From: support Date: Thu, 10 Mar 2022 13:52:22 +0000 (+0000) Subject: Built motion from commit 16cc2bd2.|2.6.5 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20110license.mail?a=commitdiff_plain;h=6a3ccdcb9915207f04604d1c44f824b9a4820161;p=motion2.git Built motion from commit 16cc2bd2.|2.6.5 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 4ff4032..c32672e 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-03-10T12:55:23.355Z", + "time": "2022-03-10T13:42:49.509Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 9a279b7..344c75e 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-03-10T12:55:23.355Z", + "time": "2022-03-10T13:42:49.509Z", "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 f97d803..f2236ff 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 _0x44e5=['urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','VIRTUAL','getDataValue','action','STRING','integration','motionbar','jscripty'];(function(_0x456626,_0x5931f8){var _0x36b37d=function(_0x5942ab){while(--_0x5942ab){_0x456626['push'](_0x456626['shift']());}};_0x36b37d(++_0x5931f8);}(_0x44e5,0x187));var _0x544e=function(_0x4dbdda,_0x11f07c){_0x4dbdda=_0x4dbdda-0x0;var _0x1acbf1=_0x44e5[_0x4dbdda];return _0x1acbf1;};'use strict';var Sequelize=require(_0x544e('0x0'));module[_0x544e('0x1')]={'name':{'type':Sequelize[_0x544e('0x2')],'get':function(_0x567ec9){return this[_0x544e('0x3')](_0x544e('0x4'));}},'action':{'type':Sequelize[_0x544e('0x5')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x544e('0x6'),_0x544e('0x7'),_0x544e('0x8'),_0x544e('0x9'),'browser',_0x544e('0xa'),_0x544e('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x544e('0xc')},'data1':{'type':Sequelize[_0x544e('0x5')](0x1000),'comment':_0x544e('0xd')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x544e('0xe')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x544e('0xf')},'data4':{'type':Sequelize[_0x544e('0x5')](0x1000),'comments':_0x544e('0x10')},'data5':{'type':Sequelize[_0x544e('0x5')](0x1000),'comments':_0x544e('0x11')},'data6':{'type':Sequelize['STRING'],'comments':_0x544e('0x12')},'data7':{'type':Sequelize[_0x544e('0x13')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xd04c=['urlForward[headers],\x20browser[wsindowHeight]','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','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]'];(function(_0x47ea0f,_0x5832ad){var _0x8b46c7=function(_0x4e02d8){while(--_0x4e02d8){_0x47ea0f['push'](_0x47ea0f['shift']());}};_0x8b46c7(++_0x5832ad);}(_0xd04c,0xd3));var _0xcd04=function(_0x5204b9,_0x224243){_0x5204b9=_0x5204b9-0x0;var _0x358775=_0xd04c[_0x5204b9];return _0x358775;};'use strict';var Sequelize=require(_0xcd04('0x0'));module[_0xcd04('0x1')]={'name':{'type':Sequelize[_0xcd04('0x2')],'get':function(_0x458085){return this[_0xcd04('0x3')](_0xcd04('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xcd04('0x5'),_0xcd04('0x6'),_0xcd04('0x7'),_0xcd04('0x8'),_0xcd04('0x9'),_0xcd04('0xa'),_0xcd04('0xb'),_0xcd04('0xc')]],'msg':_0xcd04('0xd')}},'comment':_0xcd04('0xd')},'data1':{'type':Sequelize[_0xcd04('0xe')](0x1000),'comment':_0xcd04('0xf')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0xcd04('0x10')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0xcd04('0xe')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize['STRING'],'comments':_0xcd04('0x11')},'data7':{'type':Sequelize['TEXT'],'comments':_0xcd04('0x12')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 96f02b2..ae31395 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 _0xa623=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','end','stack','name','send','body','params','Action','catch','rimraf','zip-dir','fast-json-patch','util','path','sox'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xa623,0x108));var _0x3a62=function(_0x198149,_0x390963){_0x198149=_0x198149-0x0;var _0x1357d6=_0xa623[_0x198149];return _0x1357d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3a62('0x0'));var zipdir=require(_0x3a62('0x1'));var jsonpatch=require(_0x3a62('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3a62('0x3'));var path=require(_0x3a62('0x4'));var sox=require(_0x3a62('0x5'));var csv=require(_0x3a62('0x6'));var ejs=require(_0x3a62('0x7'));var fs=require('fs');var fs_extra=require(_0x3a62('0x8'));var _=require('lodash');var squel=require(_0x3a62('0x9'));var crypto=require(_0x3a62('0xa'));var jsforce=require(_0x3a62('0xb'));var deskjs=require(_0x3a62('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3a62('0xd'));var Papa=require(_0x3a62('0xe'));var Redis=require(_0x3a62('0xf'));var authService=require(_0x3a62('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3a62('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a62('0x12'))(_0x3a62('0x13'));var utils=require(_0x3a62('0x14'));var config=require(_0x3a62('0x15'));var licenseUtil=require(_0x3a62('0x16'));var db=require(_0x3a62('0x17'))['db'];function respondWithStatusCode(_0x338271,_0x531a15){_0x531a15=_0x531a15||0xcc;return function(_0x40d543){if(_0x40d543){return _0x338271[_0x3a62('0x18')](_0x531a15);}return _0x338271[_0x3a62('0x19')](_0x531a15)['end']();};}function respondWithResult(_0x2be410,_0x162635){_0x162635=_0x162635||0xc8;return function(_0x156a35){if(_0x156a35){return _0x2be410[_0x3a62('0x19')](_0x162635)[_0x3a62('0x1a')](_0x156a35);}};}function respondWithFilteredResult(_0x1e6927,_0x3fc493){return function(_0x1d02b3){if(_0x1d02b3){var _0x580689=typeof _0x3fc493[_0x3a62('0x1b')]==='undefined'&&typeof _0x3fc493['limit']===_0x3a62('0x1c');var _0x241464=_0x1d02b3[_0x3a62('0x1d')];var _0x33dde9=_0x580689?0x0:_0x3fc493[_0x3a62('0x1b')];var _0x2e7f5e=_0x580689?_0x1d02b3[_0x3a62('0x1d')]:_0x3fc493[_0x3a62('0x1b')]+_0x3fc493[_0x3a62('0x1e')];var _0x25cc01;if(_0x2e7f5e>=_0x241464){_0x2e7f5e=_0x241464;_0x25cc01=0xc8;}else{_0x25cc01=0xce;}_0x1e6927['status'](_0x25cc01);return _0x1e6927[_0x3a62('0x1f')](_0x3a62('0x20'),_0x33dde9+'-'+_0x2e7f5e+'/'+_0x241464)[_0x3a62('0x1a')](_0x1d02b3);}return null;};}function patchUpdates(_0x23060b){return function(_0xac3c40){try{jsonpatch['apply'](_0xac3c40,_0x23060b,!![]);}catch(_0x1b0522){return BPromise[_0x3a62('0x21')](_0x1b0522);}return _0xac3c40['save']();};}function saveUpdates(_0x4bdf51,_0x56657b){return function(_0xa5d6d9){if(_0xa5d6d9){return _0xa5d6d9[_0x3a62('0x22')](_0x4bdf51)[_0x3a62('0x23')](function(_0x1113bf){return _0x1113bf;});}return null;};}function removeEntity(_0x78ef5d,_0x4f095c){return function(_0x6ae70d){if(_0x6ae70d){return _0x6ae70d[_0x3a62('0x24')]()[_0x3a62('0x23')](function(){_0x78ef5d['status'](0xcc)[_0x3a62('0x25')]();});}};}function handleEntityNotFound(_0x242538,_0x113866){return function(_0x24daa4){if(!_0x24daa4){_0x242538['sendStatus'](0x194);}return _0x24daa4;};}function handleError(_0x2f91d6,_0x2e4336){_0x2e4336=_0x2e4336||0x1f4;return function(_0x3183f5){logger['error'](_0x3183f5[_0x3a62('0x26')]);if(_0x3183f5[_0x3a62('0x27')]){delete _0x3183f5['name'];}_0x2f91d6[_0x3a62('0x19')](_0x2e4336)[_0x3a62('0x28')](_0x3183f5);};}exports[_0x3a62('0x22')]=function(_0x3cb754,_0x3ca625){if(_0x3cb754[_0x3a62('0x29')]['id']){delete _0x3cb754[_0x3a62('0x29')]['id'];}return db['Action']['find']({'where':{'id':_0x3cb754[_0x3a62('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3ca625,null))[_0x3a62('0x23')](saveUpdates(_0x3cb754[_0x3a62('0x29')],null))[_0x3a62('0x23')](respondWithResult(_0x3ca625,null))['catch'](handleError(_0x3ca625,null));};exports['destroy']=function(_0x291944,_0xce27b3){return db[_0x3a62('0x2b')]['find']({'where':{'id':_0x291944['params']['id']}})[_0x3a62('0x23')](handleEntityNotFound(_0xce27b3,null))[_0x3a62('0x23')](removeEntity(_0xce27b3,null))[_0x3a62('0x2c')](handleError(_0xce27b3,null));}; \ No newline at end of file +var _0xdc9a=['apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','Action','find','params','body','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','undefined','limit','count','offset','set','Content-Range'];(function(_0x2f131d,_0x190c7c){var _0x281910=function(_0x5cb623){while(--_0x5cb623){_0x2f131d['push'](_0x2f131d['shift']());}};_0x281910(++_0x190c7c);}(_0xdc9a,0x1c9));var _0xadc9=function(_0x2bdc75,_0x1100ec){_0x2bdc75=_0x2bdc75-0x0;var _0x103e50=_0xdc9a[_0x2bdc75];return _0x103e50;};'use strict';var emlformat=require(_0xadc9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xadc9('0x1'));var jsonpatch=require(_0xadc9('0x2'));var rp=require(_0xadc9('0x3'));var moment=require(_0xadc9('0x4'));var BPromise=require(_0xadc9('0x5'));var Mustache=require(_0xadc9('0x6'));var util=require(_0xadc9('0x7'));var path=require(_0xadc9('0x8'));var sox=require(_0xadc9('0x9'));var csv=require(_0xadc9('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xadc9('0xb'));var _=require(_0xadc9('0xc'));var squel=require(_0xadc9('0xd'));var crypto=require('crypto');var jsforce=require(_0xadc9('0xe'));var deskjs=require(_0xadc9('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xadc9('0x10'));var Redis=require(_0xadc9('0x11'));var authService=require(_0xadc9('0x12'));var qs=require(_0xadc9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xadc9('0x14'));var logger=require(_0xadc9('0x15'))(_0xadc9('0x16'));var utils=require(_0xadc9('0x17'));var config=require(_0xadc9('0x18'));var licenseUtil=require(_0xadc9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c6174,_0x4e3cac){_0x4e3cac=_0x4e3cac||0xcc;return function(_0xb19a80){if(_0xb19a80){return _0x1c6174['sendStatus'](_0x4e3cac);}return _0x1c6174[_0xadc9('0x1a')](_0x4e3cac)['end']();};}function respondWithResult(_0x20da86,_0x551cc7){_0x551cc7=_0x551cc7||0xc8;return function(_0x5e916c){if(_0x5e916c){return _0x20da86[_0xadc9('0x1a')](_0x551cc7)['json'](_0x5e916c);}};}function respondWithFilteredResult(_0x27f740,_0x4a6fb4){return function(_0x335f9d){if(_0x335f9d){var _0x3b9213=typeof _0x4a6fb4['offset']===_0xadc9('0x1b')&&typeof _0x4a6fb4[_0xadc9('0x1c')]===_0xadc9('0x1b');var _0x45d019=_0x335f9d[_0xadc9('0x1d')];var _0x3335e5=_0x3b9213?0x0:_0x4a6fb4[_0xadc9('0x1e')];var _0x7c4b21=_0x3b9213?_0x335f9d[_0xadc9('0x1d')]:_0x4a6fb4[_0xadc9('0x1e')]+_0x4a6fb4[_0xadc9('0x1c')];var _0x436dc6;if(_0x7c4b21>=_0x45d019){_0x7c4b21=_0x45d019;_0x436dc6=0xc8;}else{_0x436dc6=0xce;}_0x27f740['status'](_0x436dc6);return _0x27f740[_0xadc9('0x1f')](_0xadc9('0x20'),_0x3335e5+'-'+_0x7c4b21+'/'+_0x45d019)['json'](_0x335f9d);}return null;};}function patchUpdates(_0xaa0540){return function(_0x3baeea){try{jsonpatch[_0xadc9('0x21')](_0x3baeea,_0xaa0540,!![]);}catch(_0x1253f7){return BPromise[_0xadc9('0x22')](_0x1253f7);}return _0x3baeea[_0xadc9('0x23')]();};}function saveUpdates(_0x52c03a,_0x50dd06){return function(_0xbce0a2){if(_0xbce0a2){return _0xbce0a2[_0xadc9('0x24')](_0x52c03a)[_0xadc9('0x25')](function(_0x2e73a9){return _0x2e73a9;});}return null;};}function removeEntity(_0x64dbb8,_0x35c2d3){return function(_0x1a7d57){if(_0x1a7d57){return _0x1a7d57[_0xadc9('0x26')]()['then'](function(){_0x64dbb8['status'](0xcc)[_0xadc9('0x27')]();});}};}function handleEntityNotFound(_0x5d1a9d,_0x145aec){return function(_0x5b3b38){if(!_0x5b3b38){_0x5d1a9d[_0xadc9('0x28')](0x194);}return _0x5b3b38;};}function handleError(_0x5e97e1,_0x414a1a){_0x414a1a=_0x414a1a||0x1f4;return function(_0x1e14e4){logger[_0xadc9('0x29')](_0x1e14e4[_0xadc9('0x2a')]);if(_0x1e14e4[_0xadc9('0x2b')]){delete _0x1e14e4[_0xadc9('0x2b')];}_0x5e97e1[_0xadc9('0x1a')](_0x414a1a)['send'](_0x1e14e4);};}exports[_0xadc9('0x24')]=function(_0x51349f,_0x2741e9){if(_0x51349f['body']['id']){delete _0x51349f['body']['id'];}return db[_0xadc9('0x2c')][_0xadc9('0x2d')]({'where':{'id':_0x51349f[_0xadc9('0x2e')]['id']}})[_0xadc9('0x25')](handleEntityNotFound(_0x2741e9,null))[_0xadc9('0x25')](saveUpdates(_0x51349f[_0xadc9('0x2f')],null))['then'](respondWithResult(_0x2741e9,null))[_0xadc9('0x30')](handleError(_0x2741e9,null));};exports[_0xadc9('0x26')]=function(_0x4118cd,_0x1bb776){return db[_0xadc9('0x2c')][_0xadc9('0x2d')]({'where':{'id':_0x4118cd[_0xadc9('0x2e')]['id']}})[_0xadc9('0x25')](handleEntityNotFound(_0x1bb776,null))[_0xadc9('0x25')](removeEntity(_0x1bb776,null))[_0xadc9('0x30')](handleError(_0x1bb776,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 5802e97..128fa82 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 _0x39fd=['define','tools_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x39fd,0x1d6));var _0xd39f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x39fd[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xd39f('0x0'));var util=require(_0xd39f('0x1'));var logger=require(_0xd39f('0x2'))('api');var moment=require(_0xd39f('0x3'));var BPromise=require(_0xd39f('0x4'));var rp=require(_0xd39f('0x5'));var fs=require('fs');var path=require(_0xd39f('0x6'));var rimraf=require(_0xd39f('0x7'));var config=require(_0xd39f('0x8'));var attributes=require(_0xd39f('0x9'));module[_0xd39f('0xa')]=function(_0x7252de,_0x4b6567){return _0x7252de[_0xd39f('0xb')]('Action',attributes,{'tableName':_0xd39f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a21=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','define','Action','tools_actions','lodash','util','../../config/logger'];(function(_0x246e91,_0x2960aa){var _0x3d3e82=function(_0x1f243a){while(--_0x1f243a){_0x246e91['push'](_0x246e91['shift']());}};_0x3d3e82(++_0x2960aa);}(_0x1a21,0x1d9));var _0x11a2=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x1a21[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x11a2('0x0'));var util=require(_0x11a2('0x1'));var logger=require(_0x11a2('0x2'))(_0x11a2('0x3'));var moment=require(_0x11a2('0x4'));var BPromise=require(_0x11a2('0x5'));var rp=require(_0x11a2('0x6'));var fs=require('fs');var path=require(_0x11a2('0x7'));var rimraf=require(_0x11a2('0x8'));var config=require(_0x11a2('0x9'));var attributes=require(_0x11a2('0xa'));module['exports']=function(_0x25ba2c,_0x374aa3){return _0x25ba2c[_0x11a2('0xb')](_0x11a2('0xc'),attributes,{'tableName':_0x11a2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 631d40a..008e8d1 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 _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\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(_0x226685,_0x54f77d){var _0x12ed69=function(_0xc9411d){while(--_0xc9411d){_0x226685['push'](_0x226685['shift']());}};_0x12ed69(++_0x54f77d);}(_0x1261,0x144));var _0x1126=function(_0x9df3d8,_0x4074e3){_0x9df3d8=_0x9df3d8-0x0;var _0x366da1=_0x1261[_0x9df3d8];return _0x366da1;};'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')]('Action,\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 _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4ab3fb,_0x776775){var _0x34fe1e=function(_0x1c94c5){while(--_0x1c94c5){_0x4ab3fb['push'](_0x4ab3fb['shift']());}};_0x34fe1e(++_0x776775);}(_0xf494,0x1c6));var _0x4f49=function(_0x48a169,_0x25ac39){_0x48a169=_0x48a169-0x0;var _0x171f2e=_0xf494[_0x48a169];return _0x171f2e;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 9e1181a..980edbb 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 _0xafc2=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','delete','isAuthenticated','exports','multer'];(function(_0x460114,_0x4e0935){var _0x5a124f=function(_0x2e26bd){while(--_0x2e26bd){_0x460114['push'](_0x460114['shift']());}};_0x5a124f(++_0x4e0935);}(_0xafc2,0x8b));var _0x2afc=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xafc2[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x2afc('0x0'));var util=require(_0x2afc('0x1'));var path=require(_0x2afc('0x2'));var timeout=require(_0x2afc('0x3'));var express=require(_0x2afc('0x4'));var router=express[_0x2afc('0x5')]();var fs_extra=require(_0x2afc('0x6'));var auth=require(_0x2afc('0x7'));var interaction=require(_0x2afc('0x8'));var config=require(_0x2afc('0x9'));var controller=require('./action.controller');router['put'](_0x2afc('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x2afc('0xb')](_0x2afc('0xa'),auth[_0x2afc('0xc')](),controller['destroy']);module[_0x2afc('0xd')]=router; \ No newline at end of file +var _0x648a=['Router','../../components/auth/service','../../config/environment','put','/:id','isAuthenticated','update','delete','destroy','util','express'];(function(_0x245545,_0x4983b3){var _0x106a5f=function(_0x278277){while(--_0x278277){_0x245545['push'](_0x245545['shift']());}};_0x106a5f(++_0x4983b3);}(_0x648a,0x1e2));var _0xa648=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x648a[_0x342baa];return _0x1208f3;};'use strict';var multer=require('multer');var util=require(_0xa648('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa648('0x1'));var router=express[_0xa648('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa648('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa648('0x4'));var controller=require('./action.controller');router[_0xa648('0x5')](_0xa648('0x6'),auth[_0xa648('0x7')](),controller[_0xa648('0x8')]);router[_0xa648('0x9')](_0xa648('0x6'),auth[_0xa648('0x7')](),controller[_0xa648('0xa')]);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 f8e8a83..341bcdb 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 _0xae24=['sequelize','STRING'];(function(_0x4e5770,_0x194f1e){var _0x32f748=function(_0x467fe2){while(--_0x467fe2){_0x4e5770['push'](_0x4e5770['shift']());}};_0x32f748(++_0x194f1e);}(_0xae24,0x182));var _0x4ae2=function(_0x2afa27,_0x1fd584){_0x2afa27=_0x2afa27-0x0;var _0x262db6=_0xae24[_0x2afa27];return _0x262db6;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ae2('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4ae2('0x1')]},'table':{'type':Sequelize[_0x4ae2('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x814b=['STRING','TEXT','sequelize','exports'];(function(_0x43719c,_0x3d52e2){var _0x5c4f8a=function(_0x29f2b3){while(--_0x29f2b3){_0x43719c['push'](_0x43719c['shift']());}};_0x5c4f8a(++_0x3d52e2);}(_0x814b,0x1a2));var _0xb814=function(_0x4b1012,_0x1415eb){_0x4b1012=_0x4b1012-0x0;var _0x23d715=_0x814b[_0x4b1012];return _0x23d715;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'name':{'type':Sequelize[_0xb814('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb814('0x2')]},'parent':{'type':Sequelize[_0xb814('0x2')]},'table':{'type':Sequelize[_0xb814('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xb814('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 2ef0c85..3e918c4 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 _0x5360=['%s-%s.%s','randomstring','generate','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','alias','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','get','CustomReports','end','error','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','autoAssociation','UserProfileResource','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','joins','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','AnalyticMetric','findAll','select','output','web','fullPath'];(function(_0x3f0ac0,_0x117243){var _0x2bb684=function(_0x287d0d){while(--_0x287d0d){_0x3f0ac0['push'](_0x3f0ac0['shift']());}};_0x2bb684(++_0x117243);}(_0x5360,0x157));var _0x0536=function(_0x53517b,_0x23472d){_0x53517b=_0x53517b-0x0;var _0x2031a8=_0x5360[_0x53517b];return _0x2031a8;};'use strict';var emlformat=require(_0x0536('0x0'));var rimraf=require(_0x0536('0x1'));var zipdir=require(_0x0536('0x2'));var jsonpatch=require(_0x0536('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0536('0x4'));var Mustache=require('mustache');var util=require(_0x0536('0x5'));var path=require(_0x0536('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0536('0x7'));var _=require(_0x0536('0x8'));var squel=require(_0x0536('0x9'));var crypto=require(_0x0536('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0536('0xb'));var toCsv=require(_0x0536('0xc'));var querystring=require(_0x0536('0xd'));var Papa=require('papaparse');var Redis=require(_0x0536('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(_0x0536('0xf'))(_0x0536('0x10'));var utils=require(_0x0536('0x11'));var config=require(_0x0536('0x12'));var licenseUtil=require(_0x0536('0x13'));var db=require(_0x0536('0x14'))['db'];var dbH=require(_0x0536('0x14'))[_0x0536('0x15')];function respondWithStatusCode(_0x46da69,_0x1d2790){_0x1d2790=_0x1d2790||0xcc;return function(_0x2552aa){if(_0x2552aa){return _0x46da69[_0x0536('0x16')](_0x1d2790);}return _0x46da69[_0x0536('0x17')](_0x1d2790)['end']();};}function respondWithResult(_0x29123b,_0x114f64){_0x114f64=_0x114f64||0xc8;return function(_0xcd2622){if(_0xcd2622){return _0x29123b[_0x0536('0x17')](_0x114f64)[_0x0536('0x18')](_0xcd2622);}};}function respondWithFilteredResult(_0x58dddc,_0x3d6b68){return function(_0x3785ba){if(_0x3785ba){var _0x1ea9db=typeof _0x3d6b68[_0x0536('0x19')]==='undefined'&&typeof _0x3d6b68['limit']===_0x0536('0x1a');var _0x25fb28=_0x3785ba[_0x0536('0x1b')];var _0x5c676c=_0x1ea9db?0x0:_0x3d6b68['offset'];var _0x260faa=_0x1ea9db?_0x3785ba[_0x0536('0x1b')]:_0x3d6b68['offset']+_0x3d6b68[_0x0536('0x1c')];var _0xe7d2f;if(_0x260faa>=_0x25fb28){_0x260faa=_0x25fb28;_0xe7d2f=0xc8;}else{_0xe7d2f=0xce;}_0x58dddc[_0x0536('0x17')](_0xe7d2f);return _0x58dddc[_0x0536('0x1d')](_0x0536('0x1e'),_0x5c676c+'-'+_0x260faa+'/'+_0x25fb28)['json'](_0x3785ba);}return null;};}function patchUpdates(_0x173414){return function(_0x51ba52){try{jsonpatch['apply'](_0x51ba52,_0x173414,!![]);}catch(_0x21f3ae){return BPromise[_0x0536('0x1f')](_0x21f3ae);}return _0x51ba52[_0x0536('0x20')]();};}function saveUpdates(_0x2f5ebd,_0x139523){return function(_0x3a54ab){if(_0x3a54ab){return _0x3a54ab[_0x0536('0x21')](_0x2f5ebd)['then'](function(_0x475b87){return _0x475b87;});}return null;};}function removeEntity(_0x3e3542,_0x5a52b0){return function(_0x3294da){if(_0x3294da){return _0x3294da[_0x0536('0x22')]()[_0x0536('0x23')](function(){var _0x4e3287=_0x3294da[_0x0536('0x24')]({'plain':!![]});var _0x290701=_0x0536('0x25');return db['UserProfileResource'][_0x0536('0x22')]({'where':{'type':_0x290701,'resourceId':_0x4e3287['id']}})[_0x0536('0x23')](function(){return _0x3294da;});})[_0x0536('0x23')](function(){_0x3e3542[_0x0536('0x17')](0xcc)[_0x0536('0x26')]();});}};}function handleEntityNotFound(_0x83fa55,_0x81b08c){return function(_0x1fe89a){if(!_0x1fe89a){_0x83fa55[_0x0536('0x16')](0x194);}return _0x1fe89a;};}function handleError(_0x2e3ab1,_0x5f4b92){_0x5f4b92=_0x5f4b92||0x1f4;return function(_0x2ab6dd){logger[_0x0536('0x27')](_0x2ab6dd['stack']);if(_0x2ab6dd[_0x0536('0x28')]){delete _0x2ab6dd[_0x0536('0x28')];}_0x2e3ab1[_0x0536('0x17')](_0x5f4b92)[_0x0536('0x29')](_0x2ab6dd);};}exports['index']=function(_0x2e5ad0,_0x562ce1){var _0x4a74d3={},_0x2d8700={},_0x32121a={'count':0x0,'rows':[]};var _0x1efa98=_[_0x0536('0x2a')](db[_0x0536('0x2b')][_0x0536('0x2c')],function(_0x5830e0){return{'name':_0x5830e0[_0x0536('0x2d')],'type':_0x5830e0[_0x0536('0x2e')]['key']};});_0x2d8700[_0x0536('0x2f')]=_['map'](_0x1efa98,_0x0536('0x28'));_0x2d8700[_0x0536('0x30')]=_[_0x0536('0x31')](_0x2e5ad0[_0x0536('0x30')]);_0x2d8700[_0x0536('0x32')]=_[_0x0536('0x33')](_0x2d8700['model'],_0x2d8700[_0x0536('0x30')]);_0x4a74d3['attributes']=_['intersection'](_0x2d8700[_0x0536('0x2f')],qs[_0x0536('0x34')](_0x2e5ad0[_0x0536('0x30')]['fields']));_0x4a74d3[_0x0536('0x35')]=_0x4a74d3[_0x0536('0x35')][_0x0536('0x36')]?_0x4a74d3[_0x0536('0x35')]:_0x2d8700[_0x0536('0x2f')];if(!_0x2e5ad0['query'][_0x0536('0x37')](_0x0536('0x38'))){_0x4a74d3[_0x0536('0x1c')]=qs[_0x0536('0x1c')](_0x2e5ad0[_0x0536('0x30')]['limit']);_0x4a74d3[_0x0536('0x19')]=qs['offset'](_0x2e5ad0[_0x0536('0x30')][_0x0536('0x19')]);}_0x4a74d3[_0x0536('0x39')]=qs['sort'](_0x2e5ad0[_0x0536('0x30')][_0x0536('0x3a')]);_0x4a74d3[_0x0536('0x3b')]=qs[_0x0536('0x32')](_['pick'](_0x2e5ad0[_0x0536('0x30')],_0x2d8700[_0x0536('0x32')]),_0x1efa98);if(_0x2e5ad0['query'][_0x0536('0x3c')]){_0x4a74d3['where']=_['merge'](_0x4a74d3[_0x0536('0x3b')],{'$or':_[_0x0536('0x2a')](_0x1efa98,function(_0x29c9df){if(_0x29c9df['type']!=='VIRTUAL'){var _0x582325={};_0x582325[_0x29c9df[_0x0536('0x28')]]={'$like':'%'+_0x2e5ad0[_0x0536('0x30')]['filter']+'%'};return _0x582325;}})});}_0x4a74d3=_[_0x0536('0x3d')]({},_0x4a74d3,_0x2e5ad0[_0x0536('0x3e')]);var _0x3f5ef2={'where':_0x4a74d3[_0x0536('0x3b')]};return db['AnalyticCustomReport'][_0x0536('0x1b')](_0x3f5ef2)[_0x0536('0x23')](function(_0x25f37e){_0x32121a[_0x0536('0x1b')]=_0x25f37e;if(_0x2e5ad0[_0x0536('0x30')][_0x0536('0x3f')]){_0x4a74d3[_0x0536('0x40')]=[{'all':!![]}];}return db[_0x0536('0x2b')]['findAll'](_0x4a74d3);})[_0x0536('0x23')](function(_0x18f9da){_0x32121a[_0x0536('0x41')]=_0x18f9da;return _0x32121a;})['then'](respondWithFilteredResult(_0x562ce1,_0x4a74d3))[_0x0536('0x42')](handleError(_0x562ce1,null));};exports[_0x0536('0x43')]=function(_0x41deb2,_0x251555){var _0x3a765b={'raw':![],'where':{'id':_0x41deb2[_0x0536('0x44')]['id']}},_0x49c5b7={};_0x49c5b7[_0x0536('0x2f')]=_['keys'](db[_0x0536('0x2b')][_0x0536('0x2c')]);_0x49c5b7[_0x0536('0x30')]=_[_0x0536('0x31')](_0x41deb2[_0x0536('0x30')]);_0x49c5b7[_0x0536('0x32')]=_[_0x0536('0x33')](_0x49c5b7['model'],_0x49c5b7['query']);_0x3a765b[_0x0536('0x35')]=_[_0x0536('0x33')](_0x49c5b7[_0x0536('0x2f')],qs[_0x0536('0x34')](_0x41deb2[_0x0536('0x30')][_0x0536('0x34')]));_0x3a765b[_0x0536('0x35')]=_0x3a765b[_0x0536('0x35')]['length']?_0x3a765b[_0x0536('0x35')]:_0x49c5b7[_0x0536('0x2f')];if(_0x41deb2['query'][_0x0536('0x3f')]){_0x3a765b['include']=[{'all':!![]}];}_0x3a765b=_[_0x0536('0x3d')]({},_0x3a765b,_0x41deb2[_0x0536('0x3e')]);return db['AnalyticCustomReport']['find'](_0x3a765b)[_0x0536('0x23')](handleEntityNotFound(_0x251555,null))[_0x0536('0x23')](respondWithResult(_0x251555,null))[_0x0536('0x42')](handleError(_0x251555,null));};exports[_0x0536('0x45')]=function(_0x284c5b,_0x342a67){return db[_0x0536('0x2b')][_0x0536('0x45')](_0x284c5b[_0x0536('0x46')],{})[_0x0536('0x23')](function(_0x632a91){var _0x2a801b=_0x284c5b[_0x0536('0x47')]['get']({'plain':!![]});if(!_0x2a801b)throw new Error(_0x0536('0x48'));if(_0x2a801b[_0x0536('0x49')]===_0x0536('0x47')){var _0x4d356c=_0x632a91[_0x0536('0x24')]({'plain':!![]});var _0xda98ac=_0x0536('0x4a');return db[_0x0536('0x4b')][_0x0536('0x4c')]({'where':{'name':_0xda98ac,'userProfileId':_0x2a801b['userProfileId']},'raw':!![]})[_0x0536('0x23')](function(_0x36807b){if(_0x36807b&&_0x36807b[_0x0536('0x4d')]===0x0){return db[_0x0536('0x4e')][_0x0536('0x45')]({'name':_0x4d356c[_0x0536('0x28')],'resourceId':_0x4d356c['id'],'type':_0x0536('0x25'),'sectionId':_0x36807b['id']},{})['then'](function(){return _0x632a91;});}else{return _0x632a91;}})[_0x0536('0x42')](function(_0x12172a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12172a);throw _0x12172a;});}return _0x632a91;})[_0x0536('0x23')](respondWithResult(_0x342a67,0xc9))[_0x0536('0x42')](handleError(_0x342a67,null));};exports[_0x0536('0x21')]=function(_0x3e247e,_0x126103){if(_0x3e247e['body']['id']){delete _0x3e247e[_0x0536('0x46')]['id'];}return db['AnalyticCustomReport'][_0x0536('0x4c')]({'where':{'id':_0x3e247e[_0x0536('0x44')]['id']}})[_0x0536('0x23')](handleEntityNotFound(_0x126103,null))[_0x0536('0x23')](saveUpdates(_0x3e247e[_0x0536('0x46')],null))[_0x0536('0x23')](respondWithResult(_0x126103,null))[_0x0536('0x42')](handleError(_0x126103,null));};exports[_0x0536('0x22')]=function(_0x10022f,_0x35da14){return db[_0x0536('0x2b')][_0x0536('0x4c')]({'where':{'id':_0x10022f[_0x0536('0x44')]['id']}})[_0x0536('0x23')](handleEntityNotFound(_0x35da14,null))['then'](removeEntity(_0x35da14,null))['catch'](handleError(_0x35da14,null));};exports['preview']=function(_0x524553,_0x2e0005){var _0x4e05f2=0xa;var _0x502938=[_0x0536('0x4f'),_0x0536('0x50'),_0x0536('0x51'),_0x0536('0x52')];var _0x502172={'SUM':_0x0536('0x53'),'COUNT':_0x0536('0x54'),'COUNT DISTINCT':_0x0536('0x55'),'MAX':_0x0536('0x56'),'MIN':'MIN(%s)','AVG':_0x0536('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x0536('0x58')};var _0x2cbc1e={'SEC_TO_TIME':_0x0536('0x59'),'DATE':_0x0536('0x5a'),'HOUR':_0x0536('0x5b'),'ROUND':_0x0536('0x5c'),'UNIX_TIMESTAMP':_0x0536('0x5d')};var _0xbc7916=function(_0x291dae){return!_['includes']([_0x0536('0x5e'),_0x0536('0x5f'),_0x0536('0x60'),_0x0536('0x61')],_0x291dae);};var _0x236d1a=function(_0x275039){if(!_0x275039||!_0x275039[_0x0536('0x62')][_0x0536('0x36')]){return'';}for(var _0x26cbf5='(',_0x4ea409=0x0;_0x4ea409<_0x275039[_0x0536('0x62')][_0x0536('0x36')];_0x4ea409+=0x1){_0x4ea409>0x0&&(_0x26cbf5+='\x20'+_0x275039[_0x0536('0x63')]+'\x20');_0x26cbf5+=_0x275039[_0x0536('0x62')][_0x4ea409][_0x0536('0x64')]?_0x236d1a(_0x275039[_0x0536('0x62')][_0x4ea409][_0x0536('0x64')]):_0x275039['rules'][_0x4ea409][_0x0536('0x65')]+'\x20'+_0x275039[_0x0536('0x62')][_0x4ea409]['condition']+(_0xbc7916(_0x275039[_0x0536('0x62')][_0x4ea409][_0x0536('0x66')])?'\x20'+_0x275039['rules'][_0x4ea409][_0x0536('0x67')]:'');}return _0x26cbf5+')';};var _0x2f7ae7={'where':{'id':_0x524553[_0x0536('0x44')]['id']}},_0x508700,_0x4b91ac,_0x182066,_0x2a955a,_0x6de5f9;_0x2f7ae7=_['merge']({},_0x2f7ae7,_0x524553[_0x0536('0x3e')]);return db[_0x0536('0x2b')]['find'](_0x2f7ae7)[_0x0536('0x23')](function(_0x196020){if(_0x196020){_0x508700=_0x196020;return _0x196020[_0x0536('0x68')]();}return null;})[_0x0536('0x23')](function(_0x1d7fbe){if(_0x1d7fbe){if(!_0x1d7fbe[_0x0536('0x36')]){throw new db[(_0x0536('0x69'))][(_0x0536('0x6a'))](_0x0536('0x6b'),0x193);}_0x4b91ac=_0x1d7fbe;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x0536('0x23')](function(_0x584d6b){if(_0x584d6b){_0x182066=_[_0x0536('0x6c')](_0x584d6b,'id');var _0x4445fb;var _0x56a8b9=squel['select']();_0x56a8b9[_0x0536('0x6d')](_0x508700[_0x0536('0x6e')]);for(var _0x5aa832=0x0;_0x5aa832<_0x4b91ac[_0x0536('0x36')];_0x5aa832+=0x1){_0x4445fb=_0x4b91ac[_0x5aa832][_0x0536('0x6f')]?_0x182066[_0x4b91ac[_0x5aa832][_0x0536('0x6f')]][_0x0536('0x70')]:_0x4b91ac[_0x5aa832]['field'];_0x4445fb=_0x4b91ac[_0x5aa832][_0x0536('0x71')]?_[_0x0536('0x72')](_0x502172[_0x4b91ac[_0x5aa832][_0x0536('0x71')]],'%s',_0x4445fb):_0x4445fb;_0x4445fb=_0x4b91ac[_0x5aa832]['format']?_[_0x0536('0x72')](_0x2cbc1e[_0x4b91ac[_0x5aa832][_0x0536('0x73')]],'%s',_0x4445fb):_0x4445fb;if(_0x4b91ac[_0x5aa832][_0x0536('0x74')]){_0x56a8b9['group'](_0x4445fb);}_0x4b91ac[_0x5aa832][_0x0536('0x75')]&&_0x56a8b9[_0x0536('0x39')](_0x4445fb,_0x4b91ac[_0x5aa832][_0x0536('0x75')]===_0x0536('0x76')?![]:!![]);_0x56a8b9['field'](_0x4445fb,_0x4b91ac[_0x5aa832]['alias']||_0x4445fb);}if(_0x508700['joins']){_0x508700[_0x0536('0x77')]=JSON['parse'](_0x508700['joins']);for(var _0x2cf2d4=0x0;_0x2cf2d4<_0x508700[_0x0536('0x77')]['length'];_0x2cf2d4+=0x1){if(_0x508700[_0x0536('0x77')][_0x2cf2d4][_0x0536('0x2e')]&&_[_0x0536('0x78')](_0x502938,_0x508700[_0x0536('0x77')][_0x2cf2d4]['type'])&&_0x508700[_0x0536('0x77')][_0x2cf2d4][_0x0536('0x79')]&&_0x508700[_0x0536('0x77')][_0x2cf2d4][_0x0536('0x7a')]&&_0x508700[_0x0536('0x77')][_0x2cf2d4]['foreignKey']){_0x56a8b9[_0x508700[_0x0536('0x77')][_0x2cf2d4][_0x0536('0x2e')]](_0x508700[_0x0536('0x77')][_0x2cf2d4][_0x0536('0x7a')],null,util[_0x0536('0x73')](_0x0536('0x7b'),_0x508700['table'],_0x508700[_0x0536('0x77')][_0x2cf2d4][_0x0536('0x79')],_0x508700[_0x0536('0x77')][_0x2cf2d4]['foreignTable'],_0x508700['joins'][_0x2cf2d4][_0x0536('0x7c')]));}}}if(_0x508700[_0x0536('0x7d')]){_0x508700[_0x0536('0x7d')]=JSON[_0x0536('0x7e')](_0x508700[_0x0536('0x7d')]);_0x56a8b9[_0x0536('0x3b')](_0x236d1a(_0x508700[_0x0536('0x7d')][_0x0536('0x64')]));}_0x6de5f9=_0x56a8b9[_0x0536('0x7f')]();_0x56a8b9[_0x0536('0x1c')](_0x4e05f2);_0x56a8b9[_0x0536('0x19')](0x0);logger[_0x0536('0x80')](_0x0536('0x81'),_0x56a8b9[_0x0536('0x82')]());return dbH['sequelize'][_0x0536('0x30')](_0x56a8b9[_0x0536('0x82')](),{'type':dbH[_0x0536('0x83')][_0x0536('0x84')][_0x0536('0x85')]});}})['then'](respondWithResult(_0x2e0005,null))[_0x0536('0x42')](handleError(_0x2e0005,null));};function runReport(_0x59854a,_0x3a7fbf,_0x215811){var _0xe638c8=_0x3a7fbf[_0x0536('0x28')];var _0x436023=0xa;var _0x928050=[_0x0536('0x4f'),_0x0536('0x50'),_0x0536('0x51'),_0x0536('0x52')];var _0x5b8af9={'SUM':_0x0536('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x0536('0x55'),'MAX':_0x0536('0x56'),'MIN':_0x0536('0x86'),'AVG':_0x0536('0x57'),'GROUP_CONCAT':_0x0536('0x87'),'GROUP_CONCAT ASC':_0x0536('0x88'),'GROUP_CONCAT DESC':_0x0536('0x58')};var _0x35dbb6={'SEC_TO_TIME':_0x0536('0x59'),'DATE':'DATE(%s)','HOUR':_0x0536('0x5b'),'ROUND':_0x0536('0x5c'),'UNIX_TIMESTAMP':_0x0536('0x5d')};var _0x55028f=function(_0x955667){return!_[_0x0536('0x78')]([_0x0536('0x5e'),_0x0536('0x5f'),_0x0536('0x60'),_0x0536('0x61')],_0x955667);};var _0x4f0beb=function(_0x465f28){if(!_0x465f28||!_0x465f28[_0x0536('0x62')]['length']){return'';}for(var _0xcf7892='(',_0x311ca5=0x0;_0x311ca5<_0x465f28[_0x0536('0x62')]['length'];_0x311ca5+=0x1){_0x311ca5>0x0&&(_0xcf7892+='\x20'+_0x465f28[_0x0536('0x63')]+'\x20');_0xcf7892+=_0x465f28[_0x0536('0x62')][_0x311ca5][_0x0536('0x64')]?_0x4f0beb(_0x465f28[_0x0536('0x62')][_0x311ca5][_0x0536('0x64')]):_0x465f28[_0x0536('0x62')][_0x311ca5]['field']+'\x20'+_0x465f28[_0x0536('0x62')][_0x311ca5][_0x0536('0x66')]+(_0x55028f(_0x465f28[_0x0536('0x62')][_0x311ca5][_0x0536('0x66')])?'\x20'+_0x465f28[_0x0536('0x62')][_0x311ca5][_0x0536('0x67')]:'');}return _0xcf7892+')';};var _0xe1c650={'where':{'id':_0x59854a['id']}},_0x49aa80,_0x52c853,_0x2ce85a,_0x23b32f,_0x2680c1;_0xe1c650=_['merge']({},_0xe1c650,_0x215811);return db[_0x0536('0x2b')][_0x0536('0x4c')](_0xe1c650)[_0x0536('0x23')](function(_0x490d5d){if(_0x490d5d){_0x49aa80=_0x490d5d;return _0x490d5d['getFields']();}return null;})[_0x0536('0x23')](function(_0x24e44a){if(_0x24e44a){if(!_0x24e44a['length']){throw new db[(_0x0536('0x69'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x52c853=_0x24e44a;return db[_0x0536('0x89')][_0x0536('0x8a')]({'raw':!![]});}return null;})[_0x0536('0x23')](function(_0xb0a97){if(_0xb0a97){_0x2ce85a=_[_0x0536('0x6c')](_0xb0a97,'id');var _0x28896c;var _0x3ae3cb=squel[_0x0536('0x8b')]();_0x3ae3cb[_0x0536('0x6d')](_0x49aa80[_0x0536('0x6e')]);for(var _0x4eceb4=0x0;_0x4eceb4<_0x52c853[_0x0536('0x36')];_0x4eceb4+=0x1){_0x28896c=_0x52c853[_0x4eceb4][_0x0536('0x6f')]?_0x2ce85a[_0x52c853[_0x4eceb4][_0x0536('0x6f')]][_0x0536('0x70')]:_0x52c853[_0x4eceb4][_0x0536('0x65')];_0x28896c=_0x52c853[_0x4eceb4]['function']?_[_0x0536('0x72')](_0x5b8af9[_0x52c853[_0x4eceb4][_0x0536('0x71')]],'%s',_0x28896c):_0x28896c;_0x28896c=_0x52c853[_0x4eceb4]['format']?_[_0x0536('0x72')](_0x35dbb6[_0x52c853[_0x4eceb4]['format']],'%s',_0x28896c):_0x28896c;if(_0x52c853[_0x4eceb4][_0x0536('0x74')]){_0x3ae3cb['group'](_0x28896c);}_0x52c853[_0x4eceb4][_0x0536('0x75')]&&_0x3ae3cb[_0x0536('0x39')](_0x28896c,_0x52c853[_0x4eceb4][_0x0536('0x75')]===_0x0536('0x76')?![]:!![]);_0x3ae3cb['field'](_0x28896c,_0x52c853[_0x4eceb4]['alias']||_0x28896c);}if(_0x49aa80[_0x0536('0x77')]){_0x49aa80[_0x0536('0x77')]=JSON[_0x0536('0x7e')](_0x49aa80['joins']);for(var _0x20c413=0x0;_0x20c413<_0x49aa80[_0x0536('0x77')][_0x0536('0x36')];_0x20c413+=0x1){if(_0x49aa80[_0x0536('0x77')][_0x20c413][_0x0536('0x2e')]&&_[_0x0536('0x78')](_0x928050,_0x49aa80[_0x0536('0x77')][_0x20c413][_0x0536('0x2e')])&&_0x49aa80[_0x0536('0x77')][_0x20c413][_0x0536('0x79')]&&_0x49aa80[_0x0536('0x77')][_0x20c413][_0x0536('0x7a')]&&_0x49aa80[_0x0536('0x77')][_0x20c413][_0x0536('0x7c')]){_0x3ae3cb[_0x49aa80[_0x0536('0x77')][_0x20c413][_0x0536('0x2e')]](_0x49aa80[_0x0536('0x77')][_0x20c413]['foreignTable'],null,util[_0x0536('0x73')](_0x0536('0x7b'),_0x49aa80['table'],_0x49aa80[_0x0536('0x77')][_0x20c413]['parentKey'],_0x49aa80[_0x0536('0x77')][_0x20c413][_0x0536('0x7a')],_0x49aa80[_0x0536('0x77')][_0x20c413][_0x0536('0x7c')]));}}}if(_0x49aa80[_0x0536('0x7d')]){_0x49aa80[_0x0536('0x7d')]=JSON[_0x0536('0x7e')](_0x49aa80[_0x0536('0x7d')]);_0x3ae3cb[_0x0536('0x3b')](_0x4f0beb(_0x49aa80[_0x0536('0x7d')][_0x0536('0x64')]));}_0x2680c1=_0x3ae3cb[_0x0536('0x7f')]();_0x3ae3cb['limit'](_0x436023);_0x3ae3cb[_0x0536('0x19')](0x0);return;}})[_0x0536('0x23')](function(){if(_0x3a7fbf[_0x0536('0x8c')]===_0x0536('0x8d')){return null;}var _0x5a2f99=_[_0x0536('0x3d')](_0x3a7fbf,{'name':_0x3a7fbf[_0x0536('0x8e')]||_0x3a7fbf[_0x0536('0x28')]||_0x49aa80[_0x0536('0x28')],'basename':_0xe638c8,'savename':util[_0x0536('0x73')](_0x0536('0x8f'),_0x3a7fbf[_0x0536('0x28')]||_0x49aa80[_0x0536('0x28')],require(_0x0536('0x90'))[_0x0536('0x91')](0x4),_0x3a7fbf['output']||'csv'),'reportId':_0x49aa80['id'],'reportType':'custom'});return db[_0x0536('0x92')][_0x0536('0x45')](_0x5a2f99,{'raw':!![]});})[_0x0536('0x23')](function(_0x1a5c5b){if(_0x49aa80['table']==='cdr'){_0x2680c1['where'](_0x49aa80[_0x0536('0x6e')]+_0x0536('0x93'),_0x3a7fbf[_0x0536('0x94')],_0x3a7fbf[_0x0536('0x95')]);}else{_0x2680c1['where'](_0x49aa80[_0x0536('0x6e')]+_0x0536('0x96'),_0x3a7fbf[_0x0536('0x94')],_0x3a7fbf[_0x0536('0x95')]);}if(_0x1a5c5b){logger[_0x0536('0x97')](_0x0536('0x98'),_0x2680c1[_0x0536('0x82')]());require(_0x0536('0x99'))['fork'](path[_0x0536('0x4f')](__dirname,_0x0536('0x9a'),_0x1a5c5b['output']),[_0x1a5c5b['id'],_0x2680c1['toString'](),path[_0x0536('0x4f')](__dirname,_0x0536('0x9b'),_0x1a5c5b[_0x0536('0x9c')]),_0xe638c8]);return _0x1a5c5b;}else{var _0x5b0149=squel[_0x0536('0x8b')]();_0x5b0149['from']('('+_0x2680c1[_0x0536('0x82')]()+')',_0x0536('0x9d'));_0x5b0149[_0x0536('0x65')](_0x0536('0x9e'),_0x0536('0x1b'));_0x2680c1[_0x0536('0x1c')](_0x3a7fbf['limit']||_0x436023);_0x2680c1['offset'](_0x3a7fbf[_0x0536('0x19')]||0x0);return dbH[_0x0536('0x83')][_0x0536('0x30')](_0x5b0149[_0x0536('0x82')](),{'type':dbH[_0x0536('0x83')][_0x0536('0x84')][_0x0536('0x85')]})['then'](function(_0x4b2a88){if(!_0x4b2a88['length']){_0x23b32f=0x0;}else{_0x23b32f=_0x4b2a88[0x0][_0x0536('0x1b')]||0x0;}return dbH[_0x0536('0x83')][_0x0536('0x30')](_0x2680c1['toString'](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0x0536('0x23')](function(_0x37e324){return{'rows':_0x37e324||[],'count':_0x23b32f};});}});}exports[_0x0536('0x9f')]=function(_0x1ca1bf,_0x37bc19){return runReport(_0x1ca1bf[_0x0536('0x44')],_0x1ca1bf['query'],_0x1ca1bf[_0x0536('0x3e')])['then'](respondWithResult(_0x37bc19,null))[_0x0536('0x42')](handleError(_0x37bc19,null));};exports[_0x0536('0xa0')]=runReport;exports[_0x0536('0x30')]=function(_0x33d3be,_0x51f52d){var _0x4d7093=0xa;var _0x4fe845=[_0x0536('0x4f'),_0x0536('0x50'),_0x0536('0x51'),_0x0536('0x52')];var _0x2cd217={'SUM':'SUM(%s)','COUNT':_0x0536('0x54'),'COUNT DISTINCT':_0x0536('0x55'),'MAX':_0x0536('0x56'),'MIN':_0x0536('0x86'),'AVG':_0x0536('0x57'),'GROUP_CONCAT':_0x0536('0x87'),'GROUP_CONCAT ASC':_0x0536('0x88'),'GROUP_CONCAT DESC':_0x0536('0x58')};var _0x3a0661={'SEC_TO_TIME':_0x0536('0x59'),'DATE':'DATE(%s)','HOUR':_0x0536('0x5b'),'ROUND':_0x0536('0x5c'),'UNIX_TIMESTAMP':_0x0536('0x5d')};var _0x93a14e=function(_0xc4a3d){return!_[_0x0536('0x78')]([_0x0536('0x5e'),'IS\x20NOT\x20NULL',_0x0536('0x60'),'IS\x20NOT\x20EMPTY'],_0xc4a3d);};var _0x16bc27=function(_0x350169){if(!_0x350169||!_0x350169['rules'][_0x0536('0x36')]){return'';}for(var _0x54e5fe='(',_0x5bc238=0x0;_0x5bc238<_0x350169[_0x0536('0x62')][_0x0536('0x36')];_0x5bc238+=0x1){_0x5bc238>0x0&&(_0x54e5fe+='\x20'+_0x350169[_0x0536('0x63')]+'\x20');_0x54e5fe+=_0x350169['rules'][_0x5bc238]['group']?_0x16bc27(_0x350169['rules'][_0x5bc238]['group']):_0x350169['rules'][_0x5bc238][_0x0536('0x65')]+'\x20'+_0x350169[_0x0536('0x62')][_0x5bc238][_0x0536('0x66')]+(_0x93a14e(_0x350169[_0x0536('0x62')][_0x5bc238][_0x0536('0x66')])?'\x20'+_0x350169[_0x0536('0x62')][_0x5bc238][_0x0536('0x67')]:'');}return _0x54e5fe+')';};var _0x535c81={'where':{'id':_0x33d3be[_0x0536('0x44')]['id']}},_0x3a998b,_0x5085fe,_0x31bca8,_0x56dd99,_0x9e0a8f;_0x535c81=_['merge']({},_0x535c81,_0x33d3be[_0x0536('0x3e')]);return db[_0x0536('0x2b')]['find'](_0x535c81)['then'](function(_0x45d399){if(_0x45d399){_0x3a998b=_0x45d399;return _0x45d399[_0x0536('0x68')]();}return null;})[_0x0536('0x23')](function(_0x4931a2){if(_0x4931a2){if(!_0x4931a2['length']){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5085fe=_0x4931a2;return db['AnalyticMetric'][_0x0536('0x8a')]({'raw':!![]});}return null;})[_0x0536('0x23')](function(_0x36a3df){if(_0x36a3df){_0x31bca8=_['keyBy'](_0x36a3df,'id');var _0x2b1497;var _0x48a338=squel[_0x0536('0x8b')]();_0x48a338[_0x0536('0x6d')](_0x3a998b[_0x0536('0x6e')]);for(var _0x290db7=0x0;_0x290db7<_0x5085fe['length'];_0x290db7+=0x1){_0x2b1497=_0x5085fe[_0x290db7]['MetricId']?_0x31bca8[_0x5085fe[_0x290db7][_0x0536('0x6f')]][_0x0536('0x70')]:_0x5085fe[_0x290db7][_0x0536('0x65')];_0x2b1497=_0x5085fe[_0x290db7][_0x0536('0x71')]?_[_0x0536('0x72')](_0x2cd217[_0x5085fe[_0x290db7]['function']],'%s',_0x2b1497):_0x2b1497;_0x2b1497=_0x5085fe[_0x290db7][_0x0536('0x73')]?_[_0x0536('0x72')](_0x3a0661[_0x5085fe[_0x290db7][_0x0536('0x73')]],'%s',_0x2b1497):_0x2b1497;if(_0x5085fe[_0x290db7]['groupBy']){_0x48a338[_0x0536('0x64')](_0x2b1497);}_0x5085fe[_0x290db7][_0x0536('0x75')]&&_0x48a338[_0x0536('0x39')](_0x2b1497,_0x5085fe[_0x290db7][_0x0536('0x75')]==='DESC'?![]:!![]);_0x48a338[_0x0536('0x65')](_0x2b1497,_0x5085fe[_0x290db7][_0x0536('0xa1')]||_0x2b1497);}if(_0x3a998b[_0x0536('0x77')]){_0x3a998b['joins']=JSON[_0x0536('0x7e')](_0x3a998b[_0x0536('0x77')]);for(var _0x48d95d=0x0;_0x48d95d<_0x3a998b['joins'][_0x0536('0x36')];_0x48d95d+=0x1){if(_0x3a998b[_0x0536('0x77')][_0x48d95d][_0x0536('0x2e')]&&_[_0x0536('0x78')](_0x4fe845,_0x3a998b[_0x0536('0x77')][_0x48d95d][_0x0536('0x2e')])&&_0x3a998b[_0x0536('0x77')][_0x48d95d][_0x0536('0x79')]&&_0x3a998b[_0x0536('0x77')][_0x48d95d][_0x0536('0x7a')]&&_0x3a998b[_0x0536('0x77')][_0x48d95d][_0x0536('0x7c')]){_0x48a338[_0x3a998b['joins'][_0x48d95d][_0x0536('0x2e')]](_0x3a998b['joins'][_0x48d95d]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3a998b[_0x0536('0x6e')],_0x3a998b[_0x0536('0x77')][_0x48d95d][_0x0536('0x79')],_0x3a998b[_0x0536('0x77')][_0x48d95d]['foreignTable'],_0x3a998b['joins'][_0x48d95d][_0x0536('0x7c')]));}}}if(_0x3a998b[_0x0536('0x7d')]){_0x3a998b[_0x0536('0x7d')]=JSON[_0x0536('0x7e')](_0x3a998b[_0x0536('0x7d')]);_0x48a338['where'](_0x16bc27(_0x3a998b[_0x0536('0x7d')][_0x0536('0x64')]));}_0x9e0a8f=_0x48a338[_0x0536('0x7f')]();_0x48a338['limit'](_0x4d7093);_0x48a338['offset'](0x0);logger[_0x0536('0x80')](_0x0536('0x81'),_0x48a338['toString']());return dbH[_0x0536('0x83')][_0x0536('0x30')](_0x48a338['toString'](),{'type':dbH[_0x0536('0x83')][_0x0536('0x84')][_0x0536('0x85')]});}})[_0x0536('0x23')](function(){return{'sql':_0x9e0a8f[_0x0536('0x82')]()};})[_0x0536('0x23')](respondWithResult(_0x51f52d,null))[_0x0536('0x42')](handleError(_0x51f52d,null));}; \ No newline at end of file +var _0xebd5=['update','body','preview','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','function','format','replace','groupBy','orderBy','DESC','parse','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','join','left_join','operator','getFields','AnalyticMetric','alias','web','fullPath','randomstring','generate','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','SELECT','run','value','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','CustomReports','sendStatus','error','name','send','index','map','AnalyticCustomReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','show','params','rawAttributes','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x320ee9,_0x338339){var _0x1fbd8a=function(_0x2c1612){while(--_0x2c1612){_0x320ee9['push'](_0x320ee9['shift']());}};_0x1fbd8a(++_0x338339);}(_0xebd5,0xf4));var _0x5ebd=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xebd5[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require(_0x5ebd('0x0'));var rimraf=require(_0x5ebd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ebd('0x2'));var rp=require(_0x5ebd('0x3'));var moment=require(_0x5ebd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5ebd('0x5'));var util=require(_0x5ebd('0x6'));var path=require(_0x5ebd('0x7'));var sox=require(_0x5ebd('0x8'));var csv=require(_0x5ebd('0x9'));var ejs=require(_0x5ebd('0xa'));var fs=require('fs');var fs_extra=require(_0x5ebd('0xb'));var _=require(_0x5ebd('0xc'));var squel=require(_0x5ebd('0xd'));var crypto=require(_0x5ebd('0xe'));var jsforce=require(_0x5ebd('0xf'));var deskjs=require(_0x5ebd('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5ebd('0x11'));var Papa=require(_0x5ebd('0x12'));var Redis=require(_0x5ebd('0x13'));var authService=require(_0x5ebd('0x14'));var qs=require(_0x5ebd('0x15'));var as=require(_0x5ebd('0x16'));var hardwareService=require(_0x5ebd('0x17'));var logger=require(_0x5ebd('0x18'))(_0x5ebd('0x19'));var utils=require(_0x5ebd('0x1a'));var config=require(_0x5ebd('0x1b'));var licenseUtil=require(_0x5ebd('0x1c'));var db=require(_0x5ebd('0x1d'))['db'];var dbH=require(_0x5ebd('0x1d'))[_0x5ebd('0x1e')];function respondWithStatusCode(_0x459d86,_0x532bb8){_0x532bb8=_0x532bb8||0xcc;return function(_0x21a2e1){if(_0x21a2e1){return _0x459d86['sendStatus'](_0x532bb8);}return _0x459d86['status'](_0x532bb8)[_0x5ebd('0x1f')]();};}function respondWithResult(_0x292ee3,_0x2e908e){_0x2e908e=_0x2e908e||0xc8;return function(_0x1bca06){if(_0x1bca06){return _0x292ee3[_0x5ebd('0x20')](_0x2e908e)[_0x5ebd('0x21')](_0x1bca06);}};}function respondWithFilteredResult(_0x2d989c,_0x17ab58){return function(_0x8a5773){if(_0x8a5773){var _0xfb46c2=typeof _0x17ab58[_0x5ebd('0x22')]===_0x5ebd('0x23')&&typeof _0x17ab58[_0x5ebd('0x24')]==='undefined';var _0x309d57=_0x8a5773[_0x5ebd('0x25')];var _0x1a7cf8=_0xfb46c2?0x0:_0x17ab58['offset'];var _0x3e4fc0=_0xfb46c2?_0x8a5773['count']:_0x17ab58[_0x5ebd('0x22')]+_0x17ab58[_0x5ebd('0x24')];var _0x43e1a6;if(_0x3e4fc0>=_0x309d57){_0x3e4fc0=_0x309d57;_0x43e1a6=0xc8;}else{_0x43e1a6=0xce;}_0x2d989c[_0x5ebd('0x20')](_0x43e1a6);return _0x2d989c[_0x5ebd('0x26')](_0x5ebd('0x27'),_0x1a7cf8+'-'+_0x3e4fc0+'/'+_0x309d57)[_0x5ebd('0x21')](_0x8a5773);}return null;};}function patchUpdates(_0x49213d){return function(_0x2fce12){try{jsonpatch[_0x5ebd('0x28')](_0x2fce12,_0x49213d,!![]);}catch(_0x566e72){return BPromise[_0x5ebd('0x29')](_0x566e72);}return _0x2fce12[_0x5ebd('0x2a')]();};}function saveUpdates(_0x28bd90,_0xcb0041){return function(_0x58a191){if(_0x58a191){return _0x58a191['update'](_0x28bd90)[_0x5ebd('0x2b')](function(_0x166542){return _0x166542;});}return null;};}function removeEntity(_0xefc578,_0x58069d){return function(_0x343001){if(_0x343001){return _0x343001[_0x5ebd('0x2c')]()[_0x5ebd('0x2b')](function(){var _0x1334c5=_0x343001[_0x5ebd('0x2d')]({'plain':!![]});var _0x5d36a1=_0x5ebd('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x5d36a1,'resourceId':_0x1334c5['id']}})[_0x5ebd('0x2b')](function(){return _0x343001;});})[_0x5ebd('0x2b')](function(){_0xefc578[_0x5ebd('0x20')](0xcc)[_0x5ebd('0x1f')]();});}};}function handleEntityNotFound(_0x32080e,_0x1d3ca5){return function(_0x392e16){if(!_0x392e16){_0x32080e[_0x5ebd('0x2f')](0x194);}return _0x392e16;};}function handleError(_0x526052,_0x1f617c){_0x1f617c=_0x1f617c||0x1f4;return function(_0x39b161){logger[_0x5ebd('0x30')](_0x39b161['stack']);if(_0x39b161[_0x5ebd('0x31')]){delete _0x39b161['name'];}_0x526052[_0x5ebd('0x20')](_0x1f617c)[_0x5ebd('0x32')](_0x39b161);};}exports[_0x5ebd('0x33')]=function(_0x5e3a47,_0x1238a3){var _0x1df9ae={},_0x2206bc={},_0x39fe86={'count':0x0,'rows':[]};var _0x4946f8=_[_0x5ebd('0x34')](db[_0x5ebd('0x35')]['rawAttributes'],function(_0x57b665){return{'name':_0x57b665['fieldName'],'type':_0x57b665[_0x5ebd('0x36')][_0x5ebd('0x37')]};});_0x2206bc[_0x5ebd('0x38')]=_[_0x5ebd('0x34')](_0x4946f8,_0x5ebd('0x31'));_0x2206bc[_0x5ebd('0x39')]=_[_0x5ebd('0x3a')](_0x5e3a47[_0x5ebd('0x39')]);_0x2206bc[_0x5ebd('0x3b')]=_[_0x5ebd('0x3c')](_0x2206bc['model'],_0x2206bc[_0x5ebd('0x39')]);_0x1df9ae[_0x5ebd('0x3d')]=_[_0x5ebd('0x3c')](_0x2206bc['model'],qs[_0x5ebd('0x3e')](_0x5e3a47[_0x5ebd('0x39')]['fields']));_0x1df9ae[_0x5ebd('0x3d')]=_0x1df9ae['attributes'][_0x5ebd('0x3f')]?_0x1df9ae['attributes']:_0x2206bc[_0x5ebd('0x38')];if(!_0x5e3a47['query']['hasOwnProperty']('nolimit')){_0x1df9ae[_0x5ebd('0x24')]=qs[_0x5ebd('0x24')](_0x5e3a47['query'][_0x5ebd('0x24')]);_0x1df9ae['offset']=qs['offset'](_0x5e3a47[_0x5ebd('0x39')][_0x5ebd('0x22')]);}_0x1df9ae[_0x5ebd('0x40')]=qs[_0x5ebd('0x41')](_0x5e3a47[_0x5ebd('0x39')][_0x5ebd('0x41')]);_0x1df9ae[_0x5ebd('0x42')]=qs[_0x5ebd('0x3b')](_[_0x5ebd('0x43')](_0x5e3a47[_0x5ebd('0x39')],_0x2206bc[_0x5ebd('0x3b')]),_0x4946f8);if(_0x5e3a47[_0x5ebd('0x39')][_0x5ebd('0x44')]){_0x1df9ae[_0x5ebd('0x42')]=_[_0x5ebd('0x45')](_0x1df9ae[_0x5ebd('0x42')],{'$or':_['map'](_0x4946f8,function(_0x189c8a){if(_0x189c8a[_0x5ebd('0x36')]!==_0x5ebd('0x46')){var _0x4b0728={};_0x4b0728[_0x189c8a[_0x5ebd('0x31')]]={'$like':'%'+_0x5e3a47[_0x5ebd('0x39')]['filter']+'%'};return _0x4b0728;}})});}_0x1df9ae=_['merge']({},_0x1df9ae,_0x5e3a47[_0x5ebd('0x47')]);var _0x5e30ac={'where':_0x1df9ae[_0x5ebd('0x42')]};return db[_0x5ebd('0x35')][_0x5ebd('0x25')](_0x5e30ac)[_0x5ebd('0x2b')](function(_0x40a9c2){_0x39fe86['count']=_0x40a9c2;if(_0x5e3a47[_0x5ebd('0x39')]['includeAll']){_0x1df9ae['include']=[{'all':!![]}];}return db[_0x5ebd('0x35')][_0x5ebd('0x48')](_0x1df9ae);})['then'](function(_0x58b9ed){_0x39fe86['rows']=_0x58b9ed;return _0x39fe86;})[_0x5ebd('0x2b')](respondWithFilteredResult(_0x1238a3,_0x1df9ae))[_0x5ebd('0x49')](handleError(_0x1238a3,null));};exports[_0x5ebd('0x4a')]=function(_0x1f16d1,_0x57d551){var _0x3e3af5={'raw':![],'where':{'id':_0x1f16d1[_0x5ebd('0x4b')]['id']}},_0x3005d5={};_0x3005d5[_0x5ebd('0x38')]=_[_0x5ebd('0x3a')](db['AnalyticCustomReport'][_0x5ebd('0x4c')]);_0x3005d5[_0x5ebd('0x39')]=_['keys'](_0x1f16d1['query']);_0x3005d5['filters']=_[_0x5ebd('0x3c')](_0x3005d5[_0x5ebd('0x38')],_0x3005d5[_0x5ebd('0x39')]);_0x3e3af5[_0x5ebd('0x3d')]=_[_0x5ebd('0x3c')](_0x3005d5[_0x5ebd('0x38')],qs[_0x5ebd('0x3e')](_0x1f16d1[_0x5ebd('0x39')][_0x5ebd('0x3e')]));_0x3e3af5['attributes']=_0x3e3af5['attributes'][_0x5ebd('0x3f')]?_0x3e3af5[_0x5ebd('0x3d')]:_0x3005d5['model'];if(_0x1f16d1['query']['includeAll']){_0x3e3af5[_0x5ebd('0x4d')]=[{'all':!![]}];}_0x3e3af5=_[_0x5ebd('0x45')]({},_0x3e3af5,_0x1f16d1[_0x5ebd('0x47')]);return db[_0x5ebd('0x35')][_0x5ebd('0x4e')](_0x3e3af5)[_0x5ebd('0x2b')](handleEntityNotFound(_0x57d551,null))['then'](respondWithResult(_0x57d551,null))[_0x5ebd('0x49')](handleError(_0x57d551,null));};exports[_0x5ebd('0x4f')]=function(_0x441dde,_0x2fc307){return db['AnalyticCustomReport'][_0x5ebd('0x4f')](_0x441dde['body'],{})[_0x5ebd('0x2b')](function(_0x4a3a5a){var _0x1ca8bf=_0x441dde[_0x5ebd('0x50')][_0x5ebd('0x2d')]({'plain':!![]});if(!_0x1ca8bf)throw new Error(_0x5ebd('0x51'));if(_0x1ca8bf[_0x5ebd('0x52')]===_0x5ebd('0x50')){var _0x4c3f2a=_0x4a3a5a[_0x5ebd('0x2d')]({'plain':!![]});var _0x59f62a=_0x5ebd('0x53');return db[_0x5ebd('0x54')][_0x5ebd('0x4e')]({'where':{'name':_0x59f62a,'userProfileId':_0x1ca8bf['userProfileId']},'raw':!![]})[_0x5ebd('0x2b')](function(_0x216621){if(_0x216621&&_0x216621[_0x5ebd('0x55')]===0x0){return db[_0x5ebd('0x56')][_0x5ebd('0x4f')]({'name':_0x4c3f2a[_0x5ebd('0x31')],'resourceId':_0x4c3f2a['id'],'type':_0x5ebd('0x2e'),'sectionId':_0x216621['id']},{})[_0x5ebd('0x2b')](function(){return _0x4a3a5a;});}else{return _0x4a3a5a;}})[_0x5ebd('0x49')](function(_0x1216c8){logger[_0x5ebd('0x30')](_0x5ebd('0x57'),_0x1216c8);throw _0x1216c8;});}return _0x4a3a5a;})['then'](respondWithResult(_0x2fc307,0xc9))['catch'](handleError(_0x2fc307,null));};exports[_0x5ebd('0x58')]=function(_0x559cf0,_0x40a4ca){if(_0x559cf0['body']['id']){delete _0x559cf0[_0x5ebd('0x59')]['id'];}return db[_0x5ebd('0x35')][_0x5ebd('0x4e')]({'where':{'id':_0x559cf0['params']['id']}})[_0x5ebd('0x2b')](handleEntityNotFound(_0x40a4ca,null))[_0x5ebd('0x2b')](saveUpdates(_0x559cf0[_0x5ebd('0x59')],null))[_0x5ebd('0x2b')](respondWithResult(_0x40a4ca,null))['catch'](handleError(_0x40a4ca,null));};exports[_0x5ebd('0x2c')]=function(_0x18e0cf,_0x1ba85f){return db['AnalyticCustomReport'][_0x5ebd('0x4e')]({'where':{'id':_0x18e0cf[_0x5ebd('0x4b')]['id']}})[_0x5ebd('0x2b')](handleEntityNotFound(_0x1ba85f,null))[_0x5ebd('0x2b')](removeEntity(_0x1ba85f,null))[_0x5ebd('0x49')](handleError(_0x1ba85f,null));};exports[_0x5ebd('0x5a')]=function(_0x4c0544,_0x49f5e3){var _0x303517=0xa;var _0x54f86c=['join','left_join',_0x5ebd('0x5b'),_0x5ebd('0x5c')];var _0x930e5d={'SUM':'SUM(%s)','COUNT':_0x5ebd('0x5d'),'COUNT DISTINCT':_0x5ebd('0x5e'),'MAX':_0x5ebd('0x5f'),'MIN':_0x5ebd('0x60'),'AVG':_0x5ebd('0x61'),'GROUP_CONCAT':_0x5ebd('0x62'),'GROUP_CONCAT ASC':_0x5ebd('0x63'),'GROUP_CONCAT DESC':_0x5ebd('0x64')};var _0x57ece2={'SEC_TO_TIME':_0x5ebd('0x65'),'DATE':_0x5ebd('0x66'),'HOUR':_0x5ebd('0x67'),'ROUND':_0x5ebd('0x68'),'UNIX_TIMESTAMP':_0x5ebd('0x69')};var _0x1ebe30=function(_0x49fef7){return!_[_0x5ebd('0x6a')]([_0x5ebd('0x6b'),_0x5ebd('0x6c'),_0x5ebd('0x6d'),_0x5ebd('0x6e')],_0x49fef7);};var _0x54c66a=function(_0x304a05){if(!_0x304a05||!_0x304a05[_0x5ebd('0x6f')][_0x5ebd('0x3f')]){return'';}for(var _0x239b79='(',_0x214143=0x0;_0x214143<_0x304a05[_0x5ebd('0x6f')]['length'];_0x214143+=0x1){_0x214143>0x0&&(_0x239b79+='\x20'+_0x304a05['operator']+'\x20');_0x239b79+=_0x304a05[_0x5ebd('0x6f')][_0x214143][_0x5ebd('0x70')]?_0x54c66a(_0x304a05[_0x5ebd('0x6f')][_0x214143][_0x5ebd('0x70')]):_0x304a05[_0x5ebd('0x6f')][_0x214143][_0x5ebd('0x71')]+'\x20'+_0x304a05[_0x5ebd('0x6f')][_0x214143][_0x5ebd('0x72')]+(_0x1ebe30(_0x304a05[_0x5ebd('0x6f')][_0x214143][_0x5ebd('0x72')])?'\x20'+_0x304a05[_0x5ebd('0x6f')][_0x214143]['value']:'');}return _0x239b79+')';};var _0x20aaac={'where':{'id':_0x4c0544[_0x5ebd('0x4b')]['id']}},_0x1d795e,_0x2e2d4d,_0x51027d,_0x8194a,_0x283782;_0x20aaac=_[_0x5ebd('0x45')]({},_0x20aaac,_0x4c0544[_0x5ebd('0x47')]);return db[_0x5ebd('0x35')]['find'](_0x20aaac)[_0x5ebd('0x2b')](function(_0x1959db){if(_0x1959db){_0x1d795e=_0x1959db;return _0x1959db['getFields']();}return null;})['then'](function(_0xe24974){if(_0xe24974){if(!_0xe24974[_0x5ebd('0x3f')]){throw new db[(_0x5ebd('0x73'))][(_0x5ebd('0x74'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2e2d4d=_0xe24974;return db['AnalyticMetric'][_0x5ebd('0x48')]({'raw':!![]});}return null;})[_0x5ebd('0x2b')](function(_0x1c2139){if(_0x1c2139){_0x51027d=_[_0x5ebd('0x75')](_0x1c2139,'id');var _0x54fb15;var _0x5accbb=squel[_0x5ebd('0x76')]();_0x5accbb[_0x5ebd('0x77')](_0x1d795e[_0x5ebd('0x78')]);for(var _0x786039=0x0;_0x786039<_0x2e2d4d[_0x5ebd('0x3f')];_0x786039+=0x1){_0x54fb15=_0x2e2d4d[_0x786039][_0x5ebd('0x79')]?_0x51027d[_0x2e2d4d[_0x786039][_0x5ebd('0x79')]][_0x5ebd('0x7a')]:_0x2e2d4d[_0x786039][_0x5ebd('0x71')];_0x54fb15=_0x2e2d4d[_0x786039][_0x5ebd('0x7b')]?_['replace'](_0x930e5d[_0x2e2d4d[_0x786039][_0x5ebd('0x7b')]],'%s',_0x54fb15):_0x54fb15;_0x54fb15=_0x2e2d4d[_0x786039][_0x5ebd('0x7c')]?_[_0x5ebd('0x7d')](_0x57ece2[_0x2e2d4d[_0x786039]['format']],'%s',_0x54fb15):_0x54fb15;if(_0x2e2d4d[_0x786039][_0x5ebd('0x7e')]){_0x5accbb[_0x5ebd('0x70')](_0x54fb15);}_0x2e2d4d[_0x786039][_0x5ebd('0x7f')]&&_0x5accbb['order'](_0x54fb15,_0x2e2d4d[_0x786039]['orderBy']===_0x5ebd('0x80')?![]:!![]);_0x5accbb[_0x5ebd('0x71')](_0x54fb15,_0x2e2d4d[_0x786039]['alias']||_0x54fb15);}if(_0x1d795e['joins']){_0x1d795e['joins']=JSON[_0x5ebd('0x81')](_0x1d795e[_0x5ebd('0x82')]);for(var _0x54c301=0x0;_0x54c301<_0x1d795e[_0x5ebd('0x82')][_0x5ebd('0x3f')];_0x54c301+=0x1){if(_0x1d795e[_0x5ebd('0x82')][_0x54c301][_0x5ebd('0x36')]&&_[_0x5ebd('0x6a')](_0x54f86c,_0x1d795e[_0x5ebd('0x82')][_0x54c301][_0x5ebd('0x36')])&&_0x1d795e[_0x5ebd('0x82')][_0x54c301][_0x5ebd('0x83')]&&_0x1d795e['joins'][_0x54c301]['foreignTable']&&_0x1d795e[_0x5ebd('0x82')][_0x54c301][_0x5ebd('0x84')]){_0x5accbb[_0x1d795e[_0x5ebd('0x82')][_0x54c301][_0x5ebd('0x36')]](_0x1d795e[_0x5ebd('0x82')][_0x54c301][_0x5ebd('0x85')],null,util[_0x5ebd('0x7c')](_0x5ebd('0x86'),_0x1d795e[_0x5ebd('0x78')],_0x1d795e['joins'][_0x54c301][_0x5ebd('0x83')],_0x1d795e[_0x5ebd('0x82')][_0x54c301][_0x5ebd('0x85')],_0x1d795e['joins'][_0x54c301][_0x5ebd('0x84')]));}}}if(_0x1d795e[_0x5ebd('0x87')]){_0x1d795e['conditions']=JSON[_0x5ebd('0x81')](_0x1d795e[_0x5ebd('0x87')]);_0x5accbb[_0x5ebd('0x42')](_0x54c66a(_0x1d795e[_0x5ebd('0x87')][_0x5ebd('0x70')]));}_0x283782=_0x5accbb[_0x5ebd('0x88')]();_0x5accbb[_0x5ebd('0x24')](_0x303517);_0x5accbb[_0x5ebd('0x22')](0x0);logger[_0x5ebd('0x89')](_0x5ebd('0x8a'),_0x5accbb[_0x5ebd('0x8b')]());return dbH[_0x5ebd('0x8c')]['query'](_0x5accbb[_0x5ebd('0x8b')](),{'type':dbH[_0x5ebd('0x8c')][_0x5ebd('0x8d')]['SELECT']});}})['then'](respondWithResult(_0x49f5e3,null))['catch'](handleError(_0x49f5e3,null));};function runReport(_0x5b3a21,_0x15d1c5,_0x27bd2b){var _0x4ed5d0=_0x15d1c5[_0x5ebd('0x31')];var _0x7d8aad=0xa;var _0x284eb8=[_0x5ebd('0x8e'),_0x5ebd('0x8f'),_0x5ebd('0x5b'),_0x5ebd('0x5c')];var _0x1d7210={'SUM':'SUM(%s)','COUNT':_0x5ebd('0x5d'),'COUNT DISTINCT':_0x5ebd('0x5e'),'MAX':_0x5ebd('0x5f'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5ebd('0x62'),'GROUP_CONCAT ASC':_0x5ebd('0x63'),'GROUP_CONCAT DESC':_0x5ebd('0x64')};var _0x4b23e7={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5ebd('0x66'),'HOUR':_0x5ebd('0x67'),'ROUND':_0x5ebd('0x68'),'UNIX_TIMESTAMP':_0x5ebd('0x69')};var _0x550bf7=function(_0xc97852){return!_[_0x5ebd('0x6a')](['IS\x20NULL',_0x5ebd('0x6c'),_0x5ebd('0x6d'),_0x5ebd('0x6e')],_0xc97852);};var _0x54c5a7=function(_0x1714dc){if(!_0x1714dc||!_0x1714dc[_0x5ebd('0x6f')]['length']){return'';}for(var _0x2326c9='(',_0x4afb2f=0x0;_0x4afb2f<_0x1714dc['rules'][_0x5ebd('0x3f')];_0x4afb2f+=0x1){_0x4afb2f>0x0&&(_0x2326c9+='\x20'+_0x1714dc[_0x5ebd('0x90')]+'\x20');_0x2326c9+=_0x1714dc[_0x5ebd('0x6f')][_0x4afb2f][_0x5ebd('0x70')]?_0x54c5a7(_0x1714dc['rules'][_0x4afb2f]['group']):_0x1714dc['rules'][_0x4afb2f][_0x5ebd('0x71')]+'\x20'+_0x1714dc[_0x5ebd('0x6f')][_0x4afb2f]['condition']+(_0x550bf7(_0x1714dc[_0x5ebd('0x6f')][_0x4afb2f][_0x5ebd('0x72')])?'\x20'+_0x1714dc['rules'][_0x4afb2f]['value']:'');}return _0x2326c9+')';};var _0x10adc3={'where':{'id':_0x5b3a21['id']}},_0x1c386c,_0x209503,_0x2735b4,_0x1bf540,_0x4f57b4;_0x10adc3=_[_0x5ebd('0x45')]({},_0x10adc3,_0x27bd2b);return db[_0x5ebd('0x35')][_0x5ebd('0x4e')](_0x10adc3)['then'](function(_0x115483){if(_0x115483){_0x1c386c=_0x115483;return _0x115483[_0x5ebd('0x91')]();}return null;})[_0x5ebd('0x2b')](function(_0x1dcffd){if(_0x1dcffd){if(!_0x1dcffd[_0x5ebd('0x3f')]){throw new db[(_0x5ebd('0x73'))][(_0x5ebd('0x74'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x209503=_0x1dcffd;return db[_0x5ebd('0x92')][_0x5ebd('0x48')]({'raw':!![]});}return null;})['then'](function(_0x188b40){if(_0x188b40){_0x2735b4=_[_0x5ebd('0x75')](_0x188b40,'id');var _0x2984d5;var _0x59cdb5=squel[_0x5ebd('0x76')]();_0x59cdb5[_0x5ebd('0x77')](_0x1c386c[_0x5ebd('0x78')]);for(var _0x2a8f71=0x0;_0x2a8f71<_0x209503[_0x5ebd('0x3f')];_0x2a8f71+=0x1){_0x2984d5=_0x209503[_0x2a8f71][_0x5ebd('0x79')]?_0x2735b4[_0x209503[_0x2a8f71]['MetricId']]['metric']:_0x209503[_0x2a8f71][_0x5ebd('0x71')];_0x2984d5=_0x209503[_0x2a8f71][_0x5ebd('0x7b')]?_['replace'](_0x1d7210[_0x209503[_0x2a8f71][_0x5ebd('0x7b')]],'%s',_0x2984d5):_0x2984d5;_0x2984d5=_0x209503[_0x2a8f71][_0x5ebd('0x7c')]?_['replace'](_0x4b23e7[_0x209503[_0x2a8f71][_0x5ebd('0x7c')]],'%s',_0x2984d5):_0x2984d5;if(_0x209503[_0x2a8f71]['groupBy']){_0x59cdb5['group'](_0x2984d5);}_0x209503[_0x2a8f71][_0x5ebd('0x7f')]&&_0x59cdb5[_0x5ebd('0x40')](_0x2984d5,_0x209503[_0x2a8f71][_0x5ebd('0x7f')]===_0x5ebd('0x80')?![]:!![]);_0x59cdb5[_0x5ebd('0x71')](_0x2984d5,_0x209503[_0x2a8f71][_0x5ebd('0x93')]||_0x2984d5);}if(_0x1c386c['joins']){_0x1c386c[_0x5ebd('0x82')]=JSON[_0x5ebd('0x81')](_0x1c386c[_0x5ebd('0x82')]);for(var _0x3b42be=0x0;_0x3b42be<_0x1c386c['joins'][_0x5ebd('0x3f')];_0x3b42be+=0x1){if(_0x1c386c[_0x5ebd('0x82')][_0x3b42be][_0x5ebd('0x36')]&&_[_0x5ebd('0x6a')](_0x284eb8,_0x1c386c[_0x5ebd('0x82')][_0x3b42be][_0x5ebd('0x36')])&&_0x1c386c['joins'][_0x3b42be][_0x5ebd('0x83')]&&_0x1c386c[_0x5ebd('0x82')][_0x3b42be][_0x5ebd('0x85')]&&_0x1c386c[_0x5ebd('0x82')][_0x3b42be][_0x5ebd('0x84')]){_0x59cdb5[_0x1c386c[_0x5ebd('0x82')][_0x3b42be][_0x5ebd('0x36')]](_0x1c386c[_0x5ebd('0x82')][_0x3b42be][_0x5ebd('0x85')],null,util['format'](_0x5ebd('0x86'),_0x1c386c[_0x5ebd('0x78')],_0x1c386c['joins'][_0x3b42be][_0x5ebd('0x83')],_0x1c386c[_0x5ebd('0x82')][_0x3b42be]['foreignTable'],_0x1c386c[_0x5ebd('0x82')][_0x3b42be]['foreignKey']));}}}if(_0x1c386c[_0x5ebd('0x87')]){_0x1c386c['conditions']=JSON[_0x5ebd('0x81')](_0x1c386c[_0x5ebd('0x87')]);_0x59cdb5['where'](_0x54c5a7(_0x1c386c[_0x5ebd('0x87')][_0x5ebd('0x70')]));}_0x4f57b4=_0x59cdb5['clone']();_0x59cdb5['limit'](_0x7d8aad);_0x59cdb5['offset'](0x0);return;}})['then'](function(){if(_0x15d1c5['output']===_0x5ebd('0x94')){return null;}var _0x326e08=_[_0x5ebd('0x45')](_0x15d1c5,{'name':_0x15d1c5[_0x5ebd('0x95')]||_0x15d1c5[_0x5ebd('0x31')]||_0x1c386c[_0x5ebd('0x31')],'basename':_0x4ed5d0,'savename':util[_0x5ebd('0x7c')]('%s-%s.%s',_0x15d1c5[_0x5ebd('0x31')]||_0x1c386c[_0x5ebd('0x31')],require(_0x5ebd('0x96'))[_0x5ebd('0x97')](0x4),_0x15d1c5['output']||'csv'),'reportId':_0x1c386c['id'],'reportType':'custom'});return db[_0x5ebd('0x98')][_0x5ebd('0x4f')](_0x326e08,{'raw':!![]});})[_0x5ebd('0x2b')](function(_0x22fbe){if(_0x1c386c[_0x5ebd('0x78')]==='cdr'){_0x4f57b4['where'](_0x1c386c[_0x5ebd('0x78')]+_0x5ebd('0x99'),_0x15d1c5[_0x5ebd('0x9a')],_0x15d1c5[_0x5ebd('0x9b')]);}else{_0x4f57b4[_0x5ebd('0x42')](_0x1c386c[_0x5ebd('0x78')]+_0x5ebd('0x9c'),_0x15d1c5[_0x5ebd('0x9a')],_0x15d1c5['endDate']);}if(_0x22fbe){logger[_0x5ebd('0x9d')]('Run\x20Query:',_0x4f57b4[_0x5ebd('0x8b')]());require(_0x5ebd('0x9e'))[_0x5ebd('0x9f')](path[_0x5ebd('0x8e')](__dirname,_0x5ebd('0xa0'),_0x22fbe['output']),[_0x22fbe['id'],_0x4f57b4['toString'](),path['join'](__dirname,_0x5ebd('0xa1'),_0x22fbe['savename']),_0x4ed5d0]);return _0x22fbe;}else{var _0x1513ee=squel[_0x5ebd('0x76')]();_0x1513ee[_0x5ebd('0x77')]('('+_0x4f57b4['toString']()+')','countTable');_0x1513ee[_0x5ebd('0x71')]('COUNT(*)',_0x5ebd('0x25'));_0x4f57b4[_0x5ebd('0x24')](_0x15d1c5[_0x5ebd('0x24')]||_0x7d8aad);_0x4f57b4['offset'](_0x15d1c5['offset']||0x0);return dbH['sequelize'][_0x5ebd('0x39')](_0x1513ee[_0x5ebd('0x8b')](),{'type':dbH[_0x5ebd('0x8c')]['QueryTypes'][_0x5ebd('0xa2')]})[_0x5ebd('0x2b')](function(_0x345cd3){if(!_0x345cd3[_0x5ebd('0x3f')]){_0x1bf540=0x0;}else{_0x1bf540=_0x345cd3[0x0][_0x5ebd('0x25')]||0x0;}return dbH[_0x5ebd('0x8c')]['query'](_0x4f57b4['toString'](),{'type':dbH[_0x5ebd('0x8c')][_0x5ebd('0x8d')]['SELECT']});})[_0x5ebd('0x2b')](function(_0x4a6789){return{'rows':_0x4a6789||[],'count':_0x1bf540};});}});}exports[_0x5ebd('0xa3')]=function(_0x149a09,_0x4cba6d){return runReport(_0x149a09[_0x5ebd('0x4b')],_0x149a09[_0x5ebd('0x39')],_0x149a09['options'])['then'](respondWithResult(_0x4cba6d,null))[_0x5ebd('0x49')](handleError(_0x4cba6d,null));};exports['runReport']=runReport;exports[_0x5ebd('0x39')]=function(_0x48fae8,_0x367d0c){var _0x4f10c9=0xa;var _0x16ba04=[_0x5ebd('0x8e'),_0x5ebd('0x8f'),_0x5ebd('0x5b'),'cross_join'];var _0x167420={'SUM':'SUM(%s)','COUNT':_0x5ebd('0x5d'),'COUNT DISTINCT':_0x5ebd('0x5e'),'MAX':_0x5ebd('0x5f'),'MIN':_0x5ebd('0x60'),'AVG':_0x5ebd('0x61'),'GROUP_CONCAT':_0x5ebd('0x62'),'GROUP_CONCAT ASC':_0x5ebd('0x63'),'GROUP_CONCAT DESC':_0x5ebd('0x64')};var _0x54bcb2={'SEC_TO_TIME':_0x5ebd('0x65'),'DATE':'DATE(%s)','HOUR':_0x5ebd('0x67'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x288844=function(_0x364dc2){return!_[_0x5ebd('0x6a')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5ebd('0x6d'),'IS\x20NOT\x20EMPTY'],_0x364dc2);};var _0x540114=function(_0x107541){if(!_0x107541||!_0x107541['rules'][_0x5ebd('0x3f')]){return'';}for(var _0x1342fa='(',_0x42e11d=0x0;_0x42e11d<_0x107541[_0x5ebd('0x6f')][_0x5ebd('0x3f')];_0x42e11d+=0x1){_0x42e11d>0x0&&(_0x1342fa+='\x20'+_0x107541['operator']+'\x20');_0x1342fa+=_0x107541[_0x5ebd('0x6f')][_0x42e11d][_0x5ebd('0x70')]?_0x540114(_0x107541['rules'][_0x42e11d][_0x5ebd('0x70')]):_0x107541[_0x5ebd('0x6f')][_0x42e11d][_0x5ebd('0x71')]+'\x20'+_0x107541[_0x5ebd('0x6f')][_0x42e11d]['condition']+(_0x288844(_0x107541[_0x5ebd('0x6f')][_0x42e11d][_0x5ebd('0x72')])?'\x20'+_0x107541[_0x5ebd('0x6f')][_0x42e11d][_0x5ebd('0xa4')]:'');}return _0x1342fa+')';};var _0x6f86c5={'where':{'id':_0x48fae8[_0x5ebd('0x4b')]['id']}},_0x5ebb51,_0x5aa78d,_0x47adb7,_0x50a5e7,_0x3a7b61;_0x6f86c5=_[_0x5ebd('0x45')]({},_0x6f86c5,_0x48fae8['options']);return db['AnalyticCustomReport']['find'](_0x6f86c5)[_0x5ebd('0x2b')](function(_0x206f4d){if(_0x206f4d){_0x5ebb51=_0x206f4d;return _0x206f4d['getFields']();}return null;})[_0x5ebd('0x2b')](function(_0x654d6){if(_0x654d6){if(!_0x654d6[_0x5ebd('0x3f')]){throw new db[(_0x5ebd('0x73'))][(_0x5ebd('0x74'))](_0x5ebd('0xa5'),0x193);}_0x5aa78d=_0x654d6;return db['AnalyticMetric'][_0x5ebd('0x48')]({'raw':!![]});}return null;})[_0x5ebd('0x2b')](function(_0x317b67){if(_0x317b67){_0x47adb7=_[_0x5ebd('0x75')](_0x317b67,'id');var _0x3ed5e4;var _0x1bf155=squel['select']();_0x1bf155[_0x5ebd('0x77')](_0x5ebb51[_0x5ebd('0x78')]);for(var _0x1e1bff=0x0;_0x1e1bff<_0x5aa78d[_0x5ebd('0x3f')];_0x1e1bff+=0x1){_0x3ed5e4=_0x5aa78d[_0x1e1bff]['MetricId']?_0x47adb7[_0x5aa78d[_0x1e1bff]['MetricId']][_0x5ebd('0x7a')]:_0x5aa78d[_0x1e1bff][_0x5ebd('0x71')];_0x3ed5e4=_0x5aa78d[_0x1e1bff][_0x5ebd('0x7b')]?_[_0x5ebd('0x7d')](_0x167420[_0x5aa78d[_0x1e1bff][_0x5ebd('0x7b')]],'%s',_0x3ed5e4):_0x3ed5e4;_0x3ed5e4=_0x5aa78d[_0x1e1bff][_0x5ebd('0x7c')]?_[_0x5ebd('0x7d')](_0x54bcb2[_0x5aa78d[_0x1e1bff][_0x5ebd('0x7c')]],'%s',_0x3ed5e4):_0x3ed5e4;if(_0x5aa78d[_0x1e1bff][_0x5ebd('0x7e')]){_0x1bf155['group'](_0x3ed5e4);}_0x5aa78d[_0x1e1bff][_0x5ebd('0x7f')]&&_0x1bf155[_0x5ebd('0x40')](_0x3ed5e4,_0x5aa78d[_0x1e1bff][_0x5ebd('0x7f')]===_0x5ebd('0x80')?![]:!![]);_0x1bf155[_0x5ebd('0x71')](_0x3ed5e4,_0x5aa78d[_0x1e1bff][_0x5ebd('0x93')]||_0x3ed5e4);}if(_0x5ebb51[_0x5ebd('0x82')]){_0x5ebb51['joins']=JSON['parse'](_0x5ebb51['joins']);for(var _0x5a76b5=0x0;_0x5a76b5<_0x5ebb51['joins']['length'];_0x5a76b5+=0x1){if(_0x5ebb51['joins'][_0x5a76b5][_0x5ebd('0x36')]&&_[_0x5ebd('0x6a')](_0x16ba04,_0x5ebb51['joins'][_0x5a76b5]['type'])&&_0x5ebb51[_0x5ebd('0x82')][_0x5a76b5][_0x5ebd('0x83')]&&_0x5ebb51['joins'][_0x5a76b5][_0x5ebd('0x85')]&&_0x5ebb51[_0x5ebd('0x82')][_0x5a76b5][_0x5ebd('0x84')]){_0x1bf155[_0x5ebb51['joins'][_0x5a76b5][_0x5ebd('0x36')]](_0x5ebb51['joins'][_0x5a76b5]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x5ebb51[_0x5ebd('0x78')],_0x5ebb51['joins'][_0x5a76b5]['parentKey'],_0x5ebb51[_0x5ebd('0x82')][_0x5a76b5][_0x5ebd('0x85')],_0x5ebb51[_0x5ebd('0x82')][_0x5a76b5]['foreignKey']));}}}if(_0x5ebb51['conditions']){_0x5ebb51[_0x5ebd('0x87')]=JSON[_0x5ebd('0x81')](_0x5ebb51[_0x5ebd('0x87')]);_0x1bf155[_0x5ebd('0x42')](_0x540114(_0x5ebb51[_0x5ebd('0x87')][_0x5ebd('0x70')]));}_0x3a7b61=_0x1bf155[_0x5ebd('0x88')]();_0x1bf155['limit'](_0x4f10c9);_0x1bf155['offset'](0x0);logger[_0x5ebd('0x89')](_0x5ebd('0x8a'),_0x1bf155[_0x5ebd('0x8b')]());return dbH['sequelize'][_0x5ebd('0x39')](_0x1bf155['toString'](),{'type':dbH[_0x5ebd('0x8c')][_0x5ebd('0x8d')][_0x5ebd('0xa2')]});}})['then'](function(){return{'sql':_0x3a7b61[_0x5ebd('0x8b')]()};})[_0x5ebd('0x2b')](respondWithResult(_0x367d0c,null))[_0x5ebd('0x49')](handleError(_0x367d0c,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 963bf91..a589833 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 _0x0a5c=['rimraf','../../config/environment','exports','define','AnalyticCustomReport','lodash','util','api','bluebird','request-promise'];(function(_0x2a5b3b,_0x4ebe31){var _0xae665a=function(_0x59e86a){while(--_0x59e86a){_0x2a5b3b['push'](_0x2a5b3b['shift']());}};_0xae665a(++_0x4ebe31);}(_0x0a5c,0x1b3));var _0xc0a5=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x0a5c[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xc0a5('0x0'));var util=require(_0xc0a5('0x1'));var logger=require('../../config/logger')(_0xc0a5('0x2'));var moment=require('moment');var BPromise=require(_0xc0a5('0x3'));var rp=require(_0xc0a5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc0a5('0x5'));var config=require(_0xc0a5('0x6'));var attributes=require('./analyticCustomReport.attributes');module[_0xc0a5('0x7')]=function(_0x3e5e68,_0x4fb17e){return _0x3e5e68[_0xc0a5('0x8')](_0xc0a5('0x9'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbaa=['../../config/logger','api','moment','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util'];(function(_0x1d2cd0,_0x50754a){var _0x37f696=function(_0x495d19){while(--_0x495d19){_0x1d2cd0['push'](_0x1d2cd0['shift']());}};_0x37f696(++_0x50754a);}(_0xcbaa,0x16a));var _0xacba=function(_0x34d275,_0x5d84ee){_0x34d275=_0x34d275-0x0;var _0x1379cc=_0xcbaa[_0x34d275];return _0x1379cc;};'use strict';var _=require(_0xacba('0x0'));var util=require(_0xacba('0x1'));var logger=require(_0xacba('0x2'))(_0xacba('0x3'));var moment=require(_0xacba('0x4'));var BPromise=require('bluebird');var rp=require(_0xacba('0x5'));var fs=require('fs');var path=require(_0xacba('0x6'));var rimraf=require('rimraf');var config=require(_0xacba('0x7'));var attributes=require(_0xacba('0x8'));module[_0xacba('0x9')]=function(_0x453d93,_0x568740){return _0x453d93[_0xacba('0xa')](_0xacba('0xb'),attributes,{'tableName':_0xacba('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 81c687c..0496b5b 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 _0x9d59=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','bluebird'];(function(_0x3ed75e,_0x5f465a){var _0x441dac=function(_0x4b2182){while(--_0x4b2182){_0x3ed75e['push'](_0x3ed75e['shift']());}};_0x441dac(++_0x5f465a);}(_0x9d59,0x1e1));var _0x99d5=function(_0x5e5a29,_0x5e5ffc){_0x5e5a29=_0x5e5a29-0x0;var _0x48c4fa=_0x9d59[_0x5e5a29];return _0x48c4fa;};'use strict';var _=require(_0x99d5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x99d5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x99d5('0x2'));var db=require(_0x99d5('0x3'))['db'];var utils=require(_0x99d5('0x4'));var logger=require(_0x99d5('0x5'))(_0x99d5('0x6'));var config=require(_0x99d5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x99d5('0x8')][_0x99d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x560f99,_0x362a7c,_0x28fcc8){return new BPromise(function(_0x2bb5f7,_0x12f399){return client[_0x99d5('0xa')](_0x560f99,_0x28fcc8)[_0x99d5('0xb')](function(_0x1d317c){logger[_0x99d5('0xc')](_0x99d5('0xd'),_0x362a7c,_0x99d5('0xe'));logger[_0x99d5('0xf')](_0x99d5('0x10'),_0x362a7c,_0x99d5('0xe'),JSON[_0x99d5('0x11')](_0x1d317c));if(_0x1d317c[_0x99d5('0x12')]){if(_0x1d317c[_0x99d5('0x12')][_0x99d5('0x13')]===0x1f4){logger[_0x99d5('0x12')](_0x99d5('0xd'),_0x362a7c,_0x1d317c['error'][_0x99d5('0x14')]);return _0x12f399(_0x1d317c['error'][_0x99d5('0x14')]);}logger['error'](_0x99d5('0xd'),_0x362a7c,_0x1d317c[_0x99d5('0x12')][_0x99d5('0x14')]);return _0x2bb5f7(_0x1d317c[_0x99d5('0x12')][_0x99d5('0x14')]);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x362a7c,_0x99d5('0xe'));_0x2bb5f7(_0x1d317c['result']['message']);}})['catch'](function(_0x3de37b){logger[_0x99d5('0x12')](_0x99d5('0xd'),_0x362a7c,_0x3de37b);_0x12f399(_0x3de37b);});});} \ No newline at end of file +var _0x2e67=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2f1dc5,_0x5cd881){var _0x52cdcc=function(_0x4b7806){while(--_0x4b7806){_0x2f1dc5['push'](_0x2f1dc5['shift']());}};_0x52cdcc(++_0x5cd881);}(_0x2e67,0x106));var _0x72e6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2e67[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x72e6('0x0'));var util=require(_0x72e6('0x1'));var moment=require('moment');var BPromise=require(_0x72e6('0x2'));var rs=require(_0x72e6('0x3'));var fs=require('fs');var Redis=require(_0x72e6('0x4'));var db=require(_0x72e6('0x5'))['db'];var utils=require(_0x72e6('0x6'));var logger=require(_0x72e6('0x7'))(_0x72e6('0x8'));var config=require(_0x72e6('0x9'));var jayson=require(_0x72e6('0xa'));var client=jayson[_0x72e6('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18cf02,_0x3b1c54,_0x233996){return new BPromise(function(_0x3cf089,_0x4903ba){return client[_0x72e6('0xc')](_0x18cf02,_0x233996)[_0x72e6('0xd')](function(_0x3b37bb){logger[_0x72e6('0xe')](_0x72e6('0xf'),_0x3b1c54,'request\x20sent');logger[_0x72e6('0x10')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x3b1c54,_0x72e6('0x11'),JSON[_0x72e6('0x12')](_0x3b37bb));if(_0x3b37bb[_0x72e6('0x13')]){if(_0x3b37bb[_0x72e6('0x13')][_0x72e6('0x14')]===0x1f4){logger[_0x72e6('0x13')](_0x72e6('0xf'),_0x3b1c54,_0x3b37bb[_0x72e6('0x13')][_0x72e6('0x15')]);return _0x4903ba(_0x3b37bb[_0x72e6('0x13')]['message']);}logger[_0x72e6('0x13')](_0x72e6('0xf'),_0x3b1c54,_0x3b37bb[_0x72e6('0x13')][_0x72e6('0x15')]);return _0x3cf089(_0x3b37bb[_0x72e6('0x13')][_0x72e6('0x15')]);}else{logger[_0x72e6('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x3b1c54,'request\x20sent');_0x3cf089(_0x3b37bb[_0x72e6('0x16')]['message']);}})[_0x72e6('0x17')](function(_0x24a1e7){logger[_0x72e6('0x13')](_0x72e6('0xf'),_0x3b1c54,_0x24a1e7);_0x4903ba(_0x24a1e7);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 69f83f3..169a089 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 _0x89ee=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/preview','/:id/run','/:id/query','query','create','update'];(function(_0xbc3542,_0x4de021){var _0x1c88ff=function(_0x1d1fb4){while(--_0x1d1fb4){_0xbc3542['push'](_0xbc3542['shift']());}};_0x1c88ff(++_0x4de021);}(_0x89ee,0x1a7));var _0xe89e=function(_0xa20cda,_0x25c9ae){_0xa20cda=_0xa20cda-0x0;var _0x37b33f=_0x89ee[_0xa20cda];return _0x37b33f;};'use strict';var multer=require(_0xe89e('0x0'));var util=require(_0xe89e('0x1'));var path=require(_0xe89e('0x2'));var timeout=require(_0xe89e('0x3'));var express=require('express');var router=express[_0xe89e('0x4')]();var fs_extra=require(_0xe89e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe89e('0x6'));var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0xe89e('0x7')]('/',auth['isAuthenticated'](),controller[_0xe89e('0x8')]);router[_0xe89e('0x7')](_0xe89e('0x9'),auth[_0xe89e('0xa')](),controller[_0xe89e('0xb')]);router[_0xe89e('0x7')](_0xe89e('0xc'),auth[_0xe89e('0xa')](),controller['preview']);router[_0xe89e('0x7')](_0xe89e('0xd'),auth[_0xe89e('0xa')](),controller['run']);router['get'](_0xe89e('0xe'),auth['isAuthenticated'](),controller[_0xe89e('0xf')]);router['post']('/',auth[_0xe89e('0xa')](),controller[_0xe89e('0x10')]);router['put'](_0xe89e('0x9'),auth[_0xe89e('0xa')](),controller[_0xe89e('0x11')]);router[_0xe89e('0x12')](_0xe89e('0x9'),auth['isAuthenticated'](),controller[_0xe89e('0x13')]);module[_0xe89e('0x14')]=router; \ No newline at end of file +var _0xef2a=['preview','/:id/run','query','create','put','update','destroy','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','/:id','isAuthenticated','show','/:id/preview'];(function(_0x35d261,_0x48d9e0){var _0x3efc32=function(_0x117261){while(--_0x117261){_0x35d261['push'](_0x35d261['shift']());}};_0x3efc32(++_0x48d9e0);}(_0xef2a,0x118));var _0xaef2=function(_0x4a0990,_0x27f16e){_0x4a0990=_0x4a0990-0x0;var _0x309dd3=_0xef2a[_0x4a0990];return _0x309dd3;};'use strict';var multer=require('multer');var util=require(_0xaef2('0x0'));var path=require(_0xaef2('0x1'));var timeout=require('connect-timeout');var express=require(_0xaef2('0x2'));var router=express['Router']();var fs_extra=require(_0xaef2('0x3'));var auth=require(_0xaef2('0x4'));var interaction=require(_0xaef2('0x5'));var config=require(_0xaef2('0x6'));var controller=require(_0xaef2('0x7'));router[_0xaef2('0x8')]('/',auth['isAuthenticated'](),controller[_0xaef2('0x9')]);router[_0xaef2('0x8')](_0xaef2('0xa'),auth[_0xaef2('0xb')](),controller[_0xaef2('0xc')]);router[_0xaef2('0x8')](_0xaef2('0xd'),auth[_0xaef2('0xb')](),controller[_0xaef2('0xe')]);router[_0xaef2('0x8')](_0xaef2('0xf'),auth[_0xaef2('0xb')](),controller['run']);router[_0xaef2('0x8')]('/:id/query',auth[_0xaef2('0xb')](),controller[_0xaef2('0x10')]);router['post']('/',auth[_0xaef2('0xb')](),controller[_0xaef2('0x11')]);router[_0xaef2('0x12')]('/:id',auth[_0xaef2('0xb')](),controller[_0xaef2('0x13')]);router['delete']('/:id',auth[_0xaef2('0xb')](),controller[_0xaef2('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 86e9764..3ed4a9b 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 _0xdc97=['exports','STRING','TEXT','sequelize'];(function(_0x56e32e,_0x9eb2f6){var _0x2a757b=function(_0x50b7bc){while(--_0x50b7bc){_0x56e32e['push'](_0x56e32e['shift']());}};_0x2a757b(++_0x9eb2f6);}(_0xdc97,0x13b));var _0x7dc9=function(_0x5c7464,_0x426607){_0x5c7464=_0x5c7464-0x0;var _0x54752e=_0xdc97[_0x5c7464];return _0x54752e;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'name':{'type':Sequelize[_0x7dc9('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x7dc9('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x7dc9('0x3')]},'joins':{'type':Sequelize[_0x7dc9('0x3')]}}; \ No newline at end of file +var _0x3eea=['STRING','TEXT','sequelize'];(function(_0x4b85a1,_0x1d48f4){var _0x16a58f=function(_0x3f27eb){while(--_0x3f27eb){_0x4b85a1['push'](_0x4b85a1['shift']());}};_0x16a58f(++_0x1d48f4);}(_0x3eea,0x1ca));var _0xa3ee=function(_0xbcd81d,_0xb2f44e){_0xbcd81d=_0xbcd81d-0x0;var _0x42f2bf=_0x3eea[_0xbcd81d];return _0x42f2bf;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index c01c92e..be4904b 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 _0x326f=['order','orderBy','DESC','joins','foreignTable','foreignKey','parentKey','conditions','Limited\x20Query:','toString','sequelize','SELECT','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','UNIX_TIMESTAMP(%s)','operator','AnalyticMetric','select','from','function','parse','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','Run\x20Query:','child_process','fork','join','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','SEC_TO_TIME(%s)','debug','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','count','apply','update','then','get','DefaultReports','UserProfileResource','destroy','end','error','name','send','index','map','AnalyticDefaultReport','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','left_join','right_join','cross_join','COUNT(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','table','MetricId','metric','format','replace','groupBy'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x326f,0xd1));var _0xf326=function(_0x193d18,_0x5d4070){_0x193d18=_0x193d18-0x0;var _0x5a2e4c=_0x326f[_0x193d18];return _0x5a2e4c;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf326('0x17'))[_0xf326('0x18')];function respondWithStatusCode(_0x4b3966,_0x342fe5){_0x342fe5=_0x342fe5||0xcc;return function(_0x472632){if(_0x472632){return _0x4b3966[_0xf326('0x19')](_0x342fe5);}return _0x4b3966[_0xf326('0x1a')](_0x342fe5)['end']();};}function respondWithResult(_0x45c1b6,_0x5204ee){_0x5204ee=_0x5204ee||0xc8;return function(_0x54bd1a){if(_0x54bd1a){return _0x45c1b6[_0xf326('0x1a')](_0x5204ee)[_0xf326('0x1b')](_0x54bd1a);}};}function respondWithFilteredResult(_0x1f2e5a,_0xa63d1a){return function(_0x292f4b){if(_0x292f4b){var _0x287a2a=typeof _0xa63d1a[_0xf326('0x1c')]===_0xf326('0x1d')&&typeof _0xa63d1a['limit']===_0xf326('0x1d');var _0x453100=_0x292f4b[_0xf326('0x1e')];var _0x31ffb9=_0x287a2a?0x0:_0xa63d1a[_0xf326('0x1c')];var _0x311af0=_0x287a2a?_0x292f4b['count']:_0xa63d1a['offset']+_0xa63d1a['limit'];var _0x16e605;if(_0x311af0>=_0x453100){_0x311af0=_0x453100;_0x16e605=0xc8;}else{_0x16e605=0xce;}_0x1f2e5a[_0xf326('0x1a')](_0x16e605);return _0x1f2e5a['set']('Content-Range',_0x31ffb9+'-'+_0x311af0+'/'+_0x453100)[_0xf326('0x1b')](_0x292f4b);}return null;};}function patchUpdates(_0x4dfa76){return function(_0x5b6d3c){try{jsonpatch[_0xf326('0x1f')](_0x5b6d3c,_0x4dfa76,!![]);}catch(_0x18ead3){return BPromise['reject'](_0x18ead3);}return _0x5b6d3c['save']();};}function saveUpdates(_0x19b8ba,_0xb1efcf){return function(_0x5f21a2){if(_0x5f21a2){return _0x5f21a2[_0xf326('0x20')](_0x19b8ba)[_0xf326('0x21')](function(_0x43c53e){return _0x43c53e;});}return null;};}function removeEntity(_0x295752,_0x17c157){return function(_0x2049ec){if(_0x2049ec){return _0x2049ec['destroy']()['then'](function(){var _0x4f31f6=_0x2049ec[_0xf326('0x22')]({'plain':!![]});var _0x1a2c4e=_0xf326('0x23');return db[_0xf326('0x24')][_0xf326('0x25')]({'where':{'type':_0x1a2c4e,'resourceId':_0x4f31f6['id']}})[_0xf326('0x21')](function(){return _0x2049ec;});})['then'](function(){_0x295752[_0xf326('0x1a')](0xcc)[_0xf326('0x26')]();});}};}function handleEntityNotFound(_0x212d5d,_0x581531){return function(_0x1617d2){if(!_0x1617d2){_0x212d5d['sendStatus'](0x194);}return _0x1617d2;};}function handleError(_0x4a9abf,_0x6a8e89){_0x6a8e89=_0x6a8e89||0x1f4;return function(_0x1ae23a){logger[_0xf326('0x27')](_0x1ae23a['stack']);if(_0x1ae23a[_0xf326('0x28')]){delete _0x1ae23a[_0xf326('0x28')];}_0x4a9abf['status'](_0x6a8e89)[_0xf326('0x29')](_0x1ae23a);};}exports[_0xf326('0x2a')]=function(_0xd77aba,_0x18d110){var _0xa80156={},_0x269be9={},_0x161143={'count':0x0,'rows':[]};var _0x39a1e2=_[_0xf326('0x2b')](db[_0xf326('0x2c')]['rawAttributes'],function(_0x1035ed){return{'name':_0x1035ed[_0xf326('0x2d')],'type':_0x1035ed[_0xf326('0x2e')]['key']};});_0x269be9[_0xf326('0x2f')]=_[_0xf326('0x2b')](_0x39a1e2,_0xf326('0x28'));_0x269be9['query']=_['keys'](_0xd77aba[_0xf326('0x30')]);_0x269be9[_0xf326('0x31')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],_0x269be9[_0xf326('0x30')]);_0xa80156[_0xf326('0x33')]=_[_0xf326('0x32')](_0x269be9[_0xf326('0x2f')],qs['fields'](_0xd77aba[_0xf326('0x30')][_0xf326('0x34')]));_0xa80156['attributes']=_0xa80156[_0xf326('0x33')]['length']?_0xa80156[_0xf326('0x33')]:_0x269be9['model'];if(!_0xd77aba['query'][_0xf326('0x35')]('nolimit')){_0xa80156[_0xf326('0x36')]=qs['limit'](_0xd77aba[_0xf326('0x30')][_0xf326('0x36')]);_0xa80156[_0xf326('0x1c')]=qs['offset'](_0xd77aba[_0xf326('0x30')][_0xf326('0x1c')]);}_0xa80156['order']=qs[_0xf326('0x37')](_0xd77aba[_0xf326('0x30')][_0xf326('0x37')]);_0xa80156[_0xf326('0x38')]=qs['filters'](_[_0xf326('0x39')](_0xd77aba[_0xf326('0x30')],_0x269be9[_0xf326('0x31')]),_0x39a1e2);if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3a')]){_0xa80156['where']=_[_0xf326('0x3b')](_0xa80156[_0xf326('0x38')],{'$or':_['map'](_0x39a1e2,function(_0x4dd361){if(_0x4dd361[_0xf326('0x2e')]!=='VIRTUAL'){var _0x55dfa8={};_0x55dfa8[_0x4dd361[_0xf326('0x28')]]={'$like':'%'+_0xd77aba['query'][_0xf326('0x3a')]+'%'};return _0x55dfa8;}})});}_0xa80156=_[_0xf326('0x3b')]({},_0xa80156,_0xd77aba[_0xf326('0x3c')]);var _0x39611e={'where':_0xa80156['where']};return db[_0xf326('0x2c')][_0xf326('0x1e')](_0x39611e)[_0xf326('0x21')](function(_0x365627){_0x161143[_0xf326('0x1e')]=_0x365627;if(_0xd77aba[_0xf326('0x30')][_0xf326('0x3d')]){_0xa80156[_0xf326('0x3e')]=[{'all':!![]}];}return db[_0xf326('0x2c')][_0xf326('0x3f')](_0xa80156);})[_0xf326('0x21')](function(_0x2bab13){_0x161143['rows']=_0x2bab13;return _0x161143;})[_0xf326('0x21')](respondWithFilteredResult(_0x18d110,_0xa80156))[_0xf326('0x40')](handleError(_0x18d110,null));};exports[_0xf326('0x41')]=function(_0x270288,_0x1dd262){var _0x1a2d0d={'raw':!![],'where':{'id':_0x270288[_0xf326('0x42')]['id']}},_0x4f4c51={};_0x4f4c51[_0xf326('0x2f')]=_['keys'](db[_0xf326('0x2c')][_0xf326('0x43')]);_0x4f4c51[_0xf326('0x30')]=_[_0xf326('0x44')](_0x270288[_0xf326('0x30')]);_0x4f4c51['filters']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],_0x4f4c51[_0xf326('0x30')]);_0x1a2d0d['attributes']=_['intersection'](_0x4f4c51[_0xf326('0x2f')],qs[_0xf326('0x34')](_0x270288[_0xf326('0x30')]['fields']));_0x1a2d0d[_0xf326('0x33')]=_0x1a2d0d[_0xf326('0x33')][_0xf326('0x45')]?_0x1a2d0d[_0xf326('0x33')]:_0x4f4c51[_0xf326('0x2f')];if(_0x270288[_0xf326('0x30')][_0xf326('0x3d')]){_0x1a2d0d[_0xf326('0x3e')]=[{'all':!![]}];}_0x1a2d0d=_[_0xf326('0x3b')]({},_0x1a2d0d,_0x270288[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x1a2d0d)[_0xf326('0x21')](handleEntityNotFound(_0x1dd262,null))[_0xf326('0x21')](respondWithResult(_0x1dd262,null))[_0xf326('0x40')](handleError(_0x1dd262,null));};exports['create']=function(_0x199f8b,_0x1b0e03){return db[_0xf326('0x2c')][_0xf326('0x47')](_0x199f8b['body'],{})[_0xf326('0x21')](function(_0x2f5511){var _0xca88e=_0x199f8b[_0xf326('0x48')]['get']({'plain':!![]});if(!_0xca88e)throw new Error(_0xf326('0x49'));if(_0xca88e[_0xf326('0x4a')]===_0xf326('0x48')){var _0x451ac7=_0x2f5511[_0xf326('0x22')]({'plain':!![]});var _0x4970fb='Reports';return db[_0xf326('0x4b')][_0xf326('0x46')]({'where':{'name':_0x4970fb,'userProfileId':_0xca88e[_0xf326('0x4c')]},'raw':!![]})['then'](function(_0x102fba){if(_0x102fba&&_0x102fba[_0xf326('0x4d')]===0x0){return db[_0xf326('0x24')]['create']({'name':_0x451ac7['name'],'resourceId':_0x451ac7['id'],'type':_0xf326('0x23'),'sectionId':_0x102fba['id']},{})['then'](function(){return _0x2f5511;});}else{return _0x2f5511;}})[_0xf326('0x40')](function(_0x554277){logger[_0xf326('0x27')](_0xf326('0x4e'),_0x554277);throw _0x554277;});}return _0x2f5511;})[_0xf326('0x21')](respondWithResult(_0x1b0e03,0xc9))[_0xf326('0x40')](handleError(_0x1b0e03,null));};exports[_0xf326('0x20')]=function(_0x35d3c8,_0x7f7ece){if(_0x35d3c8['body']['id']){delete _0x35d3c8[_0xf326('0x4f')]['id'];}return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x35d3c8['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x7f7ece,null))[_0xf326('0x21')](saveUpdates(_0x35d3c8[_0xf326('0x4f')],null))[_0xf326('0x21')](respondWithResult(_0x7f7ece,null))[_0xf326('0x40')](handleError(_0x7f7ece,null));};exports['destroy']=function(_0x161fb3,_0x21eac7){return db[_0xf326('0x2c')][_0xf326('0x46')]({'where':{'id':_0x161fb3['params']['id']}})[_0xf326('0x21')](handleEntityNotFound(_0x21eac7,null))[_0xf326('0x21')](removeEntity(_0x21eac7,null))[_0xf326('0x40')](handleError(_0x21eac7,null));};exports[_0xf326('0x50')]=function(_0x4d3b9e,_0x5be2b1){var _0x18b46e=0xa;var _0x44d2ed=['join',_0xf326('0x51'),_0xf326('0x52'),_0xf326('0x53')];var _0x1258d1={'SUM':'SUM(%s)','COUNT':_0xf326('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':_0xf326('0x58')};var _0x4eef49={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':_0xf326('0x5a'),'ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2759d7=function(_0x487020){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x487020);};var _0x18dbfc=function(_0x23a9e8){if(!_0x23a9e8||!_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x33f9dd='(',_0x33ffb8=0x0;_0x33ffb8<_0x23a9e8[_0xf326('0x61')][_0xf326('0x45')];_0x33ffb8+=0x1){_0x33ffb8>0x0&&(_0x33f9dd+='\x20'+_0x23a9e8['operator']+'\x20');_0x33f9dd+=_0x23a9e8[_0xf326('0x61')][_0x33ffb8]['group']?_0x18dbfc(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x62')]):_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x63')]+'\x20'+_0x23a9e8['rules'][_0x33ffb8][_0xf326('0x64')]+(_0x2759d7(_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x64')])?'\x20'+_0x23a9e8[_0xf326('0x61')][_0x33ffb8][_0xf326('0x65')]:'');}return _0x33f9dd+')';};var _0x51ff5e={'where':{'id':_0x4d3b9e[_0xf326('0x42')]['id']}},_0x4ec099,_0x1209ca,_0x32fe3a,_0x15a538,_0x21b3cc;_0x51ff5e=_['merge']({},_0x51ff5e,_0x4d3b9e[_0xf326('0x3c')]);return db[_0xf326('0x2c')]['find'](_0x51ff5e)['then'](function(_0x5b25ca){if(_0x5b25ca){_0x4ec099=_0x5b25ca;return _0x5b25ca[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4150fa){if(_0x4150fa){if(!_0x4150fa[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x1209ca=_0x4150fa;return db['AnalyticMetric'][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x3c3379){if(_0x3c3379){_0x32fe3a=_[_0xf326('0x6a')](_0x3c3379,'id');var _0x58de1e;var _0x3717fe=squel['select']();_0x3717fe['from'](_0x4ec099[_0xf326('0x6b')]);for(var _0x540fa0=0x0;_0x540fa0<_0x1209ca[_0xf326('0x45')];_0x540fa0+=0x1){_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6c')]?_0x32fe3a[_0x1209ca[_0x540fa0][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x1209ca[_0x540fa0][_0xf326('0x63')];_0x58de1e=_0x1209ca[_0x540fa0]['function']?_['replace'](_0x1258d1[_0x1209ca[_0x540fa0]['function']],'%s',_0x58de1e):_0x58de1e;_0x58de1e=_0x1209ca[_0x540fa0][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x4eef49[_0x1209ca[_0x540fa0][_0xf326('0x6e')]],'%s',_0x58de1e):_0x58de1e;if(_0x1209ca[_0x540fa0][_0xf326('0x70')]){_0x3717fe[_0xf326('0x62')](_0x58de1e);}_0x1209ca[_0x540fa0]['orderBy']&&_0x3717fe[_0xf326('0x71')](_0x58de1e,_0x1209ca[_0x540fa0][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x3717fe['field'](_0x58de1e,_0x1209ca[_0x540fa0]['alias']||_0x58de1e);}if(_0x4ec099[_0xf326('0x74')]){_0x4ec099[_0xf326('0x74')]=JSON['parse'](_0x4ec099['joins']);for(var _0x2497fd=0x0;_0x2497fd<_0x4ec099['joins'][_0xf326('0x45')];_0x2497fd+=0x1){if(_0x4ec099['joins'][_0x2497fd]['type']&&_['includes'](_0x44d2ed,_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')])&&_0x4ec099[_0xf326('0x74')][_0x2497fd]['parentKey']&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')]&&_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x76')]){_0x3717fe[_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x2e')]](_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],null,util[_0xf326('0x6e')]('%s.%s\x20=\x20%s.%s',_0x4ec099[_0xf326('0x6b')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x77')],_0x4ec099[_0xf326('0x74')][_0x2497fd][_0xf326('0x75')],_0x4ec099['joins'][_0x2497fd][_0xf326('0x76')]));}}}if(_0x4ec099[_0xf326('0x78')]){_0x4ec099[_0xf326('0x78')]=JSON['parse'](_0x4ec099[_0xf326('0x78')]);_0x3717fe[_0xf326('0x38')](_0x18dbfc(_0x4ec099[_0xf326('0x78')][_0xf326('0x62')]));}_0x21b3cc=_0x3717fe['clone']();_0x3717fe[_0xf326('0x36')](_0x18b46e);_0x3717fe['offset'](0x0);logger['debug'](_0xf326('0x79'),_0x3717fe[_0xf326('0x7a')]());return dbH['sequelize']['query'](_0x3717fe['toString'](),{'type':dbH[_0xf326('0x7b')]['QueryTypes'][_0xf326('0x7c')]});}})[_0xf326('0x21')](respondWithResult(_0x5be2b1,null))[_0xf326('0x40')](handleError(_0x5be2b1,null));};function runReport(_0x2ec314,_0xf76a89,_0x25b56c){var _0x5d23f0=_0xf76a89[_0xf326('0x28')];var _0x323926=0xa;var _0x5f1724=['join',_0xf326('0x51'),'right_join',_0xf326('0x53')];var _0x147d51={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':_0xf326('0x7f'),'MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf326('0x58')};var _0x26bbb1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x14e8c0=function(_0x5814ad){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x5814ad);};var _0x1e50aa=function(_0x148779){if(!_0x148779||!_0x148779[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x38b696='(',_0x384b46=0x0;_0x384b46<_0x148779[_0xf326('0x61')][_0xf326('0x45')];_0x384b46+=0x1){_0x384b46>0x0&&(_0x38b696+='\x20'+_0x148779[_0xf326('0x82')]+'\x20');_0x38b696+=_0x148779[_0xf326('0x61')][_0x384b46]['group']?_0x1e50aa(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x62')]):_0x148779['rules'][_0x384b46][_0xf326('0x63')]+'\x20'+_0x148779[_0xf326('0x61')][_0x384b46]['condition']+(_0x14e8c0(_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x64')])?'\x20'+_0x148779[_0xf326('0x61')][_0x384b46][_0xf326('0x65')]:'');}return _0x38b696+')';};var _0x2ab607={'where':{'id':_0x2ec314['id']}},_0x35c228,_0x1bb7cc,_0x5794d0,_0x15d61e,_0x107c00;_0x2ab607=_[_0xf326('0x3b')]({},_0x2ab607,_0x25b56c);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x2ab607)[_0xf326('0x21')](function(_0x204002){if(_0x204002){_0x35c228=_0x204002;return _0x204002[_0xf326('0x66')]();}return null;})['then'](function(_0xa8e05b){if(_0xa8e05b){if(!_0xa8e05b[_0xf326('0x45')]){throw new db['Sequelize'][(_0xf326('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1bb7cc=_0xa8e05b;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x2a0f36){if(_0x2a0f36){_0x5794d0=_[_0xf326('0x6a')](_0x2a0f36,'id');var _0x3097cf;var _0xf66b70=squel[_0xf326('0x84')]();_0xf66b70[_0xf326('0x85')](_0x35c228[_0xf326('0x6b')]);for(var _0x3f073c=0x0;_0x3f073c<_0x1bb7cc[_0xf326('0x45')];_0x3f073c+=0x1){_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]?_0x5794d0[_0x1bb7cc[_0x3f073c][_0xf326('0x6c')]]['metric']:_0x1bb7cc[_0x3f073c][_0xf326('0x63')];_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x147d51[_0x1bb7cc[_0x3f073c][_0xf326('0x86')]],'%s',_0x3097cf):_0x3097cf;_0x3097cf=_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]?_['replace'](_0x26bbb1[_0x1bb7cc[_0x3f073c][_0xf326('0x6e')]],'%s',_0x3097cf):_0x3097cf;if(_0x1bb7cc[_0x3f073c][_0xf326('0x70')]){_0xf66b70[_0xf326('0x62')](_0x3097cf);}_0x1bb7cc[_0x3f073c][_0xf326('0x72')]&&_0xf66b70[_0xf326('0x71')](_0x3097cf,_0x1bb7cc[_0x3f073c]['orderBy']==='DESC'?![]:!![]);_0xf66b70[_0xf326('0x63')](_0x3097cf,_0x1bb7cc[_0x3f073c]['alias']||_0x3097cf);}if(_0x35c228[_0xf326('0x74')]){_0x35c228[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x35c228['joins']);for(var _0x54b023=0x0;_0x54b023<_0x35c228[_0xf326('0x74')][_0xf326('0x45')];_0x54b023+=0x1){if(_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]&&_[_0xf326('0x5c')](_0x5f1724,_0x35c228['joins'][_0x54b023][_0xf326('0x2e')])&&_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x77')]&&_0x35c228['joins'][_0x54b023]['foreignTable']&&_0x35c228['joins'][_0x54b023][_0xf326('0x76')]){_0xf66b70[_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x2e')]](_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x35c228['table'],_0x35c228['joins'][_0x54b023][_0xf326('0x77')],_0x35c228[_0xf326('0x74')][_0x54b023][_0xf326('0x75')],_0x35c228['joins'][_0x54b023][_0xf326('0x76')]));}}}if(_0x35c228[_0xf326('0x78')]){_0x35c228[_0xf326('0x78')]=JSON['parse'](_0x35c228[_0xf326('0x78')]);_0xf66b70[_0xf326('0x38')](_0x1e50aa(_0x35c228[_0xf326('0x78')][_0xf326('0x62')]));}_0x107c00=_0xf66b70['clone']();_0xf66b70['limit'](_0x323926);_0xf66b70['offset'](0x0);return;}})[_0xf326('0x21')](function(){if(_0xf76a89[_0xf326('0x89')]===_0xf326('0x8a')){return null;}var _0x5f0b45=_[_0xf326('0x3b')](_0xf76a89,{'name':_0xf76a89[_0xf326('0x8b')]||_0xf76a89[_0xf326('0x28')]||_0x35c228['name'],'basename':_0x5d23f0,'savename':util[_0xf326('0x6e')](_0xf326('0x8c'),_0xf76a89[_0xf326('0x28')]||_0x35c228[_0xf326('0x28')],require('randomstring')[_0xf326('0x8d')](0x4),_0xf76a89['output']||_0xf326('0x8e')),'reportId':_0x35c228['id'],'reportType':_0xf326('0x8f')});return db[_0xf326('0x90')][_0xf326('0x47')](_0x5f0b45,{'raw':!![]});})['then'](function(_0x2e2f70){if(_0x35c228['table']===_0xf326('0x91')){_0x107c00[_0xf326('0x38')](_0x35c228[_0xf326('0x6b')]+_0xf326('0x92'),_0xf76a89[_0xf326('0x93')],_0xf76a89['endDate']);}else{_0x107c00['where'](_0x35c228[_0xf326('0x6b')]+_0xf326('0x94'),_0xf76a89[_0xf326('0x93')],_0xf76a89[_0xf326('0x95')]);}if(_0x2e2f70){logger['info'](_0xf326('0x96'),_0x107c00['toString']());require(_0xf326('0x97'))[_0xf326('0x98')](path[_0xf326('0x99')](__dirname,'../../components/export/',_0x2e2f70[_0xf326('0x89')]),[_0x2e2f70['id'],_0x107c00[_0xf326('0x7a')](),path[_0xf326('0x99')](__dirname,_0xf326('0x9a'),_0x2e2f70[_0xf326('0x9b')]),_0x5d23f0]);return _0x2e2f70;}else{var _0x4dc4bc=squel[_0xf326('0x84')]();_0x4dc4bc[_0xf326('0x85')]('('+_0x107c00['toString']()+')',_0xf326('0x9c'));_0x4dc4bc[_0xf326('0x63')](_0xf326('0x9d'),_0xf326('0x1e'));_0x107c00['limit'](_0xf76a89['limit']||_0x323926);_0x107c00[_0xf326('0x1c')](_0xf76a89[_0xf326('0x1c')]||0x0);return dbH['sequelize'][_0xf326('0x30')](_0x4dc4bc['toString'](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]})[_0xf326('0x21')](function(_0x37cd6f){if(!_0x37cd6f[_0xf326('0x45')]){_0x15d61e=0x0;}else{_0x15d61e=_0x37cd6f[0x0][_0xf326('0x1e')]||0x0;}return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x107c00[_0xf326('0x7a')](),{'type':dbH['sequelize'][_0xf326('0x9e')][_0xf326('0x7c')]});})[_0xf326('0x21')](function(_0x1c7f81){return{'rows':_0x1c7f81||[],'count':_0x15d61e};});}});}exports['run']=function(_0x3e6a5d,_0x20020c){return runReport(_0x3e6a5d[_0xf326('0x42')],_0x3e6a5d[_0xf326('0x30')],_0x3e6a5d[_0xf326('0x3c')])['then'](respondWithResult(_0x20020c,null))[_0xf326('0x40')](handleError(_0x20020c,null));};exports['runReport']=runReport;exports[_0xf326('0x30')]=function(_0x14d255,_0xffd165){var _0x2bc501=0xa;var _0x4bd216=[_0xf326('0x99'),_0xf326('0x51'),_0xf326('0x52'),'cross_join'];var _0x23451e={'SUM':_0xf326('0x7d'),'COUNT':_0xf326('0x54'),'COUNT DISTINCT':_0xf326('0x7e'),'MAX':'MAX(%s)','MIN':_0xf326('0x55'),'AVG':_0xf326('0x80'),'GROUP_CONCAT':_0xf326('0x56'),'GROUP_CONCAT ASC':_0xf326('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x310223={'SEC_TO_TIME':_0xf326('0x9f'),'DATE':_0xf326('0x59'),'HOUR':'HOUR(%s)','ROUND':_0xf326('0x5b'),'UNIX_TIMESTAMP':_0xf326('0x81')};var _0x539d23=function(_0x171c53){return!_[_0xf326('0x5c')]([_0xf326('0x5d'),_0xf326('0x5e'),_0xf326('0x5f'),_0xf326('0x60')],_0x171c53);};var _0x4c7fc0=function(_0x4ffde1){if(!_0x4ffde1||!_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')]){return'';}for(var _0x4307d9='(',_0x2fa05b=0x0;_0x2fa05b<_0x4ffde1[_0xf326('0x61')][_0xf326('0x45')];_0x2fa05b+=0x1){_0x2fa05b>0x0&&(_0x4307d9+='\x20'+_0x4ffde1['operator']+'\x20');_0x4307d9+=_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]?_0x4c7fc0(_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x62')]):_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x63')]+'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b][_0xf326('0x64')]+(_0x539d23(_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['condition'])?'\x20'+_0x4ffde1[_0xf326('0x61')][_0x2fa05b]['value']:'');}return _0x4307d9+')';};var _0x590dc0={'where':{'id':_0x14d255[_0xf326('0x42')]['id']}},_0x32fc6e,_0x549a1f,_0x1f37f9,_0x3e0918,_0x3398fd;_0x590dc0=_[_0xf326('0x3b')]({},_0x590dc0,_0x14d255[_0xf326('0x3c')]);return db[_0xf326('0x2c')][_0xf326('0x46')](_0x590dc0)[_0xf326('0x21')](function(_0x314442){if(_0x314442){_0x32fc6e=_0x314442;return _0x314442[_0xf326('0x66')]();}return null;})[_0xf326('0x21')](function(_0x4c1fcd){if(_0x4c1fcd){if(!_0x4c1fcd[_0xf326('0x45')]){throw new db[(_0xf326('0x67'))][(_0xf326('0x68'))](_0xf326('0x69'),0x193);}_0x549a1f=_0x4c1fcd;return db[_0xf326('0x83')][_0xf326('0x3f')]({'raw':!![]});}return null;})[_0xf326('0x21')](function(_0x5429a2){if(_0x5429a2){_0x1f37f9=_[_0xf326('0x6a')](_0x5429a2,'id');var _0x15f799;var _0x320ab3=squel[_0xf326('0x84')]();_0x320ab3[_0xf326('0x85')](_0x32fc6e[_0xf326('0x6b')]);for(var _0x2094bf=0x0;_0x2094bf<_0x549a1f['length'];_0x2094bf+=0x1){_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6c')]?_0x1f37f9[_0x549a1f[_0x2094bf][_0xf326('0x6c')]][_0xf326('0x6d')]:_0x549a1f[_0x2094bf][_0xf326('0x63')];_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x86')]?_[_0xf326('0x6f')](_0x23451e[_0x549a1f[_0x2094bf][_0xf326('0x86')]],'%s',_0x15f799):_0x15f799;_0x15f799=_0x549a1f[_0x2094bf][_0xf326('0x6e')]?_[_0xf326('0x6f')](_0x310223[_0x549a1f[_0x2094bf][_0xf326('0x6e')]],'%s',_0x15f799):_0x15f799;if(_0x549a1f[_0x2094bf][_0xf326('0x70')]){_0x320ab3[_0xf326('0x62')](_0x15f799);}_0x549a1f[_0x2094bf]['orderBy']&&_0x320ab3[_0xf326('0x71')](_0x15f799,_0x549a1f[_0x2094bf][_0xf326('0x72')]===_0xf326('0x73')?![]:!![]);_0x320ab3['field'](_0x15f799,_0x549a1f[_0x2094bf]['alias']||_0x15f799);}if(_0x32fc6e[_0xf326('0x74')]){_0x32fc6e[_0xf326('0x74')]=JSON[_0xf326('0x87')](_0x32fc6e[_0xf326('0x74')]);for(var _0x5384a5=0x0;_0x5384a5<_0x32fc6e[_0xf326('0x74')][_0xf326('0x45')];_0x5384a5+=0x1){if(_0x32fc6e[_0xf326('0x74')][_0x5384a5]['type']&&_['includes'](_0x4bd216,_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')])&&_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x75')]&&_0x32fc6e['joins'][_0x5384a5][_0xf326('0x76')]){_0x320ab3[_0x32fc6e['joins'][_0x5384a5][_0xf326('0x2e')]](_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],null,util[_0xf326('0x6e')](_0xf326('0x88'),_0x32fc6e[_0xf326('0x6b')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x77')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x75')],_0x32fc6e[_0xf326('0x74')][_0x5384a5][_0xf326('0x76')]));}}}if(_0x32fc6e[_0xf326('0x78')]){_0x32fc6e[_0xf326('0x78')]=JSON['parse'](_0x32fc6e[_0xf326('0x78')]);_0x320ab3[_0xf326('0x38')](_0x4c7fc0(_0x32fc6e[_0xf326('0x78')]['group']));}_0x3398fd=_0x320ab3['clone']();_0x320ab3['limit'](_0x2bc501);_0x320ab3[_0xf326('0x1c')](0x0);logger[_0xf326('0xa0')](_0xf326('0x79'),_0x320ab3[_0xf326('0x7a')]());return dbH[_0xf326('0x7b')][_0xf326('0x30')](_0x320ab3['toString'](),{'type':dbH[_0xf326('0x7b')][_0xf326('0x9e')][_0xf326('0x7c')]});}})[_0xf326('0x21')](function(){return{'sql':_0x3398fd[_0xf326('0x7a')]()};})['then'](respondWithResult(_0xffd165,null))[_0xf326('0x40')](handleError(_0xffd165,null));}; \ No newline at end of file +var _0xe2fe=['set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','groupBy','orderBy','alias','joins','parse','type','foreignTable','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','SEC_TO_TIME(%s)','ROUND(%s)','IS\x20EMPTY','getFields','format','foreignKey','web','%s-%s.%s','randomstring','generate','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20EMPTY','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','dbH','status','json','offset','limit','undefined','count'];(function(_0x2f6b1f,_0x368020){var _0x5bcb88=function(_0x38b2cc){while(--_0x38b2cc){_0x2f6b1f['push'](_0x2f6b1f['shift']());}};_0x5bcb88(++_0x368020);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];var dbH=require(_0xee2f('0x10'))[_0xee2f('0x11')];function respondWithStatusCode(_0x100449,_0x131874){_0x131874=_0x131874||0xcc;return function(_0x3ab91f){if(_0x3ab91f){return _0x100449['sendStatus'](_0x131874);}return _0x100449[_0xee2f('0x12')](_0x131874)['end']();};}function respondWithResult(_0x36db10,_0x271c1d){_0x271c1d=_0x271c1d||0xc8;return function(_0x48b30c){if(_0x48b30c){return _0x36db10[_0xee2f('0x12')](_0x271c1d)[_0xee2f('0x13')](_0x48b30c);}};}function respondWithFilteredResult(_0x28b614,_0x1bbf7d){return function(_0x390c2c){if(_0x390c2c){var _0x58f42a=typeof _0x1bbf7d[_0xee2f('0x14')]==='undefined'&&typeof _0x1bbf7d[_0xee2f('0x15')]===_0xee2f('0x16');var _0x502eb6=_0x390c2c['count'];var _0x40b5bc=_0x58f42a?0x0:_0x1bbf7d['offset'];var _0x69db88=_0x58f42a?_0x390c2c[_0xee2f('0x17')]:_0x1bbf7d[_0xee2f('0x14')]+_0x1bbf7d['limit'];var _0x35e1a4;if(_0x69db88>=_0x502eb6){_0x69db88=_0x502eb6;_0x35e1a4=0xc8;}else{_0x35e1a4=0xce;}_0x28b614[_0xee2f('0x12')](_0x35e1a4);return _0x28b614[_0xee2f('0x18')](_0xee2f('0x19'),_0x40b5bc+'-'+_0x69db88+'/'+_0x502eb6)[_0xee2f('0x13')](_0x390c2c);}return null;};}function patchUpdates(_0x5d36d4){return function(_0x5e73ad){try{jsonpatch[_0xee2f('0x1a')](_0x5e73ad,_0x5d36d4,!![]);}catch(_0x3a1852){return BPromise[_0xee2f('0x1b')](_0x3a1852);}return _0x5e73ad[_0xee2f('0x1c')]();};}function saveUpdates(_0x472e3b,_0xf278cc){return function(_0x39a39c){if(_0x39a39c){return _0x39a39c['update'](_0x472e3b)[_0xee2f('0x1d')](function(_0x2c47c5){return _0x2c47c5;});}return null;};}function removeEntity(_0x15ceda,_0x70e308){return function(_0x820101){if(_0x820101){return _0x820101[_0xee2f('0x1e')]()[_0xee2f('0x1d')](function(){var _0x13013f=_0x820101[_0xee2f('0x1f')]({'plain':!![]});var _0x1e394f=_0xee2f('0x20');return db[_0xee2f('0x21')][_0xee2f('0x1e')]({'where':{'type':_0x1e394f,'resourceId':_0x13013f['id']}})[_0xee2f('0x1d')](function(){return _0x820101;});})['then'](function(){_0x15ceda['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18bdbb,_0x18ff19){return function(_0x2cb0cb){if(!_0x2cb0cb){_0x18bdbb[_0xee2f('0x22')](0x194);}return _0x2cb0cb;};}function handleError(_0x892a4e,_0x3737fd){_0x3737fd=_0x3737fd||0x1f4;return function(_0x4d8398){logger[_0xee2f('0x23')](_0x4d8398['stack']);if(_0x4d8398[_0xee2f('0x24')]){delete _0x4d8398[_0xee2f('0x24')];}_0x892a4e[_0xee2f('0x12')](_0x3737fd)[_0xee2f('0x25')](_0x4d8398);};}exports[_0xee2f('0x26')]=function(_0x47d5a6,_0x310c0b){var _0xd16e35={},_0x56706e={},_0x4ee0e1={'count':0x0,'rows':[]};var _0xd1aaac=_['map'](db[_0xee2f('0x27')][_0xee2f('0x28')],function(_0x53d9b7){return{'name':_0x53d9b7[_0xee2f('0x29')],'type':_0x53d9b7['type']['key']};});_0x56706e['model']=_[_0xee2f('0x2a')](_0xd1aaac,_0xee2f('0x24'));_0x56706e['query']=_[_0xee2f('0x2b')](_0x47d5a6[_0xee2f('0x2c')]);_0x56706e[_0xee2f('0x2d')]=_[_0xee2f('0x2e')](_0x56706e[_0xee2f('0x2f')],_0x56706e['query']);_0xd16e35[_0xee2f('0x30')]=_['intersection'](_0x56706e[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x47d5a6[_0xee2f('0x2c')]['fields']));_0xd16e35[_0xee2f('0x30')]=_0xd16e35['attributes'][_0xee2f('0x32')]?_0xd16e35['attributes']:_0x56706e[_0xee2f('0x2f')];if(!_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x33')](_0xee2f('0x34'))){_0xd16e35[_0xee2f('0x15')]=qs[_0xee2f('0x15')](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x15')]);_0xd16e35[_0xee2f('0x14')]=qs[_0xee2f('0x14')](_0x47d5a6[_0xee2f('0x2c')]['offset']);}_0xd16e35[_0xee2f('0x35')]=qs['sort'](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x36')]);_0xd16e35[_0xee2f('0x37')]=qs[_0xee2f('0x2d')](_[_0xee2f('0x38')](_0x47d5a6[_0xee2f('0x2c')],_0x56706e[_0xee2f('0x2d')]),_0xd1aaac);if(_0x47d5a6[_0xee2f('0x2c')]['filter']){_0xd16e35['where']=_['merge'](_0xd16e35[_0xee2f('0x37')],{'$or':_['map'](_0xd1aaac,function(_0x4501c4){if(_0x4501c4['type']!=='VIRTUAL'){var _0x5027a6={};_0x5027a6[_0x4501c4['name']]={'$like':'%'+_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x39')]+'%'};return _0x5027a6;}})});}_0xd16e35=_[_0xee2f('0x3a')]({},_0xd16e35,_0x47d5a6[_0xee2f('0x3b')]);var _0x4823a7={'where':_0xd16e35['where']};return db[_0xee2f('0x27')]['count'](_0x4823a7)['then'](function(_0x8204dc){_0x4ee0e1[_0xee2f('0x17')]=_0x8204dc;if(_0x47d5a6[_0xee2f('0x2c')]['includeAll']){_0xd16e35[_0xee2f('0x3c')]=[{'all':!![]}];}return db[_0xee2f('0x27')][_0xee2f('0x3d')](_0xd16e35);})['then'](function(_0x5896f6){_0x4ee0e1[_0xee2f('0x3e')]=_0x5896f6;return _0x4ee0e1;})[_0xee2f('0x1d')](respondWithFilteredResult(_0x310c0b,_0xd16e35))[_0xee2f('0x3f')](handleError(_0x310c0b,null));};exports[_0xee2f('0x40')]=function(_0x541fa0,_0x20697e){var _0x1df63d={'raw':!![],'where':{'id':_0x541fa0[_0xee2f('0x41')]['id']}},_0x242e91={};_0x242e91[_0xee2f('0x2f')]=_[_0xee2f('0x2b')](db[_0xee2f('0x27')][_0xee2f('0x28')]);_0x242e91[_0xee2f('0x2c')]=_[_0xee2f('0x2b')](_0x541fa0['query']);_0x242e91['filters']=_['intersection'](_0x242e91['model'],_0x242e91[_0xee2f('0x2c')]);_0x1df63d[_0xee2f('0x30')]=_[_0xee2f('0x2e')](_0x242e91[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x541fa0['query'][_0xee2f('0x31')]));_0x1df63d[_0xee2f('0x30')]=_0x1df63d[_0xee2f('0x30')][_0xee2f('0x32')]?_0x1df63d['attributes']:_0x242e91['model'];if(_0x541fa0['query'][_0xee2f('0x42')]){_0x1df63d['include']=[{'all':!![]}];}_0x1df63d=_['merge']({},_0x1df63d,_0x541fa0['options']);return db['AnalyticDefaultReport'][_0xee2f('0x43')](_0x1df63d)[_0xee2f('0x1d')](handleEntityNotFound(_0x20697e,null))[_0xee2f('0x1d')](respondWithResult(_0x20697e,null))['catch'](handleError(_0x20697e,null));};exports[_0xee2f('0x44')]=function(_0x57f65d,_0x3d95b8){return db[_0xee2f('0x27')][_0xee2f('0x44')](_0x57f65d[_0xee2f('0x45')],{})[_0xee2f('0x1d')](function(_0x4978eb){var _0x533ad0=_0x57f65d[_0xee2f('0x46')]['get']({'plain':!![]});if(!_0x533ad0)throw new Error(_0xee2f('0x47'));if(_0x533ad0[_0xee2f('0x48')]===_0xee2f('0x46')){var _0x88e683=_0x4978eb['get']({'plain':!![]});var _0x5df503=_0xee2f('0x49');return db[_0xee2f('0x4a')][_0xee2f('0x43')]({'where':{'name':_0x5df503,'userProfileId':_0x533ad0[_0xee2f('0x4b')]},'raw':!![]})[_0xee2f('0x1d')](function(_0x2a450f){if(_0x2a450f&&_0x2a450f[_0xee2f('0x4c')]===0x0){return db[_0xee2f('0x21')][_0xee2f('0x44')]({'name':_0x88e683[_0xee2f('0x24')],'resourceId':_0x88e683['id'],'type':_0xee2f('0x20'),'sectionId':_0x2a450f['id']},{})[_0xee2f('0x1d')](function(){return _0x4978eb;});}else{return _0x4978eb;}})['catch'](function(_0x34cb51){logger[_0xee2f('0x23')](_0xee2f('0x4d'),_0x34cb51);throw _0x34cb51;});}return _0x4978eb;})[_0xee2f('0x1d')](respondWithResult(_0x3d95b8,0xc9))['catch'](handleError(_0x3d95b8,null));};exports[_0xee2f('0x4e')]=function(_0xb3bf3f,_0x3a476f){if(_0xb3bf3f[_0xee2f('0x45')]['id']){delete _0xb3bf3f[_0xee2f('0x45')]['id'];}return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0xb3bf3f['params']['id']}})['then'](handleEntityNotFound(_0x3a476f,null))[_0xee2f('0x1d')](saveUpdates(_0xb3bf3f[_0xee2f('0x45')],null))[_0xee2f('0x1d')](respondWithResult(_0x3a476f,null))[_0xee2f('0x3f')](handleError(_0x3a476f,null));};exports[_0xee2f('0x1e')]=function(_0x101e09,_0x20aaca){return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0x101e09[_0xee2f('0x41')]['id']}})[_0xee2f('0x1d')](handleEntityNotFound(_0x20aaca,null))[_0xee2f('0x1d')](removeEntity(_0x20aaca,null))[_0xee2f('0x3f')](handleError(_0x20aaca,null));};exports[_0xee2f('0x4f')]=function(_0xcba6fc,_0x2b9636){var _0x1373a1=0xa;var _0x5d6c40=[_0xee2f('0x50'),'left_join',_0xee2f('0x51'),_0xee2f('0x52')];var _0x1dbbf2={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':_0xee2f('0x56'),'AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4fb159={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x1421da=function(_0xd967e9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),_0xee2f('0x5d'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xd967e9);};var _0x1708c5=function(_0x58e464){if(!_0x58e464||!_0x58e464[_0xee2f('0x5e')]['length']){return'';}for(var _0x7167f9='(',_0x59af84=0x0;_0x59af84<_0x58e464[_0xee2f('0x5e')][_0xee2f('0x32')];_0x59af84+=0x1){_0x59af84>0x0&&(_0x7167f9+='\x20'+_0x58e464[_0xee2f('0x5f')]+'\x20');_0x7167f9+=_0x58e464['rules'][_0x59af84][_0xee2f('0x60')]?_0x1708c5(_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x60')]):_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x61')]+'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x62')]+(_0x1421da(_0x58e464['rules'][_0x59af84][_0xee2f('0x62')])?'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x63')]:'');}return _0x7167f9+')';};var _0x353bd9={'where':{'id':_0xcba6fc[_0xee2f('0x41')]['id']}},_0x5280c7,_0x3c9d47,_0x8ccc9d,_0x15c7ff,_0x191af8;_0x353bd9=_[_0xee2f('0x3a')]({},_0x353bd9,_0xcba6fc['options']);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x353bd9)['then'](function(_0x9252e3){if(_0x9252e3){_0x5280c7=_0x9252e3;return _0x9252e3['getFields']();}return null;})[_0xee2f('0x1d')](function(_0x4ed7c9){if(_0x4ed7c9){if(!_0x4ed7c9['length']){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x3c9d47=_0x4ed7c9;return db[_0xee2f('0x67')][_0xee2f('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x238e7d){if(_0x238e7d){_0x8ccc9d=_[_0xee2f('0x68')](_0x238e7d,'id');var _0x42fae8;var _0x5d4fe8=squel[_0xee2f('0x69')]();_0x5d4fe8[_0xee2f('0x6a')](_0x5280c7['table']);for(var _0x1f1c55=0x0;_0x1f1c55<_0x3c9d47[_0xee2f('0x32')];_0x1f1c55+=0x1){_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]?_0x8ccc9d[_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x3c9d47[_0x1f1c55][_0xee2f('0x61')];_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x1dbbf2[_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]],'%s',_0x42fae8):_0x42fae8;_0x42fae8=_0x3c9d47[_0x1f1c55]['format']?_['replace'](_0x4fb159[_0x3c9d47[_0x1f1c55]['format']],'%s',_0x42fae8):_0x42fae8;if(_0x3c9d47[_0x1f1c55][_0xee2f('0x6f')]){_0x5d4fe8[_0xee2f('0x60')](_0x42fae8);}_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]&&_0x5d4fe8[_0xee2f('0x35')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x5d4fe8[_0xee2f('0x61')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x71')]||_0x42fae8);}if(_0x5280c7['joins']){_0x5280c7[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x72')]);for(var _0x5a7b6c=0x0;_0x5a7b6c<_0x5280c7[_0xee2f('0x72')]['length'];_0x5a7b6c+=0x1){if(_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]&&_['includes'](_0x5d6c40,_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')])&&_0x5280c7['joins'][_0x5a7b6c]['parentKey']&&_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')]&&_0x5280c7['joins'][_0x5a7b6c]['foreignKey']){_0x5d4fe8[_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]](_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')],null,util['format'](_0xee2f('0x76'),_0x5280c7[_0xee2f('0x77')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x78')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x75')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c]['foreignKey']));}}}if(_0x5280c7[_0xee2f('0x79')]){_0x5280c7[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x79')]);_0x5d4fe8[_0xee2f('0x37')](_0x1708c5(_0x5280c7['conditions'][_0xee2f('0x60')]));}_0x191af8=_0x5d4fe8[_0xee2f('0x7a')]();_0x5d4fe8[_0xee2f('0x15')](_0x1373a1);_0x5d4fe8[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x5d4fe8['toString']());return dbH['sequelize'][_0xee2f('0x2c')](_0x5d4fe8[_0xee2f('0x7d')](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](respondWithResult(_0x2b9636,null))[_0xee2f('0x3f')](handleError(_0x2b9636,null));};function runReport(_0x58c49e,_0x5b7b55,_0x2ad26d){var _0x27eabc=_0x5b7b55[_0xee2f('0x24')];var _0xc92046=0xa;var _0x38ee46=[_0xee2f('0x50'),_0xee2f('0x81'),_0xee2f('0x51'),_0xee2f('0x52')];var _0x21ac2d={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xee2f('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2ea31f={'SEC_TO_TIME':_0xee2f('0x82'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x18e191=function(_0x4fad8f){return!_['includes']([_0xee2f('0x5c'),_0xee2f('0x5d'),_0xee2f('0x84'),'IS\x20NOT\x20EMPTY'],_0x4fad8f);};var _0xd7c8f8=function(_0x4b0611){if(!_0x4b0611||!_0x4b0611[_0xee2f('0x5e')]['length']){return'';}for(var _0x378fc9='(',_0x25a3b9=0x0;_0x25a3b9<_0x4b0611[_0xee2f('0x5e')]['length'];_0x25a3b9+=0x1){_0x25a3b9>0x0&&(_0x378fc9+='\x20'+_0x4b0611['operator']+'\x20');_0x378fc9+=_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x60')]?_0xd7c8f8(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9]['group']):_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x61')]+'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')]+(_0x18e191(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')])?'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x63')]:'');}return _0x378fc9+')';};var _0x449656={'where':{'id':_0x58c49e['id']}},_0x1db0b5,_0x9f06f9,_0x659080,_0x28bde7,_0x214f94;_0x449656=_['merge']({},_0x449656,_0x2ad26d);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x449656)[_0xee2f('0x1d')](function(_0x2f5ed7){if(_0x2f5ed7){_0x1db0b5=_0x2f5ed7;return _0x2f5ed7[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x34cd09){if(_0x34cd09){if(!_0x34cd09[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x9f06f9=_0x34cd09;return db['AnalyticMetric'][_0xee2f('0x3d')]({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x1422e9){if(_0x1422e9){_0x659080=_[_0xee2f('0x68')](_0x1422e9,'id');var _0x53d769;var _0x15ca4e=squel[_0xee2f('0x69')]();_0x15ca4e[_0xee2f('0x6a')](_0x1db0b5['table']);for(var _0x4f02aa=0x0;_0x4f02aa<_0x9f06f9[_0xee2f('0x32')];_0x4f02aa+=0x1){_0x53d769=_0x9f06f9[_0x4f02aa]['MetricId']?_0x659080[_0x9f06f9[_0x4f02aa]['MetricId']]['metric']:_0x9f06f9[_0x4f02aa][_0xee2f('0x61')];_0x53d769=_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x21ac2d[_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]],'%s',_0x53d769):_0x53d769;_0x53d769=_0x9f06f9[_0x4f02aa]['format']?_[_0xee2f('0x6e')](_0x2ea31f[_0x9f06f9[_0x4f02aa][_0xee2f('0x86')]],'%s',_0x53d769):_0x53d769;if(_0x9f06f9[_0x4f02aa][_0xee2f('0x6f')]){_0x15ca4e['group'](_0x53d769);}_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]&&_0x15ca4e['order'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x15ca4e['field'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x71')]||_0x53d769);}if(_0x1db0b5['joins']){_0x1db0b5[_0xee2f('0x72')]=JSON['parse'](_0x1db0b5['joins']);for(var _0x149d7f=0x0;_0x149d7f<_0x1db0b5[_0xee2f('0x72')]['length'];_0x149d7f+=0x1){if(_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x74')]&&_['includes'](_0x38ee46,_0x1db0b5['joins'][_0x149d7f][_0xee2f('0x74')])&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['parentKey']&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')]&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]){_0x15ca4e[_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['type']](_0x1db0b5['joins'][_0x149d7f]['foreignTable'],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x1db0b5[_0xee2f('0x77')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x78')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]));}}}if(_0x1db0b5[_0xee2f('0x79')]){_0x1db0b5[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x1db0b5[_0xee2f('0x79')]);_0x15ca4e[_0xee2f('0x37')](_0xd7c8f8(_0x1db0b5[_0xee2f('0x79')][_0xee2f('0x60')]));}_0x214f94=_0x15ca4e['clone']();_0x15ca4e['limit'](_0xc92046);_0x15ca4e[_0xee2f('0x14')](0x0);return;}})[_0xee2f('0x1d')](function(){if(_0x5b7b55['output']===_0xee2f('0x88')){return null;}var _0x444c39=_[_0xee2f('0x3a')](_0x5b7b55,{'name':_0x5b7b55['fullPath']||_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],'basename':_0x27eabc,'savename':util[_0xee2f('0x86')](_0xee2f('0x89'),_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],require(_0xee2f('0x8a'))[_0xee2f('0x8b')](0x4),_0x5b7b55[_0xee2f('0x8c')]||'csv'),'reportId':_0x1db0b5['id'],'reportType':_0xee2f('0x8d')});return db[_0xee2f('0x8e')][_0xee2f('0x44')](_0x444c39,{'raw':!![]});})[_0xee2f('0x1d')](function(_0xe7e196){if(_0x1db0b5[_0xee2f('0x77')]===_0xee2f('0x8f')){_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+_0xee2f('0x90'),_0x5b7b55[_0xee2f('0x91')],_0x5b7b55['endDate']);}else{_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b7b55[_0xee2f('0x91')],_0x5b7b55[_0xee2f('0x92')]);}if(_0xe7e196){logger[_0xee2f('0x93')](_0xee2f('0x94'),_0x214f94[_0xee2f('0x7d')]());require(_0xee2f('0x95'))['fork'](path[_0xee2f('0x50')](__dirname,_0xee2f('0x96'),_0xe7e196['output']),[_0xe7e196['id'],_0x214f94[_0xee2f('0x7d')](),path[_0xee2f('0x50')](__dirname,'../../files/reports',_0xe7e196[_0xee2f('0x97')]),_0x27eabc]);return _0xe7e196;}else{var _0x26dd6c=squel[_0xee2f('0x69')]();_0x26dd6c[_0xee2f('0x6a')]('('+_0x214f94[_0xee2f('0x7d')]()+')',_0xee2f('0x98'));_0x26dd6c[_0xee2f('0x61')](_0xee2f('0x99'),_0xee2f('0x17'));_0x214f94[_0xee2f('0x15')](_0x5b7b55[_0xee2f('0x15')]||_0xc92046);_0x214f94[_0xee2f('0x14')](_0x5b7b55['offset']||0x0);return dbH[_0xee2f('0x7e')]['query'](_0x26dd6c['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')]['SELECT']})[_0xee2f('0x1d')](function(_0x472f83){if(!_0x472f83[_0xee2f('0x32')]){_0x28bde7=0x0;}else{_0x28bde7=_0x472f83[0x0]['count']||0x0;}return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x214f94['toString'](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});})[_0xee2f('0x1d')](function(_0x121a34){return{'rows':_0x121a34||[],'count':_0x28bde7};});}});}exports[_0xee2f('0x9a')]=function(_0x3d8c56,_0x5c8550){return runReport(_0x3d8c56[_0xee2f('0x41')],_0x3d8c56[_0xee2f('0x2c')],_0x3d8c56['options'])[_0xee2f('0x1d')](respondWithResult(_0x5c8550,null))[_0xee2f('0x3f')](handleError(_0x5c8550,null));};exports[_0xee2f('0x9b')]=runReport;exports['query']=function(_0x40fa57,_0x1fafcc){var _0x1163f1=0xa;var _0x162014=[_0xee2f('0x50'),_0xee2f('0x81'),'right_join',_0xee2f('0x52')];var _0xb93091={'SUM':_0xee2f('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':'MIN(%s)','AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xee2f('0x9c')};var _0x39922f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1c9f70=function(_0xa93dc9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),'IS\x20NOT\x20NULL',_0xee2f('0x84'),_0xee2f('0x9d')],_0xa93dc9);};var _0x44b06b=function(_0x541ac7){if(!_0x541ac7||!_0x541ac7[_0xee2f('0x5e')][_0xee2f('0x32')]){return'';}for(var _0xa89897='(',_0x2def5c=0x0;_0x2def5c<_0x541ac7['rules']['length'];_0x2def5c+=0x1){_0x2def5c>0x0&&(_0xa89897+='\x20'+_0x541ac7[_0xee2f('0x5f')]+'\x20');_0xa89897+=_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x60')]?_0x44b06b(_0x541ac7['rules'][_0x2def5c][_0xee2f('0x60')]):_0x541ac7[_0xee2f('0x5e')][_0x2def5c]['field']+'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')]+(_0x1c9f70(_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')])?'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x63')]:'');}return _0xa89897+')';};var _0x3f9188={'where':{'id':_0x40fa57['params']['id']}},_0x236b63,_0x4ad336,_0x3370de,_0x3c8c20,_0xc9228;_0x3f9188=_[_0xee2f('0x3a')]({},_0x3f9188,_0x40fa57[_0xee2f('0x3b')]);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x3f9188)[_0xee2f('0x1d')](function(_0xa0dfdd){if(_0xa0dfdd){_0x236b63=_0xa0dfdd;return _0xa0dfdd[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x298dfa){if(_0x298dfa){if(!_0x298dfa[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4ad336=_0x298dfa;return db[_0xee2f('0x67')]['findAll']({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x35a1c9){if(_0x35a1c9){_0x3370de=_['keyBy'](_0x35a1c9,'id');var _0x464e9e;var _0x738f35=squel[_0xee2f('0x69')]();_0x738f35[_0xee2f('0x6a')](_0x236b63[_0xee2f('0x77')]);for(var _0xe24a8a=0x0;_0xe24a8a<_0x4ad336['length'];_0xe24a8a+=0x1){_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]?_0x3370de[_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x4ad336[_0xe24a8a][_0xee2f('0x61')];_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0xb93091[_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]],'%s',_0x464e9e):_0x464e9e;_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x86')]?_[_0xee2f('0x6e')](_0x39922f[_0x4ad336[_0xe24a8a][_0xee2f('0x86')]],'%s',_0x464e9e):_0x464e9e;if(_0x4ad336[_0xe24a8a]['groupBy']){_0x738f35[_0xee2f('0x60')](_0x464e9e);}_0x4ad336[_0xe24a8a][_0xee2f('0x70')]&&_0x738f35[_0xee2f('0x35')](_0x464e9e,_0x4ad336[_0xe24a8a]['orderBy']==='DESC'?![]:!![]);_0x738f35[_0xee2f('0x61')](_0x464e9e,_0x4ad336[_0xe24a8a][_0xee2f('0x71')]||_0x464e9e);}if(_0x236b63[_0xee2f('0x72')]){_0x236b63[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x236b63['joins']);for(var _0x1cee16=0x0;_0x1cee16<_0x236b63[_0xee2f('0x72')]['length'];_0x1cee16+=0x1){if(_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]&&_[_0xee2f('0x5b')](_0x162014,_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')])&&_0x236b63[_0xee2f('0x72')][_0x1cee16]['parentKey']&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')]&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]){_0x738f35[_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]](_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x236b63[_0xee2f('0x77')],_0x236b63['joins'][_0x1cee16][_0xee2f('0x78')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]));}}}if(_0x236b63[_0xee2f('0x79')]){_0x236b63['conditions']=JSON[_0xee2f('0x73')](_0x236b63[_0xee2f('0x79')]);_0x738f35[_0xee2f('0x37')](_0x44b06b(_0x236b63[_0xee2f('0x79')]['group']));}_0xc9228=_0x738f35[_0xee2f('0x7a')]();_0x738f35[_0xee2f('0x15')](_0x1163f1);_0x738f35[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x738f35[_0xee2f('0x7d')]());return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x738f35['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](function(){return{'sql':_0xc9228['toString']()};})[_0xee2f('0x1d')](respondWithResult(_0x1fafcc,null))['catch'](handleError(_0x1fafcc,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index b194d70..14f98dd 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 _0x919d=['rimraf','../../config/environment','./analyticDefaultReport.attributes','define','analytics_default_reports','../../config/logger','moment','path'];(function(_0x4ffee4,_0x1db54d){var _0x5e9fe4=function(_0x5d3216){while(--_0x5d3216){_0x4ffee4['push'](_0x4ffee4['shift']());}};_0x5e9fe4(++_0x1db54d);}(_0x919d,0x1d5));var _0xd919=function(_0x3d6a4c,_0x1ec6db){_0x3d6a4c=_0x3d6a4c-0x0;var _0x57243d=_0x919d[_0x3d6a4c];return _0x57243d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd919('0x0'))('api');var moment=require(_0xd919('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd919('0x2'));var rimraf=require(_0xd919('0x3'));var config=require(_0xd919('0x4'));var attributes=require(_0xd919('0x5'));module['exports']=function(_0x27b235,_0x41ce3f){return _0x27b235[_0xd919('0x6')]('AnalyticDefaultReport',attributes,{'tableName':_0xd919('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28d8=['rimraf','../../config/environment','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x45ca7e,_0x21ed81){var _0x136e56=function(_0x178a92){while(--_0x178a92){_0x45ca7e['push'](_0x45ca7e['shift']());}};_0x136e56(++_0x21ed81);}(_0x28d8,0xae));var _0x828d=function(_0x21fd99,_0x23cc5e){_0x21fd99=_0x21fd99-0x0;var _0xbdcea6=_0x28d8[_0x21fd99];return _0xbdcea6;};'use strict';var _=require(_0x828d('0x0'));var util=require(_0x828d('0x1'));var logger=require(_0x828d('0x2'))(_0x828d('0x3'));var moment=require(_0x828d('0x4'));var BPromise=require(_0x828d('0x5'));var rp=require(_0x828d('0x6'));var fs=require('fs');var path=require(_0x828d('0x7'));var rimraf=require(_0x828d('0x8'));var config=require(_0x828d('0x9'));var attributes=require('./analyticDefaultReport.attributes');module[_0x828d('0xa')]=function(_0x17f9e3,_0x15f587){return _0x17f9e3[_0x828d('0xb')](_0x828d('0xc'),attributes,{'tableName':_0x828d('0xd'),'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 8a1e9f1..56569d3 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 _0xecbc=['error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xecbc,0x1e7));var _0xcecb=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xecbc[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0xcecb('0x0'));var util=require(_0xcecb('0x1'));var moment=require(_0xcecb('0x2'));var BPromise=require(_0xcecb('0x3'));var rs=require(_0xcecb('0x4'));var fs=require('fs');var Redis=require(_0xcecb('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcecb('0x6'));var logger=require('../../config/logger')(_0xcecb('0x7'));var config=require(_0xcecb('0x8'));var jayson=require(_0xcecb('0x9'));var client=jayson[_0xcecb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11e3ea,_0x549108,_0x5b2556){return new BPromise(function(_0x4cffca,_0x3fbc7f){return client[_0xcecb('0xb')](_0x11e3ea,_0x5b2556)[_0xcecb('0xc')](function(_0x33d698){logger[_0xcecb('0xd')](_0xcecb('0xe'),_0x549108,'request\x20sent');logger[_0xcecb('0xf')](_0xcecb('0x10'),_0x549108,_0xcecb('0x11'),JSON[_0xcecb('0x12')](_0x33d698));if(_0x33d698['error']){if(_0x33d698[_0xcecb('0x13')][_0xcecb('0x14')]===0x1f4){logger[_0xcecb('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x549108,_0x33d698[_0xcecb('0x13')][_0xcecb('0x15')]);return _0x3fbc7f(_0x33d698[_0xcecb('0x13')][_0xcecb('0x15')]);}logger[_0xcecb('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x549108,_0x33d698[_0xcecb('0x13')][_0xcecb('0x15')]);return _0x4cffca(_0x33d698[_0xcecb('0x13')]['message']);}else{logger[_0xcecb('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x549108,_0xcecb('0x11'));_0x4cffca(_0x33d698['result'][_0xcecb('0x15')]);}})['catch'](function(_0xc46015){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x549108,_0xc46015);_0x3fbc7f(_0xc46015);});});} \ No newline at end of file +var _0x3fcc=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x12be6d,_0x340a27){var _0x52981f=function(_0x39578f){while(--_0x39578f){_0x12be6d['push'](_0x12be6d['shift']());}};_0x52981f(++_0x340a27);}(_0x3fcc,0xd0));var _0xc3fc=function(_0xcd14f0,_0x560055){_0xcd14f0=_0xcd14f0-0x0;var _0x15e062=_0x3fcc[_0xcd14f0];return _0x15e062;};'use strict';var _=require(_0xc3fc('0x0'));var util=require(_0xc3fc('0x1'));var moment=require('moment');var BPromise=require(_0xc3fc('0x2'));var rs=require(_0xc3fc('0x3'));var fs=require('fs');var Redis=require(_0xc3fc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc3fc('0x5'));var logger=require(_0xc3fc('0x6'))(_0xc3fc('0x7'));var config=require('../../config/environment');var jayson=require(_0xc3fc('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ba422,_0x174861,_0x2e8466){return new BPromise(function(_0x3fd3ac,_0x26b6f1){return client[_0xc3fc('0x9')](_0x5ba422,_0x2e8466)['then'](function(_0x568ed4){logger[_0xc3fc('0xa')](_0xc3fc('0xb'),_0x174861,_0xc3fc('0xc'));logger['debug'](_0xc3fc('0xd'),_0x174861,_0xc3fc('0xc'),JSON['stringify'](_0x568ed4));if(_0x568ed4['error']){if(_0x568ed4[_0xc3fc('0xe')][_0xc3fc('0xf')]===0x1f4){logger[_0xc3fc('0xe')](_0xc3fc('0xb'),_0x174861,_0x568ed4['error'][_0xc3fc('0x10')]);return _0x26b6f1(_0x568ed4[_0xc3fc('0xe')][_0xc3fc('0x10')]);}logger[_0xc3fc('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x174861,_0x568ed4[_0xc3fc('0xe')][_0xc3fc('0x10')]);return _0x3fd3ac(_0x568ed4['error'][_0xc3fc('0x10')]);}else{logger[_0xc3fc('0xa')](_0xc3fc('0xb'),_0x174861,_0xc3fc('0xc'));_0x3fd3ac(_0x568ed4[_0xc3fc('0x11')][_0xc3fc('0x10')]);}})[_0xc3fc('0x12')](function(_0x1ff150){logger[_0xc3fc('0xe')](_0xc3fc('0xb'),_0x174861,_0x1ff150);_0x26b6f1(_0x1ff150);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 2cef69b..4e9be92 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 _0x3a9f=['post','create','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','run','query'];(function(_0x572420,_0x5c9276){var _0x308ed2=function(_0x2351eb){while(--_0x2351eb){_0x572420['push'](_0x572420['shift']());}};_0x308ed2(++_0x5c9276);}(_0x3a9f,0x1e8));var _0xf3a9=function(_0x46b22a,_0x5bf83a){_0x46b22a=_0x46b22a-0x0;var _0x44c2e8=_0x3a9f[_0x46b22a];return _0x44c2e8;};'use strict';var multer=require(_0xf3a9('0x0'));var util=require(_0xf3a9('0x1'));var path=require('path');var timeout=require(_0xf3a9('0x2'));var express=require(_0xf3a9('0x3'));var router=express['Router']();var fs_extra=require(_0xf3a9('0x4'));var auth=require(_0xf3a9('0x5'));var interaction=require(_0xf3a9('0x6'));var config=require(_0xf3a9('0x7'));var controller=require(_0xf3a9('0x8'));router[_0xf3a9('0x9')]('/',auth[_0xf3a9('0xa')](),controller['index']);router['get'](_0xf3a9('0xb'),auth[_0xf3a9('0xa')](),controller[_0xf3a9('0xc')]);router[_0xf3a9('0x9')](_0xf3a9('0xd'),auth[_0xf3a9('0xa')](),controller[_0xf3a9('0xe')]);router['get'](_0xf3a9('0xf'),auth[_0xf3a9('0xa')](),controller[_0xf3a9('0x10')]);router[_0xf3a9('0x9')]('/:id/query',auth[_0xf3a9('0xa')](),controller[_0xf3a9('0x11')]);router[_0xf3a9('0x12')]('/',auth[_0xf3a9('0xa')](),controller[_0xf3a9('0x13')]);router['put'](_0xf3a9('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xf3a9('0x14')]('/:id',auth[_0xf3a9('0xa')](),controller[_0xf3a9('0x15')]);module[_0xf3a9('0x16')]=router; \ No newline at end of file +var _0xea68=['get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','query','post','create','put','destroy','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller'];(function(_0x592af7,_0x2a1ba7){var _0x4738f1=function(_0x23596d){while(--_0x23596d){_0x592af7['push'](_0x592af7['shift']());}};_0x4738f1(++_0x2a1ba7);}(_0xea68,0x77));var _0x8ea6=function(_0x13b313,_0x1f1a19){_0x13b313=_0x13b313-0x0;var _0x100c85=_0xea68[_0x13b313];return _0x100c85;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8ea6('0x0'));var router=express[_0x8ea6('0x1')]();var fs_extra=require(_0x8ea6('0x2'));var auth=require(_0x8ea6('0x3'));var interaction=require(_0x8ea6('0x4'));var config=require(_0x8ea6('0x5'));var controller=require(_0x8ea6('0x6'));router[_0x8ea6('0x7')]('/',auth[_0x8ea6('0x8')](),controller[_0x8ea6('0x9')]);router['get'](_0x8ea6('0xa'),auth[_0x8ea6('0x8')](),controller[_0x8ea6('0xb')]);router[_0x8ea6('0x7')](_0x8ea6('0xc'),auth[_0x8ea6('0x8')](),controller[_0x8ea6('0xd')]);router['get'](_0x8ea6('0xe'),auth[_0x8ea6('0x8')](),controller[_0x8ea6('0xf')]);router[_0x8ea6('0x7')]('/:id/query',auth[_0x8ea6('0x8')](),controller[_0x8ea6('0x10')]);router[_0x8ea6('0x11')]('/',auth[_0x8ea6('0x8')](),controller[_0x8ea6('0x12')]);router[_0x8ea6('0x13')](_0x8ea6('0xa'),auth[_0x8ea6('0x8')](),controller['update']);router['delete'](_0x8ea6('0xa'),auth[_0x8ea6('0x8')](),controller[_0x8ea6('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index c4f0faf..967f885 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 _0x1bed=['Loading','ENUM','manual','scheduled','sequelize','moment','exports','STRING','csv','pdf','DATE'];(function(_0x2ddeca,_0x21c2a2){var _0x4b5c5f=function(_0x45d372){while(--_0x45d372){_0x2ddeca['push'](_0x2ddeca['shift']());}};_0x4b5c5f(++_0x21c2a2);}(_0x1bed,0x1b1));var _0xd1be=function(_0xc4e277,_0xedbd0e){_0xc4e277=_0xc4e277-0x0;var _0xe667d2=_0x1bed[_0xc4e277];return _0xe667d2;};'use strict';var Sequelize=require(_0xd1be('0x0'));var moment=require(_0xd1be('0x1'));module[_0xd1be('0x2')]={'name':{'type':Sequelize[_0xd1be('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xd1be('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xd1be('0x4'),_0xd1be('0x5'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xd1be('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xd1be('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xd1be('0x3')],'defaultValue':_0xd1be('0x7')},'type':{'type':Sequelize[_0xd1be('0x8')](_0xd1be('0x9'),_0xd1be('0xa')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xd1be('0x3')]}}; \ No newline at end of file +var _0x723c=['xlsx','STRING','DATE','Loading','ENUM','manual','scheduled','UNSIGNED','sequelize','moment','pdf'];(function(_0xced432,_0x3e8a0d){var _0x74b51c=function(_0x16105f){while(--_0x16105f){_0xced432['push'](_0xced432['shift']());}};_0x74b51c(++_0x3e8a0d);}(_0x723c,0x168));var _0xc723=function(_0x2fe7e4,_0x22ce17){_0x2fe7e4=_0x2fe7e4-0x0;var _0x5ba7c9=_0x723c[_0x2fe7e4];return _0x5ba7c9;};'use strict';var Sequelize=require(_0xc723('0x0'));var moment=require(_0xc723('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv',_0xc723('0x2'),_0xc723('0x3')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xc723('0x4')],'allowNull':![]},'startDate':{'type':Sequelize[_0xc723('0x5')]},'endDate':{'type':Sequelize[_0xc723('0x5')]},'status':{'type':Sequelize[_0xc723('0x4')],'defaultValue':_0xc723('0x6')},'type':{'type':Sequelize[_0xc723('0x7')](_0xc723('0x8'),_0xc723('0x9')),'allowNull':![],'defaultValue':_0xc723('0x8')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xc723('0xa')]},'reportType':{'type':Sequelize[_0xc723('0x4')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 2075c5e..998e033 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 _0x9475=['then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','AnalyticExtractedReport','includeAll','findAll','rows','catch','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','output','existsSync','join','root','savename','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','server/files/reports','format','%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9475,0xa2));var _0x5947=function(_0x190c87,_0x18b7cf){_0x190c87=_0x190c87-0x0;var _0x4c847a=_0x9475[_0x190c87];return _0x4c847a;};'use strict';var emlformat=require(_0x5947('0x0'));var rimraf=require(_0x5947('0x1'));var zipdir=require(_0x5947('0x2'));var jsonpatch=require(_0x5947('0x3'));var rp=require(_0x5947('0x4'));var moment=require(_0x5947('0x5'));var BPromise=require(_0x5947('0x6'));var Mustache=require(_0x5947('0x7'));var util=require(_0x5947('0x8'));var path=require(_0x5947('0x9'));var sox=require(_0x5947('0xa'));var csv=require(_0x5947('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5947('0xc'));var _=require(_0x5947('0xd'));var squel=require(_0x5947('0xe'));var crypto=require(_0x5947('0xf'));var jsforce=require(_0x5947('0x10'));var deskjs=require(_0x5947('0x11'));var toCsv=require(_0x5947('0xb'));var querystring=require('querystring');var Papa=require(_0x5947('0x12'));var Redis=require(_0x5947('0x13'));var authService=require(_0x5947('0x14'));var qs=require(_0x5947('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5947('0x16'));var logger=require(_0x5947('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5947('0x18'));var db=require(_0x5947('0x19'))['db'];function respondWithStatusCode(_0x28588b,_0x5ace6f){_0x5ace6f=_0x5ace6f||0xcc;return function(_0x2351b8){if(_0x2351b8){return _0x28588b[_0x5947('0x1a')](_0x5ace6f);}return _0x28588b[_0x5947('0x1b')](_0x5ace6f)[_0x5947('0x1c')]();};}function respondWithResult(_0x5a94c6,_0x5d8b93){_0x5d8b93=_0x5d8b93||0xc8;return function(_0x38e9bb){if(_0x38e9bb){return _0x5a94c6[_0x5947('0x1b')](_0x5d8b93)[_0x5947('0x1d')](_0x38e9bb);}};}function respondWithFilteredResult(_0x55678e,_0x17b51d){return function(_0x71e3eb){if(_0x71e3eb){var _0x4f9bab=typeof _0x17b51d['offset']===_0x5947('0x1e')&&typeof _0x17b51d[_0x5947('0x1f')]==='undefined';var _0x3f48a8=_0x71e3eb[_0x5947('0x20')];var _0x5b1b6a=_0x4f9bab?0x0:_0x17b51d['offset'];var _0x566ffb=_0x4f9bab?_0x71e3eb[_0x5947('0x20')]:_0x17b51d[_0x5947('0x21')]+_0x17b51d[_0x5947('0x1f')];var _0x396459;if(_0x566ffb>=_0x3f48a8){_0x566ffb=_0x3f48a8;_0x396459=0xc8;}else{_0x396459=0xce;}_0x55678e[_0x5947('0x1b')](_0x396459);return _0x55678e['set'](_0x5947('0x22'),_0x5b1b6a+'-'+_0x566ffb+'/'+_0x3f48a8)['json'](_0x71e3eb);}return null;};}function patchUpdates(_0x2efe27){return function(_0x38d04f){try{jsonpatch['apply'](_0x38d04f,_0x2efe27,!![]);}catch(_0x49ae08){return BPromise[_0x5947('0x23')](_0x49ae08);}return _0x38d04f[_0x5947('0x24')]();};}function saveUpdates(_0x358428,_0x5460e6){return function(_0x4eb5ed){if(_0x4eb5ed){return _0x4eb5ed[_0x5947('0x25')](_0x358428)[_0x5947('0x26')](function(_0x3862bc){return _0x3862bc;});}return null;};}function removeEntity(_0x2db96f,_0x3f9ff5){return function(_0x3f1862){if(_0x3f1862){return _0x3f1862[_0x5947('0x27')]()['then'](function(){var _0x11ea38=_0x3f1862[_0x5947('0x28')]({'plain':!![]});var _0x5398b6=_0x5947('0x29');return db[_0x5947('0x2a')]['destroy']({'where':{'type':_0x5398b6,'resourceId':_0x11ea38['id']}})[_0x5947('0x26')](function(){return _0x3f1862;});})[_0x5947('0x26')](function(){_0x2db96f[_0x5947('0x1b')](0xcc)[_0x5947('0x1c')]();});}};}function handleEntityNotFound(_0x3a2d24,_0x49cbdf){return function(_0x1dfa66){if(!_0x1dfa66){_0x3a2d24[_0x5947('0x1a')](0x194);}return _0x1dfa66;};}function handleError(_0x29dd85,_0x13bdb4){_0x13bdb4=_0x13bdb4||0x1f4;return function(_0x516561){logger[_0x5947('0x2b')](_0x516561[_0x5947('0x2c')]);if(_0x516561['name']){delete _0x516561[_0x5947('0x2d')];}_0x29dd85[_0x5947('0x1b')](_0x13bdb4)[_0x5947('0x2e')](_0x516561);};}exports[_0x5947('0x2f')]=function(_0x4babf0,_0x3e9876){var _0x55c199={},_0x2741a9={},_0xa20aad={'count':0x0,'rows':[]};var _0x16b1b5=_[_0x5947('0x30')](db['AnalyticExtractedReport'][_0x5947('0x31')],function(_0x105210){return{'name':_0x105210[_0x5947('0x32')],'type':_0x105210[_0x5947('0x33')][_0x5947('0x34')]};});_0x2741a9[_0x5947('0x35')]=_[_0x5947('0x30')](_0x16b1b5,_0x5947('0x2d'));_0x2741a9[_0x5947('0x36')]=_[_0x5947('0x37')](_0x4babf0['query']);_0x2741a9['filters']=_['intersection'](_0x2741a9['model'],_0x2741a9[_0x5947('0x36')]);_0x55c199[_0x5947('0x38')]=_[_0x5947('0x39')](_0x2741a9[_0x5947('0x35')],qs['fields'](_0x4babf0[_0x5947('0x36')][_0x5947('0x3a')]));_0x55c199['attributes']=_0x55c199[_0x5947('0x38')][_0x5947('0x3b')]?_0x55c199[_0x5947('0x38')]:_0x2741a9['model'];if(!_0x4babf0[_0x5947('0x36')][_0x5947('0x3c')](_0x5947('0x3d'))){_0x55c199[_0x5947('0x1f')]=qs[_0x5947('0x1f')](_0x4babf0[_0x5947('0x36')]['limit']);_0x55c199[_0x5947('0x21')]=qs[_0x5947('0x21')](_0x4babf0['query']['offset']);}_0x55c199[_0x5947('0x3e')]=qs[_0x5947('0x3f')](_0x4babf0[_0x5947('0x36')][_0x5947('0x3f')]);_0x55c199[_0x5947('0x40')]=qs[_0x5947('0x41')](_[_0x5947('0x42')](_0x4babf0['query'],_0x2741a9[_0x5947('0x41')]),_0x16b1b5);if(_0x4babf0[_0x5947('0x36')]['filter']){_0x55c199[_0x5947('0x40')]=_[_0x5947('0x43')](_0x55c199[_0x5947('0x40')],{'$or':_[_0x5947('0x30')](_0x16b1b5,function(_0x2a9560){if(_0x2a9560[_0x5947('0x33')]!==_0x5947('0x44')){var _0x1c57a5={};_0x1c57a5[_0x2a9560[_0x5947('0x2d')]]={'$like':'%'+_0x4babf0[_0x5947('0x36')][_0x5947('0x45')]+'%'};return _0x1c57a5;}})});}_0x55c199=_[_0x5947('0x43')]({},_0x55c199,_0x4babf0[_0x5947('0x46')]);var _0x890197={'where':_0x55c199[_0x5947('0x40')]};return db[_0x5947('0x47')][_0x5947('0x20')](_0x890197)[_0x5947('0x26')](function(_0x6ca44e){_0xa20aad[_0x5947('0x20')]=_0x6ca44e;if(_0x4babf0[_0x5947('0x36')][_0x5947('0x48')]){_0x55c199['include']=[{'all':!![]}];}return db[_0x5947('0x47')][_0x5947('0x49')](_0x55c199);})['then'](function(_0x544059){_0xa20aad[_0x5947('0x4a')]=_0x544059;return _0xa20aad;})[_0x5947('0x26')](respondWithFilteredResult(_0x3e9876,_0x55c199))[_0x5947('0x4b')](handleError(_0x3e9876,null));};exports['show']=function(_0x1966d5,_0xa922b8){var _0x314ad7={'raw':!![],'where':{'id':_0x1966d5[_0x5947('0x4c')]['id']}},_0x2fd480={};_0x2fd480[_0x5947('0x35')]=_[_0x5947('0x37')](db[_0x5947('0x47')][_0x5947('0x31')]);_0x2fd480['query']=_[_0x5947('0x37')](_0x1966d5['query']);_0x2fd480['filters']=_[_0x5947('0x39')](_0x2fd480[_0x5947('0x35')],_0x2fd480['query']);_0x314ad7[_0x5947('0x38')]=_[_0x5947('0x39')](_0x2fd480[_0x5947('0x35')],qs[_0x5947('0x3a')](_0x1966d5[_0x5947('0x36')][_0x5947('0x3a')]));_0x314ad7[_0x5947('0x38')]=_0x314ad7['attributes']['length']?_0x314ad7['attributes']:_0x2fd480[_0x5947('0x35')];if(_0x1966d5[_0x5947('0x36')][_0x5947('0x48')]){_0x314ad7[_0x5947('0x4d')]=[{'all':!![]}];}_0x314ad7=_[_0x5947('0x43')]({},_0x314ad7,_0x1966d5[_0x5947('0x46')]);return db['AnalyticExtractedReport'][_0x5947('0x4e')](_0x314ad7)[_0x5947('0x26')](handleEntityNotFound(_0xa922b8,null))['then'](respondWithResult(_0xa922b8,null))[_0x5947('0x4b')](handleError(_0xa922b8,null));};exports[_0x5947('0x4f')]=function(_0x1b1135,_0x42b5f9){return db['AnalyticExtractedReport'][_0x5947('0x4f')](_0x1b1135['body'],{})[_0x5947('0x26')](function(_0x52c025){var _0x30eac3=_0x1b1135[_0x5947('0x50')][_0x5947('0x28')]({'plain':!![]});if(!_0x30eac3)throw new Error(_0x5947('0x51'));if(_0x30eac3[_0x5947('0x52')]===_0x5947('0x50')){var _0x369dbd=_0x52c025['get']({'plain':!![]});var _0x488654=_0x5947('0x29');return db[_0x5947('0x53')]['find']({'where':{'name':_0x488654,'userProfileId':_0x30eac3[_0x5947('0x54')]},'raw':!![]})[_0x5947('0x26')](function(_0x478370){if(_0x478370&&_0x478370['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x369dbd[_0x5947('0x2d')],'resourceId':_0x369dbd['id'],'type':_0x478370[_0x5947('0x2d')],'sectionId':_0x478370['id']},{})[_0x5947('0x26')](function(){return _0x52c025;});}else{return _0x52c025;}})[_0x5947('0x4b')](function(_0x257630){logger['error'](_0x5947('0x55'),_0x257630);throw _0x257630;});}return _0x52c025;})[_0x5947('0x26')](respondWithResult(_0x42b5f9,0xc9))['catch'](handleError(_0x42b5f9,null));};exports['update']=function(_0x352bfb,_0x12a83a){if(_0x352bfb[_0x5947('0x56')]['id']){delete _0x352bfb[_0x5947('0x56')]['id'];}return db[_0x5947('0x47')][_0x5947('0x4e')]({'where':{'id':_0x352bfb[_0x5947('0x4c')]['id']}})[_0x5947('0x26')](handleEntityNotFound(_0x12a83a,null))[_0x5947('0x26')](saveUpdates(_0x352bfb[_0x5947('0x56')],null))[_0x5947('0x26')](respondWithResult(_0x12a83a,null))[_0x5947('0x4b')](handleError(_0x12a83a,null));};exports['destroy']=function(_0x503e2d,_0x1cad4e){return db[_0x5947('0x47')][_0x5947('0x4e')]({'where':{'id':_0x503e2d[_0x5947('0x4c')]['id']}})[_0x5947('0x26')](handleEntityNotFound(_0x1cad4e,null))[_0x5947('0x26')](removeEntity(_0x1cad4e,null))[_0x5947('0x4b')](handleError(_0x1cad4e,null));};exports[_0x5947('0x57')]=function(_0x3f4089,_0x19ca84,_0xdb0a92){return db[_0x5947('0x47')][_0x5947('0x4e')]({'where':{'id':_0x3f4089[_0x5947('0x4c')]['id']},'attributes':[_0x5947('0x2d'),_0x5947('0x58'),'savename',_0x5947('0x59')],'raw':!![]})[_0x5947('0x26')](handleEntityNotFound(_0x19ca84,null))[_0x5947('0x26')](function(_0x48c5f9){if(_0x48c5f9){if(!fs[_0x5947('0x5a')](path[_0x5947('0x5b')](config[_0x5947('0x5c')],'server/files/reports',_0x48c5f9[_0x5947('0x5d')]))){throw new db[(_0x5947('0x5e'))][(_0x5947('0x5f'))](_0x5947('0x60'));}if(_0x3f4089[_0x5947('0x36')]['exists']){return _0x19ca84[_0x5947('0x1a')](0xc8);}return _0x19ca84[_0x5947('0x57')](path['join'](config['root'],_0x5947('0x61'),_0x48c5f9[_0x5947('0x5d')]),util[_0x5947('0x62')](_0x5947('0x63'),_0x48c5f9[_0x5947('0x58')]||_0x48c5f9[_0x5947('0x2d')],_0x48c5f9[_0x5947('0x59')]['toLowerCase']()));}})[_0x5947('0x4b')](handleError(_0x19ca84,null));}; \ No newline at end of file +var _0x0d7f=['params','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','root','server/files/reports','ValidationError','format','toLowerCase','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','reject','save','destroy','then','get','ExtractedReports','UserProfileResource','error','stack','send','index','AnalyticExtractedReport','fieldName','type','model','map','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0d7f,0x115));var _0xf0d7=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x0d7f[_0x32f7d7];return _0x133d09;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf0d7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf0d7('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf0d7('0x2'));var Mustache=require(_0xf0d7('0x3'));var util=require('util');var path=require(_0xf0d7('0x4'));var sox=require(_0xf0d7('0x5'));var csv=require(_0xf0d7('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf0d7('0x7'));var crypto=require(_0xf0d7('0x8'));var jsforce=require(_0xf0d7('0x9'));var deskjs=require(_0xf0d7('0xa'));var toCsv=require(_0xf0d7('0x6'));var querystring=require(_0xf0d7('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf0d7('0xc'));var qs=require(_0xf0d7('0xd'));var as=require(_0xf0d7('0xe'));var hardwareService=require(_0xf0d7('0xf'));var logger=require(_0xf0d7('0x10'))(_0xf0d7('0x11'));var utils=require(_0xf0d7('0x12'));var config=require(_0xf0d7('0x13'));var licenseUtil=require(_0xf0d7('0x14'));var db=require(_0xf0d7('0x15'))['db'];function respondWithStatusCode(_0x5409ce,_0x5a3527){_0x5a3527=_0x5a3527||0xcc;return function(_0xea9cbd){if(_0xea9cbd){return _0x5409ce[_0xf0d7('0x16')](_0x5a3527);}return _0x5409ce[_0xf0d7('0x17')](_0x5a3527)['end']();};}function respondWithResult(_0x5d38de,_0xa54fc2){_0xa54fc2=_0xa54fc2||0xc8;return function(_0x4fe834){if(_0x4fe834){return _0x5d38de[_0xf0d7('0x17')](_0xa54fc2)[_0xf0d7('0x18')](_0x4fe834);}};}function respondWithFilteredResult(_0x354fed,_0x2940ed){return function(_0x2112a9){if(_0x2112a9){var _0x42c791=typeof _0x2940ed[_0xf0d7('0x19')]===_0xf0d7('0x1a')&&typeof _0x2940ed['limit']==='undefined';var _0x412772=_0x2112a9[_0xf0d7('0x1b')];var _0x5375e9=_0x42c791?0x0:_0x2940ed[_0xf0d7('0x19')];var _0x395132=_0x42c791?_0x2112a9[_0xf0d7('0x1b')]:_0x2940ed['offset']+_0x2940ed[_0xf0d7('0x1c')];var _0x25a11c;if(_0x395132>=_0x412772){_0x395132=_0x412772;_0x25a11c=0xc8;}else{_0x25a11c=0xce;}_0x354fed[_0xf0d7('0x17')](_0x25a11c);return _0x354fed['set']('Content-Range',_0x5375e9+'-'+_0x395132+'/'+_0x412772)[_0xf0d7('0x18')](_0x2112a9);}return null;};}function patchUpdates(_0x58e000){return function(_0xa8ca06){try{jsonpatch['apply'](_0xa8ca06,_0x58e000,!![]);}catch(_0x56cc9a){return BPromise[_0xf0d7('0x1d')](_0x56cc9a);}return _0xa8ca06[_0xf0d7('0x1e')]();};}function saveUpdates(_0x2315f0,_0x159fdd){return function(_0x5c2e8c){if(_0x5c2e8c){return _0x5c2e8c['update'](_0x2315f0)['then'](function(_0x4e16f3){return _0x4e16f3;});}return null;};}function removeEntity(_0x502130,_0x4ece9e){return function(_0x40ebaa){if(_0x40ebaa){return _0x40ebaa[_0xf0d7('0x1f')]()[_0xf0d7('0x20')](function(){var _0x4eaf7c=_0x40ebaa[_0xf0d7('0x21')]({'plain':!![]});var _0x1aad6d=_0xf0d7('0x22');return db[_0xf0d7('0x23')]['destroy']({'where':{'type':_0x1aad6d,'resourceId':_0x4eaf7c['id']}})['then'](function(){return _0x40ebaa;});})[_0xf0d7('0x20')](function(){_0x502130[_0xf0d7('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6988a,_0x15b727){return function(_0x155156){if(!_0x155156){_0x6988a['sendStatus'](0x194);}return _0x155156;};}function handleError(_0x3345c3,_0x4e0e2f){_0x4e0e2f=_0x4e0e2f||0x1f4;return function(_0x8e88c6){logger[_0xf0d7('0x24')](_0x8e88c6[_0xf0d7('0x25')]);if(_0x8e88c6['name']){delete _0x8e88c6['name'];}_0x3345c3[_0xf0d7('0x17')](_0x4e0e2f)[_0xf0d7('0x26')](_0x8e88c6);};}exports[_0xf0d7('0x27')]=function(_0x16633a,_0xa542f){var _0x1358c4={},_0x54ecbf={},_0x3fa939={'count':0x0,'rows':[]};var _0x129f42=_['map'](db[_0xf0d7('0x28')]['rawAttributes'],function(_0x41478d){return{'name':_0x41478d[_0xf0d7('0x29')],'type':_0x41478d[_0xf0d7('0x2a')]['key']};});_0x54ecbf[_0xf0d7('0x2b')]=_[_0xf0d7('0x2c')](_0x129f42,_0xf0d7('0x2d'));_0x54ecbf[_0xf0d7('0x2e')]=_[_0xf0d7('0x2f')](_0x16633a['query']);_0x54ecbf['filters']=_[_0xf0d7('0x30')](_0x54ecbf['model'],_0x54ecbf[_0xf0d7('0x2e')]);_0x1358c4[_0xf0d7('0x31')]=_[_0xf0d7('0x30')](_0x54ecbf[_0xf0d7('0x2b')],qs[_0xf0d7('0x32')](_0x16633a[_0xf0d7('0x2e')][_0xf0d7('0x32')]));_0x1358c4[_0xf0d7('0x31')]=_0x1358c4[_0xf0d7('0x31')]['length']?_0x1358c4[_0xf0d7('0x31')]:_0x54ecbf[_0xf0d7('0x2b')];if(!_0x16633a['query'][_0xf0d7('0x33')](_0xf0d7('0x34'))){_0x1358c4['limit']=qs['limit'](_0x16633a[_0xf0d7('0x2e')][_0xf0d7('0x1c')]);_0x1358c4['offset']=qs['offset'](_0x16633a[_0xf0d7('0x2e')][_0xf0d7('0x19')]);}_0x1358c4[_0xf0d7('0x35')]=qs['sort'](_0x16633a['query']['sort']);_0x1358c4['where']=qs[_0xf0d7('0x36')](_[_0xf0d7('0x37')](_0x16633a[_0xf0d7('0x2e')],_0x54ecbf['filters']),_0x129f42);if(_0x16633a[_0xf0d7('0x2e')][_0xf0d7('0x38')]){_0x1358c4[_0xf0d7('0x39')]=_[_0xf0d7('0x3a')](_0x1358c4['where'],{'$or':_[_0xf0d7('0x2c')](_0x129f42,function(_0x5040d2){if(_0x5040d2[_0xf0d7('0x2a')]!==_0xf0d7('0x3b')){var _0x351aa9={};_0x351aa9[_0x5040d2['name']]={'$like':'%'+_0x16633a['query'][_0xf0d7('0x38')]+'%'};return _0x351aa9;}})});}_0x1358c4=_['merge']({},_0x1358c4,_0x16633a['options']);var _0x3952c2={'where':_0x1358c4[_0xf0d7('0x39')]};return db[_0xf0d7('0x28')][_0xf0d7('0x1b')](_0x3952c2)[_0xf0d7('0x20')](function(_0x339ca0){_0x3fa939[_0xf0d7('0x1b')]=_0x339ca0;if(_0x16633a[_0xf0d7('0x2e')][_0xf0d7('0x3c')]){_0x1358c4[_0xf0d7('0x3d')]=[{'all':!![]}];}return db[_0xf0d7('0x28')][_0xf0d7('0x3e')](_0x1358c4);})[_0xf0d7('0x20')](function(_0x3791a1){_0x3fa939['rows']=_0x3791a1;return _0x3fa939;})[_0xf0d7('0x20')](respondWithFilteredResult(_0xa542f,_0x1358c4))['catch'](handleError(_0xa542f,null));};exports['show']=function(_0x520418,_0x279b67){var _0x3526d9={'raw':!![],'where':{'id':_0x520418[_0xf0d7('0x3f')]['id']}},_0x5ec169={};_0x5ec169['model']=_[_0xf0d7('0x2f')](db[_0xf0d7('0x28')]['rawAttributes']);_0x5ec169[_0xf0d7('0x2e')]=_['keys'](_0x520418[_0xf0d7('0x2e')]);_0x5ec169[_0xf0d7('0x36')]=_[_0xf0d7('0x30')](_0x5ec169[_0xf0d7('0x2b')],_0x5ec169['query']);_0x3526d9[_0xf0d7('0x31')]=_['intersection'](_0x5ec169[_0xf0d7('0x2b')],qs['fields'](_0x520418['query']['fields']));_0x3526d9[_0xf0d7('0x31')]=_0x3526d9[_0xf0d7('0x31')]['length']?_0x3526d9[_0xf0d7('0x31')]:_0x5ec169['model'];if(_0x520418['query'][_0xf0d7('0x3c')]){_0x3526d9['include']=[{'all':!![]}];}_0x3526d9=_['merge']({},_0x3526d9,_0x520418[_0xf0d7('0x40')]);return db[_0xf0d7('0x28')][_0xf0d7('0x41')](_0x3526d9)['then'](handleEntityNotFound(_0x279b67,null))[_0xf0d7('0x20')](respondWithResult(_0x279b67,null))[_0xf0d7('0x42')](handleError(_0x279b67,null));};exports[_0xf0d7('0x43')]=function(_0xc4b7c,_0x57ccf1){return db[_0xf0d7('0x28')][_0xf0d7('0x43')](_0xc4b7c[_0xf0d7('0x44')],{})['then'](function(_0x10a8ec){var _0x2471cd=_0xc4b7c[_0xf0d7('0x45')][_0xf0d7('0x21')]({'plain':!![]});if(!_0x2471cd)throw new Error(_0xf0d7('0x46'));if(_0x2471cd['role']==='user'){var _0x48ea84=_0x10a8ec[_0xf0d7('0x21')]({'plain':!![]});var _0x5ee102='ExtractedReports';return db[_0xf0d7('0x47')]['find']({'where':{'name':_0x5ee102,'userProfileId':_0x2471cd['userProfileId']},'raw':!![]})[_0xf0d7('0x20')](function(_0x4a155b){if(_0x4a155b&&_0x4a155b[_0xf0d7('0x48')]===0x0){return db[_0xf0d7('0x23')][_0xf0d7('0x43')]({'name':_0x48ea84[_0xf0d7('0x2d')],'resourceId':_0x48ea84['id'],'type':_0x4a155b[_0xf0d7('0x2d')],'sectionId':_0x4a155b['id']},{})['then'](function(){return _0x10a8ec;});}else{return _0x10a8ec;}})['catch'](function(_0x16f632){logger[_0xf0d7('0x24')](_0xf0d7('0x49'),_0x16f632);throw _0x16f632;});}return _0x10a8ec;})[_0xf0d7('0x20')](respondWithResult(_0x57ccf1,0xc9))[_0xf0d7('0x42')](handleError(_0x57ccf1,null));};exports['update']=function(_0x32d784,_0x151907){if(_0x32d784[_0xf0d7('0x44')]['id']){delete _0x32d784['body']['id'];}return db[_0xf0d7('0x28')][_0xf0d7('0x41')]({'where':{'id':_0x32d784[_0xf0d7('0x3f')]['id']}})['then'](handleEntityNotFound(_0x151907,null))[_0xf0d7('0x20')](saveUpdates(_0x32d784[_0xf0d7('0x44')],null))[_0xf0d7('0x20')](respondWithResult(_0x151907,null))[_0xf0d7('0x42')](handleError(_0x151907,null));};exports[_0xf0d7('0x1f')]=function(_0x15c678,_0x491076){return db['AnalyticExtractedReport'][_0xf0d7('0x41')]({'where':{'id':_0x15c678[_0xf0d7('0x3f')]['id']}})[_0xf0d7('0x20')](handleEntityNotFound(_0x491076,null))[_0xf0d7('0x20')](removeEntity(_0x491076,null))[_0xf0d7('0x42')](handleError(_0x491076,null));};exports[_0xf0d7('0x4a')]=function(_0x5a06aa,_0x276c61,_0x17489a){return db['AnalyticExtractedReport'][_0xf0d7('0x41')]({'where':{'id':_0x5a06aa[_0xf0d7('0x3f')]['id']},'attributes':['name',_0xf0d7('0x4b'),_0xf0d7('0x4c'),_0xf0d7('0x4d')],'raw':!![]})[_0xf0d7('0x20')](handleEntityNotFound(_0x276c61,null))['then'](function(_0x349cc1){if(_0x349cc1){if(!fs[_0xf0d7('0x4e')](path[_0xf0d7('0x4f')](config[_0xf0d7('0x50')],_0xf0d7('0x51'),_0x349cc1[_0xf0d7('0x4c')]))){throw new db['Sequelize'][(_0xf0d7('0x52'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x5a06aa[_0xf0d7('0x2e')]['exists']){return _0x276c61[_0xf0d7('0x16')](0xc8);}return _0x276c61[_0xf0d7('0x4a')](path[_0xf0d7('0x4f')](config[_0xf0d7('0x50')],_0xf0d7('0x51'),_0x349cc1[_0xf0d7('0x4c')]),util[_0xf0d7('0x53')]('%s.%s',_0x349cc1[_0xf0d7('0x4b')]||_0x349cc1[_0xf0d7('0x2d')],_0x349cc1[_0xf0d7('0x4d')][_0xf0d7('0x54')]()));}})[_0xf0d7('0x42')](handleError(_0x276c61,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 877ddf1..f0c4422 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 _0x3c74=['rimraf','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','moment','bluebird','request-promise','path'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x3c74,0x11a));var _0x43c7=function(_0x1b85fd,_0x55e123){_0x1b85fd=_0x1b85fd-0x0;var _0x1e7406=_0x3c74[_0x1b85fd];return _0x1e7406;};'use strict';var _=require(_0x43c7('0x0'));var util=require(_0x43c7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x43c7('0x2'));var BPromise=require(_0x43c7('0x3'));var rp=require(_0x43c7('0x4'));var fs=require('fs');var path=require(_0x43c7('0x5'));var rimraf=require(_0x43c7('0x6'));var config=require('../../config/environment');var attributes=require(_0x43c7('0x7'));module[_0x43c7('0x8')]=function(_0x636899,_0x1825a6){return _0x636899[_0x43c7('0x9')](_0x43c7('0xa'),attributes,{'tableName':_0x43c7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc135=['AnalyticExtractedReport','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x3f8b5c,_0x2b215d){var _0x2a1384=function(_0x43d9c8){while(--_0x43d9c8){_0x3f8b5c['push'](_0x3f8b5c['shift']());}};_0x2a1384(++_0x2b215d);}(_0xc135,0x156));var _0x5c13=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc135[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x5c13('0x0'));var util=require(_0x5c13('0x1'));var logger=require(_0x5c13('0x2'))('api');var moment=require(_0x5c13('0x3'));var BPromise=require(_0x5c13('0x4'));var rp=require(_0x5c13('0x5'));var fs=require('fs');var path=require(_0x5c13('0x6'));var rimraf=require(_0x5c13('0x7'));var config=require('../../config/environment');var attributes=require('./analyticExtractedReport.attributes');module[_0x5c13('0x8')]=function(_0x263033,_0x16cfbe){return _0x263033[_0x5c13('0x9')](_0x5c13('0xa'),attributes,{'tableName':'analytics_extracted_reports','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 3c377f5..0dced63 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 _0x2fe6=['message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3562a2,_0x4a766f){var _0x3e9c5f=function(_0x5047d8){while(--_0x5047d8){_0x3562a2['push'](_0x3562a2['shift']());}};_0x3e9c5f(++_0x4a766f);}(_0x2fe6,0x1cb));var _0x62fe=function(_0x4115b5,_0x2dd24d){_0x4115b5=_0x4115b5-0x0;var _0x358b2b=_0x2fe6[_0x4115b5];return _0x358b2b;};'use strict';var _=require(_0x62fe('0x0'));var util=require(_0x62fe('0x1'));var moment=require(_0x62fe('0x2'));var BPromise=require(_0x62fe('0x3'));var rs=require(_0x62fe('0x4'));var fs=require('fs');var Redis=require(_0x62fe('0x5'));var db=require(_0x62fe('0x6'))['db'];var utils=require(_0x62fe('0x7'));var logger=require(_0x62fe('0x8'))(_0x62fe('0x9'));var config=require(_0x62fe('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x62fe('0xb')][_0x62fe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x207771,_0x1184f6,_0x5a1e46){return new BPromise(function(_0x5f51a8,_0x180c90){return client[_0x62fe('0xd')](_0x207771,_0x5a1e46)[_0x62fe('0xe')](function(_0xdacf42){logger['info'](_0x62fe('0xf'),_0x1184f6,_0x62fe('0x10'));logger[_0x62fe('0x11')](_0x62fe('0x12'),_0x1184f6,_0x62fe('0x10'),JSON[_0x62fe('0x13')](_0xdacf42));if(_0xdacf42['error']){if(_0xdacf42[_0x62fe('0x14')]['code']===0x1f4){logger[_0x62fe('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1184f6,_0xdacf42[_0x62fe('0x14')][_0x62fe('0x15')]);return _0x180c90(_0xdacf42['error'][_0x62fe('0x15')]);}logger[_0x62fe('0x14')](_0x62fe('0xf'),_0x1184f6,_0xdacf42[_0x62fe('0x14')][_0x62fe('0x15')]);return _0x5f51a8(_0xdacf42[_0x62fe('0x14')]['message']);}else{logger[_0x62fe('0x16')](_0x62fe('0xf'),_0x1184f6,_0x62fe('0x10'));_0x5f51a8(_0xdacf42[_0x62fe('0x17')][_0x62fe('0x15')]);}})['catch'](function(_0x1f8ee6){logger[_0x62fe('0x14')](_0x62fe('0xf'),_0x1184f6,_0x1f8ee6);_0x180c90(_0x1f8ee6);});});} \ No newline at end of file +var _0xc986=['http','then','info','request\x20sent','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x3644ee,_0x267f61){var _0x68cc12=function(_0x150047){while(--_0x150047){_0x3644ee['push'](_0x3644ee['shift']());}};_0x68cc12(++_0x267f61);}(_0xc986,0xef));var _0x6c98=function(_0x180e21,_0x3d0829){_0x180e21=_0x180e21-0x0;var _0x7f194d=_0xc986[_0x180e21];return _0x7f194d;};'use strict';var _=require('lodash');var util=require(_0x6c98('0x0'));var moment=require(_0x6c98('0x1'));var BPromise=require(_0x6c98('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c98('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c98('0x4'))(_0x6c98('0x5'));var config=require(_0x6c98('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6c98('0x7')][_0x6c98('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bf13a,_0x26426c,_0xdab696){return new BPromise(function(_0x346670,_0x22af0b){return client['request'](_0x1bf13a,_0xdab696)[_0x6c98('0x9')](function(_0x3c22a9){logger[_0x6c98('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x26426c,_0x6c98('0xb'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x26426c,_0x6c98('0xb'),JSON[_0x6c98('0xc')](_0x3c22a9));if(_0x3c22a9[_0x6c98('0xd')]){if(_0x3c22a9[_0x6c98('0xd')][_0x6c98('0xe')]===0x1f4){logger[_0x6c98('0xd')](_0x6c98('0xf'),_0x26426c,_0x3c22a9[_0x6c98('0xd')]['message']);return _0x22af0b(_0x3c22a9[_0x6c98('0xd')][_0x6c98('0x10')]);}logger[_0x6c98('0xd')](_0x6c98('0xf'),_0x26426c,_0x3c22a9[_0x6c98('0xd')][_0x6c98('0x10')]);return _0x346670(_0x3c22a9[_0x6c98('0xd')]['message']);}else{logger['info'](_0x6c98('0xf'),_0x26426c,_0x6c98('0xb'));_0x346670(_0x3c22a9[_0x6c98('0x11')][_0x6c98('0x10')]);}})[_0x6c98('0x12')](function(_0x2a11ff){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x26426c,_0x2a11ff);_0x22af0b(_0x2a11ff);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 81307f4..5a8e481 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 _0x6b45=['get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b45,0x180));var _0x56b4=function(_0x480843,_0x8121e6){_0x480843=_0x480843-0x0;var _0x1d5cd9=_0x6b45[_0x480843];return _0x1d5cd9;};'use strict';var multer=require('multer');var util=require(_0x56b4('0x0'));var path=require(_0x56b4('0x1'));var timeout=require(_0x56b4('0x2'));var express=require('express');var router=express[_0x56b4('0x3')]();var fs_extra=require(_0x56b4('0x4'));var auth=require(_0x56b4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x56b4('0x6'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x56b4('0x7')](_0x56b4('0x8'),auth[_0x56b4('0x9')](),controller[_0x56b4('0xa')]);router[_0x56b4('0x7')]('/:id/download',auth[_0x56b4('0x9')](),controller['download']);router[_0x56b4('0xb')]('/',auth[_0x56b4('0x9')](),controller[_0x56b4('0xc')]);router[_0x56b4('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x56b4('0xe')]);router[_0x56b4('0xf')](_0x56b4('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x56b4('0x10')]=router; \ No newline at end of file +var _0x3a61=['isAuthenticated','index','/:id','show','get','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3a61,0x157));var _0x13a6=function(_0x347ea8,_0x2ac098){_0x347ea8=_0x347ea8-0x0;var _0x2e83f4=_0x3a61[_0x347ea8];return _0x2e83f4;};'use strict';var multer=require(_0x13a6('0x0'));var util=require(_0x13a6('0x1'));var path=require(_0x13a6('0x2'));var timeout=require(_0x13a6('0x3'));var express=require(_0x13a6('0x4'));var router=express[_0x13a6('0x5')]();var fs_extra=require(_0x13a6('0x6'));var auth=require(_0x13a6('0x7'));var interaction=require(_0x13a6('0x8'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0x13a6('0x9')](),controller[_0x13a6('0xa')]);router['get'](_0x13a6('0xb'),auth[_0x13a6('0x9')](),controller[_0x13a6('0xc')]);router[_0x13a6('0xd')]('/:id/download',auth[_0x13a6('0x9')](),controller[_0x13a6('0xe')]);router[_0x13a6('0xf')]('/',auth[_0x13a6('0x9')](),controller[_0x13a6('0x10')]);router[_0x13a6('0x11')](_0x13a6('0xb'),auth['isAuthenticated'](),controller[_0x13a6('0x12')]);router[_0x13a6('0x13')](_0x13a6('0xb'),auth[_0x13a6('0x9')](),controller[_0x13a6('0x14')]);module[_0x13a6('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 c4c0031..a0a4e50 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 _0x4ae5=['exports','STRING','BOOLEAN'];(function(_0x58ac9b,_0x35dc04){var _0x12a47d=function(_0x2af5ce){while(--_0x2af5ce){_0x58ac9b['push'](_0x58ac9b['shift']());}};_0x12a47d(++_0x35dc04);}(_0x4ae5,0x102));var _0x54ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4ae5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x54ae('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x54ae('0x1')]},'function':{'type':Sequelize[_0x54ae('0x1')]},'format':{'type':Sequelize[_0x54ae('0x1')]},'groupBy':{'type':Sequelize[_0x54ae('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xde1f=['BOOLEAN','sequelize','TEXT','STRING'];(function(_0x42accd,_0x4da84e){var _0x1a76ac=function(_0x2f2cb1){while(--_0x2f2cb1){_0x42accd['push'](_0x42accd['shift']());}};_0x1a76ac(++_0x4da84e);}(_0xde1f,0x125));var _0xfde1=function(_0x10639d,_0x1fad09){_0x10639d=_0x10639d-0x0;var _0x206332=_0xde1f[_0x10639d];return _0x206332;};'use strict';var Sequelize=require(_0xfde1('0x0'));module['exports']={'field':{'type':Sequelize[_0xfde1('0x1')]},'alias':{'type':Sequelize[_0xfde1('0x2')]},'function':{'type':Sequelize[_0xfde1('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xfde1('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 93e633f..28e3c38 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 _0xec5f=['merge','find','create','body','bulkCreate','bulkDestroy','ids','addFields','map','CustomReportId','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','save','update','destroy','then','error','send','index','AnalyticFieldReport','rawAttributes','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','options','includeAll','include','findAll','rows','catch','show','params','keys'];(function(_0x41936a,_0x26e929){var _0x212240=function(_0x1c0554){while(--_0x1c0554){_0x41936a['push'](_0x41936a['shift']());}};_0x212240(++_0x26e929);}(_0xec5f,0x1d8));var _0xfec5=function(_0x29fad9,_0x573b38){_0x29fad9=_0x29fad9-0x0;var _0x1bfd87=_0xec5f[_0x29fad9];return _0x1bfd87;};'use strict';var emlformat=require(_0xfec5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfec5('0x1'));var jsonpatch=require(_0xfec5('0x2'));var rp=require(_0xfec5('0x3'));var moment=require(_0xfec5('0x4'));var BPromise=require(_0xfec5('0x5'));var Mustache=require(_0xfec5('0x6'));var util=require(_0xfec5('0x7'));var path=require(_0xfec5('0x8'));var sox=require(_0xfec5('0x9'));var csv=require('to-csv');var ejs=require(_0xfec5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfec5('0xb'));var squel=require(_0xfec5('0xc'));var crypto=require(_0xfec5('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfec5('0xe'));var Redis=require(_0xfec5('0xf'));var authService=require(_0xfec5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfec5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfec5('0x12'))(_0xfec5('0x13'));var utils=require(_0xfec5('0x14'));var config=require(_0xfec5('0x15'));var licenseUtil=require(_0xfec5('0x16'));var db=require(_0xfec5('0x17'))['db'];function respondWithStatusCode(_0x5bfe9f,_0x3bed29){_0x3bed29=_0x3bed29||0xcc;return function(_0x336833){if(_0x336833){return _0x5bfe9f[_0xfec5('0x18')](_0x3bed29);}return _0x5bfe9f[_0xfec5('0x19')](_0x3bed29)[_0xfec5('0x1a')]();};}function respondWithResult(_0x5231ff,_0x182394){_0x182394=_0x182394||0xc8;return function(_0x385749){if(_0x385749){return _0x5231ff[_0xfec5('0x19')](_0x182394)['json'](_0x385749);}};}function respondWithFilteredResult(_0x2e1add,_0x7461be){return function(_0x129f4c){if(_0x129f4c){var _0xb6c8dd=typeof _0x7461be[_0xfec5('0x1b')]===_0xfec5('0x1c')&&typeof _0x7461be[_0xfec5('0x1d')]==='undefined';var _0x368a63=_0x129f4c[_0xfec5('0x1e')];var _0x257f67=_0xb6c8dd?0x0:_0x7461be[_0xfec5('0x1b')];var _0x21a721=_0xb6c8dd?_0x129f4c[_0xfec5('0x1e')]:_0x7461be[_0xfec5('0x1b')]+_0x7461be[_0xfec5('0x1d')];var _0x4fc6ba;if(_0x21a721>=_0x368a63){_0x21a721=_0x368a63;_0x4fc6ba=0xc8;}else{_0x4fc6ba=0xce;}_0x2e1add[_0xfec5('0x19')](_0x4fc6ba);return _0x2e1add[_0xfec5('0x1f')]('Content-Range',_0x257f67+'-'+_0x21a721+'/'+_0x368a63)[_0xfec5('0x20')](_0x129f4c);}return null;};}function patchUpdates(_0x4ac366){return function(_0x52e311){try{jsonpatch['apply'](_0x52e311,_0x4ac366,!![]);}catch(_0x7efe74){return BPromise['reject'](_0x7efe74);}return _0x52e311[_0xfec5('0x21')]();};}function saveUpdates(_0x2ff665,_0x37bf7b){return function(_0x114c66){if(_0x114c66){return _0x114c66[_0xfec5('0x22')](_0x2ff665)['then'](function(_0x3cc5c4){return _0x3cc5c4;});}return null;};}function removeEntity(_0x551629,_0x37ec7f){return function(_0x185689){if(_0x185689){return _0x185689[_0xfec5('0x23')]()[_0xfec5('0x24')](function(){_0x551629['status'](0xcc)[_0xfec5('0x1a')]();});}};}function handleEntityNotFound(_0x436682,_0x4887d6){return function(_0x47b117){if(!_0x47b117){_0x436682['sendStatus'](0x194);}return _0x47b117;};}function handleError(_0x502c26,_0x16cd4e){_0x16cd4e=_0x16cd4e||0x1f4;return function(_0x25432d){logger[_0xfec5('0x25')](_0x25432d['stack']);if(_0x25432d['name']){delete _0x25432d['name'];}_0x502c26['status'](_0x16cd4e)[_0xfec5('0x26')](_0x25432d);};}exports[_0xfec5('0x27')]=function(_0x34266a,_0x588b3c){var _0x18ae4d={},_0x4fc03c={},_0x155812={'count':0x0,'rows':[]};var _0xe06850=_['map'](db[_0xfec5('0x28')][_0xfec5('0x29')],function(_0x5a9d82){return{'name':_0x5a9d82[_0xfec5('0x2a')],'type':_0x5a9d82['type'][_0xfec5('0x2b')]};});_0x4fc03c[_0xfec5('0x2c')]=_['map'](_0xe06850,_0xfec5('0x2d'));_0x4fc03c[_0xfec5('0x2e')]=_['keys'](_0x34266a[_0xfec5('0x2e')]);_0x4fc03c[_0xfec5('0x2f')]=_[_0xfec5('0x30')](_0x4fc03c[_0xfec5('0x2c')],_0x4fc03c['query']);_0x18ae4d[_0xfec5('0x31')]=_[_0xfec5('0x30')](_0x4fc03c[_0xfec5('0x2c')],qs['fields'](_0x34266a[_0xfec5('0x2e')][_0xfec5('0x32')]));_0x18ae4d[_0xfec5('0x31')]=_0x18ae4d['attributes'][_0xfec5('0x33')]?_0x18ae4d[_0xfec5('0x31')]:_0x4fc03c[_0xfec5('0x2c')];if(!_0x34266a[_0xfec5('0x2e')][_0xfec5('0x34')](_0xfec5('0x35'))){_0x18ae4d[_0xfec5('0x1d')]=qs[_0xfec5('0x1d')](_0x34266a[_0xfec5('0x2e')][_0xfec5('0x1d')]);_0x18ae4d[_0xfec5('0x1b')]=qs[_0xfec5('0x1b')](_0x34266a[_0xfec5('0x2e')][_0xfec5('0x1b')]);}_0x18ae4d['order']=qs[_0xfec5('0x36')](_0x34266a[_0xfec5('0x2e')]['sort']);_0x18ae4d['where']=qs['filters'](_[_0xfec5('0x37')](_0x34266a[_0xfec5('0x2e')],_0x4fc03c[_0xfec5('0x2f')]),_0xe06850);if(_0x34266a[_0xfec5('0x2e')][_0xfec5('0x38')]){_0x18ae4d[_0xfec5('0x39')]=_['merge'](_0x18ae4d[_0xfec5('0x39')],{'$or':_['map'](_0xe06850,function(_0x207ef9){if(_0x207ef9['type']!=='VIRTUAL'){var _0x249437={};_0x249437[_0x207ef9[_0xfec5('0x2d')]]={'$like':'%'+_0x34266a['query'][_0xfec5('0x38')]+'%'};return _0x249437;}})});}_0x18ae4d=_['merge']({},_0x18ae4d,_0x34266a[_0xfec5('0x3a')]);var _0x50beb6={'where':_0x18ae4d['where']};return db[_0xfec5('0x28')]['count'](_0x50beb6)['then'](function(_0x15a98b){_0x155812[_0xfec5('0x1e')]=_0x15a98b;if(_0x34266a[_0xfec5('0x2e')][_0xfec5('0x3b')]){_0x18ae4d[_0xfec5('0x3c')]=[{'all':!![]}];}return db[_0xfec5('0x28')][_0xfec5('0x3d')](_0x18ae4d);})[_0xfec5('0x24')](function(_0x5aa2dc){_0x155812[_0xfec5('0x3e')]=_0x5aa2dc;return _0x155812;})['then'](respondWithFilteredResult(_0x588b3c,_0x18ae4d))[_0xfec5('0x3f')](handleError(_0x588b3c,null));};exports[_0xfec5('0x40')]=function(_0x50a22f,_0x5ee6c4){var _0x1967a5={'raw':![],'where':{'id':_0x50a22f[_0xfec5('0x41')]['id']}},_0x4b9722={};_0x4b9722[_0xfec5('0x2c')]=_['keys'](db[_0xfec5('0x28')][_0xfec5('0x29')]);_0x4b9722[_0xfec5('0x2e')]=_[_0xfec5('0x42')](_0x50a22f[_0xfec5('0x2e')]);_0x4b9722['filters']=_[_0xfec5('0x30')](_0x4b9722[_0xfec5('0x2c')],_0x4b9722[_0xfec5('0x2e')]);_0x1967a5['attributes']=_['intersection'](_0x4b9722[_0xfec5('0x2c')],qs[_0xfec5('0x32')](_0x50a22f['query'][_0xfec5('0x32')]));_0x1967a5['attributes']=_0x1967a5[_0xfec5('0x31')][_0xfec5('0x33')]?_0x1967a5[_0xfec5('0x31')]:_0x4b9722[_0xfec5('0x2c')];if(_0x50a22f[_0xfec5('0x2e')][_0xfec5('0x3b')]){_0x1967a5[_0xfec5('0x3c')]=[{'all':!![]}];}_0x1967a5=_[_0xfec5('0x43')]({},_0x1967a5,_0x50a22f[_0xfec5('0x3a')]);return db['AnalyticFieldReport'][_0xfec5('0x44')](_0x1967a5)[_0xfec5('0x24')](handleEntityNotFound(_0x5ee6c4,null))[_0xfec5('0x24')](respondWithResult(_0x5ee6c4,null))[_0xfec5('0x3f')](handleError(_0x5ee6c4,null));};exports[_0xfec5('0x45')]=function(_0x529198,_0x3ec083){return db[_0xfec5('0x28')][_0xfec5('0x45')](_0x529198[_0xfec5('0x46')],{})[_0xfec5('0x24')](respondWithResult(_0x3ec083,0xc9))[_0xfec5('0x3f')](handleError(_0x3ec083,null));};exports[_0xfec5('0x47')]=function(_0x35e2fe,_0x39fe19){return db[_0xfec5('0x28')][_0xfec5('0x47')](_0x35e2fe[_0xfec5('0x46')],{'raw':![],'individualHooks':!![]})[_0xfec5('0x24')](respondWithResult(_0x39fe19,0xc9))[_0xfec5('0x3f')](handleError(_0x39fe19,null));};exports[_0xfec5('0x22')]=function(_0x45347c,_0x425cd6){if(_0x45347c['body']['id']){delete _0x45347c[_0xfec5('0x46')]['id'];}return db[_0xfec5('0x28')][_0xfec5('0x44')]({'where':{'id':_0x45347c['params']['id']}})[_0xfec5('0x24')](handleEntityNotFound(_0x425cd6,null))['then'](saveUpdates(_0x45347c['body'],null))[_0xfec5('0x24')](respondWithResult(_0x425cd6,null))[_0xfec5('0x3f')](handleError(_0x425cd6,null));};exports['destroy']=function(_0x40871d,_0x386755){return db[_0xfec5('0x28')][_0xfec5('0x44')]({'where':{'id':_0x40871d[_0xfec5('0x41')]['id']}})[_0xfec5('0x24')](handleEntityNotFound(_0x386755,null))[_0xfec5('0x24')](removeEntity(_0x386755,null))[_0xfec5('0x3f')](handleError(_0x386755,null));};exports[_0xfec5('0x48')]=function(_0x46d81c,_0x210c3d){return db[_0xfec5('0x28')]['destroy']({'where':{'id':_0x46d81c[_0xfec5('0x2e')][_0xfec5('0x49')]||[]},'raw':![],'individualHooks':!![]})[_0xfec5('0x24')](respondWithResult(_0x210c3d,0xcc))[_0xfec5('0x3f')](handleError(_0x210c3d,null));};exports[_0xfec5('0x4a')]=function(_0x3897e1,_0x3656c8,_0x221e2a){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x3897e1['params']['id']}})[_0xfec5('0x24')](handleEntityNotFound(_0x3656c8,null))['then'](function(_0x5c49c1){if(_0x5c49c1){return db['sequelize']['transaction'](function(_0xd3dbac){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x3897e1[_0xfec5('0x41')]['id']},'transaction':_0xd3dbac})['then'](function(_0x206ec4){var _0x202c31=_[_0xfec5('0x4b')](_0x3897e1[_0xfec5('0x46')],function(_0xd344ab){delete _0xd344ab['id'];_0xd344ab[_0xfec5('0x4c')]=_0x3897e1['params']['id'];return _0xd344ab;});return db[_0xfec5('0x28')][_0xfec5('0x47')](_0x202c31,{'transaction':_0xd3dbac});});})[_0xfec5('0x24')](function(){return db['AnalyticFieldReport'][_0xfec5('0x3d')]({'where':{'CustomReportId':_0x3897e1['params']['id']}});});}})[_0xfec5('0x24')](respondWithResult(_0x3656c8,null))[_0xfec5('0x3f')](handleError(_0x3656c8,null));}; \ No newline at end of file +var _0xf159=['catch','fields','find','create','body','bulkCreate','params','bulkDestroy','ids','addFields','findOne','sequelize','transaction','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','AnalyticFieldReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf159,0x151));var _0x9f15=function(_0x2a3552,_0x33a2e2){_0x2a3552=_0x2a3552-0x0;var _0x2c8540=_0xf159[_0x2a3552];return _0x2c8540;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f15('0x0'));var zipdir=require(_0x9f15('0x1'));var jsonpatch=require(_0x9f15('0x2'));var rp=require(_0x9f15('0x3'));var moment=require(_0x9f15('0x4'));var BPromise=require(_0x9f15('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9f15('0x6'));var csv=require(_0x9f15('0x7'));var ejs=require(_0x9f15('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f15('0x9'));var squel=require(_0x9f15('0xa'));var crypto=require(_0x9f15('0xb'));var jsforce=require(_0x9f15('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9f15('0xd'));var Papa=require(_0x9f15('0xe'));var Redis=require(_0x9f15('0xf'));var authService=require(_0x9f15('0x10'));var qs=require(_0x9f15('0x11'));var as=require(_0x9f15('0x12'));var hardwareService=require(_0x9f15('0x13'));var logger=require(_0x9f15('0x14'))(_0x9f15('0x15'));var utils=require(_0x9f15('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9f15('0x17'));var db=require(_0x9f15('0x18'))['db'];function respondWithStatusCode(_0x21709a,_0x2bebb6){_0x2bebb6=_0x2bebb6||0xcc;return function(_0x115cbb){if(_0x115cbb){return _0x21709a[_0x9f15('0x19')](_0x2bebb6);}return _0x21709a[_0x9f15('0x1a')](_0x2bebb6)['end']();};}function respondWithResult(_0x470a37,_0xfb9317){_0xfb9317=_0xfb9317||0xc8;return function(_0x4766ee){if(_0x4766ee){return _0x470a37[_0x9f15('0x1a')](_0xfb9317)[_0x9f15('0x1b')](_0x4766ee);}};}function respondWithFilteredResult(_0x51671c,_0x443c64){return function(_0x40ca24){if(_0x40ca24){var _0x28c07b=typeof _0x443c64[_0x9f15('0x1c')]===_0x9f15('0x1d')&&typeof _0x443c64[_0x9f15('0x1e')]===_0x9f15('0x1d');var _0x58f682=_0x40ca24[_0x9f15('0x1f')];var _0x57fa6d=_0x28c07b?0x0:_0x443c64['offset'];var _0x498435=_0x28c07b?_0x40ca24[_0x9f15('0x1f')]:_0x443c64[_0x9f15('0x1c')]+_0x443c64[_0x9f15('0x1e')];var _0x46fd00;if(_0x498435>=_0x58f682){_0x498435=_0x58f682;_0x46fd00=0xc8;}else{_0x46fd00=0xce;}_0x51671c[_0x9f15('0x1a')](_0x46fd00);return _0x51671c[_0x9f15('0x20')](_0x9f15('0x21'),_0x57fa6d+'-'+_0x498435+'/'+_0x58f682)[_0x9f15('0x1b')](_0x40ca24);}return null;};}function patchUpdates(_0x4c39b8){return function(_0x32dbaa){try{jsonpatch[_0x9f15('0x22')](_0x32dbaa,_0x4c39b8,!![]);}catch(_0x169fb3){return BPromise['reject'](_0x169fb3);}return _0x32dbaa['save']();};}function saveUpdates(_0x32b730,_0x46207f){return function(_0x393c18){if(_0x393c18){return _0x393c18[_0x9f15('0x23')](_0x32b730)[_0x9f15('0x24')](function(_0x423e7a){return _0x423e7a;});}return null;};}function removeEntity(_0x50ecf6,_0x3564db){return function(_0x17272b){if(_0x17272b){return _0x17272b[_0x9f15('0x25')]()[_0x9f15('0x24')](function(){_0x50ecf6[_0x9f15('0x1a')](0xcc)[_0x9f15('0x26')]();});}};}function handleEntityNotFound(_0x4e9064,_0x2dc4cf){return function(_0x16925e){if(!_0x16925e){_0x4e9064['sendStatus'](0x194);}return _0x16925e;};}function handleError(_0x9c3fe9,_0x5aace7){_0x5aace7=_0x5aace7||0x1f4;return function(_0x286506){logger[_0x9f15('0x27')](_0x286506['stack']);if(_0x286506[_0x9f15('0x28')]){delete _0x286506['name'];}_0x9c3fe9['status'](_0x5aace7)[_0x9f15('0x29')](_0x286506);};}exports[_0x9f15('0x2a')]=function(_0x15c010,_0x2d6993){var _0x4257a0={},_0x78db76={},_0x410452={'count':0x0,'rows':[]};var _0x281b48=_[_0x9f15('0x2b')](db[_0x9f15('0x2c')]['rawAttributes'],function(_0x505bfd){return{'name':_0x505bfd[_0x9f15('0x2d')],'type':_0x505bfd[_0x9f15('0x2e')][_0x9f15('0x2f')]};});_0x78db76[_0x9f15('0x30')]=_['map'](_0x281b48,_0x9f15('0x28'));_0x78db76[_0x9f15('0x31')]=_[_0x9f15('0x32')](_0x15c010[_0x9f15('0x31')]);_0x78db76[_0x9f15('0x33')]=_[_0x9f15('0x34')](_0x78db76['model'],_0x78db76[_0x9f15('0x31')]);_0x4257a0[_0x9f15('0x35')]=_[_0x9f15('0x34')](_0x78db76['model'],qs['fields'](_0x15c010[_0x9f15('0x31')]['fields']));_0x4257a0[_0x9f15('0x35')]=_0x4257a0[_0x9f15('0x35')][_0x9f15('0x36')]?_0x4257a0[_0x9f15('0x35')]:_0x78db76['model'];if(!_0x15c010[_0x9f15('0x31')][_0x9f15('0x37')](_0x9f15('0x38'))){_0x4257a0['limit']=qs['limit'](_0x15c010[_0x9f15('0x31')]['limit']);_0x4257a0[_0x9f15('0x1c')]=qs[_0x9f15('0x1c')](_0x15c010[_0x9f15('0x31')]['offset']);}_0x4257a0[_0x9f15('0x39')]=qs[_0x9f15('0x3a')](_0x15c010[_0x9f15('0x31')][_0x9f15('0x3a')]);_0x4257a0[_0x9f15('0x3b')]=qs[_0x9f15('0x33')](_[_0x9f15('0x3c')](_0x15c010[_0x9f15('0x31')],_0x78db76[_0x9f15('0x33')]),_0x281b48);if(_0x15c010[_0x9f15('0x31')][_0x9f15('0x3d')]){_0x4257a0['where']=_[_0x9f15('0x3e')](_0x4257a0['where'],{'$or':_[_0x9f15('0x2b')](_0x281b48,function(_0xb5a215){if(_0xb5a215[_0x9f15('0x2e')]!==_0x9f15('0x3f')){var _0x555690={};_0x555690[_0xb5a215[_0x9f15('0x28')]]={'$like':'%'+_0x15c010[_0x9f15('0x31')][_0x9f15('0x3d')]+'%'};return _0x555690;}})});}_0x4257a0=_[_0x9f15('0x3e')]({},_0x4257a0,_0x15c010[_0x9f15('0x40')]);var _0x4e9db0={'where':_0x4257a0[_0x9f15('0x3b')]};return db[_0x9f15('0x2c')][_0x9f15('0x1f')](_0x4e9db0)[_0x9f15('0x24')](function(_0x3aaaca){_0x410452['count']=_0x3aaaca;if(_0x15c010[_0x9f15('0x31')][_0x9f15('0x41')]){_0x4257a0[_0x9f15('0x42')]=[{'all':!![]}];}return db[_0x9f15('0x2c')][_0x9f15('0x43')](_0x4257a0);})[_0x9f15('0x24')](function(_0x51b3db){_0x410452['rows']=_0x51b3db;return _0x410452;})['then'](respondWithFilteredResult(_0x2d6993,_0x4257a0))[_0x9f15('0x44')](handleError(_0x2d6993,null));};exports['show']=function(_0x29e232,_0x40b2f3){var _0x338326={'raw':![],'where':{'id':_0x29e232['params']['id']}},_0x434338={};_0x434338[_0x9f15('0x30')]=_[_0x9f15('0x32')](db['AnalyticFieldReport']['rawAttributes']);_0x434338[_0x9f15('0x31')]=_['keys'](_0x29e232[_0x9f15('0x31')]);_0x434338['filters']=_['intersection'](_0x434338['model'],_0x434338[_0x9f15('0x31')]);_0x338326[_0x9f15('0x35')]=_['intersection'](_0x434338[_0x9f15('0x30')],qs[_0x9f15('0x45')](_0x29e232[_0x9f15('0x31')][_0x9f15('0x45')]));_0x338326[_0x9f15('0x35')]=_0x338326[_0x9f15('0x35')][_0x9f15('0x36')]?_0x338326[_0x9f15('0x35')]:_0x434338['model'];if(_0x29e232[_0x9f15('0x31')][_0x9f15('0x41')]){_0x338326[_0x9f15('0x42')]=[{'all':!![]}];}_0x338326=_[_0x9f15('0x3e')]({},_0x338326,_0x29e232[_0x9f15('0x40')]);return db[_0x9f15('0x2c')][_0x9f15('0x46')](_0x338326)['then'](handleEntityNotFound(_0x40b2f3,null))[_0x9f15('0x24')](respondWithResult(_0x40b2f3,null))['catch'](handleError(_0x40b2f3,null));};exports[_0x9f15('0x47')]=function(_0x2e8c99,_0x222bc4){return db['AnalyticFieldReport']['create'](_0x2e8c99[_0x9f15('0x48')],{})['then'](respondWithResult(_0x222bc4,0xc9))[_0x9f15('0x44')](handleError(_0x222bc4,null));};exports[_0x9f15('0x49')]=function(_0x5a6683,_0x489f67){return db[_0x9f15('0x2c')][_0x9f15('0x49')](_0x5a6683[_0x9f15('0x48')],{'raw':![],'individualHooks':!![]})[_0x9f15('0x24')](respondWithResult(_0x489f67,0xc9))['catch'](handleError(_0x489f67,null));};exports[_0x9f15('0x23')]=function(_0x26ba99,_0x2aa147){if(_0x26ba99['body']['id']){delete _0x26ba99['body']['id'];}return db[_0x9f15('0x2c')][_0x9f15('0x46')]({'where':{'id':_0x26ba99['params']['id']}})[_0x9f15('0x24')](handleEntityNotFound(_0x2aa147,null))[_0x9f15('0x24')](saveUpdates(_0x26ba99[_0x9f15('0x48')],null))[_0x9f15('0x24')](respondWithResult(_0x2aa147,null))[_0x9f15('0x44')](handleError(_0x2aa147,null));};exports[_0x9f15('0x25')]=function(_0x3e2bcd,_0x5a3ab6){return db[_0x9f15('0x2c')][_0x9f15('0x46')]({'where':{'id':_0x3e2bcd[_0x9f15('0x4a')]['id']}})[_0x9f15('0x24')](handleEntityNotFound(_0x5a3ab6,null))[_0x9f15('0x24')](removeEntity(_0x5a3ab6,null))[_0x9f15('0x44')](handleError(_0x5a3ab6,null));};exports[_0x9f15('0x4b')]=function(_0x4c0db0,_0x50da71){return db[_0x9f15('0x2c')][_0x9f15('0x25')]({'where':{'id':_0x4c0db0['query'][_0x9f15('0x4c')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x50da71,0xcc))[_0x9f15('0x44')](handleError(_0x50da71,null));};exports[_0x9f15('0x4d')]=function(_0x2ebee3,_0x2c0780,_0x4c80ee){return db['AnalyticCustomReport'][_0x9f15('0x4e')]({'where':{'id':_0x2ebee3[_0x9f15('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2c0780,null))[_0x9f15('0x24')](function(_0xaa72bc){if(_0xaa72bc){return db[_0x9f15('0x4f')][_0x9f15('0x50')](function(_0x56295a){return db['AnalyticFieldReport'][_0x9f15('0x25')]({'where':{'CustomReportId':_0x2ebee3['params']['id']},'transaction':_0x56295a})[_0x9f15('0x24')](function(_0x3376a6){var _0x27d713=_[_0x9f15('0x2b')](_0x2ebee3['body'],function(_0x2685f3){delete _0x2685f3['id'];_0x2685f3['CustomReportId']=_0x2ebee3['params']['id'];return _0x2685f3;});return db[_0x9f15('0x2c')][_0x9f15('0x49')](_0x27d713,{'transaction':_0x56295a});});})[_0x9f15('0x24')](function(){return db[_0x9f15('0x2c')][_0x9f15('0x43')]({'where':{'CustomReportId':_0x2ebee3[_0x9f15('0x4a')]['id']}});});}})['then'](respondWithResult(_0x2c0780,null))[_0x9f15('0x44')](handleError(_0x2c0780,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 055156d..3f62a4d 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 _0x944f=['path','../../config/environment','./analyticFieldReport.attributes','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2f143f,_0x4d35ec){var _0x533487=function(_0x33b046){while(--_0x33b046){_0x2f143f['push'](_0x2f143f['shift']());}};_0x533487(++_0x4d35ec);}(_0x944f,0x1b2));var _0xf944=function(_0x5162ed,_0x386cb7){_0x5162ed=_0x5162ed-0x0;var _0x4c579b=_0x944f[_0x5162ed];return _0x4c579b;};'use strict';var _=require(_0xf944('0x0'));var util=require(_0xf944('0x1'));var logger=require(_0xf944('0x2'))(_0xf944('0x3'));var moment=require(_0xf944('0x4'));var BPromise=require('bluebird');var rp=require(_0xf944('0x5'));var fs=require('fs');var path=require(_0xf944('0x6'));var rimraf=require('rimraf');var config=require(_0xf944('0x7'));var attributes=require(_0xf944('0x8'));module['exports']=function(_0x41c5f7,_0x59735e){return _0x41c5f7['define'](_0xf944('0x9'),attributes,{'tableName':_0xf944('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4dde=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x35e75a,_0x5ed225){var _0xb23c7f=function(_0x2fa40c){while(--_0x2fa40c){_0x35e75a['push'](_0x35e75a['shift']());}};_0xb23c7f(++_0x5ed225);}(_0x4dde,0xee));var _0xe4dd=function(_0x11cbfd,_0x1c0e80){_0x11cbfd=_0x11cbfd-0x0;var _0x1802de=_0x4dde[_0x11cbfd];return _0x1802de;};'use strict';var _=require(_0xe4dd('0x0'));var util=require(_0xe4dd('0x1'));var logger=require(_0xe4dd('0x2'))(_0xe4dd('0x3'));var moment=require(_0xe4dd('0x4'));var BPromise=require(_0xe4dd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4dd('0x6'));var rimraf=require(_0xe4dd('0x7'));var config=require(_0xe4dd('0x8'));var attributes=require(_0xe4dd('0x9'));module[_0xe4dd('0xa')]=function(_0x3f7c28,_0x5a831e){return _0x3f7c28[_0xe4dd('0xb')](_0xe4dd('0xc'),attributes,{'tableName':_0xe4dd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 2dfa13c..935acec 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 _0x4aae=['../../config/environment','jayson/promise','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0xe06a66,_0x482fbb){var _0xe78c4=function(_0x45d5b1){while(--_0x45d5b1){_0xe06a66['push'](_0xe06a66['shift']());}};_0xe78c4(++_0x482fbb);}(_0x4aae,0x173));var _0xe4aa=function(_0x1a60ff,_0x496f1f){_0x1a60ff=_0x1a60ff-0x0;var _0x149ec1=_0x4aae[_0x1a60ff];return _0x149ec1;};'use strict';var _=require(_0xe4aa('0x0'));var util=require(_0xe4aa('0x1'));var moment=require('moment');var BPromise=require(_0xe4aa('0x2'));var rs=require(_0xe4aa('0x3'));var fs=require('fs');var Redis=require(_0xe4aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4aa('0x5'));var logger=require('../../config/logger')(_0xe4aa('0x6'));var config=require(_0xe4aa('0x7'));var jayson=require(_0xe4aa('0x8'));var client=jayson[_0xe4aa('0x9')][_0xe4aa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11cd15,_0x494a27,_0x165a60){return new BPromise(function(_0x2ea58a,_0x597aff){return client['request'](_0x11cd15,_0x165a60)[_0xe4aa('0xb')](function(_0x566c8a){logger[_0xe4aa('0xc')](_0xe4aa('0xd'),_0x494a27,'request\x20sent');logger['debug'](_0xe4aa('0xe'),_0x494a27,_0xe4aa('0xf'),JSON['stringify'](_0x566c8a));if(_0x566c8a[_0xe4aa('0x10')]){if(_0x566c8a[_0xe4aa('0x10')][_0xe4aa('0x11')]===0x1f4){logger[_0xe4aa('0x10')](_0xe4aa('0xd'),_0x494a27,_0x566c8a[_0xe4aa('0x10')][_0xe4aa('0x12')]);return _0x597aff(_0x566c8a[_0xe4aa('0x10')]['message']);}logger['error'](_0xe4aa('0xd'),_0x494a27,_0x566c8a[_0xe4aa('0x10')][_0xe4aa('0x12')]);return _0x2ea58a(_0x566c8a['error'][_0xe4aa('0x12')]);}else{logger[_0xe4aa('0xc')](_0xe4aa('0xd'),_0x494a27,_0xe4aa('0xf'));_0x2ea58a(_0x566c8a[_0xe4aa('0x13')][_0xe4aa('0x12')]);}})[_0xe4aa('0x14')](function(_0x3a5ea6){logger[_0xe4aa('0x10')](_0xe4aa('0xd'),_0x494a27,_0x3a5ea6);_0x597aff(_0x3a5ea6);});});} \ No newline at end of file +var _0x4fe5=['request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','info','AnalyticFieldReport,\x20%s,\x20%s','debug','stringify','error','code','message'];(function(_0x7355ac,_0x14b0d7){var _0x493020=function(_0x468a5d){while(--_0x468a5d){_0x7355ac['push'](_0x7355ac['shift']());}};_0x493020(++_0x14b0d7);}(_0x4fe5,0x1bc));var _0x54fe=function(_0x437672,_0x39f4ca){_0x437672=_0x437672-0x0;var _0x2d7325=_0x4fe5[_0x437672];return _0x2d7325;};'use strict';var _=require(_0x54fe('0x0'));var util=require(_0x54fe('0x1'));var moment=require('moment');var BPromise=require(_0x54fe('0x2'));var rs=require(_0x54fe('0x3'));var fs=require('fs');var Redis=require(_0x54fe('0x4'));var db=require(_0x54fe('0x5'))['db'];var utils=require(_0x54fe('0x6'));var logger=require(_0x54fe('0x7'))(_0x54fe('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x54fe('0x9')][_0x54fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x502966,_0x5a2d65,_0x5a5c85){return new BPromise(function(_0x195c38,_0x2accae){return client['request'](_0x502966,_0x5a5c85)['then'](function(_0x49840e){logger[_0x54fe('0xb')](_0x54fe('0xc'),_0x5a2d65,'request\x20sent');logger[_0x54fe('0xd')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x5a2d65,'request\x20sent',JSON[_0x54fe('0xe')](_0x49840e));if(_0x49840e[_0x54fe('0xf')]){if(_0x49840e[_0x54fe('0xf')][_0x54fe('0x10')]===0x1f4){logger[_0x54fe('0xf')](_0x54fe('0xc'),_0x5a2d65,_0x49840e[_0x54fe('0xf')][_0x54fe('0x11')]);return _0x2accae(_0x49840e['error'][_0x54fe('0x11')]);}logger['error'](_0x54fe('0xc'),_0x5a2d65,_0x49840e[_0x54fe('0xf')]['message']);return _0x195c38(_0x49840e[_0x54fe('0xf')]['message']);}else{logger[_0x54fe('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5a2d65,_0x54fe('0x12'));_0x195c38(_0x49840e[_0x54fe('0x13')][_0x54fe('0x11')]);}})[_0x54fe('0x14')](function(_0x2a844c){logger['error'](_0x54fe('0xc'),_0x5a2d65,_0x2a844c);_0x2accae(_0x2a844c);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index d503997..bda27ed 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(_0x318e4c,_0x5b3136){var _0x3ef92d=function(_0x37b0b0){while(--_0x37b0b0){_0x318e4c['push'](_0x318e4c['shift']());}};_0x3ef92d(++_0x5b3136);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x261197,_0x192ff4){var _0x215d5d=function(_0x292f95){while(--_0x292f95){_0x261197['push'](_0x261197['shift']());}};_0x215d5d(++_0x192ff4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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 5ccb4d5..f5a0e61 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 _0x5106=['STRING','TEXT','sequelize'];(function(_0xfd800a,_0x31d879){var _0x2e2e5d=function(_0x1cc38d){while(--_0x1cc38d){_0xfd800a['push'](_0xfd800a['shift']());}};_0x2e2e5d(++_0x31d879);}(_0x5106,0x116));var _0x6510=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5106[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x6510('0x0'));module['exports']={'name':{'type':Sequelize[_0x6510('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x6510('0x1')]},'metric':{'type':Sequelize[_0x6510('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbfa6=['sequelize','exports','TEXT','STRING'];(function(_0x344af9,_0x585b64){var _0x3409eb=function(_0x4695c2){while(--_0x4695c2){_0x344af9['push'](_0x344af9['shift']());}};_0x3409eb(++_0x585b64);}(_0xbfa6,0x1d0));var _0x6bfa=function(_0x6bbc50,_0x26b8e9){_0x6bbc50=_0x6bbc50-0x0;var _0x5e8e93=_0xbfa6[_0x6bbc50];return _0x5e8e93;};'use strict';var Sequelize=require(_0x6bfa('0x0'));module[_0x6bfa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x6bfa('0x2')]},'description':{'type':Sequelize[_0x6bfa('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index e1bb516..c742890 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 _0x1cb9=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','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','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','params','keys','length','find','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0xdec228,_0x495d2f){_0xdec228=_0xdec228-0x0;var _0x207ec8=_0x1cb9[_0xdec228];return _0x207ec8;};'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'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){var _0x7ad361=_0x2447e7[_0x91cb('0x27')]({'plain':!![]});var _0x423c4f=_0x91cb('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x423c4f,'resourceId':_0x7ad361['id']}})[_0x91cb('0x25')](function(){return _0x2447e7;});})['then'](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x318031,_0x5595c5){return function(_0x9b26a6){if(!_0x9b26a6){_0x318031['sendStatus'](0x194);}return _0x9b26a6;};}function handleError(_0x4572f6,_0x308e8c){_0x308e8c=_0x308e8c||0x1f4;return function(_0x3b3ee6){logger[_0x91cb('0x29')](_0x3b3ee6[_0x91cb('0x2a')]);if(_0x3b3ee6['name']){delete _0x3b3ee6[_0x91cb('0x2b')];}_0x4572f6['status'](_0x308e8c)[_0x91cb('0x2c')](_0x3b3ee6);};}exports[_0x91cb('0x2d')]=function(_0x445fe1,_0x4944bd){var _0x775c25={},_0x146e1f={},_0x25bbf9={'count':0x0,'rows':[]};var _0x361e4c=_[_0x91cb('0x2e')](db[_0x91cb('0x2f')][_0x91cb('0x30')],function(_0x3bbde3){return{'name':_0x3bbde3[_0x91cb('0x31')],'type':_0x3bbde3['type'][_0x91cb('0x32')]};});_0x146e1f[_0x91cb('0x33')]=_[_0x91cb('0x2e')](_0x361e4c,_0x91cb('0x2b'));_0x146e1f[_0x91cb('0x34')]=_['keys'](_0x445fe1[_0x91cb('0x34')]);_0x146e1f[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x146e1f[_0x91cb('0x33')],_0x146e1f[_0x91cb('0x34')]);_0x775c25['attributes']=_[_0x91cb('0x36')](_0x146e1f['model'],qs['fields'](_0x445fe1['query'][_0x91cb('0x37')]));_0x775c25['attributes']=_0x775c25[_0x91cb('0x38')]['length']?_0x775c25['attributes']:_0x146e1f[_0x91cb('0x33')];if(!_0x445fe1[_0x91cb('0x34')][_0x91cb('0x39')](_0x91cb('0x3a'))){_0x775c25[_0x91cb('0x1d')]=qs['limit'](_0x445fe1[_0x91cb('0x34')][_0x91cb('0x1d')]);_0x775c25[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x445fe1['query']['offset']);}_0x775c25[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x445fe1['query'][_0x91cb('0x3c')]);_0x775c25[_0x91cb('0x3d')]=qs['filters'](_[_0x91cb('0x3e')](_0x445fe1[_0x91cb('0x34')],_0x146e1f['filters']),_0x361e4c);if(_0x445fe1[_0x91cb('0x34')]['filter']){_0x775c25[_0x91cb('0x3d')]=_[_0x91cb('0x3f')](_0x775c25[_0x91cb('0x3d')],{'$or':_[_0x91cb('0x2e')](_0x361e4c,function(_0x51d0ea){if(_0x51d0ea[_0x91cb('0x40')]!=='VIRTUAL'){var _0xa90111={};_0xa90111[_0x51d0ea[_0x91cb('0x2b')]]={'$like':'%'+_0x445fe1['query'][_0x91cb('0x41')]+'%'};return _0xa90111;}})});}_0x775c25=_['merge']({},_0x775c25,_0x445fe1[_0x91cb('0x42')]);var _0x2eac87={'where':_0x775c25[_0x91cb('0x3d')]};return db[_0x91cb('0x2f')]['count'](_0x2eac87)[_0x91cb('0x25')](function(_0x5af0e6){_0x25bbf9[_0x91cb('0x1e')]=_0x5af0e6;if(_0x445fe1[_0x91cb('0x34')][_0x91cb('0x43')]){_0x775c25[_0x91cb('0x44')]=[{'all':!![]}];}return db[_0x91cb('0x2f')][_0x91cb('0x45')](_0x775c25);})[_0x91cb('0x25')](function(_0x3cc4c1){_0x25bbf9['rows']=_0x3cc4c1;return _0x25bbf9;})[_0x91cb('0x25')](respondWithFilteredResult(_0x4944bd,_0x775c25))['catch'](handleError(_0x4944bd,null));};exports[_0x91cb('0x46')]=function(_0x5537a0,_0x335879){var _0x52e82c={'raw':!![],'where':{'id':_0x5537a0[_0x91cb('0x47')]['id']}},_0x138f48={};_0x138f48[_0x91cb('0x33')]=_[_0x91cb('0x48')](db['AnalyticMetric'][_0x91cb('0x30')]);_0x138f48[_0x91cb('0x34')]=_['keys'](_0x5537a0[_0x91cb('0x34')]);_0x138f48[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],_0x138f48[_0x91cb('0x34')]);_0x52e82c[_0x91cb('0x38')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],qs[_0x91cb('0x37')](_0x5537a0['query'][_0x91cb('0x37')]));_0x52e82c[_0x91cb('0x38')]=_0x52e82c[_0x91cb('0x38')][_0x91cb('0x49')]?_0x52e82c[_0x91cb('0x38')]:_0x138f48[_0x91cb('0x33')];if(_0x5537a0[_0x91cb('0x34')][_0x91cb('0x43')]){_0x52e82c['include']=[{'all':!![]}];}_0x52e82c=_[_0x91cb('0x3f')]({},_0x52e82c,_0x5537a0[_0x91cb('0x42')]);return db[_0x91cb('0x2f')][_0x91cb('0x4a')](_0x52e82c)['then'](handleEntityNotFound(_0x335879,null))[_0x91cb('0x25')](respondWithResult(_0x335879,null))[_0x91cb('0x4b')](handleError(_0x335879,null));};exports['create']=function(_0x212473,_0x47cdb7){return db[_0x91cb('0x2f')]['create'](_0x212473['body'],{})['then'](function(_0x98245b){var _0xff3d11=_0x212473[_0x91cb('0x4c')][_0x91cb('0x27')]({'plain':!![]});if(!_0xff3d11)throw new Error(_0x91cb('0x4d'));if(_0xff3d11['role']==='user'){var _0x1d26b8=_0x98245b[_0x91cb('0x27')]({'plain':!![]});var _0x140994=_0x91cb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x140994,'userProfileId':_0xff3d11['userProfileId']},'raw':!![]})[_0x91cb('0x25')](function(_0x490417){if(_0x490417&&_0x490417[_0x91cb('0x4e')]===0x0){return db['UserProfileResource'][_0x91cb('0x4f')]({'name':_0x1d26b8[_0x91cb('0x2b')],'resourceId':_0x1d26b8['id'],'type':_0x490417[_0x91cb('0x2b')],'sectionId':_0x490417['id']},{})[_0x91cb('0x25')](function(){return _0x98245b;});}else{return _0x98245b;}})[_0x91cb('0x4b')](function(_0x362532){logger[_0x91cb('0x29')](_0x91cb('0x50'),_0x362532);throw _0x362532;});}return _0x98245b;})[_0x91cb('0x25')](respondWithResult(_0x47cdb7,0xc9))[_0x91cb('0x4b')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x24')]=function(_0x5752ed,_0x1e445a){if(_0x5752ed[_0x91cb('0x51')]['id']){delete _0x5752ed['body']['id'];}return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x5752ed['params']['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x1e445a,null))[_0x91cb('0x25')](saveUpdates(_0x5752ed[_0x91cb('0x51')],null))[_0x91cb('0x25')](respondWithResult(_0x1e445a,null))[_0x91cb('0x4b')](handleError(_0x1e445a,null));};exports[_0x91cb('0x26')]=function(_0x1d4b96,_0x274fff){return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x1d4b96[_0x91cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x274fff,null))[_0x91cb('0x25')](removeEntity(_0x274fff,null))['catch'](handleError(_0x274fff,null));}; \ No newline at end of file +var _0xf2ca=['filter','merge','map','type','VIRTUAL','options','AnalyticMetric','count','includeAll','findAll','rows','catch','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','get','Metrics','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x36c5f9,_0x12724d){var _0x1962d6=function(_0x55ce5a){while(--_0x55ce5a){_0x36c5f9['push'](_0x36c5f9['shift']());}};_0x1962d6(++_0x12724d);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x4697fa,_0x21c841){_0x4697fa=_0x4697fa-0x0;var _0x390950=_0xf2ca[_0x4697fa];return _0x390950;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){var _0xf1a7cf=_0x99f78d[_0xaf2c('0x24')]({'plain':!![]});var _0x3c1ae6=_0xaf2c('0x25');return db[_0xaf2c('0x26')][_0xaf2c('0x27')]({'where':{'type':_0x3c1ae6,'resourceId':_0xf1a7cf['id']}})['then'](function(){return _0x99f78d;});})[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x410536,_0x4b7cf2){return function(_0x3fb190){if(!_0x3fb190){_0x410536['sendStatus'](0x194);}return _0x3fb190;};}function handleError(_0x38db1b,_0x42f980){_0x42f980=_0x42f980||0x1f4;return function(_0x15466b){logger['error'](_0x15466b[_0xaf2c('0x28')]);if(_0x15466b[_0xaf2c('0x29')]){delete _0x15466b[_0xaf2c('0x29')];}_0x38db1b['status'](_0x42f980)[_0xaf2c('0x2a')](_0x15466b);};}exports[_0xaf2c('0x2b')]=function(_0x42e2a5,_0x19364e){var _0x59d858={},_0x3da072={},_0x4072ff={'count':0x0,'rows':[]};var _0x1be1ef=_['map'](db['AnalyticMetric'][_0xaf2c('0x2c')],function(_0x4c9b4f){return{'name':_0x4c9b4f[_0xaf2c('0x2d')],'type':_0x4c9b4f['type'][_0xaf2c('0x2e')]};});_0x3da072[_0xaf2c('0x2f')]=_['map'](_0x1be1ef,_0xaf2c('0x29'));_0x3da072[_0xaf2c('0x30')]=_['keys'](_0x42e2a5[_0xaf2c('0x30')]);_0x3da072[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x3da072[_0xaf2c('0x2f')],_0x3da072[_0xaf2c('0x30')]);_0x59d858[_0xaf2c('0x33')]=_['intersection'](_0x3da072[_0xaf2c('0x2f')],qs['fields'](_0x42e2a5[_0xaf2c('0x30')]['fields']));_0x59d858[_0xaf2c('0x33')]=_0x59d858['attributes'][_0xaf2c('0x34')]?_0x59d858['attributes']:_0x3da072[_0xaf2c('0x2f')];if(!_0x42e2a5['query'][_0xaf2c('0x35')](_0xaf2c('0x36'))){_0x59d858[_0xaf2c('0x1e')]=qs[_0xaf2c('0x1e')](_0x42e2a5[_0xaf2c('0x30')]['limit']);_0x59d858['offset']=qs[_0xaf2c('0x1c')](_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x1c')]);}_0x59d858[_0xaf2c('0x37')]=qs[_0xaf2c('0x38')](_0x42e2a5[_0xaf2c('0x30')]['sort']);_0x59d858[_0xaf2c('0x39')]=qs[_0xaf2c('0x31')](_['pick'](_0x42e2a5[_0xaf2c('0x30')],_0x3da072[_0xaf2c('0x31')]),_0x1be1ef);if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x3a')]){_0x59d858[_0xaf2c('0x39')]=_[_0xaf2c('0x3b')](_0x59d858[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x3c')](_0x1be1ef,function(_0x296ca8){if(_0x296ca8[_0xaf2c('0x3d')]!==_0xaf2c('0x3e')){var _0x43f606={};_0x43f606[_0x296ca8[_0xaf2c('0x29')]]={'$like':'%'+_0x42e2a5['query']['filter']+'%'};return _0x43f606;}})});}_0x59d858=_['merge']({},_0x59d858,_0x42e2a5[_0xaf2c('0x3f')]);var _0x3cb075={'where':_0x59d858[_0xaf2c('0x39')]};return db[_0xaf2c('0x40')][_0xaf2c('0x41')](_0x3cb075)[_0xaf2c('0x23')](function(_0x51c441){_0x4072ff[_0xaf2c('0x41')]=_0x51c441;if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x42')]){_0x59d858['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xaf2c('0x43')](_0x59d858);})['then'](function(_0x181787){_0x4072ff[_0xaf2c('0x44')]=_0x181787;return _0x4072ff;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x19364e,_0x59d858))[_0xaf2c('0x45')](handleError(_0x19364e,null));};exports['show']=function(_0x2091eb,_0x532d5f){var _0x2056b8={'raw':!![],'where':{'id':_0x2091eb['params']['id']}},_0x8ebb65={};_0x8ebb65[_0xaf2c('0x2f')]=_['keys'](db[_0xaf2c('0x40')][_0xaf2c('0x2c')]);_0x8ebb65[_0xaf2c('0x30')]=_[_0xaf2c('0x46')](_0x2091eb[_0xaf2c('0x30')]);_0x8ebb65[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x8ebb65[_0xaf2c('0x2f')],_0x8ebb65[_0xaf2c('0x30')]);_0x2056b8['attributes']=_['intersection'](_0x8ebb65[_0xaf2c('0x2f')],qs['fields'](_0x2091eb['query']['fields']));_0x2056b8[_0xaf2c('0x33')]=_0x2056b8[_0xaf2c('0x33')][_0xaf2c('0x34')]?_0x2056b8[_0xaf2c('0x33')]:_0x8ebb65['model'];if(_0x2091eb[_0xaf2c('0x30')]['includeAll']){_0x2056b8[_0xaf2c('0x47')]=[{'all':!![]}];}_0x2056b8=_['merge']({},_0x2056b8,_0x2091eb[_0xaf2c('0x3f')]);return db[_0xaf2c('0x40')][_0xaf2c('0x48')](_0x2056b8)[_0xaf2c('0x23')](handleEntityNotFound(_0x532d5f,null))[_0xaf2c('0x23')](respondWithResult(_0x532d5f,null))['catch'](handleError(_0x532d5f,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){return db['AnalyticMetric'][_0xaf2c('0x49')](_0x26afee['body'],{})[_0xaf2c('0x23')](function(_0x23642b){var _0x17b9ec=_0x26afee[_0xaf2c('0x4a')][_0xaf2c('0x24')]({'plain':!![]});if(!_0x17b9ec)throw new Error(_0xaf2c('0x4b'));if(_0x17b9ec[_0xaf2c('0x4c')]===_0xaf2c('0x4a')){var _0x31ccfe=_0x23642b[_0xaf2c('0x24')]({'plain':!![]});var _0x371486='Metrics';return db[_0xaf2c('0x4d')][_0xaf2c('0x48')]({'where':{'name':_0x371486,'userProfileId':_0x17b9ec['userProfileId']},'raw':!![]})['then'](function(_0x56d7ce){if(_0x56d7ce&&_0x56d7ce[_0xaf2c('0x4e')]===0x0){return db[_0xaf2c('0x26')]['create']({'name':_0x31ccfe[_0xaf2c('0x29')],'resourceId':_0x31ccfe['id'],'type':_0x56d7ce[_0xaf2c('0x29')],'sectionId':_0x56d7ce['id']},{})[_0xaf2c('0x23')](function(){return _0x23642b;});}else{return _0x23642b;}})[_0xaf2c('0x45')](function(_0x265748){logger[_0xaf2c('0x4f')](_0xaf2c('0x50'),_0x265748);throw _0x265748;});}return _0x23642b;})['then'](respondWithResult(_0x4b3ca4,0xc9))[_0xaf2c('0x45')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x51')]=function(_0x5771e5,_0x245797){if(_0x5771e5[_0xaf2c('0x52')]['id']){delete _0x5771e5[_0xaf2c('0x52')]['id'];}return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x5771e5[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x245797,null))[_0xaf2c('0x23')](saveUpdates(_0x5771e5[_0xaf2c('0x52')],null))[_0xaf2c('0x23')](respondWithResult(_0x245797,null))[_0xaf2c('0x45')](handleError(_0x245797,null));};exports[_0xaf2c('0x27')]=function(_0x411e84,_0x2356a0){return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x411e84[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x2356a0,null))[_0xaf2c('0x23')](removeEntity(_0x2356a0,null))[_0xaf2c('0x45')](handleError(_0x2356a0,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index b113e16..4b4e4b4 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 _0x5162=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','AnalyticMetric','analytics_metrics','lodash'];(function(_0x56a04c,_0xdfd206){var _0x1c8adb=function(_0x107ede){while(--_0x107ede){_0x56a04c['push'](_0x56a04c['shift']());}};_0x1c8adb(++_0xdfd206);}(_0x5162,0x103));var _0x2516=function(_0x40e5e7,_0x5de9fb){_0x40e5e7=_0x40e5e7-0x0;var _0x305d7b=_0x5162[_0x40e5e7];return _0x305d7b;};'use strict';var _=require(_0x2516('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2516('0x1'));var rp=require(_0x2516('0x2'));var fs=require('fs');var path=require(_0x2516('0x3'));var rimraf=require(_0x2516('0x4'));var config=require(_0x2516('0x5'));var attributes=require(_0x2516('0x6'));module[_0x2516('0x7')]=function(_0x5b71b5,_0x48f411){return _0x5b71b5['define'](_0x2516('0x8'),attributes,{'tableName':_0x2516('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2070=['../../config/environment','./analyticMetric.attributes','AnalyticMetric','analytics_metrics','../../config/logger','api','moment','request-promise','path'];(function(_0x14984c,_0xcea18e){var _0x50656e=function(_0x3164e2){while(--_0x3164e2){_0x14984c['push'](_0x14984c['shift']());}};_0x50656e(++_0xcea18e);}(_0x2070,0x1a2));var _0x0207=function(_0x3935da,_0x5b0174){_0x3935da=_0x3935da-0x0;var _0x540bfb=_0x2070[_0x3935da];return _0x540bfb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0207('0x0'))(_0x0207('0x1'));var moment=require(_0x0207('0x2'));var BPromise=require('bluebird');var rp=require(_0x0207('0x3'));var fs=require('fs');var path=require(_0x0207('0x4'));var rimraf=require('rimraf');var config=require(_0x0207('0x5'));var attributes=require(_0x0207('0x6'));module['exports']=function(_0x5573e8,_0x5cf734){return _0x5573e8['define'](_0x0207('0x7'),attributes,{'tableName':_0x0207('0x8'),'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 caced7d..90afe1b 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 _0xc951=['AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x38254d,_0x19592c){var _0x5ba060=function(_0x51235b){while(--_0x51235b){_0x38254d['push'](_0x38254d['shift']());}};_0x5ba060(++_0x19592c);}(_0xc951,0x16a));var _0x1c95=function(_0xd68469,_0x484c14){_0xd68469=_0xd68469-0x0;var _0x40a9ec=_0xc951[_0xd68469];return _0x40a9ec;};'use strict';var _=require(_0x1c95('0x0'));var util=require(_0x1c95('0x1'));var moment=require(_0x1c95('0x2'));var BPromise=require(_0x1c95('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c95('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1c95('0x5'));var logger=require(_0x1c95('0x6'))(_0x1c95('0x7'));var config=require(_0x1c95('0x8'));var jayson=require(_0x1c95('0x9'));var client=jayson[_0x1c95('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17debe,_0x23fe7f,_0xcfeab0){return new BPromise(function(_0x43fd23,_0x4fe4bc){return client[_0x1c95('0xb')](_0x17debe,_0xcfeab0)[_0x1c95('0xc')](function(_0x2daa55){logger[_0x1c95('0xd')](_0x1c95('0xe'),_0x23fe7f,_0x1c95('0xf'));logger['debug'](_0x1c95('0x10'),_0x23fe7f,_0x1c95('0xf'),JSON['stringify'](_0x2daa55));if(_0x2daa55[_0x1c95('0x11')]){if(_0x2daa55[_0x1c95('0x11')][_0x1c95('0x12')]===0x1f4){logger[_0x1c95('0x11')](_0x1c95('0xe'),_0x23fe7f,_0x2daa55['error'][_0x1c95('0x13')]);return _0x4fe4bc(_0x2daa55['error'][_0x1c95('0x13')]);}logger[_0x1c95('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x23fe7f,_0x2daa55[_0x1c95('0x11')][_0x1c95('0x13')]);return _0x43fd23(_0x2daa55[_0x1c95('0x11')][_0x1c95('0x13')]);}else{logger[_0x1c95('0xd')]('AnalyticMetric,\x20%s,\x20%s',_0x23fe7f,_0x1c95('0xf'));_0x43fd23(_0x2daa55['result'][_0x1c95('0x13')]);}})[_0x1c95('0x14')](function(_0x4fd66c){logger[_0x1c95('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0x23fe7f,_0x4fd66c);_0x4fe4bc(_0x4fd66c);});});} \ No newline at end of file +var _0x20a7=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','error','AnalyticMetric,\x20%s,\x20%s','message','info','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x1e9be6,_0x4cee7d){var _0x17d777=function(_0x3245cb){while(--_0x3245cb){_0x1e9be6['push'](_0x1e9be6['shift']());}};_0x17d777(++_0x4cee7d);}(_0x20a7,0x136));var _0x720a=function(_0x8468aa,_0x3303bc){_0x8468aa=_0x8468aa-0x0;var _0x4e15b6=_0x20a7[_0x8468aa];return _0x4e15b6;};'use strict';var _=require(_0x720a('0x0'));var util=require(_0x720a('0x1'));var moment=require('moment');var BPromise=require(_0x720a('0x2'));var rs=require(_0x720a('0x3'));var fs=require('fs');var Redis=require(_0x720a('0x4'));var db=require(_0x720a('0x5'))['db'];var utils=require(_0x720a('0x6'));var logger=require(_0x720a('0x7'))(_0x720a('0x8'));var config=require(_0x720a('0x9'));var jayson=require(_0x720a('0xa'));var client=jayson[_0x720a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x317d23,_0x3c9890,_0xb37d19){return new BPromise(function(_0x4142c3,_0x5370f1){return client[_0x720a('0xc')](_0x317d23,_0xb37d19)['then'](function(_0x3ec02b){logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x3c9890,'request\x20sent');logger[_0x720a('0xd')](_0x720a('0xe'),_0x3c9890,_0x720a('0xf'),JSON['stringify'](_0x3ec02b));if(_0x3ec02b[_0x720a('0x10')]){if(_0x3ec02b['error']['code']===0x1f4){logger[_0x720a('0x10')](_0x720a('0x11'),_0x3c9890,_0x3ec02b[_0x720a('0x10')][_0x720a('0x12')]);return _0x5370f1(_0x3ec02b[_0x720a('0x10')][_0x720a('0x12')]);}logger[_0x720a('0x10')](_0x720a('0x11'),_0x3c9890,_0x3ec02b[_0x720a('0x10')][_0x720a('0x12')]);return _0x4142c3(_0x3ec02b[_0x720a('0x10')][_0x720a('0x12')]);}else{logger[_0x720a('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x3c9890,_0x720a('0xf'));_0x4142c3(_0x3ec02b['result'][_0x720a('0x12')]);}})[_0x720a('0x14')](function(_0x1818c6){logger[_0x720a('0x10')](_0x720a('0x11'),_0x3c9890,_0x1818c6);_0x5370f1(_0x1818c6);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 1a9a2a8..71e17f3 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 _0xaa48=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xaa48,0x15a));var _0x8aa4=function(_0x3308a9,_0x5a3634){_0x3308a9=_0x3308a9-0x0;var _0x43bb1c=_0xaa48[_0x3308a9];return _0x43bb1c;};'use strict';var multer=require(_0x8aa4('0x0'));var util=require(_0x8aa4('0x1'));var path=require(_0x8aa4('0x2'));var timeout=require(_0x8aa4('0x3'));var express=require(_0x8aa4('0x4'));var router=express[_0x8aa4('0x5')]();var fs_extra=require(_0x8aa4('0x6'));var auth=require(_0x8aa4('0x7'));var interaction=require(_0x8aa4('0x8'));var config=require(_0x8aa4('0x9'));var controller=require(_0x8aa4('0xa'));router[_0x8aa4('0xb')]('/',auth[_0x8aa4('0xc')](),controller[_0x8aa4('0xd')]);router[_0x8aa4('0xb')](_0x8aa4('0xe'),auth[_0x8aa4('0xc')](),controller[_0x8aa4('0xf')]);router[_0x8aa4('0x10')]('/',auth['isAuthenticated'](),controller[_0x8aa4('0x11')]);router[_0x8aa4('0x12')]('/:id',auth[_0x8aa4('0xc')](),controller[_0x8aa4('0x13')]);router['delete'](_0x8aa4('0xe'),auth[_0x8aa4('0xc')](),controller[_0x8aa4('0x14')]);module[_0x8aa4('0x15')]=router; \ No newline at end of file +var _0xeedf=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','/:id','update','delete','destroy','exports','multer','util','path','express'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0xeedf,0x12c));var _0xfeed=function(_0x3b8235,_0x481f77){_0x3b8235=_0x3b8235-0x0;var _0x2e8dbc=_0xeedf[_0x3b8235];return _0x2e8dbc;};'use strict';var multer=require(_0xfeed('0x0'));var util=require(_0xfeed('0x1'));var path=require(_0xfeed('0x2'));var timeout=require('connect-timeout');var express=require(_0xfeed('0x3'));var router=express['Router']();var fs_extra=require(_0xfeed('0x4'));var auth=require(_0xfeed('0x5'));var interaction=require(_0xfeed('0x6'));var config=require(_0xfeed('0x7'));var controller=require('./analyticMetric.controller');router[_0xfeed('0x8')]('/',auth[_0xfeed('0x9')](),controller['index']);router[_0xfeed('0x8')]('/:id',auth[_0xfeed('0x9')](),controller['show']);router[_0xfeed('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xfeed('0xb'),auth[_0xfeed('0x9')](),controller[_0xfeed('0xc')]);router[_0xfeed('0xd')]('/:id',auth[_0xfeed('0x9')](),controller[_0xfeed('0xe')]);module[_0xfeed('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 519d433..6923dd4 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 _0x0216=['exports','TEXT','sequelize'];(function(_0x2ae095,_0x2b9531){var _0x54fee4=function(_0x18e26b){while(--_0x18e26b){_0x2ae095['push'](_0x2ae095['shift']());}};_0x54fee4(++_0x2b9531);}(_0x0216,0x1c4));var _0x6021=function(_0x594f3b,_0x3fe00d){_0x594f3b=_0x594f3b-0x0;var _0x28c2fc=_0x0216[_0x594f3b];return _0x28c2fc;};'use strict';var Sequelize=require(_0x6021('0x0'));module[_0x6021('0x1')]={'tree':{'type':Sequelize[_0x6021('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xca4a=['TEXT','sequelize'];(function(_0x27817b,_0x2f7e80){var _0x11692c=function(_0x30798c){while(--_0x30798c){_0x27817b['push'](_0x27817b['shift']());}};_0x11692c(++_0x2f7e80);}(_0xca4a,0x1cb));var _0xaca4=function(_0xbf5545,_0x2eef97){_0xbf5545=_0xbf5545-0x0;var _0x3e94ce=_0xca4a[_0xbf5545];return _0x3e94ce;};'use strict';var Sequelize=require(_0xaca4('0x0'));module['exports']={'tree':{'type':Sequelize[_0xaca4('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 b29ccfc..1f1fbe8 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 _0xf918=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','create','body','update','destroy','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xf918,0x119));var _0x8f91=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0xf918[_0x31e5cb];return _0x4170df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f91('0x0'));var zipdir=require(_0x8f91('0x1'));var jsonpatch=require(_0x8f91('0x2'));var rp=require(_0x8f91('0x3'));var moment=require(_0x8f91('0x4'));var BPromise=require(_0x8f91('0x5'));var Mustache=require(_0x8f91('0x6'));var util=require(_0x8f91('0x7'));var path=require('path');var sox=require(_0x8f91('0x8'));var csv=require(_0x8f91('0x9'));var ejs=require(_0x8f91('0xa'));var fs=require('fs');var fs_extra=require(_0x8f91('0xb'));var _=require(_0x8f91('0xc'));var squel=require(_0x8f91('0xd'));var crypto=require(_0x8f91('0xe'));var jsforce=require(_0x8f91('0xf'));var deskjs=require(_0x8f91('0x10'));var toCsv=require(_0x8f91('0x9'));var querystring=require(_0x8f91('0x11'));var Papa=require(_0x8f91('0x12'));var Redis=require(_0x8f91('0x13'));var authService=require(_0x8f91('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x8f91('0x15'));var hardwareService=require(_0x8f91('0x16'));var logger=require('../../config/logger')(_0x8f91('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8f91('0x18'));var db=require(_0x8f91('0x19'))['db'];function respondWithStatusCode(_0x516484,_0x26b037){_0x26b037=_0x26b037||0xcc;return function(_0x2df993){if(_0x2df993){return _0x516484[_0x8f91('0x1a')](_0x26b037);}return _0x516484[_0x8f91('0x1b')](_0x26b037)[_0x8f91('0x1c')]();};}function respondWithResult(_0x538ffd,_0x20a5c0){_0x20a5c0=_0x20a5c0||0xc8;return function(_0x5252e4){if(_0x5252e4){return _0x538ffd[_0x8f91('0x1b')](_0x20a5c0)[_0x8f91('0x1d')](_0x5252e4);}};}function respondWithFilteredResult(_0x95d58f,_0x183a4c){return function(_0x33b681){if(_0x33b681){var _0x1aea15=typeof _0x183a4c[_0x8f91('0x1e')]===_0x8f91('0x1f')&&typeof _0x183a4c[_0x8f91('0x20')]===_0x8f91('0x1f');var _0x5ae1c5=_0x33b681['count'];var _0x54a8a1=_0x1aea15?0x0:_0x183a4c[_0x8f91('0x1e')];var _0x1084ce=_0x1aea15?_0x33b681[_0x8f91('0x21')]:_0x183a4c[_0x8f91('0x1e')]+_0x183a4c[_0x8f91('0x20')];var _0x5490af;if(_0x1084ce>=_0x5ae1c5){_0x1084ce=_0x5ae1c5;_0x5490af=0xc8;}else{_0x5490af=0xce;}_0x95d58f['status'](_0x5490af);return _0x95d58f[_0x8f91('0x22')](_0x8f91('0x23'),_0x54a8a1+'-'+_0x1084ce+'/'+_0x5ae1c5)[_0x8f91('0x1d')](_0x33b681);}return null;};}function patchUpdates(_0x1cd27b){return function(_0x44defe){try{jsonpatch[_0x8f91('0x24')](_0x44defe,_0x1cd27b,!![]);}catch(_0x2f57bc){return BPromise[_0x8f91('0x25')](_0x2f57bc);}return _0x44defe['save']();};}function saveUpdates(_0x3b8583,_0x3a2d48){return function(_0x33563b){if(_0x33563b){return _0x33563b['update'](_0x3b8583)['then'](function(_0x1383f2){return _0x1383f2;});}return null;};}function removeEntity(_0x269c74,_0x93d39){return function(_0x21a368){if(_0x21a368){return _0x21a368['destroy']()[_0x8f91('0x26')](function(){_0x269c74['status'](0xcc)[_0x8f91('0x1c')]();});}};}function handleEntityNotFound(_0x35a0ca,_0x369640){return function(_0xc124ee){if(!_0xc124ee){_0x35a0ca['sendStatus'](0x194);}return _0xc124ee;};}function handleError(_0xa40ce5,_0x419410){_0x419410=_0x419410||0x1f4;return function(_0x273574){logger['error'](_0x273574[_0x8f91('0x27')]);if(_0x273574[_0x8f91('0x28')]){delete _0x273574['name'];}_0xa40ce5[_0x8f91('0x1b')](_0x419410)['send'](_0x273574);};}exports[_0x8f91('0x29')]=function(_0xbcd02f,_0x3d7c2c){var _0x196a5f={},_0x564ddb={},_0x1b9886={'count':0x0,'rows':[]};var _0x2770f8=_[_0x8f91('0x2a')](db[_0x8f91('0x2b')][_0x8f91('0x2c')],function(_0x3f15c4){return{'name':_0x3f15c4[_0x8f91('0x2d')],'type':_0x3f15c4[_0x8f91('0x2e')][_0x8f91('0x2f')]};});_0x564ddb['model']=_[_0x8f91('0x2a')](_0x2770f8,_0x8f91('0x28'));_0x564ddb[_0x8f91('0x30')]=_[_0x8f91('0x31')](_0xbcd02f[_0x8f91('0x30')]);_0x564ddb[_0x8f91('0x32')]=_[_0x8f91('0x33')](_0x564ddb[_0x8f91('0x34')],_0x564ddb[_0x8f91('0x30')]);_0x196a5f['attributes']=_[_0x8f91('0x33')](_0x564ddb['model'],qs['fields'](_0xbcd02f[_0x8f91('0x30')][_0x8f91('0x35')]));_0x196a5f['attributes']=_0x196a5f['attributes'][_0x8f91('0x36')]?_0x196a5f[_0x8f91('0x37')]:_0x564ddb[_0x8f91('0x34')];if(!_0xbcd02f[_0x8f91('0x30')][_0x8f91('0x38')](_0x8f91('0x39'))){_0x196a5f['limit']=qs[_0x8f91('0x20')](_0xbcd02f[_0x8f91('0x30')][_0x8f91('0x20')]);_0x196a5f[_0x8f91('0x1e')]=qs['offset'](_0xbcd02f[_0x8f91('0x30')][_0x8f91('0x1e')]);}_0x196a5f[_0x8f91('0x3a')]=qs[_0x8f91('0x3b')](_0xbcd02f[_0x8f91('0x30')][_0x8f91('0x3b')]);_0x196a5f[_0x8f91('0x3c')]=qs[_0x8f91('0x32')](_[_0x8f91('0x3d')](_0xbcd02f[_0x8f91('0x30')],_0x564ddb[_0x8f91('0x32')]),_0x2770f8);if(_0xbcd02f[_0x8f91('0x30')][_0x8f91('0x3e')]){_0x196a5f[_0x8f91('0x3c')]=_[_0x8f91('0x3f')](_0x196a5f[_0x8f91('0x3c')],{'$or':_['map'](_0x2770f8,function(_0x16a923){if(_0x16a923[_0x8f91('0x2e')]!==_0x8f91('0x40')){var _0x2eabc4={};_0x2eabc4[_0x16a923[_0x8f91('0x28')]]={'$like':'%'+_0xbcd02f[_0x8f91('0x30')][_0x8f91('0x3e')]+'%'};return _0x2eabc4;}})});}_0x196a5f=_[_0x8f91('0x3f')]({},_0x196a5f,_0xbcd02f['options']);var _0x587d83={'where':_0x196a5f['where']};return db[_0x8f91('0x2b')]['count'](_0x587d83)[_0x8f91('0x26')](function(_0x362715){_0x1b9886[_0x8f91('0x21')]=_0x362715;if(_0xbcd02f['query'][_0x8f91('0x41')]){_0x196a5f['include']=[{'all':!![]}];}return db[_0x8f91('0x2b')][_0x8f91('0x42')](_0x196a5f);})[_0x8f91('0x26')](function(_0x46cff6){_0x1b9886[_0x8f91('0x43')]=_0x46cff6;return _0x1b9886;})[_0x8f91('0x26')](respondWithFilteredResult(_0x3d7c2c,_0x196a5f))[_0x8f91('0x44')](handleError(_0x3d7c2c,null));};exports[_0x8f91('0x45')]=function(_0x52af07,_0x53322a){var _0x3f35e3={'raw':!![],'where':{'id':_0x52af07[_0x8f91('0x46')]['id']}},_0x2dedbc={};_0x2dedbc[_0x8f91('0x34')]=_[_0x8f91('0x31')](db['AnalyticTreeReport'][_0x8f91('0x2c')]);_0x2dedbc['query']=_[_0x8f91('0x31')](_0x52af07[_0x8f91('0x30')]);_0x2dedbc[_0x8f91('0x32')]=_[_0x8f91('0x33')](_0x2dedbc['model'],_0x2dedbc[_0x8f91('0x30')]);_0x3f35e3['attributes']=_[_0x8f91('0x33')](_0x2dedbc[_0x8f91('0x34')],qs[_0x8f91('0x35')](_0x52af07[_0x8f91('0x30')][_0x8f91('0x35')]));_0x3f35e3[_0x8f91('0x37')]=_0x3f35e3[_0x8f91('0x37')][_0x8f91('0x36')]?_0x3f35e3[_0x8f91('0x37')]:_0x2dedbc[_0x8f91('0x34')];if(_0x52af07[_0x8f91('0x30')][_0x8f91('0x41')]){_0x3f35e3[_0x8f91('0x47')]=[{'all':!![]}];}_0x3f35e3=_[_0x8f91('0x3f')]({},_0x3f35e3,_0x52af07['options']);return db[_0x8f91('0x2b')]['find'](_0x3f35e3)['then'](handleEntityNotFound(_0x53322a,null))['then'](respondWithResult(_0x53322a,null))[_0x8f91('0x44')](handleError(_0x53322a,null));};exports['create']=function(_0x3992bd,_0x4d9eda){return db[_0x8f91('0x2b')][_0x8f91('0x48')](_0x3992bd[_0x8f91('0x49')],{})[_0x8f91('0x26')](respondWithResult(_0x4d9eda,0xc9))['catch'](handleError(_0x4d9eda,null));};exports[_0x8f91('0x4a')]=function(_0x2af80e,_0x1135e9){if(_0x2af80e[_0x8f91('0x49')]['id']){delete _0x2af80e[_0x8f91('0x49')]['id'];}return db[_0x8f91('0x2b')]['find']({'where':{'id':_0x2af80e['params']['id']}})['then'](handleEntityNotFound(_0x1135e9,null))[_0x8f91('0x26')](saveUpdates(_0x2af80e[_0x8f91('0x49')],null))[_0x8f91('0x26')](respondWithResult(_0x1135e9,null))['catch'](handleError(_0x1135e9,null));};exports[_0x8f91('0x4b')]=function(_0x43a8b2,_0x3abafd){return db[_0x8f91('0x2b')][_0x8f91('0x4c')]({'where':{'id':_0x43a8b2[_0x8f91('0x46')]['id']}})['then'](handleEntityNotFound(_0x3abafd,null))['then'](removeEntity(_0x3abafd,null))[_0x8f91('0x44')](handleError(_0x3abafd,null));}; \ No newline at end of file +var _0x3be1=['map','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','AnalyticTreeReport','findAll','show','find','create','body','params','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','end','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x3be1,0x1ec));var _0x13be=function(_0x2bed02,_0x4ff3b5){_0x2bed02=_0x2bed02-0x0;var _0x4ec29f=_0x3be1[_0x2bed02];return _0x4ec29f;};'use strict';var emlformat=require(_0x13be('0x0'));var rimraf=require(_0x13be('0x1'));var zipdir=require(_0x13be('0x2'));var jsonpatch=require(_0x13be('0x3'));var rp=require(_0x13be('0x4'));var moment=require(_0x13be('0x5'));var BPromise=require(_0x13be('0x6'));var Mustache=require(_0x13be('0x7'));var util=require(_0x13be('0x8'));var path=require('path');var sox=require(_0x13be('0x9'));var csv=require(_0x13be('0xa'));var ejs=require(_0x13be('0xb'));var fs=require('fs');var fs_extra=require(_0x13be('0xc'));var _=require('lodash');var squel=require(_0x13be('0xd'));var crypto=require(_0x13be('0xe'));var jsforce=require(_0x13be('0xf'));var deskjs=require(_0x13be('0x10'));var toCsv=require(_0x13be('0xa'));var querystring=require(_0x13be('0x11'));var Papa=require('papaparse');var Redis=require(_0x13be('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x13be('0x13'));var logger=require(_0x13be('0x14'))('api');var utils=require(_0x13be('0x15'));var config=require(_0x13be('0x16'));var licenseUtil=require(_0x13be('0x17'));var db=require(_0x13be('0x18'))['db'];function respondWithStatusCode(_0x3de531,_0x1996c6){_0x1996c6=_0x1996c6||0xcc;return function(_0x53819b){if(_0x53819b){return _0x3de531['sendStatus'](_0x1996c6);}return _0x3de531[_0x13be('0x19')](_0x1996c6)['end']();};}function respondWithResult(_0x335c61,_0xc27516){_0xc27516=_0xc27516||0xc8;return function(_0x20da7b){if(_0x20da7b){return _0x335c61[_0x13be('0x19')](_0xc27516)['json'](_0x20da7b);}};}function respondWithFilteredResult(_0x860b10,_0x270f5c){return function(_0x56e087){if(_0x56e087){var _0x69ad10=typeof _0x270f5c[_0x13be('0x1a')]===_0x13be('0x1b')&&typeof _0x270f5c[_0x13be('0x1c')]===_0x13be('0x1b');var _0x6ca761=_0x56e087['count'];var _0x274849=_0x69ad10?0x0:_0x270f5c[_0x13be('0x1a')];var _0x7a72d4=_0x69ad10?_0x56e087[_0x13be('0x1d')]:_0x270f5c[_0x13be('0x1a')]+_0x270f5c[_0x13be('0x1c')];var _0x4e160b;if(_0x7a72d4>=_0x6ca761){_0x7a72d4=_0x6ca761;_0x4e160b=0xc8;}else{_0x4e160b=0xce;}_0x860b10['status'](_0x4e160b);return _0x860b10[_0x13be('0x1e')]('Content-Range',_0x274849+'-'+_0x7a72d4+'/'+_0x6ca761)[_0x13be('0x1f')](_0x56e087);}return null;};}function patchUpdates(_0x18c60e){return function(_0x4027f0){try{jsonpatch[_0x13be('0x20')](_0x4027f0,_0x18c60e,!![]);}catch(_0x24ec10){return BPromise[_0x13be('0x21')](_0x24ec10);}return _0x4027f0[_0x13be('0x22')]();};}function saveUpdates(_0x1a9375,_0x51118a){return function(_0x495e57){if(_0x495e57){return _0x495e57[_0x13be('0x23')](_0x1a9375)[_0x13be('0x24')](function(_0x25be50){return _0x25be50;});}return null;};}function removeEntity(_0x1209a6,_0x43bed3){return function(_0x36f2cb){if(_0x36f2cb){return _0x36f2cb['destroy']()[_0x13be('0x24')](function(){_0x1209a6['status'](0xcc)[_0x13be('0x25')]();});}};}function handleEntityNotFound(_0x1f64d5,_0x13ccba){return function(_0x3e8747){if(!_0x3e8747){_0x1f64d5[_0x13be('0x26')](0x194);}return _0x3e8747;};}function handleError(_0x52162d,_0x230200){_0x230200=_0x230200||0x1f4;return function(_0x4e6381){logger['error'](_0x4e6381[_0x13be('0x27')]);if(_0x4e6381[_0x13be('0x28')]){delete _0x4e6381['name'];}_0x52162d[_0x13be('0x19')](_0x230200)[_0x13be('0x29')](_0x4e6381);};}exports[_0x13be('0x2a')]=function(_0x18ac07,_0x5591a5){var _0x6dd257={},_0x4c84da={},_0x4f2d63={'count':0x0,'rows':[]};var _0x385f11=_['map'](db['AnalyticTreeReport'][_0x13be('0x2b')],function(_0x2d66ad){return{'name':_0x2d66ad[_0x13be('0x2c')],'type':_0x2d66ad[_0x13be('0x2d')][_0x13be('0x2e')]};});_0x4c84da['model']=_[_0x13be('0x2f')](_0x385f11,'name');_0x4c84da['query']=_[_0x13be('0x30')](_0x18ac07[_0x13be('0x31')]);_0x4c84da['filters']=_[_0x13be('0x32')](_0x4c84da[_0x13be('0x33')],_0x4c84da[_0x13be('0x31')]);_0x6dd257[_0x13be('0x34')]=_[_0x13be('0x32')](_0x4c84da['model'],qs[_0x13be('0x35')](_0x18ac07[_0x13be('0x31')][_0x13be('0x35')]));_0x6dd257[_0x13be('0x34')]=_0x6dd257[_0x13be('0x34')][_0x13be('0x36')]?_0x6dd257[_0x13be('0x34')]:_0x4c84da[_0x13be('0x33')];if(!_0x18ac07[_0x13be('0x31')][_0x13be('0x37')](_0x13be('0x38'))){_0x6dd257[_0x13be('0x1c')]=qs['limit'](_0x18ac07[_0x13be('0x31')][_0x13be('0x1c')]);_0x6dd257[_0x13be('0x1a')]=qs['offset'](_0x18ac07[_0x13be('0x31')][_0x13be('0x1a')]);}_0x6dd257[_0x13be('0x39')]=qs[_0x13be('0x3a')](_0x18ac07[_0x13be('0x31')][_0x13be('0x3a')]);_0x6dd257[_0x13be('0x3b')]=qs[_0x13be('0x3c')](_[_0x13be('0x3d')](_0x18ac07[_0x13be('0x31')],_0x4c84da[_0x13be('0x3c')]),_0x385f11);if(_0x18ac07[_0x13be('0x31')][_0x13be('0x3e')]){_0x6dd257[_0x13be('0x3b')]=_['merge'](_0x6dd257[_0x13be('0x3b')],{'$or':_[_0x13be('0x2f')](_0x385f11,function(_0x186514){if(_0x186514['type']!==_0x13be('0x3f')){var _0x5919b3={};_0x5919b3[_0x186514[_0x13be('0x28')]]={'$like':'%'+_0x18ac07[_0x13be('0x31')][_0x13be('0x3e')]+'%'};return _0x5919b3;}})});}_0x6dd257=_[_0x13be('0x40')]({},_0x6dd257,_0x18ac07[_0x13be('0x41')]);var _0x113dd6={'where':_0x6dd257[_0x13be('0x3b')]};return db['AnalyticTreeReport']['count'](_0x113dd6)[_0x13be('0x24')](function(_0x22b970){_0x4f2d63[_0x13be('0x1d')]=_0x22b970;if(_0x18ac07[_0x13be('0x31')][_0x13be('0x42')]){_0x6dd257[_0x13be('0x43')]=[{'all':!![]}];}return db[_0x13be('0x44')][_0x13be('0x45')](_0x6dd257);})['then'](function(_0x5afa1d){_0x4f2d63['rows']=_0x5afa1d;return _0x4f2d63;})[_0x13be('0x24')](respondWithFilteredResult(_0x5591a5,_0x6dd257))['catch'](handleError(_0x5591a5,null));};exports[_0x13be('0x46')]=function(_0x594973,_0x4f31e0){var _0x29ad5b={'raw':!![],'where':{'id':_0x594973['params']['id']}},_0x1c239a={};_0x1c239a[_0x13be('0x33')]=_[_0x13be('0x30')](db[_0x13be('0x44')]['rawAttributes']);_0x1c239a[_0x13be('0x31')]=_['keys'](_0x594973[_0x13be('0x31')]);_0x1c239a[_0x13be('0x3c')]=_[_0x13be('0x32')](_0x1c239a['model'],_0x1c239a[_0x13be('0x31')]);_0x29ad5b[_0x13be('0x34')]=_['intersection'](_0x1c239a['model'],qs[_0x13be('0x35')](_0x594973[_0x13be('0x31')][_0x13be('0x35')]));_0x29ad5b[_0x13be('0x34')]=_0x29ad5b[_0x13be('0x34')][_0x13be('0x36')]?_0x29ad5b[_0x13be('0x34')]:_0x1c239a[_0x13be('0x33')];if(_0x594973[_0x13be('0x31')][_0x13be('0x42')]){_0x29ad5b[_0x13be('0x43')]=[{'all':!![]}];}_0x29ad5b=_[_0x13be('0x40')]({},_0x29ad5b,_0x594973['options']);return db[_0x13be('0x44')][_0x13be('0x47')](_0x29ad5b)[_0x13be('0x24')](handleEntityNotFound(_0x4f31e0,null))['then'](respondWithResult(_0x4f31e0,null))['catch'](handleError(_0x4f31e0,null));};exports[_0x13be('0x48')]=function(_0x1c38fd,_0x339926){return db[_0x13be('0x44')][_0x13be('0x48')](_0x1c38fd[_0x13be('0x49')],{})[_0x13be('0x24')](respondWithResult(_0x339926,0xc9))['catch'](handleError(_0x339926,null));};exports['update']=function(_0x506615,_0x1b47df){if(_0x506615[_0x13be('0x49')]['id']){delete _0x506615[_0x13be('0x49')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x506615[_0x13be('0x4a')]['id']}})[_0x13be('0x24')](handleEntityNotFound(_0x1b47df,null))[_0x13be('0x24')](saveUpdates(_0x506615[_0x13be('0x49')],null))['then'](respondWithResult(_0x1b47df,null))[_0x13be('0x4b')](handleError(_0x1b47df,null));};exports[_0x13be('0x4c')]=function(_0x3b8fee,_0x2d90db){return db[_0x13be('0x44')]['find']({'where':{'id':_0x3b8fee[_0x13be('0x4a')]['id']}})[_0x13be('0x24')](handleEntityNotFound(_0x2d90db,null))[_0x13be('0x24')](removeEntity(_0x2d90db,null))[_0x13be('0x4b')](handleError(_0x2d90db,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 6bbe673..0711d7a 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 _0x1389=['moment','bluebird','request-promise','path','rimraf','exports','define','analytics_report_trees','lodash','util','api'];(function(_0x365e54,_0x44be74){var _0x13317a=function(_0x2d917f){while(--_0x2d917f){_0x365e54['push'](_0x365e54['shift']());}};_0x13317a(++_0x44be74);}(_0x1389,0x15d));var _0x9138=function(_0x5f4f70,_0x2d43da){_0x5f4f70=_0x5f4f70-0x0;var _0x41eb21=_0x1389[_0x5f4f70];return _0x41eb21;};'use strict';var _=require(_0x9138('0x0'));var util=require(_0x9138('0x1'));var logger=require('../../config/logger')(_0x9138('0x2'));var moment=require(_0x9138('0x3'));var BPromise=require(_0x9138('0x4'));var rp=require(_0x9138('0x5'));var fs=require('fs');var path=require(_0x9138('0x6'));var rimraf=require(_0x9138('0x7'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0x9138('0x8')]=function(_0x523b17,_0xfc4b7b){return _0x523b17[_0x9138('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0x9138('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x031d=['request-promise','rimraf','../../config/environment','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','moment','bluebird'];(function(_0x22052d,_0x3dd47b){var _0x2eee04=function(_0x15a86a){while(--_0x15a86a){_0x22052d['push'](_0x22052d['shift']());}};_0x2eee04(++_0x3dd47b);}(_0x031d,0x7f));var _0xd031=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0x031d[_0x349148];return _0x2f2b0f;};'use strict';var _=require(_0xd031('0x0'));var util=require('util');var logger=require(_0xd031('0x1'))(_0xd031('0x2'));var moment=require(_0xd031('0x3'));var BPromise=require(_0xd031('0x4'));var rp=require(_0xd031('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd031('0x6'));var config=require(_0xd031('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0xd031('0x8')]=function(_0x24b9fc,_0x311f3a){return _0x24b9fc[_0xd031('0x9')](_0xd031('0xa'),attributes,{'tableName':_0xd031('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 933a739..ccb89ec 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x29d68f,_0x59da10){var _0x262d38=function(_0xfd78b6){while(--_0xfd78b6){_0x29d68f['push'](_0x29d68f['shift']());}};_0x262d38(++_0x59da10);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3ef502,_0x1bdce1){_0x3ef502=_0x3ef502-0x0;var _0x2aed15=_0x5f2f[_0x3ef502];return _0x2aed15;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x3e9f1b,_0x2d060){var _0x20f0c2=function(_0x4649b0){while(--_0x4649b0){_0x3e9f1b['push'](_0x3e9f1b['shift']());}};_0x20f0c2(++_0x2d060);}(_0xdb28,0x106));var _0x8db2=function(_0x42059d,_0x3a7ad9){_0x42059d=_0x42059d-0x0;var _0x3b6e13=_0xdb28[_0x42059d];return _0x3b6e13;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 362c7ec..85bc528 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 _0x9e5e=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','show','post','create','put','update','delete','destroy'];(function(_0x33080e,_0x1c600a){var _0x407395=function(_0x5b62fd){while(--_0x5b62fd){_0x33080e['push'](_0x33080e['shift']());}};_0x407395(++_0x1c600a);}(_0x9e5e,0x1f4));var _0xe9e5=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x9e5e[_0x59d89e];return _0x554e93;};'use strict';var multer=require(_0xe9e5('0x0'));var util=require(_0xe9e5('0x1'));var path=require(_0xe9e5('0x2'));var timeout=require(_0xe9e5('0x3'));var express=require(_0xe9e5('0x4'));var router=express[_0xe9e5('0x5')]();var fs_extra=require(_0xe9e5('0x6'));var auth=require(_0xe9e5('0x7'));var interaction=require(_0xe9e5('0x8'));var config=require('../../config/environment');var controller=require(_0xe9e5('0x9'));router[_0xe9e5('0xa')]('/',auth[_0xe9e5('0xb')](),controller[_0xe9e5('0xc')]);router['get']('/:id',auth[_0xe9e5('0xb')](),controller[_0xe9e5('0xd')]);router[_0xe9e5('0xe')]('/',auth['isAuthenticated'](),controller[_0xe9e5('0xf')]);router[_0xe9e5('0x10')]('/:id',auth[_0xe9e5('0xb')](),controller[_0xe9e5('0x11')]);router[_0xe9e5('0x12')]('/:id',auth[_0xe9e5('0xb')](),controller[_0xe9e5('0x13')]);module['exports']=router; \ No newline at end of file +var _0x152f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','show','post','create','put','destroy','exports','multer','util','path','express'];(function(_0x184747,_0x18425e){var _0x36277d=function(_0x54b207){while(--_0x54b207){_0x184747['push'](_0x184747['shift']());}};_0x36277d(++_0x18425e);}(_0x152f,0x13f));var _0xf152=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x152f[_0x1eda20];return _0x31b953;};'use strict';var multer=require(_0xf152('0x0'));var util=require(_0xf152('0x1'));var path=require(_0xf152('0x2'));var timeout=require('connect-timeout');var express=require(_0xf152('0x3'));var router=express[_0xf152('0x4')]();var fs_extra=require(_0xf152('0x5'));var auth=require(_0xf152('0x6'));var interaction=require(_0xf152('0x7'));var config=require(_0xf152('0x8'));var controller=require(_0xf152('0x9'));router[_0xf152('0xa')]('/',auth[_0xf152('0xb')](),controller['index']);router['get'](_0xf152('0xc'),auth['isAuthenticated'](),controller[_0xf152('0xd')]);router[_0xf152('0xe')]('/',auth[_0xf152('0xb')](),controller[_0xf152('0xf')]);router[_0xf152('0x10')](_0xf152('0xc'),auth[_0xf152('0xb')](),controller['update']);router['delete'](_0xf152('0xc'),auth[_0xf152('0xb')](),controller[_0xf152('0x11')]);module[_0xf152('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 1373fb3..e08cf87 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 _0x90ae=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x90ae,0x195));var _0xe90a=function(_0x45fe84,_0x35f6cf){_0x45fe84=_0x45fe84-0x0;var _0x333f98=_0x90ae[_0x45fe84];return _0x333f98;};'use strict';var Sequelize=require(_0xe90a('0x0'));module[_0xe90a('0x1')]={'name':{'type':Sequelize[_0xe90a('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe90a('0x2')]}}; \ No newline at end of file +var _0x01d3=['STRING'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0x01d3,0xdb));var _0x301d=function(_0x2f2ea6,_0x1b3c35){_0x2f2ea6=_0x2f2ea6-0x0;var _0xc8ec68=_0x01d3[_0x2f2ea6];return _0xc8ec68;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x301d('0x0')]},'basename':{'type':Sequelize[_0x301d('0x0')]},'type':{'type':Sequelize[_0x301d('0x0')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 9192c36..3698093 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 _0xbdb2=['filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','limit','count','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','Attachment','includeAll','include','findAll','rows','show','params','keys','rawAttributes','options','find','catch','clone','get','omit','createdAt','body','updatedAt','create','file','originalname','basename'];(function(_0x4694c3,_0x296f2d){var _0x2ef3c1=function(_0x54cadb){while(--_0x54cadb){_0x4694c3['push'](_0x4694c3['shift']());}};_0x2ef3c1(++_0x296f2d);}(_0xbdb2,0x11d));var _0x2bdb=function(_0x105d3a,_0x3fd40b){_0x105d3a=_0x105d3a-0x0;var _0x2bd5df=_0xbdb2[_0x105d3a];return _0x2bd5df;};'use strict';var emlformat=require(_0x2bdb('0x0'));var rimraf=require(_0x2bdb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2bdb('0x2'));var rp=require(_0x2bdb('0x3'));var moment=require(_0x2bdb('0x4'));var BPromise=require(_0x2bdb('0x5'));var Mustache=require(_0x2bdb('0x6'));var util=require(_0x2bdb('0x7'));var path=require(_0x2bdb('0x8'));var sox=require('sox');var csv=require(_0x2bdb('0x9'));var ejs=require(_0x2bdb('0xa'));var fs=require('fs');var fs_extra=require(_0x2bdb('0xb'));var _=require(_0x2bdb('0xc'));var squel=require('squel');var crypto=require(_0x2bdb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2bdb('0xe'));var toCsv=require(_0x2bdb('0x9'));var querystring=require(_0x2bdb('0xf'));var Papa=require(_0x2bdb('0x10'));var Redis=require(_0x2bdb('0x11'));var authService=require(_0x2bdb('0x12'));var qs=require(_0x2bdb('0x13'));var as=require(_0x2bdb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2bdb('0x15'))(_0x2bdb('0x16'));var utils=require(_0x2bdb('0x17'));var config=require(_0x2bdb('0x18'));var licenseUtil=require(_0x2bdb('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x456735,_0x7fb652){_0x7fb652=_0x7fb652||0xcc;return function(_0x59fab6){if(_0x59fab6){return _0x456735['sendStatus'](_0x7fb652);}return _0x456735['status'](_0x7fb652)[_0x2bdb('0x1a')]();};}function respondWithResult(_0x42bd62,_0x2aa5fc){_0x2aa5fc=_0x2aa5fc||0xc8;return function(_0x2b6238){if(_0x2b6238){return _0x42bd62[_0x2bdb('0x1b')](_0x2aa5fc)[_0x2bdb('0x1c')](_0x2b6238);}};}function respondWithFilteredResult(_0xcef8bc,_0x1bdd48){return function(_0x58363b){if(_0x58363b){var _0x4dfea6=typeof _0x1bdd48[_0x2bdb('0x1d')]==='undefined'&&typeof _0x1bdd48[_0x2bdb('0x1e')]==='undefined';var _0x20100a=_0x58363b[_0x2bdb('0x1f')];var _0x2748ac=_0x4dfea6?0x0:_0x1bdd48[_0x2bdb('0x1d')];var _0x106284=_0x4dfea6?_0x58363b[_0x2bdb('0x1f')]:_0x1bdd48[_0x2bdb('0x1d')]+_0x1bdd48[_0x2bdb('0x1e')];var _0x174b96;if(_0x106284>=_0x20100a){_0x106284=_0x20100a;_0x174b96=0xc8;}else{_0x174b96=0xce;}_0xcef8bc[_0x2bdb('0x1b')](_0x174b96);return _0xcef8bc['set']('Content-Range',_0x2748ac+'-'+_0x106284+'/'+_0x20100a)[_0x2bdb('0x1c')](_0x58363b);}return null;};}function patchUpdates(_0x3856dd){return function(_0x28db7c){try{jsonpatch[_0x2bdb('0x20')](_0x28db7c,_0x3856dd,!![]);}catch(_0x3f146e){return BPromise[_0x2bdb('0x21')](_0x3f146e);}return _0x28db7c[_0x2bdb('0x22')]();};}function saveUpdates(_0x2053ad,_0x5eb2ed){return function(_0xe48575){if(_0xe48575){return _0xe48575[_0x2bdb('0x23')](_0x2053ad)[_0x2bdb('0x24')](function(_0x508699){return _0x508699;});}return null;};}function removeEntity(_0xbb9adb,_0x5b278c){return function(_0x1d267d){if(_0x1d267d){return _0x1d267d[_0x2bdb('0x25')]()[_0x2bdb('0x24')](function(){_0xbb9adb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a17e7,_0x8700a7){return function(_0x13d7dd){if(!_0x13d7dd){_0x1a17e7[_0x2bdb('0x26')](0x194);}return _0x13d7dd;};}function handleError(_0x378f05,_0x1722a1){_0x1722a1=_0x1722a1||0x1f4;return function(_0x193a32){logger[_0x2bdb('0x27')](_0x193a32['stack']);if(_0x193a32[_0x2bdb('0x28')]){delete _0x193a32['name'];}_0x378f05['status'](_0x1722a1)[_0x2bdb('0x29')](_0x193a32);};}exports[_0x2bdb('0x2a')]=function(_0x42eabd,_0x2a5af7){var _0x4ee088={},_0x13f09d={},_0x5dffeb={'count':0x0,'rows':[]};var _0x732882=_[_0x2bdb('0x2b')](db['Attachment']['rawAttributes'],function(_0x3cbe90){return{'name':_0x3cbe90[_0x2bdb('0x2c')],'type':_0x3cbe90[_0x2bdb('0x2d')]['key']};});_0x13f09d[_0x2bdb('0x2e')]=_['map'](_0x732882,'name');_0x13f09d[_0x2bdb('0x2f')]=_['keys'](_0x42eabd['query']);_0x13f09d[_0x2bdb('0x30')]=_['intersection'](_0x13f09d['model'],_0x13f09d[_0x2bdb('0x2f')]);_0x4ee088[_0x2bdb('0x31')]=_[_0x2bdb('0x32')](_0x13f09d[_0x2bdb('0x2e')],qs[_0x2bdb('0x33')](_0x42eabd['query']['fields']));_0x4ee088['attributes']=_0x4ee088[_0x2bdb('0x31')][_0x2bdb('0x34')]?_0x4ee088[_0x2bdb('0x31')]:_0x13f09d[_0x2bdb('0x2e')];if(!_0x42eabd['query'][_0x2bdb('0x35')]('nolimit')){_0x4ee088[_0x2bdb('0x1e')]=qs[_0x2bdb('0x1e')](_0x42eabd['query']['limit']);_0x4ee088[_0x2bdb('0x1d')]=qs[_0x2bdb('0x1d')](_0x42eabd[_0x2bdb('0x2f')][_0x2bdb('0x1d')]);}_0x4ee088[_0x2bdb('0x36')]=qs[_0x2bdb('0x37')](_0x42eabd['query'][_0x2bdb('0x37')]);_0x4ee088[_0x2bdb('0x38')]=qs[_0x2bdb('0x30')](_[_0x2bdb('0x39')](_0x42eabd['query'],_0x13f09d[_0x2bdb('0x30')]),_0x732882);if(_0x42eabd['query'][_0x2bdb('0x3a')]){_0x4ee088[_0x2bdb('0x38')]=_[_0x2bdb('0x3b')](_0x4ee088['where'],{'$or':_[_0x2bdb('0x2b')](_0x732882,function(_0x51314a){if(_0x51314a['type']!==_0x2bdb('0x3c')){var _0x4b48a5={};_0x4b48a5[_0x51314a[_0x2bdb('0x28')]]={'$like':'%'+_0x42eabd[_0x2bdb('0x2f')][_0x2bdb('0x3a')]+'%'};return _0x4b48a5;}})});}_0x4ee088=_[_0x2bdb('0x3b')]({},_0x4ee088,_0x42eabd['options']);var _0x4c73af={'where':_0x4ee088[_0x2bdb('0x38')]};return db[_0x2bdb('0x3d')][_0x2bdb('0x1f')](_0x4c73af)[_0x2bdb('0x24')](function(_0xd2b2ea){_0x5dffeb[_0x2bdb('0x1f')]=_0xd2b2ea;if(_0x42eabd[_0x2bdb('0x2f')][_0x2bdb('0x3e')]){_0x4ee088[_0x2bdb('0x3f')]=[{'all':!![]}];}return db['Attachment'][_0x2bdb('0x40')](_0x4ee088);})[_0x2bdb('0x24')](function(_0x1cb503){_0x5dffeb[_0x2bdb('0x41')]=_0x1cb503;return _0x5dffeb;})[_0x2bdb('0x24')](respondWithFilteredResult(_0x2a5af7,_0x4ee088))['catch'](handleError(_0x2a5af7,null));};exports[_0x2bdb('0x42')]=function(_0x3e5013,_0x293a94){var _0x34e785={'raw':!![],'where':{'id':_0x3e5013[_0x2bdb('0x43')]['id']}},_0x244039={};_0x244039[_0x2bdb('0x2e')]=_[_0x2bdb('0x44')](db[_0x2bdb('0x3d')][_0x2bdb('0x45')]);_0x244039['query']=_['keys'](_0x3e5013[_0x2bdb('0x2f')]);_0x244039[_0x2bdb('0x30')]=_[_0x2bdb('0x32')](_0x244039[_0x2bdb('0x2e')],_0x244039[_0x2bdb('0x2f')]);_0x34e785[_0x2bdb('0x31')]=_[_0x2bdb('0x32')](_0x244039['model'],qs[_0x2bdb('0x33')](_0x3e5013['query']['fields']));_0x34e785[_0x2bdb('0x31')]=_0x34e785[_0x2bdb('0x31')][_0x2bdb('0x34')]?_0x34e785[_0x2bdb('0x31')]:_0x244039['model'];if(_0x3e5013[_0x2bdb('0x2f')]['includeAll']){_0x34e785['include']=[{'all':!![]}];}_0x34e785=_[_0x2bdb('0x3b')]({},_0x34e785,_0x3e5013[_0x2bdb('0x46')]);return db[_0x2bdb('0x3d')][_0x2bdb('0x47')](_0x34e785)[_0x2bdb('0x24')](handleEntityNotFound(_0x293a94,null))[_0x2bdb('0x24')](respondWithResult(_0x293a94,null))[_0x2bdb('0x48')](handleError(_0x293a94,null));};exports[_0x2bdb('0x49')]=function(_0x3efd24,_0x12911f){var _0x20833d={'where':{'id':_0x3efd24[_0x2bdb('0x43')]['id']}},_0x21e356={};_0x21e356['model']=_[_0x2bdb('0x44')](db[_0x2bdb('0x3d')][_0x2bdb('0x45')]);_0x20833d[_0x2bdb('0x31')]=_[_0x2bdb('0x32')](_0x21e356['model'],qs[_0x2bdb('0x33')](_0x3efd24[_0x2bdb('0x2f')][_0x2bdb('0x33')]));_0x20833d[_0x2bdb('0x31')]=_0x20833d[_0x2bdb('0x31')][_0x2bdb('0x34')]?_0x20833d[_0x2bdb('0x31')]:_0x21e356[_0x2bdb('0x2e')];if(_0x3efd24['query'][_0x2bdb('0x3e')]){_0x20833d[_0x2bdb('0x3f')]=[{'all':!![]}];}_0x20833d=_[_0x2bdb('0x3b')]({},_0x20833d,_0x3efd24[_0x2bdb('0x46')]);return db['Attachment']['find'](_0x20833d)['then'](handleEntityNotFound(_0x12911f,null))[_0x2bdb('0x24')](function(_0x235185){if(_0x235185){var _0x5479fb=_0x235185[_0x2bdb('0x4a')]({'plain':!![]});_0x5479fb=qs[_0x2bdb('0x4b')](_0x5479fb,['id',_0x2bdb('0x4c'),'updatedAt']);_0x3efd24[_0x2bdb('0x4d')]=_[_0x2bdb('0x4b')](_0x3efd24['body'],['id',_0x2bdb('0x4c'),_0x2bdb('0x4e')]);return db['Attachment'][_0x2bdb('0x4f')](_[_0x2bdb('0x3b')](_0x5479fb,_0x3efd24['body']),{'include':_0x3efd24[_0x2bdb('0x2f')][_0x2bdb('0x3e')]?[{'all':!![]}]:undefined});}})[_0x2bdb('0x24')](respondWithResult(_0x12911f,0xc9))[_0x2bdb('0x48')](handleError(_0x12911f,null));};exports['update']=function(_0x10c1bb,_0xb1b6ce){if(_0x10c1bb['body']['id']){delete _0x10c1bb[_0x2bdb('0x4d')]['id'];}return db[_0x2bdb('0x3d')][_0x2bdb('0x47')]({'where':{'id':_0x10c1bb[_0x2bdb('0x43')]['id']}})['then'](handleEntityNotFound(_0xb1b6ce,null))[_0x2bdb('0x24')](saveUpdates(_0x10c1bb[_0x2bdb('0x4d')],null))[_0x2bdb('0x24')](respondWithResult(_0xb1b6ce,null))[_0x2bdb('0x48')](handleError(_0xb1b6ce,null));};exports[_0x2bdb('0x25')]=function(_0x1e8341,_0x4a84f7){return db['Attachment']['find']({'where':{'id':_0x1e8341[_0x2bdb('0x43')]['id']}})[_0x2bdb('0x24')](handleEntityNotFound(_0x4a84f7,null))[_0x2bdb('0x24')](removeEntity(_0x4a84f7,null))[_0x2bdb('0x48')](handleError(_0x4a84f7,null));};exports[_0x2bdb('0x4f')]=function(_0xa3ccf8,_0x131b30,_0x31f2e8){_0xa3ccf8[_0x2bdb('0x4d')][_0x2bdb('0x28')]=_0xa3ccf8[_0x2bdb('0x50')][_0x2bdb('0x51')];_0xa3ccf8[_0x2bdb('0x4d')][_0x2bdb('0x52')]=_0xa3ccf8[_0x2bdb('0x50')][_0x2bdb('0x53')];_0xa3ccf8['body'][_0x2bdb('0x2d')]=_0xa3ccf8['file'][_0x2bdb('0x54')];return db[_0x2bdb('0x3d')]['create'](_0xa3ccf8[_0x2bdb('0x4d')])[_0x2bdb('0x24')](respondWithResult(_0x131b30,0xc9))[_0x2bdb('0x48')](handleError(_0x131b30,null));};exports[_0x2bdb('0x55')]=function(_0x3698f0,_0x33c36e,_0x7cfa41){return db[_0x2bdb('0x3d')][_0x2bdb('0x56')]({'where':{'id':_0x3698f0[_0x2bdb('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x33c36e,null))[_0x2bdb('0x24')](function(_0x1a5a42){if(_0x1a5a42){var _0x251552=_0x1a5a42[_0x2bdb('0x57')]!==null;var _0x34d905=path[_0x2bdb('0x58')](config[_0x2bdb('0x59')],_0x2bdb('0x5a'));if(_0x251552){_0x34d905=path[_0x2bdb('0x58')](_0x34d905,_0x2bdb('0x5b'));}var _0x3f7dda=path['join'](_0x34d905,_0x1a5a42[_0x2bdb('0x52')]);return _0x33c36e[_0x2bdb('0x55')](_0x3f7dda);}})[_0x2bdb('0x48')](handleError(_0x33c36e,null));}; \ No newline at end of file +var _0x6f7b=['order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','clone','find','omit','createdAt','updatedAt','body','create','update','params','destroy','file','filename','mimetype','findOne','root','join','offline-chat/','basename','download','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','then','error','name','index','map','Attachment','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f7b,0x7b));var _0xb6f7=function(_0x27df38,_0x32161b){_0x27df38=_0x27df38-0x0;var _0x29c174=_0x6f7b[_0x27df38];return _0x29c174;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb6f7('0x0'));var zipdir=require(_0xb6f7('0x1'));var jsonpatch=require(_0xb6f7('0x2'));var rp=require(_0xb6f7('0x3'));var moment=require(_0xb6f7('0x4'));var BPromise=require(_0xb6f7('0x5'));var Mustache=require(_0xb6f7('0x6'));var util=require(_0xb6f7('0x7'));var path=require(_0xb6f7('0x8'));var sox=require(_0xb6f7('0x9'));var csv=require('to-csv');var ejs=require(_0xb6f7('0xa'));var fs=require('fs');var fs_extra=require(_0xb6f7('0xb'));var _=require(_0xb6f7('0xc'));var squel=require(_0xb6f7('0xd'));var crypto=require('crypto');var jsforce=require(_0xb6f7('0xe'));var deskjs=require(_0xb6f7('0xf'));var toCsv=require(_0xb6f7('0x10'));var querystring=require('querystring');var Papa=require(_0xb6f7('0x11'));var Redis=require(_0xb6f7('0x12'));var authService=require(_0xb6f7('0x13'));var qs=require(_0xb6f7('0x14'));var as=require(_0xb6f7('0x15'));var hardwareService=require(_0xb6f7('0x16'));var logger=require('../../config/logger')(_0xb6f7('0x17'));var utils=require(_0xb6f7('0x18'));var config=require(_0xb6f7('0x19'));var licenseUtil=require(_0xb6f7('0x1a'));var db=require(_0xb6f7('0x1b'))['db'];function respondWithStatusCode(_0x1f92a2,_0x5470b8){_0x5470b8=_0x5470b8||0xcc;return function(_0x577bd6){if(_0x577bd6){return _0x1f92a2[_0xb6f7('0x1c')](_0x5470b8);}return _0x1f92a2[_0xb6f7('0x1d')](_0x5470b8)[_0xb6f7('0x1e')]();};}function respondWithResult(_0x185bb4,_0x5baee4){_0x5baee4=_0x5baee4||0xc8;return function(_0x214aa5){if(_0x214aa5){return _0x185bb4[_0xb6f7('0x1d')](_0x5baee4)[_0xb6f7('0x1f')](_0x214aa5);}};}function respondWithFilteredResult(_0x23970e,_0x306830){return function(_0x5a1ce9){if(_0x5a1ce9){var _0x468e1e=typeof _0x306830[_0xb6f7('0x20')]===_0xb6f7('0x21')&&typeof _0x306830[_0xb6f7('0x22')]==='undefined';var _0x10670f=_0x5a1ce9['count'];var _0xbf9760=_0x468e1e?0x0:_0x306830[_0xb6f7('0x20')];var _0x1d5d4b=_0x468e1e?_0x5a1ce9[_0xb6f7('0x23')]:_0x306830['offset']+_0x306830[_0xb6f7('0x22')];var _0x56180a;if(_0x1d5d4b>=_0x10670f){_0x1d5d4b=_0x10670f;_0x56180a=0xc8;}else{_0x56180a=0xce;}_0x23970e[_0xb6f7('0x1d')](_0x56180a);return _0x23970e[_0xb6f7('0x24')]('Content-Range',_0xbf9760+'-'+_0x1d5d4b+'/'+_0x10670f)[_0xb6f7('0x1f')](_0x5a1ce9);}return null;};}function patchUpdates(_0x5989fd){return function(_0x5f1237){try{jsonpatch[_0xb6f7('0x25')](_0x5f1237,_0x5989fd,!![]);}catch(_0x29ab80){return BPromise[_0xb6f7('0x26')](_0x29ab80);}return _0x5f1237['save']();};}function saveUpdates(_0x71d340,_0x1fe83d){return function(_0x2979a9){if(_0x2979a9){return _0x2979a9['update'](_0x71d340)[_0xb6f7('0x27')](function(_0x8426ed){return _0x8426ed;});}return null;};}function removeEntity(_0x5d92d1,_0x94f8c2){return function(_0x3f552f){if(_0x3f552f){return _0x3f552f['destroy']()[_0xb6f7('0x27')](function(){_0x5d92d1[_0xb6f7('0x1d')](0xcc)[_0xb6f7('0x1e')]();});}};}function handleEntityNotFound(_0xe4a346,_0x478722){return function(_0x3f35d3){if(!_0x3f35d3){_0xe4a346[_0xb6f7('0x1c')](0x194);}return _0x3f35d3;};}function handleError(_0x11de09,_0x15cc4a){_0x15cc4a=_0x15cc4a||0x1f4;return function(_0x331c9b){logger[_0xb6f7('0x28')](_0x331c9b['stack']);if(_0x331c9b[_0xb6f7('0x29')]){delete _0x331c9b['name'];}_0x11de09['status'](_0x15cc4a)['send'](_0x331c9b);};}exports[_0xb6f7('0x2a')]=function(_0x34a53a,_0x5e7805){var _0xc78103={},_0x4df1db={},_0x461947={'count':0x0,'rows':[]};var _0x1a19ee=_[_0xb6f7('0x2b')](db[_0xb6f7('0x2c')]['rawAttributes'],function(_0x48a381){return{'name':_0x48a381[_0xb6f7('0x2d')],'type':_0x48a381[_0xb6f7('0x2e')][_0xb6f7('0x2f')]};});_0x4df1db[_0xb6f7('0x30')]=_['map'](_0x1a19ee,_0xb6f7('0x29'));_0x4df1db[_0xb6f7('0x31')]=_['keys'](_0x34a53a[_0xb6f7('0x31')]);_0x4df1db[_0xb6f7('0x32')]=_['intersection'](_0x4df1db['model'],_0x4df1db['query']);_0xc78103[_0xb6f7('0x33')]=_[_0xb6f7('0x34')](_0x4df1db[_0xb6f7('0x30')],qs[_0xb6f7('0x35')](_0x34a53a[_0xb6f7('0x31')]['fields']));_0xc78103['attributes']=_0xc78103[_0xb6f7('0x33')][_0xb6f7('0x36')]?_0xc78103['attributes']:_0x4df1db[_0xb6f7('0x30')];if(!_0x34a53a[_0xb6f7('0x31')][_0xb6f7('0x37')](_0xb6f7('0x38'))){_0xc78103[_0xb6f7('0x22')]=qs[_0xb6f7('0x22')](_0x34a53a[_0xb6f7('0x31')][_0xb6f7('0x22')]);_0xc78103['offset']=qs[_0xb6f7('0x20')](_0x34a53a[_0xb6f7('0x31')][_0xb6f7('0x20')]);}_0xc78103[_0xb6f7('0x39')]=qs['sort'](_0x34a53a[_0xb6f7('0x31')][_0xb6f7('0x3a')]);_0xc78103[_0xb6f7('0x3b')]=qs[_0xb6f7('0x32')](_['pick'](_0x34a53a[_0xb6f7('0x31')],_0x4df1db[_0xb6f7('0x32')]),_0x1a19ee);if(_0x34a53a[_0xb6f7('0x31')][_0xb6f7('0x3c')]){_0xc78103[_0xb6f7('0x3b')]=_['merge'](_0xc78103[_0xb6f7('0x3b')],{'$or':_[_0xb6f7('0x2b')](_0x1a19ee,function(_0x90b57c){if(_0x90b57c[_0xb6f7('0x2e')]!=='VIRTUAL'){var _0x5a36a9={};_0x5a36a9[_0x90b57c[_0xb6f7('0x29')]]={'$like':'%'+_0x34a53a[_0xb6f7('0x31')][_0xb6f7('0x3c')]+'%'};return _0x5a36a9;}})});}_0xc78103=_[_0xb6f7('0x3d')]({},_0xc78103,_0x34a53a[_0xb6f7('0x3e')]);var _0xa20088={'where':_0xc78103[_0xb6f7('0x3b')]};return db[_0xb6f7('0x2c')][_0xb6f7('0x23')](_0xa20088)['then'](function(_0x47ebd1){_0x461947[_0xb6f7('0x23')]=_0x47ebd1;if(_0x34a53a[_0xb6f7('0x31')][_0xb6f7('0x3f')]){_0xc78103[_0xb6f7('0x40')]=[{'all':!![]}];}return db[_0xb6f7('0x2c')][_0xb6f7('0x41')](_0xc78103);})[_0xb6f7('0x27')](function(_0x2ae781){_0x461947[_0xb6f7('0x42')]=_0x2ae781;return _0x461947;})[_0xb6f7('0x27')](respondWithFilteredResult(_0x5e7805,_0xc78103))[_0xb6f7('0x43')](handleError(_0x5e7805,null));};exports[_0xb6f7('0x44')]=function(_0x477e12,_0xc6d3a4){var _0x1b152b={'raw':!![],'where':{'id':_0x477e12['params']['id']}},_0x158a07={};_0x158a07[_0xb6f7('0x30')]=_[_0xb6f7('0x45')](db['Attachment'][_0xb6f7('0x46')]);_0x158a07[_0xb6f7('0x31')]=_['keys'](_0x477e12[_0xb6f7('0x31')]);_0x158a07['filters']=_[_0xb6f7('0x34')](_0x158a07[_0xb6f7('0x30')],_0x158a07['query']);_0x1b152b[_0xb6f7('0x33')]=_[_0xb6f7('0x34')](_0x158a07[_0xb6f7('0x30')],qs[_0xb6f7('0x35')](_0x477e12[_0xb6f7('0x31')][_0xb6f7('0x35')]));_0x1b152b[_0xb6f7('0x33')]=_0x1b152b[_0xb6f7('0x33')]['length']?_0x1b152b[_0xb6f7('0x33')]:_0x158a07[_0xb6f7('0x30')];if(_0x477e12[_0xb6f7('0x31')]['includeAll']){_0x1b152b[_0xb6f7('0x40')]=[{'all':!![]}];}_0x1b152b=_[_0xb6f7('0x3d')]({},_0x1b152b,_0x477e12['options']);return db[_0xb6f7('0x2c')]['find'](_0x1b152b)[_0xb6f7('0x27')](handleEntityNotFound(_0xc6d3a4,null))[_0xb6f7('0x27')](respondWithResult(_0xc6d3a4,null))[_0xb6f7('0x43')](handleError(_0xc6d3a4,null));};exports[_0xb6f7('0x47')]=function(_0x3086bc,_0x285f2d){var _0x2c3965={'where':{'id':_0x3086bc['params']['id']}},_0x476c80={};_0x476c80[_0xb6f7('0x30')]=_[_0xb6f7('0x45')](db[_0xb6f7('0x2c')][_0xb6f7('0x46')]);_0x2c3965[_0xb6f7('0x33')]=_['intersection'](_0x476c80[_0xb6f7('0x30')],qs[_0xb6f7('0x35')](_0x3086bc['query'][_0xb6f7('0x35')]));_0x2c3965[_0xb6f7('0x33')]=_0x2c3965[_0xb6f7('0x33')][_0xb6f7('0x36')]?_0x2c3965[_0xb6f7('0x33')]:_0x476c80[_0xb6f7('0x30')];if(_0x3086bc[_0xb6f7('0x31')]['includeAll']){_0x2c3965[_0xb6f7('0x40')]=[{'all':!![]}];}_0x2c3965=_[_0xb6f7('0x3d')]({},_0x2c3965,_0x3086bc['options']);return db[_0xb6f7('0x2c')][_0xb6f7('0x48')](_0x2c3965)[_0xb6f7('0x27')](handleEntityNotFound(_0x285f2d,null))[_0xb6f7('0x27')](function(_0x8b0a7b){if(_0x8b0a7b){var _0x3e69ae=_0x8b0a7b['get']({'plain':!![]});_0x3e69ae=qs[_0xb6f7('0x49')](_0x3e69ae,['id',_0xb6f7('0x4a'),_0xb6f7('0x4b')]);_0x3086bc[_0xb6f7('0x4c')]=_[_0xb6f7('0x49')](_0x3086bc[_0xb6f7('0x4c')],['id',_0xb6f7('0x4a'),'updatedAt']);return db['Attachment'][_0xb6f7('0x4d')](_[_0xb6f7('0x3d')](_0x3e69ae,_0x3086bc[_0xb6f7('0x4c')]),{'include':_0x3086bc[_0xb6f7('0x31')][_0xb6f7('0x3f')]?[{'all':!![]}]:undefined});}})[_0xb6f7('0x27')](respondWithResult(_0x285f2d,0xc9))[_0xb6f7('0x43')](handleError(_0x285f2d,null));};exports[_0xb6f7('0x4e')]=function(_0x309a84,_0x597997){if(_0x309a84[_0xb6f7('0x4c')]['id']){delete _0x309a84[_0xb6f7('0x4c')]['id'];}return db[_0xb6f7('0x2c')][_0xb6f7('0x48')]({'where':{'id':_0x309a84[_0xb6f7('0x4f')]['id']}})['then'](handleEntityNotFound(_0x597997,null))[_0xb6f7('0x27')](saveUpdates(_0x309a84[_0xb6f7('0x4c')],null))[_0xb6f7('0x27')](respondWithResult(_0x597997,null))[_0xb6f7('0x43')](handleError(_0x597997,null));};exports[_0xb6f7('0x50')]=function(_0x3b9279,_0x14d5ca){return db['Attachment'][_0xb6f7('0x48')]({'where':{'id':_0x3b9279[_0xb6f7('0x4f')]['id']}})[_0xb6f7('0x27')](handleEntityNotFound(_0x14d5ca,null))[_0xb6f7('0x27')](removeEntity(_0x14d5ca,null))[_0xb6f7('0x43')](handleError(_0x14d5ca,null));};exports[_0xb6f7('0x4d')]=function(_0x5c13b1,_0x52fc60,_0x253582){_0x5c13b1[_0xb6f7('0x4c')][_0xb6f7('0x29')]=_0x5c13b1['file']['originalname'];_0x5c13b1[_0xb6f7('0x4c')]['basename']=_0x5c13b1[_0xb6f7('0x51')][_0xb6f7('0x52')];_0x5c13b1[_0xb6f7('0x4c')][_0xb6f7('0x2e')]=_0x5c13b1[_0xb6f7('0x51')][_0xb6f7('0x53')];return db[_0xb6f7('0x2c')]['create'](_0x5c13b1[_0xb6f7('0x4c')])['then'](respondWithResult(_0x52fc60,0xc9))[_0xb6f7('0x43')](handleError(_0x52fc60,null));};exports['download']=function(_0xc6efef,_0x5c0189,_0x15817c){return db[_0xb6f7('0x2c')][_0xb6f7('0x54')]({'where':{'id':_0xc6efef[_0xb6f7('0x4f')]['id']},'raw':!![]})[_0xb6f7('0x27')](handleEntityNotFound(_0x5c0189,null))[_0xb6f7('0x27')](function(_0x55b789){if(_0x55b789){var _0x165723=_0x55b789['ChatOfflineMessageId']!==null;var _0x1a9964=path['join'](config[_0xb6f7('0x55')],'server/files/attachments/');if(_0x165723){_0x1a9964=path[_0xb6f7('0x56')](_0x1a9964,_0xb6f7('0x57'));}var _0x438e4d=path[_0xb6f7('0x56')](_0x1a9964,_0x55b789[_0xb6f7('0x58')]);return _0x5c0189[_0xb6f7('0x59')](_0x438e4d);}})['catch'](handleError(_0x5c0189,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 551c1ca..60b01e5 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 _0xc30e=['exports','Attachment','attachments','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./attachment.attributes'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0xc30e,0x153));var _0xec30=function(_0x12b23e,_0x1fa40a){_0x12b23e=_0x12b23e-0x0;var _0x5247ff=_0xc30e[_0x12b23e];return _0x5247ff;};'use strict';var _=require(_0xec30('0x0'));var util=require(_0xec30('0x1'));var logger=require(_0xec30('0x2'))(_0xec30('0x3'));var moment=require(_0xec30('0x4'));var BPromise=require(_0xec30('0x5'));var rp=require(_0xec30('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec30('0x7'));var config=require('../../config/environment');var attributes=require(_0xec30('0x8'));module[_0xec30('0x9')]=function(_0xc7f4bc,_0x169cb6){return _0xc7f4bc['define'](_0xec30('0xa'),attributes,{'tableName':_0xec30('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4236=['lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./attachment.attributes','exports','Attachment','attachments'];(function(_0x59b533,_0x59fdcc){var _0x2beced=function(_0xd3aaf3){while(--_0xd3aaf3){_0x59b533['push'](_0x59b533['shift']());}};_0x2beced(++_0x59fdcc);}(_0x4236,0xd1));var _0x6423=function(_0x1125e6,_0xa2323d){_0x1125e6=_0x1125e6-0x0;var _0x19a466=_0x4236[_0x1125e6];return _0x19a466;};'use strict';var _=require(_0x6423('0x0'));var util=require(_0x6423('0x1'));var logger=require(_0x6423('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6423('0x3'));var rp=require(_0x6423('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6423('0x5'));var config=require(_0x6423('0x6'));var attributes=require(_0x6423('0x7'));module[_0x6423('0x8')]=function(_0xde0c6b,_0x1053db){return _0xde0c6b['define'](_0x6423('0x9'),attributes,{'tableName':_0x6423('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 28982d8..b86274f 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 _0x4bc3=['then','info','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Attachment,\x20%s,\x20%s','message','result','catch','CreateAttachment','Attachment','create','options','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x1f4370,_0x419f8a){var _0x1196a4=function(_0x234ee1){while(--_0x234ee1){_0x1f4370['push'](_0x1f4370['shift']());}};_0x1196a4(++_0x419f8a);}(_0x4bc3,0x16e));var _0x34bc=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x4bc3[_0x31ced5];return _0x10d9e5;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var moment=require('moment');var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34bc('0x4'))['db'];var utils=require(_0x34bc('0x5'));var logger=require(_0x34bc('0x6'))(_0x34bc('0x7'));var config=require(_0x34bc('0x8'));var jayson=require(_0x34bc('0x9'));var client=jayson[_0x34bc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21451b,_0x50320d,_0x502087){return new BPromise(function(_0x18a01c,_0x474108){return client[_0x34bc('0xb')](_0x21451b,_0x502087)[_0x34bc('0xc')](function(_0x409105){logger[_0x34bc('0xd')]('Attachment,\x20%s,\x20%s',_0x50320d,'request\x20sent');logger[_0x34bc('0xe')](_0x34bc('0xf'),_0x50320d,_0x34bc('0x10'),JSON['stringify'](_0x409105));if(_0x409105[_0x34bc('0x11')]){if(_0x409105['error'][_0x34bc('0x12')]===0x1f4){logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error'][_0x34bc('0x14')]);return _0x474108(_0x409105['error'][_0x34bc('0x14')]);}logger[_0x34bc('0x11')](_0x34bc('0x13'),_0x50320d,_0x409105['error']['message']);return _0x18a01c(_0x409105[_0x34bc('0x11')]['message']);}else{logger[_0x34bc('0xd')](_0x34bc('0x13'),_0x50320d,_0x34bc('0x10'));_0x18a01c(_0x409105[_0x34bc('0x15')][_0x34bc('0x14')]);}})[_0x34bc('0x16')](function(_0x5e132d){logger['error']('Attachment,\x20%s,\x20%s',_0x50320d,_0x5e132d);_0x474108(_0x5e132d);});});}exports[_0x34bc('0x17')]=function(_0x3eaedf){var _0x30282b=this;return new Promise(function(_0x239e6c,_0x567eee){return db[_0x34bc('0x18')][_0x34bc('0x19')](_0x3eaedf['body'],{'raw':_0x3eaedf[_0x34bc('0x1a')]?_0x3eaedf[_0x34bc('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x34bc('0xc')](function(_0x26cdec){logger[_0x34bc('0xd')](_0x34bc('0x17'),_0x3eaedf);logger[_0x34bc('0xe')](_0x34bc('0x17'),_0x3eaedf,JSON['stringify'](_0x26cdec));_0x239e6c(_0x26cdec);})[_0x34bc('0x16')](function(_0x3c9939){logger[_0x34bc('0x11')]('CreateAttachment',_0x3c9939['message'],_0x3eaedf);_0x567eee(_0x30282b[_0x34bc('0x11')](0x1f4,_0x3c9939[_0x34bc('0x14')]));});});}; \ No newline at end of file +var _0xaf1d=['jayson/promise','client','http','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','Attachment','create','body','raw','CreateAttachment','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x34c5cb,_0x4d2a3a){var _0x411dba=function(_0x1d1e7b){while(--_0x1d1e7b){_0x34c5cb['push'](_0x34c5cb['shift']());}};_0x411dba(++_0x4d2a3a);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x5835fd,_0x464612){_0x5835fd=_0x5835fd-0x0;var _0x5bc6fe=_0xaf1d[_0x5835fd];return _0x5bc6fe;};'use strict';var _=require(_0xdaf1('0x0'));var util=require(_0xdaf1('0x1'));var moment=require(_0xdaf1('0x2'));var BPromise=require(_0xdaf1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdaf1('0x4'));var db=require(_0xdaf1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaf1('0x6'))(_0xdaf1('0x7'));var config=require(_0xdaf1('0x8'));var jayson=require(_0xdaf1('0x9'));var client=jayson[_0xdaf1('0xa')][_0xdaf1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d6c50,_0x54dc7a,_0x5ed9cd){return new BPromise(function(_0xfb18fc,_0x51a7e9){return client['request'](_0x4d6c50,_0x5ed9cd)[_0xdaf1('0xc')](function(_0x3219da){logger[_0xdaf1('0xd')](_0xdaf1('0xe'),_0x54dc7a,'request\x20sent');logger[_0xdaf1('0xf')](_0xdaf1('0x10'),_0x54dc7a,_0xdaf1('0x11'),JSON[_0xdaf1('0x12')](_0x3219da));if(_0x3219da[_0xdaf1('0x13')]){if(_0x3219da['error'][_0xdaf1('0x14')]===0x1f4){logger[_0xdaf1('0x13')](_0xdaf1('0xe'),_0x54dc7a,_0x3219da[_0xdaf1('0x13')][_0xdaf1('0x15')]);return _0x51a7e9(_0x3219da[_0xdaf1('0x13')][_0xdaf1('0x15')]);}logger[_0xdaf1('0x13')](_0xdaf1('0xe'),_0x54dc7a,_0x3219da[_0xdaf1('0x13')][_0xdaf1('0x15')]);return _0xfb18fc(_0x3219da[_0xdaf1('0x13')][_0xdaf1('0x15')]);}else{logger['info'](_0xdaf1('0xe'),_0x54dc7a,_0xdaf1('0x11'));_0xfb18fc(_0x3219da['result'][_0xdaf1('0x15')]);}})['catch'](function(_0x39d34b){logger[_0xdaf1('0x13')](_0xdaf1('0xe'),_0x54dc7a,_0x39d34b);_0x51a7e9(_0x39d34b);});});}exports['CreateAttachment']=function(_0x1dd985){var _0x5a9101=this;return new Promise(function(_0x4896c1,_0x921cd7){return db[_0xdaf1('0x16')][_0xdaf1('0x17')](_0x1dd985[_0xdaf1('0x18')],{'raw':_0x1dd985['options']?_0x1dd985['options'][_0xdaf1('0x19')]===undefined?!![]:![]:!![]})[_0xdaf1('0xc')](function(_0x37b377){logger['info'](_0xdaf1('0x1a'),_0x1dd985);logger[_0xdaf1('0xf')](_0xdaf1('0x1a'),_0x1dd985,JSON[_0xdaf1('0x12')](_0x37b377));_0x4896c1(_0x37b377);})[_0xdaf1('0x1b')](function(_0x110e33){logger[_0xdaf1('0x13')](_0xdaf1('0x1a'),_0x110e33[_0xdaf1('0x15')],_0x1dd985);_0x921cd7(_0x5a9101[_0xdaf1('0x13')](0x1f4,_0x110e33['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index c563eae..f6676fe 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(_0x5aa762,_0x1cefb7){_0x5aa762=_0x5aa762-0x0;var _0x1762e6=_0xdb28[_0x5aa762];return _0x1762e6;};'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 _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x272638,_0x42b993){var _0x19d027=function(_0x27ac44){while(--_0x27ac44){_0x272638['push'](_0x272638['shift']());}};_0x19d027(++_0x42b993);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5f66[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 5397790..0ed3cc4 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x987d=['activedirectory','undefined','url','domain','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','user','agent','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','use','User','passport','Strategy','moment','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x987d,0x1df));var _0xd987=function(_0x32e091,_0x4c88db){_0x32e091=_0x32e091-0x0;var _0xeb8c03=_0x987d[_0x32e091];return _0xeb8c03;};'use strict';var passport=require(_0xd987('0x0'));var LocalStrategy=require('passport-local')[_0xd987('0x1')];var moment=require(_0xd987('0x2'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xd987('0x3'));var util=require(_0xd987('0x4'));var db=require(_0xd987('0x5'))['db'];var authService=require(_0xd987('0x6'));var utils=require(_0xd987('0x7'));var config=require(_0xd987('0x8'));var logger=require(_0xd987('0x9'))(_0xd987('0xa'));function isActiveDirectoryConfigured(_0x44b90a){var _0x2fba3d=![];if(typeof _0x44b90a[_0xd987('0xb')]!==_0xd987('0xc')){_0x2fba3d=_0x44b90a[_0xd987('0xb')]['baseDN']&&_0x44b90a['activedirectory'][_0xd987('0xd')]&&_0x44b90a[_0xd987('0xb')][_0xd987('0xe')];}return _0x2fba3d;}function adAuthenticate(_0x1fca0d,_0x520794,_0x590dc7){return new BPromise(function(_0x54d9dc,_0x4919f0){try{var _0x2a3c2a=new ActiveDirectory(_0x1fca0d);_0x2a3c2a['authenticate'](_0x520794,_0x590dc7,function(_0x309e39,_0x4858a){if(_0x309e39){logger['error'](_0xd987('0xf'),_0x520794,util[_0xd987('0x10')](_0x309e39,{'showHidden':![],'depth':null}));_0x4919f0(_0xd987('0x11'));}else if(!_0x4858a){logger[_0xd987('0x12')](_0xd987('0x13'),_0x520794);_0x4919f0(_0xd987('0x11'));}else{_0x54d9dc(_0x4858a);}});}catch(_0x4ddfac){_0x4919f0(_0x4ddfac);}});}function ActiveDirectoryAuthenticate(_0x2000ae,_0x580183,_0x50ccb2,_0x5ab0b5){var _0x17c9de,_0x53bc43;if(!isActiveDirectoryConfigured(config)){logger[_0xd987('0x12')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x580183);return _0x5ab0b5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xd987('0x14')][_0xd987('0x15')]({'where':{'id':0x1},'attributes':[_0xd987('0x16'),_0xd987('0x17')],'raw':!![]})[_0xd987('0x18')](function(_0x30c81d){_0x17c9de=_0x30c81d;if(!_0x17c9de[_0xd987('0x16')]){logger['error'](_0xd987('0x19'),_0x580183);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x2000ae['findOne']({'attributes':['id',_0xd987('0x1a'),_0xd987('0x1b'),_0xd987('0x1c'),_0xd987('0x1d'),_0xd987('0x1e'),'blocked','blockedAt','online'],'where':{'name':_0x580183,'role':{'$or':['admin',_0xd987('0x1f'),_0xd987('0x20')]},'adSsoEnabled':!![]}});})[_0xd987('0x18')](function(_0x4a781d){if(!_0x4a781d||_0x4a781d&&_0x4a781d[_0xd987('0x1a')]!==_0x580183){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x53bc43=_0x4a781d;var _0x256e92=_0x53bc43[_0xd987('0x1a')]+'@'+config['activedirectory']['domain'];return adAuthenticate(config[_0xd987('0xb')],_0x256e92,_0x50ccb2);})[_0xd987('0x18')](function(_0x4c53bc){if(_0x53bc43[_0xd987('0x1e')]){throw new Error(_0xd987('0x11'));}if(_0x17c9de[_0xd987('0x17')]>0x0){if(_0x53bc43[_0xd987('0x21')]){if(moment(_0x53bc43[_0xd987('0x22')])[_0xd987('0x23')](_0x17c9de[_0xd987('0x17')],_0xd987('0x24'))>moment()){throw new Error(_0xd987('0x11'));}return utils[_0xd987('0x25')](_0x53bc43,0x0,![],null)[_0xd987('0x18')](function(){return utils[_0xd987('0x26')](_0x53bc43);})[_0xd987('0x18')](function(){return _0x5ab0b5(null,_0x53bc43);});}else{return utils[_0xd987('0x26')](_0x53bc43)[_0xd987('0x18')](function(){return _0x5ab0b5(null,_0x53bc43);});}}else{return utils[_0xd987('0x26')](_0x53bc43)[_0xd987('0x18')](function(){return _0x5ab0b5(null,_0x53bc43);});}})[_0xd987('0x27')](function(_0x39ec49){return _0x5ab0b5(null,![],_0x39ec49);});}function handleError(_0x451ac5,_0x4ff3c7,_0x32fb1f){return _0x451ac5['status'](_0x4ff3c7||0x1f4)[_0xd987('0x28')]({'message':_0x32fb1f?_0x32fb1f[_0xd987('0x29')]||_0x32fb1f:''});}exports[_0xd987('0x2a')]=function(_0x35196a,_0x29705e,_0x305e5b){passport['authenticate'](_0xd987('0x2b'),function(_0x23a22d,_0x4e5847,_0x1629c6){var _0x983968=_0x23a22d||_0x1629c6;if(_0x983968){return handleError(_0x29705e,0x191,_0x983968);}if(!_0x4e5847){return handleError(_0x29705e,0x194,{'message':_0xd987('0x2c')});}else{var _0x4e10e4={'payload':{'id':_0x4e5847['id'],'role':_0x4e5847['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4e10e4)[_0xd987('0x18')](function(_0x1d62a0){_0x29705e[_0xd987('0x2d')]({'id':_0x4e5847['id'],'token':_0x1d62a0,'statusCall':'','isAlreadyLogged':_0x4e5847[_0xd987('0x2e')]});});}})(_0x35196a,_0x29705e,_0x305e5b);};passport[_0xd987('0x2f')]('ad-login',new LocalStrategy({'usernameField':_0xd987('0x1a'),'passwordField':_0xd987('0x1b')},function(_0x2768de,_0xfdb08f,_0x2b3781){return ActiveDirectoryAuthenticate(db[_0xd987('0x30')],_0x2768de,_0xfdb08f,_0x2b3781);})); \ No newline at end of file +var _0x739c=['../../config/environment','../../config/logger','api','activedirectory','url','domain','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','disabled','blocked','blockedAt','online','admin','agent','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','authenticate','role','signToken','User','passport','passport-local','Strategy','moment','util','../../mysqldb','../../components/auth/service','../../config/utils'];(function(_0x5f009e,_0x2e2468){var _0x583d04=function(_0x2a7960){while(--_0x2a7960){_0x5f009e['push'](_0x5f009e['shift']());}};_0x583d04(++_0x2e2468);}(_0x739c,0x1c4));var _0xc739=function(_0x2b085f,_0x41d231){_0x2b085f=_0x2b085f-0x0;var _0x35e504=_0x739c[_0x2b085f];return _0x35e504;};'use strict';var passport=require(_0xc739('0x0'));var LocalStrategy=require(_0xc739('0x1'))[_0xc739('0x2')];var moment=require(_0xc739('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require(_0xc739('0x4'));var db=require(_0xc739('0x5'))['db'];var authService=require(_0xc739('0x6'));var utils=require(_0xc739('0x7'));var config=require(_0xc739('0x8'));var logger=require(_0xc739('0x9'))(_0xc739('0xa'));function isActiveDirectoryConfigured(_0x54064f){var _0x3a0a66=![];if(typeof _0x54064f['activedirectory']!=='undefined'){_0x3a0a66=_0x54064f[_0xc739('0xb')]['baseDN']&&_0x54064f[_0xc739('0xb')][_0xc739('0xc')]&&_0x54064f['activedirectory'][_0xc739('0xd')];}return _0x3a0a66;}function adAuthenticate(_0x2d868a,_0x48b4ec,_0x20405b){return new BPromise(function(_0x1fce64,_0x3f6726){try{var _0x359b02=new ActiveDirectory(_0x2d868a);_0x359b02['authenticate'](_0x48b4ec,_0x20405b,function(_0x222119,_0x35d6a0){if(_0x222119){logger[_0xc739('0xe')](_0xc739('0xf'),_0x48b4ec,util[_0xc739('0x10')](_0x222119,{'showHidden':![],'depth':null}));_0x3f6726('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x35d6a0){logger[_0xc739('0xe')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x48b4ec);_0x3f6726(_0xc739('0x11'));}else{_0x1fce64(_0x35d6a0);}});}catch(_0x1157f5){_0x3f6726(_0x1157f5);}});}function ActiveDirectoryAuthenticate(_0x50c1a6,_0x998dc9,_0x59c0bb,_0x3ccc09){var _0x5b4396,_0xac3bd8;if(!isActiveDirectoryConfigured(config)){logger[_0xc739('0xe')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x998dc9);return _0x3ccc09(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xc739('0x12')][_0xc739('0x13')]({'where':{'id':0x1},'attributes':[_0xc739('0x14'),_0xc739('0x15')],'raw':!![]})[_0xc739('0x16')](function(_0xfd88e2){_0x5b4396=_0xfd88e2;if(!_0x5b4396[_0xc739('0x14')]){logger[_0xc739('0xe')](_0xc739('0x17'),_0x998dc9);throw new Error(_0xc739('0x11'));}return _0x50c1a6['findOne']({'attributes':['id',_0xc739('0x18'),_0xc739('0x19'),_0xc739('0x1a'),'role',_0xc739('0x1b'),_0xc739('0x1c'),_0xc739('0x1d'),_0xc739('0x1e')],'where':{'name':_0x998dc9,'role':{'$or':[_0xc739('0x1f'),'user',_0xc739('0x20')]},'adSsoEnabled':!![]}});})[_0xc739('0x16')](function(_0x4d0b71){if(!_0x4d0b71||_0x4d0b71&&_0x4d0b71[_0xc739('0x18')]!==_0x998dc9){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0xac3bd8=_0x4d0b71;var _0x5f8b5d=_0xac3bd8[_0xc739('0x18')]+'@'+config[_0xc739('0xb')][_0xc739('0xd')];return adAuthenticate(config['activedirectory'],_0x5f8b5d,_0x59c0bb);})[_0xc739('0x16')](function(_0x1ff684){if(_0xac3bd8[_0xc739('0x1b')]){throw new Error(_0xc739('0x11'));}if(_0x5b4396[_0xc739('0x15')]>0x0){if(_0xac3bd8[_0xc739('0x1c')]){if(moment(_0xac3bd8[_0xc739('0x1d')])[_0xc739('0x21')](_0x5b4396['blockDuration'],_0xc739('0x22'))>moment()){throw new Error(_0xc739('0x11'));}return utils[_0xc739('0x23')](_0xac3bd8,0x0,![],null)[_0xc739('0x16')](function(){return utils[_0xc739('0x24')](_0xac3bd8);})['then'](function(){return _0x3ccc09(null,_0xac3bd8);});}else{return utils[_0xc739('0x24')](_0xac3bd8)[_0xc739('0x16')](function(){return _0x3ccc09(null,_0xac3bd8);});}}else{return utils[_0xc739('0x24')](_0xac3bd8)['then'](function(){return _0x3ccc09(null,_0xac3bd8);});}})[_0xc739('0x25')](function(_0x22fe52){return _0x3ccc09(null,![],_0x22fe52);});}function handleError(_0x5c74cc,_0x4c8172,_0x5305a8){return _0x5c74cc[_0xc739('0x26')](_0x4c8172||0x1f4)[_0xc739('0x27')]({'message':_0x5305a8?_0x5305a8[_0xc739('0x28')]||_0x5305a8:''});}exports[_0xc739('0x29')]=function(_0xd66f49,_0x713d9d,_0x5425bd){passport[_0xc739('0x2a')]('ad-login',function(_0x5d7985,_0x31e398,_0x2a1188){var _0x1aba35=_0x5d7985||_0x2a1188;if(_0x1aba35){return handleError(_0x713d9d,0x191,_0x1aba35);}if(!_0x31e398){return handleError(_0x713d9d,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x318872={'payload':{'id':_0x31e398['id'],'role':_0x31e398[_0xc739('0x2b')]},'options':{'expiresIn':0x15180}};return authService[_0xc739('0x2c')](_0x318872)[_0xc739('0x16')](function(_0x28e79f){_0x713d9d['json']({'id':_0x31e398['id'],'token':_0x28e79f,'statusCall':'','isAlreadyLogged':_0x31e398[_0xc739('0x1e')]});});}})(_0xd66f49,_0x713d9d,_0x5425bd);};passport['use']('ad-login',new LocalStrategy({'usernameField':_0xc739('0x18'),'passwordField':'password'},function(_0x1181d5,_0x28f8dc,_0x25c676){return ActiveDirectoryAuthenticate(db[_0xc739('0x2d')],_0x1181d5,_0x28f8dc,_0x25c676);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 89dedda..197984e 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x045e=['post','login','exports','express','Router','./authActiveDirectory.controller'];(function(_0x19e15e,_0x49a659){var _0x3129f0=function(_0xea529){while(--_0xea529){_0x19e15e['push'](_0x19e15e['shift']());}};_0x3129f0(++_0x49a659);}(_0x045e,0x93));var _0xe045=function(_0x2e6e12,_0x238fc4){_0x2e6e12=_0x2e6e12-0x0;var _0x4bebf6=_0x045e[_0x2e6e12];return _0x4bebf6;};'use strict';var express=require(_0xe045('0x0'));var router=express[_0xe045('0x1')]();var controller=require(_0xe045('0x2'));router[_0xe045('0x3')]('/',controller[_0xe045('0x4')]);module[_0xe045('0x5')]=router; \ No newline at end of file +var _0xc052=['login','express','Router','./authActiveDirectory.controller','post'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc052,0xa6));var _0x2c05=function(_0x255e61,_0x50eaff){_0x255e61=_0x255e61-0x0;var _0x113d17=_0xc052[_0x255e61];return _0x113d17;};'use strict';var express=require(_0x2c05('0x0'));var router=express[_0x2c05('0x1')]();var controller=require(_0x2c05('0x2'));router[_0x2c05('0x3')]('/',controller[_0x2c05('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 4701530..2b6a62d 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x7a54,0x106));var _0x47a5=function(_0x1b7b98,_0xa66d0c){_0x1b7b98=_0x1b7b98-0x0;var _0xae46c6=_0x7a54[_0x1b7b98];return _0xae46c6;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x48f584,_0x303860){var _0x1e99c2=function(_0x1ec99d){while(--_0x1ec99d){_0x48f584['push'](_0x48f584['shift']());}};_0x1e99c2(++_0x303860);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 22941d8..9925fd4 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 _0x64c8=['Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','express','passport'];(function(_0x2fcddf,_0x2a5c30){var _0xcd6d76=function(_0x6a8702){while(--_0x6a8702){_0x2fcddf['push'](_0x2fcddf['shift']());}};_0xcd6d76(++_0x2a5c30);}(_0x64c8,0xb2));var _0x864c=function(_0x5aa9f8,_0x441aed){_0x5aa9f8=_0x5aa9f8-0x0;var _0x256b6f=_0x64c8[_0x5aa9f8];return _0x256b6f;};'use strict';var express=require(_0x864c('0x0'));var passport=require(_0x864c('0x1'));var router=express[_0x864c('0x2')]();var controller=require(_0x864c('0x3'));var userController=require(_0x864c('0x4'));var authService=require(_0x864c('0x5'));router[_0x864c('0x6')]('/',controller[_0x864c('0x7')]);router[_0x864c('0x6')](_0x864c('0x8'),controller[_0x864c('0x9')],authService[_0x864c('0xa')],userController[_0x864c('0x7')],authService[_0x864c('0xb')]);module['exports']=router; \ No newline at end of file +var _0xbc3a=['login','callback','isMiddleware','setTokenCookie','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xbc3a,0xb4));var _0xabc3=function(_0x2a98cd,_0x4a7a0d){_0x2a98cd=_0x2a98cd-0x0;var _0x4769da=_0xbc3a[_0x2a98cd];return _0x4769da;};'use strict';var express=require(_0xabc3('0x0'));var passport=require(_0xabc3('0x1'));var router=express[_0xabc3('0x2')]();var controller=require(_0xabc3('0x3'));var userController=require(_0xabc3('0x4'));var authService=require(_0xabc3('0x5'));router[_0xabc3('0x6')]('/',controller[_0xabc3('0x7')]);router['get']('/callback',controller[_0xabc3('0x8')],authService[_0xabc3('0x9')],userController[_0xabc3('0x7')],authService[_0xabc3('0xa')]);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 896f49a..e1b1a71 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 _0xdacf=['blocked','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','add','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','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','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','client','findOne','allowedLoginAttempts','blockDuration','name','password','salt','role','disabled','blockedAt','loginAttempts','admin','user','agent','then','authenticate','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x4b527e,_0x4c85fe){var _0x1a1189=function(_0x21c560){while(--_0x21c560){_0x4b527e['push'](_0x4b527e['shift']());}};_0x1a1189(++_0x4c85fe);}(_0xdacf,0x90));var _0xfdac=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdacf[_0x19950b];return _0x3c6b41;};'use strict';var util=require(_0xfdac('0x0'));var passport=require('passport');var LocalStrategy=require(_0xfdac('0x1'))[_0xfdac('0x2')];var jayson=require(_0xfdac('0x3'));var _=require(_0xfdac('0x4'));var rs=require(_0xfdac('0x5'));var moment=require(_0xfdac('0x6'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var client=jayson[_0xfdac('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x5372b4,_0xd77bb7,_0x35cab2,_0x27e85a){var _0x26648b,_0xbdf5c4;return db['Setting'][_0xfdac('0x8')]({'where':{'id':0x1},'attributes':[_0xfdac('0x9'),_0xfdac('0xa')],'raw':!![]})['then'](function(_0x48a29b){_0x26648b=_0x48a29b;return _0x5372b4[_0xfdac('0x8')]({'attributes':['id',_0xfdac('0xb'),_0xfdac('0xc'),_0xfdac('0xd'),_0xfdac('0xe'),_0xfdac('0xf'),'blocked',_0xfdac('0x10'),_0xfdac('0x11')],'where':{'name':_0xd77bb7,'role':{'$or':[_0xfdac('0x12'),_0xfdac('0x13'),_0xfdac('0x14')]}}});})[_0xfdac('0x15')](function(_0x5d8d36){if(!_0x5d8d36||_0x5d8d36&&_0x5d8d36[_0xfdac('0xb')]!==_0xd77bb7){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0xbdf5c4=_0x5d8d36;return _0xbdf5c4;}})['then'](function(){_0xbdf5c4[_0xfdac('0x16')](_0x35cab2,function(_0x5c1195,_0x197e00){var _0x396b35=_0xbdf5c4[_0xfdac('0x11')]+0x1;if(_0x5c1195){return _0x27e85a(_0x5c1195);}else if(!_0x197e00){if(_0xbdf5c4[_0xfdac('0xf')]){return _0x27e85a(null,![],{'message':_0xfdac('0x17')});}else if(_0x26648b[_0xfdac('0x9')]>0x0){if(_0xbdf5c4[_0xfdac('0x18')]){if(_0x26648b['blockDuration']>0x0){if(moment(_0xbdf5c4['blockedAt'])['add'](_0x26648b[_0xfdac('0xa')],_0xfdac('0x19'))>moment()){return _0x27e85a(null,![],{'message':_0xfdac('0x17')});}else{return utils['clearBlockUser'](_0xbdf5c4,_0x396b35,![],null)['then'](function(){return _0x27e85a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x27e85a(null,![],{'message':_0xfdac('0x17')});}}else{if(_0x396b35>=_0x26648b[_0xfdac('0x9')]){return utils[_0xfdac('0x1a')](_0xbdf5c4,0x0,!![],moment())[_0xfdac('0x15')](function(){return _0x27e85a(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xfdac('0x1a')](_0xbdf5c4,_0x396b35,![],null)[_0xfdac('0x15')](function(){return _0x27e85a(null,![],{'message':_0xfdac('0x17')});});}}}else{return _0x27e85a(null,![],{'message':_0xfdac('0x17')});}}else{if(_0xbdf5c4[_0xfdac('0xf')]){return _0x27e85a(null,![],{'message':_0xfdac('0x17')});}else if(_0x26648b[_0xfdac('0x9')]>0x0){if(_0xbdf5c4[_0xfdac('0x18')]){if(_0x26648b[_0xfdac('0xa')]>0x0){if(moment(_0xbdf5c4[_0xfdac('0x10')])['add'](_0x26648b['blockDuration'],_0xfdac('0x19'))>moment()){return _0x27e85a(null,![],{'message':_0xfdac('0x17')});}else{return utils[_0xfdac('0x1a')](_0xbdf5c4,0x0,![],null)[_0xfdac('0x15')](function(){return utils[_0xfdac('0x1b')](_0xbdf5c4);})[_0xfdac('0x15')](function(){return _0x27e85a(null,_0xbdf5c4);});}}else{return _0x27e85a(null,![],{'message':_0xfdac('0x17')});}}else{return utils[_0xfdac('0x1a')](_0xbdf5c4,0x0,![],null)['then'](function(){return utils['getLicense'](_0xbdf5c4);})['then'](function(){return _0x27e85a(null,_0xbdf5c4);})['catch'](function(_0x3a5853){return _0x27e85a(null,![],_0x3a5853);});}}else{if(_0xbdf5c4[_0xfdac('0x18')]){return _0x27e85a(null,![],{'message':_0xfdac('0x17')});}else{return utils['getLicense'](_0xbdf5c4)[_0xfdac('0x15')](function(){return _0x27e85a(null,_0xbdf5c4);});}}}});})[_0xfdac('0x1c')](function(_0x56baac){return _0x27e85a(null,![],_0x56baac);});}function sendServiceMail(_0x356bea){return db[_0xfdac('0x1d')][_0xfdac('0x1e')]({'where':{'service':!![]},'attributes':['id','name',_0xfdac('0x1f')],'include':[{'model':db[_0xfdac('0x20')],'as':'Smtp','include':[{'model':db[_0xfdac('0x21')],'as':_0xfdac('0x21')}]}]})[_0xfdac('0x15')](function(_0x6c2d17){if(!_0x6c2d17){throw new Error(_0xfdac('0x22'));}var _0x3d9415=_0x6c2d17[_0xfdac('0x23')]();var _0x1511f8={'account':_0x3d9415,'message':_[_0xfdac('0x24')]({'from':util[_0xfdac('0x25')](_0xfdac('0x26'),_0x6c2d17[_0xfdac('0xb')],_0x6c2d17[_0xfdac('0x1f')]||_0x6c2d17['Smtp'][_0xfdac('0x13')])},_0x356bea)};return client[_0xfdac('0x27')](_0xfdac('0x28'),_0x1511f8);})['then'](function(_0x44e163){if(_0x44e163[_0xfdac('0x29')]){throw new Error(util[_0xfdac('0x25')](_0xfdac('0x2a'),_0x44e163[_0xfdac('0x29')][_0xfdac('0x2b')]||JSON[_0xfdac('0x2c')](_0x44e163[_0xfdac('0x29')])));}return!![];});}function handleError(_0x356c24,_0x22c7a9,_0x2a0882){return _0x356c24[_0xfdac('0x2d')](_0x22c7a9||0x1f4)[_0xfdac('0x2e')]({'message':_0x2a0882?_0x2a0882['message']||_0x2a0882:''});}exports[_0xfdac('0x2f')]=function(_0x1e0474,_0x42ed27,_0x50af8d){passport[_0xfdac('0x16')](_0xfdac('0x30'),function(_0x77dc05,_0x157a06,_0x5b3ef9){var _0x205f2b=_0x77dc05||_0x5b3ef9;if(_0x205f2b){return handleError(_0x42ed27,0x191,_0x205f2b);}if(!_0x157a06){return handleError(_0x42ed27,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3359ba={'payload':{'id':_0x157a06['id'],'role':_0x157a06[_0xfdac('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0xfdac('0x31')](_0x3359ba)[_0xfdac('0x15')](function(_0x48ee78){_0x42ed27[_0xfdac('0x32')]({'id':_0x157a06['id'],'token':_0x48ee78,'statusCall':'','isAlreadyLogged':_0x157a06[_0xfdac('0x33')]});});}})(_0x1e0474,_0x42ed27,_0x50af8d);};exports[_0xfdac('0x34')]=function(_0x5cf7ba,_0x2b37b8){if(!_0x5cf7ba[_0xfdac('0x35')][_0xfdac('0x1f')]){return handleError(_0x2b37b8,0x1f4,{'message':_0xfdac('0x36')});}var _0x3a70c1=rs[_0xfdac('0x37')]();_0x5cf7ba[_0xfdac('0x35')][_0xfdac('0x1f')]=_0x5cf7ba[_0xfdac('0x35')][_0xfdac('0x1f')][_0xfdac('0x38')]()[_0xfdac('0x39')]();var _0xd18ea4;return db[_0xfdac('0x3a')][_0xfdac('0x8')]({'where':{'id':0x1},'attributes':[_0xfdac('0x9'),'blockDuration'],'raw':!![]})[_0xfdac('0x15')](function(_0x59792d){_0xd18ea4=_0x59792d;return db[_0xfdac('0x3b')]['find']({'where':{'email':_0x5cf7ba[_0xfdac('0x35')]['email']}});})['then'](function(_0xaf7d8){if(!_0xaf7d8){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0xaf7d8['disabled']){throw new Error(_0xfdac('0x3c'));}if(_0xaf7d8[_0xfdac('0x18')]){if(moment(_0xaf7d8[_0xfdac('0x10')])[_0xfdac('0x3d')](_0xd18ea4[_0xfdac('0xa')],_0xfdac('0x19'))>moment()){throw new Error(_0xfdac('0x3e'));}else{_0xaf7d8['blocked']=![];_0xaf7d8[_0xfdac('0x10')]=null;}}_0xaf7d8[_0xfdac('0x3f')]=_0x3a70c1;_0xaf7d8[_0xfdac('0x40')]=Date['now']()+0x36ee80;return _0xaf7d8[_0xfdac('0x41')]();})[_0xfdac('0x15')](function(){return sendServiceMail({'to':_0x5cf7ba[_0xfdac('0x35')][_0xfdac('0x1f')],'subject':_0xfdac('0x42'),'text':_0xfdac('0x43')+_0xfdac('0x44')+_0xfdac('0x45')+_0x5cf7ba[_0xfdac('0x46')][_0xfdac('0x47')]+_0xfdac('0x48')+_0x3a70c1+'\x0a\x0a'+_0xfdac('0x49')});})[_0xfdac('0x15')](function(){_0x2b37b8[_0xfdac('0x2d')](0xc8)['send']({'message':_0xfdac('0x4a')});})[_0xfdac('0x1c')](function(_0x3e42e7){return handleError(_0x2b37b8,0x1f4,_0x3e42e7);});};exports['reset']=function(_0x24fc82,_0x3e18ae){return db[_0xfdac('0x3b')][_0xfdac('0x1e')]({'where':{'resetPasswordToken':_0x24fc82[_0xfdac('0x4b')][_0xfdac('0x4c')],'resetPasswordExpires':{'$gt':Date[_0xfdac('0x4d')]()}}})[_0xfdac('0x15')](function(_0x4e4936){if(!_0x4e4936){throw new Error(_0xfdac('0x4e'));}return db[_0xfdac('0x3a')]['findOne']({'attributes':['id',_0xfdac('0x4f'),_0xfdac('0x50'),_0xfdac('0x51')]})[_0xfdac('0x15')](function(_0x2a3379){if(_0x2a3379[_0xfdac('0x4f')])authService['validatePasswordPattern'](_0x24fc82[_0xfdac('0x35')]['password']);if(!_0x2a3379[_0xfdac('0x50')]||!_0x4e4936[_0xfdac('0x52')])return _0x4e4936;authService['validatePasswordHistory'](_0x24fc82[_0xfdac('0x35')][_0xfdac('0xc')],_0x4e4936[_0xfdac('0x52')],_0x2a3379[_0xfdac('0x51')]);return _0x4e4936;})[_0xfdac('0x15')](function(){_0x4e4936[_0xfdac('0xc')]=_0x24fc82[_0xfdac('0x35')]['password'];_0x4e4936[_0xfdac('0x3f')]=null;_0x4e4936['resetPasswordExpires']=null;return _0x4e4936[_0xfdac('0x41')]();});})[_0xfdac('0x15')](function(){_0x3e18ae[_0xfdac('0x2d')](0xc8)['send']({'message':'Password\x20reset!'});})[_0xfdac('0x1c')](function(_0x5098a1){return handleError(_0x3e18ae,0x1f4,_0x5098a1);});};passport[_0xfdac('0x53')]('local-login',new LocalStrategy({'usernameField':_0xfdac('0xb'),'passwordField':_0xfdac('0xc')},function(_0x5aff30,_0x17362b,_0x5272c9){return localAuthenticate(db[_0xfdac('0x3b')],_0x5aff30,_0x17362b,_0x5272c9);})); \ No newline at end of file +var _0x8af2=['status','send','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','find','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','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','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','validatePasswordHistory','previousPasswords','passwordHistoryLimit','Password\x20reset!','use','passport','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','minutes','clearBlockUser','add','getLicense','catch','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify'];(function(_0x1ad790,_0x2ac345){var _0x2f3f9b=function(_0x222e8d){while(--_0x222e8d){_0x1ad790['push'](_0x1ad790['shift']());}};_0x2f3f9b(++_0x2ac345);}(_0x8af2,0x120));var _0x28af=function(_0x2425e9,_0x5bbd2d){_0x2425e9=_0x2425e9-0x0;var _0x1dea52=_0x8af2[_0x2425e9];return _0x1dea52;};'use strict';var util=require('util');var passport=require(_0x28af('0x0'));var LocalStrategy=require('passport-local')[_0x28af('0x1')];var jayson=require(_0x28af('0x2'));var _=require(_0x28af('0x3'));var rs=require('randomstring');var moment=require(_0x28af('0x4'));var db=require(_0x28af('0x5'))['db'];var authService=require(_0x28af('0x6'));var utils=require(_0x28af('0x7'));var client=jayson['client'][_0x28af('0x8')]({'port':0x232b});function localAuthenticate(_0xdc3428,_0x4ab638,_0x181037,_0x420f24){var _0x48c775,_0x5e434d;return db['Setting'][_0x28af('0x9')]({'where':{'id':0x1},'attributes':[_0x28af('0xa'),_0x28af('0xb')],'raw':!![]})[_0x28af('0xc')](function(_0x2911d7){_0x48c775=_0x2911d7;return _0xdc3428[_0x28af('0x9')]({'attributes':['id',_0x28af('0xd'),_0x28af('0xe'),_0x28af('0xf'),_0x28af('0x10'),_0x28af('0x11'),_0x28af('0x12'),_0x28af('0x13'),'loginAttempts'],'where':{'name':_0x4ab638,'role':{'$or':[_0x28af('0x14'),_0x28af('0x15'),'agent']}}});})[_0x28af('0xc')](function(_0x383a7d){if(!_0x383a7d||_0x383a7d&&_0x383a7d[_0x28af('0xd')]!==_0x4ab638){throw new Error(_0x28af('0x16'));}else{_0x5e434d=_0x383a7d;return _0x5e434d;}})[_0x28af('0xc')](function(){_0x5e434d[_0x28af('0x17')](_0x181037,function(_0x162c64,_0x4eda9d){var _0x34150b=_0x5e434d[_0x28af('0x18')]+0x1;if(_0x162c64){return _0x420f24(_0x162c64);}else if(!_0x4eda9d){if(_0x5e434d[_0x28af('0x11')]){return _0x420f24(null,![],{'message':_0x28af('0x16')});}else if(_0x48c775[_0x28af('0xa')]>0x0){if(_0x5e434d[_0x28af('0x12')]){if(_0x48c775[_0x28af('0xb')]>0x0){if(moment(_0x5e434d['blockedAt'])['add'](_0x48c775[_0x28af('0xb')],_0x28af('0x19'))>moment()){return _0x420f24(null,![],{'message':_0x28af('0x16')});}else{return utils[_0x28af('0x1a')](_0x5e434d,_0x34150b,![],null)[_0x28af('0xc')](function(){return _0x420f24(null,![],{'message':_0x28af('0x16')});});}}else{return _0x420f24(null,![],{'message':_0x28af('0x16')});}}else{if(_0x34150b>=_0x48c775['allowedLoginAttempts']){return utils[_0x28af('0x1a')](_0x5e434d,0x0,!![],moment())[_0x28af('0xc')](function(){return _0x420f24(null,![],{'message':_0x28af('0x16')});});}else{return utils[_0x28af('0x1a')](_0x5e434d,_0x34150b,![],null)[_0x28af('0xc')](function(){return _0x420f24(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x420f24(null,![],{'message':_0x28af('0x16')});}}else{if(_0x5e434d[_0x28af('0x11')]){return _0x420f24(null,![],{'message':_0x28af('0x16')});}else if(_0x48c775[_0x28af('0xa')]>0x0){if(_0x5e434d[_0x28af('0x12')]){if(_0x48c775[_0x28af('0xb')]>0x0){if(moment(_0x5e434d[_0x28af('0x13')])[_0x28af('0x1b')](_0x48c775[_0x28af('0xb')],_0x28af('0x19'))>moment()){return _0x420f24(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x28af('0x1a')](_0x5e434d,0x0,![],null)[_0x28af('0xc')](function(){return utils[_0x28af('0x1c')](_0x5e434d);})['then'](function(){return _0x420f24(null,_0x5e434d);});}}else{return _0x420f24(null,![],{'message':_0x28af('0x16')});}}else{return utils['clearBlockUser'](_0x5e434d,0x0,![],null)[_0x28af('0xc')](function(){return utils[_0x28af('0x1c')](_0x5e434d);})[_0x28af('0xc')](function(){return _0x420f24(null,_0x5e434d);})['catch'](function(_0x5ece3e){return _0x420f24(null,![],_0x5ece3e);});}}else{if(_0x5e434d['blocked']){return _0x420f24(null,![],{'message':_0x28af('0x16')});}else{return utils['getLicense'](_0x5e434d)[_0x28af('0xc')](function(){return _0x420f24(null,_0x5e434d);});}}}});})[_0x28af('0x1d')](function(_0x92d2f8){return _0x420f24(null,![],_0x92d2f8);});}function sendServiceMail(_0x22248c){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id','name',_0x28af('0x1e')],'include':[{'model':db[_0x28af('0x1f')],'as':_0x28af('0x20'),'include':[{'model':db['CloudProvider'],'as':_0x28af('0x21')}]}]})[_0x28af('0xc')](function(_0x6c5fd6){if(!_0x6c5fd6){throw new Error(_0x28af('0x22'));}var _0x4da382=_0x6c5fd6[_0x28af('0x23')]();var _0x3854ae={'account':_0x4da382,'message':_[_0x28af('0x24')]({'from':util[_0x28af('0x25')](_0x28af('0x26'),_0x6c5fd6[_0x28af('0xd')],_0x6c5fd6[_0x28af('0x1e')]||_0x6c5fd6['Smtp'][_0x28af('0x15')])},_0x22248c)};return client['request'](_0x28af('0x27'),_0x3854ae);})[_0x28af('0xc')](function(_0x3117ab){if(_0x3117ab[_0x28af('0x28')]){throw new Error(util[_0x28af('0x25')](_0x28af('0x29'),_0x3117ab[_0x28af('0x28')][_0x28af('0x2a')]||JSON[_0x28af('0x2b')](_0x3117ab[_0x28af('0x28')])));}return!![];});}function handleError(_0x5eaec5,_0x4dbba5,_0x3ceb91){return _0x5eaec5[_0x28af('0x2c')](_0x4dbba5||0x1f4)[_0x28af('0x2d')]({'message':_0x3ceb91?_0x3ceb91[_0x28af('0x2a')]||_0x3ceb91:''});}exports['login']=function(_0x34563f,_0x30bdcd,_0x53053a){passport[_0x28af('0x17')](_0x28af('0x2e'),function(_0x59c1a8,_0x313663,_0x13c0b4){var _0x5c5008=_0x59c1a8||_0x13c0b4;if(_0x5c5008){return handleError(_0x30bdcd,0x191,_0x5c5008);}if(!_0x313663){return handleError(_0x30bdcd,0x194,{'message':_0x28af('0x2f')});}else{var _0x1895fa={'payload':{'id':_0x313663['id'],'role':_0x313663[_0x28af('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x28af('0x30')](_0x1895fa)[_0x28af('0xc')](function(_0x9b458){_0x30bdcd[_0x28af('0x31')]({'id':_0x313663['id'],'token':_0x9b458,'statusCall':'','isAlreadyLogged':_0x313663[_0x28af('0x32')]});});}})(_0x34563f,_0x30bdcd,_0x53053a);};exports[_0x28af('0x33')]=function(_0xb09185,_0x97149e){if(!_0xb09185[_0x28af('0x34')][_0x28af('0x1e')]){return handleError(_0x97149e,0x1f4,{'message':_0x28af('0x35')});}var _0x49f73b=rs[_0x28af('0x36')]();_0xb09185['body'][_0x28af('0x1e')]=_0xb09185[_0x28af('0x34')][_0x28af('0x1e')][_0x28af('0x37')]()[_0x28af('0x38')]();var _0xee3935;return db[_0x28af('0x39')]['findOne']({'where':{'id':0x1},'attributes':[_0x28af('0xa'),_0x28af('0xb')],'raw':!![]})[_0x28af('0xc')](function(_0x396795){_0xee3935=_0x396795;return db['User'][_0x28af('0x3a')]({'where':{'email':_0xb09185[_0x28af('0x34')][_0x28af('0x1e')]}});})[_0x28af('0xc')](function(_0x3dda4c){if(!_0x3dda4c){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x3dda4c[_0x28af('0x11')]){throw new Error(_0x28af('0x3b'));}if(_0x3dda4c['blocked']){if(moment(_0x3dda4c[_0x28af('0x13')])['add'](_0xee3935['blockDuration'],_0x28af('0x19'))>moment()){throw new Error(_0x28af('0x3c'));}else{_0x3dda4c['blocked']=![];_0x3dda4c['blockedAt']=null;}}_0x3dda4c[_0x28af('0x3d')]=_0x49f73b;_0x3dda4c['resetPasswordExpires']=Date[_0x28af('0x3e')]()+0x36ee80;return _0x3dda4c[_0x28af('0x3f')]();})[_0x28af('0xc')](function(){return sendServiceMail({'to':_0xb09185['body']['email'],'subject':_0x28af('0x40'),'text':_0x28af('0x41')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x28af('0x42')+_0xb09185[_0x28af('0x43')][_0x28af('0x44')]+'/reset/'+_0x49f73b+'\x0a\x0a'+_0x28af('0x45')});})[_0x28af('0xc')](function(){_0x97149e[_0x28af('0x2c')](0xc8)[_0x28af('0x2d')]({'message':'Reset\x20Email\x20sent!'});})[_0x28af('0x1d')](function(_0x4019f0){return handleError(_0x97149e,0x1f4,_0x4019f0);});};exports[_0x28af('0x46')]=function(_0x48a1c7,_0x5cfe4a){return db[_0x28af('0x47')][_0x28af('0x3a')]({'where':{'resetPasswordToken':_0x48a1c7[_0x28af('0x48')][_0x28af('0x49')],'resetPasswordExpires':{'$gt':Date[_0x28af('0x3e')]()}}})[_0x28af('0xc')](function(_0x40ea31){if(!_0x40ea31){throw new Error(_0x28af('0x4a'));}return db['Setting'][_0x28af('0x9')]({'attributes':['id',_0x28af('0x4b'),_0x28af('0x4c'),'passwordHistoryLimit']})[_0x28af('0xc')](function(_0x1859e0){if(_0x1859e0['securePassword'])authService[_0x28af('0x4d')](_0x48a1c7['body'][_0x28af('0xe')]);if(!_0x1859e0[_0x28af('0x4c')]||!_0x40ea31['previousPasswords'])return _0x40ea31;authService[_0x28af('0x4e')](_0x48a1c7[_0x28af('0x34')][_0x28af('0xe')],_0x40ea31[_0x28af('0x4f')],_0x1859e0[_0x28af('0x50')]);return _0x40ea31;})[_0x28af('0xc')](function(){_0x40ea31[_0x28af('0xe')]=_0x48a1c7[_0x28af('0x34')][_0x28af('0xe')];_0x40ea31[_0x28af('0x3d')]=null;_0x40ea31['resetPasswordExpires']=null;return _0x40ea31[_0x28af('0x3f')]();});})[_0x28af('0xc')](function(){_0x5cfe4a[_0x28af('0x2c')](0xc8)[_0x28af('0x2d')]({'message':_0x28af('0x51')});})[_0x28af('0x1d')](function(_0x18f37a){return handleError(_0x5cfe4a,0x1f4,_0x18f37a);});};passport[_0x28af('0x52')](_0x28af('0x2e'),new LocalStrategy({'usernameField':_0x28af('0xd'),'passwordField':_0x28af('0xe')},function(_0x4ddac5,_0x25730e,_0x549896){return localAuthenticate(db['User'],_0x4ddac5,_0x25730e,_0x549896);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 8520a85..5eac1c4 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 _0x8c3c=['express','Router','./authLocal.controller','login','forgot','post','reset','exports'];(function(_0xf8d473,_0x5e7c9d){var _0x24482e=function(_0x26e956){while(--_0x26e956){_0xf8d473['push'](_0xf8d473['shift']());}};_0x24482e(++_0x5e7c9d);}(_0x8c3c,0xf0));var _0xc8c3=function(_0x1f261e,_0x435698){_0x1f261e=_0x1f261e-0x0;var _0x14fd33=_0x8c3c[_0x1f261e];return _0x14fd33;};'use strict';var express=require(_0xc8c3('0x0'));var router=express[_0xc8c3('0x1')]();var controller=require(_0xc8c3('0x2'));router['post']('/',controller[_0xc8c3('0x3')]);router['post']('/forgot',controller[_0xc8c3('0x4')]);router[_0xc8c3('0x5')]('/reset/:token',controller[_0xc8c3('0x6')]);module[_0xc8c3('0x7')]=router; \ No newline at end of file +var _0x9e30=['/forgot','forgot','reset','exports','express','Router','./authLocal.controller','post','login'];(function(_0x1e9483,_0x1a4949){var _0x4b7e09=function(_0x3aa731){while(--_0x3aa731){_0x1e9483['push'](_0x1e9483['shift']());}};_0x4b7e09(++_0x1a4949);}(_0x9e30,0x70));var _0x09e3=function(_0x53ba51,_0x2f2321){_0x53ba51=_0x53ba51-0x0;var _0x2e776e=_0x9e30[_0x53ba51];return _0x2e776e;};'use strict';var express=require(_0x09e3('0x0'));var router=express[_0x09e3('0x1')]();var controller=require(_0x09e3('0x2'));router[_0x09e3('0x3')]('/',controller[_0x09e3('0x4')]);router[_0x09e3('0x3')](_0x09e3('0x5'),controller[_0x09e3('0x6')]);router[_0x09e3('0x3')]('/reset/:token',controller[_0x09e3('0x7')]);module[_0x09e3('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 6d0a85c..e295830 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 _0x164c=['INTEGER','sequelize','exports','STRING'];(function(_0x3eecd2,_0x2d39d0){var _0x31c001=function(_0x51a9ac){while(--_0x51a9ac){_0x3eecd2['push'](_0x3eecd2['shift']());}};_0x31c001(++_0x2d39d0);}(_0x164c,0xc5));var _0xc164=function(_0x18b2ba,_0x9375f6){_0x18b2ba=_0x18b2ba-0x0;var _0x11f941=_0x164c[_0x18b2ba];return _0x11f941;};'use strict';var Sequelize=require(_0xc164('0x0'));module[_0xc164('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc164('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xc164('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x8ede=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x1055a9,_0x223227){var _0x782f61=function(_0xcc9e30){while(--_0xcc9e30){_0x1055a9['push'](_0x1055a9['shift']());}};_0x782f61(++_0x223227);}(_0x8ede,0x1f0));var _0xe8ed=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ede[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe8ed('0x0'));module[_0xe8ed('0x1')]={'name':{'type':Sequelize[_0xe8ed('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xe8ed('0x2')]},'description':{'type':Sequelize[_0xe8ed('0x2')]},'status':{'type':Sequelize[_0xe8ed('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe8ed('0x4')],'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 78454fb..a062eed 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 _0xa992=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','type','options','Automation','count','includeAll','include','rows','show','params','keys','find','create','body','catch','addConditions','Condition','ids','getConditions','addActions','Action','omit','getActions','findOne','eml-format','rimraf','request-promise','moment','util','to-csv','lodash','crypto','jsforce','desk.js','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','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','key','model','query','intersection'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa992,0x15a));var _0x2a99=function(_0x236abc,_0x40db12){_0x236abc=_0x236abc-0x0;var _0x3e82f5=_0xa992[_0x236abc];return _0x3e82f5;};'use strict';var emlformat=require(_0x2a99('0x0'));var rimraf=require(_0x2a99('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2a99('0x2'));var moment=require(_0x2a99('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2a99('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x2a99('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2a99('0x6'));var squel=require('squel');var crypto=require(_0x2a99('0x7'));var jsforce=require(_0x2a99('0x8'));var deskjs=require(_0x2a99('0x9'));var toCsv=require(_0x2a99('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2a99('0xa'));var authService=require(_0x2a99('0xb'));var qs=require(_0x2a99('0xc'));var as=require(_0x2a99('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a99('0xe'))(_0x2a99('0xf'));var utils=require(_0x2a99('0x10'));var config=require(_0x2a99('0x11'));var licenseUtil=require(_0x2a99('0x12'));var db=require(_0x2a99('0x13'))['db'];function respondWithStatusCode(_0xc77e78,_0x3f67a7){_0x3f67a7=_0x3f67a7||0xcc;return function(_0x1263f4){if(_0x1263f4){return _0xc77e78[_0x2a99('0x14')](_0x3f67a7);}return _0xc77e78[_0x2a99('0x15')](_0x3f67a7)[_0x2a99('0x16')]();};}function respondWithResult(_0x39c5f9,_0x52a6e7){_0x52a6e7=_0x52a6e7||0xc8;return function(_0x2d2202){if(_0x2d2202){return _0x39c5f9[_0x2a99('0x15')](_0x52a6e7)['json'](_0x2d2202);}};}function respondWithFilteredResult(_0xfe9379,_0xd7c212){return function(_0x2d44d5){if(_0x2d44d5){var _0x49123b=typeof _0xd7c212[_0x2a99('0x17')]===_0x2a99('0x18')&&typeof _0xd7c212['limit']==='undefined';var _0x4f5ec0=_0x2d44d5['count'];var _0x5432eb=_0x49123b?0x0:_0xd7c212[_0x2a99('0x17')];var _0x3e1234=_0x49123b?_0x2d44d5['count']:_0xd7c212[_0x2a99('0x17')]+_0xd7c212[_0x2a99('0x19')];var _0x4ea8de;if(_0x3e1234>=_0x4f5ec0){_0x3e1234=_0x4f5ec0;_0x4ea8de=0xc8;}else{_0x4ea8de=0xce;}_0xfe9379[_0x2a99('0x15')](_0x4ea8de);return _0xfe9379[_0x2a99('0x1a')]('Content-Range',_0x5432eb+'-'+_0x3e1234+'/'+_0x4f5ec0)[_0x2a99('0x1b')](_0x2d44d5);}return null;};}function patchUpdates(_0x474f45){return function(_0x2fc1d8){try{jsonpatch[_0x2a99('0x1c')](_0x2fc1d8,_0x474f45,!![]);}catch(_0x52c91c){return BPromise[_0x2a99('0x1d')](_0x52c91c);}return _0x2fc1d8[_0x2a99('0x1e')]();};}function saveUpdates(_0x3c9ab4,_0x32a28d){return function(_0x2d19d9){if(_0x2d19d9){return _0x2d19d9[_0x2a99('0x1f')](_0x3c9ab4)[_0x2a99('0x20')](function(_0x5642e7){return _0x5642e7;});}return null;};}function removeEntity(_0x3495ec,_0x5c8be7){return function(_0x1398f3){if(_0x1398f3){return _0x1398f3[_0x2a99('0x21')]()[_0x2a99('0x20')](function(){_0x3495ec[_0x2a99('0x15')](0xcc)[_0x2a99('0x16')]();});}};}function handleEntityNotFound(_0x2fd9b3,_0x1ffb89){return function(_0x289bcc){if(!_0x289bcc){_0x2fd9b3[_0x2a99('0x14')](0x194);}return _0x289bcc;};}function handleError(_0x960dc6,_0x3e8828){_0x3e8828=_0x3e8828||0x1f4;return function(_0x32355a){logger[_0x2a99('0x22')](_0x32355a[_0x2a99('0x23')]);if(_0x32355a[_0x2a99('0x24')]){delete _0x32355a['name'];}_0x960dc6[_0x2a99('0x15')](_0x3e8828)[_0x2a99('0x25')](_0x32355a);};}exports['index']=function(_0x291353,_0x1d88ae){var _0x52c212={},_0x105ad1={},_0x525932={'count':0x0,'rows':[]};var _0x2a8f5e=_[_0x2a99('0x26')](db['Automation'][_0x2a99('0x27')],function(_0x356661){return{'name':_0x356661['fieldName'],'type':_0x356661['type'][_0x2a99('0x28')]};});_0x105ad1[_0x2a99('0x29')]=_[_0x2a99('0x26')](_0x2a8f5e,'name');_0x105ad1['query']=_['keys'](_0x291353[_0x2a99('0x2a')]);_0x105ad1['filters']=_[_0x2a99('0x2b')](_0x105ad1[_0x2a99('0x29')],_0x105ad1[_0x2a99('0x2a')]);_0x52c212[_0x2a99('0x2c')]=_[_0x2a99('0x2b')](_0x105ad1[_0x2a99('0x29')],qs[_0x2a99('0x2d')](_0x291353[_0x2a99('0x2a')][_0x2a99('0x2d')]));_0x52c212[_0x2a99('0x2c')]=_0x52c212[_0x2a99('0x2c')][_0x2a99('0x2e')]?_0x52c212['attributes']:_0x105ad1[_0x2a99('0x29')];if(!_0x291353[_0x2a99('0x2a')][_0x2a99('0x2f')](_0x2a99('0x30'))){_0x52c212[_0x2a99('0x19')]=qs[_0x2a99('0x19')](_0x291353[_0x2a99('0x2a')][_0x2a99('0x19')]);_0x52c212[_0x2a99('0x17')]=qs['offset'](_0x291353[_0x2a99('0x2a')][_0x2a99('0x17')]);}_0x52c212[_0x2a99('0x31')]=qs[_0x2a99('0x32')](_0x291353[_0x2a99('0x2a')][_0x2a99('0x32')]);_0x52c212['where']=qs[_0x2a99('0x33')](_['pick'](_0x291353[_0x2a99('0x2a')],_0x105ad1[_0x2a99('0x33')]),_0x2a8f5e);if(_0x291353[_0x2a99('0x2a')][_0x2a99('0x34')]){_0x52c212[_0x2a99('0x35')]=_[_0x2a99('0x36')](_0x52c212[_0x2a99('0x35')],{'$or':_['map'](_0x2a8f5e,function(_0x5c0329){if(_0x5c0329[_0x2a99('0x37')]!=='VIRTUAL'){var _0x26b079={};_0x26b079[_0x5c0329[_0x2a99('0x24')]]={'$like':'%'+_0x291353[_0x2a99('0x2a')]['filter']+'%'};return _0x26b079;}})});}_0x52c212=_['merge']({},_0x52c212,_0x291353[_0x2a99('0x38')]);var _0x446938={'where':_0x52c212[_0x2a99('0x35')]};return db[_0x2a99('0x39')][_0x2a99('0x3a')](_0x446938)['then'](function(_0x38a6e9){_0x525932[_0x2a99('0x3a')]=_0x38a6e9;if(_0x291353[_0x2a99('0x2a')][_0x2a99('0x3b')]){_0x52c212[_0x2a99('0x3c')]=[{'all':!![]}];}return db[_0x2a99('0x39')]['findAll'](_0x52c212);})[_0x2a99('0x20')](function(_0x4dd1b9){_0x525932[_0x2a99('0x3d')]=_0x4dd1b9;return _0x525932;})['then'](respondWithFilteredResult(_0x1d88ae,_0x52c212))['catch'](handleError(_0x1d88ae,null));};exports[_0x2a99('0x3e')]=function(_0x4619a8,_0x401996){var _0x16d5b5={'raw':![],'where':{'id':_0x4619a8[_0x2a99('0x3f')]['id']}},_0x1577f0={};_0x1577f0['model']=_['keys'](db['Automation'][_0x2a99('0x27')]);_0x1577f0[_0x2a99('0x2a')]=_[_0x2a99('0x40')](_0x4619a8[_0x2a99('0x2a')]);_0x1577f0[_0x2a99('0x33')]=_[_0x2a99('0x2b')](_0x1577f0['model'],_0x1577f0[_0x2a99('0x2a')]);_0x16d5b5[_0x2a99('0x2c')]=_[_0x2a99('0x2b')](_0x1577f0[_0x2a99('0x29')],qs[_0x2a99('0x2d')](_0x4619a8[_0x2a99('0x2a')][_0x2a99('0x2d')]));_0x16d5b5['attributes']=_0x16d5b5[_0x2a99('0x2c')][_0x2a99('0x2e')]?_0x16d5b5[_0x2a99('0x2c')]:_0x1577f0[_0x2a99('0x29')];if(_0x4619a8[_0x2a99('0x2a')][_0x2a99('0x3b')]){_0x16d5b5[_0x2a99('0x3c')]=[{'all':!![]}];}_0x16d5b5=_[_0x2a99('0x36')]({},_0x16d5b5,_0x4619a8['options']);return db[_0x2a99('0x39')][_0x2a99('0x41')](_0x16d5b5)[_0x2a99('0x20')](handleEntityNotFound(_0x401996,null))['then'](respondWithResult(_0x401996,null))['catch'](handleError(_0x401996,null));};exports[_0x2a99('0x42')]=function(_0xd25cf9,_0x56a045){return db[_0x2a99('0x39')][_0x2a99('0x42')](_0xd25cf9[_0x2a99('0x43')],{})[_0x2a99('0x20')](respondWithResult(_0x56a045,0xc9))['catch'](handleError(_0x56a045,null));};exports[_0x2a99('0x1f')]=function(_0x40366e,_0x2ae688){if(_0x40366e[_0x2a99('0x43')]['id']){delete _0x40366e[_0x2a99('0x43')]['id'];}return db['Automation'][_0x2a99('0x41')]({'where':{'id':_0x40366e['params']['id']}})[_0x2a99('0x20')](handleEntityNotFound(_0x2ae688,null))['then'](saveUpdates(_0x40366e[_0x2a99('0x43')],null))[_0x2a99('0x20')](respondWithResult(_0x2ae688,null))[_0x2a99('0x44')](handleError(_0x2ae688,null));};exports['destroy']=function(_0x3caa5f,_0x54005b){return db[_0x2a99('0x39')]['find']({'where':{'id':_0x3caa5f['params']['id']}})[_0x2a99('0x20')](handleEntityNotFound(_0x54005b,null))[_0x2a99('0x20')](removeEntity(_0x54005b,null))['catch'](handleError(_0x54005b,null));};exports[_0x2a99('0x45')]=function(_0x22e243,_0x1f9ec9,_0x1114c3){return db[_0x2a99('0x46')][_0x2a99('0x41')]({'where':{'id':_0x22e243['params']['id']}})[_0x2a99('0x20')](handleEntityNotFound(_0x1f9ec9,null))[_0x2a99('0x20')](function(_0x5b2527){if(_0x5b2527){return _0x5b2527[_0x2a99('0x45')](_0x22e243[_0x2a99('0x43')]['ids'],_['omit'](_0x22e243[_0x2a99('0x43')],[_0x2a99('0x47'),'id'])||{});}})['then'](respondWithResult(_0x1f9ec9,null))[_0x2a99('0x44')](handleError(_0x1f9ec9,null));};exports[_0x2a99('0x48')]=function(_0x4f52aa,_0x465da8,_0x3dc4db){var _0x2ceb89={};var _0x2baf05={};var _0x3b88a2;var _0x89719b;return db[_0x2a99('0x39')]['findOne']({'where':{'id':_0x4f52aa['params']['id']}})['then'](handleEntityNotFound(_0x465da8,null))[_0x2a99('0x20')](function(_0x2fd93c){if(_0x2fd93c){_0x3b88a2=_0x2fd93c;_0x2baf05[_0x2a99('0x29')]=_['keys'](db[_0x2a99('0x46')][_0x2a99('0x27')]);_0x2baf05[_0x2a99('0x2a')]=_[_0x2a99('0x40')](_0x4f52aa[_0x2a99('0x2a')]);_0x2baf05[_0x2a99('0x33')]=_['intersection'](_0x2baf05[_0x2a99('0x29')],_0x2baf05[_0x2a99('0x2a')]);_0x2ceb89['attributes']=_['intersection'](_0x2baf05['model'],qs[_0x2a99('0x2d')](_0x4f52aa['query'][_0x2a99('0x2d')]));_0x2ceb89[_0x2a99('0x2c')]=_0x2ceb89['attributes'][_0x2a99('0x2e')]?_0x2ceb89[_0x2a99('0x2c')]:_0x2baf05['model'];_0x2ceb89['order']=qs[_0x2a99('0x32')](_0x4f52aa[_0x2a99('0x2a')][_0x2a99('0x32')]);_0x2ceb89[_0x2a99('0x35')]=qs['filters'](_['pick'](_0x4f52aa[_0x2a99('0x2a')],_0x2baf05['filters']));if(_0x4f52aa['query'][_0x2a99('0x34')]){_0x2ceb89[_0x2a99('0x35')]=_[_0x2a99('0x36')](_0x2ceb89[_0x2a99('0x35')],{'$or':_[_0x2a99('0x26')](_0x2ceb89['attributes'],function(_0xe2b3ad){var _0xb867ea={};_0xb867ea[_0xe2b3ad]={'$like':'%'+_0x4f52aa[_0x2a99('0x2a')][_0x2a99('0x34')]+'%'};return _0xb867ea;})});}_0x2ceb89=_['merge']({},_0x2ceb89,_0x4f52aa[_0x2a99('0x38')]);return _0x3b88a2[_0x2a99('0x48')](_0x2ceb89);}})['then'](function(_0x11267b){if(_0x11267b){_0x89719b=_0x11267b[_0x2a99('0x2e')];if(!_0x4f52aa[_0x2a99('0x2a')][_0x2a99('0x2f')](_0x2a99('0x30'))){_0x2ceb89[_0x2a99('0x19')]=qs[_0x2a99('0x19')](_0x4f52aa[_0x2a99('0x2a')]['limit']);_0x2ceb89[_0x2a99('0x17')]=qs[_0x2a99('0x17')](_0x4f52aa[_0x2a99('0x2a')]['offset']);}return _0x3b88a2[_0x2a99('0x48')](_0x2ceb89);}})['then'](function(_0x24de3f){if(_0x24de3f){return _0x24de3f?{'count':_0x89719b,'rows':_0x24de3f}:null;}})['then'](respondWithResult(_0x465da8,null))[_0x2a99('0x44')](handleError(_0x465da8,null));};exports[_0x2a99('0x49')]=function(_0xcc6584,_0x290859,_0x3c1661){return db[_0x2a99('0x4a')][_0x2a99('0x41')]({'where':{'id':_0xcc6584[_0x2a99('0x3f')]['id']}})[_0x2a99('0x20')](handleEntityNotFound(_0x290859,null))['then'](function(_0x69501a){if(_0x69501a){return _0x69501a[_0x2a99('0x49')](_0xcc6584[_0x2a99('0x43')][_0x2a99('0x47')],_[_0x2a99('0x4b')](_0xcc6584[_0x2a99('0x43')],[_0x2a99('0x47'),'id'])||{});}})['then'](respondWithResult(_0x290859,null))[_0x2a99('0x44')](handleError(_0x290859,null));};exports[_0x2a99('0x4c')]=function(_0x2112f,_0x326e47,_0x59e1ea){var _0x26991a={};var _0x327ae9={};var _0x56aab9;var _0x36c950;return db[_0x2a99('0x39')][_0x2a99('0x4d')]({'where':{'id':_0x2112f[_0x2a99('0x3f')]['id']}})[_0x2a99('0x20')](handleEntityNotFound(_0x326e47,null))[_0x2a99('0x20')](function(_0x4838ba){if(_0x4838ba){_0x56aab9=_0x4838ba;_0x327ae9[_0x2a99('0x29')]=_[_0x2a99('0x40')](db[_0x2a99('0x4a')]['rawAttributes']);_0x327ae9['query']=_[_0x2a99('0x40')](_0x2112f[_0x2a99('0x2a')]);_0x327ae9[_0x2a99('0x33')]=_[_0x2a99('0x2b')](_0x327ae9[_0x2a99('0x29')],_0x327ae9['query']);_0x26991a[_0x2a99('0x2c')]=_['intersection'](_0x327ae9['model'],qs[_0x2a99('0x2d')](_0x2112f[_0x2a99('0x2a')]['fields']));_0x26991a['attributes']=_0x26991a[_0x2a99('0x2c')][_0x2a99('0x2e')]?_0x26991a['attributes']:_0x327ae9[_0x2a99('0x29')];_0x26991a['order']=qs['sort'](_0x2112f[_0x2a99('0x2a')][_0x2a99('0x32')]);_0x26991a[_0x2a99('0x35')]=qs[_0x2a99('0x33')](_['pick'](_0x2112f[_0x2a99('0x2a')],_0x327ae9[_0x2a99('0x33')]));if(_0x2112f[_0x2a99('0x2a')][_0x2a99('0x34')]){_0x26991a[_0x2a99('0x35')]=_[_0x2a99('0x36')](_0x26991a['where'],{'$or':_[_0x2a99('0x26')](_0x26991a[_0x2a99('0x2c')],function(_0x2c687c){var _0x55aa36={};_0x55aa36[_0x2c687c]={'$like':'%'+_0x2112f[_0x2a99('0x2a')]['filter']+'%'};return _0x55aa36;})});}_0x26991a=_[_0x2a99('0x36')]({},_0x26991a,_0x2112f[_0x2a99('0x38')]);return _0x56aab9[_0x2a99('0x4c')](_0x26991a);}})[_0x2a99('0x20')](function(_0x36a2d0){if(_0x36a2d0){_0x36c950=_0x36a2d0['length'];if(!_0x2112f[_0x2a99('0x2a')]['hasOwnProperty'](_0x2a99('0x30'))){_0x26991a['limit']=qs[_0x2a99('0x19')](_0x2112f[_0x2a99('0x2a')][_0x2a99('0x19')]);_0x26991a[_0x2a99('0x17')]=qs[_0x2a99('0x17')](_0x2112f[_0x2a99('0x2a')][_0x2a99('0x17')]);}return _0x56aab9[_0x2a99('0x4c')](_0x26991a);}})[_0x2a99('0x20')](function(_0x1a2c07){if(_0x1a2c07){return _0x1a2c07?{'count':_0x36c950,'rows':_0x1a2c07}:null;}})[_0x2a99('0x20')](respondWithResult(_0x326e47,null))[_0x2a99('0x44')](handleError(_0x326e47,null));}; \ No newline at end of file +var _0xf3aa=['hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','Automation','includeAll','include','findAll','rows','show','params','merge','options','find','catch','create','body','Condition','addConditions','ids','getConditions','findOne','Action','addActions','omit','getActions','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','then','destroy','sendStatus','stack','send','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0xffb34f,_0x565dd1){var _0x1ab8d7=function(_0x8feda9){while(--_0x8feda9){_0xffb34f['push'](_0xffb34f['shift']());}};_0x1ab8d7(++_0x565dd1);}(_0xf3aa,0x70));var _0xaf3a=function(_0x5bb818,_0x57780a){_0x5bb818=_0x5bb818-0x0;var _0xc56b13=_0xf3aa[_0x5bb818];return _0xc56b13;};'use strict';var emlformat=require(_0xaf3a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaf3a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf3a('0x2'));var moment=require('moment');var BPromise=require(_0xaf3a('0x3'));var Mustache=require('mustache');var util=require(_0xaf3a('0x4'));var path=require(_0xaf3a('0x5'));var sox=require(_0xaf3a('0x6'));var csv=require(_0xaf3a('0x7'));var ejs=require(_0xaf3a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaf3a('0x9'));var squel=require(_0xaf3a('0xa'));var crypto=require(_0xaf3a('0xb'));var jsforce=require(_0xaf3a('0xc'));var deskjs=require(_0xaf3a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xaf3a('0xe'));var Papa=require(_0xaf3a('0xf'));var Redis=require(_0xaf3a('0x10'));var authService=require(_0xaf3a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xaf3a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf3a('0x13'))('api');var utils=require(_0xaf3a('0x14'));var config=require(_0xaf3a('0x15'));var licenseUtil=require(_0xaf3a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x124675,_0x162b1d){_0x162b1d=_0x162b1d||0xcc;return function(_0x39fd1f){if(_0x39fd1f){return _0x124675['sendStatus'](_0x162b1d);}return _0x124675['status'](_0x162b1d)[_0xaf3a('0x17')]();};}function respondWithResult(_0x1ccc03,_0x4480e6){_0x4480e6=_0x4480e6||0xc8;return function(_0x27899d){if(_0x27899d){return _0x1ccc03[_0xaf3a('0x18')](_0x4480e6)['json'](_0x27899d);}};}function respondWithFilteredResult(_0x510729,_0xc9e695){return function(_0x470ef9){if(_0x470ef9){var _0x27b645=typeof _0xc9e695['offset']===_0xaf3a('0x19')&&typeof _0xc9e695[_0xaf3a('0x1a')]===_0xaf3a('0x19');var _0x2fa3f5=_0x470ef9[_0xaf3a('0x1b')];var _0x5e1885=_0x27b645?0x0:_0xc9e695[_0xaf3a('0x1c')];var _0x28a106=_0x27b645?_0x470ef9['count']:_0xc9e695[_0xaf3a('0x1c')]+_0xc9e695[_0xaf3a('0x1a')];var _0x5cb5cb;if(_0x28a106>=_0x2fa3f5){_0x28a106=_0x2fa3f5;_0x5cb5cb=0xc8;}else{_0x5cb5cb=0xce;}_0x510729[_0xaf3a('0x18')](_0x5cb5cb);return _0x510729[_0xaf3a('0x1d')](_0xaf3a('0x1e'),_0x5e1885+'-'+_0x28a106+'/'+_0x2fa3f5)[_0xaf3a('0x1f')](_0x470ef9);}return null;};}function patchUpdates(_0x1158cc){return function(_0xdb5d1a){try{jsonpatch[_0xaf3a('0x20')](_0xdb5d1a,_0x1158cc,!![]);}catch(_0x42dba0){return BPromise['reject'](_0x42dba0);}return _0xdb5d1a[_0xaf3a('0x21')]();};}function saveUpdates(_0x59346f,_0x5c0b4f){return function(_0x2e83c5){if(_0x2e83c5){return _0x2e83c5['update'](_0x59346f)[_0xaf3a('0x22')](function(_0xf42f29){return _0xf42f29;});}return null;};}function removeEntity(_0x511eb5,_0x21875b){return function(_0x3e613f){if(_0x3e613f){return _0x3e613f[_0xaf3a('0x23')]()[_0xaf3a('0x22')](function(){_0x511eb5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54f03d,_0x16c56c){return function(_0x4ab44b){if(!_0x4ab44b){_0x54f03d[_0xaf3a('0x24')](0x194);}return _0x4ab44b;};}function handleError(_0xe1fa30,_0x26b1f7){_0x26b1f7=_0x26b1f7||0x1f4;return function(_0x2bc57){logger['error'](_0x2bc57[_0xaf3a('0x25')]);if(_0x2bc57['name']){delete _0x2bc57['name'];}_0xe1fa30['status'](_0x26b1f7)[_0xaf3a('0x26')](_0x2bc57);};}exports[_0xaf3a('0x27')]=function(_0xed5ec8,_0x58bf11){var _0x44db31={},_0x3d2d9a={},_0x75cbba={'count':0x0,'rows':[]};var _0x264ad1=_['map'](db['Automation'][_0xaf3a('0x28')],function(_0x31f981){return{'name':_0x31f981[_0xaf3a('0x29')],'type':_0x31f981[_0xaf3a('0x2a')]['key']};});_0x3d2d9a['model']=_[_0xaf3a('0x2b')](_0x264ad1,'name');_0x3d2d9a[_0xaf3a('0x2c')]=_[_0xaf3a('0x2d')](_0xed5ec8[_0xaf3a('0x2c')]);_0x3d2d9a[_0xaf3a('0x2e')]=_[_0xaf3a('0x2f')](_0x3d2d9a[_0xaf3a('0x30')],_0x3d2d9a[_0xaf3a('0x2c')]);_0x44db31[_0xaf3a('0x31')]=_['intersection'](_0x3d2d9a[_0xaf3a('0x30')],qs['fields'](_0xed5ec8[_0xaf3a('0x2c')][_0xaf3a('0x32')]));_0x44db31[_0xaf3a('0x31')]=_0x44db31[_0xaf3a('0x31')][_0xaf3a('0x33')]?_0x44db31[_0xaf3a('0x31')]:_0x3d2d9a[_0xaf3a('0x30')];if(!_0xed5ec8[_0xaf3a('0x2c')][_0xaf3a('0x34')](_0xaf3a('0x35'))){_0x44db31[_0xaf3a('0x1a')]=qs[_0xaf3a('0x1a')](_0xed5ec8[_0xaf3a('0x2c')][_0xaf3a('0x1a')]);_0x44db31[_0xaf3a('0x1c')]=qs[_0xaf3a('0x1c')](_0xed5ec8[_0xaf3a('0x2c')][_0xaf3a('0x1c')]);}_0x44db31[_0xaf3a('0x36')]=qs[_0xaf3a('0x37')](_0xed5ec8[_0xaf3a('0x2c')][_0xaf3a('0x37')]);_0x44db31['where']=qs[_0xaf3a('0x2e')](_[_0xaf3a('0x38')](_0xed5ec8[_0xaf3a('0x2c')],_0x3d2d9a[_0xaf3a('0x2e')]),_0x264ad1);if(_0xed5ec8[_0xaf3a('0x2c')][_0xaf3a('0x39')]){_0x44db31[_0xaf3a('0x3a')]=_['merge'](_0x44db31[_0xaf3a('0x3a')],{'$or':_[_0xaf3a('0x2b')](_0x264ad1,function(_0x551416){if(_0x551416['type']!==_0xaf3a('0x3b')){var _0x21320c={};_0x21320c[_0x551416['name']]={'$like':'%'+_0xed5ec8[_0xaf3a('0x2c')][_0xaf3a('0x39')]+'%'};return _0x21320c;}})});}_0x44db31=_['merge']({},_0x44db31,_0xed5ec8['options']);var _0x2bb2cf={'where':_0x44db31[_0xaf3a('0x3a')]};return db[_0xaf3a('0x3c')]['count'](_0x2bb2cf)[_0xaf3a('0x22')](function(_0x18b56d){_0x75cbba[_0xaf3a('0x1b')]=_0x18b56d;if(_0xed5ec8[_0xaf3a('0x2c')][_0xaf3a('0x3d')]){_0x44db31[_0xaf3a('0x3e')]=[{'all':!![]}];}return db[_0xaf3a('0x3c')][_0xaf3a('0x3f')](_0x44db31);})['then'](function(_0xed0ec5){_0x75cbba[_0xaf3a('0x40')]=_0xed0ec5;return _0x75cbba;})[_0xaf3a('0x22')](respondWithFilteredResult(_0x58bf11,_0x44db31))['catch'](handleError(_0x58bf11,null));};exports[_0xaf3a('0x41')]=function(_0x7344b1,_0x78789e){var _0x1e2d81={'raw':![],'where':{'id':_0x7344b1[_0xaf3a('0x42')]['id']}},_0x2cea40={};_0x2cea40[_0xaf3a('0x30')]=_['keys'](db[_0xaf3a('0x3c')]['rawAttributes']);_0x2cea40[_0xaf3a('0x2c')]=_['keys'](_0x7344b1[_0xaf3a('0x2c')]);_0x2cea40['filters']=_[_0xaf3a('0x2f')](_0x2cea40[_0xaf3a('0x30')],_0x2cea40[_0xaf3a('0x2c')]);_0x1e2d81[_0xaf3a('0x31')]=_[_0xaf3a('0x2f')](_0x2cea40[_0xaf3a('0x30')],qs[_0xaf3a('0x32')](_0x7344b1['query']['fields']));_0x1e2d81['attributes']=_0x1e2d81[_0xaf3a('0x31')]['length']?_0x1e2d81[_0xaf3a('0x31')]:_0x2cea40['model'];if(_0x7344b1['query'][_0xaf3a('0x3d')]){_0x1e2d81[_0xaf3a('0x3e')]=[{'all':!![]}];}_0x1e2d81=_[_0xaf3a('0x43')]({},_0x1e2d81,_0x7344b1[_0xaf3a('0x44')]);return db[_0xaf3a('0x3c')][_0xaf3a('0x45')](_0x1e2d81)[_0xaf3a('0x22')](handleEntityNotFound(_0x78789e,null))[_0xaf3a('0x22')](respondWithResult(_0x78789e,null))[_0xaf3a('0x46')](handleError(_0x78789e,null));};exports[_0xaf3a('0x47')]=function(_0x86c60d,_0x1b2041){return db[_0xaf3a('0x3c')][_0xaf3a('0x47')](_0x86c60d['body'],{})[_0xaf3a('0x22')](respondWithResult(_0x1b2041,0xc9))[_0xaf3a('0x46')](handleError(_0x1b2041,null));};exports['update']=function(_0xa8f85e,_0x4280a4){if(_0xa8f85e[_0xaf3a('0x48')]['id']){delete _0xa8f85e['body']['id'];}return db[_0xaf3a('0x3c')]['find']({'where':{'id':_0xa8f85e[_0xaf3a('0x42')]['id']}})[_0xaf3a('0x22')](handleEntityNotFound(_0x4280a4,null))[_0xaf3a('0x22')](saveUpdates(_0xa8f85e[_0xaf3a('0x48')],null))['then'](respondWithResult(_0x4280a4,null))['catch'](handleError(_0x4280a4,null));};exports[_0xaf3a('0x23')]=function(_0x58afa4,_0xf0738c){return db[_0xaf3a('0x3c')][_0xaf3a('0x45')]({'where':{'id':_0x58afa4[_0xaf3a('0x42')]['id']}})[_0xaf3a('0x22')](handleEntityNotFound(_0xf0738c,null))[_0xaf3a('0x22')](removeEntity(_0xf0738c,null))[_0xaf3a('0x46')](handleError(_0xf0738c,null));};exports['addConditions']=function(_0x4c3e28,_0x634776,_0x2c586f){return db[_0xaf3a('0x49')][_0xaf3a('0x45')]({'where':{'id':_0x4c3e28[_0xaf3a('0x42')]['id']}})[_0xaf3a('0x22')](handleEntityNotFound(_0x634776,null))['then'](function(_0x3a7517){if(_0x3a7517){return _0x3a7517[_0xaf3a('0x4a')](_0x4c3e28[_0xaf3a('0x48')][_0xaf3a('0x4b')],_['omit'](_0x4c3e28[_0xaf3a('0x48')],['ids','id'])||{});}})[_0xaf3a('0x22')](respondWithResult(_0x634776,null))[_0xaf3a('0x46')](handleError(_0x634776,null));};exports[_0xaf3a('0x4c')]=function(_0x420190,_0x279ee4,_0x136f06){var _0x41ff24={};var _0x689939={};var _0x50114c;var _0xc83d0f;return db[_0xaf3a('0x3c')][_0xaf3a('0x4d')]({'where':{'id':_0x420190[_0xaf3a('0x42')]['id']}})[_0xaf3a('0x22')](handleEntityNotFound(_0x279ee4,null))[_0xaf3a('0x22')](function(_0x43578d){if(_0x43578d){_0x50114c=_0x43578d;_0x689939['model']=_[_0xaf3a('0x2d')](db[_0xaf3a('0x49')]['rawAttributes']);_0x689939[_0xaf3a('0x2c')]=_[_0xaf3a('0x2d')](_0x420190[_0xaf3a('0x2c')]);_0x689939['filters']=_['intersection'](_0x689939['model'],_0x689939[_0xaf3a('0x2c')]);_0x41ff24['attributes']=_[_0xaf3a('0x2f')](_0x689939[_0xaf3a('0x30')],qs[_0xaf3a('0x32')](_0x420190[_0xaf3a('0x2c')][_0xaf3a('0x32')]));_0x41ff24[_0xaf3a('0x31')]=_0x41ff24[_0xaf3a('0x31')][_0xaf3a('0x33')]?_0x41ff24[_0xaf3a('0x31')]:_0x689939[_0xaf3a('0x30')];_0x41ff24[_0xaf3a('0x36')]=qs[_0xaf3a('0x37')](_0x420190['query'][_0xaf3a('0x37')]);_0x41ff24['where']=qs['filters'](_['pick'](_0x420190[_0xaf3a('0x2c')],_0x689939['filters']));if(_0x420190[_0xaf3a('0x2c')][_0xaf3a('0x39')]){_0x41ff24[_0xaf3a('0x3a')]=_[_0xaf3a('0x43')](_0x41ff24[_0xaf3a('0x3a')],{'$or':_[_0xaf3a('0x2b')](_0x41ff24[_0xaf3a('0x31')],function(_0xacf0be){var _0x52c5da={};_0x52c5da[_0xacf0be]={'$like':'%'+_0x420190[_0xaf3a('0x2c')]['filter']+'%'};return _0x52c5da;})});}_0x41ff24=_[_0xaf3a('0x43')]({},_0x41ff24,_0x420190['options']);return _0x50114c['getConditions'](_0x41ff24);}})[_0xaf3a('0x22')](function(_0x4598df){if(_0x4598df){_0xc83d0f=_0x4598df['length'];if(!_0x420190[_0xaf3a('0x2c')][_0xaf3a('0x34')](_0xaf3a('0x35'))){_0x41ff24['limit']=qs[_0xaf3a('0x1a')](_0x420190[_0xaf3a('0x2c')][_0xaf3a('0x1a')]);_0x41ff24[_0xaf3a('0x1c')]=qs[_0xaf3a('0x1c')](_0x420190[_0xaf3a('0x2c')][_0xaf3a('0x1c')]);}return _0x50114c['getConditions'](_0x41ff24);}})[_0xaf3a('0x22')](function(_0x59c05d){if(_0x59c05d){return _0x59c05d?{'count':_0xc83d0f,'rows':_0x59c05d}:null;}})[_0xaf3a('0x22')](respondWithResult(_0x279ee4,null))['catch'](handleError(_0x279ee4,null));};exports['addActions']=function(_0x1feacb,_0x216114,_0x17827b){return db[_0xaf3a('0x4e')][_0xaf3a('0x45')]({'where':{'id':_0x1feacb[_0xaf3a('0x42')]['id']}})[_0xaf3a('0x22')](handleEntityNotFound(_0x216114,null))[_0xaf3a('0x22')](function(_0x1cc844){if(_0x1cc844){return _0x1cc844[_0xaf3a('0x4f')](_0x1feacb['body'][_0xaf3a('0x4b')],_[_0xaf3a('0x50')](_0x1feacb[_0xaf3a('0x48')],['ids','id'])||{});}})[_0xaf3a('0x22')](respondWithResult(_0x216114,null))[_0xaf3a('0x46')](handleError(_0x216114,null));};exports[_0xaf3a('0x51')]=function(_0x43bc8d,_0x1b6171,_0x4ce387){var _0xfb96e2={};var _0x54026c={};var _0x53e081;var _0x1e0e26;return db[_0xaf3a('0x3c')][_0xaf3a('0x4d')]({'where':{'id':_0x43bc8d[_0xaf3a('0x42')]['id']}})[_0xaf3a('0x22')](handleEntityNotFound(_0x1b6171,null))[_0xaf3a('0x22')](function(_0x1572fa){if(_0x1572fa){_0x53e081=_0x1572fa;_0x54026c[_0xaf3a('0x30')]=_[_0xaf3a('0x2d')](db[_0xaf3a('0x4e')]['rawAttributes']);_0x54026c[_0xaf3a('0x2c')]=_[_0xaf3a('0x2d')](_0x43bc8d[_0xaf3a('0x2c')]);_0x54026c['filters']=_[_0xaf3a('0x2f')](_0x54026c[_0xaf3a('0x30')],_0x54026c['query']);_0xfb96e2[_0xaf3a('0x31')]=_[_0xaf3a('0x2f')](_0x54026c[_0xaf3a('0x30')],qs[_0xaf3a('0x32')](_0x43bc8d[_0xaf3a('0x2c')][_0xaf3a('0x32')]));_0xfb96e2[_0xaf3a('0x31')]=_0xfb96e2[_0xaf3a('0x31')][_0xaf3a('0x33')]?_0xfb96e2[_0xaf3a('0x31')]:_0x54026c['model'];_0xfb96e2['order']=qs[_0xaf3a('0x37')](_0x43bc8d[_0xaf3a('0x2c')]['sort']);_0xfb96e2['where']=qs[_0xaf3a('0x2e')](_['pick'](_0x43bc8d['query'],_0x54026c[_0xaf3a('0x2e')]));if(_0x43bc8d[_0xaf3a('0x2c')]['filter']){_0xfb96e2[_0xaf3a('0x3a')]=_['merge'](_0xfb96e2[_0xaf3a('0x3a')],{'$or':_[_0xaf3a('0x2b')](_0xfb96e2[_0xaf3a('0x31')],function(_0x14f3f2){var _0x276736={};_0x276736[_0x14f3f2]={'$like':'%'+_0x43bc8d[_0xaf3a('0x2c')][_0xaf3a('0x39')]+'%'};return _0x276736;})});}_0xfb96e2=_[_0xaf3a('0x43')]({},_0xfb96e2,_0x43bc8d[_0xaf3a('0x44')]);return _0x53e081['getActions'](_0xfb96e2);}})['then'](function(_0xe61747){if(_0xe61747){_0x1e0e26=_0xe61747[_0xaf3a('0x33')];if(!_0x43bc8d['query'][_0xaf3a('0x34')](_0xaf3a('0x35'))){_0xfb96e2['limit']=qs[_0xaf3a('0x1a')](_0x43bc8d[_0xaf3a('0x2c')][_0xaf3a('0x1a')]);_0xfb96e2['offset']=qs['offset'](_0x43bc8d['query'][_0xaf3a('0x1c')]);}return _0x53e081['getActions'](_0xfb96e2);}})[_0xaf3a('0x22')](function(_0x50d1d5){if(_0x50d1d5){return _0x50d1d5?{'count':_0x1e0e26,'rows':_0x50d1d5}:null;}})[_0xaf3a('0x22')](respondWithResult(_0x1b6171,null))[_0xaf3a('0x46')](handleError(_0x1b6171,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 2492067..12101d5 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 _0x8073=['exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./automation.attributes'];(function(_0x9eb158,_0x5747d9){var _0x3a15d6=function(_0x52af48){while(--_0x52af48){_0x9eb158['push'](_0x9eb158['shift']());}};_0x3a15d6(++_0x5747d9);}(_0x8073,0xdd));var _0x3807=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x8073[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x3807('0x0'));var util=require(_0x3807('0x1'));var logger=require(_0x3807('0x2'))(_0x3807('0x3'));var moment=require(_0x3807('0x4'));var BPromise=require(_0x3807('0x5'));var rp=require(_0x3807('0x6'));var fs=require('fs');var path=require(_0x3807('0x7'));var rimraf=require(_0x3807('0x8'));var config=require('../../config/environment');var attributes=require(_0x3807('0x9'));module[_0x3807('0xa')]=function(_0x4896e6,_0xf7919a){return _0x4896e6['define']('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06c9=['Automation','tools_automations','lodash','../../config/logger','api','bluebird','../../config/environment','./automation.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x06c9,0x14c));var _0x906c=function(_0x523c36,_0x2bfd8f){_0x523c36=_0x523c36-0x0;var _0x163013=_0x06c9[_0x523c36];return _0x163013;};'use strict';var _=require(_0x906c('0x0'));var util=require('util');var logger=require(_0x906c('0x1'))(_0x906c('0x2'));var moment=require('moment');var BPromise=require(_0x906c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x906c('0x4'));var attributes=require(_0x906c('0x5'));module[_0x906c('0x6')]=function(_0xef8934,_0x1a9219){return _0xef8934[_0x906c('0x7')](_0x906c('0x8'),attributes,{'tableName':_0x906c('0x9'),'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 ac18ebc..cbd6d8d 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 _0x2c16=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','Automation,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x10ec12,_0x59f2af){var _0x37f0da=function(_0x22e830){while(--_0x22e830){_0x10ec12['push'](_0x10ec12['shift']());}};_0x37f0da(++_0x59f2af);}(_0x2c16,0xf0));var _0x62c1=function(_0x580d78,_0x2879e6){_0x580d78=_0x580d78-0x0;var _0x413402=_0x2c16[_0x580d78];return _0x413402;};'use strict';var _=require(_0x62c1('0x0'));var util=require(_0x62c1('0x1'));var moment=require(_0x62c1('0x2'));var BPromise=require('bluebird');var rs=require(_0x62c1('0x3'));var fs=require('fs');var Redis=require(_0x62c1('0x4'));var db=require(_0x62c1('0x5'))['db'];var utils=require(_0x62c1('0x6'));var logger=require(_0x62c1('0x7'))(_0x62c1('0x8'));var config=require(_0x62c1('0x9'));var jayson=require(_0x62c1('0xa'));var client=jayson[_0x62c1('0xb')][_0x62c1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x527671,_0x113a32,_0x4bcc7b){return new BPromise(function(_0x236518,_0x4af828){return client[_0x62c1('0xd')](_0x527671,_0x4bcc7b)['then'](function(_0x153420){logger[_0x62c1('0xe')]('Automation,\x20%s,\x20%s',_0x113a32,_0x62c1('0xf'));logger['debug'](_0x62c1('0x10'),_0x113a32,_0x62c1('0xf'),JSON[_0x62c1('0x11')](_0x153420));if(_0x153420[_0x62c1('0x12')]){if(_0x153420[_0x62c1('0x12')]['code']===0x1f4){logger['error'](_0x62c1('0x13'),_0x113a32,_0x153420[_0x62c1('0x12')]['message']);return _0x4af828(_0x153420['error'][_0x62c1('0x14')]);}logger[_0x62c1('0x12')]('Automation,\x20%s,\x20%s',_0x113a32,_0x153420[_0x62c1('0x12')][_0x62c1('0x14')]);return _0x236518(_0x153420[_0x62c1('0x12')][_0x62c1('0x14')]);}else{logger[_0x62c1('0xe')]('Automation,\x20%s,\x20%s',_0x113a32,_0x62c1('0xf'));_0x236518(_0x153420['result'][_0x62c1('0x14')]);}})[_0x62c1('0x15')](function(_0x969e09){logger[_0x62c1('0x12')](_0x62c1('0x13'),_0x113a32,_0x969e09);_0x4af828(_0x969e09);});});} \ No newline at end of file +var _0xd481=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x252609,_0x24a2ba){var _0x33dca3=function(_0x12aeb6){while(--_0x12aeb6){_0x252609['push'](_0x252609['shift']());}};_0x33dca3(++_0x24a2ba);}(_0xd481,0x1e4));var _0x1d48=function(_0x4f19ef,_0x29d1e0){_0x4f19ef=_0x4f19ef-0x0;var _0x3d7a5f=_0xd481[_0x4f19ef];return _0x3d7a5f;};'use strict';var _=require(_0x1d48('0x0'));var util=require('util');var moment=require(_0x1d48('0x1'));var BPromise=require(_0x1d48('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1d48('0x3'));var db=require(_0x1d48('0x4'))['db'];var utils=require(_0x1d48('0x5'));var logger=require('../../config/logger')(_0x1d48('0x6'));var config=require('../../config/environment');var jayson=require(_0x1d48('0x7'));var client=jayson[_0x1d48('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x472584,_0x3099cc,_0x3b8bd4){return new BPromise(function(_0x27c383,_0x1fc969){return client[_0x1d48('0x9')](_0x472584,_0x3b8bd4)[_0x1d48('0xa')](function(_0x303dce){logger[_0x1d48('0xb')](_0x1d48('0xc'),_0x3099cc,_0x1d48('0xd'));logger[_0x1d48('0xe')]('Automation,\x20%s,\x20%s,\x20%s',_0x3099cc,_0x1d48('0xd'),JSON[_0x1d48('0xf')](_0x303dce));if(_0x303dce[_0x1d48('0x10')]){if(_0x303dce[_0x1d48('0x10')][_0x1d48('0x11')]===0x1f4){logger[_0x1d48('0x10')](_0x1d48('0xc'),_0x3099cc,_0x303dce[_0x1d48('0x10')][_0x1d48('0x12')]);return _0x1fc969(_0x303dce[_0x1d48('0x10')]['message']);}logger[_0x1d48('0x10')]('Automation,\x20%s,\x20%s',_0x3099cc,_0x303dce[_0x1d48('0x10')][_0x1d48('0x12')]);return _0x27c383(_0x303dce[_0x1d48('0x10')][_0x1d48('0x12')]);}else{logger['info'](_0x1d48('0xc'),_0x3099cc,_0x1d48('0xd'));_0x27c383(_0x303dce[_0x1d48('0x13')]['message']);}})[_0x1d48('0x14')](function(_0x433c92){logger[_0x1d48('0x10')](_0x1d48('0xc'),_0x3099cc,_0x433c92);_0x1fc969(_0x433c92);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 6ee65db..e5cca08 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 _0x6dd6=['isAuthenticated','show','/:id/conditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6dd6,0xcc));var _0x66dd=function(_0x4fde83,_0x2d9011){_0x4fde83=_0x4fde83-0x0;var _0x3b33e3=_0x6dd6[_0x4fde83];return _0x3b33e3;};'use strict';var multer=require('multer');var util=require(_0x66dd('0x0'));var path=require(_0x66dd('0x1'));var timeout=require(_0x66dd('0x2'));var express=require(_0x66dd('0x3'));var router=express[_0x66dd('0x4')]();var fs_extra=require(_0x66dd('0x5'));var auth=require(_0x66dd('0x6'));var interaction=require(_0x66dd('0x7'));var config=require(_0x66dd('0x8'));var controller=require('./automation.controller');router[_0x66dd('0x9')]('/',auth['isAuthenticated'](),controller[_0x66dd('0xa')]);router['get'](_0x66dd('0xb'),auth[_0x66dd('0xc')](),controller[_0x66dd('0xd')]);router[_0x66dd('0x9')](_0x66dd('0xe'),auth['isAuthenticated'](),controller['getConditions']);router[_0x66dd('0x9')](_0x66dd('0xf'),auth[_0x66dd('0xc')](),controller[_0x66dd('0x10')]);router[_0x66dd('0x11')]('/',auth[_0x66dd('0xc')](),controller[_0x66dd('0x12')]);router[_0x66dd('0x11')](_0x66dd('0xe'),auth[_0x66dd('0xc')](),controller[_0x66dd('0x13')]);router[_0x66dd('0x11')](_0x66dd('0xf'),auth[_0x66dd('0xc')](),controller[_0x66dd('0x14')]);router[_0x66dd('0x15')](_0x66dd('0xb'),auth['isAuthenticated'](),controller[_0x66dd('0x16')]);router[_0x66dd('0x17')]('/:id',auth[_0x66dd('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x919d=['post','/:id/actions','addActions','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','./automation.controller','get','/:id','isAuthenticated','/:id/conditions','getConditions','getActions','create'];(function(_0x34aafa,_0x1b99a9){var _0x491f40=function(_0x5f211b){while(--_0x5f211b){_0x34aafa['push'](_0x34aafa['shift']());}};_0x491f40(++_0x1b99a9);}(_0x919d,0x1c0));var _0xd919=function(_0x13efc0,_0x1db695){_0x13efc0=_0x13efc0-0x0;var _0xf86e92=_0x919d[_0x13efc0];return _0xf86e92;};'use strict';var multer=require(_0xd919('0x0'));var util=require(_0xd919('0x1'));var path=require(_0xd919('0x2'));var timeout=require(_0xd919('0x3'));var express=require('express');var router=express[_0xd919('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd919('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd919('0x6'));router[_0xd919('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd919('0x7')](_0xd919('0x8'),auth[_0xd919('0x9')](),controller['show']);router[_0xd919('0x7')](_0xd919('0xa'),auth[_0xd919('0x9')](),controller[_0xd919('0xb')]);router[_0xd919('0x7')]('/:id/actions',auth[_0xd919('0x9')](),controller[_0xd919('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd919('0xd')]);router[_0xd919('0xe')](_0xd919('0xa'),auth[_0xd919('0x9')](),controller['addConditions']);router['post'](_0xd919('0xf'),auth['isAuthenticated'](),controller[_0xd919('0x10')]);router[_0xd919('0x11')](_0xd919('0x8'),auth[_0xd919('0x9')](),controller[_0xd919('0x12')]);router[_0xd919('0x13')](_0xd919('0x8'),auth[_0xd919('0x9')](),controller[_0xd919('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 825dbfb..c5fb8f6 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 _0xd7bf=['Random\x20Last\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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','ASC','DESC'];(function(_0x2f637a,_0x4d4bf4){var _0x2e179e=function(_0x252456){while(--_0x252456){_0x2f637a['push'](_0x2f637a['shift']());}};_0x2e179e(++_0x4d4bf4);}(_0xd7bf,0x72));var _0xfd7b=function(_0x292082,_0x268019){_0x292082=_0x292082-0x0;var _0x716341=_0xd7bf[_0x292082];return _0x716341;};'use strict';var Sequelize=require('sequelize');module[_0xfd7b('0x0')]={'name':{'type':Sequelize[_0xfd7b('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xfd7b('0x2')](_0xfd7b('0x3')),'allowNull':![],'defaultValue':_0xfd7b('0x3')},'description':{'type':Sequelize[_0xfd7b('0x1')]},'active':{'type':Sequelize[_0xfd7b('0x4')],'defaultValue':0x0,'comment':_0xfd7b('0x5')},'limitCalls':{'type':Sequelize[_0xfd7b('0x6')](0x4)[_0xfd7b('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xfd7b('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xfd7b('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xfd7b('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7b('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xfd7b('0x6')](0x3)[_0xfd7b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7b('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xfd7b('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7b('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xfd7b('0x6')](0x3)[_0xfd7b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7b('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xfd7b('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xfd7b('0x6')](0x3)[_0xfd7b('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xfd7b('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7b('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0xfd7b('0x6')](0x3)[_0xfd7b('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xfd7b('0xe')},'dialTimezone':{'type':Sequelize[_0xfd7b('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xfd7b('0x2')](_0xfd7b('0xf'),_0xfd7b('0x10'),_0xfd7b('0x11')),'defaultValue':_0xfd7b('0xf')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xfd7b('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xfd7b('0x6')](0x9)[_0xfd7b('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xfd7b('0x13')},'dialAMDGreeting':{'type':Sequelize[_0xfd7b('0x6')](0x9)[_0xfd7b('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xfd7b('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xfd7b('0x6')](0x9)[_0xfd7b('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xfd7b('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xfd7b('0x6')](0x9)[_0xfd7b('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xfd7b('0x6')](0x9)[_0xfd7b('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xfd7b('0x6')](0x9)[_0xfd7b('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xfd7b('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xfd7b('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xfd7b('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xfd7b('0x6')](0x9)[_0xfd7b('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xfd7b('0x2')]('DESC',_0xfd7b('0x18')),'defaultValue':_0xfd7b('0x19')},'dialPrefix':{'type':Sequelize[_0xfd7b('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xfd7b('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xfd7b('0x1a')},'dialCutDigit':{'type':Sequelize[_0xfd7b('0x6')](0x3)[_0xfd7b('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xfd7b('0x6')](0x3)[_0xfd7b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7b('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xfd7b('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xfd7b('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7b('0x1c')},'dialDropRetryFrequency':{'type':Sequelize[_0xfd7b('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7b('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xfd7b('0x6')](0x3)[_0xfd7b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7b('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xfd7b('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7b('0x1f')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xfd7b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xfd7b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7b('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xfd7b('0x6')](0x3)[_0xfd7b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xfd7b('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xfd7b('0x6')](0x5)[_0xfd7b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xfd7b('0x22')}}; \ No newline at end of file +var _0xbd49=['Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','STRING','name','ENUM','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED'];(function(_0xdf8932,_0x2eeca9){var _0x23549b=function(_0x23c1ca){while(--_0x23c1ca){_0xdf8932['push'](_0xdf8932['shift']());}};_0x23549b(++_0x2eeca9);}(_0xbd49,0x86));var _0x9bd4=function(_0x4d5ca9,_0x1e58b1){_0x4d5ca9=_0x4d5ca9-0x0;var _0x523c32=_0xbd49[_0x4d5ca9];return _0x523c32;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9bd4('0x0')],'unique':_0x9bd4('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x9bd4('0x2')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x9bd4('0x0')]},'active':{'type':Sequelize[_0x9bd4('0x3')],'defaultValue':0x0,'comment':_0x9bd4('0x4')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x9bd4('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x9bd4('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x9bd4('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9bd4('0x0')]},'dialOriginateTimeout':{'type':Sequelize[_0x9bd4('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9bd4('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9bd4('0x7')](0x3)[_0x9bd4('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9bd4('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9bd4('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bd4('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9bd4('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9bd4('0x7')](0x5)[_0x9bd4('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bd4('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9bd4('0x7')](0x3)[_0x9bd4('0x5')],'defaultValue':0x3,'comment':_0x9bd4('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9bd4('0x7')](0x5)[_0x9bd4('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bd4('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9bd4('0x7')](0x3)[_0x9bd4('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x9bd4('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9bd4('0x0')],'defaultValue':_0x9bd4('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x9bd4('0x10'),_0x9bd4('0x11'),_0x9bd4('0x12')),'defaultValue':_0x9bd4('0x10')},'dialAMDActive':{'type':Sequelize[_0x9bd4('0x3')],'defaultValue':0x0,'comment':_0x9bd4('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x9bd4('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x9bd4('0x7')](0x9)[_0x9bd4('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x9bd4('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9bd4('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9bd4('0x7')](0x9)[_0x9bd4('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9bd4('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x9bd4('0x7')](0x9)[_0x9bd4('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9bd4('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9bd4('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9bd4('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9bd4('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9bd4('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9bd4('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9bd4('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9bd4('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9bd4('0x2')](_0x9bd4('0x1a'),_0x9bd4('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x9bd4('0x0')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9bd4('0x7')](0x3)[_0x9bd4('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x9bd4('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9bd4('0x7')](0x3)[_0x9bd4('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9bd4('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9bd4('0x7')](0x5)[_0x9bd4('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bd4('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x9bd4('0x7')](0x3)[_0x9bd4('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9bd4('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bd4('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9bd4('0x7')](0x3)[_0x9bd4('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9bd4('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9bd4('0x7')](0x5)[_0x9bd4('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bd4('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x9bd4('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x9bd4('0x7')](0x5)[_0x9bd4('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9bd4('0x7')](0x3)[_0x9bd4('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9bd4('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9bd4('0x7')](0x5)[_0x9bd4('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9bd4('0x22')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index d8a0b78..924fbe1 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 _0xbdd4=['CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','phone','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','onlyIfOpen','updatedAt','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','into','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','removeBlackLists','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','jsforce','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','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','get','UserProfileResource','error','name','index','map','Campaign','rawAttributes','key','model','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','type','options','include','findAll','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','getHoppers','findOne','CmHopper','order','CampaignId','rows','getHopperHistories','hasOwnProperty'];(function(_0x5e8e25,_0x38682c){var _0x2e8ffb=function(_0x356a15){while(--_0x356a15){_0x5e8e25['push'](_0x5e8e25['shift']());}};_0x2e8ffb(++_0x38682c);}(_0xbdd4,0x14e));var _0x4bdd=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xbdd4[_0x481bf7];return _0x461787;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4bdd('0x0'));var jsonpatch=require(_0x4bdd('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4bdd('0x2'));var Mustache=require(_0x4bdd('0x3'));var util=require('util');var path=require(_0x4bdd('0x4'));var sox=require(_0x4bdd('0x5'));var csv=require(_0x4bdd('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4bdd('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4bdd('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x4bdd('0x6'));var querystring=require(_0x4bdd('0x9'));var Papa=require('papaparse');var Redis=require(_0x4bdd('0xa'));var authService=require(_0x4bdd('0xb'));var qs=require(_0x4bdd('0xc'));var as=require(_0x4bdd('0xd'));var hardwareService=require(_0x4bdd('0xe'));var logger=require('../../config/logger')(_0x4bdd('0xf'));var utils=require(_0x4bdd('0x10'));var config=require(_0x4bdd('0x11'));var licenseUtil=require(_0x4bdd('0x12'));var db=require(_0x4bdd('0x13'))['db'];function respondWithStatusCode(_0x4ec3e0,_0x2b8cd8){_0x2b8cd8=_0x2b8cd8||0xcc;return function(_0x387573){if(_0x387573){return _0x4ec3e0[_0x4bdd('0x14')](_0x2b8cd8);}return _0x4ec3e0[_0x4bdd('0x15')](_0x2b8cd8)[_0x4bdd('0x16')]();};}function respondWithResult(_0x40a4a0,_0x39bff4){_0x39bff4=_0x39bff4||0xc8;return function(_0x428353){if(_0x428353){return _0x40a4a0[_0x4bdd('0x15')](_0x39bff4)['json'](_0x428353);}};}function respondWithFilteredResult(_0x4ed860,_0x46d9f9){return function(_0x381b97){if(_0x381b97){var _0x2d0726=typeof _0x46d9f9[_0x4bdd('0x17')]===_0x4bdd('0x18')&&typeof _0x46d9f9[_0x4bdd('0x19')]===_0x4bdd('0x18');var _0x440c54=_0x381b97['count'];var _0xf6c6ba=_0x2d0726?0x0:_0x46d9f9[_0x4bdd('0x17')];var _0x41bb61=_0x2d0726?_0x381b97[_0x4bdd('0x1a')]:_0x46d9f9[_0x4bdd('0x17')]+_0x46d9f9['limit'];var _0x2d1cac;if(_0x41bb61>=_0x440c54){_0x41bb61=_0x440c54;_0x2d1cac=0xc8;}else{_0x2d1cac=0xce;}_0x4ed860['status'](_0x2d1cac);return _0x4ed860[_0x4bdd('0x1b')]('Content-Range',_0xf6c6ba+'-'+_0x41bb61+'/'+_0x440c54)[_0x4bdd('0x1c')](_0x381b97);}return null;};}function patchUpdates(_0xa67e10){return function(_0x3018e3){try{jsonpatch['apply'](_0x3018e3,_0xa67e10,!![]);}catch(_0x26e35c){return BPromise[_0x4bdd('0x1d')](_0x26e35c);}return _0x3018e3[_0x4bdd('0x1e')]();};}function saveUpdates(_0x57480b,_0x5ee2fd){return function(_0x34c9f5){if(_0x34c9f5){return _0x34c9f5[_0x4bdd('0x1f')](_0x57480b)[_0x4bdd('0x20')](function(_0x57005f){return _0x57005f;});}return null;};}function removeEntity(_0x384bc7,_0x2cfdb7){return function(_0x4c7953){if(_0x4c7953){return _0x4c7953[_0x4bdd('0x21')]()[_0x4bdd('0x20')](function(){var _0x228424=_0x4c7953[_0x4bdd('0x22')]({'plain':!![]});var _0x62a34f='IvrCampaigns';return db[_0x4bdd('0x23')]['destroy']({'where':{'type':_0x62a34f,'resourceId':_0x228424['id']}})[_0x4bdd('0x20')](function(){return _0x4c7953;});})[_0x4bdd('0x20')](function(){_0x384bc7[_0x4bdd('0x15')](0xcc)[_0x4bdd('0x16')]();});}};}function handleEntityNotFound(_0x2fdbbf,_0x2c0214){return function(_0xcb953c){if(!_0xcb953c){_0x2fdbbf[_0x4bdd('0x14')](0x194);}return _0xcb953c;};}function handleError(_0x19ab9b,_0x2e5700){_0x2e5700=_0x2e5700||0x1f4;return function(_0x2d9fff){logger[_0x4bdd('0x24')](_0x2d9fff['stack']);if(_0x2d9fff[_0x4bdd('0x25')]){delete _0x2d9fff['name'];}_0x19ab9b[_0x4bdd('0x15')](_0x2e5700)['send'](_0x2d9fff);};}exports[_0x4bdd('0x26')]=function(_0x5be1c7,_0x33feb6){var _0x2fba35={},_0x18bb46={},_0x332d11={'count':0x0,'rows':[]};var _0x3a5ba4=_[_0x4bdd('0x27')](db[_0x4bdd('0x28')][_0x4bdd('0x29')],function(_0x5d1d5b){return{'name':_0x5d1d5b['fieldName'],'type':_0x5d1d5b['type'][_0x4bdd('0x2a')]};});_0x18bb46[_0x4bdd('0x2b')]=_['map'](_0x3a5ba4,_0x4bdd('0x25'));_0x18bb46[_0x4bdd('0x2c')]=_[_0x4bdd('0x2d')](_0x5be1c7['query']);_0x18bb46['filters']=_[_0x4bdd('0x2e')](_0x18bb46['model'],_0x18bb46[_0x4bdd('0x2c')]);_0x2fba35[_0x4bdd('0x2f')]=_[_0x4bdd('0x2e')](_0x18bb46['model'],qs[_0x4bdd('0x30')](_0x5be1c7[_0x4bdd('0x2c')][_0x4bdd('0x30')]));_0x2fba35['attributes']=_0x2fba35[_0x4bdd('0x2f')]['length']?_0x2fba35[_0x4bdd('0x2f')]:_0x18bb46[_0x4bdd('0x2b')];if(!_0x5be1c7['query']['hasOwnProperty'](_0x4bdd('0x31'))){_0x2fba35[_0x4bdd('0x19')]=qs[_0x4bdd('0x19')](_0x5be1c7[_0x4bdd('0x2c')][_0x4bdd('0x19')]);_0x2fba35[_0x4bdd('0x17')]=qs[_0x4bdd('0x17')](_0x5be1c7[_0x4bdd('0x2c')][_0x4bdd('0x17')]);}_0x2fba35['order']=qs[_0x4bdd('0x32')](_0x5be1c7[_0x4bdd('0x2c')][_0x4bdd('0x32')]);_0x2fba35[_0x4bdd('0x33')]=qs[_0x4bdd('0x34')](_[_0x4bdd('0x35')](_0x5be1c7['query'],_0x18bb46['filters']),_0x3a5ba4);if(_0x5be1c7[_0x4bdd('0x2c')][_0x4bdd('0x36')]){_0x2fba35[_0x4bdd('0x33')]=_[_0x4bdd('0x37')](_0x2fba35[_0x4bdd('0x33')],{'$or':_[_0x4bdd('0x27')](_0x3a5ba4,function(_0xdbe854){if(_0xdbe854[_0x4bdd('0x38')]!=='VIRTUAL'){var _0x271766={};_0x271766[_0xdbe854[_0x4bdd('0x25')]]={'$like':'%'+_0x5be1c7[_0x4bdd('0x2c')]['filter']+'%'};return _0x271766;}})});}_0x2fba35=_[_0x4bdd('0x37')]({},_0x2fba35,_0x5be1c7[_0x4bdd('0x39')]);var _0x46b45e={'where':_0x2fba35['where']};return db[_0x4bdd('0x28')][_0x4bdd('0x1a')](_0x46b45e)[_0x4bdd('0x20')](function(_0xbdece6){_0x332d11['count']=_0xbdece6;if(_0x5be1c7[_0x4bdd('0x2c')]['includeAll']){_0x2fba35[_0x4bdd('0x3a')]=[{'all':!![]}];}return db[_0x4bdd('0x28')][_0x4bdd('0x3b')](_0x2fba35);})[_0x4bdd('0x20')](function(_0x202c12){_0x332d11['rows']=_0x202c12;return _0x332d11;})[_0x4bdd('0x20')](respondWithFilteredResult(_0x33feb6,_0x2fba35))[_0x4bdd('0x3c')](handleError(_0x33feb6,null));};exports[_0x4bdd('0x3d')]=function(_0x36cbd3,_0x17f4f3){var _0x1f6c38={'raw':![],'where':{'id':_0x36cbd3[_0x4bdd('0x3e')]['id']}},_0x144b75={};_0x144b75[_0x4bdd('0x2b')]=_['keys'](db[_0x4bdd('0x28')][_0x4bdd('0x29')]);_0x144b75[_0x4bdd('0x2c')]=_[_0x4bdd('0x2d')](_0x36cbd3[_0x4bdd('0x2c')]);_0x144b75['filters']=_[_0x4bdd('0x2e')](_0x144b75[_0x4bdd('0x2b')],_0x144b75[_0x4bdd('0x2c')]);_0x1f6c38[_0x4bdd('0x2f')]=_[_0x4bdd('0x2e')](_0x144b75['model'],qs[_0x4bdd('0x30')](_0x36cbd3[_0x4bdd('0x2c')]['fields']));_0x1f6c38['attributes']=_0x1f6c38[_0x4bdd('0x2f')][_0x4bdd('0x3f')]?_0x1f6c38[_0x4bdd('0x2f')]:_0x144b75[_0x4bdd('0x2b')];if(_0x36cbd3[_0x4bdd('0x2c')][_0x4bdd('0x40')]){_0x1f6c38[_0x4bdd('0x3a')]=[{'all':!![]}];}_0x1f6c38=_[_0x4bdd('0x37')]({},_0x1f6c38,_0x36cbd3[_0x4bdd('0x39')]);return db[_0x4bdd('0x28')][_0x4bdd('0x41')](_0x1f6c38)['then'](handleEntityNotFound(_0x17f4f3,null))[_0x4bdd('0x20')](respondWithResult(_0x17f4f3,null))[_0x4bdd('0x3c')](handleError(_0x17f4f3,null));};exports['create']=function(_0x4428cd,_0xd0c2b){return db[_0x4bdd('0x28')][_0x4bdd('0x42')](_0x4428cd[_0x4bdd('0x43')],{})[_0x4bdd('0x20')](function(_0x3980fd){var _0x1db3ae=_0x4428cd[_0x4bdd('0x44')][_0x4bdd('0x22')]({'plain':!![]});if(!_0x1db3ae)throw new Error(_0x4bdd('0x45'));if(_0x1db3ae['role']===_0x4bdd('0x44')){var _0xcd248d=_0x3980fd[_0x4bdd('0x22')]({'plain':!![]});var _0x30413a=_0x4bdd('0x46');return db[_0x4bdd('0x47')]['find']({'where':{'name':_0x30413a,'userProfileId':_0x1db3ae[_0x4bdd('0x48')]},'raw':!![]})['then'](function(_0x5304ca){if(_0x5304ca&&_0x5304ca[_0x4bdd('0x49')]===0x0){return db[_0x4bdd('0x23')][_0x4bdd('0x42')]({'name':_0xcd248d[_0x4bdd('0x25')],'resourceId':_0xcd248d['id'],'type':_0x5304ca[_0x4bdd('0x25')],'sectionId':_0x5304ca['id']},{})[_0x4bdd('0x20')](function(){return _0x3980fd;});}else{return _0x3980fd;}})[_0x4bdd('0x3c')](function(_0x4073d3){logger['error'](_0x4bdd('0x4a'),_0x4073d3);throw _0x4073d3;});}return _0x3980fd;})['then'](respondWithResult(_0xd0c2b,0xc9))['catch'](handleError(_0xd0c2b,null));};exports[_0x4bdd('0x4b')]=function(_0x1aa85d,_0x22905a){var _0x5b6d45={'where':{'id':_0x1aa85d[_0x4bdd('0x3e')]['id']}},_0x4d8a5c={};_0x4d8a5c[_0x4bdd('0x2b')]=_[_0x4bdd('0x2d')](db[_0x4bdd('0x28')]['rawAttributes']);_0x5b6d45['attributes']=_[_0x4bdd('0x2e')](_0x4d8a5c['model'],qs[_0x4bdd('0x30')](_0x1aa85d[_0x4bdd('0x2c')]['fields']));_0x5b6d45['attributes']=_0x5b6d45['attributes'][_0x4bdd('0x3f')]?_0x5b6d45[_0x4bdd('0x2f')]:_0x4d8a5c[_0x4bdd('0x2b')];if(_0x1aa85d[_0x4bdd('0x2c')][_0x4bdd('0x40')]){_0x5b6d45['include']=[{'all':!![]}];}_0x5b6d45=_[_0x4bdd('0x37')]({},_0x5b6d45,_0x1aa85d['options']);return db[_0x4bdd('0x28')][_0x4bdd('0x41')](_0x5b6d45)[_0x4bdd('0x20')](handleEntityNotFound(_0x22905a,null))['then'](function(_0x538707){if(_0x538707){var _0x51c85a=_0x538707[_0x4bdd('0x22')]({'plain':!![]});_0x51c85a=qs[_0x4bdd('0x4c')](_0x51c85a,['id',_0x4bdd('0x4d'),'updatedAt']);_0x1aa85d[_0x4bdd('0x43')]=_['omit'](_0x1aa85d[_0x4bdd('0x43')],['id',_0x4bdd('0x4d'),'updatedAt']);return db['Campaign'][_0x4bdd('0x42')](_[_0x4bdd('0x37')](_0x51c85a,_0x1aa85d[_0x4bdd('0x43')]),{'include':_0x1aa85d[_0x4bdd('0x2c')][_0x4bdd('0x40')]?[{'all':!![]}]:undefined})[_0x4bdd('0x20')](function(_0x4e742c){var _0x4ec81f=_0x1aa85d[_0x4bdd('0x44')][_0x4bdd('0x22')]({'plain':!![]});if(!_0x4ec81f)throw new Error(_0x4bdd('0x45'));if(_0x4ec81f['role']==='user'){var _0x316e4f=_0x4e742c[_0x4bdd('0x22')]({'plain':!![]});var _0x161132=_0x4bdd('0x46');return db[_0x4bdd('0x47')]['find']({'where':{'name':_0x161132,'userProfileId':_0x4ec81f[_0x4bdd('0x48')]},'raw':!![]})['then'](function(_0x2ef5a8){if(_0x2ef5a8&&_0x2ef5a8['autoAssociation']===0x0){return db[_0x4bdd('0x23')][_0x4bdd('0x42')]({'name':_0x316e4f[_0x4bdd('0x25')],'resourceId':_0x316e4f['id'],'type':_0x2ef5a8['name'],'sectionId':_0x2ef5a8['id']},{})[_0x4bdd('0x20')](function(){return _0x4e742c;});}else{return _0x4e742c;}})['catch'](function(_0x51c039){logger[_0x4bdd('0x24')](_0x4bdd('0x4a'),_0x51c039);throw _0x51c039;});}return _0x4e742c;});}})[_0x4bdd('0x20')](respondWithResult(_0x22905a,0xc9))[_0x4bdd('0x3c')](handleError(_0x22905a,null));};exports[_0x4bdd('0x1f')]=function(_0x28940c,_0x20871b){if(_0x28940c['body']['id']){delete _0x28940c['body']['id'];}return db['Campaign'][_0x4bdd('0x41')]({'where':{'id':_0x28940c[_0x4bdd('0x3e')]['id']}})[_0x4bdd('0x20')](handleEntityNotFound(_0x20871b,null))[_0x4bdd('0x20')](saveUpdates(_0x28940c[_0x4bdd('0x43')],null))['then'](respondWithResult(_0x20871b,null))['catch'](handleError(_0x20871b,null));};exports[_0x4bdd('0x21')]=function(_0x1567b3,_0x30a2fe){return db['Campaign'][_0x4bdd('0x41')]({'where':{'id':_0x1567b3[_0x4bdd('0x3e')]['id']}})[_0x4bdd('0x20')](handleEntityNotFound(_0x30a2fe,null))['then'](removeEntity(_0x30a2fe,null))['catch'](handleError(_0x30a2fe,null));};exports[_0x4bdd('0x4e')]=function(_0x138644,_0x5696b4,_0x2ddcb1){var _0x42d17c={'raw':!![],'where':{}};var _0x560814={};var _0x398a7d={'count':0x0,'rows':[]};return db[_0x4bdd('0x28')][_0x4bdd('0x4f')]({'where':{'id':_0x138644[_0x4bdd('0x3e')]['id']}})[_0x4bdd('0x20')](handleEntityNotFound(_0x5696b4,null))[_0x4bdd('0x20')](function(_0x4a48f9){if(_0x4a48f9){_0x560814[_0x4bdd('0x2b')]=_[_0x4bdd('0x2d')](db[_0x4bdd('0x50')][_0x4bdd('0x29')]);_0x560814[_0x4bdd('0x2c')]=_['keys'](_0x138644[_0x4bdd('0x2c')]);_0x560814[_0x4bdd('0x34')]=_[_0x4bdd('0x2e')](_0x560814[_0x4bdd('0x2b')],_0x560814[_0x4bdd('0x2c')]);_0x42d17c[_0x4bdd('0x2f')]=_[_0x4bdd('0x2e')](_0x560814[_0x4bdd('0x2b')],qs[_0x4bdd('0x30')](_0x138644['query'][_0x4bdd('0x30')]));_0x42d17c['attributes']=_0x42d17c[_0x4bdd('0x2f')][_0x4bdd('0x3f')]?_0x42d17c[_0x4bdd('0x2f')]:_0x560814[_0x4bdd('0x2b')];if(!_0x138644[_0x4bdd('0x2c')]['hasOwnProperty'](_0x4bdd('0x31'))){_0x42d17c[_0x4bdd('0x19')]=qs[_0x4bdd('0x19')](_0x138644[_0x4bdd('0x2c')]['limit']);_0x42d17c[_0x4bdd('0x17')]=qs[_0x4bdd('0x17')](_0x138644['query'][_0x4bdd('0x17')]);}_0x42d17c[_0x4bdd('0x51')]=qs['sort'](_0x138644[_0x4bdd('0x2c')][_0x4bdd('0x32')]);_0x42d17c[_0x4bdd('0x33')]=qs[_0x4bdd('0x34')](_[_0x4bdd('0x35')](_0x138644[_0x4bdd('0x2c')],_0x560814['filters']));_0x42d17c['where'][_0x4bdd('0x52')]=_0x4a48f9['id'];if(_0x138644[_0x4bdd('0x2c')][_0x4bdd('0x36')]){_0x42d17c[_0x4bdd('0x33')]=_[_0x4bdd('0x37')](_0x42d17c['where'],{'$or':_[_0x4bdd('0x27')](_0x42d17c['attributes'],function(_0x5b5a08){var _0x5edfc2={};_0x5edfc2[_0x5b5a08]={'$like':'%'+_0x138644['query'][_0x4bdd('0x36')]+'%'};return _0x5edfc2;})});}_0x42d17c=_[_0x4bdd('0x37')]({},_0x42d17c,_0x138644['options']);return db[_0x4bdd('0x50')][_0x4bdd('0x1a')]({'where':_0x42d17c['where']})[_0x4bdd('0x20')](function(_0x16daa0){_0x398a7d[_0x4bdd('0x1a')]=_0x16daa0;if(_0x138644[_0x4bdd('0x2c')][_0x4bdd('0x40')]){_0x42d17c[_0x4bdd('0x3a')]=[{'all':!![]}];}return db[_0x4bdd('0x50')][_0x4bdd('0x3b')](_0x42d17c);})[_0x4bdd('0x20')](function(_0x13b36a){_0x398a7d[_0x4bdd('0x53')]=_0x13b36a;return _0x398a7d;});}})['then'](respondWithFilteredResult(_0x5696b4,_0x42d17c))[_0x4bdd('0x3c')](handleError(_0x5696b4,null));};exports[_0x4bdd('0x54')]=function(_0x2a1f51,_0x90a3a2,_0x3cc479){var _0x491e3e={'raw':!![],'where':{}};var _0x1197a9={};var _0x31a19a={'count':0x0,'rows':[]};return db[_0x4bdd('0x28')][_0x4bdd('0x4f')]({'where':{'id':_0x2a1f51['params']['id']}})[_0x4bdd('0x20')](handleEntityNotFound(_0x90a3a2,null))[_0x4bdd('0x20')](function(_0x313017){if(_0x313017){_0x1197a9[_0x4bdd('0x2b')]=_[_0x4bdd('0x2d')](db['CmHopperHistory'][_0x4bdd('0x29')]);_0x1197a9[_0x4bdd('0x2c')]=_['keys'](_0x2a1f51['query']);_0x1197a9[_0x4bdd('0x34')]=_['intersection'](_0x1197a9['model'],_0x1197a9[_0x4bdd('0x2c')]);_0x491e3e[_0x4bdd('0x2f')]=_[_0x4bdd('0x2e')](_0x1197a9[_0x4bdd('0x2b')],qs[_0x4bdd('0x30')](_0x2a1f51[_0x4bdd('0x2c')][_0x4bdd('0x30')]));_0x491e3e['attributes']=_0x491e3e[_0x4bdd('0x2f')][_0x4bdd('0x3f')]?_0x491e3e[_0x4bdd('0x2f')]:_0x1197a9[_0x4bdd('0x2b')];if(!_0x2a1f51[_0x4bdd('0x2c')][_0x4bdd('0x55')](_0x4bdd('0x31'))){_0x491e3e['limit']=qs[_0x4bdd('0x19')](_0x2a1f51['query'][_0x4bdd('0x19')]);_0x491e3e[_0x4bdd('0x17')]=qs[_0x4bdd('0x17')](_0x2a1f51[_0x4bdd('0x2c')]['offset']);}_0x491e3e[_0x4bdd('0x51')]=qs[_0x4bdd('0x32')](_0x2a1f51[_0x4bdd('0x2c')][_0x4bdd('0x32')]);_0x491e3e[_0x4bdd('0x33')]=qs[_0x4bdd('0x34')](_['pick'](_0x2a1f51[_0x4bdd('0x2c')],_0x1197a9['filters']));_0x491e3e[_0x4bdd('0x33')][_0x4bdd('0x52')]=_0x313017['id'];if(_0x2a1f51[_0x4bdd('0x2c')]['filter']){_0x491e3e['where']=_[_0x4bdd('0x37')](_0x491e3e['where'],{'$or':_['map'](_0x491e3e[_0x4bdd('0x2f')],function(_0x2491e7){var _0x43caad={};_0x43caad[_0x2491e7]={'$like':'%'+_0x2a1f51[_0x4bdd('0x2c')][_0x4bdd('0x36')]+'%'};return _0x43caad;})});}_0x491e3e=_[_0x4bdd('0x37')]({},_0x491e3e,_0x2a1f51[_0x4bdd('0x39')]);return db['CmHopperHistory']['count']({'where':_0x491e3e[_0x4bdd('0x33')]})[_0x4bdd('0x20')](function(_0x403773){_0x31a19a[_0x4bdd('0x1a')]=_0x403773;if(_0x2a1f51[_0x4bdd('0x2c')][_0x4bdd('0x40')]){_0x491e3e[_0x4bdd('0x3a')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x4bdd('0x3b')](_0x491e3e);})['then'](function(_0xcfc4b7){_0x31a19a[_0x4bdd('0x53')]=_0xcfc4b7;return _0x31a19a;});}})[_0x4bdd('0x20')](respondWithFilteredResult(_0x90a3a2,_0x491e3e))[_0x4bdd('0x3c')](handleError(_0x90a3a2,null));};exports['getHopperFinals']=function(_0x2b17a7,_0x223b4a,_0x4080f0){var _0x2c6471={'raw':!![],'where':{}};var _0x21d719={};var _0x14c523={'count':0x0,'rows':[]};return db[_0x4bdd('0x28')]['findOne']({'where':{'id':_0x2b17a7['params']['id']}})['then'](handleEntityNotFound(_0x223b4a,null))['then'](function(_0x43e2c6){if(_0x43e2c6){_0x21d719['model']=_[_0x4bdd('0x2d')](db[_0x4bdd('0x56')][_0x4bdd('0x29')]);_0x21d719['query']=_[_0x4bdd('0x2d')](_0x2b17a7[_0x4bdd('0x2c')]);_0x21d719[_0x4bdd('0x34')]=_[_0x4bdd('0x2e')](_0x21d719[_0x4bdd('0x2b')],_0x21d719[_0x4bdd('0x2c')]);_0x2c6471[_0x4bdd('0x2f')]=_['intersection'](_0x21d719[_0x4bdd('0x2b')],qs[_0x4bdd('0x30')](_0x2b17a7[_0x4bdd('0x2c')][_0x4bdd('0x30')]));_0x2c6471[_0x4bdd('0x2f')]=_0x2c6471[_0x4bdd('0x2f')][_0x4bdd('0x3f')]?_0x2c6471[_0x4bdd('0x2f')]:_0x21d719[_0x4bdd('0x2b')];if(!_0x2b17a7['query'][_0x4bdd('0x55')]('nolimit')){_0x2c6471['limit']=qs[_0x4bdd('0x19')](_0x2b17a7['query'][_0x4bdd('0x19')]);_0x2c6471[_0x4bdd('0x17')]=qs['offset'](_0x2b17a7[_0x4bdd('0x2c')][_0x4bdd('0x17')]);}_0x2c6471[_0x4bdd('0x51')]=qs[_0x4bdd('0x32')](_0x2b17a7['query'][_0x4bdd('0x32')]);_0x2c6471[_0x4bdd('0x33')]=qs[_0x4bdd('0x34')](_[_0x4bdd('0x35')](_0x2b17a7[_0x4bdd('0x2c')],_0x21d719[_0x4bdd('0x34')]));_0x2c6471[_0x4bdd('0x33')][_0x4bdd('0x52')]=_0x43e2c6['id'];if(_0x2b17a7['query'][_0x4bdd('0x36')]){_0x2c6471[_0x4bdd('0x33')]=_[_0x4bdd('0x37')](_0x2c6471['where'],{'$or':_[_0x4bdd('0x27')](_0x2c6471[_0x4bdd('0x2f')],function(_0xbd3bd0){var _0x4a279a={};_0x4a279a[_0xbd3bd0]={'$like':'%'+_0x2b17a7['query']['filter']+'%'};return _0x4a279a;})});}_0x2c6471=_[_0x4bdd('0x37')]({},_0x2c6471,_0x2b17a7[_0x4bdd('0x39')]);return db['CmHopperFinal'][_0x4bdd('0x1a')]({'where':_0x2c6471[_0x4bdd('0x33')]})[_0x4bdd('0x20')](function(_0x3ba20e){_0x14c523['count']=_0x3ba20e;if(_0x2b17a7['query'][_0x4bdd('0x40')]){_0x2c6471['include']=[{'all':!![]}];}return db[_0x4bdd('0x56')][_0x4bdd('0x3b')](_0x2c6471);})[_0x4bdd('0x20')](function(_0x2bc588){_0x14c523['rows']=_0x2bc588;return _0x14c523;});}})[_0x4bdd('0x20')](respondWithFilteredResult(_0x223b4a,_0x2c6471))[_0x4bdd('0x3c')](handleError(_0x223b4a,null));};exports[_0x4bdd('0x57')]=function(_0x3ac58b,_0x2ce7b5,_0x365a3f){var _0xf4724d={'raw':!![],'where':{}};var _0x2aa590={};var _0x5e4cdf={'count':0x0,'rows':[]};return db['Campaign'][_0x4bdd('0x4f')]({'where':{'id':_0x3ac58b[_0x4bdd('0x3e')]['id']}})[_0x4bdd('0x20')](handleEntityNotFound(_0x2ce7b5,null))[_0x4bdd('0x20')](function(_0x41e362){if(_0x41e362){_0x2aa590[_0x4bdd('0x2b')]=_['keys'](db[_0x4bdd('0x58')]['rawAttributes']);_0x2aa590[_0x4bdd('0x2c')]=_[_0x4bdd('0x2d')](_0x3ac58b[_0x4bdd('0x2c')]);_0x2aa590[_0x4bdd('0x34')]=_['intersection'](_0x2aa590[_0x4bdd('0x2b')],_0x2aa590['query']);_0xf4724d['attributes']=_[_0x4bdd('0x2e')](_0x2aa590[_0x4bdd('0x2b')],qs['fields'](_0x3ac58b[_0x4bdd('0x2c')][_0x4bdd('0x30')]));_0xf4724d[_0x4bdd('0x2f')]=_0xf4724d[_0x4bdd('0x2f')]['length']?_0xf4724d[_0x4bdd('0x2f')]:_0x2aa590[_0x4bdd('0x2b')];if(!_0x3ac58b[_0x4bdd('0x2c')][_0x4bdd('0x55')]('nolimit')){_0xf4724d[_0x4bdd('0x19')]=qs[_0x4bdd('0x19')](_0x3ac58b['query'][_0x4bdd('0x19')]);_0xf4724d[_0x4bdd('0x17')]=qs[_0x4bdd('0x17')](_0x3ac58b[_0x4bdd('0x2c')][_0x4bdd('0x17')]);}_0xf4724d['order']=qs[_0x4bdd('0x32')](_0x3ac58b[_0x4bdd('0x2c')][_0x4bdd('0x32')]);_0xf4724d[_0x4bdd('0x33')]=qs['filters'](_[_0x4bdd('0x35')](_0x3ac58b[_0x4bdd('0x2c')],_0x2aa590[_0x4bdd('0x34')]));_0xf4724d[_0x4bdd('0x33')][_0x4bdd('0x52')]=_0x41e362['id'];if(_0x3ac58b[_0x4bdd('0x2c')][_0x4bdd('0x36')]){_0xf4724d['where']=_[_0x4bdd('0x37')](_0xf4724d[_0x4bdd('0x33')],{'$or':_[_0x4bdd('0x27')](_0xf4724d[_0x4bdd('0x2f')],function(_0x4b155d){var _0x58b281={};_0x58b281[_0x4b155d]={'$like':'%'+_0x3ac58b['query'][_0x4bdd('0x36')]+'%'};return _0x58b281;})});}_0xf4724d=_[_0x4bdd('0x37')]({},_0xf4724d,_0x3ac58b['options']);return db['CmHopperBlack']['count']({'where':_0xf4724d[_0x4bdd('0x33')]})[_0x4bdd('0x20')](function(_0x1f943e){_0x5e4cdf[_0x4bdd('0x1a')]=_0x1f943e;if(_0x3ac58b[_0x4bdd('0x2c')][_0x4bdd('0x40')]){_0xf4724d['include']=[{'all':!![]}];}return db[_0x4bdd('0x58')][_0x4bdd('0x3b')](_0xf4724d);})[_0x4bdd('0x20')](function(_0x42c960){_0x5e4cdf[_0x4bdd('0x53')]=_0x42c960;return _0x5e4cdf;});}})[_0x4bdd('0x20')](respondWithFilteredResult(_0x2ce7b5,_0xf4724d))[_0x4bdd('0x3c')](handleError(_0x2ce7b5,null));};exports[_0x4bdd('0x59')]=function(_0x4007a8,_0x3c1f17,_0x11c78a){var _0x2dc4aa={};var _0x2c7c70={};var _0x30d6b0;var _0x206b07;return db['Campaign'][_0x4bdd('0x4f')]({'where':{'id':_0x4007a8[_0x4bdd('0x3e')]['id']}})[_0x4bdd('0x20')](handleEntityNotFound(_0x3c1f17,null))['then'](function(_0x419fc2){if(_0x419fc2){_0x30d6b0=_0x419fc2;_0x2c7c70[_0x4bdd('0x2b')]=_[_0x4bdd('0x2d')](db[_0x4bdd('0x5a')]['rawAttributes']);_0x2c7c70[_0x4bdd('0x2c')]=_['keys'](_0x4007a8[_0x4bdd('0x2c')]);_0x2c7c70['filters']=_[_0x4bdd('0x2e')](_0x2c7c70['model'],_0x2c7c70[_0x4bdd('0x2c')]);_0x2dc4aa[_0x4bdd('0x2f')]=_[_0x4bdd('0x2e')](_0x2c7c70[_0x4bdd('0x2b')],qs[_0x4bdd('0x30')](_0x4007a8[_0x4bdd('0x2c')][_0x4bdd('0x30')]));_0x2dc4aa['attributes']=_0x2dc4aa['attributes']['length']?_0x2dc4aa[_0x4bdd('0x2f')]:_0x2c7c70[_0x4bdd('0x2b')];_0x2dc4aa[_0x4bdd('0x51')]=qs[_0x4bdd('0x32')](_0x4007a8[_0x4bdd('0x2c')][_0x4bdd('0x32')]);_0x2dc4aa[_0x4bdd('0x33')]=qs[_0x4bdd('0x34')](_[_0x4bdd('0x35')](_0x4007a8[_0x4bdd('0x2c')],_0x2c7c70[_0x4bdd('0x34')]));if(_0x4007a8[_0x4bdd('0x2c')][_0x4bdd('0x36')]){_0x2dc4aa[_0x4bdd('0x33')]=_[_0x4bdd('0x37')](_0x2dc4aa[_0x4bdd('0x33')],{'$or':_[_0x4bdd('0x27')](_0x2dc4aa[_0x4bdd('0x2f')],function(_0x5cd80b){var _0x383654={};_0x383654[_0x5cd80b]={'$like':'%'+_0x4007a8['query']['filter']+'%'};return _0x383654;})});}_0x2dc4aa=_['merge']({},_0x2dc4aa,_0x4007a8[_0x4bdd('0x39')]);return _0x30d6b0[_0x4bdd('0x59')](_0x2dc4aa);}})['then'](function(_0x1d0c74){if(_0x1d0c74){_0x206b07=_0x1d0c74[_0x4bdd('0x3f')];if(!_0x4007a8['query'][_0x4bdd('0x55')](_0x4bdd('0x31'))){_0x2dc4aa['limit']=qs['limit'](_0x4007a8['query']['limit']);_0x2dc4aa['offset']=qs['offset'](_0x4007a8[_0x4bdd('0x2c')]['offset']);}return _0x30d6b0[_0x4bdd('0x59')](_0x2dc4aa);}})['then'](function(_0x53209f){if(_0x53209f){return _0x53209f?{'count':_0x206b07,'rows':_0x53209f}:null;}})[_0x4bdd('0x20')](respondWithResult(_0x3c1f17,null))[_0x4bdd('0x3c')](handleError(_0x3c1f17,null));};exports[_0x4bdd('0x5b')]=function(_0x973771,_0x45eed1,_0x4bd4c3){var _0x48267c,_0xfe2e2f;var _0xc1a9bb=[];var _0x566d32=moment()['format'](_0x4bdd('0x5c'));return db[_0x4bdd('0x28')][_0x4bdd('0x41')]({'where':{'id':_0x973771[_0x4bdd('0x3e')]['id']}})['then'](handleEntityNotFound(_0x45eed1,null))[_0x4bdd('0x20')](function(_0x32abfa){if(_0x32abfa){_0xfe2e2f=_0x32abfa;return _0x32abfa[_0x4bdd('0x5b')](_0x973771[_0x4bdd('0x43')][_0x4bdd('0x5d')],_[_0x4bdd('0x4c')](_0x973771[_0x4bdd('0x43')],[_0x4bdd('0x5d'),'id'])||{});}return null;})[_0x4bdd('0x5e')](function(_0x5ad60e){var _0x4ce4ee;var _0x269c20;_0x48267c=_0x5ad60e||[];var _0x508978=[];if(_0x5ad60e){for(var _0x46c357=0x0;_0x46c357<_0x5ad60e[_0x4bdd('0x3f')];_0x46c357+=0x1){var _0x1335ce=_0x5ad60e[_0x46c357][_0x4bdd('0x22')]({'plain':!![]});_0xfe2e2f[_0x4bdd('0x5f')]=_0x973771[_0x4bdd('0x43')][_0x4bdd('0x5f')]?_0x973771[_0x4bdd('0x43')][_0x4bdd('0x5f')]:_0xfe2e2f[_0x4bdd('0x5f')];switch(_0xfe2e2f['dialCheckDuplicateType']){case _0x4bdd('0x60'):_0x4ce4ee=squel[_0x4bdd('0x61')]()['into'](_0x4bdd('0x62'))[_0x4bdd('0x63')](['phone',_0x4bdd('0x64'),_0x4bdd('0x65'),_0x4bdd('0x66'),_0x4bdd('0x52'),_0x4bdd('0x4d'),'updatedAt'],squel[_0x4bdd('0x67')]()['field'](_0x4bdd('0x68'),_0x4bdd('0x68'))[_0x4bdd('0x69')](_0x4bdd('0x6a'),_0x4bdd('0x64'))[_0x4bdd('0x69')]('id',_0x4bdd('0x65'))['field'](_0x1335ce[_0x4bdd('0x6b')]['toString'](),_0x4bdd('0x66'))[_0x4bdd('0x69')](_0x973771[_0x4bdd('0x3e')]['id'][_0x4bdd('0x6c')](),_0x4bdd('0x52'))[_0x4bdd('0x69')]('\x27'+_0x566d32+'\x27',_0x4bdd('0x4d'))[_0x4bdd('0x69')]('\x27'+_0x566d32+'\x27','updatedAt')[_0x4bdd('0x6d')](_0x4bdd('0x6e'))['where'](_0x4bdd('0x6f'))['where'](_0x4bdd('0x70'),_0x1335ce['CmListId'][_0x4bdd('0x6c')]())[_0x4bdd('0x33')]('phone\x20IS\x20NOT\x20NULL')[_0x4bdd('0x33')](_0x4bdd('0x71'),squel[_0x4bdd('0x67')]()[_0x4bdd('0x69')]('COALESCE(calleridnum,\x27\x27)')[_0x4bdd('0x6d')](_0x4bdd('0x72'))['where']('CampaignId\x20=\x20?',_0x973771[_0x4bdd('0x3e')]['id']['toString']()))[_0x4bdd('0x33')](_0x4bdd('0x71'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0x4bdd('0x6d')](_0x4bdd('0x62'))['where']('CampaignId\x20=\x20?',_0x973771[_0x4bdd('0x3e')]['id'][_0x4bdd('0x6c')]())))[_0x4bdd('0x6c')]();break;case _0x4bdd('0x73'):_0x4ce4ee=squel['insert']()['into'](_0x4bdd('0x62'))[_0x4bdd('0x63')](['phone',_0x4bdd('0x64'),_0x4bdd('0x65'),'ListId','CampaignId',_0x4bdd('0x4d'),_0x4bdd('0x74')],squel[_0x4bdd('0x67')]()['field'](_0x4bdd('0x68'),_0x4bdd('0x68'))[_0x4bdd('0x69')](_0x4bdd('0x6a'),_0x4bdd('0x64'))[_0x4bdd('0x69')]('id',_0x4bdd('0x65'))[_0x4bdd('0x69')](_0x1335ce[_0x4bdd('0x6b')][_0x4bdd('0x6c')](),_0x4bdd('0x66'))[_0x4bdd('0x69')](_0x973771[_0x4bdd('0x3e')]['id']['toString'](),'CampaignId')[_0x4bdd('0x69')]('\x27'+_0x566d32+'\x27',_0x4bdd('0x4d'))['field']('\x27'+_0x566d32+'\x27',_0x4bdd('0x74'))[_0x4bdd('0x6d')](_0x4bdd('0x6e'))[_0x4bdd('0x33')](_0x4bdd('0x6f'))[_0x4bdd('0x33')](_0x4bdd('0x70'),_0x1335ce[_0x4bdd('0x6b')]['toString']())[_0x4bdd('0x33')](_0x4bdd('0x75'))[_0x4bdd('0x33')](_0x4bdd('0x71'),squel[_0x4bdd('0x67')]()[_0x4bdd('0x69')](_0x4bdd('0x76'))[_0x4bdd('0x6d')]('cm_hopper')[_0x4bdd('0x33')](_0x4bdd('0x77'),_0x973771[_0x4bdd('0x3e')]['id'][_0x4bdd('0x6c')]())))[_0x4bdd('0x6c')]();break;default:_0x4ce4ee=squel[_0x4bdd('0x61')]()[_0x4bdd('0x78')]('cm_hopper')['fromQuery']([_0x4bdd('0x68'),_0x4bdd('0x64'),_0x4bdd('0x65'),_0x4bdd('0x66'),_0x4bdd('0x52'),'createdAt',_0x4bdd('0x74')],squel[_0x4bdd('0x67')]()[_0x4bdd('0x69')](_0x4bdd('0x68'),_0x4bdd('0x68'))['field']('NOW()','scheduledAt')['field']('id',_0x4bdd('0x65'))[_0x4bdd('0x69')](_0x1335ce['CmListId'][_0x4bdd('0x6c')](),'ListId')[_0x4bdd('0x69')](_0x973771[_0x4bdd('0x3e')]['id'][_0x4bdd('0x6c')](),'CampaignId')[_0x4bdd('0x69')]('\x27'+_0x566d32+'\x27',_0x4bdd('0x4d'))['field']('\x27'+_0x566d32+'\x27',_0x4bdd('0x74'))['from']('cm_contacts')[_0x4bdd('0x33')]('deletedAt\x20IS\x20NULL')[_0x4bdd('0x33')]('ListId\x20=\x20?',_0x1335ce[_0x4bdd('0x6b')][_0x4bdd('0x6c')]())[_0x4bdd('0x33')](_0x4bdd('0x75')))[_0x4bdd('0x6c')]();}_0x269c20=squel['insert']()[_0x4bdd('0x78')](_0x4bdd('0x79'))[_0x4bdd('0x63')]([_0x4bdd('0x7a'),'scheduledAt','phone',_0x4bdd('0x7b'),_0x4bdd('0x4d'),_0x4bdd('0x74')],squel['select']()['field'](_0x4bdd('0x7c'),'id')[_0x4bdd('0x69')]('NOW()',_0x4bdd('0x64'))[_0x4bdd('0x69')](_0x4bdd('0x7d'),_0x4bdd('0x68'))[_0x4bdd('0x69')](_0x4bdd('0x7e'),'OrderBy')[_0x4bdd('0x69')]('\x27'+_0x566d32+'\x27','createdAt')['field']('\x27'+_0x566d32+'\x27',_0x4bdd('0x74'))[_0x4bdd('0x6d')](_0x4bdd('0x7f'),'ci')[_0x4bdd('0x80')](_0x4bdd('0x62'),'h',_0x4bdd('0x81'))[_0x4bdd('0x33')](_0x4bdd('0x82'),_0x1335ce[_0x4bdd('0x6b')]['toString']())[_0x4bdd('0x33')]('h.CampaignId=?',_0x973771[_0x4bdd('0x3e')]['id'][_0x4bdd('0x6c')]())[_0x4bdd('0x33')](_0x4bdd('0x83'),_0x566d32))[_0x4bdd('0x6c')]();_0x508978[_0x4bdd('0x84')](db[_0x4bdd('0x85')][_0x4bdd('0x2c')](_0x4ce4ee));_0xc1a9bb[_0x4bdd('0x84')](db[_0x4bdd('0x85')][_0x4bdd('0x2c')](_0x269c20));}return BPromise[_0x4bdd('0x86')](_0x508978);}})[_0x4bdd('0x20')](function(){return BPromise[_0x4bdd('0x86')](_0xc1a9bb);})[_0x4bdd('0x20')](function(){return _0x48267c;})[_0x4bdd('0x20')](respondWithResult(_0x45eed1,null))[_0x4bdd('0x3c')](handleError(_0x45eed1,null));};exports[_0x4bdd('0x87')]=function(_0x314673,_0x50c178,_0x33e5f1){return db[_0x4bdd('0x28')]['find']({'where':{'id':_0x314673[_0x4bdd('0x3e')]['id']}})[_0x4bdd('0x20')](handleEntityNotFound(_0x50c178,null))['then'](function(_0x2a0ca8){if(_0x2a0ca8){return _0x2a0ca8[_0x4bdd('0x87')](_0x314673[_0x4bdd('0x2c')][_0x4bdd('0x5d')]);}})[_0x4bdd('0x20')](function(_0x3b3c9d){if(_0x3b3c9d){return db['CmHopper'][_0x4bdd('0x21')]({'where':{'ListId':_0x314673[_0x4bdd('0x2c')]['ids'],'CampaignId':_0x314673['params']['id']}})['then'](function(){return _0x3b3c9d;});}})[_0x4bdd('0x20')](respondWithStatusCode(_0x50c178,null))[_0x4bdd('0x3c')](handleError(_0x50c178,null));};exports[_0x4bdd('0x88')]=function(_0x1315c6,_0x49777c,_0x2b2989){var _0x579e9b={};var _0x1ae6d6={};var _0x370dfe;var _0x11ecf2;return db[_0x4bdd('0x28')][_0x4bdd('0x4f')]({'where':{'id':_0x1315c6['params']['id']}})[_0x4bdd('0x20')](handleEntityNotFound(_0x49777c,null))['then'](function(_0x40e826){if(_0x40e826){_0x370dfe=_0x40e826;_0x1ae6d6['model']=_[_0x4bdd('0x2d')](db[_0x4bdd('0x5a')][_0x4bdd('0x29')]);_0x1ae6d6['query']=_[_0x4bdd('0x2d')](_0x1315c6[_0x4bdd('0x2c')]);_0x1ae6d6[_0x4bdd('0x34')]=_[_0x4bdd('0x2e')](_0x1ae6d6[_0x4bdd('0x2b')],_0x1ae6d6[_0x4bdd('0x2c')]);_0x579e9b[_0x4bdd('0x2f')]=_[_0x4bdd('0x2e')](_0x1ae6d6[_0x4bdd('0x2b')],qs[_0x4bdd('0x30')](_0x1315c6['query'][_0x4bdd('0x30')]));_0x579e9b[_0x4bdd('0x2f')]=_0x579e9b[_0x4bdd('0x2f')][_0x4bdd('0x3f')]?_0x579e9b[_0x4bdd('0x2f')]:_0x1ae6d6['model'];_0x579e9b[_0x4bdd('0x51')]=qs['sort'](_0x1315c6[_0x4bdd('0x2c')][_0x4bdd('0x32')]);_0x579e9b[_0x4bdd('0x33')]=qs[_0x4bdd('0x34')](_['pick'](_0x1315c6[_0x4bdd('0x2c')],_0x1ae6d6[_0x4bdd('0x34')]));if(_0x1315c6[_0x4bdd('0x2c')][_0x4bdd('0x36')]){_0x579e9b['where']=_[_0x4bdd('0x37')](_0x579e9b[_0x4bdd('0x33')],{'$or':_['map'](_0x579e9b[_0x4bdd('0x2f')],function(_0x122716){var _0x43c445={};_0x43c445[_0x122716]={'$like':'%'+_0x1315c6[_0x4bdd('0x2c')][_0x4bdd('0x36')]+'%'};return _0x43c445;})});}_0x579e9b=_[_0x4bdd('0x37')]({},_0x579e9b,_0x1315c6[_0x4bdd('0x39')]);return _0x370dfe['getBlackLists'](_0x579e9b);}})[_0x4bdd('0x20')](function(_0x34cbc5){if(_0x34cbc5){_0x11ecf2=_0x34cbc5[_0x4bdd('0x3f')];if(!_0x1315c6[_0x4bdd('0x2c')]['hasOwnProperty'](_0x4bdd('0x31'))){_0x579e9b['limit']=qs[_0x4bdd('0x19')](_0x1315c6[_0x4bdd('0x2c')][_0x4bdd('0x19')]);_0x579e9b['offset']=qs['offset'](_0x1315c6[_0x4bdd('0x2c')][_0x4bdd('0x17')]);}return _0x370dfe[_0x4bdd('0x88')](_0x579e9b);}})[_0x4bdd('0x20')](function(_0xd44331){if(_0xd44331){return _0xd44331?{'count':_0x11ecf2,'rows':_0xd44331}:null;}})[_0x4bdd('0x20')](respondWithResult(_0x49777c,null))[_0x4bdd('0x3c')](handleError(_0x49777c,null));};exports[_0x4bdd('0x89')]=function(_0x5c69af,_0x5bcdd0,_0xee493c){var _0x5351ac,_0x45848a;var _0x59d37f=[];var _0x21fea7=moment()[_0x4bdd('0x8a')](_0x4bdd('0x5c'));return db[_0x4bdd('0x28')]['find']({'where':{'id':_0x5c69af[_0x4bdd('0x3e')]['id']}})[_0x4bdd('0x20')](handleEntityNotFound(_0x5bcdd0,null))[_0x4bdd('0x20')](function(_0x3a6928){if(_0x3a6928){_0x45848a=_0x3a6928;return _0x3a6928[_0x4bdd('0x89')](_0x5c69af[_0x4bdd('0x43')][_0x4bdd('0x5d')],_[_0x4bdd('0x4c')](_0x5c69af[_0x4bdd('0x43')],[_0x4bdd('0x5d'),'id'])||{});}return null;})[_0x4bdd('0x5e')](function(_0xbab814){var _0x12da8f;var _0x3bcf53;_0x5351ac=_0xbab814||[];var _0xacc05=[];if(_0xbab814){for(var _0xc2e5e5=0x0;_0xc2e5e5<_0xbab814[_0x4bdd('0x3f')];_0xc2e5e5+=0x1){var _0x299197=_0xbab814[_0xc2e5e5]['get']({'plain':!![]});_0x12da8f=squel['insert']()[_0x4bdd('0x78')]('cm_hopper_black')[_0x4bdd('0x63')](['phone',_0x4bdd('0x65'),_0x4bdd('0x66'),_0x4bdd('0x52'),_0x4bdd('0x4d'),_0x4bdd('0x74')],squel[_0x4bdd('0x67')]()['field'](_0x4bdd('0x68'),_0x4bdd('0x68'))[_0x4bdd('0x69')]('id',_0x4bdd('0x65'))[_0x4bdd('0x69')](_0x299197[_0x4bdd('0x6b')][_0x4bdd('0x6c')](),_0x4bdd('0x66'))['field'](_0x5c69af[_0x4bdd('0x3e')]['id'][_0x4bdd('0x6c')](),_0x4bdd('0x52'))[_0x4bdd('0x69')](_0x4bdd('0x6a'),'createdAt')[_0x4bdd('0x69')](_0x4bdd('0x6a'),'updatedAt')[_0x4bdd('0x6d')](_0x4bdd('0x6e'))[_0x4bdd('0x33')]('deletedAt\x20IS\x20NULL')[_0x4bdd('0x33')](_0x4bdd('0x70'),_0x299197['CmListId'][_0x4bdd('0x6c')]())[_0x4bdd('0x33')](_0x4bdd('0x75')))['toString']();_0xacc05[_0x4bdd('0x84')](db[_0x4bdd('0x85')]['query'](_0x12da8f));}return BPromise[_0x4bdd('0x86')](_0xacc05);}})[_0x4bdd('0x20')](function(){return _0x5351ac;})['then'](respondWithResult(_0x5bcdd0,null))[_0x4bdd('0x3c')](handleError(_0x5bcdd0,null));};exports[_0x4bdd('0x8b')]=function(_0x5829af,_0x34b4e4,_0x30005c){return db[_0x4bdd('0x28')][_0x4bdd('0x41')]({'where':{'id':_0x5829af[_0x4bdd('0x3e')]['id']}})[_0x4bdd('0x20')](handleEntityNotFound(_0x34b4e4,null))[_0x4bdd('0x20')](function(_0x4a050e){if(_0x4a050e){return _0x4a050e[_0x4bdd('0x8b')](_0x5829af['query']['ids']);}})['then'](function(_0x13449f){if(_0x13449f){return db['CmHopperBlack'][_0x4bdd('0x21')]({'where':{'ListId':_0x5829af[_0x4bdd('0x2c')]['ids'],'CampaignId':_0x5829af[_0x4bdd('0x3e')]['id']}})['then'](function(){return _0x13449f;});}})[_0x4bdd('0x20')](respondWithStatusCode(_0x34b4e4,null))[_0x4bdd('0x3c')](handleError(_0x34b4e4,null));}; \ No newline at end of file +var _0xda66=['../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','then','get','IvrCampaigns','destroy','sendStatus','error','stack','name','send','index','map','Campaign','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','hasOwnProperty','nolimit','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','params','fields','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','order','pick','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','field','NOW()','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId','cm_hopper_additional_phones','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x3f8a3b,_0x4385ca){var _0x1cd2e2=function(_0x334706){while(--_0x334706){_0x3f8a3b['push'](_0x3f8a3b['shift']());}};_0x1cd2e2(++_0x4385ca);}(_0xda66,0x7f));var _0x6da6=function(_0x584789,_0x1f4b10){_0x584789=_0x584789-0x0;var _0x57c028=_0xda66[_0x584789];return _0x57c028;};'use strict';var emlformat=require(_0x6da6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6da6('0x1'));var jsonpatch=require(_0x6da6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6da6('0x3'));var util=require(_0x6da6('0x4'));var path=require(_0x6da6('0x5'));var sox=require(_0x6da6('0x6'));var csv=require(_0x6da6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6da6('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6da6('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x6da6('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6da6('0xb'));var Redis=require(_0x6da6('0xc'));var authService=require(_0x6da6('0xd'));var qs=require(_0x6da6('0xe'));var as=require(_0x6da6('0xf'));var hardwareService=require(_0x6da6('0x10'));var logger=require(_0x6da6('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x6da6('0x12'));var licenseUtil=require(_0x6da6('0x13'));var db=require(_0x6da6('0x14'))['db'];function respondWithStatusCode(_0xa7da31,_0x57d6ad){_0x57d6ad=_0x57d6ad||0xcc;return function(_0x118ac9){if(_0x118ac9){return _0xa7da31['sendStatus'](_0x57d6ad);}return _0xa7da31[_0x6da6('0x15')](_0x57d6ad)[_0x6da6('0x16')]();};}function respondWithResult(_0x173238,_0x44290c){_0x44290c=_0x44290c||0xc8;return function(_0x18a255){if(_0x18a255){return _0x173238[_0x6da6('0x15')](_0x44290c)[_0x6da6('0x17')](_0x18a255);}};}function respondWithFilteredResult(_0x58d817,_0x557e72){return function(_0x50393e){if(_0x50393e){var _0x57348f=typeof _0x557e72['offset']==='undefined'&&typeof _0x557e72[_0x6da6('0x18')]===_0x6da6('0x19');var _0x321c67=_0x50393e[_0x6da6('0x1a')];var _0x2fd36d=_0x57348f?0x0:_0x557e72['offset'];var _0x2bf7d9=_0x57348f?_0x50393e[_0x6da6('0x1a')]:_0x557e72[_0x6da6('0x1b')]+_0x557e72['limit'];var _0x10f673;if(_0x2bf7d9>=_0x321c67){_0x2bf7d9=_0x321c67;_0x10f673=0xc8;}else{_0x10f673=0xce;}_0x58d817['status'](_0x10f673);return _0x58d817[_0x6da6('0x1c')](_0x6da6('0x1d'),_0x2fd36d+'-'+_0x2bf7d9+'/'+_0x321c67)[_0x6da6('0x17')](_0x50393e);}return null;};}function patchUpdates(_0xd63d5b){return function(_0x59b347){try{jsonpatch[_0x6da6('0x1e')](_0x59b347,_0xd63d5b,!![]);}catch(_0x37f406){return BPromise['reject'](_0x37f406);}return _0x59b347[_0x6da6('0x1f')]();};}function saveUpdates(_0x17f731,_0x3ff78b){return function(_0x2366e7){if(_0x2366e7){return _0x2366e7['update'](_0x17f731)[_0x6da6('0x20')](function(_0x34bf25){return _0x34bf25;});}return null;};}function removeEntity(_0x3b7340,_0xe1d27e){return function(_0x48ff63){if(_0x48ff63){return _0x48ff63['destroy']()[_0x6da6('0x20')](function(){var _0x39fb46=_0x48ff63[_0x6da6('0x21')]({'plain':!![]});var _0x30269f=_0x6da6('0x22');return db['UserProfileResource'][_0x6da6('0x23')]({'where':{'type':_0x30269f,'resourceId':_0x39fb46['id']}})[_0x6da6('0x20')](function(){return _0x48ff63;});})[_0x6da6('0x20')](function(){_0x3b7340[_0x6da6('0x15')](0xcc)[_0x6da6('0x16')]();});}};}function handleEntityNotFound(_0x3a3903,_0x15262a){return function(_0x575f7d){if(!_0x575f7d){_0x3a3903[_0x6da6('0x24')](0x194);}return _0x575f7d;};}function handleError(_0x263989,_0x2274ad){_0x2274ad=_0x2274ad||0x1f4;return function(_0x1cd1a4){logger[_0x6da6('0x25')](_0x1cd1a4[_0x6da6('0x26')]);if(_0x1cd1a4[_0x6da6('0x27')]){delete _0x1cd1a4[_0x6da6('0x27')];}_0x263989[_0x6da6('0x15')](_0x2274ad)[_0x6da6('0x28')](_0x1cd1a4);};}exports[_0x6da6('0x29')]=function(_0x5c380b,_0x3d4572){var _0x4b7e10={},_0x945988={},_0x414d68={'count':0x0,'rows':[]};var _0x357b2d=_[_0x6da6('0x2a')](db[_0x6da6('0x2b')][_0x6da6('0x2c')],function(_0x53fad5){return{'name':_0x53fad5[_0x6da6('0x2d')],'type':_0x53fad5[_0x6da6('0x2e')][_0x6da6('0x2f')]};});_0x945988['model']=_[_0x6da6('0x2a')](_0x357b2d,'name');_0x945988[_0x6da6('0x30')]=_[_0x6da6('0x31')](_0x5c380b[_0x6da6('0x30')]);_0x945988[_0x6da6('0x32')]=_['intersection'](_0x945988[_0x6da6('0x33')],_0x945988[_0x6da6('0x30')]);_0x4b7e10[_0x6da6('0x34')]=_[_0x6da6('0x35')](_0x945988['model'],qs['fields'](_0x5c380b[_0x6da6('0x30')]['fields']));_0x4b7e10[_0x6da6('0x34')]=_0x4b7e10[_0x6da6('0x34')]['length']?_0x4b7e10[_0x6da6('0x34')]:_0x945988['model'];if(!_0x5c380b[_0x6da6('0x30')][_0x6da6('0x36')](_0x6da6('0x37'))){_0x4b7e10[_0x6da6('0x18')]=qs[_0x6da6('0x18')](_0x5c380b[_0x6da6('0x30')][_0x6da6('0x18')]);_0x4b7e10['offset']=qs['offset'](_0x5c380b['query']['offset']);}_0x4b7e10['order']=qs[_0x6da6('0x38')](_0x5c380b[_0x6da6('0x30')][_0x6da6('0x38')]);_0x4b7e10[_0x6da6('0x39')]=qs[_0x6da6('0x32')](_['pick'](_0x5c380b[_0x6da6('0x30')],_0x945988[_0x6da6('0x32')]),_0x357b2d);if(_0x5c380b[_0x6da6('0x30')]['filter']){_0x4b7e10[_0x6da6('0x39')]=_[_0x6da6('0x3a')](_0x4b7e10[_0x6da6('0x39')],{'$or':_[_0x6da6('0x2a')](_0x357b2d,function(_0x19ae4c){if(_0x19ae4c[_0x6da6('0x2e')]!=='VIRTUAL'){var _0x22cd85={};_0x22cd85[_0x19ae4c[_0x6da6('0x27')]]={'$like':'%'+_0x5c380b[_0x6da6('0x30')][_0x6da6('0x3b')]+'%'};return _0x22cd85;}})});}_0x4b7e10=_[_0x6da6('0x3a')]({},_0x4b7e10,_0x5c380b[_0x6da6('0x3c')]);var _0x3733d4={'where':_0x4b7e10[_0x6da6('0x39')]};return db[_0x6da6('0x2b')][_0x6da6('0x1a')](_0x3733d4)[_0x6da6('0x20')](function(_0x14ede3){_0x414d68['count']=_0x14ede3;if(_0x5c380b[_0x6da6('0x30')][_0x6da6('0x3d')]){_0x4b7e10[_0x6da6('0x3e')]=[{'all':!![]}];}return db['Campaign'][_0x6da6('0x3f')](_0x4b7e10);})['then'](function(_0x40bd0e){_0x414d68[_0x6da6('0x40')]=_0x40bd0e;return _0x414d68;})['then'](respondWithFilteredResult(_0x3d4572,_0x4b7e10))[_0x6da6('0x41')](handleError(_0x3d4572,null));};exports['show']=function(_0x588175,_0x9601e2){var _0x13e970={'raw':![],'where':{'id':_0x588175[_0x6da6('0x42')]['id']}},_0x1611df={};_0x1611df[_0x6da6('0x33')]=_[_0x6da6('0x31')](db[_0x6da6('0x2b')][_0x6da6('0x2c')]);_0x1611df[_0x6da6('0x30')]=_[_0x6da6('0x31')](_0x588175[_0x6da6('0x30')]);_0x1611df[_0x6da6('0x32')]=_['intersection'](_0x1611df[_0x6da6('0x33')],_0x1611df[_0x6da6('0x30')]);_0x13e970[_0x6da6('0x34')]=_[_0x6da6('0x35')](_0x1611df['model'],qs[_0x6da6('0x43')](_0x588175['query'][_0x6da6('0x43')]));_0x13e970['attributes']=_0x13e970[_0x6da6('0x34')][_0x6da6('0x44')]?_0x13e970[_0x6da6('0x34')]:_0x1611df[_0x6da6('0x33')];if(_0x588175[_0x6da6('0x30')][_0x6da6('0x3d')]){_0x13e970['include']=[{'all':!![]}];}_0x13e970=_['merge']({},_0x13e970,_0x588175[_0x6da6('0x3c')]);return db[_0x6da6('0x2b')][_0x6da6('0x45')](_0x13e970)['then'](handleEntityNotFound(_0x9601e2,null))[_0x6da6('0x20')](respondWithResult(_0x9601e2,null))[_0x6da6('0x41')](handleError(_0x9601e2,null));};exports[_0x6da6('0x46')]=function(_0x22e236,_0xc54684){return db[_0x6da6('0x2b')][_0x6da6('0x46')](_0x22e236[_0x6da6('0x47')],{})[_0x6da6('0x20')](function(_0x21f968){var _0x2076be=_0x22e236[_0x6da6('0x48')][_0x6da6('0x21')]({'plain':!![]});if(!_0x2076be)throw new Error(_0x6da6('0x49'));if(_0x2076be[_0x6da6('0x4a')]===_0x6da6('0x48')){var _0x2a6761=_0x21f968[_0x6da6('0x21')]({'plain':!![]});var _0x4121fd=_0x6da6('0x22');return db[_0x6da6('0x4b')][_0x6da6('0x45')]({'where':{'name':_0x4121fd,'userProfileId':_0x2076be[_0x6da6('0x4c')]},'raw':!![]})[_0x6da6('0x20')](function(_0x20bc74){if(_0x20bc74&&_0x20bc74[_0x6da6('0x4d')]===0x0){return db[_0x6da6('0x4e')][_0x6da6('0x46')]({'name':_0x2a6761[_0x6da6('0x27')],'resourceId':_0x2a6761['id'],'type':_0x20bc74[_0x6da6('0x27')],'sectionId':_0x20bc74['id']},{})[_0x6da6('0x20')](function(){return _0x21f968;});}else{return _0x21f968;}})[_0x6da6('0x41')](function(_0x3e468c){logger[_0x6da6('0x25')](_0x6da6('0x4f'),_0x3e468c);throw _0x3e468c;});}return _0x21f968;})[_0x6da6('0x20')](respondWithResult(_0xc54684,0xc9))[_0x6da6('0x41')](handleError(_0xc54684,null));};exports['clone']=function(_0x177a4e,_0x46cb75){var _0x401f57={'where':{'id':_0x177a4e[_0x6da6('0x42')]['id']}},_0x51f0f9={};_0x51f0f9[_0x6da6('0x33')]=_['keys'](db[_0x6da6('0x2b')][_0x6da6('0x2c')]);_0x401f57[_0x6da6('0x34')]=_['intersection'](_0x51f0f9[_0x6da6('0x33')],qs[_0x6da6('0x43')](_0x177a4e[_0x6da6('0x30')][_0x6da6('0x43')]));_0x401f57[_0x6da6('0x34')]=_0x401f57[_0x6da6('0x34')]['length']?_0x401f57[_0x6da6('0x34')]:_0x51f0f9[_0x6da6('0x33')];if(_0x177a4e[_0x6da6('0x30')]['includeAll']){_0x401f57['include']=[{'all':!![]}];}_0x401f57=_['merge']({},_0x401f57,_0x177a4e['options']);return db[_0x6da6('0x2b')][_0x6da6('0x45')](_0x401f57)[_0x6da6('0x20')](handleEntityNotFound(_0x46cb75,null))[_0x6da6('0x20')](function(_0x2de317){if(_0x2de317){var _0x25925b=_0x2de317[_0x6da6('0x21')]({'plain':!![]});_0x25925b=qs[_0x6da6('0x50')](_0x25925b,['id',_0x6da6('0x51'),'updatedAt']);_0x177a4e[_0x6da6('0x47')]=_[_0x6da6('0x50')](_0x177a4e[_0x6da6('0x47')],['id',_0x6da6('0x51'),_0x6da6('0x52')]);return db[_0x6da6('0x2b')][_0x6da6('0x46')](_[_0x6da6('0x3a')](_0x25925b,_0x177a4e[_0x6da6('0x47')]),{'include':_0x177a4e['query'][_0x6da6('0x3d')]?[{'all':!![]}]:undefined})[_0x6da6('0x20')](function(_0xd76a95){var _0x3826f4=_0x177a4e[_0x6da6('0x48')][_0x6da6('0x21')]({'plain':!![]});if(!_0x3826f4)throw new Error(_0x6da6('0x49'));if(_0x3826f4[_0x6da6('0x4a')]===_0x6da6('0x48')){var _0x30e35c=_0xd76a95[_0x6da6('0x21')]({'plain':!![]});var _0x57c710=_0x6da6('0x22');return db['UserProfileSection'][_0x6da6('0x45')]({'where':{'name':_0x57c710,'userProfileId':_0x3826f4[_0x6da6('0x4c')]},'raw':!![]})[_0x6da6('0x20')](function(_0x1c3dbc){if(_0x1c3dbc&&_0x1c3dbc[_0x6da6('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x30e35c[_0x6da6('0x27')],'resourceId':_0x30e35c['id'],'type':_0x1c3dbc['name'],'sectionId':_0x1c3dbc['id']},{})['then'](function(){return _0xd76a95;});}else{return _0xd76a95;}})[_0x6da6('0x41')](function(_0x416483){logger['error'](_0x6da6('0x4f'),_0x416483);throw _0x416483;});}return _0xd76a95;});}})['then'](respondWithResult(_0x46cb75,0xc9))[_0x6da6('0x41')](handleError(_0x46cb75,null));};exports['update']=function(_0x36a671,_0x1620e7){if(_0x36a671['body']['id']){delete _0x36a671[_0x6da6('0x47')]['id'];}return db[_0x6da6('0x2b')]['find']({'where':{'id':_0x36a671[_0x6da6('0x42')]['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0x1620e7,null))['then'](saveUpdates(_0x36a671['body'],null))[_0x6da6('0x20')](respondWithResult(_0x1620e7,null))[_0x6da6('0x41')](handleError(_0x1620e7,null));};exports[_0x6da6('0x23')]=function(_0x10f976,_0x4b0e98){return db[_0x6da6('0x2b')]['find']({'where':{'id':_0x10f976[_0x6da6('0x42')]['id']}})['then'](handleEntityNotFound(_0x4b0e98,null))[_0x6da6('0x20')](removeEntity(_0x4b0e98,null))[_0x6da6('0x41')](handleError(_0x4b0e98,null));};exports[_0x6da6('0x53')]=function(_0x380ab7,_0xe5277c,_0x42fc41){var _0xc6505c={'raw':!![],'where':{}};var _0x5dfbcf={};var _0x58764f={'count':0x0,'rows':[]};return db[_0x6da6('0x2b')][_0x6da6('0x54')]({'where':{'id':_0x380ab7[_0x6da6('0x42')]['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0xe5277c,null))[_0x6da6('0x20')](function(_0x3667e3){if(_0x3667e3){_0x5dfbcf['model']=_[_0x6da6('0x31')](db[_0x6da6('0x55')][_0x6da6('0x2c')]);_0x5dfbcf[_0x6da6('0x30')]=_[_0x6da6('0x31')](_0x380ab7['query']);_0x5dfbcf[_0x6da6('0x32')]=_[_0x6da6('0x35')](_0x5dfbcf['model'],_0x5dfbcf[_0x6da6('0x30')]);_0xc6505c['attributes']=_[_0x6da6('0x35')](_0x5dfbcf[_0x6da6('0x33')],qs[_0x6da6('0x43')](_0x380ab7[_0x6da6('0x30')][_0x6da6('0x43')]));_0xc6505c['attributes']=_0xc6505c[_0x6da6('0x34')]['length']?_0xc6505c[_0x6da6('0x34')]:_0x5dfbcf[_0x6da6('0x33')];if(!_0x380ab7[_0x6da6('0x30')][_0x6da6('0x36')](_0x6da6('0x37'))){_0xc6505c[_0x6da6('0x18')]=qs[_0x6da6('0x18')](_0x380ab7['query']['limit']);_0xc6505c[_0x6da6('0x1b')]=qs[_0x6da6('0x1b')](_0x380ab7[_0x6da6('0x30')][_0x6da6('0x1b')]);}_0xc6505c[_0x6da6('0x56')]=qs[_0x6da6('0x38')](_0x380ab7[_0x6da6('0x30')][_0x6da6('0x38')]);_0xc6505c['where']=qs[_0x6da6('0x32')](_[_0x6da6('0x57')](_0x380ab7[_0x6da6('0x30')],_0x5dfbcf[_0x6da6('0x32')]));_0xc6505c[_0x6da6('0x39')][_0x6da6('0x58')]=_0x3667e3['id'];if(_0x380ab7[_0x6da6('0x30')][_0x6da6('0x3b')]){_0xc6505c[_0x6da6('0x39')]=_[_0x6da6('0x3a')](_0xc6505c['where'],{'$or':_[_0x6da6('0x2a')](_0xc6505c[_0x6da6('0x34')],function(_0x2773ad){var _0x3b12e2={};_0x3b12e2[_0x2773ad]={'$like':'%'+_0x380ab7[_0x6da6('0x30')][_0x6da6('0x3b')]+'%'};return _0x3b12e2;})});}_0xc6505c=_[_0x6da6('0x3a')]({},_0xc6505c,_0x380ab7[_0x6da6('0x3c')]);return db[_0x6da6('0x55')][_0x6da6('0x1a')]({'where':_0xc6505c['where']})['then'](function(_0x320fab){_0x58764f['count']=_0x320fab;if(_0x380ab7['query'][_0x6da6('0x3d')]){_0xc6505c[_0x6da6('0x3e')]=[{'all':!![]}];}return db[_0x6da6('0x55')]['findAll'](_0xc6505c);})[_0x6da6('0x20')](function(_0x2b8a4c){_0x58764f[_0x6da6('0x40')]=_0x2b8a4c;return _0x58764f;});}})[_0x6da6('0x20')](respondWithFilteredResult(_0xe5277c,_0xc6505c))['catch'](handleError(_0xe5277c,null));};exports[_0x6da6('0x59')]=function(_0x48bb49,_0x46648d,_0x4487ad){var _0x287042={'raw':!![],'where':{}};var _0x4848e8={};var _0x2658e3={'count':0x0,'rows':[]};return db[_0x6da6('0x2b')]['findOne']({'where':{'id':_0x48bb49[_0x6da6('0x42')]['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0x46648d,null))[_0x6da6('0x20')](function(_0x4b11a8){if(_0x4b11a8){_0x4848e8[_0x6da6('0x33')]=_[_0x6da6('0x31')](db[_0x6da6('0x5a')][_0x6da6('0x2c')]);_0x4848e8[_0x6da6('0x30')]=_[_0x6da6('0x31')](_0x48bb49[_0x6da6('0x30')]);_0x4848e8['filters']=_[_0x6da6('0x35')](_0x4848e8[_0x6da6('0x33')],_0x4848e8[_0x6da6('0x30')]);_0x287042['attributes']=_['intersection'](_0x4848e8[_0x6da6('0x33')],qs[_0x6da6('0x43')](_0x48bb49[_0x6da6('0x30')][_0x6da6('0x43')]));_0x287042[_0x6da6('0x34')]=_0x287042['attributes'][_0x6da6('0x44')]?_0x287042['attributes']:_0x4848e8[_0x6da6('0x33')];if(!_0x48bb49[_0x6da6('0x30')][_0x6da6('0x36')](_0x6da6('0x37'))){_0x287042[_0x6da6('0x18')]=qs[_0x6da6('0x18')](_0x48bb49[_0x6da6('0x30')]['limit']);_0x287042['offset']=qs['offset'](_0x48bb49[_0x6da6('0x30')][_0x6da6('0x1b')]);}_0x287042['order']=qs[_0x6da6('0x38')](_0x48bb49[_0x6da6('0x30')]['sort']);_0x287042[_0x6da6('0x39')]=qs[_0x6da6('0x32')](_[_0x6da6('0x57')](_0x48bb49[_0x6da6('0x30')],_0x4848e8[_0x6da6('0x32')]));_0x287042[_0x6da6('0x39')][_0x6da6('0x58')]=_0x4b11a8['id'];if(_0x48bb49[_0x6da6('0x30')][_0x6da6('0x3b')]){_0x287042['where']=_['merge'](_0x287042[_0x6da6('0x39')],{'$or':_[_0x6da6('0x2a')](_0x287042[_0x6da6('0x34')],function(_0x140d6d){var _0x1fef4d={};_0x1fef4d[_0x140d6d]={'$like':'%'+_0x48bb49[_0x6da6('0x30')]['filter']+'%'};return _0x1fef4d;})});}_0x287042=_[_0x6da6('0x3a')]({},_0x287042,_0x48bb49[_0x6da6('0x3c')]);return db['CmHopperHistory'][_0x6da6('0x1a')]({'where':_0x287042[_0x6da6('0x39')]})[_0x6da6('0x20')](function(_0x4c7492){_0x2658e3[_0x6da6('0x1a')]=_0x4c7492;if(_0x48bb49[_0x6da6('0x30')][_0x6da6('0x3d')]){_0x287042[_0x6da6('0x3e')]=[{'all':!![]}];}return db[_0x6da6('0x5a')][_0x6da6('0x3f')](_0x287042);})[_0x6da6('0x20')](function(_0x25db84){_0x2658e3[_0x6da6('0x40')]=_0x25db84;return _0x2658e3;});}})[_0x6da6('0x20')](respondWithFilteredResult(_0x46648d,_0x287042))[_0x6da6('0x41')](handleError(_0x46648d,null));};exports[_0x6da6('0x5b')]=function(_0x483f72,_0x169e82,_0x3f50ee){var _0x273626={'raw':!![],'where':{}};var _0x3f4407={};var _0x57dc3c={'count':0x0,'rows':[]};return db[_0x6da6('0x2b')][_0x6da6('0x54')]({'where':{'id':_0x483f72['params']['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0x169e82,null))[_0x6da6('0x20')](function(_0x4cc9dd){if(_0x4cc9dd){_0x3f4407[_0x6da6('0x33')]=_[_0x6da6('0x31')](db[_0x6da6('0x5c')]['rawAttributes']);_0x3f4407[_0x6da6('0x30')]=_[_0x6da6('0x31')](_0x483f72[_0x6da6('0x30')]);_0x3f4407[_0x6da6('0x32')]=_[_0x6da6('0x35')](_0x3f4407['model'],_0x3f4407[_0x6da6('0x30')]);_0x273626[_0x6da6('0x34')]=_[_0x6da6('0x35')](_0x3f4407[_0x6da6('0x33')],qs[_0x6da6('0x43')](_0x483f72[_0x6da6('0x30')][_0x6da6('0x43')]));_0x273626[_0x6da6('0x34')]=_0x273626[_0x6da6('0x34')]['length']?_0x273626[_0x6da6('0x34')]:_0x3f4407[_0x6da6('0x33')];if(!_0x483f72['query']['hasOwnProperty'](_0x6da6('0x37'))){_0x273626[_0x6da6('0x18')]=qs[_0x6da6('0x18')](_0x483f72['query'][_0x6da6('0x18')]);_0x273626[_0x6da6('0x1b')]=qs[_0x6da6('0x1b')](_0x483f72['query']['offset']);}_0x273626[_0x6da6('0x56')]=qs['sort'](_0x483f72[_0x6da6('0x30')][_0x6da6('0x38')]);_0x273626['where']=qs[_0x6da6('0x32')](_[_0x6da6('0x57')](_0x483f72[_0x6da6('0x30')],_0x3f4407[_0x6da6('0x32')]));_0x273626[_0x6da6('0x39')][_0x6da6('0x58')]=_0x4cc9dd['id'];if(_0x483f72['query'][_0x6da6('0x3b')]){_0x273626['where']=_[_0x6da6('0x3a')](_0x273626[_0x6da6('0x39')],{'$or':_[_0x6da6('0x2a')](_0x273626['attributes'],function(_0x3d267f){var _0xaba7d7={};_0xaba7d7[_0x3d267f]={'$like':'%'+_0x483f72['query'][_0x6da6('0x3b')]+'%'};return _0xaba7d7;})});}_0x273626=_['merge']({},_0x273626,_0x483f72['options']);return db[_0x6da6('0x5c')]['count']({'where':_0x273626[_0x6da6('0x39')]})['then'](function(_0x3bae7c){_0x57dc3c['count']=_0x3bae7c;if(_0x483f72[_0x6da6('0x30')][_0x6da6('0x3d')]){_0x273626['include']=[{'all':!![]}];}return db[_0x6da6('0x5c')][_0x6da6('0x3f')](_0x273626);})[_0x6da6('0x20')](function(_0x2e74c9){_0x57dc3c[_0x6da6('0x40')]=_0x2e74c9;return _0x57dc3c;});}})[_0x6da6('0x20')](respondWithFilteredResult(_0x169e82,_0x273626))[_0x6da6('0x41')](handleError(_0x169e82,null));};exports[_0x6da6('0x5d')]=function(_0x281b11,_0x5547e9,_0x2f270c){var _0x7b9951={'raw':!![],'where':{}};var _0x2c824c={};var _0x4987be={'count':0x0,'rows':[]};return db[_0x6da6('0x2b')][_0x6da6('0x54')]({'where':{'id':_0x281b11[_0x6da6('0x42')]['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0x5547e9,null))[_0x6da6('0x20')](function(_0x359066){if(_0x359066){_0x2c824c[_0x6da6('0x33')]=_[_0x6da6('0x31')](db[_0x6da6('0x5e')]['rawAttributes']);_0x2c824c[_0x6da6('0x30')]=_[_0x6da6('0x31')](_0x281b11[_0x6da6('0x30')]);_0x2c824c[_0x6da6('0x32')]=_['intersection'](_0x2c824c['model'],_0x2c824c[_0x6da6('0x30')]);_0x7b9951[_0x6da6('0x34')]=_[_0x6da6('0x35')](_0x2c824c['model'],qs[_0x6da6('0x43')](_0x281b11[_0x6da6('0x30')][_0x6da6('0x43')]));_0x7b9951['attributes']=_0x7b9951[_0x6da6('0x34')]['length']?_0x7b9951[_0x6da6('0x34')]:_0x2c824c[_0x6da6('0x33')];if(!_0x281b11[_0x6da6('0x30')][_0x6da6('0x36')](_0x6da6('0x37'))){_0x7b9951[_0x6da6('0x18')]=qs[_0x6da6('0x18')](_0x281b11[_0x6da6('0x30')][_0x6da6('0x18')]);_0x7b9951[_0x6da6('0x1b')]=qs[_0x6da6('0x1b')](_0x281b11[_0x6da6('0x30')]['offset']);}_0x7b9951[_0x6da6('0x56')]=qs[_0x6da6('0x38')](_0x281b11['query']['sort']);_0x7b9951[_0x6da6('0x39')]=qs[_0x6da6('0x32')](_[_0x6da6('0x57')](_0x281b11['query'],_0x2c824c[_0x6da6('0x32')]));_0x7b9951[_0x6da6('0x39')][_0x6da6('0x58')]=_0x359066['id'];if(_0x281b11[_0x6da6('0x30')][_0x6da6('0x3b')]){_0x7b9951[_0x6da6('0x39')]=_[_0x6da6('0x3a')](_0x7b9951[_0x6da6('0x39')],{'$or':_[_0x6da6('0x2a')](_0x7b9951[_0x6da6('0x34')],function(_0x23192d){var _0x13a0ff={};_0x13a0ff[_0x23192d]={'$like':'%'+_0x281b11['query'][_0x6da6('0x3b')]+'%'};return _0x13a0ff;})});}_0x7b9951=_[_0x6da6('0x3a')]({},_0x7b9951,_0x281b11[_0x6da6('0x3c')]);return db[_0x6da6('0x5e')]['count']({'where':_0x7b9951[_0x6da6('0x39')]})[_0x6da6('0x20')](function(_0x4aac02){_0x4987be[_0x6da6('0x1a')]=_0x4aac02;if(_0x281b11['query']['includeAll']){_0x7b9951[_0x6da6('0x3e')]=[{'all':!![]}];}return db[_0x6da6('0x5e')][_0x6da6('0x3f')](_0x7b9951);})['then'](function(_0xba036d){_0x4987be[_0x6da6('0x40')]=_0xba036d;return _0x4987be;});}})[_0x6da6('0x20')](respondWithFilteredResult(_0x5547e9,_0x7b9951))['catch'](handleError(_0x5547e9,null));};exports['getLists']=function(_0x2ad2f8,_0x410cb2,_0x4cc417){var _0x189ac2={};var _0x2c7407={};var _0x406990;var _0x4cad70;return db[_0x6da6('0x2b')][_0x6da6('0x54')]({'where':{'id':_0x2ad2f8[_0x6da6('0x42')]['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0x410cb2,null))[_0x6da6('0x20')](function(_0x4ebb94){if(_0x4ebb94){_0x406990=_0x4ebb94;_0x2c7407['model']=_[_0x6da6('0x31')](db[_0x6da6('0x5f')][_0x6da6('0x2c')]);_0x2c7407['query']=_['keys'](_0x2ad2f8[_0x6da6('0x30')]);_0x2c7407['filters']=_['intersection'](_0x2c7407[_0x6da6('0x33')],_0x2c7407[_0x6da6('0x30')]);_0x189ac2[_0x6da6('0x34')]=_['intersection'](_0x2c7407['model'],qs[_0x6da6('0x43')](_0x2ad2f8[_0x6da6('0x30')][_0x6da6('0x43')]));_0x189ac2[_0x6da6('0x34')]=_0x189ac2[_0x6da6('0x34')][_0x6da6('0x44')]?_0x189ac2[_0x6da6('0x34')]:_0x2c7407[_0x6da6('0x33')];_0x189ac2[_0x6da6('0x56')]=qs[_0x6da6('0x38')](_0x2ad2f8[_0x6da6('0x30')][_0x6da6('0x38')]);_0x189ac2[_0x6da6('0x39')]=qs[_0x6da6('0x32')](_[_0x6da6('0x57')](_0x2ad2f8[_0x6da6('0x30')],_0x2c7407[_0x6da6('0x32')]));if(_0x2ad2f8['query'][_0x6da6('0x3b')]){_0x189ac2[_0x6da6('0x39')]=_[_0x6da6('0x3a')](_0x189ac2['where'],{'$or':_[_0x6da6('0x2a')](_0x189ac2[_0x6da6('0x34')],function(_0x1658f7){var _0x368ca7={};_0x368ca7[_0x1658f7]={'$like':'%'+_0x2ad2f8[_0x6da6('0x30')][_0x6da6('0x3b')]+'%'};return _0x368ca7;})});}_0x189ac2=_[_0x6da6('0x3a')]({},_0x189ac2,_0x2ad2f8[_0x6da6('0x3c')]);return _0x406990[_0x6da6('0x60')](_0x189ac2);}})[_0x6da6('0x20')](function(_0x915306){if(_0x915306){_0x4cad70=_0x915306['length'];if(!_0x2ad2f8['query'][_0x6da6('0x36')](_0x6da6('0x37'))){_0x189ac2['limit']=qs[_0x6da6('0x18')](_0x2ad2f8[_0x6da6('0x30')][_0x6da6('0x18')]);_0x189ac2[_0x6da6('0x1b')]=qs[_0x6da6('0x1b')](_0x2ad2f8[_0x6da6('0x30')][_0x6da6('0x1b')]);}return _0x406990[_0x6da6('0x60')](_0x189ac2);}})['then'](function(_0x3e9997){if(_0x3e9997){return _0x3e9997?{'count':_0x4cad70,'rows':_0x3e9997}:null;}})[_0x6da6('0x20')](respondWithResult(_0x410cb2,null))[_0x6da6('0x41')](handleError(_0x410cb2,null));};exports[_0x6da6('0x61')]=function(_0x5f10fd,_0x2c7e8e,_0x218110){var _0x40ba25,_0x59c435;var _0x18e81c=[];var _0x657eea=moment()[_0x6da6('0x62')](_0x6da6('0x63'));return db['Campaign']['find']({'where':{'id':_0x5f10fd[_0x6da6('0x42')]['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0x2c7e8e,null))[_0x6da6('0x20')](function(_0x215c02){if(_0x215c02){_0x59c435=_0x215c02;return _0x215c02[_0x6da6('0x61')](_0x5f10fd[_0x6da6('0x47')][_0x6da6('0x64')],_[_0x6da6('0x50')](_0x5f10fd[_0x6da6('0x47')],['ids','id'])||{});}return null;})['spread'](function(_0x4097ca){var _0x49b13d;var _0x2af6d9;_0x40ba25=_0x4097ca||[];var _0x15710e=[];if(_0x4097ca){for(var _0x553198=0x0;_0x553198<_0x4097ca[_0x6da6('0x44')];_0x553198+=0x1){var _0x265a50=_0x4097ca[_0x553198][_0x6da6('0x21')]({'plain':!![]});_0x59c435['dialCheckDuplicateType']=_0x5f10fd['body'][_0x6da6('0x65')]?_0x5f10fd[_0x6da6('0x47')][_0x6da6('0x65')]:_0x59c435['dialCheckDuplicateType'];switch(_0x59c435[_0x6da6('0x65')]){case _0x6da6('0x66'):_0x49b13d=squel[_0x6da6('0x67')]()[_0x6da6('0x68')](_0x6da6('0x69'))[_0x6da6('0x6a')]([_0x6da6('0x6b'),_0x6da6('0x6c'),_0x6da6('0x6d'),'ListId',_0x6da6('0x58'),_0x6da6('0x51'),_0x6da6('0x52')],squel[_0x6da6('0x6e')]()[_0x6da6('0x6f')](_0x6da6('0x6b'),_0x6da6('0x6b'))[_0x6da6('0x6f')](_0x6da6('0x70'),_0x6da6('0x6c'))[_0x6da6('0x6f')]('id',_0x6da6('0x6d'))['field'](_0x265a50['CmListId']['toString'](),'ListId')['field'](_0x5f10fd[_0x6da6('0x42')]['id'][_0x6da6('0x71')](),_0x6da6('0x58'))[_0x6da6('0x6f')]('\x27'+_0x657eea+'\x27',_0x6da6('0x51'))['field']('\x27'+_0x657eea+'\x27',_0x6da6('0x52'))['from'](_0x6da6('0x72'))['where'](_0x6da6('0x73'))['where'](_0x6da6('0x74'),_0x265a50[_0x6da6('0x75')][_0x6da6('0x71')]())[_0x6da6('0x39')](_0x6da6('0x76'))[_0x6da6('0x39')](_0x6da6('0x77'),squel['select']()[_0x6da6('0x6f')](_0x6da6('0x78'))[_0x6da6('0x79')](_0x6da6('0x7a'))[_0x6da6('0x39')](_0x6da6('0x7b'),_0x5f10fd[_0x6da6('0x42')]['id'][_0x6da6('0x71')]()))[_0x6da6('0x39')](_0x6da6('0x77'),squel['select']()[_0x6da6('0x6f')](_0x6da6('0x7c'))[_0x6da6('0x79')](_0x6da6('0x69'))[_0x6da6('0x39')](_0x6da6('0x7b'),_0x5f10fd[_0x6da6('0x42')]['id']['toString']())))[_0x6da6('0x71')]();break;case _0x6da6('0x7d'):_0x49b13d=squel[_0x6da6('0x67')]()[_0x6da6('0x68')](_0x6da6('0x69'))['fromQuery']([_0x6da6('0x6b'),_0x6da6('0x6c'),_0x6da6('0x6d'),_0x6da6('0x7e'),'CampaignId',_0x6da6('0x51'),'updatedAt'],squel[_0x6da6('0x6e')]()[_0x6da6('0x6f')](_0x6da6('0x6b'),'phone')[_0x6da6('0x6f')](_0x6da6('0x70'),_0x6da6('0x6c'))['field']('id','ContactId')[_0x6da6('0x6f')](_0x265a50[_0x6da6('0x75')][_0x6da6('0x71')](),_0x6da6('0x7e'))[_0x6da6('0x6f')](_0x5f10fd[_0x6da6('0x42')]['id']['toString'](),_0x6da6('0x58'))[_0x6da6('0x6f')]('\x27'+_0x657eea+'\x27','createdAt')[_0x6da6('0x6f')]('\x27'+_0x657eea+'\x27',_0x6da6('0x52'))[_0x6da6('0x79')]('cm_contacts')[_0x6da6('0x39')]('deletedAt\x20IS\x20NULL')[_0x6da6('0x39')]('ListId\x20=\x20?',_0x265a50[_0x6da6('0x75')]['toString']())[_0x6da6('0x39')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x6da6('0x77'),squel[_0x6da6('0x6e')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0x6da6('0x69'))[_0x6da6('0x39')](_0x6da6('0x7b'),_0x5f10fd[_0x6da6('0x42')]['id'][_0x6da6('0x71')]())))[_0x6da6('0x71')]();break;default:_0x49b13d=squel['insert']()[_0x6da6('0x68')]('cm_hopper')[_0x6da6('0x6a')]([_0x6da6('0x6b'),'scheduledAt',_0x6da6('0x6d'),'ListId',_0x6da6('0x58'),_0x6da6('0x51'),_0x6da6('0x52')],squel['select']()[_0x6da6('0x6f')](_0x6da6('0x6b'),'phone')[_0x6da6('0x6f')]('NOW()',_0x6da6('0x6c'))['field']('id',_0x6da6('0x6d'))['field'](_0x265a50[_0x6da6('0x75')][_0x6da6('0x71')](),'ListId')[_0x6da6('0x6f')](_0x5f10fd[_0x6da6('0x42')]['id']['toString'](),_0x6da6('0x58'))[_0x6da6('0x6f')]('\x27'+_0x657eea+'\x27',_0x6da6('0x51'))['field']('\x27'+_0x657eea+'\x27',_0x6da6('0x52'))[_0x6da6('0x79')]('cm_contacts')[_0x6da6('0x39')](_0x6da6('0x73'))[_0x6da6('0x39')](_0x6da6('0x74'),_0x265a50[_0x6da6('0x75')]['toString']())[_0x6da6('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0x6da6('0x71')]();}_0x2af6d9=squel[_0x6da6('0x67')]()[_0x6da6('0x68')](_0x6da6('0x7f'))[_0x6da6('0x6a')](['cmHopperId',_0x6da6('0x6c'),_0x6da6('0x6b'),_0x6da6('0x80'),_0x6da6('0x51'),_0x6da6('0x52')],squel[_0x6da6('0x6e')]()['field'](_0x6da6('0x81'),'id')['field'](_0x6da6('0x70'),'scheduledAt')['field'](_0x6da6('0x82'),'phone')[_0x6da6('0x6f')](_0x6da6('0x83'),_0x6da6('0x80'))[_0x6da6('0x6f')]('\x27'+_0x657eea+'\x27',_0x6da6('0x51'))['field']('\x27'+_0x657eea+'\x27',_0x6da6('0x52'))[_0x6da6('0x79')](_0x6da6('0x84'),'ci')[_0x6da6('0x85')](_0x6da6('0x69'),'h',_0x6da6('0x86'))['where']('h.ListId\x20=\x20?',_0x265a50[_0x6da6('0x75')][_0x6da6('0x71')]())['where'](_0x6da6('0x87'),_0x5f10fd[_0x6da6('0x42')]['id'][_0x6da6('0x71')]())['where'](_0x6da6('0x88'),_0x657eea))[_0x6da6('0x71')]();_0x15710e[_0x6da6('0x89')](db[_0x6da6('0x8a')][_0x6da6('0x30')](_0x49b13d));_0x18e81c['push'](db[_0x6da6('0x8a')]['query'](_0x2af6d9));}return BPromise[_0x6da6('0x8b')](_0x15710e);}})['then'](function(){return BPromise[_0x6da6('0x8b')](_0x18e81c);})[_0x6da6('0x20')](function(){return _0x40ba25;})['then'](respondWithResult(_0x2c7e8e,null))[_0x6da6('0x41')](handleError(_0x2c7e8e,null));};exports[_0x6da6('0x8c')]=function(_0xfa1e50,_0x36835e,_0x41c904){return db[_0x6da6('0x2b')][_0x6da6('0x45')]({'where':{'id':_0xfa1e50[_0x6da6('0x42')]['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0x36835e,null))[_0x6da6('0x20')](function(_0x104f4f){if(_0x104f4f){return _0x104f4f[_0x6da6('0x8c')](_0xfa1e50['query'][_0x6da6('0x64')]);}})[_0x6da6('0x20')](function(_0x1fcf7c){if(_0x1fcf7c){return db['CmHopper'][_0x6da6('0x23')]({'where':{'ListId':_0xfa1e50['query'][_0x6da6('0x64')],'CampaignId':_0xfa1e50[_0x6da6('0x42')]['id']}})[_0x6da6('0x20')](function(){return _0x1fcf7c;});}})['then'](respondWithStatusCode(_0x36835e,null))[_0x6da6('0x41')](handleError(_0x36835e,null));};exports[_0x6da6('0x8d')]=function(_0x2495bc,_0x184e1d,_0x5ec7d4){var _0x33eb6e={};var _0x47a9a5={};var _0x105c80;var _0x355141;return db[_0x6da6('0x2b')]['findOne']({'where':{'id':_0x2495bc['params']['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0x184e1d,null))[_0x6da6('0x20')](function(_0xb8d491){if(_0xb8d491){_0x105c80=_0xb8d491;_0x47a9a5[_0x6da6('0x33')]=_[_0x6da6('0x31')](db[_0x6da6('0x5f')][_0x6da6('0x2c')]);_0x47a9a5[_0x6da6('0x30')]=_['keys'](_0x2495bc['query']);_0x47a9a5[_0x6da6('0x32')]=_['intersection'](_0x47a9a5[_0x6da6('0x33')],_0x47a9a5[_0x6da6('0x30')]);_0x33eb6e[_0x6da6('0x34')]=_[_0x6da6('0x35')](_0x47a9a5[_0x6da6('0x33')],qs[_0x6da6('0x43')](_0x2495bc[_0x6da6('0x30')][_0x6da6('0x43')]));_0x33eb6e['attributes']=_0x33eb6e[_0x6da6('0x34')][_0x6da6('0x44')]?_0x33eb6e[_0x6da6('0x34')]:_0x47a9a5[_0x6da6('0x33')];_0x33eb6e[_0x6da6('0x56')]=qs[_0x6da6('0x38')](_0x2495bc[_0x6da6('0x30')]['sort']);_0x33eb6e[_0x6da6('0x39')]=qs['filters'](_[_0x6da6('0x57')](_0x2495bc['query'],_0x47a9a5['filters']));if(_0x2495bc[_0x6da6('0x30')][_0x6da6('0x3b')]){_0x33eb6e[_0x6da6('0x39')]=_[_0x6da6('0x3a')](_0x33eb6e[_0x6da6('0x39')],{'$or':_[_0x6da6('0x2a')](_0x33eb6e[_0x6da6('0x34')],function(_0x57ae45){var _0x118826={};_0x118826[_0x57ae45]={'$like':'%'+_0x2495bc[_0x6da6('0x30')][_0x6da6('0x3b')]+'%'};return _0x118826;})});}_0x33eb6e=_[_0x6da6('0x3a')]({},_0x33eb6e,_0x2495bc[_0x6da6('0x3c')]);return _0x105c80[_0x6da6('0x8d')](_0x33eb6e);}})[_0x6da6('0x20')](function(_0x4f91cd){if(_0x4f91cd){_0x355141=_0x4f91cd[_0x6da6('0x44')];if(!_0x2495bc[_0x6da6('0x30')][_0x6da6('0x36')](_0x6da6('0x37'))){_0x33eb6e[_0x6da6('0x18')]=qs[_0x6da6('0x18')](_0x2495bc['query'][_0x6da6('0x18')]);_0x33eb6e[_0x6da6('0x1b')]=qs[_0x6da6('0x1b')](_0x2495bc['query'][_0x6da6('0x1b')]);}return _0x105c80[_0x6da6('0x8d')](_0x33eb6e);}})[_0x6da6('0x20')](function(_0x52d5db){if(_0x52d5db){return _0x52d5db?{'count':_0x355141,'rows':_0x52d5db}:null;}})[_0x6da6('0x20')](respondWithResult(_0x184e1d,null))[_0x6da6('0x41')](handleError(_0x184e1d,null));};exports[_0x6da6('0x8e')]=function(_0x1af412,_0x48e581,_0x56e2b8){var _0x21e4f7,_0x24052e;var _0x20ee4d=[];var _0x5af63b=moment()[_0x6da6('0x62')](_0x6da6('0x63'));return db[_0x6da6('0x2b')][_0x6da6('0x45')]({'where':{'id':_0x1af412['params']['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0x48e581,null))['then'](function(_0xf18937){if(_0xf18937){_0x24052e=_0xf18937;return _0xf18937['addBlackLists'](_0x1af412[_0x6da6('0x47')]['ids'],_[_0x6da6('0x50')](_0x1af412[_0x6da6('0x47')],[_0x6da6('0x64'),'id'])||{});}return null;})[_0x6da6('0x8f')](function(_0x3f7e65){var _0x52ec7e;var _0x462f7b;_0x21e4f7=_0x3f7e65||[];var _0xe76ff9=[];if(_0x3f7e65){for(var _0x142e7e=0x0;_0x142e7e<_0x3f7e65[_0x6da6('0x44')];_0x142e7e+=0x1){var _0x5f544d=_0x3f7e65[_0x142e7e][_0x6da6('0x21')]({'plain':!![]});_0x52ec7e=squel[_0x6da6('0x67')]()[_0x6da6('0x68')](_0x6da6('0x90'))[_0x6da6('0x6a')]([_0x6da6('0x6b'),_0x6da6('0x6d'),'ListId','CampaignId',_0x6da6('0x51'),_0x6da6('0x52')],squel[_0x6da6('0x6e')]()['field'](_0x6da6('0x6b'),_0x6da6('0x6b'))[_0x6da6('0x6f')]('id',_0x6da6('0x6d'))['field'](_0x5f544d['CmListId'][_0x6da6('0x71')](),'ListId')[_0x6da6('0x6f')](_0x1af412[_0x6da6('0x42')]['id'][_0x6da6('0x71')](),_0x6da6('0x58'))[_0x6da6('0x6f')](_0x6da6('0x70'),'createdAt')[_0x6da6('0x6f')](_0x6da6('0x70'),_0x6da6('0x52'))[_0x6da6('0x79')]('cm_contacts')[_0x6da6('0x39')](_0x6da6('0x73'))[_0x6da6('0x39')](_0x6da6('0x74'),_0x5f544d['CmListId']['toString']())['where'](_0x6da6('0x76')))[_0x6da6('0x71')]();_0xe76ff9[_0x6da6('0x89')](db[_0x6da6('0x8a')][_0x6da6('0x30')](_0x52ec7e));}return BPromise[_0x6da6('0x8b')](_0xe76ff9);}})['then'](function(){return _0x21e4f7;})[_0x6da6('0x20')](respondWithResult(_0x48e581,null))['catch'](handleError(_0x48e581,null));};exports[_0x6da6('0x91')]=function(_0x369109,_0x1b7113,_0x39d7df){return db[_0x6da6('0x2b')][_0x6da6('0x45')]({'where':{'id':_0x369109[_0x6da6('0x42')]['id']}})[_0x6da6('0x20')](handleEntityNotFound(_0x1b7113,null))['then'](function(_0x478689){if(_0x478689){return _0x478689['removeBlackLists'](_0x369109[_0x6da6('0x30')]['ids']);}})['then'](function(_0x4203f5){if(_0x4203f5){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x369109[_0x6da6('0x30')]['ids'],'CampaignId':_0x369109[_0x6da6('0x42')]['id']}})[_0x6da6('0x20')](function(){return _0x4203f5;});}})['then'](respondWithStatusCode(_0x1b7113,null))[_0x6da6('0x41')](handleError(_0x1b7113,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 044f8b9..f5ec12e 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(_0x4d8b94,_0x2621c8){var _0x32696f=function(_0xb8ef6a){while(--_0xb8ef6a){_0x4d8b94['push'](_0x4d8b94['shift']());}};_0x32696f(++_0x2621c8);}(_0x7a54,0x106));var _0x47a5=function(_0x48c472,_0xfdc372){_0x48c472=_0x48c472-0x0;var _0x78f305=_0x7a54[_0x48c472];return _0x78f305;};'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(_0x34827d,_0x216e99){var _0x7a060a=function(_0x5b466a){while(--_0x5b466a){_0x34827d['push'](_0x34827d['shift']());}};_0x7a060a(++_0x216e99);}(_0x7a54,0x106));var _0x47a5=function(_0x21a2b7,_0x1242c4){_0x21a2b7=_0x21a2b7-0x0;var _0x135bc4=_0x7a54[_0x21a2b7];return _0x135bc4;};'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 4b21cec..ee7a6ac 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 _0x238f=['client','request','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0xf3c504,_0x4d5a57){var _0x30c191=function(_0x1fbac1){while(--_0x1fbac1){_0xf3c504['push'](_0xf3c504['shift']());}};_0x30c191(++_0x4d5a57);}(_0x238f,0xa5));var _0xf238=function(_0x159529,_0x49c810){_0x159529=_0x159529-0x0;var _0xa948b3=_0x238f[_0x159529];return _0xa948b3;};'use strict';var _=require(_0xf238('0x0'));var util=require(_0xf238('0x1'));var moment=require(_0xf238('0x2'));var BPromise=require('bluebird');var rs=require(_0xf238('0x3'));var fs=require('fs');var Redis=require(_0xf238('0x4'));var db=require(_0xf238('0x5'))['db'];var utils=require(_0xf238('0x6'));var logger=require(_0xf238('0x7'))(_0xf238('0x8'));var config=require('../../config/environment');var jayson=require(_0xf238('0x9'));var client=jayson[_0xf238('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x549a61,_0x355a13,_0x5432d0){return new BPromise(function(_0x430297,_0x2d59db){return client[_0xf238('0xb')](_0x549a61,_0x5432d0)[_0xf238('0xc')](function(_0x5a88c2){logger[_0xf238('0xd')]('Campaign,\x20%s,\x20%s',_0x355a13,_0xf238('0xe'));logger[_0xf238('0xf')](_0xf238('0x10'),_0x355a13,_0xf238('0xe'),JSON[_0xf238('0x11')](_0x5a88c2));if(_0x5a88c2[_0xf238('0x12')]){if(_0x5a88c2[_0xf238('0x12')][_0xf238('0x13')]===0x1f4){logger['error'](_0xf238('0x14'),_0x355a13,_0x5a88c2[_0xf238('0x12')][_0xf238('0x15')]);return _0x2d59db(_0x5a88c2['error'][_0xf238('0x15')]);}logger[_0xf238('0x12')](_0xf238('0x14'),_0x355a13,_0x5a88c2[_0xf238('0x12')][_0xf238('0x15')]);return _0x430297(_0x5a88c2['error'][_0xf238('0x15')]);}else{logger['info'](_0xf238('0x14'),_0x355a13,_0xf238('0xe'));_0x430297(_0x5a88c2[_0xf238('0x16')][_0xf238('0x15')]);}})[_0xf238('0x17')](function(_0xdcf24e){logger[_0xf238('0x12')]('Campaign,\x20%s,\x20%s',_0x355a13,_0xdcf24e);_0x2d59db(_0xdcf24e);});});}exports[_0xf238('0x18')]=function(_0x34053b){var _0x42f740=this;return new Promise(function(_0x11ad75,_0x4d913a){return db[_0xf238('0x19')][_0xf238('0x1a')]({'raw':_0x34053b[_0xf238('0x1b')]?_0x34053b[_0xf238('0x1b')][_0xf238('0x1c')]===undefined?!![]:![]:!![],'where':_0x34053b[_0xf238('0x1b')]?_0x34053b[_0xf238('0x1b')][_0xf238('0x1d')]||null:null,'attributes':_0x34053b[_0xf238('0x1b')]?_0x34053b[_0xf238('0x1b')][_0xf238('0x1e')]||null:null,'limit':_0x34053b[_0xf238('0x1b')]?_0x34053b[_0xf238('0x1b')][_0xf238('0x1f')]||null:null,'include':_0x34053b[_0xf238('0x1b')]?_0x34053b[_0xf238('0x1b')][_0xf238('0x20')]?_[_0xf238('0x21')](_0x34053b[_0xf238('0x1b')][_0xf238('0x20')],function(_0xbb1c0c){return{'model':db[_0xbb1c0c[_0xf238('0x22')]],'as':_0xbb1c0c['as'],'attributes':_0xbb1c0c[_0xf238('0x1e')],'include':_0xbb1c0c[_0xf238('0x20')]?_[_0xf238('0x21')](_0xbb1c0c[_0xf238('0x20')],function(_0x235ce9){return{'model':db[_0x235ce9[_0xf238('0x22')]],'as':_0x235ce9['as'],'attributes':_0x235ce9['attributes'],'include':_0x235ce9[_0xf238('0x20')]?_[_0xf238('0x21')](_0x235ce9[_0xf238('0x20')],function(_0x5c6952){return{'model':db[_0x5c6952[_0xf238('0x22')]],'as':_0x5c6952['as'],'attributes':_0x5c6952[_0xf238('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf238('0xc')](function(_0x3491c0){logger[_0xf238('0xd')](_0xf238('0x18'),_0x34053b);logger[_0xf238('0xf')](_0xf238('0x18'),_0x34053b,JSON[_0xf238('0x11')](_0x3491c0));_0x11ad75(_0x3491c0);})[_0xf238('0x17')](function(_0x3738a9){logger['error']('GetCampaign',_0x3738a9['message'],_0x34053b);_0x4d913a(_0x42f740[_0xf238('0x12')](0x1f4,_0x3738a9[_0xf238('0x15')]));});});}; \ No newline at end of file +var _0x885e=['limit','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','Campaign,\x20%s,\x20%s','message','GetCampaign','Campaign','findAll','options','raw','where','attributes'];(function(_0x408de5,_0x24fa7b){var _0x2015a1=function(_0x13082c){while(--_0x13082c){_0x408de5['push'](_0x408de5['shift']());}};_0x2015a1(++_0x24fa7b);}(_0x885e,0xe4));var _0xe885=function(_0x4f0526,_0x9d60d0){_0x4f0526=_0x4f0526-0x0;var _0xe9031b=_0x885e[_0x4f0526];return _0xe9031b;};'use strict';var _=require(_0xe885('0x0'));var util=require(_0xe885('0x1'));var moment=require('moment');var BPromise=require(_0xe885('0x2'));var rs=require(_0xe885('0x3'));var fs=require('fs');var Redis=require(_0xe885('0x4'));var db=require(_0xe885('0x5'))['db'];var utils=require(_0xe885('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe885('0x7'));var jayson=require(_0xe885('0x8'));var client=jayson[_0xe885('0x9')][_0xe885('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55d2b2,_0x37778a,_0x597bdc){return new BPromise(function(_0x2e8fe0,_0x3c5cc7){return client[_0xe885('0xb')](_0x55d2b2,_0x597bdc)[_0xe885('0xc')](function(_0x231f2f){logger[_0xe885('0xd')]('Campaign,\x20%s,\x20%s',_0x37778a,_0xe885('0xe'));logger[_0xe885('0xf')](_0xe885('0x10'),_0x37778a,_0xe885('0xe'),JSON[_0xe885('0x11')](_0x231f2f));if(_0x231f2f[_0xe885('0x12')]){if(_0x231f2f[_0xe885('0x12')]['code']===0x1f4){logger[_0xe885('0x12')](_0xe885('0x13'),_0x37778a,_0x231f2f[_0xe885('0x12')][_0xe885('0x14')]);return _0x3c5cc7(_0x231f2f[_0xe885('0x12')][_0xe885('0x14')]);}logger[_0xe885('0x12')]('Campaign,\x20%s,\x20%s',_0x37778a,_0x231f2f['error']['message']);return _0x2e8fe0(_0x231f2f[_0xe885('0x12')][_0xe885('0x14')]);}else{logger[_0xe885('0xd')](_0xe885('0x13'),_0x37778a,'request\x20sent');_0x2e8fe0(_0x231f2f['result'][_0xe885('0x14')]);}})['catch'](function(_0x36b9e7){logger[_0xe885('0x12')](_0xe885('0x13'),_0x37778a,_0x36b9e7);_0x3c5cc7(_0x36b9e7);});});}exports[_0xe885('0x15')]=function(_0x25a002){var _0x365eab=this;return new Promise(function(_0x4f5045,_0x39f07c){return db[_0xe885('0x16')][_0xe885('0x17')]({'raw':_0x25a002[_0xe885('0x18')]?_0x25a002[_0xe885('0x18')][_0xe885('0x19')]===undefined?!![]:![]:!![],'where':_0x25a002[_0xe885('0x18')]?_0x25a002['options'][_0xe885('0x1a')]||null:null,'attributes':_0x25a002[_0xe885('0x18')]?_0x25a002[_0xe885('0x18')][_0xe885('0x1b')]||null:null,'limit':_0x25a002[_0xe885('0x18')]?_0x25a002[_0xe885('0x18')][_0xe885('0x1c')]||null:null,'include':_0x25a002[_0xe885('0x18')]?_0x25a002[_0xe885('0x18')][_0xe885('0x1d')]?_[_0xe885('0x1e')](_0x25a002[_0xe885('0x18')]['include'],function(_0x5b7f07){return{'model':db[_0x5b7f07[_0xe885('0x1f')]],'as':_0x5b7f07['as'],'attributes':_0x5b7f07[_0xe885('0x1b')],'include':_0x5b7f07[_0xe885('0x1d')]?_[_0xe885('0x1e')](_0x5b7f07[_0xe885('0x1d')],function(_0x50dd42){return{'model':db[_0x50dd42[_0xe885('0x1f')]],'as':_0x50dd42['as'],'attributes':_0x50dd42[_0xe885('0x1b')],'include':_0x50dd42[_0xe885('0x1d')]?_['map'](_0x50dd42['include'],function(_0x2ba36e){return{'model':db[_0x2ba36e[_0xe885('0x1f')]],'as':_0x2ba36e['as'],'attributes':_0x2ba36e[_0xe885('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe885('0xc')](function(_0x34b23c){logger['info']('GetCampaign',_0x25a002);logger[_0xe885('0xf')](_0xe885('0x15'),_0x25a002,JSON[_0xe885('0x11')](_0x34b23c));_0x4f5045(_0x34b23c);})['catch'](function(_0x370a10){logger[_0xe885('0x12')](_0xe885('0x15'),_0x370a10[_0xe885('0x14')],_0x25a002);_0x39f07c(_0x365eab[_0xe885('0x12')](0x1f4,_0x370a10[_0xe885('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index b7f2d49..5460078 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 _0x209f=['removeBlackLists','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addLists','addBlackLists','put','delete','destroy','/:id/lists','removeLists'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x209f,0x199));var _0xf209=function(_0x28ac84,_0x2a75fa){_0x28ac84=_0x28ac84-0x0;var _0x10c42a=_0x209f[_0x28ac84];return _0x10c42a;};'use strict';var multer=require(_0xf209('0x0'));var util=require('util');var path=require(_0xf209('0x1'));var timeout=require(_0xf209('0x2'));var express=require('express');var router=express[_0xf209('0x3')]();var fs_extra=require(_0xf209('0x4'));var auth=require(_0xf209('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf209('0x6'));var controller=require(_0xf209('0x7'));router[_0xf209('0x8')]('/',auth[_0xf209('0x9')](),controller[_0xf209('0xa')]);router['get'](_0xf209('0xb'),auth[_0xf209('0x9')](),controller[_0xf209('0xc')]);router[_0xf209('0x8')](_0xf209('0xd'),auth[_0xf209('0x9')](),controller['getHoppers']);router[_0xf209('0x8')](_0xf209('0xe'),auth[_0xf209('0x9')](),controller[_0xf209('0xf')]);router['get'](_0xf209('0x10'),auth[_0xf209('0x9')](),controller[_0xf209('0x11')]);router[_0xf209('0x8')](_0xf209('0x12'),auth[_0xf209('0x9')](),controller[_0xf209('0x13')]);router['get']('/:id/lists',auth['isAuthenticated'](),controller[_0xf209('0x14')]);router[_0xf209('0x8')](_0xf209('0x15'),auth['isAuthenticated'](),controller[_0xf209('0x16')]);router[_0xf209('0x17')]('/',auth[_0xf209('0x9')](),controller['create']);router['post'](_0xf209('0x18'),auth['isAuthenticated'](),controller[_0xf209('0x19')]);router[_0xf209('0x17')]('/:id/lists',auth['isAuthenticated'](),controller[_0xf209('0x1a')]);router[_0xf209('0x17')](_0xf209('0x15'),auth[_0xf209('0x9')](),controller[_0xf209('0x1b')]);router[_0xf209('0x1c')](_0xf209('0xb'),auth[_0xf209('0x9')](),controller['update']);router[_0xf209('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0xf209('0x1e')]);router[_0xf209('0x1d')](_0xf209('0x1f'),auth['isAuthenticated'](),controller[_0xf209('0x20')]);router[_0xf209('0x1d')](_0xf209('0x15'),auth[_0xf209('0x9')](),controller[_0xf209('0x21')]);module['exports']=router; \ No newline at end of file +var _0xbe45=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/lists','addLists','delete','removeBlackLists','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe45,0xf0));var _0x5be4=function(_0x1af52c,_0x11d083){_0x1af52c=_0x1af52c-0x0;var _0x130621=_0xbe45[_0x1af52c];return _0x130621;};'use strict';var multer=require(_0x5be4('0x0'));var util=require(_0x5be4('0x1'));var path=require('path');var timeout=require(_0x5be4('0x2'));var express=require(_0x5be4('0x3'));var router=express[_0x5be4('0x4')]();var fs_extra=require(_0x5be4('0x5'));var auth=require(_0x5be4('0x6'));var interaction=require(_0x5be4('0x7'));var config=require('../../config/environment');var controller=require(_0x5be4('0x8'));router[_0x5be4('0x9')]('/',auth[_0x5be4('0xa')](),controller[_0x5be4('0xb')]);router[_0x5be4('0x9')](_0x5be4('0xc'),auth[_0x5be4('0xa')](),controller[_0x5be4('0xd')]);router[_0x5be4('0x9')](_0x5be4('0xe'),auth[_0x5be4('0xa')](),controller[_0x5be4('0xf')]);router[_0x5be4('0x9')]('/:id/hopper_histories',auth[_0x5be4('0xa')](),controller['getHopperHistories']);router['get'](_0x5be4('0x10'),auth['isAuthenticated'](),controller[_0x5be4('0x11')]);router[_0x5be4('0x9')]('/:id/hopper_black',auth[_0x5be4('0xa')](),controller[_0x5be4('0x12')]);router[_0x5be4('0x9')]('/:id/lists',auth[_0x5be4('0xa')](),controller['getLists']);router[_0x5be4('0x9')](_0x5be4('0x13'),auth[_0x5be4('0xa')](),controller[_0x5be4('0x14')]);router[_0x5be4('0x15')]('/',auth[_0x5be4('0xa')](),controller[_0x5be4('0x16')]);router['post'](_0x5be4('0x17'),auth[_0x5be4('0xa')](),controller[_0x5be4('0x18')]);router[_0x5be4('0x15')](_0x5be4('0x19'),auth[_0x5be4('0xa')](),controller[_0x5be4('0x1a')]);router[_0x5be4('0x15')]('/:id/blacklists',auth[_0x5be4('0xa')](),controller['addBlackLists']);router['put'](_0x5be4('0xc'),auth[_0x5be4('0xa')](),controller['update']);router[_0x5be4('0x1b')](_0x5be4('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x5be4('0x1b')](_0x5be4('0x19'),auth['isAuthenticated'](),controller['removeLists']);router[_0x5be4('0x1b')](_0x5be4('0x13'),auth[_0x5be4('0xa')](),controller[_0x5be4('0x1c')]);module[_0x5be4('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index d2ea088..099f0be 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 _0x23a7=['exports','STRING','TEXT','VIRTUAL','getDataValue','key'];(function(_0x4206cc,_0x4c353d){var _0x2e6f04=function(_0x867289){while(--_0x867289){_0x4206cc['push'](_0x4206cc['shift']());}};_0x2e6f04(++_0x4c353d);}(_0x23a7,0xae));var _0x723a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x23a7[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x723a('0x0')]={'key':{'type':Sequelize[_0x723a('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x723a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x723a('0x1')]},'name':{'type':Sequelize[_0x723a('0x3')],'get':function(){return this[_0x723a('0x4')](_0x723a('0x5'));}}}; \ No newline at end of file +var _0x2dce=['getDataValue','key','exports','STRING','TEXT','VIRTUAL'];(function(_0x41cc3f,_0x2678a2){var _0x47ff58=function(_0x190d53){while(--_0x190d53){_0x41cc3f['push'](_0x41cc3f['shift']());}};_0x47ff58(++_0x2678a2);}(_0x2dce,0x68));var _0xe2dc=function(_0x14308b,_0x20093d){_0x14308b=_0x14308b-0x0;var _0x2f54bb=_0x2dce[_0x14308b];return _0x2f54bb;};'use strict';var Sequelize=require('sequelize');module[_0xe2dc('0x0')]={'key':{'type':Sequelize[_0xe2dc('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xe2dc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe2dc('0x1')]},'name':{'type':Sequelize[_0xe2dc('0x3')],'get':function(){return this[_0xe2dc('0x4')](_0xe2dc('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index eea4ee6..c861aa8 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 _0xa6e3=['crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','get','CannedAnswers','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','CannedAnswer','includeAll','findAll','rows','catch','show','include','options','update','body','find','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel'];(function(_0x3c0117,_0x2cfa34){var _0x266665=function(_0x3a2aa5){while(--_0x3a2aa5){_0x3c0117['push'](_0x3c0117['shift']());}};_0x266665(++_0x2cfa34);}(_0xa6e3,0x15c));var _0x3a6e=function(_0x5e75ef,_0x4ce765){_0x5e75ef=_0x5e75ef-0x0;var _0x3c28b2=_0xa6e3[_0x5e75ef];return _0x3c28b2;};'use strict';var emlformat=require(_0x3a6e('0x0'));var rimraf=require(_0x3a6e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a6e('0x2'));var rp=require('request-promise');var moment=require(_0x3a6e('0x3'));var BPromise=require(_0x3a6e('0x4'));var Mustache=require(_0x3a6e('0x5'));var util=require('util');var path=require(_0x3a6e('0x6'));var sox=require(_0x3a6e('0x7'));var csv=require(_0x3a6e('0x8'));var ejs=require(_0x3a6e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3a6e('0xa'));var squel=require(_0x3a6e('0xb'));var crypto=require(_0x3a6e('0xc'));var jsforce=require(_0x3a6e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3a6e('0x8'));var querystring=require('querystring');var Papa=require(_0x3a6e('0xe'));var Redis=require(_0x3a6e('0xf'));var authService=require(_0x3a6e('0x10'));var qs=require(_0x3a6e('0x11'));var as=require(_0x3a6e('0x12'));var hardwareService=require(_0x3a6e('0x13'));var logger=require(_0x3a6e('0x14'))(_0x3a6e('0x15'));var utils=require(_0x3a6e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3a6e('0x17'));var db=require(_0x3a6e('0x18'))['db'];function respondWithStatusCode(_0x53b074,_0xd7879b){_0xd7879b=_0xd7879b||0xcc;return function(_0x4e6b45){if(_0x4e6b45){return _0x53b074[_0x3a6e('0x19')](_0xd7879b);}return _0x53b074[_0x3a6e('0x1a')](_0xd7879b)[_0x3a6e('0x1b')]();};}function respondWithResult(_0x2a1410,_0x4338a4){_0x4338a4=_0x4338a4||0xc8;return function(_0x4b7ea3){if(_0x4b7ea3){return _0x2a1410[_0x3a6e('0x1a')](_0x4338a4)[_0x3a6e('0x1c')](_0x4b7ea3);}};}function respondWithFilteredResult(_0x489820,_0x3b4cee){return function(_0x58b8f0){if(_0x58b8f0){var _0x4e4bac=typeof _0x3b4cee[_0x3a6e('0x1d')]===_0x3a6e('0x1e')&&typeof _0x3b4cee[_0x3a6e('0x1f')]===_0x3a6e('0x1e');var _0x3faa4d=_0x58b8f0[_0x3a6e('0x20')];var _0x459f4e=_0x4e4bac?0x0:_0x3b4cee[_0x3a6e('0x1d')];var _0x24c2d4=_0x4e4bac?_0x58b8f0['count']:_0x3b4cee[_0x3a6e('0x1d')]+_0x3b4cee['limit'];var _0x5671a6;if(_0x24c2d4>=_0x3faa4d){_0x24c2d4=_0x3faa4d;_0x5671a6=0xc8;}else{_0x5671a6=0xce;}_0x489820['status'](_0x5671a6);return _0x489820['set']('Content-Range',_0x459f4e+'-'+_0x24c2d4+'/'+_0x3faa4d)[_0x3a6e('0x1c')](_0x58b8f0);}return null;};}function patchUpdates(_0x2adfd2){return function(_0x13c52d){try{jsonpatch[_0x3a6e('0x21')](_0x13c52d,_0x2adfd2,!![]);}catch(_0x35f331){return BPromise[_0x3a6e('0x22')](_0x35f331);}return _0x13c52d[_0x3a6e('0x23')]();};}function saveUpdates(_0x31bc38,_0x15a890){return function(_0xcfd600){if(_0xcfd600){return _0xcfd600['update'](_0x31bc38)[_0x3a6e('0x24')](function(_0x1c1837){return _0x1c1837;});}return null;};}function removeEntity(_0x1fce44,_0x161dec){return function(_0x6dcaa5){if(_0x6dcaa5){return _0x6dcaa5['destroy']()[_0x3a6e('0x24')](function(){var _0x8036da=_0x6dcaa5[_0x3a6e('0x25')]({'plain':!![]});var _0x55de75=_0x3a6e('0x26');return db['UserProfileResource'][_0x3a6e('0x27')]({'where':{'type':_0x55de75,'resourceId':_0x8036da['id']}})['then'](function(){return _0x6dcaa5;});})['then'](function(){_0x1fce44[_0x3a6e('0x1a')](0xcc)[_0x3a6e('0x1b')]();});}};}function handleEntityNotFound(_0x288940,_0x1bf097){return function(_0x878c3e){if(!_0x878c3e){_0x288940[_0x3a6e('0x19')](0x194);}return _0x878c3e;};}function handleError(_0x2d412c,_0x4083fc){_0x4083fc=_0x4083fc||0x1f4;return function(_0x187d02){logger[_0x3a6e('0x28')](_0x187d02[_0x3a6e('0x29')]);if(_0x187d02[_0x3a6e('0x2a')]){delete _0x187d02['name'];}_0x2d412c[_0x3a6e('0x1a')](_0x4083fc)[_0x3a6e('0x2b')](_0x187d02);};}exports[_0x3a6e('0x2c')]=function(_0x358ae2,_0x4255b0){var _0x39c41b={},_0x52c291={},_0x12799f={'count':0x0,'rows':[]};var _0x1463cc=_[_0x3a6e('0x2d')](db['CannedAnswer'][_0x3a6e('0x2e')],function(_0xd1ac27){return{'name':_0xd1ac27[_0x3a6e('0x2f')],'type':_0xd1ac27[_0x3a6e('0x30')][_0x3a6e('0x31')]};});_0x52c291[_0x3a6e('0x32')]=_[_0x3a6e('0x2d')](_0x1463cc,'name');_0x52c291[_0x3a6e('0x33')]=_[_0x3a6e('0x34')](_0x358ae2[_0x3a6e('0x33')]);_0x52c291[_0x3a6e('0x35')]=_[_0x3a6e('0x36')](_0x52c291[_0x3a6e('0x32')],_0x52c291[_0x3a6e('0x33')]);_0x39c41b[_0x3a6e('0x37')]=_[_0x3a6e('0x36')](_0x52c291[_0x3a6e('0x32')],qs['fields'](_0x358ae2[_0x3a6e('0x33')][_0x3a6e('0x38')]));_0x39c41b[_0x3a6e('0x37')]=_0x39c41b['attributes'][_0x3a6e('0x39')]?_0x39c41b[_0x3a6e('0x37')]:_0x52c291[_0x3a6e('0x32')];if(!_0x358ae2[_0x3a6e('0x33')][_0x3a6e('0x3a')](_0x3a6e('0x3b'))){_0x39c41b['limit']=qs['limit'](_0x358ae2[_0x3a6e('0x33')][_0x3a6e('0x1f')]);_0x39c41b[_0x3a6e('0x1d')]=qs['offset'](_0x358ae2['query'][_0x3a6e('0x1d')]);}_0x39c41b['order']=qs[_0x3a6e('0x3c')](_0x358ae2['query'][_0x3a6e('0x3c')]);_0x39c41b[_0x3a6e('0x3d')]=qs[_0x3a6e('0x35')](_['pick'](_0x358ae2[_0x3a6e('0x33')],_0x52c291[_0x3a6e('0x35')]),_0x1463cc);if(_0x358ae2[_0x3a6e('0x33')][_0x3a6e('0x3e')]){_0x39c41b[_0x3a6e('0x3d')]=_[_0x3a6e('0x3f')](_0x39c41b['where'],{'$or':[{'key':{'$like':'%'+_0x358ae2[_0x3a6e('0x33')][_0x3a6e('0x3e')]+'%'}},{'value':{'$like':'%'+_0x358ae2[_0x3a6e('0x33')][_0x3a6e('0x3e')]+'%'}}]});}_0x39c41b=_[_0x3a6e('0x3f')]({},_0x39c41b,_0x358ae2['options']);var _0x20dca6={'where':_0x39c41b[_0x3a6e('0x3d')]};return db[_0x3a6e('0x40')][_0x3a6e('0x20')](_0x20dca6)[_0x3a6e('0x24')](function(_0x34bf65){_0x12799f[_0x3a6e('0x20')]=_0x34bf65;if(_0x358ae2[_0x3a6e('0x33')][_0x3a6e('0x41')]){_0x39c41b['include']=[{'all':!![]}];}return db[_0x3a6e('0x40')][_0x3a6e('0x42')](_0x39c41b);})[_0x3a6e('0x24')](function(_0x3f899e){_0x12799f[_0x3a6e('0x43')]=_0x3f899e;return _0x12799f;})[_0x3a6e('0x24')](respondWithFilteredResult(_0x4255b0,_0x39c41b))[_0x3a6e('0x44')](handleError(_0x4255b0,null));};exports[_0x3a6e('0x45')]=function(_0x878568,_0x39572c){var _0x48bb8f={'raw':!![],'where':{'id':_0x878568['params']['id']}},_0x5cf30a={};_0x5cf30a[_0x3a6e('0x32')]=_[_0x3a6e('0x34')](db[_0x3a6e('0x40')]['rawAttributes']);_0x5cf30a[_0x3a6e('0x33')]=_[_0x3a6e('0x34')](_0x878568[_0x3a6e('0x33')]);_0x5cf30a[_0x3a6e('0x35')]=_[_0x3a6e('0x36')](_0x5cf30a[_0x3a6e('0x32')],_0x5cf30a[_0x3a6e('0x33')]);_0x48bb8f[_0x3a6e('0x37')]=_[_0x3a6e('0x36')](_0x5cf30a['model'],qs[_0x3a6e('0x38')](_0x878568[_0x3a6e('0x33')]['fields']));_0x48bb8f[_0x3a6e('0x37')]=_0x48bb8f[_0x3a6e('0x37')][_0x3a6e('0x39')]?_0x48bb8f[_0x3a6e('0x37')]:_0x5cf30a[_0x3a6e('0x32')];if(_0x878568[_0x3a6e('0x33')][_0x3a6e('0x41')]){_0x48bb8f[_0x3a6e('0x46')]=[{'all':!![]}];}_0x48bb8f=_[_0x3a6e('0x3f')]({},_0x48bb8f,_0x878568[_0x3a6e('0x47')]);return db[_0x3a6e('0x40')]['find'](_0x48bb8f)[_0x3a6e('0x24')](handleEntityNotFound(_0x39572c,null))['then'](respondWithResult(_0x39572c,null))[_0x3a6e('0x44')](handleError(_0x39572c,null));};exports[_0x3a6e('0x48')]=function(_0x25bbe1,_0x100fc4){if(_0x25bbe1[_0x3a6e('0x49')]['id']){delete _0x25bbe1['body']['id'];}return db[_0x3a6e('0x40')][_0x3a6e('0x4a')]({'where':{'id':_0x25bbe1[_0x3a6e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x100fc4,null))[_0x3a6e('0x24')](saveUpdates(_0x25bbe1[_0x3a6e('0x49')],null))[_0x3a6e('0x24')](respondWithResult(_0x100fc4,null))['catch'](handleError(_0x100fc4,null));};exports[_0x3a6e('0x27')]=function(_0xe4e069,_0xb8b7c0){return db[_0x3a6e('0x40')]['find']({'where':{'id':_0xe4e069['params']['id']}})[_0x3a6e('0x24')](handleEntityNotFound(_0xb8b7c0,null))[_0x3a6e('0x24')](removeEntity(_0xb8b7c0,null))[_0x3a6e('0x44')](handleError(_0xb8b7c0,null));};exports[_0x3a6e('0x4c')]=function(_0x175c58,_0x4302fd){var _0xea67fe={'key':_0x175c58[_0x3a6e('0x49')][_0x3a6e('0x31')]};if(_0x175c58[_0x3a6e('0x49')][_0x3a6e('0x4d')]){_0xea67fe[_0x3a6e('0x4d')]=_0x175c58[_0x3a6e('0x49')][_0x3a6e('0x4d')];}else if(_0x175c58[_0x3a6e('0x49')][_0x3a6e('0x4e')]){_0xea67fe[_0x3a6e('0x4e')]=_0x175c58[_0x3a6e('0x49')][_0x3a6e('0x4e')];}else if(_0x175c58[_0x3a6e('0x49')][_0x3a6e('0x4f')]){_0xea67fe[_0x3a6e('0x4f')]=_0x175c58['body'][_0x3a6e('0x4f')];}else if(_0x175c58[_0x3a6e('0x49')]['ChatWebsiteId']){_0xea67fe['ChatWebsiteId']=_0x175c58[_0x3a6e('0x49')][_0x3a6e('0x50')];}return db[_0x3a6e('0x40')][_0x3a6e('0x4a')]({'where':_0xea67fe})[_0x3a6e('0x24')](function(_0x30f00b){if(_0x30f00b){throw new db[(_0x3a6e('0x51'))][(_0x3a6e('0x52'))](_0x3a6e('0x53'));}return db[_0x3a6e('0x40')][_0x3a6e('0x4c')](_0x175c58['body']);})[_0x3a6e('0x24')](function(_0x470a57){var _0x260e22=_0x175c58[_0x3a6e('0x54')][_0x3a6e('0x25')]({'plain':!![]});if(!_0x260e22)throw new Error(_0x3a6e('0x55'));if(_0x260e22[_0x3a6e('0x56')]===_0x3a6e('0x54')){var _0x450cff=_0x470a57[_0x3a6e('0x25')]({'plain':!![]});return db[_0x3a6e('0x57')][_0x3a6e('0x4a')]({'where':{'name':'CannedAnswers','userProfileId':_0x260e22['userProfileId']},'raw':!![]})[_0x3a6e('0x24')](function(_0xe9f606){if(_0xe9f606&&_0xe9f606[_0x3a6e('0x58')]===0x0){return db['UserProfileResource']['create']({'name':_0x450cff['name'],'resourceId':_0x450cff['id'],'type':_0xe9f606[_0x3a6e('0x2a')],'sectionId':_0xe9f606['id']},{})['then'](function(){return _0x470a57;});}else{return _0x470a57;}})['catch'](function(_0x2e19e0){logger[_0x3a6e('0x28')](_0x3a6e('0x59'),_0x2e19e0);throw _0x2e19e0;});}return _0x470a57;})[_0x3a6e('0x24')](respondWithResult(_0x4302fd,0xc9))[_0x3a6e('0x44')](handleError(_0x4302fd,null));}; \ No newline at end of file +var _0x3882=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','update','destroy','get','CannedAnswers','UserProfileResource','then','name','send','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','merge','where','filter','options','CannedAnswer','include','findAll','rows','catch','show','keys','includeAll','find','body','params','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3882,0x164));var _0x2388=function(_0x26e312,_0x4c0fed){_0x26e312=_0x26e312-0x0;var _0x3d73ce=_0x3882[_0x26e312];return _0x3d73ce;};'use strict';var emlformat=require(_0x2388('0x0'));var rimraf=require(_0x2388('0x1'));var zipdir=require(_0x2388('0x2'));var jsonpatch=require(_0x2388('0x3'));var rp=require('request-promise');var moment=require(_0x2388('0x4'));var BPromise=require(_0x2388('0x5'));var Mustache=require(_0x2388('0x6'));var util=require('util');var path=require(_0x2388('0x7'));var sox=require(_0x2388('0x8'));var csv=require(_0x2388('0x9'));var ejs=require(_0x2388('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2388('0xb'));var crypto=require(_0x2388('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2388('0xd'));var Papa=require('papaparse');var Redis=require(_0x2388('0xe'));var authService=require(_0x2388('0xf'));var qs=require(_0x2388('0x10'));var as=require(_0x2388('0x11'));var hardwareService=require(_0x2388('0x12'));var logger=require('../../config/logger')(_0x2388('0x13'));var utils=require(_0x2388('0x14'));var config=require(_0x2388('0x15'));var licenseUtil=require(_0x2388('0x16'));var db=require(_0x2388('0x17'))['db'];function respondWithStatusCode(_0x3f4735,_0x5686cb){_0x5686cb=_0x5686cb||0xcc;return function(_0x2bb636){if(_0x2bb636){return _0x3f4735[_0x2388('0x18')](_0x5686cb);}return _0x3f4735[_0x2388('0x19')](_0x5686cb)[_0x2388('0x1a')]();};}function respondWithResult(_0xde2cfa,_0x426475){_0x426475=_0x426475||0xc8;return function(_0x214044){if(_0x214044){return _0xde2cfa[_0x2388('0x19')](_0x426475)[_0x2388('0x1b')](_0x214044);}};}function respondWithFilteredResult(_0x4e8076,_0x317134){return function(_0x9f70a6){if(_0x9f70a6){var _0x15040c=typeof _0x317134[_0x2388('0x1c')]==='undefined'&&typeof _0x317134[_0x2388('0x1d')]===_0x2388('0x1e');var _0x23dd84=_0x9f70a6[_0x2388('0x1f')];var _0x452451=_0x15040c?0x0:_0x317134[_0x2388('0x1c')];var _0x508b53=_0x15040c?_0x9f70a6[_0x2388('0x1f')]:_0x317134[_0x2388('0x1c')]+_0x317134[_0x2388('0x1d')];var _0xd402e2;if(_0x508b53>=_0x23dd84){_0x508b53=_0x23dd84;_0xd402e2=0xc8;}else{_0xd402e2=0xce;}_0x4e8076[_0x2388('0x19')](_0xd402e2);return _0x4e8076['set']('Content-Range',_0x452451+'-'+_0x508b53+'/'+_0x23dd84)[_0x2388('0x1b')](_0x9f70a6);}return null;};}function patchUpdates(_0x20bf7c){return function(_0x551140){try{jsonpatch[_0x2388('0x20')](_0x551140,_0x20bf7c,!![]);}catch(_0x2a7d9a){return BPromise[_0x2388('0x21')](_0x2a7d9a);}return _0x551140[_0x2388('0x22')]();};}function saveUpdates(_0x317eb7,_0x5707ed){return function(_0x175681){if(_0x175681){return _0x175681[_0x2388('0x23')](_0x317eb7)['then'](function(_0x3e1467){return _0x3e1467;});}return null;};}function removeEntity(_0x599133,_0xfa3865){return function(_0x179f9c){if(_0x179f9c){return _0x179f9c[_0x2388('0x24')]()['then'](function(){var _0x4cc254=_0x179f9c[_0x2388('0x25')]({'plain':!![]});var _0x2e6722=_0x2388('0x26');return db[_0x2388('0x27')]['destroy']({'where':{'type':_0x2e6722,'resourceId':_0x4cc254['id']}})[_0x2388('0x28')](function(){return _0x179f9c;});})[_0x2388('0x28')](function(){_0x599133[_0x2388('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9f690f,_0x26c68c){return function(_0x4bf932){if(!_0x4bf932){_0x9f690f[_0x2388('0x18')](0x194);}return _0x4bf932;};}function handleError(_0x55c640,_0x4f6bd6){_0x4f6bd6=_0x4f6bd6||0x1f4;return function(_0xe17c91){logger['error'](_0xe17c91['stack']);if(_0xe17c91[_0x2388('0x29')]){delete _0xe17c91[_0x2388('0x29')];}_0x55c640[_0x2388('0x19')](_0x4f6bd6)[_0x2388('0x2a')](_0xe17c91);};}exports['index']=function(_0x11c172,_0x3b262a){var _0x3329b3={},_0x3dbe69={},_0x515ac0={'count':0x0,'rows':[]};var _0x4f8883=_[_0x2388('0x2b')](db['CannedAnswer'][_0x2388('0x2c')],function(_0x399ec8){return{'name':_0x399ec8['fieldName'],'type':_0x399ec8[_0x2388('0x2d')]['key']};});_0x3dbe69[_0x2388('0x2e')]=_[_0x2388('0x2b')](_0x4f8883,_0x2388('0x29'));_0x3dbe69[_0x2388('0x2f')]=_['keys'](_0x11c172[_0x2388('0x2f')]);_0x3dbe69[_0x2388('0x30')]=_[_0x2388('0x31')](_0x3dbe69[_0x2388('0x2e')],_0x3dbe69[_0x2388('0x2f')]);_0x3329b3[_0x2388('0x32')]=_['intersection'](_0x3dbe69['model'],qs[_0x2388('0x33')](_0x11c172['query'][_0x2388('0x33')]));_0x3329b3[_0x2388('0x32')]=_0x3329b3[_0x2388('0x32')][_0x2388('0x34')]?_0x3329b3[_0x2388('0x32')]:_0x3dbe69[_0x2388('0x2e')];if(!_0x11c172['query'][_0x2388('0x35')]('nolimit')){_0x3329b3[_0x2388('0x1d')]=qs[_0x2388('0x1d')](_0x11c172['query'][_0x2388('0x1d')]);_0x3329b3[_0x2388('0x1c')]=qs['offset'](_0x11c172[_0x2388('0x2f')][_0x2388('0x1c')]);}_0x3329b3['order']=qs[_0x2388('0x36')](_0x11c172[_0x2388('0x2f')][_0x2388('0x36')]);_0x3329b3['where']=qs[_0x2388('0x30')](_[_0x2388('0x37')](_0x11c172[_0x2388('0x2f')],_0x3dbe69[_0x2388('0x30')]),_0x4f8883);if(_0x11c172[_0x2388('0x2f')]['filter']){_0x3329b3['where']=_[_0x2388('0x38')](_0x3329b3[_0x2388('0x39')],{'$or':[{'key':{'$like':'%'+_0x11c172['query'][_0x2388('0x3a')]+'%'}},{'value':{'$like':'%'+_0x11c172[_0x2388('0x2f')][_0x2388('0x3a')]+'%'}}]});}_0x3329b3=_[_0x2388('0x38')]({},_0x3329b3,_0x11c172[_0x2388('0x3b')]);var _0x20e64a={'where':_0x3329b3[_0x2388('0x39')]};return db[_0x2388('0x3c')][_0x2388('0x1f')](_0x20e64a)['then'](function(_0x1118a9){_0x515ac0[_0x2388('0x1f')]=_0x1118a9;if(_0x11c172[_0x2388('0x2f')]['includeAll']){_0x3329b3[_0x2388('0x3d')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2388('0x3e')](_0x3329b3);})['then'](function(_0x14e169){_0x515ac0[_0x2388('0x3f')]=_0x14e169;return _0x515ac0;})[_0x2388('0x28')](respondWithFilteredResult(_0x3b262a,_0x3329b3))[_0x2388('0x40')](handleError(_0x3b262a,null));};exports[_0x2388('0x41')]=function(_0x538d98,_0x28ec17){var _0x3beb38={'raw':!![],'where':{'id':_0x538d98['params']['id']}},_0x4f2f63={};_0x4f2f63[_0x2388('0x2e')]=_['keys'](db['CannedAnswer'][_0x2388('0x2c')]);_0x4f2f63[_0x2388('0x2f')]=_[_0x2388('0x42')](_0x538d98[_0x2388('0x2f')]);_0x4f2f63[_0x2388('0x30')]=_[_0x2388('0x31')](_0x4f2f63[_0x2388('0x2e')],_0x4f2f63[_0x2388('0x2f')]);_0x3beb38[_0x2388('0x32')]=_[_0x2388('0x31')](_0x4f2f63[_0x2388('0x2e')],qs['fields'](_0x538d98[_0x2388('0x2f')][_0x2388('0x33')]));_0x3beb38[_0x2388('0x32')]=_0x3beb38[_0x2388('0x32')][_0x2388('0x34')]?_0x3beb38[_0x2388('0x32')]:_0x4f2f63[_0x2388('0x2e')];if(_0x538d98['query'][_0x2388('0x43')]){_0x3beb38[_0x2388('0x3d')]=[{'all':!![]}];}_0x3beb38=_['merge']({},_0x3beb38,_0x538d98[_0x2388('0x3b')]);return db[_0x2388('0x3c')][_0x2388('0x44')](_0x3beb38)[_0x2388('0x28')](handleEntityNotFound(_0x28ec17,null))[_0x2388('0x28')](respondWithResult(_0x28ec17,null))['catch'](handleError(_0x28ec17,null));};exports[_0x2388('0x23')]=function(_0x5a7d45,_0x1841f8){if(_0x5a7d45['body']['id']){delete _0x5a7d45[_0x2388('0x45')]['id'];}return db['CannedAnswer'][_0x2388('0x44')]({'where':{'id':_0x5a7d45[_0x2388('0x46')]['id']}})[_0x2388('0x28')](handleEntityNotFound(_0x1841f8,null))[_0x2388('0x28')](saveUpdates(_0x5a7d45['body'],null))[_0x2388('0x28')](respondWithResult(_0x1841f8,null))[_0x2388('0x40')](handleError(_0x1841f8,null));};exports[_0x2388('0x24')]=function(_0x362dff,_0xe47e42){return db['CannedAnswer'][_0x2388('0x44')]({'where':{'id':_0x362dff[_0x2388('0x46')]['id']}})[_0x2388('0x28')](handleEntityNotFound(_0xe47e42,null))['then'](removeEntity(_0xe47e42,null))[_0x2388('0x40')](handleError(_0xe47e42,null));};exports[_0x2388('0x47')]=function(_0x279a90,_0x57eead){var _0xf8f59={'key':_0x279a90[_0x2388('0x45')][_0x2388('0x48')]};if(_0x279a90[_0x2388('0x45')]['MailAccountId']){_0xf8f59[_0x2388('0x49')]=_0x279a90[_0x2388('0x45')][_0x2388('0x49')];}else if(_0x279a90['body'][_0x2388('0x4a')]){_0xf8f59['SmsAccountId']=_0x279a90[_0x2388('0x45')][_0x2388('0x4a')];}else if(_0x279a90[_0x2388('0x45')][_0x2388('0x4b')]){_0xf8f59[_0x2388('0x4b')]=_0x279a90[_0x2388('0x45')]['OpenchannelAccountId'];}else if(_0x279a90['body'][_0x2388('0x4c')]){_0xf8f59[_0x2388('0x4c')]=_0x279a90[_0x2388('0x45')][_0x2388('0x4c')];}return db['CannedAnswer'][_0x2388('0x44')]({'where':_0xf8f59})[_0x2388('0x28')](function(_0x4bfda7){if(_0x4bfda7){throw new db[(_0x2388('0x4d'))][(_0x2388('0x4e'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0x2388('0x3c')][_0x2388('0x47')](_0x279a90[_0x2388('0x45')]);})['then'](function(_0x30a28f){var _0x27eeff=_0x279a90[_0x2388('0x4f')][_0x2388('0x25')]({'plain':!![]});if(!_0x27eeff)throw new Error(_0x2388('0x50'));if(_0x27eeff[_0x2388('0x51')]===_0x2388('0x4f')){var _0x4a3166=_0x30a28f[_0x2388('0x25')]({'plain':!![]});return db[_0x2388('0x52')][_0x2388('0x44')]({'where':{'name':_0x2388('0x26'),'userProfileId':_0x27eeff[_0x2388('0x53')]},'raw':!![]})[_0x2388('0x28')](function(_0x1efc14){if(_0x1efc14&&_0x1efc14[_0x2388('0x54')]===0x0){return db[_0x2388('0x27')]['create']({'name':_0x4a3166['name'],'resourceId':_0x4a3166['id'],'type':_0x1efc14[_0x2388('0x29')],'sectionId':_0x1efc14['id']},{})[_0x2388('0x28')](function(){return _0x30a28f;});}else{return _0x30a28f;}})[_0x2388('0x40')](function(_0x1ecd50){logger[_0x2388('0x55')](_0x2388('0x56'),_0x1ecd50);throw _0x1ecd50;});}return _0x30a28f;})[_0x2388('0x28')](respondWithResult(_0x57eead,0xc9))[_0x2388('0x40')](handleError(_0x57eead,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 4385ed9..3b81c26 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 _0x0e01=['exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','rimraf'];(function(_0x5f1805,_0x3b4c95){var _0x12a8b0=function(_0xc56f3f){while(--_0xc56f3f){_0x5f1805['push'](_0x5f1805['shift']());}};_0x12a8b0(++_0x3b4c95);}(_0x0e01,0x87));var _0x10e0=function(_0x96cfa1,_0x566794){_0x96cfa1=_0x96cfa1-0x0;var _0x163e4a=_0x0e01[_0x96cfa1];return _0x163e4a;};'use strict';var _=require(_0x10e0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x10e0('0x1'));var moment=require(_0x10e0('0x2'));var BPromise=require(_0x10e0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x10e0('0x4'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module[_0x10e0('0x5')]=function(_0x4a9f5f,_0x684dac){return _0x4a9f5f[_0x10e0('0x6')]('CannedAnswer',attributes,{'tableName':_0x10e0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x10e0('0x8'),'collate':_0x10e0('0x9')});}; \ No newline at end of file +var _0x62d5=['exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x62d5,0xbc));var _0x562d=function(_0x4f46e6,_0x1e71d1){_0x4f46e6=_0x4f46e6-0x0;var _0x2f1799=_0x62d5[_0x4f46e6];return _0x2f1799;};'use strict';var _=require(_0x562d('0x0'));var util=require(_0x562d('0x1'));var logger=require(_0x562d('0x2'))(_0x562d('0x3'));var moment=require('moment');var BPromise=require(_0x562d('0x4'));var rp=require(_0x562d('0x5'));var fs=require('fs');var path=require(_0x562d('0x6'));var rimraf=require('rimraf');var config=require(_0x562d('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0x562d('0x8')]=function(_0x28d7c6,_0x505f16){return _0x28d7c6[_0x562d('0x9')](_0x562d('0xa'),attributes,{'tableName':_0x562d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x562d('0xc'),'collate':_0x562d('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 0b285e1..9933f6c 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(_0x44d004,_0x3b8eae){var _0x332d58=function(_0x27916a){while(--_0x27916a){_0x44d004['push'](_0x44d004['shift']());}};_0x332d58(++_0x3b8eae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5c0d8e,_0x3b795b){var _0x43b982=function(_0x8b3dff){while(--_0x8b3dff){_0x5c0d8e['push'](_0x5c0d8e['shift']());}};_0x43b982(++_0x3b795b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 ef534e3..0298526 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 _0xffed=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','path'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xffed,0x1c1));var _0xdffe=function(_0x4ab012,_0x9e211e){_0x4ab012=_0x4ab012-0x0;var _0x573fa7=_0xffed[_0x4ab012];return _0x573fa7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdffe('0x0'));var timeout=require(_0xdffe('0x1'));var express=require(_0xdffe('0x2'));var router=express[_0xdffe('0x3')]();var fs_extra=require(_0xdffe('0x4'));var auth=require(_0xdffe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdffe('0x6'));var controller=require(_0xdffe('0x7'));router[_0xdffe('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdffe('0x8')](_0xdffe('0x9'),auth[_0xdffe('0xa')](),controller[_0xdffe('0xb')]);router[_0xdffe('0xc')]('/',auth[_0xdffe('0xa')](),controller[_0xdffe('0xd')]);router['put']('/:id',auth[_0xdffe('0xa')](),controller[_0xdffe('0xe')]);router[_0xdffe('0xf')](_0xdffe('0x9'),auth[_0xdffe('0xa')](),controller[_0xdffe('0x10')]);module[_0xdffe('0x11')]=router; \ No newline at end of file +var _0x7103=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id'];(function(_0x4eb645,_0x2819b4){var _0x1602c1=function(_0x195426){while(--_0x195426){_0x4eb645['push'](_0x4eb645['shift']());}};_0x1602c1(++_0x2819b4);}(_0x7103,0x126));var _0x3710=function(_0xf210cd,_0x3f4f86){_0xf210cd=_0xf210cd-0x0;var _0x571220=_0x7103[_0xf210cd];return _0x571220;};'use strict';var multer=require(_0x3710('0x0'));var util=require(_0x3710('0x1'));var path=require(_0x3710('0x2'));var timeout=require(_0x3710('0x3'));var express=require(_0x3710('0x4'));var router=express[_0x3710('0x5')]();var fs_extra=require(_0x3710('0x6'));var auth=require(_0x3710('0x7'));var interaction=require(_0x3710('0x8'));var config=require(_0x3710('0x9'));var controller=require(_0x3710('0xa'));router[_0x3710('0xb')]('/',auth[_0x3710('0xc')](),controller['index']);router['get'](_0x3710('0xd'),auth[_0x3710('0xc')](),controller[_0x3710('0xe')]);router[_0x3710('0xf')]('/',auth[_0x3710('0xc')](),controller[_0x3710('0x10')]);router[_0x3710('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3710('0x12')]);router[_0x3710('0x13')]('/:id',auth[_0x3710('0xc')](),controller[_0x3710('0x14')]);module[_0x3710('0x15')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 563d8b8..6346dc7 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 _0x71c8=['exports','DATE','STRING','INTEGER','sequelize'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x71c8,0x149));var _0x871c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x71c8[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x871c('0x0'));module[_0x871c('0x1')]={'calldate':{'type':Sequelize[_0x871c('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x871c('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x871c('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x871c('0x3')]},'lastapp':{'type':Sequelize[_0x871c('0x3')]},'lastdata':{'type':Sequelize[_0x871c('0x3')]},'duration':{'type':Sequelize[_0x871c('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x871c('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x871c('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x871c('0x3')]},'uniqueid':{'type':Sequelize[_0x871c('0x3')]},'linkedid':{'type':Sequelize[_0x871c('0x3')]},'sequence':{'type':Sequelize[_0x871c('0x3')]},'peeraccount':{'type':Sequelize[_0x871c('0x3')]},'type':{'type':Sequelize[_0x871c('0x3')]},'tag':{'type':Sequelize[_0x871c('0x3')]}}; \ No newline at end of file +var _0x04b8=['INTEGER','exports','1970-01-01\x2000:00:01','STRING'];(function(_0x51e6fb,_0x1c0b7e){var _0x4e30a7=function(_0x2446c2){while(--_0x2446c2){_0x51e6fb['push'](_0x51e6fb['shift']());}};_0x4e30a7(++_0x1c0b7e);}(_0x04b8,0x159));var _0x804b=function(_0x585276,_0x553f5a){_0x585276=_0x585276-0x0;var _0x4a7181=_0x04b8[_0x585276];return _0x4a7181;};'use strict';var Sequelize=require('sequelize');module[_0x804b('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x804b('0x1')},'clid':{'type':Sequelize[_0x804b('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x804b('0x2')]},'dcontext':{'type':Sequelize[_0x804b('0x2')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x804b('0x2')]},'lastapp':{'type':Sequelize[_0x804b('0x2')]},'lastdata':{'type':Sequelize[_0x804b('0x2')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x804b('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x804b('0x2')]},'amaflags':{'type':Sequelize[_0x804b('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x804b('0x2')]},'uniqueid':{'type':Sequelize[_0x804b('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x804b('0x2')]},'peeraccount':{'type':Sequelize[_0x804b('0x2')]},'type':{'type':Sequelize[_0x804b('0x2')]},'tag':{'type':Sequelize[_0x804b('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index eab0398..9176e2b 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 _0xb66c=['catch','show','params','includeAll','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','Cdr','include'];(function(_0x1af05b,_0x5134b5){var _0x5be7cc=function(_0x2d4ac0){while(--_0x2d4ac0){_0x1af05b['push'](_0x1af05b['shift']());}};_0x5be7cc(++_0x5134b5);}(_0xb66c,0x175));var _0xcb66=function(_0x25a9d8,_0x34ee82){_0x25a9d8=_0x25a9d8-0x0;var _0x245dfe=_0xb66c[_0x25a9d8];return _0x245dfe;};'use strict';var emlformat=require(_0xcb66('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcb66('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb66('0x2'));var moment=require(_0xcb66('0x3'));var BPromise=require(_0xcb66('0x4'));var Mustache=require('mustache');var util=require(_0xcb66('0x5'));var path=require(_0xcb66('0x6'));var sox=require(_0xcb66('0x7'));var csv=require(_0xcb66('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb66('0x9'));var squel=require(_0xcb66('0xa'));var crypto=require(_0xcb66('0xb'));var jsforce=require(_0xcb66('0xc'));var deskjs=require(_0xcb66('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcb66('0xe'));var Papa=require(_0xcb66('0xf'));var Redis=require(_0xcb66('0x10'));var authService=require(_0xcb66('0x11'));var qs=require(_0xcb66('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb66('0x13'));var logger=require(_0xcb66('0x14'))(_0xcb66('0x15'));var utils=require(_0xcb66('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcb66('0x17'));var db=require(_0xcb66('0x18'))['db'];function respondWithStatusCode(_0x4105d2,_0x2339bb){_0x2339bb=_0x2339bb||0xcc;return function(_0x582523){if(_0x582523){return _0x4105d2[_0xcb66('0x19')](_0x2339bb);}return _0x4105d2[_0xcb66('0x1a')](_0x2339bb)[_0xcb66('0x1b')]();};}function respondWithResult(_0x401bc9,_0x58fb9e){_0x58fb9e=_0x58fb9e||0xc8;return function(_0x19072b){if(_0x19072b){return _0x401bc9['status'](_0x58fb9e)[_0xcb66('0x1c')](_0x19072b);}};}function respondWithFilteredResult(_0x52b058,_0x27442d){return function(_0x573dc7){if(_0x573dc7){var _0x4bef09=typeof _0x27442d[_0xcb66('0x1d')]===_0xcb66('0x1e')&&typeof _0x27442d[_0xcb66('0x1f')]===_0xcb66('0x1e');var _0x4d99c0=_0x573dc7[_0xcb66('0x20')];var _0x42ad03=_0x4bef09?0x0:_0x27442d[_0xcb66('0x1d')];var _0x58bca0=_0x4bef09?_0x573dc7[_0xcb66('0x20')]:_0x27442d['offset']+_0x27442d[_0xcb66('0x1f')];var _0x41edae;if(_0x58bca0>=_0x4d99c0){_0x58bca0=_0x4d99c0;_0x41edae=0xc8;}else{_0x41edae=0xce;}_0x52b058[_0xcb66('0x1a')](_0x41edae);return _0x52b058[_0xcb66('0x21')]('Content-Range',_0x42ad03+'-'+_0x58bca0+'/'+_0x4d99c0)['json'](_0x573dc7);}return null;};}function patchUpdates(_0x4d9690){return function(_0xb39b87){try{jsonpatch['apply'](_0xb39b87,_0x4d9690,!![]);}catch(_0x5e07e8){return BPromise[_0xcb66('0x22')](_0x5e07e8);}return _0xb39b87['save']();};}function saveUpdates(_0x1c1219,_0x12e2bc){return function(_0x602b44){if(_0x602b44){return _0x602b44[_0xcb66('0x23')](_0x1c1219)[_0xcb66('0x24')](function(_0x204f15){return _0x204f15;});}return null;};}function removeEntity(_0x3391a0,_0x5977e1){return function(_0x36faba){if(_0x36faba){return _0x36faba['destroy']()['then'](function(){_0x3391a0[_0xcb66('0x1a')](0xcc)[_0xcb66('0x1b')]();});}};}function handleEntityNotFound(_0x19da3b,_0x5f389f){return function(_0x341554){if(!_0x341554){_0x19da3b[_0xcb66('0x19')](0x194);}return _0x341554;};}function handleError(_0x43cd8f,_0x40e3de){_0x40e3de=_0x40e3de||0x1f4;return function(_0x5affdb){logger[_0xcb66('0x25')](_0x5affdb[_0xcb66('0x26')]);if(_0x5affdb[_0xcb66('0x27')]){delete _0x5affdb[_0xcb66('0x27')];}_0x43cd8f[_0xcb66('0x1a')](_0x40e3de)[_0xcb66('0x28')](_0x5affdb);};}exports[_0xcb66('0x29')]=function(_0x967710,_0x28fc0b){var _0x178a06={},_0x516194={},_0x2152dc={'count':0x0,'rows':[]};var _0x5b7cf2=_['map'](db['Cdr'][_0xcb66('0x2a')],function(_0x4ca8b4){return{'name':_0x4ca8b4[_0xcb66('0x2b')],'type':_0x4ca8b4[_0xcb66('0x2c')][_0xcb66('0x2d')]};});_0x516194['model']=_[_0xcb66('0x2e')](_0x5b7cf2,_0xcb66('0x27'));_0x516194[_0xcb66('0x2f')]=_[_0xcb66('0x30')](_0x967710[_0xcb66('0x2f')]);_0x516194[_0xcb66('0x31')]=_[_0xcb66('0x32')](_0x516194[_0xcb66('0x33')],_0x516194[_0xcb66('0x2f')]);_0x178a06[_0xcb66('0x34')]=_['intersection'](_0x516194[_0xcb66('0x33')],qs[_0xcb66('0x35')](_0x967710[_0xcb66('0x2f')][_0xcb66('0x35')]));_0x178a06[_0xcb66('0x34')]=_0x178a06[_0xcb66('0x34')][_0xcb66('0x36')]?_0x178a06['attributes']:_0x516194[_0xcb66('0x33')];if(!_0x967710[_0xcb66('0x2f')][_0xcb66('0x37')](_0xcb66('0x38'))){_0x178a06['limit']=qs[_0xcb66('0x1f')](_0x967710[_0xcb66('0x2f')][_0xcb66('0x1f')]);_0x178a06[_0xcb66('0x1d')]=qs[_0xcb66('0x1d')](_0x967710[_0xcb66('0x2f')][_0xcb66('0x1d')]);}_0x178a06[_0xcb66('0x39')]=qs[_0xcb66('0x3a')](_0x967710[_0xcb66('0x2f')][_0xcb66('0x3a')]);_0x178a06[_0xcb66('0x3b')]=qs['filters'](_['pick'](_0x967710['query'],_0x516194[_0xcb66('0x31')]),_0x5b7cf2);if(_0x967710[_0xcb66('0x2f')][_0xcb66('0x3c')]){_0x178a06[_0xcb66('0x3b')]=_[_0xcb66('0x3d')](_0x178a06[_0xcb66('0x3b')],{'$or':_['map'](_0x5b7cf2,function(_0x13865f){if(_0x13865f['type']!=='VIRTUAL'){var _0x5af5d4={};_0x5af5d4[_0x13865f[_0xcb66('0x27')]]={'$like':'%'+_0x967710[_0xcb66('0x2f')][_0xcb66('0x3c')]+'%'};return _0x5af5d4;}})});}_0x178a06=_[_0xcb66('0x3d')]({},_0x178a06,_0x967710[_0xcb66('0x3e')]);var _0x3e71a7={'where':_0x178a06[_0xcb66('0x3b')]};return db[_0xcb66('0x3f')][_0xcb66('0x20')](_0x3e71a7)['then'](function(_0xe45331){_0x2152dc[_0xcb66('0x20')]=_0xe45331;if(_0x967710[_0xcb66('0x2f')]['includeAll']){_0x178a06[_0xcb66('0x40')]=[{'all':!![]}];}return db[_0xcb66('0x3f')]['findAll'](_0x178a06);})['then'](function(_0x277838){_0x2152dc['rows']=_0x277838;return _0x2152dc;})['then'](respondWithFilteredResult(_0x28fc0b,_0x178a06))[_0xcb66('0x41')](handleError(_0x28fc0b,null));};exports[_0xcb66('0x42')]=function(_0x3a260b,_0x165bcc){var _0x99229={'raw':!![],'where':{'id':_0x3a260b[_0xcb66('0x43')]['id']}},_0x235862={};_0x235862[_0xcb66('0x33')]=_[_0xcb66('0x30')](db['Cdr']['rawAttributes']);_0x235862['query']=_[_0xcb66('0x30')](_0x3a260b['query']);_0x235862[_0xcb66('0x31')]=_['intersection'](_0x235862[_0xcb66('0x33')],_0x235862[_0xcb66('0x2f')]);_0x99229[_0xcb66('0x34')]=_[_0xcb66('0x32')](_0x235862[_0xcb66('0x33')],qs[_0xcb66('0x35')](_0x3a260b['query']['fields']));_0x99229[_0xcb66('0x34')]=_0x99229[_0xcb66('0x34')][_0xcb66('0x36')]?_0x99229[_0xcb66('0x34')]:_0x235862[_0xcb66('0x33')];if(_0x3a260b[_0xcb66('0x2f')][_0xcb66('0x44')]){_0x99229[_0xcb66('0x40')]=[{'all':!![]}];}_0x99229=_[_0xcb66('0x3d')]({},_0x99229,_0x3a260b['options']);return db[_0xcb66('0x3f')][_0xcb66('0x45')](_0x99229)[_0xcb66('0x24')](handleEntityNotFound(_0x165bcc,null))[_0xcb66('0x24')](respondWithResult(_0x165bcc,null))['catch'](handleError(_0x165bcc,null));};exports[_0xcb66('0x46')]=function(_0x2f9fb5,_0x1aab4e){return db['Cdr'][_0xcb66('0x46')](_0x2f9fb5[_0xcb66('0x47')],{})[_0xcb66('0x24')](respondWithResult(_0x1aab4e,0xc9))[_0xcb66('0x41')](handleError(_0x1aab4e,null));};exports['update']=function(_0x43e0e0,_0xb0854f){if(_0x43e0e0[_0xcb66('0x47')]['id']){delete _0x43e0e0['body']['id'];}return db['Cdr'][_0xcb66('0x45')]({'where':{'id':_0x43e0e0['params']['id']}})[_0xcb66('0x24')](handleEntityNotFound(_0xb0854f,null))['then'](saveUpdates(_0x43e0e0[_0xcb66('0x47')],null))[_0xcb66('0x24')](respondWithResult(_0xb0854f,null))[_0xcb66('0x41')](handleError(_0xb0854f,null));};exports['destroy']=function(_0x2071d5,_0x5f01a2){return db[_0xcb66('0x3f')][_0xcb66('0x45')]({'where':{'id':_0x2071d5[_0xcb66('0x43')]['id']}})[_0xcb66('0x24')](handleEntityNotFound(_0x5f01a2,null))[_0xcb66('0x24')](removeEntity(_0x5f01a2,null))['catch'](handleError(_0x5f01a2,null));};exports[_0xcb66('0x48')]=function(_0x5b04ad,_0xd68e76){return db[_0xcb66('0x3f')][_0xcb66('0x48')]()['then'](respondWithResult(_0xd68e76,null))['catch'](handleError(_0xd68e76,null));}; \ No newline at end of file +var _0xc3b5=['destroy','error','stack','name','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','then'];(function(_0x14ad88,_0x12e51d){var _0x1aff58=function(_0x3af632){while(--_0x3af632){_0x14ad88['push'](_0x14ad88['shift']());}};_0x1aff58(++_0x12e51d);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x572729,_0x4ac0a7){_0x572729=_0x572729-0x0;var _0x3340a9=_0xc3b5[_0x572729];return _0x3340a9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5c3b('0x0'));var jsonpatch=require(_0x5c3b('0x1'));var rp=require(_0x5c3b('0x2'));var moment=require(_0x5c3b('0x3'));var BPromise=require(_0x5c3b('0x4'));var Mustache=require(_0x5c3b('0x5'));var util=require(_0x5c3b('0x6'));var path=require(_0x5c3b('0x7'));var sox=require('sox');var csv=require(_0x5c3b('0x8'));var ejs=require(_0x5c3b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c3b('0xa'));var squel=require(_0x5c3b('0xb'));var crypto=require(_0x5c3b('0xc'));var jsforce=require(_0x5c3b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5c3b('0x8'));var querystring=require(_0x5c3b('0xe'));var Papa=require(_0x5c3b('0xf'));var Redis=require(_0x5c3b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5c3b('0x11'));var as=require(_0x5c3b('0x12'));var hardwareService=require(_0x5c3b('0x13'));var logger=require(_0x5c3b('0x14'))(_0x5c3b('0x15'));var utils=require('../../config/utils');var config=require(_0x5c3b('0x16'));var licenseUtil=require(_0x5c3b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b2815,_0x3b953d){_0x3b953d=_0x3b953d||0xcc;return function(_0x507c2e){if(_0x507c2e){return _0x1b2815[_0x5c3b('0x18')](_0x3b953d);}return _0x1b2815[_0x5c3b('0x19')](_0x3b953d)[_0x5c3b('0x1a')]();};}function respondWithResult(_0x2384b9,_0x315e68){_0x315e68=_0x315e68||0xc8;return function(_0x3fef28){if(_0x3fef28){return _0x2384b9[_0x5c3b('0x19')](_0x315e68)['json'](_0x3fef28);}};}function respondWithFilteredResult(_0x2f7ab2,_0x5b55be){return function(_0x4cf80d){if(_0x4cf80d){var _0x195c1e=typeof _0x5b55be[_0x5c3b('0x1b')]===_0x5c3b('0x1c')&&typeof _0x5b55be['limit']===_0x5c3b('0x1c');var _0x229e28=_0x4cf80d[_0x5c3b('0x1d')];var _0x59f71b=_0x195c1e?0x0:_0x5b55be[_0x5c3b('0x1b')];var _0x34144d=_0x195c1e?_0x4cf80d['count']:_0x5b55be[_0x5c3b('0x1b')]+_0x5b55be[_0x5c3b('0x1e')];var _0x2b2307;if(_0x34144d>=_0x229e28){_0x34144d=_0x229e28;_0x2b2307=0xc8;}else{_0x2b2307=0xce;}_0x2f7ab2[_0x5c3b('0x19')](_0x2b2307);return _0x2f7ab2[_0x5c3b('0x1f')](_0x5c3b('0x20'),_0x59f71b+'-'+_0x34144d+'/'+_0x229e28)[_0x5c3b('0x21')](_0x4cf80d);}return null;};}function patchUpdates(_0x1af39c){return function(_0xc63307){try{jsonpatch[_0x5c3b('0x22')](_0xc63307,_0x1af39c,!![]);}catch(_0x4ec8c1){return BPromise['reject'](_0x4ec8c1);}return _0xc63307[_0x5c3b('0x23')]();};}function saveUpdates(_0x143022,_0x5942f1){return function(_0x439d8e){if(_0x439d8e){return _0x439d8e['update'](_0x143022)[_0x5c3b('0x24')](function(_0xb8006){return _0xb8006;});}return null;};}function removeEntity(_0x2bb9dc,_0xe9261d){return function(_0x529c39){if(_0x529c39){return _0x529c39[_0x5c3b('0x25')]()[_0x5c3b('0x24')](function(){_0x2bb9dc['status'](0xcc)[_0x5c3b('0x1a')]();});}};}function handleEntityNotFound(_0x2c8682,_0x3a8141){return function(_0x3c3991){if(!_0x3c3991){_0x2c8682['sendStatus'](0x194);}return _0x3c3991;};}function handleError(_0x15ae38,_0x20469d){_0x20469d=_0x20469d||0x1f4;return function(_0x2099dc){logger[_0x5c3b('0x26')](_0x2099dc[_0x5c3b('0x27')]);if(_0x2099dc[_0x5c3b('0x28')]){delete _0x2099dc['name'];}_0x15ae38['status'](_0x20469d)['send'](_0x2099dc);};}exports[_0x5c3b('0x29')]=function(_0x3e6832,_0x59b640){var _0xd93418={},_0x15044e={},_0x421d96={'count':0x0,'rows':[]};var _0x2a26df=_[_0x5c3b('0x2a')](db[_0x5c3b('0x2b')][_0x5c3b('0x2c')],function(_0x292266){return{'name':_0x292266[_0x5c3b('0x2d')],'type':_0x292266[_0x5c3b('0x2e')][_0x5c3b('0x2f')]};});_0x15044e[_0x5c3b('0x30')]=_['map'](_0x2a26df,_0x5c3b('0x28'));_0x15044e[_0x5c3b('0x31')]=_[_0x5c3b('0x32')](_0x3e6832[_0x5c3b('0x31')]);_0x15044e[_0x5c3b('0x33')]=_[_0x5c3b('0x34')](_0x15044e[_0x5c3b('0x30')],_0x15044e[_0x5c3b('0x31')]);_0xd93418[_0x5c3b('0x35')]=_[_0x5c3b('0x34')](_0x15044e[_0x5c3b('0x30')],qs[_0x5c3b('0x36')](_0x3e6832[_0x5c3b('0x31')][_0x5c3b('0x36')]));_0xd93418[_0x5c3b('0x35')]=_0xd93418[_0x5c3b('0x35')][_0x5c3b('0x37')]?_0xd93418['attributes']:_0x15044e[_0x5c3b('0x30')];if(!_0x3e6832[_0x5c3b('0x31')][_0x5c3b('0x38')](_0x5c3b('0x39'))){_0xd93418['limit']=qs[_0x5c3b('0x1e')](_0x3e6832[_0x5c3b('0x31')]['limit']);_0xd93418[_0x5c3b('0x1b')]=qs[_0x5c3b('0x1b')](_0x3e6832[_0x5c3b('0x31')][_0x5c3b('0x1b')]);}_0xd93418[_0x5c3b('0x3a')]=qs[_0x5c3b('0x3b')](_0x3e6832[_0x5c3b('0x31')][_0x5c3b('0x3b')]);_0xd93418[_0x5c3b('0x3c')]=qs['filters'](_[_0x5c3b('0x3d')](_0x3e6832[_0x5c3b('0x31')],_0x15044e['filters']),_0x2a26df);if(_0x3e6832['query'][_0x5c3b('0x3e')]){_0xd93418[_0x5c3b('0x3c')]=_[_0x5c3b('0x3f')](_0xd93418[_0x5c3b('0x3c')],{'$or':_[_0x5c3b('0x2a')](_0x2a26df,function(_0x406bf9){if(_0x406bf9[_0x5c3b('0x2e')]!=='VIRTUAL'){var _0x499335={};_0x499335[_0x406bf9[_0x5c3b('0x28')]]={'$like':'%'+_0x3e6832[_0x5c3b('0x31')][_0x5c3b('0x3e')]+'%'};return _0x499335;}})});}_0xd93418=_[_0x5c3b('0x3f')]({},_0xd93418,_0x3e6832['options']);var _0x16400b={'where':_0xd93418['where']};return db[_0x5c3b('0x2b')][_0x5c3b('0x1d')](_0x16400b)[_0x5c3b('0x24')](function(_0xea3ae1){_0x421d96[_0x5c3b('0x1d')]=_0xea3ae1;if(_0x3e6832[_0x5c3b('0x31')][_0x5c3b('0x40')]){_0xd93418[_0x5c3b('0x41')]=[{'all':!![]}];}return db[_0x5c3b('0x2b')]['findAll'](_0xd93418);})['then'](function(_0x345149){_0x421d96[_0x5c3b('0x42')]=_0x345149;return _0x421d96;})[_0x5c3b('0x24')](respondWithFilteredResult(_0x59b640,_0xd93418))[_0x5c3b('0x43')](handleError(_0x59b640,null));};exports[_0x5c3b('0x44')]=function(_0x22fd28,_0x2cec5d){var _0x1d9427={'raw':!![],'where':{'id':_0x22fd28['params']['id']}},_0x29ffdc={};_0x29ffdc[_0x5c3b('0x30')]=_[_0x5c3b('0x32')](db[_0x5c3b('0x2b')]['rawAttributes']);_0x29ffdc[_0x5c3b('0x31')]=_[_0x5c3b('0x32')](_0x22fd28[_0x5c3b('0x31')]);_0x29ffdc[_0x5c3b('0x33')]=_[_0x5c3b('0x34')](_0x29ffdc[_0x5c3b('0x30')],_0x29ffdc[_0x5c3b('0x31')]);_0x1d9427[_0x5c3b('0x35')]=_[_0x5c3b('0x34')](_0x29ffdc[_0x5c3b('0x30')],qs[_0x5c3b('0x36')](_0x22fd28['query'][_0x5c3b('0x36')]));_0x1d9427['attributes']=_0x1d9427[_0x5c3b('0x35')][_0x5c3b('0x37')]?_0x1d9427['attributes']:_0x29ffdc[_0x5c3b('0x30')];if(_0x22fd28[_0x5c3b('0x31')][_0x5c3b('0x40')]){_0x1d9427['include']=[{'all':!![]}];}_0x1d9427=_[_0x5c3b('0x3f')]({},_0x1d9427,_0x22fd28['options']);return db[_0x5c3b('0x2b')][_0x5c3b('0x45')](_0x1d9427)[_0x5c3b('0x24')](handleEntityNotFound(_0x2cec5d,null))[_0x5c3b('0x24')](respondWithResult(_0x2cec5d,null))[_0x5c3b('0x43')](handleError(_0x2cec5d,null));};exports[_0x5c3b('0x46')]=function(_0x2dd72c,_0x3d6034){return db[_0x5c3b('0x2b')][_0x5c3b('0x46')](_0x2dd72c[_0x5c3b('0x47')],{})['then'](respondWithResult(_0x3d6034,0xc9))[_0x5c3b('0x43')](handleError(_0x3d6034,null));};exports['update']=function(_0x155b22,_0x11bf0a){if(_0x155b22[_0x5c3b('0x47')]['id']){delete _0x155b22['body']['id'];}return db[_0x5c3b('0x2b')][_0x5c3b('0x45')]({'where':{'id':_0x155b22['params']['id']}})[_0x5c3b('0x24')](handleEntityNotFound(_0x11bf0a,null))[_0x5c3b('0x24')](saveUpdates(_0x155b22[_0x5c3b('0x47')],null))[_0x5c3b('0x24')](respondWithResult(_0x11bf0a,null))[_0x5c3b('0x43')](handleError(_0x11bf0a,null));};exports[_0x5c3b('0x25')]=function(_0x37870f,_0x21e430){return db[_0x5c3b('0x2b')][_0x5c3b('0x45')]({'where':{'id':_0x37870f[_0x5c3b('0x48')]['id']}})['then'](handleEntityNotFound(_0x21e430,null))['then'](removeEntity(_0x21e430,null))['catch'](handleError(_0x21e430,null));};exports[_0x5c3b('0x49')]=function(_0x203ae2,_0x5f14fa){return db[_0x5c3b('0x2b')][_0x5c3b('0x49')]()[_0x5c3b('0x24')](respondWithResult(_0x5f14fa,null))[_0x5c3b('0x43')](handleError(_0x5f14fa,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 0f6fd99..a0364bd 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(_0x389ba4,_0x4aad50){var _0x565839=function(_0x12f127){while(--_0x12f127){_0x389ba4['push'](_0x389ba4['shift']());}};_0x565839(++_0x4aad50);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x1182c4,_0x15749d){var _0x4950e7=function(_0x16521d){while(--_0x16521d){_0x1182c4['push'](_0x1182c4['shift']());}};_0x4950e7(++_0x15749d);}(_0x7a54,0x106));var _0x47a5=function(_0xe51edf,_0x538cb0){_0xe51edf=_0xe51edf-0x0;var _0x5149c7=_0x7a54[_0xe51edf];return _0x5149c7;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index cec1b50..ce36f1a 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 _0xecb6=['Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','Cdr,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug'];(function(_0xf8886b,_0x504891){var _0x321bd5=function(_0x3c116b){while(--_0x3c116b){_0xf8886b['push'](_0xf8886b['shift']());}};_0x321bd5(++_0x504891);}(_0xecb6,0xcf));var _0x6ecb=function(_0x578ce2,_0x250370){_0x578ce2=_0x578ce2-0x0;var _0x49546f=_0xecb6[_0x578ce2];return _0x49546f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6ecb('0x0'));var BPromise=require(_0x6ecb('0x1'));var rs=require(_0x6ecb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ecb('0x3'))['db'];var utils=require(_0x6ecb('0x4'));var logger=require(_0x6ecb('0x5'))(_0x6ecb('0x6'));var config=require(_0x6ecb('0x7'));var jayson=require(_0x6ecb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ccb91,_0x55af16,_0x1a4172){return new BPromise(function(_0x220cf4,_0x2a66a4){return client[_0x6ecb('0x9')](_0x5ccb91,_0x1a4172)['then'](function(_0x419179){logger[_0x6ecb('0xa')]('Cdr,\x20%s,\x20%s',_0x55af16,_0x6ecb('0xb'));logger[_0x6ecb('0xc')](_0x6ecb('0xd'),_0x55af16,_0x6ecb('0xb'),JSON[_0x6ecb('0xe')](_0x419179));if(_0x419179['error']){if(_0x419179[_0x6ecb('0xf')][_0x6ecb('0x10')]===0x1f4){logger['error'](_0x6ecb('0x11'),_0x55af16,_0x419179[_0x6ecb('0xf')][_0x6ecb('0x12')]);return _0x2a66a4(_0x419179['error'][_0x6ecb('0x12')]);}logger[_0x6ecb('0xf')](_0x6ecb('0x11'),_0x55af16,_0x419179[_0x6ecb('0xf')][_0x6ecb('0x12')]);return _0x220cf4(_0x419179['error'][_0x6ecb('0x12')]);}else{logger[_0x6ecb('0xa')](_0x6ecb('0x11'),_0x55af16,'request\x20sent');_0x220cf4(_0x419179['result'][_0x6ecb('0x12')]);}})[_0x6ecb('0x13')](function(_0xf21eb5){logger[_0x6ecb('0xf')]('Cdr,\x20%s,\x20%s',_0x55af16,_0xf21eb5);_0x2a66a4(_0xf21eb5);});});} \ No newline at end of file +var _0xa903=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x26282e,_0x1e0224){var _0x337112=function(_0x3a7a8b){while(--_0x3a7a8b){_0x26282e['push'](_0x26282e['shift']());}};_0x337112(++_0x1e0224);}(_0xa903,0xc2));var _0x3a90=function(_0x1a0028,_0x489eac){_0x1a0028=_0x1a0028-0x0;var _0x177eaf=_0xa903[_0x1a0028];return _0x177eaf;};'use strict';var _=require(_0x3a90('0x0'));var util=require(_0x3a90('0x1'));var moment=require(_0x3a90('0x2'));var BPromise=require(_0x3a90('0x3'));var rs=require(_0x3a90('0x4'));var fs=require('fs');var Redis=require(_0x3a90('0x5'));var db=require(_0x3a90('0x6'))['db'];var utils=require(_0x3a90('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x3a90('0x8'));var jayson=require(_0x3a90('0x9'));var client=jayson[_0x3a90('0xa')][_0x3a90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x246b80,_0x559bd6,_0x330149){return new BPromise(function(_0x3cf1d6,_0x19f5de){return client[_0x3a90('0xc')](_0x246b80,_0x330149)[_0x3a90('0xd')](function(_0x2fb686){logger[_0x3a90('0xe')](_0x3a90('0xf'),_0x559bd6,_0x3a90('0x10'));logger[_0x3a90('0x11')](_0x3a90('0x12'),_0x559bd6,_0x3a90('0x10'),JSON[_0x3a90('0x13')](_0x2fb686));if(_0x2fb686[_0x3a90('0x14')]){if(_0x2fb686[_0x3a90('0x14')][_0x3a90('0x15')]===0x1f4){logger[_0x3a90('0x14')](_0x3a90('0xf'),_0x559bd6,_0x2fb686[_0x3a90('0x14')]['message']);return _0x19f5de(_0x2fb686[_0x3a90('0x14')][_0x3a90('0x16')]);}logger[_0x3a90('0x14')](_0x3a90('0xf'),_0x559bd6,_0x2fb686[_0x3a90('0x14')][_0x3a90('0x16')]);return _0x3cf1d6(_0x2fb686[_0x3a90('0x14')][_0x3a90('0x16')]);}else{logger[_0x3a90('0xe')](_0x3a90('0xf'),_0x559bd6,_0x3a90('0x10'));_0x3cf1d6(_0x2fb686[_0x3a90('0x17')][_0x3a90('0x16')]);}})['catch'](function(_0x442c0d){logger[_0x3a90('0x14')](_0x3a90('0xf'),_0x559bd6,_0x442c0d);_0x19f5de(_0x442c0d);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index e8c34f1..85b3196 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x513545,_0x158f2e){var _0x18b7c5=function(_0x58514c){while(--_0x58514c){_0x513545['push'](_0x513545['shift']());}};_0x18b7c5(++_0x158f2e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0xe15270,_0x227d06){var _0x1e813b=function(_0x1d590d){while(--_0x1d590d){_0xe15270['push'](_0xe15270['shift']());}};_0x1e813b(++_0x227d06);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 2a24ce2..51975af 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 _0x8f5a=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8f5a,0x6f));var _0xa8f5=function(_0x22645d,_0x47dd1b){_0x22645d=_0x22645d-0x0;var _0x810e1e=_0x8f5a[_0x22645d];return _0x810e1e;};'use strict';var Sequelize=require(_0xa8f5('0x0'));module['exports']={'priority':{'type':Sequelize[_0xa8f5('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa8f5('0x2')],'allowNull':![],'defaultValue':_0xa8f5('0x3')},'appdata':{'type':Sequelize[_0xa8f5('0x4')]()},'description':{'type':Sequelize[_0xa8f5('0x2')]},'interval':{'type':Sequelize[_0xa8f5('0x2')],'defaultValue':_0xa8f5('0x5')}}; \ No newline at end of file +var _0x6e0d=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x4c0750,_0x34cfc9){var _0x27cbcc=function(_0x52edad){while(--_0x52edad){_0x4c0750['push'](_0x4c0750['shift']());}};_0x27cbcc(++_0x34cfc9);}(_0x6e0d,0x73));var _0xd6e0=function(_0x42340a,_0x2a09f9){_0x42340a=_0x42340a-0x0;var _0x102286=_0x6e0d[_0x42340a];return _0x102286;};'use strict';var Sequelize=require(_0xd6e0('0x0'));module[_0xd6e0('0x1')]={'priority':{'type':Sequelize[_0xd6e0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd6e0('0x3')],'allowNull':![],'defaultValue':_0xd6e0('0x4')},'appdata':{'type':Sequelize[_0xd6e0('0x5')]()},'description':{'type':Sequelize[_0xd6e0('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd6e0('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 7a1315d..411ad06 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 _0xbefe=['sendStatus','error','model','ChatApplication','query','keys','filters','attributes','intersection','fields','length','includeAll','include','options','find','catch','body','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','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','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy'];(function(_0x38db77,_0x18239f){var _0x916e60=function(_0x1bdf37){while(--_0x1bdf37){_0x38db77['push'](_0x38db77['shift']());}};_0x916e60(++_0x18239f);}(_0xbefe,0x168));var _0xebef=function(_0x75ad68,_0xc75b2a){_0x75ad68=_0x75ad68-0x0;var _0x469c7d=_0xbefe[_0x75ad68];return _0x469c7d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xebef('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xebef('0x1'));var rp=require(_0xebef('0x2'));var moment=require(_0xebef('0x3'));var BPromise=require(_0xebef('0x4'));var Mustache=require(_0xebef('0x5'));var util=require(_0xebef('0x6'));var path=require(_0xebef('0x7'));var sox=require(_0xebef('0x8'));var csv=require('to-csv');var ejs=require(_0xebef('0x9'));var fs=require('fs');var fs_extra=require(_0xebef('0xa'));var _=require(_0xebef('0xb'));var squel=require('squel');var crypto=require(_0xebef('0xc'));var jsforce=require(_0xebef('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xebef('0xe'));var Papa=require(_0xebef('0xf'));var Redis=require(_0xebef('0x10'));var authService=require(_0xebef('0x11'));var qs=require(_0xebef('0x12'));var as=require(_0xebef('0x13'));var hardwareService=require(_0xebef('0x14'));var logger=require(_0xebef('0x15'))('api');var utils=require(_0xebef('0x16'));var config=require(_0xebef('0x17'));var licenseUtil=require(_0xebef('0x18'));var db=require(_0xebef('0x19'))['db'];function respondWithStatusCode(_0x1dcae4,_0x566dbe){_0x566dbe=_0x566dbe||0xcc;return function(_0x584ac2){if(_0x584ac2){return _0x1dcae4['sendStatus'](_0x566dbe);}return _0x1dcae4['status'](_0x566dbe)[_0xebef('0x1a')]();};}function respondWithResult(_0x124634,_0x31772a){_0x31772a=_0x31772a||0xc8;return function(_0x35cd7a){if(_0x35cd7a){return _0x124634[_0xebef('0x1b')](_0x31772a)[_0xebef('0x1c')](_0x35cd7a);}};}function respondWithFilteredResult(_0x5813eb,_0x32ec37){return function(_0x9411d4){if(_0x9411d4){var _0x1921aa=typeof _0x32ec37[_0xebef('0x1d')]===_0xebef('0x1e')&&typeof _0x32ec37[_0xebef('0x1f')]===_0xebef('0x1e');var _0x1e4ddf=_0x9411d4[_0xebef('0x20')];var _0x16856f=_0x1921aa?0x0:_0x32ec37[_0xebef('0x1d')];var _0x5161f1=_0x1921aa?_0x9411d4[_0xebef('0x20')]:_0x32ec37[_0xebef('0x1d')]+_0x32ec37[_0xebef('0x1f')];var _0x502c1e;if(_0x5161f1>=_0x1e4ddf){_0x5161f1=_0x1e4ddf;_0x502c1e=0xc8;}else{_0x502c1e=0xce;}_0x5813eb[_0xebef('0x1b')](_0x502c1e);return _0x5813eb[_0xebef('0x21')](_0xebef('0x22'),_0x16856f+'-'+_0x5161f1+'/'+_0x1e4ddf)[_0xebef('0x1c')](_0x9411d4);}return null;};}function patchUpdates(_0x7ca0cc){return function(_0x138760){try{jsonpatch[_0xebef('0x23')](_0x138760,_0x7ca0cc,!![]);}catch(_0x4cc18e){return BPromise['reject'](_0x4cc18e);}return _0x138760['save']();};}function saveUpdates(_0x59e078,_0x2f1193){return function(_0x38f0b8){if(_0x38f0b8){return _0x38f0b8[_0xebef('0x24')](_0x59e078)[_0xebef('0x25')](function(_0x1ee3b){return _0x1ee3b;});}return null;};}function removeEntity(_0xe8dcbf,_0x5c5091){return function(_0x460104){if(_0x460104){return _0x460104[_0xebef('0x26')]()[_0xebef('0x25')](function(){_0xe8dcbf[_0xebef('0x1b')](0xcc)[_0xebef('0x1a')]();});}};}function handleEntityNotFound(_0x27f212,_0x36ca6b){return function(_0x42d2af){if(!_0x42d2af){_0x27f212[_0xebef('0x27')](0x194);}return _0x42d2af;};}function handleError(_0x2d63a8,_0x456a81){_0x456a81=_0x456a81||0x1f4;return function(_0x4fb77f){logger[_0xebef('0x28')](_0x4fb77f['stack']);if(_0x4fb77f['name']){delete _0x4fb77f['name'];}_0x2d63a8['status'](_0x456a81)['send'](_0x4fb77f);};}exports['show']=function(_0x55732a,_0x5703fc){var _0x506e64={'raw':!![],'where':{'id':_0x55732a['params']['id']}},_0x5a9249={};_0x5a9249[_0xebef('0x29')]=_['keys'](db[_0xebef('0x2a')]['rawAttributes']);_0x5a9249[_0xebef('0x2b')]=_[_0xebef('0x2c')](_0x55732a['query']);_0x5a9249[_0xebef('0x2d')]=_['intersection'](_0x5a9249[_0xebef('0x29')],_0x5a9249[_0xebef('0x2b')]);_0x506e64[_0xebef('0x2e')]=_[_0xebef('0x2f')](_0x5a9249[_0xebef('0x29')],qs[_0xebef('0x30')](_0x55732a['query'][_0xebef('0x30')]));_0x506e64['attributes']=_0x506e64[_0xebef('0x2e')][_0xebef('0x31')]?_0x506e64[_0xebef('0x2e')]:_0x5a9249[_0xebef('0x29')];if(_0x55732a[_0xebef('0x2b')][_0xebef('0x32')]){_0x506e64[_0xebef('0x33')]=[{'all':!![]}];}_0x506e64=_['merge']({},_0x506e64,_0x55732a[_0xebef('0x34')]);return db[_0xebef('0x2a')][_0xebef('0x35')](_0x506e64)[_0xebef('0x25')](handleEntityNotFound(_0x5703fc,null))[_0xebef('0x25')](respondWithResult(_0x5703fc,null))[_0xebef('0x36')](handleError(_0x5703fc,null));};exports[_0xebef('0x24')]=function(_0x48aa2f,_0x53ad2b){if(_0x48aa2f[_0xebef('0x37')]['id']){delete _0x48aa2f['body']['id'];}return db[_0xebef('0x2a')][_0xebef('0x35')]({'where':{'id':_0x48aa2f[_0xebef('0x38')]['id']}})[_0xebef('0x25')](handleEntityNotFound(_0x53ad2b,null))[_0xebef('0x25')](saveUpdates(_0x48aa2f['body'],null))[_0xebef('0x25')](respondWithResult(_0x53ad2b,null))[_0xebef('0x36')](handleError(_0x53ad2b,null));};exports['destroy']=function(_0x5a4750,_0x890f2f){return db['ChatApplication']['find']({'where':{'id':_0x5a4750['params']['id']}})[_0xebef('0x25')](handleEntityNotFound(_0x890f2f,null))['then'](removeEntity(_0x890f2f,null))['catch'](handleError(_0x890f2f,null));}; \ No newline at end of file +var _0xd403=['options','ChatApplication','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','sendStatus','error','name','show','params','model','keys','query','filters','attributes','intersection','fields','length'];(function(_0x4dffcd,_0x19b96c){var _0x411783=function(_0x47ca50){while(--_0x47ca50){_0x4dffcd['push'](_0x4dffcd['shift']());}};_0x411783(++_0x19b96c);}(_0xd403,0x1d5));var _0x3d40=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xd403[_0x4b7895];return _0x264180;};'use strict';var emlformat=require(_0x3d40('0x0'));var rimraf=require(_0x3d40('0x1'));var zipdir=require(_0x3d40('0x2'));var jsonpatch=require(_0x3d40('0x3'));var rp=require('request-promise');var moment=require(_0x3d40('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3d40('0x5'));var util=require(_0x3d40('0x6'));var path=require(_0x3d40('0x7'));var sox=require(_0x3d40('0x8'));var csv=require(_0x3d40('0x9'));var ejs=require(_0x3d40('0xa'));var fs=require('fs');var fs_extra=require(_0x3d40('0xb'));var _=require(_0x3d40('0xc'));var squel=require(_0x3d40('0xd'));var crypto=require(_0x3d40('0xe'));var jsforce=require(_0x3d40('0xf'));var deskjs=require(_0x3d40('0x10'));var toCsv=require(_0x3d40('0x9'));var querystring=require(_0x3d40('0x11'));var Papa=require(_0x3d40('0x12'));var Redis=require(_0x3d40('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3d40('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3d40('0x15'));var logger=require(_0x3d40('0x16'))(_0x3d40('0x17'));var utils=require('../../config/utils');var config=require(_0x3d40('0x18'));var licenseUtil=require(_0x3d40('0x19'));var db=require(_0x3d40('0x1a'))['db'];function respondWithStatusCode(_0x49ea7c,_0x31c199){_0x31c199=_0x31c199||0xcc;return function(_0x405625){if(_0x405625){return _0x49ea7c['sendStatus'](_0x31c199);}return _0x49ea7c['status'](_0x31c199)[_0x3d40('0x1b')]();};}function respondWithResult(_0x24d2c0,_0x3e6d19){_0x3e6d19=_0x3e6d19||0xc8;return function(_0x5062ec){if(_0x5062ec){return _0x24d2c0[_0x3d40('0x1c')](_0x3e6d19)[_0x3d40('0x1d')](_0x5062ec);}};}function respondWithFilteredResult(_0x311d57,_0x3e6e71){return function(_0x2b5e2d){if(_0x2b5e2d){var _0x359e9d=typeof _0x3e6e71[_0x3d40('0x1e')]==='undefined'&&typeof _0x3e6e71['limit']===_0x3d40('0x1f');var _0x2f38e1=_0x2b5e2d[_0x3d40('0x20')];var _0x75437e=_0x359e9d?0x0:_0x3e6e71[_0x3d40('0x1e')];var _0x2f3663=_0x359e9d?_0x2b5e2d[_0x3d40('0x20')]:_0x3e6e71[_0x3d40('0x1e')]+_0x3e6e71[_0x3d40('0x21')];var _0x402b4e;if(_0x2f3663>=_0x2f38e1){_0x2f3663=_0x2f38e1;_0x402b4e=0xc8;}else{_0x402b4e=0xce;}_0x311d57[_0x3d40('0x1c')](_0x402b4e);return _0x311d57['set']('Content-Range',_0x75437e+'-'+_0x2f3663+'/'+_0x2f38e1)[_0x3d40('0x1d')](_0x2b5e2d);}return null;};}function patchUpdates(_0x41608f){return function(_0x2fc0e2){try{jsonpatch[_0x3d40('0x22')](_0x2fc0e2,_0x41608f,!![]);}catch(_0x28b1c0){return BPromise[_0x3d40('0x23')](_0x28b1c0);}return _0x2fc0e2[_0x3d40('0x24')]();};}function saveUpdates(_0xbd7298,_0x3df1f9){return function(_0x321bc2){if(_0x321bc2){return _0x321bc2[_0x3d40('0x25')](_0xbd7298)[_0x3d40('0x26')](function(_0x181688){return _0x181688;});}return null;};}function removeEntity(_0x5314c5,_0x1a2d0f){return function(_0x14cad3){if(_0x14cad3){return _0x14cad3[_0x3d40('0x27')]()[_0x3d40('0x26')](function(){_0x5314c5[_0x3d40('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45aa46,_0x28c438){return function(_0x3cc4df){if(!_0x3cc4df){_0x45aa46[_0x3d40('0x28')](0x194);}return _0x3cc4df;};}function handleError(_0x15b25f,_0x504c72){_0x504c72=_0x504c72||0x1f4;return function(_0x26844b){logger[_0x3d40('0x29')](_0x26844b['stack']);if(_0x26844b[_0x3d40('0x2a')]){delete _0x26844b[_0x3d40('0x2a')];}_0x15b25f[_0x3d40('0x1c')](_0x504c72)['send'](_0x26844b);};}exports[_0x3d40('0x2b')]=function(_0x265c2c,_0x336f0d){var _0x23b7d2={'raw':!![],'where':{'id':_0x265c2c[_0x3d40('0x2c')]['id']}},_0x30d626={};_0x30d626[_0x3d40('0x2d')]=_[_0x3d40('0x2e')](db['ChatApplication']['rawAttributes']);_0x30d626[_0x3d40('0x2f')]=_[_0x3d40('0x2e')](_0x265c2c['query']);_0x30d626[_0x3d40('0x30')]=_['intersection'](_0x30d626[_0x3d40('0x2d')],_0x30d626['query']);_0x23b7d2[_0x3d40('0x31')]=_[_0x3d40('0x32')](_0x30d626[_0x3d40('0x2d')],qs[_0x3d40('0x33')](_0x265c2c[_0x3d40('0x2f')]['fields']));_0x23b7d2['attributes']=_0x23b7d2[_0x3d40('0x31')][_0x3d40('0x34')]?_0x23b7d2[_0x3d40('0x31')]:_0x30d626['model'];if(_0x265c2c[_0x3d40('0x2f')]['includeAll']){_0x23b7d2['include']=[{'all':!![]}];}_0x23b7d2=_['merge']({},_0x23b7d2,_0x265c2c[_0x3d40('0x35')]);return db[_0x3d40('0x36')][_0x3d40('0x37')](_0x23b7d2)[_0x3d40('0x26')](handleEntityNotFound(_0x336f0d,null))[_0x3d40('0x26')](respondWithResult(_0x336f0d,null))[_0x3d40('0x38')](handleError(_0x336f0d,null));};exports[_0x3d40('0x25')]=function(_0x3ad5cc,_0x13ab5a){if(_0x3ad5cc['body']['id']){delete _0x3ad5cc['body']['id'];}return db[_0x3d40('0x36')][_0x3d40('0x37')]({'where':{'id':_0x3ad5cc[_0x3d40('0x2c')]['id']}})[_0x3d40('0x26')](handleEntityNotFound(_0x13ab5a,null))[_0x3d40('0x26')](saveUpdates(_0x3ad5cc[_0x3d40('0x39')],null))['then'](respondWithResult(_0x13ab5a,null))[_0x3d40('0x38')](handleError(_0x13ab5a,null));};exports[_0x3d40('0x27')]=function(_0x3a7f39,_0x5d40c3){return db[_0x3d40('0x36')]['find']({'where':{'id':_0x3a7f39[_0x3d40('0x2c')]['id']}})[_0x3d40('0x26')](handleEntityNotFound(_0x5d40c3,null))['then'](removeEntity(_0x5d40c3,null))[_0x3d40('0x38')](handleError(_0x5d40c3,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 27d5c11..8a8037d 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 _0x43d3=['path','rimraf','./chatApplication.attributes','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x59de15,_0x13c0c3){var _0x400c71=function(_0xe80b8f){while(--_0xe80b8f){_0x59de15['push'](_0x59de15['shift']());}};_0x400c71(++_0x13c0c3);}(_0x43d3,0x182));var _0x343d=function(_0x12a512,_0x8065db){_0x12a512=_0x12a512-0x0;var _0x582402=_0x43d3[_0x12a512];return _0x582402;};'use strict';var _=require('lodash');var util=require(_0x343d('0x0'));var logger=require(_0x343d('0x1'))(_0x343d('0x2'));var moment=require(_0x343d('0x3'));var BPromise=require(_0x343d('0x4'));var rp=require(_0x343d('0x5'));var fs=require('fs');var path=require(_0x343d('0x6'));var rimraf=require(_0x343d('0x7'));var config=require('../../config/environment');var attributes=require(_0x343d('0x8'));module['exports']=function(_0x117216,_0x3aa08a){return _0x117216[_0x343d('0x9')](_0x343d('0xa'),attributes,{'tableName':_0x343d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x343d('0xc'),'collate':_0x343d('0xd')});}; \ No newline at end of file +var _0xa251=['../../config/logger','api','bluebird','request-promise','path','rimraf','./chatApplication.attributes','exports','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x35f991,_0x56604b){var _0x98d55a=function(_0x2c7712){while(--_0x2c7712){_0x35f991['push'](_0x35f991['shift']());}};_0x98d55a(++_0x56604b);}(_0xa251,0x1de));var _0x1a25=function(_0x2d3df2,_0x2f9498){_0x2d3df2=_0x2d3df2-0x0;var _0x347bda=_0xa251[_0x2d3df2];return _0x347bda;};'use strict';var _=require(_0x1a25('0x0'));var util=require(_0x1a25('0x1'));var logger=require(_0x1a25('0x2'))(_0x1a25('0x3'));var moment=require('moment');var BPromise=require(_0x1a25('0x4'));var rp=require(_0x1a25('0x5'));var fs=require('fs');var path=require(_0x1a25('0x6'));var rimraf=require(_0x1a25('0x7'));var config=require('../../config/environment');var attributes=require(_0x1a25('0x8'));module[_0x1a25('0x9')]=function(_0x106d02,_0x1c2a7a){return _0x106d02['define']('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1a25('0xa'),'collate':_0x1a25('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index cb8f382..69ae7a5 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 _0x51ac=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x1fb039,_0x50a6c4){var _0x192ab7=function(_0x218136){while(--_0x218136){_0x1fb039['push'](_0x1fb039['shift']());}};_0x192ab7(++_0x50a6c4);}(_0x51ac,0x11b));var _0xc51a=function(_0x30814c,_0x305670){_0x30814c=_0x30814c-0x0;var _0x25e13b=_0x51ac[_0x30814c];return _0x25e13b;};'use strict';var _=require(_0xc51a('0x0'));var util=require(_0xc51a('0x1'));var moment=require(_0xc51a('0x2'));var BPromise=require(_0xc51a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc51a('0x4'))['db'];var utils=require(_0xc51a('0x5'));var logger=require(_0xc51a('0x6'))(_0xc51a('0x7'));var config=require(_0xc51a('0x8'));var jayson=require(_0xc51a('0x9'));var client=jayson[_0xc51a('0xa')][_0xc51a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28bbc0,_0xe4dbc5,_0x1db38e){return new BPromise(function(_0x315d5c,_0x4fb335){return client['request'](_0x28bbc0,_0x1db38e)[_0xc51a('0xc')](function(_0x7e922d){logger[_0xc51a('0xd')](_0xc51a('0xe'),_0xe4dbc5,_0xc51a('0xf'));logger['debug'](_0xc51a('0x10'),_0xe4dbc5,'request\x20sent',JSON[_0xc51a('0x11')](_0x7e922d));if(_0x7e922d['error']){if(_0x7e922d['error']['code']===0x1f4){logger[_0xc51a('0x12')](_0xc51a('0xe'),_0xe4dbc5,_0x7e922d[_0xc51a('0x12')][_0xc51a('0x13')]);return _0x4fb335(_0x7e922d[_0xc51a('0x12')][_0xc51a('0x13')]);}logger[_0xc51a('0x12')](_0xc51a('0xe'),_0xe4dbc5,_0x7e922d[_0xc51a('0x12')][_0xc51a('0x13')]);return _0x315d5c(_0x7e922d[_0xc51a('0x12')][_0xc51a('0x13')]);}else{logger[_0xc51a('0xd')](_0xc51a('0xe'),_0xe4dbc5,_0xc51a('0xf'));_0x315d5c(_0x7e922d[_0xc51a('0x14')]['message']);}})[_0xc51a('0x15')](function(_0x2bfd1b){logger[_0xc51a('0x12')](_0xc51a('0xe'),_0xe4dbc5,_0x2bfd1b);_0x4fb335(_0x2bfd1b);});});} \ No newline at end of file +var _0x59ed=['../../config/logger','rpc','jayson/promise','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x59ed,0x73));var _0xd59e=function(_0x54a28a,_0x1ba1fe){_0x54a28a=_0x54a28a-0x0;var _0x3da1f1=_0x59ed[_0x54a28a];return _0x3da1f1;};'use strict';var _=require('lodash');var util=require(_0xd59e('0x0'));var moment=require('moment');var BPromise=require(_0xd59e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd59e('0x2'));var db=require(_0xd59e('0x3'))['db'];var utils=require(_0xd59e('0x4'));var logger=require(_0xd59e('0x5'))(_0xd59e('0x6'));var config=require('../../config/environment');var jayson=require(_0xd59e('0x7'));var client=jayson['client'][_0xd59e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f628e,_0x42fb03,_0x5da5e5){return new BPromise(function(_0x3ec564,_0x4b1b6c){return client['request'](_0x3f628e,_0x5da5e5)[_0xd59e('0x9')](function(_0x91b6a7){logger[_0xd59e('0xa')](_0xd59e('0xb'),_0x42fb03,_0xd59e('0xc'));logger[_0xd59e('0xd')](_0xd59e('0xe'),_0x42fb03,_0xd59e('0xc'),JSON[_0xd59e('0xf')](_0x91b6a7));if(_0x91b6a7[_0xd59e('0x10')]){if(_0x91b6a7[_0xd59e('0x10')][_0xd59e('0x11')]===0x1f4){logger[_0xd59e('0x10')](_0xd59e('0xb'),_0x42fb03,_0x91b6a7[_0xd59e('0x10')][_0xd59e('0x12')]);return _0x4b1b6c(_0x91b6a7[_0xd59e('0x10')][_0xd59e('0x12')]);}logger[_0xd59e('0x10')](_0xd59e('0xb'),_0x42fb03,_0x91b6a7['error'][_0xd59e('0x12')]);return _0x3ec564(_0x91b6a7[_0xd59e('0x10')][_0xd59e('0x12')]);}else{logger[_0xd59e('0xa')](_0xd59e('0xb'),_0x42fb03,_0xd59e('0xc'));_0x3ec564(_0x91b6a7['result'][_0xd59e('0x12')]);}})[_0xd59e('0x13')](function(_0x2fe522){logger[_0xd59e('0x10')](_0xd59e('0xb'),_0x42fb03,_0x2fe522);_0x4b1b6c(_0x2fe522);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 1892b05..d9b479e 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 _0xcf66=['util','path','express','Router','fs-extra','../../config/environment','./chatApplication.controller','/:id','show','put','isAuthenticated','destroy','exports','multer'];(function(_0x29a86c,_0x50f14a){var _0x42f78c=function(_0x1535b1){while(--_0x1535b1){_0x29a86c['push'](_0x29a86c['shift']());}};_0x42f78c(++_0x50f14a);}(_0xcf66,0x99));var _0x6cf6=function(_0x42be0f,_0x4c14cb){_0x42be0f=_0x42be0f-0x0;var _0x40ef79=_0xcf66[_0x42be0f];return _0x40ef79;};'use strict';var multer=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var path=require(_0x6cf6('0x2'));var timeout=require('connect-timeout');var express=require(_0x6cf6('0x3'));var router=express[_0x6cf6('0x4')]();var fs_extra=require(_0x6cf6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6cf6('0x6'));var controller=require(_0x6cf6('0x7'));router['get'](_0x6cf6('0x8'),auth['isAuthenticated'](),controller[_0x6cf6('0x9')]);router[_0x6cf6('0xa')](_0x6cf6('0x8'),auth[_0x6cf6('0xb')](),controller['update']);router['delete']('/:id',auth[_0x6cf6('0xb')](),controller[_0x6cf6('0xc')]);module[_0x6cf6('0xd')]=router; \ No newline at end of file +var _0xb686=['/:id','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','isAuthenticated','show'];(function(_0x27beea,_0x3bc9f4){var _0x122645=function(_0x2c848){while(--_0x2c848){_0x27beea['push'](_0x27beea['shift']());}};_0x122645(++_0x3bc9f4);}(_0xb686,0x1a5));var _0x6b68=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb686[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x6b68('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6b68('0x1'));var express=require('express');var router=express[_0x6b68('0x2')]();var fs_extra=require(_0x6b68('0x3'));var auth=require(_0x6b68('0x4'));var interaction=require(_0x6b68('0x5'));var config=require(_0x6b68('0x6'));var controller=require(_0x6b68('0x7'));router[_0x6b68('0x8')]('/:id',auth[_0x6b68('0x9')](),controller[_0x6b68('0xa')]);router['put'](_0x6b68('0xb'),auth[_0x6b68('0x9')](),controller['update']);router['delete'](_0x6b68('0xb'),auth[_0x6b68('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index f53fc66..16bb23c 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 _0x7a0b=['BOOLEAN','sequelize','exports','STRING'];(function(_0xd4669d,_0x4ef2b2){var _0x5e5002=function(_0x43aeab){while(--_0x43aeab){_0xd4669d['push'](_0xd4669d['shift']());}};_0x5e5002(++_0x4ef2b2);}(_0x7a0b,0x85));var _0xb7a0=function(_0x39c3a5,_0x55f37b){_0x39c3a5=_0x39c3a5-0x0;var _0x293f27=_0x7a0b[_0x39c3a5];return _0x293f27;};'use strict';var Sequelize=require(_0xb7a0('0x0'));module[_0xb7a0('0x1')]={'name':{'type':Sequelize[_0xb7a0('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xb7a0('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2dc3=['BOOLEAN','exports','STRING'];(function(_0x47e6d7,_0x232b87){var _0x80f038=function(_0x4db0b9){while(--_0x4db0b9){_0x47e6d7['push'](_0x47e6d7['shift']());}};_0x80f038(++_0x232b87);}(_0x2dc3,0x127));var _0x32dc=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x2dc3[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require('sequelize');module[_0x32dc('0x0')]={'name':{'type':Sequelize[_0x32dc('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x32dc('0x1')]},'write':{'type':Sequelize[_0x32dc('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 940fda7..893a016 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 _0xdb13=['error','stack','name','index','map','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ChatGroup','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','omit','ids','User','getMembers','removeMembers','addMessage','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0xdb13,0x93));var _0x3db1=function(_0xea9fdf,_0x40a92f){_0xea9fdf=_0xea9fdf-0x0;var _0x508d63=_0xdb13[_0xea9fdf];return _0x508d63;};'use strict';var emlformat=require(_0x3db1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3db1('0x1'));var jsonpatch=require(_0x3db1('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3db1('0x3'));var Mustache=require(_0x3db1('0x4'));var util=require(_0x3db1('0x5'));var path=require(_0x3db1('0x6'));var sox=require(_0x3db1('0x7'));var csv=require(_0x3db1('0x8'));var ejs=require(_0x3db1('0x9'));var fs=require('fs');var fs_extra=require(_0x3db1('0xa'));var _=require(_0x3db1('0xb'));var squel=require(_0x3db1('0xc'));var crypto=require(_0x3db1('0xd'));var jsforce=require(_0x3db1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3db1('0x8'));var querystring=require(_0x3db1('0xf'));var Papa=require('papaparse');var Redis=require(_0x3db1('0x10'));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('../../config/logger')('api');var utils=require(_0x3db1('0x11'));var config=require(_0x3db1('0x12'));var licenseUtil=require(_0x3db1('0x13'));var db=require(_0x3db1('0x14'))['db'];config[_0x3db1('0x15')]=_[_0x3db1('0x16')](config[_0x3db1('0x15')],{'host':_0x3db1('0x17'),'port':0x18eb});var socket=require(_0x3db1('0x18'))(new Redis(config['redis']));require(_0x3db1('0x19'))['register'](socket);function respondWithStatusCode(_0x3c3a7c,_0x298c9d){_0x298c9d=_0x298c9d||0xcc;return function(_0x10ac4a){if(_0x10ac4a){return _0x3c3a7c[_0x3db1('0x1a')](_0x298c9d);}return _0x3c3a7c[_0x3db1('0x1b')](_0x298c9d)[_0x3db1('0x1c')]();};}function respondWithResult(_0x1d4ab1,_0x29223a){_0x29223a=_0x29223a||0xc8;return function(_0x53e0cb){if(_0x53e0cb){return _0x1d4ab1['status'](_0x29223a)[_0x3db1('0x1d')](_0x53e0cb);}};}function respondWithFilteredResult(_0xbead32,_0x531619){return function(_0x12208a){if(_0x12208a){var _0x2aee49=typeof _0x531619['offset']==='undefined'&&typeof _0x531619[_0x3db1('0x1e')]===_0x3db1('0x1f');var _0xb91c8c=_0x12208a[_0x3db1('0x20')];var _0x4f52e8=_0x2aee49?0x0:_0x531619[_0x3db1('0x21')];var _0x3b8112=_0x2aee49?_0x12208a[_0x3db1('0x20')]:_0x531619['offset']+_0x531619[_0x3db1('0x1e')];var _0x5855d7;if(_0x3b8112>=_0xb91c8c){_0x3b8112=_0xb91c8c;_0x5855d7=0xc8;}else{_0x5855d7=0xce;}_0xbead32[_0x3db1('0x1b')](_0x5855d7);return _0xbead32[_0x3db1('0x22')](_0x3db1('0x23'),_0x4f52e8+'-'+_0x3b8112+'/'+_0xb91c8c)['json'](_0x12208a);}return null;};}function patchUpdates(_0x5356ca){return function(_0x125caa){try{jsonpatch['apply'](_0x125caa,_0x5356ca,!![]);}catch(_0x5da720){return BPromise[_0x3db1('0x24')](_0x5da720);}return _0x125caa[_0x3db1('0x25')]();};}function saveUpdates(_0x45d6f0,_0x2fe649){return function(_0x451cfa){if(_0x451cfa){return _0x451cfa[_0x3db1('0x26')](_0x45d6f0)[_0x3db1('0x27')](function(_0x1f388b){return _0x1f388b;});}return null;};}function removeEntity(_0x3e4de7,_0x1467ae){return function(_0x5b0caa){if(_0x5b0caa){return _0x5b0caa[_0x3db1('0x28')]()[_0x3db1('0x27')](function(){_0x3e4de7[_0x3db1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32fe71,_0x33c557){return function(_0x24fef5){if(!_0x24fef5){_0x32fe71['sendStatus'](0x194);}return _0x24fef5;};}function handleError(_0x4a3b82,_0x339271){_0x339271=_0x339271||0x1f4;return function(_0x1d8285){logger[_0x3db1('0x29')](_0x1d8285[_0x3db1('0x2a')]);if(_0x1d8285[_0x3db1('0x2b')]){delete _0x1d8285['name'];}_0x4a3b82[_0x3db1('0x1b')](_0x339271)['send'](_0x1d8285);};}exports[_0x3db1('0x2c')]=function(_0x443067,_0x50f2a9){var _0x1af7ec={},_0x1a79f8={},_0x1fb8f0={'count':0x0,'rows':[]};var _0x53111e=_[_0x3db1('0x2d')](db['ChatGroup'][_0x3db1('0x2e')],function(_0x47bc64){return{'name':_0x47bc64['fieldName'],'type':_0x47bc64[_0x3db1('0x2f')][_0x3db1('0x30')]};});_0x1a79f8['model']=_[_0x3db1('0x2d')](_0x53111e,_0x3db1('0x2b'));_0x1a79f8['query']=_['keys'](_0x443067[_0x3db1('0x31')]);_0x1a79f8[_0x3db1('0x32')]=_[_0x3db1('0x33')](_0x1a79f8[_0x3db1('0x34')],_0x1a79f8[_0x3db1('0x31')]);_0x1af7ec[_0x3db1('0x35')]=_['intersection'](_0x1a79f8[_0x3db1('0x34')],qs[_0x3db1('0x36')](_0x443067[_0x3db1('0x31')][_0x3db1('0x36')]));_0x1af7ec[_0x3db1('0x35')]=_0x1af7ec[_0x3db1('0x35')][_0x3db1('0x37')]?_0x1af7ec['attributes']:_0x1a79f8[_0x3db1('0x34')];if(!_0x443067[_0x3db1('0x31')][_0x3db1('0x38')](_0x3db1('0x39'))){_0x1af7ec['limit']=qs[_0x3db1('0x1e')](_0x443067[_0x3db1('0x31')][_0x3db1('0x1e')]);_0x1af7ec[_0x3db1('0x21')]=qs[_0x3db1('0x21')](_0x443067['query'][_0x3db1('0x21')]);}_0x1af7ec[_0x3db1('0x3a')]=qs[_0x3db1('0x3b')](_0x443067[_0x3db1('0x31')][_0x3db1('0x3b')]);_0x1af7ec[_0x3db1('0x3c')]=qs[_0x3db1('0x32')](_[_0x3db1('0x3d')](_0x443067[_0x3db1('0x31')],_0x1a79f8['filters']),_0x53111e);if(_0x443067['query'][_0x3db1('0x3e')]){_0x1af7ec[_0x3db1('0x3c')]=_[_0x3db1('0x3f')](_0x1af7ec['where'],{'$or':_[_0x3db1('0x2d')](_0x53111e,function(_0x38cb5f){if(_0x38cb5f[_0x3db1('0x2f')]!==_0x3db1('0x40')){var _0x151c5d={};_0x151c5d[_0x38cb5f[_0x3db1('0x2b')]]={'$like':'%'+_0x443067[_0x3db1('0x31')][_0x3db1('0x3e')]+'%'};return _0x151c5d;}})});}_0x1af7ec=_[_0x3db1('0x3f')]({},_0x1af7ec,_0x443067['options']);var _0xf4649b={'where':_0x1af7ec[_0x3db1('0x3c')]};return db[_0x3db1('0x41')][_0x3db1('0x20')](_0xf4649b)[_0x3db1('0x27')](function(_0x4b20d1){_0x1fb8f0[_0x3db1('0x20')]=_0x4b20d1;if(_0x443067['query'][_0x3db1('0x42')]){_0x1af7ec[_0x3db1('0x43')]=[{'all':!![]}];}return db[_0x3db1('0x41')][_0x3db1('0x44')](_0x1af7ec);})[_0x3db1('0x27')](function(_0x1c10b6){_0x1fb8f0['rows']=_0x1c10b6;return _0x1fb8f0;})[_0x3db1('0x27')](respondWithFilteredResult(_0x50f2a9,_0x1af7ec))[_0x3db1('0x45')](handleError(_0x50f2a9,null));};exports[_0x3db1('0x46')]=function(_0x52f43a,_0x153f41){var _0xb2c96f={'raw':!![],'where':{'id':_0x52f43a[_0x3db1('0x47')]['id']}},_0x4b26d4={};_0x4b26d4['model']=_[_0x3db1('0x48')](db[_0x3db1('0x41')]['rawAttributes']);_0x4b26d4['query']=_[_0x3db1('0x48')](_0x52f43a[_0x3db1('0x31')]);_0x4b26d4[_0x3db1('0x32')]=_[_0x3db1('0x33')](_0x4b26d4[_0x3db1('0x34')],_0x4b26d4[_0x3db1('0x31')]);_0xb2c96f[_0x3db1('0x35')]=_[_0x3db1('0x33')](_0x4b26d4[_0x3db1('0x34')],qs[_0x3db1('0x36')](_0x52f43a[_0x3db1('0x31')][_0x3db1('0x36')]));_0xb2c96f[_0x3db1('0x35')]=_0xb2c96f[_0x3db1('0x35')][_0x3db1('0x37')]?_0xb2c96f['attributes']:_0x4b26d4['model'];if(_0x52f43a[_0x3db1('0x31')]['includeAll']){_0xb2c96f[_0x3db1('0x43')]=[{'all':!![]}];}_0xb2c96f=_['merge']({},_0xb2c96f,_0x52f43a['options']);return db[_0x3db1('0x41')][_0x3db1('0x49')](_0xb2c96f)['then'](handleEntityNotFound(_0x153f41,null))[_0x3db1('0x27')](respondWithResult(_0x153f41,null))[_0x3db1('0x45')](handleError(_0x153f41,null));};exports[_0x3db1('0x4a')]=function(_0x2324fd,_0x1e18da){return db['ChatGroup'][_0x3db1('0x4a')](_0x2324fd[_0x3db1('0x4b')],{})[_0x3db1('0x27')](respondWithResult(_0x1e18da,0xc9))['catch'](handleError(_0x1e18da,null));};exports[_0x3db1('0x26')]=function(_0x7c0464,_0xdd33a8){if(_0x7c0464[_0x3db1('0x4b')]['id']){delete _0x7c0464[_0x3db1('0x4b')]['id'];}return db['ChatGroup'][_0x3db1('0x49')]({'where':{'id':_0x7c0464[_0x3db1('0x47')]['id']}})['then'](handleEntityNotFound(_0xdd33a8,null))[_0x3db1('0x27')](saveUpdates(_0x7c0464['body'],null))[_0x3db1('0x27')](respondWithResult(_0xdd33a8,null))[_0x3db1('0x45')](handleError(_0xdd33a8,null));};exports[_0x3db1('0x28')]=function(_0x141304,_0x5e0e69){return db[_0x3db1('0x41')]['find']({'where':{'id':_0x141304[_0x3db1('0x47')]['id']}})['then'](handleEntityNotFound(_0x5e0e69,null))[_0x3db1('0x27')](removeEntity(_0x5e0e69,null))[_0x3db1('0x45')](handleError(_0x5e0e69,null));};exports[_0x3db1('0x4c')]=function(_0x553397,_0x22ffa3){return db[_0x3db1('0x41')][_0x3db1('0x4c')]()[_0x3db1('0x27')](respondWithResult(_0x22ffa3,null))[_0x3db1('0x45')](handleError(_0x22ffa3,null));};exports[_0x3db1('0x4d')]=function(_0xcc4e6c,_0x26157b,_0x11ea95){return db[_0x3db1('0x4e')]['count']({'where':{'ChatGroupId':_0xcc4e6c[_0x3db1('0x47')]['id'],'ToId':_0xcc4e6c['user']['id'],'read':![]}})[_0x3db1('0x27')](function(_0x560495){return{'id':_[_0x3db1('0x4f')](_0xcc4e6c['params']['id']),'count':_0x560495};})[_0x3db1('0x27')](respondWithResult(_0x26157b,null))['catch'](handleError(_0x26157b,null));};exports['addMembers']=function(_0x545eae,_0xff2326,_0x1e2f5f){return db[_0x3db1('0x41')]['find']({'where':{'id':_0x545eae[_0x3db1('0x47')]['id']}})['then'](handleEntityNotFound(_0xff2326,null))[_0x3db1('0x27')](function(_0x388de4){if(_0x388de4){return _0x388de4[_0x3db1('0x50')](_0x545eae['body']['ids'],_[_0x3db1('0x51')](_0x545eae[_0x3db1('0x4b')],[_0x3db1('0x52'),'id'])||{});}})[_0x3db1('0x27')](respondWithResult(_0xff2326,null))[_0x3db1('0x45')](handleError(_0xff2326,null));};exports['getMembers']=function(_0x455995,_0x17ec38,_0x3c1ca3){var _0x3462fc={};var _0x470d91={};var _0x7712dd;var _0x71507a;return db[_0x3db1('0x41')]['findOne']({'where':{'id':_0x455995[_0x3db1('0x47')]['id']}})[_0x3db1('0x27')](handleEntityNotFound(_0x17ec38,null))[_0x3db1('0x27')](function(_0x23be78){if(_0x23be78){_0x7712dd=_0x23be78;_0x470d91[_0x3db1('0x34')]=_[_0x3db1('0x48')](db[_0x3db1('0x53')][_0x3db1('0x2e')]);_0x470d91['query']=_['keys'](_0x455995['query']);_0x470d91[_0x3db1('0x32')]=_['intersection'](_0x470d91[_0x3db1('0x34')],_0x470d91['query']);_0x3462fc[_0x3db1('0x35')]=_[_0x3db1('0x33')](_0x470d91[_0x3db1('0x34')],qs['fields'](_0x455995['query'][_0x3db1('0x36')]));_0x3462fc[_0x3db1('0x35')]=_0x3462fc['attributes'][_0x3db1('0x37')]?_0x3462fc[_0x3db1('0x35')]:_0x470d91['model'];_0x3462fc[_0x3db1('0x3a')]=qs[_0x3db1('0x3b')](_0x455995[_0x3db1('0x31')][_0x3db1('0x3b')]);_0x3462fc['where']=qs[_0x3db1('0x32')](_['pick'](_0x455995['query'],_0x470d91[_0x3db1('0x32')]));if(_0x455995[_0x3db1('0x31')][_0x3db1('0x3e')]){_0x3462fc['where']=_[_0x3db1('0x3f')](_0x3462fc[_0x3db1('0x3c')],{'$or':_[_0x3db1('0x2d')](_0x3462fc['attributes'],function(_0x75fa6b){var _0x43b5e7={};_0x43b5e7[_0x75fa6b]={'$like':'%'+_0x455995[_0x3db1('0x31')][_0x3db1('0x3e')]+'%'};return _0x43b5e7;})});}_0x3462fc=_[_0x3db1('0x3f')]({},_0x3462fc,_0x455995['options']);return _0x7712dd['getMembers'](_0x3462fc);}})[_0x3db1('0x27')](function(_0x6e6571){if(_0x6e6571){_0x71507a=_0x6e6571['length'];if(!_0x455995['query'][_0x3db1('0x38')]('nolimit')){_0x3462fc['limit']=qs[_0x3db1('0x1e')](_0x455995[_0x3db1('0x31')][_0x3db1('0x1e')]);_0x3462fc['offset']=qs[_0x3db1('0x21')](_0x455995[_0x3db1('0x31')][_0x3db1('0x21')]);}return _0x7712dd[_0x3db1('0x54')](_0x3462fc);}})['then'](function(_0x1a7b1d){if(_0x1a7b1d){return _0x1a7b1d?{'count':_0x71507a,'rows':_0x1a7b1d}:null;}})[_0x3db1('0x27')](respondWithResult(_0x17ec38,null))[_0x3db1('0x45')](handleError(_0x17ec38,null));};exports[_0x3db1('0x55')]=function(_0x359a17,_0x1f13e9,_0x20b2c4){return db[_0x3db1('0x41')][_0x3db1('0x49')]({'where':{'id':_0x359a17[_0x3db1('0x47')]['id']}})['then'](handleEntityNotFound(_0x1f13e9,null))[_0x3db1('0x27')](function(_0x486c16){if(_0x486c16){return _0x486c16[_0x3db1('0x55')](_0x359a17[_0x3db1('0x31')][_0x3db1('0x52')]);}})[_0x3db1('0x27')](respondWithStatusCode(_0x1f13e9,null))[_0x3db1('0x45')](handleError(_0x1f13e9,null));};exports[_0x3db1('0x56')]=function(_0x20ef00,_0x4f9d41,_0x3fa19c){if(_0x20ef00['body']['id']){delete _0x20ef00['body']['id'];}return db[_0x3db1('0x41')][_0x3db1('0x49')]({'where':{'id':_0x20ef00[_0x3db1('0x47')]['id']}})[_0x3db1('0x27')](handleEntityNotFound(_0x4f9d41,null))[_0x3db1('0x27')](function(_0x4b7e95){if(_0x4b7e95){_0x20ef00[_0x3db1('0x4b')]['ChatGroupId']=_0x4b7e95['id'];return db[_0x3db1('0x4e')][_0x3db1('0x4a')](_0x20ef00[_0x3db1('0x4b')]);}})[_0x3db1('0x27')](respondWithResult(_0x4f9d41,null))['catch'](handleError(_0x4f9d41,null));};exports[_0x3db1('0x57')]=function(_0x26346f,_0x2d2ce7,_0x11fe4d){var _0x575e62={};var _0x3d51b4={};var _0x231a8c;var _0x174bb4;return db[_0x3db1('0x41')][_0x3db1('0x58')]({'where':{'id':_0x26346f[_0x3db1('0x47')]['id']}})['then'](handleEntityNotFound(_0x2d2ce7,null))[_0x3db1('0x27')](function(_0x359827){if(_0x359827){_0x231a8c=_0x359827;_0x3d51b4[_0x3db1('0x34')]=_[_0x3db1('0x48')](db[_0x3db1('0x4e')][_0x3db1('0x2e')]);_0x3d51b4[_0x3db1('0x31')]=_['keys'](_0x26346f[_0x3db1('0x31')]);_0x3d51b4[_0x3db1('0x32')]=_['intersection'](_0x3d51b4[_0x3db1('0x34')],_0x3d51b4[_0x3db1('0x31')]);_0x575e62[_0x3db1('0x35')]=_[_0x3db1('0x33')](_0x3d51b4[_0x3db1('0x34')],qs[_0x3db1('0x36')](_0x26346f[_0x3db1('0x31')][_0x3db1('0x36')]));_0x575e62[_0x3db1('0x35')]=_0x575e62[_0x3db1('0x35')]['length']?_0x575e62[_0x3db1('0x35')]:_0x3d51b4[_0x3db1('0x34')];_0x575e62[_0x3db1('0x3a')]=qs[_0x3db1('0x3b')](_0x26346f['query'][_0x3db1('0x3b')]);_0x575e62[_0x3db1('0x3c')]=qs[_0x3db1('0x32')](_['pick'](_0x26346f[_0x3db1('0x31')],_0x3d51b4[_0x3db1('0x32')]));if(_0x26346f[_0x3db1('0x31')][_0x3db1('0x3e')]){_0x575e62[_0x3db1('0x3c')]=_[_0x3db1('0x3f')](_0x575e62[_0x3db1('0x3c')],{'$or':_[_0x3db1('0x2d')](_0x575e62[_0x3db1('0x35')],function(_0x3a6554){var _0x2ea790={};_0x2ea790[_0x3a6554]={'$like':'%'+_0x26346f[_0x3db1('0x31')][_0x3db1('0x3e')]+'%'};return _0x2ea790;})});}if(_0x26346f['query'][_0x3db1('0x59')]){var _0x3d4211=_0x26346f['query'][_0x3db1('0x59')][_0x3db1('0x5a')](',');var _0x54eb6a={};_0x54eb6a[_0x3d4211[0x0]]={'$gte':moment(_0x3d4211[0x1])[_0x3db1('0x5b')](_0x3db1('0x5c'))};_0x575e62['where']=_[_0x3db1('0x3f')](_0x575e62[_0x3db1('0x3c')],_0x54eb6a);}_0x575e62=_[_0x3db1('0x3f')]({},_0x575e62,_0x26346f[_0x3db1('0x5d')]);return _0x231a8c[_0x3db1('0x57')](_0x575e62);}})[_0x3db1('0x27')](function(_0x5942df){if(_0x5942df){_0x174bb4=_0x5942df[_0x3db1('0x37')];if(!_0x26346f[_0x3db1('0x31')][_0x3db1('0x38')](_0x3db1('0x39'))){_0x575e62[_0x3db1('0x1e')]=qs[_0x3db1('0x1e')](_0x26346f[_0x3db1('0x31')]['limit']);_0x575e62[_0x3db1('0x21')]=qs['offset'](_0x26346f[_0x3db1('0x31')]['offset']);}return _0x231a8c[_0x3db1('0x57')](_0x575e62);}})['then'](function(_0x521c7a){if(_0x521c7a){return _0x521c7a?{'count':_0x174bb4,'rows':_0x521c7a}:null;}})[_0x3db1('0x27')](respondWithResult(_0x2d2ce7,null))[_0x3db1('0x45')](handleError(_0x2d2ce7,null));}; \ No newline at end of file +var _0x75cc=['order','filter','map','nolimit','getMembers','removeMembers','addMessage','ChatInternalMessage','getMessages','$gte','split','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./chatGroup.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','error','stack','name','send','index','ChatGroup','rawAttributes','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','describe','user','toInteger','addMembers','ids','omit','findOne','User'];(function(_0x31d344,_0x1527c4){var _0x460050=function(_0x10c336){while(--_0x10c336){_0x31d344['push'](_0x31d344['shift']());}};_0x460050(++_0x1527c4);}(_0x75cc,0x122));var _0xc75c=function(_0x2a629f,_0x9f9eda){_0x2a629f=_0x2a629f-0x0;var _0x148e48=_0x75cc[_0x2a629f];return _0x148e48;};'use strict';var emlformat=require(_0xc75c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc75c('0x1'));var jsonpatch=require(_0xc75c('0x2'));var rp=require(_0xc75c('0x3'));var moment=require(_0xc75c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc75c('0x5'));var util=require('util');var path=require(_0xc75c('0x6'));var sox=require(_0xc75c('0x7'));var csv=require(_0xc75c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc75c('0x9'));var _=require(_0xc75c('0xa'));var squel=require('squel');var crypto=require(_0xc75c('0xb'));var jsforce=require(_0xc75c('0xc'));var deskjs=require(_0xc75c('0xd'));var toCsv=require(_0xc75c('0x8'));var querystring=require('querystring');var Papa=require(_0xc75c('0xe'));var Redis=require(_0xc75c('0xf'));var authService=require(_0xc75c('0x10'));var qs=require(_0xc75c('0x11'));var as=require(_0xc75c('0x12'));var hardwareService=require(_0xc75c('0x13'));var logger=require('../../config/logger')(_0xc75c('0x14'));var utils=require(_0xc75c('0x15'));var config=require(_0xc75c('0x16'));var licenseUtil=require(_0xc75c('0x17'));var db=require(_0xc75c('0x18'))['db'];config[_0xc75c('0x19')]=_[_0xc75c('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc75c('0x19')]));require(_0xc75c('0x1b'))['register'](socket);function respondWithStatusCode(_0x574ca5,_0x48b81f){_0x48b81f=_0x48b81f||0xcc;return function(_0x3eed2b){if(_0x3eed2b){return _0x574ca5[_0xc75c('0x1c')](_0x48b81f);}return _0x574ca5[_0xc75c('0x1d')](_0x48b81f)[_0xc75c('0x1e')]();};}function respondWithResult(_0x294045,_0x52a77a){_0x52a77a=_0x52a77a||0xc8;return function(_0x3e89e4){if(_0x3e89e4){return _0x294045[_0xc75c('0x1d')](_0x52a77a)[_0xc75c('0x1f')](_0x3e89e4);}};}function respondWithFilteredResult(_0x2dfa11,_0x12acbc){return function(_0x52af52){if(_0x52af52){var _0x2a556d=typeof _0x12acbc[_0xc75c('0x20')]==='undefined'&&typeof _0x12acbc[_0xc75c('0x21')]===_0xc75c('0x22');var _0x295123=_0x52af52[_0xc75c('0x23')];var _0x1b4405=_0x2a556d?0x0:_0x12acbc['offset'];var _0x2b95aa=_0x2a556d?_0x52af52[_0xc75c('0x23')]:_0x12acbc[_0xc75c('0x20')]+_0x12acbc[_0xc75c('0x21')];var _0x3db6d0;if(_0x2b95aa>=_0x295123){_0x2b95aa=_0x295123;_0x3db6d0=0xc8;}else{_0x3db6d0=0xce;}_0x2dfa11[_0xc75c('0x1d')](_0x3db6d0);return _0x2dfa11[_0xc75c('0x24')](_0xc75c('0x25'),_0x1b4405+'-'+_0x2b95aa+'/'+_0x295123)[_0xc75c('0x1f')](_0x52af52);}return null;};}function patchUpdates(_0x2241eb){return function(_0x2b0bf0){try{jsonpatch['apply'](_0x2b0bf0,_0x2241eb,!![]);}catch(_0x5ad810){return BPromise['reject'](_0x5ad810);}return _0x2b0bf0['save']();};}function saveUpdates(_0xdd763c,_0x52bda8){return function(_0x1588d4){if(_0x1588d4){return _0x1588d4[_0xc75c('0x26')](_0xdd763c)[_0xc75c('0x27')](function(_0x551107){return _0x551107;});}return null;};}function removeEntity(_0xfd9c41,_0x52b1ea){return function(_0x26f2e1){if(_0x26f2e1){return _0x26f2e1['destroy']()[_0xc75c('0x27')](function(){_0xfd9c41[_0xc75c('0x1d')](0xcc)[_0xc75c('0x1e')]();});}};}function handleEntityNotFound(_0x126e5b,_0x404570){return function(_0x39ea9e){if(!_0x39ea9e){_0x126e5b[_0xc75c('0x1c')](0x194);}return _0x39ea9e;};}function handleError(_0x5c9d24,_0x953e48){_0x953e48=_0x953e48||0x1f4;return function(_0x4f48b4){logger[_0xc75c('0x28')](_0x4f48b4[_0xc75c('0x29')]);if(_0x4f48b4[_0xc75c('0x2a')]){delete _0x4f48b4[_0xc75c('0x2a')];}_0x5c9d24[_0xc75c('0x1d')](_0x953e48)[_0xc75c('0x2b')](_0x4f48b4);};}exports[_0xc75c('0x2c')]=function(_0x5cb391,_0x4ce154){var _0x2182b6={},_0x3d32ab={},_0x33d014={'count':0x0,'rows':[]};var _0x76851f=_['map'](db[_0xc75c('0x2d')][_0xc75c('0x2e')],function(_0x2da2a6){return{'name':_0x2da2a6['fieldName'],'type':_0x2da2a6[_0xc75c('0x2f')][_0xc75c('0x30')]};});_0x3d32ab['model']=_['map'](_0x76851f,_0xc75c('0x2a'));_0x3d32ab['query']=_['keys'](_0x5cb391[_0xc75c('0x31')]);_0x3d32ab[_0xc75c('0x32')]=_['intersection'](_0x3d32ab[_0xc75c('0x33')],_0x3d32ab[_0xc75c('0x31')]);_0x2182b6['attributes']=_[_0xc75c('0x34')](_0x3d32ab['model'],qs['fields'](_0x5cb391[_0xc75c('0x31')][_0xc75c('0x35')]));_0x2182b6[_0xc75c('0x36')]=_0x2182b6[_0xc75c('0x36')][_0xc75c('0x37')]?_0x2182b6[_0xc75c('0x36')]:_0x3d32ab[_0xc75c('0x33')];if(!_0x5cb391[_0xc75c('0x31')][_0xc75c('0x38')]('nolimit')){_0x2182b6[_0xc75c('0x21')]=qs[_0xc75c('0x21')](_0x5cb391[_0xc75c('0x31')][_0xc75c('0x21')]);_0x2182b6[_0xc75c('0x20')]=qs[_0xc75c('0x20')](_0x5cb391[_0xc75c('0x31')]['offset']);}_0x2182b6['order']=qs[_0xc75c('0x39')](_0x5cb391[_0xc75c('0x31')][_0xc75c('0x39')]);_0x2182b6[_0xc75c('0x3a')]=qs['filters'](_[_0xc75c('0x3b')](_0x5cb391['query'],_0x3d32ab['filters']),_0x76851f);if(_0x5cb391[_0xc75c('0x31')]['filter']){_0x2182b6['where']=_[_0xc75c('0x3c')](_0x2182b6[_0xc75c('0x3a')],{'$or':_['map'](_0x76851f,function(_0x1543a7){if(_0x1543a7[_0xc75c('0x2f')]!==_0xc75c('0x3d')){var _0x554b35={};_0x554b35[_0x1543a7['name']]={'$like':'%'+_0x5cb391[_0xc75c('0x31')]['filter']+'%'};return _0x554b35;}})});}_0x2182b6=_[_0xc75c('0x3c')]({},_0x2182b6,_0x5cb391['options']);var _0xe0fdb4={'where':_0x2182b6[_0xc75c('0x3a')]};return db[_0xc75c('0x2d')][_0xc75c('0x23')](_0xe0fdb4)[_0xc75c('0x27')](function(_0x56bedf){_0x33d014[_0xc75c('0x23')]=_0x56bedf;if(_0x5cb391[_0xc75c('0x31')][_0xc75c('0x3e')]){_0x2182b6[_0xc75c('0x3f')]=[{'all':!![]}];}return db[_0xc75c('0x2d')][_0xc75c('0x40')](_0x2182b6);})[_0xc75c('0x27')](function(_0x4d3e52){_0x33d014[_0xc75c('0x41')]=_0x4d3e52;return _0x33d014;})['then'](respondWithFilteredResult(_0x4ce154,_0x2182b6))['catch'](handleError(_0x4ce154,null));};exports[_0xc75c('0x42')]=function(_0x5ba0cc,_0x3b94fc){var _0x2bb279={'raw':!![],'where':{'id':_0x5ba0cc[_0xc75c('0x43')]['id']}},_0x4f5bce={};_0x4f5bce[_0xc75c('0x33')]=_['keys'](db[_0xc75c('0x2d')]['rawAttributes']);_0x4f5bce[_0xc75c('0x31')]=_[_0xc75c('0x44')](_0x5ba0cc[_0xc75c('0x31')]);_0x4f5bce['filters']=_[_0xc75c('0x34')](_0x4f5bce[_0xc75c('0x33')],_0x4f5bce[_0xc75c('0x31')]);_0x2bb279[_0xc75c('0x36')]=_[_0xc75c('0x34')](_0x4f5bce[_0xc75c('0x33')],qs[_0xc75c('0x35')](_0x5ba0cc[_0xc75c('0x31')]['fields']));_0x2bb279[_0xc75c('0x36')]=_0x2bb279[_0xc75c('0x36')][_0xc75c('0x37')]?_0x2bb279['attributes']:_0x4f5bce['model'];if(_0x5ba0cc['query'][_0xc75c('0x3e')]){_0x2bb279[_0xc75c('0x3f')]=[{'all':!![]}];}_0x2bb279=_[_0xc75c('0x3c')]({},_0x2bb279,_0x5ba0cc[_0xc75c('0x45')]);return db[_0xc75c('0x2d')][_0xc75c('0x46')](_0x2bb279)[_0xc75c('0x27')](handleEntityNotFound(_0x3b94fc,null))[_0xc75c('0x27')](respondWithResult(_0x3b94fc,null))[_0xc75c('0x47')](handleError(_0x3b94fc,null));};exports[_0xc75c('0x48')]=function(_0x271b05,_0x4c533a){return db[_0xc75c('0x2d')][_0xc75c('0x48')](_0x271b05['body'],{})[_0xc75c('0x27')](respondWithResult(_0x4c533a,0xc9))[_0xc75c('0x47')](handleError(_0x4c533a,null));};exports[_0xc75c('0x26')]=function(_0x30f133,_0x36428b){if(_0x30f133[_0xc75c('0x49')]['id']){delete _0x30f133[_0xc75c('0x49')]['id'];}return db[_0xc75c('0x2d')]['find']({'where':{'id':_0x30f133[_0xc75c('0x43')]['id']}})['then'](handleEntityNotFound(_0x36428b,null))[_0xc75c('0x27')](saveUpdates(_0x30f133[_0xc75c('0x49')],null))[_0xc75c('0x27')](respondWithResult(_0x36428b,null))[_0xc75c('0x47')](handleError(_0x36428b,null));};exports['destroy']=function(_0x4c7a7b,_0x3f9ff9){return db['ChatGroup'][_0xc75c('0x46')]({'where':{'id':_0x4c7a7b[_0xc75c('0x43')]['id']}})[_0xc75c('0x27')](handleEntityNotFound(_0x3f9ff9,null))[_0xc75c('0x27')](removeEntity(_0x3f9ff9,null))[_0xc75c('0x47')](handleError(_0x3f9ff9,null));};exports['describe']=function(_0x6f582c,_0x219ecf){return db[_0xc75c('0x2d')][_0xc75c('0x4a')]()[_0xc75c('0x27')](respondWithResult(_0x219ecf,null))['catch'](handleError(_0x219ecf,null));};exports['getUnread']=function(_0x1c6607,_0x584b0d,_0xb433e0){return db['ChatInternalMessage'][_0xc75c('0x23')]({'where':{'ChatGroupId':_0x1c6607[_0xc75c('0x43')]['id'],'ToId':_0x1c6607[_0xc75c('0x4b')]['id'],'read':![]}})[_0xc75c('0x27')](function(_0xf37ada){return{'id':_[_0xc75c('0x4c')](_0x1c6607[_0xc75c('0x43')]['id']),'count':_0xf37ada};})['then'](respondWithResult(_0x584b0d,null))[_0xc75c('0x47')](handleError(_0x584b0d,null));};exports[_0xc75c('0x4d')]=function(_0x4f28d4,_0x17969b,_0x2c9da4){return db[_0xc75c('0x2d')][_0xc75c('0x46')]({'where':{'id':_0x4f28d4[_0xc75c('0x43')]['id']}})[_0xc75c('0x27')](handleEntityNotFound(_0x17969b,null))[_0xc75c('0x27')](function(_0x280b09){if(_0x280b09){return _0x280b09['addMembers'](_0x4f28d4[_0xc75c('0x49')][_0xc75c('0x4e')],_[_0xc75c('0x4f')](_0x4f28d4[_0xc75c('0x49')],[_0xc75c('0x4e'),'id'])||{});}})['then'](respondWithResult(_0x17969b,null))[_0xc75c('0x47')](handleError(_0x17969b,null));};exports['getMembers']=function(_0x3219a2,_0x238ed5,_0x5a6f5e){var _0x599671={};var _0x14bcb9={};var _0x304387;var _0x224a96;return db['ChatGroup'][_0xc75c('0x50')]({'where':{'id':_0x3219a2[_0xc75c('0x43')]['id']}})['then'](handleEntityNotFound(_0x238ed5,null))['then'](function(_0x34280b){if(_0x34280b){_0x304387=_0x34280b;_0x14bcb9[_0xc75c('0x33')]=_[_0xc75c('0x44')](db[_0xc75c('0x51')][_0xc75c('0x2e')]);_0x14bcb9[_0xc75c('0x31')]=_[_0xc75c('0x44')](_0x3219a2['query']);_0x14bcb9[_0xc75c('0x32')]=_[_0xc75c('0x34')](_0x14bcb9[_0xc75c('0x33')],_0x14bcb9[_0xc75c('0x31')]);_0x599671[_0xc75c('0x36')]=_[_0xc75c('0x34')](_0x14bcb9['model'],qs['fields'](_0x3219a2[_0xc75c('0x31')]['fields']));_0x599671[_0xc75c('0x36')]=_0x599671[_0xc75c('0x36')][_0xc75c('0x37')]?_0x599671[_0xc75c('0x36')]:_0x14bcb9[_0xc75c('0x33')];_0x599671[_0xc75c('0x52')]=qs['sort'](_0x3219a2[_0xc75c('0x31')][_0xc75c('0x39')]);_0x599671[_0xc75c('0x3a')]=qs['filters'](_[_0xc75c('0x3b')](_0x3219a2[_0xc75c('0x31')],_0x14bcb9[_0xc75c('0x32')]));if(_0x3219a2[_0xc75c('0x31')][_0xc75c('0x53')]){_0x599671[_0xc75c('0x3a')]=_['merge'](_0x599671[_0xc75c('0x3a')],{'$or':_[_0xc75c('0x54')](_0x599671[_0xc75c('0x36')],function(_0x33e1af){var _0x277708={};_0x277708[_0x33e1af]={'$like':'%'+_0x3219a2[_0xc75c('0x31')][_0xc75c('0x53')]+'%'};return _0x277708;})});}_0x599671=_[_0xc75c('0x3c')]({},_0x599671,_0x3219a2[_0xc75c('0x45')]);return _0x304387['getMembers'](_0x599671);}})['then'](function(_0x16402b){if(_0x16402b){_0x224a96=_0x16402b[_0xc75c('0x37')];if(!_0x3219a2[_0xc75c('0x31')][_0xc75c('0x38')](_0xc75c('0x55'))){_0x599671[_0xc75c('0x21')]=qs[_0xc75c('0x21')](_0x3219a2['query'][_0xc75c('0x21')]);_0x599671[_0xc75c('0x20')]=qs[_0xc75c('0x20')](_0x3219a2[_0xc75c('0x31')]['offset']);}return _0x304387[_0xc75c('0x56')](_0x599671);}})[_0xc75c('0x27')](function(_0x22a620){if(_0x22a620){return _0x22a620?{'count':_0x224a96,'rows':_0x22a620}:null;}})[_0xc75c('0x27')](respondWithResult(_0x238ed5,null))['catch'](handleError(_0x238ed5,null));};exports[_0xc75c('0x57')]=function(_0xc73ecc,_0x3e2170,_0x31c9ec){return db['ChatGroup']['find']({'where':{'id':_0xc73ecc[_0xc75c('0x43')]['id']}})[_0xc75c('0x27')](handleEntityNotFound(_0x3e2170,null))[_0xc75c('0x27')](function(_0x4fcb1e){if(_0x4fcb1e){return _0x4fcb1e['removeMembers'](_0xc73ecc[_0xc75c('0x31')][_0xc75c('0x4e')]);}})[_0xc75c('0x27')](respondWithStatusCode(_0x3e2170,null))[_0xc75c('0x47')](handleError(_0x3e2170,null));};exports[_0xc75c('0x58')]=function(_0x203df8,_0x123022,_0x445663){if(_0x203df8[_0xc75c('0x49')]['id']){delete _0x203df8[_0xc75c('0x49')]['id'];}return db[_0xc75c('0x2d')][_0xc75c('0x46')]({'where':{'id':_0x203df8['params']['id']}})['then'](handleEntityNotFound(_0x123022,null))[_0xc75c('0x27')](function(_0x361340){if(_0x361340){_0x203df8[_0xc75c('0x49')]['ChatGroupId']=_0x361340['id'];return db[_0xc75c('0x59')][_0xc75c('0x48')](_0x203df8[_0xc75c('0x49')]);}})['then'](respondWithResult(_0x123022,null))[_0xc75c('0x47')](handleError(_0x123022,null));};exports[_0xc75c('0x5a')]=function(_0x2cd00a,_0x44f7e1,_0x3d6c5d){var _0x2da80f={};var _0x2e70aa={};var _0x38b3bd;var _0x535f97;return db[_0xc75c('0x2d')][_0xc75c('0x50')]({'where':{'id':_0x2cd00a[_0xc75c('0x43')]['id']}})[_0xc75c('0x27')](handleEntityNotFound(_0x44f7e1,null))['then'](function(_0x3ecbcc){if(_0x3ecbcc){_0x38b3bd=_0x3ecbcc;_0x2e70aa[_0xc75c('0x33')]=_['keys'](db[_0xc75c('0x59')][_0xc75c('0x2e')]);_0x2e70aa['query']=_['keys'](_0x2cd00a[_0xc75c('0x31')]);_0x2e70aa[_0xc75c('0x32')]=_['intersection'](_0x2e70aa[_0xc75c('0x33')],_0x2e70aa[_0xc75c('0x31')]);_0x2da80f['attributes']=_[_0xc75c('0x34')](_0x2e70aa['model'],qs['fields'](_0x2cd00a['query']['fields']));_0x2da80f['attributes']=_0x2da80f[_0xc75c('0x36')]['length']?_0x2da80f[_0xc75c('0x36')]:_0x2e70aa[_0xc75c('0x33')];_0x2da80f[_0xc75c('0x52')]=qs[_0xc75c('0x39')](_0x2cd00a[_0xc75c('0x31')][_0xc75c('0x39')]);_0x2da80f['where']=qs[_0xc75c('0x32')](_[_0xc75c('0x3b')](_0x2cd00a[_0xc75c('0x31')],_0x2e70aa[_0xc75c('0x32')]));if(_0x2cd00a['query'][_0xc75c('0x53')]){_0x2da80f[_0xc75c('0x3a')]=_[_0xc75c('0x3c')](_0x2da80f[_0xc75c('0x3a')],{'$or':_[_0xc75c('0x54')](_0x2da80f['attributes'],function(_0x2b045c){var _0x86699a={};_0x86699a[_0x2b045c]={'$like':'%'+_0x2cd00a[_0xc75c('0x31')][_0xc75c('0x53')]+'%'};return _0x86699a;})});}if(_0x2cd00a[_0xc75c('0x31')][_0xc75c('0x5b')]){var _0x5ca44d=_0x2cd00a[_0xc75c('0x31')][_0xc75c('0x5b')][_0xc75c('0x5c')](',');var _0x1b6314={};_0x1b6314[_0x5ca44d[0x0]]={'$gte':moment(_0x5ca44d[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2da80f['where']=_[_0xc75c('0x3c')](_0x2da80f[_0xc75c('0x3a')],_0x1b6314);}_0x2da80f=_[_0xc75c('0x3c')]({},_0x2da80f,_0x2cd00a['options']);return _0x38b3bd['getMessages'](_0x2da80f);}})['then'](function(_0xf95d4f){if(_0xf95d4f){_0x535f97=_0xf95d4f[_0xc75c('0x37')];if(!_0x2cd00a[_0xc75c('0x31')]['hasOwnProperty'](_0xc75c('0x55'))){_0x2da80f[_0xc75c('0x21')]=qs[_0xc75c('0x21')](_0x2cd00a[_0xc75c('0x31')]['limit']);_0x2da80f[_0xc75c('0x20')]=qs[_0xc75c('0x20')](_0x2cd00a['query'][_0xc75c('0x20')]);}return _0x38b3bd['getMessages'](_0x2da80f);}})['then'](function(_0x59be8f){if(_0x59be8f){return _0x59be8f?{'count':_0x535f97,'rows':_0x59be8f}:null;}})[_0xc75c('0x27')](respondWithResult(_0x44f7e1,null))[_0xc75c('0x47')](handleError(_0x44f7e1,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index cdb1098..c6b7f32 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 _0xe6e9=['../../mysqldb','ChatGroup','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xe6e9,0x182));var _0x9e6e=function(_0x1139d9,_0x491c72){_0x1139d9=_0x1139d9-0x0;var _0x4b3e83=_0xe6e9[_0x1139d9];return _0x4b3e83;};'use strict';var EventEmitter=require(_0x9e6e('0x0'));var ChatGroup=require(_0x9e6e('0x1'))['db'][_0x9e6e('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9e6e('0x3'),'afterUpdate':_0x9e6e('0x4'),'afterDestroy':_0x9e6e('0x5')};function emitEvent(_0x3313dc){return function(_0x1f6d79,_0x5f4c0b,_0x1f64e8){ChatGroupEvents[_0x9e6e('0x6')](_0x3313dc+':'+_0x1f6d79['id'],_0x1f6d79);ChatGroupEvents[_0x9e6e('0x6')](_0x3313dc,_0x1f6d79);_0x1f64e8(null);};}for(var e in events){if(events[_0x9e6e('0x7')](e)){var event=events[e];ChatGroup[_0x9e6e('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0xa1c4=['../../mysqldb','ChatGroup','update','remove','emit','hook','exports','events'];(function(_0x156f94,_0x30a889){var _0x1c99f6=function(_0x11bc81){while(--_0x11bc81){_0x156f94['push'](_0x156f94['shift']());}};_0x1c99f6(++_0x30a889);}(_0xa1c4,0xdf));var _0x4a1c=function(_0x9166ea,_0x1f21b0){_0x9166ea=_0x9166ea-0x0;var _0xdceec9=_0xa1c4[_0x9166ea];return _0xdceec9;};'use strict';var EventEmitter=require(_0x4a1c('0x0'));var ChatGroup=require(_0x4a1c('0x1'))['db'][_0x4a1c('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4a1c('0x3'),'afterDestroy':_0x4a1c('0x4')};function emitEvent(_0x15e86e){return function(_0x384234,_0xb3069f,_0x3f5c46){ChatGroupEvents[_0x4a1c('0x5')](_0x15e86e+':'+_0x384234['id'],_0x384234);ChatGroupEvents[_0x4a1c('0x5')](_0x15e86e,_0x384234);_0x3f5c46(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x4a1c('0x6')](e,emitEvent(event));}}module[_0x4a1c('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 2bc0bda..7810f4c 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 _0x8b42=['ChatGroup','chat_groups','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./chatGroup.attributes','exports'];(function(_0x12d0a3,_0x6081a3){var _0x49350b=function(_0x198567){while(--_0x198567){_0x12d0a3['push'](_0x12d0a3['shift']());}};_0x49350b(++_0x6081a3);}(_0x8b42,0x162));var _0x28b4=function(_0x43b56e,_0x3627c0){_0x43b56e=_0x43b56e-0x0;var _0x1d5881=_0x8b42[_0x43b56e];return _0x1d5881;};'use strict';var _=require(_0x28b4('0x0'));var util=require('util');var logger=require(_0x28b4('0x1'))(_0x28b4('0x2'));var moment=require(_0x28b4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x28b4('0x4'));var rimraf=require(_0x28b4('0x5'));var config=require(_0x28b4('0x6'));var attributes=require(_0x28b4('0x7'));module[_0x28b4('0x8')]=function(_0xf0e7d5,_0x417e86){return _0xf0e7d5['define'](_0x28b4('0x9'),attributes,{'tableName':_0x28b4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcae3=['bluebird','request-promise','rimraf','../../config/environment','./chatGroup.attributes','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment'];(function(_0x4ccf96,_0x34978e){var _0xd103b7=function(_0x55736b){while(--_0x55736b){_0x4ccf96['push'](_0x4ccf96['shift']());}};_0xd103b7(++_0x34978e);}(_0xcae3,0x16f));var _0x3cae=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xcae3[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x3cae('0x0'));var util=require(_0x3cae('0x1'));var logger=require(_0x3cae('0x2'))(_0x3cae('0x3'));var moment=require(_0x3cae('0x4'));var BPromise=require(_0x3cae('0x5'));var rp=require(_0x3cae('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3cae('0x7'));var config=require(_0x3cae('0x8'));var attributes=require(_0x3cae('0x9'));module['exports']=function(_0x398a7b,_0x17b983){return _0x398a7b['define'](_0x3cae('0xa'),attributes,{'tableName':_0x3cae('0xb'),'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 c7122a1..4da71af 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 _0xe50e=['defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xe50e,0xf9));var _0xee50=function(_0xa542fd,_0x4a66cb){_0xa542fd=_0xa542fd-0x0;var _0x42d1dc=_0xe50e[_0xa542fd];return _0x42d1dc;};'use strict';var _=require(_0xee50('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xee50('0x1'));var fs=require('fs');var Redis=require(_0xee50('0x2'));var db=require(_0xee50('0x3'))['db'];var utils=require(_0xee50('0x4'));var logger=require(_0xee50('0x5'))(_0xee50('0x6'));var config=require(_0xee50('0x7'));var jayson=require(_0xee50('0x8'));var client=jayson[_0xee50('0x9')][_0xee50('0xa')]({'port':0x232a});config[_0xee50('0xb')]=_[_0xee50('0xc')](config[_0xee50('0xb')],{'host':_0xee50('0xd'),'port':0x18eb});var socket=require(_0xee50('0xe'))(new Redis(config[_0xee50('0xb')]));require(_0xee50('0xf'))[_0xee50('0x10')](socket);function respondWithRpcPromise(_0x2cd326,_0x385e89,_0x5c7734){return new BPromise(function(_0x527d89,_0xff8ad7){return client[_0xee50('0x11')](_0x2cd326,_0x5c7734)[_0xee50('0x12')](function(_0x32c855){logger[_0xee50('0x13')]('ChatGroup,\x20%s,\x20%s',_0x385e89,_0xee50('0x14'));logger[_0xee50('0x15')](_0xee50('0x16'),_0x385e89,_0xee50('0x14'),JSON[_0xee50('0x17')](_0x32c855));if(_0x32c855[_0xee50('0x18')]){if(_0x32c855[_0xee50('0x18')][_0xee50('0x19')]===0x1f4){logger['error'](_0xee50('0x1a'),_0x385e89,_0x32c855[_0xee50('0x18')][_0xee50('0x1b')]);return _0xff8ad7(_0x32c855[_0xee50('0x18')]['message']);}logger[_0xee50('0x18')](_0xee50('0x1a'),_0x385e89,_0x32c855[_0xee50('0x18')][_0xee50('0x1b')]);return _0x527d89(_0x32c855['error'][_0xee50('0x1b')]);}else{logger[_0xee50('0x13')](_0xee50('0x1a'),_0x385e89,_0xee50('0x14'));_0x527d89(_0x32c855[_0xee50('0x1c')][_0xee50('0x1b')]);}})['catch'](function(_0x4080ba){logger[_0xee50('0x18')](_0xee50('0x1a'),_0x385e89,_0x4080ba);_0xff8ad7(_0x4080ba);});});} \ No newline at end of file +var _0x761e=['request','ChatGroup,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register'];(function(_0x2af277,_0x115d8b){var _0x45db57=function(_0x2d6c4a){while(--_0x2d6c4a){_0x2af277['push'](_0x2af277['shift']());}};_0x45db57(++_0x115d8b);}(_0x761e,0x14e));var _0xe761=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x761e[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xe761('0x0'));var util=require(_0xe761('0x1'));var moment=require(_0xe761('0x2'));var BPromise=require(_0xe761('0x3'));var rs=require(_0xe761('0x4'));var fs=require('fs');var Redis=require(_0xe761('0x5'));var db=require(_0xe761('0x6'))['db'];var utils=require(_0xe761('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xe761('0x8'));var jayson=require(_0xe761('0x9'));var client=jayson['client'][_0xe761('0xa')]({'port':0x232a});config[_0xe761('0xb')]=_[_0xe761('0xc')](config[_0xe761('0xb')],{'host':_0xe761('0xd'),'port':0x18eb});var socket=require(_0xe761('0xe'))(new Redis(config['redis']));require(_0xe761('0xf'))[_0xe761('0x10')](socket);function respondWithRpcPromise(_0x4c70f8,_0x273e08,_0x356c8e){return new BPromise(function(_0xa686fb,_0x2a35be){return client[_0xe761('0x11')](_0x4c70f8,_0x356c8e)['then'](function(_0x11b63f){logger['info'](_0xe761('0x12'),_0x273e08,'request\x20sent');logger[_0xe761('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x273e08,'request\x20sent',JSON[_0xe761('0x14')](_0x11b63f));if(_0x11b63f[_0xe761('0x15')]){if(_0x11b63f[_0xe761('0x15')][_0xe761('0x16')]===0x1f4){logger[_0xe761('0x15')](_0xe761('0x12'),_0x273e08,_0x11b63f[_0xe761('0x15')][_0xe761('0x17')]);return _0x2a35be(_0x11b63f['error']['message']);}logger[_0xe761('0x15')](_0xe761('0x12'),_0x273e08,_0x11b63f['error'][_0xe761('0x17')]);return _0xa686fb(_0x11b63f[_0xe761('0x15')][_0xe761('0x17')]);}else{logger['info'](_0xe761('0x12'),_0x273e08,_0xe761('0x18'));_0xa686fb(_0x11b63f[_0xe761('0x19')][_0xe761('0x17')]);}})[_0xe761('0x1a')](function(_0x3ff6c9){logger['error'](_0xe761('0x12'),_0x273e08,_0x3ff6c9);_0x2a35be(_0x3ff6c9);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 634deca..a11f921 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 _0xc35c=['chatGroup:','./chatGroup.events','save','remove','update','emit','length'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc35c,0x12e));var _0xcc35=function(_0x119e0f,_0x1317fb){_0x119e0f=_0x119e0f-0x0;var _0x30e8d0=_0xc35c[_0x119e0f];return _0x30e8d0;};'use strict';var ChatGroupEvents=require(_0xcc35('0x0'));var events=[_0xcc35('0x1'),_0xcc35('0x2'),_0xcc35('0x3')];function createListener(_0xf30d28,_0x5a11cf){return function(_0x46aa6a){_0x5a11cf[_0xcc35('0x4')](_0xf30d28,_0x46aa6a);};}function removeListener(_0xeeaa3d,_0x3ef413){return function(){ChatGroupEvents['removeListener'](_0xeeaa3d,_0x3ef413);};}exports['register']=function(_0x2f0840){for(var _0x450a73=0x0,_0x964e26=events[_0xcc35('0x5')];_0x450a73<_0x964e26;_0x450a73++){var _0x266041=events[_0x450a73];var _0x43500d=createListener(_0xcc35('0x6')+_0x266041,_0x2f0840);ChatGroupEvents['on'](_0x266041,_0x43500d);}}; \ No newline at end of file +var _0xe420=['./chatGroup.events','remove','update','emit','removeListener','length','chatGroup:'];(function(_0x3607cc,_0x4f7201){var _0x582eea=function(_0x23e4f8){while(--_0x23e4f8){_0x3607cc['push'](_0x3607cc['shift']());}};_0x582eea(++_0x4f7201);}(_0xe420,0x149));var _0x0e42=function(_0x32c369,_0x4677bc){_0x32c369=_0x32c369-0x0;var _0x44c4d6=_0xe420[_0x32c369];return _0x44c4d6;};'use strict';var ChatGroupEvents=require(_0x0e42('0x0'));var events=['save',_0x0e42('0x1'),_0x0e42('0x2')];function createListener(_0x49ed93,_0x11835c){return function(_0x1a28b7){_0x11835c[_0x0e42('0x3')](_0x49ed93,_0x1a28b7);};}function removeListener(_0x4eb45c,_0x232019){return function(){ChatGroupEvents[_0x0e42('0x4')](_0x4eb45c,_0x232019);};}exports['register']=function(_0x4305c3){for(var _0x5afb6a=0x0,_0x236587=events[_0x0e42('0x5')];_0x5afb6a<_0x236587;_0x5afb6a++){var _0x31297e=events[_0x5afb6a];var _0x268093=createListener(_0x0e42('0x6')+_0x31297e,_0x4305c3);ChatGroupEvents['on'](_0x31297e,_0x268093);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 9ee6239..b4143a1 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 _0x5c9e=['put','update','delete','destroy','removeMembers','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers'];(function(_0x41a521,_0x28ed87){var _0x381b21=function(_0x12addc){while(--_0x12addc){_0x41a521['push'](_0x41a521['shift']());}};_0x381b21(++_0x28ed87);}(_0x5c9e,0x1c5));var _0xe5c9=function(_0x3cc160,_0x2f7c34){_0x3cc160=_0x3cc160-0x0;var _0x283080=_0x5c9e[_0x3cc160];return _0x283080;};'use strict';var multer=require('multer');var util=require(_0xe5c9('0x0'));var path=require(_0xe5c9('0x1'));var timeout=require(_0xe5c9('0x2'));var express=require('express');var router=express[_0xe5c9('0x3')]();var fs_extra=require(_0xe5c9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe5c9('0x5'));var config=require(_0xe5c9('0x6'));var controller=require(_0xe5c9('0x7'));router[_0xe5c9('0x8')]('/',auth[_0xe5c9('0x9')](),controller[_0xe5c9('0xa')]);router[_0xe5c9('0x8')](_0xe5c9('0xb'),auth[_0xe5c9('0x9')](),controller[_0xe5c9('0xc')]);router[_0xe5c9('0x8')](_0xe5c9('0xd'),auth[_0xe5c9('0x9')](),controller[_0xe5c9('0xe')]);router['get'](_0xe5c9('0xf'),auth['isAuthenticated'](),controller[_0xe5c9('0x10')]);router[_0xe5c9('0x8')](_0xe5c9('0x11'),auth[_0xe5c9('0x9')](),controller[_0xe5c9('0x12')]);router[_0xe5c9('0x8')](_0xe5c9('0x13'),auth[_0xe5c9('0x9')](),controller['getMessages']);router[_0xe5c9('0x14')]('/',auth[_0xe5c9('0x9')](),controller[_0xe5c9('0x15')]);router[_0xe5c9('0x14')](_0xe5c9('0x11'),auth[_0xe5c9('0x9')](),controller[_0xe5c9('0x16')]);router[_0xe5c9('0x14')](_0xe5c9('0x13'),auth[_0xe5c9('0x9')](),controller['addMessage']);router[_0xe5c9('0x17')]('/:id',auth[_0xe5c9('0x9')](),controller[_0xe5c9('0x18')]);router[_0xe5c9('0x19')](_0xe5c9('0xd'),auth['isAuthenticated'](),controller[_0xe5c9('0x1a')]);router[_0xe5c9('0x19')]('/:id/members',auth['isAuthenticated'](),controller[_0xe5c9('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xfe80=['update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','put'];(function(_0x255e37,_0x2e88c1){var _0x3db766=function(_0x254339){while(--_0x254339){_0x255e37['push'](_0x255e37['shift']());}};_0x3db766(++_0x2e88c1);}(_0xfe80,0x19a));var _0x0fe8=function(_0x15b420,_0x5c9e68){_0x15b420=_0x15b420-0x0;var _0x2c1a30=_0xfe80[_0x15b420];return _0x2c1a30;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0fe8('0x0'));var timeout=require(_0x0fe8('0x1'));var express=require(_0x0fe8('0x2'));var router=express[_0x0fe8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0fe8('0x4'));var interaction=require(_0x0fe8('0x5'));var config=require(_0x0fe8('0x6'));var controller=require(_0x0fe8('0x7'));router[_0x0fe8('0x8')]('/',auth[_0x0fe8('0x9')](),controller[_0x0fe8('0xa')]);router[_0x0fe8('0x8')](_0x0fe8('0xb'),auth[_0x0fe8('0x9')](),controller[_0x0fe8('0xc')]);router[_0x0fe8('0x8')](_0x0fe8('0xd'),auth[_0x0fe8('0x9')](),controller[_0x0fe8('0xe')]);router['get'](_0x0fe8('0xf'),auth['isAuthenticated'](),controller[_0x0fe8('0x10')]);router[_0x0fe8('0x8')](_0x0fe8('0x11'),auth[_0x0fe8('0x9')](),controller[_0x0fe8('0x12')]);router[_0x0fe8('0x8')](_0x0fe8('0x13'),auth[_0x0fe8('0x9')](),controller[_0x0fe8('0x14')]);router[_0x0fe8('0x15')]('/',auth[_0x0fe8('0x9')](),controller['create']);router[_0x0fe8('0x15')](_0x0fe8('0x11'),auth[_0x0fe8('0x9')](),controller[_0x0fe8('0x16')]);router[_0x0fe8('0x15')](_0x0fe8('0x13'),auth[_0x0fe8('0x9')](),controller[_0x0fe8('0x17')]);router[_0x0fe8('0x18')](_0x0fe8('0xd'),auth[_0x0fe8('0x9')](),controller[_0x0fe8('0x19')]);router[_0x0fe8('0x1a')](_0x0fe8('0xd'),auth[_0x0fe8('0x9')](),controller[_0x0fe8('0x1b')]);router[_0x0fe8('0x1a')](_0x0fe8('0x11'),auth[_0x0fe8('0x9')](),controller['removeMembers']);module[_0x0fe8('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index e1dd325..93d1cea 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 _0x0fd9=['long','exports','BOOLEAN','INTEGER','ENUM','star','TEXT','STRING','DATE'];(function(_0x324d02,_0x6d9c0b){var _0x3d4f59=function(_0x279f6b){while(--_0x279f6b){_0x324d02['push'](_0x324d02['shift']());}};_0x3d4f59(++_0x6d9c0b);}(_0x0fd9,0xa3));var _0x90fd=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x0fd9[_0x2642cb];return _0xe6e41;};'use strict';var Sequelize=require('sequelize');module[_0x90fd('0x0')]={'closed':{'type':Sequelize[_0x90fd('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x90fd('0x2')]},'ratingType':{'type':Sequelize[_0x90fd('0x3')]('star','thumb'),'defaultValue':_0x90fd('0x4')},'ratingMessage':{'type':Sequelize[_0x90fd('0x5')]},'pathTranscript':{'type':Sequelize[_0x90fd('0x5')]},'mailTranscript':{'type':Sequelize[_0x90fd('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x90fd('0x7')]},'disposition':{'type':Sequelize[_0x90fd('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x90fd('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x90fd('0x6')]},'osVersion':{'type':Sequelize[_0x90fd('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x90fd('0x6')]},'deviceType':{'type':Sequelize[_0x90fd('0x6')]},'referer':{'type':Sequelize[_0x90fd('0x5')]},'customerIp':{'type':Sequelize[_0x90fd('0x6')]},'formData':{'type':Sequelize[_0x90fd('0x5')](_0x90fd('0x8'))},'read1stAt':{'type':Sequelize[_0x90fd('0x7')]},'lastMsgAt':{'type':Sequelize[_0x90fd('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x90fd('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x90fd('0x6')]},'customerPort':{'type':Sequelize[_0x90fd('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x90fd('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x757a=['thumb','star','TEXT','STRING','DATE','long','exports','BOOLEAN'];(function(_0x3c139d,_0x3144fe){var _0x4eb03d=function(_0x76936b){while(--_0x76936b){_0x3c139d['push'](_0x3c139d['shift']());}};_0x4eb03d(++_0x3144fe);}(_0x757a,0xde));var _0xa757=function(_0x236f07,_0x5cbe2f){_0x236f07=_0x236f07-0x0;var _0x1d5b5c=_0x757a[_0x236f07];return _0x1d5b5c;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'closed':{'type':Sequelize[_0xa757('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize['ENUM']('star',_0xa757('0x2')),'defaultValue':_0xa757('0x3')},'ratingMessage':{'type':Sequelize[_0xa757('0x4')]},'pathTranscript':{'type':Sequelize[_0xa757('0x4')]},'mailTranscript':{'type':Sequelize[_0xa757('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xa757('0x6')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa757('0x5')]},'thirdDisposition':{'type':Sequelize[_0xa757('0x5')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xa757('0x5')]},'browserVersion':{'type':Sequelize[_0xa757('0x5')]},'osName':{'type':Sequelize[_0xa757('0x5')]},'osVersion':{'type':Sequelize[_0xa757('0x5')]},'deviceModel':{'type':Sequelize[_0xa757('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xa757('0x5')]},'referer':{'type':Sequelize[_0xa757('0x4')]},'customerIp':{'type':Sequelize[_0xa757('0x5')]},'formData':{'type':Sequelize[_0xa757('0x4')](_0xa757('0x7'))},'read1stAt':{'type':Sequelize[_0xa757('0x6')]},'lastMsgAt':{'type':Sequelize[_0xa757('0x6')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0xa757('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 827fcf8..e929fde 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 _0x6f0d=['CmContact','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','nolimit','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','getMyMessages','includeAgent','alias','setTags','spread','color','emit','chatInteractionTags:save','removeTags','unix','server','tmp','attachments','transcript-%d-%s.zip','firstName','createdAt','direction','Account','mkdirSync','Chat','Owner','N.A.','closedAt','browserName','osName','referer','customerPort','tail','existsSync','createWriteStream','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','zip-dir','request-promise','moment','bluebird','util','path','ejs','lodash','squel','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','send','render','body','agent','interaction','account','Users','TagIds','Tags','forEach','waiting','talking','answered','abandoned','total','closed','UserId','disposition','map','rawAttributes','key','name','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','select','field','from','u.fullname','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','expr','parseSearch','search','sqlOperator','conditions','length','unreadMessages','having','`\x20=\x200','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','type','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?','keys','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','parse','$gte','$lte','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','ChatInteraction','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','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','push','all','rows','include','merge','options','find','create','params','describe','findOne','ChatWebsite','vidaooApiKey','vidaooTopic','fullname','email','contact','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','Unauthorized','ChatOfflineMessageId','join','root','server/files/attachments/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages'];(function(_0x5e8573,_0x401ee1){var _0x3a744a=function(_0x31f4d7){while(--_0x31f4d7){_0x5e8573['push'](_0x5e8573['shift']());}};_0x3a744a(++_0x401ee1);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x45b402,_0x42f7ff){_0x45b402=_0x45b402-0x0;var _0x5a816f=_0x6f0d[_0x45b402];return _0x5a816f;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xd6f0('0x0'));var rp=require(_0xd6f0('0x1'));var moment=require(_0xd6f0('0x2'));var BPromise=require(_0xd6f0('0x3'));var Mustache=require('mustache');var util=require(_0xd6f0('0x4'));var path=require(_0xd6f0('0x5'));var ejs=require(_0xd6f0('0x6'));var fs=require('fs');var _=require(_0xd6f0('0x7'));var squel=require(_0xd6f0('0x8'));var Redis=require('ioredis');var qs=require(_0xd6f0('0x9'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xd6f0('0xa'));var logger=require(_0xd6f0('0xb'))(_0xd6f0('0xc'));var config=require(_0xd6f0('0xd'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd6f0('0xe')](config[_0xd6f0('0xf')],{'host':_0xd6f0('0x10'),'port':0x18eb});var socket=require(_0xd6f0('0x11'))(new Redis(config[_0xd6f0('0xf')]));require('./chatInteraction.socket')[_0xd6f0('0x12')](socket);var jayson=require(_0xd6f0('0x13'));var client=jayson[_0xd6f0('0x14')][_0xd6f0('0x15')]({'port':0x232b});var client9004=jayson['client'][_0xd6f0('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x2f0459,_0x306aad,_0x45973d,_0x109655){return new BPromise(function(_0x409549,_0x2bf5b8){var _0x250999=_0x109655||client;return _0x250999[_0xd6f0('0x16')](_0x2f0459,_0x45973d)['then'](function(_0x2b3f32){logger[_0xd6f0('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x306aad,_0xd6f0('0x18'));logger['debug'](_0xd6f0('0x19'),_0x306aad,_0xd6f0('0x18'),JSON[_0xd6f0('0x1a')](_0x2b3f32));if(_0x2b3f32[_0xd6f0('0x1b')]){if(_0x2b3f32[_0xd6f0('0x1b')][_0xd6f0('0x1c')]===0x1f4){logger[_0xd6f0('0x1b')](_0xd6f0('0x1d'),_0x306aad,_0x2b3f32[_0xd6f0('0x1b')][_0xd6f0('0x1e')]);return _0x2bf5b8(_0x2b3f32[_0xd6f0('0x1b')][_0xd6f0('0x1e')]);}logger[_0xd6f0('0x1b')](_0xd6f0('0x1d'),_0x306aad,_0x2b3f32[_0xd6f0('0x1b')][_0xd6f0('0x1e')]);return _0x409549(_0x2b3f32['error']['message']);}else{logger[_0xd6f0('0x17')](_0xd6f0('0x1d'),_0x306aad,_0xd6f0('0x18'));_0x409549(_0x2b3f32['result'][_0xd6f0('0x1e')]);}})[_0xd6f0('0x1f')](function(_0x557c9b){logger[_0xd6f0('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x306aad,_0x557c9b);_0x2bf5b8(_0x557c9b);});});}function respondWithStatusCode(_0x1ee584,_0x1c9d90){_0x1c9d90=_0x1c9d90||0xcc;return function(_0x5dbe1c){if(_0x5dbe1c){return _0x1ee584[_0xd6f0('0x20')](_0x1c9d90);}return _0x1ee584[_0xd6f0('0x21')](_0x1c9d90)['end']();};}function respondWithResult(_0x3dbdc3,_0x402070){_0x402070=_0x402070||0xc8;return function(_0x283a07){if(_0x283a07){return _0x3dbdc3['status'](_0x402070)[_0xd6f0('0x22')](_0x283a07);}};}function respondWithFilteredResult(_0x3dc166,_0x5ecb16){return function(_0xcea0ae){if(_0xcea0ae){var _0x551be8=typeof _0x5ecb16[_0xd6f0('0x23')]===_0xd6f0('0x24')&&typeof _0x5ecb16[_0xd6f0('0x25')]===_0xd6f0('0x24');var _0x4101bd=_0xcea0ae[_0xd6f0('0x26')];var _0x12d6ec=_0x551be8?0x0:_0x5ecb16[_0xd6f0('0x23')];var _0x48975d=_0x551be8?_0xcea0ae[_0xd6f0('0x26')]:_0x5ecb16[_0xd6f0('0x23')]+_0x5ecb16['limit'];var _0x38a3e9;if(_0x48975d>=_0x4101bd){_0x48975d=_0x4101bd;_0x38a3e9=0xc8;}else{_0x38a3e9=0xce;}_0x3dc166[_0xd6f0('0x21')](_0x38a3e9);return _0x3dc166[_0xd6f0('0x27')](_0xd6f0('0x28'),_0x12d6ec+'-'+_0x48975d+'/'+_0x4101bd)[_0xd6f0('0x22')](_0xcea0ae);}return null;};}function saveUpdates(_0x39e96a){return function(_0x351fda){if(_0x351fda){return _0x351fda[_0xd6f0('0x29')](_0x39e96a)[_0xd6f0('0x2a')](function(_0x43f72f){return _0x43f72f;});}return null;};}function removeEntity(_0x1dff9b){return function(_0x3e913a){if(_0x3e913a){return _0x3e913a[_0xd6f0('0x2b')]()[_0xd6f0('0x2a')](function(){_0x1dff9b[_0xd6f0('0x21')](0xcc)[_0xd6f0('0x2c')]();});}};}function handleEntityNotFound(_0x31c493){return function(_0x376890){if(!_0x376890){_0x31c493[_0xd6f0('0x20')](0x194);}return _0x376890;};}function handleError(_0x180e5f,_0x3906ca){_0x3906ca=_0x3906ca||0x1f4;return function(_0x26ab29){logger['error'](_0x26ab29[_0xd6f0('0x2d')]);if(_0x26ab29['name']){delete _0x26ab29['name'];}_0x180e5f[_0xd6f0('0x21')](_0x3906ca)[_0xd6f0('0x2e')](_0x26ab29);};}function getMustacheRender(_0x12a6fa,_0x27ad7e){return Mustache[_0xd6f0('0x2f')](_0x12a6fa,_['merge'](_0x27ad7e[_0xd6f0('0x30')],{'contact':_0x27ad7e['contact'],'message':_0x27ad7e[_0xd6f0('0x1e')],'agent':_0x27ad7e[_0xd6f0('0x31')],'interaction':_0x27ad7e[_0xd6f0('0x32')],'account':_0x27ad7e[_0xd6f0('0x33')]}))||'';}function getInteractionUsers(_0x518751,_0x5c3132){return new BPromise(function(_0x47b33d,_0x3b6463){try{if(_0x5c3132[_0x518751['id']]){_0x518751[_0xd6f0('0x34')]=_['map'](_0x5c3132[_0x518751['id']],function(_0x1d200a){return{'id':_0x1d200a['id'],'fullname':_0x1d200a['fullname']};});}}catch(_0x507f66){_0x3b6463(_0x507f66);}_0x47b33d(_0x518751);});}function getInteractionTags(_0x2fd7b8,_0x28659e){return new BPromise(function(_0x1852dd,_0x451834){try{if(_0x2fd7b8[_0xd6f0('0x35')]){_0x2fd7b8[_0xd6f0('0x36')]=[];_0x2fd7b8['TagIds']['split'](',')[_0xd6f0('0x37')](function(_0xf879a6){_0x2fd7b8[_0xd6f0('0x36')]['push'](_0x28659e[_0xf879a6]);});}delete _0x2fd7b8['TagIds'];}catch(_0x13b41d){_0x451834(_0x13b41d);}_0x1852dd(_0x2fd7b8);});}function updateChatInteraction(_0x2def01,_0x39fd07,_0x38d06f){return new BPromise(function(_0x2e3225,_0x2b5df5){return getInteractionUsers(_0x2def01,_0x38d06f)[_0xd6f0('0x2a')](function(_0x64359c){return getInteractionTags(_0x64359c,_0x39fd07);})['then'](function(_0x1af620){return getStateInteraction(_0x1af620);})[_0xd6f0('0x2a')](function(_0x1e3c8a){_0x2e3225(_0x1e3c8a);})[_0xd6f0('0x1f')](function(_0x57b83e){_0x2b5df5(_0x57b83e);});});}function getStateInteraction(_0x1981bd){return new BPromise(function(_0x94ec6d){_0x1981bd[_0xd6f0('0x38')]=0x0;_0x1981bd[_0xd6f0('0x39')]=0x0;_0x1981bd[_0xd6f0('0x3a')]=0x0;_0x1981bd['unmanaged']=0x0;_0x1981bd[_0xd6f0('0x3b')]=0x0;_0x1981bd[_0xd6f0('0x3c')]=0x0;if(!_0x1981bd[_0xd6f0('0x3d')]&&!_0x1981bd['UserId']){_0x1981bd[_0xd6f0('0x38')]+=0x1;}if(!_0x1981bd[_0xd6f0('0x3d')]&&_0x1981bd['UserId']){_0x1981bd['talking']+=0x1;if(_0x1981bd[_0xd6f0('0x38')]){_0x1981bd[_0xd6f0('0x38')]-=0x1;}}if(_0x1981bd[_0xd6f0('0x3d')]&&_0x1981bd['disposition']===_0xd6f0('0x3b')){_0x1981bd[_0xd6f0('0x3b')]+=0x1;if(_0x1981bd['waiting']){_0x1981bd[_0xd6f0('0x38')]-=0x1;}}else if(_0x1981bd[_0xd6f0('0x3d')]&&!_0x1981bd[_0xd6f0('0x3e')]&&_0x1981bd[_0xd6f0('0x3f')]){_0x1981bd['unmanaged']+=0x1;if(_0x1981bd[_0xd6f0('0x38')]){_0x1981bd[_0xd6f0('0x38')]-=0x1;}}else if(_0x1981bd[_0xd6f0('0x3d')]&&_0x1981bd[_0xd6f0('0x3e')]){_0x1981bd[_0xd6f0('0x3a')]+=0x1;if(_0x1981bd[_0xd6f0('0x39')]){_0x1981bd[_0xd6f0('0x39')]-=0x1;}}_0x1981bd[_0xd6f0('0x3c')]+=0x1;_0x94ec6d(_0x1981bd);});}exports['index']=function(_0x909f20,_0x3d42ca){var _0x55e93b={},_0x268772={},_0x39ca69={'count':0x0,'rows':[]};var _0x1bcb36=_[_0xd6f0('0x40')](db['ChatInteraction'][_0xd6f0('0x41')],function(_0xe5fd11){return{'name':_0xe5fd11['fieldName'],'type':_0xe5fd11['type'][_0xd6f0('0x42')]};});_0x268772['model']=_[_0xd6f0('0x40')](_0x1bcb36,_0xd6f0('0x43'));_0x268772[_0xd6f0('0x44')]=_['keys'](_0x909f20[_0xd6f0('0x44')]);_0x268772[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x268772[_0xd6f0('0x47')],_0x268772[_0xd6f0('0x44')]);_0x55e93b['attributes']=_[_0xd6f0('0x46')](_0x268772['model'],qs[_0xd6f0('0x48')](_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x48')]));_0x55e93b[_0xd6f0('0x49')]=_0x55e93b['attributes']['length']?_0x55e93b[_0xd6f0('0x49')]:_0x268772[_0xd6f0('0x47')];if(!_0x909f20['query'][_0xd6f0('0x4a')]('nolimit')){_0x55e93b[_0xd6f0('0x25')]=qs[_0xd6f0('0x25')](_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x25')]);_0x55e93b[_0xd6f0('0x23')]=qs['offset'](_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x23')]);}_0x55e93b[_0xd6f0('0x4b')]=qs[_0xd6f0('0x4c')](_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x4c')]);_0x55e93b[_0xd6f0('0x4d')]=qs[_0xd6f0('0x45')](_['pick'](_0x909f20[_0xd6f0('0x44')],_0x268772[_0xd6f0('0x45')]),_0x1bcb36);var _0x469e92=[];var _0x29509e=squel[_0xd6f0('0x4e')]()[_0xd6f0('0x4f')]('id')[_0xd6f0('0x4f')](_0xd6f0('0x43'))[_0xd6f0('0x4f')]('color')[_0xd6f0('0x50')]('tools_tags');var _0x5505fd=squel[_0xd6f0('0x4e')]()['field']('u.id')[_0xd6f0('0x4f')](_0xd6f0('0x51'))[_0xd6f0('0x4f')]('ui.ChatInteractionId')[_0xd6f0('0x50')](_0xd6f0('0x52'),'ui')[_0xd6f0('0x53')]('users','u',_0xd6f0('0x54'));var _0x357193=squel['select']()[_0xd6f0('0x50')](_0xd6f0('0x55'),'i')['left_join'](_0xd6f0('0x56'),'c',_0xd6f0('0x57'))[_0xd6f0('0x53')](_0xd6f0('0x58'),'o',_0xd6f0('0x59'))['left_join'](_0xd6f0('0x5a'),'a',_0xd6f0('0x5b'))['left_join'](_0xd6f0('0x5c'),'me',_0xd6f0('0x5d'))[_0xd6f0('0x53')]('chat_interaction_has_tags','it',_0xd6f0('0x5e'))['left_join']('tools_tags','t','t.id\x20=\x20it.TagId');var _0x5c5aa4=squel[_0xd6f0('0x5f')]();var _0x2876a6=[];var _0x1a8984=squel[_0xd6f0('0x5f')]();var _0x530bcc;if(_0x909f20[_0xd6f0('0x44')]['search']){_0x530bcc=as[_0xd6f0('0x60')](_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x61')]);var _0x50d93a=_0x530bcc[_0xd6f0('0x62')];for(var _0x31b055=0x0;_0x31b055<_0x530bcc[_0xd6f0('0x63')][_0xd6f0('0x64')];_0x31b055++){var _0x5ce01c=_0x530bcc[_0xd6f0('0x63')][_0x31b055];var _0xf673bb='i';var _0x30ae43=_['find'](_0x1bcb36,[_0xd6f0('0x43'),_0x5ce01c[_0xd6f0('0x4f')]]);if(!_0x30ae43){switch(_0x5ce01c[_0xd6f0('0x4f')]){case _0xd6f0('0x65'):if(_0x5ce01c['value']==0x1){_0x357193[_0xd6f0('0x66')]('`'+_0x5ce01c[_0xd6f0('0x4f')]+_0xd6f0('0x67'));}else{_0x357193[_0xd6f0('0x66')]('`'+_0x5ce01c['field']+'`\x20>\x200');}break;case'Contact':if(_0x5ce01c['operator']===_0xd6f0('0x68')){if(_0x5ce01c[_0xd6f0('0x69')][_0xd6f0('0x6a')]('\x20')[_0xd6f0('0x64')]>0x1){_0x5c5aa4[_0x50d93a](_0xd6f0('0x6b'),qs[_0xd6f0('0x6c')](_0x5ce01c[_0xd6f0('0x69')]),null);}else{var _0x1b298a='%'+_0x5ce01c[_0xd6f0('0x69')]+'%';_0x5c5aa4[_0x50d93a]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1b298a,_0x1b298a,_0x1b298a);}}else{_0x30ae43=_['find'](_0x1bcb36,[_0xd6f0('0x43'),'ContactId']);_0x5ce01c[_0xd6f0('0x4f')]=_0xd6f0('0x6d');_0x1dc77c=as[_0xd6f0('0x6e')](_0xf673bb,_0x30ae43[_0xd6f0('0x6f')],_0x5ce01c);_0x5c5aa4[_0x50d93a](_0x1dc77c[_0xd6f0('0x70')],_0x1dc77c[_0xd6f0('0x69')][_0xd6f0('0x71')],_0x1dc77c['value'][_0xd6f0('0x2c')]);}break;case _0xd6f0('0x72'):var _0x40cdae=_0x5ce01c['value'][_0xd6f0('0x6a')](',')[_0xd6f0('0x40')](function(_0x4f3dd9){return Number(_0x4f3dd9);});_0x40cdae[_0xd6f0('0x37')](function(_0x80f21c){_0x1a8984['or'](_0xd6f0('0x73'),'%,'+_0x80f21c+',%');});_0x2876a6=_[_0xd6f0('0x74')](_0x2876a6,_0x40cdae);break;case _0xd6f0('0x75'):if(_0x5ce01c[_0xd6f0('0x76')]===_0xd6f0('0x68')){_0x5c5aa4[_0x50d93a](_0xd6f0('0x77'),'%'+_0x5ce01c[_0xd6f0('0x69')]+'%',null);}else{_0x30ae43=_['find'](_0x1bcb36,[_0xd6f0('0x43'),_0xd6f0('0x3e')]);_0x5ce01c[_0xd6f0('0x4f')]=_0xd6f0('0x3e');_0x1dc77c=as['buildExpression'](_0xf673bb,_0x30ae43[_0xd6f0('0x6f')],_0x5ce01c);_0x5c5aa4[_0x50d93a](_0x1dc77c[_0xd6f0('0x70')],_0x1dc77c[_0xd6f0('0x69')][_0xd6f0('0x71')],_0x1dc77c[_0xd6f0('0x69')][_0xd6f0('0x2c')]);}break;case _0xd6f0('0x30'):_0x1dc77c=as[_0xd6f0('0x6e')]('me',null,_0x5ce01c);_0x5c5aa4[_0x50d93a](_0x1dc77c[_0xd6f0('0x70')],_0x1dc77c[_0xd6f0('0x69')]['start'],_0x1dc77c[_0xd6f0('0x69')][_0xd6f0('0x2c')]);break;}}else{var _0x1dc77c=as['buildExpression'](_0xf673bb,_0x30ae43[_0xd6f0('0x6f')],_0x5ce01c);_0x5c5aa4[_0x50d93a](_0x1dc77c[_0xd6f0('0x70')],_0x1dc77c[_0xd6f0('0x69')][_0xd6f0('0x71')],_0x1dc77c[_0xd6f0('0x69')][_0xd6f0('0x2c')]);}}}else{var _0x1c7f08=_(_0x909f20[_0xd6f0('0x44')])[_0xd6f0('0x78')]()[_0xd6f0('0x40')](function(_0x27ad68){return _['some'](_0x1bcb36,['name',_0x27ad68])?_0x27ad68:undefined;})[_0xd6f0('0x79')]()[_0xd6f0('0x69')]();if(!_[_0xd6f0('0x7a')](_0x1c7f08)){_0x1c7f08[_0xd6f0('0x37')](function(_0x1da442){if(_0x1da442==='ChatWebsiteId'){_0x357193[_0xd6f0('0x4d')](_0xd6f0('0x7b'),[]['concat'](_0x909f20[_0xd6f0('0x44')][_0x1da442]));}else if(_0x1da442==='createdAt'){var _0x458f66=JSON[_0xd6f0('0x7c')](_0x909f20[_0xd6f0('0x44')][_0x1da442])[_0xd6f0('0x7d')];var _0x391c2a=JSON['parse'](_0x909f20['query'][_0x1da442])[_0xd6f0('0x7e')];_0x357193[_0xd6f0('0x4d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x458f66,_0x391c2a);}else{if(_0x909f20[_0xd6f0('0x44')][_0x1da442]==='null'){_0x357193['where']('i.'+_0x1da442+_0xd6f0('0x7f'));}else{_0x357193['where']('i.'+_0x1da442+'\x20=\x20?',_0x909f20['query'][_0x1da442]);}}});}if(_0x909f20['query'][_0xd6f0('0x80')]){if(_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x80')]==0x1){_0x357193[_0xd6f0('0x66')](_0xd6f0('0x81'));}else{_0x357193[_0xd6f0('0x66')](_0xd6f0('0x82'));}}if(_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x83')]){_0x2876a6=_['isArray'](_0x909f20[_0xd6f0('0x44')]['tag'])?_0x909f20['query'][_0xd6f0('0x83')]:new Array(_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x83')]);_0x2876a6['forEach'](function(_0x12e166){_0x1a8984['or'](_0xd6f0('0x73'),'%,'+_0x12e166+',%');});}if(_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x84')]){var _0x41e738=_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x84')][_0xd6f0('0x85')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xd6f0('0x86')](_0x41e738)){_0x5c5aa4['or'](_0xd6f0('0x87'),_0x41e738+'%');}else{_0x5c5aa4['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd6f0('0x6c')](_0x41e738))['or'](_0xd6f0('0x88'),_0x41e738+'%');}}}_0x357193[_0xd6f0('0x4d')](_0x5c5aa4);_0x357193[_0xd6f0('0x89')](_0xd6f0('0x8a'));var _0x96fc03={'type':db[_0xd6f0('0x8b')]['QueryTypes'][_0xd6f0('0x8c')],'raw':!![]};var _0x24c31d=_0x357193[_0xd6f0('0x8d')]();_0x24c31d['field']('i.id');_0x24c31d['field'](_0xd6f0('0x8e'),_0xd6f0('0x65'));if(_0x55e93b[_0xd6f0('0x4b')]){_0x55e93b[_0xd6f0('0x4b')][_0xd6f0('0x37')](function(_0x48d87d){var _0x4b5139=_0x48d87d[0x0]===_0xd6f0('0x8f')?_0x48d87d[0x0]:'i.'+_0x48d87d[0x0];_0x357193[_0xd6f0('0x4b')](_0x4b5139,_0x48d87d[0x1]===_0xd6f0('0x90')?![]:!![]);});}if(!_[_0xd6f0('0x7a')](_0x2876a6)){_0x357193['having'](_0x1a8984);_0x24c31d[_0xd6f0('0x4d')]('t.id\x20IN\x20?',_0x2876a6);}BPromise[_0xd6f0('0x91')]()['then'](function(){if(!_0x530bcc){if(_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x92')])return;_0x24c31d['where'](_0xd6f0('0x93'));_0x357193[_0xd6f0('0x4d')](_0xd6f0('0x93'));return;}if(_0x909f20[_0xd6f0('0x94')][_0xd6f0('0x95')]!==_0xd6f0('0x31'))return;return _0x909f20[_0xd6f0('0x94')][_0xd6f0('0x96')]({'attributes':['id'],'raw':!![]})[_0xd6f0('0x2a')](function(_0x2c277f){if(_[_0xd6f0('0x7a')](_0x2c277f)){_0x24c31d[_0xd6f0('0x4d')](_0xd6f0('0x97'));_0x357193[_0xd6f0('0x4d')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x24c31d[_0xd6f0('0x4d')](_0xd6f0('0x7b'),_[_0xd6f0('0x40')](_0x2c277f,'id'));_0x357193[_0xd6f0('0x4d')](_0xd6f0('0x7b'),_[_0xd6f0('0x40')](_0x2c277f,'id'));}});})[_0xd6f0('0x2a')](function(){if(_0x909f20[_0xd6f0('0x94')][_0xd6f0('0x95')]===_0xd6f0('0x31')&&!_0x530bcc&&!_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x92')])return[];return db[_0xd6f0('0x98')][_0xd6f0('0x44')](_0x24c31d['toString'](),_0x96fc03);})['then'](function(_0x2638c3){_0x39ca69[_0xd6f0('0x26')]=_0x2638c3[_0xd6f0('0x64')];if(_0x39ca69[_0xd6f0('0x26')]===0x0)return[];return db[_0xd6f0('0x98')]['query'](_0x29509e[_0xd6f0('0x99')](),_0x96fc03)[_0xd6f0('0x2a')](function(_0x2d0d8a){_0x469e92=_[_0xd6f0('0x9a')](_0x2d0d8a,'id');_0x96fc03=_['merge'](_0x96fc03,{'model':db[_0xd6f0('0x9b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x909f20[_0xd6f0('0x44')][_0xd6f0('0x48')]){_0x55e93b[_0xd6f0('0x49')][_0xd6f0('0x37')](function(_0x229631){_0x357193['field']('i.'+_0x229631);});}else{_0x357193['field'](_0xd6f0('0x8e'),'unreadMessages');_0x357193[_0xd6f0('0x4f')]('a.key',_0xd6f0('0x9c'));_0x357193[_0xd6f0('0x4f')]('a.mandatoryDisposition',_0xd6f0('0x9d'));_0x357193['field'](_0xd6f0('0x9e'),_0xd6f0('0x8f'));_0x357193[_0xd6f0('0x4f')](_0xd6f0('0x9f'));_0x357193['field'](_0xd6f0('0xa0'),_0xd6f0('0xa1'));_0x357193[_0xd6f0('0x4f')]('c.lastName',_0xd6f0('0xa2'));_0x357193[_0xd6f0('0x4f')](_0xd6f0('0xa3'),'Contact.email');_0x357193['field'](_0xd6f0('0xa4'),_0xd6f0('0xa5'));_0x357193[_0xd6f0('0x4f')]('c.mobile',_0xd6f0('0xa6'));_0x357193[_0xd6f0('0x4f')](_0xd6f0('0xa7'),_0xd6f0('0xa8'));_0x357193[_0xd6f0('0x4f')](_0xd6f0('0xa9'),_0xd6f0('0xaa'));_0x357193['field'](_0xd6f0('0xab'),'Owner.internal');_0x357193[_0xd6f0('0x4f')](_0xd6f0('0xac'),_0xd6f0('0x35'));}if(_0x55e93b['limit'])_0x357193[_0xd6f0('0x25')](_0x55e93b['limit']);if(_0x55e93b['offset'])_0x357193[_0xd6f0('0x23')](_0x55e93b[_0xd6f0('0x23')]);return db[_0xd6f0('0x98')]['query'](_0x357193[_0xd6f0('0x99')](),_0x96fc03);})['then'](function(_0x51e28a){if(_0x51e28a[_0xd6f0('0x64')]>0x0)_0x5505fd[_0xd6f0('0x4d')](_0xd6f0('0xad'),_[_0xd6f0('0x40')](_0x51e28a,'id'));return db[_0xd6f0('0x98')][_0xd6f0('0x44')](_0x5505fd['toString'](),_0x96fc03)[_0xd6f0('0x2a')](function(_0x5b8770){var _0x1c07b8=_['groupBy'](_0x5b8770,_0xd6f0('0xae'));var _0x1dce9c=[];_0x51e28a['forEach'](function(_0x212920){_0x1dce9c[_0xd6f0('0xaf')](updateChatInteraction(_0x212920,_0x469e92,_0x1c07b8));});return BPromise[_0xd6f0('0xb0')](_0x1dce9c);});});})[_0xd6f0('0x2a')](function(_0x1fff48){_0x39ca69[_0xd6f0('0xb1')]=_0x1fff48;return _0x39ca69;})[_0xd6f0('0x2a')](respondWithFilteredResult(_0x3d42ca,_0x55e93b))[_0xd6f0('0x1f')](handleError(_0x3d42ca,null));};exports['show']=function(_0x25c9a8,_0x1a2390){var _0x529c3d={'raw':![],'where':{'id':_0x25c9a8['params']['id']}},_0x282736={};_0x282736[_0xd6f0('0x47')]=_[_0xd6f0('0x78')](db[_0xd6f0('0x9b')][_0xd6f0('0x41')]);_0x282736['query']=_['keys'](_0x25c9a8[_0xd6f0('0x44')]);_0x282736[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x282736[_0xd6f0('0x47')],_0x282736[_0xd6f0('0x44')]);_0x529c3d[_0xd6f0('0x49')]=_[_0xd6f0('0x46')](_0x282736['model'],qs[_0xd6f0('0x48')](_0x25c9a8[_0xd6f0('0x44')][_0xd6f0('0x48')]));_0x529c3d[_0xd6f0('0x49')]=_0x529c3d['attributes'][_0xd6f0('0x64')]?_0x529c3d['attributes']:_0x282736['model'];if(_0x25c9a8[_0xd6f0('0x44')]['includeAll']){_0x529c3d[_0xd6f0('0xb2')]=[{'all':!![]}];}_0x529c3d=_[_0xd6f0('0xb3')]({},_0x529c3d,_0x25c9a8[_0xd6f0('0xb4')]);return db[_0xd6f0('0x9b')][_0xd6f0('0xb5')](_0x529c3d)[_0xd6f0('0x2a')](handleEntityNotFound(_0x1a2390,null))[_0xd6f0('0x2a')](respondWithResult(_0x1a2390,null))['catch'](handleError(_0x1a2390,null));};exports[_0xd6f0('0xb6')]=function(_0x11437d,_0x410185){return db['ChatInteraction'][_0xd6f0('0xb6')](_0x11437d[_0xd6f0('0x30')],{})[_0xd6f0('0x2a')](respondWithResult(_0x410185,0xc9))[_0xd6f0('0x1f')](handleError(_0x410185,null));};exports['update']=function(_0x308306,_0x4e5bb8){if(_0x308306[_0xd6f0('0x30')]['id']){delete _0x308306['body']['id'];}return db[_0xd6f0('0x9b')][_0xd6f0('0xb5')]({'where':{'id':_0x308306[_0xd6f0('0xb7')]['id']}})[_0xd6f0('0x2a')](handleEntityNotFound(_0x4e5bb8,null))[_0xd6f0('0x2a')](saveUpdates(_0x308306[_0xd6f0('0x30')],null))[_0xd6f0('0x2a')](respondWithResult(_0x4e5bb8,null))['catch'](handleError(_0x4e5bb8,null));};exports['destroy']=function(_0x12d982,_0x574ca9){return db[_0xd6f0('0x9b')][_0xd6f0('0xb5')]({'where':{'id':_0x12d982[_0xd6f0('0xb7')]['id']}})[_0xd6f0('0x2a')](handleEntityNotFound(_0x574ca9,null))[_0xd6f0('0x2a')](removeEntity(_0x574ca9,null))[_0xd6f0('0x1f')](handleError(_0x574ca9,null));};exports[_0xd6f0('0xb8')]=function(_0x83b80a,_0xb726d0){return db[_0xd6f0('0x9b')][_0xd6f0('0xb8')]()['then'](respondWithResult(_0xb726d0,null))[_0xd6f0('0x1f')](handleError(_0xb726d0,null));};exports['createVidaooSession']=function(_0x28d7e9,_0x210946){var _0x4ed3f0=_0x28d7e9[_0xd6f0('0xb7')]['id'];var _0x5b85c3;var _0x3704e6;var _0xcc9d50;return db[_0xd6f0('0x9b')][_0xd6f0('0xb9')]({'where':{'id':_0x4ed3f0}})[_0xd6f0('0x2a')](function(_0x3b4c53){_0x5b85c3=_0x3b4c53;return db[_0xd6f0('0xba')]['findOne']({'where':{'id':_0x3b4c53[_0xd6f0('0x92')]},'attributes':['id',_0xd6f0('0xbb'),'vidaooEscalation',_0xd6f0('0xbc'),'vidaooNote','vidaooMetadata'],'raw':!![]});})['then'](function(_0x461f29){if(_0x461f29&&_0x461f29[_0xd6f0('0xbb')]&&_0x461f29['vidaooEscalation']){_0x3704e6=_0x461f29;var _0x18e364={'interaction':{'id':_0x4ed3f0},'agent':{'id':_0x28d7e9[_0xd6f0('0x94')]['id'],'name':_0x28d7e9[_0xd6f0('0x94')][_0xd6f0('0x43')],'fullname':_0x28d7e9[_0xd6f0('0x94')][_0xd6f0('0xbd')],'email':_0x28d7e9[_0xd6f0('0x94')][_0xd6f0('0xbe')]},'contact':_0x28d7e9['body'][_0xd6f0('0xbf')],'account':_0x28d7e9[_0xd6f0('0x30')]['account']};var _0x360ec0={'rejectUnauthorized':![],'method':'POST','url':_0xd6f0('0xc0'),'headers':{'X-APIKEY':_0x461f29[_0xd6f0('0xbb')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x28d7e9[_0xd6f0('0x94')][_0xd6f0('0xbe')]],'buttons':null,'topic':_0x3704e6['vidaooTopic'],'note':_[_0xd6f0('0xc1')](_0x3704e6['vidaooNote'])?null:getMustacheRender(_0x3704e6['vidaooNote'],_0x18e364),'metadata':null},'redirect':_0xd6f0('0xc2'),'json':!![]};try{if(!_[_0xd6f0('0xc1')](_0x3704e6[_0xd6f0('0xc3')])){var _0x5ede6b=getMustacheRender(_0x3704e6[_0xd6f0('0xc3')],_0x18e364);var _0x45283d=JSON[_0xd6f0('0x7c')](_0x5ede6b);_0x360ec0[_0xd6f0('0x30')][_0xd6f0('0xc4')]=_0x45283d;}}catch(_0x5cbab7){throw new db[(_0xd6f0('0x8b'))][(_0xd6f0('0xc5'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x360ec0);}else{throw new db[(_0xd6f0('0x8b'))]['ValidationError'](_0xd6f0('0xc6'));}})[_0xd6f0('0x2a')](function(_0x46f385){_0xcc9d50=_0x46f385;if(_0xcc9d50['id']){var _0x30f693={'body':_0xcc9d50[_0xd6f0('0xc7')],'ChatWebsiteId':_0x3704e6['id'],'ChatInteractionId':_0x5b85c3['id'],'direction':_0xd6f0('0xc8'),'UserId':_0x28d7e9[_0xd6f0('0x94')]['id']};return db['ChatMessage']['create'](_0x30f693,{});}else{throw new db[(_0xd6f0('0x8b'))]['ValidationError'](_0xd6f0('0xc9'));}})[_0xd6f0('0x2a')](function(){return _0x5b85c3[_0xd6f0('0xca')]({'vidaooSessionId':_0xcc9d50['id']});})['then'](respondWithResult(_0x210946,null))[_0xd6f0('0x1f')](handleError(_0x210946,null));};exports['customUpdate']=function(_0x39f781,_0x2e2fc5){if(_0x39f781['body']['id']){delete _0x39f781[_0xd6f0('0x30')]['id'];}return db[_0xd6f0('0x9b')]['find']({'where':{'id':_0x39f781['params']['id']},'include':[{'model':db['CmContact'],'as':_0xd6f0('0xcb')}]})[_0xd6f0('0x2a')](handleEntityNotFound(_0x2e2fc5,null))[_0xd6f0('0x2a')](saveUpdates(_0x39f781[_0xd6f0('0x30')],null))[_0xd6f0('0x2a')](respondWithResult(_0x2e2fc5,null))['catch'](handleError(_0x2e2fc5,null));};exports[_0xd6f0('0xcc')]=function(_0xf4ecc,_0x1e908d){if(_0xf4ecc[_0xd6f0('0x30')]['id']){delete _0xf4ecc[_0xd6f0('0x30')]['id'];}return db[_0xd6f0('0x9b')][_0xd6f0('0xb5')]({'where':{'id':_0xf4ecc[_0xd6f0('0xb7')]['id']}})[_0xd6f0('0x2a')](function(_0x62d0ef){if(!_0x62d0ef){logger[_0xd6f0('0x1b')](_0xd6f0('0xcd'),_0xd6f0('0xcc'),0x194,_0xd6f0('0xce'));_0x1e908d['sendStatus'](0x194);}else{if(_0x62d0ef['UserId']){throw new db[(_0xd6f0('0x8b'))][(_0xd6f0('0xc5'))]('Interaction\x20already\x20assigned');}}return _0x62d0ef;})[_0xd6f0('0x2a')](function(_0x2f7e8f){if(_0x2f7e8f){return _0x2f7e8f[_0xd6f0('0x29')]({'closed':_0xf4ecc[_0xd6f0('0x30')][_0xd6f0('0x3d')],'disposition':_0xf4ecc[_0xd6f0('0x30')][_0xd6f0('0x3f')]})['then'](function(_0x2879b5){return _0x2879b5;});}})[_0xd6f0('0x2a')](function(){return respondWithRpcPromise(_0xd6f0('0xcf'),_0xd6f0('0xcc'),_0xf4ecc['body'],client9004);})[_0xd6f0('0x2a')](respondWithResult(_0x1e908d,null))[_0xd6f0('0x1f')](handleError(_0x1e908d,null));};exports[_0xd6f0('0xd0')]=function(_0x516f59,_0x178d6b){_0x516f59['body'][_0xd6f0('0x43')]=_0x516f59[_0xd6f0('0xd1')][_0xd6f0('0xd2')];_0x516f59[_0xd6f0('0x30')][_0xd6f0('0xd3')]=_0x516f59[_0xd6f0('0xd1')][_0xd6f0('0xd4')];_0x516f59[_0xd6f0('0x30')][_0xd6f0('0x6f')]=_0x516f59[_0xd6f0('0xd1')][_0xd6f0('0xd5')];return db[_0xd6f0('0xd6')][_0xd6f0('0xb6')](_0x516f59[_0xd6f0('0x30')])[_0xd6f0('0x2a')](respondWithResult(_0x178d6b,0xc9))[_0xd6f0('0x1f')](handleError(_0x178d6b,null));};exports['attachmentDownload']=function(_0x198eec,_0x3d1d95){return db[_0xd6f0('0x9b')][_0xd6f0('0xb9')]({'where':{'id':_0x198eec['params']['id']},'raw':!![]})[_0xd6f0('0x2a')](handleEntityNotFound(_0x3d1d95,null))['then'](function(_0x5a8d88){if(_0x5a8d88){if(_0x5a8d88[_0xd6f0('0x3d')]){return _0x3d1d95['status'](0x193)[_0xd6f0('0x22')]({'status':0x193,'message':_0xd6f0('0xd7')});}return db[_0xd6f0('0xd6')]['findOne']({'where':{'id':_0x198eec[_0xd6f0('0x44')]['attachId']},'raw':!![]})[_0xd6f0('0x2a')](handleEntityNotFound(_0x3d1d95,null));}})[_0xd6f0('0x2a')](function(_0xe4e7f9){if(_0xe4e7f9){var _0x51bf52=_0xe4e7f9[_0xd6f0('0xd8')]!==null;var _0x33f54e=path[_0xd6f0('0xd9')](config[_0xd6f0('0xda')],_0xd6f0('0xdb'));if(_0x51bf52){_0x33f54e=path[_0xd6f0('0xd9')](_0x33f54e,'offline-chat/');}var _0x17c5b6=path[_0xd6f0('0xd9')](_0x33f54e,_0xe4e7f9[_0xd6f0('0xd3')]);return _0x3d1d95[_0xd6f0('0xdc')](_0x17c5b6);}})['catch'](handleError(_0x3d1d95,null));};exports[_0xd6f0('0xdd')]=function(_0x55fb13,_0x2e5f31){var _0x59d38a=null;var _0x5db326=null;var _0x2df291=null;if(_0x55fb13[_0xd6f0('0x30')]['id']){delete _0x55fb13[_0xd6f0('0x30')]['id'];}if(_0x55fb13['body'][_0xd6f0('0xde')]){_0x2df291=path['join'](config[_0xd6f0('0xda')],_0xd6f0('0xdf'),util[_0xd6f0('0xe0')](_0xd6f0('0xe1'),Date[_0xd6f0('0xe2')]()));_0x55fb13[_0xd6f0('0x30')][_0xd6f0('0xe3')]=_0x2df291;}return db[_0xd6f0('0x9b')][_0xd6f0('0xb5')]({'where':{'id':_0x55fb13[_0xd6f0('0xb7')]['id']},'include':[{'model':db[_0xd6f0('0xe4')],'as':_0xd6f0('0xe5'),'include':[{'model':db['User'],'as':'User'}]}]})[_0xd6f0('0x2a')](handleEntityNotFound(_0x2e5f31,null))[_0xd6f0('0x2a')](saveUpdates(_0x55fb13[_0xd6f0('0x30')],null))[_0xd6f0('0x2a')](function(_0x5ae946){if(_0x5ae946){_0x59d38a=_0x5ae946;return db[_0xd6f0('0xba')]['find']({'where':{'id':_0x59d38a[_0xd6f0('0x92')]}});}})[_0xd6f0('0x2a')](function(_0x3f32e6){if(_0x3f32e6){_0x5db326=_0x3f32e6;return db[_0xd6f0('0xe6')][_0xd6f0('0xb5')]({'where':{'id':_0x59d38a['ContactId']}});}})[_0xd6f0('0x2a')](function(_0x174f35){if(_0x174f35){if(_0x2df291){var _0x4c3b1d=null;for(var _0x88b850=0x1;_0x88b850<_0x59d38a[_0xd6f0('0xe5')][_0xd6f0('0x64')];++_0x88b850){_0x4c3b1d=_0x59d38a[_0xd6f0('0xe5')][_0x88b850];var _0x55bb74=_0x4c3b1d['UserId']?util[_0xd6f0('0xe0')](_0xd6f0('0xe7'),_0x5db326[_0xd6f0('0xe8')],_0x4c3b1d[_0xd6f0('0x3e')]):_0xd6f0('0xe9');var _0x3eb403=_0x55fb13[_0xd6f0('0x30')][_0xd6f0('0xea')]||util['format'](_0xd6f0('0xe7'),_0xd6f0('0xeb'),_0x4c3b1d[_0xd6f0('0x6d')]);switch(_0x5db326[_0xd6f0('0xec')]){case _0xd6f0('0xed'):_0x55bb74=_0x4c3b1d[_0xd6f0('0x3e')]?util[_0xd6f0('0xe0')](_0xd6f0('0xe7'),_0x5db326[_0xd6f0('0xe8')],_0x4c3b1d[_0xd6f0('0x3e')]):_0xd6f0('0xe9');break;case'agent_alias':_0x55bb74=_0x4c3b1d['UserId']?_0x4c3b1d[_0xd6f0('0x75')]['alias']||_0x4c3b1d[_0xd6f0('0x75')][_0xd6f0('0xbd')]:_0xd6f0('0xe9');break;case _0xd6f0('0xee'):_0x55bb74=_0x4c3b1d[_0xd6f0('0x3e')]?_0x4c3b1d[_0xd6f0('0x75')][_0xd6f0('0xbd')]:'System';break;default:_0x55bb74=_0x4c3b1d[_0xd6f0('0x3e')]?util[_0xd6f0('0xe0')](_0xd6f0('0xe7'),_0x5db326['agentAlias'],_0x4c3b1d['UserId']):_0xd6f0('0xe9');}var _0x156d8c=util[_0xd6f0('0xe0')](_0xd6f0('0xef'),moment(_0x4c3b1d['createdAt'])[_0xd6f0('0xe0')](_0xd6f0('0xf0')),_0x4c3b1d['direction']==='in'?_0x3eb403:_0x55bb74,_0x4c3b1d[_0xd6f0('0x30')]);if(!_0x4c3b1d[_0xd6f0('0xf1')]){fs[_0xd6f0('0xf2')](_0x2df291,_0x156d8c);}}return db[_0xd6f0('0xf3')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xd6f0('0xf4')],'as':_0xd6f0('0xf5'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}}})[_0xd6f0('0x2a')](function(_0x24800d){if(!_0x24800d||!_0x24800d[_0xd6f0('0xf5')]||!_0x55fb13[_0xd6f0('0x30')])return _0x59d38a;var _0x1acefc=_0x24800d[_0xd6f0('0xf6')]();return respondWithRpcPromise(_0xd6f0('0xf7'),_0xd6f0('0xf8'),{'account':_0x1acefc,'message':{'from':util[_0xd6f0('0xe0')](_0xd6f0('0xf9'),_0x24800d['name'],_0x24800d[_0xd6f0('0xbe')]||_0x24800d[_0xd6f0('0xf5')][_0xd6f0('0x94')]),'to':_0x55fb13[_0xd6f0('0x30')][_0xd6f0('0xde')],'subject':_0xd6f0('0xfa'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x55fb13[_0xd6f0('0x30')][_0xd6f0('0xde')]),'attachments':[{'path':_0x2df291}]}})[_0xd6f0('0x2a')](function(){return _0x59d38a;})[_0xd6f0('0x1f')](function(_0x53d6fd){logger[_0xd6f0('0x1b')](_0x53d6fd);});})[_0xd6f0('0x2a')](respondWithStatusCode(_0x2e5f31,0xc8))[_0xd6f0('0x1f')](handleError(_0x2e5f31,null));};exports[_0xd6f0('0xfb')]=function(_0x3ce855,_0x56fbcb){return db[_0xd6f0('0xe4')][_0xd6f0('0xb5')]({'where':{'id':_0x3ce855['params']['id']}})[_0xd6f0('0x2a')](handleEntityNotFound(_0x56fbcb,null))[_0xd6f0('0x2a')](function(_0x4ae09a){if(_0x4ae09a){return _0x4ae09a[_0xd6f0('0xfb')](_0x3ce855[_0xd6f0('0x30')][_0xd6f0('0xfc')],_[_0xd6f0('0xfd')](_0x3ce855[_0xd6f0('0x30')],[_0xd6f0('0xfc'),'id'])||{});}})[_0xd6f0('0x2a')](respondWithResult(_0x56fbcb,null))[_0xd6f0('0x1f')](handleError(_0x56fbcb,null));};exports[_0xd6f0('0xfe')]=function(_0x430b18,_0x22ec51){var _0x578789={'raw':![],'where':{}};var _0xdd080f={};var _0x4a1165={'count':0x0,'rows':[]};return db[_0xd6f0('0x9b')][_0xd6f0('0xb9')]({'where':{'id':_0x430b18[_0xd6f0('0xb7')]['id']}})['then'](handleEntityNotFound(_0x22ec51,null))[_0xd6f0('0x2a')](function(_0x2e64be){if(_0x2e64be){_0xdd080f[_0xd6f0('0x47')]=_[_0xd6f0('0x78')](db[_0xd6f0('0xe4')]['rawAttributes']);_0xdd080f['query']=_[_0xd6f0('0x78')](_0x430b18[_0xd6f0('0x44')]);_0xdd080f[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0xdd080f[_0xd6f0('0x47')],_0xdd080f[_0xd6f0('0x44')]);_0x578789[_0xd6f0('0x49')]=_[_0xd6f0('0x46')](_0xdd080f['model'],qs['fields'](_0x430b18['query'][_0xd6f0('0x48')]));_0x578789['attributes']=_0x578789[_0xd6f0('0x49')][_0xd6f0('0x64')]?_0x578789[_0xd6f0('0x49')]:_0xdd080f[_0xd6f0('0x47')];if(!_0x430b18[_0xd6f0('0x44')][_0xd6f0('0x4a')](_0xd6f0('0xff'))){_0x578789[_0xd6f0('0x25')]=qs[_0xd6f0('0x25')](_0x430b18[_0xd6f0('0x44')]['limit']);_0x578789[_0xd6f0('0x23')]=qs['offset'](_0x430b18[_0xd6f0('0x44')][_0xd6f0('0x23')]);}_0x578789['order']=qs[_0xd6f0('0x4c')](_0x430b18[_0xd6f0('0x44')][_0xd6f0('0x4c')]);_0x578789[_0xd6f0('0x4d')]=qs[_0xd6f0('0x45')](_['pick'](_0x430b18['query'],_0xdd080f['filters']));_0x578789['where'][_0xd6f0('0xae')]=_0x2e64be['id'];if(_0x430b18['query'][_0xd6f0('0x84')]){_0x578789[_0xd6f0('0x4d')]=_[_0xd6f0('0xb3')](_0x578789[_0xd6f0('0x4d')],{'$or':_[_0xd6f0('0x40')](_0x578789[_0xd6f0('0x49')],function(_0x55f274){var _0x1d461f={};_0x1d461f[_0x55f274]={'$like':'%'+_0x430b18[_0xd6f0('0x44')][_0xd6f0('0x84')]+'%'};return _0x1d461f;})});}if(_0x430b18[_0xd6f0('0x44')][_0xd6f0('0x7d')]){var _0x32af02=_0x430b18['query']['$gte'][_0xd6f0('0x6a')](',');var _0x69694c={};_0x69694c[_0x32af02[0x0]]={'$gte':moment(_0x32af02[0x1])['format'](_0xd6f0('0x100'))};_0x578789[_0xd6f0('0x4d')]=_['merge'](_0x578789[_0xd6f0('0x4d')],_0x69694c);}_0x578789=_[_0xd6f0('0xb3')]({},_0x578789,_0x430b18[_0xd6f0('0xb4')]);return db['ChatMessage'][_0xd6f0('0x26')]({'where':_0x578789[_0xd6f0('0x4d')]})[_0xd6f0('0x2a')](function(_0x2d6902){_0x4a1165[_0xd6f0('0x26')]=_0x2d6902;if(_0x430b18['query'][_0xd6f0('0x101')]){_0x578789[_0xd6f0('0xb2')]=[{'all':!![]}];}return db[_0xd6f0('0xe4')][_0xd6f0('0x102')](_0x578789);})[_0xd6f0('0x2a')](function(_0x2ace80){_0x4a1165[_0xd6f0('0xb1')]=_0x2ace80;return _0x4a1165;});}})[_0xd6f0('0x2a')](respondWithFilteredResult(_0x22ec51,_0x578789))[_0xd6f0('0x1f')](handleError(_0x22ec51,null));};exports[_0xd6f0('0x103')]=function(_0x46dedb,_0x5887ab){var _0x240207={'where':{}},_0x3a32b3={},_0x55c3da={'count':0x0,'rows':[]};return db[_0xd6f0('0x9b')]['findOne']({'where':{'id':_0x46dedb[_0xd6f0('0xb7')]['id']}})[_0xd6f0('0x2a')](handleEntityNotFound(_0x5887ab,null))['then'](function(_0x2c9e1a){if(_0x2c9e1a){_0x3a32b3['model']=_[_0xd6f0('0x78')](db['ChatMessage'][_0xd6f0('0x41')]);_0x3a32b3[_0xd6f0('0x44')]=_['keys'](_0x46dedb['query']);_0x3a32b3[_0xd6f0('0x45')]=_[_0xd6f0('0x46')](_0x3a32b3[_0xd6f0('0x47')],_0x3a32b3['query']);_0x240207[_0xd6f0('0x49')]=_[_0xd6f0('0x46')](_0x3a32b3[_0xd6f0('0x47')],qs[_0xd6f0('0x48')](_0x46dedb[_0xd6f0('0x44')]['fields']));_0x240207[_0xd6f0('0x49')]=_0x240207[_0xd6f0('0x49')][_0xd6f0('0x64')]?_0x240207[_0xd6f0('0x49')]:_0x3a32b3[_0xd6f0('0x47')];if(!_0x46dedb[_0xd6f0('0x44')][_0xd6f0('0x4a')]('nolimit')){_0x240207[_0xd6f0('0x25')]=qs[_0xd6f0('0x25')](_0x46dedb['query'][_0xd6f0('0x25')]);_0x240207[_0xd6f0('0x23')]=qs['offset'](_0x46dedb[_0xd6f0('0x44')][_0xd6f0('0x23')]);}_0x240207[_0xd6f0('0x4b')]=qs[_0xd6f0('0x4c')](_0x46dedb[_0xd6f0('0x44')][_0xd6f0('0x4c')]);_0x240207[_0xd6f0('0x4d')]=qs[_0xd6f0('0x45')](_['pick'](_0x46dedb[_0xd6f0('0x44')],_0x3a32b3[_0xd6f0('0x45')]));_0x240207['where'][_0xd6f0('0xae')]=_0x2c9e1a['id'];if(_0x46dedb['query'][_0xd6f0('0x84')]){_0x240207[_0xd6f0('0x4d')]=_[_0xd6f0('0xb3')](_0x240207[_0xd6f0('0x4d')],{'$or':_[_0xd6f0('0x40')](_0x240207[_0xd6f0('0x49')],function(_0x44cead){var _0x5e1062={};_0x5e1062[_0x44cead]={'$like':'%'+_0x46dedb[_0xd6f0('0x44')][_0xd6f0('0x84')]+'%'};return _0x5e1062;})});}_0x240207[_0xd6f0('0x4d')][_0xd6f0('0xf1')]=![];if(_0x46dedb[_0xd6f0('0x44')]['id']){_0x240207['where']['id']={'$gt':_0x46dedb[_0xd6f0('0x44')]['id']};}_0x240207=_['merge']({},_0x240207,_0x46dedb[_0xd6f0('0xb4')]);return db['ChatMessage'][_0xd6f0('0x26')]({'where':_0x240207[_0xd6f0('0x4d')]})['then'](function(_0x27887e){_0x55c3da['count']=_0x27887e;_0x240207['include']=[];if(_0x46dedb[_0xd6f0('0x44')][_0xd6f0('0x104')]){_0x240207[_0xd6f0('0xb2')][_0xd6f0('0xaf')]({'model':db[_0xd6f0('0x75')],'as':_0xd6f0('0x75'),'attributes':['id',_0xd6f0('0xbd'),_0xd6f0('0x105')]});}if(_0x46dedb[_0xd6f0('0x44')][_0xd6f0('0x101')]){_0x240207[_0xd6f0('0xb2')]=[{'all':!![]}];}return db[_0xd6f0('0xe4')][_0xd6f0('0x102')](_0x240207);})[_0xd6f0('0x2a')](function(_0x2ea0c4){_0x55c3da['rows']=_0x2ea0c4;return _0x55c3da;});}})[_0xd6f0('0x2a')](respondWithFilteredResult(_0x5887ab,_0x240207))[_0xd6f0('0x1f')](handleError(_0x5887ab,null));};exports['addTags']=function(_0x2e9eca,_0x1814a9){return db[_0xd6f0('0x9b')][_0xd6f0('0xb5')]({'where':{'id':_0x2e9eca[_0xd6f0('0xb7')]['id']}})[_0xd6f0('0x2a')](handleEntityNotFound(_0x1814a9,null))[_0xd6f0('0x2a')](function(_0x54f0f0){if(_0x54f0f0){return _0x54f0f0[_0xd6f0('0x106')](_0x2e9eca[_0xd6f0('0x30')][_0xd6f0('0xfc')],_[_0xd6f0('0xfd')](_0x2e9eca[_0xd6f0('0x30')],['ids','id'])||{})[_0xd6f0('0x107')](function(){return db[_0xd6f0('0x72')][_0xd6f0('0x102')]({'attributes':['id','name',_0xd6f0('0x108')],'where':{'id':_0x2e9eca[_0xd6f0('0x30')][_0xd6f0('0xfc')]}});})[_0xd6f0('0x2a')](function(_0x486a3e){socket[_0xd6f0('0x109')](_0xd6f0('0x10a'),{'id':Number(_0x2e9eca[_0xd6f0('0xb7')]['id']),'tags':_0x486a3e||[]});return{'id':Number(_0x2e9eca[_0xd6f0('0xb7')]['id']),'tags':_0x486a3e||[]};});}})[_0xd6f0('0x2a')](respondWithResult(_0x1814a9,null))[_0xd6f0('0x1f')](handleError(_0x1814a9,null));};exports[_0xd6f0('0x10b')]=function(_0x1033e1,_0x3d1c1e){return db[_0xd6f0('0x9b')]['find']({'where':{'id':_0x1033e1['params']['id']}})[_0xd6f0('0x2a')](handleEntityNotFound(_0x3d1c1e,null))[_0xd6f0('0x2a')](function(_0x547615){if(_0x547615){return _0x547615[_0xd6f0('0x10b')](_0x1033e1[_0xd6f0('0x44')][_0xd6f0('0xfc')]);}})[_0xd6f0('0x2a')](respondWithStatusCode(_0x3d1c1e,null))[_0xd6f0('0x1f')](handleError(_0x3d1c1e,null));};exports[_0xd6f0('0xdc')]=function(_0x920605,_0x280343){var _0xdeebce=moment()[_0xd6f0('0x10c')]()[_0xd6f0('0x99')]();var _0x2ac49c=path['join'](config[_0xd6f0('0xda')],_0xd6f0('0x10d'),'files',_0xd6f0('0x10e'));var _0x5327b3=path[_0xd6f0('0xd9')](config[_0xd6f0('0xda')],_0xd6f0('0x10d'),'files',_0xd6f0('0x10f'));var _0x245c62=path[_0xd6f0('0xd9')](_0x2ac49c,_0xdeebce);var _0x1a4ad0=util['format'](_0xd6f0('0x110'),_0x920605[_0xd6f0('0xb7')]['id'],_0xdeebce);var _0x4e7e89=path[_0xd6f0('0xd9')](_0x2ac49c,_0x1a4ad0);var _0x1151d0=[];_0x1151d0[_0xd6f0('0xaf')]({'model':db[_0xd6f0('0x75')],'as':'User','attributes':['id',_0xd6f0('0xbd')],'raw':!![]});_0x1151d0[_0xd6f0('0xaf')]({'model':db['CmContact'],'as':_0xd6f0('0xcb'),'attributes':['id',_0xd6f0('0x111'),'lastName'],'raw':!![]});if(_0x920605[_0xd6f0('0x44')][_0xd6f0('0x10f')]){_0x1151d0[_0xd6f0('0xaf')]({'model':db[_0xd6f0('0xd6')],'as':_0xd6f0('0xd6'),'raw':!![]});}var _0x46ee50=[{'model':db[_0xd6f0('0xe4')],'as':_0xd6f0('0xe5'),'attributes':['id',_0xd6f0('0x30'),_0xd6f0('0x112'),_0xd6f0('0x113'),'secret',_0xd6f0('0x80')],'include':_0x1151d0}];_0x46ee50['push']({'model':db[_0xd6f0('0xba')],'as':_0xd6f0('0x114'),'attributes':['id',_0xd6f0('0x43')]});_0x46ee50[_0xd6f0('0xaf')]({'model':db['User'],'as':'Owner','attributes':['id',_0xd6f0('0xbd')]});return db['ChatInteraction'][_0xd6f0('0xb5')]({'where':{'id':_0x920605[_0xd6f0('0xb7')]['id']},'include':_0x46ee50})[_0xd6f0('0x2a')](handleEntityNotFound(_0x280343,null))['then'](function(_0x519500){if(_0x519500){var _0x1fce58=_0x519500['get']({'plain':!![]});fs[_0xd6f0('0x115')](_0x245c62);var _0x3e89c2={'channel':_0xd6f0('0x116'),'account':_0x1fce58[_0xd6f0('0x114')][_0xd6f0('0x43')],'agent':_0x1fce58[_0xd6f0('0x117')]?_0x1fce58['Owner'][_0xd6f0('0xbd')]:_0xd6f0('0x118'),'createdAt':moment(_0x1fce58['createdAt'])[_0xd6f0('0xe0')](_0xd6f0('0x100'))[_0xd6f0('0x99')](),'closedAt':_0x1fce58[_0xd6f0('0x3d')]?moment(_0x1fce58[_0xd6f0('0x119')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xd6f0('0x99')]():'','disposition':_0x1fce58['disposition'],'chatInfo':{'browser':_0x1fce58[_0xd6f0('0x11a')],'os':_0x1fce58[_0xd6f0('0x11b')],'referer':_0x1fce58[_0xd6f0('0x11c')],'customerIp':_0x1fce58['customerIp'],'customerPort':_0x1fce58['customerPort']?_0x1fce58[_0xd6f0('0x11d')]:_0xd6f0('0x118')},'messages':_(_0x1fce58[_0xd6f0('0xe5')])[_0xd6f0('0x11e')]()['filter']({'secret':![]})[_0xd6f0('0x40')](function(_0x37107f){if(_0x37107f['Attachment']){var _0x318972=path[_0xd6f0('0xd9')](_0x5327b3,_0x37107f[_0xd6f0('0xd6')][_0xd6f0('0xd3')]);if(fs[_0xd6f0('0x11f')](_0x318972)){fs['createReadStream'](_0x318972)['pipe'](fs[_0xd6f0('0x120')](path[_0xd6f0('0xd9')](_0x245c62,_0x37107f['Attachment'][_0xd6f0('0xd3')])));}}return{'date':moment(_0x37107f[_0xd6f0('0x112')])[_0xd6f0('0xe0')](_0xd6f0('0x100'))[_0xd6f0('0x99')](),'sender':_0x37107f[_0xd6f0('0x113')]===_0xd6f0('0xc8')?_0x37107f[_0xd6f0('0x75')]?_0x37107f[_0xd6f0('0x75')][_0xd6f0('0xbd')]:_0xd6f0('0xe9'):_0x37107f['Contact']['firstName']+(_0x37107f[_0xd6f0('0xcb')]['lastName']?'\x20'+_0x37107f[_0xd6f0('0xcb')][_0xd6f0('0x121')]:''),'body':_0x37107f[_0xd6f0('0xd6')]?_0x37107f['Attachment']['basename']:_0x37107f['body'],'direction':_0x37107f[_0xd6f0('0x113')]===_0xd6f0('0xc8')?'A':'C','secret':_0x37107f['secret'],'read':_0x37107f['read'],'attachment':_0x37107f[_0xd6f0('0xd6')]};})[_0xd6f0('0x69')]()};return ejs[_0xd6f0('0x122')](path['join'](config['root'],_0xd6f0('0x10d'),_0xd6f0('0x123'),_0xd6f0('0x124')),{'interaction':_0x3e89c2})['then'](function(_0xa4ae76){var _0x1478ce=path['join'](_0x245c62,_0xd6f0('0x125')+_0x1fce58['id']+'-'+_0xdeebce+_0xd6f0('0x126'));var _0x264d69={'path':_0x1478ce,'channel':_0xd6f0('0x116'),'interactionId':_0x1fce58['id']};return pdf[_0xd6f0('0x127')](_0xa4ae76,_0x264d69);})[_0xd6f0('0x2a')](function(){return new Promise(function(_0x300b64,_0x16ef7b){zipdir(_0x245c62,{'saveTo':_0x4e7e89},function(_0x526978,_0x552cd5){if(_0x526978)return _0x16ef7b(_0x526978);return _0x300b64(_0x552cd5);});})[_0xd6f0('0x2a')](function(){return new BPromise(function(_0x5e505d,_0x5d0e6e){rimraf(_0x245c62,function(_0x44e0ca){if(_0x44e0ca)_0x5d0e6e(_0x44e0ca);return _0x5e505d();});});})[_0xd6f0('0x2a')](function(){return _0x280343[_0xd6f0('0xdc')](_0x4e7e89,_0x1a4ad0,function(_0x4fc550){if(_0x4fc550){logger['error']('err',_0x4fc550);}else{fs[_0xd6f0('0x128')](_0x4e7e89);}});});});}else{return _0x280343[_0xd6f0('0x20')](0xc8);}})[_0xd6f0('0x1f')](handleError(_0x280343,null));}; \ No newline at end of file +var _0xe5b3=['closedAt','browserName','osName','referer','customerIp','existsSync','createWriteStream','out','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','unlinkSync','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','then','end','stack','name','send','render','merge','body','contact','interaction','account','Users','map','fullname','TagIds','split','forEach','Tags','push','waiting','answered','unmanaged','abandoned','total','closed','UserId','talking','disposition','index','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','field','from','tools_tags','select','ui.ChatInteractionId','user_has_chat_interactions','left_join','chat_interactions','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','buildExpression','type','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','some','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','parse','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','ChatInteraction','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','params','includeAll','include','create','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','attachmentUpload','originalname','basename','filename','mimetype','attachmentDownload','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','download','close','mailTranscript','root','server/files/chat/upload/','transcript-%s.txt','Messages','ChatWebsite','CmContact','ContactId','format','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','createdAt','secret','appendFileSync','MailAccount','Smtp','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','addMessage','ids','omit','$gte','YYYY-MM-DD\x20HH:mm:ss','options','findAll','includeAgent','addTags','spread','color','removeTags','unix','tmp','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','direction','Account','Owner','mkdirSync','Chat'];(function(_0x3f1478,_0xb54c58){var _0x5b84f2=function(_0x11d08f){while(--_0x11d08f){_0x3f1478['push'](_0x3f1478['shift']());}};_0x5b84f2(++_0xb54c58);}(_0xe5b3,0x133));var _0x3e5b=function(_0x5bc65c,_0x292169){_0x5bc65c=_0x5bc65c-0x0;var _0x4c9971=_0xe5b3[_0x5bc65c];return _0x4c9971;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x3e5b('0x0'));var rp=require(_0x3e5b('0x1'));var moment=require(_0x3e5b('0x2'));var BPromise=require(_0x3e5b('0x3'));var Mustache=require(_0x3e5b('0x4'));var util=require(_0x3e5b('0x5'));var path=require(_0x3e5b('0x6'));var ejs=require(_0x3e5b('0x7'));var fs=require('fs');var _=require(_0x3e5b('0x8'));var squel=require(_0x3e5b('0x9'));var Redis=require(_0x3e5b('0xa'));var qs=require('../../components/parsers/qs');var as=require(_0x3e5b('0xb'));var pdf=require(_0x3e5b('0xc'));var logger=require('../../config/logger')(_0x3e5b('0xd'));var config=require(_0x3e5b('0xe'));var db=require(_0x3e5b('0xf'))['db'];config[_0x3e5b('0x10')]=_['defaults'](config['redis'],{'host':_0x3e5b('0x11'),'port':0x18eb});var socket=require(_0x3e5b('0x12'))(new Redis(config[_0x3e5b('0x10')]));require(_0x3e5b('0x13'))[_0x3e5b('0x14')](socket);var jayson=require('jayson/promise');var client=jayson[_0x3e5b('0x15')]['http']({'port':0x232b});var client9004=jayson[_0x3e5b('0x15')][_0x3e5b('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x4d69dd,_0x374068,_0x20b97b,_0x3c4eb1){return new BPromise(function(_0x405e70,_0x560010){var _0x39a2a1=_0x3c4eb1||client;return _0x39a2a1['request'](_0x4d69dd,_0x20b97b)['then'](function(_0x4d71a3){logger[_0x3e5b('0x17')](_0x3e5b('0x18'),_0x374068,_0x3e5b('0x19'));logger['debug'](_0x3e5b('0x1a'),_0x374068,'request\x20sent',JSON['stringify'](_0x4d71a3));if(_0x4d71a3[_0x3e5b('0x1b')]){if(_0x4d71a3[_0x3e5b('0x1b')]['code']===0x1f4){logger[_0x3e5b('0x1b')](_0x3e5b('0x18'),_0x374068,_0x4d71a3['error'][_0x3e5b('0x1c')]);return _0x560010(_0x4d71a3[_0x3e5b('0x1b')]['message']);}logger['error'](_0x3e5b('0x18'),_0x374068,_0x4d71a3[_0x3e5b('0x1b')][_0x3e5b('0x1c')]);return _0x405e70(_0x4d71a3[_0x3e5b('0x1b')][_0x3e5b('0x1c')]);}else{logger[_0x3e5b('0x17')](_0x3e5b('0x18'),_0x374068,_0x3e5b('0x19'));_0x405e70(_0x4d71a3[_0x3e5b('0x1d')][_0x3e5b('0x1c')]);}})[_0x3e5b('0x1e')](function(_0x11e5cf){logger[_0x3e5b('0x1b')](_0x3e5b('0x18'),_0x374068,_0x11e5cf);_0x560010(_0x11e5cf);});});}function respondWithStatusCode(_0x5b46d4,_0x433f9c){_0x433f9c=_0x433f9c||0xcc;return function(_0x86f19c){if(_0x86f19c){return _0x5b46d4[_0x3e5b('0x1f')](_0x433f9c);}return _0x5b46d4[_0x3e5b('0x20')](_0x433f9c)['end']();};}function respondWithResult(_0x1eb80f,_0x5b33bb){_0x5b33bb=_0x5b33bb||0xc8;return function(_0x2f9e42){if(_0x2f9e42){return _0x1eb80f[_0x3e5b('0x20')](_0x5b33bb)['json'](_0x2f9e42);}};}function respondWithFilteredResult(_0x41b684,_0x2f6368){return function(_0x42d7e9){if(_0x42d7e9){var _0x3c8965=typeof _0x2f6368[_0x3e5b('0x21')]===_0x3e5b('0x22')&&typeof _0x2f6368[_0x3e5b('0x23')]===_0x3e5b('0x22');var _0x4c4b89=_0x42d7e9[_0x3e5b('0x24')];var _0x505f40=_0x3c8965?0x0:_0x2f6368[_0x3e5b('0x21')];var _0x4fd64b=_0x3c8965?_0x42d7e9[_0x3e5b('0x24')]:_0x2f6368[_0x3e5b('0x21')]+_0x2f6368[_0x3e5b('0x23')];var _0x475b39;if(_0x4fd64b>=_0x4c4b89){_0x4fd64b=_0x4c4b89;_0x475b39=0xc8;}else{_0x475b39=0xce;}_0x41b684[_0x3e5b('0x20')](_0x475b39);return _0x41b684[_0x3e5b('0x25')](_0x3e5b('0x26'),_0x505f40+'-'+_0x4fd64b+'/'+_0x4c4b89)[_0x3e5b('0x27')](_0x42d7e9);}return null;};}function saveUpdates(_0x221718){return function(_0x112dc0){if(_0x112dc0){return _0x112dc0[_0x3e5b('0x28')](_0x221718)['then'](function(_0x21bc10){return _0x21bc10;});}return null;};}function removeEntity(_0x1882aa){return function(_0xa8760b){if(_0xa8760b){return _0xa8760b[_0x3e5b('0x29')]()[_0x3e5b('0x2a')](function(){_0x1882aa[_0x3e5b('0x20')](0xcc)[_0x3e5b('0x2b')]();});}};}function handleEntityNotFound(_0x4c4e01){return function(_0x33f089){if(!_0x33f089){_0x4c4e01['sendStatus'](0x194);}return _0x33f089;};}function handleError(_0x5b9ba3,_0x32c6b0){_0x32c6b0=_0x32c6b0||0x1f4;return function(_0x78d68a){logger['error'](_0x78d68a[_0x3e5b('0x2c')]);if(_0x78d68a[_0x3e5b('0x2d')]){delete _0x78d68a[_0x3e5b('0x2d')];}_0x5b9ba3[_0x3e5b('0x20')](_0x32c6b0)[_0x3e5b('0x2e')](_0x78d68a);};}function getMustacheRender(_0x26f842,_0x3b3046){return Mustache[_0x3e5b('0x2f')](_0x26f842,_[_0x3e5b('0x30')](_0x3b3046[_0x3e5b('0x31')],{'contact':_0x3b3046[_0x3e5b('0x32')],'message':_0x3b3046[_0x3e5b('0x1c')],'agent':_0x3b3046['agent'],'interaction':_0x3b3046[_0x3e5b('0x33')],'account':_0x3b3046[_0x3e5b('0x34')]}))||'';}function getInteractionUsers(_0x53caa2,_0x4edf59){return new BPromise(function(_0x471196,_0x56d7ef){try{if(_0x4edf59[_0x53caa2['id']]){_0x53caa2[_0x3e5b('0x35')]=_[_0x3e5b('0x36')](_0x4edf59[_0x53caa2['id']],function(_0xb2349c){return{'id':_0xb2349c['id'],'fullname':_0xb2349c[_0x3e5b('0x37')]};});}}catch(_0x5389e3){_0x56d7ef(_0x5389e3);}_0x471196(_0x53caa2);});}function getInteractionTags(_0x18b07f,_0x4cdcb1){return new BPromise(function(_0x42b970,_0x5ec841){try{if(_0x18b07f['TagIds']){_0x18b07f['Tags']=[];_0x18b07f[_0x3e5b('0x38')][_0x3e5b('0x39')](',')[_0x3e5b('0x3a')](function(_0x35cfcd){_0x18b07f[_0x3e5b('0x3b')][_0x3e5b('0x3c')](_0x4cdcb1[_0x35cfcd]);});}delete _0x18b07f['TagIds'];}catch(_0x5d0c59){_0x5ec841(_0x5d0c59);}_0x42b970(_0x18b07f);});}function updateChatInteraction(_0x5ee6dc,_0x565319,_0x5f0271){return new BPromise(function(_0x47ea59,_0x5aad1d){return getInteractionUsers(_0x5ee6dc,_0x5f0271)[_0x3e5b('0x2a')](function(_0x349de0){return getInteractionTags(_0x349de0,_0x565319);})[_0x3e5b('0x2a')](function(_0x1aafd5){return getStateInteraction(_0x1aafd5);})[_0x3e5b('0x2a')](function(_0x2506a6){_0x47ea59(_0x2506a6);})[_0x3e5b('0x1e')](function(_0x423be2){_0x5aad1d(_0x423be2);});});}function getStateInteraction(_0x222d0f){return new BPromise(function(_0xbbc6b){_0x222d0f[_0x3e5b('0x3d')]=0x0;_0x222d0f['talking']=0x0;_0x222d0f[_0x3e5b('0x3e')]=0x0;_0x222d0f[_0x3e5b('0x3f')]=0x0;_0x222d0f[_0x3e5b('0x40')]=0x0;_0x222d0f[_0x3e5b('0x41')]=0x0;if(!_0x222d0f[_0x3e5b('0x42')]&&!_0x222d0f[_0x3e5b('0x43')]){_0x222d0f[_0x3e5b('0x3d')]+=0x1;}if(!_0x222d0f[_0x3e5b('0x42')]&&_0x222d0f[_0x3e5b('0x43')]){_0x222d0f[_0x3e5b('0x44')]+=0x1;if(_0x222d0f[_0x3e5b('0x3d')]){_0x222d0f['waiting']-=0x1;}}if(_0x222d0f['closed']&&_0x222d0f['disposition']==='abandoned'){_0x222d0f[_0x3e5b('0x40')]+=0x1;if(_0x222d0f[_0x3e5b('0x3d')]){_0x222d0f[_0x3e5b('0x3d')]-=0x1;}}else if(_0x222d0f[_0x3e5b('0x42')]&&!_0x222d0f[_0x3e5b('0x43')]&&_0x222d0f[_0x3e5b('0x45')]){_0x222d0f[_0x3e5b('0x3f')]+=0x1;if(_0x222d0f[_0x3e5b('0x3d')]){_0x222d0f[_0x3e5b('0x3d')]-=0x1;}}else if(_0x222d0f[_0x3e5b('0x42')]&&_0x222d0f['UserId']){_0x222d0f[_0x3e5b('0x3e')]+=0x1;if(_0x222d0f[_0x3e5b('0x44')]){_0x222d0f[_0x3e5b('0x44')]-=0x1;}}_0x222d0f[_0x3e5b('0x41')]+=0x1;_0xbbc6b(_0x222d0f);});}exports[_0x3e5b('0x46')]=function(_0x4f0c2c,_0x588ee7){var _0x495217={},_0x1fbd87={},_0x20af6a={'count':0x0,'rows':[]};var _0x3b2319=_['map'](db['ChatInteraction'][_0x3e5b('0x47')],function(_0x313c51){return{'name':_0x313c51[_0x3e5b('0x48')],'type':_0x313c51['type']['key']};});_0x1fbd87[_0x3e5b('0x49')]=_['map'](_0x3b2319,_0x3e5b('0x2d'));_0x1fbd87[_0x3e5b('0x4a')]=_[_0x3e5b('0x4b')](_0x4f0c2c[_0x3e5b('0x4a')]);_0x1fbd87[_0x3e5b('0x4c')]=_[_0x3e5b('0x4d')](_0x1fbd87[_0x3e5b('0x49')],_0x1fbd87[_0x3e5b('0x4a')]);_0x495217[_0x3e5b('0x4e')]=_['intersection'](_0x1fbd87[_0x3e5b('0x49')],qs['fields'](_0x4f0c2c[_0x3e5b('0x4a')][_0x3e5b('0x4f')]));_0x495217[_0x3e5b('0x4e')]=_0x495217[_0x3e5b('0x4e')][_0x3e5b('0x50')]?_0x495217[_0x3e5b('0x4e')]:_0x1fbd87[_0x3e5b('0x49')];if(!_0x4f0c2c[_0x3e5b('0x4a')][_0x3e5b('0x51')](_0x3e5b('0x52'))){_0x495217[_0x3e5b('0x23')]=qs[_0x3e5b('0x23')](_0x4f0c2c[_0x3e5b('0x4a')]['limit']);_0x495217[_0x3e5b('0x21')]=qs[_0x3e5b('0x21')](_0x4f0c2c[_0x3e5b('0x4a')][_0x3e5b('0x21')]);}_0x495217[_0x3e5b('0x53')]=qs[_0x3e5b('0x54')](_0x4f0c2c['query'][_0x3e5b('0x54')]);_0x495217[_0x3e5b('0x55')]=qs[_0x3e5b('0x4c')](_[_0x3e5b('0x56')](_0x4f0c2c[_0x3e5b('0x4a')],_0x1fbd87[_0x3e5b('0x4c')]),_0x3b2319);var _0x216600=[];var _0x437430=squel['select']()[_0x3e5b('0x57')]('id')['field']('name')[_0x3e5b('0x57')]('color')[_0x3e5b('0x58')](_0x3e5b('0x59'));var _0xf52ebd=squel[_0x3e5b('0x5a')]()['field']('u.id')['field']('u.fullname')[_0x3e5b('0x57')](_0x3e5b('0x5b'))[_0x3e5b('0x58')](_0x3e5b('0x5c'),'ui')[_0x3e5b('0x5d')]('users','u','u.id\x20=\x20ui.UserId');var _0xa0a18d=squel[_0x3e5b('0x5a')]()[_0x3e5b('0x58')](_0x3e5b('0x5e'),'i')[_0x3e5b('0x5d')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0x3e5b('0x5f'))[_0x3e5b('0x5d')](_0x3e5b('0x60'),'a',_0x3e5b('0x61'))[_0x3e5b('0x5d')](_0x3e5b('0x62'),'me',_0x3e5b('0x63'))[_0x3e5b('0x5d')]('chat_interaction_has_tags','it',_0x3e5b('0x64'))[_0x3e5b('0x5d')](_0x3e5b('0x59'),'t',_0x3e5b('0x65'));var _0x2d2c1e=squel['expr']();var _0xd45159=[];var _0x57ac70=squel[_0x3e5b('0x66')]();var _0x1fd40c;if(_0x4f0c2c['query']['search']){_0x1fd40c=as['parseSearch'](_0x4f0c2c[_0x3e5b('0x4a')]['search']);var _0x1ab942=_0x1fd40c[_0x3e5b('0x67')];for(var _0x1af190=0x0;_0x1af190<_0x1fd40c[_0x3e5b('0x68')][_0x3e5b('0x50')];_0x1af190++){var _0x4de129=_0x1fd40c['conditions'][_0x1af190];var _0x226f61='i';var _0x13bc3b=_[_0x3e5b('0x69')](_0x3b2319,['name',_0x4de129[_0x3e5b('0x57')]]);if(!_0x13bc3b){switch(_0x4de129[_0x3e5b('0x57')]){case _0x3e5b('0x6a'):if(_0x4de129[_0x3e5b('0x6b')]==0x1){_0xa0a18d[_0x3e5b('0x6c')]('`'+_0x4de129[_0x3e5b('0x57')]+_0x3e5b('0x6d'));}else{_0xa0a18d[_0x3e5b('0x6c')]('`'+_0x4de129[_0x3e5b('0x57')]+_0x3e5b('0x6e'));}break;case _0x3e5b('0x6f'):if(_0x4de129[_0x3e5b('0x70')]===_0x3e5b('0x71')){if(_0x4de129[_0x3e5b('0x6b')][_0x3e5b('0x39')]('\x20')[_0x3e5b('0x50')]>0x1){_0x2d2c1e[_0x1ab942](_0x3e5b('0x72'),qs[_0x3e5b('0x73')](_0x4de129['value']),null);}else{var _0xe5d4c5='%'+_0x4de129[_0x3e5b('0x6b')]+'%';_0x2d2c1e[_0x1ab942]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xe5d4c5,_0xe5d4c5,_0xe5d4c5);}}else{_0x13bc3b=_[_0x3e5b('0x69')](_0x3b2319,[_0x3e5b('0x2d'),'ContactId']);_0x4de129['field']='ContactId';_0x8d164e=as[_0x3e5b('0x74')](_0x226f61,_0x13bc3b[_0x3e5b('0x75')],_0x4de129);_0x2d2c1e[_0x1ab942](_0x8d164e['text'],_0x8d164e[_0x3e5b('0x6b')][_0x3e5b('0x76')],_0x8d164e['value'][_0x3e5b('0x2b')]);}break;case _0x3e5b('0x77'):var _0x43f28f=_0x4de129[_0x3e5b('0x6b')][_0x3e5b('0x39')](',')[_0x3e5b('0x36')](function(_0x5891fe){return Number(_0x5891fe);});_0x43f28f[_0x3e5b('0x3a')](function(_0x3f2c6c){_0x57ac70['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3f2c6c+',%');});_0xd45159=_[_0x3e5b('0x78')](_0xd45159,_0x43f28f);break;case _0x3e5b('0x79'):if(_0x4de129[_0x3e5b('0x70')]===_0x3e5b('0x71')){_0x2d2c1e[_0x1ab942](_0x3e5b('0x7a'),'%'+_0x4de129[_0x3e5b('0x6b')]+'%',null);}else{_0x13bc3b=_[_0x3e5b('0x69')](_0x3b2319,['name','UserId']);_0x4de129[_0x3e5b('0x57')]=_0x3e5b('0x43');_0x8d164e=as['buildExpression'](_0x226f61,_0x13bc3b[_0x3e5b('0x75')],_0x4de129);_0x2d2c1e[_0x1ab942](_0x8d164e[_0x3e5b('0x7b')],_0x8d164e[_0x3e5b('0x6b')][_0x3e5b('0x76')],_0x8d164e[_0x3e5b('0x6b')][_0x3e5b('0x2b')]);}break;case _0x3e5b('0x31'):_0x8d164e=as['buildExpression']('me',null,_0x4de129);_0x2d2c1e[_0x1ab942](_0x8d164e[_0x3e5b('0x7b')],_0x8d164e[_0x3e5b('0x6b')]['start'],_0x8d164e['value']['end']);break;}}else{var _0x8d164e=as[_0x3e5b('0x74')](_0x226f61,_0x13bc3b[_0x3e5b('0x75')],_0x4de129);_0x2d2c1e[_0x1ab942](_0x8d164e[_0x3e5b('0x7b')],_0x8d164e[_0x3e5b('0x6b')][_0x3e5b('0x76')],_0x8d164e['value'][_0x3e5b('0x2b')]);}}}else{var _0x48e1c=_(_0x4f0c2c['query'])[_0x3e5b('0x4b')]()['map'](function(_0x4f62fb){return _[_0x3e5b('0x7c')](_0x3b2319,[_0x3e5b('0x2d'),_0x4f62fb])?_0x4f62fb:undefined;})['compact']()[_0x3e5b('0x6b')]();if(!_[_0x3e5b('0x7d')](_0x48e1c)){_0x48e1c['forEach'](function(_0x2e36af){if(_0x2e36af===_0x3e5b('0x7e')){_0xa0a18d[_0x3e5b('0x55')](_0x3e5b('0x7f'),[][_0x3e5b('0x80')](_0x4f0c2c[_0x3e5b('0x4a')][_0x2e36af]));}else if(_0x2e36af==='createdAt'){var _0x4fc232=JSON[_0x3e5b('0x81')](_0x4f0c2c['query'][_0x2e36af])['$gte'];var _0x25d3d8=JSON[_0x3e5b('0x81')](_0x4f0c2c[_0x3e5b('0x4a')][_0x2e36af])['$lte'];_0xa0a18d[_0x3e5b('0x55')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4fc232,_0x25d3d8);}else{if(_0x4f0c2c[_0x3e5b('0x4a')][_0x2e36af]==='null'){_0xa0a18d[_0x3e5b('0x55')]('i.'+_0x2e36af+_0x3e5b('0x82'));}else{_0xa0a18d[_0x3e5b('0x55')]('i.'+_0x2e36af+_0x3e5b('0x83'),_0x4f0c2c['query'][_0x2e36af]);}}});}if(_0x4f0c2c[_0x3e5b('0x4a')]['read']){if(_0x4f0c2c[_0x3e5b('0x4a')][_0x3e5b('0x84')]==0x1){_0xa0a18d['having'](_0x3e5b('0x85'));}else{_0xa0a18d[_0x3e5b('0x6c')](_0x3e5b('0x86'));}}if(_0x4f0c2c['query'][_0x3e5b('0x87')]){_0xd45159=_[_0x3e5b('0x88')](_0x4f0c2c[_0x3e5b('0x4a')]['tag'])?_0x4f0c2c[_0x3e5b('0x4a')][_0x3e5b('0x87')]:new Array(_0x4f0c2c['query'][_0x3e5b('0x87')]);_0xd45159[_0x3e5b('0x3a')](function(_0x1ddf2d){_0x57ac70['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1ddf2d+',%');});}if(_0x4f0c2c[_0x3e5b('0x4a')][_0x3e5b('0x89')]){var _0x352f7e=_0x4f0c2c[_0x3e5b('0x4a')]['filter'][_0x3e5b('0x8a')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x3e5b('0x8b')](_0x352f7e)){_0x2d2c1e['or']('i.id\x20LIKE\x20?',_0x352f7e+'%');}else{_0x2d2c1e['or'](_0x3e5b('0x8c'),qs[_0x3e5b('0x73')](_0x352f7e))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x352f7e+'%');}}}_0xa0a18d[_0x3e5b('0x55')](_0x2d2c1e);_0xa0a18d[_0x3e5b('0x8d')]('i.id');var _0x1f734a={'type':db[_0x3e5b('0x8e')][_0x3e5b('0x8f')][_0x3e5b('0x90')],'raw':!![]};var _0x53aa30=_0xa0a18d['clone']();_0x53aa30[_0x3e5b('0x57')](_0x3e5b('0x91'));_0x53aa30[_0x3e5b('0x57')](_0x3e5b('0x92'),_0x3e5b('0x6a'));if(_0x495217[_0x3e5b('0x53')]){_0x495217['order']['forEach'](function(_0x19e93f){var _0x203279=_0x19e93f[0x0]===_0x3e5b('0x93')?_0x19e93f[0x0]:'i.'+_0x19e93f[0x0];_0xa0a18d[_0x3e5b('0x53')](_0x203279,_0x19e93f[0x1]===_0x3e5b('0x94')?![]:!![]);});}if(!_[_0x3e5b('0x7d')](_0xd45159)){_0xa0a18d[_0x3e5b('0x6c')](_0x57ac70);_0x53aa30[_0x3e5b('0x55')]('t.id\x20IN\x20?',_0xd45159);}BPromise['resolve']()[_0x3e5b('0x2a')](function(){if(!_0x1fd40c){if(_0x4f0c2c['query'][_0x3e5b('0x7e')])return;_0x53aa30[_0x3e5b('0x55')](_0x3e5b('0x95'));_0xa0a18d[_0x3e5b('0x55')](_0x3e5b('0x95'));return;}if(_0x4f0c2c[_0x3e5b('0x96')][_0x3e5b('0x97')]!==_0x3e5b('0x98'))return;return _0x4f0c2c[_0x3e5b('0x96')][_0x3e5b('0x99')]({'attributes':['id'],'raw':!![]})[_0x3e5b('0x2a')](function(_0x199fa4){if(_[_0x3e5b('0x7d')](_0x199fa4)){_0x53aa30['where']('i.ChatWebsiteId\x20IS\x20NULL');_0xa0a18d[_0x3e5b('0x55')](_0x3e5b('0x9a'));}else{_0x53aa30[_0x3e5b('0x55')](_0x3e5b('0x7f'),_['map'](_0x199fa4,'id'));_0xa0a18d[_0x3e5b('0x55')]('i.ChatWebsiteId\x20IN\x20?',_[_0x3e5b('0x36')](_0x199fa4,'id'));}});})['then'](function(){if(_0x4f0c2c[_0x3e5b('0x96')][_0x3e5b('0x97')]===_0x3e5b('0x98')&&!_0x1fd40c&&!_0x4f0c2c[_0x3e5b('0x4a')][_0x3e5b('0x7e')])return[];return db[_0x3e5b('0x9b')][_0x3e5b('0x4a')](_0x53aa30[_0x3e5b('0x9c')](),_0x1f734a);})[_0x3e5b('0x2a')](function(_0x5198f9){_0x20af6a[_0x3e5b('0x24')]=_0x5198f9[_0x3e5b('0x50')];if(_0x20af6a['count']===0x0)return[];return db[_0x3e5b('0x9b')][_0x3e5b('0x4a')](_0x437430[_0x3e5b('0x9c')](),_0x1f734a)[_0x3e5b('0x2a')](function(_0x41de83){_0x216600=_[_0x3e5b('0x9d')](_0x41de83,'id');_0x1f734a=_[_0x3e5b('0x30')](_0x1f734a,{'model':db[_0x3e5b('0x9e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4f0c2c[_0x3e5b('0x4a')][_0x3e5b('0x4f')]){_0x495217[_0x3e5b('0x4e')][_0x3e5b('0x3a')](function(_0x499287){_0xa0a18d[_0x3e5b('0x57')]('i.'+_0x499287);});}else{_0xa0a18d[_0x3e5b('0x57')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0xa0a18d[_0x3e5b('0x57')](_0x3e5b('0x9f'),_0x3e5b('0xa0'));_0xa0a18d[_0x3e5b('0x57')](_0x3e5b('0xa1'),'Account.mandatoryDisposition');_0xa0a18d[_0x3e5b('0x57')](_0x3e5b('0xa2'),'contactName');_0xa0a18d['field'](_0x3e5b('0xa3'));_0xa0a18d[_0x3e5b('0x57')]('c.firstName','Contact.firstName');_0xa0a18d[_0x3e5b('0x57')](_0x3e5b('0xa4'),'Contact.lastName');_0xa0a18d[_0x3e5b('0x57')](_0x3e5b('0xa5'),_0x3e5b('0xa6'));_0xa0a18d[_0x3e5b('0x57')](_0x3e5b('0xa7'),'Contact.phone');_0xa0a18d['field'](_0x3e5b('0xa8'),_0x3e5b('0xa9'));_0xa0a18d[_0x3e5b('0x57')](_0x3e5b('0xaa'),_0x3e5b('0xab'));_0xa0a18d[_0x3e5b('0x57')](_0x3e5b('0xac'),_0x3e5b('0xad'));_0xa0a18d[_0x3e5b('0x57')](_0x3e5b('0xae'),_0x3e5b('0xaf'));_0xa0a18d[_0x3e5b('0x57')](_0x3e5b('0xb0'),_0x3e5b('0x38'));}if(_0x495217[_0x3e5b('0x23')])_0xa0a18d[_0x3e5b('0x23')](_0x495217[_0x3e5b('0x23')]);if(_0x495217[_0x3e5b('0x21')])_0xa0a18d[_0x3e5b('0x21')](_0x495217[_0x3e5b('0x21')]);return db[_0x3e5b('0x9b')][_0x3e5b('0x4a')](_0xa0a18d[_0x3e5b('0x9c')](),_0x1f734a);})[_0x3e5b('0x2a')](function(_0x408070){if(_0x408070['length']>0x0)_0xf52ebd['where'](_0x3e5b('0xb1'),_[_0x3e5b('0x36')](_0x408070,'id'));return db[_0x3e5b('0x9b')][_0x3e5b('0x4a')](_0xf52ebd['toString'](),_0x1f734a)[_0x3e5b('0x2a')](function(_0x494adc){var _0x1f1062=_[_0x3e5b('0xb2')](_0x494adc,_0x3e5b('0xb3'));var _0x2c08fd=[];_0x408070[_0x3e5b('0x3a')](function(_0x4e49ae){_0x2c08fd[_0x3e5b('0x3c')](updateChatInteraction(_0x4e49ae,_0x216600,_0x1f1062));});return BPromise[_0x3e5b('0xb4')](_0x2c08fd);});});})[_0x3e5b('0x2a')](function(_0x2cedeb){_0x20af6a[_0x3e5b('0xb5')]=_0x2cedeb;return _0x20af6a;})[_0x3e5b('0x2a')](respondWithFilteredResult(_0x588ee7,_0x495217))['catch'](handleError(_0x588ee7,null));};exports['show']=function(_0x3687e0,_0x48ac2f){var _0x54b166={'raw':![],'where':{'id':_0x3687e0[_0x3e5b('0xb6')]['id']}},_0x2cf2f2={};_0x2cf2f2[_0x3e5b('0x49')]=_['keys'](db['ChatInteraction'][_0x3e5b('0x47')]);_0x2cf2f2[_0x3e5b('0x4a')]=_[_0x3e5b('0x4b')](_0x3687e0[_0x3e5b('0x4a')]);_0x2cf2f2[_0x3e5b('0x4c')]=_[_0x3e5b('0x4d')](_0x2cf2f2['model'],_0x2cf2f2['query']);_0x54b166[_0x3e5b('0x4e')]=_[_0x3e5b('0x4d')](_0x2cf2f2[_0x3e5b('0x49')],qs[_0x3e5b('0x4f')](_0x3687e0[_0x3e5b('0x4a')][_0x3e5b('0x4f')]));_0x54b166[_0x3e5b('0x4e')]=_0x54b166[_0x3e5b('0x4e')][_0x3e5b('0x50')]?_0x54b166[_0x3e5b('0x4e')]:_0x2cf2f2[_0x3e5b('0x49')];if(_0x3687e0[_0x3e5b('0x4a')][_0x3e5b('0xb7')]){_0x54b166[_0x3e5b('0xb8')]=[{'all':!![]}];}_0x54b166=_[_0x3e5b('0x30')]({},_0x54b166,_0x3687e0['options']);return db[_0x3e5b('0x9e')][_0x3e5b('0x69')](_0x54b166)[_0x3e5b('0x2a')](handleEntityNotFound(_0x48ac2f,null))[_0x3e5b('0x2a')](respondWithResult(_0x48ac2f,null))[_0x3e5b('0x1e')](handleError(_0x48ac2f,null));};exports[_0x3e5b('0xb9')]=function(_0x99f91b,_0x5456f6){return db[_0x3e5b('0x9e')][_0x3e5b('0xb9')](_0x99f91b[_0x3e5b('0x31')],{})[_0x3e5b('0x2a')](respondWithResult(_0x5456f6,0xc9))['catch'](handleError(_0x5456f6,null));};exports[_0x3e5b('0x28')]=function(_0x25caed,_0x253b17){if(_0x25caed[_0x3e5b('0x31')]['id']){delete _0x25caed[_0x3e5b('0x31')]['id'];}return db[_0x3e5b('0x9e')][_0x3e5b('0x69')]({'where':{'id':_0x25caed[_0x3e5b('0xb6')]['id']}})[_0x3e5b('0x2a')](handleEntityNotFound(_0x253b17,null))[_0x3e5b('0x2a')](saveUpdates(_0x25caed[_0x3e5b('0x31')],null))[_0x3e5b('0x2a')](respondWithResult(_0x253b17,null))['catch'](handleError(_0x253b17,null));};exports[_0x3e5b('0x29')]=function(_0x2231f2,_0x2d0e8a){return db[_0x3e5b('0x9e')][_0x3e5b('0x69')]({'where':{'id':_0x2231f2[_0x3e5b('0xb6')]['id']}})[_0x3e5b('0x2a')](handleEntityNotFound(_0x2d0e8a,null))[_0x3e5b('0x2a')](removeEntity(_0x2d0e8a,null))[_0x3e5b('0x1e')](handleError(_0x2d0e8a,null));};exports['describe']=function(_0x5df21b,_0x3b0192){return db[_0x3e5b('0x9e')][_0x3e5b('0xba')]()['then'](respondWithResult(_0x3b0192,null))[_0x3e5b('0x1e')](handleError(_0x3b0192,null));};exports[_0x3e5b('0xbb')]=function(_0x534729,_0x3f518e){var _0x36c589=_0x534729[_0x3e5b('0xb6')]['id'];var _0x30cf58;var _0x129e7c;var _0x129ba4;return db[_0x3e5b('0x9e')][_0x3e5b('0xbc')]({'where':{'id':_0x36c589}})[_0x3e5b('0x2a')](function(_0x8c2eb2){_0x30cf58=_0x8c2eb2;return db['ChatWebsite'][_0x3e5b('0xbc')]({'where':{'id':_0x8c2eb2['ChatWebsiteId']},'attributes':['id',_0x3e5b('0xbd'),_0x3e5b('0xbe'),_0x3e5b('0xbf'),_0x3e5b('0xc0'),_0x3e5b('0xc1')],'raw':!![]});})['then'](function(_0x169db3){if(_0x169db3&&_0x169db3[_0x3e5b('0xbd')]&&_0x169db3[_0x3e5b('0xbe')]){_0x129e7c=_0x169db3;var _0xe07809={'interaction':{'id':_0x36c589},'agent':{'id':_0x534729[_0x3e5b('0x96')]['id'],'name':_0x534729[_0x3e5b('0x96')][_0x3e5b('0x2d')],'fullname':_0x534729['user'][_0x3e5b('0x37')],'email':_0x534729[_0x3e5b('0x96')]['email']},'contact':_0x534729[_0x3e5b('0x31')][_0x3e5b('0x32')],'account':_0x534729['body']['account']};var _0x5da532={'rejectUnauthorized':![],'method':_0x3e5b('0xc2'),'url':_0x3e5b('0xc3'),'headers':{'X-APIKEY':_0x169db3[_0x3e5b('0xbd')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x534729['user']['email']],'buttons':null,'topic':_0x129e7c[_0x3e5b('0xbf')],'note':_[_0x3e5b('0xc4')](_0x129e7c['vidaooNote'])?null:getMustacheRender(_0x129e7c['vidaooNote'],_0xe07809),'metadata':null},'redirect':_0x3e5b('0xc5'),'json':!![]};try{if(!_[_0x3e5b('0xc4')](_0x129e7c[_0x3e5b('0xc1')])){var _0x2a86ac=getMustacheRender(_0x129e7c[_0x3e5b('0xc1')],_0xe07809);var _0x543d09=JSON[_0x3e5b('0x81')](_0x2a86ac);_0x5da532[_0x3e5b('0x31')][_0x3e5b('0xc6')]=_0x543d09;}}catch(_0x5c7523){throw new db[(_0x3e5b('0x8e'))][(_0x3e5b('0xc7'))](_0x3e5b('0xc8'));}return rp(_0x5da532);}else{throw new db['Sequelize']['ValidationError'](_0x3e5b('0xc9'));}})[_0x3e5b('0x2a')](function(_0x1d1f1c){_0x129ba4=_0x1d1f1c;if(_0x129ba4['id']){var _0x87364d={'body':_0x129ba4[_0x3e5b('0xca')],'ChatWebsiteId':_0x129e7c['id'],'ChatInteractionId':_0x30cf58['id'],'direction':'out','UserId':_0x534729[_0x3e5b('0x96')]['id']};return db[_0x3e5b('0xcb')][_0x3e5b('0xb9')](_0x87364d,{});}else{throw new db[(_0x3e5b('0x8e'))][(_0x3e5b('0xc7'))](_0x3e5b('0xcc'));}})['then'](function(){return _0x30cf58[_0x3e5b('0xcd')]({'vidaooSessionId':_0x129ba4['id']});})[_0x3e5b('0x2a')](respondWithResult(_0x3f518e,null))[_0x3e5b('0x1e')](handleError(_0x3f518e,null));};exports['customUpdate']=function(_0xad5598,_0x2dd452){if(_0xad5598[_0x3e5b('0x31')]['id']){delete _0xad5598[_0x3e5b('0x31')]['id'];}return db[_0x3e5b('0x9e')]['find']({'where':{'id':_0xad5598['params']['id']},'include':[{'model':db['CmContact'],'as':'Contact'}]})['then'](handleEntityNotFound(_0x2dd452,null))[_0x3e5b('0x2a')](saveUpdates(_0xad5598[_0x3e5b('0x31')],null))[_0x3e5b('0x2a')](respondWithResult(_0x2dd452,null))['catch'](handleError(_0x2dd452,null));};exports[_0x3e5b('0xce')]=function(_0x5548d3,_0x4b9257){if(_0x5548d3[_0x3e5b('0x31')]['id']){delete _0x5548d3[_0x3e5b('0x31')]['id'];}return db['ChatInteraction'][_0x3e5b('0x69')]({'where':{'id':_0x5548d3['params']['id']}})[_0x3e5b('0x2a')](function(_0x59d692){if(!_0x59d692){logger[_0x3e5b('0x1b')](_0x3e5b('0xcf'),_0x3e5b('0xce'),0x194,_0x3e5b('0xd0'));_0x4b9257['sendStatus'](0x194);}else{if(_0x59d692[_0x3e5b('0x43')]){throw new db[(_0x3e5b('0x8e'))][(_0x3e5b('0xc7'))](_0x3e5b('0xd1'));}}return _0x59d692;})[_0x3e5b('0x2a')](function(_0x59762c){if(_0x59762c){return _0x59762c[_0x3e5b('0x28')]({'closed':_0x5548d3[_0x3e5b('0x31')]['closed'],'disposition':_0x5548d3[_0x3e5b('0x31')]['disposition']})[_0x3e5b('0x2a')](function(_0x3436ad){return _0x3436ad;});}})[_0x3e5b('0x2a')](function(){return respondWithRpcPromise('AbandonInteraction','abandon',_0x5548d3['body'],client9004);})['then'](respondWithResult(_0x4b9257,null))[_0x3e5b('0x1e')](handleError(_0x4b9257,null));};exports[_0x3e5b('0xd2')]=function(_0x93aa1b,_0x5515d0){_0x93aa1b['body']['name']=_0x93aa1b['file'][_0x3e5b('0xd3')];_0x93aa1b[_0x3e5b('0x31')][_0x3e5b('0xd4')]=_0x93aa1b['file'][_0x3e5b('0xd5')];_0x93aa1b[_0x3e5b('0x31')][_0x3e5b('0x75')]=_0x93aa1b['file'][_0x3e5b('0xd6')];return db['Attachment'][_0x3e5b('0xb9')](_0x93aa1b['body'])[_0x3e5b('0x2a')](respondWithResult(_0x5515d0,0xc9))[_0x3e5b('0x1e')](handleError(_0x5515d0,null));};exports[_0x3e5b('0xd7')]=function(_0x414b50,_0x10fc88){return db[_0x3e5b('0x9e')][_0x3e5b('0xbc')]({'where':{'id':_0x414b50['params']['id']},'raw':!![]})[_0x3e5b('0x2a')](handleEntityNotFound(_0x10fc88,null))['then'](function(_0x259c6d){if(_0x259c6d){if(_0x259c6d['closed']){return _0x10fc88[_0x3e5b('0x20')](0x193)['json']({'status':0x193,'message':_0x3e5b('0xd8')});}return db[_0x3e5b('0xd9')][_0x3e5b('0xbc')]({'where':{'id':_0x414b50[_0x3e5b('0x4a')][_0x3e5b('0xda')]},'raw':!![]})[_0x3e5b('0x2a')](handleEntityNotFound(_0x10fc88,null));}})[_0x3e5b('0x2a')](function(_0x4a5c00){if(_0x4a5c00){var _0x48ae5b=_0x4a5c00[_0x3e5b('0xdb')]!==null;var _0xbac664=path[_0x3e5b('0xdc')](config['root'],'server/files/attachments/');if(_0x48ae5b){_0xbac664=path[_0x3e5b('0xdc')](_0xbac664,'offline-chat/');}var _0x2dc14d=path[_0x3e5b('0xdc')](_0xbac664,_0x4a5c00[_0x3e5b('0xd4')]);return _0x10fc88[_0x3e5b('0xdd')](_0x2dc14d);}})[_0x3e5b('0x1e')](handleError(_0x10fc88,null));};exports[_0x3e5b('0xde')]=function(_0x345969,_0x410b7f){var _0x2f5938=null;var _0x5cb09d=null;var _0xc09e4a=null;if(_0x345969[_0x3e5b('0x31')]['id']){delete _0x345969['body']['id'];}if(_0x345969[_0x3e5b('0x31')][_0x3e5b('0xdf')]){_0xc09e4a=path['join'](config[_0x3e5b('0xe0')],_0x3e5b('0xe1'),util['format'](_0x3e5b('0xe2'),Date['now']()));_0x345969[_0x3e5b('0x31')]['pathTranscript']=_0xc09e4a;}return db[_0x3e5b('0x9e')]['find']({'where':{'id':_0x345969[_0x3e5b('0xb6')]['id']},'include':[{'model':db[_0x3e5b('0xcb')],'as':_0x3e5b('0xe3'),'include':[{'model':db[_0x3e5b('0x79')],'as':_0x3e5b('0x79')}]}]})[_0x3e5b('0x2a')](handleEntityNotFound(_0x410b7f,null))[_0x3e5b('0x2a')](saveUpdates(_0x345969['body'],null))[_0x3e5b('0x2a')](function(_0x241517){if(_0x241517){_0x2f5938=_0x241517;return db[_0x3e5b('0xe4')][_0x3e5b('0x69')]({'where':{'id':_0x2f5938[_0x3e5b('0x7e')]}});}})[_0x3e5b('0x2a')](function(_0x2868d4){if(_0x2868d4){_0x5cb09d=_0x2868d4;return db[_0x3e5b('0xe5')][_0x3e5b('0x69')]({'where':{'id':_0x2f5938[_0x3e5b('0xe6')]}});}})[_0x3e5b('0x2a')](function(_0x14cdf0){if(_0x14cdf0){if(_0xc09e4a){var _0x34d587=null;for(var _0x553c84=0x1;_0x553c84<_0x2f5938[_0x3e5b('0xe3')][_0x3e5b('0x50')];++_0x553c84){_0x34d587=_0x2f5938[_0x3e5b('0xe3')][_0x553c84];var _0x3cb9a2=_0x34d587[_0x3e5b('0x43')]?util[_0x3e5b('0xe7')](_0x3e5b('0xe8'),_0x5cb09d[_0x3e5b('0xe9')],_0x34d587[_0x3e5b('0x43')]):_0x3e5b('0xea');var _0x18ddf0=_0x345969['body']['customer']||util['format'](_0x3e5b('0xe8'),_0x3e5b('0xeb'),_0x34d587[_0x3e5b('0xe6')]);switch(_0x5cb09d[_0x3e5b('0xec')]){case _0x3e5b('0xed'):_0x3cb9a2=_0x34d587[_0x3e5b('0x43')]?util[_0x3e5b('0xe7')](_0x3e5b('0xe8'),_0x5cb09d['agentAlias'],_0x34d587[_0x3e5b('0x43')]):_0x3e5b('0xea');break;case _0x3e5b('0xee'):_0x3cb9a2=_0x34d587[_0x3e5b('0x43')]?_0x34d587[_0x3e5b('0x79')][_0x3e5b('0xef')]||_0x34d587[_0x3e5b('0x79')][_0x3e5b('0x37')]:_0x3e5b('0xea');break;case _0x3e5b('0xf0'):_0x3cb9a2=_0x34d587[_0x3e5b('0x43')]?_0x34d587[_0x3e5b('0x79')][_0x3e5b('0x37')]:_0x3e5b('0xea');break;default:_0x3cb9a2=_0x34d587['UserId']?util[_0x3e5b('0xe7')](_0x3e5b('0xe8'),_0x5cb09d[_0x3e5b('0xe9')],_0x34d587[_0x3e5b('0x43')]):_0x3e5b('0xea');}var _0x2288e9=util[_0x3e5b('0xe7')]('[%s]\x20%s:\x20%s\x0a',moment(_0x34d587[_0x3e5b('0xf1')])[_0x3e5b('0xe7')]('MM/DD/YYYY\x20HH:mm:ss'),_0x34d587['direction']==='in'?_0x18ddf0:_0x3cb9a2,_0x34d587[_0x3e5b('0x31')]);if(!_0x34d587[_0x3e5b('0xf2')]){fs[_0x3e5b('0xf3')](_0xc09e4a,_0x2288e9);}}return db[_0x3e5b('0xf4')][_0x3e5b('0xbc')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x3e5b('0xf5'),'raw':!![],'include':[{'model':db[_0x3e5b('0xf6')],'as':_0x3e5b('0xf6'),'raw':!![]}]}]});}}})['then'](function(_0x5195e2){if(!_0x5195e2||!_0x5195e2[_0x3e5b('0xf5')]||!_0x345969[_0x3e5b('0x31')])return _0x2f5938;var _0x33e1ef=_0x5195e2['getSmtpOptions']();return respondWithRpcPromise(_0x3e5b('0xf7'),_0x3e5b('0xf8'),{'account':_0x33e1ef,'message':{'from':util['format'](_0x3e5b('0xf9'),_0x5195e2[_0x3e5b('0x2d')],_0x5195e2[_0x3e5b('0xfa')]||_0x5195e2[_0x3e5b('0xf5')][_0x3e5b('0x96')]),'to':_0x345969['body'][_0x3e5b('0xdf')],'subject':_0x3e5b('0xfb'),'text':util[_0x3e5b('0xe7')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x345969[_0x3e5b('0x31')][_0x3e5b('0xdf')]),'attachments':[{'path':_0xc09e4a}]}})['then'](function(){return _0x2f5938;})['catch'](function(_0x2f56d7){logger[_0x3e5b('0x1b')](_0x2f56d7);});})['then'](respondWithStatusCode(_0x410b7f,0xc8))[_0x3e5b('0x1e')](handleError(_0x410b7f,null));};exports['addMessage']=function(_0x5b07ce,_0x586935){return db[_0x3e5b('0xcb')][_0x3e5b('0x69')]({'where':{'id':_0x5b07ce[_0x3e5b('0xb6')]['id']}})[_0x3e5b('0x2a')](handleEntityNotFound(_0x586935,null))['then'](function(_0x596968){if(_0x596968){return _0x596968[_0x3e5b('0xfc')](_0x5b07ce[_0x3e5b('0x31')][_0x3e5b('0xfd')],_[_0x3e5b('0xfe')](_0x5b07ce['body'],[_0x3e5b('0xfd'),'id'])||{});}})['then'](respondWithResult(_0x586935,null))[_0x3e5b('0x1e')](handleError(_0x586935,null));};exports['getMessages']=function(_0x54d961,_0x63ecb){var _0x52dd5e={'raw':![],'where':{}};var _0x1cd6ed={};var _0x2d8e32={'count':0x0,'rows':[]};return db[_0x3e5b('0x9e')]['findOne']({'where':{'id':_0x54d961['params']['id']}})['then'](handleEntityNotFound(_0x63ecb,null))['then'](function(_0x5d655f){if(_0x5d655f){_0x1cd6ed[_0x3e5b('0x49')]=_[_0x3e5b('0x4b')](db[_0x3e5b('0xcb')][_0x3e5b('0x47')]);_0x1cd6ed['query']=_[_0x3e5b('0x4b')](_0x54d961[_0x3e5b('0x4a')]);_0x1cd6ed[_0x3e5b('0x4c')]=_[_0x3e5b('0x4d')](_0x1cd6ed[_0x3e5b('0x49')],_0x1cd6ed[_0x3e5b('0x4a')]);_0x52dd5e['attributes']=_[_0x3e5b('0x4d')](_0x1cd6ed[_0x3e5b('0x49')],qs[_0x3e5b('0x4f')](_0x54d961[_0x3e5b('0x4a')][_0x3e5b('0x4f')]));_0x52dd5e['attributes']=_0x52dd5e[_0x3e5b('0x4e')][_0x3e5b('0x50')]?_0x52dd5e['attributes']:_0x1cd6ed[_0x3e5b('0x49')];if(!_0x54d961[_0x3e5b('0x4a')][_0x3e5b('0x51')](_0x3e5b('0x52'))){_0x52dd5e['limit']=qs['limit'](_0x54d961[_0x3e5b('0x4a')][_0x3e5b('0x23')]);_0x52dd5e[_0x3e5b('0x21')]=qs['offset'](_0x54d961['query']['offset']);}_0x52dd5e[_0x3e5b('0x53')]=qs[_0x3e5b('0x54')](_0x54d961['query'][_0x3e5b('0x54')]);_0x52dd5e['where']=qs[_0x3e5b('0x4c')](_[_0x3e5b('0x56')](_0x54d961[_0x3e5b('0x4a')],_0x1cd6ed[_0x3e5b('0x4c')]));_0x52dd5e[_0x3e5b('0x55')]['ChatInteractionId']=_0x5d655f['id'];if(_0x54d961['query'][_0x3e5b('0x89')]){_0x52dd5e['where']=_[_0x3e5b('0x30')](_0x52dd5e[_0x3e5b('0x55')],{'$or':_[_0x3e5b('0x36')](_0x52dd5e['attributes'],function(_0x18621c){var _0x1d50f7={};_0x1d50f7[_0x18621c]={'$like':'%'+_0x54d961['query']['filter']+'%'};return _0x1d50f7;})});}if(_0x54d961[_0x3e5b('0x4a')]['$gte']){var _0x592a35=_0x54d961[_0x3e5b('0x4a')][_0x3e5b('0xff')][_0x3e5b('0x39')](',');var _0x26b692={};_0x26b692[_0x592a35[0x0]]={'$gte':moment(_0x592a35[0x1])[_0x3e5b('0xe7')](_0x3e5b('0x100'))};_0x52dd5e[_0x3e5b('0x55')]=_[_0x3e5b('0x30')](_0x52dd5e['where'],_0x26b692);}_0x52dd5e=_['merge']({},_0x52dd5e,_0x54d961[_0x3e5b('0x101')]);return db['ChatMessage']['count']({'where':_0x52dd5e[_0x3e5b('0x55')]})['then'](function(_0x1fe234){_0x2d8e32[_0x3e5b('0x24')]=_0x1fe234;if(_0x54d961[_0x3e5b('0x4a')][_0x3e5b('0xb7')]){_0x52dd5e[_0x3e5b('0xb8')]=[{'all':!![]}];}return db[_0x3e5b('0xcb')][_0x3e5b('0x102')](_0x52dd5e);})[_0x3e5b('0x2a')](function(_0x17d49a){_0x2d8e32[_0x3e5b('0xb5')]=_0x17d49a;return _0x2d8e32;});}})['then'](respondWithFilteredResult(_0x63ecb,_0x52dd5e))[_0x3e5b('0x1e')](handleError(_0x63ecb,null));};exports['getMyMessages']=function(_0x496569,_0x229231){var _0x2b6f7f={'where':{}},_0x55f441={},_0x1a95c2={'count':0x0,'rows':[]};return db[_0x3e5b('0x9e')][_0x3e5b('0xbc')]({'where':{'id':_0x496569[_0x3e5b('0xb6')]['id']}})['then'](handleEntityNotFound(_0x229231,null))[_0x3e5b('0x2a')](function(_0x5beb7b){if(_0x5beb7b){_0x55f441[_0x3e5b('0x49')]=_[_0x3e5b('0x4b')](db[_0x3e5b('0xcb')][_0x3e5b('0x47')]);_0x55f441['query']=_[_0x3e5b('0x4b')](_0x496569[_0x3e5b('0x4a')]);_0x55f441[_0x3e5b('0x4c')]=_[_0x3e5b('0x4d')](_0x55f441[_0x3e5b('0x49')],_0x55f441['query']);_0x2b6f7f[_0x3e5b('0x4e')]=_[_0x3e5b('0x4d')](_0x55f441[_0x3e5b('0x49')],qs[_0x3e5b('0x4f')](_0x496569['query']['fields']));_0x2b6f7f[_0x3e5b('0x4e')]=_0x2b6f7f[_0x3e5b('0x4e')][_0x3e5b('0x50')]?_0x2b6f7f[_0x3e5b('0x4e')]:_0x55f441['model'];if(!_0x496569[_0x3e5b('0x4a')]['hasOwnProperty'](_0x3e5b('0x52'))){_0x2b6f7f['limit']=qs[_0x3e5b('0x23')](_0x496569[_0x3e5b('0x4a')][_0x3e5b('0x23')]);_0x2b6f7f[_0x3e5b('0x21')]=qs[_0x3e5b('0x21')](_0x496569[_0x3e5b('0x4a')][_0x3e5b('0x21')]);}_0x2b6f7f[_0x3e5b('0x53')]=qs[_0x3e5b('0x54')](_0x496569[_0x3e5b('0x4a')][_0x3e5b('0x54')]);_0x2b6f7f[_0x3e5b('0x55')]=qs[_0x3e5b('0x4c')](_[_0x3e5b('0x56')](_0x496569[_0x3e5b('0x4a')],_0x55f441[_0x3e5b('0x4c')]));_0x2b6f7f['where']['ChatInteractionId']=_0x5beb7b['id'];if(_0x496569['query'][_0x3e5b('0x89')]){_0x2b6f7f[_0x3e5b('0x55')]=_[_0x3e5b('0x30')](_0x2b6f7f['where'],{'$or':_[_0x3e5b('0x36')](_0x2b6f7f[_0x3e5b('0x4e')],function(_0x452450){var _0x1f4ca7={};_0x1f4ca7[_0x452450]={'$like':'%'+_0x496569[_0x3e5b('0x4a')][_0x3e5b('0x89')]+'%'};return _0x1f4ca7;})});}_0x2b6f7f[_0x3e5b('0x55')][_0x3e5b('0xf2')]=![];if(_0x496569[_0x3e5b('0x4a')]['id']){_0x2b6f7f[_0x3e5b('0x55')]['id']={'$gt':_0x496569['query']['id']};}_0x2b6f7f=_[_0x3e5b('0x30')]({},_0x2b6f7f,_0x496569[_0x3e5b('0x101')]);return db['ChatMessage'][_0x3e5b('0x24')]({'where':_0x2b6f7f[_0x3e5b('0x55')]})[_0x3e5b('0x2a')](function(_0x3e7663){_0x1a95c2['count']=_0x3e7663;_0x2b6f7f[_0x3e5b('0xb8')]=[];if(_0x496569['query'][_0x3e5b('0x103')]){_0x2b6f7f[_0x3e5b('0xb8')]['push']({'model':db[_0x3e5b('0x79')],'as':_0x3e5b('0x79'),'attributes':['id','fullname','alias']});}if(_0x496569['query'][_0x3e5b('0xb7')]){_0x2b6f7f[_0x3e5b('0xb8')]=[{'all':!![]}];}return db[_0x3e5b('0xcb')][_0x3e5b('0x102')](_0x2b6f7f);})[_0x3e5b('0x2a')](function(_0xf026f){_0x1a95c2[_0x3e5b('0xb5')]=_0xf026f;return _0x1a95c2;});}})[_0x3e5b('0x2a')](respondWithFilteredResult(_0x229231,_0x2b6f7f))[_0x3e5b('0x1e')](handleError(_0x229231,null));};exports[_0x3e5b('0x104')]=function(_0x2127ca,_0x34d441){return db[_0x3e5b('0x9e')]['find']({'where':{'id':_0x2127ca[_0x3e5b('0xb6')]['id']}})[_0x3e5b('0x2a')](handleEntityNotFound(_0x34d441,null))['then'](function(_0x57e137){if(_0x57e137){return _0x57e137['setTags'](_0x2127ca[_0x3e5b('0x31')]['ids'],_[_0x3e5b('0xfe')](_0x2127ca[_0x3e5b('0x31')],[_0x3e5b('0xfd'),'id'])||{})[_0x3e5b('0x105')](function(){return db['Tag']['findAll']({'attributes':['id',_0x3e5b('0x2d'),_0x3e5b('0x106')],'where':{'id':_0x2127ca[_0x3e5b('0x31')][_0x3e5b('0xfd')]}});})[_0x3e5b('0x2a')](function(_0x123d9e){socket['emit']('chatInteractionTags:save',{'id':Number(_0x2127ca[_0x3e5b('0xb6')]['id']),'tags':_0x123d9e||[]});return{'id':Number(_0x2127ca[_0x3e5b('0xb6')]['id']),'tags':_0x123d9e||[]};});}})['then'](respondWithResult(_0x34d441,null))['catch'](handleError(_0x34d441,null));};exports[_0x3e5b('0x107')]=function(_0x38c7a8,_0x40e4bb){return db[_0x3e5b('0x9e')]['find']({'where':{'id':_0x38c7a8[_0x3e5b('0xb6')]['id']}})[_0x3e5b('0x2a')](handleEntityNotFound(_0x40e4bb,null))[_0x3e5b('0x2a')](function(_0x153d8f){if(_0x153d8f){return _0x153d8f[_0x3e5b('0x107')](_0x38c7a8[_0x3e5b('0x4a')][_0x3e5b('0xfd')]);}})[_0x3e5b('0x2a')](respondWithStatusCode(_0x40e4bb,null))[_0x3e5b('0x1e')](handleError(_0x40e4bb,null));};exports['download']=function(_0x5756f9,_0x584567){var _0xe0fa7e=moment()[_0x3e5b('0x108')]()[_0x3e5b('0x9c')]();var _0x43d8ed=path[_0x3e5b('0xdc')](config[_0x3e5b('0xe0')],'server','files',_0x3e5b('0x109'));var _0x38aac3=path[_0x3e5b('0xdc')](config[_0x3e5b('0xe0')],_0x3e5b('0x10a'),_0x3e5b('0x10b'),_0x3e5b('0x10c'));var _0x5c4b44=path[_0x3e5b('0xdc')](_0x43d8ed,_0xe0fa7e);var _0x35430b=util[_0x3e5b('0xe7')](_0x3e5b('0x10d'),_0x5756f9[_0x3e5b('0xb6')]['id'],_0xe0fa7e);var _0x434e78=path[_0x3e5b('0xdc')](_0x43d8ed,_0x35430b);var _0x1583d7=[];_0x1583d7[_0x3e5b('0x3c')]({'model':db[_0x3e5b('0x79')],'as':_0x3e5b('0x79'),'attributes':['id','fullname'],'raw':!![]});_0x1583d7[_0x3e5b('0x3c')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x3e5b('0x10e'),_0x3e5b('0x10f')],'raw':!![]});if(_0x5756f9[_0x3e5b('0x4a')][_0x3e5b('0x10c')]){_0x1583d7[_0x3e5b('0x3c')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x3a3e20=[{'model':db[_0x3e5b('0xcb')],'as':_0x3e5b('0xe3'),'attributes':['id','body',_0x3e5b('0xf1'),_0x3e5b('0x110'),_0x3e5b('0xf2'),'read'],'include':_0x1583d7}];_0x3a3e20[_0x3e5b('0x3c')]({'model':db[_0x3e5b('0xe4')],'as':_0x3e5b('0x111'),'attributes':['id',_0x3e5b('0x2d')]});_0x3a3e20[_0x3e5b('0x3c')]({'model':db[_0x3e5b('0x79')],'as':_0x3e5b('0x112'),'attributes':['id',_0x3e5b('0x37')]});return db[_0x3e5b('0x9e')][_0x3e5b('0x69')]({'where':{'id':_0x5756f9[_0x3e5b('0xb6')]['id']},'include':_0x3a3e20})[_0x3e5b('0x2a')](handleEntityNotFound(_0x584567,null))[_0x3e5b('0x2a')](function(_0x4fc4a4){if(_0x4fc4a4){var _0x2ccb39=_0x4fc4a4['get']({'plain':!![]});fs[_0x3e5b('0x113')](_0x5c4b44);var _0x2fb159={'channel':_0x3e5b('0x114'),'account':_0x2ccb39[_0x3e5b('0x111')]['name'],'agent':_0x2ccb39[_0x3e5b('0x112')]?_0x2ccb39[_0x3e5b('0x112')][_0x3e5b('0x37')]:'N.A.','createdAt':moment(_0x2ccb39[_0x3e5b('0xf1')])[_0x3e5b('0xe7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3e5b('0x9c')](),'closedAt':_0x2ccb39['closed']?moment(_0x2ccb39[_0x3e5b('0x115')])[_0x3e5b('0xe7')](_0x3e5b('0x100'))[_0x3e5b('0x9c')]():'','disposition':_0x2ccb39[_0x3e5b('0x45')],'chatInfo':{'browser':_0x2ccb39[_0x3e5b('0x116')],'os':_0x2ccb39[_0x3e5b('0x117')],'referer':_0x2ccb39[_0x3e5b('0x118')],'customerIp':_0x2ccb39[_0x3e5b('0x119')],'customerPort':_0x2ccb39['customerPort']?_0x2ccb39['customerPort']:'N.A.'},'messages':_(_0x2ccb39[_0x3e5b('0xe3')])['tail']()[_0x3e5b('0x89')]({'secret':![]})['map'](function(_0x2aef9e){if(_0x2aef9e[_0x3e5b('0xd9')]){var _0x126ec8=path[_0x3e5b('0xdc')](_0x38aac3,_0x2aef9e[_0x3e5b('0xd9')]['basename']);if(fs[_0x3e5b('0x11a')](_0x126ec8)){fs['createReadStream'](_0x126ec8)['pipe'](fs[_0x3e5b('0x11b')](path['join'](_0x5c4b44,_0x2aef9e[_0x3e5b('0xd9')]['basename'])));}}return{'date':moment(_0x2aef9e[_0x3e5b('0xf1')])[_0x3e5b('0xe7')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3e5b('0x9c')](),'sender':_0x2aef9e[_0x3e5b('0x110')]===_0x3e5b('0x11c')?_0x2aef9e[_0x3e5b('0x79')]?_0x2aef9e[_0x3e5b('0x79')]['fullname']:'System':_0x2aef9e[_0x3e5b('0x6f')][_0x3e5b('0x10e')]+(_0x2aef9e[_0x3e5b('0x6f')][_0x3e5b('0x10f')]?'\x20'+_0x2aef9e['Contact']['lastName']:''),'body':_0x2aef9e['Attachment']?_0x2aef9e[_0x3e5b('0xd9')][_0x3e5b('0xd4')]:_0x2aef9e[_0x3e5b('0x31')],'direction':_0x2aef9e[_0x3e5b('0x110')]===_0x3e5b('0x11c')?'A':'C','secret':_0x2aef9e[_0x3e5b('0xf2')],'read':_0x2aef9e[_0x3e5b('0x84')],'attachment':_0x2aef9e[_0x3e5b('0xd9')]};})[_0x3e5b('0x6b')]()};return ejs[_0x3e5b('0x11d')](path[_0x3e5b('0xdc')](config[_0x3e5b('0xe0')],'server',_0x3e5b('0x11e'),_0x3e5b('0x11f')),{'interaction':_0x2fb159})['then'](function(_0xe34a63){var _0x34eb0c=path['join'](_0x5c4b44,_0x3e5b('0x120')+_0x2ccb39['id']+'-'+_0xe0fa7e+'.pdf');var _0x1b3662={'path':_0x34eb0c,'channel':'Chat','interactionId':_0x2ccb39['id']};return pdf[_0x3e5b('0x121')](_0xe34a63,_0x1b3662);})[_0x3e5b('0x2a')](function(){return new Promise(function(_0x42923b,_0x433fa3){zipdir(_0x5c4b44,{'saveTo':_0x434e78},function(_0x954e61,_0x344be2){if(_0x954e61)return _0x433fa3(_0x954e61);return _0x42923b(_0x344be2);});})[_0x3e5b('0x2a')](function(){return new BPromise(function(_0x4037a7,_0x41c956){rimraf(_0x5c4b44,function(_0x5f0004){if(_0x5f0004)_0x41c956(_0x5f0004);return _0x4037a7();});});})[_0x3e5b('0x2a')](function(){return _0x584567[_0x3e5b('0xdd')](_0x434e78,_0x35430b,function(_0x581db2){if(_0x581db2){logger[_0x3e5b('0x1b')](_0x3e5b('0x122'),_0x581db2);}else{fs[_0x3e5b('0x123')](_0x434e78);}});});});}else{return _0x584567['sendStatus'](0xc8);}})[_0x3e5b('0x1e')](handleError(_0x584567,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index a1271b5..579a073 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 _0x9915=['findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','then','setDataValue','Users'];(function(_0xa5662e,_0x4f47b0){var _0x344dda=function(_0x106a04){while(--_0x106a04){_0xa5662e['push'](_0xa5662e['shift']());}};_0x344dda(++_0x4f47b0);}(_0x9915,0xd9));var _0x5991=function(_0x25faae,_0x15b88b){_0x25faae=_0x25faae-0x0;var _0x460ded=_0x9915[_0x25faae];return _0x460ded;};'use strict';var EventEmitter=require(_0x5991('0x0'));var ChatInteraction=require(_0x5991('0x1'))['db'][_0x5991('0x2')];var ChatMessage=require(_0x5991('0x1'))['db'][_0x5991('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5991('0x4')](0x0);var events={'afterCreate':_0x5991('0x5'),'afterUpdate':_0x5991('0x6'),'afterDestroy':_0x5991('0x7')};function emitEvent(_0x3b7f5b){return function(_0x3a4046,_0x1008b0,_0x43ea55){_0x3a4046['getUsers']({'attributes':['id'],'raw':!![]})[_0x5991('0x8')](function(_0x395353){_0x3a4046[_0x5991('0x9')](_0x5991('0xa'),_0x395353['map'](function(_0x18876d){return{'id':_0x18876d['id']};}));return ChatMessage[_0x5991('0xb')]({'where':{'ChatInteractionId':_0x3a4046['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5991('0x8')](function(_0x1bf748){_0x3a4046[_0x5991('0x9')](_0x5991('0xc'),_0x1bf748[_0x5991('0xd')]);ChatInteractionEvents[_0x5991('0xe')](_0x3b7f5b+':'+_0x3a4046['id'],_0x3a4046);ChatInteractionEvents['emit'](_0x3b7f5b,_0x3a4046);_0x43ea55(null);})[_0x5991('0xf')](_0x43ea55(null));};}for(var e in events){if(events[_0x5991('0x10')](e)){var event=events[e];ChatInteraction[_0x5991('0x11')](e,emitEvent(event));}}module[_0x5991('0x12')]=ChatInteractionEvents; \ No newline at end of file +var _0x8819=['Users','map','findAll','then','unreadMessages','emit','catch','exports','events','ChatInteraction','ChatMessage','setMaxListeners','update','getUsers','setDataValue'];(function(_0x528676,_0x5c61ec){var _0x5e93fb=function(_0x131d12){while(--_0x131d12){_0x528676['push'](_0x528676['shift']());}};_0x5e93fb(++_0x5c61ec);}(_0x8819,0x1e8));var _0x9881=function(_0x274705,_0x21774b){_0x274705=_0x274705-0x0;var _0x4e83cd=_0x8819[_0x274705];return _0x4e83cd;};'use strict';var EventEmitter=require(_0x9881('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x9881('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x9881('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x9881('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9881('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4ec718){return function(_0x4718e5,_0x209616,_0xd4b1c1){_0x4718e5[_0x9881('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5c0377){_0x4718e5[_0x9881('0x6')](_0x9881('0x7'),_0x5c0377[_0x9881('0x8')](function(_0x35df8a){return{'id':_0x35df8a['id']};}));return ChatMessage[_0x9881('0x9')]({'where':{'ChatInteractionId':_0x4718e5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9881('0xa')](function(_0x4fb853){_0x4718e5[_0x9881('0x6')](_0x9881('0xb'),_0x4fb853['length']);ChatInteractionEvents[_0x9881('0xc')](_0x4ec718+':'+_0x4718e5['id'],_0x4718e5);ChatInteractionEvents[_0x9881('0xc')](_0x4ec718,_0x4718e5);_0xd4b1c1(null);})[_0x9881('0xd')](_0xd4b1c1(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x9881('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 8292eeb..2f1b308 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 _0x32bf=['ChatInteraction','closed','closedAt','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define'];(function(_0x27cbf1,_0x54e403){var _0x399ee3=function(_0x533835){while(--_0x533835){_0x27cbf1['push'](_0x27cbf1['shift']());}};_0x399ee3(++_0x54e403);}(_0x32bf,0x154));var _0xf32b=function(_0x4fcc33,_0x37f357){_0x4fcc33=_0x4fcc33-0x0;var _0x35da2f=_0x32bf[_0x4fcc33];return _0x35da2f;};'use strict';var _=require(_0xf32b('0x0'));var util=require(_0xf32b('0x1'));var logger=require(_0xf32b('0x2'))(_0xf32b('0x3'));var moment=require(_0xf32b('0x4'));var BPromise=require(_0xf32b('0x5'));var rp=require(_0xf32b('0x6'));var fs=require('fs');var path=require(_0xf32b('0x7'));var rimraf=require('rimraf');var config=require(_0xf32b('0x8'));var attributes=require(_0xf32b('0x9'));module[_0xf32b('0xa')]=function(_0x5cac46,_0x448913){return _0x5cac46[_0xf32b('0xb')](_0xf32b('0xc'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x534e74,_0x4465b1,_0x3f0ca6){if(_0x534e74['changed'](_0xf32b('0xd'))){_0x534e74[_0xf32b('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x3f0ca6(null,_0x534e74);}},'charset':'utf8mb4','collate':_0xf32b('0xf')});}; \ No newline at end of file +var _0x1cae=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','utf8mb4','utf8mb4_unicode_ci'];(function(_0xf0af0c,_0x41b6aa){var _0x40aa5f=function(_0x48df97){while(--_0x48df97){_0xf0af0c['push'](_0xf0af0c['shift']());}};_0x40aa5f(++_0x41b6aa);}(_0x1cae,0x1e0));var _0xe1ca=function(_0x4621f1,_0x5f1cdb){_0x4621f1=_0x4621f1-0x0;var _0x48d3cb=_0x1cae[_0x4621f1];return _0x48d3cb;};'use strict';var _=require(_0xe1ca('0x0'));var util=require(_0xe1ca('0x1'));var logger=require(_0xe1ca('0x2'))(_0xe1ca('0x3'));var moment=require(_0xe1ca('0x4'));var BPromise=require(_0xe1ca('0x5'));var rp=require(_0xe1ca('0x6'));var fs=require('fs');var path=require(_0xe1ca('0x7'));var rimraf=require(_0xe1ca('0x8'));var config=require(_0xe1ca('0x9'));var attributes=require(_0xe1ca('0xa'));module[_0xe1ca('0xb')]=function(_0x4df2f6,_0x2b0f28){return _0x4df2f6[_0xe1ca('0xc')](_0xe1ca('0xd'),attributes,{'tableName':_0xe1ca('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x142c30,_0x1d9861,_0x4e3523){if(_0x142c30[_0xe1ca('0xf')](_0xe1ca('0x10'))){_0x142c30[_0xe1ca('0x11')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4e3523(null,_0x142c30);}},'charset':_0xe1ca('0x12'),'collate':_0xe1ca('0x13')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index e1be1c6..c9aa55b 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 _0xd014=['then','request\x20sent','debug','stringify','error','ChatInteraction,\x20%s,\x20%s','message','info','result','ChatInteraction','update','body','options','raw','where','attributes','limit','UpdateChatInteraction','AddTagsToChatInteraction','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','register','request'];(function(_0x3cc0e2,_0xf41d9d){var _0x5a073f=function(_0x3614de){while(--_0x3614de){_0x3cc0e2['push'](_0x3cc0e2['shift']());}};_0x5a073f(++_0xf41d9d);}(_0xd014,0xfc));var _0x4d01=function(_0x4ebfb7,_0x4a44eb){_0x4ebfb7=_0x4ebfb7-0x0;var _0x5bf7bf=_0xd014[_0x4ebfb7];return _0x5bf7bf;};'use strict';var _=require(_0x4d01('0x0'));var util=require(_0x4d01('0x1'));var moment=require('moment');var BPromise=require(_0x4d01('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d01('0x3'));var db=require(_0x4d01('0x4'))['db'];var utils=require(_0x4d01('0x5'));var logger=require(_0x4d01('0x6'))(_0x4d01('0x7'));var config=require(_0x4d01('0x8'));var jayson=require(_0x4d01('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x4d01('0xa')]=_[_0x4d01('0xb')](config[_0x4d01('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4d01('0xa')]));require('./chatInteraction.socket')[_0x4d01('0xc')](socket);function respondWithRpcPromise(_0x4f1387,_0x44c357,_0xe3399e){return new BPromise(function(_0x31a1b0,_0x496d03){return client[_0x4d01('0xd')](_0x4f1387,_0xe3399e)[_0x4d01('0xe')](function(_0x49df08){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x44c357,_0x4d01('0xf'));logger[_0x4d01('0x10')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x44c357,_0x4d01('0xf'),JSON[_0x4d01('0x11')](_0x49df08));if(_0x49df08[_0x4d01('0x12')]){if(_0x49df08['error']['code']===0x1f4){logger[_0x4d01('0x12')](_0x4d01('0x13'),_0x44c357,_0x49df08[_0x4d01('0x12')][_0x4d01('0x14')]);return _0x496d03(_0x49df08[_0x4d01('0x12')]['message']);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x44c357,_0x49df08['error'][_0x4d01('0x14')]);return _0x31a1b0(_0x49df08[_0x4d01('0x12')][_0x4d01('0x14')]);}else{logger[_0x4d01('0x15')](_0x4d01('0x13'),_0x44c357,_0x4d01('0xf'));_0x31a1b0(_0x49df08[_0x4d01('0x16')][_0x4d01('0x14')]);}})['catch'](function(_0x5ed0ac){logger[_0x4d01('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x44c357,_0x5ed0ac);_0x496d03(_0x5ed0ac);});});}exports['UpdateChatInteraction']=function(_0x1df810){var _0x3fc3ab=this;return new Promise(function(_0x179709,_0x4bbdab){return db[_0x4d01('0x17')][_0x4d01('0x18')](_0x1df810[_0x4d01('0x19')],{'raw':_0x1df810['options']?_0x1df810[_0x4d01('0x1a')][_0x4d01('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1df810[_0x4d01('0x1a')]?_0x1df810['options'][_0x4d01('0x1c')]||null:null,'attributes':_0x1df810[_0x4d01('0x1a')]?_0x1df810[_0x4d01('0x1a')][_0x4d01('0x1d')]||null:null,'limit':_0x1df810['options']?_0x1df810[_0x4d01('0x1a')][_0x4d01('0x1e')]||null:null})['then'](function(_0x386a30){logger[_0x4d01('0x15')](_0x4d01('0x1f'),_0x1df810);logger[_0x4d01('0x10')](_0x4d01('0x1f'),_0x1df810,JSON[_0x4d01('0x11')](_0x386a30));_0x179709(_0x386a30);})['catch'](function(_0x58f013){logger[_0x4d01('0x12')](_0x4d01('0x1f'),_0x58f013['message'],_0x1df810);_0x4bbdab(_0x3fc3ab[_0x4d01('0x12')](0x1f4,_0x58f013[_0x4d01('0x14')]));});});};exports[_0x4d01('0x20')]=function(_0x48c352){return new Promise(function(_0x51235a,_0x19243b){return db[_0x4d01('0x17')]['find']({'where':_0x48c352[_0x4d01('0x1a')]?_0x48c352[_0x4d01('0x1a')][_0x4d01('0x1c')]||null:null})['then'](function(_0x18dfaa){if(_0x18dfaa){return _0x18dfaa[_0x4d01('0x21')](_0x48c352[_0x4d01('0x19')][_0x4d01('0x22')],_[_0x4d01('0x23')](_0x48c352['body'],[_0x4d01('0x22'),'id'])||{});}})[_0x4d01('0x24')](function(_0x3a8d6e){logger[_0x4d01('0x15')](_0x4d01('0x25'),_0x48c352);logger[_0x4d01('0x10')](_0x4d01('0x25'),_0x48c352,JSON['stringify'](_0x3a8d6e));_0x51235a(_0x3a8d6e);})['catch'](function(_0x3e9667){logger[_0x4d01('0x12')]('AddTags',_0x3e9667[_0x4d01('0x14')],_0x48c352);_0x19243b(_this[_0x4d01('0x12')](0x1f4,_0x3e9667[_0x4d01('0x14')]));});});}; \ No newline at end of file +var _0xb572=['catch','ChatInteraction','update','body','options','attributes','UpdateChatInteraction','stringify','AddTagsToChatInteraction','find','where','addTags','ids','omit','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0xeab8e1,_0x496fd0){var _0xcad265=function(_0x9440f4){while(--_0x9440f4){_0xeab8e1['push'](_0xeab8e1['shift']());}};_0xcad265(++_0x496fd0);}(_0xb572,0xb3));var _0x2b57=function(_0x1c2eca,_0x3e9b0b){_0x1c2eca=_0x1c2eca-0x0;var _0x2c7c68=_0xb572[_0x1c2eca];return _0x2c7c68;};'use strict';var _=require('lodash');var util=require(_0x2b57('0x0'));var moment=require(_0x2b57('0x1'));var BPromise=require(_0x2b57('0x2'));var rs=require(_0x2b57('0x3'));var fs=require('fs');var Redis=require(_0x2b57('0x4'));var db=require(_0x2b57('0x5'))['db'];var utils=require(_0x2b57('0x6'));var logger=require(_0x2b57('0x7'))('rpc');var config=require(_0x2b57('0x8'));var jayson=require(_0x2b57('0x9'));var client=jayson[_0x2b57('0xa')]['http']({'port':0x232a});config[_0x2b57('0xb')]=_['defaults'](config[_0x2b57('0xb')],{'host':_0x2b57('0xc'),'port':0x18eb});var socket=require(_0x2b57('0xd'))(new Redis(config[_0x2b57('0xb')]));require(_0x2b57('0xe'))[_0x2b57('0xf')](socket);function respondWithRpcPromise(_0xd7d485,_0x5af70b,_0xcdd74d){return new BPromise(function(_0x4f7722,_0x58a799){return client['request'](_0xd7d485,_0xcdd74d)[_0x2b57('0x10')](function(_0x40eb3b){logger[_0x2b57('0x11')](_0x2b57('0x12'),_0x5af70b,_0x2b57('0x13'));logger[_0x2b57('0x14')](_0x2b57('0x15'),_0x5af70b,_0x2b57('0x13'),JSON['stringify'](_0x40eb3b));if(_0x40eb3b[_0x2b57('0x16')]){if(_0x40eb3b['error'][_0x2b57('0x17')]===0x1f4){logger[_0x2b57('0x16')](_0x2b57('0x12'),_0x5af70b,_0x40eb3b[_0x2b57('0x16')][_0x2b57('0x18')]);return _0x58a799(_0x40eb3b[_0x2b57('0x16')]['message']);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x5af70b,_0x40eb3b[_0x2b57('0x16')][_0x2b57('0x18')]);return _0x4f7722(_0x40eb3b[_0x2b57('0x16')][_0x2b57('0x18')]);}else{logger[_0x2b57('0x11')](_0x2b57('0x12'),_0x5af70b,'request\x20sent');_0x4f7722(_0x40eb3b[_0x2b57('0x19')][_0x2b57('0x18')]);}})[_0x2b57('0x1a')](function(_0x2ecb1a){logger[_0x2b57('0x16')](_0x2b57('0x12'),_0x5af70b,_0x2ecb1a);_0x58a799(_0x2ecb1a);});});}exports['UpdateChatInteraction']=function(_0x14a6e7){var _0x4f82c3=this;return new Promise(function(_0x142154,_0x38a23b){return db[_0x2b57('0x1b')][_0x2b57('0x1c')](_0x14a6e7[_0x2b57('0x1d')],{'raw':_0x14a6e7[_0x2b57('0x1e')]?_0x14a6e7[_0x2b57('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14a6e7[_0x2b57('0x1e')]?_0x14a6e7['options']['where']||null:null,'attributes':_0x14a6e7[_0x2b57('0x1e')]?_0x14a6e7[_0x2b57('0x1e')][_0x2b57('0x1f')]||null:null,'limit':_0x14a6e7[_0x2b57('0x1e')]?_0x14a6e7[_0x2b57('0x1e')]['limit']||null:null})[_0x2b57('0x10')](function(_0x28a846){logger['info'](_0x2b57('0x20'),_0x14a6e7);logger[_0x2b57('0x14')](_0x2b57('0x20'),_0x14a6e7,JSON[_0x2b57('0x21')](_0x28a846));_0x142154(_0x28a846);})[_0x2b57('0x1a')](function(_0x5284d0){logger[_0x2b57('0x16')](_0x2b57('0x20'),_0x5284d0[_0x2b57('0x18')],_0x14a6e7);_0x38a23b(_0x4f82c3[_0x2b57('0x16')](0x1f4,_0x5284d0[_0x2b57('0x18')]));});});};exports[_0x2b57('0x22')]=function(_0x2873d8){return new Promise(function(_0x2569a1,_0x26945a){return db[_0x2b57('0x1b')][_0x2b57('0x23')]({'where':_0x2873d8[_0x2b57('0x1e')]?_0x2873d8[_0x2b57('0x1e')][_0x2b57('0x24')]||null:null})[_0x2b57('0x10')](function(_0x489878){if(_0x489878){return _0x489878[_0x2b57('0x25')](_0x2873d8[_0x2b57('0x1d')][_0x2b57('0x26')],_[_0x2b57('0x27')](_0x2873d8['body'],[_0x2b57('0x26'),'id'])||{});}})['spread'](function(_0x3fe869){logger[_0x2b57('0x11')]('AddTags',_0x2873d8);logger[_0x2b57('0x14')](_0x2b57('0x28'),_0x2873d8,JSON['stringify'](_0x3fe869));_0x2569a1(_0x3fe869);})[_0x2b57('0x1a')](function(_0x233378){logger['error'](_0x2b57('0x28'),_0x233378[_0x2b57('0x18')],_0x2873d8);_0x26945a(_this[_0x2b57('0x16')](0x1f4,_0x233378['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 9bb74f1..c91e680 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 _0xa395=['save','remove','emit','removeListener','register','chatInteraction:','./chatInteraction.events'];(function(_0x7dd36b,_0x1cdb4c){var _0x4b87e0=function(_0x464b4c){while(--_0x464b4c){_0x7dd36b['push'](_0x7dd36b['shift']());}};_0x4b87e0(++_0x1cdb4c);}(_0xa395,0x14f));var _0x5a39=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa395[_0x37bd26];return _0xe83dc4;};'use strict';var ChatInteractionEvents=require(_0x5a39('0x0'));var events=[_0x5a39('0x1'),_0x5a39('0x2'),'update'];function createListener(_0x25e2e0,_0x306e82){return function(_0x5885ea){_0x306e82[_0x5a39('0x3')](_0x25e2e0,_0x5885ea);};}function removeListener(_0x2ed55c,_0xaa6028){return function(){ChatInteractionEvents[_0x5a39('0x4')](_0x2ed55c,_0xaa6028);};}exports[_0x5a39('0x5')]=function(_0x178b5f){for(var _0x261187=0x0,_0x629632=events['length'];_0x261187<_0x629632;_0x261187++){var _0x5b2a15=events[_0x261187];var _0x5d28e5=createListener(_0x5a39('0x6')+_0x5b2a15,_0x178b5f);ChatInteractionEvents['on'](_0x5b2a15,_0x5d28e5);}}; \ No newline at end of file +var _0xc230=['update','emit','removeListener','register','length','./chatInteraction.events','save'];(function(_0x19c4bd,_0x19a00d){var _0x2fc7b5=function(_0x24fdab){while(--_0x24fdab){_0x19c4bd['push'](_0x19c4bd['shift']());}};_0x2fc7b5(++_0x19a00d);}(_0xc230,0xf3));var _0x0c23=function(_0x190a56,_0x4e3ff8){_0x190a56=_0x190a56-0x0;var _0x27adbd=_0xc230[_0x190a56];return _0x27adbd;};'use strict';var ChatInteractionEvents=require(_0x0c23('0x0'));var events=[_0x0c23('0x1'),'remove',_0x0c23('0x2')];function createListener(_0x3b5826,_0x437a2e){return function(_0x1f6427){_0x437a2e[_0x0c23('0x3')](_0x3b5826,_0x1f6427);};}function removeListener(_0x5647ed,_0x38eee4){return function(){ChatInteractionEvents[_0x0c23('0x4')](_0x5647ed,_0x38eee4);};}exports[_0x0c23('0x5')]=function(_0x2dc25f){for(var _0x190626=0x0,_0x2fe7c2=events[_0x0c23('0x6')];_0x190626<_0x2fe7c2;_0x190626++){var _0x5bd698=events[_0x190626];var _0x15ff4e=createListener('chatInteraction:'+_0x5bd698,_0x2dc25f);ChatInteractionEvents['on'](_0x5bd698,_0x15ff4e);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 24bd1e0..2f008fe 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 _0xa54e=['chatinteraction:addtags','/:id','update','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','now','originalname','/:id/attachment_upload','single','addMessage','/:id/tags','tracked','chat'];(function(_0xdeefbd,_0x9e1b3d){var _0x4ff63f=function(_0x4b51f9){while(--_0x4b51f9){_0xdeefbd['push'](_0xdeefbd['shift']());}};_0x4ff63f(++_0x9e1b3d);}(_0xa54e,0xaa));var _0xea54=function(_0x285824,_0x3da647){_0x285824=_0x285824-0x0;var _0x311d7e=_0xa54e[_0x285824];return _0x311d7e;};'use strict';var multer=require(_0xea54('0x0'));var util=require(_0xea54('0x1'));var path=require('path');var timeout=require(_0xea54('0x2'));var express=require('express');var router=express[_0xea54('0x3')]();var fs_extra=require(_0xea54('0x4'));var auth=require(_0xea54('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xea54('0x6'));var controller=require(_0xea54('0x7'));router[_0xea54('0x8')]('/',auth['isAuthenticated'](),controller[_0xea54('0x9')]);router[_0xea54('0x8')](_0xea54('0xa'),auth[_0xea54('0xb')](),controller['describe']);router[_0xea54('0x8')]('/:id',auth[_0xea54('0xc')](),controller[_0xea54('0xd')]);router[_0xea54('0x8')](_0xea54('0xe'),auth[_0xea54('0xc')](),controller[_0xea54('0xf')]);router[_0xea54('0x8')](_0xea54('0x10'),auth[_0xea54('0xb')](),controller[_0xea54('0x11')]);router[_0xea54('0x8')](_0xea54('0x12'),auth[_0xea54('0xc')](),controller[_0xea54('0x13')]);router[_0xea54('0x8')](_0xea54('0x14'),auth[_0xea54('0xb')](),controller[_0xea54('0x15')]);router[_0xea54('0x16')]('/',auth['isAuthenticated'](),controller[_0xea54('0x17')]);router['post']('/:id/vidaoo',auth[_0xea54('0xb')](),controller[_0xea54('0x18')]);var upload=multer({'storage':multer[_0xea54('0x19')]({'destination':function(_0x2e54b5,_0x232c3c,_0x7a7788){_0x7a7788(null,path[_0xea54('0x1a')](config[_0xea54('0x1b')],_0xea54('0x1c')));},'filename':function(_0x3bdb32,_0x39a25e,_0x2d56d4){_0x2d56d4(null,util[_0xea54('0x1d')]('%s-%s',Date[_0xea54('0x1e')](),_0x39a25e[_0xea54('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xea54('0x16')](_0xea54('0x20'),upload[_0xea54('0x21')]('file'),controller['attachmentUpload']);router[_0xea54('0x16')]('/:id/messages',auth[_0xea54('0xc')](),controller[_0xea54('0x22')]);router['post'](_0xea54('0x23'),auth[_0xea54('0xb')](),interaction[_0xea54('0x24')](_0xea54('0x25'),_0xea54('0x26')),controller['addTags']);router['put'](_0xea54('0x27'),auth['isAuthenticated'](),interaction['tracked'](_0xea54('0x25'),'chatinteraction:update'),controller[_0xea54('0x28')]);router[_0xea54('0x29')](_0xea54('0x2a'),controller[_0xea54('0x2b')]);router[_0xea54('0x29')](_0xea54('0x2c'),auth[_0xea54('0xc')](),controller[_0xea54('0x2d')]);router[_0xea54('0x29')]('/:id/close',controller[_0xea54('0x2e')]);router[_0xea54('0x2f')](_0xea54('0x27'),auth[_0xea54('0xb')](),interaction[_0xea54('0x24')](_0xea54('0x25'),_0xea54('0x30')),controller[_0xea54('0x31')]);router[_0xea54('0x2f')]('/:id/tags',auth[_0xea54('0xb')](),controller[_0xea54('0x32')]);module[_0xea54('0x33')]=router; \ No newline at end of file +var _0x0740=['chat','chatinteraction:addtags','addTags','put','tracked','update','/:id/custom_update','customUpdate','delete','chatinteraction:destroy','removeTags','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','/:id/vidaoo','createVidaooSession','diskStorage','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','single','file','/:id/tags'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0740,0x99));var _0x0074=function(_0x2d68cf,_0x2b5d44){_0x2d68cf=_0x2d68cf-0x0;var _0x9b3502=_0x0740[_0x2d68cf];return _0x9b3502;};'use strict';var multer=require(_0x0074('0x0'));var util=require(_0x0074('0x1'));var path=require(_0x0074('0x2'));var timeout=require('connect-timeout');var express=require(_0x0074('0x3'));var router=express[_0x0074('0x4')]();var fs_extra=require(_0x0074('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0074('0x6'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0x0074('0x7')]('/',auth[_0x0074('0x8')](),controller[_0x0074('0x9')]);router[_0x0074('0x7')](_0x0074('0xa'),auth[_0x0074('0x8')](),controller[_0x0074('0xb')]);router[_0x0074('0x7')](_0x0074('0xc'),auth[_0x0074('0xd')](),controller[_0x0074('0xe')]);router[_0x0074('0x7')](_0x0074('0xf'),auth[_0x0074('0xd')](),controller['attachmentDownload']);router[_0x0074('0x7')](_0x0074('0x10'),auth[_0x0074('0x8')](),controller[_0x0074('0x11')]);router[_0x0074('0x7')](_0x0074('0x12'),auth[_0x0074('0xd')](),controller[_0x0074('0x13')]);router['get'](_0x0074('0x14'),auth['isAuthenticated'](),controller[_0x0074('0x15')]);router[_0x0074('0x16')]('/',auth[_0x0074('0x8')](),controller['create']);router['post'](_0x0074('0x17'),auth[_0x0074('0x8')](),controller[_0x0074('0x18')]);var upload=multer({'storage':multer[_0x0074('0x19')]({'destination':function(_0x37a149,_0x4bf594,_0x3f7781){_0x3f7781(null,path['join'](config['root'],_0x0074('0x1a')));},'filename':function(_0x14ffaa,_0x19ed94,_0x4d1253){_0x4d1253(null,util[_0x0074('0x1b')](_0x0074('0x1c'),Date[_0x0074('0x1d')](),_0x19ed94['originalname'][_0x0074('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x0074('0x1f'),upload[_0x0074('0x20')](_0x0074('0x21')),controller['attachmentUpload']);router[_0x0074('0x16')]('/:id/messages',auth[_0x0074('0xd')](),controller['addMessage']);router['post'](_0x0074('0x22'),auth[_0x0074('0x8')](),interaction['tracked'](_0x0074('0x23'),_0x0074('0x24')),controller[_0x0074('0x25')]);router[_0x0074('0x26')]('/:id',auth[_0x0074('0x8')](),interaction[_0x0074('0x27')](_0x0074('0x23'),'chatinteraction:update'),controller[_0x0074('0x28')]);router['put'](_0x0074('0x29'),controller[_0x0074('0x2a')]);router[_0x0074('0x26')]('/:id/abandon',auth[_0x0074('0xd')](),controller['abandon']);router[_0x0074('0x26')]('/:id/close',controller['close']);router[_0x0074('0x2b')](_0x0074('0xc'),auth[_0x0074('0x8')](),interaction[_0x0074('0x27')](_0x0074('0x23'),_0x0074('0x2c')),controller['destroy']);router['delete']('/:id/tags',auth[_0x0074('0x8')](),controller[_0x0074('0x2d')]);module[_0x0074('0x2e')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 6e4223f..d2d8eb1 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 _0x4298=['INTEGER','sequelize','exports','TEXT'];(function(_0x13f044,_0x4d2100){var _0x35841a=function(_0x4a9550){while(--_0x4a9550){_0x13f044['push'](_0x13f044['shift']());}};_0x35841a(++_0x4d2100);}(_0x4298,0x81));var _0x8429=function(_0x19bee2,_0x3cb24b){_0x19bee2=_0x19bee2-0x0;var _0x31d63d=_0x4298[_0x19bee2];return _0x31d63d;};'use strict';var Sequelize=require(_0x8429('0x0'));module[_0x8429('0x1')]={'body':{'type':Sequelize[_0x8429('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8429('0x3')]}}; \ No newline at end of file +var _0xf521=['medium','BOOLEAN','INTEGER','exports','TEXT'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0xf521,0x17a));var _0x1f52=function(_0x2c60d1,_0x5b778f){_0x2c60d1=_0x2c60d1-0x0;var _0xdf6e43=_0xf521[_0x2c60d1];return _0xdf6e43;};'use strict';var Sequelize=require('sequelize');module[_0x1f52('0x0')]={'body':{'type':Sequelize[_0x1f52('0x1')](_0x1f52('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1f52('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x1f52('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 3665f7f..dfcce68 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 _0xeaaa=['sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','then','destroy','stack','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','ChatInternalMessage','rows','catch','show','params','rawAttributes','include','find','create','body','update','describe','get','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','User','findAll','agent','user','fullname','role','userpic','internal','online','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','read','eml-format','zip-dir','request-promise','moment','mustache','util'];(function(_0x1f3aec,_0x24c18e){var _0x409f0d=function(_0x52b818){while(--_0x52b818){_0x1f3aec['push'](_0x1f3aec['shift']());}};_0x409f0d(++_0x24c18e);}(_0xeaaa,0x66));var _0xaeaa=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xeaaa[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xaeaa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaeaa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaeaa('0x2'));var moment=require(_0xaeaa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaeaa('0x4'));var util=require(_0xaeaa('0x5'));var path=require('path');var sox=require(_0xaeaa('0x6'));var csv=require(_0xaeaa('0x7'));var ejs=require(_0xaeaa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaeaa('0x9'));var squel=require(_0xaeaa('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaeaa('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaeaa('0xc'));var Redis=require(_0xaeaa('0xd'));var authService=require(_0xaeaa('0xe'));var qs=require(_0xaeaa('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaeaa('0x10'));var logger=require(_0xaeaa('0x11'))(_0xaeaa('0x12'));var utils=require(_0xaeaa('0x13'));var config=require(_0xaeaa('0x14'));var licenseUtil=require(_0xaeaa('0x15'));var db=require(_0xaeaa('0x16'))['db'];config[_0xaeaa('0x17')]=_[_0xaeaa('0x18')](config[_0xaeaa('0x17')],{'host':_0xaeaa('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaeaa('0x17')]));require(_0xaeaa('0x1a'))['register'](socket);function respondWithStatusCode(_0x179a07,_0x292604){_0x292604=_0x292604||0xcc;return function(_0x11405c){if(_0x11405c){return _0x179a07[_0xaeaa('0x1b')](_0x292604);}return _0x179a07[_0xaeaa('0x1c')](_0x292604)[_0xaeaa('0x1d')]();};}function respondWithResult(_0x3b5376,_0x210447){_0x210447=_0x210447||0xc8;return function(_0x14fa3f){if(_0x14fa3f){return _0x3b5376[_0xaeaa('0x1c')](_0x210447)[_0xaeaa('0x1e')](_0x14fa3f);}};}function respondWithFilteredResult(_0x591457,_0x4d31ee){return function(_0x15de87){if(_0x15de87){var _0x4c54b1=typeof _0x4d31ee['offset']===_0xaeaa('0x1f')&&typeof _0x4d31ee[_0xaeaa('0x20')]===_0xaeaa('0x1f');var _0x5c9ecf=_0x15de87[_0xaeaa('0x21')];var _0x48027c=_0x4c54b1?0x0:_0x4d31ee['offset'];var _0x5cd875=_0x4c54b1?_0x15de87[_0xaeaa('0x21')]:_0x4d31ee[_0xaeaa('0x22')]+_0x4d31ee[_0xaeaa('0x20')];var _0x4beaf1;if(_0x5cd875>=_0x5c9ecf){_0x5cd875=_0x5c9ecf;_0x4beaf1=0xc8;}else{_0x4beaf1=0xce;}_0x591457['status'](_0x4beaf1);return _0x591457['set'](_0xaeaa('0x23'),_0x48027c+'-'+_0x5cd875+'/'+_0x5c9ecf)[_0xaeaa('0x1e')](_0x15de87);}return null;};}function patchUpdates(_0x1361e8){return function(_0x2ed148){try{jsonpatch[_0xaeaa('0x24')](_0x2ed148,_0x1361e8,!![]);}catch(_0x59612a){return BPromise['reject'](_0x59612a);}return _0x2ed148[_0xaeaa('0x25')]();};}function saveUpdates(_0x30333e,_0x16334b){return function(_0x5fb847){if(_0x5fb847){return _0x5fb847['update'](_0x30333e)[_0xaeaa('0x26')](function(_0x1eb8c8){return _0x1eb8c8;});}return null;};}function removeEntity(_0x1a9b52,_0x4ce2a2){return function(_0x45cede){if(_0x45cede){return _0x45cede[_0xaeaa('0x27')]()['then'](function(){_0x1a9b52[_0xaeaa('0x1c')](0xcc)[_0xaeaa('0x1d')]();});}};}function handleEntityNotFound(_0x4c9c10,_0x23b663){return function(_0x1d9d9f){if(!_0x1d9d9f){_0x4c9c10['sendStatus'](0x194);}return _0x1d9d9f;};}function handleError(_0x1dd9cd,_0x39269e){_0x39269e=_0x39269e||0x1f4;return function(_0x4e36c5){logger['error'](_0x4e36c5[_0xaeaa('0x28')]);if(_0x4e36c5[_0xaeaa('0x29')]){delete _0x4e36c5[_0xaeaa('0x29')];}_0x1dd9cd['status'](_0x39269e)[_0xaeaa('0x2a')](_0x4e36c5);};}exports[_0xaeaa('0x2b')]=function(_0x375ea5,_0xdee91){var _0x2df3a4={},_0x17911c={},_0x24b415={'count':0x0,'rows':[]};var _0x5a98a1=_['map'](db['ChatInternalMessage']['rawAttributes'],function(_0xe08a4d){return{'name':_0xe08a4d[_0xaeaa('0x2c')],'type':_0xe08a4d[_0xaeaa('0x2d')][_0xaeaa('0x2e')]};});_0x17911c[_0xaeaa('0x2f')]=_[_0xaeaa('0x30')](_0x5a98a1,_0xaeaa('0x29'));_0x17911c['query']=_[_0xaeaa('0x31')](_0x375ea5['query']);_0x17911c[_0xaeaa('0x32')]=_[_0xaeaa('0x33')](_0x17911c['model'],_0x17911c['query']);_0x2df3a4[_0xaeaa('0x34')]=_[_0xaeaa('0x33')](_0x17911c['model'],qs[_0xaeaa('0x35')](_0x375ea5[_0xaeaa('0x36')][_0xaeaa('0x35')]));_0x2df3a4[_0xaeaa('0x34')]=_0x2df3a4[_0xaeaa('0x34')][_0xaeaa('0x37')]?_0x2df3a4[_0xaeaa('0x34')]:_0x17911c[_0xaeaa('0x2f')];if(!_0x375ea5[_0xaeaa('0x36')][_0xaeaa('0x38')]('nolimit')){_0x2df3a4[_0xaeaa('0x20')]=qs[_0xaeaa('0x20')](_0x375ea5[_0xaeaa('0x36')][_0xaeaa('0x20')]);_0x2df3a4['offset']=qs[_0xaeaa('0x22')](_0x375ea5[_0xaeaa('0x36')][_0xaeaa('0x22')]);}_0x2df3a4[_0xaeaa('0x39')]=qs[_0xaeaa('0x3a')](_0x375ea5[_0xaeaa('0x36')][_0xaeaa('0x3a')]);_0x2df3a4['where']=qs[_0xaeaa('0x32')](_[_0xaeaa('0x3b')](_0x375ea5[_0xaeaa('0x36')],_0x17911c[_0xaeaa('0x32')]),_0x5a98a1);if(_0x375ea5[_0xaeaa('0x36')][_0xaeaa('0x3c')]){_0x2df3a4[_0xaeaa('0x3d')]=_[_0xaeaa('0x3e')](_0x2df3a4[_0xaeaa('0x3d')],{'$or':_['map'](_0x5a98a1,function(_0x58128c){if(_0x58128c[_0xaeaa('0x2d')]!==_0xaeaa('0x3f')){var _0x951ecb={};_0x951ecb[_0x58128c[_0xaeaa('0x29')]]={'$like':'%'+_0x375ea5[_0xaeaa('0x36')][_0xaeaa('0x3c')]+'%'};return _0x951ecb;}})});}_0x2df3a4=_[_0xaeaa('0x3e')]({},_0x2df3a4,_0x375ea5[_0xaeaa('0x40')]);var _0x65828c={'where':_0x2df3a4[_0xaeaa('0x3d')]};return db['ChatInternalMessage'][_0xaeaa('0x21')](_0x65828c)[_0xaeaa('0x26')](function(_0x2a2352){_0x24b415[_0xaeaa('0x21')]=_0x2a2352;if(_0x375ea5['query']['includeAll']){_0x2df3a4['include']=[{'all':!![]}];}return db[_0xaeaa('0x41')]['findAll'](_0x2df3a4);})['then'](function(_0x1c074f){_0x24b415[_0xaeaa('0x42')]=_0x1c074f;return _0x24b415;})[_0xaeaa('0x26')](respondWithFilteredResult(_0xdee91,_0x2df3a4))[_0xaeaa('0x43')](handleError(_0xdee91,null));};exports[_0xaeaa('0x44')]=function(_0x307e22,_0x3f1a1e){var _0x2aed36={'raw':!![],'where':{'id':_0x307e22[_0xaeaa('0x45')]['id']}},_0x585193={};_0x585193['model']=_['keys'](db['ChatInternalMessage'][_0xaeaa('0x46')]);_0x585193[_0xaeaa('0x36')]=_[_0xaeaa('0x31')](_0x307e22[_0xaeaa('0x36')]);_0x585193[_0xaeaa('0x32')]=_['intersection'](_0x585193[_0xaeaa('0x2f')],_0x585193['query']);_0x2aed36[_0xaeaa('0x34')]=_[_0xaeaa('0x33')](_0x585193[_0xaeaa('0x2f')],qs[_0xaeaa('0x35')](_0x307e22[_0xaeaa('0x36')][_0xaeaa('0x35')]));_0x2aed36['attributes']=_0x2aed36[_0xaeaa('0x34')][_0xaeaa('0x37')]?_0x2aed36['attributes']:_0x585193[_0xaeaa('0x2f')];if(_0x307e22[_0xaeaa('0x36')]['includeAll']){_0x2aed36[_0xaeaa('0x47')]=[{'all':!![]}];}_0x2aed36=_[_0xaeaa('0x3e')]({},_0x2aed36,_0x307e22[_0xaeaa('0x40')]);return db[_0xaeaa('0x41')][_0xaeaa('0x48')](_0x2aed36)[_0xaeaa('0x26')](handleEntityNotFound(_0x3f1a1e,null))[_0xaeaa('0x26')](respondWithResult(_0x3f1a1e,null))['catch'](handleError(_0x3f1a1e,null));};exports[_0xaeaa('0x49')]=function(_0x310168,_0x24b451){return db[_0xaeaa('0x41')][_0xaeaa('0x49')](_0x310168[_0xaeaa('0x4a')],{})[_0xaeaa('0x26')](respondWithResult(_0x24b451,0xc9))[_0xaeaa('0x43')](handleError(_0x24b451,null));};exports[_0xaeaa('0x4b')]=function(_0x5214fa,_0x2cd5cc){if(_0x5214fa[_0xaeaa('0x4a')]['id']){delete _0x5214fa[_0xaeaa('0x4a')]['id'];}return db[_0xaeaa('0x41')][_0xaeaa('0x48')]({'where':{'id':_0x5214fa[_0xaeaa('0x45')]['id']}})[_0xaeaa('0x26')](handleEntityNotFound(_0x2cd5cc,null))[_0xaeaa('0x26')](saveUpdates(_0x5214fa['body'],null))['then'](respondWithResult(_0x2cd5cc,null))[_0xaeaa('0x43')](handleError(_0x2cd5cc,null));};exports['destroy']=function(_0x13634b,_0x41600b){return db[_0xaeaa('0x41')][_0xaeaa('0x48')]({'where':{'id':_0x13634b[_0xaeaa('0x45')]['id']}})[_0xaeaa('0x26')](handleEntityNotFound(_0x41600b,null))['then'](removeEntity(_0x41600b,null))[_0xaeaa('0x43')](handleError(_0x41600b,null));};exports[_0xaeaa('0x4c')]=function(_0x119fd4,_0x5dd612){return db['ChatInternalMessage']['describe']()[_0xaeaa('0x26')](respondWithResult(_0x5dd612,null))[_0xaeaa('0x43')](handleError(_0x5dd612,null));};function wrapUser(_0x73107d){return function(_0x1fd806){var _0x58b3e0=_0x73107d[_0xaeaa('0x4d')]({'plain':!![]});_0x58b3e0[_0xaeaa('0x4e')]=[];if(_0x1fd806){_0x58b3e0[_0xaeaa('0x4f')]=_0x1fd806[_0xaeaa('0x50')];_0x58b3e0[_0xaeaa('0x51')]=_0x1fd806;}else{_0x58b3e0[_0xaeaa('0x4f')]=moment(0x0)['format'](_0xaeaa('0x52'));_0x58b3e0[_0xaeaa('0x51')]={};}return _0x58b3e0;};}exports['getUsers']=function(_0x38ed82,_0x4a442d,_0x298493){var _0x5e666c=[];return db[_0xaeaa('0x53')][_0xaeaa('0x54')]({'where':{'role':[_0xaeaa('0x55'),'admin',_0xaeaa('0x56')]},'attributes':['id',_0xaeaa('0x57'),_0xaeaa('0x29'),_0xaeaa('0x58'),_0xaeaa('0x59'),_0xaeaa('0x5a'),_0xaeaa('0x5b'),'lastLoginAt',_0xaeaa('0x5c'),_0xaeaa('0x5d')],'order':qs[_0xaeaa('0x3a')](_0xaeaa('0x5e')),'include':[{'model':db[_0xaeaa('0x5f')],'as':_0xaeaa('0x60'),'attributes':['id','name',_0xaeaa('0x2d')],'through':{'attributes':[]}}]})[_0xaeaa('0x26')](function(_0x387295){if(_0x387295){var _0xdcc034=_0x38ed82[_0xaeaa('0x56')][_0xaeaa('0x4d')]({'plain':!![]});if(!_0xdcc034)throw new Error(_0xaeaa('0x61'));if(_0xdcc034[_0xaeaa('0x58')]===_0xaeaa('0x56')){return db[_0xaeaa('0x62')][_0xaeaa('0x48')]({'where':{'name':_0xaeaa('0x63'),'userProfileId':_0xdcc034[_0xaeaa('0x64')]},'raw':!![]})[_0xaeaa('0x26')](function(_0x3458f4){if(_0x3458f4){if(_0x3458f4[_0xaeaa('0x65')]===0x0){return db[_0xaeaa('0x66')]['findAll']({'where':{'sectionId':_0x3458f4['id']},'raw':!![]})[_0xaeaa('0x26')](function(_0x563c4d){var _0x211211=[];if(_[_0xaeaa('0x67')](_0x563c4d)){_0x211211=_[_0xaeaa('0x3c')](_0x387295,function(_0x3523fe){if(_0x3523fe[_0xaeaa('0x58')]!==_0xaeaa('0x55')){return _0x3523fe;}});return _0x211211;}else{for(var _0x1fd761=0x0;_0x1fd761<_0x387295[_0xaeaa('0x37')];_0x1fd761++){var _0x4ccd21=_0x387295[_0x1fd761];if(_0x4ccd21['role']===_0xaeaa('0x55')){var _0x4f125e=_['find'](_0x563c4d,function(_0x284b43){return _0x284b43[_0xaeaa('0x68')]===_0x4ccd21['id'];});if(_0x4f125e)_0x211211[_0xaeaa('0x69')](_0x4ccd21);}else{_0x211211[_0xaeaa('0x69')](_0x4ccd21);}}return _0x211211;}});}else{return _0x387295;}}else{var _0x654dcf=_['filter'](_0x387295,function(_0x261bf1){if(_0x261bf1[_0xaeaa('0x58')]!==_0xaeaa('0x55')){return _0x261bf1;}});return _0x654dcf;}});}else{return _0x387295;}}})[_0xaeaa('0x26')](function(_0x35617b){var _0x581620=[];if(_0x35617b){_0x5e666c=_0x35617b;for(var _0x23b37d=0x0;_0x23b37d<_0x35617b[_0xaeaa('0x37')];_0x23b37d+=0x1){_0x5e666c[_0x23b37d][_0xaeaa('0x4e')]=[];_0x581620[_0xaeaa('0x69')](db['ChatInternalMessage'][_0xaeaa('0x48')]({'where':{'FromId':[_0x38ed82['user']['id'],_0x35617b[_0x23b37d]['id']],'ToId':[_0x38ed82[_0xaeaa('0x56')]['id'],_0x35617b[_0x23b37d]['id']],'ChatGroupId':null},'attributes':['id',_0xaeaa('0x50'),_0xaeaa('0x6a'),'ToId',_0xaeaa('0x6b'),_0xaeaa('0x4a')],'order':qs[_0xaeaa('0x3a')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xaeaa('0x26')](wrapUser(_0x35617b[_0x23b37d])));}return BPromise['all'](_0x581620);}return[];})[_0xaeaa('0x26')](function(_0x6de5e3){return{'rows':_0x6de5e3,'count':_0x6de5e3[_0xaeaa('0x37')]};})[_0xaeaa('0x26')](respondWithResult(_0x4a442d,null))['catch'](handleError(_0x4a442d,null));}; \ No newline at end of file +var _0xee3a=['fields','length','limit','order','sort','where','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','keys','find','create','body','describe','get','lastMessageAt','createdAt','lastMessage','format','getUsers','agent','admin','fullname','userpic','-online','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','isEmpty','push','messages','FromId','ToId','-createdAt','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','localhost','socket.io-emitter','redis','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','model','query','filters','intersection','attributes'];(function(_0xebb784,_0x431f7c){var _0x24d1ba=function(_0x78096f){while(--_0x78096f){_0xebb784['push'](_0xebb784['shift']());}};_0x24d1ba(++_0x431f7c);}(_0xee3a,0x1b9));var _0xaee3=function(_0x377267,_0x5e21e7){_0x377267=_0x377267-0x0;var _0x3db86e=_0xee3a[_0x377267];return _0x3db86e;};'use strict';var emlformat=require(_0xaee3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xaee3('0x1'));var jsonpatch=require(_0xaee3('0x2'));var rp=require(_0xaee3('0x3'));var moment=require(_0xaee3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaee3('0x5'));var path=require(_0xaee3('0x6'));var sox=require(_0xaee3('0x7'));var csv=require('to-csv');var ejs=require(_0xaee3('0x8'));var fs=require('fs');var fs_extra=require(_0xaee3('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaee3('0xa'));var jsforce=require(_0xaee3('0xb'));var deskjs=require(_0xaee3('0xc'));var toCsv=require('to-csv');var querystring=require(_0xaee3('0xd'));var Papa=require(_0xaee3('0xe'));var Redis=require(_0xaee3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xaee3('0x10'));var as=require(_0xaee3('0x11'));var hardwareService=require(_0xaee3('0x12'));var logger=require(_0xaee3('0x13'))(_0xaee3('0x14'));var utils=require(_0xaee3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xaee3('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xaee3('0x17'),'port':0x18eb});var socket=require(_0xaee3('0x18'))(new Redis(config[_0xaee3('0x19')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x56dbc8,_0x3335c8){_0x3335c8=_0x3335c8||0xcc;return function(_0x167c79){if(_0x167c79){return _0x56dbc8[_0xaee3('0x1a')](_0x3335c8);}return _0x56dbc8[_0xaee3('0x1b')](_0x3335c8)[_0xaee3('0x1c')]();};}function respondWithResult(_0xc00318,_0x4bb4f6){_0x4bb4f6=_0x4bb4f6||0xc8;return function(_0x35d360){if(_0x35d360){return _0xc00318[_0xaee3('0x1b')](_0x4bb4f6)[_0xaee3('0x1d')](_0x35d360);}};}function respondWithFilteredResult(_0x3ddf4c,_0xbf3703){return function(_0x3a0eaf){if(_0x3a0eaf){var _0x1e5a26=typeof _0xbf3703[_0xaee3('0x1e')]===_0xaee3('0x1f')&&typeof _0xbf3703['limit']===_0xaee3('0x1f');var _0x5efa8d=_0x3a0eaf[_0xaee3('0x20')];var _0x21f18e=_0x1e5a26?0x0:_0xbf3703[_0xaee3('0x1e')];var _0x5347c1=_0x1e5a26?_0x3a0eaf[_0xaee3('0x20')]:_0xbf3703[_0xaee3('0x1e')]+_0xbf3703['limit'];var _0x1ec998;if(_0x5347c1>=_0x5efa8d){_0x5347c1=_0x5efa8d;_0x1ec998=0xc8;}else{_0x1ec998=0xce;}_0x3ddf4c[_0xaee3('0x1b')](_0x1ec998);return _0x3ddf4c[_0xaee3('0x21')](_0xaee3('0x22'),_0x21f18e+'-'+_0x5347c1+'/'+_0x5efa8d)[_0xaee3('0x1d')](_0x3a0eaf);}return null;};}function patchUpdates(_0x3bb0c7){return function(_0x3ed50f){try{jsonpatch[_0xaee3('0x23')](_0x3ed50f,_0x3bb0c7,!![]);}catch(_0x5457ec){return BPromise['reject'](_0x5457ec);}return _0x3ed50f[_0xaee3('0x24')]();};}function saveUpdates(_0x2c03aa,_0x4e38b5){return function(_0x2216b6){if(_0x2216b6){return _0x2216b6[_0xaee3('0x25')](_0x2c03aa)['then'](function(_0x5a4fcd){return _0x5a4fcd;});}return null;};}function removeEntity(_0x251c74,_0x408956){return function(_0x228f94){if(_0x228f94){return _0x228f94[_0xaee3('0x26')]()[_0xaee3('0x27')](function(){_0x251c74[_0xaee3('0x1b')](0xcc)[_0xaee3('0x1c')]();});}};}function handleEntityNotFound(_0x5b1375,_0x51bf6b){return function(_0x3a4d78){if(!_0x3a4d78){_0x5b1375['sendStatus'](0x194);}return _0x3a4d78;};}function handleError(_0x3bff74,_0x3da37c){_0x3da37c=_0x3da37c||0x1f4;return function(_0x523c12){logger[_0xaee3('0x28')](_0x523c12[_0xaee3('0x29')]);if(_0x523c12[_0xaee3('0x2a')]){delete _0x523c12[_0xaee3('0x2a')];}_0x3bff74['status'](_0x3da37c)[_0xaee3('0x2b')](_0x523c12);};}exports[_0xaee3('0x2c')]=function(_0x57274c,_0x23b404){var _0xafa98a={},_0x17cf44={},_0x5e81f5={'count':0x0,'rows':[]};var _0x755652=_[_0xaee3('0x2d')](db[_0xaee3('0x2e')][_0xaee3('0x2f')],function(_0x4424fc){return{'name':_0x4424fc[_0xaee3('0x30')],'type':_0x4424fc['type']['key']};});_0x17cf44[_0xaee3('0x31')]=_['map'](_0x755652,_0xaee3('0x2a'));_0x17cf44['query']=_['keys'](_0x57274c[_0xaee3('0x32')]);_0x17cf44[_0xaee3('0x33')]=_[_0xaee3('0x34')](_0x17cf44[_0xaee3('0x31')],_0x17cf44[_0xaee3('0x32')]);_0xafa98a[_0xaee3('0x35')]=_[_0xaee3('0x34')](_0x17cf44[_0xaee3('0x31')],qs[_0xaee3('0x36')](_0x57274c[_0xaee3('0x32')][_0xaee3('0x36')]));_0xafa98a[_0xaee3('0x35')]=_0xafa98a[_0xaee3('0x35')][_0xaee3('0x37')]?_0xafa98a[_0xaee3('0x35')]:_0x17cf44[_0xaee3('0x31')];if(!_0x57274c[_0xaee3('0x32')]['hasOwnProperty']('nolimit')){_0xafa98a[_0xaee3('0x38')]=qs[_0xaee3('0x38')](_0x57274c[_0xaee3('0x32')][_0xaee3('0x38')]);_0xafa98a['offset']=qs[_0xaee3('0x1e')](_0x57274c[_0xaee3('0x32')][_0xaee3('0x1e')]);}_0xafa98a[_0xaee3('0x39')]=qs[_0xaee3('0x3a')](_0x57274c['query'][_0xaee3('0x3a')]);_0xafa98a[_0xaee3('0x3b')]=qs['filters'](_['pick'](_0x57274c[_0xaee3('0x32')],_0x17cf44[_0xaee3('0x33')]),_0x755652);if(_0x57274c['query'][_0xaee3('0x3c')]){_0xafa98a[_0xaee3('0x3b')]=_['merge'](_0xafa98a[_0xaee3('0x3b')],{'$or':_[_0xaee3('0x2d')](_0x755652,function(_0x5cf7ee){if(_0x5cf7ee[_0xaee3('0x3d')]!==_0xaee3('0x3e')){var _0x24671d={};_0x24671d[_0x5cf7ee['name']]={'$like':'%'+_0x57274c[_0xaee3('0x32')][_0xaee3('0x3c')]+'%'};return _0x24671d;}})});}_0xafa98a=_[_0xaee3('0x3f')]({},_0xafa98a,_0x57274c[_0xaee3('0x40')]);var _0x31d1a2={'where':_0xafa98a['where']};return db[_0xaee3('0x2e')][_0xaee3('0x20')](_0x31d1a2)[_0xaee3('0x27')](function(_0x1a3baf){_0x5e81f5[_0xaee3('0x20')]=_0x1a3baf;if(_0x57274c[_0xaee3('0x32')]['includeAll']){_0xafa98a[_0xaee3('0x41')]=[{'all':!![]}];}return db[_0xaee3('0x2e')][_0xaee3('0x42')](_0xafa98a);})[_0xaee3('0x27')](function(_0x1e777d){_0x5e81f5[_0xaee3('0x43')]=_0x1e777d;return _0x5e81f5;})[_0xaee3('0x27')](respondWithFilteredResult(_0x23b404,_0xafa98a))[_0xaee3('0x44')](handleError(_0x23b404,null));};exports[_0xaee3('0x45')]=function(_0x375828,_0x44a8f7){var _0x3c37a0={'raw':!![],'where':{'id':_0x375828[_0xaee3('0x46')]['id']}},_0x59ddb4={};_0x59ddb4[_0xaee3('0x31')]=_[_0xaee3('0x47')](db[_0xaee3('0x2e')]['rawAttributes']);_0x59ddb4[_0xaee3('0x32')]=_[_0xaee3('0x47')](_0x375828[_0xaee3('0x32')]);_0x59ddb4[_0xaee3('0x33')]=_[_0xaee3('0x34')](_0x59ddb4[_0xaee3('0x31')],_0x59ddb4[_0xaee3('0x32')]);_0x3c37a0[_0xaee3('0x35')]=_[_0xaee3('0x34')](_0x59ddb4[_0xaee3('0x31')],qs[_0xaee3('0x36')](_0x375828[_0xaee3('0x32')][_0xaee3('0x36')]));_0x3c37a0[_0xaee3('0x35')]=_0x3c37a0[_0xaee3('0x35')]['length']?_0x3c37a0[_0xaee3('0x35')]:_0x59ddb4[_0xaee3('0x31')];if(_0x375828[_0xaee3('0x32')]['includeAll']){_0x3c37a0['include']=[{'all':!![]}];}_0x3c37a0=_[_0xaee3('0x3f')]({},_0x3c37a0,_0x375828[_0xaee3('0x40')]);return db[_0xaee3('0x2e')][_0xaee3('0x48')](_0x3c37a0)[_0xaee3('0x27')](handleEntityNotFound(_0x44a8f7,null))[_0xaee3('0x27')](respondWithResult(_0x44a8f7,null))[_0xaee3('0x44')](handleError(_0x44a8f7,null));};exports['create']=function(_0x404104,_0x2d499a){return db[_0xaee3('0x2e')][_0xaee3('0x49')](_0x404104[_0xaee3('0x4a')],{})[_0xaee3('0x27')](respondWithResult(_0x2d499a,0xc9))[_0xaee3('0x44')](handleError(_0x2d499a,null));};exports[_0xaee3('0x25')]=function(_0x33e82c,_0x5c9c8c){if(_0x33e82c[_0xaee3('0x4a')]['id']){delete _0x33e82c[_0xaee3('0x4a')]['id'];}return db[_0xaee3('0x2e')][_0xaee3('0x48')]({'where':{'id':_0x33e82c[_0xaee3('0x46')]['id']}})[_0xaee3('0x27')](handleEntityNotFound(_0x5c9c8c,null))[_0xaee3('0x27')](saveUpdates(_0x33e82c[_0xaee3('0x4a')],null))['then'](respondWithResult(_0x5c9c8c,null))[_0xaee3('0x44')](handleError(_0x5c9c8c,null));};exports[_0xaee3('0x26')]=function(_0x49cdee,_0xdc6387){return db[_0xaee3('0x2e')]['find']({'where':{'id':_0x49cdee['params']['id']}})['then'](handleEntityNotFound(_0xdc6387,null))[_0xaee3('0x27')](removeEntity(_0xdc6387,null))[_0xaee3('0x44')](handleError(_0xdc6387,null));};exports[_0xaee3('0x4b')]=function(_0x156893,_0x1012d0){return db[_0xaee3('0x2e')][_0xaee3('0x4b')]()[_0xaee3('0x27')](respondWithResult(_0x1012d0,null))[_0xaee3('0x44')](handleError(_0x1012d0,null));};function wrapUser(_0x84ddf3){return function(_0x45ab32){var _0x1bca23=_0x84ddf3[_0xaee3('0x4c')]({'plain':!![]});_0x1bca23['messages']=[];if(_0x45ab32){_0x1bca23[_0xaee3('0x4d')]=_0x45ab32[_0xaee3('0x4e')];_0x1bca23[_0xaee3('0x4f')]=_0x45ab32;}else{_0x1bca23['lastMessageAt']=moment(0x0)[_0xaee3('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x1bca23[_0xaee3('0x4f')]={};}return _0x1bca23;};}exports[_0xaee3('0x51')]=function(_0x497d1c,_0x19aef4,_0x512f08){var _0x228246=[];return db['User'][_0xaee3('0x42')]({'where':{'role':[_0xaee3('0x52'),_0xaee3('0x53'),'user']},'attributes':['id',_0xaee3('0x54'),_0xaee3('0x2a'),'role',_0xaee3('0x55'),'internal','online','lastLoginAt','allowmessenger','showWebBar'],'order':qs[_0xaee3('0x3a')](_0xaee3('0x56')),'include':[{'model':db['VoiceQueue'],'as':_0xaee3('0x57'),'attributes':['id',_0xaee3('0x2a'),'type'],'through':{'attributes':[]}}]})[_0xaee3('0x27')](function(_0x46cc5){if(_0x46cc5){var _0x5c0e15=_0x497d1c[_0xaee3('0x58')][_0xaee3('0x4c')]({'plain':!![]});if(!_0x5c0e15)throw new Error(_0xaee3('0x59'));if(_0x5c0e15[_0xaee3('0x5a')]===_0xaee3('0x58')){return db['UserProfileSection']['find']({'where':{'name':'Agents','userProfileId':_0x5c0e15[_0xaee3('0x5b')]},'raw':!![]})[_0xaee3('0x27')](function(_0x1f7683){if(_0x1f7683){if(_0x1f7683['autoAssociation']===0x0){return db[_0xaee3('0x5c')][_0xaee3('0x42')]({'where':{'sectionId':_0x1f7683['id']},'raw':!![]})[_0xaee3('0x27')](function(_0x10732c){var _0x532c58=[];if(_[_0xaee3('0x5d')](_0x10732c)){_0x532c58=_[_0xaee3('0x3c')](_0x46cc5,function(_0x4fa451){if(_0x4fa451[_0xaee3('0x5a')]!==_0xaee3('0x52')){return _0x4fa451;}});return _0x532c58;}else{for(var _0x4034ad=0x0;_0x4034ad<_0x46cc5['length'];_0x4034ad++){var _0x2573a6=_0x46cc5[_0x4034ad];if(_0x2573a6[_0xaee3('0x5a')]===_0xaee3('0x52')){var _0x247289=_['find'](_0x10732c,function(_0x5bd044){return _0x5bd044['resourceId']===_0x2573a6['id'];});if(_0x247289)_0x532c58[_0xaee3('0x5e')](_0x2573a6);}else{_0x532c58[_0xaee3('0x5e')](_0x2573a6);}}return _0x532c58;}});}else{return _0x46cc5;}}else{var _0x2a9c76=_['filter'](_0x46cc5,function(_0x1c5ff0){if(_0x1c5ff0[_0xaee3('0x5a')]!==_0xaee3('0x52')){return _0x1c5ff0;}});return _0x2a9c76;}});}else{return _0x46cc5;}}})['then'](function(_0x141d51){var _0x85ae15=[];if(_0x141d51){_0x228246=_0x141d51;for(var _0x4e27d3=0x0;_0x4e27d3<_0x141d51[_0xaee3('0x37')];_0x4e27d3+=0x1){_0x228246[_0x4e27d3][_0xaee3('0x5f')]=[];_0x85ae15['push'](db['ChatInternalMessage'][_0xaee3('0x48')]({'where':{'FromId':[_0x497d1c[_0xaee3('0x58')]['id'],_0x141d51[_0x4e27d3]['id']],'ToId':[_0x497d1c[_0xaee3('0x58')]['id'],_0x141d51[_0x4e27d3]['id']],'ChatGroupId':null},'attributes':['id',_0xaee3('0x4e'),_0xaee3('0x60'),_0xaee3('0x61'),'read',_0xaee3('0x4a')],'order':qs[_0xaee3('0x3a')](_0xaee3('0x62')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x141d51[_0x4e27d3])));}return BPromise['all'](_0x85ae15);}return[];})[_0xaee3('0x27')](function(_0x118753){return{'rows':_0x118753,'count':_0x118753[_0xaee3('0x37')]};})[_0xaee3('0x27')](respondWithResult(_0x19aef4,null))['catch'](handleError(_0x19aef4,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index b4aa15f..12a3a99 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 _0x5cf8=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb','ChatInternalMessage'];(function(_0xa6cb09,_0x39410f){var _0x12b437=function(_0x1813cc){while(--_0x1813cc){_0xa6cb09['push'](_0xa6cb09['shift']());}};_0x12b437(++_0x39410f);}(_0x5cf8,0xf9));var _0x85cf=function(_0x3ce233,_0x58abd8){_0x3ce233=_0x3ce233-0x0;var _0x48c0cc=_0x5cf8[_0x3ce233];return _0x48c0cc;};'use strict';var EventEmitter=require(_0x85cf('0x0'));var ChatInternalMessage=require(_0x85cf('0x1'))['db'][_0x85cf('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x85cf('0x3')](0x0);var events={'afterCreate':_0x85cf('0x4'),'afterUpdate':_0x85cf('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4be9b7){return function(_0x21624b,_0x2437eb,_0x3f3360){ChatInternalMessageEvents[_0x85cf('0x6')](_0x4be9b7+':'+_0x21624b['id'],_0x21624b);ChatInternalMessageEvents[_0x85cf('0x6')](_0x4be9b7,_0x21624b);_0x3f3360(null);};}for(var e in events){if(events[_0x85cf('0x7')](e)){var event=events[e];ChatInternalMessage[_0x85cf('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xcfc0=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0x2c36b2,_0x288962){var _0x1ba740=function(_0x241ad3){while(--_0x241ad3){_0x2c36b2['push'](_0x2c36b2['shift']());}};_0x1ba740(++_0x288962);}(_0xcfc0,0x179));var _0x0cfc=function(_0xe10c3e,_0x336f40){_0xe10c3e=_0xe10c3e-0x0;var _0x5608e1=_0xcfc0[_0xe10c3e];return _0x5608e1;};'use strict';var EventEmitter=require(_0x0cfc('0x0'));var ChatInternalMessage=require(_0x0cfc('0x1'))['db'][_0x0cfc('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x0cfc('0x3')](0x0);var events={'afterCreate':_0x0cfc('0x4'),'afterUpdate':_0x0cfc('0x5'),'afterDestroy':_0x0cfc('0x6')};function emitEvent(_0x3c8b6a){return function(_0x53bb39,_0x38e418,_0x226120){ChatInternalMessageEvents[_0x0cfc('0x7')](_0x3c8b6a+':'+_0x53bb39['id'],_0x53bb39);ChatInternalMessageEvents[_0x0cfc('0x7')](_0x3c8b6a,_0x53bb39);_0x226120(null);};}for(var e in events){if(events[_0x0cfc('0x8')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x0cfc('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 33aad5c..119fd19 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 _0x72c1=['../../config/environment','./chatInternalMessage.attributes','exports','chat_internal_messages','utf8mb4_unicode_ci','lodash','util','rimraf'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x72c1,0x105));var _0x172c=function(_0x5c2824,_0x2df2af){_0x5c2824=_0x5c2824-0x0;var _0x3342fe=_0x72c1[_0x5c2824];return _0x3342fe;};'use strict';var _=require(_0x172c('0x0'));var util=require(_0x172c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x172c('0x2'));var config=require(_0x172c('0x3'));var attributes=require(_0x172c('0x4'));module[_0x172c('0x5')]=function(_0x2152d3,_0x3e4b5c){return _0x2152d3['define']('ChatInternalMessage',attributes,{'tableName':_0x172c('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x172c('0x7')});}; \ No newline at end of file +var _0xfa69=['./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1acb02,_0x1a8394){var _0x37dbbe=function(_0x41e06a){while(--_0x41e06a){_0x1acb02['push'](_0x1acb02['shift']());}};_0x37dbbe(++_0x1a8394);}(_0xfa69,0x1d8));var _0x9fa6=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xfa69[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x9fa6('0x0'));var util=require('util');var logger=require(_0x9fa6('0x1'))(_0x9fa6('0x2'));var moment=require(_0x9fa6('0x3'));var BPromise=require(_0x9fa6('0x4'));var rp=require(_0x9fa6('0x5'));var fs=require('fs');var path=require(_0x9fa6('0x6'));var rimraf=require(_0x9fa6('0x7'));var config=require(_0x9fa6('0x8'));var attributes=require(_0x9fa6('0x9'));module[_0x9fa6('0xa')]=function(_0xff6be5,_0x320a84){return _0xff6be5['define'](_0x9fa6('0xb'),attributes,{'tableName':_0x9fa6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 58fa7eb..e1b0f4b 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 _0xe134=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment'];(function(_0x252699,_0x134b4e){var _0x56d0c6=function(_0x5551a8){while(--_0x5551a8){_0x252699['push'](_0x252699['shift']());}};_0x56d0c6(++_0x134b4e);}(_0xe134,0x102));var _0x4e13=function(_0x138281,_0x5e6188){_0x138281=_0x138281-0x0;var _0x535192=_0xe134[_0x138281];return _0x535192;};'use strict';var _=require(_0x4e13('0x0'));var util=require('util');var moment=require(_0x4e13('0x1'));var BPromise=require('bluebird');var rs=require(_0x4e13('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e13('0x3'))['db'];var utils=require(_0x4e13('0x4'));var logger=require('../../config/logger')(_0x4e13('0x5'));var config=require(_0x4e13('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4e13('0x7')][_0x4e13('0x8')]({'port':0x232a});config[_0x4e13('0x9')]=_[_0x4e13('0xa')](config[_0x4e13('0x9')],{'host':_0x4e13('0xb'),'port':0x18eb});var socket=require(_0x4e13('0xc'))(new Redis(config[_0x4e13('0x9')]));require(_0x4e13('0xd'))[_0x4e13('0xe')](socket);function respondWithRpcPromise(_0x430970,_0xccc796,_0x3beec1){return new BPromise(function(_0x4a802e,_0x2e6ac0){return client[_0x4e13('0xf')](_0x430970,_0x3beec1)[_0x4e13('0x10')](function(_0xc3f27e){logger[_0x4e13('0x11')](_0x4e13('0x12'),_0xccc796,_0x4e13('0x13'));logger[_0x4e13('0x14')](_0x4e13('0x15'),_0xccc796,'request\x20sent',JSON['stringify'](_0xc3f27e));if(_0xc3f27e[_0x4e13('0x16')]){if(_0xc3f27e[_0x4e13('0x16')][_0x4e13('0x17')]===0x1f4){logger['error'](_0x4e13('0x12'),_0xccc796,_0xc3f27e[_0x4e13('0x16')][_0x4e13('0x18')]);return _0x2e6ac0(_0xc3f27e[_0x4e13('0x16')][_0x4e13('0x18')]);}logger['error'](_0x4e13('0x12'),_0xccc796,_0xc3f27e[_0x4e13('0x16')][_0x4e13('0x18')]);return _0x4a802e(_0xc3f27e[_0x4e13('0x16')][_0x4e13('0x18')]);}else{logger[_0x4e13('0x11')](_0x4e13('0x12'),_0xccc796,'request\x20sent');_0x4a802e(_0xc3f27e[_0x4e13('0x19')]['message']);}})['catch'](function(_0x20db43){logger['error'](_0x4e13('0x12'),_0xccc796,_0x20db43);_0x2e6ac0(_0x20db43);});});} \ No newline at end of file +var _0xf73a=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x427249,_0x360587){var _0x5ad328=function(_0x3af302){while(--_0x3af302){_0x427249['push'](_0x427249['shift']());}};_0x5ad328(++_0x360587);}(_0xf73a,0x115));var _0xaf73=function(_0x3cb65e,_0x24dbcd){_0x3cb65e=_0x3cb65e-0x0;var _0x45c3fa=_0xf73a[_0x3cb65e];return _0x45c3fa;};'use strict';var _=require(_0xaf73('0x0'));var util=require(_0xaf73('0x1'));var moment=require('moment');var BPromise=require(_0xaf73('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaf73('0x3'));var db=require(_0xaf73('0x4'))['db'];var utils=require(_0xaf73('0x5'));var logger=require(_0xaf73('0x6'))(_0xaf73('0x7'));var config=require(_0xaf73('0x8'));var jayson=require(_0xaf73('0x9'));var client=jayson[_0xaf73('0xa')][_0xaf73('0xb')]({'port':0x232a});config[_0xaf73('0xc')]=_[_0xaf73('0xd')](config['redis'],{'host':_0xaf73('0xe'),'port':0x18eb});var socket=require(_0xaf73('0xf'))(new Redis(config[_0xaf73('0xc')]));require(_0xaf73('0x10'))[_0xaf73('0x11')](socket);function respondWithRpcPromise(_0x5116bb,_0x83ce19,_0x29d6b9){return new BPromise(function(_0x524b95,_0x5158f3){return client[_0xaf73('0x12')](_0x5116bb,_0x29d6b9)[_0xaf73('0x13')](function(_0x451168){logger[_0xaf73('0x14')](_0xaf73('0x15'),_0x83ce19,_0xaf73('0x16'));logger['debug'](_0xaf73('0x17'),_0x83ce19,_0xaf73('0x16'),JSON[_0xaf73('0x18')](_0x451168));if(_0x451168[_0xaf73('0x19')]){if(_0x451168[_0xaf73('0x19')][_0xaf73('0x1a')]===0x1f4){logger['error'](_0xaf73('0x15'),_0x83ce19,_0x451168[_0xaf73('0x19')][_0xaf73('0x1b')]);return _0x5158f3(_0x451168[_0xaf73('0x19')][_0xaf73('0x1b')]);}logger[_0xaf73('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x83ce19,_0x451168[_0xaf73('0x19')][_0xaf73('0x1b')]);return _0x524b95(_0x451168[_0xaf73('0x19')][_0xaf73('0x1b')]);}else{logger['info'](_0xaf73('0x15'),_0x83ce19,'request\x20sent');_0x524b95(_0x451168[_0xaf73('0x1c')][_0xaf73('0x1b')]);}})[_0xaf73('0x1d')](function(_0x51b7ea){logger[_0xaf73('0x19')](_0xaf73('0x15'),_0x83ce19,_0x51b7ea);_0x5158f3(_0x51b7ea);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 422e409..44f227a 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 _0xbb0a=['removeListener','register','length','remove','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbb0a,0xad));var _0xabb0=function(_0x562ec0,_0x5692e3){_0x562ec0=_0x562ec0-0x0;var _0x213d70=_0xbb0a[_0x562ec0];return _0x213d70;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0xabb0('0x0'),_0xabb0('0x1')];function createListener(_0x3a5f5b,_0x144f27){return function(_0x4ce766){_0x144f27['emit'](_0x3a5f5b,_0x4ce766);};}function removeListener(_0x18a2cd,_0x44bd80){return function(){ChatInternalMessageEvents[_0xabb0('0x2')](_0x18a2cd,_0x44bd80);};}exports[_0xabb0('0x3')]=function(_0x1afca2){for(var _0x260568=0x0,_0x2f9fd5=events[_0xabb0('0x4')];_0x260568<_0x2f9fd5;_0x260568++){var _0x38a5c3=events[_0x260568];var _0x2be81a=createListener('chatInternalMessage:'+_0x38a5c3,_0x1afca2);ChatInternalMessageEvents['on'](_0x38a5c3,_0x2be81a);}}; \ No newline at end of file +var _0xdea9=['remove','update','removeListener','register','length','chatInternalMessage:'];(function(_0x42208a,_0x4a2177){var _0x12eb0f=function(_0x412d6e){while(--_0x412d6e){_0x42208a['push'](_0x42208a['shift']());}};_0x12eb0f(++_0x4a2177);}(_0xdea9,0x192));var _0x9dea=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdea9[_0x167cc1];return _0x10bc4b;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save',_0x9dea('0x0'),_0x9dea('0x1')];function createListener(_0x1aac80,_0x31a153){return function(_0x4fdc34){_0x31a153['emit'](_0x1aac80,_0x4fdc34);};}function removeListener(_0x48ec1e,_0x2e5450){return function(){ChatInternalMessageEvents[_0x9dea('0x2')](_0x48ec1e,_0x2e5450);};}exports[_0x9dea('0x3')]=function(_0xd5c5f3){for(var _0x39f647=0x0,_0x3de04d=events[_0x9dea('0x4')];_0x39f647<_0x3de04d;_0x39f647++){var _0x33ca85=events[_0x39f647];var _0xdf5285=createListener(_0x9dea('0x5')+_0x33ca85,_0xd5c5f3);ChatInternalMessageEvents['on'](_0x33ca85,_0xdf5285);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index ad2a45b..796fecc 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 _0x5d21=['getUsers','/:id','show','post','create','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','index','/describe','isAuthenticated','describe','/users'];(function(_0x5a7c14,_0xfe838a){var _0x28ed61=function(_0x406c1d){while(--_0x406c1d){_0x5a7c14['push'](_0x5a7c14['shift']());}};_0x28ed61(++_0xfe838a);}(_0x5d21,0x178));var _0x15d2=function(_0x21f855,_0x443370){_0x21f855=_0x21f855-0x0;var _0x543a1c=_0x5d21[_0x21f855];return _0x543a1c;};'use strict';var multer=require(_0x15d2('0x0'));var util=require(_0x15d2('0x1'));var path=require('path');var timeout=require(_0x15d2('0x2'));var express=require(_0x15d2('0x3'));var router=express[_0x15d2('0x4')]();var fs_extra=require(_0x15d2('0x5'));var auth=require(_0x15d2('0x6'));var interaction=require(_0x15d2('0x7'));var config=require('../../config/environment');var controller=require(_0x15d2('0x8'));router[_0x15d2('0x9')]('/',auth['isAuthenticated'](),controller[_0x15d2('0xa')]);router[_0x15d2('0x9')](_0x15d2('0xb'),auth[_0x15d2('0xc')](),controller[_0x15d2('0xd')]);router[_0x15d2('0x9')](_0x15d2('0xe'),auth[_0x15d2('0xc')](),controller[_0x15d2('0xf')]);router[_0x15d2('0x9')](_0x15d2('0x10'),auth['isAuthenticated'](),controller[_0x15d2('0x11')]);router[_0x15d2('0x12')]('/',auth[_0x15d2('0xc')](),controller[_0x15d2('0x13')]);router['put'](_0x15d2('0x10'),controller[_0x15d2('0x14')]);router[_0x15d2('0x15')](_0x15d2('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x15d2('0x16')]=router; \ No newline at end of file +var _0xabad=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','create','put','update','delete','destroy'];(function(_0xb661b9,_0x4eae7b){var _0x105b16=function(_0x4da662){while(--_0x4da662){_0xb661b9['push'](_0xb661b9['shift']());}};_0x105b16(++_0x4eae7b);}(_0xabad,0x191));var _0xdaba=function(_0x5ba8fc,_0x3120dd){_0x5ba8fc=_0x5ba8fc-0x0;var _0x974890=_0xabad[_0x5ba8fc];return _0x974890;};'use strict';var multer=require(_0xdaba('0x0'));var util=require('util');var path=require(_0xdaba('0x1'));var timeout=require(_0xdaba('0x2'));var express=require(_0xdaba('0x3'));var router=express[_0xdaba('0x4')]();var fs_extra=require(_0xdaba('0x5'));var auth=require(_0xdaba('0x6'));var interaction=require(_0xdaba('0x7'));var config=require(_0xdaba('0x8'));var controller=require(_0xdaba('0x9'));router[_0xdaba('0xa')]('/',auth[_0xdaba('0xb')](),controller[_0xdaba('0xc')]);router[_0xdaba('0xa')](_0xdaba('0xd'),auth[_0xdaba('0xb')](),controller[_0xdaba('0xe')]);router[_0xdaba('0xa')](_0xdaba('0xf'),auth['isAuthenticated'](),controller[_0xdaba('0x10')]);router['get'](_0xdaba('0x11'),auth['isAuthenticated'](),controller[_0xdaba('0x12')]);router['post']('/',auth[_0xdaba('0xb')](),controller[_0xdaba('0x13')]);router[_0xdaba('0x14')](_0xdaba('0x11'),controller[_0xdaba('0x15')]);router[_0xdaba('0x16')](_0xdaba('0x11'),auth['isAuthenticated'](),controller[_0xdaba('0x17')]);module[_0xdaba('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 7fca2d8..e6a91c0 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 _0x5423=['out','DATE','TEXT','sequelize','exports','medium','BOOLEAN','ENUM'];(function(_0x5734ac,_0x326c9b){var _0x502ad9=function(_0x10aa82){while(--_0x10aa82){_0x5734ac['push'](_0x5734ac['shift']());}};_0x502ad9(++_0x326c9b);}(_0x5423,0xe3));var _0x3542=function(_0x4dea73,_0xf30851){_0x4dea73=_0x4dea73-0x0;var _0x103229=_0x5423[_0x4dea73];return _0x103229;};'use strict';var Sequelize=require(_0x3542('0x0'));module[_0x3542('0x1')]={'body':{'type':Sequelize['TEXT'](_0x3542('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3542('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3542('0x4')]('in',_0x3542('0x5')),'defaultValue':_0x3542('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x3542('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x3542('0x7')]}}; \ No newline at end of file +var _0x69d3=['TEXT','BOOLEAN','out','sequelize','exports'];(function(_0x107fb8,_0x1503dc){var _0x193322=function(_0x538e64){while(--_0x538e64){_0x107fb8['push'](_0x107fb8['shift']());}};_0x193322(++_0x1503dc);}(_0x69d3,0xda));var _0x369d=function(_0x5d2e01,_0x25fb5c){_0x5d2e01=_0x5d2e01-0x0;var _0x44dd1=_0x69d3[_0x5d2e01];return _0x44dd1;};'use strict';var Sequelize=require(_0x369d('0x0'));module[_0x369d('0x1')]={'body':{'type':Sequelize[_0x369d('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x369d('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x369d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x369d('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x369d('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 28c3638..7adff86 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 _0x069b=['format','channel','motionChannel','event','EventManager','acceptmessage','parse','chat-interactions','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','contact','User','internal','SIP/%s','formData','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./chatMessage.socket','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','update','describe','../../config/logger','accept','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','isNil','read1stAt','interaction','role','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','email','interface'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x069b,0x199));var _0xb069=function(_0x239049,_0x4b9d4c){_0x239049=_0x239049-0x0;var _0x35eb70=_0x069b[_0x239049];return _0x35eb70;};'use strict';var emlformat=require(_0xb069('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb069('0x1'));var jsonpatch=require(_0xb069('0x2'));var rp=require(_0xb069('0x3'));var moment=require(_0xb069('0x4'));var BPromise=require(_0xb069('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb069('0x6'));var csv=require(_0xb069('0x7'));var ejs=require(_0xb069('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb069('0x9'));var crypto=require(_0xb069('0xa'));var jsforce=require(_0xb069('0xb'));var deskjs=require(_0xb069('0xc'));var toCsv=require(_0xb069('0x7'));var querystring=require(_0xb069('0xd'));var Papa=require('papaparse');var Redis=require(_0xb069('0xe'));var authService=require(_0xb069('0xf'));var qs=require(_0xb069('0x10'));var as=require(_0xb069('0x11'));var hardwareService=require(_0xb069('0x12'));var logger=require('../../config/logger')(_0xb069('0x13'));var utils=require(_0xb069('0x14'));var config=require(_0xb069('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb069('0x16'))['db'];config[_0xb069('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb069('0x18'))(new Redis(config['redis']));require(_0xb069('0x19'))['register'](socket);var jayson=require(_0xb069('0x1a'));var client=jayson[_0xb069('0x1b')][_0xb069('0x1c')]({'port':0x232c});var client9002=jayson[_0xb069('0x1b')][_0xb069('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4b0880,_0x3ecdd8,_0x1e509e,_0x420133){return new BPromise(function(_0x3c6744,_0x3de536){var _0x150e4f=_0x420133||client;return _0x150e4f[_0xb069('0x1d')](_0x4b0880,_0x1e509e)[_0xb069('0x1e')](function(_0x30f30a){logger[_0xb069('0x1f')](_0xb069('0x20'),_0x3ecdd8,'request\x20sent');logger[_0xb069('0x21')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x3ecdd8,_0xb069('0x22'),JSON['stringify'](_0x30f30a));if(_0x30f30a[_0xb069('0x23')]){if(_0x30f30a[_0xb069('0x23')]['code']===0x1f4){logger['error'](_0xb069('0x20'),_0x3ecdd8,_0x30f30a[_0xb069('0x23')][_0xb069('0x24')]);return _0x3de536(_0x30f30a[_0xb069('0x23')][_0xb069('0x24')]);}logger[_0xb069('0x23')]('ChatMessage,\x20%s,\x20%s',_0x3ecdd8,_0x30f30a[_0xb069('0x23')][_0xb069('0x24')]);return _0x3c6744(_0x30f30a[_0xb069('0x23')][_0xb069('0x24')]);}else{logger['info'](_0xb069('0x20'),_0x3ecdd8,'request\x20sent');_0x3c6744(_0x30f30a[_0xb069('0x25')][_0xb069('0x24')]);}})[_0xb069('0x26')](function(_0x2b07a6){logger[_0xb069('0x23')](_0xb069('0x20'),_0x3ecdd8,_0x2b07a6);_0x3de536(_0x2b07a6);});});}function respondWithStatusCode(_0x4ec4cc,_0x3c95fb){_0x3c95fb=_0x3c95fb||0xcc;return function(_0xef3367){if(_0xef3367){return _0x4ec4cc[_0xb069('0x27')](_0x3c95fb);}return _0x4ec4cc[_0xb069('0x28')](_0x3c95fb)[_0xb069('0x29')]();};}function respondWithResult(_0x19b6e1,_0x495040){_0x495040=_0x495040||0xc8;return function(_0x321088){if(_0x321088){return _0x19b6e1[_0xb069('0x28')](_0x495040)[_0xb069('0x2a')](_0x321088);}};}function respondWithFilteredResult(_0x17b4de,_0x3f1580){return function(_0x4e9acf){if(_0x4e9acf){var _0x5b3ae4=typeof _0x3f1580[_0xb069('0x2b')]===_0xb069('0x2c')&&typeof _0x3f1580[_0xb069('0x2d')]==='undefined';var _0x379954=_0x4e9acf['count'];var _0x7a7113=_0x5b3ae4?0x0:_0x3f1580[_0xb069('0x2b')];var _0x1103b1=_0x5b3ae4?_0x4e9acf[_0xb069('0x2e')]:_0x3f1580[_0xb069('0x2b')]+_0x3f1580['limit'];var _0x4b1c81;if(_0x1103b1>=_0x379954){_0x1103b1=_0x379954;_0x4b1c81=0xc8;}else{_0x4b1c81=0xce;}_0x17b4de['status'](_0x4b1c81);return _0x17b4de['set']('Content-Range',_0x7a7113+'-'+_0x1103b1+'/'+_0x379954)[_0xb069('0x2a')](_0x4e9acf);}return null;};}function patchUpdates(_0x4518b7){return function(_0x4a8428){try{jsonpatch[_0xb069('0x2f')](_0x4a8428,_0x4518b7,!![]);}catch(_0x9221bf){return BPromise[_0xb069('0x30')](_0x9221bf);}return _0x4a8428[_0xb069('0x31')]();};}function saveUpdates(_0x40e115,_0x53f182){return function(_0x1d835e){if(_0x1d835e){return _0x1d835e['update'](_0x40e115)[_0xb069('0x1e')](function(_0x3a8ebb){return _0x3a8ebb;});}return null;};}function removeEntity(_0x141a7d,_0x3c27a9){return function(_0xb355c5){if(_0xb355c5){return _0xb355c5[_0xb069('0x32')]()['then'](function(){_0x141a7d[_0xb069('0x28')](0xcc)[_0xb069('0x29')]();});}};}function handleEntityNotFound(_0x7de12f,_0x4d04a7){return function(_0x41f434){if(!_0x41f434){_0x7de12f[_0xb069('0x27')](0x194);}return _0x41f434;};}function handleError(_0x46244c,_0x50e3f2){_0x50e3f2=_0x50e3f2||0x1f4;return function(_0x3524c4){logger[_0xb069('0x23')](_0x3524c4[_0xb069('0x33')]);if(_0x3524c4[_0xb069('0x34')]){delete _0x3524c4[_0xb069('0x34')];}_0x46244c[_0xb069('0x28')](_0x50e3f2)[_0xb069('0x35')](_0x3524c4);};}exports[_0xb069('0x36')]=function(_0x85e18c,_0x80da87){var _0x14d0d1={},_0x555cf2={},_0x35439f={'count':0x0,'rows':[]};var _0x47c310=_[_0xb069('0x37')](db[_0xb069('0x38')][_0xb069('0x39')],function(_0x12f725){return{'name':_0x12f725[_0xb069('0x3a')],'type':_0x12f725['type'][_0xb069('0x3b')]};});_0x555cf2['model']=_[_0xb069('0x37')](_0x47c310,'name');_0x555cf2[_0xb069('0x3c')]=_[_0xb069('0x3d')](_0x85e18c[_0xb069('0x3c')]);_0x555cf2[_0xb069('0x3e')]=_[_0xb069('0x3f')](_0x555cf2['model'],_0x555cf2[_0xb069('0x3c')]);_0x14d0d1[_0xb069('0x40')]=_[_0xb069('0x3f')](_0x555cf2[_0xb069('0x41')],qs['fields'](_0x85e18c[_0xb069('0x3c')][_0xb069('0x42')]));_0x14d0d1[_0xb069('0x40')]=_0x14d0d1['attributes'][_0xb069('0x43')]?_0x14d0d1['attributes']:_0x555cf2[_0xb069('0x41')];if(!_0x85e18c['query'][_0xb069('0x44')](_0xb069('0x45'))){_0x14d0d1[_0xb069('0x2d')]=qs[_0xb069('0x2d')](_0x85e18c[_0xb069('0x3c')][_0xb069('0x2d')]);_0x14d0d1[_0xb069('0x2b')]=qs[_0xb069('0x2b')](_0x85e18c[_0xb069('0x3c')][_0xb069('0x2b')]);}_0x14d0d1[_0xb069('0x46')]=qs[_0xb069('0x47')](_0x85e18c[_0xb069('0x3c')]['sort']);_0x14d0d1[_0xb069('0x48')]=qs[_0xb069('0x3e')](_['pick'](_0x85e18c[_0xb069('0x3c')],_0x555cf2[_0xb069('0x3e')]),_0x47c310);if(_0x85e18c[_0xb069('0x3c')]['filter']){_0x14d0d1[_0xb069('0x48')]=_[_0xb069('0x49')](_0x14d0d1[_0xb069('0x48')],{'$or':_[_0xb069('0x37')](_0x47c310,function(_0x513c20){if(_0x513c20[_0xb069('0x4a')]!==_0xb069('0x4b')){var _0x1bd6f3={};_0x1bd6f3[_0x513c20[_0xb069('0x34')]]={'$like':'%'+_0x85e18c[_0xb069('0x3c')][_0xb069('0x4c')]+'%'};return _0x1bd6f3;}})});}_0x14d0d1=_['merge']({},_0x14d0d1,_0x85e18c[_0xb069('0x4d')]);var _0x236089={'where':_0x14d0d1[_0xb069('0x48')]};return db['ChatMessage'][_0xb069('0x2e')](_0x236089)[_0xb069('0x1e')](function(_0x50b537){_0x35439f['count']=_0x50b537;if(_0x85e18c[_0xb069('0x3c')][_0xb069('0x4e')]){_0x14d0d1[_0xb069('0x4f')]=[{'all':!![]}];}return db[_0xb069('0x38')][_0xb069('0x50')](_0x14d0d1);})[_0xb069('0x1e')](function(_0x253dc4){_0x35439f[_0xb069('0x51')]=_0x253dc4;return _0x35439f;})['then'](respondWithFilteredResult(_0x80da87,_0x14d0d1))['catch'](handleError(_0x80da87,null));};exports[_0xb069('0x52')]=function(_0x20ba90,_0x6708e8){var _0x214fa7={'raw':!![],'where':{'id':_0x20ba90[_0xb069('0x53')]['id']}},_0x37f066={};_0x37f066['model']=_['keys'](db[_0xb069('0x38')][_0xb069('0x39')]);_0x37f066[_0xb069('0x3c')]=_['keys'](_0x20ba90['query']);_0x37f066[_0xb069('0x3e')]=_[_0xb069('0x3f')](_0x37f066['model'],_0x37f066[_0xb069('0x3c')]);_0x214fa7[_0xb069('0x40')]=_[_0xb069('0x3f')](_0x37f066[_0xb069('0x41')],qs[_0xb069('0x42')](_0x20ba90[_0xb069('0x3c')][_0xb069('0x42')]));_0x214fa7['attributes']=_0x214fa7[_0xb069('0x40')]['length']?_0x214fa7[_0xb069('0x40')]:_0x37f066[_0xb069('0x41')];if(_0x20ba90['query'][_0xb069('0x4e')]){_0x214fa7[_0xb069('0x4f')]=[{'all':!![]}];}_0x214fa7=_['merge']({},_0x214fa7,_0x20ba90[_0xb069('0x4d')]);return db[_0xb069('0x38')][_0xb069('0x54')](_0x214fa7)[_0xb069('0x1e')](handleEntityNotFound(_0x6708e8,null))[_0xb069('0x1e')](respondWithResult(_0x6708e8,null))[_0xb069('0x26')](handleError(_0x6708e8,null));};exports[_0xb069('0x55')]=function(_0x43b235,_0x466048){return db['ChatMessage']['create'](_0x43b235[_0xb069('0x56')],{})[_0xb069('0x1e')](respondWithResult(_0x466048,0xc9))[_0xb069('0x26')](handleError(_0x466048,null));};exports[_0xb069('0x57')]=function(_0x3ce811,_0x1e4ab5){if(_0x3ce811[_0xb069('0x56')]['id']){delete _0x3ce811[_0xb069('0x56')]['id'];}return db[_0xb069('0x38')][_0xb069('0x54')]({'where':{'id':_0x3ce811[_0xb069('0x53')]['id']}})['then'](handleEntityNotFound(_0x1e4ab5,null))[_0xb069('0x1e')](saveUpdates(_0x3ce811['body'],null))[_0xb069('0x1e')](respondWithResult(_0x1e4ab5,null))['catch'](handleError(_0x1e4ab5,null));};exports[_0xb069('0x32')]=function(_0x399416,_0x551bae){return db[_0xb069('0x38')][_0xb069('0x54')]({'where':{'id':_0x399416[_0xb069('0x53')]['id']}})['then'](handleEntityNotFound(_0x551bae,null))[_0xb069('0x1e')](removeEntity(_0x551bae,null))[_0xb069('0x26')](handleError(_0x551bae,null));};exports[_0xb069('0x58')]=function(_0xe2ff3b,_0x19d70f){return db['ChatMessage'][_0xb069('0x58')]()[_0xb069('0x1e')](respondWithResult(_0x19d70f,null))[_0xb069('0x26')](handleError(_0x19d70f,null));};var interaction_log=require(_0xb069('0x59'))('chat-interactions');exports[_0xb069('0x5a')]=function(_0x4912df,_0x43f05a,_0x11713a){var _0x35e599={'agent':{},'channel':_0xb069('0x5b')};if(_0x4912df[_0xb069('0x56')]['id']){delete _0x4912df[_0xb069('0x56')]['id'];}_0x4912df[_0xb069('0x56')][_0xb069('0x5c')]=!![];_0x4912df['body'][_0xb069('0x5d')]=moment()['format'](_0xb069('0x5e'));_0x4912df[_0xb069('0x56')][_0xb069('0x5f')]=_0x4912df[_0xb069('0x56')][_0xb069('0x5f')]||_0x4912df[_0xb069('0x60')]['id'];_0x35e599[_0xb069('0x61')]['id']=_0x4912df[_0xb069('0x56')][_0xb069('0x5f')];return db[_0xb069('0x38')][_0xb069('0x54')]({'where':{'id':_0x4912df[_0xb069('0x53')]['id'],'UserId':null}})[_0xb069('0x1e')](handleEntityNotFound(_0x43f05a,null))[_0xb069('0x1e')](saveUpdates(_0x4912df[_0xb069('0x56')],null))[_0xb069('0x1e')](function(_0x220ed6){if(_0x220ed6){_0x35e599[_0xb069('0x24')]=_0x220ed6[_0xb069('0x62')]({'plain':!![]});return db[_0xb069('0x63')]['find']({'where':{'id':_0x220ed6['ChatInteractionId']}});}return null;})[_0xb069('0x1e')](handleEntityNotFound(_0x43f05a,null))[_0xb069('0x1e')](function(_0xc2c71d){if(_0xc2c71d){return _0xc2c71d[_0xb069('0x57')]({'UserId':_0x4912df[_0xb069('0x56')][_0xb069('0x5f')],'read1stAt':_[_0xb069('0x64')](_0xc2c71d[_0xb069('0x65')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb069('0x1e')](function(_0x245dcd){if(_0x245dcd){_0x35e599[_0xb069('0x66')]=_0x245dcd[_0xb069('0x62')]({'plain':!![]});interaction_log[_0xb069('0x1f')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4912df[_0xb069('0x60')]['id'],_0x4912df[_0xb069('0x60')][_0xb069('0x34')],_0x4912df['user'][_0xb069('0x67')],_0x35e599[_0xb069('0x66')]['id'],_0x4912df[_0xb069('0x56')]?JSON[_0xb069('0x68')](_0x4912df[_0xb069('0x56')]):_0xb069('0x69'));return respondWithRpcPromise(_0xb069('0x6a'),'acceptMessage',_0x35e599);}return null;})['then'](function(_0x940d57){var _0x5b2df0=_0xb069('0x6b')+_0x940d57[_0xb069('0x24')][_0xb069('0x6c')];return db[_0xb069('0x6d')][_0xb069('0x3c')](_0x5b2df0,{'type':db[_0xb069('0x6e')][_0xb069('0x6f')][_0xb069('0x70')],'raw':!![]})[_0xb069('0x1e')](function(_0x3526e9){return _0x3526e9;});})[_0xb069('0x1e')](function(_0xd0d29c){if(_0xd0d29c){_0x35e599[_0xb069('0x24')]['contact']=_0xd0d29c[0x0];if(!_0x4912df[_0xb069('0x56')][_0xb069('0x5f')])return;return db['User'][_0xb069('0x54')]({'where':{'id':_0x4912df[_0xb069('0x56')][_0xb069('0x5f')],'role':_0xb069('0x61')},'attributes':['id',_0xb069('0x34'),'fullname',_0xb069('0x71'),'internal'],'raw':!![]});}return null;})[_0xb069('0x1e')](function(_0x43c242){if(!_0x43c242)return null;_0x35e599[_0xb069('0x24')][_0xb069('0x61')]=_0x43c242;return _0x35e599;})[_0xb069('0x1e')](function(_0x4d6e14){if(_0x4d6e14){if(_0x4912df[_0xb069('0x56')]['manual']){_0x35e599[_0xb069('0x24')][_0xb069('0x72')]=util[_0xb069('0x73')]('SIP/%s',_0x4912df['user'][_0xb069('0x34')]);_0x35e599[_0xb069('0x24')]['channel']=_0x35e599[_0xb069('0x74')];_0x35e599[_0xb069('0x24')][_0xb069('0x75')]=_0x35e599['channel'];_0x35e599[_0xb069('0x24')][_0xb069('0x76')]='accept';return respondWithRpcPromise(_0xb069('0x77'),_0xb069('0x77'),{'event':_0xb069('0x78'),'message':_[_0xb069('0x49')](_0x35e599[_0xb069('0x24')],JSON[_0xb069('0x79')](_0x35e599[_0xb069('0x66')]['formData']))},client9002)[_0xb069('0x1e')](function(){return _0x35e599;});}return _0x35e599;}return null;})['then'](respondWithResult(_0x43f05a,null))[_0xb069('0x26')](handleError(_0x43f05a,null));};var interaction_log=require(_0xb069('0x59'))(_0xb069('0x7a'));exports[_0xb069('0x30')]=function(_0x1d01e2,_0x48002a,_0x395ed5){var _0xd6dafc={'agent':{},'channel':'chat'};if(_0x1d01e2[_0xb069('0x56')]['id']){delete _0x1d01e2[_0xb069('0x56')]['id'];}_0x1d01e2['body'][_0xb069('0x5f')]=_0x1d01e2[_0xb069('0x56')]['UserId']||_0x1d01e2['user']['id'];_0xd6dafc[_0xb069('0x61')]['id']=_0x1d01e2[_0xb069('0x56')][_0xb069('0x5f')];return db[_0xb069('0x38')][_0xb069('0x54')]({'where':{'id':_0x1d01e2[_0xb069('0x53')]['id'],'UserId':null}})[_0xb069('0x1e')](handleEntityNotFound(_0x48002a,null))['then'](function(_0x2f797e){if(_0x2f797e){_0xd6dafc[_0xb069('0x24')]=_0x2f797e[_0xb069('0x62')]({'plain':!![]});return db[_0xb069('0x63')][_0xb069('0x54')]({'where':{'id':_0x2f797e[_0xb069('0x7b')]}});}return null;})[_0xb069('0x1e')](handleEntityNotFound(_0x48002a,null))[_0xb069('0x1e')](function(_0x59cc5d){if(_0x59cc5d){_0xd6dafc['interaction']=_0x59cc5d['get']({'plain':!![]});interaction_log['info'](_0xb069('0x7c'),_0x1d01e2['user']['id'],_0x1d01e2[_0xb069('0x60')][_0xb069('0x34')],_0x1d01e2[_0xb069('0x60')]['role'],_0xd6dafc[_0xb069('0x66')]['id'],_0x1d01e2['body']?JSON[_0xb069('0x68')](_0x1d01e2[_0xb069('0x56')]):'null');return respondWithRpcPromise(_0xb069('0x7d'),'rejectMessage',_0xd6dafc);}return null;})['then'](function(_0x1f8ad4){var _0xbd3989=_0xb069('0x6b')+_0x1f8ad4[_0xb069('0x24')][_0xb069('0x6c')];return db[_0xb069('0x6d')][_0xb069('0x3c')](_0xbd3989,{'type':db[_0xb069('0x6e')][_0xb069('0x6f')][_0xb069('0x70')],'raw':!![]})['then'](function(_0x5c0b37){return _0x5c0b37;});})[_0xb069('0x1e')](function(_0x158639){if(_0x158639){_0xd6dafc['message'][_0xb069('0x7e')]=_0x158639[0x0];if(!_0x1d01e2[_0xb069('0x56')][_0xb069('0x5f')])return;return db[_0xb069('0x7f')][_0xb069('0x54')]({'where':{'id':_0x1d01e2['body'][_0xb069('0x5f')],'role':_0xb069('0x61')},'attributes':['id','name','fullname',_0xb069('0x71'),_0xb069('0x80')],'raw':!![]});}return null;})[_0xb069('0x1e')](function(_0x884a7){if(!_0x884a7)return null;_0xd6dafc[_0xb069('0x24')]['agent']=_0x884a7;return _0xd6dafc;})['then'](function(_0xc2f700){if(_0xc2f700){_0xc2f700[_0xb069('0x24')][_0xb069('0x72')]=util[_0xb069('0x73')](_0xb069('0x81'),_0x1d01e2[_0xb069('0x60')]['name']);_0xc2f700[_0xb069('0x24')][_0xb069('0x74')]=_0xd6dafc[_0xb069('0x74')];_0xc2f700[_0xb069('0x24')][_0xb069('0x75')]=_0xd6dafc[_0xb069('0x74')];_0xc2f700[_0xb069('0x24')][_0xb069('0x76')]=_0xb069('0x30');respondWithRpcPromise('EventManager',_0xb069('0x77'),{'event':'rejectmessage','message':_[_0xb069('0x49')](_0xd6dafc['message'],JSON['parse'](_0xd6dafc['interaction'][_0xb069('0x82')]))},client9002);return _0xd6dafc;}return null;})[_0xb069('0x1e')](respondWithResult(_0x48002a,null))[_0xb069('0x26')](handleError(_0x48002a,null));}; \ No newline at end of file +var _0x369b=['catch','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','ChatMessage','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','fields','find','create','body','describe','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','ChatInteraction','ChatInteractionId','isNil','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','chat-interactions','get','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','Sequelize','internal','parse','formData','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','info','result'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x369b,0xe4));var _0xb369=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x369b[_0x47a7d0];return _0xb9bd08;};'use strict';var emlformat=require(_0xb369('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb369('0x1'));var rp=require(_0xb369('0x2'));var moment=require(_0xb369('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb369('0x4'));var util=require(_0xb369('0x5'));var path=require(_0xb369('0x6'));var sox=require(_0xb369('0x7'));var csv=require(_0xb369('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb369('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb369('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb369('0xb'));var toCsv=require(_0xb369('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb369('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xb369('0xd'));var hardwareService=require(_0xb369('0xe'));var logger=require(_0xb369('0xf'))('api');var utils=require(_0xb369('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xb369('0x11'));var db=require(_0xb369('0x12'))['db'];config[_0xb369('0x13')]=_['defaults'](config[_0xb369('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0xb369('0x14'))(new Redis(config[_0xb369('0x13')]));require(_0xb369('0x15'))[_0xb369('0x16')](socket);var jayson=require(_0xb369('0x17'));var client=jayson[_0xb369('0x18')][_0xb369('0x19')]({'port':0x232c});var client9002=jayson[_0xb369('0x18')][_0xb369('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5c3cad,_0x5da475,_0x36e815,_0x35b356){return new BPromise(function(_0x20b9a4,_0x5d73ad){var _0x71f99d=_0x35b356||client;return _0x71f99d[_0xb369('0x1a')](_0x5c3cad,_0x36e815)[_0xb369('0x1b')](function(_0x2fe64b){logger['info']('ChatMessage,\x20%s,\x20%s',_0x5da475,'request\x20sent');logger[_0xb369('0x1c')](_0xb369('0x1d'),_0x5da475,_0xb369('0x1e'),JSON[_0xb369('0x1f')](_0x2fe64b));if(_0x2fe64b[_0xb369('0x20')]){if(_0x2fe64b['error'][_0xb369('0x21')]===0x1f4){logger['error'](_0xb369('0x22'),_0x5da475,_0x2fe64b['error'][_0xb369('0x23')]);return _0x5d73ad(_0x2fe64b[_0xb369('0x20')][_0xb369('0x23')]);}logger[_0xb369('0x20')](_0xb369('0x22'),_0x5da475,_0x2fe64b[_0xb369('0x20')][_0xb369('0x23')]);return _0x20b9a4(_0x2fe64b[_0xb369('0x20')]['message']);}else{logger[_0xb369('0x24')](_0xb369('0x22'),_0x5da475,_0xb369('0x1e'));_0x20b9a4(_0x2fe64b[_0xb369('0x25')]['message']);}})[_0xb369('0x26')](function(_0x398152){logger[_0xb369('0x20')](_0xb369('0x22'),_0x5da475,_0x398152);_0x5d73ad(_0x398152);});});}function respondWithStatusCode(_0x7affc2,_0xbb3355){_0xbb3355=_0xbb3355||0xcc;return function(_0x286d6b){if(_0x286d6b){return _0x7affc2[_0xb369('0x27')](_0xbb3355);}return _0x7affc2[_0xb369('0x28')](_0xbb3355)[_0xb369('0x29')]();};}function respondWithResult(_0x5a1ab8,_0x1c3b45){_0x1c3b45=_0x1c3b45||0xc8;return function(_0x232206){if(_0x232206){return _0x5a1ab8[_0xb369('0x28')](_0x1c3b45)[_0xb369('0x2a')](_0x232206);}};}function respondWithFilteredResult(_0x5aa806,_0x253e0f){return function(_0x77e9ec){if(_0x77e9ec){var _0x19539f=typeof _0x253e0f['offset']==='undefined'&&typeof _0x253e0f[_0xb369('0x2b')]===_0xb369('0x2c');var _0x2ed3f5=_0x77e9ec[_0xb369('0x2d')];var _0x361076=_0x19539f?0x0:_0x253e0f[_0xb369('0x2e')];var _0x262330=_0x19539f?_0x77e9ec[_0xb369('0x2d')]:_0x253e0f[_0xb369('0x2e')]+_0x253e0f['limit'];var _0x281ec6;if(_0x262330>=_0x2ed3f5){_0x262330=_0x2ed3f5;_0x281ec6=0xc8;}else{_0x281ec6=0xce;}_0x5aa806['status'](_0x281ec6);return _0x5aa806[_0xb369('0x2f')](_0xb369('0x30'),_0x361076+'-'+_0x262330+'/'+_0x2ed3f5)[_0xb369('0x2a')](_0x77e9ec);}return null;};}function patchUpdates(_0x354cdb){return function(_0x59c47d){try{jsonpatch[_0xb369('0x31')](_0x59c47d,_0x354cdb,!![]);}catch(_0x4f66e0){return BPromise[_0xb369('0x32')](_0x4f66e0);}return _0x59c47d[_0xb369('0x33')]();};}function saveUpdates(_0x54db5a,_0x1d290d){return function(_0x12b7d7){if(_0x12b7d7){return _0x12b7d7[_0xb369('0x34')](_0x54db5a)[_0xb369('0x1b')](function(_0x3abfba){return _0x3abfba;});}return null;};}function removeEntity(_0x41a571,_0x4bcfb1){return function(_0x42b4a7){if(_0x42b4a7){return _0x42b4a7[_0xb369('0x35')]()[_0xb369('0x1b')](function(){_0x41a571[_0xb369('0x28')](0xcc)[_0xb369('0x29')]();});}};}function handleEntityNotFound(_0x45cc14,_0xcbdacf){return function(_0x1803be){if(!_0x1803be){_0x45cc14['sendStatus'](0x194);}return _0x1803be;};}function handleError(_0x1ab72d,_0x53c42a){_0x53c42a=_0x53c42a||0x1f4;return function(_0x3ba06f){logger[_0xb369('0x20')](_0x3ba06f[_0xb369('0x36')]);if(_0x3ba06f[_0xb369('0x37')]){delete _0x3ba06f[_0xb369('0x37')];}_0x1ab72d[_0xb369('0x28')](_0x53c42a)[_0xb369('0x38')](_0x3ba06f);};}exports[_0xb369('0x39')]=function(_0x585155,_0xa8606){var _0x822865={},_0x193c4d={},_0x1b0b6f={'count':0x0,'rows':[]};var _0x447dcb=_['map'](db[_0xb369('0x3a')][_0xb369('0x3b')],function(_0x58fa14){return{'name':_0x58fa14[_0xb369('0x3c')],'type':_0x58fa14[_0xb369('0x3d')][_0xb369('0x3e')]};});_0x193c4d['model']=_['map'](_0x447dcb,_0xb369('0x37'));_0x193c4d[_0xb369('0x3f')]=_[_0xb369('0x40')](_0x585155[_0xb369('0x3f')]);_0x193c4d[_0xb369('0x41')]=_['intersection'](_0x193c4d['model'],_0x193c4d[_0xb369('0x3f')]);_0x822865[_0xb369('0x42')]=_[_0xb369('0x43')](_0x193c4d[_0xb369('0x44')],qs['fields'](_0x585155['query']['fields']));_0x822865[_0xb369('0x42')]=_0x822865['attributes'][_0xb369('0x45')]?_0x822865[_0xb369('0x42')]:_0x193c4d[_0xb369('0x44')];if(!_0x585155[_0xb369('0x3f')][_0xb369('0x46')](_0xb369('0x47'))){_0x822865['limit']=qs[_0xb369('0x2b')](_0x585155['query']['limit']);_0x822865[_0xb369('0x2e')]=qs[_0xb369('0x2e')](_0x585155[_0xb369('0x3f')][_0xb369('0x2e')]);}_0x822865[_0xb369('0x48')]=qs[_0xb369('0x49')](_0x585155[_0xb369('0x3f')]['sort']);_0x822865[_0xb369('0x4a')]=qs[_0xb369('0x41')](_[_0xb369('0x4b')](_0x585155[_0xb369('0x3f')],_0x193c4d['filters']),_0x447dcb);if(_0x585155['query'][_0xb369('0x4c')]){_0x822865[_0xb369('0x4a')]=_[_0xb369('0x4d')](_0x822865[_0xb369('0x4a')],{'$or':_['map'](_0x447dcb,function(_0x6adf33){if(_0x6adf33[_0xb369('0x3d')]!=='VIRTUAL'){var _0x52a406={};_0x52a406[_0x6adf33[_0xb369('0x37')]]={'$like':'%'+_0x585155[_0xb369('0x3f')][_0xb369('0x4c')]+'%'};return _0x52a406;}})});}_0x822865=_['merge']({},_0x822865,_0x585155[_0xb369('0x4e')]);var _0x5ed89c={'where':_0x822865['where']};return db[_0xb369('0x3a')]['count'](_0x5ed89c)['then'](function(_0xca7fb){_0x1b0b6f['count']=_0xca7fb;if(_0x585155[_0xb369('0x3f')][_0xb369('0x4f')]){_0x822865[_0xb369('0x50')]=[{'all':!![]}];}return db[_0xb369('0x3a')][_0xb369('0x51')](_0x822865);})[_0xb369('0x1b')](function(_0x4ef418){_0x1b0b6f[_0xb369('0x52')]=_0x4ef418;return _0x1b0b6f;})['then'](respondWithFilteredResult(_0xa8606,_0x822865))[_0xb369('0x26')](handleError(_0xa8606,null));};exports[_0xb369('0x53')]=function(_0x51b5de,_0x37883b){var _0x208dbd={'raw':!![],'where':{'id':_0x51b5de[_0xb369('0x54')]['id']}},_0x4f3f3f={};_0x4f3f3f[_0xb369('0x44')]=_['keys'](db[_0xb369('0x3a')][_0xb369('0x3b')]);_0x4f3f3f[_0xb369('0x3f')]=_[_0xb369('0x40')](_0x51b5de[_0xb369('0x3f')]);_0x4f3f3f['filters']=_[_0xb369('0x43')](_0x4f3f3f[_0xb369('0x44')],_0x4f3f3f[_0xb369('0x3f')]);_0x208dbd[_0xb369('0x42')]=_['intersection'](_0x4f3f3f[_0xb369('0x44')],qs[_0xb369('0x55')](_0x51b5de[_0xb369('0x3f')][_0xb369('0x55')]));_0x208dbd[_0xb369('0x42')]=_0x208dbd[_0xb369('0x42')][_0xb369('0x45')]?_0x208dbd[_0xb369('0x42')]:_0x4f3f3f[_0xb369('0x44')];if(_0x51b5de[_0xb369('0x3f')][_0xb369('0x4f')]){_0x208dbd[_0xb369('0x50')]=[{'all':!![]}];}_0x208dbd=_[_0xb369('0x4d')]({},_0x208dbd,_0x51b5de['options']);return db['ChatMessage'][_0xb369('0x56')](_0x208dbd)[_0xb369('0x1b')](handleEntityNotFound(_0x37883b,null))[_0xb369('0x1b')](respondWithResult(_0x37883b,null))[_0xb369('0x26')](handleError(_0x37883b,null));};exports[_0xb369('0x57')]=function(_0x161e4e,_0x444e69){return db[_0xb369('0x3a')][_0xb369('0x57')](_0x161e4e['body'],{})[_0xb369('0x1b')](respondWithResult(_0x444e69,0xc9))[_0xb369('0x26')](handleError(_0x444e69,null));};exports[_0xb369('0x34')]=function(_0x5d510e,_0x54278d){if(_0x5d510e['body']['id']){delete _0x5d510e[_0xb369('0x58')]['id'];}return db[_0xb369('0x3a')][_0xb369('0x56')]({'where':{'id':_0x5d510e[_0xb369('0x54')]['id']}})['then'](handleEntityNotFound(_0x54278d,null))[_0xb369('0x1b')](saveUpdates(_0x5d510e[_0xb369('0x58')],null))[_0xb369('0x1b')](respondWithResult(_0x54278d,null))[_0xb369('0x26')](handleError(_0x54278d,null));};exports['destroy']=function(_0x1cdd9d,_0x24928f){return db['ChatMessage'][_0xb369('0x56')]({'where':{'id':_0x1cdd9d[_0xb369('0x54')]['id']}})['then'](handleEntityNotFound(_0x24928f,null))[_0xb369('0x1b')](removeEntity(_0x24928f,null))[_0xb369('0x26')](handleError(_0x24928f,null));};exports[_0xb369('0x59')]=function(_0x59b2e1,_0x2e9b3e){return db[_0xb369('0x3a')][_0xb369('0x59')]()[_0xb369('0x1b')](respondWithResult(_0x2e9b3e,null))[_0xb369('0x26')](handleError(_0x2e9b3e,null));};var interaction_log=require(_0xb369('0xf'))('chat-interactions');exports[_0xb369('0x5a')]=function(_0x2117f2,_0x247b5d,_0x94e116){var _0x150722={'agent':{},'channel':_0xb369('0x5b')};if(_0x2117f2[_0xb369('0x58')]['id']){delete _0x2117f2['body']['id'];}_0x2117f2[_0xb369('0x58')][_0xb369('0x5c')]=!![];_0x2117f2['body'][_0xb369('0x5d')]=moment()[_0xb369('0x5e')](_0xb369('0x5f'));_0x2117f2['body'][_0xb369('0x60')]=_0x2117f2[_0xb369('0x58')]['UserId']||_0x2117f2[_0xb369('0x61')]['id'];_0x150722['agent']['id']=_0x2117f2[_0xb369('0x58')][_0xb369('0x60')];return db['ChatMessage'][_0xb369('0x56')]({'where':{'id':_0x2117f2[_0xb369('0x54')]['id'],'UserId':null}})[_0xb369('0x1b')](handleEntityNotFound(_0x247b5d,null))[_0xb369('0x1b')](saveUpdates(_0x2117f2['body'],null))[_0xb369('0x1b')](function(_0x282b8d){if(_0x282b8d){_0x150722[_0xb369('0x23')]=_0x282b8d['get']({'plain':!![]});return db[_0xb369('0x62')]['find']({'where':{'id':_0x282b8d[_0xb369('0x63')]}});}return null;})[_0xb369('0x1b')](handleEntityNotFound(_0x247b5d,null))[_0xb369('0x1b')](function(_0x115b55){if(_0x115b55){return _0x115b55['update']({'UserId':_0x2117f2[_0xb369('0x58')]['UserId'],'read1stAt':_[_0xb369('0x64')](_0x115b55['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xb369('0x1b')](function(_0x4ffdb7){if(_0x4ffdb7){_0x150722[_0xb369('0x65')]=_0x4ffdb7['get']({'plain':!![]});interaction_log[_0xb369('0x24')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2117f2[_0xb369('0x61')]['id'],_0x2117f2[_0xb369('0x61')][_0xb369('0x37')],_0x2117f2[_0xb369('0x61')]['role'],_0x150722[_0xb369('0x65')]['id'],_0x2117f2[_0xb369('0x58')]?JSON[_0xb369('0x1f')](_0x2117f2['body']):_0xb369('0x66'));return respondWithRpcPromise(_0xb369('0x67'),_0xb369('0x68'),_0x150722);}return null;})[_0xb369('0x1b')](function(_0x1c115d){var _0x4dbe13=_0xb369('0x69')+_0x1c115d[_0xb369('0x23')][_0xb369('0x6a')];return db[_0xb369('0x6b')][_0xb369('0x3f')](_0x4dbe13,{'type':db['Sequelize'][_0xb369('0x6c')][_0xb369('0x6d')],'raw':!![]})[_0xb369('0x1b')](function(_0xa08371){return _0xa08371;});})['then'](function(_0x6a9eab){if(_0x6a9eab){_0x150722[_0xb369('0x23')][_0xb369('0x6e')]=_0x6a9eab[0x0];if(!_0x2117f2[_0xb369('0x58')][_0xb369('0x60')])return;return db[_0xb369('0x6f')][_0xb369('0x56')]({'where':{'id':_0x2117f2[_0xb369('0x58')]['UserId'],'role':_0xb369('0x70')},'attributes':['id','name',_0xb369('0x71'),_0xb369('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x5c3314){if(!_0x5c3314)return null;_0x150722[_0xb369('0x23')][_0xb369('0x70')]=_0x5c3314;return _0x150722;})['then'](function(_0x2c30d2){if(_0x2c30d2){if(_0x2117f2[_0xb369('0x58')][_0xb369('0x73')]){_0x150722[_0xb369('0x23')][_0xb369('0x74')]=util[_0xb369('0x5e')](_0xb369('0x75'),_0x2117f2['user'][_0xb369('0x37')]);_0x150722[_0xb369('0x23')][_0xb369('0x76')]=_0x150722[_0xb369('0x76')];_0x150722[_0xb369('0x23')][_0xb369('0x77')]=_0x150722[_0xb369('0x76')];_0x150722[_0xb369('0x23')][_0xb369('0x78')]=_0xb369('0x5a');return respondWithRpcPromise(_0xb369('0x79'),'EventManager',{'event':_0xb369('0x7a'),'message':_[_0xb369('0x4d')](_0x150722['message'],JSON['parse'](_0x150722[_0xb369('0x65')]['formData']))},client9002)[_0xb369('0x1b')](function(){return _0x150722;});}return _0x150722;}return null;})['then'](respondWithResult(_0x247b5d,null))[_0xb369('0x26')](handleError(_0x247b5d,null));};var interaction_log=require(_0xb369('0xf'))(_0xb369('0x7b'));exports[_0xb369('0x32')]=function(_0x246d1f,_0x3ca74e,_0x246683){var _0x25eaad={'agent':{},'channel':_0xb369('0x5b')};if(_0x246d1f[_0xb369('0x58')]['id']){delete _0x246d1f['body']['id'];}_0x246d1f['body']['UserId']=_0x246d1f[_0xb369('0x58')][_0xb369('0x60')]||_0x246d1f[_0xb369('0x61')]['id'];_0x25eaad[_0xb369('0x70')]['id']=_0x246d1f[_0xb369('0x58')][_0xb369('0x60')];return db[_0xb369('0x3a')][_0xb369('0x56')]({'where':{'id':_0x246d1f[_0xb369('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3ca74e,null))['then'](function(_0x14e641){if(_0x14e641){_0x25eaad[_0xb369('0x23')]=_0x14e641[_0xb369('0x7c')]({'plain':!![]});return db['ChatInteraction'][_0xb369('0x56')]({'where':{'id':_0x14e641['ChatInteractionId']}});}return null;})[_0xb369('0x1b')](handleEntityNotFound(_0x3ca74e,null))['then'](function(_0xe941f3){if(_0xe941f3){_0x25eaad[_0xb369('0x65')]=_0xe941f3[_0xb369('0x7c')]({'plain':!![]});interaction_log[_0xb369('0x24')](_0xb369('0x7d'),_0x246d1f[_0xb369('0x61')]['id'],_0x246d1f[_0xb369('0x61')][_0xb369('0x37')],_0x246d1f[_0xb369('0x61')][_0xb369('0x7e')],_0x25eaad[_0xb369('0x65')]['id'],_0x246d1f[_0xb369('0x58')]?JSON['stringify'](_0x246d1f[_0xb369('0x58')]):_0xb369('0x66'));return respondWithRpcPromise(_0xb369('0x7f'),_0xb369('0x80'),_0x25eaad);}return null;})[_0xb369('0x1b')](function(_0x2b3c44){var _0x5ea819=_0xb369('0x69')+_0x2b3c44['message']['ContactId'];return db[_0xb369('0x6b')][_0xb369('0x3f')](_0x5ea819,{'type':db[_0xb369('0x81')][_0xb369('0x6c')][_0xb369('0x6d')],'raw':!![]})[_0xb369('0x1b')](function(_0x417a1c){return _0x417a1c;});})[_0xb369('0x1b')](function(_0x211208){if(_0x211208){_0x25eaad['message'][_0xb369('0x6e')]=_0x211208[0x0];if(!_0x246d1f[_0xb369('0x58')][_0xb369('0x60')])return;return db[_0xb369('0x6f')]['find']({'where':{'id':_0x246d1f[_0xb369('0x58')][_0xb369('0x60')],'role':'agent'},'attributes':['id',_0xb369('0x37'),_0xb369('0x71'),_0xb369('0x72'),_0xb369('0x82')],'raw':!![]});}return null;})[_0xb369('0x1b')](function(_0x283a50){if(!_0x283a50)return null;_0x25eaad[_0xb369('0x23')]['agent']=_0x283a50;return _0x25eaad;})[_0xb369('0x1b')](function(_0x33b434){if(_0x33b434){_0x33b434[_0xb369('0x23')][_0xb369('0x74')]=util[_0xb369('0x5e')](_0xb369('0x75'),_0x246d1f['user'][_0xb369('0x37')]);_0x33b434[_0xb369('0x23')][_0xb369('0x76')]=_0x25eaad[_0xb369('0x76')];_0x33b434[_0xb369('0x23')]['motionChannel']=_0x25eaad[_0xb369('0x76')];_0x33b434[_0xb369('0x23')][_0xb369('0x78')]=_0xb369('0x32');respondWithRpcPromise(_0xb369('0x79'),_0xb369('0x79'),{'event':'rejectmessage','message':_[_0xb369('0x4d')](_0x25eaad[_0xb369('0x23')],JSON[_0xb369('0x83')](_0x25eaad[_0xb369('0x65')][_0xb369('0x84')]))},client9002);return _0x25eaad;}return null;})[_0xb369('0x1b')](respondWithResult(_0x3ca74e,null))[_0xb369('0x26')](handleError(_0x3ca74e,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 1fa7505..7c92a63 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 _0x339e=['hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x19446d,_0x2e4229){var _0xbf8527=function(_0x479720){while(--_0x479720){_0x19446d['push'](_0x19446d['shift']());}};_0xbf8527(++_0x2e4229);}(_0x339e,0x89));var _0xe339=function(_0x26b80e,_0x5c9333){_0x26b80e=_0x26b80e-0x0;var _0x84a8a8=_0x339e[_0x26b80e];return _0x84a8a8;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xe339('0x0'))['db'][_0xe339('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xe339('0x2')](0x0);var events={'afterCreate':_0xe339('0x3'),'afterUpdate':_0xe339('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5dd8c1){return function(_0x348fad,_0x3c8561,_0x13c3a4){ChatMessageEvents[_0xe339('0x5')](_0x5dd8c1+':'+_0x348fad['id'],_0x348fad);ChatMessageEvents[_0xe339('0x5')](_0x5dd8c1,_0x348fad);_0x13c3a4(null);};}for(var e in events){if(events[_0xe339('0x6')](e)){var event=events[e];ChatMessage[_0xe339('0x7')](e,emitEvent(event));}}module[_0xe339('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x102f=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x5c67e3,_0x3b1a11){var _0x52762d=function(_0x2f20a7){while(--_0x2f20a7){_0x5c67e3['push'](_0x5c67e3['shift']());}};_0x52762d(++_0x3b1a11);}(_0x102f,0x127));var _0xf102=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x102f[_0x2160a9];return _0xa88cf7;};'use strict';var EventEmitter=require(_0xf102('0x0'));var ChatMessage=require(_0xf102('0x1'))['db'][_0xf102('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xf102('0x3')](0x0);var events={'afterCreate':_0xf102('0x4'),'afterUpdate':_0xf102('0x5'),'afterDestroy':_0xf102('0x6')};function emitEvent(_0x450bff){return function(_0x196900,_0x9f58a0,_0x1b03c0){ChatMessageEvents[_0xf102('0x7')](_0x450bff+':'+_0x196900['id'],_0x196900);ChatMessageEvents[_0xf102('0x7')](_0x450bff,_0x196900);_0x1b03c0(null);};}for(var e in events){if(events[_0xf102('0x8')](e)){var event=events[e];ChatMessage[_0xf102('0x9')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index ebcd793..b20bd51 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 _0x605c=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','./chatMessage.attributes','exports','define','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','findOne','then','createdAt','error','utf8mb4_unicode_ci'];(function(_0x13682c,_0x455b1d){var _0x40550=function(_0x570149){while(--_0x570149){_0x13682c['push'](_0x13682c['shift']());}};_0x40550(++_0x455b1d);}(_0x605c,0x1db));var _0xc605=function(_0x417fd1,_0x5b8052){_0x417fd1=_0x417fd1-0x0;var _0x504abb=_0x605c[_0x417fd1];return _0x504abb;};'use strict';var _=require(_0xc605('0x0'));var util=require(_0xc605('0x1'));var logger=require(_0xc605('0x2'))(_0xc605('0x3'));var moment=require(_0xc605('0x4'));var BPromise=require('bluebird');var rp=require(_0xc605('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc605('0x6'));var config=require('../../config/environment');var attributes=require(_0xc605('0x7'));module[_0xc605('0x8')]=function(_0x49d252,_0x17c755){return _0x49d252[_0xc605('0x9')]('ChatMessage',attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xc605('0xa'),'fields':[_0xc605('0xb')],'type':_0xc605('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3814d6,_0x2d2507,_0x5f5376){var _0x105cd9=_0x49d252[_0xc605('0xd')];var _0x5a8e45=_0x3814d6[_0xc605('0xe')]({'plain':!![]});if(_0x5a8e45['direction']['toLowerCase']()==='in'||_0x5a8e45[_0xc605('0xf')][_0xc605('0x10')]()===_0xc605('0x11')&&!_0x5a8e45[_0xc605('0x12')]&&!_[_0xc605('0x13')](_0x5a8e45['UserId'])){_0x105cd9['ChatInteraction'][_0xc605('0x14')]({'where':{'id':_0x5a8e45['ChatInteractionId']}})[_0xc605('0x15')](function(_0x8a172){if(_0x8a172){_0x8a172['update']({'lastMsgAt':_0x5a8e45[_0xc605('0x16')],'lastMsgDirection':_0x5a8e45['direction'][_0xc605('0x10')]()});}})['catch'](function(_0x595e56){console[_0xc605('0x17')](_0x595e56);});}_0x5f5376();}},'charset':'utf8mb4','collate':_0xc605('0x18')});}; \ No newline at end of file +var _0xff3c=['util','api','moment','path','rimraf','../../config/environment','./chatMessage.attributes','exports','ChatMessage','fti_chat_messages','FULLTEXT','models','toLowerCase','direction','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1d58f0,_0x1a82db){var _0x2105a4=function(_0x5950b7){while(--_0x5950b7){_0x1d58f0['push'](_0x1d58f0['shift']());}};_0x2105a4(++_0x1a82db);}(_0xff3c,0x179));var _0xcff3=function(_0x1fb0cd,_0x1f71e9){_0x1fb0cd=_0x1fb0cd-0x0;var _0x293374=_0xff3c[_0x1fb0cd];return _0x293374;};'use strict';var _=require(_0xcff3('0x0'));var util=require(_0xcff3('0x1'));var logger=require('../../config/logger')(_0xcff3('0x2'));var moment=require(_0xcff3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcff3('0x4'));var rimraf=require(_0xcff3('0x5'));var config=require(_0xcff3('0x6'));var attributes=require(_0xcff3('0x7'));module[_0xcff3('0x8')]=function(_0x308a82,_0x47b899){return _0x308a82['define'](_0xcff3('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0xcff3('0xa'),'fields':['body'],'type':_0xcff3('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d9aec,_0x32db64,_0x3de9db){var _0x4473d7=_0x308a82[_0xcff3('0xc')];var _0x42e9da=_0x3d9aec['get']({'plain':!![]});if(_0x42e9da['direction'][_0xcff3('0xd')]()==='in'||_0x42e9da[_0xcff3('0xe')][_0xcff3('0xd')]()===_0xcff3('0xf')&&!_0x42e9da[_0xcff3('0x10')]&&!_[_0xcff3('0x11')](_0x42e9da[_0xcff3('0x12')])){_0x4473d7[_0xcff3('0x13')][_0xcff3('0x14')]({'where':{'id':_0x42e9da[_0xcff3('0x15')]}})[_0xcff3('0x16')](function(_0x155309){if(_0x155309){_0x155309[_0xcff3('0x17')]({'lastMsgAt':_0x42e9da[_0xcff3('0x18')],'lastMsgDirection':_0x42e9da[_0xcff3('0xe')][_0xcff3('0xd')]()});}})['catch'](function(_0x3fabce){console['error'](_0x3fabce);});}_0x3de9db();}},'charset':_0xcff3('0x19'),'collate':_0xcff3('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 51c0d19..182e386 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 _0x677a=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ChatMessage','create','options','raw','CreateChatMessage','lodash','moment','bluebird'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x677a,0xd6));var _0xa677=function(_0x195ea7,_0x2873b1){_0x195ea7=_0x195ea7-0x0;var _0x10e3c1=_0x677a[_0x195ea7];return _0x10e3c1;};'use strict';var _=require(_0xa677('0x0'));var util=require('util');var moment=require(_0xa677('0x1'));var BPromise=require(_0xa677('0x2'));var rs=require(_0xa677('0x3'));var fs=require('fs');var Redis=require(_0xa677('0x4'));var db=require(_0xa677('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa677('0x6'))(_0xa677('0x7'));var config=require(_0xa677('0x8'));var jayson=require(_0xa677('0x9'));var client=jayson[_0xa677('0xa')]['http']({'port':0x232a});config[_0xa677('0xb')]=_[_0xa677('0xc')](config[_0xa677('0xb')],{'host':_0xa677('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatMessage.socket')[_0xa677('0xe')](socket);function respondWithRpcPromise(_0x4c9e8c,_0x3e5e2c,_0x1d6586){return new BPromise(function(_0x5d2451,_0xead831){return client[_0xa677('0xf')](_0x4c9e8c,_0x1d6586)[_0xa677('0x10')](function(_0x96f98d){logger['info'](_0xa677('0x11'),_0x3e5e2c,_0xa677('0x12'));logger[_0xa677('0x13')](_0xa677('0x14'),_0x3e5e2c,'request\x20sent',JSON[_0xa677('0x15')](_0x96f98d));if(_0x96f98d['error']){if(_0x96f98d[_0xa677('0x16')][_0xa677('0x17')]===0x1f4){logger[_0xa677('0x16')](_0xa677('0x11'),_0x3e5e2c,_0x96f98d[_0xa677('0x16')][_0xa677('0x18')]);return _0xead831(_0x96f98d[_0xa677('0x16')][_0xa677('0x18')]);}logger[_0xa677('0x16')](_0xa677('0x11'),_0x3e5e2c,_0x96f98d[_0xa677('0x16')][_0xa677('0x18')]);return _0x5d2451(_0x96f98d[_0xa677('0x16')][_0xa677('0x18')]);}else{logger['info'](_0xa677('0x11'),_0x3e5e2c,_0xa677('0x12'));_0x5d2451(_0x96f98d['result']['message']);}})[_0xa677('0x19')](function(_0x73350){logger[_0xa677('0x16')](_0xa677('0x11'),_0x3e5e2c,_0x73350);_0xead831(_0x73350);});});}exports['CreateChatMessage']=function(_0x2eab12){var _0x2122ac=this;return new Promise(function(_0xad957e,_0x44de05){return db[_0xa677('0x1a')][_0xa677('0x1b')](_0x2eab12['body'],{'raw':_0x2eab12[_0xa677('0x1c')]?_0x2eab12['options'][_0xa677('0x1d')]===undefined?!![]:![]:!![]})[_0xa677('0x10')](function(_0x45eb0f){logger['info'](_0xa677('0x1e'),_0x2eab12);logger[_0xa677('0x13')](_0xa677('0x1e'),_0x2eab12,JSON[_0xa677('0x15')](_0x45eb0f));_0xad957e(_0x45eb0f);})['catch'](function(_0x1aa82b){logger[_0xa677('0x16')]('CreateChatMessage',_0x1aa82b[_0xa677('0x18')],_0x2eab12);_0x44de05(_0x2122ac[_0xa677('0x16')](0x1f4,_0x1aa82b[_0xa677('0x18')]));});});}; \ No newline at end of file +var _0xb573=['message','result','catch','ChatMessage','create','body','raw','CreateChatMessage','stringify','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','client','http','redis','defaults','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x4f8b44,_0x4eda31){var _0x45727b=function(_0x566b10){while(--_0x566b10){_0x4f8b44['push'](_0x4f8b44['shift']());}};_0x45727b(++_0x4eda31);}(_0xb573,0x101));var _0x3b57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb573[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3b57('0x0'));var util=require('util');var moment=require(_0x3b57('0x1'));var BPromise=require(_0x3b57('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b57('0x3'));var db=require(_0x3b57('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3b57('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3b57('0x6')][_0x3b57('0x7')]({'port':0x232a});config[_0x3b57('0x8')]=_[_0x3b57('0x9')](config[_0x3b57('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x3b57('0xa'))(new Redis(config[_0x3b57('0x8')]));require(_0x3b57('0xb'))[_0x3b57('0xc')](socket);function respondWithRpcPromise(_0x3637f7,_0x36a88e,_0x534ffd){return new BPromise(function(_0x59cbba,_0x53f34f){return client[_0x3b57('0xd')](_0x3637f7,_0x534ffd)[_0x3b57('0xe')](function(_0xb8a66b){logger[_0x3b57('0xf')](_0x3b57('0x10'),_0x36a88e,_0x3b57('0x11'));logger[_0x3b57('0x12')](_0x3b57('0x13'),_0x36a88e,_0x3b57('0x11'),JSON['stringify'](_0xb8a66b));if(_0xb8a66b['error']){if(_0xb8a66b['error'][_0x3b57('0x14')]===0x1f4){logger['error'](_0x3b57('0x10'),_0x36a88e,_0xb8a66b[_0x3b57('0x15')]['message']);return _0x53f34f(_0xb8a66b['error'][_0x3b57('0x16')]);}logger[_0x3b57('0x15')](_0x3b57('0x10'),_0x36a88e,_0xb8a66b[_0x3b57('0x15')]['message']);return _0x59cbba(_0xb8a66b[_0x3b57('0x15')]['message']);}else{logger[_0x3b57('0xf')](_0x3b57('0x10'),_0x36a88e,_0x3b57('0x11'));_0x59cbba(_0xb8a66b[_0x3b57('0x17')][_0x3b57('0x16')]);}})[_0x3b57('0x18')](function(_0x2c1d6d){logger[_0x3b57('0x15')](_0x3b57('0x10'),_0x36a88e,_0x2c1d6d);_0x53f34f(_0x2c1d6d);});});}exports['CreateChatMessage']=function(_0x1db958){var _0x56c127=this;return new Promise(function(_0x8488ca,_0x1477bc){return db[_0x3b57('0x19')][_0x3b57('0x1a')](_0x1db958[_0x3b57('0x1b')],{'raw':_0x1db958['options']?_0x1db958['options'][_0x3b57('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x32fe49){logger[_0x3b57('0xf')](_0x3b57('0x1d'),_0x1db958);logger[_0x3b57('0x12')](_0x3b57('0x1d'),_0x1db958,JSON[_0x3b57('0x1e')](_0x32fe49));_0x8488ca(_0x32fe49);})[_0x3b57('0x18')](function(_0x3265f4){logger['error'](_0x3b57('0x1d'),_0x3265f4[_0x3b57('0x16')],_0x1db958);_0x1477bc(_0x56c127['error'](0x1f4,_0x3265f4[_0x3b57('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 433e305..1fe586a 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 _0x379e=['./chatMessage.events','emit','removeListener','length','chatMessage:'];(function(_0x335271,_0x5025f2){var _0xa9fff8=function(_0x28d0bd){while(--_0x28d0bd){_0x335271['push'](_0x335271['shift']());}};_0xa9fff8(++_0x5025f2);}(_0x379e,0x104));var _0xe379=function(_0x3f0ba1,_0xfb3397){_0x3f0ba1=_0x3f0ba1-0x0;var _0x50ac0f=_0x379e[_0x3f0ba1];return _0x50ac0f;};'use strict';var ChatMessageEvents=require(_0xe379('0x0'));var events=['save','remove','update'];function createListener(_0x594cd4,_0xccbef2){return function(_0x1e24f9){_0xccbef2[_0xe379('0x1')](_0x594cd4,_0x1e24f9);};}function removeListener(_0x3db31a,_0x475418){return function(){ChatMessageEvents[_0xe379('0x2')](_0x3db31a,_0x475418);};}exports['register']=function(_0x1f6c46){for(var _0x24221c=0x0,_0x166621=events[_0xe379('0x3')];_0x24221c<_0x166621;_0x24221c++){var _0x22cb37=events[_0x24221c];var _0x5475e7=createListener(_0xe379('0x4')+_0x22cb37,_0x1f6c46);ChatMessageEvents['on'](_0x22cb37,_0x5475e7);}}; \ No newline at end of file +var _0x5334=['update','chatMessage:','./chatMessage.events','save','remove'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x5334,0x84));var _0x4533=function(_0x3db511,_0x44be0c){_0x3db511=_0x3db511-0x0;var _0x28f626=_0x5334[_0x3db511];return _0x28f626;};'use strict';var ChatMessageEvents=require(_0x4533('0x0'));var events=[_0x4533('0x1'),_0x4533('0x2'),_0x4533('0x3')];function createListener(_0x39af56,_0x52b768){return function(_0x17585f){_0x52b768['emit'](_0x39af56,_0x17585f);};}function removeListener(_0x42184d,_0x11ce61){return function(){ChatMessageEvents['removeListener'](_0x42184d,_0x11ce61);};}exports['register']=function(_0x51b4ce){for(var _0x201673=0x0,_0x4dea06=events['length'];_0x201673<_0x4dea06;_0x201673++){var _0x487906=events[_0x201673];var _0x3fbdc3=createListener(_0x4533('0x4')+_0x487906,_0x51b4ce);ChatMessageEvents['on'](_0x487906,_0x3fbdc3);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index b39101d..0f47702 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 _0x0a7f=['isAuthenticated','/describe','describe','/:id','post','tracked','chatmessage:create','create','put','update','accept','/:id/reject','reject','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get'];(function(_0x48928d,_0x5b3413){var _0x45367f=function(_0x31a008){while(--_0x31a008){_0x48928d['push'](_0x48928d['shift']());}};_0x45367f(++_0x5b3413);}(_0x0a7f,0xb0));var _0xf0a7=function(_0x198add,_0x239d3c){_0x198add=_0x198add-0x0;var _0x35bfaa=_0x0a7f[_0x198add];return _0x35bfaa;};'use strict';var multer=require(_0xf0a7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf0a7('0x1'));var router=express[_0xf0a7('0x2')]();var fs_extra=require(_0xf0a7('0x3'));var auth=require(_0xf0a7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf0a7('0x5'));var controller=require(_0xf0a7('0x6'));router[_0xf0a7('0x7')]('/',auth[_0xf0a7('0x8')](),controller['index']);router[_0xf0a7('0x7')](_0xf0a7('0x9'),auth[_0xf0a7('0x8')](),controller[_0xf0a7('0xa')]);router[_0xf0a7('0x7')](_0xf0a7('0xb'),auth[_0xf0a7('0x8')](),controller['show']);router[_0xf0a7('0xc')]('/',auth[_0xf0a7('0x8')](),interaction[_0xf0a7('0xd')]('chat',_0xf0a7('0xe')),controller[_0xf0a7('0xf')]);router[_0xf0a7('0x10')](_0xf0a7('0xb'),controller[_0xf0a7('0x11')]);router[_0xf0a7('0x10')]('/:id/accept',auth['isAuthenticated'](),controller[_0xf0a7('0x12')]);router[_0xf0a7('0x10')](_0xf0a7('0x13'),auth[_0xf0a7('0x8')](),controller[_0xf0a7('0x14')]);router['delete']('/:id',auth[_0xf0a7('0x8')](),controller[_0xf0a7('0x15')]);module[_0xf0a7('0x16')]=router; \ No newline at end of file +var _0xa94f=['../../components/auth/service','../../config/environment','./chatMessage.controller','get','index','isAuthenticated','describe','/:id','show','post','tracked','chat','chatmessage:create','put','update','accept','/:id/reject','reject','delete','destroy','multer','util','Router'];(function(_0x4f631a,_0x34bb43){var _0x37ec95=function(_0x294331){while(--_0x294331){_0x4f631a['push'](_0x4f631a['shift']());}};_0x37ec95(++_0x34bb43);}(_0xa94f,0x184));var _0xfa94=function(_0x2a1f02,_0x411fc1){_0x2a1f02=_0x2a1f02-0x0;var _0x385f3f=_0xa94f[_0x2a1f02];return _0x385f3f;};'use strict';var multer=require(_0xfa94('0x0'));var util=require(_0xfa94('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa94('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfa94('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfa94('0x4'));var controller=require(_0xfa94('0x5'));router[_0xfa94('0x6')]('/',auth['isAuthenticated'](),controller[_0xfa94('0x7')]);router[_0xfa94('0x6')]('/describe',auth[_0xfa94('0x8')](),controller[_0xfa94('0x9')]);router['get'](_0xfa94('0xa'),auth['isAuthenticated'](),controller[_0xfa94('0xb')]);router[_0xfa94('0xc')]('/',auth[_0xfa94('0x8')](),interaction[_0xfa94('0xd')](_0xfa94('0xe'),_0xfa94('0xf')),controller['create']);router[_0xfa94('0x10')](_0xfa94('0xa'),controller[_0xfa94('0x11')]);router['put']('/:id/accept',auth[_0xfa94('0x8')](),controller[_0xfa94('0x12')]);router[_0xfa94('0x10')](_0xfa94('0x13'),auth['isAuthenticated'](),controller[_0xfa94('0x14')]);router[_0xfa94('0x15')](_0xfa94('0xa'),auth[_0xfa94('0x8')](),controller[_0xfa94('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index e04917f..c91f503 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 _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x279d0a,_0xd987ba){var _0x403056=function(_0x38e9f2){while(--_0x38e9f2){_0x279d0a['push'](_0x279d0a['shift']());}};_0x403056(++_0xd987ba);}(_0x5f2f,0x73));var _0xf5f2=function(_0x34646f,_0x55a313){_0x34646f=_0x34646f-0x0;var _0x490624=_0x5f2f[_0x34646f];return _0x490624;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x577677,_0x150870){var _0x3a9818=function(_0x23b6ce){while(--_0x23b6ce){_0x577677['push'](_0x577677['shift']());}};_0x3a9818(++_0x150870);}(_0x5f2f,0x73));var _0xf5f2=function(_0x197789,_0x43d35b){_0x197789=_0x197789-0x0;var _0x48dcd=_0x5f2f[_0x197789];return _0x48dcd;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index b33ed98..330ad2c 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x7a54,0x106));var _0x47a5=function(_0x24a553,_0x5c9959){_0x24a553=_0x24a553-0x0;var _0x451aa5=_0x7a54[_0x24a553];return _0x451aa5;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _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(_0x53fbb7,_0x37a6f8){var _0x3075f8=function(_0x279717){while(--_0x279717){_0x53fbb7['push'](_0x53fbb7['shift']());}};_0x3075f8(++_0x37a6f8);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 9bc4949..6e80f88 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2619=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x328378,_0x1ce409){var _0x57f607=function(_0x22aec3){while(--_0x22aec3){_0x328378['push'](_0x328378['shift']());}};_0x57f607(++_0x1ce409);}(_0x2619,0x168));var _0x9261=function(_0x25a1c3,_0x4962c7){_0x25a1c3=_0x25a1c3-0x0;var _0x47b7a8=_0x2619[_0x25a1c3];return _0x47b7a8;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require(_0x9261('0x0'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x9261('0x1')](0x0);var events={'afterCreate':_0x9261('0x2'),'afterUpdate':_0x9261('0x3'),'afterDestroy':_0x9261('0x4')};function emitEvent(_0x32ac7d){return function(_0x54e29b,_0x2eabab,_0x1dc634){ChatOfflineMessageEvents[_0x9261('0x5')](_0x32ac7d+':'+_0x54e29b['id'],_0x54e29b);ChatOfflineMessageEvents[_0x9261('0x5')](_0x32ac7d,_0x54e29b);_0x1dc634(null);};}for(var e in events){if(events[_0x9261('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x9261('0x7')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0xa445=['events','../../mysqldb','update','emit','hasOwnProperty'];(function(_0x58725a,_0x389d19){var _0x2e6e65=function(_0x2f034e){while(--_0x2f034e){_0x58725a['push'](_0x58725a['shift']());}};_0x2e6e65(++_0x389d19);}(_0xa445,0xfa));var _0x5a44=function(_0x1909fa,_0x167ebe){_0x1909fa=_0x1909fa-0x0;var _0x2b1caa=_0xa445[_0x1909fa];return _0x2b1caa;};'use strict';var EventEmitter=require(_0x5a44('0x0'));var ChatOfflineMessage=require(_0x5a44('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5a44('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5b5f27){return function(_0x4d06bb,_0x1a3581,_0x10e14d){ChatOfflineMessageEvents[_0x5a44('0x3')](_0x5b5f27+':'+_0x4d06bb['id'],_0x4d06bb);ChatOfflineMessageEvents['emit'](_0x5b5f27,_0x4d06bb);_0x10e14d(null);};}for(var e in events){if(events[_0x5a44('0x4')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 4374bd4..4b44e07 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 _0x068c=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x48e53c,_0x24baf7){var _0xb8dae2=function(_0x244913){while(--_0x244913){_0x48e53c['push'](_0x48e53c['shift']());}};_0xb8dae2(++_0x24baf7);}(_0x068c,0xdc));var _0xc068=function(_0x49bbf8,_0x31ea69){_0x49bbf8=_0x49bbf8-0x0;var _0x29d1d7=_0x068c[_0x49bbf8];return _0x29d1d7;};'use strict';var attributes=require(_0xc068('0x0'));module[_0xc068('0x1')]=function(_0x5129b4){return _0x5129b4[_0xc068('0x2')](_0xc068('0x3'),attributes,{'tableName':_0xc068('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc068('0x5')});}; \ No newline at end of file +var _0xf8a1=['exports','utf8mb4'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf8a1,0x68));var _0x1f8a=function(_0x23ae76,_0x4f5909){_0x23ae76=_0x23ae76-0x0;var _0x36b7cf=_0xf8a1[_0x23ae76];return _0x36b7cf;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x1f8a('0x0')]=function(_0x412018){return _0x412018['define']('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1f8a('0x1'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 8084eca..93a6e13 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 _0xfe52=['code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','ChatOfflineMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x2ae0af,_0x2ba5f2){var _0xbd8402=function(_0x417762){while(--_0x417762){_0x2ae0af['push'](_0x2ae0af['shift']());}};_0xbd8402(++_0x2ba5f2);}(_0xfe52,0x1a8));var _0x2fe5=function(_0x4472b6,_0x3768b6){_0x4472b6=_0x4472b6-0x0;var _0x153531=_0xfe52[_0x4472b6];return _0x153531;};'use strict';var _=require(_0x2fe5('0x0'));var util=require(_0x2fe5('0x1'));var moment=require(_0x2fe5('0x2'));var BPromise=require('bluebird');var rs=require(_0x2fe5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2fe5('0x4'))['db'];var utils=require(_0x2fe5('0x5'));var logger=require(_0x2fe5('0x6'))(_0x2fe5('0x7'));var config=require('../../config/environment');var jayson=require(_0x2fe5('0x8'));var client=jayson[_0x2fe5('0x9')][_0x2fe5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40e891,_0x3575e3,_0x5d0d9e){return new BPromise(function(_0x2970b9,_0x285761){return client[_0x2fe5('0xb')](_0x40e891,_0x5d0d9e)['then'](function(_0x113c43){logger['info'](_0x2fe5('0xc'),_0x3575e3,'request\x20sent');logger[_0x2fe5('0xd')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x3575e3,_0x2fe5('0xe'),JSON[_0x2fe5('0xf')](_0x113c43));if(_0x113c43[_0x2fe5('0x10')]){if(_0x113c43[_0x2fe5('0x10')][_0x2fe5('0x11')]===0x1f4){logger[_0x2fe5('0x10')](_0x2fe5('0xc'),_0x3575e3,_0x113c43[_0x2fe5('0x10')]['message']);return _0x285761(_0x113c43[_0x2fe5('0x10')]['message']);}logger['error'](_0x2fe5('0xc'),_0x3575e3,_0x113c43[_0x2fe5('0x10')][_0x2fe5('0x12')]);return _0x2970b9(_0x113c43[_0x2fe5('0x10')][_0x2fe5('0x12')]);}else{logger['info'](_0x2fe5('0xc'),_0x3575e3,'request\x20sent');_0x2970b9(_0x113c43[_0x2fe5('0x13')][_0x2fe5('0x12')]);}})[_0x2fe5('0x14')](function(_0x137723){logger[_0x2fe5('0x10')](_0x2fe5('0xc'),_0x3575e3,_0x137723);_0x285761(_0x137723);});});} \ No newline at end of file +var _0x53ba=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0xdb4cf,_0x319856){var _0x504265=function(_0x531daa){while(--_0x531daa){_0xdb4cf['push'](_0xdb4cf['shift']());}};_0x504265(++_0x319856);}(_0x53ba,0x18a));var _0xa53b=function(_0x272084,_0x5d30c1){_0x272084=_0x272084-0x0;var _0x1bb50f=_0x53ba[_0x272084];return _0x1bb50f;};'use strict';var _=require(_0xa53b('0x0'));var util=require(_0xa53b('0x1'));var moment=require(_0xa53b('0x2'));var BPromise=require(_0xa53b('0x3'));var rs=require(_0xa53b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa53b('0x5'));var logger=require(_0xa53b('0x6'))(_0xa53b('0x7'));var config=require(_0xa53b('0x8'));var jayson=require(_0xa53b('0x9'));var client=jayson[_0xa53b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x202134,_0x237755,_0x5c63ba){return new BPromise(function(_0x178981,_0x44bff6){return client[_0xa53b('0xb')](_0x202134,_0x5c63ba)['then'](function(_0x10dea8){logger[_0xa53b('0xc')](_0xa53b('0xd'),_0x237755,_0xa53b('0xe'));logger['debug'](_0xa53b('0xf'),_0x237755,_0xa53b('0xe'),JSON[_0xa53b('0x10')](_0x10dea8));if(_0x10dea8[_0xa53b('0x11')]){if(_0x10dea8[_0xa53b('0x11')][_0xa53b('0x12')]===0x1f4){logger[_0xa53b('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x237755,_0x10dea8[_0xa53b('0x11')][_0xa53b('0x13')]);return _0x44bff6(_0x10dea8['error'][_0xa53b('0x13')]);}logger['error'](_0xa53b('0xd'),_0x237755,_0x10dea8['error'][_0xa53b('0x13')]);return _0x178981(_0x10dea8['error'][_0xa53b('0x13')]);}else{logger[_0xa53b('0xc')](_0xa53b('0xd'),_0x237755,'request\x20sent');_0x178981(_0x10dea8[_0xa53b('0x14')][_0xa53b('0x13')]);}})['catch'](function(_0x36a5a4){logger['error'](_0xa53b('0xd'),_0x237755,_0x36a5a4);_0x44bff6(_0x36a5a4);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 6e4620e..e4a485f 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 _0x2df9=['isAuthenticated','index','describe','show','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x23f8d2,_0x301fec){var _0x5d174b=function(_0x2c3c9e){while(--_0x2c3c9e){_0x23f8d2['push'](_0x23f8d2['shift']());}};_0x5d174b(++_0x301fec);}(_0x2df9,0x172));var _0x92df=function(_0x14da79,_0x3b626e){_0x14da79=_0x14da79-0x0;var _0xb1b31a=_0x2df9[_0x14da79];return _0xb1b31a;};'use strict';var multer=require(_0x92df('0x0'));var util=require(_0x92df('0x1'));var path=require('path');var timeout=require(_0x92df('0x2'));var express=require(_0x92df('0x3'));var router=express[_0x92df('0x4')]();var fs_extra=require(_0x92df('0x5'));var auth=require(_0x92df('0x6'));var interaction=require(_0x92df('0x7'));var config=require(_0x92df('0x8'));var controller=require('./chatOfflineMessage.controller');router[_0x92df('0x9')]('/',auth[_0x92df('0xa')](),controller[_0x92df('0xb')]);router['get']('/describe',auth[_0x92df('0xa')](),controller[_0x92df('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x92df('0xd')]);router['post']('/',auth[_0x92df('0xa')](),controller['create']);router['put'](_0x92df('0xe'),auth[_0x92df('0xa')](),controller[_0x92df('0xf')]);router[_0x92df('0x10')](_0x92df('0xe'),auth[_0x92df('0xa')](),controller[_0x92df('0x11')]);module[_0x92df('0x12')]=router; \ No newline at end of file +var _0x1c2e=['create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','/describe','isAuthenticated','describe','/:id','post'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x1c2e,0x193));var _0xe1c2=function(_0x5bc258,_0x406d3c){_0x5bc258=_0x5bc258-0x0;var _0xe9ae4f=_0x1c2e[_0x5bc258];return _0xe9ae4f;};'use strict';var multer=require(_0xe1c2('0x0'));var util=require(_0xe1c2('0x1'));var path=require(_0xe1c2('0x2'));var timeout=require(_0xe1c2('0x3'));var express=require(_0xe1c2('0x4'));var router=express[_0xe1c2('0x5')]();var fs_extra=require(_0xe1c2('0x6'));var auth=require(_0xe1c2('0x7'));var interaction=require(_0xe1c2('0x8'));var config=require(_0xe1c2('0x9'));var controller=require(_0xe1c2('0xa'));router[_0xe1c2('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe1c2('0xb')](_0xe1c2('0xc'),auth[_0xe1c2('0xd')](),controller[_0xe1c2('0xe')]);router[_0xe1c2('0xb')](_0xe1c2('0xf'),auth[_0xe1c2('0xd')](),controller['show']);router[_0xe1c2('0x10')]('/',auth['isAuthenticated'](),controller[_0xe1c2('0x11')]);router['put'](_0xe1c2('0xf'),auth[_0xe1c2('0xd')](),controller[_0xe1c2('0x12')]);router[_0xe1c2('0x13')](_0xe1c2('0xf'),auth[_0xe1c2('0xd')](),controller['destroy']);module[_0xe1c2('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index db0910b..5d16ff6 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 _0x7ae8=['exports','STRING','ENUM','mouseOver','timeout','INTEGER','sequelize'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x7ae8,0xd8));var _0x87ae=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7ae8[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x87ae('0x0'));module[_0x87ae('0x1')]={'name':{'type':Sequelize[_0x87ae('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x87ae('0x3')](_0x87ae('0x4'),_0x87ae('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x87ae('0x6')]}}; \ No newline at end of file +var _0x207f=['mouseOver','INTEGER','sequelize','STRING','ENUM','timeout'];(function(_0x35e8c2,_0x1fc071){var _0x1c6bbe=function(_0x39dccb){while(--_0x39dccb){_0x35e8c2['push'](_0x35e8c2['shift']());}};_0x1c6bbe(++_0x1fc071);}(_0x207f,0x158));var _0xf207=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x207f[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xf207('0x0'));module['exports']={'name':{'type':Sequelize[_0xf207('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf207('0x2')]('mouseOver',_0xf207('0x3')),'defaultValue':_0xf207('0x4')},'selector':{'type':Sequelize[_0xf207('0x1')]},'timeout':{'type':Sequelize[_0xf207('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index ff1470a..d313801 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 _0xbe52=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x3c55f2,_0x47f857){var _0x43fea0=function(_0x2d61f4){while(--_0x2d61f4){_0x3c55f2['push'](_0x3c55f2['shift']());}};_0x43fea0(++_0x47f857);}(_0xbe52,0x164));var _0x2be5=function(_0x415f2b,_0x13e8b4){_0x415f2b=_0x415f2b-0x0;var _0x172201=_0xbe52[_0x415f2b];return _0x172201;};'use strict';var emlformat=require(_0x2be5('0x0'));var rimraf=require(_0x2be5('0x1'));var zipdir=require(_0x2be5('0x2'));var jsonpatch=require(_0x2be5('0x3'));var rp=require(_0x2be5('0x4'));var moment=require('moment');var BPromise=require(_0x2be5('0x5'));var Mustache=require(_0x2be5('0x6'));var util=require(_0x2be5('0x7'));var path=require(_0x2be5('0x8'));var sox=require(_0x2be5('0x9'));var csv=require(_0x2be5('0xa'));var ejs=require(_0x2be5('0xb'));var fs=require('fs');var fs_extra=require(_0x2be5('0xc'));var _=require(_0x2be5('0xd'));var squel=require(_0x2be5('0xe'));var crypto=require(_0x2be5('0xf'));var jsforce=require(_0x2be5('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x2be5('0xa'));var querystring=require(_0x2be5('0x11'));var Papa=require(_0x2be5('0x12'));var Redis=require('ioredis');var authService=require(_0x2be5('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2be5('0x14'));var logger=require(_0x2be5('0x15'))(_0x2be5('0x16'));var utils=require(_0x2be5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2be5('0x18'));var db=require(_0x2be5('0x19'))['db'];function respondWithStatusCode(_0x5ce5ca,_0x588a62){_0x588a62=_0x588a62||0xcc;return function(_0x25b643){if(_0x25b643){return _0x5ce5ca[_0x2be5('0x1a')](_0x588a62);}return _0x5ce5ca['status'](_0x588a62)[_0x2be5('0x1b')]();};}function respondWithResult(_0x3af879,_0xd905c9){_0xd905c9=_0xd905c9||0xc8;return function(_0x71834e){if(_0x71834e){return _0x3af879[_0x2be5('0x1c')](_0xd905c9)[_0x2be5('0x1d')](_0x71834e);}};}function respondWithFilteredResult(_0x4a1be3,_0x4f8fce){return function(_0x3f4996){if(_0x3f4996){var _0x5e6f16=typeof _0x4f8fce[_0x2be5('0x1e')]==='undefined'&&typeof _0x4f8fce[_0x2be5('0x1f')]===_0x2be5('0x20');var _0x35db37=_0x3f4996['count'];var _0x8ea605=_0x5e6f16?0x0:_0x4f8fce[_0x2be5('0x1e')];var _0x544625=_0x5e6f16?_0x3f4996[_0x2be5('0x21')]:_0x4f8fce[_0x2be5('0x1e')]+_0x4f8fce[_0x2be5('0x1f')];var _0x1bffbf;if(_0x544625>=_0x35db37){_0x544625=_0x35db37;_0x1bffbf=0xc8;}else{_0x1bffbf=0xce;}_0x4a1be3[_0x2be5('0x1c')](_0x1bffbf);return _0x4a1be3[_0x2be5('0x22')](_0x2be5('0x23'),_0x8ea605+'-'+_0x544625+'/'+_0x35db37)['json'](_0x3f4996);}return null;};}function patchUpdates(_0x514223){return function(_0x329cf0){try{jsonpatch[_0x2be5('0x24')](_0x329cf0,_0x514223,!![]);}catch(_0x1bafd2){return BPromise[_0x2be5('0x25')](_0x1bafd2);}return _0x329cf0['save']();};}function saveUpdates(_0x2ecc64,_0x2bc13e){return function(_0x2bbe9f){if(_0x2bbe9f){return _0x2bbe9f[_0x2be5('0x26')](_0x2ecc64)[_0x2be5('0x27')](function(_0x3f78d4){return _0x3f78d4;});}return null;};}function removeEntity(_0x2b776f,_0x29910d){return function(_0x3f4430){if(_0x3f4430){return _0x3f4430[_0x2be5('0x28')]()['then'](function(){_0x2b776f[_0x2be5('0x1c')](0xcc)[_0x2be5('0x1b')]();});}};}function handleEntityNotFound(_0x323c2d,_0x4d3aee){return function(_0x25c47c){if(!_0x25c47c){_0x323c2d[_0x2be5('0x1a')](0x194);}return _0x25c47c;};}function handleError(_0x33ecf1,_0x127093){_0x127093=_0x127093||0x1f4;return function(_0x434637){logger[_0x2be5('0x29')](_0x434637['stack']);if(_0x434637[_0x2be5('0x2a')]){delete _0x434637[_0x2be5('0x2a')];}_0x33ecf1[_0x2be5('0x1c')](_0x127093)[_0x2be5('0x2b')](_0x434637);};}exports[_0x2be5('0x2c')]=function(_0x28c6bb,_0x19edba){var _0x5c8fec={'raw':!![],'where':{'id':_0x28c6bb[_0x2be5('0x2d')]['id']}},_0xed9be3={};_0xed9be3[_0x2be5('0x2e')]=_[_0x2be5('0x2f')](db[_0x2be5('0x30')][_0x2be5('0x31')]);_0xed9be3[_0x2be5('0x32')]=_['keys'](_0x28c6bb[_0x2be5('0x32')]);_0xed9be3[_0x2be5('0x33')]=_[_0x2be5('0x34')](_0xed9be3['model'],_0xed9be3[_0x2be5('0x32')]);_0x5c8fec[_0x2be5('0x35')]=_['intersection'](_0xed9be3[_0x2be5('0x2e')],qs[_0x2be5('0x36')](_0x28c6bb[_0x2be5('0x32')][_0x2be5('0x36')]));_0x5c8fec['attributes']=_0x5c8fec[_0x2be5('0x35')][_0x2be5('0x37')]?_0x5c8fec[_0x2be5('0x35')]:_0xed9be3['model'];if(_0x28c6bb['query'][_0x2be5('0x38')]){_0x5c8fec[_0x2be5('0x39')]=[{'all':!![]}];}_0x5c8fec=_[_0x2be5('0x3a')]({},_0x5c8fec,_0x28c6bb[_0x2be5('0x3b')]);return db[_0x2be5('0x30')][_0x2be5('0x3c')](_0x5c8fec)['then'](handleEntityNotFound(_0x19edba,null))[_0x2be5('0x27')](respondWithResult(_0x19edba,null))[_0x2be5('0x3d')](handleError(_0x19edba,null));};exports['create']=function(_0x101c6f,_0x935255){return db[_0x2be5('0x30')]['create'](_0x101c6f['body'],{})[_0x2be5('0x27')](respondWithResult(_0x935255,0xc9))[_0x2be5('0x3d')](handleError(_0x935255,null));};exports[_0x2be5('0x26')]=function(_0x1644be,_0x470f1d){if(_0x1644be[_0x2be5('0x3e')]['id']){delete _0x1644be[_0x2be5('0x3e')]['id'];}return db[_0x2be5('0x30')][_0x2be5('0x3c')]({'where':{'id':_0x1644be['params']['id']}})[_0x2be5('0x27')](handleEntityNotFound(_0x470f1d,null))[_0x2be5('0x27')](saveUpdates(_0x1644be[_0x2be5('0x3e')],null))['then'](respondWithResult(_0x470f1d,null))[_0x2be5('0x3d')](handleError(_0x470f1d,null));};exports[_0x2be5('0x28')]=function(_0x42f912,_0x4e21ff){return db['ChatProactiveAction'][_0x2be5('0x3c')]({'where':{'id':_0x42f912[_0x2be5('0x2d')]['id']}})[_0x2be5('0x27')](handleEntityNotFound(_0x4e21ff,null))['then'](removeEntity(_0x4e21ff,null))[_0x2be5('0x3d')](handleError(_0x4e21ff,null));}; \ No newline at end of file +var _0xa990=['offset','limit','json','save','update','then','error','stack','name','send','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','fields','attributes','length','include','merge','options','find','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','../../mysqldb','sendStatus','status','end','undefined','count'];(function(_0x3eef73,_0x61c3b2){var _0xe1b202=function(_0x12ca19){while(--_0x12ca19){_0x3eef73['push'](_0x3eef73['shift']());}};_0xe1b202(++_0x61c3b2);}(_0xa990,0xc9));var _0x0a99=function(_0x2e5f54,_0x13dd84){_0x2e5f54=_0x2e5f54-0x0;var _0x407d00=_0xa990[_0x2e5f54];return _0x407d00;};'use strict';var emlformat=require(_0x0a99('0x0'));var rimraf=require(_0x0a99('0x1'));var zipdir=require(_0x0a99('0x2'));var jsonpatch=require(_0x0a99('0x3'));var rp=require(_0x0a99('0x4'));var moment=require(_0x0a99('0x5'));var BPromise=require(_0x0a99('0x6'));var Mustache=require(_0x0a99('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0a99('0x8'));var csv=require(_0x0a99('0x9'));var ejs=require(_0x0a99('0xa'));var fs=require('fs');var fs_extra=require(_0x0a99('0xb'));var _=require(_0x0a99('0xc'));var squel=require(_0x0a99('0xd'));var crypto=require(_0x0a99('0xe'));var jsforce=require(_0x0a99('0xf'));var deskjs=require(_0x0a99('0x10'));var toCsv=require(_0x0a99('0x9'));var querystring=require(_0x0a99('0x11'));var Papa=require('papaparse');var Redis=require(_0x0a99('0x12'));var authService=require(_0x0a99('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a99('0x14'));var logger=require(_0x0a99('0x15'))(_0x0a99('0x16'));var utils=require(_0x0a99('0x17'));var config=require(_0x0a99('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a99('0x19'))['db'];function respondWithStatusCode(_0x3aaaad,_0x57ab88){_0x57ab88=_0x57ab88||0xcc;return function(_0xb6a34d){if(_0xb6a34d){return _0x3aaaad[_0x0a99('0x1a')](_0x57ab88);}return _0x3aaaad[_0x0a99('0x1b')](_0x57ab88)[_0x0a99('0x1c')]();};}function respondWithResult(_0x346061,_0x23d018){_0x23d018=_0x23d018||0xc8;return function(_0x18c124){if(_0x18c124){return _0x346061[_0x0a99('0x1b')](_0x23d018)['json'](_0x18c124);}};}function respondWithFilteredResult(_0x5a17e1,_0x2c40db){return function(_0x3ac17e){if(_0x3ac17e){var _0xb7356c=typeof _0x2c40db['offset']===_0x0a99('0x1d')&&typeof _0x2c40db['limit']==='undefined';var _0x20104c=_0x3ac17e[_0x0a99('0x1e')];var _0x3de006=_0xb7356c?0x0:_0x2c40db[_0x0a99('0x1f')];var _0x572ce5=_0xb7356c?_0x3ac17e['count']:_0x2c40db[_0x0a99('0x1f')]+_0x2c40db[_0x0a99('0x20')];var _0xbe23f3;if(_0x572ce5>=_0x20104c){_0x572ce5=_0x20104c;_0xbe23f3=0xc8;}else{_0xbe23f3=0xce;}_0x5a17e1[_0x0a99('0x1b')](_0xbe23f3);return _0x5a17e1['set']('Content-Range',_0x3de006+'-'+_0x572ce5+'/'+_0x20104c)[_0x0a99('0x21')](_0x3ac17e);}return null;};}function patchUpdates(_0x4d0c78){return function(_0x1e8d30){try{jsonpatch['apply'](_0x1e8d30,_0x4d0c78,!![]);}catch(_0x191ee4){return BPromise['reject'](_0x191ee4);}return _0x1e8d30[_0x0a99('0x22')]();};}function saveUpdates(_0x356681,_0x3b1d60){return function(_0x1c1e5c){if(_0x1c1e5c){return _0x1c1e5c[_0x0a99('0x23')](_0x356681)[_0x0a99('0x24')](function(_0x19c870){return _0x19c870;});}return null;};}function removeEntity(_0x1d803c,_0x398dd2){return function(_0x5745ca){if(_0x5745ca){return _0x5745ca['destroy']()[_0x0a99('0x24')](function(){_0x1d803c[_0x0a99('0x1b')](0xcc)[_0x0a99('0x1c')]();});}};}function handleEntityNotFound(_0x518617,_0x5d917c){return function(_0x371b31){if(!_0x371b31){_0x518617[_0x0a99('0x1a')](0x194);}return _0x371b31;};}function handleError(_0x1b0e94,_0x40e765){_0x40e765=_0x40e765||0x1f4;return function(_0x10e70f){logger[_0x0a99('0x25')](_0x10e70f[_0x0a99('0x26')]);if(_0x10e70f[_0x0a99('0x27')]){delete _0x10e70f[_0x0a99('0x27')];}_0x1b0e94['status'](_0x40e765)[_0x0a99('0x28')](_0x10e70f);};}exports['show']=function(_0x47bc34,_0x4e597b){var _0x223bdb={'raw':!![],'where':{'id':_0x47bc34[_0x0a99('0x29')]['id']}},_0x379c7e={};_0x379c7e[_0x0a99('0x2a')]=_[_0x0a99('0x2b')](db[_0x0a99('0x2c')][_0x0a99('0x2d')]);_0x379c7e['query']=_[_0x0a99('0x2b')](_0x47bc34[_0x0a99('0x2e')]);_0x379c7e[_0x0a99('0x2f')]=_[_0x0a99('0x30')](_0x379c7e['model'],_0x379c7e['query']);_0x223bdb['attributes']=_[_0x0a99('0x30')](_0x379c7e[_0x0a99('0x2a')],qs[_0x0a99('0x31')](_0x47bc34['query'][_0x0a99('0x31')]));_0x223bdb[_0x0a99('0x32')]=_0x223bdb[_0x0a99('0x32')][_0x0a99('0x33')]?_0x223bdb[_0x0a99('0x32')]:_0x379c7e[_0x0a99('0x2a')];if(_0x47bc34[_0x0a99('0x2e')]['includeAll']){_0x223bdb[_0x0a99('0x34')]=[{'all':!![]}];}_0x223bdb=_[_0x0a99('0x35')]({},_0x223bdb,_0x47bc34[_0x0a99('0x36')]);return db[_0x0a99('0x2c')][_0x0a99('0x37')](_0x223bdb)['then'](handleEntityNotFound(_0x4e597b,null))[_0x0a99('0x24')](respondWithResult(_0x4e597b,null))['catch'](handleError(_0x4e597b,null));};exports['create']=function(_0x5f20d0,_0x51b4ec){return db[_0x0a99('0x2c')]['create'](_0x5f20d0[_0x0a99('0x38')],{})[_0x0a99('0x24')](respondWithResult(_0x51b4ec,0xc9))[_0x0a99('0x39')](handleError(_0x51b4ec,null));};exports[_0x0a99('0x23')]=function(_0x414a0f,_0x43614d){if(_0x414a0f[_0x0a99('0x38')]['id']){delete _0x414a0f[_0x0a99('0x38')]['id'];}return db[_0x0a99('0x2c')][_0x0a99('0x37')]({'where':{'id':_0x414a0f[_0x0a99('0x29')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x43614d,null))[_0x0a99('0x24')](saveUpdates(_0x414a0f['body'],null))[_0x0a99('0x24')](respondWithResult(_0x43614d,null))[_0x0a99('0x39')](handleError(_0x43614d,null));};exports['destroy']=function(_0x3f0a9,_0x549bb9){return db[_0x0a99('0x2c')]['find']({'where':{'id':_0x3f0a9[_0x0a99('0x29')]['id']}})[_0x0a99('0x24')](handleEntityNotFound(_0x549bb9,null))[_0x0a99('0x24')](removeEntity(_0x549bb9,null))[_0x0a99('0x39')](handleError(_0x549bb9,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index e74bdde..9e42e17 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 _0x56d6=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','ChatProactiveAction'];(function(_0x1583ba,_0x3f0972){var _0x51b6b5=function(_0x4c20db){while(--_0x4c20db){_0x1583ba['push'](_0x1583ba['shift']());}};_0x51b6b5(++_0x3f0972);}(_0x56d6,0x16b));var _0x656d=function(_0x438bea,_0x34be26){_0x438bea=_0x438bea-0x0;var _0x150797=_0x56d6[_0x438bea];return _0x150797;};'use strict';var _=require(_0x656d('0x0'));var util=require(_0x656d('0x1'));var logger=require(_0x656d('0x2'))(_0x656d('0x3'));var moment=require(_0x656d('0x4'));var BPromise=require(_0x656d('0x5'));var rp=require(_0x656d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x656d('0x7'));var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0x656d('0x8')]=function(_0x54cca9,_0x46702f){return _0x54cca9[_0x656d('0x9')](_0x656d('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44ba=['bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports','define','chat_proactive_actions','lodash','util','api','moment'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x44ba,0xe0));var _0xa44b=function(_0xf0f7ba,_0x48be70){_0xf0f7ba=_0xf0f7ba-0x0;var _0x44382c=_0x44ba[_0xf0f7ba];return _0x44382c;};'use strict';var _=require(_0xa44b('0x0'));var util=require(_0xa44b('0x1'));var logger=require('../../config/logger')(_0xa44b('0x2'));var moment=require(_0xa44b('0x3'));var BPromise=require(_0xa44b('0x4'));var rp=require(_0xa44b('0x5'));var fs=require('fs');var path=require(_0xa44b('0x6'));var rimraf=require('rimraf');var config=require(_0xa44b('0x7'));var attributes=require(_0xa44b('0x8'));module[_0xa44b('0x9')]=function(_0xc11e90,_0x5f4309){return _0xc11e90[_0xa44b('0xa')]('ChatProactiveAction',attributes,{'tableName':_0xa44b('0xb'),'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 c2a40f9..ca5ee07 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 _0x41bc=['message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x453a05,_0x102018){var _0xc42c7d=function(_0x39f5a3){while(--_0x39f5a3){_0x453a05['push'](_0x453a05['shift']());}};_0xc42c7d(++_0x102018);}(_0x41bc,0x1a7));var _0xc41b=function(_0xd1969,_0x5a6d5e){_0xd1969=_0xd1969-0x0;var _0x5056b7=_0x41bc[_0xd1969];return _0x5056b7;};'use strict';var _=require(_0xc41b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc41b('0x1'));var fs=require('fs');var Redis=require(_0xc41b('0x2'));var db=require(_0xc41b('0x3'))['db'];var utils=require(_0xc41b('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xc41b('0x5'));var jayson=require(_0xc41b('0x6'));var client=jayson[_0xc41b('0x7')][_0xc41b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28eba1,_0x43e0de,_0x528817){return new BPromise(function(_0x35e3ca,_0x2ce59c){return client[_0xc41b('0x9')](_0x28eba1,_0x528817)['then'](function(_0x12e2f1){logger[_0xc41b('0xa')](_0xc41b('0xb'),_0x43e0de,_0xc41b('0xc'));logger[_0xc41b('0xd')](_0xc41b('0xe'),_0x43e0de,'request\x20sent',JSON['stringify'](_0x12e2f1));if(_0x12e2f1[_0xc41b('0xf')]){if(_0x12e2f1['error'][_0xc41b('0x10')]===0x1f4){logger[_0xc41b('0xf')](_0xc41b('0xb'),_0x43e0de,_0x12e2f1[_0xc41b('0xf')][_0xc41b('0x11')]);return _0x2ce59c(_0x12e2f1['error']['message']);}logger[_0xc41b('0xf')](_0xc41b('0xb'),_0x43e0de,_0x12e2f1[_0xc41b('0xf')][_0xc41b('0x11')]);return _0x35e3ca(_0x12e2f1[_0xc41b('0xf')]['message']);}else{logger[_0xc41b('0xa')](_0xc41b('0xb'),_0x43e0de,_0xc41b('0xc'));_0x35e3ca(_0x12e2f1[_0xc41b('0x12')][_0xc41b('0x11')]);}})[_0xc41b('0x13')](function(_0x5c2e69){logger[_0xc41b('0xf')](_0xc41b('0xb'),_0x43e0de,_0x5c2e69);_0x2ce59c(_0x5c2e69);});});} \ No newline at end of file +var _0xeab5=['http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x25a719,_0x27803b){var _0x389724=function(_0x2cf7b3){while(--_0x2cf7b3){_0x25a719['push'](_0x25a719['shift']());}};_0x389724(++_0x27803b);}(_0xeab5,0x192));var _0x5eab=function(_0x33d9ae,_0x3b54b9){_0x33d9ae=_0x33d9ae-0x0;var _0x5dc9e2=_0xeab5[_0x33d9ae];return _0x5dc9e2;};'use strict';var _=require(_0x5eab('0x0'));var util=require(_0x5eab('0x1'));var moment=require(_0x5eab('0x2'));var BPromise=require('bluebird');var rs=require(_0x5eab('0x3'));var fs=require('fs');var Redis=require(_0x5eab('0x4'));var db=require(_0x5eab('0x5'))['db'];var utils=require(_0x5eab('0x6'));var logger=require(_0x5eab('0x7'))(_0x5eab('0x8'));var config=require(_0x5eab('0x9'));var jayson=require(_0x5eab('0xa'));var client=jayson[_0x5eab('0xb')][_0x5eab('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d8aa8,_0x38e526,_0x296872){return new BPromise(function(_0x36fe6b,_0x1178ba){return client[_0x5eab('0xd')](_0x2d8aa8,_0x296872)['then'](function(_0x3bc168){logger[_0x5eab('0xe')](_0x5eab('0xf'),_0x38e526,_0x5eab('0x10'));logger[_0x5eab('0x11')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x38e526,_0x5eab('0x10'),JSON['stringify'](_0x3bc168));if(_0x3bc168[_0x5eab('0x12')]){if(_0x3bc168[_0x5eab('0x12')][_0x5eab('0x13')]===0x1f4){logger[_0x5eab('0x12')](_0x5eab('0xf'),_0x38e526,_0x3bc168['error'][_0x5eab('0x14')]);return _0x1178ba(_0x3bc168[_0x5eab('0x12')][_0x5eab('0x14')]);}logger[_0x5eab('0x12')](_0x5eab('0xf'),_0x38e526,_0x3bc168[_0x5eab('0x12')][_0x5eab('0x14')]);return _0x36fe6b(_0x3bc168[_0x5eab('0x12')][_0x5eab('0x14')]);}else{logger[_0x5eab('0xe')](_0x5eab('0xf'),_0x38e526,_0x5eab('0x10'));_0x36fe6b(_0x3bc168[_0x5eab('0x15')][_0x5eab('0x14')]);}})[_0x5eab('0x16')](function(_0x59f9bd){logger[_0x5eab('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x38e526,_0x59f9bd);_0x1178ba(_0x59f9bd);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index f098059..98f5f05 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 _0x9c5a=['/:id','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create','put','update'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x1f74e4,_0x328659){_0x1f74e4=_0x1f74e4-0x0;var _0x2e8856=_0x9c5a[_0x1f74e4];return _0x2e8856;};'use strict';var multer=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var path=require('path');var timeout=require(_0xa9c5('0x2'));var express=require(_0xa9c5('0x3'));var router=express[_0xa9c5('0x4')]();var fs_extra=require(_0xa9c5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa9c5('0x6'));var config=require(_0xa9c5('0x7'));var controller=require('./chatProactiveAction.controller');router[_0xa9c5('0x8')]('/:id',auth[_0xa9c5('0x9')](),controller[_0xa9c5('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa9c5('0xb')]);router[_0xa9c5('0xc')]('/:id',auth[_0xa9c5('0x9')](),controller[_0xa9c5('0xd')]);router['delete'](_0xa9c5('0xe'),auth[_0xa9c5('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xeff8=['isAuthenticated','show','post','create','put','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xeff8,0x186));var _0x8eff=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xeff8[_0x3e5086];return _0xfeb102;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8eff('0x5'));var interaction=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var controller=require(_0x8eff('0x8'));router['get'](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller[_0x8eff('0xb')]);router[_0x8eff('0xc')]('/',auth['isAuthenticated'](),controller[_0x8eff('0xd')]);router[_0x8eff('0xe')](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller['update']);router['delete'](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller[_0x8eff('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 779b4bb..efef23f 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 _0x5140=['STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize'];(function(_0x220d39,_0x1abe28){var _0x356192=function(_0x35d5c6){while(--_0x35d5c6){_0x220d39['push'](_0x220d39['shift']());}};_0x356192(++_0x1abe28);}(_0x5140,0x19c));var _0x0514=function(_0x3af887,_0x514984){_0x3af887=_0x3af887-0x0;var _0x1c1e9e=_0x5140[_0x3af887];return _0x1c1e9e;};'use strict';var Sequelize=require(_0x0514('0x0'));module['exports']={'name':{'type':Sequelize[_0x0514('0x1')],'unique':_0x0514('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0514('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0514('0x4')](_0x0514('0x5'),_0x0514('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x9299=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x257a81,_0x58c5ab){var _0x14ee6d=function(_0x41e9b4){while(--_0x41e9b4){_0x257a81['push'](_0x257a81['shift']());}};_0x14ee6d(++_0x58c5ab);}(_0x9299,0xbb));var _0x9929=function(_0x2aab5c,_0x1590e5){_0x2aab5c=_0x2aab5c-0x0;var _0x3412b4=_0x9299[_0x2aab5c];return _0x3412b4;};'use strict';var Sequelize=require(_0x9929('0x0'));module[_0x9929('0x1')]={'name':{'type':Sequelize[_0x9929('0x2')],'unique':_0x9929('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9929('0x2')]},'timeout':{'type':Sequelize[_0x9929('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9929('0x5')](_0x9929('0x6'),'beepall',_0x9929('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index c7c48bb..1c9c18c 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 _0x0340=['field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','QueryTypes','every','includes','all','union','compact','removeTeams','forEach','userChatQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','lodash','squel','crypto','to-csv','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','defaults','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','json','offset','undefined','limit','apply','save','destroy','get','ChatQueues','UserProfileResource','sendStatus','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','count','include','findAll','rows','params','includeAll','create','body','role','user','UserProfileSection','find','userProfileId','autoAssociation','describe','getMembers','findOne','UserChatQueue','pick','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','ids','Agents','online','interface','flatMap','transaction','addTeams','each','findOrCreate','emit','userChatQueue:save','select'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x0340,0x1d7));var _0x0034=function(_0x1e8040,_0xda9ce7){_0x1e8040=_0x1e8040-0x0;var _0x24a40b=_0x0340[_0x1e8040];return _0x24a40b;};'use strict';var emlformat=require(_0x0034('0x0'));var rimraf=require(_0x0034('0x1'));var zipdir=require(_0x0034('0x2'));var jsonpatch=require(_0x0034('0x3'));var rp=require(_0x0034('0x4'));var moment=require(_0x0034('0x5'));var BPromise=require(_0x0034('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0034('0x7'));var sox=require(_0x0034('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0034('0x9'));var squel=require(_0x0034('0xa'));var crypto=require(_0x0034('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0034('0xc'));var querystring=require('querystring');var Papa=require(_0x0034('0xd'));var Redis=require(_0x0034('0xe'));var authService=require(_0x0034('0xf'));var qs=require(_0x0034('0x10'));var as=require(_0x0034('0x11'));var hardwareService=require(_0x0034('0x12'));var logger=require(_0x0034('0x13'))(_0x0034('0x14'));var utils=require(_0x0034('0x15'));var config=require(_0x0034('0x16'));var licenseUtil=require(_0x0034('0x17'));var db=require('../../mysqldb')['db'];config[_0x0034('0x18')]=_[_0x0034('0x19')](config[_0x0034('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x0034('0x1a'))(new Redis(config[_0x0034('0x18')]));require(_0x0034('0x1b'))[_0x0034('0x1c')](socket);var jayson=require(_0x0034('0x1d'));var client=jayson[_0x0034('0x1e')][_0x0034('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x164daa,_0x2ef597,_0x5e3e6b,_0x4ddd8c){return new BPromise(function(_0x2a6472,_0x5e2967){var _0x316a20=_0x4ddd8c||client;return _0x316a20[_0x0034('0x20')](_0x164daa,_0x5e3e6b)[_0x0034('0x21')](function(_0x54295f){logger['info'](_0x0034('0x22'),_0x2ef597,_0x0034('0x23'));logger[_0x0034('0x24')](_0x0034('0x25'),_0x2ef597,_0x0034('0x23'),JSON['stringify'](_0x54295f));if(_0x54295f['error']){if(_0x54295f[_0x0034('0x26')][_0x0034('0x27')]===0x1f4){logger[_0x0034('0x26')](_0x0034('0x22'),_0x2ef597,_0x54295f[_0x0034('0x26')][_0x0034('0x28')]);return _0x5e2967(_0x54295f[_0x0034('0x26')][_0x0034('0x28')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x2ef597,_0x54295f[_0x0034('0x26')][_0x0034('0x28')]);return _0x2a6472(_0x54295f[_0x0034('0x26')][_0x0034('0x28')]);}else{logger['info'](_0x0034('0x22'),_0x2ef597,_0x0034('0x23'));_0x2a6472(_0x54295f['result'][_0x0034('0x28')]);}})[_0x0034('0x29')](function(_0x2e6b9c){logger[_0x0034('0x26')](_0x0034('0x22'),_0x2ef597,_0x2e6b9c);_0x5e2967(_0x2e6b9c);});});}function respondWithStatusCode(_0x3f437f,_0x33ec19){_0x33ec19=_0x33ec19||0xcc;return function(_0x3df937){if(_0x3df937){return _0x3f437f['sendStatus'](_0x33ec19);}return _0x3f437f[_0x0034('0x2a')](_0x33ec19)[_0x0034('0x2b')]();};}function respondWithResult(_0x457b92,_0xca6eb7){_0xca6eb7=_0xca6eb7||0xc8;return function(_0x90c080){if(_0x90c080){return _0x457b92[_0x0034('0x2a')](_0xca6eb7)[_0x0034('0x2c')](_0x90c080);}};}function respondWithFilteredResult(_0x21762e,_0x302bcf){return function(_0x577c1f){if(_0x577c1f){var _0x3c01=typeof _0x302bcf[_0x0034('0x2d')]===_0x0034('0x2e')&&typeof _0x302bcf['limit']===_0x0034('0x2e');var _0x1f6d23=_0x577c1f['count'];var _0x35eebb=_0x3c01?0x0:_0x302bcf[_0x0034('0x2d')];var _0x4ddc28=_0x3c01?_0x577c1f['count']:_0x302bcf[_0x0034('0x2d')]+_0x302bcf[_0x0034('0x2f')];var _0x2a5f6e;if(_0x4ddc28>=_0x1f6d23){_0x4ddc28=_0x1f6d23;_0x2a5f6e=0xc8;}else{_0x2a5f6e=0xce;}_0x21762e[_0x0034('0x2a')](_0x2a5f6e);return _0x21762e['set']('Content-Range',_0x35eebb+'-'+_0x4ddc28+'/'+_0x1f6d23)[_0x0034('0x2c')](_0x577c1f);}return null;};}function patchUpdates(_0xd7c48d){return function(_0x5b6144){try{jsonpatch[_0x0034('0x30')](_0x5b6144,_0xd7c48d,!![]);}catch(_0x389482){return BPromise['reject'](_0x389482);}return _0x5b6144[_0x0034('0x31')]();};}function saveUpdates(_0x1399ec,_0x30edb0){return function(_0x26a983){if(_0x26a983){return _0x26a983['update'](_0x1399ec)[_0x0034('0x21')](function(_0x4d9923){return _0x4d9923;});}return null;};}function removeEntity(_0x4b35b4,_0x373954){return function(_0x56541c){if(_0x56541c){return _0x56541c[_0x0034('0x32')]()[_0x0034('0x21')](function(){var _0x270af5=_0x56541c[_0x0034('0x33')]({'plain':!![]});var _0xf8a9ec=_0x0034('0x34');return db[_0x0034('0x35')][_0x0034('0x32')]({'where':{'type':_0xf8a9ec,'resourceId':_0x270af5['id']}})[_0x0034('0x21')](function(){return _0x56541c;});})[_0x0034('0x21')](function(){_0x4b35b4['status'](0xcc)[_0x0034('0x2b')]();});}};}function handleEntityNotFound(_0x461b8a,_0x1e1f78){return function(_0x2de65b){if(!_0x2de65b){_0x461b8a[_0x0034('0x36')](0x194);}return _0x2de65b;};}function handleError(_0x150e1d,_0x1d973b){_0x1d973b=_0x1d973b||0x1f4;return function(_0x3f91d3){logger[_0x0034('0x26')](_0x3f91d3[_0x0034('0x37')]);if(_0x3f91d3[_0x0034('0x38')]){delete _0x3f91d3[_0x0034('0x38')];}_0x150e1d[_0x0034('0x2a')](_0x1d973b)[_0x0034('0x39')](_0x3f91d3);};}exports[_0x0034('0x3a')]=function(_0x251c60,_0x3caaf4){var _0x48aea8={},_0x8087cb={},_0x5a93ab={'count':0x0,'rows':[]};var _0x2998f7=_[_0x0034('0x3b')](db[_0x0034('0x3c')][_0x0034('0x3d')],function(_0x45f7fa){return{'name':_0x45f7fa[_0x0034('0x3e')],'type':_0x45f7fa['type'][_0x0034('0x3f')]};});_0x8087cb[_0x0034('0x40')]=_['map'](_0x2998f7,'name');_0x8087cb[_0x0034('0x41')]=_[_0x0034('0x42')](_0x251c60[_0x0034('0x41')]);_0x8087cb[_0x0034('0x43')]=_[_0x0034('0x44')](_0x8087cb[_0x0034('0x40')],_0x8087cb[_0x0034('0x41')]);_0x48aea8[_0x0034('0x45')]=_[_0x0034('0x44')](_0x8087cb['model'],qs['fields'](_0x251c60[_0x0034('0x41')][_0x0034('0x46')]));_0x48aea8[_0x0034('0x45')]=_0x48aea8[_0x0034('0x45')][_0x0034('0x47')]?_0x48aea8[_0x0034('0x45')]:_0x8087cb['model'];if(!_0x251c60['query'][_0x0034('0x48')](_0x0034('0x49'))){_0x48aea8[_0x0034('0x2f')]=qs[_0x0034('0x2f')](_0x251c60[_0x0034('0x41')][_0x0034('0x2f')]);_0x48aea8['offset']=qs['offset'](_0x251c60[_0x0034('0x41')][_0x0034('0x2d')]);}_0x48aea8[_0x0034('0x4a')]=qs[_0x0034('0x4b')](_0x251c60[_0x0034('0x41')]['sort']);_0x48aea8[_0x0034('0x4c')]=qs[_0x0034('0x43')](_['pick'](_0x251c60['query'],_0x8087cb['filters']),_0x2998f7);if(_0x251c60[_0x0034('0x41')][_0x0034('0x4d')]){_0x48aea8[_0x0034('0x4c')]=_[_0x0034('0x4e')](_0x48aea8[_0x0034('0x4c')],{'$or':_[_0x0034('0x3b')](_0x2998f7,function(_0x84a1c3){if(_0x84a1c3[_0x0034('0x4f')]!==_0x0034('0x50')){var _0x2d7625={};_0x2d7625[_0x84a1c3[_0x0034('0x38')]]={'$like':'%'+_0x251c60[_0x0034('0x41')][_0x0034('0x4d')]+'%'};return _0x2d7625;}})});}_0x48aea8=_[_0x0034('0x4e')]({},_0x48aea8,_0x251c60[_0x0034('0x51')]);var _0x190fbf={'where':_0x48aea8[_0x0034('0x4c')]};return db['ChatQueue']['count'](_0x190fbf)[_0x0034('0x21')](function(_0x254566){_0x5a93ab[_0x0034('0x52')]=_0x254566;if(_0x251c60[_0x0034('0x41')]['includeAll']){_0x48aea8[_0x0034('0x53')]=[{'all':!![]}];}return db[_0x0034('0x3c')][_0x0034('0x54')](_0x48aea8);})[_0x0034('0x21')](function(_0x174c45){_0x5a93ab[_0x0034('0x55')]=_0x174c45;return _0x5a93ab;})['then'](respondWithFilteredResult(_0x3caaf4,_0x48aea8))['catch'](handleError(_0x3caaf4,null));};exports['show']=function(_0x348700,_0x154eb7){var _0x222273={'raw':!![],'where':{'id':_0x348700[_0x0034('0x56')]['id']}},_0x2956ce={};_0x2956ce['model']=_[_0x0034('0x42')](db['ChatQueue'][_0x0034('0x3d')]);_0x2956ce[_0x0034('0x41')]=_[_0x0034('0x42')](_0x348700[_0x0034('0x41')]);_0x2956ce[_0x0034('0x43')]=_[_0x0034('0x44')](_0x2956ce[_0x0034('0x40')],_0x2956ce[_0x0034('0x41')]);_0x222273[_0x0034('0x45')]=_[_0x0034('0x44')](_0x2956ce[_0x0034('0x40')],qs[_0x0034('0x46')](_0x348700[_0x0034('0x41')]['fields']));_0x222273[_0x0034('0x45')]=_0x222273[_0x0034('0x45')]['length']?_0x222273[_0x0034('0x45')]:_0x2956ce[_0x0034('0x40')];if(_0x348700[_0x0034('0x41')][_0x0034('0x57')]){_0x222273[_0x0034('0x53')]=[{'all':!![]}];}_0x222273=_['merge']({},_0x222273,_0x348700[_0x0034('0x51')]);return db[_0x0034('0x3c')]['find'](_0x222273)[_0x0034('0x21')](handleEntityNotFound(_0x154eb7,null))[_0x0034('0x21')](respondWithResult(_0x154eb7,null))['catch'](handleError(_0x154eb7,null));};exports['create']=function(_0x510d5a,_0x476ba0){return db[_0x0034('0x3c')][_0x0034('0x58')](_0x510d5a[_0x0034('0x59')],{})[_0x0034('0x21')](function(_0x55ed3d){var _0x10975f=_0x510d5a['user'][_0x0034('0x33')]({'plain':!![]});if(!_0x10975f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10975f[_0x0034('0x5a')]===_0x0034('0x5b')){var _0x3e4757=_0x55ed3d['get']({'plain':!![]});var _0x53da13=_0x0034('0x34');return db[_0x0034('0x5c')][_0x0034('0x5d')]({'where':{'name':_0x53da13,'userProfileId':_0x10975f[_0x0034('0x5e')]},'raw':!![]})[_0x0034('0x21')](function(_0x1a6753){if(_0x1a6753&&_0x1a6753[_0x0034('0x5f')]===0x0){return db[_0x0034('0x35')]['create']({'name':_0x3e4757[_0x0034('0x38')],'resourceId':_0x3e4757['id'],'type':_0x1a6753[_0x0034('0x38')],'sectionId':_0x1a6753['id']},{})[_0x0034('0x21')](function(){return _0x55ed3d;});}else{return _0x55ed3d;}})['catch'](function(_0x178fc9){logger[_0x0034('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x178fc9);throw _0x178fc9;});}return _0x55ed3d;})[_0x0034('0x21')](respondWithResult(_0x476ba0,0xc9))['catch'](handleError(_0x476ba0,null));};exports['update']=function(_0x5cfb30,_0x2bb7a9){if(_0x5cfb30[_0x0034('0x59')]['id']){delete _0x5cfb30[_0x0034('0x59')]['id'];}return db[_0x0034('0x3c')]['find']({'where':{'id':_0x5cfb30[_0x0034('0x56')]['id']}})['then'](handleEntityNotFound(_0x2bb7a9,null))['then'](saveUpdates(_0x5cfb30['body'],null))[_0x0034('0x21')](respondWithResult(_0x2bb7a9,null))[_0x0034('0x29')](handleError(_0x2bb7a9,null));};exports[_0x0034('0x32')]=function(_0x231c80,_0x1b19c6){return db[_0x0034('0x3c')]['find']({'where':{'id':_0x231c80[_0x0034('0x56')]['id']}})[_0x0034('0x21')](handleEntityNotFound(_0x1b19c6,null))[_0x0034('0x21')](removeEntity(_0x1b19c6,null))['catch'](handleError(_0x1b19c6,null));};exports[_0x0034('0x60')]=function(_0x37a00d,_0xeaff03){return db[_0x0034('0x3c')][_0x0034('0x60')]()[_0x0034('0x21')](respondWithResult(_0xeaff03,null))[_0x0034('0x29')](handleError(_0xeaff03,null));};exports[_0x0034('0x61')]=function(_0x23c017,_0x441eda,_0x465df7){var _0x5097db={'raw':!![],'where':{}},_0x4dd925={},_0x39bd01;return db[_0x0034('0x3c')][_0x0034('0x62')]({'where':{'id':_0x23c017[_0x0034('0x56')]['id']}})[_0x0034('0x21')](handleEntityNotFound(_0x441eda,null))['then'](function(_0x52f815){if(_0x52f815){_0x39bd01=_0x52f815['get']({'plain':!![]});_0x4dd925[_0x0034('0x40')]=_[_0x0034('0x42')](db[_0x0034('0x63')]['rawAttributes']);_0x4dd925[_0x0034('0x41')]=_[_0x0034('0x42')](_0x23c017['query']);_0x4dd925[_0x0034('0x43')]=_['intersection'](_0x4dd925[_0x0034('0x40')],_0x4dd925[_0x0034('0x41')]);_0x5097db[_0x0034('0x45')]=_[_0x0034('0x44')](_0x4dd925[_0x0034('0x40')],qs['fields'](_0x23c017[_0x0034('0x41')][_0x0034('0x46')]));_0x5097db[_0x0034('0x45')]=_0x5097db[_0x0034('0x45')]['length']?_0x5097db[_0x0034('0x45')]:_0x4dd925[_0x0034('0x40')];if(!_0x23c017['query'][_0x0034('0x48')]('nolimit')){_0x5097db[_0x0034('0x2f')]=qs['limit'](_0x23c017[_0x0034('0x41')][_0x0034('0x2f')]);_0x5097db[_0x0034('0x2d')]=qs[_0x0034('0x2d')](_0x23c017['query'][_0x0034('0x2d')]);}_0x5097db['order']=qs['sort'](_0x23c017[_0x0034('0x41')][_0x0034('0x4b')]);_0x5097db[_0x0034('0x4c')]=qs['filters'](_[_0x0034('0x64')](_0x23c017[_0x0034('0x41')],_0x4dd925['filters']));_0x5097db[_0x0034('0x4c')][_0x0034('0x65')]=_0x52f815['id'];if(_0x23c017[_0x0034('0x41')][_0x0034('0x4d')]){_0x5097db['where']=_[_0x0034('0x4e')](_0x5097db['where'],{'$or':_['map'](_0x5097db['attributes'],function(_0x1917ea){var _0x2fced2={};_0x2fced2[_0x1917ea]={'$like':'%'+_0x23c017[_0x0034('0x41')][_0x0034('0x4d')]+'%'};return _0x2fced2;})});}_0x5097db=_[_0x0034('0x4e')]({},_0x5097db,_0x23c017[_0x0034('0x51')]);return db['UserChatQueue'][_0x0034('0x54')](_0x5097db);}})[_0x0034('0x21')](function(_0x34ab3c){if(_0x34ab3c){return db[_0x0034('0x66')][_0x0034('0x67')]({'where':{'id':_[_0x0034('0x3b')](_0x34ab3c,_0x0034('0x68')),'role':_0x0034('0x69')},'attributes':['id',_0x0034('0x38'),_0x0034('0x6a'),_0x0034('0x6b'),_0x0034('0x6c')]});}})[_0x0034('0x21')](function(_0x19cfe7){if(_0x19cfe7){return{'count':_0x19cfe7[_0x0034('0x52')],'rows':_[_0x0034('0x3b')](_0x19cfe7[_0x0034('0x55')],function(_0x3f4201){return{'membername':_0x3f4201['name'],'UserId':_0x3f4201['id'],'queue_name':_0x39bd01[_0x0034('0x38')],'ChatQueueId':_0x39bd01['id'],'interface':util['format'](_0x0034('0x6d'),_0x0034('0x6e'),_0x3f4201['name']),'penalty':0x0,'paused':_0x3f4201['chatPause'],'createdAt':_0x3f4201[_0x0034('0x6c')],'updatedAt':_0x3f4201[_0x0034('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0034('0x21')](respondWithFilteredResult(_0x441eda,_0x5097db))[_0x0034('0x29')](handleError(_0x441eda,null));};exports[_0x0034('0x6f')]=function(_0x4d0d5e,_0x41d32d,_0x13fb2a){var _0x3ff0f0={};var _0x3c3555={};var _0x98d50e;var _0x523934;return db['ChatQueue'][_0x0034('0x62')]({'where':{'id':_0x4d0d5e[_0x0034('0x56')]['id']}})[_0x0034('0x21')](handleEntityNotFound(_0x41d32d,null))['then'](function(_0x48fb9e){if(_0x48fb9e){_0x98d50e=_0x48fb9e;_0x3c3555['model']=_[_0x0034('0x42')](db[_0x0034('0x70')][_0x0034('0x3d')]);_0x3c3555[_0x0034('0x41')]=_[_0x0034('0x42')](_0x4d0d5e[_0x0034('0x41')]);_0x3c3555[_0x0034('0x43')]=_['intersection'](_0x3c3555[_0x0034('0x40')],_0x3c3555[_0x0034('0x41')]);_0x3ff0f0[_0x0034('0x45')]=_[_0x0034('0x44')](_0x3c3555[_0x0034('0x40')],qs[_0x0034('0x46')](_0x4d0d5e[_0x0034('0x41')][_0x0034('0x46')]));_0x3ff0f0['attributes']=_0x3ff0f0[_0x0034('0x45')][_0x0034('0x47')]?_0x3ff0f0['attributes']:_0x3c3555['model'];_0x3ff0f0[_0x0034('0x4a')]=qs[_0x0034('0x4b')](_0x4d0d5e[_0x0034('0x41')][_0x0034('0x4b')]);_0x3ff0f0[_0x0034('0x4c')]=qs[_0x0034('0x43')](_[_0x0034('0x64')](_0x4d0d5e[_0x0034('0x41')],_0x3c3555[_0x0034('0x43')]));if(_0x4d0d5e['query']['filter']){_0x3ff0f0['where']=_[_0x0034('0x4e')](_0x3ff0f0[_0x0034('0x4c')],{'$or':_[_0x0034('0x3b')](_0x3ff0f0[_0x0034('0x45')],function(_0x11c761){var _0x50a9aa={};_0x50a9aa[_0x11c761]={'$like':'%'+_0x4d0d5e[_0x0034('0x41')][_0x0034('0x4d')]+'%'};return _0x50a9aa;})});}_0x3ff0f0=_['merge']({},_0x3ff0f0,_0x4d0d5e[_0x0034('0x51')]);return _0x98d50e[_0x0034('0x6f')](_0x3ff0f0);}})['then'](function(_0x19e262){if(_0x19e262){_0x523934=_0x19e262[_0x0034('0x47')];if(!_0x4d0d5e[_0x0034('0x41')][_0x0034('0x48')](_0x0034('0x49'))){_0x3ff0f0['limit']=qs[_0x0034('0x2f')](_0x4d0d5e[_0x0034('0x41')][_0x0034('0x2f')]);_0x3ff0f0[_0x0034('0x2d')]=qs['offset'](_0x4d0d5e[_0x0034('0x41')][_0x0034('0x2d')]);}return _0x98d50e[_0x0034('0x6f')](_0x3ff0f0);}})['then'](function(_0x41a5fa){if(_0x41a5fa){return _0x41a5fa?{'count':_0x523934,'rows':_0x41a5fa}:null;}})[_0x0034('0x21')](respondWithResult(_0x41d32d,null))['catch'](handleError(_0x41d32d,null));};exports['addTeams']=function(_0x1f6936,_0x15c549,_0x4692e3){var _0x44a0b2=_0x1f6936[_0x0034('0x59')][_0x0034('0x71')];return db[_0x0034('0x70')][_0x0034('0x54')]({'where':{'id':_0x44a0b2},'attributes':['id'],'include':[{'model':db[_0x0034('0x66')],'as':_0x0034('0x72'),'attributes':['id','name',_0x0034('0x73'),'voicePause',_0x0034('0x74')],'raw':!![]}]})[_0x0034('0x21')](function(_0x1e9f14){if(_0x1e9f14){var _0x2b0b16=_[_0x0034('0x75')](_0x1e9f14,function(_0x4bd334){var _0x3f4cab=_0x4bd334['get']({'plain':!![]});return _0x3f4cab[_0x0034('0x72')];});return db['ChatQueue'][_0x0034('0x5d')]({'where':{'id':_0x1f6936[_0x0034('0x56')]['id']}})[_0x0034('0x21')](function(_0x5e0d2b){return db['sequelize'][_0x0034('0x76')](function(_0x5669c0){return _0x5e0d2b[_0x0034('0x77')](_0x44a0b2,{'transaction':_0x5669c0})['then'](function(){return BPromise[_0x0034('0x78')](_0x2b0b16,function(_0x24b862){return db[_0x0034('0x63')][_0x0034('0x79')]({'where':{'UserId':_0x24b862['id'],'ChatQueueId':_0x1f6936['params']['id']},'transaction':_0x5669c0});});})[_0x0034('0x21')](function(){_0x2b0b16['forEach'](function(_0x2f46b1){socket[_0x0034('0x7a')](_0x0034('0x7b'),{'UserId':_0x2f46b1['id'],'ChatQueueId':_0x5e0d2b['id']});});});});});}})[_0x0034('0x21')](respondWithStatusCode(_0x15c549,null))[_0x0034('0x29')](handleError(_0x15c549,null));};exports['removeTeams']=function(_0x16d295,_0x49e23e,_0x44ec45){return db['Team'][_0x0034('0x54')]({'where':{'id':_0x16d295[_0x0034('0x41')][_0x0034('0x71')]},'attributes':['id'],'include':[{'model':db[_0x0034('0x66')],'as':_0x0034('0x72'),'attributes':['id'],'raw':!![]}]})[_0x0034('0x21')](handleEntityNotFound(_0x49e23e,null))[_0x0034('0x21')](function(_0x2f3867){var _0x5390b1=_[_0x0034('0x3b')](_0x2f3867,'id');var _0x3fc569=[];var _0x19d2f8=[];var _0x38093a=squel[_0x0034('0x7c')]();_0x38093a[_0x0034('0x7d')](_0x0034('0x7e'))[_0x0034('0x7f')](_0x0034('0x80'),'tq')[_0x0034('0x81')](_0x0034('0x82'),'ut',_0x0034('0x83'))[_0x0034('0x4c')]('ChatQueueId\x20=\x20?',_0x16d295[_0x0034('0x56')]['id']);for(var _0x6c2a74=0x0;_0x6c2a74<_0x2f3867[_0x0034('0x47')];_0x6c2a74+=0x1){let _0xa7f352=_0x2f3867[_0x6c2a74];for(var _0x109042=0x0;_0x109042<_0xa7f352[_0x0034('0x72')][_0x0034('0x47')];_0x109042+=0x1){let _0x36f12e=_0xa7f352[_0x0034('0x72')][_0x109042];var _0x21ec0d=_0x38093a[_0x0034('0x84')]();_0x21ec0d[_0x0034('0x4c')]('ut.UserId\x20=\x20?',_0x36f12e['id']);_0x19d2f8[_0x0034('0x85')](db['sequelize'][_0x0034('0x41')](_0x21ec0d['toString'](),{'type':db[_0x0034('0x86')][_0x0034('0x87')]['SELECT']})[_0x0034('0x21')](function(_0x11269a){if(_0x11269a[_0x0034('0x47')]===0x1){return _0x36f12e['id'];}else{var _0x569294=_[_0x0034('0x88')](_[_0x0034('0x3b')](_0x11269a,'TeamId'),function(_0x3d1b6d){return _[_0x0034('0x89')](_0x5390b1,_0x3d1b6d);});if(_0x569294){return _0x36f12e['id'];}}}));}}return BPromise[_0x0034('0x8a')](_0x19d2f8)[_0x0034('0x21')](function(_0x235365){_0x3fc569=_(_0x3fc569)[_0x0034('0x8b')](_0x235365)[_0x0034('0x8c')]()['value']();return db[_0x0034('0x3c')][_0x0034('0x5d')]({'where':{'id':_0x16d295[_0x0034('0x56')]['id']}})[_0x0034('0x21')](function(_0x25aca8){return db[_0x0034('0x86')]['transaction'](function(_0x3b3e3d){return _0x25aca8[_0x0034('0x8d')](_0x16d295[_0x0034('0x41')]['ids'],{'transaction':_0x3b3e3d})['then'](function(){if(!_['isEmpty'](_0x3fc569)){return _0x25aca8['removeAgents'](_0x3fc569,{'transaction':_0x3b3e3d});}})[_0x0034('0x21')](function(){_0x3fc569[_0x0034('0x8e')](function(_0x150b57){socket['emit'](_0x0034('0x8f'),{'UserId':_0x150b57,'ChatQueueId':_0x25aca8['id']});});});});});});})[_0x0034('0x21')](respondWithStatusCode(_0x49e23e,null))[_0x0034('0x29')](handleError(_0x49e23e,null));};exports[_0x0034('0x90')]=function(_0x54283f,_0x2b152f,_0x2bdeee){return db[_0x0034('0x3c')][_0x0034('0x5d')]({'where':{'id':_0x54283f['params']['id']}})[_0x0034('0x21')](handleEntityNotFound(_0x2b152f,null))[_0x0034('0x21')](function(_0x1d39e1){if(_0x1d39e1){return _0x1d39e1[_0x0034('0x90')](_0x54283f[_0x0034('0x59')][_0x0034('0x71')],_['omit'](_0x54283f[_0x0034('0x59')],[_0x0034('0x71'),'id'])||{})[_0x0034('0x91')](function(_0x4ff165){for(var _0x359f1a=0x0;_0x359f1a<_0x54283f[_0x0034('0x59')]['ids'][_0x0034('0x47')];_0x359f1a+=0x1){socket[_0x0034('0x7a')](_0x0034('0x7b'),{'UserId':Number(_0x54283f[_0x0034('0x59')][_0x0034('0x71')][_0x359f1a]),'ChatQueueId':Number(_0x54283f['params']['id'])});}return _0x4ff165;});}})[_0x0034('0x21')](respondWithResult(_0x2b152f,null))['catch'](handleError(_0x2b152f,null));};exports[_0x0034('0x92')]=function(_0x59f046,_0x329637,_0x343ee1){return db[_0x0034('0x3c')][_0x0034('0x5d')]({'where':{'id':_0x59f046['params']['id']}})[_0x0034('0x21')](handleEntityNotFound(_0x329637,null))[_0x0034('0x21')](function(_0x2ea814){if(_0x2ea814){return _0x2ea814[_0x0034('0x92')](_0x59f046['query'][_0x0034('0x71')])['then'](function(){if(_[_0x0034('0x93')](_0x59f046[_0x0034('0x41')][_0x0034('0x71')])){for(var _0x5dd94d=0x0;_0x5dd94d<_0x59f046[_0x0034('0x41')][_0x0034('0x71')]['length'];_0x5dd94d+=0x1){socket[_0x0034('0x7a')](_0x0034('0x8f'),{'UserId':Number(_0x59f046[_0x0034('0x41')][_0x0034('0x71')][_0x5dd94d]),'ChatQueueId':Number(_0x59f046[_0x0034('0x56')]['id'])});}}else{socket[_0x0034('0x7a')](_0x0034('0x8f'),{'UserId':Number(_0x59f046[_0x0034('0x41')][_0x0034('0x71')]),'ChatQueueId':Number(_0x59f046[_0x0034('0x56')]['id'])});}});}})[_0x0034('0x21')](respondWithStatusCode(_0x329637,null))[_0x0034('0x29')](handleError(_0x329637,null));};exports[_0x0034('0x94')]=function(_0xedc6cf,_0x29a495,_0x4142f0){var _0x44dabc={};var _0x3cd067={};var _0x5e3ea7;var _0xc7bf0a;return db[_0x0034('0x3c')][_0x0034('0x62')]({'where':{'id':_0xedc6cf[_0x0034('0x56')]['id']}})[_0x0034('0x21')](handleEntityNotFound(_0x29a495,null))[_0x0034('0x21')](function(_0x4bafe0){if(_0x4bafe0){_0x5e3ea7=_0x4bafe0;_0x3cd067[_0x0034('0x40')]=_['keys'](db[_0x0034('0x66')][_0x0034('0x3d')]);_0x3cd067[_0x0034('0x41')]=_['keys'](_0xedc6cf[_0x0034('0x41')]);_0x3cd067['filters']=_['intersection'](_0x3cd067[_0x0034('0x40')],_0x3cd067[_0x0034('0x41')]);_0x44dabc[_0x0034('0x45')]=_[_0x0034('0x44')](_0x3cd067['model'],qs[_0x0034('0x46')](_0xedc6cf[_0x0034('0x41')][_0x0034('0x46')]));_0x44dabc[_0x0034('0x45')]=_0x44dabc[_0x0034('0x45')][_0x0034('0x47')]?_0x44dabc[_0x0034('0x45')]:_0x3cd067[_0x0034('0x40')];_0x44dabc[_0x0034('0x4a')]=qs[_0x0034('0x4b')](_0xedc6cf[_0x0034('0x41')][_0x0034('0x4b')]);_0x44dabc[_0x0034('0x4c')]=qs[_0x0034('0x43')](_[_0x0034('0x64')](_0xedc6cf[_0x0034('0x41')],_0x3cd067['filters']));if(_0xedc6cf['query']['filter']){_0x44dabc[_0x0034('0x4c')]=_['merge'](_0x44dabc['where'],{'$or':_[_0x0034('0x3b')](_0x44dabc[_0x0034('0x45')],function(_0x1379a5){var _0x16f242={};_0x16f242[_0x1379a5]={'$like':'%'+_0xedc6cf[_0x0034('0x41')][_0x0034('0x4d')]+'%'};return _0x16f242;})});}_0x44dabc=_[_0x0034('0x4e')]({},_0x44dabc,_0xedc6cf[_0x0034('0x51')]);return _0x5e3ea7[_0x0034('0x94')](_0x44dabc);}})[_0x0034('0x21')](function(_0xcee7f){if(_0xcee7f){_0xc7bf0a=_0xcee7f[_0x0034('0x47')];if(!_0xedc6cf[_0x0034('0x41')][_0x0034('0x48')](_0x0034('0x49'))){_0x44dabc[_0x0034('0x2f')]=qs['limit'](_0xedc6cf[_0x0034('0x41')]['limit']);_0x44dabc[_0x0034('0x2d')]=qs[_0x0034('0x2d')](_0xedc6cf[_0x0034('0x41')]['offset']);}return _0x5e3ea7['getAgents'](_0x44dabc);}})[_0x0034('0x21')](function(_0x4bd55e){if(_0x4bd55e){return _0x4bd55e?{'count':_0xc7bf0a,'rows':_0x4bd55e}:null;}})[_0x0034('0x21')](respondWithResult(_0x29a495,null))[_0x0034('0x29')](handleError(_0x29a495,null));}; \ No newline at end of file +var _0xc065=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','update','describe','getMembers','findOne','length','pick','ChatQueueId','findAll','User','findAndCountAll','UserId','chatPause','updatedAt','createdAt','format','SIP','getTeams','hasOwnProperty','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','removeTeams','Team','select','field','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','value','isEmpty','forEach','userChatQueue:remove','addAgents','omit','spread','emit','userChatQueue:save','removeAgents','isArray','getAgents','zip-dir','moment','bluebird','mustache','util','path','to-csv','squel','jsforce','desk.js','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','socket.io-emitter','register','jayson/promise','client','http','request','ChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','save','then','destroy','get','UserProfileResource','stack','name','index','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','params'];(function(_0x40b6db,_0xd0d7f3){var _0x5705c7=function(_0x671159){while(--_0x671159){_0x40b6db['push'](_0x40b6db['shift']());}};_0x5705c7(++_0xd0d7f3);}(_0xc065,0x162));var _0x5c06=function(_0x3229da,_0x4a8b90){_0x3229da=_0x3229da-0x0;var _0x394e61=_0xc065[_0x3229da];return _0x394e61;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5c06('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5c06('0x1'));var BPromise=require(_0x5c06('0x2'));var Mustache=require(_0x5c06('0x3'));var util=require(_0x5c06('0x4'));var path=require(_0x5c06('0x5'));var sox=require('sox');var csv=require(_0x5c06('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5c06('0x7'));var crypto=require('crypto');var jsforce=require(_0x5c06('0x8'));var deskjs=require(_0x5c06('0x9'));var toCsv=require(_0x5c06('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5c06('0xa'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c06('0xb'));var logger=require(_0x5c06('0xc'))(_0x5c06('0xd'));var utils=require(_0x5c06('0xe'));var config=require(_0x5c06('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c06('0x10'))['db'];config['redis']=_[_0x5c06('0x11')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5c06('0x12'))(new Redis(config['redis']));require('./chatQueue.socket')[_0x5c06('0x13')](socket);var jayson=require(_0x5c06('0x14'));var client=jayson[_0x5c06('0x15')][_0x5c06('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x25e179,_0x58bf4e,_0x43e54e,_0x1a0b0b){return new BPromise(function(_0x522a86,_0x2923c6){var _0x3420ff=_0x1a0b0b||client;return _0x3420ff[_0x5c06('0x17')](_0x25e179,_0x43e54e)['then'](function(_0x511044){logger['info'](_0x5c06('0x18'),_0x58bf4e,_0x5c06('0x19'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x58bf4e,_0x5c06('0x19'),JSON[_0x5c06('0x1a')](_0x511044));if(_0x511044['error']){if(_0x511044[_0x5c06('0x1b')]['code']===0x1f4){logger[_0x5c06('0x1b')](_0x5c06('0x18'),_0x58bf4e,_0x511044[_0x5c06('0x1b')]['message']);return _0x2923c6(_0x511044['error']['message']);}logger[_0x5c06('0x1b')]('ChatQueue,\x20%s,\x20%s',_0x58bf4e,_0x511044[_0x5c06('0x1b')][_0x5c06('0x1c')]);return _0x522a86(_0x511044[_0x5c06('0x1b')][_0x5c06('0x1c')]);}else{logger[_0x5c06('0x1d')](_0x5c06('0x18'),_0x58bf4e,_0x5c06('0x19'));_0x522a86(_0x511044['result'][_0x5c06('0x1c')]);}})[_0x5c06('0x1e')](function(_0x36ab9f){logger[_0x5c06('0x1b')](_0x5c06('0x18'),_0x58bf4e,_0x36ab9f);_0x2923c6(_0x36ab9f);});});}function respondWithStatusCode(_0x1215d9,_0x229b24){_0x229b24=_0x229b24||0xcc;return function(_0xf0c90f){if(_0xf0c90f){return _0x1215d9[_0x5c06('0x1f')](_0x229b24);}return _0x1215d9[_0x5c06('0x20')](_0x229b24)[_0x5c06('0x21')]();};}function respondWithResult(_0x3e9381,_0x7fce65){_0x7fce65=_0x7fce65||0xc8;return function(_0x44adeb){if(_0x44adeb){return _0x3e9381['status'](_0x7fce65)['json'](_0x44adeb);}};}function respondWithFilteredResult(_0x53aafb,_0x22f66a){return function(_0x59e0fc){if(_0x59e0fc){var _0x1f4792=typeof _0x22f66a[_0x5c06('0x22')]==='undefined'&&typeof _0x22f66a['limit']===_0x5c06('0x23');var _0x3d065d=_0x59e0fc[_0x5c06('0x24')];var _0x1bffcb=_0x1f4792?0x0:_0x22f66a['offset'];var _0x554de2=_0x1f4792?_0x59e0fc[_0x5c06('0x24')]:_0x22f66a[_0x5c06('0x22')]+_0x22f66a[_0x5c06('0x25')];var _0x3cd001;if(_0x554de2>=_0x3d065d){_0x554de2=_0x3d065d;_0x3cd001=0xc8;}else{_0x3cd001=0xce;}_0x53aafb[_0x5c06('0x20')](_0x3cd001);return _0x53aafb[_0x5c06('0x26')]('Content-Range',_0x1bffcb+'-'+_0x554de2+'/'+_0x3d065d)[_0x5c06('0x27')](_0x59e0fc);}return null;};}function patchUpdates(_0x53730c){return function(_0x4c35e9){try{jsonpatch[_0x5c06('0x28')](_0x4c35e9,_0x53730c,!![]);}catch(_0x404928){return BPromise['reject'](_0x404928);}return _0x4c35e9[_0x5c06('0x29')]();};}function saveUpdates(_0x400ab8,_0x2f90ae){return function(_0x2e0a24){if(_0x2e0a24){return _0x2e0a24['update'](_0x400ab8)[_0x5c06('0x2a')](function(_0x3d9eb1){return _0x3d9eb1;});}return null;};}function removeEntity(_0x465ee6,_0xdc6de4){return function(_0x543bd5){if(_0x543bd5){return _0x543bd5[_0x5c06('0x2b')]()[_0x5c06('0x2a')](function(){var _0x972117=_0x543bd5[_0x5c06('0x2c')]({'plain':!![]});var _0x1ccdca='ChatQueues';return db[_0x5c06('0x2d')][_0x5c06('0x2b')]({'where':{'type':_0x1ccdca,'resourceId':_0x972117['id']}})[_0x5c06('0x2a')](function(){return _0x543bd5;});})['then'](function(){_0x465ee6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b466,_0x3ca6da){return function(_0xe56713){if(!_0xe56713){_0x12b466[_0x5c06('0x1f')](0x194);}return _0xe56713;};}function handleError(_0x25a38b,_0x23a798){_0x23a798=_0x23a798||0x1f4;return function(_0x56208e){logger['error'](_0x56208e[_0x5c06('0x2e')]);if(_0x56208e[_0x5c06('0x2f')]){delete _0x56208e['name'];}_0x25a38b[_0x5c06('0x20')](_0x23a798)['send'](_0x56208e);};}exports[_0x5c06('0x30')]=function(_0x26be53,_0x2f2394){var _0x265f07={},_0x49179f={},_0xcdafd={'count':0x0,'rows':[]};var _0x4dc6e3=_['map'](db[_0x5c06('0x31')][_0x5c06('0x32')],function(_0xcb2990){return{'name':_0xcb2990[_0x5c06('0x33')],'type':_0xcb2990[_0x5c06('0x34')][_0x5c06('0x35')]};});_0x49179f[_0x5c06('0x36')]=_['map'](_0x4dc6e3,_0x5c06('0x2f'));_0x49179f[_0x5c06('0x37')]=_[_0x5c06('0x38')](_0x26be53['query']);_0x49179f[_0x5c06('0x39')]=_[_0x5c06('0x3a')](_0x49179f['model'],_0x49179f[_0x5c06('0x37')]);_0x265f07[_0x5c06('0x3b')]=_[_0x5c06('0x3a')](_0x49179f[_0x5c06('0x36')],qs[_0x5c06('0x3c')](_0x26be53['query'][_0x5c06('0x3c')]));_0x265f07[_0x5c06('0x3b')]=_0x265f07[_0x5c06('0x3b')]['length']?_0x265f07['attributes']:_0x49179f[_0x5c06('0x36')];if(!_0x26be53[_0x5c06('0x37')]['hasOwnProperty'](_0x5c06('0x3d'))){_0x265f07['limit']=qs['limit'](_0x26be53['query'][_0x5c06('0x25')]);_0x265f07[_0x5c06('0x22')]=qs[_0x5c06('0x22')](_0x26be53[_0x5c06('0x37')][_0x5c06('0x22')]);}_0x265f07[_0x5c06('0x3e')]=qs[_0x5c06('0x3f')](_0x26be53[_0x5c06('0x37')][_0x5c06('0x3f')]);_0x265f07[_0x5c06('0x40')]=qs[_0x5c06('0x39')](_['pick'](_0x26be53[_0x5c06('0x37')],_0x49179f[_0x5c06('0x39')]),_0x4dc6e3);if(_0x26be53['query'][_0x5c06('0x41')]){_0x265f07[_0x5c06('0x40')]=_[_0x5c06('0x42')](_0x265f07['where'],{'$or':_[_0x5c06('0x43')](_0x4dc6e3,function(_0x5a56bf){if(_0x5a56bf['type']!==_0x5c06('0x44')){var _0x4a9567={};_0x4a9567[_0x5a56bf[_0x5c06('0x2f')]]={'$like':'%'+_0x26be53['query'][_0x5c06('0x41')]+'%'};return _0x4a9567;}})});}_0x265f07=_[_0x5c06('0x42')]({},_0x265f07,_0x26be53[_0x5c06('0x45')]);var _0x5ba31e={'where':_0x265f07['where']};return db[_0x5c06('0x31')][_0x5c06('0x24')](_0x5ba31e)['then'](function(_0x4425c2){_0xcdafd[_0x5c06('0x24')]=_0x4425c2;if(_0x26be53[_0x5c06('0x37')][_0x5c06('0x46')]){_0x265f07[_0x5c06('0x47')]=[{'all':!![]}];}return db['ChatQueue']['findAll'](_0x265f07);})[_0x5c06('0x2a')](function(_0x205421){_0xcdafd[_0x5c06('0x48')]=_0x205421;return _0xcdafd;})[_0x5c06('0x2a')](respondWithFilteredResult(_0x2f2394,_0x265f07))[_0x5c06('0x1e')](handleError(_0x2f2394,null));};exports[_0x5c06('0x49')]=function(_0x13a5ae,_0x1c1152){var _0x963fa7={'raw':!![],'where':{'id':_0x13a5ae[_0x5c06('0x4a')]['id']}},_0x444b34={};_0x444b34[_0x5c06('0x36')]=_[_0x5c06('0x38')](db['ChatQueue']['rawAttributes']);_0x444b34[_0x5c06('0x37')]=_[_0x5c06('0x38')](_0x13a5ae['query']);_0x444b34[_0x5c06('0x39')]=_['intersection'](_0x444b34['model'],_0x444b34[_0x5c06('0x37')]);_0x963fa7[_0x5c06('0x3b')]=_['intersection'](_0x444b34[_0x5c06('0x36')],qs['fields'](_0x13a5ae[_0x5c06('0x37')]['fields']));_0x963fa7[_0x5c06('0x3b')]=_0x963fa7[_0x5c06('0x3b')]['length']?_0x963fa7[_0x5c06('0x3b')]:_0x444b34[_0x5c06('0x36')];if(_0x13a5ae[_0x5c06('0x37')][_0x5c06('0x46')]){_0x963fa7['include']=[{'all':!![]}];}_0x963fa7=_[_0x5c06('0x42')]({},_0x963fa7,_0x13a5ae['options']);return db[_0x5c06('0x31')][_0x5c06('0x4b')](_0x963fa7)['then'](handleEntityNotFound(_0x1c1152,null))[_0x5c06('0x2a')](respondWithResult(_0x1c1152,null))[_0x5c06('0x1e')](handleError(_0x1c1152,null));};exports[_0x5c06('0x4c')]=function(_0x4965e6,_0x1e22fa){return db[_0x5c06('0x31')][_0x5c06('0x4c')](_0x4965e6[_0x5c06('0x4d')],{})[_0x5c06('0x2a')](function(_0x156a1a){var _0x2a563f=_0x4965e6[_0x5c06('0x4e')][_0x5c06('0x2c')]({'plain':!![]});if(!_0x2a563f)throw new Error(_0x5c06('0x4f'));if(_0x2a563f[_0x5c06('0x50')]===_0x5c06('0x4e')){var _0x49084a=_0x156a1a['get']({'plain':!![]});var _0xc8d245=_0x5c06('0x51');return db[_0x5c06('0x52')][_0x5c06('0x4b')]({'where':{'name':_0xc8d245,'userProfileId':_0x2a563f[_0x5c06('0x53')]},'raw':!![]})['then'](function(_0x2227b2){if(_0x2227b2&&_0x2227b2['autoAssociation']===0x0){return db[_0x5c06('0x2d')][_0x5c06('0x4c')]({'name':_0x49084a[_0x5c06('0x2f')],'resourceId':_0x49084a['id'],'type':_0x2227b2[_0x5c06('0x2f')],'sectionId':_0x2227b2['id']},{})[_0x5c06('0x2a')](function(){return _0x156a1a;});}else{return _0x156a1a;}})[_0x5c06('0x1e')](function(_0x4abecd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4abecd);throw _0x4abecd;});}return _0x156a1a;})[_0x5c06('0x2a')](respondWithResult(_0x1e22fa,0xc9))[_0x5c06('0x1e')](handleError(_0x1e22fa,null));};exports[_0x5c06('0x54')]=function(_0x48e091,_0x4fcb26){if(_0x48e091[_0x5c06('0x4d')]['id']){delete _0x48e091[_0x5c06('0x4d')]['id'];}return db[_0x5c06('0x31')][_0x5c06('0x4b')]({'where':{'id':_0x48e091[_0x5c06('0x4a')]['id']}})[_0x5c06('0x2a')](handleEntityNotFound(_0x4fcb26,null))[_0x5c06('0x2a')](saveUpdates(_0x48e091[_0x5c06('0x4d')],null))[_0x5c06('0x2a')](respondWithResult(_0x4fcb26,null))['catch'](handleError(_0x4fcb26,null));};exports[_0x5c06('0x2b')]=function(_0x3ea524,_0x11358b){return db[_0x5c06('0x31')]['find']({'where':{'id':_0x3ea524[_0x5c06('0x4a')]['id']}})[_0x5c06('0x2a')](handleEntityNotFound(_0x11358b,null))[_0x5c06('0x2a')](removeEntity(_0x11358b,null))['catch'](handleError(_0x11358b,null));};exports['describe']=function(_0x3f99fb,_0x3ab181){return db['ChatQueue'][_0x5c06('0x55')]()[_0x5c06('0x2a')](respondWithResult(_0x3ab181,null))[_0x5c06('0x1e')](handleError(_0x3ab181,null));};exports[_0x5c06('0x56')]=function(_0x39f207,_0x3d262d,_0x37adcd){var _0x138abe={'raw':!![],'where':{}},_0x185960={},_0x45b1a0;return db[_0x5c06('0x31')][_0x5c06('0x57')]({'where':{'id':_0x39f207[_0x5c06('0x4a')]['id']}})[_0x5c06('0x2a')](handleEntityNotFound(_0x3d262d,null))[_0x5c06('0x2a')](function(_0x4affa7){if(_0x4affa7){_0x45b1a0=_0x4affa7['get']({'plain':!![]});_0x185960['model']=_[_0x5c06('0x38')](db['UserChatQueue']['rawAttributes']);_0x185960['query']=_[_0x5c06('0x38')](_0x39f207['query']);_0x185960[_0x5c06('0x39')]=_[_0x5c06('0x3a')](_0x185960[_0x5c06('0x36')],_0x185960[_0x5c06('0x37')]);_0x138abe['attributes']=_[_0x5c06('0x3a')](_0x185960[_0x5c06('0x36')],qs[_0x5c06('0x3c')](_0x39f207[_0x5c06('0x37')][_0x5c06('0x3c')]));_0x138abe[_0x5c06('0x3b')]=_0x138abe[_0x5c06('0x3b')][_0x5c06('0x58')]?_0x138abe[_0x5c06('0x3b')]:_0x185960[_0x5c06('0x36')];if(!_0x39f207[_0x5c06('0x37')]['hasOwnProperty'](_0x5c06('0x3d'))){_0x138abe[_0x5c06('0x25')]=qs[_0x5c06('0x25')](_0x39f207[_0x5c06('0x37')]['limit']);_0x138abe[_0x5c06('0x22')]=qs['offset'](_0x39f207['query']['offset']);}_0x138abe[_0x5c06('0x3e')]=qs['sort'](_0x39f207[_0x5c06('0x37')][_0x5c06('0x3f')]);_0x138abe[_0x5c06('0x40')]=qs[_0x5c06('0x39')](_[_0x5c06('0x59')](_0x39f207[_0x5c06('0x37')],_0x185960[_0x5c06('0x39')]));_0x138abe[_0x5c06('0x40')][_0x5c06('0x5a')]=_0x4affa7['id'];if(_0x39f207[_0x5c06('0x37')]['filter']){_0x138abe[_0x5c06('0x40')]=_[_0x5c06('0x42')](_0x138abe[_0x5c06('0x40')],{'$or':_[_0x5c06('0x43')](_0x138abe['attributes'],function(_0x30ea6e){var _0xeab711={};_0xeab711[_0x30ea6e]={'$like':'%'+_0x39f207['query'][_0x5c06('0x41')]+'%'};return _0xeab711;})});}_0x138abe=_[_0x5c06('0x42')]({},_0x138abe,_0x39f207[_0x5c06('0x45')]);return db['UserChatQueue'][_0x5c06('0x5b')](_0x138abe);}})[_0x5c06('0x2a')](function(_0x31cefa){if(_0x31cefa){return db[_0x5c06('0x5c')][_0x5c06('0x5d')]({'where':{'id':_[_0x5c06('0x43')](_0x31cefa,_0x5c06('0x5e')),'role':'agent'},'attributes':['id',_0x5c06('0x2f'),_0x5c06('0x5f'),_0x5c06('0x60'),_0x5c06('0x61')]});}})[_0x5c06('0x2a')](function(_0x24b5f2){if(_0x24b5f2){return{'count':_0x24b5f2[_0x5c06('0x24')],'rows':_['map'](_0x24b5f2[_0x5c06('0x48')],function(_0x446ee3){return{'membername':_0x446ee3[_0x5c06('0x2f')],'UserId':_0x446ee3['id'],'queue_name':_0x45b1a0[_0x5c06('0x2f')],'ChatQueueId':_0x45b1a0['id'],'interface':util[_0x5c06('0x62')]('%s/%s',_0x5c06('0x63'),_0x446ee3['name']),'penalty':0x0,'paused':_0x446ee3[_0x5c06('0x5f')],'createdAt':_0x446ee3[_0x5c06('0x61')],'updatedAt':_0x446ee3['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3d262d,_0x138abe))[_0x5c06('0x1e')](handleError(_0x3d262d,null));};exports[_0x5c06('0x64')]=function(_0x4333a6,_0x21abdb,_0x361140){var _0x2bf8e0={};var _0xf4a714={};var _0x4f6233;var _0x53d46c;return db[_0x5c06('0x31')][_0x5c06('0x57')]({'where':{'id':_0x4333a6[_0x5c06('0x4a')]['id']}})[_0x5c06('0x2a')](handleEntityNotFound(_0x21abdb,null))['then'](function(_0xa8ca87){if(_0xa8ca87){_0x4f6233=_0xa8ca87;_0xf4a714[_0x5c06('0x36')]=_[_0x5c06('0x38')](db['Team'][_0x5c06('0x32')]);_0xf4a714[_0x5c06('0x37')]=_[_0x5c06('0x38')](_0x4333a6[_0x5c06('0x37')]);_0xf4a714['filters']=_[_0x5c06('0x3a')](_0xf4a714['model'],_0xf4a714[_0x5c06('0x37')]);_0x2bf8e0['attributes']=_['intersection'](_0xf4a714[_0x5c06('0x36')],qs[_0x5c06('0x3c')](_0x4333a6[_0x5c06('0x37')]['fields']));_0x2bf8e0[_0x5c06('0x3b')]=_0x2bf8e0[_0x5c06('0x3b')][_0x5c06('0x58')]?_0x2bf8e0[_0x5c06('0x3b')]:_0xf4a714[_0x5c06('0x36')];_0x2bf8e0[_0x5c06('0x3e')]=qs[_0x5c06('0x3f')](_0x4333a6[_0x5c06('0x37')][_0x5c06('0x3f')]);_0x2bf8e0[_0x5c06('0x40')]=qs[_0x5c06('0x39')](_[_0x5c06('0x59')](_0x4333a6[_0x5c06('0x37')],_0xf4a714['filters']));if(_0x4333a6[_0x5c06('0x37')][_0x5c06('0x41')]){_0x2bf8e0[_0x5c06('0x40')]=_['merge'](_0x2bf8e0[_0x5c06('0x40')],{'$or':_[_0x5c06('0x43')](_0x2bf8e0['attributes'],function(_0x3ede9a){var _0x4ff9a3={};_0x4ff9a3[_0x3ede9a]={'$like':'%'+_0x4333a6[_0x5c06('0x37')][_0x5c06('0x41')]+'%'};return _0x4ff9a3;})});}_0x2bf8e0=_[_0x5c06('0x42')]({},_0x2bf8e0,_0x4333a6[_0x5c06('0x45')]);return _0x4f6233['getTeams'](_0x2bf8e0);}})[_0x5c06('0x2a')](function(_0x52d555){if(_0x52d555){_0x53d46c=_0x52d555[_0x5c06('0x58')];if(!_0x4333a6[_0x5c06('0x37')][_0x5c06('0x65')](_0x5c06('0x3d'))){_0x2bf8e0[_0x5c06('0x25')]=qs[_0x5c06('0x25')](_0x4333a6[_0x5c06('0x37')][_0x5c06('0x25')]);_0x2bf8e0[_0x5c06('0x22')]=qs[_0x5c06('0x22')](_0x4333a6['query'][_0x5c06('0x22')]);}return _0x4f6233['getTeams'](_0x2bf8e0);}})[_0x5c06('0x2a')](function(_0x17a58e){if(_0x17a58e){return _0x17a58e?{'count':_0x53d46c,'rows':_0x17a58e}:null;}})['then'](respondWithResult(_0x21abdb,null))[_0x5c06('0x1e')](handleError(_0x21abdb,null));};exports[_0x5c06('0x66')]=function(_0x306105,_0x552123,_0x4633e5){var _0x14d300=_0x306105[_0x5c06('0x4d')][_0x5c06('0x67')];return db['Team'][_0x5c06('0x5b')]({'where':{'id':_0x14d300},'attributes':['id'],'include':[{'model':db[_0x5c06('0x5c')],'as':'Agents','attributes':['id',_0x5c06('0x2f'),_0x5c06('0x68'),_0x5c06('0x69'),_0x5c06('0x6a')],'raw':!![]}]})['then'](function(_0x268692){if(_0x268692){var _0x32a368=_[_0x5c06('0x6b')](_0x268692,function(_0x389fab){var _0x3dcd7f=_0x389fab['get']({'plain':!![]});return _0x3dcd7f[_0x5c06('0x6c')];});return db[_0x5c06('0x31')][_0x5c06('0x4b')]({'where':{'id':_0x306105[_0x5c06('0x4a')]['id']}})['then'](function(_0x3eed73){return db[_0x5c06('0x6d')][_0x5c06('0x6e')](function(_0x42c67c){return _0x3eed73[_0x5c06('0x66')](_0x14d300,{'transaction':_0x42c67c})['then'](function(){return BPromise[_0x5c06('0x6f')](_0x32a368,function(_0x514d0d){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x514d0d['id'],'ChatQueueId':_0x306105[_0x5c06('0x4a')]['id']},'transaction':_0x42c67c});});})[_0x5c06('0x2a')](function(){_0x32a368['forEach'](function(_0x5c6af5){socket['emit']('userChatQueue:save',{'UserId':_0x5c6af5['id'],'ChatQueueId':_0x3eed73['id']});});});});});}})['then'](respondWithStatusCode(_0x552123,null))[_0x5c06('0x1e')](handleError(_0x552123,null));};exports[_0x5c06('0x70')]=function(_0x583c58,_0x33834e,_0x2fdde7){return db[_0x5c06('0x71')][_0x5c06('0x5b')]({'where':{'id':_0x583c58[_0x5c06('0x37')][_0x5c06('0x67')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x33834e,null))[_0x5c06('0x2a')](function(_0x598b16){var _0x2ec48c=_[_0x5c06('0x43')](_0x598b16,'id');var _0x37e87e=[];var _0x495a57=[];var _0x1e7dd5=squel[_0x5c06('0x72')]();_0x1e7dd5[_0x5c06('0x73')](_0x5c06('0x74'))[_0x5c06('0x75')](_0x5c06('0x76'),'tq')[_0x5c06('0x77')]('user_has_teams','ut',_0x5c06('0x78'))['where'](_0x5c06('0x79'),_0x583c58[_0x5c06('0x4a')]['id']);for(var _0x2876ee=0x0;_0x2876ee<_0x598b16['length'];_0x2876ee+=0x1){let _0x34c748=_0x598b16[_0x2876ee];for(var _0x597029=0x0;_0x597029<_0x34c748['Agents'][_0x5c06('0x58')];_0x597029+=0x1){let _0x4dc088=_0x34c748['Agents'][_0x597029];var _0x3d5769=_0x1e7dd5[_0x5c06('0x7a')]();_0x3d5769['where'](_0x5c06('0x7b'),_0x4dc088['id']);_0x495a57[_0x5c06('0x7c')](db[_0x5c06('0x6d')][_0x5c06('0x37')](_0x3d5769[_0x5c06('0x7d')](),{'type':db[_0x5c06('0x6d')][_0x5c06('0x7e')][_0x5c06('0x7f')]})['then'](function(_0x2766c6){if(_0x2766c6['length']===0x1){return _0x4dc088['id'];}else{var _0x294a3c=_[_0x5c06('0x80')](_[_0x5c06('0x43')](_0x2766c6,_0x5c06('0x81')),function(_0x4f927d){return _[_0x5c06('0x82')](_0x2ec48c,_0x4f927d);});if(_0x294a3c){return _0x4dc088['id'];}}}));}}return BPromise['all'](_0x495a57)[_0x5c06('0x2a')](function(_0x121c54){_0x37e87e=_(_0x37e87e)['union'](_0x121c54)['compact']()[_0x5c06('0x83')]();return db[_0x5c06('0x31')]['find']({'where':{'id':_0x583c58['params']['id']}})['then'](function(_0x437f5b){return db[_0x5c06('0x6d')]['transaction'](function(_0x202738){return _0x437f5b[_0x5c06('0x70')](_0x583c58[_0x5c06('0x37')][_0x5c06('0x67')],{'transaction':_0x202738})['then'](function(){if(!_[_0x5c06('0x84')](_0x37e87e)){return _0x437f5b['removeAgents'](_0x37e87e,{'transaction':_0x202738});}})[_0x5c06('0x2a')](function(){_0x37e87e[_0x5c06('0x85')](function(_0x231056){socket['emit'](_0x5c06('0x86'),{'UserId':_0x231056,'ChatQueueId':_0x437f5b['id']});});});});});});})[_0x5c06('0x2a')](respondWithStatusCode(_0x33834e,null))['catch'](handleError(_0x33834e,null));};exports[_0x5c06('0x87')]=function(_0x2dcb23,_0x1bb495,_0x5e115c){return db[_0x5c06('0x31')][_0x5c06('0x4b')]({'where':{'id':_0x2dcb23[_0x5c06('0x4a')]['id']}})[_0x5c06('0x2a')](handleEntityNotFound(_0x1bb495,null))[_0x5c06('0x2a')](function(_0x327ce8){if(_0x327ce8){return _0x327ce8['addAgents'](_0x2dcb23['body'][_0x5c06('0x67')],_[_0x5c06('0x88')](_0x2dcb23['body'],[_0x5c06('0x67'),'id'])||{})[_0x5c06('0x89')](function(_0x244526){for(var _0x27c38e=0x0;_0x27c38e<_0x2dcb23[_0x5c06('0x4d')][_0x5c06('0x67')]['length'];_0x27c38e+=0x1){socket[_0x5c06('0x8a')](_0x5c06('0x8b'),{'UserId':Number(_0x2dcb23[_0x5c06('0x4d')][_0x5c06('0x67')][_0x27c38e]),'ChatQueueId':Number(_0x2dcb23['params']['id'])});}return _0x244526;});}})['then'](respondWithResult(_0x1bb495,null))[_0x5c06('0x1e')](handleError(_0x1bb495,null));};exports[_0x5c06('0x8c')]=function(_0x4366d9,_0x49b224,_0x2ab16d){return db[_0x5c06('0x31')]['find']({'where':{'id':_0x4366d9['params']['id']}})[_0x5c06('0x2a')](handleEntityNotFound(_0x49b224,null))[_0x5c06('0x2a')](function(_0x13c533){if(_0x13c533){return _0x13c533[_0x5c06('0x8c')](_0x4366d9[_0x5c06('0x37')][_0x5c06('0x67')])[_0x5c06('0x2a')](function(){if(_[_0x5c06('0x8d')](_0x4366d9[_0x5c06('0x37')]['ids'])){for(var _0x23c6e4=0x0;_0x23c6e4<_0x4366d9[_0x5c06('0x37')][_0x5c06('0x67')][_0x5c06('0x58')];_0x23c6e4+=0x1){socket[_0x5c06('0x8a')](_0x5c06('0x86'),{'UserId':Number(_0x4366d9[_0x5c06('0x37')]['ids'][_0x23c6e4]),'ChatQueueId':Number(_0x4366d9[_0x5c06('0x4a')]['id'])});}}else{socket[_0x5c06('0x8a')](_0x5c06('0x86'),{'UserId':Number(_0x4366d9['query'][_0x5c06('0x67')]),'ChatQueueId':Number(_0x4366d9['params']['id'])});}});}})[_0x5c06('0x2a')](respondWithStatusCode(_0x49b224,null))[_0x5c06('0x1e')](handleError(_0x49b224,null));};exports[_0x5c06('0x8e')]=function(_0x1fdae8,_0x8651f6,_0x280cde){var _0x5090b8={};var _0x26d1da={};var _0x11da5c;var _0x4cf604;return db[_0x5c06('0x31')][_0x5c06('0x57')]({'where':{'id':_0x1fdae8['params']['id']}})[_0x5c06('0x2a')](handleEntityNotFound(_0x8651f6,null))['then'](function(_0x34ab32){if(_0x34ab32){_0x11da5c=_0x34ab32;_0x26d1da[_0x5c06('0x36')]=_[_0x5c06('0x38')](db['User'][_0x5c06('0x32')]);_0x26d1da[_0x5c06('0x37')]=_[_0x5c06('0x38')](_0x1fdae8[_0x5c06('0x37')]);_0x26d1da[_0x5c06('0x39')]=_[_0x5c06('0x3a')](_0x26d1da[_0x5c06('0x36')],_0x26d1da['query']);_0x5090b8['attributes']=_[_0x5c06('0x3a')](_0x26d1da[_0x5c06('0x36')],qs[_0x5c06('0x3c')](_0x1fdae8[_0x5c06('0x37')][_0x5c06('0x3c')]));_0x5090b8[_0x5c06('0x3b')]=_0x5090b8[_0x5c06('0x3b')][_0x5c06('0x58')]?_0x5090b8[_0x5c06('0x3b')]:_0x26d1da['model'];_0x5090b8[_0x5c06('0x3e')]=qs[_0x5c06('0x3f')](_0x1fdae8[_0x5c06('0x37')][_0x5c06('0x3f')]);_0x5090b8[_0x5c06('0x40')]=qs[_0x5c06('0x39')](_[_0x5c06('0x59')](_0x1fdae8[_0x5c06('0x37')],_0x26d1da[_0x5c06('0x39')]));if(_0x1fdae8[_0x5c06('0x37')][_0x5c06('0x41')]){_0x5090b8['where']=_[_0x5c06('0x42')](_0x5090b8[_0x5c06('0x40')],{'$or':_['map'](_0x5090b8[_0x5c06('0x3b')],function(_0x46d521){var _0x1136c2={};_0x1136c2[_0x46d521]={'$like':'%'+_0x1fdae8[_0x5c06('0x37')]['filter']+'%'};return _0x1136c2;})});}_0x5090b8=_[_0x5c06('0x42')]({},_0x5090b8,_0x1fdae8[_0x5c06('0x45')]);return _0x11da5c['getAgents'](_0x5090b8);}})[_0x5c06('0x2a')](function(_0x1bf1a4){if(_0x1bf1a4){_0x4cf604=_0x1bf1a4[_0x5c06('0x58')];if(!_0x1fdae8[_0x5c06('0x37')]['hasOwnProperty'](_0x5c06('0x3d'))){_0x5090b8[_0x5c06('0x25')]=qs[_0x5c06('0x25')](_0x1fdae8[_0x5c06('0x37')]['limit']);_0x5090b8['offset']=qs[_0x5c06('0x22')](_0x1fdae8[_0x5c06('0x37')][_0x5c06('0x22')]);}return _0x11da5c[_0x5c06('0x8e')](_0x5090b8);}})[_0x5c06('0x2a')](function(_0x1d872f){if(_0x1d872f){return _0x1d872f?{'count':_0x4cf604,'rows':_0x1d872f}:null;}})[_0x5c06('0x2a')](respondWithResult(_0x8651f6,null))[_0x5c06('0x1e')](handleError(_0x8651f6,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 180c849..aa2b8d2 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 _0x9275=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','update','remove'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x9275,0x154));var _0x5927=function(_0x4aba15,_0x4e90aa){_0x4aba15=_0x4aba15-0x0;var _0x1c8122=_0x9275[_0x4aba15];return _0x1c8122;};'use strict';var EventEmitter=require(_0x5927('0x0'));var ChatQueue=require(_0x5927('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5927('0x2'),'afterDestroy':_0x5927('0x3')};function emitEvent(_0xf1b137){return function(_0x1c1900,_0x155969,_0x35a21c){ChatQueueEvents['emit'](_0xf1b137+':'+_0x1c1900['id'],_0x1c1900);ChatQueueEvents[_0x5927('0x4')](_0xf1b137,_0x1c1900);_0x35a21c(null);};}for(var e in events){if(events[_0x5927('0x5')](e)){var event=events[e];ChatQueue[_0x5927('0x6')](e,emitEvent(event));}}module[_0x5927('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xe444=['exports','events','ChatQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x4a4606,_0x47e0a1){var _0x45ef09=function(_0x497c78){while(--_0x497c78){_0x4a4606['push'](_0x4a4606['shift']());}};_0x45ef09(++_0x47e0a1);}(_0xe444,0x196));var _0x4e44=function(_0x1b4d7f,_0x1c0847){_0x1b4d7f=_0x1b4d7f-0x0;var _0x58e7be=_0xe444[_0x1b4d7f];return _0x58e7be;};'use strict';var EventEmitter=require(_0x4e44('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x4e44('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4e44('0x2')](0x0);var events={'afterCreate':_0x4e44('0x3'),'afterUpdate':'update','afterDestroy':_0x4e44('0x4')};function emitEvent(_0x5d0e3d){return function(_0x4b770a,_0xdcbdec,_0x5569bd){ChatQueueEvents[_0x4e44('0x5')](_0x5d0e3d+':'+_0x4b770a['id'],_0x4b770a);ChatQueueEvents[_0x4e44('0x5')](_0x5d0e3d,_0x4b770a);_0x5569bd(null);};}for(var e in events){if(events[_0x4e44('0x6')](e)){var event=events[e];ChatQueue[_0x4e44('0x7')](e,emitEvent(event));}}module[_0x4e44('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 12d94ea..e4ecf67 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 _0x78c2=['moment','path','rimraf','../../config/environment','./chatQueue.attributes','exports','ChatQueue','chat_queues','util','../../config/logger'];(function(_0x54edd3,_0x561dc7){var _0x550b19=function(_0x5a4382){while(--_0x5a4382){_0x54edd3['push'](_0x54edd3['shift']());}};_0x550b19(++_0x561dc7);}(_0x78c2,0x1b6));var _0x278c=function(_0x26d3db,_0x216e3b){_0x26d3db=_0x26d3db-0x0;var _0x36ee83=_0x78c2[_0x26d3db];return _0x36ee83;};'use strict';var _=require('lodash');var util=require(_0x278c('0x0'));var logger=require(_0x278c('0x1'))('api');var moment=require(_0x278c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x278c('0x3'));var rimraf=require(_0x278c('0x4'));var config=require(_0x278c('0x5'));var attributes=require(_0x278c('0x6'));module[_0x278c('0x7')]=function(_0x10daad,_0x2b9fd9){return _0x10daad['define'](_0x278c('0x8'),attributes,{'tableName':_0x278c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cbd=['./chatQueue.attributes','ChatQueue','chat_queues','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xf4e9a0,_0x34f1db){var _0x520e40=function(_0x203c12){while(--_0x203c12){_0xf4e9a0['push'](_0xf4e9a0['shift']());}};_0x520e40(++_0x34f1db);}(_0x0cbd,0x1a5));var _0xd0cb=function(_0x22636f,_0x5daa9c){_0x22636f=_0x22636f-0x0;var _0x47b162=_0x0cbd[_0x22636f];return _0x47b162;};'use strict';var _=require(_0xd0cb('0x0'));var util=require(_0xd0cb('0x1'));var logger=require('../../config/logger')(_0xd0cb('0x2'));var moment=require(_0xd0cb('0x3'));var BPromise=require('bluebird');var rp=require(_0xd0cb('0x4'));var fs=require('fs');var path=require(_0xd0cb('0x5'));var rimraf=require(_0xd0cb('0x6'));var config=require(_0xd0cb('0x7'));var attributes=require(_0xd0cb('0x8'));module['exports']=function(_0x39b5c3,_0x18bff4){return _0x39b5c3['define'](_0xd0cb('0x9'),attributes,{'tableName':_0xd0cb('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 5ac47aa..2c0b85a 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 _0xca73=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetChatQueue','findAll','options','raw','where','limit','map','include','model','attributes','catch','ChatQueue','find','ShowChatQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2f901a,_0x3089d8){var _0x188ba5=function(_0x312d84){while(--_0x312d84){_0x2f901a['push'](_0x2f901a['shift']());}};_0x188ba5(++_0x3089d8);}(_0xca73,0x1ee));var _0x3ca7=function(_0x582df0,_0x82017b){_0x582df0=_0x582df0-0x0;var _0x410fb7=_0xca73[_0x582df0];return _0x410fb7;};'use strict';var _=require(_0x3ca7('0x0'));var util=require(_0x3ca7('0x1'));var moment=require('moment');var BPromise=require(_0x3ca7('0x2'));var rs=require(_0x3ca7('0x3'));var fs=require('fs');var Redis=require(_0x3ca7('0x4'));var db=require(_0x3ca7('0x5'))['db'];var utils=require(_0x3ca7('0x6'));var logger=require(_0x3ca7('0x7'))(_0x3ca7('0x8'));var config=require(_0x3ca7('0x9'));var jayson=require(_0x3ca7('0xa'));var client=jayson[_0x3ca7('0xb')]['http']({'port':0x232a});config[_0x3ca7('0xc')]=_[_0x3ca7('0xd')](config[_0x3ca7('0xc')],{'host':_0x3ca7('0xe'),'port':0x18eb});var socket=require(_0x3ca7('0xf'))(new Redis(config[_0x3ca7('0xc')]));require('./chatQueue.socket')[_0x3ca7('0x10')](socket);function respondWithRpcPromise(_0xf5217a,_0x484546,_0x5acbe2){return new BPromise(function(_0x33f89c,_0x1fbfe7){return client[_0x3ca7('0x11')](_0xf5217a,_0x5acbe2)[_0x3ca7('0x12')](function(_0x186739){logger[_0x3ca7('0x13')](_0x3ca7('0x14'),_0x484546,_0x3ca7('0x15'));logger[_0x3ca7('0x16')](_0x3ca7('0x17'),_0x484546,_0x3ca7('0x15'),JSON[_0x3ca7('0x18')](_0x186739));if(_0x186739[_0x3ca7('0x19')]){if(_0x186739['error'][_0x3ca7('0x1a')]===0x1f4){logger[_0x3ca7('0x19')]('ChatQueue,\x20%s,\x20%s',_0x484546,_0x186739[_0x3ca7('0x19')][_0x3ca7('0x1b')]);return _0x1fbfe7(_0x186739[_0x3ca7('0x19')][_0x3ca7('0x1b')]);}logger['error'](_0x3ca7('0x14'),_0x484546,_0x186739['error'][_0x3ca7('0x1b')]);return _0x33f89c(_0x186739[_0x3ca7('0x19')][_0x3ca7('0x1b')]);}else{logger['info'](_0x3ca7('0x14'),_0x484546,'request\x20sent');_0x33f89c(_0x186739['result'][_0x3ca7('0x1b')]);}})['catch'](function(_0x40d7f0){logger['error']('ChatQueue,\x20%s,\x20%s',_0x484546,_0x40d7f0);_0x1fbfe7(_0x40d7f0);});});}exports[_0x3ca7('0x1c')]=function(_0x181849){var _0x2d2882=this;return new Promise(function(_0x49f0ad,_0x2f28cb){return db['ChatQueue'][_0x3ca7('0x1d')]({'raw':_0x181849[_0x3ca7('0x1e')]?_0x181849[_0x3ca7('0x1e')][_0x3ca7('0x1f')]===undefined?!![]:![]:!![],'where':_0x181849['options']?_0x181849['options'][_0x3ca7('0x20')]||null:null,'attributes':_0x181849[_0x3ca7('0x1e')]?_0x181849[_0x3ca7('0x1e')]['attributes']||null:null,'limit':_0x181849[_0x3ca7('0x1e')]?_0x181849[_0x3ca7('0x1e')][_0x3ca7('0x21')]||null:null,'include':_0x181849[_0x3ca7('0x1e')]?_0x181849['options']['include']?_[_0x3ca7('0x22')](_0x181849[_0x3ca7('0x1e')][_0x3ca7('0x23')],function(_0x2fbd3a){return{'model':db[_0x2fbd3a[_0x3ca7('0x24')]],'as':_0x2fbd3a['as'],'attributes':_0x2fbd3a[_0x3ca7('0x25')],'include':_0x2fbd3a[_0x3ca7('0x23')]?_[_0x3ca7('0x22')](_0x2fbd3a[_0x3ca7('0x23')],function(_0x236e7d){return{'model':db[_0x236e7d[_0x3ca7('0x24')]],'as':_0x236e7d['as'],'attributes':_0x236e7d[_0x3ca7('0x25')],'include':_0x236e7d[_0x3ca7('0x23')]?_['map'](_0x236e7d[_0x3ca7('0x23')],function(_0x308541){return{'model':db[_0x308541[_0x3ca7('0x24')]],'as':_0x308541['as'],'attributes':_0x308541[_0x3ca7('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30aa21){logger['info']('GetChatQueue',_0x181849);logger[_0x3ca7('0x16')]('GetChatQueue',_0x181849,JSON[_0x3ca7('0x18')](_0x30aa21));_0x49f0ad(_0x30aa21);})[_0x3ca7('0x26')](function(_0x1a579d){logger['error']('GetChatQueue',_0x1a579d[_0x3ca7('0x1b')],_0x181849);_0x2f28cb(_0x2d2882['error'](0x1f4,_0x1a579d[_0x3ca7('0x1b')]));});});};exports['ShowChatQueue']=function(_0x597bd3){var _0x3bd2de=this;return new Promise(function(_0x402489,_0x5e2816){return db[_0x3ca7('0x27')][_0x3ca7('0x28')]({'raw':_0x597bd3['options']?_0x597bd3[_0x3ca7('0x1e')][_0x3ca7('0x1f')]===undefined?!![]:![]:!![],'where':_0x597bd3[_0x3ca7('0x1e')]?_0x597bd3[_0x3ca7('0x1e')][_0x3ca7('0x20')]||null:null,'attributes':_0x597bd3['options']?_0x597bd3[_0x3ca7('0x1e')]['attributes']||null:null,'include':_0x597bd3[_0x3ca7('0x1e')]?_0x597bd3['options'][_0x3ca7('0x23')]?_[_0x3ca7('0x22')](_0x597bd3[_0x3ca7('0x1e')]['include'],function(_0x4a597c){return{'model':db[_0x4a597c['model']],'as':_0x4a597c['as'],'attributes':_0x4a597c[_0x3ca7('0x25')],'include':_0x4a597c[_0x3ca7('0x23')]?_['map'](_0x4a597c[_0x3ca7('0x23')],function(_0x5a1c27){return{'model':db[_0x5a1c27[_0x3ca7('0x24')]],'as':_0x5a1c27['as'],'attributes':_0x5a1c27[_0x3ca7('0x25')],'include':_0x5a1c27[_0x3ca7('0x23')]?_[_0x3ca7('0x22')](_0x5a1c27[_0x3ca7('0x23')],function(_0xd4cb0a){return{'model':db[_0xd4cb0a['model']],'as':_0xd4cb0a['as'],'attributes':_0xd4cb0a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d948a){logger['info'](_0x3ca7('0x29'),_0x597bd3);logger[_0x3ca7('0x16')](_0x3ca7('0x29'),_0x597bd3,JSON[_0x3ca7('0x18')](_0x3d948a));_0x402489(_0x3d948a);})['catch'](function(_0x12c47a){logger[_0x3ca7('0x19')](_0x3ca7('0x29'),_0x12c47a[_0x3ca7('0x1b')],_0x597bd3);_0x5e2816(_0x3bd2de['error'](0x1f4,_0x12c47a[_0x3ca7('0x1b')]));});});}; \ No newline at end of file +var _0x5c96=['ChatQueue','model','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./chatQueue.socket','register','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','options','raw','where','attributes','include','map','ShowChatQueue'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5c96,0x133));var _0x65c9=function(_0x248cbb,_0x20f938){_0x248cbb=_0x248cbb-0x0;var _0x208a55=_0x5c96[_0x248cbb];return _0x208a55;};'use strict';var _=require(_0x65c9('0x0'));var util=require(_0x65c9('0x1'));var moment=require(_0x65c9('0x2'));var BPromise=require(_0x65c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x65c9('0x4'));var db=require(_0x65c9('0x5'))['db'];var utils=require(_0x65c9('0x6'));var logger=require(_0x65c9('0x7'))(_0x65c9('0x8'));var config=require(_0x65c9('0x9'));var jayson=require(_0x65c9('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x65c9('0xb')],{'host':_0x65c9('0xc'),'port':0x18eb});var socket=require(_0x65c9('0xd'))(new Redis(config['redis']));require(_0x65c9('0xe'))[_0x65c9('0xf')](socket);function respondWithRpcPromise(_0x9498d6,_0x2ed1d6,_0x4106e9){return new BPromise(function(_0x34b7c6,_0x292827){return client['request'](_0x9498d6,_0x4106e9)['then'](function(_0x5a29dd){logger[_0x65c9('0x10')](_0x65c9('0x11'),_0x2ed1d6,_0x65c9('0x12'));logger[_0x65c9('0x13')](_0x65c9('0x14'),_0x2ed1d6,'request\x20sent',JSON[_0x65c9('0x15')](_0x5a29dd));if(_0x5a29dd[_0x65c9('0x16')]){if(_0x5a29dd[_0x65c9('0x16')][_0x65c9('0x17')]===0x1f4){logger['error'](_0x65c9('0x11'),_0x2ed1d6,_0x5a29dd[_0x65c9('0x16')][_0x65c9('0x18')]);return _0x292827(_0x5a29dd[_0x65c9('0x16')][_0x65c9('0x18')]);}logger[_0x65c9('0x16')](_0x65c9('0x11'),_0x2ed1d6,_0x5a29dd[_0x65c9('0x16')][_0x65c9('0x18')]);return _0x34b7c6(_0x5a29dd[_0x65c9('0x16')][_0x65c9('0x18')]);}else{logger[_0x65c9('0x10')]('ChatQueue,\x20%s,\x20%s',_0x2ed1d6,'request\x20sent');_0x34b7c6(_0x5a29dd[_0x65c9('0x19')][_0x65c9('0x18')]);}})[_0x65c9('0x1a')](function(_0x1caf2a){logger[_0x65c9('0x16')](_0x65c9('0x11'),_0x2ed1d6,_0x1caf2a);_0x292827(_0x1caf2a);});});}exports[_0x65c9('0x1b')]=function(_0x483c1d){var _0x42f7f2=this;return new Promise(function(_0x4fccab,_0x5b275d){return db['ChatQueue']['findAll']({'raw':_0x483c1d[_0x65c9('0x1c')]?_0x483c1d[_0x65c9('0x1c')][_0x65c9('0x1d')]===undefined?!![]:![]:!![],'where':_0x483c1d[_0x65c9('0x1c')]?_0x483c1d[_0x65c9('0x1c')][_0x65c9('0x1e')]||null:null,'attributes':_0x483c1d[_0x65c9('0x1c')]?_0x483c1d[_0x65c9('0x1c')][_0x65c9('0x1f')]||null:null,'limit':_0x483c1d[_0x65c9('0x1c')]?_0x483c1d[_0x65c9('0x1c')]['limit']||null:null,'include':_0x483c1d[_0x65c9('0x1c')]?_0x483c1d[_0x65c9('0x1c')][_0x65c9('0x20')]?_[_0x65c9('0x21')](_0x483c1d[_0x65c9('0x1c')][_0x65c9('0x20')],function(_0x580445){return{'model':db[_0x580445['model']],'as':_0x580445['as'],'attributes':_0x580445[_0x65c9('0x1f')],'include':_0x580445[_0x65c9('0x20')]?_['map'](_0x580445[_0x65c9('0x20')],function(_0x368e13){return{'model':db[_0x368e13['model']],'as':_0x368e13['as'],'attributes':_0x368e13[_0x65c9('0x1f')],'include':_0x368e13[_0x65c9('0x20')]?_['map'](_0x368e13['include'],function(_0x1b2d58){return{'model':db[_0x1b2d58['model']],'as':_0x1b2d58['as'],'attributes':_0x1b2d58[_0x65c9('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c8d72){logger['info'](_0x65c9('0x1b'),_0x483c1d);logger[_0x65c9('0x13')](_0x65c9('0x1b'),_0x483c1d,JSON['stringify'](_0x1c8d72));_0x4fccab(_0x1c8d72);})[_0x65c9('0x1a')](function(_0x172d86){logger['error'](_0x65c9('0x1b'),_0x172d86['message'],_0x483c1d);_0x5b275d(_0x42f7f2[_0x65c9('0x16')](0x1f4,_0x172d86[_0x65c9('0x18')]));});});};exports[_0x65c9('0x22')]=function(_0x379a57){var _0x5315f2=this;return new Promise(function(_0x1dcd81,_0x34b80b){return db[_0x65c9('0x23')]['find']({'raw':_0x379a57[_0x65c9('0x1c')]?_0x379a57[_0x65c9('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x379a57[_0x65c9('0x1c')]?_0x379a57['options'][_0x65c9('0x1e')]||null:null,'attributes':_0x379a57[_0x65c9('0x1c')]?_0x379a57[_0x65c9('0x1c')][_0x65c9('0x1f')]||null:null,'include':_0x379a57['options']?_0x379a57[_0x65c9('0x1c')][_0x65c9('0x20')]?_['map'](_0x379a57[_0x65c9('0x1c')][_0x65c9('0x20')],function(_0x2f58e6){return{'model':db[_0x2f58e6[_0x65c9('0x24')]],'as':_0x2f58e6['as'],'attributes':_0x2f58e6[_0x65c9('0x1f')],'include':_0x2f58e6[_0x65c9('0x20')]?_[_0x65c9('0x21')](_0x2f58e6[_0x65c9('0x20')],function(_0x20ab98){return{'model':db[_0x20ab98[_0x65c9('0x24')]],'as':_0x20ab98['as'],'attributes':_0x20ab98[_0x65c9('0x1f')],'include':_0x20ab98[_0x65c9('0x20')]?_[_0x65c9('0x21')](_0x20ab98[_0x65c9('0x20')],function(_0x2f04f1){return{'model':db[_0x2f04f1[_0x65c9('0x24')]],'as':_0x2f04f1['as'],'attributes':_0x2f04f1['attributes']};}):[]};}):[]};}):[]:[]})[_0x65c9('0x25')](function(_0x4a752e){logger[_0x65c9('0x10')](_0x65c9('0x22'),_0x379a57);logger['debug']('ShowChatQueue',_0x379a57,JSON[_0x65c9('0x15')](_0x4a752e));_0x1dcd81(_0x4a752e);})[_0x65c9('0x1a')](function(_0x1795fc){logger[_0x65c9('0x16')](_0x65c9('0x22'),_0x1795fc['message'],_0x379a57);_0x34b80b(_0x5315f2[_0x65c9('0x16')](0x1f4,_0x1795fc['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 63fa0af..c0018ad 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 _0x00bb=['removeListener','length','chatQueue:','./chatQueue.events','save','remove','emit'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0x00bb,0x1d8));var _0xb00b=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x00bb[_0x47a7d0];return _0xb9bd08;};'use strict';var ChatQueueEvents=require(_0xb00b('0x0'));var events=[_0xb00b('0x1'),_0xb00b('0x2'),'update'];function createListener(_0x170f94,_0x47a3bf){return function(_0x278c5e){_0x47a3bf[_0xb00b('0x3')](_0x170f94,_0x278c5e);};}function removeListener(_0x582ef9,_0x14b5d0){return function(){ChatQueueEvents[_0xb00b('0x4')](_0x582ef9,_0x14b5d0);};}exports['register']=function(_0x574cf8){for(var _0x532ffb=0x0,_0x36e363=events[_0xb00b('0x5')];_0x532ffb<_0x36e363;_0x532ffb++){var _0x41dfc9=events[_0x532ffb];var _0x37f07d=createListener(_0xb00b('0x6')+_0x41dfc9,_0x574cf8);ChatQueueEvents['on'](_0x41dfc9,_0x37f07d);}}; \ No newline at end of file +var _0x4c6d=['emit','removeListener','register','length','chatQueue:','./chatQueue.events','save','remove','update'];(function(_0x581c27,_0x52e4d5){var _0x5d1392=function(_0x14c83d){while(--_0x14c83d){_0x581c27['push'](_0x581c27['shift']());}};_0x5d1392(++_0x52e4d5);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x5443e2,_0xe2863c){_0x5443e2=_0x5443e2-0x0;var _0x5cb7c0=_0x4c6d[_0x5443e2];return _0x5cb7c0;};'use strict';var ChatQueueEvents=require(_0xd4c6('0x0'));var events=[_0xd4c6('0x1'),_0xd4c6('0x2'),_0xd4c6('0x3')];function createListener(_0x350cc0,_0x5448bc){return function(_0x209f99){_0x5448bc[_0xd4c6('0x4')](_0x350cc0,_0x209f99);};}function removeListener(_0x306766,_0x4b2d75){return function(){ChatQueueEvents[_0xd4c6('0x5')](_0x306766,_0x4b2d75);};}exports[_0xd4c6('0x6')]=function(_0x56279c){for(var _0x182671=0x0,_0x316314=events[_0xd4c6('0x7')];_0x182671<_0x316314;_0x182671++){var _0x5d4fce=events[_0x182671];var _0x440ee3=createListener(_0xd4c6('0x8')+_0x5d4fce,_0x56279c);ChatQueueEvents['on'](_0x5d4fce,_0x440ee3);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index c1b7236..a9d2fb2 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x2306a5,_0x175f5b){var _0x1a2e0b=function(_0x51bac0){while(--_0x51bac0){_0x2306a5['push'](_0x2306a5['shift']());}};_0x1a2e0b(++_0x175f5b);}(_0xe14b,0x93));var _0xbe14=function(_0xfd5b09,_0x121584){_0xfd5b09=_0xfd5b09-0x0;var _0x5d443c=_0xe14b[_0xfd5b09];return _0x5d443c;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _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(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x3e74,0x175));var _0x43e7=function(_0x4b5fea,_0x1e88aa){_0x4b5fea=_0x4b5fea-0x0;var _0x2b342a=_0x3e74[_0x4b5fea];return _0x2b342a;};'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 7af47f1..ee69967 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 _0x4621=['STRING','DATE'];(function(_0x466e57,_0x21b819){var _0x34df42=function(_0x3e9758){while(--_0x3e9758){_0x466e57['push'](_0x466e57['shift']());}};_0x34df42(++_0x21b819);}(_0x4621,0x16d));var _0x1462=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4621[_0x40a045];return _0x1a687c;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x1462('0x0')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x1462('0x0')]},'exitAt':{'type':Sequelize[_0x1462('0x0')]},'reason':{'type':Sequelize[_0x1462('0x1')]}}; \ No newline at end of file +var _0x623d=['exports','STRING','DATE'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x623d,0x1b0));var _0xd623=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x623d[_0x432682];return _0x463d05;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xd623('0x0')]={'uniqueid':{'type':Sequelize[_0xd623('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xd623('0x1')]},'joinAt':{'type':Sequelize[_0xd623('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd623('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xd623('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 8c94d8b..b9728ac 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 _0x6c99=['show','params','intersection','length','includeAll','find','catch','create','body','update','describe','eml-format','zip-dir','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','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','offset','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','fieldName','type','query','keys','filters','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','include','ChatQueueReport','findAll','rows'];(function(_0x5c9829,_0x1c621b){var _0x7201d=function(_0x2ce86b){while(--_0x2ce86b){_0x5c9829['push'](_0x5c9829['shift']());}};_0x7201d(++_0x1c621b);}(_0x6c99,0x9b));var _0x96c9=function(_0x588011,_0x5e9d11){_0x588011=_0x588011-0x0;var _0x3b3773=_0x6c99[_0x588011];return _0x3b3773;};'use strict';var emlformat=require(_0x96c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x96c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x96c9('0x2'));var path=require(_0x96c9('0x3'));var sox=require(_0x96c9('0x4'));var csv=require(_0x96c9('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x96c9('0x6'));var _=require(_0x96c9('0x7'));var squel=require(_0x96c9('0x8'));var crypto=require(_0x96c9('0x9'));var jsforce=require(_0x96c9('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x96c9('0xb'));var Papa=require('papaparse');var Redis=require(_0x96c9('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x96c9('0xd'));var as=require(_0x96c9('0xe'));var hardwareService=require(_0x96c9('0xf'));var logger=require(_0x96c9('0x10'))('api');var utils=require(_0x96c9('0x11'));var config=require(_0x96c9('0x12'));var licenseUtil=require(_0x96c9('0x13'));var db=require(_0x96c9('0x14'))['db'];function respondWithStatusCode(_0x3e2e57,_0x5243ca){_0x5243ca=_0x5243ca||0xcc;return function(_0x46f105){if(_0x46f105){return _0x3e2e57[_0x96c9('0x15')](_0x5243ca);}return _0x3e2e57[_0x96c9('0x16')](_0x5243ca)[_0x96c9('0x17')]();};}function respondWithResult(_0x59418c,_0x5d1f4e){_0x5d1f4e=_0x5d1f4e||0xc8;return function(_0x3f1cf9){if(_0x3f1cf9){return _0x59418c[_0x96c9('0x16')](_0x5d1f4e)[_0x96c9('0x18')](_0x3f1cf9);}};}function respondWithFilteredResult(_0x2f6ec5,_0x5c1116){return function(_0x4fa3db){if(_0x4fa3db){var _0x5d18da=typeof _0x5c1116[_0x96c9('0x19')]==='undefined'&&typeof _0x5c1116[_0x96c9('0x1a')]==='undefined';var _0x1ceeb0=_0x4fa3db[_0x96c9('0x1b')];var _0x21a0d0=_0x5d18da?0x0:_0x5c1116[_0x96c9('0x19')];var _0x3bdf8f=_0x5d18da?_0x4fa3db['count']:_0x5c1116[_0x96c9('0x19')]+_0x5c1116['limit'];var _0x3dd3de;if(_0x3bdf8f>=_0x1ceeb0){_0x3bdf8f=_0x1ceeb0;_0x3dd3de=0xc8;}else{_0x3dd3de=0xce;}_0x2f6ec5[_0x96c9('0x16')](_0x3dd3de);return _0x2f6ec5[_0x96c9('0x1c')]('Content-Range',_0x21a0d0+'-'+_0x3bdf8f+'/'+_0x1ceeb0)['json'](_0x4fa3db);}return null;};}function patchUpdates(_0x17aea5){return function(_0x20f974){try{jsonpatch[_0x96c9('0x1d')](_0x20f974,_0x17aea5,!![]);}catch(_0x1bf748){return BPromise[_0x96c9('0x1e')](_0x1bf748);}return _0x20f974[_0x96c9('0x1f')]();};}function saveUpdates(_0x596453,_0x101a25){return function(_0x3a7fc5){if(_0x3a7fc5){return _0x3a7fc5['update'](_0x596453)[_0x96c9('0x20')](function(_0x2a7ae1){return _0x2a7ae1;});}return null;};}function removeEntity(_0x185bb5,_0x575364){return function(_0x13e642){if(_0x13e642){return _0x13e642[_0x96c9('0x21')]()[_0x96c9('0x20')](function(){_0x185bb5[_0x96c9('0x16')](0xcc)[_0x96c9('0x17')]();});}};}function handleEntityNotFound(_0x2b7ad3,_0x62b05e){return function(_0x5c7252){if(!_0x5c7252){_0x2b7ad3[_0x96c9('0x15')](0x194);}return _0x5c7252;};}function handleError(_0x40b1db,_0x316d86){_0x316d86=_0x316d86||0x1f4;return function(_0x3b8b0f){logger[_0x96c9('0x22')](_0x3b8b0f[_0x96c9('0x23')]);if(_0x3b8b0f[_0x96c9('0x24')]){delete _0x3b8b0f[_0x96c9('0x24')];}_0x40b1db[_0x96c9('0x16')](_0x316d86)[_0x96c9('0x25')](_0x3b8b0f);};}exports[_0x96c9('0x26')]=function(_0x7d2858,_0x56b920){var _0x5364e5={},_0x342216={},_0x3a770b={'count':0x0,'rows':[]};var _0x4cae5a=_[_0x96c9('0x27')](db['ChatQueueReport']['rawAttributes'],function(_0x1fa934){return{'name':_0x1fa934[_0x96c9('0x28')],'type':_0x1fa934[_0x96c9('0x29')]['key']};});_0x342216['model']=_[_0x96c9('0x27')](_0x4cae5a,_0x96c9('0x24'));_0x342216[_0x96c9('0x2a')]=_[_0x96c9('0x2b')](_0x7d2858[_0x96c9('0x2a')]);_0x342216[_0x96c9('0x2c')]=_['intersection'](_0x342216['model'],_0x342216[_0x96c9('0x2a')]);_0x5364e5[_0x96c9('0x2d')]=_['intersection'](_0x342216[_0x96c9('0x2e')],qs[_0x96c9('0x2f')](_0x7d2858[_0x96c9('0x2a')][_0x96c9('0x2f')]));_0x5364e5[_0x96c9('0x2d')]=_0x5364e5[_0x96c9('0x2d')]['length']?_0x5364e5[_0x96c9('0x2d')]:_0x342216[_0x96c9('0x2e')];if(!_0x7d2858[_0x96c9('0x2a')][_0x96c9('0x30')]('nolimit')){_0x5364e5[_0x96c9('0x1a')]=qs['limit'](_0x7d2858['query'][_0x96c9('0x1a')]);_0x5364e5['offset']=qs[_0x96c9('0x19')](_0x7d2858['query'][_0x96c9('0x19')]);}_0x5364e5[_0x96c9('0x31')]=qs[_0x96c9('0x32')](_0x7d2858['query']['sort']);_0x5364e5[_0x96c9('0x33')]=qs['filters'](_[_0x96c9('0x34')](_0x7d2858['query'],_0x342216[_0x96c9('0x2c')]),_0x4cae5a);if(_0x7d2858[_0x96c9('0x2a')][_0x96c9('0x35')]){_0x5364e5[_0x96c9('0x33')]=_['merge'](_0x5364e5[_0x96c9('0x33')],{'$or':_[_0x96c9('0x27')](_0x4cae5a,function(_0x338925){if(_0x338925[_0x96c9('0x29')]!==_0x96c9('0x36')){var _0x770669={};_0x770669[_0x338925[_0x96c9('0x24')]]={'$like':'%'+_0x7d2858[_0x96c9('0x2a')][_0x96c9('0x35')]+'%'};return _0x770669;}})});}_0x5364e5=_[_0x96c9('0x37')]({},_0x5364e5,_0x7d2858[_0x96c9('0x38')]);var _0x331735={'where':_0x5364e5['where']};return db['ChatQueueReport'][_0x96c9('0x1b')](_0x331735)[_0x96c9('0x20')](function(_0x59db64){_0x3a770b[_0x96c9('0x1b')]=_0x59db64;if(_0x7d2858[_0x96c9('0x2a')]['includeAll']){_0x5364e5[_0x96c9('0x39')]=[{'all':!![]}];}return db[_0x96c9('0x3a')][_0x96c9('0x3b')](_0x5364e5);})[_0x96c9('0x20')](function(_0x3b64c8){_0x3a770b[_0x96c9('0x3c')]=_0x3b64c8;return _0x3a770b;})[_0x96c9('0x20')](respondWithFilteredResult(_0x56b920,_0x5364e5))['catch'](handleError(_0x56b920,null));};exports[_0x96c9('0x3d')]=function(_0x3d9056,_0x18592b){var _0x3a3399={'raw':!![],'where':{'id':_0x3d9056[_0x96c9('0x3e')]['id']}},_0x49ee79={};_0x49ee79['model']=_[_0x96c9('0x2b')](db[_0x96c9('0x3a')]['rawAttributes']);_0x49ee79[_0x96c9('0x2a')]=_[_0x96c9('0x2b')](_0x3d9056[_0x96c9('0x2a')]);_0x49ee79[_0x96c9('0x2c')]=_[_0x96c9('0x3f')](_0x49ee79[_0x96c9('0x2e')],_0x49ee79[_0x96c9('0x2a')]);_0x3a3399[_0x96c9('0x2d')]=_[_0x96c9('0x3f')](_0x49ee79['model'],qs['fields'](_0x3d9056[_0x96c9('0x2a')][_0x96c9('0x2f')]));_0x3a3399[_0x96c9('0x2d')]=_0x3a3399[_0x96c9('0x2d')][_0x96c9('0x40')]?_0x3a3399['attributes']:_0x49ee79[_0x96c9('0x2e')];if(_0x3d9056[_0x96c9('0x2a')][_0x96c9('0x41')]){_0x3a3399[_0x96c9('0x39')]=[{'all':!![]}];}_0x3a3399=_['merge']({},_0x3a3399,_0x3d9056['options']);return db[_0x96c9('0x3a')][_0x96c9('0x42')](_0x3a3399)[_0x96c9('0x20')](handleEntityNotFound(_0x18592b,null))['then'](respondWithResult(_0x18592b,null))[_0x96c9('0x43')](handleError(_0x18592b,null));};exports['create']=function(_0x3c4bf1,_0x2071d5){return db['ChatQueueReport'][_0x96c9('0x44')](_0x3c4bf1[_0x96c9('0x45')],{})['then'](respondWithResult(_0x2071d5,0xc9))[_0x96c9('0x43')](handleError(_0x2071d5,null));};exports[_0x96c9('0x46')]=function(_0x986731,_0x16156e){if(_0x986731[_0x96c9('0x45')]['id']){delete _0x986731[_0x96c9('0x45')]['id'];}return db[_0x96c9('0x3a')][_0x96c9('0x42')]({'where':{'id':_0x986731[_0x96c9('0x3e')]['id']}})[_0x96c9('0x20')](handleEntityNotFound(_0x16156e,null))['then'](saveUpdates(_0x986731[_0x96c9('0x45')],null))['then'](respondWithResult(_0x16156e,null))[_0x96c9('0x43')](handleError(_0x16156e,null));};exports[_0x96c9('0x21')]=function(_0x25f3df,_0x59dea7){return db[_0x96c9('0x3a')][_0x96c9('0x42')]({'where':{'id':_0x25f3df[_0x96c9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x59dea7,null))[_0x96c9('0x20')](removeEntity(_0x59dea7,null))[_0x96c9('0x43')](handleError(_0x59dea7,null));};exports[_0x96c9('0x47')]=function(_0x576314,_0x4f18ad){return db[_0x96c9('0x3a')][_0x96c9('0x47')]()[_0x96c9('0x20')](respondWithResult(_0x4f18ad,null))[_0x96c9('0x43')](handleError(_0x4f18ad,null));}; \ No newline at end of file +var _0xd7c3=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','ChatQueueReport','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js'];(function(_0x35ef6b,_0x202c42){var _0x3ad145=function(_0x3092de){while(--_0x3092de){_0x35ef6b['push'](_0x35ef6b['shift']());}};_0x3ad145(++_0x202c42);}(_0xd7c3,0x1c5));var _0x3d7c=function(_0x29a43f,_0x5bc56f){_0x29a43f=_0x29a43f-0x0;var _0x14b425=_0xd7c3[_0x29a43f];return _0x14b425;};'use strict';var emlformat=require(_0x3d7c('0x0'));var rimraf=require(_0x3d7c('0x1'));var zipdir=require(_0x3d7c('0x2'));var jsonpatch=require(_0x3d7c('0x3'));var rp=require(_0x3d7c('0x4'));var moment=require(_0x3d7c('0x5'));var BPromise=require(_0x3d7c('0x6'));var Mustache=require(_0x3d7c('0x7'));var util=require(_0x3d7c('0x8'));var path=require('path');var sox=require(_0x3d7c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d7c('0xa'));var squel=require(_0x3d7c('0xb'));var crypto=require(_0x3d7c('0xc'));var jsforce=require(_0x3d7c('0xd'));var deskjs=require(_0x3d7c('0xe'));var toCsv=require(_0x3d7c('0xf'));var querystring=require(_0x3d7c('0x10'));var Papa=require(_0x3d7c('0x11'));var Redis=require(_0x3d7c('0x12'));var authService=require(_0x3d7c('0x13'));var qs=require(_0x3d7c('0x14'));var as=require(_0x3d7c('0x15'));var hardwareService=require(_0x3d7c('0x16'));var logger=require(_0x3d7c('0x17'))(_0x3d7c('0x18'));var utils=require(_0x3d7c('0x19'));var config=require(_0x3d7c('0x1a'));var licenseUtil=require(_0x3d7c('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20148f,_0x40e8a6){_0x40e8a6=_0x40e8a6||0xcc;return function(_0xb7bd60){if(_0xb7bd60){return _0x20148f[_0x3d7c('0x1c')](_0x40e8a6);}return _0x20148f[_0x3d7c('0x1d')](_0x40e8a6)[_0x3d7c('0x1e')]();};}function respondWithResult(_0x4728dc,_0x477faf){_0x477faf=_0x477faf||0xc8;return function(_0x2717c5){if(_0x2717c5){return _0x4728dc[_0x3d7c('0x1d')](_0x477faf)[_0x3d7c('0x1f')](_0x2717c5);}};}function respondWithFilteredResult(_0x37122a,_0x1ba7ee){return function(_0xf0a186){if(_0xf0a186){var _0x9d0305=typeof _0x1ba7ee[_0x3d7c('0x20')]==='undefined'&&typeof _0x1ba7ee[_0x3d7c('0x21')]===_0x3d7c('0x22');var _0x49e25c=_0xf0a186['count'];var _0x447ea0=_0x9d0305?0x0:_0x1ba7ee[_0x3d7c('0x20')];var _0x323204=_0x9d0305?_0xf0a186[_0x3d7c('0x23')]:_0x1ba7ee['offset']+_0x1ba7ee[_0x3d7c('0x21')];var _0x328851;if(_0x323204>=_0x49e25c){_0x323204=_0x49e25c;_0x328851=0xc8;}else{_0x328851=0xce;}_0x37122a[_0x3d7c('0x1d')](_0x328851);return _0x37122a['set'](_0x3d7c('0x24'),_0x447ea0+'-'+_0x323204+'/'+_0x49e25c)[_0x3d7c('0x1f')](_0xf0a186);}return null;};}function patchUpdates(_0x3a99fd){return function(_0x5a91d2){try{jsonpatch[_0x3d7c('0x25')](_0x5a91d2,_0x3a99fd,!![]);}catch(_0x22f9f6){return BPromise[_0x3d7c('0x26')](_0x22f9f6);}return _0x5a91d2[_0x3d7c('0x27')]();};}function saveUpdates(_0xa4fbe9,_0x4c977f){return function(_0x126c5e){if(_0x126c5e){return _0x126c5e[_0x3d7c('0x28')](_0xa4fbe9)[_0x3d7c('0x29')](function(_0x81a5a3){return _0x81a5a3;});}return null;};}function removeEntity(_0x553df1,_0x4a7966){return function(_0x3518c9){if(_0x3518c9){return _0x3518c9[_0x3d7c('0x2a')]()[_0x3d7c('0x29')](function(){_0x553df1[_0x3d7c('0x1d')](0xcc)[_0x3d7c('0x1e')]();});}};}function handleEntityNotFound(_0x2806a5,_0x139fa2){return function(_0x2ac594){if(!_0x2ac594){_0x2806a5[_0x3d7c('0x1c')](0x194);}return _0x2ac594;};}function handleError(_0x4696f1,_0x820d20){_0x820d20=_0x820d20||0x1f4;return function(_0x4d440b){logger['error'](_0x4d440b[_0x3d7c('0x2b')]);if(_0x4d440b[_0x3d7c('0x2c')]){delete _0x4d440b['name'];}_0x4696f1[_0x3d7c('0x1d')](_0x820d20)[_0x3d7c('0x2d')](_0x4d440b);};}exports[_0x3d7c('0x2e')]=function(_0x53698b,_0x457c53){var _0x386719={},_0x215c60={},_0x236440={'count':0x0,'rows':[]};var _0x257dde=_['map'](db[_0x3d7c('0x2f')][_0x3d7c('0x30')],function(_0x20dc15){return{'name':_0x20dc15['fieldName'],'type':_0x20dc15[_0x3d7c('0x31')][_0x3d7c('0x32')]};});_0x215c60[_0x3d7c('0x33')]=_[_0x3d7c('0x34')](_0x257dde,_0x3d7c('0x2c'));_0x215c60[_0x3d7c('0x35')]=_['keys'](_0x53698b['query']);_0x215c60[_0x3d7c('0x36')]=_[_0x3d7c('0x37')](_0x215c60[_0x3d7c('0x33')],_0x215c60[_0x3d7c('0x35')]);_0x386719[_0x3d7c('0x38')]=_[_0x3d7c('0x37')](_0x215c60['model'],qs[_0x3d7c('0x39')](_0x53698b[_0x3d7c('0x35')][_0x3d7c('0x39')]));_0x386719['attributes']=_0x386719[_0x3d7c('0x38')]['length']?_0x386719['attributes']:_0x215c60[_0x3d7c('0x33')];if(!_0x53698b[_0x3d7c('0x35')][_0x3d7c('0x3a')](_0x3d7c('0x3b'))){_0x386719['limit']=qs[_0x3d7c('0x21')](_0x53698b[_0x3d7c('0x35')]['limit']);_0x386719[_0x3d7c('0x20')]=qs['offset'](_0x53698b[_0x3d7c('0x35')][_0x3d7c('0x20')]);}_0x386719[_0x3d7c('0x3c')]=qs[_0x3d7c('0x3d')](_0x53698b[_0x3d7c('0x35')][_0x3d7c('0x3d')]);_0x386719[_0x3d7c('0x3e')]=qs[_0x3d7c('0x36')](_[_0x3d7c('0x3f')](_0x53698b[_0x3d7c('0x35')],_0x215c60[_0x3d7c('0x36')]),_0x257dde);if(_0x53698b[_0x3d7c('0x35')]['filter']){_0x386719[_0x3d7c('0x3e')]=_[_0x3d7c('0x40')](_0x386719[_0x3d7c('0x3e')],{'$or':_[_0x3d7c('0x34')](_0x257dde,function(_0x1f1e29){if(_0x1f1e29[_0x3d7c('0x31')]!==_0x3d7c('0x41')){var _0x55ada1={};_0x55ada1[_0x1f1e29[_0x3d7c('0x2c')]]={'$like':'%'+_0x53698b[_0x3d7c('0x35')]['filter']+'%'};return _0x55ada1;}})});}_0x386719=_['merge']({},_0x386719,_0x53698b['options']);var _0x40058f={'where':_0x386719[_0x3d7c('0x3e')]};return db[_0x3d7c('0x2f')][_0x3d7c('0x23')](_0x40058f)['then'](function(_0x130583){_0x236440[_0x3d7c('0x23')]=_0x130583;if(_0x53698b[_0x3d7c('0x35')][_0x3d7c('0x42')]){_0x386719[_0x3d7c('0x43')]=[{'all':!![]}];}return db[_0x3d7c('0x2f')][_0x3d7c('0x44')](_0x386719);})[_0x3d7c('0x29')](function(_0x12fc85){_0x236440[_0x3d7c('0x45')]=_0x12fc85;return _0x236440;})[_0x3d7c('0x29')](respondWithFilteredResult(_0x457c53,_0x386719))[_0x3d7c('0x46')](handleError(_0x457c53,null));};exports[_0x3d7c('0x47')]=function(_0x5bb21a,_0x5b0db8){var _0x177ad7={'raw':!![],'where':{'id':_0x5bb21a[_0x3d7c('0x48')]['id']}},_0x2ed019={};_0x2ed019['model']=_[_0x3d7c('0x49')](db[_0x3d7c('0x2f')][_0x3d7c('0x30')]);_0x2ed019[_0x3d7c('0x35')]=_[_0x3d7c('0x49')](_0x5bb21a[_0x3d7c('0x35')]);_0x2ed019[_0x3d7c('0x36')]=_[_0x3d7c('0x37')](_0x2ed019['model'],_0x2ed019[_0x3d7c('0x35')]);_0x177ad7[_0x3d7c('0x38')]=_[_0x3d7c('0x37')](_0x2ed019[_0x3d7c('0x33')],qs['fields'](_0x5bb21a[_0x3d7c('0x35')][_0x3d7c('0x39')]));_0x177ad7[_0x3d7c('0x38')]=_0x177ad7[_0x3d7c('0x38')][_0x3d7c('0x4a')]?_0x177ad7['attributes']:_0x2ed019[_0x3d7c('0x33')];if(_0x5bb21a['query'][_0x3d7c('0x42')]){_0x177ad7[_0x3d7c('0x43')]=[{'all':!![]}];}_0x177ad7=_[_0x3d7c('0x40')]({},_0x177ad7,_0x5bb21a['options']);return db[_0x3d7c('0x2f')][_0x3d7c('0x4b')](_0x177ad7)[_0x3d7c('0x29')](handleEntityNotFound(_0x5b0db8,null))[_0x3d7c('0x29')](respondWithResult(_0x5b0db8,null))[_0x3d7c('0x46')](handleError(_0x5b0db8,null));};exports['create']=function(_0x468a9c,_0x393217){return db[_0x3d7c('0x2f')][_0x3d7c('0x4c')](_0x468a9c[_0x3d7c('0x4d')],{})[_0x3d7c('0x29')](respondWithResult(_0x393217,0xc9))[_0x3d7c('0x46')](handleError(_0x393217,null));};exports[_0x3d7c('0x28')]=function(_0x2549ed,_0x33cc2c){if(_0x2549ed['body']['id']){delete _0x2549ed[_0x3d7c('0x4d')]['id'];}return db[_0x3d7c('0x2f')][_0x3d7c('0x4b')]({'where':{'id':_0x2549ed[_0x3d7c('0x48')]['id']}})[_0x3d7c('0x29')](handleEntityNotFound(_0x33cc2c,null))['then'](saveUpdates(_0x2549ed[_0x3d7c('0x4d')],null))[_0x3d7c('0x29')](respondWithResult(_0x33cc2c,null))[_0x3d7c('0x46')](handleError(_0x33cc2c,null));};exports[_0x3d7c('0x2a')]=function(_0x1cba46,_0x31bbac){return db[_0x3d7c('0x2f')][_0x3d7c('0x4b')]({'where':{'id':_0x1cba46['params']['id']}})[_0x3d7c('0x29')](handleEntityNotFound(_0x31bbac,null))['then'](removeEntity(_0x31bbac,null))['catch'](handleError(_0x31bbac,null));};exports['describe']=function(_0x5b65a9,_0x55a56c){return db[_0x3d7c('0x2f')]['describe']()['then'](respondWithResult(_0x55a56c,null))[_0x3d7c('0x46')](handleError(_0x55a56c,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 80e7685..5770bfa 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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x3c6254,_0x24ab89){var _0x551e02=function(_0xb437ac){while(--_0xb437ac){_0x3c6254['push'](_0x3c6254['shift']());}};_0x551e02(++_0x24ab89);}(_0x757a,0xde));var _0xa757=function(_0x432923,_0x4f4024){_0x432923=_0x432923-0x0;var _0x4ad7e7=_0x757a[_0x432923];return _0x4ad7e7;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x55a62d,_0x2b1826){var _0x5adef7=function(_0x42cdf0){while(--_0x42cdf0){_0x55a62d['push'](_0x55a62d['shift']());}};_0x5adef7(++_0x2b1826);}(_0x757a,0xde));var _0xa757=function(_0x3b1bab,_0x379389){_0x3b1bab=_0x3b1bab-0x0;var _0x3a7974=_0x757a[_0x3b1bab];return _0x3a7974;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 44dd31a..6ee3a20 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 _0x7889=['UpdateChatQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','ChatQueueReport','create','body','options','raw','CreateChatQueueReport','catch'];(function(_0x5acc8c,_0x4f7b1a){var _0x236007=function(_0x1aeaab){while(--_0x1aeaab){_0x5acc8c['push'](_0x5acc8c['shift']());}};_0x236007(++_0x4f7b1a);}(_0x7889,0x1cc));var _0x9788=function(_0x4a31c5,_0x3ae3e9){_0x4a31c5=_0x4a31c5-0x0;var _0x2cb35a=_0x7889[_0x4a31c5];return _0x2cb35a;};'use strict';var _=require(_0x9788('0x0'));var util=require(_0x9788('0x1'));var moment=require(_0x9788('0x2'));var BPromise=require(_0x9788('0x3'));var rs=require(_0x9788('0x4'));var fs=require('fs');var Redis=require(_0x9788('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9788('0x6'));var logger=require('../../config/logger')(_0x9788('0x7'));var config=require(_0x9788('0x8'));var jayson=require(_0x9788('0x9'));var client=jayson['client'][_0x9788('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x422af7,_0x4e825c,_0x59dea1){return new BPromise(function(_0x280169,_0x262aec){return client[_0x9788('0xb')](_0x422af7,_0x59dea1)[_0x9788('0xc')](function(_0x16c231){logger[_0x9788('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x4e825c,'request\x20sent');logger[_0x9788('0xe')](_0x9788('0xf'),_0x4e825c,_0x9788('0x10'),JSON[_0x9788('0x11')](_0x16c231));if(_0x16c231[_0x9788('0x12')]){if(_0x16c231[_0x9788('0x12')][_0x9788('0x13')]===0x1f4){logger[_0x9788('0x12')](_0x9788('0x14'),_0x4e825c,_0x16c231[_0x9788('0x12')]['message']);return _0x262aec(_0x16c231[_0x9788('0x12')][_0x9788('0x15')]);}logger[_0x9788('0x12')](_0x9788('0x14'),_0x4e825c,_0x16c231['error'][_0x9788('0x15')]);return _0x280169(_0x16c231['error'][_0x9788('0x15')]);}else{logger[_0x9788('0xd')](_0x9788('0x14'),_0x4e825c,'request\x20sent');_0x280169(_0x16c231[_0x9788('0x16')]['message']);}})['catch'](function(_0x10750e){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x4e825c,_0x10750e);_0x262aec(_0x10750e);});});}exports['CreateChatQueueReport']=function(_0x3df7d9){var _0x3c79d4=this;return new Promise(function(_0x4525fb,_0x3905cc){return db[_0x9788('0x17')][_0x9788('0x18')](_0x3df7d9[_0x9788('0x19')],{'raw':_0x3df7d9[_0x9788('0x1a')]?_0x3df7d9[_0x9788('0x1a')][_0x9788('0x1b')]===undefined?!![]:![]:!![]})[_0x9788('0xc')](function(_0x4a119d){logger[_0x9788('0xd')](_0x9788('0x1c'),_0x3df7d9);logger[_0x9788('0xe')](_0x9788('0x1c'),_0x3df7d9,JSON['stringify'](_0x4a119d));_0x4525fb(_0x4a119d);})[_0x9788('0x1d')](function(_0x4cdad9){logger[_0x9788('0x12')]('CreateChatQueueReport',_0x4cdad9[_0x9788('0x15')],_0x3df7d9);_0x3905cc(_0x3c79d4['error'](0x1f4,_0x4cdad9['message']));});});};exports[_0x9788('0x1e')]=function(_0x5e1a5f){var _0x4b06f8=this;return new Promise(function(_0x1e3b76,_0x2e4793){return db[_0x9788('0x17')][_0x9788('0x1f')](_0x5e1a5f['body'],{'raw':_0x5e1a5f[_0x9788('0x1a')]?_0x5e1a5f[_0x9788('0x1a')][_0x9788('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e1a5f[_0x9788('0x1a')]?_0x5e1a5f[_0x9788('0x1a')][_0x9788('0x20')]||null:null,'attributes':_0x5e1a5f['options']?_0x5e1a5f['options'][_0x9788('0x21')]||null:null,'limit':_0x5e1a5f[_0x9788('0x1a')]?_0x5e1a5f[_0x9788('0x1a')][_0x9788('0x22')]||null:null})[_0x9788('0xc')](function(_0x4a7c1c){logger[_0x9788('0xd')](_0x9788('0x1e'),_0x5e1a5f);logger[_0x9788('0xe')]('UpdateChatQueueReport',_0x5e1a5f,JSON[_0x9788('0x11')](_0x4a7c1c));_0x1e3b76(_0x4a7c1c);})['catch'](function(_0x78bb83){logger[_0x9788('0x12')]('UpdateChatQueueReport',_0x78bb83[_0x9788('0x15')],_0x5e1a5f);_0x2e4793(_0x4b06f8[_0x9788('0x12')](0x1f4,_0x78bb83[_0x9788('0x15')]));});});}; \ No newline at end of file +var _0xb991=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','then','UpdateChatQueueReport','update','where','limit','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb991,0x69));var _0x1b99=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xb991[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x1b99('0x0'));var util=require(_0x1b99('0x1'));var moment=require(_0x1b99('0x2'));var BPromise=require(_0x1b99('0x3'));var rs=require(_0x1b99('0x4'));var fs=require('fs');var Redis=require(_0x1b99('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b99('0x6'));var logger=require(_0x1b99('0x7'))(_0x1b99('0x8'));var config=require(_0x1b99('0x9'));var jayson=require(_0x1b99('0xa'));var client=jayson[_0x1b99('0xb')][_0x1b99('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2693a5,_0x5cd2d3,_0x592297){return new BPromise(function(_0x3bb0ee,_0x1694e7){return client['request'](_0x2693a5,_0x592297)['then'](function(_0x415ae1){logger[_0x1b99('0xd')](_0x1b99('0xe'),_0x5cd2d3,_0x1b99('0xf'));logger['debug'](_0x1b99('0x10'),_0x5cd2d3,_0x1b99('0xf'),JSON[_0x1b99('0x11')](_0x415ae1));if(_0x415ae1[_0x1b99('0x12')]){if(_0x415ae1['error'][_0x1b99('0x13')]===0x1f4){logger['error'](_0x1b99('0xe'),_0x5cd2d3,_0x415ae1[_0x1b99('0x12')][_0x1b99('0x14')]);return _0x1694e7(_0x415ae1[_0x1b99('0x12')][_0x1b99('0x14')]);}logger[_0x1b99('0x12')](_0x1b99('0xe'),_0x5cd2d3,_0x415ae1['error'][_0x1b99('0x14')]);return _0x3bb0ee(_0x415ae1['error'][_0x1b99('0x14')]);}else{logger[_0x1b99('0xd')](_0x1b99('0xe'),_0x5cd2d3,'request\x20sent');_0x3bb0ee(_0x415ae1[_0x1b99('0x15')]['message']);}})[_0x1b99('0x16')](function(_0x2f4e6a){logger[_0x1b99('0x12')](_0x1b99('0xe'),_0x5cd2d3,_0x2f4e6a);_0x1694e7(_0x2f4e6a);});});}exports[_0x1b99('0x17')]=function(_0x4e219e){var _0x1d314a=this;return new Promise(function(_0x480e94,_0x3983c8){return db[_0x1b99('0x18')][_0x1b99('0x19')](_0x4e219e[_0x1b99('0x1a')],{'raw':_0x4e219e[_0x1b99('0x1b')]?_0x4e219e[_0x1b99('0x1b')][_0x1b99('0x1c')]===undefined?!![]:![]:!![]})[_0x1b99('0x1d')](function(_0x392a9a){logger[_0x1b99('0xd')]('CreateChatQueueReport',_0x4e219e);logger['debug'](_0x1b99('0x17'),_0x4e219e,JSON[_0x1b99('0x11')](_0x392a9a));_0x480e94(_0x392a9a);})[_0x1b99('0x16')](function(_0x558d7b){logger['error'](_0x1b99('0x17'),_0x558d7b[_0x1b99('0x14')],_0x4e219e);_0x3983c8(_0x1d314a[_0x1b99('0x12')](0x1f4,_0x558d7b[_0x1b99('0x14')]));});});};exports[_0x1b99('0x1e')]=function(_0x419937){var _0x5b740a=this;return new Promise(function(_0x270c88,_0x589dde){return db[_0x1b99('0x18')][_0x1b99('0x1f')](_0x419937['body'],{'raw':_0x419937[_0x1b99('0x1b')]?_0x419937[_0x1b99('0x1b')][_0x1b99('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x419937['options']?_0x419937[_0x1b99('0x1b')][_0x1b99('0x20')]||null:null,'attributes':_0x419937['options']?_0x419937[_0x1b99('0x1b')]['attributes']||null:null,'limit':_0x419937[_0x1b99('0x1b')]?_0x419937[_0x1b99('0x1b')][_0x1b99('0x21')]||null:null})[_0x1b99('0x1d')](function(_0x5052cc){logger[_0x1b99('0xd')](_0x1b99('0x1e'),_0x419937);logger[_0x1b99('0x22')](_0x1b99('0x1e'),_0x419937,JSON[_0x1b99('0x11')](_0x5052cc));_0x270c88(_0x5052cc);})[_0x1b99('0x16')](function(_0x57518a){logger[_0x1b99('0x12')](_0x1b99('0x1e'),_0x57518a['message'],_0x419937);_0x589dde(_0x5b740a[_0x1b99('0x12')](0x1f4,_0x57518a[_0x1b99('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 4632b1b..d28e87a 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 _0xdeb8=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xdeb8,0x1b9));var _0x8deb=function(_0x214787,_0x29db96){_0x214787=_0x214787-0x0;var _0x1bb519=_0xdeb8[_0x214787];return _0x1bb519;};'use strict';var multer=require(_0x8deb('0x0'));var util=require(_0x8deb('0x1'));var path=require(_0x8deb('0x2'));var timeout=require('connect-timeout');var express=require(_0x8deb('0x3'));var router=express[_0x8deb('0x4')]();var fs_extra=require(_0x8deb('0x5'));var auth=require(_0x8deb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8deb('0x7'));var controller=require(_0x8deb('0x8'));router[_0x8deb('0x9')]('/',auth[_0x8deb('0xa')](),controller[_0x8deb('0xb')]);router['get'](_0x8deb('0xc'),auth[_0x8deb('0xa')](),controller[_0x8deb('0xd')]);router[_0x8deb('0x9')](_0x8deb('0xe'),auth[_0x8deb('0xa')](),controller[_0x8deb('0xf')]);router[_0x8deb('0x10')]('/',auth[_0x8deb('0xa')](),controller[_0x8deb('0x11')]);router[_0x8deb('0x12')]('/:id',auth[_0x8deb('0xa')](),controller[_0x8deb('0x13')]);router['delete'](_0x8deb('0xe'),auth['isAuthenticated'](),controller[_0x8deb('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3558=['index','/describe','isAuthenticated','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get'];(function(_0x5b0fc9,_0x345838){var _0x25420e=function(_0x2ef1c2){while(--_0x2ef1c2){_0x5b0fc9['push'](_0x5b0fc9['shift']());}};_0x25420e(++_0x345838);}(_0x3558,0xaa));var _0x8355=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0x3558[_0x1d87fc];return _0x492b56;};'use strict';var multer=require(_0x8355('0x0'));var util=require(_0x8355('0x1'));var path=require(_0x8355('0x2'));var timeout=require(_0x8355('0x3'));var express=require(_0x8355('0x4'));var router=express[_0x8355('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8355('0x6'));var interaction=require(_0x8355('0x7'));var config=require('../../config/environment');var controller=require(_0x8355('0x8'));router[_0x8355('0x9')]('/',auth['isAuthenticated'](),controller[_0x8355('0xa')]);router[_0x8355('0x9')](_0x8355('0xb'),auth[_0x8355('0xc')](),controller['describe']);router[_0x8355('0x9')](_0x8355('0xd'),auth[_0x8355('0xc')](),controller[_0x8355('0xe')]);router[_0x8355('0xf')]('/',auth[_0x8355('0xc')](),controller[_0x8355('0x10')]);router['put'](_0x8355('0xd'),auth[_0x8355('0xc')](),controller['update']);router[_0x8355('0x11')](_0x8355('0xd'),auth[_0x8355('0xc')](),controller[_0x8355('0x12')]);module[_0x8355('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 6ece408..358018f 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x595e30,_0x1f0f9f){var _0x3bcd17=function(_0x4faeb){while(--_0x4faeb){_0x595e30['push'](_0x595e30['shift']());}};_0x3bcd17(++_0x1f0f9f);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x00bb[_0x5783f4];return _0x28e380;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x2254a5,_0x26d21c){var _0x3433b9=function(_0x407e94){while(--_0x407e94){_0x2254a5['push'](_0x2254a5['shift']());}};_0x3433b9(++_0x26d21c);}(_0xf4eb,0xec));var _0xbf4e=function(_0xbb0544,_0x4e46d7){_0xbb0544=_0xbb0544-0x0;var _0x4e6146=_0xf4eb[_0xbb0544];return _0x4e6146;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 11e6253..aee29e7 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 _0xdd10=['stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','ChatTransferReport','includeAll','include','rows','catch','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end'];(function(_0x4e2f0e,_0x59fedc){var _0x281145=function(_0x5fcce8){while(--_0x5fcce8){_0x4e2f0e['push'](_0x4e2f0e['shift']());}};_0x281145(++_0x59fedc);}(_0xdd10,0x6f));var _0x0dd1=function(_0x2ee0c1,_0x2355b2){_0x2ee0c1=_0x2ee0c1-0x0;var _0x5cfe33=_0xdd10[_0x2ee0c1];return _0x5cfe33;};'use strict';var emlformat=require(_0x0dd1('0x0'));var rimraf=require(_0x0dd1('0x1'));var zipdir=require(_0x0dd1('0x2'));var jsonpatch=require(_0x0dd1('0x3'));var rp=require(_0x0dd1('0x4'));var moment=require('moment');var BPromise=require(_0x0dd1('0x5'));var Mustache=require(_0x0dd1('0x6'));var util=require(_0x0dd1('0x7'));var path=require('path');var sox=require('sox');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(_0x0dd1('0xd'));var jsforce=require(_0x0dd1('0xe'));var deskjs=require(_0x0dd1('0xf'));var toCsv=require(_0x0dd1('0x8'));var querystring=require(_0x0dd1('0x10'));var Papa=require(_0x0dd1('0x11'));var Redis=require(_0x0dd1('0x12'));var authService=require(_0x0dd1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0dd1('0x14'));var hardwareService=require(_0x0dd1('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0dd1('0x16'));var licenseUtil=require(_0x0dd1('0x17'));var db=require(_0x0dd1('0x18'))['db'];function respondWithStatusCode(_0x536332,_0x5fed78){_0x5fed78=_0x5fed78||0xcc;return function(_0x30b433){if(_0x30b433){return _0x536332[_0x0dd1('0x19')](_0x5fed78);}return _0x536332[_0x0dd1('0x1a')](_0x5fed78)['end']();};}function respondWithResult(_0x320294,_0x21b6aa){_0x21b6aa=_0x21b6aa||0xc8;return function(_0x53eead){if(_0x53eead){return _0x320294['status'](_0x21b6aa)[_0x0dd1('0x1b')](_0x53eead);}};}function respondWithFilteredResult(_0x5b0836,_0x51c677){return function(_0x2c4274){if(_0x2c4274){var _0x443db5=typeof _0x51c677[_0x0dd1('0x1c')]==='undefined'&&typeof _0x51c677['limit']===_0x0dd1('0x1d');var _0x18d1aa=_0x2c4274['count'];var _0x42daa9=_0x443db5?0x0:_0x51c677[_0x0dd1('0x1c')];var _0xd2fa22=_0x443db5?_0x2c4274[_0x0dd1('0x1e')]:_0x51c677[_0x0dd1('0x1c')]+_0x51c677[_0x0dd1('0x1f')];var _0x3d4f54;if(_0xd2fa22>=_0x18d1aa){_0xd2fa22=_0x18d1aa;_0x3d4f54=0xc8;}else{_0x3d4f54=0xce;}_0x5b0836['status'](_0x3d4f54);return _0x5b0836[_0x0dd1('0x20')](_0x0dd1('0x21'),_0x42daa9+'-'+_0xd2fa22+'/'+_0x18d1aa)[_0x0dd1('0x1b')](_0x2c4274);}return null;};}function patchUpdates(_0x80d9fd){return function(_0x2422d2){try{jsonpatch[_0x0dd1('0x22')](_0x2422d2,_0x80d9fd,!![]);}catch(_0x5b351b){return BPromise[_0x0dd1('0x23')](_0x5b351b);}return _0x2422d2[_0x0dd1('0x24')]();};}function saveUpdates(_0x1b5377,_0x34a77c){return function(_0x13c6db){if(_0x13c6db){return _0x13c6db[_0x0dd1('0x25')](_0x1b5377)[_0x0dd1('0x26')](function(_0x4743d9){return _0x4743d9;});}return null;};}function removeEntity(_0x3e25f5,_0xd29cc){return function(_0x449ff3){if(_0x449ff3){return _0x449ff3[_0x0dd1('0x27')]()['then'](function(){_0x3e25f5[_0x0dd1('0x1a')](0xcc)[_0x0dd1('0x28')]();});}};}function handleEntityNotFound(_0x4f77a0,_0x3d5d8f){return function(_0x282613){if(!_0x282613){_0x4f77a0[_0x0dd1('0x19')](0x194);}return _0x282613;};}function handleError(_0x54d206,_0xd22cfb){_0xd22cfb=_0xd22cfb||0x1f4;return function(_0x4b1de8){logger['error'](_0x4b1de8[_0x0dd1('0x29')]);if(_0x4b1de8[_0x0dd1('0x2a')]){delete _0x4b1de8[_0x0dd1('0x2a')];}_0x54d206[_0x0dd1('0x1a')](_0xd22cfb)[_0x0dd1('0x2b')](_0x4b1de8);};}exports['index']=function(_0x507d78,_0x373fbe){var _0x5782b4={},_0x5068dc={},_0x1d9630={'count':0x0,'rows':[]};var _0xc1a64e=_[_0x0dd1('0x2c')](db['ChatTransferReport'][_0x0dd1('0x2d')],function(_0x4b198c){return{'name':_0x4b198c[_0x0dd1('0x2e')],'type':_0x4b198c[_0x0dd1('0x2f')][_0x0dd1('0x30')]};});_0x5068dc[_0x0dd1('0x31')]=_[_0x0dd1('0x2c')](_0xc1a64e,_0x0dd1('0x2a'));_0x5068dc['query']=_[_0x0dd1('0x32')](_0x507d78[_0x0dd1('0x33')]);_0x5068dc[_0x0dd1('0x34')]=_[_0x0dd1('0x35')](_0x5068dc[_0x0dd1('0x31')],_0x5068dc[_0x0dd1('0x33')]);_0x5782b4['attributes']=_[_0x0dd1('0x35')](_0x5068dc[_0x0dd1('0x31')],qs[_0x0dd1('0x36')](_0x507d78[_0x0dd1('0x33')][_0x0dd1('0x36')]));_0x5782b4[_0x0dd1('0x37')]=_0x5782b4[_0x0dd1('0x37')][_0x0dd1('0x38')]?_0x5782b4['attributes']:_0x5068dc[_0x0dd1('0x31')];if(!_0x507d78[_0x0dd1('0x33')][_0x0dd1('0x39')]('nolimit')){_0x5782b4[_0x0dd1('0x1f')]=qs[_0x0dd1('0x1f')](_0x507d78[_0x0dd1('0x33')][_0x0dd1('0x1f')]);_0x5782b4['offset']=qs['offset'](_0x507d78[_0x0dd1('0x33')][_0x0dd1('0x1c')]);}_0x5782b4[_0x0dd1('0x3a')]=qs[_0x0dd1('0x3b')](_0x507d78[_0x0dd1('0x33')][_0x0dd1('0x3b')]);_0x5782b4['where']=qs[_0x0dd1('0x34')](_[_0x0dd1('0x3c')](_0x507d78[_0x0dd1('0x33')],_0x5068dc[_0x0dd1('0x34')]),_0xc1a64e);if(_0x507d78[_0x0dd1('0x33')][_0x0dd1('0x3d')]){_0x5782b4[_0x0dd1('0x3e')]=_[_0x0dd1('0x3f')](_0x5782b4[_0x0dd1('0x3e')],{'$or':_[_0x0dd1('0x2c')](_0xc1a64e,function(_0x32fdd3){if(_0x32fdd3[_0x0dd1('0x2f')]!==_0x0dd1('0x40')){var _0xf87014={};_0xf87014[_0x32fdd3['name']]={'$like':'%'+_0x507d78[_0x0dd1('0x33')]['filter']+'%'};return _0xf87014;}})});}_0x5782b4=_[_0x0dd1('0x3f')]({},_0x5782b4,_0x507d78['options']);var _0x5dcc60={'where':_0x5782b4[_0x0dd1('0x3e')]};return db[_0x0dd1('0x41')][_0x0dd1('0x1e')](_0x5dcc60)[_0x0dd1('0x26')](function(_0x1c1cff){_0x1d9630[_0x0dd1('0x1e')]=_0x1c1cff;if(_0x507d78[_0x0dd1('0x33')][_0x0dd1('0x42')]){_0x5782b4[_0x0dd1('0x43')]=[{'all':!![]}];}return db[_0x0dd1('0x41')]['findAll'](_0x5782b4);})[_0x0dd1('0x26')](function(_0x204fba){_0x1d9630[_0x0dd1('0x44')]=_0x204fba;return _0x1d9630;})[_0x0dd1('0x26')](respondWithFilteredResult(_0x373fbe,_0x5782b4))[_0x0dd1('0x45')](handleError(_0x373fbe,null));};exports['show']=function(_0x1b99d6,_0x47ed90){var _0x2768da={'raw':!![],'where':{'id':_0x1b99d6['params']['id']}},_0x57ef34={};_0x57ef34['model']=_[_0x0dd1('0x32')](db[_0x0dd1('0x41')][_0x0dd1('0x2d')]);_0x57ef34[_0x0dd1('0x33')]=_['keys'](_0x1b99d6['query']);_0x57ef34['filters']=_[_0x0dd1('0x35')](_0x57ef34[_0x0dd1('0x31')],_0x57ef34[_0x0dd1('0x33')]);_0x2768da['attributes']=_[_0x0dd1('0x35')](_0x57ef34[_0x0dd1('0x31')],qs[_0x0dd1('0x36')](_0x1b99d6[_0x0dd1('0x33')][_0x0dd1('0x36')]));_0x2768da[_0x0dd1('0x37')]=_0x2768da[_0x0dd1('0x37')]['length']?_0x2768da[_0x0dd1('0x37')]:_0x57ef34[_0x0dd1('0x31')];if(_0x1b99d6[_0x0dd1('0x33')][_0x0dd1('0x42')]){_0x2768da[_0x0dd1('0x43')]=[{'all':!![]}];}_0x2768da=_[_0x0dd1('0x3f')]({},_0x2768da,_0x1b99d6[_0x0dd1('0x46')]);return db[_0x0dd1('0x41')][_0x0dd1('0x47')](_0x2768da)[_0x0dd1('0x26')](handleEntityNotFound(_0x47ed90,null))[_0x0dd1('0x26')](respondWithResult(_0x47ed90,null))[_0x0dd1('0x45')](handleError(_0x47ed90,null));};exports[_0x0dd1('0x48')]=function(_0x3b94d4,_0x290962){return db[_0x0dd1('0x41')][_0x0dd1('0x48')](_0x3b94d4[_0x0dd1('0x49')],{})[_0x0dd1('0x26')](respondWithResult(_0x290962,0xc9))['catch'](handleError(_0x290962,null));};exports[_0x0dd1('0x25')]=function(_0x51e3f3,_0x2dafa2){if(_0x51e3f3[_0x0dd1('0x49')]['id']){delete _0x51e3f3[_0x0dd1('0x49')]['id'];}return db[_0x0dd1('0x41')][_0x0dd1('0x47')]({'where':{'id':_0x51e3f3['params']['id']}})[_0x0dd1('0x26')](handleEntityNotFound(_0x2dafa2,null))['then'](saveUpdates(_0x51e3f3[_0x0dd1('0x49')],null))[_0x0dd1('0x26')](respondWithResult(_0x2dafa2,null))[_0x0dd1('0x45')](handleError(_0x2dafa2,null));};exports[_0x0dd1('0x27')]=function(_0x57f204,_0x4e3729){return db[_0x0dd1('0x41')]['find']({'where':{'id':_0x57f204[_0x0dd1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4e3729,null))[_0x0dd1('0x26')](removeEntity(_0x4e3729,null))[_0x0dd1('0x45')](handleError(_0x4e3729,null));};exports[_0x0dd1('0x4b')]=function(_0x1e0400,_0x21876c){return db['ChatTransferReport'][_0x0dd1('0x4b')]()[_0x0dd1('0x26')](respondWithResult(_0x21876c,null))[_0x0dd1('0x45')](handleError(_0x21876c,null));}; \ No newline at end of file +var _0xa1ff=['count','apply','reject','update','then','destroy','end','sendStatus','error','stack','name','send','map','ChatTransferReport','rawAttributes','type','key','query','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','options','includeAll','include','findAll','show','params','keys','length','merge','create','body','catch','find','describe','eml-format','zip-dir','fast-json-patch','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0xa1ff,0x101));var _0xfa1f=function(_0x483d79,_0x15706b){_0x483d79=_0x483d79-0x0;var _0x54b429=_0xa1ff[_0x483d79];return _0x54b429;};'use strict';var emlformat=require(_0xfa1f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfa1f('0x1'));var jsonpatch=require(_0xfa1f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfa1f('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xfa1f('0x4'));var csv=require(_0xfa1f('0x5'));var ejs=require(_0xfa1f('0x6'));var fs=require('fs');var fs_extra=require(_0xfa1f('0x7'));var _=require(_0xfa1f('0x8'));var squel=require(_0xfa1f('0x9'));var crypto=require('crypto');var jsforce=require(_0xfa1f('0xa'));var deskjs=require(_0xfa1f('0xb'));var toCsv=require('to-csv');var querystring=require(_0xfa1f('0xc'));var Papa=require(_0xfa1f('0xd'));var Redis=require('ioredis');var authService=require(_0xfa1f('0xe'));var qs=require(_0xfa1f('0xf'));var as=require(_0xfa1f('0x10'));var hardwareService=require(_0xfa1f('0x11'));var logger=require('../../config/logger')(_0xfa1f('0x12'));var utils=require(_0xfa1f('0x13'));var config=require(_0xfa1f('0x14'));var licenseUtil=require(_0xfa1f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f7b22,_0x428004){_0x428004=_0x428004||0xcc;return function(_0x3b03ac){if(_0x3b03ac){return _0x1f7b22['sendStatus'](_0x428004);}return _0x1f7b22[_0xfa1f('0x16')](_0x428004)['end']();};}function respondWithResult(_0x4df719,_0x11fd0f){_0x11fd0f=_0x11fd0f||0xc8;return function(_0x2b189b){if(_0x2b189b){return _0x4df719[_0xfa1f('0x16')](_0x11fd0f)[_0xfa1f('0x17')](_0x2b189b);}};}function respondWithFilteredResult(_0x4db318,_0x19c27d){return function(_0x3ba8a4){if(_0x3ba8a4){var _0x39e65e=typeof _0x19c27d[_0xfa1f('0x18')]===_0xfa1f('0x19')&&typeof _0x19c27d[_0xfa1f('0x1a')]===_0xfa1f('0x19');var _0x1793eb=_0x3ba8a4['count'];var _0x5816d4=_0x39e65e?0x0:_0x19c27d[_0xfa1f('0x18')];var _0x465785=_0x39e65e?_0x3ba8a4[_0xfa1f('0x1b')]:_0x19c27d[_0xfa1f('0x18')]+_0x19c27d[_0xfa1f('0x1a')];var _0x4537b3;if(_0x465785>=_0x1793eb){_0x465785=_0x1793eb;_0x4537b3=0xc8;}else{_0x4537b3=0xce;}_0x4db318['status'](_0x4537b3);return _0x4db318['set']('Content-Range',_0x5816d4+'-'+_0x465785+'/'+_0x1793eb)['json'](_0x3ba8a4);}return null;};}function patchUpdates(_0x2e15b3){return function(_0x10c661){try{jsonpatch[_0xfa1f('0x1c')](_0x10c661,_0x2e15b3,!![]);}catch(_0x54ff4a){return BPromise[_0xfa1f('0x1d')](_0x54ff4a);}return _0x10c661['save']();};}function saveUpdates(_0x1be753,_0x1c6a1a){return function(_0x40c435){if(_0x40c435){return _0x40c435[_0xfa1f('0x1e')](_0x1be753)[_0xfa1f('0x1f')](function(_0x2f9a43){return _0x2f9a43;});}return null;};}function removeEntity(_0x25a1e6,_0x52031d){return function(_0xb34751){if(_0xb34751){return _0xb34751[_0xfa1f('0x20')]()[_0xfa1f('0x1f')](function(){_0x25a1e6['status'](0xcc)[_0xfa1f('0x21')]();});}};}function handleEntityNotFound(_0x5d270c,_0xf062a9){return function(_0x4918c2){if(!_0x4918c2){_0x5d270c[_0xfa1f('0x22')](0x194);}return _0x4918c2;};}function handleError(_0x34e3e2,_0x82cfef){_0x82cfef=_0x82cfef||0x1f4;return function(_0x36143f){logger[_0xfa1f('0x23')](_0x36143f[_0xfa1f('0x24')]);if(_0x36143f['name']){delete _0x36143f[_0xfa1f('0x25')];}_0x34e3e2[_0xfa1f('0x16')](_0x82cfef)[_0xfa1f('0x26')](_0x36143f);};}exports['index']=function(_0xcd34fa,_0x1d2f1c){var _0x3f1877={},_0x4193f6={},_0x164d26={'count':0x0,'rows':[]};var _0x709ec5=_[_0xfa1f('0x27')](db[_0xfa1f('0x28')][_0xfa1f('0x29')],function(_0x51b352){return{'name':_0x51b352['fieldName'],'type':_0x51b352[_0xfa1f('0x2a')][_0xfa1f('0x2b')]};});_0x4193f6['model']=_[_0xfa1f('0x27')](_0x709ec5,'name');_0x4193f6[_0xfa1f('0x2c')]=_['keys'](_0xcd34fa[_0xfa1f('0x2c')]);_0x4193f6['filters']=_['intersection'](_0x4193f6[_0xfa1f('0x2d')],_0x4193f6[_0xfa1f('0x2c')]);_0x3f1877[_0xfa1f('0x2e')]=_[_0xfa1f('0x2f')](_0x4193f6['model'],qs[_0xfa1f('0x30')](_0xcd34fa[_0xfa1f('0x2c')][_0xfa1f('0x30')]));_0x3f1877[_0xfa1f('0x2e')]=_0x3f1877[_0xfa1f('0x2e')]['length']?_0x3f1877[_0xfa1f('0x2e')]:_0x4193f6[_0xfa1f('0x2d')];if(!_0xcd34fa['query'][_0xfa1f('0x31')](_0xfa1f('0x32'))){_0x3f1877[_0xfa1f('0x1a')]=qs[_0xfa1f('0x1a')](_0xcd34fa[_0xfa1f('0x2c')]['limit']);_0x3f1877['offset']=qs[_0xfa1f('0x18')](_0xcd34fa[_0xfa1f('0x2c')][_0xfa1f('0x18')]);}_0x3f1877[_0xfa1f('0x33')]=qs[_0xfa1f('0x34')](_0xcd34fa[_0xfa1f('0x2c')][_0xfa1f('0x34')]);_0x3f1877[_0xfa1f('0x35')]=qs[_0xfa1f('0x36')](_[_0xfa1f('0x37')](_0xcd34fa['query'],_0x4193f6[_0xfa1f('0x36')]),_0x709ec5);if(_0xcd34fa[_0xfa1f('0x2c')][_0xfa1f('0x38')]){_0x3f1877[_0xfa1f('0x35')]=_['merge'](_0x3f1877[_0xfa1f('0x35')],{'$or':_[_0xfa1f('0x27')](_0x709ec5,function(_0x2f85a6){if(_0x2f85a6['type']!=='VIRTUAL'){var _0x1c3054={};_0x1c3054[_0x2f85a6[_0xfa1f('0x25')]]={'$like':'%'+_0xcd34fa[_0xfa1f('0x2c')][_0xfa1f('0x38')]+'%'};return _0x1c3054;}})});}_0x3f1877=_['merge']({},_0x3f1877,_0xcd34fa[_0xfa1f('0x39')]);var _0x544189={'where':_0x3f1877[_0xfa1f('0x35')]};return db[_0xfa1f('0x28')]['count'](_0x544189)[_0xfa1f('0x1f')](function(_0xdd78b9){_0x164d26[_0xfa1f('0x1b')]=_0xdd78b9;if(_0xcd34fa[_0xfa1f('0x2c')][_0xfa1f('0x3a')]){_0x3f1877[_0xfa1f('0x3b')]=[{'all':!![]}];}return db[_0xfa1f('0x28')][_0xfa1f('0x3c')](_0x3f1877);})[_0xfa1f('0x1f')](function(_0x253e4b){_0x164d26['rows']=_0x253e4b;return _0x164d26;})['then'](respondWithFilteredResult(_0x1d2f1c,_0x3f1877))['catch'](handleError(_0x1d2f1c,null));};exports[_0xfa1f('0x3d')]=function(_0x496240,_0x1515ef){var _0x405b8c={'raw':!![],'where':{'id':_0x496240[_0xfa1f('0x3e')]['id']}},_0x3cb5f7={};_0x3cb5f7[_0xfa1f('0x2d')]=_[_0xfa1f('0x3f')](db['ChatTransferReport'][_0xfa1f('0x29')]);_0x3cb5f7[_0xfa1f('0x2c')]=_[_0xfa1f('0x3f')](_0x496240[_0xfa1f('0x2c')]);_0x3cb5f7[_0xfa1f('0x36')]=_[_0xfa1f('0x2f')](_0x3cb5f7[_0xfa1f('0x2d')],_0x3cb5f7[_0xfa1f('0x2c')]);_0x405b8c[_0xfa1f('0x2e')]=_[_0xfa1f('0x2f')](_0x3cb5f7[_0xfa1f('0x2d')],qs[_0xfa1f('0x30')](_0x496240[_0xfa1f('0x2c')][_0xfa1f('0x30')]));_0x405b8c['attributes']=_0x405b8c[_0xfa1f('0x2e')][_0xfa1f('0x40')]?_0x405b8c[_0xfa1f('0x2e')]:_0x3cb5f7['model'];if(_0x496240[_0xfa1f('0x2c')][_0xfa1f('0x3a')]){_0x405b8c[_0xfa1f('0x3b')]=[{'all':!![]}];}_0x405b8c=_[_0xfa1f('0x41')]({},_0x405b8c,_0x496240[_0xfa1f('0x39')]);return db[_0xfa1f('0x28')]['find'](_0x405b8c)[_0xfa1f('0x1f')](handleEntityNotFound(_0x1515ef,null))[_0xfa1f('0x1f')](respondWithResult(_0x1515ef,null))['catch'](handleError(_0x1515ef,null));};exports[_0xfa1f('0x42')]=function(_0x2e52b9,_0x4f3727){return db[_0xfa1f('0x28')][_0xfa1f('0x42')](_0x2e52b9[_0xfa1f('0x43')],{})['then'](respondWithResult(_0x4f3727,0xc9))[_0xfa1f('0x44')](handleError(_0x4f3727,null));};exports[_0xfa1f('0x1e')]=function(_0x5b2ab9,_0x22a32b){if(_0x5b2ab9[_0xfa1f('0x43')]['id']){delete _0x5b2ab9[_0xfa1f('0x43')]['id'];}return db['ChatTransferReport'][_0xfa1f('0x45')]({'where':{'id':_0x5b2ab9[_0xfa1f('0x3e')]['id']}})[_0xfa1f('0x1f')](handleEntityNotFound(_0x22a32b,null))[_0xfa1f('0x1f')](saveUpdates(_0x5b2ab9[_0xfa1f('0x43')],null))[_0xfa1f('0x1f')](respondWithResult(_0x22a32b,null))[_0xfa1f('0x44')](handleError(_0x22a32b,null));};exports[_0xfa1f('0x20')]=function(_0x1754a8,_0x391bcc){return db[_0xfa1f('0x28')][_0xfa1f('0x45')]({'where':{'id':_0x1754a8[_0xfa1f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x391bcc,null))['then'](removeEntity(_0x391bcc,null))[_0xfa1f('0x44')](handleError(_0x391bcc,null));};exports[_0xfa1f('0x46')]=function(_0x5bf2bb,_0x5baa9e){return db[_0xfa1f('0x28')][_0xfa1f('0x46')]()[_0xfa1f('0x1f')](respondWithResult(_0x5baa9e,null))[_0xfa1f('0x44')](handleError(_0x5baa9e,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 71ac0f2..1977cfb 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 _0x70d6=['bluebird','request-promise','path','../../config/environment','define','uniqueid','lodash','util','../../config/logger','api'];(function(_0xeb56e0,_0x242ed0){var _0xc9e71d=function(_0x33f60c){while(--_0x33f60c){_0xeb56e0['push'](_0xeb56e0['shift']());}};_0xc9e71d(++_0x242ed0);}(_0x70d6,0x10a));var _0x670d=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x70d6[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x670d('0x0'));var util=require(_0x670d('0x1'));var logger=require(_0x670d('0x2'))(_0x670d('0x3'));var moment=require('moment');var BPromise=require(_0x670d('0x4'));var rp=require(_0x670d('0x5'));var fs=require('fs');var path=require(_0x670d('0x6'));var rimraf=require('rimraf');var config=require(_0x670d('0x7'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x5b2432,_0xc951b2){return _0x5b2432[_0x670d('0x8')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x670d('0x9'),'fields':[_0x670d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb62=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','define','report_chat_transfer','uniqueid'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xcb62,0x108));var _0x2cb6=function(_0x38b6c7,_0x3b8628){_0x38b6c7=_0x38b6c7-0x0;var _0x18cead=_0xcb62[_0x38b6c7];return _0x18cead;};'use strict';var _=require('lodash');var util=require(_0x2cb6('0x0'));var logger=require(_0x2cb6('0x1'))(_0x2cb6('0x2'));var moment=require('moment');var BPromise=require(_0x2cb6('0x3'));var rp=require(_0x2cb6('0x4'));var fs=require('fs');var path=require(_0x2cb6('0x5'));var rimraf=require(_0x2cb6('0x6'));var config=require(_0x2cb6('0x7'));var attributes=require(_0x2cb6('0x8'));module['exports']=function(_0x3250dc,_0x26c373){return _0x3250dc[_0x2cb6('0x9')]('ChatTransferReport',attributes,{'tableName':_0x2cb6('0xa'),'paranoid':![],'indexes':[{'name':_0x2cb6('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 5b229d2..2cdf08e 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 _0xedbb=['debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4b34f0,_0x5913dd){var _0x2fa2d2=function(_0x23da5c){while(--_0x23da5c){_0x4b34f0['push'](_0x4b34f0['shift']());}};_0x2fa2d2(++_0x5913dd);}(_0xedbb,0x150));var _0xbedb=function(_0x4966b8,_0x45cb3f){_0x4966b8=_0x4966b8-0x0;var _0x311109=_0xedbb[_0x4966b8];return _0x311109;};'use strict';var _=require(_0xbedb('0x0'));var util=require(_0xbedb('0x1'));var moment=require(_0xbedb('0x2'));var BPromise=require(_0xbedb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbedb('0x4'));var db=require(_0xbedb('0x5'))['db'];var utils=require(_0xbedb('0x6'));var logger=require(_0xbedb('0x7'))('rpc');var config=require(_0xbedb('0x8'));var jayson=require(_0xbedb('0x9'));var client=jayson[_0xbedb('0xa')][_0xbedb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24056e,_0x348cc0,_0x1629b6){return new BPromise(function(_0x1021a1,_0x19487c){return client['request'](_0x24056e,_0x1629b6)[_0xbedb('0xc')](function(_0x5508c8){logger[_0xbedb('0xd')](_0xbedb('0xe'),_0x348cc0,_0xbedb('0xf'));logger[_0xbedb('0x10')](_0xbedb('0x11'),_0x348cc0,_0xbedb('0xf'),JSON['stringify'](_0x5508c8));if(_0x5508c8[_0xbedb('0x12')]){if(_0x5508c8[_0xbedb('0x12')][_0xbedb('0x13')]===0x1f4){logger[_0xbedb('0x12')](_0xbedb('0xe'),_0x348cc0,_0x5508c8['error'][_0xbedb('0x14')]);return _0x19487c(_0x5508c8[_0xbedb('0x12')]['message']);}logger['error'](_0xbedb('0xe'),_0x348cc0,_0x5508c8[_0xbedb('0x12')][_0xbedb('0x14')]);return _0x1021a1(_0x5508c8[_0xbedb('0x12')][_0xbedb('0x14')]);}else{logger[_0xbedb('0xd')](_0xbedb('0xe'),_0x348cc0,_0xbedb('0xf'));_0x1021a1(_0x5508c8['result']['message']);}})[_0xbedb('0x15')](function(_0x3d812b){logger[_0xbedb('0x12')](_0xbedb('0xe'),_0x348cc0,_0x3d812b);_0x19487c(_0x3d812b);});});} \ No newline at end of file +var _0x5ff2=['lodash','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2513c7,_0x30ca8f){var _0x51d34b=function(_0x35937e){while(--_0x35937e){_0x2513c7['push'](_0x2513c7['shift']());}};_0x51d34b(++_0x30ca8f);}(_0x5ff2,0x17c));var _0x25ff=function(_0x5c7e53,_0x174ce5){_0x5c7e53=_0x5c7e53-0x0;var _0x1c9af9=_0x5ff2[_0x5c7e53];return _0x1c9af9;};'use strict';var _=require(_0x25ff('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25ff('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x25ff('0x2'))(_0x25ff('0x3'));var config=require(_0x25ff('0x4'));var jayson=require(_0x25ff('0x5'));var client=jayson['client'][_0x25ff('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x306dba,_0x1b0fed,_0x17f85e){return new BPromise(function(_0x18e00c,_0x31912b){return client[_0x25ff('0x7')](_0x306dba,_0x17f85e)['then'](function(_0x3ea5d2){logger[_0x25ff('0x8')](_0x25ff('0x9'),_0x1b0fed,_0x25ff('0xa'));logger[_0x25ff('0xb')](_0x25ff('0xc'),_0x1b0fed,'request\x20sent',JSON[_0x25ff('0xd')](_0x3ea5d2));if(_0x3ea5d2[_0x25ff('0xe')]){if(_0x3ea5d2[_0x25ff('0xe')][_0x25ff('0xf')]===0x1f4){logger[_0x25ff('0xe')](_0x25ff('0x9'),_0x1b0fed,_0x3ea5d2[_0x25ff('0xe')][_0x25ff('0x10')]);return _0x31912b(_0x3ea5d2[_0x25ff('0xe')][_0x25ff('0x10')]);}logger['error'](_0x25ff('0x9'),_0x1b0fed,_0x3ea5d2[_0x25ff('0xe')][_0x25ff('0x10')]);return _0x18e00c(_0x3ea5d2[_0x25ff('0xe')][_0x25ff('0x10')]);}else{logger['info'](_0x25ff('0x9'),_0x1b0fed,_0x25ff('0xa'));_0x18e00c(_0x3ea5d2[_0x25ff('0x11')]['message']);}})[_0x25ff('0x12')](function(_0x506eb8){logger[_0x25ff('0xe')]('ChatTransferReport,\x20%s,\x20%s',_0x1b0fed,_0x506eb8);_0x31912b(_0x506eb8);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 3c41841..d55f277 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 _0xbbfc=['delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put'];(function(_0x2aa727,_0x396eb6){var _0x286d36=function(_0x13318f){while(--_0x13318f){_0x2aa727['push'](_0x2aa727['shift']());}};_0x286d36(++_0x396eb6);}(_0xbbfc,0x17f));var _0xcbbf=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xbbfc[_0x377a6e];return _0x37f751;};'use strict';var multer=require(_0xcbbf('0x0'));var util=require('util');var path=require(_0xcbbf('0x1'));var timeout=require('connect-timeout');var express=require(_0xcbbf('0x2'));var router=express[_0xcbbf('0x3')]();var fs_extra=require(_0xcbbf('0x4'));var auth=require(_0xcbbf('0x5'));var interaction=require(_0xcbbf('0x6'));var config=require(_0xcbbf('0x7'));var controller=require(_0xcbbf('0x8'));router['get']('/',auth[_0xcbbf('0x9')](),controller[_0xcbbf('0xa')]);router[_0xcbbf('0xb')](_0xcbbf('0xc'),auth[_0xcbbf('0x9')](),controller[_0xcbbf('0xd')]);router[_0xcbbf('0xb')](_0xcbbf('0xe'),auth[_0xcbbf('0x9')](),controller[_0xcbbf('0xf')]);router['post']('/',auth[_0xcbbf('0x9')](),controller['create']);router[_0xcbbf('0x10')](_0xcbbf('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xcbbf('0x11')](_0xcbbf('0xe'),auth[_0xcbbf('0x9')](),controller[_0xcbbf('0x12')]);module[_0xcbbf('0x13')]=router; \ No newline at end of file +var _0x7bec=['index','/describe','isAuthenticated','describe','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get'];(function(_0x35e75a,_0x5ed225){var _0xb23c7f=function(_0x2fa40c){while(--_0x2fa40c){_0x35e75a['push'](_0x35e75a['shift']());}};_0xb23c7f(++_0x5ed225);}(_0x7bec,0x19a));var _0xc7be=function(_0x1ba894,_0x1bdcdd){_0x1ba894=_0x1ba894-0x0;var _0x1e705d=_0x7bec[_0x1ba894];return _0x1e705d;};'use strict';var multer=require(_0xc7be('0x0'));var util=require(_0xc7be('0x1'));var path=require(_0xc7be('0x2'));var timeout=require(_0xc7be('0x3'));var express=require(_0xc7be('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc7be('0x5'));var interaction=require(_0xc7be('0x6'));var config=require(_0xc7be('0x7'));var controller=require(_0xc7be('0x8'));router[_0xc7be('0x9')]('/',auth['isAuthenticated'](),controller[_0xc7be('0xa')]);router[_0xc7be('0x9')](_0xc7be('0xb'),auth[_0xc7be('0xc')](),controller[_0xc7be('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc7be('0xe')]('/',auth[_0xc7be('0xc')](),controller['create']);router[_0xc7be('0xf')](_0xc7be('0x10'),auth[_0xc7be('0xc')](),controller[_0xc7be('0x11')]);router[_0xc7be('0x12')](_0xc7be('0x10'),auth[_0xc7be('0xc')](),controller[_0xc7be('0x13')]);module[_0xc7be('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index a21425d..de00ded 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 _0x55e0=['CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','stringify','name','text','input','getDataValue','onlineForm','parse','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right'];(function(_0x508e2a,_0x392ea1){var _0x18f170=function(_0x4047fc){while(--_0x4047fc){_0x508e2a['push'](_0x508e2a['shift']());}};_0x18f170(++_0x392ea1);}(_0x55e0,0xdc));var _0x055e=function(_0x5340fb,_0x53d5a2){_0x5340fb=_0x5340fb-0x0;var _0x35701e=_0x55e0[_0x5340fb];return _0x35701e;};'use strict';var Sequelize=require(_0x055e('0x0'));var rs=require(_0x055e('0x1'));module[_0x055e('0x2')]={'name':{'type':Sequelize[_0x055e('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x055e('0x3')]},'mapKey':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x4')},'mapKeyOffline':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x4')},'key':{'type':Sequelize[_0x055e('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x055e('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x055e('0x3')]},'animation':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x055e('0x9')]('rounded','squared'),'defaultValue':_0x055e('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0xb')},'start_chat_button':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xc')},'offline_chat_button':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'header_offline':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x055e('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x13')},'noteTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x14')},'placeholderMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x16')},'closingMessageButton':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'skipMessageButton':{'type':Sequelize[_0x055e('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x17')},'ratingType':{'type':Sequelize[_0x055e('0x9')](_0x055e('0x18'),_0x055e('0x19')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return JSON[_0x055e('0x1a')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x055e('0x1b'),'type':_0x055e('0x1c'),'required':!![]},'props':{'title':_0x055e('0x1b'),'helpText':''}},{'type':_0x055e('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x055e('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x055e('0x1e')](_0x055e('0x1f'))?JSON[_0x055e('0x20')](this[_0x055e('0x1e')](_0x055e('0x1f'))):{};},'set':function(_0x4c653c){return this['setDataValue'](_0x055e('0x1f'),JSON[_0x055e('0x1a')](_0x4c653c));}},'offlineForm':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x055e('0x1d'),'props':{'title':_0x055e('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x055e('0x4'),'type':_0x055e('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x055e('0x21')},'props':{'title':'Comments','helpText':_0x055e('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x055e('0x1e')](_0x055e('0x23'))?JSON[_0x055e('0x20')](this[_0x055e('0x1e')]('offlineForm')):{};},'set':function(_0x99a372){return this[_0x055e('0x24')](_0x055e('0x23'),JSON[_0x055e('0x1a')](_0x99a372));}},'token':{'type':Sequelize[_0x055e('0x3')],'defaultValue':function(){return rs[_0x055e('0x25')]();}},'autoclose':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x055e('0x3')]},'forwardOffline':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x26')},'waitingMessage':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x29')},'sendUnmanaged':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x055e('0x10')]},'showAgentAvatar':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x055e('0x3')]},'notificationTemplate':{'type':Sequelize[_0x055e('0x10')],'defaultValue':function(){return _0x055e('0x2a');}},'notificationSound':{'type':Sequelize[_0x055e('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x055e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x2c')},'verticalAlignment':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x055e('0x3')],'defaultValue':_0x055e('0x2d')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x2e')},'defaultTitle':{'type':Sequelize[_0x055e('0x3')]},'customerAvatar':{'type':Sequelize[_0x055e('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x055e('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x055e('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x055e('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x055e('0x30')},'systemAvatar':{'type':Sequelize[_0x055e('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x055e('0x31')},'mandatoryDisposition':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1012a4){if(!_0x1012a4)this[_0x055e('0x24')](_0x055e('0x32'),null);this['setDataValue'](_0x055e('0x33'),_0x1012a4);}},'vidaooEscalation':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x055e('0x3')],'allowNull':![],'defaultValue':_0x055e('0x34')},'vidaooNote':{'type':Sequelize[_0x055e('0x3')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0x055e('0x10')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x055e('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x055e('0x10')]}}; \ No newline at end of file +var _0x0713=['offlineForm','setDataValue','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','thumb','star','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x3071('0x0')]={'name':{'type':Sequelize[_0x3071('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x3071('0x1')],'allowNull':![],'unique':_0x3071('0x2')},'description':{'type':Sequelize[_0x3071('0x1')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x3')},'mapKeyOffline':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x3')},'key':{'type':Sequelize[_0x3071('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x4')},'customerAlias':{'type':Sequelize[_0x3071('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x3071('0x1')],'allowNull':![],'defaultValue':_0x3071('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x3071('0x1')],'allowNull':![],'defaultValue':_0x3071('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x3071('0x1')],'allowNull':![],'defaultValue':_0x3071('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3071('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x3071('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x3071('0x1')]},'animation':{'type':Sequelize[_0x3071('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3071('0x9')]('rounded',_0x3071('0xa')),'defaultValue':_0x3071('0xb')},'header_online':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0xc')},'start_chat_button':{'type':Sequelize[_0x3071('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0xd')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0xe')},'download_transcript':{'type':Sequelize[_0x3071('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x3071('0x1')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x3071('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x3071('0xf')]},'closingQuestion':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x12')},'noteTitle':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x14')},'closingMessage':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x15')},'closingMessageButton':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0xd')},'skipMessageButton':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x16')},'conditionAgreement':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x3071('0x1')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x3071('0x9')]('star',_0x3071('0x17')),'defaultValue':_0x3071('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x3071('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x3071('0xf')],'defaultValue':function(){return JSON[_0x3071('0x19')]({'items':[{'type':_0x3071('0x1a'),'variable':null,'config':{'placeholder':_0x3071('0x1b'),'type':_0x3071('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':_0x3071('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x3071('0x3'),'type':_0x3071('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x3071('0x1d')](_0x3071('0x1e'))?JSON[_0x3071('0x1f')](this[_0x3071('0x1d')](_0x3071('0x1e'))):{};},'set':function(_0x1de5fb){return this['setDataValue'](_0x3071('0x1e'),JSON[_0x3071('0x19')](_0x1de5fb));}},'offlineForm':{'type':Sequelize[_0x3071('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x3071('0x1a'),'props':{'title':_0x3071('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x3071('0x3'),'type':_0x3071('0x3')},'variable':null},{'type':_0x3071('0x20'),'config':{'placeholder':_0x3071('0x21')},'props':{'title':_0x3071('0x21'),'helpText':_0x3071('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x3071('0x1d')](_0x3071('0x23'))?JSON[_0x3071('0x1f')](this['getDataValue']('offlineForm')):{};},'set':function(_0x9e26d1){return this[_0x3071('0x24')](_0x3071('0x23'),JSON[_0x3071('0x19')](_0x9e26d1));}},'token':{'type':Sequelize[_0x3071('0x1')],'defaultValue':function(){return rs[_0x3071('0x25')]();}},'autoclose':{'type':Sequelize[_0x3071('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x3071('0x1')]},'waitingTitle':{'type':Sequelize[_0x3071('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x27')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x3071('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x29')},'skipUnmanaged':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x16')},'sendUnmanaged':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0xd')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x3071('0x1')]},'notificationTemplate':{'type':Sequelize[_0x3071('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x3071('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x3071('0x1')],'defaultValue':_0x3071('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0x3071('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x2b')},'verticalAlignment':{'type':Sequelize[_0x3071('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x2c')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x2d')},'defaultTitle':{'type':Sequelize[_0x3071('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x3071('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x3071('0x1')],'allowNull':![],'defaultValue':_0x3071('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3071('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3071('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x3071('0x2f')},'systemAvatar':{'type':Sequelize[_0x3071('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3071('0x7')],'comment':_0x3071('0x30')},'mandatoryDisposition':{'type':Sequelize[_0x3071('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x53ed25){if(!_0x53ed25)this[_0x3071('0x24')](_0x3071('0x31'),null);this[_0x3071('0x24')](_0x3071('0x32'),_0x53ed25);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x3071('0x1')]},'vidaooTopic':{'type':Sequelize[_0x3071('0x1')],'allowNull':![],'defaultValue':_0x3071('0x33')},'vidaooNote':{'type':Sequelize[_0x3071('0x1')],'defaultValue':function(){return _0x3071('0x34');}},'vidaooMetadata':{'type':Sequelize[_0x3071('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x3071('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 070495b..8a0a634 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 _0x9f6a=['keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','show','params','intersection','include','find','create','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','sitepic','addAvatar','agentAvatar','file','filename','addCustomerAvatar','addSystemAvatar','getLogo','join','root','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','customerAvatar','showCustomerAvatar','getSystemAvatar','systemAvatar','notify','user-agent-parser','setUA','headers','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','customerIp','cf-connecting-ip','x-forwarded-for','first','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','threadId','externalUrl','ChatInteraction','ContactId','interaction','contact','firstName','messageId','created','autoclose','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','*,*,*,*','Start','startRouting','EventManager','files','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','basename','sequelize','Attachment','bulkCreate','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','subjectOffline','mapValues','offlineMessageSubject','Chat','notifyMail','server','attachments','offline-chat','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)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','increment','push','all','server/files/chat/iframe.ejs','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','IntervalId','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','removeAgents','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','ejs','fs-extra','lodash','querystring','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','update','destroy','get','ChatWebsites','end','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','model'];(function(_0x36c4bb,_0x287df6){var _0x37846b=function(_0x4b3c0f){while(--_0x4b3c0f){_0x36c4bb['push'](_0x36c4bb['shift']());}};_0x37846b(++_0x287df6);}(_0x9f6a,0xe8));var _0xa9f6=function(_0x1fc18b,_0x13d27d){_0x1fc18b=_0x1fc18b-0x0;var _0x16a351=_0x9f6a[_0x1fc18b];return _0x16a351;};'use strict';var BPromise=require(_0xa9f6('0x0'));var Mustache=require(_0xa9f6('0x1'));var util=require(_0xa9f6('0x2'));var path=require(_0xa9f6('0x3'));var ejs=require(_0xa9f6('0x4'));var fs=require('fs');var fs_extra=require(_0xa9f6('0x5'));var _=require(_0xa9f6('0x6'));var querystring=require(_0xa9f6('0x7'));var Redis=require(_0xa9f6('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0xa9f6('0x9'))(_0xa9f6('0xa'));var config=require(_0xa9f6('0xb'));var db=require(_0xa9f6('0xc'))['db'];config[_0xa9f6('0xd')]=_[_0xa9f6('0xe')](config['redis'],{'host':_0xa9f6('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa9f6('0xd')]));require(_0xa9f6('0x10'))[_0xa9f6('0x11')](socket);var htmlToText=require(_0xa9f6('0x12'));var jayson=require(_0xa9f6('0x13'));var client=jayson[_0xa9f6('0x14')][_0xa9f6('0x15')]({'port':0x232c});var client9002=jayson[_0xa9f6('0x14')][_0xa9f6('0x15')]({'port':0x232a});var client9003=jayson[_0xa9f6('0x14')][_0xa9f6('0x15')]({'port':0x232b});var client9001=jayson[_0xa9f6('0x14')][_0xa9f6('0x15')]({'port':0x2329});function respondWithRpcPromise(_0x331618,_0x40cf72,_0x3b8a8b,_0x597a51){return new BPromise(function(_0x2b896e,_0x1026e8){var _0x31f99b=_0x597a51||client;return _0x31f99b[_0xa9f6('0x16')](_0x331618,_0x3b8a8b)[_0xa9f6('0x17')](function(_0x5fb15a){logger[_0xa9f6('0x18')](_0xa9f6('0x19'),_0x40cf72,_0xa9f6('0x1a'));logger['debug'](_0xa9f6('0x1b'),_0x40cf72,'request\x20sent',JSON[_0xa9f6('0x1c')](_0x5fb15a));if(_0x5fb15a['error']){if(_0x5fb15a[_0xa9f6('0x1d')][_0xa9f6('0x1e')]===0x1f4){logger[_0xa9f6('0x1d')](_0xa9f6('0x19'),_0x40cf72,_0x5fb15a[_0xa9f6('0x1d')][_0xa9f6('0x1f')]);return _0x1026e8(_0x5fb15a[_0xa9f6('0x1d')][_0xa9f6('0x1f')]);}logger[_0xa9f6('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x40cf72,_0x5fb15a[_0xa9f6('0x1d')][_0xa9f6('0x1f')]);return _0x2b896e(_0x5fb15a['error'][_0xa9f6('0x1f')]);}else{logger['info'](_0xa9f6('0x19'),_0x40cf72,_0xa9f6('0x1a'));_0x2b896e(_0x5fb15a[_0xa9f6('0x20')]['message']);}})[_0xa9f6('0x21')](function(_0x29ab13){logger[_0xa9f6('0x1d')](_0xa9f6('0x19'),_0x40cf72,_0x29ab13);_0x1026e8(_0x29ab13);});});}function respondWithStatusCode(_0x48af38,_0x2ea271){_0x2ea271=_0x2ea271||0xcc;return function(_0xe128dc){if(_0xe128dc){return _0x48af38[_0xa9f6('0x22')](_0x2ea271);}return _0x48af38[_0xa9f6('0x23')](_0x2ea271)['end']();};}function respondWithResult(_0x35aa70,_0x487718){_0x487718=_0x487718||0xc8;return function(_0x57809a){if(_0x57809a){return _0x35aa70[_0xa9f6('0x23')](_0x487718)[_0xa9f6('0x24')](_0x57809a);}};}function respondWithFilteredResult(_0x5cdf92,_0x514a12){return function(_0x5d90d2){if(_0x5d90d2){var _0xc85ca8=typeof _0x514a12[_0xa9f6('0x25')]===_0xa9f6('0x26')&&typeof _0x514a12[_0xa9f6('0x27')]===_0xa9f6('0x26');var _0x479633=_0x5d90d2['count'];var _0x39194f=_0xc85ca8?0x0:_0x514a12[_0xa9f6('0x25')];var _0x51b5b4=_0xc85ca8?_0x5d90d2[_0xa9f6('0x28')]:_0x514a12[_0xa9f6('0x25')]+_0x514a12[_0xa9f6('0x27')];var _0x52a896;if(_0x51b5b4>=_0x479633){_0x51b5b4=_0x479633;_0x52a896=0xc8;}else{_0x52a896=0xce;}_0x5cdf92[_0xa9f6('0x23')](_0x52a896);return _0x5cdf92['set']('Content-Range',_0x39194f+'-'+_0x51b5b4+'/'+_0x479633)['json'](_0x5d90d2);}return null;};}function saveUpdates(_0x44de2e){return function(_0x2482c6){if(_0x2482c6){return _0x2482c6[_0xa9f6('0x29')](_0x44de2e)[_0xa9f6('0x17')](function(_0x1ddf8f){return _0x1ddf8f;});}return null;};}function removeEntity(_0x2d1119){return function(_0x15b349){if(_0x15b349){return _0x15b349[_0xa9f6('0x2a')]()[_0xa9f6('0x17')](function(){var _0xed4602=_0x15b349[_0xa9f6('0x2b')]({'plain':!![]});var _0x4383d9=_0xa9f6('0x2c');return db['UserProfileResource'][_0xa9f6('0x2a')]({'where':{'type':_0x4383d9,'resourceId':_0xed4602['id']}})[_0xa9f6('0x17')](function(){return _0x15b349;});})[_0xa9f6('0x17')](function(){_0x2d1119[_0xa9f6('0x23')](0xcc)[_0xa9f6('0x2d')]();});}};}function handleEntityNotFound(_0x419c99){return function(_0x216995){if(!_0x216995){_0x419c99['sendStatus'](0x194);}return _0x216995;};}function handleError(_0x44349f,_0x2bfefd){_0x2bfefd=_0x2bfefd||0x1f4;return function(_0x71f0e5){logger[_0xa9f6('0x1d')](_0x71f0e5[_0xa9f6('0x2e')]);if(_0x71f0e5[_0xa9f6('0x2f')]){delete _0x71f0e5['name'];}_0x44349f[_0xa9f6('0x23')](_0x2bfefd)['send'](_0x71f0e5);};}exports[_0xa9f6('0x30')]=function(_0x36b222,_0xbd44f1){var _0x221151={'include':[{'model':db[_0xa9f6('0x31')],'as':_0xa9f6('0x32')}]},_0x419264={},_0x43f05a={'count':0x0,'rows':[]};var _0x26e22b=_[_0xa9f6('0x33')](db[_0xa9f6('0x34')][_0xa9f6('0x35')],function(_0x537aeb){return{'name':_0x537aeb[_0xa9f6('0x36')],'type':_0x537aeb[_0xa9f6('0x37')]['key']};});_0x419264[_0xa9f6('0x38')]=_[_0xa9f6('0x33')](_0x26e22b,_0xa9f6('0x2f'));_0x419264['query']=_[_0xa9f6('0x39')](_0x36b222[_0xa9f6('0x3a')]);_0x419264[_0xa9f6('0x3b')]=_['intersection'](_0x419264[_0xa9f6('0x38')],_0x419264[_0xa9f6('0x3a')]);_0x221151[_0xa9f6('0x3c')]=_['intersection'](_0x419264[_0xa9f6('0x38')],qs[_0xa9f6('0x3d')](_0x36b222['query'][_0xa9f6('0x3d')]));_0x221151[_0xa9f6('0x3c')]=_0x221151[_0xa9f6('0x3c')][_0xa9f6('0x3e')]?_0x221151[_0xa9f6('0x3c')]:_0x419264[_0xa9f6('0x38')];if(!_0x36b222[_0xa9f6('0x3a')][_0xa9f6('0x3f')](_0xa9f6('0x40'))){_0x221151['limit']=qs[_0xa9f6('0x27')](_0x36b222['query'][_0xa9f6('0x27')]);_0x221151[_0xa9f6('0x25')]=qs[_0xa9f6('0x25')](_0x36b222['query'][_0xa9f6('0x25')]);}_0x221151[_0xa9f6('0x41')]=qs['sort'](_0x36b222[_0xa9f6('0x3a')][_0xa9f6('0x42')]);_0x221151[_0xa9f6('0x43')]=qs[_0xa9f6('0x3b')](_[_0xa9f6('0x44')](_0x36b222[_0xa9f6('0x3a')],_0x419264[_0xa9f6('0x3b')]),_0x26e22b);if(_0x36b222['query'][_0xa9f6('0x45')]){_0x221151[_0xa9f6('0x43')]=_['merge'](_0x221151[_0xa9f6('0x43')],{'$or':_['map'](_0x26e22b,function(_0x5b296a){if(_0x5b296a[_0xa9f6('0x37')]!=='VIRTUAL'){var _0x229bdf={};_0x229bdf[_0x5b296a[_0xa9f6('0x2f')]]={'$like':'%'+_0x36b222['query'][_0xa9f6('0x45')]+'%'};return _0x229bdf;}})});}_0x221151=_[_0xa9f6('0x46')]({},_0x221151,_0x36b222[_0xa9f6('0x47')]);var _0x1ec70e={'where':_0x221151[_0xa9f6('0x43')]};return db[_0xa9f6('0x34')]['count'](_0x1ec70e)['then'](function(_0x356ba4){_0x43f05a[_0xa9f6('0x28')]=_0x356ba4;if(_0x36b222[_0xa9f6('0x3a')][_0xa9f6('0x48')]){_0x221151['include']=[{'all':!![]}];}return db[_0xa9f6('0x34')][_0xa9f6('0x49')](_0x221151);})[_0xa9f6('0x17')](function(_0x406efb){_0x43f05a['rows']=_0x406efb;return _0x43f05a;})['then'](respondWithFilteredResult(_0xbd44f1,_0x221151))[_0xa9f6('0x21')](handleError(_0xbd44f1,null));};exports[_0xa9f6('0x4a')]=function(_0x33b980,_0x8e3724){var _0x5941c6={'raw':![],'where':{'id':_0x33b980[_0xa9f6('0x4b')]['id']},'include':[{'model':db[_0xa9f6('0x31')],'as':_0xa9f6('0x32')}]},_0x449db3={};_0x449db3[_0xa9f6('0x38')]=_[_0xa9f6('0x39')](db['ChatWebsite'][_0xa9f6('0x35')]);_0x449db3['query']=_[_0xa9f6('0x39')](_0x33b980[_0xa9f6('0x3a')]);_0x449db3['filters']=_[_0xa9f6('0x4c')](_0x449db3[_0xa9f6('0x38')],_0x449db3['query']);_0x5941c6[_0xa9f6('0x3c')]=_[_0xa9f6('0x4c')](_0x449db3[_0xa9f6('0x38')],qs[_0xa9f6('0x3d')](_0x33b980['query']['fields']));_0x5941c6[_0xa9f6('0x3c')]=_0x5941c6[_0xa9f6('0x3c')]['length']?_0x5941c6[_0xa9f6('0x3c')]:_0x449db3['model'];if(_0x33b980[_0xa9f6('0x3a')][_0xa9f6('0x48')]){_0x5941c6[_0xa9f6('0x4d')]=[{'all':!![]}];}_0x5941c6=_[_0xa9f6('0x46')]({},_0x5941c6,_0x33b980['options']);return db[_0xa9f6('0x34')][_0xa9f6('0x4e')](_0x5941c6)['then'](handleEntityNotFound(_0x8e3724,null))['then'](respondWithResult(_0x8e3724,null))[_0xa9f6('0x21')](handleError(_0x8e3724,null));};exports[_0xa9f6('0x4f')]=function(_0x347aed,_0x2b005d){return db['ChatWebsite'][_0xa9f6('0x4f')](_0x347aed['body'],{})[_0xa9f6('0x17')](function(_0x2d2a54){var _0x2c4cbc=_0x347aed[_0xa9f6('0x50')]['get']({'plain':!![]});if(!_0x2c4cbc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c4cbc['role']==='user'){var _0x3908ed=_0x2d2a54[_0xa9f6('0x2b')]({'plain':!![]});var _0x18ce4b=_0xa9f6('0x2c');return db[_0xa9f6('0x51')]['find']({'where':{'name':_0x18ce4b,'userProfileId':_0x2c4cbc[_0xa9f6('0x52')]},'raw':!![]})[_0xa9f6('0x17')](function(_0x436f5e){if(_0x436f5e&&_0x436f5e['autoAssociation']===0x0){return db[_0xa9f6('0x53')][_0xa9f6('0x4f')]({'name':_0x3908ed['name'],'resourceId':_0x3908ed['id'],'type':_0x436f5e['name'],'sectionId':_0x436f5e['id']},{})[_0xa9f6('0x17')](function(){return _0x2d2a54;});}else{return _0x2d2a54;}})[_0xa9f6('0x21')](function(_0x14c216){logger[_0xa9f6('0x1d')](_0xa9f6('0x54'),_0x14c216);throw _0x14c216;});}return _0x2d2a54;})['then'](respondWithResult(_0x2b005d,0xc9))[_0xa9f6('0x21')](handleError(_0x2b005d,null));};exports[_0xa9f6('0x29')]=function(_0x3d754c,_0x4ae163){if(_0x3d754c[_0xa9f6('0x55')]['id']){delete _0x3d754c[_0xa9f6('0x55')]['id'];}return db[_0xa9f6('0x34')]['find']({'where':{'id':_0x3d754c[_0xa9f6('0x4b')]['id']},'include':[{'model':db[_0xa9f6('0x31')],'as':_0xa9f6('0x32')}]})[_0xa9f6('0x17')](handleEntityNotFound(_0x4ae163,null))[_0xa9f6('0x17')](saveUpdates(_0x3d754c[_0xa9f6('0x55')],null))[_0xa9f6('0x17')](respondWithResult(_0x4ae163,null))[_0xa9f6('0x21')](handleError(_0x4ae163,null));};exports['destroy']=function(_0x20daa3,_0x5704de){return db['ChatWebsite']['find']({'where':{'id':_0x20daa3[_0xa9f6('0x4b')]['id']}})[_0xa9f6('0x17')](handleEntityNotFound(_0x5704de,null))[_0xa9f6('0x17')](removeEntity(_0x5704de,null))[_0xa9f6('0x21')](handleError(_0x5704de,null));};exports[_0xa9f6('0x56')]=function(_0x5a7b54,_0x53761a){return db[_0xa9f6('0x34')][_0xa9f6('0x56')]()[_0xa9f6('0x17')](respondWithResult(_0x53761a,null))['catch'](handleError(_0x53761a,null));};exports[_0xa9f6('0x57')]=function(_0xa421f2,_0x372339){if(_0xa421f2['body']['id']){delete _0xa421f2['body']['id'];}return db[_0xa9f6('0x34')][_0xa9f6('0x4e')]({'where':{'id':_0xa421f2[_0xa9f6('0x4b')]['id']}})[_0xa9f6('0x17')](handleEntityNotFound(_0x372339,null))[_0xa9f6('0x17')](function(_0x4e9146){if(_0x4e9146){_0xa421f2[_0xa9f6('0x55')][_0xa9f6('0x58')]=_0x4e9146['id'];return db[_0xa9f6('0x59')][_0xa9f6('0x4f')](_0xa421f2[_0xa9f6('0x55')]);}})[_0xa9f6('0x17')](respondWithResult(_0x372339,null))[_0xa9f6('0x21')](handleError(_0x372339,null));};exports[_0xa9f6('0x5a')]=function(_0x4e1f8c,_0x52da2b){var _0x39ff1b={'raw':![],'where':{}};var _0x48fa7e={};var _0xe1ff2d={'count':0x0,'rows':[]};return db[_0xa9f6('0x34')][_0xa9f6('0x5b')]({'where':{'id':_0x4e1f8c[_0xa9f6('0x4b')]['id']}})[_0xa9f6('0x17')](handleEntityNotFound(_0x52da2b,null))[_0xa9f6('0x17')](function(_0x1d8f08){if(_0x1d8f08){_0x48fa7e[_0xa9f6('0x38')]=_[_0xa9f6('0x39')](db[_0xa9f6('0x59')][_0xa9f6('0x35')]);_0x48fa7e['query']=_['keys'](_0x4e1f8c[_0xa9f6('0x3a')]);_0x48fa7e[_0xa9f6('0x3b')]=_[_0xa9f6('0x4c')](_0x48fa7e['model'],_0x48fa7e[_0xa9f6('0x3a')]);_0x39ff1b[_0xa9f6('0x3c')]=_[_0xa9f6('0x4c')](_0x48fa7e[_0xa9f6('0x38')],qs['fields'](_0x4e1f8c[_0xa9f6('0x3a')][_0xa9f6('0x3d')]));_0x39ff1b['attributes']=_0x39ff1b[_0xa9f6('0x3c')]['length']?_0x39ff1b['attributes']:_0x48fa7e[_0xa9f6('0x38')];if(!_0x4e1f8c[_0xa9f6('0x3a')][_0xa9f6('0x3f')](_0xa9f6('0x40'))){_0x39ff1b[_0xa9f6('0x27')]=qs[_0xa9f6('0x27')](_0x4e1f8c['query'][_0xa9f6('0x27')]);_0x39ff1b[_0xa9f6('0x25')]=qs[_0xa9f6('0x25')](_0x4e1f8c[_0xa9f6('0x3a')][_0xa9f6('0x25')]);}_0x39ff1b[_0xa9f6('0x41')]=qs[_0xa9f6('0x42')](_0x4e1f8c[_0xa9f6('0x3a')][_0xa9f6('0x42')]);_0x39ff1b['where']=qs[_0xa9f6('0x3b')](_[_0xa9f6('0x44')](_0x4e1f8c[_0xa9f6('0x3a')],_0x48fa7e[_0xa9f6('0x3b')]));_0x39ff1b[_0xa9f6('0x43')][_0xa9f6('0x58')]=_0x1d8f08['id'];if(_0x4e1f8c[_0xa9f6('0x3a')]['filter']){_0x39ff1b[_0xa9f6('0x43')]=_[_0xa9f6('0x46')](_0x39ff1b['where'],{'$or':_['map'](_0x39ff1b[_0xa9f6('0x3c')],function(_0x2a8795){var _0x2cbb6f={};_0x2cbb6f[_0x2a8795]={'$like':'%'+_0x4e1f8c[_0xa9f6('0x3a')]['filter']+'%'};return _0x2cbb6f;})});}_0x39ff1b=_['merge']({},_0x39ff1b,_0x4e1f8c[_0xa9f6('0x47')]);return db[_0xa9f6('0x59')][_0xa9f6('0x28')]({'where':_0x39ff1b[_0xa9f6('0x43')]})[_0xa9f6('0x17')](function(_0x51bedb){_0xe1ff2d[_0xa9f6('0x28')]=_0x51bedb;if(_0x4e1f8c[_0xa9f6('0x3a')][_0xa9f6('0x48')]){_0x39ff1b[_0xa9f6('0x4d')]=[{'all':!![]}];}return db[_0xa9f6('0x59')][_0xa9f6('0x49')](_0x39ff1b);})[_0xa9f6('0x17')](function(_0x2adb4b){_0xe1ff2d[_0xa9f6('0x5c')]=_0x2adb4b;return _0xe1ff2d;});}})[_0xa9f6('0x17')](respondWithFilteredResult(_0x52da2b,_0x39ff1b))[_0xa9f6('0x21')](handleError(_0x52da2b,null));};exports[_0xa9f6('0x5d')]=function(_0x4157b9,_0x5b395d){return db[_0xa9f6('0x34')][_0xa9f6('0x4e')]({'where':{'id':_0x4157b9[_0xa9f6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5b395d,null))[_0xa9f6('0x17')](function(_0x33b3ad){if(_0x33b3ad){return _0x33b3ad[_0xa9f6('0x5d')](_0x4157b9['query'][_0xa9f6('0x5e')]);}})[_0xa9f6('0x17')](respondWithStatusCode(_0x5b395d,null))[_0xa9f6('0x21')](handleError(_0x5b395d,null));};exports['addAnswer']=function(_0x6fadf3,_0x754747){if(_0x6fadf3[_0xa9f6('0x55')]['id']){delete _0x6fadf3[_0xa9f6('0x55')]['id'];}return db[_0xa9f6('0x34')][_0xa9f6('0x4e')]({'where':{'id':_0x6fadf3[_0xa9f6('0x4b')]['id']}})[_0xa9f6('0x17')](handleEntityNotFound(_0x754747,null))[_0xa9f6('0x17')](function(_0x5dbe64){if(_0x5dbe64){_0x6fadf3['body'][_0xa9f6('0x58')]=_0x5dbe64['id'];return db[_0xa9f6('0x5f')][_0xa9f6('0x4f')](_0x6fadf3[_0xa9f6('0x55')]);}})[_0xa9f6('0x17')](respondWithResult(_0x754747,null))[_0xa9f6('0x21')](handleError(_0x754747,null));};exports[_0xa9f6('0x60')]=function(_0x3e1898,_0x9e22e6){var _0x3d5978={'raw':![],'where':{}};var _0x3a2b36={};var _0x515947={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x3e1898[_0xa9f6('0x4b')]['id']}})[_0xa9f6('0x17')](handleEntityNotFound(_0x9e22e6,null))[_0xa9f6('0x17')](function(_0xb8825b){if(_0xb8825b){_0x3a2b36[_0xa9f6('0x38')]=_[_0xa9f6('0x39')](db['CannedAnswer'][_0xa9f6('0x35')]);_0x3a2b36[_0xa9f6('0x3a')]=_['keys'](_0x3e1898['query']);_0x3a2b36[_0xa9f6('0x3b')]=_[_0xa9f6('0x4c')](_0x3a2b36[_0xa9f6('0x38')],_0x3a2b36['query']);_0x3d5978[_0xa9f6('0x3c')]=_[_0xa9f6('0x4c')](_0x3a2b36['model'],qs[_0xa9f6('0x3d')](_0x3e1898[_0xa9f6('0x3a')][_0xa9f6('0x3d')]));_0x3d5978[_0xa9f6('0x3c')]=_0x3d5978[_0xa9f6('0x3c')][_0xa9f6('0x3e')]?_0x3d5978[_0xa9f6('0x3c')]:_0x3a2b36[_0xa9f6('0x38')];if(!_0x3e1898['query'][_0xa9f6('0x3f')]('nolimit')){_0x3d5978[_0xa9f6('0x27')]=qs['limit'](_0x3e1898[_0xa9f6('0x3a')]['limit']);_0x3d5978[_0xa9f6('0x25')]=qs[_0xa9f6('0x25')](_0x3e1898[_0xa9f6('0x3a')][_0xa9f6('0x25')]);}_0x3d5978[_0xa9f6('0x41')]=qs[_0xa9f6('0x42')](_0x3e1898[_0xa9f6('0x3a')][_0xa9f6('0x42')]);_0x3d5978[_0xa9f6('0x43')]=qs['filters'](_['pick'](_0x3e1898[_0xa9f6('0x3a')],_0x3a2b36[_0xa9f6('0x3b')]));_0x3d5978[_0xa9f6('0x43')][_0xa9f6('0x58')]=_0xb8825b['id'];if(_0x3e1898[_0xa9f6('0x3a')]['filter']){_0x3d5978[_0xa9f6('0x43')]=_['merge'](_0x3d5978['where'],{'$or':_[_0xa9f6('0x33')](_0x3d5978[_0xa9f6('0x3c')],function(_0xbc20d9){var _0x2362b1={};_0x2362b1[_0xbc20d9]={'$like':'%'+_0x3e1898[_0xa9f6('0x3a')][_0xa9f6('0x45')]+'%'};return _0x2362b1;})});}_0x3d5978=_['merge']({},_0x3d5978,_0x3e1898[_0xa9f6('0x47')]);return db[_0xa9f6('0x5f')][_0xa9f6('0x28')]({'where':_0x3d5978[_0xa9f6('0x43')]})['then'](function(_0x277b07){_0x515947[_0xa9f6('0x28')]=_0x277b07;if(_0x3e1898[_0xa9f6('0x3a')][_0xa9f6('0x48')]){_0x3d5978['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xa9f6('0x49')](_0x3d5978);})[_0xa9f6('0x17')](function(_0x31c202){_0x515947['rows']=_0x31c202;return _0x515947;});}})[_0xa9f6('0x17')](respondWithFilteredResult(_0x9e22e6,_0x3d5978))[_0xa9f6('0x21')](handleError(_0x9e22e6,null));};exports[_0xa9f6('0x61')]=function(_0x945de,_0x4ebf84){return db['ChatWebsite'][_0xa9f6('0x4e')]({'where':{'id':_0x945de[_0xa9f6('0x4b')]['id']}})[_0xa9f6('0x17')](handleEntityNotFound(_0x4ebf84,null))[_0xa9f6('0x17')](function(_0x561660){if(_0x561660){return _0x561660[_0xa9f6('0x61')](_0x945de[_0xa9f6('0x3a')][_0xa9f6('0x5e')]);}})['then'](respondWithStatusCode(_0x4ebf84,null))[_0xa9f6('0x21')](handleError(_0x4ebf84,null));};exports['addLogo']=function(_0x513546,_0x1bd4bf){_0x513546[_0xa9f6('0x55')][_0xa9f6('0x62')]=_0x513546['file']['filename'];return db[_0xa9f6('0x34')][_0xa9f6('0x4e')]({'where':{'id':_0x513546[_0xa9f6('0x4b')]['id']}})[_0xa9f6('0x17')](handleEntityNotFound(_0x1bd4bf,null))[_0xa9f6('0x17')](saveUpdates(_0x513546[_0xa9f6('0x55')],null))[_0xa9f6('0x17')](respondWithResult(_0x1bd4bf,null))[_0xa9f6('0x21')](handleError(_0x1bd4bf,null));};exports[_0xa9f6('0x63')]=function(_0xf72926,_0x4a366e){_0xf72926[_0xa9f6('0x55')][_0xa9f6('0x64')]=_0xf72926[_0xa9f6('0x65')][_0xa9f6('0x66')];return db[_0xa9f6('0x34')][_0xa9f6('0x4e')]({'where':{'id':_0xf72926[_0xa9f6('0x4b')]['id']}})[_0xa9f6('0x17')](handleEntityNotFound(_0x4a366e,null))['then'](saveUpdates(_0xf72926['body'],null))[_0xa9f6('0x17')](respondWithResult(_0x4a366e,null))[_0xa9f6('0x21')](handleError(_0x4a366e,null));};exports[_0xa9f6('0x67')]=function(_0x31e8ef,_0x5c2add){_0x31e8ef[_0xa9f6('0x55')]['customerAvatar']=_0x31e8ef['file'][_0xa9f6('0x66')];return db[_0xa9f6('0x34')][_0xa9f6('0x4e')]({'where':{'id':_0x31e8ef[_0xa9f6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5c2add,null))[_0xa9f6('0x17')](saveUpdates(_0x31e8ef['body'],null))['then'](respondWithResult(_0x5c2add,null))[_0xa9f6('0x21')](handleError(_0x5c2add,null));};exports[_0xa9f6('0x68')]=function(_0x3a3504,_0xaab023){_0x3a3504[_0xa9f6('0x55')]['systemAvatar']=_0x3a3504[_0xa9f6('0x65')][_0xa9f6('0x66')];return db[_0xa9f6('0x34')]['find']({'where':{'id':_0x3a3504[_0xa9f6('0x4b')]['id']}})[_0xa9f6('0x17')](handleEntityNotFound(_0xaab023,null))['then'](saveUpdates(_0x3a3504[_0xa9f6('0x55')],null))[_0xa9f6('0x17')](respondWithResult(_0xaab023,null))[_0xa9f6('0x21')](handleError(_0xaab023,null));};exports[_0xa9f6('0x69')]=function(_0x177af5,_0x4cd1d3){var _0x48a716=path[_0xa9f6('0x6a')](config[_0xa9f6('0x6b')],'server/files/images/logos/default_logo.svg');var _0x5cf757={'where':{'id':_0x177af5[_0xa9f6('0x4b')]['id']},'attributes':['id',_0xa9f6('0x62')],'raw':!![]};var _0x125c43=![];return require(_0xa9f6('0x6c'))[_0xa9f6('0x6d')]()[_0xa9f6('0x17')](function(_0x82fa3){if(_0x82fa3){_0x125c43=_0x82fa3[_0xa9f6('0x6e')];}})[_0xa9f6('0x17')](function(){return db[_0xa9f6('0x34')][_0xa9f6('0x4e')](_0x5cf757);})[_0xa9f6('0x17')](handleEntityNotFound(_0x4cd1d3,null))['then'](function(_0x3bd0ec){if(_0x3bd0ec){if(!_[_0xa9f6('0x6f')](_0x3bd0ec[_0xa9f6('0x62')])){if(fs[_0xa9f6('0x70')](path['join'](config[_0xa9f6('0x6b')],_0xa9f6('0x71'),_0x3bd0ec['sitepic']))&&_0x125c43){_0x48a716=path['join'](config[_0xa9f6('0x6b')],_0xa9f6('0x71'),_0x3bd0ec['sitepic']);}}return _0x4cd1d3[_0xa9f6('0x72')](_0x48a716);}})['catch'](handleError(_0x4cd1d3,null));};exports[_0xa9f6('0x73')]=function(_0x4e402a,_0x378949){var _0x31e399=path[_0xa9f6('0x6a')](config[_0xa9f6('0x6b')],'server/files/images/avatars/default_avatar.png');var _0x47c271={'where':{'id':_0x4e402a[_0xa9f6('0x4b')]['id']},'attributes':['id',_0xa9f6('0x64')],'raw':!![]};return db[_0xa9f6('0x34')][_0xa9f6('0x4e')](_0x47c271)[_0xa9f6('0x17')](handleEntityNotFound(_0x378949,null))['then'](function(_0x499e26){if(_0x499e26){if(!_[_0xa9f6('0x6f')](_0x499e26[_0xa9f6('0x64')])){if(fs[_0xa9f6('0x70')](path[_0xa9f6('0x6a')](config[_0xa9f6('0x6b')],'server/files/images/avatars/',_0x499e26[_0xa9f6('0x64')]))){_0x31e399=path[_0xa9f6('0x6a')](config[_0xa9f6('0x6b')],_0xa9f6('0x74'),_0x499e26[_0xa9f6('0x64')]);}}return _0x378949['download'](_0x31e399);}})[_0xa9f6('0x21')](handleError(_0x378949,null));};exports['getCustomerAvatar']=function(_0xe491b2,_0xd56857){var _0x5222fe=path[_0xa9f6('0x6a')](config[_0xa9f6('0x6b')],'server/files/images/avatars/customer_avatar.png');var _0x1593db={'where':{'id':_0xe491b2[_0xa9f6('0x4b')]['id']},'attributes':['id',_0xa9f6('0x75'),_0xa9f6('0x76')],'raw':!![]};return db[_0xa9f6('0x34')][_0xa9f6('0x4e')](_0x1593db)[_0xa9f6('0x17')](handleEntityNotFound(_0xd56857,null))[_0xa9f6('0x17')](function(_0x25ddf4){if(_0x25ddf4){if(!_['isNil'](_0x25ddf4[_0xa9f6('0x75')])){if(fs[_0xa9f6('0x70')](path[_0xa9f6('0x6a')](config[_0xa9f6('0x6b')],_0xa9f6('0x74'),_0x25ddf4['customerAvatar']))&&_0x25ddf4[_0xa9f6('0x76')]){_0x5222fe=path[_0xa9f6('0x6a')](config['root'],_0xa9f6('0x74'),_0x25ddf4[_0xa9f6('0x75')]);}}return _0xd56857[_0xa9f6('0x72')](_0x5222fe);}})[_0xa9f6('0x21')](handleError(_0xd56857,null));};exports[_0xa9f6('0x77')]=function(_0x1d611e,_0x6d12f9){var _0x29c642=path[_0xa9f6('0x6a')](config[_0xa9f6('0x6b')],'server/files/images/avatars/system_avatar.png');var _0x2e4521={'where':{'id':_0x1d611e['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xa9f6('0x34')][_0xa9f6('0x4e')](_0x2e4521)[_0xa9f6('0x17')](handleEntityNotFound(_0x6d12f9,null))[_0xa9f6('0x17')](function(_0x286692){if(_0x286692){if(!_['isNil'](_0x286692['systemAvatar'])){if(fs[_0xa9f6('0x70')](path[_0xa9f6('0x6a')](config[_0xa9f6('0x6b')],_0xa9f6('0x74'),_0x286692[_0xa9f6('0x78')]))){_0x29c642=path[_0xa9f6('0x6a')](config[_0xa9f6('0x6b')],'server/files/images/avatars/',_0x286692[_0xa9f6('0x78')]);}}return _0x6d12f9[_0xa9f6('0x72')](_0x29c642);}})[_0xa9f6('0x21')](handleError(_0x6d12f9,null));};exports[_0xa9f6('0x79')]=function(_0x1cfa39,_0x4d7b9d){var _0x69bdbc=require(_0xa9f6('0x7a'));var _0x4652c3=new _0x69bdbc();var _0x4f0302=_0x4652c3[_0xa9f6('0x7b')](_0x1cfa39[_0xa9f6('0x7c')]['user-agent'])[_0xa9f6('0x7d')]();var _0x4d8d4a={'body':_0x1cfa39[_0xa9f6('0x55')],'channel':'chat'};var _0x33d36b=[];var _0x4cd6c4=[];var _0x424a67={};var _0x4fd195=![];return db[_0xa9f6('0x7e')][_0xa9f6('0x56')]()[_0xa9f6('0x17')](function(_0x2e4118){if(!_0x2e4118){throw new db[(_0xa9f6('0x7f'))][(_0xa9f6('0x80'))](_0xa9f6('0x81'));}_0x33d36b=_[_0xa9f6('0x82')](_[_0xa9f6('0x39')](_0x2e4118),[_0xa9f6('0x83'),'updatedAt']);_0x4cd6c4=_['difference'](_[_0xa9f6('0x39')](_0x2e4118),['createdAt',_0xa9f6('0x84'),_0xa9f6('0x85'),_0xa9f6('0x86')]);if(_0x1cfa39[_0xa9f6('0x55')]['id']){delete _0x1cfa39['body']['id'];}if(_[_0xa9f6('0x6f')](_0x1cfa39[_0xa9f6('0x55')][_0xa9f6('0x87')])){throw new db[(_0xa9f6('0x7f'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xa9f6('0x6f')](_0x1cfa39[_0xa9f6('0x55')]['body'])||_0x1cfa39[_0xa9f6('0x55')][_0xa9f6('0x55')]===''){throw new db[(_0xa9f6('0x7f'))][(_0xa9f6('0x80'))](_0xa9f6('0x88'));}if(_[_0xa9f6('0x6f')](_0x1cfa39[_0xa9f6('0x55')]['mapKey'])){throw new db[(_0xa9f6('0x7f'))][(_0xa9f6('0x80'))](_0xa9f6('0x89')+_0x4cd6c4);}if(!_[_0xa9f6('0x8a')](_0x4cd6c4,_0x1cfa39[_0xa9f6('0x55')][_0xa9f6('0x8b')])){throw new db['Sequelize'][(_0xa9f6('0x80'))](_0xa9f6('0x8c')+_0x4cd6c4);}_0x424a67[_0x1cfa39[_0xa9f6('0x55')]['mapKey']]=_0x1cfa39[_0xa9f6('0x55')]['from'];})['then'](function(){return db[_0xa9f6('0x34')]['find']({'where':{'id':_0x1cfa39['params']['id']},'include':[{'model':db[_0xa9f6('0x8d')],'as':_0xa9f6('0x8e'),'include':[{'model':db[_0xa9f6('0x7e')],'as':_0xa9f6('0x8f'),'where':_0x424a67,'limit':0x1,'order':[[_0xa9f6('0x84'),_0xa9f6('0x90')]]}]},{'model':db[_0xa9f6('0x91')],'as':_0xa9f6('0x92')}]});})[_0xa9f6('0x17')](handleEntityNotFound(_0x4d7b9d,null))[_0xa9f6('0x17')](function(_0x3579b6){if(_0x3579b6&&_0x3579b6[_0xa9f6('0x8e')]){_0x4d8d4a[_0xa9f6('0x93')]=_0x3579b6;_0x4d8d4a[_0xa9f6('0x94')]=_0x3579b6[_0xa9f6('0x92')];_0x4d8d4a[_0xa9f6('0x95')]=_0x3579b6[_0xa9f6('0x8e')];_0x4d8d4a[_0xa9f6('0x94')]=_[_0xa9f6('0x96')](_0x4d8d4a['applications'],[_0xa9f6('0x97')],[_0xa9f6('0x98')]);if(_0x4d8d4a[_0xa9f6('0x93')][_0xa9f6('0x92')]){delete _0x4d8d4a[_0xa9f6('0x93')][_0xa9f6('0x92')];}if(_0x4d8d4a[_0xa9f6('0x93')][_0xa9f6('0x8e')]&&_0x4d8d4a['account'][_0xa9f6('0x8e')][_0xa9f6('0x8f')][_0xa9f6('0x3e')]){return _0x4d8d4a[_0xa9f6('0x93')][_0xa9f6('0x8e')]['Contacts'][0x0];}var _0x4b60d0=_[_0xa9f6('0xe')](_0x1cfa39[_0xa9f6('0x55')],{'firstName':_0x1cfa39[_0xa9f6('0x55')][_0xa9f6('0x87')],'ListId':_0x3579b6[_0xa9f6('0x86')]});_0x4b60d0[_0x1cfa39[_0xa9f6('0x55')][_0xa9f6('0x8b')]]=_0x1cfa39[_0xa9f6('0x55')][_0xa9f6('0x87')];return db[_0xa9f6('0x7e')]['create'](_0x4b60d0,{'fields':_0x33d36b,'raw':!![]});}})[_0xa9f6('0x17')](handleEntityNotFound(_0x4d7b9d,null))[_0xa9f6('0x17')](function(_0x55e2ba){_0x4d8d4a['contact']=_0x55e2ba;var _0x434876=_0x1cfa39['body'][_0xa9f6('0x99')];if(_0x1cfa39[_0xa9f6('0x7c')][_0xa9f6('0x9a')]){_0x434876=_0x1cfa39[_0xa9f6('0x7c')][_0xa9f6('0x9a')];}else if(_0x1cfa39[_0xa9f6('0x7c')][_0xa9f6('0x9b')]){_0x434876=_[_0xa9f6('0x9c')](_0x1cfa39[_0xa9f6('0x7c')][_0xa9f6('0x9b')][_0xa9f6('0x9d')](','));}if(_0x55e2ba){var _0x5a2055={'ContactId':_0x55e2ba['id'],'ChatWebsiteId':_0x1cfa39[_0xa9f6('0x4b')]['id'],'from':(_0x55e2ba['firstName']||'')+'\x20'+(_0x55e2ba[_0xa9f6('0x9e')]||''),'customerIp':_0x434876,'customerPort':_0x1cfa39[_0xa9f6('0x7c')][_0xa9f6('0x9f')]?_0x1cfa39[_0xa9f6('0x7c')][_0xa9f6('0x9f')]:null,'referer':_0x1cfa39[_0xa9f6('0x55')][_0xa9f6('0xa0')],'browserName':_0x4f0302[_0xa9f6('0xa1')][_0xa9f6('0x2f')]&&_0x4f0302[_0xa9f6('0xa1')][_0xa9f6('0xa2')]?util[_0xa9f6('0xa3')](_0xa9f6('0xa4'),_0x4f0302[_0xa9f6('0xa1')][_0xa9f6('0x2f')],_0x4f0302[_0xa9f6('0xa1')][_0xa9f6('0xa2')]):_0xa9f6('0xa5'),'browserVersion':_0x4f0302[_0xa9f6('0xa1')][_0xa9f6('0xa2')]||'unknown','osName':util['format'](_0xa9f6('0xa4'),_0x4f0302['os']['name'],_0x4f0302['os'][_0xa9f6('0xa2')]),'osVersion':_0x4f0302['os'][_0xa9f6('0xa2')],'deviceModel':_0x4f0302['device'][_0xa9f6('0x38')]&&_0x4f0302[_0xa9f6('0xa6')][_0xa9f6('0xa7')]?util['format']('%s\x20%s\x20%s',_0x4f0302[_0xa9f6('0xa6')]['model'],_0x4f0302[_0xa9f6('0xa6')][_0xa9f6('0xa7')],_0x4f0302[_0xa9f6('0xa6')]['type']):null,'deviceVendor':_0x4f0302[_0xa9f6('0xa6')][_0xa9f6('0xa7')],'deviceType':_0x4f0302[_0xa9f6('0xa6')][_0xa9f6('0x37')],'formData':JSON[_0xa9f6('0x1c')](_0x1cfa39['body'])};var _0x49205d={'ChatWebsiteId':_0x1cfa39[_0xa9f6('0x4b')]['id'],'closed':![]};if(_0x1cfa39['body'][_0xa9f6('0xa8')]){_0x49205d['threadId']=_0x1cfa39[_0xa9f6('0x55')][_0xa9f6('0xa8')];return db['ChatInteraction'][_0xa9f6('0x4e')]({'where':_0x49205d})[_0xa9f6('0x17')](function(_0x28d64a){if(_0x28d64a){return[_0x28d64a,![]];}_0x5a2055[_0xa9f6('0xa8')]=_0x1cfa39[_0xa9f6('0x55')][_0xa9f6('0xa8')];_0x5a2055[_0xa9f6('0xa9')]=_0x1cfa39[_0xa9f6('0x55')][_0xa9f6('0xa9')];return db[_0xa9f6('0xaa')]['create'](_0x5a2055)['then'](function(_0x361afd){return[_0x361afd,!![]];});});}_0x49205d[_0xa9f6('0xab')]=_0x55e2ba['id'];if(_0x1cfa39[_0xa9f6('0x55')]['interaction']&&_0x1cfa39[_0xa9f6('0x55')]['interaction']['id']){_0x49205d['id']=_0x1cfa39[_0xa9f6('0x55')][_0xa9f6('0xac')]['id'];return db['ChatInteraction'][_0xa9f6('0x4e')]({'where':_0x49205d})[_0xa9f6('0x17')](function(_0x366783){if(_0x366783){return[_0x366783,![]];}return db[_0xa9f6('0xaa')][_0xa9f6('0x4f')](_0x5a2055)['then'](function(_0x4c924e){return[_0x4c924e,!![]];});});}return db['ChatInteraction'][_0xa9f6('0x4f')](_0x5a2055)[_0xa9f6('0x17')](function(_0x267ada){return[_0x267ada,!![]];});}})['spread'](function(_0x34e1ec,_0x4f5397){if(_0x34e1ec){_0x4fd195=_0x4f5397;if(!_0x4f5397){var _0x3c7afc={'from':(_0x4d8d4a[_0xa9f6('0xad')][_0xa9f6('0xae')]||'')+'\x20'+(_0x4d8d4a[_0xa9f6('0xad')][_0xa9f6('0x9e')]||'')};if(_0x1cfa39[_0xa9f6('0x55')][_0xa9f6('0xa8')]&&_0x1cfa39[_0xa9f6('0x55')][_0xa9f6('0xaf')]&&_0x1cfa39[_0xa9f6('0x55')][_0xa9f6('0xa8')]!=_0x1cfa39['body'][_0xa9f6('0xaf')]){_0x3c7afc[_0xa9f6('0xa8')]=_0x1cfa39[_0xa9f6('0x55')][_0xa9f6('0xaf')];}return _0x34e1ec[_0xa9f6('0x29')](_0x3c7afc);}else{return _0x34e1ec;}}})['then'](function(_0x237eb1){_0x4d8d4a[_0xa9f6('0xac')]=_0x237eb1[_0xa9f6('0x2b')]({'plain':!![]});_0x4d8d4a[_0xa9f6('0xac')]['created']=_0x4fd195;if(_0x4d8d4a[_0xa9f6('0xac')][_0xa9f6('0xb0')]){if(_0x4d8d4a['account'][_0xa9f6('0xb1')]){_0x4d8d4a['applications']['push']({'id':0x0,'priority':_0x4d8d4a[_0xa9f6('0x94')][_0xa9f6('0x3e')]+0x1,'app':_0xa9f6('0xb2'),'appdata':_0xa9f6('0xb3'),'interval':'*,*,*,*'});}}return db[_0xa9f6('0xb4')][_0xa9f6('0x4f')]({'body':_0x1cfa39[_0xa9f6('0x55')]['body'],'ChatWebsiteId':_0x1cfa39[_0xa9f6('0x4b')]['id'],'ChatInteractionId':_0x237eb1['id'],'direction':'in','ContactId':_0x4d8d4a['contact']['id'],'AttachmentId':_0x1cfa39['body'][_0xa9f6('0xb5')]});})[_0xa9f6('0x17')](function(_0x3a25eb){_0x4d8d4a['message']=_0x3a25eb;if(_0x4d8d4a['interaction'][_0xa9f6('0xb6')]){return db[_0xa9f6('0xb7')][_0xa9f6('0x4e')]({'attributes':['id',_0xa9f6('0x2f')],'where':{'id':_0x4d8d4a['interaction'][_0xa9f6('0xb6')]}})[_0xa9f6('0x17')](function(_0x5d0d33){if(_0x5d0d33){_0x4d8d4a[_0xa9f6('0x94')][_0xa9f6('0xb8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5d0d33['name']+','+(_0x4d8d4a['account']['waitForTheAssignedAgent']||0xa),'interval':_0xa9f6('0xb9')});_0x4d8d4a['forcedOwnership']=!![];}return respondWithRpcPromise(_0xa9f6('0xba'),_0xa9f6('0xbb'),_0x4d8d4a);});}return respondWithRpcPromise(_0xa9f6('0xba'),'startRouting',_0x4d8d4a);})[_0xa9f6('0x17')](function(_0x267402){respondWithRpcPromise(_0xa9f6('0xbc'),_0xa9f6('0xbc'),{'event':'notify','message':_0x267402},client9002);return _0x267402;})[_0xa9f6('0x17')](respondWithResult(_0x4d7b9d,null))[_0xa9f6('0x21')](handleError(_0x4d7b9d,null));};exports['offline']=function(_0xb03120,_0x2cab8d){var _0x146bee,_0xee538b,_0x5e307e;var _0x2fd840=[];var _0x542da4={};var _0x3ba8c7=_0xb03120[_0xa9f6('0xbd')]||[];var _0x3e712b=[];var _0x5a0bd9;return db[_0xa9f6('0x7e')][_0xa9f6('0x56')]()['then'](function(_0x2cb678){if(!_0x2cb678){throw new db[(_0xa9f6('0x7f'))]['ValidationError'](_0xa9f6('0x81'));}_0x2fd840=_[_0xa9f6('0x82')](_[_0xa9f6('0x39')](_0x2cb678),['createdAt','updatedAt',_0xa9f6('0x85'),_0xa9f6('0x86')]);if(_0xb03120[_0xa9f6('0x55')]['id']){delete _0xb03120[_0xa9f6('0x55')]['id'];}if(_[_0xa9f6('0x6f')](_0xb03120[_0xa9f6('0x55')]['from'])){throw _0x2cab8d[_0xa9f6('0x23')](0x1f4)[_0xa9f6('0xbe')](new db[(_0xa9f6('0x7f'))]['ValidationError']('from\x20is\x20mandatory'));}if(_['isNil'](_0xb03120[_0xa9f6('0x55')][_0xa9f6('0x55')])||_0xb03120['body']['body']===''){throw _0x2cab8d[_0xa9f6('0x23')](0x1f4)[_0xa9f6('0xbe')](new db[(_0xa9f6('0x7f'))][(_0xa9f6('0x80'))](_0xa9f6('0x88')));}if(_[_0xa9f6('0x6f')](_0xb03120['body'][_0xa9f6('0xbf')])){throw _0x2cab8d['status'](0x1f4)[_0xa9f6('0xbe')](new db[(_0xa9f6('0x7f'))]['ValidationError'](_0xa9f6('0xc0')+_0x2fd840));}if(!_[_0xa9f6('0x8a')](_0x2fd840,_0xb03120[_0xa9f6('0x55')][_0xa9f6('0xbf')])){throw _0x2cab8d[_0xa9f6('0x23')](0x1f4)[_0xa9f6('0xbe')](new db[(_0xa9f6('0x7f'))]['ValidationError']('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2fd840));}_0x542da4[_0xb03120[_0xa9f6('0x55')][_0xa9f6('0xbf')]]=_0xb03120['body'][_0xa9f6('0x87')];})[_0xa9f6('0x17')](function(){return db[_0xa9f6('0x34')][_0xa9f6('0x4e')]({'where':{'id':_0xb03120[_0xa9f6('0x4b')]['id']},'include':[{'model':db[_0xa9f6('0x8d')],'as':_0xa9f6('0x8e')},{'model':db[_0xa9f6('0xc1')],'as':_0xa9f6('0xc1')}]});})['then'](handleEntityNotFound(_0x2cab8d,null))[_0xa9f6('0x17')](function(_0x20d72b){if(_0x20d72b&&_0x20d72b[_0xa9f6('0x8e')]){_0xee538b=_0x20d72b;var _0x1694d0=_[_0xa9f6('0xe')](_0xb03120[_0xa9f6('0x55')],{'firstName':_0xb03120[_0xa9f6('0x55')][_0xa9f6('0x87')],'phone':_0xb03120[_0xa9f6('0x55')][_0xa9f6('0x87')],'ListId':_0x20d72b['ListId']});_0x1694d0[_0xb03120[_0xa9f6('0x55')][_0xa9f6('0xbf')]]=_0xb03120[_0xa9f6('0x55')][_0xa9f6('0x87')];return db[_0xa9f6('0x7e')][_0xa9f6('0xc2')]({'where':_0x542da4,'defaults':_0x1694d0});}})[_0xa9f6('0xc3')](function(_0x33540d){if(_0x33540d){_0x5e307e=_0x33540d;var _0x2e36f6=fs['readFileSync'](path['join'](config[_0xa9f6('0x6b')],'server/files/templates/chatOfflineMessage.ejs'),_0xa9f6('0xc4'));var _0x47c4b3=ejs[_0xa9f6('0xc5')](_0x2e36f6,{'body':_[_0xa9f6('0xc6')](_0xb03120[_0xa9f6('0x55')][_0xa9f6('0x55')]),'bodyTitle':_0xee538b[_0xa9f6('0xc7')]});return db[_0xa9f6('0xc8')][_0xa9f6('0x4f')]({'body':_0x47c4b3,'plainBody':htmlToText[_0xa9f6('0xc9')](_0x47c4b3),'ContactId':_0x33540d['id'],'ChatWebsiteId':_0xee538b['id']});}})['then'](function(_0x45548a){_0x5a0bd9=_0x45548a;if(_0x3ba8c7[_0xa9f6('0x3e')]){var _0x1313a9=_0x3ba8c7[_0xa9f6('0x33')](function(_0x2c6e3e){return{'name':_0x2c6e3e[_0xa9f6('0xca')],'basename':_0x2c6e3e[_0xa9f6('0x66')],'type':_0x2c6e3e[_0xa9f6('0xcb')],'ChatOfflineMessageId':_0x45548a['id']};});_0x3e712b=_0x1313a9['map'](_0x161d7e=>{var _0x1d3dce={'filename':_0x161d7e[_0xa9f6('0x2f')],'path':path[_0xa9f6('0x6a')](config['root'],'server',_0xa9f6('0xbd'),'attachments','offline-chat',_0x161d7e[_0xa9f6('0xcc')])};return _0x1d3dce;});if(!_0xee538b['openNewInteraction']){return db[_0xa9f6('0xcd')]['transaction'](function(_0xf04394){return db[_0xa9f6('0xce')][_0xa9f6('0xcf')](_0x1313a9,{'transaction':_0xf04394});});}}})[_0xa9f6('0x17')](function(){if(_0x5a0bd9){_0x146bee=_0x5a0bd9;return db[_0xa9f6('0xc1')][_0xa9f6('0x5b')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xa9f6('0xd0')],'as':_0xa9f6('0xd0'),'raw':!![]}]}]});}})['then'](function(_0x7823b2){if(_0x7823b2&&_0x7823b2['Smtp']&&_0xee538b[_0xa9f6('0xd1')]&&_0xee538b[_0xa9f6('0xd2')]){var _0x59ffba=_0x7823b2['getSmtpOptions']();return respondWithRpcPromise(_0xa9f6('0xd3'),_0xa9f6('0xd4'),{'account':_0x59ffba,'message':{'from':util[_0xa9f6('0xa3')](_0xa9f6('0xd5'),_0x7823b2[_0xa9f6('0x2f')],_0x7823b2[_0xa9f6('0xd6')]||_0x7823b2['Smtp'][_0xa9f6('0x50')]),'to':_0xee538b['forwardOfflineAddress'],'subject':_0xee538b['offlineMessageSubject'],'html':_0x146bee[_0xa9f6('0x55')],'attachments':_0x3e712b}},client9003)['then'](function(){return _0x146bee;})[_0xa9f6('0x21')](function(_0x636403){logger[_0xa9f6('0x1d')](_0x636403);});}})[_0xa9f6('0x17')](function(){if(_0xee538b&&_0xee538b['openNewInteraction']&&_0xee538b[_0xa9f6('0xd7')]){var _0x508664=[];if(_0x3ba8c7[_0xa9f6('0x3e')]){_0x508664=_0x3ba8c7[_0xa9f6('0x33')](function(_0x40f55c){return{'name':_0x40f55c[_0xa9f6('0xca')],'basename':_0x40f55c['filename'],'type':_0x40f55c[_0xa9f6('0xcb')],'ChatOfflineMessageId':_0x5a0bd9['id']};});}var _0x2ea078;if(!_['isNil'](_0xee538b[_0xa9f6('0xd8')])){var _0x1a3ffe=_[_0xa9f6('0x33')](_0xb03120[_0xa9f6('0x55')],function(_0x41a2cc){return _0x41a2cc;});var _0x4a6134=_['toPairsIn'](_0x1a3ffe)[0x0];var _0x528329=_[_0xa9f6('0xd9')](_0x4a6134,function(_0x41b97d){return _0x41b97d;});_0x2ea078=_0x528329[0x1][_0xee538b[_0xa9f6('0xd8')]];}var _0x3cd357={'from':_0x5e307e['email'],'firstName':_0x5e307e[_0xa9f6('0xae')],'lastName':_0x5e307e[_0xa9f6('0x9e')],'mapKey':_0xa9f6('0xd6'),'message':{'from':_0x5e307e['email'],'to':_0xee538b[_0xa9f6('0xc1')][_0xa9f6('0xd6')],'cc':'','subject':_['isNil'](_0x2ea078)?_0xee538b[_0xa9f6('0xda')]:_0x2ea078,'messageId':'','sentAt':new Date(),'attach':_0x508664[_0xa9f6('0x3e')],'attachments':_0x508664,'originChannel':_0xa9f6('0xdb'),'ChatWebsiteId':_0xee538b['id'],'ChatOfflineMessageId':_0x146bee['id'],'originTo':_0xee538b[_0xa9f6('0xc1')][_0xa9f6('0xd6')]},'body':_0x146bee['body']};var _0x3d361b={'account':{'id':_0xee538b[_0xa9f6('0xd7')]},'body':_0x3cd357,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0xa9f6('0xdc'),_0x3d361b,client9001)['then'](function(){return _0x146bee;})[_0xa9f6('0x21')](function(_0x4f0143){logger['error'](_0x4f0143);});}return;})[_0xa9f6('0x17')](function(){if(_0x146bee){return _0x146bee;}})[_0xa9f6('0x17')](respondWithResult(_0x2cab8d,null))[_0xa9f6('0x21')](function(_0x4731f5){logger[_0xa9f6('0x1d')](_0xa9f6('0x21'),_0x4731f5);for(var _0x404500 of _0x3ba8c7){var _0x1d312e=path[_0xa9f6('0x6a')](config[_0xa9f6('0x6b')],_0xa9f6('0xdd'),_0xa9f6('0xbd'),_0xa9f6('0xde'),_0xa9f6('0xdf'),_0x404500['filename']);fs_extra['remove'](_0x1d312e)[_0xa9f6('0x21')](function(_0x228681){logger[_0xa9f6('0x1d')](_0xa9f6('0xe0'),_0x1d312e,_0x228681);});}});};exports[_0xa9f6('0xe1')]=function(_0x5a22ed,_0x251c81){return db[_0xa9f6('0xaa')][_0xa9f6('0x4e')]({'where':{'id':_0x5a22ed[_0xa9f6('0x4b')]['id']}})[_0xa9f6('0x17')](handleEntityNotFound(_0x251c81,null))['then'](function(_0x978c1c){if(_0x978c1c){return _0x978c1c[_0xa9f6('0xe1')](_0x5a22ed['body']['ids'],_[_0xa9f6('0xe2')](_0x5a22ed[_0xa9f6('0x55')],[_0xa9f6('0x5e'),'id'])||{});}})[_0xa9f6('0x17')](respondWithResult(_0x251c81,null))['catch'](handleError(_0x251c81,null));};exports[_0xa9f6('0xe3')]=function(_0x2c7837,_0x3e6077){var _0x2cd5a7={'raw':![],'where':{}};var _0x4b5990={};var _0x562b20={'count':0x0,'rows':[]};return db[_0xa9f6('0x34')]['findOne']({'where':{'id':_0x2c7837[_0xa9f6('0x4b')]['id']}})[_0xa9f6('0x17')](handleEntityNotFound(_0x3e6077,null))[_0xa9f6('0x17')](function(_0x238e77){if(_0x238e77){_0x4b5990['model']=_[_0xa9f6('0x39')](db[_0xa9f6('0xaa')][_0xa9f6('0x35')]);_0x4b5990[_0xa9f6('0x3a')]=_[_0xa9f6('0x39')](_0x2c7837['query']);_0x4b5990['filters']=_['intersection'](_0x4b5990['model'],_0x4b5990[_0xa9f6('0x3a')]);_0x2cd5a7[_0xa9f6('0x3c')]=_['intersection'](_0x4b5990[_0xa9f6('0x38')],qs[_0xa9f6('0x3d')](_0x2c7837[_0xa9f6('0x3a')][_0xa9f6('0x3d')]));_0x2cd5a7[_0xa9f6('0x3c')]=_0x2cd5a7[_0xa9f6('0x3c')][_0xa9f6('0x3e')]?_0x2cd5a7['attributes']:_0x4b5990[_0xa9f6('0x38')];if(!_0x2c7837[_0xa9f6('0x3a')][_0xa9f6('0x3f')]('nolimit')){_0x2cd5a7['limit']=qs[_0xa9f6('0x27')](_0x2c7837[_0xa9f6('0x3a')]['limit']);_0x2cd5a7['offset']=qs[_0xa9f6('0x25')](_0x2c7837[_0xa9f6('0x3a')][_0xa9f6('0x25')]);}_0x2cd5a7['order']=qs[_0xa9f6('0x42')](_0x2c7837['query']['sort']);_0x2cd5a7['where']=qs[_0xa9f6('0x3b')](_[_0xa9f6('0x44')](_0x2c7837[_0xa9f6('0x3a')],_0x4b5990[_0xa9f6('0x3b')]));_0x2cd5a7[_0xa9f6('0x43')]['ChatWebsiteId']=_0x238e77['id'];if(_0x2c7837[_0xa9f6('0x3a')][_0xa9f6('0x45')]){_0x2cd5a7[_0xa9f6('0x43')]=_['merge'](_0x2cd5a7[_0xa9f6('0x43')],{'$or':_[_0xa9f6('0x33')](_0x2cd5a7[_0xa9f6('0x3c')],function(_0x32d26f){var _0xd12e61={};_0xd12e61[_0x32d26f]={'$like':'%'+_0x2c7837['query'][_0xa9f6('0x45')]+'%'};return _0xd12e61;})});}_0x2cd5a7=_[_0xa9f6('0x46')]({},_0x2cd5a7,_0x2c7837[_0xa9f6('0x47')]);return db['ChatInteraction'][_0xa9f6('0x28')]({'where':_0x2cd5a7['where']})[_0xa9f6('0x17')](function(_0x198878){_0x562b20[_0xa9f6('0x28')]=_0x198878;if(_0x2c7837[_0xa9f6('0x3a')]['includeAll']){_0x2cd5a7['include']=[{'model':db['CmContact'],'as':_0xa9f6('0xe4'),'required':![]},{'model':db[_0xa9f6('0xb7')],'as':_0xa9f6('0xe5'),'attributes':[_0xa9f6('0x2f'),_0xa9f6('0xe6'),_0xa9f6('0xe7')],'required':![]},{'model':db['Tag'],'as':_0xa9f6('0xe8'),'attributes':['id',_0xa9f6('0x2f'),_0xa9f6('0xe9')],'where':_0x2c7837[_0xa9f6('0x3a')]['tag']?{'id':_0x2c7837[_0xa9f6('0x3a')]['tag']}:undefined,'required':_0x2c7837[_0xa9f6('0x3a')][_0xa9f6('0xea')]?!![]:![]}];}return db[_0xa9f6('0xaa')][_0xa9f6('0x49')](_0x2cd5a7);})[_0xa9f6('0x17')](function(_0x1eee0e){_0x562b20[_0xa9f6('0x5c')]=_0x1eee0e;return _0x562b20;});}})[_0xa9f6('0x17')](respondWithFilteredResult(_0x3e6077,_0x2cd5a7))[_0xa9f6('0x21')](handleError(_0x3e6077,null));};function iftimePromise(_0x333938,_0x5340e4){return respondWithRpcPromise('Command',_0xa9f6('0xeb'),{'command':_0x5340e4[_0xa9f6('0xec')]?util[_0xa9f6('0xa3')](_0xa9f6('0xed'),_0x333938['interval'],_0x5340e4['timezone']):util[_0xa9f6('0xa3')](_0xa9f6('0xee'),_0x333938[_0xa9f6('0xef')])},client9002)['then'](function(_0x4de002){var _0x290a7e=_0x4de002&&_0x4de002[_0xa9f6('0xf0')]('true')>=0x0?!![]:![];logger['info'](_0xa9f6('0xf1'),_0x5340e4['id'],_0x333938['id'],_0x333938[_0xa9f6('0xef')],_0x290a7e?_0xa9f6('0xf2'):_0xa9f6('0xf3'),_0x5340e4[_0xa9f6('0xec')]?_0x5340e4['timezone']:_0xa9f6('0xf4'));return _0x290a7e;})[_0xa9f6('0x21')](function(_0x2857e8){logger[_0xa9f6('0x1d')](_0xa9f6('0xf1'),_0x5340e4['id'],_0x333938['id'],_0x333938[_0xa9f6('0xef')],util[_0xa9f6('0xf5')](_0x2857e8,{'showHidden':![],'depth':null}),_0x5340e4[_0xa9f6('0xec')]?_0x5340e4[_0xa9f6('0xec')]:_0xa9f6('0xf4'));return![];});}exports[_0xa9f6('0xeb')]=function(_0x4de582,_0x1bd8aa){var _0x284f85=0x0;var _0x561856=0x0;var _0x497485=![];var _0x5f97c9;var _0x1ef2d9;return db['ChatWebsite'][_0xa9f6('0x4e')]({'where':{'id':_0x4de582['params']['id']},'include':[{'model':db['Interval'],'as':_0xa9f6('0xf6'),'include':[{'model':db[_0xa9f6('0xf6')],'as':_0xa9f6('0xf7'),'attributes':['id','interval'],'raw':!![]}]}]})[_0xa9f6('0x17')](handleEntityNotFound(_0x1bd8aa,null))['then'](function(_0x4339e0){if(_0x4339e0){_0x5f97c9=_0x4339e0;return _0x4339e0[_0xa9f6('0xf8')]({'raw':!![]});}})[_0xa9f6('0x17')](function(_0x361bc5){if(_0x5f97c9){if(_0x361bc5){_0x1ef2d9=_0x361bc5;}}return require(_0xa9f6('0x6c'))[_0xa9f6('0x6d')]();})[_0xa9f6('0x17')](function(_0xa5bde3){if(_0xa5bde3){_0x561856=_0xa5bde3['virtual'];_0x497485=_0xa5bde3[_0xa9f6('0x6e')];}})[_0xa9f6('0x17')](function(){return db[_0xa9f6('0xaa')]['count']({'where':{'closed':![]}});})['then'](function(_0x5998a0){_0x284f85=_0x5998a0;if(_0x561856&&_0x5998a0>_0x561856){return db['License']['findOne']({'where':{'id':0x1}})[_0xa9f6('0x17')](function(_0x1e586b){if(_0x1e586b){_0x1e586b[_0xa9f6('0xf9')]('chatLicenseExceeded');}});}})[_0xa9f6('0x17')](function(){if(_0x5f97c9[_0xa9f6('0xf6')]&&_0x5f97c9['Interval'][_0xa9f6('0xf7')]){var _0x3346a6=[];for(var _0x2e0a93=0x0;_0x2e0a93<_0x5f97c9[_0xa9f6('0xf6')]['Intervals'][_0xa9f6('0x3e')];_0x2e0a93++){var _0x44cf74=_0x5f97c9[_0xa9f6('0xf6')]['Intervals'][_0x2e0a93][_0xa9f6('0x2b')]({'plain':!![]});_0x3346a6[_0xa9f6('0xfa')](iftimePromise(_0x44cf74,_0x5f97c9));}return BPromise[_0xa9f6('0xfb')](_0x3346a6)[_0xa9f6('0x17')](function(_0x257c72){return _['some'](_0x257c72);});}else{return!![];}})[_0xa9f6('0x17')](function(_0x27dc60){var _0x369f76=fs['readFileSync'](path['join'](config[_0xa9f6('0x6b')],_0xa9f6('0xfc')),_0xa9f6('0xc4'));var _0x101590={'remote':_0x5f97c9['remote'],'query':querystring[_0xa9f6('0x1c')](_[_0xa9f6('0x46')](_0x5f97c9[_0xa9f6('0x2b')]({'plain':!![]}),{'customerIp':_0x4de582[_0xa9f6('0x7c')][_0xa9f6('0x9b')]||_0x4de582[_0xa9f6('0x7c')]['x-real-ip']||_0x4de582[_0xa9f6('0xfd')][_0xa9f6('0xfe')]||_0x4de582['ip'],'referer':_0x4de582[_0xa9f6('0x7c')][_0xa9f6('0xa0')],'openedInteractions':_0x284f85,'maxInteractions':_0x561856,'virtual':_0x497485['virtual'],'online':_0x27dc60,'custom':_0x497485}))[_0xa9f6('0xff')](/'/g,'\x5c\x27')};_0x1bd8aa['send'](ejs[_0xa9f6('0xc5')](Mustache['render'](_0x369f76,_0x101590),{'proactiveActions':_0x1ef2d9,'alignment':_0x5f97c9[_0xa9f6('0x100')],'verticalAlignment':_0x5f97c9[_0xa9f6('0x101')],'div_color':_0x5f97c9['color'],'labelText':_0x5f97c9[_0xa9f6('0x102')],'text_color':_0x5f97c9[_0xa9f6('0x103')],'text_button_color':_0x5f97c9[_0xa9f6('0x104')],'button_color':_0x5f97c9[_0xa9f6('0x105')],'background_color':_0x5f97c9[_0xa9f6('0x106')],'hideWhenOffline':_0x5f97c9['hideWhenOffline'],'interval':_0x5f97c9[_0xa9f6('0x107')]}));})[_0xa9f6('0x21')](handleError(_0x1bd8aa,null));};exports[_0xa9f6('0x108')]=function(_0x524c53,_0x104db2){var _0x44fc50=_0x524c53[_0xa9f6('0x4b')]['id'];var _0x54a5f8=_0x524c53[_0xa9f6('0x55')];var _0x76c598=0xc8;var _0x551da9=null;return db[_0xa9f6('0xcd')][_0xa9f6('0x109')]({'isolationLevel':db[_0xa9f6('0xcd')][_0xa9f6('0x10a')][_0xa9f6('0x10b')][_0xa9f6('0x10c')]},function(_0x53e2aa){return db[_0xa9f6('0x34')][_0xa9f6('0x5b')]({'where':{'id':_0x44fc50},'transaction':_0x53e2aa})[_0xa9f6('0x17')](function(_0x2326e3){if(_0x2326e3){return db[_0xa9f6('0x91')][_0xa9f6('0x2a')]({'where':{'ChatWebsiteId':_0x44fc50},'transaction':_0x53e2aa})[_0xa9f6('0x17')](function(){var _0x42532c=_[_0xa9f6('0x33')](_0x54a5f8,function(_0x8f090c){_0x8f090c[_0xa9f6('0x58')]=_0x44fc50;return _0x8f090c;});return db[_0xa9f6('0x91')][_0xa9f6('0xcf')](_0x42532c,{'transaction':_0x53e2aa});});}else{_0x76c598=0x194;_0x551da9=[];}});})['then'](function(){if(_0x76c598!==0x194){return db[_0xa9f6('0x91')][_0xa9f6('0x10d')]({'where':{'ChatWebsiteId':_0x44fc50},'order':_0xa9f6('0x97')})[_0xa9f6('0x17')](function(_0x5f0cd9){_0x551da9=_0x5f0cd9;});}})['catch'](function(_0x69bb45){_0x76c598=0x1f4;logger[_0xa9f6('0x1d')](_0x69bb45[_0xa9f6('0x2e')]);if(_0x69bb45[_0xa9f6('0x2f')]){delete _0x69bb45[_0xa9f6('0x2f')];}_0x551da9=_0x69bb45;})[_0xa9f6('0x10e')](function(){if(_0x551da9===null){_0x104db2[_0xa9f6('0x22')](_0x76c598);}else{if(_0x76c598===0x1f4){_0x104db2[_0xa9f6('0x23')](_0x76c598)[_0xa9f6('0xbe')](_0x551da9);}else{_0x104db2[_0xa9f6('0x23')](_0x76c598)[_0xa9f6('0x24')](_0x551da9);}}});};exports[_0xa9f6('0x10f')]=function(_0x19d95f,_0x391827){var _0x431f70={};var _0x25cf97={};var _0x2cce97;var _0x72841d;return db[_0xa9f6('0x34')][_0xa9f6('0x5b')]({'where':{'id':_0x19d95f[_0xa9f6('0x4b')]['id']}})[_0xa9f6('0x17')](handleEntityNotFound(_0x391827,null))[_0xa9f6('0x17')](function(_0x31bde6){if(_0x31bde6){_0x2cce97=_0x31bde6;_0x25cf97[_0xa9f6('0x38')]=_[_0xa9f6('0x39')](db[_0xa9f6('0x91')]['rawAttributes']);_0x25cf97[_0xa9f6('0x3a')]=_['keys'](_0x19d95f[_0xa9f6('0x3a')]);_0x25cf97[_0xa9f6('0x3b')]=_[_0xa9f6('0x4c')](_0x25cf97[_0xa9f6('0x38')],_0x25cf97[_0xa9f6('0x3a')]);_0x431f70['attributes']=_['intersection'](_0x25cf97[_0xa9f6('0x38')],qs[_0xa9f6('0x3d')](_0x19d95f[_0xa9f6('0x3a')][_0xa9f6('0x3d')]));_0x431f70[_0xa9f6('0x3c')]=_0x431f70['attributes'][_0xa9f6('0x3e')]?_0x431f70[_0xa9f6('0x3c')]:_0x25cf97['model'];_0x431f70[_0xa9f6('0x41')]=qs[_0xa9f6('0x42')](_0x19d95f[_0xa9f6('0x3a')][_0xa9f6('0x42')]);_0x431f70[_0xa9f6('0x43')]=qs[_0xa9f6('0x3b')](_[_0xa9f6('0x44')](_0x19d95f[_0xa9f6('0x3a')],_0x25cf97[_0xa9f6('0x3b')]));if(_0x19d95f[_0xa9f6('0x3a')][_0xa9f6('0x45')]){_0x431f70[_0xa9f6('0x43')]=_[_0xa9f6('0x46')](_0x431f70[_0xa9f6('0x43')],{'$or':_[_0xa9f6('0x33')](_0x431f70[_0xa9f6('0x3c')],function(_0x3e7583){var _0x3808dc={};_0x3808dc[_0x3e7583]={'$like':'%'+_0x19d95f[_0xa9f6('0x3a')][_0xa9f6('0x45')]+'%'};return _0x3808dc;})});}_0x431f70=_[_0xa9f6('0x46')]({},_0x431f70,_0x19d95f[_0xa9f6('0x47')]);return _0x2cce97['getApplications'](_0x431f70);}})[_0xa9f6('0x17')](function(_0x2d4ff9){if(_0x2d4ff9){_0x72841d=_0x2d4ff9[_0xa9f6('0x3e')];if(!_0x19d95f['query']['hasOwnProperty'](_0xa9f6('0x40'))){_0x431f70['limit']=qs['limit'](_0x19d95f[_0xa9f6('0x3a')]['limit']);_0x431f70['offset']=qs[_0xa9f6('0x25')](_0x19d95f[_0xa9f6('0x3a')][_0xa9f6('0x25')]);}return _0x2cce97[_0xa9f6('0x10f')](_0x431f70);}})[_0xa9f6('0x17')](function(_0x5bf93a){if(_0x5bf93a){return _0x5bf93a?{'count':_0x72841d,'rows':_0x5bf93a}:null;}})[_0xa9f6('0x17')](respondWithResult(_0x391827,null))[_0xa9f6('0x21')](handleError(_0x391827,null));};exports[_0xa9f6('0x110')]=function(_0x215a36,_0x414ac8){return db[_0xa9f6('0x111')]['find']({'where':{'id':_0x215a36[_0xa9f6('0x4b')]['id']}})[_0xa9f6('0x17')](handleEntityNotFound(_0x414ac8,null))[_0xa9f6('0x17')](function(_0x4de846){if(_0x4de846){return _0x4de846[_0xa9f6('0x110')](_0x215a36[_0xa9f6('0x55')]['ids'],_[_0xa9f6('0xe2')](_0x215a36[_0xa9f6('0x55')],[_0xa9f6('0x5e'),'id'])||{});}})[_0xa9f6('0x17')](respondWithResult(_0x414ac8,null))[_0xa9f6('0x21')](handleError(_0x414ac8,null));};exports[_0xa9f6('0xf8')]=function(_0x5eb4f5,_0x265f71){var _0x55ae24={};var _0x5a171b={};var _0x47de82;var _0x4525d4;return db[_0xa9f6('0x34')][_0xa9f6('0x5b')]({'where':{'id':_0x5eb4f5[_0xa9f6('0x4b')]['id']}})[_0xa9f6('0x17')](handleEntityNotFound(_0x265f71,null))[_0xa9f6('0x17')](function(_0x264000){if(_0x264000){_0x47de82=_0x264000;_0x5a171b[_0xa9f6('0x38')]=_[_0xa9f6('0x39')](db[_0xa9f6('0x112')][_0xa9f6('0x35')]);_0x5a171b[_0xa9f6('0x3a')]=_[_0xa9f6('0x39')](_0x5eb4f5[_0xa9f6('0x3a')]);_0x5a171b[_0xa9f6('0x3b')]=_[_0xa9f6('0x4c')](_0x5a171b[_0xa9f6('0x38')],_0x5a171b[_0xa9f6('0x3a')]);_0x55ae24[_0xa9f6('0x3c')]=_[_0xa9f6('0x4c')](_0x5a171b[_0xa9f6('0x38')],qs[_0xa9f6('0x3d')](_0x5eb4f5[_0xa9f6('0x3a')][_0xa9f6('0x3d')]));_0x55ae24[_0xa9f6('0x3c')]=_0x55ae24['attributes'][_0xa9f6('0x3e')]?_0x55ae24['attributes']:_0x5a171b['model'];_0x55ae24[_0xa9f6('0x41')]=qs[_0xa9f6('0x42')](_0x5eb4f5[_0xa9f6('0x3a')][_0xa9f6('0x42')]);_0x55ae24[_0xa9f6('0x43')]=qs[_0xa9f6('0x3b')](_['pick'](_0x5eb4f5[_0xa9f6('0x3a')],_0x5a171b[_0xa9f6('0x3b')]));if(_0x5eb4f5[_0xa9f6('0x3a')][_0xa9f6('0x45')]){_0x55ae24[_0xa9f6('0x43')]=_[_0xa9f6('0x46')](_0x55ae24[_0xa9f6('0x43')],{'$or':_[_0xa9f6('0x33')](_0x55ae24[_0xa9f6('0x3c')],function(_0x19b802){var _0x20e7b1={};_0x20e7b1[_0x19b802]={'$like':'%'+_0x5eb4f5[_0xa9f6('0x3a')][_0xa9f6('0x45')]+'%'};return _0x20e7b1;})});}_0x55ae24=_['merge']({},_0x55ae24,_0x5eb4f5['options']);return _0x47de82[_0xa9f6('0xf8')](_0x55ae24);}})['then'](function(_0x55c07d){if(_0x55c07d){_0x4525d4=_0x55c07d['length'];if(!_0x5eb4f5[_0xa9f6('0x3a')][_0xa9f6('0x3f')]('nolimit')){_0x55ae24['limit']=qs[_0xa9f6('0x27')](_0x5eb4f5[_0xa9f6('0x3a')][_0xa9f6('0x27')]);_0x55ae24[_0xa9f6('0x25')]=qs[_0xa9f6('0x25')](_0x5eb4f5[_0xa9f6('0x3a')][_0xa9f6('0x25')]);}return _0x47de82[_0xa9f6('0xf8')](_0x55ae24);}})[_0xa9f6('0x17')](function(_0x286f00){if(_0x286f00){return _0x286f00?{'count':_0x4525d4,'rows':_0x286f00}:null;}})[_0xa9f6('0x17')](respondWithResult(_0x265f71,null))['catch'](handleError(_0x265f71,null));};exports[_0xa9f6('0x113')]=function(_0x4cb8d0,_0x58f5c3){var _0x5350c6=_0x4cb8d0[_0xa9f6('0x3a')][_0xa9f6('0x114')]===_0xa9f6('0x115')?_0xa9f6('0x116'):_0xa9f6('0x117');return db['ChatWebsite'][_0xa9f6('0x4e')]({'attributes':['id',_0x5350c6],'where':{'id':_0x4cb8d0['params']['id']}})[_0xa9f6('0x17')](handleEntityNotFound(_0x58f5c3,null))[_0xa9f6('0x17')](function(_0x43c35d){if(_0x43c35d){var _0x5ef74c=_0x43c35d[_0x5350c6];var _0x5261b1=_0x5ef74c&&_0x5ef74c[_0xa9f6('0x118')]?_0x5ef74c[_0xa9f6('0x118')]:[];_0x58f5c3[_0xa9f6('0xbe')]({'fromKey':_[_0xa9f6('0x6f')](_0x5ef74c[_0xa9f6('0x119')])?undefined:_0x5ef74c[_0xa9f6('0x119')],'count':_0x5261b1[_0xa9f6('0x3e')],'rows':_0x5261b1});}})[_0xa9f6('0x21')](handleError(_0x58f5c3,null));};exports[_0xa9f6('0x11a')]=function(_0x27be70,_0x4341a7){var _0x114409={'raw':![],'where':{}};var _0x51f670={};var _0x239735={'count':0x0,'rows':[]};return db[_0xa9f6('0x34')][_0xa9f6('0x5b')]({'where':{'id':_0x27be70['params']['id']}})[_0xa9f6('0x17')](handleEntityNotFound(_0x4341a7,null))[_0xa9f6('0x17')](function(_0x13d266){if(_0x13d266){_0x51f670[_0xa9f6('0x38')]=_[_0xa9f6('0x39')](db[_0xa9f6('0xc8')][_0xa9f6('0x35')]);_0x51f670[_0xa9f6('0x3a')]=_[_0xa9f6('0x39')](_0x27be70[_0xa9f6('0x3a')]);_0x51f670['filters']=_['intersection'](_0x51f670[_0xa9f6('0x38')],_0x51f670[_0xa9f6('0x3a')]);_0x114409['attributes']=_[_0xa9f6('0x4c')](_0x51f670['model'],qs[_0xa9f6('0x3d')](_0x27be70[_0xa9f6('0x3a')][_0xa9f6('0x3d')]));_0x114409[_0xa9f6('0x3c')]=_0x114409['attributes']['length']?_0x114409['attributes']:_0x51f670[_0xa9f6('0x38')];if(!_0x27be70['query']['hasOwnProperty'](_0xa9f6('0x40'))){_0x114409[_0xa9f6('0x27')]=qs['limit'](_0x27be70['query'][_0xa9f6('0x27')]);_0x114409['offset']=qs[_0xa9f6('0x25')](_0x27be70[_0xa9f6('0x3a')][_0xa9f6('0x25')]);}_0x114409[_0xa9f6('0x41')]=qs[_0xa9f6('0x42')](_0x27be70[_0xa9f6('0x3a')]['sort']);_0x114409[_0xa9f6('0x43')]=qs[_0xa9f6('0x3b')](_['pick'](_0x27be70[_0xa9f6('0x3a')],_0x51f670['filters']));_0x114409[_0xa9f6('0x43')][_0xa9f6('0x58')]=_0x13d266['id'];if(_0x27be70[_0xa9f6('0x3a')][_0xa9f6('0x45')]){_0x114409[_0xa9f6('0x43')]=_[_0xa9f6('0x46')](_0x114409[_0xa9f6('0x43')],{'$or':_['map'](_0x114409[_0xa9f6('0x3c')],function(_0x1d8977){var _0x563ac7={};_0x563ac7[_0x1d8977]={'$like':'%'+_0x27be70[_0xa9f6('0x3a')][_0xa9f6('0x45')]+'%'};return _0x563ac7;})});}_0x114409=_['merge']({},_0x114409,_0x27be70['options']);return db[_0xa9f6('0xc8')][_0xa9f6('0x28')]({'where':_0x114409[_0xa9f6('0x43')]})[_0xa9f6('0x17')](function(_0x58a096){_0x239735[_0xa9f6('0x28')]=_0x58a096;if(_0x27be70[_0xa9f6('0x3a')]['includeAll']){_0x114409[_0xa9f6('0x4d')]=[{'all':!![]}];}else{_0x114409[_0xa9f6('0x4d')]=[{'model':db[_0xa9f6('0x7e')],'as':'Contact','required':![]},{'model':db[_0xa9f6('0xce')],'as':_0xa9f6('0x11b'),'required':![]}];}return db['ChatOfflineMessage'][_0xa9f6('0x49')](_0x114409);})['then'](function(_0x32ef89){_0x239735[_0xa9f6('0x5c')]=_0x32ef89;return _0x239735;});}})[_0xa9f6('0x17')](respondWithFilteredResult(_0x4341a7,_0x114409))[_0xa9f6('0x21')](handleError(_0x4341a7,null));};exports[_0xa9f6('0x11c')]=function(_0x21d0ab,_0x14ebd4){return db['ChatWebsite'][_0xa9f6('0x4e')]({'where':{'id':_0x21d0ab[_0xa9f6('0x4b')]['id']}})[_0xa9f6('0x17')](handleEntityNotFound(_0x14ebd4,null))['then'](function(_0x1ef4cb){if(_0x1ef4cb){return _0x1ef4cb['addAgents'](_0x21d0ab[_0xa9f6('0x55')]['ids'],_[_0xa9f6('0xe2')](_0x21d0ab[_0xa9f6('0x55')],[_0xa9f6('0x5e'),'id'])||{})[_0xa9f6('0xc3')](function(_0x21247d){for(var _0x1ac4d8=0x0;_0x1ac4d8<_0x21d0ab[_0xa9f6('0x55')][_0xa9f6('0x5e')][_0xa9f6('0x3e')];_0x1ac4d8+=0x1){socket[_0xa9f6('0x11d')]('userChatWebsite:save',{'UserId':Number(_0x21d0ab[_0xa9f6('0x55')]['ids'][_0x1ac4d8]),'ChatWebsiteId':Number(_0x21d0ab[_0xa9f6('0x4b')]['id'])});}return _0x21247d;});}})['then'](respondWithResult(_0x14ebd4,null))[_0xa9f6('0x21')](handleError(_0x14ebd4,null));};exports[_0xa9f6('0x11e')]=function(_0x31a716,_0x2e164b){return db['ChatWebsite'][_0xa9f6('0x4e')]({'where':{'id':_0x31a716[_0xa9f6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2e164b,null))['then'](function(_0x479831){if(_0x479831){return _0x479831[_0xa9f6('0x11e')](_0x31a716[_0xa9f6('0x3a')][_0xa9f6('0x5e')])['then'](function(){if(_['isArray'](_0x31a716[_0xa9f6('0x3a')][_0xa9f6('0x5e')])){for(var _0x354937=0x0;_0x354937<_0x31a716['query']['ids'][_0xa9f6('0x3e')];_0x354937+=0x1){socket['emit'](_0xa9f6('0x11f'),{'UserId':Number(_0x31a716[_0xa9f6('0x3a')][_0xa9f6('0x5e')][_0x354937]),'ChatWebsiteId':Number(_0x31a716[_0xa9f6('0x4b')]['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x31a716[_0xa9f6('0x3a')][_0xa9f6('0x5e')]),'ChatWebsiteId':Number(_0x31a716['params']['id'])});}});}})[_0xa9f6('0x17')](respondWithStatusCode(_0x2e164b,null))[_0xa9f6('0x21')](handleError(_0x2e164b,null));};exports[_0xa9f6('0x120')]=function(_0x3c5578,_0x872d30){var _0x36487b={};var _0x2e534b={};var _0x3e1179;var _0x457d09;return db['ChatWebsite']['findOne']({'where':{'id':_0x3c5578[_0xa9f6('0x4b')]['id']}})[_0xa9f6('0x17')](handleEntityNotFound(_0x872d30,null))[_0xa9f6('0x17')](function(_0x25b1c0){if(_0x25b1c0){_0x3e1179=_0x25b1c0;_0x2e534b['model']=_[_0xa9f6('0x39')](db[_0xa9f6('0xb7')][_0xa9f6('0x35')]);_0x2e534b[_0xa9f6('0x3a')]=_[_0xa9f6('0x39')](_0x3c5578[_0xa9f6('0x3a')]);_0x2e534b[_0xa9f6('0x3b')]=_[_0xa9f6('0x4c')](_0x2e534b[_0xa9f6('0x38')],_0x2e534b[_0xa9f6('0x3a')]);_0x36487b[_0xa9f6('0x3c')]=_[_0xa9f6('0x4c')](_0x2e534b[_0xa9f6('0x38')],qs[_0xa9f6('0x3d')](_0x3c5578[_0xa9f6('0x3a')][_0xa9f6('0x3d')]));_0x36487b['attributes']=_0x36487b['attributes']['length']?_0x36487b[_0xa9f6('0x3c')]:_0x2e534b[_0xa9f6('0x38')];_0x36487b[_0xa9f6('0x41')]=qs[_0xa9f6('0x42')](_0x3c5578[_0xa9f6('0x3a')][_0xa9f6('0x42')]);_0x36487b[_0xa9f6('0x43')]=qs[_0xa9f6('0x3b')](_[_0xa9f6('0x44')](_0x3c5578[_0xa9f6('0x3a')],_0x2e534b[_0xa9f6('0x3b')]));if(_0x3c5578[_0xa9f6('0x3a')][_0xa9f6('0x45')]){_0x36487b[_0xa9f6('0x43')]=_[_0xa9f6('0x46')](_0x36487b[_0xa9f6('0x43')],{'$or':_['map'](_0x36487b[_0xa9f6('0x3c')],function(_0x1a19f1){var _0x189562={};_0x189562[_0x1a19f1]={'$like':'%'+_0x3c5578[_0xa9f6('0x3a')][_0xa9f6('0x45')]+'%'};return _0x189562;})});}_0x36487b=_['merge']({},_0x36487b,_0x3c5578[_0xa9f6('0x47')]);return _0x3e1179[_0xa9f6('0x120')](_0x36487b);}})[_0xa9f6('0x17')](function(_0x2815fc){if(_0x2815fc){_0x457d09=_0x2815fc[_0xa9f6('0x3e')];if(!_0x3c5578['query'][_0xa9f6('0x3f')](_0xa9f6('0x40'))){_0x36487b[_0xa9f6('0x27')]=qs[_0xa9f6('0x27')](_0x3c5578[_0xa9f6('0x3a')]['limit']);_0x36487b[_0xa9f6('0x25')]=qs[_0xa9f6('0x25')](_0x3c5578[_0xa9f6('0x3a')][_0xa9f6('0x25')]);}return _0x3e1179[_0xa9f6('0x120')](_0x36487b);}})['then'](function(_0x491d8d){if(_0x491d8d){return _0x491d8d?{'count':_0x457d09,'rows':_0x491d8d}:null;}})[_0xa9f6('0x17')](respondWithResult(_0x872d30,null))[_0xa9f6('0x21')](handleError(_0x872d30,null));}; \ No newline at end of file +var _0x0692=['Owner','Tags','color','tag','Command','getSnippet','iftime\x20%s,%s','interval','timezone','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','../../config/license/util','virtual','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','replace','render','alignment','verticalAlignment','labelText','textColor','textButtonColor','backgroundColor','addApplications','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','items','fromKey','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','merge','where','filter','options','includeAll','include','findAll','rows','show','Pause','fields','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','find','ChatWebsiteId','Disposition','params','pick','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','getLicense','custom','server/files/images/logos/','download','getAvatar','join','server/files/images/avatars/default_avatar.png','isNil','existsSync','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','server/files/images/avatars/','showCustomerAvatar','getSystemAvatar','systemAvatar','notify','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','applications','list','orderBy','account','from','customerIp','headers','cf-connecting-ip','x-forwarded-for','split','x-real-port','referer','browser','version','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','interaction','spread','contact','lastName','messageId','created','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','CompanyId','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','toPairs','ChatOfflineMessage','originalname','mimetype','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','format','\x22%s\x22\x20<%s>','email','offlineMessageSubject','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','server','attachments','remove','addInteraction','omit','getInteractions','Contact'];(function(_0xa4f636,_0xaca1b6){var _0x37e02a=function(_0x49bd47){while(--_0x49bd47){_0xa4f636['push'](_0xa4f636['shift']());}};_0x37e02a(++_0xaca1b6);}(_0x0692,0x15b));var _0x2069=function(_0x23b7d6,_0x55846d){_0x23b7d6=_0x23b7d6-0x0;var _0x489b2f=_0x0692[_0x23b7d6];return _0x489b2f;};'use strict';var BPromise=require('bluebird');var Mustache=require(_0x2069('0x0'));var util=require(_0x2069('0x1'));var path=require(_0x2069('0x2'));var ejs=require(_0x2069('0x3'));var fs=require('fs');var fs_extra=require(_0x2069('0x4'));var _=require(_0x2069('0x5'));var querystring=require(_0x2069('0x6'));var Redis=require('ioredis');var qs=require(_0x2069('0x7'));var logger=require(_0x2069('0x8'))(_0x2069('0x9'));var config=require(_0x2069('0xa'));var db=require(_0x2069('0xb'))['db'];config[_0x2069('0xc')]=_[_0x2069('0xd')](config['redis'],{'host':_0x2069('0xe'),'port':0x18eb});var socket=require(_0x2069('0xf'))(new Redis(config[_0x2069('0xc')]));require(_0x2069('0x10'))[_0x2069('0x11')](socket);var htmlToText=require(_0x2069('0x12'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2069('0x13')]({'port':0x232c});var client9002=jayson[_0x2069('0x14')][_0x2069('0x13')]({'port':0x232a});var client9003=jayson[_0x2069('0x14')]['http']({'port':0x232b});var client9001=jayson[_0x2069('0x14')][_0x2069('0x13')]({'port':0x2329});function respondWithRpcPromise(_0x185b2e,_0x4e572d,_0xa18ce3,_0x59d46b){return new BPromise(function(_0x1789be,_0x1f9d7d){var _0x1d5d27=_0x59d46b||client;return _0x1d5d27[_0x2069('0x15')](_0x185b2e,_0xa18ce3)[_0x2069('0x16')](function(_0x545868){logger[_0x2069('0x17')](_0x2069('0x18'),_0x4e572d,_0x2069('0x19'));logger[_0x2069('0x1a')](_0x2069('0x1b'),_0x4e572d,'request\x20sent',JSON[_0x2069('0x1c')](_0x545868));if(_0x545868[_0x2069('0x1d')]){if(_0x545868['error'][_0x2069('0x1e')]===0x1f4){logger[_0x2069('0x1d')](_0x2069('0x18'),_0x4e572d,_0x545868[_0x2069('0x1d')][_0x2069('0x1f')]);return _0x1f9d7d(_0x545868[_0x2069('0x1d')][_0x2069('0x1f')]);}logger[_0x2069('0x1d')](_0x2069('0x18'),_0x4e572d,_0x545868['error'][_0x2069('0x1f')]);return _0x1789be(_0x545868[_0x2069('0x1d')][_0x2069('0x1f')]);}else{logger['info'](_0x2069('0x18'),_0x4e572d,_0x2069('0x19'));_0x1789be(_0x545868['result'][_0x2069('0x1f')]);}})[_0x2069('0x20')](function(_0x2083ee){logger[_0x2069('0x1d')](_0x2069('0x18'),_0x4e572d,_0x2083ee);_0x1f9d7d(_0x2083ee);});});}function respondWithStatusCode(_0x4647bf,_0x506853){_0x506853=_0x506853||0xcc;return function(_0x73c3a9){if(_0x73c3a9){return _0x4647bf[_0x2069('0x21')](_0x506853);}return _0x4647bf['status'](_0x506853)[_0x2069('0x22')]();};}function respondWithResult(_0x2b5689,_0x1246a4){_0x1246a4=_0x1246a4||0xc8;return function(_0x3bbdbd){if(_0x3bbdbd){return _0x2b5689[_0x2069('0x23')](_0x1246a4)[_0x2069('0x24')](_0x3bbdbd);}};}function respondWithFilteredResult(_0x4cbd2f,_0x286fd1){return function(_0x19e90c){if(_0x19e90c){var _0x5ef7a6=typeof _0x286fd1[_0x2069('0x25')]==='undefined'&&typeof _0x286fd1[_0x2069('0x26')]===_0x2069('0x27');var _0x486172=_0x19e90c[_0x2069('0x28')];var _0x21ef5c=_0x5ef7a6?0x0:_0x286fd1[_0x2069('0x25')];var _0x2679dc=_0x5ef7a6?_0x19e90c[_0x2069('0x28')]:_0x286fd1['offset']+_0x286fd1[_0x2069('0x26')];var _0xdffcff;if(_0x2679dc>=_0x486172){_0x2679dc=_0x486172;_0xdffcff=0xc8;}else{_0xdffcff=0xce;}_0x4cbd2f[_0x2069('0x23')](_0xdffcff);return _0x4cbd2f[_0x2069('0x29')](_0x2069('0x2a'),_0x21ef5c+'-'+_0x2679dc+'/'+_0x486172)[_0x2069('0x24')](_0x19e90c);}return null;};}function saveUpdates(_0x47a28d){return function(_0x548db9){if(_0x548db9){return _0x548db9[_0x2069('0x2b')](_0x47a28d)[_0x2069('0x16')](function(_0x566b3e){return _0x566b3e;});}return null;};}function removeEntity(_0x5e6dd1){return function(_0x3c7e02){if(_0x3c7e02){return _0x3c7e02[_0x2069('0x2c')]()[_0x2069('0x16')](function(){var _0x164f7f=_0x3c7e02[_0x2069('0x2d')]({'plain':!![]});var _0x2685be=_0x2069('0x2e');return db[_0x2069('0x2f')]['destroy']({'where':{'type':_0x2685be,'resourceId':_0x164f7f['id']}})[_0x2069('0x16')](function(){return _0x3c7e02;});})[_0x2069('0x16')](function(){_0x5e6dd1[_0x2069('0x23')](0xcc)[_0x2069('0x22')]();});}};}function handleEntityNotFound(_0xc7a491){return function(_0x5e1353){if(!_0x5e1353){_0xc7a491[_0x2069('0x21')](0x194);}return _0x5e1353;};}function handleError(_0x30b9ec,_0x27123e){_0x27123e=_0x27123e||0x1f4;return function(_0x3a64d1){logger[_0x2069('0x1d')](_0x3a64d1[_0x2069('0x30')]);if(_0x3a64d1[_0x2069('0x31')]){delete _0x3a64d1['name'];}_0x30b9ec[_0x2069('0x23')](_0x27123e)[_0x2069('0x32')](_0x3a64d1);};}exports['index']=function(_0x4c7edf,_0x1cacd7){var _0x3b4b36={'include':[{'model':db['Pause'],'as':_0x2069('0x33')}]},_0x5a9948={},_0xca8e2={'count':0x0,'rows':[]};var _0x5012e5=_[_0x2069('0x34')](db[_0x2069('0x35')][_0x2069('0x36')],function(_0x1d9036){return{'name':_0x1d9036['fieldName'],'type':_0x1d9036[_0x2069('0x37')][_0x2069('0x38')]};});_0x5a9948[_0x2069('0x39')]=_[_0x2069('0x34')](_0x5012e5,_0x2069('0x31'));_0x5a9948[_0x2069('0x3a')]=_[_0x2069('0x3b')](_0x4c7edf[_0x2069('0x3a')]);_0x5a9948[_0x2069('0x3c')]=_[_0x2069('0x3d')](_0x5a9948[_0x2069('0x39')],_0x5a9948[_0x2069('0x3a')]);_0x3b4b36[_0x2069('0x3e')]=_[_0x2069('0x3d')](_0x5a9948[_0x2069('0x39')],qs['fields'](_0x4c7edf[_0x2069('0x3a')]['fields']));_0x3b4b36['attributes']=_0x3b4b36[_0x2069('0x3e')][_0x2069('0x3f')]?_0x3b4b36[_0x2069('0x3e')]:_0x5a9948[_0x2069('0x39')];if(!_0x4c7edf[_0x2069('0x3a')][_0x2069('0x40')](_0x2069('0x41'))){_0x3b4b36[_0x2069('0x26')]=qs[_0x2069('0x26')](_0x4c7edf[_0x2069('0x3a')][_0x2069('0x26')]);_0x3b4b36[_0x2069('0x25')]=qs[_0x2069('0x25')](_0x4c7edf[_0x2069('0x3a')][_0x2069('0x25')]);}_0x3b4b36[_0x2069('0x42')]=qs[_0x2069('0x43')](_0x4c7edf[_0x2069('0x3a')]['sort']);_0x3b4b36['where']=qs['filters'](_['pick'](_0x4c7edf['query'],_0x5a9948[_0x2069('0x3c')]),_0x5012e5);if(_0x4c7edf[_0x2069('0x3a')]['filter']){_0x3b4b36['where']=_[_0x2069('0x44')](_0x3b4b36[_0x2069('0x45')],{'$or':_[_0x2069('0x34')](_0x5012e5,function(_0x517d1c){if(_0x517d1c[_0x2069('0x37')]!=='VIRTUAL'){var _0x48edf0={};_0x48edf0[_0x517d1c[_0x2069('0x31')]]={'$like':'%'+_0x4c7edf['query'][_0x2069('0x46')]+'%'};return _0x48edf0;}})});}_0x3b4b36=_[_0x2069('0x44')]({},_0x3b4b36,_0x4c7edf[_0x2069('0x47')]);var _0xdcbde4={'where':_0x3b4b36[_0x2069('0x45')]};return db['ChatWebsite'][_0x2069('0x28')](_0xdcbde4)[_0x2069('0x16')](function(_0x149905){_0xca8e2[_0x2069('0x28')]=_0x149905;if(_0x4c7edf[_0x2069('0x3a')][_0x2069('0x48')]){_0x3b4b36[_0x2069('0x49')]=[{'all':!![]}];}return db[_0x2069('0x35')][_0x2069('0x4a')](_0x3b4b36);})['then'](function(_0x1006c9){_0xca8e2[_0x2069('0x4b')]=_0x1006c9;return _0xca8e2;})[_0x2069('0x16')](respondWithFilteredResult(_0x1cacd7,_0x3b4b36))[_0x2069('0x20')](handleError(_0x1cacd7,null));};exports[_0x2069('0x4c')]=function(_0xe27827,_0x1220c8){var _0x2182f4={'raw':![],'where':{'id':_0xe27827['params']['id']},'include':[{'model':db[_0x2069('0x4d')],'as':_0x2069('0x33')}]},_0x97d0cc={};_0x97d0cc['model']=_[_0x2069('0x3b')](db[_0x2069('0x35')][_0x2069('0x36')]);_0x97d0cc[_0x2069('0x3a')]=_[_0x2069('0x3b')](_0xe27827[_0x2069('0x3a')]);_0x97d0cc[_0x2069('0x3c')]=_['intersection'](_0x97d0cc['model'],_0x97d0cc['query']);_0x2182f4[_0x2069('0x3e')]=_['intersection'](_0x97d0cc[_0x2069('0x39')],qs[_0x2069('0x4e')](_0xe27827[_0x2069('0x3a')][_0x2069('0x4e')]));_0x2182f4[_0x2069('0x3e')]=_0x2182f4['attributes'][_0x2069('0x3f')]?_0x2182f4[_0x2069('0x3e')]:_0x97d0cc[_0x2069('0x39')];if(_0xe27827[_0x2069('0x3a')]['includeAll']){_0x2182f4[_0x2069('0x49')]=[{'all':!![]}];}_0x2182f4=_[_0x2069('0x44')]({},_0x2182f4,_0xe27827['options']);return db[_0x2069('0x35')]['find'](_0x2182f4)['then'](handleEntityNotFound(_0x1220c8,null))['then'](respondWithResult(_0x1220c8,null))['catch'](handleError(_0x1220c8,null));};exports['create']=function(_0x523082,_0x1a8646){return db[_0x2069('0x35')][_0x2069('0x4f')](_0x523082[_0x2069('0x50')],{})[_0x2069('0x16')](function(_0x3b9a82){var _0x14d216=_0x523082[_0x2069('0x51')]['get']({'plain':!![]});if(!_0x14d216)throw new Error(_0x2069('0x52'));if(_0x14d216[_0x2069('0x53')]===_0x2069('0x51')){var _0x553f30=_0x3b9a82['get']({'plain':!![]});var _0x4b937a='ChatWebsites';return db[_0x2069('0x54')]['find']({'where':{'name':_0x4b937a,'userProfileId':_0x14d216['userProfileId']},'raw':!![]})[_0x2069('0x16')](function(_0x409b95){if(_0x409b95&&_0x409b95[_0x2069('0x55')]===0x0){return db[_0x2069('0x2f')][_0x2069('0x4f')]({'name':_0x553f30['name'],'resourceId':_0x553f30['id'],'type':_0x409b95[_0x2069('0x31')],'sectionId':_0x409b95['id']},{})[_0x2069('0x16')](function(){return _0x3b9a82;});}else{return _0x3b9a82;}})[_0x2069('0x20')](function(_0x142597){logger['error'](_0x2069('0x56'),_0x142597);throw _0x142597;});}return _0x3b9a82;})['then'](respondWithResult(_0x1a8646,0xc9))[_0x2069('0x20')](handleError(_0x1a8646,null));};exports[_0x2069('0x2b')]=function(_0x4135bc,_0x3fecb3){if(_0x4135bc[_0x2069('0x50')]['id']){delete _0x4135bc[_0x2069('0x50')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x4135bc['params']['id']},'include':[{'model':db[_0x2069('0x4d')],'as':_0x2069('0x33')}]})['then'](handleEntityNotFound(_0x3fecb3,null))['then'](saveUpdates(_0x4135bc[_0x2069('0x50')],null))['then'](respondWithResult(_0x3fecb3,null))[_0x2069('0x20')](handleError(_0x3fecb3,null));};exports[_0x2069('0x2c')]=function(_0x1edd2e,_0x5ba7cc){return db[_0x2069('0x35')]['find']({'where':{'id':_0x1edd2e['params']['id']}})[_0x2069('0x16')](handleEntityNotFound(_0x5ba7cc,null))[_0x2069('0x16')](removeEntity(_0x5ba7cc,null))[_0x2069('0x20')](handleError(_0x5ba7cc,null));};exports[_0x2069('0x57')]=function(_0x332816,_0x4c508b){return db['ChatWebsite']['describe']()[_0x2069('0x16')](respondWithResult(_0x4c508b,null))[_0x2069('0x20')](handleError(_0x4c508b,null));};exports[_0x2069('0x58')]=function(_0x5b9fb5,_0x3e6e1d){if(_0x5b9fb5[_0x2069('0x50')]['id']){delete _0x5b9fb5['body']['id'];}return db['ChatWebsite'][_0x2069('0x59')]({'where':{'id':_0x5b9fb5['params']['id']}})[_0x2069('0x16')](handleEntityNotFound(_0x3e6e1d,null))[_0x2069('0x16')](function(_0x245513){if(_0x245513){_0x5b9fb5[_0x2069('0x50')][_0x2069('0x5a')]=_0x245513['id'];return db[_0x2069('0x5b')]['create'](_0x5b9fb5[_0x2069('0x50')]);}})[_0x2069('0x16')](respondWithResult(_0x3e6e1d,null))['catch'](handleError(_0x3e6e1d,null));};exports['getDispositions']=function(_0x25473c,_0x2258d6){var _0x348b37={'raw':![],'where':{}};var _0x13ead4={};var _0x562b4a={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x25473c[_0x2069('0x5c')]['id']}})[_0x2069('0x16')](handleEntityNotFound(_0x2258d6,null))['then'](function(_0x1b0c89){if(_0x1b0c89){_0x13ead4[_0x2069('0x39')]=_[_0x2069('0x3b')](db['Disposition'][_0x2069('0x36')]);_0x13ead4['query']=_[_0x2069('0x3b')](_0x25473c[_0x2069('0x3a')]);_0x13ead4[_0x2069('0x3c')]=_[_0x2069('0x3d')](_0x13ead4[_0x2069('0x39')],_0x13ead4[_0x2069('0x3a')]);_0x348b37['attributes']=_['intersection'](_0x13ead4[_0x2069('0x39')],qs[_0x2069('0x4e')](_0x25473c['query']['fields']));_0x348b37[_0x2069('0x3e')]=_0x348b37[_0x2069('0x3e')][_0x2069('0x3f')]?_0x348b37[_0x2069('0x3e')]:_0x13ead4[_0x2069('0x39')];if(!_0x25473c['query'][_0x2069('0x40')](_0x2069('0x41'))){_0x348b37[_0x2069('0x26')]=qs[_0x2069('0x26')](_0x25473c[_0x2069('0x3a')][_0x2069('0x26')]);_0x348b37['offset']=qs[_0x2069('0x25')](_0x25473c[_0x2069('0x3a')]['offset']);}_0x348b37[_0x2069('0x42')]=qs[_0x2069('0x43')](_0x25473c[_0x2069('0x3a')]['sort']);_0x348b37[_0x2069('0x45')]=qs['filters'](_[_0x2069('0x5d')](_0x25473c[_0x2069('0x3a')],_0x13ead4[_0x2069('0x3c')]));_0x348b37[_0x2069('0x45')][_0x2069('0x5a')]=_0x1b0c89['id'];if(_0x25473c['query']['filter']){_0x348b37['where']=_[_0x2069('0x44')](_0x348b37[_0x2069('0x45')],{'$or':_[_0x2069('0x34')](_0x348b37['attributes'],function(_0x3ece0d){var _0x4910c7={};_0x4910c7[_0x3ece0d]={'$like':'%'+_0x25473c['query'][_0x2069('0x46')]+'%'};return _0x4910c7;})});}_0x348b37=_['merge']({},_0x348b37,_0x25473c['options']);return db[_0x2069('0x5b')]['count']({'where':_0x348b37['where']})[_0x2069('0x16')](function(_0x28d0b6){_0x562b4a[_0x2069('0x28')]=_0x28d0b6;if(_0x25473c[_0x2069('0x3a')]['includeAll']){_0x348b37['include']=[{'all':!![]}];}return db['Disposition'][_0x2069('0x4a')](_0x348b37);})[_0x2069('0x16')](function(_0x3d3ec1){_0x562b4a[_0x2069('0x4b')]=_0x3d3ec1;return _0x562b4a;});}})[_0x2069('0x16')](respondWithFilteredResult(_0x2258d6,_0x348b37))[_0x2069('0x20')](handleError(_0x2258d6,null));};exports[_0x2069('0x5e')]=function(_0x4a3e15,_0x2dc294){return db[_0x2069('0x35')][_0x2069('0x59')]({'where':{'id':_0x4a3e15[_0x2069('0x5c')]['id']}})[_0x2069('0x16')](handleEntityNotFound(_0x2dc294,null))['then'](function(_0x3379ac){if(_0x3379ac){return _0x3379ac[_0x2069('0x5e')](_0x4a3e15[_0x2069('0x3a')][_0x2069('0x5f')]);}})[_0x2069('0x16')](respondWithStatusCode(_0x2dc294,null))['catch'](handleError(_0x2dc294,null));};exports[_0x2069('0x60')]=function(_0x3340b6,_0x214065){if(_0x3340b6[_0x2069('0x50')]['id']){delete _0x3340b6[_0x2069('0x50')]['id'];}return db[_0x2069('0x35')][_0x2069('0x59')]({'where':{'id':_0x3340b6[_0x2069('0x5c')]['id']}})[_0x2069('0x16')](handleEntityNotFound(_0x214065,null))[_0x2069('0x16')](function(_0xbf2fd8){if(_0xbf2fd8){_0x3340b6[_0x2069('0x50')][_0x2069('0x5a')]=_0xbf2fd8['id'];return db['CannedAnswer'][_0x2069('0x4f')](_0x3340b6[_0x2069('0x50')]);}})[_0x2069('0x16')](respondWithResult(_0x214065,null))['catch'](handleError(_0x214065,null));};exports[_0x2069('0x61')]=function(_0x5ef8ec,_0x442fdb){var _0x1cc2f0={'raw':![],'where':{}};var _0x21c432={};var _0x3f4483={'count':0x0,'rows':[]};return db[_0x2069('0x35')][_0x2069('0x62')]({'where':{'id':_0x5ef8ec['params']['id']}})[_0x2069('0x16')](handleEntityNotFound(_0x442fdb,null))['then'](function(_0x1398a6){if(_0x1398a6){_0x21c432[_0x2069('0x39')]=_[_0x2069('0x3b')](db[_0x2069('0x63')][_0x2069('0x36')]);_0x21c432[_0x2069('0x3a')]=_[_0x2069('0x3b')](_0x5ef8ec[_0x2069('0x3a')]);_0x21c432['filters']=_[_0x2069('0x3d')](_0x21c432[_0x2069('0x39')],_0x21c432[_0x2069('0x3a')]);_0x1cc2f0[_0x2069('0x3e')]=_['intersection'](_0x21c432['model'],qs[_0x2069('0x4e')](_0x5ef8ec[_0x2069('0x3a')][_0x2069('0x4e')]));_0x1cc2f0['attributes']=_0x1cc2f0[_0x2069('0x3e')][_0x2069('0x3f')]?_0x1cc2f0[_0x2069('0x3e')]:_0x21c432[_0x2069('0x39')];if(!_0x5ef8ec[_0x2069('0x3a')]['hasOwnProperty'](_0x2069('0x41'))){_0x1cc2f0[_0x2069('0x26')]=qs[_0x2069('0x26')](_0x5ef8ec[_0x2069('0x3a')][_0x2069('0x26')]);_0x1cc2f0['offset']=qs[_0x2069('0x25')](_0x5ef8ec['query'][_0x2069('0x25')]);}_0x1cc2f0[_0x2069('0x42')]=qs[_0x2069('0x43')](_0x5ef8ec['query']['sort']);_0x1cc2f0['where']=qs['filters'](_[_0x2069('0x5d')](_0x5ef8ec[_0x2069('0x3a')],_0x21c432[_0x2069('0x3c')]));_0x1cc2f0['where'][_0x2069('0x5a')]=_0x1398a6['id'];if(_0x5ef8ec[_0x2069('0x3a')][_0x2069('0x46')]){_0x1cc2f0[_0x2069('0x45')]=_[_0x2069('0x44')](_0x1cc2f0[_0x2069('0x45')],{'$or':_[_0x2069('0x34')](_0x1cc2f0['attributes'],function(_0x56b209){var _0xd5f665={};_0xd5f665[_0x56b209]={'$like':'%'+_0x5ef8ec[_0x2069('0x3a')][_0x2069('0x46')]+'%'};return _0xd5f665;})});}_0x1cc2f0=_['merge']({},_0x1cc2f0,_0x5ef8ec['options']);return db[_0x2069('0x63')][_0x2069('0x28')]({'where':_0x1cc2f0[_0x2069('0x45')]})[_0x2069('0x16')](function(_0x50da2c){_0x3f4483[_0x2069('0x28')]=_0x50da2c;if(_0x5ef8ec['query']['includeAll']){_0x1cc2f0[_0x2069('0x49')]=[{'all':!![]}];}return db['CannedAnswer'][_0x2069('0x4a')](_0x1cc2f0);})[_0x2069('0x16')](function(_0x51718a){_0x3f4483['rows']=_0x51718a;return _0x3f4483;});}})[_0x2069('0x16')](respondWithFilteredResult(_0x442fdb,_0x1cc2f0))[_0x2069('0x20')](handleError(_0x442fdb,null));};exports[_0x2069('0x64')]=function(_0x362f54,_0x14b49e){return db[_0x2069('0x35')][_0x2069('0x59')]({'where':{'id':_0x362f54[_0x2069('0x5c')]['id']}})[_0x2069('0x16')](handleEntityNotFound(_0x14b49e,null))[_0x2069('0x16')](function(_0x2a46e6){if(_0x2a46e6){return _0x2a46e6[_0x2069('0x64')](_0x362f54[_0x2069('0x3a')][_0x2069('0x5f')]);}})['then'](respondWithStatusCode(_0x14b49e,null))[_0x2069('0x20')](handleError(_0x14b49e,null));};exports[_0x2069('0x65')]=function(_0x4f9b3d,_0x32e2af){_0x4f9b3d[_0x2069('0x50')][_0x2069('0x66')]=_0x4f9b3d[_0x2069('0x67')][_0x2069('0x68')];return db[_0x2069('0x35')]['find']({'where':{'id':_0x4f9b3d[_0x2069('0x5c')]['id']}})[_0x2069('0x16')](handleEntityNotFound(_0x32e2af,null))[_0x2069('0x16')](saveUpdates(_0x4f9b3d[_0x2069('0x50')],null))['then'](respondWithResult(_0x32e2af,null))[_0x2069('0x20')](handleError(_0x32e2af,null));};exports[_0x2069('0x69')]=function(_0x1c5412,_0x2d2c60){_0x1c5412[_0x2069('0x50')][_0x2069('0x6a')]=_0x1c5412[_0x2069('0x67')]['filename'];return db[_0x2069('0x35')][_0x2069('0x59')]({'where':{'id':_0x1c5412[_0x2069('0x5c')]['id']}})[_0x2069('0x16')](handleEntityNotFound(_0x2d2c60,null))['then'](saveUpdates(_0x1c5412['body'],null))['then'](respondWithResult(_0x2d2c60,null))[_0x2069('0x20')](handleError(_0x2d2c60,null));};exports[_0x2069('0x6b')]=function(_0xe2354d,_0x518398){_0xe2354d[_0x2069('0x50')][_0x2069('0x6c')]=_0xe2354d[_0x2069('0x67')]['filename'];return db[_0x2069('0x35')]['find']({'where':{'id':_0xe2354d[_0x2069('0x5c')]['id']}})[_0x2069('0x16')](handleEntityNotFound(_0x518398,null))[_0x2069('0x16')](saveUpdates(_0xe2354d[_0x2069('0x50')],null))['then'](respondWithResult(_0x518398,null))[_0x2069('0x20')](handleError(_0x518398,null));};exports[_0x2069('0x6d')]=function(_0x362e62,_0x8f994d){_0x362e62[_0x2069('0x50')]['systemAvatar']=_0x362e62[_0x2069('0x67')][_0x2069('0x68')];return db[_0x2069('0x35')][_0x2069('0x59')]({'where':{'id':_0x362e62[_0x2069('0x5c')]['id']}})[_0x2069('0x16')](handleEntityNotFound(_0x8f994d,null))[_0x2069('0x16')](saveUpdates(_0x362e62[_0x2069('0x50')],null))[_0x2069('0x16')](respondWithResult(_0x8f994d,null))[_0x2069('0x20')](handleError(_0x8f994d,null));};exports[_0x2069('0x6e')]=function(_0x31c97e,_0x40c410){var _0x35b8c6=path['join'](config[_0x2069('0x6f')],_0x2069('0x70'));var _0x59d574={'where':{'id':_0x31c97e[_0x2069('0x5c')]['id']},'attributes':['id',_0x2069('0x66')],'raw':!![]};var _0x7f9e55=![];return require('../../config/license/util')[_0x2069('0x71')]()[_0x2069('0x16')](function(_0x373675){if(_0x373675){_0x7f9e55=_0x373675[_0x2069('0x72')];}})['then'](function(){return db['ChatWebsite'][_0x2069('0x59')](_0x59d574);})['then'](handleEntityNotFound(_0x40c410,null))[_0x2069('0x16')](function(_0x3f1dda){if(_0x3f1dda){if(!_['isNil'](_0x3f1dda['sitepic'])){if(fs['existsSync'](path['join'](config['root'],'server/files/images/logos/',_0x3f1dda['sitepic']))&&_0x7f9e55){_0x35b8c6=path['join'](config[_0x2069('0x6f')],_0x2069('0x73'),_0x3f1dda['sitepic']);}}return _0x40c410[_0x2069('0x74')](_0x35b8c6);}})['catch'](handleError(_0x40c410,null));};exports[_0x2069('0x75')]=function(_0x57e870,_0x233d68){var _0x1ad60e=path[_0x2069('0x76')](config[_0x2069('0x6f')],_0x2069('0x77'));var _0x3ce716={'where':{'id':_0x57e870['params']['id']},'attributes':['id',_0x2069('0x6a')],'raw':!![]};return db[_0x2069('0x35')][_0x2069('0x59')](_0x3ce716)[_0x2069('0x16')](handleEntityNotFound(_0x233d68,null))['then'](function(_0x4af5d1){if(_0x4af5d1){if(!_[_0x2069('0x78')](_0x4af5d1[_0x2069('0x6a')])){if(fs[_0x2069('0x79')](path[_0x2069('0x76')](config[_0x2069('0x6f')],'server/files/images/avatars/',_0x4af5d1[_0x2069('0x6a')]))){_0x1ad60e=path[_0x2069('0x76')](config[_0x2069('0x6f')],'server/files/images/avatars/',_0x4af5d1[_0x2069('0x6a')]);}}return _0x233d68[_0x2069('0x74')](_0x1ad60e);}})[_0x2069('0x20')](handleError(_0x233d68,null));};exports[_0x2069('0x7a')]=function(_0x2832ce,_0xd6e183){var _0x46b818=path[_0x2069('0x76')](config['root'],_0x2069('0x7b'));var _0x1a6844={'where':{'id':_0x2832ce[_0x2069('0x5c')]['id']},'attributes':['id',_0x2069('0x6c'),'showCustomerAvatar'],'raw':!![]};return db[_0x2069('0x35')][_0x2069('0x59')](_0x1a6844)[_0x2069('0x16')](handleEntityNotFound(_0xd6e183,null))['then'](function(_0x920014){if(_0x920014){if(!_[_0x2069('0x78')](_0x920014[_0x2069('0x6c')])){if(fs[_0x2069('0x79')](path['join'](config[_0x2069('0x6f')],_0x2069('0x7c'),_0x920014[_0x2069('0x6c')]))&&_0x920014[_0x2069('0x7d')]){_0x46b818=path['join'](config['root'],_0x2069('0x7c'),_0x920014[_0x2069('0x6c')]);}}return _0xd6e183['download'](_0x46b818);}})[_0x2069('0x20')](handleError(_0xd6e183,null));};exports[_0x2069('0x7e')]=function(_0x1cbfce,_0x41dce9){var _0x3387a2=path[_0x2069('0x76')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x334427={'where':{'id':_0x1cbfce[_0x2069('0x5c')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x2069('0x35')][_0x2069('0x59')](_0x334427)[_0x2069('0x16')](handleEntityNotFound(_0x41dce9,null))['then'](function(_0xfbc769){if(_0xfbc769){if(!_['isNil'](_0xfbc769[_0x2069('0x7f')])){if(fs['existsSync'](path[_0x2069('0x76')](config[_0x2069('0x6f')],_0x2069('0x7c'),_0xfbc769[_0x2069('0x7f')]))){_0x3387a2=path[_0x2069('0x76')](config[_0x2069('0x6f')],_0x2069('0x7c'),_0xfbc769[_0x2069('0x7f')]);}}return _0x41dce9[_0x2069('0x74')](_0x3387a2);}})['catch'](handleError(_0x41dce9,null));};exports[_0x2069('0x80')]=function(_0x42cd34,_0x2308ea){var _0x1093b0=require(_0x2069('0x81'));var _0x2ad30c=new _0x1093b0();var _0x2ffa87=_0x2ad30c[_0x2069('0x82')](_0x42cd34['headers'][_0x2069('0x83')])[_0x2069('0x84')]();var _0x3823aa={'body':_0x42cd34[_0x2069('0x50')],'channel':_0x2069('0x85')};var _0x32e353=[];var _0x42c330=[];var _0x2c81d1={};var _0x596e64=![];return db[_0x2069('0x86')][_0x2069('0x57')]()['then'](function(_0x5978d5){if(!_0x5978d5){throw new db[(_0x2069('0x87'))][(_0x2069('0x88'))](_0x2069('0x89'));}_0x32e353=_[_0x2069('0x8a')](_['keys'](_0x5978d5),[_0x2069('0x8b'),'updatedAt']);_0x42c330=_[_0x2069('0x8a')](_[_0x2069('0x3b')](_0x5978d5),[_0x2069('0x8b'),_0x2069('0x8c'),'CompanyId',_0x2069('0x8d')]);if(_0x42cd34[_0x2069('0x50')]['id']){delete _0x42cd34[_0x2069('0x50')]['id'];}if(_[_0x2069('0x78')](_0x42cd34['body']['from'])){throw new db[(_0x2069('0x87'))]['ValidationError'](_0x2069('0x8e'));}if(_['isNil'](_0x42cd34[_0x2069('0x50')][_0x2069('0x50')])||_0x42cd34[_0x2069('0x50')][_0x2069('0x50')]===''){throw new db[(_0x2069('0x87'))][(_0x2069('0x88'))](_0x2069('0x8f'));}if(_[_0x2069('0x78')](_0x42cd34[_0x2069('0x50')]['mapKey'])){throw new db[(_0x2069('0x87'))][(_0x2069('0x88'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x42c330);}if(!_[_0x2069('0x90')](_0x42c330,_0x42cd34[_0x2069('0x50')][_0x2069('0x91')])){throw new db[(_0x2069('0x87'))]['ValidationError'](_0x2069('0x92')+_0x42c330);}_0x2c81d1[_0x42cd34[_0x2069('0x50')][_0x2069('0x91')]]=_0x42cd34[_0x2069('0x50')]['from'];})[_0x2069('0x16')](function(){return db[_0x2069('0x35')][_0x2069('0x59')]({'where':{'id':_0x42cd34['params']['id']},'include':[{'model':db[_0x2069('0x93')],'as':_0x2069('0x94'),'include':[{'model':db[_0x2069('0x86')],'as':_0x2069('0x95'),'where':_0x2c81d1,'limit':0x1,'order':[[_0x2069('0x8c'),_0x2069('0x96')]]}]},{'model':db[_0x2069('0x97')],'as':_0x2069('0x98')}]});})[_0x2069('0x16')](handleEntityNotFound(_0x2308ea,null))[_0x2069('0x16')](function(_0x4a9aab){if(_0x4a9aab&&_0x4a9aab['List']){_0x3823aa['account']=_0x4a9aab;_0x3823aa[_0x2069('0x99')]=_0x4a9aab['Applications'];_0x3823aa[_0x2069('0x9a')]=_0x4a9aab[_0x2069('0x94')];_0x3823aa[_0x2069('0x99')]=_[_0x2069('0x9b')](_0x3823aa['applications'],['priority'],['asc']);if(_0x3823aa[_0x2069('0x9c')]['Applications']){delete _0x3823aa[_0x2069('0x9c')]['Applications'];}if(_0x3823aa['account'][_0x2069('0x94')]&&_0x3823aa['account']['List'][_0x2069('0x95')][_0x2069('0x3f')]){return _0x3823aa['account'][_0x2069('0x94')][_0x2069('0x95')][0x0];}var _0x92fb0c=_[_0x2069('0xd')](_0x42cd34[_0x2069('0x50')],{'firstName':_0x42cd34[_0x2069('0x50')][_0x2069('0x9d')],'ListId':_0x4a9aab[_0x2069('0x8d')]});_0x92fb0c[_0x42cd34[_0x2069('0x50')]['mapKey']]=_0x42cd34[_0x2069('0x50')]['from'];return db[_0x2069('0x86')]['create'](_0x92fb0c,{'fields':_0x32e353,'raw':!![]});}})[_0x2069('0x16')](handleEntityNotFound(_0x2308ea,null))[_0x2069('0x16')](function(_0x4a7453){_0x3823aa['contact']=_0x4a7453;var _0x2accfa=_0x42cd34[_0x2069('0x50')][_0x2069('0x9e')];if(_0x42cd34[_0x2069('0x9f')]['cf-connecting-ip']){_0x2accfa=_0x42cd34[_0x2069('0x9f')][_0x2069('0xa0')];}else if(_0x42cd34['headers'][_0x2069('0xa1')]){_0x2accfa=_['first'](_0x42cd34[_0x2069('0x9f')]['x-forwarded-for'][_0x2069('0xa2')](','));}if(_0x4a7453){var _0x52ebd9={'ContactId':_0x4a7453['id'],'ChatWebsiteId':_0x42cd34[_0x2069('0x5c')]['id'],'from':(_0x4a7453['firstName']||'')+'\x20'+(_0x4a7453['lastName']||''),'customerIp':_0x2accfa,'customerPort':_0x42cd34[_0x2069('0x9f')][_0x2069('0xa3')]?_0x42cd34['headers'][_0x2069('0xa3')]:null,'referer':_0x42cd34[_0x2069('0x50')][_0x2069('0xa4')],'browserName':_0x2ffa87[_0x2069('0xa5')][_0x2069('0x31')]&&_0x2ffa87[_0x2069('0xa5')][_0x2069('0xa6')]?util['format'](_0x2069('0xa7'),_0x2ffa87[_0x2069('0xa5')]['name'],_0x2ffa87['browser'][_0x2069('0xa6')]):_0x2069('0xa8'),'browserVersion':_0x2ffa87[_0x2069('0xa5')][_0x2069('0xa6')]||_0x2069('0xa8'),'osName':util['format'](_0x2069('0xa7'),_0x2ffa87['os']['name'],_0x2ffa87['os'][_0x2069('0xa6')]),'osVersion':_0x2ffa87['os'][_0x2069('0xa6')],'deviceModel':_0x2ffa87[_0x2069('0xa9')]['model']&&_0x2ffa87[_0x2069('0xa9')][_0x2069('0xaa')]?util['format'](_0x2069('0xab'),_0x2ffa87[_0x2069('0xa9')][_0x2069('0x39')],_0x2ffa87[_0x2069('0xa9')][_0x2069('0xaa')],_0x2ffa87[_0x2069('0xa9')][_0x2069('0x37')]):null,'deviceVendor':_0x2ffa87['device'][_0x2069('0xaa')],'deviceType':_0x2ffa87['device'][_0x2069('0x37')],'formData':JSON[_0x2069('0x1c')](_0x42cd34[_0x2069('0x50')])};var _0x1e9a29={'ChatWebsiteId':_0x42cd34[_0x2069('0x5c')]['id'],'closed':![]};if(_0x42cd34[_0x2069('0x50')][_0x2069('0xac')]){_0x1e9a29['threadId']=_0x42cd34[_0x2069('0x50')][_0x2069('0xac')];return db[_0x2069('0xad')][_0x2069('0x59')]({'where':_0x1e9a29})[_0x2069('0x16')](function(_0x5cdd3f){if(_0x5cdd3f){return[_0x5cdd3f,![]];}_0x52ebd9['threadId']=_0x42cd34[_0x2069('0x50')][_0x2069('0xac')];_0x52ebd9[_0x2069('0xae')]=_0x42cd34[_0x2069('0x50')]['externalUrl'];return db[_0x2069('0xad')]['create'](_0x52ebd9)[_0x2069('0x16')](function(_0x252dcf){return[_0x252dcf,!![]];});});}_0x1e9a29['ContactId']=_0x4a7453['id'];if(_0x42cd34[_0x2069('0x50')]['interaction']&&_0x42cd34[_0x2069('0x50')][_0x2069('0xaf')]['id']){_0x1e9a29['id']=_0x42cd34[_0x2069('0x50')][_0x2069('0xaf')]['id'];return db[_0x2069('0xad')][_0x2069('0x59')]({'where':_0x1e9a29})[_0x2069('0x16')](function(_0x4d7c3d){if(_0x4d7c3d){return[_0x4d7c3d,![]];}return db[_0x2069('0xad')]['create'](_0x52ebd9)[_0x2069('0x16')](function(_0x6b792f){return[_0x6b792f,!![]];});});}return db[_0x2069('0xad')][_0x2069('0x4f')](_0x52ebd9)[_0x2069('0x16')](function(_0x5e526f){return[_0x5e526f,!![]];});}})[_0x2069('0xb0')](function(_0x92e3b,_0x24285f){if(_0x92e3b){_0x596e64=_0x24285f;if(!_0x24285f){var _0x172d44={'from':(_0x3823aa[_0x2069('0xb1')]['firstName']||'')+'\x20'+(_0x3823aa[_0x2069('0xb1')][_0x2069('0xb2')]||'')};if(_0x42cd34[_0x2069('0x50')][_0x2069('0xac')]&&_0x42cd34[_0x2069('0x50')][_0x2069('0xb3')]&&_0x42cd34[_0x2069('0x50')]['threadId']!=_0x42cd34[_0x2069('0x50')][_0x2069('0xb3')]){_0x172d44[_0x2069('0xac')]=_0x42cd34[_0x2069('0x50')][_0x2069('0xb3')];}return _0x92e3b[_0x2069('0x2b')](_0x172d44);}else{return _0x92e3b;}}})[_0x2069('0x16')](function(_0x1ba0a6){_0x3823aa[_0x2069('0xaf')]=_0x1ba0a6[_0x2069('0x2d')]({'plain':!![]});_0x3823aa['interaction'][_0x2069('0xb4')]=_0x596e64;if(_0x3823aa['interaction']['created']){if(_0x3823aa['account']['autoclose']){_0x3823aa[_0x2069('0x99')][_0x2069('0xb5')]({'id':0x0,'priority':_0x3823aa['applications'][_0x2069('0x3f')]+0x1,'app':_0x2069('0xb6'),'appdata':_0x2069('0xb7'),'interval':_0x2069('0xb8')});}}return db['ChatMessage'][_0x2069('0x4f')]({'body':_0x42cd34[_0x2069('0x50')][_0x2069('0x50')],'ChatWebsiteId':_0x42cd34[_0x2069('0x5c')]['id'],'ChatInteractionId':_0x1ba0a6['id'],'direction':'in','ContactId':_0x3823aa['contact']['id'],'AttachmentId':_0x42cd34[_0x2069('0x50')][_0x2069('0xb9')]});})[_0x2069('0x16')](function(_0xadd14d){_0x3823aa[_0x2069('0x1f')]=_0xadd14d;if(_0x3823aa['interaction'][_0x2069('0xba')]){return db['User'][_0x2069('0x59')]({'attributes':['id','name'],'where':{'id':_0x3823aa['interaction'][_0x2069('0xba')]}})[_0x2069('0x16')](function(_0x240256){if(_0x240256){_0x3823aa[_0x2069('0x99')]['unshift']({'id':0x0,'priority':0x0,'app':_0x2069('0xbb'),'appdata':_0x240256[_0x2069('0x31')]+','+(_0x3823aa[_0x2069('0x9c')][_0x2069('0xbc')]||0xa),'interval':'*,*,*,*'});_0x3823aa[_0x2069('0xbd')]=!![];}return respondWithRpcPromise(_0x2069('0xbe'),_0x2069('0xbf'),_0x3823aa);});}return respondWithRpcPromise(_0x2069('0xbe'),_0x2069('0xbf'),_0x3823aa);})[_0x2069('0x16')](function(_0x3d7764){respondWithRpcPromise(_0x2069('0xc0'),_0x2069('0xc0'),{'event':_0x2069('0x80'),'message':_0x3d7764},client9002);return _0x3d7764;})['then'](respondWithResult(_0x2308ea,null))[_0x2069('0x20')](handleError(_0x2308ea,null));};exports[_0x2069('0xc1')]=function(_0x378292,_0x2fdc71){var _0xb1ffd2,_0x42f4ec,_0xc5af88;var _0x4c3441=[];var _0x34bcbb={};var _0x400759=_0x378292[_0x2069('0xc2')]||[];var _0x5bb1d2=[];var _0x64bc93;return db[_0x2069('0x86')][_0x2069('0x57')]()[_0x2069('0x16')](function(_0x27db79){if(!_0x27db79){throw new db[(_0x2069('0x87'))][(_0x2069('0x88'))]('no\x20available\x20attributes');}_0x4c3441=_[_0x2069('0x8a')](_[_0x2069('0x3b')](_0x27db79),[_0x2069('0x8b'),_0x2069('0x8c'),_0x2069('0xc3'),_0x2069('0x8d')]);if(_0x378292['body']['id']){delete _0x378292[_0x2069('0x50')]['id'];}if(_[_0x2069('0x78')](_0x378292[_0x2069('0x50')][_0x2069('0x9d')])){throw _0x2fdc71['status'](0x1f4)[_0x2069('0x32')](new db[(_0x2069('0x87'))][(_0x2069('0x88'))]('from\x20is\x20mandatory'));}if(_[_0x2069('0x78')](_0x378292[_0x2069('0x50')][_0x2069('0x50')])||_0x378292[_0x2069('0x50')]['body']===''){throw _0x2fdc71['status'](0x1f4)[_0x2069('0x32')](new db['Sequelize'][(_0x2069('0x88'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x2069('0x78')](_0x378292['body']['mapKeyOffline'])){throw _0x2fdc71['status'](0x1f4)[_0x2069('0x32')](new db['Sequelize']['ValidationError'](_0x2069('0xc4')+_0x4c3441));}if(!_[_0x2069('0x90')](_0x4c3441,_0x378292[_0x2069('0x50')][_0x2069('0xc5')])){throw _0x2fdc71['status'](0x1f4)[_0x2069('0x32')](new db[(_0x2069('0x87'))][(_0x2069('0x88'))](_0x2069('0xc6')+_0x4c3441));}_0x34bcbb[_0x378292['body'][_0x2069('0xc5')]]=_0x378292['body'][_0x2069('0x9d')];})[_0x2069('0x16')](function(){return db[_0x2069('0x35')][_0x2069('0x59')]({'where':{'id':_0x378292[_0x2069('0x5c')]['id']},'include':[{'model':db[_0x2069('0x93')],'as':'List'},{'model':db[_0x2069('0xc7')],'as':_0x2069('0xc7')}]});})[_0x2069('0x16')](handleEntityNotFound(_0x2fdc71,null))[_0x2069('0x16')](function(_0x61601c){if(_0x61601c&&_0x61601c[_0x2069('0x94')]){_0x42f4ec=_0x61601c;var _0x348858=_[_0x2069('0xd')](_0x378292[_0x2069('0x50')],{'firstName':_0x378292[_0x2069('0x50')][_0x2069('0x9d')],'phone':_0x378292['body'][_0x2069('0x9d')],'ListId':_0x61601c['ListId']});_0x348858[_0x378292['body'][_0x2069('0xc5')]]=_0x378292[_0x2069('0x50')][_0x2069('0x9d')];return db[_0x2069('0x86')][_0x2069('0xc8')]({'where':_0x34bcbb,'defaults':_0x348858});}})[_0x2069('0xb0')](function(_0x4e2e59){if(_0x4e2e59){_0xc5af88=_0x4e2e59;var _0x123104=fs[_0x2069('0xc9')](path['join'](config[_0x2069('0x6f')],_0x2069('0xca')),'utf8');var _0xc6da50=ejs['render'](_0x123104,{'body':_[_0x2069('0xcb')](_0x378292[_0x2069('0x50')]['body']),'bodyTitle':_0x42f4ec['offlineMessageBody']});return db[_0x2069('0xcc')][_0x2069('0x4f')]({'body':_0xc6da50,'plainBody':htmlToText['fromString'](_0xc6da50),'ContactId':_0x4e2e59['id'],'ChatWebsiteId':_0x42f4ec['id']});}})[_0x2069('0x16')](function(_0x4c063f){_0x64bc93=_0x4c063f;if(_0x400759[_0x2069('0x3f')]){var _0x482bf1=_0x400759[_0x2069('0x34')](function(_0x4439de){return{'name':_0x4439de[_0x2069('0xcd')],'basename':_0x4439de['filename'],'type':_0x4439de[_0x2069('0xce')],'ChatOfflineMessageId':_0x4c063f['id']};});_0x5bb1d2=_0x482bf1[_0x2069('0x34')](_0x15fc66=>{var _0x2010ab={'filename':_0x15fc66['name'],'path':path[_0x2069('0x76')](config[_0x2069('0x6f')],'server',_0x2069('0xc2'),'attachments',_0x2069('0xcf'),_0x15fc66[_0x2069('0xd0')])};return _0x2010ab;});if(!_0x42f4ec[_0x2069('0xd1')]){return db[_0x2069('0xd2')][_0x2069('0xd3')](function(_0x372b9b){return db[_0x2069('0xd4')][_0x2069('0xd5')](_0x482bf1,{'transaction':_0x372b9b});});}}})[_0x2069('0x16')](function(){if(_0x64bc93){_0xb1ffd2=_0x64bc93;return db[_0x2069('0xc7')][_0x2069('0x62')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x2069('0xd6'),'raw':!![],'include':[{'model':db[_0x2069('0xd7')],'as':_0x2069('0xd7'),'raw':!![]}]}]});}})[_0x2069('0x16')](function(_0x126b4e){if(_0x126b4e&&_0x126b4e[_0x2069('0xd6')]&&_0x42f4ec[_0x2069('0xd8')]&&_0x42f4ec[_0x2069('0xd9')]){var _0x196677=_0x126b4e['getSmtpOptions']();return respondWithRpcPromise(_0x2069('0xda'),'sendMail',{'account':_0x196677,'message':{'from':util[_0x2069('0xdb')](_0x2069('0xdc'),_0x126b4e[_0x2069('0x31')],_0x126b4e[_0x2069('0xdd')]||_0x126b4e[_0x2069('0xd6')]['user']),'to':_0x42f4ec[_0x2069('0xd9')],'subject':_0x42f4ec[_0x2069('0xde')],'html':_0xb1ffd2[_0x2069('0x50')],'attachments':_0x5bb1d2}},client9003)['then'](function(){return _0xb1ffd2;})[_0x2069('0x20')](function(_0x463a3e){logger[_0x2069('0x1d')](_0x463a3e);});}})[_0x2069('0x16')](function(){if(_0x42f4ec&&_0x42f4ec[_0x2069('0xd1')]&&_0x42f4ec['MailAccountId']){var _0x1bf022=[];if(_0x400759['length']){_0x1bf022=_0x400759[_0x2069('0x34')](function(_0x102d5a){return{'name':_0x102d5a[_0x2069('0xcd')],'basename':_0x102d5a[_0x2069('0x68')],'type':_0x102d5a[_0x2069('0xce')],'ChatOfflineMessageId':_0x64bc93['id']};});}var _0x52d730;if(!_[_0x2069('0x78')](_0x42f4ec[_0x2069('0xdf')])){var _0x2e0778=_[_0x2069('0x34')](_0x378292[_0x2069('0x50')],function(_0x51e5d9){return _0x51e5d9;});var _0x6cb6be=_[_0x2069('0xe0')](_0x2e0778)[0x0];var _0x2d2e40=_[_0x2069('0xe1')](_0x6cb6be,function(_0x42ac3a){return _0x42ac3a;});_0x52d730=_0x2d2e40[0x1][_0x42f4ec[_0x2069('0xdf')]];}var _0x3cf230={'from':_0xc5af88['email'],'firstName':_0xc5af88['firstName'],'lastName':_0xc5af88[_0x2069('0xb2')],'mapKey':_0x2069('0xdd'),'message':{'from':_0xc5af88[_0x2069('0xdd')],'to':_0x42f4ec[_0x2069('0xc7')][_0x2069('0xdd')],'cc':'','subject':_[_0x2069('0x78')](_0x52d730)?_0x42f4ec[_0x2069('0xde')]:_0x52d730,'messageId':'','sentAt':new Date(),'attach':_0x1bf022['length'],'attachments':_0x1bf022,'originChannel':_0x2069('0xe2'),'ChatWebsiteId':_0x42f4ec['id'],'ChatOfflineMessageId':_0xb1ffd2['id'],'originTo':_0x42f4ec[_0x2069('0xc7')][_0x2069('0xdd')]},'body':_0xb1ffd2[_0x2069('0x50')]};var _0x288eed={'account':{'id':_0x42f4ec['MailAccountId']},'body':_0x3cf230,'log':_0x2069('0xe3')};return respondWithRpcPromise(_0x2069('0xe3'),'notifyMail',_0x288eed,client9001)[_0x2069('0x16')](function(){return _0xb1ffd2;})[_0x2069('0x20')](function(_0x3c45d6){logger[_0x2069('0x1d')](_0x3c45d6);});}return;})[_0x2069('0x16')](function(){if(_0xb1ffd2){return _0xb1ffd2;}})['then'](respondWithResult(_0x2fdc71,null))[_0x2069('0x20')](function(_0x407ff3){logger['error'](_0x2069('0x20'),_0x407ff3);for(var _0x3aa142 of _0x400759){var _0x37a051=path[_0x2069('0x76')](config['root'],_0x2069('0xe4'),_0x2069('0xc2'),_0x2069('0xe5'),'offline-chat',_0x3aa142[_0x2069('0x68')]);fs_extra[_0x2069('0xe6')](_0x37a051)[_0x2069('0x20')](function(_0x3d797d){logger[_0x2069('0x1d')]('Could\x20not\x20remove\x20attachment\x20file',_0x37a051,_0x3d797d);});}});};exports[_0x2069('0xe7')]=function(_0x54e187,_0x115de0){return db['ChatInteraction'][_0x2069('0x59')]({'where':{'id':_0x54e187[_0x2069('0x5c')]['id']}})[_0x2069('0x16')](handleEntityNotFound(_0x115de0,null))[_0x2069('0x16')](function(_0x3040c2){if(_0x3040c2){return _0x3040c2[_0x2069('0xe7')](_0x54e187['body'][_0x2069('0x5f')],_[_0x2069('0xe8')](_0x54e187['body'],[_0x2069('0x5f'),'id'])||{});}})[_0x2069('0x16')](respondWithResult(_0x115de0,null))[_0x2069('0x20')](handleError(_0x115de0,null));};exports[_0x2069('0xe9')]=function(_0x5c7d41,_0x2b981d){var _0x85add7={'raw':![],'where':{}};var _0xc2f4f8={};var _0x434f26={'count':0x0,'rows':[]};return db[_0x2069('0x35')][_0x2069('0x62')]({'where':{'id':_0x5c7d41[_0x2069('0x5c')]['id']}})[_0x2069('0x16')](handleEntityNotFound(_0x2b981d,null))['then'](function(_0x5403fb){if(_0x5403fb){_0xc2f4f8[_0x2069('0x39')]=_['keys'](db[_0x2069('0xad')][_0x2069('0x36')]);_0xc2f4f8['query']=_[_0x2069('0x3b')](_0x5c7d41[_0x2069('0x3a')]);_0xc2f4f8['filters']=_['intersection'](_0xc2f4f8['model'],_0xc2f4f8['query']);_0x85add7[_0x2069('0x3e')]=_['intersection'](_0xc2f4f8[_0x2069('0x39')],qs[_0x2069('0x4e')](_0x5c7d41[_0x2069('0x3a')][_0x2069('0x4e')]));_0x85add7[_0x2069('0x3e')]=_0x85add7[_0x2069('0x3e')]['length']?_0x85add7['attributes']:_0xc2f4f8[_0x2069('0x39')];if(!_0x5c7d41[_0x2069('0x3a')][_0x2069('0x40')](_0x2069('0x41'))){_0x85add7[_0x2069('0x26')]=qs[_0x2069('0x26')](_0x5c7d41[_0x2069('0x3a')][_0x2069('0x26')]);_0x85add7[_0x2069('0x25')]=qs[_0x2069('0x25')](_0x5c7d41['query']['offset']);}_0x85add7[_0x2069('0x42')]=qs['sort'](_0x5c7d41[_0x2069('0x3a')][_0x2069('0x43')]);_0x85add7[_0x2069('0x45')]=qs['filters'](_[_0x2069('0x5d')](_0x5c7d41[_0x2069('0x3a')],_0xc2f4f8[_0x2069('0x3c')]));_0x85add7[_0x2069('0x45')][_0x2069('0x5a')]=_0x5403fb['id'];if(_0x5c7d41[_0x2069('0x3a')][_0x2069('0x46')]){_0x85add7[_0x2069('0x45')]=_[_0x2069('0x44')](_0x85add7[_0x2069('0x45')],{'$or':_[_0x2069('0x34')](_0x85add7[_0x2069('0x3e')],function(_0x53a1e8){var _0x5f2759={};_0x5f2759[_0x53a1e8]={'$like':'%'+_0x5c7d41[_0x2069('0x3a')][_0x2069('0x46')]+'%'};return _0x5f2759;})});}_0x85add7=_['merge']({},_0x85add7,_0x5c7d41[_0x2069('0x47')]);return db[_0x2069('0xad')][_0x2069('0x28')]({'where':_0x85add7[_0x2069('0x45')]})[_0x2069('0x16')](function(_0x2c522b){_0x434f26[_0x2069('0x28')]=_0x2c522b;if(_0x5c7d41['query']['includeAll']){_0x85add7['include']=[{'model':db[_0x2069('0x86')],'as':_0x2069('0xea'),'required':![]},{'model':db['User'],'as':_0x2069('0xeb'),'attributes':['name','fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x2069('0xec'),'attributes':['id',_0x2069('0x31'),_0x2069('0xed')],'where':_0x5c7d41[_0x2069('0x3a')][_0x2069('0xee')]?{'id':_0x5c7d41['query'][_0x2069('0xee')]}:undefined,'required':_0x5c7d41[_0x2069('0x3a')][_0x2069('0xee')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x85add7);})[_0x2069('0x16')](function(_0x640f5b){_0x434f26[_0x2069('0x4b')]=_0x640f5b;return _0x434f26;});}})['then'](respondWithFilteredResult(_0x2b981d,_0x85add7))[_0x2069('0x20')](handleError(_0x2b981d,null));};function iftimePromise(_0x304199,_0x56180c){return respondWithRpcPromise(_0x2069('0xef'),_0x2069('0xf0'),{'command':_0x56180c['timezone']?util[_0x2069('0xdb')](_0x2069('0xf1'),_0x304199[_0x2069('0xf2')],_0x56180c[_0x2069('0xf3')]):util[_0x2069('0xdb')]('iftime\x20%s',_0x304199[_0x2069('0xf2')])},client9002)[_0x2069('0x16')](function(_0x5d94f7){var _0x5f160c=_0x5d94f7&&_0x5d94f7[_0x2069('0xf4')](_0x2069('0xf5'))>=0x0?!![]:![];logger[_0x2069('0x17')](_0x2069('0xf6'),_0x56180c['id'],_0x304199['id'],_0x304199[_0x2069('0xf2')],_0x5f160c?_0x2069('0xf7'):_0x2069('0xf8'),_0x56180c[_0x2069('0xf3')]?_0x56180c['timezone']:_0x2069('0xf9'));return _0x5f160c;})['catch'](function(_0x5c9dbf){logger[_0x2069('0x1d')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x56180c['id'],_0x304199['id'],_0x304199[_0x2069('0xf2')],util[_0x2069('0xfa')](_0x5c9dbf,{'showHidden':![],'depth':null}),_0x56180c[_0x2069('0xf3')]?_0x56180c['timezone']:_0x2069('0xf9'));return![];});}exports['getSnippet']=function(_0x596b94,_0x546f71){var _0x325376=0x0;var _0x294044=0x0;var _0x26a5bb=![];var _0x42c49d;var _0x4761a0;return db[_0x2069('0x35')][_0x2069('0x59')]({'where':{'id':_0x596b94[_0x2069('0x5c')]['id']},'include':[{'model':db[_0x2069('0xfb')],'as':'Interval','include':[{'model':db[_0x2069('0xfb')],'as':_0x2069('0xfc'),'attributes':['id',_0x2069('0xf2')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x546f71,null))[_0x2069('0x16')](function(_0x1c7a66){if(_0x1c7a66){_0x42c49d=_0x1c7a66;return _0x1c7a66[_0x2069('0xfd')]({'raw':!![]});}})[_0x2069('0x16')](function(_0x322cba){if(_0x42c49d){if(_0x322cba){_0x4761a0=_0x322cba;}}return require(_0x2069('0xfe'))['getLicense']();})[_0x2069('0x16')](function(_0x145975){if(_0x145975){_0x294044=_0x145975[_0x2069('0xff')];_0x26a5bb=_0x145975['custom'];}})[_0x2069('0x16')](function(){return db['ChatInteraction'][_0x2069('0x28')]({'where':{'closed':![]}});})[_0x2069('0x16')](function(_0x3c2ea2){_0x325376=_0x3c2ea2;if(_0x294044&&_0x3c2ea2>_0x294044){return db[_0x2069('0x100')][_0x2069('0x62')]({'where':{'id':0x1}})[_0x2069('0x16')](function(_0x4da9d8){if(_0x4da9d8){_0x4da9d8[_0x2069('0x101')](_0x2069('0x102'));}});}})[_0x2069('0x16')](function(){if(_0x42c49d[_0x2069('0xfb')]&&_0x42c49d['Interval'][_0x2069('0xfc')]){var _0x3366cf=[];for(var _0x1c7fe7=0x0;_0x1c7fe7<_0x42c49d[_0x2069('0xfb')][_0x2069('0xfc')][_0x2069('0x3f')];_0x1c7fe7++){var _0x1b5815=_0x42c49d[_0x2069('0xfb')]['Intervals'][_0x1c7fe7][_0x2069('0x2d')]({'plain':!![]});_0x3366cf[_0x2069('0xb5')](iftimePromise(_0x1b5815,_0x42c49d));}return BPromise[_0x2069('0x103')](_0x3366cf)['then'](function(_0x2c89b9){return _[_0x2069('0x104')](_0x2c89b9);});}else{return!![];}})[_0x2069('0x16')](function(_0x4ab06a){var _0xeb29b=fs[_0x2069('0xc9')](path[_0x2069('0x76')](config['root'],_0x2069('0x105')),'utf8');var _0x207a4a={'remote':_0x42c49d[_0x2069('0x106')],'query':querystring['stringify'](_[_0x2069('0x44')](_0x42c49d[_0x2069('0x2d')]({'plain':!![]}),{'customerIp':_0x596b94['headers']['x-forwarded-for']||_0x596b94['headers'][_0x2069('0x107')]||_0x596b94[_0x2069('0x108')][_0x2069('0x109')]||_0x596b94['ip'],'referer':_0x596b94[_0x2069('0x9f')][_0x2069('0xa4')],'openedInteractions':_0x325376,'maxInteractions':_0x294044,'virtual':_0x26a5bb[_0x2069('0xff')],'online':_0x4ab06a,'custom':_0x26a5bb}))[_0x2069('0x10a')](/'/g,'\x5c\x27')};_0x546f71[_0x2069('0x32')](ejs[_0x2069('0x10b')](Mustache['render'](_0xeb29b,_0x207a4a),{'proactiveActions':_0x4761a0,'alignment':_0x42c49d[_0x2069('0x10c')],'verticalAlignment':_0x42c49d[_0x2069('0x10d')],'div_color':_0x42c49d[_0x2069('0xed')],'labelText':_0x42c49d[_0x2069('0x10e')],'text_color':_0x42c49d[_0x2069('0x10f')],'text_button_color':_0x42c49d[_0x2069('0x110')],'button_color':_0x42c49d['color_button'],'background_color':_0x42c49d[_0x2069('0x111')],'hideWhenOffline':_0x42c49d['hideWhenOffline'],'interval':_0x42c49d['IntervalId']}));})[_0x2069('0x20')](handleError(_0x546f71,null));};exports[_0x2069('0x112')]=function(_0x1fb637,_0xc4c9cf){var _0x6c0f4f=_0x1fb637['params']['id'];var _0x243d19=_0x1fb637['body'];var _0xe52638=0xc8;var _0x4e143a=null;return db[_0x2069('0xd2')][_0x2069('0xd3')]({'isolationLevel':db[_0x2069('0xd2')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x373008){return db['ChatWebsite'][_0x2069('0x62')]({'where':{'id':_0x6c0f4f},'transaction':_0x373008})['then'](function(_0x1098f2){if(_0x1098f2){return db['ChatApplication'][_0x2069('0x2c')]({'where':{'ChatWebsiteId':_0x6c0f4f},'transaction':_0x373008})['then'](function(){var _0x3734b3=_[_0x2069('0x34')](_0x243d19,function(_0x58fb56){_0x58fb56[_0x2069('0x5a')]=_0x6c0f4f;return _0x58fb56;});return db[_0x2069('0x97')][_0x2069('0xd5')](_0x3734b3,{'transaction':_0x373008});});}else{_0xe52638=0x194;_0x4e143a=[];}});})[_0x2069('0x16')](function(){if(_0xe52638!==0x194){return db[_0x2069('0x97')][_0x2069('0x113')]({'where':{'ChatWebsiteId':_0x6c0f4f},'order':'priority'})[_0x2069('0x16')](function(_0x95c1f0){_0x4e143a=_0x95c1f0;});}})[_0x2069('0x20')](function(_0x5c7f32){_0xe52638=0x1f4;logger[_0x2069('0x1d')](_0x5c7f32[_0x2069('0x30')]);if(_0x5c7f32[_0x2069('0x31')]){delete _0x5c7f32[_0x2069('0x31')];}_0x4e143a=_0x5c7f32;})[_0x2069('0x114')](function(){if(_0x4e143a===null){_0xc4c9cf['sendStatus'](_0xe52638);}else{if(_0xe52638===0x1f4){_0xc4c9cf[_0x2069('0x23')](_0xe52638)[_0x2069('0x32')](_0x4e143a);}else{_0xc4c9cf[_0x2069('0x23')](_0xe52638)[_0x2069('0x24')](_0x4e143a);}}});};exports[_0x2069('0x115')]=function(_0x42c272,_0x2a048f){var _0x13b29a={};var _0x3af982={};var _0x327bcd;var _0x13637d;return db[_0x2069('0x35')][_0x2069('0x62')]({'where':{'id':_0x42c272[_0x2069('0x5c')]['id']}})[_0x2069('0x16')](handleEntityNotFound(_0x2a048f,null))[_0x2069('0x16')](function(_0x670435){if(_0x670435){_0x327bcd=_0x670435;_0x3af982[_0x2069('0x39')]=_[_0x2069('0x3b')](db[_0x2069('0x97')]['rawAttributes']);_0x3af982[_0x2069('0x3a')]=_[_0x2069('0x3b')](_0x42c272[_0x2069('0x3a')]);_0x3af982[_0x2069('0x3c')]=_['intersection'](_0x3af982['model'],_0x3af982[_0x2069('0x3a')]);_0x13b29a[_0x2069('0x3e')]=_[_0x2069('0x3d')](_0x3af982[_0x2069('0x39')],qs[_0x2069('0x4e')](_0x42c272['query'][_0x2069('0x4e')]));_0x13b29a[_0x2069('0x3e')]=_0x13b29a['attributes'][_0x2069('0x3f')]?_0x13b29a[_0x2069('0x3e')]:_0x3af982['model'];_0x13b29a[_0x2069('0x42')]=qs[_0x2069('0x43')](_0x42c272[_0x2069('0x3a')][_0x2069('0x43')]);_0x13b29a[_0x2069('0x45')]=qs[_0x2069('0x3c')](_['pick'](_0x42c272[_0x2069('0x3a')],_0x3af982['filters']));if(_0x42c272[_0x2069('0x3a')][_0x2069('0x46')]){_0x13b29a[_0x2069('0x45')]=_['merge'](_0x13b29a[_0x2069('0x45')],{'$or':_['map'](_0x13b29a[_0x2069('0x3e')],function(_0x2e8676){var _0x3c48b5={};_0x3c48b5[_0x2e8676]={'$like':'%'+_0x42c272[_0x2069('0x3a')]['filter']+'%'};return _0x3c48b5;})});}_0x13b29a=_[_0x2069('0x44')]({},_0x13b29a,_0x42c272[_0x2069('0x47')]);return _0x327bcd['getApplications'](_0x13b29a);}})['then'](function(_0x728314){if(_0x728314){_0x13637d=_0x728314[_0x2069('0x3f')];if(!_0x42c272['query'][_0x2069('0x40')](_0x2069('0x41'))){_0x13b29a[_0x2069('0x26')]=qs['limit'](_0x42c272[_0x2069('0x3a')][_0x2069('0x26')]);_0x13b29a['offset']=qs[_0x2069('0x25')](_0x42c272[_0x2069('0x3a')][_0x2069('0x25')]);}return _0x327bcd[_0x2069('0x115')](_0x13b29a);}})['then'](function(_0x48560e){if(_0x48560e){return _0x48560e?{'count':_0x13637d,'rows':_0x48560e}:null;}})[_0x2069('0x16')](respondWithResult(_0x2a048f,null))['catch'](handleError(_0x2a048f,null));};exports[_0x2069('0x116')]=function(_0x35cf6a,_0x5e716e){return db[_0x2069('0x117')][_0x2069('0x59')]({'where':{'id':_0x35cf6a[_0x2069('0x5c')]['id']}})[_0x2069('0x16')](handleEntityNotFound(_0x5e716e,null))[_0x2069('0x16')](function(_0xbadaeb){if(_0xbadaeb){return _0xbadaeb['addProactiveActions'](_0x35cf6a[_0x2069('0x50')][_0x2069('0x5f')],_[_0x2069('0xe8')](_0x35cf6a[_0x2069('0x50')],['ids','id'])||{});}})[_0x2069('0x16')](respondWithResult(_0x5e716e,null))[_0x2069('0x20')](handleError(_0x5e716e,null));};exports[_0x2069('0xfd')]=function(_0x27d043,_0x30ceac){var _0x42b7bc={};var _0x12e786={};var _0x348591;var _0x51adbb;return db[_0x2069('0x35')][_0x2069('0x62')]({'where':{'id':_0x27d043[_0x2069('0x5c')]['id']}})[_0x2069('0x16')](handleEntityNotFound(_0x30ceac,null))[_0x2069('0x16')](function(_0x3036e2){if(_0x3036e2){_0x348591=_0x3036e2;_0x12e786[_0x2069('0x39')]=_[_0x2069('0x3b')](db[_0x2069('0x118')]['rawAttributes']);_0x12e786[_0x2069('0x3a')]=_[_0x2069('0x3b')](_0x27d043[_0x2069('0x3a')]);_0x12e786[_0x2069('0x3c')]=_[_0x2069('0x3d')](_0x12e786['model'],_0x12e786['query']);_0x42b7bc[_0x2069('0x3e')]=_['intersection'](_0x12e786[_0x2069('0x39')],qs['fields'](_0x27d043[_0x2069('0x3a')][_0x2069('0x4e')]));_0x42b7bc['attributes']=_0x42b7bc[_0x2069('0x3e')][_0x2069('0x3f')]?_0x42b7bc[_0x2069('0x3e')]:_0x12e786[_0x2069('0x39')];_0x42b7bc['order']=qs[_0x2069('0x43')](_0x27d043['query'][_0x2069('0x43')]);_0x42b7bc[_0x2069('0x45')]=qs[_0x2069('0x3c')](_['pick'](_0x27d043[_0x2069('0x3a')],_0x12e786['filters']));if(_0x27d043['query']['filter']){_0x42b7bc['where']=_[_0x2069('0x44')](_0x42b7bc[_0x2069('0x45')],{'$or':_['map'](_0x42b7bc[_0x2069('0x3e')],function(_0x53dafd){var _0x3b49c7={};_0x3b49c7[_0x53dafd]={'$like':'%'+_0x27d043[_0x2069('0x3a')][_0x2069('0x46')]+'%'};return _0x3b49c7;})});}_0x42b7bc=_[_0x2069('0x44')]({},_0x42b7bc,_0x27d043[_0x2069('0x47')]);return _0x348591[_0x2069('0xfd')](_0x42b7bc);}})[_0x2069('0x16')](function(_0x545ff7){if(_0x545ff7){_0x51adbb=_0x545ff7['length'];if(!_0x27d043[_0x2069('0x3a')][_0x2069('0x40')]('nolimit')){_0x42b7bc['limit']=qs['limit'](_0x27d043[_0x2069('0x3a')][_0x2069('0x26')]);_0x42b7bc[_0x2069('0x25')]=qs[_0x2069('0x25')](_0x27d043[_0x2069('0x3a')][_0x2069('0x25')]);}return _0x348591[_0x2069('0xfd')](_0x42b7bc);}})['then'](function(_0x1fbede){if(_0x1fbede){return _0x1fbede?{'count':_0x51adbb,'rows':_0x1fbede}:null;}})[_0x2069('0x16')](respondWithResult(_0x30ceac,null))['catch'](handleError(_0x30ceac,null));};exports[_0x2069('0x119')]=function(_0x1483ee,_0x34c716){var _0xfc462b=_0x1483ee[_0x2069('0x3a')]['online']===_0x2069('0x11a')?'offlineForm':'onlineForm';return db[_0x2069('0x35')][_0x2069('0x59')]({'attributes':['id',_0xfc462b],'where':{'id':_0x1483ee[_0x2069('0x5c')]['id']}})['then'](handleEntityNotFound(_0x34c716,null))[_0x2069('0x16')](function(_0x446f20){if(_0x446f20){var _0x4adb88=_0x446f20[_0xfc462b];var _0x3cc7c5=_0x4adb88&&_0x4adb88[_0x2069('0x11b')]?_0x4adb88[_0x2069('0x11b')]:[];_0x34c716[_0x2069('0x32')]({'fromKey':_[_0x2069('0x78')](_0x4adb88[_0x2069('0x11c')])?undefined:_0x4adb88[_0x2069('0x11c')],'count':_0x3cc7c5[_0x2069('0x3f')],'rows':_0x3cc7c5});}})[_0x2069('0x20')](handleError(_0x34c716,null));};exports['getOfflineMessages']=function(_0x20b0b8,_0x4e515d){var _0x24e451={'raw':![],'where':{}};var _0x12a586={};var _0x3715db={'count':0x0,'rows':[]};return db[_0x2069('0x35')][_0x2069('0x62')]({'where':{'id':_0x20b0b8[_0x2069('0x5c')]['id']}})[_0x2069('0x16')](handleEntityNotFound(_0x4e515d,null))['then'](function(_0x57e5bb){if(_0x57e5bb){_0x12a586[_0x2069('0x39')]=_[_0x2069('0x3b')](db[_0x2069('0xcc')][_0x2069('0x36')]);_0x12a586[_0x2069('0x3a')]=_[_0x2069('0x3b')](_0x20b0b8[_0x2069('0x3a')]);_0x12a586[_0x2069('0x3c')]=_[_0x2069('0x3d')](_0x12a586[_0x2069('0x39')],_0x12a586[_0x2069('0x3a')]);_0x24e451['attributes']=_[_0x2069('0x3d')](_0x12a586['model'],qs['fields'](_0x20b0b8[_0x2069('0x3a')][_0x2069('0x4e')]));_0x24e451[_0x2069('0x3e')]=_0x24e451[_0x2069('0x3e')][_0x2069('0x3f')]?_0x24e451[_0x2069('0x3e')]:_0x12a586[_0x2069('0x39')];if(!_0x20b0b8[_0x2069('0x3a')]['hasOwnProperty'](_0x2069('0x41'))){_0x24e451[_0x2069('0x26')]=qs[_0x2069('0x26')](_0x20b0b8['query'][_0x2069('0x26')]);_0x24e451[_0x2069('0x25')]=qs[_0x2069('0x25')](_0x20b0b8[_0x2069('0x3a')]['offset']);}_0x24e451[_0x2069('0x42')]=qs[_0x2069('0x43')](_0x20b0b8[_0x2069('0x3a')]['sort']);_0x24e451[_0x2069('0x45')]=qs[_0x2069('0x3c')](_[_0x2069('0x5d')](_0x20b0b8[_0x2069('0x3a')],_0x12a586['filters']));_0x24e451[_0x2069('0x45')]['ChatWebsiteId']=_0x57e5bb['id'];if(_0x20b0b8[_0x2069('0x3a')]['filter']){_0x24e451[_0x2069('0x45')]=_[_0x2069('0x44')](_0x24e451[_0x2069('0x45')],{'$or':_[_0x2069('0x34')](_0x24e451[_0x2069('0x3e')],function(_0x1c6589){var _0x5514b9={};_0x5514b9[_0x1c6589]={'$like':'%'+_0x20b0b8[_0x2069('0x3a')][_0x2069('0x46')]+'%'};return _0x5514b9;})});}_0x24e451=_['merge']({},_0x24e451,_0x20b0b8[_0x2069('0x47')]);return db[_0x2069('0xcc')]['count']({'where':_0x24e451['where']})[_0x2069('0x16')](function(_0x552bdd){_0x3715db['count']=_0x552bdd;if(_0x20b0b8['query'][_0x2069('0x48')]){_0x24e451['include']=[{'all':!![]}];}else{_0x24e451[_0x2069('0x49')]=[{'model':db[_0x2069('0x86')],'as':_0x2069('0xea'),'required':![]},{'model':db[_0x2069('0xd4')],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage'][_0x2069('0x4a')](_0x24e451);})['then'](function(_0x2bf5b6){_0x3715db['rows']=_0x2bf5b6;return _0x3715db;});}})[_0x2069('0x16')](respondWithFilteredResult(_0x4e515d,_0x24e451))[_0x2069('0x20')](handleError(_0x4e515d,null));};exports[_0x2069('0x11d')]=function(_0x249d55,_0x3ddc8f){return db[_0x2069('0x35')][_0x2069('0x59')]({'where':{'id':_0x249d55[_0x2069('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3ddc8f,null))[_0x2069('0x16')](function(_0x41dc05){if(_0x41dc05){return _0x41dc05['addAgents'](_0x249d55[_0x2069('0x50')]['ids'],_[_0x2069('0xe8')](_0x249d55[_0x2069('0x50')],[_0x2069('0x5f'),'id'])||{})[_0x2069('0xb0')](function(_0x3da3a7){for(var _0x11e338=0x0;_0x11e338<_0x249d55[_0x2069('0x50')]['ids']['length'];_0x11e338+=0x1){socket[_0x2069('0x11e')]('userChatWebsite:save',{'UserId':Number(_0x249d55[_0x2069('0x50')][_0x2069('0x5f')][_0x11e338]),'ChatWebsiteId':Number(_0x249d55[_0x2069('0x5c')]['id'])});}return _0x3da3a7;});}})[_0x2069('0x16')](respondWithResult(_0x3ddc8f,null))[_0x2069('0x20')](handleError(_0x3ddc8f,null));};exports[_0x2069('0x11f')]=function(_0x35ab28,_0x1f5534){return db['ChatWebsite'][_0x2069('0x59')]({'where':{'id':_0x35ab28[_0x2069('0x5c')]['id']}})[_0x2069('0x16')](handleEntityNotFound(_0x1f5534,null))['then'](function(_0x279015){if(_0x279015){return _0x279015[_0x2069('0x11f')](_0x35ab28['query']['ids'])[_0x2069('0x16')](function(){if(_[_0x2069('0x120')](_0x35ab28[_0x2069('0x3a')][_0x2069('0x5f')])){for(var _0x32e933=0x0;_0x32e933<_0x35ab28[_0x2069('0x3a')]['ids'][_0x2069('0x3f')];_0x32e933+=0x1){socket['emit'](_0x2069('0x121'),{'UserId':Number(_0x35ab28[_0x2069('0x3a')][_0x2069('0x5f')][_0x32e933]),'ChatWebsiteId':Number(_0x35ab28[_0x2069('0x5c')]['id'])});}}else{socket[_0x2069('0x11e')]('userChatWebsite:remove',{'UserId':Number(_0x35ab28[_0x2069('0x3a')][_0x2069('0x5f')]),'ChatWebsiteId':Number(_0x35ab28[_0x2069('0x5c')]['id'])});}});}})[_0x2069('0x16')](respondWithStatusCode(_0x1f5534,null))['catch'](handleError(_0x1f5534,null));};exports['getAgents']=function(_0x5d5e25,_0x387adb){var _0x4ddada={};var _0xb49efc={};var _0x1ebed0;var _0x1906ff;return db[_0x2069('0x35')][_0x2069('0x62')]({'where':{'id':_0x5d5e25['params']['id']}})['then'](handleEntityNotFound(_0x387adb,null))[_0x2069('0x16')](function(_0xabb90e){if(_0xabb90e){_0x1ebed0=_0xabb90e;_0xb49efc['model']=_[_0x2069('0x3b')](db['User'][_0x2069('0x36')]);_0xb49efc[_0x2069('0x3a')]=_[_0x2069('0x3b')](_0x5d5e25[_0x2069('0x3a')]);_0xb49efc[_0x2069('0x3c')]=_[_0x2069('0x3d')](_0xb49efc[_0x2069('0x39')],_0xb49efc['query']);_0x4ddada[_0x2069('0x3e')]=_['intersection'](_0xb49efc[_0x2069('0x39')],qs[_0x2069('0x4e')](_0x5d5e25[_0x2069('0x3a')][_0x2069('0x4e')]));_0x4ddada[_0x2069('0x3e')]=_0x4ddada[_0x2069('0x3e')][_0x2069('0x3f')]?_0x4ddada[_0x2069('0x3e')]:_0xb49efc[_0x2069('0x39')];_0x4ddada['order']=qs[_0x2069('0x43')](_0x5d5e25['query'][_0x2069('0x43')]);_0x4ddada[_0x2069('0x45')]=qs['filters'](_[_0x2069('0x5d')](_0x5d5e25[_0x2069('0x3a')],_0xb49efc['filters']));if(_0x5d5e25[_0x2069('0x3a')][_0x2069('0x46')]){_0x4ddada[_0x2069('0x45')]=_[_0x2069('0x44')](_0x4ddada['where'],{'$or':_[_0x2069('0x34')](_0x4ddada['attributes'],function(_0x11953d){var _0x581b67={};_0x581b67[_0x11953d]={'$like':'%'+_0x5d5e25['query']['filter']+'%'};return _0x581b67;})});}_0x4ddada=_[_0x2069('0x44')]({},_0x4ddada,_0x5d5e25[_0x2069('0x47')]);return _0x1ebed0[_0x2069('0x122')](_0x4ddada);}})[_0x2069('0x16')](function(_0x2b0578){if(_0x2b0578){_0x1906ff=_0x2b0578[_0x2069('0x3f')];if(!_0x5d5e25['query']['hasOwnProperty'](_0x2069('0x41'))){_0x4ddada[_0x2069('0x26')]=qs[_0x2069('0x26')](_0x5d5e25['query'][_0x2069('0x26')]);_0x4ddada[_0x2069('0x25')]=qs['offset'](_0x5d5e25[_0x2069('0x3a')]['offset']);}return _0x1ebed0['getAgents'](_0x4ddada);}})[_0x2069('0x16')](function(_0x25cc9e){if(_0x25cc9e){return _0x25cc9e?{'count':_0x1906ff,'rows':_0x25cc9e}:null;}})[_0x2069('0x16')](respondWithResult(_0x387adb,null))['catch'](handleError(_0x387adb,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 29c3849..ca18671 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 _0xa4ba=['setMaxListeners','save','remove','emit','hook','../../mysqldb','ChatWebsite'];(function(_0xadf23b,_0x2511f1){var _0x36fb64=function(_0x3254c9){while(--_0x3254c9){_0xadf23b['push'](_0xadf23b['shift']());}};_0x36fb64(++_0x2511f1);}(_0xa4ba,0x1b7));var _0xaa4b=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xa4ba[_0x32f7d7];return _0x133d09;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xaa4b('0x0'))['db'][_0xaa4b('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xaa4b('0x2')](0x0);var events={'afterCreate':_0xaa4b('0x3'),'afterUpdate':'update','afterDestroy':_0xaa4b('0x4')};function emitEvent(_0x5e7bce){return function(_0x54f0ce,_0xeb83b1,_0x1b2ee8){ChatWebsiteEvents[_0xaa4b('0x5')](_0x5e7bce+':'+_0x54f0ce['id'],_0x54f0ce);ChatWebsiteEvents[_0xaa4b('0x5')](_0x5e7bce,_0x54f0ce);_0x1b2ee8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xaa4b('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0x61a5=['events','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5dc217,_0x260474){var _0x57bbe7=function(_0x5f078d){while(--_0x5f078d){_0x5dc217['push'](_0x5dc217['shift']());}};_0x57bbe7(++_0x260474);}(_0x61a5,0xf0));var _0x561a=function(_0x5d6280,_0x3f72ab){_0x5d6280=_0x5d6280-0x0;var _0x77b738=_0x61a5[_0x5d6280];return _0x77b738;};'use strict';var EventEmitter=require(_0x561a('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x561a('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x561a('0x2')](0x0);var events={'afterCreate':_0x561a('0x3'),'afterUpdate':_0x561a('0x4'),'afterDestroy':_0x561a('0x5')};function emitEvent(_0x58f636){return function(_0xe92b4d,_0x33c0f5,_0x5b9ca9){ChatWebsiteEvents[_0x561a('0x6')](_0x58f636+':'+_0xe92b4d['id'],_0xe92b4d);ChatWebsiteEvents[_0x561a('0x6')](_0x58f636,_0xe92b4d);_0x5b9ca9(null);};}for(var e in events){if(events[_0x561a('0x7')](e)){var event=events[e];ChatWebsite[_0x561a('0x8')](e,emitEvent(event));}}module[_0x561a('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 21f31cd..7592050 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 _0x1837=['util','api','moment','bluebird','request-promise','path','rimraf','exports','define','ChatWebsite','lodash'];(function(_0x134e51,_0x180acb){var _0x56c680=function(_0x357ef0){while(--_0x357ef0){_0x134e51['push'](_0x134e51['shift']());}};_0x56c680(++_0x180acb);}(_0x1837,0x1d8));var _0x7183=function(_0x4f7152,_0x6e2e36){_0x4f7152=_0x4f7152-0x0;var _0x112d12=_0x1837[_0x4f7152];return _0x112d12;};'use strict';var _=require(_0x7183('0x0'));var util=require(_0x7183('0x1'));var logger=require('../../config/logger')(_0x7183('0x2'));var moment=require(_0x7183('0x3'));var BPromise=require(_0x7183('0x4'));var rp=require(_0x7183('0x5'));var fs=require('fs');var path=require(_0x7183('0x6'));var rimraf=require(_0x7183('0x7'));var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module[_0x7183('0x8')]=function(_0x14a842,_0x4a0ab7){return _0x14a842[_0x7183('0x9')](_0x7183('0xa'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4806=['request-promise','path','rimraf','../../config/environment','exports','ChatWebsite','chat_websites','util','../../config/logger','moment','bluebird'];(function(_0x57c142,_0x1a8d59){var _0x38f66=function(_0x1a863f){while(--_0x1a863f){_0x57c142['push'](_0x57c142['shift']());}};_0x38f66(++_0x1a8d59);}(_0x4806,0x1d5));var _0x6480=function(_0x80c62,_0xe09ac2){_0x80c62=_0x80c62-0x0;var _0x1e36ab=_0x4806[_0x80c62];return _0x1e36ab;};'use strict';var _=require('lodash');var util=require(_0x6480('0x0'));var logger=require(_0x6480('0x1'))('api');var moment=require(_0x6480('0x2'));var BPromise=require(_0x6480('0x3'));var rp=require(_0x6480('0x4'));var fs=require('fs');var path=require(_0x6480('0x5'));var rimraf=require(_0x6480('0x6'));var config=require(_0x6480('0x7'));var attributes=require('./chatWebsite.attributes');module[_0x6480('0x8')]=function(_0x3ba60e,_0x1bafea){return _0x3ba60e['define'](_0x6480('0x9'),attributes,{'tableName':_0x6480('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 947ae9f..4574cb0 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 _0x5f82=['jayson/promise','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x2bf9dd,_0x1cf613){var _0x1bdcd3=function(_0x50dee5){while(--_0x50dee5){_0x2bf9dd['push'](_0x2bf9dd['shift']());}};_0x1bdcd3(++_0x1cf613);}(_0x5f82,0x161));var _0x25f8=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f82[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x25f8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x25f8('0x1'));var fs=require('fs');var Redis=require(_0x25f8('0x2'));var db=require(_0x25f8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x25f8('0x4'))(_0x25f8('0x5'));var config=require(_0x25f8('0x6'));var jayson=require(_0x25f8('0x7'));var client=jayson['client'][_0x25f8('0x8')]({'port':0x232a});config[_0x25f8('0x9')]=_[_0x25f8('0xa')](config[_0x25f8('0x9')],{'host':_0x25f8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x25f8('0x9')]));require(_0x25f8('0xc'))[_0x25f8('0xd')](socket);function respondWithRpcPromise(_0x432a1e,_0x21bce0,_0x4a8a6e){return new BPromise(function(_0x54fb7a,_0x3e42a7){return client[_0x25f8('0xe')](_0x432a1e,_0x4a8a6e)[_0x25f8('0xf')](function(_0x5bd70b){logger[_0x25f8('0x10')](_0x25f8('0x11'),_0x21bce0,'request\x20sent');logger['debug'](_0x25f8('0x12'),_0x21bce0,_0x25f8('0x13'),JSON[_0x25f8('0x14')](_0x5bd70b));if(_0x5bd70b['error']){if(_0x5bd70b[_0x25f8('0x15')][_0x25f8('0x16')]===0x1f4){logger[_0x25f8('0x15')](_0x25f8('0x11'),_0x21bce0,_0x5bd70b['error'][_0x25f8('0x17')]);return _0x3e42a7(_0x5bd70b['error'][_0x25f8('0x17')]);}logger[_0x25f8('0x15')](_0x25f8('0x11'),_0x21bce0,_0x5bd70b[_0x25f8('0x15')][_0x25f8('0x17')]);return _0x54fb7a(_0x5bd70b[_0x25f8('0x15')][_0x25f8('0x17')]);}else{logger[_0x25f8('0x10')](_0x25f8('0x11'),_0x21bce0,_0x25f8('0x13'));_0x54fb7a(_0x5bd70b['result']['message']);}})['catch'](function(_0x55d578){logger[_0x25f8('0x15')](_0x25f8('0x11'),_0x21bce0,_0x55d578);_0x3e42a7(_0x55d578);});});} \ No newline at end of file +var _0xbf2c=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./chatWebsite.socket','register','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x163d42,_0x3cabea){var _0x59186c=function(_0x139ab9){while(--_0x139ab9){_0x163d42['push'](_0x163d42['shift']());}};_0x59186c(++_0x3cabea);}(_0xbf2c,0x13a));var _0xcbf2=function(_0x782554,_0x1f1e1b){_0x782554=_0x782554-0x0;var _0xdfb436=_0xbf2c[_0x782554];return _0xdfb436;};'use strict';var _=require(_0xcbf2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcbf2('0x1'));var rs=require(_0xcbf2('0x2'));var fs=require('fs');var Redis=require(_0xcbf2('0x3'));var db=require(_0xcbf2('0x4'))['db'];var utils=require(_0xcbf2('0x5'));var logger=require(_0xcbf2('0x6'))(_0xcbf2('0x7'));var config=require('../../config/environment');var jayson=require(_0xcbf2('0x8'));var client=jayson[_0xcbf2('0x9')][_0xcbf2('0xa')]({'port':0x232a});config[_0xcbf2('0xb')]=_[_0xcbf2('0xc')](config['redis'],{'host':_0xcbf2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcbf2('0xb')]));require(_0xcbf2('0xe'))[_0xcbf2('0xf')](socket);function respondWithRpcPromise(_0x34255a,_0x432f02,_0x39ef08){return new BPromise(function(_0x58604c,_0x2c1947){return client[_0xcbf2('0x10')](_0x34255a,_0x39ef08)[_0xcbf2('0x11')](function(_0x2e85b1){logger[_0xcbf2('0x12')](_0xcbf2('0x13'),_0x432f02,_0xcbf2('0x14'));logger[_0xcbf2('0x15')](_0xcbf2('0x16'),_0x432f02,_0xcbf2('0x14'),JSON[_0xcbf2('0x17')](_0x2e85b1));if(_0x2e85b1[_0xcbf2('0x18')]){if(_0x2e85b1[_0xcbf2('0x18')][_0xcbf2('0x19')]===0x1f4){logger[_0xcbf2('0x18')](_0xcbf2('0x13'),_0x432f02,_0x2e85b1[_0xcbf2('0x18')][_0xcbf2('0x1a')]);return _0x2c1947(_0x2e85b1['error'][_0xcbf2('0x1a')]);}logger[_0xcbf2('0x18')](_0xcbf2('0x13'),_0x432f02,_0x2e85b1[_0xcbf2('0x18')]['message']);return _0x58604c(_0x2e85b1[_0xcbf2('0x18')][_0xcbf2('0x1a')]);}else{logger[_0xcbf2('0x12')](_0xcbf2('0x13'),_0x432f02,_0xcbf2('0x14'));_0x58604c(_0x2e85b1[_0xcbf2('0x1b')]['message']);}})[_0xcbf2('0x1c')](function(_0x1ebece){logger[_0xcbf2('0x18')](_0xcbf2('0x13'),_0x432f02,_0x1ebece);_0x2c1947(_0x1ebece);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 59bd5df..31e905c 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 _0x146d=['update','emit','removeListener','register','length','chatWebsite:','save','remove'];(function(_0x10dc60,_0x2fcce1){var _0x47dec5=function(_0x24b5e4){while(--_0x24b5e4){_0x10dc60['push'](_0x10dc60['shift']());}};_0x47dec5(++_0x2fcce1);}(_0x146d,0x15e));var _0xd146=function(_0x35ace7,_0xbd1eaa){_0x35ace7=_0x35ace7-0x0;var _0x203523=_0x146d[_0x35ace7];return _0x203523;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0xd146('0x0'),_0xd146('0x1'),_0xd146('0x2')];function createListener(_0x28f377,_0x29f305){return function(_0x27325f){_0x29f305[_0xd146('0x3')](_0x28f377,_0x27325f);};}function removeListener(_0x264773,_0x54b452){return function(){ChatWebsiteEvents[_0xd146('0x4')](_0x264773,_0x54b452);};}exports[_0xd146('0x5')]=function(_0x1964cc){for(var _0x50d80a=0x0,_0x56c043=events[_0xd146('0x6')];_0x50d80a<_0x56c043;_0x50d80a++){var _0x456c4d=events[_0x50d80a];var _0x26b3c2=createListener(_0xd146('0x7')+_0x456c4d,_0x1964cc);ChatWebsiteEvents['on'](_0x456c4d,_0x26b3c2);}}; \ No newline at end of file +var _0x15c6=['length','chatWebsite:','save','remove','emit','removeListener','register'];(function(_0x17cae3,_0x5d3d3c){var _0x2e6081=function(_0x2e3cd6){while(--_0x2e3cd6){_0x17cae3['push'](_0x17cae3['shift']());}};_0x2e6081(++_0x5d3d3c);}(_0x15c6,0x136));var _0x615c=function(_0x58381c,_0x3b9374){_0x58381c=_0x58381c-0x0;var _0x1a7440=_0x15c6[_0x58381c];return _0x1a7440;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x615c('0x0'),_0x615c('0x1'),'update'];function createListener(_0x1eb42f,_0x175231){return function(_0xdca239){_0x175231[_0x615c('0x2')](_0x1eb42f,_0xdca239);};}function removeListener(_0x229a3c,_0x3888c2){return function(){ChatWebsiteEvents[_0x615c('0x3')](_0x229a3c,_0x3888c2);};}exports[_0x615c('0x4')]=function(_0x12dfb7){for(var _0x53e7bd=0x0,_0x43ea98=events[_0x615c('0x5')];_0x53e7bd<_0x43ea98;_0x53e7bd++){var _0x504702=events[_0x53e7bd];var _0x244765=createListener(_0x615c('0x6')+_0x504702,_0x12dfb7);ChatWebsiteEvents['on'](_0x504702,_0x244765);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 9eaf221..63a51c8 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 _0xeddd=['multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','/describe','show','isAuthenticated','getDispositions','/:id/canned_answers','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','file','addAvatar','server/files/images/avatars/','addCustomerAvatar','/:id/notify','server/files','attachments','replace','/:id/offline','offline','/:id/applications','addApplications','addProactiveActions','/:id/users','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAgents'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeddd,0x11c));var _0xdedd=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xeddd[_0x11005e];return _0x29338f;};'use strict';var multer=require(_0xdedd('0x0'));var util=require(_0xdedd('0x1'));var path=require(_0xdedd('0x2'));var timeout=require('connect-timeout');var express=require(_0xdedd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdedd('0x4'));var interaction=require(_0xdedd('0x5'));var config=require(_0xdedd('0x6'));var controller=require(_0xdedd('0x7'));router[_0xdedd('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdedd('0x8')](_0xdedd('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xdedd('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xdedd('0xa')]);router[_0xdedd('0x8')]('/:id/dispositions',auth[_0xdedd('0xb')](),controller[_0xdedd('0xc')]);router['get'](_0xdedd('0xd'),auth[_0xdedd('0xb')](),controller[_0xdedd('0xe')]);router[_0xdedd('0x8')]('/:id/logo',controller[_0xdedd('0xf')]);router[_0xdedd('0x8')](_0xdedd('0x10'),controller[_0xdedd('0x11')]);router[_0xdedd('0x8')](_0xdedd('0x12'),controller[_0xdedd('0x13')]);router[_0xdedd('0x8')](_0xdedd('0x14'),controller[_0xdedd('0x15')]);router['get'](_0xdedd('0x16'),auth['isAuthenticated'](),controller[_0xdedd('0x17')]);router[_0xdedd('0x8')](_0xdedd('0x18'),controller[_0xdedd('0x19')]);router[_0xdedd('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0xdedd('0x1a')]);router[_0xdedd('0x8')](_0xdedd('0x1b'),auth[_0xdedd('0xb')](),controller[_0xdedd('0x1c')]);router[_0xdedd('0x8')](_0xdedd('0x1d'),controller[_0xdedd('0x1e')]);router[_0xdedd('0x8')](_0xdedd('0x1f'),auth[_0xdedd('0xb')](),controller[_0xdedd('0x20')]);router[_0xdedd('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0xdedd('0x21')]);router[_0xdedd('0x22')]('/',auth[_0xdedd('0xb')](),controller[_0xdedd('0x23')]);router[_0xdedd('0x22')](_0xdedd('0x24'),auth[_0xdedd('0xb')](),controller[_0xdedd('0x25')]);router[_0xdedd('0x22')](_0xdedd('0xd'),auth[_0xdedd('0xb')](),controller[_0xdedd('0x26')]);var upload=multer({'storage':multer[_0xdedd('0x27')]({'destination':function(_0x12db6f,_0x3d966f,_0x56b1cc){_0x56b1cc(null,path[_0xdedd('0x28')](config[_0xdedd('0x29')],_0xdedd('0x2a')));},'filename':function(_0x3af902,_0x283509,_0x5116f3){_0x5116f3(null,util[_0xdedd('0x2b')](_0xdedd('0x2c'),Date[_0xdedd('0x2d')](),_0x283509[_0xdedd('0x2e')]));}})});router['post'](_0xdedd('0x2f'),upload['single']('file'),controller['addLogo']);var upload=multer({'storage':multer[_0xdedd('0x27')]({'destination':function(_0x3fe3d4,_0x3f271e,_0x32e8ed){_0x32e8ed(null,path['join'](config[_0xdedd('0x29')],'server/files/images/avatars/'));},'filename':function(_0x5c5f2f,_0x3a2958,_0x261706){_0x261706(null,util[_0xdedd('0x2b')](_0xdedd('0x2c'),Date[_0xdedd('0x2d')](),_0x3a2958[_0xdedd('0x2e')]));}})});router[_0xdedd('0x22')](_0xdedd('0x10'),upload[_0xdedd('0x30')](_0xdedd('0x31')),controller[_0xdedd('0x32')]);var upload=multer({'storage':multer[_0xdedd('0x27')]({'destination':function(_0x576fb3,_0x1c10ac,_0x465cb2){_0x465cb2(null,path[_0xdedd('0x28')](config[_0xdedd('0x29')],_0xdedd('0x33')));},'filename':function(_0x6bd3d6,_0x40f5c2,_0x298aa7){_0x298aa7(null,util[_0xdedd('0x2b')](_0xdedd('0x2c'),Date[_0xdedd('0x2d')](),_0x40f5c2[_0xdedd('0x2e')]));}})});router[_0xdedd('0x22')](_0xdedd('0x12'),upload[_0xdedd('0x30')](_0xdedd('0x31')),controller[_0xdedd('0x34')]);var upload=multer({'storage':multer[_0xdedd('0x27')]({'destination':function(_0x58ad8e,_0x30d3ea,_0x32def4){_0x32def4(null,path[_0xdedd('0x28')](config['root'],_0xdedd('0x33')));},'filename':function(_0x7bffcc,_0x281fe4,_0x2ef65d){_0x2ef65d(null,util['format'](_0xdedd('0x2c'),Date[_0xdedd('0x2d')](),_0x281fe4[_0xdedd('0x2e')]));}})});router[_0xdedd('0x22')]('/:id/system_avatar',upload['single']('file'),controller['addSystemAvatar']);router[_0xdedd('0x22')](_0xdedd('0x35'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xdedd('0x27')]({'destination':function(_0x5b0807,_0x5352bd,_0x23421f){const _0x2120f1=path[_0xdedd('0x28')](config['root'],_0xdedd('0x36'),_0xdedd('0x37'),'offline-chat');fs_extra['ensureDir'](_0x2120f1,function(){_0x23421f(null,_0x2120f1);});},'filename':function(_0x36f8d8,_0x3ebd1d,_0x5d1f99){const _0x59fc72=_0x3ebd1d['originalname'][_0xdedd('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xa6e522=path['extname'](_0x59fc72);const _0x16960e=Date['now']()+'-'+_0x59fc72[_0xdedd('0x38')](_0xa6e522,'')+_0xa6e522;_0x5d1f99(null,_0x16960e);}})});router[_0xdedd('0x22')](_0xdedd('0x39'),offlineUploadMulter['any'](),controller[_0xdedd('0x3a')]);router[_0xdedd('0x22')](_0xdedd('0x16'),auth[_0xdedd('0xb')](),controller['addInteraction']);router['post'](_0xdedd('0x3b'),auth[_0xdedd('0xb')](),controller[_0xdedd('0x3c')]);router[_0xdedd('0x22')](_0xdedd('0x1b'),auth[_0xdedd('0xb')](),controller[_0xdedd('0x3d')]);router['post'](_0xdedd('0x3e'),auth[_0xdedd('0xb')](),controller[_0xdedd('0x3f')]);router[_0xdedd('0x40')](_0xdedd('0x41'),auth[_0xdedd('0xb')](),controller[_0xdedd('0x42')]);router[_0xdedd('0x43')](_0xdedd('0x41'),auth[_0xdedd('0xb')](),controller[_0xdedd('0x44')]);router[_0xdedd('0x43')](_0xdedd('0x24'),auth['isAuthenticated'](),controller[_0xdedd('0x45')]);router[_0xdedd('0x43')](_0xdedd('0xd'),auth[_0xdedd('0xb')](),controller['removeAnswers']);router[_0xdedd('0x43')]('/:id/users',auth[_0xdedd('0xb')](),controller[_0xdedd('0x46')]);module['exports']=router; \ No newline at end of file +var _0x5e8b=['/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','join','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','file','root','server/files/images/avatars/','/:id/avatar','addAvatar','diskStorage','addCustomerAvatar','addSystemAvatar','/:id/notify','attachments','offline-chat','ensureDir','replace','/:id/offline','any','offline','addProactiveActions','addAgents','put','update','delete','destroy','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getSnippet','/:id/applications','/:id/proactive_actions','/:id/fields','getFields'];(function(_0x464b27,_0x1877c8){var _0x59de43=function(_0x4dc439){while(--_0x4dc439){_0x464b27['push'](_0x464b27['shift']());}};_0x59de43(++_0x1877c8);}(_0x5e8b,0x6a));var _0xb5e8=function(_0x45c04f,_0x5e18f1){_0x45c04f=_0x45c04f-0x0;var _0x2af7cd=_0x5e8b[_0x45c04f];return _0x2af7cd;};'use strict';var multer=require(_0xb5e8('0x0'));var util=require(_0xb5e8('0x1'));var path=require(_0xb5e8('0x2'));var timeout=require(_0xb5e8('0x3'));var express=require(_0xb5e8('0x4'));var router=express[_0xb5e8('0x5')]();var fs_extra=require(_0xb5e8('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb5e8('0x7'));var controller=require(_0xb5e8('0x8'));router[_0xb5e8('0x9')]('/',auth[_0xb5e8('0xa')](),controller[_0xb5e8('0xb')]);router[_0xb5e8('0x9')](_0xb5e8('0xc'),auth[_0xb5e8('0xa')](),controller[_0xb5e8('0xd')]);router[_0xb5e8('0x9')](_0xb5e8('0xe'),auth[_0xb5e8('0xa')](),controller['show']);router[_0xb5e8('0x9')](_0xb5e8('0xf'),auth['isAuthenticated'](),controller[_0xb5e8('0x10')]);router['get'](_0xb5e8('0x11'),auth[_0xb5e8('0xa')](),controller[_0xb5e8('0x12')]);router[_0xb5e8('0x9')]('/:id/logo',controller[_0xb5e8('0x13')]);router[_0xb5e8('0x9')]('/:id/avatar',controller[_0xb5e8('0x14')]);router[_0xb5e8('0x9')](_0xb5e8('0x15'),controller['getCustomerAvatar']);router[_0xb5e8('0x9')](_0xb5e8('0x16'),controller[_0xb5e8('0x17')]);router[_0xb5e8('0x9')](_0xb5e8('0x18'),auth[_0xb5e8('0xa')](),controller['getInteractions']);router['get']('/:id/snippet',controller[_0xb5e8('0x19')]);router['get'](_0xb5e8('0x1a'),auth['isAuthenticated'](),controller['getApplications']);router[_0xb5e8('0x9')](_0xb5e8('0x1b'),auth[_0xb5e8('0xa')](),controller['getProactiveActions']);router[_0xb5e8('0x9')](_0xb5e8('0x1c'),controller[_0xb5e8('0x1d')]);router['get'](_0xb5e8('0x1e'),auth[_0xb5e8('0xa')](),controller[_0xb5e8('0x1f')]);router['get'](_0xb5e8('0x20'),auth[_0xb5e8('0xa')](),controller[_0xb5e8('0x21')]);router[_0xb5e8('0x22')]('/',auth[_0xb5e8('0xa')](),controller[_0xb5e8('0x23')]);router[_0xb5e8('0x22')](_0xb5e8('0xf'),auth[_0xb5e8('0xa')](),controller['addDisposition']);router[_0xb5e8('0x22')](_0xb5e8('0x11'),auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x200a5f,_0xcf8b0f,_0x892b53){_0x892b53(null,path[_0xb5e8('0x24')](config['root'],_0xb5e8('0x25')));},'filename':function(_0x102066,_0x4c4193,_0x2215ed){_0x2215ed(null,util[_0xb5e8('0x26')](_0xb5e8('0x27'),Date[_0xb5e8('0x28')](),_0x4c4193[_0xb5e8('0x29')]));}})});router[_0xb5e8('0x22')](_0xb5e8('0x2a'),upload[_0xb5e8('0x2b')](_0xb5e8('0x2c')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5e7abf,_0x2a7eaa,_0x2d1f21){_0x2d1f21(null,path[_0xb5e8('0x24')](config[_0xb5e8('0x2d')],_0xb5e8('0x2e')));},'filename':function(_0x212a42,_0x579d96,_0x5885f5){_0x5885f5(null,util[_0xb5e8('0x26')](_0xb5e8('0x27'),Date['now'](),_0x579d96[_0xb5e8('0x29')]));}})});router[_0xb5e8('0x22')](_0xb5e8('0x2f'),upload[_0xb5e8('0x2b')](_0xb5e8('0x2c')),controller[_0xb5e8('0x30')]);var upload=multer({'storage':multer[_0xb5e8('0x31')]({'destination':function(_0x41623a,_0x454007,_0x17058c){_0x17058c(null,path[_0xb5e8('0x24')](config[_0xb5e8('0x2d')],'server/files/images/avatars/'));},'filename':function(_0x15f2a4,_0x1fd399,_0xd25e6a){_0xd25e6a(null,util[_0xb5e8('0x26')]('%s-%s',Date['now'](),_0x1fd399['originalname']));}})});router[_0xb5e8('0x22')](_0xb5e8('0x15'),upload[_0xb5e8('0x2b')]('file'),controller[_0xb5e8('0x32')]);var upload=multer({'storage':multer[_0xb5e8('0x31')]({'destination':function(_0x570c1b,_0x588e7c,_0x123f5b){_0x123f5b(null,path['join'](config[_0xb5e8('0x2d')],_0xb5e8('0x2e')));},'filename':function(_0x219bca,_0x5e6cd0,_0x243ef0){_0x243ef0(null,util[_0xb5e8('0x26')]('%s-%s',Date[_0xb5e8('0x28')](),_0x5e6cd0[_0xb5e8('0x29')]));}})});router[_0xb5e8('0x22')](_0xb5e8('0x16'),upload[_0xb5e8('0x2b')](_0xb5e8('0x2c')),controller[_0xb5e8('0x33')]);router[_0xb5e8('0x22')](_0xb5e8('0x34'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0xb5e8('0x31')]({'destination':function(_0x1f54b3,_0x570a14,_0x504eca){const _0x84b4e4=path[_0xb5e8('0x24')](config['root'],'server/files',_0xb5e8('0x35'),_0xb5e8('0x36'));fs_extra[_0xb5e8('0x37')](_0x84b4e4,function(){_0x504eca(null,_0x84b4e4);});},'filename':function(_0xe7921c,_0x55987a,_0x186822){const _0x52e0ac=_0x55987a[_0xb5e8('0x29')][_0xb5e8('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x10e477=path['extname'](_0x52e0ac);const _0x2025e9=Date[_0xb5e8('0x28')]()+'-'+_0x52e0ac[_0xb5e8('0x38')](_0x10e477,'')+_0x10e477;_0x186822(null,_0x2025e9);}})});router[_0xb5e8('0x22')](_0xb5e8('0x39'),offlineUploadMulter[_0xb5e8('0x3a')](),controller[_0xb5e8('0x3b')]);router[_0xb5e8('0x22')](_0xb5e8('0x18'),auth[_0xb5e8('0xa')](),controller['addInteraction']);router[_0xb5e8('0x22')](_0xb5e8('0x1a'),auth[_0xb5e8('0xa')](),controller['addApplications']);router[_0xb5e8('0x22')]('/:id/proactive_actions',auth[_0xb5e8('0xa')](),controller[_0xb5e8('0x3c')]);router[_0xb5e8('0x22')]('/:id/users',auth[_0xb5e8('0xa')](),controller[_0xb5e8('0x3d')]);router[_0xb5e8('0x3e')](_0xb5e8('0xe'),auth[_0xb5e8('0xa')](),controller[_0xb5e8('0x3f')]);router[_0xb5e8('0x40')](_0xb5e8('0xe'),auth[_0xb5e8('0xa')](),controller[_0xb5e8('0x41')]);router[_0xb5e8('0x40')](_0xb5e8('0xf'),auth[_0xb5e8('0xa')](),controller['removeDispositions']);router[_0xb5e8('0x40')](_0xb5e8('0x11'),auth[_0xb5e8('0xa')](),controller[_0xb5e8('0x42')]);router[_0xb5e8('0x40')](_0xb5e8('0x20'),auth[_0xb5e8('0xa')](),controller[_0xb5e8('0x43')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 1d34bfc..17831de 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd874=['../config/environment','Router','env','get','client-side-logger','expressEndpoint','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service'];(function(_0x1e2688,_0x19411e){var _0x3dc79a=function(_0x378ee9){while(--_0x378ee9){_0x1e2688['push'](_0x1e2688['shift']());}};_0x3dc79a(++_0x19411e);}(_0xd874,0x171));var _0x4d87=function(_0x9e5b39,_0xa86fe6){_0x9e5b39=_0x9e5b39-0x0;var _0x1bbc15=_0xd874[_0x9e5b39];return _0x1bbc15;};var beaverLogger=require(_0x4d87('0x0'));var express=require(_0x4d87('0x1'));var auth=require(_0x4d87('0x2'));var config=require(_0x4d87('0x3'));var router=express[_0x4d87('0x4')]();var isProduction=config[_0x4d87('0x5')]==='production'||![];function clientSideLogs(_0x17a2ad,_0x3e490f,_0x582f67){var _0x381619=_0x17a2ad['app'][_0x4d87('0x6')](_0x4d87('0x7'));if(!_0x381619){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x4d87('0x8')]({'uri':'/client-logs','logger':_0x381619,'enableCors':!isProduction})(_0x17a2ad,_0x3e490f,_0x582f67);}router[_0x4d87('0x9')](auth[_0x4d87('0xa')](),clientSideLogs);module[_0x4d87('0xb')]=router; \ No newline at end of file +var _0xc4b2=['isAuthenticated','exports','beaver-logger/server','../components/auth/service','../config/environment','Router','env','app','Client-Side\x20logger\x20not\x20found!','/client-logs'];(function(_0xd816e2,_0x5edac2){var _0x1f5924=function(_0x1bcbf0){while(--_0x1bcbf0){_0xd816e2['push'](_0xd816e2['shift']());}};_0x1f5924(++_0x5edac2);}(_0xc4b2,0x1ce));var _0x2c4b=function(_0x867b0a,_0x587ccf){_0x867b0a=_0x867b0a-0x0;var _0x137438=_0xc4b2[_0x867b0a];return _0x137438;};var beaverLogger=require(_0x2c4b('0x0'));var express=require('express');var auth=require(_0x2c4b('0x1'));var config=require(_0x2c4b('0x2'));var router=express[_0x2c4b('0x3')]();var isProduction=config[_0x2c4b('0x4')]==='production'||![];function clientSideLogs(_0x2eacb2,_0x1908db,_0x35e508){var _0x35b4aa=_0x2eacb2[_0x2c4b('0x5')]['get']('client-side-logger');if(!_0x35b4aa){throw new Error(_0x2c4b('0x6'));}return beaverLogger['expressEndpoint']({'uri':_0x2c4b('0x7'),'logger':_0x35b4aa,'enableCors':!isProduction})(_0x2eacb2,_0x1908db,_0x35e508);}router['use'](auth[_0x2c4b('0x8')](),clientSideLogs);module[_0x2c4b('0x9')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index f791181..71fd1c0 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 _0x453a=['MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x453a,0x18a));var _0xa453=function(_0x20187f,_0xbf67c9){_0x20187f=_0x20187f-0x0;var _0x398db5=_0x453a[_0x20187f];return _0x398db5;};'use strict';var Sequelize=require(_0xa453('0x0'));module[_0xa453('0x1')]={'name':{'type':Sequelize[_0xa453('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xa453('0x3')](_0xa453('0x4'),'Google','MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xa453('0x3')](_0xa453('0x5'),_0xa453('0x6'))},'data1':{'type':Sequelize['STRING'],'comment':_0xa453('0x7')},'data2':{'type':Sequelize[_0xa453('0x2')],'comment':_0xa453('0x8')},'data3':{'type':Sequelize[_0xa453('0x2')],'comment':_0xa453('0x9')},'data4':{'type':Sequelize[_0xa453('0x2')],'comment':_0xa453('0xa')},'data5':{'type':Sequelize['TEXT'],'comment':_0xa453('0xb')},'data6':{'type':Sequelize['TEXT'],'comment':_0xa453('0xc')},'data7':{'type':Sequelize[_0xa453('0xd')],'comment':_0xa453('0xe')}}; \ No newline at end of file +var _0xe63f=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20refresh_token','exports','STRING','ENUM','AmazonAWS','Google','Outlook365','Dynamics365'];(function(_0x2e6c19,_0x131233){var _0x52885d=function(_0x38f224){while(--_0x38f224){_0x2e6c19['push'](_0x2e6c19['shift']());}};_0x52885d(++_0x131233);}(_0xe63f,0x9e));var _0xfe63=function(_0xd31b2c,_0x2bccdd){_0xd31b2c=_0xd31b2c-0x0;var _0x5ec823=_0xe63f[_0xd31b2c];return _0x5ec823;};'use strict';var Sequelize=require('sequelize');module[_0xfe63('0x0')]={'name':{'type':Sequelize[_0xfe63('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xfe63('0x2')](_0xfe63('0x3'),_0xfe63('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xfe63('0x5'),_0xfe63('0x6'))},'data1':{'type':Sequelize[_0xfe63('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0xfe63('0x1')],'comment':_0xfe63('0x7')},'data3':{'type':Sequelize[_0xfe63('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0xfe63('0x1')],'comment':_0xfe63('0x8')},'data5':{'type':Sequelize[_0xfe63('0x9')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xfe63('0x9')],'comment':_0xfe63('0xa')},'data7':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 815400d..1f3752a 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 _0xa4f7=['set','Content-Range','update','destroy','then','error','stack','name','send','slice','index','map','CloudProvider','fieldName','key','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','service','decryptString','data3','catch','show','find','create','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','MicrosoftAzure','encryptString','params','oauth2MicrosoftAuthorize','findOne','get','state','parse','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','microsoftAuthorization:success','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','defaults','redis','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count'];(function(_0x10af2b,_0x302c36){var _0x314be2=function(_0x24d803){while(--_0x24d803){_0x10af2b['push'](_0x10af2b['shift']());}};_0x314be2(++_0x302c36);}(_0xa4f7,0x169));var _0x7a4f=function(_0x3c3db9,_0x2f532a){_0x3c3db9=_0x3c3db9-0x0;var _0x3f7d51=_0xa4f7[_0x3c3db9];return _0x3f7d51;};'use strict';var _=require(_0x7a4f('0x0'));var Redis=require(_0x7a4f('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x7a4f('0x2'));var config=require(_0x7a4f('0x3'));var logger=require(_0x7a4f('0x4'))(_0x7a4f('0x5'));var db=require(_0x7a4f('0x6'))['db'];var oauth=require(_0x7a4f('0x7'));config['redis']=_[_0x7a4f('0x8')](config[_0x7a4f('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7a4f('0xa'))(new Redis(config['redis']));var redis=new Redis(config[_0x7a4f('0x9')]);function respondWithStatusCode(_0x150b40,_0x703b65){_0x703b65=_0x703b65||0xcc;return function(_0x5c9b81){if(_0x5c9b81){return _0x150b40[_0x7a4f('0xb')](_0x703b65);}return _0x150b40[_0x7a4f('0xc')](_0x703b65)[_0x7a4f('0xd')]();};}function respondWithResult(_0x25f6d3,_0xb68ff4){_0xb68ff4=_0xb68ff4||0xc8;return function(_0x1e121b){if(_0x1e121b){return _0x25f6d3['status'](_0xb68ff4)[_0x7a4f('0xe')](_0x1e121b);}};}function respondWithFilteredResult(_0x2dec04,_0x495d7a){return function(_0x4175f5){if(_0x4175f5){var _0x2211cb=typeof _0x495d7a[_0x7a4f('0xf')]==='undefined'&&typeof _0x495d7a[_0x7a4f('0x10')]===_0x7a4f('0x11');var _0x8e7842=_0x4175f5['count'];var _0x565a8b=_0x2211cb?0x0:_0x495d7a[_0x7a4f('0xf')];var _0x2495de=_0x2211cb?_0x4175f5[_0x7a4f('0x12')]:_0x495d7a[_0x7a4f('0xf')]+_0x495d7a[_0x7a4f('0x10')];var _0xd27483;if(_0x2495de>=_0x8e7842){_0x2495de=_0x8e7842;_0xd27483=0xc8;}else{_0xd27483=0xce;}_0x2dec04[_0x7a4f('0xc')](_0xd27483);return _0x2dec04[_0x7a4f('0x13')](_0x7a4f('0x14'),_0x565a8b+'-'+_0x2495de+'/'+_0x8e7842)['json'](_0x4175f5);}return null;};}function saveUpdates(_0x86f0c3){return function(_0x25eabe){if(_0x25eabe){return _0x25eabe[_0x7a4f('0x15')](_0x86f0c3)['then'](function(_0x23999c){return _0x23999c;});}return null;};}function removeEntity(_0x3bcad2){return function(_0x2a919c){if(_0x2a919c){return _0x2a919c[_0x7a4f('0x16')]()[_0x7a4f('0x17')](function(){_0x3bcad2[_0x7a4f('0xc')](0xcc)[_0x7a4f('0xd')]();});}};}function handleEntityNotFound(_0x2d0594){return function(_0x9bc5da){if(!_0x9bc5da){_0x2d0594['sendStatus'](0x194);}return _0x9bc5da;};}function handleError(_0x2fc7bc,_0x5ae90c){_0x5ae90c=_0x5ae90c||0x1f4;return function(_0x19f6f4){logger[_0x7a4f('0x18')](_0x19f6f4[_0x7a4f('0x19')]);if(_0x19f6f4[_0x7a4f('0x1a')]){delete _0x19f6f4[_0x7a4f('0x1a')];}_0x2fc7bc['status'](_0x5ae90c)[_0x7a4f('0x1b')](_0x19f6f4);};}function maskClientSecret(_0x1a721d){return _['padEnd'](_0x1a721d[_0x7a4f('0x1c')](0x0,0x3),0x14,'*');}exports[_0x7a4f('0x1d')]=function(_0x251ff4,_0xb8bd4a){var _0x5a6f7f={},_0x41c7ee={},_0x20163b={'count':0x0,'rows':[]};var _0x12fa34=_[_0x7a4f('0x1e')](db[_0x7a4f('0x1f')]['rawAttributes'],function(_0x286b34){return{'name':_0x286b34[_0x7a4f('0x20')],'type':_0x286b34['type'][_0x7a4f('0x21')]};});_0x41c7ee[_0x7a4f('0x22')]=_[_0x7a4f('0x1e')](_0x12fa34,_0x7a4f('0x1a'));_0x41c7ee['query']=_[_0x7a4f('0x23')](_0x251ff4['query']);_0x41c7ee[_0x7a4f('0x24')]=_[_0x7a4f('0x25')](_0x41c7ee[_0x7a4f('0x22')],_0x41c7ee['query']);_0x5a6f7f['attributes']=_[_0x7a4f('0x25')](_0x41c7ee[_0x7a4f('0x22')],qs[_0x7a4f('0x26')](_0x251ff4[_0x7a4f('0x27')]['fields']));_0x5a6f7f[_0x7a4f('0x28')]=_0x5a6f7f[_0x7a4f('0x28')][_0x7a4f('0x29')]?_0x5a6f7f[_0x7a4f('0x28')]:_0x41c7ee['model'];if(!_0x251ff4[_0x7a4f('0x27')][_0x7a4f('0x2a')](_0x7a4f('0x2b'))){_0x5a6f7f[_0x7a4f('0x10')]=qs[_0x7a4f('0x10')](_0x251ff4[_0x7a4f('0x27')]['limit']);_0x5a6f7f[_0x7a4f('0xf')]=qs[_0x7a4f('0xf')](_0x251ff4[_0x7a4f('0x27')]['offset']);}_0x5a6f7f[_0x7a4f('0x2c')]=qs[_0x7a4f('0x2d')](_0x251ff4[_0x7a4f('0x27')][_0x7a4f('0x2d')]);_0x5a6f7f[_0x7a4f('0x2e')]=qs[_0x7a4f('0x24')](_['pick'](_0x251ff4['query'],_0x41c7ee[_0x7a4f('0x24')]),_0x12fa34);if(_0x251ff4[_0x7a4f('0x27')]['filter']){_0x5a6f7f[_0x7a4f('0x2e')]=_[_0x7a4f('0x2f')](_0x5a6f7f['where'],{'$or':_[_0x7a4f('0x1e')](_0x12fa34,function(_0x17b27b){if(_0x17b27b['type']!==_0x7a4f('0x30')){var _0x7c9624={};_0x7c9624[_0x17b27b[_0x7a4f('0x1a')]]={'$like':'%'+_0x251ff4[_0x7a4f('0x27')][_0x7a4f('0x31')]+'%'};return _0x7c9624;}})});}_0x5a6f7f=_[_0x7a4f('0x2f')]({},_0x5a6f7f,_0x251ff4[_0x7a4f('0x32')]);var _0x51762b={'where':_0x5a6f7f[_0x7a4f('0x2e')]};return db[_0x7a4f('0x1f')][_0x7a4f('0x12')](_0x51762b)[_0x7a4f('0x17')](function(_0x3a3ed6){_0x20163b[_0x7a4f('0x12')]=_0x3a3ed6;if(_0x251ff4['query'][_0x7a4f('0x33')]){_0x5a6f7f[_0x7a4f('0x34')]=[{'all':!![]}];}return db[_0x7a4f('0x1f')][_0x7a4f('0x35')](_0x5a6f7f);})[_0x7a4f('0x17')](function(_0x56b259){_0x20163b[_0x7a4f('0x36')]=_[_0x7a4f('0x1e')](_0x56b259,function(_0x42e012){if(_0x42e012[_0x7a4f('0x37')]==='MicrosoftAzure'){var _0x151c37=encryptor[_0x7a4f('0x38')](_0x42e012[_0x7a4f('0x39')]);_0x42e012[_0x7a4f('0x39')]=maskClientSecret(_0x151c37);}return _0x42e012;});return _0x20163b;})[_0x7a4f('0x17')](respondWithFilteredResult(_0xb8bd4a,_0x5a6f7f))[_0x7a4f('0x3a')](handleError(_0xb8bd4a,null));};exports[_0x7a4f('0x3b')]=function(_0x5c021a,_0x1848c1){var _0x29100b={'raw':!![],'where':{'id':_0x5c021a['params']['id']}},_0x1748f7={};_0x1748f7['model']=_[_0x7a4f('0x23')](db['CloudProvider']['rawAttributes']);_0x1748f7[_0x7a4f('0x27')]=_[_0x7a4f('0x23')](_0x5c021a['query']);_0x1748f7['filters']=_[_0x7a4f('0x25')](_0x1748f7['model'],_0x1748f7[_0x7a4f('0x27')]);_0x29100b[_0x7a4f('0x28')]=_[_0x7a4f('0x25')](_0x1748f7[_0x7a4f('0x22')],qs[_0x7a4f('0x26')](_0x5c021a[_0x7a4f('0x27')][_0x7a4f('0x26')]));_0x29100b[_0x7a4f('0x28')]=_0x29100b[_0x7a4f('0x28')]['length']?_0x29100b[_0x7a4f('0x28')]:_0x1748f7[_0x7a4f('0x22')];if(_0x5c021a[_0x7a4f('0x27')][_0x7a4f('0x33')]){_0x29100b[_0x7a4f('0x34')]=[{'all':!![]}];}_0x29100b=_[_0x7a4f('0x2f')]({},_0x29100b,_0x5c021a[_0x7a4f('0x32')]);return db[_0x7a4f('0x1f')][_0x7a4f('0x3c')](_0x29100b)[_0x7a4f('0x17')](handleEntityNotFound(_0x1848c1,null))['then'](function(_0x240846){if(_0x240846['service']==='MicrosoftAzure'){var _0xad81cc=encryptor['decryptString'](_0x240846[_0x7a4f('0x39')]);_0x240846[_0x7a4f('0x39')]=maskClientSecret(_0xad81cc);}return _0x240846;})[_0x7a4f('0x17')](respondWithResult(_0x1848c1,null))['catch'](handleError(_0x1848c1,null));};exports[_0x7a4f('0x3d')]=function(_0x578154,_0xa58570){if(!_0x578154[_0x7a4f('0x3e')][_0x7a4f('0x1a')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x578154[_0x7a4f('0x3e')][_0x7a4f('0x37')])throw new Error(_0x7a4f('0x3f'));var _0x37b524=db[_0x7a4f('0x1f')]['rawAttributes'][_0x7a4f('0x37')][_0x7a4f('0x40')];if(!_0x37b524[_0x7a4f('0x41')](_0x578154['body'][_0x7a4f('0x37')]))throw new Error(_0x7a4f('0x42')+_0x37b524[_0x7a4f('0x43')](',\x20'));if(_0x578154[_0x7a4f('0x3e')][_0x7a4f('0x37')]===_0x7a4f('0x44')&&_0x578154[_0x7a4f('0x3e')][_0x7a4f('0x39')]){_0x578154[_0x7a4f('0x3e')][_0x7a4f('0x39')]=encryptor[_0x7a4f('0x45')](_0x578154[_0x7a4f('0x3e')][_0x7a4f('0x39')]);}return db[_0x7a4f('0x1f')][_0x7a4f('0x3d')](_0x578154[_0x7a4f('0x3e')],{})['then'](respondWithResult(_0xa58570,0xc9))['catch'](handleError(_0xa58570,null));};exports[_0x7a4f('0x15')]=function(_0xc4d136,_0x237251){if(_0xc4d136['body']['id']){delete _0xc4d136[_0x7a4f('0x3e')]['id'];}return db[_0x7a4f('0x1f')]['find']({'where':{'id':_0xc4d136[_0x7a4f('0x46')]['id']}})[_0x7a4f('0x17')](handleEntityNotFound(_0x237251,null))[_0x7a4f('0x17')](function(_0x4cf58c){if(_0x4cf58c['service']==='MicrosoftAzure'&&_0xc4d136['body'][_0x7a4f('0x39')]){_0xc4d136['body'][_0x7a4f('0x39')]=encryptor[_0x7a4f('0x45')](_0xc4d136['body']['data3']);}return _0x4cf58c;})['then'](saveUpdates(_0xc4d136[_0x7a4f('0x3e')],null))[_0x7a4f('0x17')](respondWithResult(_0x237251,null))['catch'](handleError(_0x237251,null));};exports['destroy']=function(_0xcf2362,_0x493be6){return db[_0x7a4f('0x1f')]['find']({'where':{'id':_0xcf2362[_0x7a4f('0x46')]['id']}})['then'](handleEntityNotFound(_0x493be6,null))['then'](removeEntity(_0x493be6,null))[_0x7a4f('0x3a')](handleError(_0x493be6,null));};exports[_0x7a4f('0x47')]=function(_0x105031,_0x54bc39){return db[_0x7a4f('0x1f')][_0x7a4f('0x48')]({'where':{'id':_0x105031[_0x7a4f('0x46')]['id']},'raw':!![]})[_0x7a4f('0x17')](function(_0x1de21a){if(!_0x1de21a)return _0x54bc39[_0x7a4f('0xb')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x1de21a,_0x105031['user']['id'])};})['then'](respondWithResult(_0x54bc39,null))[_0x7a4f('0x3a')](handleError(_0x54bc39,null));};exports['oauth2MicrosoftCallback']=function(_0x1a48d0,_0x5a8971){var _0x3be61b=_0x1a48d0[_0x7a4f('0x3e')];var _0x4c2d87;var _0x1858ad;if(_0x3be61b['error'])throw _0x3be61b;redis[_0x7a4f('0x49')](_0x3be61b[_0x7a4f('0x4a')])[_0x7a4f('0x17')](function(_0x2bc3b6){if(!_0x2bc3b6)throw new Error('Invalid\x20state\x20parameter');_0x4c2d87=JSON[_0x7a4f('0x4b')](_0x2bc3b6);var _0x91f99e=Buffer['from'](_0x3be61b[_0x7a4f('0x4a')],_0x7a4f('0x4c'))[_0x7a4f('0x4d')](_0x7a4f('0x4e'));_0x1858ad=JSON['parse'](_0x91f99e);if(!oauth[_0x7a4f('0x4f')](_0x3be61b[_0x7a4f('0x50')],_0x4c2d87[_0x7a4f('0x51')]))throw new Error(_0x7a4f('0x52'));redis['del'](_0x3be61b[_0x7a4f('0x4a')]);return oauth[_0x7a4f('0x53')](_0x3be61b[_0x7a4f('0x54')],_0x4c2d87);})[_0x7a4f('0x17')](function(_0x2d9d03){_0x4c2d87[_0x7a4f('0x55')]=_0x2d9d03[_0x7a4f('0x56')];_0x4c2d87[_0x7a4f('0x57')]=_0x2d9d03['refresh_token'];return db[_0x7a4f('0x1f')]['update']({'data5':_0x4c2d87['data5'],'data6':_0x4c2d87[_0x7a4f('0x57')]},{'where':{'id':_0x4c2d87['id']}});})[_0x7a4f('0x17')](function(){oauth['startRefreshInterval'](_0x4c2d87);socket['emit'](_0x7a4f('0x58'),{'id':_0x1858ad['id']});return;})[_0x7a4f('0x17')](respondWithStatusCode(_0x5a8971,null))[_0x7a4f('0x3a')](function(_0x1ac4c4){if(_0x1858ad){socket[_0x7a4f('0x59')](_0x7a4f('0x5a'),{'id':_0x1858ad['id']});}if(!_0x4c2d87){logger[_0x7a4f('0x18')](_0x7a4f('0x5b'),_0x1ac4c4);return _0x5a8971[_0x7a4f('0xc')](0x1f4)[_0x7a4f('0x1b')](_0x1ac4c4[_0x7a4f('0x5c')]);}logger[_0x7a4f('0x18')](_0x7a4f('0x5d'),_0x4c2d87['id'],JSON[_0x7a4f('0x5e')](_0x1ac4c4));});}; \ No newline at end of file +var _0x47db=['destroy','error','stack','name','send','padEnd','slice','index','map','CloudProvider','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','rawAttributes','keys','length','find','create','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','get','Invalid\x20state\x20parameter','parse','from','state','toString','isValidIdToken','oauth2Claims','Unable\x20to\x20validate\x20id_token','code','data5','access_token','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','offset','undefined','limit','count','Content-Range','json','update','then'];(function(_0x2ef1ae,_0x3f0649){var _0x41fdd7=function(_0x56bfec){while(--_0x56bfec){_0x2ef1ae['push'](_0x2ef1ae['shift']());}};_0x41fdd7(++_0x3f0649);}(_0x47db,0x15f));var _0xb47d=function(_0x2010ef,_0x2e0229){_0x2010ef=_0x2010ef-0x0;var _0x281728=_0x47db[_0x2010ef];return _0x281728;};'use strict';var _=require('lodash');var Redis=require(_0xb47d('0x0'));var qs=require('../../components/parsers/qs');var encryptor=require('../../components/encryptor');var config=require('../../config/environment');var logger=require(_0xb47d('0x1'))(_0xb47d('0x2'));var db=require(_0xb47d('0x3'))['db'];var oauth=require('./cloudProvider.oauth');config[_0xb47d('0x4')]=_[_0xb47d('0x5')](config[_0xb47d('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0xb47d('0x6'))(new Redis(config[_0xb47d('0x4')]));var redis=new Redis(config[_0xb47d('0x4')]);function respondWithStatusCode(_0x3b2e15,_0x2802c9){_0x2802c9=_0x2802c9||0xcc;return function(_0x32dfd1){if(_0x32dfd1){return _0x3b2e15[_0xb47d('0x7')](_0x2802c9);}return _0x3b2e15[_0xb47d('0x8')](_0x2802c9)['end']();};}function respondWithResult(_0x3f0fc2,_0x261674){_0x261674=_0x261674||0xc8;return function(_0x5ab928){if(_0x5ab928){return _0x3f0fc2['status'](_0x261674)['json'](_0x5ab928);}};}function respondWithFilteredResult(_0x3d7ad8,_0x35b9e4){return function(_0x133199){if(_0x133199){var _0x3c79ab=typeof _0x35b9e4[_0xb47d('0x9')]===_0xb47d('0xa')&&typeof _0x35b9e4[_0xb47d('0xb')]===_0xb47d('0xa');var _0x353fd2=_0x133199[_0xb47d('0xc')];var _0x175e83=_0x3c79ab?0x0:_0x35b9e4[_0xb47d('0x9')];var _0x4f4248=_0x3c79ab?_0x133199[_0xb47d('0xc')]:_0x35b9e4['offset']+_0x35b9e4[_0xb47d('0xb')];var _0x47913c;if(_0x4f4248>=_0x353fd2){_0x4f4248=_0x353fd2;_0x47913c=0xc8;}else{_0x47913c=0xce;}_0x3d7ad8[_0xb47d('0x8')](_0x47913c);return _0x3d7ad8['set'](_0xb47d('0xd'),_0x175e83+'-'+_0x4f4248+'/'+_0x353fd2)[_0xb47d('0xe')](_0x133199);}return null;};}function saveUpdates(_0x275b6c){return function(_0x258ab7){if(_0x258ab7){return _0x258ab7[_0xb47d('0xf')](_0x275b6c)[_0xb47d('0x10')](function(_0x7ee9c1){return _0x7ee9c1;});}return null;};}function removeEntity(_0x1fb5ee){return function(_0x4ac953){if(_0x4ac953){return _0x4ac953[_0xb47d('0x11')]()[_0xb47d('0x10')](function(){_0x1fb5ee[_0xb47d('0x8')](0xcc)['end']();});}};}function handleEntityNotFound(_0x255d0d){return function(_0x51f1a8){if(!_0x51f1a8){_0x255d0d[_0xb47d('0x7')](0x194);}return _0x51f1a8;};}function handleError(_0x5f39e4,_0x3e66fa){_0x3e66fa=_0x3e66fa||0x1f4;return function(_0x79d79b){logger[_0xb47d('0x12')](_0x79d79b[_0xb47d('0x13')]);if(_0x79d79b[_0xb47d('0x14')]){delete _0x79d79b['name'];}_0x5f39e4[_0xb47d('0x8')](_0x3e66fa)[_0xb47d('0x15')](_0x79d79b);};}function maskClientSecret(_0x39daef){return _[_0xb47d('0x16')](_0x39daef[_0xb47d('0x17')](0x0,0x3),0x14,'*');}exports[_0xb47d('0x18')]=function(_0x4ddf96,_0x38150c){var _0x229c4d={},_0x23619f={},_0x5d9f9d={'count':0x0,'rows':[]};var _0x42be46=_[_0xb47d('0x19')](db[_0xb47d('0x1a')]['rawAttributes'],function(_0x157c32){return{'name':_0x157c32[_0xb47d('0x1b')],'type':_0x157c32['type'][_0xb47d('0x1c')]};});_0x23619f[_0xb47d('0x1d')]=_[_0xb47d('0x19')](_0x42be46,'name');_0x23619f[_0xb47d('0x1e')]=_['keys'](_0x4ddf96[_0xb47d('0x1e')]);_0x23619f[_0xb47d('0x1f')]=_[_0xb47d('0x20')](_0x23619f[_0xb47d('0x1d')],_0x23619f[_0xb47d('0x1e')]);_0x229c4d[_0xb47d('0x21')]=_[_0xb47d('0x20')](_0x23619f[_0xb47d('0x1d')],qs[_0xb47d('0x22')](_0x4ddf96[_0xb47d('0x1e')][_0xb47d('0x22')]));_0x229c4d[_0xb47d('0x21')]=_0x229c4d['attributes']['length']?_0x229c4d['attributes']:_0x23619f[_0xb47d('0x1d')];if(!_0x4ddf96[_0xb47d('0x1e')]['hasOwnProperty'](_0xb47d('0x23'))){_0x229c4d[_0xb47d('0xb')]=qs['limit'](_0x4ddf96[_0xb47d('0x1e')][_0xb47d('0xb')]);_0x229c4d[_0xb47d('0x9')]=qs[_0xb47d('0x9')](_0x4ddf96[_0xb47d('0x1e')]['offset']);}_0x229c4d[_0xb47d('0x24')]=qs[_0xb47d('0x25')](_0x4ddf96[_0xb47d('0x1e')][_0xb47d('0x25')]);_0x229c4d[_0xb47d('0x26')]=qs[_0xb47d('0x1f')](_['pick'](_0x4ddf96['query'],_0x23619f['filters']),_0x42be46);if(_0x4ddf96[_0xb47d('0x1e')]['filter']){_0x229c4d[_0xb47d('0x26')]=_[_0xb47d('0x27')](_0x229c4d['where'],{'$or':_[_0xb47d('0x19')](_0x42be46,function(_0x895c2a){if(_0x895c2a[_0xb47d('0x28')]!==_0xb47d('0x29')){var _0x12d968={};_0x12d968[_0x895c2a[_0xb47d('0x14')]]={'$like':'%'+_0x4ddf96[_0xb47d('0x1e')][_0xb47d('0x2a')]+'%'};return _0x12d968;}})});}_0x229c4d=_['merge']({},_0x229c4d,_0x4ddf96[_0xb47d('0x2b')]);var _0x1520f0={'where':_0x229c4d['where']};return db[_0xb47d('0x1a')][_0xb47d('0xc')](_0x1520f0)['then'](function(_0x266340){_0x5d9f9d[_0xb47d('0xc')]=_0x266340;if(_0x4ddf96['query'][_0xb47d('0x2c')]){_0x229c4d[_0xb47d('0x2d')]=[{'all':!![]}];}return db[_0xb47d('0x1a')][_0xb47d('0x2e')](_0x229c4d);})[_0xb47d('0x10')](function(_0x5a1045){_0x5d9f9d[_0xb47d('0x2f')]=_[_0xb47d('0x19')](_0x5a1045,function(_0x33dff6){if(_0x33dff6[_0xb47d('0x30')]===_0xb47d('0x31')){var _0x1c76c4=encryptor[_0xb47d('0x32')](_0x33dff6[_0xb47d('0x33')]);_0x33dff6['data3']=maskClientSecret(_0x1c76c4);}return _0x33dff6;});return _0x5d9f9d;})[_0xb47d('0x10')](respondWithFilteredResult(_0x38150c,_0x229c4d))[_0xb47d('0x34')](handleError(_0x38150c,null));};exports[_0xb47d('0x35')]=function(_0x3e0e08,_0x4aaa22){var _0x23e0e5={'raw':!![],'where':{'id':_0x3e0e08[_0xb47d('0x36')]['id']}},_0x581067={};_0x581067['model']=_['keys'](db[_0xb47d('0x1a')][_0xb47d('0x37')]);_0x581067[_0xb47d('0x1e')]=_[_0xb47d('0x38')](_0x3e0e08['query']);_0x581067[_0xb47d('0x1f')]=_['intersection'](_0x581067[_0xb47d('0x1d')],_0x581067[_0xb47d('0x1e')]);_0x23e0e5[_0xb47d('0x21')]=_[_0xb47d('0x20')](_0x581067['model'],qs['fields'](_0x3e0e08['query'][_0xb47d('0x22')]));_0x23e0e5[_0xb47d('0x21')]=_0x23e0e5[_0xb47d('0x21')][_0xb47d('0x39')]?_0x23e0e5['attributes']:_0x581067[_0xb47d('0x1d')];if(_0x3e0e08[_0xb47d('0x1e')]['includeAll']){_0x23e0e5['include']=[{'all':!![]}];}_0x23e0e5=_[_0xb47d('0x27')]({},_0x23e0e5,_0x3e0e08[_0xb47d('0x2b')]);return db[_0xb47d('0x1a')][_0xb47d('0x3a')](_0x23e0e5)[_0xb47d('0x10')](handleEntityNotFound(_0x4aaa22,null))[_0xb47d('0x10')](function(_0x527bb2){if(_0x527bb2['service']===_0xb47d('0x31')){var _0x34c3a4=encryptor[_0xb47d('0x32')](_0x527bb2['data3']);_0x527bb2[_0xb47d('0x33')]=maskClientSecret(_0x34c3a4);}return _0x527bb2;})['then'](respondWithResult(_0x4aaa22,null))[_0xb47d('0x34')](handleError(_0x4aaa22,null));};exports[_0xb47d('0x3b')]=function(_0xff14d2,_0x40f297){if(!_0xff14d2[_0xb47d('0x3c')][_0xb47d('0x14')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0xff14d2[_0xb47d('0x3c')][_0xb47d('0x30')])throw new Error(_0xb47d('0x3d'));var _0x21319=db[_0xb47d('0x1a')]['rawAttributes'][_0xb47d('0x30')][_0xb47d('0x3e')];if(!_0x21319[_0xb47d('0x3f')](_0xff14d2[_0xb47d('0x3c')][_0xb47d('0x30')]))throw new Error(_0xb47d('0x40')+_0x21319[_0xb47d('0x41')](',\x20'));if(_0xff14d2[_0xb47d('0x3c')]['service']==='MicrosoftAzure'&&_0xff14d2[_0xb47d('0x3c')][_0xb47d('0x33')]){_0xff14d2['body'][_0xb47d('0x33')]=encryptor[_0xb47d('0x42')](_0xff14d2['body'][_0xb47d('0x33')]);}return db[_0xb47d('0x1a')][_0xb47d('0x3b')](_0xff14d2[_0xb47d('0x3c')],{})['then'](respondWithResult(_0x40f297,0xc9))[_0xb47d('0x34')](handleError(_0x40f297,null));};exports[_0xb47d('0xf')]=function(_0x320587,_0x1a0689){if(_0x320587['body']['id']){delete _0x320587[_0xb47d('0x3c')]['id'];}return db[_0xb47d('0x1a')][_0xb47d('0x3a')]({'where':{'id':_0x320587[_0xb47d('0x36')]['id']}})['then'](handleEntityNotFound(_0x1a0689,null))[_0xb47d('0x10')](function(_0x20d7e9){if(_0x20d7e9[_0xb47d('0x30')]===_0xb47d('0x31')&&_0x320587[_0xb47d('0x3c')][_0xb47d('0x33')]){_0x320587[_0xb47d('0x3c')][_0xb47d('0x33')]=encryptor[_0xb47d('0x42')](_0x320587[_0xb47d('0x3c')][_0xb47d('0x33')]);}return _0x20d7e9;})[_0xb47d('0x10')](saveUpdates(_0x320587[_0xb47d('0x3c')],null))['then'](respondWithResult(_0x1a0689,null))[_0xb47d('0x34')](handleError(_0x1a0689,null));};exports['destroy']=function(_0xeb524b,_0x402a24){return db[_0xb47d('0x1a')][_0xb47d('0x3a')]({'where':{'id':_0xeb524b[_0xb47d('0x36')]['id']}})[_0xb47d('0x10')](handleEntityNotFound(_0x402a24,null))[_0xb47d('0x10')](removeEntity(_0x402a24,null))[_0xb47d('0x34')](handleError(_0x402a24,null));};exports[_0xb47d('0x43')]=function(_0x1aa0e4,_0x3c42e4){return db[_0xb47d('0x1a')][_0xb47d('0x44')]({'where':{'id':_0x1aa0e4[_0xb47d('0x36')]['id']},'raw':!![]})['then'](function(_0x42750d){if(!_0x42750d)return _0x3c42e4[_0xb47d('0x7')](0x194);return{'url':oauth[_0xb47d('0x45')](_0x42750d,_0x1aa0e4[_0xb47d('0x46')]['id'])};})['then'](respondWithResult(_0x3c42e4,null))[_0xb47d('0x34')](handleError(_0x3c42e4,null));};exports['oauth2MicrosoftCallback']=function(_0x20147f,_0xfe2188){var _0x1042cd=_0x20147f[_0xb47d('0x3c')];var _0x5eca7f;var _0x5ba3f9;if(_0x1042cd[_0xb47d('0x12')])throw _0x1042cd;redis[_0xb47d('0x47')](_0x1042cd['state'])['then'](function(_0x379626){if(!_0x379626)throw new Error(_0xb47d('0x48'));_0x5eca7f=JSON[_0xb47d('0x49')](_0x379626);var _0x3f4d5a=Buffer[_0xb47d('0x4a')](_0x1042cd[_0xb47d('0x4b')],'base64')[_0xb47d('0x4c')]('ascii');_0x5ba3f9=JSON[_0xb47d('0x49')](_0x3f4d5a);if(!oauth[_0xb47d('0x4d')](_0x1042cd['id_token'],_0x5eca7f[_0xb47d('0x4e')]))throw new Error(_0xb47d('0x4f'));redis['del'](_0x1042cd['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x1042cd[_0xb47d('0x50')],_0x5eca7f);})[_0xb47d('0x10')](function(_0x1fb02a){_0x5eca7f[_0xb47d('0x51')]=_0x1fb02a[_0xb47d('0x52')];_0x5eca7f[_0xb47d('0x53')]=_0x1fb02a[_0xb47d('0x54')];return db['CloudProvider']['update']({'data5':_0x5eca7f['data5'],'data6':_0x5eca7f[_0xb47d('0x53')]},{'where':{'id':_0x5eca7f['id']}});})[_0xb47d('0x10')](function(){oauth['startRefreshInterval'](_0x5eca7f);socket[_0xb47d('0x55')](_0xb47d('0x56'),{'id':_0x5ba3f9['id']});return;})[_0xb47d('0x10')](respondWithStatusCode(_0xfe2188,null))[_0xb47d('0x34')](function(_0x55a0b7){if(_0x5ba3f9){socket[_0xb47d('0x55')](_0xb47d('0x57'),{'id':_0x5ba3f9['id']});}if(!_0x5eca7f){logger[_0xb47d('0x12')](_0xb47d('0x58'),_0x55a0b7);return _0xfe2188[_0xb47d('0x8')](0x1f4)[_0xb47d('0x15')](_0x55a0b7[_0xb47d('0x59')]);}logger[_0xb47d('0x12')](_0xb47d('0x5a'),_0x5eca7f['id'],JSON[_0xb47d('0x5b')](_0x55a0b7));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 778db76..796e7cd 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 _0x195b=['rimraf','../../config/environment','exports','define','CloudProvider','cloud_providers','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0xced98a,_0x5cb79a){var _0x2055db=function(_0x7c4807){while(--_0x7c4807){_0xced98a['push'](_0xced98a['shift']());}};_0x2055db(++_0x5cb79a);}(_0x195b,0x1c0));var _0xb195=function(_0x19eea4,_0x333721){_0x19eea4=_0x19eea4-0x0;var _0x413d38=_0x195b[_0x19eea4];return _0x413d38;};'use strict';var _=require(_0xb195('0x0'));var util=require(_0xb195('0x1'));var logger=require('../../config/logger')(_0xb195('0x2'));var moment=require(_0xb195('0x3'));var BPromise=require(_0xb195('0x4'));var rp=require(_0xb195('0x5'));var fs=require('fs');var path=require(_0xb195('0x6'));var rimraf=require(_0xb195('0x7'));var config=require(_0xb195('0x8'));var attributes=require('./cloudProvider.attributes');module[_0xb195('0x9')]=function(_0x17713c,_0x5622c3){return _0x17713c[_0xb195('0xa')](_0xb195('0xb'),attributes,{'tableName':_0xb195('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8ef=['request-promise','path','rimraf','../../config/environment','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','moment','bluebird'];(function(_0x949cc1,_0x5903ba){var _0x52cc2e=function(_0x3f19a9){while(--_0x3f19a9){_0x949cc1['push'](_0x949cc1['shift']());}};_0x52cc2e(++_0x5903ba);}(_0xc8ef,0xb1));var _0xfc8e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xc8ef[_0x187ee1];return _0x388160;};'use strict';var _=require(_0xfc8e('0x0'));var util=require(_0xfc8e('0x1'));var logger=require(_0xfc8e('0x2'))('api');var moment=require(_0xfc8e('0x3'));var BPromise=require(_0xfc8e('0x4'));var rp=require(_0xfc8e('0x5'));var fs=require('fs');var path=require(_0xfc8e('0x6'));var rimraf=require(_0xfc8e('0x7'));var config=require(_0xfc8e('0x8'));var attributes=require('./cloudProvider.attributes');module[_0xfc8e('0x9')]=function(_0x19a878,_0x1a04a6){return _0x19a878[_0xfc8e('0xa')](_0xfc8e('0xb'),attributes,{'tableName':_0xfc8e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 8f48ac4..4fc2bb8 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x754c=['access_token','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','all','catch','inspect','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','type','Dynamics365','push','data7','/.default','Outlook365','replace','{TENANT_ID}','id_token','from','stringify','toString','base64','client_id','data1','response_type','redirect_uri','data4','response_mode','scope','nonce','map','key','value','join','set','decode','payload','issuer','aud','audience','isAfter','unix','exp','resolve','then','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data2','data5'];(function(_0x14854e,_0x731c62){var _0x2f96d0=function(_0x4dcc99){while(--_0x4dcc99){_0x14854e['push'](_0x14854e['shift']());}};_0x2f96d0(++_0x731c62);}(_0x754c,0xeb));var _0xc754=function(_0x1e5dfc,_0x5791eb){_0x1e5dfc=_0x1e5dfc-0x0;var _0x519071=_0x754c[_0x1e5dfc];return _0x519071;};'use strict';var _=require(_0xc754('0x0'));var crypto=require(_0xc754('0x1'));var jwt=require(_0xc754('0x2'));var moment=require(_0xc754('0x3'));var Redis=require(_0xc754('0x4'));var rp=require(_0xc754('0x5'));var util=require('util');var encryptor=require(_0xc754('0x6'));var config=require(_0xc754('0x7'));var logger=require(_0xc754('0x8'))('api');var schedule=require(_0xc754('0x9'));var db=require(_0xc754('0xa'))['db'];config[_0xc754('0xb')]=_['defaults'](config[_0xc754('0xb')],{'host':_0xc754('0xc'),'port':0x18eb});var redis=new Redis(config[_0xc754('0xb')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0xc754('0xd'),_0xc754('0xe'),_0xc754('0xf'),_0xc754('0x10'),_0xc754('0x11'),_0xc754('0x12'),_0xc754('0x13')],'Dynamics365':[_0xc754('0xd'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xc754('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xe7111d){var _0x10e369=_['map'](AZURE_AUTH_SCOPES[_0xe7111d[_0xc754('0x15')]]);if(_0xe7111d[_0xc754('0x15')]===_0xc754('0x16'))_0x10e369[_0xc754('0x17')](_0xe7111d[_0xc754('0x18')]+_0xc754('0x19'));return _0x10e369['join']('\x20');}function getAccessTokenScope(_0x3336f4){if(_0x3336f4[_0xc754('0x15')]===_0xc754('0x1a'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x3336f4[_0xc754('0x15')]===_0xc754('0x16'))return _0x3336f4[_0xc754('0x18')]+_0xc754('0x19');}function generateMicrosoftAuthorizationUrl(_0x1ff16a,_0x799a8){var _0x405fe0=MICROSOFT_AUTH_URL[_0xc754('0x1b')](_0xc754('0x1c'),_0x1ff16a['data2']);var _0x274124=['code',_0xc754('0x1d')];var _0x2a6d52=Buffer[_0xc754('0x1e')](JSON[_0xc754('0x1f')]({'id':_0x799a8}))[_0xc754('0x20')](_0xc754('0x21'));var _0x5b325a=crypto['randomBytes'](0x10)['toString']('hex');var _0x188749=getAuthorizationScopes(_0x1ff16a);var _0x5601b4=[{'key':_0xc754('0x22'),'value':_0x1ff16a[_0xc754('0x23')]},{'key':_0xc754('0x24'),'value':encodeURIComponent(_0x274124['join']('\x20'))},{'key':_0xc754('0x25'),'value':_0x1ff16a[_0xc754('0x26')]},{'key':_0xc754('0x27'),'value':'form_post'},{'key':_0xc754('0x28'),'value':encodeURIComponent(_0x188749)},{'key':'state','value':_0x2a6d52},{'key':_0xc754('0x29'),'value':_0x5b325a},{'key':'prompt','value':'login'}];var _0x35f060=_0x405fe0+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xc754('0x2a')](_0x5601b4,function(_0x756e90){return _0x756e90[_0xc754('0x2b')]+'='+_0x756e90[_0xc754('0x2c')];})[_0xc754('0x2d')]('&');_0x1ff16a['oauth2Claims']={'issuer':_0x405fe0[_0xc754('0x1b')]('oauth2/',''),'audience':_0x1ff16a[_0xc754('0x23')],'state':_0x2a6d52,'nonce':_0x5b325a};redis[_0xc754('0x2e')](_0x2a6d52,JSON[_0xc754('0x1f')](_0x1ff16a));return _0x35f060;}function isValidIdToken(_0x524a2c,_0x168f71){try{var _0x57513a=jwt[_0xc754('0x2f')](_0x524a2c,{'complete':!![]});var _0x12c63f=_0x57513a[_0xc754('0x30')];if(_0x12c63f['iss']!==_0x168f71[_0xc754('0x31')])return![];if(_0x12c63f[_0xc754('0x32')]!==_0x168f71[_0xc754('0x33')])return![];if(_0x12c63f['nonce']!==_0x168f71[_0xc754('0x29')])return![];if(moment()[_0xc754('0x34')](moment[_0xc754('0x35')](_0x12c63f[_0xc754('0x36')])))return![];return!![];}catch(_0x292d6f){throw _0x292d6f;}}function refreshOauth2MicrosoftAccessToken(_0x2dcf7b){return Promise[_0xc754('0x37')]()[_0xc754('0x38')](function(){if(_0x2dcf7b['data3'])return _0x2dcf7b;return db[_0xc754('0x39')][_0xc754('0x3a')]({'where':{'id':_0x2dcf7b['id']},'raw':!![]});})['then'](function(_0x367800){var _0x13ef8e={'grant_type':_0xc754('0x3b'),'refresh_token':_0x367800[_0xc754('0x3c')],'scope':getAccessTokenScope(_0x367800),'redirect_uri':_0x367800[_0xc754('0x26')],'client_id':_0x367800['data1'],'client_secret':encryptor[_0xc754('0x3d')](_0x367800['data3'])};var _0x404aed={'method':_0xc754('0x3e'),'uri':MICROSOFT_AUTH_URL[_0xc754('0x1b')]('{TENANT_ID}',_0x367800[_0xc754('0x3f')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x13ef8e,'json':!![]};return rp(_0x404aed);})['then'](function(_0x168fc6){_0x2dcf7b[_0xc754('0x40')]=_0x168fc6[_0xc754('0x41')];_0x2dcf7b[_0xc754('0x3c')]=_0x168fc6[_0xc754('0x3b')];return db[_0xc754('0x39')][_0xc754('0x42')]({'data5':_0x2dcf7b[_0xc754('0x40')],'data6':_0x2dcf7b[_0xc754('0x3c')]},{'where':{'id':_0x2dcf7b['id']}});})['then'](function(){return _0x2dcf7b;})['catch'](function(_0x2d1a51){logger[_0xc754('0x43')](_0xc754('0x44'),_0x2dcf7b['id'],_0x2d1a51);});}function getOauth2MicrosoftAccessToken(_0x4c88ef,_0x37d31e){var _0x3c0bde={'grant_type':_0xc754('0x45'),'code':_0x4c88ef,'scope':getAccessTokenScope(_0x37d31e),'redirect_uri':_0x37d31e[_0xc754('0x26')],'client_id':_0x37d31e['data1'],'client_secret':encryptor['decryptString'](_0x37d31e['data3'])};var _0x29296d={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xc754('0x1b')](_0xc754('0x1c'),_0x37d31e['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3c0bde,'json':!![]};return rp(_0x29296d);}function startRefreshInterval(_0x4301ab){var _0x56db51=schedule[_0xc754('0x46')];if(_0x56db51[_0x4301ab['id']])clearInterval(_0x56db51[_0x4301ab['id']]);_0x56db51[_0x4301ab['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xc754('0x47')](this,{'id':_0x4301ab['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xc754('0x46')]=_0x56db51;}function startAllRefreshIntervals(){return db[_0xc754('0x39')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xc754('0x38')](function(_0x48c721){var _0xa2c826=_0x48c721[_0xc754('0x2a')](function(_0x5638ca){return refreshOauth2MicrosoftAccessToken(_0x5638ca)[_0xc754('0x38')](function(_0x2b4e43){startRefreshInterval(_0x2b4e43);});});return Promise[_0xc754('0x48')](_0xa2c826);})[_0xc754('0x49')](function(_0x383ad1){var _0x2a1f21=_0x383ad1?util[_0xc754('0x4a')](_0x383ad1,{'showHidden':![],'depth':null}):'';logger[_0xc754('0x43')]('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x2a1f21);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x4752=['resolve','then','data3','CloudProvider','findOne','decryptString','POST','access_token','data6','data5','catch','authorization_code','intervals','bind','all','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','crypto','moment','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','defaults','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','/token','map','type','Dynamics365','push','data7','/.default','replace','{TENANT_ID}','data2','id_token','toString','randomBytes','hex','data1','response_type','join','data4','form_post','scope','state','nonce','prompt','key','value','oauth2/','payload','iss','aud','isAfter','unix','exp'];(function(_0x5da086,_0x3b56ce){var _0x4b23fd=function(_0x3b4caa){while(--_0x3b4caa){_0x5da086['push'](_0x5da086['shift']());}};_0x4b23fd(++_0x3b56ce);}(_0x4752,0x93));var _0x2475=function(_0x279eb4,_0x11b8c0){_0x279eb4=_0x279eb4-0x0;var _0x24f399=_0x4752[_0x279eb4];return _0x24f399;};'use strict';var _=require('lodash');var crypto=require(_0x2475('0x0'));var jwt=require('jsonwebtoken');var moment=require(_0x2475('0x1'));var Redis=require(_0x2475('0x2'));var rp=require('request-promise');var util=require(_0x2475('0x3'));var encryptor=require(_0x2475('0x4'));var config=require(_0x2475('0x5'));var logger=require(_0x2475('0x6'))('api');var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config['redis']=_[_0x2475('0x7')](config[_0x2475('0x8')],{'host':_0x2475('0x9'),'port':0x18eb});var redis=new Redis(config[_0x2475('0x8')]);var MICROSOFT_AUTH_URL=_0x2475('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0x2475('0xb'),_0x2475('0xc'),_0x2475('0xd'),_0x2475('0xe'),_0x2475('0xf'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x2475('0xb'),_0x2475('0xe')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x2475('0x10');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5b132c){var _0x41fdf4=_[_0x2475('0x11')](AZURE_AUTH_SCOPES[_0x5b132c[_0x2475('0x12')]]);if(_0x5b132c[_0x2475('0x12')]===_0x2475('0x13'))_0x41fdf4[_0x2475('0x14')](_0x5b132c[_0x2475('0x15')]+_0x2475('0x16'));return _0x41fdf4['join']('\x20');}function getAccessTokenScope(_0x3415fc){if(_0x3415fc[_0x2475('0x12')]==='Outlook365')return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x3415fc['type']===_0x2475('0x13'))return _0x3415fc[_0x2475('0x15')]+_0x2475('0x16');}function generateMicrosoftAuthorizationUrl(_0x2754cd,_0x255eba){var _0x4a0ff0=MICROSOFT_AUTH_URL[_0x2475('0x17')](_0x2475('0x18'),_0x2754cd[_0x2475('0x19')]);var _0x3432ce=['code',_0x2475('0x1a')];var _0x1a10c0=Buffer['from'](JSON['stringify']({'id':_0x255eba}))[_0x2475('0x1b')]('base64');var _0x317b3a=crypto[_0x2475('0x1c')](0x10)[_0x2475('0x1b')](_0x2475('0x1d'));var _0x130f6f=getAuthorizationScopes(_0x2754cd);var _0x1f6dfe=[{'key':'client_id','value':_0x2754cd[_0x2475('0x1e')]},{'key':_0x2475('0x1f'),'value':encodeURIComponent(_0x3432ce[_0x2475('0x20')]('\x20'))},{'key':'redirect_uri','value':_0x2754cd[_0x2475('0x21')]},{'key':'response_mode','value':_0x2475('0x22')},{'key':_0x2475('0x23'),'value':encodeURIComponent(_0x130f6f)},{'key':_0x2475('0x24'),'value':_0x1a10c0},{'key':_0x2475('0x25'),'value':_0x317b3a},{'key':_0x2475('0x26'),'value':'login'}];var _0x1e99fd=_0x4a0ff0+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x2475('0x11')](_0x1f6dfe,function(_0x46cd62){return _0x46cd62[_0x2475('0x27')]+'='+_0x46cd62[_0x2475('0x28')];})[_0x2475('0x20')]('&');_0x2754cd['oauth2Claims']={'issuer':_0x4a0ff0[_0x2475('0x17')](_0x2475('0x29'),''),'audience':_0x2754cd[_0x2475('0x1e')],'state':_0x1a10c0,'nonce':_0x317b3a};redis['set'](_0x1a10c0,JSON['stringify'](_0x2754cd));return _0x1e99fd;}function isValidIdToken(_0x296b4b,_0x18f8ae){try{var _0x274986=jwt['decode'](_0x296b4b,{'complete':!![]});var _0x219dad=_0x274986[_0x2475('0x2a')];if(_0x219dad[_0x2475('0x2b')]!==_0x18f8ae['issuer'])return![];if(_0x219dad[_0x2475('0x2c')]!==_0x18f8ae['audience'])return![];if(_0x219dad[_0x2475('0x25')]!==_0x18f8ae[_0x2475('0x25')])return![];if(moment()[_0x2475('0x2d')](moment[_0x2475('0x2e')](_0x219dad[_0x2475('0x2f')])))return![];return!![];}catch(_0x14060d){throw _0x14060d;}}function refreshOauth2MicrosoftAccessToken(_0x45c425){return Promise[_0x2475('0x30')]()[_0x2475('0x31')](function(){if(_0x45c425[_0x2475('0x32')])return _0x45c425;return db[_0x2475('0x33')][_0x2475('0x34')]({'where':{'id':_0x45c425['id']},'raw':!![]});})[_0x2475('0x31')](function(_0x1baa26){var _0x13bde9={'grant_type':'refresh_token','refresh_token':_0x1baa26['data6'],'scope':getAccessTokenScope(_0x1baa26),'redirect_uri':_0x1baa26[_0x2475('0x21')],'client_id':_0x1baa26[_0x2475('0x1e')],'client_secret':encryptor[_0x2475('0x35')](_0x1baa26[_0x2475('0x32')])};var _0x2829ee={'method':_0x2475('0x36'),'uri':MICROSOFT_AUTH_URL['replace'](_0x2475('0x18'),_0x1baa26[_0x2475('0x19')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x13bde9,'json':!![]};return rp(_0x2829ee);})[_0x2475('0x31')](function(_0x2db4c9){_0x45c425['data5']=_0x2db4c9[_0x2475('0x37')];_0x45c425[_0x2475('0x38')]=_0x2db4c9['refresh_token'];return db[_0x2475('0x33')]['update']({'data5':_0x45c425[_0x2475('0x39')],'data6':_0x45c425[_0x2475('0x38')]},{'where':{'id':_0x45c425['id']}});})[_0x2475('0x31')](function(){return _0x45c425;})[_0x2475('0x3a')](function(_0xa5d19f){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x45c425['id'],_0xa5d19f);});}function getOauth2MicrosoftAccessToken(_0x587258,_0x3ed31f){var _0x16a98a={'grant_type':_0x2475('0x3b'),'code':_0x587258,'scope':getAccessTokenScope(_0x3ed31f),'redirect_uri':_0x3ed31f[_0x2475('0x21')],'client_id':_0x3ed31f['data1'],'client_secret':encryptor['decryptString'](_0x3ed31f[_0x2475('0x32')])};var _0x1f82d0={'method':_0x2475('0x36'),'uri':MICROSOFT_AUTH_URL[_0x2475('0x17')](_0x2475('0x18'),_0x3ed31f[_0x2475('0x19')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x16a98a,'json':!![]};return rp(_0x1f82d0);}function startRefreshInterval(_0x2f2dc2){var _0x14f800=schedule[_0x2475('0x3c')];if(_0x14f800[_0x2f2dc2['id']])clearInterval(_0x14f800[_0x2f2dc2['id']]);_0x14f800[_0x2f2dc2['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x2475('0x3d')](this,{'id':_0x2f2dc2['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x14f800;}function startAllRefreshIntervals(){return db[_0x2475('0x33')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x2475('0x31')](function(_0x43c215){var _0x5baeeb=_0x43c215[_0x2475('0x11')](function(_0x4b3099){return refreshOauth2MicrosoftAccessToken(_0x4b3099)[_0x2475('0x31')](function(_0x500e29){startRefreshInterval(_0x500e29);});});return Promise[_0x2475('0x3e')](_0x5baeeb);})[_0x2475('0x3a')](function(_0x37ac87){var _0x19aa3a=_0x37ac87?util['inspect'](_0x37ac87,{'showHidden':![],'depth':null}):'';logger[_0x2475('0x3f')](_0x2475('0x40'),_0x19aa3a);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 21d3038..05bfda6 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 _0xd08d=['http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x1e0052,_0x4af3fe){var _0x4a55fe=function(_0x4d1091){while(--_0x4d1091){_0x1e0052['push'](_0x1e0052['shift']());}};_0x4a55fe(++_0x4af3fe);}(_0xd08d,0x81));var _0xdd08=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xd08d[_0x164eca];return _0x2ce562;};'use strict';var _=require('lodash');var util=require(_0xdd08('0x0'));var moment=require(_0xdd08('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd08('0x2'));var fs=require('fs');var Redis=require(_0xdd08('0x3'));var db=require(_0xdd08('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd08('0x5'))(_0xdd08('0x6'));var config=require(_0xdd08('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdd08('0x8')][_0xdd08('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13999f,_0x28d59c,_0x147a23){return new BPromise(function(_0x54a5a3,_0x15416b){return client[_0xdd08('0xa')](_0x13999f,_0x147a23)[_0xdd08('0xb')](function(_0x51ce97){logger[_0xdd08('0xc')](_0xdd08('0xd'),_0x28d59c,_0xdd08('0xe'));logger[_0xdd08('0xf')](_0xdd08('0x10'),_0x28d59c,_0xdd08('0xe'),JSON[_0xdd08('0x11')](_0x51ce97));if(_0x51ce97[_0xdd08('0x12')]){if(_0x51ce97[_0xdd08('0x12')][_0xdd08('0x13')]===0x1f4){logger[_0xdd08('0x12')](_0xdd08('0xd'),_0x28d59c,_0x51ce97['error'][_0xdd08('0x14')]);return _0x15416b(_0x51ce97[_0xdd08('0x12')][_0xdd08('0x14')]);}logger[_0xdd08('0x12')](_0xdd08('0xd'),_0x28d59c,_0x51ce97[_0xdd08('0x12')][_0xdd08('0x14')]);return _0x54a5a3(_0x51ce97[_0xdd08('0x12')][_0xdd08('0x14')]);}else{logger[_0xdd08('0xc')](_0xdd08('0xd'),_0x28d59c,_0xdd08('0xe'));_0x54a5a3(_0x51ce97[_0xdd08('0x15')][_0xdd08('0x14')]);}})[_0xdd08('0x16')](function(_0x278f5e){logger[_0xdd08('0x12')](_0xdd08('0xd'),_0x28d59c,_0x278f5e);_0x15416b(_0x278f5e);});});} \ No newline at end of file +var _0xe2ab=['CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','request\x20sent','debug'];(function(_0xf35bd4,_0x51ff64){var _0x47912b=function(_0x269818){while(--_0x269818){_0xf35bd4['push'](_0xf35bd4['shift']());}};_0x47912b(++_0x51ff64);}(_0xe2ab,0xc4));var _0xbe2a=function(_0x391d6d,_0x3a747c){_0x391d6d=_0x391d6d-0x0;var _0x37d5c6=_0xe2ab[_0x391d6d];return _0x37d5c6;};'use strict';var _=require(_0xbe2a('0x0'));var util=require(_0xbe2a('0x1'));var moment=require(_0xbe2a('0x2'));var BPromise=require(_0xbe2a('0x3'));var rs=require(_0xbe2a('0x4'));var fs=require('fs');var Redis=require(_0xbe2a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe2a('0x6'));var logger=require(_0xbe2a('0x7'))(_0xbe2a('0x8'));var config=require(_0xbe2a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbe2a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f504b,_0x58b8f1,_0x5a8a5d){return new BPromise(function(_0xfccbff,_0x232194){return client['request'](_0x2f504b,_0x5a8a5d)['then'](function(_0x83d775){logger[_0xbe2a('0xb')]('CloudProvider,\x20%s,\x20%s',_0x58b8f1,_0xbe2a('0xc'));logger[_0xbe2a('0xd')](_0xbe2a('0xe'),_0x58b8f1,_0xbe2a('0xc'),JSON[_0xbe2a('0xf')](_0x83d775));if(_0x83d775['error']){if(_0x83d775['error']['code']===0x1f4){logger[_0xbe2a('0x10')](_0xbe2a('0x11'),_0x58b8f1,_0x83d775[_0xbe2a('0x10')][_0xbe2a('0x12')]);return _0x232194(_0x83d775[_0xbe2a('0x10')]['message']);}logger[_0xbe2a('0x10')](_0xbe2a('0x11'),_0x58b8f1,_0x83d775[_0xbe2a('0x10')]['message']);return _0xfccbff(_0x83d775[_0xbe2a('0x10')][_0xbe2a('0x12')]);}else{logger[_0xbe2a('0xb')](_0xbe2a('0x11'),_0x58b8f1,_0xbe2a('0xc'));_0xfccbff(_0x83d775[_0xbe2a('0x13')][_0xbe2a('0x12')]);}})[_0xbe2a('0x14')](function(_0x4395fe){logger['error'](_0xbe2a('0x11'),_0x58b8f1,_0x4395fe);_0x232194(_0x4395fe);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index e5bb872..a6d09f2 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 _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x1deac0,_0x4e0895){var _0x4e38a7=function(_0x32739a){while(--_0x32739a){_0x1deac0['push'](_0x1deac0['shift']());}};_0x4e38a7(++_0x4e0895);}(_0xdb28,0x106));var _0x8db2=function(_0x104a8a,_0x19421a){_0x104a8a=_0x104a8a-0x0;var _0x314058=_0xdb28[_0x104a8a];return _0x314058;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7a54=['isAuthenticated','/:id','show','post','create','delete','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback','exports','express','Router','../../components/auth/service','get'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x7a54,0x106));var _0x47a5=function(_0x4344b7,_0x20113b){_0x4344b7=_0x4344b7-0x0;var _0x570f7d=_0x7a54[_0x4344b7];return _0x570f7d;};'use strict';var express=require(_0x47a5('0x0'));var router=express[_0x47a5('0x1')]();var auth=require(_0x47a5('0x2'));var controller=require('./cloudProvider.controller');router[_0x47a5('0x3')]('/',auth[_0x47a5('0x4')](),controller['index']);router[_0x47a5('0x3')](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller[_0x47a5('0x6')]);router[_0x47a5('0x7')]('/',auth['isAuthenticated'](),controller[_0x47a5('0x8')]);router['put'](_0x47a5('0x5'),auth[_0x47a5('0x4')](),controller['update']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47a5('0x3')](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router['post']('/oauth2/microsoft/callback',controller[_0x47a5('0xc')]);module[_0x47a5('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 5dafe2d..592bdf7 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 _0xf6d5=['name','sequelize','exports','STRING'];(function(_0x5ce2bd,_0x267de7){var _0x68a7e7=function(_0x1e484c){while(--_0x1e484c){_0x5ce2bd['push'](_0x5ce2bd['shift']());}};_0x68a7e7(++_0x267de7);}(_0xf6d5,0x179));var _0x5f6d=function(_0x485201,_0x3c533a){_0x485201=_0x485201-0x0;var _0x9ca98a=_0xf6d5[_0x485201];return _0x9ca98a;};'use strict';var Sequelize=require(_0x5f6d('0x0'));module[_0x5f6d('0x1')]={'name':{'type':Sequelize[_0x5f6d('0x2')],'unique':_0x5f6d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x5f6d('0x2')]},'website':{'type':Sequelize[_0x5f6d('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x5f6d('0x2')]},'type':{'type':Sequelize[_0x5f6d('0x2')]},'street':{'type':Sequelize[_0x5f6d('0x2')]},'postalCode':{'type':Sequelize[_0x5f6d('0x2')]},'city':{'type':Sequelize[_0x5f6d('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x5f6d('0x2')]},'sStreet':{'type':Sequelize[_0x5f6d('0x2')]},'sPostalCode':{'type':Sequelize[_0x5f6d('0x2')]},'sCity':{'type':Sequelize[_0x5f6d('0x2')]},'sCountry':{'type':Sequelize[_0x5f6d('0x2')]},'description':{'type':Sequelize[_0x5f6d('0x2')]}}; \ No newline at end of file +var _0xa468=['name','STRING'];(function(_0x15cf11,_0x5a3678){var _0x3ed63f=function(_0xed467d){while(--_0xed467d){_0x15cf11['push'](_0x15cf11['shift']());}};_0x3ed63f(++_0x5a3678);}(_0xa468,0xef));var _0x8a46=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xa468[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8a46('0x0')],'unique':_0x8a46('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x8a46('0x0')]},'companyId':{'type':Sequelize[_0x8a46('0x0')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x8a46('0x0')]},'fax':{'type':Sequelize[_0x8a46('0x0')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x8a46('0x0')]},'postalCode':{'type':Sequelize[_0x8a46('0x0')]},'city':{'type':Sequelize[_0x8a46('0x0')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8a46('0x0')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x8a46('0x0')]},'sPostalCode':{'type':Sequelize[_0x8a46('0x0')]},'sCity':{'type':Sequelize[_0x8a46('0x0')]},'sCountry':{'type':Sequelize[_0x8a46('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 284ee79..38c9ad5 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 _0xe7ed=['Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Companies','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','findOne','CmContact','pick','nolimit','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','stack','name','index','CmCompany','describe','model','keys','query','filters','fields','attributes','hasOwnProperty','order','sort','where','filter','merge','map','options','includeAll','include','findAll','catch','show','params','rawAttributes','intersection','length','find','create','body'];(function(_0x9b9b84,_0x5af466){var _0x73b9ea=function(_0x5cc826){while(--_0x5cc826){_0x9b9b84['push'](_0x9b9b84['shift']());}};_0x73b9ea(++_0x5af466);}(_0xe7ed,0x174));var _0xde7e=function(_0x52272d,_0x32757b){_0x52272d=_0x52272d-0x0;var _0x144092=_0xe7ed[_0x52272d];return _0x144092;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xde7e('0x0'));var zipdir=require(_0xde7e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xde7e('0x2'));var moment=require(_0xde7e('0x3'));var BPromise=require(_0xde7e('0x4'));var Mustache=require(_0xde7e('0x5'));var util=require(_0xde7e('0x6'));var path=require(_0xde7e('0x7'));var sox=require('sox');var csv=require(_0xde7e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde7e('0x9'));var _=require(_0xde7e('0xa'));var squel=require('squel');var crypto=require(_0xde7e('0xb'));var jsforce=require(_0xde7e('0xc'));var deskjs=require(_0xde7e('0xd'));var toCsv=require(_0xde7e('0x8'));var querystring=require(_0xde7e('0xe'));var Papa=require(_0xde7e('0xf'));var Redis=require(_0xde7e('0x10'));var authService=require(_0xde7e('0x11'));var qs=require(_0xde7e('0x12'));var as=require(_0xde7e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xde7e('0x14'));var utils=require(_0xde7e('0x15'));var config=require(_0xde7e('0x16'));var licenseUtil=require(_0xde7e('0x17'));var db=require(_0xde7e('0x18'))['db'];function respondWithStatusCode(_0x1415a2,_0x1e5760){_0x1e5760=_0x1e5760||0xcc;return function(_0x1b1139){if(_0x1b1139){return _0x1415a2[_0xde7e('0x19')](_0x1e5760);}return _0x1415a2[_0xde7e('0x1a')](_0x1e5760)[_0xde7e('0x1b')]();};}function respondWithResult(_0x5bb48d,_0x20d520){_0x20d520=_0x20d520||0xc8;return function(_0x5b0ca8){if(_0x5b0ca8){return _0x5bb48d[_0xde7e('0x1a')](_0x20d520)[_0xde7e('0x1c')](_0x5b0ca8);}};}function respondWithFilteredResult(_0x1adaf6,_0x2b11fd){return function(_0x5bf8bd){if(_0x5bf8bd){var _0x158dbe=typeof _0x2b11fd['offset']===_0xde7e('0x1d')&&typeof _0x2b11fd[_0xde7e('0x1e')]===_0xde7e('0x1d');var _0x28e3eb=_0x5bf8bd[_0xde7e('0x1f')];var _0x13af61=_0x158dbe?0x0:_0x2b11fd[_0xde7e('0x20')];var _0x30f83b=_0x158dbe?_0x5bf8bd[_0xde7e('0x1f')]:_0x2b11fd[_0xde7e('0x20')]+_0x2b11fd[_0xde7e('0x1e')];var _0x1cda46;if(_0x30f83b>=_0x28e3eb){_0x30f83b=_0x28e3eb;_0x1cda46=0xc8;}else{_0x1cda46=0xce;}_0x1adaf6[_0xde7e('0x1a')](_0x1cda46);return _0x1adaf6[_0xde7e('0x21')](_0xde7e('0x22'),_0x13af61+'-'+_0x30f83b+'/'+_0x28e3eb)[_0xde7e('0x1c')](_0x5bf8bd);}return null;};}function patchUpdates(_0x54f7e1){return function(_0x26a1e6){try{jsonpatch[_0xde7e('0x23')](_0x26a1e6,_0x54f7e1,!![]);}catch(_0x3539fb){return BPromise['reject'](_0x3539fb);}return _0x26a1e6[_0xde7e('0x24')]();};}function saveUpdates(_0x21e659,_0x386c9a){return function(_0x3ec9f3){if(_0x3ec9f3){return _0x3ec9f3[_0xde7e('0x25')](_0x21e659)[_0xde7e('0x26')](function(_0x502cd6){return _0x502cd6;});}return null;};}function removeEntity(_0x4d2f8d,_0x58a314){return function(_0x996a74){if(_0x996a74){return _0x996a74[_0xde7e('0x27')]()[_0xde7e('0x26')](function(){var _0x36d3bf=_0x996a74[_0xde7e('0x28')]({'plain':!![]});var _0x2626d8='Companies';return db[_0xde7e('0x29')][_0xde7e('0x27')]({'where':{'type':_0x2626d8,'resourceId':_0x36d3bf['id']}})[_0xde7e('0x26')](function(){return _0x996a74;});})[_0xde7e('0x26')](function(){_0x4d2f8d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43baf1,_0x45ac4a){return function(_0xef0e7e){if(!_0xef0e7e){_0x43baf1[_0xde7e('0x19')](0x194);}return _0xef0e7e;};}function handleError(_0x35ffdd,_0x51634f){_0x51634f=_0x51634f||0x1f4;return function(_0x113eae){logger['error'](_0x113eae[_0xde7e('0x2a')]);if(_0x113eae[_0xde7e('0x2b')]){delete _0x113eae[_0xde7e('0x2b')];}_0x35ffdd[_0xde7e('0x1a')](_0x51634f)['send'](_0x113eae);};}exports[_0xde7e('0x2c')]=function(_0x37c797,_0x1c2b96){var _0x54f1ac={},_0x24ad97={},_0x54ae92={'count':0x0,'rows':[]};return db[_0xde7e('0x2d')][_0xde7e('0x2e')]()[_0xde7e('0x26')](function(_0x1eace6){_0x24ad97[_0xde7e('0x2f')]=_[_0xde7e('0x30')](_0x1eace6);_0x24ad97[_0xde7e('0x31')]=_[_0xde7e('0x30')](_0x37c797['query']);_0x24ad97[_0xde7e('0x32')]=_['intersection'](_0x24ad97['model'],_0x24ad97['query']);_0x54f1ac['attributes']=_['intersection'](_0x24ad97[_0xde7e('0x2f')],qs[_0xde7e('0x33')](_0x37c797[_0xde7e('0x31')][_0xde7e('0x33')]));_0x54f1ac[_0xde7e('0x34')]=_0x54f1ac[_0xde7e('0x34')]['length']?_0x54f1ac[_0xde7e('0x34')]:_0x24ad97[_0xde7e('0x2f')];if(!_0x37c797['query'][_0xde7e('0x35')]('nolimit')){_0x54f1ac[_0xde7e('0x1e')]=qs['limit'](_0x37c797[_0xde7e('0x31')][_0xde7e('0x1e')]);_0x54f1ac[_0xde7e('0x20')]=qs['offset'](_0x37c797[_0xde7e('0x31')]['offset']);}_0x54f1ac[_0xde7e('0x36')]=qs[_0xde7e('0x37')](_0x37c797[_0xde7e('0x31')][_0xde7e('0x37')]);_0x54f1ac[_0xde7e('0x38')]=qs['filters'](_['pick'](_0x37c797['query'],_0x24ad97['filters']),_0x1eace6);if(_0x37c797[_0xde7e('0x31')][_0xde7e('0x39')]){_0x54f1ac['where']=_[_0xde7e('0x3a')](_0x54f1ac[_0xde7e('0x38')],{'$or':_[_0xde7e('0x3b')](_0x54f1ac[_0xde7e('0x34')],function(_0x4bd521){var _0x4da77c={};_0x4da77c[_0x4bd521]={'$like':'%'+_0x37c797['query']['filter']+'%'};return _0x4da77c;})});}_0x54f1ac=_[_0xde7e('0x3a')]({},_0x54f1ac,_0x37c797[_0xde7e('0x3c')]);var _0x564ff8={'where':_0x54f1ac[_0xde7e('0x38')]};return db[_0xde7e('0x2d')]['count'](_0x564ff8)[_0xde7e('0x26')](function(_0x3330ce){_0x54ae92[_0xde7e('0x1f')]=_0x3330ce;if(_0x37c797[_0xde7e('0x31')][_0xde7e('0x3d')]){_0x54f1ac[_0xde7e('0x3e')]=[{'all':!![]}];}return db[_0xde7e('0x2d')][_0xde7e('0x3f')](_0x54f1ac);})[_0xde7e('0x26')](function(_0x45bacb){_0x54ae92['rows']=_0x45bacb;return _0x54ae92;})[_0xde7e('0x26')](respondWithFilteredResult(_0x1c2b96,_0x54f1ac))[_0xde7e('0x40')](handleError(_0x1c2b96,null));})[_0xde7e('0x40')](handleError(_0x1c2b96,null));};exports[_0xde7e('0x41')]=function(_0x3e7b78,_0x15b514){var _0x26c6ab={'raw':![],'where':{'id':_0x3e7b78[_0xde7e('0x42')]['id']}},_0x322a64={};_0x322a64[_0xde7e('0x2f')]=_[_0xde7e('0x30')](db[_0xde7e('0x2d')][_0xde7e('0x43')]);_0x322a64['query']=_[_0xde7e('0x30')](_0x3e7b78[_0xde7e('0x31')]);_0x322a64[_0xde7e('0x32')]=_[_0xde7e('0x44')](_0x322a64[_0xde7e('0x2f')],_0x322a64[_0xde7e('0x31')]);_0x26c6ab[_0xde7e('0x34')]=_[_0xde7e('0x44')](_0x322a64[_0xde7e('0x2f')],qs[_0xde7e('0x33')](_0x3e7b78[_0xde7e('0x31')][_0xde7e('0x33')]));_0x26c6ab[_0xde7e('0x34')]=_0x26c6ab[_0xde7e('0x34')][_0xde7e('0x45')]?_0x26c6ab[_0xde7e('0x34')]:_0x322a64['model'];if(_0x3e7b78['query'][_0xde7e('0x3d')]){_0x26c6ab[_0xde7e('0x3e')]=[{'all':!![]}];}_0x26c6ab=_[_0xde7e('0x3a')]({},_0x26c6ab,_0x3e7b78[_0xde7e('0x3c')]);return db[_0xde7e('0x2d')][_0xde7e('0x46')](_0x26c6ab)[_0xde7e('0x26')](handleEntityNotFound(_0x15b514,null))[_0xde7e('0x26')](respondWithResult(_0x15b514,null))[_0xde7e('0x40')](handleError(_0x15b514,null));};exports[_0xde7e('0x47')]=function(_0x5cac13,_0x45e491){return db[_0xde7e('0x2d')][_0xde7e('0x47')](_0x5cac13[_0xde7e('0x48')],{})[_0xde7e('0x26')](function(_0x338d97){var _0x4a79e1=_0x5cac13['user'][_0xde7e('0x28')]({'plain':!![]});if(!_0x4a79e1)throw new Error(_0xde7e('0x49'));if(_0x4a79e1['role']===_0xde7e('0x4a')){var _0x332176=_0x338d97[_0xde7e('0x28')]({'plain':!![]});var _0x1c9748=_0xde7e('0x4b');return db[_0xde7e('0x4c')][_0xde7e('0x46')]({'where':{'name':_0x1c9748,'userProfileId':_0x4a79e1[_0xde7e('0x4d')]},'raw':!![]})['then'](function(_0x3c9bf7){if(_0x3c9bf7&&_0x3c9bf7[_0xde7e('0x4e')]===0x0){return db[_0xde7e('0x29')][_0xde7e('0x47')]({'name':_0x332176['name'],'resourceId':_0x332176['id'],'type':_0x3c9bf7[_0xde7e('0x2b')],'sectionId':_0x3c9bf7['id']},{})[_0xde7e('0x26')](function(){return _0x338d97;});}else{return _0x338d97;}})['catch'](function(_0x295639){logger[_0xde7e('0x4f')](_0xde7e('0x50'),_0x295639);throw _0x295639;});}return _0x338d97;})[_0xde7e('0x26')](respondWithResult(_0x45e491,0xc9))['catch'](handleError(_0x45e491,null));};exports[_0xde7e('0x25')]=function(_0x305739,_0x42e308){if(_0x305739[_0xde7e('0x48')]['id']){delete _0x305739[_0xde7e('0x48')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x305739[_0xde7e('0x42')]['id']}})[_0xde7e('0x26')](handleEntityNotFound(_0x42e308,null))[_0xde7e('0x26')](saveUpdates(_0x305739[_0xde7e('0x48')],null))['then'](respondWithResult(_0x42e308,null))[_0xde7e('0x40')](handleError(_0x42e308,null));};exports[_0xde7e('0x27')]=function(_0x938213,_0x442ce4){return db[_0xde7e('0x2d')][_0xde7e('0x46')]({'where':{'id':_0x938213['params']['id']}})[_0xde7e('0x26')](handleEntityNotFound(_0x442ce4,null))['then'](removeEntity(_0x442ce4,null))[_0xde7e('0x40')](handleError(_0x442ce4,null));};exports[_0xde7e('0x2e')]=function(_0x20dada,_0x486917){return db[_0xde7e('0x2d')][_0xde7e('0x2e')]()[_0xde7e('0x26')](respondWithResult(_0x486917,null))[_0xde7e('0x40')](handleError(_0x486917,null));};exports[_0xde7e('0x51')]=function(_0x2e3c17,_0x4d96fc,_0xa69e1d){return db['CmContact'][_0xde7e('0x46')]({'where':{'id':_0x2e3c17[_0xde7e('0x42')]['id']}})['then'](handleEntityNotFound(_0x4d96fc,null))['then'](function(_0x126326){if(_0x126326){return _0x126326['addContacts'](_0x2e3c17[_0xde7e('0x48')][_0xde7e('0x52')],_[_0xde7e('0x53')](_0x2e3c17[_0xde7e('0x48')],['ids','id'])||{});}})['then'](respondWithResult(_0x4d96fc,null))[_0xde7e('0x40')](handleError(_0x4d96fc,null));};exports[_0xde7e('0x54')]=function(_0x4754f0,_0x2a1717,_0x28a143){var _0x562d02={};var _0x3f57fe={};var _0x12be61;var _0x3717b1;return db[_0xde7e('0x2d')][_0xde7e('0x55')]({'where':{'id':_0x4754f0['params']['id']}})[_0xde7e('0x26')](handleEntityNotFound(_0x2a1717,null))[_0xde7e('0x26')](function(_0x1b5555){if(_0x1b5555){_0x12be61=_0x1b5555;_0x3f57fe[_0xde7e('0x2f')]=_['keys'](db[_0xde7e('0x56')][_0xde7e('0x43')]);_0x3f57fe[_0xde7e('0x31')]=_['keys'](_0x4754f0[_0xde7e('0x31')]);_0x3f57fe['filters']=_[_0xde7e('0x44')](_0x3f57fe[_0xde7e('0x2f')],_0x3f57fe[_0xde7e('0x31')]);_0x562d02[_0xde7e('0x34')]=_['intersection'](_0x3f57fe[_0xde7e('0x2f')],qs[_0xde7e('0x33')](_0x4754f0[_0xde7e('0x31')][_0xde7e('0x33')]));_0x562d02[_0xde7e('0x34')]=_0x562d02[_0xde7e('0x34')][_0xde7e('0x45')]?_0x562d02[_0xde7e('0x34')]:_0x3f57fe[_0xde7e('0x2f')];_0x562d02['order']=qs[_0xde7e('0x37')](_0x4754f0[_0xde7e('0x31')][_0xde7e('0x37')]);_0x562d02[_0xde7e('0x38')]=qs[_0xde7e('0x32')](_[_0xde7e('0x57')](_0x4754f0['query'],_0x3f57fe[_0xde7e('0x32')]));if(_0x4754f0['query'][_0xde7e('0x39')]){_0x562d02['where']=_[_0xde7e('0x3a')](_0x562d02[_0xde7e('0x38')],{'$or':_[_0xde7e('0x3b')](_0x562d02[_0xde7e('0x34')],function(_0x14118a){var _0x7da07c={};_0x7da07c[_0x14118a]={'$like':'%'+_0x4754f0['query']['filter']+'%'};return _0x7da07c;})});}_0x562d02=_[_0xde7e('0x3a')]({},_0x562d02,_0x4754f0['options']);return _0x12be61['getContacts'](_0x562d02);}})['then'](function(_0x250536){if(_0x250536){_0x3717b1=_0x250536['length'];if(!_0x4754f0[_0xde7e('0x31')][_0xde7e('0x35')](_0xde7e('0x58'))){_0x562d02['limit']=qs[_0xde7e('0x1e')](_0x4754f0['query'][_0xde7e('0x1e')]);_0x562d02[_0xde7e('0x20')]=qs['offset'](_0x4754f0[_0xde7e('0x31')][_0xde7e('0x20')]);}return _0x12be61[_0xde7e('0x54')](_0x562d02);}})[_0xde7e('0x26')](function(_0x292c35){if(_0x292c35){return _0x292c35?{'count':_0x3717b1,'rows':_0x292c35}:null;}})[_0xde7e('0x26')](respondWithResult(_0x2a1717,null))[_0xde7e('0x40')](handleError(_0x2a1717,null));}; \ No newline at end of file +var _0x5433=['../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','where','map','CmCompany','includeAll','include','findAll','rows','catch','show','rawAttributes','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','addContacts','ids','omit','getContacts','findOne','CmContact','filter','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x96602e,_0x3d75d4){var _0x5c004d=function(_0x1432ba){while(--_0x1432ba){_0x96602e['push'](_0x96602e['shift']());}};_0x5c004d(++_0x3d75d4);}(_0x5433,0x97));var _0x3543=function(_0x351b82,_0x15e88b){_0x351b82=_0x351b82-0x0;var _0x108433=_0x5433[_0x351b82];return _0x108433;};'use strict';var emlformat=require(_0x3543('0x0'));var rimraf=require(_0x3543('0x1'));var zipdir=require(_0x3543('0x2'));var jsonpatch=require(_0x3543('0x3'));var rp=require(_0x3543('0x4'));var moment=require('moment');var BPromise=require(_0x3543('0x5'));var Mustache=require(_0x3543('0x6'));var util=require(_0x3543('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x3543('0x8'));var ejs=require(_0x3543('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3543('0xa'));var squel=require(_0x3543('0xb'));var crypto=require('crypto');var jsforce=require(_0x3543('0xc'));var deskjs=require(_0x3543('0xd'));var toCsv=require(_0x3543('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3543('0xe'));var authService=require(_0x3543('0xf'));var qs=require(_0x3543('0x10'));var as=require(_0x3543('0x11'));var hardwareService=require(_0x3543('0x12'));var logger=require(_0x3543('0x13'))(_0x3543('0x14'));var utils=require(_0x3543('0x15'));var config=require(_0x3543('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e4157,_0xbf587d){_0xbf587d=_0xbf587d||0xcc;return function(_0x4eeee4){if(_0x4eeee4){return _0x3e4157[_0x3543('0x17')](_0xbf587d);}return _0x3e4157[_0x3543('0x18')](_0xbf587d)[_0x3543('0x19')]();};}function respondWithResult(_0xc1315d,_0x2cf222){_0x2cf222=_0x2cf222||0xc8;return function(_0x3c6190){if(_0x3c6190){return _0xc1315d[_0x3543('0x18')](_0x2cf222)[_0x3543('0x1a')](_0x3c6190);}};}function respondWithFilteredResult(_0x269669,_0x18d031){return function(_0x59ba09){if(_0x59ba09){var _0x4430a8=typeof _0x18d031[_0x3543('0x1b')]===_0x3543('0x1c')&&typeof _0x18d031[_0x3543('0x1d')]===_0x3543('0x1c');var _0x4a972a=_0x59ba09[_0x3543('0x1e')];var _0x59dd59=_0x4430a8?0x0:_0x18d031[_0x3543('0x1b')];var _0x3ff8cd=_0x4430a8?_0x59ba09[_0x3543('0x1e')]:_0x18d031[_0x3543('0x1b')]+_0x18d031['limit'];var _0x1bc801;if(_0x3ff8cd>=_0x4a972a){_0x3ff8cd=_0x4a972a;_0x1bc801=0xc8;}else{_0x1bc801=0xce;}_0x269669[_0x3543('0x18')](_0x1bc801);return _0x269669[_0x3543('0x1f')](_0x3543('0x20'),_0x59dd59+'-'+_0x3ff8cd+'/'+_0x4a972a)[_0x3543('0x1a')](_0x59ba09);}return null;};}function patchUpdates(_0x58d5f8){return function(_0x37402a){try{jsonpatch[_0x3543('0x21')](_0x37402a,_0x58d5f8,!![]);}catch(_0x3f1561){return BPromise[_0x3543('0x22')](_0x3f1561);}return _0x37402a[_0x3543('0x23')]();};}function saveUpdates(_0x52fedb,_0x39d809){return function(_0x26de70){if(_0x26de70){return _0x26de70[_0x3543('0x24')](_0x52fedb)[_0x3543('0x25')](function(_0x1e1d11){return _0x1e1d11;});}return null;};}function removeEntity(_0x1a96c9,_0x496059){return function(_0x48950b){if(_0x48950b){return _0x48950b[_0x3543('0x26')]()['then'](function(){var _0x4551e5=_0x48950b[_0x3543('0x27')]({'plain':!![]});var _0x35e36c='Companies';return db[_0x3543('0x28')]['destroy']({'where':{'type':_0x35e36c,'resourceId':_0x4551e5['id']}})[_0x3543('0x25')](function(){return _0x48950b;});})[_0x3543('0x25')](function(){_0x1a96c9['status'](0xcc)[_0x3543('0x19')]();});}};}function handleEntityNotFound(_0x4eb797,_0x1ba0d0){return function(_0x26e46a){if(!_0x26e46a){_0x4eb797[_0x3543('0x17')](0x194);}return _0x26e46a;};}function handleError(_0x4b5edc,_0x313678){_0x313678=_0x313678||0x1f4;return function(_0xfff75a){logger[_0x3543('0x29')](_0xfff75a['stack']);if(_0xfff75a[_0x3543('0x2a')]){delete _0xfff75a[_0x3543('0x2a')];}_0x4b5edc[_0x3543('0x18')](_0x313678)[_0x3543('0x2b')](_0xfff75a);};}exports[_0x3543('0x2c')]=function(_0x570eea,_0x133ea2){var _0x2a94fb={},_0x22edd7={},_0x1244f9={'count':0x0,'rows':[]};return db['CmCompany'][_0x3543('0x2d')]()[_0x3543('0x25')](function(_0x1571de){_0x22edd7[_0x3543('0x2e')]=_[_0x3543('0x2f')](_0x1571de);_0x22edd7[_0x3543('0x30')]=_[_0x3543('0x2f')](_0x570eea['query']);_0x22edd7[_0x3543('0x31')]=_[_0x3543('0x32')](_0x22edd7[_0x3543('0x2e')],_0x22edd7[_0x3543('0x30')]);_0x2a94fb[_0x3543('0x33')]=_['intersection'](_0x22edd7['model'],qs['fields'](_0x570eea['query'][_0x3543('0x34')]));_0x2a94fb[_0x3543('0x33')]=_0x2a94fb[_0x3543('0x33')][_0x3543('0x35')]?_0x2a94fb['attributes']:_0x22edd7['model'];if(!_0x570eea[_0x3543('0x30')][_0x3543('0x36')]('nolimit')){_0x2a94fb[_0x3543('0x1d')]=qs['limit'](_0x570eea['query'][_0x3543('0x1d')]);_0x2a94fb[_0x3543('0x1b')]=qs[_0x3543('0x1b')](_0x570eea[_0x3543('0x30')][_0x3543('0x1b')]);}_0x2a94fb[_0x3543('0x37')]=qs[_0x3543('0x38')](_0x570eea['query']['sort']);_0x2a94fb['where']=qs['filters'](_[_0x3543('0x39')](_0x570eea[_0x3543('0x30')],_0x22edd7[_0x3543('0x31')]),_0x1571de);if(_0x570eea[_0x3543('0x30')]['filter']){_0x2a94fb['where']=_[_0x3543('0x3a')](_0x2a94fb[_0x3543('0x3b')],{'$or':_[_0x3543('0x3c')](_0x2a94fb[_0x3543('0x33')],function(_0x438a1b){var _0x397026={};_0x397026[_0x438a1b]={'$like':'%'+_0x570eea['query']['filter']+'%'};return _0x397026;})});}_0x2a94fb=_[_0x3543('0x3a')]({},_0x2a94fb,_0x570eea['options']);var _0x46f8ab={'where':_0x2a94fb['where']};return db[_0x3543('0x3d')][_0x3543('0x1e')](_0x46f8ab)[_0x3543('0x25')](function(_0x10430c){_0x1244f9['count']=_0x10430c;if(_0x570eea[_0x3543('0x30')][_0x3543('0x3e')]){_0x2a94fb[_0x3543('0x3f')]=[{'all':!![]}];}return db['CmCompany'][_0x3543('0x40')](_0x2a94fb);})['then'](function(_0xda981c){_0x1244f9[_0x3543('0x41')]=_0xda981c;return _0x1244f9;})[_0x3543('0x25')](respondWithFilteredResult(_0x133ea2,_0x2a94fb))[_0x3543('0x42')](handleError(_0x133ea2,null));})['catch'](handleError(_0x133ea2,null));};exports[_0x3543('0x43')]=function(_0x2b6f3b,_0x2c46ce){var _0x539462={'raw':![],'where':{'id':_0x2b6f3b['params']['id']}},_0x48b6c6={};_0x48b6c6[_0x3543('0x2e')]=_[_0x3543('0x2f')](db['CmCompany'][_0x3543('0x44')]);_0x48b6c6['query']=_[_0x3543('0x2f')](_0x2b6f3b[_0x3543('0x30')]);_0x48b6c6[_0x3543('0x31')]=_['intersection'](_0x48b6c6[_0x3543('0x2e')],_0x48b6c6['query']);_0x539462[_0x3543('0x33')]=_[_0x3543('0x32')](_0x48b6c6[_0x3543('0x2e')],qs[_0x3543('0x34')](_0x2b6f3b[_0x3543('0x30')]['fields']));_0x539462[_0x3543('0x33')]=_0x539462[_0x3543('0x33')][_0x3543('0x35')]?_0x539462[_0x3543('0x33')]:_0x48b6c6['model'];if(_0x2b6f3b['query'][_0x3543('0x3e')]){_0x539462[_0x3543('0x3f')]=[{'all':!![]}];}_0x539462=_[_0x3543('0x3a')]({},_0x539462,_0x2b6f3b[_0x3543('0x45')]);return db[_0x3543('0x3d')][_0x3543('0x46')](_0x539462)[_0x3543('0x25')](handleEntityNotFound(_0x2c46ce,null))[_0x3543('0x25')](respondWithResult(_0x2c46ce,null))[_0x3543('0x42')](handleError(_0x2c46ce,null));};exports[_0x3543('0x47')]=function(_0x57bf00,_0x3b8520){return db[_0x3543('0x3d')][_0x3543('0x47')](_0x57bf00[_0x3543('0x48')],{})[_0x3543('0x25')](function(_0x1ffc70){var _0x34ba99=_0x57bf00['user'][_0x3543('0x27')]({'plain':!![]});if(!_0x34ba99)throw new Error(_0x3543('0x49'));if(_0x34ba99[_0x3543('0x4a')]==='user'){var _0x30f4eb=_0x1ffc70[_0x3543('0x27')]({'plain':!![]});var _0x3a8598='Companies';return db[_0x3543('0x4b')][_0x3543('0x46')]({'where':{'name':_0x3a8598,'userProfileId':_0x34ba99['userProfileId']},'raw':!![]})[_0x3543('0x25')](function(_0x140f7f){if(_0x140f7f&&_0x140f7f[_0x3543('0x4c')]===0x0){return db['UserProfileResource'][_0x3543('0x47')]({'name':_0x30f4eb['name'],'resourceId':_0x30f4eb['id'],'type':_0x140f7f['name'],'sectionId':_0x140f7f['id']},{})[_0x3543('0x25')](function(){return _0x1ffc70;});}else{return _0x1ffc70;}})[_0x3543('0x42')](function(_0x1ab788){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ab788);throw _0x1ab788;});}return _0x1ffc70;})[_0x3543('0x25')](respondWithResult(_0x3b8520,0xc9))[_0x3543('0x42')](handleError(_0x3b8520,null));};exports[_0x3543('0x24')]=function(_0x2ec325,_0x4596d6){if(_0x2ec325['body']['id']){delete _0x2ec325[_0x3543('0x48')]['id'];}return db[_0x3543('0x3d')][_0x3543('0x46')]({'where':{'id':_0x2ec325[_0x3543('0x4d')]['id']}})[_0x3543('0x25')](handleEntityNotFound(_0x4596d6,null))['then'](saveUpdates(_0x2ec325[_0x3543('0x48')],null))[_0x3543('0x25')](respondWithResult(_0x4596d6,null))[_0x3543('0x42')](handleError(_0x4596d6,null));};exports[_0x3543('0x26')]=function(_0x1b4011,_0x25ed9c){return db[_0x3543('0x3d')][_0x3543('0x46')]({'where':{'id':_0x1b4011[_0x3543('0x4d')]['id']}})[_0x3543('0x25')](handleEntityNotFound(_0x25ed9c,null))[_0x3543('0x25')](removeEntity(_0x25ed9c,null))['catch'](handleError(_0x25ed9c,null));};exports[_0x3543('0x2d')]=function(_0xc9e26e,_0x361c67){return db['CmCompany'][_0x3543('0x2d')]()['then'](respondWithResult(_0x361c67,null))[_0x3543('0x42')](handleError(_0x361c67,null));};exports[_0x3543('0x4e')]=function(_0x30d3db,_0x1a8331,_0x1964f2){return db['CmContact'][_0x3543('0x46')]({'where':{'id':_0x30d3db[_0x3543('0x4d')]['id']}})[_0x3543('0x25')](handleEntityNotFound(_0x1a8331,null))[_0x3543('0x25')](function(_0x478486){if(_0x478486){return _0x478486[_0x3543('0x4e')](_0x30d3db[_0x3543('0x48')][_0x3543('0x4f')],_[_0x3543('0x50')](_0x30d3db[_0x3543('0x48')],[_0x3543('0x4f'),'id'])||{});}})[_0x3543('0x25')](respondWithResult(_0x1a8331,null))['catch'](handleError(_0x1a8331,null));};exports[_0x3543('0x51')]=function(_0x33f0a9,_0x510a16,_0x1b1f6a){var _0x3b4f29={};var _0x4a6339={};var _0x9184d0;var _0x18a35c;return db[_0x3543('0x3d')][_0x3543('0x52')]({'where':{'id':_0x33f0a9[_0x3543('0x4d')]['id']}})[_0x3543('0x25')](handleEntityNotFound(_0x510a16,null))[_0x3543('0x25')](function(_0x413c81){if(_0x413c81){_0x9184d0=_0x413c81;_0x4a6339[_0x3543('0x2e')]=_[_0x3543('0x2f')](db[_0x3543('0x53')][_0x3543('0x44')]);_0x4a6339[_0x3543('0x30')]=_[_0x3543('0x2f')](_0x33f0a9['query']);_0x4a6339[_0x3543('0x31')]=_[_0x3543('0x32')](_0x4a6339[_0x3543('0x2e')],_0x4a6339[_0x3543('0x30')]);_0x3b4f29[_0x3543('0x33')]=_[_0x3543('0x32')](_0x4a6339[_0x3543('0x2e')],qs[_0x3543('0x34')](_0x33f0a9[_0x3543('0x30')][_0x3543('0x34')]));_0x3b4f29[_0x3543('0x33')]=_0x3b4f29[_0x3543('0x33')]['length']?_0x3b4f29[_0x3543('0x33')]:_0x4a6339['model'];_0x3b4f29[_0x3543('0x37')]=qs['sort'](_0x33f0a9[_0x3543('0x30')][_0x3543('0x38')]);_0x3b4f29[_0x3543('0x3b')]=qs[_0x3543('0x31')](_[_0x3543('0x39')](_0x33f0a9[_0x3543('0x30')],_0x4a6339['filters']));if(_0x33f0a9[_0x3543('0x30')][_0x3543('0x54')]){_0x3b4f29[_0x3543('0x3b')]=_[_0x3543('0x3a')](_0x3b4f29['where'],{'$or':_[_0x3543('0x3c')](_0x3b4f29[_0x3543('0x33')],function(_0x598601){var _0x52069c={};_0x52069c[_0x598601]={'$like':'%'+_0x33f0a9[_0x3543('0x30')][_0x3543('0x54')]+'%'};return _0x52069c;})});}_0x3b4f29=_[_0x3543('0x3a')]({},_0x3b4f29,_0x33f0a9[_0x3543('0x45')]);return _0x9184d0[_0x3543('0x51')](_0x3b4f29);}})[_0x3543('0x25')](function(_0x484fcb){if(_0x484fcb){_0x18a35c=_0x484fcb['length'];if(!_0x33f0a9[_0x3543('0x30')][_0x3543('0x36')](_0x3543('0x55'))){_0x3b4f29[_0x3543('0x1d')]=qs[_0x3543('0x1d')](_0x33f0a9[_0x3543('0x30')][_0x3543('0x1d')]);_0x3b4f29['offset']=qs[_0x3543('0x1b')](_0x33f0a9[_0x3543('0x30')][_0x3543('0x1b')]);}return _0x9184d0[_0x3543('0x51')](_0x3b4f29);}})['then'](function(_0x54401e){if(_0x54401e){return _0x54401e?{'count':_0x18a35c,'rows':_0x54401e}:null;}})[_0x3543('0x25')](respondWithResult(_0x510a16,null))[_0x3543('0x42')](handleError(_0x510a16,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 253050f..67ac0a8 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 _0x7de1=['exports','cm_companies','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmCompany.attributes'];(function(_0x1ca890,_0x21d0d3){var _0x3f8e01=function(_0x4ff2e2){while(--_0x4ff2e2){_0x1ca890['push'](_0x1ca890['shift']());}};_0x3f8e01(++_0x21d0d3);}(_0x7de1,0xd4));var _0x17de=function(_0x3fa7d3,_0x37f83c){_0x3fa7d3=_0x3fa7d3-0x0;var _0x4c51bd=_0x7de1[_0x3fa7d3];return _0x4c51bd;};'use strict';var _=require('lodash');var util=require(_0x17de('0x0'));var logger=require(_0x17de('0x1'))(_0x17de('0x2'));var moment=require('moment');var BPromise=require(_0x17de('0x3'));var rp=require(_0x17de('0x4'));var fs=require('fs');var path=require(_0x17de('0x5'));var rimraf=require('rimraf');var config=require(_0x17de('0x6'));var attributes=require(_0x17de('0x7'));module[_0x17de('0x8')]=function(_0x221ae7,_0x13056d){return _0x221ae7['define']('CmCompany',attributes,{'tableName':_0x17de('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c32=['cm_companies','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','define','CmCompany'];(function(_0x4ed70e,_0xe5509a){var _0x355f5d=function(_0x3269da){while(--_0x3269da){_0x4ed70e['push'](_0x4ed70e['shift']());}};_0x355f5d(++_0xe5509a);}(_0x8c32,0x91));var _0x28c3=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x8c32[_0x12fc8d];return _0x3f9d04;};'use strict';var _=require(_0x28c3('0x0'));var util=require('util');var logger=require(_0x28c3('0x1'))('api');var moment=require(_0x28c3('0x2'));var BPromise=require(_0x28c3('0x3'));var rp=require(_0x28c3('0x4'));var fs=require('fs');var path=require(_0x28c3('0x5'));var rimraf=require(_0x28c3('0x6'));var config=require(_0x28c3('0x7'));var attributes=require(_0x28c3('0x8'));module['exports']=function(_0x31bb68,_0x4a8254){return _0x31bb68[_0x28c3('0x9')](_0x28c3('0xa'),attributes,{'tableName':_0x28c3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 59b94c0..5f2b114 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 _0x0c6b=['CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x0c6b,0x89));var _0xb0c6=function(_0x2fa326,_0x5bb165){_0x2fa326=_0x2fa326-0x0;var _0x6888ea=_0x0c6b[_0x2fa326];return _0x6888ea;};'use strict';var _=require(_0xb0c6('0x0'));var util=require('util');var moment=require(_0xb0c6('0x1'));var BPromise=require(_0xb0c6('0x2'));var rs=require(_0xb0c6('0x3'));var fs=require('fs');var Redis=require(_0xb0c6('0x4'));var db=require(_0xb0c6('0x5'))['db'];var utils=require(_0xb0c6('0x6'));var logger=require(_0xb0c6('0x7'))(_0xb0c6('0x8'));var config=require('../../config/environment');var jayson=require(_0xb0c6('0x9'));var client=jayson[_0xb0c6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31fb7c,_0x9b0a5a,_0x4c4e56){return new BPromise(function(_0x9ce313,_0x4c97e6){return client[_0xb0c6('0xb')](_0x31fb7c,_0x4c4e56)[_0xb0c6('0xc')](function(_0x5c17cf){logger[_0xb0c6('0xd')](_0xb0c6('0xe'),_0x9b0a5a,_0xb0c6('0xf'));logger[_0xb0c6('0x10')](_0xb0c6('0x11'),_0x9b0a5a,_0xb0c6('0xf'),JSON[_0xb0c6('0x12')](_0x5c17cf));if(_0x5c17cf[_0xb0c6('0x13')]){if(_0x5c17cf[_0xb0c6('0x13')][_0xb0c6('0x14')]===0x1f4){logger[_0xb0c6('0x13')](_0xb0c6('0xe'),_0x9b0a5a,_0x5c17cf[_0xb0c6('0x13')][_0xb0c6('0x15')]);return _0x4c97e6(_0x5c17cf['error'][_0xb0c6('0x15')]);}logger['error'](_0xb0c6('0xe'),_0x9b0a5a,_0x5c17cf[_0xb0c6('0x13')][_0xb0c6('0x15')]);return _0x9ce313(_0x5c17cf['error'][_0xb0c6('0x15')]);}else{logger[_0xb0c6('0xd')](_0xb0c6('0xe'),_0x9b0a5a,_0xb0c6('0xf'));_0x9ce313(_0x5c17cf['result'][_0xb0c6('0x15')]);}})['catch'](function(_0x27985d){logger[_0xb0c6('0x13')]('CmCompany,\x20%s,\x20%s',_0x9b0a5a,_0x27985d);_0x4c97e6(_0x27985d);});});} \ No newline at end of file +var _0x8538=['code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','CmCompany,\x20%s,\x20%s','debug','stringify','error'];(function(_0x512f90,_0x23171e){var _0x3f1e21=function(_0x459201){while(--_0x459201){_0x512f90['push'](_0x512f90['shift']());}};_0x3f1e21(++_0x23171e);}(_0x8538,0x158));var _0x8853=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8538[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x8853('0x0'));var moment=require(_0x8853('0x1'));var BPromise=require(_0x8853('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8853('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8853('0x4'));var logger=require(_0x8853('0x5'))(_0x8853('0x6'));var config=require(_0x8853('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8853('0x8')][_0x8853('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c3fb9,_0xf78e42,_0x3a33f1){return new BPromise(function(_0x256563,_0x2b22dd){return client['request'](_0x2c3fb9,_0x3a33f1)[_0x8853('0xa')](function(_0x1601dc){logger[_0x8853('0xb')](_0x8853('0xc'),_0xf78e42,'request\x20sent');logger[_0x8853('0xd')]('CmCompany,\x20%s,\x20%s,\x20%s',_0xf78e42,'request\x20sent',JSON[_0x8853('0xe')](_0x1601dc));if(_0x1601dc[_0x8853('0xf')]){if(_0x1601dc['error'][_0x8853('0x10')]===0x1f4){logger['error'](_0x8853('0xc'),_0xf78e42,_0x1601dc[_0x8853('0xf')][_0x8853('0x11')]);return _0x2b22dd(_0x1601dc[_0x8853('0xf')]['message']);}logger['error']('CmCompany,\x20%s,\x20%s',_0xf78e42,_0x1601dc['error'][_0x8853('0x11')]);return _0x256563(_0x1601dc['error']['message']);}else{logger[_0x8853('0xb')]('CmCompany,\x20%s,\x20%s',_0xf78e42,'request\x20sent');_0x256563(_0x1601dc[_0x8853('0x12')][_0x8853('0x11')]);}})[_0x8853('0x13')](function(_0x56f0ce){logger[_0x8853('0xf')]('CmCompany,\x20%s,\x20%s',_0xf78e42,_0x56f0ce);_0x2b22dd(_0x56f0ce);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 687d3c8..62d3758 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 _0x1b8e=['exports','multer','util','path','express','fs-extra','../../components/interaction/service','./cmCompany.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getContacts','post','addContacts','put','update','delete','destroy'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x1b8e,0x14b));var _0xe1b8=function(_0x3b97cc,_0x2b2220){_0x3b97cc=_0x3b97cc-0x0;var _0x5079ba=_0x1b8e[_0x3b97cc];return _0x5079ba;};'use strict';var multer=require(_0xe1b8('0x0'));var util=require(_0xe1b8('0x1'));var path=require(_0xe1b8('0x2'));var timeout=require('connect-timeout');var express=require(_0xe1b8('0x3'));var router=express['Router']();var fs_extra=require(_0xe1b8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe1b8('0x5'));var config=require('../../config/environment');var controller=require(_0xe1b8('0x6'));router[_0xe1b8('0x7')]('/',auth['isAuthenticated'](),controller[_0xe1b8('0x8')]);router[_0xe1b8('0x7')](_0xe1b8('0x9'),auth[_0xe1b8('0xa')](),controller[_0xe1b8('0xb')]);router[_0xe1b8('0x7')](_0xe1b8('0xc'),auth[_0xe1b8('0xa')](),controller[_0xe1b8('0xd')]);router[_0xe1b8('0x7')]('/:id/contacts',auth[_0xe1b8('0xa')](),controller[_0xe1b8('0xe')]);router['post']('/',auth[_0xe1b8('0xa')](),controller['create']);router[_0xe1b8('0xf')]('/:id/contacts',auth[_0xe1b8('0xa')](),controller[_0xe1b8('0x10')]);router[_0xe1b8('0x11')](_0xe1b8('0xc'),auth[_0xe1b8('0xa')](),controller[_0xe1b8('0x12')]);router[_0xe1b8('0x13')]('/:id',auth[_0xe1b8('0xa')](),controller[_0xe1b8('0x14')]);module[_0xe1b8('0x15')]=router; \ No newline at end of file +var _0x235b=['../../config/environment','./cmCompany.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/contacts','getContacts','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2344d5,_0x1a8690){var _0x58dd20=function(_0x16d9c4){while(--_0x16d9c4){_0x2344d5['push'](_0x2344d5['shift']());}};_0x58dd20(++_0x1a8690);}(_0x235b,0x130));var _0xb235=function(_0x5c4dee,_0x3ceeb1){_0x5c4dee=_0x5c4dee-0x0;var _0xa47b=_0x235b[_0x5c4dee];return _0xa47b;};'use strict';var multer=require(_0xb235('0x0'));var util=require(_0xb235('0x1'));var path=require(_0xb235('0x2'));var timeout=require(_0xb235('0x3'));var express=require(_0xb235('0x4'));var router=express[_0xb235('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb235('0x6'));var interaction=require(_0xb235('0x7'));var config=require(_0xb235('0x8'));var controller=require(_0xb235('0x9'));router[_0xb235('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb235('0xa')](_0xb235('0xb'),auth[_0xb235('0xc')](),controller[_0xb235('0xd')]);router['get'](_0xb235('0xe'),auth[_0xb235('0xc')](),controller[_0xb235('0xf')]);router[_0xb235('0xa')](_0xb235('0x10'),auth[_0xb235('0xc')](),controller[_0xb235('0x11')]);router[_0xb235('0x12')]('/',auth['isAuthenticated'](),controller[_0xb235('0x13')]);router[_0xb235('0x12')](_0xb235('0x10'),auth[_0xb235('0xc')](),controller['addContacts']);router['put'](_0xb235('0xe'),auth['isAuthenticated'](),controller[_0xb235('0x14')]);router[_0xb235('0x15')](_0xb235('0xe'),auth['isAuthenticated'](),controller[_0xb235('0x16')]);module[_0xb235('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 0139697..4f5ff87 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 _0xf870=['STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x3a30d3,_0x55eb4a){var _0x4a4f79=function(_0x49de7e){while(--_0x49de7e){_0x3a30d3['push'](_0x3a30d3['shift']());}};_0x4a4f79(++_0x55eb4a);}(_0xf870,0x141));var _0x0f87=function(_0x3bee2f,_0x32b1d3){_0x3bee2f=_0x3bee2f-0x0;var _0x160186=_0xf870[_0x3bee2f];return _0x160186;};'use strict';var _=require(_0x0f87('0x0'));var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize[_0x0f87('0x1')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x0f87('0x1')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x0f87('0x1')]},'dateOfBirth':{'type':Sequelize[_0x0f87('0x1')]},'description':{'type':Sequelize[_0x0f87('0x2')]},'phone':{'type':Sequelize[_0x0f87('0x1')]},'mobile':{'type':Sequelize[_0x0f87('0x1')]},'fax':{'type':Sequelize[_0x0f87('0x1')]},'email':{'type':Sequelize[_0x0f87('0x1')]},'url':{'type':Sequelize[_0x0f87('0x1')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x0f87('0x1')]},'twitter':{'type':Sequelize[_0x0f87('0x1')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x0f87('0x1')]},'line':{'type':Sequelize[_0x0f87('0x1')]},'wechat':{'type':Sequelize[_0x0f87('0x1')]},'telegram':{'type':Sequelize[_0x0f87('0x1')]},'UserId':{'type':Sequelize[_0x0f87('0x3')]},'AdditionalPhones':{'type':Sequelize[_0x0f87('0x1')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x0f87('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x0f87('0x5')],'defaultValue':Sequelize[_0x0f87('0x6')]},'dialTimezone':{'type':Sequelize[_0x0f87('0x1')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc416=['STRING','TEXT','INTEGER','DATE','lodash','sequelize','exports'];(function(_0x47bf8b,_0x5c377e){var _0x2d71ff=function(_0x96d3b2){while(--_0x96d3b2){_0x47bf8b['push'](_0x47bf8b['shift']());}};_0x2d71ff(++_0x5c377e);}(_0xc416,0x1e7));var _0x6c41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc416[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6c41('0x0'));var Sequelize=require(_0x6c41('0x1'));module[_0x6c41('0x2')]={'firstName':{'type':Sequelize[_0x6c41('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x6c41('0x3')]},'street':{'type':Sequelize[_0x6c41('0x3')]},'postalCode':{'type':Sequelize[_0x6c41('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x6c41('0x3')]},'description':{'type':Sequelize[_0x6c41('0x4')]},'phone':{'type':Sequelize[_0x6c41('0x3')]},'mobile':{'type':Sequelize[_0x6c41('0x3')]},'fax':{'type':Sequelize[_0x6c41('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x6c41('0x3')]},'facebook':{'type':Sequelize[_0x6c41('0x3')]},'fb_data':{'type':Sequelize[_0x6c41('0x3')]},'twitter':{'type':Sequelize[_0x6c41('0x3')]},'skype':{'type':Sequelize[_0x6c41('0x3')]},'teams':{'type':Sequelize[_0x6c41('0x3')]},'viber':{'type':Sequelize[_0x6c41('0x3')]},'line':{'type':Sequelize[_0x6c41('0x3')]},'wechat':{'type':Sequelize[_0x6c41('0x3')]},'telegram':{'type':Sequelize[_0x6c41('0x3')]},'UserId':{'type':Sequelize[_0x6c41('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x6c41('0x3')]},'priority':{'type':Sequelize[_0x6c41('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x6c41('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 603d591..2975e72 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 _0xa70c=['-createdAt','channel','includes','toLowerCase','range','Invalid\x20createdAt\x20filter','type','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','color','browserName','customerIp','customerPort','osName','ratingMessage','referer','subject','substatus','threadId','startCase','Interaction','findAndCountAll','Owner','flatten','sortBy','reverse','slice','util','path','squel','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment/shared','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmContact.socket','register','offset','undefined','limit','count','status','set','Content-Range','update','then','end','sendStatus','error','stack','name','send','index','describe','keys','length','cf_','push','findOne','trimStart','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','field','tools_tags','select','from','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','expr','search','parseSearch','sqlOperator','conditions','find','Tag','split','map','forEach','union','User','and','uc.UserId\x20=\x20?','value','dateOfBirth','fieldType','datetime','DATE','text','start','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','DESC','having','t.id\x20IN\x20?','role','some','user','c.ListId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','c.firstName','c.mobile','c.fax','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','destroy','CmContact','params','tags','columnName','displayName','analytics','findAll','values','body','get','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatMessage','ChatOfflineMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappQueueReport','create','isNil','dialTimezone','utcOffset','timezones','additionalPhones','duplicates','$or','findOrCreate','spread','contact','all','show','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','CmCustomField','omit','cf_%d','pickBy','startsWith','cm_contacts','setFields','id\x20=\x20?','toParam','phone','getTags','rawAttributes','pick','options','nolimit','setTags','OrderBy','items','item_types','description','ItemTypeId','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','CmHopper','`ItemType`.OrderBy','item','ItemType.OrderBy','bulkCreate','getAdditionalPhones','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','includeAll','include','getHopperHistories','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','upload','createReadStream','parse','meta','import','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','getJourney','chat','sms','fax','whatsapp','voice'];(function(_0x182820,_0x1e704a){var _0x3ad285=function(_0x516ac4){while(--_0x516ac4){_0x182820['push'](_0x182820['shift']());}};_0x3ad285(++_0x1e704a);}(_0xa70c,0x15e));var _0xca70=function(_0x36154a,_0x2cf98c){_0x36154a=_0x36154a-0x0;var _0x61104e=_0xa70c[_0x36154a];return _0x61104e;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xca70('0x0'));var path=require(_0xca70('0x1'));var fs=require('fs');var _=require('lodash');var squel=require(_0xca70('0x2'));var Papa=require(_0xca70('0x3'));var Redis=require(_0xca70('0x4'));var qs=require(_0xca70('0x5'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xca70('0x6'))('api');var config=require('../../config/environment');var shared=require(_0xca70('0x7'));var db=require(_0xca70('0x8'))['db'];config['redis']=_[_0xca70('0x9')](config[_0xca70('0xa')],{'host':_0xca70('0xb'),'port':0x18eb});var socket=require(_0xca70('0xc'))(new Redis(config['redis']));require(_0xca70('0xd'))[_0xca70('0xe')](socket);function respondWithResult(_0x9b32ed,_0x54160d){_0x54160d=_0x54160d||0xc8;return function(_0x2b1043){if(_0x2b1043){return _0x9b32ed['status'](_0x54160d)['json'](_0x2b1043);}};}function respondWithFilteredResult(_0xf1b13,_0x318021){return function(_0x23bc7e){if(_0x23bc7e){var _0x1b424b=typeof _0x318021[_0xca70('0xf')]===_0xca70('0x10')&&typeof _0x318021[_0xca70('0x11')]===_0xca70('0x10');var _0x2122f4=_0x23bc7e[_0xca70('0x12')];var _0x291839=_0x1b424b?0x0:_0x318021[_0xca70('0xf')];var _0x1816e7=_0x1b424b?_0x23bc7e[_0xca70('0x12')]:_0x318021['offset']+_0x318021[_0xca70('0x11')];var _0x54258f;if(_0x1816e7>=_0x2122f4){_0x1816e7=_0x2122f4;_0x54258f=0xc8;}else{_0x54258f=0xce;}_0xf1b13[_0xca70('0x13')](_0x54258f);return _0xf1b13[_0xca70('0x14')](_0xca70('0x15'),_0x291839+'-'+_0x1816e7+'/'+_0x2122f4)['json'](_0x23bc7e);}return null;};}function saveUpdates(_0x3caec3){return function(_0x39f889){if(_0x39f889){return _0x39f889[_0xca70('0x16')](_0x3caec3)[_0xca70('0x17')](function(_0x289c28){return _0x289c28;});}return null;};}function removeEntity(_0x42a1c9){return function(_0x161976){if(_0x161976){return _0x161976['destroy']()[_0xca70('0x17')](function(){_0x42a1c9['status'](0xcc)[_0xca70('0x18')]();});}};}function handleEntityNotFound(_0x46f0a3){return function(_0x583577){if(!_0x583577){_0x46f0a3[_0xca70('0x19')](0x194);}return _0x583577;};}function handleError(_0x196b19,_0x161447){_0x161447=_0x161447||0x1f4;return function(_0x3c1f0b){logger[_0xca70('0x1a')](_0x3c1f0b[_0xca70('0x1b')]);if(_0x3c1f0b[_0xca70('0x1c')]){delete _0x3c1f0b[_0xca70('0x1c')];}_0x196b19['status'](_0x161447)[_0xca70('0x1d')](_0x3c1f0b);};}exports[_0xca70('0x1e')]=function(_0x21cb38,_0x52e625){var _0x38cd4e={},_0x48aefa={},_0x528e6e={'count':0x0,'rows':[]};return db['CmContact'][_0xca70('0x1f')]()[_0xca70('0x17')](function(_0x3dfdf3){var _0x43771c=[];for(var _0x4d8498=0x0;_0x4d84980x1){_0x1c00ce['or'](_0xca70('0x5a'),qs['getFullTextValue'](_0x315917),null);}else{if(qs[_0xca70('0x5b')](_0x315917)){_0x1c00ce['or'](_0xca70('0x5c'),_0x315917+'%');_0x1c00ce['or'](_0xca70('0x5d'),_0x315917+'%');_0x1c00ce['or'](_0xca70('0x5e'),_0x315917+'%');_0x1c00ce['or'](_0xca70('0x5f'),_0x315917+'%');}else if(qs['isEmail'](_0x315917)){_0x1c00ce['or'](_0xca70('0x60'),_0x315917+'%');}else{_0x1c00ce['or'](_0xca70('0x61'),'%'+_0x315917+'%');_0x1c00ce['or'](_0xca70('0x62'),'%'+_0x315917+'%');_0x1c00ce['or'](_0xca70('0x60'),'%'+_0x315917+'%');}}}}_0x1f2195['where'](_0x1c00ce);_0x1f2195[_0xca70('0x63')](_0xca70('0x64'));var _0x246901={'type':db[_0xca70('0x65')][_0xca70('0x66')][_0xca70('0x67')],'raw':!![]};var _0x56441e=_0x1f2195['clone']()[_0xca70('0x30')](_0xca70('0x64'));if(_0x38cd4e[_0xca70('0x2d')]){_0x38cd4e['order'][_0xca70('0x42')](function(_0x2fc020){_0x1f2195[_0xca70('0x2d')]('c.'+_0x2fc020[0x0],_0x2fc020[0x1]===_0xca70('0x68')?![]:!![]);});}if(!_['isEmpty'](_0x36c9e5)){_0x1f2195[_0xca70('0x69')](_0x5a9ddc);_0x56441e[_0xca70('0x2f')](_0xca70('0x6a'),_0x36c9e5);}BPromise['resolve']()['then'](function(){if(!_0x16c95e)return;if(_0x21cb38['user'][_0xca70('0x6b')]!=='agent')return;if(!_[_0xca70('0x6c')](_0x16c95e[_0xca70('0x3d')],[_0xca70('0x30'),_0xca70('0x44')])){return _0x21cb38[_0xca70('0x6d')]['getLists']({'attributes':['id'],'raw':!![]})[_0xca70('0x17')](function(_0x45ce7b){if(_['isEmpty'](_0x45ce7b)){_0x56441e[_0xca70('0x2f')](_0xca70('0x6e'));_0x1f2195[_0xca70('0x2f')](_0xca70('0x6e'));}else{_0x56441e[_0xca70('0x2f')]('c.ListId\x20IN\x20?',_[_0xca70('0x41')](_0x45ce7b,'id'));_0x1f2195[_0xca70('0x2f')](_0xca70('0x51'),_[_0xca70('0x41')](_0x45ce7b,'id'));}});}})[_0xca70('0x17')](function(){if(_0x21cb38[_0xca70('0x6d')][_0xca70('0x6b')]===_0xca70('0x6f')&&!_0x16c95e&&!_0x21cb38['query'][_0xca70('0x50')])return[];return db[_0xca70('0x70')][_0xca70('0x27')](_0x56441e[_0xca70('0x71')](),_0x246901);})['then'](function(_0x5e7da3){_0x528e6e['count']=_0x5e7da3[_0xca70('0x21')];if(_0x528e6e['count']===0x0)return[];return db[_0xca70('0x70')][_0xca70('0x27')](_0x31276c['toString'](),_0x246901)[_0xca70('0x17')](function(_0x2e22bf){_0x480dd0=_[_0xca70('0x72')](_0x2e22bf,'id');_0x246901=_[_0xca70('0x73')](_0x246901,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x21cb38[_0xca70('0x27')][_0xca70('0x2b')]){_0x38cd4e[_0xca70('0x2a')][_0xca70('0x42')](function(_0x436232){_0x1f2195[_0xca70('0x30')]('c.'+_0x436232);});}else{_0x1f2195[_0xca70('0x30')](_0xca70('0x64'));_0x1f2195[_0xca70('0x30')](_0xca70('0x74'));_0x1f2195['field']('c.lastName');_0x1f2195[_0xca70('0x30')]('c.phone');_0x1f2195[_0xca70('0x30')](_0xca70('0x75'));_0x1f2195['field'](_0xca70('0x76'));_0x1f2195[_0xca70('0x30')]('c.email');_0x1f2195[_0xca70('0x30')]('c.ListId');_0x1f2195[_0xca70('0x30')]('c.createdAt');_0x1f2195[_0xca70('0x30')](_0xca70('0x77'));_0x1f2195[_0xca70('0x30')]('c.CompanyId');_0x1f2195[_0xca70('0x30')](_0xca70('0x78'),'TagIds');}if(_0x38cd4e[_0xca70('0x11')])_0x1f2195[_0xca70('0x11')](_0x38cd4e[_0xca70('0x11')]);if(_0x38cd4e['offset'])_0x1f2195['offset'](_0x38cd4e[_0xca70('0xf')]);return db[_0xca70('0x70')][_0xca70('0x27')](_0x1f2195[_0xca70('0x71')](),_0x246901);});})[_0xca70('0x17')](function(_0x29bfe4){_0x29bfe4['forEach'](function(_0x585dbb){if(_0x585dbb[_0xca70('0x79')]){_0x585dbb[_0xca70('0x7a')]=[];_0x585dbb[_0xca70('0x79')][_0xca70('0x40')](',')[_0xca70('0x42')](function(_0x12b3e8){_0x585dbb[_0xca70('0x7a')]['push'](_0x480dd0[_0x12b3e8]);});}delete _0x585dbb['TagIds'];});_0x528e6e[_0xca70('0x7b')]=_0x29bfe4;return _0x528e6e;})['then'](respondWithFilteredResult(_0x52e625,_0x38cd4e));})[_0xca70('0x7c')](handleError(_0x52e625,null));};exports[_0xca70('0x7d')]=function(_0x4654de,_0x469063){return db[_0xca70('0x7e')][_0xca70('0x3e')]({'where':{'id':_0x4654de[_0xca70('0x7f')]['id']}})[_0xca70('0x17')](handleEntityNotFound(_0x469063,null))[_0xca70('0x17')](removeEntity(_0x469063,null))[_0xca70('0x7c')](handleError(_0x469063,null));};exports[_0xca70('0x1f')]=function(_0x15f602,_0x381eb5){return db[_0xca70('0x7e')]['describe']()[_0xca70('0x17')](function(_0xfb3ead){delete _0xfb3ead[_0xca70('0x80')];for(var _0x24aaf4=0x0;_0x24aaf40x0){return new Promise(function(_0x2e82fe,_0x51d169){var _0xf78d6=[];for(var _0x283142=0x0;_0x283142<_0x3f940e[_0xca70('0x21')];_0x283142++){_0xf78d6[_0xca70('0x23')](insertAdditionalPhones(_0x3f940e[_0x283142][_0xca70('0xac')],_0x3f940e[_0x283142][_0xca70('0xa7')]));}Promise[_0xca70('0xad')](_0xf78d6)[_0xca70('0x17')](function(){_0x2e82fe(0x1);});})[_0xca70('0x17')](function(){return{'success':_0x4bddd8,'failure':_0x3355ec,'duplicates':_0x2cd3cb};});}else{return{'success':_0x4bddd8,'failure':_0x3355ec,'duplicates':_0x2cd3cb};}}})['then'](respondWithResult(_0x21f09c,0xc9))[_0xca70('0x7c')](handleError(_0x21f09c,null));};exports[_0xca70('0xae')]=function(_0x58302b,_0x388586){var _0x8c26ae;return db[_0xca70('0x7e')][_0xca70('0x1f')]()[_0xca70('0x17')](function(_0x22f091){return db[_0xca70('0x7e')][_0xca70('0x3e')]({'where':{'id':_0x58302b[_0xca70('0x7f')]['id']},'include':[{'model':db[_0xca70('0x3f')],'as':_0xca70('0x7a'),'attributes':['id',_0xca70('0x1c'),'color'],'required':_0x58302b[_0xca70('0x27')]['tag']?!![]:![]},{'model':db[_0xca70('0x96')],'as':_0xca70('0xaf'),'where':{'CmContactId':_0x58302b[_0xca70('0x7f')]['id']},'required':![],'include':[{'model':db[_0xca70('0xb0')],'as':_0xca70('0xb1')}]}],'order':[db[_0xca70('0x70')][_0xca70('0xb2')](_0xca70('0xb3'))],'attributes':_['keys'](_0x22f091)});})[_0xca70('0x17')](function(_0x25afdd){if(!_[_0xca70('0xa3')](_0x25afdd)){_0x8c26ae=_0x25afdd['get']({'plain':!![]});var _0xc95a4c={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x25afdd&&_0x25afdd[_0xca70('0x50')]){if(_0x25afdd[_0xca70('0x50')]){_0xc95a4c[_0xca70('0x2f')][_0xca70('0xb4')][_0xca70('0x23')]({'ListId':{'$ne':_0x25afdd[_0xca70('0x50')]}});}}return db[_0xca70('0xb5')]['findAll'](_0xc95a4c);}})['then'](function(_0x5a84fd){if(!_['isNil'](_0x5a84fd)){return _[_0xca70('0xb6')](_0x8c26ae,_['map'](_0x5a84fd,function(_0x18d050){return util['format'](_0xca70('0xb7'),_0x18d050['id']);}));}})[_0xca70('0x17')](handleEntityNotFound(_0x388586,null))[_0xca70('0x17')](respondWithResult(_0x388586,null))['catch'](handleError(_0x388586,null));};exports[_0xca70('0x16')]=function(_0x1e55f9,_0x321bbc){var _0x2bdf89;if(_0x1e55f9['body']['id']){delete _0x1e55f9[_0xca70('0x86')]['id'];}if(!_[_0xca70('0xa3')](_0x1e55f9[_0xca70('0x86')][_0xca70('0xa4')])){var _0x598e50=_0x1e55f9['body'][_0xca70('0xa4')];if(!_['isNil'](shared[_0xca70('0xa6')][_0x598e50]))_0x1e55f9[_0xca70('0x86')]['utcOffset']=shared['timezones'][_0x598e50][_0xca70('0xa5')];}return db[_0xca70('0x7e')][_0xca70('0x3e')]({'where':{'id':_0x1e55f9['params']['id']}})['then'](handleEntityNotFound(_0x321bbc,null))[_0xca70('0x17')](saveUpdates(_0x1e55f9[_0xca70('0x86')],null))[_0xca70('0x17')](function(_0x2eb9a5){_0x2bdf89=_0x2eb9a5;var _0x1a60bd={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2eb9a5&&_0x2eb9a5[_0xca70('0x50')]){if(_0x2eb9a5[_0xca70('0x50')]){_0x1a60bd['where'][_0xca70('0xb4')][_0xca70('0x23')]({'ListId':{'$ne':_0x2eb9a5[_0xca70('0x50')]}});}}return db['CmCustomField'][_0xca70('0x84')](_0x1a60bd);})[_0xca70('0x17')](function(_0x50ee18){if(_0x50ee18){return _[_0xca70('0xb6')](_[_0xca70('0xb8')](_0x1e55f9[_0xca70('0x86')],function(_0x3422ff,_0x138166){return _[_0xca70('0xb9')](_0x138166,'cf_');}),_[_0xca70('0x41')](_0x50ee18,function(_0x57df5b){return util['format']('cf_%d',_0x57df5b['id']);}));}})['then'](function(_0xeb5d79){if(_0xeb5d79&&!_[_0xca70('0x4f')](_0xeb5d79)){var _0x42ba1e=squel['update']()['table'](_0xca70('0xba'))[_0xca70('0xbb')](_0xeb5d79)[_0xca70('0x2f')](_0xca70('0xbc'),_0x1e55f9[_0xca70('0x7f')]['id'])[_0xca70('0xbd')]();return db[_0xca70('0x70')][_0xca70('0x27')](_0x42ba1e[_0xca70('0x4c')],{'replacements':_0x42ba1e[_0xca70('0x85')]});}})[_0xca70('0x17')](function(){if(_0x1e55f9[_0xca70('0x86')][_0xca70('0xbe')]&&_0x2bdf89){return db['CmHopper'][_0xca70('0x16')]({'phone':_0x1e55f9[_0xca70('0x86')][_0xca70('0xbe')],'OrderBy':0x0},{'where':{'ContactId':_0x2bdf89['id']}});}})[_0xca70('0x17')](function(){return _0x2bdf89;})[_0xca70('0x17')](respondWithResult(_0x321bbc,null))['catch'](handleError(_0x321bbc,null));};exports[_0xca70('0xbf')]=function(_0x1abcad,_0x244e62){var _0x3fbbb9={};var _0x342165={};var _0x19ad56;var _0x174ac7;return db[_0xca70('0x7e')]['findOne']({'where':{'id':_0x1abcad['params']['id']}})[_0xca70('0x17')](handleEntityNotFound(_0x244e62,null))[_0xca70('0x17')](function(_0x34a584){if(_0x34a584){_0x19ad56=_0x34a584;_0x342165[_0xca70('0x26')]=_[_0xca70('0x20')](db[_0xca70('0x3f')][_0xca70('0xc0')]);_0x342165[_0xca70('0x27')]=_[_0xca70('0x20')](_0x1abcad[_0xca70('0x27')]);_0x342165['filters']=_[_0xca70('0x29')](_0x342165['model'],_0x342165[_0xca70('0x27')]);_0x3fbbb9[_0xca70('0x2a')]=_[_0xca70('0x29')](_0x342165[_0xca70('0x26')],qs['fields'](_0x1abcad[_0xca70('0x27')][_0xca70('0x2b')]));_0x3fbbb9[_0xca70('0x2a')]=_0x3fbbb9[_0xca70('0x2a')][_0xca70('0x21')]?_0x3fbbb9[_0xca70('0x2a')]:_0x342165[_0xca70('0x26')];_0x3fbbb9[_0xca70('0x2d')]=qs[_0xca70('0x2e')](_0x1abcad[_0xca70('0x27')][_0xca70('0x2e')]);_0x3fbbb9[_0xca70('0x2f')]=qs[_0xca70('0x28')](_[_0xca70('0xc1')](_0x1abcad[_0xca70('0x27')],_0x342165[_0xca70('0x28')]));if(_0x1abcad['query'][_0xca70('0x58')]){_0x3fbbb9[_0xca70('0x2f')]=_['merge'](_0x3fbbb9[_0xca70('0x2f')],{'$or':_[_0xca70('0x41')](_0x3fbbb9[_0xca70('0x2a')],function(_0x588688){var _0x39a430={};_0x39a430[_0x588688]={'$like':'%'+_0x1abcad[_0xca70('0x27')][_0xca70('0x58')]+'%'};return _0x39a430;})});}_0x3fbbb9=_[_0xca70('0x73')]({},_0x3fbbb9,_0x1abcad[_0xca70('0xc2')]);return _0x19ad56[_0xca70('0xbf')](_0x3fbbb9);}})[_0xca70('0x17')](function(_0x3d4a50){if(_0x3d4a50){_0x174ac7=_0x3d4a50[_0xca70('0x21')];if(!_0x1abcad[_0xca70('0x27')][_0xca70('0x2c')](_0xca70('0xc3'))){_0x3fbbb9[_0xca70('0x11')]=qs[_0xca70('0x11')](_0x1abcad[_0xca70('0x27')][_0xca70('0x11')]);_0x3fbbb9[_0xca70('0xf')]=qs[_0xca70('0xf')](_0x1abcad[_0xca70('0x27')][_0xca70('0xf')]);}return _0x19ad56[_0xca70('0xbf')](_0x3fbbb9);}})['then'](function(_0x37497e){if(_0x37497e){return _0x37497e?{'count':_0x174ac7,'rows':_0x37497e}:null;}})[_0xca70('0x17')](respondWithResult(_0x244e62,null))['catch'](handleError(_0x244e62,null));};exports[_0xca70('0xc4')]=function(_0x2afe90,_0xa422e6){if(_0x2afe90[_0xca70('0x86')]['id']){delete _0x2afe90[_0xca70('0x86')]['id'];}return db[_0xca70('0x7e')][_0xca70('0x24')]({'where':{'id':_0x2afe90[_0xca70('0x7f')]['id']}})[_0xca70('0x17')](handleEntityNotFound(_0xa422e6,null))[_0xca70('0x17')](function(_0x34ee8e){if(_0x34ee8e){return _0x34ee8e[_0xca70('0xc4')](_0x2afe90['body']['ids']||[]);}return null;})[_0xca70('0x17')](respondWithResult(_0xa422e6,null))[_0xca70('0x7c')](handleError(_0xa422e6,null));};exports['setAdditionalPhones']=function(_0x3222a7,_0x4f31d4){var _0x5cea83=[];_0x5cea83[_0xca70('0x23')](addAdditionalPhones(_0x3222a7[_0xca70('0x86')]));Promise[_0xca70('0xad')](_0x5cea83)['then'](function(){_0x5cea83=[];_0x5cea83[_0xca70('0x23')](deleteCmHopperPhones(_0x3222a7[_0xca70('0x86')]['id']));_0x5cea83[_0xca70('0x23')](addCmHopperPhones(_0x3222a7[_0xca70('0x86')]['id']));Promise[_0xca70('0xad')](_0x5cea83)[_0xca70('0x17')](function(){return[0x1];})[_0xca70('0x17')](respondWithResult(_0x4f31d4,null));});};function addAdditionalPhones(_0x2770ba){var _0x465c32;return new Promise(function(_0x2919bf,_0x400e61){return db[_0xca70('0x96')][_0xca70('0x7d')]({'where':{'CmContactId':_0x2770ba['id']}})[_0xca70('0x17')](function(){db['ContactItemType'][_0xca70('0x84')]({'raw':!![],'attributes':['id',_0xca70('0xc5')]})[_0xca70('0x17')](function(_0x214b37){var _0x2f3918=[];for(var _0x76b7bf=0x0;_0x76b7bf<_0x2770ba[_0xca70('0xc6')][_0xca70('0x21')];_0x76b7bf++){var _0x1aeeaa=_0x2770ba['item_types']?_[_0xca70('0xa3')](_0x2770ba[_0xca70('0xc7')][_0x76b7bf])?'':_0x2770ba[_0xca70('0xc7')][_0x76b7bf]:_0x2770ba[_0xca70('0xc6')][_0x76b7bf]['ItemTypeId']?_0x2770ba[_0xca70('0xc6')][_0x76b7bf]['ItemTypeId']:'';var _0x4b73c6=_[_0xca70('0xa3')](_0x2770ba[_0xca70('0xc6')][_0x76b7bf]['description'])?'':_0x2770ba[_0xca70('0xc6')][_0x76b7bf][_0xca70('0xc8')];var _0x4f3c57=_0x1aeeaa+':'+_0x2770ba[_0xca70('0xc6')][_0x76b7bf][_0xca70('0xbe')]+'§'+_0x4b73c6;if(_[_0xca70('0xa3')](_0x465c32))_0x465c32=_0x4f3c57;else _0x465c32+=';'+_0x4f3c57;var _0x3a84cd=null;if(_0x2770ba[_0xca70('0xc7')]){if(!_[_0xca70('0xa3')](_0x2770ba[_0xca70('0xc7')][_0x76b7bf])){var _0x124ce6=_[_0xca70('0x3e')](_0x214b37,function(_0x569047){return _0x569047['id']===_0x2770ba[_0xca70('0xc7')][_0x76b7bf];});if(!_[_0xca70('0xa3')](_0x124ce6)){_0x3a84cd=_0x124ce6[_0xca70('0xc5')];}}}else{if(!_[_0xca70('0xa3')](_0x2770ba[_0xca70('0xc6')][_0x76b7bf])){var _0x124ce6=_[_0xca70('0x3e')](_0x214b37,function(_0x3d9da3){return _0x3d9da3['id']===_0x2770ba['items'][_0x76b7bf][_0xca70('0xc9')];});if(!_[_0xca70('0xa3')](_0x124ce6)){_0x3a84cd=_0x76b7bf;}}}if(_[_0xca70('0xa3')](_0x3a84cd)){_0x3a84cd=0x64;}_0x2f3918[_0xca70('0x23')](addAdditionalPhone(_0x2770ba['id'],_0x2770ba[_0xca70('0xc6')][_0x76b7bf][_0xca70('0xbe')],_0x2770ba[_0xca70('0xc7')]?_['isNil'](_0x2770ba[_0xca70('0xc7')][_0x76b7bf])?null:_0x2770ba[_0xca70('0xc7')][_0x76b7bf]:_0x2770ba[_0xca70('0xc6')][_0x76b7bf][_0xca70('0xc9')]?_0x2770ba[_0xca70('0xc6')][_0x76b7bf][_0xca70('0xc9')]:null,_0x3a84cd,_0x4b73c6));}Promise[_0xca70('0xad')](_0x2f3918)['then'](function(){db['CmContact'][_0xca70('0x16')]({'AdditionalPhones':_0x465c32},{'where':{'id':_0x2770ba['id']}})[_0xca70('0x17')](function(){_0x2919bf(0x1);});});});});});}function addAdditionalPhone(_0x487ac6,_0x3a30da,_0x45c72c,_0x5e883d,_0x9fc21a){return db[_0xca70('0x96')]['find']({'where':{'CmContactId':_0x487ac6,'item':_0x3a30da}})[_0xca70('0x17')](function(_0x3b1114){if(_0x3b1114)logger[_0xca70('0x8a')](_0xca70('0xca'),_0x3b1114);else{db[_0xca70('0x96')][_0xca70('0xa2')]({'CmContactId':_0x487ac6,'item':_0x3a30da,'ItemTypeId':_0x45c72c,'OrderBy':_0x5e883d,'ItemClass':_0xca70('0xcb'),'description':_0x9fc21a});}});}function deletePhones(_0x3578d0){return db[_0xca70('0x96')][_0xca70('0x7d')]({'where':{'CmContactId':_0x3578d0}});}function deleteCmHopperPhones(_0x1f40e1){return new Promise(function(_0x1d92ca,_0x44b7ab){return db['CmHopper'][_0xca70('0x84')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1f40e1}})[_0xca70('0x17')](function(_0x588b7e){db[_0xca70('0xcc')][_0xca70('0x7d')]({'where':{'CmHopperId':{'$in':_[_0xca70('0x41')](_0x588b7e,'id')}}});})[_0xca70('0x17')](function(){_0x1d92ca(0x1);});});}function addCmHopperPhones(_0x37d051){return new Promise(function(_0x1fd6e2,_0x3838f7){return db[_0xca70('0xcd')][_0xca70('0x84')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x37d051}})[_0xca70('0x17')](function(_0x2fb02a){var _0x3ac905=[];_['map'](_0x2fb02a,function(_0x24fcdf){_0x3ac905['push'](createCmHopperPhone(_0x37d051,_0x24fcdf['id']));});Promise[_0xca70('0xad')](_0x3ac905)[_0xca70('0x17')](function(){_0x1fd6e2(0x1);});});});}function createCmHopperPhone(_0x77e2af,_0x2c5e5e){return new Promise(function(_0x470e9e,_0x36f2c0){db[_0xca70('0x96')][_0xca70('0x84')]({'raw':!![],'attributes':['item','OrderBy'],'where':{'CmContactId':_0x77e2af,'ItemClass':_0xca70('0xcb')},'include':[{'model':db[_0xca70('0xb0')],'attributes':[_0xca70('0xc5')],'as':_0xca70('0xb1')}],'order':[_0xca70('0xc5'),db[_0xca70('0x70')][_0xca70('0xb2')](_0xca70('0xce'))]})[_0xca70('0x17')](function(_0x240c2b){var _0x24f1c9=0x1;var _0x8d1ef2=_[_0xca70('0x41')](_0x240c2b,function(_0xef0b65){_0xef0b65['CmHopperId']=_0x2c5e5e;_0xef0b65[_0xca70('0xbe')]=_0xef0b65[_0xca70('0xcf')];_0xef0b65['OrderBy']=_0x24f1c9;delete _0xef0b65[_0xca70('0xd0')];_0x24f1c9=_0x24f1c9+0x1;return _0xef0b65;});return db[_0xca70('0xcc')][_0xca70('0xd1')](_0x8d1ef2,{});})[_0xca70('0x17')](function(){_0x470e9e(0x1);});});}function insertAdditionalPhones(_0xa5cc76,_0x5943cb){return new Promise(function(_0x15de0c,_0x4098be){var _0x9289fb=[];for(var _0x2945c1=0x0;_0x2945c1<_0x5943cb[_0xca70('0x21')];_0x2945c1++){var _0x53c649=_0x5943cb[_0x2945c1];_0x9289fb[_0xca70('0x23')](parseContactItemType(_0x53c649));}Promise[_0xca70('0xad')](_0x9289fb)['then'](function(){var _0x3a4c4c={'id':_0xa5cc76['id'],'items':_0x5943cb};return addAdditionalPhones(_0x3a4c4c)[_0xca70('0x17')](function(_0x41c7ad){return addCmHopperPhones(_0xa5cc76['id']);});})[_0xca70('0x17')](function(){_0x15de0c(_0xa5cc76);});});}function parseContactItemType(_0x41846e){return new Promise(function(_0x7d9c32,_0x360ca6){if(_0x41846e[_0xca70('0x2c')]('ItemTypeId')){_0x7d9c32(_0x41846e);}else{return db[_0xca70('0xb0')][_0xca70('0x3e')]({'where':{'name':_0x41846e[_0xca70('0xb1')]}})[_0xca70('0x17')](function(_0x1b9146){if(_[_0xca70('0xa3')](_0x1b9146))_0x41846e[_0xca70('0xc9')]=null;else _0x41846e[_0xca70('0xc9')]=_0x1b9146['id'];_0x7d9c32(_0x41846e);});}});}exports[_0xca70('0xd2')]=function(_0x512e14,_0x1e3123){return db[_0xca70('0x96')]['findAll']({'raw':!![],'where':{'CmContactId':_0x512e14['params']['id'],'ItemClass':_0xca70('0xcb')},'include':[{'model':db[_0xca70('0xb0')],'as':'ItemType'}],'order':[[_0xca70('0xc5')],[db['sequelize']['literal'](_0xca70('0xce'))]]})[_0xca70('0x17')](function(_0x439875){return _0x439875;})[_0xca70('0x17')](respondWithResult(_0x1e3123,null))[_0xca70('0x7c')](handleError(_0x1e3123,null));};exports['duplicateAdditionalPhones']=function(_0x1fee94,_0x4295f1){return db[_0xca70('0x96')][_0xca70('0x84')]({'raw':!![],'where':{'CmContactId':_0x1fee94[_0xca70('0x86')]['fromContactId']}})[_0xca70('0x17')](function(_0x10519f){var _0x134074=_['map'](_0x10519f,function(_0x4466be){_0x4466be['CmContactId']=_0x1fee94['body'][_0xca70('0xd3')];return _0x4466be;});return db[_0xca70('0x96')]['bulkCreate'](_0x134074,{});})[_0xca70('0x17')](function(_0x34d37a){return addCmHopperPhones(_0x1fee94[_0xca70('0x86')][_0xca70('0xd3')]);})['then'](function(_0x38f624){return['ok'];})[_0xca70('0x17')](respondWithResult(_0x4295f1,null))['catch'](handleError(_0x4295f1,null));};exports[_0xca70('0xd4')]=function(_0x45cde8,_0x578d6b){var _0x526023=[];_0x526023['push'](createCmHopperPhone(_0x45cde8[_0xca70('0x86')]['id'],_0x45cde8['body'][_0xca70('0xd5')]));Promise[_0xca70('0xad')](_0x526023)['then'](function(){return[0x1];})['then'](respondWithResult(_0x578d6b,null));};exports[_0xca70('0xd6')]=function(_0x48c6bd,_0xddcc0c){var _0xc96f3f={'raw':![],'where':{}};var _0x296214={};var _0x388a10={'count':0x0,'rows':[]};return db['CmContact'][_0xca70('0x24')]({'where':{'id':_0x48c6bd[_0xca70('0x7f')]['id']}})[_0xca70('0x17')](handleEntityNotFound(_0xddcc0c,null))['then'](function(_0x1efc3d){if(_0x1efc3d){_0x296214['model']=_['keys'](db['CmHopper'][_0xca70('0xc0')]);_0x296214['query']=_[_0xca70('0x20')](_0x48c6bd[_0xca70('0x27')]);_0x296214['filters']=_[_0xca70('0x29')](_0x296214[_0xca70('0x26')],_0x296214[_0xca70('0x27')]);_0xc96f3f['attributes']=_['intersection'](_0x296214[_0xca70('0x26')],qs[_0xca70('0x2b')](_0x48c6bd[_0xca70('0x27')][_0xca70('0x2b')]));_0xc96f3f['attributes']=_0xc96f3f['attributes'][_0xca70('0x21')]?_0xc96f3f[_0xca70('0x2a')]:_0x296214['model'];if(!_0x48c6bd['query']['hasOwnProperty'](_0xca70('0xc3'))){_0xc96f3f['limit']=qs[_0xca70('0x11')](_0x48c6bd['query'][_0xca70('0x11')]);_0xc96f3f[_0xca70('0xf')]=qs['offset'](_0x48c6bd[_0xca70('0x27')][_0xca70('0xf')]);}_0xc96f3f[_0xca70('0x2d')]=qs[_0xca70('0x2e')](_0x48c6bd[_0xca70('0x27')][_0xca70('0x2e')]);_0xc96f3f[_0xca70('0x2f')]=qs[_0xca70('0x28')](_[_0xca70('0xc1')](_0x48c6bd[_0xca70('0x27')],_0x296214['filters']));_0xc96f3f['where'][_0xca70('0xd7')]=_0x1efc3d['id'];if(_0x48c6bd[_0xca70('0x27')][_0xca70('0x58')]){_0xc96f3f[_0xca70('0x2f')]=_['merge'](_0xc96f3f['where'],{'$or':_[_0xca70('0x41')](_0xc96f3f[_0xca70('0x2a')],function(_0x3d8388){var _0x19f8ac={};_0x19f8ac[_0x3d8388]={'$like':'%'+_0x48c6bd['query'][_0xca70('0x58')]+'%'};return _0x19f8ac;})});}_0xc96f3f=_[_0xca70('0x73')]({},_0xc96f3f,_0x48c6bd[_0xca70('0xc2')]);return db[_0xca70('0xcd')][_0xca70('0x12')]({'where':_0xc96f3f['where']})[_0xca70('0x17')](function(_0x4d4732){_0x388a10[_0xca70('0x12')]=_0x4d4732;if(_0x48c6bd[_0xca70('0x27')][_0xca70('0xd8')]){_0xc96f3f[_0xca70('0xd9')]=[{'all':!![]}];}return db[_0xca70('0xcd')][_0xca70('0x84')](_0xc96f3f);})['then'](function(_0x5f0950){_0x388a10[_0xca70('0x7b')]=_0x5f0950;return _0x388a10;});}})[_0xca70('0x17')](respondWithFilteredResult(_0xddcc0c,_0xc96f3f))[_0xca70('0x7c')](handleError(_0xddcc0c,null));};exports[_0xca70('0xda')]=function(_0x1a6b96,_0x26dbd0){var _0x1f4379={'raw':!![],'where':{}};var _0x40e24a={};var _0x4375ef={'count':0x0,'rows':[]};return db['CmContact'][_0xca70('0x24')]({'where':{'id':_0x1a6b96[_0xca70('0x7f')]['id']}})[_0xca70('0x17')](handleEntityNotFound(_0x26dbd0,null))[_0xca70('0x17')](function(_0xdaeb1a){if(_0xdaeb1a){_0x40e24a[_0xca70('0x26')]=_[_0xca70('0x20')](db[_0xca70('0x98')][_0xca70('0xc0')]);_0x40e24a['query']=_[_0xca70('0x20')](_0x1a6b96[_0xca70('0x27')]);_0x40e24a['filters']=_['intersection'](_0x40e24a[_0xca70('0x26')],_0x40e24a[_0xca70('0x27')]);_0x1f4379['attributes']=_[_0xca70('0x29')](_0x40e24a['model'],qs[_0xca70('0x2b')](_0x1a6b96[_0xca70('0x27')][_0xca70('0x2b')]));_0x1f4379[_0xca70('0x2a')]=_0x1f4379[_0xca70('0x2a')][_0xca70('0x21')]?_0x1f4379[_0xca70('0x2a')]:_0x40e24a[_0xca70('0x26')];if(!_0x1a6b96[_0xca70('0x27')][_0xca70('0x2c')](_0xca70('0xc3'))){_0x1f4379[_0xca70('0x11')]=qs[_0xca70('0x11')](_0x1a6b96['query']['limit']);_0x1f4379['offset']=qs[_0xca70('0xf')](_0x1a6b96[_0xca70('0x27')]['offset']);}_0x1f4379['order']=qs[_0xca70('0x2e')](_0x1a6b96[_0xca70('0x27')][_0xca70('0x2e')]);_0x1f4379['where']=qs[_0xca70('0x28')](_[_0xca70('0xc1')](_0x1a6b96[_0xca70('0x27')],_0x40e24a[_0xca70('0x28')]));_0x1f4379[_0xca70('0x2f')][_0xca70('0xd7')]=_0xdaeb1a['id'];if(_0x1a6b96[_0xca70('0x27')][_0xca70('0x58')]){_0x1f4379[_0xca70('0x2f')]=_[_0xca70('0x73')](_0x1f4379[_0xca70('0x2f')],{'$or':_[_0xca70('0x41')](_0x1f4379[_0xca70('0x2a')],function(_0x539aa3){var _0x57f528={};_0x57f528[_0x539aa3]={'$like':'%'+_0x1a6b96[_0xca70('0x27')][_0xca70('0x58')]+'%'};return _0x57f528;})});}_0x1f4379=_[_0xca70('0x73')]({},_0x1f4379,_0x1a6b96[_0xca70('0xc2')]);return db[_0xca70('0x98')]['count']({'where':_0x1f4379['where']})[_0xca70('0x17')](function(_0x1fae9a){_0x4375ef['count']=_0x1fae9a;if(_0x1a6b96[_0xca70('0x27')][_0xca70('0xd8')]){_0x1f4379['include']=[{'all':!![]}];}return db[_0xca70('0x98')][_0xca70('0x84')](_0x1f4379);})[_0xca70('0x17')](function(_0x44fceb){_0x4375ef[_0xca70('0x7b')]=_0x44fceb;return _0x4375ef;});}})[_0xca70('0x17')](respondWithFilteredResult(_0x26dbd0,_0x1f4379))[_0xca70('0x7c')](handleError(_0x26dbd0,null));};exports[_0xca70('0xdb')]=function(_0x3c4ea0,_0xed3e64){var _0x450c4c={'raw':!![],'where':{}};var _0x1c0b27={};var _0x43bb18={'count':0x0,'rows':[]};return db[_0xca70('0x7e')][_0xca70('0x24')]({'where':{'id':_0x3c4ea0[_0xca70('0x7f')]['id']}})[_0xca70('0x17')](handleEntityNotFound(_0xed3e64,null))[_0xca70('0x17')](function(_0x46c494){if(_0x46c494){_0x1c0b27[_0xca70('0x26')]=_[_0xca70('0x20')](db[_0xca70('0x97')][_0xca70('0xc0')]);_0x1c0b27[_0xca70('0x27')]=_[_0xca70('0x20')](_0x3c4ea0['query']);_0x1c0b27[_0xca70('0x28')]=_[_0xca70('0x29')](_0x1c0b27[_0xca70('0x26')],_0x1c0b27[_0xca70('0x27')]);_0x450c4c[_0xca70('0x2a')]=_[_0xca70('0x29')](_0x1c0b27['model'],qs[_0xca70('0x2b')](_0x3c4ea0['query'][_0xca70('0x2b')]));_0x450c4c[_0xca70('0x2a')]=_0x450c4c[_0xca70('0x2a')]['length']?_0x450c4c[_0xca70('0x2a')]:_0x1c0b27[_0xca70('0x26')];if(!_0x3c4ea0[_0xca70('0x27')]['hasOwnProperty'](_0xca70('0xc3'))){_0x450c4c[_0xca70('0x11')]=qs[_0xca70('0x11')](_0x3c4ea0[_0xca70('0x27')][_0xca70('0x11')]);_0x450c4c[_0xca70('0xf')]=qs['offset'](_0x3c4ea0[_0xca70('0x27')]['offset']);}_0x450c4c[_0xca70('0x2d')]=qs['sort'](_0x3c4ea0[_0xca70('0x27')][_0xca70('0x2e')]);_0x450c4c[_0xca70('0x2f')]=qs[_0xca70('0x28')](_[_0xca70('0xc1')](_0x3c4ea0['query'],_0x1c0b27['filters']));_0x450c4c[_0xca70('0x2f')]['ContactId']=_0x46c494['id'];if(_0x3c4ea0['query'][_0xca70('0x58')]){_0x450c4c['where']=_['merge'](_0x450c4c[_0xca70('0x2f')],{'$or':_[_0xca70('0x41')](_0x450c4c['attributes'],function(_0x3b00e0){var _0xd37fff={};_0xd37fff[_0x3b00e0]={'$like':'%'+_0x3c4ea0[_0xca70('0x27')]['filter']+'%'};return _0xd37fff;})});}_0x450c4c=_['merge']({},_0x450c4c,_0x3c4ea0[_0xca70('0xc2')]);return db['CmHopperFinal']['count']({'where':_0x450c4c[_0xca70('0x2f')]})[_0xca70('0x17')](function(_0x35d728){_0x43bb18[_0xca70('0x12')]=_0x35d728;if(_0x3c4ea0[_0xca70('0x27')]['includeAll']){_0x450c4c[_0xca70('0xd9')]=[{'all':!![]}];}return db[_0xca70('0x97')]['findAll'](_0x450c4c);})[_0xca70('0x17')](function(_0x3d0030){_0x43bb18[_0xca70('0x7b')]=_0x3d0030;return _0x43bb18;});}})[_0xca70('0x17')](respondWithFilteredResult(_0xed3e64,_0x450c4c))[_0xca70('0x7c')](handleError(_0xed3e64,null));};exports['getJscriptySessions']=function(_0x55ef58,_0x30b8fb){var _0x4230fe={'raw':!![],'where':{}};var _0x2f6e2a={};var _0x3933cb={'count':0x0,'rows':[]};return db['CmContact'][_0xca70('0x24')]({'where':{'id':_0x55ef58[_0xca70('0x7f')]['id']}})[_0xca70('0x17')](handleEntityNotFound(_0x30b8fb,null))[_0xca70('0x17')](function(_0x5168d0){if(_0x5168d0){_0x2f6e2a[_0xca70('0x26')]=_['keys'](db['JscriptySessionReport'][_0xca70('0xc0')]);_0x2f6e2a['query']=_['keys'](_0x55ef58[_0xca70('0x27')]);_0x2f6e2a[_0xca70('0x28')]=_[_0xca70('0x29')](_0x2f6e2a[_0xca70('0x26')],_0x2f6e2a[_0xca70('0x27')]);_0x4230fe[_0xca70('0x2a')]=_[_0xca70('0x29')](_0x2f6e2a[_0xca70('0x26')],qs[_0xca70('0x2b')](_0x55ef58[_0xca70('0x27')][_0xca70('0x2b')]));_0x4230fe[_0xca70('0x2a')]=_0x4230fe[_0xca70('0x2a')][_0xca70('0x21')]?_0x4230fe[_0xca70('0x2a')]:_0x2f6e2a[_0xca70('0x26')];if(!_0x55ef58['query'][_0xca70('0x2c')](_0xca70('0xc3'))){_0x4230fe[_0xca70('0x11')]=qs['limit'](_0x55ef58[_0xca70('0x27')]['limit']);_0x4230fe[_0xca70('0xf')]=qs[_0xca70('0xf')](_0x55ef58['query'][_0xca70('0xf')]);}_0x4230fe[_0xca70('0x2d')]=qs['sort'](_0x55ef58['query'][_0xca70('0x2e')]);_0x4230fe[_0xca70('0x2f')]=qs[_0xca70('0x28')](_[_0xca70('0xc1')](_0x55ef58[_0xca70('0x27')],_0x2f6e2a[_0xca70('0x28')]));_0x4230fe[_0xca70('0x2f')][_0xca70('0xd7')]=_0x5168d0['id'];if(_0x55ef58[_0xca70('0x27')][_0xca70('0x58')]){_0x4230fe[_0xca70('0x2f')]=_[_0xca70('0x73')](_0x4230fe[_0xca70('0x2f')],{'$or':_[_0xca70('0x41')](_0x4230fe[_0xca70('0x2a')],function(_0x5d00b6){var _0x497a3f={};_0x497a3f[_0x5d00b6]={'$like':'%'+_0x55ef58['query'][_0xca70('0x58')]+'%'};return _0x497a3f;})});}_0x4230fe=_['merge']({},_0x4230fe,_0x55ef58['options']);return db[_0xca70('0x9f')]['count']({'where':_0x4230fe['where']})['then'](function(_0x5dc76d){_0x3933cb[_0xca70('0x12')]=_0x5dc76d;if(_0x55ef58[_0xca70('0x27')][_0xca70('0xd8')]){_0x4230fe['include']=[{'all':!![]}];}return db[_0xca70('0x9f')][_0xca70('0x84')](_0x4230fe);})[_0xca70('0x17')](function(_0x2623ca){_0x3933cb[_0xca70('0x7b')]=_0x2623ca;return _0x3933cb;});}})['then'](respondWithFilteredResult(_0x30b8fb,_0x4230fe))[_0xca70('0x7c')](handleError(_0x30b8fb,null));};exports[_0xca70('0xdc')]=function(_0x98bf95,_0x4165c0){try{if(!_0x98bf95['body']['ListId']){throw new Error(_0xca70('0xdd'));}if(!_0x98bf95[_0xca70('0x86')][_0xca70('0xde')]){throw new Error(_0xca70('0xdf'));}if(!_0x98bf95[_0xca70('0x86')][_0xca70('0xe0')]){throw new Error(_0xca70('0xe1'));}if(!_0x98bf95[_0xca70('0x86')][_0xca70('0xe2')]){throw new Error(_0xca70('0xe3'));}var _0x3ea91f=_0x98bf95[_0xca70('0x86')]['binding_keys'][_0xca70('0x40')](',');var _0x58c663=_0x98bf95['body'][_0xca70('0xe0')][_0xca70('0x40')](',');if(!_0x3ea91f[_0xca70('0x21')]||!_0x58c663['length']||_0x3ea91f[_0xca70('0x21')]!==_0x58c663[_0xca70('0x21')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x98bf95['body'][_0xca70('0x2b')]=_[_0xca70('0xe4')](_0x3ea91f,_0x58c663);if(!_0x98bf95[_0xca70('0x86')]['fields'][_0xca70('0xbe')]){throw new Error(_0xca70('0xe5'));}if(!_0x98bf95[_0xca70('0x86')]['fields'][_0xca70('0xe6')]){throw new Error(_0xca70('0xe7'));}var _0x495c3d=path[_0xca70('0x89')](config[_0xca70('0xe8')],_0xca70('0xe9'),_0x98bf95[_0xca70('0xea')][_0xca70('0xeb')]);fs[_0xca70('0xec')](_0x495c3d,parseInt(_0xca70('0xed'),0x8));var _0x573a52=require(_0xca70('0xee'))[_0xca70('0xef')](path[_0xca70('0x89')](__dirname,_0xca70('0xf0')),[_0x495c3d,_0x98bf95[_0xca70('0x86')][_0xca70('0xde')],_0x98bf95[_0xca70('0x86')]['binding_values'],_0x98bf95['body'][_0xca70('0x50')],_0x98bf95[_0xca70('0x86')][_0xca70('0xf1')],_0x98bf95[_0xca70('0x86')][_0xca70('0xa8')],_0x98bf95['body'][_0xca70('0xe2')]]);return _0x4165c0[_0xca70('0x13')](0xc8)[_0xca70('0xf2')]({'message':'File\x20uploaded\x20correctly!','pid':_0x573a52['pid']});}catch(_0x31c689){return _0x4165c0['status'](0x1f4)['send'](_0x31c689);}};exports[_0xca70('0xf3')]=function(_0x19a2eb,_0x5b8808){var _0x1e6c74=fs[_0xca70('0xf4')](_0x19a2eb[_0xca70('0xea')][_0xca70('0x1')]);Papa[_0xca70('0xf5')](_0x1e6c74,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x3b277c){return _0x5b8808['status'](0xc8)['json']({'file':_0x19a2eb[_0xca70('0xea')],'fields':_0x3b277c[_0xca70('0xf6')][_0xca70('0x2b')]});}});};exports[_0xca70('0xf7')]=function(_0x271a27,_0x1aef75){return db[_0xca70('0x44')][_0xca70('0x84')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})['then'](function(_0x2c99e0){var _0x5e67a4=![];if(!_0x271a27[_0xca70('0x86')][_0xca70('0x50')]){throw new Error(_0xca70('0xdd'));}if(!_0x271a27[_0xca70('0x86')][_0xca70('0xf8')][_0xca70('0xbe')]){throw new Error(_0xca70('0xe5'));}if(!_0x271a27[_0xca70('0x86')][_0xca70('0xf8')][_0xca70('0xe6')]){throw new Error(_0xca70('0xe7'));}if(!_0x271a27['body'][_0xca70('0xe2')]){throw new Error(_0xca70('0xe3'));}var _0xf58648=require(_0xca70('0xee'))[_0xca70('0xef')](path[_0xca70('0x89')](__dirname,_0xca70('0xf9')),[_0x271a27[_0xca70('0x7f')]['id'],JSON['stringify'](_0x271a27['body']),JSON[_0xca70('0xfa')](_0x2c99e0)]);_0xf58648['on'](_0xca70('0xfb'),function(){_0x5e67a4=!![];return _0x1aef75[_0xca70('0x13')](0xc8)['json']({'message':_0xca70('0xfc'),'pid':_0xf58648[_0xca70('0xfd')]});});_0xf58648['on'](_0xca70('0xfe'),function(_0x397799){if(_0x397799&&!_0x5e67a4){return _0x1aef75[_0xca70('0x13')](0x1f4)[_0xca70('0xf2')]({'message':_0xca70('0xff'),'pid':_0xf58648[_0xca70('0xfd')]});}});})[_0xca70('0x7c')](handleError(_0x1aef75,null));};exports[_0xca70('0x100')]=function(_0x2b88a1,_0x5449f4,_0x51a453){return db[_0xca70('0x44')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0xca70('0x17')](function(_0x537228){var _0x14a50f=![];if(!_0x2b88a1[_0xca70('0x86')][_0xca70('0x50')]){throw new Error(_0xca70('0xdd'));}if(!_0x2b88a1[_0xca70('0x86')]['binding'][_0xca70('0xbe')]){throw new Error(_0xca70('0xe5'));}if(!_0x2b88a1[_0xca70('0x86')][_0xca70('0xf8')][_0xca70('0xe6')]){throw new Error(_0xca70('0xe7'));}if(!_0x2b88a1[_0xca70('0x86')][_0xca70('0xe2')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x5bddec=require(_0xca70('0xee'))[_0xca70('0xef')](path[_0xca70('0x89')](__dirname,_0xca70('0x101')),[_0x2b88a1[_0xca70('0x7f')]['id'],JSON[_0xca70('0xfa')](_0x2b88a1[_0xca70('0x86')]),JSON[_0xca70('0xfa')](_0x537228)]);_0x5bddec['on'](_0xca70('0xfb'),function(_0x4b8c75){_0x14a50f=!![];return _0x5449f4[_0xca70('0x13')](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x5bddec[_0xca70('0xfd')]});});_0x5bddec['on'](_0xca70('0xfe'),function(_0x2d8b58){if(_0x2d8b58&&!_0x14a50f){return _0x5449f4['status'](0x1f4)['json']({'message':_0xca70('0xff'),'pid':_0x5bddec[_0xca70('0xfd')]});}});})[_0xca70('0x7c')](handleError(_0x5449f4,null));};exports[_0xca70('0x102')]=function(_0x206c32,_0x26183f){var _0x2d8c4c=['mail',_0xca70('0x103'),_0xca70('0x104'),'openchannel',_0xca70('0x105'),_0xca70('0x106'),_0xca70('0x107')];var _0x4582d1={'offset':0x0,'order':qs[_0xca70('0x2e')](_0xca70('0x108'))},_0x5821e1={'count':0x0,'rows':[]};Promise['resolve']()[_0xca70('0x17')](function(){if(_0x206c32[_0xca70('0x27')][_0xca70('0x109')]){if(!_[_0xca70('0x10a')](_0x2d8c4c,_0x206c32[_0xca70('0x27')][_0xca70('0x109')][_0xca70('0x10b')]())){throw new Error('Invalid\x20channel');}_0x2d8c4c=[_0x206c32[_0xca70('0x27')][_0xca70('0x109')][_0xca70('0x10b')]()];}if(_0x206c32[_0xca70('0x27')][_0xca70('0x10c')]){try{var _0x5e8945=JSON['parse'](_0x206c32[_0xca70('0x27')][_0xca70('0x10c')]);if(!moment(_0x5e8945[_0xca70('0x33')])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x5e8945['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x27dee2){throw new Error(_0xca70('0x10d'));}}if(!_0x206c32[_0xca70('0x27')][_0xca70('0x2c')](_0xca70('0xc3'))){_0x4582d1[_0xca70('0x11')]=qs[_0xca70('0x11')](_0x206c32['query']['limit']||0xa);_0x4582d1['offset']=qs[_0xca70('0xf')](_0x206c32[_0xca70('0x27')][_0xca70('0xf')]);}var _0x3311ac=_0x2d8c4c[_0xca70('0x41')](function(_0x43c253){if(_0x43c253===_0xca70('0x107')){var _0x5ac1d0={'attributes':['id','uniqueid',_0xca70('0x10e'),'source',_0xca70('0x10f'),'callerid','starttime',_0xca70('0x110'),_0xca70('0x111'),_0xca70('0x112'),_0xca70('0x113'),_0xca70('0x114'),_0xca70('0x115'),_0xca70('0x116'),_0xca70('0x117')],'where':{'ContactId':_0x206c32[_0xca70('0x7f')]['id']},'include':[{'model':db[_0xca70('0x44')],'as':_0xca70('0x44'),'attributes':['id',_0xca70('0x1c'),_0xca70('0x118'),_0xca70('0x119')]}],'order':[[_0xca70('0x113'),_0xca70('0x68')]]};if(_0x206c32[_0xca70('0x27')][_0xca70('0x10c')]){_0x5ac1d0['where'][_0xca70('0x113')]={'$gte':_0x5e8945[_0xca70('0x33')],'$lte':_0x5e8945['to']};}return db[_0xca70('0x9a')]['findAndCountAll'](_0x5ac1d0)['then'](function(_0x3b2670){_0x5821e1[_0xca70('0x12')]+=_0x3b2670[_0xca70('0x12')];return _['map'](_0x3b2670[_0xca70('0x7b')],function(_0x23f913){var _0x4ae21e=_0x23f913[_0xca70('0x87')]({'plain':!![]});_0x4ae21e[_0xca70('0x109')]=_0x43c253;if(_0x4ae21e['User']){_0x4ae21e[_0xca70('0x44')]={'id':_0x4ae21e[_0xca70('0x44')]['id'],'name':_0x4ae21e[_0xca70('0x44')][_0xca70('0x1c')],'fullname':_0x4ae21e[_0xca70('0x44')][_0xca70('0x118')],'alias':_0x4ae21e[_0xca70('0x44')][_0xca70('0x119')]};}return _0x4ae21e;});});}else{var _0x29ce3d=_['startCase'](_0x43c253)+(_0x43c253===_0xca70('0x103')?_0xca70('0x11a'):_0xca70('0x11b'));var _0x99f986={'attributes':['id',_0xca70('0x11c'),_0xca70('0x11d'),_0xca70('0x113'),'note',_0xca70('0x11e'),_0xca70('0x11f'),_0xca70('0x120'),_0xca70('0x117'),_0x29ce3d+'Id'],'where':{'ContactId':_0x206c32[_0xca70('0x7f')]['id']},'include':[{'model':db[_0x29ce3d],'as':_0xca70('0x11b'),'attributes':['id',_0xca70('0x1c'),'key']},{'model':db[_0xca70('0x44')],'as':'Owner','attributes':['id',_0xca70('0x1c'),'fullname']},{'model':db[_0xca70('0x3f')],'as':'Tags','attributes':['id',_0xca70('0x1c'),_0xca70('0x121')],'through':{'attributes':[]}}],'order':[[_0xca70('0x113'),_0xca70('0x68')]]};if(_0x206c32['query'][_0xca70('0x10c')]){_0x99f986[_0xca70('0x2f')][_0xca70('0x113')]={'$gte':_0x5e8945['from'],'$lte':_0x5e8945['to']};}switch(_0x43c253){case'chat':_0x99f986[_0xca70('0x2a')]['push'](_0xca70('0x122'),_0xca70('0x123'),_0xca70('0x124'),'deviceModel',_0xca70('0x125'),_0xca70('0x126'),'ratingType','ratingValue',_0xca70('0x127'));break;case'mail':_0x99f986['attributes']['push'](_0xca70('0x128'),_0xca70('0x129'));break;case'openchannel':_0x99f986['attributes'][_0xca70('0x23')]('externalUrl',_0xca70('0x12a'));break;}return db[_[_0xca70('0x12b')](_0x43c253)+_0xca70('0x12c')][_0xca70('0x12d')](_0x99f986)[_0xca70('0x17')](function(_0x3ee4cb){_0x5821e1[_0xca70('0x12')]+=_0x3ee4cb[_0xca70('0x12')];return _['map'](_0x3ee4cb[_0xca70('0x7b')],function(_0x27ee69){var _0xdf62e0=_0x27ee69[_0xca70('0x87')]({'plain':!![]});_0xdf62e0[_0xca70('0x109')]=_0x43c253;if(_0xdf62e0['Owner']){_0xdf62e0[_0xca70('0x12e')]={'id':_0xdf62e0['Owner']['id'],'name':_0xdf62e0[_0xca70('0x12e')][_0xca70('0x1c')],'fullname':_0xdf62e0[_0xca70('0x12e')][_0xca70('0x118')]};}return _0xdf62e0;});});}});return Promise[_0xca70('0xad')](_0x3311ac);})['then'](function(_0x1cfc8d){return _(_0x1cfc8d)[_0xca70('0x12f')]()[_0xca70('0x130')](_0xca70('0x113'))[_0xca70('0x131')]()['value']();})[_0xca70('0x17')](function(_0x400c15){_0x5821e1[_0xca70('0x7b')]=_0x4582d1['limit']?_0x400c15[_0xca70('0x132')](_0x4582d1[_0xca70('0xf')],_0x4582d1['offset']+_0x4582d1[_0xca70('0x11')]):_0x400c15;return _0x5821e1;})[_0xca70('0x17')](respondWithFilteredResult(_0x26183f,_0x4582d1))['catch'](handleError(_0x26183f,null));}; \ No newline at end of file +var _0x6351=['Tag','Phones','ContactItemType','ItemType','$and','CmCustomField','cf_%d','omit','pickBy','format','table','cm_contacts','id\x20=\x20?','toParam','phone','getTags','rawAttributes','options','setTags','ids','setAdditionalPhones','item_types','ItemTypeId','description','items','OrderBy','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','literal','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','includeAll','getHopperFinals','include','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','chmodSync','0777','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','binding','fork','stringify','message','exit','No\x20phone\x20column\x20specified','../../components/import/cm/csvUpdates','getJourney','mail','sms','fax','whatsapp','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20createdAt\x20filter','source','destination','callerid','starttime','duration','note','createdAt','userDisposition','userThirdDisposition','fullname','findAndCountAll','chat','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','UserId','Account','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','subject','substatus','threadId','startCase','flatten','sortBy','slice','path','lodash','squel','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment/shared','redis','localhost','socket.io-emitter','./cmContact.socket','offset','undefined','limit','count','status','set','Content-Range','json','update','destroy','then','sendStatus','error','stack','name','send','index','CmContact','describe','length','keys','startsWith','cf_','push','findOne','trimStart','fieldType','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','left_join','cm_contact_has_tags','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','find','value','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','DATE','text','map','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','filter','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','QueryTypes','clone','DESC','having','t.id\x20IN\x20?','resolve','user','role','some','getLists','c.ListId\x20IS\x20NULL','agent','sequelize','toString','merge','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','params','tags','columnName','displayName','analytics','findAll','alias','custom','values','catch','body','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','findOrCreate','spread','all'];(function(_0x57e465,_0x5166f6){var _0x4ef074=function(_0x19a2e0){while(--_0x19a2e0){_0x57e465['push'](_0x57e465['shift']());}};_0x4ef074(++_0x5166f6);}(_0x6351,0x1b2));var _0x1635=function(_0x20a6bd,_0xaeb074){_0x20a6bd=_0x20a6bd-0x0;var _0x318a91=_0x6351[_0x20a6bd];return _0x318a91;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require('util');var path=require(_0x1635('0x0'));var fs=require('fs');var _=require(_0x1635('0x1'));var squel=require(_0x1635('0x2'));var Papa=require('papaparse');var Redis=require(_0x1635('0x3'));var qs=require('../../components/parsers/qs');var as=require(_0x1635('0x4'));var logger=require(_0x1635('0x5'))('api');var config=require('../../config/environment');var shared=require(_0x1635('0x6'));var db=require('../../mysqldb')['db'];config[_0x1635('0x7')]=_['defaults'](config[_0x1635('0x7')],{'host':_0x1635('0x8'),'port':0x18eb});var socket=require(_0x1635('0x9'))(new Redis(config['redis']));require(_0x1635('0xa'))['register'](socket);function respondWithResult(_0x35f3aa,_0x35a92d){_0x35a92d=_0x35a92d||0xc8;return function(_0x205373){if(_0x205373){return _0x35f3aa['status'](_0x35a92d)['json'](_0x205373);}};}function respondWithFilteredResult(_0x256488,_0xdb7878){return function(_0x772c1d){if(_0x772c1d){var _0x5791d8=typeof _0xdb7878[_0x1635('0xb')]===_0x1635('0xc')&&typeof _0xdb7878[_0x1635('0xd')]===_0x1635('0xc');var _0x3f08a2=_0x772c1d[_0x1635('0xe')];var _0x4e91f8=_0x5791d8?0x0:_0xdb7878[_0x1635('0xb')];var _0x439b59=_0x5791d8?_0x772c1d['count']:_0xdb7878[_0x1635('0xb')]+_0xdb7878['limit'];var _0x54868d;if(_0x439b59>=_0x3f08a2){_0x439b59=_0x3f08a2;_0x54868d=0xc8;}else{_0x54868d=0xce;}_0x256488[_0x1635('0xf')](_0x54868d);return _0x256488[_0x1635('0x10')](_0x1635('0x11'),_0x4e91f8+'-'+_0x439b59+'/'+_0x3f08a2)[_0x1635('0x12')](_0x772c1d);}return null;};}function saveUpdates(_0x4e9f54){return function(_0x1c6fdd){if(_0x1c6fdd){return _0x1c6fdd[_0x1635('0x13')](_0x4e9f54)['then'](function(_0x4b14f4){return _0x4b14f4;});}return null;};}function removeEntity(_0x52d151){return function(_0x3c3fb4){if(_0x3c3fb4){return _0x3c3fb4[_0x1635('0x14')]()[_0x1635('0x15')](function(){_0x52d151[_0x1635('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x423c39){return function(_0x5a668d){if(!_0x5a668d){_0x423c39[_0x1635('0x16')](0x194);}return _0x5a668d;};}function handleError(_0x192907,_0x1f3892){_0x1f3892=_0x1f3892||0x1f4;return function(_0x249a1a){logger[_0x1635('0x17')](_0x249a1a[_0x1635('0x18')]);if(_0x249a1a[_0x1635('0x19')]){delete _0x249a1a['name'];}_0x192907['status'](_0x1f3892)[_0x1635('0x1a')](_0x249a1a);};}exports[_0x1635('0x1b')]=function(_0x209840,_0x55d7d5){var _0x1b7b7d={},_0x52b2e6={},_0x43b3ee={'count':0x0,'rows':[]};return db[_0x1635('0x1c')][_0x1635('0x1d')]()[_0x1635('0x15')](function(_0x5d5d48){var _0x3e7014=[];for(var _0x554ea8=0x0;_0x554ea80x1){_0x4d0409['or'](_0x1635('0x59'),qs[_0x1635('0x5a')](_0x1f99f3),null);}else{if(qs['isNumeric'](_0x1f99f3)){_0x4d0409['or']('c.id\x20LIKE\x20?',_0x1f99f3+'%');_0x4d0409['or'](_0x1635('0x5b'),_0x1f99f3+'%');_0x4d0409['or']('c.mobile\x20LIKE\x20?',_0x1f99f3+'%');_0x4d0409['or'](_0x1635('0x5c'),_0x1f99f3+'%');}else if(qs[_0x1635('0x5d')](_0x1f99f3)){_0x4d0409['or'](_0x1635('0x5e'),_0x1f99f3+'%');}else{_0x4d0409['or'](_0x1635('0x5f'),'%'+_0x1f99f3+'%');_0x4d0409['or'](_0x1635('0x60'),'%'+_0x1f99f3+'%');_0x4d0409['or'](_0x1635('0x5e'),'%'+_0x1f99f3+'%');}}}}_0x1f30ac['where'](_0x4d0409);_0x1f30ac[_0x1635('0x61')](_0x1635('0x62'));var _0x45fb08={'type':db['Sequelize'][_0x1635('0x63')]['SELECT'],'raw':!![]};var _0x57fd4b=_0x1f30ac[_0x1635('0x64')]()[_0x1635('0x34')](_0x1635('0x62'));if(_0x1b7b7d[_0x1635('0x2e')]){_0x1b7b7d[_0x1635('0x2e')]['forEach'](function(_0x521c4a){_0x1f30ac['order']('c.'+_0x521c4a[0x0],_0x521c4a[0x1]===_0x1635('0x65')?![]:!![]);});}if(!_[_0x1635('0x50')](_0xcfd0ff)){_0x1f30ac[_0x1635('0x66')](_0x33462e);_0x57fd4b[_0x1635('0x30')](_0x1635('0x67'),_0xcfd0ff);}BPromise[_0x1635('0x68')]()['then'](function(){if(!_0x378074)return;if(_0x209840[_0x1635('0x69')][_0x1635('0x6a')]!=='agent')return;if(!_[_0x1635('0x6b')](_0x378074[_0x1635('0x41')],[_0x1635('0x34'),_0x1635('0x48')])){return _0x209840[_0x1635('0x69')][_0x1635('0x6c')]({'attributes':['id'],'raw':!![]})[_0x1635('0x15')](function(_0x2acead){if(_[_0x1635('0x50')](_0x2acead)){_0x57fd4b[_0x1635('0x30')](_0x1635('0x6d'));_0x1f30ac[_0x1635('0x30')](_0x1635('0x6d'));}else{_0x57fd4b['where'](_0x1635('0x52'),_[_0x1635('0x4e')](_0x2acead,'id'));_0x1f30ac['where'](_0x1635('0x52'),_[_0x1635('0x4e')](_0x2acead,'id'));}});}})[_0x1635('0x15')](function(){if(_0x209840['user'][_0x1635('0x6a')]===_0x1635('0x6e')&&!_0x378074&&!_0x209840['query']['ListId'])return[];return db[_0x1635('0x6f')][_0x1635('0x28')](_0x57fd4b[_0x1635('0x70')](),_0x45fb08);})[_0x1635('0x15')](function(_0x35ac6d){_0x43b3ee[_0x1635('0xe')]=_0x35ac6d[_0x1635('0x1e')];if(_0x43b3ee['count']===0x0)return[];return db['sequelize'][_0x1635('0x28')](_0x58d789[_0x1635('0x70')](),_0x45fb08)[_0x1635('0x15')](function(_0x38939c){_0x325b96=_['keyBy'](_0x38939c,'id');_0x45fb08=_[_0x1635('0x71')](_0x45fb08,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x209840[_0x1635('0x28')][_0x1635('0x2b')]){_0x1b7b7d[_0x1635('0x2a')][_0x1635('0x45')](function(_0x9785b0){_0x1f30ac[_0x1635('0x34')]('c.'+_0x9785b0);});}else{_0x1f30ac[_0x1635('0x34')](_0x1635('0x62'));_0x1f30ac[_0x1635('0x34')](_0x1635('0x72'));_0x1f30ac[_0x1635('0x34')](_0x1635('0x73'));_0x1f30ac[_0x1635('0x34')](_0x1635('0x74'));_0x1f30ac[_0x1635('0x34')](_0x1635('0x75'));_0x1f30ac[_0x1635('0x34')](_0x1635('0x76'));_0x1f30ac['field']('c.email');_0x1f30ac['field']('c.ListId');_0x1f30ac['field'](_0x1635('0x77'));_0x1f30ac['field'](_0x1635('0x78'));_0x1f30ac['field'](_0x1635('0x79'));_0x1f30ac[_0x1635('0x34')](_0x1635('0x7a'),_0x1635('0x7b'));}if(_0x1b7b7d[_0x1635('0xd')])_0x1f30ac[_0x1635('0xd')](_0x1b7b7d[_0x1635('0xd')]);if(_0x1b7b7d[_0x1635('0xb')])_0x1f30ac[_0x1635('0xb')](_0x1b7b7d['offset']);return db[_0x1635('0x6f')]['query'](_0x1f30ac['toString'](),_0x45fb08);});})[_0x1635('0x15')](function(_0x4d8a46){_0x4d8a46[_0x1635('0x45')](function(_0x48486d){if(_0x48486d[_0x1635('0x7b')]){_0x48486d[_0x1635('0x7c')]=[];_0x48486d[_0x1635('0x7b')]['split'](',')['forEach'](function(_0x41c5aa){_0x48486d[_0x1635('0x7c')][_0x1635('0x22')](_0x325b96[_0x41c5aa]);});}delete _0x48486d[_0x1635('0x7b')];});_0x43b3ee[_0x1635('0x7d')]=_0x4d8a46;return _0x43b3ee;})[_0x1635('0x15')](respondWithFilteredResult(_0x55d7d5,_0x1b7b7d));})['catch'](handleError(_0x55d7d5,null));};exports[_0x1635('0x14')]=function(_0x444553,_0x22e839){return db['CmContact'][_0x1635('0x42')]({'where':{'id':_0x444553[_0x1635('0x7e')]['id']}})[_0x1635('0x15')](handleEntityNotFound(_0x22e839,null))[_0x1635('0x15')](removeEntity(_0x22e839,null))['catch'](handleError(_0x22e839,null));};exports[_0x1635('0x1d')]=function(_0x181626,_0xdf1b9a){return db[_0x1635('0x1c')]['describe']()[_0x1635('0x15')](function(_0x422663){delete _0x422663[_0x1635('0x7f')];for(var _0x28b935=0x0;_0x28b9350x0){return new Promise(function(_0x499c39,_0x510cb5){var _0x2456e5=[];for(var _0x4945d0=0x0;_0x4945d0<_0x147748[_0x1635('0x1e')];_0x4945d0++){_0x2456e5[_0x1635('0x22')](insertAdditionalPhones(_0x147748[_0x4945d0]['contact'],_0x147748[_0x4945d0][_0x1635('0xac')]));}Promise[_0x1635('0xb3')](_0x2456e5)[_0x1635('0x15')](function(){_0x499c39(0x1);});})['then'](function(){return{'success':_0xcde54a,'failure':_0x4d4dc2,'duplicates':_0x50182d};});}else{return{'success':_0xcde54a,'failure':_0x4d4dc2,'duplicates':_0x50182d};}}})['then'](respondWithResult(_0x2e7832,0xc9))[_0x1635('0x87')](handleError(_0x2e7832,null));};exports['show']=function(_0x1ed8dd,_0x3642a9){var _0x179f68;return db[_0x1635('0x1c')][_0x1635('0x1d')]()['then'](function(_0x6d0e58){return db[_0x1635('0x1c')][_0x1635('0x42')]({'where':{'id':_0x1ed8dd[_0x1635('0x7e')]['id']},'include':[{'model':db[_0x1635('0xb4')],'as':_0x1635('0x7c'),'attributes':['id',_0x1635('0x19'),_0x1635('0x35')],'required':_0x1ed8dd[_0x1635('0x28')]['tag']?!![]:![]},{'model':db[_0x1635('0x9e')],'as':_0x1635('0xb5'),'where':{'CmContactId':_0x1ed8dd[_0x1635('0x7e')]['id']},'required':![],'include':[{'model':db[_0x1635('0xb6')],'as':_0x1635('0xb7')}]}],'order':[db[_0x1635('0x6f')]['literal']('Phones.OrderBy')],'attributes':_[_0x1635('0x1f')](_0x6d0e58)});})[_0x1635('0x15')](function(_0x52d651){if(!_[_0x1635('0xa9')](_0x52d651)){_0x179f68=_0x52d651['get']({'plain':!![]});var _0xb7ea06={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x52d651&&_0x52d651[_0x1635('0x51')]){if(_0x52d651[_0x1635('0x51')]){_0xb7ea06[_0x1635('0x30')][_0x1635('0xb8')][_0x1635('0x22')]({'ListId':{'$ne':_0x52d651[_0x1635('0x51')]}});}}return db[_0x1635('0xb9')][_0x1635('0x83')](_0xb7ea06);}})[_0x1635('0x15')](function(_0x3840fa){if(!_['isNil'](_0x3840fa)){return _['omit'](_0x179f68,_['map'](_0x3840fa,function(_0x360d83){return util['format'](_0x1635('0xba'),_0x360d83['id']);}));}})[_0x1635('0x15')](handleEntityNotFound(_0x3642a9,null))[_0x1635('0x15')](respondWithResult(_0x3642a9,null))[_0x1635('0x87')](handleError(_0x3642a9,null));};exports[_0x1635('0x13')]=function(_0x3d4c6c,_0x2b42b6){var _0x5c227f;if(_0x3d4c6c[_0x1635('0x88')]['id']){delete _0x3d4c6c['body']['id'];}if(!_[_0x1635('0xa9')](_0x3d4c6c[_0x1635('0x88')]['dialTimezone'])){var _0x2762cc=_0x3d4c6c[_0x1635('0x88')]['dialTimezone'];if(!_[_0x1635('0xa9')](shared[_0x1635('0xaa')][_0x2762cc]))_0x3d4c6c['body']['utcOffset']=shared[_0x1635('0xaa')][_0x2762cc][_0x1635('0xab')];}return db[_0x1635('0x1c')][_0x1635('0x42')]({'where':{'id':_0x3d4c6c[_0x1635('0x7e')]['id']}})[_0x1635('0x15')](handleEntityNotFound(_0x2b42b6,null))[_0x1635('0x15')](saveUpdates(_0x3d4c6c[_0x1635('0x88')],null))['then'](function(_0x55d8fe){_0x5c227f=_0x55d8fe;var _0x2d80ff={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x55d8fe&&_0x55d8fe[_0x1635('0x51')]){if(_0x55d8fe['ListId']){_0x2d80ff[_0x1635('0x30')]['$and'][_0x1635('0x22')]({'ListId':{'$ne':_0x55d8fe['ListId']}});}}return db[_0x1635('0xb9')][_0x1635('0x83')](_0x2d80ff);})['then'](function(_0x11e5d3){if(_0x11e5d3){return _[_0x1635('0xbb')](_[_0x1635('0xbc')](_0x3d4c6c[_0x1635('0x88')],function(_0x14422e,_0x1b8ff9){return _[_0x1635('0x20')](_0x1b8ff9,_0x1635('0x21'));}),_[_0x1635('0x4e')](_0x11e5d3,function(_0x175544){return util[_0x1635('0xbd')](_0x1635('0xba'),_0x175544['id']);}));}})[_0x1635('0x15')](function(_0x14b5e4){if(_0x14b5e4&&!_[_0x1635('0x50')](_0x14b5e4)){var _0x62dfc6=squel[_0x1635('0x13')]()[_0x1635('0xbe')](_0x1635('0xbf'))['setFields'](_0x14b5e4)[_0x1635('0x30')](_0x1635('0xc0'),_0x3d4c6c[_0x1635('0x7e')]['id'])[_0x1635('0xc1')]();return db[_0x1635('0x6f')]['query'](_0x62dfc6[_0x1635('0x4d')],{'replacements':_0x62dfc6[_0x1635('0x86')]});}})[_0x1635('0x15')](function(){if(_0x3d4c6c[_0x1635('0x88')][_0x1635('0xc2')]&&_0x5c227f){return db[_0x1635('0x8f')][_0x1635('0x13')]({'phone':_0x3d4c6c[_0x1635('0x88')][_0x1635('0xc2')],'OrderBy':0x0},{'where':{'ContactId':_0x5c227f['id']}});}})['then'](function(){return _0x5c227f;})[_0x1635('0x15')](respondWithResult(_0x2b42b6,null))[_0x1635('0x87')](handleError(_0x2b42b6,null));};exports[_0x1635('0xc3')]=function(_0x168e65,_0x221f62){var _0x4ce0b2={};var _0x41eab9={};var _0x254cb3;var _0x335430;return db[_0x1635('0x1c')][_0x1635('0x23')]({'where':{'id':_0x168e65[_0x1635('0x7e')]['id']}})[_0x1635('0x15')](handleEntityNotFound(_0x221f62,null))[_0x1635('0x15')](function(_0x89c22c){if(_0x89c22c){_0x254cb3=_0x89c22c;_0x41eab9[_0x1635('0x27')]=_[_0x1635('0x1f')](db['Tag'][_0x1635('0xc4')]);_0x41eab9['query']=_[_0x1635('0x1f')](_0x168e65['query']);_0x41eab9['filters']=_['intersection'](_0x41eab9['model'],_0x41eab9[_0x1635('0x28')]);_0x4ce0b2[_0x1635('0x2a')]=_[_0x1635('0x29')](_0x41eab9['model'],qs[_0x1635('0x2b')](_0x168e65['query'][_0x1635('0x2b')]));_0x4ce0b2[_0x1635('0x2a')]=_0x4ce0b2[_0x1635('0x2a')][_0x1635('0x1e')]?_0x4ce0b2[_0x1635('0x2a')]:_0x41eab9['model'];_0x4ce0b2[_0x1635('0x2e')]=qs['sort'](_0x168e65[_0x1635('0x28')][_0x1635('0x2f')]);_0x4ce0b2[_0x1635('0x30')]=qs[_0x1635('0x31')](_[_0x1635('0x32')](_0x168e65[_0x1635('0x28')],_0x41eab9[_0x1635('0x31')]));if(_0x168e65[_0x1635('0x28')][_0x1635('0x57')]){_0x4ce0b2[_0x1635('0x30')]=_[_0x1635('0x71')](_0x4ce0b2[_0x1635('0x30')],{'$or':_[_0x1635('0x4e')](_0x4ce0b2['attributes'],function(_0x4c11cb){var _0x5fba74={};_0x5fba74[_0x4c11cb]={'$like':'%'+_0x168e65[_0x1635('0x28')][_0x1635('0x57')]+'%'};return _0x5fba74;})});}_0x4ce0b2=_[_0x1635('0x71')]({},_0x4ce0b2,_0x168e65[_0x1635('0xc5')]);return _0x254cb3[_0x1635('0xc3')](_0x4ce0b2);}})[_0x1635('0x15')](function(_0x464adb){if(_0x464adb){_0x335430=_0x464adb['length'];if(!_0x168e65[_0x1635('0x28')][_0x1635('0x2c')](_0x1635('0x2d'))){_0x4ce0b2['limit']=qs[_0x1635('0xd')](_0x168e65[_0x1635('0x28')][_0x1635('0xd')]);_0x4ce0b2['offset']=qs[_0x1635('0xb')](_0x168e65[_0x1635('0x28')][_0x1635('0xb')]);}return _0x254cb3[_0x1635('0xc3')](_0x4ce0b2);}})[_0x1635('0x15')](function(_0x2575a8){if(_0x2575a8){return _0x2575a8?{'count':_0x335430,'rows':_0x2575a8}:null;}})['then'](respondWithResult(_0x221f62,null))[_0x1635('0x87')](handleError(_0x221f62,null));};exports[_0x1635('0xc6')]=function(_0x591618,_0x1f8986){if(_0x591618['body']['id']){delete _0x591618[_0x1635('0x88')]['id'];}return db['CmContact'][_0x1635('0x23')]({'where':{'id':_0x591618[_0x1635('0x7e')]['id']}})[_0x1635('0x15')](handleEntityNotFound(_0x1f8986,null))[_0x1635('0x15')](function(_0x3e2ab7){if(_0x3e2ab7){return _0x3e2ab7['setTags'](_0x591618[_0x1635('0x88')][_0x1635('0xc7')]||[]);}return null;})[_0x1635('0x15')](respondWithResult(_0x1f8986,null))['catch'](handleError(_0x1f8986,null));};exports[_0x1635('0xc8')]=function(_0x58680f,_0xf1f986){var _0x30376f=[];_0x30376f['push'](addAdditionalPhones(_0x58680f[_0x1635('0x88')]));Promise['all'](_0x30376f)[_0x1635('0x15')](function(){_0x30376f=[];_0x30376f[_0x1635('0x22')](deleteCmHopperPhones(_0x58680f[_0x1635('0x88')]['id']));_0x30376f[_0x1635('0x22')](addCmHopperPhones(_0x58680f[_0x1635('0x88')]['id']));Promise[_0x1635('0xb3')](_0x30376f)[_0x1635('0x15')](function(){return[0x1];})[_0x1635('0x15')](respondWithResult(_0xf1f986,null));});};function addAdditionalPhones(_0x4214be){var _0x3299a8;return new Promise(function(_0x18484d,_0x4a5756){return db[_0x1635('0x9e')][_0x1635('0x14')]({'where':{'CmContactId':_0x4214be['id']}})[_0x1635('0x15')](function(){db[_0x1635('0xb6')]['findAll']({'raw':!![],'attributes':['id','OrderBy']})[_0x1635('0x15')](function(_0x3df123){var _0x1bd6de=[];for(var _0x2be050=0x0;_0x2be050<_0x4214be['items']['length'];_0x2be050++){var _0x11e1ce=_0x4214be['item_types']?_[_0x1635('0xa9')](_0x4214be[_0x1635('0xc9')][_0x2be050])?'':_0x4214be['item_types'][_0x2be050]:_0x4214be['items'][_0x2be050]['ItemTypeId']?_0x4214be['items'][_0x2be050][_0x1635('0xca')]:'';var _0xdad188=_[_0x1635('0xa9')](_0x4214be['items'][_0x2be050][_0x1635('0xcb')])?'':_0x4214be[_0x1635('0xcc')][_0x2be050]['description'];var _0x1c5262=_0x11e1ce+':'+_0x4214be[_0x1635('0xcc')][_0x2be050][_0x1635('0xc2')]+'§'+_0xdad188;if(_[_0x1635('0xa9')](_0x3299a8))_0x3299a8=_0x1c5262;else _0x3299a8+=';'+_0x1c5262;var _0x14012f=null;if(_0x4214be[_0x1635('0xc9')]){if(!_[_0x1635('0xa9')](_0x4214be[_0x1635('0xc9')][_0x2be050])){var _0x3ae3cc=_[_0x1635('0x42')](_0x3df123,function(_0x14482e){return _0x14482e['id']===_0x4214be[_0x1635('0xc9')][_0x2be050];});if(!_[_0x1635('0xa9')](_0x3ae3cc)){_0x14012f=_0x3ae3cc[_0x1635('0xcd')];}}}else{if(!_[_0x1635('0xa9')](_0x4214be[_0x1635('0xcc')][_0x2be050])){var _0x3ae3cc=_['find'](_0x3df123,function(_0x4df6f9){return _0x4df6f9['id']===_0x4214be[_0x1635('0xcc')][_0x2be050][_0x1635('0xca')];});if(!_['isNil'](_0x3ae3cc)){_0x14012f=_0x2be050;}}}if(_['isNil'](_0x14012f)){_0x14012f=0x64;}_0x1bd6de[_0x1635('0x22')](addAdditionalPhone(_0x4214be['id'],_0x4214be[_0x1635('0xcc')][_0x2be050][_0x1635('0xc2')],_0x4214be['item_types']?_[_0x1635('0xa9')](_0x4214be[_0x1635('0xc9')][_0x2be050])?null:_0x4214be['item_types'][_0x2be050]:_0x4214be[_0x1635('0xcc')][_0x2be050][_0x1635('0xca')]?_0x4214be['items'][_0x2be050]['ItemTypeId']:null,_0x14012f,_0xdad188));}Promise[_0x1635('0xb3')](_0x1bd6de)['then'](function(){db[_0x1635('0x1c')][_0x1635('0x13')]({'AdditionalPhones':_0x3299a8},{'where':{'id':_0x4214be['id']}})['then'](function(){_0x18484d(0x1);});});});});});}function addAdditionalPhone(_0x45b4fa,_0x253119,_0x2e03d7,_0x3f6b1d,_0x40459e){return db[_0x1635('0x9e')]['find']({'where':{'CmContactId':_0x45b4fa,'item':_0x253119}})[_0x1635('0x15')](function(_0x3469db){if(_0x3469db)logger[_0x1635('0x8d')](_0x1635('0xce'),_0x3469db);else{db[_0x1635('0x9e')][_0x1635('0x92')]({'CmContactId':_0x45b4fa,'item':_0x253119,'ItemTypeId':_0x2e03d7,'OrderBy':_0x3f6b1d,'ItemClass':_0x1635('0xcf'),'description':_0x40459e});}});}function deletePhones(_0x2acaa2){return db[_0x1635('0x9e')][_0x1635('0x14')]({'where':{'CmContactId':_0x2acaa2}});}function deleteCmHopperPhones(_0x4ed702){return new Promise(function(_0x2e706c,_0x3f1581){return db[_0x1635('0x8f')][_0x1635('0x83')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4ed702}})[_0x1635('0x15')](function(_0x4ca3d7){db[_0x1635('0xd0')][_0x1635('0x14')]({'where':{'CmHopperId':{'$in':_[_0x1635('0x4e')](_0x4ca3d7,'id')}}});})[_0x1635('0x15')](function(){_0x2e706c(0x1);});});}function addCmHopperPhones(_0x1fa813){return new Promise(function(_0xc7d289,_0x1e6a9e){return db['CmHopper'][_0x1635('0x83')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1fa813}})[_0x1635('0x15')](function(_0x39113a){var _0x561c0a=[];_['map'](_0x39113a,function(_0x16e8d5){_0x561c0a[_0x1635('0x22')](createCmHopperPhone(_0x1fa813,_0x16e8d5['id']));});Promise[_0x1635('0xb3')](_0x561c0a)[_0x1635('0x15')](function(){_0xc7d289(0x1);});});});}function createCmHopperPhone(_0x48fe25,_0xe06031){return new Promise(function(_0x591e64,_0x1b71e4){db['CmContactHasItem'][_0x1635('0x83')]({'raw':!![],'attributes':[_0x1635('0xd1'),_0x1635('0xcd')],'where':{'CmContactId':_0x48fe25,'ItemClass':_0x1635('0xcf')},'include':[{'model':db['ContactItemType'],'attributes':[_0x1635('0xcd')],'as':_0x1635('0xb7')}],'order':[_0x1635('0xcd'),db[_0x1635('0x6f')]['literal'](_0x1635('0xd2'))]})[_0x1635('0x15')](function(_0x2306bc){var _0x277db9=0x1;var _0x5354fd=_['map'](_0x2306bc,function(_0x3286b7){_0x3286b7[_0x1635('0xd3')]=_0xe06031;_0x3286b7['phone']=_0x3286b7[_0x1635('0xd1')];_0x3286b7['OrderBy']=_0x277db9;delete _0x3286b7['ItemType.OrderBy'];_0x277db9=_0x277db9+0x1;return _0x3286b7;});return db[_0x1635('0xd0')]['bulkCreate'](_0x5354fd,{});})['then'](function(){_0x591e64(0x1);});});}function insertAdditionalPhones(_0x33afe5,_0x39fa89){return new Promise(function(_0x470767,_0x36175c){var _0x55b5fe=[];for(var _0x436218=0x0;_0x436218<_0x39fa89['length'];_0x436218++){var _0x253b1f=_0x39fa89[_0x436218];_0x55b5fe[_0x1635('0x22')](parseContactItemType(_0x253b1f));}Promise[_0x1635('0xb3')](_0x55b5fe)[_0x1635('0x15')](function(){var _0x41a3c1={'id':_0x33afe5['id'],'items':_0x39fa89};return addAdditionalPhones(_0x41a3c1)['then'](function(_0x2c5656){return addCmHopperPhones(_0x33afe5['id']);});})['then'](function(){_0x470767(_0x33afe5);});});}function parseContactItemType(_0xccefb1){return new Promise(function(_0x2983f1,_0x20656c){if(_0xccefb1[_0x1635('0x2c')](_0x1635('0xca'))){_0x2983f1(_0xccefb1);}else{return db[_0x1635('0xb6')][_0x1635('0x42')]({'where':{'name':_0xccefb1['ItemType']}})['then'](function(_0x21bb19){if(_[_0x1635('0xa9')](_0x21bb19))_0xccefb1['ItemTypeId']=null;else _0xccefb1[_0x1635('0xca')]=_0x21bb19['id'];_0x2983f1(_0xccefb1);});}});}exports['getAdditionalPhones']=function(_0x2311f6,_0x5764be){return db['CmContactHasItem'][_0x1635('0x83')]({'raw':!![],'where':{'CmContactId':_0x2311f6[_0x1635('0x7e')]['id'],'ItemClass':_0x1635('0xcf')},'include':[{'model':db[_0x1635('0xb6')],'as':_0x1635('0xb7')}],'order':[[_0x1635('0xcd')],[db[_0x1635('0x6f')][_0x1635('0xd4')]('`ItemType`.OrderBy')]]})[_0x1635('0x15')](function(_0x2f4e1c){return _0x2f4e1c;})['then'](respondWithResult(_0x5764be,null))[_0x1635('0x87')](handleError(_0x5764be,null));};exports[_0x1635('0xd5')]=function(_0x32463d,_0x4c9037){return db[_0x1635('0x9e')][_0x1635('0x83')]({'raw':!![],'where':{'CmContactId':_0x32463d['body'][_0x1635('0xd6')]}})[_0x1635('0x15')](function(_0x1d6350){var _0x468738=_['map'](_0x1d6350,function(_0x135398){_0x135398[_0x1635('0xd7')]=_0x32463d[_0x1635('0x88')][_0x1635('0xd8')];return _0x135398;});return db[_0x1635('0x9e')][_0x1635('0xad')](_0x468738,{});})[_0x1635('0x15')](function(_0x18c9bf){return addCmHopperPhones(_0x32463d[_0x1635('0x88')]['toContactId']);})[_0x1635('0x15')](function(_0x415ea2){return['ok'];})[_0x1635('0x15')](respondWithResult(_0x4c9037,null))[_0x1635('0x87')](handleError(_0x4c9037,null));};exports[_0x1635('0xd9')]=function(_0x3d2bfe,_0x412fc4){var _0x3b6501=[];_0x3b6501[_0x1635('0x22')](createCmHopperPhone(_0x3d2bfe[_0x1635('0x88')]['id'],_0x3d2bfe['body'][_0x1635('0xda')]));Promise[_0x1635('0xb3')](_0x3b6501)[_0x1635('0x15')](function(){return[0x1];})[_0x1635('0x15')](respondWithResult(_0x412fc4,null));};exports[_0x1635('0xdb')]=function(_0x2551c4,_0x241d48){var _0x66251d={'raw':![],'where':{}};var _0x195f81={};var _0x19cc8c={'count':0x0,'rows':[]};return db[_0x1635('0x1c')]['findOne']({'where':{'id':_0x2551c4['params']['id']}})['then'](handleEntityNotFound(_0x241d48,null))[_0x1635('0x15')](function(_0x13778a){if(_0x13778a){_0x195f81[_0x1635('0x27')]=_['keys'](db['CmHopper'][_0x1635('0xc4')]);_0x195f81[_0x1635('0x28')]=_[_0x1635('0x1f')](_0x2551c4[_0x1635('0x28')]);_0x195f81[_0x1635('0x31')]=_[_0x1635('0x29')](_0x195f81[_0x1635('0x27')],_0x195f81[_0x1635('0x28')]);_0x66251d[_0x1635('0x2a')]=_[_0x1635('0x29')](_0x195f81[_0x1635('0x27')],qs[_0x1635('0x2b')](_0x2551c4[_0x1635('0x28')][_0x1635('0x2b')]));_0x66251d['attributes']=_0x66251d[_0x1635('0x2a')]['length']?_0x66251d[_0x1635('0x2a')]:_0x195f81[_0x1635('0x27')];if(!_0x2551c4['query']['hasOwnProperty'](_0x1635('0x2d'))){_0x66251d[_0x1635('0xd')]=qs[_0x1635('0xd')](_0x2551c4[_0x1635('0x28')][_0x1635('0xd')]);_0x66251d[_0x1635('0xb')]=qs['offset'](_0x2551c4[_0x1635('0x28')][_0x1635('0xb')]);}_0x66251d[_0x1635('0x2e')]=qs['sort'](_0x2551c4[_0x1635('0x28')][_0x1635('0x2f')]);_0x66251d[_0x1635('0x30')]=qs[_0x1635('0x31')](_['pick'](_0x2551c4[_0x1635('0x28')],_0x195f81[_0x1635('0x31')]));_0x66251d[_0x1635('0x30')][_0x1635('0xdc')]=_0x13778a['id'];if(_0x2551c4[_0x1635('0x28')][_0x1635('0x57')]){_0x66251d[_0x1635('0x30')]=_[_0x1635('0x71')](_0x66251d[_0x1635('0x30')],{'$or':_[_0x1635('0x4e')](_0x66251d[_0x1635('0x2a')],function(_0x5af7c9){var _0xafb0f8={};_0xafb0f8[_0x5af7c9]={'$like':'%'+_0x2551c4[_0x1635('0x28')][_0x1635('0x57')]+'%'};return _0xafb0f8;})});}_0x66251d=_[_0x1635('0x71')]({},_0x66251d,_0x2551c4[_0x1635('0xc5')]);return db[_0x1635('0x8f')]['count']({'where':_0x66251d['where']})['then'](function(_0x347f3c){_0x19cc8c[_0x1635('0xe')]=_0x347f3c;if(_0x2551c4[_0x1635('0x28')][_0x1635('0xdd')]){_0x66251d['include']=[{'all':!![]}];}return db[_0x1635('0x8f')][_0x1635('0x83')](_0x66251d);})[_0x1635('0x15')](function(_0x1eb836){_0x19cc8c[_0x1635('0x7d')]=_0x1eb836;return _0x19cc8c;});}})[_0x1635('0x15')](respondWithFilteredResult(_0x241d48,_0x66251d))[_0x1635('0x87')](handleError(_0x241d48,null));};exports['getHopperHistories']=function(_0x550d7f,_0x4aa4a9){var _0x1b7058={'raw':!![],'where':{}};var _0x5b226b={};var _0x53f36c={'count':0x0,'rows':[]};return db[_0x1635('0x1c')][_0x1635('0x23')]({'where':{'id':_0x550d7f[_0x1635('0x7e')]['id']}})[_0x1635('0x15')](handleEntityNotFound(_0x4aa4a9,null))['then'](function(_0x1318ef){if(_0x1318ef){_0x5b226b[_0x1635('0x27')]=_['keys'](db[_0x1635('0xa0')][_0x1635('0xc4')]);_0x5b226b[_0x1635('0x28')]=_[_0x1635('0x1f')](_0x550d7f[_0x1635('0x28')]);_0x5b226b['filters']=_[_0x1635('0x29')](_0x5b226b['model'],_0x5b226b[_0x1635('0x28')]);_0x1b7058[_0x1635('0x2a')]=_[_0x1635('0x29')](_0x5b226b['model'],qs[_0x1635('0x2b')](_0x550d7f['query'][_0x1635('0x2b')]));_0x1b7058[_0x1635('0x2a')]=_0x1b7058[_0x1635('0x2a')][_0x1635('0x1e')]?_0x1b7058[_0x1635('0x2a')]:_0x5b226b['model'];if(!_0x550d7f[_0x1635('0x28')][_0x1635('0x2c')](_0x1635('0x2d'))){_0x1b7058[_0x1635('0xd')]=qs[_0x1635('0xd')](_0x550d7f[_0x1635('0x28')]['limit']);_0x1b7058[_0x1635('0xb')]=qs['offset'](_0x550d7f[_0x1635('0x28')][_0x1635('0xb')]);}_0x1b7058[_0x1635('0x2e')]=qs[_0x1635('0x2f')](_0x550d7f[_0x1635('0x28')]['sort']);_0x1b7058[_0x1635('0x30')]=qs[_0x1635('0x31')](_[_0x1635('0x32')](_0x550d7f['query'],_0x5b226b['filters']));_0x1b7058['where'][_0x1635('0xdc')]=_0x1318ef['id'];if(_0x550d7f['query']['filter']){_0x1b7058[_0x1635('0x30')]=_[_0x1635('0x71')](_0x1b7058['where'],{'$or':_[_0x1635('0x4e')](_0x1b7058['attributes'],function(_0x578161){var _0x380f3a={};_0x380f3a[_0x578161]={'$like':'%'+_0x550d7f[_0x1635('0x28')][_0x1635('0x57')]+'%'};return _0x380f3a;})});}_0x1b7058=_[_0x1635('0x71')]({},_0x1b7058,_0x550d7f[_0x1635('0xc5')]);return db[_0x1635('0xa0')][_0x1635('0xe')]({'where':_0x1b7058['where']})[_0x1635('0x15')](function(_0x3e23cb){_0x53f36c[_0x1635('0xe')]=_0x3e23cb;if(_0x550d7f[_0x1635('0x28')]['includeAll']){_0x1b7058['include']=[{'all':!![]}];}return db[_0x1635('0xa0')][_0x1635('0x83')](_0x1b7058);})[_0x1635('0x15')](function(_0x2c82a4){_0x53f36c[_0x1635('0x7d')]=_0x2c82a4;return _0x53f36c;});}})[_0x1635('0x15')](respondWithFilteredResult(_0x4aa4a9,_0x1b7058))[_0x1635('0x87')](handleError(_0x4aa4a9,null));};exports[_0x1635('0xde')]=function(_0x4a7530,_0x40fbc4){var _0x9c96e3={'raw':!![],'where':{}};var _0x1c0f50={};var _0x27f6e5={'count':0x0,'rows':[]};return db[_0x1635('0x1c')][_0x1635('0x23')]({'where':{'id':_0x4a7530[_0x1635('0x7e')]['id']}})[_0x1635('0x15')](handleEntityNotFound(_0x40fbc4,null))[_0x1635('0x15')](function(_0x5a7448){if(_0x5a7448){_0x1c0f50['model']=_[_0x1635('0x1f')](db[_0x1635('0x9f')]['rawAttributes']);_0x1c0f50[_0x1635('0x28')]=_[_0x1635('0x1f')](_0x4a7530[_0x1635('0x28')]);_0x1c0f50[_0x1635('0x31')]=_[_0x1635('0x29')](_0x1c0f50[_0x1635('0x27')],_0x1c0f50[_0x1635('0x28')]);_0x9c96e3[_0x1635('0x2a')]=_['intersection'](_0x1c0f50[_0x1635('0x27')],qs[_0x1635('0x2b')](_0x4a7530[_0x1635('0x28')][_0x1635('0x2b')]));_0x9c96e3[_0x1635('0x2a')]=_0x9c96e3[_0x1635('0x2a')][_0x1635('0x1e')]?_0x9c96e3[_0x1635('0x2a')]:_0x1c0f50[_0x1635('0x27')];if(!_0x4a7530[_0x1635('0x28')][_0x1635('0x2c')]('nolimit')){_0x9c96e3[_0x1635('0xd')]=qs[_0x1635('0xd')](_0x4a7530['query'][_0x1635('0xd')]);_0x9c96e3[_0x1635('0xb')]=qs[_0x1635('0xb')](_0x4a7530[_0x1635('0x28')][_0x1635('0xb')]);}_0x9c96e3['order']=qs[_0x1635('0x2f')](_0x4a7530[_0x1635('0x28')][_0x1635('0x2f')]);_0x9c96e3[_0x1635('0x30')]=qs['filters'](_[_0x1635('0x32')](_0x4a7530[_0x1635('0x28')],_0x1c0f50[_0x1635('0x31')]));_0x9c96e3[_0x1635('0x30')][_0x1635('0xdc')]=_0x5a7448['id'];if(_0x4a7530[_0x1635('0x28')]['filter']){_0x9c96e3['where']=_[_0x1635('0x71')](_0x9c96e3['where'],{'$or':_[_0x1635('0x4e')](_0x9c96e3[_0x1635('0x2a')],function(_0x32b6ee){var _0xf251ba={};_0xf251ba[_0x32b6ee]={'$like':'%'+_0x4a7530[_0x1635('0x28')][_0x1635('0x57')]+'%'};return _0xf251ba;})});}_0x9c96e3=_[_0x1635('0x71')]({},_0x9c96e3,_0x4a7530[_0x1635('0xc5')]);return db[_0x1635('0x9f')][_0x1635('0xe')]({'where':_0x9c96e3['where']})[_0x1635('0x15')](function(_0x2088d4){_0x27f6e5[_0x1635('0xe')]=_0x2088d4;if(_0x4a7530[_0x1635('0x28')]['includeAll']){_0x9c96e3[_0x1635('0xdf')]=[{'all':!![]}];}return db[_0x1635('0x9f')]['findAll'](_0x9c96e3);})[_0x1635('0x15')](function(_0x30433c){_0x27f6e5['rows']=_0x30433c;return _0x27f6e5;});}})[_0x1635('0x15')](respondWithFilteredResult(_0x40fbc4,_0x9c96e3))[_0x1635('0x87')](handleError(_0x40fbc4,null));};exports[_0x1635('0xe0')]=function(_0x4112e7,_0xe00fcf){var _0x262088={'raw':!![],'where':{}};var _0xd48424={};var _0x2e0646={'count':0x0,'rows':[]};return db['CmContact'][_0x1635('0x23')]({'where':{'id':_0x4112e7[_0x1635('0x7e')]['id']}})[_0x1635('0x15')](handleEntityNotFound(_0xe00fcf,null))['then'](function(_0xfb2e9a){if(_0xfb2e9a){_0xd48424[_0x1635('0x27')]=_[_0x1635('0x1f')](db[_0x1635('0xa6')][_0x1635('0xc4')]);_0xd48424[_0x1635('0x28')]=_[_0x1635('0x1f')](_0x4112e7[_0x1635('0x28')]);_0xd48424['filters']=_[_0x1635('0x29')](_0xd48424[_0x1635('0x27')],_0xd48424[_0x1635('0x28')]);_0x262088[_0x1635('0x2a')]=_['intersection'](_0xd48424[_0x1635('0x27')],qs[_0x1635('0x2b')](_0x4112e7[_0x1635('0x28')][_0x1635('0x2b')]));_0x262088[_0x1635('0x2a')]=_0x262088[_0x1635('0x2a')][_0x1635('0x1e')]?_0x262088[_0x1635('0x2a')]:_0xd48424[_0x1635('0x27')];if(!_0x4112e7[_0x1635('0x28')]['hasOwnProperty'](_0x1635('0x2d'))){_0x262088[_0x1635('0xd')]=qs[_0x1635('0xd')](_0x4112e7[_0x1635('0x28')][_0x1635('0xd')]);_0x262088[_0x1635('0xb')]=qs[_0x1635('0xb')](_0x4112e7['query'][_0x1635('0xb')]);}_0x262088['order']=qs[_0x1635('0x2f')](_0x4112e7[_0x1635('0x28')][_0x1635('0x2f')]);_0x262088[_0x1635('0x30')]=qs[_0x1635('0x31')](_['pick'](_0x4112e7[_0x1635('0x28')],_0xd48424[_0x1635('0x31')]));_0x262088[_0x1635('0x30')][_0x1635('0xdc')]=_0xfb2e9a['id'];if(_0x4112e7[_0x1635('0x28')][_0x1635('0x57')]){_0x262088[_0x1635('0x30')]=_[_0x1635('0x71')](_0x262088[_0x1635('0x30')],{'$or':_[_0x1635('0x4e')](_0x262088[_0x1635('0x2a')],function(_0xeabf73){var _0x200355={};_0x200355[_0xeabf73]={'$like':'%'+_0x4112e7['query']['filter']+'%'};return _0x200355;})});}_0x262088=_['merge']({},_0x262088,_0x4112e7[_0x1635('0xc5')]);return db[_0x1635('0xa6')][_0x1635('0xe')]({'where':_0x262088['where']})[_0x1635('0x15')](function(_0x2061d5){_0x2e0646[_0x1635('0xe')]=_0x2061d5;if(_0x4112e7['query'][_0x1635('0xdd')]){_0x262088[_0x1635('0xdf')]=[{'all':!![]}];}return db[_0x1635('0xa6')][_0x1635('0x83')](_0x262088);})[_0x1635('0x15')](function(_0x1a842d){_0x2e0646[_0x1635('0x7d')]=_0x1a842d;return _0x2e0646;});}})['then'](respondWithFilteredResult(_0xe00fcf,_0x262088))[_0x1635('0x87')](handleError(_0xe00fcf,null));};exports[_0x1635('0xe1')]=function(_0x2a0dba,_0x1420cb){try{if(!_0x2a0dba[_0x1635('0x88')][_0x1635('0x51')]){throw new Error(_0x1635('0xe2'));}if(!_0x2a0dba['body'][_0x1635('0xe3')]){throw new Error(_0x1635('0xe4'));}if(!_0x2a0dba[_0x1635('0x88')][_0x1635('0xe5')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x2a0dba['body'][_0x1635('0xe6')]){throw new Error(_0x1635('0xe7'));}var _0x2c296d=_0x2a0dba['body'][_0x1635('0xe3')][_0x1635('0x44')](',');var _0x3b9ca0=_0x2a0dba[_0x1635('0x88')]['binding_values'][_0x1635('0x44')](',');if(!_0x2c296d['length']||!_0x3b9ca0[_0x1635('0x1e')]||_0x2c296d[_0x1635('0x1e')]!==_0x3b9ca0['length']){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x2a0dba[_0x1635('0x88')][_0x1635('0x2b')]=_[_0x1635('0xe8')](_0x2c296d,_0x3b9ca0);if(!_0x2a0dba['body']['fields'][_0x1635('0xc2')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x2a0dba[_0x1635('0x88')][_0x1635('0x2b')][_0x1635('0xe9')]){throw new Error(_0x1635('0xea'));}var _0x3c816b=path[_0x1635('0x8c')](config[_0x1635('0xeb')],_0x1635('0xec'),_0x2a0dba[_0x1635('0xed')]['filename']);fs[_0x1635('0xee')](_0x3c816b,parseInt(_0x1635('0xef'),0x8));var _0x4e2daf=require('child_process')['fork'](path[_0x1635('0x8c')](__dirname,_0x1635('0xf0')),[_0x3c816b,_0x2a0dba[_0x1635('0x88')][_0x1635('0xe3')],_0x2a0dba['body']['binding_values'],_0x2a0dba['body']['ListId'],_0x2a0dba[_0x1635('0x88')][_0x1635('0xf1')],_0x2a0dba[_0x1635('0x88')][_0x1635('0xaf')],_0x2a0dba['body'][_0x1635('0xe6')]]);return _0x1420cb['status'](0xc8)['json']({'message':_0x1635('0xf2'),'pid':_0x4e2daf[_0x1635('0xf3')]});}catch(_0x33c9d3){return _0x1420cb['status'](0x1f4)[_0x1635('0x1a')](_0x33c9d3);}};exports[_0x1635('0xf4')]=function(_0x556337,_0x1f25ef){var _0x32602e=fs[_0x1635('0xf5')](_0x556337[_0x1635('0xed')]['path']);Papa[_0x1635('0xf6')](_0x32602e,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x1d00fa){return _0x1f25ef[_0x1635('0xf')](0xc8)['json']({'file':_0x556337['file'],'fields':_0x1d00fa[_0x1635('0xf7')][_0x1635('0x2b')]});}});};exports[_0x1635('0xf8')]=function(_0x2052ec,_0x1eed49){return db[_0x1635('0x48')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x1635('0x6e')}})['then'](function(_0x1abc74){var _0x3ff617=![];if(!_0x2052ec['body'][_0x1635('0x51')]){throw new Error(_0x1635('0xe2'));}if(!_0x2052ec[_0x1635('0x88')][_0x1635('0xf9')][_0x1635('0xc2')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x2052ec[_0x1635('0x88')]['binding']['firstName']){throw new Error(_0x1635('0xea'));}if(!_0x2052ec[_0x1635('0x88')][_0x1635('0xe6')]){throw new Error(_0x1635('0xe7'));}var _0x512d59=require('child_process')[_0x1635('0xfa')](path['join'](__dirname,'../../components/import/cm/csv2'),[_0x2052ec[_0x1635('0x7e')]['id'],JSON[_0x1635('0xfb')](_0x2052ec['body']),JSON[_0x1635('0xfb')](_0x1abc74)]);_0x512d59['on'](_0x1635('0xfc'),function(){_0x3ff617=!![];return _0x1eed49[_0x1635('0xf')](0xc8)[_0x1635('0x12')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x512d59['pid']});});_0x512d59['on'](_0x1635('0xfd'),function(_0x4af914){if(_0x4af914&&!_0x3ff617){return _0x1eed49[_0x1635('0xf')](0x1f4)['json']({'message':'error\x20child\x20process','pid':_0x512d59['pid']});}});})[_0x1635('0x87')](handleError(_0x1eed49,null));};exports['importUpdates']=function(_0x223a43,_0x2d991d,_0x86791b){return db['User'][_0x1635('0x83')]({'raw':!![],'attributes':['id'],'where':{'role':_0x1635('0x6e')}})[_0x1635('0x15')](function(_0x3d2732){var _0x17e0b8=![];if(!_0x223a43[_0x1635('0x88')][_0x1635('0x51')]){throw new Error(_0x1635('0xe2'));}if(!_0x223a43['body'][_0x1635('0xf9')]['phone']){throw new Error(_0x1635('0xfe'));}if(!_0x223a43[_0x1635('0x88')][_0x1635('0xf9')]['firstName']){throw new Error(_0x1635('0xea'));}if(!_0x223a43['body'][_0x1635('0xe6')]){throw new Error(_0x1635('0xe7'));}var _0x1b83fd=require('child_process')['fork'](path['join'](__dirname,_0x1635('0xff')),[_0x223a43[_0x1635('0x7e')]['id'],JSON[_0x1635('0xfb')](_0x223a43[_0x1635('0x88')]),JSON[_0x1635('0xfb')](_0x3d2732)]);_0x1b83fd['on'](_0x1635('0xfc'),function(_0x4d0bbb){_0x17e0b8=!![];return _0x2d991d['status'](0xc8)[_0x1635('0x12')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x1b83fd[_0x1635('0xf3')]});});_0x1b83fd['on']('exit',function(_0x3a82b5){if(_0x3a82b5&&!_0x17e0b8){return _0x2d991d[_0x1635('0xf')](0x1f4)[_0x1635('0x12')]({'message':'error\x20child\x20process','pid':_0x1b83fd['pid']});}});})[_0x1635('0x87')](handleError(_0x2d991d,null));};exports[_0x1635('0x100')]=function(_0x6b35ef,_0x32861e){var _0x101329=[_0x1635('0x101'),'chat',_0x1635('0x102'),'openchannel',_0x1635('0x103'),_0x1635('0x104'),_0x1635('0x105')];var _0x411909={'offset':0x0,'order':qs['sort'](_0x1635('0x106'))},_0x1538b0={'count':0x0,'rows':[]};Promise['resolve']()[_0x1635('0x15')](function(){if(_0x6b35ef[_0x1635('0x28')][_0x1635('0x107')]){if(!_[_0x1635('0x108')](_0x101329,_0x6b35ef[_0x1635('0x28')][_0x1635('0x107')][_0x1635('0x109')]())){throw new Error(_0x1635('0x10a'));}_0x101329=[_0x6b35ef['query']['channel']['toLowerCase']()];}if(_0x6b35ef['query'][_0x1635('0x10b')]){try{var _0xfb2358=JSON['parse'](_0x6b35ef[_0x1635('0x28')]['range']);if(!moment(_0xfb2358[_0x1635('0x36')])['isValid']()){throw new Error(_0x1635('0x10c'));}if(!moment(_0xfb2358['to'])[_0x1635('0x10d')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x35ce4d){throw new Error(_0x1635('0x10e'));}}if(!_0x6b35ef['query'][_0x1635('0x2c')](_0x1635('0x2d'))){_0x411909[_0x1635('0xd')]=qs['limit'](_0x6b35ef[_0x1635('0x28')][_0x1635('0xd')]||0xa);_0x411909[_0x1635('0xb')]=qs[_0x1635('0xb')](_0x6b35ef['query']['offset']);}var _0x2d509f=_0x101329[_0x1635('0x4e')](function(_0xa948b3){if(_0xa948b3===_0x1635('0x105')){var _0x181d22={'attributes':['id','uniqueid',_0x1635('0x26'),_0x1635('0x10f'),_0x1635('0x110'),_0x1635('0x111'),_0x1635('0x112'),'endtime',_0x1635('0x113'),_0x1635('0x114'),_0x1635('0x115'),_0x1635('0x116'),'userSecondDisposition',_0x1635('0x117'),'UserId'],'where':{'ContactId':_0x6b35ef['params']['id']},'include':[{'model':db[_0x1635('0x48')],'as':_0x1635('0x48'),'attributes':['id',_0x1635('0x19'),_0x1635('0x118'),_0x1635('0x84')]}],'order':[[_0x1635('0x115'),_0x1635('0x65')]]};if(_0x6b35ef[_0x1635('0x28')][_0x1635('0x10b')]){_0x181d22[_0x1635('0x30')][_0x1635('0x115')]={'$gte':_0xfb2358[_0x1635('0x36')],'$lte':_0xfb2358['to']};}return db[_0x1635('0xa2')][_0x1635('0x119')](_0x181d22)[_0x1635('0x15')](function(_0x51be52){_0x1538b0[_0x1635('0xe')]+=_0x51be52[_0x1635('0xe')];return _[_0x1635('0x4e')](_0x51be52['rows'],function(_0x5cac21){var _0x5d8cdd=_0x5cac21[_0x1635('0x89')]({'plain':!![]});_0x5d8cdd[_0x1635('0x107')]=_0xa948b3;if(_0x5d8cdd[_0x1635('0x48')]){_0x5d8cdd[_0x1635('0x48')]={'id':_0x5d8cdd[_0x1635('0x48')]['id'],'name':_0x5d8cdd['User'][_0x1635('0x19')],'fullname':_0x5d8cdd[_0x1635('0x48')][_0x1635('0x118')],'alias':_0x5d8cdd[_0x1635('0x48')][_0x1635('0x84')]};}return _0x5d8cdd;});});}else{var _0x56192c=_['startCase'](_0xa948b3)+(_0xa948b3===_0x1635('0x11a')?_0x1635('0x11b'):'Account');var _0x314b7e={'attributes':['id',_0x1635('0x11c'),_0x1635('0x11d'),_0x1635('0x115'),_0x1635('0x114'),_0x1635('0x11e'),_0x1635('0x11f'),_0x1635('0x120'),_0x1635('0x121'),_0x56192c+'Id'],'where':{'ContactId':_0x6b35ef[_0x1635('0x7e')]['id']},'include':[{'model':db[_0x56192c],'as':_0x1635('0x122'),'attributes':['id','name',_0x1635('0x123')]},{'model':db[_0x1635('0x48')],'as':_0x1635('0x124'),'attributes':['id',_0x1635('0x19'),'fullname']},{'model':db[_0x1635('0xb4')],'as':_0x1635('0x7c'),'attributes':['id',_0x1635('0x19'),_0x1635('0x35')],'through':{'attributes':[]}}],'order':[[_0x1635('0x115'),'DESC']]};if(_0x6b35ef[_0x1635('0x28')][_0x1635('0x10b')]){_0x314b7e['where'][_0x1635('0x115')]={'$gte':_0xfb2358[_0x1635('0x36')],'$lte':_0xfb2358['to']};}switch(_0xa948b3){case _0x1635('0x11a'):_0x314b7e[_0x1635('0x2a')][_0x1635('0x22')](_0x1635('0x125'),_0x1635('0x126'),_0x1635('0x127'),_0x1635('0x128'),_0x1635('0x129'),_0x1635('0x12a'),_0x1635('0x12b'),'ratingValue','referer');break;case _0x1635('0x101'):_0x314b7e[_0x1635('0x2a')][_0x1635('0x22')](_0x1635('0x12c'),_0x1635('0x12d'));break;case'openchannel':_0x314b7e[_0x1635('0x2a')][_0x1635('0x22')]('externalUrl',_0x1635('0x12e'));break;}return db[_[_0x1635('0x12f')](_0xa948b3)+'Interaction'][_0x1635('0x119')](_0x314b7e)[_0x1635('0x15')](function(_0x59d408){_0x1538b0[_0x1635('0xe')]+=_0x59d408['count'];return _['map'](_0x59d408['rows'],function(_0x5e520c){var _0x2c9b36=_0x5e520c[_0x1635('0x89')]({'plain':!![]});_0x2c9b36['channel']=_0xa948b3;if(_0x2c9b36[_0x1635('0x124')]){_0x2c9b36[_0x1635('0x124')]={'id':_0x2c9b36[_0x1635('0x124')]['id'],'name':_0x2c9b36['Owner'][_0x1635('0x19')],'fullname':_0x2c9b36['Owner']['fullname']};}return _0x2c9b36;});});}});return Promise['all'](_0x2d509f);})['then'](function(_0x23babe){return _(_0x23babe)[_0x1635('0x130')]()[_0x1635('0x131')]('createdAt')['reverse']()['value']();})[_0x1635('0x15')](function(_0x1fae5d){_0x1538b0[_0x1635('0x7d')]=_0x411909[_0x1635('0xd')]?_0x1fae5d[_0x1635('0x132')](_0x411909[_0x1635('0xb')],_0x411909[_0x1635('0xb')]+_0x411909[_0x1635('0xd')]):_0x1fae5d;return _0x1538b0;})['then'](respondWithFilteredResult(_0x32861e,_0x411909))['catch'](handleError(_0x32861e,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 6d08e3d..681c638 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe52f=['update','remove','emit','hasOwnProperty','hook','CmContact','setMaxListeners'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xe52f,0x163));var _0xfe52=function(_0x4904b3,_0x1b2b85){_0x4904b3=_0x4904b3-0x0;var _0x47caf3=_0xe52f[_0x4904b3];return _0x47caf3;};'use strict';var EventEmitter=require('events');var CmContact=require('../../mysqldb')['db'][_0xfe52('0x0')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xfe52('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xfe52('0x2'),'afterDestroy':_0xfe52('0x3')};function emitEvent(_0x21882b){return function(_0x2c8abe,_0x2959db,_0x35a9ac){CmContactEvents['emit'](_0x21882b+':'+_0x2c8abe['id'],_0x2c8abe);CmContactEvents[_0xfe52('0x4')](_0x21882b,_0x2c8abe);_0x35a9ac(null);};}for(var e in events){if(events[_0xfe52('0x5')](e)){var event=events[e];CmContact[_0xfe52('0x6')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0xeca1=['emit','hasOwnProperty','hook','exports','CmContact','setMaxListeners','update'];(function(_0x50478e,_0x404854){var _0x190c0e=function(_0x2a767e){while(--_0x2a767e){_0x50478e['push'](_0x50478e['shift']());}};_0x190c0e(++_0x404854);}(_0xeca1,0xf9));var _0x1eca=function(_0x395237,_0x10c765){_0x395237=_0x395237-0x0;var _0x46c3bd=_0xeca1[_0x395237];return _0x46c3bd;};'use strict';var EventEmitter=require('events');var CmContact=require('../../mysqldb')['db'][_0x1eca('0x0')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x1eca('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1eca('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2db7c1){return function(_0xffde47,_0x2f827d,_0x4d6984){CmContactEvents['emit'](_0x2db7c1+':'+_0xffde47['id'],_0xffde47);CmContactEvents[_0x1eca('0x3')](_0x2db7c1,_0xffde47);_0x4d6984(null);};}for(var e in events){if(events[_0x1eca('0x4')](e)){var event=events[e];CmContact[_0x1eca('0x5')](e,emitEvent(event));}}module[_0x1eca('0x6')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index ba64ee5..f42ec3e 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f4c=['cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','priority','callbackUniqueid','catch','ret','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','ListId','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','dialCheckDuplicateType','CmList','Lists','always','onlyIfOpen','BlackLists','length','CmHopperBlack','cmContact,\x20%s,\x20%s','message','findAll','destroy','ContactId','VoiceQueueId','CampaignId','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','util','api','moment','bluebird','path','rimraf','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','fax','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','VoiceQueue','findOne','then','isNil','timezones','utcOffset','add','minutes','CmHopper'];(function(_0x2c031f,_0x9694fd){var _0x59633b=function(_0x1bcc5d){while(--_0x1bcc5d){_0x2c031f['push'](_0x2c031f['shift']());}};_0x59633b(++_0x9694fd);}(_0x9f4c,0x147));var _0xc9f4=function(_0x1aa4d0,_0x3f13a0){_0x1aa4d0=_0x1aa4d0-0x0;var _0x1c9386=_0x9f4c[_0x1aa4d0];return _0x1c9386;};'use strict';var _=require('lodash');var util=require(_0xc9f4('0x0'));var logger=require('../../config/logger')(_0xc9f4('0x1'));var moment=require(_0xc9f4('0x2'));var BPromise=require(_0xc9f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc9f4('0x4'));var rimraf=require(_0xc9f4('0x5'));var config=require('../../config/environment');var shared=require(_0xc9f4('0x6'));var attributes=require(_0xc9f4('0x7'));module[_0xc9f4('0x8')]=function(_0x385fb6,_0x2516e4){return _0x385fb6[_0xc9f4('0x9')](_0xc9f4('0xa'),attributes,{'tableName':_0xc9f4('0xb'),'paranoid':!![],'indexes':[{'name':_0xc9f4('0xc'),'fields':[_0xc9f4('0xc')]},{'name':_0xc9f4('0xd'),'fields':[_0xc9f4('0xe'),_0xc9f4('0xf'),_0xc9f4('0xc'),'mobile',_0xc9f4('0x10'),'email'],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xc9f4('0x11'),'collate':_0xc9f4('0x12'),'hooks':{'afterCreate':function(_0x532454,_0x4ca78b,_0x5c22c0){var _0x288ac2=_0x385fb6[_0xc9f4('0x13')];var _0x354e53=_0x532454[_0xc9f4('0x14')]({'plain':!![]});function _0x179469(){return function(_0x3cf058){logger[_0xc9f4('0x15')](_0xc9f4('0x16'),_0xc9f4('0x17'),util[_0xc9f4('0x18')](_0x3cf058,{'showHidden':![],'depth':null}));};}function _0x49936b(_0xef922d,_0x32127a){var _0x372983=_0x32127a[_0xc9f4('0x19')]?_0x32127a[_0xc9f4('0x19')]:moment()[_0xc9f4('0x1a')](_0xc9f4('0x1b'));return new BPromise(function(_0x2fd8b7,_0x57daeb){if(_['isNil'](_0x32127a[_0xc9f4('0x1c')])){_0x2fd8b7({'ret':_0x372983});}else{_0x288ac2[_0xc9f4('0x1d')][_0xc9f4('0x1e')]({'where':{'id':_0xef922d['id']}})[_0xc9f4('0x1f')](function(_0x1ca2c0){if(!_[_0xc9f4('0x20')](_0x1ca2c0)){var _0x56d847=_0x1ca2c0[_0xc9f4('0x1c')];if(!_[_0xc9f4('0x20')](_0x56d847)){var _0x36d871=shared[_0xc9f4('0x21')];var _0x335c1c=_0x36d871[_0x56d847];var _0x52852a=_0x36d871[_0x32127a['dialTimezone']];if(!_[_0xc9f4('0x20')](_0x335c1c)&&!_['isNil'](_0x52852a)){var _0x11e253=_0x335c1c[_0xc9f4('0x22')]-_0x52852a[_0xc9f4('0x22')];_0x372983=_0x32127a[_0xc9f4('0x19')]?_0x32127a['scheduledat']:moment();var _0x4f9f14=moment(_0x372983)[_0xc9f4('0x23')](_0x11e253,_0xc9f4('0x24'));_0x2fd8b7({'ret':_0x4f9f14[_0xc9f4('0x1a')](_0xc9f4('0x1b'))});}else _0x2fd8b7({'ret':_0x372983});}else _0x2fd8b7({'ret':_0x372983});}else{_0x2fd8b7({'ret':_0x372983});}});}});return 0xa;}var _0xbb8f52=function(_0x2ede08){return new BPromise(function(_0x16de46,_0x9faebe){_0x49936b(_0x2ede08,_0x354e53)['then'](function(_0x265174){_0x354e53[_0xc9f4('0x19')]=_0x265174['ret'];_0x288ac2[_0xc9f4('0x25')][_0xc9f4('0x1e')]({'where':{'phone':_0x354e53['phone'],'VoiceQueueId':_0x2ede08['id']}})[_0xc9f4('0x1f')](function(_0x4f0703){if(!_['isNil'](_0x4f0703)){throw new Error(_0xc9f4('0x26')+_0x354e53[_0xc9f4('0xc')]+_0xc9f4('0x27')+_0x2ede08['id']);}return _0x288ac2[_0xc9f4('0x25')][_0xc9f4('0x28')]({'phone':_0x354e53[_0xc9f4('0xc')],'ContactId':_0x354e53['id'],'ListId':_0x354e53['ListId'],'priority':_0x354e53[_0xc9f4('0x29')]?_0x354e53[_0xc9f4('0x29')]:0x2,'scheduledat':_0x354e53[_0xc9f4('0x19')]?_0x354e53['scheduledat']:moment()[_0xc9f4('0x1a')](_0xc9f4('0x1b')),'callback':_0x354e53[_0xc9f4('0x2a')]?!![]:![],'callbackuniqueid':_0x354e53['callbackUniqueid']?_0x354e53[_0xc9f4('0x2a')]:undefined,'callbackat':_0x354e53['callbackUniqueid']?moment()['format'](_0xc9f4('0x1b')):undefined,'VoiceQueueId':_0x2ede08['id']});})[_0xc9f4('0x2b')](function(_0x3f8af3){_0x9faebe(_0x3f8af3);});});});};var _0x6b4ec=function(_0x33e271){return new BPromise(function(_0x2f1d17,_0x4c61c8){_0x49936b(_0x33e271,_0x354e53)[_0xc9f4('0x1f')](function(_0x47f612){_0x354e53[_0xc9f4('0x19')]=_0x47f612[_0xc9f4('0x2c')];_0x288ac2[_0xc9f4('0x25')]['findOne']({'where':{'phone':_0x354e53[_0xc9f4('0xc')],'VoiceQueueId':_0x33e271['id']}})[_0xc9f4('0x1f')](function(_0x560b4b){if(!_[_0xc9f4('0x20')](_0x560b4b)){throw new Error('cmContact,\x20afterCreate\x20'+_0x354e53['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x33e271['id']);}return _0x288ac2[_0xc9f4('0x2d')][_0xc9f4('0x1e')]({'where':{'calleridnum':_0x354e53['phone'],'VoiceQueueId':_0x33e271['id']}});})['then'](function(_0x5b828d){if(!_[_0xc9f4('0x20')](_0x5b828d)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x354e53['phone']+_0xc9f4('0x2e')+_0x33e271['id']);}return _0x288ac2[_0xc9f4('0x25')]['create']({'phone':_0x354e53['phone'],'ContactId':_0x354e53['id'],'ListId':_0x354e53['ListId'],'priority':_0x354e53[_0xc9f4('0x29')]?_0x354e53[_0xc9f4('0x29')]:0x2,'scheduledat':_0x354e53[_0xc9f4('0x19')]?_0x354e53[_0xc9f4('0x19')]:moment()[_0xc9f4('0x1a')](_0xc9f4('0x1b')),'callback':_0x354e53['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x354e53[_0xc9f4('0x2a')]?_0x354e53[_0xc9f4('0x2a')]:undefined,'callbackat':_0x354e53['callbackUniqueid']?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x33e271['id']});})['catch'](function(_0x16b024){_0x4c61c8(_0x16b024);});});});};function _0x3f2769(){return function(_0x5f4109){logger[_0xc9f4('0x15')]('cmContact',_0xc9f4('0x17'),util[_0xc9f4('0x18')](_0x5f4109,{'showHidden':![],'depth':null}));};}function _0x4bf8c1(_0x526446,_0x3dba5f){var _0x198f2e=_0x3dba5f[_0xc9f4('0x19')]?_0x3dba5f[_0xc9f4('0x19')]:moment()[_0xc9f4('0x1a')](_0xc9f4('0x1b'));return new BPromise(function(_0xcf4380,_0x27fedd){if(_[_0xc9f4('0x20')](_0x3dba5f['dialTimezone'])){_0xcf4380({'ret':_0x198f2e});}else{_0x288ac2[_0xc9f4('0x2f')]['findOne']({'where':{'id':_0x526446['id']}})[_0xc9f4('0x1f')](function(_0x4d5646){if(!_[_0xc9f4('0x20')](_0x4d5646)){var _0x81df1c=_0x4d5646[_0xc9f4('0x1c')];if(!_[_0xc9f4('0x20')](_0x81df1c)){var _0x457d95=shared[_0xc9f4('0x21')];var _0x38d344=_0x457d95[_0x81df1c];var _0x149e9b=_0x457d95[_0x3dba5f[_0xc9f4('0x1c')]];if(!_['isNil'](_0x38d344)&&!_[_0xc9f4('0x20')](_0x149e9b)){var _0x8c548d=_0x38d344[_0xc9f4('0x22')]-_0x149e9b[_0xc9f4('0x22')];_0x198f2e=_0x3dba5f[_0xc9f4('0x19')]?_0x3dba5f['scheduledat']:moment();var _0xbdeefd=moment(_0x198f2e)[_0xc9f4('0x23')](_0x8c548d,_0xc9f4('0x24'));_0xcf4380({'ret':_0xbdeefd[_0xc9f4('0x1a')](_0xc9f4('0x1b'))});}else _0xcf4380({'ret':_0x198f2e});}else _0xcf4380({'ret':_0x198f2e});}else{_0xcf4380({'ret':_0x198f2e});}});}});return 0xa;}var _0x182c8d=function(_0x4b1c2a){return new BPromise(function(_0x5b5d42,_0x402b92){_0x4bf8c1(_0x4b1c2a,_0x354e53)['then'](function(_0x29ea2e){_0x354e53['scheduledat']=_0x29ea2e[_0xc9f4('0x2c')];_0x288ac2[_0xc9f4('0x25')]['findOne']({'where':{'phone':_0x354e53[_0xc9f4('0xc')],'CampaignId':_0x4b1c2a['id']}})['then'](function(_0x5e7e2c){if(!_[_0xc9f4('0x20')](_0x5e7e2c)){throw new Error(_0xc9f4('0x26')+_0x354e53[_0xc9f4('0xc')]+_0xc9f4('0x30')+_0x4b1c2a['id']);}return _0x288ac2['CmHopper'][_0xc9f4('0x28')]({'phone':_0x354e53['phone'],'ContactId':_0x354e53['id'],'ListId':_0x354e53[_0xc9f4('0x31')],'priority':_0x354e53[_0xc9f4('0x29')]?_0x354e53['priority']:0x2,'scheduledat':_0x354e53[_0xc9f4('0x19')]?_0x354e53['scheduledat']:moment()[_0xc9f4('0x1a')](_0xc9f4('0x1b')),'callback':_0x354e53[_0xc9f4('0x2a')]?!![]:![],'callbackuniqueid':_0x354e53[_0xc9f4('0x2a')]?_0x354e53[_0xc9f4('0x2a')]:undefined,'callbackat':_0x354e53['callbackUniqueid']?moment()[_0xc9f4('0x1a')](_0xc9f4('0x1b')):undefined,'CampaignId':_0x4b1c2a['id']});})[_0xc9f4('0x2b')](function(_0x3b99d0){_0x402b92(_0x3b99d0);});});});};var _0x26ebc5=function(_0x8bdeb6){return new BPromise(function(_0x125d3c,_0x1982e0){_0x4bf8c1(_0x8bdeb6,_0x354e53)[_0xc9f4('0x1f')](function(_0x1ced5e){_0x354e53[_0xc9f4('0x19')]=_0x1ced5e[_0xc9f4('0x2c')];_0x288ac2[_0xc9f4('0x25')][_0xc9f4('0x1e')]({'where':{'phone':_0x354e53['phone'],'CampaignId':_0x8bdeb6['id']}})[_0xc9f4('0x1f')](function(_0x3e342d){if(!_[_0xc9f4('0x20')](_0x3e342d)){throw new Error(_0xc9f4('0x26')+_0x354e53[_0xc9f4('0xc')]+_0xc9f4('0x32')+_0x8bdeb6['id']);}return _0x288ac2[_0xc9f4('0x2d')]['findOne']({'where':{'calleridnum':_0x354e53[_0xc9f4('0xc')],'CampaignId':_0x8bdeb6['id']}});})[_0xc9f4('0x1f')](function(_0x160967){if(!_[_0xc9f4('0x20')](_0x160967)){throw new Error(_0xc9f4('0x33')+_0x354e53[_0xc9f4('0xc')]+_0xc9f4('0x34')+_0x8bdeb6['id']);}return _0x288ac2[_0xc9f4('0x25')]['create']({'phone':_0x354e53[_0xc9f4('0xc')],'ContactId':_0x354e53['id'],'ListId':_0x354e53[_0xc9f4('0x31')],'priority':_0x354e53[_0xc9f4('0x29')]?_0x354e53[_0xc9f4('0x29')]:0x2,'scheduledat':_0x354e53[_0xc9f4('0x19')]?_0x354e53[_0xc9f4('0x19')]:moment()['format'](_0xc9f4('0x1b')),'callback':_0x354e53[_0xc9f4('0x2a')]?!![]:![],'callbackuniqueid':_0x354e53['callbackUniqueid']?_0x354e53[_0xc9f4('0x2a')]:undefined,'callbackat':_0x354e53[_0xc9f4('0x2a')]?moment()['format'](_0xc9f4('0x1b')):undefined,'CampaignId':_0x8bdeb6['id']});})['catch'](function(_0x4f8928){_0x1982e0(_0x4f8928);});});});};if(_0x354e53[_0xc9f4('0x31')]){_0x288ac2[_0xc9f4('0x1d')]['findAll']({'where':{'type':_0xc9f4('0x35')},'attributes':['id',_0xc9f4('0x36'),_0xc9f4('0x1c')],'include':[{'model':_0x288ac2[_0xc9f4('0x37')],'as':_0xc9f4('0x38'),'where':{'id':_0x354e53['ListId']}}]})[_0xc9f4('0x1f')](function(_0x3c9638){if(_0x3c9638){var _0x503864=[];for(var _0xef9a24=0x0,_0x20e4f4;_0xef9a24<_0x3c9638['length'];_0xef9a24+=0x1){_0x20e4f4=_0x3c9638[_0xef9a24][_0xc9f4('0x14')]({'plain':!![]});switch(_0x20e4f4['dialCheckDuplicateType']){case _0xc9f4('0x39'):_0x6b4ec(_0x20e4f4)['catch'](_0x179469());break;case _0xc9f4('0x3a'):_0xbb8f52(_0x20e4f4)[_0xc9f4('0x2b')](_0x179469());break;default:_0x4bf8c1(_0x20e4f4,_0x354e53)['then'](function(_0x1a5712){_0x354e53[_0xc9f4('0x19')]=_0x1a5712[_0xc9f4('0x2c')];_0x288ac2[_0xc9f4('0x25')][_0xc9f4('0x28')]({'phone':_0x354e53[_0xc9f4('0xc')],'ContactId':_0x354e53['id'],'ListId':_0x354e53[_0xc9f4('0x31')],'scheduledat':_0x354e53[_0xc9f4('0x19')]?_0x354e53[_0xc9f4('0x19')]:moment()[_0xc9f4('0x1a')](_0xc9f4('0x1b')),'priority':_0x354e53['priority']?_0x354e53[_0xc9f4('0x29')]:0x2,'callback':_0x354e53['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x354e53[_0xc9f4('0x2a')]?_0x354e53[_0xc9f4('0x2a')]:undefined,'callbackat':_0x354e53[_0xc9f4('0x2a')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x20e4f4['id']})['catch'](_0x179469());});}}}})[_0xc9f4('0x1f')](function(){return _0x288ac2[_0xc9f4('0x1d')]['findAll']({'where':{'type':_0xc9f4('0x35')},'attributes':['id'],'include':[{'model':_0x288ac2['CmList'],'as':_0xc9f4('0x3b'),'where':{'id':_0x354e53[_0xc9f4('0x31')]}}]})[_0xc9f4('0x1f')](function(_0x50934f){if(_0x50934f){var _0x1fb6bf=[];for(var _0x56f313=0x0,_0x211090;_0x56f313<_0x50934f[_0xc9f4('0x3c')];_0x56f313+=0x1){_0x211090=_0x50934f[_0x56f313][_0xc9f4('0x14')]({'plain':!![]});_0x288ac2[_0xc9f4('0x3d')][_0xc9f4('0x28')]({'phone':_0x354e53[_0xc9f4('0xc')],'ContactId':_0x354e53['id'],'ListId':_0x354e53[_0xc9f4('0x31')],'VoiceQueueId':_0x211090['id']})[_0xc9f4('0x2b')](function(_0x2f5858){logger[_0xc9f4('0x15')](_0xc9f4('0x3e'),'afterCreate',_0x2f5858[_0xc9f4('0x3f')]);});}}});})[_0xc9f4('0x1f')](function(){return _0x288ac2[_0xc9f4('0x2f')][_0xc9f4('0x40')]({'attributes':['id','dialCheckDuplicateType',_0xc9f4('0x1c')],'include':[{'model':_0x288ac2[_0xc9f4('0x37')],'as':_0xc9f4('0x38'),'where':{'id':_0x354e53[_0xc9f4('0x31')]}}]})[_0xc9f4('0x1f')](function(_0x31f075){if(_0x31f075){var _0x3f0cc8=[];for(var _0x2ff1db=0x0,_0x1cbc6b;_0x2ff1db<_0x31f075[_0xc9f4('0x3c')];_0x2ff1db+=0x1){_0x1cbc6b=_0x31f075[_0x2ff1db]['get']({'plain':!![]});switch(_0x1cbc6b[_0xc9f4('0x36')]){case _0xc9f4('0x39'):_0x26ebc5(_0x1cbc6b)['catch'](_0x3f2769());break;case _0xc9f4('0x3a'):_0x182c8d(_0x1cbc6b)[_0xc9f4('0x2b')](_0x3f2769());break;default:_0x288ac2[_0xc9f4('0x25')][_0xc9f4('0x28')]({'phone':_0x354e53['phone'],'ContactId':_0x354e53['id'],'ListId':_0x354e53['ListId'],'scheduledat':_0x354e53[_0xc9f4('0x19')]?_0x354e53['scheduledat']:moment()[_0xc9f4('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x354e53[_0xc9f4('0x29')]?_0x354e53[_0xc9f4('0x29')]:0x2,'callback':_0x354e53[_0xc9f4('0x2a')]?!![]:![],'callbackuniqueid':_0x354e53['callbackUniqueid']?_0x354e53[_0xc9f4('0x2a')]:undefined,'callbackat':_0x354e53[_0xc9f4('0x2a')]?moment()[_0xc9f4('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x1cbc6b['id']})[_0xc9f4('0x2b')](_0x3f2769());}}}});})[_0xc9f4('0x1f')](function(){return _0x288ac2[_0xc9f4('0x2f')][_0xc9f4('0x40')]({'attributes':['id'],'include':[{'model':_0x288ac2[_0xc9f4('0x37')],'as':_0xc9f4('0x3b'),'where':{'id':_0x354e53[_0xc9f4('0x31')]}}]})['then'](function(_0x47dc57){if(_0x47dc57){var _0x25d0a7=[];for(var _0x5f4edc=0x0,_0x119785;_0x5f4edc<_0x47dc57[_0xc9f4('0x3c')];_0x5f4edc+=0x1){_0x119785=_0x47dc57[_0x5f4edc][_0xc9f4('0x14')]({'plain':!![]});_0x288ac2[_0xc9f4('0x3d')]['create']({'phone':_0x354e53['phone'],'ContactId':_0x354e53['id'],'ListId':_0x354e53['ListId'],'CampaignId':_0x119785['id']})[_0xc9f4('0x2b')](function(_0x455d0f){logger['error']('cmContact,\x20%s,\x20%s',_0xc9f4('0x17'),_0x455d0f['message']);});}}});})[_0xc9f4('0x1f')](function(){_0x5c22c0();})['catch'](function(_0x135227){logger[_0xc9f4('0x15')]('cmContact,\x20%s,\x20%s',_0xc9f4('0x17'),_0x135227[_0xc9f4('0x3f')]);_0x5c22c0(_0x135227);});}else{_0x5c22c0(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x28155d,_0x1334ca,_0x4cda9a){var _0xd38d95=_0x385fb6[_0xc9f4('0x13')];var _0x1bfe1f=_0x28155d[_0xc9f4('0x14')]({'plain':!![]});return _0xd38d95['CmHopper'][_0xc9f4('0x40')]({'raw':!![],'where':{'ListId':_0x1bfe1f[_0xc9f4('0x31')],'ContactId':_0x1bfe1f['id']}})[_0xc9f4('0x1f')](function(_0x2949c5){if(!_['isEmpty'](_0x2949c5)){var _0x22af89=[];for(var _0x4e25b9=0x0;_0x4e25b9<_0x2949c5[_0xc9f4('0x3c')];_0x4e25b9+=0x1){var _0x4ddd34=_0xd38d95[_0xc9f4('0x25')][_0xc9f4('0x41')]({'where':{'ListId':_0x2949c5[_0x4e25b9][_0xc9f4('0x31')],'ContactId':_0x2949c5[_0x4e25b9][_0xc9f4('0x42')],'VoiceQueueId':_0x2949c5[_0x4e25b9][_0xc9f4('0x43')],'CampaignId':_0x2949c5[_0x4e25b9][_0xc9f4('0x44')]}});_0x22af89['push'](_0x4ddd34);}return BPromise[_0xc9f4('0x45')](_0x22af89);}})['then'](function(_0x11a77b){logger[_0xc9f4('0x46')](_0xc9f4('0x47'),util['inspect'](_0x11a77b,{'showHidden':![],'depth':null}));_0x4cda9a();})[_0xc9f4('0x2b')](function(_0xde9b17){logger['error'](_0xc9f4('0x48'),util[_0xc9f4('0x18')](_0xde9b17,{'showHidden':![],'depth':null}));_0x4cda9a(_0xde9b17);});}}});}; \ No newline at end of file +var _0x1242=['lastName','mobile','fax','email','utf8mb4_unicode_ci','get','inspect','scheduledat','format','isNil','VoiceQueue','then','dialTimezone','timezones','utcOffset','minutes','YYYY-MM-DD\x20HH:mm:ss','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','findOne','CmHopperFinal','cmContact,\x20afterCreate,\x20','catch','error','cmContact','afterCreate','Campaign','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','CmList','Lists','dialCheckDuplicateType','always','onlyIfOpen','BlackLists','length','cmContact,\x20%s,\x20%s','message','CmHopperBlack','List\x20not\x20found','models','ContactId','CampaignId','all','info','[CmContact][afterDestroy][Succesfull]','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContact.attributes','define','CmContact','cm_contacts','phone','firstName'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x1242,0x7f));var _0x2124=function(_0x34e29e,_0x10abaa){_0x34e29e=_0x34e29e-0x0;var _0x2f2219=_0x1242[_0x34e29e];return _0x2f2219;};'use strict';var _=require(_0x2124('0x0'));var util=require('util');var logger=require(_0x2124('0x1'))(_0x2124('0x2'));var moment=require(_0x2124('0x3'));var BPromise=require(_0x2124('0x4'));var rp=require(_0x2124('0x5'));var fs=require('fs');var path=require(_0x2124('0x6'));var rimraf=require(_0x2124('0x7'));var config=require(_0x2124('0x8'));var shared=require('../../config/environment/shared');var attributes=require(_0x2124('0x9'));module['exports']=function(_0x2cf886,_0x5dcb5f){return _0x2cf886[_0x2124('0xa')](_0x2124('0xb'),attributes,{'tableName':_0x2124('0xc'),'paranoid':!![],'indexes':[{'name':_0x2124('0xd'),'fields':[_0x2124('0xd')]},{'name':'fti_cm_contacts','fields':[_0x2124('0xe'),_0x2124('0xf'),_0x2124('0xd'),_0x2124('0x10'),_0x2124('0x11'),_0x2124('0x12')],'type':'FULLTEXT'}],'timestamps':!![],'charset':'utf8mb4','collate':_0x2124('0x13'),'hooks':{'afterCreate':function(_0xeb863d,_0x113908,_0x543969){var _0x5f5b97=_0x2cf886['models'];var _0x215716=_0xeb863d[_0x2124('0x14')]({'plain':!![]});function _0x497ec4(){return function(_0x44340d){logger['error']('cmContact','afterCreate',util[_0x2124('0x15')](_0x44340d,{'showHidden':![],'depth':null}));};}function _0x14f69a(_0x3655ea,_0x479663){var _0x3414c7=_0x479663['scheduledat']?_0x479663[_0x2124('0x16')]:moment()[_0x2124('0x17')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x43e430,_0x47755d){if(_[_0x2124('0x18')](_0x479663['dialTimezone'])){_0x43e430({'ret':_0x3414c7});}else{_0x5f5b97[_0x2124('0x19')]['findOne']({'where':{'id':_0x3655ea['id']}})[_0x2124('0x1a')](function(_0x312bda){if(!_[_0x2124('0x18')](_0x312bda)){var _0x20f785=_0x312bda[_0x2124('0x1b')];if(!_[_0x2124('0x18')](_0x20f785)){var _0x731771=shared[_0x2124('0x1c')];var _0x31c3cd=_0x731771[_0x20f785];var _0x2e9792=_0x731771[_0x479663[_0x2124('0x1b')]];if(!_[_0x2124('0x18')](_0x31c3cd)&&!_[_0x2124('0x18')](_0x2e9792)){var _0x2afc6b=_0x31c3cd[_0x2124('0x1d')]-_0x2e9792[_0x2124('0x1d')];_0x3414c7=_0x479663[_0x2124('0x16')]?_0x479663['scheduledat']:moment();var _0x486332=moment(_0x3414c7)['add'](_0x2afc6b,_0x2124('0x1e'));_0x43e430({'ret':_0x486332['format'](_0x2124('0x1f'))});}else _0x43e430({'ret':_0x3414c7});}else _0x43e430({'ret':_0x3414c7});}else{_0x43e430({'ret':_0x3414c7});}});}});return 0xa;}var _0x5ccd9=function(_0x4bb0b9){return new BPromise(function(_0x3fc9d0,_0x425178){_0x14f69a(_0x4bb0b9,_0x215716)[_0x2124('0x1a')](function(_0x3341b9){_0x215716[_0x2124('0x16')]=_0x3341b9[_0x2124('0x20')];_0x5f5b97[_0x2124('0x21')]['findOne']({'where':{'phone':_0x215716[_0x2124('0xd')],'VoiceQueueId':_0x4bb0b9['id']}})[_0x2124('0x1a')](function(_0x30fb60){if(!_['isNil'](_0x30fb60)){throw new Error(_0x2124('0x22')+_0x215716['phone']+_0x2124('0x23')+_0x4bb0b9['id']);}return _0x5f5b97[_0x2124('0x21')][_0x2124('0x24')]({'phone':_0x215716['phone'],'ContactId':_0x215716['id'],'ListId':_0x215716[_0x2124('0x25')],'priority':_0x215716[_0x2124('0x26')]?_0x215716[_0x2124('0x26')]:0x2,'scheduledat':_0x215716[_0x2124('0x16')]?_0x215716[_0x2124('0x16')]:moment()[_0x2124('0x17')](_0x2124('0x1f')),'callback':_0x215716[_0x2124('0x27')]?!![]:![],'callbackuniqueid':_0x215716['callbackUniqueid']?_0x215716[_0x2124('0x27')]:undefined,'callbackat':_0x215716[_0x2124('0x27')]?moment()[_0x2124('0x17')](_0x2124('0x1f')):undefined,'VoiceQueueId':_0x4bb0b9['id']});})['catch'](function(_0x4648f8){_0x425178(_0x4648f8);});});});};var _0x198a9d=function(_0x14c235){return new BPromise(function(_0xdcec3b,_0xea9ca){_0x14f69a(_0x14c235,_0x215716)[_0x2124('0x1a')](function(_0x445c62){_0x215716[_0x2124('0x16')]=_0x445c62['ret'];_0x5f5b97[_0x2124('0x21')][_0x2124('0x28')]({'where':{'phone':_0x215716[_0x2124('0xd')],'VoiceQueueId':_0x14c235['id']}})[_0x2124('0x1a')](function(_0x4282ab){if(!_[_0x2124('0x18')](_0x4282ab)){throw new Error(_0x2124('0x22')+_0x215716[_0x2124('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x14c235['id']);}return _0x5f5b97[_0x2124('0x29')][_0x2124('0x28')]({'where':{'calleridnum':_0x215716[_0x2124('0xd')],'VoiceQueueId':_0x14c235['id']}});})['then'](function(_0x1a921d){if(!_[_0x2124('0x18')](_0x1a921d)){throw new Error(_0x2124('0x2a')+_0x215716[_0x2124('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x14c235['id']);}return _0x5f5b97[_0x2124('0x21')][_0x2124('0x24')]({'phone':_0x215716[_0x2124('0xd')],'ContactId':_0x215716['id'],'ListId':_0x215716[_0x2124('0x25')],'priority':_0x215716[_0x2124('0x26')]?_0x215716[_0x2124('0x26')]:0x2,'scheduledat':_0x215716['scheduledat']?_0x215716[_0x2124('0x16')]:moment()[_0x2124('0x17')](_0x2124('0x1f')),'callback':_0x215716['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x215716[_0x2124('0x27')]?_0x215716['callbackUniqueid']:undefined,'callbackat':_0x215716[_0x2124('0x27')]?moment()[_0x2124('0x17')](_0x2124('0x1f')):undefined,'VoiceQueueId':_0x14c235['id']});})[_0x2124('0x2b')](function(_0x383b19){_0xea9ca(_0x383b19);});});});};function _0x102e24(){return function(_0x5856f2){logger[_0x2124('0x2c')](_0x2124('0x2d'),_0x2124('0x2e'),util[_0x2124('0x15')](_0x5856f2,{'showHidden':![],'depth':null}));};}function _0x2901eb(_0x1fb37c,_0x1c08a5){var _0x346c32=_0x1c08a5[_0x2124('0x16')]?_0x1c08a5['scheduledat']:moment()['format'](_0x2124('0x1f'));return new BPromise(function(_0x502be0,_0x35c103){if(_[_0x2124('0x18')](_0x1c08a5[_0x2124('0x1b')])){_0x502be0({'ret':_0x346c32});}else{_0x5f5b97[_0x2124('0x2f')][_0x2124('0x28')]({'where':{'id':_0x1fb37c['id']}})['then'](function(_0x3cd381){if(!_[_0x2124('0x18')](_0x3cd381)){var _0x31404c=_0x3cd381[_0x2124('0x1b')];if(!_[_0x2124('0x18')](_0x31404c)){var _0x3de354=shared[_0x2124('0x1c')];var _0xa78ceb=_0x3de354[_0x31404c];var _0x5902df=_0x3de354[_0x1c08a5[_0x2124('0x1b')]];if(!_['isNil'](_0xa78ceb)&&!_['isNil'](_0x5902df)){var _0x343544=_0xa78ceb[_0x2124('0x1d')]-_0x5902df[_0x2124('0x1d')];_0x346c32=_0x1c08a5[_0x2124('0x16')]?_0x1c08a5[_0x2124('0x16')]:moment();var _0x273bb0=moment(_0x346c32)[_0x2124('0x30')](_0x343544,_0x2124('0x1e'));_0x502be0({'ret':_0x273bb0[_0x2124('0x17')](_0x2124('0x1f'))});}else _0x502be0({'ret':_0x346c32});}else _0x502be0({'ret':_0x346c32});}else{_0x502be0({'ret':_0x346c32});}});}});return 0xa;}var _0x1d82ca=function(_0x3985df){return new BPromise(function(_0x333d94,_0x33ad6b){_0x2901eb(_0x3985df,_0x215716)[_0x2124('0x1a')](function(_0x29ce7b){_0x215716[_0x2124('0x16')]=_0x29ce7b[_0x2124('0x20')];_0x5f5b97['CmHopper'][_0x2124('0x28')]({'where':{'phone':_0x215716[_0x2124('0xd')],'CampaignId':_0x3985df['id']}})['then'](function(_0x113a5a){if(!_[_0x2124('0x18')](_0x113a5a)){throw new Error(_0x2124('0x22')+_0x215716[_0x2124('0xd')]+_0x2124('0x31')+_0x3985df['id']);}return _0x5f5b97[_0x2124('0x21')][_0x2124('0x24')]({'phone':_0x215716['phone'],'ContactId':_0x215716['id'],'ListId':_0x215716['ListId'],'priority':_0x215716[_0x2124('0x26')]?_0x215716[_0x2124('0x26')]:0x2,'scheduledat':_0x215716[_0x2124('0x16')]?_0x215716[_0x2124('0x16')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x215716[_0x2124('0x27')]?!![]:![],'callbackuniqueid':_0x215716[_0x2124('0x27')]?_0x215716['callbackUniqueid']:undefined,'callbackat':_0x215716['callbackUniqueid']?moment()['format'](_0x2124('0x1f')):undefined,'CampaignId':_0x3985df['id']});})['catch'](function(_0x449506){_0x33ad6b(_0x449506);});});});};var _0xfaed28=function(_0x418bdf){return new BPromise(function(_0x37e7df,_0x3c9e14){_0x2901eb(_0x418bdf,_0x215716)[_0x2124('0x1a')](function(_0x201034){_0x215716[_0x2124('0x16')]=_0x201034['ret'];_0x5f5b97[_0x2124('0x21')][_0x2124('0x28')]({'where':{'phone':_0x215716[_0x2124('0xd')],'CampaignId':_0x418bdf['id']}})['then'](function(_0x4de719){if(!_[_0x2124('0x18')](_0x4de719)){throw new Error(_0x2124('0x22')+_0x215716['phone']+_0x2124('0x32')+_0x418bdf['id']);}return _0x5f5b97['CmHopperFinal'][_0x2124('0x28')]({'where':{'calleridnum':_0x215716[_0x2124('0xd')],'CampaignId':_0x418bdf['id']}});})[_0x2124('0x1a')](function(_0x4557c8){if(!_['isNil'](_0x4557c8)){throw new Error(_0x2124('0x2a')+_0x215716[_0x2124('0xd')]+_0x2124('0x33')+_0x418bdf['id']);}return _0x5f5b97[_0x2124('0x21')]['create']({'phone':_0x215716[_0x2124('0xd')],'ContactId':_0x215716['id'],'ListId':_0x215716[_0x2124('0x25')],'priority':_0x215716[_0x2124('0x26')]?_0x215716['priority']:0x2,'scheduledat':_0x215716['scheduledat']?_0x215716[_0x2124('0x16')]:moment()['format'](_0x2124('0x1f')),'callback':_0x215716[_0x2124('0x27')]?!![]:![],'callbackuniqueid':_0x215716[_0x2124('0x27')]?_0x215716[_0x2124('0x27')]:undefined,'callbackat':_0x215716[_0x2124('0x27')]?moment()[_0x2124('0x17')](_0x2124('0x1f')):undefined,'CampaignId':_0x418bdf['id']});})[_0x2124('0x2b')](function(_0x1e98a4){_0x3c9e14(_0x1e98a4);});});});};if(_0x215716[_0x2124('0x25')]){_0x5f5b97['VoiceQueue'][_0x2124('0x34')]({'where':{'type':_0x2124('0x35')},'attributes':['id','dialCheckDuplicateType',_0x2124('0x1b')],'include':[{'model':_0x5f5b97[_0x2124('0x36')],'as':_0x2124('0x37'),'where':{'id':_0x215716[_0x2124('0x25')]}}]})['then'](function(_0x583a20){if(_0x583a20){var _0x138b75=[];for(var _0x521ff0=0x0,_0x3e9a95;_0x521ff0<_0x583a20['length'];_0x521ff0+=0x1){_0x3e9a95=_0x583a20[_0x521ff0][_0x2124('0x14')]({'plain':!![]});switch(_0x3e9a95[_0x2124('0x38')]){case _0x2124('0x39'):_0x198a9d(_0x3e9a95)[_0x2124('0x2b')](_0x497ec4());break;case _0x2124('0x3a'):_0x5ccd9(_0x3e9a95)[_0x2124('0x2b')](_0x497ec4());break;default:_0x2901eb(_0x3e9a95,_0x215716)['then'](function(_0x2c52c2){_0x215716[_0x2124('0x16')]=_0x2c52c2['ret'];_0x5f5b97['CmHopper'][_0x2124('0x24')]({'phone':_0x215716[_0x2124('0xd')],'ContactId':_0x215716['id'],'ListId':_0x215716[_0x2124('0x25')],'scheduledat':_0x215716[_0x2124('0x16')]?_0x215716[_0x2124('0x16')]:moment()[_0x2124('0x17')](_0x2124('0x1f')),'priority':_0x215716[_0x2124('0x26')]?_0x215716[_0x2124('0x26')]:0x2,'callback':_0x215716['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x215716[_0x2124('0x27')]?_0x215716[_0x2124('0x27')]:undefined,'callbackat':_0x215716[_0x2124('0x27')]?moment()['format'](_0x2124('0x1f')):undefined,'VoiceQueueId':_0x3e9a95['id']})[_0x2124('0x2b')](_0x497ec4());});}}}})[_0x2124('0x1a')](function(){return _0x5f5b97[_0x2124('0x19')][_0x2124('0x34')]({'where':{'type':_0x2124('0x35')},'attributes':['id'],'include':[{'model':_0x5f5b97['CmList'],'as':_0x2124('0x3b'),'where':{'id':_0x215716[_0x2124('0x25')]}}]})[_0x2124('0x1a')](function(_0x19b5a6){if(_0x19b5a6){var _0x43d2ba=[];for(var _0x2979ed=0x0,_0x411b7d;_0x2979ed<_0x19b5a6[_0x2124('0x3c')];_0x2979ed+=0x1){_0x411b7d=_0x19b5a6[_0x2979ed][_0x2124('0x14')]({'plain':!![]});_0x5f5b97['CmHopperBlack'][_0x2124('0x24')]({'phone':_0x215716[_0x2124('0xd')],'ContactId':_0x215716['id'],'ListId':_0x215716[_0x2124('0x25')],'VoiceQueueId':_0x411b7d['id']})[_0x2124('0x2b')](function(_0x5a44f6){logger[_0x2124('0x2c')](_0x2124('0x3d'),_0x2124('0x2e'),_0x5a44f6[_0x2124('0x3e')]);});}}});})[_0x2124('0x1a')](function(){return _0x5f5b97[_0x2124('0x2f')][_0x2124('0x34')]({'attributes':['id',_0x2124('0x38'),_0x2124('0x1b')],'include':[{'model':_0x5f5b97[_0x2124('0x36')],'as':'Lists','where':{'id':_0x215716['ListId']}}]})[_0x2124('0x1a')](function(_0x1b1633){if(_0x1b1633){var _0x10e224=[];for(var _0x491039=0x0,_0x28c51d;_0x491039<_0x1b1633[_0x2124('0x3c')];_0x491039+=0x1){_0x28c51d=_0x1b1633[_0x491039][_0x2124('0x14')]({'plain':!![]});switch(_0x28c51d['dialCheckDuplicateType']){case _0x2124('0x39'):_0xfaed28(_0x28c51d)[_0x2124('0x2b')](_0x102e24());break;case'onlyIfOpen':_0x1d82ca(_0x28c51d)[_0x2124('0x2b')](_0x102e24());break;default:_0x5f5b97['CmHopper'][_0x2124('0x24')]({'phone':_0x215716['phone'],'ContactId':_0x215716['id'],'ListId':_0x215716['ListId'],'scheduledat':_0x215716[_0x2124('0x16')]?_0x215716[_0x2124('0x16')]:moment()[_0x2124('0x17')](_0x2124('0x1f')),'priority':_0x215716[_0x2124('0x26')]?_0x215716[_0x2124('0x26')]:0x2,'callback':_0x215716['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x215716[_0x2124('0x27')]?_0x215716['callbackUniqueid']:undefined,'callbackat':_0x215716['callbackUniqueid']?moment()[_0x2124('0x17')](_0x2124('0x1f')):undefined,'CampaignId':_0x28c51d['id']})[_0x2124('0x2b')](_0x102e24());}}}});})[_0x2124('0x1a')](function(){return _0x5f5b97['Campaign'][_0x2124('0x34')]({'attributes':['id'],'include':[{'model':_0x5f5b97[_0x2124('0x36')],'as':_0x2124('0x3b'),'where':{'id':_0x215716['ListId']}}]})[_0x2124('0x1a')](function(_0x441878){if(_0x441878){var _0x3a7682=[];for(var _0x5bac18=0x0,_0x4508f8;_0x5bac18<_0x441878['length'];_0x5bac18+=0x1){_0x4508f8=_0x441878[_0x5bac18][_0x2124('0x14')]({'plain':!![]});_0x5f5b97[_0x2124('0x3f')][_0x2124('0x24')]({'phone':_0x215716[_0x2124('0xd')],'ContactId':_0x215716['id'],'ListId':_0x215716[_0x2124('0x25')],'CampaignId':_0x4508f8['id']})['catch'](function(_0x5117cd){logger[_0x2124('0x2c')](_0x2124('0x3d'),_0x2124('0x2e'),_0x5117cd[_0x2124('0x3e')]);});}}});})[_0x2124('0x1a')](function(){_0x543969();})[_0x2124('0x2b')](function(_0x205aa3){logger[_0x2124('0x2c')](_0x2124('0x3d'),'afterCreate',_0x205aa3[_0x2124('0x3e')]);_0x543969(_0x205aa3);});}else{_0x543969(new Error(_0x2124('0x40')));}},'afterDestroy':function(_0x83d0d5,_0x43edc8,_0x3b07cc){var _0x29da3d=_0x2cf886[_0x2124('0x41')];var _0x430437=_0x83d0d5[_0x2124('0x14')]({'plain':!![]});return _0x29da3d[_0x2124('0x21')][_0x2124('0x34')]({'raw':!![],'where':{'ListId':_0x430437[_0x2124('0x25')],'ContactId':_0x430437['id']}})['then'](function(_0x18c7bc){if(!_['isEmpty'](_0x18c7bc)){var _0x5ea209=[];for(var _0x324274=0x0;_0x324274<_0x18c7bc[_0x2124('0x3c')];_0x324274+=0x1){var _0xd60b6a=_0x29da3d[_0x2124('0x21')]['destroy']({'where':{'ListId':_0x18c7bc[_0x324274]['ListId'],'ContactId':_0x18c7bc[_0x324274][_0x2124('0x42')],'VoiceQueueId':_0x18c7bc[_0x324274]['VoiceQueueId'],'CampaignId':_0x18c7bc[_0x324274][_0x2124('0x43')]}});_0x5ea209['push'](_0xd60b6a);}return BPromise[_0x2124('0x44')](_0x5ea209);}})['then'](function(_0x18edde){logger[_0x2124('0x45')](_0x2124('0x46'),util['inspect'](_0x18edde,{'showHidden':![],'depth':null}));_0x3b07cc();})[_0x2124('0x2b')](function(_0xa67e5d){logger[_0x2124('0x2c')]('[CmContact][afterDestroy][Error]',util['inspect'](_0xa67e5d,{'showHidden':![],'depth':null}));_0x3b07cc(_0xa67e5d);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 5917636..7fc8094 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0xd19726,_0x13ce4a){var _0x3c4a14=function(_0x135837){while(--_0x135837){_0xd19726['push'](_0xd19726['shift']());}};_0x3c4a14(++_0x13ce4a);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x120de3,_0x271751){var _0x353a36=function(_0x2f8ab8){while(--_0x2f8ab8){_0x120de3['push'](_0x120de3['shift']());}};_0x353a36(++_0x271751);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index e3b3bca..e136c6a 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd49c=['exports','STRING','INTEGER','PHONE'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0xd49c,0x1d8));var _0xcd49=function(_0x2126e4,_0x191f80){_0x2126e4=_0x2126e4-0x0;var _0x53834a=_0xd49c[_0x2126e4];return _0x53834a;};'use strict';var Sequelize=require('sequelize');module[_0xcd49('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xcd49('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xcd49('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xcd49('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xcd49('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0xd4b6=['exports','STRING','INTEGER','PHONE','sequelize'];(function(_0x15f82c,_0x5ae939){var _0x3e832c=function(_0x2fc39d){while(--_0x2fc39d){_0x15f82c['push'](_0x15f82c['shift']());}};_0x3e832c(++_0x5ae939);}(_0xd4b6,0x13f));var _0x6d4b=function(_0x8e6eb,_0x40b670){_0x8e6eb=_0x8e6eb-0x0;var _0xbded8d=_0xd4b6[_0x8e6eb];return _0xbded8d;};'use strict';var Sequelize=require(_0x6d4b('0x0'));module[_0x6d4b('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x6d4b('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x6d4b('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x6d4b('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index c72f27a..403f396 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x498b=['eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','error','name','send','map','CmContactHasItem','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','options','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body'];(function(_0x29e542,_0x4a55ca){var _0x1b968a=function(_0x90f2c4){while(--_0x90f2c4){_0x29e542['push'](_0x29e542['shift']());}};_0x1b968a(++_0x4a55ca);}(_0x498b,0x1d4));var _0xb498=function(_0x4f5c0d,_0x265235){_0x4f5c0d=_0x4f5c0d-0x0;var _0x54afaf=_0x498b[_0x4f5c0d];return _0x54afaf;};'use strict';var emlformat=require(_0xb498('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb498('0x1'));var jsonpatch=require(_0xb498('0x2'));var rp=require(_0xb498('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb498('0x4'));var util=require('util');var path=require(_0xb498('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb498('0x6'));var fs=require('fs');var fs_extra=require(_0xb498('0x7'));var _=require('lodash');var squel=require(_0xb498('0x8'));var crypto=require(_0xb498('0x9'));var jsforce=require(_0xb498('0xa'));var deskjs=require(_0xb498('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb498('0xc'));var Redis=require('ioredis');var authService=require(_0xb498('0xd'));var qs=require(_0xb498('0xe'));var as=require(_0xb498('0xf'));var hardwareService=require(_0xb498('0x10'));var logger=require(_0xb498('0x11'))(_0xb498('0x12'));var utils=require(_0xb498('0x13'));var config=require(_0xb498('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xb498('0x15'))['db'];function respondWithStatusCode(_0xcd5d1d,_0x1c6ba9){_0x1c6ba9=_0x1c6ba9||0xcc;return function(_0x1c35a7){if(_0x1c35a7){return _0xcd5d1d[_0xb498('0x16')](_0x1c6ba9);}return _0xcd5d1d[_0xb498('0x17')](_0x1c6ba9)[_0xb498('0x18')]();};}function respondWithResult(_0x11ed29,_0x17bec3){_0x17bec3=_0x17bec3||0xc8;return function(_0x3c5f3a){if(_0x3c5f3a){return _0x11ed29[_0xb498('0x17')](_0x17bec3)[_0xb498('0x19')](_0x3c5f3a);}};}function respondWithFilteredResult(_0x1097f0,_0x51cc85){return function(_0x1bcbdd){if(_0x1bcbdd){var _0x127fcf=typeof _0x51cc85[_0xb498('0x1a')]===_0xb498('0x1b')&&typeof _0x51cc85['limit']===_0xb498('0x1b');var _0x475eff=_0x1bcbdd[_0xb498('0x1c')];var _0x42e772=_0x127fcf?0x0:_0x51cc85['offset'];var _0x4a0be4=_0x127fcf?_0x1bcbdd[_0xb498('0x1c')]:_0x51cc85[_0xb498('0x1a')]+_0x51cc85[_0xb498('0x1d')];var _0x31eafa;if(_0x4a0be4>=_0x475eff){_0x4a0be4=_0x475eff;_0x31eafa=0xc8;}else{_0x31eafa=0xce;}_0x1097f0[_0xb498('0x17')](_0x31eafa);return _0x1097f0[_0xb498('0x1e')]('Content-Range',_0x42e772+'-'+_0x4a0be4+'/'+_0x475eff)[_0xb498('0x19')](_0x1bcbdd);}return null;};}function patchUpdates(_0x80a07c){return function(_0x3cd64f){try{jsonpatch[_0xb498('0x1f')](_0x3cd64f,_0x80a07c,!![]);}catch(_0x2806cd){return BPromise[_0xb498('0x20')](_0x2806cd);}return _0x3cd64f[_0xb498('0x21')]();};}function saveUpdates(_0x4c806a,_0x4f23d8){return function(_0xdfaf09){if(_0xdfaf09){return _0xdfaf09['update'](_0x4c806a)[_0xb498('0x22')](function(_0x1e5735){return _0x1e5735;});}return null;};}function removeEntity(_0x24c6fe,_0x3f2abc){return function(_0x161496){if(_0x161496){return _0x161496[_0xb498('0x23')]()[_0xb498('0x22')](function(){var _0x2acb88=_0x161496['get']({'plain':!![]});var _0x2dc783='CmContactHasItems';return db['UserProfileResource'][_0xb498('0x23')]({'where':{'type':_0x2dc783,'resourceId':_0x2acb88['id']}})[_0xb498('0x22')](function(){return _0x161496;});})[_0xb498('0x22')](function(){_0x24c6fe[_0xb498('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a8e7d,_0x2498f4){return function(_0x5abef2){if(!_0x5abef2){_0x3a8e7d[_0xb498('0x16')](0x194);}return _0x5abef2;};}function handleError(_0x71c621,_0x54b3c9){_0x54b3c9=_0x54b3c9||0x1f4;return function(_0x5d70e3){logger[_0xb498('0x24')](_0x5d70e3['stack']);if(_0x5d70e3[_0xb498('0x25')]){delete _0x5d70e3['name'];}_0x71c621[_0xb498('0x17')](_0x54b3c9)[_0xb498('0x26')](_0x5d70e3);};}exports['index']=function(_0x2cafd6,_0x5cbffa){var _0x1da268={},_0x4f0735={},_0x3c3068={'count':0x0,'rows':[]};var _0x3e2753=_[_0xb498('0x27')](db[_0xb498('0x28')][_0xb498('0x29')],function(_0x510dc4){return{'name':_0x510dc4[_0xb498('0x2a')],'type':_0x510dc4['type']['key']};});_0x4f0735[_0xb498('0x2b')]=_['map'](_0x3e2753,'name');_0x4f0735[_0xb498('0x2c')]=_[_0xb498('0x2d')](_0x2cafd6[_0xb498('0x2c')]);_0x4f0735['filters']=_[_0xb498('0x2e')](_0x4f0735['model'],_0x4f0735[_0xb498('0x2c')]);_0x1da268['attributes']=_[_0xb498('0x2e')](_0x4f0735[_0xb498('0x2b')],qs[_0xb498('0x2f')](_0x2cafd6['query']['fields']));_0x1da268[_0xb498('0x30')]=_0x1da268[_0xb498('0x30')][_0xb498('0x31')]?_0x1da268[_0xb498('0x30')]:_0x4f0735[_0xb498('0x2b')];if(!_0x2cafd6[_0xb498('0x2c')]['hasOwnProperty'](_0xb498('0x32'))){_0x1da268[_0xb498('0x1d')]=qs[_0xb498('0x1d')](_0x2cafd6[_0xb498('0x2c')][_0xb498('0x1d')]);_0x1da268[_0xb498('0x1a')]=qs[_0xb498('0x1a')](_0x2cafd6['query']['offset']);}_0x1da268[_0xb498('0x33')]=qs[_0xb498('0x34')](_0x2cafd6[_0xb498('0x2c')][_0xb498('0x34')]);_0x1da268[_0xb498('0x35')]=qs[_0xb498('0x36')](_[_0xb498('0x37')](_0x2cafd6[_0xb498('0x2c')],_0x4f0735[_0xb498('0x36')]),_0x3e2753);if(_0x2cafd6[_0xb498('0x2c')][_0xb498('0x38')]){_0x1da268[_0xb498('0x35')]=_[_0xb498('0x39')](_0x1da268[_0xb498('0x35')],{'$or':_[_0xb498('0x27')](_0x3e2753,function(_0x5b62f2){if(_0x5b62f2[_0xb498('0x3a')]!==_0xb498('0x3b')){var _0x317d74={};_0x317d74[_0x5b62f2[_0xb498('0x25')]]={'$like':'%'+_0x2cafd6[_0xb498('0x2c')][_0xb498('0x38')]+'%'};return _0x317d74;}})});}_0x1da268=_[_0xb498('0x39')]({},_0x1da268,_0x2cafd6['options']);var _0x174629={'where':_0x1da268[_0xb498('0x35')]};return db['CmContactHasItem'][_0xb498('0x1c')](_0x174629)[_0xb498('0x22')](function(_0x49a795){_0x3c3068[_0xb498('0x1c')]=_0x49a795;if(_0x2cafd6[_0xb498('0x2c')][_0xb498('0x3c')]){_0x1da268['include']=[{'all':!![]}];}return db[_0xb498('0x28')][_0xb498('0x3d')](_0x1da268);})[_0xb498('0x22')](function(_0x324be8){_0x3c3068[_0xb498('0x3e')]=_0x324be8;return _0x3c3068;})[_0xb498('0x22')](respondWithFilteredResult(_0x5cbffa,_0x1da268))[_0xb498('0x3f')](handleError(_0x5cbffa,null));};exports[_0xb498('0x40')]=function(_0x204242,_0x2c99f9){var _0x438569={'raw':!![],'where':{'id':_0x204242[_0xb498('0x41')]['id']}},_0x2b596f={};_0x2b596f[_0xb498('0x2b')]=_[_0xb498('0x2d')](db[_0xb498('0x28')][_0xb498('0x29')]);_0x2b596f[_0xb498('0x2c')]=_['keys'](_0x204242['query']);_0x2b596f[_0xb498('0x36')]=_['intersection'](_0x2b596f[_0xb498('0x2b')],_0x2b596f[_0xb498('0x2c')]);_0x438569[_0xb498('0x30')]=_[_0xb498('0x2e')](_0x2b596f[_0xb498('0x2b')],qs[_0xb498('0x2f')](_0x204242['query'][_0xb498('0x2f')]));_0x438569[_0xb498('0x30')]=_0x438569['attributes'][_0xb498('0x31')]?_0x438569['attributes']:_0x2b596f[_0xb498('0x2b')];if(_0x204242[_0xb498('0x2c')][_0xb498('0x3c')]){_0x438569['include']=[{'all':!![]}];}_0x438569=_[_0xb498('0x39')]({},_0x438569,_0x204242[_0xb498('0x42')]);return db[_0xb498('0x28')]['find'](_0x438569)[_0xb498('0x22')](handleEntityNotFound(_0x2c99f9,null))['then'](respondWithResult(_0x2c99f9,null))['catch'](handleError(_0x2c99f9,null));};exports[_0xb498('0x43')]=function(_0xdc1e8b,_0x2893ec){return db['CmContactHasItem'][_0xb498('0x43')](_0xdc1e8b['body'],{})['then'](function(_0x5452b3){var _0x26c29b=_0xdc1e8b[_0xb498('0x44')][_0xb498('0x45')]({'plain':!![]});if(!_0x26c29b)throw new Error(_0xb498('0x46'));if(_0x26c29b[_0xb498('0x47')]==='user'){var _0x383485=_0x5452b3[_0xb498('0x45')]({'plain':!![]});var _0x2d2fbd=_0xb498('0x48');return db[_0xb498('0x49')][_0xb498('0x4a')]({'where':{'name':_0x2d2fbd,'userProfileId':_0x26c29b['userProfileId']},'raw':!![]})['then'](function(_0x2aaa70){if(_0x2aaa70&&_0x2aaa70['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x383485['name'],'resourceId':_0x383485['id'],'type':_0x2aaa70['name'],'sectionId':_0x2aaa70['id']},{})['then'](function(){return _0x5452b3;});}else{return _0x5452b3;}})[_0xb498('0x3f')](function(_0xf47d9d){logger[_0xb498('0x24')](_0xb498('0x4b'),_0xf47d9d);throw _0xf47d9d;});}return _0x5452b3;})['then'](respondWithResult(_0x2893ec,0xc9))['catch'](handleError(_0x2893ec,null));};exports[_0xb498('0x4c')]=function(_0x419d44,_0x424c2a){if(_0x419d44[_0xb498('0x4d')]['id']){delete _0x419d44[_0xb498('0x4d')]['id'];}return db[_0xb498('0x28')][_0xb498('0x4a')]({'where':{'id':_0x419d44[_0xb498('0x41')]['id']}})[_0xb498('0x22')](handleEntityNotFound(_0x424c2a,null))[_0xb498('0x22')](saveUpdates(_0x419d44['body'],null))['then'](respondWithResult(_0x424c2a,null))[_0xb498('0x3f')](handleError(_0x424c2a,null));};exports[_0xb498('0x23')]=function(_0x95a863,_0x21cc0f){return db['CmContactHasItem']['find']({'where':{'id':_0x95a863[_0xb498('0x41')]['id']}})[_0xb498('0x22')](handleEntityNotFound(_0x21cc0f,null))['then'](removeEntity(_0x21cc0f,null))[_0xb498('0x3f')](handleError(_0x21cc0f,null));}; \ No newline at end of file +var _0xef88=['sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','show','includeAll','catch','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','end','error','stack','name','send','index','CmContactHasItem','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order'];(function(_0x4d726e,_0x80a8f8){var _0x58166f=function(_0x33e6b6){while(--_0x33e6b6){_0x4d726e['push'](_0x4d726e['shift']());}};_0x58166f(++_0x80a8f8);}(_0xef88,0x10f));var _0x8ef8=function(_0x368084,_0x401d23){_0x368084=_0x368084-0x0;var _0x2e4477=_0xef88[_0x368084];return _0x2e4477;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ef8('0x0'));var zipdir=require(_0x8ef8('0x1'));var jsonpatch=require(_0x8ef8('0x2'));var rp=require('request-promise');var moment=require(_0x8ef8('0x3'));var BPromise=require(_0x8ef8('0x4'));var Mustache=require(_0x8ef8('0x5'));var util=require(_0x8ef8('0x6'));var path=require(_0x8ef8('0x7'));var sox=require('sox');var csv=require(_0x8ef8('0x8'));var ejs=require(_0x8ef8('0x9'));var fs=require('fs');var fs_extra=require(_0x8ef8('0xa'));var _=require(_0x8ef8('0xb'));var squel=require(_0x8ef8('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8ef8('0xd'));var toCsv=require(_0x8ef8('0x8'));var querystring=require(_0x8ef8('0xe'));var Papa=require(_0x8ef8('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8ef8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ef8('0x11'))(_0x8ef8('0x12'));var utils=require(_0x8ef8('0x13'));var config=require(_0x8ef8('0x14'));var licenseUtil=require(_0x8ef8('0x15'));var db=require(_0x8ef8('0x16'))['db'];function respondWithStatusCode(_0x5a2592,_0x343973){_0x343973=_0x343973||0xcc;return function(_0x2e3ca1){if(_0x2e3ca1){return _0x5a2592[_0x8ef8('0x17')](_0x343973);}return _0x5a2592[_0x8ef8('0x18')](_0x343973)['end']();};}function respondWithResult(_0x7d483f,_0x5847e8){_0x5847e8=_0x5847e8||0xc8;return function(_0x192ba7){if(_0x192ba7){return _0x7d483f[_0x8ef8('0x18')](_0x5847e8)[_0x8ef8('0x19')](_0x192ba7);}};}function respondWithFilteredResult(_0x10c22c,_0xa43984){return function(_0x3e0838){if(_0x3e0838){var _0x3e39e2=typeof _0xa43984[_0x8ef8('0x1a')]===_0x8ef8('0x1b')&&typeof _0xa43984['limit']===_0x8ef8('0x1b');var _0x2067d6=_0x3e0838[_0x8ef8('0x1c')];var _0x20f80d=_0x3e39e2?0x0:_0xa43984[_0x8ef8('0x1a')];var _0x1050fb=_0x3e39e2?_0x3e0838[_0x8ef8('0x1c')]:_0xa43984[_0x8ef8('0x1a')]+_0xa43984['limit'];var _0x1e932a;if(_0x1050fb>=_0x2067d6){_0x1050fb=_0x2067d6;_0x1e932a=0xc8;}else{_0x1e932a=0xce;}_0x10c22c[_0x8ef8('0x18')](_0x1e932a);return _0x10c22c[_0x8ef8('0x1d')](_0x8ef8('0x1e'),_0x20f80d+'-'+_0x1050fb+'/'+_0x2067d6)[_0x8ef8('0x19')](_0x3e0838);}return null;};}function patchUpdates(_0x12472a){return function(_0x13567a){try{jsonpatch['apply'](_0x13567a,_0x12472a,!![]);}catch(_0x1165a4){return BPromise[_0x8ef8('0x1f')](_0x1165a4);}return _0x13567a[_0x8ef8('0x20')]();};}function saveUpdates(_0x540d8d,_0x4c308d){return function(_0x46cf64){if(_0x46cf64){return _0x46cf64[_0x8ef8('0x21')](_0x540d8d)[_0x8ef8('0x22')](function(_0x5b2d55){return _0x5b2d55;});}return null;};}function removeEntity(_0x5d8ad9,_0x14abb8){return function(_0x209ded){if(_0x209ded){return _0x209ded[_0x8ef8('0x23')]()['then'](function(){var _0x22f82e=_0x209ded[_0x8ef8('0x24')]({'plain':!![]});var _0x2d2abf=_0x8ef8('0x25');return db[_0x8ef8('0x26')][_0x8ef8('0x23')]({'where':{'type':_0x2d2abf,'resourceId':_0x22f82e['id']}})[_0x8ef8('0x22')](function(){return _0x209ded;});})['then'](function(){_0x5d8ad9['status'](0xcc)[_0x8ef8('0x27')]();});}};}function handleEntityNotFound(_0x3d786e,_0x569cc2){return function(_0x4ad4b1){if(!_0x4ad4b1){_0x3d786e['sendStatus'](0x194);}return _0x4ad4b1;};}function handleError(_0x286b5c,_0x17134d){_0x17134d=_0x17134d||0x1f4;return function(_0x2353d5){logger[_0x8ef8('0x28')](_0x2353d5[_0x8ef8('0x29')]);if(_0x2353d5[_0x8ef8('0x2a')]){delete _0x2353d5[_0x8ef8('0x2a')];}_0x286b5c[_0x8ef8('0x18')](_0x17134d)[_0x8ef8('0x2b')](_0x2353d5);};}exports[_0x8ef8('0x2c')]=function(_0x102572,_0x31ced3){var _0x1ca1a3={},_0x5f3734={},_0x3e1a82={'count':0x0,'rows':[]};var _0x5ed230=_['map'](db[_0x8ef8('0x2d')][_0x8ef8('0x2e')],function(_0x27c028){return{'name':_0x27c028[_0x8ef8('0x2f')],'type':_0x27c028[_0x8ef8('0x30')]['key']};});_0x5f3734[_0x8ef8('0x31')]=_[_0x8ef8('0x32')](_0x5ed230,_0x8ef8('0x2a'));_0x5f3734[_0x8ef8('0x33')]=_[_0x8ef8('0x34')](_0x102572[_0x8ef8('0x33')]);_0x5f3734['filters']=_['intersection'](_0x5f3734[_0x8ef8('0x31')],_0x5f3734[_0x8ef8('0x33')]);_0x1ca1a3['attributes']=_[_0x8ef8('0x35')](_0x5f3734[_0x8ef8('0x31')],qs[_0x8ef8('0x36')](_0x102572['query'][_0x8ef8('0x36')]));_0x1ca1a3[_0x8ef8('0x37')]=_0x1ca1a3[_0x8ef8('0x37')][_0x8ef8('0x38')]?_0x1ca1a3[_0x8ef8('0x37')]:_0x5f3734[_0x8ef8('0x31')];if(!_0x102572[_0x8ef8('0x33')][_0x8ef8('0x39')](_0x8ef8('0x3a'))){_0x1ca1a3[_0x8ef8('0x3b')]=qs[_0x8ef8('0x3b')](_0x102572[_0x8ef8('0x33')][_0x8ef8('0x3b')]);_0x1ca1a3[_0x8ef8('0x1a')]=qs[_0x8ef8('0x1a')](_0x102572['query']['offset']);}_0x1ca1a3[_0x8ef8('0x3c')]=qs['sort'](_0x102572[_0x8ef8('0x33')][_0x8ef8('0x3d')]);_0x1ca1a3[_0x8ef8('0x3e')]=qs[_0x8ef8('0x3f')](_['pick'](_0x102572[_0x8ef8('0x33')],_0x5f3734[_0x8ef8('0x3f')]),_0x5ed230);if(_0x102572[_0x8ef8('0x33')][_0x8ef8('0x40')]){_0x1ca1a3['where']=_[_0x8ef8('0x41')](_0x1ca1a3['where'],{'$or':_[_0x8ef8('0x32')](_0x5ed230,function(_0x397428){if(_0x397428[_0x8ef8('0x30')]!==_0x8ef8('0x42')){var _0x4c903a={};_0x4c903a[_0x397428[_0x8ef8('0x2a')]]={'$like':'%'+_0x102572[_0x8ef8('0x33')]['filter']+'%'};return _0x4c903a;}})});}_0x1ca1a3=_[_0x8ef8('0x41')]({},_0x1ca1a3,_0x102572[_0x8ef8('0x43')]);var _0x36e217={'where':_0x1ca1a3[_0x8ef8('0x3e')]};return db['CmContactHasItem']['count'](_0x36e217)[_0x8ef8('0x22')](function(_0x342c9e){_0x3e1a82[_0x8ef8('0x1c')]=_0x342c9e;if(_0x102572['query']['includeAll']){_0x1ca1a3[_0x8ef8('0x44')]=[{'all':!![]}];}return db[_0x8ef8('0x2d')][_0x8ef8('0x45')](_0x1ca1a3);})[_0x8ef8('0x22')](function(_0x597517){_0x3e1a82[_0x8ef8('0x46')]=_0x597517;return _0x3e1a82;})['then'](respondWithFilteredResult(_0x31ced3,_0x1ca1a3))['catch'](handleError(_0x31ced3,null));};exports[_0x8ef8('0x47')]=function(_0x5c5edf,_0x50c17b){var _0x1f3279={'raw':!![],'where':{'id':_0x5c5edf['params']['id']}},_0x21acd5={};_0x21acd5[_0x8ef8('0x31')]=_['keys'](db[_0x8ef8('0x2d')][_0x8ef8('0x2e')]);_0x21acd5[_0x8ef8('0x33')]=_[_0x8ef8('0x34')](_0x5c5edf[_0x8ef8('0x33')]);_0x21acd5[_0x8ef8('0x3f')]=_['intersection'](_0x21acd5['model'],_0x21acd5[_0x8ef8('0x33')]);_0x1f3279['attributes']=_[_0x8ef8('0x35')](_0x21acd5[_0x8ef8('0x31')],qs[_0x8ef8('0x36')](_0x5c5edf[_0x8ef8('0x33')][_0x8ef8('0x36')]));_0x1f3279[_0x8ef8('0x37')]=_0x1f3279[_0x8ef8('0x37')][_0x8ef8('0x38')]?_0x1f3279[_0x8ef8('0x37')]:_0x21acd5['model'];if(_0x5c5edf[_0x8ef8('0x33')][_0x8ef8('0x48')]){_0x1f3279[_0x8ef8('0x44')]=[{'all':!![]}];}_0x1f3279=_[_0x8ef8('0x41')]({},_0x1f3279,_0x5c5edf['options']);return db[_0x8ef8('0x2d')]['find'](_0x1f3279)[_0x8ef8('0x22')](handleEntityNotFound(_0x50c17b,null))['then'](respondWithResult(_0x50c17b,null))[_0x8ef8('0x49')](handleError(_0x50c17b,null));};exports[_0x8ef8('0x4a')]=function(_0x2ec9a6,_0x33a1b8){return db[_0x8ef8('0x2d')][_0x8ef8('0x4a')](_0x2ec9a6[_0x8ef8('0x4b')],{})[_0x8ef8('0x22')](function(_0x4acf1c){var _0x5a35cd=_0x2ec9a6[_0x8ef8('0x4c')][_0x8ef8('0x24')]({'plain':!![]});if(!_0x5a35cd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a35cd[_0x8ef8('0x4d')]===_0x8ef8('0x4c')){var _0x8c0b58=_0x4acf1c[_0x8ef8('0x24')]({'plain':!![]});var _0x654390='CmContactHasItems';return db['UserProfileSection']['find']({'where':{'name':_0x654390,'userProfileId':_0x5a35cd[_0x8ef8('0x4e')]},'raw':!![]})[_0x8ef8('0x22')](function(_0x473ef1){if(_0x473ef1&&_0x473ef1[_0x8ef8('0x4f')]===0x0){return db[_0x8ef8('0x26')][_0x8ef8('0x4a')]({'name':_0x8c0b58[_0x8ef8('0x2a')],'resourceId':_0x8c0b58['id'],'type':_0x473ef1[_0x8ef8('0x2a')],'sectionId':_0x473ef1['id']},{})[_0x8ef8('0x22')](function(){return _0x4acf1c;});}else{return _0x4acf1c;}})[_0x8ef8('0x49')](function(_0x3e77d4){logger[_0x8ef8('0x28')](_0x8ef8('0x50'),_0x3e77d4);throw _0x3e77d4;});}return _0x4acf1c;})[_0x8ef8('0x22')](respondWithResult(_0x33a1b8,0xc9))[_0x8ef8('0x49')](handleError(_0x33a1b8,null));};exports['update']=function(_0x42a0c4,_0x44ae1e){if(_0x42a0c4[_0x8ef8('0x4b')]['id']){delete _0x42a0c4[_0x8ef8('0x4b')]['id'];}return db['CmContactHasItem'][_0x8ef8('0x51')]({'where':{'id':_0x42a0c4['params']['id']}})[_0x8ef8('0x22')](handleEntityNotFound(_0x44ae1e,null))[_0x8ef8('0x22')](saveUpdates(_0x42a0c4[_0x8ef8('0x4b')],null))[_0x8ef8('0x22')](respondWithResult(_0x44ae1e,null))[_0x8ef8('0x49')](handleError(_0x44ae1e,null));};exports[_0x8ef8('0x23')]=function(_0x809048,_0x7bdabc){return db[_0x8ef8('0x2d')][_0x8ef8('0x51')]({'where':{'id':_0x809048[_0x8ef8('0x52')]['id']}})[_0x8ef8('0x22')](handleEntityNotFound(_0x7bdabc,null))[_0x8ef8('0x22')](removeEntity(_0x7bdabc,null))[_0x8ef8('0x49')](handleError(_0x7bdabc,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index b18b6f5..42f7459 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f1e=['../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x749feb,_0x437662){var _0x5f5dfb=function(_0x2c9c8c){while(--_0x2c9c8c){_0x749feb['push'](_0x749feb['shift']());}};_0x5f5dfb(++_0x437662);}(_0x9f1e,0x12d));var _0xe9f1=function(_0x5a5559,_0x5b7a55){_0x5a5559=_0x5a5559-0x0;var _0x1b6d05=_0x9f1e[_0x5a5559];return _0x1b6d05;};'use strict';var _=require(_0xe9f1('0x0'));var util=require(_0xe9f1('0x1'));var logger=require('../../config/logger')(_0xe9f1('0x2'));var moment=require(_0xe9f1('0x3'));var BPromise=require(_0xe9f1('0x4'));var rp=require(_0xe9f1('0x5'));var fs=require('fs');var path=require(_0xe9f1('0x6'));var rimraf=require('rimraf');var config=require(_0xe9f1('0x7'));var attributes=require(_0xe9f1('0x8'));module[_0xe9f1('0x9')]=function(_0x4b1f8b,_0x24ae34){return _0x4b1f8b['define'](_0xe9f1('0xa'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa75a=['rimraf','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','util','../../config/logger','bluebird','request-promise'];(function(_0x1ce929,_0x4c0a6e){var _0x3506bd=function(_0x23a638){while(--_0x23a638){_0x1ce929['push'](_0x1ce929['shift']());}};_0x3506bd(++_0x4c0a6e);}(_0xa75a,0xc2));var _0xaa75=function(_0x45cd35,_0x41147c){_0x45cd35=_0x45cd35-0x0;var _0x16db84=_0xa75a[_0x45cd35];return _0x16db84;};'use strict';var _=require('lodash');var util=require(_0xaa75('0x0'));var logger=require(_0xaa75('0x1'))('api');var moment=require('moment');var BPromise=require(_0xaa75('0x2'));var rp=require(_0xaa75('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa75('0x4'));var config=require(_0xaa75('0x5'));var attributes=require(_0xaa75('0x6'));module[_0xaa75('0x7')]=function(_0x5a340b,_0x5a9b13){return _0x5a340b['define'](_0xaa75('0x8'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index cf82c10..c9f0118 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d6a=['CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','CmContactHasItem,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug'];(function(_0x2c0842,_0x2a68d7){var _0x8ed440=function(_0x36745c){while(--_0x36745c){_0x2c0842['push'](_0x2c0842['shift']());}};_0x8ed440(++_0x2a68d7);}(_0x0d6a,0x188));var _0xa0d6=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x0d6a[_0x55abd9];return _0x3e5669;};'use strict';var _=require(_0xa0d6('0x0'));var util=require('util');var moment=require(_0xa0d6('0x1'));var BPromise=require(_0xa0d6('0x2'));var rs=require(_0xa0d6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa0d6('0x4'))['db'];var utils=require(_0xa0d6('0x5'));var logger=require(_0xa0d6('0x6'))(_0xa0d6('0x7'));var config=require(_0xa0d6('0x8'));var jayson=require(_0xa0d6('0x9'));var client=jayson[_0xa0d6('0xa')][_0xa0d6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2948f8,_0x37372d,_0x1196ea){return new BPromise(function(_0x2064cd,_0x3936b6){return client[_0xa0d6('0xc')](_0x2948f8,_0x1196ea)[_0xa0d6('0xd')](function(_0x25d70f){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x37372d,_0xa0d6('0xe'));logger[_0xa0d6('0xf')](_0xa0d6('0x10'),_0x37372d,_0xa0d6('0xe'),JSON['stringify'](_0x25d70f));if(_0x25d70f[_0xa0d6('0x11')]){if(_0x25d70f[_0xa0d6('0x11')][_0xa0d6('0x12')]===0x1f4){logger[_0xa0d6('0x11')](_0xa0d6('0x13'),_0x37372d,_0x25d70f[_0xa0d6('0x11')]['message']);return _0x3936b6(_0x25d70f[_0xa0d6('0x11')][_0xa0d6('0x14')]);}logger[_0xa0d6('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x37372d,_0x25d70f['error'][_0xa0d6('0x14')]);return _0x2064cd(_0x25d70f[_0xa0d6('0x11')][_0xa0d6('0x14')]);}else{logger[_0xa0d6('0x15')](_0xa0d6('0x13'),_0x37372d,_0xa0d6('0xe'));_0x2064cd(_0x25d70f[_0xa0d6('0x16')][_0xa0d6('0x14')]);}})[_0xa0d6('0x17')](function(_0x6268a7){logger[_0xa0d6('0x11')](_0xa0d6('0x13'),_0x37372d,_0x6268a7);_0x3936b6(_0x6268a7);});});} \ No newline at end of file +var _0xafdb=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xafdb,0x177));var _0xbafd=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0xafdb[_0x238671];return _0x474844;};'use strict';var _=require('lodash');var util=require(_0xbafd('0x0'));var moment=require(_0xbafd('0x1'));var BPromise=require(_0xbafd('0x2'));var rs=require(_0xbafd('0x3'));var fs=require('fs');var Redis=require(_0xbafd('0x4'));var db=require(_0xbafd('0x5'))['db'];var utils=require(_0xbafd('0x6'));var logger=require(_0xbafd('0x7'))(_0xbafd('0x8'));var config=require(_0xbafd('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbafd('0xa')][_0xbafd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5277b2,_0x5d016d,_0x396e0a){return new BPromise(function(_0x2a4e08,_0xc7c94b){return client['request'](_0x5277b2,_0x396e0a)[_0xbafd('0xc')](function(_0x55f67d){logger['info'](_0xbafd('0xd'),_0x5d016d,_0xbafd('0xe'));logger['debug']('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x5d016d,_0xbafd('0xe'),JSON[_0xbafd('0xf')](_0x55f67d));if(_0x55f67d['error']){if(_0x55f67d['error'][_0xbafd('0x10')]===0x1f4){logger[_0xbafd('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x5d016d,_0x55f67d[_0xbafd('0x11')][_0xbafd('0x12')]);return _0xc7c94b(_0x55f67d[_0xbafd('0x11')][_0xbafd('0x12')]);}logger['error'](_0xbafd('0xd'),_0x5d016d,_0x55f67d[_0xbafd('0x11')][_0xbafd('0x12')]);return _0x2a4e08(_0x55f67d[_0xbafd('0x11')][_0xbafd('0x12')]);}else{logger[_0xbafd('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x5d016d,'request\x20sent');_0x2a4e08(_0x55f67d[_0xbafd('0x14')][_0xbafd('0x12')]);}})[_0xbafd('0x15')](function(_0x4b0fbb){logger[_0xbafd('0x11')](_0xbafd('0xd'),_0x5d016d,_0x4b0fbb);_0xc7c94b(_0x4b0fbb);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 2a83fd9..790c7bc 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb65a=['update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','show','post','put','/:id'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0xb65a,0x114));var _0xab65=function(_0x5042c8,_0x121f12){_0x5042c8=_0x5042c8-0x0;var _0x4b4b24=_0xb65a[_0x5042c8];return _0x4b4b24;};'use strict';var multer=require(_0xab65('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xab65('0x1'));var express=require(_0xab65('0x2'));var router=express[_0xab65('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xab65('0x4'));var config=require(_0xab65('0x5'));var controller=require(_0xab65('0x6'));router['get']('/',auth[_0xab65('0x7')](),controller['index']);router['get']('/:id',auth[_0xab65('0x7')](),controller[_0xab65('0x8')]);router[_0xab65('0x9')]('/',auth[_0xab65('0x7')](),controller['create']);router[_0xab65('0xa')](_0xab65('0xb'),auth[_0xab65('0x7')](),controller[_0xab65('0xc')]);router[_0xab65('0xd')](_0xab65('0xb'),auth[_0xab65('0x7')](),controller[_0xab65('0xe')]);module[_0xab65('0xf')]=router; \ No newline at end of file +var _0xe946=['fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0xc15b3f,_0x43c0f9){var _0x84d670=function(_0x375550){while(--_0x375550){_0xc15b3f['push'](_0xc15b3f['shift']());}};_0x84d670(++_0x43c0f9);}(_0xe946,0x1ef));var _0x6e94=function(_0x4057a5,_0x16d807){_0x4057a5=_0x4057a5-0x0;var _0x27c3dd=_0xe946[_0x4057a5];return _0x27c3dd;};'use strict';var multer=require(_0x6e94('0x0'));var util=require(_0x6e94('0x1'));var path=require(_0x6e94('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e94('0x3'));var router=express[_0x6e94('0x4')]();var fs_extra=require(_0x6e94('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6e94('0x6'));var config=require(_0x6e94('0x7'));var controller=require(_0x6e94('0x8'));router['get']('/',auth[_0x6e94('0x9')](),controller[_0x6e94('0xa')]);router[_0x6e94('0xb')](_0x6e94('0xc'),auth['isAuthenticated'](),controller[_0x6e94('0xd')]);router[_0x6e94('0xe')]('/',auth[_0x6e94('0x9')](),controller['create']);router[_0x6e94('0xf')](_0x6e94('0xc'),auth[_0x6e94('0x9')](),controller[_0x6e94('0x10')]);router[_0x6e94('0x11')](_0x6e94('0xc'),auth[_0x6e94('0x9')](),controller[_0x6e94('0x12')]);module[_0x6e94('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 7e0f72b..2e2e471 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 _0x066a=['lodash','exports','alias','STRING','getDataValue','name','TEXT','type','select','values','isArray','stringify','setDataValue','BOOLEAN','ENUM','voice','sequelize'];(function(_0x169726,_0x26592f){var _0x3863e7=function(_0x3d2579){while(--_0x3d2579){_0x169726['push'](_0x169726['shift']());}};_0x3863e7(++_0x26592f);}(_0x066a,0x175));var _0xa066=function(_0x20eb43,_0x56ce0b){_0x20eb43=_0x20eb43-0x0;var _0xf7b5dd=_0x066a[_0x20eb43];return _0xf7b5dd;};'use strict';var Sequelize=require(_0xa066('0x0'));var _=require(_0xa066('0x1'));module[_0xa066('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x36ccc9){return this['getDataValue'](_0xa066('0x3'));}},'alias':{'type':Sequelize[_0xa066('0x4')],'allowNull':![],'set':function(_0x11ce8e){this['setDataValue'](_0xa066('0x3'),_0x11ce8e?_0x11ce8e:this[_0xa066('0x5')](_0xa066('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xa066('0x7')]('long'),'get':function(){if(this[_0xa066('0x5')](_0xa066('0x8'))===_0xa066('0x9')){return JSON['parse'](this[_0xa066('0x5')](_0xa066('0xa')));}else{return this[_0xa066('0x5')](_0xa066('0xa'));}},'set':function(_0x4e417f){if(Array[_0xa066('0xb')](_0x4e417f)){this['setDataValue'](_0xa066('0xa'),JSON[_0xa066('0xc')](_0x4e417f));}else{this[_0xa066('0xd')]('values',_0x4e417f);}}},'required':{'type':Sequelize[_0xa066('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xa066('0xf')](_0xa066('0x10'))}}; \ No newline at end of file +var _0x79cf=['setDataValue','name','STRING','TEXT','long','parse','values','stringify','BOOLEAN','voice','exports','getDataValue','alias'];(function(_0x212a37,_0xf35b2e){var _0x5d0bf9=function(_0x51850f){while(--_0x51850f){_0x212a37['push'](_0x212a37['shift']());}};_0x5d0bf9(++_0xf35b2e);}(_0x79cf,0x10e));var _0xf79c=function(_0x434c22,_0x33bcc9){_0x434c22=_0x434c22-0x0;var _0x44eab7=_0x79cf[_0x434c22];return _0x44eab7;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0xf79c('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x340f92){return this[_0xf79c('0x1')](_0xf79c('0x2'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x479abb){this[_0xf79c('0x3')](_0xf79c('0x2'),_0x479abb?_0x479abb:this[_0xf79c('0x1')](_0xf79c('0x4')));}},'type':{'type':Sequelize[_0xf79c('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xf79c('0x6')](_0xf79c('0x7')),'get':function(){if(this[_0xf79c('0x1')]('type')==='select'){return JSON[_0xf79c('0x8')](this['getDataValue'](_0xf79c('0x9')));}else{return this[_0xf79c('0x1')](_0xf79c('0x9'));}},'set':function(_0x146a86){if(Array['isArray'](_0x146a86)){this[_0xf79c('0x3')](_0xf79c('0x9'),JSON[_0xf79c('0xa')](_0x146a86));}else{this[_0xf79c('0x3')](_0xf79c('0x9'),_0x146a86);}}},'required':{'type':Sequelize[_0xf79c('0xb')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xf79c('0xb')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xf79c('0xc'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 03a1fb4..ee47973 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 _0x1b73=['Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','CmCustomField','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','keys','find','body','create','transaction','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','sequelize','queryInterface','addColumn','cm_contacts','cf_%d','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','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','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set'];(function(_0x40e4c5,_0x3aa132){var _0x3326fb=function(_0x136720){while(--_0x136720){_0x40e4c5['push'](_0x40e4c5['shift']());}};_0x3326fb(++_0x3aa132);}(_0x1b73,0x8f));var _0x31b7=function(_0x53c98f,_0x25494a){_0x53c98f=_0x53c98f-0x0;var _0xaee92a=_0x1b73[_0x53c98f];return _0xaee92a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x31b7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x31b7('0x1'));var rp=require(_0x31b7('0x2'));var moment=require(_0x31b7('0x3'));var BPromise=require(_0x31b7('0x4'));var Mustache=require(_0x31b7('0x5'));var util=require('util');var path=require(_0x31b7('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x31b7('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x31b7('0x8'));var jsforce=require(_0x31b7('0x9'));var deskjs=require(_0x31b7('0xa'));var toCsv=require('to-csv');var querystring=require(_0x31b7('0xb'));var Papa=require(_0x31b7('0xc'));var Redis=require(_0x31b7('0xd'));var authService=require(_0x31b7('0xe'));var qs=require(_0x31b7('0xf'));var as=require(_0x31b7('0x10'));var hardwareService=require(_0x31b7('0x11'));var logger=require(_0x31b7('0x12'))('api');var utils=require(_0x31b7('0x13'));var config=require(_0x31b7('0x14'));var licenseUtil=require(_0x31b7('0x15'));var db=require(_0x31b7('0x16'))['db'];function respondWithStatusCode(_0x1c037c,_0x1f086d){_0x1f086d=_0x1f086d||0xcc;return function(_0x21fdf4){if(_0x21fdf4){return _0x1c037c[_0x31b7('0x17')](_0x1f086d);}return _0x1c037c[_0x31b7('0x18')](_0x1f086d)[_0x31b7('0x19')]();};}function respondWithResult(_0x2925fa,_0x4457df){_0x4457df=_0x4457df||0xc8;return function(_0x1aada0){if(_0x1aada0){return _0x2925fa[_0x31b7('0x18')](_0x4457df)['json'](_0x1aada0);}};}function respondWithFilteredResult(_0x58c333,_0x26e0ea){return function(_0x3b7417){if(_0x3b7417){var _0xa7d421=typeof _0x26e0ea[_0x31b7('0x1a')]==='undefined'&&typeof _0x26e0ea['limit']===_0x31b7('0x1b');var _0x297f22=_0x3b7417['count'];var _0x3d914c=_0xa7d421?0x0:_0x26e0ea['offset'];var _0xefb438=_0xa7d421?_0x3b7417[_0x31b7('0x1c')]:_0x26e0ea[_0x31b7('0x1a')]+_0x26e0ea[_0x31b7('0x1d')];var _0x5e42aa;if(_0xefb438>=_0x297f22){_0xefb438=_0x297f22;_0x5e42aa=0xc8;}else{_0x5e42aa=0xce;}_0x58c333[_0x31b7('0x18')](_0x5e42aa);return _0x58c333[_0x31b7('0x1e')](_0x31b7('0x1f'),_0x3d914c+'-'+_0xefb438+'/'+_0x297f22)[_0x31b7('0x20')](_0x3b7417);}return null;};}function patchUpdates(_0x617e9f){return function(_0x42827f){try{jsonpatch[_0x31b7('0x21')](_0x42827f,_0x617e9f,!![]);}catch(_0x4be8de){return BPromise[_0x31b7('0x22')](_0x4be8de);}return _0x42827f[_0x31b7('0x23')]();};}function saveUpdates(_0x5bdb19,_0x3aec5c){return function(_0x343766){if(_0x343766){return _0x343766[_0x31b7('0x24')](_0x5bdb19)[_0x31b7('0x25')](function(_0x4b5ac4){return _0x4b5ac4;});}return null;};}function removeEntity(_0xec19cd,_0x51ee35){return function(_0xe49d8b){if(_0xe49d8b){return _0xe49d8b[_0x31b7('0x26')]()[_0x31b7('0x25')](function(){_0xec19cd[_0x31b7('0x18')](0xcc)[_0x31b7('0x19')]();});}};}function handleEntityNotFound(_0x1b8562,_0x58acc7){return function(_0xcca502){if(!_0xcca502){_0x1b8562['sendStatus'](0x194);}return _0xcca502;};}function handleError(_0x260bdf,_0x2e6149){_0x2e6149=_0x2e6149||0x1f4;return function(_0x4dbceb){logger[_0x31b7('0x27')](_0x4dbceb['stack']);if(_0x4dbceb[_0x31b7('0x28')]){delete _0x4dbceb[_0x31b7('0x28')];}_0x260bdf['status'](_0x2e6149)[_0x31b7('0x29')](_0x4dbceb);};}exports[_0x31b7('0x2a')]=function(_0x2db676,_0x4cd0c4){var _0x2b2e07={},_0x3d6bc3={},_0x40637b={'count':0x0,'rows':[]};var _0x4507b6=_[_0x31b7('0x2b')](db[_0x31b7('0x2c')][_0x31b7('0x2d')],function(_0x461dea){return{'name':_0x461dea['fieldName'],'type':_0x461dea[_0x31b7('0x2e')][_0x31b7('0x2f')]};});_0x3d6bc3[_0x31b7('0x30')]=_['differenceBy'](_[_0x31b7('0x2b')](_0x4507b6,'name'),['name']);_0x3d6bc3[_0x31b7('0x31')]=_['keys'](_0x2db676[_0x31b7('0x31')]);_0x3d6bc3[_0x31b7('0x32')]=_[_0x31b7('0x33')](_0x3d6bc3[_0x31b7('0x30')],_0x3d6bc3[_0x31b7('0x31')]);_0x2b2e07['attributes']=_[_0x31b7('0x33')](_0x3d6bc3[_0x31b7('0x30')],qs[_0x31b7('0x34')](_0x2db676[_0x31b7('0x31')][_0x31b7('0x34')]));_0x2b2e07['attributes']=_0x2b2e07[_0x31b7('0x35')][_0x31b7('0x36')]?_0x2b2e07[_0x31b7('0x35')]:_0x3d6bc3[_0x31b7('0x30')];if(!_0x2db676['query'][_0x31b7('0x37')](_0x31b7('0x38'))){_0x2b2e07[_0x31b7('0x1d')]=qs[_0x31b7('0x1d')](_0x2db676[_0x31b7('0x31')][_0x31b7('0x1d')]);_0x2b2e07['offset']=qs[_0x31b7('0x1a')](_0x2db676[_0x31b7('0x31')][_0x31b7('0x1a')]);}_0x2b2e07[_0x31b7('0x39')]=qs[_0x31b7('0x3a')](_0x2db676[_0x31b7('0x31')][_0x31b7('0x3a')]);_0x2b2e07[_0x31b7('0x3b')]=qs[_0x31b7('0x32')](_[_0x31b7('0x3c')](_0x2db676['query'],_0x3d6bc3[_0x31b7('0x32')]),_0x4507b6);if(_0x2db676[_0x31b7('0x31')]['filter']){_0x2b2e07[_0x31b7('0x3b')]=_[_0x31b7('0x3d')](_0x2b2e07[_0x31b7('0x3b')],{'$or':_[_0x31b7('0x2b')](_0x4507b6,function(_0x900cdf){if(_0x900cdf[_0x31b7('0x2e')]!==_0x31b7('0x3e')){var _0x101713={};_0x101713[_0x900cdf[_0x31b7('0x28')]]={'$like':'%'+_0x2db676['query'][_0x31b7('0x3f')]+'%'};return _0x101713;}})});}_0x2b2e07=_['merge']({},_0x2b2e07,_0x2db676[_0x31b7('0x40')]);var _0x4bf145={'where':_0x2b2e07[_0x31b7('0x3b')]};return db[_0x31b7('0x2c')][_0x31b7('0x1c')](_0x4bf145)[_0x31b7('0x25')](function(_0x344945){_0x40637b[_0x31b7('0x1c')]=_0x344945;if(_0x2db676[_0x31b7('0x31')][_0x31b7('0x41')]){_0x2b2e07[_0x31b7('0x42')]=[{'all':!![]}];}return db[_0x31b7('0x2c')][_0x31b7('0x43')](_0x2b2e07);})['then'](function(_0x9e83e4){_0x40637b['rows']=_0x9e83e4;return _0x40637b;})[_0x31b7('0x25')](respondWithFilteredResult(_0x4cd0c4,_0x2b2e07))[_0x31b7('0x44')](handleError(_0x4cd0c4,null));};exports['show']=function(_0x53f92f,_0x2b65f1){var _0x57f4ce={'raw':!![],'where':{'id':_0x53f92f[_0x31b7('0x45')]['id']}},_0x3b47cf={};_0x3b47cf[_0x31b7('0x30')]=_[_0x31b7('0x46')](db[_0x31b7('0x2c')][_0x31b7('0x2d')]);_0x3b47cf[_0x31b7('0x31')]=_[_0x31b7('0x46')](_0x53f92f[_0x31b7('0x31')]);_0x3b47cf['filters']=_[_0x31b7('0x33')](_0x3b47cf[_0x31b7('0x30')],_0x3b47cf['query']);_0x57f4ce[_0x31b7('0x35')]=_[_0x31b7('0x33')](_0x3b47cf['model'],qs[_0x31b7('0x34')](_0x53f92f[_0x31b7('0x31')][_0x31b7('0x34')]));_0x57f4ce[_0x31b7('0x35')]=_0x57f4ce['attributes']['length']?_0x57f4ce[_0x31b7('0x35')]:_0x3b47cf[_0x31b7('0x30')];if(_0x53f92f[_0x31b7('0x31')]['includeAll']){_0x57f4ce['include']=[{'all':!![]}];}_0x57f4ce=_[_0x31b7('0x3d')]({},_0x57f4ce,_0x53f92f[_0x31b7('0x40')]);return db[_0x31b7('0x2c')][_0x31b7('0x47')](_0x57f4ce)[_0x31b7('0x25')](handleEntityNotFound(_0x2b65f1,null))['then'](respondWithResult(_0x2b65f1,null))[_0x31b7('0x44')](handleError(_0x2b65f1,null));};exports[_0x31b7('0x24')]=function(_0x107c7b,_0x4c7aca){if(_0x107c7b[_0x31b7('0x48')]['id']){delete _0x107c7b[_0x31b7('0x48')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0x107c7b['params']['id']}})[_0x31b7('0x25')](handleEntityNotFound(_0x4c7aca,null))['then'](saveUpdates(_0x107c7b[_0x31b7('0x48')],null))['then'](respondWithResult(_0x4c7aca,null))[_0x31b7('0x44')](handleError(_0x4c7aca,null));};exports[_0x31b7('0x26')]=function(_0x1b788f,_0x1b86be){return db['CmCustomField'][_0x31b7('0x47')]({'where':{'id':_0x1b788f[_0x31b7('0x45')]['id']}})['then'](handleEntityNotFound(_0x1b86be,null))['then'](removeEntity(_0x1b86be,null))[_0x31b7('0x44')](handleError(_0x1b86be,null));};exports[_0x31b7('0x49')]=function(_0x4f3b96,_0x2bd6c7){var _0x5c25aa;return db['sequelize'][_0x31b7('0x4a')](function(_0x4f9a97){return db[_0x31b7('0x2c')][_0x31b7('0x49')](_0x4f3b96[_0x31b7('0x48')],{'transaction':_0x4f9a97})['then'](function(_0x38cb06){_0x5c25aa=_0x38cb06;var _0x1b402b={'type':db[_0x31b7('0x4b')][_0x31b7('0x4c')],'transaction':_0x4f9a97};switch(_0x4f3b96[_0x31b7('0x48')][_0x31b7('0x2e')]){case _0x31b7('0x4d'):_0x1b402b['type']=db[_0x31b7('0x4b')]['TEXT'];break;case _0x31b7('0x4e'):_0x1b402b['type']=db[_0x31b7('0x4b')][_0x31b7('0x4f')];break;case _0x31b7('0x50'):_0x1b402b['type']=db[_0x31b7('0x4b')]['BOOLEAN'];_0x1b402b[_0x31b7('0x51')]=![];break;default:}return db[_0x31b7('0x52')][_0x31b7('0x53')][_0x31b7('0x54')](_0x31b7('0x55'),util['format'](_0x31b7('0x56'),_0x5c25aa['id']),_0x1b402b);})[_0x31b7('0x25')](function(){return _0x5c25aa;});})['then'](respondWithResult(_0x2bd6c7,0xc9))[_0x31b7('0x44')](handleError(_0x2bd6c7,null));}; \ No newline at end of file +var _0xf17b=['mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','save','then','error','stack','name','send','index','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','findAll','rows','catch','show','length','include','update','body','find','params','create','transaction','Sequelize','text','TEXT','number','switch','BOOLEAN','sequelize','addColumn','cm_contacts','format','cf_%d','eml-format','fast-json-patch','request-promise','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf17b,0x1af));var _0xbf17=function(_0x14914a,_0x3eae81){_0x14914a=_0x14914a-0x0;var _0x3766ec=_0xf17b[_0x14914a];return _0x3766ec;};'use strict';var emlformat=require(_0xbf17('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbf17('0x1'));var rp=require(_0xbf17('0x2'));var moment=require(_0xbf17('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbf17('0x4'));var util=require(_0xbf17('0x5'));var path=require(_0xbf17('0x6'));var sox=require(_0xbf17('0x7'));var csv=require(_0xbf17('0x8'));var ejs=require(_0xbf17('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbf17('0xa'));var squel=require(_0xbf17('0xb'));var crypto=require(_0xbf17('0xc'));var jsforce=require(_0xbf17('0xd'));var deskjs=require(_0xbf17('0xe'));var toCsv=require(_0xbf17('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbf17('0xf'));var authService=require(_0xbf17('0x10'));var qs=require(_0xbf17('0x11'));var as=require(_0xbf17('0x12'));var hardwareService=require(_0xbf17('0x13'));var logger=require('../../config/logger')(_0xbf17('0x14'));var utils=require(_0xbf17('0x15'));var config=require(_0xbf17('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbf17('0x17'))['db'];function respondWithStatusCode(_0x1a0a8c,_0x28d059){_0x28d059=_0x28d059||0xcc;return function(_0x16601d){if(_0x16601d){return _0x1a0a8c[_0xbf17('0x18')](_0x28d059);}return _0x1a0a8c[_0xbf17('0x19')](_0x28d059)[_0xbf17('0x1a')]();};}function respondWithResult(_0x483d12,_0x43a20e){_0x43a20e=_0x43a20e||0xc8;return function(_0x7fd11b){if(_0x7fd11b){return _0x483d12[_0xbf17('0x19')](_0x43a20e)['json'](_0x7fd11b);}};}function respondWithFilteredResult(_0x193694,_0x58ab54){return function(_0x573753){if(_0x573753){var _0x579cee=typeof _0x58ab54['offset']===_0xbf17('0x1b')&&typeof _0x58ab54[_0xbf17('0x1c')]===_0xbf17('0x1b');var _0x23aeb4=_0x573753[_0xbf17('0x1d')];var _0x3048dd=_0x579cee?0x0:_0x58ab54[_0xbf17('0x1e')];var _0x1eaa18=_0x579cee?_0x573753[_0xbf17('0x1d')]:_0x58ab54[_0xbf17('0x1e')]+_0x58ab54['limit'];var _0x202ebb;if(_0x1eaa18>=_0x23aeb4){_0x1eaa18=_0x23aeb4;_0x202ebb=0xc8;}else{_0x202ebb=0xce;}_0x193694[_0xbf17('0x19')](_0x202ebb);return _0x193694[_0xbf17('0x1f')](_0xbf17('0x20'),_0x3048dd+'-'+_0x1eaa18+'/'+_0x23aeb4)['json'](_0x573753);}return null;};}function patchUpdates(_0x19ac53){return function(_0xd2f58f){try{jsonpatch[_0xbf17('0x21')](_0xd2f58f,_0x19ac53,!![]);}catch(_0x8ccbdf){return BPromise['reject'](_0x8ccbdf);}return _0xd2f58f[_0xbf17('0x22')]();};}function saveUpdates(_0x110ba9,_0x5e7922){return function(_0x1dd46c){if(_0x1dd46c){return _0x1dd46c['update'](_0x110ba9)[_0xbf17('0x23')](function(_0x35a88e){return _0x35a88e;});}return null;};}function removeEntity(_0x1c89f7,_0x24d583){return function(_0x5b7f5b){if(_0x5b7f5b){return _0x5b7f5b['destroy']()['then'](function(){_0x1c89f7[_0xbf17('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d0773,_0x8c7295){return function(_0x5a6b06){if(!_0x5a6b06){_0x9d0773[_0xbf17('0x18')](0x194);}return _0x5a6b06;};}function handleError(_0x37a149,_0x5c19ad){_0x5c19ad=_0x5c19ad||0x1f4;return function(_0x27ce06){logger[_0xbf17('0x24')](_0x27ce06[_0xbf17('0x25')]);if(_0x27ce06['name']){delete _0x27ce06[_0xbf17('0x26')];}_0x37a149[_0xbf17('0x19')](_0x5c19ad)[_0xbf17('0x27')](_0x27ce06);};}exports[_0xbf17('0x28')]=function(_0x52b4e9,_0x3e6dc7){var _0x8d07e2={},_0x2ad726={},_0x844cc6={'count':0x0,'rows':[]};var _0x317f5f=_['map'](db[_0xbf17('0x29')][_0xbf17('0x2a')],function(_0x4304ba){return{'name':_0x4304ba[_0xbf17('0x2b')],'type':_0x4304ba[_0xbf17('0x2c')]['key']};});_0x2ad726[_0xbf17('0x2d')]=_[_0xbf17('0x2e')](_[_0xbf17('0x2f')](_0x317f5f,'name'),[_0xbf17('0x26')]);_0x2ad726[_0xbf17('0x30')]=_[_0xbf17('0x31')](_0x52b4e9[_0xbf17('0x30')]);_0x2ad726['filters']=_['intersection'](_0x2ad726[_0xbf17('0x2d')],_0x2ad726['query']);_0x8d07e2[_0xbf17('0x32')]=_[_0xbf17('0x33')](_0x2ad726['model'],qs[_0xbf17('0x34')](_0x52b4e9['query']['fields']));_0x8d07e2[_0xbf17('0x32')]=_0x8d07e2[_0xbf17('0x32')]['length']?_0x8d07e2[_0xbf17('0x32')]:_0x2ad726['model'];if(!_0x52b4e9[_0xbf17('0x30')][_0xbf17('0x35')](_0xbf17('0x36'))){_0x8d07e2[_0xbf17('0x1c')]=qs[_0xbf17('0x1c')](_0x52b4e9[_0xbf17('0x30')][_0xbf17('0x1c')]);_0x8d07e2[_0xbf17('0x1e')]=qs[_0xbf17('0x1e')](_0x52b4e9['query'][_0xbf17('0x1e')]);}_0x8d07e2[_0xbf17('0x37')]=qs[_0xbf17('0x38')](_0x52b4e9['query'][_0xbf17('0x38')]);_0x8d07e2[_0xbf17('0x39')]=qs[_0xbf17('0x3a')](_[_0xbf17('0x3b')](_0x52b4e9[_0xbf17('0x30')],_0x2ad726['filters']),_0x317f5f);if(_0x52b4e9[_0xbf17('0x30')]['filter']){_0x8d07e2[_0xbf17('0x39')]=_['merge'](_0x8d07e2[_0xbf17('0x39')],{'$or':_[_0xbf17('0x2f')](_0x317f5f,function(_0x3123f7){if(_0x3123f7[_0xbf17('0x2c')]!==_0xbf17('0x3c')){var _0x55feb3={};_0x55feb3[_0x3123f7[_0xbf17('0x26')]]={'$like':'%'+_0x52b4e9['query'][_0xbf17('0x3d')]+'%'};return _0x55feb3;}})});}_0x8d07e2=_[_0xbf17('0x3e')]({},_0x8d07e2,_0x52b4e9[_0xbf17('0x3f')]);var _0x3ec1ec={'where':_0x8d07e2[_0xbf17('0x39')]};return db['CmCustomField']['count'](_0x3ec1ec)[_0xbf17('0x23')](function(_0x2c79cf){_0x844cc6['count']=_0x2c79cf;if(_0x52b4e9['query']['includeAll']){_0x8d07e2['include']=[{'all':!![]}];}return db[_0xbf17('0x29')][_0xbf17('0x40')](_0x8d07e2);})[_0xbf17('0x23')](function(_0x577e11){_0x844cc6[_0xbf17('0x41')]=_0x577e11;return _0x844cc6;})[_0xbf17('0x23')](respondWithFilteredResult(_0x3e6dc7,_0x8d07e2))[_0xbf17('0x42')](handleError(_0x3e6dc7,null));};exports[_0xbf17('0x43')]=function(_0x2d12e5,_0x483406){var _0x301099={'raw':!![],'where':{'id':_0x2d12e5['params']['id']}},_0x389a9d={};_0x389a9d[_0xbf17('0x2d')]=_[_0xbf17('0x31')](db[_0xbf17('0x29')][_0xbf17('0x2a')]);_0x389a9d[_0xbf17('0x30')]=_[_0xbf17('0x31')](_0x2d12e5['query']);_0x389a9d[_0xbf17('0x3a')]=_[_0xbf17('0x33')](_0x389a9d[_0xbf17('0x2d')],_0x389a9d[_0xbf17('0x30')]);_0x301099[_0xbf17('0x32')]=_[_0xbf17('0x33')](_0x389a9d[_0xbf17('0x2d')],qs[_0xbf17('0x34')](_0x2d12e5[_0xbf17('0x30')]['fields']));_0x301099[_0xbf17('0x32')]=_0x301099[_0xbf17('0x32')][_0xbf17('0x44')]?_0x301099['attributes']:_0x389a9d[_0xbf17('0x2d')];if(_0x2d12e5[_0xbf17('0x30')]['includeAll']){_0x301099[_0xbf17('0x45')]=[{'all':!![]}];}_0x301099=_[_0xbf17('0x3e')]({},_0x301099,_0x2d12e5[_0xbf17('0x3f')]);return db[_0xbf17('0x29')]['find'](_0x301099)['then'](handleEntityNotFound(_0x483406,null))['then'](respondWithResult(_0x483406,null))[_0xbf17('0x42')](handleError(_0x483406,null));};exports[_0xbf17('0x46')]=function(_0x4fdacf,_0x498408){if(_0x4fdacf[_0xbf17('0x47')]['id']){delete _0x4fdacf[_0xbf17('0x47')]['id'];}return db['CmCustomField'][_0xbf17('0x48')]({'where':{'id':_0x4fdacf[_0xbf17('0x49')]['id']}})['then'](handleEntityNotFound(_0x498408,null))['then'](saveUpdates(_0x4fdacf[_0xbf17('0x47')],null))[_0xbf17('0x23')](respondWithResult(_0x498408,null))[_0xbf17('0x42')](handleError(_0x498408,null));};exports['destroy']=function(_0x29c7ab,_0x225793){return db['CmCustomField'][_0xbf17('0x48')]({'where':{'id':_0x29c7ab[_0xbf17('0x49')]['id']}})[_0xbf17('0x23')](handleEntityNotFound(_0x225793,null))['then'](removeEntity(_0x225793,null))['catch'](handleError(_0x225793,null));};exports[_0xbf17('0x4a')]=function(_0x52429c,_0x391b40){var _0x44ae07;return db['sequelize'][_0xbf17('0x4b')](function(_0x120c16){return db[_0xbf17('0x29')][_0xbf17('0x4a')](_0x52429c[_0xbf17('0x47')],{'transaction':_0x120c16})[_0xbf17('0x23')](function(_0x5b4dbb){_0x44ae07=_0x5b4dbb;var _0x23334c={'type':db[_0xbf17('0x4c')]['TEXT'],'transaction':_0x120c16};switch(_0x52429c[_0xbf17('0x47')][_0xbf17('0x2c')]){case _0xbf17('0x4d'):_0x23334c['type']=db[_0xbf17('0x4c')][_0xbf17('0x4e')];break;case _0xbf17('0x4f'):_0x23334c[_0xbf17('0x2c')]=db[_0xbf17('0x4c')]['INTEGER'];break;case _0xbf17('0x50'):_0x23334c[_0xbf17('0x2c')]=db[_0xbf17('0x4c')][_0xbf17('0x51')];_0x23334c['defaultValue']=![];break;default:}return db[_0xbf17('0x52')]['queryInterface'][_0xbf17('0x53')](_0xbf17('0x54'),util[_0xbf17('0x55')](_0xbf17('0x56'),_0x44ae07['id']),_0x23334c);})[_0xbf17('0x23')](function(){return _0x44ae07;});})['then'](respondWithResult(_0x391b40,0xc9))[_0xbf17('0x42')](handleError(_0x391b40,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 45b1b07..9b24f56 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 _0xe70b=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','cm_custom_fields','lodash'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe70b,0x1e3));var _0xbe70=function(_0x46549c,_0x2cdc80){_0x46549c=_0x46549c-0x0;var _0x15b851=_0xe70b[_0x46549c];return _0x15b851;};'use strict';var _=require(_0xbe70('0x0'));var util=require('util');var logger=require(_0xbe70('0x1'))(_0xbe70('0x2'));var moment=require(_0xbe70('0x3'));var BPromise=require(_0xbe70('0x4'));var rp=require(_0xbe70('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe70('0x6'));var config=require(_0xbe70('0x7'));var attributes=require('./cmCustomField.attributes');module[_0xbe70('0x8')]=function(_0xf9ce24,_0x554d8d){return _0xf9ce24[_0xbe70('0x9')]('CmCustomField',attributes,{'tableName':_0xbe70('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fba=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmCustomField','cm_custom_fields'];(function(_0x13682c,_0x455b1d){var _0x40550=function(_0x570149){while(--_0x570149){_0x13682c['push'](_0x13682c['shift']());}};_0x40550(++_0x455b1d);}(_0x7fba,0xd2));var _0xa7fb=function(_0x3b6418,_0x24e772){_0x3b6418=_0x3b6418-0x0;var _0x435878=_0x7fba[_0x3b6418];return _0x435878;};'use strict';var _=require(_0xa7fb('0x0'));var util=require(_0xa7fb('0x1'));var logger=require(_0xa7fb('0x2'))(_0xa7fb('0x3'));var moment=require(_0xa7fb('0x4'));var BPromise=require(_0xa7fb('0x5'));var rp=require(_0xa7fb('0x6'));var fs=require('fs');var path=require(_0xa7fb('0x7'));var rimraf=require(_0xa7fb('0x8'));var config=require(_0xa7fb('0x9'));var attributes=require('./cmCustomField.attributes');module[_0xa7fb('0xa')]=function(_0x3b3939,_0x58389b){return _0x3b3939[_0xa7fb('0xb')](_0xa7fb('0xc'),attributes,{'tableName':_0xa7fb('0xd'),'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 232a6ba..1d9fa24 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 _0xdc12=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','CmCustomField,\x20%s,\x20%s','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x4caaaa,_0x43123f){var _0x356d35=function(_0xa1bc59){while(--_0xa1bc59){_0x4caaaa['push'](_0x4caaaa['shift']());}};_0x356d35(++_0x43123f);}(_0xdc12,0xf2));var _0x2dc1=function(_0x223212,_0x30dd8d){_0x223212=_0x223212-0x0;var _0x2e13dc=_0xdc12[_0x223212];return _0x2e13dc;};'use strict';var _=require(_0x2dc1('0x0'));var util=require('util');var moment=require(_0x2dc1('0x1'));var BPromise=require(_0x2dc1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2dc1('0x3'));var db=require(_0x2dc1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2dc1('0x5'))(_0x2dc1('0x6'));var config=require(_0x2dc1('0x7'));var jayson=require(_0x2dc1('0x8'));var client=jayson[_0x2dc1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e2307,_0x55b108,_0x2cab84){return new BPromise(function(_0x36ca88,_0x2104c5){return client[_0x2dc1('0xa')](_0x2e2307,_0x2cab84)[_0x2dc1('0xb')](function(_0x56bc63){logger['info'](_0x2dc1('0xc'),_0x55b108,'request\x20sent');logger['debug'](_0x2dc1('0xd'),_0x55b108,_0x2dc1('0xe'),JSON[_0x2dc1('0xf')](_0x56bc63));if(_0x56bc63[_0x2dc1('0x10')]){if(_0x56bc63[_0x2dc1('0x10')][_0x2dc1('0x11')]===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x55b108,_0x56bc63['error']['message']);return _0x2104c5(_0x56bc63[_0x2dc1('0x10')][_0x2dc1('0x12')]);}logger[_0x2dc1('0x10')](_0x2dc1('0xc'),_0x55b108,_0x56bc63[_0x2dc1('0x10')]['message']);return _0x36ca88(_0x56bc63['error'][_0x2dc1('0x12')]);}else{logger[_0x2dc1('0x13')](_0x2dc1('0xc'),_0x55b108,'request\x20sent');_0x36ca88(_0x56bc63[_0x2dc1('0x14')][_0x2dc1('0x12')]);}})[_0x2dc1('0x15')](function(_0x23a5f5){logger[_0x2dc1('0x10')](_0x2dc1('0xc'),_0x55b108,_0x23a5f5);_0x2104c5(_0x23a5f5);});});} \ No newline at end of file +var _0x29df=['../../config/environment','jayson/promise','client','http','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x2f7fd7,_0x2a68c3){var _0x1058ae=function(_0x2e09ff){while(--_0x2e09ff){_0x2f7fd7['push'](_0x2f7fd7['shift']());}};_0x1058ae(++_0x2a68c3);}(_0x29df,0x1a8));var _0xf29d=function(_0x382910,_0x3314c3){_0x382910=_0x382910-0x0;var _0x5d38c3=_0x29df[_0x382910];return _0x5d38c3;};'use strict';var _=require(_0xf29d('0x0'));var util=require(_0xf29d('0x1'));var moment=require(_0xf29d('0x2'));var BPromise=require(_0xf29d('0x3'));var rs=require(_0xf29d('0x4'));var fs=require('fs');var Redis=require(_0xf29d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf29d('0x6'));var logger=require('../../config/logger')(_0xf29d('0x7'));var config=require(_0xf29d('0x8'));var jayson=require(_0xf29d('0x9'));var client=jayson[_0xf29d('0xa')][_0xf29d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x537d85,_0x390718,_0x3e75e9){return new BPromise(function(_0x5344d4,_0x56b167){return client['request'](_0x537d85,_0x3e75e9)[_0xf29d('0xc')](function(_0x13a06c){logger['info'](_0xf29d('0xd'),_0x390718,_0xf29d('0xe'));logger[_0xf29d('0xf')](_0xf29d('0x10'),_0x390718,'request\x20sent',JSON[_0xf29d('0x11')](_0x13a06c));if(_0x13a06c[_0xf29d('0x12')]){if(_0x13a06c[_0xf29d('0x12')][_0xf29d('0x13')]===0x1f4){logger[_0xf29d('0x12')](_0xf29d('0xd'),_0x390718,_0x13a06c['error']['message']);return _0x56b167(_0x13a06c['error']['message']);}logger[_0xf29d('0x12')](_0xf29d('0xd'),_0x390718,_0x13a06c['error'][_0xf29d('0x14')]);return _0x5344d4(_0x13a06c['error'][_0xf29d('0x14')]);}else{logger[_0xf29d('0x15')]('CmCustomField,\x20%s,\x20%s',_0x390718,_0xf29d('0xe'));_0x5344d4(_0x13a06c[_0xf29d('0x16')][_0xf29d('0x14')]);}})[_0xf29d('0x17')](function(_0x4c51b1){logger[_0xf29d('0x12')](_0xf29d('0xd'),_0x390718,_0x4c51b1);_0x56b167(_0x4c51b1);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 4b948d2..4549c4c 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 _0x5b2e=['show','create','put','delete','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','/:id','isAuthenticated'];(function(_0x21c2c8,_0x44257e){var _0x4dd745=function(_0x1b3196){while(--_0x1b3196){_0x21c2c8['push'](_0x21c2c8['shift']());}};_0x4dd745(++_0x44257e);}(_0x5b2e,0xe5));var _0xe5b2=function(_0x2fd9b4,_0x146ebc){_0x2fd9b4=_0x2fd9b4-0x0;var _0x48c1ee=_0x5b2e[_0x2fd9b4];return _0x48c1ee;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe5b2('0x0'));var express=require(_0xe5b2('0x1'));var router=express[_0xe5b2('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe5b2('0x3'));var interaction=require(_0xe5b2('0x4'));var config=require(_0xe5b2('0x5'));var controller=require(_0xe5b2('0x6'));router[_0xe5b2('0x7')]('/',auth['isAuthenticated'](),controller[_0xe5b2('0x8')]);router[_0xe5b2('0x7')](_0xe5b2('0x9'),auth[_0xe5b2('0xa')](),controller[_0xe5b2('0xb')]);router['post']('/',auth[_0xe5b2('0xa')](),controller[_0xe5b2('0xc')]);router[_0xe5b2('0xd')](_0xe5b2('0x9'),auth[_0xe5b2('0xa')](),controller['update']);router[_0xe5b2('0xe')]('/:id',auth[_0xe5b2('0xa')](),controller['destroy']);module[_0xe5b2('0xf')]=router; \ No newline at end of file +var _0xd730=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','/:id','show','create','update','destroy','exports','util','connect-timeout'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0xd730,0xfd));var _0x0d73=function(_0x28aa0e,_0x2cd33e){_0x28aa0e=_0x28aa0e-0x0;var _0x1e0522=_0xd730[_0x28aa0e];return _0x1e0522;};'use strict';var multer=require('multer');var util=require(_0x0d73('0x0'));var path=require('path');var timeout=require(_0x0d73('0x1'));var express=require('express');var router=express[_0x0d73('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0d73('0x3'));var interaction=require(_0x0d73('0x4'));var config=require(_0x0d73('0x5'));var controller=require(_0x0d73('0x6'));router['get']('/',auth[_0x0d73('0x7')](),controller[_0x0d73('0x8')]);router['get'](_0x0d73('0x9'),auth['isAuthenticated'](),controller[_0x0d73('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0d73('0xb')]);router['put'](_0x0d73('0x9'),auth[_0x0d73('0x7')](),controller[_0x0d73('0xc')]);router['delete'](_0x0d73('0x9'),auth['isAuthenticated'](),controller[_0x0d73('0xd')]);module[_0x0d73('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 829882b..e59097c 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 _0x56d9=['contactListQueue','moment','sequelize','exports','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x56d9,0x1ba));var _0x956d=function(_0x3c2722,_0x1c4748){_0x3c2722=_0x3c2722-0x0;var _0x99c954=_0x56d9[_0x3c2722];return _0x99c954;};'use strict';var moment=require(_0x956d('0x0'));var Sequelize=require(_0x956d('0x1'));module[_0x956d('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x956d('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x956d('0x4')],'defaultValue':moment()['format'](_0x956d('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x956d('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x956d('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x956d('0x6')](0x2)[_0x956d('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x956d('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x956d('0x6')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x956d('0x6')],'unique':_0x956d('0x8')},'UserId':{'type':Sequelize[_0x956d('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x956d('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x956d('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x956d('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x956d('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x956d('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x956d('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x956d('0x6')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x956d('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xc1d3=['BOOLEAN','DATE','UNSIGNED','contactListQueue','sequelize','STRING','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0xef9615,_0x3a6a0d){var _0x31234f=function(_0x1cc770){while(--_0x1cc770){_0xef9615['push'](_0xef9615['shift']());}};_0x31234f(++_0x3a6a0d);}(_0xc1d3,0xdc));var _0x3c1d=function(_0x49b37c,_0x35985e){_0x49b37c=_0x49b37c-0x0;var _0x22f574=_0xc1d3[_0x49b37c];return _0x22f574;};'use strict';var moment=require('moment');var Sequelize=require(_0x3c1d('0x0'));module['exports']={'phone':{'type':Sequelize[_0x3c1d('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x3c1d('0x2')](_0x3c1d('0x3'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3c1d('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x3c1d('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3c1d('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3c1d('0x6')]},'priority':{'type':Sequelize[_0x3c1d('0x4')](0x2)[_0x3c1d('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x3c1d('0x8')},'ListId':{'type':Sequelize[_0x3c1d('0x4')],'unique':_0x3c1d('0x8')},'UserId':{'type':Sequelize[_0x3c1d('0x4')]},'VoiceQueueId':{'type':Sequelize[_0x3c1d('0x4')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x3c1d('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3c1d('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3c1d('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3c1d('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x3c1d('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 22850cd..da924ef 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 _0xf767=['json','update','error','stack','name','send','index','map','CmHopper','rawAttributes','type','model','keys','query','intersection','filters','concat','$and','$gt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$iLike','$notILike','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','then','include','catch','show','params','includeAll','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','preview','dialPreviewAutoRecallMe','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','Contact','Company','CmList','List','Queue','dialActive','getPreviewRecall','recallme','CmCompany','getOpenContacts','outbound','entity\x20not\x20found','sendStatus','getTimezones','push','utcOffset','getTimezone','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','offset','limit','undefined','count','set'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf767,0x76));var _0x7f76=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0xf767[_0x3e69ae];return _0x3d7f42;};'use strict';var moment=require('moment');var _=require(_0x7f76('0x0'));var qs=require(_0x7f76('0x1'));var logger=require(_0x7f76('0x2'))(_0x7f76('0x3'));var shared=require(_0x7f76('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x396137,_0x2aa5e1){_0x2aa5e1=_0x2aa5e1||0xc8;return function(_0x40ba50){if(_0x40ba50){return _0x396137[_0x7f76('0x5')](_0x2aa5e1)['json'](_0x40ba50);}};}function respondWithFilteredResult(_0x23c243,_0x2f2588){return function(_0x45ddcc){if(_0x45ddcc){var _0x1eeb08=typeof _0x2f2588[_0x7f76('0x6')]==='undefined'&&typeof _0x2f2588[_0x7f76('0x7')]===_0x7f76('0x8');var _0x35d28d=_0x45ddcc[_0x7f76('0x9')];var _0x4c5f88=_0x1eeb08?0x0:_0x2f2588[_0x7f76('0x6')];var _0x5dc8aa=_0x1eeb08?_0x45ddcc[_0x7f76('0x9')]:_0x2f2588[_0x7f76('0x6')]+_0x2f2588[_0x7f76('0x7')];var _0x34b4a2;if(_0x5dc8aa>=_0x35d28d){_0x5dc8aa=_0x35d28d;_0x34b4a2=0xc8;}else{_0x34b4a2=0xce;}_0x23c243[_0x7f76('0x5')](_0x34b4a2);return _0x23c243[_0x7f76('0xa')]('Content-Range',_0x4c5f88+'-'+_0x5dc8aa+'/'+_0x35d28d)[_0x7f76('0xb')](_0x45ddcc);}return null;};}function saveUpdates(_0x2cd1b3,_0x47403b){return function(_0x32392b){if(_0x32392b){return _0x32392b[_0x7f76('0xc')](_0x2cd1b3)['then'](function(_0x2b1112){return _0x2b1112;});}return null;};}function handleEntityNotFound(_0x4d8de0,_0x42a9d3){return function(_0x256f79){if(!_0x256f79){_0x4d8de0['sendStatus'](0x194);}return _0x256f79;};}function handleError(_0x4ec2bd,_0x58d2f3){_0x58d2f3=_0x58d2f3||0x1f4;return function(_0xe81aa9){logger[_0x7f76('0xd')](_0xe81aa9[_0x7f76('0xe')]);if(_0xe81aa9['name']){delete _0xe81aa9[_0x7f76('0xf')];}_0x4ec2bd['status'](_0x58d2f3)[_0x7f76('0x10')](_0xe81aa9);};}exports[_0x7f76('0x11')]=function(_0x431076,_0x4802ff){var _0x4f1c15={},_0x494537={},_0x54e95a={'count':0x0,'rows':[]};var _0x59867d=_[_0x7f76('0x12')](db[_0x7f76('0x13')][_0x7f76('0x14')],function(_0x21c2ca){return{'name':_0x21c2ca['fieldName'],'type':_0x21c2ca[_0x7f76('0x15')]['key']};});_0x494537[_0x7f76('0x16')]=_[_0x7f76('0x12')](_0x59867d,'name');_0x494537['query']=_[_0x7f76('0x17')](_0x431076[_0x7f76('0x18')]);_0x494537['filters']=_[_0x7f76('0x19')](_0x494537['model'],_0x494537[_0x7f76('0x18')]);_0x494537[_0x7f76('0x1a')]=_[_0x7f76('0x1b')](_0x494537[_0x7f76('0x1a')],[_0x7f76('0x1c'),'$or',_0x7f76('0x1d'),'$gte','$lt',_0x7f76('0x1e'),_0x7f76('0x1f'),_0x7f76('0x20'),'$not',_0x7f76('0x21'),_0x7f76('0x22'),_0x7f76('0x23'),_0x7f76('0x24'),_0x7f76('0x25'),'$notLike',_0x7f76('0x26'),_0x7f76('0x27'),'$like','$overlap',_0x7f76('0x28'),'$contained',_0x7f76('0x29')]);_0x4f1c15[_0x7f76('0x2a')]=_[_0x7f76('0x19')](_0x494537[_0x7f76('0x16')],qs[_0x7f76('0x2b')](_0x431076[_0x7f76('0x18')]['fields']));_0x4f1c15[_0x7f76('0x2a')]=_0x4f1c15[_0x7f76('0x2a')][_0x7f76('0x2c')]?_0x4f1c15[_0x7f76('0x2a')]:_0x494537['model'];if(!_0x431076[_0x7f76('0x18')][_0x7f76('0x2d')](_0x7f76('0x2e'))){_0x4f1c15['limit']=qs[_0x7f76('0x7')](_0x431076[_0x7f76('0x18')][_0x7f76('0x7')]);_0x4f1c15[_0x7f76('0x6')]=qs[_0x7f76('0x6')](_0x431076[_0x7f76('0x18')][_0x7f76('0x6')]);}_0x4f1c15[_0x7f76('0x2f')]=qs[_0x7f76('0x30')](_0x431076[_0x7f76('0x18')][_0x7f76('0x30')]);_0x4f1c15[_0x7f76('0x31')]=qs[_0x7f76('0x1a')](_['pick'](_0x431076[_0x7f76('0x18')],_0x494537[_0x7f76('0x1a')]),_0x59867d);if(_0x431076[_0x7f76('0x18')][_0x7f76('0x32')]){_0x4f1c15[_0x7f76('0x31')]=_[_0x7f76('0x33')](_0x4f1c15[_0x7f76('0x31')],{'$or':_[_0x7f76('0x12')](_0x59867d,function(_0x5bffd0){if(_0x5bffd0[_0x7f76('0x15')]!=='VIRTUAL'){var _0x5e9a68={};_0x5e9a68[_0x5bffd0[_0x7f76('0xf')]]={'$like':'%'+_0x431076['query'][_0x7f76('0x32')]+'%'};return _0x5e9a68;}})});}_0x4f1c15=_[_0x7f76('0x33')]({},_0x4f1c15,_0x431076['options']);var _0x3dbcc3={'where':_0x4f1c15['where']};return db['CmHopper'][_0x7f76('0x9')](_0x3dbcc3)[_0x7f76('0x34')](function(_0x445d2d){_0x54e95a[_0x7f76('0x9')]=_0x445d2d;if(_0x431076[_0x7f76('0x18')]['includeAll']){_0x4f1c15[_0x7f76('0x35')]=[{'all':!![]}];}return db[_0x7f76('0x13')]['findAll'](_0x4f1c15);})['then'](function(_0x311204){_0x54e95a['rows']=_0x311204;return _0x54e95a;})[_0x7f76('0x34')](respondWithFilteredResult(_0x4802ff,_0x4f1c15))[_0x7f76('0x36')](handleError(_0x4802ff,null));};exports[_0x7f76('0x37')]=function(_0x4ddbab,_0x2e1b96){var _0x26b537={'raw':!![],'where':{'id':_0x4ddbab[_0x7f76('0x38')]['id']}},_0xd271c2={};_0xd271c2[_0x7f76('0x16')]=_[_0x7f76('0x17')](db['CmHopper']['rawAttributes']);_0xd271c2[_0x7f76('0x18')]=_[_0x7f76('0x17')](_0x4ddbab[_0x7f76('0x18')]);_0xd271c2[_0x7f76('0x1a')]=_[_0x7f76('0x19')](_0xd271c2[_0x7f76('0x16')],_0xd271c2[_0x7f76('0x18')]);_0x26b537[_0x7f76('0x2a')]=_[_0x7f76('0x19')](_0xd271c2[_0x7f76('0x16')],qs[_0x7f76('0x2b')](_0x4ddbab[_0x7f76('0x18')][_0x7f76('0x2b')]));_0x26b537[_0x7f76('0x2a')]=_0x26b537[_0x7f76('0x2a')][_0x7f76('0x2c')]?_0x26b537[_0x7f76('0x2a')]:_0xd271c2[_0x7f76('0x16')];if(_0x4ddbab['query'][_0x7f76('0x39')]){_0x26b537[_0x7f76('0x35')]=[{'all':!![]}];}_0x26b537=_[_0x7f76('0x33')]({},_0x26b537,_0x4ddbab['options']);return db['CmHopper'][_0x7f76('0x3a')](_0x26b537)['then'](handleEntityNotFound(_0x2e1b96,null))[_0x7f76('0x34')](respondWithResult(_0x2e1b96,null))['catch'](handleError(_0x2e1b96,null));};exports['create']=function(_0x2237ed,_0x20ffe5){return db[_0x7f76('0x13')][_0x7f76('0x3b')](_0x2237ed[_0x7f76('0x3c')],{})[_0x7f76('0x34')](respondWithResult(_0x20ffe5,0xc9))[_0x7f76('0x36')](handleError(_0x20ffe5,null));};exports[_0x7f76('0xc')]=function(_0x71f722,_0x1d43e3){if(_0x71f722[_0x7f76('0x3c')]['id']){delete _0x71f722[_0x7f76('0x3c')]['id'];}return db[_0x7f76('0x13')][_0x7f76('0x3a')]({'where':{'id':_0x71f722['params']['id']}})[_0x7f76('0x34')](handleEntityNotFound(_0x1d43e3,null))['then'](saveUpdates(_0x71f722[_0x7f76('0x3c')],null))[_0x7f76('0x34')](respondWithResult(_0x1d43e3,null))[_0x7f76('0x36')](handleError(_0x1d43e3,null));};exports[_0x7f76('0x3d')]=function(_0x487b1f,_0x16ffcd){return db[_0x7f76('0x13')][_0x7f76('0x3d')]()[_0x7f76('0x34')](respondWithResult(_0x16ffcd,null))['catch'](handleError(_0x16ffcd,null));};exports[_0x7f76('0x3e')]=function(_0xd87fe7,_0x53f77a){var _0x163307;var _0x364fea=_0xd87fe7[_0x7f76('0x38')]['id'];return db['CmHopper'][_0x7f76('0x3a')]({'where':{'id':_0xd87fe7[_0x7f76('0x38')]['id']}})[_0x7f76('0x34')](handleEntityNotFound(_0x53f77a,null))[_0x7f76('0x34')](function(_0x37665b){if(_0x37665b){return _0x37665b[_0x7f76('0x3e')]()[_0x7f76('0x34')](function(_0x42abd9){return _0x42abd9;});}})[_0x7f76('0x34')](function(_0xa97329){_0x163307=_0xa97329;if(_0xa97329){if(_0xa97329[_0x7f76('0x3f')]||_0xa97329[_0x7f76('0x40')]){return db[_0xa97329['VoiceQueueId']?_0x7f76('0x41'):'Campaign'][_0x7f76('0x3a')]({'where':{'id':_0xa97329[_0x7f76('0x3f')]?_0xa97329[_0x7f76('0x3f')]:_0xa97329['CampaignId']},'attributes':['id',_0x7f76('0xf')],'raw':!![]});}}})[_0x7f76('0x34')](function(_0x48ceb1){var _0xd76438={};if(_0x48ceb1){_[_0x7f76('0x33')](_0xd76438,_[_0x7f76('0x42')](_0x163307[_0x7f76('0x43')],[_0x7f76('0x44'),_0x7f76('0x45'),'id']));_0xd76438[_0x7f76('0x46')]=0x15;_0xd76438[_0x7f76('0x47')]=_0x7f76('0x48');_0xd76438['campaign']=_0x48ceb1['name'];_0xd76438[_0x7f76('0x49')]=_0xd87fe7[_0x7f76('0x4a')][_0x7f76('0xf')];_0xd76438[_0x7f76('0x4b')]=_0xd87fe7[_0x7f76('0x4a')]['id'];_0xd76438[_0x7f76('0x48')]=!![];_0xd76438[_0x7f76('0x4c')]=moment()[_0x7f76('0x4d')](_0x7f76('0x4e'));_0xd76438['calleridnum']=_0x163307[_0x7f76('0x4f')];_0xd76438[_0x7f76('0x50')]=_0x163307[_0x7f76('0x3f')]?_0x7f76('0x51'):_0x7f76('0x52');return db[_0x7f76('0x53')][_0x7f76('0x3a')]({'where':{'id':_0xd76438['ContactId']},'attributes':[_0x7f76('0x54'),'lastName']})[_0x7f76('0x34')](function(_0x22ae47){if(!_[_0x7f76('0x55')](_0x53f77a)&&!_[_0x7f76('0x55')](_0x22ae47[_0x7f76('0x54')])){_0xd76438[_0x7f76('0x56')]=_0x22ae47[_0x7f76('0x54')];if(!_[_0x7f76('0x55')](_0x22ae47['lastName'])){_0xd76438['calleridname']+='\x20'+_0x22ae47[_0x7f76('0x57')];}}})[_0x7f76('0x58')](function(){return db[_0x7f76('0x59')][_0x7f76('0x3b')](_0xd76438);});}})[_0x7f76('0x34')](function(_0x41537b){return db[_0x7f76('0x5a')][_0x7f76('0x3e')]({'where':{'CmHopperId':_0x364fea}});})['then'](function(){return _0x53f77a['status'](0xcc)[_0x7f76('0x5b')]();})[_0x7f76('0x36')](handleError(_0x53f77a,null));};exports[_0x7f76('0x5c')]=function(_0x529e7f,_0x2a3300){var _0x1f892c=[];return db['CmContact'][_0x7f76('0x3d')]()[_0x7f76('0x34')](function(_0x2da333){_0x1f892c=_[_0x7f76('0x17')](_0x2da333);return _0x529e7f[_0x7f76('0x4a')][_0x7f76('0x5d')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x7f76('0x5e')},'attributes':['id','dialOrderByScheduledAt',_0x7f76('0x5f')],'raw':!![]});})['then'](function(_0x229cd4){if(_0x229cd4&&_0x229cd4['length']){return db[_0x7f76('0x60')][_0x7f76('0x61')](function(_0x14dcc6){var _0x3e83d2={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x7f76('0x4e'))},'VoiceQueueId':{'$in':_[_0x7f76('0x12')](_0x229cd4,'id')},'$or':[{'UserId':null},{'UserId':_0x529e7f[_0x7f76('0x4a')]['id']}]};var _0x2aa2dc={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x229cd4)[_0x7f76('0x32')](['dialPreviewAutoRecallMe',0x0])[_0x7f76('0x12')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x529e7f[_0x7f76('0x4a')]['id']}]};var _0x5374bf={'$or':[_0x3e83d2,_0x2aa2dc]};var _0x41e377=[];if(_0x529e7f[_0x7f76('0x3c')]['direction']&&_0x529e7f[_0x7f76('0x3c')][_0x7f76('0x62')]===_0x7f76('0x63')){if(!_[_0x7f76('0x64')](_0x529e7f[_0x7f76('0x3c')][_0x7f76('0x65')])){_0x5374bf['id']={'$in':_0x529e7f[_0x7f76('0x3c')][_0x7f76('0x65')]};}_0x41e377=[[_0x7f76('0x66'),_0x7f76('0x67')],[_0x7f76('0x68'),_0x229cd4[0x0][_0x7f76('0x69')]===_0x7f76('0x67')?_0x7f76('0x6a'):'ASC'],db[_0x7f76('0x60')][_0x7f76('0x6b')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x7f76('0x6a')]];}else{if(!_[_0x7f76('0x64')](_0x529e7f[_0x7f76('0x3c')][_0x7f76('0x65')])){_0x5374bf['id']={'$notIn':_0x529e7f[_0x7f76('0x3c')][_0x7f76('0x65')]};}_0x41e377=[[_0x7f76('0x66'),_0x7f76('0x6a')],[_0x7f76('0x68'),_0x229cd4[0x0][_0x7f76('0x69')]],db[_0x7f76('0x60')][_0x7f76('0x6b')](_0x7f76('0x6c')),['id',_0x7f76('0x67')]];}return db['CmHopper'][_0x7f76('0x6d')]({'attributes':['id',_0x7f76('0x6e'),'phone','recallme'],'where':_0x5374bf,'order':_0x41e377,'transaction':_0x14dcc6,'lock':_0x14dcc6['LOCK'][_0x7f76('0x6f')],'include':[{'model':db[_0x7f76('0x53')],'as':_0x7f76('0x70'),'attributes':_0x1f892c,'include':[{'model':db['CmCompany'],'as':_0x7f76('0x71'),'attributes':['id',_0x7f76('0xf')]}]},{'model':db[_0x7f76('0x72')],'as':_0x7f76('0x73'),'attributes':['id',_0x7f76('0xf')]},{'model':db[_0x7f76('0x41')],'as':_0x7f76('0x74'),'attributes':['id',_0x7f76('0xf'),_0x7f76('0x75')]}]})['then'](function(_0x10271e){if(_0x10271e){return _0x10271e[_0x7f76('0xc')]({'UserId':_0x529e7f[_0x7f76('0x4a')]['id']},{'transaction':_0x14dcc6});}});});}})[_0x7f76('0x34')](handleEntityNotFound(_0x2a3300,null))[_0x7f76('0x34')](respondWithResult(_0x2a3300,null))[_0x7f76('0x36')](handleError(_0x2a3300,null));};exports[_0x7f76('0x76')]=function(_0x5e87b6,_0x1d94ec,_0x10a434){var _0x228f77=[];var _0x476211=_0x5e87b6[_0x7f76('0x38')]['id'];var _0x5dcbcc=_0x5e87b6[_0x7f76('0x4a')]['id'];return db[_0x7f76('0x53')]['describe']()['then'](function(_0x5cbdcc){_0x228f77=_[_0x7f76('0x17')](_0x5cbdcc);return db[_0x7f76('0x60')][_0x7f76('0x61')](function(_0x8d6dec){const _0x366375={'id':_0x476211};return db[_0x7f76('0x13')]['findOne']({'attributes':['id',_0x7f76('0x6e'),_0x7f76('0x77')],'where':_0x366375,'transaction':_0x8d6dec,'lock':_0x8d6dec['LOCK'][_0x7f76('0x6f')],'include':[{'model':db[_0x7f76('0x53')],'as':_0x7f76('0x70'),'attributes':_0x228f77,'include':[{'model':db[_0x7f76('0x78')],'as':_0x7f76('0x71'),'attributes':['id',_0x7f76('0xf')]}]},{'model':db[_0x7f76('0x72')],'as':'List','attributes':['id',_0x7f76('0xf')]},{'model':db[_0x7f76('0x41')],'as':'Queue','attributes':['id',_0x7f76('0xf'),_0x7f76('0x75')]}]})['then'](function(_0x3a37ad){if(_0x3a37ad){return _0x3a37ad[_0x7f76('0xc')]({'UserId':_0x5dcbcc},{'transaction':_0x8d6dec});}});});})[_0x7f76('0x34')](handleEntityNotFound(_0x1d94ec,null))[_0x7f76('0x34')](respondWithResult(_0x1d94ec,null))[_0x7f76('0x36')](handleError(_0x1d94ec,null));};exports[_0x7f76('0x79')]=function(_0x37afb1,_0x44d60f){return _0x37afb1[_0x7f76('0x4a')][_0x7f76('0x5d')]({'where':{'type':_0x7f76('0x7a'),'dialActive':!![],'dialMethod':_0x7f76('0x5e')},'attributes':['id'],'raw':!![]})[_0x7f76('0x34')](function(_0x132805){if(_0x132805&&_0x132805[_0x7f76('0x2c')]){return db[_0x7f76('0x13')][_0x7f76('0x9')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7f76('0x4d')](_0x7f76('0x4e'))},'VoiceQueueId':{'$in':_[_0x7f76('0x12')](_0x132805,'id')},'$or':[{'UserId':null},{'UserId':_0x37afb1[_0x7f76('0x4a')]['id']}]}});}return 0x0;})[_0x7f76('0x34')](function(_0x102b43){if(!_[_0x7f76('0x55')](_0x102b43)&&_['isNumber'](_0x102b43)){return _0x44d60f['status'](0xc8)[_0x7f76('0xb')]({'contacts':_0x102b43});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0x7f76('0x79'),0x194,_0x7f76('0x7b'));_0x44d60f[_0x7f76('0x7c')](0x194);}})[_0x7f76('0x36')](handleError(_0x44d60f,null));};exports[_0x7f76('0x7d')]=function(_0x496bb,_0x1cfec4){var _0x340b31=shared['timezones'];var _0x542432=[];_[_0x7f76('0x12')](_0x340b31,function(_0x3dcd18){_0x542432[_0x7f76('0x7e')]({'id':_0x3dcd18[_0x7f76('0xf')],'name':_0x3dcd18['name'],'utcOffset':_0x3dcd18[_0x7f76('0x7f')]});});return _0x1cfec4[_0x7f76('0x5')](0xc8)[_0x7f76('0xb')]({'tz':_0x542432});};exports[_0x7f76('0x80')]=function(_0x28083e,_0x43bace){var _0x2400b7=shared['timezones'];var _0x5a856f={};if(!_[_0x7f76('0x55')](_0x2400b7[_0x28083e[_0x7f76('0x3c')]['id']]))_0x5a856f=_0x2400b7[_0x28083e[_0x7f76('0x3c')]['id']];return _0x43bace[_0x7f76('0x5')](0xc8)[_0x7f76('0xb')](_0x5a856f);}; \ No newline at end of file +var _0x08d9=['Campaign','dataValues','createdAt','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperAdditionalPhone','end','getPreview','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','dialOrderByScheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','Company','List','Queue','getPreviewRecall','CmCompany','CmList','dialActive','getOpenContacts','getVoiceQueues','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','push','utcOffset','moment','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','update','then','error','name','send','index','map','CmHopper','fieldName','type','model','query','keys','filters','concat','$and','$or','$gt','$lt','$lte','$ne','$eq','$not','$in','$notIn','$like','$notLike','$iLike','$overlap','$contained','$any','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','rawAttributes','include','create','catch','body','find','describe','destroy','params','VoiceQueueId','CampaignId','VoiceQueue'];(function(_0x299b8b,_0xfe6056){var _0xff3281=function(_0xbaae5c){while(--_0xbaae5c){_0x299b8b['push'](_0x299b8b['shift']());}};_0xff3281(++_0xfe6056);}(_0x08d9,0xc2));var _0x908d=function(_0x288456,_0x262fe7){_0x288456=_0x288456-0x0;var _0x466fae=_0x08d9[_0x288456];return _0x466fae;};'use strict';var moment=require(_0x908d('0x0'));var _=require('lodash');var qs=require(_0x908d('0x1'));var logger=require('../../config/logger')(_0x908d('0x2'));var shared=require(_0x908d('0x3'));var db=require(_0x908d('0x4'))['db'];function respondWithResult(_0x5228dd,_0x53cef4){_0x53cef4=_0x53cef4||0xc8;return function(_0x15dfb3){if(_0x15dfb3){return _0x5228dd[_0x908d('0x5')](_0x53cef4)[_0x908d('0x6')](_0x15dfb3);}};}function respondWithFilteredResult(_0xe780e0,_0xb63409){return function(_0x5d67d6){if(_0x5d67d6){var _0x52cd93=typeof _0xb63409[_0x908d('0x7')]===_0x908d('0x8')&&typeof _0xb63409[_0x908d('0x9')]===_0x908d('0x8');var _0x44b888=_0x5d67d6[_0x908d('0xa')];var _0x24113f=_0x52cd93?0x0:_0xb63409[_0x908d('0x7')];var _0x2ac2b7=_0x52cd93?_0x5d67d6['count']:_0xb63409[_0x908d('0x7')]+_0xb63409[_0x908d('0x9')];var _0xbba8e2;if(_0x2ac2b7>=_0x44b888){_0x2ac2b7=_0x44b888;_0xbba8e2=0xc8;}else{_0xbba8e2=0xce;}_0xe780e0[_0x908d('0x5')](_0xbba8e2);return _0xe780e0[_0x908d('0xb')]('Content-Range',_0x24113f+'-'+_0x2ac2b7+'/'+_0x44b888)['json'](_0x5d67d6);}return null;};}function saveUpdates(_0x588cc3,_0x3213df){return function(_0x2c92df){if(_0x2c92df){return _0x2c92df[_0x908d('0xc')](_0x588cc3)[_0x908d('0xd')](function(_0x2e1a77){return _0x2e1a77;});}return null;};}function handleEntityNotFound(_0x3c1149,_0x9dbb7f){return function(_0x4dcd6f){if(!_0x4dcd6f){_0x3c1149['sendStatus'](0x194);}return _0x4dcd6f;};}function handleError(_0x3e1c4f,_0x207ac1){_0x207ac1=_0x207ac1||0x1f4;return function(_0x178809){logger[_0x908d('0xe')](_0x178809['stack']);if(_0x178809['name']){delete _0x178809[_0x908d('0xf')];}_0x3e1c4f[_0x908d('0x5')](_0x207ac1)[_0x908d('0x10')](_0x178809);};}exports[_0x908d('0x11')]=function(_0x4cc9ba,_0x9438c7){var _0x3b83aa={},_0x3dea46={},_0x4101c1={'count':0x0,'rows':[]};var _0x209ffd=_[_0x908d('0x12')](db[_0x908d('0x13')]['rawAttributes'],function(_0x34a524){return{'name':_0x34a524[_0x908d('0x14')],'type':_0x34a524[_0x908d('0x15')]['key']};});_0x3dea46[_0x908d('0x16')]=_[_0x908d('0x12')](_0x209ffd,_0x908d('0xf'));_0x3dea46[_0x908d('0x17')]=_[_0x908d('0x18')](_0x4cc9ba['query']);_0x3dea46[_0x908d('0x19')]=_['intersection'](_0x3dea46[_0x908d('0x16')],_0x3dea46[_0x908d('0x17')]);_0x3dea46[_0x908d('0x19')]=_[_0x908d('0x1a')](_0x3dea46[_0x908d('0x19')],[_0x908d('0x1b'),_0x908d('0x1c'),_0x908d('0x1d'),'$gte',_0x908d('0x1e'),_0x908d('0x1f'),_0x908d('0x20'),_0x908d('0x21'),_0x908d('0x22'),'$between','$notBetween',_0x908d('0x23'),_0x908d('0x24'),_0x908d('0x25'),_0x908d('0x26'),_0x908d('0x27'),'$notILike',_0x908d('0x25'),_0x908d('0x28'),'$contains',_0x908d('0x29'),_0x908d('0x2a')]);_0x3b83aa[_0x908d('0x2b')]=_[_0x908d('0x2c')](_0x3dea46[_0x908d('0x16')],qs[_0x908d('0x2d')](_0x4cc9ba[_0x908d('0x17')][_0x908d('0x2d')]));_0x3b83aa[_0x908d('0x2b')]=_0x3b83aa[_0x908d('0x2b')][_0x908d('0x2e')]?_0x3b83aa['attributes']:_0x3dea46[_0x908d('0x16')];if(!_0x4cc9ba[_0x908d('0x17')][_0x908d('0x2f')](_0x908d('0x30'))){_0x3b83aa['limit']=qs[_0x908d('0x9')](_0x4cc9ba[_0x908d('0x17')][_0x908d('0x9')]);_0x3b83aa[_0x908d('0x7')]=qs[_0x908d('0x7')](_0x4cc9ba[_0x908d('0x17')][_0x908d('0x7')]);}_0x3b83aa[_0x908d('0x31')]=qs[_0x908d('0x32')](_0x4cc9ba[_0x908d('0x17')][_0x908d('0x32')]);_0x3b83aa['where']=qs['filters'](_[_0x908d('0x33')](_0x4cc9ba[_0x908d('0x17')],_0x3dea46['filters']),_0x209ffd);if(_0x4cc9ba['query'][_0x908d('0x34')]){_0x3b83aa[_0x908d('0x35')]=_[_0x908d('0x36')](_0x3b83aa[_0x908d('0x35')],{'$or':_[_0x908d('0x12')](_0x209ffd,function(_0x5ad500){if(_0x5ad500[_0x908d('0x15')]!==_0x908d('0x37')){var _0x2a766f={};_0x2a766f[_0x5ad500[_0x908d('0xf')]]={'$like':'%'+_0x4cc9ba[_0x908d('0x17')]['filter']+'%'};return _0x2a766f;}})});}_0x3b83aa=_['merge']({},_0x3b83aa,_0x4cc9ba[_0x908d('0x38')]);var _0x522ef1={'where':_0x3b83aa[_0x908d('0x35')]};return db[_0x908d('0x13')][_0x908d('0xa')](_0x522ef1)[_0x908d('0xd')](function(_0x3ef848){_0x4101c1[_0x908d('0xa')]=_0x3ef848;if(_0x4cc9ba[_0x908d('0x17')][_0x908d('0x39')]){_0x3b83aa['include']=[{'all':!![]}];}return db['CmHopper'][_0x908d('0x3a')](_0x3b83aa);})[_0x908d('0xd')](function(_0x297366){_0x4101c1['rows']=_0x297366;return _0x4101c1;})['then'](respondWithFilteredResult(_0x9438c7,_0x3b83aa))['catch'](handleError(_0x9438c7,null));};exports[_0x908d('0x3b')]=function(_0x54982f,_0x2b0108){var _0x10667b={'raw':!![],'where':{'id':_0x54982f['params']['id']}},_0x1dd840={};_0x1dd840['model']=_['keys'](db[_0x908d('0x13')][_0x908d('0x3c')]);_0x1dd840['query']=_[_0x908d('0x18')](_0x54982f['query']);_0x1dd840[_0x908d('0x19')]=_[_0x908d('0x2c')](_0x1dd840[_0x908d('0x16')],_0x1dd840['query']);_0x10667b[_0x908d('0x2b')]=_[_0x908d('0x2c')](_0x1dd840[_0x908d('0x16')],qs[_0x908d('0x2d')](_0x54982f['query'][_0x908d('0x2d')]));_0x10667b[_0x908d('0x2b')]=_0x10667b[_0x908d('0x2b')][_0x908d('0x2e')]?_0x10667b[_0x908d('0x2b')]:_0x1dd840['model'];if(_0x54982f[_0x908d('0x17')][_0x908d('0x39')]){_0x10667b[_0x908d('0x3d')]=[{'all':!![]}];}_0x10667b=_[_0x908d('0x36')]({},_0x10667b,_0x54982f[_0x908d('0x38')]);return db[_0x908d('0x13')]['find'](_0x10667b)['then'](handleEntityNotFound(_0x2b0108,null))[_0x908d('0xd')](respondWithResult(_0x2b0108,null))['catch'](handleError(_0x2b0108,null));};exports[_0x908d('0x3e')]=function(_0x1ab59a,_0x5b28ad){return db[_0x908d('0x13')][_0x908d('0x3e')](_0x1ab59a['body'],{})[_0x908d('0xd')](respondWithResult(_0x5b28ad,0xc9))[_0x908d('0x3f')](handleError(_0x5b28ad,null));};exports[_0x908d('0xc')]=function(_0x447f75,_0x53fdf4){if(_0x447f75[_0x908d('0x40')]['id']){delete _0x447f75['body']['id'];}return db[_0x908d('0x13')][_0x908d('0x41')]({'where':{'id':_0x447f75['params']['id']}})[_0x908d('0xd')](handleEntityNotFound(_0x53fdf4,null))['then'](saveUpdates(_0x447f75['body'],null))[_0x908d('0xd')](respondWithResult(_0x53fdf4,null))[_0x908d('0x3f')](handleError(_0x53fdf4,null));};exports[_0x908d('0x42')]=function(_0x3cffc4,_0x4e498c){return db['CmHopper']['describe']()[_0x908d('0xd')](respondWithResult(_0x4e498c,null))[_0x908d('0x3f')](handleError(_0x4e498c,null));};exports[_0x908d('0x43')]=function(_0x19d277,_0x44d091){var _0x1fd1bf;var _0x3f5d4f=_0x19d277[_0x908d('0x44')]['id'];return db['CmHopper'][_0x908d('0x41')]({'where':{'id':_0x19d277['params']['id']}})[_0x908d('0xd')](handleEntityNotFound(_0x44d091,null))[_0x908d('0xd')](function(_0x192554){if(_0x192554){return _0x192554[_0x908d('0x43')]()['then'](function(_0x51df00){return _0x51df00;});}})[_0x908d('0xd')](function(_0x297681){_0x1fd1bf=_0x297681;if(_0x297681){if(_0x297681[_0x908d('0x45')]||_0x297681[_0x908d('0x46')]){return db[_0x297681[_0x908d('0x45')]?_0x908d('0x47'):_0x908d('0x48')][_0x908d('0x41')]({'where':{'id':_0x297681[_0x908d('0x45')]?_0x297681[_0x908d('0x45')]:_0x297681['CampaignId']},'attributes':['id',_0x908d('0xf')],'raw':!![]});}}})[_0x908d('0xd')](function(_0x4d8abe){var _0x5d98f8={};if(_0x4d8abe){_[_0x908d('0x36')](_0x5d98f8,_['omit'](_0x1fd1bf[_0x908d('0x49')],[_0x908d('0x4a'),'updatedAt','id']));_0x5d98f8['state']=0x15;_0x5d98f8[_0x908d('0x4b')]=_0x908d('0x4c');_0x5d98f8['campaign']=_0x4d8abe[_0x908d('0xf')];_0x5d98f8[_0x908d('0x4d')]=_0x19d277[_0x908d('0x4e')][_0x908d('0xf')];_0x5d98f8[_0x908d('0x4f')]=_0x19d277[_0x908d('0x4e')]['id'];_0x5d98f8[_0x908d('0x4c')]=!![];_0x5d98f8[_0x908d('0x50')]=moment()[_0x908d('0x51')](_0x908d('0x52'));_0x5d98f8[_0x908d('0x53')]=_0x1fd1bf[_0x908d('0x54')];_0x5d98f8['campaigntype']=_0x1fd1bf['VoiceQueueId']?_0x908d('0x55'):'ivr';return db[_0x908d('0x56')][_0x908d('0x41')]({'where':{'id':_0x5d98f8[_0x908d('0x57')]},'attributes':[_0x908d('0x58'),_0x908d('0x59')]})[_0x908d('0xd')](function(_0x1eba12){if(!_[_0x908d('0x5a')](_0x44d091)&&!_[_0x908d('0x5a')](_0x1eba12[_0x908d('0x58')])){_0x5d98f8['calleridname']=_0x1eba12[_0x908d('0x58')];if(!_[_0x908d('0x5a')](_0x1eba12[_0x908d('0x59')])){_0x5d98f8[_0x908d('0x5b')]+='\x20'+_0x1eba12[_0x908d('0x59')];}}})[_0x908d('0x5c')](function(){return db['CmHopperFinal'][_0x908d('0x3e')](_0x5d98f8);});}})['then'](function(_0x3875c6){return db[_0x908d('0x5d')][_0x908d('0x43')]({'where':{'CmHopperId':_0x3f5d4f}});})[_0x908d('0xd')](function(){return _0x44d091[_0x908d('0x5')](0xcc)[_0x908d('0x5e')]();})['catch'](handleError(_0x44d091,null));};exports[_0x908d('0x5f')]=function(_0x2489d2,_0x3bf30c){var _0x24c79d=[];return db[_0x908d('0x56')][_0x908d('0x42')]()['then'](function(_0x29fd0a){_0x24c79d=_[_0x908d('0x18')](_0x29fd0a);return _0x2489d2[_0x908d('0x4e')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt',_0x908d('0x60')],'raw':!![]});})[_0x908d('0xd')](function(_0xfd6c9){if(_0xfd6c9&&_0xfd6c9[_0x908d('0x2e')]){return db[_0x908d('0x61')][_0x908d('0x62')](function(_0x11bf76){var _0xa9b13a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x908d('0x51')](_0x908d('0x52'))},'VoiceQueueId':{'$in':_['map'](_0xfd6c9,'id')},'$or':[{'UserId':null},{'UserId':_0x2489d2[_0x908d('0x4e')]['id']}]};var _0x330fa2={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0xfd6c9)[_0x908d('0x34')]([_0x908d('0x60'),0x0])[_0x908d('0x12')]('id')[_0x908d('0x63')]()},'$or':[{'UserId':null},{'UserId':_0x2489d2[_0x908d('0x4e')]['id']}]};var _0x144d04={'$or':[_0xa9b13a,_0x330fa2]};var _0x4bde16=[];if(_0x2489d2[_0x908d('0x40')][_0x908d('0x64')]&&_0x2489d2[_0x908d('0x40')][_0x908d('0x64')]===_0x908d('0x65')){if(!_[_0x908d('0x66')](_0x2489d2[_0x908d('0x40')][_0x908d('0x67')])){_0x144d04['id']={'$in':_0x2489d2[_0x908d('0x40')]['hopperIds']};}_0x4bde16=[[_0x908d('0x68'),_0x908d('0x69')],[_0x908d('0x6a'),_0xfd6c9[0x0]['dialOrderByScheduledAt']===_0x908d('0x69')?_0x908d('0x6b'):'ASC'],db[_0x908d('0x61')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x908d('0x6b')]];}else{if(!_[_0x908d('0x66')](_0x2489d2['body'][_0x908d('0x67')])){_0x144d04['id']={'$notIn':_0x2489d2[_0x908d('0x40')][_0x908d('0x67')]};}_0x4bde16=[[_0x908d('0x68'),_0x908d('0x6b')],[_0x908d('0x6a'),_0xfd6c9[0x0][_0x908d('0x6c')]],db[_0x908d('0x61')][_0x908d('0x6d')](_0x908d('0x6e')),['id',_0x908d('0x69')]];}return db[_0x908d('0x13')][_0x908d('0x6f')]({'attributes':['id',_0x908d('0x70'),_0x908d('0x54'),_0x908d('0x71')],'where':_0x144d04,'order':_0x4bde16,'transaction':_0x11bf76,'lock':_0x11bf76['LOCK'][_0x908d('0x72')],'include':[{'model':db['CmContact'],'as':_0x908d('0x73'),'attributes':_0x24c79d,'include':[{'model':db['CmCompany'],'as':_0x908d('0x74'),'attributes':['id',_0x908d('0xf')]}]},{'model':db['CmList'],'as':_0x908d('0x75'),'attributes':['id','name']},{'model':db[_0x908d('0x47')],'as':_0x908d('0x76'),'attributes':['id',_0x908d('0xf'),'dialActive']}]})['then'](function(_0x3d4d9d){if(_0x3d4d9d){return _0x3d4d9d[_0x908d('0xc')]({'UserId':_0x2489d2[_0x908d('0x4e')]['id']},{'transaction':_0x11bf76});}});});}})[_0x908d('0xd')](handleEntityNotFound(_0x3bf30c,null))[_0x908d('0xd')](respondWithResult(_0x3bf30c,null))[_0x908d('0x3f')](handleError(_0x3bf30c,null));};exports[_0x908d('0x77')]=function(_0x5edbd9,_0x1a4afa,_0x3aa2a6){var _0x31d4e9=[];var _0x35c028=_0x5edbd9[_0x908d('0x44')]['id'];var _0xae854c=_0x5edbd9['user']['id'];return db[_0x908d('0x56')][_0x908d('0x42')]()[_0x908d('0xd')](function(_0x51c6d4){_0x31d4e9=_[_0x908d('0x18')](_0x51c6d4);return db[_0x908d('0x61')][_0x908d('0x62')](function(_0x32fc44){const _0x5065e4={'id':_0x35c028};return db['CmHopper'][_0x908d('0x6f')]({'attributes':['id','scheduledat',_0x908d('0x71')],'where':_0x5065e4,'transaction':_0x32fc44,'lock':_0x32fc44['LOCK'][_0x908d('0x72')],'include':[{'model':db[_0x908d('0x56')],'as':_0x908d('0x73'),'attributes':_0x31d4e9,'include':[{'model':db[_0x908d('0x78')],'as':_0x908d('0x74'),'attributes':['id',_0x908d('0xf')]}]},{'model':db[_0x908d('0x79')],'as':_0x908d('0x75'),'attributes':['id',_0x908d('0xf')]},{'model':db['VoiceQueue'],'as':_0x908d('0x76'),'attributes':['id',_0x908d('0xf'),_0x908d('0x7a')]}]})[_0x908d('0xd')](function(_0xb24af7){if(_0xb24af7){return _0xb24af7[_0x908d('0xc')]({'UserId':_0xae854c},{'transaction':_0x32fc44});}});});})['then'](handleEntityNotFound(_0x1a4afa,null))['then'](respondWithResult(_0x1a4afa,null))['catch'](handleError(_0x1a4afa,null));};exports[_0x908d('0x7b')]=function(_0x5e6a28,_0x1238d9){return _0x5e6a28['user'][_0x908d('0x7c')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x908d('0x7d')},'attributes':['id'],'raw':!![]})[_0x908d('0xd')](function(_0x31401f){if(_0x31401f&&_0x31401f[_0x908d('0x2e')]){return db[_0x908d('0x13')][_0x908d('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x908d('0x51')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x908d('0x12')](_0x31401f,'id')},'$or':[{'UserId':null},{'UserId':_0x5e6a28['user']['id']}]}});}return 0x0;})[_0x908d('0xd')](function(_0xaa6114){if(!_[_0x908d('0x5a')](_0xaa6114)&&_[_0x908d('0x7e')](_0xaa6114)){return _0x1238d9[_0x908d('0x5')](0xc8)['json']({'contacts':_0xaa6114});}else{logger['error'](_0x908d('0x7f'),_0x908d('0x7b'),0x194,_0x908d('0x80'));_0x1238d9[_0x908d('0x81')](0x194);}})['catch'](handleError(_0x1238d9,null));};exports[_0x908d('0x82')]=function(_0x121c99,_0xc2f39b){var _0xde7683=shared['timezones'];var _0x7f57c6=[];_[_0x908d('0x12')](_0xde7683,function(_0x430d93){_0x7f57c6[_0x908d('0x83')]({'id':_0x430d93[_0x908d('0xf')],'name':_0x430d93[_0x908d('0xf')],'utcOffset':_0x430d93[_0x908d('0x84')]});});return _0xc2f39b[_0x908d('0x5')](0xc8)[_0x908d('0x6')]({'tz':_0x7f57c6});};exports['getTimezone']=function(_0x3d0d5a,_0xc9be1c){var _0x3fbad0=shared['timezones'];var _0xd20668={};if(!_['isNil'](_0x3fbad0[_0x3d0d5a[_0x908d('0x40')]['id']]))_0xd20668=_0x3fbad0[_0x3d0d5a[_0x908d('0x40')]['id']];return _0xc9be1c[_0x908d('0x5')](0xc8)[_0x908d('0x6')](_0xd20668);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index d28229f..1ae7459 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 _0x3f8a=['rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x4b2a82,_0x3f3c01){var _0x122e07=function(_0x5e29fe){while(--_0x5e29fe){_0x4b2a82['push'](_0x4b2a82['shift']());}};_0x122e07(++_0x3f3c01);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x4d5256,_0x572fd3){_0x4d5256=_0x4d5256-0x0;var _0x315f40=_0x3f8a[_0x4d5256];return _0x315f40;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));module[_0xa3f8('0xa')]=function(_0x471464,_0x1f160a){return _0x471464[_0xa3f8('0xb')](_0xa3f8('0xc'),attributes,{'tableName':_0xa3f8('0xd'),'paranoid':![],'indexes':[{'name':_0xa3f8('0xe'),'fields':[_0xa3f8('0xe')]},{'name':_0xa3f8('0xf'),'fields':[_0xa3f8('0xf')]},{'name':_0xa3f8('0x10'),'fields':['priority']}],'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(_0xdc5d93,_0x594c9c){var _0x8455e7=function(_0x2e7078){while(--_0x2e7078){_0xdc5d93['push'](_0xdc5d93['shift']());}};_0x8455e7(++_0x594c9c);}(_0x814b,0x1a2));var _0xb814=function(_0x537501,_0x1509e4){_0x537501=_0x537501-0x0;var _0x54bfc2=_0x814b[_0x537501];return _0x54bfc2;};'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 4b34c17..bf2c04f 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 _0x98b7=['phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','literal','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','voicePause','CmList','List','lodash','util','moment','bluebird','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowCmHopper','stringify','CreateCmHopper','create','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','LOCK','UPDATE','Contact','keys','Agent','name','length','UserId','push','update','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','GetCmHopperPreview','findOne'];(function(_0x43862e,_0x4a9e13){var _0x255562=function(_0xd6157){while(--_0xd6157){_0x43862e['push'](_0x43862e['shift']());}};_0x255562(++_0x4a9e13);}(_0x98b7,0xc1));var _0x798b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x98b7[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x798b('0x0'));var util=require(_0x798b('0x1'));var moment=require(_0x798b('0x2'));var BPromise=require(_0x798b('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('rpc');var jayson=require(_0x798b('0x4'));var client=jayson[_0x798b('0x5')][_0x798b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x15b21a,_0x33c026,_0x4c197e){return new BPromise(function(_0x2bab89,_0x5d70b2){return client[_0x798b('0x7')](_0x15b21a,_0x4c197e)[_0x798b('0x8')](function(_0x3fb4de){logger[_0x798b('0x9')](_0x798b('0xa'),_0x33c026,'request\x20sent');logger[_0x798b('0xb')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x33c026,_0x798b('0xc'),JSON['stringify'](_0x3fb4de));if(_0x3fb4de[_0x798b('0xd')]){if(_0x3fb4de[_0x798b('0xd')][_0x798b('0xe')]===0x1f4){logger['error']('CmHopper,\x20%s,\x20%s',_0x33c026,_0x3fb4de[_0x798b('0xd')][_0x798b('0xf')]);return _0x5d70b2(_0x3fb4de[_0x798b('0xd')]['message']);}logger[_0x798b('0xd')]('CmHopper,\x20%s,\x20%s',_0x33c026,_0x3fb4de[_0x798b('0xd')]['message']);return _0x2bab89(_0x3fb4de[_0x798b('0xd')][_0x798b('0xf')]);}else{logger[_0x798b('0x9')](_0x798b('0xa'),_0x33c026,_0x798b('0xc'));_0x2bab89(_0x3fb4de[_0x798b('0x10')][_0x798b('0xf')]);}})['catch'](function(_0x511dd3){logger[_0x798b('0xd')](_0x798b('0xa'),_0x33c026,_0x511dd3);_0x5d70b2(_0x511dd3);});});}exports[_0x798b('0x11')]=function(_0x19b15c){var _0x2d2978=this;return new Promise(function(_0x46c7c5,_0x320602){return db[_0x798b('0x12')][_0x798b('0x13')]({'raw':_0x19b15c[_0x798b('0x14')]?_0x19b15c[_0x798b('0x14')][_0x798b('0x15')]===undefined?!![]:![]:!![],'where':_0x19b15c[_0x798b('0x14')]?_0x19b15c[_0x798b('0x14')][_0x798b('0x16')]||null:null,'attributes':_0x19b15c['options']?_0x19b15c[_0x798b('0x14')][_0x798b('0x17')]||null:null,'limit':_0x19b15c[_0x798b('0x14')]?_0x19b15c[_0x798b('0x14')][_0x798b('0x18')]||null:null,'include':_0x19b15c[_0x798b('0x14')]?_0x19b15c[_0x798b('0x14')][_0x798b('0x19')]?_['map'](_0x19b15c[_0x798b('0x14')][_0x798b('0x19')],function(_0x13766f){return{'model':db[_0x13766f[_0x798b('0x1a')]],'as':_0x13766f['as'],'attributes':_0x13766f['attributes'],'include':_0x13766f[_0x798b('0x19')]?_[_0x798b('0x1b')](_0x13766f[_0x798b('0x19')],function(_0x2d1ab9){return{'model':db[_0x2d1ab9['model']],'as':_0x2d1ab9['as'],'attributes':_0x2d1ab9[_0x798b('0x17')],'include':_0x2d1ab9['include']?_[_0x798b('0x1b')](_0x2d1ab9[_0x798b('0x19')],function(_0x38ae10){return{'model':db[_0x38ae10['model']],'as':_0x38ae10['as'],'attributes':_0x38ae10[_0x798b('0x17')]};}):[]};}):[]};}):[]:[]})[_0x798b('0x8')](function(_0x359ef5){logger[_0x798b('0x9')](_0x798b('0x11'),_0x19b15c);logger[_0x798b('0xb')](_0x798b('0x11'),_0x19b15c,JSON['stringify'](_0x359ef5));_0x46c7c5(_0x359ef5);})[_0x798b('0x1c')](function(_0x5a7266){logger[_0x798b('0xd')](_0x798b('0x11'),_0x5a7266[_0x798b('0xf')],_0x19b15c);_0x320602(_0x2d2978[_0x798b('0xd')](0x1f4,_0x5a7266[_0x798b('0xf')]));});});};exports['ShowCmHopper']=function(_0x543614){var _0x14da30=this;return new Promise(function(_0x40b229,_0x228c44){return db[_0x798b('0x12')]['find']({'raw':_0x543614[_0x798b('0x14')]?_0x543614[_0x798b('0x14')][_0x798b('0x15')]===undefined?!![]:![]:!![],'where':_0x543614[_0x798b('0x14')]?_0x543614['options'][_0x798b('0x16')]||null:null,'attributes':_0x543614[_0x798b('0x14')]?_0x543614[_0x798b('0x14')][_0x798b('0x17')]||null:null,'include':_0x543614[_0x798b('0x14')]?_0x543614[_0x798b('0x14')][_0x798b('0x19')]?_[_0x798b('0x1b')](_0x543614[_0x798b('0x14')]['include'],function(_0x2d8b7d){return{'model':db[_0x2d8b7d[_0x798b('0x1a')]],'as':_0x2d8b7d['as'],'attributes':_0x2d8b7d[_0x798b('0x17')],'include':_0x2d8b7d[_0x798b('0x19')]?_['map'](_0x2d8b7d['include'],function(_0x7a802b){return{'model':db[_0x7a802b[_0x798b('0x1a')]],'as':_0x7a802b['as'],'attributes':_0x7a802b[_0x798b('0x17')],'include':_0x7a802b[_0x798b('0x19')]?_[_0x798b('0x1b')](_0x7a802b['include'],function(_0x4fbf92){return{'model':db[_0x4fbf92[_0x798b('0x1a')]],'as':_0x4fbf92['as'],'attributes':_0x4fbf92[_0x798b('0x17')]};}):[]};}):[]};}):[]:[]})[_0x798b('0x8')](function(_0x3ff1d0){logger[_0x798b('0x9')](_0x798b('0x1d'),_0x543614);logger[_0x798b('0xb')](_0x798b('0x1d'),_0x543614,JSON[_0x798b('0x1e')](_0x3ff1d0));_0x40b229(_0x3ff1d0);})[_0x798b('0x1c')](function(_0x3d73ca){logger[_0x798b('0xd')](_0x798b('0x1d'),_0x3d73ca[_0x798b('0xf')],_0x543614);_0x228c44(_0x14da30[_0x798b('0xd')](0x1f4,_0x3d73ca[_0x798b('0xf')]));});});};exports[_0x798b('0x1f')]=function(_0x408612){var _0xad28d4=this;return new Promise(function(_0x26029f,_0x2d0fff){return db[_0x798b('0x12')][_0x798b('0x20')](_0x408612[_0x798b('0x21')],{'raw':_0x408612[_0x798b('0x14')]?_0x408612[_0x798b('0x14')][_0x798b('0x15')]===undefined?!![]:![]:!![]})[_0x798b('0x8')](function(_0xb63d9c){logger[_0x798b('0x9')](_0x798b('0x1f'),_0x408612);logger[_0x798b('0xb')](_0x798b('0x1f'),_0x408612,JSON['stringify'](_0xb63d9c));_0x26029f(_0xb63d9c);})[_0x798b('0x1c')](function(_0x2b0842){logger['error'](_0x798b('0x1f'),_0x2b0842[_0x798b('0xf')],_0x408612);_0x2d0fff(_0xad28d4[_0x798b('0xd')](0x1f4,_0x2b0842['message']));});});};exports[_0x798b('0x22')]=function(_0x2e6148){var _0xe258fc=this;return new Promise(function(_0x2a0efa,_0x5d3d44){return db['CmHopper']['update'](_0x2e6148[_0x798b('0x21')],{'raw':_0x2e6148[_0x798b('0x14')]?_0x2e6148[_0x798b('0x14')][_0x798b('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e6148['options']?_0x2e6148['options'][_0x798b('0x16')]||null:null,'attributes':_0x2e6148[_0x798b('0x14')]?_0x2e6148[_0x798b('0x14')]['attributes']||null:null,'limit':_0x2e6148[_0x798b('0x14')]?_0x2e6148['options']['limit']||null:null})['then'](function(_0x39d657){logger[_0x798b('0x9')](_0x798b('0x22'),_0x2e6148);logger['info'](_0x798b('0x23'),JSON['stringify'](_0x2e6148['options']['where']),_0x2e6148[_0x798b('0x21')][_0x798b('0x24')]);logger['debug'](_0x798b('0x22'),_0x2e6148,JSON[_0x798b('0x1e')](_0x39d657));_0x2a0efa(_0x39d657);})['catch'](function(_0x26338a){logger[_0x798b('0xd')](_0x798b('0x22'),_0x26338a[_0x798b('0xf')],_0x2e6148);_0x5d3d44(_0xe258fc['error'](0x1f4,_0x26338a[_0x798b('0xf')]));});});};exports[_0x798b('0x25')]=function(_0x37f3e1){var _0x48c1bd=this;return new Promise(function(_0xa8e7e8,_0xa970f6){return db[_0x798b('0x12')][_0x798b('0x26')]({'where':_0x37f3e1[_0x798b('0x14')]?_0x37f3e1[_0x798b('0x14')][_0x798b('0x16')]||null:null})[_0x798b('0x8')](function(_0x457b60){logger[_0x798b('0x9')](_0x798b('0x25'),_0x37f3e1);logger[_0x798b('0xb')](_0x798b('0x25'),_0x37f3e1,JSON['stringify'](_0x457b60));_0xa8e7e8(_0x457b60);})[_0x798b('0x1c')](function(_0x4b6798){logger[_0x798b('0xd')]('DestroyCmHopper',_0x4b6798[_0x798b('0xf')],_0x37f3e1);_0xa970f6(_0x48c1bd[_0x798b('0xd')](0x1f4,_0x4b6798[_0x798b('0xf')]));});});};exports[_0x798b('0x27')]=function(_0x56b346){var _0x2c5ba5=this;return new Promise(function(_0x390b0f,_0x4c1075){return db[_0x798b('0x28')][_0x798b('0x29')]()[_0x798b('0x8')](function(_0x5dbdd8){return db[_0x798b('0x2a')]['transaction'](function(_0x5dd836){return db[_0x798b('0x12')][_0x798b('0x13')]({'where':_0x56b346[_0x798b('0x14')]?_0x56b346[_0x798b('0x14')][_0x798b('0x16')]||null:null,'attributes':_0x56b346[_0x798b('0x14')]?_0x56b346[_0x798b('0x14')][_0x798b('0x17')]||null:null,'limit':_0x56b346[_0x798b('0x14')]?_0x56b346[_0x798b('0x14')][_0x798b('0x18')]||null:null,'order':_0x56b346[_0x798b('0x14')]?_0x56b346[_0x798b('0x14')]['order']||null:null,'transaction':_0x5dd836,'lock':_0x5dd836[_0x798b('0x2b')][_0x798b('0x2c')],'include':[{'model':db[_0x798b('0x28')],'as':_0x798b('0x2d'),'attributes':_[_0x798b('0x2e')](_0x5dbdd8)},{'model':db['User'],'as':_0x798b('0x2f'),'attributes':['id',_0x798b('0x30'),'voicePause']}]})[_0x798b('0x8')](function(_0x5572af){var _0xb0d7cd=[];var _0x5f4905=[];for(var _0x1d29f1=0x0;_0x1d29f1<_0x5572af[_0x798b('0x31')];_0x1d29f1+=0x1){var _0x3726bb=_0x5572af[_0x1d29f1][_0x798b('0x32')];if(_0x3726bb===null){_0xb0d7cd[_0x798b('0x33')](_0x5572af[_0x1d29f1][_0x798b('0x34')](_0x56b346[_0x798b('0x21')],{'transaction':_0x5dd836}));}else if(!_0x5f4905[_0x798b('0x35')](_0x3726bb)){_0x5f4905['push'](_0x3726bb);_0xb0d7cd[_0x798b('0x33')](_0x5572af[_0x1d29f1]['update'](_0x56b346[_0x798b('0x21')],{'transaction':_0x5dd836}));}}return BPromise[_0x798b('0x36')](_0xb0d7cd);});})[_0x798b('0x8')](function(_0x45fdd2){logger[_0x798b('0x9')]('GetContactDialer',_0x56b346);if(_0x45fdd2[_0x798b('0x31')]>0x0){logger['info'](_0x798b('0x37'),_0x45fdd2[0x0][_0x798b('0x38')]['id'],_0x45fdd2[0x0]['dataValues']['ContactId'],_0x45fdd2[0x0][_0x798b('0x38')]['active']);}logger[_0x798b('0xb')](_0x798b('0x27'),_0x56b346,JSON[_0x798b('0x1e')](_0x45fdd2));_0x390b0f(_0x45fdd2);})['catch'](function(_0x6377ec){logger['error'](_0x798b('0x27'),_0x6377ec[_0x798b('0xf')],_0x56b346);_0x4c1075(_0x2c5ba5[_0x798b('0xd')](0x1f4,_0x6377ec[_0x798b('0xf')]));});});});};exports['MoveContactManagedDialer']=function(_0xfb7104){var _0x1ca33a=this;return new Promise(function(_0x1612c6,_0x44a4a5){return db['sequelize'][_0x798b('0x39')](function(_0x2306cf){return db[_0x798b('0x3a')][_0x798b('0x20')](_0xfb7104[_0x798b('0x21')],{'raw':_0xfb7104[_0x798b('0x14')]?_0xfb7104['options'][_0x798b('0x15')]===undefined?!![]:![]:!![],'transaction':_0x2306cf})[_0x798b('0x8')](function(){logger[_0x798b('0x9')](_0x798b('0x3b'),JSON[_0x798b('0x1e')](_0xfb7104['options'][_0x798b('0x16')]),_0xfb7104[_0x798b('0x14')][_0x798b('0x16')][_0x798b('0x24')]);return db[_0x798b('0x12')][_0x798b('0x26')]({'where':_0xfb7104['options']?_0xfb7104[_0x798b('0x14')][_0x798b('0x16')]||null:null,'transaction':_0x2306cf});});})[_0x798b('0x8')](function(_0x18e3c4){logger['info'](_0x798b('0x3c'),_0xfb7104);logger[_0x798b('0xb')]('MoveContactManagedDialer',_0xfb7104,JSON[_0x798b('0x1e')](_0x18e3c4));_0x1612c6(_0x18e3c4);})[_0x798b('0x1c')](function(_0xad4324){logger[_0x798b('0xd')](_0x798b('0x3c'),_0xad4324['message'],_0xfb7104);_0x44a4a5(_0x1ca33a[_0x798b('0xd')](0x1f4,_0xad4324[_0x798b('0xf')]));});});};exports[_0x798b('0x3d')]=function(_0x554fa9){var _0xa5e5a4=this;return new Promise(function(_0x3e69b6,_0x272a76){return db[_0x798b('0x12')]['findAll']({'raw':_0x554fa9[_0x798b('0x14')]?_0x554fa9['options'][_0x798b('0x15')]===undefined?!![]:![]:!![],'where':_0x554fa9[_0x798b('0x14')]?_0x554fa9[_0x798b('0x14')][_0x798b('0x16')]||null:null,'attributes':[[db[_0x798b('0x2a')]['fn']('COUNT',db[_0x798b('0x2a')]['fn']('IF',db[_0x798b('0x2a')]['literal'](_0x798b('0x3e')+util[_0x798b('0x3f')](_0x798b('0x40'),moment()[_0x798b('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x798b('0x41')))),_0x798b('0x42')]]})[_0x798b('0x8')](function(_0x49d64e){logger['info']('CountReScheduled',_0x554fa9);logger[_0x798b('0xb')]('CountReScheduled',_0x554fa9,JSON['stringify'](_0x49d64e));_0x3e69b6(_0x49d64e);})[_0x798b('0x1c')](function(_0x33264d){logger[_0x798b('0xd')](_0x798b('0x3d'),_0x33264d[_0x798b('0xf')],_0x554fa9);_0x272a76(_0xa5e5a4['error'](0x1f4,_0x33264d[_0x798b('0xf')]));});});};exports[_0x798b('0x43')]=function(_0x341300){var _0x410cfb=this;return new Promise(function(_0x227b55,_0x2993c2){return db[_0x798b('0x28')][_0x798b('0x29')]()[_0x798b('0x8')](function(_0x4c72c8){return db[_0x798b('0x2a')][_0x798b('0x39')](function(_0x17c6e1){return db[_0x798b('0x12')][_0x798b('0x13')]({'where':_0x341300[_0x798b('0x14')]?_0x341300[_0x798b('0x14')]['where']||null:null,'attributes':_0x341300[_0x798b('0x14')]?_0x341300[_0x798b('0x14')][_0x798b('0x17')]||null:null,'limit':0x1,'order':_0x341300['options']?_0x341300[_0x798b('0x14')][_0x798b('0x44')]||null:null,'group':db['CmHopper'][_0x798b('0x32')],'transaction':_0x17c6e1,'lock':_0x17c6e1['LOCK'][_0x798b('0x2c')],'include':_0x341300[_0x798b('0x14')]?_0x341300['options']['include']?_['map'](_0x341300[_0x798b('0x14')][_0x798b('0x19')],function(_0x1cdf98){return{'model':db[_0x1cdf98[_0x798b('0x1a')]],'as':_0x1cdf98['as'],'attributes':_0x1cdf98[_0x798b('0x17')],'include':_0x1cdf98[_0x798b('0x19')]?_[_0x798b('0x1b')](_0x1cdf98[_0x798b('0x19')],function(_0x264c35){return{'model':db[_0x264c35['model']],'as':_0x264c35['as'],'attributes':_0x264c35['attributes'],'include':_0x264c35[_0x798b('0x19')]?_['map'](_0x264c35[_0x798b('0x19')],function(_0x29f920){return{'model':db[_0x29f920[_0x798b('0x1a')]],'as':_0x29f920['as'],'attributes':_0x29f920['attributes']};}):[]};}):[]};}):[]:[]})[_0x798b('0x8')](function(_0xce4c14){var _0x108b2e=[];for(var _0x4b8752=0x0;_0x4b8752<_0xce4c14['length'];_0x4b8752+=0x1){_0x108b2e[_0x798b('0x33')](_0xce4c14[_0x4b8752][_0x798b('0x34')](_0x341300[_0x798b('0x21')],{'transaction':_0x17c6e1}));}return BPromise[_0x798b('0x36')](_0x108b2e);});})[_0x798b('0x8')](function(_0xbd3f8a){logger[_0x798b('0x9')](_0x798b('0x43'),_0x341300);logger['debug'](_0x798b('0x43'),_0x341300,JSON[_0x798b('0x1e')](_0xbd3f8a));_0x227b55(_0xbd3f8a);})[_0x798b('0x1c')](function(_0x283a2a){logger[_0x798b('0xd')]('GetContactRecallMe',_0x283a2a[_0x798b('0xf')],_0x341300);_0x2993c2(_0x410cfb['error'](0x1f4,_0x283a2a[_0x798b('0xf')]));});});});};exports[_0x798b('0x45')]=function(_0xd637d8){var _0x30e304=this;return new Promise(function(_0x370224,_0x1fc4f1){db['CmContact'][_0x798b('0x29')]()[_0x798b('0x8')](function(_0x538091){return db['CmHopper']['findAll']({'raw':_0xd637d8[_0x798b('0x14')]?_0xd637d8[_0x798b('0x14')][_0x798b('0x15')]===undefined?!![]:![]:!![],'where':_0xd637d8[_0x798b('0x14')]?_0xd637d8[_0x798b('0x14')][_0x798b('0x16')]||null:null,'attributes':_0xd637d8['options']?_0xd637d8[_0x798b('0x14')]['attributes']||null:null,'limit':_0xd637d8[_0x798b('0x14')]?_0xd637d8[_0x798b('0x14')]['limit']||null:null,'include':_0xd637d8[_0x798b('0x14')]?_0xd637d8[_0x798b('0x14')][_0x798b('0x19')]?_[_0x798b('0x1b')](_0xd637d8[_0x798b('0x14')][_0x798b('0x19')],function(_0xb58b6c){return{'model':db[_0xb58b6c[_0x798b('0x1a')]],'as':_0xb58b6c['as'],'attributes':_0xb58b6c['as']===_0x798b('0x2d')?_[_0x798b('0x2e')](_0x538091):_0xb58b6c[_0x798b('0x17')],'include':_0xb58b6c[_0x798b('0x19')]?_[_0x798b('0x1b')](_0xb58b6c['include'],function(_0x5b4b8d){return{'model':db[_0x5b4b8d[_0x798b('0x1a')]],'as':_0x5b4b8d['as'],'attributes':_0x5b4b8d[_0x798b('0x17')],'include':_0x5b4b8d['include']?_[_0x798b('0x1b')](_0x5b4b8d[_0x798b('0x19')],function(_0x3948af){return{'model':db[_0x3948af[_0x798b('0x1a')]],'as':_0x3948af['as'],'attributes':_0x3948af[_0x798b('0x17')]};}):[]};}):[]};}):[]:[]})[_0x798b('0x8')](function(_0x18f156){logger['info'](_0x798b('0x11'),_0xd637d8);logger[_0x798b('0xb')]('GetCmHopper',_0xd637d8,JSON[_0x798b('0x1e')](_0x18f156));_0x370224(_0x18f156);})[_0x798b('0x1c')](function(_0x12d003){logger['error'](_0x798b('0x11'),_0x12d003[_0x798b('0xf')],_0xd637d8);_0x1fc4f1(_0x30e304[_0x798b('0xd')](0x1f4,_0x12d003[_0x798b('0xf')]));});});});};exports['GetContactByPhone']=function(_0x3826e6){var _0x522482=this;return new Promise(function(_0x57d71d,_0x3b57df){return db[_0x798b('0x28')][_0x798b('0x46')]({'raw':!![],'where':{'phone':_0x3826e6[_0x798b('0x14')][_0x798b('0x16')][_0x798b('0x47')]},'attributes':['id',_0x798b('0x48')],'order':[['id',_0x798b('0x49')]]})[_0x798b('0x8')](function(_0x599a50){logger[_0x798b('0x9')](_0x798b('0x4a'),_0x3826e6);logger[_0x798b('0xb')]('getContactByPhone',_0x3826e6,JSON[_0x798b('0x1e')](_0x599a50));_0x57d71d(_0x599a50);})[_0x798b('0x1c')](function(_0x344404){logger[_0x798b('0xd')](_0x798b('0x4a'),_0x344404[_0x798b('0xf')],_0x3826e6);_0x3b57df(_0x522482[_0x798b('0xd')](0x1f4,_0x344404[_0x798b('0xf')]));});});};exports[_0x798b('0x4b')]=function(_0x4fd5e9){var _0x51a08a=this;return new Promise(function(_0x57d60b,_0x25d7f8){return db[_0x798b('0x2a')][_0x798b('0x39')](function(_0x2f2656){return db[_0x798b('0x12')]['update']({'active':![]},{'where':{},'transaction':_0x2f2656})[_0x798b('0x8')](function(_0x240e1d){logger[_0x798b('0x9')](_0x798b('0x4b'),_0x4fd5e9);logger['debug'](_0x798b('0x4b'),_0x4fd5e9,JSON[_0x798b('0x1e')](_0x240e1d));_0x57d60b(_0x240e1d);})['catch'](function(_0x254ea8){logger['error']('ResetActiveCalls',_0x254ea8[_0x798b('0xf')],_0x4fd5e9);_0x25d7f8(_0x51a08a[_0x798b('0xd')](0x1f4,_0x254ea8[_0x798b('0xf')]));});});});};exports[_0x798b('0x4c')]=function(_0x53b0a1){var _0x5e96e4=this;var _0x23e8c0=_0x53b0a1['body'][_0x798b('0x16')][_0x798b('0x4d')];var _0x374534=_0x53b0a1[_0x798b('0x21')][_0x798b('0x16')][_0x798b('0x4e')];var _0x101a65=_0x53b0a1[_0x798b('0x21')][_0x798b('0x16')][_0x798b('0x4f')];return new Promise(function(_0x5cd286,_0x135f14){return db[_0x798b('0x12')][_0x798b('0x13')]({'where':{'voiceQueueId':{'$in':_0x23e8c0},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x798b('0x50')](_0x798b('0x51')+_0x374534+_0x798b('0x52')),'$gt':db[_0x798b('0x2a')][_0x798b('0x50')](_0x798b('0x53'))}},'UserId':{'$in':_0x101a65}},'include':[{'model':db[_0x798b('0x28')],'as':_0x798b('0x2d')},{'model':db[_0x798b('0x54')],'as':_0x798b('0x2f'),'attributes':['id',_0x798b('0x30'),_0x798b('0x55')]},{'model':db[_0x798b('0x56')],'as':_0x798b('0x57')}]})['then'](function(_0x135051){if(_0x135051[_0x798b('0x31')]>0x0){return db[_0x798b('0x2a')][_0x798b('0x39')](function(_0x3905e3){return db[_0x798b('0x12')][_0x798b('0x34')]({'recallmeNotifiedDate':db['sequelize'][_0x798b('0x50')](_0x798b('0x53'))},{'where':{'id':{'$in':_[_0x798b('0x1b')](_0x135051,'id')}},'transaction':_0x3905e3})['then'](function(){_0x5cd286(_0x135051);})[_0x798b('0x1c')](function(_0x271bb9){logger[_0x798b('0xd')](_0x798b('0x4c'),_0x271bb9[_0x798b('0xf')],_0x53b0a1);_0x135f14(_0x5e96e4['error'](0x1f4,_0x271bb9[_0x798b('0xf')]));});})['catch'](function(_0x1f64da){logger['error'](_0x798b('0x4c'),_0x1f64da['message'],_0x53b0a1);_0x135f14(_0x5e96e4[_0x798b('0xd')](0x1f4,_0x1f64da[_0x798b('0xf')]));});}else{_0x5cd286(_0x135051);}});});}; \ No newline at end of file +var _0x1cbc=['raw','attributes','limit','include','map','model','then','ShowCmHopper','where','CreateCmHopper','CmHopper','create','body','UpdateCmHopper','update','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','includes','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe','order','GetCmHopperPreview','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','catch','GetCmHopper','findAll','options'];(function(_0x2af434,_0x5f3d88){var _0x40d7e6=function(_0x485c05){while(--_0x485c05){_0x2af434['push'](_0x2af434['shift']());}};_0x40d7e6(++_0x5f3d88);}(_0x1cbc,0xf4));var _0xc1cb=function(_0x4b7d87,_0x238711){_0x4b7d87=_0x4b7d87-0x0;var _0x3b9f82=_0x1cbc[_0x4b7d87];return _0x3b9f82;};'use strict';var _=require(_0xc1cb('0x0'));var util=require('util');var moment=require(_0xc1cb('0x1'));var BPromise=require(_0xc1cb('0x2'));var db=require(_0xc1cb('0x3'))['db'];var logger=require(_0xc1cb('0x4'))(_0xc1cb('0x5'));var jayson=require(_0xc1cb('0x6'));var client=jayson[_0xc1cb('0x7')][_0xc1cb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf92511,_0x3d5b4c,_0x1dacec){return new BPromise(function(_0x27423b,_0x56f1c8){return client[_0xc1cb('0x9')](_0xf92511,_0x1dacec)['then'](function(_0xe5da07){logger[_0xc1cb('0xa')]('CmHopper,\x20%s,\x20%s',_0x3d5b4c,_0xc1cb('0xb'));logger[_0xc1cb('0xc')](_0xc1cb('0xd'),_0x3d5b4c,_0xc1cb('0xb'),JSON[_0xc1cb('0xe')](_0xe5da07));if(_0xe5da07[_0xc1cb('0xf')]){if(_0xe5da07[_0xc1cb('0xf')][_0xc1cb('0x10')]===0x1f4){logger['error'](_0xc1cb('0x11'),_0x3d5b4c,_0xe5da07['error'][_0xc1cb('0x12')]);return _0x56f1c8(_0xe5da07[_0xc1cb('0xf')][_0xc1cb('0x12')]);}logger[_0xc1cb('0xf')](_0xc1cb('0x11'),_0x3d5b4c,_0xe5da07[_0xc1cb('0xf')][_0xc1cb('0x12')]);return _0x27423b(_0xe5da07['error'][_0xc1cb('0x12')]);}else{logger[_0xc1cb('0xa')](_0xc1cb('0x11'),_0x3d5b4c,_0xc1cb('0xb'));_0x27423b(_0xe5da07['result'][_0xc1cb('0x12')]);}})[_0xc1cb('0x13')](function(_0x4fd5ea){logger['error'](_0xc1cb('0x11'),_0x3d5b4c,_0x4fd5ea);_0x56f1c8(_0x4fd5ea);});});}exports[_0xc1cb('0x14')]=function(_0xc10170){var _0x49dca2=this;return new Promise(function(_0x5a47a4,_0x4df1b9){return db['CmHopper'][_0xc1cb('0x15')]({'raw':_0xc10170[_0xc1cb('0x16')]?_0xc10170[_0xc1cb('0x16')][_0xc1cb('0x17')]===undefined?!![]:![]:!![],'where':_0xc10170[_0xc1cb('0x16')]?_0xc10170[_0xc1cb('0x16')]['where']||null:null,'attributes':_0xc10170[_0xc1cb('0x16')]?_0xc10170[_0xc1cb('0x16')][_0xc1cb('0x18')]||null:null,'limit':_0xc10170[_0xc1cb('0x16')]?_0xc10170['options'][_0xc1cb('0x19')]||null:null,'include':_0xc10170[_0xc1cb('0x16')]?_0xc10170[_0xc1cb('0x16')]['include']?_['map'](_0xc10170[_0xc1cb('0x16')][_0xc1cb('0x1a')],function(_0x4c8298){return{'model':db[_0x4c8298['model']],'as':_0x4c8298['as'],'attributes':_0x4c8298[_0xc1cb('0x18')],'include':_0x4c8298[_0xc1cb('0x1a')]?_[_0xc1cb('0x1b')](_0x4c8298[_0xc1cb('0x1a')],function(_0x2d27a7){return{'model':db[_0x2d27a7[_0xc1cb('0x1c')]],'as':_0x2d27a7['as'],'attributes':_0x2d27a7[_0xc1cb('0x18')],'include':_0x2d27a7['include']?_[_0xc1cb('0x1b')](_0x2d27a7['include'],function(_0x1179a1){return{'model':db[_0x1179a1[_0xc1cb('0x1c')]],'as':_0x1179a1['as'],'attributes':_0x1179a1[_0xc1cb('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc1cb('0x1d')](function(_0x2f9e2c){logger[_0xc1cb('0xa')](_0xc1cb('0x14'),_0xc10170);logger[_0xc1cb('0xc')](_0xc1cb('0x14'),_0xc10170,JSON[_0xc1cb('0xe')](_0x2f9e2c));_0x5a47a4(_0x2f9e2c);})[_0xc1cb('0x13')](function(_0x4378f4){logger['error']('GetCmHopper',_0x4378f4['message'],_0xc10170);_0x4df1b9(_0x49dca2[_0xc1cb('0xf')](0x1f4,_0x4378f4[_0xc1cb('0x12')]));});});};exports[_0xc1cb('0x1e')]=function(_0x496093){var _0x9fdcb9=this;return new Promise(function(_0x3b5063,_0x2e6d7d){return db['CmHopper']['find']({'raw':_0x496093[_0xc1cb('0x16')]?_0x496093[_0xc1cb('0x16')][_0xc1cb('0x17')]===undefined?!![]:![]:!![],'where':_0x496093[_0xc1cb('0x16')]?_0x496093[_0xc1cb('0x16')][_0xc1cb('0x1f')]||null:null,'attributes':_0x496093[_0xc1cb('0x16')]?_0x496093[_0xc1cb('0x16')]['attributes']||null:null,'include':_0x496093['options']?_0x496093[_0xc1cb('0x16')]['include']?_[_0xc1cb('0x1b')](_0x496093['options'][_0xc1cb('0x1a')],function(_0x19c59a){return{'model':db[_0x19c59a[_0xc1cb('0x1c')]],'as':_0x19c59a['as'],'attributes':_0x19c59a[_0xc1cb('0x18')],'include':_0x19c59a[_0xc1cb('0x1a')]?_[_0xc1cb('0x1b')](_0x19c59a[_0xc1cb('0x1a')],function(_0x4bf21b){return{'model':db[_0x4bf21b[_0xc1cb('0x1c')]],'as':_0x4bf21b['as'],'attributes':_0x4bf21b['attributes'],'include':_0x4bf21b['include']?_['map'](_0x4bf21b[_0xc1cb('0x1a')],function(_0x27f202){return{'model':db[_0x27f202[_0xc1cb('0x1c')]],'as':_0x27f202['as'],'attributes':_0x27f202[_0xc1cb('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc1cb('0x1d')](function(_0x30474f){logger[_0xc1cb('0xa')](_0xc1cb('0x1e'),_0x496093);logger[_0xc1cb('0xc')]('ShowCmHopper',_0x496093,JSON[_0xc1cb('0xe')](_0x30474f));_0x3b5063(_0x30474f);})[_0xc1cb('0x13')](function(_0x20cb54){logger['error']('ShowCmHopper',_0x20cb54[_0xc1cb('0x12')],_0x496093);_0x2e6d7d(_0x9fdcb9[_0xc1cb('0xf')](0x1f4,_0x20cb54[_0xc1cb('0x12')]));});});};exports[_0xc1cb('0x20')]=function(_0x1e3c85){var _0x5aec00=this;return new Promise(function(_0x262b17,_0x1afb2f){return db[_0xc1cb('0x21')][_0xc1cb('0x22')](_0x1e3c85[_0xc1cb('0x23')],{'raw':_0x1e3c85[_0xc1cb('0x16')]?_0x1e3c85[_0xc1cb('0x16')][_0xc1cb('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0xab4c7d){logger['info'](_0xc1cb('0x20'),_0x1e3c85);logger[_0xc1cb('0xc')](_0xc1cb('0x20'),_0x1e3c85,JSON[_0xc1cb('0xe')](_0xab4c7d));_0x262b17(_0xab4c7d);})[_0xc1cb('0x13')](function(_0x263993){logger[_0xc1cb('0xf')]('CreateCmHopper',_0x263993[_0xc1cb('0x12')],_0x1e3c85);_0x1afb2f(_0x5aec00[_0xc1cb('0xf')](0x1f4,_0x263993[_0xc1cb('0x12')]));});});};exports[_0xc1cb('0x24')]=function(_0x30bcb5){var _0x551a97=this;return new Promise(function(_0x3fa1bc,_0x1d449c){return db['CmHopper'][_0xc1cb('0x25')](_0x30bcb5[_0xc1cb('0x23')],{'raw':_0x30bcb5[_0xc1cb('0x16')]?_0x30bcb5[_0xc1cb('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30bcb5['options']?_0x30bcb5[_0xc1cb('0x16')][_0xc1cb('0x1f')]||null:null,'attributes':_0x30bcb5[_0xc1cb('0x16')]?_0x30bcb5['options'][_0xc1cb('0x18')]||null:null,'limit':_0x30bcb5[_0xc1cb('0x16')]?_0x30bcb5[_0xc1cb('0x16')][_0xc1cb('0x19')]||null:null})[_0xc1cb('0x1d')](function(_0xd4aabe){logger['info']('UpdateCmHopper',_0x30bcb5);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0xc1cb('0xe')](_0x30bcb5[_0xc1cb('0x16')][_0xc1cb('0x1f')]),_0x30bcb5[_0xc1cb('0x23')][_0xc1cb('0x26')]);logger[_0xc1cb('0xc')](_0xc1cb('0x24'),_0x30bcb5,JSON[_0xc1cb('0xe')](_0xd4aabe));_0x3fa1bc(_0xd4aabe);})[_0xc1cb('0x13')](function(_0x49caab){logger[_0xc1cb('0xf')]('UpdateCmHopper',_0x49caab[_0xc1cb('0x12')],_0x30bcb5);_0x1d449c(_0x551a97[_0xc1cb('0xf')](0x1f4,_0x49caab[_0xc1cb('0x12')]));});});};exports['DestroyCmHopper']=function(_0x13f6ba){var _0x45eabb=this;return new Promise(function(_0x20d531,_0x37cbfb){return db[_0xc1cb('0x21')]['destroy']({'where':_0x13f6ba[_0xc1cb('0x16')]?_0x13f6ba[_0xc1cb('0x16')]['where']||null:null})[_0xc1cb('0x1d')](function(_0x209bb2){logger[_0xc1cb('0xa')](_0xc1cb('0x27'),_0x13f6ba);logger[_0xc1cb('0xc')](_0xc1cb('0x27'),_0x13f6ba,JSON[_0xc1cb('0xe')](_0x209bb2));_0x20d531(_0x209bb2);})[_0xc1cb('0x13')](function(_0x5e8c47){logger[_0xc1cb('0xf')](_0xc1cb('0x27'),_0x5e8c47[_0xc1cb('0x12')],_0x13f6ba);_0x37cbfb(_0x45eabb[_0xc1cb('0xf')](0x1f4,_0x5e8c47[_0xc1cb('0x12')]));});});};exports[_0xc1cb('0x28')]=function(_0x776875){var _0xbc8d04=this;return new Promise(function(_0x41a1e8,_0x51d6ab){return db[_0xc1cb('0x29')][_0xc1cb('0x2a')]()[_0xc1cb('0x1d')](function(_0x256c2d){return db[_0xc1cb('0x2b')][_0xc1cb('0x2c')](function(_0x26c90e){return db[_0xc1cb('0x21')][_0xc1cb('0x15')]({'where':_0x776875[_0xc1cb('0x16')]?_0x776875[_0xc1cb('0x16')][_0xc1cb('0x1f')]||null:null,'attributes':_0x776875[_0xc1cb('0x16')]?_0x776875[_0xc1cb('0x16')][_0xc1cb('0x18')]||null:null,'limit':_0x776875['options']?_0x776875[_0xc1cb('0x16')][_0xc1cb('0x19')]||null:null,'order':_0x776875['options']?_0x776875[_0xc1cb('0x16')]['order']||null:null,'transaction':_0x26c90e,'lock':_0x26c90e[_0xc1cb('0x2d')][_0xc1cb('0x2e')],'include':[{'model':db[_0xc1cb('0x29')],'as':_0xc1cb('0x2f'),'attributes':_[_0xc1cb('0x30')](_0x256c2d)},{'model':db[_0xc1cb('0x31')],'as':_0xc1cb('0x32'),'attributes':['id',_0xc1cb('0x33'),_0xc1cb('0x34')]}]})[_0xc1cb('0x1d')](function(_0x16bbf5){var _0x5ddc80=[];var _0x23f427=[];for(var _0x127266=0x0;_0x127266<_0x16bbf5[_0xc1cb('0x35')];_0x127266+=0x1){var _0x55064c=_0x16bbf5[_0x127266][_0xc1cb('0x36')];if(_0x55064c===null){_0x5ddc80['push'](_0x16bbf5[_0x127266]['update'](_0x776875[_0xc1cb('0x23')],{'transaction':_0x26c90e}));}else if(!_0x23f427[_0xc1cb('0x37')](_0x55064c)){_0x23f427[_0xc1cb('0x38')](_0x55064c);_0x5ddc80[_0xc1cb('0x38')](_0x16bbf5[_0x127266]['update'](_0x776875[_0xc1cb('0x23')],{'transaction':_0x26c90e}));}}return BPromise[_0xc1cb('0x39')](_0x5ddc80);});})['then'](function(_0x415920){logger[_0xc1cb('0xa')](_0xc1cb('0x28'),_0x776875);if(_0x415920[_0xc1cb('0x35')]>0x0){logger[_0xc1cb('0xa')](_0xc1cb('0x3a'),_0x415920[0x0]['dataValues']['id'],_0x415920[0x0][_0xc1cb('0x3b')]['ContactId'],_0x415920[0x0]['dataValues']['active']);}logger['debug'](_0xc1cb('0x28'),_0x776875,JSON[_0xc1cb('0xe')](_0x415920));_0x41a1e8(_0x415920);})[_0xc1cb('0x13')](function(_0x17e809){logger[_0xc1cb('0xf')]('GetContactDialer',_0x17e809[_0xc1cb('0x12')],_0x776875);_0x51d6ab(_0xbc8d04[_0xc1cb('0xf')](0x1f4,_0x17e809[_0xc1cb('0x12')]));});});});};exports[_0xc1cb('0x3c')]=function(_0x1ade42){var _0x43bb73=this;return new Promise(function(_0x9e87a6,_0x166f98){return db[_0xc1cb('0x2b')][_0xc1cb('0x2c')](function(_0x15e7ca){return db[_0xc1cb('0x3d')]['create'](_0x1ade42[_0xc1cb('0x23')],{'raw':_0x1ade42[_0xc1cb('0x16')]?_0x1ade42[_0xc1cb('0x16')][_0xc1cb('0x17')]===undefined?!![]:![]:!![],'transaction':_0x15e7ca})['then'](function(){logger[_0xc1cb('0xa')](_0xc1cb('0x3e'),JSON[_0xc1cb('0xe')](_0x1ade42[_0xc1cb('0x16')]['where']),_0x1ade42[_0xc1cb('0x16')][_0xc1cb('0x1f')][_0xc1cb('0x26')]);return db[_0xc1cb('0x21')][_0xc1cb('0x3f')]({'where':_0x1ade42[_0xc1cb('0x16')]?_0x1ade42[_0xc1cb('0x16')]['where']||null:null,'transaction':_0x15e7ca});});})['then'](function(_0x3cd8d4){logger[_0xc1cb('0xa')](_0xc1cb('0x3c'),_0x1ade42);logger['debug'](_0xc1cb('0x3c'),_0x1ade42,JSON[_0xc1cb('0xe')](_0x3cd8d4));_0x9e87a6(_0x3cd8d4);})['catch'](function(_0x384716){logger[_0xc1cb('0xf')](_0xc1cb('0x3c'),_0x384716['message'],_0x1ade42);_0x166f98(_0x43bb73['error'](0x1f4,_0x384716[_0xc1cb('0x12')]));});});};exports['CountReScheduled']=function(_0x27b92e){var _0x2537fb=this;return new Promise(function(_0x31a899,_0x1876d8){return db['CmHopper'][_0xc1cb('0x15')]({'raw':_0x27b92e[_0xc1cb('0x16')]?_0x27b92e[_0xc1cb('0x16')][_0xc1cb('0x17')]===undefined?!![]:![]:!![],'where':_0x27b92e[_0xc1cb('0x16')]?_0x27b92e[_0xc1cb('0x16')][_0xc1cb('0x1f')]||null:null,'attributes':[[db[_0xc1cb('0x2b')]['fn'](_0xc1cb('0x40'),db['sequelize']['fn']('IF',db[_0xc1cb('0x2b')][_0xc1cb('0x41')](_0xc1cb('0x42')+util[_0xc1cb('0x43')](_0xc1cb('0x44'),moment()['format'](_0xc1cb('0x45')))+_0xc1cb('0x46')))),'contactsRescheduled']]})[_0xc1cb('0x1d')](function(_0x1479c5){logger[_0xc1cb('0xa')](_0xc1cb('0x47'),_0x27b92e);logger['debug'](_0xc1cb('0x47'),_0x27b92e,JSON[_0xc1cb('0xe')](_0x1479c5));_0x31a899(_0x1479c5);})[_0xc1cb('0x13')](function(_0x160495){logger[_0xc1cb('0xf')](_0xc1cb('0x47'),_0x160495[_0xc1cb('0x12')],_0x27b92e);_0x1876d8(_0x2537fb['error'](0x1f4,_0x160495['message']));});});};exports[_0xc1cb('0x48')]=function(_0x38fc7e){var _0xfd3fc0=this;return new Promise(function(_0x56957e,_0x5ed1ac){return db['CmContact']['describe']()[_0xc1cb('0x1d')](function(_0x5e3f23){return db[_0xc1cb('0x2b')]['transaction'](function(_0x5c44be){return db[_0xc1cb('0x21')][_0xc1cb('0x15')]({'where':_0x38fc7e[_0xc1cb('0x16')]?_0x38fc7e['options'][_0xc1cb('0x1f')]||null:null,'attributes':_0x38fc7e[_0xc1cb('0x16')]?_0x38fc7e[_0xc1cb('0x16')]['attributes']||null:null,'limit':0x1,'order':_0x38fc7e[_0xc1cb('0x16')]?_0x38fc7e['options'][_0xc1cb('0x49')]||null:null,'group':db[_0xc1cb('0x21')][_0xc1cb('0x36')],'transaction':_0x5c44be,'lock':_0x5c44be[_0xc1cb('0x2d')]['UPDATE'],'include':_0x38fc7e['options']?_0x38fc7e[_0xc1cb('0x16')][_0xc1cb('0x1a')]?_['map'](_0x38fc7e['options'][_0xc1cb('0x1a')],function(_0x52cdbc){return{'model':db[_0x52cdbc[_0xc1cb('0x1c')]],'as':_0x52cdbc['as'],'attributes':_0x52cdbc['attributes'],'include':_0x52cdbc[_0xc1cb('0x1a')]?_[_0xc1cb('0x1b')](_0x52cdbc[_0xc1cb('0x1a')],function(_0x2e8f8d){return{'model':db[_0x2e8f8d[_0xc1cb('0x1c')]],'as':_0x2e8f8d['as'],'attributes':_0x2e8f8d[_0xc1cb('0x18')],'include':_0x2e8f8d[_0xc1cb('0x1a')]?_[_0xc1cb('0x1b')](_0x2e8f8d[_0xc1cb('0x1a')],function(_0x334687){return{'model':db[_0x334687['model']],'as':_0x334687['as'],'attributes':_0x334687[_0xc1cb('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc1cb('0x1d')](function(_0x2a7d1b){var _0x494676=[];for(var _0x24eab1=0x0;_0x24eab1<_0x2a7d1b['length'];_0x24eab1+=0x1){_0x494676['push'](_0x2a7d1b[_0x24eab1]['update'](_0x38fc7e[_0xc1cb('0x23')],{'transaction':_0x5c44be}));}return BPromise[_0xc1cb('0x39')](_0x494676);});})[_0xc1cb('0x1d')](function(_0x5bd56f){logger[_0xc1cb('0xa')]('GetContactRecallMe',_0x38fc7e);logger[_0xc1cb('0xc')](_0xc1cb('0x48'),_0x38fc7e,JSON['stringify'](_0x5bd56f));_0x56957e(_0x5bd56f);})[_0xc1cb('0x13')](function(_0x14bce7){logger[_0xc1cb('0xf')]('GetContactRecallMe',_0x14bce7[_0xc1cb('0x12')],_0x38fc7e);_0x5ed1ac(_0xfd3fc0[_0xc1cb('0xf')](0x1f4,_0x14bce7[_0xc1cb('0x12')]));});});});};exports[_0xc1cb('0x4a')]=function(_0x5ea9ff){var _0x215c3f=this;return new Promise(function(_0x3456ca,_0xa2ce6c){db[_0xc1cb('0x29')]['describe']()['then'](function(_0x3870e6){return db['CmHopper'][_0xc1cb('0x15')]({'raw':_0x5ea9ff[_0xc1cb('0x16')]?_0x5ea9ff[_0xc1cb('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x5ea9ff[_0xc1cb('0x16')]?_0x5ea9ff[_0xc1cb('0x16')][_0xc1cb('0x1f')]||null:null,'attributes':_0x5ea9ff['options']?_0x5ea9ff[_0xc1cb('0x16')][_0xc1cb('0x18')]||null:null,'limit':_0x5ea9ff[_0xc1cb('0x16')]?_0x5ea9ff[_0xc1cb('0x16')][_0xc1cb('0x19')]||null:null,'include':_0x5ea9ff['options']?_0x5ea9ff[_0xc1cb('0x16')][_0xc1cb('0x1a')]?_[_0xc1cb('0x1b')](_0x5ea9ff[_0xc1cb('0x16')][_0xc1cb('0x1a')],function(_0x167268){return{'model':db[_0x167268[_0xc1cb('0x1c')]],'as':_0x167268['as'],'attributes':_0x167268['as']===_0xc1cb('0x2f')?_[_0xc1cb('0x30')](_0x3870e6):_0x167268[_0xc1cb('0x18')],'include':_0x167268[_0xc1cb('0x1a')]?_[_0xc1cb('0x1b')](_0x167268['include'],function(_0x5ab337){return{'model':db[_0x5ab337['model']],'as':_0x5ab337['as'],'attributes':_0x5ab337['attributes'],'include':_0x5ab337[_0xc1cb('0x1a')]?_['map'](_0x5ab337[_0xc1cb('0x1a')],function(_0x1365a4){return{'model':db[_0x1365a4[_0xc1cb('0x1c')]],'as':_0x1365a4['as'],'attributes':_0x1365a4['attributes']};}):[]};}):[]};}):[]:[]})[_0xc1cb('0x1d')](function(_0x20f4fc){logger['info'](_0xc1cb('0x14'),_0x5ea9ff);logger[_0xc1cb('0xc')](_0xc1cb('0x14'),_0x5ea9ff,JSON['stringify'](_0x20f4fc));_0x3456ca(_0x20f4fc);})[_0xc1cb('0x13')](function(_0x4cf7b7){logger[_0xc1cb('0xf')]('GetCmHopper',_0x4cf7b7[_0xc1cb('0x12')],_0x5ea9ff);_0xa2ce6c(_0x215c3f[_0xc1cb('0xf')](0x1f4,_0x4cf7b7[_0xc1cb('0x12')]));});});});};exports[_0xc1cb('0x4b')]=function(_0x4a5432){var _0x459e4d=this;return new Promise(function(_0x1ae580,_0x296e68){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x4a5432['options'][_0xc1cb('0x1f')][_0xc1cb('0x4c')]},'attributes':['id',_0xc1cb('0x4d')],'order':[['id',_0xc1cb('0x4e')]]})[_0xc1cb('0x1d')](function(_0x114e2b){logger['info']('getContactByPhone',_0x4a5432);logger[_0xc1cb('0xc')](_0xc1cb('0x4f'),_0x4a5432,JSON[_0xc1cb('0xe')](_0x114e2b));_0x1ae580(_0x114e2b);})[_0xc1cb('0x13')](function(_0x3613e3){logger['error']('getContactByPhone',_0x3613e3[_0xc1cb('0x12')],_0x4a5432);_0x296e68(_0x459e4d[_0xc1cb('0xf')](0x1f4,_0x3613e3[_0xc1cb('0x12')]));});});};exports[_0xc1cb('0x50')]=function(_0x23efc9){var _0x4b8f55=this;return new Promise(function(_0x21d5a7,_0x3c2314){return db[_0xc1cb('0x2b')][_0xc1cb('0x2c')](function(_0x3d431c){return db[_0xc1cb('0x21')]['update']({'active':![]},{'where':{},'transaction':_0x3d431c})[_0xc1cb('0x1d')](function(_0x178048){logger[_0xc1cb('0xa')](_0xc1cb('0x50'),_0x23efc9);logger[_0xc1cb('0xc')](_0xc1cb('0x50'),_0x23efc9,JSON[_0xc1cb('0xe')](_0x178048));_0x21d5a7(_0x178048);})['catch'](function(_0xb0b385){logger[_0xc1cb('0xf')]('ResetActiveCalls',_0xb0b385[_0xc1cb('0x12')],_0x23efc9);_0x3c2314(_0x4b8f55['error'](0x1f4,_0xb0b385[_0xc1cb('0x12')]));});});});};exports[_0xc1cb('0x51')]=function(_0x515b39){var _0x4c5be0=this;var _0x3c46b1=_0x515b39[_0xc1cb('0x23')][_0xc1cb('0x1f')][_0xc1cb('0x52')];var _0x2ee969=_0x515b39[_0xc1cb('0x23')][_0xc1cb('0x1f')][_0xc1cb('0x53')];var _0x3b4ce4=_0x515b39['body'][_0xc1cb('0x1f')][_0xc1cb('0x54')];return new Promise(function(_0x578340,_0x10e71f){return db[_0xc1cb('0x21')][_0xc1cb('0x15')]({'where':{'voiceQueueId':{'$in':_0x3c46b1},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0xc1cb('0x41')](_0xc1cb('0x55')+_0x2ee969+_0xc1cb('0x56')),'$gt':db['sequelize']['literal'](_0xc1cb('0x57'))}},'UserId':{'$in':_0x3b4ce4}},'include':[{'model':db[_0xc1cb('0x29')],'as':_0xc1cb('0x2f')},{'model':db[_0xc1cb('0x31')],'as':'Agent','attributes':['id',_0xc1cb('0x33'),_0xc1cb('0x34')]},{'model':db[_0xc1cb('0x58')],'as':'List'}]})['then'](function(_0x57d218){if(_0x57d218[_0xc1cb('0x35')]>0x0){return db[_0xc1cb('0x2b')][_0xc1cb('0x2c')](function(_0x507b6f){return db[_0xc1cb('0x21')]['update']({'recallmeNotifiedDate':db[_0xc1cb('0x2b')][_0xc1cb('0x41')](_0xc1cb('0x57'))},{'where':{'id':{'$in':_['map'](_0x57d218,'id')}},'transaction':_0x507b6f})[_0xc1cb('0x1d')](function(){_0x578340(_0x57d218);})[_0xc1cb('0x13')](function(_0x381046){logger['error'](_0xc1cb('0x51'),_0x381046[_0xc1cb('0x12')],_0x515b39);_0x10e71f(_0x4c5be0[_0xc1cb('0xf')](0x1f4,_0x381046[_0xc1cb('0x12')]));});})[_0xc1cb('0x13')](function(_0x431acc){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x431acc[_0xc1cb('0x12')],_0x515b39);_0x10e71f(_0x4c5be0[_0xc1cb('0xf')](0x1f4,_0x431acc[_0xc1cb('0x12')]));});}else{_0x578340(_0x57d218);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 404e972..eb04629 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 _0xfeb5=['isAuthenticated','index','/describe','describe','/:id','show','/:id/previewrecall','post','/preview','getPreview','/timezone','getTimezone','put','destroy','exports','express','Router','../../components/auth/service','get'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xfeb5,0x13f));var _0x5feb=function(_0x2c4b06,_0x5e8a08){_0x2c4b06=_0x2c4b06-0x0;var _0x3669d5=_0xfeb5[_0x2c4b06];return _0x3669d5;};'use strict';var express=require(_0x5feb('0x0'));var router=express[_0x5feb('0x1')]();var auth=require(_0x5feb('0x2'));var controller=require('./cmHopper.controller');router[_0x5feb('0x3')]('/',auth[_0x5feb('0x4')](),controller[_0x5feb('0x5')]);router[_0x5feb('0x3')](_0x5feb('0x6'),auth[_0x5feb('0x4')](),controller[_0x5feb('0x7')]);router[_0x5feb('0x3')]('/opencontacts',auth[_0x5feb('0x4')](),controller['getOpenContacts']);router[_0x5feb('0x3')]('/timezones',auth['isAuthenticated'](),controller['getTimezones']);router[_0x5feb('0x3')](_0x5feb('0x8'),auth[_0x5feb('0x4')](),controller[_0x5feb('0x9')]);router[_0x5feb('0x3')](_0x5feb('0xa'),auth[_0x5feb('0x4')](),controller['getPreviewRecall']);router[_0x5feb('0xb')]('/',auth[_0x5feb('0x4')](),controller['create']);router[_0x5feb('0xb')](_0x5feb('0xc'),auth['isAuthenticated'](),controller[_0x5feb('0xd')]);router[_0x5feb('0xb')](_0x5feb('0xe'),auth[_0x5feb('0x4')](),controller[_0x5feb('0xf')]);router[_0x5feb('0x10')](_0x5feb('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5feb('0x8'),auth['isAuthenticated'](),controller[_0x5feb('0x11')]);module[_0x5feb('0x12')]=router; \ No newline at end of file +var _0x1371=['post','/preview','getPreview','getTimezone','put','destroy','exports','express','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','/:id/previewrecall'];(function(_0x2ee52f,_0x2032c0){var _0x2f9663=function(_0x4704b5){while(--_0x4704b5){_0x2ee52f['push'](_0x2ee52f['shift']());}};_0x2f9663(++_0x2032c0);}(_0x1371,0x12d));var _0x1137=function(_0x342b8e,_0x57d6dd){_0x342b8e=_0x342b8e-0x0;var _0x49b5ae=_0x1371[_0x342b8e];return _0x49b5ae;};'use strict';var express=require(_0x1137('0x0'));var router=express['Router']();var auth=require(_0x1137('0x1'));var controller=require(_0x1137('0x2'));router[_0x1137('0x3')]('/',auth[_0x1137('0x4')](),controller[_0x1137('0x5')]);router['get'](_0x1137('0x6'),auth['isAuthenticated'](),controller[_0x1137('0x7')]);router[_0x1137('0x3')](_0x1137('0x8'),auth['isAuthenticated'](),controller[_0x1137('0x9')]);router[_0x1137('0x3')](_0x1137('0xa'),auth[_0x1137('0x4')](),controller[_0x1137('0xb')]);router[_0x1137('0x3')](_0x1137('0xc'),auth[_0x1137('0x4')](),controller['show']);router['get'](_0x1137('0xd'),auth[_0x1137('0x4')](),controller['getPreviewRecall']);router[_0x1137('0xe')]('/',auth[_0x1137('0x4')](),controller['create']);router[_0x1137('0xe')](_0x1137('0xf'),auth[_0x1137('0x4')](),controller[_0x1137('0x10')]);router[_0x1137('0xe')]('/timezone',auth[_0x1137('0x4')](),controller[_0x1137('0x11')]);router[_0x1137('0x12')](_0x1137('0xc'),auth[_0x1137('0x4')](),controller['update']);router['delete'](_0x1137('0xc'),auth[_0x1137('0x4')](),controller[_0x1137('0x13')]);module[_0x1137('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index c09fafc..357b221 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x816b=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports','INTEGER'];(function(_0x39221f,_0x8c3fab){var _0x51ec1c=function(_0x532f0c){while(--_0x532f0c){_0x39221f['push'](_0x39221f['shift']());}};_0x51ec1c(++_0x8c3fab);}(_0x816b,0x1e9));var _0xb816=function(_0x473131,_0x41a2c4){_0x473131=_0x473131-0x0;var _0x3eada2=_0x816b[_0x473131];return _0x3eada2;};'use strict';var moment=require('moment');var Sequelize=require(_0xb816('0x0'));module[_0xb816('0x1')]={'CmHopperId':{'type':Sequelize[_0xb816('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xb816('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xb816('0x3')],'defaultValue':moment()[_0xb816('0x4')](_0xb816('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb816('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb816('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xb816('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb816('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb816('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb816('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x71a1=['sequelize','exports','INTEGER','DATE','moment'];(function(_0x44f481,_0x4ed8b3){var _0x5b39b1=function(_0x352926){while(--_0x352926){_0x44f481['push'](_0x44f481['shift']());}};_0x5b39b1(++_0x4ed8b3);}(_0x71a1,0x108));var _0x171a=function(_0x1c1db0,_0x10608b){_0x1c1db0=_0x1c1db0-0x0;var _0x4d5390=_0x71a1[_0x1c1db0];return _0x4d5390;};'use strict';var moment=require(_0x171a('0x0'));var Sequelize=require(_0x171a('0x1'));module[_0x171a('0x2')]={'CmHopperId':{'type':Sequelize[_0x171a('0x3')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x171a('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x171a('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x171a('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x171a('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x171a('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x171a('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x171a('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x171a('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x171a('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 3aba3d4..0720b85 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa24f=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','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','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','CmHopperAdditionalPhones','UserProfileResource','error','name','index','map','CmHopperAdditionalPhone','rawAttributes','type'];(function(_0x326fae,_0x1d8175){var _0x158800=function(_0x50b3c8){while(--_0x50b3c8){_0x326fae['push'](_0x326fae['shift']());}};_0x158800(++_0x1d8175);}(_0xa24f,0x1c2));var _0xfa24=function(_0x506b51,_0x2d2b6d){_0x506b51=_0x506b51-0x0;var _0xca5779=_0xa24f[_0x506b51];return _0xca5779;};'use strict';var emlformat=require(_0xfa24('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfa24('0x1'));var rp=require(_0xfa24('0x2'));var moment=require(_0xfa24('0x3'));var BPromise=require(_0xfa24('0x4'));var Mustache=require(_0xfa24('0x5'));var util=require('util');var path=require(_0xfa24('0x6'));var sox=require(_0xfa24('0x7'));var csv=require(_0xfa24('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa24('0x9'));var _=require(_0xfa24('0xa'));var squel=require(_0xfa24('0xb'));var crypto=require(_0xfa24('0xc'));var jsforce=require(_0xfa24('0xd'));var deskjs=require(_0xfa24('0xe'));var toCsv=require(_0xfa24('0x8'));var querystring=require(_0xfa24('0xf'));var Papa=require(_0xfa24('0x10'));var Redis=require(_0xfa24('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfa24('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa24('0x13'));var logger=require(_0xfa24('0x14'))(_0xfa24('0x15'));var utils=require('../../config/utils');var config=require(_0xfa24('0x16'));var licenseUtil=require(_0xfa24('0x17'));var db=require(_0xfa24('0x18'))['db'];function respondWithStatusCode(_0x50439d,_0xf29620){_0xf29620=_0xf29620||0xcc;return function(_0x536be7){if(_0x536be7){return _0x50439d[_0xfa24('0x19')](_0xf29620);}return _0x50439d['status'](_0xf29620)[_0xfa24('0x1a')]();};}function respondWithResult(_0x494ff1,_0x18c1b9){_0x18c1b9=_0x18c1b9||0xc8;return function(_0x106fa1){if(_0x106fa1){return _0x494ff1[_0xfa24('0x1b')](_0x18c1b9)[_0xfa24('0x1c')](_0x106fa1);}};}function respondWithFilteredResult(_0x2709e4,_0x6cbcd9){return function(_0x5715f8){if(_0x5715f8){var _0x5be169=typeof _0x6cbcd9['offset']===_0xfa24('0x1d')&&typeof _0x6cbcd9[_0xfa24('0x1e')]==='undefined';var _0x37e826=_0x5715f8[_0xfa24('0x1f')];var _0x463eb4=_0x5be169?0x0:_0x6cbcd9['offset'];var _0x19f0ce=_0x5be169?_0x5715f8[_0xfa24('0x1f')]:_0x6cbcd9[_0xfa24('0x20')]+_0x6cbcd9['limit'];var _0x1a8bbe;if(_0x19f0ce>=_0x37e826){_0x19f0ce=_0x37e826;_0x1a8bbe=0xc8;}else{_0x1a8bbe=0xce;}_0x2709e4[_0xfa24('0x1b')](_0x1a8bbe);return _0x2709e4[_0xfa24('0x21')](_0xfa24('0x22'),_0x463eb4+'-'+_0x19f0ce+'/'+_0x37e826)['json'](_0x5715f8);}return null;};}function patchUpdates(_0x3ab1bc){return function(_0x4cd3e8){try{jsonpatch[_0xfa24('0x23')](_0x4cd3e8,_0x3ab1bc,!![]);}catch(_0x869808){return BPromise[_0xfa24('0x24')](_0x869808);}return _0x4cd3e8['save']();};}function saveUpdates(_0x5a05ed,_0xfa5e27){return function(_0x54d705){if(_0x54d705){return _0x54d705['update'](_0x5a05ed)[_0xfa24('0x25')](function(_0x5c7b37){return _0x5c7b37;});}return null;};}function removeEntity(_0x2173fb,_0x5ade5b){return function(_0x30e225){if(_0x30e225){return _0x30e225[_0xfa24('0x26')]()[_0xfa24('0x25')](function(){var _0x3e45b4=_0x30e225['get']({'plain':!![]});var _0x37d0e5=_0xfa24('0x27');return db[_0xfa24('0x28')]['destroy']({'where':{'type':_0x37d0e5,'resourceId':_0x3e45b4['id']}})[_0xfa24('0x25')](function(){return _0x30e225;});})['then'](function(){_0x2173fb[_0xfa24('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ba496,_0x53c69f){return function(_0x46b19d){if(!_0x46b19d){_0x1ba496[_0xfa24('0x19')](0x194);}return _0x46b19d;};}function handleError(_0x1a1b29,_0x21c3e8){_0x21c3e8=_0x21c3e8||0x1f4;return function(_0x355561){logger[_0xfa24('0x29')](_0x355561['stack']);if(_0x355561[_0xfa24('0x2a')]){delete _0x355561[_0xfa24('0x2a')];}_0x1a1b29[_0xfa24('0x1b')](_0x21c3e8)['send'](_0x355561);};}exports[_0xfa24('0x2b')]=function(_0x150dad,_0x4b1f8b){var _0x30fc5f={},_0x29dbdf={},_0x2b6e3e={'count':0x0,'rows':[]};var _0x436c01=_[_0xfa24('0x2c')](db[_0xfa24('0x2d')][_0xfa24('0x2e')],function(_0x2ed632){return{'name':_0x2ed632['fieldName'],'type':_0x2ed632[_0xfa24('0x2f')][_0xfa24('0x30')]};});_0x29dbdf[_0xfa24('0x31')]=_[_0xfa24('0x2c')](_0x436c01,_0xfa24('0x2a'));_0x29dbdf[_0xfa24('0x32')]=_[_0xfa24('0x33')](_0x150dad[_0xfa24('0x32')]);_0x29dbdf[_0xfa24('0x34')]=_[_0xfa24('0x35')](_0x29dbdf[_0xfa24('0x31')],_0x29dbdf[_0xfa24('0x32')]);_0x30fc5f[_0xfa24('0x36')]=_['intersection'](_0x29dbdf['model'],qs[_0xfa24('0x37')](_0x150dad[_0xfa24('0x32')][_0xfa24('0x37')]));_0x30fc5f[_0xfa24('0x36')]=_0x30fc5f[_0xfa24('0x36')][_0xfa24('0x38')]?_0x30fc5f[_0xfa24('0x36')]:_0x29dbdf[_0xfa24('0x31')];if(!_0x150dad[_0xfa24('0x32')][_0xfa24('0x39')](_0xfa24('0x3a'))){_0x30fc5f['limit']=qs[_0xfa24('0x1e')](_0x150dad['query'][_0xfa24('0x1e')]);_0x30fc5f[_0xfa24('0x20')]=qs[_0xfa24('0x20')](_0x150dad['query']['offset']);}_0x30fc5f[_0xfa24('0x3b')]=qs['sort'](_0x150dad[_0xfa24('0x32')][_0xfa24('0x3c')]);_0x30fc5f[_0xfa24('0x3d')]=qs[_0xfa24('0x34')](_[_0xfa24('0x3e')](_0x150dad[_0xfa24('0x32')],_0x29dbdf[_0xfa24('0x34')]),_0x436c01);if(_0x150dad[_0xfa24('0x32')]['filter']){_0x30fc5f[_0xfa24('0x3d')]=_[_0xfa24('0x3f')](_0x30fc5f[_0xfa24('0x3d')],{'$or':_[_0xfa24('0x2c')](_0x436c01,function(_0x5ee077){if(_0x5ee077[_0xfa24('0x2f')]!=='VIRTUAL'){var _0x5089bf={};_0x5089bf[_0x5ee077['name']]={'$like':'%'+_0x150dad[_0xfa24('0x32')]['filter']+'%'};return _0x5089bf;}})});}_0x30fc5f=_[_0xfa24('0x3f')]({},_0x30fc5f,_0x150dad[_0xfa24('0x40')]);var _0x21c090={'where':_0x30fc5f['where']};return db[_0xfa24('0x2d')][_0xfa24('0x1f')](_0x21c090)[_0xfa24('0x25')](function(_0x3c3155){_0x2b6e3e[_0xfa24('0x1f')]=_0x3c3155;if(_0x150dad[_0xfa24('0x32')][_0xfa24('0x41')]){_0x30fc5f[_0xfa24('0x42')]=[{'all':!![]}];}return db[_0xfa24('0x2d')][_0xfa24('0x43')](_0x30fc5f);})[_0xfa24('0x25')](function(_0x234ceb){_0x2b6e3e[_0xfa24('0x44')]=_0x234ceb;return _0x2b6e3e;})[_0xfa24('0x25')](respondWithFilteredResult(_0x4b1f8b,_0x30fc5f))['catch'](handleError(_0x4b1f8b,null));};exports[_0xfa24('0x45')]=function(_0x2d55bb,_0x4817f1){var _0x427cd3={'raw':!![],'where':{'id':_0x2d55bb[_0xfa24('0x46')]['id']}},_0x36912d={};_0x36912d[_0xfa24('0x31')]=_[_0xfa24('0x33')](db[_0xfa24('0x2d')][_0xfa24('0x2e')]);_0x36912d[_0xfa24('0x32')]=_[_0xfa24('0x33')](_0x2d55bb[_0xfa24('0x32')]);_0x36912d[_0xfa24('0x34')]=_['intersection'](_0x36912d['model'],_0x36912d[_0xfa24('0x32')]);_0x427cd3[_0xfa24('0x36')]=_['intersection'](_0x36912d[_0xfa24('0x31')],qs[_0xfa24('0x37')](_0x2d55bb[_0xfa24('0x32')][_0xfa24('0x37')]));_0x427cd3[_0xfa24('0x36')]=_0x427cd3[_0xfa24('0x36')]['length']?_0x427cd3[_0xfa24('0x36')]:_0x36912d[_0xfa24('0x31')];if(_0x2d55bb[_0xfa24('0x32')]['includeAll']){_0x427cd3['include']=[{'all':!![]}];}_0x427cd3=_[_0xfa24('0x3f')]({},_0x427cd3,_0x2d55bb[_0xfa24('0x40')]);return db[_0xfa24('0x2d')][_0xfa24('0x47')](_0x427cd3)[_0xfa24('0x25')](handleEntityNotFound(_0x4817f1,null))[_0xfa24('0x25')](respondWithResult(_0x4817f1,null))['catch'](handleError(_0x4817f1,null));};exports[_0xfa24('0x48')]=function(_0x59b07f,_0x294ddc){return db[_0xfa24('0x2d')][_0xfa24('0x48')](_0x59b07f[_0xfa24('0x49')],{})['then'](function(_0x15f77c){var _0x1c359e=_0x59b07f[_0xfa24('0x4a')][_0xfa24('0x4b')]({'plain':!![]});if(!_0x1c359e)throw new Error(_0xfa24('0x4c'));if(_0x1c359e[_0xfa24('0x4d')]==='user'){var _0x26047d=_0x15f77c['get']({'plain':!![]});var _0x47b986=_0xfa24('0x27');return db[_0xfa24('0x4e')][_0xfa24('0x47')]({'where':{'name':_0x47b986,'userProfileId':_0x1c359e[_0xfa24('0x4f')]},'raw':!![]})['then'](function(_0x411be4){if(_0x411be4&&_0x411be4[_0xfa24('0x50')]===0x0){return db[_0xfa24('0x28')][_0xfa24('0x48')]({'name':_0x26047d[_0xfa24('0x2a')],'resourceId':_0x26047d['id'],'type':_0x411be4[_0xfa24('0x2a')],'sectionId':_0x411be4['id']},{})['then'](function(){return _0x15f77c;});}else{return _0x15f77c;}})['catch'](function(_0x5dcbc8){logger[_0xfa24('0x29')](_0xfa24('0x51'),_0x5dcbc8);throw _0x5dcbc8;});}return _0x15f77c;})[_0xfa24('0x25')](respondWithResult(_0x294ddc,0xc9))[_0xfa24('0x52')](handleError(_0x294ddc,null));};exports['update']=function(_0x13d488,_0x5beac8){if(_0x13d488[_0xfa24('0x49')]['id']){delete _0x13d488[_0xfa24('0x49')]['id'];}return db[_0xfa24('0x2d')][_0xfa24('0x47')]({'where':{'id':_0x13d488['params']['id']}})[_0xfa24('0x25')](handleEntityNotFound(_0x5beac8,null))[_0xfa24('0x25')](saveUpdates(_0x13d488['body'],null))[_0xfa24('0x25')](respondWithResult(_0x5beac8,null))['catch'](handleError(_0x5beac8,null));};exports[_0xfa24('0x26')]=function(_0x5be03c,_0x6f9f2f){return db['CmHopperAdditionalPhone'][_0xfa24('0x47')]({'where':{'id':_0x5be03c[_0xfa24('0x46')]['id']}})[_0xfa24('0x25')](handleEntityNotFound(_0x6f9f2f,null))[_0xfa24('0x25')](removeEntity(_0x6f9f2f,null))[_0xfa24('0x52')](handleError(_0x6f9f2f,null));}; \ No newline at end of file +var _0xf703=['to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','undefined','limit','count','offset','set','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xf703,0x123));var _0x3f70=function(_0x3a7fa8,_0x22a524){_0x3a7fa8=_0x3a7fa8-0x0;var _0x235b57=_0xf703[_0x3a7fa8];return _0x235b57;};'use strict';var emlformat=require(_0x3f70('0x0'));var rimraf=require(_0x3f70('0x1'));var zipdir=require(_0x3f70('0x2'));var jsonpatch=require(_0x3f70('0x3'));var rp=require('request-promise');var moment=require(_0x3f70('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3f70('0x5'));var util=require(_0x3f70('0x6'));var path=require(_0x3f70('0x7'));var sox=require(_0x3f70('0x8'));var csv=require(_0x3f70('0x9'));var ejs=require(_0x3f70('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f70('0xb'));var squel=require('squel');var crypto=require(_0x3f70('0xc'));var jsforce=require(_0x3f70('0xd'));var deskjs=require(_0x3f70('0xe'));var toCsv=require(_0x3f70('0x9'));var querystring=require(_0x3f70('0xf'));var Papa=require('papaparse');var Redis=require(_0x3f70('0x10'));var authService=require(_0x3f70('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3f70('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f70('0x13'))(_0x3f70('0x14'));var utils=require(_0x3f70('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3f70('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18cbd9,_0x209683){_0x209683=_0x209683||0xcc;return function(_0x49c56a){if(_0x49c56a){return _0x18cbd9['sendStatus'](_0x209683);}return _0x18cbd9[_0x3f70('0x17')](_0x209683)[_0x3f70('0x18')]();};}function respondWithResult(_0x234443,_0x24ef73){_0x24ef73=_0x24ef73||0xc8;return function(_0x460858){if(_0x460858){return _0x234443[_0x3f70('0x17')](_0x24ef73)[_0x3f70('0x19')](_0x460858);}};}function respondWithFilteredResult(_0x4e80b0,_0x10712e){return function(_0x3d383d){if(_0x3d383d){var _0x5021de=typeof _0x10712e['offset']===_0x3f70('0x1a')&&typeof _0x10712e[_0x3f70('0x1b')]===_0x3f70('0x1a');var _0x3cb37d=_0x3d383d[_0x3f70('0x1c')];var _0x3ca8d1=_0x5021de?0x0:_0x10712e[_0x3f70('0x1d')];var _0x2de5d7=_0x5021de?_0x3d383d[_0x3f70('0x1c')]:_0x10712e[_0x3f70('0x1d')]+_0x10712e[_0x3f70('0x1b')];var _0x381059;if(_0x2de5d7>=_0x3cb37d){_0x2de5d7=_0x3cb37d;_0x381059=0xc8;}else{_0x381059=0xce;}_0x4e80b0['status'](_0x381059);return _0x4e80b0[_0x3f70('0x1e')]('Content-Range',_0x3ca8d1+'-'+_0x2de5d7+'/'+_0x3cb37d)[_0x3f70('0x19')](_0x3d383d);}return null;};}function patchUpdates(_0x24fa7c){return function(_0x3e09ae){try{jsonpatch['apply'](_0x3e09ae,_0x24fa7c,!![]);}catch(_0x1a47d5){return BPromise['reject'](_0x1a47d5);}return _0x3e09ae[_0x3f70('0x1f')]();};}function saveUpdates(_0x36d23a,_0x595ad5){return function(_0x575bf1){if(_0x575bf1){return _0x575bf1[_0x3f70('0x20')](_0x36d23a)[_0x3f70('0x21')](function(_0x1aae89){return _0x1aae89;});}return null;};}function removeEntity(_0x32224d,_0x44123f){return function(_0x557aa0){if(_0x557aa0){return _0x557aa0[_0x3f70('0x22')]()[_0x3f70('0x21')](function(){var _0x535102=_0x557aa0[_0x3f70('0x23')]({'plain':!![]});var _0x2dd777=_0x3f70('0x24');return db[_0x3f70('0x25')][_0x3f70('0x22')]({'where':{'type':_0x2dd777,'resourceId':_0x535102['id']}})[_0x3f70('0x21')](function(){return _0x557aa0;});})[_0x3f70('0x21')](function(){_0x32224d[_0x3f70('0x17')](0xcc)[_0x3f70('0x18')]();});}};}function handleEntityNotFound(_0x4da0e2,_0x1005c9){return function(_0x258242){if(!_0x258242){_0x4da0e2['sendStatus'](0x194);}return _0x258242;};}function handleError(_0x34f030,_0x5c155d){_0x5c155d=_0x5c155d||0x1f4;return function(_0x5b2beb){logger['error'](_0x5b2beb['stack']);if(_0x5b2beb['name']){delete _0x5b2beb[_0x3f70('0x26')];}_0x34f030[_0x3f70('0x17')](_0x5c155d)[_0x3f70('0x27')](_0x5b2beb);};}exports[_0x3f70('0x28')]=function(_0x406123,_0xf681a8){var _0x4c71f6={},_0x311b08={},_0x1ae048={'count':0x0,'rows':[]};var _0x2cb8bc=_[_0x3f70('0x29')](db[_0x3f70('0x2a')][_0x3f70('0x2b')],function(_0x1df787){return{'name':_0x1df787['fieldName'],'type':_0x1df787[_0x3f70('0x2c')][_0x3f70('0x2d')]};});_0x311b08[_0x3f70('0x2e')]=_['map'](_0x2cb8bc,'name');_0x311b08[_0x3f70('0x2f')]=_[_0x3f70('0x30')](_0x406123[_0x3f70('0x2f')]);_0x311b08['filters']=_[_0x3f70('0x31')](_0x311b08[_0x3f70('0x2e')],_0x311b08[_0x3f70('0x2f')]);_0x4c71f6[_0x3f70('0x32')]=_['intersection'](_0x311b08[_0x3f70('0x2e')],qs['fields'](_0x406123[_0x3f70('0x2f')][_0x3f70('0x33')]));_0x4c71f6[_0x3f70('0x32')]=_0x4c71f6[_0x3f70('0x32')]['length']?_0x4c71f6[_0x3f70('0x32')]:_0x311b08[_0x3f70('0x2e')];if(!_0x406123[_0x3f70('0x2f')][_0x3f70('0x34')](_0x3f70('0x35'))){_0x4c71f6[_0x3f70('0x1b')]=qs[_0x3f70('0x1b')](_0x406123[_0x3f70('0x2f')]['limit']);_0x4c71f6[_0x3f70('0x1d')]=qs[_0x3f70('0x1d')](_0x406123[_0x3f70('0x2f')]['offset']);}_0x4c71f6[_0x3f70('0x36')]=qs[_0x3f70('0x37')](_0x406123[_0x3f70('0x2f')][_0x3f70('0x37')]);_0x4c71f6[_0x3f70('0x38')]=qs[_0x3f70('0x39')](_['pick'](_0x406123['query'],_0x311b08['filters']),_0x2cb8bc);if(_0x406123[_0x3f70('0x2f')][_0x3f70('0x3a')]){_0x4c71f6[_0x3f70('0x38')]=_[_0x3f70('0x3b')](_0x4c71f6['where'],{'$or':_[_0x3f70('0x29')](_0x2cb8bc,function(_0xe6c36){if(_0xe6c36['type']!==_0x3f70('0x3c')){var _0x2f5c01={};_0x2f5c01[_0xe6c36[_0x3f70('0x26')]]={'$like':'%'+_0x406123[_0x3f70('0x2f')][_0x3f70('0x3a')]+'%'};return _0x2f5c01;}})});}_0x4c71f6=_['merge']({},_0x4c71f6,_0x406123[_0x3f70('0x3d')]);var _0x37eae0={'where':_0x4c71f6[_0x3f70('0x38')]};return db[_0x3f70('0x2a')][_0x3f70('0x1c')](_0x37eae0)[_0x3f70('0x21')](function(_0x23ceef){_0x1ae048[_0x3f70('0x1c')]=_0x23ceef;if(_0x406123['query'][_0x3f70('0x3e')]){_0x4c71f6[_0x3f70('0x3f')]=[{'all':!![]}];}return db[_0x3f70('0x2a')][_0x3f70('0x40')](_0x4c71f6);})['then'](function(_0x221d4f){_0x1ae048[_0x3f70('0x41')]=_0x221d4f;return _0x1ae048;})[_0x3f70('0x21')](respondWithFilteredResult(_0xf681a8,_0x4c71f6))['catch'](handleError(_0xf681a8,null));};exports['show']=function(_0x28d01f,_0x23f9d0){var _0x1688e3={'raw':!![],'where':{'id':_0x28d01f[_0x3f70('0x42')]['id']}},_0x14ad60={};_0x14ad60['model']=_[_0x3f70('0x30')](db[_0x3f70('0x2a')]['rawAttributes']);_0x14ad60[_0x3f70('0x2f')]=_[_0x3f70('0x30')](_0x28d01f['query']);_0x14ad60['filters']=_['intersection'](_0x14ad60[_0x3f70('0x2e')],_0x14ad60[_0x3f70('0x2f')]);_0x1688e3[_0x3f70('0x32')]=_[_0x3f70('0x31')](_0x14ad60['model'],qs[_0x3f70('0x33')](_0x28d01f[_0x3f70('0x2f')][_0x3f70('0x33')]));_0x1688e3[_0x3f70('0x32')]=_0x1688e3[_0x3f70('0x32')]['length']?_0x1688e3[_0x3f70('0x32')]:_0x14ad60[_0x3f70('0x2e')];if(_0x28d01f[_0x3f70('0x2f')][_0x3f70('0x3e')]){_0x1688e3[_0x3f70('0x3f')]=[{'all':!![]}];}_0x1688e3=_[_0x3f70('0x3b')]({},_0x1688e3,_0x28d01f[_0x3f70('0x3d')]);return db[_0x3f70('0x2a')][_0x3f70('0x43')](_0x1688e3)[_0x3f70('0x21')](handleEntityNotFound(_0x23f9d0,null))[_0x3f70('0x21')](respondWithResult(_0x23f9d0,null))['catch'](handleError(_0x23f9d0,null));};exports[_0x3f70('0x44')]=function(_0x4a7138,_0x568a3e){return db['CmHopperAdditionalPhone'][_0x3f70('0x44')](_0x4a7138[_0x3f70('0x45')],{})['then'](function(_0x85c1b2){var _0x3b7155=_0x4a7138[_0x3f70('0x46')]['get']({'plain':!![]});if(!_0x3b7155)throw new Error(_0x3f70('0x47'));if(_0x3b7155[_0x3f70('0x48')]===_0x3f70('0x46')){var _0x309ffd=_0x85c1b2[_0x3f70('0x23')]({'plain':!![]});var _0x3e6f38='CmHopperAdditionalPhones';return db[_0x3f70('0x49')][_0x3f70('0x43')]({'where':{'name':_0x3e6f38,'userProfileId':_0x3b7155['userProfileId']},'raw':!![]})['then'](function(_0x32a5b7){if(_0x32a5b7&&_0x32a5b7['autoAssociation']===0x0){return db['UserProfileResource'][_0x3f70('0x44')]({'name':_0x309ffd[_0x3f70('0x26')],'resourceId':_0x309ffd['id'],'type':_0x32a5b7[_0x3f70('0x26')],'sectionId':_0x32a5b7['id']},{})[_0x3f70('0x21')](function(){return _0x85c1b2;});}else{return _0x85c1b2;}})[_0x3f70('0x4a')](function(_0x39a866){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39a866);throw _0x39a866;});}return _0x85c1b2;})[_0x3f70('0x21')](respondWithResult(_0x568a3e,0xc9))[_0x3f70('0x4a')](handleError(_0x568a3e,null));};exports['update']=function(_0xa7f5cc,_0x378849){if(_0xa7f5cc[_0x3f70('0x45')]['id']){delete _0xa7f5cc['body']['id'];}return db[_0x3f70('0x2a')][_0x3f70('0x43')]({'where':{'id':_0xa7f5cc[_0x3f70('0x42')]['id']}})[_0x3f70('0x21')](handleEntityNotFound(_0x378849,null))[_0x3f70('0x21')](saveUpdates(_0xa7f5cc[_0x3f70('0x45')],null))[_0x3f70('0x21')](respondWithResult(_0x378849,null))['catch'](handleError(_0x378849,null));};exports['destroy']=function(_0x4e0b3a,_0x26eb2f){return db[_0x3f70('0x2a')][_0x3f70('0x43')]({'where':{'id':_0x4e0b3a[_0x3f70('0x42')]['id']}})[_0x3f70('0x21')](handleEntityNotFound(_0x26eb2f,null))[_0x3f70('0x21')](removeEntity(_0x26eb2f,null))['catch'](handleError(_0x26eb2f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index da9d921..9ae3ccb 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5160=['../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x6aa4c,_0x478fdc){var _0x1024df=function(_0x32e6c2){while(--_0x32e6c2){_0x6aa4c['push'](_0x6aa4c['shift']());}};_0x1024df(++_0x478fdc);}(_0x5160,0x1cc));var _0x0516=function(_0x355fc5,_0x32031a){_0x355fc5=_0x355fc5-0x0;var _0x564b76=_0x5160[_0x355fc5];return _0x564b76;};'use strict';var _=require(_0x0516('0x0'));var util=require(_0x0516('0x1'));var logger=require(_0x0516('0x2'))('api');var moment=require(_0x0516('0x3'));var BPromise=require(_0x0516('0x4'));var rp=require(_0x0516('0x5'));var fs=require('fs');var path=require(_0x0516('0x6'));var rimraf=require(_0x0516('0x7'));var config=require(_0x0516('0x8'));var attributes=require(_0x0516('0x9'));module['exports']=function(_0x10a70e,_0x81a539){return _0x10a70e[_0x0516('0xa')](_0x0516('0xb'),attributes,{'tableName':_0x0516('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe349=['util','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash'];(function(_0x1d1d97,_0xe779d0){var _0x3130fc=function(_0x1cb13d){while(--_0x1cb13d){_0x1d1d97['push'](_0x1d1d97['shift']());}};_0x3130fc(++_0xe779d0);}(_0xe349,0x107));var _0x9e34=function(_0x4d35f3,_0x19ba66){_0x4d35f3=_0x4d35f3-0x0;var _0x382fea=_0xe349[_0x4d35f3];return _0x382fea;};'use strict';var _=require(_0x9e34('0x0'));var util=require(_0x9e34('0x1'));var logger=require('../../config/logger')(_0x9e34('0x2'));var moment=require(_0x9e34('0x3'));var BPromise=require(_0x9e34('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e34('0x5'));var rimraf=require(_0x9e34('0x6'));var config=require(_0x9e34('0x7'));var attributes=require(_0x9e34('0x8'));module['exports']=function(_0x3211de,_0x27293c){return _0x3211de['define'](_0x9e34('0x9'),attributes,{'tableName':_0x9e34('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 6a6eb95..7cbcffe 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1567=['ContactId','ListId','VoiceQueueId','CampaignId','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','ASC','countdropretry','SwapAdditionalPhones','waitTime','duration','isNil','scheduledat','add','minutes','phone','updatedAt','createdAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body'];(function(_0x2f23f7,_0x4f4877){var _0x244344=function(_0x4d7aaa){while(--_0x4d7aaa){_0x2f23f7['push'](_0x2f23f7['shift']());}};_0x244344(++_0x4f4877);}(_0x1567,0x119));var _0x7156=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x1567[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x7156('0x0'));var util=require(_0x7156('0x1'));var moment=require('moment');var BPromise=require(_0x7156('0x2'));var rs=require(_0x7156('0x3'));var fs=require('fs');var Redis=require(_0x7156('0x4'));var db=require(_0x7156('0x5'))['db'];var utils=require(_0x7156('0x6'));var logger=require(_0x7156('0x7'))(_0x7156('0x8'));var config=require(_0x7156('0x9'));var jayson=require(_0x7156('0xa'));var client=jayson[_0x7156('0xb')][_0x7156('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x276651,_0xb57099,_0x43d3d7){return new BPromise(function(_0x4bb054,_0x29e411){return client[_0x7156('0xd')](_0x276651,_0x43d3d7)[_0x7156('0xe')](function(_0x2511ec){logger['info'](_0x7156('0xf'),_0xb57099,_0x7156('0x10'));logger[_0x7156('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0xb57099,_0x7156('0x10'),JSON[_0x7156('0x12')](_0x2511ec));if(_0x2511ec[_0x7156('0x13')]){if(_0x2511ec[_0x7156('0x13')][_0x7156('0x14')]===0x1f4){logger[_0x7156('0x13')](_0x7156('0xf'),_0xb57099,_0x2511ec['error'][_0x7156('0x15')]);return _0x29e411(_0x2511ec[_0x7156('0x13')][_0x7156('0x15')]);}logger[_0x7156('0x13')](_0x7156('0xf'),_0xb57099,_0x2511ec[_0x7156('0x13')][_0x7156('0x15')]);return _0x4bb054(_0x2511ec[_0x7156('0x13')][_0x7156('0x15')]);}else{logger[_0x7156('0x16')](_0x7156('0xf'),_0xb57099,'request\x20sent');_0x4bb054(_0x2511ec[_0x7156('0x17')]['message']);}})[_0x7156('0x18')](function(_0x425185){logger[_0x7156('0x13')](_0x7156('0xf'),_0xb57099,_0x425185);_0x29e411(_0x425185);});});}exports[_0x7156('0x19')]=function(_0x5c7980){var _0x320713=this;return new Promise(function(_0x58e6e5,_0x5009d5){return db[_0x7156('0x1a')][_0x7156('0x1b')]({'raw':!![],'where':{'ContactId':_0x5c7980[_0x7156('0x1c')][_0x7156('0x1d')],'ListId':_0x5c7980[_0x7156('0x1c')][_0x7156('0x1e')],'VoiceQueueId':_0x5c7980[_0x7156('0x1c')][_0x7156('0x1f')]===undefined?null:_0x5c7980['body'][_0x7156('0x1f')],'CampaignId':_0x5c7980['body'][_0x7156('0x20')]===undefined?null:_0x5c7980[_0x7156('0x1c')][_0x7156('0x20')]}})['then'](function(_0x1b6d28){if(_0x1b6d28!=null){return db['CmHopperAdditionalPhone'][_0x7156('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x1b6d28['id'],'OrderBy':{'$gt':_0x1b6d28[_0x7156('0x21')]}},'order':[[_0x7156('0x21'),'ASC']]})[_0x7156('0xe')](function(_0x15ac51){var _0x590726=0x0;if(_0x15ac51){if(_0x15ac51[_0x7156('0x22')]+_0x15ac51[_0x7156('0x23')]+_0x15ac51[_0x7156('0x24')]+_0x15ac51[_0x7156('0x25')]+_0x15ac51['countdropretry']+_0x15ac51[_0x7156('0x26')]+_0x15ac51[_0x7156('0x27')]+_0x15ac51[_0x7156('0x28')]<_0x5c7980[_0x7156('0x29')][_0x7156('0x2a')])_0x590726=0x1;_0x58e6e5({'additional':_0x590726});}else{return db[_0x7156('0x2b')][_0x7156('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x1b6d28['id']},'order':[['OrderBy',_0x7156('0x2c')]]})[_0x7156('0xe')](function(_0x50f057){var _0x198cfc=0x0;if(_0x50f057){if(_0x50f057[_0x7156('0x22')]+_0x50f057[_0x7156('0x23')]+_0x50f057[_0x7156('0x24')]+_0x50f057[_0x7156('0x25')]+_0x50f057[_0x7156('0x2d')]+_0x50f057['countabandonedretry']+_0x50f057['countmachineretry']+_0x50f057[_0x7156('0x28')]<_0x5c7980[_0x7156('0x29')]['dialGlobalMaxRetry'])_0x198cfc=0x1;_0x58e6e5({'additional':_0x198cfc});}else{_0x58e6e5({'additional':0x0});}})[_0x7156('0x18')](function(_0x117a6a){logger[_0x7156('0x13')]('VerifyAdditionalPhones',_0x117a6a[_0x7156('0x15')]);_0x5009d5(_0x320713[_0x7156('0x13')](0x1f4,_0x117a6a[_0x7156('0x15')]));});}})['catch'](function(_0xa413f4){logger[_0x7156('0x13')]('VerifyAdditionalPhones',_0xa413f4[_0x7156('0x15')]);_0x5009d5(_0x320713[_0x7156('0x13')](0x1f4,_0xa413f4['message']));});}else _0x58e6e5({'additional':0x0});});});};exports[_0x7156('0x2e')]=function(_0x115b72){var _0x3c4793=this;return new Promise(function(_0x28057c,_0x5eb864){return db[_0x7156('0x1a')][_0x7156('0x1b')]({'raw':!![],'where':{'ContactId':_0x115b72[_0x7156('0x1c')][_0x7156('0x1d')],'ListId':_0x115b72['body'][_0x7156('0x1e')],'VoiceQueueId':_0x115b72[_0x7156('0x1c')][_0x7156('0x1f')]===undefined?null:_0x115b72[_0x7156('0x1c')][_0x7156('0x1f')],'CampaignId':_0x115b72[_0x7156('0x1c')][_0x7156('0x20')]===undefined?null:_0x115b72[_0x7156('0x1c')][_0x7156('0x20')]}})[_0x7156('0xe')](function(_0x3b29e1){if(_0x3b29e1!=null){return db[_0x7156('0x2b')][_0x7156('0x1b')]({'raw':!![],'where':{'CmHopperId':_0x3b29e1['id'],'OrderBy':{'$gte':_0x3b29e1[_0x7156('0x21')]}},'order':[[_0x7156('0x21'),_0x7156('0x2c')]]})[_0x7156('0xe')](function(_0x23a1d5){if(_0x23a1d5)return activateAdditionalPhone(_0x3b29e1,_0x115b72[_0x7156('0x1c')],_0x23a1d5,_0x115b72['duration'],_0x115b72[_0x7156('0x2f')])[_0x7156('0xe')](function(_0x80377a){_0x28057c(_0x80377a);});else{return db[_0x7156('0x2b')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x3b29e1['id']},'order':[[_0x7156('0x21'),_0x7156('0x2c')]]})['then'](function(_0x4844c3){if(_0x4844c3)return activateAdditionalPhone(_0x3b29e1,_0x115b72['body'],_0x4844c3,_0x115b72[_0x7156('0x30')],_0x115b72[_0x7156('0x2f')])['then'](function(_0x300e2e){_0x28057c(_0x300e2e);});else{_0x28057c({'id':_0x3b29e1['id'],'phone':''});}})['catch'](function(_0x503506){logger['error'](_0x7156('0x19'),_0x503506[_0x7156('0x15')]);_0x5eb864(_0x3c4793[_0x7156('0x13')](0x1f4,_0x503506['message']));});}})[_0x7156('0x18')](function(_0x19e892){logger['error']('VerifyAdditionalPhones',_0x19e892[_0x7156('0x15')]);_0x5eb864(_0x3c4793['error'](0x1f4,_0x19e892[_0x7156('0x15')]));});}else _0x28057c(0x1);});});};function activateAdditionalPhone(_0x11a84e,_0x2389ca,_0x2ce24f,_0x362ef4,_0xdc717){return new Promise(function(_0x2a5898,_0x475378){var _0x4b893f;if(_[_0x7156('0x31')](_0x2ce24f[_0x7156('0x32')])){_0x2ce24f[_0x7156('0x32')]=moment();}if(moment()>moment(_0x2ce24f[_0x7156('0x32')])){_0x4b893f=moment()[_0x7156('0x33')](_0xdc717||0x3,'minutes');}else{if(_0x2ce24f[_0x7156('0x21')]==0x0){_0x4b893f=moment(_0x2ce24f['scheduledat']);}else{_0x4b893f=moment()[_0x7156('0x33')](_0xdc717||0x3,_0x7156('0x34'));}}if(_[_0x7156('0x31')](_0x4b893f)){_0x4b893f=moment()[_0x7156('0x33')](_0xdc717||0x3,_0x7156('0x34'));}var _0x1b696c={'phone':_0x11a84e[_0x7156('0x35')],'active':0x0,'OrderBy':_[_0x7156('0x31')](_0x11a84e['OrderBy'])?0x0:_0x11a84e[_0x7156('0x21')],'scheduledat':moment()[_0x7156('0x33')](_0x362ef4||0x1,_0x7156('0x34')),'countbusyretry':_0x2389ca[_0x7156('0x22')],'countcongestionretry':_0x2389ca[_0x7156('0x23')],'countnoanswerretry':_0x2389ca[_0x7156('0x24')],'countnosuchnumberretry':_0x2389ca['countnosuchnumberretry'],'countdropretry':_0x2389ca[_0x7156('0x2d')],'countabandonedretry':_0x2389ca[_0x7156('0x26')],'countmachineretry':_0x2389ca[_0x7156('0x27')],'countagentrejectretry':_0x2389ca[_0x7156('0x28')],'createdAt':_0x2389ca['createdAt'],'updatedAt':_0x2389ca[_0x7156('0x36')]};var _0x85b1f4={'CmHopperId':_0x11a84e['id'],'phone':_0x2ce24f['phone'],'active':0x0,'OrderBy':_['isNil'](_0x2ce24f[_0x7156('0x21')])?0x0:_0x2ce24f['OrderBy'],'scheduledat':_0x4b893f,'countbusyretry':_0x2ce24f[_0x7156('0x22')],'countcongestionretry':_0x2ce24f['countcongestionretry'],'countnoanswerretry':_0x2ce24f['countnoanswerretry'],'countnosuchnumberretry':_0x2ce24f['countnosuchnumberretry'],'countdropretry':_0x2ce24f['countdropretry'],'countabandonedretry':_0x2ce24f[_0x7156('0x26')],'countmachineretry':_0x2ce24f[_0x7156('0x27')],'countagentrejectretry':_0x2ce24f[_0x7156('0x28')],'createdAt':_0x2ce24f[_0x7156('0x37')],'updatedAt':_0x2ce24f[_0x7156('0x36')]};return db[_0x7156('0x38')][_0x7156('0x39')](function(_0x466a22){return db[_0x7156('0x2b')][_0x7156('0x3a')](_0x1b696c,{'where':{'id':_0x2ce24f['id']}},{'transaction':_0x466a22})['then'](function(){return db['CmHopper']['update'](_0x85b1f4,{'where':{'id':_0x11a84e['id']}},{'transaction':_0x466a22});});})['then'](function(_0x59150b){_0x2a5898({'id':_0x11a84e['id'],'phone':_0x2ce24f['phone']});})[_0x7156('0x18')](function(_0x50a613){logger[_0x7156('0x13')](_0x7156('0x3b'),_0x50a613['message']);_0x475378({'error':_0x50a613[_0x7156('0x15')]});});});}exports[_0x7156('0x3c')]=function(_0x4c9eaf){var _0x2a9b52=this;return new Promise(function(_0x18d70a,_0x3dda24){return db[_0x7156('0x1a')]['update'](_0x4c9eaf[_0x7156('0x1c')][_0x7156('0x3d')],{'where':{'id':_0x4c9eaf[_0x7156('0x1c')]['id']}})['then'](function(_0x4d1781){_0x18d70a(_0x4d1781);})[_0x7156('0x18')](function(_0x15e25f){logger['error'](_0x7156('0x3c'),_0x15e25f[_0x7156('0x15')]);_0x3dda24(_0x2a9b52[_0x7156('0x13')](0x1f4,_0x15e25f[_0x7156('0x15')]));});});}; \ No newline at end of file +var _0x5967=['code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','info','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countnosuchnumberretry','countabandonedretry','entity','dialGlobalMaxRetry','countcongestionretry','countnoanswerretry','countmachineretry','countagentrejectretry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','countbusyretry','createdAt','updatedAt','countdropretry','sequelize','transaction','update','activateAdditionalPhone','field','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','request\x20sent','debug','stringify','error'];(function(_0x396485,_0x1a98ff){var _0x49c78f=function(_0x2e91b4){while(--_0x2e91b4){_0x396485['push'](_0x396485['shift']());}};_0x49c78f(++_0x1a98ff);}(_0x5967,0x148));var _0x7596=function(_0x4be130,_0x3a69a2){_0x4be130=_0x4be130-0x0;var _0x4ba1b8=_0x5967[_0x4be130];return _0x4ba1b8;};'use strict';var _=require('lodash');var util=require(_0x7596('0x0'));var moment=require(_0x7596('0x1'));var BPromise=require('bluebird');var rs=require(_0x7596('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7596('0x3'))['db'];var utils=require(_0x7596('0x4'));var logger=require('../../config/logger')(_0x7596('0x5'));var config=require(_0x7596('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7596('0x7')][_0x7596('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d7b70,_0x16ba05,_0xe6ce7c){return new BPromise(function(_0x52438f,_0x9398b0){return client[_0x7596('0x9')](_0x1d7b70,_0xe6ce7c)['then'](function(_0x15f7f5){logger['info']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x16ba05,_0x7596('0xa'));logger[_0x7596('0xb')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x16ba05,_0x7596('0xa'),JSON[_0x7596('0xc')](_0x15f7f5));if(_0x15f7f5[_0x7596('0xd')]){if(_0x15f7f5[_0x7596('0xd')][_0x7596('0xe')]===0x1f4){logger[_0x7596('0xd')](_0x7596('0xf'),_0x16ba05,_0x15f7f5[_0x7596('0xd')][_0x7596('0x10')]);return _0x9398b0(_0x15f7f5[_0x7596('0xd')][_0x7596('0x10')]);}logger[_0x7596('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x16ba05,_0x15f7f5['error']['message']);return _0x52438f(_0x15f7f5[_0x7596('0xd')][_0x7596('0x10')]);}else{logger[_0x7596('0x11')](_0x7596('0xf'),_0x16ba05,_0x7596('0xa'));_0x52438f(_0x15f7f5[_0x7596('0x12')][_0x7596('0x10')]);}})[_0x7596('0x13')](function(_0x482efa){logger[_0x7596('0xd')](_0x7596('0xf'),_0x16ba05,_0x482efa);_0x9398b0(_0x482efa);});});}exports[_0x7596('0x14')]=function(_0x4f0ef2){var _0x1a2826=this;return new Promise(function(_0x1b9433,_0x2ce38c){return db[_0x7596('0x15')][_0x7596('0x16')]({'raw':!![],'where':{'ContactId':_0x4f0ef2[_0x7596('0x17')][_0x7596('0x18')],'ListId':_0x4f0ef2[_0x7596('0x17')][_0x7596('0x19')],'VoiceQueueId':_0x4f0ef2['body'][_0x7596('0x1a')]===undefined?null:_0x4f0ef2[_0x7596('0x17')][_0x7596('0x1a')],'CampaignId':_0x4f0ef2[_0x7596('0x17')][_0x7596('0x1b')]===undefined?null:_0x4f0ef2[_0x7596('0x17')][_0x7596('0x1b')]}})[_0x7596('0x1c')](function(_0x28f013){if(_0x28f013!=null){return db[_0x7596('0x1d')][_0x7596('0x16')]({'raw':!![],'where':{'CmHopperId':_0x28f013['id'],'OrderBy':{'$gt':_0x28f013[_0x7596('0x1e')]}},'order':[[_0x7596('0x1e'),_0x7596('0x1f')]]})[_0x7596('0x1c')](function(_0xfc9512){var _0x351f50=0x0;if(_0xfc9512){if(_0xfc9512['countbusyretry']+_0xfc9512['countcongestionretry']+_0xfc9512['countnoanswerretry']+_0xfc9512[_0x7596('0x20')]+_0xfc9512['countdropretry']+_0xfc9512[_0x7596('0x21')]+_0xfc9512['countmachineretry']+_0xfc9512['countagentrejectretry']<_0x4f0ef2[_0x7596('0x22')][_0x7596('0x23')])_0x351f50=0x1;_0x1b9433({'additional':_0x351f50});}else{return db[_0x7596('0x1d')][_0x7596('0x16')]({'raw':!![],'where':{'CmHopperId':_0x28f013['id']},'order':[[_0x7596('0x1e'),_0x7596('0x1f')]]})[_0x7596('0x1c')](function(_0x2dc579){var _0x41b339=0x0;if(_0x2dc579){if(_0x2dc579['countbusyretry']+_0x2dc579[_0x7596('0x24')]+_0x2dc579[_0x7596('0x25')]+_0x2dc579['countnosuchnumberretry']+_0x2dc579['countdropretry']+_0x2dc579[_0x7596('0x21')]+_0x2dc579[_0x7596('0x26')]+_0x2dc579[_0x7596('0x27')]<_0x4f0ef2[_0x7596('0x22')][_0x7596('0x23')])_0x41b339=0x1;_0x1b9433({'additional':_0x41b339});}else{_0x1b9433({'additional':0x0});}})[_0x7596('0x13')](function(_0x134802){logger['error'](_0x7596('0x14'),_0x134802[_0x7596('0x10')]);_0x2ce38c(_0x1a2826['error'](0x1f4,_0x134802[_0x7596('0x10')]));});}})[_0x7596('0x13')](function(_0x2b89a5){logger[_0x7596('0xd')](_0x7596('0x14'),_0x2b89a5[_0x7596('0x10')]);_0x2ce38c(_0x1a2826[_0x7596('0xd')](0x1f4,_0x2b89a5[_0x7596('0x10')]));});}else _0x1b9433({'additional':0x0});});});};exports[_0x7596('0x28')]=function(_0x45f87a){var _0x4af70a=this;return new Promise(function(_0x3d0b39,_0x1a20bf){return db[_0x7596('0x15')]['findOne']({'raw':!![],'where':{'ContactId':_0x45f87a[_0x7596('0x17')][_0x7596('0x18')],'ListId':_0x45f87a[_0x7596('0x17')][_0x7596('0x19')],'VoiceQueueId':_0x45f87a['body'][_0x7596('0x1a')]===undefined?null:_0x45f87a[_0x7596('0x17')][_0x7596('0x1a')],'CampaignId':_0x45f87a[_0x7596('0x17')][_0x7596('0x1b')]===undefined?null:_0x45f87a[_0x7596('0x17')][_0x7596('0x1b')]}})[_0x7596('0x1c')](function(_0xe3d3b6){if(_0xe3d3b6!=null){return db[_0x7596('0x1d')][_0x7596('0x16')]({'raw':!![],'where':{'CmHopperId':_0xe3d3b6['id'],'OrderBy':{'$gte':_0xe3d3b6[_0x7596('0x1e')]}},'order':[[_0x7596('0x1e'),_0x7596('0x1f')]]})[_0x7596('0x1c')](function(_0x99e68d){if(_0x99e68d)return activateAdditionalPhone(_0xe3d3b6,_0x45f87a['body'],_0x99e68d,_0x45f87a[_0x7596('0x29')],_0x45f87a[_0x7596('0x2a')])[_0x7596('0x1c')](function(_0x7f02d7){_0x3d0b39(_0x7f02d7);});else{return db[_0x7596('0x1d')][_0x7596('0x16')]({'raw':!![],'where':{'CmHopperId':_0xe3d3b6['id']},'order':[['OrderBy',_0x7596('0x1f')]]})[_0x7596('0x1c')](function(_0x2a1b07){if(_0x2a1b07)return activateAdditionalPhone(_0xe3d3b6,_0x45f87a['body'],_0x2a1b07,_0x45f87a[_0x7596('0x29')],_0x45f87a[_0x7596('0x2a')])[_0x7596('0x1c')](function(_0x2d2f1e){_0x3d0b39(_0x2d2f1e);});else{_0x3d0b39({'id':_0xe3d3b6['id'],'phone':''});}})[_0x7596('0x13')](function(_0x5bde81){logger[_0x7596('0xd')](_0x7596('0x14'),_0x5bde81[_0x7596('0x10')]);_0x1a20bf(_0x4af70a[_0x7596('0xd')](0x1f4,_0x5bde81[_0x7596('0x10')]));});}})['catch'](function(_0x241ea0){logger['error']('VerifyAdditionalPhones',_0x241ea0[_0x7596('0x10')]);_0x1a20bf(_0x4af70a[_0x7596('0xd')](0x1f4,_0x241ea0[_0x7596('0x10')]));});}else _0x3d0b39(0x1);});});};function activateAdditionalPhone(_0x140183,_0x570286,_0x4e7aea,_0x47b55f,_0x4b0a30){return new Promise(function(_0x114f13,_0x80344a){var _0x10488a;if(_[_0x7596('0x2b')](_0x4e7aea[_0x7596('0x2c')])){_0x4e7aea[_0x7596('0x2c')]=moment();}if(moment()>moment(_0x4e7aea[_0x7596('0x2c')])){_0x10488a=moment()[_0x7596('0x2d')](_0x4b0a30||0x3,_0x7596('0x2e'));}else{if(_0x4e7aea['OrderBy']==0x0){_0x10488a=moment(_0x4e7aea[_0x7596('0x2c')]);}else{_0x10488a=moment()[_0x7596('0x2d')](_0x4b0a30||0x3,_0x7596('0x2e'));}}if(_[_0x7596('0x2b')](_0x10488a)){_0x10488a=moment()['add'](_0x4b0a30||0x3,_0x7596('0x2e'));}var _0x395e34={'phone':_0x140183[_0x7596('0x2f')],'active':0x0,'OrderBy':_[_0x7596('0x2b')](_0x140183[_0x7596('0x1e')])?0x0:_0x140183[_0x7596('0x1e')],'scheduledat':moment()[_0x7596('0x2d')](_0x47b55f||0x1,_0x7596('0x2e')),'countbusyretry':_0x570286[_0x7596('0x30')],'countcongestionretry':_0x570286['countcongestionretry'],'countnoanswerretry':_0x570286['countnoanswerretry'],'countnosuchnumberretry':_0x570286[_0x7596('0x20')],'countdropretry':_0x570286['countdropretry'],'countabandonedretry':_0x570286[_0x7596('0x21')],'countmachineretry':_0x570286[_0x7596('0x26')],'countagentrejectretry':_0x570286[_0x7596('0x27')],'createdAt':_0x570286[_0x7596('0x31')],'updatedAt':_0x570286[_0x7596('0x32')]};var _0x5e2485={'CmHopperId':_0x140183['id'],'phone':_0x4e7aea[_0x7596('0x2f')],'active':0x0,'OrderBy':_[_0x7596('0x2b')](_0x4e7aea[_0x7596('0x1e')])?0x0:_0x4e7aea[_0x7596('0x1e')],'scheduledat':_0x10488a,'countbusyretry':_0x4e7aea[_0x7596('0x30')],'countcongestionretry':_0x4e7aea['countcongestionretry'],'countnoanswerretry':_0x4e7aea[_0x7596('0x25')],'countnosuchnumberretry':_0x4e7aea[_0x7596('0x20')],'countdropretry':_0x4e7aea[_0x7596('0x33')],'countabandonedretry':_0x4e7aea[_0x7596('0x21')],'countmachineretry':_0x4e7aea[_0x7596('0x26')],'countagentrejectretry':_0x4e7aea[_0x7596('0x27')],'createdAt':_0x4e7aea[_0x7596('0x31')],'updatedAt':_0x4e7aea[_0x7596('0x32')]};return db[_0x7596('0x34')][_0x7596('0x35')](function(_0x3d7179){return db[_0x7596('0x1d')][_0x7596('0x36')](_0x395e34,{'where':{'id':_0x4e7aea['id']}},{'transaction':_0x3d7179})['then'](function(){return db[_0x7596('0x15')][_0x7596('0x36')](_0x5e2485,{'where':{'id':_0x140183['id']}},{'transaction':_0x3d7179});});})[_0x7596('0x1c')](function(_0x4fc4cf){_0x114f13({'id':_0x140183['id'],'phone':_0x4e7aea[_0x7596('0x2f')]});})[_0x7596('0x13')](function(_0x431a3e){logger[_0x7596('0xd')](_0x7596('0x37'),_0x431a3e['message']);_0x80344a({'error':_0x431a3e['message']});});});}exports['IncrementPreviewCounters']=function(_0x201c53){var _0x5a3fff=this;return new Promise(function(_0x3caa14,_0x38e6f3){return db['CmHopper'][_0x7596('0x36')](_0x201c53[_0x7596('0x17')][_0x7596('0x38')],{'where':{'id':_0x201c53[_0x7596('0x17')]['id']}})['then'](function(_0x389337){_0x3caa14(_0x389337);})['catch'](function(_0x4caf83){logger['error']('IncrementPreviewCounters',_0x4caf83[_0x7596('0x10')]);_0x38e6f3(_0x5a3fff[_0x7596('0xd')](0x1f4,_0x4caf83[_0x7596('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index f8ff6fe..4b60950 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3fe7=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./cmHopperAdditionalPhone.controller','get','index','isAuthenticated','show','create','put'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0x3fe7,0x125));var _0x73fe=function(_0x1663ae,_0x10484a){_0x1663ae=_0x1663ae-0x0;var _0x30ffb8=_0x3fe7[_0x1663ae];return _0x30ffb8;};'use strict';var multer=require(_0x73fe('0x0'));var util=require(_0x73fe('0x1'));var path=require(_0x73fe('0x2'));var timeout=require(_0x73fe('0x3'));var express=require('express');var router=express[_0x73fe('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x73fe('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x73fe('0x6'));router[_0x73fe('0x7')]('/',auth['isAuthenticated'](),controller[_0x73fe('0x8')]);router[_0x73fe('0x7')]('/:id',auth[_0x73fe('0x9')](),controller[_0x73fe('0xa')]);router['post']('/',auth[_0x73fe('0x9')](),controller[_0x73fe('0xb')]);router[_0x73fe('0xc')](_0x73fe('0xd'),auth[_0x73fe('0x9')](),controller[_0x73fe('0xe')]);router[_0x73fe('0xf')](_0x73fe('0xd'),auth['isAuthenticated'](),controller[_0x73fe('0x10')]);module[_0x73fe('0x11')]=router; \ No newline at end of file +var _0xf408=['./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1cbe57,_0x309402){var _0x41d825=function(_0x2c7db3){while(--_0x2c7db3){_0x1cbe57['push'](_0x1cbe57['shift']());}};_0x41d825(++_0x309402);}(_0xf408,0x199));var _0x8f40=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0xf408[_0x1e4150];return _0x1ce3ee;};'use strict';var multer=require(_0x8f40('0x0'));var util=require(_0x8f40('0x1'));var path=require(_0x8f40('0x2'));var timeout=require('connect-timeout');var express=require(_0x8f40('0x3'));var router=express[_0x8f40('0x4')]();var fs_extra=require(_0x8f40('0x5'));var auth=require(_0x8f40('0x6'));var interaction=require(_0x8f40('0x7'));var config=require(_0x8f40('0x8'));var controller=require(_0x8f40('0x9'));router[_0x8f40('0xa')]('/',auth[_0x8f40('0xb')](),controller[_0x8f40('0xc')]);router[_0x8f40('0xa')](_0x8f40('0xd'),auth[_0x8f40('0xb')](),controller[_0x8f40('0xe')]);router[_0x8f40('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8f40('0x10')]('/:id',auth[_0x8f40('0xb')](),controller[_0x8f40('0x11')]);router['delete'](_0x8f40('0xd'),auth[_0x8f40('0xb')](),controller[_0x8f40('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 08769ad..783f8bb 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 _0x4745=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0xaaa7cf,_0x45f830){var _0x2be410=function(_0x20f915){while(--_0x20f915){_0xaaa7cf['push'](_0xaaa7cf['shift']());}};_0x2be410(++_0x45f830);}(_0x4745,0x1e7));var _0x5474=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4745[_0x4cf98e];return _0x1623ac;};'use strict';var moment=require(_0x5474('0x0'));var Sequelize=require(_0x5474('0x1'));module[_0x5474('0x2')]={'phone':{'type':Sequelize[_0x5474('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x5474('0x4')],'unique':_0x5474('0x5')},'ListId':{'type':Sequelize[_0x5474('0x4')],'unique':_0x5474('0x5')},'VoiceQueueId':{'type':Sequelize[_0x5474('0x4')],'unique':_0x5474('0x5')}}; \ No newline at end of file +var _0x1c23=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x4d1192,_0x222a8b){var _0x4d4920=function(_0x224ab3){while(--_0x224ab3){_0x4d1192['push'](_0x4d1192['shift']());}};_0x4d4920(++_0x222a8b);}(_0x1c23,0x1d5));var _0x31c2=function(_0x7f7b22,_0x13f6ad){_0x7f7b22=_0x7f7b22-0x0;var _0x3f5ab2=_0x1c23[_0x7f7b22];return _0x3f5ab2;};'use strict';var moment=require(_0x31c2('0x0'));var Sequelize=require(_0x31c2('0x1'));module[_0x31c2('0x2')]={'phone':{'type':Sequelize[_0x31c2('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x31c2('0x4')],'unique':_0x31c2('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x31c2('0x5')},'VoiceQueueId':{'type':Sequelize[_0x31c2('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index daf5eae..59b0071 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 _0x81df=['pick','filters','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','destroy','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','end','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where'];(function(_0x414bec,_0x304768){var _0xa58d4d=function(_0x8d7adf){while(--_0x8d7adf){_0x414bec['push'](_0x414bec['shift']());}};_0xa58d4d(++_0x304768);}(_0x81df,0xf9));var _0xf81d=function(_0x3cd63e,_0x1a48a9){_0x3cd63e=_0x3cd63e-0x0;var _0x5dc1ef=_0x81df[_0x3cd63e];return _0x5dc1ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf81d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf81d('0x1'));var rp=require('request-promise');var moment=require(_0xf81d('0x2'));var BPromise=require(_0xf81d('0x3'));var Mustache=require(_0xf81d('0x4'));var util=require(_0xf81d('0x5'));var path=require(_0xf81d('0x6'));var sox=require(_0xf81d('0x7'));var csv=require(_0xf81d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf81d('0x9'));var squel=require('squel');var crypto=require(_0xf81d('0xa'));var jsforce=require(_0xf81d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf81d('0x8'));var querystring=require(_0xf81d('0xc'));var Papa=require(_0xf81d('0xd'));var Redis=require(_0xf81d('0xe'));var authService=require(_0xf81d('0xf'));var qs=require(_0xf81d('0x10'));var as=require(_0xf81d('0x11'));var hardwareService=require(_0xf81d('0x12'));var logger=require(_0xf81d('0x13'))(_0xf81d('0x14'));var utils=require(_0xf81d('0x15'));var config=require(_0xf81d('0x16'));var licenseUtil=require(_0xf81d('0x17'));var db=require(_0xf81d('0x18'))['db'];function respondWithStatusCode(_0x454100,_0x4650d9){_0x4650d9=_0x4650d9||0xcc;return function(_0x326c01){if(_0x326c01){return _0x454100[_0xf81d('0x19')](_0x4650d9);}return _0x454100[_0xf81d('0x1a')](_0x4650d9)['end']();};}function respondWithResult(_0x6c2317,_0x3cfdc9){_0x3cfdc9=_0x3cfdc9||0xc8;return function(_0x36c0a0){if(_0x36c0a0){return _0x6c2317['status'](_0x3cfdc9)[_0xf81d('0x1b')](_0x36c0a0);}};}function respondWithFilteredResult(_0x1b7429,_0x4bc4d9){return function(_0x2e2747){if(_0x2e2747){var _0x3454ac=typeof _0x4bc4d9[_0xf81d('0x1c')]===_0xf81d('0x1d')&&typeof _0x4bc4d9[_0xf81d('0x1e')]===_0xf81d('0x1d');var _0x1229b9=_0x2e2747[_0xf81d('0x1f')];var _0x293de8=_0x3454ac?0x0:_0x4bc4d9[_0xf81d('0x1c')];var _0x23d092=_0x3454ac?_0x2e2747[_0xf81d('0x1f')]:_0x4bc4d9[_0xf81d('0x1c')]+_0x4bc4d9[_0xf81d('0x1e')];var _0x5985ee;if(_0x23d092>=_0x1229b9){_0x23d092=_0x1229b9;_0x5985ee=0xc8;}else{_0x5985ee=0xce;}_0x1b7429['status'](_0x5985ee);return _0x1b7429[_0xf81d('0x20')](_0xf81d('0x21'),_0x293de8+'-'+_0x23d092+'/'+_0x1229b9)[_0xf81d('0x1b')](_0x2e2747);}return null;};}function patchUpdates(_0x265079){return function(_0x1c1ca6){try{jsonpatch[_0xf81d('0x22')](_0x1c1ca6,_0x265079,!![]);}catch(_0x42e7d3){return BPromise['reject'](_0x42e7d3);}return _0x1c1ca6[_0xf81d('0x23')]();};}function saveUpdates(_0x29c49a,_0x18e3bc){return function(_0x423c57){if(_0x423c57){return _0x423c57['update'](_0x29c49a)[_0xf81d('0x24')](function(_0x416552){return _0x416552;});}return null;};}function removeEntity(_0x2b42fb,_0x27f81d){return function(_0x57c884){if(_0x57c884){return _0x57c884['destroy']()[_0xf81d('0x24')](function(){_0x2b42fb[_0xf81d('0x1a')](0xcc)[_0xf81d('0x25')]();});}};}function handleEntityNotFound(_0x3a9d5b,_0x224cea){return function(_0x407cb0){if(!_0x407cb0){_0x3a9d5b['sendStatus'](0x194);}return _0x407cb0;};}function handleError(_0x2b0f3e,_0xe8086f){_0xe8086f=_0xe8086f||0x1f4;return function(_0x270c5c){logger[_0xf81d('0x26')](_0x270c5c[_0xf81d('0x27')]);if(_0x270c5c[_0xf81d('0x28')]){delete _0x270c5c[_0xf81d('0x28')];}_0x2b0f3e[_0xf81d('0x1a')](_0xe8086f)[_0xf81d('0x29')](_0x270c5c);};}exports[_0xf81d('0x2a')]=function(_0xad0b67,_0x17f9f9){var _0x23fb05={},_0x249135={},_0x5300b2={'count':0x0,'rows':[]};var _0x526bfd=_[_0xf81d('0x2b')](db[_0xf81d('0x2c')][_0xf81d('0x2d')],function(_0x5c2416){return{'name':_0x5c2416[_0xf81d('0x2e')],'type':_0x5c2416['type'][_0xf81d('0x2f')]};});_0x249135[_0xf81d('0x30')]=_[_0xf81d('0x2b')](_0x526bfd,_0xf81d('0x28'));_0x249135[_0xf81d('0x31')]=_[_0xf81d('0x32')](_0xad0b67[_0xf81d('0x31')]);_0x249135['filters']=_['intersection'](_0x249135[_0xf81d('0x30')],_0x249135[_0xf81d('0x31')]);_0x23fb05['attributes']=_[_0xf81d('0x33')](_0x249135[_0xf81d('0x30')],qs[_0xf81d('0x34')](_0xad0b67[_0xf81d('0x31')]['fields']));_0x23fb05[_0xf81d('0x35')]=_0x23fb05[_0xf81d('0x35')][_0xf81d('0x36')]?_0x23fb05['attributes']:_0x249135[_0xf81d('0x30')];if(!_0xad0b67[_0xf81d('0x31')][_0xf81d('0x37')](_0xf81d('0x38'))){_0x23fb05[_0xf81d('0x1e')]=qs['limit'](_0xad0b67[_0xf81d('0x31')]['limit']);_0x23fb05[_0xf81d('0x1c')]=qs[_0xf81d('0x1c')](_0xad0b67[_0xf81d('0x31')][_0xf81d('0x1c')]);}_0x23fb05['order']=qs[_0xf81d('0x39')](_0xad0b67[_0xf81d('0x31')][_0xf81d('0x39')]);_0x23fb05[_0xf81d('0x3a')]=qs['filters'](_[_0xf81d('0x3b')](_0xad0b67[_0xf81d('0x31')],_0x249135[_0xf81d('0x3c')]),_0x526bfd);if(_0xad0b67[_0xf81d('0x31')]['filter']){_0x23fb05['where']=_[_0xf81d('0x3d')](_0x23fb05[_0xf81d('0x3a')],{'$or':_['map'](_0x526bfd,function(_0x3e339b){if(_0x3e339b[_0xf81d('0x3e')]!=='VIRTUAL'){var _0xa2c697={};_0xa2c697[_0x3e339b[_0xf81d('0x28')]]={'$like':'%'+_0xad0b67[_0xf81d('0x31')][_0xf81d('0x3f')]+'%'};return _0xa2c697;}})});}_0x23fb05=_[_0xf81d('0x3d')]({},_0x23fb05,_0xad0b67[_0xf81d('0x40')]);var _0x545d46={'where':_0x23fb05[_0xf81d('0x3a')]};return db[_0xf81d('0x2c')][_0xf81d('0x1f')](_0x545d46)[_0xf81d('0x24')](function(_0x26d9fd){_0x5300b2[_0xf81d('0x1f')]=_0x26d9fd;if(_0xad0b67[_0xf81d('0x31')][_0xf81d('0x41')]){_0x23fb05[_0xf81d('0x42')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xf81d('0x43')](_0x23fb05);})[_0xf81d('0x24')](function(_0x4c0f6f){_0x5300b2[_0xf81d('0x44')]=_0x4c0f6f;return _0x5300b2;})['then'](respondWithFilteredResult(_0x17f9f9,_0x23fb05))[_0xf81d('0x45')](handleError(_0x17f9f9,null));};exports[_0xf81d('0x46')]=function(_0x4ba154,_0x387a7b){var _0x117a23={'raw':!![],'where':{'id':_0x4ba154[_0xf81d('0x47')]['id']}},_0x4b676e={};_0x4b676e[_0xf81d('0x30')]=_[_0xf81d('0x32')](db[_0xf81d('0x2c')][_0xf81d('0x2d')]);_0x4b676e['query']=_[_0xf81d('0x32')](_0x4ba154[_0xf81d('0x31')]);_0x4b676e[_0xf81d('0x3c')]=_[_0xf81d('0x33')](_0x4b676e[_0xf81d('0x30')],_0x4b676e['query']);_0x117a23[_0xf81d('0x35')]=_[_0xf81d('0x33')](_0x4b676e[_0xf81d('0x30')],qs[_0xf81d('0x34')](_0x4ba154[_0xf81d('0x31')][_0xf81d('0x34')]));_0x117a23[_0xf81d('0x35')]=_0x117a23[_0xf81d('0x35')]['length']?_0x117a23[_0xf81d('0x35')]:_0x4b676e['model'];if(_0x4ba154[_0xf81d('0x31')][_0xf81d('0x41')]){_0x117a23[_0xf81d('0x42')]=[{'all':!![]}];}_0x117a23=_['merge']({},_0x117a23,_0x4ba154[_0xf81d('0x40')]);return db['CmHopperBlack'][_0xf81d('0x48')](_0x117a23)['then'](handleEntityNotFound(_0x387a7b,null))['then'](respondWithResult(_0x387a7b,null))[_0xf81d('0x45')](handleError(_0x387a7b,null));};exports[_0xf81d('0x49')]=function(_0x5d6312,_0x34e303){if(_0x5d6312['body']['id']){delete _0x5d6312['body']['id'];}return db[_0xf81d('0x2c')]['find']({'where':{'id':_0x5d6312['params']['id']}})['then'](handleEntityNotFound(_0x34e303,null))['then'](saveUpdates(_0x5d6312[_0xf81d('0x4a')],null))[_0xf81d('0x24')](respondWithResult(_0x34e303,null))[_0xf81d('0x45')](handleError(_0x34e303,null));};exports[_0xf81d('0x4b')]=function(_0x2c0762,_0x176f99){return db[_0xf81d('0x2c')][_0xf81d('0x48')]({'where':{'id':_0x2c0762[_0xf81d('0x47')]['id']}})[_0xf81d('0x24')](handleEntityNotFound(_0x176f99,null))[_0xf81d('0x24')](removeEntity(_0x176f99,null))['catch'](handleError(_0x176f99,null));};exports[_0xf81d('0x4c')]=function(_0x56970b,_0x13c25b){return db[_0xf81d('0x2c')][_0xf81d('0x4c')]()[_0xf81d('0x24')](respondWithResult(_0x13c25b,null))['catch'](handleError(_0x13c25b,null));}; \ No newline at end of file +var _0xdca4=['length','nolimit','order','sort','pick','where','type','VIRTUAL','merge','options','include','findAll','rows','show','params','includeAll','find','catch','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','reject','update','then','destroy','stack','name','index','map','CmHopperBlack','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields'];(function(_0x167295,_0x555a81){var _0x400be6=function(_0x1edcba){while(--_0x1edcba){_0x167295['push'](_0x167295['shift']());}};_0x400be6(++_0x555a81);}(_0xdca4,0x138));var _0x4dca=function(_0x37465a,_0x52723c){_0x37465a=_0x37465a-0x0;var _0x52691d=_0xdca4[_0x37465a];return _0x52691d;};'use strict';var emlformat=require(_0x4dca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4dca('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4dca('0x2'));var moment=require(_0x4dca('0x3'));var BPromise=require(_0x4dca('0x4'));var Mustache=require(_0x4dca('0x5'));var util=require(_0x4dca('0x6'));var path=require(_0x4dca('0x7'));var sox=require(_0x4dca('0x8'));var csv=require('to-csv');var ejs=require(_0x4dca('0x9'));var fs=require('fs');var fs_extra=require(_0x4dca('0xa'));var _=require(_0x4dca('0xb'));var squel=require(_0x4dca('0xc'));var crypto=require('crypto');var jsforce=require(_0x4dca('0xd'));var deskjs=require(_0x4dca('0xe'));var toCsv=require(_0x4dca('0xf'));var querystring=require(_0x4dca('0x10'));var Papa=require(_0x4dca('0x11'));var Redis=require(_0x4dca('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4dca('0x13'));var as=require(_0x4dca('0x14'));var hardwareService=require(_0x4dca('0x15'));var logger=require('../../config/logger')(_0x4dca('0x16'));var utils=require(_0x4dca('0x17'));var config=require(_0x4dca('0x18'));var licenseUtil=require(_0x4dca('0x19'));var db=require(_0x4dca('0x1a'))['db'];function respondWithStatusCode(_0x343bde,_0x4466bc){_0x4466bc=_0x4466bc||0xcc;return function(_0x15b27f){if(_0x15b27f){return _0x343bde[_0x4dca('0x1b')](_0x4466bc);}return _0x343bde[_0x4dca('0x1c')](_0x4466bc)[_0x4dca('0x1d')]();};}function respondWithResult(_0x553154,_0x33633f){_0x33633f=_0x33633f||0xc8;return function(_0x263c44){if(_0x263c44){return _0x553154[_0x4dca('0x1c')](_0x33633f)['json'](_0x263c44);}};}function respondWithFilteredResult(_0x2b2784,_0x27c08c){return function(_0x4da393){if(_0x4da393){var _0x3216e9=typeof _0x27c08c[_0x4dca('0x1e')]==='undefined'&&typeof _0x27c08c[_0x4dca('0x1f')]===_0x4dca('0x20');var _0x2fea94=_0x4da393[_0x4dca('0x21')];var _0x41e56f=_0x3216e9?0x0:_0x27c08c[_0x4dca('0x1e')];var _0x536606=_0x3216e9?_0x4da393[_0x4dca('0x21')]:_0x27c08c[_0x4dca('0x1e')]+_0x27c08c[_0x4dca('0x1f')];var _0x2a0136;if(_0x536606>=_0x2fea94){_0x536606=_0x2fea94;_0x2a0136=0xc8;}else{_0x2a0136=0xce;}_0x2b2784['status'](_0x2a0136);return _0x2b2784[_0x4dca('0x22')]('Content-Range',_0x41e56f+'-'+_0x536606+'/'+_0x2fea94)['json'](_0x4da393);}return null;};}function patchUpdates(_0x3c02c9){return function(_0x3d956e){try{jsonpatch['apply'](_0x3d956e,_0x3c02c9,!![]);}catch(_0x1ecc1a){return BPromise[_0x4dca('0x23')](_0x1ecc1a);}return _0x3d956e['save']();};}function saveUpdates(_0x3051f6,_0x12203e){return function(_0x404788){if(_0x404788){return _0x404788[_0x4dca('0x24')](_0x3051f6)[_0x4dca('0x25')](function(_0x446bf3){return _0x446bf3;});}return null;};}function removeEntity(_0x5dcf31,_0x4ec5c6){return function(_0x4eb255){if(_0x4eb255){return _0x4eb255[_0x4dca('0x26')]()[_0x4dca('0x25')](function(){_0x5dcf31[_0x4dca('0x1c')](0xcc)[_0x4dca('0x1d')]();});}};}function handleEntityNotFound(_0x5e651b,_0x141227){return function(_0x5d0ceb){if(!_0x5d0ceb){_0x5e651b[_0x4dca('0x1b')](0x194);}return _0x5d0ceb;};}function handleError(_0x374043,_0x3c9013){_0x3c9013=_0x3c9013||0x1f4;return function(_0x4bec3c){logger['error'](_0x4bec3c[_0x4dca('0x27')]);if(_0x4bec3c[_0x4dca('0x28')]){delete _0x4bec3c[_0x4dca('0x28')];}_0x374043[_0x4dca('0x1c')](_0x3c9013)['send'](_0x4bec3c);};}exports[_0x4dca('0x29')]=function(_0x5c02aa,_0x35be18){var _0x28f1e1={},_0x60caa1={},_0x3aebb3={'count':0x0,'rows':[]};var _0x33dc2a=_[_0x4dca('0x2a')](db[_0x4dca('0x2b')][_0x4dca('0x2c')],function(_0xad04c){return{'name':_0xad04c[_0x4dca('0x2d')],'type':_0xad04c['type']['key']};});_0x60caa1['model']=_[_0x4dca('0x2a')](_0x33dc2a,_0x4dca('0x28'));_0x60caa1[_0x4dca('0x2e')]=_[_0x4dca('0x2f')](_0x5c02aa['query']);_0x60caa1[_0x4dca('0x30')]=_[_0x4dca('0x31')](_0x60caa1[_0x4dca('0x32')],_0x60caa1['query']);_0x28f1e1[_0x4dca('0x33')]=_['intersection'](_0x60caa1[_0x4dca('0x32')],qs[_0x4dca('0x34')](_0x5c02aa['query'][_0x4dca('0x34')]));_0x28f1e1[_0x4dca('0x33')]=_0x28f1e1[_0x4dca('0x33')][_0x4dca('0x35')]?_0x28f1e1['attributes']:_0x60caa1[_0x4dca('0x32')];if(!_0x5c02aa[_0x4dca('0x2e')]['hasOwnProperty'](_0x4dca('0x36'))){_0x28f1e1[_0x4dca('0x1f')]=qs[_0x4dca('0x1f')](_0x5c02aa[_0x4dca('0x2e')][_0x4dca('0x1f')]);_0x28f1e1[_0x4dca('0x1e')]=qs[_0x4dca('0x1e')](_0x5c02aa[_0x4dca('0x2e')]['offset']);}_0x28f1e1[_0x4dca('0x37')]=qs[_0x4dca('0x38')](_0x5c02aa['query']['sort']);_0x28f1e1['where']=qs[_0x4dca('0x30')](_[_0x4dca('0x39')](_0x5c02aa[_0x4dca('0x2e')],_0x60caa1[_0x4dca('0x30')]),_0x33dc2a);if(_0x5c02aa['query']['filter']){_0x28f1e1[_0x4dca('0x3a')]=_['merge'](_0x28f1e1[_0x4dca('0x3a')],{'$or':_[_0x4dca('0x2a')](_0x33dc2a,function(_0x4e3b4a){if(_0x4e3b4a[_0x4dca('0x3b')]!==_0x4dca('0x3c')){var _0x44f700={};_0x44f700[_0x4e3b4a[_0x4dca('0x28')]]={'$like':'%'+_0x5c02aa[_0x4dca('0x2e')]['filter']+'%'};return _0x44f700;}})});}_0x28f1e1=_[_0x4dca('0x3d')]({},_0x28f1e1,_0x5c02aa[_0x4dca('0x3e')]);var _0x4f4939={'where':_0x28f1e1[_0x4dca('0x3a')]};return db[_0x4dca('0x2b')]['count'](_0x4f4939)[_0x4dca('0x25')](function(_0x582f0e){_0x3aebb3[_0x4dca('0x21')]=_0x582f0e;if(_0x5c02aa[_0x4dca('0x2e')]['includeAll']){_0x28f1e1[_0x4dca('0x3f')]=[{'all':!![]}];}return db[_0x4dca('0x2b')][_0x4dca('0x40')](_0x28f1e1);})[_0x4dca('0x25')](function(_0x2d7a30){_0x3aebb3[_0x4dca('0x41')]=_0x2d7a30;return _0x3aebb3;})[_0x4dca('0x25')](respondWithFilteredResult(_0x35be18,_0x28f1e1))['catch'](handleError(_0x35be18,null));};exports[_0x4dca('0x42')]=function(_0x123fb5,_0x3bce2c){var _0x2e34c0={'raw':!![],'where':{'id':_0x123fb5[_0x4dca('0x43')]['id']}},_0x4b6854={};_0x4b6854[_0x4dca('0x32')]=_[_0x4dca('0x2f')](db['CmHopperBlack'][_0x4dca('0x2c')]);_0x4b6854[_0x4dca('0x2e')]=_[_0x4dca('0x2f')](_0x123fb5[_0x4dca('0x2e')]);_0x4b6854[_0x4dca('0x30')]=_[_0x4dca('0x31')](_0x4b6854[_0x4dca('0x32')],_0x4b6854[_0x4dca('0x2e')]);_0x2e34c0['attributes']=_[_0x4dca('0x31')](_0x4b6854['model'],qs[_0x4dca('0x34')](_0x123fb5[_0x4dca('0x2e')]['fields']));_0x2e34c0['attributes']=_0x2e34c0[_0x4dca('0x33')][_0x4dca('0x35')]?_0x2e34c0[_0x4dca('0x33')]:_0x4b6854['model'];if(_0x123fb5[_0x4dca('0x2e')][_0x4dca('0x44')]){_0x2e34c0[_0x4dca('0x3f')]=[{'all':!![]}];}_0x2e34c0=_[_0x4dca('0x3d')]({},_0x2e34c0,_0x123fb5[_0x4dca('0x3e')]);return db['CmHopperBlack'][_0x4dca('0x45')](_0x2e34c0)['then'](handleEntityNotFound(_0x3bce2c,null))[_0x4dca('0x25')](respondWithResult(_0x3bce2c,null))[_0x4dca('0x46')](handleError(_0x3bce2c,null));};exports[_0x4dca('0x24')]=function(_0x19b8a5,_0x5cf48b){if(_0x19b8a5['body']['id']){delete _0x19b8a5[_0x4dca('0x47')]['id'];}return db['CmHopperBlack'][_0x4dca('0x45')]({'where':{'id':_0x19b8a5[_0x4dca('0x43')]['id']}})[_0x4dca('0x25')](handleEntityNotFound(_0x5cf48b,null))[_0x4dca('0x25')](saveUpdates(_0x19b8a5[_0x4dca('0x47')],null))[_0x4dca('0x25')](respondWithResult(_0x5cf48b,null))[_0x4dca('0x46')](handleError(_0x5cf48b,null));};exports[_0x4dca('0x26')]=function(_0x493612,_0x3ee644){return db[_0x4dca('0x2b')][_0x4dca('0x45')]({'where':{'id':_0x493612['params']['id']}})[_0x4dca('0x25')](handleEntityNotFound(_0x3ee644,null))[_0x4dca('0x25')](removeEntity(_0x3ee644,null))[_0x4dca('0x46')](handleError(_0x3ee644,null));};exports[_0x4dca('0x48')]=function(_0x3d6291,_0x35e9bc){return db['CmHopperBlack']['describe']()['then'](respondWithResult(_0x35e9bc,null))[_0x4dca('0x46')](handleError(_0x35e9bc,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index de69f54..ade5099 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 _0x6e6b=['./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','path','rimraf','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6e6b,0x151));var _0xb6e6=function(_0x42b913,_0x12ca41){_0x42b913=_0x42b913-0x0;var _0x253a82=_0x6e6b[_0x42b913];return _0x253a82;};'use strict';var _=require(_0xb6e6('0x0'));var util=require('util');var logger=require(_0xb6e6('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb6e6('0x2'));var rimraf=require(_0xb6e6('0x3'));var config=require(_0xb6e6('0x4'));var attributes=require(_0xb6e6('0x5'));module[_0xb6e6('0x6')]=function(_0x2062a9,_0x4cc8f8){return _0x2062a9['define'](_0xb6e6('0x7'),attributes,{'tableName':_0xb6e6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73c6=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black'];(function(_0x475923,_0x25d9ec){var _0x374030=function(_0x3f256b){while(--_0x3f256b){_0x475923['push'](_0x475923['shift']());}};_0x374030(++_0x25d9ec);}(_0x73c6,0xfc));var _0x673c=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x73c6[_0x411017];return _0x2adeea;};'use strict';var _=require('lodash');var util=require(_0x673c('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x673c('0x1'));var BPromise=require(_0x673c('0x2'));var rp=require(_0x673c('0x3'));var fs=require('fs');var path=require(_0x673c('0x4'));var rimraf=require(_0x673c('0x5'));var config=require(_0x673c('0x6'));var attributes=require(_0x673c('0x7'));module[_0x673c('0x8')]=function(_0x3fef36,_0x5f423f){return _0x3fef36[_0x673c('0x9')](_0x673c('0xa'),attributes,{'tableName':_0x673c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 376f5ec..fc0307f 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 _0x46f1=['info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','limit','include','model','attributes','map','update','where','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x2b4f7a,_0x292b5a){var _0x304a9c=function(_0x3e20a7){while(--_0x3e20a7){_0x2b4f7a['push'](_0x2b4f7a['shift']());}};_0x304a9c(++_0x292b5a);}(_0x46f1,0x1d2));var _0x146f=function(_0x3d9ef0,_0x5e8a9b){_0x3d9ef0=_0x3d9ef0-0x0;var _0x2a8520=_0x46f1[_0x3d9ef0];return _0x2a8520;};'use strict';var _=require('lodash');var util=require(_0x146f('0x0'));var moment=require('moment');var BPromise=require(_0x146f('0x1'));var rs=require(_0x146f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x146f('0x3'))['db'];var utils=require(_0x146f('0x4'));var logger=require('../../config/logger')(_0x146f('0x5'));var config=require(_0x146f('0x6'));var jayson=require(_0x146f('0x7'));var client=jayson['client'][_0x146f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b1ca5,_0x31890a,_0x1d6245){return new BPromise(function(_0x131f1a,_0xb2c7c4){return client['request'](_0x1b1ca5,_0x1d6245)[_0x146f('0x9')](function(_0xa9f8fd){logger[_0x146f('0xa')](_0x146f('0xb'),_0x31890a,_0x146f('0xc'));logger[_0x146f('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x31890a,'request\x20sent',JSON[_0x146f('0xe')](_0xa9f8fd));if(_0xa9f8fd['error']){if(_0xa9f8fd[_0x146f('0xf')]['code']===0x1f4){logger[_0x146f('0xf')](_0x146f('0xb'),_0x31890a,_0xa9f8fd[_0x146f('0xf')][_0x146f('0x10')]);return _0xb2c7c4(_0xa9f8fd[_0x146f('0xf')][_0x146f('0x10')]);}logger[_0x146f('0xf')](_0x146f('0xb'),_0x31890a,_0xa9f8fd[_0x146f('0xf')][_0x146f('0x10')]);return _0x131f1a(_0xa9f8fd['error'][_0x146f('0x10')]);}else{logger[_0x146f('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x31890a,_0x146f('0xc'));_0x131f1a(_0xa9f8fd[_0x146f('0x11')][_0x146f('0x10')]);}})[_0x146f('0x12')](function(_0x5cd4bb){logger[_0x146f('0xf')](_0x146f('0xb'),_0x31890a,_0x5cd4bb);_0xb2c7c4(_0x5cd4bb);});});}exports[_0x146f('0x13')]=function(_0x207e40){var _0x36b5ba=this;return new Promise(function(_0x95fbbf,_0x4c0181){return db[_0x146f('0x14')][_0x146f('0x15')]({'raw':_0x207e40[_0x146f('0x16')]?_0x207e40[_0x146f('0x16')][_0x146f('0x17')]===undefined?!![]:![]:!![],'where':_0x207e40['options']?_0x207e40['options']['where']||null:null,'attributes':_0x207e40[_0x146f('0x16')]?_0x207e40[_0x146f('0x16')]['attributes']||null:null,'limit':_0x207e40['options']?_0x207e40[_0x146f('0x16')][_0x146f('0x18')]||null:null,'include':_0x207e40[_0x146f('0x16')]?_0x207e40['options'][_0x146f('0x19')]?_['map'](_0x207e40['options'][_0x146f('0x19')],function(_0xed3249){return{'model':db[_0xed3249[_0x146f('0x1a')]],'as':_0xed3249['as'],'attributes':_0xed3249[_0x146f('0x1b')],'include':_0xed3249['include']?_[_0x146f('0x1c')](_0xed3249['include'],function(_0x4213f2){return{'model':db[_0x4213f2[_0x146f('0x1a')]],'as':_0x4213f2['as'],'attributes':_0x4213f2[_0x146f('0x1b')],'include':_0x4213f2[_0x146f('0x19')]?_[_0x146f('0x1c')](_0x4213f2[_0x146f('0x19')],function(_0x68162a){return{'model':db[_0x68162a[_0x146f('0x1a')]],'as':_0x68162a['as'],'attributes':_0x68162a[_0x146f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x146f('0x9')](function(_0x4ec85d){logger[_0x146f('0xa')](_0x146f('0x13'),_0x207e40);logger[_0x146f('0xd')](_0x146f('0x13'),_0x207e40,JSON['stringify'](_0x4ec85d));_0x95fbbf(_0x4ec85d);})[_0x146f('0x12')](function(_0x48b646){logger[_0x146f('0xf')]('GetCmHopperBlack',_0x48b646[_0x146f('0x10')],_0x207e40);_0x4c0181(_0x36b5ba[_0x146f('0xf')](0x1f4,_0x48b646[_0x146f('0x10')]));});});};exports['UpdateCmHopperBlack']=function(_0x5de5ba){var _0x3c08b6=this;return new Promise(function(_0x49ee13,_0x51ec64){return db[_0x146f('0x14')][_0x146f('0x1d')](_0x5de5ba['body'],{'raw':_0x5de5ba[_0x146f('0x16')]?_0x5de5ba['options'][_0x146f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5de5ba[_0x146f('0x16')]?_0x5de5ba['options'][_0x146f('0x1e')]||null:null,'attributes':_0x5de5ba[_0x146f('0x16')]?_0x5de5ba['options'][_0x146f('0x1b')]||null:null,'limit':_0x5de5ba[_0x146f('0x16')]?_0x5de5ba[_0x146f('0x16')][_0x146f('0x18')]||null:null})['then'](function(_0x200e21){logger[_0x146f('0xa')](_0x146f('0x1f'),_0x5de5ba);logger[_0x146f('0xd')](_0x146f('0x1f'),_0x5de5ba,JSON[_0x146f('0xe')](_0x200e21));_0x49ee13(_0x200e21);})[_0x146f('0x12')](function(_0x2a1b01){logger['error'](_0x146f('0x1f'),_0x2a1b01[_0x146f('0x10')],_0x5de5ba);_0x51ec64(_0x3c08b6[_0x146f('0xf')](0x1f4,_0x2a1b01['message']));});});};exports[_0x146f('0x20')]=function(_0x377392){var _0x1b20f3=this;return new Promise(function(_0x1710d7,_0x28e4f2){return db['CmHopperBlack'][_0x146f('0x21')]({'where':_0x377392[_0x146f('0x16')]?_0x377392[_0x146f('0x16')]['where']||null:null})['then'](function(_0x1e008b){logger['info']('DestroyCmHopperBlack',_0x377392);logger[_0x146f('0xd')](_0x146f('0x20'),_0x377392,JSON['stringify'](_0x1e008b));_0x1710d7(_0x1e008b);})[_0x146f('0x12')](function(_0x271b58){logger[_0x146f('0xf')](_0x146f('0x20'),_0x271b58[_0x146f('0x10')],_0x377392);_0x28e4f2(_0x1b20f3['error'](0x1f4,_0x271b58[_0x146f('0x10')]));});});}; \ No newline at end of file +var _0x83d2=['update','body','destroy','DestroyCmHopperBlack','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','result','catch','findAll','options','raw','where','attributes','limit','map','include','model','GetCmHopperBlack','debug','UpdateCmHopperBlack'];(function(_0x2c18a8,_0x24eaa5){var _0x1e009a=function(_0x5dea3a){while(--_0x5dea3a){_0x2c18a8['push'](_0x2c18a8['shift']());}};_0x1e009a(++_0x24eaa5);}(_0x83d2,0xbd));var _0x283d=function(_0x1c585c,_0x15f4df){_0x1c585c=_0x1c585c-0x0;var _0x404bbf=_0x83d2[_0x1c585c];return _0x404bbf;};'use strict';var _=require('lodash');var util=require(_0x283d('0x0'));var moment=require(_0x283d('0x1'));var BPromise=require(_0x283d('0x2'));var rs=require(_0x283d('0x3'));var fs=require('fs');var Redis=require(_0x283d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x283d('0x5'));var logger=require(_0x283d('0x6'))(_0x283d('0x7'));var config=require(_0x283d('0x8'));var jayson=require(_0x283d('0x9'));var client=jayson[_0x283d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1723ee,_0x196a70,_0x493a24){return new BPromise(function(_0x1eaa0f,_0xee8715){return client[_0x283d('0xb')](_0x1723ee,_0x493a24)[_0x283d('0xc')](function(_0x9eee5d){logger[_0x283d('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x196a70,_0x283d('0xe'));logger['debug']('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x196a70,_0x283d('0xe'),JSON[_0x283d('0xf')](_0x9eee5d));if(_0x9eee5d[_0x283d('0x10')]){if(_0x9eee5d[_0x283d('0x10')]['code']===0x1f4){logger[_0x283d('0x10')](_0x283d('0x11'),_0x196a70,_0x9eee5d[_0x283d('0x10')][_0x283d('0x12')]);return _0xee8715(_0x9eee5d[_0x283d('0x10')][_0x283d('0x12')]);}logger[_0x283d('0x10')](_0x283d('0x11'),_0x196a70,_0x9eee5d[_0x283d('0x10')][_0x283d('0x12')]);return _0x1eaa0f(_0x9eee5d[_0x283d('0x10')][_0x283d('0x12')]);}else{logger[_0x283d('0xd')](_0x283d('0x11'),_0x196a70,'request\x20sent');_0x1eaa0f(_0x9eee5d[_0x283d('0x13')]['message']);}})[_0x283d('0x14')](function(_0x1f182b){logger[_0x283d('0x10')](_0x283d('0x11'),_0x196a70,_0x1f182b);_0xee8715(_0x1f182b);});});}exports['GetCmHopperBlack']=function(_0xa094f2){var _0x59bb1f=this;return new Promise(function(_0x486880,_0xc8e45e){return db['CmHopperBlack'][_0x283d('0x15')]({'raw':_0xa094f2[_0x283d('0x16')]?_0xa094f2[_0x283d('0x16')][_0x283d('0x17')]===undefined?!![]:![]:!![],'where':_0xa094f2[_0x283d('0x16')]?_0xa094f2[_0x283d('0x16')][_0x283d('0x18')]||null:null,'attributes':_0xa094f2['options']?_0xa094f2[_0x283d('0x16')][_0x283d('0x19')]||null:null,'limit':_0xa094f2['options']?_0xa094f2[_0x283d('0x16')][_0x283d('0x1a')]||null:null,'include':_0xa094f2[_0x283d('0x16')]?_0xa094f2[_0x283d('0x16')]['include']?_[_0x283d('0x1b')](_0xa094f2[_0x283d('0x16')][_0x283d('0x1c')],function(_0x32d372){return{'model':db[_0x32d372[_0x283d('0x1d')]],'as':_0x32d372['as'],'attributes':_0x32d372[_0x283d('0x19')],'include':_0x32d372[_0x283d('0x1c')]?_[_0x283d('0x1b')](_0x32d372['include'],function(_0x39b8bd){return{'model':db[_0x39b8bd['model']],'as':_0x39b8bd['as'],'attributes':_0x39b8bd[_0x283d('0x19')],'include':_0x39b8bd[_0x283d('0x1c')]?_['map'](_0x39b8bd['include'],function(_0xda4f2f){return{'model':db[_0xda4f2f['model']],'as':_0xda4f2f['as'],'attributes':_0xda4f2f[_0x283d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x283d('0xc')](function(_0x102aed){logger[_0x283d('0xd')](_0x283d('0x1e'),_0xa094f2);logger[_0x283d('0x1f')]('GetCmHopperBlack',_0xa094f2,JSON[_0x283d('0xf')](_0x102aed));_0x486880(_0x102aed);})[_0x283d('0x14')](function(_0x17122f){logger[_0x283d('0x10')](_0x283d('0x1e'),_0x17122f['message'],_0xa094f2);_0xc8e45e(_0x59bb1f[_0x283d('0x10')](0x1f4,_0x17122f[_0x283d('0x12')]));});});};exports[_0x283d('0x20')]=function(_0x56eb40){var _0x297cd2=this;return new Promise(function(_0x352c94,_0xdedb6d){return db['CmHopperBlack'][_0x283d('0x21')](_0x56eb40[_0x283d('0x22')],{'raw':_0x56eb40['options']?_0x56eb40['options'][_0x283d('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56eb40[_0x283d('0x16')]?_0x56eb40[_0x283d('0x16')][_0x283d('0x18')]||null:null,'attributes':_0x56eb40[_0x283d('0x16')]?_0x56eb40[_0x283d('0x16')][_0x283d('0x19')]||null:null,'limit':_0x56eb40['options']?_0x56eb40[_0x283d('0x16')][_0x283d('0x1a')]||null:null})[_0x283d('0xc')](function(_0x3595f1){logger[_0x283d('0xd')](_0x283d('0x20'),_0x56eb40);logger['debug'](_0x283d('0x20'),_0x56eb40,JSON[_0x283d('0xf')](_0x3595f1));_0x352c94(_0x3595f1);})[_0x283d('0x14')](function(_0x292825){logger[_0x283d('0x10')](_0x283d('0x20'),_0x292825[_0x283d('0x12')],_0x56eb40);_0xdedb6d(_0x297cd2[_0x283d('0x10')](0x1f4,_0x292825[_0x283d('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x861138){var _0x1002ba=this;return new Promise(function(_0x47d24d,_0x964461){return db['CmHopperBlack'][_0x283d('0x23')]({'where':_0x861138[_0x283d('0x16')]?_0x861138[_0x283d('0x16')]['where']||null:null})[_0x283d('0xc')](function(_0x50dee6){logger['info'](_0x283d('0x24'),_0x861138);logger[_0x283d('0x1f')]('DestroyCmHopperBlack',_0x861138,JSON[_0x283d('0xf')](_0x50dee6));_0x47d24d(_0x50dee6);})[_0x283d('0x14')](function(_0x54cbff){logger['error']('DestroyCmHopperBlack',_0x54cbff['message'],_0x861138);_0x964461(_0x1002ba[_0x283d('0x10')](0x1f4,_0x54cbff[_0x283d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 73a02fb..597fa92 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 _0x7c09=['describe','put','/:id','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','/describe','isAuthenticated'];(function(_0x5b8bae,_0x669810){var _0x145b66=function(_0xef91ae){while(--_0xef91ae){_0x5b8bae['push'](_0x5b8bae['shift']());}};_0x145b66(++_0x669810);}(_0x7c09,0x102));var _0x97c0=function(_0x168575,_0x42c9){_0x168575=_0x168575-0x0;var _0x15eeec=_0x7c09[_0x168575];return _0x15eeec;};'use strict';var multer=require('multer');var util=require(_0x97c0('0x0'));var path=require(_0x97c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x97c0('0x2'));var router=express[_0x97c0('0x3')]();var fs_extra=require(_0x97c0('0x4'));var auth=require(_0x97c0('0x5'));var interaction=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var controller=require(_0x97c0('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x97c0('0x9')](_0x97c0('0xa'),auth[_0x97c0('0xb')](),controller[_0x97c0('0xc')]);router[_0x97c0('0x9')]('/:id',auth[_0x97c0('0xb')](),controller['show']);router[_0x97c0('0xd')](_0x97c0('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x97c0('0xf')](_0x97c0('0xe'),auth[_0x97c0('0xb')](),controller[_0x97c0('0x10')]);module[_0x97c0('0x11')]=router; \ No newline at end of file +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(_0x9bf0a1,_0x105c87){var _0x2f5065=function(_0x113b11){while(--_0x113b11){_0x9bf0a1['push'](_0x9bf0a1['shift']());}};_0x2f5065(++_0x105c87);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x1722d4,_0x4beb3b){_0x1722d4=_0x1722d4-0x0;var _0x46dd4b=_0xaa3f[_0x1722d4];return _0x46dd4b;};'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 diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 348a636..513ea3b 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 _0x645c=['INTEGER','DATE','STRING','endtime','BOOLEAN','sequelize','moment','exports'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0x645c,0xcd));var _0xc645=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x645c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc645('0x0'));var moment=require(_0xc645('0x1'));module[_0xc645('0x2')]={'state':{'type':Sequelize[_0xc645('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xc645('0x4')]},'countbusyretry':{'type':Sequelize[_0xc645('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc645('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc645('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc645('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc645('0x5')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xc645('0x5')]},'calleridnum':{'type':Sequelize[_0xc645('0x5')]},'calleridname':{'type':Sequelize[_0xc645('0x5')]},'starttime':{'type':Sequelize[_0xc645('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xc645('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xc645('0x4')]},'ringtime':{'type':Sequelize[_0xc645('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc645('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xc645('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc645('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xc645('0x5')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xc645('0x5')]},'membername':{'type':Sequelize[_0xc645('0x5')]},'reason':{'type':Sequelize[_0xc645('0x5')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc645('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xc645('0x4')],'set':function(_0x27109f){var _0x5588ef=this['getDataValue'](_0xc645('0x6'));if(_0x5588ef&&_0x27109f){this['setDataValue']('followuptime',moment(_0x27109f)['diff'](moment(_0x5588ef),'seconds'));}}},'amd':{'type':Sequelize[_0xc645('0x7')],'defaultValue':![]},'fax':{'type':Sequelize[_0xc645('0x7')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xc645('0x7')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xc645('0x4')]},'callback':{'type':Sequelize[_0xc645('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc645('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc645('0x4')]},'deleted':{'type':Sequelize[_0xc645('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xc645('0x4')]},'recallme':{'type':Sequelize[_0xc645('0x7')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xc645('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xc645('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc645('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc645('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x349e=['INTEGER','DATE','STRING','getDataValue','endtime','setDataValue','diff','BOOLEAN','moment','exports'];(function(_0x339cdd,_0x3a5877){var _0x5d2085=function(_0x19c7c0){while(--_0x19c7c0){_0x339cdd['push'](_0x339cdd['shift']());}};_0x5d2085(++_0x3a5877);}(_0x349e,0x1ca));var _0xe349=function(_0x14f9e3,_0x1ee25c){_0x14f9e3=_0x14f9e3-0x0;var _0x5ecee2=_0x349e[_0x14f9e3];return _0x5ecee2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe349('0x0'));module[_0xe349('0x1')]={'state':{'type':Sequelize[_0xe349('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xe349('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe349('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe349('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xe349('0x4')]},'originatecalleridname':{'type':Sequelize[_0xe349('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe349('0x4')]},'starttime':{'type':Sequelize[_0xe349('0x3')]},'responsetime':{'type':Sequelize[_0xe349('0x3')]},'answertime':{'type':Sequelize[_0xe349('0x3')]},'droptime':{'type':Sequelize[_0xe349('0x3')]},'endtime':{'type':Sequelize[_0xe349('0x3')]},'ringtime':{'type':Sequelize[_0xe349('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe349('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe349('0x4')]},'campaign':{'type':Sequelize[_0xe349('0x4')]},'campaigntype':{'type':Sequelize[_0xe349('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xe349('0x4')]},'disposition':{'type':Sequelize[_0xe349('0x4')]},'secondDisposition':{'type':Sequelize[_0xe349('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe349('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x372d5a){var _0xba968d=this[_0xe349('0x5')](_0xe349('0x6'));if(_0xba968d&&_0x372d5a){this[_0xe349('0x7')]('followuptime',moment(_0x372d5a)[_0xe349('0x8')](moment(_0xba968d),'seconds'));}}},'amd':{'type':Sequelize[_0xe349('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe349('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xe349('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe349('0x3')]},'callback':{'type':Sequelize[_0xe349('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe349('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe349('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe349('0x3')]},'recallme':{'type':Sequelize[_0xe349('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe349('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0xe349('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe349('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe349('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe349('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 efb79c7..9f961c6 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 _0x5fab=['json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','includeAll','include','findAll','then','rows','show','params','intersection','fields','options','find','catch','describe','body','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','dropContacts','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','select','field','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','NOW()','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','Campaign','insert','CampaignId','createdAt','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x10090c,_0x2cb8dd){var _0x3137a8=function(_0x2f5ce4){while(--_0x2f5ce4){_0x10090c['push'](_0x10090c['shift']());}};_0x3137a8(++_0x2cb8dd);}(_0x5fab,0x177));var _0xb5fa=function(_0x4c4683,_0x241657){_0x4c4683=_0x4c4683-0x0;var _0x78ee7e=_0x5fab[_0x4c4683];return _0x78ee7e;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];function respondWithStatusCode(_0x4d3576,_0x2ad830){_0x2ad830=_0x2ad830||0xcc;return function(_0x3dad4d){if(_0x3dad4d){return _0x4d3576['sendStatus'](_0x2ad830);}return _0x4d3576[_0xb5fa('0x1a')](_0x2ad830)['end']();};}function respondWithResult(_0x265992,_0x3fc372){_0x3fc372=_0x3fc372||0xc8;return function(_0x40c914){if(_0x40c914){return _0x265992[_0xb5fa('0x1a')](_0x3fc372)[_0xb5fa('0x1b')](_0x40c914);}};}function respondWithFilteredResult(_0x5371cf,_0x567f31){return function(_0x38e964){if(_0x38e964){var _0x587043=typeof _0x567f31[_0xb5fa('0x1c')]===_0xb5fa('0x1d')&&typeof _0x567f31['limit']==='undefined';var _0x451a55=_0x38e964[_0xb5fa('0x1e')];var _0x32e9e5=_0x587043?0x0:_0x567f31[_0xb5fa('0x1c')];var _0x324ba5=_0x587043?_0x38e964[_0xb5fa('0x1e')]:_0x567f31[_0xb5fa('0x1c')]+_0x567f31[_0xb5fa('0x1f')];var _0xc14dc4;if(_0x324ba5>=_0x451a55){_0x324ba5=_0x451a55;_0xc14dc4=0xc8;}else{_0xc14dc4=0xce;}_0x5371cf[_0xb5fa('0x1a')](_0xc14dc4);return _0x5371cf[_0xb5fa('0x20')](_0xb5fa('0x21'),_0x32e9e5+'-'+_0x324ba5+'/'+_0x451a55)['json'](_0x38e964);}return null;};}function patchUpdates(_0x432bfa){return function(_0x519e20){try{jsonpatch[_0xb5fa('0x22')](_0x519e20,_0x432bfa,!![]);}catch(_0x4a6c04){return BPromise[_0xb5fa('0x23')](_0x4a6c04);}return _0x519e20[_0xb5fa('0x24')]();};}function saveUpdates(_0x4e05c0,_0x40dfdf){return function(_0x3a2ab9){if(_0x3a2ab9){return _0x3a2ab9[_0xb5fa('0x25')](_0x4e05c0)['then'](function(_0x32a85c){return _0x32a85c;});}return null;};}function removeEntity(_0xec108f,_0x444237){return function(_0x542348){if(_0x542348){return _0x542348[_0xb5fa('0x26')]()['then'](function(){_0xec108f[_0xb5fa('0x1a')](0xcc)[_0xb5fa('0x27')]();});}};}function handleEntityNotFound(_0x11053a,_0x543edf){return function(_0x2dbd22){if(!_0x2dbd22){_0x11053a[_0xb5fa('0x28')](0x194);}return _0x2dbd22;};}function handleError(_0x6a455c,_0x20d649){_0x20d649=_0x20d649||0x1f4;return function(_0x568870){logger['error'](_0x568870['stack']);if(_0x568870['name']){delete _0x568870[_0xb5fa('0x29')];}_0x6a455c[_0xb5fa('0x1a')](_0x20d649)[_0xb5fa('0x2a')](_0x568870);};}exports[_0xb5fa('0x2b')]=function(_0x534884,_0x3506a4){var _0x358549={},_0x353314={},_0x409af9={'count':0x0,'rows':[]};var _0x2a5690=_[_0xb5fa('0x2c')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')],function(_0x1f4380){return{'name':_0x1f4380[_0xb5fa('0x2f')],'type':_0x1f4380[_0xb5fa('0x30')][_0xb5fa('0x31')]};});_0x353314[_0xb5fa('0x32')]=_[_0xb5fa('0x2c')](_0x2a5690,_0xb5fa('0x29'));_0x353314[_0xb5fa('0x33')]=_[_0xb5fa('0x34')](_0x534884[_0xb5fa('0x33')]);_0x353314[_0xb5fa('0x35')]=_['intersection'](_0x353314[_0xb5fa('0x32')],_0x353314['query']);_0x358549['attributes']=_['intersection'](_0x353314[_0xb5fa('0x32')],qs['fields'](_0x534884[_0xb5fa('0x33')]['fields']));_0x358549['attributes']=_0x358549[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x358549['attributes']:_0x353314['model'];if(!_0x534884[_0xb5fa('0x33')][_0xb5fa('0x38')](_0xb5fa('0x39'))){_0x358549['limit']=qs[_0xb5fa('0x1f')](_0x534884[_0xb5fa('0x33')]['limit']);_0x358549[_0xb5fa('0x1c')]=qs[_0xb5fa('0x1c')](_0x534884[_0xb5fa('0x33')]['offset']);}_0x358549[_0xb5fa('0x3a')]=qs[_0xb5fa('0x3b')](_0x534884[_0xb5fa('0x33')]['sort']);_0x358549[_0xb5fa('0x3c')]=qs[_0xb5fa('0x35')](_[_0xb5fa('0x3d')](_0x534884[_0xb5fa('0x33')],_0x353314['filters']),_0x2a5690);if(_0x534884['query']['filter']){_0x358549['where']=_['merge'](_0x358549['where'],{'$or':_[_0xb5fa('0x2c')](_0x2a5690,function(_0x4c0a4d){if(_0x4c0a4d[_0xb5fa('0x30')]!==_0xb5fa('0x3e')){var _0x36db1a={};_0x36db1a[_0x4c0a4d[_0xb5fa('0x29')]]={'$like':'%'+_0x534884[_0xb5fa('0x33')][_0xb5fa('0x3f')]+'%'};return _0x36db1a;}})});}_0x358549=_['merge']({},_0x358549,_0x534884['options']);var _0x4c4bf0={'where':_0x358549[_0xb5fa('0x3c')]};return db['CmHopperFinal'][_0xb5fa('0x1e')](_0x4c4bf0)['then'](function(_0x58aa97){_0x409af9[_0xb5fa('0x1e')]=_0x58aa97;if(_0x534884[_0xb5fa('0x33')][_0xb5fa('0x40')]){_0x358549[_0xb5fa('0x41')]=[{'all':!![]}];}return db[_0xb5fa('0x2d')][_0xb5fa('0x42')](_0x358549);})[_0xb5fa('0x43')](function(_0x83df0b){_0x409af9[_0xb5fa('0x44')]=_0x83df0b;return _0x409af9;})[_0xb5fa('0x43')](respondWithFilteredResult(_0x3506a4,_0x358549))['catch'](handleError(_0x3506a4,null));};exports[_0xb5fa('0x45')]=function(_0x4bc9df,_0x233f90){var _0x39aac3={'raw':!![],'where':{'id':_0x4bc9df[_0xb5fa('0x46')]['id']}},_0x2c7c5f={};_0x2c7c5f[_0xb5fa('0x32')]=_[_0xb5fa('0x34')](db[_0xb5fa('0x2d')][_0xb5fa('0x2e')]);_0x2c7c5f['query']=_[_0xb5fa('0x34')](_0x4bc9df[_0xb5fa('0x33')]);_0x2c7c5f['filters']=_[_0xb5fa('0x47')](_0x2c7c5f['model'],_0x2c7c5f[_0xb5fa('0x33')]);_0x39aac3[_0xb5fa('0x36')]=_['intersection'](_0x2c7c5f['model'],qs[_0xb5fa('0x48')](_0x4bc9df[_0xb5fa('0x33')][_0xb5fa('0x48')]));_0x39aac3[_0xb5fa('0x36')]=_0x39aac3[_0xb5fa('0x36')][_0xb5fa('0x37')]?_0x39aac3[_0xb5fa('0x36')]:_0x2c7c5f[_0xb5fa('0x32')];if(_0x4bc9df['query'][_0xb5fa('0x40')]){_0x39aac3[_0xb5fa('0x41')]=[{'all':!![]}];}_0x39aac3=_['merge']({},_0x39aac3,_0x4bc9df[_0xb5fa('0x49')]);return db[_0xb5fa('0x2d')][_0xb5fa('0x4a')](_0x39aac3)[_0xb5fa('0x43')](handleEntityNotFound(_0x233f90,null))[_0xb5fa('0x43')](respondWithResult(_0x233f90,null))[_0xb5fa('0x4b')](handleError(_0x233f90,null));};exports[_0xb5fa('0x4c')]=function(_0x33eb2c,_0x20f5f5){return db[_0xb5fa('0x2d')][_0xb5fa('0x4c')]()[_0xb5fa('0x43')](respondWithResult(_0x20f5f5,null))[_0xb5fa('0x4b')](handleError(_0x20f5f5,null));};exports[_0xb5fa('0x25')]=function(_0x42a359,_0x3a39f2){if(_0x42a359['body']['uniqueid']){delete _0x42a359[_0xb5fa('0x4d')]['uniqueid'];}return db[_0xb5fa('0x2d')][_0xb5fa('0x4a')]({'where':{'uniqueid':_0x42a359['params']['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x3a39f2,null))[_0xb5fa('0x43')](saveUpdates(_0x42a359[_0xb5fa('0x4d')],null))[_0xb5fa('0x43')](respondWithResult(_0x3a39f2,null))[_0xb5fa('0x4b')](handleError(_0x3a39f2,null));};exports[_0xb5fa('0x4e')]=function(_0x51d5f7,_0x27a651,_0x4fd5bf){return db[_0xb5fa('0x2d')][_0xb5fa('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x51d5f7[_0xb5fa('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db['sequelize']['literal'](_0xb5fa('0x51')))),_0xb5fa('0x52')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x54')))),_0xb5fa('0x55')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x56')))),_0xb5fa('0x57')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db['sequelize']['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x58')))),_0xb5fa('0x59')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x5a')))),'dropContacts'],[db['sequelize']['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')]['literal'](_0xb5fa('0x5b')))),_0xb5fa('0x5c')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')]('`state`\x20=\x2022,\x201,\x20null'))),_0xb5fa('0x5d')],[db[_0xb5fa('0x50')]['fn']('COUNT',db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')]['literal'](_0xb5fa('0x5e')))),_0xb5fa('0x5f')]]})[_0xb5fa('0x43')](handleEntityNotFound(_0x27a651,null))[_0xb5fa('0x43')](respondWithResult(_0x27a651,null))[_0xb5fa('0x4b')](handleError(_0x27a651,null));};exports[_0xb5fa('0x60')]=function(_0x18cde9,_0x40d7d5,_0xd2ba4e){return db[_0xb5fa('0x2d')][_0xb5fa('0x42')]({'raw':![],'where':{'CampaignId':_0x18cde9[_0xb5fa('0x46')]['id']},'attributes':[[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x51')))),_0xb5fa('0x52')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db['sequelize'][_0xb5fa('0x53')](_0xb5fa('0x54')))),_0xb5fa('0x55')],[db['sequelize']['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db['sequelize'][_0xb5fa('0x53')](_0xb5fa('0x56')))),_0xb5fa('0x57')],[db['sequelize']['fn']('COUNT',db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')]('`state`\x20=\x208,\x201,\x20null'))),_0xb5fa('0x59')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb5fa('0x61')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db['sequelize']['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x5b')))),_0xb5fa('0x5c')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')][_0xb5fa('0x53')](_0xb5fa('0x62')))),_0xb5fa('0x5d')],[db[_0xb5fa('0x50')]['fn'](_0xb5fa('0x4f'),db[_0xb5fa('0x50')]['fn']('IF',db[_0xb5fa('0x50')]['literal'](_0xb5fa('0x5e')))),'answeringMachine']]})[_0xb5fa('0x43')](handleEntityNotFound(_0x40d7d5,null))[_0xb5fa('0x43')](respondWithResult(_0x40d7d5,null))[_0xb5fa('0x4b')](handleError(_0x40d7d5,null));};exports[_0xb5fa('0x63')]=function(_0x339dfb,_0x56e6b0,_0x1585cd){return db['VoiceQueue'][_0xb5fa('0x4a')]({'where':{'id':_0x339dfb[_0xb5fa('0x46')]['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x56e6b0,null))[_0xb5fa('0x43')](function(_0x5e44d8){var _0x4d1117;if(_0x5e44d8){_0x4d1117=squel['insert']()[_0xb5fa('0x64')](_0xb5fa('0x65'))[_0xb5fa('0x66')]([_0xb5fa('0x67'),_0xb5fa('0x68'),_0xb5fa('0x69'),'ListId',_0xb5fa('0x6a'),'createdAt','updatedAt'],squel[_0xb5fa('0x6b')]()['field']('ANY_VALUE(calleridnum)','phone')[_0xb5fa('0x6c')]('NOW()',_0xb5fa('0x68'))[_0xb5fa('0x6c')](_0xb5fa('0x6d'),'ContactId')['field'](_0xb5fa('0x6e'),_0xb5fa('0x6f'))['field'](_0xb5fa('0x70'),_0xb5fa('0x6a'))[_0xb5fa('0x6c')](_0xb5fa('0x71'),'createdAt')[_0xb5fa('0x6c')](_0xb5fa('0x71'),_0xb5fa('0x72'))[_0xb5fa('0x73')](_0xb5fa('0x74'))[_0xb5fa('0x3c')](_0xb5fa('0x75'),_0x339dfb['params']['id'][_0xb5fa('0x76')]())['where'](_0xb5fa('0x77'),_0x339dfb[_0xb5fa('0x4d')]['state'][_0xb5fa('0x76')]())[_0xb5fa('0x3c')](_0xb5fa('0x78'))[_0xb5fa('0x3c')](_0xb5fa('0x79'),squel[_0xb5fa('0x6b')]()[_0xb5fa('0x6c')](_0xb5fa('0x67'))['from'](_0xb5fa('0x65'))[_0xb5fa('0x3c')](_0xb5fa('0x75'),_0x339dfb[_0xb5fa('0x46')]['id']['toString']()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xb5fa('0x6c')](_0xb5fa('0x7a'))[_0xb5fa('0x73')](_0xb5fa('0x74'))['where']('VoiceQueueId\x20=\x20?',_0x339dfb[_0xb5fa('0x46')]['id']['toString']())[_0xb5fa('0x3c')](_0xb5fa('0x7b')))[_0xb5fa('0x7c')](_0xb5fa('0x69')))['toString']();return db[_0xb5fa('0x50')]['query'](_0x4d1117);}return[];})[_0xb5fa('0x43')](respondWithResult(_0x56e6b0,null))[_0xb5fa('0x4b')](handleError(_0x56e6b0,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x5e6852,_0x391412,_0x3150ac){return db[_0xb5fa('0x7d')][_0xb5fa('0x4a')]({'where':{'id':_0x5e6852[_0xb5fa('0x46')]['id']}})[_0xb5fa('0x43')](handleEntityNotFound(_0x391412,null))[_0xb5fa('0x43')](function(_0x25b278){var _0x1a0255;if(_0x25b278){_0x1a0255=squel[_0xb5fa('0x7e')]()[_0xb5fa('0x64')](_0xb5fa('0x65'))[_0xb5fa('0x66')](['phone','scheduledAt',_0xb5fa('0x69'),'ListId',_0xb5fa('0x7f'),_0xb5fa('0x80'),'updatedAt'],squel[_0xb5fa('0x6b')]()[_0xb5fa('0x6c')]('ANY_VALUE(calleridnum)',_0xb5fa('0x67'))[_0xb5fa('0x6c')]('NOW()',_0xb5fa('0x68'))[_0xb5fa('0x6c')](_0xb5fa('0x6d'),'ContactId')['field'](_0xb5fa('0x6e'),_0xb5fa('0x6f'))[_0xb5fa('0x6c')](_0xb5fa('0x81'),_0xb5fa('0x7f'))[_0xb5fa('0x6c')](_0xb5fa('0x71'),_0xb5fa('0x80'))[_0xb5fa('0x6c')](_0xb5fa('0x71'),'updatedAt')['from'](_0xb5fa('0x74'))[_0xb5fa('0x3c')](_0xb5fa('0x82'),_0x5e6852[_0xb5fa('0x46')]['id']['toString']())[_0xb5fa('0x3c')](_0xb5fa('0x77'),_0x5e6852[_0xb5fa('0x4d')]['state'][_0xb5fa('0x76')]())[_0xb5fa('0x3c')](_0xb5fa('0x78'))[_0xb5fa('0x3c')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb5fa('0x6b')]()[_0xb5fa('0x6c')](_0xb5fa('0x67'))[_0xb5fa('0x73')](_0xb5fa('0x65'))[_0xb5fa('0x3c')](_0xb5fa('0x82'),_0x5e6852[_0xb5fa('0x46')]['id'][_0xb5fa('0x76')]()))[_0xb5fa('0x3c')](_0xb5fa('0x79'),squel[_0xb5fa('0x6b')]()[_0xb5fa('0x6c')](_0xb5fa('0x7a'))[_0xb5fa('0x73')]('cm_hopper_final')[_0xb5fa('0x3c')](_0xb5fa('0x82'),_0x5e6852[_0xb5fa('0x46')]['id'][_0xb5fa('0x76')]())[_0xb5fa('0x3c')](_0xb5fa('0x7b')))[_0xb5fa('0x7c')](_0xb5fa('0x69')))['toString']();return db['sequelize'][_0xb5fa('0x33')](_0x1a0255);}return[];})['then'](respondWithResult(_0x391412,null))['catch'](handleError(_0x391412,null));};exports[_0xb5fa('0x83')]=function(_0x27dbe8,_0x2faf23,_0x4d607d){return db[_0xb5fa('0x84')][_0xb5fa('0x85')]({'where':{'VoiceQueueId':_0x27dbe8[_0xb5fa('0x4d')]['VoiceQueueId'],'CampaignId':_0x27dbe8[_0xb5fa('0x4d')][_0xb5fa('0x7f')],'ContactId':_0x27dbe8['body'][_0xb5fa('0x69')]}})[_0xb5fa('0x43')](handleEntityNotFound(_0x2faf23,null))[_0xb5fa('0x43')](function(_0xf15d5c){if(_0xf15d5c){return _0xf15d5c;}return null;})[_0xb5fa('0x43')](respondWithResult(_0x2faf23,null))[_0xb5fa('0x4b')](handleError(_0x2faf23,null));}; \ No newline at end of file +var _0x6d38=['calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','stack','name','send','index','map','CmHopperFinal','rawAttributes','type','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','keys','filters','intersection','describe','catch','body','uniqueid','find','params','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','from','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','Campaign','cm_hopper','CampaignId','ANY_VALUE(ListId)','CampaignId\x20=\x20?','state'];(function(_0x4aac43,_0x196d7d){var _0x42bbaf=function(_0x1557b8){while(--_0x1557b8){_0x4aac43['push'](_0x4aac43['shift']());}};_0x42bbaf(++_0x196d7d);}(_0x6d38,0x1ef));var _0x86d3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6d38[_0x465028];return _0xb783d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86d3('0x0'));var zipdir=require(_0x86d3('0x1'));var jsonpatch=require(_0x86d3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x86d3('0x3'));var Mustache=require('mustache');var util=require(_0x86d3('0x4'));var path=require(_0x86d3('0x5'));var sox=require(_0x86d3('0x6'));var csv=require('to-csv');var ejs=require(_0x86d3('0x7'));var fs=require('fs');var fs_extra=require(_0x86d3('0x8'));var _=require(_0x86d3('0x9'));var squel=require(_0x86d3('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x86d3('0xb'));var toCsv=require(_0x86d3('0xc'));var querystring=require(_0x86d3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86d3('0xe'));var qs=require(_0x86d3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x86d3('0x10'))(_0x86d3('0x11'));var utils=require('../../config/utils');var config=require(_0x86d3('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86d3('0x13'))['db'];function respondWithStatusCode(_0x7d4d2e,_0x440a55){_0x440a55=_0x440a55||0xcc;return function(_0x26d64c){if(_0x26d64c){return _0x7d4d2e[_0x86d3('0x14')](_0x440a55);}return _0x7d4d2e[_0x86d3('0x15')](_0x440a55)[_0x86d3('0x16')]();};}function respondWithResult(_0x12ef4a,_0x5ce2ff){_0x5ce2ff=_0x5ce2ff||0xc8;return function(_0x1c1ba8){if(_0x1c1ba8){return _0x12ef4a[_0x86d3('0x15')](_0x5ce2ff)[_0x86d3('0x17')](_0x1c1ba8);}};}function respondWithFilteredResult(_0x207f6f,_0x1ea535){return function(_0x34fb3b){if(_0x34fb3b){var _0x1ff008=typeof _0x1ea535[_0x86d3('0x18')]==='undefined'&&typeof _0x1ea535[_0x86d3('0x19')]===_0x86d3('0x1a');var _0x431b3f=_0x34fb3b[_0x86d3('0x1b')];var _0x46feec=_0x1ff008?0x0:_0x1ea535[_0x86d3('0x18')];var _0x33e459=_0x1ff008?_0x34fb3b[_0x86d3('0x1b')]:_0x1ea535[_0x86d3('0x18')]+_0x1ea535['limit'];var _0x191ba5;if(_0x33e459>=_0x431b3f){_0x33e459=_0x431b3f;_0x191ba5=0xc8;}else{_0x191ba5=0xce;}_0x207f6f['status'](_0x191ba5);return _0x207f6f[_0x86d3('0x1c')]('Content-Range',_0x46feec+'-'+_0x33e459+'/'+_0x431b3f)['json'](_0x34fb3b);}return null;};}function patchUpdates(_0x41486a){return function(_0x1edb6d){try{jsonpatch[_0x86d3('0x1d')](_0x1edb6d,_0x41486a,!![]);}catch(_0x1720ae){return BPromise['reject'](_0x1720ae);}return _0x1edb6d[_0x86d3('0x1e')]();};}function saveUpdates(_0x55e1c3,_0x36e0fa){return function(_0x3fdf67){if(_0x3fdf67){return _0x3fdf67[_0x86d3('0x1f')](_0x55e1c3)['then'](function(_0x39d819){return _0x39d819;});}return null;};}function removeEntity(_0x72b3d4,_0x1fa4ac){return function(_0x4bf5b8){if(_0x4bf5b8){return _0x4bf5b8['destroy']()[_0x86d3('0x20')](function(){_0x72b3d4['status'](0xcc)[_0x86d3('0x16')]();});}};}function handleEntityNotFound(_0x1bea5e,_0x3dfecd){return function(_0x3c5fe4){if(!_0x3c5fe4){_0x1bea5e['sendStatus'](0x194);}return _0x3c5fe4;};}function handleError(_0x481077,_0x3359e4){_0x3359e4=_0x3359e4||0x1f4;return function(_0x611764){logger['error'](_0x611764[_0x86d3('0x21')]);if(_0x611764['name']){delete _0x611764[_0x86d3('0x22')];}_0x481077[_0x86d3('0x15')](_0x3359e4)[_0x86d3('0x23')](_0x611764);};}exports[_0x86d3('0x24')]=function(_0x11a6fd,_0x14c9ff){var _0x1f203e={},_0x35d708={},_0x303f13={'count':0x0,'rows':[]};var _0x44dacf=_[_0x86d3('0x25')](db[_0x86d3('0x26')][_0x86d3('0x27')],function(_0x28c25e){return{'name':_0x28c25e['fieldName'],'type':_0x28c25e[_0x86d3('0x28')][_0x86d3('0x29')]};});_0x35d708[_0x86d3('0x2a')]=_[_0x86d3('0x25')](_0x44dacf,_0x86d3('0x22'));_0x35d708[_0x86d3('0x2b')]=_['keys'](_0x11a6fd[_0x86d3('0x2b')]);_0x35d708['filters']=_['intersection'](_0x35d708[_0x86d3('0x2a')],_0x35d708[_0x86d3('0x2b')]);_0x1f203e[_0x86d3('0x2c')]=_['intersection'](_0x35d708[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x11a6fd['query'][_0x86d3('0x2d')]));_0x1f203e[_0x86d3('0x2c')]=_0x1f203e[_0x86d3('0x2c')][_0x86d3('0x2e')]?_0x1f203e[_0x86d3('0x2c')]:_0x35d708[_0x86d3('0x2a')];if(!_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x2f')]('nolimit')){_0x1f203e['limit']=qs['limit'](_0x11a6fd[_0x86d3('0x2b')]['limit']);_0x1f203e[_0x86d3('0x18')]=qs['offset'](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x18')]);}_0x1f203e[_0x86d3('0x30')]=qs[_0x86d3('0x31')](_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x31')]);_0x1f203e[_0x86d3('0x32')]=qs['filters'](_[_0x86d3('0x33')](_0x11a6fd[_0x86d3('0x2b')],_0x35d708['filters']),_0x44dacf);if(_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]){_0x1f203e[_0x86d3('0x32')]=_[_0x86d3('0x35')](_0x1f203e['where'],{'$or':_[_0x86d3('0x25')](_0x44dacf,function(_0x42ac0d){if(_0x42ac0d[_0x86d3('0x28')]!=='VIRTUAL'){var _0x5762ca={};_0x5762ca[_0x42ac0d[_0x86d3('0x22')]]={'$like':'%'+_0x11a6fd[_0x86d3('0x2b')][_0x86d3('0x34')]+'%'};return _0x5762ca;}})});}_0x1f203e=_[_0x86d3('0x35')]({},_0x1f203e,_0x11a6fd[_0x86d3('0x36')]);var _0x3666fc={'where':_0x1f203e[_0x86d3('0x32')]};return db['CmHopperFinal'][_0x86d3('0x1b')](_0x3666fc)[_0x86d3('0x20')](function(_0x2bdc67){_0x303f13[_0x86d3('0x1b')]=_0x2bdc67;if(_0x11a6fd['query'][_0x86d3('0x37')]){_0x1f203e[_0x86d3('0x38')]=[{'all':!![]}];}return db[_0x86d3('0x26')][_0x86d3('0x39')](_0x1f203e);})['then'](function(_0x587747){_0x303f13[_0x86d3('0x3a')]=_0x587747;return _0x303f13;})['then'](respondWithFilteredResult(_0x14c9ff,_0x1f203e))['catch'](handleError(_0x14c9ff,null));};exports[_0x86d3('0x3b')]=function(_0x1385fc,_0x43490a){var _0x35d6fe={'raw':!![],'where':{'id':_0x1385fc['params']['id']}},_0x23ef72={};_0x23ef72[_0x86d3('0x2a')]=_[_0x86d3('0x3c')](db[_0x86d3('0x26')]['rawAttributes']);_0x23ef72[_0x86d3('0x2b')]=_[_0x86d3('0x3c')](_0x1385fc['query']);_0x23ef72[_0x86d3('0x3d')]=_[_0x86d3('0x3e')](_0x23ef72['model'],_0x23ef72['query']);_0x35d6fe['attributes']=_[_0x86d3('0x3e')](_0x23ef72[_0x86d3('0x2a')],qs[_0x86d3('0x2d')](_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x2d')]));_0x35d6fe[_0x86d3('0x2c')]=_0x35d6fe['attributes'][_0x86d3('0x2e')]?_0x35d6fe[_0x86d3('0x2c')]:_0x23ef72['model'];if(_0x1385fc[_0x86d3('0x2b')][_0x86d3('0x37')]){_0x35d6fe[_0x86d3('0x38')]=[{'all':!![]}];}_0x35d6fe=_[_0x86d3('0x35')]({},_0x35d6fe,_0x1385fc[_0x86d3('0x36')]);return db[_0x86d3('0x26')]['find'](_0x35d6fe)[_0x86d3('0x20')](handleEntityNotFound(_0x43490a,null))[_0x86d3('0x20')](respondWithResult(_0x43490a,null))['catch'](handleError(_0x43490a,null));};exports[_0x86d3('0x3f')]=function(_0x412d0e,_0xd20863){return db[_0x86d3('0x26')][_0x86d3('0x3f')]()['then'](respondWithResult(_0xd20863,null))[_0x86d3('0x40')](handleError(_0xd20863,null));};exports[_0x86d3('0x1f')]=function(_0x3226b5,_0x14fa58){if(_0x3226b5[_0x86d3('0x41')][_0x86d3('0x42')]){delete _0x3226b5[_0x86d3('0x41')][_0x86d3('0x42')];}return db[_0x86d3('0x26')][_0x86d3('0x43')]({'where':{'uniqueid':_0x3226b5[_0x86d3('0x44')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x14fa58,null))['then'](saveUpdates(_0x3226b5[_0x86d3('0x41')],null))[_0x86d3('0x20')](respondWithResult(_0x14fa58,null))['catch'](handleError(_0x14fa58,null));};exports[_0x86d3('0x45')]=function(_0x23a6ee,_0x197047,_0x2e9af5){return db[_0x86d3('0x26')][_0x86d3('0x39')]({'raw':![],'where':{'VoiceQueueId':_0x23a6ee['params']['id']},'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x48')))),_0x86d3('0x49')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db['sequelize'][_0x86d3('0x47')](_0x86d3('0x4b')))),_0x86d3('0x4c')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')]['literal'](_0x86d3('0x4d')))),'busyContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')]('`state`\x20=\x208,\x201,\x20null'))),_0x86d3('0x4e')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x86d3('0x4f')))),'dropContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x50')))),_0x86d3('0x51')],[db[_0x86d3('0x46')]['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x52')))),'answeringMachine']]})[_0x86d3('0x20')](handleEntityNotFound(_0x197047,null))[_0x86d3('0x20')](respondWithResult(_0x197047,null))['catch'](handleError(_0x197047,null));};exports[_0x86d3('0x53')]=function(_0x416428,_0x15cdd0,_0x29bdee){return db[_0x86d3('0x26')][_0x86d3('0x39')]({'raw':![],'where':{'CampaignId':_0x416428[_0x86d3('0x44')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x86d3('0x49')],[db['sequelize']['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x4b')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x4d')))),_0x86d3('0x54')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x55')))),_0x86d3('0x4e')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db[_0x86d3('0x46')]['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x86d3('0x56')],[db[_0x86d3('0x46')]['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x57')))),_0x86d3('0x58')],[db['sequelize']['fn'](_0x86d3('0x4a'),db['sequelize']['fn']('IF',db[_0x86d3('0x46')][_0x86d3('0x47')](_0x86d3('0x50')))),_0x86d3('0x51')],[db[_0x86d3('0x46')]['fn']('COUNT',db[_0x86d3('0x46')]['fn']('IF',db['sequelize'][_0x86d3('0x47')](_0x86d3('0x52')))),'answeringMachine']]})[_0x86d3('0x20')](handleEntityNotFound(_0x15cdd0,null))[_0x86d3('0x20')](respondWithResult(_0x15cdd0,null))[_0x86d3('0x40')](handleError(_0x15cdd0,null));};exports[_0x86d3('0x59')]=function(_0x308fed,_0x1c966a,_0x379799){return db['VoiceQueue'][_0x86d3('0x43')]({'where':{'id':_0x308fed[_0x86d3('0x44')]['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x1c966a,null))[_0x86d3('0x20')](function(_0x46e356){var _0x47f72e;if(_0x46e356){_0x47f72e=squel[_0x86d3('0x5a')]()[_0x86d3('0x5b')]('cm_hopper')[_0x86d3('0x5c')]([_0x86d3('0x5d'),_0x86d3('0x5e'),_0x86d3('0x5f'),_0x86d3('0x60'),_0x86d3('0x61'),_0x86d3('0x62'),_0x86d3('0x63')],squel[_0x86d3('0x64')]()[_0x86d3('0x65')](_0x86d3('0x66'),_0x86d3('0x5d'))[_0x86d3('0x65')](_0x86d3('0x67'),'scheduledAt')[_0x86d3('0x65')](_0x86d3('0x68'),_0x86d3('0x5f'))[_0x86d3('0x65')]('ANY_VALUE(ListId)',_0x86d3('0x60'))[_0x86d3('0x65')](_0x86d3('0x69'),_0x86d3('0x61'))['field']('NOW()',_0x86d3('0x62'))['field'](_0x86d3('0x67'),'updatedAt')['from'](_0x86d3('0x6a'))[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]())['where'](_0x86d3('0x6d'),_0x308fed[_0x86d3('0x41')]['state'][_0x86d3('0x6c')]())[_0x86d3('0x32')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x86d3('0x32')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x86d3('0x64')]()['field']('phone')[_0x86d3('0x6e')]('cm_hopper')[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]()))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()[_0x86d3('0x65')]('calleridnum')[_0x86d3('0x6e')](_0x86d3('0x6a'))[_0x86d3('0x32')](_0x86d3('0x6b'),_0x308fed[_0x86d3('0x44')]['id']['toString']())[_0x86d3('0x32')](_0x86d3('0x70')))[_0x86d3('0x71')](_0x86d3('0x5f')))[_0x86d3('0x6c')]();return db[_0x86d3('0x46')][_0x86d3('0x2b')](_0x47f72e);}return[];})['then'](respondWithResult(_0x1c966a,null))[_0x86d3('0x40')](handleError(_0x1c966a,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0xca2e0,_0x596b1d,_0x5a22ca){return db[_0x86d3('0x72')][_0x86d3('0x43')]({'where':{'id':_0xca2e0['params']['id']}})[_0x86d3('0x20')](handleEntityNotFound(_0x596b1d,null))[_0x86d3('0x20')](function(_0x879a8b){var _0x1c1384;if(_0x879a8b){_0x1c1384=squel[_0x86d3('0x5a')]()[_0x86d3('0x5b')](_0x86d3('0x73'))['fromQuery'](['phone',_0x86d3('0x5e'),_0x86d3('0x5f'),_0x86d3('0x60'),_0x86d3('0x74'),_0x86d3('0x62'),_0x86d3('0x63')],squel['select']()[_0x86d3('0x65')](_0x86d3('0x66'),_0x86d3('0x5d'))[_0x86d3('0x65')](_0x86d3('0x67'),_0x86d3('0x5e'))[_0x86d3('0x65')](_0x86d3('0x68'),_0x86d3('0x5f'))['field'](_0x86d3('0x75'),_0x86d3('0x60'))['field']('ANY_VALUE(CampaignId)',_0x86d3('0x74'))[_0x86d3('0x65')](_0x86d3('0x67'),'createdAt')[_0x86d3('0x65')](_0x86d3('0x67'),_0x86d3('0x63'))[_0x86d3('0x6e')](_0x86d3('0x6a'))['where'](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id']['toString']())[_0x86d3('0x32')](_0x86d3('0x6d'),_0xca2e0[_0x86d3('0x41')][_0x86d3('0x77')]['toString']())[_0x86d3('0x32')](_0x86d3('0x78'))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()['field'](_0x86d3('0x5d'))[_0x86d3('0x6e')](_0x86d3('0x73'))[_0x86d3('0x32')](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]()))[_0x86d3('0x32')](_0x86d3('0x6f'),squel[_0x86d3('0x64')]()['field']('calleridnum')[_0x86d3('0x6e')](_0x86d3('0x6a'))['where'](_0x86d3('0x76'),_0xca2e0[_0x86d3('0x44')]['id'][_0x86d3('0x6c')]())[_0x86d3('0x32')](_0x86d3('0x70')))[_0x86d3('0x71')](_0x86d3('0x5f')))[_0x86d3('0x6c')]();return db[_0x86d3('0x46')]['query'](_0x1c1384);}return[];})['then'](respondWithResult(_0x596b1d,null))['catch'](handleError(_0x596b1d,null));};exports['checkContactHopper']=function(_0xad83bf,_0x2514c1,_0x28a509){return db[_0x86d3('0x79')][_0x86d3('0x7a')]({'where':{'VoiceQueueId':_0xad83bf[_0x86d3('0x41')][_0x86d3('0x61')],'CampaignId':_0xad83bf['body'][_0x86d3('0x74')],'ContactId':_0xad83bf[_0x86d3('0x41')][_0x86d3('0x5f')]}})[_0x86d3('0x20')](handleEntityNotFound(_0x2514c1,null))['then'](function(_0xe239b5){if(_0xe239b5){return _0xe239b5;}return null;})['then'](respondWithResult(_0x2514c1,null))[_0x86d3('0x40')](handleError(_0x2514c1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index e12c204..95012c9 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 _0x5fea=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','api','moment','bluebird','request-promise','./cmHopperFinal.attributes','exports','define'];(function(_0x4e2839,_0xd8392d){var _0x4ee2c9=function(_0x548f87){while(--_0x548f87){_0x4e2839['push'](_0x4e2839['shift']());}};_0x4ee2c9(++_0xd8392d);}(_0x5fea,0x1be));var _0xa5fe=function(_0x175a55,_0x4082fd){_0x175a55=_0x175a55-0x0;var _0x167adf=_0x5fea[_0x175a55];return _0x167adf;};'use strict';var _=require(_0xa5fe('0x0'));var util=require(_0xa5fe('0x1'));var logger=require('../../config/logger')(_0xa5fe('0x2'));var moment=require(_0xa5fe('0x3'));var BPromise=require(_0xa5fe('0x4'));var rp=require(_0xa5fe('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa5fe('0x6'));module[_0xa5fe('0x7')]=function(_0x5521ac,_0x5f6ada){return _0x5521ac[_0xa5fe('0x8')](_0xa5fe('0x9'),attributes,{'tableName':_0xa5fe('0xa'),'paranoid':![],'indexes':[{'name':_0xa5fe('0xb'),'fields':[_0xa5fe('0xb')]},{'name':_0xa5fe('0xc'),'fields':[_0xa5fe('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xee19=['exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xee19,0xef));var _0x9ee1=function(_0x808637,_0x3b9e91){_0x808637=_0x808637-0x0;var _0x3de970=_0xee19[_0x808637];return _0x3de970;};'use strict';var _=require('lodash');var util=require(_0x9ee1('0x0'));var logger=require('../../config/logger')(_0x9ee1('0x1'));var moment=require(_0x9ee1('0x2'));var BPromise=require(_0x9ee1('0x3'));var rp=require(_0x9ee1('0x4'));var fs=require('fs');var path=require(_0x9ee1('0x5'));var rimraf=require(_0x9ee1('0x6'));var config=require(_0x9ee1('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0x9ee1('0x8')]=function(_0x1067b3,_0x250918){return _0x1067b3['define'](_0x9ee1('0x9'),attributes,{'tableName':_0x9ee1('0xa'),'paranoid':![],'indexes':[{'name':_0x9ee1('0xb'),'fields':[_0x9ee1('0xb')]},{'name':_0x9ee1('0xc'),'fields':[_0x9ee1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 170d738..b867db2 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(_0x4f75dc,_0x361d82){var _0xef97d5=function(_0x5bd1c3){while(--_0x5bd1c3){_0x4f75dc['push'](_0x4f75dc['shift']());}};_0xef97d5(++_0x361d82);}(_0xb10b,0x12a));var _0xbb10=function(_0x196ce1,_0x46e836){_0x196ce1=_0x196ce1-0x0;var _0x360a64=_0xb10b[_0x196ce1];return _0x360a64;};'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(_0x14bb88,_0x2dbc45){var _0x257ba1=function(_0x90527a){while(--_0x90527a){_0x14bb88['push'](_0x14bb88['shift']());}};_0x257ba1(++_0x2dbc45);}(_0xb10b,0x12a));var _0xbb10=function(_0x18175b,_0x4d7376){_0x18175b=_0x18175b-0x0;var _0x210d45=_0xb10b[_0x18175b];return _0x210d45;};'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 e6bb068..7e11389 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 _0x6177=['index','/describe','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0x6177,0xf8));var _0x7617=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x6177[_0x9cd4c3];return _0x4c9025;};'use strict';var multer=require(_0x7617('0x0'));var util=require(_0x7617('0x1'));var path=require(_0x7617('0x2'));var timeout=require(_0x7617('0x3'));var express=require(_0x7617('0x4'));var router=express[_0x7617('0x5')]();var fs_extra=require(_0x7617('0x6'));var auth=require(_0x7617('0x7'));var interaction=require(_0x7617('0x8'));var config=require(_0x7617('0x9'));var controller=require(_0x7617('0xa'));router[_0x7617('0xb')]('/',auth[_0x7617('0xc')](),controller[_0x7617('0xd')]);router[_0x7617('0xb')](_0x7617('0xe'),auth[_0x7617('0xc')](),controller[_0x7617('0xf')]);router[_0x7617('0xb')]('/:id',auth[_0x7617('0xc')](),controller[_0x7617('0x10')]);router['get'](_0x7617('0x11'),auth[_0x7617('0xc')](),controller[_0x7617('0x12')]);router[_0x7617('0xb')]('/campaign/countAttributes/:id',auth[_0x7617('0xc')](),controller[_0x7617('0x13')]);router[_0x7617('0x14')](_0x7617('0x15'),auth[_0x7617('0xc')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x7617('0x14')](_0x7617('0x16'),auth[_0x7617('0xc')](),controller[_0x7617('0x17')]);router[_0x7617('0x14')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0x7617('0x18')]);router[_0x7617('0x19')](_0x7617('0x1a'),auth[_0x7617('0xc')](),controller[_0x7617('0x1b')]);module[_0x7617('0x1c')]=router; \ No newline at end of file +var _0x48ae=['update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put'];(function(_0x1bd62c,_0x4316bf){var _0x4686d8=function(_0x596f81){while(--_0x596f81){_0x1bd62c['push'](_0x1bd62c['shift']());}};_0x4686d8(++_0x4316bf);}(_0x48ae,0xd2));var _0xe48a=function(_0x13e6f1,_0x438272){_0x13e6f1=_0x13e6f1-0x0;var _0x36eee0=_0x48ae[_0x13e6f1];return _0x36eee0;};'use strict';var multer=require(_0xe48a('0x0'));var util=require(_0xe48a('0x1'));var path=require(_0xe48a('0x2'));var timeout=require(_0xe48a('0x3'));var express=require(_0xe48a('0x4'));var router=express[_0xe48a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe48a('0x6'));var interaction=require(_0xe48a('0x7'));var config=require(_0xe48a('0x8'));var controller=require('./cmHopperFinal.controller');router[_0xe48a('0x9')]('/',auth[_0xe48a('0xa')](),controller[_0xe48a('0xb')]);router[_0xe48a('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe48a('0xc')]);router[_0xe48a('0x9')](_0xe48a('0xd'),auth['isAuthenticated'](),controller[_0xe48a('0xe')]);router[_0xe48a('0x9')](_0xe48a('0xf'),auth['isAuthenticated'](),controller[_0xe48a('0x10')]);router['get'](_0xe48a('0x11'),auth[_0xe48a('0xa')](),controller['countContactsIvrCampaignHopperFinal']);router[_0xe48a('0x12')](_0xe48a('0x13'),auth[_0xe48a('0xa')](),controller[_0xe48a('0x14')]);router[_0xe48a('0x12')]('/voice/campaign/moveContacts/:id',auth[_0xe48a('0xa')](),controller[_0xe48a('0x15')]);router['post'](_0xe48a('0x16'),auth[_0xe48a('0xa')](),controller['checkContactHopper']);router[_0xe48a('0x17')](_0xe48a('0xd'),auth[_0xe48a('0xa')](),controller[_0xe48a('0x18')]);module[_0xe48a('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index a383b42..31f5337 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 _0x605a=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x3b9f0d,_0x8720a0){var _0xe901e3=function(_0x578d3f){while(--_0x578d3f){_0x3b9f0d['push'](_0x3b9f0d['shift']());}};_0xe901e3(++_0x8720a0);}(_0x605a,0x126));var _0xa605=function(_0x288f1a,_0x2cfc64){_0x288f1a=_0x288f1a-0x0;var _0x5cacb3=_0x605a[_0x288f1a];return _0x5cacb3;};'use strict';var Sequelize=require(_0xa605('0x0'));module[_0xa605('0x1')]={'state':{'type':Sequelize[_0xa605('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xa605('0x3')]},'scheduledat':{'type':Sequelize[_0xa605('0x4')]},'countbusyretry':{'type':Sequelize[_0xa605('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa605('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xa605('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa605('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xa605('0x3')]},'originatecalleridname':{'type':Sequelize[_0xa605('0x3')]},'calleridnum':{'type':Sequelize[_0xa605('0x3')]},'calleridname':{'type':Sequelize[_0xa605('0x3')]},'starttime':{'type':Sequelize[_0xa605('0x4')]},'responsetime':{'type':Sequelize[_0xa605('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xa605('0x4')]},'endtime':{'type':Sequelize[_0xa605('0x4')]},'ringtime':{'type':Sequelize[_0xa605('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa605('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xa605('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xa605('0x3')]},'campaigntype':{'type':Sequelize[_0xa605('0x3')]},'membername':{'type':Sequelize[_0xa605('0x3')]},'reason':{'type':Sequelize[_0xa605('0x3')]},'amd':{'type':Sequelize[_0xa605('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xa605('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xa605('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa605('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa605('0x4')]},'recallme':{'type':Sequelize[_0xa605('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xa605('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa605('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa605('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa605('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa605('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xa605('0x3')]}}; \ No newline at end of file +var _0x3330=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x4dd773,_0x22fbb0){var _0x47bc88=function(_0x4af281){while(--_0x4af281){_0x4dd773['push'](_0x4dd773['shift']());}};_0x47bc88(++_0x22fbb0);}(_0x3330,0x1b5));var _0x0333=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x3330[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0x0333('0x0'));module[_0x0333('0x1')]={'state':{'type':Sequelize[_0x0333('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x0333('0x3')]},'scheduledat':{'type':Sequelize[_0x0333('0x4')]},'countbusyretry':{'type':Sequelize[_0x0333('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0333('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0333('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0333('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0333('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x0333('0x3')]},'originatecalleridname':{'type':Sequelize[_0x0333('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x0333('0x4')]},'responsetime':{'type':Sequelize[_0x0333('0x4')]},'answertime':{'type':Sequelize[_0x0333('0x4')]},'droptime':{'type':Sequelize[_0x0333('0x4')]},'endtime':{'type':Sequelize[_0x0333('0x4')]},'ringtime':{'type':Sequelize[_0x0333('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0333('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0333('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0333('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0333('0x3')]},'campaign':{'type':Sequelize[_0x0333('0x3')]},'campaigntype':{'type':Sequelize[_0x0333('0x3')]},'membername':{'type':Sequelize[_0x0333('0x3')]},'reason':{'type':Sequelize[_0x0333('0x3')]},'amd':{'type':Sequelize[_0x0333('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x0333('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0333('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x0333('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x0333('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0333('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0333('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0333('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0333('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 255aec9..e7a41e8 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 _0xf7a7=['options','include','findAll','rows','catch','show','params','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','reject','update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','filter','merge'];(function(_0x5a2192,_0x41edfd){var _0x36906a=function(_0x1b9bb2){while(--_0x1b9bb2){_0x5a2192['push'](_0x5a2192['shift']());}};_0x36906a(++_0x41edfd);}(_0xf7a7,0xa3));var _0x7f7a=function(_0x44a880,_0x558efb){_0x44a880=_0x44a880-0x0;var _0x38ec0a=_0xf7a7[_0x44a880];return _0x38ec0a;};'use strict';var emlformat=require(_0x7f7a('0x0'));var rimraf=require(_0x7f7a('0x1'));var zipdir=require(_0x7f7a('0x2'));var jsonpatch=require(_0x7f7a('0x3'));var rp=require(_0x7f7a('0x4'));var moment=require(_0x7f7a('0x5'));var BPromise=require(_0x7f7a('0x6'));var Mustache=require(_0x7f7a('0x7'));var util=require(_0x7f7a('0x8'));var path=require(_0x7f7a('0x9'));var sox=require('sox');var csv=require(_0x7f7a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f7a('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7f7a('0xc'));var jsforce=require(_0x7f7a('0xd'));var deskjs=require(_0x7f7a('0xe'));var toCsv=require(_0x7f7a('0xa'));var querystring=require(_0x7f7a('0xf'));var Papa=require(_0x7f7a('0x10'));var Redis=require('ioredis');var authService=require(_0x7f7a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7f7a('0x12'));var hardwareService=require(_0x7f7a('0x13'));var logger=require(_0x7f7a('0x14'))(_0x7f7a('0x15'));var utils=require(_0x7f7a('0x16'));var config=require(_0x7f7a('0x17'));var licenseUtil=require(_0x7f7a('0x18'));var db=require(_0x7f7a('0x19'))['db'];function respondWithStatusCode(_0x8643d5,_0x2c41e2){_0x2c41e2=_0x2c41e2||0xcc;return function(_0x49aeb4){if(_0x49aeb4){return _0x8643d5[_0x7f7a('0x1a')](_0x2c41e2);}return _0x8643d5[_0x7f7a('0x1b')](_0x2c41e2)[_0x7f7a('0x1c')]();};}function respondWithResult(_0x1d7974,_0x1a0e2b){_0x1a0e2b=_0x1a0e2b||0xc8;return function(_0x33a4da){if(_0x33a4da){return _0x1d7974[_0x7f7a('0x1b')](_0x1a0e2b)['json'](_0x33a4da);}};}function respondWithFilteredResult(_0x1cf196,_0x156958){return function(_0x5f56fc){if(_0x5f56fc){var _0x43fba0=typeof _0x156958[_0x7f7a('0x1d')]===_0x7f7a('0x1e')&&typeof _0x156958['limit']===_0x7f7a('0x1e');var _0x41ee48=_0x5f56fc[_0x7f7a('0x1f')];var _0x202723=_0x43fba0?0x0:_0x156958[_0x7f7a('0x1d')];var _0x223da3=_0x43fba0?_0x5f56fc[_0x7f7a('0x1f')]:_0x156958[_0x7f7a('0x1d')]+_0x156958['limit'];var _0x8f815c;if(_0x223da3>=_0x41ee48){_0x223da3=_0x41ee48;_0x8f815c=0xc8;}else{_0x8f815c=0xce;}_0x1cf196[_0x7f7a('0x1b')](_0x8f815c);return _0x1cf196[_0x7f7a('0x20')](_0x7f7a('0x21'),_0x202723+'-'+_0x223da3+'/'+_0x41ee48)[_0x7f7a('0x22')](_0x5f56fc);}return null;};}function patchUpdates(_0x404cb2){return function(_0x4a2086){try{jsonpatch['apply'](_0x4a2086,_0x404cb2,!![]);}catch(_0x4afb18){return BPromise[_0x7f7a('0x23')](_0x4afb18);}return _0x4a2086['save']();};}function saveUpdates(_0x2e79da,_0x38ec90){return function(_0x4f2b09){if(_0x4f2b09){return _0x4f2b09[_0x7f7a('0x24')](_0x2e79da)[_0x7f7a('0x25')](function(_0xb5e8a9){return _0xb5e8a9;});}return null;};}function removeEntity(_0x5df9f0,_0xfe85f9){return function(_0x450c6b){if(_0x450c6b){return _0x450c6b[_0x7f7a('0x26')]()[_0x7f7a('0x25')](function(){_0x5df9f0['status'](0xcc)[_0x7f7a('0x1c')]();});}};}function handleEntityNotFound(_0x45a423,_0x3cbb40){return function(_0x590f01){if(!_0x590f01){_0x45a423[_0x7f7a('0x1a')](0x194);}return _0x590f01;};}function handleError(_0x5c14b1,_0x451bbb){_0x451bbb=_0x451bbb||0x1f4;return function(_0x297769){logger[_0x7f7a('0x27')](_0x297769[_0x7f7a('0x28')]);if(_0x297769[_0x7f7a('0x29')]){delete _0x297769[_0x7f7a('0x29')];}_0x5c14b1[_0x7f7a('0x1b')](_0x451bbb)[_0x7f7a('0x2a')](_0x297769);};}exports[_0x7f7a('0x2b')]=function(_0x2619f0,_0x21e78c){var _0x3d78ca={},_0x8f7ed6={},_0xebea29={'count':0x0,'rows':[]};var _0x151895=_[_0x7f7a('0x2c')](db[_0x7f7a('0x2d')][_0x7f7a('0x2e')],function(_0x44da78){return{'name':_0x44da78[_0x7f7a('0x2f')],'type':_0x44da78[_0x7f7a('0x30')][_0x7f7a('0x31')]};});_0x8f7ed6[_0x7f7a('0x32')]=_[_0x7f7a('0x2c')](_0x151895,_0x7f7a('0x29'));_0x8f7ed6[_0x7f7a('0x33')]=_[_0x7f7a('0x34')](_0x2619f0[_0x7f7a('0x33')]);_0x8f7ed6['filters']=_[_0x7f7a('0x35')](_0x8f7ed6['model'],_0x8f7ed6['query']);_0x3d78ca[_0x7f7a('0x36')]=_['intersection'](_0x8f7ed6[_0x7f7a('0x32')],qs[_0x7f7a('0x37')](_0x2619f0[_0x7f7a('0x33')][_0x7f7a('0x37')]));_0x3d78ca[_0x7f7a('0x36')]=_0x3d78ca[_0x7f7a('0x36')][_0x7f7a('0x38')]?_0x3d78ca[_0x7f7a('0x36')]:_0x8f7ed6['model'];if(!_0x2619f0[_0x7f7a('0x33')]['hasOwnProperty'](_0x7f7a('0x39'))){_0x3d78ca['limit']=qs['limit'](_0x2619f0['query'][_0x7f7a('0x3a')]);_0x3d78ca[_0x7f7a('0x1d')]=qs['offset'](_0x2619f0[_0x7f7a('0x33')][_0x7f7a('0x1d')]);}_0x3d78ca[_0x7f7a('0x3b')]=qs[_0x7f7a('0x3c')](_0x2619f0[_0x7f7a('0x33')][_0x7f7a('0x3c')]);_0x3d78ca[_0x7f7a('0x3d')]=qs[_0x7f7a('0x3e')](_['pick'](_0x2619f0[_0x7f7a('0x33')],_0x8f7ed6[_0x7f7a('0x3e')]),_0x151895);if(_0x2619f0[_0x7f7a('0x33')][_0x7f7a('0x3f')]){_0x3d78ca['where']=_[_0x7f7a('0x40')](_0x3d78ca[_0x7f7a('0x3d')],{'$or':_['map'](_0x151895,function(_0x44055a){if(_0x44055a['type']!=='VIRTUAL'){var _0x33b41a={};_0x33b41a[_0x44055a[_0x7f7a('0x29')]]={'$like':'%'+_0x2619f0['query'][_0x7f7a('0x3f')]+'%'};return _0x33b41a;}})});}_0x3d78ca=_[_0x7f7a('0x40')]({},_0x3d78ca,_0x2619f0[_0x7f7a('0x41')]);var _0x1346d5={'where':_0x3d78ca[_0x7f7a('0x3d')]};return db[_0x7f7a('0x2d')][_0x7f7a('0x1f')](_0x1346d5)[_0x7f7a('0x25')](function(_0x1155e7){_0xebea29[_0x7f7a('0x1f')]=_0x1155e7;if(_0x2619f0['query']['includeAll']){_0x3d78ca[_0x7f7a('0x42')]=[{'all':!![]}];}return db[_0x7f7a('0x2d')][_0x7f7a('0x43')](_0x3d78ca);})[_0x7f7a('0x25')](function(_0x3f4a96){_0xebea29[_0x7f7a('0x44')]=_0x3f4a96;return _0xebea29;})['then'](respondWithFilteredResult(_0x21e78c,_0x3d78ca))[_0x7f7a('0x45')](handleError(_0x21e78c,null));};exports[_0x7f7a('0x46')]=function(_0x230bf9,_0x512a17){var _0x43742={'raw':!![],'where':{'id':_0x230bf9[_0x7f7a('0x47')]['id']}},_0x8a0f55={};_0x8a0f55[_0x7f7a('0x32')]=_[_0x7f7a('0x34')](db[_0x7f7a('0x2d')][_0x7f7a('0x2e')]);_0x8a0f55[_0x7f7a('0x33')]=_[_0x7f7a('0x34')](_0x230bf9[_0x7f7a('0x33')]);_0x8a0f55[_0x7f7a('0x3e')]=_['intersection'](_0x8a0f55[_0x7f7a('0x32')],_0x8a0f55[_0x7f7a('0x33')]);_0x43742[_0x7f7a('0x36')]=_[_0x7f7a('0x35')](_0x8a0f55[_0x7f7a('0x32')],qs[_0x7f7a('0x37')](_0x230bf9[_0x7f7a('0x33')][_0x7f7a('0x37')]));_0x43742[_0x7f7a('0x36')]=_0x43742['attributes'][_0x7f7a('0x38')]?_0x43742[_0x7f7a('0x36')]:_0x8a0f55[_0x7f7a('0x32')];if(_0x230bf9['query']['includeAll']){_0x43742[_0x7f7a('0x42')]=[{'all':!![]}];}_0x43742=_['merge']({},_0x43742,_0x230bf9[_0x7f7a('0x41')]);return db[_0x7f7a('0x2d')]['find'](_0x43742)[_0x7f7a('0x25')](handleEntityNotFound(_0x512a17,null))[_0x7f7a('0x25')](respondWithResult(_0x512a17,null))[_0x7f7a('0x45')](handleError(_0x512a17,null));};exports['create']=function(_0x5e464d,_0x5b7df5){return db['CmHopperHistory']['create'](_0x5e464d[_0x7f7a('0x48')],{})[_0x7f7a('0x25')](respondWithResult(_0x5b7df5,0xc9))['catch'](handleError(_0x5b7df5,null));};exports[_0x7f7a('0x49')]=function(_0x1baf49,_0x59d395){return db[_0x7f7a('0x2d')][_0x7f7a('0x49')]()[_0x7f7a('0x25')](respondWithResult(_0x59d395,null))[_0x7f7a('0x45')](handleError(_0x59d395,null));};exports[_0x7f7a('0x24')]=function(_0x161f42,_0x2ecdaa){if(_0x161f42[_0x7f7a('0x48')][_0x7f7a('0x4a')]){delete _0x161f42['body']['uniqueid'];}return db[_0x7f7a('0x2d')][_0x7f7a('0x4b')]({'where':{'uniqueid':_0x161f42[_0x7f7a('0x47')]['id']}})[_0x7f7a('0x25')](handleEntityNotFound(_0x2ecdaa,null))[_0x7f7a('0x25')](saveUpdates(_0x161f42['body'],null))[_0x7f7a('0x25')](respondWithResult(_0x2ecdaa,null))[_0x7f7a('0x45')](handleError(_0x2ecdaa,null));}; \ No newline at end of file +var _0x359d=['apply','reject','update','then','error','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','catch','show','create','describe','body','uniqueid','find','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range'];(function(_0x47c2f4,_0x4ebdae){var _0x53b877=function(_0x4a7c21){while(--_0x4a7c21){_0x47c2f4['push'](_0x47c2f4['shift']());}};_0x53b877(++_0x4ebdae);}(_0x359d,0x6f));var _0xd359=function(_0x1d1963,_0x32cc0e){_0x1d1963=_0x1d1963-0x0;var _0x3f58bb=_0x359d[_0x1d1963];return _0x3f58bb;};'use strict';var emlformat=require(_0xd359('0x0'));var rimraf=require(_0xd359('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd359('0x2'));var moment=require('moment');var BPromise=require(_0xd359('0x3'));var Mustache=require(_0xd359('0x4'));var util=require(_0xd359('0x5'));var path=require(_0xd359('0x6'));var sox=require(_0xd359('0x7'));var csv=require(_0xd359('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd359('0x9'));var _=require(_0xd359('0xa'));var squel=require(_0xd359('0xb'));var crypto=require(_0xd359('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd359('0x8'));var querystring=require(_0xd359('0xd'));var Papa=require(_0xd359('0xe'));var Redis=require(_0xd359('0xf'));var authService=require(_0xd359('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd359('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd359('0x12'))(_0xd359('0x13'));var utils=require(_0xd359('0x14'));var config=require(_0xd359('0x15'));var licenseUtil=require(_0xd359('0x16'));var db=require(_0xd359('0x17'))['db'];function respondWithStatusCode(_0xd3000c,_0x55bda0){_0x55bda0=_0x55bda0||0xcc;return function(_0x105f10){if(_0x105f10){return _0xd3000c[_0xd359('0x18')](_0x55bda0);}return _0xd3000c[_0xd359('0x19')](_0x55bda0)[_0xd359('0x1a')]();};}function respondWithResult(_0x30b92b,_0x5d7641){_0x5d7641=_0x5d7641||0xc8;return function(_0xb0403a){if(_0xb0403a){return _0x30b92b['status'](_0x5d7641)[_0xd359('0x1b')](_0xb0403a);}};}function respondWithFilteredResult(_0x3b8709,_0x1cbdf7){return function(_0x10167f){if(_0x10167f){var _0x59a759=typeof _0x1cbdf7[_0xd359('0x1c')]===_0xd359('0x1d')&&typeof _0x1cbdf7[_0xd359('0x1e')]===_0xd359('0x1d');var _0x33bd55=_0x10167f[_0xd359('0x1f')];var _0xad5d0=_0x59a759?0x0:_0x1cbdf7[_0xd359('0x1c')];var _0x363ee6=_0x59a759?_0x10167f[_0xd359('0x1f')]:_0x1cbdf7[_0xd359('0x1c')]+_0x1cbdf7[_0xd359('0x1e')];var _0x1b9a70;if(_0x363ee6>=_0x33bd55){_0x363ee6=_0x33bd55;_0x1b9a70=0xc8;}else{_0x1b9a70=0xce;}_0x3b8709[_0xd359('0x19')](_0x1b9a70);return _0x3b8709['set'](_0xd359('0x20'),_0xad5d0+'-'+_0x363ee6+'/'+_0x33bd55)['json'](_0x10167f);}return null;};}function patchUpdates(_0x2fa03d){return function(_0x16387b){try{jsonpatch[_0xd359('0x21')](_0x16387b,_0x2fa03d,!![]);}catch(_0x8aa530){return BPromise[_0xd359('0x22')](_0x8aa530);}return _0x16387b['save']();};}function saveUpdates(_0x27fbb5,_0x3e0f5c){return function(_0x22418c){if(_0x22418c){return _0x22418c[_0xd359('0x23')](_0x27fbb5)[_0xd359('0x24')](function(_0x400683){return _0x400683;});}return null;};}function removeEntity(_0x4d9c84,_0xf8de5b){return function(_0x4a853a){if(_0x4a853a){return _0x4a853a['destroy']()[_0xd359('0x24')](function(){_0x4d9c84['status'](0xcc)[_0xd359('0x1a')]();});}};}function handleEntityNotFound(_0x1136af,_0x4eac29){return function(_0x5babc9){if(!_0x5babc9){_0x1136af[_0xd359('0x18')](0x194);}return _0x5babc9;};}function handleError(_0x9fbbc8,_0x51cf9f){_0x51cf9f=_0x51cf9f||0x1f4;return function(_0x389534){logger[_0xd359('0x25')](_0x389534['stack']);if(_0x389534[_0xd359('0x26')]){delete _0x389534[_0xd359('0x26')];}_0x9fbbc8[_0xd359('0x19')](_0x51cf9f)[_0xd359('0x27')](_0x389534);};}exports[_0xd359('0x28')]=function(_0x37dd97,_0x503977){var _0x176fc7={},_0x380ccd={},_0x3edb30={'count':0x0,'rows':[]};var _0xa46a49=_[_0xd359('0x29')](db[_0xd359('0x2a')][_0xd359('0x2b')],function(_0x1b436e){return{'name':_0x1b436e[_0xd359('0x2c')],'type':_0x1b436e['type']['key']};});_0x380ccd[_0xd359('0x2d')]=_[_0xd359('0x29')](_0xa46a49,_0xd359('0x26'));_0x380ccd[_0xd359('0x2e')]=_[_0xd359('0x2f')](_0x37dd97[_0xd359('0x2e')]);_0x380ccd[_0xd359('0x30')]=_[_0xd359('0x31')](_0x380ccd['model'],_0x380ccd[_0xd359('0x2e')]);_0x176fc7[_0xd359('0x32')]=_[_0xd359('0x31')](_0x380ccd[_0xd359('0x2d')],qs[_0xd359('0x33')](_0x37dd97['query'][_0xd359('0x33')]));_0x176fc7['attributes']=_0x176fc7['attributes'][_0xd359('0x34')]?_0x176fc7[_0xd359('0x32')]:_0x380ccd[_0xd359('0x2d')];if(!_0x37dd97[_0xd359('0x2e')]['hasOwnProperty'](_0xd359('0x35'))){_0x176fc7['limit']=qs[_0xd359('0x1e')](_0x37dd97[_0xd359('0x2e')][_0xd359('0x1e')]);_0x176fc7[_0xd359('0x1c')]=qs[_0xd359('0x1c')](_0x37dd97[_0xd359('0x2e')][_0xd359('0x1c')]);}_0x176fc7[_0xd359('0x36')]=qs[_0xd359('0x37')](_0x37dd97[_0xd359('0x2e')][_0xd359('0x37')]);_0x176fc7[_0xd359('0x38')]=qs[_0xd359('0x30')](_[_0xd359('0x39')](_0x37dd97[_0xd359('0x2e')],_0x380ccd[_0xd359('0x30')]),_0xa46a49);if(_0x37dd97[_0xd359('0x2e')]['filter']){_0x176fc7[_0xd359('0x38')]=_[_0xd359('0x3a')](_0x176fc7[_0xd359('0x38')],{'$or':_[_0xd359('0x29')](_0xa46a49,function(_0x49a880){if(_0x49a880[_0xd359('0x3b')]!=='VIRTUAL'){var _0x5daea8={};_0x5daea8[_0x49a880['name']]={'$like':'%'+_0x37dd97[_0xd359('0x2e')][_0xd359('0x3c')]+'%'};return _0x5daea8;}})});}_0x176fc7=_[_0xd359('0x3a')]({},_0x176fc7,_0x37dd97[_0xd359('0x3d')]);var _0x5707e5={'where':_0x176fc7[_0xd359('0x38')]};return db[_0xd359('0x2a')]['count'](_0x5707e5)[_0xd359('0x24')](function(_0xf98f8c){_0x3edb30[_0xd359('0x1f')]=_0xf98f8c;if(_0x37dd97['query'][_0xd359('0x3e')]){_0x176fc7[_0xd359('0x3f')]=[{'all':!![]}];}return db[_0xd359('0x2a')][_0xd359('0x40')](_0x176fc7);})[_0xd359('0x24')](function(_0x1dfa70){_0x3edb30['rows']=_0x1dfa70;return _0x3edb30;})['then'](respondWithFilteredResult(_0x503977,_0x176fc7))[_0xd359('0x41')](handleError(_0x503977,null));};exports[_0xd359('0x42')]=function(_0x4071df,_0x524bca){var _0x57697d={'raw':!![],'where':{'id':_0x4071df['params']['id']}},_0x23bd30={};_0x23bd30[_0xd359('0x2d')]=_['keys'](db[_0xd359('0x2a')][_0xd359('0x2b')]);_0x23bd30[_0xd359('0x2e')]=_[_0xd359('0x2f')](_0x4071df['query']);_0x23bd30[_0xd359('0x30')]=_['intersection'](_0x23bd30[_0xd359('0x2d')],_0x23bd30[_0xd359('0x2e')]);_0x57697d[_0xd359('0x32')]=_[_0xd359('0x31')](_0x23bd30[_0xd359('0x2d')],qs[_0xd359('0x33')](_0x4071df[_0xd359('0x2e')]['fields']));_0x57697d['attributes']=_0x57697d[_0xd359('0x32')][_0xd359('0x34')]?_0x57697d['attributes']:_0x23bd30['model'];if(_0x4071df[_0xd359('0x2e')]['includeAll']){_0x57697d[_0xd359('0x3f')]=[{'all':!![]}];}_0x57697d=_[_0xd359('0x3a')]({},_0x57697d,_0x4071df[_0xd359('0x3d')]);return db[_0xd359('0x2a')]['find'](_0x57697d)[_0xd359('0x24')](handleEntityNotFound(_0x524bca,null))[_0xd359('0x24')](respondWithResult(_0x524bca,null))['catch'](handleError(_0x524bca,null));};exports[_0xd359('0x43')]=function(_0x4776e8,_0x2dccce){return db['CmHopperHistory'][_0xd359('0x43')](_0x4776e8['body'],{})[_0xd359('0x24')](respondWithResult(_0x2dccce,0xc9))[_0xd359('0x41')](handleError(_0x2dccce,null));};exports[_0xd359('0x44')]=function(_0x2db749,_0x1f1dba){return db[_0xd359('0x2a')][_0xd359('0x44')]()[_0xd359('0x24')](respondWithResult(_0x1f1dba,null))[_0xd359('0x41')](handleError(_0x1f1dba,null));};exports['update']=function(_0xfcf5e3,_0x772dad){if(_0xfcf5e3[_0xd359('0x45')][_0xd359('0x46')]){delete _0xfcf5e3[_0xd359('0x45')][_0xd359('0x46')];}return db[_0xd359('0x2a')][_0xd359('0x47')]({'where':{'uniqueid':_0xfcf5e3['params']['id']}})[_0xd359('0x24')](handleEntityNotFound(_0x772dad,null))['then'](saveUpdates(_0xfcf5e3[_0xd359('0x45')],null))[_0xd359('0x24')](respondWithResult(_0x772dad,null))['catch'](handleError(_0x772dad,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 6412ad6..5765ab4 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 _0x8952=['api','moment','bluebird','path','rimraf','../../config/environment','exports','cm_hopper_history','endtime','uniqueid','util','../../config/logger'];(function(_0xd9dcf,_0xba9733){var _0xb72f0=function(_0x226cc4){while(--_0x226cc4){_0xd9dcf['push'](_0xd9dcf['shift']());}};_0xb72f0(++_0xba9733);}(_0x8952,0x17e));var _0x2895=function(_0x4b797b,_0x57578f){_0x4b797b=_0x4b797b-0x0;var _0x542dec=_0x8952[_0x4b797b];return _0x542dec;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var logger=require(_0x2895('0x1'))(_0x2895('0x2'));var moment=require(_0x2895('0x3'));var BPromise=require(_0x2895('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2895('0x5'));var rimraf=require(_0x2895('0x6'));var config=require(_0x2895('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0x2895('0x8')]=function(_0x73c245,_0x37305b){return _0x73c245['define']('CmHopperHistory',attributes,{'tableName':_0x2895('0x9'),'paranoid':![],'indexes':[{'name':_0x2895('0xa'),'fields':[_0x2895('0xa')]},{'name':_0x2895('0xb'),'fields':[_0x2895('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x905a=['request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','bluebird'];(function(_0x49b932,_0x49c8d2){var _0x55b0b9=function(_0x137573){while(--_0x137573){_0x49b932['push'](_0x49b932['shift']());}};_0x55b0b9(++_0x49c8d2);}(_0x905a,0xeb));var _0xa905=function(_0x173a40,_0x1f84e4){_0x173a40=_0x173a40-0x0;var _0xef83d8=_0x905a[_0x173a40];return _0xef83d8;};'use strict';var _=require(_0xa905('0x0'));var util=require('util');var logger=require(_0xa905('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa905('0x2'));var rp=require(_0xa905('0x3'));var fs=require('fs');var path=require(_0xa905('0x4'));var rimraf=require(_0xa905('0x5'));var config=require(_0xa905('0x6'));var attributes=require(_0xa905('0x7'));module[_0xa905('0x8')]=function(_0x312150,_0x7667dd){return _0x312150[_0xa905('0x9')](_0xa905('0xa'),attributes,{'tableName':_0xa905('0xb'),'paranoid':![],'indexes':[{'name':_0xa905('0xc'),'fields':['endtime']},{'name':_0xa905('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index bb288c0..2432e88 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 _0x1841=['outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','GetCampaignHopperHistory','col','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperHistory','create','options','catch','AvgHandleTime','CmHopperHistory','findAll','raw','where','sequelize','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','COUNT','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null'];(function(_0x29d7e6,_0x328da1){var _0x5cf650=function(_0x2065f3){while(--_0x2065f3){_0x29d7e6['push'](_0x29d7e6['shift']());}};_0x5cf650(++_0x328da1);}(_0x1841,0xdf));var _0x1184=function(_0x211ae6,_0x49f5ae){_0x211ae6=_0x211ae6-0x0;var _0x337f44=_0x1841[_0x211ae6];return _0x337f44;};'use strict';var _=require('lodash');var util=require(_0x1184('0x0'));var moment=require(_0x1184('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1184('0x2'));var db=require(_0x1184('0x3'))['db'];var utils=require(_0x1184('0x4'));var logger=require(_0x1184('0x5'))(_0x1184('0x6'));var config=require('../../config/environment');var jayson=require(_0x1184('0x7'));var client=jayson[_0x1184('0x8')][_0x1184('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a7046,_0x122829,_0x4292f6){return new BPromise(function(_0x2e8a79,_0x18bc1b){return client[_0x1184('0xa')](_0x1a7046,_0x4292f6)[_0x1184('0xb')](function(_0x349460){logger[_0x1184('0xc')](_0x1184('0xd'),_0x122829,_0x1184('0xe'));logger[_0x1184('0xf')](_0x1184('0x10'),_0x122829,_0x1184('0xe'),JSON[_0x1184('0x11')](_0x349460));if(_0x349460[_0x1184('0x12')]){if(_0x349460['error'][_0x1184('0x13')]===0x1f4){logger[_0x1184('0x12')](_0x1184('0xd'),_0x122829,_0x349460[_0x1184('0x12')][_0x1184('0x14')]);return _0x18bc1b(_0x349460['error'][_0x1184('0x14')]);}logger[_0x1184('0x12')](_0x1184('0xd'),_0x122829,_0x349460['error']['message']);return _0x2e8a79(_0x349460[_0x1184('0x12')]['message']);}else{logger['info'](_0x1184('0xd'),_0x122829,_0x1184('0xe'));_0x2e8a79(_0x349460[_0x1184('0x15')][_0x1184('0x14')]);}})['catch'](function(_0x18d82a){logger[_0x1184('0x12')](_0x1184('0xd'),_0x122829,_0x18d82a);_0x18bc1b(_0x18d82a);});});}exports[_0x1184('0x16')]=function(_0x2ce3c0){var _0x5bf7e7=this;return new Promise(function(_0x1841d2,_0x1c42f8){return db['CmHopperHistory'][_0x1184('0x17')](_0x2ce3c0['body'],{'raw':_0x2ce3c0[_0x1184('0x18')]?_0x2ce3c0[_0x1184('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x1184('0xb')](function(_0x576306){logger[_0x1184('0xc')](_0x1184('0x16'),_0x2ce3c0);logger[_0x1184('0xf')](_0x1184('0x16'),_0x2ce3c0,JSON[_0x1184('0x11')](_0x576306));_0x1841d2(_0x576306);})[_0x1184('0x19')](function(_0x562f40){logger[_0x1184('0x12')](_0x1184('0x16'),_0x562f40['message'],_0x2ce3c0);_0x1c42f8(_0x5bf7e7['error'](0x1f4,_0x562f40['message']));});});};exports[_0x1184('0x1a')]=function(_0x250d9b){var _0x31b0d0=this;return new Promise(function(_0x202616,_0x4a60b4){return db[_0x1184('0x1b')][_0x1184('0x1c')]({'raw':_0x250d9b[_0x1184('0x18')]?_0x250d9b[_0x1184('0x18')][_0x1184('0x1d')]===undefined?!![]:![]:!![],'where':_0x250d9b[_0x1184('0x18')]?_0x250d9b['options'][_0x1184('0x1e')]||null:null,'attributes':[[db[_0x1184('0x1f')]['fn']('COUNT',db[_0x1184('0x1f')]['col']('id')),'predictiveIntervalTotalCalls'],[db[_0x1184('0x1f')]['fn']('COUNT',db[_0x1184('0x1f')]['fn']('IF',db[_0x1184('0x1f')][_0x1184('0x20')](_0x1184('0x21')))),_0x1184('0x22')],[db[_0x1184('0x1f')]['fn']('COUNT',db[_0x1184('0x1f')]['fn']('IF',db['sequelize'][_0x1184('0x20')](_0x1184('0x23')))),_0x1184('0x24')],[db['sequelize']['fn'](_0x1184('0x25'),db[_0x1184('0x1f')]['fn']('IF',db['sequelize'][_0x1184('0x20')](_0x1184('0x26')))),_0x1184('0x27')],[db[_0x1184('0x1f')]['fn'](_0x1184('0x28'),db[_0x1184('0x1f')]['fn']('IF',db['sequelize'][_0x1184('0x20')](_0x1184('0x29')))),_0x1184('0x2a')],[db[_0x1184('0x1f')]['fn'](_0x1184('0x28'),db[_0x1184('0x1f')]['fn']('IF',db['sequelize'][_0x1184('0x20')](_0x1184('0x2b')))),'predictiveIntervalAvgTalktime']]})[_0x1184('0xb')](function(_0x17e40e){logger[_0x1184('0xc')](_0x1184('0x1a'),_0x250d9b);logger[_0x1184('0xf')](_0x1184('0x1a'),_0x250d9b,JSON['stringify'](_0x17e40e));_0x202616(_0x17e40e);})[_0x1184('0x19')](function(_0x47578f){logger[_0x1184('0x12')](_0x1184('0x1a'),_0x47578f[_0x1184('0x14')],_0x250d9b);_0x4a60b4(_0x31b0d0[_0x1184('0x12')](0x1f4,_0x47578f[_0x1184('0x14')]));});});};exports[_0x1184('0x2c')]=function(_0x36e068){var _0x1fec1f=this;return new Promise(function(_0x35018e,_0x5297da){return db['CmHopperHistory'][_0x1184('0x1c')]({'raw':_0x36e068['options']?_0x36e068[_0x1184('0x18')][_0x1184('0x1d')]===undefined?!![]:![]:!![],'where':_0x36e068['options']?_0x36e068[_0x1184('0x18')]['where']||null:null,'attributes':[[_0x1184('0x2d'),_0x1184('0x2e')],[db[_0x1184('0x1f')]['fn']('COUNT',db[_0x1184('0x1f')]['fn']('IF',db[_0x1184('0x1f')]['literal'](_0x1184('0x2f')))),_0x1184('0x30')],[db[_0x1184('0x1f')]['fn'](_0x1184('0x25'),db['sequelize']['fn']('IF',db[_0x1184('0x1f')][_0x1184('0x20')](_0x1184('0x31')))),'outboundNoAnswerCallsDay'],[db['sequelize']['fn'](_0x1184('0x25'),db[_0x1184('0x1f')]['fn']('IF',db[_0x1184('0x1f')][_0x1184('0x20')](_0x1184('0x21')))),'outboundAnswerCallsDay'],[db[_0x1184('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1184('0x1f')][_0x1184('0x20')](_0x1184('0x32')))),_0x1184('0x33')],[db[_0x1184('0x1f')]['fn']('COUNT',db[_0x1184('0x1f')]['fn']('IF',db[_0x1184('0x1f')][_0x1184('0x20')](_0x1184('0x34')))),'outboundCongestionCallsDay'],[db[_0x1184('0x1f')]['fn'](_0x1184('0x25'),db[_0x1184('0x1f')]['fn']('IF',db[_0x1184('0x1f')][_0x1184('0x20')](_0x1184('0x35')))),_0x1184('0x36')],[db[_0x1184('0x1f')]['fn'](_0x1184('0x25'),db[_0x1184('0x1f')]['fn']('IF',db[_0x1184('0x1f')][_0x1184('0x20')](_0x1184('0x37')))),_0x1184('0x38')],[db[_0x1184('0x1f')]['fn'](_0x1184('0x25'),db[_0x1184('0x1f')]['fn']('IF',db[_0x1184('0x1f')][_0x1184('0x20')](_0x1184('0x39')))),_0x1184('0x3a')],[db[_0x1184('0x1f')]['fn'](_0x1184('0x25'),db[_0x1184('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x1184('0x3b')))),_0x1184('0x3c')],[db[_0x1184('0x1f')]['fn'](_0x1184('0x25'),db[_0x1184('0x1f')]['fn']('IF',db[_0x1184('0x1f')]['literal'](_0x1184('0x3d')))),_0x1184('0x3e')],[db[_0x1184('0x1f')]['fn']('COUNT',db[_0x1184('0x1f')]['fn']('IF',db[_0x1184('0x1f')]['literal'](_0x1184('0x3f')))),'outboundRejectCallsDay'],[db[_0x1184('0x1f')]['fn'](_0x1184('0x25'),db[_0x1184('0x1f')]['fn']('IF',db[_0x1184('0x1f')][_0x1184('0x20')](_0x1184('0x40')))),_0x1184('0x41')],[db[_0x1184('0x1f')]['fn']('COUNT',db[_0x1184('0x1f')]['fn']('IF',db[_0x1184('0x1f')]['literal'](_0x1184('0x42')))),_0x1184('0x43')],[db[_0x1184('0x1f')]['fn']('COUNT',db[_0x1184('0x1f')]['fn']('IF',db[_0x1184('0x1f')][_0x1184('0x20')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x1184('0x2d')]})['then'](function(_0x53caf2){logger[_0x1184('0xc')](_0x1184('0x2c'),_0x36e068);logger[_0x1184('0xf')](_0x1184('0x2c'),_0x36e068,JSON[_0x1184('0x11')](_0x53caf2));_0x35018e(_0x53caf2);})['catch'](function(_0x23591b){logger[_0x1184('0x12')]('GetVoiceQueueHopperHistory',_0x23591b[_0x1184('0x14')],_0x36e068);_0x5297da(_0x1fec1f[_0x1184('0x12')](0x1f4,_0x23591b[_0x1184('0x14')]));});});};exports[_0x1184('0x44')]=function(_0x4a1e0c){var _0x3abff0=this;return new Promise(function(_0x3e01cf,_0x15845d){return db[_0x1184('0x1b')][_0x1184('0x1c')]({'raw':_0x4a1e0c[_0x1184('0x18')]?_0x4a1e0c[_0x1184('0x18')][_0x1184('0x1d')]===undefined?!![]:![]:!![],'where':_0x4a1e0c['options']?_0x4a1e0c['options']['where']||null:null,'attributes':[[_0x1184('0x2d'),_0x1184('0x2e')],[db[_0x1184('0x1f')]['fn'](_0x1184('0x25'),db[_0x1184('0x1f')][_0x1184('0x45')]('id')),_0x1184('0x46')],[db[_0x1184('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1184('0x1f')][_0x1184('0x20')](_0x1184('0x21')))),_0x1184('0x47')]],'group':[_0x1184('0x2d')]})[_0x1184('0xb')](function(_0x10ce6e){logger[_0x1184('0xc')]('GetCampaignHopperHistory',_0x4a1e0c);logger[_0x1184('0xf')](_0x1184('0x44'),_0x4a1e0c,JSON['stringify'](_0x10ce6e));_0x3e01cf(_0x10ce6e);})['catch'](function(_0x415fe7){logger[_0x1184('0x12')](_0x1184('0x44'),_0x415fe7['message'],_0x4a1e0c);_0x15845d(_0x3abff0['error'](0x1f4,_0x415fe7[_0x1184('0x14')]));});});}; \ No newline at end of file +var _0x9434=['`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','raw','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','AvgHandleTime','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout'];(function(_0x1e4f2f,_0x35edfa){var _0xccea89=function(_0x164386){while(--_0x164386){_0x1e4f2f['push'](_0x1e4f2f['shift']());}};_0xccea89(++_0x35edfa);}(_0x9434,0x168));var _0x4943=function(_0x33ca08,_0x18ca07){_0x33ca08=_0x33ca08-0x0;var _0x11ebea=_0x9434[_0x33ca08];return _0x11ebea;};'use strict';var _=require(_0x4943('0x0'));var util=require(_0x4943('0x1'));var moment=require(_0x4943('0x2'));var BPromise=require(_0x4943('0x3'));var rs=require(_0x4943('0x4'));var fs=require('fs');var Redis=require(_0x4943('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4943('0x6'));var logger=require(_0x4943('0x7'))('rpc');var config=require(_0x4943('0x8'));var jayson=require(_0x4943('0x9'));var client=jayson['client'][_0x4943('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56a55a,_0x4da494,_0x3ae08d){return new BPromise(function(_0x2f4119,_0x1876eb){return client[_0x4943('0xb')](_0x56a55a,_0x3ae08d)[_0x4943('0xc')](function(_0x553991){logger['info'](_0x4943('0xd'),_0x4da494,_0x4943('0xe'));logger[_0x4943('0xf')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x4da494,_0x4943('0xe'),JSON[_0x4943('0x10')](_0x553991));if(_0x553991['error']){if(_0x553991[_0x4943('0x11')]['code']===0x1f4){logger['error'](_0x4943('0xd'),_0x4da494,_0x553991[_0x4943('0x11')][_0x4943('0x12')]);return _0x1876eb(_0x553991[_0x4943('0x11')][_0x4943('0x12')]);}logger[_0x4943('0x11')](_0x4943('0xd'),_0x4da494,_0x553991['error'][_0x4943('0x12')]);return _0x2f4119(_0x553991[_0x4943('0x11')][_0x4943('0x12')]);}else{logger[_0x4943('0x13')](_0x4943('0xd'),_0x4da494,_0x4943('0xe'));_0x2f4119(_0x553991['result'][_0x4943('0x12')]);}})[_0x4943('0x14')](function(_0xb08628){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x4da494,_0xb08628);_0x1876eb(_0xb08628);});});}exports[_0x4943('0x15')]=function(_0x4cba96){var _0x2f0add=this;return new Promise(function(_0x33b2d0,_0x51a416){return db[_0x4943('0x16')][_0x4943('0x17')](_0x4cba96[_0x4943('0x18')],{'raw':_0x4cba96['options']?_0x4cba96[_0x4943('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x4943('0xc')](function(_0x52fa3b){logger[_0x4943('0x13')](_0x4943('0x15'),_0x4cba96);logger[_0x4943('0xf')](_0x4943('0x15'),_0x4cba96,JSON['stringify'](_0x52fa3b));_0x33b2d0(_0x52fa3b);})[_0x4943('0x14')](function(_0x205eb2){logger[_0x4943('0x11')](_0x4943('0x15'),_0x205eb2[_0x4943('0x12')],_0x4cba96);_0x51a416(_0x2f0add[_0x4943('0x11')](0x1f4,_0x205eb2[_0x4943('0x12')]));});});};exports[_0x4943('0x1a')]=function(_0x5dd061){var _0x5dbc0a=this;return new Promise(function(_0x315c7f,_0x127a53){return db[_0x4943('0x16')]['findAll']({'raw':_0x5dd061[_0x4943('0x19')]?_0x5dd061[_0x4943('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5dd061[_0x4943('0x19')]?_0x5dd061[_0x4943('0x19')][_0x4943('0x1b')]||null:null,'attributes':[[db[_0x4943('0x1c')]['fn'](_0x4943('0x1d'),db[_0x4943('0x1c')][_0x4943('0x1e')]('id')),_0x4943('0x1f')],[db[_0x4943('0x1c')]['fn'](_0x4943('0x1d'),db[_0x4943('0x1c')]['fn']('IF',db[_0x4943('0x1c')][_0x4943('0x20')](_0x4943('0x21')))),_0x4943('0x22')],[db[_0x4943('0x1c')]['fn'](_0x4943('0x1d'),db[_0x4943('0x1c')]['fn']('IF',db['sequelize'][_0x4943('0x20')]('`state`\x20=\x2010,\x201,\x20null'))),_0x4943('0x23')],[db[_0x4943('0x1c')]['fn'](_0x4943('0x1d'),db[_0x4943('0x1c')]['fn']('IF',db[_0x4943('0x1c')][_0x4943('0x20')](_0x4943('0x24')))),_0x4943('0x25')],[db['sequelize']['fn'](_0x4943('0x26'),db[_0x4943('0x1c')]['fn']('IF',db['sequelize'][_0x4943('0x20')](_0x4943('0x27')))),'predictiveIntervalAvgHoldtime'],[db[_0x4943('0x1c')]['fn'](_0x4943('0x26'),db[_0x4943('0x1c')]['fn']('IF',db['sequelize'][_0x4943('0x20')](_0x4943('0x28')))),_0x4943('0x29')]]})[_0x4943('0xc')](function(_0x3526c1){logger['info'](_0x4943('0x1a'),_0x5dd061);logger[_0x4943('0xf')](_0x4943('0x1a'),_0x5dd061,JSON[_0x4943('0x10')](_0x3526c1));_0x315c7f(_0x3526c1);})[_0x4943('0x14')](function(_0x1e7e7a){logger[_0x4943('0x11')](_0x4943('0x1a'),_0x1e7e7a[_0x4943('0x12')],_0x5dd061);_0x127a53(_0x5dbc0a[_0x4943('0x11')](0x1f4,_0x1e7e7a[_0x4943('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x435ddd){var _0x400bc8=this;return new Promise(function(_0xed2e1f,_0x2b4d12){return db[_0x4943('0x16')]['findAll']({'raw':_0x435ddd['options']?_0x435ddd['options'][_0x4943('0x2a')]===undefined?!![]:![]:!![],'where':_0x435ddd[_0x4943('0x19')]?_0x435ddd['options'][_0x4943('0x1b')]||null:null,'attributes':[['campaign',_0x4943('0x2b')],[db[_0x4943('0x1c')]['fn'](_0x4943('0x1d'),db[_0x4943('0x1c')]['fn']('IF',db[_0x4943('0x1c')][_0x4943('0x20')](_0x4943('0x2c')))),_0x4943('0x2d')],[db[_0x4943('0x1c')]['fn'](_0x4943('0x1d'),db[_0x4943('0x1c')]['fn']('IF',db[_0x4943('0x1c')][_0x4943('0x20')](_0x4943('0x2e')))),_0x4943('0x2f')],[db[_0x4943('0x1c')]['fn'](_0x4943('0x1d'),db[_0x4943('0x1c')]['fn']('IF',db[_0x4943('0x1c')][_0x4943('0x20')](_0x4943('0x21')))),_0x4943('0x30')],[db[_0x4943('0x1c')]['fn'](_0x4943('0x1d'),db[_0x4943('0x1c')]['fn']('IF',db[_0x4943('0x1c')][_0x4943('0x20')]('`state`\x20=\x205,\x201,\x20null'))),_0x4943('0x31')],[db[_0x4943('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4943('0x1c')]['literal'](_0x4943('0x32')))),'outboundCongestionCallsDay'],[db[_0x4943('0x1c')]['fn']('COUNT',db[_0x4943('0x1c')]['fn']('IF',db['sequelize'][_0x4943('0x20')](_0x4943('0x33')))),_0x4943('0x34')],[db['sequelize']['fn']('COUNT',db[_0x4943('0x1c')]['fn']('IF',db['sequelize'][_0x4943('0x20')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4943('0x35')],[db[_0x4943('0x1c')]['fn'](_0x4943('0x1d'),db[_0x4943('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x4943('0x36')))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0x4943('0x1d'),db[_0x4943('0x1c')]['fn']('IF',db[_0x4943('0x1c')][_0x4943('0x20')](_0x4943('0x37')))),_0x4943('0x38')],[db[_0x4943('0x1c')]['fn']('COUNT',db[_0x4943('0x1c')]['fn']('IF',db[_0x4943('0x1c')]['literal'](_0x4943('0x39')))),_0x4943('0x3a')],[db[_0x4943('0x1c')]['fn']('COUNT',db[_0x4943('0x1c')]['fn']('IF',db[_0x4943('0x1c')]['literal'](_0x4943('0x3b')))),_0x4943('0x3c')],[db['sequelize']['fn'](_0x4943('0x1d'),db[_0x4943('0x1c')]['fn']('IF',db[_0x4943('0x1c')]['literal'](_0x4943('0x3d')))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0x4943('0x1d'),db[_0x4943('0x1c')]['fn']('IF',db[_0x4943('0x1c')]['literal']('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x4943('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4943('0x1c')]['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x4943('0x3e')]})[_0x4943('0xc')](function(_0x24288a){logger['info'](_0x4943('0x3f'),_0x435ddd);logger[_0x4943('0xf')](_0x4943('0x3f'),_0x435ddd,JSON['stringify'](_0x24288a));_0xed2e1f(_0x24288a);})[_0x4943('0x14')](function(_0x44bcae){logger['error']('GetVoiceQueueHopperHistory',_0x44bcae['message'],_0x435ddd);_0x2b4d12(_0x400bc8['error'](0x1f4,_0x44bcae[_0x4943('0x12')]));});});};exports[_0x4943('0x40')]=function(_0x41e6de){var _0x3056c6=this;return new Promise(function(_0x490a65,_0x10f06b){return db['CmHopperHistory']['findAll']({'raw':_0x41e6de[_0x4943('0x19')]?_0x41e6de[_0x4943('0x19')][_0x4943('0x2a')]===undefined?!![]:![]:!![],'where':_0x41e6de['options']?_0x41e6de[_0x4943('0x19')][_0x4943('0x1b')]||null:null,'attributes':[[_0x4943('0x3e'),_0x4943('0x2b')],[db[_0x4943('0x1c')]['fn']('COUNT',db[_0x4943('0x1c')][_0x4943('0x1e')]('id')),_0x4943('0x41')],[db[_0x4943('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4943('0x1c')][_0x4943('0x20')](_0x4943('0x21')))),'ivrAnswerCallsDay']],'group':[_0x4943('0x3e')]})[_0x4943('0xc')](function(_0x264609){logger[_0x4943('0x13')](_0x4943('0x40'),_0x41e6de);logger[_0x4943('0xf')](_0x4943('0x40'),_0x41e6de,JSON[_0x4943('0x10')](_0x264609));_0x490a65(_0x264609);})[_0x4943('0x14')](function(_0x320eca){logger[_0x4943('0x11')](_0x4943('0x40'),_0x320eca[_0x4943('0x12')],_0x41e6de);_0x10f06b(_0x3056c6[_0x4943('0x11')](0x1f4,_0x320eca[_0x4943('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index a75b76c..97b816d 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 _0x390a=['create','put','update','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x49bcf9,_0xc957d3){var _0xf3a061=function(_0x4072ff){while(--_0x4072ff){_0x49bcf9['push'](_0x49bcf9['shift']());}};_0xf3a061(++_0xc957d3);}(_0x390a,0x133));var _0xa390=function(_0x4b6369,_0xbb93d8){_0x4b6369=_0x4b6369-0x0;var _0x6a0ae6=_0x390a[_0x4b6369];return _0x6a0ae6;};'use strict';var multer=require('multer');var util=require(_0xa390('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa390('0x1'));var router=express[_0xa390('0x2')]();var fs_extra=require(_0xa390('0x3'));var auth=require(_0xa390('0x4'));var interaction=require(_0xa390('0x5'));var config=require(_0xa390('0x6'));var controller=require(_0xa390('0x7'));router[_0xa390('0x8')]('/',auth[_0xa390('0x9')](),controller[_0xa390('0xa')]);router[_0xa390('0x8')](_0xa390('0xb'),auth['isAuthenticated'](),controller[_0xa390('0xc')]);router[_0xa390('0x8')](_0xa390('0xd'),auth[_0xa390('0x9')](),controller[_0xa390('0xe')]);router[_0xa390('0xf')]('/',auth[_0xa390('0x9')](),controller[_0xa390('0x10')]);router[_0xa390('0x11')](_0xa390('0xd'),auth['isAuthenticated'](),controller[_0xa390('0x12')]);module['exports']=router; \ No newline at end of file +var _0xdb2f=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','describe','/:id','show','post','create','put','update','exports','multer','path'];(function(_0x4641d5,_0x5bf8c9){var _0x253adb=function(_0x281659){while(--_0x281659){_0x4641d5['push'](_0x4641d5['shift']());}};_0x253adb(++_0x5bf8c9);}(_0xdb2f,0x75));var _0xfdb2=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xdb2f[_0x484e36];return _0xafc85d;};'use strict';var multer=require(_0xfdb2('0x0'));var util=require('util');var path=require(_0xfdb2('0x1'));var timeout=require(_0xfdb2('0x2'));var express=require(_0xfdb2('0x3'));var router=express[_0xfdb2('0x4')]();var fs_extra=require(_0xfdb2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfdb2('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router[_0xfdb2('0x7')]('/',auth[_0xfdb2('0x8')](),controller['index']);router[_0xfdb2('0x7')]('/describe',auth[_0xfdb2('0x8')](),controller[_0xfdb2('0x9')]);router[_0xfdb2('0x7')](_0xfdb2('0xa'),auth['isAuthenticated'](),controller[_0xfdb2('0xb')]);router[_0xfdb2('0xc')]('/',auth[_0xfdb2('0x8')](),controller[_0xfdb2('0xd')]);router[_0xfdb2('0xe')](_0xfdb2('0xa'),auth['isAuthenticated'](),controller[_0xfdb2('0xf')]);module[_0xfdb2('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 5e3afe4..a114d88 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 _0xf53f=['name','sequelize','exports','STRING'];(function(_0x265361,_0x3b9209){var _0x6177ee=function(_0x2bb4f4){while(--_0x2bb4f4){_0x265361['push'](_0x265361['shift']());}};_0x6177ee(++_0x3b9209);}(_0xf53f,0x8d));var _0xff53=function(_0x1bb0dc,_0xaa5a18){_0x1bb0dc=_0x1bb0dc-0x0;var _0x1e53d2=_0xf53f[_0x1bb0dc];return _0x1e53d2;};'use strict';var Sequelize=require(_0xff53('0x0'));module[_0xff53('0x1')]={'name':{'type':Sequelize[_0xff53('0x2')],'unique':_0xff53('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xff53('0x2')]},'dialPrefix':{'type':Sequelize[_0xff53('0x2')]}}; \ No newline at end of file +var _0x6c32=['STRING','sequelize'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6c32,0xb5));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x26c3('0x0'));module['exports']={'name':{'type':Sequelize[_0x26c3('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x26c3('0x1')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 77b0a85..ffc073c 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 _0x2e46=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','describe','addDisposition','ListId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','omit','success','dataValues','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','cf_%d','nolimit','raw','ContactItemType','OrderBy','alias','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','each','isEmpty','now','writeFileSync','format','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','text/csv','download','addCustomField','sequelize','CmCustomField','addCustomFields','Sequelize','text','TEXT','number','switch','defaultValue','queryInterface','cf_%s','getCustomFields','order','getGlobalCustomFields','findAndCountAll','addAgents','emit','removeAgents','userCmList:remove','getAgents','User','info','spread','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','register','status','json','offset','limit','undefined','count','set','save','update','then','get','Lists','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','map','CmList','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','create','body','user'];(function(_0x513d8f,_0x2b6303){var _0x6d9d35=function(_0x1c7891){while(--_0x1c7891){_0x513d8f['push'](_0x513d8f['shift']());}};_0x6d9d35(++_0x2b6303);}(_0x2e46,0xf7));var _0x62e4=function(_0x47cb8c,_0xd2b94){_0x47cb8c=_0x47cb8c-0x0;var _0x1d0207=_0x2e46[_0x47cb8c];return _0x1d0207;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x62e4('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x62e4('0x1'));var moment=require(_0x62e4('0x2'));var BPromise=require(_0x62e4('0x3'));var Mustache=require('mustache');var util=require(_0x62e4('0x4'));var path=require(_0x62e4('0x5'));var sox=require(_0x62e4('0x6'));var csv=require(_0x62e4('0x7'));var ejs=require(_0x62e4('0x8'));var fs=require('fs');var fs_extra=require(_0x62e4('0x9'));var _=require('lodash');var squel=require(_0x62e4('0xa'));var crypto=require(_0x62e4('0xb'));var jsforce=require(_0x62e4('0xc'));var deskjs=require(_0x62e4('0xd'));var toCsv=require(_0x62e4('0x7'));var querystring=require('querystring');var Papa=require(_0x62e4('0xe'));var Redis=require(_0x62e4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x62e4('0x10'));var as=require(_0x62e4('0x11'));var hardwareService=require(_0x62e4('0x12'));var logger=require(_0x62e4('0x13'))(_0x62e4('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x62e4('0x15'))['db'];var csv_results;config[_0x62e4('0x16')]=_[_0x62e4('0x17')](config[_0x62e4('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x62e4('0x18'))(new Redis(config[_0x62e4('0x16')]));require(_0x62e4('0x19'))[_0x62e4('0x1a')](socket);function respondWithStatusCode(_0x2f597e,_0x369fcc){_0x369fcc=_0x369fcc||0xcc;return function(_0x322e87){if(_0x322e87){return _0x2f597e['sendStatus'](_0x369fcc);}return _0x2f597e['status'](_0x369fcc)['end']();};}function respondWithResult(_0x396901,_0x128da2){_0x128da2=_0x128da2||0xc8;return function(_0xfd37ce){if(_0xfd37ce){return _0x396901[_0x62e4('0x1b')](_0x128da2)[_0x62e4('0x1c')](_0xfd37ce);}};}function respondWithFilteredResult(_0xd76c72,_0x22ba7d){return function(_0x38cf3c){if(_0x38cf3c){var _0x4aaaf7=typeof _0x22ba7d[_0x62e4('0x1d')]==='undefined'&&typeof _0x22ba7d[_0x62e4('0x1e')]===_0x62e4('0x1f');var _0x473254=_0x38cf3c[_0x62e4('0x20')];var _0x111334=_0x4aaaf7?0x0:_0x22ba7d[_0x62e4('0x1d')];var _0x4312a8=_0x4aaaf7?_0x38cf3c[_0x62e4('0x20')]:_0x22ba7d['offset']+_0x22ba7d['limit'];var _0x3a6e7a;if(_0x4312a8>=_0x473254){_0x4312a8=_0x473254;_0x3a6e7a=0xc8;}else{_0x3a6e7a=0xce;}_0xd76c72[_0x62e4('0x1b')](_0x3a6e7a);return _0xd76c72[_0x62e4('0x21')]('Content-Range',_0x111334+'-'+_0x4312a8+'/'+_0x473254)[_0x62e4('0x1c')](_0x38cf3c);}return null;};}function patchUpdates(_0x35a25e){return function(_0x266f7b){try{jsonpatch['apply'](_0x266f7b,_0x35a25e,!![]);}catch(_0x430c82){return BPromise['reject'](_0x430c82);}return _0x266f7b[_0x62e4('0x22')]();};}function saveUpdates(_0x13d8ba,_0x491509){return function(_0x3cb026){if(_0x3cb026){return _0x3cb026[_0x62e4('0x23')](_0x13d8ba)[_0x62e4('0x24')](function(_0x4ee66b){return _0x4ee66b;});}return null;};}function removeEntity(_0x193080,_0x2453f6){return function(_0x37031a){if(_0x37031a){return _0x37031a['destroy']()[_0x62e4('0x24')](function(){var _0x316476=_0x37031a[_0x62e4('0x25')]({'plain':!![]});var _0x15802b=_0x62e4('0x26');return db[_0x62e4('0x27')][_0x62e4('0x28')]({'where':{'type':_0x15802b,'resourceId':_0x316476['id']}})[_0x62e4('0x24')](function(){return _0x37031a;});})[_0x62e4('0x24')](function(){_0x193080['status'](0xcc)[_0x62e4('0x29')]();});}};}function handleEntityNotFound(_0x10f385,_0x542f14){return function(_0x305080){if(!_0x305080){_0x10f385[_0x62e4('0x2a')](0x194);}return _0x305080;};}function handleError(_0x2257df,_0x2af10c){_0x2af10c=_0x2af10c||0x1f4;return function(_0x5e6f11){logger[_0x62e4('0x2b')](_0x5e6f11[_0x62e4('0x2c')]);if(_0x5e6f11[_0x62e4('0x2d')]){delete _0x5e6f11[_0x62e4('0x2d')];}_0x2257df['status'](_0x2af10c)[_0x62e4('0x2e')](_0x5e6f11);};}exports['index']=function(_0x52c393,_0x2ce869){var _0x3dc6c3={},_0x5aa5c5={},_0x49f409={'count':0x0,'rows':[]};var _0x162dd1=_[_0x62e4('0x2f')](db[_0x62e4('0x30')][_0x62e4('0x31')],function(_0xe59475){return{'name':_0xe59475[_0x62e4('0x32')],'type':_0xe59475[_0x62e4('0x33')][_0x62e4('0x34')]};});_0x5aa5c5['model']=_[_0x62e4('0x2f')](_0x162dd1,_0x62e4('0x2d'));_0x5aa5c5[_0x62e4('0x35')]=_[_0x62e4('0x36')](_0x52c393[_0x62e4('0x35')]);_0x5aa5c5[_0x62e4('0x37')]=_[_0x62e4('0x38')](_0x5aa5c5[_0x62e4('0x39')],_0x5aa5c5[_0x62e4('0x35')]);_0x3dc6c3[_0x62e4('0x3a')]=_[_0x62e4('0x38')](_0x5aa5c5['model'],qs[_0x62e4('0x3b')](_0x52c393[_0x62e4('0x35')][_0x62e4('0x3b')]));_0x3dc6c3[_0x62e4('0x3a')]=_0x3dc6c3[_0x62e4('0x3a')][_0x62e4('0x3c')]?_0x3dc6c3[_0x62e4('0x3a')]:_0x5aa5c5[_0x62e4('0x39')];if(!_0x52c393['query'][_0x62e4('0x3d')]('nolimit')){_0x3dc6c3[_0x62e4('0x1e')]=qs[_0x62e4('0x1e')](_0x52c393[_0x62e4('0x35')][_0x62e4('0x1e')]);_0x3dc6c3['offset']=qs[_0x62e4('0x1d')](_0x52c393[_0x62e4('0x35')][_0x62e4('0x1d')]);}_0x3dc6c3['order']=qs[_0x62e4('0x3e')](_0x52c393['query'][_0x62e4('0x3e')]);_0x3dc6c3['where']=qs['filters'](_['pick'](_0x52c393[_0x62e4('0x35')],_0x5aa5c5[_0x62e4('0x37')]),_0x162dd1);if(_0x52c393[_0x62e4('0x35')][_0x62e4('0x3f')]){_0x3dc6c3[_0x62e4('0x40')]=_[_0x62e4('0x41')](_0x3dc6c3[_0x62e4('0x40')],{'$or':_[_0x62e4('0x2f')](_0x162dd1,function(_0x28a8d1){if(_0x28a8d1[_0x62e4('0x33')]!=='VIRTUAL'){var _0x381e37={};_0x381e37[_0x28a8d1[_0x62e4('0x2d')]]={'$like':'%'+_0x52c393[_0x62e4('0x35')][_0x62e4('0x3f')]+'%'};return _0x381e37;}})});}_0x3dc6c3=_['merge']({},_0x3dc6c3,_0x52c393[_0x62e4('0x42')]);var _0x3a7433={'where':_0x3dc6c3['where']};return db[_0x62e4('0x30')]['count'](_0x3a7433)[_0x62e4('0x24')](function(_0x140043){_0x49f409[_0x62e4('0x20')]=_0x140043;if(_0x52c393[_0x62e4('0x35')][_0x62e4('0x43')]){_0x3dc6c3[_0x62e4('0x44')]=[{'all':!![]}];}return db[_0x62e4('0x30')][_0x62e4('0x45')](_0x3dc6c3);})['then'](function(_0x923c50){_0x49f409[_0x62e4('0x46')]=_0x923c50;return _0x49f409;})['then'](respondWithFilteredResult(_0x2ce869,_0x3dc6c3))[_0x62e4('0x47')](handleError(_0x2ce869,null));};exports['show']=function(_0x4580f4,_0xd9d1db){var _0x5a9cea={'raw':![],'where':{'id':_0x4580f4['params']['id']}},_0xfb485c={};_0xfb485c['model']=_[_0x62e4('0x36')](db[_0x62e4('0x30')][_0x62e4('0x31')]);_0xfb485c['query']=_[_0x62e4('0x36')](_0x4580f4[_0x62e4('0x35')]);_0xfb485c[_0x62e4('0x37')]=_[_0x62e4('0x38')](_0xfb485c['model'],_0xfb485c[_0x62e4('0x35')]);_0x5a9cea[_0x62e4('0x3a')]=_['intersection'](_0xfb485c[_0x62e4('0x39')],qs[_0x62e4('0x3b')](_0x4580f4[_0x62e4('0x35')][_0x62e4('0x3b')]));_0x5a9cea[_0x62e4('0x3a')]=_0x5a9cea['attributes'][_0x62e4('0x3c')]?_0x5a9cea[_0x62e4('0x3a')]:_0xfb485c[_0x62e4('0x39')];if(_0x4580f4[_0x62e4('0x35')]['includeAll']){_0x5a9cea['include']=[{'all':!![]}];}_0x5a9cea=_[_0x62e4('0x41')]({},_0x5a9cea,_0x4580f4[_0x62e4('0x42')]);return db[_0x62e4('0x30')]['find'](_0x5a9cea)[_0x62e4('0x24')](handleEntityNotFound(_0xd9d1db,null))['then'](respondWithResult(_0xd9d1db,null))[_0x62e4('0x47')](handleError(_0xd9d1db,null));};exports['create']=function(_0x22b761,_0x454d0d){return db[_0x62e4('0x30')][_0x62e4('0x48')](_0x22b761[_0x62e4('0x49')],{})['then'](function(_0x1cd962){var _0x469648=_0x22b761[_0x62e4('0x4a')]['get']({'plain':!![]});if(!_0x469648)throw new Error(_0x62e4('0x4b'));if(_0x469648[_0x62e4('0x4c')]===_0x62e4('0x4a')){var _0x48480c=_0x1cd962[_0x62e4('0x25')]({'plain':!![]});var _0xc308d=_0x62e4('0x26');return db[_0x62e4('0x4d')]['find']({'where':{'name':_0xc308d,'userProfileId':_0x469648['userProfileId']},'raw':!![]})[_0x62e4('0x24')](function(_0x394047){if(_0x394047&&_0x394047['autoAssociation']===0x0){return db[_0x62e4('0x27')]['create']({'name':_0x48480c[_0x62e4('0x2d')],'resourceId':_0x48480c['id'],'type':_0x394047[_0x62e4('0x2d')],'sectionId':_0x394047['id']},{})[_0x62e4('0x24')](function(){return _0x1cd962;});}else{return _0x1cd962;}})[_0x62e4('0x47')](function(_0x32ab4d){logger['error'](_0x62e4('0x4e'),_0x32ab4d);throw _0x32ab4d;});}return _0x1cd962;})[_0x62e4('0x24')](respondWithResult(_0x454d0d,0xc9))['catch'](handleError(_0x454d0d,null));};exports[_0x62e4('0x23')]=function(_0x1f67af,_0x3a1c2d){if(_0x1f67af[_0x62e4('0x49')]['id']){delete _0x1f67af['body']['id'];}return db[_0x62e4('0x30')]['find']({'where':{'id':_0x1f67af['params']['id']}})[_0x62e4('0x24')](handleEntityNotFound(_0x3a1c2d,null))['then'](saveUpdates(_0x1f67af['body'],null))[_0x62e4('0x24')](respondWithResult(_0x3a1c2d,null))['catch'](handleError(_0x3a1c2d,null));};exports[_0x62e4('0x28')]=function(_0x38b039,_0x71b6f1){return db[_0x62e4('0x30')][_0x62e4('0x4f')]({'where':{'id':_0x38b039[_0x62e4('0x50')]['id']}})[_0x62e4('0x24')](handleEntityNotFound(_0x71b6f1,null))[_0x62e4('0x24')](removeEntity(_0x71b6f1,null))[_0x62e4('0x47')](handleError(_0x71b6f1,null));};exports[_0x62e4('0x51')]=function(_0x3f0535,_0x45f8c9){return db[_0x62e4('0x30')][_0x62e4('0x51')]()[_0x62e4('0x24')](respondWithResult(_0x45f8c9,null))['catch'](handleError(_0x45f8c9,null));};exports[_0x62e4('0x52')]=function(_0x45c548,_0x20d173,_0x583c12){if(_0x45c548[_0x62e4('0x49')]['id']){delete _0x45c548[_0x62e4('0x49')]['id'];}return db['CmList'][_0x62e4('0x4f')]({'where':{'id':_0x45c548[_0x62e4('0x50')]['id']}})[_0x62e4('0x24')](handleEntityNotFound(_0x20d173,null))['then'](function(_0x49be1a){if(_0x49be1a){_0x45c548['body'][_0x62e4('0x53')]=_0x49be1a['id'];return db[_0x62e4('0x54')][_0x62e4('0x48')](_0x45c548[_0x62e4('0x49')]);}})['then'](respondWithResult(_0x20d173,null))[_0x62e4('0x47')](handleError(_0x20d173,null));};exports[_0x62e4('0x55')]=function(_0x3503d0,_0x2093be,_0x480904){var _0x5efa85={'raw':![],'where':{}};var _0x5c4092={};var _0x2b747b={'count':0x0,'rows':[]};return db[_0x62e4('0x30')][_0x62e4('0x56')]({'where':{'id':_0x3503d0[_0x62e4('0x50')]['id']}})['then'](handleEntityNotFound(_0x2093be,null))[_0x62e4('0x24')](function(_0x14a231){if(_0x14a231){_0x5c4092[_0x62e4('0x39')]=_[_0x62e4('0x36')](db[_0x62e4('0x54')][_0x62e4('0x31')]);_0x5c4092['query']=_['keys'](_0x3503d0[_0x62e4('0x35')]);_0x5c4092[_0x62e4('0x37')]=_[_0x62e4('0x38')](_0x5c4092[_0x62e4('0x39')],_0x5c4092[_0x62e4('0x35')]);_0x5efa85[_0x62e4('0x3a')]=_['intersection'](_0x5c4092[_0x62e4('0x39')],qs[_0x62e4('0x3b')](_0x3503d0[_0x62e4('0x35')][_0x62e4('0x3b')]));_0x5efa85['attributes']=_0x5efa85['attributes'][_0x62e4('0x3c')]?_0x5efa85[_0x62e4('0x3a')]:_0x5c4092[_0x62e4('0x39')];if(!_0x3503d0[_0x62e4('0x35')][_0x62e4('0x3d')]('nolimit')){_0x5efa85[_0x62e4('0x1e')]=qs[_0x62e4('0x1e')](_0x3503d0[_0x62e4('0x35')][_0x62e4('0x1e')]);_0x5efa85['offset']=qs['offset'](_0x3503d0['query'][_0x62e4('0x1d')]);}_0x5efa85['order']=qs[_0x62e4('0x3e')](_0x3503d0['query'][_0x62e4('0x3e')]);_0x5efa85[_0x62e4('0x40')]=qs['filters'](_[_0x62e4('0x57')](_0x3503d0['query'],_0x5c4092[_0x62e4('0x37')]));_0x5efa85[_0x62e4('0x40')][_0x62e4('0x53')]=_0x14a231['id'];if(_0x3503d0[_0x62e4('0x35')][_0x62e4('0x3f')]){_0x5efa85[_0x62e4('0x40')]=_[_0x62e4('0x41')](_0x5efa85['where'],{'$or':_[_0x62e4('0x2f')](_0x5efa85[_0x62e4('0x3a')],function(_0x1a94b2){var _0xedbad1={};_0xedbad1[_0x1a94b2]={'$like':'%'+_0x3503d0[_0x62e4('0x35')][_0x62e4('0x3f')]+'%'};return _0xedbad1;})});}_0x5efa85=_[_0x62e4('0x41')]({},_0x5efa85,_0x3503d0['options']);return db['Disposition'][_0x62e4('0x20')]({'where':_0x5efa85[_0x62e4('0x40')]})[_0x62e4('0x24')](function(_0x4ea433){_0x2b747b[_0x62e4('0x20')]=_0x4ea433;if(_0x3503d0[_0x62e4('0x35')][_0x62e4('0x43')]){_0x5efa85[_0x62e4('0x44')]=[{'all':!![]}];}return db[_0x62e4('0x54')][_0x62e4('0x45')](_0x5efa85);})['then'](function(_0x51009e){_0x2b747b[_0x62e4('0x46')]=_0x51009e;return _0x2b747b;});}})['then'](respondWithFilteredResult(_0x2093be,_0x5efa85))[_0x62e4('0x47')](handleError(_0x2093be,null));};exports[_0x62e4('0x58')]=function(_0x232d7f,_0x3639e7,_0x37deb9){return db['CmList'][_0x62e4('0x4f')]({'where':{'id':_0x232d7f['params']['id']}})[_0x62e4('0x24')](handleEntityNotFound(_0x3639e7,null))['then'](function(_0x4f38a9){if(_0x4f38a9){return _0x4f38a9['removeDispositions'](_0x232d7f['query'][_0x62e4('0x59')]);}})['then'](respondWithStatusCode(_0x3639e7,null))[_0x62e4('0x47')](handleError(_0x3639e7,null));};exports[_0x62e4('0x5a')]=function(_0x24ee61,_0x173317,_0x2f94e0){return db[_0x62e4('0x30')][_0x62e4('0x4f')]({'where':{'id':_0x24ee61['params']['id']}})[_0x62e4('0x24')](handleEntityNotFound(_0x173317,null))[_0x62e4('0x24')](function(_0x576b29){if(_0x576b29){var _0x627f27=[];var _0x22bfab={'success':[],'errors':[]};return db[_0x62e4('0x5b')]['describe']()[_0x62e4('0x24')](function(_0x472a56){if(_0x24ee61[_0x62e4('0x49')][_0x62e4('0x5c')]&&_[_0x62e4('0x5d')](_0x24ee61[_0x62e4('0x49')]['tags'])){if(_0x24ee61[_0x62e4('0x49')][_0x62e4('0x5c')][_0x62e4('0x3c')]){_0x24ee61['body'][_0x62e4('0x5c')]=_0x24ee61[_0x62e4('0x49')][_0x62e4('0x5c')][_0x62e4('0x5e')](';')+';';}else{_0x24ee61['body'][_0x62e4('0x5c')]=null;}}else{_0x24ee61[_0x62e4('0x49')]['tags']=null;}if(_0x24ee61[_0x62e4('0x49')]&&_[_0x62e4('0x5d')](_0x24ee61[_0x62e4('0x49')])){for(var _0x4b211a=0x0;_0x4b211a<_0x24ee61[_0x62e4('0x49')][_0x62e4('0x3c')];_0x4b211a+=0x1){_0x24ee61[_0x62e4('0x49')][_0x4b211a]['ListId']=_0x24ee61['params']['id'];_0x627f27[_0x62e4('0x5f')](_0x24ee61['body'][_0x4b211a]);}return BPromise['each'](_0x627f27,function(_0x4504cf){return db['CmContact'][_0x62e4('0x48')](_[_0x62e4('0x60')](_0x4504cf,['ids','id'])||{},{'fields':_[_0x62e4('0x36')](_0x472a56),'raw':!![]})[_0x62e4('0x24')](function(_0x3bf950){_0x22bfab[_0x62e4('0x61')][_0x62e4('0x5f')](_0x3bf950[_0x62e4('0x62')]);})['catch'](function(_0x360025){_0x22bfab['errors']['push']({'data':_0x4504cf,'error':_0x360025['message']});});})[_0x62e4('0x24')](function(_0x316849){return _0x22bfab;})['catch'](function(_0x46f9b3){return _0x46f9b3;});}else{_0x173317[_0x62e4('0x1b')](0x190)[_0x62e4('0x1c')]({'message':_0x62e4('0x63')});}});}})['then'](respondWithResult(_0x173317,null))[_0x62e4('0x47')](handleError(_0x173317,null));};exports[_0x62e4('0x64')]=function(_0x71cf7f,_0x32304f,_0x6ca528){var _0x2f06c6;return db[_0x62e4('0x30')]['find']({'where':{'id':_0x71cf7f[_0x62e4('0x50')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x62e4('0x65')}]})['then'](handleEntityNotFound(_0x32304f,null))[_0x62e4('0x24')](function(_0x55f999){if(_0x55f999){_0x2f06c6=_0x55f999;return db[_0x62e4('0x5b')][_0x62e4('0x31')];}})[_0x62e4('0x24')](function(_0x819e56){if(_0x819e56){var _0x1e4d7e={};var _0x9dd58f={};_0x9dd58f['model']=_[_0x62e4('0x66')](_['keys'](_0x819e56),_[_0x62e4('0x2f')](_0x2f06c6[_0x62e4('0x65')],function(_0x3b38f2){return util['format'](_0x62e4('0x67'),_0x3b38f2['id']);}));_0x9dd58f[_0x62e4('0x35')]=_[_0x62e4('0x36')](_0x71cf7f['query']);_0x9dd58f[_0x62e4('0x37')]=_[_0x62e4('0x38')](_0x9dd58f['model'],_0x9dd58f[_0x62e4('0x35')]);_0x1e4d7e[_0x62e4('0x3a')]=_[_0x62e4('0x38')](_0x9dd58f[_0x62e4('0x39')],qs[_0x62e4('0x3b')](_0x71cf7f['query']['fields']));_0x1e4d7e['attributes']=_0x1e4d7e[_0x62e4('0x3a')][_0x62e4('0x3c')]?_0x1e4d7e['attributes']:_0x9dd58f[_0x62e4('0x39')];if(!_0x71cf7f[_0x62e4('0x35')][_0x62e4('0x3d')](_0x62e4('0x68'))){_0x1e4d7e[_0x62e4('0x1e')]=qs[_0x62e4('0x1e')](_0x71cf7f[_0x62e4('0x35')]['limit']);_0x1e4d7e['offset']=qs['offset'](_0x71cf7f[_0x62e4('0x35')][_0x62e4('0x1d')]);}_0x1e4d7e['order']=qs['sort'](_0x71cf7f['query'][_0x62e4('0x3e')]);_0x1e4d7e[_0x62e4('0x40')]=qs[_0x62e4('0x37')](_[_0x62e4('0x57')](_0x71cf7f[_0x62e4('0x35')],_0x9dd58f[_0x62e4('0x37')]));_0x1e4d7e[_0x62e4('0x69')]=!![];if(_0x71cf7f[_0x62e4('0x35')][_0x62e4('0x3f')]){_0x1e4d7e[_0x62e4('0x40')]=_[_0x62e4('0x41')](_0x1e4d7e[_0x62e4('0x40')],{'$or':_[_0x62e4('0x2f')](_0x1e4d7e[_0x62e4('0x3a')],function(_0x35bf79){var _0x3017e2={};_0x3017e2[_0x35bf79]={'$like':'%'+_0x71cf7f[_0x62e4('0x35')][_0x62e4('0x3f')]+'%'};return _0x3017e2;})});}_0x1e4d7e=_[_0x62e4('0x41')]({},_0x1e4d7e,_0x71cf7f[_0x62e4('0x42')]);return _0x2f06c6[_0x62e4('0x64')](_0x1e4d7e);}})[_0x62e4('0x24')](respondWithResult(_0x32304f,null))[_0x62e4('0x47')](handleError(_0x32304f,null));};exports['getContactsCsv']=function(_0x5f32e7,_0x58816c,_0xdd59b2){var _0x3f41dc;var _0x967725;var _0x497dc9;var _0x16c3da=_0x5f32e7[_0x62e4('0x50')]['id'];csv_results=[];return db[_0x62e4('0x6a')][_0x62e4('0x45')]({'attributes':['id','name'],'raw':!![],'order':[_0x62e4('0x6b')]})['then'](function(_0x5b694d){_0x3f41dc=_0x5b694d;var _0x5a3f7=_['keys'](db[_0x62e4('0x5b')][_0x62e4('0x31')]);return db['CmCustomField'][_0x62e4('0x45')]({'raw':!![],'attributes':['id',_0x62e4('0x6c')]})['then'](function(_0x437a99){_0x967725=_0x437a99;var _0xfb8a76=squel[_0x62e4('0x6d')]()[_0x62e4('0x3b')](_0x5a3f7)['from'](_0x62e4('0x6e'),'c')[_0x62e4('0x40')](_0x62e4('0x6f'),_0x16c3da)[_0x62e4('0x40')](_0x62e4('0x70'))[_0x62e4('0x71')]();for(var _0x4ee042=0x0;_0x4ee042<_0x967725[_0x62e4('0x3c')];_0x4ee042++){_0xfb8a76[_0x62e4('0x72')](_0x62e4('0x73')+_0x967725[_0x4ee042]['id'],_0x62e4('0x74')+_0x967725[_0x4ee042]['alias']);}for(var _0x4ee042=0x0;_0x4ee042<_0x3f41dc[_0x62e4('0x3c')];_0x4ee042++){_0xfb8a76[_0x62e4('0x72')](squel[_0x62e4('0x6d')]()['field'](_0x62e4('0x75'))[_0x62e4('0x76')](_0x62e4('0x77'))[_0x62e4('0x40')](_0x62e4('0x78'),_0x3f41dc[_0x4ee042]['id'])[_0x62e4('0x40')](_0x62e4('0x79')),_0x62e4('0x7a')+_0x3f41dc[_0x4ee042][_0x62e4('0x2d')]);_0xfb8a76[_0x62e4('0x72')](squel[_0x62e4('0x6d')]()[_0x62e4('0x72')](_0x62e4('0x7b'))[_0x62e4('0x76')](_0x62e4('0x77'))[_0x62e4('0x40')]('ItemTypeId\x20=\x20?',_0x3f41dc[_0x4ee042]['id'])['where'](_0x62e4('0x79')),_0x62e4('0x7c')+_0x3f41dc[_0x4ee042]['name']);}var _0x91fdd8=[];_0x91fdd8[_0x62e4('0x5f')](_0xfb8a76[_0x62e4('0x7d')]());BPromise[_0x62e4('0x7e')](_0x91fdd8,handleQuery)[_0x62e4('0x24')](function(_0x311d28){handleQuery(_0xfb8a76[_0x62e4('0x7d')]());var _0x565cbe=csv_results[0x0];if(!_[_0x62e4('0x7f')](_0x565cbe)){var _0x371d38=toCsv(_0x565cbe);var _0x2d04a6=Date[_0x62e4('0x80')]();fs[_0x62e4('0x81')](util[_0x62e4('0x82')](_0x62e4('0x83'),_0x16c3da,_0x2d04a6),_0x371d38);_0x58816c['setHeader'](_0x62e4('0x84'),_0x62e4('0x85')+util['format']('list_%d_%s.csv',_0x16c3da,_0x2d04a6));_0x58816c[_0x62e4('0x86')]('Content-type',_0x62e4('0x87'));return _0x58816c[_0x62e4('0x88')](util['format']('/tmp/list_%d_%s.csv',_0x16c3da,_0x2d04a6));}else{return _0x58816c[_0x62e4('0x2a')](0xcc);}});});});};exports[_0x62e4('0x89')]=function(_0x367f80,_0x13463d,_0x3b203d){var _0xe30df1;delete _0x367f80[_0x62e4('0x49')]['id'];return db['CmList'][_0x62e4('0x56')]({'where':{'id':_0x367f80[_0x62e4('0x50')]['id']}})[_0x62e4('0x24')](handleEntityNotFound(_0x13463d,null))[_0x62e4('0x24')](function(_0x34afb5){if(_0x34afb5){return db[_0x62e4('0x8a')]['transaction'](function(_0x44a5ec){return db[_0x62e4('0x8b')][_0x62e4('0x48')](_0x367f80['body'],{'transaction':_0x44a5ec})['then'](function(_0x2dfa73){_0xe30df1=_0x2dfa73;return _0x34afb5[_0x62e4('0x8c')](_0x2dfa73,{'transaction':_0x44a5ec});})[_0x62e4('0x24')](function(){var _0x1c0562={'type':db[_0x62e4('0x8d')]['TEXT'],'transaction':_0x44a5ec};switch(_0x367f80[_0x62e4('0x49')]['type']){case _0x62e4('0x8e'):_0x1c0562[_0x62e4('0x33')]=db[_0x62e4('0x8d')][_0x62e4('0x8f')];break;case _0x62e4('0x90'):_0x1c0562[_0x62e4('0x33')]=db[_0x62e4('0x8d')]['INTEGER'];break;case _0x62e4('0x91'):_0x1c0562['type']=db[_0x62e4('0x8d')]['BOOLEAN'];_0x1c0562[_0x62e4('0x92')]=![];break;default:}return db[_0x62e4('0x8a')][_0x62e4('0x93')]['addColumn'](_0x62e4('0x6e'),util[_0x62e4('0x82')](_0x62e4('0x94'),_0xe30df1['id']),_0x1c0562);})['then'](function(){return _0xe30df1;});});}})['then'](respondWithResult(_0x13463d,null))['catch'](handleError(_0x13463d,null));};exports[_0x62e4('0x95')]=function(_0x5340a7,_0x4ae383,_0x1f3dec){var _0x1bdbde={};var _0x5b5d0e={};var _0x100add;var _0x2b226d;return db[_0x62e4('0x30')][_0x62e4('0x56')]({'where':{'id':_0x5340a7[_0x62e4('0x50')]['id']}})[_0x62e4('0x24')](handleEntityNotFound(_0x4ae383,null))[_0x62e4('0x24')](function(_0x13e1a3){if(_0x13e1a3){_0x100add=_0x13e1a3;_0x5b5d0e[_0x62e4('0x39')]=_[_0x62e4('0x36')](db[_0x62e4('0x8b')][_0x62e4('0x31')]);_0x5b5d0e[_0x62e4('0x35')]=_[_0x62e4('0x36')](_0x5340a7[_0x62e4('0x35')]);_0x5b5d0e[_0x62e4('0x37')]=_[_0x62e4('0x38')](_0x5b5d0e[_0x62e4('0x39')],_0x5b5d0e[_0x62e4('0x35')]);_0x1bdbde[_0x62e4('0x3a')]=_['intersection'](_0x5b5d0e[_0x62e4('0x39')],qs[_0x62e4('0x3b')](_0x5340a7[_0x62e4('0x35')][_0x62e4('0x3b')]));_0x1bdbde[_0x62e4('0x3a')]=_0x1bdbde[_0x62e4('0x3a')][_0x62e4('0x3c')]?_0x1bdbde[_0x62e4('0x3a')]:_0x5b5d0e[_0x62e4('0x39')];_0x1bdbde[_0x62e4('0x96')]=qs[_0x62e4('0x3e')](_0x5340a7[_0x62e4('0x35')][_0x62e4('0x3e')]);_0x1bdbde[_0x62e4('0x40')]=qs[_0x62e4('0x37')](_[_0x62e4('0x57')](_0x5340a7[_0x62e4('0x35')],_0x5b5d0e['filters']));_0x1bdbde[_0x62e4('0x40')]=_['merge'](_0x1bdbde[_0x62e4('0x40')],{'$or':[{'ListId':_0x13e1a3['id']},{'ListId':null}]});if(_0x5340a7['query'][_0x62e4('0x3f')]){_0x1bdbde[_0x62e4('0x40')]=_[_0x62e4('0x41')](_0x1bdbde[_0x62e4('0x40')],{'$or':_[_0x62e4('0x2f')](_0x1bdbde[_0x62e4('0x3a')],function(_0x39bf3c){var _0x17c454={};_0x17c454[_0x39bf3c]={'$like':'%'+_0x5340a7[_0x62e4('0x35')][_0x62e4('0x3f')]+'%'};return _0x17c454;})});}_0x1bdbde=_[_0x62e4('0x41')]({},_0x1bdbde,_0x5340a7[_0x62e4('0x42')]);return db[_0x62e4('0x8b')]['findAndCountAll'](_0x1bdbde);}})['then'](respondWithResult(_0x4ae383,null))[_0x62e4('0x47')](handleError(_0x4ae383,null));};exports[_0x62e4('0x97')]=function(_0x5dc226,_0x5c75d6){return db[_0x62e4('0x8b')][_0x62e4('0x98')]({'where':{'ListId':null}})[_0x62e4('0x24')](handleEntityNotFound(_0x5c75d6,null))['then'](function(_0x589714){return _0x589714;})['then'](respondWithResult(_0x5c75d6,null))['catch'](handleError(_0x5c75d6,null));};exports[_0x62e4('0x99')]=function(_0x53e771,_0x275c8c,_0x36d5be){return db[_0x62e4('0x30')][_0x62e4('0x4f')]({'where':{'id':_0x53e771['params']['id']}})[_0x62e4('0x24')](handleEntityNotFound(_0x275c8c,null))[_0x62e4('0x24')](function(_0x1684d7){if(_0x1684d7){return _0x1684d7['addAgents'](_0x53e771['body'][_0x62e4('0x59')],_['omit'](_0x53e771[_0x62e4('0x49')],[_0x62e4('0x59'),'id'])||{})['spread'](function(_0x59abee){for(var _0x14bf7f=0x0;_0x14bf7f<_0x53e771[_0x62e4('0x49')][_0x62e4('0x59')]['length'];_0x14bf7f+=0x1){socket[_0x62e4('0x9a')]('userCmList:save',{'UserId':Number(_0x53e771[_0x62e4('0x49')]['ids'][_0x14bf7f]),'CmListId':Number(_0x53e771['params']['id'])});}return _0x59abee;});}})[_0x62e4('0x24')](respondWithResult(_0x275c8c,null))[_0x62e4('0x47')](handleError(_0x275c8c,null));};exports['removeAgents']=function(_0x523fc6,_0xf5898c,_0x5217ab){return db['CmList'][_0x62e4('0x4f')]({'where':{'id':_0x523fc6[_0x62e4('0x50')]['id']}})[_0x62e4('0x24')](handleEntityNotFound(_0xf5898c,null))[_0x62e4('0x24')](function(_0x581344){if(_0x581344){return _0x581344[_0x62e4('0x9b')](_0x523fc6[_0x62e4('0x35')][_0x62e4('0x59')])['then'](function(){if(_['isArray'](_0x523fc6[_0x62e4('0x35')][_0x62e4('0x59')])){for(var _0x496e06=0x0;_0x496e06<_0x523fc6[_0x62e4('0x35')]['ids']['length'];_0x496e06+=0x1){socket['emit'](_0x62e4('0x9c'),{'UserId':Number(_0x523fc6[_0x62e4('0x35')][_0x62e4('0x59')][_0x496e06]),'CmListId':Number(_0x523fc6['params']['id'])});}}else{socket[_0x62e4('0x9a')](_0x62e4('0x9c'),{'UserId':Number(_0x523fc6['query'][_0x62e4('0x59')]),'CmListId':Number(_0x523fc6[_0x62e4('0x50')]['id'])});}});}})[_0x62e4('0x24')](respondWithStatusCode(_0xf5898c,null))[_0x62e4('0x47')](handleError(_0xf5898c,null));};exports[_0x62e4('0x9d')]=function(_0x3a18b6,_0x43b57d,_0x2a9c1a){var _0x9e39a8={};var _0x132b75={};var _0x135030;var _0x55d4b7;return db[_0x62e4('0x30')]['findOne']({'where':{'id':_0x3a18b6[_0x62e4('0x50')]['id']}})[_0x62e4('0x24')](handleEntityNotFound(_0x43b57d,null))[_0x62e4('0x24')](function(_0x406ff2){if(_0x406ff2){_0x135030=_0x406ff2;_0x132b75[_0x62e4('0x39')]=_[_0x62e4('0x36')](db[_0x62e4('0x9e')][_0x62e4('0x31')]);_0x132b75[_0x62e4('0x35')]=_[_0x62e4('0x36')](_0x3a18b6[_0x62e4('0x35')]);_0x132b75[_0x62e4('0x37')]=_[_0x62e4('0x38')](_0x132b75['model'],_0x132b75[_0x62e4('0x35')]);_0x9e39a8[_0x62e4('0x3a')]=_[_0x62e4('0x38')](_0x132b75[_0x62e4('0x39')],qs[_0x62e4('0x3b')](_0x3a18b6[_0x62e4('0x35')][_0x62e4('0x3b')]));_0x9e39a8[_0x62e4('0x3a')]=_0x9e39a8['attributes'][_0x62e4('0x3c')]?_0x9e39a8['attributes']:_0x132b75[_0x62e4('0x39')];_0x9e39a8['order']=qs[_0x62e4('0x3e')](_0x3a18b6['query'][_0x62e4('0x3e')]);_0x9e39a8[_0x62e4('0x40')]=qs['filters'](_['pick'](_0x3a18b6['query'],_0x132b75[_0x62e4('0x37')]));if(_0x3a18b6['query'][_0x62e4('0x3f')]){_0x9e39a8[_0x62e4('0x40')]=_[_0x62e4('0x41')](_0x9e39a8[_0x62e4('0x40')],{'$or':_[_0x62e4('0x2f')](_0x9e39a8[_0x62e4('0x3a')],function(_0x512206){var _0x2d77a9={};_0x2d77a9[_0x512206]={'$like':'%'+_0x3a18b6[_0x62e4('0x35')][_0x62e4('0x3f')]+'%'};return _0x2d77a9;})});}_0x9e39a8=_[_0x62e4('0x41')]({},_0x9e39a8,_0x3a18b6[_0x62e4('0x42')]);return _0x135030[_0x62e4('0x9d')](_0x9e39a8);}})[_0x62e4('0x24')](function(_0x5d9f92){if(_0x5d9f92){_0x55d4b7=_0x5d9f92[_0x62e4('0x3c')];if(!_0x3a18b6[_0x62e4('0x35')]['hasOwnProperty']('nolimit')){_0x9e39a8['limit']=qs[_0x62e4('0x1e')](_0x3a18b6[_0x62e4('0x35')][_0x62e4('0x1e')]);_0x9e39a8[_0x62e4('0x1d')]=qs[_0x62e4('0x1d')](_0x3a18b6[_0x62e4('0x35')]['offset']);}return _0x135030[_0x62e4('0x9d')](_0x9e39a8);}})[_0x62e4('0x24')](function(_0x4531fe){if(_0x4531fe){return _0x4531fe?{'count':_0x55d4b7,'rows':_0x4531fe}:null;}})[_0x62e4('0x24')](respondWithResult(_0x43b57d,null))['catch'](handleError(_0x43b57d,null));};function handleQuery(_0x285ecc){logger[_0x62e4('0x9f')](_0x285ecc);return db[_0x62e4('0x8a')][_0x62e4('0x35')](_0x285ecc)[_0x62e4('0xa0')](function(_0x2ab9e1){csv_results[_0x62e4('0x5f')](_0x2ab9e1);})['catch'](function(_0x78fbf0){logger[_0x62e4('0x2b')](_0x78fbf0['message']);});} \ No newline at end of file +var _0xd4e0=['defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','options','findAndCountAll','getGlobalCustomFields','addAgents','omit','emit','removeAgents','userCmList:remove','getAgents','spread','message','eml-format','rimraf','zip-dir','moment','bluebird','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/utils','../../config/environment','redis','defaults','localhost','./cmList.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','where','filter','merge','include','findAll','rows','catch','params','keys','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','body','describe','addDisposition','ListId','getDispositions','findOne','Disposition','nolimit','sort','pick','removeDispositions','ids','addContacts','tags','length','join','isArray','CmContact','success','dataValues','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','OrderBy','alias','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','select','additionalPhone_','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','push','toString','each','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','type','number','INTEGER','switch','BOOLEAN'];(function(_0x493a51,_0x45128c){var _0xc85756=function(_0x2c39a8){while(--_0x2c39a8){_0x493a51['push'](_0x493a51['shift']());}};_0xc85756(++_0x45128c);}(_0xd4e0,0xb0));var _0x0d4e=function(_0x222c4e,_0x157d73){_0x222c4e=_0x222c4e-0x0;var _0x231432=_0xd4e0[_0x222c4e];return _0x231432;};'use strict';var emlformat=require(_0x0d4e('0x0'));var rimraf=require(_0x0d4e('0x1'));var zipdir=require(_0x0d4e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d4e('0x3'));var BPromise=require(_0x0d4e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0d4e('0x5'));var sox=require(_0x0d4e('0x6'));var csv=require(_0x0d4e('0x7'));var ejs=require(_0x0d4e('0x8'));var fs=require('fs');var fs_extra=require(_0x0d4e('0x9'));var _=require(_0x0d4e('0xa'));var squel=require(_0x0d4e('0xb'));var crypto=require(_0x0d4e('0xc'));var jsforce=require(_0x0d4e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0d4e('0xe'));var Papa=require(_0x0d4e('0xf'));var Redis=require(_0x0d4e('0x10'));var authService=require(_0x0d4e('0x11'));var qs=require(_0x0d4e('0x12'));var as=require(_0x0d4e('0x13'));var hardwareService=require(_0x0d4e('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x0d4e('0x15'));var config=require(_0x0d4e('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var csv_results;config[_0x0d4e('0x17')]=_[_0x0d4e('0x18')](config[_0x0d4e('0x17')],{'host':_0x0d4e('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d4e('0x17')]));require(_0x0d4e('0x1a'))[_0x0d4e('0x1b')](socket);function respondWithStatusCode(_0x23c57c,_0x5465a4){_0x5465a4=_0x5465a4||0xcc;return function(_0x3b3718){if(_0x3b3718){return _0x23c57c[_0x0d4e('0x1c')](_0x5465a4);}return _0x23c57c['status'](_0x5465a4)[_0x0d4e('0x1d')]();};}function respondWithResult(_0x5a873e,_0x3a8621){_0x3a8621=_0x3a8621||0xc8;return function(_0x1d5cd8){if(_0x1d5cd8){return _0x5a873e[_0x0d4e('0x1e')](_0x3a8621)[_0x0d4e('0x1f')](_0x1d5cd8);}};}function respondWithFilteredResult(_0x31c1ab,_0x5d5280){return function(_0x127f90){if(_0x127f90){var _0x40a3c4=typeof _0x5d5280['offset']===_0x0d4e('0x20')&&typeof _0x5d5280[_0x0d4e('0x21')]===_0x0d4e('0x20');var _0x340202=_0x127f90['count'];var _0x13a282=_0x40a3c4?0x0:_0x5d5280['offset'];var _0x3c1b07=_0x40a3c4?_0x127f90[_0x0d4e('0x22')]:_0x5d5280[_0x0d4e('0x23')]+_0x5d5280[_0x0d4e('0x21')];var _0x90ae08;if(_0x3c1b07>=_0x340202){_0x3c1b07=_0x340202;_0x90ae08=0xc8;}else{_0x90ae08=0xce;}_0x31c1ab[_0x0d4e('0x1e')](_0x90ae08);return _0x31c1ab['set'](_0x0d4e('0x24'),_0x13a282+'-'+_0x3c1b07+'/'+_0x340202)[_0x0d4e('0x1f')](_0x127f90);}return null;};}function patchUpdates(_0x40ce04){return function(_0x2106f5){try{jsonpatch[_0x0d4e('0x25')](_0x2106f5,_0x40ce04,!![]);}catch(_0x3e0cdb){return BPromise[_0x0d4e('0x26')](_0x3e0cdb);}return _0x2106f5[_0x0d4e('0x27')]();};}function saveUpdates(_0x19db40,_0x32771d){return function(_0x45c111){if(_0x45c111){return _0x45c111[_0x0d4e('0x28')](_0x19db40)[_0x0d4e('0x29')](function(_0x85f64b){return _0x85f64b;});}return null;};}function removeEntity(_0x23631f,_0x214083){return function(_0x351d33){if(_0x351d33){return _0x351d33[_0x0d4e('0x2a')]()['then'](function(){var _0x405992=_0x351d33[_0x0d4e('0x2b')]({'plain':!![]});var _0x33c75d=_0x0d4e('0x2c');return db[_0x0d4e('0x2d')][_0x0d4e('0x2a')]({'where':{'type':_0x33c75d,'resourceId':_0x405992['id']}})[_0x0d4e('0x29')](function(){return _0x351d33;});})['then'](function(){_0x23631f['status'](0xcc)[_0x0d4e('0x1d')]();});}};}function handleEntityNotFound(_0x635b2a,_0x259192){return function(_0x4ea86c){if(!_0x4ea86c){_0x635b2a[_0x0d4e('0x1c')](0x194);}return _0x4ea86c;};}function handleError(_0x19899d,_0x2d9fb3){_0x2d9fb3=_0x2d9fb3||0x1f4;return function(_0x1e760c){logger[_0x0d4e('0x2e')](_0x1e760c[_0x0d4e('0x2f')]);if(_0x1e760c[_0x0d4e('0x30')]){delete _0x1e760c[_0x0d4e('0x30')];}_0x19899d[_0x0d4e('0x1e')](_0x2d9fb3)[_0x0d4e('0x31')](_0x1e760c);};}exports[_0x0d4e('0x32')]=function(_0x2299b9,_0x2a644d){var _0x483b1c={},_0x3980a7={},_0x16737f={'count':0x0,'rows':[]};var _0x21f754=_[_0x0d4e('0x33')](db[_0x0d4e('0x34')][_0x0d4e('0x35')],function(_0xb90e80){return{'name':_0xb90e80['fieldName'],'type':_0xb90e80['type']['key']};});_0x3980a7[_0x0d4e('0x36')]=_[_0x0d4e('0x33')](_0x21f754,_0x0d4e('0x30'));_0x3980a7[_0x0d4e('0x37')]=_['keys'](_0x2299b9[_0x0d4e('0x37')]);_0x3980a7[_0x0d4e('0x38')]=_[_0x0d4e('0x39')](_0x3980a7['model'],_0x3980a7[_0x0d4e('0x37')]);_0x483b1c[_0x0d4e('0x3a')]=_[_0x0d4e('0x39')](_0x3980a7['model'],qs['fields'](_0x2299b9[_0x0d4e('0x37')][_0x0d4e('0x3b')]));_0x483b1c['attributes']=_0x483b1c['attributes']['length']?_0x483b1c[_0x0d4e('0x3a')]:_0x3980a7[_0x0d4e('0x36')];if(!_0x2299b9[_0x0d4e('0x37')][_0x0d4e('0x3c')]('nolimit')){_0x483b1c[_0x0d4e('0x21')]=qs['limit'](_0x2299b9[_0x0d4e('0x37')]['limit']);_0x483b1c[_0x0d4e('0x23')]=qs['offset'](_0x2299b9[_0x0d4e('0x37')][_0x0d4e('0x23')]);}_0x483b1c[_0x0d4e('0x3d')]=qs['sort'](_0x2299b9[_0x0d4e('0x37')]['sort']);_0x483b1c[_0x0d4e('0x3e')]=qs[_0x0d4e('0x38')](_['pick'](_0x2299b9['query'],_0x3980a7[_0x0d4e('0x38')]),_0x21f754);if(_0x2299b9['query'][_0x0d4e('0x3f')]){_0x483b1c[_0x0d4e('0x3e')]=_[_0x0d4e('0x40')](_0x483b1c[_0x0d4e('0x3e')],{'$or':_[_0x0d4e('0x33')](_0x21f754,function(_0x4f57ea){if(_0x4f57ea['type']!=='VIRTUAL'){var _0xb8ea86={};_0xb8ea86[_0x4f57ea[_0x0d4e('0x30')]]={'$like':'%'+_0x2299b9[_0x0d4e('0x37')][_0x0d4e('0x3f')]+'%'};return _0xb8ea86;}})});}_0x483b1c=_[_0x0d4e('0x40')]({},_0x483b1c,_0x2299b9['options']);var _0x2d576e={'where':_0x483b1c[_0x0d4e('0x3e')]};return db[_0x0d4e('0x34')][_0x0d4e('0x22')](_0x2d576e)[_0x0d4e('0x29')](function(_0x2be412){_0x16737f[_0x0d4e('0x22')]=_0x2be412;if(_0x2299b9['query']['includeAll']){_0x483b1c[_0x0d4e('0x41')]=[{'all':!![]}];}return db[_0x0d4e('0x34')][_0x0d4e('0x42')](_0x483b1c);})[_0x0d4e('0x29')](function(_0x449132){_0x16737f[_0x0d4e('0x43')]=_0x449132;return _0x16737f;})[_0x0d4e('0x29')](respondWithFilteredResult(_0x2a644d,_0x483b1c))[_0x0d4e('0x44')](handleError(_0x2a644d,null));};exports['show']=function(_0x423606,_0xb92d5e){var _0x42a3a9={'raw':![],'where':{'id':_0x423606[_0x0d4e('0x45')]['id']}},_0x21993a={};_0x21993a[_0x0d4e('0x36')]=_[_0x0d4e('0x46')](db[_0x0d4e('0x34')][_0x0d4e('0x35')]);_0x21993a[_0x0d4e('0x37')]=_[_0x0d4e('0x46')](_0x423606[_0x0d4e('0x37')]);_0x21993a[_0x0d4e('0x38')]=_[_0x0d4e('0x39')](_0x21993a['model'],_0x21993a[_0x0d4e('0x37')]);_0x42a3a9[_0x0d4e('0x3a')]=_[_0x0d4e('0x39')](_0x21993a['model'],qs['fields'](_0x423606[_0x0d4e('0x37')]['fields']));_0x42a3a9[_0x0d4e('0x3a')]=_0x42a3a9[_0x0d4e('0x3a')]['length']?_0x42a3a9['attributes']:_0x21993a['model'];if(_0x423606[_0x0d4e('0x37')][_0x0d4e('0x47')]){_0x42a3a9[_0x0d4e('0x41')]=[{'all':!![]}];}_0x42a3a9=_['merge']({},_0x42a3a9,_0x423606['options']);return db[_0x0d4e('0x34')]['find'](_0x42a3a9)['then'](handleEntityNotFound(_0xb92d5e,null))['then'](respondWithResult(_0xb92d5e,null))[_0x0d4e('0x44')](handleError(_0xb92d5e,null));};exports[_0x0d4e('0x48')]=function(_0xa7dd21,_0x47ae91){return db[_0x0d4e('0x34')][_0x0d4e('0x48')](_0xa7dd21['body'],{})[_0x0d4e('0x29')](function(_0x1420a5){var _0x44e0ae=_0xa7dd21[_0x0d4e('0x49')]['get']({'plain':!![]});if(!_0x44e0ae)throw new Error(_0x0d4e('0x4a'));if(_0x44e0ae['role']===_0x0d4e('0x49')){var _0x5bdb32=_0x1420a5[_0x0d4e('0x2b')]({'plain':!![]});var _0x1ae130=_0x0d4e('0x2c');return db['UserProfileSection'][_0x0d4e('0x4b')]({'where':{'name':_0x1ae130,'userProfileId':_0x44e0ae[_0x0d4e('0x4c')]},'raw':!![]})[_0x0d4e('0x29')](function(_0x39eee8){if(_0x39eee8&&_0x39eee8[_0x0d4e('0x4d')]===0x0){return db[_0x0d4e('0x2d')][_0x0d4e('0x48')]({'name':_0x5bdb32[_0x0d4e('0x30')],'resourceId':_0x5bdb32['id'],'type':_0x39eee8[_0x0d4e('0x30')],'sectionId':_0x39eee8['id']},{})['then'](function(){return _0x1420a5;});}else{return _0x1420a5;}})['catch'](function(_0x186420){logger[_0x0d4e('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x186420);throw _0x186420;});}return _0x1420a5;})[_0x0d4e('0x29')](respondWithResult(_0x47ae91,0xc9))[_0x0d4e('0x44')](handleError(_0x47ae91,null));};exports[_0x0d4e('0x28')]=function(_0x44770c,_0x428746){if(_0x44770c[_0x0d4e('0x4e')]['id']){delete _0x44770c[_0x0d4e('0x4e')]['id'];}return db[_0x0d4e('0x34')][_0x0d4e('0x4b')]({'where':{'id':_0x44770c[_0x0d4e('0x45')]['id']}})['then'](handleEntityNotFound(_0x428746,null))[_0x0d4e('0x29')](saveUpdates(_0x44770c['body'],null))[_0x0d4e('0x29')](respondWithResult(_0x428746,null))['catch'](handleError(_0x428746,null));};exports['destroy']=function(_0x3cd755,_0x3c42b5){return db[_0x0d4e('0x34')]['find']({'where':{'id':_0x3cd755[_0x0d4e('0x45')]['id']}})[_0x0d4e('0x29')](handleEntityNotFound(_0x3c42b5,null))[_0x0d4e('0x29')](removeEntity(_0x3c42b5,null))[_0x0d4e('0x44')](handleError(_0x3c42b5,null));};exports[_0x0d4e('0x4f')]=function(_0x2e026f,_0x274612){return db[_0x0d4e('0x34')][_0x0d4e('0x4f')]()[_0x0d4e('0x29')](respondWithResult(_0x274612,null))[_0x0d4e('0x44')](handleError(_0x274612,null));};exports[_0x0d4e('0x50')]=function(_0x580e50,_0x2cfa3b,_0x4e9b46){if(_0x580e50[_0x0d4e('0x4e')]['id']){delete _0x580e50['body']['id'];}return db['CmList'][_0x0d4e('0x4b')]({'where':{'id':_0x580e50[_0x0d4e('0x45')]['id']}})[_0x0d4e('0x29')](handleEntityNotFound(_0x2cfa3b,null))[_0x0d4e('0x29')](function(_0x16b144){if(_0x16b144){_0x580e50[_0x0d4e('0x4e')][_0x0d4e('0x51')]=_0x16b144['id'];return db['Disposition'][_0x0d4e('0x48')](_0x580e50['body']);}})[_0x0d4e('0x29')](respondWithResult(_0x2cfa3b,null))[_0x0d4e('0x44')](handleError(_0x2cfa3b,null));};exports[_0x0d4e('0x52')]=function(_0x563d0a,_0x12ae9d,_0x1ebc35){var _0x51bba4={'raw':![],'where':{}};var _0x2c89a4={};var _0x570bc9={'count':0x0,'rows':[]};return db[_0x0d4e('0x34')][_0x0d4e('0x53')]({'where':{'id':_0x563d0a[_0x0d4e('0x45')]['id']}})[_0x0d4e('0x29')](handleEntityNotFound(_0x12ae9d,null))[_0x0d4e('0x29')](function(_0x50ffe4){if(_0x50ffe4){_0x2c89a4[_0x0d4e('0x36')]=_[_0x0d4e('0x46')](db[_0x0d4e('0x54')][_0x0d4e('0x35')]);_0x2c89a4[_0x0d4e('0x37')]=_[_0x0d4e('0x46')](_0x563d0a[_0x0d4e('0x37')]);_0x2c89a4[_0x0d4e('0x38')]=_[_0x0d4e('0x39')](_0x2c89a4[_0x0d4e('0x36')],_0x2c89a4[_0x0d4e('0x37')]);_0x51bba4[_0x0d4e('0x3a')]=_['intersection'](_0x2c89a4[_0x0d4e('0x36')],qs[_0x0d4e('0x3b')](_0x563d0a[_0x0d4e('0x37')]['fields']));_0x51bba4['attributes']=_0x51bba4['attributes']['length']?_0x51bba4[_0x0d4e('0x3a')]:_0x2c89a4[_0x0d4e('0x36')];if(!_0x563d0a[_0x0d4e('0x37')][_0x0d4e('0x3c')](_0x0d4e('0x55'))){_0x51bba4['limit']=qs[_0x0d4e('0x21')](_0x563d0a['query'][_0x0d4e('0x21')]);_0x51bba4['offset']=qs['offset'](_0x563d0a[_0x0d4e('0x37')][_0x0d4e('0x23')]);}_0x51bba4['order']=qs[_0x0d4e('0x56')](_0x563d0a[_0x0d4e('0x37')]['sort']);_0x51bba4['where']=qs[_0x0d4e('0x38')](_[_0x0d4e('0x57')](_0x563d0a[_0x0d4e('0x37')],_0x2c89a4[_0x0d4e('0x38')]));_0x51bba4[_0x0d4e('0x3e')][_0x0d4e('0x51')]=_0x50ffe4['id'];if(_0x563d0a[_0x0d4e('0x37')][_0x0d4e('0x3f')]){_0x51bba4[_0x0d4e('0x3e')]=_[_0x0d4e('0x40')](_0x51bba4['where'],{'$or':_[_0x0d4e('0x33')](_0x51bba4['attributes'],function(_0x33c44f){var _0x796a87={};_0x796a87[_0x33c44f]={'$like':'%'+_0x563d0a[_0x0d4e('0x37')][_0x0d4e('0x3f')]+'%'};return _0x796a87;})});}_0x51bba4=_[_0x0d4e('0x40')]({},_0x51bba4,_0x563d0a['options']);return db['Disposition'][_0x0d4e('0x22')]({'where':_0x51bba4[_0x0d4e('0x3e')]})['then'](function(_0x3ed24d){_0x570bc9[_0x0d4e('0x22')]=_0x3ed24d;if(_0x563d0a[_0x0d4e('0x37')]['includeAll']){_0x51bba4[_0x0d4e('0x41')]=[{'all':!![]}];}return db['Disposition'][_0x0d4e('0x42')](_0x51bba4);})[_0x0d4e('0x29')](function(_0xcc1816){_0x570bc9[_0x0d4e('0x43')]=_0xcc1816;return _0x570bc9;});}})[_0x0d4e('0x29')](respondWithFilteredResult(_0x12ae9d,_0x51bba4))[_0x0d4e('0x44')](handleError(_0x12ae9d,null));};exports[_0x0d4e('0x58')]=function(_0x250fd3,_0x346720,_0x5d2468){return db[_0x0d4e('0x34')]['find']({'where':{'id':_0x250fd3[_0x0d4e('0x45')]['id']}})[_0x0d4e('0x29')](handleEntityNotFound(_0x346720,null))[_0x0d4e('0x29')](function(_0x280153){if(_0x280153){return _0x280153[_0x0d4e('0x58')](_0x250fd3['query'][_0x0d4e('0x59')]);}})[_0x0d4e('0x29')](respondWithStatusCode(_0x346720,null))[_0x0d4e('0x44')](handleError(_0x346720,null));};exports[_0x0d4e('0x5a')]=function(_0x5889b7,_0x503114,_0x1a53b7){return db[_0x0d4e('0x34')]['find']({'where':{'id':_0x5889b7[_0x0d4e('0x45')]['id']}})[_0x0d4e('0x29')](handleEntityNotFound(_0x503114,null))[_0x0d4e('0x29')](function(_0x4d07c3){if(_0x4d07c3){var _0xd05b6d=[];var _0x398d99={'success':[],'errors':[]};return db['CmContact']['describe']()['then'](function(_0x4bfc61){if(_0x5889b7[_0x0d4e('0x4e')][_0x0d4e('0x5b')]&&_['isArray'](_0x5889b7[_0x0d4e('0x4e')]['tags'])){if(_0x5889b7[_0x0d4e('0x4e')][_0x0d4e('0x5b')][_0x0d4e('0x5c')]){_0x5889b7[_0x0d4e('0x4e')]['tags']=_0x5889b7['body'][_0x0d4e('0x5b')][_0x0d4e('0x5d')](';')+';';}else{_0x5889b7['body'][_0x0d4e('0x5b')]=null;}}else{_0x5889b7[_0x0d4e('0x4e')]['tags']=null;}if(_0x5889b7[_0x0d4e('0x4e')]&&_[_0x0d4e('0x5e')](_0x5889b7[_0x0d4e('0x4e')])){for(var _0x1f562e=0x0;_0x1f562e<_0x5889b7[_0x0d4e('0x4e')]['length'];_0x1f562e+=0x1){_0x5889b7[_0x0d4e('0x4e')][_0x1f562e]['ListId']=_0x5889b7['params']['id'];_0xd05b6d['push'](_0x5889b7[_0x0d4e('0x4e')][_0x1f562e]);}return BPromise['each'](_0xd05b6d,function(_0x2ae982){return db[_0x0d4e('0x5f')][_0x0d4e('0x48')](_['omit'](_0x2ae982,[_0x0d4e('0x59'),'id'])||{},{'fields':_[_0x0d4e('0x46')](_0x4bfc61),'raw':!![]})['then'](function(_0x204bb5){_0x398d99[_0x0d4e('0x60')]['push'](_0x204bb5[_0x0d4e('0x61')]);})[_0x0d4e('0x44')](function(_0x25a201){_0x398d99['errors']['push']({'data':_0x2ae982,'error':_0x25a201['message']});});})[_0x0d4e('0x29')](function(_0x151f8b){return _0x398d99;})[_0x0d4e('0x44')](function(_0x4ecfdd){return _0x4ecfdd;});}else{_0x503114[_0x0d4e('0x1e')](0x190)[_0x0d4e('0x1f')]({'message':_0x0d4e('0x62')});}});}})[_0x0d4e('0x29')](respondWithResult(_0x503114,null))['catch'](handleError(_0x503114,null));};exports[_0x0d4e('0x63')]=function(_0x1250e3,_0x9c0301,_0x264e54){var _0x3592ad;return db[_0x0d4e('0x34')][_0x0d4e('0x4b')]({'where':{'id':_0x1250e3[_0x0d4e('0x45')]['id']},'include':[{'model':db[_0x0d4e('0x64')],'as':'CustomFields'}]})[_0x0d4e('0x29')](handleEntityNotFound(_0x9c0301,null))[_0x0d4e('0x29')](function(_0x464c1e){if(_0x464c1e){_0x3592ad=_0x464c1e;return db[_0x0d4e('0x5f')][_0x0d4e('0x35')];}})[_0x0d4e('0x29')](function(_0x5494dc){if(_0x5494dc){var _0x5ca200={};var _0x1c4a78={};_0x1c4a78[_0x0d4e('0x36')]=_[_0x0d4e('0x65')](_['keys'](_0x5494dc),_[_0x0d4e('0x33')](_0x3592ad['CustomFields'],function(_0x2028ae){return util[_0x0d4e('0x66')](_0x0d4e('0x67'),_0x2028ae['id']);}));_0x1c4a78[_0x0d4e('0x37')]=_[_0x0d4e('0x46')](_0x1250e3['query']);_0x1c4a78[_0x0d4e('0x38')]=_['intersection'](_0x1c4a78[_0x0d4e('0x36')],_0x1c4a78['query']);_0x5ca200[_0x0d4e('0x3a')]=_[_0x0d4e('0x39')](_0x1c4a78['model'],qs[_0x0d4e('0x3b')](_0x1250e3['query']['fields']));_0x5ca200[_0x0d4e('0x3a')]=_0x5ca200['attributes'][_0x0d4e('0x5c')]?_0x5ca200['attributes']:_0x1c4a78['model'];if(!_0x1250e3['query'][_0x0d4e('0x3c')](_0x0d4e('0x55'))){_0x5ca200[_0x0d4e('0x21')]=qs[_0x0d4e('0x21')](_0x1250e3[_0x0d4e('0x37')][_0x0d4e('0x21')]);_0x5ca200[_0x0d4e('0x23')]=qs[_0x0d4e('0x23')](_0x1250e3[_0x0d4e('0x37')][_0x0d4e('0x23')]);}_0x5ca200['order']=qs[_0x0d4e('0x56')](_0x1250e3[_0x0d4e('0x37')][_0x0d4e('0x56')]);_0x5ca200[_0x0d4e('0x3e')]=qs['filters'](_['pick'](_0x1250e3[_0x0d4e('0x37')],_0x1c4a78['filters']));_0x5ca200[_0x0d4e('0x68')]=!![];if(_0x1250e3['query'][_0x0d4e('0x3f')]){_0x5ca200[_0x0d4e('0x3e')]=_[_0x0d4e('0x40')](_0x5ca200[_0x0d4e('0x3e')],{'$or':_[_0x0d4e('0x33')](_0x5ca200[_0x0d4e('0x3a')],function(_0x240b74){var _0x2322b4={};_0x2322b4[_0x240b74]={'$like':'%'+_0x1250e3['query'][_0x0d4e('0x3f')]+'%'};return _0x2322b4;})});}_0x5ca200=_[_0x0d4e('0x40')]({},_0x5ca200,_0x1250e3['options']);return _0x3592ad['getContacts'](_0x5ca200);}})[_0x0d4e('0x29')](respondWithResult(_0x9c0301,null))['catch'](handleError(_0x9c0301,null));};exports[_0x0d4e('0x69')]=function(_0x325007,_0x475876,_0xe92e17){var _0x177c86;var _0x53293b;var _0x1627dd;var _0x437493=_0x325007[_0x0d4e('0x45')]['id'];csv_results=[];return db[_0x0d4e('0x6a')][_0x0d4e('0x42')]({'attributes':['id',_0x0d4e('0x30')],'raw':!![],'order':[_0x0d4e('0x6b')]})['then'](function(_0x518cf1){_0x177c86=_0x518cf1;var _0x340a9e=_[_0x0d4e('0x46')](db['CmContact'][_0x0d4e('0x35')]);return db['CmCustomField'][_0x0d4e('0x42')]({'raw':!![],'attributes':['id',_0x0d4e('0x6c')]})[_0x0d4e('0x29')](function(_0x1b9d00){_0x53293b=_0x1b9d00;var _0x41adbd=squel['select']()[_0x0d4e('0x3b')](_0x340a9e)[_0x0d4e('0x6d')](_0x0d4e('0x6e'),'c')[_0x0d4e('0x3e')](_0x0d4e('0x6f'),_0x437493)['where'](_0x0d4e('0x70'))['distinct']();for(var _0x4cd381=0x0;_0x4cd381<_0x53293b[_0x0d4e('0x5c')];_0x4cd381++){_0x41adbd[_0x0d4e('0x71')](_0x0d4e('0x72')+_0x53293b[_0x4cd381]['id'],_0x0d4e('0x73')+_0x53293b[_0x4cd381][_0x0d4e('0x6c')]);}for(var _0x4cd381=0x0;_0x4cd381<_0x177c86[_0x0d4e('0x5c')];_0x4cd381++){_0x41adbd['field'](squel[_0x0d4e('0x74')]()[_0x0d4e('0x71')]('item')[_0x0d4e('0x6d')]('cm_contact_has_items')['where']('ItemTypeId\x20=\x20?',_0x177c86[_0x4cd381]['id'])[_0x0d4e('0x3e')]('CmContactId\x20=\x20c.id'),_0x0d4e('0x75')+_0x177c86[_0x4cd381][_0x0d4e('0x30')]);_0x41adbd[_0x0d4e('0x71')](squel[_0x0d4e('0x74')]()[_0x0d4e('0x71')]('description')[_0x0d4e('0x6d')](_0x0d4e('0x76'))[_0x0d4e('0x3e')](_0x0d4e('0x77'),_0x177c86[_0x4cd381]['id'])[_0x0d4e('0x3e')](_0x0d4e('0x78')),'description_additionalPhone_'+_0x177c86[_0x4cd381]['name']);}var _0x224888=[];_0x224888[_0x0d4e('0x79')](_0x41adbd[_0x0d4e('0x7a')]());BPromise[_0x0d4e('0x7b')](_0x224888,handleQuery)[_0x0d4e('0x29')](function(_0x12970d){handleQuery(_0x41adbd[_0x0d4e('0x7a')]());var _0x1caefa=csv_results[0x0];if(!_['isEmpty'](_0x1caefa)){var _0x475c7c=toCsv(_0x1caefa);var _0x1f6b1f=Date[_0x0d4e('0x7c')]();fs[_0x0d4e('0x7d')](util['format'](_0x0d4e('0x7e'),_0x437493,_0x1f6b1f),_0x475c7c);_0x475876[_0x0d4e('0x7f')](_0x0d4e('0x80'),_0x0d4e('0x81')+util[_0x0d4e('0x66')]('list_%d_%s.csv',_0x437493,_0x1f6b1f));_0x475876[_0x0d4e('0x7f')](_0x0d4e('0x82'),_0x0d4e('0x83'));return _0x475876['download'](util[_0x0d4e('0x66')](_0x0d4e('0x7e'),_0x437493,_0x1f6b1f));}else{return _0x475876['sendStatus'](0xcc);}});});});};exports[_0x0d4e('0x84')]=function(_0x1f3476,_0x24cc66,_0x486d5a){var _0x5e0d90;delete _0x1f3476[_0x0d4e('0x4e')]['id'];return db[_0x0d4e('0x34')]['findOne']({'where':{'id':_0x1f3476[_0x0d4e('0x45')]['id']}})[_0x0d4e('0x29')](handleEntityNotFound(_0x24cc66,null))[_0x0d4e('0x29')](function(_0x15928c){if(_0x15928c){return db[_0x0d4e('0x85')][_0x0d4e('0x86')](function(_0x365586){return db['CmCustomField'][_0x0d4e('0x48')](_0x1f3476[_0x0d4e('0x4e')],{'transaction':_0x365586})[_0x0d4e('0x29')](function(_0x2b1bc5){_0x5e0d90=_0x2b1bc5;return _0x15928c[_0x0d4e('0x87')](_0x2b1bc5,{'transaction':_0x365586});})[_0x0d4e('0x29')](function(){var _0x3647d5={'type':db[_0x0d4e('0x88')][_0x0d4e('0x89')],'transaction':_0x365586};switch(_0x1f3476[_0x0d4e('0x4e')]['type']){case _0x0d4e('0x8a'):_0x3647d5[_0x0d4e('0x8b')]=db[_0x0d4e('0x88')][_0x0d4e('0x89')];break;case _0x0d4e('0x8c'):_0x3647d5['type']=db[_0x0d4e('0x88')][_0x0d4e('0x8d')];break;case _0x0d4e('0x8e'):_0x3647d5[_0x0d4e('0x8b')]=db[_0x0d4e('0x88')][_0x0d4e('0x8f')];_0x3647d5[_0x0d4e('0x90')]=![];break;default:}return db[_0x0d4e('0x85')][_0x0d4e('0x91')][_0x0d4e('0x92')]('cm_contacts',util['format'](_0x0d4e('0x93'),_0x5e0d90['id']),_0x3647d5);})[_0x0d4e('0x29')](function(){return _0x5e0d90;});});}})[_0x0d4e('0x29')](respondWithResult(_0x24cc66,null))['catch'](handleError(_0x24cc66,null));};exports[_0x0d4e('0x94')]=function(_0x2ac95d,_0x516029,_0x3d167e){var _0x5bcfa0={};var _0x1f0960={};var _0x2ff32a;var _0x3b419c;return db['CmList'][_0x0d4e('0x53')]({'where':{'id':_0x2ac95d[_0x0d4e('0x45')]['id']}})[_0x0d4e('0x29')](handleEntityNotFound(_0x516029,null))[_0x0d4e('0x29')](function(_0x3436ec){if(_0x3436ec){_0x2ff32a=_0x3436ec;_0x1f0960[_0x0d4e('0x36')]=_[_0x0d4e('0x46')](db[_0x0d4e('0x64')][_0x0d4e('0x35')]);_0x1f0960[_0x0d4e('0x37')]=_['keys'](_0x2ac95d[_0x0d4e('0x37')]);_0x1f0960[_0x0d4e('0x38')]=_[_0x0d4e('0x39')](_0x1f0960[_0x0d4e('0x36')],_0x1f0960[_0x0d4e('0x37')]);_0x5bcfa0['attributes']=_[_0x0d4e('0x39')](_0x1f0960[_0x0d4e('0x36')],qs[_0x0d4e('0x3b')](_0x2ac95d[_0x0d4e('0x37')][_0x0d4e('0x3b')]));_0x5bcfa0[_0x0d4e('0x3a')]=_0x5bcfa0[_0x0d4e('0x3a')][_0x0d4e('0x5c')]?_0x5bcfa0['attributes']:_0x1f0960[_0x0d4e('0x36')];_0x5bcfa0[_0x0d4e('0x3d')]=qs[_0x0d4e('0x56')](_0x2ac95d[_0x0d4e('0x37')][_0x0d4e('0x56')]);_0x5bcfa0[_0x0d4e('0x3e')]=qs[_0x0d4e('0x38')](_['pick'](_0x2ac95d[_0x0d4e('0x37')],_0x1f0960[_0x0d4e('0x38')]));_0x5bcfa0['where']=_[_0x0d4e('0x40')](_0x5bcfa0[_0x0d4e('0x3e')],{'$or':[{'ListId':_0x3436ec['id']},{'ListId':null}]});if(_0x2ac95d[_0x0d4e('0x37')][_0x0d4e('0x3f')]){_0x5bcfa0[_0x0d4e('0x3e')]=_['merge'](_0x5bcfa0['where'],{'$or':_['map'](_0x5bcfa0['attributes'],function(_0x2bc496){var _0x141bcb={};_0x141bcb[_0x2bc496]={'$like':'%'+_0x2ac95d[_0x0d4e('0x37')]['filter']+'%'};return _0x141bcb;})});}_0x5bcfa0=_[_0x0d4e('0x40')]({},_0x5bcfa0,_0x2ac95d[_0x0d4e('0x95')]);return db[_0x0d4e('0x64')][_0x0d4e('0x96')](_0x5bcfa0);}})[_0x0d4e('0x29')](respondWithResult(_0x516029,null))[_0x0d4e('0x44')](handleError(_0x516029,null));};exports[_0x0d4e('0x97')]=function(_0x36a9ff,_0x15aac1){return db[_0x0d4e('0x64')][_0x0d4e('0x96')]({'where':{'ListId':null}})[_0x0d4e('0x29')](handleEntityNotFound(_0x15aac1,null))[_0x0d4e('0x29')](function(_0x2d9d07){return _0x2d9d07;})[_0x0d4e('0x29')](respondWithResult(_0x15aac1,null))[_0x0d4e('0x44')](handleError(_0x15aac1,null));};exports[_0x0d4e('0x98')]=function(_0x54419d,_0x21ade7,_0x1b3c33){return db['CmList'][_0x0d4e('0x4b')]({'where':{'id':_0x54419d[_0x0d4e('0x45')]['id']}})[_0x0d4e('0x29')](handleEntityNotFound(_0x21ade7,null))[_0x0d4e('0x29')](function(_0x4213e4){if(_0x4213e4){return _0x4213e4['addAgents'](_0x54419d['body']['ids'],_[_0x0d4e('0x99')](_0x54419d[_0x0d4e('0x4e')],['ids','id'])||{})['spread'](function(_0x120300){for(var _0x17ccdf=0x0;_0x17ccdf<_0x54419d[_0x0d4e('0x4e')][_0x0d4e('0x59')]['length'];_0x17ccdf+=0x1){socket[_0x0d4e('0x9a')]('userCmList:save',{'UserId':Number(_0x54419d[_0x0d4e('0x4e')][_0x0d4e('0x59')][_0x17ccdf]),'CmListId':Number(_0x54419d[_0x0d4e('0x45')]['id'])});}return _0x120300;});}})[_0x0d4e('0x29')](respondWithResult(_0x21ade7,null))['catch'](handleError(_0x21ade7,null));};exports[_0x0d4e('0x9b')]=function(_0x128206,_0x156c0a,_0x1a9ca3){return db['CmList'][_0x0d4e('0x4b')]({'where':{'id':_0x128206[_0x0d4e('0x45')]['id']}})['then'](handleEntityNotFound(_0x156c0a,null))['then'](function(_0x48ca6f){if(_0x48ca6f){return _0x48ca6f[_0x0d4e('0x9b')](_0x128206[_0x0d4e('0x37')][_0x0d4e('0x59')])[_0x0d4e('0x29')](function(){if(_[_0x0d4e('0x5e')](_0x128206['query'][_0x0d4e('0x59')])){for(var _0x4e8cfb=0x0;_0x4e8cfb<_0x128206['query'][_0x0d4e('0x59')]['length'];_0x4e8cfb+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x128206[_0x0d4e('0x37')][_0x0d4e('0x59')][_0x4e8cfb]),'CmListId':Number(_0x128206[_0x0d4e('0x45')]['id'])});}}else{socket[_0x0d4e('0x9a')](_0x0d4e('0x9c'),{'UserId':Number(_0x128206[_0x0d4e('0x37')]['ids']),'CmListId':Number(_0x128206[_0x0d4e('0x45')]['id'])});}});}})[_0x0d4e('0x29')](respondWithStatusCode(_0x156c0a,null))['catch'](handleError(_0x156c0a,null));};exports[_0x0d4e('0x9d')]=function(_0x5ea443,_0x69d83d,_0x218330){var _0x5502fc={};var _0x2be0dd={};var _0x1c4ab8;var _0x2e0b0b;return db[_0x0d4e('0x34')][_0x0d4e('0x53')]({'where':{'id':_0x5ea443[_0x0d4e('0x45')]['id']}})[_0x0d4e('0x29')](handleEntityNotFound(_0x69d83d,null))['then'](function(_0x429c81){if(_0x429c81){_0x1c4ab8=_0x429c81;_0x2be0dd['model']=_[_0x0d4e('0x46')](db['User']['rawAttributes']);_0x2be0dd['query']=_[_0x0d4e('0x46')](_0x5ea443[_0x0d4e('0x37')]);_0x2be0dd[_0x0d4e('0x38')]=_[_0x0d4e('0x39')](_0x2be0dd[_0x0d4e('0x36')],_0x2be0dd[_0x0d4e('0x37')]);_0x5502fc['attributes']=_[_0x0d4e('0x39')](_0x2be0dd[_0x0d4e('0x36')],qs[_0x0d4e('0x3b')](_0x5ea443[_0x0d4e('0x37')][_0x0d4e('0x3b')]));_0x5502fc['attributes']=_0x5502fc['attributes'][_0x0d4e('0x5c')]?_0x5502fc[_0x0d4e('0x3a')]:_0x2be0dd[_0x0d4e('0x36')];_0x5502fc[_0x0d4e('0x3d')]=qs[_0x0d4e('0x56')](_0x5ea443[_0x0d4e('0x37')]['sort']);_0x5502fc[_0x0d4e('0x3e')]=qs[_0x0d4e('0x38')](_['pick'](_0x5ea443[_0x0d4e('0x37')],_0x2be0dd['filters']));if(_0x5ea443['query'][_0x0d4e('0x3f')]){_0x5502fc[_0x0d4e('0x3e')]=_['merge'](_0x5502fc['where'],{'$or':_[_0x0d4e('0x33')](_0x5502fc[_0x0d4e('0x3a')],function(_0x2c1cb3){var _0x5bdcd6={};_0x5bdcd6[_0x2c1cb3]={'$like':'%'+_0x5ea443[_0x0d4e('0x37')][_0x0d4e('0x3f')]+'%'};return _0x5bdcd6;})});}_0x5502fc=_[_0x0d4e('0x40')]({},_0x5502fc,_0x5ea443[_0x0d4e('0x95')]);return _0x1c4ab8[_0x0d4e('0x9d')](_0x5502fc);}})[_0x0d4e('0x29')](function(_0x2c8b44){if(_0x2c8b44){_0x2e0b0b=_0x2c8b44[_0x0d4e('0x5c')];if(!_0x5ea443[_0x0d4e('0x37')][_0x0d4e('0x3c')](_0x0d4e('0x55'))){_0x5502fc[_0x0d4e('0x21')]=qs[_0x0d4e('0x21')](_0x5ea443[_0x0d4e('0x37')][_0x0d4e('0x21')]);_0x5502fc['offset']=qs[_0x0d4e('0x23')](_0x5ea443[_0x0d4e('0x37')][_0x0d4e('0x23')]);}return _0x1c4ab8[_0x0d4e('0x9d')](_0x5502fc);}})[_0x0d4e('0x29')](function(_0x4d36fe){if(_0x4d36fe){return _0x4d36fe?{'count':_0x2e0b0b,'rows':_0x4d36fe}:null;}})[_0x0d4e('0x29')](respondWithResult(_0x69d83d,null))[_0x0d4e('0x44')](handleError(_0x69d83d,null));};function handleQuery(_0x4b280f){logger['info'](_0x4b280f);return db[_0x0d4e('0x85')]['query'](_0x4b280f)[_0x0d4e('0x9e')](function(_0x3c113f){csv_results[_0x0d4e('0x79')](_0x3c113f);})['catch'](function(_0x5a9848){logger['error'](_0x5a9848[_0x0d4e('0x9f')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 551d140..a0b33fc 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x2bc7cc,_0x25cfd3){_0x2bc7cc=_0x2bc7cc-0x0;var _0x3de177=_0x3e74[_0x2bc7cc];return _0x3de177;};'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 _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x4c77e8,_0x1b25c7){_0x4c77e8=_0x4c77e8-0x0;var _0x4cc76b=_0x3e74[_0x4c77e8];return _0x4cc76b;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 34f569e..f70d684 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 _0xee5b=['request-promise','path','rimraf','exports','define','lodash','../../config/logger','api','bluebird'];(function(_0x38a6e6,_0x13b905){var _0x3566a8=function(_0x5804b3){while(--_0x5804b3){_0x38a6e6['push'](_0x38a6e6['shift']());}};_0x3566a8(++_0x13b905);}(_0xee5b,0x1f4));var _0xbee5=function(_0x4bbd6b,_0x4fd360){_0x4bbd6b=_0x4bbd6b-0x0;var _0x4b4528=_0xee5b[_0x4bbd6b];return _0x4b4528;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var logger=require(_0xbee5('0x1'))(_0xbee5('0x2'));var moment=require('moment');var BPromise=require(_0xbee5('0x3'));var rp=require(_0xbee5('0x4'));var fs=require('fs');var path=require(_0xbee5('0x5'));var rimraf=require(_0xbee5('0x6'));var config=require('../../config/environment');var attributes=require('./cmList.attributes');module[_0xbee5('0x7')]=function(_0x2c0bde,_0xab6e4d){return _0x2c0bde[_0xbee5('0x8')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55e0=['./cmList.attributes','exports','define','cm_lists','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x55e0,0xdc));var _0x055e=function(_0x3cbd4f,_0x1eaf24){_0x3cbd4f=_0x3cbd4f-0x0;var _0x4ed6f2=_0x55e0[_0x3cbd4f];return _0x4ed6f2;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var logger=require(_0x055e('0x2'))(_0x055e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x055e('0x4'));var fs=require('fs');var path=require(_0x055e('0x5'));var rimraf=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var attributes=require(_0x055e('0x8'));module[_0x055e('0x9')]=function(_0x490ee1,_0x5239f6){return _0x490ee1[_0x055e('0xa')]('CmList',attributes,{'tableName':_0x055e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 1de50db..47c2914 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 _0x4a7f=['./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter'];(function(_0x27e7e2,_0x3ddb8a){var _0x55431f=function(_0xb012a2){while(--_0xb012a2){_0x27e7e2['push'](_0x27e7e2['shift']());}};_0x55431f(++_0x3ddb8a);}(_0x4a7f,0xfe));var _0xf4a7=function(_0x2fe999,_0x372c9c){_0x2fe999=_0x2fe999-0x0;var _0x1748c9=_0x4a7f[_0x2fe999];return _0x1748c9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf4a7('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4a7('0x1'))['db'];var utils=require(_0xf4a7('0x2'));var logger=require(_0xf4a7('0x3'))('rpc');var config=require(_0xf4a7('0x4'));var jayson=require(_0xf4a7('0x5'));var client=jayson[_0xf4a7('0x6')]['http']({'port':0x232a});config[_0xf4a7('0x7')]=_['defaults'](config[_0xf4a7('0x7')],{'host':_0xf4a7('0x8'),'port':0x18eb});var socket=require(_0xf4a7('0x9'))(new Redis(config[_0xf4a7('0x7')]));require(_0xf4a7('0xa'))[_0xf4a7('0xb')](socket);function respondWithRpcPromise(_0x5a6a71,_0x2cd814,_0x593200){return new BPromise(function(_0x1c9d1f,_0x555744){return client[_0xf4a7('0xc')](_0x5a6a71,_0x593200)[_0xf4a7('0xd')](function(_0x39eb40){logger[_0xf4a7('0xe')](_0xf4a7('0xf'),_0x2cd814,_0xf4a7('0x10'));logger['debug']('CmList,\x20%s,\x20%s,\x20%s',_0x2cd814,_0xf4a7('0x10'),JSON[_0xf4a7('0x11')](_0x39eb40));if(_0x39eb40[_0xf4a7('0x12')]){if(_0x39eb40[_0xf4a7('0x12')][_0xf4a7('0x13')]===0x1f4){logger['error'](_0xf4a7('0xf'),_0x2cd814,_0x39eb40['error']['message']);return _0x555744(_0x39eb40[_0xf4a7('0x12')]['message']);}logger[_0xf4a7('0x12')](_0xf4a7('0xf'),_0x2cd814,_0x39eb40['error'][_0xf4a7('0x14')]);return _0x1c9d1f(_0x39eb40['error'][_0xf4a7('0x14')]);}else{logger[_0xf4a7('0xe')](_0xf4a7('0xf'),_0x2cd814,'request\x20sent');_0x1c9d1f(_0x39eb40['result']['message']);}})[_0xf4a7('0x15')](function(_0xa3459){logger['error'](_0xf4a7('0xf'),_0x2cd814,_0xa3459);_0x555744(_0xa3459);});});} \ No newline at end of file +var _0x1930=['defaults','localhost','socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0x4e8174,_0x2d9cbc){var _0x4d719c=function(_0x2c45e7){while(--_0x2c45e7){_0x4e8174['push'](_0x4e8174['shift']());}};_0x4d719c(++_0x2d9cbc);}(_0x1930,0x1ae));var _0x0193=function(_0x42c21a,_0x3295be){_0x42c21a=_0x42c21a-0x0;var _0x247ee9=_0x1930[_0x42c21a];return _0x247ee9;};'use strict';var _=require(_0x0193('0x0'));var util=require(_0x0193('0x1'));var moment=require(_0x0193('0x2'));var BPromise=require(_0x0193('0x3'));var rs=require(_0x0193('0x4'));var fs=require('fs');var Redis=require(_0x0193('0x5'));var db=require(_0x0193('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0193('0x7'));var config=require(_0x0193('0x8'));var jayson=require(_0x0193('0x9'));var client=jayson[_0x0193('0xa')]['http']({'port':0x232a});config[_0x0193('0xb')]=_[_0x0193('0xc')](config[_0x0193('0xb')],{'host':_0x0193('0xd'),'port':0x18eb});var socket=require(_0x0193('0xe'))(new Redis(config['redis']));require(_0x0193('0xf'))[_0x0193('0x10')](socket);function respondWithRpcPromise(_0x29e7f8,_0x56cf42,_0x3b3b42){return new BPromise(function(_0x52dfad,_0x1fc5e6){return client['request'](_0x29e7f8,_0x3b3b42)[_0x0193('0x11')](function(_0x48ded0){logger[_0x0193('0x12')](_0x0193('0x13'),_0x56cf42,_0x0193('0x14'));logger['debug'](_0x0193('0x15'),_0x56cf42,'request\x20sent',JSON['stringify'](_0x48ded0));if(_0x48ded0[_0x0193('0x16')]){if(_0x48ded0['error'][_0x0193('0x17')]===0x1f4){logger[_0x0193('0x16')](_0x0193('0x13'),_0x56cf42,_0x48ded0['error'][_0x0193('0x18')]);return _0x1fc5e6(_0x48ded0[_0x0193('0x16')][_0x0193('0x18')]);}logger[_0x0193('0x16')]('CmList,\x20%s,\x20%s',_0x56cf42,_0x48ded0[_0x0193('0x16')]['message']);return _0x52dfad(_0x48ded0['error'][_0x0193('0x18')]);}else{logger['info'](_0x0193('0x13'),_0x56cf42,_0x0193('0x14'));_0x52dfad(_0x48ded0[_0x0193('0x19')][_0x0193('0x18')]);}})['catch'](function(_0x31960a){logger['error']('CmList,\x20%s,\x20%s',_0x56cf42,_0x31960a);_0x1fc5e6(_0x31960a);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index c6fd50b..aac2362 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 _0xc0c0=['cmList:','./cmList.events','save','remove','emit','removeListener','register'];(function(_0x3cb872,_0x4b26e2){var _0x288d59=function(_0x30276e){while(--_0x30276e){_0x3cb872['push'](_0x3cb872['shift']());}};_0x288d59(++_0x4b26e2);}(_0xc0c0,0x127));var _0x0c0c=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xc0c0[_0xaa1b3e];return _0x454d7d;};'use strict';var CmListEvents=require(_0x0c0c('0x0'));var events=[_0x0c0c('0x1'),_0x0c0c('0x2'),'update'];function createListener(_0x442a4e,_0x3a413f){return function(_0x34196a){_0x3a413f[_0x0c0c('0x3')](_0x442a4e,_0x34196a);};}function removeListener(_0x18a567,_0x18be93){return function(){CmListEvents[_0x0c0c('0x4')](_0x18a567,_0x18be93);};}exports[_0x0c0c('0x5')]=function(_0x2dd4f5){for(var _0x5cefc3=0x0,_0x3f922c=events['length'];_0x5cefc3<_0x3f922c;_0x5cefc3++){var _0x4352b2=events[_0x5cefc3];var _0x1afe98=createListener(_0x0c0c('0x6')+_0x4352b2,_0x2dd4f5);CmListEvents['on'](_0x4352b2,_0x1afe98);}}; \ No newline at end of file +var _0x43da=['remove','update','register','length','cmList:','./cmList.events','save'];(function(_0x3e929f,_0x67373){var _0x245c49=function(_0x5d34ab){while(--_0x5d34ab){_0x3e929f['push'](_0x3e929f['shift']());}};_0x245c49(++_0x67373);}(_0x43da,0xd7));var _0xa43d=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x43da[_0x56916d];return _0x2b7f1f;};'use strict';var CmListEvents=require(_0xa43d('0x0'));var events=[_0xa43d('0x1'),_0xa43d('0x2'),_0xa43d('0x3')];function createListener(_0x5820cd,_0x132c5a){return function(_0x50a90f){_0x132c5a['emit'](_0x5820cd,_0x50a90f);};}function removeListener(_0x444b0c,_0x31bd34){return function(){CmListEvents['removeListener'](_0x444b0c,_0x31bd34);};}exports[_0xa43d('0x4')]=function(_0x5d2fbb){for(var _0x2f32cc=0x0,_0x3454c6=events[_0xa43d('0x5')];_0x2f32cc<_0x3454c6;_0x2f32cc++){var _0x556da2=events[_0x2f32cc];var _0x4e89b2=createListener(_0xa43d('0x6')+_0x556da2,_0x5d2fbb);CmListEvents['on'](_0x556da2,_0x4e89b2);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 3495dc1..03f4d5f 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 _0x98fc=['removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','/:id/contacts','getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','addDisposition','addContacts','addCustomField','addAgents','delete','destroy','removeDispositions'];(function(_0x52a970,_0x22327c){var _0x31e6b2=function(_0x22d09f){while(--_0x22d09f){_0x52a970['push'](_0x52a970['shift']());}};_0x31e6b2(++_0x22327c);}(_0x98fc,0x156));var _0xc98f=function(_0x3dff0d,_0x4d59ff){_0x3dff0d=_0x3dff0d-0x0;var _0x352383=_0x98fc[_0x3dff0d];return _0x352383;};'use strict';var multer=require(_0xc98f('0x0'));var util=require(_0xc98f('0x1'));var path=require(_0xc98f('0x2'));var timeout=require(_0xc98f('0x3'));var express=require(_0xc98f('0x4'));var router=express['Router']();var fs_extra=require(_0xc98f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc98f('0x6'));var config=require('../../config/environment');var controller=require(_0xc98f('0x7'));router[_0xc98f('0x8')]('/',auth[_0xc98f('0x9')](),controller[_0xc98f('0xa')]);router[_0xc98f('0x8')](_0xc98f('0xb'),auth[_0xc98f('0x9')](),controller[_0xc98f('0xc')]);router[_0xc98f('0x8')](_0xc98f('0xd'),auth['isAuthenticated'](),controller[_0xc98f('0xe')]);router['get'](_0xc98f('0xf'),auth[_0xc98f('0x9')](),controller[_0xc98f('0x10')]);router[_0xc98f('0x8')](_0xc98f('0x11'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xc98f('0x8')](_0xc98f('0x12'),auth[_0xc98f('0x9')](),controller[_0xc98f('0x13')]);router[_0xc98f('0x8')]('/:id/contacts/csv',auth[_0xc98f('0x9')](),controller[_0xc98f('0x14')]);router['get'](_0xc98f('0x15'),auth[_0xc98f('0x9')](),controller[_0xc98f('0x16')]);router[_0xc98f('0x8')](_0xc98f('0x17'),auth[_0xc98f('0x9')](),controller['getAgents']);router[_0xc98f('0x18')]('/',auth[_0xc98f('0x9')](),controller['create']);router[_0xc98f('0x18')]('/:id/dispositions',auth[_0xc98f('0x9')](),controller[_0xc98f('0x19')]);router['post'](_0xc98f('0x12'),auth[_0xc98f('0x9')](),controller[_0xc98f('0x1a')]);router['post']('/:id/fields',auth[_0xc98f('0x9')](),controller[_0xc98f('0x1b')]);router[_0xc98f('0x18')](_0xc98f('0x17'),auth[_0xc98f('0x9')](),controller[_0xc98f('0x1c')]);router['put'](_0xc98f('0xf'),auth[_0xc98f('0x9')](),controller['update']);router[_0xc98f('0x1d')](_0xc98f('0xf'),auth[_0xc98f('0x9')](),controller[_0xc98f('0x1e')]);router[_0xc98f('0x1d')]('/:id/dispositions',auth[_0xc98f('0x9')](),controller[_0xc98f('0x1f')]);router[_0xc98f('0x1d')](_0xc98f('0x17'),auth[_0xc98f('0x9')](),controller[_0xc98f('0x20')]);module[_0xc98f('0x21')]=router; \ No newline at end of file +var _0x90c7=['getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','addDisposition','post','addContacts','addCustomField','put','update','delete','destroy','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','/describe','describe','/global_fields','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContacts'];(function(_0x37053a,_0x4f77c4){var _0x29342e=function(_0x46446f){while(--_0x46446f){_0x37053a['push'](_0x37053a['shift']());}};_0x29342e(++_0x4f77c4);}(_0x90c7,0x9c));var _0x790c=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x90c7[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x790c('0x0'));var util=require(_0x790c('0x1'));var path=require(_0x790c('0x2'));var timeout=require(_0x790c('0x3'));var express=require(_0x790c('0x4'));var router=express[_0x790c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x790c('0x6'));var interaction=require(_0x790c('0x7'));var config=require('../../config/environment');var controller=require(_0x790c('0x8'));router[_0x790c('0x9')]('/',auth[_0x790c('0xa')](),controller['index']);router[_0x790c('0x9')](_0x790c('0xb'),auth[_0x790c('0xa')](),controller[_0x790c('0xc')]);router[_0x790c('0x9')](_0x790c('0xd'),auth[_0x790c('0xa')](),controller['getGlobalCustomFields']);router[_0x790c('0x9')](_0x790c('0xe'),auth['isAuthenticated'](),controller['show']);router['get'](_0x790c('0xf'),auth[_0x790c('0xa')](),controller[_0x790c('0x10')]);router[_0x790c('0x9')](_0x790c('0x11'),auth[_0x790c('0xa')](),controller[_0x790c('0x12')]);router['get']('/:id/contacts/csv',auth['isAuthenticated'](),controller[_0x790c('0x13')]);router[_0x790c('0x9')](_0x790c('0x14'),auth[_0x790c('0xa')](),controller[_0x790c('0x15')]);router[_0x790c('0x9')](_0x790c('0x16'),auth[_0x790c('0xa')](),controller[_0x790c('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0x790c('0x18')]);router['post'](_0x790c('0xf'),auth['isAuthenticated'](),controller[_0x790c('0x19')]);router[_0x790c('0x1a')](_0x790c('0x11'),auth[_0x790c('0xa')](),controller[_0x790c('0x1b')]);router[_0x790c('0x1a')](_0x790c('0x14'),auth['isAuthenticated'](),controller[_0x790c('0x1c')]);router[_0x790c('0x1a')](_0x790c('0x16'),auth[_0x790c('0xa')](),controller['addAgents']);router[_0x790c('0x1d')](_0x790c('0xe'),auth[_0x790c('0xa')](),controller[_0x790c('0x1e')]);router[_0x790c('0x1f')]('/:id',auth[_0x790c('0xa')](),controller[_0x790c('0x20')]);router[_0x790c('0x1f')](_0x790c('0xf'),auth[_0x790c('0xa')](),controller[_0x790c('0x21')]);router['delete'](_0x790c('0x16'),auth[_0x790c('0xa')](),controller['removeAgents']);module[_0x790c('0x22')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index eea9280..f79a63a 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 _0x38d2=['exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x5053c6,_0x5450e3){var _0x4d2106=function(_0x50222e){while(--_0x50222e){_0x5053c6['push'](_0x5053c6['shift']());}};_0x4d2106(++_0x5450e3);}(_0x38d2,0x118));var _0x238d=function(_0x7b8885,_0x2694be){_0x7b8885=_0x7b8885-0x0;var _0x28eb4e=_0x38d2[_0x7b8885];return _0x28eb4e;};'use strict';var Sequelize=require('sequelize');module[_0x238d('0x0')]={'name':{'type':Sequelize[_0x238d('0x1')],'get':function(_0x505e99){return this[_0x238d('0x2')](_0x238d('0x3'));}},'field':{'type':Sequelize[_0x238d('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x238d('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x0bc8=['getDataValue','field','STRING','sequelize','VIRTUAL'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x0bc8,0x1d9));var _0x80bc=function(_0x51fac7,_0x3c7250){_0x51fac7=_0x51fac7-0x0;var _0x3c302b=_0x0bc8[_0x51fac7];return _0x3c302b;};'use strict';var Sequelize=require(_0x80bc('0x0'));module['exports']={'name':{'type':Sequelize[_0x80bc('0x1')],'get':function(_0x512641){return this[_0x80bc('0x2')](_0x80bc('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x80bc('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index c995bcd..2bdd7ef 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(_0x26bee4,_0x1b6954){var _0x49a491=function(_0x175a92){while(--_0x175a92){_0x26bee4['push'](_0x26bee4['shift']());}};_0x49a491(++_0x1b6954);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'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 _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x2f1b23,_0xa206c8){var _0x1ed58d=function(_0x4d26e3){while(--_0x4d26e3){_0x2f1b23['push'](_0x2f1b23['shift']());}};_0x1ed58d(++_0xa206c8);}(_0x7a54,0x106));var _0x47a5=function(_0x3314bb,_0x1acdab){_0x3314bb=_0x3314bb-0x0;var _0x154833=_0x7a54[_0x3314bb];return _0x154833;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index c7b9bcb..b22f494 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 _0xbc47=['api','moment','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger'];(function(_0x42689c,_0x2dafd1){var _0x3e4902=function(_0x4e2964){while(--_0x4e2964){_0x42689c['push'](_0x42689c['shift']());}};_0x3e4902(++_0x2dafd1);}(_0xbc47,0x193));var _0x7bc4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xbc47[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x7bc4('0x0'));var util=require(_0x7bc4('0x1'));var logger=require(_0x7bc4('0x2'))(_0x7bc4('0x3'));var moment=require(_0x7bc4('0x4'));var BPromise=require('bluebird');var rp=require(_0x7bc4('0x5'));var fs=require('fs');var path=require(_0x7bc4('0x6'));var rimraf=require(_0x7bc4('0x7'));var config=require(_0x7bc4('0x8'));var attributes=require(_0x7bc4('0x9'));module[_0x7bc4('0xa')]=function(_0x5cac08,_0x17c596){return _0x5cac08[_0x7bc4('0xb')](_0x7bc4('0xc'),attributes,{'tableName':_0x7bc4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3e3=['Condition','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./condition.attributes','exports','define'];(function(_0x2f3683,_0x398028){var _0x376933=function(_0x4ef656){while(--_0x4ef656){_0x2f3683['push'](_0x2f3683['shift']());}};_0x376933(++_0x398028);}(_0xe3e3,0x79));var _0x3e3e=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xe3e3[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x3e3e('0x0'));var util=require('util');var logger=require(_0x3e3e('0x1'))(_0x3e3e('0x2'));var moment=require(_0x3e3e('0x3'));var BPromise=require(_0x3e3e('0x4'));var rp=require(_0x3e3e('0x5'));var fs=require('fs');var path=require(_0x3e3e('0x6'));var rimraf=require('rimraf');var config=require(_0x3e3e('0x7'));var attributes=require(_0x3e3e('0x8'));module[_0x3e3e('0x9')]=function(_0x12c365,_0x4b16cd){return _0x12c365[_0x3e3e('0xa')](_0x3e3e('0xb'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 371330f..0dfde8b 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 _0x4ba8=['request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http'];(function(_0xd49f81,_0x4ac741){var _0x10a214=function(_0x4b6386){while(--_0x4b6386){_0xd49f81['push'](_0xd49f81['shift']());}};_0x10a214(++_0x4ac741);}(_0x4ba8,0xd2));var _0x84ba=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4ba8[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x84ba('0x0'));var util=require(_0x84ba('0x1'));var moment=require(_0x84ba('0x2'));var BPromise=require(_0x84ba('0x3'));var rs=require(_0x84ba('0x4'));var fs=require('fs');var Redis=require(_0x84ba('0x5'));var db=require(_0x84ba('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x84ba('0x7'));var jayson=require(_0x84ba('0x8'));var client=jayson['client'][_0x84ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x453fad,_0x33b7f2,_0x2705c1){return new BPromise(function(_0xd0bb58,_0x4ca1a9){return client[_0x84ba('0xa')](_0x453fad,_0x2705c1)[_0x84ba('0xb')](function(_0x20365b){logger[_0x84ba('0xc')](_0x84ba('0xd'),_0x33b7f2,_0x84ba('0xe'));logger[_0x84ba('0xf')](_0x84ba('0x10'),_0x33b7f2,_0x84ba('0xe'),JSON[_0x84ba('0x11')](_0x20365b));if(_0x20365b[_0x84ba('0x12')]){if(_0x20365b['error'][_0x84ba('0x13')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x33b7f2,_0x20365b[_0x84ba('0x12')][_0x84ba('0x14')]);return _0x4ca1a9(_0x20365b[_0x84ba('0x12')]['message']);}logger[_0x84ba('0x12')](_0x84ba('0xd'),_0x33b7f2,_0x20365b[_0x84ba('0x12')]['message']);return _0xd0bb58(_0x20365b['error']['message']);}else{logger[_0x84ba('0xc')](_0x84ba('0xd'),_0x33b7f2,_0x84ba('0xe'));_0xd0bb58(_0x20365b[_0x84ba('0x15')][_0x84ba('0x14')]);}})['catch'](function(_0x1ded39){logger[_0x84ba('0x12')]('Condition,\x20%s,\x20%s',_0x33b7f2,_0x1ded39);_0x4ca1a9(_0x1ded39);});});} \ No newline at end of file +var _0xd109=['code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x557495,_0x5655db){var _0x22ff4d=function(_0x39f45c){while(--_0x39f45c){_0x557495['push'](_0x557495['shift']());}};_0x22ff4d(++_0x5655db);}(_0xd109,0x192));var _0x9d10=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xd109[_0x565ed7];return _0x183ad7;};'use strict';var _=require('lodash');var util=require(_0x9d10('0x0'));var moment=require('moment');var BPromise=require(_0x9d10('0x1'));var rs=require(_0x9d10('0x2'));var fs=require('fs');var Redis=require(_0x9d10('0x3'));var db=require(_0x9d10('0x4'))['db'];var utils=require(_0x9d10('0x5'));var logger=require(_0x9d10('0x6'))(_0x9d10('0x7'));var config=require('../../config/environment');var jayson=require(_0x9d10('0x8'));var client=jayson[_0x9d10('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1775e8,_0x292d48,_0x4900d6){return new BPromise(function(_0x336db6,_0x2e3ccf){return client[_0x9d10('0xa')](_0x1775e8,_0x4900d6)['then'](function(_0x582f96){logger[_0x9d10('0xb')](_0x9d10('0xc'),_0x292d48,_0x9d10('0xd'));logger[_0x9d10('0xe')](_0x9d10('0xf'),_0x292d48,'request\x20sent',JSON[_0x9d10('0x10')](_0x582f96));if(_0x582f96[_0x9d10('0x11')]){if(_0x582f96[_0x9d10('0x11')][_0x9d10('0x12')]===0x1f4){logger['error'](_0x9d10('0xc'),_0x292d48,_0x582f96['error']['message']);return _0x2e3ccf(_0x582f96['error']['message']);}logger['error'](_0x9d10('0xc'),_0x292d48,_0x582f96[_0x9d10('0x11')][_0x9d10('0x13')]);return _0x336db6(_0x582f96['error']['message']);}else{logger[_0x9d10('0xb')](_0x9d10('0xc'),_0x292d48,_0x9d10('0xd'));_0x336db6(_0x582f96['result'][_0x9d10('0x13')]);}})[_0x9d10('0x14')](function(_0x567bac){logger[_0x9d10('0x11')](_0x9d10('0xc'),_0x292d48,_0x567bac);_0x2e3ccf(_0x567bac);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 25548fc..b233679 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 _0xa518=['../../components/auth/service','put','/:id','update','delete','isAuthenticated','destroy','exports','util','path','express','Router'];(function(_0x272243,_0x32f3e4){var _0x5aaf13=function(_0x47649c){while(--_0x47649c){_0x272243['push'](_0x272243['shift']());}};_0x5aaf13(++_0x32f3e4);}(_0xa518,0x1f4));var _0x8a51=function(_0x4a8418,_0x39078a){_0x4a8418=_0x4a8418-0x0;var _0x390174=_0xa518[_0x4a8418];return _0x390174;};'use strict';var multer=require('multer');var util=require(_0x8a51('0x0'));var path=require(_0x8a51('0x1'));var timeout=require('connect-timeout');var express=require(_0x8a51('0x2'));var router=express[_0x8a51('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8a51('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./condition.controller');router[_0x8a51('0x5')](_0x8a51('0x6'),auth['isAuthenticated'](),controller[_0x8a51('0x7')]);router[_0x8a51('0x8')](_0x8a51('0x6'),auth[_0x8a51('0x9')](),controller[_0x8a51('0xa')]);module[_0x8a51('0xb')]=router; \ No newline at end of file +var _0xd335=['isAuthenticated','update','delete','/:id','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./condition.controller','put'];(function(_0x44e4e1,_0x5637b2){var _0x300cd2=function(_0x189eeb){while(--_0x189eeb){_0x44e4e1['push'](_0x44e4e1['shift']());}};_0x300cd2(++_0x5637b2);}(_0xd335,0x1b7));var _0x5d33=function(_0x3c22a8,_0x2dcb66){_0x3c22a8=_0x3c22a8-0x0;var _0x5862c1=_0xd335[_0x3c22a8];return _0x5862c1;};'use strict';var multer=require('multer');var util=require(_0x5d33('0x0'));var path=require('path');var timeout=require(_0x5d33('0x1'));var express=require(_0x5d33('0x2'));var router=express[_0x5d33('0x3')]();var fs_extra=require(_0x5d33('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5d33('0x5'));var config=require(_0x5d33('0x6'));var controller=require(_0x5d33('0x7'));router[_0x5d33('0x8')]('/:id',auth[_0x5d33('0x9')](),controller[_0x5d33('0xa')]);router[_0x5d33('0xb')](_0x5d33('0xc'),auth[_0x5d33('0x9')](),controller['destroy']);module[_0x5d33('0xd')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index eb9f84d..028d88b 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8cc6=['STRING','name','INTEGER','sequelize'];(function(_0x1a6910,_0xd159df){var _0x48566c=function(_0x32a032){while(--_0x32a032){_0x1a6910['push'](_0x1a6910['shift']());}};_0x48566c(++_0xd159df);}(_0x8cc6,0x73));var _0x68cc=function(_0x36b52b,_0x3170af){_0x36b52b=_0x36b52b-0x0;var _0xc995aa=_0x8cc6[_0x36b52b];return _0xc995aa;};'use strict';var Sequelize=require(_0x68cc('0x0'));module['exports']={'name':{'type':Sequelize[_0x68cc('0x1')],'allowNull':![],'unique':_0x68cc('0x2')},'OrderBy':{'type':Sequelize[_0x68cc('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x68cc('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x7374=['sequelize','exports','STRING','INTEGER'];(function(_0x30e06a,_0x124623){var _0x61feba=function(_0x4d2f2f){while(--_0x4d2f2f){_0x30e06a['push'](_0x30e06a['shift']());}};_0x61feba(++_0x124623);}(_0x7374,0x90));var _0x4737=function(_0x299c3c,_0x575a00){_0x299c3c=_0x299c3c-0x0;var _0x349746=_0x7374[_0x299c3c];return _0x349746;};'use strict';var Sequelize=require(_0x4737('0x0'));module[_0x4737('0x1')]={'name':{'type':Sequelize[_0x4737('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x4737('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x4737('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 898634a..87adcbc 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4325=['path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','name','map','ContactItemType','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ContactItemTypes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','eml-format','rimraf','fast-json-patch','request-promise','moment','util'];(function(_0x1e9335,_0x3d010e){var _0x5ae40f=function(_0x598e18){while(--_0x598e18){_0x1e9335['push'](_0x1e9335['shift']());}};_0x5ae40f(++_0x3d010e);}(_0x4325,0x1da));var _0x5432=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4325[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x5432('0x0'));var rimraf=require(_0x5432('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5432('0x2'));var rp=require(_0x5432('0x3'));var moment=require(_0x5432('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5432('0x5'));var path=require(_0x5432('0x6'));var sox=require(_0x5432('0x7'));var csv=require('to-csv');var ejs=require(_0x5432('0x8'));var fs=require('fs');var fs_extra=require(_0x5432('0x9'));var _=require('lodash');var squel=require(_0x5432('0xa'));var crypto=require('crypto');var jsforce=require(_0x5432('0xb'));var deskjs=require(_0x5432('0xc'));var toCsv=require(_0x5432('0xd'));var querystring=require(_0x5432('0xe'));var Papa=require(_0x5432('0xf'));var Redis=require('ioredis');var authService=require(_0x5432('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5432('0x11'));var hardwareService=require(_0x5432('0x12'));var logger=require(_0x5432('0x13'))(_0x5432('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5432('0x15'));var db=require(_0x5432('0x16'))['db'];function respondWithStatusCode(_0x5366a0,_0x10a289){_0x10a289=_0x10a289||0xcc;return function(_0x111c54){if(_0x111c54){return _0x5366a0[_0x5432('0x17')](_0x10a289);}return _0x5366a0[_0x5432('0x18')](_0x10a289)[_0x5432('0x19')]();};}function respondWithResult(_0x1a084d,_0x54f41a){_0x54f41a=_0x54f41a||0xc8;return function(_0x5617ce){if(_0x5617ce){return _0x1a084d[_0x5432('0x18')](_0x54f41a)[_0x5432('0x1a')](_0x5617ce);}};}function respondWithFilteredResult(_0x3859d1,_0x364152){return function(_0x9d2023){if(_0x9d2023){var _0x11db3c=typeof _0x364152['offset']===_0x5432('0x1b')&&typeof _0x364152['limit']===_0x5432('0x1b');var _0x3de07a=_0x9d2023[_0x5432('0x1c')];var _0x32fe60=_0x11db3c?0x0:_0x364152[_0x5432('0x1d')];var _0x5f011f=_0x11db3c?_0x9d2023[_0x5432('0x1c')]:_0x364152[_0x5432('0x1d')]+_0x364152[_0x5432('0x1e')];var _0x2bfe04;if(_0x5f011f>=_0x3de07a){_0x5f011f=_0x3de07a;_0x2bfe04=0xc8;}else{_0x2bfe04=0xce;}_0x3859d1[_0x5432('0x18')](_0x2bfe04);return _0x3859d1[_0x5432('0x1f')](_0x5432('0x20'),_0x32fe60+'-'+_0x5f011f+'/'+_0x3de07a)['json'](_0x9d2023);}return null;};}function patchUpdates(_0x66911a){return function(_0x29cde7){try{jsonpatch[_0x5432('0x21')](_0x29cde7,_0x66911a,!![]);}catch(_0xa6c864){return BPromise[_0x5432('0x22')](_0xa6c864);}return _0x29cde7['save']();};}function saveUpdates(_0x5901e2,_0x4d09cd){return function(_0x61827e){if(_0x61827e){return _0x61827e[_0x5432('0x23')](_0x5901e2)[_0x5432('0x24')](function(_0x1f4870){return _0x1f4870;});}return null;};}function removeEntity(_0x4af9f6,_0x4af5f4){return function(_0x3e0b66){if(_0x3e0b66){return _0x3e0b66[_0x5432('0x25')]()['then'](function(){var _0x19e6b2=_0x3e0b66[_0x5432('0x26')]({'plain':!![]});var _0x637582='ContactItemTypes';return db[_0x5432('0x27')][_0x5432('0x25')]({'where':{'type':_0x637582,'resourceId':_0x19e6b2['id']}})[_0x5432('0x24')](function(){return _0x3e0b66;});})['then'](function(){_0x4af9f6['status'](0xcc)[_0x5432('0x19')]();});}};}function handleEntityNotFound(_0x2114b8,_0x589f79){return function(_0x1abe73){if(!_0x1abe73){_0x2114b8[_0x5432('0x17')](0x194);}return _0x1abe73;};}function handleError(_0x1f2e8f,_0x4add5b){_0x4add5b=_0x4add5b||0x1f4;return function(_0x29dc15){logger['error'](_0x29dc15['stack']);if(_0x29dc15[_0x5432('0x28')]){delete _0x29dc15['name'];}_0x1f2e8f[_0x5432('0x18')](_0x4add5b)['send'](_0x29dc15);};}exports['index']=function(_0x465a09,_0x21735e){var _0x345b51={},_0x4e92d5={},_0x31490c={'count':0x0,'rows':[]};var _0x1d436c=_[_0x5432('0x29')](db[_0x5432('0x2a')][_0x5432('0x2b')],function(_0x308b4c){return{'name':_0x308b4c[_0x5432('0x2c')],'type':_0x308b4c[_0x5432('0x2d')][_0x5432('0x2e')]};});_0x4e92d5['model']=_['map'](_0x1d436c,_0x5432('0x28'));_0x4e92d5[_0x5432('0x2f')]=_[_0x5432('0x30')](_0x465a09[_0x5432('0x2f')]);_0x4e92d5[_0x5432('0x31')]=_['intersection'](_0x4e92d5[_0x5432('0x32')],_0x4e92d5['query']);_0x345b51[_0x5432('0x33')]=_[_0x5432('0x34')](_0x4e92d5[_0x5432('0x32')],qs[_0x5432('0x35')](_0x465a09[_0x5432('0x2f')][_0x5432('0x35')]));_0x345b51['attributes']=_0x345b51[_0x5432('0x33')][_0x5432('0x36')]?_0x345b51[_0x5432('0x33')]:_0x4e92d5[_0x5432('0x32')];if(!_0x465a09['query'][_0x5432('0x37')](_0x5432('0x38'))){_0x345b51[_0x5432('0x1e')]=qs[_0x5432('0x1e')](_0x465a09[_0x5432('0x2f')][_0x5432('0x1e')]);_0x345b51[_0x5432('0x1d')]=qs[_0x5432('0x1d')](_0x465a09[_0x5432('0x2f')][_0x5432('0x1d')]);}_0x345b51[_0x5432('0x39')]=qs[_0x5432('0x3a')](_0x465a09[_0x5432('0x2f')][_0x5432('0x3a')]);_0x345b51['where']=qs[_0x5432('0x31')](_['pick'](_0x465a09[_0x5432('0x2f')],_0x4e92d5[_0x5432('0x31')]),_0x1d436c);if(_0x465a09[_0x5432('0x2f')][_0x5432('0x3b')]){_0x345b51['where']=_['merge'](_0x345b51['where'],{'$or':_[_0x5432('0x29')](_0x1d436c,function(_0x2053ed){if(_0x2053ed[_0x5432('0x2d')]!==_0x5432('0x3c')){var _0x52b296={};_0x52b296[_0x2053ed[_0x5432('0x28')]]={'$like':'%'+_0x465a09[_0x5432('0x2f')][_0x5432('0x3b')]+'%'};return _0x52b296;}})});}_0x345b51=_['merge']({},_0x345b51,_0x465a09[_0x5432('0x3d')]);var _0x38c951={'where':_0x345b51['where']};return db[_0x5432('0x2a')][_0x5432('0x1c')](_0x38c951)['then'](function(_0x23f8f4){_0x31490c['count']=_0x23f8f4;if(_0x465a09[_0x5432('0x2f')][_0x5432('0x3e')]){_0x345b51[_0x5432('0x3f')]=[{'all':!![]}];}return db[_0x5432('0x2a')]['findAll'](_0x345b51);})[_0x5432('0x24')](function(_0x4b93b4){_0x31490c[_0x5432('0x40')]=_0x4b93b4;return _0x31490c;})[_0x5432('0x24')](respondWithFilteredResult(_0x21735e,_0x345b51))[_0x5432('0x41')](handleError(_0x21735e,null));};exports[_0x5432('0x42')]=function(_0xc656ca,_0x23119a){var _0x2234da={'raw':!![],'where':{'id':_0xc656ca[_0x5432('0x43')]['id']}},_0x4ab024={};_0x4ab024[_0x5432('0x32')]=_[_0x5432('0x30')](db[_0x5432('0x2a')][_0x5432('0x2b')]);_0x4ab024[_0x5432('0x2f')]=_[_0x5432('0x30')](_0xc656ca['query']);_0x4ab024[_0x5432('0x31')]=_[_0x5432('0x34')](_0x4ab024[_0x5432('0x32')],_0x4ab024[_0x5432('0x2f')]);_0x2234da[_0x5432('0x33')]=_['intersection'](_0x4ab024[_0x5432('0x32')],qs['fields'](_0xc656ca[_0x5432('0x2f')][_0x5432('0x35')]));_0x2234da['attributes']=_0x2234da[_0x5432('0x33')]['length']?_0x2234da[_0x5432('0x33')]:_0x4ab024[_0x5432('0x32')];if(_0xc656ca['query']['includeAll']){_0x2234da[_0x5432('0x3f')]=[{'all':!![]}];}_0x2234da=_[_0x5432('0x44')]({},_0x2234da,_0xc656ca[_0x5432('0x3d')]);return db[_0x5432('0x2a')][_0x5432('0x45')](_0x2234da)[_0x5432('0x24')](handleEntityNotFound(_0x23119a,null))[_0x5432('0x24')](respondWithResult(_0x23119a,null))['catch'](handleError(_0x23119a,null));};exports[_0x5432('0x46')]=function(_0x14763c,_0x429da8){return db['ContactItemType']['create'](_0x14763c['body'],{})['then'](function(_0x26d6ae){var _0x42212f=_0x14763c[_0x5432('0x47')][_0x5432('0x26')]({'plain':!![]});if(!_0x42212f)throw new Error(_0x5432('0x48'));if(_0x42212f['role']===_0x5432('0x47')){var _0xce691b=_0x26d6ae[_0x5432('0x26')]({'plain':!![]});var _0x536229=_0x5432('0x49');return db[_0x5432('0x4a')][_0x5432('0x45')]({'where':{'name':_0x536229,'userProfileId':_0x42212f[_0x5432('0x4b')]},'raw':!![]})[_0x5432('0x24')](function(_0x50cd7c){if(_0x50cd7c&&_0x50cd7c[_0x5432('0x4c')]===0x0){return db['UserProfileResource'][_0x5432('0x46')]({'name':_0xce691b['name'],'resourceId':_0xce691b['id'],'type':_0x50cd7c[_0x5432('0x28')],'sectionId':_0x50cd7c['id']},{})[_0x5432('0x24')](function(){return _0x26d6ae;});}else{return _0x26d6ae;}})['catch'](function(_0x7129e2){logger['error'](_0x5432('0x4d'),_0x7129e2);throw _0x7129e2;});}return _0x26d6ae;})[_0x5432('0x24')](respondWithResult(_0x429da8,0xc9))[_0x5432('0x41')](handleError(_0x429da8,null));};exports[_0x5432('0x23')]=function(_0x5f08eb,_0x3757b1){if(_0x5f08eb['body']['id']){delete _0x5f08eb[_0x5432('0x4e')]['id'];}return db['ContactItemType'][_0x5432('0x45')]({'where':{'id':_0x5f08eb[_0x5432('0x43')]['id']}})[_0x5432('0x24')](handleEntityNotFound(_0x3757b1,null))[_0x5432('0x24')](saveUpdates(_0x5f08eb[_0x5432('0x4e')],null))[_0x5432('0x24')](respondWithResult(_0x3757b1,null))[_0x5432('0x41')](handleError(_0x3757b1,null));};exports[_0x5432('0x25')]=function(_0x3e0259,_0x20d9f5){return db['ContactItemType'][_0x5432('0x45')]({'where':{'id':_0x3e0259[_0x5432('0x43')]['id']}})['then'](handleEntityNotFound(_0x20d9f5,null))[_0x5432('0x24')](db[_0x5432('0x4f')][_0x5432('0x23')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x3e0259[_0x5432('0x43')]['id']}}))[_0x5432('0x24')](removeEntity(_0x20d9f5,null))['catch'](handleError(_0x20d9f5,null));}; \ No newline at end of file +var _0x1893=['util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','get','ContactItemTypes','UserProfileResource','destroy','error','stack','name','index','ContactItemType','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','catch','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x31d849,_0x3db9bc){var _0x1c55b3=function(_0x3b8040){while(--_0x3b8040){_0x31d849['push'](_0x31d849['shift']());}};_0x1c55b3(++_0x3db9bc);}(_0x1893,0xa2));var _0x3189=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x1893[_0x4b73a2];return _0x383c66;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3189('0x0'));var jsonpatch=require(_0x3189('0x1'));var rp=require(_0x3189('0x2'));var moment=require(_0x3189('0x3'));var BPromise=require(_0x3189('0x4'));var Mustache=require(_0x3189('0x5'));var util=require(_0x3189('0x6'));var path=require('path');var sox=require(_0x3189('0x7'));var csv=require(_0x3189('0x8'));var ejs=require(_0x3189('0x9'));var fs=require('fs');var fs_extra=require(_0x3189('0xa'));var _=require(_0x3189('0xb'));var squel=require(_0x3189('0xc'));var crypto=require(_0x3189('0xd'));var jsforce=require(_0x3189('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3189('0x8'));var querystring=require('querystring');var Papa=require(_0x3189('0xf'));var Redis=require('ioredis');var authService=require(_0x3189('0x10'));var qs=require(_0x3189('0x11'));var as=require(_0x3189('0x12'));var hardwareService=require(_0x3189('0x13'));var logger=require('../../config/logger')(_0x3189('0x14'));var utils=require(_0x3189('0x15'));var config=require(_0x3189('0x16'));var licenseUtil=require(_0x3189('0x17'));var db=require(_0x3189('0x18'))['db'];function respondWithStatusCode(_0x5d9fff,_0x22b11e){_0x22b11e=_0x22b11e||0xcc;return function(_0x353b17){if(_0x353b17){return _0x5d9fff[_0x3189('0x19')](_0x22b11e);}return _0x5d9fff[_0x3189('0x1a')](_0x22b11e)[_0x3189('0x1b')]();};}function respondWithResult(_0x20dcc2,_0xef438){_0xef438=_0xef438||0xc8;return function(_0x25a917){if(_0x25a917){return _0x20dcc2['status'](_0xef438)[_0x3189('0x1c')](_0x25a917);}};}function respondWithFilteredResult(_0xb3e4c2,_0x1c209b){return function(_0x2fb62b){if(_0x2fb62b){var _0x486dd2=typeof _0x1c209b[_0x3189('0x1d')]==='undefined'&&typeof _0x1c209b['limit']===_0x3189('0x1e');var _0x49b1bc=_0x2fb62b[_0x3189('0x1f')];var _0xf8aed7=_0x486dd2?0x0:_0x1c209b[_0x3189('0x1d')];var _0x9905c4=_0x486dd2?_0x2fb62b['count']:_0x1c209b[_0x3189('0x1d')]+_0x1c209b[_0x3189('0x20')];var _0x16edd7;if(_0x9905c4>=_0x49b1bc){_0x9905c4=_0x49b1bc;_0x16edd7=0xc8;}else{_0x16edd7=0xce;}_0xb3e4c2['status'](_0x16edd7);return _0xb3e4c2[_0x3189('0x21')](_0x3189('0x22'),_0xf8aed7+'-'+_0x9905c4+'/'+_0x49b1bc)[_0x3189('0x1c')](_0x2fb62b);}return null;};}function patchUpdates(_0x2c1e59){return function(_0x29b275){try{jsonpatch['apply'](_0x29b275,_0x2c1e59,!![]);}catch(_0x1771a8){return BPromise[_0x3189('0x23')](_0x1771a8);}return _0x29b275[_0x3189('0x24')]();};}function saveUpdates(_0x539e12,_0x309c6e){return function(_0x47abb4){if(_0x47abb4){return _0x47abb4[_0x3189('0x25')](_0x539e12)[_0x3189('0x26')](function(_0x200f16){return _0x200f16;});}return null;};}function removeEntity(_0x38e56a,_0x1cbe33){return function(_0x393fcb){if(_0x393fcb){return _0x393fcb['destroy']()['then'](function(){var _0x1dd6c2=_0x393fcb[_0x3189('0x27')]({'plain':!![]});var _0x1dc1c8=_0x3189('0x28');return db[_0x3189('0x29')][_0x3189('0x2a')]({'where':{'type':_0x1dc1c8,'resourceId':_0x1dd6c2['id']}})[_0x3189('0x26')](function(){return _0x393fcb;});})[_0x3189('0x26')](function(){_0x38e56a[_0x3189('0x1a')](0xcc)[_0x3189('0x1b')]();});}};}function handleEntityNotFound(_0x5ce5f5,_0x4c4a5e){return function(_0x5aa34a){if(!_0x5aa34a){_0x5ce5f5[_0x3189('0x19')](0x194);}return _0x5aa34a;};}function handleError(_0x3d7d5b,_0x1be399){_0x1be399=_0x1be399||0x1f4;return function(_0x90c31){logger[_0x3189('0x2b')](_0x90c31[_0x3189('0x2c')]);if(_0x90c31['name']){delete _0x90c31[_0x3189('0x2d')];}_0x3d7d5b[_0x3189('0x1a')](_0x1be399)['send'](_0x90c31);};}exports[_0x3189('0x2e')]=function(_0x3744ff,_0x39c5e4){var _0x5c7a36={},_0x168dc2={},_0x32bba1={'count':0x0,'rows':[]};var _0x23798e=_['map'](db[_0x3189('0x2f')][_0x3189('0x30')],function(_0x51ce54){return{'name':_0x51ce54[_0x3189('0x31')],'type':_0x51ce54[_0x3189('0x32')][_0x3189('0x33')]};});_0x168dc2[_0x3189('0x34')]=_[_0x3189('0x35')](_0x23798e,'name');_0x168dc2['query']=_[_0x3189('0x36')](_0x3744ff['query']);_0x168dc2[_0x3189('0x37')]=_[_0x3189('0x38')](_0x168dc2[_0x3189('0x34')],_0x168dc2[_0x3189('0x39')]);_0x5c7a36[_0x3189('0x3a')]=_[_0x3189('0x38')](_0x168dc2[_0x3189('0x34')],qs[_0x3189('0x3b')](_0x3744ff[_0x3189('0x39')]['fields']));_0x5c7a36[_0x3189('0x3a')]=_0x5c7a36[_0x3189('0x3a')][_0x3189('0x3c')]?_0x5c7a36[_0x3189('0x3a')]:_0x168dc2[_0x3189('0x34')];if(!_0x3744ff[_0x3189('0x39')][_0x3189('0x3d')]('nolimit')){_0x5c7a36['limit']=qs[_0x3189('0x20')](_0x3744ff['query'][_0x3189('0x20')]);_0x5c7a36[_0x3189('0x1d')]=qs['offset'](_0x3744ff[_0x3189('0x39')][_0x3189('0x1d')]);}_0x5c7a36[_0x3189('0x3e')]=qs[_0x3189('0x3f')](_0x3744ff['query'][_0x3189('0x3f')]);_0x5c7a36['where']=qs['filters'](_[_0x3189('0x40')](_0x3744ff[_0x3189('0x39')],_0x168dc2[_0x3189('0x37')]),_0x23798e);if(_0x3744ff[_0x3189('0x39')][_0x3189('0x41')]){_0x5c7a36[_0x3189('0x42')]=_[_0x3189('0x43')](_0x5c7a36[_0x3189('0x42')],{'$or':_['map'](_0x23798e,function(_0x568dab){if(_0x568dab[_0x3189('0x32')]!==_0x3189('0x44')){var _0x59fc8f={};_0x59fc8f[_0x568dab[_0x3189('0x2d')]]={'$like':'%'+_0x3744ff[_0x3189('0x39')][_0x3189('0x41')]+'%'};return _0x59fc8f;}})});}_0x5c7a36=_['merge']({},_0x5c7a36,_0x3744ff[_0x3189('0x45')]);var _0xc48bf1={'where':_0x5c7a36[_0x3189('0x42')]};return db[_0x3189('0x2f')]['count'](_0xc48bf1)[_0x3189('0x26')](function(_0x2f0d49){_0x32bba1['count']=_0x2f0d49;if(_0x3744ff['query'][_0x3189('0x46')]){_0x5c7a36['include']=[{'all':!![]}];}return db[_0x3189('0x2f')][_0x3189('0x47')](_0x5c7a36);})[_0x3189('0x26')](function(_0x9593f3){_0x32bba1['rows']=_0x9593f3;return _0x32bba1;})[_0x3189('0x26')](respondWithFilteredResult(_0x39c5e4,_0x5c7a36))[_0x3189('0x48')](handleError(_0x39c5e4,null));};exports['show']=function(_0x42e1d2,_0x4114ba){var _0x279991={'raw':!![],'where':{'id':_0x42e1d2[_0x3189('0x49')]['id']}},_0x3a6a36={};_0x3a6a36['model']=_['keys'](db[_0x3189('0x2f')]['rawAttributes']);_0x3a6a36[_0x3189('0x39')]=_[_0x3189('0x36')](_0x42e1d2[_0x3189('0x39')]);_0x3a6a36['filters']=_[_0x3189('0x38')](_0x3a6a36[_0x3189('0x34')],_0x3a6a36[_0x3189('0x39')]);_0x279991['attributes']=_[_0x3189('0x38')](_0x3a6a36[_0x3189('0x34')],qs[_0x3189('0x3b')](_0x42e1d2[_0x3189('0x39')][_0x3189('0x3b')]));_0x279991[_0x3189('0x3a')]=_0x279991['attributes']['length']?_0x279991[_0x3189('0x3a')]:_0x3a6a36['model'];if(_0x42e1d2['query'][_0x3189('0x46')]){_0x279991['include']=[{'all':!![]}];}_0x279991=_[_0x3189('0x43')]({},_0x279991,_0x42e1d2[_0x3189('0x45')]);return db[_0x3189('0x2f')]['find'](_0x279991)[_0x3189('0x26')](handleEntityNotFound(_0x4114ba,null))['then'](respondWithResult(_0x4114ba,null))[_0x3189('0x48')](handleError(_0x4114ba,null));};exports['create']=function(_0x49c4a8,_0x244166){return db['ContactItemType'][_0x3189('0x4a')](_0x49c4a8['body'],{})['then'](function(_0x347993){var _0x3f961e=_0x49c4a8[_0x3189('0x4b')][_0x3189('0x27')]({'plain':!![]});if(!_0x3f961e)throw new Error(_0x3189('0x4c'));if(_0x3f961e[_0x3189('0x4d')]==='user'){var _0x21d446=_0x347993['get']({'plain':!![]});var _0x5e2823=_0x3189('0x28');return db[_0x3189('0x4e')][_0x3189('0x4f')]({'where':{'name':_0x5e2823,'userProfileId':_0x3f961e[_0x3189('0x50')]},'raw':!![]})[_0x3189('0x26')](function(_0xaa2012){if(_0xaa2012&&_0xaa2012['autoAssociation']===0x0){return db[_0x3189('0x29')]['create']({'name':_0x21d446[_0x3189('0x2d')],'resourceId':_0x21d446['id'],'type':_0xaa2012[_0x3189('0x2d')],'sectionId':_0xaa2012['id']},{})[_0x3189('0x26')](function(){return _0x347993;});}else{return _0x347993;}})[_0x3189('0x48')](function(_0x4f41e5){logger[_0x3189('0x2b')](_0x3189('0x51'),_0x4f41e5);throw _0x4f41e5;});}return _0x347993;})['then'](respondWithResult(_0x244166,0xc9))[_0x3189('0x48')](handleError(_0x244166,null));};exports[_0x3189('0x25')]=function(_0x584009,_0x2bc288){if(_0x584009['body']['id']){delete _0x584009[_0x3189('0x52')]['id'];}return db['ContactItemType'][_0x3189('0x4f')]({'where':{'id':_0x584009['params']['id']}})[_0x3189('0x26')](handleEntityNotFound(_0x2bc288,null))[_0x3189('0x26')](saveUpdates(_0x584009['body'],null))['then'](respondWithResult(_0x2bc288,null))['catch'](handleError(_0x2bc288,null));};exports[_0x3189('0x2a')]=function(_0x5b14ac,_0x212df4){return db[_0x3189('0x2f')][_0x3189('0x4f')]({'where':{'id':_0x5b14ac[_0x3189('0x49')]['id']}})[_0x3189('0x26')](handleEntityNotFound(_0x212df4,null))[_0x3189('0x26')](db[_0x3189('0x53')][_0x3189('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x5b14ac[_0x3189('0x49')]['id']}}))['then'](removeEntity(_0x212df4,null))[_0x3189('0x48')](handleError(_0x212df4,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 3337723..d95ad74 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe742=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xe742,0xf0));var _0x2e74=function(_0x4b0920,_0x32a257){_0x4b0920=_0x4b0920-0x0;var _0x185ca3=_0xe742[_0x4b0920];return _0x185ca3;};'use strict';var _=require(_0x2e74('0x0'));var util=require(_0x2e74('0x1'));var logger=require('../../config/logger')(_0x2e74('0x2'));var moment=require(_0x2e74('0x3'));var BPromise=require(_0x2e74('0x4'));var rp=require(_0x2e74('0x5'));var fs=require('fs');var path=require(_0x2e74('0x6'));var rimraf=require('rimraf');var config=require(_0x2e74('0x7'));var attributes=require(_0x2e74('0x8'));module[_0x2e74('0x9')]=function(_0x50a635,_0x1fb759){return _0x50a635['define'](_0x2e74('0xa'),attributes,{'tableName':_0x2e74('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe152=['path','rimraf','../../config/environment','exports','define','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe152,0x172));var _0x2e15=function(_0x407cf7,_0x3093c9){_0x407cf7=_0x407cf7-0x0;var _0x2fa1b=_0xe152[_0x407cf7];return _0x2fa1b;};'use strict';var _=require(_0x2e15('0x0'));var util=require(_0x2e15('0x1'));var logger=require(_0x2e15('0x2'))(_0x2e15('0x3'));var moment=require(_0x2e15('0x4'));var BPromise=require(_0x2e15('0x5'));var rp=require(_0x2e15('0x6'));var fs=require('fs');var path=require(_0x2e15('0x7'));var rimraf=require(_0x2e15('0x8'));var config=require(_0x2e15('0x9'));var attributes=require('./contactItemType.attributes');module[_0x2e15('0xa')]=function(_0xf729b1,_0x545931){return _0xf729b1[_0x2e15('0xb')]('ContactItemType',attributes,{'tableName':_0x2e15('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 786da5f..e4d6c41 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x74a7=['lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch'];(function(_0x3cfdfc,_0x1171e5){var _0x2863db=function(_0x136111){while(--_0x136111){_0x3cfdfc['push'](_0x3cfdfc['shift']());}};_0x2863db(++_0x1171e5);}(_0x74a7,0x130));var _0x774a=function(_0x25b61f,_0x2e0cde){_0x25b61f=_0x25b61f-0x0;var _0x3965f8=_0x74a7[_0x25b61f];return _0x3965f8;};'use strict';var _=require(_0x774a('0x0'));var util=require('util');var moment=require(_0x774a('0x1'));var BPromise=require(_0x774a('0x2'));var rs=require(_0x774a('0x3'));var fs=require('fs');var Redis=require(_0x774a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x774a('0x5'))(_0x774a('0x6'));var config=require(_0x774a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x774a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x154a28,_0xe260ca,_0x1c9b5c){return new BPromise(function(_0x450104,_0x18c106){return client[_0x774a('0x9')](_0x154a28,_0x1c9b5c)['then'](function(_0x1e5d95){logger['info'](_0x774a('0xa'),_0xe260ca,_0x774a('0xb'));logger[_0x774a('0xc')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0xe260ca,_0x774a('0xb'),JSON[_0x774a('0xd')](_0x1e5d95));if(_0x1e5d95[_0x774a('0xe')]){if(_0x1e5d95[_0x774a('0xe')]['code']===0x1f4){logger[_0x774a('0xe')](_0x774a('0xa'),_0xe260ca,_0x1e5d95['error']['message']);return _0x18c106(_0x1e5d95['error']['message']);}logger['error']('ContactItemType,\x20%s,\x20%s',_0xe260ca,_0x1e5d95[_0x774a('0xe')][_0x774a('0xf')]);return _0x450104(_0x1e5d95[_0x774a('0xe')][_0x774a('0xf')]);}else{logger[_0x774a('0x10')](_0x774a('0xa'),_0xe260ca,'request\x20sent');_0x450104(_0x1e5d95[_0x774a('0x11')][_0x774a('0xf')]);}})[_0x774a('0x12')](function(_0x20d910){logger[_0x774a('0xe')]('ContactItemType,\x20%s,\x20%s',_0xe260ca,_0x20d910);_0x18c106(_0x20d910);});});} \ No newline at end of file +var _0xb264=['code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x3f1420,_0x514caa){var _0x153266=function(_0x1189c1){while(--_0x1189c1){_0x3f1420['push'](_0x3f1420['shift']());}};_0x153266(++_0x514caa);}(_0xb264,0x108));var _0x4b26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb264[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4b26('0x0'));var util=require(_0x4b26('0x1'));var moment=require('moment');var BPromise=require(_0x4b26('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b26('0x3'))['db'];var utils=require(_0x4b26('0x4'));var logger=require(_0x4b26('0x5'))(_0x4b26('0x6'));var config=require(_0x4b26('0x7'));var jayson=require(_0x4b26('0x8'));var client=jayson[_0x4b26('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x165096,_0x337ddc,_0x5a8c67){return new BPromise(function(_0x1edb7c,_0xec9f8a){return client[_0x4b26('0xa')](_0x165096,_0x5a8c67)['then'](function(_0x2ab5e2){logger[_0x4b26('0xb')](_0x4b26('0xc'),_0x337ddc,_0x4b26('0xd'));logger[_0x4b26('0xe')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x337ddc,_0x4b26('0xd'),JSON['stringify'](_0x2ab5e2));if(_0x2ab5e2[_0x4b26('0xf')]){if(_0x2ab5e2[_0x4b26('0xf')][_0x4b26('0x10')]===0x1f4){logger[_0x4b26('0xf')](_0x4b26('0xc'),_0x337ddc,_0x2ab5e2['error'][_0x4b26('0x11')]);return _0xec9f8a(_0x2ab5e2[_0x4b26('0xf')]['message']);}logger['error'](_0x4b26('0xc'),_0x337ddc,_0x2ab5e2['error'][_0x4b26('0x11')]);return _0x1edb7c(_0x2ab5e2[_0x4b26('0xf')][_0x4b26('0x11')]);}else{logger['info'](_0x4b26('0xc'),_0x337ddc,_0x4b26('0xd'));_0x1edb7c(_0x2ab5e2[_0x4b26('0x12')][_0x4b26('0x11')]);}})[_0x4b26('0x13')](function(_0x1582a3){logger[_0x4b26('0xf')](_0x4b26('0xc'),_0x337ddc,_0x1582a3);_0xec9f8a(_0x1582a3);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index e20902e..957a0ed 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x536d=['get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./contactItemType.controller'];(function(_0x4ff019,_0x4b3310){var _0x3dd5c0=function(_0x47f8b6){while(--_0x47f8b6){_0x4ff019['push'](_0x4ff019['shift']());}};_0x3dd5c0(++_0x4b3310);}(_0x536d,0x1b3));var _0xd536=function(_0x2107c,_0x2da138){_0x2107c=_0x2107c-0x0;var _0x14e5d9=_0x536d[_0x2107c];return _0x14e5d9;};'use strict';var multer=require(_0xd536('0x0'));var util=require(_0xd536('0x1'));var path=require(_0xd536('0x2'));var timeout=require(_0xd536('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd536('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd536('0x5'));var controller=require(_0xd536('0x6'));router[_0xd536('0x7')]('/',auth[_0xd536('0x8')](),controller[_0xd536('0x9')]);router[_0xd536('0x7')](_0xd536('0xa'),auth[_0xd536('0x8')](),controller['show']);router[_0xd536('0xb')]('/',auth[_0xd536('0x8')](),controller[_0xd536('0xc')]);router['put'](_0xd536('0xa'),auth[_0xd536('0x8')](),controller[_0xd536('0xd')]);router[_0xd536('0xe')](_0xd536('0xa'),auth[_0xd536('0x8')](),controller[_0xd536('0xf')]);module[_0xd536('0x10')]=router; \ No newline at end of file +var _0x03f3=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','index','isAuthenticated','show','create','put','/:id','update','destroy','multer','path','connect-timeout','express'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x03f3,0x1b1));var _0x303f=function(_0x205eca,_0x138c20){_0x205eca=_0x205eca-0x0;var _0x193e81=_0x03f3[_0x205eca];return _0x193e81;};'use strict';var multer=require(_0x303f('0x0'));var util=require('util');var path=require(_0x303f('0x1'));var timeout=require(_0x303f('0x2'));var express=require(_0x303f('0x3'));var router=express[_0x303f('0x4')]();var fs_extra=require(_0x303f('0x5'));var auth=require(_0x303f('0x6'));var interaction=require(_0x303f('0x7'));var config=require(_0x303f('0x8'));var controller=require(_0x303f('0x9'));router[_0x303f('0xa')]('/',auth['isAuthenticated'](),controller[_0x303f('0xb')]);router[_0x303f('0xa')]('/:id',auth[_0x303f('0xc')](),controller[_0x303f('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x303f('0xe')]);router[_0x303f('0xf')](_0x303f('0x10'),auth[_0x303f('0xc')](),controller[_0x303f('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x303f('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index f4f0e8c..9e84eaa 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['STRING','sequelize'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xb7e7[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x81f0fc,_0x2c5785){var _0xd4667d=function(_0x5c4849){while(--_0x5c4849){_0x81f0fc['push'](_0x81f0fc['shift']());}};_0xd4667d(++_0x2c5785);}(_0x757a,0xde));var _0xa757=function(_0x192f19,_0x108d16){_0x192f19=_0x192f19-0x0;var _0x17de1d=_0x757a[_0x192f19];return _0x17de1d;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 8105673..e6d360b 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 _0xd859=['register','sendStatus','offset','undefined','limit','count','status','Content-Range','json','reject','save','update','then','destroy','get','end','error','stack','name','map','Dashboard','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','params','keys','find','catch','create','body','user','CustomDashboards','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','hasOwnProperty','getItems','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./dashboard.socket'];(function(_0x2a05ce,_0x5de2c9){var _0x3d3b83=function(_0x1ef526){while(--_0x1ef526){_0x2a05ce['push'](_0x2a05ce['shift']());}};_0x3d3b83(++_0x5de2c9);}(_0xd859,0x64));var _0x9d85=function(_0x639430,_0x3c1d15){_0x639430=_0x639430-0x0;var _0x282adb=_0xd859[_0x639430];return _0x282adb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9d85('0x0'));var zipdir=require(_0x9d85('0x1'));var jsonpatch=require(_0x9d85('0x2'));var rp=require(_0x9d85('0x3'));var moment=require(_0x9d85('0x4'));var BPromise=require(_0x9d85('0x5'));var Mustache=require(_0x9d85('0x6'));var util=require(_0x9d85('0x7'));var path=require(_0x9d85('0x8'));var sox=require(_0x9d85('0x9'));var csv=require(_0x9d85('0xa'));var ejs=require(_0x9d85('0xb'));var fs=require('fs');var fs_extra=require(_0x9d85('0xc'));var _=require(_0x9d85('0xd'));var squel=require(_0x9d85('0xe'));var crypto=require(_0x9d85('0xf'));var jsforce=require(_0x9d85('0x10'));var deskjs=require(_0x9d85('0x11'));var toCsv=require(_0x9d85('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9d85('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9d85('0x13'));var as=require(_0x9d85('0x14'));var hardwareService=require(_0x9d85('0x15'));var logger=require(_0x9d85('0x16'))(_0x9d85('0x17'));var utils=require(_0x9d85('0x18'));var config=require(_0x9d85('0x19'));var licenseUtil=require(_0x9d85('0x1a'));var db=require(_0x9d85('0x1b'))['db'];config['redis']=_[_0x9d85('0x1c')](config['redis'],{'host':_0x9d85('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9d85('0x1e')]));require(_0x9d85('0x1f'))[_0x9d85('0x20')](socket);function respondWithStatusCode(_0x3b4aae,_0x206818){_0x206818=_0x206818||0xcc;return function(_0x26f2b0){if(_0x26f2b0){return _0x3b4aae[_0x9d85('0x21')](_0x206818);}return _0x3b4aae['status'](_0x206818)['end']();};}function respondWithResult(_0x214497,_0x5bcab3){_0x5bcab3=_0x5bcab3||0xc8;return function(_0xac70b2){if(_0xac70b2){return _0x214497['status'](_0x5bcab3)['json'](_0xac70b2);}};}function respondWithFilteredResult(_0x1e54d6,_0xa3d051){return function(_0x343b69){if(_0x343b69){var _0x1c7c71=typeof _0xa3d051[_0x9d85('0x22')]===_0x9d85('0x23')&&typeof _0xa3d051[_0x9d85('0x24')]==='undefined';var _0x31f932=_0x343b69[_0x9d85('0x25')];var _0x29585e=_0x1c7c71?0x0:_0xa3d051[_0x9d85('0x22')];var _0x52d652=_0x1c7c71?_0x343b69[_0x9d85('0x25')]:_0xa3d051['offset']+_0xa3d051[_0x9d85('0x24')];var _0x4c8a77;if(_0x52d652>=_0x31f932){_0x52d652=_0x31f932;_0x4c8a77=0xc8;}else{_0x4c8a77=0xce;}_0x1e54d6[_0x9d85('0x26')](_0x4c8a77);return _0x1e54d6['set'](_0x9d85('0x27'),_0x29585e+'-'+_0x52d652+'/'+_0x31f932)[_0x9d85('0x28')](_0x343b69);}return null;};}function patchUpdates(_0x3c1f40){return function(_0x2a4643){try{jsonpatch['apply'](_0x2a4643,_0x3c1f40,!![]);}catch(_0x4e588e){return BPromise[_0x9d85('0x29')](_0x4e588e);}return _0x2a4643[_0x9d85('0x2a')]();};}function saveUpdates(_0x3c68ca,_0x213809){return function(_0x1e1994){if(_0x1e1994){return _0x1e1994[_0x9d85('0x2b')](_0x3c68ca)[_0x9d85('0x2c')](function(_0xa57fce){return _0xa57fce;});}return null;};}function removeEntity(_0x5ac73c,_0x488f41){return function(_0x5472bf){if(_0x5472bf){return _0x5472bf[_0x9d85('0x2d')]()['then'](function(){var _0x457d16=_0x5472bf[_0x9d85('0x2e')]({'plain':!![]});var _0x176109='CustomDashboards';return db['UserProfileResource'][_0x9d85('0x2d')]({'where':{'type':_0x176109,'resourceId':_0x457d16['id']}})[_0x9d85('0x2c')](function(){return _0x5472bf;});})['then'](function(){_0x5ac73c[_0x9d85('0x26')](0xcc)[_0x9d85('0x2f')]();});}};}function handleEntityNotFound(_0x16f5b2,_0x42f614){return function(_0x5470b7){if(!_0x5470b7){_0x16f5b2['sendStatus'](0x194);}return _0x5470b7;};}function handleError(_0x31256e,_0x9d159b){_0x9d159b=_0x9d159b||0x1f4;return function(_0x2871dc){logger[_0x9d85('0x30')](_0x2871dc[_0x9d85('0x31')]);if(_0x2871dc[_0x9d85('0x32')]){delete _0x2871dc['name'];}_0x31256e[_0x9d85('0x26')](_0x9d159b)['send'](_0x2871dc);};}exports['index']=function(_0x4e2a37,_0x4a7222){var _0x455325={},_0xc6124c={},_0x10e3ad={'count':0x0,'rows':[]};var _0x3c6f9b=_[_0x9d85('0x33')](db[_0x9d85('0x34')][_0x9d85('0x35')],function(_0x52bed){return{'name':_0x52bed[_0x9d85('0x36')],'type':_0x52bed['type'][_0x9d85('0x37')]};});_0xc6124c[_0x9d85('0x38')]=_[_0x9d85('0x33')](_0x3c6f9b,_0x9d85('0x32'));_0xc6124c[_0x9d85('0x39')]=_['keys'](_0x4e2a37[_0x9d85('0x39')]);_0xc6124c[_0x9d85('0x3a')]=_[_0x9d85('0x3b')](_0xc6124c[_0x9d85('0x38')],_0xc6124c['query']);_0x455325['attributes']=_[_0x9d85('0x3b')](_0xc6124c[_0x9d85('0x38')],qs[_0x9d85('0x3c')](_0x4e2a37[_0x9d85('0x39')][_0x9d85('0x3c')]));_0x455325[_0x9d85('0x3d')]=_0x455325[_0x9d85('0x3d')][_0x9d85('0x3e')]?_0x455325[_0x9d85('0x3d')]:_0xc6124c['model'];if(!_0x4e2a37[_0x9d85('0x39')]['hasOwnProperty'](_0x9d85('0x3f'))){_0x455325[_0x9d85('0x24')]=qs['limit'](_0x4e2a37[_0x9d85('0x39')][_0x9d85('0x24')]);_0x455325[_0x9d85('0x22')]=qs[_0x9d85('0x22')](_0x4e2a37[_0x9d85('0x39')]['offset']);}_0x455325[_0x9d85('0x40')]=qs['sort'](_0x4e2a37['query'][_0x9d85('0x41')]);_0x455325['where']=qs[_0x9d85('0x3a')](_[_0x9d85('0x42')](_0x4e2a37['query'],_0xc6124c[_0x9d85('0x3a')]),_0x3c6f9b);if(_0x4e2a37[_0x9d85('0x39')][_0x9d85('0x43')]){_0x455325[_0x9d85('0x44')]=_['merge'](_0x455325[_0x9d85('0x44')],{'$or':_[_0x9d85('0x33')](_0x3c6f9b,function(_0x3abe48){if(_0x3abe48['type']!==_0x9d85('0x45')){var _0x42a467={};_0x42a467[_0x3abe48['name']]={'$like':'%'+_0x4e2a37[_0x9d85('0x39')]['filter']+'%'};return _0x42a467;}})});}_0x455325=_[_0x9d85('0x46')]({},_0x455325,_0x4e2a37[_0x9d85('0x47')]);var _0x512886={'where':_0x455325[_0x9d85('0x44')]};return db[_0x9d85('0x34')][_0x9d85('0x25')](_0x512886)['then'](function(_0x566893){_0x10e3ad[_0x9d85('0x25')]=_0x566893;if(_0x4e2a37['query'][_0x9d85('0x48')]){_0x455325[_0x9d85('0x49')]=[{'all':!![]}];}return db['Dashboard'][_0x9d85('0x4a')](_0x455325);})[_0x9d85('0x2c')](function(_0x23c0b8){_0x10e3ad['rows']=_0x23c0b8;return _0x10e3ad;})[_0x9d85('0x2c')](respondWithFilteredResult(_0x4a7222,_0x455325))['catch'](handleError(_0x4a7222,null));};exports['show']=function(_0xd9d2ea,_0x57eeaa){var _0x19aac3={'raw':![],'where':{'id':_0xd9d2ea[_0x9d85('0x4b')]['id']}},_0xb4fae1={};_0xb4fae1[_0x9d85('0x38')]=_[_0x9d85('0x4c')](db[_0x9d85('0x34')][_0x9d85('0x35')]);_0xb4fae1[_0x9d85('0x39')]=_[_0x9d85('0x4c')](_0xd9d2ea[_0x9d85('0x39')]);_0xb4fae1[_0x9d85('0x3a')]=_[_0x9d85('0x3b')](_0xb4fae1[_0x9d85('0x38')],_0xb4fae1[_0x9d85('0x39')]);_0x19aac3['attributes']=_[_0x9d85('0x3b')](_0xb4fae1[_0x9d85('0x38')],qs[_0x9d85('0x3c')](_0xd9d2ea[_0x9d85('0x39')][_0x9d85('0x3c')]));_0x19aac3[_0x9d85('0x3d')]=_0x19aac3['attributes'][_0x9d85('0x3e')]?_0x19aac3[_0x9d85('0x3d')]:_0xb4fae1[_0x9d85('0x38')];if(_0xd9d2ea['query'][_0x9d85('0x48')]){_0x19aac3[_0x9d85('0x49')]=[{'all':!![]}];}_0x19aac3=_[_0x9d85('0x46')]({},_0x19aac3,_0xd9d2ea[_0x9d85('0x47')]);return db[_0x9d85('0x34')][_0x9d85('0x4d')](_0x19aac3)[_0x9d85('0x2c')](handleEntityNotFound(_0x57eeaa,null))['then'](respondWithResult(_0x57eeaa,null))[_0x9d85('0x4e')](handleError(_0x57eeaa,null));};exports[_0x9d85('0x4f')]=function(_0x2f63d1,_0x2adc43){return db[_0x9d85('0x34')][_0x9d85('0x4f')](_0x2f63d1[_0x9d85('0x50')],{})['then'](function(_0x548bc8){var _0x232fdf=_0x2f63d1[_0x9d85('0x51')]['get']({'plain':!![]});if(!_0x232fdf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x232fdf['role']===_0x9d85('0x51')){var _0x5241b8=_0x548bc8[_0x9d85('0x2e')]({'plain':!![]});var _0x4d9b54=_0x9d85('0x52');return db[_0x9d85('0x53')][_0x9d85('0x4d')]({'where':{'name':_0x4d9b54,'userProfileId':_0x232fdf['userProfileId']},'raw':!![]})[_0x9d85('0x2c')](function(_0x558674){if(_0x558674&&_0x558674[_0x9d85('0x54')]===0x0){return db[_0x9d85('0x55')]['create']({'name':_0x5241b8[_0x9d85('0x32')],'resourceId':_0x5241b8['id'],'type':_0x558674[_0x9d85('0x32')],'sectionId':_0x558674['id']},{})[_0x9d85('0x2c')](function(){return _0x548bc8;});}else{return _0x548bc8;}})[_0x9d85('0x4e')](function(_0x4301ab){logger[_0x9d85('0x30')](_0x9d85('0x56'),_0x4301ab);throw _0x4301ab;});}return _0x548bc8;})[_0x9d85('0x2c')](respondWithResult(_0x2adc43,0xc9))[_0x9d85('0x4e')](handleError(_0x2adc43,null));};exports[_0x9d85('0x57')]=function(_0x5744fd,_0x7cee69){var _0x26b4d5={'where':{'id':_0x5744fd[_0x9d85('0x4b')]['id']}},_0x353245={};_0x353245[_0x9d85('0x38')]=_['keys'](db['Dashboard']['rawAttributes']);_0x26b4d5[_0x9d85('0x3d')]=_[_0x9d85('0x3b')](_0x353245[_0x9d85('0x38')],qs['fields'](_0x5744fd[_0x9d85('0x39')][_0x9d85('0x3c')]));_0x26b4d5['attributes']=_0x26b4d5[_0x9d85('0x3d')][_0x9d85('0x3e')]?_0x26b4d5[_0x9d85('0x3d')]:_0x353245[_0x9d85('0x38')];if(_0x5744fd['query'][_0x9d85('0x48')]){_0x26b4d5[_0x9d85('0x49')]=[{'all':!![]}];}_0x26b4d5=_[_0x9d85('0x46')]({},_0x26b4d5,_0x5744fd[_0x9d85('0x47')]);return db[_0x9d85('0x34')][_0x9d85('0x4d')](_0x26b4d5)[_0x9d85('0x2c')](handleEntityNotFound(_0x7cee69,null))['then'](function(_0x48c323){if(_0x48c323){var _0x52b657=_0x48c323['get']({'plain':!![]});_0x52b657=qs[_0x9d85('0x58')](_0x52b657,['id','createdAt',_0x9d85('0x59')]);_0x5744fd[_0x9d85('0x50')]=_[_0x9d85('0x58')](_0x5744fd['body'],['id',_0x9d85('0x5a'),_0x9d85('0x59')]);return db[_0x9d85('0x34')][_0x9d85('0x4f')](_[_0x9d85('0x46')](_0x52b657,_0x5744fd[_0x9d85('0x50')]),{'include':_0x5744fd[_0x9d85('0x39')]['includeAll']?[{'all':!![]}]:undefined})[_0x9d85('0x2c')](function(_0x23445a){var _0x231ac9=_0x5744fd[_0x9d85('0x51')][_0x9d85('0x2e')]({'plain':!![]});if(!_0x231ac9)throw new Error(_0x9d85('0x5b'));if(_0x231ac9[_0x9d85('0x5c')]===_0x9d85('0x51')){var _0x1810b2=_0x23445a[_0x9d85('0x2e')]({'plain':!![]});var _0x50193d=_0x9d85('0x52');return db['UserProfileSection'][_0x9d85('0x4d')]({'where':{'name':_0x50193d,'userProfileId':_0x231ac9[_0x9d85('0x5d')]},'raw':!![]})[_0x9d85('0x2c')](function(_0x3160ee){if(_0x3160ee&&_0x3160ee[_0x9d85('0x54')]===0x0){return db[_0x9d85('0x55')][_0x9d85('0x4f')]({'name':_0x1810b2['name'],'resourceId':_0x1810b2['id'],'type':_0x3160ee[_0x9d85('0x32')],'sectionId':_0x3160ee['id']},{})[_0x9d85('0x2c')](function(){return _0x23445a;});}else{return _0x23445a;}})[_0x9d85('0x4e')](function(_0x23f8ac){logger[_0x9d85('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23f8ac);throw _0x23f8ac;});}return _0x23445a;});}})[_0x9d85('0x2c')](respondWithResult(_0x7cee69,0xc9))['catch'](handleError(_0x7cee69,null));};exports[_0x9d85('0x2b')]=function(_0x902839,_0x258be4){if(_0x902839['body']['id']){delete _0x902839[_0x9d85('0x50')]['id'];}return db[_0x9d85('0x34')][_0x9d85('0x4d')]({'where':{'id':_0x902839[_0x9d85('0x4b')]['id']}})[_0x9d85('0x2c')](handleEntityNotFound(_0x258be4,null))[_0x9d85('0x2c')](saveUpdates(_0x902839[_0x9d85('0x50')],null))['then'](respondWithResult(_0x258be4,null))[_0x9d85('0x4e')](handleError(_0x258be4,null));};exports[_0x9d85('0x2d')]=function(_0x4253cd,_0x4ade59){return db[_0x9d85('0x34')][_0x9d85('0x4d')]({'where':{'id':_0x4253cd[_0x9d85('0x4b')]['id']}})[_0x9d85('0x2c')](handleEntityNotFound(_0x4ade59,null))[_0x9d85('0x2c')](removeEntity(_0x4ade59,null))[_0x9d85('0x4e')](handleError(_0x4ade59,null));};function widgetAttributes(_0xf01b2c){try{switch(_0xf01b2c[_0x9d85('0x5e')]){case _0x9d85('0x5f'):return[{'name':'attrUrl','value':_0xf01b2c[_0x9d85('0x60')]||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c[_0x9d85('0x61')][0x0]?_0xf01b2c[_0x9d85('0x61')][0x0][_0x9d85('0x62')]:undefined)||_0x9d85('0x63')}];case _0x9d85('0x64'):return[{'name':_0x9d85('0x65'),'value':_0xf01b2c['attrPath']||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c[_0x9d85('0x61')][0x0]?_0xf01b2c['attrs'][0x0][_0x9d85('0x62')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0xf01b2c[_0x9d85('0x66')]||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c[_0x9d85('0x61')][0x0]?_0xf01b2c[_0x9d85('0x61')][0x0][_0x9d85('0x62')]:undefined)||_0x9d85('0x67')},{'name':_0x9d85('0x68'),'value':_0xf01b2c[_0x9d85('0x68')]||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c[_0x9d85('0x61')][0x1]?_0xf01b2c[_0x9d85('0x61')][0x1][_0x9d85('0x62')]:undefined)||_0x9d85('0x69')},{'name':_0x9d85('0x6a'),'value':_0xf01b2c[_0x9d85('0x6a')]||(_0xf01b2c['attrs']&&_0xf01b2c['attrs'][0x2]?_0xf01b2c[_0x9d85('0x61')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x9d85('0x6b'),'value':_0xf01b2c[_0x9d85('0x6b')]||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c[_0x9d85('0x61')][0x0]?_0xf01b2c['attrs'][0x0][_0x9d85('0x62')]:undefined)||_0x9d85('0x6c')},{'name':_0x9d85('0x6d'),'value':_0xf01b2c['attrVoiceQueues']||(_0xf01b2c['attrs']&&_0xf01b2c[_0x9d85('0x61')][0x1]?_0xf01b2c[_0x9d85('0x61')][0x1][_0x9d85('0x62')]:undefined)||[]},{'name':_0x9d85('0x6a'),'value':_0xf01b2c[_0x9d85('0x6a')]||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c[_0x9d85('0x61')][0x2]?_0xf01b2c[_0x9d85('0x61')][0x2][_0x9d85('0x62')]:undefined)||0x14},{'name':'attrChannel','value':_0xf01b2c[_0x9d85('0x6e')]||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c['attrs'][0x3]?_0xf01b2c[_0x9d85('0x61')][0x3]['value']:undefined)||'voice'},{'name':_0x9d85('0x6f'),'value':_0xf01b2c[_0x9d85('0x6f')]||(_0xf01b2c['attrs']&&_0xf01b2c['attrs'][0x4]?_0xf01b2c['attrs'][0x4]['value']:undefined)||''},{'name':'attrFaxAccounts','value':_0xf01b2c[_0x9d85('0x70')]||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c[_0x9d85('0x61')][0x5]?_0xf01b2c['attrs'][0x5][_0x9d85('0x62')]:undefined)||''},{'name':_0x9d85('0x71'),'value':_0xf01b2c[_0x9d85('0x71')]||(_0xf01b2c['attrs']&&_0xf01b2c['attrs'][0x6]?_0xf01b2c['attrs'][0x6]['value']:undefined)||''},{'name':_0x9d85('0x72'),'value':_0xf01b2c['attrOpenchannelAccounts']||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c['attrs'][0x7]?_0xf01b2c[_0x9d85('0x61')][0x7]['value']:undefined)||''},{'name':_0x9d85('0x73'),'value':_0xf01b2c[_0x9d85('0x73')]||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c[_0x9d85('0x61')][0x8]?_0xf01b2c['attrs'][0x8][_0x9d85('0x62')]:undefined)||''},{'name':_0x9d85('0x74'),'value':_0xf01b2c[_0x9d85('0x74')]||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c[_0x9d85('0x61')][0x9]?_0xf01b2c[_0x9d85('0x61')][0x9][_0x9d85('0x62')]:undefined)||''}];case _0x9d85('0x75'):case _0x9d85('0x76'):return[{'name':_0x9d85('0x77'),'value':_0xf01b2c[_0x9d85('0x77')]||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c[_0x9d85('0x61')][0x0]?_0xf01b2c['attrs'][0x0][_0x9d85('0x62')]:undefined)||_0x9d85('0x6c')},{'name':'attrSerie2','value':_0xf01b2c[_0x9d85('0x78')]||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c[_0x9d85('0x61')][0x1]?_0xf01b2c[_0x9d85('0x61')][0x1][_0x9d85('0x62')]:undefined)||null},{'name':_0x9d85('0x79'),'value':_0xf01b2c[_0x9d85('0x79')]||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c[_0x9d85('0x61')][0x2]?_0xf01b2c[_0x9d85('0x61')][0x2][_0x9d85('0x62')]:undefined)||null},{'name':_0x9d85('0x6d'),'value':_0xf01b2c[_0x9d85('0x6d')]||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c['attrs'][0x3]?_0xf01b2c[_0x9d85('0x61')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0xf01b2c[_0x9d85('0x6e')]||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c[_0x9d85('0x61')][0x4]?_0xf01b2c[_0x9d85('0x61')][0x4][_0x9d85('0x62')]:undefined)||_0x9d85('0x7a')},{'name':_0x9d85('0x6f'),'value':_0xf01b2c['attrEmailAccounts']||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c[_0x9d85('0x61')][0x5]?_0xf01b2c[_0x9d85('0x61')][0x5][_0x9d85('0x62')]:undefined)||''},{'name':_0x9d85('0x70'),'value':_0xf01b2c['attrFaxAccounts']||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c[_0x9d85('0x61')][0x6]?_0xf01b2c[_0x9d85('0x61')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0xf01b2c[_0x9d85('0x71')]||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c[_0x9d85('0x61')][0x7]?_0xf01b2c[_0x9d85('0x61')][0x7][_0x9d85('0x62')]:undefined)||''},{'name':_0x9d85('0x72'),'value':_0xf01b2c[_0x9d85('0x72')]||(_0xf01b2c['attrs']&&_0xf01b2c[_0x9d85('0x61')][0x8]?_0xf01b2c[_0x9d85('0x61')][0x8][_0x9d85('0x62')]:undefined)||''},{'name':_0x9d85('0x73'),'value':_0xf01b2c[_0x9d85('0x73')]||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c[_0x9d85('0x61')][0x9]?_0xf01b2c[_0x9d85('0x61')][0x9][_0x9d85('0x62')]:undefined)||''},{'name':_0x9d85('0x74'),'value':_0xf01b2c['attrChatWebsites']||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c[_0x9d85('0x61')][0xa]?_0xf01b2c['attrs'][0xa]['value']:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0xf01b2c[_0x9d85('0x7b')]||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c['attrs'][0x0]?_0xf01b2c[_0x9d85('0x61')][0x0][_0x9d85('0x5e')]:undefined)||null,'value':_0xf01b2c[_0x9d85('0x7c')]||(_0xf01b2c['attrs']&&_0xf01b2c['attrs'][0x0]?_0xf01b2c['attrs'][0x0]['value']:undefined)||null},{'name':_0x9d85('0x7d'),'value':_0xf01b2c[_0x9d85('0x7d')]||(_0xf01b2c[_0x9d85('0x61')]&&_0xf01b2c[_0x9d85('0x61')][0x1]?_0xf01b2c[_0x9d85('0x61')][0x1][_0x9d85('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x510ea5){logger['error'](_0x9d85('0x7e'),JSON[_0x9d85('0x7f')](_0x510ea5));return[];}}exports['addItem']=function(_0x1c77cb,_0xb86dc1,_0x12156d){if(_0x1c77cb[_0x9d85('0x50')]['id']){delete _0x1c77cb[_0x9d85('0x50')]['id'];}return db['Dashboard'][_0x9d85('0x4d')]({'where':{'id':_0x1c77cb['params']['id']}})[_0x9d85('0x2c')](handleEntityNotFound(_0xb86dc1,null))[_0x9d85('0x2c')](function(_0x90b0){if(_0x90b0){_0x1c77cb[_0x9d85('0x50')][_0x9d85('0x80')]=_0x90b0['id'];_0x1c77cb[_0x9d85('0x50')][_0x9d85('0x61')]=widgetAttributes(_0x1c77cb[_0x9d85('0x50')]);return db['DashboardItem']['create'](_0x1c77cb['body']);}})['then'](respondWithResult(_0xb86dc1,null))['catch'](handleError(_0xb86dc1,null));};exports['getItems']=function(_0x21b3ee,_0x21c138,_0x4005dd){var _0x4a152e={};var _0x5acff3={};var _0x44b52d;var _0xb79960;return db['Dashboard']['findOne']({'where':{'id':_0x21b3ee[_0x9d85('0x4b')]['id']}})[_0x9d85('0x2c')](handleEntityNotFound(_0x21c138,null))[_0x9d85('0x2c')](function(_0x1f5ec4){if(_0x1f5ec4){_0x44b52d=_0x1f5ec4;_0x5acff3[_0x9d85('0x38')]=_[_0x9d85('0x4c')](db[_0x9d85('0x81')]['rawAttributes']);_0x5acff3['query']=_[_0x9d85('0x4c')](_0x21b3ee[_0x9d85('0x39')]);_0x5acff3[_0x9d85('0x3a')]=_['intersection'](_0x5acff3[_0x9d85('0x38')],_0x5acff3[_0x9d85('0x39')]);_0x4a152e[_0x9d85('0x3d')]=_[_0x9d85('0x3b')](_0x5acff3[_0x9d85('0x38')],qs[_0x9d85('0x3c')](_0x21b3ee[_0x9d85('0x39')][_0x9d85('0x3c')]));_0x4a152e[_0x9d85('0x3d')]=_0x4a152e[_0x9d85('0x3d')][_0x9d85('0x3e')]?_0x4a152e[_0x9d85('0x3d')]:_0x5acff3[_0x9d85('0x38')];_0x4a152e[_0x9d85('0x40')]=qs[_0x9d85('0x41')](_0x21b3ee[_0x9d85('0x39')][_0x9d85('0x41')]);_0x4a152e['where']=qs['filters'](_['pick'](_0x21b3ee['query'],_0x5acff3[_0x9d85('0x3a')]));if(_0x21b3ee['query'][_0x9d85('0x43')]){_0x4a152e[_0x9d85('0x44')]=_[_0x9d85('0x46')](_0x4a152e[_0x9d85('0x44')],{'$or':_[_0x9d85('0x33')](_0x4a152e[_0x9d85('0x3d')],function(_0x366f4e){var _0x3085f7={};_0x3085f7[_0x366f4e]={'$like':'%'+_0x21b3ee['query']['filter']+'%'};return _0x3085f7;})});}_0x4a152e=_[_0x9d85('0x46')]({},_0x4a152e,_0x21b3ee[_0x9d85('0x47')]);return _0x44b52d['getItems'](_0x4a152e);}})[_0x9d85('0x2c')](function(_0x29b8fd){if(_0x29b8fd){_0xb79960=_0x29b8fd[_0x9d85('0x3e')];if(!_0x21b3ee[_0x9d85('0x39')][_0x9d85('0x82')](_0x9d85('0x3f'))){_0x4a152e[_0x9d85('0x24')]=qs[_0x9d85('0x24')](_0x21b3ee['query']['limit']);_0x4a152e[_0x9d85('0x22')]=qs[_0x9d85('0x22')](_0x21b3ee[_0x9d85('0x39')][_0x9d85('0x22')]);}return _0x44b52d[_0x9d85('0x83')](_0x4a152e);}})[_0x9d85('0x2c')](function(_0x53b7b4){if(_0x53b7b4){return _0x53b7b4?{'count':_0xb79960,'rows':_0x53b7b4}:null;}})[_0x9d85('0x2c')](respondWithResult(_0x21c138,null))['catch'](handleError(_0x21c138,null));}; \ No newline at end of file +var _0x8574=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','UserProfileResource','sendStatus','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','omit','createdAt','update','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie2','attrSerie3','attrSmsAccounts','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne'];(function(_0x386d4a,_0x905002){var _0x1c5074=function(_0x21110e){while(--_0x21110e){_0x386d4a['push'](_0x386d4a['shift']());}};_0x1c5074(++_0x905002);}(_0x8574,0x81));var _0x4857=function(_0x38223f,_0x3a0dfc){_0x38223f=_0x38223f-0x0;var _0x3e3fab=_0x8574[_0x38223f];return _0x3e3fab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4857('0x0'));var zipdir=require(_0x4857('0x1'));var jsonpatch=require(_0x4857('0x2'));var rp=require(_0x4857('0x3'));var moment=require(_0x4857('0x4'));var BPromise=require(_0x4857('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4857('0x6'));var sox=require('sox');var csv=require(_0x4857('0x7'));var ejs=require(_0x4857('0x8'));var fs=require('fs');var fs_extra=require(_0x4857('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4857('0xa'));var jsforce=require(_0x4857('0xb'));var deskjs=require(_0x4857('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4857('0xd'));var Papa=require(_0x4857('0xe'));var Redis=require(_0x4857('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4857('0x10'));var logger=require(_0x4857('0x11'))(_0x4857('0x12'));var utils=require(_0x4857('0x13'));var config=require(_0x4857('0x14'));var licenseUtil=require(_0x4857('0x15'));var db=require(_0x4857('0x16'))['db'];config[_0x4857('0x17')]=_[_0x4857('0x18')](config[_0x4857('0x17')],{'host':_0x4857('0x19'),'port':0x18eb});var socket=require(_0x4857('0x1a'))(new Redis(config[_0x4857('0x17')]));require(_0x4857('0x1b'))[_0x4857('0x1c')](socket);function respondWithStatusCode(_0xe2b2c9,_0xd6d07c){_0xd6d07c=_0xd6d07c||0xcc;return function(_0x300cde){if(_0x300cde){return _0xe2b2c9['sendStatus'](_0xd6d07c);}return _0xe2b2c9[_0x4857('0x1d')](_0xd6d07c)['end']();};}function respondWithResult(_0x4da00b,_0x46cd07){_0x46cd07=_0x46cd07||0xc8;return function(_0x35121c){if(_0x35121c){return _0x4da00b['status'](_0x46cd07)[_0x4857('0x1e')](_0x35121c);}};}function respondWithFilteredResult(_0x4690af,_0x1852ca){return function(_0xab8a6){if(_0xab8a6){var _0x458aa9=typeof _0x1852ca[_0x4857('0x1f')]===_0x4857('0x20')&&typeof _0x1852ca[_0x4857('0x21')]==='undefined';var _0x5ee00c=_0xab8a6[_0x4857('0x22')];var _0xe4a7a4=_0x458aa9?0x0:_0x1852ca[_0x4857('0x1f')];var _0x626f44=_0x458aa9?_0xab8a6[_0x4857('0x22')]:_0x1852ca[_0x4857('0x1f')]+_0x1852ca[_0x4857('0x21')];var _0x445265;if(_0x626f44>=_0x5ee00c){_0x626f44=_0x5ee00c;_0x445265=0xc8;}else{_0x445265=0xce;}_0x4690af['status'](_0x445265);return _0x4690af[_0x4857('0x23')]('Content-Range',_0xe4a7a4+'-'+_0x626f44+'/'+_0x5ee00c)[_0x4857('0x1e')](_0xab8a6);}return null;};}function patchUpdates(_0x74a78d){return function(_0x44a329){try{jsonpatch[_0x4857('0x24')](_0x44a329,_0x74a78d,!![]);}catch(_0x3f80f9){return BPromise[_0x4857('0x25')](_0x3f80f9);}return _0x44a329[_0x4857('0x26')]();};}function saveUpdates(_0x4d5ad1,_0x32d416){return function(_0x3be379){if(_0x3be379){return _0x3be379['update'](_0x4d5ad1)[_0x4857('0x27')](function(_0x8669ea){return _0x8669ea;});}return null;};}function removeEntity(_0x1796fe,_0x208184){return function(_0x509cfc){if(_0x509cfc){return _0x509cfc[_0x4857('0x28')]()[_0x4857('0x27')](function(){var _0x4ce014=_0x509cfc['get']({'plain':!![]});var _0x57bcb4='CustomDashboards';return db[_0x4857('0x29')][_0x4857('0x28')]({'where':{'type':_0x57bcb4,'resourceId':_0x4ce014['id']}})[_0x4857('0x27')](function(){return _0x509cfc;});})[_0x4857('0x27')](function(){_0x1796fe[_0x4857('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27e6db,_0x57e374){return function(_0x3c6a09){if(!_0x3c6a09){_0x27e6db[_0x4857('0x2a')](0x194);}return _0x3c6a09;};}function handleError(_0x47d392,_0x4e70a9){_0x4e70a9=_0x4e70a9||0x1f4;return function(_0x19272f){logger['error'](_0x19272f[_0x4857('0x2b')]);if(_0x19272f['name']){delete _0x19272f[_0x4857('0x2c')];}_0x47d392['status'](_0x4e70a9)[_0x4857('0x2d')](_0x19272f);};}exports[_0x4857('0x2e')]=function(_0x1030fc,_0x24e776){var _0x2bdbb9={},_0x3d6269={},_0x11a108={'count':0x0,'rows':[]};var _0x523b6d=_[_0x4857('0x2f')](db[_0x4857('0x30')][_0x4857('0x31')],function(_0x2e1a08){return{'name':_0x2e1a08[_0x4857('0x32')],'type':_0x2e1a08[_0x4857('0x33')][_0x4857('0x34')]};});_0x3d6269[_0x4857('0x35')]=_[_0x4857('0x2f')](_0x523b6d,_0x4857('0x2c'));_0x3d6269[_0x4857('0x36')]=_[_0x4857('0x37')](_0x1030fc[_0x4857('0x36')]);_0x3d6269[_0x4857('0x38')]=_[_0x4857('0x39')](_0x3d6269[_0x4857('0x35')],_0x3d6269[_0x4857('0x36')]);_0x2bdbb9[_0x4857('0x3a')]=_[_0x4857('0x39')](_0x3d6269['model'],qs[_0x4857('0x3b')](_0x1030fc[_0x4857('0x36')][_0x4857('0x3b')]));_0x2bdbb9[_0x4857('0x3a')]=_0x2bdbb9[_0x4857('0x3a')][_0x4857('0x3c')]?_0x2bdbb9['attributes']:_0x3d6269[_0x4857('0x35')];if(!_0x1030fc[_0x4857('0x36')][_0x4857('0x3d')](_0x4857('0x3e'))){_0x2bdbb9['limit']=qs['limit'](_0x1030fc[_0x4857('0x36')][_0x4857('0x21')]);_0x2bdbb9[_0x4857('0x1f')]=qs['offset'](_0x1030fc[_0x4857('0x36')][_0x4857('0x1f')]);}_0x2bdbb9[_0x4857('0x3f')]=qs[_0x4857('0x40')](_0x1030fc[_0x4857('0x36')][_0x4857('0x40')]);_0x2bdbb9[_0x4857('0x41')]=qs[_0x4857('0x38')](_[_0x4857('0x42')](_0x1030fc[_0x4857('0x36')],_0x3d6269[_0x4857('0x38')]),_0x523b6d);if(_0x1030fc[_0x4857('0x36')][_0x4857('0x43')]){_0x2bdbb9[_0x4857('0x41')]=_['merge'](_0x2bdbb9[_0x4857('0x41')],{'$or':_[_0x4857('0x2f')](_0x523b6d,function(_0x2158d2){if(_0x2158d2[_0x4857('0x33')]!=='VIRTUAL'){var _0x3e1aa1={};_0x3e1aa1[_0x2158d2[_0x4857('0x2c')]]={'$like':'%'+_0x1030fc[_0x4857('0x36')]['filter']+'%'};return _0x3e1aa1;}})});}_0x2bdbb9=_['merge']({},_0x2bdbb9,_0x1030fc[_0x4857('0x44')]);var _0x463b65={'where':_0x2bdbb9[_0x4857('0x41')]};return db['Dashboard'][_0x4857('0x22')](_0x463b65)[_0x4857('0x27')](function(_0x37d8f8){_0x11a108[_0x4857('0x22')]=_0x37d8f8;if(_0x1030fc[_0x4857('0x36')][_0x4857('0x45')]){_0x2bdbb9[_0x4857('0x46')]=[{'all':!![]}];}return db[_0x4857('0x30')][_0x4857('0x47')](_0x2bdbb9);})[_0x4857('0x27')](function(_0x34ea44){_0x11a108[_0x4857('0x48')]=_0x34ea44;return _0x11a108;})[_0x4857('0x27')](respondWithFilteredResult(_0x24e776,_0x2bdbb9))[_0x4857('0x49')](handleError(_0x24e776,null));};exports[_0x4857('0x4a')]=function(_0x420dd0,_0x476ba2){var _0x902144={'raw':![],'where':{'id':_0x420dd0[_0x4857('0x4b')]['id']}},_0x422f45={};_0x422f45[_0x4857('0x35')]=_[_0x4857('0x37')](db[_0x4857('0x30')][_0x4857('0x31')]);_0x422f45[_0x4857('0x36')]=_[_0x4857('0x37')](_0x420dd0[_0x4857('0x36')]);_0x422f45['filters']=_[_0x4857('0x39')](_0x422f45[_0x4857('0x35')],_0x422f45[_0x4857('0x36')]);_0x902144[_0x4857('0x3a')]=_[_0x4857('0x39')](_0x422f45[_0x4857('0x35')],qs[_0x4857('0x3b')](_0x420dd0[_0x4857('0x36')][_0x4857('0x3b')]));_0x902144[_0x4857('0x3a')]=_0x902144[_0x4857('0x3a')][_0x4857('0x3c')]?_0x902144[_0x4857('0x3a')]:_0x422f45['model'];if(_0x420dd0[_0x4857('0x36')][_0x4857('0x45')]){_0x902144[_0x4857('0x46')]=[{'all':!![]}];}_0x902144=_[_0x4857('0x4c')]({},_0x902144,_0x420dd0['options']);return db['Dashboard'][_0x4857('0x4d')](_0x902144)['then'](handleEntityNotFound(_0x476ba2,null))[_0x4857('0x27')](respondWithResult(_0x476ba2,null))[_0x4857('0x49')](handleError(_0x476ba2,null));};exports[_0x4857('0x4e')]=function(_0x25a63b,_0x104d51){return db[_0x4857('0x30')]['create'](_0x25a63b[_0x4857('0x4f')],{})['then'](function(_0x267936){var _0x4aeb60=_0x25a63b[_0x4857('0x50')][_0x4857('0x51')]({'plain':!![]});if(!_0x4aeb60)throw new Error(_0x4857('0x52'));if(_0x4aeb60[_0x4857('0x53')]===_0x4857('0x50')){var _0x41824a=_0x267936[_0x4857('0x51')]({'plain':!![]});var _0x2c3374=_0x4857('0x54');return db[_0x4857('0x55')]['find']({'where':{'name':_0x2c3374,'userProfileId':_0x4aeb60[_0x4857('0x56')]},'raw':!![]})[_0x4857('0x27')](function(_0x59c2a3){if(_0x59c2a3&&_0x59c2a3[_0x4857('0x57')]===0x0){return db[_0x4857('0x29')][_0x4857('0x4e')]({'name':_0x41824a[_0x4857('0x2c')],'resourceId':_0x41824a['id'],'type':_0x59c2a3[_0x4857('0x2c')],'sectionId':_0x59c2a3['id']},{})[_0x4857('0x27')](function(){return _0x267936;});}else{return _0x267936;}})[_0x4857('0x49')](function(_0x5af46d){logger[_0x4857('0x58')](_0x4857('0x59'),_0x5af46d);throw _0x5af46d;});}return _0x267936;})[_0x4857('0x27')](respondWithResult(_0x104d51,0xc9))['catch'](handleError(_0x104d51,null));};exports[_0x4857('0x5a')]=function(_0x1b6ac0,_0x10a7a7){var _0x4ab7c8={'where':{'id':_0x1b6ac0['params']['id']}},_0x24f32f={};_0x24f32f[_0x4857('0x35')]=_['keys'](db[_0x4857('0x30')]['rawAttributes']);_0x4ab7c8[_0x4857('0x3a')]=_[_0x4857('0x39')](_0x24f32f['model'],qs['fields'](_0x1b6ac0[_0x4857('0x36')][_0x4857('0x3b')]));_0x4ab7c8[_0x4857('0x3a')]=_0x4ab7c8[_0x4857('0x3a')][_0x4857('0x3c')]?_0x4ab7c8['attributes']:_0x24f32f[_0x4857('0x35')];if(_0x1b6ac0[_0x4857('0x36')][_0x4857('0x45')]){_0x4ab7c8[_0x4857('0x46')]=[{'all':!![]}];}_0x4ab7c8=_[_0x4857('0x4c')]({},_0x4ab7c8,_0x1b6ac0[_0x4857('0x44')]);return db[_0x4857('0x30')][_0x4857('0x4d')](_0x4ab7c8)[_0x4857('0x27')](handleEntityNotFound(_0x10a7a7,null))['then'](function(_0xcb112e){if(_0xcb112e){var _0x4837e5=_0xcb112e[_0x4857('0x51')]({'plain':!![]});_0x4837e5=qs['omit'](_0x4837e5,['id','createdAt',_0x4857('0x5b')]);_0x1b6ac0[_0x4857('0x4f')]=_[_0x4857('0x5c')](_0x1b6ac0[_0x4857('0x4f')],['id',_0x4857('0x5d'),_0x4857('0x5b')]);return db[_0x4857('0x30')][_0x4857('0x4e')](_['merge'](_0x4837e5,_0x1b6ac0['body']),{'include':_0x1b6ac0[_0x4857('0x36')]['includeAll']?[{'all':!![]}]:undefined})[_0x4857('0x27')](function(_0x5079a){var _0x10c663=_0x1b6ac0[_0x4857('0x50')]['get']({'plain':!![]});if(!_0x10c663)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10c663[_0x4857('0x53')]===_0x4857('0x50')){var _0x4b2254=_0x5079a['get']({'plain':!![]});var _0x57d8af=_0x4857('0x54');return db[_0x4857('0x55')][_0x4857('0x4d')]({'where':{'name':_0x57d8af,'userProfileId':_0x10c663['userProfileId']},'raw':!![]})[_0x4857('0x27')](function(_0x347ceb){if(_0x347ceb&&_0x347ceb['autoAssociation']===0x0){return db[_0x4857('0x29')]['create']({'name':_0x4b2254[_0x4857('0x2c')],'resourceId':_0x4b2254['id'],'type':_0x347ceb[_0x4857('0x2c')],'sectionId':_0x347ceb['id']},{})['then'](function(){return _0x5079a;});}else{return _0x5079a;}})[_0x4857('0x49')](function(_0x5e226b){logger['error'](_0x4857('0x59'),_0x5e226b);throw _0x5e226b;});}return _0x5079a;});}})[_0x4857('0x27')](respondWithResult(_0x10a7a7,0xc9))[_0x4857('0x49')](handleError(_0x10a7a7,null));};exports[_0x4857('0x5e')]=function(_0x4e1adf,_0x678c54){if(_0x4e1adf[_0x4857('0x4f')]['id']){delete _0x4e1adf[_0x4857('0x4f')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x4e1adf[_0x4857('0x4b')]['id']}})[_0x4857('0x27')](handleEntityNotFound(_0x678c54,null))[_0x4857('0x27')](saveUpdates(_0x4e1adf['body'],null))['then'](respondWithResult(_0x678c54,null))['catch'](handleError(_0x678c54,null));};exports[_0x4857('0x28')]=function(_0x1581d9,_0x12ff81){return db[_0x4857('0x30')][_0x4857('0x4d')]({'where':{'id':_0x1581d9['params']['id']}})['then'](handleEntityNotFound(_0x12ff81,null))[_0x4857('0x27')](removeEntity(_0x12ff81,null))[_0x4857('0x49')](handleError(_0x12ff81,null));};function widgetAttributes(_0x1f490f){try{switch(_0x1f490f[_0x4857('0x33')]){case'iframe':return[{'name':_0x4857('0x5f'),'value':_0x1f490f[_0x4857('0x5f')]||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f[_0x4857('0x60')][0x0]?_0x1f490f[_0x4857('0x60')][0x0][_0x4857('0x61')]:undefined)||_0x4857('0x62')}];case'custom':return[{'name':_0x4857('0x63'),'value':_0x1f490f[_0x4857('0x63')]||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f[_0x4857('0x60')][0x0]?_0x1f490f[_0x4857('0x60')][0x0][_0x4857('0x61')]:undefined)||''}];case _0x4857('0x64'):return[{'name':_0x4857('0x65'),'value':_0x1f490f[_0x4857('0x65')]||(_0x1f490f['attrs']&&_0x1f490f[_0x4857('0x60')][0x0]?_0x1f490f[_0x4857('0x60')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x4857('0x66'),'value':_0x1f490f[_0x4857('0x66')]||(_0x1f490f['attrs']&&_0x1f490f[_0x4857('0x60')][0x1]?_0x1f490f['attrs'][0x1][_0x4857('0x61')]:undefined)||_0x4857('0x67')},{'name':_0x4857('0x68'),'value':_0x1f490f[_0x4857('0x68')]||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f[_0x4857('0x60')][0x2]?_0x1f490f[_0x4857('0x60')][0x2][_0x4857('0x61')]:undefined)||0xc}];case _0x4857('0x69'):return[{'name':_0x4857('0x6a'),'value':_0x1f490f[_0x4857('0x6a')]||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f['attrs'][0x0]?_0x1f490f[_0x4857('0x60')][0x0][_0x4857('0x61')]:undefined)||_0x4857('0x6b')},{'name':'attrVoiceQueues','value':_0x1f490f[_0x4857('0x6c')]||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f[_0x4857('0x60')][0x1]?_0x1f490f['attrs'][0x1][_0x4857('0x61')]:undefined)||[]},{'name':_0x4857('0x68'),'value':_0x1f490f[_0x4857('0x68')]||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f['attrs'][0x2]?_0x1f490f[_0x4857('0x60')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x1f490f[_0x4857('0x6d')]||(_0x1f490f['attrs']&&_0x1f490f[_0x4857('0x60')][0x3]?_0x1f490f[_0x4857('0x60')][0x3][_0x4857('0x61')]:undefined)||_0x4857('0x6e')},{'name':_0x4857('0x6f'),'value':_0x1f490f[_0x4857('0x6f')]||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f['attrs'][0x4]?_0x1f490f[_0x4857('0x60')][0x4][_0x4857('0x61')]:undefined)||''},{'name':_0x4857('0x70'),'value':_0x1f490f['attrFaxAccounts']||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f[_0x4857('0x60')][0x5]?_0x1f490f[_0x4857('0x60')][0x5][_0x4857('0x61')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x1f490f['attrSmsAccounts']||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f[_0x4857('0x60')][0x6]?_0x1f490f[_0x4857('0x60')][0x6]['value']:undefined)||''},{'name':_0x4857('0x71'),'value':_0x1f490f[_0x4857('0x71')]||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f[_0x4857('0x60')][0x7]?_0x1f490f[_0x4857('0x60')][0x7][_0x4857('0x61')]:undefined)||''},{'name':_0x4857('0x72'),'value':_0x1f490f[_0x4857('0x72')]||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f[_0x4857('0x60')][0x8]?_0x1f490f[_0x4857('0x60')][0x8][_0x4857('0x61')]:undefined)||''},{'name':_0x4857('0x73'),'value':_0x1f490f[_0x4857('0x73')]||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f[_0x4857('0x60')][0x9]?_0x1f490f['attrs'][0x9][_0x4857('0x61')]:undefined)||''}];case'multibar-chart':case _0x4857('0x74'):return[{'name':'attrSerie1','value':_0x1f490f['attrSerie1']||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f[_0x4857('0x60')][0x0]?_0x1f490f[_0x4857('0x60')][0x0]['value']:undefined)||'total'},{'name':_0x4857('0x75'),'value':_0x1f490f[_0x4857('0x75')]||(_0x1f490f['attrs']&&_0x1f490f['attrs'][0x1]?_0x1f490f[_0x4857('0x60')][0x1][_0x4857('0x61')]:undefined)||null},{'name':_0x4857('0x76'),'value':_0x1f490f[_0x4857('0x76')]||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f[_0x4857('0x60')][0x2]?_0x1f490f[_0x4857('0x60')][0x2][_0x4857('0x61')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x1f490f[_0x4857('0x6c')]||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f[_0x4857('0x60')][0x3]?_0x1f490f[_0x4857('0x60')][0x3][_0x4857('0x61')]:undefined)||[]},{'name':_0x4857('0x6d'),'value':_0x1f490f[_0x4857('0x6d')]||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f[_0x4857('0x60')][0x4]?_0x1f490f['attrs'][0x4]['value']:undefined)||_0x4857('0x6e')},{'name':'attrEmailAccounts','value':_0x1f490f[_0x4857('0x6f')]||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f['attrs'][0x5]?_0x1f490f[_0x4857('0x60')][0x5]['value']:undefined)||''},{'name':_0x4857('0x70'),'value':_0x1f490f[_0x4857('0x70')]||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f['attrs'][0x6]?_0x1f490f[_0x4857('0x60')][0x6]['value']:undefined)||''},{'name':_0x4857('0x77'),'value':_0x1f490f[_0x4857('0x77')]||(_0x1f490f['attrs']&&_0x1f490f[_0x4857('0x60')][0x7]?_0x1f490f[_0x4857('0x60')][0x7][_0x4857('0x61')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1f490f['attrOpenchannelAccounts']||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f[_0x4857('0x60')][0x8]?_0x1f490f[_0x4857('0x60')][0x8][_0x4857('0x61')]:undefined)||''},{'name':_0x4857('0x72'),'value':_0x1f490f['attrWhatsappAccounts']||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f[_0x4857('0x60')][0x9]?_0x1f490f['attrs'][0x9][_0x4857('0x61')]:undefined)||''},{'name':_0x4857('0x73'),'value':_0x1f490f[_0x4857('0x73')]||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f['attrs'][0xa]?_0x1f490f[_0x4857('0x60')][0xa][_0x4857('0x61')]:undefined)||''}];case _0x4857('0x78'):return[{'name':_0x4857('0x79'),'type':_0x1f490f['reportType']||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f['attrs'][0x0]?_0x1f490f['attrs'][0x0][_0x4857('0x33')]:undefined)||null,'value':_0x1f490f[_0x4857('0x79')]||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f[_0x4857('0x60')][0x0]?_0x1f490f[_0x4857('0x60')][0x0][_0x4857('0x61')]:undefined)||null},{'name':_0x4857('0x7a'),'value':_0x1f490f[_0x4857('0x7a')]||(_0x1f490f[_0x4857('0x60')]&&_0x1f490f[_0x4857('0x60')][0x1]?_0x1f490f[_0x4857('0x60')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x5f5483){logger['error'](_0x4857('0x7b'),JSON[_0x4857('0x7c')](_0x5f5483));return[];}}exports[_0x4857('0x7d')]=function(_0x232308,_0x5d1491,_0x202dad){if(_0x232308[_0x4857('0x4f')]['id']){delete _0x232308[_0x4857('0x4f')]['id'];}return db[_0x4857('0x30')][_0x4857('0x4d')]({'where':{'id':_0x232308[_0x4857('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5d1491,null))[_0x4857('0x27')](function(_0x1255bb){if(_0x1255bb){_0x232308[_0x4857('0x4f')][_0x4857('0x7e')]=_0x1255bb['id'];_0x232308[_0x4857('0x4f')]['attrs']=widgetAttributes(_0x232308['body']);return db['DashboardItem'][_0x4857('0x4e')](_0x232308[_0x4857('0x4f')]);}})['then'](respondWithResult(_0x5d1491,null))[_0x4857('0x49')](handleError(_0x5d1491,null));};exports[_0x4857('0x7f')]=function(_0x659800,_0x7b4975,_0xd061a7){var _0x1fff65={};var _0x51cb8c={};var _0x5950a5;var _0x5112da;return db['Dashboard'][_0x4857('0x80')]({'where':{'id':_0x659800['params']['id']}})[_0x4857('0x27')](handleEntityNotFound(_0x7b4975,null))[_0x4857('0x27')](function(_0x593ea0){if(_0x593ea0){_0x5950a5=_0x593ea0;_0x51cb8c[_0x4857('0x35')]=_[_0x4857('0x37')](db['DashboardItem'][_0x4857('0x31')]);_0x51cb8c[_0x4857('0x36')]=_['keys'](_0x659800['query']);_0x51cb8c[_0x4857('0x38')]=_[_0x4857('0x39')](_0x51cb8c[_0x4857('0x35')],_0x51cb8c[_0x4857('0x36')]);_0x1fff65[_0x4857('0x3a')]=_[_0x4857('0x39')](_0x51cb8c[_0x4857('0x35')],qs[_0x4857('0x3b')](_0x659800['query'][_0x4857('0x3b')]));_0x1fff65[_0x4857('0x3a')]=_0x1fff65[_0x4857('0x3a')]['length']?_0x1fff65[_0x4857('0x3a')]:_0x51cb8c[_0x4857('0x35')];_0x1fff65['order']=qs[_0x4857('0x40')](_0x659800['query'][_0x4857('0x40')]);_0x1fff65[_0x4857('0x41')]=qs[_0x4857('0x38')](_[_0x4857('0x42')](_0x659800[_0x4857('0x36')],_0x51cb8c[_0x4857('0x38')]));if(_0x659800['query'][_0x4857('0x43')]){_0x1fff65[_0x4857('0x41')]=_[_0x4857('0x4c')](_0x1fff65[_0x4857('0x41')],{'$or':_[_0x4857('0x2f')](_0x1fff65['attributes'],function(_0x3d0ada){var _0x43d67d={};_0x43d67d[_0x3d0ada]={'$like':'%'+_0x659800['query'][_0x4857('0x43')]+'%'};return _0x43d67d;})});}_0x1fff65=_[_0x4857('0x4c')]({},_0x1fff65,_0x659800[_0x4857('0x44')]);return _0x5950a5['getItems'](_0x1fff65);}})['then'](function(_0xed4cda){if(_0xed4cda){_0x5112da=_0xed4cda[_0x4857('0x3c')];if(!_0x659800['query'][_0x4857('0x3d')](_0x4857('0x3e'))){_0x1fff65['limit']=qs[_0x4857('0x21')](_0x659800[_0x4857('0x36')][_0x4857('0x21')]);_0x1fff65[_0x4857('0x1f')]=qs['offset'](_0x659800['query'][_0x4857('0x1f')]);}return _0x5950a5[_0x4857('0x7f')](_0x1fff65);}})[_0x4857('0x27')](function(_0x2f3596){if(_0x2f3596){return _0x2f3596?{'count':_0x5112da,'rows':_0x2f3596}:null;}})[_0x4857('0x27')](respondWithResult(_0x7b4975,null))['catch'](handleError(_0x7b4975,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index c3d6f4e..2ea1277 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 _0x2a38=['update','emit','../../mysqldb','Dashboard','setMaxListeners','save'];(function(_0xfcd855,_0x3a730a){var _0x3c36c2=function(_0x5081ad){while(--_0x5081ad){_0xfcd855['push'](_0xfcd855['shift']());}};_0x3c36c2(++_0x3a730a);}(_0x2a38,0x1e8));var _0x82a3=function(_0x59941f,_0x211569){_0x59941f=_0x59941f-0x0;var _0x4cdaf0=_0x2a38[_0x59941f];return _0x4cdaf0;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x82a3('0x0'))['db'][_0x82a3('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x82a3('0x2')](0x0);var events={'afterCreate':_0x82a3('0x3'),'afterUpdate':_0x82a3('0x4'),'afterDestroy':'remove'};function emitEvent(_0x48aa92){return function(_0x976a0a,_0x193722,_0xadfee3){DashboardEvents['emit'](_0x48aa92+':'+_0x976a0a['id'],_0x976a0a);DashboardEvents[_0x82a3('0x5')](_0x48aa92,_0x976a0a);_0xadfee3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xb016=['remove','emit','hasOwnProperty','events','../../mysqldb','save'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb016,0x159));var _0x6b01=function(_0x3ca848,_0x32728b){_0x3ca848=_0x3ca848-0x0;var _0x26de64=_0xb016[_0x3ca848];return _0x26de64;};'use strict';var EventEmitter=require(_0x6b01('0x0'));var Dashboard=require(_0x6b01('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b01('0x2'),'afterUpdate':'update','afterDestroy':_0x6b01('0x3')};function emitEvent(_0x464e83){return function(_0x161b59,_0x3b9de1,_0x5964ca){DashboardEvents[_0x6b01('0x4')](_0x464e83+':'+_0x161b59['id'],_0x161b59);DashboardEvents[_0x6b01('0x4')](_0x464e83,_0x161b59);_0x5964ca(null);};}for(var e in events){if(events[_0x6b01('0x5')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index cc8c15c..21fb336 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 _0x6e37=['exports','define','Dashboard','dashboards','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./dashboard.attributes'];(function(_0x2b9ae3,_0xd6d709){var _0x4e18a2=function(_0x397406){while(--_0x397406){_0x2b9ae3['push'](_0x2b9ae3['shift']());}};_0x4e18a2(++_0xd6d709);}(_0x6e37,0xee));var _0x76e3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e37[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x76e3('0x0'));var util=require(_0x76e3('0x1'));var logger=require(_0x76e3('0x2'))('api');var moment=require(_0x76e3('0x3'));var BPromise=require(_0x76e3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76e3('0x5'));var rimraf=require(_0x76e3('0x6'));var config=require(_0x76e3('0x7'));var attributes=require(_0x76e3('0x8'));module[_0x76e3('0x9')]=function(_0x2920ca,_0x20b2f8){return _0x2920ca[_0x76e3('0xa')](_0x76e3('0xb'),attributes,{'tableName':_0x76e3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37f9=['moment','request-promise','path','rimraf','./dashboard.attributes','exports','Dashboard','dashboards','lodash','../../config/logger','api'];(function(_0xdf9009,_0x216ed5){var _0x484793=function(_0x192c3a){while(--_0x192c3a){_0xdf9009['push'](_0xdf9009['shift']());}};_0x484793(++_0x216ed5);}(_0x37f9,0x1ec));var _0x937f=function(_0x1d6b14,_0x572e45){_0x1d6b14=_0x1d6b14-0x0;var _0x5b3317=_0x37f9[_0x1d6b14];return _0x5b3317;};'use strict';var _=require(_0x937f('0x0'));var util=require('util');var logger=require(_0x937f('0x1'))(_0x937f('0x2'));var moment=require(_0x937f('0x3'));var BPromise=require('bluebird');var rp=require(_0x937f('0x4'));var fs=require('fs');var path=require(_0x937f('0x5'));var rimraf=require(_0x937f('0x6'));var config=require('../../config/environment');var attributes=require(_0x937f('0x7'));module[_0x937f('0x8')]=function(_0x5da082,_0x4230e9){return _0x5da082['define'](_0x937f('0x9'),attributes,{'tableName':_0x937f('0xa'),'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 d5a8af4..b8f7ed6 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 _0x602c=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','defaults','redis','socket.io-emitter','./dashboard.socket','register','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message'];(function(_0x2af3af,_0x689a4){var _0x3b075d=function(_0x2415bc){while(--_0x2415bc){_0x2af3af['push'](_0x2af3af['shift']());}};_0x3b075d(++_0x689a4);}(_0x602c,0x11a));var _0xc602=function(_0x37a174,_0x1f3cbd){_0x37a174=_0x37a174-0x0;var _0x4f6328=_0x602c[_0x37a174];return _0x4f6328;};'use strict';var _=require(_0xc602('0x0'));var util=require(_0xc602('0x1'));var moment=require(_0xc602('0x2'));var BPromise=require(_0xc602('0x3'));var rs=require(_0xc602('0x4'));var fs=require('fs');var Redis=require(_0xc602('0x5'));var db=require(_0xc602('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc602('0x7'));var config=require(_0xc602('0x8'));var jayson=require(_0xc602('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xc602('0xa')](config[_0xc602('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc602('0xc'))(new Redis(config[_0xc602('0xb')]));require(_0xc602('0xd'))[_0xc602('0xe')](socket);function respondWithRpcPromise(_0x405351,_0x220e18,_0x3f9e1a){return new BPromise(function(_0x35d88d,_0x4dcd84){return client[_0xc602('0xf')](_0x405351,_0x3f9e1a)[_0xc602('0x10')](function(_0x2209c7){logger[_0xc602('0x11')]('Dashboard,\x20%s,\x20%s',_0x220e18,_0xc602('0x12'));logger[_0xc602('0x13')](_0xc602('0x14'),_0x220e18,_0xc602('0x12'),JSON[_0xc602('0x15')](_0x2209c7));if(_0x2209c7[_0xc602('0x16')]){if(_0x2209c7['error'][_0xc602('0x17')]===0x1f4){logger[_0xc602('0x16')](_0xc602('0x18'),_0x220e18,_0x2209c7[_0xc602('0x16')][_0xc602('0x19')]);return _0x4dcd84(_0x2209c7[_0xc602('0x16')][_0xc602('0x19')]);}logger[_0xc602('0x16')](_0xc602('0x18'),_0x220e18,_0x2209c7[_0xc602('0x16')]['message']);return _0x35d88d(_0x2209c7['error'][_0xc602('0x19')]);}else{logger['info'](_0xc602('0x18'),_0x220e18,_0xc602('0x12'));_0x35d88d(_0x2209c7[_0xc602('0x1a')][_0xc602('0x19')]);}})[_0xc602('0x1b')](function(_0x294d2e){logger[_0xc602('0x16')](_0xc602('0x18'),_0x220e18,_0x294d2e);_0x4dcd84(_0x294d2e);});});} \ No newline at end of file +var _0x79d7=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','then','Dashboard,\x20%s,\x20%s','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x11219a,_0x517322){var _0x36afbc=function(_0x15603d){while(--_0x15603d){_0x11219a['push'](_0x11219a['shift']());}};_0x36afbc(++_0x517322);}(_0x79d7,0x1bb));var _0x779d=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x79d7[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x779d('0x0'));var util=require(_0x779d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x779d('0x2'));var fs=require('fs');var Redis=require(_0x779d('0x3'));var db=require(_0x779d('0x4'))['db'];var utils=require(_0x779d('0x5'));var logger=require(_0x779d('0x6'))('rpc');var config=require(_0x779d('0x7'));var jayson=require(_0x779d('0x8'));var client=jayson[_0x779d('0x9')][_0x779d('0xa')]({'port':0x232a});config[_0x779d('0xb')]=_[_0x779d('0xc')](config['redis'],{'host':_0x779d('0xd'),'port':0x18eb});var socket=require(_0x779d('0xe'))(new Redis(config[_0x779d('0xb')]));require(_0x779d('0xf'))[_0x779d('0x10')](socket);function respondWithRpcPromise(_0x24bb64,_0x707ab8,_0x4827d3){return new BPromise(function(_0x34e37a,_0x56b276){return client['request'](_0x24bb64,_0x4827d3)[_0x779d('0x11')](function(_0x3ec8d1){logger['info'](_0x779d('0x12'),_0x707ab8,'request\x20sent');logger['debug'](_0x779d('0x13'),_0x707ab8,_0x779d('0x14'),JSON[_0x779d('0x15')](_0x3ec8d1));if(_0x3ec8d1[_0x779d('0x16')]){if(_0x3ec8d1['error'][_0x779d('0x17')]===0x1f4){logger[_0x779d('0x16')](_0x779d('0x12'),_0x707ab8,_0x3ec8d1[_0x779d('0x16')][_0x779d('0x18')]);return _0x56b276(_0x3ec8d1[_0x779d('0x16')][_0x779d('0x18')]);}logger['error'](_0x779d('0x12'),_0x707ab8,_0x3ec8d1[_0x779d('0x16')][_0x779d('0x18')]);return _0x34e37a(_0x3ec8d1[_0x779d('0x16')]['message']);}else{logger[_0x779d('0x19')](_0x779d('0x12'),_0x707ab8,_0x779d('0x14'));_0x34e37a(_0x3ec8d1[_0x779d('0x1a')]['message']);}})[_0x779d('0x1b')](function(_0x317b76){logger['error'](_0x779d('0x12'),_0x707ab8,_0x317b76);_0x56b276(_0x317b76);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 6da1674..50608fa 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 _0xda6d=['length','dashboard:','./dashboard.events','save','remove','register'];(function(_0x5f35c1,_0x618cd8){var _0x5b3df3=function(_0x411dfe){while(--_0x411dfe){_0x5f35c1['push'](_0x5f35c1['shift']());}};_0x5b3df3(++_0x618cd8);}(_0xda6d,0x6e));var _0xdda6=function(_0x4c40a3,_0x56a4d1){_0x4c40a3=_0x4c40a3-0x0;var _0x1fd7cf=_0xda6d[_0x4c40a3];return _0x1fd7cf;};'use strict';var DashboardEvents=require(_0xdda6('0x0'));var events=[_0xdda6('0x1'),_0xdda6('0x2'),'update'];function createListener(_0x96601b,_0x26cf9d){return function(_0x255e90){_0x26cf9d['emit'](_0x96601b,_0x255e90);};}function removeListener(_0x5d0e29,_0x46c356){return function(){DashboardEvents['removeListener'](_0x5d0e29,_0x46c356);};}exports[_0xdda6('0x3')]=function(_0x1a2818){for(var _0x28be14=0x0,_0x2488a9=events[_0xdda6('0x4')];_0x28be14<_0x2488a9;_0x28be14++){var _0x3cf79e=events[_0x28be14];var _0x3ebc00=createListener(_0xdda6('0x5')+_0x3cf79e,_0x1a2818);DashboardEvents['on'](_0x3cf79e,_0x3ebc00);}}; \ No newline at end of file +var _0xc24a=['register','length','./dashboard.events','save','remove','update','emit','removeListener'];(function(_0x241028,_0x279c1c){var _0x210ae7=function(_0x56c226){while(--_0x56c226){_0x241028['push'](_0x241028['shift']());}};_0x210ae7(++_0x279c1c);}(_0xc24a,0x12a));var _0xac24=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc24a[_0x2dafbe];return _0x58a45a;};'use strict';var DashboardEvents=require(_0xac24('0x0'));var events=[_0xac24('0x1'),_0xac24('0x2'),_0xac24('0x3')];function createListener(_0x75177,_0x14edae){return function(_0x505a58){_0x14edae[_0xac24('0x4')](_0x75177,_0x505a58);};}function removeListener(_0x5006e9,_0x318e33){return function(){DashboardEvents[_0xac24('0x5')](_0x5006e9,_0x318e33);};}exports[_0xac24('0x6')]=function(_0x48d618){for(var _0x1fbc36=0x0,_0x7f9386=events[_0xac24('0x7')];_0x1fbc36<_0x7f9386;_0x1fbc36++){var _0x45aa19=events[_0x1fbc36];var _0x25ffb3=createListener('dashboard:'+_0x45aa19,_0x48d618);DashboardEvents['on'](_0x45aa19,_0x25ffb3);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 7706d3d..97c487c 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 _0xd702=['/:id/clone','addItem','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','show','/:id/items','getItems','post'];(function(_0x597a17,_0x386e0e){var _0x69b807=function(_0x3ca560){while(--_0x3ca560){_0x597a17['push'](_0x597a17['shift']());}};_0x69b807(++_0x386e0e);}(_0xd702,0x1b9));var _0x2d70=function(_0x2a1eef,_0x48cb14){_0x2a1eef=_0x2a1eef-0x0;var _0x2a0aef=_0xd702[_0x2a1eef];return _0x2a0aef;};'use strict';var multer=require(_0x2d70('0x0'));var util=require('util');var path=require(_0x2d70('0x1'));var timeout=require(_0x2d70('0x2'));var express=require(_0x2d70('0x3'));var router=express[_0x2d70('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2d70('0x5'));var config=require(_0x2d70('0x6'));var controller=require(_0x2d70('0x7'));router[_0x2d70('0x8')]('/',auth[_0x2d70('0x9')](),controller['index']);router[_0x2d70('0x8')](_0x2d70('0xa'),auth[_0x2d70('0x9')](),controller[_0x2d70('0xb')]);router[_0x2d70('0x8')](_0x2d70('0xc'),auth['isAuthenticated'](),controller[_0x2d70('0xd')]);router[_0x2d70('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2d70('0xe')](_0x2d70('0xf'),auth['isAuthenticated'](),controller['clone']);router[_0x2d70('0xe')](_0x2d70('0xc'),auth[_0x2d70('0x9')](),controller[_0x2d70('0x10')]);router['put'](_0x2d70('0xa'),auth[_0x2d70('0x9')](),controller['update']);router[_0x2d70('0x11')](_0x2d70('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x2d70('0x12')]=router; \ No newline at end of file +var _0x4765=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','index','/:id','isAuthenticated','get','/:id/items','getItems','post','/:id/clone','addItem','update','exports','multer','util','path'];(function(_0x954f73,_0x3fd901){var _0x4a6377=function(_0x4bac8d){while(--_0x4bac8d){_0x954f73['push'](_0x954f73['shift']());}};_0x4a6377(++_0x3fd901);}(_0x4765,0x1b5));var _0x5476=function(_0x3f5879,_0x422a29){_0x3f5879=_0x3f5879-0x0;var _0xd3cc05=_0x4765[_0x3f5879];return _0xd3cc05;};'use strict';var multer=require(_0x5476('0x0'));var util=require(_0x5476('0x1'));var path=require(_0x5476('0x2'));var timeout=require(_0x5476('0x3'));var express=require(_0x5476('0x4'));var router=express['Router']();var fs_extra=require(_0x5476('0x5'));var auth=require(_0x5476('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5476('0x7'));var controller=require(_0x5476('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5476('0x9')]);router['get'](_0x5476('0xa'),auth[_0x5476('0xb')](),controller['show']);router[_0x5476('0xc')](_0x5476('0xd'),auth[_0x5476('0xb')](),controller[_0x5476('0xe')]);router[_0x5476('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5476('0xf')](_0x5476('0x10'),auth[_0x5476('0xb')](),controller['clone']);router[_0x5476('0xf')](_0x5476('0xd'),auth[_0x5476('0xb')](),controller[_0x5476('0x11')]);router['put']('/:id',auth[_0x5476('0xb')](),controller[_0x5476('0x12')]);router['delete'](_0x5476('0xa'),auth[_0x5476('0xb')](),controller['destroy']);module[_0x5476('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index d895684..f486241 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 _0x5fab=['STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel','exports'];(function(_0x30f8da,_0x215308){var _0xe2f162=function(_0x1e8e73){while(--_0x1e8e73){_0x30f8da['push'](_0x30f8da['shift']());}};_0xe2f162(++_0x215308);}(_0x5fab,0x177));var _0xb5fa=function(_0x2ffea9,_0x4f90ae){_0x2ffea9=_0x2ffea9-0x0;var _0x715534=_0x5fab[_0x2ffea9];return _0x715534;};'use strict';var Sequelize=require(_0xb5fa('0x0'));var squel=require(_0xb5fa('0x1'));var _=require('lodash');module[_0xb5fa('0x2')]={'title':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb5fa('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb5fa('0x4')](_0xb5fa('0x5')),'get':function(){try{return JSON[_0xb5fa('0x6')](this[_0xb5fa('0x7')](_0xb5fa('0x8')));}catch(_0x10361d){return[];}},'set':function(_0x44df89){try{this['setDataValue']('attrs',JSON[_0xb5fa('0x9')](_0x44df89));}catch(_0x1aec3e){this[_0xb5fa('0xa')]('attrs',JSON[_0xb5fa('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb5fa('0x3')]},'titleFontSize':{'type':Sequelize[_0xb5fa('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0xc1c6=['long','parse','setDataValue','stringify','attrs','INTEGER','#ffffff','sequelize','squel','lodash','STRING','TEXT'];(function(_0x449619,_0x23e61b){var _0x8cac60=function(_0x4e474e){while(--_0x4e474e){_0x449619['push'](_0x449619['shift']());}};_0x8cac60(++_0x23e61b);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x417dd8,_0xa64d27){_0x417dd8=_0x417dd8-0x0;var _0x124e3a=_0xc1c6[_0x417dd8];return _0x124e3a;};'use strict';var Sequelize=require(_0x6c1c('0x0'));var squel=require(_0x6c1c('0x1'));var _=require(_0x6c1c('0x2'));module['exports']={'title':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6c1c('0x4')](_0x6c1c('0x5')),'get':function(){try{return JSON[_0x6c1c('0x6')](this['getDataValue']('attrs'));}catch(_0x32af84){return[];}},'set':function(_0x524a6b){try{this[_0x6c1c('0x7')]('attrs',JSON[_0x6c1c('0x8')](_0x524a6b));}catch(_0x2eb1ba){this[_0x6c1c('0x7')](_0x6c1c('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x6c1c('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6c1c('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x6c1c('0xa')]},'background':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![],'defaultValue':_0x6c1c('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6c1c('0x3')]},'titleFontSize':{'type':Sequelize[_0x6c1c('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 7a497b4..6634eb9 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 _0x1a61=['update','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','save','destroy','then','sendStatus','error','stack','name','send','show','params','keys','DashboardItem','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','stringify','create','body'];(function(_0x420cd4,_0x20169b){var _0x2cdc13=function(_0x989219){while(--_0x989219){_0x420cd4['push'](_0x420cd4['shift']());}};_0x2cdc13(++_0x20169b);}(_0x1a61,0x1e6));var _0x11a6=function(_0x52bc75,_0x114550){_0x52bc75=_0x52bc75-0x0;var _0x355959=_0x1a61[_0x52bc75];return _0x355959;};'use strict';var emlformat=require(_0x11a6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x11a6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x11a6('0x2'));var moment=require(_0x11a6('0x3'));var BPromise=require(_0x11a6('0x4'));var Mustache=require(_0x11a6('0x5'));var util=require('util');var path=require('path');var sox=require(_0x11a6('0x6'));var csv=require(_0x11a6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x11a6('0x8'));var _=require(_0x11a6('0x9'));var squel=require(_0x11a6('0xa'));var crypto=require(_0x11a6('0xb'));var jsforce=require(_0x11a6('0xc'));var deskjs=require(_0x11a6('0xd'));var toCsv=require(_0x11a6('0x7'));var querystring=require(_0x11a6('0xe'));var Papa=require(_0x11a6('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x11a6('0x10'));var hardwareService=require(_0x11a6('0x11'));var logger=require('../../config/logger')(_0x11a6('0x12'));var utils=require(_0x11a6('0x13'));var config=require(_0x11a6('0x14'));var licenseUtil=require(_0x11a6('0x15'));var db=require(_0x11a6('0x16'))['db'];config[_0x11a6('0x17')]=_['defaults'](config['redis'],{'host':_0x11a6('0x18'),'port':0x18eb});var socket=require(_0x11a6('0x19'))(new Redis(config['redis']));require(_0x11a6('0x1a'))[_0x11a6('0x1b')](socket);function respondWithStatusCode(_0x5158ea,_0x252df2){_0x252df2=_0x252df2||0xcc;return function(_0x1ec457){if(_0x1ec457){return _0x5158ea['sendStatus'](_0x252df2);}return _0x5158ea[_0x11a6('0x1c')](_0x252df2)[_0x11a6('0x1d')]();};}function respondWithResult(_0x1fec24,_0x444ed0){_0x444ed0=_0x444ed0||0xc8;return function(_0x4bdbf3){if(_0x4bdbf3){return _0x1fec24[_0x11a6('0x1c')](_0x444ed0)[_0x11a6('0x1e')](_0x4bdbf3);}};}function respondWithFilteredResult(_0xe8ed8,_0x289fff){return function(_0x1a9d43){if(_0x1a9d43){var _0x1e3cdd=typeof _0x289fff[_0x11a6('0x1f')]===_0x11a6('0x20')&&typeof _0x289fff[_0x11a6('0x21')]===_0x11a6('0x20');var _0x2516a4=_0x1a9d43[_0x11a6('0x22')];var _0x25a4c5=_0x1e3cdd?0x0:_0x289fff[_0x11a6('0x1f')];var _0x595d3c=_0x1e3cdd?_0x1a9d43[_0x11a6('0x22')]:_0x289fff[_0x11a6('0x1f')]+_0x289fff[_0x11a6('0x21')];var _0x3d1efd;if(_0x595d3c>=_0x2516a4){_0x595d3c=_0x2516a4;_0x3d1efd=0xc8;}else{_0x3d1efd=0xce;}_0xe8ed8['status'](_0x3d1efd);return _0xe8ed8['set'](_0x11a6('0x23'),_0x25a4c5+'-'+_0x595d3c+'/'+_0x2516a4)['json'](_0x1a9d43);}return null;};}function patchUpdates(_0x707dd2){return function(_0x4c42ec){try{jsonpatch['apply'](_0x4c42ec,_0x707dd2,!![]);}catch(_0x51fe97){return BPromise['reject'](_0x51fe97);}return _0x4c42ec[_0x11a6('0x24')]();};}function saveUpdates(_0x55a043,_0x1830f6){return function(_0x364375){if(_0x364375){return _0x364375['update'](_0x55a043)['then'](function(_0x2ffd7f){return _0x2ffd7f;});}return null;};}function removeEntity(_0x144cc5,_0x34e230){return function(_0x2715d5){if(_0x2715d5){return _0x2715d5[_0x11a6('0x25')]()[_0x11a6('0x26')](function(){_0x144cc5[_0x11a6('0x1c')](0xcc)[_0x11a6('0x1d')]();});}};}function handleEntityNotFound(_0x111e74,_0x349915){return function(_0x1ceb50){if(!_0x1ceb50){_0x111e74[_0x11a6('0x27')](0x194);}return _0x1ceb50;};}function handleError(_0x3f87a3,_0x3ca310){_0x3ca310=_0x3ca310||0x1f4;return function(_0x304ad8){logger[_0x11a6('0x28')](_0x304ad8[_0x11a6('0x29')]);if(_0x304ad8[_0x11a6('0x2a')]){delete _0x304ad8[_0x11a6('0x2a')];}_0x3f87a3[_0x11a6('0x1c')](_0x3ca310)[_0x11a6('0x2b')](_0x304ad8);};}exports[_0x11a6('0x2c')]=function(_0x2d7ab7,_0x1ec7aa){var _0x3827e3={'raw':![],'where':{'id':_0x2d7ab7[_0x11a6('0x2d')]['id']}},_0x56f74d={};_0x56f74d['model']=_[_0x11a6('0x2e')](db[_0x11a6('0x2f')][_0x11a6('0x30')]);_0x56f74d[_0x11a6('0x31')]=_[_0x11a6('0x2e')](_0x2d7ab7['query']);_0x56f74d[_0x11a6('0x32')]=_[_0x11a6('0x33')](_0x56f74d['model'],_0x56f74d['query']);_0x3827e3['attributes']=_[_0x11a6('0x33')](_0x56f74d[_0x11a6('0x34')],qs['fields'](_0x2d7ab7[_0x11a6('0x31')][_0x11a6('0x35')]));_0x3827e3[_0x11a6('0x36')]=_0x3827e3[_0x11a6('0x36')][_0x11a6('0x37')]?_0x3827e3['attributes']:_0x56f74d[_0x11a6('0x34')];if(_0x2d7ab7[_0x11a6('0x31')][_0x11a6('0x38')]){_0x3827e3[_0x11a6('0x39')]=[{'all':!![]}];}_0x3827e3=_[_0x11a6('0x3a')]({},_0x3827e3,_0x2d7ab7[_0x11a6('0x3b')]);return db[_0x11a6('0x2f')][_0x11a6('0x3c')](_0x3827e3)[_0x11a6('0x26')](handleEntityNotFound(_0x1ec7aa,null))[_0x11a6('0x26')](respondWithResult(_0x1ec7aa,null))[_0x11a6('0x3d')](handleError(_0x1ec7aa,null));};exports[_0x11a6('0x25')]=function(_0x1f3062,_0x554164){return db[_0x11a6('0x2f')][_0x11a6('0x3c')]({'where':{'id':_0x1f3062[_0x11a6('0x2d')]['id']}})[_0x11a6('0x26')](handleEntityNotFound(_0x554164,null))[_0x11a6('0x26')](removeEntity(_0x554164,null))[_0x11a6('0x3d')](handleError(_0x554164,null));};function widgetAttributes(_0x3017d4){try{switch(_0x3017d4[_0x11a6('0x3e')]){case _0x11a6('0x3f'):return[{'name':'attrUrl','value':_0x3017d4[_0x11a6('0x40')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4['attrs'][0x0]?_0x3017d4[_0x11a6('0x41')][0x0][_0x11a6('0x42')]:undefined)||_0x11a6('0x43')}];case'custom':return[{'name':_0x11a6('0x44'),'value':_0x3017d4[_0x11a6('0x44')]||(_0x3017d4['attrs']&&_0x3017d4['attrs'][0x0]?_0x3017d4[_0x11a6('0x41')][0x0]['value']:undefined)||''}];case _0x11a6('0x45'):return[{'name':_0x11a6('0x46'),'value':_0x3017d4['attrHourFormat']||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4['attrs'][0x0]?_0x3017d4[_0x11a6('0x41')][0x0][_0x11a6('0x42')]:undefined)||'HH:mm:ss'},{'name':_0x11a6('0x47'),'value':_0x3017d4[_0x11a6('0x47')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x1]?_0x3017d4[_0x11a6('0x41')][0x1][_0x11a6('0x42')]:undefined)||_0x11a6('0x48')},{'name':'attrFontSize','value':_0x3017d4[_0x11a6('0x49')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4['attrs'][0x2]?_0x3017d4[_0x11a6('0x41')][0x2][_0x11a6('0x42')]:undefined)||0xc}];case'counter':return[{'name':_0x11a6('0x4a'),'value':_0x3017d4[_0x11a6('0x4a')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4['attrs'][0x0]?_0x3017d4['attrs'][0x0]['value']:undefined)||'total'},{'name':_0x11a6('0x4b'),'value':_0x3017d4['attrVoiceQueues']||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x1]?_0x3017d4['attrs'][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x3017d4[_0x11a6('0x49')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4['attrs'][0x2]?_0x3017d4[_0x11a6('0x41')][0x2]['value']:undefined)||0x14},{'name':_0x11a6('0x4c'),'value':_0x3017d4['attrChannel']||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x3]?_0x3017d4['attrs'][0x3][_0x11a6('0x42')]:undefined)||'voice'},{'name':_0x11a6('0x4d'),'value':_0x3017d4[_0x11a6('0x4d')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x4]?_0x3017d4['attrs'][0x4][_0x11a6('0x42')]:undefined)||''},{'name':_0x11a6('0x4e'),'value':_0x3017d4[_0x11a6('0x4e')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x5]?_0x3017d4[_0x11a6('0x41')][0x5]['value']:undefined)||''},{'name':_0x11a6('0x4f'),'value':_0x3017d4[_0x11a6('0x4f')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4['attrs'][0x6]?_0x3017d4[_0x11a6('0x41')][0x6][_0x11a6('0x42')]:undefined)||''},{'name':_0x11a6('0x50'),'value':_0x3017d4[_0x11a6('0x50')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x7]?_0x3017d4[_0x11a6('0x41')][0x7][_0x11a6('0x42')]:undefined)||''},{'name':_0x11a6('0x51'),'value':_0x3017d4[_0x11a6('0x51')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x8]?_0x3017d4[_0x11a6('0x41')][0x8][_0x11a6('0x42')]:undefined)||''},{'name':_0x11a6('0x52'),'value':_0x3017d4[_0x11a6('0x52')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x9]?_0x3017d4['attrs'][0x9][_0x11a6('0x42')]:undefined)||''}];case'multibar-chart':case _0x11a6('0x53'):return[{'name':'attrSerie1','value':_0x3017d4[_0x11a6('0x54')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x0]?_0x3017d4[_0x11a6('0x41')][0x0]['value']:undefined)||_0x11a6('0x55')},{'name':_0x11a6('0x56'),'value':_0x3017d4['attrSerie2']||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x1]?_0x3017d4[_0x11a6('0x41')][0x1][_0x11a6('0x42')]:undefined)||null},{'name':_0x11a6('0x57'),'value':_0x3017d4['attrSerie3']||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x2]?_0x3017d4[_0x11a6('0x41')][0x2][_0x11a6('0x42')]:undefined)||null},{'name':_0x11a6('0x4b'),'value':_0x3017d4['attrVoiceQueues']||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x3]?_0x3017d4[_0x11a6('0x41')][0x3][_0x11a6('0x42')]:undefined)||[]},{'name':_0x11a6('0x4c'),'value':_0x3017d4[_0x11a6('0x4c')]||(_0x3017d4['attrs']&&_0x3017d4[_0x11a6('0x41')][0x4]?_0x3017d4[_0x11a6('0x41')][0x4][_0x11a6('0x42')]:undefined)||_0x11a6('0x58')},{'name':_0x11a6('0x4d'),'value':_0x3017d4[_0x11a6('0x4d')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x5]?_0x3017d4['attrs'][0x5][_0x11a6('0x42')]:undefined)||''},{'name':_0x11a6('0x4e'),'value':_0x3017d4[_0x11a6('0x4e')]||(_0x3017d4['attrs']&&_0x3017d4[_0x11a6('0x41')][0x6]?_0x3017d4[_0x11a6('0x41')][0x6][_0x11a6('0x42')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3017d4[_0x11a6('0x4f')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x7]?_0x3017d4[_0x11a6('0x41')][0x7][_0x11a6('0x42')]:undefined)||''},{'name':_0x11a6('0x50'),'value':_0x3017d4['attrOpenchannelAccounts']||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x8]?_0x3017d4[_0x11a6('0x41')][0x8]['value']:undefined)||''},{'name':_0x11a6('0x51'),'value':_0x3017d4[_0x11a6('0x51')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x9]?_0x3017d4[_0x11a6('0x41')][0x9]['value']:undefined)||''},{'name':_0x11a6('0x52'),'value':_0x3017d4[_0x11a6('0x52')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0xa]?_0x3017d4[_0x11a6('0x41')][0xa][_0x11a6('0x42')]:undefined)||''}];case _0x11a6('0x59'):return[{'name':_0x11a6('0x5a'),'type':_0x3017d4[_0x11a6('0x5b')]||(_0x3017d4['attrs']&&_0x3017d4[_0x11a6('0x41')][0x0]?_0x3017d4[_0x11a6('0x41')][0x0][_0x11a6('0x3e')]:undefined)||null,'value':_0x3017d4[_0x11a6('0x5a')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x0]?_0x3017d4[_0x11a6('0x41')][0x0][_0x11a6('0x42')]:undefined)||null},{'name':_0x11a6('0x5c'),'value':_0x3017d4[_0x11a6('0x5c')]||(_0x3017d4[_0x11a6('0x41')]&&_0x3017d4[_0x11a6('0x41')][0x1]?_0x3017d4['attrs'][0x1][_0x11a6('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x3d1bfc){logger[_0x11a6('0x28')]('widgetAttributes:\x20%s',JSON[_0x11a6('0x5d')](_0x3d1bfc));return[];}}exports[_0x11a6('0x5e')]=function(_0x569ea6,_0x479468){if(_0x569ea6['body']){_0x569ea6[_0x11a6('0x5f')][_0x11a6('0x41')]=widgetAttributes(_0x569ea6[_0x11a6('0x5f')]);}return db[_0x11a6('0x2f')][_0x11a6('0x5e')](_0x569ea6[_0x11a6('0x5f')],{})[_0x11a6('0x26')](respondWithResult(_0x479468,0xc9))[_0x11a6('0x3d')](handleError(_0x479468,null));};exports[_0x11a6('0x60')]=function(_0x28119b,_0x50c1f5){if(_0x28119b[_0x11a6('0x5f')]['id']){delete _0x28119b[_0x11a6('0x5f')]['id'];}_0x28119b[_0x11a6('0x5f')]['attrs']=widgetAttributes(_0x28119b[_0x11a6('0x5f')]);return db[_0x11a6('0x2f')][_0x11a6('0x3c')]({'where':{'id':_0x28119b[_0x11a6('0x2d')]['id']}})[_0x11a6('0x26')](handleEntityNotFound(_0x50c1f5,null))[_0x11a6('0x26')](saveUpdates(_0x28119b[_0x11a6('0x5f')],null))[_0x11a6('0x26')](respondWithResult(_0x50c1f5,null))[_0x11a6('0x3d')](handleError(_0x50c1f5,null));}; \ No newline at end of file +var _0x5024=['sendStatus','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','length','include','find','catch','type','iframe','attrUrl','attrs','https://','attrPath','clock','attrHourFormat','value','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','voice','attrWhatsappAccounts','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','./dashboardItem.socket','register','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','then','destroy'];(function(_0x388b47,_0x5cdac5){var _0x4859df=function(_0x466a16){while(--_0x466a16){_0x388b47['push'](_0x388b47['shift']());}};_0x4859df(++_0x5cdac5);}(_0x5024,0xf7));var _0x4502=function(_0x513ce1,_0x3d89f0){_0x513ce1=_0x513ce1-0x0;var _0x32f276=_0x5024[_0x513ce1];return _0x32f276;};'use strict';var emlformat=require(_0x4502('0x0'));var rimraf=require(_0x4502('0x1'));var zipdir=require(_0x4502('0x2'));var jsonpatch=require(_0x4502('0x3'));var rp=require('request-promise');var moment=require(_0x4502('0x4'));var BPromise=require(_0x4502('0x5'));var Mustache=require(_0x4502('0x6'));var util=require(_0x4502('0x7'));var path=require(_0x4502('0x8'));var sox=require(_0x4502('0x9'));var csv=require(_0x4502('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4502('0xb'));var squel=require('squel');var crypto=require(_0x4502('0xc'));var jsforce=require(_0x4502('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4502('0xe'));var Papa=require(_0x4502('0xf'));var Redis=require('ioredis');var authService=require(_0x4502('0x10'));var qs=require(_0x4502('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4502('0x12'));var logger=require(_0x4502('0x13'))(_0x4502('0x14'));var utils=require(_0x4502('0x15'));var config=require(_0x4502('0x16'));var licenseUtil=require(_0x4502('0x17'));var db=require('../../mysqldb')['db'];config[_0x4502('0x18')]=_['defaults'](config[_0x4502('0x18')],{'host':_0x4502('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4502('0x18')]));require(_0x4502('0x1a'))[_0x4502('0x1b')](socket);function respondWithStatusCode(_0x40f629,_0xac878d){_0xac878d=_0xac878d||0xcc;return function(_0x1c977d){if(_0x1c977d){return _0x40f629['sendStatus'](_0xac878d);}return _0x40f629[_0x4502('0x1c')](_0xac878d)[_0x4502('0x1d')]();};}function respondWithResult(_0x555abe,_0x5220fd){_0x5220fd=_0x5220fd||0xc8;return function(_0x2d102a){if(_0x2d102a){return _0x555abe[_0x4502('0x1c')](_0x5220fd)[_0x4502('0x1e')](_0x2d102a);}};}function respondWithFilteredResult(_0x567cc5,_0x11daa1){return function(_0x3b0fcb){if(_0x3b0fcb){var _0x13bee2=typeof _0x11daa1['offset']==='undefined'&&typeof _0x11daa1[_0x4502('0x1f')]===_0x4502('0x20');var _0x3153c7=_0x3b0fcb[_0x4502('0x21')];var _0x8ecd0b=_0x13bee2?0x0:_0x11daa1['offset'];var _0x5616c6=_0x13bee2?_0x3b0fcb[_0x4502('0x21')]:_0x11daa1[_0x4502('0x22')]+_0x11daa1['limit'];var _0x5ec200;if(_0x5616c6>=_0x3153c7){_0x5616c6=_0x3153c7;_0x5ec200=0xc8;}else{_0x5ec200=0xce;}_0x567cc5[_0x4502('0x1c')](_0x5ec200);return _0x567cc5['set'](_0x4502('0x23'),_0x8ecd0b+'-'+_0x5616c6+'/'+_0x3153c7)[_0x4502('0x1e')](_0x3b0fcb);}return null;};}function patchUpdates(_0x1592ed){return function(_0x154b68){try{jsonpatch[_0x4502('0x24')](_0x154b68,_0x1592ed,!![]);}catch(_0x3f6df8){return BPromise[_0x4502('0x25')](_0x3f6df8);}return _0x154b68[_0x4502('0x26')]();};}function saveUpdates(_0x167e17,_0x2e23b7){return function(_0xeb372){if(_0xeb372){return _0xeb372['update'](_0x167e17)[_0x4502('0x27')](function(_0x3bc984){return _0x3bc984;});}return null;};}function removeEntity(_0x1009dd,_0x46a560){return function(_0xbc6e06){if(_0xbc6e06){return _0xbc6e06[_0x4502('0x28')]()[_0x4502('0x27')](function(){_0x1009dd[_0x4502('0x1c')](0xcc)[_0x4502('0x1d')]();});}};}function handleEntityNotFound(_0xeb30d3,_0x26320e){return function(_0x3ba780){if(!_0x3ba780){_0xeb30d3[_0x4502('0x29')](0x194);}return _0x3ba780;};}function handleError(_0x35606c,_0x516140){_0x516140=_0x516140||0x1f4;return function(_0x4bcb5f){logger[_0x4502('0x2a')](_0x4bcb5f[_0x4502('0x2b')]);if(_0x4bcb5f[_0x4502('0x2c')]){delete _0x4bcb5f['name'];}_0x35606c[_0x4502('0x1c')](_0x516140)[_0x4502('0x2d')](_0x4bcb5f);};}exports[_0x4502('0x2e')]=function(_0x573d1a,_0x44265d){var _0x4207ce={'raw':![],'where':{'id':_0x573d1a[_0x4502('0x2f')]['id']}},_0x3f212b={};_0x3f212b[_0x4502('0x30')]=_[_0x4502('0x31')](db[_0x4502('0x32')][_0x4502('0x33')]);_0x3f212b[_0x4502('0x34')]=_[_0x4502('0x31')](_0x573d1a[_0x4502('0x34')]);_0x3f212b[_0x4502('0x35')]=_[_0x4502('0x36')](_0x3f212b[_0x4502('0x30')],_0x3f212b['query']);_0x4207ce['attributes']=_['intersection'](_0x3f212b['model'],qs[_0x4502('0x37')](_0x573d1a[_0x4502('0x34')][_0x4502('0x37')]));_0x4207ce[_0x4502('0x38')]=_0x4207ce[_0x4502('0x38')][_0x4502('0x39')]?_0x4207ce[_0x4502('0x38')]:_0x3f212b[_0x4502('0x30')];if(_0x573d1a[_0x4502('0x34')]['includeAll']){_0x4207ce[_0x4502('0x3a')]=[{'all':!![]}];}_0x4207ce=_['merge']({},_0x4207ce,_0x573d1a['options']);return db[_0x4502('0x32')][_0x4502('0x3b')](_0x4207ce)[_0x4502('0x27')](handleEntityNotFound(_0x44265d,null))['then'](respondWithResult(_0x44265d,null))['catch'](handleError(_0x44265d,null));};exports['destroy']=function(_0x9d4bed,_0x3bbe44){return db['DashboardItem'][_0x4502('0x3b')]({'where':{'id':_0x9d4bed[_0x4502('0x2f')]['id']}})['then'](handleEntityNotFound(_0x3bbe44,null))[_0x4502('0x27')](removeEntity(_0x3bbe44,null))[_0x4502('0x3c')](handleError(_0x3bbe44,null));};function widgetAttributes(_0x416f4b){try{switch(_0x416f4b[_0x4502('0x3d')]){case _0x4502('0x3e'):return[{'name':_0x4502('0x3f'),'value':_0x416f4b['attrUrl']||(_0x416f4b['attrs']&&_0x416f4b[_0x4502('0x40')][0x0]?_0x416f4b[_0x4502('0x40')][0x0]['value']:undefined)||_0x4502('0x41')}];case'custom':return[{'name':_0x4502('0x42'),'value':_0x416f4b[_0x4502('0x42')]||(_0x416f4b['attrs']&&_0x416f4b[_0x4502('0x40')][0x0]?_0x416f4b[_0x4502('0x40')][0x0]['value']:undefined)||''}];case _0x4502('0x43'):return[{'name':_0x4502('0x44'),'value':_0x416f4b['attrHourFormat']||(_0x416f4b['attrs']&&_0x416f4b[_0x4502('0x40')][0x0]?_0x416f4b[_0x4502('0x40')][0x0][_0x4502('0x45')]:undefined)||'HH:mm:ss'},{'name':_0x4502('0x46'),'value':_0x416f4b['attrTimezone']||(_0x416f4b[_0x4502('0x40')]&&_0x416f4b['attrs'][0x1]?_0x416f4b[_0x4502('0x40')][0x1][_0x4502('0x45')]:undefined)||_0x4502('0x47')},{'name':_0x4502('0x48'),'value':_0x416f4b[_0x4502('0x48')]||(_0x416f4b['attrs']&&_0x416f4b[_0x4502('0x40')][0x2]?_0x416f4b[_0x4502('0x40')][0x2][_0x4502('0x45')]:undefined)||0xc}];case _0x4502('0x49'):return[{'name':'attrMetric','value':_0x416f4b[_0x4502('0x4a')]||(_0x416f4b['attrs']&&_0x416f4b[_0x4502('0x40')][0x0]?_0x416f4b[_0x4502('0x40')][0x0]['value']:undefined)||_0x4502('0x4b')},{'name':_0x4502('0x4c'),'value':_0x416f4b[_0x4502('0x4c')]||(_0x416f4b[_0x4502('0x40')]&&_0x416f4b['attrs'][0x1]?_0x416f4b[_0x4502('0x40')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x416f4b[_0x4502('0x48')]||(_0x416f4b['attrs']&&_0x416f4b[_0x4502('0x40')][0x2]?_0x416f4b[_0x4502('0x40')][0x2][_0x4502('0x45')]:undefined)||0x14},{'name':_0x4502('0x4d'),'value':_0x416f4b['attrChannel']||(_0x416f4b[_0x4502('0x40')]&&_0x416f4b[_0x4502('0x40')][0x3]?_0x416f4b['attrs'][0x3][_0x4502('0x45')]:undefined)||'voice'},{'name':_0x4502('0x4e'),'value':_0x416f4b['attrEmailAccounts']||(_0x416f4b[_0x4502('0x40')]&&_0x416f4b[_0x4502('0x40')][0x4]?_0x416f4b['attrs'][0x4][_0x4502('0x45')]:undefined)||''},{'name':_0x4502('0x4f'),'value':_0x416f4b[_0x4502('0x4f')]||(_0x416f4b['attrs']&&_0x416f4b['attrs'][0x5]?_0x416f4b['attrs'][0x5][_0x4502('0x45')]:undefined)||''},{'name':_0x4502('0x50'),'value':_0x416f4b['attrSmsAccounts']||(_0x416f4b['attrs']&&_0x416f4b[_0x4502('0x40')][0x6]?_0x416f4b['attrs'][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x416f4b[_0x4502('0x51')]||(_0x416f4b[_0x4502('0x40')]&&_0x416f4b[_0x4502('0x40')][0x7]?_0x416f4b['attrs'][0x7][_0x4502('0x45')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x416f4b['attrWhatsappAccounts']||(_0x416f4b['attrs']&&_0x416f4b[_0x4502('0x40')][0x8]?_0x416f4b[_0x4502('0x40')][0x8][_0x4502('0x45')]:undefined)||''},{'name':_0x4502('0x52'),'value':_0x416f4b[_0x4502('0x52')]||(_0x416f4b[_0x4502('0x40')]&&_0x416f4b[_0x4502('0x40')][0x9]?_0x416f4b['attrs'][0x9][_0x4502('0x45')]:undefined)||''}];case'multibar-chart':case _0x4502('0x53'):return[{'name':_0x4502('0x54'),'value':_0x416f4b[_0x4502('0x54')]||(_0x416f4b[_0x4502('0x40')]&&_0x416f4b[_0x4502('0x40')][0x0]?_0x416f4b[_0x4502('0x40')][0x0][_0x4502('0x45')]:undefined)||_0x4502('0x4b')},{'name':'attrSerie2','value':_0x416f4b[_0x4502('0x55')]||(_0x416f4b[_0x4502('0x40')]&&_0x416f4b[_0x4502('0x40')][0x1]?_0x416f4b[_0x4502('0x40')][0x1]['value']:undefined)||null},{'name':_0x4502('0x56'),'value':_0x416f4b[_0x4502('0x56')]||(_0x416f4b[_0x4502('0x40')]&&_0x416f4b[_0x4502('0x40')][0x2]?_0x416f4b[_0x4502('0x40')][0x2][_0x4502('0x45')]:undefined)||null},{'name':_0x4502('0x4c'),'value':_0x416f4b[_0x4502('0x4c')]||(_0x416f4b[_0x4502('0x40')]&&_0x416f4b[_0x4502('0x40')][0x3]?_0x416f4b[_0x4502('0x40')][0x3][_0x4502('0x45')]:undefined)||[]},{'name':'attrChannel','value':_0x416f4b[_0x4502('0x4d')]||(_0x416f4b['attrs']&&_0x416f4b[_0x4502('0x40')][0x4]?_0x416f4b[_0x4502('0x40')][0x4]['value']:undefined)||_0x4502('0x57')},{'name':_0x4502('0x4e'),'value':_0x416f4b['attrEmailAccounts']||(_0x416f4b['attrs']&&_0x416f4b[_0x4502('0x40')][0x5]?_0x416f4b[_0x4502('0x40')][0x5][_0x4502('0x45')]:undefined)||''},{'name':_0x4502('0x4f'),'value':_0x416f4b[_0x4502('0x4f')]||(_0x416f4b[_0x4502('0x40')]&&_0x416f4b['attrs'][0x6]?_0x416f4b[_0x4502('0x40')][0x6][_0x4502('0x45')]:undefined)||''},{'name':_0x4502('0x50'),'value':_0x416f4b[_0x4502('0x50')]||(_0x416f4b[_0x4502('0x40')]&&_0x416f4b[_0x4502('0x40')][0x7]?_0x416f4b[_0x4502('0x40')][0x7][_0x4502('0x45')]:undefined)||''},{'name':_0x4502('0x51'),'value':_0x416f4b['attrOpenchannelAccounts']||(_0x416f4b[_0x4502('0x40')]&&_0x416f4b[_0x4502('0x40')][0x8]?_0x416f4b[_0x4502('0x40')][0x8][_0x4502('0x45')]:undefined)||''},{'name':_0x4502('0x58'),'value':_0x416f4b['attrWhatsappAccounts']||(_0x416f4b[_0x4502('0x40')]&&_0x416f4b[_0x4502('0x40')][0x9]?_0x416f4b[_0x4502('0x40')][0x9][_0x4502('0x45')]:undefined)||''},{'name':_0x4502('0x52'),'value':_0x416f4b[_0x4502('0x52')]||(_0x416f4b[_0x4502('0x40')]&&_0x416f4b[_0x4502('0x40')][0xa]?_0x416f4b[_0x4502('0x40')][0xa][_0x4502('0x45')]:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x416f4b[_0x4502('0x59')]||(_0x416f4b['attrs']&&_0x416f4b[_0x4502('0x40')][0x0]?_0x416f4b[_0x4502('0x40')][0x0][_0x4502('0x3d')]:undefined)||null,'value':_0x416f4b[_0x4502('0x5a')]||(_0x416f4b[_0x4502('0x40')]&&_0x416f4b[_0x4502('0x40')][0x0]?_0x416f4b[_0x4502('0x40')][0x0][_0x4502('0x45')]:undefined)||null},{'name':_0x4502('0x5b'),'value':_0x416f4b['attrRefresh']||(_0x416f4b['attrs']&&_0x416f4b['attrs'][0x1]?_0x416f4b[_0x4502('0x40')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x10eeb4){logger[_0x4502('0x2a')](_0x4502('0x5c'),JSON[_0x4502('0x5d')](_0x10eeb4));return[];}}exports[_0x4502('0x5e')]=function(_0x27a134,_0x5cef39){if(_0x27a134[_0x4502('0x5f')]){_0x27a134[_0x4502('0x5f')][_0x4502('0x40')]=widgetAttributes(_0x27a134[_0x4502('0x5f')]);}return db[_0x4502('0x32')][_0x4502('0x5e')](_0x27a134[_0x4502('0x5f')],{})[_0x4502('0x27')](respondWithResult(_0x5cef39,0xc9))[_0x4502('0x3c')](handleError(_0x5cef39,null));};exports['update']=function(_0x4948ea,_0x121648){if(_0x4948ea[_0x4502('0x5f')]['id']){delete _0x4948ea[_0x4502('0x5f')]['id'];}_0x4948ea['body'][_0x4502('0x40')]=widgetAttributes(_0x4948ea[_0x4502('0x5f')]);return db[_0x4502('0x32')][_0x4502('0x3b')]({'where':{'id':_0x4948ea[_0x4502('0x2f')]['id']}})[_0x4502('0x27')](handleEntityNotFound(_0x121648,null))[_0x4502('0x27')](saveUpdates(_0x4948ea[_0x4502('0x5f')],null))[_0x4502('0x27')](respondWithResult(_0x121648,null))['catch'](handleError(_0x121648,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index c9da5fa..e825481 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 _0x73bf=['update','remove','emit','hasOwnProperty','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x73bf,0x107));var _0xf73b=function(_0x42d383,_0x436594){_0x42d383=_0x42d383-0x0;var _0x122dbb=_0x73bf[_0x42d383];return _0x122dbb;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xf73b('0x0'))['db'][_0xf73b('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xf73b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf73b('0x3'),'afterDestroy':_0xf73b('0x4')};function emitEvent(_0x4294c2){return function(_0x46501f,_0x341d58,_0x556980){DashboardItemEvents['emit'](_0x4294c2+':'+_0x46501f['id'],_0x46501f);DashboardItemEvents[_0xf73b('0x5')](_0x4294c2,_0x46501f);_0x556980(null);};}for(var e in events){if(events[_0xf73b('0x6')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x0d3b=['events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x550d39,_0x5545ca){var _0x3b0623=function(_0x58f52b){while(--_0x58f52b){_0x550d39['push'](_0x550d39['shift']());}};_0x3b0623(++_0x5545ca);}(_0x0d3b,0xf0));var _0xb0d3=function(_0x150c00,_0x18a5f0){_0x150c00=_0x150c00-0x0;var _0x473e32=_0x0d3b[_0x150c00];return _0x473e32;};'use strict';var EventEmitter=require(_0xb0d3('0x0'));var DashboardItem=require(_0xb0d3('0x1'))['db'][_0xb0d3('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xb0d3('0x3')](0x0);var events={'afterCreate':_0xb0d3('0x4'),'afterUpdate':_0xb0d3('0x5'),'afterDestroy':_0xb0d3('0x6')};function emitEvent(_0xca29d){return function(_0x13ae29,_0x2ddf21,_0x1ce6ee){DashboardItemEvents[_0xb0d3('0x7')](_0xca29d+':'+_0x13ae29['id'],_0x13ae29);DashboardItemEvents[_0xb0d3('0x7')](_0xca29d,_0x13ae29);_0x1ce6ee(null);};}for(var e in events){if(events[_0xb0d3('0x8')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xb0d3('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 34f4d85..340e7ba 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 _0x41ff=['dashboard_items','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports'];(function(_0x1ab29b,_0x5c4b9d){var _0x1990a9=function(_0x9bf541){while(--_0x9bf541){_0x1ab29b['push'](_0x1ab29b['shift']());}};_0x1990a9(++_0x5c4b9d);}(_0x41ff,0x1e1));var _0xf41f=function(_0x1941f0,_0x517d39){_0x1941f0=_0x1941f0-0x0;var _0x4bdd98=_0x41ff[_0x1941f0];return _0x4bdd98;};'use strict';var _=require(_0xf41f('0x0'));var util=require(_0xf41f('0x1'));var logger=require(_0xf41f('0x2'))(_0xf41f('0x3'));var moment=require(_0xf41f('0x4'));var BPromise=require('bluebird');var rp=require(_0xf41f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf41f('0x6'));var config=require(_0xf41f('0x7'));var attributes=require('./dashboardItem.attributes');module[_0xf41f('0x8')]=function(_0x37b23e,_0x98fa88){return _0x37b23e['define']('DashboardItem',attributes,{'tableName':_0xf41f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2a1c=['dashboard_items','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./dashboardItem.attributes'];(function(_0x4e9a52,_0x25b20d){var _0x2d425f=function(_0x4f2157){while(--_0x4f2157){_0x4e9a52['push'](_0x4e9a52['shift']());}};_0x2d425f(++_0x25b20d);}(_0x2a1c,0x12a));var _0xc2a1=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x2a1c[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xc2a1('0x0'));var util=require('util');var logger=require(_0xc2a1('0x1'))(_0xc2a1('0x2'));var moment=require('moment');var BPromise=require(_0xc2a1('0x3'));var rp=require(_0xc2a1('0x4'));var fs=require('fs');var path=require(_0xc2a1('0x5'));var rimraf=require(_0xc2a1('0x6'));var config=require('../../config/environment');var attributes=require(_0xc2a1('0x7'));module['exports']=function(_0x1e0259,_0x3a5e2b){return _0x1e0259['define']('DashboardItem',attributes,{'tableName':_0xc2a1('0x8'),'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 1e94a55..e19a722 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 _0x85f7=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x2645bd,_0x1527ba){var _0x1858c3=function(_0x4329fc){while(--_0x4329fc){_0x2645bd['push'](_0x2645bd['shift']());}};_0x1858c3(++_0x1527ba);}(_0x85f7,0xca));var _0x785f=function(_0x2c05ef,_0x202786){_0x2c05ef=_0x2c05ef-0x0;var _0x4a8e39=_0x85f7[_0x2c05ef];return _0x4a8e39;};'use strict';var _=require(_0x785f('0x0'));var util=require(_0x785f('0x1'));var moment=require(_0x785f('0x2'));var BPromise=require('bluebird');var rs=require(_0x785f('0x3'));var fs=require('fs');var Redis=require(_0x785f('0x4'));var db=require(_0x785f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x785f('0x6'))(_0x785f('0x7'));var config=require(_0x785f('0x8'));var jayson=require(_0x785f('0x9'));var client=jayson[_0x785f('0xa')][_0x785f('0xb')]({'port':0x232a});config[_0x785f('0xc')]=_[_0x785f('0xd')](config[_0x785f('0xc')],{'host':_0x785f('0xe'),'port':0x18eb});var socket=require(_0x785f('0xf'))(new Redis(config['redis']));require(_0x785f('0x10'))[_0x785f('0x11')](socket);function respondWithRpcPromise(_0xef55d8,_0x5586ac,_0x34037a){return new BPromise(function(_0x2465a3,_0x5aeb56){return client[_0x785f('0x12')](_0xef55d8,_0x34037a)[_0x785f('0x13')](function(_0x993346){logger[_0x785f('0x14')](_0x785f('0x15'),_0x5586ac,'request\x20sent');logger[_0x785f('0x16')](_0x785f('0x17'),_0x5586ac,'request\x20sent',JSON[_0x785f('0x18')](_0x993346));if(_0x993346[_0x785f('0x19')]){if(_0x993346[_0x785f('0x19')]['code']===0x1f4){logger[_0x785f('0x19')]('DashboardItem,\x20%s,\x20%s',_0x5586ac,_0x993346['error'][_0x785f('0x1a')]);return _0x5aeb56(_0x993346['error']['message']);}logger[_0x785f('0x19')](_0x785f('0x15'),_0x5586ac,_0x993346[_0x785f('0x19')][_0x785f('0x1a')]);return _0x2465a3(_0x993346[_0x785f('0x19')][_0x785f('0x1a')]);}else{logger[_0x785f('0x14')](_0x785f('0x15'),_0x5586ac,_0x785f('0x1b'));_0x2465a3(_0x993346[_0x785f('0x1c')][_0x785f('0x1a')]);}})[_0x785f('0x1d')](function(_0x1a4bc2){logger['error'](_0x785f('0x15'),_0x5586ac,_0x1a4bc2);_0x5aeb56(_0x1a4bc2);});});} \ No newline at end of file +var _0xf1e6=['info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then'];(function(_0x9d02b1,_0x1cfdc1){var _0x40bb1a=function(_0x452ba2){while(--_0x452ba2){_0x9d02b1['push'](_0x9d02b1['shift']());}};_0x40bb1a(++_0x1cfdc1);}(_0xf1e6,0x19f));var _0x6f1e=function(_0x24696b,_0x12de19){_0x24696b=_0x24696b-0x0;var _0x3f86b0=_0xf1e6[_0x24696b];return _0x3f86b0;};'use strict';var _=require(_0x6f1e('0x0'));var util=require('util');var moment=require(_0x6f1e('0x1'));var BPromise=require('bluebird');var rs=require(_0x6f1e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f1e('0x3'))['db'];var utils=require(_0x6f1e('0x4'));var logger=require(_0x6f1e('0x5'))('rpc');var config=require(_0x6f1e('0x6'));var jayson=require(_0x6f1e('0x7'));var client=jayson[_0x6f1e('0x8')]['http']({'port':0x232a});config[_0x6f1e('0x9')]=_[_0x6f1e('0xa')](config[_0x6f1e('0x9')],{'host':_0x6f1e('0xb'),'port':0x18eb});var socket=require(_0x6f1e('0xc'))(new Redis(config[_0x6f1e('0x9')]));require(_0x6f1e('0xd'))[_0x6f1e('0xe')](socket);function respondWithRpcPromise(_0x21ac9b,_0x362d1e,_0x490046){return new BPromise(function(_0x57d536,_0x1c1c2e){return client[_0x6f1e('0xf')](_0x21ac9b,_0x490046)[_0x6f1e('0x10')](function(_0x2c59b8){logger[_0x6f1e('0x11')](_0x6f1e('0x12'),_0x362d1e,'request\x20sent');logger[_0x6f1e('0x13')](_0x6f1e('0x14'),_0x362d1e,_0x6f1e('0x15'),JSON[_0x6f1e('0x16')](_0x2c59b8));if(_0x2c59b8['error']){if(_0x2c59b8['error'][_0x6f1e('0x17')]===0x1f4){logger[_0x6f1e('0x18')]('DashboardItem,\x20%s,\x20%s',_0x362d1e,_0x2c59b8['error']['message']);return _0x1c1c2e(_0x2c59b8['error'][_0x6f1e('0x19')]);}logger['error'](_0x6f1e('0x12'),_0x362d1e,_0x2c59b8['error'][_0x6f1e('0x19')]);return _0x57d536(_0x2c59b8[_0x6f1e('0x18')][_0x6f1e('0x19')]);}else{logger[_0x6f1e('0x11')](_0x6f1e('0x12'),_0x362d1e,_0x6f1e('0x15'));_0x57d536(_0x2c59b8['result']['message']);}})[_0x6f1e('0x1a')](function(_0x308454){logger[_0x6f1e('0x18')](_0x6f1e('0x12'),_0x362d1e,_0x308454);_0x1c1c2e(_0x308454);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 6a2d427..38d6e53 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 _0x06c7=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','remove','update'];(function(_0x587b1f,_0x50dd6e){var _0x21ba68=function(_0x5504da){while(--_0x5504da){_0x587b1f['push'](_0x587b1f['shift']());}};_0x21ba68(++_0x50dd6e);}(_0x06c7,0x185));var _0x706c=function(_0x52f01e,_0x35248d){_0x52f01e=_0x52f01e-0x0;var _0x46d8c0=_0x06c7[_0x52f01e];return _0x46d8c0;};'use strict';var DashboardItemEvents=require(_0x706c('0x0'));var events=['save',_0x706c('0x1'),_0x706c('0x2')];function createListener(_0x3fd896,_0x38c209){return function(_0x399d6b){_0x38c209[_0x706c('0x3')](_0x3fd896,_0x399d6b);};}function removeListener(_0x446972,_0x5e795e){return function(){DashboardItemEvents[_0x706c('0x4')](_0x446972,_0x5e795e);};}exports[_0x706c('0x5')]=function(_0x1d813e){for(var _0x93d273=0x0,_0x362ca5=events[_0x706c('0x6')];_0x93d273<_0x362ca5;_0x93d273++){var _0x4662e7=events[_0x93d273];var _0x1b3ace=createListener(_0x706c('0x7')+_0x4662e7,_0x1d813e);DashboardItemEvents['on'](_0x4662e7,_0x1b3ace);}}; \ No newline at end of file +var _0xe400=['save','remove','update','emit','removeListener','length','./dashboardItem.events'];(function(_0x145f6e,_0x570b09){var _0x3eda54=function(_0x5e6494){while(--_0x5e6494){_0x145f6e['push'](_0x145f6e['shift']());}};_0x3eda54(++_0x570b09);}(_0xe400,0x18e));var _0x0e40=function(_0x55071b,_0x746e86){_0x55071b=_0x55071b-0x0;var _0x45b4ca=_0xe400[_0x55071b];return _0x45b4ca;};'use strict';var DashboardItemEvents=require(_0x0e40('0x0'));var events=[_0x0e40('0x1'),_0x0e40('0x2'),_0x0e40('0x3')];function createListener(_0x4e50bb,_0xac0044){return function(_0x254eb2){_0xac0044[_0x0e40('0x4')](_0x4e50bb,_0x254eb2);};}function removeListener(_0x1a4049,_0xcbf085){return function(){DashboardItemEvents[_0x0e40('0x5')](_0x1a4049,_0xcbf085);};}exports['register']=function(_0x43eb26){for(var _0x5ca5c2=0x0,_0x2d5d88=events[_0x0e40('0x6')];_0x5ca5c2<_0x2d5d88;_0x5ca5c2++){var _0x127e12=events[_0x5ca5c2];var _0x2f4103=createListener('dashboardItem:'+_0x127e12,_0x43eb26);DashboardItemEvents['on'](_0x127e12,_0x2f4103);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index fb9cd91..1202ba4 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 _0xe0c8=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated'];(function(_0x4d4c63,_0x33ac30){var _0x383b63=function(_0x2520c6){while(--_0x2520c6){_0x4d4c63['push'](_0x4d4c63['shift']());}};_0x383b63(++_0x33ac30);}(_0xe0c8,0x65));var _0x8e0c=function(_0x2c2a8e,_0x1dfe39){_0x2c2a8e=_0x2c2a8e-0x0;var _0x3b9e38=_0xe0c8[_0x2c2a8e];return _0x3b9e38;};'use strict';var multer=require(_0x8e0c('0x0'));var util=require(_0x8e0c('0x1'));var path=require(_0x8e0c('0x2'));var timeout=require(_0x8e0c('0x3'));var express=require(_0x8e0c('0x4'));var router=express['Router']();var fs_extra=require(_0x8e0c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8e0c('0x6'));var config=require('../../config/environment');var controller=require(_0x8e0c('0x7'));router[_0x8e0c('0x8')](_0x8e0c('0x9'),auth[_0x8e0c('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x8e0c('0xb')]);router[_0x8e0c('0xc')](_0x8e0c('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x8e0c('0xd')](_0x8e0c('0x9'),auth['isAuthenticated'](),controller[_0x8e0c('0xe')]);module[_0x8e0c('0xf')]=router; \ No newline at end of file +var _0xfb8c=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','/:id','show','post','isAuthenticated','create'];(function(_0x1055d3,_0x5dce87){var _0x55b24a=function(_0x559f0a){while(--_0x559f0a){_0x1055d3['push'](_0x1055d3['shift']());}};_0x55b24a(++_0x5dce87);}(_0xfb8c,0x89));var _0xcfb8=function(_0x4e2745,_0x3eff2c){_0x4e2745=_0x4e2745-0x0;var _0x1e2e0a=_0xfb8c[_0x4e2745];return _0x1e2e0a;};'use strict';var multer=require(_0xcfb8('0x0'));var util=require(_0xcfb8('0x1'));var path=require(_0xcfb8('0x2'));var timeout=require(_0xcfb8('0x3'));var express=require('express');var router=express[_0xcfb8('0x4')]();var fs_extra=require(_0xcfb8('0x5'));var auth=require(_0xcfb8('0x6'));var interaction=require(_0xcfb8('0x7'));var config=require(_0xcfb8('0x8'));var controller=require(_0xcfb8('0x9'));router['get'](_0xcfb8('0xa'),auth['isAuthenticated'](),controller[_0xcfb8('0xb')]);router[_0xcfb8('0xc')]('/',auth[_0xcfb8('0xd')](),controller[_0xcfb8('0xe')]);router['put'](_0xcfb8('0xa'),auth[_0xcfb8('0xd')](),controller[_0xcfb8('0xf')]);router[_0xcfb8('0x10')](_0xcfb8('0xa'),auth[_0xcfb8('0xd')](),controller[_0xcfb8('0x11')]);module[_0xcfb8('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index f7548a6..3303bad 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 _0x6385=['STRING','ENUM','first','second','exports'];(function(_0x300b7c,_0x4ae511){var _0x3cb7ef=function(_0x3ce21e){while(--_0x3ce21e){_0x300b7c['push'](_0x300b7c['shift']());}};_0x3cb7ef(++_0x4ae511);}(_0x6385,0xf4));var _0x5638=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x6385[_0x4c440b];return _0x2d48cf;};'use strict';var Sequelize=require('sequelize');module[_0x5638('0x0')]={'name':{'type':Sequelize[_0x5638('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x5638('0x2')](_0x5638('0x3'),_0x5638('0x4'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x5638('0x1')]}}; \ No newline at end of file +var _0x6852=['sequelize','STRING','ENUM','first','second','third'];(function(_0x5a1da0,_0x264065){var _0x3a5743=function(_0x36d77e){while(--_0x36d77e){_0x5a1da0['push'](_0x5a1da0['shift']());}};_0x3a5743(++_0x264065);}(_0x6852,0x9c));var _0x2685=function(_0x1b40d4,_0x3d64bd){_0x1b40d4=_0x1b40d4-0x0;var _0x4f665b=_0x6852[_0x1b40d4];return _0x4f665b;};'use strict';var Sequelize=require(_0x2685('0x0'));module['exports']={'name':{'type':Sequelize[_0x2685('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x2685('0x2')](_0x2685('0x3'),_0x2685('0x4'),_0x2685('0x5')),'allowNull':![],'defaultValue':_0x2685('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 55e2825..c7ba4ac 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 _0x5fed=['fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','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','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','get','UserProfileResource','error','stack','name','index','Disposition','fieldName','type','map','query','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','include','rows','catch','keys','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Dispositions','UserProfileSection','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir'];(function(_0x332109,_0x474add){var _0x7a6ab2=function(_0x5132dd){while(--_0x5132dd){_0x332109['push'](_0x332109['shift']());}};_0x7a6ab2(++_0x474add);}(_0x5fed,0xed));var _0xd5fe=function(_0x4afdce,_0x2d1a6a){_0x4afdce=_0x4afdce-0x0;var _0x5a163f=_0x5fed[_0x4afdce];return _0x5a163f;};'use strict';var emlformat=require(_0xd5fe('0x0'));var rimraf=require(_0xd5fe('0x1'));var zipdir=require(_0xd5fe('0x2'));var jsonpatch=require(_0xd5fe('0x3'));var rp=require(_0xd5fe('0x4'));var moment=require(_0xd5fe('0x5'));var BPromise=require(_0xd5fe('0x6'));var Mustache=require('mustache');var util=require(_0xd5fe('0x7'));var path=require(_0xd5fe('0x8'));var sox=require('sox');var csv=require(_0xd5fe('0x9'));var ejs=require(_0xd5fe('0xa'));var fs=require('fs');var fs_extra=require(_0xd5fe('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd5fe('0xc'));var deskjs=require(_0xd5fe('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd5fe('0xe'));var Papa=require(_0xd5fe('0xf'));var Redis=require(_0xd5fe('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd5fe('0x11'));var as=require(_0xd5fe('0x12'));var hardwareService=require(_0xd5fe('0x13'));var logger=require(_0xd5fe('0x14'))(_0xd5fe('0x15'));var utils=require(_0xd5fe('0x16'));var config=require(_0xd5fe('0x17'));var licenseUtil=require(_0xd5fe('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x537b9a,_0x2b7738){_0x2b7738=_0x2b7738||0xcc;return function(_0x25555e){if(_0x25555e){return _0x537b9a[_0xd5fe('0x19')](_0x2b7738);}return _0x537b9a[_0xd5fe('0x1a')](_0x2b7738)[_0xd5fe('0x1b')]();};}function respondWithResult(_0x5e9898,_0xdb92be){_0xdb92be=_0xdb92be||0xc8;return function(_0x237daa){if(_0x237daa){return _0x5e9898[_0xd5fe('0x1a')](_0xdb92be)[_0xd5fe('0x1c')](_0x237daa);}};}function respondWithFilteredResult(_0x2dd1a1,_0x11823a){return function(_0x2fd7e3){if(_0x2fd7e3){var _0x1aaab8=typeof _0x11823a['offset']==='undefined'&&typeof _0x11823a['limit']===_0xd5fe('0x1d');var _0x575c27=_0x2fd7e3[_0xd5fe('0x1e')];var _0xef900=_0x1aaab8?0x0:_0x11823a['offset'];var _0x4a5144=_0x1aaab8?_0x2fd7e3[_0xd5fe('0x1e')]:_0x11823a[_0xd5fe('0x1f')]+_0x11823a[_0xd5fe('0x20')];var _0x573dc1;if(_0x4a5144>=_0x575c27){_0x4a5144=_0x575c27;_0x573dc1=0xc8;}else{_0x573dc1=0xce;}_0x2dd1a1['status'](_0x573dc1);return _0x2dd1a1[_0xd5fe('0x21')](_0xd5fe('0x22'),_0xef900+'-'+_0x4a5144+'/'+_0x575c27)['json'](_0x2fd7e3);}return null;};}function patchUpdates(_0x46ac7e){return function(_0x3be577){try{jsonpatch[_0xd5fe('0x23')](_0x3be577,_0x46ac7e,!![]);}catch(_0x633413){return BPromise[_0xd5fe('0x24')](_0x633413);}return _0x3be577[_0xd5fe('0x25')]();};}function saveUpdates(_0x176132,_0x2fdd59){return function(_0x1cc433){if(_0x1cc433){return _0x1cc433['update'](_0x176132)['then'](function(_0x132629){return _0x132629;});}return null;};}function removeEntity(_0x442be8,_0x370f6d){return function(_0x4a33ac){if(_0x4a33ac){return _0x4a33ac[_0xd5fe('0x26')]()[_0xd5fe('0x27')](function(){var _0x5aee55=_0x4a33ac[_0xd5fe('0x28')]({'plain':!![]});var _0x35b550='Dispositions';return db[_0xd5fe('0x29')][_0xd5fe('0x26')]({'where':{'type':_0x35b550,'resourceId':_0x5aee55['id']}})[_0xd5fe('0x27')](function(){return _0x4a33ac;});})[_0xd5fe('0x27')](function(){_0x442be8[_0xd5fe('0x1a')](0xcc)[_0xd5fe('0x1b')]();});}};}function handleEntityNotFound(_0x20bbde,_0x4ae4c1){return function(_0x5a5f43){if(!_0x5a5f43){_0x20bbde[_0xd5fe('0x19')](0x194);}return _0x5a5f43;};}function handleError(_0x1c08c7,_0x1ac071){_0x1ac071=_0x1ac071||0x1f4;return function(_0xb5d006){logger[_0xd5fe('0x2a')](_0xb5d006[_0xd5fe('0x2b')]);if(_0xb5d006[_0xd5fe('0x2c')]){delete _0xb5d006[_0xd5fe('0x2c')];}_0x1c08c7[_0xd5fe('0x1a')](_0x1ac071)['send'](_0xb5d006);};}exports[_0xd5fe('0x2d')]=function(_0x50c4b1,_0x34822f){var _0x3d7735={},_0x30b3b1={},_0x4b1668={'count':0x0,'rows':[]};var _0x209d05=_['map'](db[_0xd5fe('0x2e')]['rawAttributes'],function(_0x2e812f){return{'name':_0x2e812f[_0xd5fe('0x2f')],'type':_0x2e812f[_0xd5fe('0x30')]['key']};});_0x30b3b1['model']=_[_0xd5fe('0x31')](_0x209d05,_0xd5fe('0x2c'));_0x30b3b1[_0xd5fe('0x32')]=_['keys'](_0x50c4b1['query']);_0x30b3b1['filters']=_[_0xd5fe('0x33')](_0x30b3b1['model'],_0x30b3b1[_0xd5fe('0x32')]);_0x3d7735[_0xd5fe('0x34')]=_[_0xd5fe('0x33')](_0x30b3b1[_0xd5fe('0x35')],qs[_0xd5fe('0x36')](_0x50c4b1['query'][_0xd5fe('0x36')]));_0x3d7735[_0xd5fe('0x34')]=_0x3d7735[_0xd5fe('0x34')][_0xd5fe('0x37')]?_0x3d7735['attributes']:_0x30b3b1[_0xd5fe('0x35')];if(!_0x50c4b1[_0xd5fe('0x32')]['hasOwnProperty'](_0xd5fe('0x38'))){_0x3d7735[_0xd5fe('0x20')]=qs[_0xd5fe('0x20')](_0x50c4b1[_0xd5fe('0x32')]['limit']);_0x3d7735[_0xd5fe('0x1f')]=qs[_0xd5fe('0x1f')](_0x50c4b1[_0xd5fe('0x32')]['offset']);}_0x3d7735[_0xd5fe('0x39')]=qs[_0xd5fe('0x3a')](_0x50c4b1[_0xd5fe('0x32')][_0xd5fe('0x3a')]);_0x3d7735[_0xd5fe('0x3b')]=qs[_0xd5fe('0x3c')](_['pick'](_0x50c4b1[_0xd5fe('0x32')],_0x30b3b1[_0xd5fe('0x3c')]),_0x209d05);if(_0x50c4b1[_0xd5fe('0x32')][_0xd5fe('0x3d')]){_0x3d7735[_0xd5fe('0x3b')]=_[_0xd5fe('0x3e')](_0x3d7735[_0xd5fe('0x3b')],{'$or':_['map'](_0x209d05,function(_0x2c54b6){if(_0x2c54b6[_0xd5fe('0x30')]!==_0xd5fe('0x3f')){var _0x51c3b3={};_0x51c3b3[_0x2c54b6[_0xd5fe('0x2c')]]={'$like':'%'+_0x50c4b1['query'][_0xd5fe('0x3d')]+'%'};return _0x51c3b3;}})});}_0x3d7735=_[_0xd5fe('0x3e')]({},_0x3d7735,_0x50c4b1['options']);var _0x447d15={'where':_0x3d7735[_0xd5fe('0x3b')]};return db[_0xd5fe('0x2e')][_0xd5fe('0x1e')](_0x447d15)[_0xd5fe('0x27')](function(_0x52ffe1){_0x4b1668[_0xd5fe('0x1e')]=_0x52ffe1;if(_0x50c4b1[_0xd5fe('0x32')]['includeAll']){_0x3d7735[_0xd5fe('0x40')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3d7735);})[_0xd5fe('0x27')](function(_0x318934){_0x4b1668[_0xd5fe('0x41')]=_0x318934;return _0x4b1668;})[_0xd5fe('0x27')](respondWithFilteredResult(_0x34822f,_0x3d7735))[_0xd5fe('0x42')](handleError(_0x34822f,null));};exports['show']=function(_0x8d9be2,_0x5da4f3){var _0x56bbe4={'raw':!![],'where':{'id':_0x8d9be2['params']['id']}},_0x3fbb98={};_0x3fbb98[_0xd5fe('0x35')]=_[_0xd5fe('0x43')](db[_0xd5fe('0x2e')]['rawAttributes']);_0x3fbb98['query']=_[_0xd5fe('0x43')](_0x8d9be2['query']);_0x3fbb98[_0xd5fe('0x3c')]=_[_0xd5fe('0x33')](_0x3fbb98[_0xd5fe('0x35')],_0x3fbb98[_0xd5fe('0x32')]);_0x56bbe4[_0xd5fe('0x34')]=_[_0xd5fe('0x33')](_0x3fbb98[_0xd5fe('0x35')],qs[_0xd5fe('0x36')](_0x8d9be2[_0xd5fe('0x32')][_0xd5fe('0x36')]));_0x56bbe4[_0xd5fe('0x34')]=_0x56bbe4['attributes'][_0xd5fe('0x37')]?_0x56bbe4[_0xd5fe('0x34')]:_0x3fbb98['model'];if(_0x8d9be2['query'][_0xd5fe('0x44')]){_0x56bbe4[_0xd5fe('0x40')]=[{'all':!![]}];}_0x56bbe4=_[_0xd5fe('0x3e')]({},_0x56bbe4,_0x8d9be2[_0xd5fe('0x45')]);return db[_0xd5fe('0x2e')][_0xd5fe('0x46')](_0x56bbe4)['then'](handleEntityNotFound(_0x5da4f3,null))['then'](respondWithResult(_0x5da4f3,null))[_0xd5fe('0x42')](handleError(_0x5da4f3,null));};exports[_0xd5fe('0x47')]=function(_0x58efda,_0xd929b0){return db['Disposition'][_0xd5fe('0x47')](_0x58efda[_0xd5fe('0x48')],{})['then'](function(_0x2e9014){var _0x30ad7b=_0x58efda[_0xd5fe('0x49')][_0xd5fe('0x28')]({'plain':!![]});if(!_0x30ad7b)throw new Error(_0xd5fe('0x4a'));if(_0x30ad7b['role']===_0xd5fe('0x49')){var _0x3c05a3=_0x2e9014[_0xd5fe('0x28')]({'plain':!![]});var _0x26c643=_0xd5fe('0x4b');return db[_0xd5fe('0x4c')][_0xd5fe('0x46')]({'where':{'name':_0x26c643,'userProfileId':_0x30ad7b[_0xd5fe('0x4d')]},'raw':!![]})[_0xd5fe('0x27')](function(_0x334666){if(_0x334666&&_0x334666[_0xd5fe('0x4e')]===0x0){return db[_0xd5fe('0x29')][_0xd5fe('0x47')]({'name':_0x3c05a3['name'],'resourceId':_0x3c05a3['id'],'type':_0x334666[_0xd5fe('0x2c')],'sectionId':_0x334666['id']},{})[_0xd5fe('0x27')](function(){return _0x2e9014;});}else{return _0x2e9014;}})[_0xd5fe('0x42')](function(_0x18ff28){logger[_0xd5fe('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18ff28);throw _0x18ff28;});}return _0x2e9014;})[_0xd5fe('0x27')](respondWithResult(_0xd929b0,0xc9))[_0xd5fe('0x42')](handleError(_0xd929b0,null));};exports['update']=function(_0x45d10b,_0x3c28eb){if(_0x45d10b['body']['id']){delete _0x45d10b[_0xd5fe('0x48')]['id'];}return db[_0xd5fe('0x2e')]['find']({'where':{'id':_0x45d10b[_0xd5fe('0x4f')]['id']}})[_0xd5fe('0x27')](handleEntityNotFound(_0x3c28eb,null))['then'](saveUpdates(_0x45d10b[_0xd5fe('0x48')],null))[_0xd5fe('0x27')](respondWithResult(_0x3c28eb,null))[_0xd5fe('0x42')](handleError(_0x3c28eb,null));};exports[_0xd5fe('0x26')]=function(_0x476852,_0x93ad25){return db['Disposition'][_0xd5fe('0x46')]({'where':{'id':_0x476852[_0xd5fe('0x4f')]['id']}})[_0xd5fe('0x27')](handleEntityNotFound(_0x93ad25,null))[_0xd5fe('0x27')](removeEntity(_0x93ad25,null))[_0xd5fe('0x42')](handleError(_0x93ad25,null));}; \ No newline at end of file +var _0x600f=['rows','catch','params','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','get','Dispositions','UserProfileResource','destroy','error','stack','name','index','map','Disposition','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll'];(function(_0x48a6fa,_0x21295d){var _0x383ec7=function(_0x38484c){while(--_0x38484c){_0x48a6fa['push'](_0x48a6fa['shift']());}};_0x383ec7(++_0x21295d);}(_0x600f,0xb4));var _0xf600=function(_0x2cb58b,_0x5a879d){_0x2cb58b=_0x2cb58b-0x0;var _0xe9dd9c=_0x600f[_0x2cb58b];return _0xe9dd9c;};'use strict';var emlformat=require(_0xf600('0x0'));var rimraf=require(_0xf600('0x1'));var zipdir=require(_0xf600('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf600('0x3'));var moment=require('moment');var BPromise=require(_0xf600('0x4'));var Mustache=require(_0xf600('0x5'));var util=require(_0xf600('0x6'));var path=require(_0xf600('0x7'));var sox=require(_0xf600('0x8'));var csv=require(_0xf600('0x9'));var ejs=require(_0xf600('0xa'));var fs=require('fs');var fs_extra=require(_0xf600('0xb'));var _=require('lodash');var squel=require(_0xf600('0xc'));var crypto=require('crypto');var jsforce=require(_0xf600('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf600('0x9'));var querystring=require(_0xf600('0xe'));var Papa=require(_0xf600('0xf'));var Redis=require(_0xf600('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf600('0x11'));var as=require(_0xf600('0x12'));var hardwareService=require(_0xf600('0x13'));var logger=require(_0xf600('0x14'))('api');var utils=require(_0xf600('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf600('0x16'));var db=require(_0xf600('0x17'))['db'];function respondWithStatusCode(_0xe45a38,_0x436d6d){_0x436d6d=_0x436d6d||0xcc;return function(_0xc0ca75){if(_0xc0ca75){return _0xe45a38[_0xf600('0x18')](_0x436d6d);}return _0xe45a38[_0xf600('0x19')](_0x436d6d)[_0xf600('0x1a')]();};}function respondWithResult(_0x4cec23,_0x336ec5){_0x336ec5=_0x336ec5||0xc8;return function(_0x1f8f1e){if(_0x1f8f1e){return _0x4cec23[_0xf600('0x19')](_0x336ec5)['json'](_0x1f8f1e);}};}function respondWithFilteredResult(_0x265c6a,_0x5cd205){return function(_0x4ae962){if(_0x4ae962){var _0x20d9c3=typeof _0x5cd205[_0xf600('0x1b')]===_0xf600('0x1c')&&typeof _0x5cd205[_0xf600('0x1d')]===_0xf600('0x1c');var _0x506667=_0x4ae962[_0xf600('0x1e')];var _0x1e4efa=_0x20d9c3?0x0:_0x5cd205[_0xf600('0x1b')];var _0x2c9a76=_0x20d9c3?_0x4ae962[_0xf600('0x1e')]:_0x5cd205[_0xf600('0x1b')]+_0x5cd205[_0xf600('0x1d')];var _0x5f488c;if(_0x2c9a76>=_0x506667){_0x2c9a76=_0x506667;_0x5f488c=0xc8;}else{_0x5f488c=0xce;}_0x265c6a[_0xf600('0x19')](_0x5f488c);return _0x265c6a['set'](_0xf600('0x1f'),_0x1e4efa+'-'+_0x2c9a76+'/'+_0x506667)[_0xf600('0x20')](_0x4ae962);}return null;};}function patchUpdates(_0x287e86){return function(_0x2dc1ca){try{jsonpatch[_0xf600('0x21')](_0x2dc1ca,_0x287e86,!![]);}catch(_0x4968c7){return BPromise[_0xf600('0x22')](_0x4968c7);}return _0x2dc1ca[_0xf600('0x23')]();};}function saveUpdates(_0x1a5856,_0x328a9b){return function(_0x4083c5){if(_0x4083c5){return _0x4083c5[_0xf600('0x24')](_0x1a5856)[_0xf600('0x25')](function(_0x74a9de){return _0x74a9de;});}return null;};}function removeEntity(_0x2c066f,_0x259a3c){return function(_0x5ab4fe){if(_0x5ab4fe){return _0x5ab4fe['destroy']()['then'](function(){var _0x2f9aaa=_0x5ab4fe[_0xf600('0x26')]({'plain':!![]});var _0xf5299c=_0xf600('0x27');return db[_0xf600('0x28')][_0xf600('0x29')]({'where':{'type':_0xf5299c,'resourceId':_0x2f9aaa['id']}})[_0xf600('0x25')](function(){return _0x5ab4fe;});})[_0xf600('0x25')](function(){_0x2c066f[_0xf600('0x19')](0xcc)[_0xf600('0x1a')]();});}};}function handleEntityNotFound(_0xfa3730,_0x242bab){return function(_0x370027){if(!_0x370027){_0xfa3730[_0xf600('0x18')](0x194);}return _0x370027;};}function handleError(_0x1e3ba1,_0x324eed){_0x324eed=_0x324eed||0x1f4;return function(_0xc59f05){logger[_0xf600('0x2a')](_0xc59f05[_0xf600('0x2b')]);if(_0xc59f05[_0xf600('0x2c')]){delete _0xc59f05['name'];}_0x1e3ba1[_0xf600('0x19')](_0x324eed)['send'](_0xc59f05);};}exports[_0xf600('0x2d')]=function(_0x247aab,_0x2913a0){var _0x2dfdc9={},_0x45c957={},_0x32f144={'count':0x0,'rows':[]};var _0x5bf5ef=_[_0xf600('0x2e')](db[_0xf600('0x2f')][_0xf600('0x30')],function(_0x15ea7a){return{'name':_0x15ea7a[_0xf600('0x31')],'type':_0x15ea7a[_0xf600('0x32')]['key']};});_0x45c957[_0xf600('0x33')]=_[_0xf600('0x2e')](_0x5bf5ef,'name');_0x45c957['query']=_[_0xf600('0x34')](_0x247aab[_0xf600('0x35')]);_0x45c957[_0xf600('0x36')]=_[_0xf600('0x37')](_0x45c957[_0xf600('0x33')],_0x45c957[_0xf600('0x35')]);_0x2dfdc9['attributes']=_[_0xf600('0x37')](_0x45c957[_0xf600('0x33')],qs[_0xf600('0x38')](_0x247aab[_0xf600('0x35')][_0xf600('0x38')]));_0x2dfdc9[_0xf600('0x39')]=_0x2dfdc9[_0xf600('0x39')]['length']?_0x2dfdc9[_0xf600('0x39')]:_0x45c957[_0xf600('0x33')];if(!_0x247aab[_0xf600('0x35')][_0xf600('0x3a')](_0xf600('0x3b'))){_0x2dfdc9[_0xf600('0x1d')]=qs[_0xf600('0x1d')](_0x247aab[_0xf600('0x35')][_0xf600('0x1d')]);_0x2dfdc9['offset']=qs[_0xf600('0x1b')](_0x247aab['query'][_0xf600('0x1b')]);}_0x2dfdc9[_0xf600('0x3c')]=qs[_0xf600('0x3d')](_0x247aab['query']['sort']);_0x2dfdc9[_0xf600('0x3e')]=qs[_0xf600('0x36')](_[_0xf600('0x3f')](_0x247aab['query'],_0x45c957[_0xf600('0x36')]),_0x5bf5ef);if(_0x247aab[_0xf600('0x35')][_0xf600('0x40')]){_0x2dfdc9['where']=_[_0xf600('0x41')](_0x2dfdc9['where'],{'$or':_['map'](_0x5bf5ef,function(_0x3b4353){if(_0x3b4353[_0xf600('0x32')]!=='VIRTUAL'){var _0x150a37={};_0x150a37[_0x3b4353['name']]={'$like':'%'+_0x247aab[_0xf600('0x35')]['filter']+'%'};return _0x150a37;}})});}_0x2dfdc9=_[_0xf600('0x41')]({},_0x2dfdc9,_0x247aab['options']);var _0x2e2ba1={'where':_0x2dfdc9[_0xf600('0x3e')]};return db['Disposition'][_0xf600('0x1e')](_0x2e2ba1)[_0xf600('0x25')](function(_0x7753ae){_0x32f144['count']=_0x7753ae;if(_0x247aab[_0xf600('0x35')][_0xf600('0x42')]){_0x2dfdc9[_0xf600('0x43')]=[{'all':!![]}];}return db[_0xf600('0x2f')][_0xf600('0x44')](_0x2dfdc9);})[_0xf600('0x25')](function(_0x5420df){_0x32f144[_0xf600('0x45')]=_0x5420df;return _0x32f144;})[_0xf600('0x25')](respondWithFilteredResult(_0x2913a0,_0x2dfdc9))[_0xf600('0x46')](handleError(_0x2913a0,null));};exports['show']=function(_0xb6fffe,_0x4e7379){var _0x2b07f9={'raw':!![],'where':{'id':_0xb6fffe[_0xf600('0x47')]['id']}},_0x4deb0b={};_0x4deb0b[_0xf600('0x33')]=_['keys'](db[_0xf600('0x2f')][_0xf600('0x30')]);_0x4deb0b['query']=_['keys'](_0xb6fffe[_0xf600('0x35')]);_0x4deb0b[_0xf600('0x36')]=_[_0xf600('0x37')](_0x4deb0b['model'],_0x4deb0b[_0xf600('0x35')]);_0x2b07f9[_0xf600('0x39')]=_[_0xf600('0x37')](_0x4deb0b['model'],qs[_0xf600('0x38')](_0xb6fffe[_0xf600('0x35')]['fields']));_0x2b07f9[_0xf600('0x39')]=_0x2b07f9[_0xf600('0x39')][_0xf600('0x48')]?_0x2b07f9['attributes']:_0x4deb0b[_0xf600('0x33')];if(_0xb6fffe[_0xf600('0x35')][_0xf600('0x42')]){_0x2b07f9[_0xf600('0x43')]=[{'all':!![]}];}_0x2b07f9=_['merge']({},_0x2b07f9,_0xb6fffe[_0xf600('0x49')]);return db[_0xf600('0x2f')][_0xf600('0x4a')](_0x2b07f9)[_0xf600('0x25')](handleEntityNotFound(_0x4e7379,null))[_0xf600('0x25')](respondWithResult(_0x4e7379,null))[_0xf600('0x46')](handleError(_0x4e7379,null));};exports[_0xf600('0x4b')]=function(_0x549b09,_0xb0453e){return db[_0xf600('0x2f')]['create'](_0x549b09['body'],{})[_0xf600('0x25')](function(_0x1f1bf9){var _0x1dc768=_0x549b09[_0xf600('0x4c')]['get']({'plain':!![]});if(!_0x1dc768)throw new Error(_0xf600('0x4d'));if(_0x1dc768[_0xf600('0x4e')]===_0xf600('0x4c')){var _0x5e8c0d=_0x1f1bf9[_0xf600('0x26')]({'plain':!![]});var _0x309962='Dispositions';return db['UserProfileSection']['find']({'where':{'name':_0x309962,'userProfileId':_0x1dc768[_0xf600('0x4f')]},'raw':!![]})[_0xf600('0x25')](function(_0x12f86b){if(_0x12f86b&&_0x12f86b[_0xf600('0x50')]===0x0){return db[_0xf600('0x28')][_0xf600('0x4b')]({'name':_0x5e8c0d[_0xf600('0x2c')],'resourceId':_0x5e8c0d['id'],'type':_0x12f86b[_0xf600('0x2c')],'sectionId':_0x12f86b['id']},{})['then'](function(){return _0x1f1bf9;});}else{return _0x1f1bf9;}})['catch'](function(_0x155f51){logger[_0xf600('0x2a')](_0xf600('0x51'),_0x155f51);throw _0x155f51;});}return _0x1f1bf9;})[_0xf600('0x25')](respondWithResult(_0xb0453e,0xc9))[_0xf600('0x46')](handleError(_0xb0453e,null));};exports[_0xf600('0x24')]=function(_0xf3940f,_0x3e62ab){if(_0xf3940f[_0xf600('0x52')]['id']){delete _0xf3940f[_0xf600('0x52')]['id'];}return db['Disposition'][_0xf600('0x4a')]({'where':{'id':_0xf3940f[_0xf600('0x47')]['id']}})[_0xf600('0x25')](handleEntityNotFound(_0x3e62ab,null))[_0xf600('0x25')](saveUpdates(_0xf3940f[_0xf600('0x52')],null))['then'](respondWithResult(_0x3e62ab,null))['catch'](handleError(_0x3e62ab,null));};exports[_0xf600('0x29')]=function(_0x1704a4,_0x438c47){return db[_0xf600('0x2f')][_0xf600('0x4a')]({'where':{'id':_0x1704a4[_0xf600('0x47')]['id']}})['then'](handleEntityNotFound(_0x438c47,null))[_0xf600('0x25')](removeEntity(_0x438c47,null))[_0xf600('0x46')](handleError(_0x438c47,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index c78ed83..bf25ce8 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 _0x3a8c=['name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','Disposition','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_sms','SmsAccountId','name_fax','FaxAccountId'];(function(_0x456792,_0x972791){var _0x5cf90d=function(_0x9df2be){while(--_0x9df2be){_0x456792['push'](_0x456792['shift']());}};_0x5cf90d(++_0x972791);}(_0x3a8c,0x18a));var _0xc3a8=function(_0x5685c5,_0x3c0b1c){_0x5685c5=_0x5685c5-0x0;var _0x396e4e=_0x3a8c[_0x5685c5];return _0x396e4e;};'use strict';var _=require(_0xc3a8('0x0'));var util=require(_0xc3a8('0x1'));var logger=require(_0xc3a8('0x2'))(_0xc3a8('0x3'));var moment=require('moment');var BPromise=require(_0xc3a8('0x4'));var rp=require(_0xc3a8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc3a8('0x6'));var config=require(_0xc3a8('0x7'));var attributes=require('./disposition.attributes');module[_0xc3a8('0x8')]=function(_0x37acb1,_0x234d15){return _0x37acb1[_0xc3a8('0x9')](_0xc3a8('0xa'),attributes,{'tableName':_0xc3a8('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xc3a8('0xc'),'fields':[_0xc3a8('0xd'),'ListId']},{'unique':!![],'name':_0xc3a8('0xe'),'fields':['name',_0xc3a8('0xf')]},{'unique':!![],'name':'name_mail','fields':[_0xc3a8('0xd'),'MailAccountId']},{'unique':!![],'name':_0xc3a8('0x10'),'fields':[_0xc3a8('0xd'),_0xc3a8('0x11')]},{'unique':!![],'name':_0xc3a8('0x12'),'fields':[_0xc3a8('0xd'),_0xc3a8('0x13')]},{'unique':!![],'name':_0xc3a8('0x14'),'fields':[_0xc3a8('0xd'),'OpenchannelAccountId']},{'unique':!![],'name':_0xc3a8('0x15'),'fields':[_0xc3a8('0xd'),_0xc3a8('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe34a=['ChatWebsiteId','name_mail','MailAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','define','Disposition','tools_dispositions','ListId','name_chat','name'];(function(_0xad65d5,_0x5c83a8){var _0x42c481=function(_0x5a2494){while(--_0x5a2494){_0xad65d5['push'](_0xad65d5['shift']());}};_0x42c481(++_0x5c83a8);}(_0xe34a,0x178));var _0xae34=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xe34a[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0xae34('0x0'));var util=require(_0xae34('0x1'));var logger=require('../../config/logger')(_0xae34('0x2'));var moment=require(_0xae34('0x3'));var BPromise=require(_0xae34('0x4'));var rp=require(_0xae34('0x5'));var fs=require('fs');var path=require(_0xae34('0x6'));var rimraf=require('rimraf');var config=require(_0xae34('0x7'));var attributes=require(_0xae34('0x8'));module['exports']=function(_0xba675c,_0x34e9c1){return _0xba675c[_0xae34('0x9')](_0xae34('0xa'),attributes,{'tableName':_0xae34('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name',_0xae34('0xc')]},{'unique':!![],'name':_0xae34('0xd'),'fields':[_0xae34('0xe'),_0xae34('0xf')]},{'unique':!![],'name':_0xae34('0x10'),'fields':[_0xae34('0xe'),_0xae34('0x11')]},{'unique':!![],'name':'name_sms','fields':[_0xae34('0xe'),'SmsAccountId']},{'unique':!![],'name':_0xae34('0x12'),'fields':[_0xae34('0xe'),_0xae34('0x13')]},{'unique':!![],'name':_0xae34('0x14'),'fields':[_0xae34('0xe'),_0xae34('0x15')]},{'unique':!![],'name':_0xae34('0x16'),'fields':[_0xae34('0xe'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 83b6618..febf1a0 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(_0x3cbdf5,_0x151ccd){var _0x5ee507=function(_0x31a253){while(--_0x31a253){_0x3cbdf5['push'](_0x3cbdf5['shift']());}};_0x5ee507(++_0x151ccd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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(_0x402bf3,_0x3db897){var _0x54822f=function(_0x5e155b){while(--_0x5e155b){_0x402bf3['push'](_0x402bf3['shift']());}};_0x54822f(++_0x3db897);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 5dad478..b731b66 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 _0xe100=['create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated','index','show','post'];(function(_0x3f4243,_0x2e542a){var _0x1cc411=function(_0x4398c3){while(--_0x4398c3){_0x3f4243['push'](_0x3f4243['shift']());}};_0x1cc411(++_0x2e542a);}(_0xe100,0xbb));var _0x0e10=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe100[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0e10('0x0'));var util=require(_0x0e10('0x1'));var path=require(_0x0e10('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e10('0x3'));var router=express[_0x0e10('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0e10('0x5'));var interaction=require(_0x0e10('0x6'));var config=require('../../config/environment');var controller=require(_0x0e10('0x7'));router[_0x0e10('0x8')]('/',auth[_0x0e10('0x9')](),controller[_0x0e10('0xa')]);router[_0x0e10('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0e10('0xb')]);router[_0x0e10('0xc')]('/',auth[_0x0e10('0x9')](),controller[_0x0e10('0xd')]);router[_0x0e10('0xe')](_0x0e10('0xf'),auth[_0x0e10('0x9')](),controller[_0x0e10('0x10')]);router[_0x0e10('0x11')](_0x0e10('0xf'),auth[_0x0e10('0x9')](),controller[_0x0e10('0x12')]);module[_0x0e10('0x13')]=router; \ No newline at end of file +var _0xff92=['put','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','/:id','post','create'];(function(_0x4641a6,_0x3c9319){var _0x467a49=function(_0x37fd4a){while(--_0x37fd4a){_0x4641a6['push'](_0x4641a6['shift']());}};_0x467a49(++_0x3c9319);}(_0xff92,0x148));var _0x2ff9=function(_0x390ef1,_0x4daf3f){_0x390ef1=_0x390ef1-0x0;var _0x523823=_0xff92[_0x390ef1];return _0x523823;};'use strict';var multer=require(_0x2ff9('0x0'));var util=require(_0x2ff9('0x1'));var path=require(_0x2ff9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2ff9('0x3')]();var fs_extra=require(_0x2ff9('0x4'));var auth=require(_0x2ff9('0x5'));var interaction=require(_0x2ff9('0x6'));var config=require(_0x2ff9('0x7'));var controller=require(_0x2ff9('0x8'));router[_0x2ff9('0x9')]('/',auth[_0x2ff9('0xa')](),controller['index']);router[_0x2ff9('0x9')](_0x2ff9('0xb'),auth[_0x2ff9('0xa')](),controller['show']);router[_0x2ff9('0xc')]('/',auth[_0x2ff9('0xa')](),controller[_0x2ff9('0xd')]);router[_0x2ff9('0xe')](_0x2ff9('0xb'),auth[_0x2ff9('0xa')](),controller[_0x2ff9('0xf')]);router[_0x2ff9('0x10')](_0x2ff9('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2ff9('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 a3f5db7..4b83f7c 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 _0x56c2=['yes','4800','7200','9600','12000','14400','2400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','exports','STRING','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x56c2,0x17d));var _0x256c=function(_0x355fa6,_0x40e134){_0x355fa6=_0x355fa6-0x0;var _0x54cba7=_0x56c2[_0x355fa6];return _0x54cba7;};'use strict';var Sequelize=require('sequelize');module[_0x256c('0x0')]={'name':{'type':Sequelize[_0x256c('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x256c('0x2')](_0x256c('0x3'),'no'),'defaultValue':_0x256c('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x256c('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x256c('0x2')]('2400',_0x256c('0x4'),_0x256c('0x5'),_0x256c('0x6'),_0x256c('0x7'),_0x256c('0x8')),'defaultValue':_0x256c('0x4')},'maxrate':{'type':Sequelize[_0x256c('0x2')](_0x256c('0x9'),'4800',_0x256c('0x5'),_0x256c('0x6'),_0x256c('0x7'),_0x256c('0x8')),'defaultValue':_0x256c('0x8')},'modem':{'type':Sequelize[_0x256c('0x1')],'defaultValue':_0x256c('0xa')},'gateway':{'type':Sequelize[_0x256c('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x256c('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x256c('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x256c('0xc'),_0x256c('0xd'),_0x256c('0xe'),_0x256c('0xf')),'defaultValue':_0x256c('0xc')},'key':{'type':Sequelize[_0x256c('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x256c('0x10')],'defaultValue':function(){return _0x256c('0x11');}},'notificationSound':{'type':Sequelize[_0x256c('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x256c('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x256c('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x256c('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x256c('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x256c('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x256c('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x256c('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x256c('0x12')],'defaultValue':![],'comment':_0x256c('0x14'),'set':function(_0x4b3b7a){if(!_0x4b3b7a)this['setDataValue'](_0x256c('0x15'),null);this[_0x256c('0x16')](_0x256c('0x17'),_0x4b3b7a);}}}; \ No newline at end of file +var _0xd056=['IAX','DADHI','KHOMP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','yes','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd056,0x142));var _0x6d05=function(_0x108899,_0x54beb9){_0x108899=_0x108899-0x0;var _0x15516e=_0xd056[_0x108899];return _0x15516e;};'use strict';var Sequelize=require('sequelize');module[_0x6d05('0x0')]={'name':{'type':Sequelize[_0x6d05('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6d05('0x1')]},'ecm':{'type':Sequelize[_0x6d05('0x2')](_0x6d05('0x3'),'no'),'defaultValue':_0x6d05('0x3')},'headerinfo':{'type':Sequelize[_0x6d05('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x6d05('0x1')],'unique':_0x6d05('0x4')},'minrate':{'type':Sequelize[_0x6d05('0x2')](_0x6d05('0x5'),_0x6d05('0x6'),_0x6d05('0x7'),_0x6d05('0x8'),_0x6d05('0x9'),_0x6d05('0xa')),'defaultValue':_0x6d05('0x6')},'maxrate':{'type':Sequelize[_0x6d05('0x2')]('2400',_0x6d05('0x6'),_0x6d05('0x7'),_0x6d05('0x8'),'12000',_0x6d05('0xa')),'defaultValue':_0x6d05('0xa')},'modem':{'type':Sequelize[_0x6d05('0x1')],'defaultValue':_0x6d05('0xb')},'gateway':{'type':Sequelize[_0x6d05('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6d05('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x6d05('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x6d05('0xd'),_0x6d05('0xe'),_0x6d05('0xf'),_0x6d05('0x10')),'defaultValue':_0x6d05('0xd')},'key':{'type':Sequelize[_0x6d05('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6d05('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x6d05('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6d05('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6d05('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6d05('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6d05('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6d05('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x6d05('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x6d05('0x12')],'defaultValue':![],'comment':_0x6d05('0x14'),'set':function(_0x6e54a2){if(!_0x6e54a2)this[_0x6d05('0x15')](_0x6d05('0x16'),null);this[_0x6d05('0x15')](_0x6d05('0x17'),_0x6e54a2);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 754ccb7..73a4021 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 _0x8f10=['VoiceExtension','tech','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','FaxAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','FaxAccount','fieldName','type','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','show','params','rawAttributes','intersection','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','nolimit','options','rows','removeDispositions','ids','CannedAnswer','getAnswers','findOne','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','destroy','FaxApplication','bulkCreate','findAndCountAll','priority','send','getApplications','context','from-voip-provider','localstationid','app','description','Fax\x20Extension','appdata','push','Answer','gateway','faxdetect','maxrate','minrate','modem','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','updateAccountApplications'];(function(_0x27d5a4,_0x44ef55){var _0x387c03=function(_0x16cef4){while(--_0x16cef4){_0x27d5a4['push'](_0x27d5a4['shift']());}};_0x387c03(++_0x44ef55);}(_0x8f10,0xe8));var _0x08f1=function(_0x48ba5e,_0x1dc502){_0x48ba5e=_0x48ba5e-0x0;var _0xd671d=_0x8f10[_0x48ba5e];return _0xd671d;};'use strict';var emlformat=require(_0x08f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x08f1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x08f1('0x2'));var moment=require(_0x08f1('0x3'));var BPromise=require(_0x08f1('0x4'));var Mustache=require(_0x08f1('0x5'));var util=require(_0x08f1('0x6'));var path=require(_0x08f1('0x7'));var sox=require(_0x08f1('0x8'));var csv=require(_0x08f1('0x9'));var ejs=require(_0x08f1('0xa'));var fs=require('fs');var fs_extra=require(_0x08f1('0xb'));var _=require(_0x08f1('0xc'));var squel=require('squel');var crypto=require(_0x08f1('0xd'));var jsforce=require(_0x08f1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x08f1('0x9'));var querystring=require(_0x08f1('0xf'));var Papa=require(_0x08f1('0x10'));var Redis=require(_0x08f1('0x11'));var authService=require(_0x08f1('0x12'));var qs=require(_0x08f1('0x13'));var as=require(_0x08f1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x08f1('0x15'))(_0x08f1('0x16'));var utils=require(_0x08f1('0x17'));var config=require(_0x08f1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x08f1('0x19'))['db'];config[_0x08f1('0x1a')]=_[_0x08f1('0x1b')](config[_0x08f1('0x1a')],{'host':_0x08f1('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x08f1('0x1a')]));require(_0x08f1('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x08f1('0x1e')][_0x08f1('0x1f')]({'port':0x232c});var client9002=jayson[_0x08f1('0x1e')][_0x08f1('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3fc836,_0x2dff68,_0x4569ff,_0x4a9956){return new BPromise(function(_0x47c902,_0x5b8561){var _0x12b50a=_0x4a9956||client;return _0x12b50a['request'](_0x3fc836,_0x4569ff)[_0x08f1('0x20')](function(_0x526ef4){logger[_0x08f1('0x21')](_0x08f1('0x22'),_0x2dff68,_0x08f1('0x23'));logger[_0x08f1('0x24')](_0x08f1('0x25'),_0x2dff68,_0x08f1('0x23'),JSON[_0x08f1('0x26')](_0x526ef4));if(_0x526ef4[_0x08f1('0x27')]){if(_0x526ef4['error'][_0x08f1('0x28')]===0x1f4){logger['error'](_0x08f1('0x22'),_0x2dff68,_0x526ef4[_0x08f1('0x27')][_0x08f1('0x29')]);return _0x5b8561(_0x526ef4['error'][_0x08f1('0x29')]);}logger['error'](_0x08f1('0x22'),_0x2dff68,_0x526ef4[_0x08f1('0x27')][_0x08f1('0x29')]);return _0x47c902(_0x526ef4[_0x08f1('0x27')][_0x08f1('0x29')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x2dff68,_0x08f1('0x23'));_0x47c902(_0x526ef4[_0x08f1('0x2a')][_0x08f1('0x29')]);}})['catch'](function(_0x3fe9b9){logger[_0x08f1('0x27')](_0x08f1('0x22'),_0x2dff68,_0x3fe9b9);_0x5b8561(_0x3fe9b9);});});}function respondWithStatusCode(_0x128e48,_0x276656){_0x276656=_0x276656||0xcc;return function(_0x3e2101){if(_0x3e2101){return _0x128e48['sendStatus'](_0x276656);}return _0x128e48[_0x08f1('0x2b')](_0x276656)[_0x08f1('0x2c')]();};}function respondWithResult(_0x17b61e,_0x3db46e){_0x3db46e=_0x3db46e||0xc8;return function(_0x363e02){if(_0x363e02){return _0x17b61e[_0x08f1('0x2b')](_0x3db46e)[_0x08f1('0x2d')](_0x363e02);}};}function respondWithFilteredResult(_0x57bfeb,_0x1cb61c){return function(_0x3ccf8e){if(_0x3ccf8e){var _0x5dbdf5=typeof _0x1cb61c[_0x08f1('0x2e')]===_0x08f1('0x2f')&&typeof _0x1cb61c[_0x08f1('0x30')]===_0x08f1('0x2f');var _0x2e37fc=_0x3ccf8e['count'];var _0x5d0f8e=_0x5dbdf5?0x0:_0x1cb61c['offset'];var _0x4642f7=_0x5dbdf5?_0x3ccf8e[_0x08f1('0x31')]:_0x1cb61c[_0x08f1('0x2e')]+_0x1cb61c['limit'];var _0x22dd13;if(_0x4642f7>=_0x2e37fc){_0x4642f7=_0x2e37fc;_0x22dd13=0xc8;}else{_0x22dd13=0xce;}_0x57bfeb[_0x08f1('0x2b')](_0x22dd13);return _0x57bfeb[_0x08f1('0x32')](_0x08f1('0x33'),_0x5d0f8e+'-'+_0x4642f7+'/'+_0x2e37fc)['json'](_0x3ccf8e);}return null;};}function patchUpdates(_0x144cff){return function(_0x2ec449){try{jsonpatch['apply'](_0x2ec449,_0x144cff,!![]);}catch(_0x4c17f8){return BPromise[_0x08f1('0x34')](_0x4c17f8);}return _0x2ec449[_0x08f1('0x35')]();};}function saveUpdates(_0x117ad3,_0x2d3197){return function(_0x2c8321){if(_0x2c8321){return _0x2c8321[_0x08f1('0x36')](_0x117ad3)[_0x08f1('0x20')](function(_0x45824d){return _0x45824d;});}return null;};}function removeEntity(_0xf92bb8,_0x1d3f3a){return function(_0x22aa23){if(_0x22aa23){return _0x22aa23['destroy']()[_0x08f1('0x20')](function(){var _0x39bec8=_0x22aa23[_0x08f1('0x37')]({'plain':!![]});var _0x281e29=_0x08f1('0x38');return db[_0x08f1('0x39')]['destroy']({'where':{'type':_0x281e29,'resourceId':_0x39bec8['id']}})[_0x08f1('0x20')](function(){return _0x22aa23;});})['then'](function(){_0xf92bb8['status'](0xcc)[_0x08f1('0x2c')]();});}};}function handleEntityNotFound(_0x431435,_0x1e7866){return function(_0x3fd4bc){if(!_0x3fd4bc){_0x431435[_0x08f1('0x3a')](0x194);}return _0x3fd4bc;};}function handleError(_0x581e23,_0x2d66b0){_0x2d66b0=_0x2d66b0||0x1f4;return function(_0x46b4cd){logger[_0x08f1('0x27')](_0x46b4cd[_0x08f1('0x3b')]);if(_0x46b4cd[_0x08f1('0x3c')]){delete _0x46b4cd[_0x08f1('0x3c')];}_0x581e23['status'](_0x2d66b0)['send'](_0x46b4cd);};}exports[_0x08f1('0x3d')]=function(_0x33b46d,_0x56f977){var _0x1bd015={'include':[{'model':db[_0x08f1('0x3e')],'as':_0x08f1('0x3f')}]},_0x55c5b8={},_0x3e8624={'count':0x0,'rows':[]};var _0x104ffb=_['map'](db[_0x08f1('0x40')]['rawAttributes'],function(_0x239bfa){return{'name':_0x239bfa[_0x08f1('0x41')],'type':_0x239bfa[_0x08f1('0x42')][_0x08f1('0x43')]};});_0x55c5b8[_0x08f1('0x44')]=_[_0x08f1('0x45')](_0x104ffb,_0x08f1('0x3c'));_0x55c5b8['query']=_[_0x08f1('0x46')](_0x33b46d[_0x08f1('0x47')]);_0x55c5b8[_0x08f1('0x48')]=_['intersection'](_0x55c5b8[_0x08f1('0x44')],_0x55c5b8[_0x08f1('0x47')]);_0x1bd015[_0x08f1('0x49')]=_['intersection'](_0x55c5b8[_0x08f1('0x44')],qs[_0x08f1('0x4a')](_0x33b46d['query'][_0x08f1('0x4a')]));_0x1bd015['attributes']=_0x1bd015[_0x08f1('0x49')][_0x08f1('0x4b')]?_0x1bd015[_0x08f1('0x49')]:_0x55c5b8['model'];if(!_0x33b46d['query'][_0x08f1('0x4c')]('nolimit')){_0x1bd015[_0x08f1('0x30')]=qs[_0x08f1('0x30')](_0x33b46d[_0x08f1('0x47')][_0x08f1('0x30')]);_0x1bd015[_0x08f1('0x2e')]=qs[_0x08f1('0x2e')](_0x33b46d['query'][_0x08f1('0x2e')]);}_0x1bd015[_0x08f1('0x4d')]=qs[_0x08f1('0x4e')](_0x33b46d[_0x08f1('0x47')]['sort']);_0x1bd015[_0x08f1('0x4f')]=qs['filters'](_[_0x08f1('0x50')](_0x33b46d['query'],_0x55c5b8['filters']),_0x104ffb);if(_0x33b46d[_0x08f1('0x47')][_0x08f1('0x51')]){_0x1bd015[_0x08f1('0x4f')]=_['merge'](_0x1bd015['where'],{'$or':_[_0x08f1('0x45')](_0x104ffb,function(_0x49e9fe){if(_0x49e9fe['type']!=='VIRTUAL'){var _0x3fd21b={};_0x3fd21b[_0x49e9fe[_0x08f1('0x3c')]]={'$like':'%'+_0x33b46d[_0x08f1('0x47')][_0x08f1('0x51')]+'%'};return _0x3fd21b;}})});}_0x1bd015=_[_0x08f1('0x52')]({},_0x1bd015,_0x33b46d['options']);var _0x33d385={'where':_0x1bd015['where']};return db[_0x08f1('0x40')][_0x08f1('0x31')](_0x33d385)['then'](function(_0x5cb2cb){_0x3e8624[_0x08f1('0x31')]=_0x5cb2cb;if(_0x33b46d['query'][_0x08f1('0x53')]){_0x1bd015[_0x08f1('0x54')]=[{'all':!![]}];}return db[_0x08f1('0x40')][_0x08f1('0x55')](_0x1bd015);})[_0x08f1('0x20')](function(_0x154c75){_0x3e8624['rows']=_0x154c75;return _0x3e8624;})[_0x08f1('0x20')](respondWithFilteredResult(_0x56f977,_0x1bd015))[_0x08f1('0x56')](handleError(_0x56f977,null));};exports[_0x08f1('0x57')]=function(_0x332670,_0x2e0870){var _0x20b52e={'raw':![],'where':{'id':_0x332670[_0x08f1('0x58')]['id']},'include':[{'model':db[_0x08f1('0x3e')],'as':_0x08f1('0x3f')}]},_0xe35e4={};_0xe35e4[_0x08f1('0x44')]=_[_0x08f1('0x46')](db[_0x08f1('0x40')][_0x08f1('0x59')]);_0xe35e4[_0x08f1('0x47')]=_['keys'](_0x332670[_0x08f1('0x47')]);_0xe35e4[_0x08f1('0x48')]=_[_0x08f1('0x5a')](_0xe35e4[_0x08f1('0x44')],_0xe35e4[_0x08f1('0x47')]);_0x20b52e[_0x08f1('0x49')]=_[_0x08f1('0x5a')](_0xe35e4['model'],qs[_0x08f1('0x4a')](_0x332670[_0x08f1('0x47')][_0x08f1('0x4a')]));_0x20b52e[_0x08f1('0x49')]=_0x20b52e['attributes'][_0x08f1('0x4b')]?_0x20b52e[_0x08f1('0x49')]:_0xe35e4[_0x08f1('0x44')];if(_0x332670[_0x08f1('0x47')]['includeAll']){_0x20b52e[_0x08f1('0x54')]=[{'all':!![]}];}_0x20b52e=_[_0x08f1('0x52')]({},_0x20b52e,_0x332670['options']);return db[_0x08f1('0x40')][_0x08f1('0x5b')](_0x20b52e)[_0x08f1('0x20')](handleEntityNotFound(_0x2e0870,null))[_0x08f1('0x20')](respondWithResult(_0x2e0870,null))[_0x08f1('0x56')](handleError(_0x2e0870,null));};exports[_0x08f1('0x5c')]=function(_0xa30e4d,_0x17a927){return db[_0x08f1('0x40')][_0x08f1('0x5c')](_0xa30e4d[_0x08f1('0x5d')],{})[_0x08f1('0x20')](function(_0x4f442f){var _0x27df90=_0xa30e4d['user'][_0x08f1('0x37')]({'plain':!![]});if(!_0x27df90)throw new Error(_0x08f1('0x5e'));if(_0x27df90[_0x08f1('0x5f')]===_0x08f1('0x60')){var _0x4e8ffc=_0x4f442f[_0x08f1('0x37')]({'plain':!![]});var _0xd2cba1=_0x08f1('0x38');return db[_0x08f1('0x61')]['find']({'where':{'name':_0xd2cba1,'userProfileId':_0x27df90[_0x08f1('0x62')]},'raw':!![]})[_0x08f1('0x20')](function(_0x5e5ede){if(_0x5e5ede&&_0x5e5ede['autoAssociation']===0x0){return db[_0x08f1('0x39')][_0x08f1('0x5c')]({'name':_0x4e8ffc[_0x08f1('0x3c')],'resourceId':_0x4e8ffc['id'],'type':_0x5e5ede[_0x08f1('0x3c')],'sectionId':_0x5e5ede['id']},{})[_0x08f1('0x20')](function(){return _0x4f442f;});}else{return _0x4f442f;}})['catch'](function(_0x2fb111){logger[_0x08f1('0x27')](_0x08f1('0x63'),_0x2fb111);throw _0x2fb111;});}return _0x4f442f;})[_0x08f1('0x20')](respondWithResult(_0x17a927,0xc9))[_0x08f1('0x56')](handleError(_0x17a927,null));};exports['update']=function(_0x1a76b1,_0x5ef6aa){if(_0x1a76b1['body']['id']){delete _0x1a76b1[_0x08f1('0x5d')]['id'];}return db[_0x08f1('0x40')][_0x08f1('0x5b')]({'where':{'id':_0x1a76b1['params']['id']},'include':[{'model':db[_0x08f1('0x3e')],'as':_0x08f1('0x3f')}]})[_0x08f1('0x20')](handleEntityNotFound(_0x5ef6aa,null))[_0x08f1('0x20')](saveUpdates(_0x1a76b1[_0x08f1('0x5d')],null))[_0x08f1('0x20')](respondWithResult(_0x5ef6aa,null))[_0x08f1('0x56')](handleError(_0x5ef6aa,null));};exports['destroy']=function(_0x4d8403,_0x3c1426){return db[_0x08f1('0x40')][_0x08f1('0x5b')]({'where':{'id':_0x4d8403[_0x08f1('0x58')]['id']}})[_0x08f1('0x20')](handleEntityNotFound(_0x3c1426,null))[_0x08f1('0x20')](removeEntity(_0x3c1426,null))[_0x08f1('0x56')](handleError(_0x3c1426,null));};exports[_0x08f1('0x64')]=function(_0x1fb182,_0x20b0e3){return db['FaxAccount'][_0x08f1('0x64')]()[_0x08f1('0x20')](respondWithResult(_0x20b0e3,null))['catch'](handleError(_0x20b0e3,null));};exports[_0x08f1('0x65')]=function(_0x193dc3,_0x45c31,_0x192a48){if(_0x193dc3[_0x08f1('0x5d')]['id']){delete _0x193dc3[_0x08f1('0x5d')]['id'];}return db[_0x08f1('0x40')][_0x08f1('0x5b')]({'where':{'id':_0x193dc3[_0x08f1('0x58')]['id']}})['then'](handleEntityNotFound(_0x45c31,null))['then'](function(_0x4239e6){if(_0x4239e6){_0x193dc3[_0x08f1('0x5d')][_0x08f1('0x66')]=_0x4239e6['id'];return db[_0x08f1('0x67')][_0x08f1('0x5c')](_0x193dc3[_0x08f1('0x5d')]);}})[_0x08f1('0x20')](respondWithResult(_0x45c31,null))[_0x08f1('0x56')](handleError(_0x45c31,null));};exports['getDispositions']=function(_0x3bfb57,_0x59e6a3,_0xdabab4){var _0x11a8cc={'raw':![],'where':{}};var _0x146260={};var _0x9b245e={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x3bfb57[_0x08f1('0x58')]['id']}})[_0x08f1('0x20')](handleEntityNotFound(_0x59e6a3,null))[_0x08f1('0x20')](function(_0x473163){if(_0x473163){_0x146260[_0x08f1('0x44')]=_[_0x08f1('0x46')](db[_0x08f1('0x67')]['rawAttributes']);_0x146260[_0x08f1('0x47')]=_[_0x08f1('0x46')](_0x3bfb57['query']);_0x146260['filters']=_[_0x08f1('0x5a')](_0x146260[_0x08f1('0x44')],_0x146260[_0x08f1('0x47')]);_0x11a8cc[_0x08f1('0x49')]=_[_0x08f1('0x5a')](_0x146260[_0x08f1('0x44')],qs[_0x08f1('0x4a')](_0x3bfb57[_0x08f1('0x47')]['fields']));_0x11a8cc[_0x08f1('0x49')]=_0x11a8cc['attributes']['length']?_0x11a8cc[_0x08f1('0x49')]:_0x146260[_0x08f1('0x44')];if(!_0x3bfb57['query'][_0x08f1('0x4c')](_0x08f1('0x68'))){_0x11a8cc['limit']=qs[_0x08f1('0x30')](_0x3bfb57[_0x08f1('0x47')][_0x08f1('0x30')]);_0x11a8cc[_0x08f1('0x2e')]=qs[_0x08f1('0x2e')](_0x3bfb57[_0x08f1('0x47')][_0x08f1('0x2e')]);}_0x11a8cc[_0x08f1('0x4d')]=qs[_0x08f1('0x4e')](_0x3bfb57[_0x08f1('0x47')][_0x08f1('0x4e')]);_0x11a8cc[_0x08f1('0x4f')]=qs[_0x08f1('0x48')](_['pick'](_0x3bfb57['query'],_0x146260[_0x08f1('0x48')]));_0x11a8cc['where'][_0x08f1('0x66')]=_0x473163['id'];if(_0x3bfb57[_0x08f1('0x47')]['filter']){_0x11a8cc['where']=_[_0x08f1('0x52')](_0x11a8cc['where'],{'$or':_[_0x08f1('0x45')](_0x11a8cc[_0x08f1('0x49')],function(_0x4230ad){var _0x453794={};_0x453794[_0x4230ad]={'$like':'%'+_0x3bfb57[_0x08f1('0x47')][_0x08f1('0x51')]+'%'};return _0x453794;})});}_0x11a8cc=_['merge']({},_0x11a8cc,_0x3bfb57[_0x08f1('0x69')]);return db['Disposition'][_0x08f1('0x31')]({'where':_0x11a8cc[_0x08f1('0x4f')]})[_0x08f1('0x20')](function(_0x5c061f){_0x9b245e[_0x08f1('0x31')]=_0x5c061f;if(_0x3bfb57[_0x08f1('0x47')]['includeAll']){_0x11a8cc[_0x08f1('0x54')]=[{'all':!![]}];}return db[_0x08f1('0x67')]['findAll'](_0x11a8cc);})[_0x08f1('0x20')](function(_0x4a266c){_0x9b245e[_0x08f1('0x6a')]=_0x4a266c;return _0x9b245e;});}})[_0x08f1('0x20')](respondWithFilteredResult(_0x59e6a3,_0x11a8cc))[_0x08f1('0x56')](handleError(_0x59e6a3,null));};exports[_0x08f1('0x6b')]=function(_0x23ff0c,_0x30bb53,_0x42466f){return db[_0x08f1('0x40')][_0x08f1('0x5b')]({'where':{'id':_0x23ff0c[_0x08f1('0x58')]['id']}})[_0x08f1('0x20')](handleEntityNotFound(_0x30bb53,null))[_0x08f1('0x20')](function(_0x466c3e){if(_0x466c3e){return _0x466c3e[_0x08f1('0x6b')](_0x23ff0c[_0x08f1('0x47')][_0x08f1('0x6c')]);}})[_0x08f1('0x20')](respondWithStatusCode(_0x30bb53,null))[_0x08f1('0x56')](handleError(_0x30bb53,null));};exports['addAnswer']=function(_0x2aaa8b,_0x2c728c,_0x50ae85){if(_0x2aaa8b[_0x08f1('0x5d')]['id']){delete _0x2aaa8b[_0x08f1('0x5d')]['id'];}return db[_0x08f1('0x40')][_0x08f1('0x5b')]({'where':{'id':_0x2aaa8b[_0x08f1('0x58')]['id']}})[_0x08f1('0x20')](handleEntityNotFound(_0x2c728c,null))[_0x08f1('0x20')](function(_0x2948d4){if(_0x2948d4){_0x2aaa8b[_0x08f1('0x5d')][_0x08f1('0x66')]=_0x2948d4['id'];return db[_0x08f1('0x6d')]['create'](_0x2aaa8b['body']);}})[_0x08f1('0x20')](respondWithResult(_0x2c728c,null))[_0x08f1('0x56')](handleError(_0x2c728c,null));};exports[_0x08f1('0x6e')]=function(_0x90ac54,_0x19f4d6,_0x53030){var _0x4bc217={'raw':![],'where':{}};var _0x326671={};var _0x597770={'count':0x0,'rows':[]};return db['FaxAccount'][_0x08f1('0x6f')]({'where':{'id':_0x90ac54['params']['id']}})[_0x08f1('0x20')](handleEntityNotFound(_0x19f4d6,null))[_0x08f1('0x20')](function(_0x3b7445){if(_0x3b7445){_0x326671[_0x08f1('0x44')]=_['keys'](db['CannedAnswer'][_0x08f1('0x59')]);_0x326671[_0x08f1('0x47')]=_[_0x08f1('0x46')](_0x90ac54[_0x08f1('0x47')]);_0x326671[_0x08f1('0x48')]=_[_0x08f1('0x5a')](_0x326671[_0x08f1('0x44')],_0x326671[_0x08f1('0x47')]);_0x4bc217['attributes']=_['intersection'](_0x326671['model'],qs[_0x08f1('0x4a')](_0x90ac54[_0x08f1('0x47')][_0x08f1('0x4a')]));_0x4bc217['attributes']=_0x4bc217[_0x08f1('0x49')][_0x08f1('0x4b')]?_0x4bc217[_0x08f1('0x49')]:_0x326671['model'];if(!_0x90ac54['query']['hasOwnProperty']('nolimit')){_0x4bc217[_0x08f1('0x30')]=qs[_0x08f1('0x30')](_0x90ac54[_0x08f1('0x47')][_0x08f1('0x30')]);_0x4bc217[_0x08f1('0x2e')]=qs['offset'](_0x90ac54[_0x08f1('0x47')][_0x08f1('0x2e')]);}_0x4bc217[_0x08f1('0x4d')]=qs['sort'](_0x90ac54['query'][_0x08f1('0x4e')]);_0x4bc217['where']=qs[_0x08f1('0x48')](_[_0x08f1('0x50')](_0x90ac54[_0x08f1('0x47')],_0x326671[_0x08f1('0x48')]));_0x4bc217['where'][_0x08f1('0x66')]=_0x3b7445['id'];if(_0x90ac54[_0x08f1('0x47')][_0x08f1('0x51')]){_0x4bc217['where']=_['merge'](_0x4bc217[_0x08f1('0x4f')],{'$or':_['map'](_0x4bc217['attributes'],function(_0x3b816e){var _0x31fdc7={};_0x31fdc7[_0x3b816e]={'$like':'%'+_0x90ac54[_0x08f1('0x47')]['filter']+'%'};return _0x31fdc7;})});}_0x4bc217=_[_0x08f1('0x52')]({},_0x4bc217,_0x90ac54[_0x08f1('0x69')]);return db[_0x08f1('0x6d')][_0x08f1('0x31')]({'where':_0x4bc217[_0x08f1('0x4f')]})[_0x08f1('0x20')](function(_0x21b0e8){_0x597770[_0x08f1('0x31')]=_0x21b0e8;if(_0x90ac54['query'][_0x08f1('0x53')]){_0x4bc217['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x08f1('0x55')](_0x4bc217);})[_0x08f1('0x20')](function(_0xe10b12){_0x597770[_0x08f1('0x6a')]=_0xe10b12;return _0x597770;});}})[_0x08f1('0x20')](respondWithFilteredResult(_0x19f4d6,_0x4bc217))[_0x08f1('0x56')](handleError(_0x19f4d6,null));};exports['removeAnswers']=function(_0x47bc12,_0x4a5cdd,_0x11c09f){return db['FaxAccount']['find']({'where':{'id':_0x47bc12[_0x08f1('0x58')]['id']}})['then'](handleEntityNotFound(_0x4a5cdd,null))[_0x08f1('0x20')](function(_0x38b457){if(_0x38b457){return _0x38b457['removeAnswers'](_0x47bc12['query'][_0x08f1('0x6c')]);}})[_0x08f1('0x20')](respondWithStatusCode(_0x4a5cdd,null))[_0x08f1('0x56')](handleError(_0x4a5cdd,null));};exports[_0x08f1('0x70')]=function(_0x263178,_0x55d72c,_0x433c71){return db['FaxInteraction'][_0x08f1('0x5b')]({'where':{'id':_0x263178[_0x08f1('0x58')]['id']}})[_0x08f1('0x20')](handleEntityNotFound(_0x55d72c,null))[_0x08f1('0x20')](function(_0x1e95cc){if(_0x1e95cc){return _0x1e95cc['addInteraction'](_0x263178['body'][_0x08f1('0x6c')],_[_0x08f1('0x71')](_0x263178['body'],['ids','id'])||{});}})[_0x08f1('0x20')](respondWithResult(_0x55d72c,null))[_0x08f1('0x56')](handleError(_0x55d72c,null));};exports[_0x08f1('0x72')]=function(_0x3e89a1,_0x30af16,_0xb89f32){var _0xb47b6d={'raw':![],'where':{}};var _0x31dfcc={};var _0x1e4c79={'count':0x0,'rows':[]};return db['FaxAccount'][_0x08f1('0x6f')]({'where':{'id':_0x3e89a1['params']['id']}})['then'](handleEntityNotFound(_0x30af16,null))['then'](function(_0x5809a9){if(_0x5809a9){_0x31dfcc[_0x08f1('0x44')]=_[_0x08f1('0x46')](db[_0x08f1('0x73')][_0x08f1('0x59')]);_0x31dfcc['query']=_['keys'](_0x3e89a1[_0x08f1('0x47')]);_0x31dfcc[_0x08f1('0x48')]=_['intersection'](_0x31dfcc['model'],_0x31dfcc[_0x08f1('0x47')]);_0xb47b6d[_0x08f1('0x49')]=_[_0x08f1('0x5a')](_0x31dfcc[_0x08f1('0x44')],qs['fields'](_0x3e89a1[_0x08f1('0x47')]['fields']));_0xb47b6d[_0x08f1('0x49')]=_0xb47b6d[_0x08f1('0x49')][_0x08f1('0x4b')]?_0xb47b6d[_0x08f1('0x49')]:_0x31dfcc['model'];if(!_0x3e89a1[_0x08f1('0x47')][_0x08f1('0x4c')](_0x08f1('0x68'))){_0xb47b6d[_0x08f1('0x30')]=qs[_0x08f1('0x30')](_0x3e89a1['query'][_0x08f1('0x30')]);_0xb47b6d['offset']=qs[_0x08f1('0x2e')](_0x3e89a1[_0x08f1('0x47')][_0x08f1('0x2e')]);}_0xb47b6d[_0x08f1('0x4d')]=qs[_0x08f1('0x4e')](_0x3e89a1[_0x08f1('0x47')][_0x08f1('0x4e')]);_0xb47b6d[_0x08f1('0x4f')]=qs[_0x08f1('0x48')](_['pick'](_0x3e89a1['query'],_0x31dfcc[_0x08f1('0x48')]));_0xb47b6d['where'][_0x08f1('0x66')]=_0x5809a9['id'];if(_0x3e89a1['query']['filter']){_0xb47b6d[_0x08f1('0x4f')]=_[_0x08f1('0x52')](_0xb47b6d['where'],{'$or':_['map'](_0xb47b6d[_0x08f1('0x49')],function(_0x4cb042){var _0x2587ea={};_0x2587ea[_0x4cb042]={'$like':'%'+_0x3e89a1[_0x08f1('0x47')]['filter']+'%'};return _0x2587ea;})});}_0xb47b6d=_[_0x08f1('0x52')]({},_0xb47b6d,_0x3e89a1[_0x08f1('0x69')]);return db['FaxInteraction'][_0x08f1('0x31')]({'where':_0xb47b6d['where']})['then'](function(_0x58d50b){_0x1e4c79[_0x08f1('0x31')]=_0x58d50b;if(_0x3e89a1[_0x08f1('0x47')][_0x08f1('0x53')]){_0xb47b6d[_0x08f1('0x54')]=[{'model':db[_0x08f1('0x74')],'as':_0x08f1('0x75'),'required':![]},{'model':db[_0x08f1('0x76')],'as':'Owner','attributes':[_0x08f1('0x3c'),_0x08f1('0x77'),'internal'],'required':![]},{'model':db[_0x08f1('0x78')],'as':_0x08f1('0x79'),'attributes':['id',_0x08f1('0x3c'),_0x08f1('0x7a')],'where':_0x3e89a1[_0x08f1('0x47')][_0x08f1('0x7b')]?{'id':_0x3e89a1[_0x08f1('0x47')][_0x08f1('0x7b')]}:undefined,'required':_0x3e89a1[_0x08f1('0x47')][_0x08f1('0x7b')]?!![]:![]}];}return db['FaxInteraction'][_0x08f1('0x55')](_0xb47b6d);})[_0x08f1('0x20')](function(_0x4932c8){_0x1e4c79['rows']=_0x4932c8;return _0x1e4c79;});}})['then'](respondWithFilteredResult(_0x30af16,_0xb47b6d))['catch'](handleError(_0x30af16,null));};exports[_0x08f1('0x7c')]=function(_0x11028a,_0x1ad6b5){var _0x45918c=_0x11028a[_0x08f1('0x58')]['id'];var _0x545971=_0x11028a[_0x08f1('0x5d')];var _0x41e012=0xc8;var _0x10d4b5=null;return db[_0x08f1('0x7d')][_0x08f1('0x7e')]({'isolationLevel':db[_0x08f1('0x7d')][_0x08f1('0x7f')][_0x08f1('0x80')][_0x08f1('0x81')]},function(_0x5c576e){return db['FaxAccount']['findOne']({'where':{'id':_0x45918c},'transaction':_0x5c576e})[_0x08f1('0x20')](function(_0xbc218c){if(_0xbc218c){return db['FaxApplication'][_0x08f1('0x82')]({'where':{'FaxAccountId':_0x45918c},'transaction':_0x5c576e})[_0x08f1('0x20')](function(){var _0x115409=_['map'](_0x545971,function(_0x31386e){_0x31386e['FaxAccountId']=_0x45918c;return _0x31386e;});return db[_0x08f1('0x83')][_0x08f1('0x84')](_0x115409,{'transaction':_0x5c576e});});}else{_0x41e012=0x194;_0x10d4b5=[];}});})['then'](function(){if(_0x41e012!==0x194){return db[_0x08f1('0x83')][_0x08f1('0x85')]({'where':{'FaxAccountId':_0x45918c},'order':_0x08f1('0x86')})[_0x08f1('0x20')](function(_0x4b7f78){_0x10d4b5=_0x4b7f78;});}})[_0x08f1('0x56')](function(_0x21f238){_0x41e012=0x1f4;logger['error'](_0x21f238[_0x08f1('0x3b')]);if(_0x21f238[_0x08f1('0x3c')]){delete _0x21f238[_0x08f1('0x3c')];}_0x10d4b5=_0x21f238;})['finally'](function(){if(_0x10d4b5===null){_0x1ad6b5[_0x08f1('0x3a')](_0x41e012);}else{if(_0x41e012===0x1f4){_0x1ad6b5[_0x08f1('0x2b')](_0x41e012)[_0x08f1('0x87')](_0x10d4b5);}else{_0x1ad6b5[_0x08f1('0x2b')](_0x41e012)['json'](_0x10d4b5);}}});};exports['getApplications']=function(_0x1ccd42,_0x261592,_0x4bb0a1){var _0xfde911={};var _0x32dbb8={};var _0x5095a6;var _0x37fae3;return db['FaxAccount'][_0x08f1('0x6f')]({'where':{'id':_0x1ccd42[_0x08f1('0x58')]['id']}})[_0x08f1('0x20')](handleEntityNotFound(_0x261592,null))[_0x08f1('0x20')](function(_0x1ba4a8){if(_0x1ba4a8){_0x5095a6=_0x1ba4a8;_0x32dbb8[_0x08f1('0x44')]=_[_0x08f1('0x46')](db[_0x08f1('0x83')][_0x08f1('0x59')]);_0x32dbb8[_0x08f1('0x47')]=_[_0x08f1('0x46')](_0x1ccd42[_0x08f1('0x47')]);_0x32dbb8[_0x08f1('0x48')]=_[_0x08f1('0x5a')](_0x32dbb8[_0x08f1('0x44')],_0x32dbb8['query']);_0xfde911[_0x08f1('0x49')]=_[_0x08f1('0x5a')](_0x32dbb8[_0x08f1('0x44')],qs[_0x08f1('0x4a')](_0x1ccd42[_0x08f1('0x47')][_0x08f1('0x4a')]));_0xfde911[_0x08f1('0x49')]=_0xfde911[_0x08f1('0x49')][_0x08f1('0x4b')]?_0xfde911['attributes']:_0x32dbb8[_0x08f1('0x44')];_0xfde911[_0x08f1('0x4d')]=qs[_0x08f1('0x4e')](_0x1ccd42['query'][_0x08f1('0x4e')]);_0xfde911[_0x08f1('0x4f')]=qs[_0x08f1('0x48')](_[_0x08f1('0x50')](_0x1ccd42['query'],_0x32dbb8[_0x08f1('0x48')]));if(_0x1ccd42[_0x08f1('0x47')]['filter']){_0xfde911['where']=_['merge'](_0xfde911[_0x08f1('0x4f')],{'$or':_[_0x08f1('0x45')](_0xfde911[_0x08f1('0x49')],function(_0x971f0f){var _0x368218={};_0x368218[_0x971f0f]={'$like':'%'+_0x1ccd42[_0x08f1('0x47')]['filter']+'%'};return _0x368218;})});}_0xfde911=_[_0x08f1('0x52')]({},_0xfde911,_0x1ccd42[_0x08f1('0x69')]);return _0x5095a6[_0x08f1('0x88')](_0xfde911);}})[_0x08f1('0x20')](function(_0xf0967){if(_0xf0967){_0x37fae3=_0xf0967['length'];if(!_0x1ccd42[_0x08f1('0x47')]['hasOwnProperty'](_0x08f1('0x68'))){_0xfde911[_0x08f1('0x30')]=qs[_0x08f1('0x30')](_0x1ccd42['query'][_0x08f1('0x30')]);_0xfde911[_0x08f1('0x2e')]=qs[_0x08f1('0x2e')](_0x1ccd42[_0x08f1('0x47')][_0x08f1('0x2e')]);}return _0x5095a6[_0x08f1('0x88')](_0xfde911);}})[_0x08f1('0x20')](function(_0x3eb451){if(_0x3eb451){return _0x3eb451?{'count':_0x37fae3,'rows':_0x3eb451}:null;}})[_0x08f1('0x20')](respondWithResult(_0x261592,null))[_0x08f1('0x56')](handleError(_0x261592,null));};function Extension(_0x3caefd,_0x1221a3,_0x34118c,_0x2b3022){this[_0x08f1('0x89')]=_0x08f1('0x8a');this['exten']=_0x3caefd[_0x08f1('0x8b')];this[_0x08f1('0x8c')]=_0x2b3022;this[_0x08f1('0x42')]='system';this[_0x08f1('0x8d')]=_0x08f1('0x8e');this[_0x08f1('0x66')]=_0x3caefd['id'];this[_0x08f1('0x86')]=_0x1221a3;this[_0x08f1('0x8f')]=_0x34118c;}function createExtensionsReciveFax(_0x4b4e6d){var _0x2665ca=0x1;var _0x4fca3f=[];_0x4fca3f[_0x08f1('0x90')](new Extension(_0x4b4e6d,_0x2665ca,'',_0x08f1('0x91')));_0x2665ca+=0x1;_0x4fca3f[_0x08f1('0x90')](new Extension(_0x4b4e6d,_0x2665ca,'CDR(type)=inbound-fax','Set'));_0x2665ca+=0x1;for(var _0x56181d in _0x4b4e6d){if(_0x4b4e6d[_0x08f1('0x4c')](_0x56181d)&&(_0x56181d==='ecm'||_0x56181d==='localstationid'||_0x56181d===_0x08f1('0x92')||_0x56181d===_0x08f1('0x93')||_0x56181d==='headerinfo'||_0x56181d===_0x08f1('0x94')||_0x56181d===_0x08f1('0x95')||_0x56181d===_0x08f1('0x96')||_0x56181d===_0x08f1('0x97'))){_0x4fca3f['push'](new Extension(_0x4b4e6d,_0x2665ca,_0x08f1('0x98')+_0x56181d+')='+_0x4b4e6d[_0x56181d],_0x08f1('0x99')));_0x2665ca+=0x1;}}_0x4fca3f[_0x08f1('0x90')](new Extension(_0x4b4e6d,_0x2665ca,'6',_0x08f1('0x9a')));_0x2665ca+=0x1;_0x4fca3f['push'](new Extension(_0x4b4e6d,_0x2665ca,_0x08f1('0x9b'),_0x08f1('0x9c')));_0x2665ca=0x0;return _0x4fca3f;}exports['addAccountApplications']=function(_0x7d6311,_0x5d8471,_0x3f86d4){var _0x37a4b0;return db[_0x08f1('0x7d')][_0x08f1('0x7e')](function(_0x790f27){return db[_0x08f1('0x40')][_0x08f1('0x5c')](_0x7d6311[_0x08f1('0x5d')],{'transaction':_0x790f27})[_0x08f1('0x20')](function(_0xba5ee2){_0x37a4b0=_0xba5ee2[_0x08f1('0x37')]({'plain':!![]});return db['VoiceExtension'][_0x08f1('0x84')](createExtensionsReciveFax(_0x37a4b0),{'transaction':_0x790f27});});})['then'](function(){return _0x37a4b0;})[_0x08f1('0x20')](respondWithResult(_0x5d8471,null))[_0x08f1('0x56')](handleError(_0x5d8471,null));};exports[_0x08f1('0x9d')]=function(_0x9a7470,_0x115822,_0x2a6d94){var _0x3624ab;return db[_0x08f1('0x7d')]['transaction'](function(_0x29952c){return db[_0x08f1('0x40')][_0x08f1('0x36')](_0x9a7470[_0x08f1('0x5d')],{'where':{'id':_0x9a7470[_0x08f1('0x5d')]['id']},'transaction':_0x29952c})['then'](function(_0x27f223){return db['VoiceExtension'][_0x08f1('0x82')]({'where':{'FaxAccountId':_0x9a7470[_0x08f1('0x5d')]['id']},'transaction':_0x29952c})[_0x08f1('0x20')](function(_0x5811a7){return db[_0x08f1('0x9e')][_0x08f1('0x84')](createExtensionsReciveFax(_[_0x08f1('0x71')](_0x9a7470[_0x08f1('0x5d')],[_0x08f1('0x9f'),_0x08f1('0x43'),'createdAt',_0x08f1('0xa0'),'TrunkId',_0x08f1('0xa1')])),{'transaction':_0x29952c});});});})[_0x08f1('0x20')](function(){return db['FaxAccount'][_0x08f1('0xa2')](_0x9a7470['body']['id']);})[_0x08f1('0x20')](respondWithResult(_0x115822,null))['catch'](handleError(_0x115822,null));};exports[_0x08f1('0xa3')]=function(_0x491b72,_0x314fda,_0x2dedd3){var _0x40aff4={'raw':!![],'where':{}};var _0x41520c={};var _0x955ecb={'count':0x0,'rows':[]};return db[_0x08f1('0x40')][_0x08f1('0x6f')]({'where':{'id':_0x491b72[_0x08f1('0x58')]['id']}})[_0x08f1('0x20')](handleEntityNotFound(_0x314fda,null))[_0x08f1('0x20')](function(_0x24aec1){if(_0x24aec1){_0x41520c['model']=_['keys'](db[_0x08f1('0xa4')][_0x08f1('0x59')]);_0x41520c[_0x08f1('0x47')]=_[_0x08f1('0x46')](_0x491b72[_0x08f1('0x47')]);_0x41520c[_0x08f1('0x48')]=_['intersection'](_0x41520c[_0x08f1('0x44')],_0x41520c[_0x08f1('0x47')]);_0x40aff4[_0x08f1('0x49')]=_[_0x08f1('0x5a')](_0x41520c[_0x08f1('0x44')],qs[_0x08f1('0x4a')](_0x491b72[_0x08f1('0x47')][_0x08f1('0x4a')]));_0x40aff4[_0x08f1('0x49')]=_0x40aff4['attributes'][_0x08f1('0x4b')]?_0x40aff4[_0x08f1('0x49')]:_0x41520c[_0x08f1('0x44')];if(!_0x491b72['query'][_0x08f1('0x4c')](_0x08f1('0x68'))){_0x40aff4[_0x08f1('0x30')]=qs[_0x08f1('0x30')](_0x491b72['query'][_0x08f1('0x30')]);_0x40aff4[_0x08f1('0x2e')]=qs[_0x08f1('0x2e')](_0x491b72[_0x08f1('0x47')][_0x08f1('0x2e')]);}_0x40aff4[_0x08f1('0x4d')]=qs[_0x08f1('0x4e')](_0x491b72['query'][_0x08f1('0x4e')]);_0x40aff4[_0x08f1('0x4f')]=qs[_0x08f1('0x48')](_[_0x08f1('0x50')](_0x491b72[_0x08f1('0x47')],_0x41520c[_0x08f1('0x48')]));_0x40aff4['where']['FaxAccountId']=_0x24aec1['id'];if(_0x491b72['query']['filter']){_0x40aff4[_0x08f1('0x4f')]=_[_0x08f1('0x52')](_0x40aff4[_0x08f1('0x4f')],{'$or':_[_0x08f1('0x45')](_0x40aff4[_0x08f1('0x49')],function(_0x3c1b1f){var _0x15c177={};_0x15c177[_0x3c1b1f]={'$like':'%'+_0x491b72[_0x08f1('0x47')][_0x08f1('0x51')]+'%'};return _0x15c177;})});}if(_0x491b72[_0x08f1('0x47')]['$gte']){var _0x3b665c=_0x491b72[_0x08f1('0x47')][_0x08f1('0xa5')][_0x08f1('0xa6')](',');var _0x2c25df={};_0x2c25df[_0x3b665c[0x0]]={'$gte':moment(_0x3b665c[0x1])[_0x08f1('0xa7')](_0x08f1('0xa8'))};_0x40aff4[_0x08f1('0x4f')]=_[_0x08f1('0x52')](_0x40aff4['where'],_0x2c25df);}_0x40aff4=_[_0x08f1('0x52')]({},_0x40aff4,_0x491b72['options']);return db[_0x08f1('0xa4')][_0x08f1('0x31')]({'where':_0x40aff4[_0x08f1('0x4f')]})[_0x08f1('0x20')](function(_0x16793b){_0x955ecb['count']=_0x16793b;if(_0x491b72[_0x08f1('0x47')]['includeAll']){_0x40aff4[_0x08f1('0x54')]=[{'all':!![]}];}return db[_0x08f1('0xa4')][_0x08f1('0x55')](_0x40aff4);})['then'](function(_0x5d6f16){_0x955ecb[_0x08f1('0x6a')]=_0x5d6f16;return _0x955ecb;});}})[_0x08f1('0x20')](respondWithFilteredResult(_0x314fda,_0x40aff4))[_0x08f1('0x56')](handleError(_0x314fda,null));};exports['send']=function(_0x29b340,_0x2cd3e2,_0x56f2fc){var _0x51d6fc,_0x45ab15={},_0x1c4378;if(_0x29b340[_0x08f1('0x5d')]['to']){_0x1c4378=_0x29b340['body']['to'][0x0];}return db['FaxAccount'][_0x08f1('0x5b')]({'where':{'id':_0x29b340['params']['id']},'include':[{'model':db['CmList'],'as':_0x08f1('0xa9'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x1c4378},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x08f1('0x20')](handleEntityNotFound(_0x2cd3e2,null))[_0x08f1('0x20')](function(_0x406c82){_0x51d6fc=_0x406c82;if(_0x29b340[_0x08f1('0x5d')]['attachments']&&_0x29b340[_0x08f1('0x5d')]['attachments'][_0x08f1('0x4b')]){for(var _0x5718cc=0x0;_0x5718cc<_0x29b340['body'][_0x08f1('0xaa')]['length'];_0x5718cc+=0x1){_0x29b340[_0x08f1('0x5d')][_0x08f1('0xaa')][_0x5718cc]={'filename':_0x29b340[_0x08f1('0x5d')]['attachments'][_0x5718cc]['name'],'id':_0x29b340[_0x08f1('0x5d')]['attachments'][_0x5718cc]['id'],'path':path[_0x08f1('0xab')](config[_0x08f1('0xac')],_0x08f1('0xad'),_0x29b340[_0x08f1('0x5d')][_0x08f1('0xaa')][_0x5718cc][_0x08f1('0xae')])};}}return respondWithRpcPromise(_0x08f1('0xaf'),_0x08f1('0xaf'),{'FaxAccountId':_[_0x08f1('0xb0')](_0x29b340[_0x08f1('0x58')]['id'])?undefined:_0x29b340[_0x08f1('0x58')]['id'],'path':_[_0x08f1('0xb0')](_0x29b340[_0x08f1('0x5d')][_0x08f1('0xaa')][0x0][_0x08f1('0x7')])?undefined:_0x29b340[_0x08f1('0x5d')][_0x08f1('0xaa')][0x0][_0x08f1('0x7')],'fax':_[_0x08f1('0xb0')](_0x29b340['body']['to'][0x0])?undefined:_0x29b340[_0x08f1('0x5d')]['to'][0x0]},client9002);})[_0x08f1('0x20')](function(){if(_0x51d6fc){if(_[_0x08f1('0xb0')](_0x29b340['body'][_0x08f1('0xb1')])){_0x29b340[_0x08f1('0x5d')][_0x08f1('0xb1')]=util[_0x08f1('0xa7')](_0x08f1('0xb2'),_0x51d6fc[_0x08f1('0x3c')],_0x51d6fc[_0x08f1('0xb3')]);}if(_0x51d6fc[_0x08f1('0xa9')]){if(_0x51d6fc['List'][_0x08f1('0xb4')][_0x08f1('0x4b')]){return _0x51d6fc[_0x08f1('0xa9')][_0x08f1('0xb4')][0x0];}else{return db[_0x08f1('0x74')]['create'](_[_0x08f1('0x1b')](_0x29b340[_0x08f1('0x5d')],{'firstName':_0x29b340['body']['to'][0x0],'phone':_0x29b340[_0x08f1('0x5d')]['to'][0x0],'fax':_0x29b340[_0x08f1('0x5d')]['to'][0x0],'ListId':_0x51d6fc[_0x08f1('0xa1')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x08f1('0xb5'));}})[_0x08f1('0x20')](function(_0x7413b7){if(_0x7413b7){return db['FaxInteraction'][_0x08f1('0x5b')]({'where':{'ContactId':_0x7413b7['id'],'closed':![],'FaxAccountId':_0x51d6fc['id']}})[_0x08f1('0x20')](function(_0xf40376){if(_0xf40376){return[_0xf40376,![]];}return db[_0x08f1('0x73')][_0x08f1('0x5c')]({'UserId':_0x29b340[_0x08f1('0x60')]['id'],'ContactId':_0x7413b7['id'],'FaxAccountId':_0x51d6fc['id'],'fax':_0x29b340['body']['to'][0x0],'firstMsgDirection':_0x08f1('0xb6'),'Messages':[_[_0x08f1('0x52')](_0x29b340[_0x08f1('0x5d')],{'read':![],'body':_0x29b340[_0x08f1('0x5d')][_0x08f1('0xaa')][0x0][_0x08f1('0xb7')],'FaxAccountId':_0x51d6fc['id'],'UserId':_0x29b340['user']['id'],'ContactId':_0x7413b7['id'],'AttachmentId':_0x29b340[_0x08f1('0x5d')][_0x08f1('0xaa')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0x08f1('0xb8')}]})[_0x08f1('0x20')](function(_0x272cee){return[_0x272cee,!![]];});});}else{throw new Error(_0x08f1('0xb9'));}})[_0x08f1('0xba')](function(_0x39c12c,_0x170ec4){if(_0x170ec4){return _0x39c12c;}return db['FaxMessage'][_0x08f1('0x5c')]({'direction':'out','read':![],'body':_0x29b340['body'][_0x08f1('0xaa')][0x0][_0x08f1('0xb7')],'FaxAccountId':_0x51d6fc['id'],'FaxInteractionId':_0x39c12c['id'],'UserId':_0x29b340[_0x08f1('0x60')]['id'],'ContactId':_0x39c12c[_0x08f1('0xbb')],'AttachmentId':_0x29b340[_0x08f1('0x5d')]['attachments'][0x0]['id']})['then'](function(_0x1d9029){_0x39c12c[_0x08f1('0xbc')][_0x08f1('0xb8')]=[];_0x39c12c[_0x08f1('0xbc')][_0x08f1('0xb8')]['push'](_0x1d9029[_0x08f1('0xbc')]);return _0x39c12c;});})[_0x08f1('0x20')](function(_0x382cee){respondWithRpcPromise(_0x08f1('0xbd'),_0x08f1('0xbd'),{'FaxAccountId':_[_0x08f1('0xb0')](_0x29b340[_0x08f1('0x58')]['id'])?undefined:_0x29b340[_0x08f1('0x58')]['id'],'path':_[_0x08f1('0xb0')](_0x29b340['body'][_0x08f1('0xaa')][0x0][_0x08f1('0x7')])?undefined:_0x29b340['body'][_0x08f1('0xaa')][0x0][_0x08f1('0x7')],'fax':_['isNil'](_0x29b340[_0x08f1('0x5d')]['to'][0x0])?undefined:_0x29b340[_0x08f1('0x5d')]['to'][0x0],'AttachmentId':_0x29b340[_0x08f1('0x5d')][_0x08f1('0xaa')][0x0]['id']},client9002)['then'](function(_0x1045d1){logger[_0x08f1('0x21')](_0x08f1('0xbe'),_0x1045d1);})[_0x08f1('0x56')](function(_0x5e8ae3){logger[_0x08f1('0x21')](_0x08f1('0xbe'),_0x5e8ae3);});return _0x382cee;})[_0x08f1('0x20')](respondWithResult(_0x2cd3e2,null))[_0x08f1('0x56')](handleError(_0x2cd3e2,null));};exports['addAgents']=function(_0x4b5083,_0x3ba396,_0x561296){return db[_0x08f1('0x40')][_0x08f1('0x5b')]({'where':{'id':_0x4b5083['params']['id']}})[_0x08f1('0x20')](handleEntityNotFound(_0x3ba396,null))[_0x08f1('0x20')](function(_0x150419){if(_0x150419){return _0x150419[_0x08f1('0xbf')](_0x4b5083[_0x08f1('0x5d')][_0x08f1('0x6c')],_[_0x08f1('0x71')](_0x4b5083[_0x08f1('0x5d')],[_0x08f1('0x6c'),'id'])||{})[_0x08f1('0xba')](function(_0x125b3b){for(var _0x54f977=0x0;_0x54f977<_0x4b5083['body'][_0x08f1('0x6c')][_0x08f1('0x4b')];_0x54f977+=0x1){socket[_0x08f1('0xc0')]('userFaxAccount:save',{'UserId':Number(_0x4b5083[_0x08f1('0x5d')][_0x08f1('0x6c')][_0x54f977]),'FaxAccountId':Number(_0x4b5083[_0x08f1('0x58')]['id'])});}return _0x125b3b;});}})['then'](respondWithResult(_0x3ba396,null))[_0x08f1('0x56')](handleError(_0x3ba396,null));};exports[_0x08f1('0xc1')]=function(_0x47c7c9,_0x36e53c,_0xe40bde){return db[_0x08f1('0x40')][_0x08f1('0x5b')]({'where':{'id':_0x47c7c9[_0x08f1('0x58')]['id']}})[_0x08f1('0x20')](handleEntityNotFound(_0x36e53c,null))['then'](function(_0x4b056f){if(_0x4b056f){return _0x4b056f[_0x08f1('0xc1')](_0x47c7c9[_0x08f1('0x47')]['ids'])[_0x08f1('0x20')](function(){if(_['isArray'](_0x47c7c9[_0x08f1('0x47')][_0x08f1('0x6c')])){for(var _0x515840=0x0;_0x515840<_0x47c7c9[_0x08f1('0x47')][_0x08f1('0x6c')][_0x08f1('0x4b')];_0x515840+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x47c7c9[_0x08f1('0x47')][_0x08f1('0x6c')][_0x515840]),'FaxAccountId':Number(_0x47c7c9['params']['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x47c7c9[_0x08f1('0x47')][_0x08f1('0x6c')]),'FaxAccountId':Number(_0x47c7c9[_0x08f1('0x58')]['id'])});}});}})[_0x08f1('0x20')](respondWithStatusCode(_0x36e53c,null))[_0x08f1('0x56')](handleError(_0x36e53c,null));};exports['getAgents']=function(_0xe4e13a,_0x9970dc,_0x30846d){var _0x3128f0={};var _0x550f6c={};var _0x3cba68;var _0xb5755;return db[_0x08f1('0x40')][_0x08f1('0x6f')]({'where':{'id':_0xe4e13a[_0x08f1('0x58')]['id']}})[_0x08f1('0x20')](handleEntityNotFound(_0x9970dc,null))[_0x08f1('0x20')](function(_0x13cca3){if(_0x13cca3){_0x3cba68=_0x13cca3;_0x550f6c[_0x08f1('0x44')]=_['keys'](db[_0x08f1('0x76')][_0x08f1('0x59')]);_0x550f6c['query']=_[_0x08f1('0x46')](_0xe4e13a[_0x08f1('0x47')]);_0x550f6c[_0x08f1('0x48')]=_[_0x08f1('0x5a')](_0x550f6c[_0x08f1('0x44')],_0x550f6c[_0x08f1('0x47')]);_0x3128f0[_0x08f1('0x49')]=_['intersection'](_0x550f6c['model'],qs[_0x08f1('0x4a')](_0xe4e13a[_0x08f1('0x47')][_0x08f1('0x4a')]));_0x3128f0[_0x08f1('0x49')]=_0x3128f0[_0x08f1('0x49')][_0x08f1('0x4b')]?_0x3128f0['attributes']:_0x550f6c[_0x08f1('0x44')];_0x3128f0['order']=qs[_0x08f1('0x4e')](_0xe4e13a[_0x08f1('0x47')][_0x08f1('0x4e')]);_0x3128f0[_0x08f1('0x4f')]=qs[_0x08f1('0x48')](_[_0x08f1('0x50')](_0xe4e13a[_0x08f1('0x47')],_0x550f6c[_0x08f1('0x48')]));if(_0xe4e13a['query'][_0x08f1('0x51')]){_0x3128f0[_0x08f1('0x4f')]=_['merge'](_0x3128f0[_0x08f1('0x4f')],{'$or':_[_0x08f1('0x45')](_0x3128f0['attributes'],function(_0xb2ea8b){var _0x59d11f={};_0x59d11f[_0xb2ea8b]={'$like':'%'+_0xe4e13a[_0x08f1('0x47')][_0x08f1('0x51')]+'%'};return _0x59d11f;})});}_0x3128f0=_[_0x08f1('0x52')]({},_0x3128f0,_0xe4e13a[_0x08f1('0x69')]);return _0x3cba68[_0x08f1('0xc2')](_0x3128f0);}})[_0x08f1('0x20')](function(_0x419861){if(_0x419861){_0xb5755=_0x419861['length'];if(!_0xe4e13a[_0x08f1('0x47')][_0x08f1('0x4c')](_0x08f1('0x68'))){_0x3128f0[_0x08f1('0x30')]=qs[_0x08f1('0x30')](_0xe4e13a[_0x08f1('0x47')][_0x08f1('0x30')]);_0x3128f0[_0x08f1('0x2e')]=qs['offset'](_0xe4e13a[_0x08f1('0x47')]['offset']);}return _0x3cba68[_0x08f1('0xc2')](_0x3128f0);}})[_0x08f1('0x20')](function(_0x3262dc){if(_0x3262dc){return _0x3262dc?{'count':_0xb5755,'rows':_0x3262dc}:null;}})[_0x08f1('0x20')](respondWithResult(_0x9970dc,null))['catch'](handleError(_0x9970dc,null));}; \ No newline at end of file +var _0x4759=['DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./faxAccount.socket','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','get','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filters','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','findOne','Disposition','sort','pick','FaxAccountId','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','Transaction','READ_COMMITTED','FaxApplication','priority','send','getApplications','context','exten','description','Fax\x20Extension','appdata','push','Answer','Set','ecm','localstationid','gateway','faxdetect','maxrate','modem','t38timeout','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','transaction','bulkCreate','updateAccountApplications','VoiceExtension','tech','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','CmContact','Contacts'];(function(_0x319090,_0x3dcba5){var _0x797fb4=function(_0xdfb7ee){while(--_0xdfb7ee){_0x319090['push'](_0x319090['shift']());}};_0x797fb4(++_0x3dcba5);}(_0x4759,0xe8));var _0x9475=function(_0x5534fe,_0x43c22e){_0x5534fe=_0x5534fe-0x0;var _0x3d1dc2=_0x4759[_0x5534fe];return _0x3d1dc2;};'use strict';var emlformat=require(_0x9475('0x0'));var rimraf=require(_0x9475('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9475('0x2'));var rp=require(_0x9475('0x3'));var moment=require(_0x9475('0x4'));var BPromise=require(_0x9475('0x5'));var Mustache=require(_0x9475('0x6'));var util=require(_0x9475('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9475('0x8'));var ejs=require(_0x9475('0x9'));var fs=require('fs');var fs_extra=require(_0x9475('0xa'));var _=require(_0x9475('0xb'));var squel=require('squel');var crypto=require(_0x9475('0xc'));var jsforce=require(_0x9475('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9475('0x8'));var querystring=require(_0x9475('0xe'));var Papa=require(_0x9475('0xf'));var Redis=require(_0x9475('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9475('0x11'));var logger=require(_0x9475('0x12'))('api');var utils=require(_0x9475('0x13'));var config=require(_0x9475('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9475('0x15'))['db'];config['redis']=_[_0x9475('0x16')](config[_0x9475('0x17')],{'host':_0x9475('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9475('0x19'))[_0x9475('0x1a')](socket);var jayson=require(_0x9475('0x1b'));var client=jayson[_0x9475('0x1c')][_0x9475('0x1d')]({'port':0x232c});var client9002=jayson[_0x9475('0x1c')][_0x9475('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4ee041,_0x8e9afc,_0x3fa2ee,_0x48e995){return new BPromise(function(_0x5d432c,_0x407db8){var _0x15a499=_0x48e995||client;return _0x15a499[_0x9475('0x1e')](_0x4ee041,_0x3fa2ee)['then'](function(_0x3a29f4){logger[_0x9475('0x1f')](_0x9475('0x20'),_0x8e9afc,_0x9475('0x21'));logger[_0x9475('0x22')](_0x9475('0x23'),_0x8e9afc,'request\x20sent',JSON[_0x9475('0x24')](_0x3a29f4));if(_0x3a29f4[_0x9475('0x25')]){if(_0x3a29f4[_0x9475('0x25')][_0x9475('0x26')]===0x1f4){logger[_0x9475('0x25')]('FaxAccount,\x20%s,\x20%s',_0x8e9afc,_0x3a29f4['error'][_0x9475('0x27')]);return _0x407db8(_0x3a29f4[_0x9475('0x25')][_0x9475('0x27')]);}logger[_0x9475('0x25')](_0x9475('0x20'),_0x8e9afc,_0x3a29f4['error'][_0x9475('0x27')]);return _0x5d432c(_0x3a29f4['error'][_0x9475('0x27')]);}else{logger['info'](_0x9475('0x20'),_0x8e9afc,_0x9475('0x21'));_0x5d432c(_0x3a29f4[_0x9475('0x28')][_0x9475('0x27')]);}})[_0x9475('0x29')](function(_0xaa197f){logger['error']('FaxAccount,\x20%s,\x20%s',_0x8e9afc,_0xaa197f);_0x407db8(_0xaa197f);});});}function respondWithStatusCode(_0x54a78a,_0x44e09e){_0x44e09e=_0x44e09e||0xcc;return function(_0x1d561a){if(_0x1d561a){return _0x54a78a[_0x9475('0x2a')](_0x44e09e);}return _0x54a78a[_0x9475('0x2b')](_0x44e09e)[_0x9475('0x2c')]();};}function respondWithResult(_0x5215a7,_0x4742f7){_0x4742f7=_0x4742f7||0xc8;return function(_0x5e8c9e){if(_0x5e8c9e){return _0x5215a7[_0x9475('0x2b')](_0x4742f7)[_0x9475('0x2d')](_0x5e8c9e);}};}function respondWithFilteredResult(_0x3d498c,_0x3b0d6a){return function(_0x5ab700){if(_0x5ab700){var _0x2aa141=typeof _0x3b0d6a[_0x9475('0x2e')]===_0x9475('0x2f')&&typeof _0x3b0d6a['limit']===_0x9475('0x2f');var _0x27013b=_0x5ab700[_0x9475('0x30')];var _0x4d271b=_0x2aa141?0x0:_0x3b0d6a[_0x9475('0x2e')];var _0x317708=_0x2aa141?_0x5ab700['count']:_0x3b0d6a['offset']+_0x3b0d6a[_0x9475('0x31')];var _0x3e6449;if(_0x317708>=_0x27013b){_0x317708=_0x27013b;_0x3e6449=0xc8;}else{_0x3e6449=0xce;}_0x3d498c[_0x9475('0x2b')](_0x3e6449);return _0x3d498c[_0x9475('0x32')](_0x9475('0x33'),_0x4d271b+'-'+_0x317708+'/'+_0x27013b)['json'](_0x5ab700);}return null;};}function patchUpdates(_0x1fbd25){return function(_0x366821){try{jsonpatch[_0x9475('0x34')](_0x366821,_0x1fbd25,!![]);}catch(_0xdfb9e8){return BPromise[_0x9475('0x35')](_0xdfb9e8);}return _0x366821[_0x9475('0x36')]();};}function saveUpdates(_0x206a6f,_0x2936c0){return function(_0x515c70){if(_0x515c70){return _0x515c70['update'](_0x206a6f)['then'](function(_0x290362){return _0x290362;});}return null;};}function removeEntity(_0x23e968,_0x167323){return function(_0x123bc6){if(_0x123bc6){return _0x123bc6[_0x9475('0x37')]()[_0x9475('0x38')](function(){var _0x4497f4=_0x123bc6[_0x9475('0x39')]({'plain':!![]});var _0x2f3a18='FaxAccounts';return db[_0x9475('0x3a')][_0x9475('0x37')]({'where':{'type':_0x2f3a18,'resourceId':_0x4497f4['id']}})[_0x9475('0x38')](function(){return _0x123bc6;});})['then'](function(){_0x23e968[_0x9475('0x2b')](0xcc)[_0x9475('0x2c')]();});}};}function handleEntityNotFound(_0x29fb00,_0xc5532c){return function(_0xb2d1cb){if(!_0xb2d1cb){_0x29fb00[_0x9475('0x2a')](0x194);}return _0xb2d1cb;};}function handleError(_0x1599e3,_0x685005){_0x685005=_0x685005||0x1f4;return function(_0x3158be){logger[_0x9475('0x25')](_0x3158be[_0x9475('0x3b')]);if(_0x3158be[_0x9475('0x3c')]){delete _0x3158be[_0x9475('0x3c')];}_0x1599e3[_0x9475('0x2b')](_0x685005)['send'](_0x3158be);};}exports[_0x9475('0x3d')]=function(_0xdd0a3,_0x3a7476){var _0x575519={'include':[{'model':db[_0x9475('0x3e')],'as':_0x9475('0x3f')}]},_0x4a62fe={},_0x3c0540={'count':0x0,'rows':[]};var _0x251c1b=_['map'](db[_0x9475('0x40')][_0x9475('0x41')],function(_0x4fa85d){return{'name':_0x4fa85d[_0x9475('0x42')],'type':_0x4fa85d[_0x9475('0x43')][_0x9475('0x44')]};});_0x4a62fe[_0x9475('0x45')]=_[_0x9475('0x46')](_0x251c1b,_0x9475('0x3c'));_0x4a62fe['query']=_[_0x9475('0x47')](_0xdd0a3[_0x9475('0x48')]);_0x4a62fe['filters']=_[_0x9475('0x49')](_0x4a62fe['model'],_0x4a62fe[_0x9475('0x48')]);_0x575519[_0x9475('0x4a')]=_[_0x9475('0x49')](_0x4a62fe[_0x9475('0x45')],qs[_0x9475('0x4b')](_0xdd0a3[_0x9475('0x48')][_0x9475('0x4b')]));_0x575519[_0x9475('0x4a')]=_0x575519[_0x9475('0x4a')][_0x9475('0x4c')]?_0x575519['attributes']:_0x4a62fe[_0x9475('0x45')];if(!_0xdd0a3[_0x9475('0x48')][_0x9475('0x4d')](_0x9475('0x4e'))){_0x575519[_0x9475('0x31')]=qs[_0x9475('0x31')](_0xdd0a3['query']['limit']);_0x575519[_0x9475('0x2e')]=qs[_0x9475('0x2e')](_0xdd0a3['query'][_0x9475('0x2e')]);}_0x575519[_0x9475('0x4f')]=qs['sort'](_0xdd0a3['query']['sort']);_0x575519['where']=qs[_0x9475('0x50')](_['pick'](_0xdd0a3[_0x9475('0x48')],_0x4a62fe[_0x9475('0x50')]),_0x251c1b);if(_0xdd0a3[_0x9475('0x48')][_0x9475('0x51')]){_0x575519[_0x9475('0x52')]=_[_0x9475('0x53')](_0x575519['where'],{'$or':_[_0x9475('0x46')](_0x251c1b,function(_0x25ada7){if(_0x25ada7[_0x9475('0x43')]!==_0x9475('0x54')){var _0x1bf5e5={};_0x1bf5e5[_0x25ada7[_0x9475('0x3c')]]={'$like':'%'+_0xdd0a3['query']['filter']+'%'};return _0x1bf5e5;}})});}_0x575519=_[_0x9475('0x53')]({},_0x575519,_0xdd0a3['options']);var _0x7290f7={'where':_0x575519[_0x9475('0x52')]};return db[_0x9475('0x40')]['count'](_0x7290f7)[_0x9475('0x38')](function(_0x23e9cb){_0x3c0540[_0x9475('0x30')]=_0x23e9cb;if(_0xdd0a3[_0x9475('0x48')][_0x9475('0x55')]){_0x575519[_0x9475('0x56')]=[{'all':!![]}];}return db['FaxAccount'][_0x9475('0x57')](_0x575519);})[_0x9475('0x38')](function(_0x3df671){_0x3c0540[_0x9475('0x58')]=_0x3df671;return _0x3c0540;})[_0x9475('0x38')](respondWithFilteredResult(_0x3a7476,_0x575519))[_0x9475('0x29')](handleError(_0x3a7476,null));};exports[_0x9475('0x59')]=function(_0x24503d,_0x5b4862){var _0x2de8f2={'raw':![],'where':{'id':_0x24503d[_0x9475('0x5a')]['id']},'include':[{'model':db[_0x9475('0x3e')],'as':_0x9475('0x3f')}]},_0x3891f5={};_0x3891f5[_0x9475('0x45')]=_[_0x9475('0x47')](db[_0x9475('0x40')]['rawAttributes']);_0x3891f5[_0x9475('0x48')]=_['keys'](_0x24503d[_0x9475('0x48')]);_0x3891f5['filters']=_['intersection'](_0x3891f5['model'],_0x3891f5[_0x9475('0x48')]);_0x2de8f2[_0x9475('0x4a')]=_[_0x9475('0x49')](_0x3891f5[_0x9475('0x45')],qs[_0x9475('0x4b')](_0x24503d[_0x9475('0x48')]['fields']));_0x2de8f2[_0x9475('0x4a')]=_0x2de8f2['attributes'][_0x9475('0x4c')]?_0x2de8f2['attributes']:_0x3891f5[_0x9475('0x45')];if(_0x24503d[_0x9475('0x48')][_0x9475('0x55')]){_0x2de8f2[_0x9475('0x56')]=[{'all':!![]}];}_0x2de8f2=_[_0x9475('0x53')]({},_0x2de8f2,_0x24503d[_0x9475('0x5b')]);return db[_0x9475('0x40')][_0x9475('0x5c')](_0x2de8f2)[_0x9475('0x38')](handleEntityNotFound(_0x5b4862,null))[_0x9475('0x38')](respondWithResult(_0x5b4862,null))[_0x9475('0x29')](handleError(_0x5b4862,null));};exports['create']=function(_0x31e501,_0x1e4b8d){return db[_0x9475('0x40')][_0x9475('0x5d')](_0x31e501[_0x9475('0x5e')],{})[_0x9475('0x38')](function(_0x54d07e){var _0x584248=_0x31e501[_0x9475('0x5f')]['get']({'plain':!![]});if(!_0x584248)throw new Error(_0x9475('0x60'));if(_0x584248[_0x9475('0x61')]===_0x9475('0x5f')){var _0x260c09=_0x54d07e[_0x9475('0x39')]({'plain':!![]});var _0xbf2e6a=_0x9475('0x62');return db[_0x9475('0x63')][_0x9475('0x5c')]({'where':{'name':_0xbf2e6a,'userProfileId':_0x584248[_0x9475('0x64')]},'raw':!![]})['then'](function(_0x5c3179){if(_0x5c3179&&_0x5c3179['autoAssociation']===0x0){return db['UserProfileResource'][_0x9475('0x5d')]({'name':_0x260c09[_0x9475('0x3c')],'resourceId':_0x260c09['id'],'type':_0x5c3179[_0x9475('0x3c')],'sectionId':_0x5c3179['id']},{})['then'](function(){return _0x54d07e;});}else{return _0x54d07e;}})[_0x9475('0x29')](function(_0x105358){logger[_0x9475('0x25')](_0x9475('0x65'),_0x105358);throw _0x105358;});}return _0x54d07e;})['then'](respondWithResult(_0x1e4b8d,0xc9))[_0x9475('0x29')](handleError(_0x1e4b8d,null));};exports[_0x9475('0x66')]=function(_0x327142,_0x12e32b){if(_0x327142['body']['id']){delete _0x327142[_0x9475('0x5e')]['id'];}return db['FaxAccount'][_0x9475('0x5c')]({'where':{'id':_0x327142[_0x9475('0x5a')]['id']},'include':[{'model':db[_0x9475('0x3e')],'as':_0x9475('0x3f')}]})[_0x9475('0x38')](handleEntityNotFound(_0x12e32b,null))[_0x9475('0x38')](saveUpdates(_0x327142[_0x9475('0x5e')],null))[_0x9475('0x38')](respondWithResult(_0x12e32b,null))[_0x9475('0x29')](handleError(_0x12e32b,null));};exports[_0x9475('0x37')]=function(_0x36594a,_0x24646f){return db[_0x9475('0x40')][_0x9475('0x5c')]({'where':{'id':_0x36594a[_0x9475('0x5a')]['id']}})['then'](handleEntityNotFound(_0x24646f,null))[_0x9475('0x38')](removeEntity(_0x24646f,null))[_0x9475('0x29')](handleError(_0x24646f,null));};exports[_0x9475('0x67')]=function(_0x3216e2,_0x25a4bf){return db['FaxAccount'][_0x9475('0x67')]()[_0x9475('0x38')](respondWithResult(_0x25a4bf,null))['catch'](handleError(_0x25a4bf,null));};exports[_0x9475('0x68')]=function(_0x26e9ff,_0x1c0094,_0x3eb21c){if(_0x26e9ff['body']['id']){delete _0x26e9ff['body']['id'];}return db[_0x9475('0x40')][_0x9475('0x5c')]({'where':{'id':_0x26e9ff['params']['id']}})['then'](handleEntityNotFound(_0x1c0094,null))[_0x9475('0x38')](function(_0x56bf1c){if(_0x56bf1c){_0x26e9ff[_0x9475('0x5e')]['FaxAccountId']=_0x56bf1c['id'];return db['Disposition'][_0x9475('0x5d')](_0x26e9ff[_0x9475('0x5e')]);}})[_0x9475('0x38')](respondWithResult(_0x1c0094,null))[_0x9475('0x29')](handleError(_0x1c0094,null));};exports['getDispositions']=function(_0x3985be,_0x4157b0,_0x3874bd){var _0x37ae65={'raw':![],'where':{}};var _0x29507a={};var _0x1db6b3={'count':0x0,'rows':[]};return db['FaxAccount'][_0x9475('0x69')]({'where':{'id':_0x3985be[_0x9475('0x5a')]['id']}})[_0x9475('0x38')](handleEntityNotFound(_0x4157b0,null))[_0x9475('0x38')](function(_0x2eb394){if(_0x2eb394){_0x29507a['model']=_[_0x9475('0x47')](db[_0x9475('0x6a')][_0x9475('0x41')]);_0x29507a[_0x9475('0x48')]=_[_0x9475('0x47')](_0x3985be[_0x9475('0x48')]);_0x29507a['filters']=_[_0x9475('0x49')](_0x29507a[_0x9475('0x45')],_0x29507a[_0x9475('0x48')]);_0x37ae65[_0x9475('0x4a')]=_[_0x9475('0x49')](_0x29507a[_0x9475('0x45')],qs[_0x9475('0x4b')](_0x3985be[_0x9475('0x48')][_0x9475('0x4b')]));_0x37ae65[_0x9475('0x4a')]=_0x37ae65[_0x9475('0x4a')][_0x9475('0x4c')]?_0x37ae65[_0x9475('0x4a')]:_0x29507a[_0x9475('0x45')];if(!_0x3985be[_0x9475('0x48')][_0x9475('0x4d')]('nolimit')){_0x37ae65['limit']=qs['limit'](_0x3985be[_0x9475('0x48')]['limit']);_0x37ae65[_0x9475('0x2e')]=qs[_0x9475('0x2e')](_0x3985be[_0x9475('0x48')]['offset']);}_0x37ae65[_0x9475('0x4f')]=qs[_0x9475('0x6b')](_0x3985be['query'][_0x9475('0x6b')]);_0x37ae65['where']=qs[_0x9475('0x50')](_[_0x9475('0x6c')](_0x3985be[_0x9475('0x48')],_0x29507a[_0x9475('0x50')]));_0x37ae65[_0x9475('0x52')][_0x9475('0x6d')]=_0x2eb394['id'];if(_0x3985be[_0x9475('0x48')][_0x9475('0x51')]){_0x37ae65['where']=_[_0x9475('0x53')](_0x37ae65['where'],{'$or':_[_0x9475('0x46')](_0x37ae65[_0x9475('0x4a')],function(_0x34663d){var _0x221291={};_0x221291[_0x34663d]={'$like':'%'+_0x3985be['query'][_0x9475('0x51')]+'%'};return _0x221291;})});}_0x37ae65=_[_0x9475('0x53')]({},_0x37ae65,_0x3985be[_0x9475('0x5b')]);return db[_0x9475('0x6a')]['count']({'where':_0x37ae65[_0x9475('0x52')]})['then'](function(_0x5e2601){_0x1db6b3[_0x9475('0x30')]=_0x5e2601;if(_0x3985be['query']['includeAll']){_0x37ae65[_0x9475('0x56')]=[{'all':!![]}];}return db['Disposition'][_0x9475('0x57')](_0x37ae65);})[_0x9475('0x38')](function(_0xe8f412){_0x1db6b3[_0x9475('0x58')]=_0xe8f412;return _0x1db6b3;});}})['then'](respondWithFilteredResult(_0x4157b0,_0x37ae65))[_0x9475('0x29')](handleError(_0x4157b0,null));};exports['removeDispositions']=function(_0x183d83,_0x39799e,_0x1e9c44){return db[_0x9475('0x40')][_0x9475('0x5c')]({'where':{'id':_0x183d83[_0x9475('0x5a')]['id']}})['then'](handleEntityNotFound(_0x39799e,null))[_0x9475('0x38')](function(_0x398d0a){if(_0x398d0a){return _0x398d0a['removeDispositions'](_0x183d83['query'][_0x9475('0x6e')]);}})['then'](respondWithStatusCode(_0x39799e,null))[_0x9475('0x29')](handleError(_0x39799e,null));};exports[_0x9475('0x6f')]=function(_0x873a45,_0x397a77,_0x559f77){if(_0x873a45[_0x9475('0x5e')]['id']){delete _0x873a45[_0x9475('0x5e')]['id'];}return db['FaxAccount'][_0x9475('0x5c')]({'where':{'id':_0x873a45[_0x9475('0x5a')]['id']}})[_0x9475('0x38')](handleEntityNotFound(_0x397a77,null))[_0x9475('0x38')](function(_0x3ae550){if(_0x3ae550){_0x873a45[_0x9475('0x5e')][_0x9475('0x6d')]=_0x3ae550['id'];return db[_0x9475('0x70')][_0x9475('0x5d')](_0x873a45['body']);}})[_0x9475('0x38')](respondWithResult(_0x397a77,null))['catch'](handleError(_0x397a77,null));};exports[_0x9475('0x71')]=function(_0x42c9a9,_0xd0ed65,_0x3788d3){var _0xf7c02e={'raw':![],'where':{}};var _0x38f542={};var _0x590de5={'count':0x0,'rows':[]};return db[_0x9475('0x40')][_0x9475('0x69')]({'where':{'id':_0x42c9a9[_0x9475('0x5a')]['id']}})['then'](handleEntityNotFound(_0xd0ed65,null))[_0x9475('0x38')](function(_0x2f0c60){if(_0x2f0c60){_0x38f542[_0x9475('0x45')]=_[_0x9475('0x47')](db[_0x9475('0x70')][_0x9475('0x41')]);_0x38f542['query']=_[_0x9475('0x47')](_0x42c9a9[_0x9475('0x48')]);_0x38f542['filters']=_[_0x9475('0x49')](_0x38f542[_0x9475('0x45')],_0x38f542[_0x9475('0x48')]);_0xf7c02e[_0x9475('0x4a')]=_[_0x9475('0x49')](_0x38f542[_0x9475('0x45')],qs[_0x9475('0x4b')](_0x42c9a9[_0x9475('0x48')][_0x9475('0x4b')]));_0xf7c02e[_0x9475('0x4a')]=_0xf7c02e[_0x9475('0x4a')][_0x9475('0x4c')]?_0xf7c02e[_0x9475('0x4a')]:_0x38f542[_0x9475('0x45')];if(!_0x42c9a9[_0x9475('0x48')][_0x9475('0x4d')](_0x9475('0x4e'))){_0xf7c02e['limit']=qs[_0x9475('0x31')](_0x42c9a9[_0x9475('0x48')][_0x9475('0x31')]);_0xf7c02e['offset']=qs['offset'](_0x42c9a9[_0x9475('0x48')][_0x9475('0x2e')]);}_0xf7c02e['order']=qs[_0x9475('0x6b')](_0x42c9a9[_0x9475('0x48')]['sort']);_0xf7c02e['where']=qs[_0x9475('0x50')](_[_0x9475('0x6c')](_0x42c9a9[_0x9475('0x48')],_0x38f542[_0x9475('0x50')]));_0xf7c02e['where'][_0x9475('0x6d')]=_0x2f0c60['id'];if(_0x42c9a9['query'][_0x9475('0x51')]){_0xf7c02e[_0x9475('0x52')]=_['merge'](_0xf7c02e[_0x9475('0x52')],{'$or':_[_0x9475('0x46')](_0xf7c02e['attributes'],function(_0x3bead7){var _0x2ccc51={};_0x2ccc51[_0x3bead7]={'$like':'%'+_0x42c9a9['query']['filter']+'%'};return _0x2ccc51;})});}_0xf7c02e=_[_0x9475('0x53')]({},_0xf7c02e,_0x42c9a9[_0x9475('0x5b')]);return db[_0x9475('0x70')][_0x9475('0x30')]({'where':_0xf7c02e[_0x9475('0x52')]})[_0x9475('0x38')](function(_0x49d96d){_0x590de5[_0x9475('0x30')]=_0x49d96d;if(_0x42c9a9[_0x9475('0x48')][_0x9475('0x55')]){_0xf7c02e[_0x9475('0x56')]=[{'all':!![]}];}return db[_0x9475('0x70')][_0x9475('0x57')](_0xf7c02e);})[_0x9475('0x38')](function(_0x2590df){_0x590de5['rows']=_0x2590df;return _0x590de5;});}})[_0x9475('0x38')](respondWithFilteredResult(_0xd0ed65,_0xf7c02e))[_0x9475('0x29')](handleError(_0xd0ed65,null));};exports[_0x9475('0x72')]=function(_0x303503,_0x3e77e,_0x3ac73c){return db[_0x9475('0x40')][_0x9475('0x5c')]({'where':{'id':_0x303503['params']['id']}})[_0x9475('0x38')](handleEntityNotFound(_0x3e77e,null))[_0x9475('0x38')](function(_0x425d15){if(_0x425d15){return _0x425d15[_0x9475('0x72')](_0x303503[_0x9475('0x48')][_0x9475('0x6e')]);}})[_0x9475('0x38')](respondWithStatusCode(_0x3e77e,null))[_0x9475('0x29')](handleError(_0x3e77e,null));};exports[_0x9475('0x73')]=function(_0x57b2cb,_0x4640fd,_0x52fbdd){return db[_0x9475('0x74')][_0x9475('0x5c')]({'where':{'id':_0x57b2cb['params']['id']}})['then'](handleEntityNotFound(_0x4640fd,null))[_0x9475('0x38')](function(_0x4d1e7f){if(_0x4d1e7f){return _0x4d1e7f['addInteraction'](_0x57b2cb[_0x9475('0x5e')]['ids'],_[_0x9475('0x75')](_0x57b2cb['body'],[_0x9475('0x6e'),'id'])||{});}})[_0x9475('0x38')](respondWithResult(_0x4640fd,null))[_0x9475('0x29')](handleError(_0x4640fd,null));};exports[_0x9475('0x76')]=function(_0x1eab37,_0x492d32,_0x1f1839){var _0x164b82={'raw':![],'where':{}};var _0x2f90c2={};var _0xf1b704={'count':0x0,'rows':[]};return db[_0x9475('0x40')][_0x9475('0x69')]({'where':{'id':_0x1eab37['params']['id']}})[_0x9475('0x38')](handleEntityNotFound(_0x492d32,null))['then'](function(_0x54a4cc){if(_0x54a4cc){_0x2f90c2['model']=_[_0x9475('0x47')](db[_0x9475('0x74')][_0x9475('0x41')]);_0x2f90c2['query']=_['keys'](_0x1eab37[_0x9475('0x48')]);_0x2f90c2['filters']=_[_0x9475('0x49')](_0x2f90c2[_0x9475('0x45')],_0x2f90c2[_0x9475('0x48')]);_0x164b82[_0x9475('0x4a')]=_[_0x9475('0x49')](_0x2f90c2[_0x9475('0x45')],qs[_0x9475('0x4b')](_0x1eab37[_0x9475('0x48')]['fields']));_0x164b82[_0x9475('0x4a')]=_0x164b82[_0x9475('0x4a')][_0x9475('0x4c')]?_0x164b82[_0x9475('0x4a')]:_0x2f90c2[_0x9475('0x45')];if(!_0x1eab37[_0x9475('0x48')][_0x9475('0x4d')](_0x9475('0x4e'))){_0x164b82[_0x9475('0x31')]=qs[_0x9475('0x31')](_0x1eab37['query']['limit']);_0x164b82[_0x9475('0x2e')]=qs['offset'](_0x1eab37[_0x9475('0x48')][_0x9475('0x2e')]);}_0x164b82[_0x9475('0x4f')]=qs[_0x9475('0x6b')](_0x1eab37[_0x9475('0x48')]['sort']);_0x164b82[_0x9475('0x52')]=qs[_0x9475('0x50')](_['pick'](_0x1eab37[_0x9475('0x48')],_0x2f90c2[_0x9475('0x50')]));_0x164b82['where'][_0x9475('0x6d')]=_0x54a4cc['id'];if(_0x1eab37['query'][_0x9475('0x51')]){_0x164b82['where']=_['merge'](_0x164b82['where'],{'$or':_[_0x9475('0x46')](_0x164b82[_0x9475('0x4a')],function(_0x151081){var _0x5bcf8a={};_0x5bcf8a[_0x151081]={'$like':'%'+_0x1eab37[_0x9475('0x48')][_0x9475('0x51')]+'%'};return _0x5bcf8a;})});}_0x164b82=_[_0x9475('0x53')]({},_0x164b82,_0x1eab37[_0x9475('0x5b')]);return db['FaxInteraction'][_0x9475('0x30')]({'where':_0x164b82[_0x9475('0x52')]})[_0x9475('0x38')](function(_0x20a6cd){_0xf1b704[_0x9475('0x30')]=_0x20a6cd;if(_0x1eab37['query'][_0x9475('0x55')]){_0x164b82['include']=[{'model':db['CmContact'],'as':_0x9475('0x77'),'required':![]},{'model':db['User'],'as':_0x9475('0x78'),'attributes':['name',_0x9475('0x79'),_0x9475('0x7a')],'required':![]},{'model':db[_0x9475('0x7b')],'as':'Tags','attributes':['id',_0x9475('0x3c'),_0x9475('0x7c')],'where':_0x1eab37[_0x9475('0x48')][_0x9475('0x7d')]?{'id':_0x1eab37[_0x9475('0x48')][_0x9475('0x7d')]}:undefined,'required':_0x1eab37['query'][_0x9475('0x7d')]?!![]:![]}];}return db[_0x9475('0x74')]['findAll'](_0x164b82);})[_0x9475('0x38')](function(_0x3f1dac){_0xf1b704['rows']=_0x3f1dac;return _0xf1b704;});}})[_0x9475('0x38')](respondWithFilteredResult(_0x492d32,_0x164b82))[_0x9475('0x29')](handleError(_0x492d32,null));};exports[_0x9475('0x7e')]=function(_0x3d4449,_0x8532d0){var _0x58fe27=_0x3d4449[_0x9475('0x5a')]['id'];var _0x2f935b=_0x3d4449[_0x9475('0x5e')];var _0x2db10f=0xc8;var _0x410042=null;return db[_0x9475('0x7f')]['transaction']({'isolationLevel':db['sequelize'][_0x9475('0x80')]['ISOLATION_LEVELS'][_0x9475('0x81')]},function(_0x245710){return db[_0x9475('0x40')][_0x9475('0x69')]({'where':{'id':_0x58fe27},'transaction':_0x245710})['then'](function(_0x554ee1){if(_0x554ee1){return db[_0x9475('0x82')][_0x9475('0x37')]({'where':{'FaxAccountId':_0x58fe27},'transaction':_0x245710})[_0x9475('0x38')](function(){var _0x4e90d0=_[_0x9475('0x46')](_0x2f935b,function(_0x12a8d9){_0x12a8d9[_0x9475('0x6d')]=_0x58fe27;return _0x12a8d9;});return db['FaxApplication']['bulkCreate'](_0x4e90d0,{'transaction':_0x245710});});}else{_0x2db10f=0x194;_0x410042=[];}});})['then'](function(){if(_0x2db10f!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x58fe27},'order':_0x9475('0x83')})[_0x9475('0x38')](function(_0x28d67d){_0x410042=_0x28d67d;});}})['catch'](function(_0x1f63b0){_0x2db10f=0x1f4;logger[_0x9475('0x25')](_0x1f63b0[_0x9475('0x3b')]);if(_0x1f63b0[_0x9475('0x3c')]){delete _0x1f63b0[_0x9475('0x3c')];}_0x410042=_0x1f63b0;})['finally'](function(){if(_0x410042===null){_0x8532d0[_0x9475('0x2a')](_0x2db10f);}else{if(_0x2db10f===0x1f4){_0x8532d0['status'](_0x2db10f)[_0x9475('0x84')](_0x410042);}else{_0x8532d0[_0x9475('0x2b')](_0x2db10f)[_0x9475('0x2d')](_0x410042);}}});};exports[_0x9475('0x85')]=function(_0x3ca16e,_0x3385bf,_0x4fd4d1){var _0x3cdd9a={};var _0xc58ff6={};var _0xf9e8e0;var _0x172256;return db[_0x9475('0x40')][_0x9475('0x69')]({'where':{'id':_0x3ca16e[_0x9475('0x5a')]['id']}})[_0x9475('0x38')](handleEntityNotFound(_0x3385bf,null))[_0x9475('0x38')](function(_0x524090){if(_0x524090){_0xf9e8e0=_0x524090;_0xc58ff6['model']=_[_0x9475('0x47')](db[_0x9475('0x82')][_0x9475('0x41')]);_0xc58ff6[_0x9475('0x48')]=_[_0x9475('0x47')](_0x3ca16e['query']);_0xc58ff6[_0x9475('0x50')]=_[_0x9475('0x49')](_0xc58ff6['model'],_0xc58ff6['query']);_0x3cdd9a[_0x9475('0x4a')]=_[_0x9475('0x49')](_0xc58ff6[_0x9475('0x45')],qs[_0x9475('0x4b')](_0x3ca16e[_0x9475('0x48')][_0x9475('0x4b')]));_0x3cdd9a[_0x9475('0x4a')]=_0x3cdd9a[_0x9475('0x4a')]['length']?_0x3cdd9a['attributes']:_0xc58ff6[_0x9475('0x45')];_0x3cdd9a[_0x9475('0x4f')]=qs['sort'](_0x3ca16e['query'][_0x9475('0x6b')]);_0x3cdd9a[_0x9475('0x52')]=qs[_0x9475('0x50')](_[_0x9475('0x6c')](_0x3ca16e[_0x9475('0x48')],_0xc58ff6['filters']));if(_0x3ca16e['query'][_0x9475('0x51')]){_0x3cdd9a[_0x9475('0x52')]=_[_0x9475('0x53')](_0x3cdd9a[_0x9475('0x52')],{'$or':_[_0x9475('0x46')](_0x3cdd9a[_0x9475('0x4a')],function(_0x59d158){var _0x21917c={};_0x21917c[_0x59d158]={'$like':'%'+_0x3ca16e['query'][_0x9475('0x51')]+'%'};return _0x21917c;})});}_0x3cdd9a=_[_0x9475('0x53')]({},_0x3cdd9a,_0x3ca16e[_0x9475('0x5b')]);return _0xf9e8e0['getApplications'](_0x3cdd9a);}})['then'](function(_0x5ce4db){if(_0x5ce4db){_0x172256=_0x5ce4db[_0x9475('0x4c')];if(!_0x3ca16e[_0x9475('0x48')][_0x9475('0x4d')]('nolimit')){_0x3cdd9a[_0x9475('0x31')]=qs[_0x9475('0x31')](_0x3ca16e['query'][_0x9475('0x31')]);_0x3cdd9a[_0x9475('0x2e')]=qs[_0x9475('0x2e')](_0x3ca16e[_0x9475('0x48')][_0x9475('0x2e')]);}return _0xf9e8e0['getApplications'](_0x3cdd9a);}})['then'](function(_0x5ac4fb){if(_0x5ac4fb){return _0x5ac4fb?{'count':_0x172256,'rows':_0x5ac4fb}:null;}})['then'](respondWithResult(_0x3385bf,null))['catch'](handleError(_0x3385bf,null));};function Extension(_0x14b7e9,_0x3fe7d5,_0x3d3e18,_0x5d1edf){this[_0x9475('0x86')]='from-voip-provider';this[_0x9475('0x87')]=_0x14b7e9['localstationid'];this['app']=_0x5d1edf;this['type']='system';this[_0x9475('0x88')]=_0x9475('0x89');this[_0x9475('0x6d')]=_0x14b7e9['id'];this[_0x9475('0x83')]=_0x3fe7d5;this[_0x9475('0x8a')]=_0x3d3e18;}function createExtensionsReciveFax(_0x4f48d5){var _0x5e837f=0x1;var _0x4bb2f2=[];_0x4bb2f2[_0x9475('0x8b')](new Extension(_0x4f48d5,_0x5e837f,'',_0x9475('0x8c')));_0x5e837f+=0x1;_0x4bb2f2['push'](new Extension(_0x4f48d5,_0x5e837f,'CDR(type)=inbound-fax',_0x9475('0x8d')));_0x5e837f+=0x1;for(var _0x57f200 in _0x4f48d5){if(_0x4f48d5['hasOwnProperty'](_0x57f200)&&(_0x57f200===_0x9475('0x8e')||_0x57f200===_0x9475('0x8f')||_0x57f200===_0x9475('0x90')||_0x57f200===_0x9475('0x91')||_0x57f200==='headerinfo'||_0x57f200===_0x9475('0x92')||_0x57f200==='minrate'||_0x57f200===_0x9475('0x93')||_0x57f200===_0x9475('0x94'))){_0x4bb2f2[_0x9475('0x8b')](new Extension(_0x4f48d5,_0x5e837f,'FAXOPT('+_0x57f200+')='+_0x4f48d5[_0x57f200],'Set'));_0x5e837f+=0x1;}}_0x4bb2f2[_0x9475('0x8b')](new Extension(_0x4f48d5,_0x5e837f,'6',_0x9475('0x95')));_0x5e837f+=0x1;_0x4bb2f2[_0x9475('0x8b')](new Extension(_0x4f48d5,_0x5e837f,_0x9475('0x96'),_0x9475('0x97')));_0x5e837f=0x0;return _0x4bb2f2;}exports['addAccountApplications']=function(_0x3bb7c8,_0x4c6d38,_0x575d50){var _0x5e8614;return db[_0x9475('0x7f')][_0x9475('0x98')](function(_0x1358c8){return db[_0x9475('0x40')][_0x9475('0x5d')](_0x3bb7c8[_0x9475('0x5e')],{'transaction':_0x1358c8})['then'](function(_0x5404d8){_0x5e8614=_0x5404d8[_0x9475('0x39')]({'plain':!![]});return db['VoiceExtension'][_0x9475('0x99')](createExtensionsReciveFax(_0x5e8614),{'transaction':_0x1358c8});});})[_0x9475('0x38')](function(){return _0x5e8614;})[_0x9475('0x38')](respondWithResult(_0x4c6d38,null))['catch'](handleError(_0x4c6d38,null));};exports[_0x9475('0x9a')]=function(_0x24e56f,_0x25f2f2,_0x2c2d28){var _0x13ba2a;return db[_0x9475('0x7f')]['transaction'](function(_0x365b32){return db['FaxAccount'][_0x9475('0x66')](_0x24e56f['body'],{'where':{'id':_0x24e56f[_0x9475('0x5e')]['id']},'transaction':_0x365b32})[_0x9475('0x38')](function(_0x36c8c5){return db[_0x9475('0x9b')]['destroy']({'where':{'FaxAccountId':_0x24e56f[_0x9475('0x5e')]['id']},'transaction':_0x365b32})[_0x9475('0x38')](function(_0x1676cb){return db[_0x9475('0x9b')]['bulkCreate'](createExtensionsReciveFax(_[_0x9475('0x75')](_0x24e56f[_0x9475('0x5e')],[_0x9475('0x9c'),_0x9475('0x44'),'createdAt',_0x9475('0x9d'),_0x9475('0x9e'),'ListId'])),{'transaction':_0x365b32});});});})['then'](function(){return db[_0x9475('0x40')][_0x9475('0x9f')](_0x24e56f[_0x9475('0x5e')]['id']);})[_0x9475('0x38')](respondWithResult(_0x25f2f2,null))[_0x9475('0x29')](handleError(_0x25f2f2,null));};exports[_0x9475('0xa0')]=function(_0x27be29,_0x50551e,_0x38b8dc){var _0x134692={'raw':!![],'where':{}};var _0x2070bd={};var _0x1054f9={'count':0x0,'rows':[]};return db[_0x9475('0x40')][_0x9475('0x69')]({'where':{'id':_0x27be29[_0x9475('0x5a')]['id']}})[_0x9475('0x38')](handleEntityNotFound(_0x50551e,null))[_0x9475('0x38')](function(_0x4fe611){if(_0x4fe611){_0x2070bd[_0x9475('0x45')]=_[_0x9475('0x47')](db[_0x9475('0xa1')][_0x9475('0x41')]);_0x2070bd[_0x9475('0x48')]=_[_0x9475('0x47')](_0x27be29[_0x9475('0x48')]);_0x2070bd['filters']=_['intersection'](_0x2070bd['model'],_0x2070bd[_0x9475('0x48')]);_0x134692[_0x9475('0x4a')]=_['intersection'](_0x2070bd['model'],qs[_0x9475('0x4b')](_0x27be29[_0x9475('0x48')]['fields']));_0x134692[_0x9475('0x4a')]=_0x134692[_0x9475('0x4a')][_0x9475('0x4c')]?_0x134692[_0x9475('0x4a')]:_0x2070bd[_0x9475('0x45')];if(!_0x27be29[_0x9475('0x48')]['hasOwnProperty'](_0x9475('0x4e'))){_0x134692[_0x9475('0x31')]=qs[_0x9475('0x31')](_0x27be29['query'][_0x9475('0x31')]);_0x134692['offset']=qs[_0x9475('0x2e')](_0x27be29['query'][_0x9475('0x2e')]);}_0x134692[_0x9475('0x4f')]=qs['sort'](_0x27be29[_0x9475('0x48')]['sort']);_0x134692['where']=qs[_0x9475('0x50')](_[_0x9475('0x6c')](_0x27be29[_0x9475('0x48')],_0x2070bd[_0x9475('0x50')]));_0x134692[_0x9475('0x52')][_0x9475('0x6d')]=_0x4fe611['id'];if(_0x27be29[_0x9475('0x48')][_0x9475('0x51')]){_0x134692['where']=_[_0x9475('0x53')](_0x134692[_0x9475('0x52')],{'$or':_[_0x9475('0x46')](_0x134692[_0x9475('0x4a')],function(_0x1f7dc3){var _0x2229ab={};_0x2229ab[_0x1f7dc3]={'$like':'%'+_0x27be29[_0x9475('0x48')][_0x9475('0x51')]+'%'};return _0x2229ab;})});}if(_0x27be29[_0x9475('0x48')][_0x9475('0xa2')]){var _0x2a5149=_0x27be29[_0x9475('0x48')][_0x9475('0xa2')]['split'](',');var _0x3f0725={};_0x3f0725[_0x2a5149[0x0]]={'$gte':moment(_0x2a5149[0x1])[_0x9475('0xa3')](_0x9475('0xa4'))};_0x134692[_0x9475('0x52')]=_[_0x9475('0x53')](_0x134692[_0x9475('0x52')],_0x3f0725);}_0x134692=_[_0x9475('0x53')]({},_0x134692,_0x27be29['options']);return db['FaxMessage']['count']({'where':_0x134692[_0x9475('0x52')]})[_0x9475('0x38')](function(_0x247046){_0x1054f9[_0x9475('0x30')]=_0x247046;if(_0x27be29[_0x9475('0x48')]['includeAll']){_0x134692['include']=[{'all':!![]}];}return db[_0x9475('0xa1')][_0x9475('0x57')](_0x134692);})[_0x9475('0x38')](function(_0x20f9bd){_0x1054f9['rows']=_0x20f9bd;return _0x1054f9;});}})[_0x9475('0x38')](respondWithFilteredResult(_0x50551e,_0x134692))[_0x9475('0x29')](handleError(_0x50551e,null));};exports[_0x9475('0x84')]=function(_0x32e22b,_0x20b1da,_0x11b518){var _0x565f46,_0xe1633b={},_0x10181b;if(_0x32e22b['body']['to']){_0x10181b=_0x32e22b[_0x9475('0x5e')]['to'][0x0];}return db['FaxAccount'][_0x9475('0x5c')]({'where':{'id':_0x32e22b['params']['id']},'include':[{'model':db[_0x9475('0xa5')],'as':'List','include':[{'model':db[_0x9475('0xa6')],'as':_0x9475('0xa7'),'where':{'fax':_0x10181b},'limit':0x1,'order':[['updatedAt',_0x9475('0xa8')]]}]}]})[_0x9475('0x38')](handleEntityNotFound(_0x20b1da,null))[_0x9475('0x38')](function(_0x3e3b19){_0x565f46=_0x3e3b19;if(_0x32e22b['body']['attachments']&&_0x32e22b['body'][_0x9475('0xa9')][_0x9475('0x4c')]){for(var _0x2182d4=0x0;_0x2182d4<_0x32e22b['body']['attachments'][_0x9475('0x4c')];_0x2182d4+=0x1){_0x32e22b['body']['attachments'][_0x2182d4]={'filename':_0x32e22b[_0x9475('0x5e')][_0x9475('0xa9')][_0x2182d4][_0x9475('0x3c')],'id':_0x32e22b['body']['attachments'][_0x2182d4]['id'],'path':path[_0x9475('0xaa')](config[_0x9475('0xab')],_0x9475('0xac'),_0x32e22b[_0x9475('0x5e')][_0x9475('0xa9')][_0x2182d4][_0x9475('0xad')])};}}return respondWithRpcPromise(_0x9475('0xae'),_0x9475('0xae'),{'FaxAccountId':_[_0x9475('0xaf')](_0x32e22b[_0x9475('0x5a')]['id'])?undefined:_0x32e22b[_0x9475('0x5a')]['id'],'path':_[_0x9475('0xaf')](_0x32e22b[_0x9475('0x5e')][_0x9475('0xa9')][0x0][_0x9475('0xb0')])?undefined:_0x32e22b['body'][_0x9475('0xa9')][0x0][_0x9475('0xb0')],'fax':_[_0x9475('0xaf')](_0x32e22b['body']['to'][0x0])?undefined:_0x32e22b[_0x9475('0x5e')]['to'][0x0]},client9002);})[_0x9475('0x38')](function(){if(_0x565f46){if(_[_0x9475('0xaf')](_0x32e22b[_0x9475('0x5e')][_0x9475('0xb1')])){_0x32e22b[_0x9475('0x5e')][_0x9475('0xb1')]=util[_0x9475('0xa3')](_0x9475('0xb2'),_0x565f46[_0x9475('0x3c')],_0x565f46[_0x9475('0xb3')]);}if(_0x565f46[_0x9475('0xb4')]){if(_0x565f46[_0x9475('0xb4')][_0x9475('0xa7')][_0x9475('0x4c')]){return _0x565f46['List']['Contacts'][0x0];}else{return db[_0x9475('0xa6')][_0x9475('0x5d')](_[_0x9475('0x16')](_0x32e22b[_0x9475('0x5e')],{'firstName':_0x32e22b[_0x9475('0x5e')]['to'][0x0],'phone':_0x32e22b[_0x9475('0x5e')]['to'][0x0],'fax':_0x32e22b[_0x9475('0x5e')]['to'][0x0],'ListId':_0x565f46[_0x9475('0xb5')]}));}}else{throw new Error(_0x9475('0xb6'));}}else{throw new Error(_0x9475('0xb7'));}})[_0x9475('0x38')](function(_0x8b1a8f){if(_0x8b1a8f){return db[_0x9475('0x74')][_0x9475('0x5c')]({'where':{'ContactId':_0x8b1a8f['id'],'closed':![],'FaxAccountId':_0x565f46['id']}})['then'](function(_0x27994e){if(_0x27994e){return[_0x27994e,![]];}return db[_0x9475('0x74')][_0x9475('0x5d')]({'UserId':_0x32e22b['user']['id'],'ContactId':_0x8b1a8f['id'],'FaxAccountId':_0x565f46['id'],'fax':_0x32e22b[_0x9475('0x5e')]['to'][0x0],'firstMsgDirection':_0x9475('0xb8'),'Messages':[_[_0x9475('0x53')](_0x32e22b[_0x9475('0x5e')],{'read':![],'body':_0x32e22b[_0x9475('0x5e')][_0x9475('0xa9')][0x0][_0x9475('0xb9')],'FaxAccountId':_0x565f46['id'],'UserId':_0x32e22b['user']['id'],'ContactId':_0x8b1a8f['id'],'AttachmentId':_0x32e22b[_0x9475('0x5e')][_0x9475('0xa9')][0x0]['id']})]},{'include':[{'model':db[_0x9475('0xa1')],'as':_0x9475('0xba')}]})[_0x9475('0x38')](function(_0x4778cf){return[_0x4778cf,!![]];});});}else{throw new Error(_0x9475('0xbb'));}})[_0x9475('0xbc')](function(_0x165105,_0x22da96){if(_0x22da96){return _0x165105;}return db[_0x9475('0xa1')][_0x9475('0x5d')]({'direction':_0x9475('0xb8'),'read':![],'body':_0x32e22b[_0x9475('0x5e')][_0x9475('0xa9')][0x0][_0x9475('0xb9')],'FaxAccountId':_0x565f46['id'],'FaxInteractionId':_0x165105['id'],'UserId':_0x32e22b[_0x9475('0x5f')]['id'],'ContactId':_0x165105['ContactId'],'AttachmentId':_0x32e22b[_0x9475('0x5e')][_0x9475('0xa9')][0x0]['id']})[_0x9475('0x38')](function(_0x4f6cd1){_0x165105[_0x9475('0xbd')][_0x9475('0xba')]=[];_0x165105[_0x9475('0xbd')][_0x9475('0xba')][_0x9475('0x8b')](_0x4f6cd1[_0x9475('0xbd')]);return _0x165105;});})['then'](function(_0x1a4887){respondWithRpcPromise(_0x9475('0xbe'),'SendFax',{'FaxAccountId':_[_0x9475('0xaf')](_0x32e22b[_0x9475('0x5a')]['id'])?undefined:_0x32e22b[_0x9475('0x5a')]['id'],'path':_[_0x9475('0xaf')](_0x32e22b[_0x9475('0x5e')][_0x9475('0xa9')][0x0][_0x9475('0xb0')])?undefined:_0x32e22b[_0x9475('0x5e')][_0x9475('0xa9')][0x0][_0x9475('0xb0')],'fax':_[_0x9475('0xaf')](_0x32e22b['body']['to'][0x0])?undefined:_0x32e22b[_0x9475('0x5e')]['to'][0x0],'AttachmentId':_0x32e22b[_0x9475('0x5e')][_0x9475('0xa9')][0x0]['id']},client9002)[_0x9475('0x38')](function(_0x2c915e){logger[_0x9475('0x1f')](_0x9475('0xbf'),_0x2c915e);})[_0x9475('0x29')](function(_0x2b7a6c){logger[_0x9475('0x1f')](_0x9475('0xbf'),_0x2b7a6c);});return _0x1a4887;})[_0x9475('0x38')](respondWithResult(_0x20b1da,null))[_0x9475('0x29')](handleError(_0x20b1da,null));};exports[_0x9475('0xc0')]=function(_0x5e0f01,_0x32bf0b,_0x343910){return db[_0x9475('0x40')][_0x9475('0x5c')]({'where':{'id':_0x5e0f01['params']['id']}})['then'](handleEntityNotFound(_0x32bf0b,null))[_0x9475('0x38')](function(_0x4cad26){if(_0x4cad26){return _0x4cad26[_0x9475('0xc0')](_0x5e0f01[_0x9475('0x5e')]['ids'],_[_0x9475('0x75')](_0x5e0f01['body'],[_0x9475('0x6e'),'id'])||{})[_0x9475('0xbc')](function(_0x2de411){for(var _0x13e732=0x0;_0x13e732<_0x5e0f01['body'][_0x9475('0x6e')][_0x9475('0x4c')];_0x13e732+=0x1){socket[_0x9475('0xc1')](_0x9475('0xc2'),{'UserId':Number(_0x5e0f01['body'][_0x9475('0x6e')][_0x13e732]),'FaxAccountId':Number(_0x5e0f01['params']['id'])});}return _0x2de411;});}})[_0x9475('0x38')](respondWithResult(_0x32bf0b,null))['catch'](handleError(_0x32bf0b,null));};exports['removeAgents']=function(_0x62a6e1,_0x28b392,_0x1c3a21){return db[_0x9475('0x40')][_0x9475('0x5c')]({'where':{'id':_0x62a6e1[_0x9475('0x5a')]['id']}})[_0x9475('0x38')](handleEntityNotFound(_0x28b392,null))[_0x9475('0x38')](function(_0x555699){if(_0x555699){return _0x555699[_0x9475('0xc3')](_0x62a6e1[_0x9475('0x48')][_0x9475('0x6e')])[_0x9475('0x38')](function(){if(_[_0x9475('0xc4')](_0x62a6e1[_0x9475('0x48')][_0x9475('0x6e')])){for(var _0x3e3d91=0x0;_0x3e3d91<_0x62a6e1[_0x9475('0x48')][_0x9475('0x6e')][_0x9475('0x4c')];_0x3e3d91+=0x1){socket[_0x9475('0xc1')](_0x9475('0xc5'),{'UserId':Number(_0x62a6e1['query'][_0x9475('0x6e')][_0x3e3d91]),'FaxAccountId':Number(_0x62a6e1[_0x9475('0x5a')]['id'])});}}else{socket[_0x9475('0xc1')](_0x9475('0xc5'),{'UserId':Number(_0x62a6e1[_0x9475('0x48')][_0x9475('0x6e')]),'FaxAccountId':Number(_0x62a6e1[_0x9475('0x5a')]['id'])});}});}})[_0x9475('0x38')](respondWithStatusCode(_0x28b392,null))[_0x9475('0x29')](handleError(_0x28b392,null));};exports[_0x9475('0xc6')]=function(_0x52c333,_0x5510ea,_0x20e02f){var _0x18a131={};var _0x4452e8={};var _0x4ceaa8;var _0x3e2503;return db[_0x9475('0x40')][_0x9475('0x69')]({'where':{'id':_0x52c333[_0x9475('0x5a')]['id']}})[_0x9475('0x38')](handleEntityNotFound(_0x5510ea,null))[_0x9475('0x38')](function(_0xfcea5c){if(_0xfcea5c){_0x4ceaa8=_0xfcea5c;_0x4452e8[_0x9475('0x45')]=_[_0x9475('0x47')](db[_0x9475('0xc7')][_0x9475('0x41')]);_0x4452e8[_0x9475('0x48')]=_[_0x9475('0x47')](_0x52c333[_0x9475('0x48')]);_0x4452e8[_0x9475('0x50')]=_[_0x9475('0x49')](_0x4452e8[_0x9475('0x45')],_0x4452e8[_0x9475('0x48')]);_0x18a131[_0x9475('0x4a')]=_[_0x9475('0x49')](_0x4452e8[_0x9475('0x45')],qs[_0x9475('0x4b')](_0x52c333[_0x9475('0x48')][_0x9475('0x4b')]));_0x18a131[_0x9475('0x4a')]=_0x18a131[_0x9475('0x4a')][_0x9475('0x4c')]?_0x18a131[_0x9475('0x4a')]:_0x4452e8[_0x9475('0x45')];_0x18a131['order']=qs[_0x9475('0x6b')](_0x52c333[_0x9475('0x48')][_0x9475('0x6b')]);_0x18a131[_0x9475('0x52')]=qs['filters'](_[_0x9475('0x6c')](_0x52c333[_0x9475('0x48')],_0x4452e8[_0x9475('0x50')]));if(_0x52c333[_0x9475('0x48')][_0x9475('0x51')]){_0x18a131[_0x9475('0x52')]=_[_0x9475('0x53')](_0x18a131[_0x9475('0x52')],{'$or':_[_0x9475('0x46')](_0x18a131[_0x9475('0x4a')],function(_0x2a5da7){var _0x5f2ce3={};_0x5f2ce3[_0x2a5da7]={'$like':'%'+_0x52c333[_0x9475('0x48')][_0x9475('0x51')]+'%'};return _0x5f2ce3;})});}_0x18a131=_[_0x9475('0x53')]({},_0x18a131,_0x52c333[_0x9475('0x5b')]);return _0x4ceaa8['getAgents'](_0x18a131);}})[_0x9475('0x38')](function(_0x1196db){if(_0x1196db){_0x3e2503=_0x1196db['length'];if(!_0x52c333[_0x9475('0x48')][_0x9475('0x4d')](_0x9475('0x4e'))){_0x18a131[_0x9475('0x31')]=qs[_0x9475('0x31')](_0x52c333[_0x9475('0x48')][_0x9475('0x31')]);_0x18a131[_0x9475('0x2e')]=qs[_0x9475('0x2e')](_0x52c333[_0x9475('0x48')]['offset']);}return _0x4ceaa8[_0x9475('0xc6')](_0x18a131);}})[_0x9475('0x38')](function(_0x11a7d3){if(_0x11a7d3){return _0x11a7d3?{'count':_0x3e2503,'rows':_0x11a7d3}:null;}})[_0x9475('0x38')](respondWithResult(_0x5510ea,null))[_0x9475('0x29')](handleError(_0x5510ea,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 498dcc8..f4b4ad3 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 _0x57a7=['setMaxListeners','save','update','remove','exports','../../mysqldb','FaxAccount'];(function(_0x202b05,_0x5a246c){var _0x22a0a7=function(_0x5157f2){while(--_0x5157f2){_0x202b05['push'](_0x202b05['shift']());}};_0x22a0a7(++_0x5a246c);}(_0x57a7,0xb4));var _0x757a=function(_0x54d4f9,_0x4b10a8){_0x54d4f9=_0x54d4f9-0x0;var _0x2a56d5=_0x57a7[_0x54d4f9];return _0x2a56d5;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x757a('0x0'))['db'][_0x757a('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x757a('0x2')](0x0);var events={'afterCreate':_0x757a('0x3'),'afterUpdate':_0x757a('0x4'),'afterDestroy':_0x757a('0x5')};function emitEvent(_0x4646ea){return function(_0x4469c2,_0xcb84f6,_0x3375be){FaxAccountEvents['emit'](_0x4646ea+':'+_0x4469c2['id'],_0x4469c2);FaxAccountEvents['emit'](_0x4646ea,_0x4469c2);_0x3375be(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x757a('0x6')]=FaxAccountEvents; \ No newline at end of file +var _0x793b=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','remove','emit'];(function(_0x574fc1,_0x9079d){var _0x422848=function(_0x6e6906){while(--_0x6e6906){_0x574fc1['push'](_0x574fc1['shift']());}};_0x422848(++_0x9079d);}(_0x793b,0x189));var _0xb793=function(_0x30b2f2,_0x30af05){_0x30b2f2=_0x30b2f2-0x0;var _0x3f4695=_0x793b[_0x30b2f2];return _0x3f4695;};'use strict';var EventEmitter=require(_0xb793('0x0'));var FaxAccount=require(_0xb793('0x1'))['db'][_0xb793('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb793('0x3')](0x0);var events={'afterCreate':_0xb793('0x4'),'afterUpdate':'update','afterDestroy':_0xb793('0x5')};function emitEvent(_0x18aa98){return function(_0x577e1c,_0x56ca69,_0x28d672){FaxAccountEvents[_0xb793('0x6')](_0x18aa98+':'+_0x577e1c['id'],_0x577e1c);FaxAccountEvents[_0xb793('0x6')](_0x18aa98,_0x577e1c);_0x28d672(null);};}for(var e in events){if(events[_0xb793('0x7')](e)){var event=events[e];FaxAccount[_0xb793('0x8')](e,emitEvent(event));}}module[_0xb793('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 32291fc..e173fc5 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 _0x88a6=['../../config/environment','./faxAccount.attributes','define','FaxAccount','fax_accounts','util','../../config/logger','request-promise','path','rimraf'];(function(_0x446929,_0x2e9877){var _0x1f4c5c=function(_0x19a2fe){while(--_0x19a2fe){_0x446929['push'](_0x446929['shift']());}};_0x1f4c5c(++_0x2e9877);}(_0x88a6,0x1c7));var _0x688a=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0x88a6[_0x3bfdde];return _0x3f752a;};'use strict';var _=require('lodash');var util=require(_0x688a('0x0'));var logger=require(_0x688a('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x688a('0x2'));var fs=require('fs');var path=require(_0x688a('0x3'));var rimraf=require(_0x688a('0x4'));var config=require(_0x688a('0x5'));var attributes=require(_0x688a('0x6'));module['exports']=function(_0x33a347,_0x16b62d){return _0x33a347[_0x688a('0x7')](_0x688a('0x8'),attributes,{'tableName':_0x688a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c20=['fax_accounts','lodash','util','api','path','rimraf','./faxAccount.attributes','exports','define','FaxAccount'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0x6c20,0x119));var _0x06c2=function(_0x1c30bf,_0x247c31){_0x1c30bf=_0x1c30bf-0x0;var _0x255b5e=_0x6c20[_0x1c30bf];return _0x255b5e;};'use strict';var _=require(_0x06c2('0x0'));var util=require(_0x06c2('0x1'));var logger=require('../../config/logger')(_0x06c2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x06c2('0x3'));var rimraf=require(_0x06c2('0x4'));var config=require('../../config/environment');var attributes=require(_0x06c2('0x5'));module[_0x06c2('0x6')]=function(_0x57efa0,_0x16af6e){return _0x57efa0[_0x06c2('0x7')](_0x06c2('0x8'),attributes,{'tableName':_0x06c2('0x9'),'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 8714b4d..1fe09ca 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 _0xc736=['interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','socket.io-emitter','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','from','find','account','CmList','List','FaxApplication','Applications','applications','list','orderBy','priority','asc','length','ListId','create','FaxInteraction','Contact\x20not\x20found','spread','get','push','unmanaged','created'];(function(_0x4cf4c0,_0x502c87){var _0x28338f=function(_0x36580d){while(--_0x36580d){_0x4cf4c0['push'](_0x4cf4c0['shift']());}};_0x28338f(++_0x502c87);}(_0xc736,0x114));var _0x6c73=function(_0x170496,_0x44b50a){_0x170496=_0x170496-0x0;var _0x43f9c0=_0xc736[_0x170496];return _0x43f9c0;};'use strict';var _=require(_0x6c73('0x0'));var util=require(_0x6c73('0x1'));var moment=require(_0x6c73('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c73('0x3'));var db=require(_0x6c73('0x4'))['db'];var utils=require(_0x6c73('0x5'));var logger=require(_0x6c73('0x6'))('rpc');var config=require(_0x6c73('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6c73('0x8')][_0x6c73('0x9')]({'port':0x232c});config['redis']=_[_0x6c73('0xa')](config[_0x6c73('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6c73('0xc'))(new Redis(config[_0x6c73('0xb')]));require('./faxAccount.socket')[_0x6c73('0xd')](socket);function respondWithRpcPromise(_0x39b087,_0x1a0bf5,_0x4dbf40){return new BPromise(function(_0x363a9f,_0x563d64){return client['request'](_0x39b087,_0x4dbf40)[_0x6c73('0xe')](function(_0x42a92e){logger[_0x6c73('0xf')](_0x6c73('0x10'),_0x1a0bf5,_0x6c73('0x11'));logger[_0x6c73('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1a0bf5,_0x6c73('0x11'),JSON[_0x6c73('0x13')](_0x42a92e));if(_0x42a92e[_0x6c73('0x14')]){if(_0x42a92e['error'][_0x6c73('0x15')]===0x1f4){logger[_0x6c73('0x14')](_0x6c73('0x10'),_0x1a0bf5,_0x42a92e['error'][_0x6c73('0x16')]);return _0x563d64(_0x42a92e[_0x6c73('0x14')][_0x6c73('0x16')]);}logger[_0x6c73('0x14')](_0x6c73('0x10'),_0x1a0bf5,_0x42a92e['error'][_0x6c73('0x16')]);return _0x363a9f(_0x42a92e['error'][_0x6c73('0x16')]);}else{logger[_0x6c73('0xf')](_0x6c73('0x10'),_0x1a0bf5,_0x6c73('0x11'));_0x363a9f(_0x42a92e[_0x6c73('0x17')][_0x6c73('0x16')]);}})[_0x6c73('0x18')](function(_0x788543){logger[_0x6c73('0x14')](_0x6c73('0x10'),_0x1a0bf5,_0x788543);_0x563d64(_0x788543);});});}exports[_0x6c73('0x19')]=function(_0x6fb31f){var _0x130e79=this;return new Promise(function(_0x166d1e,_0x4828c1){return db[_0x6c73('0x1a')][_0x6c73('0x1b')]({'raw':_0x6fb31f[_0x6c73('0x1c')]?_0x6fb31f['options'][_0x6c73('0x1d')]===undefined?!![]:![]:!![],'where':_0x6fb31f[_0x6c73('0x1c')]?_0x6fb31f[_0x6c73('0x1c')]['where']||null:null,'attributes':_0x6fb31f[_0x6c73('0x1c')]?_0x6fb31f[_0x6c73('0x1c')][_0x6c73('0x1e')]||null:null,'limit':_0x6fb31f[_0x6c73('0x1c')]?_0x6fb31f[_0x6c73('0x1c')][_0x6c73('0x1f')]||null:null,'include':_0x6fb31f[_0x6c73('0x1c')]?_0x6fb31f[_0x6c73('0x1c')][_0x6c73('0x20')]?_[_0x6c73('0x21')](_0x6fb31f[_0x6c73('0x1c')][_0x6c73('0x20')],function(_0xe91b5d){return{'model':db[_0xe91b5d[_0x6c73('0x22')]],'as':_0xe91b5d['as'],'attributes':_0xe91b5d[_0x6c73('0x1e')],'include':_0xe91b5d[_0x6c73('0x20')]?_['map'](_0xe91b5d['include'],function(_0x4e5e73){return{'model':db[_0x4e5e73['model']],'as':_0x4e5e73['as'],'attributes':_0x4e5e73[_0x6c73('0x1e')],'include':_0x4e5e73[_0x6c73('0x20')]?_['map'](_0x4e5e73[_0x6c73('0x20')],function(_0x2a74e5){return{'model':db[_0x2a74e5[_0x6c73('0x22')]],'as':_0x2a74e5['as'],'attributes':_0x2a74e5['attributes']};}):[]};}):[]};}):[]:[]})[_0x6c73('0xe')](function(_0x19441d){logger[_0x6c73('0xf')]('GetFaxAccount',_0x6fb31f);logger[_0x6c73('0x12')](_0x6c73('0x19'),_0x6fb31f,JSON['stringify'](_0x19441d));_0x166d1e(_0x19441d);})[_0x6c73('0x18')](function(_0x37bfcf){logger['error'](_0x6c73('0x19'),_0x37bfcf[_0x6c73('0x16')],_0x6fb31f);_0x4828c1(_0x130e79['error'](0x1f4,_0x37bfcf['message']));});});};exports[_0x6c73('0x23')]=function(_0x5023f6,_0x5a7765,_0x5ed9de){var _0x30d284=this;return new Promise(function(_0x7964a3,_0xfb97b0){var _0x35ab7c={'body':_0x5023f6[_0x6c73('0x24')],'channel':_0x6c73('0x25')};var _0x5a5f73=[];var _0x1117be=[];var _0x329570={};return db[_0x6c73('0x26')][_0x6c73('0x27')]()[_0x6c73('0xe')](function(_0x98b783){if(!_0x98b783){throw new db[(_0x6c73('0x28'))][(_0x6c73('0x29'))](_0x6c73('0x2a'));}_0x5a5f73=_[_0x6c73('0x2b')](_[_0x6c73('0x2c')](_0x98b783),[_0x6c73('0x2d'),_0x6c73('0x2e')]);_0x1117be=_[_0x6c73('0x2b')](_[_0x6c73('0x2c')](_0x98b783),['createdAt',_0x6c73('0x2e'),_0x6c73('0x2f'),'ListId']);if(_0x5023f6['body']['id']){delete _0x5023f6[_0x6c73('0x24')]['id'];}if(_[_0x6c73('0x30')](_0x5023f6[_0x6c73('0x24')]['from'])){throw new db[(_0x6c73('0x28'))][(_0x6c73('0x29'))](_0x6c73('0x31'));}if(_[_0x6c73('0x30')](_0x5023f6[_0x6c73('0x24')]['body'])||_0x5023f6[_0x6c73('0x24')][_0x6c73('0x24')]===''){throw new db[(_0x6c73('0x28'))]['ValidationError'](_0x6c73('0x32'));}if(_['isNil'](_0x5023f6[_0x6c73('0x24')]['mapKey'])){throw new db[(_0x6c73('0x28'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1117be);}if(!_[_0x6c73('0x33')](_0x1117be,_0x5023f6[_0x6c73('0x24')]['mapKey'])){throw new db[(_0x6c73('0x28'))][(_0x6c73('0x29'))](_0x6c73('0x34')+_0x1117be);}_0x329570[_0x5023f6[_0x6c73('0x24')][_0x6c73('0x35')]]=_0x5023f6[_0x6c73('0x24')][_0x6c73('0x36')];})['then'](function(){return db[_0x6c73('0x1a')][_0x6c73('0x37')]({'where':{'id':_0x5023f6[_0x6c73('0x38')]['id']},'include':[{'model':db[_0x6c73('0x39')],'as':_0x6c73('0x3a'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x329570,'limit':0x1,'order':[[_0x6c73('0x2e'),'DESC']]}]},{'model':db[_0x6c73('0x3b')],'as':_0x6c73('0x3c')}]});})[_0x6c73('0xe')](function(_0x39a018){if(_0x39a018&&_0x39a018[_0x6c73('0x3a')]){var _0x285136=_0x39a018['get']({'plain':!![]});_0x35ab7c[_0x6c73('0x38')]=_0x285136;_0x35ab7c[_0x6c73('0x3d')]=_0x285136[_0x6c73('0x3c')];_0x35ab7c[_0x6c73('0x3e')]=_0x285136[_0x6c73('0x3a')];_0x35ab7c[_0x6c73('0x3d')]=_[_0x6c73('0x3f')](_0x35ab7c[_0x6c73('0x3d')],[_0x6c73('0x40')],[_0x6c73('0x41')]);if(_0x35ab7c[_0x6c73('0x38')][_0x6c73('0x3c')]){delete _0x35ab7c[_0x6c73('0x38')][_0x6c73('0x3c')];}if(_0x35ab7c['account'][_0x6c73('0x3a')]&&_0x35ab7c[_0x6c73('0x38')][_0x6c73('0x3a')]['Contacts'][_0x6c73('0x42')]){return _0x35ab7c[_0x6c73('0x38')]['List']['Contacts'][0x0];}var _0x475667=_['defaults'](_0x5023f6['body'],{'firstName':_0x5023f6['body']['from'],'ListId':_0x285136[_0x6c73('0x43')]});_0x475667[_0x5023f6[_0x6c73('0x24')][_0x6c73('0x35')]]=_0x5023f6[_0x6c73('0x24')][_0x6c73('0x36')];return db[_0x6c73('0x26')][_0x6c73('0x44')](_0x475667,{'fields':_0x5a5f73,'raw':!![]});}})[_0x6c73('0xe')](function(_0x54053f){_0x35ab7c['contact']=_0x54053f;if(_0x54053f){var _0x463aa0={'ContactId':_0x54053f['id'],'FaxAccountId':_0x5023f6[_0x6c73('0x38')]['id'],'fax':_0x54053f[_0x6c73('0x25')]};return db[_0x6c73('0x45')][_0x6c73('0x37')]({'where':{'ContactId':_0x54053f['id'],'closed':![],'FaxAccountId':_0x5023f6[_0x6c73('0x38')]['id']}})[_0x6c73('0xe')](function(_0x50efde){if(_0x50efde){return[_0x50efde,![]];}return db[_0x6c73('0x45')][_0x6c73('0x44')](_0x463aa0)['then'](function(_0x33c9e0){return[_0x33c9e0,!![]];});});}else{throw new Error(_0x6c73('0x46'));}})[_0x6c73('0x47')](function(_0x164b82,_0x2e9489){var _0x5c6c8c=_0x164b82[_0x6c73('0x48')]({'plain':!![]});if(_0x2e9489){if(_0x35ab7c['account']['autoclose']){_0x35ab7c['applications'][_0x6c73('0x49')]({'id':0x0,'priority':_0x35ab7c[_0x6c73('0x3d')][_0x6c73('0x42')]+0x1,'app':'close','appdata':_0x6c73('0x4a'),'interval':'*,*,*,*'});}_0x5c6c8c[_0x6c73('0x4b')]=!![];}else{_0x5c6c8c[_0x6c73('0x4b')]=![];}_0x35ab7c[_0x6c73('0x4c')]=_0x5c6c8c;return db[_0x6c73('0x4d')][_0x6c73('0x44')]({'body':_0x5023f6[_0x6c73('0x24')][_0x6c73('0x24')],'FaxAccountId':_0x5023f6[_0x6c73('0x38')]['id'],'FaxInteractionId':_0x164b82['id'],'direction':'in','ContactId':_0x164b82[_0x6c73('0x4e')],'AttachmentId':_0x5023f6['body'][_0x6c73('0x4f')]});})['then'](function(_0x2d9e5e){_0x35ab7c['message']=_0x2d9e5e;if(_0x35ab7c[_0x6c73('0x4c')][_0x6c73('0x50')]){return db[_0x6c73('0x51')][_0x6c73('0x37')]({'attributes':['id',_0x6c73('0x52')],'where':{'id':_0x35ab7c['interaction'][_0x6c73('0x50')]}})[_0x6c73('0xe')](function(_0x28b345){if(_0x28b345){_0x35ab7c['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x6c73('0x53'),'appdata':_0x28b345['name']+','+(_0x35ab7c[_0x6c73('0x38')][_0x6c73('0x54')]||0xa),'interval':_0x6c73('0x55')});}return respondWithRpcPromise(_0x6c73('0x56'),_0x6c73('0x57'),_0x35ab7c);});}return respondWithRpcPromise('Start','startRouting',_0x35ab7c);})[_0x6c73('0xe')](function(_0x4b6c3e){_0x7964a3(_0x4b6c3e);})[_0x6c73('0x18')](function(_0x38145b){_0xfb97b0(_0x30d284['error'](0x1f4,_0x38145b[_0x6c73('0x16')]));});});}; \ No newline at end of file +var _0xee35=['body','fax','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','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','find','account','List','DESC','Applications','get','applications','list','orderBy','priority','asc','Contacts','length','CmContact','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','*,*,*,*','created','FaxMessage','AttachmentId','User','name','interaction','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','NotifyFaxAccount'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xee35,0x13a));var _0x5ee3=function(_0x31826c,_0x1995c5){_0x31826c=_0x31826c-0x0;var _0x20bbd7=_0xee35[_0x31826c];return _0x20bbd7;};'use strict';var _=require(_0x5ee3('0x0'));var util=require(_0x5ee3('0x1'));var moment=require('moment');var BPromise=require(_0x5ee3('0x2'));var rs=require(_0x5ee3('0x3'));var fs=require('fs');var Redis=require(_0x5ee3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5ee3('0x5'));var logger=require('../../config/logger')(_0x5ee3('0x6'));var config=require(_0x5ee3('0x7'));var jayson=require(_0x5ee3('0x8'));var client=jayson[_0x5ee3('0x9')][_0x5ee3('0xa')]({'port':0x232c});config['redis']=_[_0x5ee3('0xb')](config['redis'],{'host':_0x5ee3('0xc'),'port':0x18eb});var socket=require(_0x5ee3('0xd'))(new Redis(config[_0x5ee3('0xe')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x161835,_0x1bb9e3,_0x4db138){return new BPromise(function(_0x485bb0,_0x32ffeb){return client[_0x5ee3('0xf')](_0x161835,_0x4db138)[_0x5ee3('0x10')](function(_0xbd08fe){logger[_0x5ee3('0x11')](_0x5ee3('0x12'),_0x1bb9e3,_0x5ee3('0x13'));logger[_0x5ee3('0x14')](_0x5ee3('0x15'),_0x1bb9e3,_0x5ee3('0x13'),JSON[_0x5ee3('0x16')](_0xbd08fe));if(_0xbd08fe[_0x5ee3('0x17')]){if(_0xbd08fe[_0x5ee3('0x17')][_0x5ee3('0x18')]===0x1f4){logger[_0x5ee3('0x17')]('FaxAccount,\x20%s,\x20%s',_0x1bb9e3,_0xbd08fe[_0x5ee3('0x17')][_0x5ee3('0x19')]);return _0x32ffeb(_0xbd08fe[_0x5ee3('0x17')][_0x5ee3('0x19')]);}logger[_0x5ee3('0x17')](_0x5ee3('0x12'),_0x1bb9e3,_0xbd08fe[_0x5ee3('0x17')][_0x5ee3('0x19')]);return _0x485bb0(_0xbd08fe[_0x5ee3('0x17')]['message']);}else{logger['info'](_0x5ee3('0x12'),_0x1bb9e3,_0x5ee3('0x13'));_0x485bb0(_0xbd08fe['result'][_0x5ee3('0x19')]);}})[_0x5ee3('0x1a')](function(_0x50588b){logger[_0x5ee3('0x17')](_0x5ee3('0x12'),_0x1bb9e3,_0x50588b);_0x32ffeb(_0x50588b);});});}exports[_0x5ee3('0x1b')]=function(_0x2244aa){var _0xf87c02=this;return new Promise(function(_0x19fee9,_0x5f53c7){return db[_0x5ee3('0x1c')][_0x5ee3('0x1d')]({'raw':_0x2244aa[_0x5ee3('0x1e')]?_0x2244aa['options'][_0x5ee3('0x1f')]===undefined?!![]:![]:!![],'where':_0x2244aa[_0x5ee3('0x1e')]?_0x2244aa['options']['where']||null:null,'attributes':_0x2244aa[_0x5ee3('0x1e')]?_0x2244aa[_0x5ee3('0x1e')][_0x5ee3('0x20')]||null:null,'limit':_0x2244aa[_0x5ee3('0x1e')]?_0x2244aa[_0x5ee3('0x1e')][_0x5ee3('0x21')]||null:null,'include':_0x2244aa[_0x5ee3('0x1e')]?_0x2244aa[_0x5ee3('0x1e')][_0x5ee3('0x22')]?_[_0x5ee3('0x23')](_0x2244aa[_0x5ee3('0x1e')][_0x5ee3('0x22')],function(_0x43c58c){return{'model':db[_0x43c58c['model']],'as':_0x43c58c['as'],'attributes':_0x43c58c[_0x5ee3('0x20')],'include':_0x43c58c[_0x5ee3('0x22')]?_[_0x5ee3('0x23')](_0x43c58c[_0x5ee3('0x22')],function(_0x39718a){return{'model':db[_0x39718a[_0x5ee3('0x24')]],'as':_0x39718a['as'],'attributes':_0x39718a['attributes'],'include':_0x39718a[_0x5ee3('0x22')]?_[_0x5ee3('0x23')](_0x39718a[_0x5ee3('0x22')],function(_0x892eb1){return{'model':db[_0x892eb1['model']],'as':_0x892eb1['as'],'attributes':_0x892eb1[_0x5ee3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3982ec){logger[_0x5ee3('0x11')](_0x5ee3('0x1b'),_0x2244aa);logger[_0x5ee3('0x14')](_0x5ee3('0x1b'),_0x2244aa,JSON['stringify'](_0x3982ec));_0x19fee9(_0x3982ec);})[_0x5ee3('0x1a')](function(_0x471a0d){logger['error']('GetFaxAccount',_0x471a0d[_0x5ee3('0x19')],_0x2244aa);_0x5f53c7(_0xf87c02['error'](0x1f4,_0x471a0d['message']));});});};exports[_0x5ee3('0x25')]=function(_0x46c424,_0x32029d,_0x39c4f1){var _0x1b6630=this;return new Promise(function(_0x13fb03,_0x5de2d2){var _0x5052f8={'body':_0x46c424[_0x5ee3('0x26')],'channel':_0x5ee3('0x27')};var _0x27f0da=[];var _0x11ddd6=[];var _0x525b69={};return db['CmContact']['describe']()[_0x5ee3('0x10')](function(_0x443fcd){if(!_0x443fcd){throw new db[(_0x5ee3('0x28'))][(_0x5ee3('0x29'))](_0x5ee3('0x2a'));}_0x27f0da=_[_0x5ee3('0x2b')](_[_0x5ee3('0x2c')](_0x443fcd),[_0x5ee3('0x2d'),_0x5ee3('0x2e')]);_0x11ddd6=_['difference'](_['keys'](_0x443fcd),[_0x5ee3('0x2d'),_0x5ee3('0x2e'),_0x5ee3('0x2f'),_0x5ee3('0x30')]);if(_0x46c424['body']['id']){delete _0x46c424[_0x5ee3('0x26')]['id'];}if(_[_0x5ee3('0x31')](_0x46c424[_0x5ee3('0x26')][_0x5ee3('0x32')])){throw new db[(_0x5ee3('0x28'))][(_0x5ee3('0x29'))](_0x5ee3('0x33'));}if(_[_0x5ee3('0x31')](_0x46c424[_0x5ee3('0x26')][_0x5ee3('0x26')])||_0x46c424[_0x5ee3('0x26')][_0x5ee3('0x26')]===''){throw new db[(_0x5ee3('0x28'))][(_0x5ee3('0x29'))](_0x5ee3('0x34'));}if(_['isNil'](_0x46c424[_0x5ee3('0x26')][_0x5ee3('0x35')])){throw new db[(_0x5ee3('0x28'))]['ValidationError'](_0x5ee3('0x36')+_0x11ddd6);}if(!_[_0x5ee3('0x37')](_0x11ddd6,_0x46c424[_0x5ee3('0x26')][_0x5ee3('0x35')])){throw new db['Sequelize']['ValidationError'](_0x5ee3('0x38')+_0x11ddd6);}_0x525b69[_0x46c424[_0x5ee3('0x26')][_0x5ee3('0x35')]]=_0x46c424[_0x5ee3('0x26')][_0x5ee3('0x32')];})[_0x5ee3('0x10')](function(){return db[_0x5ee3('0x1c')][_0x5ee3('0x39')]({'where':{'id':_0x46c424[_0x5ee3('0x3a')]['id']},'include':[{'model':db['CmList'],'as':_0x5ee3('0x3b'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x525b69,'limit':0x1,'order':[[_0x5ee3('0x2e'),_0x5ee3('0x3c')]]}]},{'model':db['FaxApplication'],'as':_0x5ee3('0x3d')}]});})[_0x5ee3('0x10')](function(_0x23b1e8){if(_0x23b1e8&&_0x23b1e8[_0x5ee3('0x3b')]){var _0x3dd8a5=_0x23b1e8[_0x5ee3('0x3e')]({'plain':!![]});_0x5052f8[_0x5ee3('0x3a')]=_0x3dd8a5;_0x5052f8[_0x5ee3('0x3f')]=_0x3dd8a5[_0x5ee3('0x3d')];_0x5052f8[_0x5ee3('0x40')]=_0x3dd8a5[_0x5ee3('0x3b')];_0x5052f8[_0x5ee3('0x3f')]=_[_0x5ee3('0x41')](_0x5052f8[_0x5ee3('0x3f')],[_0x5ee3('0x42')],[_0x5ee3('0x43')]);if(_0x5052f8[_0x5ee3('0x3a')][_0x5ee3('0x3d')]){delete _0x5052f8[_0x5ee3('0x3a')][_0x5ee3('0x3d')];}if(_0x5052f8[_0x5ee3('0x3a')]['List']&&_0x5052f8[_0x5ee3('0x3a')][_0x5ee3('0x3b')][_0x5ee3('0x44')][_0x5ee3('0x45')]){return _0x5052f8[_0x5ee3('0x3a')][_0x5ee3('0x3b')][_0x5ee3('0x44')][0x0];}var _0x5c84e2=_[_0x5ee3('0xb')](_0x46c424['body'],{'firstName':_0x46c424[_0x5ee3('0x26')][_0x5ee3('0x32')],'ListId':_0x3dd8a5[_0x5ee3('0x30')]});_0x5c84e2[_0x46c424[_0x5ee3('0x26')][_0x5ee3('0x35')]]=_0x46c424[_0x5ee3('0x26')][_0x5ee3('0x32')];return db[_0x5ee3('0x46')][_0x5ee3('0x47')](_0x5c84e2,{'fields':_0x27f0da,'raw':!![]});}})[_0x5ee3('0x10')](function(_0x1dba47){_0x5052f8[_0x5ee3('0x48')]=_0x1dba47;if(_0x1dba47){var _0x155c3b={'ContactId':_0x1dba47['id'],'FaxAccountId':_0x46c424[_0x5ee3('0x3a')]['id'],'fax':_0x1dba47['fax']};return db[_0x5ee3('0x49')]['find']({'where':{'ContactId':_0x1dba47['id'],'closed':![],'FaxAccountId':_0x46c424[_0x5ee3('0x3a')]['id']}})['then'](function(_0x235a59){if(_0x235a59){return[_0x235a59,![]];}return db[_0x5ee3('0x49')][_0x5ee3('0x47')](_0x155c3b)['then'](function(_0x2a79da){return[_0x2a79da,!![]];});});}else{throw new Error(_0x5ee3('0x4a'));}})['spread'](function(_0x36eacd,_0x1a8220){var _0x2c1b85=_0x36eacd[_0x5ee3('0x3e')]({'plain':!![]});if(_0x1a8220){if(_0x5052f8[_0x5ee3('0x3a')][_0x5ee3('0x4b')]){_0x5052f8['applications']['push']({'id':0x0,'priority':_0x5052f8[_0x5ee3('0x3f')][_0x5ee3('0x45')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x5ee3('0x4c')});}_0x2c1b85[_0x5ee3('0x4d')]=!![];}else{_0x2c1b85[_0x5ee3('0x4d')]=![];}_0x5052f8['interaction']=_0x2c1b85;return db[_0x5ee3('0x4e')][_0x5ee3('0x47')]({'body':_0x46c424[_0x5ee3('0x26')]['body'],'FaxAccountId':_0x46c424[_0x5ee3('0x3a')]['id'],'FaxInteractionId':_0x36eacd['id'],'direction':'in','ContactId':_0x36eacd['ContactId'],'AttachmentId':_0x46c424[_0x5ee3('0x26')][_0x5ee3('0x4f')]});})[_0x5ee3('0x10')](function(_0x21592c){_0x5052f8[_0x5ee3('0x19')]=_0x21592c;if(_0x5052f8['interaction']['UserId']){return db[_0x5ee3('0x50')]['find']({'attributes':['id',_0x5ee3('0x51')],'where':{'id':_0x5052f8[_0x5ee3('0x52')][_0x5ee3('0x53')]}})[_0x5ee3('0x10')](function(_0x1bbd1a){if(_0x1bbd1a){_0x5052f8[_0x5ee3('0x3f')][_0x5ee3('0x54')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1bbd1a['name']+','+(_0x5052f8[_0x5ee3('0x3a')][_0x5ee3('0x55')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x5052f8);});}return respondWithRpcPromise(_0x5ee3('0x56'),_0x5ee3('0x57'),_0x5052f8);})['then'](function(_0x23280e){_0x13fb03(_0x23280e);})[_0x5ee3('0x1a')](function(_0x5c7657){_0x5de2d2(_0x1b6630['error'](0x1f4,_0x5c7657[_0x5ee3('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 7015d7d..a9866ef 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 _0x731f=['register','length','save','remove','emit','removeListener'];(function(_0x46ff7b,_0x15a7fa){var _0x570b72=function(_0x3a3da4){while(--_0x3a3da4){_0x46ff7b['push'](_0x46ff7b['shift']());}};_0x570b72(++_0x15a7fa);}(_0x731f,0xa4));var _0xf731=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x731f[_0x122ef9];return _0x42fba0;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xf731('0x0'),_0xf731('0x1'),'update'];function createListener(_0x51c877,_0x5d8d3e){return function(_0x55aeda){_0x5d8d3e[_0xf731('0x2')](_0x51c877,_0x55aeda);};}function removeListener(_0x49032d,_0x4cb5f1){return function(){FaxAccountEvents[_0xf731('0x3')](_0x49032d,_0x4cb5f1);};}exports[_0xf731('0x4')]=function(_0x36b6fe){for(var _0x2fe7f9=0x0,_0x4ea69c=events[_0xf731('0x5')];_0x2fe7f9<_0x4ea69c;_0x2fe7f9++){var _0x4244c6=events[_0x2fe7f9];var _0x307c14=createListener('faxAccount:'+_0x4244c6,_0x36b6fe);FaxAccountEvents['on'](_0x4244c6,_0x307c14);}}; \ No newline at end of file +var _0x963d=['emit','removeListener','register','save'];(function(_0x288579,_0x154f63){var _0xf363ba=function(_0x2c76ef){while(--_0x2c76ef){_0x288579['push'](_0x288579['shift']());}};_0xf363ba(++_0x154f63);}(_0x963d,0xa7));var _0xd963=function(_0x1aecee,_0x4ec9c4){_0x1aecee=_0x1aecee-0x0;var _0x4cb55a=_0x963d[_0x1aecee];return _0x4cb55a;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0xd963('0x0'),'remove','update'];function createListener(_0x12b9c5,_0x15c888){return function(_0xa0e2b4){_0x15c888[_0xd963('0x1')](_0x12b9c5,_0xa0e2b4);};}function removeListener(_0x22f447,_0x5d5b31){return function(){FaxAccountEvents[_0xd963('0x2')](_0x22f447,_0x5d5b31);};}exports[_0xd963('0x3')]=function(_0x57e3d8){for(var _0x194597=0x0,_0x18ef45=events['length'];_0x194597<_0x18ef45;_0x194597++){var _0x1317aa=events[_0x194597];var _0x1e2042=createListener('faxAccount:'+_0x1317aa,_0x57e3d8);FaxAccountEvents['on'](_0x1317aa,_0x1e2042);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 272529b..cdf56af 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(_0xb03639,_0x4c64d8){var _0x2fa641=function(_0x19492f){while(--_0x19492f){_0xb03639['push'](_0xb03639['shift']());}};_0x2fa641(++_0x4c64d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x11d7ae,_0x3e75cc){var _0xf3d528=function(_0x3816ac){while(--_0x3816ac){_0x11d7ae['push'](_0x11d7ae['shift']());}};_0xf3d528(++_0x3e75cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 2393d7d..7f20913 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 _0xbe54=['INTEGER','STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x4ed13f,_0x387b6d){var _0x39b14a=function(_0x422ad2){while(--_0x422ad2){_0x4ed13f['push'](_0x4ed13f['shift']());}};_0x39b14a(++_0x387b6d);}(_0xbe54,0xe8));var _0x4be5=function(_0x1ea580,_0x518ec7){_0x1ea580=_0x1ea580-0x0;var _0x5a525d=_0xbe54[_0x1ea580];return _0x5a525d;};'use strict';var Sequelize=require(_0x4be5('0x0'));module[_0x4be5('0x1')]={'priority':{'type':Sequelize[_0x4be5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x4be5('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4be5('0x4')]()},'description':{'type':Sequelize[_0x4be5('0x3')]},'interval':{'type':Sequelize[_0x4be5('0x3')],'defaultValue':_0x4be5('0x5')}}; \ No newline at end of file +var _0x20c8=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x7cd69f,_0xdacf23){var _0x142857=function(_0x5ebf3a){while(--_0x5ebf3a){_0x7cd69f['push'](_0x7cd69f['shift']());}};_0x142857(++_0xdacf23);}(_0x20c8,0x1ee));var _0x820c=function(_0x2b976c,_0x4ee6dd){_0x2b976c=_0x2b976c-0x0;var _0x5c5a26=_0x20c8[_0x2b976c];return _0x5c5a26;};'use strict';var Sequelize=require(_0x820c('0x0'));module[_0x820c('0x1')]={'priority':{'type':Sequelize[_0x820c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x820c('0x3')],'allowNull':![],'defaultValue':_0x820c('0x4')},'appdata':{'type':Sequelize[_0x820c('0x5')]()},'description':{'type':Sequelize[_0x820c('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x820c('0x6')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index a27430f..cd4fe90 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 _0xc2cc=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','then','include','findAll','rows','show','params','length','includeAll','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv'];(function(_0x2f82e7,_0x50f448){var _0x483927=function(_0x1f9d9c){while(--_0x1f9d9c){_0x2f82e7['push'](_0x2f82e7['shift']());}};_0x483927(++_0x50f448);}(_0xc2cc,0xd7));var _0xcc2c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc2cc[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xcc2c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcc2c('0x1'));var jsonpatch=require(_0xcc2c('0x2'));var rp=require(_0xcc2c('0x3'));var moment=require(_0xcc2c('0x4'));var BPromise=require(_0xcc2c('0x5'));var Mustache=require(_0xcc2c('0x6'));var util=require(_0xcc2c('0x7'));var path=require('path');var sox=require(_0xcc2c('0x8'));var csv=require('to-csv');var ejs=require(_0xcc2c('0x9'));var fs=require('fs');var fs_extra=require(_0xcc2c('0xa'));var _=require(_0xcc2c('0xb'));var squel=require(_0xcc2c('0xc'));var crypto=require(_0xcc2c('0xd'));var jsforce=require(_0xcc2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcc2c('0xf'));var querystring=require(_0xcc2c('0x10'));var Papa=require('papaparse');var Redis=require(_0xcc2c('0x11'));var authService=require(_0xcc2c('0x12'));var qs=require(_0xcc2c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc2c('0x14'));var logger=require(_0xcc2c('0x15'))(_0xcc2c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcc2c('0x17'));var db=require(_0xcc2c('0x18'))['db'];function respondWithStatusCode(_0x1cb75a,_0x14abd0){_0x14abd0=_0x14abd0||0xcc;return function(_0x7f99be){if(_0x7f99be){return _0x1cb75a[_0xcc2c('0x19')](_0x14abd0);}return _0x1cb75a[_0xcc2c('0x1a')](_0x14abd0)[_0xcc2c('0x1b')]();};}function respondWithResult(_0x5da05a,_0x1f3692){_0x1f3692=_0x1f3692||0xc8;return function(_0x4ef1aa){if(_0x4ef1aa){return _0x5da05a[_0xcc2c('0x1a')](_0x1f3692)[_0xcc2c('0x1c')](_0x4ef1aa);}};}function respondWithFilteredResult(_0x5d31a3,_0x11fc14){return function(_0x3cbc7a){if(_0x3cbc7a){var _0x493f1d=typeof _0x11fc14[_0xcc2c('0x1d')]===_0xcc2c('0x1e')&&typeof _0x11fc14[_0xcc2c('0x1f')]===_0xcc2c('0x1e');var _0x2e5e14=_0x3cbc7a[_0xcc2c('0x20')];var _0x409ed7=_0x493f1d?0x0:_0x11fc14[_0xcc2c('0x1d')];var _0x41eb81=_0x493f1d?_0x3cbc7a[_0xcc2c('0x20')]:_0x11fc14[_0xcc2c('0x1d')]+_0x11fc14['limit'];var _0x31dcbf;if(_0x41eb81>=_0x2e5e14){_0x41eb81=_0x2e5e14;_0x31dcbf=0xc8;}else{_0x31dcbf=0xce;}_0x5d31a3[_0xcc2c('0x1a')](_0x31dcbf);return _0x5d31a3[_0xcc2c('0x21')](_0xcc2c('0x22'),_0x409ed7+'-'+_0x41eb81+'/'+_0x2e5e14)[_0xcc2c('0x1c')](_0x3cbc7a);}return null;};}function patchUpdates(_0xe6c049){return function(_0x23e037){try{jsonpatch['apply'](_0x23e037,_0xe6c049,!![]);}catch(_0x5c3ca7){return BPromise[_0xcc2c('0x23')](_0x5c3ca7);}return _0x23e037[_0xcc2c('0x24')]();};}function saveUpdates(_0x8ee03f,_0x24f263){return function(_0x5c8c29){if(_0x5c8c29){return _0x5c8c29[_0xcc2c('0x25')](_0x8ee03f)['then'](function(_0x3ea769){return _0x3ea769;});}return null;};}function removeEntity(_0x92ed03,_0x4285e1){return function(_0x5ebe36){if(_0x5ebe36){return _0x5ebe36[_0xcc2c('0x26')]()['then'](function(){_0x92ed03[_0xcc2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d3d01,_0x21310c){return function(_0x3b4a5e){if(!_0x3b4a5e){_0x2d3d01[_0xcc2c('0x19')](0x194);}return _0x3b4a5e;};}function handleError(_0x4b57e0,_0x570e61){_0x570e61=_0x570e61||0x1f4;return function(_0x102ccd){logger[_0xcc2c('0x27')](_0x102ccd[_0xcc2c('0x28')]);if(_0x102ccd['name']){delete _0x102ccd[_0xcc2c('0x29')];}_0x4b57e0[_0xcc2c('0x1a')](_0x570e61)[_0xcc2c('0x2a')](_0x102ccd);};}exports[_0xcc2c('0x2b')]=function(_0x4b2b63,_0xe48351){var _0x1b5cf5={},_0x4878c2={},_0x181050={'count':0x0,'rows':[]};var _0x57ad97=_[_0xcc2c('0x2c')](db[_0xcc2c('0x2d')][_0xcc2c('0x2e')],function(_0x26c4d8){return{'name':_0x26c4d8[_0xcc2c('0x2f')],'type':_0x26c4d8[_0xcc2c('0x30')][_0xcc2c('0x31')]};});_0x4878c2[_0xcc2c('0x32')]=_[_0xcc2c('0x2c')](_0x57ad97,_0xcc2c('0x29'));_0x4878c2['query']=_[_0xcc2c('0x33')](_0x4b2b63['query']);_0x4878c2[_0xcc2c('0x34')]=_[_0xcc2c('0x35')](_0x4878c2[_0xcc2c('0x32')],_0x4878c2[_0xcc2c('0x36')]);_0x1b5cf5[_0xcc2c('0x37')]=_[_0xcc2c('0x35')](_0x4878c2[_0xcc2c('0x32')],qs[_0xcc2c('0x38')](_0x4b2b63[_0xcc2c('0x36')][_0xcc2c('0x38')]));_0x1b5cf5[_0xcc2c('0x37')]=_0x1b5cf5['attributes']['length']?_0x1b5cf5[_0xcc2c('0x37')]:_0x4878c2[_0xcc2c('0x32')];if(!_0x4b2b63[_0xcc2c('0x36')][_0xcc2c('0x39')](_0xcc2c('0x3a'))){_0x1b5cf5[_0xcc2c('0x1f')]=qs[_0xcc2c('0x1f')](_0x4b2b63['query'][_0xcc2c('0x1f')]);_0x1b5cf5[_0xcc2c('0x1d')]=qs[_0xcc2c('0x1d')](_0x4b2b63['query']['offset']);}_0x1b5cf5[_0xcc2c('0x3b')]=qs['sort'](_0x4b2b63[_0xcc2c('0x36')]['sort']);_0x1b5cf5[_0xcc2c('0x3c')]=qs[_0xcc2c('0x34')](_[_0xcc2c('0x3d')](_0x4b2b63[_0xcc2c('0x36')],_0x4878c2[_0xcc2c('0x34')]),_0x57ad97);if(_0x4b2b63[_0xcc2c('0x36')][_0xcc2c('0x3e')]){_0x1b5cf5[_0xcc2c('0x3c')]=_[_0xcc2c('0x3f')](_0x1b5cf5[_0xcc2c('0x3c')],{'$or':_[_0xcc2c('0x2c')](_0x57ad97,function(_0x1712f7){if(_0x1712f7[_0xcc2c('0x30')]!=='VIRTUAL'){var _0x74c4f1={};_0x74c4f1[_0x1712f7[_0xcc2c('0x29')]]={'$like':'%'+_0x4b2b63[_0xcc2c('0x36')][_0xcc2c('0x3e')]+'%'};return _0x74c4f1;}})});}_0x1b5cf5=_['merge']({},_0x1b5cf5,_0x4b2b63[_0xcc2c('0x40')]);var _0x132cba={'where':_0x1b5cf5[_0xcc2c('0x3c')]};return db[_0xcc2c('0x2d')][_0xcc2c('0x20')](_0x132cba)[_0xcc2c('0x41')](function(_0x40726d){_0x181050[_0xcc2c('0x20')]=_0x40726d;if(_0x4b2b63[_0xcc2c('0x36')]['includeAll']){_0x1b5cf5[_0xcc2c('0x42')]=[{'all':!![]}];}return db[_0xcc2c('0x2d')][_0xcc2c('0x43')](_0x1b5cf5);})[_0xcc2c('0x41')](function(_0x1c1a9d){_0x181050[_0xcc2c('0x44')]=_0x1c1a9d;return _0x181050;})[_0xcc2c('0x41')](respondWithFilteredResult(_0xe48351,_0x1b5cf5))['catch'](handleError(_0xe48351,null));};exports[_0xcc2c('0x45')]=function(_0xbf2a88,_0x54fb4c){var _0x54c768={'raw':!![],'where':{'id':_0xbf2a88[_0xcc2c('0x46')]['id']}},_0xeee342={};_0xeee342['model']=_[_0xcc2c('0x33')](db[_0xcc2c('0x2d')][_0xcc2c('0x2e')]);_0xeee342[_0xcc2c('0x36')]=_['keys'](_0xbf2a88[_0xcc2c('0x36')]);_0xeee342[_0xcc2c('0x34')]=_[_0xcc2c('0x35')](_0xeee342[_0xcc2c('0x32')],_0xeee342[_0xcc2c('0x36')]);_0x54c768[_0xcc2c('0x37')]=_[_0xcc2c('0x35')](_0xeee342[_0xcc2c('0x32')],qs[_0xcc2c('0x38')](_0xbf2a88[_0xcc2c('0x36')][_0xcc2c('0x38')]));_0x54c768['attributes']=_0x54c768[_0xcc2c('0x37')][_0xcc2c('0x47')]?_0x54c768['attributes']:_0xeee342[_0xcc2c('0x32')];if(_0xbf2a88[_0xcc2c('0x36')][_0xcc2c('0x48')]){_0x54c768[_0xcc2c('0x42')]=[{'all':!![]}];}_0x54c768=_[_0xcc2c('0x3f')]({},_0x54c768,_0xbf2a88[_0xcc2c('0x40')]);return db['FaxApplication'][_0xcc2c('0x49')](_0x54c768)['then'](handleEntityNotFound(_0x54fb4c,null))[_0xcc2c('0x41')](respondWithResult(_0x54fb4c,null))[_0xcc2c('0x4a')](handleError(_0x54fb4c,null));};exports[_0xcc2c('0x4b')]=function(_0xc135d5,_0x939ff2){return db[_0xcc2c('0x2d')]['create'](_0xc135d5[_0xcc2c('0x4c')],{})[_0xcc2c('0x41')](respondWithResult(_0x939ff2,0xc9))[_0xcc2c('0x4a')](handleError(_0x939ff2,null));};exports['update']=function(_0x3db9d2,_0x38ee12){if(_0x3db9d2[_0xcc2c('0x4c')]['id']){delete _0x3db9d2['body']['id'];}return db[_0xcc2c('0x2d')][_0xcc2c('0x49')]({'where':{'id':_0x3db9d2[_0xcc2c('0x46')]['id']}})[_0xcc2c('0x41')](handleEntityNotFound(_0x38ee12,null))[_0xcc2c('0x41')](saveUpdates(_0x3db9d2[_0xcc2c('0x4c')],null))[_0xcc2c('0x41')](respondWithResult(_0x38ee12,null))[_0xcc2c('0x4a')](handleError(_0x38ee12,null));};exports[_0xcc2c('0x26')]=function(_0x236068,_0x7d158a){return db[_0xcc2c('0x2d')][_0xcc2c('0x49')]({'where':{'id':_0x236068['params']['id']}})[_0xcc2c('0x41')](handleEntityNotFound(_0x7d158a,null))[_0xcc2c('0x41')](removeEntity(_0x7d158a,null))[_0xcc2c('0x4a')](handleError(_0x7d158a,null));}; \ No newline at end of file +var _0x69c7=['undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','map','FaxApplication','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','keys','length','find','create','body','params','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset'];(function(_0x6da195,_0x54773b){var _0x26d75d=function(_0x54454d){while(--_0x54454d){_0x6da195['push'](_0x6da195['shift']());}};_0x26d75d(++_0x54773b);}(_0x69c7,0x77));var _0x769c=function(_0x3b1186,_0x53e918){_0x3b1186=_0x3b1186-0x0;var _0x3869d6=_0x69c7[_0x3b1186];return _0x3869d6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x769c('0x0'));var jsonpatch=require(_0x769c('0x1'));var rp=require('request-promise');var moment=require(_0x769c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x769c('0x3'));var util=require(_0x769c('0x4'));var path=require('path');var sox=require(_0x769c('0x5'));var csv=require(_0x769c('0x6'));var ejs=require(_0x769c('0x7'));var fs=require('fs');var fs_extra=require(_0x769c('0x8'));var _=require(_0x769c('0x9'));var squel=require(_0x769c('0xa'));var crypto=require(_0x769c('0xb'));var jsforce=require(_0x769c('0xc'));var deskjs=require(_0x769c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x769c('0xe'));var Redis=require(_0x769c('0xf'));var authService=require(_0x769c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x769c('0x11'));var hardwareService=require(_0x769c('0x12'));var logger=require(_0x769c('0x13'))('api');var utils=require(_0x769c('0x14'));var config=require(_0x769c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x769c('0x16'))['db'];function respondWithStatusCode(_0x5aaf08,_0x19b2dc){_0x19b2dc=_0x19b2dc||0xcc;return function(_0x2ddb20){if(_0x2ddb20){return _0x5aaf08[_0x769c('0x17')](_0x19b2dc);}return _0x5aaf08[_0x769c('0x18')](_0x19b2dc)['end']();};}function respondWithResult(_0x317b01,_0x5361fe){_0x5361fe=_0x5361fe||0xc8;return function(_0x81c497){if(_0x81c497){return _0x317b01[_0x769c('0x18')](_0x5361fe)[_0x769c('0x19')](_0x81c497);}};}function respondWithFilteredResult(_0x256a2f,_0x54e7fd){return function(_0x517896){if(_0x517896){var _0x3ffed1=typeof _0x54e7fd[_0x769c('0x1a')]===_0x769c('0x1b')&&typeof _0x54e7fd[_0x769c('0x1c')]==='undefined';var _0x3e5b4a=_0x517896[_0x769c('0x1d')];var _0x1bba17=_0x3ffed1?0x0:_0x54e7fd[_0x769c('0x1a')];var _0xcb5e34=_0x3ffed1?_0x517896[_0x769c('0x1d')]:_0x54e7fd[_0x769c('0x1a')]+_0x54e7fd[_0x769c('0x1c')];var _0x52c3df;if(_0xcb5e34>=_0x3e5b4a){_0xcb5e34=_0x3e5b4a;_0x52c3df=0xc8;}else{_0x52c3df=0xce;}_0x256a2f[_0x769c('0x18')](_0x52c3df);return _0x256a2f[_0x769c('0x1e')](_0x769c('0x1f'),_0x1bba17+'-'+_0xcb5e34+'/'+_0x3e5b4a)['json'](_0x517896);}return null;};}function patchUpdates(_0x23290e){return function(_0x86e910){try{jsonpatch[_0x769c('0x20')](_0x86e910,_0x23290e,!![]);}catch(_0x3c4dcd){return BPromise[_0x769c('0x21')](_0x3c4dcd);}return _0x86e910['save']();};}function saveUpdates(_0x24a478,_0x21752d){return function(_0xd7b403){if(_0xd7b403){return _0xd7b403[_0x769c('0x22')](_0x24a478)[_0x769c('0x23')](function(_0x149507){return _0x149507;});}return null;};}function removeEntity(_0x57e78a,_0x2117cd){return function(_0x5644c6){if(_0x5644c6){return _0x5644c6[_0x769c('0x24')]()['then'](function(){_0x57e78a[_0x769c('0x18')](0xcc)[_0x769c('0x25')]();});}};}function handleEntityNotFound(_0x460166,_0x5edc4b){return function(_0x19a03c){if(!_0x19a03c){_0x460166['sendStatus'](0x194);}return _0x19a03c;};}function handleError(_0xbc146,_0x18cfab){_0x18cfab=_0x18cfab||0x1f4;return function(_0x186677){logger['error'](_0x186677[_0x769c('0x26')]);if(_0x186677[_0x769c('0x27')]){delete _0x186677['name'];}_0xbc146[_0x769c('0x18')](_0x18cfab)[_0x769c('0x28')](_0x186677);};}exports['index']=function(_0x3f426d,_0x41c987){var _0x96bb5a={},_0x3f75cb={},_0x54e969={'count':0x0,'rows':[]};var _0xc4e7a8=_[_0x769c('0x29')](db[_0x769c('0x2a')][_0x769c('0x2b')],function(_0x5b89d8){return{'name':_0x5b89d8[_0x769c('0x2c')],'type':_0x5b89d8['type'][_0x769c('0x2d')]};});_0x3f75cb[_0x769c('0x2e')]=_[_0x769c('0x29')](_0xc4e7a8,'name');_0x3f75cb[_0x769c('0x2f')]=_['keys'](_0x3f426d[_0x769c('0x2f')]);_0x3f75cb[_0x769c('0x30')]=_[_0x769c('0x31')](_0x3f75cb['model'],_0x3f75cb[_0x769c('0x2f')]);_0x96bb5a['attributes']=_['intersection'](_0x3f75cb[_0x769c('0x2e')],qs[_0x769c('0x32')](_0x3f426d['query'][_0x769c('0x32')]));_0x96bb5a[_0x769c('0x33')]=_0x96bb5a[_0x769c('0x33')]['length']?_0x96bb5a['attributes']:_0x3f75cb['model'];if(!_0x3f426d[_0x769c('0x2f')][_0x769c('0x34')](_0x769c('0x35'))){_0x96bb5a[_0x769c('0x1c')]=qs[_0x769c('0x1c')](_0x3f426d[_0x769c('0x2f')][_0x769c('0x1c')]);_0x96bb5a[_0x769c('0x1a')]=qs[_0x769c('0x1a')](_0x3f426d['query']['offset']);}_0x96bb5a['order']=qs['sort'](_0x3f426d[_0x769c('0x2f')][_0x769c('0x36')]);_0x96bb5a['where']=qs[_0x769c('0x30')](_[_0x769c('0x37')](_0x3f426d['query'],_0x3f75cb['filters']),_0xc4e7a8);if(_0x3f426d[_0x769c('0x2f')][_0x769c('0x38')]){_0x96bb5a[_0x769c('0x39')]=_['merge'](_0x96bb5a['where'],{'$or':_[_0x769c('0x29')](_0xc4e7a8,function(_0x2a7110){if(_0x2a7110[_0x769c('0x3a')]!==_0x769c('0x3b')){var _0x5bda25={};_0x5bda25[_0x2a7110[_0x769c('0x27')]]={'$like':'%'+_0x3f426d[_0x769c('0x2f')][_0x769c('0x38')]+'%'};return _0x5bda25;}})});}_0x96bb5a=_[_0x769c('0x3c')]({},_0x96bb5a,_0x3f426d[_0x769c('0x3d')]);var _0x6afd75={'where':_0x96bb5a[_0x769c('0x39')]};return db['FaxApplication'][_0x769c('0x1d')](_0x6afd75)['then'](function(_0x16b085){_0x54e969[_0x769c('0x1d')]=_0x16b085;if(_0x3f426d[_0x769c('0x2f')][_0x769c('0x3e')]){_0x96bb5a[_0x769c('0x3f')]=[{'all':!![]}];}return db[_0x769c('0x2a')]['findAll'](_0x96bb5a);})[_0x769c('0x23')](function(_0x4c4a2c){_0x54e969[_0x769c('0x40')]=_0x4c4a2c;return _0x54e969;})[_0x769c('0x23')](respondWithFilteredResult(_0x41c987,_0x96bb5a))[_0x769c('0x41')](handleError(_0x41c987,null));};exports[_0x769c('0x42')]=function(_0x28b143,_0x47e0d9){var _0x423270={'raw':!![],'where':{'id':_0x28b143['params']['id']}},_0x98e4bc={};_0x98e4bc[_0x769c('0x2e')]=_['keys'](db[_0x769c('0x2a')]['rawAttributes']);_0x98e4bc[_0x769c('0x2f')]=_[_0x769c('0x43')](_0x28b143[_0x769c('0x2f')]);_0x98e4bc[_0x769c('0x30')]=_[_0x769c('0x31')](_0x98e4bc[_0x769c('0x2e')],_0x98e4bc[_0x769c('0x2f')]);_0x423270['attributes']=_['intersection'](_0x98e4bc['model'],qs['fields'](_0x28b143[_0x769c('0x2f')]['fields']));_0x423270['attributes']=_0x423270[_0x769c('0x33')][_0x769c('0x44')]?_0x423270[_0x769c('0x33')]:_0x98e4bc['model'];if(_0x28b143[_0x769c('0x2f')]['includeAll']){_0x423270['include']=[{'all':!![]}];}_0x423270=_['merge']({},_0x423270,_0x28b143[_0x769c('0x3d')]);return db[_0x769c('0x2a')][_0x769c('0x45')](_0x423270)['then'](handleEntityNotFound(_0x47e0d9,null))[_0x769c('0x23')](respondWithResult(_0x47e0d9,null))['catch'](handleError(_0x47e0d9,null));};exports[_0x769c('0x46')]=function(_0x335abc,_0x23cddb){return db['FaxApplication']['create'](_0x335abc[_0x769c('0x47')],{})['then'](respondWithResult(_0x23cddb,0xc9))[_0x769c('0x41')](handleError(_0x23cddb,null));};exports[_0x769c('0x22')]=function(_0x1fd0de,_0x958ed2){if(_0x1fd0de[_0x769c('0x47')]['id']){delete _0x1fd0de[_0x769c('0x47')]['id'];}return db[_0x769c('0x2a')][_0x769c('0x45')]({'where':{'id':_0x1fd0de[_0x769c('0x48')]['id']}})['then'](handleEntityNotFound(_0x958ed2,null))[_0x769c('0x23')](saveUpdates(_0x1fd0de[_0x769c('0x47')],null))[_0x769c('0x23')](respondWithResult(_0x958ed2,null))[_0x769c('0x41')](handleError(_0x958ed2,null));};exports[_0x769c('0x24')]=function(_0x647053,_0x86cf4e){return db[_0x769c('0x2a')][_0x769c('0x45')]({'where':{'id':_0x647053['params']['id']}})['then'](handleEntityNotFound(_0x86cf4e,null))[_0x769c('0x23')](removeEntity(_0x86cf4e,null))[_0x769c('0x41')](handleError(_0x86cf4e,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 66c9ec6..fd711a8 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 _0xdcff=['request-promise','../../config/environment','./faxApplication.attributes','define','FaxApplication','utf8mb4','util','api','bluebird'];(function(_0xffbf7,_0x4baa3f){var _0x1cb3e0=function(_0x2e8e3f){while(--_0x2e8e3f){_0xffbf7['push'](_0xffbf7['shift']());}};_0x1cb3e0(++_0x4baa3f);}(_0xdcff,0xba));var _0xfdcf=function(_0x68670b,_0x2ff8eb){_0x68670b=_0x68670b-0x0;var _0x211c94=_0xdcff[_0x68670b];return _0x211c94;};'use strict';var _=require('lodash');var util=require(_0xfdcf('0x0'));var logger=require('../../config/logger')(_0xfdcf('0x1'));var moment=require('moment');var BPromise=require(_0xfdcf('0x2'));var rp=require(_0xfdcf('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfdcf('0x4'));var attributes=require(_0xfdcf('0x5'));module['exports']=function(_0x32d91e,_0x6ff2ff){return _0x32d91e[_0xfdcf('0x6')](_0xfdcf('0x7'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfdcf('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x09cc=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x132059,_0x9db9ce){var _0x2cb838=function(_0xa86d4c){while(--_0xa86d4c){_0x132059['push'](_0x132059['shift']());}};_0x2cb838(++_0x9db9ce);}(_0x09cc,0x7d));var _0xc09c=function(_0x207a02,_0x278c56){_0x207a02=_0x207a02-0x0;var _0xd995c3=_0x09cc[_0x207a02];return _0xd995c3;};'use strict';var _=require(_0xc09c('0x0'));var util=require(_0xc09c('0x1'));var logger=require(_0xc09c('0x2'))(_0xc09c('0x3'));var moment=require(_0xc09c('0x4'));var BPromise=require('bluebird');var rp=require(_0xc09c('0x5'));var fs=require('fs');var path=require(_0xc09c('0x6'));var rimraf=require('rimraf');var config=require(_0xc09c('0x7'));var attributes=require(_0xc09c('0x8'));module[_0xc09c('0x9')]=function(_0x3c0b85,_0x1d40b0){return _0x3c0b85[_0xc09c('0xa')](_0xc09c('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc09c('0xc'),'collate':_0xc09c('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 7ade083..5cc53bb 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 _0xf6d9=['limit','then','UpdateFaxApplication','debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FaxApplication','update','options','raw','attributes'];(function(_0x389a17,_0x5db1a8){var _0x5e9f17=function(_0x450125){while(--_0x450125){_0x389a17['push'](_0x389a17['shift']());}};_0x5e9f17(++_0x5db1a8);}(_0xf6d9,0x130));var _0x9f6d=function(_0x183d35,_0x570c05){_0x183d35=_0x183d35-0x0;var _0x46d4e1=_0xf6d9[_0x183d35];return _0x46d4e1;};'use strict';var _=require(_0x9f6d('0x0'));var util=require(_0x9f6d('0x1'));var moment=require(_0x9f6d('0x2'));var BPromise=require('bluebird');var rs=require(_0x9f6d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f6d('0x4'))['db'];var utils=require(_0x9f6d('0x5'));var logger=require(_0x9f6d('0x6'))(_0x9f6d('0x7'));var config=require(_0x9f6d('0x8'));var jayson=require(_0x9f6d('0x9'));var client=jayson['client'][_0x9f6d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x541a83,_0x2ff481,_0x3dbbb1){return new BPromise(function(_0x2d5a03,_0x52207c){return client[_0x9f6d('0xb')](_0x541a83,_0x3dbbb1)['then'](function(_0x3bf4a7){logger[_0x9f6d('0xc')](_0x9f6d('0xd'),_0x2ff481,_0x9f6d('0xe'));logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x2ff481,_0x9f6d('0xe'),JSON[_0x9f6d('0xf')](_0x3bf4a7));if(_0x3bf4a7[_0x9f6d('0x10')]){if(_0x3bf4a7[_0x9f6d('0x10')][_0x9f6d('0x11')]===0x1f4){logger[_0x9f6d('0x10')](_0x9f6d('0xd'),_0x2ff481,_0x3bf4a7[_0x9f6d('0x10')][_0x9f6d('0x12')]);return _0x52207c(_0x3bf4a7['error'][_0x9f6d('0x12')]);}logger[_0x9f6d('0x10')](_0x9f6d('0xd'),_0x2ff481,_0x3bf4a7[_0x9f6d('0x10')][_0x9f6d('0x12')]);return _0x2d5a03(_0x3bf4a7[_0x9f6d('0x10')][_0x9f6d('0x12')]);}else{logger[_0x9f6d('0xc')](_0x9f6d('0xd'),_0x2ff481,_0x9f6d('0xe'));_0x2d5a03(_0x3bf4a7[_0x9f6d('0x13')][_0x9f6d('0x12')]);}})[_0x9f6d('0x14')](function(_0x2f1a94){logger[_0x9f6d('0x10')](_0x9f6d('0xd'),_0x2ff481,_0x2f1a94);_0x52207c(_0x2f1a94);});});}exports['UpdateFaxApplication']=function(_0x309ea6){var _0x1bb199=this;return new Promise(function(_0x48987b,_0x57a556){return db[_0x9f6d('0x15')][_0x9f6d('0x16')](_0x309ea6['body'],{'raw':_0x309ea6[_0x9f6d('0x17')]?_0x309ea6[_0x9f6d('0x17')][_0x9f6d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x309ea6['options']?_0x309ea6[_0x9f6d('0x17')]['where']||null:null,'attributes':_0x309ea6[_0x9f6d('0x17')]?_0x309ea6[_0x9f6d('0x17')][_0x9f6d('0x19')]||null:null,'limit':_0x309ea6['options']?_0x309ea6[_0x9f6d('0x17')][_0x9f6d('0x1a')]||null:null})[_0x9f6d('0x1b')](function(_0x25099c){logger[_0x9f6d('0xc')](_0x9f6d('0x1c'),_0x309ea6);logger[_0x9f6d('0x1d')](_0x9f6d('0x1c'),_0x309ea6,JSON['stringify'](_0x25099c));_0x48987b(_0x25099c);})[_0x9f6d('0x14')](function(_0x4f5e86){logger[_0x9f6d('0x10')](_0x9f6d('0x1c'),_0x4f5e86[_0x9f6d('0x12')],_0x309ea6);_0x57a556(_0x1bb199[_0x9f6d('0x10')](0x1f4,_0x4f5e86[_0x9f6d('0x12')]));});});}; \ No newline at end of file +var _0x86f4=['info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x1c191a,_0x8b576b){var _0xe436a=function(_0x265abb){while(--_0x265abb){_0x1c191a['push'](_0x1c191a['shift']());}};_0xe436a(++_0x8b576b);}(_0x86f4,0x18a));var _0x486f=function(_0x5bb723,_0x447d85){_0x5bb723=_0x5bb723-0x0;var _0x408223=_0x86f4[_0x5bb723];return _0x408223;};'use strict';var _=require(_0x486f('0x0'));var util=require(_0x486f('0x1'));var moment=require(_0x486f('0x2'));var BPromise=require(_0x486f('0x3'));var rs=require(_0x486f('0x4'));var fs=require('fs');var Redis=require(_0x486f('0x5'));var db=require(_0x486f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x486f('0x7'))(_0x486f('0x8'));var config=require('../../config/environment');var jayson=require(_0x486f('0x9'));var client=jayson[_0x486f('0xa')][_0x486f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x207201,_0x3c6469,_0x3a0791){return new BPromise(function(_0x5bfabc,_0x33363d){return client[_0x486f('0xc')](_0x207201,_0x3a0791)[_0x486f('0xd')](function(_0x468a82){logger[_0x486f('0xe')](_0x486f('0xf'),_0x3c6469,_0x486f('0x10'));logger[_0x486f('0x11')](_0x486f('0x12'),_0x3c6469,_0x486f('0x10'),JSON[_0x486f('0x13')](_0x468a82));if(_0x468a82[_0x486f('0x14')]){if(_0x468a82[_0x486f('0x14')][_0x486f('0x15')]===0x1f4){logger[_0x486f('0x14')](_0x486f('0xf'),_0x3c6469,_0x468a82[_0x486f('0x14')]['message']);return _0x33363d(_0x468a82[_0x486f('0x14')]['message']);}logger[_0x486f('0x14')](_0x486f('0xf'),_0x3c6469,_0x468a82[_0x486f('0x14')]['message']);return _0x5bfabc(_0x468a82['error'][_0x486f('0x16')]);}else{logger[_0x486f('0xe')]('FaxApplication,\x20%s,\x20%s',_0x3c6469,_0x486f('0x10'));_0x5bfabc(_0x468a82[_0x486f('0x17')][_0x486f('0x16')]);}})['catch'](function(_0x53561a){logger[_0x486f('0x14')](_0x486f('0xf'),_0x3c6469,_0x53561a);_0x33363d(_0x53561a);});});}exports[_0x486f('0x18')]=function(_0x39bfac){var _0x4e68d1=this;return new Promise(function(_0x59deb8,_0x268eb9){return db[_0x486f('0x19')][_0x486f('0x1a')](_0x39bfac[_0x486f('0x1b')],{'raw':_0x39bfac[_0x486f('0x1c')]?_0x39bfac[_0x486f('0x1c')][_0x486f('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39bfac[_0x486f('0x1c')]?_0x39bfac[_0x486f('0x1c')][_0x486f('0x1e')]||null:null,'attributes':_0x39bfac[_0x486f('0x1c')]?_0x39bfac[_0x486f('0x1c')][_0x486f('0x1f')]||null:null,'limit':_0x39bfac[_0x486f('0x1c')]?_0x39bfac[_0x486f('0x1c')][_0x486f('0x20')]||null:null})['then'](function(_0x4481ab){logger[_0x486f('0xe')](_0x486f('0x18'),_0x39bfac);logger[_0x486f('0x11')](_0x486f('0x18'),_0x39bfac,JSON[_0x486f('0x13')](_0x4481ab));_0x59deb8(_0x4481ab);})[_0x486f('0x21')](function(_0xbf5f3a){logger[_0x486f('0x14')](_0x486f('0x18'),_0xbf5f3a[_0x486f('0x16')],_0x39bfac);_0x268eb9(_0x4e68d1[_0x486f('0x14')](0x1f4,_0xbf5f3a[_0x486f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 7135f99..c890af7 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 _0x1775=['../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x39e2d7,_0x183beb){var _0x435ff0=function(_0x1fdb01){while(--_0x1fdb01){_0x39e2d7['push'](_0x39e2d7['shift']());}};_0x435ff0(++_0x183beb);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var fs_extra=require(_0x5177('0x5'));var auth=require(_0x5177('0x6'));var interaction=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var controller=require(_0x5177('0x9'));router[_0x5177('0xa')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0xc')]);router[_0x5177('0xa')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0xe')]);router[_0x5177('0xf')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0x10')]);router[_0x5177('0x11')](_0x5177('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5177('0x12')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0x13')]);module[_0x5177('0x14')]=router; \ No newline at end of file +var _0xe605=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x55143b,_0x31b9e4){var _0x4e6cb0=function(_0x323915){while(--_0x323915){_0x55143b['push'](_0x55143b['shift']());}};_0x4e6cb0(++_0x31b9e4);}(_0xe605,0x92));var _0x5e60=function(_0x3e24a6,_0x3a274d){_0x3e24a6=_0x3e24a6-0x0;var _0x2ad67b=_0xe605[_0x3e24a6];return _0x2ad67b;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/:id',auth[_0x5e60('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5e60('0xd')]);router[_0x5e60('0xe')](_0x5e60('0xf'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x10')]);router[_0x5e60('0x11')]('/:id',auth[_0x5e60('0xb')](),controller['destroy']);module[_0x5e60('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 354b1fe..a8f6031 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 _0x5ef0=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x412cdf,_0x54a64f){var _0xae078e=function(_0x361d4a){while(--_0x361d4a){_0x412cdf['push'](_0x412cdf['shift']());}};_0xae078e(++_0x54a64f);}(_0x5ef0,0xba));var _0x05ef=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5ef0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x05ef('0x0'));module[_0x05ef('0x1')]={'closed':{'type':Sequelize[_0x05ef('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x05ef('0x3')]},'disposition':{'type':Sequelize[_0x05ef('0x4')]},'secondDisposition':{'type':Sequelize[_0x05ef('0x4')]},'thirdDisposition':{'type':Sequelize[_0x05ef('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x05ef('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x05ef('0x5')]('in',_0x05ef('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x05ef('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x05ef('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x832f=['DATE','STRING','ENUM','out','exports','BOOLEAN'];(function(_0x1e7a14,_0x50d503){var _0x220d34=function(_0xd655d6){while(--_0xd655d6){_0x1e7a14['push'](_0x1e7a14['shift']());}};_0x220d34(++_0x50d503);}(_0x832f,0x12a));var _0xf832=function(_0x33dcf7,_0x3d5390){_0x33dcf7=_0x33dcf7-0x0;var _0x542d4e=_0x832f[_0x33dcf7];return _0x542d4e;};'use strict';var Sequelize=require('sequelize');module[_0xf832('0x0')]={'closed':{'type':Sequelize[_0xf832('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf832('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xf832('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xf832('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xf832('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf832('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xf832('0x4')]('in',_0xf832('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 79e2565..eb2c52a 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 _0xcf4f=['destroy','error','stack','name','Users','map','fullname','Tags','TagIds','forEach','push','catch','waiting','talking','answered','unmanaged','closed','UserId','total','FaxInteraction','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','field','color','from','tools_tags','select','u.fullname','ui.FaxInteractionId','users','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','length','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','body','some','compact','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','having','tag','isArray','filter','replace','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','user','role','agent','getFaxAccounts','isEmpty','i.FaxAccountId\x20IS\x20NULL','FaxAccountId','sequelize','toString','keyBy','merge','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','include','options','create','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','rawAttributes','nolimit','FaxInteractionId','findAll','addTags','spread','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then'];(function(_0x441301,_0x4896af){var _0x5f1a90=function(_0x2abe45){while(--_0x2abe45){_0x441301['push'](_0x441301['shift']());}};_0x5f1a90(++_0x4896af);}(_0xcf4f,0x186));var _0xfcf4=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xcf4f[_0x27af45];return _0x18df21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfcf4('0x0'));var zipdir=require(_0xfcf4('0x1'));var jsonpatch=require(_0xfcf4('0x2'));var rp=require(_0xfcf4('0x3'));var moment=require(_0xfcf4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfcf4('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xfcf4('0x6'));var ejs=require(_0xfcf4('0x7'));var fs=require('fs');var fs_extra=require(_0xfcf4('0x8'));var _=require(_0xfcf4('0x9'));var squel=require(_0xfcf4('0xa'));var crypto=require(_0xfcf4('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfcf4('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfcf4('0xc'));var authService=require(_0xfcf4('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfcf4('0xe'));var logger=require(_0xfcf4('0xf'))(_0xfcf4('0x10'));var utils=require(_0xfcf4('0x11'));var config=require(_0xfcf4('0x12'));var licenseUtil=require(_0xfcf4('0x13'));var db=require('../../mysqldb')['db'];config[_0xfcf4('0x14')]=_[_0xfcf4('0x15')](config[_0xfcf4('0x14')],{'host':_0xfcf4('0x16'),'port':0x18eb});var socket=require(_0xfcf4('0x17'))(new Redis(config[_0xfcf4('0x14')]));require('./faxInteraction.socket')[_0xfcf4('0x18')](socket);function respondWithStatusCode(_0x3216fe,_0x9f7e8e){_0x9f7e8e=_0x9f7e8e||0xcc;return function(_0x2b2cf4){if(_0x2b2cf4){return _0x3216fe[_0xfcf4('0x19')](_0x9f7e8e);}return _0x3216fe['status'](_0x9f7e8e)[_0xfcf4('0x1a')]();};}function respondWithResult(_0xbffea4,_0x115c88){_0x115c88=_0x115c88||0xc8;return function(_0x4682be){if(_0x4682be){return _0xbffea4[_0xfcf4('0x1b')](_0x115c88)[_0xfcf4('0x1c')](_0x4682be);}};}function respondWithFilteredResult(_0x2afc45,_0x3c9d71){return function(_0x489900){if(_0x489900){var _0x20ce04=typeof _0x3c9d71[_0xfcf4('0x1d')]===_0xfcf4('0x1e')&&typeof _0x3c9d71[_0xfcf4('0x1f')]===_0xfcf4('0x1e');var _0x165cab=_0x489900[_0xfcf4('0x20')];var _0x2e4d4f=_0x20ce04?0x0:_0x3c9d71[_0xfcf4('0x1d')];var _0x3ef2c1=_0x20ce04?_0x489900['count']:_0x3c9d71[_0xfcf4('0x1d')]+_0x3c9d71[_0xfcf4('0x1f')];var _0x14a8bd;if(_0x3ef2c1>=_0x165cab){_0x3ef2c1=_0x165cab;_0x14a8bd=0xc8;}else{_0x14a8bd=0xce;}_0x2afc45[_0xfcf4('0x1b')](_0x14a8bd);return _0x2afc45[_0xfcf4('0x21')](_0xfcf4('0x22'),_0x2e4d4f+'-'+_0x3ef2c1+'/'+_0x165cab)[_0xfcf4('0x1c')](_0x489900);}return null;};}function patchUpdates(_0x332d6b){return function(_0x4f9cbf){try{jsonpatch['apply'](_0x4f9cbf,_0x332d6b,!![]);}catch(_0x3072c4){return BPromise[_0xfcf4('0x23')](_0x3072c4);}return _0x4f9cbf['save']();};}function saveUpdates(_0x41643c,_0x34bbc2){return function(_0x582163){if(_0x582163){return _0x582163[_0xfcf4('0x24')](_0x41643c)[_0xfcf4('0x25')](function(_0x214bc1){return _0x214bc1;});}return null;};}function removeEntity(_0x94c9ec,_0x4e3887){return function(_0x323110){if(_0x323110){return _0x323110[_0xfcf4('0x26')]()[_0xfcf4('0x25')](function(){_0x94c9ec[_0xfcf4('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x587774,_0x586408){return function(_0x5d21ce){if(!_0x5d21ce){_0x587774[_0xfcf4('0x19')](0x194);}return _0x5d21ce;};}function handleError(_0x4e19a5,_0x5e9615){_0x5e9615=_0x5e9615||0x1f4;return function(_0x11b64f){logger[_0xfcf4('0x27')](_0x11b64f[_0xfcf4('0x28')]);if(_0x11b64f[_0xfcf4('0x29')]){delete _0x11b64f['name'];}_0x4e19a5[_0xfcf4('0x1b')](_0x5e9615)['send'](_0x11b64f);};}function getInteractionUsers(_0x24c405,_0x1a8c8c){return new BPromise(function(_0x58c0ca,_0x1a68ba){try{if(_0x1a8c8c[_0x24c405['id']]){_0x24c405[_0xfcf4('0x2a')]=_[_0xfcf4('0x2b')](_0x1a8c8c[_0x24c405['id']],function(_0x252c5e){return{'id':_0x252c5e['id'],'fullname':_0x252c5e[_0xfcf4('0x2c')]};});}}catch(_0x31d516){_0x1a68ba(_0x31d516);}_0x58c0ca(_0x24c405);});}function getInteractionTags(_0x8474d3,_0x4eb9ca){return new BPromise(function(_0x14b809,_0xd35057){try{if(_0x8474d3['TagIds']){_0x8474d3[_0xfcf4('0x2d')]=[];_0x8474d3[_0xfcf4('0x2e')]['split'](',')[_0xfcf4('0x2f')](function(_0x41759d){_0x8474d3[_0xfcf4('0x2d')][_0xfcf4('0x30')](_0x4eb9ca[_0x41759d]);});}delete _0x8474d3[_0xfcf4('0x2e')];}catch(_0x21b02e){_0xd35057(_0x21b02e);}_0x14b809(_0x8474d3);});}function updateFaxInteraction(_0x3ec8ef,_0xe63c1,_0x39bf25){return new BPromise(function(_0xd47ab7,_0x1cdc49){return getInteractionUsers(_0x3ec8ef,_0x39bf25)[_0xfcf4('0x25')](function(_0x40fc40){return getInteractionTags(_0x40fc40,_0xe63c1);})[_0xfcf4('0x25')](function(_0x50b793){return getStateInteraction(_0x50b793);})[_0xfcf4('0x25')](function(_0x33d827){_0xd47ab7(_0x33d827);})[_0xfcf4('0x31')](function(_0x257158){_0x1cdc49(_0x257158);});});}function getStateInteraction(_0x36740e){return new BPromise(function(_0x32a79a){_0x36740e[_0xfcf4('0x32')]=0x0;_0x36740e[_0xfcf4('0x33')]=0x0;_0x36740e[_0xfcf4('0x34')]=0x0;_0x36740e[_0xfcf4('0x35')]=0x0;_0x36740e['total']=0x0;if(!_0x36740e[_0xfcf4('0x36')]&&!_0x36740e[_0xfcf4('0x37')]){_0x36740e[_0xfcf4('0x32')]+=0x1;}if(!_0x36740e[_0xfcf4('0x36')]&&_0x36740e[_0xfcf4('0x37')]){_0x36740e[_0xfcf4('0x33')]+=0x1;if(_0x36740e[_0xfcf4('0x32')]){_0x36740e[_0xfcf4('0x32')]-=0x1;}}if(_0x36740e[_0xfcf4('0x36')]&&_0x36740e[_0xfcf4('0x37')]){_0x36740e[_0xfcf4('0x34')]+=0x1;if(_0x36740e[_0xfcf4('0x33')]){_0x36740e[_0xfcf4('0x33')]-=0x1;}}if(_0x36740e['closed']&&!_0x36740e[_0xfcf4('0x37')]){_0x36740e[_0xfcf4('0x35')]+=0x1;if(_0x36740e[_0xfcf4('0x32')]){_0x36740e[_0xfcf4('0x32')]-=0x1;}}_0x36740e[_0xfcf4('0x38')]+=0x1;_0x32a79a(_0x36740e);});}exports['index']=function(_0x1f2d17,_0x4ae393){var _0x171f13={},_0x293739={},_0x5475dd={'count':0x0,'rows':[]};var _0x5389ea=_[_0xfcf4('0x2b')](db[_0xfcf4('0x39')]['rawAttributes'],function(_0x55ee08){return{'name':_0x55ee08['fieldName'],'type':_0x55ee08[_0xfcf4('0x3a')]['key']};});_0x293739[_0xfcf4('0x3b')]=_[_0xfcf4('0x2b')](_0x5389ea,'name');_0x293739[_0xfcf4('0x3c')]=_[_0xfcf4('0x3d')](_0x1f2d17[_0xfcf4('0x3c')]);_0x293739[_0xfcf4('0x3e')]=_[_0xfcf4('0x3f')](_0x293739[_0xfcf4('0x3b')],_0x293739['query']);_0x171f13[_0xfcf4('0x40')]=_['intersection'](_0x293739['model'],qs[_0xfcf4('0x41')](_0x1f2d17[_0xfcf4('0x3c')][_0xfcf4('0x41')]));_0x171f13[_0xfcf4('0x40')]=_0x171f13['attributes']['length']?_0x171f13[_0xfcf4('0x40')]:_0x293739[_0xfcf4('0x3b')];if(!_0x1f2d17['query'][_0xfcf4('0x42')]('nolimit')){_0x171f13['limit']=qs[_0xfcf4('0x1f')](_0x1f2d17[_0xfcf4('0x3c')][_0xfcf4('0x1f')]);_0x171f13[_0xfcf4('0x1d')]=qs[_0xfcf4('0x1d')](_0x1f2d17[_0xfcf4('0x3c')][_0xfcf4('0x1d')]);}_0x171f13['order']=qs[_0xfcf4('0x43')](_0x1f2d17['query']['sort']);_0x171f13['where']=qs[_0xfcf4('0x3e')](_[_0xfcf4('0x44')](_0x1f2d17[_0xfcf4('0x3c')],_0x293739[_0xfcf4('0x3e')]),_0x5389ea);var _0x4d3e75=[];var _0x582a57=squel['select']()['field']('id')[_0xfcf4('0x45')](_0xfcf4('0x29'))['field'](_0xfcf4('0x46'))[_0xfcf4('0x47')](_0xfcf4('0x48'));var _0x203c1c=squel[_0xfcf4('0x49')]()[_0xfcf4('0x45')]('u.id')[_0xfcf4('0x45')](_0xfcf4('0x4a'))[_0xfcf4('0x45')](_0xfcf4('0x4b'))[_0xfcf4('0x47')]('user_has_fax_interactions','ui')['left_join'](_0xfcf4('0x4c'),'u',_0xfcf4('0x4d'));var _0x54a0dd=squel[_0xfcf4('0x49')]()[_0xfcf4('0x47')](_0xfcf4('0x4e'),'i')['left_join'](_0xfcf4('0x4f'),'c',_0xfcf4('0x50'))[_0xfcf4('0x51')](_0xfcf4('0x4c'),'o','o.id\x20=\x20i.UserId')[_0xfcf4('0x51')]('fax_accounts','a',_0xfcf4('0x52'))[_0xfcf4('0x51')](_0xfcf4('0x53'),'me',_0xfcf4('0x54'))['left_join']('fax_interaction_has_tags','it',_0xfcf4('0x55'))['left_join'](_0xfcf4('0x48'),'t',_0xfcf4('0x56'));var _0x5483ac=squel['expr']();var _0x6c8ab5=[];var _0x3d8805=squel[_0xfcf4('0x57')]();var _0x2c1e10;if(_0x1f2d17[_0xfcf4('0x3c')][_0xfcf4('0x58')]){_0x2c1e10=as[_0xfcf4('0x59')](_0x1f2d17[_0xfcf4('0x3c')][_0xfcf4('0x58')]);var _0x3a8d7d=_0x2c1e10['sqlOperator'];for(var _0x23de79=0x0;_0x23de79<_0x2c1e10[_0xfcf4('0x5a')]['length'];_0x23de79++){var _0x2edfc2=_0x2c1e10[_0xfcf4('0x5a')][_0x23de79];var _0x2ced82='i';var _0x4a32d9=_[_0xfcf4('0x5b')](_0x5389ea,[_0xfcf4('0x29'),_0x2edfc2[_0xfcf4('0x45')]]);if(!_0x4a32d9){switch(_0x2edfc2[_0xfcf4('0x45')]){case _0xfcf4('0x5c'):if(_0x2edfc2[_0xfcf4('0x5d')]==0x1){_0x54a0dd['having']('`'+_0x2edfc2[_0xfcf4('0x45')]+_0xfcf4('0x5e'));}else{_0x54a0dd['having']('`'+_0x2edfc2[_0xfcf4('0x45')]+_0xfcf4('0x5f'));}break;case _0xfcf4('0x60'):if(_0x2edfc2[_0xfcf4('0x61')]===_0xfcf4('0x62')){if(_0x2edfc2[_0xfcf4('0x5d')][_0xfcf4('0x63')]('\x20')[_0xfcf4('0x64')]>0x1){_0x5483ac[_0x3a8d7d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xfcf4('0x65')](_0x2edfc2[_0xfcf4('0x5d')]),null);}else{var _0x493fdc='%'+_0x2edfc2[_0xfcf4('0x5d')]+'%';_0x5483ac[_0x3a8d7d](_0xfcf4('0x66'),_0x493fdc,_0x493fdc,_0x493fdc);}}else{_0x4a32d9=_[_0xfcf4('0x5b')](_0x5389ea,[_0xfcf4('0x29'),_0xfcf4('0x67')]);_0x2edfc2[_0xfcf4('0x45')]=_0xfcf4('0x67');_0x3a4058=as['buildExpression'](_0x2ced82,_0x4a32d9['type'],_0x2edfc2);_0x5483ac[_0x3a8d7d](_0x3a4058[_0xfcf4('0x68')],_0x3a4058[_0xfcf4('0x5d')][_0xfcf4('0x69')],_0x3a4058[_0xfcf4('0x5d')][_0xfcf4('0x1a')]);}break;case _0xfcf4('0x6a'):var _0x501043=_0x2edfc2['value']['split'](',')[_0xfcf4('0x2b')](function(_0x4c8007){return Number(_0x4c8007);});_0x501043[_0xfcf4('0x2f')](function(_0x2a7add){_0x3d8805['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2a7add+',%');});_0x6c8ab5=_[_0xfcf4('0x6b')](_0x6c8ab5,_0x501043);break;case _0xfcf4('0x6c'):if(_0x2edfc2['operator']==='$substring'){_0x5483ac[_0x3a8d7d](_0xfcf4('0x6d'),'%'+_0x2edfc2['value']+'%',null);}else{_0x4a32d9=_[_0xfcf4('0x5b')](_0x5389ea,[_0xfcf4('0x29'),_0xfcf4('0x37')]);_0x2edfc2[_0xfcf4('0x45')]=_0xfcf4('0x37');_0x3a4058=as[_0xfcf4('0x6e')](_0x2ced82,_0x4a32d9[_0xfcf4('0x3a')],_0x2edfc2);_0x5483ac[_0x3a8d7d](_0x3a4058[_0xfcf4('0x68')],_0x3a4058[_0xfcf4('0x5d')][_0xfcf4('0x69')],_0x3a4058[_0xfcf4('0x5d')][_0xfcf4('0x1a')]);}break;case _0xfcf4('0x6f'):_0x3a4058=as[_0xfcf4('0x6e')]('me',null,_0x2edfc2);_0x5483ac[_0x3a8d7d](_0x3a4058[_0xfcf4('0x68')],_0x3a4058[_0xfcf4('0x5d')][_0xfcf4('0x69')],_0x3a4058[_0xfcf4('0x5d')]['end']);break;}}else{var _0x3a4058=as[_0xfcf4('0x6e')](_0x2ced82,_0x4a32d9[_0xfcf4('0x3a')],_0x2edfc2);_0x5483ac[_0x3a8d7d](_0x3a4058[_0xfcf4('0x68')],_0x3a4058[_0xfcf4('0x5d')]['start'],_0x3a4058[_0xfcf4('0x5d')][_0xfcf4('0x1a')]);}}}else{var _0x524d17=_(_0x1f2d17['query'])[_0xfcf4('0x3d')]()['map'](function(_0x156631){return _[_0xfcf4('0x70')](_0x5389ea,[_0xfcf4('0x29'),_0x156631])?_0x156631:undefined;})[_0xfcf4('0x71')]()[_0xfcf4('0x5d')]();if(!_['isEmpty'](_0x524d17)){_0x524d17[_0xfcf4('0x2f')](function(_0x66e151){if(_0x66e151==='FaxAccountId'){_0x54a0dd['where'](_0xfcf4('0x72'),[][_0xfcf4('0x73')](_0x1f2d17[_0xfcf4('0x3c')][_0x66e151]));}else if(_0x66e151===_0xfcf4('0x74')){var _0x5db5c9=JSON['parse'](_0x1f2d17[_0xfcf4('0x3c')][_0x66e151])[_0xfcf4('0x75')];var _0xe47680=JSON[_0xfcf4('0x76')](_0x1f2d17['query'][_0x66e151])[_0xfcf4('0x77')];_0x54a0dd[_0xfcf4('0x78')](_0xfcf4('0x79'),_0x5db5c9,_0xe47680);}else{if(_0x1f2d17[_0xfcf4('0x3c')][_0x66e151]==='null'){_0x54a0dd['where']('i.'+_0x66e151+_0xfcf4('0x7a'));}else{_0x54a0dd[_0xfcf4('0x78')]('i.'+_0x66e151+_0xfcf4('0x7b'),_0x1f2d17[_0xfcf4('0x3c')][_0x66e151]);}}});}if(_0x1f2d17[_0xfcf4('0x3c')][_0xfcf4('0x7c')]){if(_0x1f2d17[_0xfcf4('0x3c')][_0xfcf4('0x7c')]==0x1){_0x54a0dd[_0xfcf4('0x7d')]('`unreadMessages`\x20=\x200');}else{_0x54a0dd[_0xfcf4('0x7d')]('`unreadMessages`\x20>\x200');}}if(_0x1f2d17[_0xfcf4('0x3c')][_0xfcf4('0x7e')]){_0x6c8ab5=_[_0xfcf4('0x7f')](_0x1f2d17[_0xfcf4('0x3c')][_0xfcf4('0x7e')])?_0x1f2d17[_0xfcf4('0x3c')][_0xfcf4('0x7e')]:new Array(_0x1f2d17[_0xfcf4('0x3c')]['tag']);_0x6c8ab5[_0xfcf4('0x2f')](function(_0x2209a7){_0x3d8805['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2209a7+',%');});}if(_0x1f2d17[_0xfcf4('0x3c')][_0xfcf4('0x80')]){var _0x792d4f=_0x1f2d17[_0xfcf4('0x3c')][_0xfcf4('0x80')][_0xfcf4('0x81')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x792d4f)){_0x5483ac['or']('i.id\x20LIKE\x20?',_0x792d4f+'%')['or'](_0xfcf4('0x82'),_0x792d4f+'%');}_0x5483ac['or'](_0xfcf4('0x83'),_0x792d4f+'%');}}_0x54a0dd[_0xfcf4('0x78')](_0x5483ac);_0x54a0dd[_0xfcf4('0x84')](_0xfcf4('0x85'));var _0x20e0c2={'type':db[_0xfcf4('0x86')][_0xfcf4('0x87')][_0xfcf4('0x88')],'raw':!![]};var _0x502215=_0x54a0dd[_0xfcf4('0x89')]();_0x502215[_0xfcf4('0x45')](_0xfcf4('0x85'));_0x502215[_0xfcf4('0x45')](_0xfcf4('0x8a'),_0xfcf4('0x5c'));if(_0x171f13['order']){_0x171f13[_0xfcf4('0x8b')][_0xfcf4('0x2f')](function(_0x556fcd){var _0x51402a=_0x556fcd[0x0]==='contactName'?_0x556fcd[0x0]:'i.'+_0x556fcd[0x0];_0x54a0dd[_0xfcf4('0x8b')](_0x51402a,_0x556fcd[0x1]===_0xfcf4('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0x6c8ab5)){_0x54a0dd[_0xfcf4('0x7d')](_0x3d8805);_0x502215[_0xfcf4('0x78')](_0xfcf4('0x8d'),_0x6c8ab5);}BPromise[_0xfcf4('0x8e')]()[_0xfcf4('0x25')](function(){if(!_0x2c1e10){if(_0x1f2d17[_0xfcf4('0x3c')]['FaxAccountId'])return;_0x502215['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x54a0dd['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x1f2d17[_0xfcf4('0x8f')][_0xfcf4('0x90')]!==_0xfcf4('0x91'))return;return _0x1f2d17[_0xfcf4('0x8f')][_0xfcf4('0x92')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3d7edf){if(_[_0xfcf4('0x93')](_0x3d7edf)){_0x502215[_0xfcf4('0x78')](_0xfcf4('0x94'));_0x54a0dd[_0xfcf4('0x78')](_0xfcf4('0x94'));}else{_0x502215['where']('i.FaxAccountId\x20IN\x20?',_[_0xfcf4('0x2b')](_0x3d7edf,'id'));_0x54a0dd['where'](_0xfcf4('0x72'),_[_0xfcf4('0x2b')](_0x3d7edf,'id'));}});})['then'](function(){if(_0x1f2d17[_0xfcf4('0x8f')][_0xfcf4('0x90')]===_0xfcf4('0x91')&&!_0x2c1e10&&!_0x1f2d17[_0xfcf4('0x3c')][_0xfcf4('0x95')])return[];return db[_0xfcf4('0x96')][_0xfcf4('0x3c')](_0x502215[_0xfcf4('0x97')](),_0x20e0c2);})[_0xfcf4('0x25')](function(_0x31c0cc){_0x5475dd[_0xfcf4('0x20')]=_0x31c0cc[_0xfcf4('0x64')];if(_0x5475dd['count']===0x0)return[];return db['sequelize'][_0xfcf4('0x3c')](_0x582a57[_0xfcf4('0x97')](),_0x20e0c2)[_0xfcf4('0x25')](function(_0x37bac5){_0x4d3e75=_[_0xfcf4('0x98')](_0x37bac5,'id');_0x20e0c2=_[_0xfcf4('0x99')](_0x20e0c2,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1f2d17[_0xfcf4('0x3c')][_0xfcf4('0x41')]){_0x171f13[_0xfcf4('0x40')][_0xfcf4('0x2f')](function(_0x446277){_0x54a0dd['field']('i.'+_0x446277);});}else{_0x54a0dd[_0xfcf4('0x45')](_0xfcf4('0x8a'),_0xfcf4('0x5c'));_0x54a0dd[_0xfcf4('0x45')]('a.key',_0xfcf4('0x9a'));_0x54a0dd[_0xfcf4('0x45')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x54a0dd[_0xfcf4('0x45')](_0xfcf4('0x9b'),'contactName');_0x54a0dd[_0xfcf4('0x45')](_0xfcf4('0x9c'));_0x54a0dd['field'](_0xfcf4('0x9d'),_0xfcf4('0x9e'));_0x54a0dd['field'](_0xfcf4('0x9f'),_0xfcf4('0xa0'));_0x54a0dd[_0xfcf4('0x45')]('c.email','Contact.email');_0x54a0dd[_0xfcf4('0x45')]('c.phone',_0xfcf4('0xa1'));_0x54a0dd[_0xfcf4('0x45')](_0xfcf4('0xa2'),_0xfcf4('0xa3'));_0x54a0dd[_0xfcf4('0x45')](_0xfcf4('0xa4'),'Contact.fax');_0x54a0dd[_0xfcf4('0x45')](_0xfcf4('0xa5'),_0xfcf4('0xa6'));_0x54a0dd[_0xfcf4('0x45')]('o.internal',_0xfcf4('0xa7'));_0x54a0dd[_0xfcf4('0x45')](_0xfcf4('0xa8'),'TagIds');}if(_0x171f13[_0xfcf4('0x1f')])_0x54a0dd['limit'](_0x171f13[_0xfcf4('0x1f')]);if(_0x171f13[_0xfcf4('0x1d')])_0x54a0dd['offset'](_0x171f13['offset']);return db[_0xfcf4('0x96')][_0xfcf4('0x3c')](_0x54a0dd['toString'](),_0x20e0c2);})[_0xfcf4('0x25')](function(_0xc0db9f){if(_0xc0db9f[_0xfcf4('0x64')]>0x0)_0x203c1c[_0xfcf4('0x78')](_0xfcf4('0xa9'),_[_0xfcf4('0x2b')](_0xc0db9f,'id'));return db['sequelize']['query'](_0x203c1c[_0xfcf4('0x97')](),_0x20e0c2)[_0xfcf4('0x25')](function(_0x48a006){var _0xf0913e=_[_0xfcf4('0xaa')](_0x48a006,'FaxInteractionId');var _0x21f8a6=[];_0xc0db9f[_0xfcf4('0x2f')](function(_0x8961c1){_0x21f8a6[_0xfcf4('0x30')](updateFaxInteraction(_0x8961c1,_0x4d3e75,_0xf0913e));});return BPromise[_0xfcf4('0xab')](_0x21f8a6);});});})[_0xfcf4('0x25')](function(_0x137190){_0x5475dd[_0xfcf4('0xac')]=_0x137190;return _0x5475dd;})['then'](respondWithFilteredResult(_0x4ae393,_0x171f13))[_0xfcf4('0x31')](handleError(_0x4ae393,null));};exports[_0xfcf4('0xad')]=function(_0x195291,_0x299f75){var _0xe99a09={'raw':![],'where':{'id':_0x195291[_0xfcf4('0xae')]['id']}},_0x31ae25={};_0x31ae25[_0xfcf4('0x3b')]=_[_0xfcf4('0x3d')](db[_0xfcf4('0x39')]['rawAttributes']);_0x31ae25[_0xfcf4('0x3c')]=_[_0xfcf4('0x3d')](_0x195291[_0xfcf4('0x3c')]);_0x31ae25[_0xfcf4('0x3e')]=_[_0xfcf4('0x3f')](_0x31ae25['model'],_0x31ae25[_0xfcf4('0x3c')]);_0xe99a09['attributes']=_[_0xfcf4('0x3f')](_0x31ae25[_0xfcf4('0x3b')],qs[_0xfcf4('0x41')](_0x195291[_0xfcf4('0x3c')][_0xfcf4('0x41')]));_0xe99a09[_0xfcf4('0x40')]=_0xe99a09[_0xfcf4('0x40')]['length']?_0xe99a09[_0xfcf4('0x40')]:_0x31ae25['model'];if(_0x195291[_0xfcf4('0x3c')][_0xfcf4('0xaf')]){_0xe99a09[_0xfcf4('0xb0')]=[{'all':!![]}];}_0xe99a09=_[_0xfcf4('0x99')]({},_0xe99a09,_0x195291[_0xfcf4('0xb1')]);return db[_0xfcf4('0x39')][_0xfcf4('0x5b')](_0xe99a09)[_0xfcf4('0x25')](handleEntityNotFound(_0x299f75,null))[_0xfcf4('0x25')](respondWithResult(_0x299f75,null))[_0xfcf4('0x31')](handleError(_0x299f75,null));};exports[_0xfcf4('0xb2')]=function(_0x33ef12,_0x2cd010){return db[_0xfcf4('0x39')][_0xfcf4('0xb2')](_0x33ef12['body'],{})['then'](respondWithResult(_0x2cd010,0xc9))[_0xfcf4('0x31')](handleError(_0x2cd010,null));};exports[_0xfcf4('0x24')]=function(_0x2cd939,_0x1a5965){if(_0x2cd939[_0xfcf4('0x6f')]['id']){delete _0x2cd939['body']['id'];}return db[_0xfcf4('0x39')][_0xfcf4('0x5b')]({'where':{'id':_0x2cd939[_0xfcf4('0xae')]['id']}})[_0xfcf4('0x25')](handleEntityNotFound(_0x1a5965,null))[_0xfcf4('0x25')](saveUpdates(_0x2cd939[_0xfcf4('0x6f')],null))[_0xfcf4('0x25')](respondWithResult(_0x1a5965,null))[_0xfcf4('0x31')](handleError(_0x1a5965,null));};exports[_0xfcf4('0x26')]=function(_0x5cf187,_0x36b767){return db[_0xfcf4('0x39')][_0xfcf4('0x5b')]({'where':{'id':_0x5cf187[_0xfcf4('0xae')]['id']}})[_0xfcf4('0x25')](handleEntityNotFound(_0x36b767,null))['then'](removeEntity(_0x36b767,null))['catch'](handleError(_0x36b767,null));};exports['describe']=function(_0x57c194,_0x16852c){return db['FaxInteraction'][_0xfcf4('0xb3')]()[_0xfcf4('0x25')](respondWithResult(_0x16852c,null))[_0xfcf4('0x31')](handleError(_0x16852c,null));};exports[_0xfcf4('0xb4')]=function(_0x3bbfea,_0x12ff42,_0x1eabb8){return db[_0xfcf4('0xb5')][_0xfcf4('0x5b')]({'where':{'id':_0x3bbfea['params']['id']}})[_0xfcf4('0x25')](handleEntityNotFound(_0x12ff42,null))[_0xfcf4('0x25')](function(_0x174b22){if(_0x174b22){return _0x174b22['addMessage'](_0x3bbfea[_0xfcf4('0x6f')]['ids'],_[_0xfcf4('0xb6')](_0x3bbfea[_0xfcf4('0x6f')],[_0xfcf4('0xb7'),'id'])||{});}})['then'](respondWithResult(_0x12ff42,null))[_0xfcf4('0x31')](handleError(_0x12ff42,null));};exports[_0xfcf4('0xb8')]=function(_0x2b24fe,_0x1b1dcc,_0x2beeb2){var _0x494e34={'raw':![],'where':{}};var _0x41de3a={};var _0x315457={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xfcf4('0xb9')]({'where':{'id':_0x2b24fe[_0xfcf4('0xae')]['id']}})[_0xfcf4('0x25')](handleEntityNotFound(_0x1b1dcc,null))['then'](function(_0x53948f){if(_0x53948f){_0x41de3a[_0xfcf4('0x3b')]=_[_0xfcf4('0x3d')](db[_0xfcf4('0xb5')][_0xfcf4('0xba')]);_0x41de3a[_0xfcf4('0x3c')]=_[_0xfcf4('0x3d')](_0x2b24fe[_0xfcf4('0x3c')]);_0x41de3a['filters']=_[_0xfcf4('0x3f')](_0x41de3a[_0xfcf4('0x3b')],_0x41de3a[_0xfcf4('0x3c')]);_0x494e34[_0xfcf4('0x40')]=_['intersection'](_0x41de3a[_0xfcf4('0x3b')],qs['fields'](_0x2b24fe[_0xfcf4('0x3c')][_0xfcf4('0x41')]));_0x494e34['attributes']=_0x494e34[_0xfcf4('0x40')][_0xfcf4('0x64')]?_0x494e34['attributes']:_0x41de3a[_0xfcf4('0x3b')];if(!_0x2b24fe[_0xfcf4('0x3c')][_0xfcf4('0x42')](_0xfcf4('0xbb'))){_0x494e34['limit']=qs[_0xfcf4('0x1f')](_0x2b24fe['query'][_0xfcf4('0x1f')]);_0x494e34[_0xfcf4('0x1d')]=qs['offset'](_0x2b24fe[_0xfcf4('0x3c')]['offset']);}_0x494e34[_0xfcf4('0x8b')]=qs[_0xfcf4('0x43')](_0x2b24fe[_0xfcf4('0x3c')][_0xfcf4('0x43')]);_0x494e34[_0xfcf4('0x78')]=qs['filters'](_[_0xfcf4('0x44')](_0x2b24fe[_0xfcf4('0x3c')],_0x41de3a[_0xfcf4('0x3e')]));_0x494e34[_0xfcf4('0x78')][_0xfcf4('0xbc')]=_0x53948f['id'];if(_0x2b24fe[_0xfcf4('0x3c')][_0xfcf4('0x80')]){_0x494e34[_0xfcf4('0x78')]=_[_0xfcf4('0x99')](_0x494e34[_0xfcf4('0x78')],{'$or':_[_0xfcf4('0x2b')](_0x494e34[_0xfcf4('0x40')],function(_0xb2bbc){var _0x5ecf1f={};_0x5ecf1f[_0xb2bbc]={'$like':'%'+_0x2b24fe['query']['filter']+'%'};return _0x5ecf1f;})});}if(_0x2b24fe[_0xfcf4('0x3c')][_0xfcf4('0x75')]){var _0x4c37da=_0x2b24fe[_0xfcf4('0x3c')][_0xfcf4('0x75')][_0xfcf4('0x63')](',');var _0x25ed8e={};_0x25ed8e[_0x4c37da[0x0]]={'$gte':moment(_0x4c37da[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x494e34[_0xfcf4('0x78')]=_[_0xfcf4('0x99')](_0x494e34[_0xfcf4('0x78')],_0x25ed8e);}_0x494e34=_[_0xfcf4('0x99')]({},_0x494e34,_0x2b24fe[_0xfcf4('0xb1')]);return db['FaxMessage'][_0xfcf4('0x20')]({'where':_0x494e34[_0xfcf4('0x78')]})['then'](function(_0x3cc2e3){_0x315457['count']=_0x3cc2e3;if(_0x2b24fe[_0xfcf4('0x3c')][_0xfcf4('0xaf')]){_0x494e34['include']=[{'all':!![]}];}return db[_0xfcf4('0xb5')][_0xfcf4('0xbd')](_0x494e34);})[_0xfcf4('0x25')](function(_0x3a077c){_0x315457['rows']=_0x3a077c;return _0x315457;});}})[_0xfcf4('0x25')](respondWithFilteredResult(_0x1b1dcc,_0x494e34))[_0xfcf4('0x31')](handleError(_0x1b1dcc,null));};exports[_0xfcf4('0xbe')]=function(_0x1344a2,_0x2a107e,_0x42b244){return db[_0xfcf4('0x39')]['find']({'where':{'id':_0x1344a2[_0xfcf4('0xae')]['id']}})[_0xfcf4('0x25')](handleEntityNotFound(_0x2a107e,null))[_0xfcf4('0x25')](function(_0x2abb58){if(_0x2abb58){return _0x2abb58['setTags'](_0x1344a2[_0xfcf4('0x6f')]['ids'],_[_0xfcf4('0xb6')](_0x1344a2[_0xfcf4('0x6f')],[_0xfcf4('0xb7'),'id'])||{})[_0xfcf4('0xbf')](function(){return db['Tag'][_0xfcf4('0xbd')]({'attributes':['id',_0xfcf4('0x29'),_0xfcf4('0x46')],'where':{'id':_0x1344a2[_0xfcf4('0x6f')][_0xfcf4('0xb7')]}});})[_0xfcf4('0x25')](function(_0x434ad6){socket['emit'](_0xfcf4('0xc0'),{'id':Number(_0x1344a2[_0xfcf4('0xae')]['id']),'tags':_0x434ad6||[]});return{'id':Number(_0x1344a2[_0xfcf4('0xae')]['id']),'tags':_0x434ad6||[]};});}})[_0xfcf4('0x25')](respondWithResult(_0x2a107e,null))[_0xfcf4('0x31')](handleError(_0x2a107e,null));};exports[_0xfcf4('0xc1')]=function(_0x1df5d0,_0x210e2e,_0x343905){return db['FaxInteraction']['find']({'where':{'id':_0x1df5d0[_0xfcf4('0xae')]['id']}})[_0xfcf4('0x25')](handleEntityNotFound(_0x210e2e,null))[_0xfcf4('0x25')](function(_0x16198d){if(_0x16198d){return _0x16198d[_0xfcf4('0xc1')](_0x1df5d0[_0xfcf4('0x3c')]['ids']);}})['then'](respondWithStatusCode(_0x210e2e,null))[_0xfcf4('0x31')](handleError(_0x210e2e,null));};exports[_0xfcf4('0xc2')]=function(_0x266a5b,_0x10b3aa){var _0x3e1683=moment()[_0xfcf4('0xc3')]()[_0xfcf4('0x97')]();var _0x5026ae=path[_0xfcf4('0xc4')](config[_0xfcf4('0xc5')],_0xfcf4('0xc6'),_0xfcf4('0xc7'),_0xfcf4('0xc8'));var _0x5232a1=path['join'](config[_0xfcf4('0xc5')],'server','files',_0xfcf4('0xc9'));var _0x134a3b=path['join'](_0x5026ae,_0x3e1683);var _0x5a486c=util[_0xfcf4('0xca')]('transcript-%d-%s.zip',_0x266a5b['params']['id'],_0x3e1683);var _0x464849=path[_0xfcf4('0xc4')](_0x5026ae,_0x5a486c);var _0x81d2d=[];_0x81d2d['push']({'model':db[_0xfcf4('0xcb')],'as':_0xfcf4('0xcb'),'raw':!![]});var _0x1153f1=[{'model':db[_0xfcf4('0xb5')],'as':'Messages','attributes':['id','body',_0xfcf4('0x74')],'include':_0x81d2d}];return db[_0xfcf4('0x39')][_0xfcf4('0x5b')]({'where':{'id':_0x266a5b[_0xfcf4('0xae')]['id']},'include':_0x1153f1})['then'](handleEntityNotFound(_0x10b3aa,null))['then'](function(_0x455cc5){if(_0x455cc5&&_0x455cc5[_0xfcf4('0xcc')]){var _0x34c712=_0x455cc5[_0xfcf4('0xcd')]({'plain':!![]});fs[_0xfcf4('0xce')](_0x134a3b);for(var _0x432a57=0x0;_0x432a57<_0x34c712[_0xfcf4('0xcc')][_0xfcf4('0x64')];_0x432a57++){var _0x53a569=_0x34c712[_0xfcf4('0xcc')][_0x432a57][_0xfcf4('0xcb')];if(_0x53a569){var _0x56b944=path['join'](_0x5232a1,_0x53a569[_0xfcf4('0xcf')]);if(fs[_0xfcf4('0xd0')](_0x56b944)){fs[_0xfcf4('0xd1')](_0x56b944)['pipe'](fs[_0xfcf4('0xd2')](path[_0xfcf4('0xc4')](_0x134a3b,_0x53a569[_0xfcf4('0xcf')])));}}}return BPromise[_0xfcf4('0x8e')]()[_0xfcf4('0x25')](function(){return new BPromise(function(_0x31f743,_0x312787){zipdir(_0x134a3b,{'saveTo':_0x464849},function(_0x5846eb,_0x4320af){if(_0x5846eb)return _0x312787(_0x5846eb);return _0x31f743(_0x4320af);});})['then'](function(){return new BPromise(function(_0x34f75c,_0x51862e){rimraf(_0x134a3b,function(_0x2ef90e){if(_0x2ef90e)_0x51862e(_0x2ef90e);return _0x34f75c();});});})[_0xfcf4('0x25')](function(){return _0x10b3aa[_0xfcf4('0xc2')](_0x464849,_0x5a486c,function(_0x1f5ebe){if(_0x1f5ebe){console[_0xfcf4('0xd3')](_0xfcf4('0xd4'),_0x1f5ebe);}else{fs[_0xfcf4('0xd5')](_0x464849);}});});});}else{return _0x10b3aa['sendStatus'](0xc8);}})[_0xfcf4('0x31')](handleError(_0x10b3aa,null));}; \ No newline at end of file +var _0x0159=['clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','rows','catch','params','includeAll','include','options','create','body','describe','addMessage','FaxMessage','ids','getMessages','pick','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','emit','faxInteractionTags:save','removeTags','download','join','root','server','files','attachments','format','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','unlinkSync','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','Users','map','fullname','Tags','forEach','push','TagIds','waiting','talking','answered','closed','UserId','unmanaged','total','index','FaxInteraction','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','select','field','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','expr','search','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','start','buildExpression','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes'];(function(_0x33ecef,_0x47dca9){var _0x1a38fa=function(_0x232958){while(--_0x232958){_0x33ecef['push'](_0x33ecef['shift']());}};_0x1a38fa(++_0x47dca9);}(_0x0159,0x11a));var _0x9015=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0159[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9015('0x0'));var zipdir=require(_0x9015('0x1'));var jsonpatch=require(_0x9015('0x2'));var rp=require('request-promise');var moment=require(_0x9015('0x3'));var BPromise=require(_0x9015('0x4'));var Mustache=require(_0x9015('0x5'));var util=require(_0x9015('0x6'));var path=require(_0x9015('0x7'));var sox=require('sox');var csv=require(_0x9015('0x8'));var ejs=require(_0x9015('0x9'));var fs=require('fs');var fs_extra=require(_0x9015('0xa'));var _=require('lodash');var squel=require(_0x9015('0xb'));var crypto=require(_0x9015('0xc'));var jsforce=require(_0x9015('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9015('0x8'));var querystring=require(_0x9015('0xe'));var Papa=require(_0x9015('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9015('0x10'));var as=require(_0x9015('0x11'));var hardwareService=require(_0x9015('0x12'));var logger=require(_0x9015('0x13'))('api');var utils=require(_0x9015('0x14'));var config=require(_0x9015('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9015('0x16'))['db'];config['redis']=_['defaults'](config[_0x9015('0x17')],{'host':_0x9015('0x18'),'port':0x18eb});var socket=require(_0x9015('0x19'))(new Redis(config[_0x9015('0x17')]));require('./faxInteraction.socket')[_0x9015('0x1a')](socket);function respondWithStatusCode(_0x35f759,_0x4481a1){_0x4481a1=_0x4481a1||0xcc;return function(_0x2e6c66){if(_0x2e6c66){return _0x35f759[_0x9015('0x1b')](_0x4481a1);}return _0x35f759[_0x9015('0x1c')](_0x4481a1)[_0x9015('0x1d')]();};}function respondWithResult(_0x3c792e,_0x198449){_0x198449=_0x198449||0xc8;return function(_0x198d34){if(_0x198d34){return _0x3c792e[_0x9015('0x1c')](_0x198449)[_0x9015('0x1e')](_0x198d34);}};}function respondWithFilteredResult(_0x22c171,_0x833178){return function(_0x501e7c){if(_0x501e7c){var _0x2c1af3=typeof _0x833178[_0x9015('0x1f')]==='undefined'&&typeof _0x833178['limit']===_0x9015('0x20');var _0xc0d8d6=_0x501e7c[_0x9015('0x21')];var _0x3140b0=_0x2c1af3?0x0:_0x833178['offset'];var _0x35ed6c=_0x2c1af3?_0x501e7c[_0x9015('0x21')]:_0x833178['offset']+_0x833178[_0x9015('0x22')];var _0x4c5ddd;if(_0x35ed6c>=_0xc0d8d6){_0x35ed6c=_0xc0d8d6;_0x4c5ddd=0xc8;}else{_0x4c5ddd=0xce;}_0x22c171['status'](_0x4c5ddd);return _0x22c171[_0x9015('0x23')](_0x9015('0x24'),_0x3140b0+'-'+_0x35ed6c+'/'+_0xc0d8d6)['json'](_0x501e7c);}return null;};}function patchUpdates(_0x187569){return function(_0x229ec5){try{jsonpatch[_0x9015('0x25')](_0x229ec5,_0x187569,!![]);}catch(_0x1e4a08){return BPromise[_0x9015('0x26')](_0x1e4a08);}return _0x229ec5[_0x9015('0x27')]();};}function saveUpdates(_0x1a9200,_0x1e630f){return function(_0x5f3f01){if(_0x5f3f01){return _0x5f3f01[_0x9015('0x28')](_0x1a9200)['then'](function(_0x317e21){return _0x317e21;});}return null;};}function removeEntity(_0x4be91e,_0x3a9337){return function(_0x270c00){if(_0x270c00){return _0x270c00[_0x9015('0x29')]()[_0x9015('0x2a')](function(){_0x4be91e[_0x9015('0x1c')](0xcc)[_0x9015('0x1d')]();});}};}function handleEntityNotFound(_0x10c98c,_0x49b156){return function(_0x42ec63){if(!_0x42ec63){_0x10c98c[_0x9015('0x1b')](0x194);}return _0x42ec63;};}function handleError(_0x1f1a4d,_0x2259d4){_0x2259d4=_0x2259d4||0x1f4;return function(_0x32b751){logger['error'](_0x32b751[_0x9015('0x2b')]);if(_0x32b751[_0x9015('0x2c')]){delete _0x32b751[_0x9015('0x2c')];}_0x1f1a4d[_0x9015('0x1c')](_0x2259d4)['send'](_0x32b751);};}function getInteractionUsers(_0x244c2b,_0x1e51c5){return new BPromise(function(_0x40cfca,_0x231674){try{if(_0x1e51c5[_0x244c2b['id']]){_0x244c2b[_0x9015('0x2d')]=_[_0x9015('0x2e')](_0x1e51c5[_0x244c2b['id']],function(_0x42ef35){return{'id':_0x42ef35['id'],'fullname':_0x42ef35[_0x9015('0x2f')]};});}}catch(_0x5bab78){_0x231674(_0x5bab78);}_0x40cfca(_0x244c2b);});}function getInteractionTags(_0x3f06f9,_0x206c5b){return new BPromise(function(_0x4d0b33,_0x35969f){try{if(_0x3f06f9['TagIds']){_0x3f06f9[_0x9015('0x30')]=[];_0x3f06f9['TagIds']['split'](',')[_0x9015('0x31')](function(_0x22e484){_0x3f06f9[_0x9015('0x30')][_0x9015('0x32')](_0x206c5b[_0x22e484]);});}delete _0x3f06f9[_0x9015('0x33')];}catch(_0x2e1544){_0x35969f(_0x2e1544);}_0x4d0b33(_0x3f06f9);});}function updateFaxInteraction(_0x5aaf31,_0x2f03da,_0x5deb1c){return new BPromise(function(_0x331031,_0xc323a6){return getInteractionUsers(_0x5aaf31,_0x5deb1c)[_0x9015('0x2a')](function(_0x322308){return getInteractionTags(_0x322308,_0x2f03da);})[_0x9015('0x2a')](function(_0x8c6a83){return getStateInteraction(_0x8c6a83);})['then'](function(_0x31dd3b){_0x331031(_0x31dd3b);})['catch'](function(_0x437590){_0xc323a6(_0x437590);});});}function getStateInteraction(_0x3f0c8b){return new BPromise(function(_0xbaaef9){_0x3f0c8b[_0x9015('0x34')]=0x0;_0x3f0c8b[_0x9015('0x35')]=0x0;_0x3f0c8b[_0x9015('0x36')]=0x0;_0x3f0c8b['unmanaged']=0x0;_0x3f0c8b['total']=0x0;if(!_0x3f0c8b[_0x9015('0x37')]&&!_0x3f0c8b['UserId']){_0x3f0c8b[_0x9015('0x34')]+=0x1;}if(!_0x3f0c8b[_0x9015('0x37')]&&_0x3f0c8b[_0x9015('0x38')]){_0x3f0c8b[_0x9015('0x35')]+=0x1;if(_0x3f0c8b[_0x9015('0x34')]){_0x3f0c8b[_0x9015('0x34')]-=0x1;}}if(_0x3f0c8b[_0x9015('0x37')]&&_0x3f0c8b[_0x9015('0x38')]){_0x3f0c8b['answered']+=0x1;if(_0x3f0c8b[_0x9015('0x35')]){_0x3f0c8b['talking']-=0x1;}}if(_0x3f0c8b[_0x9015('0x37')]&&!_0x3f0c8b[_0x9015('0x38')]){_0x3f0c8b[_0x9015('0x39')]+=0x1;if(_0x3f0c8b[_0x9015('0x34')]){_0x3f0c8b[_0x9015('0x34')]-=0x1;}}_0x3f0c8b[_0x9015('0x3a')]+=0x1;_0xbaaef9(_0x3f0c8b);});}exports[_0x9015('0x3b')]=function(_0x3562de,_0x55a505){var _0x3f48eb={},_0x5c693c={},_0x2272c4={'count':0x0,'rows':[]};var _0x3ed6ae=_['map'](db[_0x9015('0x3c')][_0x9015('0x3d')],function(_0x1ed51b){return{'name':_0x1ed51b['fieldName'],'type':_0x1ed51b[_0x9015('0x3e')]['key']};});_0x5c693c[_0x9015('0x3f')]=_['map'](_0x3ed6ae,_0x9015('0x2c'));_0x5c693c[_0x9015('0x40')]=_[_0x9015('0x41')](_0x3562de['query']);_0x5c693c['filters']=_[_0x9015('0x42')](_0x5c693c[_0x9015('0x3f')],_0x5c693c['query']);_0x3f48eb[_0x9015('0x43')]=_[_0x9015('0x42')](_0x5c693c['model'],qs['fields'](_0x3562de[_0x9015('0x40')][_0x9015('0x44')]));_0x3f48eb['attributes']=_0x3f48eb['attributes'][_0x9015('0x45')]?_0x3f48eb[_0x9015('0x43')]:_0x5c693c[_0x9015('0x3f')];if(!_0x3562de[_0x9015('0x40')][_0x9015('0x46')](_0x9015('0x47'))){_0x3f48eb[_0x9015('0x22')]=qs[_0x9015('0x22')](_0x3562de['query']['limit']);_0x3f48eb['offset']=qs[_0x9015('0x1f')](_0x3562de[_0x9015('0x40')]['offset']);}_0x3f48eb['order']=qs[_0x9015('0x48')](_0x3562de[_0x9015('0x40')][_0x9015('0x48')]);_0x3f48eb[_0x9015('0x49')]=qs[_0x9015('0x4a')](_['pick'](_0x3562de[_0x9015('0x40')],_0x5c693c['filters']),_0x3ed6ae);var _0x188edd=[];var _0x5a3c91=squel[_0x9015('0x4b')]()[_0x9015('0x4c')]('id')[_0x9015('0x4c')](_0x9015('0x2c'))['field']('color')[_0x9015('0x4d')](_0x9015('0x4e'));var _0x3b0d7a=squel[_0x9015('0x4b')]()[_0x9015('0x4c')](_0x9015('0x4f'))[_0x9015('0x4c')](_0x9015('0x50'))[_0x9015('0x4c')](_0x9015('0x51'))[_0x9015('0x4d')](_0x9015('0x52'),'ui')[_0x9015('0x53')](_0x9015('0x54'),'u','u.id\x20=\x20ui.UserId');var _0x409c94=squel['select']()['from'](_0x9015('0x55'),'i')[_0x9015('0x53')](_0x9015('0x56'),'c',_0x9015('0x57'))[_0x9015('0x53')](_0x9015('0x54'),'o',_0x9015('0x58'))[_0x9015('0x53')](_0x9015('0x59'),'a','a.id\x20=\x20i.FaxAccountId')[_0x9015('0x53')]('fax_messages','me',_0x9015('0x5a'))[_0x9015('0x53')](_0x9015('0x5b'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x9015('0x53')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0xa6522c=squel['expr']();var _0x30f22f=[];var _0x1c9a08=squel[_0x9015('0x5c')]();var _0x558ac2;if(_0x3562de[_0x9015('0x40')][_0x9015('0x5d')]){_0x558ac2=as['parseSearch'](_0x3562de[_0x9015('0x40')][_0x9015('0x5d')]);var _0x1e6da7=_0x558ac2[_0x9015('0x5e')];for(var _0x40a1e4=0x0;_0x40a1e4<_0x558ac2[_0x9015('0x5f')][_0x9015('0x45')];_0x40a1e4++){var _0x252bb3=_0x558ac2[_0x9015('0x5f')][_0x40a1e4];var _0x509fc7='i';var _0x450771=_['find'](_0x3ed6ae,[_0x9015('0x2c'),_0x252bb3[_0x9015('0x4c')]]);if(!_0x450771){switch(_0x252bb3[_0x9015('0x4c')]){case _0x9015('0x60'):if(_0x252bb3['value']==0x1){_0x409c94[_0x9015('0x61')]('`'+_0x252bb3['field']+_0x9015('0x62'));}else{_0x409c94[_0x9015('0x61')]('`'+_0x252bb3[_0x9015('0x4c')]+_0x9015('0x63'));}break;case _0x9015('0x64'):if(_0x252bb3[_0x9015('0x65')]===_0x9015('0x66')){if(_0x252bb3[_0x9015('0x67')][_0x9015('0x68')]('\x20')[_0x9015('0x45')]>0x1){_0xa6522c[_0x1e6da7](_0x9015('0x69'),qs['getFullTextValue'](_0x252bb3[_0x9015('0x67')]),null);}else{var _0x4e6771='%'+_0x252bb3[_0x9015('0x67')]+'%';_0xa6522c[_0x1e6da7](_0x9015('0x6a'),_0x4e6771,_0x4e6771,_0x4e6771);}}else{_0x450771=_[_0x9015('0x6b')](_0x3ed6ae,[_0x9015('0x2c'),'ContactId']);_0x252bb3[_0x9015('0x4c')]=_0x9015('0x6c');_0x48fc72=as['buildExpression'](_0x509fc7,_0x450771[_0x9015('0x3e')],_0x252bb3);_0xa6522c[_0x1e6da7](_0x48fc72[_0x9015('0x6d')],_0x48fc72[_0x9015('0x67')]['start'],_0x48fc72[_0x9015('0x67')][_0x9015('0x1d')]);}break;case _0x9015('0x6e'):var _0x9a03b=_0x252bb3[_0x9015('0x67')][_0x9015('0x68')](',')[_0x9015('0x2e')](function(_0x3a15f3){return Number(_0x3a15f3);});_0x9a03b[_0x9015('0x31')](function(_0x5eebce){_0x1c9a08['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5eebce+',%');});_0x30f22f=_[_0x9015('0x6f')](_0x30f22f,_0x9a03b);break;case'User':if(_0x252bb3[_0x9015('0x65')]===_0x9015('0x66')){_0xa6522c[_0x1e6da7](_0x9015('0x70'),'%'+_0x252bb3[_0x9015('0x67')]+'%',null);}else{_0x450771=_[_0x9015('0x6b')](_0x3ed6ae,[_0x9015('0x2c'),'UserId']);_0x252bb3[_0x9015('0x4c')]=_0x9015('0x38');_0x48fc72=as['buildExpression'](_0x509fc7,_0x450771['type'],_0x252bb3);_0xa6522c[_0x1e6da7](_0x48fc72[_0x9015('0x6d')],_0x48fc72[_0x9015('0x67')][_0x9015('0x71')],_0x48fc72['value']['end']);}break;case'body':_0x48fc72=as[_0x9015('0x72')]('me',null,_0x252bb3);_0xa6522c[_0x1e6da7](_0x48fc72['text'],_0x48fc72[_0x9015('0x67')]['start'],_0x48fc72[_0x9015('0x67')]['end']);break;}}else{var _0x48fc72=as[_0x9015('0x72')](_0x509fc7,_0x450771['type'],_0x252bb3);_0xa6522c[_0x1e6da7](_0x48fc72[_0x9015('0x6d')],_0x48fc72[_0x9015('0x67')][_0x9015('0x71')],_0x48fc72[_0x9015('0x67')][_0x9015('0x1d')]);}}}else{var _0x3ee8f0=_(_0x3562de[_0x9015('0x40')])['keys']()[_0x9015('0x2e')](function(_0x4c7e53){return _[_0x9015('0x73')](_0x3ed6ae,[_0x9015('0x2c'),_0x4c7e53])?_0x4c7e53:undefined;})['compact']()[_0x9015('0x67')]();if(!_[_0x9015('0x74')](_0x3ee8f0)){_0x3ee8f0[_0x9015('0x31')](function(_0x4c1352){if(_0x4c1352===_0x9015('0x75')){_0x409c94[_0x9015('0x49')](_0x9015('0x76'),[]['concat'](_0x3562de[_0x9015('0x40')][_0x4c1352]));}else if(_0x4c1352===_0x9015('0x77')){var _0xed0af7=JSON[_0x9015('0x78')](_0x3562de[_0x9015('0x40')][_0x4c1352])['$gte'];var _0x30ef39=JSON[_0x9015('0x78')](_0x3562de[_0x9015('0x40')][_0x4c1352])['$lte'];_0x409c94['where'](_0x9015('0x79'),_0xed0af7,_0x30ef39);}else{if(_0x3562de[_0x9015('0x40')][_0x4c1352]==='null'){_0x409c94[_0x9015('0x49')]('i.'+_0x4c1352+'\x20IS\x20NULL');}else{_0x409c94[_0x9015('0x49')]('i.'+_0x4c1352+_0x9015('0x7a'),_0x3562de[_0x9015('0x40')][_0x4c1352]);}}});}if(_0x3562de[_0x9015('0x40')][_0x9015('0x7b')]){if(_0x3562de['query'][_0x9015('0x7b')]==0x1){_0x409c94['having']('`unreadMessages`\x20=\x200');}else{_0x409c94[_0x9015('0x61')](_0x9015('0x7c'));}}if(_0x3562de[_0x9015('0x40')]['tag']){_0x30f22f=_[_0x9015('0x7d')](_0x3562de['query'][_0x9015('0x7e')])?_0x3562de[_0x9015('0x40')][_0x9015('0x7e')]:new Array(_0x3562de[_0x9015('0x40')]['tag']);_0x30f22f[_0x9015('0x31')](function(_0x3becdc){_0x1c9a08['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3becdc+',%');});}if(_0x3562de[_0x9015('0x40')]['filter']){var _0x3af9d9=_0x3562de[_0x9015('0x40')][_0x9015('0x7f')]['replace']('\x5c','\x5c\x5c')[_0x9015('0x80')](/'/g,'\x27\x27');if(qs[_0x9015('0x81')](_0x3af9d9)){_0xa6522c['or'](_0x9015('0x82'),_0x3af9d9+'%')['or']('i.fax\x20LIKE\x20?',_0x3af9d9+'%');}_0xa6522c['or'](_0x9015('0x83'),_0x3af9d9+'%');}}_0x409c94['where'](_0xa6522c);_0x409c94[_0x9015('0x84')](_0x9015('0x85'));var _0x21b37b={'type':db[_0x9015('0x86')][_0x9015('0x87')]['SELECT'],'raw':!![]};var _0x31c923=_0x409c94[_0x9015('0x88')]();_0x31c923['field']('i.id');_0x31c923['field'](_0x9015('0x89'),_0x9015('0x60'));if(_0x3f48eb['order']){_0x3f48eb[_0x9015('0x8a')][_0x9015('0x31')](function(_0x3a8fcd){var _0x5e4243=_0x3a8fcd[0x0]==='contactName'?_0x3a8fcd[0x0]:'i.'+_0x3a8fcd[0x0];_0x409c94['order'](_0x5e4243,_0x3a8fcd[0x1]==='DESC'?![]:!![]);});}if(!_[_0x9015('0x74')](_0x30f22f)){_0x409c94[_0x9015('0x61')](_0x1c9a08);_0x31c923[_0x9015('0x49')](_0x9015('0x8b'),_0x30f22f);}BPromise[_0x9015('0x8c')]()['then'](function(){if(!_0x558ac2){if(_0x3562de[_0x9015('0x40')][_0x9015('0x75')])return;_0x31c923[_0x9015('0x49')](_0x9015('0x8d'));_0x409c94[_0x9015('0x49')](_0x9015('0x8d'));return;}if(_0x3562de[_0x9015('0x8e')][_0x9015('0x8f')]!==_0x9015('0x90'))return;return _0x3562de[_0x9015('0x8e')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x9015('0x2a')](function(_0x5ebb75){if(_[_0x9015('0x74')](_0x5ebb75)){_0x31c923[_0x9015('0x49')]('i.FaxAccountId\x20IS\x20NULL');_0x409c94[_0x9015('0x49')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x31c923[_0x9015('0x49')]('i.FaxAccountId\x20IN\x20?',_[_0x9015('0x2e')](_0x5ebb75,'id'));_0x409c94[_0x9015('0x49')](_0x9015('0x76'),_[_0x9015('0x2e')](_0x5ebb75,'id'));}});})['then'](function(){if(_0x3562de[_0x9015('0x8e')][_0x9015('0x8f')]===_0x9015('0x90')&&!_0x558ac2&&!_0x3562de[_0x9015('0x40')][_0x9015('0x75')])return[];return db[_0x9015('0x91')]['query'](_0x31c923[_0x9015('0x92')](),_0x21b37b);})[_0x9015('0x2a')](function(_0x3950eb){_0x2272c4['count']=_0x3950eb[_0x9015('0x45')];if(_0x2272c4[_0x9015('0x21')]===0x0)return[];return db[_0x9015('0x91')][_0x9015('0x40')](_0x5a3c91[_0x9015('0x92')](),_0x21b37b)['then'](function(_0x4e54d3){_0x188edd=_[_0x9015('0x93')](_0x4e54d3,'id');_0x21b37b=_[_0x9015('0x94')](_0x21b37b,{'model':db[_0x9015('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3562de[_0x9015('0x40')][_0x9015('0x44')]){_0x3f48eb[_0x9015('0x43')][_0x9015('0x31')](function(_0x40699e){_0x409c94[_0x9015('0x4c')]('i.'+_0x40699e);});}else{_0x409c94[_0x9015('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x409c94['field']('a.key',_0x9015('0x95'));_0x409c94['field']('a.mandatoryDisposition',_0x9015('0x96'));_0x409c94[_0x9015('0x4c')]('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');_0x409c94['field'](_0x9015('0x97'));_0x409c94[_0x9015('0x4c')](_0x9015('0x98'),_0x9015('0x99'));_0x409c94[_0x9015('0x4c')](_0x9015('0x9a'),_0x9015('0x9b'));_0x409c94[_0x9015('0x4c')](_0x9015('0x9c'),'Contact.email');_0x409c94['field'](_0x9015('0x9d'),'Contact.phone');_0x409c94[_0x9015('0x4c')](_0x9015('0x9e'),_0x9015('0x9f'));_0x409c94[_0x9015('0x4c')](_0x9015('0xa0'),'Contact.fax');_0x409c94[_0x9015('0x4c')](_0x9015('0xa1'),_0x9015('0xa2'));_0x409c94['field'](_0x9015('0xa3'),_0x9015('0xa4'));_0x409c94['field'](_0x9015('0xa5'),_0x9015('0x33'));}if(_0x3f48eb[_0x9015('0x22')])_0x409c94[_0x9015('0x22')](_0x3f48eb['limit']);if(_0x3f48eb['offset'])_0x409c94[_0x9015('0x1f')](_0x3f48eb[_0x9015('0x1f')]);return db[_0x9015('0x91')][_0x9015('0x40')](_0x409c94[_0x9015('0x92')](),_0x21b37b);})['then'](function(_0xd798dd){if(_0xd798dd[_0x9015('0x45')]>0x0)_0x3b0d7a[_0x9015('0x49')](_0x9015('0xa6'),_['map'](_0xd798dd,'id'));return db[_0x9015('0x91')][_0x9015('0x40')](_0x3b0d7a[_0x9015('0x92')](),_0x21b37b)[_0x9015('0x2a')](function(_0x210902){var _0x2c7c24=_['groupBy'](_0x210902,_0x9015('0xa7'));var _0x497dd0=[];_0xd798dd[_0x9015('0x31')](function(_0x16342c){_0x497dd0[_0x9015('0x32')](updateFaxInteraction(_0x16342c,_0x188edd,_0x2c7c24));});return BPromise['all'](_0x497dd0);});});})[_0x9015('0x2a')](function(_0xfb6304){_0x2272c4[_0x9015('0xa8')]=_0xfb6304;return _0x2272c4;})['then'](respondWithFilteredResult(_0x55a505,_0x3f48eb))[_0x9015('0xa9')](handleError(_0x55a505,null));};exports['show']=function(_0x318766,_0x59cf2e){var _0x544547={'raw':![],'where':{'id':_0x318766[_0x9015('0xaa')]['id']}},_0x319dcf={};_0x319dcf[_0x9015('0x3f')]=_[_0x9015('0x41')](db[_0x9015('0x3c')][_0x9015('0x3d')]);_0x319dcf['query']=_['keys'](_0x318766['query']);_0x319dcf[_0x9015('0x4a')]=_[_0x9015('0x42')](_0x319dcf['model'],_0x319dcf['query']);_0x544547['attributes']=_['intersection'](_0x319dcf[_0x9015('0x3f')],qs[_0x9015('0x44')](_0x318766[_0x9015('0x40')][_0x9015('0x44')]));_0x544547[_0x9015('0x43')]=_0x544547[_0x9015('0x43')][_0x9015('0x45')]?_0x544547['attributes']:_0x319dcf['model'];if(_0x318766[_0x9015('0x40')][_0x9015('0xab')]){_0x544547[_0x9015('0xac')]=[{'all':!![]}];}_0x544547=_[_0x9015('0x94')]({},_0x544547,_0x318766[_0x9015('0xad')]);return db[_0x9015('0x3c')][_0x9015('0x6b')](_0x544547)[_0x9015('0x2a')](handleEntityNotFound(_0x59cf2e,null))[_0x9015('0x2a')](respondWithResult(_0x59cf2e,null))[_0x9015('0xa9')](handleError(_0x59cf2e,null));};exports[_0x9015('0xae')]=function(_0x26d1b6,_0x4c9d5d){return db[_0x9015('0x3c')]['create'](_0x26d1b6[_0x9015('0xaf')],{})['then'](respondWithResult(_0x4c9d5d,0xc9))[_0x9015('0xa9')](handleError(_0x4c9d5d,null));};exports['update']=function(_0x2b5d9d,_0x48f2e9){if(_0x2b5d9d[_0x9015('0xaf')]['id']){delete _0x2b5d9d['body']['id'];}return db[_0x9015('0x3c')][_0x9015('0x6b')]({'where':{'id':_0x2b5d9d[_0x9015('0xaa')]['id']}})[_0x9015('0x2a')](handleEntityNotFound(_0x48f2e9,null))['then'](saveUpdates(_0x2b5d9d[_0x9015('0xaf')],null))[_0x9015('0x2a')](respondWithResult(_0x48f2e9,null))['catch'](handleError(_0x48f2e9,null));};exports[_0x9015('0x29')]=function(_0x2514cb,_0x1da56b){return db['FaxInteraction'][_0x9015('0x6b')]({'where':{'id':_0x2514cb['params']['id']}})['then'](handleEntityNotFound(_0x1da56b,null))[_0x9015('0x2a')](removeEntity(_0x1da56b,null))[_0x9015('0xa9')](handleError(_0x1da56b,null));};exports[_0x9015('0xb0')]=function(_0x5bb011,_0x43bfe6){return db[_0x9015('0x3c')][_0x9015('0xb0')]()['then'](respondWithResult(_0x43bfe6,null))['catch'](handleError(_0x43bfe6,null));};exports[_0x9015('0xb1')]=function(_0x3cc9b5,_0x35dd79,_0x944faa){return db[_0x9015('0xb2')][_0x9015('0x6b')]({'where':{'id':_0x3cc9b5[_0x9015('0xaa')]['id']}})['then'](handleEntityNotFound(_0x35dd79,null))['then'](function(_0x1cb4e1){if(_0x1cb4e1){return _0x1cb4e1[_0x9015('0xb1')](_0x3cc9b5[_0x9015('0xaf')]['ids'],_['omit'](_0x3cc9b5[_0x9015('0xaf')],[_0x9015('0xb3'),'id'])||{});}})[_0x9015('0x2a')](respondWithResult(_0x35dd79,null))[_0x9015('0xa9')](handleError(_0x35dd79,null));};exports[_0x9015('0xb4')]=function(_0x43a1f3,_0x51df09,_0x17a0a9){var _0x82ded1={'raw':![],'where':{}};var _0x441b50={};var _0x1d41fe={'count':0x0,'rows':[]};return db[_0x9015('0x3c')]['findOne']({'where':{'id':_0x43a1f3[_0x9015('0xaa')]['id']}})['then'](handleEntityNotFound(_0x51df09,null))['then'](function(_0x391750){if(_0x391750){_0x441b50['model']=_['keys'](db[_0x9015('0xb2')][_0x9015('0x3d')]);_0x441b50[_0x9015('0x40')]=_[_0x9015('0x41')](_0x43a1f3['query']);_0x441b50[_0x9015('0x4a')]=_[_0x9015('0x42')](_0x441b50['model'],_0x441b50['query']);_0x82ded1[_0x9015('0x43')]=_[_0x9015('0x42')](_0x441b50[_0x9015('0x3f')],qs[_0x9015('0x44')](_0x43a1f3['query'][_0x9015('0x44')]));_0x82ded1[_0x9015('0x43')]=_0x82ded1['attributes'][_0x9015('0x45')]?_0x82ded1['attributes']:_0x441b50[_0x9015('0x3f')];if(!_0x43a1f3['query'][_0x9015('0x46')]('nolimit')){_0x82ded1[_0x9015('0x22')]=qs['limit'](_0x43a1f3['query'][_0x9015('0x22')]);_0x82ded1[_0x9015('0x1f')]=qs[_0x9015('0x1f')](_0x43a1f3[_0x9015('0x40')]['offset']);}_0x82ded1[_0x9015('0x8a')]=qs[_0x9015('0x48')](_0x43a1f3[_0x9015('0x40')][_0x9015('0x48')]);_0x82ded1[_0x9015('0x49')]=qs[_0x9015('0x4a')](_[_0x9015('0xb5')](_0x43a1f3[_0x9015('0x40')],_0x441b50[_0x9015('0x4a')]));_0x82ded1['where']['FaxInteractionId']=_0x391750['id'];if(_0x43a1f3['query']['filter']){_0x82ded1[_0x9015('0x49')]=_[_0x9015('0x94')](_0x82ded1[_0x9015('0x49')],{'$or':_[_0x9015('0x2e')](_0x82ded1[_0x9015('0x43')],function(_0x5a4b43){var _0x564926={};_0x564926[_0x5a4b43]={'$like':'%'+_0x43a1f3[_0x9015('0x40')][_0x9015('0x7f')]+'%'};return _0x564926;})});}if(_0x43a1f3['query'][_0x9015('0xb6')]){var _0x421f24=_0x43a1f3[_0x9015('0x40')][_0x9015('0xb6')][_0x9015('0x68')](',');var _0x2ab7e1={};_0x2ab7e1[_0x421f24[0x0]]={'$gte':moment(_0x421f24[0x1])['format'](_0x9015('0xb7'))};_0x82ded1['where']=_[_0x9015('0x94')](_0x82ded1[_0x9015('0x49')],_0x2ab7e1);}_0x82ded1=_['merge']({},_0x82ded1,_0x43a1f3[_0x9015('0xad')]);return db[_0x9015('0xb2')][_0x9015('0x21')]({'where':_0x82ded1[_0x9015('0x49')]})[_0x9015('0x2a')](function(_0x7d1eb4){_0x1d41fe[_0x9015('0x21')]=_0x7d1eb4;if(_0x43a1f3[_0x9015('0x40')][_0x9015('0xab')]){_0x82ded1['include']=[{'all':!![]}];}return db['FaxMessage'][_0x9015('0xb8')](_0x82ded1);})[_0x9015('0x2a')](function(_0x161720){_0x1d41fe['rows']=_0x161720;return _0x1d41fe;});}})[_0x9015('0x2a')](respondWithFilteredResult(_0x51df09,_0x82ded1))[_0x9015('0xa9')](handleError(_0x51df09,null));};exports[_0x9015('0xb9')]=function(_0x450998,_0x3f7f3a,_0x261f46){return db['FaxInteraction']['find']({'where':{'id':_0x450998['params']['id']}})['then'](handleEntityNotFound(_0x3f7f3a,null))[_0x9015('0x2a')](function(_0x4cdfbf){if(_0x4cdfbf){return _0x4cdfbf[_0x9015('0xba')](_0x450998[_0x9015('0xaf')]['ids'],_[_0x9015('0xbb')](_0x450998[_0x9015('0xaf')],['ids','id'])||{})['spread'](function(){return db[_0x9015('0x6e')][_0x9015('0xb8')]({'attributes':['id',_0x9015('0x2c'),'color'],'where':{'id':_0x450998[_0x9015('0xaf')][_0x9015('0xb3')]}});})[_0x9015('0x2a')](function(_0x4bc525){socket[_0x9015('0xbc')](_0x9015('0xbd'),{'id':Number(_0x450998[_0x9015('0xaa')]['id']),'tags':_0x4bc525||[]});return{'id':Number(_0x450998[_0x9015('0xaa')]['id']),'tags':_0x4bc525||[]};});}})[_0x9015('0x2a')](respondWithResult(_0x3f7f3a,null))[_0x9015('0xa9')](handleError(_0x3f7f3a,null));};exports[_0x9015('0xbe')]=function(_0x1fabe9,_0x137a8a,_0x2bb401){return db[_0x9015('0x3c')]['find']({'where':{'id':_0x1fabe9[_0x9015('0xaa')]['id']}})[_0x9015('0x2a')](handleEntityNotFound(_0x137a8a,null))['then'](function(_0x5e24fd){if(_0x5e24fd){return _0x5e24fd[_0x9015('0xbe')](_0x1fabe9['query']['ids']);}})[_0x9015('0x2a')](respondWithStatusCode(_0x137a8a,null))[_0x9015('0xa9')](handleError(_0x137a8a,null));};exports[_0x9015('0xbf')]=function(_0x16bcd1,_0x10c0f8){var _0x27e14f=moment()['unix']()[_0x9015('0x92')]();var _0x5a33fd=path[_0x9015('0xc0')](config[_0x9015('0xc1')],_0x9015('0xc2'),'files','tmp');var _0x1f5394=path[_0x9015('0xc0')](config[_0x9015('0xc1')],_0x9015('0xc2'),_0x9015('0xc3'),_0x9015('0xc4'));var _0x3b2e76=path[_0x9015('0xc0')](_0x5a33fd,_0x27e14f);var _0x3273cf=util[_0x9015('0xc5')]('transcript-%d-%s.zip',_0x16bcd1[_0x9015('0xaa')]['id'],_0x27e14f);var _0x3eee8a=path['join'](_0x5a33fd,_0x3273cf);var _0x391513=[];_0x391513['push']({'model':db[_0x9015('0xc6')],'as':_0x9015('0xc6'),'raw':!![]});var _0x3c872a=[{'model':db[_0x9015('0xb2')],'as':_0x9015('0xc7'),'attributes':['id',_0x9015('0xaf'),_0x9015('0x77')],'include':_0x391513}];return db[_0x9015('0x3c')]['find']({'where':{'id':_0x16bcd1[_0x9015('0xaa')]['id']},'include':_0x3c872a})[_0x9015('0x2a')](handleEntityNotFound(_0x10c0f8,null))['then'](function(_0xd8439b){if(_0xd8439b&&_0xd8439b[_0x9015('0xc7')]){var _0x314570=_0xd8439b[_0x9015('0xc8')]({'plain':!![]});fs[_0x9015('0xc9')](_0x3b2e76);for(var _0x831535=0x0;_0x831535<_0x314570[_0x9015('0xc7')][_0x9015('0x45')];_0x831535++){var _0x59ee13=_0x314570[_0x9015('0xc7')][_0x831535][_0x9015('0xc6')];if(_0x59ee13){var _0x465280=path[_0x9015('0xc0')](_0x1f5394,_0x59ee13[_0x9015('0xca')]);if(fs[_0x9015('0xcb')](_0x465280)){fs[_0x9015('0xcc')](_0x465280)[_0x9015('0xcd')](fs[_0x9015('0xce')](path['join'](_0x3b2e76,_0x59ee13['basename'])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x178bbb,_0xb859c1){zipdir(_0x3b2e76,{'saveTo':_0x3eee8a},function(_0x918f27,_0x516a41){if(_0x918f27)return _0xb859c1(_0x918f27);return _0x178bbb(_0x516a41);});})[_0x9015('0x2a')](function(){return new BPromise(function(_0x5b5830,_0x1f8366){rimraf(_0x3b2e76,function(_0x3d5e04){if(_0x3d5e04)_0x1f8366(_0x3d5e04);return _0x5b5830();});});})[_0x9015('0x2a')](function(){return _0x10c0f8[_0x9015('0xbf')](_0x3eee8a,_0x3273cf,function(_0x4071b2){if(_0x4071b2){console[_0x9015('0xcf')]('err',_0x4071b2);}else{fs[_0x9015('0xd0')](_0x3eee8a);}});});});}else{return _0x10c0f8[_0x9015('0x1b')](0xc8);}})[_0x9015('0xa9')](handleError(_0x10c0f8,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 722c2bb..7c6356a 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 _0xf95a=['exports','events','../../mysqldb','setMaxListeners','save','remove','getUsers','then','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x5ed3fc,_0x3a59ff){var _0x581d39=function(_0x1b1a50){while(--_0x1b1a50){_0x5ed3fc['push'](_0x5ed3fc['shift']());}};_0x581d39(++_0x3a59ff);}(_0xf95a,0x141));var _0xaf95=function(_0x217cdc,_0x4e1bf1){_0x217cdc=_0x217cdc-0x0;var _0x2764ff=_0xf95a[_0x217cdc];return _0x2764ff;};'use strict';var EventEmitter=require(_0xaf95('0x0'));var FaxInteraction=require(_0xaf95('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0xaf95('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xaf95('0x2')](0x0);var events={'afterCreate':_0xaf95('0x3'),'afterUpdate':'update','afterDestroy':_0xaf95('0x4')};function emitEvent(_0x2ce8cd){return function(_0x1845ef,_0x22b9bc,_0x1feca2){_0x1845ef[_0xaf95('0x5')]({'attributes':['id'],'raw':!![]})[_0xaf95('0x6')](function(_0x40d9ba){_0x1845ef['setDataValue']('Users',_0x40d9ba[_0xaf95('0x7')](function(_0x143b01){return{'id':_0x143b01['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x1845ef['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaf95('0x6')](function(_0x2961a1){_0x1845ef[_0xaf95('0x8')](_0xaf95('0x9'),_0x2961a1[_0xaf95('0xa')]);FaxInteractionEvents[_0xaf95('0xb')](_0x2ce8cd+':'+_0x1845ef['id'],_0x1845ef);FaxInteractionEvents[_0xaf95('0xb')](_0x2ce8cd,_0x1845ef);_0x1feca2(null);})[_0xaf95('0xc')](_0x1feca2(null));};}for(var e in events){if(events[_0xaf95('0xd')](e)){var event=events[e];FaxInteraction[_0xaf95('0xe')](e,emitEvent(event));}}module[_0xaf95('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x6203=['FaxMessage','save','update','remove','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6203,0x11d));var _0x3620=function(_0x1c7b42,_0x1ec268){_0x1c7b42=_0x1c7b42-0x0;var _0x5a3d4e=_0x6203[_0x1c7b42];return _0x5a3d4e;};'use strict';var EventEmitter=require(_0x3620('0x0'));var FaxInteraction=require(_0x3620('0x1'))['db'][_0x3620('0x2')];var FaxMessage=require(_0x3620('0x1'))['db'][_0x3620('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3620('0x4'),'afterUpdate':_0x3620('0x5'),'afterDestroy':_0x3620('0x6')};function emitEvent(_0x2e89a6){return function(_0x2ac7fe,_0x31c184,_0x4f66c2){_0x2ac7fe['getUsers']({'attributes':['id'],'raw':!![]})[_0x3620('0x7')](function(_0x1c90fe){_0x2ac7fe[_0x3620('0x8')]('Users',_0x1c90fe[_0x3620('0x9')](function(_0x2f94da){return{'id':_0x2f94da['id']};}));return FaxMessage[_0x3620('0xa')]({'where':{'FaxInteractionId':_0x2ac7fe['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3620('0x7')](function(_0x283c5c){_0x2ac7fe[_0x3620('0x8')](_0x3620('0xb'),_0x283c5c[_0x3620('0xc')]);FaxInteractionEvents['emit'](_0x2e89a6+':'+_0x2ac7fe['id'],_0x2ac7fe);FaxInteractionEvents[_0x3620('0xd')](_0x2e89a6,_0x2ac7fe);_0x4f66c2(null);})[_0x3620('0xe')](_0x4f66c2(null));};}for(var e in events){if(events[_0x3620('0xf')](e)){var event=events[e];FaxInteraction[_0x3620('0x10')](e,emitEvent(event));}}module[_0x3620('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 38ce8c6..b140846 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 _0x648e=['closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions'];(function(_0x2c4819,_0x184573){var _0x3e1235=function(_0x5384ff){while(--_0x5384ff){_0x2c4819['push'](_0x2c4819['shift']());}};_0x3e1235(++_0x184573);}(_0x648e,0xa3));var _0xe648=function(_0x58dab9,_0x40268b){_0x58dab9=_0x58dab9-0x0;var _0x4302f6=_0x648e[_0x58dab9];return _0x4302f6;};'use strict';var _=require(_0xe648('0x0'));var util=require(_0xe648('0x1'));var logger=require('../../config/logger')(_0xe648('0x2'));var moment=require('moment');var BPromise=require(_0xe648('0x3'));var rp=require(_0xe648('0x4'));var fs=require('fs');var path=require(_0xe648('0x5'));var rimraf=require(_0xe648('0x6'));var config=require(_0xe648('0x7'));var attributes=require(_0xe648('0x8'));module[_0xe648('0x9')]=function(_0x385ad9,_0x243ac3){return _0x385ad9[_0xe648('0xa')](_0xe648('0xb'),attributes,{'tableName':_0xe648('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3e0855,_0xa616e0,_0x116435){if(_0x3e0855['changed'](_0xe648('0xd'))){_0x3e0855[_0xe648('0xe')]=moment()['format'](_0xe648('0xf'));}_0x116435(null,_0x3e0855);}}});}; \ No newline at end of file +var _0xe277=['define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports'];(function(_0x27bea2,_0x12caf5){var _0x272f8f=function(_0x11a8c4){while(--_0x11a8c4){_0x27bea2['push'](_0x27bea2['shift']());}};_0x272f8f(++_0x12caf5);}(_0xe277,0x15e));var _0x7e27=function(_0x2b4dac,_0x3890ac){_0x2b4dac=_0x2b4dac-0x0;var _0x18781e=_0xe277[_0x2b4dac];return _0x18781e;};'use strict';var _=require(_0x7e27('0x0'));var util=require(_0x7e27('0x1'));var logger=require('../../config/logger')(_0x7e27('0x2'));var moment=require(_0x7e27('0x3'));var BPromise=require(_0x7e27('0x4'));var rp=require(_0x7e27('0x5'));var fs=require('fs');var path=require(_0x7e27('0x6'));var rimraf=require('rimraf');var config=require(_0x7e27('0x7'));var attributes=require(_0x7e27('0x8'));module[_0x7e27('0x9')]=function(_0x25a56a,_0x5beb40){return _0x25a56a[_0x7e27('0xa')](_0x7e27('0xb'),attributes,{'tableName':_0x7e27('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47d7b2,_0x44d253,_0x84de7e){if(_0x47d7b2[_0x7e27('0xd')](_0x7e27('0xe'))){_0x47d7b2[_0x7e27('0xf')]=moment()[_0x7e27('0x10')](_0x7e27('0x11'));}_0x84de7e(null,_0x47d7b2);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 06ba2c2..86bc6c6 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 _0x2c27=['omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateFaxInteraction','update','body','options','raw','AddTagsToFaxInteraction','find','where','addTags','ids'];(function(_0x8d2bd9,_0x4eac58){var _0x43ad0a=function(_0x1061fd){while(--_0x1061fd){_0x8d2bd9['push'](_0x8d2bd9['shift']());}};_0x43ad0a(++_0x4eac58);}(_0x2c27,0x1bb));var _0x72c2=function(_0x45a81c,_0x3fb8de){_0x45a81c=_0x45a81c-0x0;var _0x3e8a59=_0x2c27[_0x45a81c];return _0x3e8a59;};'use strict';var _=require(_0x72c2('0x0'));var util=require(_0x72c2('0x1'));var moment=require(_0x72c2('0x2'));var BPromise=require(_0x72c2('0x3'));var rs=require(_0x72c2('0x4'));var fs=require('fs');var Redis=require(_0x72c2('0x5'));var db=require(_0x72c2('0x6'))['db'];var utils=require(_0x72c2('0x7'));var logger=require('../../config/logger')(_0x72c2('0x8'));var config=require('../../config/environment');var jayson=require(_0x72c2('0x9'));var client=jayson[_0x72c2('0xa')]['http']({'port':0x232a});config[_0x72c2('0xb')]=_[_0x72c2('0xc')](config[_0x72c2('0xb')],{'host':_0x72c2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x72c2('0xb')]));require(_0x72c2('0xe'))[_0x72c2('0xf')](socket);function respondWithRpcPromise(_0x11f5e0,_0x56d130,_0x2297cc){return new BPromise(function(_0xb2286,_0x20a122){return client[_0x72c2('0x10')](_0x11f5e0,_0x2297cc)[_0x72c2('0x11')](function(_0x360a89){logger[_0x72c2('0x12')](_0x72c2('0x13'),_0x56d130,_0x72c2('0x14'));logger[_0x72c2('0x15')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x56d130,_0x72c2('0x14'),JSON[_0x72c2('0x16')](_0x360a89));if(_0x360a89[_0x72c2('0x17')]){if(_0x360a89[_0x72c2('0x17')][_0x72c2('0x18')]===0x1f4){logger['error'](_0x72c2('0x13'),_0x56d130,_0x360a89[_0x72c2('0x17')][_0x72c2('0x19')]);return _0x20a122(_0x360a89[_0x72c2('0x17')][_0x72c2('0x19')]);}logger[_0x72c2('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x56d130,_0x360a89[_0x72c2('0x17')][_0x72c2('0x19')]);return _0xb2286(_0x360a89[_0x72c2('0x17')]['message']);}else{logger['info'](_0x72c2('0x13'),_0x56d130,'request\x20sent');_0xb2286(_0x360a89['result'][_0x72c2('0x19')]);}})[_0x72c2('0x1a')](function(_0x33f2b8){logger[_0x72c2('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x56d130,_0x33f2b8);_0x20a122(_0x33f2b8);});});}exports[_0x72c2('0x1b')]=function(_0x19c546){var _0x415875=this;return new Promise(function(_0x4d5f69,_0x652330){return db['FaxInteraction'][_0x72c2('0x1c')](_0x19c546[_0x72c2('0x1d')],{'raw':_0x19c546['options']?_0x19c546[_0x72c2('0x1e')][_0x72c2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19c546[_0x72c2('0x1e')]?_0x19c546[_0x72c2('0x1e')]['where']||null:null,'attributes':_0x19c546[_0x72c2('0x1e')]?_0x19c546[_0x72c2('0x1e')]['attributes']||null:null,'limit':_0x19c546[_0x72c2('0x1e')]?_0x19c546[_0x72c2('0x1e')]['limit']||null:null})[_0x72c2('0x11')](function(_0x205cdc){logger[_0x72c2('0x12')](_0x72c2('0x1b'),_0x19c546);logger[_0x72c2('0x15')](_0x72c2('0x1b'),_0x19c546,JSON[_0x72c2('0x16')](_0x205cdc));_0x4d5f69(_0x205cdc);})['catch'](function(_0x2a6b66){logger['error'](_0x72c2('0x1b'),_0x2a6b66[_0x72c2('0x19')],_0x19c546);_0x652330(_0x415875[_0x72c2('0x17')](0x1f4,_0x2a6b66[_0x72c2('0x19')]));});});};exports[_0x72c2('0x20')]=function(_0x361181){return new Promise(function(_0x247ff4,_0x3876d5){return db['FaxInteraction'][_0x72c2('0x21')]({'where':_0x361181['options']?_0x361181[_0x72c2('0x1e')][_0x72c2('0x22')]||null:null})[_0x72c2('0x11')](function(_0x4ef588){if(_0x4ef588){return _0x4ef588[_0x72c2('0x23')](_0x361181[_0x72c2('0x1d')][_0x72c2('0x24')],_[_0x72c2('0x25')](_0x361181[_0x72c2('0x1d')],['ids','id'])||{});}})[_0x72c2('0x26')](function(_0x52dfed){logger[_0x72c2('0x12')](_0x72c2('0x27'),_0x361181);logger['debug'](_0x72c2('0x27'),_0x361181,JSON[_0x72c2('0x16')](_0x52dfed));_0x247ff4(_0x52dfed);})[_0x72c2('0x1a')](function(_0x5cb226){logger[_0x72c2('0x17')](_0x72c2('0x27'),_0x5cb226[_0x72c2('0x19')],_0x361181);_0x3876d5(_this[_0x72c2('0x17')](0x1f4,_0x5cb226[_0x72c2('0x19')]));});});}; \ No newline at end of file +var _0x9a08=['FaxInteraction','body','options','raw','where','attributes','info','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','request','then','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','catch','UpdateFaxInteraction'];(function(_0x5ae62b,_0xcf4f30){var _0x2155c1=function(_0x58a26e){while(--_0x58a26e){_0x5ae62b['push'](_0x5ae62b['shift']());}};_0x2155c1(++_0xcf4f30);}(_0x9a08,0x1e7));var _0x89a0=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x9a08[_0x4dc7b9];return _0x3ab114;};'use strict';var _=require(_0x89a0('0x0'));var util=require('util');var moment=require(_0x89a0('0x1'));var BPromise=require(_0x89a0('0x2'));var rs=require(_0x89a0('0x3'));var fs=require('fs');var Redis=require(_0x89a0('0x4'));var db=require(_0x89a0('0x5'))['db'];var utils=require(_0x89a0('0x6'));var logger=require(_0x89a0('0x7'))('rpc');var config=require(_0x89a0('0x8'));var jayson=require(_0x89a0('0x9'));var client=jayson[_0x89a0('0xa')][_0x89a0('0xb')]({'port':0x232a});config[_0x89a0('0xc')]=_['defaults'](config[_0x89a0('0xc')],{'host':_0x89a0('0xd'),'port':0x18eb});var socket=require(_0x89a0('0xe'))(new Redis(config[_0x89a0('0xc')]));require(_0x89a0('0xf'))['register'](socket);function respondWithRpcPromise(_0x19fb48,_0x527aa8,_0x25f842){return new BPromise(function(_0x4d655e,_0x445a4b){return client[_0x89a0('0x10')](_0x19fb48,_0x25f842)[_0x89a0('0x11')](function(_0x1a1c46){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x527aa8,_0x89a0('0x12'));logger[_0x89a0('0x13')](_0x89a0('0x14'),_0x527aa8,_0x89a0('0x12'),JSON[_0x89a0('0x15')](_0x1a1c46));if(_0x1a1c46['error']){if(_0x1a1c46[_0x89a0('0x16')][_0x89a0('0x17')]===0x1f4){logger[_0x89a0('0x16')](_0x89a0('0x18'),_0x527aa8,_0x1a1c46[_0x89a0('0x16')][_0x89a0('0x19')]);return _0x445a4b(_0x1a1c46[_0x89a0('0x16')][_0x89a0('0x19')]);}logger[_0x89a0('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x527aa8,_0x1a1c46[_0x89a0('0x16')][_0x89a0('0x19')]);return _0x4d655e(_0x1a1c46[_0x89a0('0x16')][_0x89a0('0x19')]);}else{logger['info'](_0x89a0('0x18'),_0x527aa8,_0x89a0('0x12'));_0x4d655e(_0x1a1c46[_0x89a0('0x1a')][_0x89a0('0x19')]);}})[_0x89a0('0x1b')](function(_0x2771ea){logger[_0x89a0('0x16')](_0x89a0('0x18'),_0x527aa8,_0x2771ea);_0x445a4b(_0x2771ea);});});}exports[_0x89a0('0x1c')]=function(_0x2b79f4){var _0x5b9358=this;return new Promise(function(_0x29733b,_0xf4f48a){return db[_0x89a0('0x1d')]['update'](_0x2b79f4[_0x89a0('0x1e')],{'raw':_0x2b79f4[_0x89a0('0x1f')]?_0x2b79f4[_0x89a0('0x1f')][_0x89a0('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b79f4[_0x89a0('0x1f')]?_0x2b79f4[_0x89a0('0x1f')][_0x89a0('0x21')]||null:null,'attributes':_0x2b79f4['options']?_0x2b79f4['options'][_0x89a0('0x22')]||null:null,'limit':_0x2b79f4[_0x89a0('0x1f')]?_0x2b79f4[_0x89a0('0x1f')]['limit']||null:null})[_0x89a0('0x11')](function(_0x5ef231){logger[_0x89a0('0x23')]('UpdateFaxInteraction',_0x2b79f4);logger['debug'](_0x89a0('0x1c'),_0x2b79f4,JSON[_0x89a0('0x15')](_0x5ef231));_0x29733b(_0x5ef231);})[_0x89a0('0x1b')](function(_0x354713){logger['error']('UpdateFaxInteraction',_0x354713[_0x89a0('0x19')],_0x2b79f4);_0xf4f48a(_0x5b9358[_0x89a0('0x16')](0x1f4,_0x354713['message']));});});};exports[_0x89a0('0x24')]=function(_0x58cf85){return new Promise(function(_0x2aa945,_0x4c7437){return db[_0x89a0('0x1d')][_0x89a0('0x25')]({'where':_0x58cf85[_0x89a0('0x1f')]?_0x58cf85[_0x89a0('0x1f')][_0x89a0('0x21')]||null:null})['then'](function(_0x154a5d){if(_0x154a5d){return _0x154a5d[_0x89a0('0x26')](_0x58cf85[_0x89a0('0x1e')][_0x89a0('0x27')],_[_0x89a0('0x28')](_0x58cf85[_0x89a0('0x1e')],[_0x89a0('0x27'),'id'])||{});}})[_0x89a0('0x29')](function(_0x2e4e65){logger[_0x89a0('0x23')](_0x89a0('0x2a'),_0x58cf85);logger[_0x89a0('0x13')](_0x89a0('0x2a'),_0x58cf85,JSON[_0x89a0('0x15')](_0x2e4e65));_0x2aa945(_0x2e4e65);})[_0x89a0('0x1b')](function(_0x2ae9fc){logger[_0x89a0('0x16')](_0x89a0('0x2a'),_0x2ae9fc['message'],_0x58cf85);_0x4c7437(_this[_0x89a0('0x16')](0x1f4,_0x2ae9fc[_0x89a0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index d4c5b8c..d0c389a 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 _0x4b5b=['remove','update','removeListener','faxInteraction:','./faxInteraction.events'];(function(_0x55c3d9,_0x3bf75c){var _0x19fd97=function(_0x2b0205){while(--_0x2b0205){_0x55c3d9['push'](_0x55c3d9['shift']());}};_0x19fd97(++_0x3bf75c);}(_0x4b5b,0x1da));var _0xb4b5=function(_0x78af2c,_0x357958){_0x78af2c=_0x78af2c-0x0;var _0x39cd15=_0x4b5b[_0x78af2c];return _0x39cd15;};'use strict';var FaxInteractionEvents=require(_0xb4b5('0x0'));var events=['save',_0xb4b5('0x1'),_0xb4b5('0x2')];function createListener(_0x498276,_0x4a48a9){return function(_0xfcedb7){_0x4a48a9['emit'](_0x498276,_0xfcedb7);};}function removeListener(_0x203fca,_0x162944){return function(){FaxInteractionEvents[_0xb4b5('0x3')](_0x203fca,_0x162944);};}exports['register']=function(_0x430e6e){for(var _0x31ef0d=0x0,_0x442356=events['length'];_0x31ef0d<_0x442356;_0x31ef0d++){var _0x2ea175=events[_0x31ef0d];var _0x1c7876=createListener(_0xb4b5('0x4')+_0x2ea175,_0x430e6e);FaxInteractionEvents['on'](_0x2ea175,_0x1c7876);}}; \ No newline at end of file +var _0x7f03=['update','emit','removeListener','register','length','faxInteraction:','save','remove'];(function(_0x1eb252,_0x1b9c4f){var _0x7d46a=function(_0x255724){while(--_0x255724){_0x1eb252['push'](_0x1eb252['shift']());}};_0x7d46a(++_0x1b9c4f);}(_0x7f03,0x1e6));var _0x37f0=function(_0x1df92f,_0x2d0bb4){_0x1df92f=_0x1df92f-0x0;var _0x711643=_0x7f03[_0x1df92f];return _0x711643;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x37f0('0x0'),_0x37f0('0x1'),_0x37f0('0x2')];function createListener(_0x5910a6,_0x428d34){return function(_0xcfcda1){_0x428d34[_0x37f0('0x3')](_0x5910a6,_0xcfcda1);};}function removeListener(_0xaa8da8,_0x46ff68){return function(){FaxInteractionEvents[_0x37f0('0x4')](_0xaa8da8,_0x46ff68);};}exports[_0x37f0('0x5')]=function(_0x1dbd8a){for(var _0x2f33c7=0x0,_0x5d3e3f=events[_0x37f0('0x6')];_0x2f33c7<_0x5d3e3f;_0x2f33c7++){var _0x2a4c8d=events[_0x2f33c7];var _0x28e1a8=createListener(_0x37f0('0x7')+_0x2a4c8d,_0x1dbd8a);FaxInteractionEvents['on'](_0x2a4c8d,_0x28e1a8);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index b823fbb..0667472 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 _0x12cc=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','download','post','create','/:id/tags','fax','faxinteraction:addtags','addTags','put','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer'];(function(_0x58dd21,_0x5105ef){var _0x7851af=function(_0x159714){while(--_0x159714){_0x58dd21['push'](_0x58dd21['shift']());}};_0x7851af(++_0x5105ef);}(_0x12cc,0x7f));var _0xc12c=function(_0x50d613,_0x5ef1d8){_0x50d613=_0x50d613-0x0;var _0x452931=_0x12cc[_0x50d613];return _0x452931;};'use strict';var multer=require(_0xc12c('0x0'));var util=require('util');var path=require(_0xc12c('0x1'));var timeout=require(_0xc12c('0x2'));var express=require(_0xc12c('0x3'));var router=express[_0xc12c('0x4')]();var fs_extra=require(_0xc12c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc12c('0x6'));var config=require(_0xc12c('0x7'));var controller=require(_0xc12c('0x8'));router[_0xc12c('0x9')]('/',auth[_0xc12c('0xa')](),controller['index']);router[_0xc12c('0x9')](_0xc12c('0xb'),auth[_0xc12c('0xa')](),controller[_0xc12c('0xc')]);router['get'](_0xc12c('0xd'),auth[_0xc12c('0xa')](),controller[_0xc12c('0xe')]);router[_0xc12c('0x9')](_0xc12c('0xf'),auth[_0xc12c('0xa')](),controller['getMessages']);router['get']('/:id/download',auth[_0xc12c('0xa')](),controller[_0xc12c('0x10')]);router[_0xc12c('0x11')]('/',auth[_0xc12c('0xa')](),controller[_0xc12c('0x12')]);router[_0xc12c('0x11')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post'](_0xc12c('0x13'),auth[_0xc12c('0xa')](),interaction['tracked'](_0xc12c('0x14'),_0xc12c('0x15')),controller[_0xc12c('0x16')]);router[_0xc12c('0x17')](_0xc12c('0xd'),auth[_0xc12c('0xa')](),interaction[_0xc12c('0x18')](_0xc12c('0x14'),_0xc12c('0x19')),controller[_0xc12c('0x1a')]);router[_0xc12c('0x1b')](_0xc12c('0xd'),auth[_0xc12c('0xa')](),interaction[_0xc12c('0x18')](_0xc12c('0x14'),_0xc12c('0x1c')),controller[_0xc12c('0x1d')]);router[_0xc12c('0x1b')](_0xc12c('0x13'),auth[_0xc12c('0xa')](),controller[_0xc12c('0x1e')]);module[_0xc12c('0x1f')]=router; \ No newline at end of file +var _0x3e7e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','show','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','/:id/tags','tracked','fax','addTags','put','faxinteraction:update','delete','/:id','faxinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','Router'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x3e7e,0xc7));var _0xe3e7=function(_0x1d9262,_0xc69dd){_0x1d9262=_0x1d9262-0x0;var _0xfb6182=_0x3e7e[_0x1d9262];return _0xfb6182;};'use strict';var multer=require(_0xe3e7('0x0'));var util=require(_0xe3e7('0x1'));var path=require(_0xe3e7('0x2'));var timeout=require(_0xe3e7('0x3'));var express=require('express');var router=express[_0xe3e7('0x4')]();var fs_extra=require(_0xe3e7('0x5'));var auth=require(_0xe3e7('0x6'));var interaction=require(_0xe3e7('0x7'));var config=require(_0xe3e7('0x8'));var controller=require(_0xe3e7('0x9'));router[_0xe3e7('0xa')]('/',auth['isAuthenticated'](),controller[_0xe3e7('0xb')]);router[_0xe3e7('0xa')](_0xe3e7('0xc'),auth[_0xe3e7('0xd')](),controller[_0xe3e7('0xe')]);router[_0xe3e7('0xa')]('/:id',auth[_0xe3e7('0xd')](),controller[_0xe3e7('0xf')]);router[_0xe3e7('0xa')]('/:id/messages',auth[_0xe3e7('0xd')](),controller[_0xe3e7('0x10')]);router[_0xe3e7('0xa')](_0xe3e7('0x11'),auth[_0xe3e7('0xd')](),controller[_0xe3e7('0x12')]);router['post']('/',auth[_0xe3e7('0xd')](),controller[_0xe3e7('0x13')]);router[_0xe3e7('0x14')](_0xe3e7('0x15'),auth[_0xe3e7('0xd')](),controller[_0xe3e7('0x16')]);router[_0xe3e7('0x14')](_0xe3e7('0x17'),auth[_0xe3e7('0xd')](),interaction[_0xe3e7('0x18')](_0xe3e7('0x19'),'faxinteraction:addtags'),controller[_0xe3e7('0x1a')]);router[_0xe3e7('0x1b')]('/:id',auth[_0xe3e7('0xd')](),interaction[_0xe3e7('0x18')]('fax',_0xe3e7('0x1c')),controller['update']);router[_0xe3e7('0x1d')](_0xe3e7('0x1e'),auth[_0xe3e7('0xd')](),interaction[_0xe3e7('0x18')](_0xe3e7('0x19'),_0xe3e7('0x1f')),controller[_0xe3e7('0x20')]);router[_0xe3e7('0x1d')](_0xe3e7('0x17'),auth[_0xe3e7('0xd')](),controller[_0xe3e7('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index c9befe0..07bac89 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 _0x0e35=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3b2e12,_0x5482c7){var _0x5da1e9=function(_0x5760c8){while(--_0x5760c8){_0x3b2e12['push'](_0x3b2e12['shift']());}};_0x5da1e9(++_0x5482c7);}(_0x0e35,0xc2));var _0x50e3=function(_0x2d337d,_0x1de539){_0x2d337d=_0x2d337d-0x0;var _0x17553b=_0x0e35[_0x2d337d];return _0x17553b;};'use strict';var Sequelize=require(_0x50e3('0x0'));module[_0x50e3('0x1')]={'body':{'type':Sequelize[_0x50e3('0x2')](_0x50e3('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x50e3('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x50e3('0x5')]('in',_0x50e3('0x6')),'defaultValue':_0x50e3('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x50e3('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x50e3('0x7')]}}; \ No newline at end of file +var _0x0207=['exports','BOOLEAN','ENUM','out','TEXT','DATE'];(function(_0x511116,_0x33b8bc){var _0x4edf4e=function(_0x4b9bfc){while(--_0x4b9bfc){_0x511116['push'](_0x511116['shift']());}};_0x4edf4e(++_0x33b8bc);}(_0x0207,0x162));var _0x7020=function(_0x4f91d4,_0x40f706){_0x4f91d4=_0x4f91d4-0x0;var _0xfb49ae=_0x0207[_0x4f91d4];return _0xfb49ae;};'use strict';var Sequelize=require('sequelize');module[_0x7020('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x7020('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7020('0x2')]('in',_0x7020('0x3')),'defaultValue':_0x7020('0x3'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x7020('0x4')],'defaultValue':null},'readAt':{'type':Sequelize[_0x7020('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index a4f47c3..10905f9 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 _0x7380=['channel','motionChannel','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','Sequelize','internal','SIP/%s','event','rejectmessage','create','findOne','isNil','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','files','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','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/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','request','then','info','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','update','destroy','stack','name','index','map','FaxMessage','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','params','rawAttributes','find','body','describe','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction','FaxInteractionId','read1stAt','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface'];(function(_0x3f95a5,_0xb8721c){var _0x369171=function(_0x5de0df){while(--_0x5de0df){_0x3f95a5['push'](_0x3f95a5['shift']());}};_0x369171(++_0xb8721c);}(_0x7380,0x143));var _0x0738=function(_0x1780f8,_0x11ba93){_0x1780f8=_0x1780f8-0x0;var _0x33a410=_0x7380[_0x1780f8];return _0x33a410;};'use strict';var emlformat=require(_0x0738('0x0'));var rimraf=require(_0x0738('0x1'));var zipdir=require(_0x0738('0x2'));var jsonpatch=require(_0x0738('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0738('0x4'));var Mustache=require(_0x0738('0x5'));var util=require('util');var path=require(_0x0738('0x6'));var sox=require(_0x0738('0x7'));var csv=require(_0x0738('0x8'));var ejs=require(_0x0738('0x9'));var fs=require('fs');var fs_extra=require(_0x0738('0xa'));var _=require('lodash');var squel=require(_0x0738('0xb'));var crypto=require(_0x0738('0xc'));var jsforce=require(_0x0738('0xd'));var deskjs=require(_0x0738('0xe'));var toCsv=require(_0x0738('0x8'));var querystring=require(_0x0738('0xf'));var Papa=require(_0x0738('0x10'));var Redis=require(_0x0738('0x11'));var authService=require(_0x0738('0x12'));var qs=require(_0x0738('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0738('0x14'));var logger=require(_0x0738('0x15'))(_0x0738('0x16'));var utils=require('../../config/utils');var config=require(_0x0738('0x17'));var licenseUtil=require(_0x0738('0x18'));var db=require(_0x0738('0x19'))['db'];config[_0x0738('0x1a')]=_[_0x0738('0x1b')](config[_0x0738('0x1a')],{'host':_0x0738('0x1c'),'port':0x18eb});var socket=require(_0x0738('0x1d'))(new Redis(config[_0x0738('0x1a')]));require(_0x0738('0x1e'))[_0x0738('0x1f')](socket);var jayson=require(_0x0738('0x20'));var client=jayson['client'][_0x0738('0x21')]({'port':0x232c});var client9002=jayson[_0x0738('0x22')][_0x0738('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x3020b0,_0x3b62a9,_0x2e4c68,_0x26cba2){return new BPromise(function(_0x1c7771,_0x5cca19){var _0x3e3fb2=_0x26cba2||client;return _0x3e3fb2[_0x0738('0x23')](_0x3020b0,_0x2e4c68)[_0x0738('0x24')](function(_0x56b6d4){logger[_0x0738('0x25')]('FaxMessage,\x20%s,\x20%s',_0x3b62a9,'request\x20sent');logger['debug'](_0x0738('0x26'),_0x3b62a9,_0x0738('0x27'),JSON[_0x0738('0x28')](_0x56b6d4));if(_0x56b6d4[_0x0738('0x29')]){if(_0x56b6d4[_0x0738('0x29')][_0x0738('0x2a')]===0x1f4){logger[_0x0738('0x29')](_0x0738('0x2b'),_0x3b62a9,_0x56b6d4['error']['message']);return _0x5cca19(_0x56b6d4[_0x0738('0x29')][_0x0738('0x2c')]);}logger['error'](_0x0738('0x2b'),_0x3b62a9,_0x56b6d4['error'][_0x0738('0x2c')]);return _0x1c7771(_0x56b6d4['error']['message']);}else{logger[_0x0738('0x25')](_0x0738('0x2b'),_0x3b62a9,_0x0738('0x27'));_0x1c7771(_0x56b6d4[_0x0738('0x2d')][_0x0738('0x2c')]);}})[_0x0738('0x2e')](function(_0x7dbff7){logger[_0x0738('0x29')](_0x0738('0x2b'),_0x3b62a9,_0x7dbff7);_0x5cca19(_0x7dbff7);});});}function respondWithStatusCode(_0x464c50,_0x227f1e){_0x227f1e=_0x227f1e||0xcc;return function(_0x3c8b69){if(_0x3c8b69){return _0x464c50[_0x0738('0x2f')](_0x227f1e);}return _0x464c50[_0x0738('0x30')](_0x227f1e)[_0x0738('0x31')]();};}function respondWithResult(_0x68e4bd,_0x6aef91){_0x6aef91=_0x6aef91||0xc8;return function(_0x398e4f){if(_0x398e4f){return _0x68e4bd[_0x0738('0x30')](_0x6aef91)[_0x0738('0x32')](_0x398e4f);}};}function respondWithFilteredResult(_0x48a628,_0x183fa3){return function(_0x246748){if(_0x246748){var _0x53688c=typeof _0x183fa3[_0x0738('0x33')]===_0x0738('0x34')&&typeof _0x183fa3['limit']===_0x0738('0x34');var _0x5105f9=_0x246748[_0x0738('0x35')];var _0x349933=_0x53688c?0x0:_0x183fa3['offset'];var _0x3c4890=_0x53688c?_0x246748[_0x0738('0x35')]:_0x183fa3[_0x0738('0x33')]+_0x183fa3[_0x0738('0x36')];var _0x489952;if(_0x3c4890>=_0x5105f9){_0x3c4890=_0x5105f9;_0x489952=0xc8;}else{_0x489952=0xce;}_0x48a628[_0x0738('0x30')](_0x489952);return _0x48a628[_0x0738('0x37')]('Content-Range',_0x349933+'-'+_0x3c4890+'/'+_0x5105f9)[_0x0738('0x32')](_0x246748);}return null;};}function patchUpdates(_0x42d7a0){return function(_0x280d0d){try{jsonpatch[_0x0738('0x38')](_0x280d0d,_0x42d7a0,!![]);}catch(_0x4e7f19){return BPromise[_0x0738('0x39')](_0x4e7f19);}return _0x280d0d['save']();};}function saveUpdates(_0x1e480a,_0x3103be){return function(_0x24293b){if(_0x24293b){return _0x24293b[_0x0738('0x3a')](_0x1e480a)[_0x0738('0x24')](function(_0x2e70d8){return _0x2e70d8;});}return null;};}function removeEntity(_0x197741,_0x1afca1){return function(_0x533b5f){if(_0x533b5f){return _0x533b5f[_0x0738('0x3b')]()['then'](function(){_0x197741[_0x0738('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aed0c,_0x143ffa){return function(_0x38b95c){if(!_0x38b95c){_0x1aed0c['sendStatus'](0x194);}return _0x38b95c;};}function handleError(_0x14c60b,_0x1fe444){_0x1fe444=_0x1fe444||0x1f4;return function(_0x3e7d9e){logger[_0x0738('0x29')](_0x3e7d9e[_0x0738('0x3c')]);if(_0x3e7d9e['name']){delete _0x3e7d9e[_0x0738('0x3d')];}_0x14c60b[_0x0738('0x30')](_0x1fe444)['send'](_0x3e7d9e);};}exports[_0x0738('0x3e')]=function(_0x40b244,_0x18673d){var _0x4ffd60={},_0x5c6823={},_0x1c2393={'count':0x0,'rows':[]};var _0x51df91=_[_0x0738('0x3f')](db[_0x0738('0x40')]['rawAttributes'],function(_0x37cdc7){return{'name':_0x37cdc7[_0x0738('0x41')],'type':_0x37cdc7[_0x0738('0x42')][_0x0738('0x43')]};});_0x5c6823['model']=_[_0x0738('0x3f')](_0x51df91,'name');_0x5c6823[_0x0738('0x44')]=_[_0x0738('0x45')](_0x40b244[_0x0738('0x44')]);_0x5c6823[_0x0738('0x46')]=_[_0x0738('0x47')](_0x5c6823[_0x0738('0x48')],_0x5c6823[_0x0738('0x44')]);_0x4ffd60[_0x0738('0x49')]=_[_0x0738('0x47')](_0x5c6823[_0x0738('0x48')],qs[_0x0738('0x4a')](_0x40b244[_0x0738('0x44')][_0x0738('0x4a')]));_0x4ffd60[_0x0738('0x49')]=_0x4ffd60['attributes'][_0x0738('0x4b')]?_0x4ffd60[_0x0738('0x49')]:_0x5c6823[_0x0738('0x48')];if(!_0x40b244[_0x0738('0x44')][_0x0738('0x4c')](_0x0738('0x4d'))){_0x4ffd60[_0x0738('0x36')]=qs[_0x0738('0x36')](_0x40b244[_0x0738('0x44')][_0x0738('0x36')]);_0x4ffd60['offset']=qs[_0x0738('0x33')](_0x40b244[_0x0738('0x44')]['offset']);}_0x4ffd60[_0x0738('0x4e')]=qs[_0x0738('0x4f')](_0x40b244['query'][_0x0738('0x4f')]);_0x4ffd60['where']=qs[_0x0738('0x46')](_[_0x0738('0x50')](_0x40b244[_0x0738('0x44')],_0x5c6823['filters']),_0x51df91);if(_0x40b244[_0x0738('0x44')][_0x0738('0x51')]){_0x4ffd60[_0x0738('0x52')]=_[_0x0738('0x53')](_0x4ffd60['where'],{'$or':_[_0x0738('0x3f')](_0x51df91,function(_0x2a5b13){if(_0x2a5b13[_0x0738('0x42')]!=='VIRTUAL'){var _0x3af00b={};_0x3af00b[_0x2a5b13[_0x0738('0x3d')]]={'$like':'%'+_0x40b244['query']['filter']+'%'};return _0x3af00b;}})});}_0x4ffd60=_[_0x0738('0x53')]({},_0x4ffd60,_0x40b244[_0x0738('0x54')]);var _0x78f05f={'where':_0x4ffd60[_0x0738('0x52')]};return db['FaxMessage']['count'](_0x78f05f)[_0x0738('0x24')](function(_0x2ae820){_0x1c2393['count']=_0x2ae820;if(_0x40b244[_0x0738('0x44')][_0x0738('0x55')]){_0x4ffd60[_0x0738('0x56')]=[{'all':!![]}];}return db['FaxMessage'][_0x0738('0x57')](_0x4ffd60);})[_0x0738('0x24')](function(_0x463060){_0x1c2393[_0x0738('0x58')]=_0x463060;return _0x1c2393;})['then'](respondWithFilteredResult(_0x18673d,_0x4ffd60))[_0x0738('0x2e')](handleError(_0x18673d,null));};exports['show']=function(_0xa279b6,_0x35d9c3){var _0x4f2d4b={'raw':!![],'where':{'id':_0xa279b6[_0x0738('0x59')]['id']}},_0x555c30={};_0x555c30['model']=_[_0x0738('0x45')](db[_0x0738('0x40')][_0x0738('0x5a')]);_0x555c30[_0x0738('0x44')]=_['keys'](_0xa279b6[_0x0738('0x44')]);_0x555c30[_0x0738('0x46')]=_['intersection'](_0x555c30['model'],_0x555c30[_0x0738('0x44')]);_0x4f2d4b[_0x0738('0x49')]=_[_0x0738('0x47')](_0x555c30[_0x0738('0x48')],qs[_0x0738('0x4a')](_0xa279b6['query']['fields']));_0x4f2d4b[_0x0738('0x49')]=_0x4f2d4b['attributes'][_0x0738('0x4b')]?_0x4f2d4b[_0x0738('0x49')]:_0x555c30[_0x0738('0x48')];if(_0xa279b6['query'][_0x0738('0x55')]){_0x4f2d4b['include']=[{'all':!![]}];}_0x4f2d4b=_[_0x0738('0x53')]({},_0x4f2d4b,_0xa279b6[_0x0738('0x54')]);return db[_0x0738('0x40')][_0x0738('0x5b')](_0x4f2d4b)[_0x0738('0x24')](handleEntityNotFound(_0x35d9c3,null))[_0x0738('0x24')](respondWithResult(_0x35d9c3,null))['catch'](handleError(_0x35d9c3,null));};exports['update']=function(_0x51c338,_0x445338){if(_0x51c338[_0x0738('0x5c')]['id']){delete _0x51c338[_0x0738('0x5c')]['id'];}return db[_0x0738('0x40')]['find']({'where':{'id':_0x51c338[_0x0738('0x59')]['id']}})['then'](handleEntityNotFound(_0x445338,null))[_0x0738('0x24')](saveUpdates(_0x51c338['body'],null))[_0x0738('0x24')](respondWithResult(_0x445338,null))['catch'](handleError(_0x445338,null));};exports[_0x0738('0x3b')]=function(_0x239431,_0x186f09){return db[_0x0738('0x40')][_0x0738('0x5b')]({'where':{'id':_0x239431['params']['id']}})['then'](handleEntityNotFound(_0x186f09,null))[_0x0738('0x24')](removeEntity(_0x186f09,null))[_0x0738('0x2e')](handleError(_0x186f09,null));};exports[_0x0738('0x5d')]=function(_0x1d4c9e,_0x829eb1){return db[_0x0738('0x40')][_0x0738('0x5d')]()[_0x0738('0x24')](respondWithResult(_0x829eb1,null))[_0x0738('0x2e')](handleError(_0x829eb1,null));};var interaction_log=require(_0x0738('0x15'))(_0x0738('0x5e'));exports[_0x0738('0x5f')]=function(_0x3de953,_0x3135e8,_0x3090cc){var _0x391c92={'agent':{},'channel':_0x0738('0x60')};if(_0x3de953[_0x0738('0x5c')]['id']){delete _0x3de953[_0x0738('0x5c')]['id'];}_0x3de953['body'][_0x0738('0x61')]=!![];_0x3de953['body'][_0x0738('0x62')]=moment()['format'](_0x0738('0x63'));_0x3de953[_0x0738('0x5c')][_0x0738('0x64')]=_0x3de953['body']['UserId']||_0x3de953['user']['id'];_0x391c92[_0x0738('0x65')]['id']=_0x3de953[_0x0738('0x5c')][_0x0738('0x64')];return db[_0x0738('0x40')][_0x0738('0x5b')]({'where':{'id':_0x3de953[_0x0738('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3135e8,null))[_0x0738('0x24')](saveUpdates(_0x3de953[_0x0738('0x5c')],null))[_0x0738('0x24')](function(_0x31a223){if(_0x31a223){_0x391c92[_0x0738('0x2c')]=_0x31a223[_0x0738('0x66')]({'plain':!![]});return db[_0x0738('0x67')][_0x0738('0x5b')]({'where':{'id':_0x31a223[_0x0738('0x68')]}});}return null;})[_0x0738('0x24')](handleEntityNotFound(_0x3135e8,null))[_0x0738('0x24')](function(_0x36c8d9){if(_0x36c8d9){return _0x36c8d9[_0x0738('0x3a')]({'UserId':_0x3de953[_0x0738('0x5c')][_0x0738('0x64')],'read1stAt':_['isNil'](_0x36c8d9[_0x0738('0x69')])?moment()[_0x0738('0x6a')](_0x0738('0x63')):undefined});}return null;})[_0x0738('0x24')](function(_0x4f9648){if(_0x4f9648){_0x391c92[_0x0738('0x6b')]=_0x4f9648['get']({'plain':!![]});interaction_log[_0x0738('0x25')](_0x0738('0x6c'),_0x3de953[_0x0738('0x6d')]['id'],_0x3de953[_0x0738('0x6d')][_0x0738('0x3d')],_0x3de953[_0x0738('0x6d')][_0x0738('0x6e')],_0x391c92['interaction']['id'],_0x3de953[_0x0738('0x5c')]?JSON[_0x0738('0x28')](_0x3de953[_0x0738('0x5c')]):'null');return respondWithRpcPromise(_0x0738('0x6f'),_0x0738('0x70'),_0x391c92);}return null;})[_0x0738('0x24')](function(_0x5c7aaf){var _0x5a3cf4=_0x0738('0x71')+_0x5c7aaf[_0x0738('0x2c')][_0x0738('0x72')];return db[_0x0738('0x73')][_0x0738('0x44')](_0x5a3cf4,{'type':db['Sequelize'][_0x0738('0x74')][_0x0738('0x75')],'raw':!![]})['then'](function(_0x22f809){return _0x22f809;});})[_0x0738('0x24')](function(_0x70bb6a){if(_0x70bb6a){_0x391c92[_0x0738('0x2c')][_0x0738('0x76')]=_0x70bb6a[0x0];if(!_0x3de953['body']['UserId'])return;return db[_0x0738('0x77')][_0x0738('0x5b')]({'where':{'id':_0x3de953[_0x0738('0x5c')][_0x0738('0x64')],'role':'agent'},'attributes':['id',_0x0738('0x3d'),_0x0738('0x78'),_0x0738('0x79'),'internal'],'raw':!![]});}return null;})['then'](function(_0x261814){if(!_0x261814)return null;_0x391c92[_0x0738('0x2c')][_0x0738('0x65')]=_0x261814;return _0x391c92;})['then'](function(_0x3f5bc0){if(_0x3f5bc0){if(_0x3de953[_0x0738('0x5c')][_0x0738('0x7a')]){_0x391c92['message'][_0x0738('0x7b')]=util[_0x0738('0x6a')]('SIP/%s',_0x3de953[_0x0738('0x6d')][_0x0738('0x3d')]);_0x391c92['message'][_0x0738('0x7c')]=_0x391c92[_0x0738('0x7c')];_0x391c92[_0x0738('0x2c')][_0x0738('0x7d')]=_0x391c92[_0x0738('0x7c')];_0x391c92[_0x0738('0x2c')]['event']=_0x0738('0x5f');return respondWithRpcPromise(_0x0738('0x7e'),_0x0738('0x7e'),{'event':_0x0738('0x7f'),'message':_0x391c92[_0x0738('0x2c')]},client9002)[_0x0738('0x24')](function(){return _0x391c92;});}return _0x391c92;}return null;})[_0x0738('0x24')](respondWithResult(_0x3135e8,null))['catch'](handleError(_0x3135e8,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports['reject']=function(_0x563b46,_0x330e2d,_0x482e41){var _0x3cab75={'agent':{},'channel':_0x0738('0x60')};if(_0x563b46[_0x0738('0x5c')]['id']){delete _0x563b46[_0x0738('0x5c')]['id'];}_0x563b46[_0x0738('0x5c')][_0x0738('0x64')]=_0x563b46['body'][_0x0738('0x64')]||_0x563b46[_0x0738('0x6d')]['id'];_0x3cab75['agent']['id']=_0x563b46[_0x0738('0x5c')][_0x0738('0x64')];return db[_0x0738('0x40')][_0x0738('0x5b')]({'where':{'id':_0x563b46[_0x0738('0x59')]['id'],'UserId':null}})[_0x0738('0x24')](handleEntityNotFound(_0x330e2d,null))[_0x0738('0x24')](function(_0x57c5cd){if(_0x57c5cd){_0x3cab75[_0x0738('0x2c')]=_0x57c5cd['get']({'plain':!![]});return db[_0x0738('0x67')][_0x0738('0x5b')]({'where':{'id':_0x57c5cd[_0x0738('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x330e2d,null))[_0x0738('0x24')](function(_0xc8d679){if(_0xc8d679){_0x3cab75[_0x0738('0x6b')]=_0xc8d679[_0x0738('0x66')]({'plain':!![]});interaction_log['info'](_0x0738('0x80'),_0x563b46['user']['id'],_0x563b46[_0x0738('0x6d')][_0x0738('0x3d')],_0x563b46['user'][_0x0738('0x6e')],_0x3cab75[_0x0738('0x6b')]['id'],_0x563b46[_0x0738('0x5c')]?JSON[_0x0738('0x28')](_0x563b46[_0x0738('0x5c')]):_0x0738('0x81'));return respondWithRpcPromise(_0x0738('0x82'),'rejectMessage',_0x3cab75);}return null;})[_0x0738('0x24')](function(_0x4d4b14){var _0x2f5495=_0x0738('0x71')+_0x4d4b14['message']['ContactId'];return db[_0x0738('0x73')][_0x0738('0x44')](_0x2f5495,{'type':db[_0x0738('0x83')][_0x0738('0x74')][_0x0738('0x75')],'raw':!![]})['then'](function(_0x1d2aa6){return _0x1d2aa6;});})[_0x0738('0x24')](function(_0x1c8388){if(_0x1c8388){_0x3cab75[_0x0738('0x2c')]['contact']=_0x1c8388[0x0];if(!_0x563b46['body'][_0x0738('0x64')])return;return db[_0x0738('0x77')][_0x0738('0x5b')]({'where':{'id':_0x563b46[_0x0738('0x5c')][_0x0738('0x64')],'role':_0x0738('0x65')},'attributes':['id',_0x0738('0x3d'),_0x0738('0x78'),_0x0738('0x79'),_0x0738('0x84')],'raw':!![]});}return null;})[_0x0738('0x24')](function(_0x191b43){if(!_0x191b43)return null;_0x3cab75[_0x0738('0x2c')][_0x0738('0x65')]=_0x191b43;return _0x3cab75;})[_0x0738('0x24')](function(_0x1513a2){if(_0x1513a2){_0x1513a2[_0x0738('0x2c')][_0x0738('0x7b')]=util['format'](_0x0738('0x85'),_0x563b46[_0x0738('0x6d')][_0x0738('0x3d')]);_0x1513a2[_0x0738('0x2c')][_0x0738('0x7c')]=_0x3cab75[_0x0738('0x7c')];_0x1513a2[_0x0738('0x2c')][_0x0738('0x7d')]=_0x3cab75['channel'];_0x1513a2[_0x0738('0x2c')][_0x0738('0x86')]='reject';respondWithRpcPromise(_0x0738('0x7e'),_0x0738('0x7e'),{'event':_0x0738('0x87'),'message':_0x1513a2[_0x0738('0x2c')]},client9002);return _0x3cab75;}return null;})[_0x0738('0x24')](respondWithResult(_0x330e2d,null))[_0x0738('0x2e')](handleError(_0x330e2d,null));};exports[_0x0738('0x88')]=function(_0x17c02c,_0x28ed64){var _0x17098a;return db['FaxMessage']['create'](_0x17c02c[_0x0738('0x5c')],{})['then'](function(_0x349d64){_0x17098a=_0x349d64;return db['CmContact'][_0x0738('0x89')]({'where':{'id':_0x17098a[_0x0738('0x72')]}});})[_0x0738('0x24')](function(_0x2f9f73){if(_[_0x0738('0x8a')](_0x2f9f73)){return;}else{_0x17098a[_0x0738('0x60')]=_0x2f9f73['fax'];return db['Attachment']['findOne']({'where':{'id':_0x17098a[_0x0738('0x8b')]}});}})[_0x0738('0x24')](function(_0x2a3589){return respondWithRpcPromise(_0x0738('0x8c'),_0x0738('0x8c'),{'FaxAccountId':_[_0x0738('0x8a')](_0x17c02c[_0x0738('0x5c')])?undefined:_0x17c02c[_0x0738('0x5c')][_0x0738('0x8d')],'path':_['isNil'](_0x2a3589)?undefined:util[_0x0738('0x6a')](_0x0738('0x8e'),_0x2a3589[_0x0738('0x8f')]),'fax':_[_0x0738('0x8a')](_0x17098a[_0x0738('0x60')])?undefined:_0x17098a[_0x0738('0x60')],'AttachmentId':_0x17098a[_0x0738('0x8b')]},client9002);})['then'](respondWithResult(_0x28ed64,0xc9))['catch'](handleError(_0x28ed64,null));};exports[_0x0738('0x90')]=function(_0x3fa2eb,_0x3a073d){var _0xed00b2=path[_0x0738('0x91')](config['root'],_0x0738('0x92'),_0x0738('0x93'),'attachments');return db[_0x0738('0x40')][_0x0738('0x5b')]({'where':{'id':_0x3fa2eb['params']['id']},'include':[{'model':db[_0x0738('0x94')],'as':_0x0738('0x94')}]})[_0x0738('0x24')](handleEntityNotFound(_0x3a073d,null))[_0x0738('0x24')](function(_0x3ff0eb){if(_0x3ff0eb){return _0x3a073d[_0x0738('0x90')](path[_0x0738('0x91')](_0xed00b2,_0x3ff0eb[_0x0738('0x94')][_0x0738('0x8f')]));}})[_0x0738('0x2e')](handleError(_0x3a073d,null));}; \ No newline at end of file +var _0x12a4=['User','email','internal','manual','interface','channel','motionChannel','EventManager','acceptmessage','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','sequelize','fullname','SIP/%s','rejectmessage','create','CmContact','findOne','Attachment','SendFax','FaxAccountId','basename','join','server','files','attachments','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','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','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','index','FaxMessage','rawAttributes','type','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','params','includeAll','find','body','describe','fax-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact'];(function(_0x3951f8,_0x4d0ee2){var _0x1ff85e=function(_0x3a5409){while(--_0x3a5409){_0x3951f8['push'](_0x3951f8['shift']());}};_0x1ff85e(++_0x4d0ee2);}(_0x12a4,0x13a));var _0x412a=function(_0x329664,_0x130748){_0x329664=_0x329664-0x0;var _0x4e346e=_0x12a4[_0x329664];return _0x4e346e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x412a('0x0'));var zipdir=require(_0x412a('0x1'));var jsonpatch=require(_0x412a('0x2'));var rp=require(_0x412a('0x3'));var moment=require(_0x412a('0x4'));var BPromise=require(_0x412a('0x5'));var Mustache=require(_0x412a('0x6'));var util=require(_0x412a('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x412a('0x8'));var fs=require('fs');var fs_extra=require(_0x412a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x412a('0xa'));var jsforce=require(_0x412a('0xb'));var deskjs=require(_0x412a('0xc'));var toCsv=require(_0x412a('0xd'));var querystring=require('querystring');var Papa=require(_0x412a('0xe'));var Redis=require(_0x412a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x412a('0x10'));var as=require(_0x412a('0x11'));var hardwareService=require(_0x412a('0x12'));var logger=require(_0x412a('0x13'))(_0x412a('0x14'));var utils=require(_0x412a('0x15'));var config=require(_0x412a('0x16'));var licenseUtil=require(_0x412a('0x17'));var db=require(_0x412a('0x18'))['db'];config[_0x412a('0x19')]=_[_0x412a('0x1a')](config[_0x412a('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x412a('0x1b'))(new Redis(config['redis']));require('./faxMessage.socket')[_0x412a('0x1c')](socket);var jayson=require(_0x412a('0x1d'));var client=jayson[_0x412a('0x1e')][_0x412a('0x1f')]({'port':0x232c});var client9002=jayson[_0x412a('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3740d7,_0x80ffc2,_0x184de0,_0x22d2e6){return new BPromise(function(_0x354bcd,_0x33ebdc){var _0x37a78b=_0x22d2e6||client;return _0x37a78b[_0x412a('0x20')](_0x3740d7,_0x184de0)[_0x412a('0x21')](function(_0x3ba6be){logger[_0x412a('0x22')](_0x412a('0x23'),_0x80ffc2,_0x412a('0x24'));logger[_0x412a('0x25')](_0x412a('0x26'),_0x80ffc2,_0x412a('0x24'),JSON['stringify'](_0x3ba6be));if(_0x3ba6be[_0x412a('0x27')]){if(_0x3ba6be[_0x412a('0x27')][_0x412a('0x28')]===0x1f4){logger[_0x412a('0x27')]('FaxMessage,\x20%s,\x20%s',_0x80ffc2,_0x3ba6be['error'][_0x412a('0x29')]);return _0x33ebdc(_0x3ba6be[_0x412a('0x27')]['message']);}logger[_0x412a('0x27')]('FaxMessage,\x20%s,\x20%s',_0x80ffc2,_0x3ba6be['error'][_0x412a('0x29')]);return _0x354bcd(_0x3ba6be[_0x412a('0x27')][_0x412a('0x29')]);}else{logger[_0x412a('0x22')]('FaxMessage,\x20%s,\x20%s',_0x80ffc2,_0x412a('0x24'));_0x354bcd(_0x3ba6be[_0x412a('0x2a')][_0x412a('0x29')]);}})[_0x412a('0x2b')](function(_0x25f14d){logger[_0x412a('0x27')](_0x412a('0x23'),_0x80ffc2,_0x25f14d);_0x33ebdc(_0x25f14d);});});}function respondWithStatusCode(_0x273dcc,_0x549823){_0x549823=_0x549823||0xcc;return function(_0x468572){if(_0x468572){return _0x273dcc[_0x412a('0x2c')](_0x549823);}return _0x273dcc[_0x412a('0x2d')](_0x549823)['end']();};}function respondWithResult(_0x297296,_0x40030e){_0x40030e=_0x40030e||0xc8;return function(_0x6d364e){if(_0x6d364e){return _0x297296['status'](_0x40030e)[_0x412a('0x2e')](_0x6d364e);}};}function respondWithFilteredResult(_0x1b5378,_0x510d9f){return function(_0x373aed){if(_0x373aed){var _0x2811fc=typeof _0x510d9f[_0x412a('0x2f')]===_0x412a('0x30')&&typeof _0x510d9f[_0x412a('0x31')]===_0x412a('0x30');var _0x126870=_0x373aed[_0x412a('0x32')];var _0x2a029b=_0x2811fc?0x0:_0x510d9f['offset'];var _0x4e776a=_0x2811fc?_0x373aed['count']:_0x510d9f[_0x412a('0x2f')]+_0x510d9f[_0x412a('0x31')];var _0x2f5d1f;if(_0x4e776a>=_0x126870){_0x4e776a=_0x126870;_0x2f5d1f=0xc8;}else{_0x2f5d1f=0xce;}_0x1b5378[_0x412a('0x2d')](_0x2f5d1f);return _0x1b5378[_0x412a('0x33')](_0x412a('0x34'),_0x2a029b+'-'+_0x4e776a+'/'+_0x126870)[_0x412a('0x2e')](_0x373aed);}return null;};}function patchUpdates(_0x6a0c98){return function(_0xe5d168){try{jsonpatch[_0x412a('0x35')](_0xe5d168,_0x6a0c98,!![]);}catch(_0x28112b){return BPromise[_0x412a('0x36')](_0x28112b);}return _0xe5d168[_0x412a('0x37')]();};}function saveUpdates(_0x3d63f6,_0x23fd83){return function(_0x4b58e9){if(_0x4b58e9){return _0x4b58e9[_0x412a('0x38')](_0x3d63f6)[_0x412a('0x21')](function(_0x54d2eb){return _0x54d2eb;});}return null;};}function removeEntity(_0x1a2d93,_0x48334b){return function(_0x3776d1){if(_0x3776d1){return _0x3776d1[_0x412a('0x39')]()[_0x412a('0x21')](function(){_0x1a2d93[_0x412a('0x2d')](0xcc)[_0x412a('0x3a')]();});}};}function handleEntityNotFound(_0x17fb96,_0x70bb19){return function(_0x47b7b4){if(!_0x47b7b4){_0x17fb96['sendStatus'](0x194);}return _0x47b7b4;};}function handleError(_0x2b7d94,_0x81238d){_0x81238d=_0x81238d||0x1f4;return function(_0x4e4f64){logger[_0x412a('0x27')](_0x4e4f64[_0x412a('0x3b')]);if(_0x4e4f64[_0x412a('0x3c')]){delete _0x4e4f64['name'];}_0x2b7d94[_0x412a('0x2d')](_0x81238d)['send'](_0x4e4f64);};}exports[_0x412a('0x3d')]=function(_0x42fe45,_0x93a0fb){var _0x3c5356={},_0x1cca60={},_0x305baa={'count':0x0,'rows':[]};var _0x127e9b=_['map'](db[_0x412a('0x3e')][_0x412a('0x3f')],function(_0x1e578d){return{'name':_0x1e578d['fieldName'],'type':_0x1e578d[_0x412a('0x40')]['key']};});_0x1cca60['model']=_[_0x412a('0x41')](_0x127e9b,_0x412a('0x3c'));_0x1cca60[_0x412a('0x42')]=_[_0x412a('0x43')](_0x42fe45[_0x412a('0x42')]);_0x1cca60['filters']=_[_0x412a('0x44')](_0x1cca60[_0x412a('0x45')],_0x1cca60[_0x412a('0x42')]);_0x3c5356['attributes']=_[_0x412a('0x44')](_0x1cca60['model'],qs[_0x412a('0x46')](_0x42fe45['query'][_0x412a('0x46')]));_0x3c5356[_0x412a('0x47')]=_0x3c5356['attributes'][_0x412a('0x48')]?_0x3c5356[_0x412a('0x47')]:_0x1cca60[_0x412a('0x45')];if(!_0x42fe45[_0x412a('0x42')][_0x412a('0x49')]('nolimit')){_0x3c5356['limit']=qs[_0x412a('0x31')](_0x42fe45['query'][_0x412a('0x31')]);_0x3c5356[_0x412a('0x2f')]=qs[_0x412a('0x2f')](_0x42fe45[_0x412a('0x42')]['offset']);}_0x3c5356['order']=qs['sort'](_0x42fe45['query'][_0x412a('0x4a')]);_0x3c5356[_0x412a('0x4b')]=qs[_0x412a('0x4c')](_[_0x412a('0x4d')](_0x42fe45[_0x412a('0x42')],_0x1cca60['filters']),_0x127e9b);if(_0x42fe45['query'][_0x412a('0x4e')]){_0x3c5356[_0x412a('0x4b')]=_[_0x412a('0x4f')](_0x3c5356['where'],{'$or':_[_0x412a('0x41')](_0x127e9b,function(_0xc82611){if(_0xc82611[_0x412a('0x40')]!==_0x412a('0x50')){var _0xb83eac={};_0xb83eac[_0xc82611['name']]={'$like':'%'+_0x42fe45['query']['filter']+'%'};return _0xb83eac;}})});}_0x3c5356=_[_0x412a('0x4f')]({},_0x3c5356,_0x42fe45[_0x412a('0x51')]);var _0x28f54c={'where':_0x3c5356[_0x412a('0x4b')]};return db['FaxMessage']['count'](_0x28f54c)[_0x412a('0x21')](function(_0x3b4ae8){_0x305baa[_0x412a('0x32')]=_0x3b4ae8;if(_0x42fe45['query']['includeAll']){_0x3c5356[_0x412a('0x52')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x3c5356);})['then'](function(_0xfd94f3){_0x305baa[_0x412a('0x53')]=_0xfd94f3;return _0x305baa;})[_0x412a('0x21')](respondWithFilteredResult(_0x93a0fb,_0x3c5356))[_0x412a('0x2b')](handleError(_0x93a0fb,null));};exports['show']=function(_0x3724df,_0x2f730c){var _0x3bb472={'raw':!![],'where':{'id':_0x3724df[_0x412a('0x54')]['id']}},_0x5d878e={};_0x5d878e[_0x412a('0x45')]=_[_0x412a('0x43')](db['FaxMessage'][_0x412a('0x3f')]);_0x5d878e[_0x412a('0x42')]=_['keys'](_0x3724df[_0x412a('0x42')]);_0x5d878e[_0x412a('0x4c')]=_['intersection'](_0x5d878e[_0x412a('0x45')],_0x5d878e[_0x412a('0x42')]);_0x3bb472['attributes']=_[_0x412a('0x44')](_0x5d878e['model'],qs[_0x412a('0x46')](_0x3724df[_0x412a('0x42')][_0x412a('0x46')]));_0x3bb472['attributes']=_0x3bb472[_0x412a('0x47')][_0x412a('0x48')]?_0x3bb472[_0x412a('0x47')]:_0x5d878e['model'];if(_0x3724df[_0x412a('0x42')][_0x412a('0x55')]){_0x3bb472[_0x412a('0x52')]=[{'all':!![]}];}_0x3bb472=_[_0x412a('0x4f')]({},_0x3bb472,_0x3724df['options']);return db[_0x412a('0x3e')][_0x412a('0x56')](_0x3bb472)[_0x412a('0x21')](handleEntityNotFound(_0x2f730c,null))[_0x412a('0x21')](respondWithResult(_0x2f730c,null))[_0x412a('0x2b')](handleError(_0x2f730c,null));};exports[_0x412a('0x38')]=function(_0x2989f7,_0xd8150c){if(_0x2989f7[_0x412a('0x57')]['id']){delete _0x2989f7[_0x412a('0x57')]['id'];}return db['FaxMessage'][_0x412a('0x56')]({'where':{'id':_0x2989f7[_0x412a('0x54')]['id']}})['then'](handleEntityNotFound(_0xd8150c,null))[_0x412a('0x21')](saveUpdates(_0x2989f7[_0x412a('0x57')],null))[_0x412a('0x21')](respondWithResult(_0xd8150c,null))[_0x412a('0x2b')](handleError(_0xd8150c,null));};exports[_0x412a('0x39')]=function(_0x3bedaa,_0x185241){return db[_0x412a('0x3e')][_0x412a('0x56')]({'where':{'id':_0x3bedaa[_0x412a('0x54')]['id']}})[_0x412a('0x21')](handleEntityNotFound(_0x185241,null))[_0x412a('0x21')](removeEntity(_0x185241,null))['catch'](handleError(_0x185241,null));};exports[_0x412a('0x58')]=function(_0x2d826b,_0x43ef1f){return db[_0x412a('0x3e')][_0x412a('0x58')]()[_0x412a('0x21')](respondWithResult(_0x43ef1f,null))['catch'](handleError(_0x43ef1f,null));};var interaction_log=require(_0x412a('0x13'))(_0x412a('0x59'));exports[_0x412a('0x5a')]=function(_0x5335ca,_0x134986,_0x28b9a4){var _0x590552={'agent':{},'channel':'fax'};if(_0x5335ca[_0x412a('0x57')]['id']){delete _0x5335ca[_0x412a('0x57')]['id'];}_0x5335ca[_0x412a('0x57')]['read']=!![];_0x5335ca[_0x412a('0x57')][_0x412a('0x5b')]=moment()[_0x412a('0x5c')](_0x412a('0x5d'));_0x5335ca[_0x412a('0x57')][_0x412a('0x5e')]=_0x5335ca[_0x412a('0x57')][_0x412a('0x5e')]||_0x5335ca['user']['id'];_0x590552[_0x412a('0x5f')]['id']=_0x5335ca[_0x412a('0x57')][_0x412a('0x5e')];return db[_0x412a('0x3e')][_0x412a('0x56')]({'where':{'id':_0x5335ca[_0x412a('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x134986,null))[_0x412a('0x21')](saveUpdates(_0x5335ca[_0x412a('0x57')],null))[_0x412a('0x21')](function(_0x46dd70){if(_0x46dd70){_0x590552[_0x412a('0x29')]=_0x46dd70[_0x412a('0x60')]({'plain':!![]});return db[_0x412a('0x61')][_0x412a('0x56')]({'where':{'id':_0x46dd70[_0x412a('0x62')]}});}return null;})[_0x412a('0x21')](handleEntityNotFound(_0x134986,null))[_0x412a('0x21')](function(_0x16ad9c){if(_0x16ad9c){return _0x16ad9c[_0x412a('0x38')]({'UserId':_0x5335ca[_0x412a('0x57')]['UserId'],'read1stAt':_[_0x412a('0x63')](_0x16ad9c[_0x412a('0x64')])?moment()['format'](_0x412a('0x5d')):undefined});}return null;})[_0x412a('0x21')](function(_0x2c8df2){if(_0x2c8df2){_0x590552[_0x412a('0x65')]=_0x2c8df2[_0x412a('0x60')]({'plain':!![]});interaction_log['info'](_0x412a('0x66'),_0x5335ca[_0x412a('0x67')]['id'],_0x5335ca[_0x412a('0x67')]['name'],_0x5335ca[_0x412a('0x67')]['role'],_0x590552['interaction']['id'],_0x5335ca['body']?JSON[_0x412a('0x68')](_0x5335ca[_0x412a('0x57')]):_0x412a('0x69'));return respondWithRpcPromise('AcceptMessage',_0x412a('0x6a'),_0x590552);}return null;})[_0x412a('0x21')](function(_0x550f2a){var _0x516f77=_0x412a('0x6b')+_0x550f2a[_0x412a('0x29')]['ContactId'];return db['sequelize'][_0x412a('0x42')](_0x516f77,{'type':db[_0x412a('0x6c')][_0x412a('0x6d')][_0x412a('0x6e')],'raw':!![]})[_0x412a('0x21')](function(_0x4950e5){return _0x4950e5;});})[_0x412a('0x21')](function(_0x3d69ba){if(_0x3d69ba){_0x590552['message'][_0x412a('0x6f')]=_0x3d69ba[0x0];if(!_0x5335ca[_0x412a('0x57')][_0x412a('0x5e')])return;return db[_0x412a('0x70')]['find']({'where':{'id':_0x5335ca['body'][_0x412a('0x5e')],'role':_0x412a('0x5f')},'attributes':['id',_0x412a('0x3c'),'fullname',_0x412a('0x71'),_0x412a('0x72')],'raw':!![]});}return null;})['then'](function(_0x257161){if(!_0x257161)return null;_0x590552[_0x412a('0x29')][_0x412a('0x5f')]=_0x257161;return _0x590552;})[_0x412a('0x21')](function(_0x244499){if(_0x244499){if(_0x5335ca[_0x412a('0x57')][_0x412a('0x73')]){_0x590552[_0x412a('0x29')][_0x412a('0x74')]=util[_0x412a('0x5c')]('SIP/%s',_0x5335ca[_0x412a('0x67')][_0x412a('0x3c')]);_0x590552[_0x412a('0x29')][_0x412a('0x75')]=_0x590552[_0x412a('0x75')];_0x590552[_0x412a('0x29')][_0x412a('0x76')]=_0x590552['channel'];_0x590552[_0x412a('0x29')]['event']='accept';return respondWithRpcPromise(_0x412a('0x77'),_0x412a('0x77'),{'event':_0x412a('0x78'),'message':_0x590552[_0x412a('0x29')]},client9002)['then'](function(){return _0x590552;});}return _0x590552;}return null;})[_0x412a('0x21')](respondWithResult(_0x134986,null))['catch'](handleError(_0x134986,null));};var interaction_log=require(_0x412a('0x13'))(_0x412a('0x59'));exports[_0x412a('0x36')]=function(_0x2fb0c3,_0x48bf6b,_0xcb01b1){var _0x430899={'agent':{},'channel':_0x412a('0x79')};if(_0x2fb0c3[_0x412a('0x57')]['id']){delete _0x2fb0c3['body']['id'];}_0x2fb0c3[_0x412a('0x57')][_0x412a('0x5e')]=_0x2fb0c3[_0x412a('0x57')]['UserId']||_0x2fb0c3[_0x412a('0x67')]['id'];_0x430899['agent']['id']=_0x2fb0c3['body'][_0x412a('0x5e')];return db[_0x412a('0x3e')]['find']({'where':{'id':_0x2fb0c3[_0x412a('0x54')]['id'],'UserId':null}})[_0x412a('0x21')](handleEntityNotFound(_0x48bf6b,null))[_0x412a('0x21')](function(_0xf26f8b){if(_0xf26f8b){_0x430899[_0x412a('0x29')]=_0xf26f8b['get']({'plain':!![]});return db[_0x412a('0x61')][_0x412a('0x56')]({'where':{'id':_0xf26f8b[_0x412a('0x62')]}});}return null;})[_0x412a('0x21')](handleEntityNotFound(_0x48bf6b,null))['then'](function(_0x25a92d){if(_0x25a92d){_0x430899[_0x412a('0x65')]=_0x25a92d['get']({'plain':!![]});interaction_log[_0x412a('0x22')](_0x412a('0x7a'),_0x2fb0c3[_0x412a('0x67')]['id'],_0x2fb0c3['user'][_0x412a('0x3c')],_0x2fb0c3[_0x412a('0x67')]['role'],_0x430899[_0x412a('0x65')]['id'],_0x2fb0c3[_0x412a('0x57')]?JSON[_0x412a('0x68')](_0x2fb0c3['body']):_0x412a('0x69'));return respondWithRpcPromise(_0x412a('0x7b'),_0x412a('0x7c'),_0x430899);}return null;})[_0x412a('0x21')](function(_0x1c174f){var _0x31829f=_0x412a('0x6b')+_0x1c174f[_0x412a('0x29')][_0x412a('0x7d')];return db[_0x412a('0x7e')]['query'](_0x31829f,{'type':db[_0x412a('0x6c')][_0x412a('0x6d')]['SELECT'],'raw':!![]})[_0x412a('0x21')](function(_0x26cb89){return _0x26cb89;});})[_0x412a('0x21')](function(_0x3dad24){if(_0x3dad24){_0x430899[_0x412a('0x29')][_0x412a('0x6f')]=_0x3dad24[0x0];if(!_0x2fb0c3['body'][_0x412a('0x5e')])return;return db['User']['find']({'where':{'id':_0x2fb0c3[_0x412a('0x57')][_0x412a('0x5e')],'role':'agent'},'attributes':['id','name',_0x412a('0x7f'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x555f33){if(!_0x555f33)return null;_0x430899[_0x412a('0x29')]['agent']=_0x555f33;return _0x430899;})[_0x412a('0x21')](function(_0x496aa5){if(_0x496aa5){_0x496aa5[_0x412a('0x29')][_0x412a('0x74')]=util[_0x412a('0x5c')](_0x412a('0x80'),_0x2fb0c3[_0x412a('0x67')][_0x412a('0x3c')]);_0x496aa5[_0x412a('0x29')][_0x412a('0x75')]=_0x430899[_0x412a('0x75')];_0x496aa5[_0x412a('0x29')][_0x412a('0x76')]=_0x430899['channel'];_0x496aa5[_0x412a('0x29')]['event']='reject';respondWithRpcPromise(_0x412a('0x77'),'EventManager',{'event':_0x412a('0x81'),'message':_0x496aa5[_0x412a('0x29')]},client9002);return _0x430899;}return null;})[_0x412a('0x21')](respondWithResult(_0x48bf6b,null))['catch'](handleError(_0x48bf6b,null));};exports[_0x412a('0x82')]=function(_0x1e3f2f,_0x3522bc){var _0x524abf;return db['FaxMessage'][_0x412a('0x82')](_0x1e3f2f['body'],{})[_0x412a('0x21')](function(_0x5c637e){_0x524abf=_0x5c637e;return db[_0x412a('0x83')][_0x412a('0x84')]({'where':{'id':_0x524abf[_0x412a('0x7d')]}});})[_0x412a('0x21')](function(_0x807b7b){if(_['isNil'](_0x807b7b)){return;}else{_0x524abf[_0x412a('0x79')]=_0x807b7b[_0x412a('0x79')];return db[_0x412a('0x85')][_0x412a('0x84')]({'where':{'id':_0x524abf['AttachmentId']}});}})[_0x412a('0x21')](function(_0x112f03){return respondWithRpcPromise('SendFax',_0x412a('0x86'),{'FaxAccountId':_[_0x412a('0x63')](_0x1e3f2f['body'])?undefined:_0x1e3f2f['body'][_0x412a('0x87')],'path':_[_0x412a('0x63')](_0x112f03)?undefined:util[_0x412a('0x5c')]('/var/opt/motion2/server/files/attachments/%s',_0x112f03[_0x412a('0x88')]),'fax':_[_0x412a('0x63')](_0x524abf[_0x412a('0x79')])?undefined:_0x524abf[_0x412a('0x79')],'AttachmentId':_0x524abf['AttachmentId']},client9002);})[_0x412a('0x21')](respondWithResult(_0x3522bc,0xc9))[_0x412a('0x2b')](handleError(_0x3522bc,null));};exports['download']=function(_0x32468f,_0x11a78f){var _0x118d38=path[_0x412a('0x89')](config['root'],_0x412a('0x8a'),_0x412a('0x8b'),_0x412a('0x8c'));return db[_0x412a('0x3e')][_0x412a('0x56')]({'where':{'id':_0x32468f[_0x412a('0x54')]['id']},'include':[{'model':db[_0x412a('0x85')],'as':_0x412a('0x85')}]})[_0x412a('0x21')](handleEntityNotFound(_0x11a78f,null))[_0x412a('0x21')](function(_0x45d6cc){if(_0x45d6cc){return _0x11a78f[_0x412a('0x8d')](path[_0x412a('0x89')](_0x118d38,_0x45d6cc[_0x412a('0x85')][_0x412a('0x88')]));}})[_0x412a('0x2b')](handleError(_0x11a78f,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index e50bd1e..59ebf3c 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 _0x9962=['events','FaxMessage','setMaxListeners','save','remove','emit','hook','exports'];(function(_0x56e13e,_0x3754cd){var _0x148751=function(_0x5864ea){while(--_0x5864ea){_0x56e13e['push'](_0x56e13e['shift']());}};_0x148751(++_0x3754cd);}(_0x9962,0xb8));var _0x2996=function(_0x3a763c,_0x2e2efd){_0x3a763c=_0x3a763c-0x0;var _0x28699f=_0x9962[_0x3a763c];return _0x28699f;};'use strict';var EventEmitter=require(_0x2996('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x2996('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x2996('0x2')](0x0);var events={'afterCreate':_0x2996('0x3'),'afterUpdate':'update','afterDestroy':_0x2996('0x4')};function emitEvent(_0x58947a){return function(_0x4221bb,_0x96baaa,_0x4a72cd){FaxMessageEvents[_0x2996('0x5')](_0x58947a+':'+_0x4221bb['id'],_0x4221bb);FaxMessageEvents[_0x2996('0x5')](_0x58947a,_0x4221bb);_0x4a72cd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x2996('0x6')](e,emitEvent(event));}}module[_0x2996('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x63a6=['FaxMessage','save','update','hook','exports','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x63a6,0x1c7));var _0x663a=function(_0x5b34c0,_0x3ad403){_0x5b34c0=_0x5b34c0-0x0;var _0x242bd3=_0x63a6[_0x5b34c0];return _0x242bd3;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x663a('0x0'))['db'][_0x663a('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x663a('0x2'),'afterUpdate':_0x663a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2a63c6){return function(_0x2a1a20,_0x10be49,_0x125e93){FaxMessageEvents['emit'](_0x2a63c6+':'+_0x2a1a20['id'],_0x2a1a20);FaxMessageEvents['emit'](_0x2a63c6,_0x2a1a20);_0x125e93(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x663a('0x4')](e,emitEvent(event));}}module[_0x663a('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 2d3eecb..784498f 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 _0x89dc=['FaxMessage','body','models','toLowerCase','direction','secret','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','catch','error','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define'];(function(_0x191b48,_0x402e4e){var _0x2aff3c=function(_0x2b7faf){while(--_0x2b7faf){_0x191b48['push'](_0x191b48['shift']());}};_0x2aff3c(++_0x402e4e);}(_0x89dc,0xe7));var _0xc89d=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x89dc[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0xc89d('0x0'));var util=require(_0xc89d('0x1'));var logger=require(_0xc89d('0x2'))(_0xc89d('0x3'));var moment=require('moment');var BPromise=require(_0xc89d('0x4'));var rp=require(_0xc89d('0x5'));var fs=require('fs');var path=require(_0xc89d('0x6'));var rimraf=require(_0xc89d('0x7'));var config=require(_0xc89d('0x8'));var attributes=require(_0xc89d('0x9'));module[_0xc89d('0xa')]=function(_0x32c582,_0xd93bc0){return _0x32c582[_0xc89d('0xb')](_0xc89d('0xc'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xc89d('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f4063,_0x44d349,_0x20970e){var _0x204170=_0x32c582[_0xc89d('0xe')];var _0x17b2db=_0x4f4063['get']({'plain':!![]});if(_0x17b2db['direction'][_0xc89d('0xf')]()==='in'||_0x17b2db[_0xc89d('0x10')]['toLowerCase']()==='out'&&!_0x17b2db[_0xc89d('0x11')]&&!_[_0xc89d('0x12')](_0x17b2db[_0xc89d('0x13')])){_0x204170[_0xc89d('0x14')]['findOne']({'where':{'id':_0x17b2db[_0xc89d('0x15')]}})[_0xc89d('0x16')](function(_0x3dc216){if(_0x3dc216){_0x3dc216[_0xc89d('0x17')]({'lastMsgAt':_0x17b2db[_0xc89d('0x18')],'lastMsgDirection':_0x17b2db['direction'][_0xc89d('0xf')]()});}})[_0xc89d('0x19')](function(_0x24e0ab){console[_0xc89d('0x1a')](_0x24e0ab);});}_0x20970e();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1da4=['direction','toLowerCase','out','isNil','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models'];(function(_0x530a58,_0x141d0a){var _0x46efd4=function(_0x5b699a){while(--_0x5b699a){_0x530a58['push'](_0x530a58['shift']());}};_0x46efd4(++_0x141d0a);}(_0x1da4,0xc9));var _0x41da=function(_0x556245,_0x40f597){_0x556245=_0x556245-0x0;var _0x2ce703=_0x1da4[_0x556245];return _0x2ce703;};'use strict';var _=require(_0x41da('0x0'));var util=require('util');var logger=require(_0x41da('0x1'))(_0x41da('0x2'));var moment=require(_0x41da('0x3'));var BPromise=require(_0x41da('0x4'));var rp=require(_0x41da('0x5'));var fs=require('fs');var path=require(_0x41da('0x6'));var rimraf=require(_0x41da('0x7'));var config=require('../../config/environment');var attributes=require('./faxMessage.attributes');module[_0x41da('0x8')]=function(_0x50717c,_0x4494d4){return _0x50717c['define'](_0x41da('0x9'),attributes,{'tableName':_0x41da('0xa'),'paranoid':![],'indexes':[{'name':_0x41da('0xb'),'fields':[_0x41da('0xc')],'type':_0x41da('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b0f5f,_0x5a2571,_0x3b7a6a){var _0x35eacc=_0x50717c[_0x41da('0xe')];var _0x370932=_0x2b0f5f['get']({'plain':!![]});if(_0x370932[_0x41da('0xf')][_0x41da('0x10')]()==='in'||_0x370932['direction'][_0x41da('0x10')]()===_0x41da('0x11')&&!_0x370932['secret']&&!_[_0x41da('0x12')](_0x370932['UserId'])){_0x35eacc['FaxInteraction']['findOne']({'where':{'id':_0x370932[_0x41da('0x13')]}})[_0x41da('0x14')](function(_0x1889b0){if(_0x1889b0){_0x1889b0[_0x41da('0x15')]({'lastMsgAt':_0x370932[_0x41da('0x16')],'lastMsgDirection':_0x370932[_0x41da('0xf')][_0x41da('0x10')]()});}})[_0x41da('0x17')](function(_0x3168db){console[_0x41da('0x18')](_0x3168db);});}_0x3b7a6a();}},'charset':_0x41da('0x19'),'collate':_0x41da('0x1a')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 10aa7de..5900c0d 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 _0x24ca=['redis','defaults','socket.io-emitter','./faxMessage.socket','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','create','body','options','stringify','UpdateFaxMessage','FaxMessage','update','where','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x24ca,0x1bc));var _0xa24c=function(_0x42bafd,_0x3f0fe3){_0x42bafd=_0x42bafd-0x0;var _0x2ed705=_0x24ca[_0x42bafd];return _0x2ed705;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require(_0xa24c('0x1'));var BPromise=require(_0xa24c('0x2'));var rs=require(_0xa24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa24c('0x4'))['db'];var utils=require(_0xa24c('0x5'));var logger=require(_0xa24c('0x6'))(_0xa24c('0x7'));var config=require(_0xa24c('0x8'));var jayson=require(_0xa24c('0x9'));var client=jayson[_0xa24c('0xa')][_0xa24c('0xb')]({'port':0x232a});config[_0xa24c('0xc')]=_[_0xa24c('0xd')](config[_0xa24c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa24c('0xe'))(new Redis(config[_0xa24c('0xc')]));require(_0xa24c('0xf'))['register'](socket);function respondWithRpcPromise(_0x399f32,_0x325c6d,_0x288f76){return new BPromise(function(_0x211003,_0x169632){return client[_0xa24c('0x10')](_0x399f32,_0x288f76)[_0xa24c('0x11')](function(_0xc82af0){logger[_0xa24c('0x12')]('FaxMessage,\x20%s,\x20%s',_0x325c6d,_0xa24c('0x13'));logger[_0xa24c('0x14')](_0xa24c('0x15'),_0x325c6d,_0xa24c('0x13'),JSON['stringify'](_0xc82af0));if(_0xc82af0[_0xa24c('0x16')]){if(_0xc82af0[_0xa24c('0x16')][_0xa24c('0x17')]===0x1f4){logger[_0xa24c('0x16')](_0xa24c('0x18'),_0x325c6d,_0xc82af0[_0xa24c('0x16')][_0xa24c('0x19')]);return _0x169632(_0xc82af0['error']['message']);}logger[_0xa24c('0x16')](_0xa24c('0x18'),_0x325c6d,_0xc82af0['error']['message']);return _0x211003(_0xc82af0[_0xa24c('0x16')][_0xa24c('0x19')]);}else{logger['info'](_0xa24c('0x18'),_0x325c6d,'request\x20sent');_0x211003(_0xc82af0[_0xa24c('0x1a')][_0xa24c('0x19')]);}})[_0xa24c('0x1b')](function(_0xefdbd9){logger['error'](_0xa24c('0x18'),_0x325c6d,_0xefdbd9);_0x169632(_0xefdbd9);});});}exports[_0xa24c('0x1c')]=function(_0x773f70){var _0x4d4bab=this;return new Promise(function(_0x48a768,_0x506424){return db['FaxMessage'][_0xa24c('0x1d')](_0x773f70[_0xa24c('0x1e')],{'raw':_0x773f70[_0xa24c('0x1f')]?_0x773f70[_0xa24c('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0xa24c('0x11')](function(_0x5f299e){logger[_0xa24c('0x12')](_0xa24c('0x1c'),_0x773f70);logger['debug'](_0xa24c('0x1c'),_0x773f70,JSON[_0xa24c('0x20')](_0x5f299e));_0x48a768(_0x5f299e);})[_0xa24c('0x1b')](function(_0x188ee2){logger[_0xa24c('0x16')]('CreateFaxMessage',_0x188ee2[_0xa24c('0x19')],_0x773f70);_0x506424(_0x4d4bab['error'](0x1f4,_0x188ee2[_0xa24c('0x19')]));});});};exports[_0xa24c('0x21')]=function(_0x294685){var _0x51dc3f=this;return new Promise(function(_0x1beb55,_0x31c4d9){return db[_0xa24c('0x22')][_0xa24c('0x23')](_0x294685[_0xa24c('0x1e')],{'raw':_0x294685[_0xa24c('0x1f')]?_0x294685[_0xa24c('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x294685[_0xa24c('0x1f')]?_0x294685[_0xa24c('0x1f')][_0xa24c('0x24')]||null:null,'attributes':_0x294685[_0xa24c('0x1f')]?_0x294685['options'][_0xa24c('0x25')]||null:null,'limit':_0x294685[_0xa24c('0x1f')]?_0x294685[_0xa24c('0x1f')]['limit']||null:null})[_0xa24c('0x11')](function(_0x3dcb1b){logger[_0xa24c('0x12')]('UpdateFaxMessage',_0x294685);logger[_0xa24c('0x14')]('UpdateFaxMessage',_0x294685,JSON[_0xa24c('0x20')](_0x3dcb1b));_0x1beb55(_0x3dcb1b);})[_0xa24c('0x1b')](function(_0x1a247b){logger['error'](_0xa24c('0x21'),_0x1a247b[_0xa24c('0x19')],_0x294685);_0x31c4d9(_0x51dc3f[_0xa24c('0x16')](0x1f4,_0x1a247b['message']));});});}; \ No newline at end of file +var _0x5c12=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','FaxMessage,\x20%s,\x20%s','message','catch','CreateFaxMessage','FaxMessage','create','body','options','then','stringify','UpdateFaxMessage','raw','attributes','limit','util','moment','randomstring','ioredis'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x5c12,0x188));var _0x25c1=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x5c12[_0x1da527];return _0x40fc7c;};'use strict';var _=require('lodash');var util=require(_0x25c1('0x0'));var moment=require(_0x25c1('0x1'));var BPromise=require('bluebird');var rs=require(_0x25c1('0x2'));var fs=require('fs');var Redis=require(_0x25c1('0x3'));var db=require(_0x25c1('0x4'))['db'];var utils=require(_0x25c1('0x5'));var logger=require(_0x25c1('0x6'))(_0x25c1('0x7'));var config=require(_0x25c1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x25c1('0x9')][_0x25c1('0xa')]({'port':0x232a});config[_0x25c1('0xb')]=_['defaults'](config['redis'],{'host':_0x25c1('0xc'),'port':0x18eb});var socket=require(_0x25c1('0xd'))(new Redis(config[_0x25c1('0xb')]));require(_0x25c1('0xe'))[_0x25c1('0xf')](socket);function respondWithRpcPromise(_0x588f30,_0x3e062e,_0x41c89d){return new BPromise(function(_0x11a223,_0x81f0f4){return client[_0x25c1('0x10')](_0x588f30,_0x41c89d)['then'](function(_0x196e2f){logger[_0x25c1('0x11')]('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x25c1('0x12'));logger[_0x25c1('0x13')](_0x25c1('0x14'),_0x3e062e,_0x25c1('0x12'),JSON['stringify'](_0x196e2f));if(_0x196e2f['error']){if(_0x196e2f['error']['code']===0x1f4){logger[_0x25c1('0x15')](_0x25c1('0x16'),_0x3e062e,_0x196e2f[_0x25c1('0x15')][_0x25c1('0x17')]);return _0x81f0f4(_0x196e2f[_0x25c1('0x15')]['message']);}logger[_0x25c1('0x15')]('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x196e2f['error']['message']);return _0x11a223(_0x196e2f[_0x25c1('0x15')][_0x25c1('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x25c1('0x12'));_0x11a223(_0x196e2f['result'][_0x25c1('0x17')]);}})[_0x25c1('0x18')](function(_0x5c3c5d){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3e062e,_0x5c3c5d);_0x81f0f4(_0x5c3c5d);});});}exports[_0x25c1('0x19')]=function(_0x3d3149){var _0x22a36e=this;return new Promise(function(_0x1bf95d,_0x481c12){return db[_0x25c1('0x1a')][_0x25c1('0x1b')](_0x3d3149[_0x25c1('0x1c')],{'raw':_0x3d3149[_0x25c1('0x1d')]?_0x3d3149['options']['raw']===undefined?!![]:![]:!![]})[_0x25c1('0x1e')](function(_0xac3335){logger[_0x25c1('0x11')](_0x25c1('0x19'),_0x3d3149);logger[_0x25c1('0x13')](_0x25c1('0x19'),_0x3d3149,JSON[_0x25c1('0x1f')](_0xac3335));_0x1bf95d(_0xac3335);})[_0x25c1('0x18')](function(_0x14ffd9){logger[_0x25c1('0x15')](_0x25c1('0x19'),_0x14ffd9[_0x25c1('0x17')],_0x3d3149);_0x481c12(_0x22a36e[_0x25c1('0x15')](0x1f4,_0x14ffd9['message']));});});};exports[_0x25c1('0x20')]=function(_0x20dbb9){var _0x1b1c96=this;return new Promise(function(_0x1fb59f,_0x21fdb8){return db[_0x25c1('0x1a')]['update'](_0x20dbb9[_0x25c1('0x1c')],{'raw':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')][_0x25c1('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')]['where']||null:null,'attributes':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9['options'][_0x25c1('0x22')]||null:null,'limit':_0x20dbb9[_0x25c1('0x1d')]?_0x20dbb9[_0x25c1('0x1d')][_0x25c1('0x23')]||null:null})[_0x25c1('0x1e')](function(_0x21069c){logger[_0x25c1('0x11')](_0x25c1('0x20'),_0x20dbb9);logger[_0x25c1('0x13')]('UpdateFaxMessage',_0x20dbb9,JSON[_0x25c1('0x1f')](_0x21069c));_0x1fb59f(_0x21069c);})['catch'](function(_0x492715){logger[_0x25c1('0x15')](_0x25c1('0x20'),_0x492715['message'],_0x20dbb9);_0x21fdb8(_0x1b1c96[_0x25c1('0x15')](0x1f4,_0x492715['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 9fb1fa8..1c74998 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 _0xa5a8=['update','removeListener','length','faxMessage:','./faxMessage.events','save','remove'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa5a8,0x185));var _0x8a5a=function(_0x532f64,_0x1f2431){_0x532f64=_0x532f64-0x0;var _0x50370d=_0xa5a8[_0x532f64];return _0x50370d;};'use strict';var FaxMessageEvents=require(_0x8a5a('0x0'));var events=[_0x8a5a('0x1'),_0x8a5a('0x2'),_0x8a5a('0x3')];function createListener(_0x8dc88a,_0x2396fc){return function(_0x469719){_0x2396fc['emit'](_0x8dc88a,_0x469719);};}function removeListener(_0x3f64c8,_0x46c10e){return function(){FaxMessageEvents[_0x8a5a('0x4')](_0x3f64c8,_0x46c10e);};}exports['register']=function(_0x388218){for(var _0x1de323=0x0,_0x49a060=events[_0x8a5a('0x5')];_0x1de323<_0x49a060;_0x1de323++){var _0xc92d0e=events[_0x1de323];var _0x5e199d=createListener(_0x8a5a('0x6')+_0xc92d0e,_0x388218);FaxMessageEvents['on'](_0xc92d0e,_0x5e199d);}}; \ No newline at end of file +var _0xf84a=['./faxMessage.events','save','remove','update','register','length','faxMessage:'];(function(_0x12baa8,_0x43ce92){var _0x49e7b7=function(_0x53498f){while(--_0x53498f){_0x12baa8['push'](_0x12baa8['shift']());}};_0x49e7b7(++_0x43ce92);}(_0xf84a,0x1ab));var _0xaf84=function(_0x1b72e2,_0x35c61f){_0x1b72e2=_0x1b72e2-0x0;var _0x39f54d=_0xf84a[_0x1b72e2];return _0x39f54d;};'use strict';var FaxMessageEvents=require(_0xaf84('0x0'));var events=[_0xaf84('0x1'),_0xaf84('0x2'),_0xaf84('0x3')];function createListener(_0x50b069,_0x441986){return function(_0x567bc3){_0x441986['emit'](_0x50b069,_0x567bc3);};}function removeListener(_0x271e14,_0x42783e){return function(){FaxMessageEvents['removeListener'](_0x271e14,_0x42783e);};}exports[_0xaf84('0x4')]=function(_0x2687c6){for(var _0x5b1a34=0x0,_0x5bc9a8=events[_0xaf84('0x5')];_0x5b1a34<_0x5bc9a8;_0x5b1a34++){var _0x52699e=events[_0x5b1a34];var _0x7eedaf=createListener(_0xaf84('0x6')+_0x52699e,_0x2687c6);FaxMessageEvents['on'](_0x52699e,_0x7eedaf);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index c9c11b1..7454215 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 _0xc368=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','/describe','describe','/:id','download','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','delete','destroy','exports','util','connect-timeout'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xc368,0x7b));var _0x8c36=function(_0x559001,_0x342c16){_0x559001=_0x559001-0x0;var _0x38569c=_0xc368[_0x559001];return _0x38569c;};'use strict';var multer=require('multer');var util=require(_0x8c36('0x0'));var path=require('path');var timeout=require(_0x8c36('0x1'));var express=require(_0x8c36('0x2'));var router=express[_0x8c36('0x3')]();var fs_extra=require(_0x8c36('0x4'));var auth=require(_0x8c36('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8c36('0x6'));var controller=require(_0x8c36('0x7'));router[_0x8c36('0x8')]('/',auth[_0x8c36('0x9')](),controller['index']);router['get'](_0x8c36('0xa'),auth[_0x8c36('0x9')](),controller[_0x8c36('0xb')]);router[_0x8c36('0x8')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller['show']);router['get']('/:id/download',auth[_0x8c36('0x9')](),controller[_0x8c36('0xd')]);router['post']('/',auth[_0x8c36('0x9')](),interaction[_0x8c36('0xe')](_0x8c36('0xf'),_0x8c36('0x10')),controller[_0x8c36('0x11')]);router[_0x8c36('0x12')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x13')]);router[_0x8c36('0x12')](_0x8c36('0x14'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x15')]);router[_0x8c36('0x12')]('/:id/reject',auth[_0x8c36('0x9')](),controller['reject']);router[_0x8c36('0x16')](_0x8c36('0xc'),auth[_0x8c36('0x9')](),controller[_0x8c36('0x17')]);module[_0x8c36('0x18')]=router; \ No newline at end of file +var _0xd3d1=['put','update','accept','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','post','tracked','fax','faxmessage:create','create'];(function(_0x5186f0,_0x3e47a0){var _0xac8777=function(_0x3c853c){while(--_0x3c853c){_0x5186f0['push'](_0x5186f0['shift']());}};_0xac8777(++_0x3e47a0);}(_0xd3d1,0x172));var _0x1d3d=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd3d1[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1d3d('0x2'));var router=express[_0x1d3d('0x3')]();var fs_extra=require(_0x1d3d('0x4'));var auth=require(_0x1d3d('0x5'));var interaction=require(_0x1d3d('0x6'));var config=require(_0x1d3d('0x7'));var controller=require(_0x1d3d('0x8'));router[_0x1d3d('0x9')]('/',auth[_0x1d3d('0xa')](),controller[_0x1d3d('0xb')]);router[_0x1d3d('0x9')](_0x1d3d('0xc'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0xd')]);router[_0x1d3d('0x9')](_0x1d3d('0xe'),auth[_0x1d3d('0xa')](),controller['show']);router[_0x1d3d('0x9')](_0x1d3d('0xf'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x10')]);router[_0x1d3d('0x11')]('/',auth[_0x1d3d('0xa')](),interaction[_0x1d3d('0x12')](_0x1d3d('0x13'),_0x1d3d('0x14')),controller[_0x1d3d('0x15')]);router[_0x1d3d('0x16')]('/:id',auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x17')]);router['put']('/:id/accept',auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x18')]);router[_0x1d3d('0x16')]('/:id/reject',auth[_0x1d3d('0xa')](),controller['reject']);router[_0x1d3d('0x19')](_0x1d3d('0xe'),auth[_0x1d3d('0xa')](),controller[_0x1d3d('0x1a')]);module[_0x1d3d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 1864715..bde67cd 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 _0x4f98=['STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0xcd26a9,_0x512e77){var _0x3afcbc=function(_0x40e770){while(--_0x40e770){_0xcd26a9['push'](_0xcd26a9['shift']());}};_0x3afcbc(++_0x512e77);}(_0x4f98,0x196));var _0x84f9=function(_0x4ec520,_0x15fee2){_0x4ec520=_0x4ec520-0x0;var _0xed49d7=_0x4f98[_0x4ec520];return _0xed49d7;};'use strict';var Sequelize=require(_0x84f9('0x0'));module[_0x84f9('0x1')]={'name':{'type':Sequelize[_0x84f9('0x2')],'unique':_0x84f9('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x84f9('0x2')]},'timeout':{'type':Sequelize[_0x84f9('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x84f9('0x5')]('rrmemory',_0x84f9('0x6'),_0x84f9('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x84f9('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4a81=['rrmemory','beepall','roundrobin','INTEGER','sequelize','exports','STRING','name','ENUM'];(function(_0x5d949e,_0x555707){var _0x445c1e=function(_0x160f2a){while(--_0x160f2a){_0x5d949e['push'](_0x5d949e['shift']());}};_0x445c1e(++_0x555707);}(_0x4a81,0x1e1));var _0x14a8=function(_0x3d4500,_0x544b9e){_0x3d4500=_0x3d4500-0x0;var _0x55e264=_0x4a81[_0x3d4500];return _0x55e264;};'use strict';var Sequelize=require(_0x14a8('0x0'));module[_0x14a8('0x1')]={'name':{'type':Sequelize[_0x14a8('0x2')],'unique':_0x14a8('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x14a8('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x14a8('0x4')](_0x14a8('0x5'),_0x14a8('0x6'),_0x14a8('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x14a8('0x8')],'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 d3cdd37..7ead20a 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 _0xb216=['api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','type','merge','options','FaxQueue','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','FaxQueueId','User','findAndCountAll','UserId','agent','createdAt','SIP','getTeams','Team','pick','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','forEach','userFaxQueue:save','removeTeams','select','tq.TeamId','from','team_has_fax_queues','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','removeAgents','emit','omit','spread','userFaxQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger'];(function(_0x1b8465,_0x58d72a){var _0x40eb0a=function(_0x2cdc27){while(--_0x2cdc27){_0x1b8465['push'](_0x1b8465['shift']());}};_0x40eb0a(++_0x58d72a);}(_0xb216,0x182));var _0x6b21=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb216[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x6b21('0x0'));var rimraf=require(_0x6b21('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b21('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6b21('0x3'));var Mustache=require(_0x6b21('0x4'));var util=require(_0x6b21('0x5'));var path=require('path');var sox=require(_0x6b21('0x6'));var csv=require(_0x6b21('0x7'));var ejs=require(_0x6b21('0x8'));var fs=require('fs');var fs_extra=require(_0x6b21('0x9'));var _=require(_0x6b21('0xa'));var squel=require('squel');var crypto=require(_0x6b21('0xb'));var jsforce=require(_0x6b21('0xc'));var deskjs=require(_0x6b21('0xd'));var toCsv=require(_0x6b21('0x7'));var querystring=require(_0x6b21('0xe'));var Papa=require(_0x6b21('0xf'));var Redis=require('ioredis');var authService=require(_0x6b21('0x10'));var qs=require(_0x6b21('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b21('0x12'))(_0x6b21('0x13'));var utils=require(_0x6b21('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6b21('0x15'));var db=require(_0x6b21('0x16'))['db'];config[_0x6b21('0x17')]=_[_0x6b21('0x18')](config[_0x6b21('0x17')],{'host':_0x6b21('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b21('0x17')]));require(_0x6b21('0x1a'))['register'](socket);function respondWithStatusCode(_0x2bda5b,_0x26b1ca){_0x26b1ca=_0x26b1ca||0xcc;return function(_0x5ab54d){if(_0x5ab54d){return _0x2bda5b['sendStatus'](_0x26b1ca);}return _0x2bda5b[_0x6b21('0x1b')](_0x26b1ca)[_0x6b21('0x1c')]();};}function respondWithResult(_0x127c6c,_0x49dcc3){_0x49dcc3=_0x49dcc3||0xc8;return function(_0x49d4d7){if(_0x49d4d7){return _0x127c6c[_0x6b21('0x1b')](_0x49dcc3)[_0x6b21('0x1d')](_0x49d4d7);}};}function respondWithFilteredResult(_0x41448d,_0x4823fa){return function(_0x532166){if(_0x532166){var _0x1eb0db=typeof _0x4823fa['offset']===_0x6b21('0x1e')&&typeof _0x4823fa[_0x6b21('0x1f')]===_0x6b21('0x1e');var _0x2c8fe1=_0x532166[_0x6b21('0x20')];var _0x43a71e=_0x1eb0db?0x0:_0x4823fa[_0x6b21('0x21')];var _0x4eaf3f=_0x1eb0db?_0x532166[_0x6b21('0x20')]:_0x4823fa[_0x6b21('0x21')]+_0x4823fa[_0x6b21('0x1f')];var _0x1f0018;if(_0x4eaf3f>=_0x2c8fe1){_0x4eaf3f=_0x2c8fe1;_0x1f0018=0xc8;}else{_0x1f0018=0xce;}_0x41448d[_0x6b21('0x1b')](_0x1f0018);return _0x41448d['set'](_0x6b21('0x22'),_0x43a71e+'-'+_0x4eaf3f+'/'+_0x2c8fe1)['json'](_0x532166);}return null;};}function patchUpdates(_0x4cfdb3){return function(_0x1e6f5a){try{jsonpatch[_0x6b21('0x23')](_0x1e6f5a,_0x4cfdb3,!![]);}catch(_0x201ecd){return BPromise['reject'](_0x201ecd);}return _0x1e6f5a[_0x6b21('0x24')]();};}function saveUpdates(_0x569393,_0x5b3d3b){return function(_0x12abe6){if(_0x12abe6){return _0x12abe6[_0x6b21('0x25')](_0x569393)[_0x6b21('0x26')](function(_0x2de8bf){return _0x2de8bf;});}return null;};}function removeEntity(_0x4418ff,_0x1e9d89){return function(_0x2b1cd5){if(_0x2b1cd5){return _0x2b1cd5[_0x6b21('0x27')]()['then'](function(){var _0x5eb6db=_0x2b1cd5[_0x6b21('0x28')]({'plain':!![]});var _0x25cf95='FaxQueues';return db[_0x6b21('0x29')][_0x6b21('0x27')]({'where':{'type':_0x25cf95,'resourceId':_0x5eb6db['id']}})['then'](function(){return _0x2b1cd5;});})[_0x6b21('0x26')](function(){_0x4418ff['status'](0xcc)[_0x6b21('0x1c')]();});}};}function handleEntityNotFound(_0x25b8a9,_0x4a0879){return function(_0x4408ce){if(!_0x4408ce){_0x25b8a9[_0x6b21('0x2a')](0x194);}return _0x4408ce;};}function handleError(_0x6364cf,_0x167de7){_0x167de7=_0x167de7||0x1f4;return function(_0x23a86d){logger['error'](_0x23a86d[_0x6b21('0x2b')]);if(_0x23a86d['name']){delete _0x23a86d[_0x6b21('0x2c')];}_0x6364cf['status'](_0x167de7)[_0x6b21('0x2d')](_0x23a86d);};}exports[_0x6b21('0x2e')]=function(_0xf80b44,_0x5a06dd){var _0x91a464={},_0x94fea8={},_0x26439f={'count':0x0,'rows':[]};var _0x29eda4=_[_0x6b21('0x2f')](db['FaxQueue'][_0x6b21('0x30')],function(_0xfdcab1){return{'name':_0xfdcab1[_0x6b21('0x31')],'type':_0xfdcab1['type'][_0x6b21('0x32')]};});_0x94fea8[_0x6b21('0x33')]=_[_0x6b21('0x2f')](_0x29eda4,_0x6b21('0x2c'));_0x94fea8[_0x6b21('0x34')]=_[_0x6b21('0x35')](_0xf80b44[_0x6b21('0x34')]);_0x94fea8[_0x6b21('0x36')]=_[_0x6b21('0x37')](_0x94fea8[_0x6b21('0x33')],_0x94fea8[_0x6b21('0x34')]);_0x91a464[_0x6b21('0x38')]=_['intersection'](_0x94fea8[_0x6b21('0x33')],qs[_0x6b21('0x39')](_0xf80b44['query']['fields']));_0x91a464[_0x6b21('0x38')]=_0x91a464[_0x6b21('0x38')]['length']?_0x91a464[_0x6b21('0x38')]:_0x94fea8[_0x6b21('0x33')];if(!_0xf80b44[_0x6b21('0x34')]['hasOwnProperty'](_0x6b21('0x3a'))){_0x91a464[_0x6b21('0x1f')]=qs[_0x6b21('0x1f')](_0xf80b44[_0x6b21('0x34')][_0x6b21('0x1f')]);_0x91a464[_0x6b21('0x21')]=qs[_0x6b21('0x21')](_0xf80b44[_0x6b21('0x34')]['offset']);}_0x91a464[_0x6b21('0x3b')]=qs['sort'](_0xf80b44['query'][_0x6b21('0x3c')]);_0x91a464[_0x6b21('0x3d')]=qs[_0x6b21('0x36')](_['pick'](_0xf80b44[_0x6b21('0x34')],_0x94fea8['filters']),_0x29eda4);if(_0xf80b44[_0x6b21('0x34')][_0x6b21('0x3e')]){_0x91a464['where']=_['merge'](_0x91a464[_0x6b21('0x3d')],{'$or':_['map'](_0x29eda4,function(_0x3b2e9b){if(_0x3b2e9b[_0x6b21('0x3f')]!=='VIRTUAL'){var _0x1e4480={};_0x1e4480[_0x3b2e9b[_0x6b21('0x2c')]]={'$like':'%'+_0xf80b44[_0x6b21('0x34')][_0x6b21('0x3e')]+'%'};return _0x1e4480;}})});}_0x91a464=_[_0x6b21('0x40')]({},_0x91a464,_0xf80b44[_0x6b21('0x41')]);var _0x4b6014={'where':_0x91a464[_0x6b21('0x3d')]};return db[_0x6b21('0x42')]['count'](_0x4b6014)[_0x6b21('0x26')](function(_0xec93b8){_0x26439f[_0x6b21('0x20')]=_0xec93b8;if(_0xf80b44['query'][_0x6b21('0x43')]){_0x91a464[_0x6b21('0x44')]=[{'all':!![]}];}return db[_0x6b21('0x42')][_0x6b21('0x45')](_0x91a464);})[_0x6b21('0x26')](function(_0x412f4c){_0x26439f[_0x6b21('0x46')]=_0x412f4c;return _0x26439f;})[_0x6b21('0x26')](respondWithFilteredResult(_0x5a06dd,_0x91a464))[_0x6b21('0x47')](handleError(_0x5a06dd,null));};exports[_0x6b21('0x48')]=function(_0x27ce0b,_0x87c5da){var _0x4c8e70={'raw':!![],'where':{'id':_0x27ce0b[_0x6b21('0x49')]['id']}},_0x2e24c4={};_0x2e24c4[_0x6b21('0x33')]=_[_0x6b21('0x35')](db[_0x6b21('0x42')]['rawAttributes']);_0x2e24c4['query']=_[_0x6b21('0x35')](_0x27ce0b[_0x6b21('0x34')]);_0x2e24c4[_0x6b21('0x36')]=_['intersection'](_0x2e24c4['model'],_0x2e24c4[_0x6b21('0x34')]);_0x4c8e70['attributes']=_['intersection'](_0x2e24c4[_0x6b21('0x33')],qs[_0x6b21('0x39')](_0x27ce0b[_0x6b21('0x34')][_0x6b21('0x39')]));_0x4c8e70['attributes']=_0x4c8e70[_0x6b21('0x38')][_0x6b21('0x4a')]?_0x4c8e70[_0x6b21('0x38')]:_0x2e24c4['model'];if(_0x27ce0b[_0x6b21('0x34')][_0x6b21('0x43')]){_0x4c8e70[_0x6b21('0x44')]=[{'all':!![]}];}_0x4c8e70=_[_0x6b21('0x40')]({},_0x4c8e70,_0x27ce0b[_0x6b21('0x41')]);return db[_0x6b21('0x42')][_0x6b21('0x4b')](_0x4c8e70)[_0x6b21('0x26')](handleEntityNotFound(_0x87c5da,null))[_0x6b21('0x26')](respondWithResult(_0x87c5da,null))['catch'](handleError(_0x87c5da,null));};exports['create']=function(_0x221874,_0x643b6e){return db[_0x6b21('0x42')][_0x6b21('0x4c')](_0x221874[_0x6b21('0x4d')],{})[_0x6b21('0x26')](function(_0x1904f0){var _0x33b11e=_0x221874['user'][_0x6b21('0x28')]({'plain':!![]});if(!_0x33b11e)throw new Error(_0x6b21('0x4e'));if(_0x33b11e[_0x6b21('0x4f')]===_0x6b21('0x50')){var _0x1e7662=_0x1904f0['get']({'plain':!![]});var _0x23131a='FaxQueues';return db['UserProfileSection']['find']({'where':{'name':_0x23131a,'userProfileId':_0x33b11e[_0x6b21('0x51')]},'raw':!![]})[_0x6b21('0x26')](function(_0x22a1a9){if(_0x22a1a9&&_0x22a1a9[_0x6b21('0x52')]===0x0){return db['UserProfileResource'][_0x6b21('0x4c')]({'name':_0x1e7662[_0x6b21('0x2c')],'resourceId':_0x1e7662['id'],'type':_0x22a1a9[_0x6b21('0x2c')],'sectionId':_0x22a1a9['id']},{})[_0x6b21('0x26')](function(){return _0x1904f0;});}else{return _0x1904f0;}})[_0x6b21('0x47')](function(_0x558c32){logger[_0x6b21('0x53')](_0x6b21('0x54'),_0x558c32);throw _0x558c32;});}return _0x1904f0;})[_0x6b21('0x26')](respondWithResult(_0x643b6e,0xc9))['catch'](handleError(_0x643b6e,null));};exports['update']=function(_0x510cb0,_0xed88ca){if(_0x510cb0['body']['id']){delete _0x510cb0[_0x6b21('0x4d')]['id'];}return db[_0x6b21('0x42')]['find']({'where':{'id':_0x510cb0[_0x6b21('0x49')]['id']}})[_0x6b21('0x26')](handleEntityNotFound(_0xed88ca,null))[_0x6b21('0x26')](saveUpdates(_0x510cb0[_0x6b21('0x4d')],null))[_0x6b21('0x26')](respondWithResult(_0xed88ca,null))[_0x6b21('0x47')](handleError(_0xed88ca,null));};exports[_0x6b21('0x27')]=function(_0x133f27,_0x3ffd72){return db['FaxQueue']['find']({'where':{'id':_0x133f27[_0x6b21('0x49')]['id']}})[_0x6b21('0x26')](handleEntityNotFound(_0x3ffd72,null))['then'](removeEntity(_0x3ffd72,null))[_0x6b21('0x47')](handleError(_0x3ffd72,null));};exports[_0x6b21('0x55')]=function(_0xf206c6,_0x5d759d){return db[_0x6b21('0x42')]['describe']()[_0x6b21('0x26')](respondWithResult(_0x5d759d,null))[_0x6b21('0x47')](handleError(_0x5d759d,null));};exports[_0x6b21('0x56')]=function(_0xe70f03,_0x4e32d4,_0x1998b8){var _0x1dd30e={'raw':!![],'where':{}},_0x46e3fb={},_0x21c7ef;return db[_0x6b21('0x42')][_0x6b21('0x57')]({'where':{'id':_0xe70f03['params']['id']}})[_0x6b21('0x26')](handleEntityNotFound(_0x4e32d4,null))['then'](function(_0x1b5c2e){if(_0x1b5c2e){_0x21c7ef=_0x1b5c2e[_0x6b21('0x28')]({'plain':!![]});_0x46e3fb['model']=_[_0x6b21('0x35')](db[_0x6b21('0x58')]['rawAttributes']);_0x46e3fb[_0x6b21('0x34')]=_[_0x6b21('0x35')](_0xe70f03[_0x6b21('0x34')]);_0x46e3fb[_0x6b21('0x36')]=_[_0x6b21('0x37')](_0x46e3fb['model'],_0x46e3fb[_0x6b21('0x34')]);_0x1dd30e[_0x6b21('0x38')]=_[_0x6b21('0x37')](_0x46e3fb[_0x6b21('0x33')],qs[_0x6b21('0x39')](_0xe70f03[_0x6b21('0x34')][_0x6b21('0x39')]));_0x1dd30e[_0x6b21('0x38')]=_0x1dd30e[_0x6b21('0x38')][_0x6b21('0x4a')]?_0x1dd30e[_0x6b21('0x38')]:_0x46e3fb[_0x6b21('0x33')];if(!_0xe70f03[_0x6b21('0x34')][_0x6b21('0x59')](_0x6b21('0x3a'))){_0x1dd30e['limit']=qs[_0x6b21('0x1f')](_0xe70f03[_0x6b21('0x34')][_0x6b21('0x1f')]);_0x1dd30e[_0x6b21('0x21')]=qs['offset'](_0xe70f03[_0x6b21('0x34')][_0x6b21('0x21')]);}_0x1dd30e[_0x6b21('0x3b')]=qs['sort'](_0xe70f03[_0x6b21('0x34')]['sort']);_0x1dd30e['where']=qs['filters'](_['pick'](_0xe70f03[_0x6b21('0x34')],_0x46e3fb[_0x6b21('0x36')]));_0x1dd30e['where'][_0x6b21('0x5a')]=_0x1b5c2e['id'];if(_0xe70f03[_0x6b21('0x34')][_0x6b21('0x3e')]){_0x1dd30e['where']=_[_0x6b21('0x40')](_0x1dd30e[_0x6b21('0x3d')],{'$or':_[_0x6b21('0x2f')](_0x1dd30e['attributes'],function(_0x31000c){var _0x4faf34={};_0x4faf34[_0x31000c]={'$like':'%'+_0xe70f03['query']['filter']+'%'};return _0x4faf34;})});}_0x1dd30e=_[_0x6b21('0x40')]({},_0x1dd30e,_0xe70f03[_0x6b21('0x41')]);return db[_0x6b21('0x58')][_0x6b21('0x45')](_0x1dd30e);}})['then'](function(_0x13d0fb){if(_0x13d0fb){return db[_0x6b21('0x5b')][_0x6b21('0x5c')]({'where':{'id':_['map'](_0x13d0fb,_0x6b21('0x5d')),'role':_0x6b21('0x5e')},'attributes':['id',_0x6b21('0x2c'),'faxPause','updatedAt',_0x6b21('0x5f')]});}})[_0x6b21('0x26')](function(_0x189265){if(_0x189265){return{'count':_0x189265[_0x6b21('0x20')],'rows':_['map'](_0x189265[_0x6b21('0x46')],function(_0x33478f){return{'membername':_0x33478f[_0x6b21('0x2c')],'UserId':_0x33478f['id'],'queue_name':_0x21c7ef[_0x6b21('0x2c')],'FaxQueueId':_0x21c7ef['id'],'interface':util['format']('%s/%s',_0x6b21('0x60'),_0x33478f[_0x6b21('0x2c')]),'penalty':0x0,'paused':_0x33478f['faxPause'],'createdAt':_0x33478f[_0x6b21('0x5f')],'updatedAt':_0x33478f['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x6b21('0x26')](respondWithFilteredResult(_0x4e32d4,_0x1dd30e))[_0x6b21('0x47')](handleError(_0x4e32d4,null));};exports[_0x6b21('0x61')]=function(_0x4cfc0e,_0x3ca573,_0x57084e){var _0x27daed={};var _0x3b8bd6={};var _0x52909e;var _0x48a356;return db[_0x6b21('0x42')]['findOne']({'where':{'id':_0x4cfc0e[_0x6b21('0x49')]['id']}})[_0x6b21('0x26')](handleEntityNotFound(_0x3ca573,null))[_0x6b21('0x26')](function(_0xf7ac80){if(_0xf7ac80){_0x52909e=_0xf7ac80;_0x3b8bd6['model']=_[_0x6b21('0x35')](db[_0x6b21('0x62')][_0x6b21('0x30')]);_0x3b8bd6[_0x6b21('0x34')]=_[_0x6b21('0x35')](_0x4cfc0e[_0x6b21('0x34')]);_0x3b8bd6['filters']=_['intersection'](_0x3b8bd6[_0x6b21('0x33')],_0x3b8bd6[_0x6b21('0x34')]);_0x27daed[_0x6b21('0x38')]=_[_0x6b21('0x37')](_0x3b8bd6[_0x6b21('0x33')],qs[_0x6b21('0x39')](_0x4cfc0e['query'][_0x6b21('0x39')]));_0x27daed[_0x6b21('0x38')]=_0x27daed['attributes'][_0x6b21('0x4a')]?_0x27daed[_0x6b21('0x38')]:_0x3b8bd6['model'];_0x27daed[_0x6b21('0x3b')]=qs[_0x6b21('0x3c')](_0x4cfc0e[_0x6b21('0x34')][_0x6b21('0x3c')]);_0x27daed[_0x6b21('0x3d')]=qs[_0x6b21('0x36')](_[_0x6b21('0x63')](_0x4cfc0e[_0x6b21('0x34')],_0x3b8bd6[_0x6b21('0x36')]));if(_0x4cfc0e[_0x6b21('0x34')][_0x6b21('0x3e')]){_0x27daed['where']=_[_0x6b21('0x40')](_0x27daed[_0x6b21('0x3d')],{'$or':_['map'](_0x27daed[_0x6b21('0x38')],function(_0x558330){var _0x1f6f4e={};_0x1f6f4e[_0x558330]={'$like':'%'+_0x4cfc0e['query'][_0x6b21('0x3e')]+'%'};return _0x1f6f4e;})});}_0x27daed=_[_0x6b21('0x40')]({},_0x27daed,_0x4cfc0e['options']);return _0x52909e[_0x6b21('0x61')](_0x27daed);}})[_0x6b21('0x26')](function(_0x172ab9){if(_0x172ab9){_0x48a356=_0x172ab9[_0x6b21('0x4a')];if(!_0x4cfc0e['query'][_0x6b21('0x59')]('nolimit')){_0x27daed['limit']=qs[_0x6b21('0x1f')](_0x4cfc0e[_0x6b21('0x34')][_0x6b21('0x1f')]);_0x27daed[_0x6b21('0x21')]=qs[_0x6b21('0x21')](_0x4cfc0e['query']['offset']);}return _0x52909e[_0x6b21('0x61')](_0x27daed);}})[_0x6b21('0x26')](function(_0x369a04){if(_0x369a04){return _0x369a04?{'count':_0x48a356,'rows':_0x369a04}:null;}})[_0x6b21('0x26')](respondWithResult(_0x3ca573,null))[_0x6b21('0x47')](handleError(_0x3ca573,null));};exports[_0x6b21('0x64')]=function(_0x1cb6e8,_0x3d0ab4,_0x469fcf){var _0x3fcbc4=_0x1cb6e8[_0x6b21('0x4d')][_0x6b21('0x65')];return db[_0x6b21('0x62')][_0x6b21('0x45')]({'where':{'id':_0x3fcbc4},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6b21('0x66'),'attributes':['id',_0x6b21('0x2c'),_0x6b21('0x67'),_0x6b21('0x68'),'interface'],'raw':!![]}]})['then'](function(_0x2fa2cb){if(_0x2fa2cb){var _0x4c081e=_[_0x6b21('0x69')](_0x2fa2cb,function(_0x30d432){var _0x53318c=_0x30d432['get']({'plain':!![]});return _0x53318c[_0x6b21('0x66')];});return db['FaxQueue'][_0x6b21('0x4b')]({'where':{'id':_0x1cb6e8['params']['id']}})[_0x6b21('0x26')](function(_0x4a67fa){return db[_0x6b21('0x6a')][_0x6b21('0x6b')](function(_0x140484){return _0x4a67fa[_0x6b21('0x64')](_0x3fcbc4,{'transaction':_0x140484})['then'](function(){return BPromise[_0x6b21('0x6c')](_0x4c081e,function(_0x4d9e7e){return db[_0x6b21('0x58')]['findOrCreate']({'where':{'UserId':_0x4d9e7e['id'],'FaxQueueId':_0x1cb6e8[_0x6b21('0x49')]['id']},'transaction':_0x140484});});})[_0x6b21('0x26')](function(){_0x4c081e[_0x6b21('0x6d')](function(_0x3f0052){socket['emit'](_0x6b21('0x6e'),{'UserId':_0x3f0052['id'],'FaxQueueId':_0x4a67fa['id']});});});});});}})[_0x6b21('0x26')](respondWithStatusCode(_0x3d0ab4,null))[_0x6b21('0x47')](handleError(_0x3d0ab4,null));};exports[_0x6b21('0x6f')]=function(_0x591e7f,_0x2dce88,_0x479fa5){return db[_0x6b21('0x62')][_0x6b21('0x45')]({'where':{'id':_0x591e7f[_0x6b21('0x34')][_0x6b21('0x65')]},'attributes':['id'],'include':[{'model':db[_0x6b21('0x5b')],'as':_0x6b21('0x66'),'attributes':['id'],'raw':!![]}]})[_0x6b21('0x26')](handleEntityNotFound(_0x2dce88,null))['then'](function(_0x2184b0){var _0x25315f=_['map'](_0x2184b0,'id');var _0x45dbf0=[];var _0x474434=[];var _0x3735b8=squel[_0x6b21('0x70')]();_0x3735b8['field'](_0x6b21('0x71'))[_0x6b21('0x72')](_0x6b21('0x73'),'tq')['join']('user_has_teams','ut',_0x6b21('0x74'))['where'](_0x6b21('0x75'),_0x591e7f['params']['id']);for(var _0x4c5572=0x0;_0x4c5572<_0x2184b0[_0x6b21('0x4a')];_0x4c5572+=0x1){let _0x350155=_0x2184b0[_0x4c5572];for(var _0xb736de=0x0;_0xb736de<_0x350155[_0x6b21('0x66')][_0x6b21('0x4a')];_0xb736de+=0x1){let _0x1178fd=_0x350155[_0x6b21('0x66')][_0xb736de];var _0xb0d7fc=_0x3735b8[_0x6b21('0x76')]();_0xb0d7fc['where'](_0x6b21('0x77'),_0x1178fd['id']);_0x474434[_0x6b21('0x78')](db[_0x6b21('0x6a')][_0x6b21('0x34')](_0xb0d7fc['toString'](),{'type':db[_0x6b21('0x6a')][_0x6b21('0x79')][_0x6b21('0x7a')]})['then'](function(_0x3f8e6c){if(_0x3f8e6c[_0x6b21('0x4a')]===0x1){return _0x1178fd['id'];}else{var _0x4fd7eb=_['every'](_[_0x6b21('0x2f')](_0x3f8e6c,_0x6b21('0x7b')),function(_0x48f6aa){return _[_0x6b21('0x7c')](_0x25315f,_0x48f6aa);});if(_0x4fd7eb){return _0x1178fd['id'];}}}));}}return BPromise[_0x6b21('0x7d')](_0x474434)[_0x6b21('0x26')](function(_0x7826f8){_0x45dbf0=_(_0x45dbf0)[_0x6b21('0x7e')](_0x7826f8)[_0x6b21('0x7f')]()['value']();return db[_0x6b21('0x42')][_0x6b21('0x4b')]({'where':{'id':_0x591e7f[_0x6b21('0x49')]['id']}})[_0x6b21('0x26')](function(_0x1b2cd2){return db[_0x6b21('0x6a')][_0x6b21('0x6b')](function(_0x3170e1){return _0x1b2cd2[_0x6b21('0x6f')](_0x591e7f[_0x6b21('0x34')][_0x6b21('0x65')],{'transaction':_0x3170e1})[_0x6b21('0x26')](function(){if(!_[_0x6b21('0x80')](_0x45dbf0)){return _0x1b2cd2[_0x6b21('0x81')](_0x45dbf0,{'transaction':_0x3170e1});}})[_0x6b21('0x26')](function(){_0x45dbf0['forEach'](function(_0x34435b){socket[_0x6b21('0x82')]('userFaxQueue:remove',{'UserId':_0x34435b,'FaxQueueId':_0x1b2cd2['id']});});});});});});})[_0x6b21('0x26')](respondWithStatusCode(_0x2dce88,null))[_0x6b21('0x47')](handleError(_0x2dce88,null));};exports['addAgents']=function(_0x5dfef1,_0x4bca3a,_0x398a65){return db[_0x6b21('0x42')]['find']({'where':{'id':_0x5dfef1[_0x6b21('0x49')]['id']}})[_0x6b21('0x26')](handleEntityNotFound(_0x4bca3a,null))[_0x6b21('0x26')](function(_0x4da712){if(_0x4da712){return _0x4da712['addAgents'](_0x5dfef1['body'][_0x6b21('0x65')],_[_0x6b21('0x83')](_0x5dfef1[_0x6b21('0x4d')],[_0x6b21('0x65'),'id'])||{})[_0x6b21('0x84')](function(_0x1c9684){for(var _0x5bd507=0x0;_0x5bd507<_0x5dfef1[_0x6b21('0x4d')][_0x6b21('0x65')]['length'];_0x5bd507+=0x1){socket['emit'](_0x6b21('0x6e'),{'UserId':Number(_0x5dfef1[_0x6b21('0x4d')][_0x6b21('0x65')][_0x5bd507]),'FaxQueueId':Number(_0x5dfef1['params']['id'])});}return _0x1c9684;});}})['then'](respondWithResult(_0x4bca3a,null))[_0x6b21('0x47')](handleError(_0x4bca3a,null));};exports[_0x6b21('0x81')]=function(_0x698537,_0x1355fa,_0x4fb0b3){return db[_0x6b21('0x42')][_0x6b21('0x4b')]({'where':{'id':_0x698537[_0x6b21('0x49')]['id']}})[_0x6b21('0x26')](handleEntityNotFound(_0x1355fa,null))[_0x6b21('0x26')](function(_0x2e7f14){if(_0x2e7f14){return _0x2e7f14[_0x6b21('0x81')](_0x698537['query'][_0x6b21('0x65')])[_0x6b21('0x26')](function(){if(_['isArray'](_0x698537[_0x6b21('0x34')][_0x6b21('0x65')])){for(var _0x4c484c=0x0;_0x4c484c<_0x698537[_0x6b21('0x34')][_0x6b21('0x65')][_0x6b21('0x4a')];_0x4c484c+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x698537[_0x6b21('0x34')][_0x6b21('0x65')][_0x4c484c]),'FaxQueueId':Number(_0x698537[_0x6b21('0x49')]['id'])});}}else{socket[_0x6b21('0x82')](_0x6b21('0x85'),{'UserId':Number(_0x698537['query'][_0x6b21('0x65')]),'FaxQueueId':Number(_0x698537[_0x6b21('0x49')]['id'])});}});}})[_0x6b21('0x26')](respondWithStatusCode(_0x1355fa,null))[_0x6b21('0x47')](handleError(_0x1355fa,null));};exports[_0x6b21('0x86')]=function(_0x1300a3,_0x41172e,_0x8bf8b){var _0x384c87={};var _0x2e820e={};var _0xf24527;var _0x432420;return db[_0x6b21('0x42')][_0x6b21('0x57')]({'where':{'id':_0x1300a3[_0x6b21('0x49')]['id']}})[_0x6b21('0x26')](handleEntityNotFound(_0x41172e,null))[_0x6b21('0x26')](function(_0x5e8831){if(_0x5e8831){_0xf24527=_0x5e8831;_0x2e820e[_0x6b21('0x33')]=_['keys'](db[_0x6b21('0x5b')][_0x6b21('0x30')]);_0x2e820e[_0x6b21('0x34')]=_[_0x6b21('0x35')](_0x1300a3[_0x6b21('0x34')]);_0x2e820e[_0x6b21('0x36')]=_[_0x6b21('0x37')](_0x2e820e[_0x6b21('0x33')],_0x2e820e[_0x6b21('0x34')]);_0x384c87[_0x6b21('0x38')]=_[_0x6b21('0x37')](_0x2e820e[_0x6b21('0x33')],qs[_0x6b21('0x39')](_0x1300a3['query'][_0x6b21('0x39')]));_0x384c87['attributes']=_0x384c87[_0x6b21('0x38')][_0x6b21('0x4a')]?_0x384c87[_0x6b21('0x38')]:_0x2e820e[_0x6b21('0x33')];_0x384c87[_0x6b21('0x3b')]=qs[_0x6b21('0x3c')](_0x1300a3[_0x6b21('0x34')][_0x6b21('0x3c')]);_0x384c87['where']=qs['filters'](_[_0x6b21('0x63')](_0x1300a3['query'],_0x2e820e[_0x6b21('0x36')]));if(_0x1300a3[_0x6b21('0x34')][_0x6b21('0x3e')]){_0x384c87[_0x6b21('0x3d')]=_['merge'](_0x384c87[_0x6b21('0x3d')],{'$or':_['map'](_0x384c87[_0x6b21('0x38')],function(_0x151c6b){var _0x521aee={};_0x521aee[_0x151c6b]={'$like':'%'+_0x1300a3['query'][_0x6b21('0x3e')]+'%'};return _0x521aee;})});}_0x384c87=_[_0x6b21('0x40')]({},_0x384c87,_0x1300a3[_0x6b21('0x41')]);return _0xf24527[_0x6b21('0x86')](_0x384c87);}})[_0x6b21('0x26')](function(_0x3402af){if(_0x3402af){_0x432420=_0x3402af[_0x6b21('0x4a')];if(!_0x1300a3[_0x6b21('0x34')][_0x6b21('0x59')](_0x6b21('0x3a'))){_0x384c87['limit']=qs[_0x6b21('0x1f')](_0x1300a3['query'][_0x6b21('0x1f')]);_0x384c87[_0x6b21('0x21')]=qs['offset'](_0x1300a3['query']['offset']);}return _0xf24527[_0x6b21('0x86')](_0x384c87);}})[_0x6b21('0x26')](function(_0x4fffc3){if(_0x4fffc3){return _0x4fffc3?{'count':_0x432420,'rows':_0x4fffc3}:null;}})[_0x6b21('0x26')](respondWithResult(_0x41172e,null))[_0x6b21('0x47')](handleError(_0x41172e,null));}; \ No newline at end of file +var _0xd6c6=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','socket.io-emitter','redis','register','status','end','offset','undefined','count','limit','json','apply','reject','save','update','then','FaxQueues','destroy','sendStatus','error','stack','name','send','index','FaxQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','params','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserFaxQueue','hasOwnProperty','findAll','User','findAndCountAll','UserId','agent','faxPause','updatedAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','forEach','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1d4717,_0x35803a){var _0x5eb1fb=function(_0x5131ba){while(--_0x5131ba){_0x1d4717['push'](_0x1d4717['shift']());}};_0x5eb1fb(++_0x35803a);}(_0xd6c6,0x111));var _0x6d6c=function(_0x4d04fb,_0x55691a){_0x4d04fb=_0x4d04fb-0x0;var _0x114be6=_0xd6c6[_0x4d04fb];return _0x114be6;};'use strict';var emlformat=require(_0x6d6c('0x0'));var rimraf=require(_0x6d6c('0x1'));var zipdir=require(_0x6d6c('0x2'));var jsonpatch=require(_0x6d6c('0x3'));var rp=require(_0x6d6c('0x4'));var moment=require(_0x6d6c('0x5'));var BPromise=require(_0x6d6c('0x6'));var Mustache=require(_0x6d6c('0x7'));var util=require(_0x6d6c('0x8'));var path=require(_0x6d6c('0x9'));var sox=require('sox');var csv=require(_0x6d6c('0xa'));var ejs=require(_0x6d6c('0xb'));var fs=require('fs');var fs_extra=require(_0x6d6c('0xc'));var _=require(_0x6d6c('0xd'));var squel=require('squel');var crypto=require(_0x6d6c('0xe'));var jsforce=require(_0x6d6c('0xf'));var deskjs=require(_0x6d6c('0x10'));var toCsv=require(_0x6d6c('0xa'));var querystring=require(_0x6d6c('0x11'));var Papa=require(_0x6d6c('0x12'));var Redis=require(_0x6d6c('0x13'));var authService=require(_0x6d6c('0x14'));var qs=require(_0x6d6c('0x15'));var as=require(_0x6d6c('0x16'));var hardwareService=require(_0x6d6c('0x17'));var logger=require(_0x6d6c('0x18'))(_0x6d6c('0x19'));var utils=require(_0x6d6c('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6c('0x1b'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6d6c('0x1c'))(new Redis(config[_0x6d6c('0x1d')]));require('./faxQueue.socket')[_0x6d6c('0x1e')](socket);function respondWithStatusCode(_0x3ffa85,_0x3fae44){_0x3fae44=_0x3fae44||0xcc;return function(_0x31aeac){if(_0x31aeac){return _0x3ffa85['sendStatus'](_0x3fae44);}return _0x3ffa85[_0x6d6c('0x1f')](_0x3fae44)[_0x6d6c('0x20')]();};}function respondWithResult(_0x339309,_0x123317){_0x123317=_0x123317||0xc8;return function(_0x3bd78d){if(_0x3bd78d){return _0x339309['status'](_0x123317)['json'](_0x3bd78d);}};}function respondWithFilteredResult(_0x27eb61,_0x2fd0c0){return function(_0x39ab3b){if(_0x39ab3b){var _0x18bd30=typeof _0x2fd0c0[_0x6d6c('0x21')]==='undefined'&&typeof _0x2fd0c0['limit']===_0x6d6c('0x22');var _0x44d2b2=_0x39ab3b['count'];var _0x4e9a3b=_0x18bd30?0x0:_0x2fd0c0[_0x6d6c('0x21')];var _0x158975=_0x18bd30?_0x39ab3b[_0x6d6c('0x23')]:_0x2fd0c0[_0x6d6c('0x21')]+_0x2fd0c0[_0x6d6c('0x24')];var _0x52ddf4;if(_0x158975>=_0x44d2b2){_0x158975=_0x44d2b2;_0x52ddf4=0xc8;}else{_0x52ddf4=0xce;}_0x27eb61[_0x6d6c('0x1f')](_0x52ddf4);return _0x27eb61['set']('Content-Range',_0x4e9a3b+'-'+_0x158975+'/'+_0x44d2b2)[_0x6d6c('0x25')](_0x39ab3b);}return null;};}function patchUpdates(_0x4dd28a){return function(_0x2d5a95){try{jsonpatch[_0x6d6c('0x26')](_0x2d5a95,_0x4dd28a,!![]);}catch(_0x3ddc59){return BPromise[_0x6d6c('0x27')](_0x3ddc59);}return _0x2d5a95[_0x6d6c('0x28')]();};}function saveUpdates(_0x16d4b4,_0x152184){return function(_0x2dbb04){if(_0x2dbb04){return _0x2dbb04[_0x6d6c('0x29')](_0x16d4b4)['then'](function(_0x2a6569){return _0x2a6569;});}return null;};}function removeEntity(_0x58be34,_0x340e26){return function(_0x4ab722){if(_0x4ab722){return _0x4ab722['destroy']()[_0x6d6c('0x2a')](function(){var _0x1bd7d1=_0x4ab722['get']({'plain':!![]});var _0x1cd7b7=_0x6d6c('0x2b');return db['UserProfileResource'][_0x6d6c('0x2c')]({'where':{'type':_0x1cd7b7,'resourceId':_0x1bd7d1['id']}})[_0x6d6c('0x2a')](function(){return _0x4ab722;});})[_0x6d6c('0x2a')](function(){_0x58be34[_0x6d6c('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4427e4,_0x304002){return function(_0x46b249){if(!_0x46b249){_0x4427e4[_0x6d6c('0x2d')](0x194);}return _0x46b249;};}function handleError(_0x5c17c1,_0x4e473e){_0x4e473e=_0x4e473e||0x1f4;return function(_0x2bc27b){logger[_0x6d6c('0x2e')](_0x2bc27b[_0x6d6c('0x2f')]);if(_0x2bc27b['name']){delete _0x2bc27b[_0x6d6c('0x30')];}_0x5c17c1[_0x6d6c('0x1f')](_0x4e473e)[_0x6d6c('0x31')](_0x2bc27b);};}exports[_0x6d6c('0x32')]=function(_0x4fd0c6,_0x1fc4a5){var _0x1ea0d6={},_0x5896c6={},_0x22c7bc={'count':0x0,'rows':[]};var _0x661582=_['map'](db[_0x6d6c('0x33')][_0x6d6c('0x34')],function(_0x5c1f3b){return{'name':_0x5c1f3b[_0x6d6c('0x35')],'type':_0x5c1f3b[_0x6d6c('0x36')][_0x6d6c('0x37')]};});_0x5896c6[_0x6d6c('0x38')]=_[_0x6d6c('0x39')](_0x661582,_0x6d6c('0x30'));_0x5896c6[_0x6d6c('0x3a')]=_[_0x6d6c('0x3b')](_0x4fd0c6[_0x6d6c('0x3a')]);_0x5896c6[_0x6d6c('0x3c')]=_['intersection'](_0x5896c6[_0x6d6c('0x38')],_0x5896c6['query']);_0x1ea0d6['attributes']=_[_0x6d6c('0x3d')](_0x5896c6[_0x6d6c('0x38')],qs[_0x6d6c('0x3e')](_0x4fd0c6[_0x6d6c('0x3a')][_0x6d6c('0x3e')]));_0x1ea0d6[_0x6d6c('0x3f')]=_0x1ea0d6[_0x6d6c('0x3f')][_0x6d6c('0x40')]?_0x1ea0d6[_0x6d6c('0x3f')]:_0x5896c6[_0x6d6c('0x38')];if(!_0x4fd0c6[_0x6d6c('0x3a')]['hasOwnProperty'](_0x6d6c('0x41'))){_0x1ea0d6[_0x6d6c('0x24')]=qs[_0x6d6c('0x24')](_0x4fd0c6[_0x6d6c('0x3a')]['limit']);_0x1ea0d6[_0x6d6c('0x21')]=qs[_0x6d6c('0x21')](_0x4fd0c6['query']['offset']);}_0x1ea0d6[_0x6d6c('0x42')]=qs[_0x6d6c('0x43')](_0x4fd0c6['query'][_0x6d6c('0x43')]);_0x1ea0d6[_0x6d6c('0x44')]=qs[_0x6d6c('0x3c')](_[_0x6d6c('0x45')](_0x4fd0c6['query'],_0x5896c6[_0x6d6c('0x3c')]),_0x661582);if(_0x4fd0c6[_0x6d6c('0x3a')][_0x6d6c('0x46')]){_0x1ea0d6['where']=_[_0x6d6c('0x47')](_0x1ea0d6[_0x6d6c('0x44')],{'$or':_['map'](_0x661582,function(_0x39e9b1){if(_0x39e9b1[_0x6d6c('0x36')]!=='VIRTUAL'){var _0x18ea3b={};_0x18ea3b[_0x39e9b1['name']]={'$like':'%'+_0x4fd0c6[_0x6d6c('0x3a')][_0x6d6c('0x46')]+'%'};return _0x18ea3b;}})});}_0x1ea0d6=_[_0x6d6c('0x47')]({},_0x1ea0d6,_0x4fd0c6[_0x6d6c('0x48')]);var _0x6575b1={'where':_0x1ea0d6[_0x6d6c('0x44')]};return db[_0x6d6c('0x33')][_0x6d6c('0x23')](_0x6575b1)['then'](function(_0x180899){_0x22c7bc[_0x6d6c('0x23')]=_0x180899;if(_0x4fd0c6[_0x6d6c('0x3a')][_0x6d6c('0x49')]){_0x1ea0d6['include']=[{'all':!![]}];}return db[_0x6d6c('0x33')]['findAll'](_0x1ea0d6);})[_0x6d6c('0x2a')](function(_0x20ec2d){_0x22c7bc[_0x6d6c('0x4a')]=_0x20ec2d;return _0x22c7bc;})[_0x6d6c('0x2a')](respondWithFilteredResult(_0x1fc4a5,_0x1ea0d6))[_0x6d6c('0x4b')](handleError(_0x1fc4a5,null));};exports[_0x6d6c('0x4c')]=function(_0x1f0190,_0x47b651){var _0x3baca5={'raw':!![],'where':{'id':_0x1f0190[_0x6d6c('0x4d')]['id']}},_0x34c199={};_0x34c199[_0x6d6c('0x38')]=_[_0x6d6c('0x3b')](db[_0x6d6c('0x33')][_0x6d6c('0x34')]);_0x34c199[_0x6d6c('0x3a')]=_[_0x6d6c('0x3b')](_0x1f0190['query']);_0x34c199[_0x6d6c('0x3c')]=_['intersection'](_0x34c199['model'],_0x34c199[_0x6d6c('0x3a')]);_0x3baca5[_0x6d6c('0x3f')]=_[_0x6d6c('0x3d')](_0x34c199[_0x6d6c('0x38')],qs[_0x6d6c('0x3e')](_0x1f0190[_0x6d6c('0x3a')][_0x6d6c('0x3e')]));_0x3baca5['attributes']=_0x3baca5['attributes'][_0x6d6c('0x40')]?_0x3baca5[_0x6d6c('0x3f')]:_0x34c199['model'];if(_0x1f0190['query'][_0x6d6c('0x49')]){_0x3baca5[_0x6d6c('0x4e')]=[{'all':!![]}];}_0x3baca5=_[_0x6d6c('0x47')]({},_0x3baca5,_0x1f0190[_0x6d6c('0x48')]);return db[_0x6d6c('0x33')][_0x6d6c('0x4f')](_0x3baca5)[_0x6d6c('0x2a')](handleEntityNotFound(_0x47b651,null))[_0x6d6c('0x2a')](respondWithResult(_0x47b651,null))[_0x6d6c('0x4b')](handleError(_0x47b651,null));};exports[_0x6d6c('0x50')]=function(_0x12c796,_0x553ff4){return db[_0x6d6c('0x33')][_0x6d6c('0x50')](_0x12c796['body'],{})[_0x6d6c('0x2a')](function(_0xe679ee){var _0x264ade=_0x12c796[_0x6d6c('0x51')][_0x6d6c('0x52')]({'plain':!![]});if(!_0x264ade)throw new Error(_0x6d6c('0x53'));if(_0x264ade[_0x6d6c('0x54')]==='user'){var _0x3369ca=_0xe679ee[_0x6d6c('0x52')]({'plain':!![]});var _0xa523a=_0x6d6c('0x2b');return db[_0x6d6c('0x55')][_0x6d6c('0x4f')]({'where':{'name':_0xa523a,'userProfileId':_0x264ade[_0x6d6c('0x56')]},'raw':!![]})[_0x6d6c('0x2a')](function(_0x5d254f){if(_0x5d254f&&_0x5d254f[_0x6d6c('0x57')]===0x0){return db[_0x6d6c('0x58')][_0x6d6c('0x50')]({'name':_0x3369ca[_0x6d6c('0x30')],'resourceId':_0x3369ca['id'],'type':_0x5d254f['name'],'sectionId':_0x5d254f['id']},{})['then'](function(){return _0xe679ee;});}else{return _0xe679ee;}})[_0x6d6c('0x4b')](function(_0x4f3214){logger['error'](_0x6d6c('0x59'),_0x4f3214);throw _0x4f3214;});}return _0xe679ee;})['then'](respondWithResult(_0x553ff4,0xc9))[_0x6d6c('0x4b')](handleError(_0x553ff4,null));};exports[_0x6d6c('0x29')]=function(_0x177fef,_0x3b7435){if(_0x177fef[_0x6d6c('0x5a')]['id']){delete _0x177fef[_0x6d6c('0x5a')]['id'];}return db[_0x6d6c('0x33')]['find']({'where':{'id':_0x177fef[_0x6d6c('0x4d')]['id']}})[_0x6d6c('0x2a')](handleEntityNotFound(_0x3b7435,null))['then'](saveUpdates(_0x177fef[_0x6d6c('0x5a')],null))['then'](respondWithResult(_0x3b7435,null))[_0x6d6c('0x4b')](handleError(_0x3b7435,null));};exports[_0x6d6c('0x2c')]=function(_0x4ac8c1,_0x59ac95){return db[_0x6d6c('0x33')]['find']({'where':{'id':_0x4ac8c1[_0x6d6c('0x4d')]['id']}})[_0x6d6c('0x2a')](handleEntityNotFound(_0x59ac95,null))['then'](removeEntity(_0x59ac95,null))['catch'](handleError(_0x59ac95,null));};exports[_0x6d6c('0x5b')]=function(_0x3cf333,_0x5bf6d2){return db[_0x6d6c('0x33')][_0x6d6c('0x5b')]()[_0x6d6c('0x2a')](respondWithResult(_0x5bf6d2,null))[_0x6d6c('0x4b')](handleError(_0x5bf6d2,null));};exports['getMembers']=function(_0x56d410,_0x107242,_0xa19f74){var _0x242489={'raw':!![],'where':{}},_0x48ca40={},_0xc9f2b8;return db[_0x6d6c('0x33')][_0x6d6c('0x5c')]({'where':{'id':_0x56d410[_0x6d6c('0x4d')]['id']}})[_0x6d6c('0x2a')](handleEntityNotFound(_0x107242,null))[_0x6d6c('0x2a')](function(_0x1962c6){if(_0x1962c6){_0xc9f2b8=_0x1962c6[_0x6d6c('0x52')]({'plain':!![]});_0x48ca40[_0x6d6c('0x38')]=_[_0x6d6c('0x3b')](db[_0x6d6c('0x5d')][_0x6d6c('0x34')]);_0x48ca40[_0x6d6c('0x3a')]=_['keys'](_0x56d410[_0x6d6c('0x3a')]);_0x48ca40['filters']=_[_0x6d6c('0x3d')](_0x48ca40['model'],_0x48ca40[_0x6d6c('0x3a')]);_0x242489[_0x6d6c('0x3f')]=_[_0x6d6c('0x3d')](_0x48ca40[_0x6d6c('0x38')],qs['fields'](_0x56d410[_0x6d6c('0x3a')]['fields']));_0x242489['attributes']=_0x242489[_0x6d6c('0x3f')][_0x6d6c('0x40')]?_0x242489[_0x6d6c('0x3f')]:_0x48ca40[_0x6d6c('0x38')];if(!_0x56d410[_0x6d6c('0x3a')][_0x6d6c('0x5e')](_0x6d6c('0x41'))){_0x242489[_0x6d6c('0x24')]=qs[_0x6d6c('0x24')](_0x56d410[_0x6d6c('0x3a')]['limit']);_0x242489[_0x6d6c('0x21')]=qs['offset'](_0x56d410[_0x6d6c('0x3a')][_0x6d6c('0x21')]);}_0x242489[_0x6d6c('0x42')]=qs[_0x6d6c('0x43')](_0x56d410[_0x6d6c('0x3a')]['sort']);_0x242489[_0x6d6c('0x44')]=qs[_0x6d6c('0x3c')](_[_0x6d6c('0x45')](_0x56d410[_0x6d6c('0x3a')],_0x48ca40[_0x6d6c('0x3c')]));_0x242489[_0x6d6c('0x44')]['FaxQueueId']=_0x1962c6['id'];if(_0x56d410[_0x6d6c('0x3a')]['filter']){_0x242489[_0x6d6c('0x44')]=_[_0x6d6c('0x47')](_0x242489[_0x6d6c('0x44')],{'$or':_[_0x6d6c('0x39')](_0x242489[_0x6d6c('0x3f')],function(_0x3e4047){var _0x6e34b6={};_0x6e34b6[_0x3e4047]={'$like':'%'+_0x56d410['query'][_0x6d6c('0x46')]+'%'};return _0x6e34b6;})});}_0x242489=_[_0x6d6c('0x47')]({},_0x242489,_0x56d410[_0x6d6c('0x48')]);return db[_0x6d6c('0x5d')][_0x6d6c('0x5f')](_0x242489);}})['then'](function(_0x4f5e02){if(_0x4f5e02){return db[_0x6d6c('0x60')][_0x6d6c('0x61')]({'where':{'id':_[_0x6d6c('0x39')](_0x4f5e02,_0x6d6c('0x62')),'role':_0x6d6c('0x63')},'attributes':['id',_0x6d6c('0x30'),_0x6d6c('0x64'),_0x6d6c('0x65'),'createdAt']});}})[_0x6d6c('0x2a')](function(_0x30654e){if(_0x30654e){return{'count':_0x30654e[_0x6d6c('0x23')],'rows':_['map'](_0x30654e[_0x6d6c('0x4a')],function(_0xfec8c9){return{'membername':_0xfec8c9['name'],'UserId':_0xfec8c9['id'],'queue_name':_0xc9f2b8[_0x6d6c('0x30')],'FaxQueueId':_0xc9f2b8['id'],'interface':util[_0x6d6c('0x66')](_0x6d6c('0x67'),_0x6d6c('0x68'),_0xfec8c9[_0x6d6c('0x30')]),'penalty':0x0,'paused':_0xfec8c9[_0x6d6c('0x64')],'createdAt':_0xfec8c9['createdAt'],'updatedAt':_0xfec8c9[_0x6d6c('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6d6c('0x2a')](respondWithFilteredResult(_0x107242,_0x242489))[_0x6d6c('0x4b')](handleError(_0x107242,null));};exports[_0x6d6c('0x69')]=function(_0x554ea5,_0x22ed0c,_0x2274e1){var _0xe50b05={};var _0x1b4d47={};var _0x195e38;var _0x43e10b;return db[_0x6d6c('0x33')][_0x6d6c('0x5c')]({'where':{'id':_0x554ea5['params']['id']}})[_0x6d6c('0x2a')](handleEntityNotFound(_0x22ed0c,null))['then'](function(_0x9bd01a){if(_0x9bd01a){_0x195e38=_0x9bd01a;_0x1b4d47[_0x6d6c('0x38')]=_['keys'](db[_0x6d6c('0x6a')][_0x6d6c('0x34')]);_0x1b4d47[_0x6d6c('0x3a')]=_['keys'](_0x554ea5[_0x6d6c('0x3a')]);_0x1b4d47[_0x6d6c('0x3c')]=_[_0x6d6c('0x3d')](_0x1b4d47[_0x6d6c('0x38')],_0x1b4d47[_0x6d6c('0x3a')]);_0xe50b05[_0x6d6c('0x3f')]=_[_0x6d6c('0x3d')](_0x1b4d47[_0x6d6c('0x38')],qs[_0x6d6c('0x3e')](_0x554ea5[_0x6d6c('0x3a')]['fields']));_0xe50b05[_0x6d6c('0x3f')]=_0xe50b05[_0x6d6c('0x3f')][_0x6d6c('0x40')]?_0xe50b05[_0x6d6c('0x3f')]:_0x1b4d47[_0x6d6c('0x38')];_0xe50b05[_0x6d6c('0x42')]=qs['sort'](_0x554ea5['query'][_0x6d6c('0x43')]);_0xe50b05[_0x6d6c('0x44')]=qs[_0x6d6c('0x3c')](_[_0x6d6c('0x45')](_0x554ea5[_0x6d6c('0x3a')],_0x1b4d47['filters']));if(_0x554ea5['query'][_0x6d6c('0x46')]){_0xe50b05[_0x6d6c('0x44')]=_[_0x6d6c('0x47')](_0xe50b05[_0x6d6c('0x44')],{'$or':_[_0x6d6c('0x39')](_0xe50b05[_0x6d6c('0x3f')],function(_0x226e83){var _0x523efe={};_0x523efe[_0x226e83]={'$like':'%'+_0x554ea5[_0x6d6c('0x3a')]['filter']+'%'};return _0x523efe;})});}_0xe50b05=_[_0x6d6c('0x47')]({},_0xe50b05,_0x554ea5[_0x6d6c('0x48')]);return _0x195e38[_0x6d6c('0x69')](_0xe50b05);}})[_0x6d6c('0x2a')](function(_0x547e30){if(_0x547e30){_0x43e10b=_0x547e30[_0x6d6c('0x40')];if(!_0x554ea5['query'][_0x6d6c('0x5e')]('nolimit')){_0xe50b05['limit']=qs[_0x6d6c('0x24')](_0x554ea5[_0x6d6c('0x3a')][_0x6d6c('0x24')]);_0xe50b05[_0x6d6c('0x21')]=qs[_0x6d6c('0x21')](_0x554ea5['query'][_0x6d6c('0x21')]);}return _0x195e38['getTeams'](_0xe50b05);}})[_0x6d6c('0x2a')](function(_0x1d7c6b){if(_0x1d7c6b){return _0x1d7c6b?{'count':_0x43e10b,'rows':_0x1d7c6b}:null;}})[_0x6d6c('0x2a')](respondWithResult(_0x22ed0c,null))['catch'](handleError(_0x22ed0c,null));};exports[_0x6d6c('0x6b')]=function(_0x25be22,_0x1728cd,_0x114ad7){var _0x5a222a=_0x25be22[_0x6d6c('0x5a')][_0x6d6c('0x6c')];return db[_0x6d6c('0x6a')][_0x6d6c('0x5f')]({'where':{'id':_0x5a222a},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6d6c('0x6d'),'attributes':['id','name',_0x6d6c('0x6e'),'voicePause',_0x6d6c('0x6f')],'raw':!![]}]})[_0x6d6c('0x2a')](function(_0x3393cd){if(_0x3393cd){var _0x147ce3=_[_0x6d6c('0x70')](_0x3393cd,function(_0x228dbd){var _0x57fe71=_0x228dbd['get']({'plain':!![]});return _0x57fe71[_0x6d6c('0x6d')];});return db[_0x6d6c('0x33')][_0x6d6c('0x4f')]({'where':{'id':_0x25be22[_0x6d6c('0x4d')]['id']}})[_0x6d6c('0x2a')](function(_0x5db80c){return db[_0x6d6c('0x71')][_0x6d6c('0x72')](function(_0x4b02be){return _0x5db80c['addTeams'](_0x5a222a,{'transaction':_0x4b02be})[_0x6d6c('0x2a')](function(){return BPromise[_0x6d6c('0x73')](_0x147ce3,function(_0x409116){return db[_0x6d6c('0x5d')]['findOrCreate']({'where':{'UserId':_0x409116['id'],'FaxQueueId':_0x25be22[_0x6d6c('0x4d')]['id']},'transaction':_0x4b02be});});})[_0x6d6c('0x2a')](function(){_0x147ce3[_0x6d6c('0x74')](function(_0x604ae4){socket[_0x6d6c('0x75')](_0x6d6c('0x76'),{'UserId':_0x604ae4['id'],'FaxQueueId':_0x5db80c['id']});});});});});}})[_0x6d6c('0x2a')](respondWithStatusCode(_0x1728cd,null))[_0x6d6c('0x4b')](handleError(_0x1728cd,null));};exports[_0x6d6c('0x77')]=function(_0x1edc3b,_0x531fe8,_0x2e96ab){return db[_0x6d6c('0x6a')][_0x6d6c('0x5f')]({'where':{'id':_0x1edc3b[_0x6d6c('0x3a')][_0x6d6c('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6d6c('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x6d6c('0x2a')](handleEntityNotFound(_0x531fe8,null))[_0x6d6c('0x2a')](function(_0x187b53){var _0x1c538e=_[_0x6d6c('0x39')](_0x187b53,'id');var _0x521a0e=[];var _0x2ee637=[];var _0x109d09=squel[_0x6d6c('0x78')]();_0x109d09['field'](_0x6d6c('0x79'))[_0x6d6c('0x7a')](_0x6d6c('0x7b'),'tq')[_0x6d6c('0x7c')](_0x6d6c('0x7d'),'ut',_0x6d6c('0x7e'))[_0x6d6c('0x44')](_0x6d6c('0x7f'),_0x1edc3b['params']['id']);for(var _0x557a3a=0x0;_0x557a3a<_0x187b53['length'];_0x557a3a+=0x1){let _0x4a5d96=_0x187b53[_0x557a3a];for(var _0x5cfd86=0x0;_0x5cfd86<_0x4a5d96[_0x6d6c('0x6d')]['length'];_0x5cfd86+=0x1){let _0x3558b5=_0x4a5d96[_0x6d6c('0x6d')][_0x5cfd86];var _0x686a08=_0x109d09[_0x6d6c('0x80')]();_0x686a08[_0x6d6c('0x44')](_0x6d6c('0x81'),_0x3558b5['id']);_0x2ee637[_0x6d6c('0x82')](db[_0x6d6c('0x71')]['query'](_0x686a08['toString'](),{'type':db[_0x6d6c('0x71')][_0x6d6c('0x83')][_0x6d6c('0x84')]})['then'](function(_0x54ce4d){if(_0x54ce4d['length']===0x1){return _0x3558b5['id'];}else{var _0x3a333d=_[_0x6d6c('0x85')](_['map'](_0x54ce4d,_0x6d6c('0x86')),function(_0x546504){return _[_0x6d6c('0x87')](_0x1c538e,_0x546504);});if(_0x3a333d){return _0x3558b5['id'];}}}));}}return BPromise[_0x6d6c('0x88')](_0x2ee637)['then'](function(_0x5c11fe){_0x521a0e=_(_0x521a0e)[_0x6d6c('0x89')](_0x5c11fe)[_0x6d6c('0x8a')]()[_0x6d6c('0x8b')]();return db[_0x6d6c('0x33')][_0x6d6c('0x4f')]({'where':{'id':_0x1edc3b[_0x6d6c('0x4d')]['id']}})['then'](function(_0x208c26){return db[_0x6d6c('0x71')][_0x6d6c('0x72')](function(_0xba7f6c){return _0x208c26[_0x6d6c('0x77')](_0x1edc3b[_0x6d6c('0x3a')][_0x6d6c('0x6c')],{'transaction':_0xba7f6c})[_0x6d6c('0x2a')](function(){if(!_[_0x6d6c('0x8c')](_0x521a0e)){return _0x208c26['removeAgents'](_0x521a0e,{'transaction':_0xba7f6c});}})['then'](function(){_0x521a0e[_0x6d6c('0x74')](function(_0x3daac2){socket['emit'](_0x6d6c('0x8d'),{'UserId':_0x3daac2,'FaxQueueId':_0x208c26['id']});});});});});});})[_0x6d6c('0x2a')](respondWithStatusCode(_0x531fe8,null))[_0x6d6c('0x4b')](handleError(_0x531fe8,null));};exports[_0x6d6c('0x8e')]=function(_0xf4151b,_0x436158,_0x84532b){return db[_0x6d6c('0x33')][_0x6d6c('0x4f')]({'where':{'id':_0xf4151b[_0x6d6c('0x4d')]['id']}})[_0x6d6c('0x2a')](handleEntityNotFound(_0x436158,null))[_0x6d6c('0x2a')](function(_0x15cf2a){if(_0x15cf2a){return _0x15cf2a[_0x6d6c('0x8e')](_0xf4151b['body']['ids'],_[_0x6d6c('0x8f')](_0xf4151b[_0x6d6c('0x5a')],[_0x6d6c('0x6c'),'id'])||{})[_0x6d6c('0x90')](function(_0x12a13a){for(var _0x56aa3b=0x0;_0x56aa3b<_0xf4151b['body'][_0x6d6c('0x6c')][_0x6d6c('0x40')];_0x56aa3b+=0x1){socket[_0x6d6c('0x75')]('userFaxQueue:save',{'UserId':Number(_0xf4151b[_0x6d6c('0x5a')][_0x6d6c('0x6c')][_0x56aa3b]),'FaxQueueId':Number(_0xf4151b[_0x6d6c('0x4d')]['id'])});}return _0x12a13a;});}})[_0x6d6c('0x2a')](respondWithResult(_0x436158,null))[_0x6d6c('0x4b')](handleError(_0x436158,null));};exports['removeAgents']=function(_0x3eb0c0,_0x17979e,_0x43275d){return db[_0x6d6c('0x33')][_0x6d6c('0x4f')]({'where':{'id':_0x3eb0c0[_0x6d6c('0x4d')]['id']}})[_0x6d6c('0x2a')](handleEntityNotFound(_0x17979e,null))['then'](function(_0x16feee){if(_0x16feee){return _0x16feee['removeAgents'](_0x3eb0c0[_0x6d6c('0x3a')][_0x6d6c('0x6c')])[_0x6d6c('0x2a')](function(){if(_[_0x6d6c('0x91')](_0x3eb0c0[_0x6d6c('0x3a')]['ids'])){for(var _0x44a3c7=0x0;_0x44a3c7<_0x3eb0c0['query']['ids'][_0x6d6c('0x40')];_0x44a3c7+=0x1){socket['emit'](_0x6d6c('0x8d'),{'UserId':Number(_0x3eb0c0[_0x6d6c('0x3a')]['ids'][_0x44a3c7]),'FaxQueueId':Number(_0x3eb0c0[_0x6d6c('0x4d')]['id'])});}}else{socket['emit'](_0x6d6c('0x8d'),{'UserId':Number(_0x3eb0c0[_0x6d6c('0x3a')]['ids']),'FaxQueueId':Number(_0x3eb0c0[_0x6d6c('0x4d')]['id'])});}});}})[_0x6d6c('0x2a')](respondWithStatusCode(_0x17979e,null))['catch'](handleError(_0x17979e,null));};exports[_0x6d6c('0x92')]=function(_0x1e0cb3,_0x2ba3c8,_0x36c9e5){var _0x5adcc2={};var _0x19555e={};var _0x264fea;var _0x29e73c;return db[_0x6d6c('0x33')][_0x6d6c('0x5c')]({'where':{'id':_0x1e0cb3[_0x6d6c('0x4d')]['id']}})[_0x6d6c('0x2a')](handleEntityNotFound(_0x2ba3c8,null))[_0x6d6c('0x2a')](function(_0x252215){if(_0x252215){_0x264fea=_0x252215;_0x19555e[_0x6d6c('0x38')]=_[_0x6d6c('0x3b')](db['User'][_0x6d6c('0x34')]);_0x19555e[_0x6d6c('0x3a')]=_[_0x6d6c('0x3b')](_0x1e0cb3[_0x6d6c('0x3a')]);_0x19555e[_0x6d6c('0x3c')]=_[_0x6d6c('0x3d')](_0x19555e['model'],_0x19555e[_0x6d6c('0x3a')]);_0x5adcc2[_0x6d6c('0x3f')]=_[_0x6d6c('0x3d')](_0x19555e[_0x6d6c('0x38')],qs[_0x6d6c('0x3e')](_0x1e0cb3['query'][_0x6d6c('0x3e')]));_0x5adcc2[_0x6d6c('0x3f')]=_0x5adcc2['attributes']['length']?_0x5adcc2[_0x6d6c('0x3f')]:_0x19555e[_0x6d6c('0x38')];_0x5adcc2['order']=qs[_0x6d6c('0x43')](_0x1e0cb3[_0x6d6c('0x3a')][_0x6d6c('0x43')]);_0x5adcc2[_0x6d6c('0x44')]=qs['filters'](_[_0x6d6c('0x45')](_0x1e0cb3['query'],_0x19555e[_0x6d6c('0x3c')]));if(_0x1e0cb3['query'][_0x6d6c('0x46')]){_0x5adcc2[_0x6d6c('0x44')]=_[_0x6d6c('0x47')](_0x5adcc2[_0x6d6c('0x44')],{'$or':_[_0x6d6c('0x39')](_0x5adcc2[_0x6d6c('0x3f')],function(_0x7ea2c4){var _0x32f091={};_0x32f091[_0x7ea2c4]={'$like':'%'+_0x1e0cb3[_0x6d6c('0x3a')][_0x6d6c('0x46')]+'%'};return _0x32f091;})});}_0x5adcc2=_[_0x6d6c('0x47')]({},_0x5adcc2,_0x1e0cb3[_0x6d6c('0x48')]);return _0x264fea['getAgents'](_0x5adcc2);}})[_0x6d6c('0x2a')](function(_0xc596ee){if(_0xc596ee){_0x29e73c=_0xc596ee[_0x6d6c('0x40')];if(!_0x1e0cb3[_0x6d6c('0x3a')][_0x6d6c('0x5e')](_0x6d6c('0x41'))){_0x5adcc2['limit']=qs[_0x6d6c('0x24')](_0x1e0cb3['query'][_0x6d6c('0x24')]);_0x5adcc2[_0x6d6c('0x21')]=qs[_0x6d6c('0x21')](_0x1e0cb3[_0x6d6c('0x3a')][_0x6d6c('0x21')]);}return _0x264fea[_0x6d6c('0x92')](_0x5adcc2);}})['then'](function(_0x408002){if(_0x408002){return _0x408002?{'count':_0x29e73c,'rows':_0x408002}:null;}})[_0x6d6c('0x2a')](respondWithResult(_0x2ba3c8,null))['catch'](handleError(_0x2ba3c8,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 4ff3252..7100678 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 _0x9977=['hook','exports','events','update','remove','emit','hasOwnProperty'];(function(_0x69450e,_0x13dc15){var _0x3f3e77=function(_0x568a1e){while(--_0x568a1e){_0x69450e['push'](_0x69450e['shift']());}};_0x3f3e77(++_0x13dc15);}(_0x9977,0x12f));var _0x7997=function(_0x3c40f4,_0x500b8a){_0x3c40f4=_0x3c40f4-0x0;var _0x1209d=_0x9977[_0x3c40f4];return _0x1209d;};'use strict';var EventEmitter=require(_0x7997('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7997('0x1'),'afterDestroy':_0x7997('0x2')};function emitEvent(_0x4c22c9){return function(_0x2cb647,_0x9ab9ac,_0x4e0473){FaxQueueEvents[_0x7997('0x3')](_0x4c22c9+':'+_0x2cb647['id'],_0x2cb647);FaxQueueEvents['emit'](_0x4c22c9,_0x2cb647);_0x4e0473(null);};}for(var e in events){if(events[_0x7997('0x4')](e)){var event=events[e];FaxQueue[_0x7997('0x5')](e,emitEvent(event));}}module[_0x7997('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0xc156=['update','remove','emit','hasOwnProperty','hook','exports','FaxQueue','setMaxListeners','save'];(function(_0x15ad3f,_0x1d6280){var _0xfb1d10=function(_0x2730f7){while(--_0x2730f7){_0x15ad3f['push'](_0x15ad3f['shift']());}};_0xfb1d10(++_0x1d6280);}(_0xc156,0x7b));var _0x6c15=function(_0x1e8eda,_0x384f8d){_0x1e8eda=_0x1e8eda-0x0;var _0x2d256c=_0xc156[_0x1e8eda];return _0x2d256c;};'use strict';var EventEmitter=require('events');var FaxQueue=require('../../mysqldb')['db'][_0x6c15('0x0')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x6c15('0x1')](0x0);var events={'afterCreate':_0x6c15('0x2'),'afterUpdate':_0x6c15('0x3'),'afterDestroy':_0x6c15('0x4')};function emitEvent(_0x5549f9){return function(_0x421828,_0x5a2d6e,_0x1bf38e){FaxQueueEvents[_0x6c15('0x5')](_0x5549f9+':'+_0x421828['id'],_0x421828);FaxQueueEvents[_0x6c15('0x5')](_0x5549f9,_0x421828);_0x1bf38e(null);};}for(var e in events){if(events[_0x6c15('0x6')](e)){var event=events[e];FaxQueue[_0x6c15('0x7')](e,emitEvent(event));}}module[_0x6c15('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 50fab88..ed16df8 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 _0xab3e=['api','moment','bluebird','request-promise','rimraf','./faxQueue.attributes','exports','define','FaxQueue','lodash','util'];(function(_0x18763e,_0x19ac2c){var _0xc25e40=function(_0x5e66dc){while(--_0x5e66dc){_0x18763e['push'](_0x18763e['shift']());}};_0xc25e40(++_0x19ac2c);}(_0xab3e,0xa3));var _0xeab3=function(_0x55d472,_0x309412){_0x55d472=_0x55d472-0x0;var _0x14d1d0=_0xab3e[_0x55d472];return _0x14d1d0;};'use strict';var _=require(_0xeab3('0x0'));var util=require(_0xeab3('0x1'));var logger=require('../../config/logger')(_0xeab3('0x2'));var moment=require(_0xeab3('0x3'));var BPromise=require(_0xeab3('0x4'));var rp=require(_0xeab3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeab3('0x6'));var config=require('../../config/environment');var attributes=require(_0xeab3('0x7'));module[_0xeab3('0x8')]=function(_0x5d8669,_0x12514f){return _0x5d8669[_0xeab3('0x9')](_0xeab3('0xa'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaab9=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes','exports','define','lodash'];(function(_0x4ab723,_0x435404){var _0x743cbd=function(_0x3755f0){while(--_0x3755f0){_0x4ab723['push'](_0x4ab723['shift']());}};_0x743cbd(++_0x435404);}(_0xaab9,0x1a3));var _0x9aab=function(_0x3868d6,_0x2cfa99){_0x3868d6=_0x3868d6-0x0;var _0x4300ee=_0xaab9[_0x3868d6];return _0x4300ee;};'use strict';var _=require(_0x9aab('0x0'));var util=require(_0x9aab('0x1'));var logger=require(_0x9aab('0x2'))(_0x9aab('0x3'));var moment=require(_0x9aab('0x4'));var BPromise=require(_0x9aab('0x5'));var rp=require(_0x9aab('0x6'));var fs=require('fs');var path=require(_0x9aab('0x7'));var rimraf=require(_0x9aab('0x8'));var config=require('../../config/environment');var attributes=require(_0x9aab('0x9'));module[_0x9aab('0xa')]=function(_0x49f4a2,_0x265137){return _0x49f4a2[_0x9aab('0xb')]('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index c2aa57c..27cbc92 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 _0x5ec7=['stringify','error','code','message','request\x20sent','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','limit','include','model','debug','ShowFaxQueue','find','raw','map','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','request','then','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s'];(function(_0x169552,_0x2701a7){var _0x573672=function(_0x286859){while(--_0x286859){_0x169552['push'](_0x169552['shift']());}};_0x573672(++_0x2701a7);}(_0x5ec7,0xde));var _0x75ec=function(_0x51786e,_0x5ee24e){_0x51786e=_0x51786e-0x0;var _0x25b5e2=_0x5ec7[_0x51786e];return _0x25b5e2;};'use strict';var _=require(_0x75ec('0x0'));var util=require(_0x75ec('0x1'));var moment=require(_0x75ec('0x2'));var BPromise=require(_0x75ec('0x3'));var rs=require(_0x75ec('0x4'));var fs=require('fs');var Redis=require(_0x75ec('0x5'));var db=require(_0x75ec('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x75ec('0x7'));var config=require(_0x75ec('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x75ec('0x9')][_0x75ec('0xa')]({'port':0x232a});config[_0x75ec('0xb')]=_[_0x75ec('0xc')](config[_0x75ec('0xb')],{'host':_0x75ec('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x75ec('0xb')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x36c33b,_0x3072a1,_0x299ab4){return new BPromise(function(_0x4ae736,_0x3bc69c){return client[_0x75ec('0xe')](_0x36c33b,_0x299ab4)[_0x75ec('0xf')](function(_0x5b74ec){logger['info'](_0x75ec('0x10'),_0x3072a1,'request\x20sent');logger['debug'](_0x75ec('0x11'),_0x3072a1,'request\x20sent',JSON[_0x75ec('0x12')](_0x5b74ec));if(_0x5b74ec[_0x75ec('0x13')]){if(_0x5b74ec[_0x75ec('0x13')][_0x75ec('0x14')]===0x1f4){logger[_0x75ec('0x13')]('FaxQueue,\x20%s,\x20%s',_0x3072a1,_0x5b74ec[_0x75ec('0x13')][_0x75ec('0x15')]);return _0x3bc69c(_0x5b74ec[_0x75ec('0x13')]['message']);}logger[_0x75ec('0x13')](_0x75ec('0x10'),_0x3072a1,_0x5b74ec[_0x75ec('0x13')][_0x75ec('0x15')]);return _0x4ae736(_0x5b74ec['error']['message']);}else{logger['info'](_0x75ec('0x10'),_0x3072a1,_0x75ec('0x16'));_0x4ae736(_0x5b74ec[_0x75ec('0x17')][_0x75ec('0x15')]);}})[_0x75ec('0x18')](function(_0x1108b9){logger[_0x75ec('0x13')](_0x75ec('0x10'),_0x3072a1,_0x1108b9);_0x3bc69c(_0x1108b9);});});}exports[_0x75ec('0x19')]=function(_0x10d5c5){var _0x546cd6=this;return new Promise(function(_0x5765c8,_0x28075c){return db[_0x75ec('0x1a')][_0x75ec('0x1b')]({'raw':_0x10d5c5[_0x75ec('0x1c')]?_0x10d5c5['options']['raw']===undefined?!![]:![]:!![],'where':_0x10d5c5[_0x75ec('0x1c')]?_0x10d5c5[_0x75ec('0x1c')][_0x75ec('0x1d')]||null:null,'attributes':_0x10d5c5['options']?_0x10d5c5[_0x75ec('0x1c')][_0x75ec('0x1e')]||null:null,'limit':_0x10d5c5[_0x75ec('0x1c')]?_0x10d5c5[_0x75ec('0x1c')][_0x75ec('0x1f')]||null:null,'include':_0x10d5c5[_0x75ec('0x1c')]?_0x10d5c5[_0x75ec('0x1c')][_0x75ec('0x20')]?_['map'](_0x10d5c5[_0x75ec('0x1c')][_0x75ec('0x20')],function(_0x23e805){return{'model':db[_0x23e805[_0x75ec('0x21')]],'as':_0x23e805['as'],'attributes':_0x23e805[_0x75ec('0x1e')],'include':_0x23e805['include']?_['map'](_0x23e805[_0x75ec('0x20')],function(_0x4c96c7){return{'model':db[_0x4c96c7['model']],'as':_0x4c96c7['as'],'attributes':_0x4c96c7[_0x75ec('0x1e')],'include':_0x4c96c7['include']?_['map'](_0x4c96c7[_0x75ec('0x20')],function(_0xfdc96f){return{'model':db[_0xfdc96f[_0x75ec('0x21')]],'as':_0xfdc96f['as'],'attributes':_0xfdc96f[_0x75ec('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x75ec('0xf')](function(_0x2a3997){logger['info'](_0x75ec('0x19'),_0x10d5c5);logger[_0x75ec('0x22')](_0x75ec('0x19'),_0x10d5c5,JSON[_0x75ec('0x12')](_0x2a3997));_0x5765c8(_0x2a3997);})[_0x75ec('0x18')](function(_0x458ffe){logger[_0x75ec('0x13')]('GetFaxQueue',_0x458ffe['message'],_0x10d5c5);_0x28075c(_0x546cd6[_0x75ec('0x13')](0x1f4,_0x458ffe['message']));});});};exports[_0x75ec('0x23')]=function(_0x587db2){var _0x19b8e0=this;return new Promise(function(_0x4f2780,_0x445cf6){return db[_0x75ec('0x1a')][_0x75ec('0x24')]({'raw':_0x587db2['options']?_0x587db2[_0x75ec('0x1c')][_0x75ec('0x25')]===undefined?!![]:![]:!![],'where':_0x587db2[_0x75ec('0x1c')]?_0x587db2['options']['where']||null:null,'attributes':_0x587db2[_0x75ec('0x1c')]?_0x587db2['options'][_0x75ec('0x1e')]||null:null,'include':_0x587db2['options']?_0x587db2[_0x75ec('0x1c')][_0x75ec('0x20')]?_[_0x75ec('0x26')](_0x587db2[_0x75ec('0x1c')]['include'],function(_0xbbf8e1){return{'model':db[_0xbbf8e1[_0x75ec('0x21')]],'as':_0xbbf8e1['as'],'attributes':_0xbbf8e1[_0x75ec('0x1e')],'include':_0xbbf8e1['include']?_['map'](_0xbbf8e1[_0x75ec('0x20')],function(_0x4497f8){return{'model':db[_0x4497f8[_0x75ec('0x21')]],'as':_0x4497f8['as'],'attributes':_0x4497f8[_0x75ec('0x1e')],'include':_0x4497f8['include']?_[_0x75ec('0x26')](_0x4497f8[_0x75ec('0x20')],function(_0x3192e2){return{'model':db[_0x3192e2[_0x75ec('0x21')]],'as':_0x3192e2['as'],'attributes':_0x3192e2[_0x75ec('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x75ec('0xf')](function(_0x1595d6){logger[_0x75ec('0x27')]('ShowFaxQueue',_0x587db2);logger['debug']('ShowFaxQueue',_0x587db2,JSON[_0x75ec('0x12')](_0x1595d6));_0x4f2780(_0x1595d6);})[_0x75ec('0x18')](function(_0x571a8f){logger[_0x75ec('0x13')](_0x75ec('0x23'),_0x571a8f[_0x75ec('0x15')],_0x587db2);_0x445cf6(_0x19b8e0['error'](0x1f4,_0x571a8f[_0x75ec('0x15')]));});});}; \ No newline at end of file +var _0xa2fb=['./faxQueue.socket','register','request','then','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','info','result','catch','GetFaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','FaxQueue','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x32358b,_0x5c7c35){var _0x58c21d=function(_0x238a63){while(--_0x238a63){_0x32358b['push'](_0x32358b['shift']());}};_0x58c21d(++_0x5c7c35);}(_0xa2fb,0x183));var _0xba2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa2fb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xba2f('0x0'));var util=require(_0xba2f('0x1'));var moment=require(_0xba2f('0x2'));var BPromise=require(_0xba2f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba2f('0x4'))['db'];var utils=require(_0xba2f('0x5'));var logger=require(_0xba2f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xba2f('0x7'));var client=jayson[_0xba2f('0x8')]['http']({'port':0x232a});config[_0xba2f('0x9')]=_[_0xba2f('0xa')](config['redis'],{'host':_0xba2f('0xb'),'port':0x18eb});var socket=require(_0xba2f('0xc'))(new Redis(config[_0xba2f('0x9')]));require(_0xba2f('0xd'))[_0xba2f('0xe')](socket);function respondWithRpcPromise(_0x58a37e,_0x3ae53b,_0x588b97){return new BPromise(function(_0x8a7d1a,_0x1fb71e){return client[_0xba2f('0xf')](_0x58a37e,_0x588b97)[_0xba2f('0x10')](function(_0x4caa81){logger['info']('FaxQueue,\x20%s,\x20%s',_0x3ae53b,_0xba2f('0x11'));logger[_0xba2f('0x12')](_0xba2f('0x13'),_0x3ae53b,_0xba2f('0x11'),JSON[_0xba2f('0x14')](_0x4caa81));if(_0x4caa81[_0xba2f('0x15')]){if(_0x4caa81[_0xba2f('0x15')][_0xba2f('0x16')]===0x1f4){logger[_0xba2f('0x15')](_0xba2f('0x17'),_0x3ae53b,_0x4caa81[_0xba2f('0x15')][_0xba2f('0x18')]);return _0x1fb71e(_0x4caa81[_0xba2f('0x15')][_0xba2f('0x18')]);}logger['error'](_0xba2f('0x17'),_0x3ae53b,_0x4caa81[_0xba2f('0x15')][_0xba2f('0x18')]);return _0x8a7d1a(_0x4caa81[_0xba2f('0x15')][_0xba2f('0x18')]);}else{logger[_0xba2f('0x19')](_0xba2f('0x17'),_0x3ae53b,_0xba2f('0x11'));_0x8a7d1a(_0x4caa81[_0xba2f('0x1a')][_0xba2f('0x18')]);}})[_0xba2f('0x1b')](function(_0x28718d){logger[_0xba2f('0x15')](_0xba2f('0x17'),_0x3ae53b,_0x28718d);_0x1fb71e(_0x28718d);});});}exports[_0xba2f('0x1c')]=function(_0x5ed1a9){var _0x4f7145=this;return new Promise(function(_0x472679,_0xd702bc){return db['FaxQueue'][_0xba2f('0x1d')]({'raw':_0x5ed1a9[_0xba2f('0x1e')]?_0x5ed1a9[_0xba2f('0x1e')][_0xba2f('0x1f')]===undefined?!![]:![]:!![],'where':_0x5ed1a9['options']?_0x5ed1a9[_0xba2f('0x1e')][_0xba2f('0x20')]||null:null,'attributes':_0x5ed1a9['options']?_0x5ed1a9[_0xba2f('0x1e')][_0xba2f('0x21')]||null:null,'limit':_0x5ed1a9['options']?_0x5ed1a9['options'][_0xba2f('0x22')]||null:null,'include':_0x5ed1a9[_0xba2f('0x1e')]?_0x5ed1a9['options'][_0xba2f('0x23')]?_[_0xba2f('0x24')](_0x5ed1a9['options'][_0xba2f('0x23')],function(_0x6137ac){return{'model':db[_0x6137ac[_0xba2f('0x25')]],'as':_0x6137ac['as'],'attributes':_0x6137ac[_0xba2f('0x21')],'include':_0x6137ac[_0xba2f('0x23')]?_[_0xba2f('0x24')](_0x6137ac[_0xba2f('0x23')],function(_0x199393){return{'model':db[_0x199393[_0xba2f('0x25')]],'as':_0x199393['as'],'attributes':_0x199393[_0xba2f('0x21')],'include':_0x199393[_0xba2f('0x23')]?_[_0xba2f('0x24')](_0x199393['include'],function(_0x1d81f2){return{'model':db[_0x1d81f2[_0xba2f('0x25')]],'as':_0x1d81f2['as'],'attributes':_0x1d81f2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xe8b1d7){logger[_0xba2f('0x19')]('GetFaxQueue',_0x5ed1a9);logger[_0xba2f('0x12')](_0xba2f('0x1c'),_0x5ed1a9,JSON[_0xba2f('0x14')](_0xe8b1d7));_0x472679(_0xe8b1d7);})[_0xba2f('0x1b')](function(_0x3af027){logger[_0xba2f('0x15')](_0xba2f('0x1c'),_0x3af027[_0xba2f('0x18')],_0x5ed1a9);_0xd702bc(_0x4f7145[_0xba2f('0x15')](0x1f4,_0x3af027[_0xba2f('0x18')]));});});};exports[_0xba2f('0x26')]=function(_0x5c036f){var _0xd8df82=this;return new Promise(function(_0xf36010,_0x5be5c3){return db[_0xba2f('0x27')]['find']({'raw':_0x5c036f[_0xba2f('0x1e')]?_0x5c036f[_0xba2f('0x1e')][_0xba2f('0x1f')]===undefined?!![]:![]:!![],'where':_0x5c036f[_0xba2f('0x1e')]?_0x5c036f[_0xba2f('0x1e')][_0xba2f('0x20')]||null:null,'attributes':_0x5c036f['options']?_0x5c036f[_0xba2f('0x1e')][_0xba2f('0x21')]||null:null,'include':_0x5c036f['options']?_0x5c036f[_0xba2f('0x1e')][_0xba2f('0x23')]?_[_0xba2f('0x24')](_0x5c036f['options']['include'],function(_0x5ed9e8){return{'model':db[_0x5ed9e8[_0xba2f('0x25')]],'as':_0x5ed9e8['as'],'attributes':_0x5ed9e8[_0xba2f('0x21')],'include':_0x5ed9e8[_0xba2f('0x23')]?_[_0xba2f('0x24')](_0x5ed9e8['include'],function(_0x31fc46){return{'model':db[_0x31fc46[_0xba2f('0x25')]],'as':_0x31fc46['as'],'attributes':_0x31fc46[_0xba2f('0x21')],'include':_0x31fc46[_0xba2f('0x23')]?_[_0xba2f('0x24')](_0x31fc46['include'],function(_0x4fb895){return{'model':db[_0x4fb895[_0xba2f('0x25')]],'as':_0x4fb895['as'],'attributes':_0x4fb895['attributes']};}):[]};}):[]};}):[]:[]})[_0xba2f('0x10')](function(_0x44c144){logger['info'](_0xba2f('0x26'),_0x5c036f);logger[_0xba2f('0x12')]('ShowFaxQueue',_0x5c036f,JSON[_0xba2f('0x14')](_0x44c144));_0xf36010(_0x44c144);})[_0xba2f('0x1b')](function(_0x3be9b1){logger['error']('ShowFaxQueue',_0x3be9b1[_0xba2f('0x18')],_0x5c036f);_0x5be5c3(_0xd8df82['error'](0x1f4,_0x3be9b1[_0xba2f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index cd0f5af..6a887b2 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 _0x8adb=['./faxQueue.events','save','update'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x8adb,0x105));var _0xb8ad=function(_0x3a7906,_0x6fad2b){_0x3a7906=_0x3a7906-0x0;var _0x42fd59=_0x8adb[_0x3a7906];return _0x42fd59;};'use strict';var FaxQueueEvents=require(_0xb8ad('0x0'));var events=[_0xb8ad('0x1'),'remove',_0xb8ad('0x2')];function createListener(_0x2b6793,_0x605323){return function(_0x6fc409){_0x605323['emit'](_0x2b6793,_0x6fc409);};}function removeListener(_0x1e8101,_0x661777){return function(){FaxQueueEvents['removeListener'](_0x1e8101,_0x661777);};}exports['register']=function(_0x417b54){for(var _0x55c767=0x0,_0x3e4541=events['length'];_0x55c767<_0x3e4541;_0x55c767++){var _0x53a961=events[_0x55c767];var _0x14dd77=createListener('faxQueue:'+_0x53a961,_0x417b54);FaxQueueEvents['on'](_0x53a961,_0x14dd77);}}; \ No newline at end of file +var _0x1fe7=['update','emit','removeListener','register','./faxQueue.events','save','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1fe7,0xe4));var _0x71fe=function(_0x1d42aa,_0x7eb641){_0x1d42aa=_0x1d42aa-0x0;var _0x49361a=_0x1fe7[_0x1d42aa];return _0x49361a;};'use strict';var FaxQueueEvents=require(_0x71fe('0x0'));var events=[_0x71fe('0x1'),_0x71fe('0x2'),_0x71fe('0x3')];function createListener(_0x20bcea,_0x11a231){return function(_0x8301f8){_0x11a231[_0x71fe('0x4')](_0x20bcea,_0x8301f8);};}function removeListener(_0x42a3ac,_0x40bd2f){return function(){FaxQueueEvents[_0x71fe('0x5')](_0x42a3ac,_0x40bd2f);};}exports[_0x71fe('0x6')]=function(_0x32ffde){for(var _0x525886=0x0,_0x504d06=events['length'];_0x525886<_0x504d06;_0x525886++){var _0x5cb5a6=events[_0x525886];var _0x14d036=createListener('faxQueue:'+_0x5cb5a6,_0x32ffde);FaxQueueEvents['on'](_0x5cb5a6,_0x14d036);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index ac5c2c5..579dfa0 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 _0x7880=['delete','destroy','removeTeams','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update'];(function(_0x2bcb4b,_0xafe8f3){var _0xf207da=function(_0x577e8f){while(--_0x577e8f){_0x2bcb4b['push'](_0x2bcb4b['shift']());}};_0xf207da(++_0xafe8f3);}(_0x7880,0x1f4));var _0x0788=function(_0x5e5671,_0x457d56){_0x5e5671=_0x5e5671-0x0;var _0x3035f8=_0x7880[_0x5e5671];return _0x3035f8;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router[_0x0788('0x9')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0xd')]);router['get'](_0x0788('0xe'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router['get'](_0x0788('0x10'),auth[_0x0788('0xa')](),controller[_0x0788('0x11')]);router[_0x0788('0x9')](_0x0788('0x12'),auth['isAuthenticated'](),controller[_0x0788('0x13')]);router[_0x0788('0x9')](_0x0788('0x14'),auth[_0x0788('0xa')](),controller[_0x0788('0x15')]);router[_0x0788('0x16')]('/',auth[_0x0788('0xa')](),controller['create']);router[_0x0788('0x16')](_0x0788('0x12'),auth[_0x0788('0xa')](),controller[_0x0788('0x17')]);router['post'](_0x0788('0x14'),auth['isAuthenticated'](),controller[_0x0788('0x18')]);router[_0x0788('0x19')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller[_0x0788('0x1a')]);router[_0x0788('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x0788('0x1c')]);router[_0x0788('0x1b')]('/:id/teams',auth[_0x0788('0xa')](),controller[_0x0788('0x1d')]);router[_0x0788('0x1b')]('/:id/users',auth[_0x0788('0xa')](),controller[_0x0788('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x9fe7=['show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueue.controller','get','index','/describe','describe','/:id','isAuthenticated'];(function(_0xb446fe,_0x1144ca){var _0x40be27=function(_0x4afc70){while(--_0x4afc70){_0xb446fe['push'](_0xb446fe['shift']());}};_0x40be27(++_0x1144ca);}(_0x9fe7,0x1df));var _0x79fe=function(_0x138e5b,_0x3864e9){_0x138e5b=_0x138e5b-0x0;var _0x4f4d86=_0x9fe7[_0x138e5b];return _0x4f4d86;};'use strict';var multer=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var path=require('path');var timeout=require(_0x79fe('0x2'));var express=require('express');var router=express[_0x79fe('0x3')]();var fs_extra=require(_0x79fe('0x4'));var auth=require(_0x79fe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x79fe('0x6'));var controller=require(_0x79fe('0x7'));router[_0x79fe('0x8')]('/',auth['isAuthenticated'](),controller[_0x79fe('0x9')]);router[_0x79fe('0x8')](_0x79fe('0xa'),auth['isAuthenticated'](),controller[_0x79fe('0xb')]);router[_0x79fe('0x8')](_0x79fe('0xc'),auth[_0x79fe('0xd')](),controller[_0x79fe('0xe')]);router['get'](_0x79fe('0xf'),auth[_0x79fe('0xd')](),controller['getMembers']);router[_0x79fe('0x8')](_0x79fe('0x10'),auth[_0x79fe('0xd')](),controller[_0x79fe('0x11')]);router['get'](_0x79fe('0x12'),auth[_0x79fe('0xd')](),controller[_0x79fe('0x13')]);router[_0x79fe('0x14')]('/',auth[_0x79fe('0xd')](),controller[_0x79fe('0x15')]);router[_0x79fe('0x14')](_0x79fe('0x10'),auth['isAuthenticated'](),controller[_0x79fe('0x16')]);router[_0x79fe('0x14')](_0x79fe('0x12'),auth[_0x79fe('0xd')](),controller[_0x79fe('0x17')]);router[_0x79fe('0x18')]('/:id',auth[_0x79fe('0xd')](),controller[_0x79fe('0x19')]);router[_0x79fe('0x1a')](_0x79fe('0xc'),auth['isAuthenticated'](),controller[_0x79fe('0x1b')]);router[_0x79fe('0x1a')](_0x79fe('0x10'),auth[_0x79fe('0xd')](),controller['removeTeams']);router['delete'](_0x79fe('0x12'),auth[_0x79fe('0xd')](),controller[_0x79fe('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index a51464f..fb2e42b 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 _0x5294=['exports','STRING','DATE','moment','sequelize'];(function(_0x16ce16,_0x14e1f5){var _0x3d6bd0=function(_0xf1c137){while(--_0xf1c137){_0x16ce16['push'](_0x16ce16['shift']());}};_0x3d6bd0(++_0x14e1f5);}(_0x5294,0x111));var _0x4529=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5294[_0x1facfa];return _0x9ec701;};'use strict';var moment=require(_0x4529('0x0'));var Sequelize=require(_0x4529('0x1'));module[_0x4529('0x2')]={'uniqueid':{'type':Sequelize[_0x4529('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4529('0x3')]},'joinAt':{'type':Sequelize[_0x4529('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x4529('0x4')]},'exitAt':{'type':Sequelize[_0x4529('0x4')]},'reason':{'type':Sequelize[_0x4529('0x3')]}}; \ No newline at end of file +var _0x8828=['moment','exports','STRING','DATE'];(function(_0x47b15f,_0x103e93){var _0x55bf25=function(_0x51fe7f){while(--_0x51fe7f){_0x47b15f['push'](_0x47b15f['shift']());}};_0x55bf25(++_0x103e93);}(_0x8828,0x184));var _0x8882=function(_0x31d012,_0x4de949){_0x31d012=_0x31d012-0x0;var _0x400fda=_0x8828[_0x31d012];return _0x400fda;};'use strict';var moment=require(_0x8882('0x0'));var Sequelize=require('sequelize');module[_0x8882('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8882('0x2')]},'joinAt':{'type':Sequelize[_0x8882('0x3')]},'leaveAt':{'type':Sequelize[_0x8882('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8882('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 2192ced..f3bd0eb 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 _0x8388=['index','rawAttributes','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','includeAll','FaxQueueReport','rows','catch','show','include','options','find','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name'];(function(_0x2bab77,_0x17a334){var _0x11e91f=function(_0x1aaa42){while(--_0x1aaa42){_0x2bab77['push'](_0x2bab77['shift']());}};_0x11e91f(++_0x17a334);}(_0x8388,0x18d));var _0x8838=function(_0x4e198a,_0x5a6bad){_0x4e198a=_0x4e198a-0x0;var _0xb84bfe=_0x8388[_0x4e198a];return _0xb84bfe;};'use strict';var emlformat=require(_0x8838('0x0'));var rimraf=require(_0x8838('0x1'));var zipdir=require(_0x8838('0x2'));var jsonpatch=require(_0x8838('0x3'));var rp=require('request-promise');var moment=require(_0x8838('0x4'));var BPromise=require(_0x8838('0x5'));var Mustache=require(_0x8838('0x6'));var util=require(_0x8838('0x7'));var path=require(_0x8838('0x8'));var sox=require('sox');var csv=require(_0x8838('0x9'));var ejs=require(_0x8838('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8838('0xb'));var squel=require(_0x8838('0xc'));var crypto=require(_0x8838('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8838('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8838('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8838('0x10'));var as=require(_0x8838('0x11'));var hardwareService=require(_0x8838('0x12'));var logger=require(_0x8838('0x13'))('api');var utils=require(_0x8838('0x14'));var config=require(_0x8838('0x15'));var licenseUtil=require(_0x8838('0x16'));var db=require(_0x8838('0x17'))['db'];function respondWithStatusCode(_0x5cdd14,_0x157a82){_0x157a82=_0x157a82||0xcc;return function(_0x48dc7a){if(_0x48dc7a){return _0x5cdd14['sendStatus'](_0x157a82);}return _0x5cdd14[_0x8838('0x18')](_0x157a82)[_0x8838('0x19')]();};}function respondWithResult(_0x201ee5,_0x43b446){_0x43b446=_0x43b446||0xc8;return function(_0x15936c){if(_0x15936c){return _0x201ee5[_0x8838('0x18')](_0x43b446)[_0x8838('0x1a')](_0x15936c);}};}function respondWithFilteredResult(_0x8daaab,_0x486dae){return function(_0x44a342){if(_0x44a342){var _0x377db0=typeof _0x486dae['offset']===_0x8838('0x1b')&&typeof _0x486dae[_0x8838('0x1c')]===_0x8838('0x1b');var _0x4d0c2e=_0x44a342[_0x8838('0x1d')];var _0x522d44=_0x377db0?0x0:_0x486dae[_0x8838('0x1e')];var _0x204120=_0x377db0?_0x44a342[_0x8838('0x1d')]:_0x486dae['offset']+_0x486dae[_0x8838('0x1c')];var _0x7b836e;if(_0x204120>=_0x4d0c2e){_0x204120=_0x4d0c2e;_0x7b836e=0xc8;}else{_0x7b836e=0xce;}_0x8daaab['status'](_0x7b836e);return _0x8daaab[_0x8838('0x1f')](_0x8838('0x20'),_0x522d44+'-'+_0x204120+'/'+_0x4d0c2e)['json'](_0x44a342);}return null;};}function patchUpdates(_0x9de0f6){return function(_0xd59bca){try{jsonpatch['apply'](_0xd59bca,_0x9de0f6,!![]);}catch(_0x55ccbc){return BPromise[_0x8838('0x21')](_0x55ccbc);}return _0xd59bca[_0x8838('0x22')]();};}function saveUpdates(_0xe01a61,_0xb74e1b){return function(_0x109341){if(_0x109341){return _0x109341[_0x8838('0x23')](_0xe01a61)[_0x8838('0x24')](function(_0x35c3e0){return _0x35c3e0;});}return null;};}function removeEntity(_0x46b603,_0x56a4de){return function(_0x73d719){if(_0x73d719){return _0x73d719['destroy']()[_0x8838('0x24')](function(){_0x46b603[_0x8838('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50b05a,_0x256f42){return function(_0x2df92b){if(!_0x2df92b){_0x50b05a[_0x8838('0x25')](0x194);}return _0x2df92b;};}function handleError(_0x45e5bb,_0x1c611a){_0x1c611a=_0x1c611a||0x1f4;return function(_0x1b3153){logger[_0x8838('0x26')](_0x1b3153[_0x8838('0x27')]);if(_0x1b3153[_0x8838('0x28')]){delete _0x1b3153[_0x8838('0x28')];}_0x45e5bb['status'](_0x1c611a)['send'](_0x1b3153);};}exports[_0x8838('0x29')]=function(_0x52907a,_0x30ea01){var _0x3e8d7e={},_0x5da3b0={},_0x537c9d={'count':0x0,'rows':[]};var _0x2ac2b1=_['map'](db['FaxQueueReport'][_0x8838('0x2a')],function(_0x10b1d3){return{'name':_0x10b1d3['fieldName'],'type':_0x10b1d3[_0x8838('0x2b')][_0x8838('0x2c')]};});_0x5da3b0['model']=_[_0x8838('0x2d')](_0x2ac2b1,_0x8838('0x28'));_0x5da3b0[_0x8838('0x2e')]=_[_0x8838('0x2f')](_0x52907a['query']);_0x5da3b0[_0x8838('0x30')]=_[_0x8838('0x31')](_0x5da3b0['model'],_0x5da3b0['query']);_0x3e8d7e[_0x8838('0x32')]=_['intersection'](_0x5da3b0[_0x8838('0x33')],qs[_0x8838('0x34')](_0x52907a[_0x8838('0x2e')]['fields']));_0x3e8d7e[_0x8838('0x32')]=_0x3e8d7e[_0x8838('0x32')][_0x8838('0x35')]?_0x3e8d7e['attributes']:_0x5da3b0[_0x8838('0x33')];if(!_0x52907a[_0x8838('0x2e')][_0x8838('0x36')]('nolimit')){_0x3e8d7e['limit']=qs[_0x8838('0x1c')](_0x52907a[_0x8838('0x2e')][_0x8838('0x1c')]);_0x3e8d7e[_0x8838('0x1e')]=qs['offset'](_0x52907a[_0x8838('0x2e')][_0x8838('0x1e')]);}_0x3e8d7e[_0x8838('0x37')]=qs[_0x8838('0x38')](_0x52907a[_0x8838('0x2e')][_0x8838('0x38')]);_0x3e8d7e[_0x8838('0x39')]=qs[_0x8838('0x30')](_['pick'](_0x52907a[_0x8838('0x2e')],_0x5da3b0['filters']),_0x2ac2b1);if(_0x52907a['query']['filter']){_0x3e8d7e['where']=_[_0x8838('0x3a')](_0x3e8d7e[_0x8838('0x39')],{'$or':_[_0x8838('0x2d')](_0x2ac2b1,function(_0x4ca6ab){if(_0x4ca6ab[_0x8838('0x2b')]!==_0x8838('0x3b')){var _0x3c9e1e={};_0x3c9e1e[_0x4ca6ab[_0x8838('0x28')]]={'$like':'%'+_0x52907a[_0x8838('0x2e')][_0x8838('0x3c')]+'%'};return _0x3c9e1e;}})});}_0x3e8d7e=_[_0x8838('0x3a')]({},_0x3e8d7e,_0x52907a['options']);var _0x534e3a={'where':_0x3e8d7e['where']};return db['FaxQueueReport'][_0x8838('0x1d')](_0x534e3a)[_0x8838('0x24')](function(_0x543891){_0x537c9d[_0x8838('0x1d')]=_0x543891;if(_0x52907a[_0x8838('0x2e')][_0x8838('0x3d')]){_0x3e8d7e['include']=[{'all':!![]}];}return db[_0x8838('0x3e')]['findAll'](_0x3e8d7e);})[_0x8838('0x24')](function(_0x380c15){_0x537c9d[_0x8838('0x3f')]=_0x380c15;return _0x537c9d;})[_0x8838('0x24')](respondWithFilteredResult(_0x30ea01,_0x3e8d7e))[_0x8838('0x40')](handleError(_0x30ea01,null));};exports[_0x8838('0x41')]=function(_0x50695c,_0x21df2b){var _0x310ac7={'raw':!![],'where':{'id':_0x50695c['params']['id']}},_0x5dfa10={};_0x5dfa10[_0x8838('0x33')]=_[_0x8838('0x2f')](db[_0x8838('0x3e')][_0x8838('0x2a')]);_0x5dfa10[_0x8838('0x2e')]=_['keys'](_0x50695c[_0x8838('0x2e')]);_0x5dfa10[_0x8838('0x30')]=_[_0x8838('0x31')](_0x5dfa10[_0x8838('0x33')],_0x5dfa10[_0x8838('0x2e')]);_0x310ac7['attributes']=_['intersection'](_0x5dfa10[_0x8838('0x33')],qs['fields'](_0x50695c[_0x8838('0x2e')][_0x8838('0x34')]));_0x310ac7[_0x8838('0x32')]=_0x310ac7['attributes']['length']?_0x310ac7[_0x8838('0x32')]:_0x5dfa10[_0x8838('0x33')];if(_0x50695c[_0x8838('0x2e')][_0x8838('0x3d')]){_0x310ac7[_0x8838('0x42')]=[{'all':!![]}];}_0x310ac7=_[_0x8838('0x3a')]({},_0x310ac7,_0x50695c[_0x8838('0x43')]);return db[_0x8838('0x3e')][_0x8838('0x44')](_0x310ac7)[_0x8838('0x24')](handleEntityNotFound(_0x21df2b,null))[_0x8838('0x24')](respondWithResult(_0x21df2b,null))[_0x8838('0x40')](handleError(_0x21df2b,null));};exports['create']=function(_0xf664e,_0x5919b7){return db[_0x8838('0x3e')]['create'](_0xf664e[_0x8838('0x45')],{})[_0x8838('0x24')](respondWithResult(_0x5919b7,0xc9))[_0x8838('0x40')](handleError(_0x5919b7,null));};exports[_0x8838('0x23')]=function(_0x3c5b0e,_0x226f91){if(_0x3c5b0e[_0x8838('0x45')]['id']){delete _0x3c5b0e['body']['id'];}return db[_0x8838('0x3e')]['find']({'where':{'id':_0x3c5b0e[_0x8838('0x46')]['id']}})['then'](handleEntityNotFound(_0x226f91,null))[_0x8838('0x24')](saveUpdates(_0x3c5b0e[_0x8838('0x45')],null))['then'](respondWithResult(_0x226f91,null))[_0x8838('0x40')](handleError(_0x226f91,null));};exports[_0x8838('0x47')]=function(_0x44bdb4,_0x57f25c){return db[_0x8838('0x3e')][_0x8838('0x44')]({'where':{'id':_0x44bdb4[_0x8838('0x46')]['id']}})['then'](handleEntityNotFound(_0x57f25c,null))[_0x8838('0x24')](removeEntity(_0x57f25c,null))[_0x8838('0x40')](handleError(_0x57f25c,null));};exports[_0x8838('0x48')]=function(_0x379684,_0xe13d25){return db[_0x8838('0x3e')][_0x8838('0x48')]()[_0x8838('0x24')](respondWithResult(_0xe13d25,null))[_0x8838('0x40')](handleError(_0xe13d25,null));}; \ No newline at end of file +var _0x534d=['error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','merge','where','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x534d,0x79));var _0xd534=function(_0xe66e37,_0x978de4){_0xe66e37=_0xe66e37-0x0;var _0x2aff69=_0x534d[_0xe66e37];return _0x2aff69;};'use strict';var emlformat=require(_0xd534('0x0'));var rimraf=require(_0xd534('0x1'));var zipdir=require(_0xd534('0x2'));var jsonpatch=require(_0xd534('0x3'));var rp=require(_0xd534('0x4'));var moment=require(_0xd534('0x5'));var BPromise=require(_0xd534('0x6'));var Mustache=require(_0xd534('0x7'));var util=require(_0xd534('0x8'));var path=require(_0xd534('0x9'));var sox=require(_0xd534('0xa'));var csv=require(_0xd534('0xb'));var ejs=require(_0xd534('0xc'));var fs=require('fs');var fs_extra=require(_0xd534('0xd'));var _=require(_0xd534('0xe'));var squel=require(_0xd534('0xf'));var crypto=require(_0xd534('0x10'));var jsforce=require(_0xd534('0x11'));var deskjs=require(_0xd534('0x12'));var toCsv=require('to-csv');var querystring=require(_0xd534('0x13'));var Papa=require(_0xd534('0x14'));var Redis=require(_0xd534('0x15'));var authService=require(_0xd534('0x16'));var qs=require(_0xd534('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd534('0x18'));var logger=require(_0xd534('0x19'))(_0xd534('0x1a'));var utils=require(_0xd534('0x1b'));var config=require(_0xd534('0x1c'));var licenseUtil=require(_0xd534('0x1d'));var db=require(_0xd534('0x1e'))['db'];function respondWithStatusCode(_0xc019db,_0x568e0e){_0x568e0e=_0x568e0e||0xcc;return function(_0x518e7d){if(_0x518e7d){return _0xc019db[_0xd534('0x1f')](_0x568e0e);}return _0xc019db[_0xd534('0x20')](_0x568e0e)[_0xd534('0x21')]();};}function respondWithResult(_0x187e0,_0x290b75){_0x290b75=_0x290b75||0xc8;return function(_0x9ecc7d){if(_0x9ecc7d){return _0x187e0[_0xd534('0x20')](_0x290b75)[_0xd534('0x22')](_0x9ecc7d);}};}function respondWithFilteredResult(_0x340dee,_0x1ec85f){return function(_0x502c61){if(_0x502c61){var _0x51e8b2=typeof _0x1ec85f[_0xd534('0x23')]===_0xd534('0x24')&&typeof _0x1ec85f[_0xd534('0x25')]==='undefined';var _0x4f7f45=_0x502c61[_0xd534('0x26')];var _0x477b62=_0x51e8b2?0x0:_0x1ec85f[_0xd534('0x23')];var _0xb097fd=_0x51e8b2?_0x502c61['count']:_0x1ec85f['offset']+_0x1ec85f[_0xd534('0x25')];var _0x65672f;if(_0xb097fd>=_0x4f7f45){_0xb097fd=_0x4f7f45;_0x65672f=0xc8;}else{_0x65672f=0xce;}_0x340dee['status'](_0x65672f);return _0x340dee['set'](_0xd534('0x27'),_0x477b62+'-'+_0xb097fd+'/'+_0x4f7f45)['json'](_0x502c61);}return null;};}function patchUpdates(_0x3c0f39){return function(_0x419e08){try{jsonpatch[_0xd534('0x28')](_0x419e08,_0x3c0f39,!![]);}catch(_0x4464d3){return BPromise[_0xd534('0x29')](_0x4464d3);}return _0x419e08['save']();};}function saveUpdates(_0x59f5d7,_0x25a176){return function(_0x533c13){if(_0x533c13){return _0x533c13[_0xd534('0x2a')](_0x59f5d7)[_0xd534('0x2b')](function(_0x4d139f){return _0x4d139f;});}return null;};}function removeEntity(_0x3138f6,_0x38681b){return function(_0x3c030e){if(_0x3c030e){return _0x3c030e[_0xd534('0x2c')]()['then'](function(){_0x3138f6['status'](0xcc)[_0xd534('0x21')]();});}};}function handleEntityNotFound(_0x269b31,_0x1028b8){return function(_0x4ec7bf){if(!_0x4ec7bf){_0x269b31[_0xd534('0x1f')](0x194);}return _0x4ec7bf;};}function handleError(_0x27d291,_0x46818d){_0x46818d=_0x46818d||0x1f4;return function(_0x4c509d){logger[_0xd534('0x2d')](_0x4c509d[_0xd534('0x2e')]);if(_0x4c509d['name']){delete _0x4c509d[_0xd534('0x2f')];}_0x27d291[_0xd534('0x20')](_0x46818d)[_0xd534('0x30')](_0x4c509d);};}exports[_0xd534('0x31')]=function(_0x2bf346,_0x36ee41){var _0x4d5bbb={},_0xf3da75={},_0x35037c={'count':0x0,'rows':[]};var _0xb08730=_[_0xd534('0x32')](db[_0xd534('0x33')][_0xd534('0x34')],function(_0x2d525e){return{'name':_0x2d525e[_0xd534('0x35')],'type':_0x2d525e[_0xd534('0x36')][_0xd534('0x37')]};});_0xf3da75[_0xd534('0x38')]=_[_0xd534('0x32')](_0xb08730,'name');_0xf3da75[_0xd534('0x39')]=_[_0xd534('0x3a')](_0x2bf346['query']);_0xf3da75[_0xd534('0x3b')]=_[_0xd534('0x3c')](_0xf3da75['model'],_0xf3da75['query']);_0x4d5bbb['attributes']=_[_0xd534('0x3c')](_0xf3da75[_0xd534('0x38')],qs['fields'](_0x2bf346[_0xd534('0x39')][_0xd534('0x3d')]));_0x4d5bbb[_0xd534('0x3e')]=_0x4d5bbb['attributes'][_0xd534('0x3f')]?_0x4d5bbb[_0xd534('0x3e')]:_0xf3da75[_0xd534('0x38')];if(!_0x2bf346['query'][_0xd534('0x40')](_0xd534('0x41'))){_0x4d5bbb[_0xd534('0x25')]=qs['limit'](_0x2bf346[_0xd534('0x39')][_0xd534('0x25')]);_0x4d5bbb['offset']=qs[_0xd534('0x23')](_0x2bf346[_0xd534('0x39')][_0xd534('0x23')]);}_0x4d5bbb[_0xd534('0x42')]=qs['sort'](_0x2bf346[_0xd534('0x39')]['sort']);_0x4d5bbb['where']=qs['filters'](_[_0xd534('0x43')](_0x2bf346[_0xd534('0x39')],_0xf3da75[_0xd534('0x3b')]),_0xb08730);if(_0x2bf346[_0xd534('0x39')]['filter']){_0x4d5bbb['where']=_[_0xd534('0x44')](_0x4d5bbb[_0xd534('0x45')],{'$or':_[_0xd534('0x32')](_0xb08730,function(_0x1f588d){if(_0x1f588d[_0xd534('0x36')]!==_0xd534('0x46')){var _0x4b8d09={};_0x4b8d09[_0x1f588d[_0xd534('0x2f')]]={'$like':'%'+_0x2bf346['query'][_0xd534('0x47')]+'%'};return _0x4b8d09;}})});}_0x4d5bbb=_[_0xd534('0x44')]({},_0x4d5bbb,_0x2bf346[_0xd534('0x48')]);var _0x3bb78f={'where':_0x4d5bbb[_0xd534('0x45')]};return db['FaxQueueReport'][_0xd534('0x26')](_0x3bb78f)['then'](function(_0x351e1b){_0x35037c[_0xd534('0x26')]=_0x351e1b;if(_0x2bf346[_0xd534('0x39')][_0xd534('0x49')]){_0x4d5bbb[_0xd534('0x4a')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x4d5bbb);})[_0xd534('0x2b')](function(_0x2b9de4){_0x35037c[_0xd534('0x4b')]=_0x2b9de4;return _0x35037c;})[_0xd534('0x2b')](respondWithFilteredResult(_0x36ee41,_0x4d5bbb))[_0xd534('0x4c')](handleError(_0x36ee41,null));};exports[_0xd534('0x4d')]=function(_0x1ee0fa,_0xc8b67d){var _0x5b2eb3={'raw':!![],'where':{'id':_0x1ee0fa[_0xd534('0x4e')]['id']}},_0x1e8595={};_0x1e8595[_0xd534('0x38')]=_['keys'](db['FaxQueueReport'][_0xd534('0x34')]);_0x1e8595[_0xd534('0x39')]=_['keys'](_0x1ee0fa[_0xd534('0x39')]);_0x1e8595['filters']=_[_0xd534('0x3c')](_0x1e8595[_0xd534('0x38')],_0x1e8595[_0xd534('0x39')]);_0x5b2eb3['attributes']=_[_0xd534('0x3c')](_0x1e8595[_0xd534('0x38')],qs[_0xd534('0x3d')](_0x1ee0fa[_0xd534('0x39')][_0xd534('0x3d')]));_0x5b2eb3[_0xd534('0x3e')]=_0x5b2eb3[_0xd534('0x3e')][_0xd534('0x3f')]?_0x5b2eb3[_0xd534('0x3e')]:_0x1e8595[_0xd534('0x38')];if(_0x1ee0fa['query']['includeAll']){_0x5b2eb3['include']=[{'all':!![]}];}_0x5b2eb3=_[_0xd534('0x44')]({},_0x5b2eb3,_0x1ee0fa[_0xd534('0x48')]);return db[_0xd534('0x33')][_0xd534('0x4f')](_0x5b2eb3)[_0xd534('0x2b')](handleEntityNotFound(_0xc8b67d,null))[_0xd534('0x2b')](respondWithResult(_0xc8b67d,null))['catch'](handleError(_0xc8b67d,null));};exports[_0xd534('0x50')]=function(_0x4c4560,_0x3eb0d1){return db[_0xd534('0x33')]['create'](_0x4c4560[_0xd534('0x51')],{})[_0xd534('0x2b')](respondWithResult(_0x3eb0d1,0xc9))[_0xd534('0x4c')](handleError(_0x3eb0d1,null));};exports[_0xd534('0x2a')]=function(_0x495f17,_0xb3c1cb){if(_0x495f17[_0xd534('0x51')]['id']){delete _0x495f17[_0xd534('0x51')]['id'];}return db[_0xd534('0x33')][_0xd534('0x4f')]({'where':{'id':_0x495f17[_0xd534('0x4e')]['id']}})[_0xd534('0x2b')](handleEntityNotFound(_0xb3c1cb,null))['then'](saveUpdates(_0x495f17['body'],null))[_0xd534('0x2b')](respondWithResult(_0xb3c1cb,null))[_0xd534('0x4c')](handleError(_0xb3c1cb,null));};exports['destroy']=function(_0x494667,_0x56b2ee){return db[_0xd534('0x33')]['find']({'where':{'id':_0x494667[_0xd534('0x4e')]['id']}})[_0xd534('0x2b')](handleEntityNotFound(_0x56b2ee,null))[_0xd534('0x2b')](removeEntity(_0x56b2ee,null))[_0xd534('0x4c')](handleError(_0x56b2ee,null));};exports['describe']=function(_0x17b1bc,_0x400472){return db[_0xd534('0x33')][_0xd534('0x52')]()[_0xd534('0x2b')](respondWithResult(_0x400472,null))[_0xd534('0x4c')](handleError(_0x400472,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 85dd7cc..f5874c6 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x3972ac,_0x519760){var _0x5e403d=function(_0x27f34e){while(--_0x27f34e){_0x3972ac['push'](_0x3972ac['shift']());}};_0x5e403d(++_0x519760);}(_0xabce,0x103));var _0xeabc=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xabce[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x1e76b2,_0x49b324){var _0x3553e3=function(_0x12c827){while(--_0x12c827){_0x1e76b2['push'](_0x1e76b2['shift']());}};_0x3553e3(++_0x49b324);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x6f5598,_0xabeb74){_0x6f5598=_0x6f5598-0x0;var _0x1e1325=_0x7fbe[_0x6f5598];return _0x1e1325;};'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':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('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 3fd823f..d0be239 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 _0x4372=['UpdateFaxQueueReport','update','body','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','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','options','raw'];(function(_0x34366b,_0x248c3c){var _0x33921b=function(_0x55946a){while(--_0x55946a){_0x34366b['push'](_0x34366b['shift']());}};_0x33921b(++_0x248c3c);}(_0x4372,0x72));var _0x2437=function(_0x1c9863,_0xe952b2){_0x1c9863=_0x1c9863-0x0;var _0x104660=_0x4372[_0x1c9863];return _0x104660;};'use strict';var _=require(_0x2437('0x0'));var util=require('util');var moment=require(_0x2437('0x1'));var BPromise=require(_0x2437('0x2'));var rs=require(_0x2437('0x3'));var fs=require('fs');var Redis=require(_0x2437('0x4'));var db=require(_0x2437('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2437('0x6'))(_0x2437('0x7'));var config=require(_0x2437('0x8'));var jayson=require(_0x2437('0x9'));var client=jayson[_0x2437('0xa')][_0x2437('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2560c6,_0x1b3ac7,_0x11d939){return new BPromise(function(_0x536ee5,_0x3474af){return client[_0x2437('0xc')](_0x2560c6,_0x11d939)[_0x2437('0xd')](function(_0x460a89){logger[_0x2437('0xe')](_0x2437('0xf'),_0x1b3ac7,_0x2437('0x10'));logger[_0x2437('0x11')](_0x2437('0x12'),_0x1b3ac7,_0x2437('0x10'),JSON[_0x2437('0x13')](_0x460a89));if(_0x460a89[_0x2437('0x14')]){if(_0x460a89[_0x2437('0x14')][_0x2437('0x15')]===0x1f4){logger[_0x2437('0x14')](_0x2437('0xf'),_0x1b3ac7,_0x460a89[_0x2437('0x14')]['message']);return _0x3474af(_0x460a89[_0x2437('0x14')][_0x2437('0x16')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x1b3ac7,_0x460a89[_0x2437('0x14')]['message']);return _0x536ee5(_0x460a89[_0x2437('0x14')][_0x2437('0x16')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x1b3ac7,_0x2437('0x10'));_0x536ee5(_0x460a89[_0x2437('0x17')][_0x2437('0x16')]);}})[_0x2437('0x18')](function(_0x5486b0){logger[_0x2437('0x14')](_0x2437('0xf'),_0x1b3ac7,_0x5486b0);_0x3474af(_0x5486b0);});});}exports[_0x2437('0x19')]=function(_0x53a162){var _0x37ae87=this;return new Promise(function(_0x359db0,_0x3f4519){return db[_0x2437('0x1a')][_0x2437('0x1b')](_0x53a162['body'],{'raw':_0x53a162[_0x2437('0x1c')]?_0x53a162[_0x2437('0x1c')][_0x2437('0x1d')]===undefined?!![]:![]:!![]})[_0x2437('0xd')](function(_0xb461bd){logger[_0x2437('0xe')]('CreateFaxQueueReport',_0x53a162);logger[_0x2437('0x11')](_0x2437('0x19'),_0x53a162,JSON[_0x2437('0x13')](_0xb461bd));_0x359db0(_0xb461bd);})['catch'](function(_0x28e68e){logger[_0x2437('0x14')](_0x2437('0x19'),_0x28e68e[_0x2437('0x16')],_0x53a162);_0x3f4519(_0x37ae87['error'](0x1f4,_0x28e68e[_0x2437('0x16')]));});});};exports[_0x2437('0x1e')]=function(_0x46c4b1){var _0x368586=this;return new Promise(function(_0x4b8d32,_0xd418ac){return db[_0x2437('0x1a')][_0x2437('0x1f')](_0x46c4b1[_0x2437('0x20')],{'raw':_0x46c4b1[_0x2437('0x1c')]?_0x46c4b1['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46c4b1[_0x2437('0x1c')]?_0x46c4b1[_0x2437('0x1c')][_0x2437('0x21')]||null:null,'attributes':_0x46c4b1['options']?_0x46c4b1['options'][_0x2437('0x22')]||null:null,'limit':_0x46c4b1[_0x2437('0x1c')]?_0x46c4b1[_0x2437('0x1c')][_0x2437('0x23')]||null:null})[_0x2437('0xd')](function(_0x3a5c49){logger[_0x2437('0xe')](_0x2437('0x1e'),_0x46c4b1);logger[_0x2437('0x11')]('UpdateFaxQueueReport',_0x46c4b1,JSON['stringify'](_0x3a5c49));_0x4b8d32(_0x3a5c49);})[_0x2437('0x18')](function(_0x1ddecc){logger[_0x2437('0x14')](_0x2437('0x1e'),_0x1ddecc[_0x2437('0x16')],_0x46c4b1);_0xd418ac(_0x368586[_0x2437('0x14')](0x1f4,_0x1ddecc[_0x2437('0x16')]));});});}; \ No newline at end of file +var _0xfbd7=['error','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','catch','UpdateFaxQueueReport','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5c0210,_0x31b7c7){var _0x1fb324=function(_0x50b834){while(--_0x50b834){_0x5c0210['push'](_0x5c0210['shift']());}};_0x1fb324(++_0x31b7c7);}(_0xfbd7,0x1c8));var _0x7fbd=function(_0x5b9ac9,_0x374422){_0x5b9ac9=_0x5b9ac9-0x0;var _0x7e6db3=_0xfbd7[_0x5b9ac9];return _0x7e6db3;};'use strict';var _=require('lodash');var util=require(_0x7fbd('0x0'));var moment=require(_0x7fbd('0x1'));var BPromise=require(_0x7fbd('0x2'));var rs=require(_0x7fbd('0x3'));var fs=require('fs');var Redis=require(_0x7fbd('0x4'));var db=require(_0x7fbd('0x5'))['db'];var utils=require(_0x7fbd('0x6'));var logger=require(_0x7fbd('0x7'))(_0x7fbd('0x8'));var config=require(_0x7fbd('0x9'));var jayson=require(_0x7fbd('0xa'));var client=jayson[_0x7fbd('0xb')][_0x7fbd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f3d54,_0x191b21,_0x1bac05){return new BPromise(function(_0x5b3386,_0x37bb30){return client[_0x7fbd('0xd')](_0x5f3d54,_0x1bac05)[_0x7fbd('0xe')](function(_0x1a10a0){logger[_0x7fbd('0xf')](_0x7fbd('0x10'),_0x191b21,'request\x20sent');logger[_0x7fbd('0x11')](_0x7fbd('0x12'),_0x191b21,'request\x20sent',JSON[_0x7fbd('0x13')](_0x1a10a0));if(_0x1a10a0[_0x7fbd('0x14')]){if(_0x1a10a0['error']['code']===0x1f4){logger[_0x7fbd('0x14')](_0x7fbd('0x10'),_0x191b21,_0x1a10a0['error'][_0x7fbd('0x15')]);return _0x37bb30(_0x1a10a0[_0x7fbd('0x14')]['message']);}logger[_0x7fbd('0x14')](_0x7fbd('0x10'),_0x191b21,_0x1a10a0['error'][_0x7fbd('0x15')]);return _0x5b3386(_0x1a10a0['error'][_0x7fbd('0x15')]);}else{logger[_0x7fbd('0xf')](_0x7fbd('0x10'),_0x191b21,'request\x20sent');_0x5b3386(_0x1a10a0[_0x7fbd('0x16')][_0x7fbd('0x15')]);}})['catch'](function(_0x237f5e){logger[_0x7fbd('0x14')](_0x7fbd('0x10'),_0x191b21,_0x237f5e);_0x37bb30(_0x237f5e);});});}exports[_0x7fbd('0x17')]=function(_0x253111){var _0x5b9cf4=this;return new Promise(function(_0x512b2b,_0x1721f3){return db[_0x7fbd('0x18')][_0x7fbd('0x19')](_0x253111[_0x7fbd('0x1a')],{'raw':_0x253111[_0x7fbd('0x1b')]?_0x253111[_0x7fbd('0x1b')][_0x7fbd('0x1c')]===undefined?!![]:![]:!![]})[_0x7fbd('0xe')](function(_0x2efd75){logger[_0x7fbd('0xf')](_0x7fbd('0x17'),_0x253111);logger[_0x7fbd('0x11')](_0x7fbd('0x17'),_0x253111,JSON[_0x7fbd('0x13')](_0x2efd75));_0x512b2b(_0x2efd75);})[_0x7fbd('0x1d')](function(_0x390da0){logger[_0x7fbd('0x14')](_0x7fbd('0x17'),_0x390da0[_0x7fbd('0x15')],_0x253111);_0x1721f3(_0x5b9cf4[_0x7fbd('0x14')](0x1f4,_0x390da0[_0x7fbd('0x15')]));});});};exports[_0x7fbd('0x1e')]=function(_0x72d35f){var _0x3f511c=this;return new Promise(function(_0x57bca2,_0x381519){return db[_0x7fbd('0x18')]['update'](_0x72d35f['body'],{'raw':_0x72d35f[_0x7fbd('0x1b')]?_0x72d35f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x72d35f['options']?_0x72d35f['options'][_0x7fbd('0x1f')]||null:null,'attributes':_0x72d35f[_0x7fbd('0x1b')]?_0x72d35f['options'][_0x7fbd('0x20')]||null:null,'limit':_0x72d35f[_0x7fbd('0x1b')]?_0x72d35f[_0x7fbd('0x1b')][_0x7fbd('0x21')]||null:null})[_0x7fbd('0xe')](function(_0x4a3bdc){logger[_0x7fbd('0xf')](_0x7fbd('0x1e'),_0x72d35f);logger[_0x7fbd('0x11')](_0x7fbd('0x1e'),_0x72d35f,JSON[_0x7fbd('0x13')](_0x4a3bdc));_0x57bca2(_0x4a3bdc);})[_0x7fbd('0x1d')](function(_0x24244d){logger[_0x7fbd('0x14')]('UpdateFaxQueueReport',_0x24244d[_0x7fbd('0x15')],_0x72d35f);_0x381519(_0x3f511c['error'](0x1f4,_0x24244d['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index ea4aa76..099264f 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 _0xe047=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','/:id','show','create','put','delete','destroy'];(function(_0x1d78f8,_0x21b9b8){var _0x4b32af=function(_0xd5141){while(--_0xd5141){_0x1d78f8['push'](_0x1d78f8['shift']());}};_0x4b32af(++_0x21b9b8);}(_0xe047,0x1c9));var _0x7e04=function(_0x922dbd,_0x3c8b97){_0x922dbd=_0x922dbd-0x0;var _0x1934f5=_0xe047[_0x922dbd];return _0x1934f5;};'use strict';var multer=require(_0x7e04('0x0'));var util=require('util');var path=require(_0x7e04('0x1'));var timeout=require(_0x7e04('0x2'));var express=require(_0x7e04('0x3'));var router=express[_0x7e04('0x4')]();var fs_extra=require(_0x7e04('0x5'));var auth=require(_0x7e04('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7e04('0x7'));var controller=require(_0x7e04('0x8'));router[_0x7e04('0x9')]('/',auth[_0x7e04('0xa')](),controller['index']);router[_0x7e04('0x9')](_0x7e04('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x7e04('0x9')](_0x7e04('0xc'),auth['isAuthenticated'](),controller[_0x7e04('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7e04('0xe')]);router[_0x7e04('0xf')](_0x7e04('0xc'),auth[_0x7e04('0xa')](),controller['update']);router[_0x7e04('0x10')](_0x7e04('0xc'),auth[_0x7e04('0xa')](),controller[_0x7e04('0x11')]);module[_0x7e04('0x12')]=router; \ No newline at end of file +var _0xdb25=['show','post','create','put','update','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4ce467,_0x1e7a57){var _0x459c45=function(_0x23049e){while(--_0x23049e){_0x4ce467['push'](_0x4ce467['shift']());}};_0x459c45(++_0x1e7a57);}(_0xdb25,0x1e0));var _0x5db2=function(_0x4d3cf8,_0xcf6c68){_0x4d3cf8=_0x4d3cf8-0x0;var _0x1918bb=_0xdb25[_0x4d3cf8];return _0x1918bb;};'use strict';var multer=require(_0x5db2('0x0'));var util=require(_0x5db2('0x1'));var path=require(_0x5db2('0x2'));var timeout=require(_0x5db2('0x3'));var express=require(_0x5db2('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5db2('0x5'));var interaction=require(_0x5db2('0x6'));var config=require('../../config/environment');var controller=require(_0x5db2('0x7'));router[_0x5db2('0x8')]('/',auth[_0x5db2('0x9')](),controller[_0x5db2('0xa')]);router['get'](_0x5db2('0xb'),auth['isAuthenticated'](),controller[_0x5db2('0xc')]);router[_0x5db2('0x8')](_0x5db2('0xd'),auth[_0x5db2('0x9')](),controller[_0x5db2('0xe')]);router[_0x5db2('0xf')]('/',auth[_0x5db2('0x9')](),controller[_0x5db2('0x10')]);router[_0x5db2('0x11')]('/:id',auth[_0x5db2('0x9')](),controller[_0x5db2('0x12')]);router['delete'](_0x5db2('0xd'),auth[_0x5db2('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 770a91b..0862866 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x78aa70,_0x36e722){var _0x1e701a=function(_0x722aeb){while(--_0x722aeb){_0x78aa70['push'](_0x78aa70['shift']());}};_0x1e701a(++_0x36e722);}(_0xe706,0xa3));var _0x6e70=function(_0x32c012,_0xe3c576){_0x32c012=_0x32c012-0x0;var _0x48562e=_0xe706[_0x32c012];return _0x48562e;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x55d683,_0x181159){var _0x1cb3ae=function(_0x56c2dd){while(--_0x56c2dd){_0x55d683['push'](_0x55d683['shift']());}};_0x1cb3ae(++_0x181159);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x00bb[_0x5b561d];return _0x431060;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 473d0fd..6fd0198 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 _0xbf89=['../../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','offset','set','apply','reject','save','update','then','destroy','error','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','catch','show','keys','fields','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x3c2e23,_0x333d1f){var _0x2b057a=function(_0x5666a1){while(--_0x5666a1){_0x3c2e23['push'](_0x3c2e23['shift']());}};_0x2b057a(++_0x333d1f);}(_0xbf89,0x83));var _0x9bf8=function(_0x289842,_0x2d9db4){_0x289842=_0x289842-0x0;var _0x16155a=_0xbf89[_0x289842];return _0x16155a;};'use strict';var emlformat=require(_0x9bf8('0x0'));var rimraf=require(_0x9bf8('0x1'));var zipdir=require(_0x9bf8('0x2'));var jsonpatch=require(_0x9bf8('0x3'));var rp=require(_0x9bf8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9bf8('0x5'));var path=require('path');var sox=require(_0x9bf8('0x6'));var csv=require('to-csv');var ejs=require(_0x9bf8('0x7'));var fs=require('fs');var fs_extra=require(_0x9bf8('0x8'));var _=require(_0x9bf8('0x9'));var squel=require('squel');var crypto=require(_0x9bf8('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9bf8('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9bf8('0xc'));var Papa=require(_0x9bf8('0xd'));var Redis=require(_0x9bf8('0xe'));var authService=require(_0x9bf8('0xf'));var qs=require(_0x9bf8('0x10'));var as=require(_0x9bf8('0x11'));var hardwareService=require(_0x9bf8('0x12'));var logger=require('../../config/logger')(_0x9bf8('0x13'));var utils=require(_0x9bf8('0x14'));var config=require(_0x9bf8('0x15'));var licenseUtil=require(_0x9bf8('0x16'));var db=require(_0x9bf8('0x17'))['db'];function respondWithStatusCode(_0x499c45,_0xb0eafe){_0xb0eafe=_0xb0eafe||0xcc;return function(_0x48b2d9){if(_0x48b2d9){return _0x499c45[_0x9bf8('0x18')](_0xb0eafe);}return _0x499c45[_0x9bf8('0x19')](_0xb0eafe)[_0x9bf8('0x1a')]();};}function respondWithResult(_0x5f53cd,_0x27fac9){_0x27fac9=_0x27fac9||0xc8;return function(_0x207715){if(_0x207715){return _0x5f53cd[_0x9bf8('0x19')](_0x27fac9)[_0x9bf8('0x1b')](_0x207715);}};}function respondWithFilteredResult(_0x102815,_0x15006d){return function(_0x207784){if(_0x207784){var _0x5c379d=typeof _0x15006d['offset']===_0x9bf8('0x1c')&&typeof _0x15006d[_0x9bf8('0x1d')]==='undefined';var _0x3fa321=_0x207784['count'];var _0x6abcbd=_0x5c379d?0x0:_0x15006d['offset'];var _0x569678=_0x5c379d?_0x207784['count']:_0x15006d[_0x9bf8('0x1e')]+_0x15006d[_0x9bf8('0x1d')];var _0x1bd44d;if(_0x569678>=_0x3fa321){_0x569678=_0x3fa321;_0x1bd44d=0xc8;}else{_0x1bd44d=0xce;}_0x102815['status'](_0x1bd44d);return _0x102815[_0x9bf8('0x1f')]('Content-Range',_0x6abcbd+'-'+_0x569678+'/'+_0x3fa321)[_0x9bf8('0x1b')](_0x207784);}return null;};}function patchUpdates(_0x18e4d0){return function(_0x2b0040){try{jsonpatch[_0x9bf8('0x20')](_0x2b0040,_0x18e4d0,!![]);}catch(_0x5670dc){return BPromise[_0x9bf8('0x21')](_0x5670dc);}return _0x2b0040[_0x9bf8('0x22')]();};}function saveUpdates(_0x19e725,_0x23bf6c){return function(_0x349948){if(_0x349948){return _0x349948[_0x9bf8('0x23')](_0x19e725)[_0x9bf8('0x24')](function(_0x382bc8){return _0x382bc8;});}return null;};}function removeEntity(_0x17e982,_0x39dae0){return function(_0x256766){if(_0x256766){return _0x256766[_0x9bf8('0x25')]()[_0x9bf8('0x24')](function(){_0x17e982['status'](0xcc)[_0x9bf8('0x1a')]();});}};}function handleEntityNotFound(_0x2b2199,_0x24559e){return function(_0x331203){if(!_0x331203){_0x2b2199[_0x9bf8('0x18')](0x194);}return _0x331203;};}function handleError(_0x57d139,_0x4bd4d4){_0x4bd4d4=_0x4bd4d4||0x1f4;return function(_0x25ed10){logger[_0x9bf8('0x26')](_0x25ed10['stack']);if(_0x25ed10[_0x9bf8('0x27')]){delete _0x25ed10['name'];}_0x57d139[_0x9bf8('0x19')](_0x4bd4d4)[_0x9bf8('0x28')](_0x25ed10);};}exports[_0x9bf8('0x29')]=function(_0x3ab73a,_0x46cf0){var _0x53c5ce={},_0x2e8008={},_0x25a12d={'count':0x0,'rows':[]};var _0x474054=_[_0x9bf8('0x2a')](db[_0x9bf8('0x2b')][_0x9bf8('0x2c')],function(_0x37add9){return{'name':_0x37add9[_0x9bf8('0x2d')],'type':_0x37add9['type'][_0x9bf8('0x2e')]};});_0x2e8008[_0x9bf8('0x2f')]=_[_0x9bf8('0x2a')](_0x474054,_0x9bf8('0x27'));_0x2e8008['query']=_['keys'](_0x3ab73a[_0x9bf8('0x30')]);_0x2e8008[_0x9bf8('0x31')]=_['intersection'](_0x2e8008['model'],_0x2e8008['query']);_0x53c5ce['attributes']=_[_0x9bf8('0x32')](_0x2e8008[_0x9bf8('0x2f')],qs['fields'](_0x3ab73a[_0x9bf8('0x30')]['fields']));_0x53c5ce[_0x9bf8('0x33')]=_0x53c5ce[_0x9bf8('0x33')][_0x9bf8('0x34')]?_0x53c5ce[_0x9bf8('0x33')]:_0x2e8008[_0x9bf8('0x2f')];if(!_0x3ab73a[_0x9bf8('0x30')][_0x9bf8('0x35')](_0x9bf8('0x36'))){_0x53c5ce[_0x9bf8('0x1d')]=qs[_0x9bf8('0x1d')](_0x3ab73a[_0x9bf8('0x30')][_0x9bf8('0x1d')]);_0x53c5ce['offset']=qs[_0x9bf8('0x1e')](_0x3ab73a[_0x9bf8('0x30')][_0x9bf8('0x1e')]);}_0x53c5ce['order']=qs[_0x9bf8('0x37')](_0x3ab73a['query'][_0x9bf8('0x37')]);_0x53c5ce[_0x9bf8('0x38')]=qs[_0x9bf8('0x31')](_[_0x9bf8('0x39')](_0x3ab73a[_0x9bf8('0x30')],_0x2e8008['filters']),_0x474054);if(_0x3ab73a[_0x9bf8('0x30')][_0x9bf8('0x3a')]){_0x53c5ce[_0x9bf8('0x38')]=_[_0x9bf8('0x3b')](_0x53c5ce[_0x9bf8('0x38')],{'$or':_[_0x9bf8('0x2a')](_0x474054,function(_0x85bb63){if(_0x85bb63[_0x9bf8('0x3c')]!==_0x9bf8('0x3d')){var _0x103801={};_0x103801[_0x85bb63[_0x9bf8('0x27')]]={'$like':'%'+_0x3ab73a[_0x9bf8('0x30')][_0x9bf8('0x3a')]+'%'};return _0x103801;}})});}_0x53c5ce=_[_0x9bf8('0x3b')]({},_0x53c5ce,_0x3ab73a[_0x9bf8('0x3e')]);var _0x317a5e={'where':_0x53c5ce['where']};return db[_0x9bf8('0x2b')]['count'](_0x317a5e)[_0x9bf8('0x24')](function(_0x3dbd61){_0x25a12d[_0x9bf8('0x3f')]=_0x3dbd61;if(_0x3ab73a['query']['includeAll']){_0x53c5ce['include']=[{'all':!![]}];}return db[_0x9bf8('0x2b')]['findAll'](_0x53c5ce);})['then'](function(_0x42f64f){_0x25a12d['rows']=_0x42f64f;return _0x25a12d;})['then'](respondWithFilteredResult(_0x46cf0,_0x53c5ce))[_0x9bf8('0x40')](handleError(_0x46cf0,null));};exports[_0x9bf8('0x41')]=function(_0x4e980d,_0x260377){var _0xd084e9={'raw':!![],'where':{'id':_0x4e980d['params']['id']}},_0x17e6f7={};_0x17e6f7[_0x9bf8('0x2f')]=_[_0x9bf8('0x42')](db['FaxTransferReport']['rawAttributes']);_0x17e6f7['query']=_[_0x9bf8('0x42')](_0x4e980d['query']);_0x17e6f7[_0x9bf8('0x31')]=_[_0x9bf8('0x32')](_0x17e6f7[_0x9bf8('0x2f')],_0x17e6f7[_0x9bf8('0x30')]);_0xd084e9[_0x9bf8('0x33')]=_[_0x9bf8('0x32')](_0x17e6f7[_0x9bf8('0x2f')],qs[_0x9bf8('0x43')](_0x4e980d['query'][_0x9bf8('0x43')]));_0xd084e9[_0x9bf8('0x33')]=_0xd084e9[_0x9bf8('0x33')][_0x9bf8('0x34')]?_0xd084e9[_0x9bf8('0x33')]:_0x17e6f7[_0x9bf8('0x2f')];if(_0x4e980d[_0x9bf8('0x30')]['includeAll']){_0xd084e9[_0x9bf8('0x44')]=[{'all':!![]}];}_0xd084e9=_[_0x9bf8('0x3b')]({},_0xd084e9,_0x4e980d['options']);return db[_0x9bf8('0x2b')]['find'](_0xd084e9)[_0x9bf8('0x24')](handleEntityNotFound(_0x260377,null))[_0x9bf8('0x24')](respondWithResult(_0x260377,null))[_0x9bf8('0x40')](handleError(_0x260377,null));};exports[_0x9bf8('0x45')]=function(_0x342c27,_0x5e55a5){return db['FaxTransferReport']['create'](_0x342c27[_0x9bf8('0x46')],{})[_0x9bf8('0x24')](respondWithResult(_0x5e55a5,0xc9))['catch'](handleError(_0x5e55a5,null));};exports[_0x9bf8('0x23')]=function(_0x57d7c1,_0x4e8d0e){if(_0x57d7c1[_0x9bf8('0x46')]['id']){delete _0x57d7c1[_0x9bf8('0x46')]['id'];}return db[_0x9bf8('0x2b')][_0x9bf8('0x47')]({'where':{'id':_0x57d7c1['params']['id']}})[_0x9bf8('0x24')](handleEntityNotFound(_0x4e8d0e,null))['then'](saveUpdates(_0x57d7c1[_0x9bf8('0x46')],null))[_0x9bf8('0x24')](respondWithResult(_0x4e8d0e,null))[_0x9bf8('0x40')](handleError(_0x4e8d0e,null));};exports[_0x9bf8('0x25')]=function(_0x497b5c,_0x5c45f2){return db[_0x9bf8('0x2b')][_0x9bf8('0x47')]({'where':{'id':_0x497b5c['params']['id']}})[_0x9bf8('0x24')](handleEntityNotFound(_0x5c45f2,null))[_0x9bf8('0x24')](removeEntity(_0x5c45f2,null))['catch'](handleError(_0x5c45f2,null));};exports[_0x9bf8('0x48')]=function(_0x27f42f,_0x246d4b){return db[_0x9bf8('0x2b')][_0x9bf8('0x48')]()[_0x9bf8('0x24')](respondWithResult(_0x246d4b,null))[_0x9bf8('0x40')](handleError(_0x246d4b,null));}; \ No newline at end of file +var _0x6496=['FaxTransferReport','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','update','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','save','then','destroy','error','stack','name','index'];(function(_0x1855e1,_0x5054fb){var _0x2489b0=function(_0x30648e){while(--_0x30648e){_0x1855e1['push'](_0x1855e1['shift']());}};_0x2489b0(++_0x5054fb);}(_0x6496,0x152));var _0x6649=function(_0x3da7a1,_0x151473){_0x3da7a1=_0x3da7a1-0x0;var _0x3b7290=_0x6496[_0x3da7a1];return _0x3b7290;};'use strict';var emlformat=require(_0x6649('0x0'));var rimraf=require(_0x6649('0x1'));var zipdir=require(_0x6649('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6649('0x3'));var moment=require(_0x6649('0x4'));var BPromise=require(_0x6649('0x5'));var Mustache=require(_0x6649('0x6'));var util=require(_0x6649('0x7'));var path=require(_0x6649('0x8'));var sox=require(_0x6649('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6649('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6649('0xb'));var jsforce=require(_0x6649('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6649('0xd'));var querystring=require(_0x6649('0xe'));var Papa=require(_0x6649('0xf'));var Redis=require(_0x6649('0x10'));var authService=require(_0x6649('0x11'));var qs=require(_0x6649('0x12'));var as=require(_0x6649('0x13'));var hardwareService=require(_0x6649('0x14'));var logger=require(_0x6649('0x15'))(_0x6649('0x16'));var utils=require('../../config/utils');var config=require(_0x6649('0x17'));var licenseUtil=require(_0x6649('0x18'));var db=require(_0x6649('0x19'))['db'];function respondWithStatusCode(_0x40ab12,_0x210a5e){_0x210a5e=_0x210a5e||0xcc;return function(_0x4583a9){if(_0x4583a9){return _0x40ab12[_0x6649('0x1a')](_0x210a5e);}return _0x40ab12[_0x6649('0x1b')](_0x210a5e)[_0x6649('0x1c')]();};}function respondWithResult(_0x53c71a,_0x222051){_0x222051=_0x222051||0xc8;return function(_0x5e0772){if(_0x5e0772){return _0x53c71a[_0x6649('0x1b')](_0x222051)[_0x6649('0x1d')](_0x5e0772);}};}function respondWithFilteredResult(_0x278283,_0x160ec7){return function(_0x31709e){if(_0x31709e){var _0x1eb600=typeof _0x160ec7[_0x6649('0x1e')]==='undefined'&&typeof _0x160ec7[_0x6649('0x1f')]===_0x6649('0x20');var _0x4ecfd2=_0x31709e[_0x6649('0x21')];var _0x1c6593=_0x1eb600?0x0:_0x160ec7[_0x6649('0x1e')];var _0x52c79f=_0x1eb600?_0x31709e['count']:_0x160ec7[_0x6649('0x1e')]+_0x160ec7[_0x6649('0x1f')];var _0x4a1166;if(_0x52c79f>=_0x4ecfd2){_0x52c79f=_0x4ecfd2;_0x4a1166=0xc8;}else{_0x4a1166=0xce;}_0x278283[_0x6649('0x1b')](_0x4a1166);return _0x278283['set'](_0x6649('0x22'),_0x1c6593+'-'+_0x52c79f+'/'+_0x4ecfd2)[_0x6649('0x1d')](_0x31709e);}return null;};}function patchUpdates(_0x1626d3){return function(_0x2ae9a0){try{jsonpatch['apply'](_0x2ae9a0,_0x1626d3,!![]);}catch(_0xc1925d){return BPromise['reject'](_0xc1925d);}return _0x2ae9a0[_0x6649('0x23')]();};}function saveUpdates(_0x1078e3,_0x3d990a){return function(_0x3555ae){if(_0x3555ae){return _0x3555ae['update'](_0x1078e3)[_0x6649('0x24')](function(_0xa0f080){return _0xa0f080;});}return null;};}function removeEntity(_0x22b295,_0x739e48){return function(_0x22c42f){if(_0x22c42f){return _0x22c42f[_0x6649('0x25')]()[_0x6649('0x24')](function(){_0x22b295[_0x6649('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e06ce,_0x54387a){return function(_0x1895fe){if(!_0x1895fe){_0x3e06ce[_0x6649('0x1a')](0x194);}return _0x1895fe;};}function handleError(_0x417742,_0x572062){_0x572062=_0x572062||0x1f4;return function(_0x559d5c){logger[_0x6649('0x26')](_0x559d5c[_0x6649('0x27')]);if(_0x559d5c['name']){delete _0x559d5c[_0x6649('0x28')];}_0x417742[_0x6649('0x1b')](_0x572062)['send'](_0x559d5c);};}exports[_0x6649('0x29')]=function(_0x3b913e,_0x52b359){var _0x457f38={},_0x3f6382={},_0x43cdf8={'count':0x0,'rows':[]};var _0x3bfd96=_['map'](db[_0x6649('0x2a')][_0x6649('0x2b')],function(_0x3bb0d7){return{'name':_0x3bb0d7[_0x6649('0x2c')],'type':_0x3bb0d7['type']['key']};});_0x3f6382[_0x6649('0x2d')]=_[_0x6649('0x2e')](_0x3bfd96,_0x6649('0x28'));_0x3f6382[_0x6649('0x2f')]=_[_0x6649('0x30')](_0x3b913e['query']);_0x3f6382[_0x6649('0x31')]=_[_0x6649('0x32')](_0x3f6382[_0x6649('0x2d')],_0x3f6382[_0x6649('0x2f')]);_0x457f38[_0x6649('0x33')]=_[_0x6649('0x32')](_0x3f6382['model'],qs['fields'](_0x3b913e[_0x6649('0x2f')][_0x6649('0x34')]));_0x457f38[_0x6649('0x33')]=_0x457f38[_0x6649('0x33')][_0x6649('0x35')]?_0x457f38[_0x6649('0x33')]:_0x3f6382[_0x6649('0x2d')];if(!_0x3b913e['query'][_0x6649('0x36')](_0x6649('0x37'))){_0x457f38[_0x6649('0x1f')]=qs[_0x6649('0x1f')](_0x3b913e[_0x6649('0x2f')][_0x6649('0x1f')]);_0x457f38['offset']=qs['offset'](_0x3b913e[_0x6649('0x2f')][_0x6649('0x1e')]);}_0x457f38['order']=qs[_0x6649('0x38')](_0x3b913e[_0x6649('0x2f')][_0x6649('0x38')]);_0x457f38['where']=qs[_0x6649('0x31')](_[_0x6649('0x39')](_0x3b913e[_0x6649('0x2f')],_0x3f6382[_0x6649('0x31')]),_0x3bfd96);if(_0x3b913e[_0x6649('0x2f')][_0x6649('0x3a')]){_0x457f38[_0x6649('0x3b')]=_[_0x6649('0x3c')](_0x457f38[_0x6649('0x3b')],{'$or':_[_0x6649('0x2e')](_0x3bfd96,function(_0x46f8f0){if(_0x46f8f0[_0x6649('0x3d')]!==_0x6649('0x3e')){var _0x2d1c16={};_0x2d1c16[_0x46f8f0[_0x6649('0x28')]]={'$like':'%'+_0x3b913e[_0x6649('0x2f')][_0x6649('0x3a')]+'%'};return _0x2d1c16;}})});}_0x457f38=_[_0x6649('0x3c')]({},_0x457f38,_0x3b913e[_0x6649('0x3f')]);var _0x2ed32c={'where':_0x457f38['where']};return db['FaxTransferReport'][_0x6649('0x21')](_0x2ed32c)[_0x6649('0x24')](function(_0x129342){_0x43cdf8[_0x6649('0x21')]=_0x129342;if(_0x3b913e[_0x6649('0x2f')][_0x6649('0x40')]){_0x457f38[_0x6649('0x41')]=[{'all':!![]}];}return db[_0x6649('0x2a')][_0x6649('0x42')](_0x457f38);})[_0x6649('0x24')](function(_0x13318d){_0x43cdf8[_0x6649('0x43')]=_0x13318d;return _0x43cdf8;})['then'](respondWithFilteredResult(_0x52b359,_0x457f38))[_0x6649('0x44')](handleError(_0x52b359,null));};exports[_0x6649('0x45')]=function(_0x53ff91,_0x2cc7a6){var _0x1e9f40={'raw':!![],'where':{'id':_0x53ff91[_0x6649('0x46')]['id']}},_0x2256dc={};_0x2256dc[_0x6649('0x2d')]=_['keys'](db['FaxTransferReport']['rawAttributes']);_0x2256dc[_0x6649('0x2f')]=_[_0x6649('0x30')](_0x53ff91[_0x6649('0x2f')]);_0x2256dc[_0x6649('0x31')]=_[_0x6649('0x32')](_0x2256dc[_0x6649('0x2d')],_0x2256dc['query']);_0x1e9f40[_0x6649('0x33')]=_['intersection'](_0x2256dc['model'],qs[_0x6649('0x34')](_0x53ff91[_0x6649('0x2f')][_0x6649('0x34')]));_0x1e9f40[_0x6649('0x33')]=_0x1e9f40[_0x6649('0x33')][_0x6649('0x35')]?_0x1e9f40['attributes']:_0x2256dc[_0x6649('0x2d')];if(_0x53ff91[_0x6649('0x2f')][_0x6649('0x40')]){_0x1e9f40['include']=[{'all':!![]}];}_0x1e9f40=_[_0x6649('0x3c')]({},_0x1e9f40,_0x53ff91['options']);return db[_0x6649('0x2a')]['find'](_0x1e9f40)[_0x6649('0x24')](handleEntityNotFound(_0x2cc7a6,null))[_0x6649('0x24')](respondWithResult(_0x2cc7a6,null))[_0x6649('0x44')](handleError(_0x2cc7a6,null));};exports[_0x6649('0x47')]=function(_0x1c4640,_0x15f86a){return db[_0x6649('0x2a')]['create'](_0x1c4640['body'],{})[_0x6649('0x24')](respondWithResult(_0x15f86a,0xc9))[_0x6649('0x44')](handleError(_0x15f86a,null));};exports[_0x6649('0x48')]=function(_0x182c70,_0x376890){if(_0x182c70[_0x6649('0x49')]['id']){delete _0x182c70[_0x6649('0x49')]['id'];}return db[_0x6649('0x2a')][_0x6649('0x4a')]({'where':{'id':_0x182c70['params']['id']}})['then'](handleEntityNotFound(_0x376890,null))['then'](saveUpdates(_0x182c70['body'],null))['then'](respondWithResult(_0x376890,null))[_0x6649('0x44')](handleError(_0x376890,null));};exports[_0x6649('0x25')]=function(_0x38430f,_0x1a79ca){return db[_0x6649('0x2a')][_0x6649('0x4a')]({'where':{'id':_0x38430f[_0x6649('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a79ca,null))[_0x6649('0x24')](removeEntity(_0x1a79ca,null))[_0x6649('0x44')](handleError(_0x1a79ca,null));};exports[_0x6649('0x4b')]=function(_0x3e9e3f,_0x4d3bc8){return db['FaxTransferReport']['describe']()[_0x6649('0x24')](respondWithResult(_0x4d3bc8,null))[_0x6649('0x44')](handleError(_0x4d3bc8,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index c7d43dc..809d77c 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 _0x5f5f=['./faxTransferReport.attributes','exports','define','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2afee6,_0x5247f3){var _0xc53396=function(_0x1e418f){while(--_0x1e418f){_0x2afee6['push'](_0x2afee6['shift']());}};_0xc53396(++_0x5247f3);}(_0x5f5f,0x178));var _0xf5f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf5f5('0x0'));var util=require('util');var logger=require(_0xf5f5('0x1'))(_0xf5f5('0x2'));var moment=require(_0xf5f5('0x3'));var BPromise=require('bluebird');var rp=require(_0xf5f5('0x4'));var fs=require('fs');var path=require(_0xf5f5('0x5'));var rimraf=require(_0xf5f5('0x6'));var config=require(_0xf5f5('0x7'));var attributes=require(_0xf5f5('0x8'));module[_0xf5f5('0x9')]=function(_0x28fc98,_0xb6003b){return _0x28fc98[_0xf5f5('0xa')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xf5f5('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6df1=['path','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2c2d02,_0x516d6b){var _0x4ed1d7=function(_0x4b126f){while(--_0x4b126f){_0x2c2d02['push'](_0x2c2d02['shift']());}};_0x4ed1d7(++_0x516d6b);}(_0x6df1,0x1e8));var _0x16df=function(_0x5355b3,_0x2f1e18){_0x5355b3=_0x5355b3-0x0;var _0x1dbf46=_0x6df1[_0x5355b3];return _0x1dbf46;};'use strict';var _=require('lodash');var util=require(_0x16df('0x0'));var logger=require(_0x16df('0x1'))(_0x16df('0x2'));var moment=require(_0x16df('0x3'));var BPromise=require(_0x16df('0x4'));var rp=require(_0x16df('0x5'));var fs=require('fs');var path=require(_0x16df('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x16df('0x7'));module[_0x16df('0x8')]=function(_0x1f9b93,_0x4d9218){return _0x1f9b93[_0x16df('0x9')](_0x16df('0xa'),attributes,{'tableName':_0x16df('0xb'),'paranoid':![],'indexes':[{'name':_0x16df('0xc'),'fields':[_0x16df('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index f34871d..4e4daf1 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 _0xfc0a=['error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5c4f6b,_0x2cdfce){var _0x104c4e=function(_0x31171b){while(--_0x31171b){_0x5c4f6b['push'](_0x5c4f6b['shift']());}};_0x104c4e(++_0x2cdfce);}(_0xfc0a,0x18f));var _0xafc0=function(_0x16d167,_0x5352ec){_0x16d167=_0x16d167-0x0;var _0x54f7fb=_0xfc0a[_0x16d167];return _0x54f7fb;};'use strict';var _=require(_0xafc0('0x0'));var util=require(_0xafc0('0x1'));var moment=require('moment');var BPromise=require(_0xafc0('0x2'));var rs=require(_0xafc0('0x3'));var fs=require('fs');var Redis=require(_0xafc0('0x4'));var db=require(_0xafc0('0x5'))['db'];var utils=require(_0xafc0('0x6'));var logger=require('../../config/logger')(_0xafc0('0x7'));var config=require(_0xafc0('0x8'));var jayson=require(_0xafc0('0x9'));var client=jayson[_0xafc0('0xa')][_0xafc0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194710,_0x1607cb,_0x2de0d7){return new BPromise(function(_0x1392cf,_0x11aabb){return client[_0xafc0('0xc')](_0x194710,_0x2de0d7)[_0xafc0('0xd')](function(_0x1e7d7a){logger[_0xafc0('0xe')](_0xafc0('0xf'),_0x1607cb,_0xafc0('0x10'));logger['debug'](_0xafc0('0x11'),_0x1607cb,_0xafc0('0x10'),JSON[_0xafc0('0x12')](_0x1e7d7a));if(_0x1e7d7a[_0xafc0('0x13')]){if(_0x1e7d7a[_0xafc0('0x13')][_0xafc0('0x14')]===0x1f4){logger[_0xafc0('0x13')](_0xafc0('0xf'),_0x1607cb,_0x1e7d7a[_0xafc0('0x13')][_0xafc0('0x15')]);return _0x11aabb(_0x1e7d7a['error'][_0xafc0('0x15')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x1607cb,_0x1e7d7a[_0xafc0('0x13')][_0xafc0('0x15')]);return _0x1392cf(_0x1e7d7a[_0xafc0('0x13')][_0xafc0('0x15')]);}else{logger[_0xafc0('0xe')](_0xafc0('0xf'),_0x1607cb,_0xafc0('0x10'));_0x1392cf(_0x1e7d7a['result']['message']);}})['catch'](function(_0x39e5f9){logger['error'](_0xafc0('0xf'),_0x1607cb,_0x39e5f9);_0x11aabb(_0x39e5f9);});});} \ No newline at end of file +var _0xa5ae=['request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http'];(function(_0x4e42e3,_0x48a19b){var _0x1ec072=function(_0x4a8c70){while(--_0x4a8c70){_0x4e42e3['push'](_0x4e42e3['shift']());}};_0x1ec072(++_0x48a19b);}(_0xa5ae,0xe8));var _0xea5a=function(_0x5b7696,_0x3ebd92){_0x5b7696=_0x5b7696-0x0;var _0x42d7b9=_0xa5ae[_0x5b7696];return _0x42d7b9;};'use strict';var _=require(_0xea5a('0x0'));var util=require(_0xea5a('0x1'));var moment=require(_0xea5a('0x2'));var BPromise=require('bluebird');var rs=require(_0xea5a('0x3'));var fs=require('fs');var Redis=require(_0xea5a('0x4'));var db=require(_0xea5a('0x5'))['db'];var utils=require(_0xea5a('0x6'));var logger=require('../../config/logger')(_0xea5a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xea5a('0x8')][_0xea5a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1cc326,_0x6ea701,_0x972582){return new BPromise(function(_0x40a3a2,_0x3f8e1a){return client[_0xea5a('0xa')](_0x1cc326,_0x972582)[_0xea5a('0xb')](function(_0x323c56){logger[_0xea5a('0xc')](_0xea5a('0xd'),_0x6ea701,_0xea5a('0xe'));logger[_0xea5a('0xf')](_0xea5a('0x10'),_0x6ea701,'request\x20sent',JSON['stringify'](_0x323c56));if(_0x323c56['error']){if(_0x323c56['error'][_0xea5a('0x11')]===0x1f4){logger[_0xea5a('0x12')](_0xea5a('0xd'),_0x6ea701,_0x323c56[_0xea5a('0x12')][_0xea5a('0x13')]);return _0x3f8e1a(_0x323c56['error']['message']);}logger[_0xea5a('0x12')](_0xea5a('0xd'),_0x6ea701,_0x323c56[_0xea5a('0x12')][_0xea5a('0x13')]);return _0x40a3a2(_0x323c56['error'][_0xea5a('0x13')]);}else{logger[_0xea5a('0xc')](_0xea5a('0xd'),_0x6ea701,_0xea5a('0xe'));_0x40a3a2(_0x323c56[_0xea5a('0x14')][_0xea5a('0x13')]);}})[_0xea5a('0x15')](function(_0x376ca3){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x6ea701,_0x376ca3);_0x3f8e1a(_0x376ca3);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 9419ef9..48a3f1e 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 _0x5dc7=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update'];(function(_0x52bf3e,_0x2af0f9){var _0x21d6da=function(_0x4b87c9){while(--_0x4b87c9){_0x52bf3e['push'](_0x52bf3e['shift']());}};_0x21d6da(++_0x2af0f9);}(_0x5dc7,0x1a6));var _0x75dc=function(_0x4ca08b,_0x453114){_0x4ca08b=_0x4ca08b-0x0;var _0x4108e8=_0x5dc7[_0x4ca08b];return _0x4108e8;};'use strict';var multer=require(_0x75dc('0x0'));var util=require(_0x75dc('0x1'));var path=require(_0x75dc('0x2'));var timeout=require('connect-timeout');var express=require(_0x75dc('0x3'));var router=express[_0x75dc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x75dc('0x5'));var interaction=require(_0x75dc('0x6'));var config=require(_0x75dc('0x7'));var controller=require(_0x75dc('0x8'));router['get']('/',auth[_0x75dc('0x9')](),controller[_0x75dc('0xa')]);router[_0x75dc('0xb')](_0x75dc('0xc'),auth['isAuthenticated'](),controller[_0x75dc('0xd')]);router[_0x75dc('0xb')](_0x75dc('0xe'),auth[_0x75dc('0x9')](),controller[_0x75dc('0xf')]);router[_0x75dc('0x10')]('/',auth[_0x75dc('0x9')](),controller[_0x75dc('0x11')]);router['put'](_0x75dc('0xe'),auth['isAuthenticated'](),controller[_0x75dc('0x12')]);router['delete'](_0x75dc('0xe'),auth[_0x75dc('0x9')](),controller[_0x75dc('0x13')]);module[_0x75dc('0x14')]=router; \ No newline at end of file +var _0xd359=['put','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','show','post'];(function(_0x47541e,_0x30ddbd){var _0x301523=function(_0x4bc7d0){while(--_0x4bc7d0){_0x47541e['push'](_0x47541e['shift']());}};_0x301523(++_0x30ddbd);}(_0xd359,0xae));var _0x9d35=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd359[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9d35('0x0'));var timeout=require('connect-timeout');var express=require(_0x9d35('0x1'));var router=express[_0x9d35('0x2')]();var fs_extra=require(_0x9d35('0x3'));var auth=require(_0x9d35('0x4'));var interaction=require(_0x9d35('0x5'));var config=require(_0x9d35('0x6'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0x9d35('0x7')](),controller['index']);router[_0x9d35('0x8')](_0x9d35('0x9'),auth[_0x9d35('0x7')](),controller['describe']);router[_0x9d35('0x8')](_0x9d35('0xa'),auth[_0x9d35('0x7')](),controller[_0x9d35('0xb')]);router[_0x9d35('0xc')]('/',auth[_0x9d35('0x7')](),controller['create']);router[_0x9d35('0xd')]('/:id',auth[_0x9d35('0x7')](),controller['update']);router[_0x9d35('0xe')](_0x9d35('0xa'),auth[_0x9d35('0x7')](),controller[_0x9d35('0xf')]);module[_0x9d35('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 404acca..ae59237 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 _0x4a84=['../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5a853d,_0xa65917){var _0x3776aa=function(_0x392837){while(--_0x392837){_0x5a853d['push'](_0x5a853d['shift']());}};_0x3776aa(++_0xa65917);}(_0x4a84,0x151));var _0x44a8=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4a84[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x44a8('0x0'));var util=require(_0x44a8('0x1'));var path=require(_0x44a8('0x2'));var timeout=require('connect-timeout');var express=require(_0x44a8('0x3'));var router=express[_0x44a8('0x4')]();var fs_extra=require(_0x44a8('0x5'));var auth=require(_0x44a8('0x6'));var interaction=require(_0x44a8('0x7'));var config=require(_0x44a8('0x8'));var controller=require(_0x44a8('0x9'));router[_0x44a8('0xa')]('/',auth[_0x44a8('0xb')](),controller[_0x44a8('0xc')]);router[_0x44a8('0xa')](_0x44a8('0xd'),auth[_0x44a8('0xb')](),controller[_0x44a8('0xe')]);router[_0x44a8('0xa')](_0x44a8('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x44a8('0xa')](_0x44a8('0x10'),auth[_0x44a8('0xb')](),controller['getFields']);router[_0x44a8('0x11')]('/',auth['isAuthenticated'](),controller[_0x44a8('0x12')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x44a8('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x44a8('0x14')]);router['delete']('/:id',auth[_0x44a8('0xb')](),controller[_0x44a8('0x15')]);module[_0x44a8('0x16')]=router; \ No newline at end of file +var _0xec63=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','get','/:id','show','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','util','path','Router','fs-extra'];(function(_0x5d81cd,_0x626aab){var _0x153343=function(_0x25d36e){while(--_0x25d36e){_0x5d81cd['push'](_0x5d81cd['shift']());}};_0x153343(++_0x626aab);}(_0xec63,0x96));var _0x3ec6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xec63[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x3ec6('0x0'));var path=require(_0x3ec6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3ec6('0x2')]();var fs_extra=require(_0x3ec6('0x3'));var auth=require(_0x3ec6('0x4'));var interaction=require(_0x3ec6('0x5'));var config=require(_0x3ec6('0x6'));var controller=require(_0x3ec6('0x7'));router['get']('/',auth[_0x3ec6('0x8')](),controller['index']);router[_0x3ec6('0x9')](_0x3ec6('0xa'),auth[_0x3ec6('0x8')](),controller[_0x3ec6('0xb')]);router[_0x3ec6('0x9')]('/:id/configurations',auth[_0x3ec6('0x8')](),controller['getConfigurations']);router['get'](_0x3ec6('0xc'),auth['isAuthenticated'](),controller[_0x3ec6('0xd')]);router[_0x3ec6('0xe')]('/',auth[_0x3ec6('0x8')](),controller['create']);router[_0x3ec6('0xe')](_0x3ec6('0xf'),auth[_0x3ec6('0x8')](),controller[_0x3ec6('0x10')]);router[_0x3ec6('0x11')](_0x3ec6('0xa'),auth[_0x3ec6('0x8')](),controller[_0x3ec6('0x12')]);router[_0x3ec6('0x13')](_0x3ec6('0xa'),auth[_0x3ec6('0x8')](),controller[_0x3ec6('0x14')]);module[_0x3ec6('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 414d09d..17008a7 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 _0x7821=['newTab','sequelize','exports','STRING','ENUM','integrationTab'];(function(_0x3c95e5,_0x31bfb7){var _0x161528=function(_0xa5b05b){while(--_0xa5b05b){_0x3c95e5['push'](_0x3c95e5['shift']());}};_0x161528(++_0x31bfb7);}(_0x7821,0x127));var _0x1782=function(_0x245e2d,_0x1515a6){_0x245e2d=_0x245e2d-0x0;var _0x2d1b6f=_0x7821[_0x245e2d];return _0x2d1b6f;};'use strict';var Sequelize=require(_0x1782('0x0'));module[_0x1782('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1782('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1782('0x2')]},'authType':{'type':Sequelize[_0x1782('0x3')]('basic'),'defaultValue':'basic'},'password':{'type':Sequelize[_0x1782('0x2')]},'consumerKey':{'type':Sequelize[_0x1782('0x2')]},'consumerSecret':{'type':Sequelize[_0x1782('0x2')]},'token':{'type':Sequelize[_0x1782('0x2')]},'tokenSecret':{'type':Sequelize[_0x1782('0x2')]},'serverUrl':{'type':Sequelize[_0x1782('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1782('0x4'),_0x1782('0x5')),'defaultValue':_0x1782('0x4')}}; \ No newline at end of file +var _0x2eaf=['sequelize','exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x3f16a9,_0x5020a7){var _0x3cbf92=function(_0x49b2bc){while(--_0x49b2bc){_0x3f16a9['push'](_0x3f16a9['shift']());}};_0x3cbf92(++_0x5020a7);}(_0x2eaf,0x1c7));var _0xf2ea=function(_0x10221b,_0x4202b8){_0x10221b=_0x10221b-0x0;var _0x40e259=_0x2eaf[_0x10221b];return _0x40e259;};'use strict';var Sequelize=require(_0xf2ea('0x0'));module[_0xf2ea('0x1')]={'name':{'type':Sequelize[_0xf2ea('0x2')]},'description':{'type':Sequelize[_0xf2ea('0x2')]},'username':{'type':Sequelize[_0xf2ea('0x2')]},'remoteUri':{'type':Sequelize[_0xf2ea('0x2')]},'authType':{'type':Sequelize[_0xf2ea('0x3')]('basic'),'defaultValue':_0xf2ea('0x4')},'password':{'type':Sequelize[_0xf2ea('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xf2ea('0x2')]},'token':{'type':Sequelize[_0xf2ea('0x2')]},'tokenSecret':{'type':Sequelize[_0xf2ea('0x2')]},'serverUrl':{'type':Sequelize[_0xf2ea('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf2ea('0x3')](_0xf2ea('0x5'),_0xf2ea('0x6')),'defaultValue':_0xf2ea('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 44437bf..e8123de 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 _0x1db3=['sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','then','error','stack','send','index','map','DeskAccount','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','include','find','body','update','params','destroy','getConfigurations','findOne','DeskConfiguration','rawAttributes','addConfiguration','AccountId','getSubjects','channel','create','DeskField','Subjects','Descriptions','getFields','priority','authType','username','password','consumerKey','token','tokenSecret','substring','GET','%s/custom_fields','application/json','headers','Authorization','format','%s:%s','toString','base64','concat','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x4baab7,_0x5503a8){var _0x5e8039=function(_0x4fb23f){while(--_0x4fb23f){_0x4baab7['push'](_0x4baab7['shift']());}};_0x5e8039(++_0x5503a8);}(_0x1db3,0xd6));var _0x31db=function(_0x3f156,_0x18d9da){_0x3f156=_0x3f156-0x0;var _0x53ce60=_0x1db3[_0x3f156];return _0x53ce60;};'use strict';var emlformat=require(_0x31db('0x0'));var rimraf=require(_0x31db('0x1'));var zipdir=require(_0x31db('0x2'));var jsonpatch=require(_0x31db('0x3'));var rp=require(_0x31db('0x4'));var moment=require(_0x31db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x31db('0x6'));var util=require(_0x31db('0x7'));var path=require('path');var sox=require(_0x31db('0x8'));var csv=require(_0x31db('0x9'));var ejs=require(_0x31db('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x31db('0xb'));var crypto=require(_0x31db('0xc'));var jsforce=require(_0x31db('0xd'));var deskjs=require(_0x31db('0xe'));var toCsv=require(_0x31db('0x9'));var querystring=require(_0x31db('0xf'));var Papa=require(_0x31db('0x10'));var Redis=require(_0x31db('0x11'));var authService=require(_0x31db('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x31db('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x31db('0x14'));var utils=require(_0x31db('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x31db('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x31db('0x17'));function respondWithStatusCode(_0xf19f02,_0x5ae022){_0x5ae022=_0x5ae022||0xcc;return function(_0x486afc){if(_0x486afc){return _0xf19f02[_0x31db('0x18')](_0x5ae022);}return _0xf19f02['status'](_0x5ae022)[_0x31db('0x19')]();};}function respondWithResult(_0x538ed2,_0x2a170b){_0x2a170b=_0x2a170b||0xc8;return function(_0xded4db){if(_0xded4db){return _0x538ed2['status'](_0x2a170b)['json'](_0xded4db);}};}function respondWithFilteredResult(_0x4eff6c,_0x497662){return function(_0x140328){if(_0x140328){var _0x4b772d=typeof _0x497662[_0x31db('0x1a')]===_0x31db('0x1b')&&typeof _0x497662[_0x31db('0x1c')]==='undefined';var _0x5dbaac=_0x140328[_0x31db('0x1d')];var _0x2778aa=_0x4b772d?0x0:_0x497662[_0x31db('0x1a')];var _0x2760a4=_0x4b772d?_0x140328[_0x31db('0x1d')]:_0x497662['offset']+_0x497662[_0x31db('0x1c')];var _0x158034;if(_0x2760a4>=_0x5dbaac){_0x2760a4=_0x5dbaac;_0x158034=0xc8;}else{_0x158034=0xce;}_0x4eff6c[_0x31db('0x1e')](_0x158034);return _0x4eff6c[_0x31db('0x1f')](_0x31db('0x20'),_0x2778aa+'-'+_0x2760a4+'/'+_0x5dbaac)[_0x31db('0x21')](_0x140328);}return null;};}function patchUpdates(_0x1cc48a){return function(_0x1f019f){try{jsonpatch[_0x31db('0x22')](_0x1f019f,_0x1cc48a,!![]);}catch(_0x5841a6){return BPromise[_0x31db('0x23')](_0x5841a6);}return _0x1f019f[_0x31db('0x24')]();};}function saveUpdates(_0x4b8194,_0x49fc28){return function(_0x4c1219){if(_0x4c1219){return _0x4c1219['update'](_0x4b8194)['then'](function(_0xa2e7a0){return _0xa2e7a0;});}return null;};}function removeEntity(_0x2cb708,_0x1e8084){return function(_0x17b7a4){if(_0x17b7a4){return _0x17b7a4['destroy']()[_0x31db('0x25')](function(){_0x2cb708[_0x31db('0x1e')](0xcc)[_0x31db('0x19')]();});}};}function handleEntityNotFound(_0x429b9f,_0x172158){return function(_0x11209a){if(!_0x11209a){_0x429b9f['sendStatus'](0x194);}return _0x11209a;};}function handleError(_0x2f49fe,_0x6cd86f){_0x6cd86f=_0x6cd86f||0x1f4;return function(_0x261fcc){logger[_0x31db('0x26')](_0x261fcc[_0x31db('0x27')]);if(_0x261fcc['name']){delete _0x261fcc['name'];}_0x2f49fe[_0x31db('0x1e')](_0x6cd86f)[_0x31db('0x28')](_0x261fcc);};}exports[_0x31db('0x29')]=function(_0x420272,_0x371638){var _0x4de25c={},_0x32c0fb={},_0x41a2bb={'count':0x0,'rows':[]};var _0x20024d=_[_0x31db('0x2a')](db[_0x31db('0x2b')]['rawAttributes'],function(_0x599032){return{'name':_0x599032['fieldName'],'type':_0x599032[_0x31db('0x2c')]['key']};});_0x32c0fb[_0x31db('0x2d')]=_[_0x31db('0x2a')](_0x20024d,_0x31db('0x2e'));_0x32c0fb[_0x31db('0x2f')]=_[_0x31db('0x30')](_0x420272[_0x31db('0x2f')]);_0x32c0fb[_0x31db('0x31')]=_[_0x31db('0x32')](_0x32c0fb[_0x31db('0x2d')],_0x32c0fb[_0x31db('0x2f')]);_0x4de25c[_0x31db('0x33')]=_[_0x31db('0x32')](_0x32c0fb['model'],qs[_0x31db('0x34')](_0x420272[_0x31db('0x2f')]['fields']));_0x4de25c[_0x31db('0x33')]=_0x4de25c[_0x31db('0x33')][_0x31db('0x35')]?_0x4de25c['attributes']:_0x32c0fb['model'];if(!_0x420272[_0x31db('0x2f')][_0x31db('0x36')](_0x31db('0x37'))){_0x4de25c[_0x31db('0x1c')]=qs[_0x31db('0x1c')](_0x420272[_0x31db('0x2f')]['limit']);_0x4de25c[_0x31db('0x1a')]=qs[_0x31db('0x1a')](_0x420272[_0x31db('0x2f')][_0x31db('0x1a')]);}_0x4de25c[_0x31db('0x38')]=qs[_0x31db('0x39')](_0x420272['query'][_0x31db('0x39')]);_0x4de25c[_0x31db('0x3a')]=qs[_0x31db('0x31')](_[_0x31db('0x3b')](_0x420272[_0x31db('0x2f')],_0x32c0fb[_0x31db('0x31')]),_0x20024d);if(_0x420272['query'][_0x31db('0x3c')]){_0x4de25c['where']=_[_0x31db('0x3d')](_0x4de25c[_0x31db('0x3a')],{'$or':_[_0x31db('0x2a')](_0x20024d,function(_0x595c53){if(_0x595c53[_0x31db('0x2c')]!=='VIRTUAL'){var _0x273ff9={};_0x273ff9[_0x595c53[_0x31db('0x2e')]]={'$like':'%'+_0x420272[_0x31db('0x2f')]['filter']+'%'};return _0x273ff9;}})});}_0x4de25c=_['merge']({},_0x4de25c,_0x420272[_0x31db('0x3e')]);var _0x4c200a={'where':_0x4de25c[_0x31db('0x3a')]};return db[_0x31db('0x2b')]['count'](_0x4c200a)['then'](function(_0x456d3e){_0x41a2bb['count']=_0x456d3e;if(_0x420272[_0x31db('0x2f')][_0x31db('0x3f')]){_0x4de25c['include']=[{'all':!![]}];}return db[_0x31db('0x2b')][_0x31db('0x40')](_0x4de25c);})[_0x31db('0x25')](function(_0x5ec22){_0x41a2bb['rows']=_0x5ec22;return _0x41a2bb;})[_0x31db('0x25')](respondWithFilteredResult(_0x371638,_0x4de25c))[_0x31db('0x41')](handleError(_0x371638,null));};exports[_0x31db('0x42')]=function(_0xb1f04a,_0x4f667d){var _0x50253c={'raw':![],'where':{'id':_0xb1f04a['params']['id']}},_0x4c71e4={};_0x4c71e4[_0x31db('0x2d')]=_['keys'](db['DeskAccount']['rawAttributes']);_0x4c71e4['query']=_[_0x31db('0x30')](_0xb1f04a['query']);_0x4c71e4[_0x31db('0x31')]=_[_0x31db('0x32')](_0x4c71e4[_0x31db('0x2d')],_0x4c71e4['query']);_0x50253c[_0x31db('0x33')]=_['intersection'](_0x4c71e4[_0x31db('0x2d')],qs[_0x31db('0x34')](_0xb1f04a[_0x31db('0x2f')][_0x31db('0x34')]));_0x50253c[_0x31db('0x33')]=_0x50253c[_0x31db('0x33')][_0x31db('0x35')]?_0x50253c[_0x31db('0x33')]:_0x4c71e4['model'];if(_0xb1f04a['query'][_0x31db('0x3f')]){_0x50253c[_0x31db('0x43')]=[{'all':!![]}];}_0x50253c=_[_0x31db('0x3d')]({},_0x50253c,_0xb1f04a[_0x31db('0x3e')]);return db[_0x31db('0x2b')][_0x31db('0x44')](_0x50253c)[_0x31db('0x25')](handleEntityNotFound(_0x4f667d,null))[_0x31db('0x25')](respondWithResult(_0x4f667d,null))[_0x31db('0x41')](handleError(_0x4f667d,null));};exports['create']=function(_0x4b471c,_0x4f66cc){return db[_0x31db('0x2b')]['create'](_0x4b471c[_0x31db('0x45')],{})[_0x31db('0x25')](respondWithResult(_0x4f66cc,0xc9))[_0x31db('0x41')](handleError(_0x4f66cc,null));};exports[_0x31db('0x46')]=function(_0x256c67,_0x5f2bd1){if(_0x256c67[_0x31db('0x45')]['id']){delete _0x256c67[_0x31db('0x45')]['id'];}return db[_0x31db('0x2b')][_0x31db('0x44')]({'where':{'id':_0x256c67[_0x31db('0x47')]['id']}})[_0x31db('0x25')](handleEntityNotFound(_0x5f2bd1,null))[_0x31db('0x25')](saveUpdates(_0x256c67['body'],null))[_0x31db('0x25')](respondWithResult(_0x5f2bd1,null))[_0x31db('0x41')](handleError(_0x5f2bd1,null));};exports[_0x31db('0x48')]=function(_0x1fe3da,_0x28d1cc){return db['DeskAccount'][_0x31db('0x44')]({'where':{'id':_0x1fe3da[_0x31db('0x47')]['id']}})['then'](handleEntityNotFound(_0x28d1cc,null))[_0x31db('0x25')](removeEntity(_0x28d1cc,null))[_0x31db('0x41')](handleError(_0x28d1cc,null));};exports[_0x31db('0x49')]=function(_0x31f75f,_0x22f76c,_0x18635a){var _0x4a9f3a={};var _0x1d5254={};var _0x4ab864;var _0x43484a;return db[_0x31db('0x2b')][_0x31db('0x4a')]({'where':{'id':_0x31f75f[_0x31db('0x47')]['id']}})['then'](handleEntityNotFound(_0x22f76c,null))[_0x31db('0x25')](function(_0x12f1cd){if(_0x12f1cd){_0x4ab864=_0x12f1cd;_0x1d5254[_0x31db('0x2d')]=_['keys'](db[_0x31db('0x4b')][_0x31db('0x4c')]);_0x1d5254['query']=_[_0x31db('0x30')](_0x31f75f[_0x31db('0x2f')]);_0x1d5254[_0x31db('0x31')]=_[_0x31db('0x32')](_0x1d5254[_0x31db('0x2d')],_0x1d5254['query']);_0x4a9f3a['attributes']=_['intersection'](_0x1d5254[_0x31db('0x2d')],qs[_0x31db('0x34')](_0x31f75f[_0x31db('0x2f')][_0x31db('0x34')]));_0x4a9f3a[_0x31db('0x33')]=_0x4a9f3a['attributes']['length']?_0x4a9f3a[_0x31db('0x33')]:_0x1d5254[_0x31db('0x2d')];_0x4a9f3a[_0x31db('0x38')]=qs[_0x31db('0x39')](_0x31f75f[_0x31db('0x2f')][_0x31db('0x39')]);_0x4a9f3a[_0x31db('0x3a')]=qs[_0x31db('0x31')](_['pick'](_0x31f75f['query'],_0x1d5254['filters']));if(_0x31f75f[_0x31db('0x2f')][_0x31db('0x3c')]){_0x4a9f3a['where']=_[_0x31db('0x3d')](_0x4a9f3a['where'],{'$or':_['map'](_0x4a9f3a[_0x31db('0x33')],function(_0x4c9a09){var _0x31a15a={};_0x31a15a[_0x4c9a09]={'$like':'%'+_0x31f75f[_0x31db('0x2f')][_0x31db('0x3c')]+'%'};return _0x31a15a;})});}_0x4a9f3a=_[_0x31db('0x3d')]({},_0x4a9f3a,_0x31f75f['options']);return _0x4ab864[_0x31db('0x49')](_0x4a9f3a);}})[_0x31db('0x25')](function(_0x16c1eb){if(_0x16c1eb){_0x43484a=_0x16c1eb[_0x31db('0x35')];if(!_0x31f75f['query']['hasOwnProperty'](_0x31db('0x37'))){_0x4a9f3a[_0x31db('0x1c')]=qs['limit'](_0x31f75f['query'][_0x31db('0x1c')]);_0x4a9f3a[_0x31db('0x1a')]=qs[_0x31db('0x1a')](_0x31f75f[_0x31db('0x2f')][_0x31db('0x1a')]);}return _0x4ab864[_0x31db('0x49')](_0x4a9f3a);}})[_0x31db('0x25')](function(_0x3f4fbd){if(_0x3f4fbd){return _0x3f4fbd?{'count':_0x43484a,'rows':_0x3f4fbd}:null;}})[_0x31db('0x25')](respondWithResult(_0x22f76c,null))[_0x31db('0x41')](handleError(_0x22f76c,null));};exports[_0x31db('0x4d')]=function(_0x22025f,_0x34cde9,_0x36166f){if(_0x22025f[_0x31db('0x45')]['id']){delete _0x22025f['body']['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x22025f[_0x31db('0x47')]['id']}})[_0x31db('0x25')](handleEntityNotFound(_0x34cde9,null))['then'](function(_0x13a263){if(_0x13a263){_0x22025f[_0x31db('0x45')][_0x31db('0x4e')]=_0x13a263['id'];_0x22025f['body']['Subjects']=integrations[_0x31db('0x4f')](_0x22025f['body'][_0x31db('0x50')],_0x22025f[_0x31db('0x45')][_0x31db('0x2c')]);_0x22025f['body']['Descriptions']=integrations['getDescriptions'](_0x22025f[_0x31db('0x45')][_0x31db('0x50')],_0x22025f[_0x31db('0x45')][_0x31db('0x2c')]);return db[_0x31db('0x4b')][_0x31db('0x51')](_0x22025f[_0x31db('0x45')],{'include':[{'model':db[_0x31db('0x52')],'as':_0x31db('0x53')},{'model':db[_0x31db('0x52')],'as':_0x31db('0x54')}]});}return null;})[_0x31db('0x25')](respondWithResult(_0x34cde9,null))[_0x31db('0x41')](handleError(_0x34cde9,null));};exports[_0x31db('0x55')]=function(_0x94e18f,_0x36f959,_0xa43c16){var _0x3d3003=[{'name':_0x31db('0x56'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x122cbe='';return db[_0x31db('0x2b')][_0x31db('0x4a')]({'where':{'id':_0x94e18f[_0x31db('0x47')]['id']},'attributes':['id','remoteUri',_0x31db('0x57'),_0x31db('0x58'),_0x31db('0x59'),_0x31db('0x5a'),'consumerSecret',_0x31db('0x5b'),_0x31db('0x5c')]})[_0x31db('0x25')](handleEntityNotFound(_0x36f959,null))[_0x31db('0x25')](function(_0x4bb55c){if(_0x4bb55c){_0x122cbe=_0x4bb55c['remoteUri'];var _0x427135=_0x122cbe['slice'](-0x1);if(_0x427135==='/'){_0x122cbe=_0x122cbe[_0x31db('0x5d')](0x0,_0x122cbe['lastIndexOf'](_0x427135));}var _0x469bbb={'method':_0x31db('0x5e'),'uri':util['format'](_0x31db('0x5f'),_0x122cbe),'headers':{'Content-Type':_0x31db('0x60'),'Accept':_0x31db('0x60')},'json':!![]};if(_0x4bb55c[_0x31db('0x57')]==='basic'){_0x469bbb[_0x31db('0x61')][_0x31db('0x62')]=util['format']('Basic\x20%s',new Buffer(util[_0x31db('0x63')](_0x31db('0x64'),_0x4bb55c[_0x31db('0x58')],_0x4bb55c[_0x31db('0x59')]))[_0x31db('0x65')](_0x31db('0x66')));}return rp(_0x469bbb)['then'](function(_0x1f8e55){return _0x3d3003[_0x31db('0x67')](_[_0x31db('0x2a')](_0x1f8e55['_embedded'][_0x31db('0x68')],function(_0x28f5c5){return{'id':_0x28f5c5['name'],'name':_0x28f5c5[_0x31db('0x2e')],'type':_0x28f5c5[_0x31db('0x2c')],'active':_0x28f5c5[_0x31db('0x69')],'label':_0x28f5c5[_0x31db('0x6a')],'custom':!![]};}));});}})[_0x31db('0x25')](function(_0xe0566b){return{'count':_0xe0566b[_0x31db('0x35')],'rows':_0xe0566b};})['then'](respondWithResult(_0x36f959,null))[_0x31db('0x41')](function(_0x10d724){var _0x5cd02c=_0x94e18f['query'][_0x31db('0x6b')]?0x1f4:_0x10d724['statusCode']||0x1f4;logger['error'](_0x31db('0x6c'),'getFields',_0x5cd02c,JSON['stringify'](_0x10d724));delete _0x10d724['name'];if(_0x5cd02c===0x191){_0x5cd02c=0x190;}_0x36f959['status'](_0x5cd02c)[_0x31db('0x28')](_0x94e18f['query'][_0x31db('0x6b')]?{'message':_0x31db('0x6d'),'statusCode':_0x10d724[_0x31db('0x6e')]}:_0x10d724);});}; \ No newline at end of file +var _0xfdbd=['find','catch','create','body','params','getConfigurations','Subjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','findOne','authType','username','password','consumerKey','consumerSecret','tokenSecret','remoteUri','substring','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','entries','label','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','length'];(function(_0x473738,_0x15ea31){var _0x1df4ae=function(_0x417a72){while(--_0x417a72){_0x473738['push'](_0x473738['shift']());}};_0x1df4ae(++_0x15ea31);}(_0xfdbd,0x1e5));var _0xdfdb=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xfdbd[_0x1e7b16];return _0x37fadc;};'use strict';var emlformat=require(_0xdfdb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdfdb('0x1'));var jsonpatch=require(_0xdfdb('0x2'));var rp=require(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdfdb('0x5'));var path=require(_0xdfdb('0x6'));var sox=require(_0xdfdb('0x7'));var csv=require('to-csv');var ejs=require(_0xdfdb('0x8'));var fs=require('fs');var fs_extra=require(_0xdfdb('0x9'));var _=require(_0xdfdb('0xa'));var squel=require(_0xdfdb('0xb'));var crypto=require(_0xdfdb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdfdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdfdb('0xe'));var Redis=require(_0xdfdb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdfdb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdfdb('0x11'));var utils=require(_0xdfdb('0x12'));var config=require(_0xdfdb('0x13'));var licenseUtil=require(_0xdfdb('0x14'));var db=require(_0xdfdb('0x15'))['db'];var integrations=require(_0xdfdb('0x16'));function respondWithStatusCode(_0x273e66,_0x2239b3){_0x2239b3=_0x2239b3||0xcc;return function(_0x41e7de){if(_0x41e7de){return _0x273e66[_0xdfdb('0x17')](_0x2239b3);}return _0x273e66[_0xdfdb('0x18')](_0x2239b3)[_0xdfdb('0x19')]();};}function respondWithResult(_0x5495c7,_0x1ab904){_0x1ab904=_0x1ab904||0xc8;return function(_0x3e8733){if(_0x3e8733){return _0x5495c7[_0xdfdb('0x18')](_0x1ab904)['json'](_0x3e8733);}};}function respondWithFilteredResult(_0x93198d,_0x3649e0){return function(_0x4a231e){if(_0x4a231e){var _0x5b6009=typeof _0x3649e0[_0xdfdb('0x1a')]===_0xdfdb('0x1b')&&typeof _0x3649e0[_0xdfdb('0x1c')]===_0xdfdb('0x1b');var _0x1f6dde=_0x4a231e[_0xdfdb('0x1d')];var _0x404b2b=_0x5b6009?0x0:_0x3649e0[_0xdfdb('0x1a')];var _0x1c5a4c=_0x5b6009?_0x4a231e['count']:_0x3649e0[_0xdfdb('0x1a')]+_0x3649e0['limit'];var _0x1c947d;if(_0x1c5a4c>=_0x1f6dde){_0x1c5a4c=_0x1f6dde;_0x1c947d=0xc8;}else{_0x1c947d=0xce;}_0x93198d[_0xdfdb('0x18')](_0x1c947d);return _0x93198d[_0xdfdb('0x1e')](_0xdfdb('0x1f'),_0x404b2b+'-'+_0x1c5a4c+'/'+_0x1f6dde)[_0xdfdb('0x20')](_0x4a231e);}return null;};}function patchUpdates(_0x1e2d6c){return function(_0x297633){try{jsonpatch[_0xdfdb('0x21')](_0x297633,_0x1e2d6c,!![]);}catch(_0x1c6521){return BPromise[_0xdfdb('0x22')](_0x1c6521);}return _0x297633[_0xdfdb('0x23')]();};}function saveUpdates(_0x447d02,_0x24b64d){return function(_0x1982d1){if(_0x1982d1){return _0x1982d1[_0xdfdb('0x24')](_0x447d02)[_0xdfdb('0x25')](function(_0x5b35b5){return _0x5b35b5;});}return null;};}function removeEntity(_0x140f41,_0x3bb294){return function(_0x578bec){if(_0x578bec){return _0x578bec[_0xdfdb('0x26')]()[_0xdfdb('0x25')](function(){_0x140f41['status'](0xcc)[_0xdfdb('0x19')]();});}};}function handleEntityNotFound(_0x31c362,_0x556dce){return function(_0x315978){if(!_0x315978){_0x31c362[_0xdfdb('0x17')](0x194);}return _0x315978;};}function handleError(_0x568352,_0x2e8b90){_0x2e8b90=_0x2e8b90||0x1f4;return function(_0x18231e){logger[_0xdfdb('0x27')](_0x18231e[_0xdfdb('0x28')]);if(_0x18231e[_0xdfdb('0x29')]){delete _0x18231e[_0xdfdb('0x29')];}_0x568352['status'](_0x2e8b90)[_0xdfdb('0x2a')](_0x18231e);};}exports[_0xdfdb('0x2b')]=function(_0x4640fc,_0x5d5f35){var _0x53c056={},_0xbe79ff={},_0x3328c7={'count':0x0,'rows':[]};var _0x368fe7=_['map'](db[_0xdfdb('0x2c')][_0xdfdb('0x2d')],function(_0x79e3c7){return{'name':_0x79e3c7[_0xdfdb('0x2e')],'type':_0x79e3c7[_0xdfdb('0x2f')][_0xdfdb('0x30')]};});_0xbe79ff[_0xdfdb('0x31')]=_[_0xdfdb('0x32')](_0x368fe7,_0xdfdb('0x29'));_0xbe79ff[_0xdfdb('0x33')]=_[_0xdfdb('0x34')](_0x4640fc[_0xdfdb('0x33')]);_0xbe79ff[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0xbe79ff[_0xdfdb('0x31')],_0xbe79ff[_0xdfdb('0x33')]);_0x53c056[_0xdfdb('0x37')]=_[_0xdfdb('0x36')](_0xbe79ff[_0xdfdb('0x31')],qs[_0xdfdb('0x38')](_0x4640fc[_0xdfdb('0x33')]['fields']));_0x53c056[_0xdfdb('0x37')]=_0x53c056[_0xdfdb('0x37')]['length']?_0x53c056[_0xdfdb('0x37')]:_0xbe79ff['model'];if(!_0x4640fc[_0xdfdb('0x33')][_0xdfdb('0x39')](_0xdfdb('0x3a'))){_0x53c056[_0xdfdb('0x1c')]=qs[_0xdfdb('0x1c')](_0x4640fc[_0xdfdb('0x33')][_0xdfdb('0x1c')]);_0x53c056[_0xdfdb('0x1a')]=qs[_0xdfdb('0x1a')](_0x4640fc['query'][_0xdfdb('0x1a')]);}_0x53c056[_0xdfdb('0x3b')]=qs[_0xdfdb('0x3c')](_0x4640fc[_0xdfdb('0x33')][_0xdfdb('0x3c')]);_0x53c056[_0xdfdb('0x3d')]=qs[_0xdfdb('0x35')](_['pick'](_0x4640fc['query'],_0xbe79ff[_0xdfdb('0x35')]),_0x368fe7);if(_0x4640fc['query'][_0xdfdb('0x3e')]){_0x53c056[_0xdfdb('0x3d')]=_[_0xdfdb('0x3f')](_0x53c056[_0xdfdb('0x3d')],{'$or':_[_0xdfdb('0x32')](_0x368fe7,function(_0x50f9b2){if(_0x50f9b2[_0xdfdb('0x2f')]!==_0xdfdb('0x40')){var _0x6ea722={};_0x6ea722[_0x50f9b2[_0xdfdb('0x29')]]={'$like':'%'+_0x4640fc[_0xdfdb('0x33')][_0xdfdb('0x3e')]+'%'};return _0x6ea722;}})});}_0x53c056=_[_0xdfdb('0x3f')]({},_0x53c056,_0x4640fc[_0xdfdb('0x41')]);var _0x4753d6={'where':_0x53c056['where']};return db[_0xdfdb('0x2c')][_0xdfdb('0x1d')](_0x4753d6)[_0xdfdb('0x25')](function(_0x1fe49a){_0x3328c7[_0xdfdb('0x1d')]=_0x1fe49a;if(_0x4640fc['query']['includeAll']){_0x53c056[_0xdfdb('0x42')]=[{'all':!![]}];}return db[_0xdfdb('0x2c')][_0xdfdb('0x43')](_0x53c056);})['then'](function(_0x183c28){_0x3328c7[_0xdfdb('0x44')]=_0x183c28;return _0x3328c7;})[_0xdfdb('0x25')](respondWithFilteredResult(_0x5d5f35,_0x53c056))['catch'](handleError(_0x5d5f35,null));};exports['show']=function(_0xc1bb29,_0x5c56ff){var _0x476a65={'raw':![],'where':{'id':_0xc1bb29['params']['id']}},_0x5051d2={};_0x5051d2[_0xdfdb('0x31')]=_[_0xdfdb('0x34')](db['DeskAccount']['rawAttributes']);_0x5051d2[_0xdfdb('0x33')]=_['keys'](_0xc1bb29[_0xdfdb('0x33')]);_0x5051d2[_0xdfdb('0x35')]=_['intersection'](_0x5051d2[_0xdfdb('0x31')],_0x5051d2['query']);_0x476a65['attributes']=_[_0xdfdb('0x36')](_0x5051d2[_0xdfdb('0x31')],qs[_0xdfdb('0x38')](_0xc1bb29[_0xdfdb('0x33')][_0xdfdb('0x38')]));_0x476a65['attributes']=_0x476a65['attributes'][_0xdfdb('0x45')]?_0x476a65[_0xdfdb('0x37')]:_0x5051d2[_0xdfdb('0x31')];if(_0xc1bb29['query']['includeAll']){_0x476a65['include']=[{'all':!![]}];}_0x476a65=_[_0xdfdb('0x3f')]({},_0x476a65,_0xc1bb29[_0xdfdb('0x41')]);return db[_0xdfdb('0x2c')][_0xdfdb('0x46')](_0x476a65)[_0xdfdb('0x25')](handleEntityNotFound(_0x5c56ff,null))[_0xdfdb('0x25')](respondWithResult(_0x5c56ff,null))[_0xdfdb('0x47')](handleError(_0x5c56ff,null));};exports[_0xdfdb('0x48')]=function(_0x237c11,_0x2fd6d2){return db[_0xdfdb('0x2c')][_0xdfdb('0x48')](_0x237c11['body'],{})[_0xdfdb('0x25')](respondWithResult(_0x2fd6d2,0xc9))[_0xdfdb('0x47')](handleError(_0x2fd6d2,null));};exports['update']=function(_0x1b5249,_0x27e080){if(_0x1b5249[_0xdfdb('0x49')]['id']){delete _0x1b5249['body']['id'];}return db[_0xdfdb('0x2c')]['find']({'where':{'id':_0x1b5249[_0xdfdb('0x4a')]['id']}})[_0xdfdb('0x25')](handleEntityNotFound(_0x27e080,null))['then'](saveUpdates(_0x1b5249['body'],null))[_0xdfdb('0x25')](respondWithResult(_0x27e080,null))['catch'](handleError(_0x27e080,null));};exports['destroy']=function(_0x2eb471,_0x4f1a0b){return db[_0xdfdb('0x2c')]['find']({'where':{'id':_0x2eb471[_0xdfdb('0x4a')]['id']}})[_0xdfdb('0x25')](handleEntityNotFound(_0x4f1a0b,null))[_0xdfdb('0x25')](removeEntity(_0x4f1a0b,null))[_0xdfdb('0x47')](handleError(_0x4f1a0b,null));};exports[_0xdfdb('0x4b')]=function(_0x1d4cd2,_0x276bc0,_0x1f97fb){var _0x31ec16={};var _0x49959a={};var _0x25e3ad;var _0x1574fa;return db[_0xdfdb('0x2c')]['findOne']({'where':{'id':_0x1d4cd2[_0xdfdb('0x4a')]['id']}})[_0xdfdb('0x25')](handleEntityNotFound(_0x276bc0,null))['then'](function(_0x493c2e){if(_0x493c2e){_0x25e3ad=_0x493c2e;_0x49959a[_0xdfdb('0x31')]=_[_0xdfdb('0x34')](db['DeskConfiguration']['rawAttributes']);_0x49959a['query']=_['keys'](_0x1d4cd2[_0xdfdb('0x33')]);_0x49959a[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x49959a['model'],_0x49959a[_0xdfdb('0x33')]);_0x31ec16['attributes']=_[_0xdfdb('0x36')](_0x49959a[_0xdfdb('0x31')],qs[_0xdfdb('0x38')](_0x1d4cd2['query'][_0xdfdb('0x38')]));_0x31ec16[_0xdfdb('0x37')]=_0x31ec16[_0xdfdb('0x37')][_0xdfdb('0x45')]?_0x31ec16['attributes']:_0x49959a[_0xdfdb('0x31')];_0x31ec16[_0xdfdb('0x3b')]=qs['sort'](_0x1d4cd2[_0xdfdb('0x33')][_0xdfdb('0x3c')]);_0x31ec16[_0xdfdb('0x3d')]=qs[_0xdfdb('0x35')](_['pick'](_0x1d4cd2[_0xdfdb('0x33')],_0x49959a[_0xdfdb('0x35')]));if(_0x1d4cd2[_0xdfdb('0x33')][_0xdfdb('0x3e')]){_0x31ec16[_0xdfdb('0x3d')]=_[_0xdfdb('0x3f')](_0x31ec16[_0xdfdb('0x3d')],{'$or':_['map'](_0x31ec16['attributes'],function(_0x2d1a9c){var _0x2d17ca={};_0x2d17ca[_0x2d1a9c]={'$like':'%'+_0x1d4cd2[_0xdfdb('0x33')][_0xdfdb('0x3e')]+'%'};return _0x2d17ca;})});}_0x31ec16=_[_0xdfdb('0x3f')]({},_0x31ec16,_0x1d4cd2[_0xdfdb('0x41')]);return _0x25e3ad[_0xdfdb('0x4b')](_0x31ec16);}})[_0xdfdb('0x25')](function(_0x45989c){if(_0x45989c){_0x1574fa=_0x45989c[_0xdfdb('0x45')];if(!_0x1d4cd2[_0xdfdb('0x33')][_0xdfdb('0x39')](_0xdfdb('0x3a'))){_0x31ec16[_0xdfdb('0x1c')]=qs[_0xdfdb('0x1c')](_0x1d4cd2[_0xdfdb('0x33')][_0xdfdb('0x1c')]);_0x31ec16[_0xdfdb('0x1a')]=qs[_0xdfdb('0x1a')](_0x1d4cd2['query'][_0xdfdb('0x1a')]);}return _0x25e3ad[_0xdfdb('0x4b')](_0x31ec16);}})[_0xdfdb('0x25')](function(_0x4432a7){if(_0x4432a7){return _0x4432a7?{'count':_0x1574fa,'rows':_0x4432a7}:null;}})['then'](respondWithResult(_0x276bc0,null))['catch'](handleError(_0x276bc0,null));};exports['addConfiguration']=function(_0x3b9bbd,_0x124b80,_0x51b405){if(_0x3b9bbd[_0xdfdb('0x49')]['id']){delete _0x3b9bbd[_0xdfdb('0x49')]['id'];}return db[_0xdfdb('0x2c')]['findOne']({'where':{'id':_0x3b9bbd[_0xdfdb('0x4a')]['id']}})[_0xdfdb('0x25')](handleEntityNotFound(_0x124b80,null))[_0xdfdb('0x25')](function(_0x4d5d5e){if(_0x4d5d5e){_0x3b9bbd['body']['AccountId']=_0x4d5d5e['id'];_0x3b9bbd[_0xdfdb('0x49')][_0xdfdb('0x4c')]=integrations['getSubjects'](_0x3b9bbd['body'][_0xdfdb('0x4d')],_0x3b9bbd[_0xdfdb('0x49')][_0xdfdb('0x2f')]);_0x3b9bbd[_0xdfdb('0x49')][_0xdfdb('0x4e')]=integrations[_0xdfdb('0x4f')](_0x3b9bbd[_0xdfdb('0x49')][_0xdfdb('0x4d')],_0x3b9bbd['body'][_0xdfdb('0x2f')]);return db[_0xdfdb('0x50')][_0xdfdb('0x48')](_0x3b9bbd['body'],{'include':[{'model':db[_0xdfdb('0x51')],'as':_0xdfdb('0x4c')},{'model':db[_0xdfdb('0x51')],'as':_0xdfdb('0x4e')}]});}return null;})[_0xdfdb('0x25')](respondWithResult(_0x124b80,null))[_0xdfdb('0x47')](handleError(_0x124b80,null));};exports[_0xdfdb('0x52')]=function(_0x4869ba,_0x2bed73,_0x2dc1d5){var _0x47784e=[{'name':_0xdfdb('0x53'),'label':_0xdfdb('0x53'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x3b5d3b='';return db[_0xdfdb('0x2c')][_0xdfdb('0x54')]({'where':{'id':_0x4869ba[_0xdfdb('0x4a')]['id']},'attributes':['id','remoteUri',_0xdfdb('0x55'),_0xdfdb('0x56'),_0xdfdb('0x57'),_0xdfdb('0x58'),_0xdfdb('0x59'),'token',_0xdfdb('0x5a')]})[_0xdfdb('0x25')](handleEntityNotFound(_0x2bed73,null))['then'](function(_0x322701){if(_0x322701){_0x3b5d3b=_0x322701[_0xdfdb('0x5b')];var _0x2a436f=_0x3b5d3b['slice'](-0x1);if(_0x2a436f==='/'){_0x3b5d3b=_0x3b5d3b[_0xdfdb('0x5c')](0x0,_0x3b5d3b['lastIndexOf'](_0x2a436f));}var _0x248c5f={'method':_0xdfdb('0x5d'),'uri':util[_0xdfdb('0x5e')](_0xdfdb('0x5f'),_0x3b5d3b),'headers':{'Content-Type':'application/json','Accept':_0xdfdb('0x60')},'json':!![]};if(_0x322701[_0xdfdb('0x55')]===_0xdfdb('0x61')){_0x248c5f['headers'][_0xdfdb('0x62')]=util[_0xdfdb('0x5e')](_0xdfdb('0x63'),new Buffer(util[_0xdfdb('0x5e')](_0xdfdb('0x64'),_0x322701['username'],_0x322701[_0xdfdb('0x57')]))[_0xdfdb('0x65')](_0xdfdb('0x66')));}return rp(_0x248c5f)[_0xdfdb('0x25')](function(_0x35e033){return _0x47784e[_0xdfdb('0x67')](_[_0xdfdb('0x32')](_0x35e033['_embedded'][_0xdfdb('0x68')],function(_0x3b9c93){return{'id':_0x3b9c93['name'],'name':_0x3b9c93['name'],'type':_0x3b9c93[_0xdfdb('0x2f')],'active':_0x3b9c93['active'],'label':_0x3b9c93[_0xdfdb('0x69')],'custom':!![]};}));});}})[_0xdfdb('0x25')](function(_0xce5b6f){return{'count':_0xce5b6f[_0xdfdb('0x45')],'rows':_0xce5b6f};})[_0xdfdb('0x25')](respondWithResult(_0x2bed73,null))[_0xdfdb('0x47')](function(_0x4daf16){var _0x3947bb=_0x4869ba[_0xdfdb('0x33')][_0xdfdb('0x6a')]?0x1f4:_0x4daf16['statusCode']||0x1f4;logger[_0xdfdb('0x27')](_0xdfdb('0x6b'),_0xdfdb('0x52'),_0x3947bb,JSON[_0xdfdb('0x6c')](_0x4daf16));delete _0x4daf16[_0xdfdb('0x29')];if(_0x3947bb===0x191){_0x3947bb=0x190;}_0x2bed73[_0xdfdb('0x18')](_0x3947bb)[_0xdfdb('0x2a')](_0x4869ba[_0xdfdb('0x33')][_0xdfdb('0x6a')]?{'message':_0xdfdb('0x6d'),'statusCode':_0x4daf16[_0xdfdb('0x6e')]}:_0x4daf16);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 321b2d8..e02c9b9 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 _0xc7bb=['util','../../config/logger','moment','request-promise','path','rimraf','../../components/integrations/configuration','DeskAccount','lodash'];(function(_0x3cb83f,_0x2bc6dd){var _0x105d68=function(_0x18bd0f){while(--_0x18bd0f){_0x3cb83f['push'](_0x3cb83f['shift']());}};_0x105d68(++_0x2bc6dd);}(_0xc7bb,0x1af));var _0xbc7b=function(_0x1fba42,_0x370f73){_0x1fba42=_0x1fba42-0x0;var _0x1b6c24=_0xc7bb[_0x1fba42];return _0x1b6c24;};'use strict';var _=require(_0xbc7b('0x0'));var util=require(_0xbc7b('0x1'));var logger=require(_0xbc7b('0x2'))('api');var moment=require(_0xbc7b('0x3'));var BPromise=require('bluebird');var rp=require(_0xbc7b('0x4'));var fs=require('fs');var path=require(_0xbc7b('0x5'));var rimraf=require(_0xbc7b('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xbc7b('0x7'));module['exports']=function(_0x2d0351,_0x306e51){return _0x2d0351['define'](_0xbc7b('0x8'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x963a=['path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x343d57,_0x5e193c){var _0xf86086=function(_0x3b136a){while(--_0x3b136a){_0x343d57['push'](_0x343d57['shift']());}};_0xf86086(++_0x5e193c);}(_0x963a,0x166));var _0xa963=function(_0x37c0fa,_0x55bcfb){_0x37c0fa=_0x37c0fa-0x0;var _0x1164ec=_0x963a[_0x37c0fa];return _0x1164ec;};'use strict';var _=require(_0xa963('0x0'));var util=require(_0xa963('0x1'));var logger=require(_0xa963('0x2'))('api');var moment=require(_0xa963('0x3'));var BPromise=require(_0xa963('0x4'));var rp=require(_0xa963('0x5'));var fs=require('fs');var path=require(_0xa963('0x6'));var rimraf=require(_0xa963('0x7'));var config=require(_0xa963('0x8'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xa963('0x9'));module[_0xa963('0xa')]=function(_0x49c6ad,_0x439810){return _0x49c6ad[_0xa963('0xb')](_0xa963('0xc'),attributes,{'tableName':_0xa963('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index d1dcd30..893a647 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 _0xce73=['stringify','error','message','result','DeskAccount','findAll','options','attributes','limit','map','include','model','GetDeskAccount','catch','find','where','ShowDeskAccount','util','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x127866,_0x1a49ad){var _0x4addaf=function(_0x586512){while(--_0x586512){_0x127866['push'](_0x127866['shift']());}};_0x4addaf(++_0x1a49ad);}(_0xce73,0x197));var _0x3ce7=function(_0x3b0416,_0x5ad95d){_0x3b0416=_0x3b0416-0x0;var _0x124c1e=_0xce73[_0x3b0416];return _0x124c1e;};'use strict';var _=require('lodash');var util=require(_0x3ce7('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3ce7('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3ce7('0x2'));var logger=require(_0x3ce7('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3ce7('0x4'));var client=jayson[_0x3ce7('0x5')][_0x3ce7('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4797f5,_0x3950cb,_0x5de0dd){return new BPromise(function(_0x2ea3de,_0x1afda5){return client['request'](_0x4797f5,_0x5de0dd)[_0x3ce7('0x7')](function(_0xffc09d){logger[_0x3ce7('0x8')](_0x3ce7('0x9'),_0x3950cb,_0x3ce7('0xa'));logger[_0x3ce7('0xb')](_0x3ce7('0xc'),_0x3950cb,_0x3ce7('0xa'),JSON[_0x3ce7('0xd')](_0xffc09d));if(_0xffc09d[_0x3ce7('0xe')]){if(_0xffc09d[_0x3ce7('0xe')]['code']===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x3950cb,_0xffc09d[_0x3ce7('0xe')][_0x3ce7('0xf')]);return _0x1afda5(_0xffc09d[_0x3ce7('0xe')][_0x3ce7('0xf')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x3950cb,_0xffc09d['error'][_0x3ce7('0xf')]);return _0x2ea3de(_0xffc09d['error']['message']);}else{logger[_0x3ce7('0x8')](_0x3ce7('0x9'),_0x3950cb,_0x3ce7('0xa'));_0x2ea3de(_0xffc09d[_0x3ce7('0x10')][_0x3ce7('0xf')]);}})['catch'](function(_0x194e19){logger[_0x3ce7('0xe')](_0x3ce7('0x9'),_0x3950cb,_0x194e19);_0x1afda5(_0x194e19);});});}exports['GetDeskAccount']=function(_0x550182){var _0x1e0eb6=this;return new Promise(function(_0x2db527,_0x158e16){return db[_0x3ce7('0x11')][_0x3ce7('0x12')]({'raw':_0x550182['options']?_0x550182[_0x3ce7('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x550182['options']?_0x550182[_0x3ce7('0x13')]['where']||null:null,'attributes':_0x550182[_0x3ce7('0x13')]?_0x550182[_0x3ce7('0x13')][_0x3ce7('0x14')]||null:null,'limit':_0x550182[_0x3ce7('0x13')]?_0x550182[_0x3ce7('0x13')][_0x3ce7('0x15')]||null:null,'include':_0x550182[_0x3ce7('0x13')]?_0x550182['options']['include']?_[_0x3ce7('0x16')](_0x550182['options'][_0x3ce7('0x17')],function(_0x3cfd86){return{'model':db[_0x3cfd86['model']],'as':_0x3cfd86['as'],'attributes':_0x3cfd86[_0x3ce7('0x14')],'include':_0x3cfd86[_0x3ce7('0x17')]?_[_0x3ce7('0x16')](_0x3cfd86['include'],function(_0x252e9e){return{'model':db[_0x252e9e[_0x3ce7('0x18')]],'as':_0x252e9e['as'],'attributes':_0x252e9e['attributes'],'include':_0x252e9e[_0x3ce7('0x17')]?_['map'](_0x252e9e[_0x3ce7('0x17')],function(_0x17803a){return{'model':db[_0x17803a[_0x3ce7('0x18')]],'as':_0x17803a['as'],'attributes':_0x17803a[_0x3ce7('0x14')]};}):[]};}):[]};}):[]:[]})[_0x3ce7('0x7')](function(_0x164c16){logger[_0x3ce7('0x8')](_0x3ce7('0x19'),_0x550182);logger[_0x3ce7('0xb')](_0x3ce7('0x19'),_0x550182,JSON['stringify'](_0x164c16));_0x2db527(_0x164c16);})[_0x3ce7('0x1a')](function(_0x89686e){logger[_0x3ce7('0xe')](_0x3ce7('0x19'),_0x89686e['message'],_0x550182);_0x158e16(_0x1e0eb6[_0x3ce7('0xe')](0x1f4,_0x89686e['message']));});});};exports['ShowDeskAccount']=function(_0x3b55b7){var _0x497342=this;return new Promise(function(_0xb6b229,_0x34f7bb){return db[_0x3ce7('0x11')][_0x3ce7('0x1b')]({'raw':_0x3b55b7['options']?_0x3b55b7['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b55b7[_0x3ce7('0x13')]?_0x3b55b7[_0x3ce7('0x13')][_0x3ce7('0x1c')]||null:null,'attributes':_0x3b55b7['options']?_0x3b55b7[_0x3ce7('0x13')][_0x3ce7('0x14')]||null:null,'include':_0x3b55b7['options']?_0x3b55b7[_0x3ce7('0x13')][_0x3ce7('0x17')]?_[_0x3ce7('0x16')](_0x3b55b7[_0x3ce7('0x13')][_0x3ce7('0x17')],function(_0x2563cb){return{'model':db[_0x2563cb[_0x3ce7('0x18')]],'as':_0x2563cb['as'],'attributes':_0x2563cb[_0x3ce7('0x14')],'include':_0x2563cb[_0x3ce7('0x17')]?_['map'](_0x2563cb[_0x3ce7('0x17')],function(_0x27e198){return{'model':db[_0x27e198[_0x3ce7('0x18')]],'as':_0x27e198['as'],'attributes':_0x27e198['attributes'],'include':_0x27e198['include']?_[_0x3ce7('0x16')](_0x27e198[_0x3ce7('0x17')],function(_0x1925b9){return{'model':db[_0x1925b9[_0x3ce7('0x18')]],'as':_0x1925b9['as'],'attributes':_0x1925b9['attributes']};}):[]};}):[]};}):[]:[]})[_0x3ce7('0x7')](function(_0x50e233){logger[_0x3ce7('0x8')]('ShowDeskAccount',_0x3b55b7);logger[_0x3ce7('0xb')](_0x3ce7('0x1d'),_0x3b55b7,JSON[_0x3ce7('0xd')](_0x50e233));_0xb6b229(_0x50e233);})[_0x3ce7('0x1a')](function(_0x5a19fa){logger['error']('ShowDeskAccount',_0x5a19fa[_0x3ce7('0xf')],_0x3b55b7);_0x34f7bb(_0x497342[_0x3ce7('0xe')](0x1f4,_0x5a19fa['message']));});});}; \ No newline at end of file +var _0x70af=['request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowDeskAccount','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s'];(function(_0x337845,_0x20f7db){var _0x5ce3f0=function(_0xb3d975){while(--_0xb3d975){_0x337845['push'](_0x337845['shift']());}};_0x5ce3f0(++_0x20f7db);}(_0x70af,0x1b8));var _0xf70a=function(_0x27c4b2,_0x1b0457){_0x27c4b2=_0x27c4b2-0x0;var _0x5311c2=_0x70af[_0x27c4b2];return _0x5311c2;};'use strict';var _=require(_0xf70a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf70a('0x1'));var rs=require(_0xf70a('0x2'));var fs=require('fs');var Redis=require(_0xf70a('0x3'));var db=require(_0xf70a('0x4'))['db'];var utils=require(_0xf70a('0x5'));var logger=require(_0xf70a('0x6'))(_0xf70a('0x7'));var config=require(_0xf70a('0x8'));var jayson=require(_0xf70a('0x9'));var client=jayson['client'][_0xf70a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31ca43,_0x24ff0f,_0x1ee536){return new BPromise(function(_0xcc3e44,_0x84a518){return client[_0xf70a('0xb')](_0x31ca43,_0x1ee536)[_0xf70a('0xc')](function(_0x3473f7){logger[_0xf70a('0xd')](_0xf70a('0xe'),_0x24ff0f,_0xf70a('0xf'));logger['debug'](_0xf70a('0x10'),_0x24ff0f,'request\x20sent',JSON[_0xf70a('0x11')](_0x3473f7));if(_0x3473f7['error']){if(_0x3473f7[_0xf70a('0x12')][_0xf70a('0x13')]===0x1f4){logger[_0xf70a('0x12')](_0xf70a('0xe'),_0x24ff0f,_0x3473f7[_0xf70a('0x12')][_0xf70a('0x14')]);return _0x84a518(_0x3473f7[_0xf70a('0x12')][_0xf70a('0x14')]);}logger[_0xf70a('0x12')](_0xf70a('0xe'),_0x24ff0f,_0x3473f7[_0xf70a('0x12')]['message']);return _0xcc3e44(_0x3473f7['error'][_0xf70a('0x14')]);}else{logger[_0xf70a('0xd')]('DeskAccount,\x20%s,\x20%s',_0x24ff0f,'request\x20sent');_0xcc3e44(_0x3473f7['result'][_0xf70a('0x14')]);}})[_0xf70a('0x15')](function(_0x39ccf8){logger['error'](_0xf70a('0xe'),_0x24ff0f,_0x39ccf8);_0x84a518(_0x39ccf8);});});}exports[_0xf70a('0x16')]=function(_0x250fa2){var _0x2f9970=this;return new Promise(function(_0x49e3dd,_0x1a3c79){return db[_0xf70a('0x17')][_0xf70a('0x18')]({'raw':_0x250fa2[_0xf70a('0x19')]?_0x250fa2[_0xf70a('0x19')][_0xf70a('0x1a')]===undefined?!![]:![]:!![],'where':_0x250fa2[_0xf70a('0x19')]?_0x250fa2[_0xf70a('0x19')][_0xf70a('0x1b')]||null:null,'attributes':_0x250fa2[_0xf70a('0x19')]?_0x250fa2[_0xf70a('0x19')][_0xf70a('0x1c')]||null:null,'limit':_0x250fa2['options']?_0x250fa2['options'][_0xf70a('0x1d')]||null:null,'include':_0x250fa2[_0xf70a('0x19')]?_0x250fa2['options']['include']?_[_0xf70a('0x1e')](_0x250fa2[_0xf70a('0x19')][_0xf70a('0x1f')],function(_0x1a8da2){return{'model':db[_0x1a8da2[_0xf70a('0x20')]],'as':_0x1a8da2['as'],'attributes':_0x1a8da2[_0xf70a('0x1c')],'include':_0x1a8da2[_0xf70a('0x1f')]?_['map'](_0x1a8da2[_0xf70a('0x1f')],function(_0x25126a){return{'model':db[_0x25126a[_0xf70a('0x20')]],'as':_0x25126a['as'],'attributes':_0x25126a['attributes'],'include':_0x25126a[_0xf70a('0x1f')]?_[_0xf70a('0x1e')](_0x25126a[_0xf70a('0x1f')],function(_0x547787){return{'model':db[_0x547787[_0xf70a('0x20')]],'as':_0x547787['as'],'attributes':_0x547787[_0xf70a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf70a('0xc')](function(_0x550157){logger[_0xf70a('0xd')]('GetDeskAccount',_0x250fa2);logger['debug'](_0xf70a('0x16'),_0x250fa2,JSON[_0xf70a('0x11')](_0x550157));_0x49e3dd(_0x550157);})['catch'](function(_0x129b21){logger[_0xf70a('0x12')](_0xf70a('0x16'),_0x129b21[_0xf70a('0x14')],_0x250fa2);_0x1a3c79(_0x2f9970['error'](0x1f4,_0x129b21[_0xf70a('0x14')]));});});};exports[_0xf70a('0x21')]=function(_0x2b5a45){var _0x47117a=this;return new Promise(function(_0x5880af,_0x276a00){return db[_0xf70a('0x17')][_0xf70a('0x22')]({'raw':_0x2b5a45[_0xf70a('0x19')]?_0x2b5a45['options'][_0xf70a('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b5a45[_0xf70a('0x19')]?_0x2b5a45[_0xf70a('0x19')][_0xf70a('0x1b')]||null:null,'attributes':_0x2b5a45[_0xf70a('0x19')]?_0x2b5a45[_0xf70a('0x19')][_0xf70a('0x1c')]||null:null,'include':_0x2b5a45[_0xf70a('0x19')]?_0x2b5a45['options'][_0xf70a('0x1f')]?_[_0xf70a('0x1e')](_0x2b5a45[_0xf70a('0x19')][_0xf70a('0x1f')],function(_0x5a8b2b){return{'model':db[_0x5a8b2b[_0xf70a('0x20')]],'as':_0x5a8b2b['as'],'attributes':_0x5a8b2b[_0xf70a('0x1c')],'include':_0x5a8b2b[_0xf70a('0x1f')]?_[_0xf70a('0x1e')](_0x5a8b2b[_0xf70a('0x1f')],function(_0x2d4b69){return{'model':db[_0x2d4b69[_0xf70a('0x20')]],'as':_0x2d4b69['as'],'attributes':_0x2d4b69[_0xf70a('0x1c')],'include':_0x2d4b69['include']?_[_0xf70a('0x1e')](_0x2d4b69[_0xf70a('0x1f')],function(_0x404116){return{'model':db[_0x404116[_0xf70a('0x20')]],'as':_0x404116['as'],'attributes':_0x404116[_0xf70a('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c6ca3){logger['info'](_0xf70a('0x21'),_0x2b5a45);logger['debug']('ShowDeskAccount',_0x2b5a45,JSON[_0xf70a('0x11')](_0x3c6ca3));_0x5880af(_0x3c6ca3);})[_0xf70a('0x15')](function(_0x1abc50){logger[_0xf70a('0x12')](_0xf70a('0x21'),_0x1abc50[_0xf70a('0x14')],_0x2b5a45);_0x276a00(_0x47117a[_0xf70a('0x12')](0x1f4,_0x1abc50[_0xf70a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 08e2b0d..2310ec2 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 _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x47b165,_0x9f9f3b){var _0x1e864e=function(_0x37b410){while(--_0x37b410){_0x47b165['push'](_0x47b165['shift']());}};_0x1e864e(++_0x9f9f3b);}(_0xedd9,0xfc));var _0x9edd=function(_0x38816b,_0x55a0a8){_0x38816b=_0x38816b-0x0;var _0x3a3acf=_0xedd9[_0x38816b];return _0x3a3acf;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=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(_0x486665,_0x2821f3){var _0x1ce6e2=function(_0x2d0cb2){while(--_0x2d0cb2){_0x486665['push'](_0x486665['shift']());}};_0x1ce6e2(++_0x2821f3);}(_0x34e8,0x12c));var _0x834e=function(_0x4253b4,_0xf619dc){_0x4253b4=_0x4253b4-0x0;var _0x3e50d6=_0x34e8[_0x4253b4];return _0x3e50d6;};'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 90e0204..a75cbd6 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 _0xbd51=['sequelize','exports','STRING'];(function(_0xa874c9,_0x4fbbcd){var _0x13b2cf=function(_0x5bbcee){while(--_0x5bbcee){_0xa874c9['push'](_0xa874c9['shift']());}};_0x13b2cf(++_0x4fbbcd);}(_0xbd51,0x96));var _0x1bd5=function(_0x40df6a,_0x41636b){_0x40df6a=_0x40df6a-0x0;var _0x20a4e8=_0xbd51[_0x40df6a];return _0x20a4e8;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module[_0x1bd5('0x1')]={'name':{'type':Sequelize[_0x1bd5('0x2')]},'description':{'type':Sequelize[_0x1bd5('0x2')]}}; \ No newline at end of file +var _0x9ad5=['STRING','sequelize','exports'];(function(_0x339702,_0x465d98){var _0x55cc03=function(_0x570dad){while(--_0x570dad){_0x339702['push'](_0x339702['shift']());}};_0x55cc03(++_0x465d98);}(_0x9ad5,0x97));var _0x59ad=function(_0x11c459,_0x336724){_0x11c459=_0x11c459-0x0;var _0x3fab25=_0x9ad5[_0x11c459];return _0x3fab25;};'use strict';var Sequelize=require(_0x59ad('0x0'));module[_0x59ad('0x1')]={'name':{'type':Sequelize[_0x59ad('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 53ac4c4..0045fe1 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 _0x261d=['send','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','getFields','DeskField','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir','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','../../mysqldb','end','status','json','undefined','count','set','reject','update','then','destroy','sendStatus','stack','name'];(function(_0x1d8c30,_0x48f70c){var _0x4d87c7=function(_0x3fc4fe){while(--_0x3fc4fe){_0x1d8c30['push'](_0x1d8c30['shift']());}};_0x4d87c7(++_0x48f70c);}(_0x261d,0x119));var _0xd261=function(_0x3eecb,_0x38a8c9){_0x3eecb=_0x3eecb-0x0;var _0x5bee2a=_0x261d[_0x3eecb];return _0x5bee2a;};'use strict';var emlformat=require(_0xd261('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd261('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd261('0x2'));var ejs=require(_0xd261('0x3'));var fs=require('fs');var fs_extra=require(_0xd261('0x4'));var _=require(_0xd261('0x5'));var squel=require(_0xd261('0x6'));var crypto=require(_0xd261('0x7'));var jsforce=require(_0xd261('0x8'));var deskjs=require(_0xd261('0x9'));var toCsv=require(_0xd261('0x2'));var querystring=require(_0xd261('0xa'));var Papa=require(_0xd261('0xb'));var Redis=require(_0xd261('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xd261('0xd'));var as=require(_0xd261('0xe'));var hardwareService=require(_0xd261('0xf'));var logger=require(_0xd261('0x10'))(_0xd261('0x11'));var utils=require(_0xd261('0x12'));var config=require(_0xd261('0x13'));var licenseUtil=require(_0xd261('0x14'));var db=require(_0xd261('0x15'))['db'];function respondWithStatusCode(_0x115a41,_0x4b65d4){_0x4b65d4=_0x4b65d4||0xcc;return function(_0xff44e1){if(_0xff44e1){return _0x115a41['sendStatus'](_0x4b65d4);}return _0x115a41['status'](_0x4b65d4)[_0xd261('0x16')]();};}function respondWithResult(_0x33bee0,_0x29e487){_0x29e487=_0x29e487||0xc8;return function(_0x40589d){if(_0x40589d){return _0x33bee0[_0xd261('0x17')](_0x29e487)[_0xd261('0x18')](_0x40589d);}};}function respondWithFilteredResult(_0x20d053,_0x335310){return function(_0x3d0088){if(_0x3d0088){var _0x4a6b93=typeof _0x335310['offset']==='undefined'&&typeof _0x335310['limit']===_0xd261('0x19');var _0x126680=_0x3d0088[_0xd261('0x1a')];var _0x58cd93=_0x4a6b93?0x0:_0x335310['offset'];var _0x220dd0=_0x4a6b93?_0x3d0088['count']:_0x335310['offset']+_0x335310['limit'];var _0x4c7fc7;if(_0x220dd0>=_0x126680){_0x220dd0=_0x126680;_0x4c7fc7=0xc8;}else{_0x4c7fc7=0xce;}_0x20d053[_0xd261('0x17')](_0x4c7fc7);return _0x20d053[_0xd261('0x1b')]('Content-Range',_0x58cd93+'-'+_0x220dd0+'/'+_0x126680)['json'](_0x3d0088);}return null;};}function patchUpdates(_0x3eadbd){return function(_0x4aa431){try{jsonpatch['apply'](_0x4aa431,_0x3eadbd,!![]);}catch(_0xf68d6){return BPromise[_0xd261('0x1c')](_0xf68d6);}return _0x4aa431['save']();};}function saveUpdates(_0x230dc0,_0x1a0cbe){return function(_0x50adb8){if(_0x50adb8){return _0x50adb8[_0xd261('0x1d')](_0x230dc0)[_0xd261('0x1e')](function(_0x291354){return _0x291354;});}return null;};}function removeEntity(_0x338eba,_0x1cde91){return function(_0x470afe){if(_0x470afe){return _0x470afe[_0xd261('0x1f')]()[_0xd261('0x1e')](function(){_0x338eba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ba67d,_0x1f6a05){return function(_0x4726bb){if(!_0x4726bb){_0x4ba67d[_0xd261('0x20')](0x194);}return _0x4726bb;};}function handleError(_0x58e002,_0x2168b6){_0x2168b6=_0x2168b6||0x1f4;return function(_0x4d4c3a){logger['error'](_0x4d4c3a[_0xd261('0x21')]);if(_0x4d4c3a[_0xd261('0x22')]){delete _0x4d4c3a['name'];}_0x58e002[_0xd261('0x17')](_0x2168b6)[_0xd261('0x23')](_0x4d4c3a);};}exports['index']=function(_0x2072e8,_0x4f3b62){var _0x3f4d39={},_0x307a04={},_0x14443d={'count':0x0,'rows':[]};var _0x4a5f25=_[_0xd261('0x24')](db[_0xd261('0x25')][_0xd261('0x26')],function(_0x5499ca){return{'name':_0x5499ca[_0xd261('0x27')],'type':_0x5499ca[_0xd261('0x28')][_0xd261('0x29')]};});_0x307a04[_0xd261('0x2a')]=_[_0xd261('0x24')](_0x4a5f25,_0xd261('0x22'));_0x307a04['query']=_[_0xd261('0x2b')](_0x2072e8[_0xd261('0x2c')]);_0x307a04[_0xd261('0x2d')]=_[_0xd261('0x2e')](_0x307a04['model'],_0x307a04[_0xd261('0x2c')]);_0x3f4d39['attributes']=_[_0xd261('0x2e')](_0x307a04[_0xd261('0x2a')],qs['fields'](_0x2072e8[_0xd261('0x2c')]['fields']));_0x3f4d39[_0xd261('0x2f')]=_0x3f4d39[_0xd261('0x2f')][_0xd261('0x30')]?_0x3f4d39[_0xd261('0x2f')]:_0x307a04[_0xd261('0x2a')];if(!_0x2072e8[_0xd261('0x2c')][_0xd261('0x31')](_0xd261('0x32'))){_0x3f4d39[_0xd261('0x33')]=qs[_0xd261('0x33')](_0x2072e8[_0xd261('0x2c')]['limit']);_0x3f4d39[_0xd261('0x34')]=qs[_0xd261('0x34')](_0x2072e8[_0xd261('0x2c')][_0xd261('0x34')]);}_0x3f4d39[_0xd261('0x35')]=qs[_0xd261('0x36')](_0x2072e8[_0xd261('0x2c')][_0xd261('0x36')]);_0x3f4d39[_0xd261('0x37')]=qs[_0xd261('0x2d')](_[_0xd261('0x38')](_0x2072e8[_0xd261('0x2c')],_0x307a04['filters']),_0x4a5f25);if(_0x2072e8['query'][_0xd261('0x39')]){_0x3f4d39['where']=_[_0xd261('0x3a')](_0x3f4d39[_0xd261('0x37')],{'$or':_[_0xd261('0x24')](_0x4a5f25,function(_0x328731){if(_0x328731[_0xd261('0x28')]!==_0xd261('0x3b')){var _0x4d957b={};_0x4d957b[_0x328731['name']]={'$like':'%'+_0x2072e8[_0xd261('0x2c')]['filter']+'%'};return _0x4d957b;}})});}_0x3f4d39=_[_0xd261('0x3a')]({},_0x3f4d39,_0x2072e8[_0xd261('0x3c')]);var _0x5f59ca={'where':_0x3f4d39[_0xd261('0x37')]};return db[_0xd261('0x25')][_0xd261('0x1a')](_0x5f59ca)[_0xd261('0x1e')](function(_0x4d4697){_0x14443d[_0xd261('0x1a')]=_0x4d4697;if(_0x2072e8[_0xd261('0x2c')][_0xd261('0x3d')]){_0x3f4d39[_0xd261('0x3e')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xd261('0x3f')](_0x3f4d39);})[_0xd261('0x1e')](function(_0x483755){_0x14443d[_0xd261('0x40')]=_0x483755;return _0x14443d;})[_0xd261('0x1e')](respondWithFilteredResult(_0x4f3b62,_0x3f4d39))[_0xd261('0x41')](handleError(_0x4f3b62,null));};exports['show']=function(_0x3aaf98,_0x5d5833){var _0x99114f={'raw':![],'where':{'id':_0x3aaf98[_0xd261('0x42')]['id']}},_0x4e2e52={};_0x4e2e52[_0xd261('0x2a')]=_[_0xd261('0x2b')](db[_0xd261('0x25')]['rawAttributes']);_0x4e2e52[_0xd261('0x2c')]=_[_0xd261('0x2b')](_0x3aaf98['query']);_0x4e2e52[_0xd261('0x2d')]=_['intersection'](_0x4e2e52[_0xd261('0x2a')],_0x4e2e52['query']);_0x99114f['attributes']=_['intersection'](_0x4e2e52[_0xd261('0x2a')],qs[_0xd261('0x43')](_0x3aaf98[_0xd261('0x2c')][_0xd261('0x43')]));_0x99114f[_0xd261('0x2f')]=_0x99114f[_0xd261('0x2f')][_0xd261('0x30')]?_0x99114f[_0xd261('0x2f')]:_0x4e2e52[_0xd261('0x2a')];if(_0x3aaf98[_0xd261('0x2c')]['includeAll']){_0x99114f['include']=[{'all':!![]}];}_0x99114f=_['merge']({},_0x99114f,_0x3aaf98[_0xd261('0x3c')]);return db['DeskConfiguration'][_0xd261('0x44')](_0x99114f)['then'](handleEntityNotFound(_0x5d5833,null))[_0xd261('0x1e')](respondWithResult(_0x5d5833,null))[_0xd261('0x41')](handleError(_0x5d5833,null));};exports[_0xd261('0x45')]=function(_0x4387bb,_0x4486ba){return db[_0xd261('0x25')][_0xd261('0x45')](_0x4387bb[_0xd261('0x46')],{})[_0xd261('0x1e')](respondWithResult(_0x4486ba,0xc9))[_0xd261('0x41')](handleError(_0x4486ba,null));};exports[_0xd261('0x1d')]=function(_0x42a2f8,_0x844ea8){if(_0x42a2f8[_0xd261('0x46')]['id']){delete _0x42a2f8['body']['id'];}return db[_0xd261('0x25')][_0xd261('0x44')]({'where':{'id':_0x42a2f8[_0xd261('0x42')]['id']}})[_0xd261('0x1e')](handleEntityNotFound(_0x844ea8,null))[_0xd261('0x1e')](saveUpdates(_0x42a2f8[_0xd261('0x46')],null))[_0xd261('0x1e')](respondWithResult(_0x844ea8,null))[_0xd261('0x41')](handleError(_0x844ea8,null));};exports[_0xd261('0x1f')]=function(_0x10f3b1,_0x4a2195){return db['DeskConfiguration']['find']({'where':{'id':_0x10f3b1[_0xd261('0x42')]['id']}})[_0xd261('0x1e')](handleEntityNotFound(_0x4a2195,null))[_0xd261('0x1e')](removeEntity(_0x4a2195,null))[_0xd261('0x41')](handleError(_0x4a2195,null));};exports[_0xd261('0x47')]=function(_0x4581d5,_0xb004f4,_0x572b33){var _0x2b7fe4={};var _0x1b7a9c={};var _0x19b7cb;var _0x2703c9;return db[_0xd261('0x25')]['findOne']({'where':{'id':_0x4581d5[_0xd261('0x42')]['id']}})[_0xd261('0x1e')](handleEntityNotFound(_0xb004f4,null))[_0xd261('0x1e')](function(_0x54ee77){if(_0x54ee77){_0x19b7cb=_0x54ee77;_0x1b7a9c[_0xd261('0x2a')]=_[_0xd261('0x2b')](db[_0xd261('0x48')][_0xd261('0x26')]);_0x1b7a9c[_0xd261('0x2c')]=_[_0xd261('0x2b')](_0x4581d5[_0xd261('0x2c')]);_0x1b7a9c[_0xd261('0x2d')]=_[_0xd261('0x2e')](_0x1b7a9c[_0xd261('0x2a')],_0x1b7a9c['query']);_0x2b7fe4[_0xd261('0x2f')]=_[_0xd261('0x2e')](_0x1b7a9c[_0xd261('0x2a')],qs[_0xd261('0x43')](_0x4581d5['query'][_0xd261('0x43')]));_0x2b7fe4[_0xd261('0x2f')]=_0x2b7fe4[_0xd261('0x2f')][_0xd261('0x30')]?_0x2b7fe4[_0xd261('0x2f')]:_0x1b7a9c[_0xd261('0x2a')];_0x2b7fe4[_0xd261('0x35')]=qs[_0xd261('0x36')](_0x4581d5[_0xd261('0x2c')]['sort']);_0x2b7fe4['where']=qs[_0xd261('0x2d')](_[_0xd261('0x38')](_0x4581d5[_0xd261('0x2c')],_0x1b7a9c[_0xd261('0x2d')]));if(_0x4581d5[_0xd261('0x2c')]['filter']){_0x2b7fe4[_0xd261('0x37')]=_[_0xd261('0x3a')](_0x2b7fe4[_0xd261('0x37')],{'$or':_[_0xd261('0x24')](_0x2b7fe4[_0xd261('0x2f')],function(_0x362b41){var _0x28c0bb={};_0x28c0bb[_0x362b41]={'$like':'%'+_0x4581d5[_0xd261('0x2c')][_0xd261('0x39')]+'%'};return _0x28c0bb;})});}_0x2b7fe4=_['merge']({},_0x2b7fe4,_0x4581d5[_0xd261('0x3c')]);return _0x19b7cb[_0xd261('0x47')](_0x2b7fe4);}})[_0xd261('0x1e')](function(_0xc4ebd5){if(_0xc4ebd5){_0x2703c9=_0xc4ebd5['length'];if(!_0x4581d5[_0xd261('0x2c')][_0xd261('0x31')](_0xd261('0x32'))){_0x2b7fe4[_0xd261('0x33')]=qs[_0xd261('0x33')](_0x4581d5[_0xd261('0x2c')]['limit']);_0x2b7fe4[_0xd261('0x34')]=qs['offset'](_0x4581d5['query']['offset']);}return _0x19b7cb[_0xd261('0x47')](_0x2b7fe4);}})[_0xd261('0x1e')](function(_0x5dae79){if(_0x5dae79){return _0x5dae79?{'count':_0x2703c9,'rows':_0x5dae79}:null;}})['then'](respondWithResult(_0xb004f4,null))[_0xd261('0x41')](handleError(_0xb004f4,null));};exports[_0xd261('0x49')]=function(_0x1186f5,_0x2eec19,_0x5dce99){var _0x56412c={};var _0x47fed4={};var _0x54d6dc;var _0x38bdf4;return db[_0xd261('0x25')][_0xd261('0x4a')]({'where':{'id':_0x1186f5[_0xd261('0x42')]['id']}})['then'](handleEntityNotFound(_0x2eec19,null))['then'](function(_0x12b35d){if(_0x12b35d){_0x54d6dc=_0x12b35d;_0x47fed4[_0xd261('0x2a')]=_[_0xd261('0x2b')](db['DeskField'][_0xd261('0x26')]);_0x47fed4[_0xd261('0x2c')]=_['keys'](_0x1186f5[_0xd261('0x2c')]);_0x47fed4[_0xd261('0x2d')]=_['intersection'](_0x47fed4[_0xd261('0x2a')],_0x47fed4[_0xd261('0x2c')]);_0x56412c['attributes']=_[_0xd261('0x2e')](_0x47fed4[_0xd261('0x2a')],qs[_0xd261('0x43')](_0x1186f5[_0xd261('0x2c')]['fields']));_0x56412c[_0xd261('0x2f')]=_0x56412c[_0xd261('0x2f')][_0xd261('0x30')]?_0x56412c[_0xd261('0x2f')]:_0x47fed4['model'];_0x56412c[_0xd261('0x35')]=qs['sort'](_0x1186f5[_0xd261('0x2c')]['sort']);_0x56412c[_0xd261('0x37')]=qs[_0xd261('0x2d')](_['pick'](_0x1186f5[_0xd261('0x2c')],_0x47fed4[_0xd261('0x2d')]));if(_0x1186f5[_0xd261('0x2c')]['filter']){_0x56412c[_0xd261('0x37')]=_[_0xd261('0x3a')](_0x56412c[_0xd261('0x37')],{'$or':_['map'](_0x56412c[_0xd261('0x2f')],function(_0x53f53a){var _0xd06d2c={};_0xd06d2c[_0x53f53a]={'$like':'%'+_0x1186f5['query'][_0xd261('0x39')]+'%'};return _0xd06d2c;})});}_0x56412c=_['merge']({},_0x56412c,_0x1186f5['options']);return _0x54d6dc['getSubjects'](_0x56412c);}})[_0xd261('0x1e')](function(_0xb5088a){if(_0xb5088a){_0x38bdf4=_0xb5088a['length'];if(!_0x1186f5[_0xd261('0x2c')][_0xd261('0x31')](_0xd261('0x32'))){_0x56412c[_0xd261('0x33')]=qs[_0xd261('0x33')](_0x1186f5['query']['limit']);_0x56412c[_0xd261('0x34')]=qs[_0xd261('0x34')](_0x1186f5[_0xd261('0x2c')][_0xd261('0x34')]);}return _0x54d6dc[_0xd261('0x49')](_0x56412c);}})['then'](function(_0x1e0f2e){if(_0x1e0f2e){return _0x1e0f2e?{'count':_0x38bdf4,'rows':_0x1e0f2e}:null;}})[_0xd261('0x1e')](respondWithResult(_0x2eec19,null))[_0xd261('0x41')](handleError(_0x2eec19,null));};exports[_0xd261('0x4b')]=function(_0x2cb485,_0x317917,_0x243965){var _0x63f21d={};var _0x4febd0={};var _0xfb2395;var _0x340e81;return db[_0xd261('0x25')][_0xd261('0x4a')]({'where':{'id':_0x2cb485['params']['id']}})[_0xd261('0x1e')](handleEntityNotFound(_0x317917,null))[_0xd261('0x1e')](function(_0x464da1){if(_0x464da1){_0xfb2395=_0x464da1;_0x4febd0[_0xd261('0x2a')]=_[_0xd261('0x2b')](db[_0xd261('0x48')]['rawAttributes']);_0x4febd0[_0xd261('0x2c')]=_[_0xd261('0x2b')](_0x2cb485['query']);_0x4febd0[_0xd261('0x2d')]=_[_0xd261('0x2e')](_0x4febd0[_0xd261('0x2a')],_0x4febd0['query']);_0x63f21d[_0xd261('0x2f')]=_[_0xd261('0x2e')](_0x4febd0[_0xd261('0x2a')],qs[_0xd261('0x43')](_0x2cb485[_0xd261('0x2c')][_0xd261('0x43')]));_0x63f21d['attributes']=_0x63f21d['attributes'][_0xd261('0x30')]?_0x63f21d[_0xd261('0x2f')]:_0x4febd0[_0xd261('0x2a')];_0x63f21d[_0xd261('0x35')]=qs[_0xd261('0x36')](_0x2cb485[_0xd261('0x2c')][_0xd261('0x36')]);_0x63f21d[_0xd261('0x37')]=qs['filters'](_['pick'](_0x2cb485[_0xd261('0x2c')],_0x4febd0[_0xd261('0x2d')]));if(_0x2cb485[_0xd261('0x2c')][_0xd261('0x39')]){_0x63f21d[_0xd261('0x37')]=_[_0xd261('0x3a')](_0x63f21d[_0xd261('0x37')],{'$or':_['map'](_0x63f21d[_0xd261('0x2f')],function(_0x4d8b1b){var _0x3547ec={};_0x3547ec[_0x4d8b1b]={'$like':'%'+_0x2cb485[_0xd261('0x2c')]['filter']+'%'};return _0x3547ec;})});}_0x63f21d=_[_0xd261('0x3a')]({},_0x63f21d,_0x2cb485['options']);return _0xfb2395[_0xd261('0x4b')](_0x63f21d);}})[_0xd261('0x1e')](function(_0x39d7d5){if(_0x39d7d5){_0x340e81=_0x39d7d5['length'];if(!_0x2cb485[_0xd261('0x2c')][_0xd261('0x31')]('nolimit')){_0x63f21d['limit']=qs[_0xd261('0x33')](_0x2cb485[_0xd261('0x2c')][_0xd261('0x33')]);_0x63f21d[_0xd261('0x34')]=qs[_0xd261('0x34')](_0x2cb485[_0xd261('0x2c')][_0xd261('0x34')]);}return _0xfb2395['getDescriptions'](_0x63f21d);}})[_0xd261('0x1e')](function(_0x1c75ff){if(_0x1c75ff){return _0x1c75ff?{'count':_0x340e81,'rows':_0x1c75ff}:null;}})[_0xd261('0x1e')](respondWithResult(_0x317917,null))[_0xd261('0x41')](handleError(_0x317917,null));};exports[_0xd261('0x4c')]=function(_0x414689,_0x1cea0b,_0x51ec41){var _0x4489d5={};var _0x2aba27={};var _0x3eb41a;var _0x1c084f;return db[_0xd261('0x25')][_0xd261('0x4a')]({'where':{'id':_0x414689[_0xd261('0x42')]['id']}})[_0xd261('0x1e')](handleEntityNotFound(_0x1cea0b,null))[_0xd261('0x1e')](function(_0x4fcb8b){if(_0x4fcb8b){_0x3eb41a=_0x4fcb8b;_0x2aba27[_0xd261('0x2a')]=_['keys'](db[_0xd261('0x4d')][_0xd261('0x26')]);_0x2aba27['query']=_[_0xd261('0x2b')](_0x414689[_0xd261('0x2c')]);_0x2aba27['filters']=_[_0xd261('0x2e')](_0x2aba27[_0xd261('0x2a')],_0x2aba27[_0xd261('0x2c')]);_0x4489d5[_0xd261('0x2f')]=_['intersection'](_0x2aba27[_0xd261('0x2a')],qs[_0xd261('0x43')](_0x414689[_0xd261('0x2c')][_0xd261('0x43')]));_0x4489d5[_0xd261('0x2f')]=_0x4489d5['attributes']['length']?_0x4489d5[_0xd261('0x2f')]:_0x2aba27[_0xd261('0x2a')];_0x4489d5[_0xd261('0x35')]=qs['sort'](_0x414689[_0xd261('0x2c')][_0xd261('0x36')]);_0x4489d5[_0xd261('0x37')]=qs[_0xd261('0x2d')](_[_0xd261('0x38')](_0x414689[_0xd261('0x2c')],_0x2aba27['filters']));if(_0x414689['query']['filter']){_0x4489d5[_0xd261('0x37')]=_[_0xd261('0x3a')](_0x4489d5[_0xd261('0x37')],{'$or':_[_0xd261('0x24')](_0x4489d5[_0xd261('0x2f')],function(_0x14d5fe){var _0x16363d={};_0x16363d[_0x14d5fe]={'$like':'%'+_0x414689[_0xd261('0x2c')][_0xd261('0x39')]+'%'};return _0x16363d;})});}_0x4489d5=_[_0xd261('0x3a')]({},_0x4489d5,_0x414689[_0xd261('0x3c')]);return _0x3eb41a['getTags'](_0x4489d5);}})[_0xd261('0x1e')](function(_0x159d4f){if(_0x159d4f){_0x1c084f=_0x159d4f[_0xd261('0x30')];if(!_0x414689[_0xd261('0x2c')][_0xd261('0x31')](_0xd261('0x32'))){_0x4489d5['limit']=qs[_0xd261('0x33')](_0x414689[_0xd261('0x2c')]['limit']);_0x4489d5[_0xd261('0x34')]=qs['offset'](_0x414689[_0xd261('0x2c')][_0xd261('0x34')]);}return _0x3eb41a[_0xd261('0x4c')](_0x4489d5);}})[_0xd261('0x1e')](function(_0x20d904){if(_0x20d904){return _0x20d904?{'count':_0x1c084f,'rows':_0x20d904}:null;}})['then'](respondWithResult(_0x1cea0b,null))['catch'](handleError(_0x1cea0b,null));};exports['setTags']=function(_0x5cc3da,_0x510e6c,_0x5eb9ba){if(_0x5cc3da[_0xd261('0x46')]['id']){delete _0x5cc3da['body']['id'];}return db[_0xd261('0x25')][_0xd261('0x4a')]({'where':{'id':_0x5cc3da[_0xd261('0x42')]['id']}})['then'](handleEntityNotFound(_0x510e6c,null))[_0xd261('0x1e')](function(_0x23f7aa){if(_0x23f7aa){return _0x23f7aa[_0xd261('0x4e')](_0x5cc3da['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x510e6c,null))[_0xd261('0x41')](handleError(_0x510e6c,null));}; \ No newline at end of file +var _0x6ca9=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','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','../../config/environment','../../mysqldb','sendStatus','end','status','json','limit','offset','count','set','reject','update','destroy','then','error','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','query','keys','filters','intersection','attributes','model','nolimit','sort','where','pick','type','VIRTUAL','filter','options','includeAll','include','rows','catch','params','fields','length','merge','create','body','getFields','DeskField','order','hasOwnProperty','getSubjects','getDescriptions','getTags','findOne','Tag','setTags'];(function(_0x410e66,_0x53adf7){var _0x5b78ad=function(_0x142333){while(--_0x142333){_0x410e66['push'](_0x410e66['shift']());}};_0x5b78ad(++_0x53adf7);}(_0x6ca9,0x9e));var _0x96ca=function(_0x524f8d,_0x228fb4){_0x524f8d=_0x524f8d-0x0;var _0x57e1c1=_0x6ca9[_0x524f8d];return _0x57e1c1;};'use strict';var emlformat=require(_0x96ca('0x0'));var rimraf=require(_0x96ca('0x1'));var zipdir=require(_0x96ca('0x2'));var jsonpatch=require(_0x96ca('0x3'));var rp=require(_0x96ca('0x4'));var moment=require(_0x96ca('0x5'));var BPromise=require(_0x96ca('0x6'));var Mustache=require('mustache');var util=require(_0x96ca('0x7'));var path=require(_0x96ca('0x8'));var sox=require('sox');var csv=require(_0x96ca('0x9'));var ejs=require(_0x96ca('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96ca('0xb'));var squel=require(_0x96ca('0xc'));var crypto=require(_0x96ca('0xd'));var jsforce=require(_0x96ca('0xe'));var deskjs=require(_0x96ca('0xf'));var toCsv=require(_0x96ca('0x9'));var querystring=require('querystring');var Papa=require(_0x96ca('0x10'));var Redis=require(_0x96ca('0x11'));var authService=require(_0x96ca('0x12'));var qs=require(_0x96ca('0x13'));var as=require(_0x96ca('0x14'));var hardwareService=require(_0x96ca('0x15'));var logger=require(_0x96ca('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x96ca('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x96ca('0x18'))['db'];function respondWithStatusCode(_0x4eb4bf,_0x2ecd31){_0x2ecd31=_0x2ecd31||0xcc;return function(_0x47a01d){if(_0x47a01d){return _0x4eb4bf[_0x96ca('0x19')](_0x2ecd31);}return _0x4eb4bf['status'](_0x2ecd31)[_0x96ca('0x1a')]();};}function respondWithResult(_0xb9f127,_0x2c8ddd){_0x2c8ddd=_0x2c8ddd||0xc8;return function(_0x3caa8d){if(_0x3caa8d){return _0xb9f127[_0x96ca('0x1b')](_0x2c8ddd)[_0x96ca('0x1c')](_0x3caa8d);}};}function respondWithFilteredResult(_0xbb2cde,_0x296427){return function(_0x509a21){if(_0x509a21){var _0xeb8b95=typeof _0x296427['offset']==='undefined'&&typeof _0x296427[_0x96ca('0x1d')]==='undefined';var _0x533ef9=_0x509a21['count'];var _0x242547=_0xeb8b95?0x0:_0x296427[_0x96ca('0x1e')];var _0x444f7f=_0xeb8b95?_0x509a21[_0x96ca('0x1f')]:_0x296427[_0x96ca('0x1e')]+_0x296427[_0x96ca('0x1d')];var _0x2957e4;if(_0x444f7f>=_0x533ef9){_0x444f7f=_0x533ef9;_0x2957e4=0xc8;}else{_0x2957e4=0xce;}_0xbb2cde[_0x96ca('0x1b')](_0x2957e4);return _0xbb2cde[_0x96ca('0x20')]('Content-Range',_0x242547+'-'+_0x444f7f+'/'+_0x533ef9)['json'](_0x509a21);}return null;};}function patchUpdates(_0x1bb3e7){return function(_0x17b9be){try{jsonpatch['apply'](_0x17b9be,_0x1bb3e7,!![]);}catch(_0x490123){return BPromise[_0x96ca('0x21')](_0x490123);}return _0x17b9be['save']();};}function saveUpdates(_0x4b6c93,_0x489c37){return function(_0x2e987f){if(_0x2e987f){return _0x2e987f[_0x96ca('0x22')](_0x4b6c93)['then'](function(_0x19006f){return _0x19006f;});}return null;};}function removeEntity(_0x4dad72,_0x45ffbd){return function(_0x155f17){if(_0x155f17){return _0x155f17[_0x96ca('0x23')]()[_0x96ca('0x24')](function(){_0x4dad72[_0x96ca('0x1b')](0xcc)[_0x96ca('0x1a')]();});}};}function handleEntityNotFound(_0x55d5a4,_0x5b9ce1){return function(_0x2cb84b){if(!_0x2cb84b){_0x55d5a4[_0x96ca('0x19')](0x194);}return _0x2cb84b;};}function handleError(_0x3214bd,_0x1e4e0a){_0x1e4e0a=_0x1e4e0a||0x1f4;return function(_0x2ec381){logger[_0x96ca('0x25')](_0x2ec381[_0x96ca('0x26')]);if(_0x2ec381['name']){delete _0x2ec381[_0x96ca('0x27')];}_0x3214bd['status'](_0x1e4e0a)[_0x96ca('0x28')](_0x2ec381);};}exports['index']=function(_0xafa8ab,_0xf2bb1){var _0x1b0988={},_0x5183cb={},_0x56b5ee={'count':0x0,'rows':[]};var _0x57411d=_[_0x96ca('0x29')](db[_0x96ca('0x2a')][_0x96ca('0x2b')],function(_0x46e7e7){return{'name':_0x46e7e7[_0x96ca('0x2c')],'type':_0x46e7e7['type']['key']};});_0x5183cb['model']=_[_0x96ca('0x29')](_0x57411d,'name');_0x5183cb[_0x96ca('0x2d')]=_[_0x96ca('0x2e')](_0xafa8ab['query']);_0x5183cb[_0x96ca('0x2f')]=_[_0x96ca('0x30')](_0x5183cb['model'],_0x5183cb[_0x96ca('0x2d')]);_0x1b0988[_0x96ca('0x31')]=_[_0x96ca('0x30')](_0x5183cb['model'],qs['fields'](_0xafa8ab[_0x96ca('0x2d')]['fields']));_0x1b0988['attributes']=_0x1b0988[_0x96ca('0x31')]['length']?_0x1b0988[_0x96ca('0x31')]:_0x5183cb[_0x96ca('0x32')];if(!_0xafa8ab[_0x96ca('0x2d')]['hasOwnProperty'](_0x96ca('0x33'))){_0x1b0988['limit']=qs[_0x96ca('0x1d')](_0xafa8ab['query'][_0x96ca('0x1d')]);_0x1b0988[_0x96ca('0x1e')]=qs['offset'](_0xafa8ab[_0x96ca('0x2d')][_0x96ca('0x1e')]);}_0x1b0988['order']=qs[_0x96ca('0x34')](_0xafa8ab['query'][_0x96ca('0x34')]);_0x1b0988[_0x96ca('0x35')]=qs[_0x96ca('0x2f')](_[_0x96ca('0x36')](_0xafa8ab[_0x96ca('0x2d')],_0x5183cb[_0x96ca('0x2f')]),_0x57411d);if(_0xafa8ab[_0x96ca('0x2d')]['filter']){_0x1b0988[_0x96ca('0x35')]=_['merge'](_0x1b0988[_0x96ca('0x35')],{'$or':_[_0x96ca('0x29')](_0x57411d,function(_0x4c92cf){if(_0x4c92cf[_0x96ca('0x37')]!==_0x96ca('0x38')){var _0x30c923={};_0x30c923[_0x4c92cf[_0x96ca('0x27')]]={'$like':'%'+_0xafa8ab[_0x96ca('0x2d')][_0x96ca('0x39')]+'%'};return _0x30c923;}})});}_0x1b0988=_['merge']({},_0x1b0988,_0xafa8ab[_0x96ca('0x3a')]);var _0x3ad69f={'where':_0x1b0988[_0x96ca('0x35')]};return db['DeskConfiguration'][_0x96ca('0x1f')](_0x3ad69f)[_0x96ca('0x24')](function(_0x1681a0){_0x56b5ee[_0x96ca('0x1f')]=_0x1681a0;if(_0xafa8ab['query'][_0x96ca('0x3b')]){_0x1b0988[_0x96ca('0x3c')]=[{'all':!![]}];}return db[_0x96ca('0x2a')]['findAll'](_0x1b0988);})[_0x96ca('0x24')](function(_0xe93184){_0x56b5ee[_0x96ca('0x3d')]=_0xe93184;return _0x56b5ee;})[_0x96ca('0x24')](respondWithFilteredResult(_0xf2bb1,_0x1b0988))[_0x96ca('0x3e')](handleError(_0xf2bb1,null));};exports['show']=function(_0x4d8f4e,_0x27f8f7){var _0x44f60d={'raw':![],'where':{'id':_0x4d8f4e[_0x96ca('0x3f')]['id']}},_0xa9ccaf={};_0xa9ccaf[_0x96ca('0x32')]=_['keys'](db[_0x96ca('0x2a')]['rawAttributes']);_0xa9ccaf[_0x96ca('0x2d')]=_['keys'](_0x4d8f4e['query']);_0xa9ccaf[_0x96ca('0x2f')]=_[_0x96ca('0x30')](_0xa9ccaf[_0x96ca('0x32')],_0xa9ccaf['query']);_0x44f60d['attributes']=_[_0x96ca('0x30')](_0xa9ccaf[_0x96ca('0x32')],qs[_0x96ca('0x40')](_0x4d8f4e[_0x96ca('0x2d')]['fields']));_0x44f60d['attributes']=_0x44f60d['attributes'][_0x96ca('0x41')]?_0x44f60d[_0x96ca('0x31')]:_0xa9ccaf['model'];if(_0x4d8f4e[_0x96ca('0x2d')][_0x96ca('0x3b')]){_0x44f60d['include']=[{'all':!![]}];}_0x44f60d=_[_0x96ca('0x42')]({},_0x44f60d,_0x4d8f4e[_0x96ca('0x3a')]);return db['DeskConfiguration']['find'](_0x44f60d)[_0x96ca('0x24')](handleEntityNotFound(_0x27f8f7,null))[_0x96ca('0x24')](respondWithResult(_0x27f8f7,null))[_0x96ca('0x3e')](handleError(_0x27f8f7,null));};exports[_0x96ca('0x43')]=function(_0xf0517,_0x1bbcda){return db[_0x96ca('0x2a')][_0x96ca('0x43')](_0xf0517[_0x96ca('0x44')],{})[_0x96ca('0x24')](respondWithResult(_0x1bbcda,0xc9))[_0x96ca('0x3e')](handleError(_0x1bbcda,null));};exports[_0x96ca('0x22')]=function(_0x55e9af,_0x1dfab2){if(_0x55e9af[_0x96ca('0x44')]['id']){delete _0x55e9af['body']['id'];}return db[_0x96ca('0x2a')]['find']({'where':{'id':_0x55e9af[_0x96ca('0x3f')]['id']}})[_0x96ca('0x24')](handleEntityNotFound(_0x1dfab2,null))[_0x96ca('0x24')](saveUpdates(_0x55e9af[_0x96ca('0x44')],null))[_0x96ca('0x24')](respondWithResult(_0x1dfab2,null))[_0x96ca('0x3e')](handleError(_0x1dfab2,null));};exports['destroy']=function(_0x409084,_0x12391e){return db[_0x96ca('0x2a')]['find']({'where':{'id':_0x409084[_0x96ca('0x3f')]['id']}})[_0x96ca('0x24')](handleEntityNotFound(_0x12391e,null))[_0x96ca('0x24')](removeEntity(_0x12391e,null))[_0x96ca('0x3e')](handleError(_0x12391e,null));};exports[_0x96ca('0x45')]=function(_0x38ab4d,_0x7da4e7,_0x86aa31){var _0x459918={};var _0xdb5116={};var _0x35d7cd;var _0x52f869;return db[_0x96ca('0x2a')]['findOne']({'where':{'id':_0x38ab4d[_0x96ca('0x3f')]['id']}})[_0x96ca('0x24')](handleEntityNotFound(_0x7da4e7,null))[_0x96ca('0x24')](function(_0x146fc6){if(_0x146fc6){_0x35d7cd=_0x146fc6;_0xdb5116[_0x96ca('0x32')]=_[_0x96ca('0x2e')](db[_0x96ca('0x46')]['rawAttributes']);_0xdb5116['query']=_[_0x96ca('0x2e')](_0x38ab4d['query']);_0xdb5116[_0x96ca('0x2f')]=_[_0x96ca('0x30')](_0xdb5116[_0x96ca('0x32')],_0xdb5116[_0x96ca('0x2d')]);_0x459918['attributes']=_[_0x96ca('0x30')](_0xdb5116['model'],qs[_0x96ca('0x40')](_0x38ab4d[_0x96ca('0x2d')][_0x96ca('0x40')]));_0x459918[_0x96ca('0x31')]=_0x459918[_0x96ca('0x31')][_0x96ca('0x41')]?_0x459918['attributes']:_0xdb5116[_0x96ca('0x32')];_0x459918[_0x96ca('0x47')]=qs['sort'](_0x38ab4d[_0x96ca('0x2d')][_0x96ca('0x34')]);_0x459918[_0x96ca('0x35')]=qs[_0x96ca('0x2f')](_['pick'](_0x38ab4d[_0x96ca('0x2d')],_0xdb5116[_0x96ca('0x2f')]));if(_0x38ab4d[_0x96ca('0x2d')]['filter']){_0x459918[_0x96ca('0x35')]=_['merge'](_0x459918[_0x96ca('0x35')],{'$or':_[_0x96ca('0x29')](_0x459918['attributes'],function(_0x4649d9){var _0x42c015={};_0x42c015[_0x4649d9]={'$like':'%'+_0x38ab4d[_0x96ca('0x2d')][_0x96ca('0x39')]+'%'};return _0x42c015;})});}_0x459918=_[_0x96ca('0x42')]({},_0x459918,_0x38ab4d['options']);return _0x35d7cd[_0x96ca('0x45')](_0x459918);}})['then'](function(_0x123018){if(_0x123018){_0x52f869=_0x123018[_0x96ca('0x41')];if(!_0x38ab4d['query'][_0x96ca('0x48')](_0x96ca('0x33'))){_0x459918[_0x96ca('0x1d')]=qs[_0x96ca('0x1d')](_0x38ab4d['query'][_0x96ca('0x1d')]);_0x459918['offset']=qs[_0x96ca('0x1e')](_0x38ab4d[_0x96ca('0x2d')][_0x96ca('0x1e')]);}return _0x35d7cd[_0x96ca('0x45')](_0x459918);}})[_0x96ca('0x24')](function(_0xd475e5){if(_0xd475e5){return _0xd475e5?{'count':_0x52f869,'rows':_0xd475e5}:null;}})['then'](respondWithResult(_0x7da4e7,null))['catch'](handleError(_0x7da4e7,null));};exports[_0x96ca('0x49')]=function(_0x12b018,_0x2b7daa,_0xfedc99){var _0xf376a4={};var _0xc5b272={};var _0x3fac55;var _0x39263d;return db[_0x96ca('0x2a')]['findOne']({'where':{'id':_0x12b018[_0x96ca('0x3f')]['id']}})[_0x96ca('0x24')](handleEntityNotFound(_0x2b7daa,null))['then'](function(_0x4e8636){if(_0x4e8636){_0x3fac55=_0x4e8636;_0xc5b272['model']=_[_0x96ca('0x2e')](db['DeskField']['rawAttributes']);_0xc5b272[_0x96ca('0x2d')]=_['keys'](_0x12b018[_0x96ca('0x2d')]);_0xc5b272[_0x96ca('0x2f')]=_['intersection'](_0xc5b272['model'],_0xc5b272[_0x96ca('0x2d')]);_0xf376a4[_0x96ca('0x31')]=_[_0x96ca('0x30')](_0xc5b272['model'],qs[_0x96ca('0x40')](_0x12b018[_0x96ca('0x2d')][_0x96ca('0x40')]));_0xf376a4['attributes']=_0xf376a4[_0x96ca('0x31')][_0x96ca('0x41')]?_0xf376a4[_0x96ca('0x31')]:_0xc5b272[_0x96ca('0x32')];_0xf376a4[_0x96ca('0x47')]=qs['sort'](_0x12b018[_0x96ca('0x2d')][_0x96ca('0x34')]);_0xf376a4[_0x96ca('0x35')]=qs['filters'](_[_0x96ca('0x36')](_0x12b018[_0x96ca('0x2d')],_0xc5b272['filters']));if(_0x12b018[_0x96ca('0x2d')][_0x96ca('0x39')]){_0xf376a4[_0x96ca('0x35')]=_[_0x96ca('0x42')](_0xf376a4[_0x96ca('0x35')],{'$or':_[_0x96ca('0x29')](_0xf376a4['attributes'],function(_0xfaf814){var _0x168030={};_0x168030[_0xfaf814]={'$like':'%'+_0x12b018[_0x96ca('0x2d')][_0x96ca('0x39')]+'%'};return _0x168030;})});}_0xf376a4=_[_0x96ca('0x42')]({},_0xf376a4,_0x12b018[_0x96ca('0x3a')]);return _0x3fac55[_0x96ca('0x49')](_0xf376a4);}})[_0x96ca('0x24')](function(_0x1c9e06){if(_0x1c9e06){_0x39263d=_0x1c9e06[_0x96ca('0x41')];if(!_0x12b018['query']['hasOwnProperty']('nolimit')){_0xf376a4[_0x96ca('0x1d')]=qs[_0x96ca('0x1d')](_0x12b018[_0x96ca('0x2d')][_0x96ca('0x1d')]);_0xf376a4[_0x96ca('0x1e')]=qs[_0x96ca('0x1e')](_0x12b018['query']['offset']);}return _0x3fac55[_0x96ca('0x49')](_0xf376a4);}})[_0x96ca('0x24')](function(_0x28bf3e){if(_0x28bf3e){return _0x28bf3e?{'count':_0x39263d,'rows':_0x28bf3e}:null;}})[_0x96ca('0x24')](respondWithResult(_0x2b7daa,null))[_0x96ca('0x3e')](handleError(_0x2b7daa,null));};exports['getDescriptions']=function(_0x2599bc,_0x299e0f,_0x24ff19){var _0x2f6ae1={};var _0x4fb61a={};var _0x2fc366;var _0x2bfe78;return db[_0x96ca('0x2a')]['findOne']({'where':{'id':_0x2599bc['params']['id']}})[_0x96ca('0x24')](handleEntityNotFound(_0x299e0f,null))[_0x96ca('0x24')](function(_0x1ee375){if(_0x1ee375){_0x2fc366=_0x1ee375;_0x4fb61a[_0x96ca('0x32')]=_[_0x96ca('0x2e')](db[_0x96ca('0x46')]['rawAttributes']);_0x4fb61a[_0x96ca('0x2d')]=_['keys'](_0x2599bc[_0x96ca('0x2d')]);_0x4fb61a[_0x96ca('0x2f')]=_[_0x96ca('0x30')](_0x4fb61a[_0x96ca('0x32')],_0x4fb61a[_0x96ca('0x2d')]);_0x2f6ae1[_0x96ca('0x31')]=_[_0x96ca('0x30')](_0x4fb61a[_0x96ca('0x32')],qs[_0x96ca('0x40')](_0x2599bc[_0x96ca('0x2d')][_0x96ca('0x40')]));_0x2f6ae1[_0x96ca('0x31')]=_0x2f6ae1[_0x96ca('0x31')][_0x96ca('0x41')]?_0x2f6ae1[_0x96ca('0x31')]:_0x4fb61a[_0x96ca('0x32')];_0x2f6ae1['order']=qs['sort'](_0x2599bc[_0x96ca('0x2d')]['sort']);_0x2f6ae1[_0x96ca('0x35')]=qs[_0x96ca('0x2f')](_['pick'](_0x2599bc[_0x96ca('0x2d')],_0x4fb61a[_0x96ca('0x2f')]));if(_0x2599bc[_0x96ca('0x2d')][_0x96ca('0x39')]){_0x2f6ae1[_0x96ca('0x35')]=_[_0x96ca('0x42')](_0x2f6ae1[_0x96ca('0x35')],{'$or':_[_0x96ca('0x29')](_0x2f6ae1[_0x96ca('0x31')],function(_0xd076c2){var _0x5cdf5e={};_0x5cdf5e[_0xd076c2]={'$like':'%'+_0x2599bc[_0x96ca('0x2d')][_0x96ca('0x39')]+'%'};return _0x5cdf5e;})});}_0x2f6ae1=_[_0x96ca('0x42')]({},_0x2f6ae1,_0x2599bc[_0x96ca('0x3a')]);return _0x2fc366[_0x96ca('0x4a')](_0x2f6ae1);}})[_0x96ca('0x24')](function(_0x259b44){if(_0x259b44){_0x2bfe78=_0x259b44[_0x96ca('0x41')];if(!_0x2599bc[_0x96ca('0x2d')]['hasOwnProperty']('nolimit')){_0x2f6ae1[_0x96ca('0x1d')]=qs[_0x96ca('0x1d')](_0x2599bc[_0x96ca('0x2d')]['limit']);_0x2f6ae1['offset']=qs['offset'](_0x2599bc[_0x96ca('0x2d')]['offset']);}return _0x2fc366[_0x96ca('0x4a')](_0x2f6ae1);}})[_0x96ca('0x24')](function(_0x6dcd1c){if(_0x6dcd1c){return _0x6dcd1c?{'count':_0x2bfe78,'rows':_0x6dcd1c}:null;}})[_0x96ca('0x24')](respondWithResult(_0x299e0f,null))[_0x96ca('0x3e')](handleError(_0x299e0f,null));};exports[_0x96ca('0x4b')]=function(_0x256dad,_0x517c4a,_0x24649a){var _0x273f44={};var _0x2f967a={};var _0x4016f7;var _0x1d82b4;return db[_0x96ca('0x2a')][_0x96ca('0x4c')]({'where':{'id':_0x256dad[_0x96ca('0x3f')]['id']}})[_0x96ca('0x24')](handleEntityNotFound(_0x517c4a,null))['then'](function(_0x40ce18){if(_0x40ce18){_0x4016f7=_0x40ce18;_0x2f967a[_0x96ca('0x32')]=_[_0x96ca('0x2e')](db[_0x96ca('0x4d')][_0x96ca('0x2b')]);_0x2f967a[_0x96ca('0x2d')]=_[_0x96ca('0x2e')](_0x256dad['query']);_0x2f967a[_0x96ca('0x2f')]=_[_0x96ca('0x30')](_0x2f967a[_0x96ca('0x32')],_0x2f967a[_0x96ca('0x2d')]);_0x273f44[_0x96ca('0x31')]=_[_0x96ca('0x30')](_0x2f967a[_0x96ca('0x32')],qs[_0x96ca('0x40')](_0x256dad[_0x96ca('0x2d')][_0x96ca('0x40')]));_0x273f44[_0x96ca('0x31')]=_0x273f44[_0x96ca('0x31')]['length']?_0x273f44[_0x96ca('0x31')]:_0x2f967a[_0x96ca('0x32')];_0x273f44[_0x96ca('0x47')]=qs['sort'](_0x256dad[_0x96ca('0x2d')][_0x96ca('0x34')]);_0x273f44[_0x96ca('0x35')]=qs[_0x96ca('0x2f')](_['pick'](_0x256dad['query'],_0x2f967a['filters']));if(_0x256dad['query'][_0x96ca('0x39')]){_0x273f44[_0x96ca('0x35')]=_['merge'](_0x273f44['where'],{'$or':_[_0x96ca('0x29')](_0x273f44[_0x96ca('0x31')],function(_0x4ae929){var _0x290f5a={};_0x290f5a[_0x4ae929]={'$like':'%'+_0x256dad[_0x96ca('0x2d')][_0x96ca('0x39')]+'%'};return _0x290f5a;})});}_0x273f44=_[_0x96ca('0x42')]({},_0x273f44,_0x256dad['options']);return _0x4016f7[_0x96ca('0x4b')](_0x273f44);}})[_0x96ca('0x24')](function(_0x59d0c5){if(_0x59d0c5){_0x1d82b4=_0x59d0c5[_0x96ca('0x41')];if(!_0x256dad[_0x96ca('0x2d')][_0x96ca('0x48')](_0x96ca('0x33'))){_0x273f44['limit']=qs[_0x96ca('0x1d')](_0x256dad[_0x96ca('0x2d')][_0x96ca('0x1d')]);_0x273f44['offset']=qs['offset'](_0x256dad[_0x96ca('0x2d')][_0x96ca('0x1e')]);}return _0x4016f7['getTags'](_0x273f44);}})[_0x96ca('0x24')](function(_0x26db57){if(_0x26db57){return _0x26db57?{'count':_0x1d82b4,'rows':_0x26db57}:null;}})[_0x96ca('0x24')](respondWithResult(_0x517c4a,null))['catch'](handleError(_0x517c4a,null));};exports[_0x96ca('0x4e')]=function(_0x3937f6,_0x35535d,_0x19430e){if(_0x3937f6[_0x96ca('0x44')]['id']){delete _0x3937f6[_0x96ca('0x44')]['id'];}return db[_0x96ca('0x2a')][_0x96ca('0x4c')]({'where':{'id':_0x3937f6['params']['id']}})['then'](handleEntityNotFound(_0x35535d,null))['then'](function(_0x3828cc){if(_0x3828cc){return _0x3828cc[_0x96ca('0x4e')](_0x3937f6['body']['ids']||[]);}return null;})[_0x96ca('0x24')](respondWithResult(_0x35535d,null))[_0x96ca('0x3e')](handleError(_0x35535d,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 8381363..85d8113 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 _0x938c=['request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','lodash','util','api'];(function(_0x21826c,_0x146cbf){var _0x4f7be8=function(_0x2a6d48){while(--_0x2a6d48){_0x21826c['push'](_0x21826c['shift']());}};_0x4f7be8(++_0x146cbf);}(_0x938c,0x11f));var _0xc938=function(_0x5e2a4a,_0x469e5f){_0x5e2a4a=_0x5e2a4a-0x0;var _0x2eb5a7=_0x938c[_0x5e2a4a];return _0x2eb5a7;};'use strict';var _=require(_0xc938('0x0'));var util=require(_0xc938('0x1'));var logger=require('../../config/logger')(_0xc938('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc938('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc938('0x4'));var config=require(_0xc938('0x5'));var attributes=require(_0xc938('0x6'));module[_0xc938('0x7')]=function(_0x235110,_0x8cfbb6){return _0x235110['define'](_0xc938('0x8'),attributes,{'tableName':_0xc938('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf304=['int_desk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xf304,0x1eb));var _0x4f30=function(_0x190dbe,_0x13cb87){_0x190dbe=_0x190dbe-0x0;var _0x158330=_0xf304[_0x190dbe];return _0x158330;};'use strict';var _=require(_0x4f30('0x0'));var util=require('util');var logger=require(_0x4f30('0x1'))(_0x4f30('0x2'));var moment=require(_0x4f30('0x3'));var BPromise=require(_0x4f30('0x4'));var rp=require(_0x4f30('0x5'));var fs=require('fs');var path=require(_0x4f30('0x6'));var rimraf=require(_0x4f30('0x7'));var config=require(_0x4f30('0x8'));var attributes=require(_0x4f30('0x9'));module[_0x4f30('0xa')]=function(_0x3f3199,_0x3a99d3){return _0x3f3199[_0x4f30('0xb')](_0x4f30('0xc'),attributes,{'tableName':_0x4f30('0xd'),'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 406d8a5..395567c 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 _0xb145=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','DeskConfiguration,\x20%s,\x20%s','message'];(function(_0x4381ca,_0x57672e){var _0x40c459=function(_0x22623c){while(--_0x22623c){_0x4381ca['push'](_0x4381ca['shift']());}};_0x40c459(++_0x57672e);}(_0xb145,0xa3));var _0x5b14=function(_0xe63574,_0xe5e6af){_0xe63574=_0xe63574-0x0;var _0x4b8afd=_0xb145[_0xe63574];return _0x4b8afd;};'use strict';var _=require('lodash');var util=require(_0x5b14('0x0'));var moment=require(_0x5b14('0x1'));var BPromise=require(_0x5b14('0x2'));var rs=require(_0x5b14('0x3'));var fs=require('fs');var Redis=require(_0x5b14('0x4'));var db=require(_0x5b14('0x5'))['db'];var utils=require(_0x5b14('0x6'));var logger=require(_0x5b14('0x7'))('rpc');var config=require(_0x5b14('0x8'));var jayson=require(_0x5b14('0x9'));var client=jayson[_0x5b14('0xa')][_0x5b14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50fd91,_0x1d12ed,_0x2a3921){return new BPromise(function(_0x34530a,_0x62cdcd){return client[_0x5b14('0xc')](_0x50fd91,_0x2a3921)['then'](function(_0x32d729){logger[_0x5b14('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x1d12ed,_0x5b14('0xe'));logger[_0x5b14('0xf')](_0x5b14('0x10'),_0x1d12ed,_0x5b14('0xe'),JSON[_0x5b14('0x11')](_0x32d729));if(_0x32d729['error']){if(_0x32d729[_0x5b14('0x12')]['code']===0x1f4){logger[_0x5b14('0x12')](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x62cdcd(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);return _0x34530a(_0x32d729[_0x5b14('0x12')][_0x5b14('0x14')]);}else{logger[_0x5b14('0xd')](_0x5b14('0x13'),_0x1d12ed,_0x5b14('0xe'));_0x34530a(_0x32d729[_0x5b14('0x15')][_0x5b14('0x14')]);}})[_0x5b14('0x16')](function(_0x2c3efb){logger['error'](_0x5b14('0x13'),_0x1d12ed,_0x2c3efb);_0x62cdcd(_0x2c3efb);});});} \ No newline at end of file +var _0xa1a4=['request','then','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','DeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xf77ad,_0x1641db){var _0x24bbb1=function(_0xea77cc){while(--_0xea77cc){_0xf77ad['push'](_0xf77ad['shift']());}};_0x24bbb1(++_0x1641db);}(_0xa1a4,0x11f));var _0x4a1a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xa1a4[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x4a1a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4a1a('0x1'));var rs=require(_0x4a1a('0x2'));var fs=require('fs');var Redis=require(_0x4a1a('0x3'));var db=require(_0x4a1a('0x4'))['db'];var utils=require(_0x4a1a('0x5'));var logger=require(_0x4a1a('0x6'))(_0x4a1a('0x7'));var config=require(_0x4a1a('0x8'));var jayson=require(_0x4a1a('0x9'));var client=jayson[_0x4a1a('0xa')][_0x4a1a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16bb6d,_0x4b90f0,_0x6109cc){return new BPromise(function(_0x51c432,_0xcd0771){return client[_0x4a1a('0xc')](_0x16bb6d,_0x6109cc)[_0x4a1a('0xd')](function(_0x27238a){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x4b90f0,'request\x20sent');logger['debug'](_0x4a1a('0xe'),_0x4b90f0,_0x4a1a('0xf'),JSON[_0x4a1a('0x10')](_0x27238a));if(_0x27238a[_0x4a1a('0x11')]){if(_0x27238a[_0x4a1a('0x11')]['code']===0x1f4){logger[_0x4a1a('0x11')](_0x4a1a('0x12'),_0x4b90f0,_0x27238a[_0x4a1a('0x11')][_0x4a1a('0x13')]);return _0xcd0771(_0x27238a[_0x4a1a('0x11')][_0x4a1a('0x13')]);}logger['error'](_0x4a1a('0x12'),_0x4b90f0,_0x27238a[_0x4a1a('0x11')][_0x4a1a('0x13')]);return _0x51c432(_0x27238a['error'][_0x4a1a('0x13')]);}else{logger[_0x4a1a('0x14')](_0x4a1a('0x12'),_0x4b90f0,'request\x20sent');_0x51c432(_0x27238a[_0x4a1a('0x15')][_0x4a1a('0x13')]);}})[_0x4a1a('0x16')](function(_0x36c55d){logger[_0x4a1a('0x11')](_0x4a1a('0x12'),_0x4b90f0,_0x36c55d);_0xcd0771(_0x36c55d);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index b5b4c8b..7aed061 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 _0xff6f=['../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2de630,_0x534adc){var _0x35259e=function(_0x5672a3){while(--_0x5672a3){_0x2de630['push'](_0x2de630['shift']());}};_0x35259e(++_0x534adc);}(_0xff6f,0x11e));var _0xfff6=function(_0x26d616,_0x25cb01){_0x26d616=_0x26d616-0x0;var _0xedbee=_0xff6f[_0x26d616];return _0xedbee;};'use strict';var multer=require(_0xfff6('0x0'));var util=require(_0xfff6('0x1'));var path=require(_0xfff6('0x2'));var timeout=require(_0xfff6('0x3'));var express=require(_0xfff6('0x4'));var router=express[_0xfff6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfff6('0x6'));var interaction=require(_0xfff6('0x7'));var config=require(_0xfff6('0x8'));var controller=require('./intDeskField.controller');router[_0xfff6('0x9')]('/',auth['isAuthenticated'](),controller[_0xfff6('0xa')]);router[_0xfff6('0x9')](_0xfff6('0xb'),auth[_0xfff6('0xc')](),controller[_0xfff6('0xd')]);router[_0xfff6('0xe')]('/',auth[_0xfff6('0xc')](),controller[_0xfff6('0xf')]);router[_0xfff6('0x10')](_0xfff6('0xb'),auth['isAuthenticated'](),controller[_0xfff6('0x11')]);router[_0xfff6('0x12')](_0xfff6('0xb'),auth[_0xfff6('0xc')](),controller[_0xfff6('0x13')]);module[_0xfff6('0x14')]=router; \ No newline at end of file +var _0xfaf6=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','util'];(function(_0x4290ef,_0x570c71){var _0x7410f4=function(_0x1af97c){while(--_0x1af97c){_0x4290ef['push'](_0x4290ef['shift']());}};_0x7410f4(++_0x570c71);}(_0xfaf6,0x175));var _0x6faf=function(_0x5a39e7,_0x3426b4){_0x5a39e7=_0x5a39e7-0x0;var _0x5b230b=_0xfaf6[_0x5a39e7];return _0x5b230b;};'use strict';var multer=require('multer');var util=require(_0x6faf('0x0'));var path=require(_0x6faf('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6faf('0x2')]();var fs_extra=require(_0x6faf('0x3'));var auth=require(_0x6faf('0x4'));var interaction=require(_0x6faf('0x5'));var config=require(_0x6faf('0x6'));var controller=require(_0x6faf('0x7'));router[_0x6faf('0x8')]('/',auth[_0x6faf('0x9')](),controller[_0x6faf('0xa')]);router[_0x6faf('0x8')](_0x6faf('0xb'),auth[_0x6faf('0x9')](),controller[_0x6faf('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6faf('0xd')]);router[_0x6faf('0xe')](_0x6faf('0xb'),auth[_0x6faf('0x9')](),controller[_0x6faf('0xf')]);router[_0x6faf('0x10')](_0x6faf('0xb'),auth[_0x6faf('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index ff0e24c..c6e3e7b 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 _0x57f7=['BOOLEAN','sequelize','exports','variable','customVariable','string','STRING'];(function(_0x208505,_0x241a77){var _0x1a985f=function(_0x4a5110){while(--_0x4a5110){_0x208505['push'](_0x208505['shift']());}};_0x1a985f(++_0x241a77);}(_0x57f7,0x120));var _0x757f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x57f7[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x757f('0x0'));module[_0x757f('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x757f('0x2'),_0x757f('0x3'),'keyValue','picklist'),'defaultValue':_0x757f('0x4')},'content':{'type':Sequelize[_0x757f('0x5')]},'key':{'type':Sequelize[_0x757f('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x757f('0x4'),_0x757f('0x2'),_0x757f('0x3'))},'keyContent':{'type':Sequelize[_0x757f('0x5')]},'idField':{'type':Sequelize[_0x757f('0x5')]},'nameField':{'type':Sequelize[_0x757f('0x5')]},'customField':{'type':Sequelize[_0x757f('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x757f('0x5')]}}; \ No newline at end of file +var _0x98e3=['BOOLEAN','sequelize','exports','string','variable','customVariable','picklist','STRING','ENUM'];(function(_0x519163,_0x103cb9){var _0x3c281c=function(_0x47f435){while(--_0x47f435){_0x519163['push'](_0x519163['shift']());}};_0x3c281c(++_0x103cb9);}(_0x98e3,0xac));var _0x398e=function(_0xbb274f,_0x21a686){_0xbb274f=_0xbb274f-0x0;var _0x50478d=_0x98e3[_0xbb274f];return _0x50478d;};'use strict';var Sequelize=require(_0x398e('0x0'));module[_0x398e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x398e('0x2'),_0x398e('0x3'),_0x398e('0x4'),'keyValue',_0x398e('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x398e('0x6')]},'key':{'type':Sequelize[_0x398e('0x6')]},'keyType':{'type':Sequelize[_0x398e('0x7')](_0x398e('0x2'),_0x398e('0x3'),_0x398e('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x398e('0x6')]},'customField':{'type':Sequelize[_0x398e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x398e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index addcfa3..e816734 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 _0xea68=['reject','update','then','destroy','sendStatus','error','stack','name','send','index','DeskField','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x553502,_0x4d2c0c){var _0x246c37=function(_0x36698a){while(--_0x36698a){_0x553502['push'](_0x553502['shift']());}};_0x246c37(++_0x4d2c0c);}(_0xea68,0x77));var _0x8ea6=function(_0x2499b1,_0x26ca1b){_0x2499b1=_0x2499b1-0x0;var _0x5d9d24=_0xea68[_0x2499b1];return _0x5d9d24;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8ea6('0x0'));var moment=require(_0x8ea6('0x1'));var BPromise=require(_0x8ea6('0x2'));var Mustache=require(_0x8ea6('0x3'));var util=require(_0x8ea6('0x4'));var path=require(_0x8ea6('0x5'));var sox=require(_0x8ea6('0x6'));var csv=require(_0x8ea6('0x7'));var ejs=require(_0x8ea6('0x8'));var fs=require('fs');var fs_extra=require(_0x8ea6('0x9'));var _=require('lodash');var squel=require(_0x8ea6('0xa'));var crypto=require(_0x8ea6('0xb'));var jsforce=require(_0x8ea6('0xc'));var deskjs=require(_0x8ea6('0xd'));var toCsv=require(_0x8ea6('0x7'));var querystring=require(_0x8ea6('0xe'));var Papa=require(_0x8ea6('0xf'));var Redis=require('ioredis');var authService=require(_0x8ea6('0x10'));var qs=require(_0x8ea6('0x11'));var as=require(_0x8ea6('0x12'));var hardwareService=require(_0x8ea6('0x13'));var logger=require('../../config/logger')(_0x8ea6('0x14'));var utils=require(_0x8ea6('0x15'));var config=require(_0x8ea6('0x16'));var licenseUtil=require(_0x8ea6('0x17'));var db=require(_0x8ea6('0x18'))['db'];function respondWithStatusCode(_0x35ae46,_0x1aebe4){_0x1aebe4=_0x1aebe4||0xcc;return function(_0x3969d6){if(_0x3969d6){return _0x35ae46['sendStatus'](_0x1aebe4);}return _0x35ae46['status'](_0x1aebe4)[_0x8ea6('0x19')]();};}function respondWithResult(_0x3ed92a,_0x1c9d94){_0x1c9d94=_0x1c9d94||0xc8;return function(_0x506020){if(_0x506020){return _0x3ed92a[_0x8ea6('0x1a')](_0x1c9d94)[_0x8ea6('0x1b')](_0x506020);}};}function respondWithFilteredResult(_0x431a69,_0x1d53a9){return function(_0x51b544){if(_0x51b544){var _0x209053=typeof _0x1d53a9[_0x8ea6('0x1c')]===_0x8ea6('0x1d')&&typeof _0x1d53a9[_0x8ea6('0x1e')]===_0x8ea6('0x1d');var _0x56a36d=_0x51b544[_0x8ea6('0x1f')];var _0x10945b=_0x209053?0x0:_0x1d53a9['offset'];var _0x29b279=_0x209053?_0x51b544['count']:_0x1d53a9[_0x8ea6('0x1c')]+_0x1d53a9['limit'];var _0x3af156;if(_0x29b279>=_0x56a36d){_0x29b279=_0x56a36d;_0x3af156=0xc8;}else{_0x3af156=0xce;}_0x431a69[_0x8ea6('0x1a')](_0x3af156);return _0x431a69[_0x8ea6('0x20')](_0x8ea6('0x21'),_0x10945b+'-'+_0x29b279+'/'+_0x56a36d)[_0x8ea6('0x1b')](_0x51b544);}return null;};}function patchUpdates(_0x2919b8){return function(_0x3ee726){try{jsonpatch[_0x8ea6('0x22')](_0x3ee726,_0x2919b8,!![]);}catch(_0x2fc860){return BPromise[_0x8ea6('0x23')](_0x2fc860);}return _0x3ee726['save']();};}function saveUpdates(_0x5e0d0f,_0x1668c0){return function(_0x2a1486){if(_0x2a1486){return _0x2a1486[_0x8ea6('0x24')](_0x5e0d0f)[_0x8ea6('0x25')](function(_0x273b3b){return _0x273b3b;});}return null;};}function removeEntity(_0x15fa38,_0x4a5530){return function(_0x3fd7eb){if(_0x3fd7eb){return _0x3fd7eb[_0x8ea6('0x26')]()[_0x8ea6('0x25')](function(){_0x15fa38['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26c6d8,_0x3cc3f1){return function(_0x102da4){if(!_0x102da4){_0x26c6d8[_0x8ea6('0x27')](0x194);}return _0x102da4;};}function handleError(_0x3aebc6,_0x4dfc18){_0x4dfc18=_0x4dfc18||0x1f4;return function(_0xb510b7){logger[_0x8ea6('0x28')](_0xb510b7[_0x8ea6('0x29')]);if(_0xb510b7[_0x8ea6('0x2a')]){delete _0xb510b7[_0x8ea6('0x2a')];}_0x3aebc6[_0x8ea6('0x1a')](_0x4dfc18)[_0x8ea6('0x2b')](_0xb510b7);};}exports[_0x8ea6('0x2c')]=function(_0x536d3e,_0x13f547){var _0x26afb4={},_0x20a3a0={},_0x1054ab={'count':0x0,'rows':[]};var _0x19e405=_['map'](db[_0x8ea6('0x2d')][_0x8ea6('0x2e')],function(_0x10d465){return{'name':_0x10d465[_0x8ea6('0x2f')],'type':_0x10d465[_0x8ea6('0x30')]['key']};});_0x20a3a0[_0x8ea6('0x31')]=_[_0x8ea6('0x32')](_0x19e405,'name');_0x20a3a0[_0x8ea6('0x33')]=_[_0x8ea6('0x34')](_0x536d3e[_0x8ea6('0x33')]);_0x20a3a0['filters']=_[_0x8ea6('0x35')](_0x20a3a0['model'],_0x20a3a0['query']);_0x26afb4[_0x8ea6('0x36')]=_[_0x8ea6('0x35')](_0x20a3a0[_0x8ea6('0x31')],qs[_0x8ea6('0x37')](_0x536d3e['query'][_0x8ea6('0x37')]));_0x26afb4[_0x8ea6('0x36')]=_0x26afb4[_0x8ea6('0x36')][_0x8ea6('0x38')]?_0x26afb4[_0x8ea6('0x36')]:_0x20a3a0[_0x8ea6('0x31')];if(!_0x536d3e[_0x8ea6('0x33')][_0x8ea6('0x39')](_0x8ea6('0x3a'))){_0x26afb4[_0x8ea6('0x1e')]=qs[_0x8ea6('0x1e')](_0x536d3e[_0x8ea6('0x33')]['limit']);_0x26afb4[_0x8ea6('0x1c')]=qs[_0x8ea6('0x1c')](_0x536d3e[_0x8ea6('0x33')][_0x8ea6('0x1c')]);}_0x26afb4['order']=qs['sort'](_0x536d3e[_0x8ea6('0x33')][_0x8ea6('0x3b')]);_0x26afb4[_0x8ea6('0x3c')]=qs[_0x8ea6('0x3d')](_[_0x8ea6('0x3e')](_0x536d3e[_0x8ea6('0x33')],_0x20a3a0['filters']),_0x19e405);if(_0x536d3e[_0x8ea6('0x33')]['filter']){_0x26afb4['where']=_[_0x8ea6('0x3f')](_0x26afb4[_0x8ea6('0x3c')],{'$or':_['map'](_0x19e405,function(_0x126c80){if(_0x126c80[_0x8ea6('0x30')]!==_0x8ea6('0x40')){var _0x4e1f88={};_0x4e1f88[_0x126c80['name']]={'$like':'%'+_0x536d3e[_0x8ea6('0x33')][_0x8ea6('0x41')]+'%'};return _0x4e1f88;}})});}_0x26afb4=_[_0x8ea6('0x3f')]({},_0x26afb4,_0x536d3e[_0x8ea6('0x42')]);var _0x48db97={'where':_0x26afb4[_0x8ea6('0x3c')]};return db[_0x8ea6('0x2d')][_0x8ea6('0x1f')](_0x48db97)[_0x8ea6('0x25')](function(_0x34d55b){_0x1054ab[_0x8ea6('0x1f')]=_0x34d55b;if(_0x536d3e['query'][_0x8ea6('0x43')]){_0x26afb4[_0x8ea6('0x44')]=[{'all':!![]}];}return db[_0x8ea6('0x2d')][_0x8ea6('0x45')](_0x26afb4);})['then'](function(_0x464d22){_0x1054ab[_0x8ea6('0x46')]=_0x464d22;return _0x1054ab;})['then'](respondWithFilteredResult(_0x13f547,_0x26afb4))[_0x8ea6('0x47')](handleError(_0x13f547,null));};exports[_0x8ea6('0x48')]=function(_0xa735e3,_0x48cd47){var _0xc036e4={'raw':!![],'where':{'id':_0xa735e3['params']['id']}},_0x1ca0a4={};_0x1ca0a4[_0x8ea6('0x31')]=_['keys'](db[_0x8ea6('0x2d')][_0x8ea6('0x2e')]);_0x1ca0a4['query']=_[_0x8ea6('0x34')](_0xa735e3[_0x8ea6('0x33')]);_0x1ca0a4['filters']=_['intersection'](_0x1ca0a4[_0x8ea6('0x31')],_0x1ca0a4[_0x8ea6('0x33')]);_0xc036e4[_0x8ea6('0x36')]=_['intersection'](_0x1ca0a4[_0x8ea6('0x31')],qs[_0x8ea6('0x37')](_0xa735e3['query'][_0x8ea6('0x37')]));_0xc036e4['attributes']=_0xc036e4[_0x8ea6('0x36')]['length']?_0xc036e4['attributes']:_0x1ca0a4[_0x8ea6('0x31')];if(_0xa735e3[_0x8ea6('0x33')][_0x8ea6('0x43')]){_0xc036e4[_0x8ea6('0x44')]=[{'all':!![]}];}_0xc036e4=_['merge']({},_0xc036e4,_0xa735e3[_0x8ea6('0x42')]);return db[_0x8ea6('0x2d')][_0x8ea6('0x49')](_0xc036e4)[_0x8ea6('0x25')](handleEntityNotFound(_0x48cd47,null))['then'](respondWithResult(_0x48cd47,null))[_0x8ea6('0x47')](handleError(_0x48cd47,null));};exports[_0x8ea6('0x4a')]=function(_0x3de81d,_0x317a0f){return db[_0x8ea6('0x2d')][_0x8ea6('0x4a')](_0x3de81d[_0x8ea6('0x4b')],{})[_0x8ea6('0x25')](respondWithResult(_0x317a0f,0xc9))['catch'](handleError(_0x317a0f,null));};exports[_0x8ea6('0x24')]=function(_0x27363b,_0x3850dc){if(_0x27363b['body']['id']){delete _0x27363b[_0x8ea6('0x4b')]['id'];}return db[_0x8ea6('0x2d')]['find']({'where':{'id':_0x27363b[_0x8ea6('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3850dc,null))[_0x8ea6('0x25')](saveUpdates(_0x27363b[_0x8ea6('0x4b')],null))[_0x8ea6('0x25')](respondWithResult(_0x3850dc,null))['catch'](handleError(_0x3850dc,null));};exports[_0x8ea6('0x26')]=function(_0x1767b2,_0x5cdf5f){return db[_0x8ea6('0x2d')][_0x8ea6('0x49')]({'where':{'id':_0x1767b2[_0x8ea6('0x4c')]['id']}})[_0x8ea6('0x25')](handleEntityNotFound(_0x5cdf5f,null))[_0x8ea6('0x25')](removeEntity(_0x5cdf5f,null))[_0x8ea6('0x47')](handleError(_0x5cdf5f,null));}; \ No newline at end of file +var _0xef9e=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','sort','where','filters','pick','filter','merge','VIRTUAL','options','DeskField','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x741339,_0x39d3c9){var _0x47ec64=function(_0x182e7e){while(--_0x182e7e){_0x741339['push'](_0x741339['shift']());}};_0x47ec64(++_0x39d3c9);}(_0xef9e,0x1ef));var _0xeef9=function(_0x98a7f4,_0x26a940){_0x98a7f4=_0x98a7f4-0x0;var _0x1d8a5a=_0xef9e[_0x98a7f4];return _0x1d8a5a;};'use strict';var emlformat=require(_0xeef9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeef9('0x1'));var jsonpatch=require(_0xeef9('0x2'));var rp=require(_0xeef9('0x3'));var moment=require(_0xeef9('0x4'));var BPromise=require(_0xeef9('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xeef9('0x6'));var sox=require(_0xeef9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeef9('0x8'));var _=require(_0xeef9('0x9'));var squel=require(_0xeef9('0xa'));var crypto=require('crypto');var jsforce=require(_0xeef9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xeef9('0xc'));var querystring=require(_0xeef9('0xd'));var Papa=require(_0xeef9('0xe'));var Redis=require(_0xeef9('0xf'));var authService=require(_0xeef9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xeef9('0x11'));var hardwareService=require(_0xeef9('0x12'));var logger=require(_0xeef9('0x13'))(_0xeef9('0x14'));var utils=require(_0xeef9('0x15'));var config=require(_0xeef9('0x16'));var licenseUtil=require(_0xeef9('0x17'));var db=require(_0xeef9('0x18'))['db'];function respondWithStatusCode(_0x5aceb1,_0x4a2e48){_0x4a2e48=_0x4a2e48||0xcc;return function(_0x1fbd25){if(_0x1fbd25){return _0x5aceb1[_0xeef9('0x19')](_0x4a2e48);}return _0x5aceb1[_0xeef9('0x1a')](_0x4a2e48)[_0xeef9('0x1b')]();};}function respondWithResult(_0x511899,_0x3ea6ab){_0x3ea6ab=_0x3ea6ab||0xc8;return function(_0x43c208){if(_0x43c208){return _0x511899[_0xeef9('0x1a')](_0x3ea6ab)[_0xeef9('0x1c')](_0x43c208);}};}function respondWithFilteredResult(_0x2c1ad5,_0x191c11){return function(_0x5492f5){if(_0x5492f5){var _0x112657=typeof _0x191c11[_0xeef9('0x1d')]===_0xeef9('0x1e')&&typeof _0x191c11[_0xeef9('0x1f')]==='undefined';var _0x40458b=_0x5492f5[_0xeef9('0x20')];var _0x5eaab0=_0x112657?0x0:_0x191c11['offset'];var _0x3176ef=_0x112657?_0x5492f5[_0xeef9('0x20')]:_0x191c11[_0xeef9('0x1d')]+_0x191c11['limit'];var _0x385f37;if(_0x3176ef>=_0x40458b){_0x3176ef=_0x40458b;_0x385f37=0xc8;}else{_0x385f37=0xce;}_0x2c1ad5['status'](_0x385f37);return _0x2c1ad5[_0xeef9('0x21')](_0xeef9('0x22'),_0x5eaab0+'-'+_0x3176ef+'/'+_0x40458b)[_0xeef9('0x1c')](_0x5492f5);}return null;};}function patchUpdates(_0x4b1085){return function(_0x546fe5){try{jsonpatch['apply'](_0x546fe5,_0x4b1085,!![]);}catch(_0x5893bc){return BPromise['reject'](_0x5893bc);}return _0x546fe5[_0xeef9('0x23')]();};}function saveUpdates(_0x44c935,_0x2ac7e0){return function(_0x3e93a2){if(_0x3e93a2){return _0x3e93a2['update'](_0x44c935)[_0xeef9('0x24')](function(_0x488fc5){return _0x488fc5;});}return null;};}function removeEntity(_0x5c325f,_0x31190f){return function(_0x365466){if(_0x365466){return _0x365466[_0xeef9('0x25')]()[_0xeef9('0x24')](function(){_0x5c325f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59cbc0,_0x271a8d){return function(_0x3cddab){if(!_0x3cddab){_0x59cbc0[_0xeef9('0x19')](0x194);}return _0x3cddab;};}function handleError(_0x10be35,_0x30c876){_0x30c876=_0x30c876||0x1f4;return function(_0x53fece){logger[_0xeef9('0x26')](_0x53fece[_0xeef9('0x27')]);if(_0x53fece[_0xeef9('0x28')]){delete _0x53fece[_0xeef9('0x28')];}_0x10be35[_0xeef9('0x1a')](_0x30c876)['send'](_0x53fece);};}exports[_0xeef9('0x29')]=function(_0x31f504,_0x427d3e){var _0x44501f={},_0x4b4e61={},_0x34b96b={'count':0x0,'rows':[]};var _0x49ba35=_[_0xeef9('0x2a')](db['DeskField'][_0xeef9('0x2b')],function(_0x229a14){return{'name':_0x229a14[_0xeef9('0x2c')],'type':_0x229a14[_0xeef9('0x2d')][_0xeef9('0x2e')]};});_0x4b4e61[_0xeef9('0x2f')]=_[_0xeef9('0x2a')](_0x49ba35,'name');_0x4b4e61[_0xeef9('0x30')]=_[_0xeef9('0x31')](_0x31f504[_0xeef9('0x30')]);_0x4b4e61['filters']=_[_0xeef9('0x32')](_0x4b4e61[_0xeef9('0x2f')],_0x4b4e61[_0xeef9('0x30')]);_0x44501f['attributes']=_['intersection'](_0x4b4e61[_0xeef9('0x2f')],qs[_0xeef9('0x33')](_0x31f504[_0xeef9('0x30')][_0xeef9('0x33')]));_0x44501f[_0xeef9('0x34')]=_0x44501f['attributes'][_0xeef9('0x35')]?_0x44501f['attributes']:_0x4b4e61['model'];if(!_0x31f504['query']['hasOwnProperty']('nolimit')){_0x44501f[_0xeef9('0x1f')]=qs[_0xeef9('0x1f')](_0x31f504['query']['limit']);_0x44501f[_0xeef9('0x1d')]=qs['offset'](_0x31f504[_0xeef9('0x30')][_0xeef9('0x1d')]);}_0x44501f['order']=qs[_0xeef9('0x36')](_0x31f504[_0xeef9('0x30')][_0xeef9('0x36')]);_0x44501f[_0xeef9('0x37')]=qs[_0xeef9('0x38')](_[_0xeef9('0x39')](_0x31f504[_0xeef9('0x30')],_0x4b4e61['filters']),_0x49ba35);if(_0x31f504[_0xeef9('0x30')][_0xeef9('0x3a')]){_0x44501f[_0xeef9('0x37')]=_[_0xeef9('0x3b')](_0x44501f[_0xeef9('0x37')],{'$or':_['map'](_0x49ba35,function(_0x664e75){if(_0x664e75[_0xeef9('0x2d')]!==_0xeef9('0x3c')){var _0x188c40={};_0x188c40[_0x664e75[_0xeef9('0x28')]]={'$like':'%'+_0x31f504[_0xeef9('0x30')][_0xeef9('0x3a')]+'%'};return _0x188c40;}})});}_0x44501f=_[_0xeef9('0x3b')]({},_0x44501f,_0x31f504[_0xeef9('0x3d')]);var _0x5f1015={'where':_0x44501f[_0xeef9('0x37')]};return db[_0xeef9('0x3e')][_0xeef9('0x20')](_0x5f1015)[_0xeef9('0x24')](function(_0x4f3e4e){_0x34b96b[_0xeef9('0x20')]=_0x4f3e4e;if(_0x31f504[_0xeef9('0x30')][_0xeef9('0x3f')]){_0x44501f[_0xeef9('0x40')]=[{'all':!![]}];}return db['DeskField'][_0xeef9('0x41')](_0x44501f);})['then'](function(_0x5c512f){_0x34b96b[_0xeef9('0x42')]=_0x5c512f;return _0x34b96b;})[_0xeef9('0x24')](respondWithFilteredResult(_0x427d3e,_0x44501f))[_0xeef9('0x43')](handleError(_0x427d3e,null));};exports[_0xeef9('0x44')]=function(_0x4bec11,_0x57a7cd){var _0x12c0ec={'raw':!![],'where':{'id':_0x4bec11[_0xeef9('0x45')]['id']}},_0x2b4ea6={};_0x2b4ea6[_0xeef9('0x2f')]=_['keys'](db[_0xeef9('0x3e')][_0xeef9('0x2b')]);_0x2b4ea6['query']=_[_0xeef9('0x31')](_0x4bec11['query']);_0x2b4ea6[_0xeef9('0x38')]=_['intersection'](_0x2b4ea6['model'],_0x2b4ea6[_0xeef9('0x30')]);_0x12c0ec[_0xeef9('0x34')]=_[_0xeef9('0x32')](_0x2b4ea6[_0xeef9('0x2f')],qs[_0xeef9('0x33')](_0x4bec11[_0xeef9('0x30')][_0xeef9('0x33')]));_0x12c0ec['attributes']=_0x12c0ec[_0xeef9('0x34')][_0xeef9('0x35')]?_0x12c0ec['attributes']:_0x2b4ea6[_0xeef9('0x2f')];if(_0x4bec11[_0xeef9('0x30')]['includeAll']){_0x12c0ec['include']=[{'all':!![]}];}_0x12c0ec=_[_0xeef9('0x3b')]({},_0x12c0ec,_0x4bec11[_0xeef9('0x3d')]);return db[_0xeef9('0x3e')][_0xeef9('0x46')](_0x12c0ec)[_0xeef9('0x24')](handleEntityNotFound(_0x57a7cd,null))[_0xeef9('0x24')](respondWithResult(_0x57a7cd,null))[_0xeef9('0x43')](handleError(_0x57a7cd,null));};exports['create']=function(_0x155d7a,_0x293514){return db[_0xeef9('0x3e')][_0xeef9('0x47')](_0x155d7a[_0xeef9('0x48')],{})[_0xeef9('0x24')](respondWithResult(_0x293514,0xc9))[_0xeef9('0x43')](handleError(_0x293514,null));};exports[_0xeef9('0x49')]=function(_0x224711,_0x307b6a){if(_0x224711['body']['id']){delete _0x224711[_0xeef9('0x48')]['id'];}return db[_0xeef9('0x3e')]['find']({'where':{'id':_0x224711[_0xeef9('0x45')]['id']}})[_0xeef9('0x24')](handleEntityNotFound(_0x307b6a,null))[_0xeef9('0x24')](saveUpdates(_0x224711[_0xeef9('0x48')],null))[_0xeef9('0x24')](respondWithResult(_0x307b6a,null))[_0xeef9('0x43')](handleError(_0x307b6a,null));};exports[_0xeef9('0x25')]=function(_0x5bbb03,_0x398568){return db['DeskField'][_0xeef9('0x46')]({'where':{'id':_0x5bbb03[_0xeef9('0x45')]['id']}})[_0xeef9('0x24')](handleEntityNotFound(_0x398568,null))[_0xeef9('0x24')](removeEntity(_0x398568,null))[_0xeef9('0x43')](handleError(_0x398568,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 5e3b06f..9949186 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 _0x411a=['rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','desk_unique_index','FieldId','lodash','util','api','bluebird','request-promise'];(function(_0x5e521f,_0x20d219){var _0x869d4=function(_0x17c8b6){while(--_0x17c8b6){_0x5e521f['push'](_0x5e521f['shift']());}};_0x869d4(++_0x20d219);}(_0x411a,0xf2));var _0xa411=function(_0x274f14,_0x27dd7f){_0x274f14=_0x274f14-0x0;var _0x13b97e=_0x411a[_0x274f14];return _0x13b97e;};'use strict';var _=require(_0xa411('0x0'));var util=require(_0xa411('0x1'));var logger=require('../../config/logger')(_0xa411('0x2'));var moment=require('moment');var BPromise=require(_0xa411('0x3'));var rp=require(_0xa411('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa411('0x5'));var config=require(_0xa411('0x6'));var attributes=require(_0xa411('0x7'));module[_0xa411('0x8')]=function(_0x1483bc,_0x3a6392){return _0x1483bc[_0xa411('0x9')](_0xa411('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xa411('0xb'),'fields':['idField',_0xa411('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbebb=['api','moment','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','idField','FieldId','lodash','../../config/logger'];(function(_0x495e9f,_0x1b1d80){var _0xb249d2=function(_0x3db4e4){while(--_0x3db4e4){_0x495e9f['push'](_0x495e9f['shift']());}};_0xb249d2(++_0x1b1d80);}(_0xbebb,0x1b1));var _0xbbeb=function(_0x2c86da,_0x2bf90e){_0x2c86da=_0x2c86da-0x0;var _0x5e41e0=_0xbebb[_0x2c86da];return _0x5e41e0;};'use strict';var _=require(_0xbbeb('0x0'));var util=require('util');var logger=require(_0xbbeb('0x1'))(_0xbbeb('0x2'));var moment=require(_0xbbeb('0x3'));var BPromise=require('bluebird');var rp=require(_0xbbeb('0x4'));var fs=require('fs');var path=require(_0xbbeb('0x5'));var rimraf=require(_0xbbeb('0x6'));var config=require(_0xbbeb('0x7'));var attributes=require(_0xbbeb('0x8'));module[_0xbbeb('0x9')]=function(_0x3d40ea,_0x16b8c5){return _0x3d40ea[_0xbbeb('0xa')](_0xbbeb('0xb'),attributes,{'tableName':_0xbbeb('0xc'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xbbeb('0xd'),_0xbbeb('0xe')],'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 b158afa..02f37d3 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 _0x00df=['info','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0xb593e7,_0x34bfc6){var _0xb3c43a=function(_0x1a452a){while(--_0x1a452a){_0xb593e7['push'](_0xb593e7['shift']());}};_0xb3c43a(++_0x34bfc6);}(_0x00df,0xc8));var _0xf00d=function(_0x54adca,_0x1bb295){_0x54adca=_0x54adca-0x0;var _0x2e1a30=_0x00df[_0x54adca];return _0x2e1a30;};'use strict';var _=require('lodash');var util=require(_0xf00d('0x0'));var moment=require('moment');var BPromise=require(_0xf00d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf00d('0x2'));var db=require(_0xf00d('0x3'))['db'];var utils=require(_0xf00d('0x4'));var logger=require(_0xf00d('0x5'))(_0xf00d('0x6'));var config=require(_0xf00d('0x7'));var jayson=require(_0xf00d('0x8'));var client=jayson[_0xf00d('0x9')][_0xf00d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x263848,_0x51eec1,_0x42a15d){return new BPromise(function(_0x3aa5cf,_0x237d08){return client[_0xf00d('0xb')](_0x263848,_0x42a15d)[_0xf00d('0xc')](function(_0x37126f){logger['info'](_0xf00d('0xd'),_0x51eec1,_0xf00d('0xe'));logger[_0xf00d('0xf')]('DeskField,\x20%s,\x20%s,\x20%s',_0x51eec1,_0xf00d('0xe'),JSON[_0xf00d('0x10')](_0x37126f));if(_0x37126f[_0xf00d('0x11')]){if(_0x37126f[_0xf00d('0x11')][_0xf00d('0x12')]===0x1f4){logger[_0xf00d('0x11')](_0xf00d('0xd'),_0x51eec1,_0x37126f[_0xf00d('0x11')][_0xf00d('0x13')]);return _0x237d08(_0x37126f['error']['message']);}logger[_0xf00d('0x11')]('DeskField,\x20%s,\x20%s',_0x51eec1,_0x37126f[_0xf00d('0x11')][_0xf00d('0x13')]);return _0x3aa5cf(_0x37126f[_0xf00d('0x11')][_0xf00d('0x13')]);}else{logger[_0xf00d('0x14')](_0xf00d('0xd'),_0x51eec1,_0xf00d('0xe'));_0x3aa5cf(_0x37126f[_0xf00d('0x15')][_0xf00d('0x13')]);}})['catch'](function(_0x411776){logger[_0xf00d('0x11')]('DeskField,\x20%s,\x20%s',_0x51eec1,_0x411776);_0x237d08(_0x411776);});});} \ No newline at end of file +var _0xe516=['message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','DeskField,\x20%s,\x20%s','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x4d60ee,_0x3ab36a){var _0x3e6138=function(_0x5dfeff){while(--_0x5dfeff){_0x4d60ee['push'](_0x4d60ee['shift']());}};_0x3e6138(++_0x3ab36a);}(_0xe516,0x70));var _0x6e51=function(_0x4d2c26,_0x2701f9){_0x4d2c26=_0x4d2c26-0x0;var _0x5bf9b4=_0xe516[_0x4d2c26];return _0x5bf9b4;};'use strict';var _=require(_0x6e51('0x0'));var util=require(_0x6e51('0x1'));var moment=require('moment');var BPromise=require(_0x6e51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e51('0x3'));var db=require(_0x6e51('0x4'))['db'];var utils=require(_0x6e51('0x5'));var logger=require(_0x6e51('0x6'))(_0x6e51('0x7'));var config=require(_0x6e51('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6e51('0x9')][_0x6e51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bfdd8,_0x2a4312,_0x3efaf8){return new BPromise(function(_0x39569b,_0x39299a){return client[_0x6e51('0xb')](_0x3bfdd8,_0x3efaf8)[_0x6e51('0xc')](function(_0x40fd4b){logger[_0x6e51('0xd')](_0x6e51('0xe'),_0x2a4312,'request\x20sent');logger[_0x6e51('0xf')](_0x6e51('0x10'),_0x2a4312,_0x6e51('0x11'),JSON['stringify'](_0x40fd4b));if(_0x40fd4b[_0x6e51('0x12')]){if(_0x40fd4b[_0x6e51('0x12')][_0x6e51('0x13')]===0x1f4){logger[_0x6e51('0x12')]('DeskField,\x20%s,\x20%s',_0x2a4312,_0x40fd4b[_0x6e51('0x12')][_0x6e51('0x14')]);return _0x39299a(_0x40fd4b[_0x6e51('0x12')][_0x6e51('0x14')]);}logger[_0x6e51('0x12')](_0x6e51('0xe'),_0x2a4312,_0x40fd4b['error'][_0x6e51('0x14')]);return _0x39569b(_0x40fd4b[_0x6e51('0x12')]['message']);}else{logger['info'](_0x6e51('0xe'),_0x2a4312,'request\x20sent');_0x39569b(_0x40fd4b['result'][_0x6e51('0x14')]);}})[_0x6e51('0x15')](function(_0x34d5cc){logger[_0x6e51('0x12')]('DeskField,\x20%s,\x20%s',_0x2a4312,_0x34d5cc);_0x39299a(_0x34d5cc);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 8a6754b..5c61bac 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 _0x06bf=['./intDynamics365Account.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2b6448,_0x4fa425){var _0x5cc0f1=function(_0x583596){while(--_0x583596){_0x2b6448['push'](_0x2b6448['shift']());}};_0x5cc0f1(++_0x4fa425);}(_0x06bf,0x148));var _0xf06b=function(_0x26cf5e,_0x29d036){_0x26cf5e=_0x26cf5e-0x0;var _0x3c40f=_0x06bf[_0x26cf5e];return _0x3c40f;};'use strict';var multer=require('multer');var util=require(_0xf06b('0x0'));var path=require('path');var timeout=require(_0xf06b('0x1'));var express=require(_0xf06b('0x2'));var router=express[_0xf06b('0x3')]();var fs_extra=require(_0xf06b('0x4'));var auth=require(_0xf06b('0x5'));var interaction=require(_0xf06b('0x6'));var config=require(_0xf06b('0x7'));var controller=require(_0xf06b('0x8'));router[_0xf06b('0x9')]('/',auth['isAuthenticated'](),controller[_0xf06b('0xa')]);router[_0xf06b('0x9')](_0xf06b('0xb'),auth[_0xf06b('0xc')](),controller[_0xf06b('0xd')]);router[_0xf06b('0x9')](_0xf06b('0xe'),auth[_0xf06b('0xc')](),controller['getConfigurations']);router[_0xf06b('0x9')](_0xf06b('0xf'),auth[_0xf06b('0xc')](),controller[_0xf06b('0x10')]);router[_0xf06b('0x11')]('/',auth[_0xf06b('0xc')](),controller[_0xf06b('0x12')]);router[_0xf06b('0x11')](_0xf06b('0xe'),auth[_0xf06b('0xc')](),controller[_0xf06b('0x13')]);router[_0xf06b('0x14')](_0xf06b('0xb'),auth[_0xf06b('0xc')](),controller[_0xf06b('0x15')]);router['delete'](_0xf06b('0xb'),auth['isAuthenticated'](),controller[_0xf06b('0x16')]);module[_0xf06b('0x17')]=router; \ No newline at end of file +var _0xfddd=['exports','multer','util','express','Router','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','delete','destroy'];(function(_0x3d69f5,_0xb99af3){var _0xfc942a=function(_0x106248){while(--_0x106248){_0x3d69f5['push'](_0x3d69f5['shift']());}};_0xfc942a(++_0xb99af3);}(_0xfddd,0x105));var _0xdfdd=function(_0x2ff56b,_0x5df44a){_0x2ff56b=_0x2ff56b-0x0;var _0x44a7d7=_0xfddd[_0x2ff56b];return _0x44a7d7;};'use strict';var multer=require(_0xdfdd('0x0'));var util=require(_0xdfdd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdfdd('0x2'));var router=express[_0xdfdd('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdfdd('0x4'));var controller=require(_0xdfdd('0x5'));router[_0xdfdd('0x6')]('/',auth[_0xdfdd('0x7')](),controller['index']);router[_0xdfdd('0x6')](_0xdfdd('0x8'),auth[_0xdfdd('0x7')](),controller[_0xdfdd('0x9')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xdfdd('0xa')]);router['get'](_0xdfdd('0xb'),auth['isAuthenticated'](),controller[_0xdfdd('0xc')]);router[_0xdfdd('0xd')]('/',auth['isAuthenticated'](),controller[_0xdfdd('0xe')]);router['post'](_0xdfdd('0xf'),auth[_0xdfdd('0x7')](),controller[_0xdfdd('0x10')]);router['put']('/:id',auth[_0xdfdd('0x7')](),controller['update']);router[_0xdfdd('0x11')](_0xdfdd('0x8'),auth[_0xdfdd('0x7')](),controller[_0xdfdd('0x12')]);module[_0xdfdd('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 1f90e8f..397285c 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 _0xc92f=['sequelize','exports','STRING'];(function(_0x162003,_0x2e2322){var _0x1be39a=function(_0x2cd83e){while(--_0x2cd83e){_0x162003['push'](_0x162003['shift']());}};_0x1be39a(++_0x2e2322);}(_0xc92f,0xf3));var _0xfc92=function(_0x3cd38e,_0x26ccd7){_0x3cd38e=_0x3cd38e-0x0;var _0x2fcf5c=_0xc92f[_0x3cd38e];return _0x2fcf5c;};'use strict';var Sequelize=require(_0xfc92('0x0'));module[_0xfc92('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfc92('0x2')]},'password':{'type':Sequelize[_0xfc92('0x2')]},'remoteUri':{'type':Sequelize[_0xfc92('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xfc92('0x2')]},'clientSecret':{'type':Sequelize[_0xfc92('0x2')]},'serverUrl':{'type':Sequelize[_0xfc92('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xe292=['STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe292,0x19e));var _0x2e29=function(_0x521dda,_0x4693bf){_0x521dda=_0x521dda-0x0;var _0x4b03d8=_0xe292[_0x521dda];return _0x4b03d8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2e29('0x0')]},'username':{'type':Sequelize[_0x2e29('0x0')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x2e29('0x0')]},'clientId':{'type':Sequelize[_0x2e29('0x0')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x2e29('0x0')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 126e93b..55043e9 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 _0x6de8=['regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby','sentimentvalue','slainvokedidname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','modernAuthentication','CloudProvider','data5','access_token','data7','POST','https://login.microsoftonline.com/','clientSecret','GET','Bearer\x20','MetadataId','EntityDefinitions(','4.0','Attributes','remove','includes','LogicalName','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','forEach','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','error','send','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','UserLocalizedLabel','Value','DisplayName','TrueOption','true','OptionSet','FalseOption','?$select=DisplayName,LogicalName','util','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','offset','limit','undefined','count','then','destroy','sendStatus','stack','name','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','attributes','length','nolimit','order','sort','where','pick','merge','includeAll','findAll','rows','catch','params','include','find','create','body','update','getConfigurations','findOne','intersection','filter','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','Dynamics365Configuration','Dynamics365Field','Subjects','slice','substring','%s/api/data/v9.0/','getFields','incident','PhoneCall','title','description','customerid','phonenumber'];(function(_0x304b67,_0x31cb39){var _0x493afb=function(_0x21dce3){while(--_0x21dce3){_0x304b67['push'](_0x304b67['shift']());}};_0x493afb(++_0x31cb39);}(_0x6de8,0x126));var _0x86de=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0x6de8[_0x5e8eae];return _0xdd09cd;};'use strict';var rp=require('request-promise');var util=require(_0x86de('0x0'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x86de('0x1'))(_0x86de('0x2'));var db=require(_0x86de('0x3'))['db'];var integrations=require(_0x86de('0x4'));function respondWithResult(_0x1b3659,_0x255609){_0x255609=_0x255609||0xc8;return function(_0x1683cb){if(_0x1683cb){return _0x1b3659[_0x86de('0x5')](_0x255609)['json'](_0x1683cb);}};}function respondWithFilteredResult(_0x5f2eca,_0x4663c9){return function(_0x54eb9d){if(_0x54eb9d){var _0x5039b3=typeof _0x4663c9[_0x86de('0x6')]==='undefined'&&typeof _0x4663c9[_0x86de('0x7')]===_0x86de('0x8');var _0x3cc2dd=_0x54eb9d['count'];var _0x1405f5=_0x5039b3?0x0:_0x4663c9['offset'];var _0x4714f9=_0x5039b3?_0x54eb9d[_0x86de('0x9')]:_0x4663c9[_0x86de('0x6')]+_0x4663c9[_0x86de('0x7')];var _0x19221a;if(_0x4714f9>=_0x3cc2dd){_0x4714f9=_0x3cc2dd;_0x19221a=0xc8;}else{_0x19221a=0xce;}_0x5f2eca[_0x86de('0x5')](_0x19221a);return _0x5f2eca['set']('Content-Range',_0x1405f5+'-'+_0x4714f9+'/'+_0x3cc2dd)['json'](_0x54eb9d);}return null;};}function saveUpdates(_0x5cc9d){return function(_0x45fdd6){if(_0x45fdd6){return _0x45fdd6['update'](_0x5cc9d)[_0x86de('0xa')](function(_0x189e79){return _0x189e79;});}return null;};}function removeEntity(_0xae5a13){return function(_0x1b9bec){if(_0x1b9bec){return _0x1b9bec[_0x86de('0xb')]()[_0x86de('0xa')](function(){_0xae5a13['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x169341){return function(_0xf71e88){if(!_0xf71e88){_0x169341[_0x86de('0xc')](0x194);}return _0xf71e88;};}function handleError(_0x31e011,_0x2f7393){_0x2f7393=_0x2f7393||0x1f4;return function(_0x8c04b1){logger['error'](_0x8c04b1[_0x86de('0xd')]);if(_0x8c04b1[_0x86de('0xe')]){delete _0x8c04b1[_0x86de('0xe')];}_0x31e011[_0x86de('0x5')](_0x2f7393)['send'](_0x8c04b1);};}exports[_0x86de('0xf')]=function(_0x3d793c,_0x1bb695){var _0x4d9c31={},_0x17d6ac={},_0x15d676={'count':0x0,'rows':[]};var _0x4f8216=_[_0x86de('0x10')](db[_0x86de('0x11')][_0x86de('0x12')],function(_0x578d8f){return{'name':_0x578d8f[_0x86de('0x13')],'type':_0x578d8f[_0x86de('0x14')][_0x86de('0x15')]};});_0x17d6ac[_0x86de('0x16')]=_[_0x86de('0x10')](_0x4f8216,_0x86de('0xe'));_0x17d6ac[_0x86de('0x17')]=_[_0x86de('0x18')](_0x3d793c[_0x86de('0x17')]);_0x17d6ac[_0x86de('0x19')]=_['intersection'](_0x17d6ac[_0x86de('0x16')],_0x17d6ac[_0x86de('0x17')]);_0x4d9c31['attributes']=_['intersection'](_0x17d6ac['model'],qs[_0x86de('0x1a')](_0x3d793c['query'][_0x86de('0x1a')]));_0x4d9c31[_0x86de('0x1b')]=_0x4d9c31[_0x86de('0x1b')][_0x86de('0x1c')]?_0x4d9c31[_0x86de('0x1b')]:_0x17d6ac['model'];if(!_0x3d793c['query']['hasOwnProperty'](_0x86de('0x1d'))){_0x4d9c31[_0x86de('0x7')]=qs[_0x86de('0x7')](_0x3d793c['query'][_0x86de('0x7')]);_0x4d9c31[_0x86de('0x6')]=qs[_0x86de('0x6')](_0x3d793c[_0x86de('0x17')][_0x86de('0x6')]);}_0x4d9c31[_0x86de('0x1e')]=qs[_0x86de('0x1f')](_0x3d793c[_0x86de('0x17')][_0x86de('0x1f')]);_0x4d9c31[_0x86de('0x20')]=qs[_0x86de('0x19')](_[_0x86de('0x21')](_0x3d793c['query'],_0x17d6ac[_0x86de('0x19')]),_0x4f8216);if(_0x3d793c[_0x86de('0x17')]['filter']){_0x4d9c31['where']=_[_0x86de('0x22')](_0x4d9c31['where'],{'$or':_[_0x86de('0x10')](_0x4f8216,function(_0x35480b){if(_0x35480b[_0x86de('0x14')]!=='VIRTUAL'){var _0xb7ceae={};_0xb7ceae[_0x35480b[_0x86de('0xe')]]={'$like':'%'+_0x3d793c['query']['filter']+'%'};return _0xb7ceae;}})});}_0x4d9c31=_[_0x86de('0x22')]({},_0x4d9c31,_0x3d793c['options']);var _0x3117b5={'where':_0x4d9c31[_0x86de('0x20')]};return db[_0x86de('0x11')][_0x86de('0x9')](_0x3117b5)[_0x86de('0xa')](function(_0x2e3de2){_0x15d676[_0x86de('0x9')]=_0x2e3de2;if(_0x3d793c[_0x86de('0x17')][_0x86de('0x23')]){_0x4d9c31['include']=[{'all':!![]}];}return db['Dynamics365Account'][_0x86de('0x24')](_0x4d9c31);})[_0x86de('0xa')](function(_0x18bc1d){_0x15d676[_0x86de('0x25')]=_0x18bc1d;return _0x15d676;})['then'](respondWithFilteredResult(_0x1bb695,_0x4d9c31))[_0x86de('0x26')](handleError(_0x1bb695,null));};exports['show']=function(_0x2d150d,_0x280414){var _0x5cff08={'raw':![],'where':{'id':_0x2d150d[_0x86de('0x27')]['id']}},_0x3b0cfd={};_0x3b0cfd['model']=_[_0x86de('0x18')](db[_0x86de('0x11')][_0x86de('0x12')]);_0x3b0cfd[_0x86de('0x17')]=_[_0x86de('0x18')](_0x2d150d[_0x86de('0x17')]);_0x3b0cfd[_0x86de('0x19')]=_['intersection'](_0x3b0cfd[_0x86de('0x16')],_0x3b0cfd[_0x86de('0x17')]);_0x5cff08[_0x86de('0x1b')]=_['intersection'](_0x3b0cfd['model'],qs[_0x86de('0x1a')](_0x2d150d[_0x86de('0x17')]['fields']));_0x5cff08[_0x86de('0x1b')]=_0x5cff08[_0x86de('0x1b')]['length']?_0x5cff08[_0x86de('0x1b')]:_0x3b0cfd['model'];if(_0x2d150d['query']['includeAll']){_0x5cff08[_0x86de('0x28')]=[{'all':!![]}];}_0x5cff08=_[_0x86de('0x22')]({},_0x5cff08,_0x2d150d['options']);return db[_0x86de('0x11')][_0x86de('0x29')](_0x5cff08)[_0x86de('0xa')](handleEntityNotFound(_0x280414,null))[_0x86de('0xa')](respondWithResult(_0x280414,null))[_0x86de('0x26')](handleError(_0x280414,null));};exports[_0x86de('0x2a')]=function(_0x409ad6,_0xac99ac){return db['Dynamics365Account'][_0x86de('0x2a')](_0x409ad6[_0x86de('0x2b')],{})['then'](respondWithResult(_0xac99ac,0xc9))[_0x86de('0x26')](handleError(_0xac99ac,null));};exports[_0x86de('0x2c')]=function(_0x51e706,_0x19cd6b){if(_0x51e706['body']['id']){delete _0x51e706[_0x86de('0x2b')]['id'];}return db[_0x86de('0x11')][_0x86de('0x29')]({'where':{'id':_0x51e706[_0x86de('0x27')]['id']}})['then'](handleEntityNotFound(_0x19cd6b,null))[_0x86de('0xa')](saveUpdates(_0x51e706[_0x86de('0x2b')],null))[_0x86de('0xa')](respondWithResult(_0x19cd6b,null))[_0x86de('0x26')](handleError(_0x19cd6b,null));};exports['destroy']=function(_0x372d0e,_0x494a95){return db[_0x86de('0x11')]['find']({'where':{'id':_0x372d0e['params']['id']}})['then'](handleEntityNotFound(_0x494a95,null))[_0x86de('0xa')](removeEntity(_0x494a95,null))[_0x86de('0x26')](handleError(_0x494a95,null));};exports[_0x86de('0x2d')]=function(_0x425a79,_0x33f5fc){var _0xd0805f={};var _0x3b9fba={};var _0x4c16a2;var _0x2f0b3e;return db[_0x86de('0x11')][_0x86de('0x2e')]({'where':{'id':_0x425a79[_0x86de('0x27')]['id']}})[_0x86de('0xa')](handleEntityNotFound(_0x33f5fc,null))[_0x86de('0xa')](function(_0x394dfa){if(_0x394dfa){_0x4c16a2=_0x394dfa;_0x3b9fba['model']=_[_0x86de('0x18')](db['Dynamics365Configuration'][_0x86de('0x12')]);_0x3b9fba[_0x86de('0x17')]=_[_0x86de('0x18')](_0x425a79['query']);_0x3b9fba[_0x86de('0x19')]=_[_0x86de('0x2f')](_0x3b9fba[_0x86de('0x16')],_0x3b9fba[_0x86de('0x17')]);_0xd0805f['attributes']=_[_0x86de('0x2f')](_0x3b9fba['model'],qs[_0x86de('0x1a')](_0x425a79[_0x86de('0x17')]['fields']));_0xd0805f['attributes']=_0xd0805f[_0x86de('0x1b')][_0x86de('0x1c')]?_0xd0805f[_0x86de('0x1b')]:_0x3b9fba[_0x86de('0x16')];_0xd0805f[_0x86de('0x1e')]=qs[_0x86de('0x1f')](_0x425a79[_0x86de('0x17')][_0x86de('0x1f')]);_0xd0805f['where']=qs[_0x86de('0x19')](_[_0x86de('0x21')](_0x425a79[_0x86de('0x17')],_0x3b9fba['filters']));if(_0x425a79['query'][_0x86de('0x30')]){_0xd0805f[_0x86de('0x20')]=_['merge'](_0xd0805f[_0x86de('0x20')],{'$or':_[_0x86de('0x10')](_0xd0805f[_0x86de('0x1b')],function(_0x1c7601){var _0x2a1eb7={};_0x2a1eb7[_0x1c7601]={'$like':'%'+_0x425a79['query'][_0x86de('0x30')]+'%'};return _0x2a1eb7;})});}_0xd0805f=_[_0x86de('0x22')]({},_0xd0805f,_0x425a79['options']);return _0x4c16a2['getConfigurations'](_0xd0805f);}})['then'](function(_0x1deb17){if(_0x1deb17){_0x2f0b3e=_0x1deb17[_0x86de('0x1c')];if(!_0x425a79[_0x86de('0x17')][_0x86de('0x31')](_0x86de('0x1d'))){_0xd0805f[_0x86de('0x7')]=qs[_0x86de('0x7')](_0x425a79[_0x86de('0x17')]['limit']);_0xd0805f['offset']=qs[_0x86de('0x6')](_0x425a79[_0x86de('0x17')][_0x86de('0x6')]);}return _0x4c16a2['getConfigurations'](_0xd0805f);}})[_0x86de('0xa')](function(_0x2e2396){if(_0x2e2396){return _0x2e2396?{'count':_0x2f0b3e,'rows':_0x2e2396}:null;}})[_0x86de('0xa')](respondWithResult(_0x33f5fc,null))[_0x86de('0x26')](handleError(_0x33f5fc,null));};exports[_0x86de('0x32')]=function(_0x2a2cd,_0x409f6e){if(_0x2a2cd['body']['id']){delete _0x2a2cd['body']['id'];}return db[_0x86de('0x11')][_0x86de('0x2e')]({'where':{'id':_0x2a2cd[_0x86de('0x27')]['id']}})[_0x86de('0xa')](handleEntityNotFound(_0x409f6e,null))[_0x86de('0xa')](function(_0x31a3dc){if(_0x31a3dc){_0x2a2cd[_0x86de('0x2b')][_0x86de('0x33')]=_0x31a3dc['id'];_0x2a2cd[_0x86de('0x2b')]['Subjects']=integrations[_0x86de('0x34')](_0x2a2cd['body'][_0x86de('0x35')],_0x2a2cd[_0x86de('0x2b')][_0x86de('0x14')]);_0x2a2cd[_0x86de('0x2b')][_0x86de('0x36')]=integrations['getDescriptions'](_0x2a2cd[_0x86de('0x2b')][_0x86de('0x35')],_0x2a2cd[_0x86de('0x2b')][_0x86de('0x14')]);return db[_0x86de('0x37')][_0x86de('0x2a')](_0x2a2cd[_0x86de('0x2b')],{'include':[{'model':db[_0x86de('0x38')],'as':_0x86de('0x39')},{'model':db[_0x86de('0x38')],'as':_0x86de('0x36')}]});}return null;})[_0x86de('0xa')](respondWithResult(_0x409f6e,null))[_0x86de('0x26')](handleError(_0x409f6e,null));};function sanitizeRemoteUri(_0x19e073){var _0x2e93fb=_0x19e073[_0x86de('0x3a')](-0x1);if(_0x2e93fb==='/')return _0x19e073[_0x86de('0x3b')](0x0,_0x19e073['lastIndexOf'](_0x2e93fb));return _0x19e073;}function getWebApiUrl(_0x19c1d5){return util['format'](_0x86de('0x3c'),_0x19c1d5);}exports[_0x86de('0x3d')]=function(_0x3ad3ad,_0x5c4205){var _0x52c04a=_0x3ad3ad[_0x86de('0x17')]['ticketType'];var _0x17cbf8=_0x52c04a===_0x86de('0x3e')?'Incident':_0x86de('0x3f');var _0x489857='';var _0x17f5aa='';var _0x1f4839='';var _0x49dace='';var _0x4e001c='';var _0x561d32='';var _0x197966='';var _0x21c704='';var _0x30bce2=[_0x86de('0x40'),_0x86de('0x41'),_0x86de('0x42'),'ownerid','caseorigincode','subject',_0x86de('0x43'),_0x86de('0x44'),_0x86de('0x45'),_0x86de('0x46')];var _0x49f3a9=[_0x86de('0x47'),'accountidyominame',_0x86de('0x48'),_0x86de('0x49'),'contactidname',_0x86de('0x4a'),_0x86de('0x4b'),_0x86de('0x4c'),'createdbyexternalpartyname',_0x86de('0x4d'),_0x86de('0x4e'),_0x86de('0x4f'),_0x86de('0x50'),_0x86de('0x51'),_0x86de('0x52'),'customeridname',_0x86de('0x53'),_0x86de('0x54'),_0x86de('0x55'),_0x86de('0x56'),_0x86de('0x57'),_0x86de('0x58'),_0x86de('0x59'),_0x86de('0x5a'),_0x86de('0x5b'),_0x86de('0x5c'),'importsequencenumber',_0x86de('0x5d'),_0x86de('0x5e'),_0x86de('0x5f'),_0x86de('0x60'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon',_0x86de('0x61'),_0x86de('0x62'),_0x86de('0x63'),_0x86de('0x64'),_0x86de('0x65'),_0x86de('0x66'),_0x86de('0x67'),_0x86de('0x68'),_0x86de('0x69'),_0x86de('0x6a'),'parentcaseidname','primarycontactidname',_0x86de('0x6b'),_0x86de('0x6c'),_0x86de('0x6d'),_0x86de('0x6e'),'resolveby',_0x86de('0x6f'),_0x86de('0x70'),'responsiblecontactidname','responsiblecontactidyominame',_0x86de('0x71'),_0x86de('0x72'),'slaname',_0x86de('0x73'),_0x86de('0x74'),_0x86de('0x75'),_0x86de('0x76'),_0x86de('0x77'),_0x86de('0x78'),_0x86de('0x79'),'traversedpath',_0x86de('0x7a'),_0x86de('0x7b')];var _0x25e613=_0x30bce2[_0x86de('0x7c')](_0x49f3a9);return db[_0x86de('0x11')][_0x86de('0x2e')]({'where':{'id':_0x3ad3ad[_0x86de('0x27')]['id']},'attributes':['id',_0x86de('0x7d'),_0x86de('0x7e'),_0x86de('0x7f'),_0x86de('0x80'),_0x86de('0x81'),'clientSecret',_0x86de('0x82')],'include':[{'model':db[_0x86de('0x83')],'as':_0x86de('0x83'),'attributes':['id',_0x86de('0x84'),'data7']}]})[_0x86de('0xa')](handleEntityNotFound(_0x5c4205,null))['then'](function(_0xaa8fe8){if(_0xaa8fe8){if(_0xaa8fe8['modernAuthentication']){_0xaa8fe8[_0x86de('0x85')]=_0xaa8fe8[_0x86de('0x83')][_0x86de('0x84')];_0x21c704=sanitizeRemoteUri(_0xaa8fe8[_0x86de('0x83')][_0x86de('0x86')]);_0x197966=getWebApiUrl(_0x21c704);return _0xaa8fe8;}_0x21c704=sanitizeRemoteUri(_0xaa8fe8[_0x86de('0x7f')]);_0x197966=getWebApiUrl(_0x21c704);var _0x52d824={'method':_0x86de('0x87'),'uri':_0x86de('0x88')+_0xaa8fe8[_0x86de('0x80')]+'/oauth2/token','form':{'client_id':_0xaa8fe8[_0x86de('0x81')],'resource':_0x21c704,'username':_0xaa8fe8['username'],'password':_0xaa8fe8[_0x86de('0x7e')],'grant_type':_0x86de('0x7e'),'client_secret':_0xaa8fe8[_0x86de('0x89')]},'json':!![]};return rp(_0x52d824);}})[_0x86de('0xa')](function(_0x50a888){_0x561d32=_0x50a888[_0x86de('0x85')];var _0x3fda5d={'method':_0x86de('0x8a'),'uri':encodeURI(_0x197966+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x17cbf8+'\x27'),'headers':{'Authorization':_0x86de('0x8b')+_0x561d32,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3fda5d);})[_0x86de('0xa')](function(_0x1b1387){var _0x4c0d8b=_0x1b1387['value'][0x0];var _0x1d3208=_0x4c0d8b[_0x86de('0x8c')];var _0x2155d7={'method':_0x86de('0x8a'),'uri':_0x197966+_0x86de('0x8d')+_0x1d3208+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x561d32,'If-None-Match':null,'OData-Version':_0x86de('0x8e')},'json':!![]};return rp(_0x2155d7);})[_0x86de('0xa')](function(_0x59f93e){_0x489857=_0x59f93e;_0x17f5aa=_0x489857[_0x86de('0x8f')];_0x17f5aa=_[_0x86de('0x90')](_0x17f5aa,function(_0xef2fbb){return!_0x25e613[_0x86de('0x91')](_0xef2fbb[_0x86de('0x92')]);});var _0x5a367f=[];var _0x5d5c9b=[];_0x17f5aa['forEach'](function(_0x4f842e){if(_0x4f842e[_0x86de('0x93')]){var _0x48de76=_0x4f842e[_0x86de('0x93')][_0x86de('0x3b')](_0x4f842e[_0x86de('0x93')][_0x86de('0x94')]('.')+0x1);if(_0x48de76===_0x86de('0x95')){_0x5a367f[_0x86de('0x96')](getSelectList(_0x197966,_0x52c04a,_0x5d5c9b,_0x489857[_0x86de('0x8c')],_0x4f842e[_0x86de('0x8c')],_0x561d32));}}});return Promise[_0x86de('0x97')](_0x5a367f);})[_0x86de('0xa')](function(_0x3577d6){_0x1f4839=_0x3577d6[0x0];var _0x1175c4=[];var _0x5e00d9=[];_0x17f5aa[_0x86de('0x98')](function(_0x30c667){if(!_['isNil'](_0x30c667['@odata.type'])){var _0x3f7e2d=_0x30c667['@odata.type'][_0x86de('0x3b')](_0x30c667[_0x86de('0x93')][_0x86de('0x94')]('.')+0x1);if(_0x3f7e2d===_0x86de('0x99')){_0x1175c4[_0x86de('0x96')](getBooleanList(_0x197966,_0x52c04a,_0x5e00d9,_0x489857[_0x86de('0x8c')],_0x30c667[_0x86de('0x8c')],_0x561d32));}}});return Promise[_0x86de('0x97')](_0x1175c4);})[_0x86de('0xa')](function(_0x5bb528){_0x49dace=_0x5bb528[0x0];var _0x27d5ee=[];var _0x2f877e=[];_0x17f5aa[_0x86de('0x98')](function(_0x11d4a2){if(_0x11d4a2['@odata.type']){var _0x176684=_0x11d4a2[_0x86de('0x93')]['substring'](_0x11d4a2['@odata.type'][_0x86de('0x94')]('.')+0x1);if(_0x176684===_0x86de('0x9a')||_0x176684==='DoubleAttributeMetadata'||_0x176684===_0x86de('0x9b')||_0x176684===_0x86de('0x9c')||_0x176684===_0x86de('0x9d')||_0x176684===_0x86de('0x9e')||_0x176684===_0x86de('0x9f')||_0x176684===_0x86de('0xa0')||_0x176684===_0x86de('0xa1')||_0x176684===_0x86de('0xa2')){_0x27d5ee[_0x86de('0x96')](getInputList(_0x197966,_0x52c04a,_0x176684,_0x2f877e,_0x489857['MetadataId'],_0x11d4a2[_0x86de('0x8c')],_0x561d32));}}});return Promise[_0x86de('0x97')](_0x27d5ee);})[_0x86de('0xa')](function(_0x5e6b8e){_0x4e001c=_0x5e6b8e[0x0];var _0x1ee342=_0x1f4839[_0x86de('0x7c')](_0x49dace)[_0x86de('0x7c')](_0x4e001c);var _0x39de38={'count':_0x1ee342['length'],'rows':_0x1ee342};return _0x39de38;})[_0x86de('0xa')](respondWithResult(_0x5c4205,null))[_0x86de('0x26')](function(_0x508590){var _0x84ca50=_0x3ad3ad[_0x86de('0x17')]['test']?0x1f4:_0x508590[_0x86de('0xa3')]||0x1f4;logger[_0x86de('0xa4')](_0x508590[_0x86de('0xd')]);delete _0x508590[_0x86de('0xe')];if(_0x84ca50===0x191){_0x84ca50=0x190;}_0x5c4205['status'](_0x84ca50)[_0x86de('0xa5')](_0x3ad3ad[_0x86de('0x17')][_0x86de('0xa6')]?{'message':_0x86de('0xa7'),'statusCode':_0x508590[_0x86de('0xa3')]}:_0x508590);});};function getSelectList(_0x1839d2,_0x49da5f,_0x255b00,_0x5ab27f,_0x1c3ef1,_0x1afb4f){var _0x5c08d1={'method':_0x86de('0x8a'),'uri':_0x1839d2+'EntityDefinitions('+_0x5ab27f+_0x86de('0xa8')+_0x1c3ef1+_0x86de('0xa9')+_0x86de('0xaa'),'headers':{'Authorization':'Bearer\x20'+_0x1afb4f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5c08d1)[_0x86de('0xa')](function(_0x4b170d){var _0xb17f5c=[];var _0x2841d5=_0x4b170d['OptionSet'][_0x86de('0xab')];_0x2841d5[_0x86de('0x98')](function(_0x8a0c9c){_0xb17f5c[_0x86de('0x96')]({'name':_0x8a0c9c[_0x86de('0xac')][_0x86de('0xad')]['Label'],'value':String(_0x8a0c9c[_0x86de('0xae')])});});var _0x3d15f7={'id':_0x49da5f+'_'+_0x4b170d['LogicalName'],'name':_0x4b170d[_0x86de('0xaf')][_0x86de('0xad')][_0x86de('0xac')],'custom':![],'options':_0xb17f5c};_0x255b00['push'](_0x3d15f7);return _0x255b00;});}function getBooleanList(_0x568267,_0x1eb7bb,_0x575f20,_0x298e03,_0x1b6fb9,_0x4b206d){var _0x1b60cd={'method':_0x86de('0x8a'),'uri':_0x568267+_0x86de('0x8d')+_0x298e03+_0x86de('0xa8')+_0x1b6fb9+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x86de('0x8b')+_0x4b206d,'If-None-Match':null,'OData-Version':_0x86de('0x8e')},'json':!![]};return rp(_0x1b60cd)[_0x86de('0xa')](function(_0x2ca87e){var _0x33e1c7=[];_0x33e1c7['push']({'name':_0x2ca87e['OptionSet'][_0x86de('0xb0')]['Label'][_0x86de('0xad')][_0x86de('0xac')],'value':_0x86de('0xb1')},{'name':_0x2ca87e[_0x86de('0xb2')][_0x86de('0xb3')]['Label'][_0x86de('0xad')][_0x86de('0xac')],'value':'false'});var _0x147769={'id':_0x1eb7bb+'_'+_0x2ca87e[_0x86de('0x92')],'name':_0x2ca87e[_0x86de('0xaf')][_0x86de('0xad')][_0x86de('0xac')],'custom':![],'options':_0x33e1c7};_0x575f20['push'](_0x147769);return _0x575f20;});}function getInputList(_0x4a7770,_0x45877a,_0x409c39,_0x425f1f,_0x9209e7,_0x4a2f7d,_0x4239c5){var _0x4d1b1a={'method':_0x86de('0x8a'),'uri':_0x4a7770+_0x86de('0x8d')+_0x9209e7+_0x86de('0xa8')+_0x4a2f7d+')/Microsoft.Dynamics.CRM.'+_0x409c39+_0x86de('0xb4'),'headers':{'Authorization':'Bearer\x20'+_0x4239c5,'If-None-Match':null,'OData-Version':_0x86de('0x8e')},'json':!![]};return rp(_0x4d1b1a)[_0x86de('0xa')](function(_0x5f309a){var _0x21140f={'id':_0x45877a+'_'+_0x5f309a[_0x86de('0x92')],'name':_0x5f309a['DisplayName']['UserLocalizedLabel']?_0x5f309a[_0x86de('0xaf')][_0x86de('0xad')][_0x86de('0xac')]:_0x5f309a['LogicalName'],'custom':![],'options':[]};_0x425f1f[_0x86de('0x96')](_0x21140f);return _0x425f1f;});} \ No newline at end of file +var _0xabe7=['statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','versionnumber','username','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','substring','PicklistAttributeMetadata','push','all','isNil','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Label','UserLocalizedLabel','Value','DisplayName','TrueOption','true','FalseOption','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../config/logger','api','../../mysqldb','status','json','offset','undefined','count','limit','set','destroy','then','end','error','send','Dynamics365Account','type','key','model','map','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','options','find','create','body','update','params','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','slice','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','Incident','title','description','customerid','ownerid','caseorigincode','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','entitlementidname','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','statecode'];(function(_0x124c75,_0x332013){var _0x5c5471=function(_0x2fd3eb){while(--_0x2fd3eb){_0x124c75['push'](_0x124c75['shift']());}};_0x5c5471(++_0x332013);}(_0xabe7,0x1b0));var _0x7abe=function(_0x40f042,_0x1a7773){_0x40f042=_0x40f042-0x0;var _0x215057=_0xabe7[_0x40f042];return _0x215057;};'use strict';var rp=require(_0x7abe('0x0'));var util=require(_0x7abe('0x1'));var _=require(_0x7abe('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x7abe('0x3'))(_0x7abe('0x4'));var db=require(_0x7abe('0x5'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x2aee9b,_0x40b4c1){_0x40b4c1=_0x40b4c1||0xc8;return function(_0x589d0c){if(_0x589d0c){return _0x2aee9b[_0x7abe('0x6')](_0x40b4c1)[_0x7abe('0x7')](_0x589d0c);}};}function respondWithFilteredResult(_0x56d6ae,_0xa1afbe){return function(_0x1f3ebc){if(_0x1f3ebc){var _0x2fb3ad=typeof _0xa1afbe[_0x7abe('0x8')]==='undefined'&&typeof _0xa1afbe['limit']===_0x7abe('0x9');var _0x139d57=_0x1f3ebc[_0x7abe('0xa')];var _0x9e9619=_0x2fb3ad?0x0:_0xa1afbe[_0x7abe('0x8')];var _0x33389b=_0x2fb3ad?_0x1f3ebc['count']:_0xa1afbe['offset']+_0xa1afbe[_0x7abe('0xb')];var _0x51f4ad;if(_0x33389b>=_0x139d57){_0x33389b=_0x139d57;_0x51f4ad=0xc8;}else{_0x51f4ad=0xce;}_0x56d6ae[_0x7abe('0x6')](_0x51f4ad);return _0x56d6ae[_0x7abe('0xc')]('Content-Range',_0x9e9619+'-'+_0x33389b+'/'+_0x139d57)[_0x7abe('0x7')](_0x1f3ebc);}return null;};}function saveUpdates(_0x1852aa){return function(_0x52b4fe){if(_0x52b4fe){return _0x52b4fe['update'](_0x1852aa)['then'](function(_0x3ffde2){return _0x3ffde2;});}return null;};}function removeEntity(_0x4ae3f0){return function(_0x2b7f07){if(_0x2b7f07){return _0x2b7f07[_0x7abe('0xd')]()[_0x7abe('0xe')](function(){_0x4ae3f0[_0x7abe('0x6')](0xcc)[_0x7abe('0xf')]();});}};}function handleEntityNotFound(_0xcd4c2c){return function(_0x4e0d20){if(!_0x4e0d20){_0xcd4c2c['sendStatus'](0x194);}return _0x4e0d20;};}function handleError(_0x467052,_0x4a6cbf){_0x4a6cbf=_0x4a6cbf||0x1f4;return function(_0x35929f){logger[_0x7abe('0x10')](_0x35929f['stack']);if(_0x35929f['name']){delete _0x35929f['name'];}_0x467052['status'](_0x4a6cbf)[_0x7abe('0x11')](_0x35929f);};}exports['index']=function(_0x324d6f,_0x17b180){var _0x28041b={},_0x4519e6={},_0xe86293={'count':0x0,'rows':[]};var _0x3b37c0=_['map'](db[_0x7abe('0x12')]['rawAttributes'],function(_0x185018){return{'name':_0x185018['fieldName'],'type':_0x185018[_0x7abe('0x13')][_0x7abe('0x14')]};});_0x4519e6[_0x7abe('0x15')]=_[_0x7abe('0x16')](_0x3b37c0,_0x7abe('0x17'));_0x4519e6[_0x7abe('0x18')]=_['keys'](_0x324d6f[_0x7abe('0x18')]);_0x4519e6[_0x7abe('0x19')]=_['intersection'](_0x4519e6[_0x7abe('0x15')],_0x4519e6[_0x7abe('0x18')]);_0x28041b[_0x7abe('0x1a')]=_[_0x7abe('0x1b')](_0x4519e6[_0x7abe('0x15')],qs[_0x7abe('0x1c')](_0x324d6f[_0x7abe('0x18')][_0x7abe('0x1c')]));_0x28041b['attributes']=_0x28041b['attributes'][_0x7abe('0x1d')]?_0x28041b['attributes']:_0x4519e6['model'];if(!_0x324d6f['query'][_0x7abe('0x1e')](_0x7abe('0x1f'))){_0x28041b[_0x7abe('0xb')]=qs[_0x7abe('0xb')](_0x324d6f[_0x7abe('0x18')][_0x7abe('0xb')]);_0x28041b[_0x7abe('0x8')]=qs[_0x7abe('0x8')](_0x324d6f[_0x7abe('0x18')][_0x7abe('0x8')]);}_0x28041b[_0x7abe('0x20')]=qs[_0x7abe('0x21')](_0x324d6f[_0x7abe('0x18')][_0x7abe('0x21')]);_0x28041b[_0x7abe('0x22')]=qs[_0x7abe('0x19')](_[_0x7abe('0x23')](_0x324d6f['query'],_0x4519e6[_0x7abe('0x19')]),_0x3b37c0);if(_0x324d6f[_0x7abe('0x18')][_0x7abe('0x24')]){_0x28041b[_0x7abe('0x22')]=_[_0x7abe('0x25')](_0x28041b[_0x7abe('0x22')],{'$or':_[_0x7abe('0x16')](_0x3b37c0,function(_0x326786){if(_0x326786[_0x7abe('0x13')]!==_0x7abe('0x26')){var _0x111549={};_0x111549[_0x326786[_0x7abe('0x17')]]={'$like':'%'+_0x324d6f[_0x7abe('0x18')][_0x7abe('0x24')]+'%'};return _0x111549;}})});}_0x28041b=_[_0x7abe('0x25')]({},_0x28041b,_0x324d6f['options']);var _0xbbf06b={'where':_0x28041b[_0x7abe('0x22')]};return db['Dynamics365Account'][_0x7abe('0xa')](_0xbbf06b)[_0x7abe('0xe')](function(_0x122807){_0xe86293[_0x7abe('0xa')]=_0x122807;if(_0x324d6f['query'][_0x7abe('0x27')]){_0x28041b[_0x7abe('0x28')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x7abe('0x29')](_0x28041b);})[_0x7abe('0xe')](function(_0x1a6ab0){_0xe86293[_0x7abe('0x2a')]=_0x1a6ab0;return _0xe86293;})[_0x7abe('0xe')](respondWithFilteredResult(_0x17b180,_0x28041b))[_0x7abe('0x2b')](handleError(_0x17b180,null));};exports[_0x7abe('0x2c')]=function(_0x102e01,_0x2f447a){var _0x13ab7c={'raw':![],'where':{'id':_0x102e01['params']['id']}},_0x383a3d={};_0x383a3d[_0x7abe('0x15')]=_['keys'](db[_0x7abe('0x12')][_0x7abe('0x2d')]);_0x383a3d[_0x7abe('0x18')]=_[_0x7abe('0x2e')](_0x102e01[_0x7abe('0x18')]);_0x383a3d[_0x7abe('0x19')]=_[_0x7abe('0x1b')](_0x383a3d['model'],_0x383a3d[_0x7abe('0x18')]);_0x13ab7c['attributes']=_[_0x7abe('0x1b')](_0x383a3d[_0x7abe('0x15')],qs[_0x7abe('0x1c')](_0x102e01[_0x7abe('0x18')][_0x7abe('0x1c')]));_0x13ab7c['attributes']=_0x13ab7c[_0x7abe('0x1a')][_0x7abe('0x1d')]?_0x13ab7c[_0x7abe('0x1a')]:_0x383a3d[_0x7abe('0x15')];if(_0x102e01[_0x7abe('0x18')]['includeAll']){_0x13ab7c[_0x7abe('0x28')]=[{'all':!![]}];}_0x13ab7c=_[_0x7abe('0x25')]({},_0x13ab7c,_0x102e01[_0x7abe('0x2f')]);return db[_0x7abe('0x12')][_0x7abe('0x30')](_0x13ab7c)[_0x7abe('0xe')](handleEntityNotFound(_0x2f447a,null))[_0x7abe('0xe')](respondWithResult(_0x2f447a,null))[_0x7abe('0x2b')](handleError(_0x2f447a,null));};exports[_0x7abe('0x31')]=function(_0x85f7fe,_0x3a1e74){return db[_0x7abe('0x12')][_0x7abe('0x31')](_0x85f7fe[_0x7abe('0x32')],{})['then'](respondWithResult(_0x3a1e74,0xc9))[_0x7abe('0x2b')](handleError(_0x3a1e74,null));};exports[_0x7abe('0x33')]=function(_0xacf804,_0x4f4f92){if(_0xacf804['body']['id']){delete _0xacf804[_0x7abe('0x32')]['id'];}return db['Dynamics365Account'][_0x7abe('0x30')]({'where':{'id':_0xacf804[_0x7abe('0x34')]['id']}})[_0x7abe('0xe')](handleEntityNotFound(_0x4f4f92,null))[_0x7abe('0xe')](saveUpdates(_0xacf804[_0x7abe('0x32')],null))[_0x7abe('0xe')](respondWithResult(_0x4f4f92,null))[_0x7abe('0x2b')](handleError(_0x4f4f92,null));};exports['destroy']=function(_0x4916bc,_0x455677){return db['Dynamics365Account']['find']({'where':{'id':_0x4916bc[_0x7abe('0x34')]['id']}})[_0x7abe('0xe')](handleEntityNotFound(_0x455677,null))[_0x7abe('0xe')](removeEntity(_0x455677,null))[_0x7abe('0x2b')](handleError(_0x455677,null));};exports[_0x7abe('0x35')]=function(_0x1b6424,_0x42a882){var _0x2d9281={};var _0x34d14e={};var _0x535e7d;var _0x269723;return db[_0x7abe('0x12')][_0x7abe('0x36')]({'where':{'id':_0x1b6424[_0x7abe('0x34')]['id']}})[_0x7abe('0xe')](handleEntityNotFound(_0x42a882,null))[_0x7abe('0xe')](function(_0x4e9ea2){if(_0x4e9ea2){_0x535e7d=_0x4e9ea2;_0x34d14e[_0x7abe('0x15')]=_[_0x7abe('0x2e')](db['Dynamics365Configuration'][_0x7abe('0x2d')]);_0x34d14e[_0x7abe('0x18')]=_[_0x7abe('0x2e')](_0x1b6424[_0x7abe('0x18')]);_0x34d14e[_0x7abe('0x19')]=_['intersection'](_0x34d14e[_0x7abe('0x15')],_0x34d14e[_0x7abe('0x18')]);_0x2d9281[_0x7abe('0x1a')]=_[_0x7abe('0x1b')](_0x34d14e[_0x7abe('0x15')],qs[_0x7abe('0x1c')](_0x1b6424[_0x7abe('0x18')][_0x7abe('0x1c')]));_0x2d9281[_0x7abe('0x1a')]=_0x2d9281['attributes'][_0x7abe('0x1d')]?_0x2d9281[_0x7abe('0x1a')]:_0x34d14e[_0x7abe('0x15')];_0x2d9281[_0x7abe('0x20')]=qs[_0x7abe('0x21')](_0x1b6424['query'][_0x7abe('0x21')]);_0x2d9281[_0x7abe('0x22')]=qs[_0x7abe('0x19')](_[_0x7abe('0x23')](_0x1b6424[_0x7abe('0x18')],_0x34d14e['filters']));if(_0x1b6424[_0x7abe('0x18')][_0x7abe('0x24')]){_0x2d9281[_0x7abe('0x22')]=_[_0x7abe('0x25')](_0x2d9281[_0x7abe('0x22')],{'$or':_[_0x7abe('0x16')](_0x2d9281['attributes'],function(_0x49698e){var _0x2835b3={};_0x2835b3[_0x49698e]={'$like':'%'+_0x1b6424['query'][_0x7abe('0x24')]+'%'};return _0x2835b3;})});}_0x2d9281=_['merge']({},_0x2d9281,_0x1b6424['options']);return _0x535e7d[_0x7abe('0x35')](_0x2d9281);}})[_0x7abe('0xe')](function(_0x2df076){if(_0x2df076){_0x269723=_0x2df076[_0x7abe('0x1d')];if(!_0x1b6424['query']['hasOwnProperty'](_0x7abe('0x1f'))){_0x2d9281[_0x7abe('0xb')]=qs[_0x7abe('0xb')](_0x1b6424[_0x7abe('0x18')][_0x7abe('0xb')]);_0x2d9281['offset']=qs['offset'](_0x1b6424[_0x7abe('0x18')][_0x7abe('0x8')]);}return _0x535e7d['getConfigurations'](_0x2d9281);}})[_0x7abe('0xe')](function(_0x4f8d68){if(_0x4f8d68){return _0x4f8d68?{'count':_0x269723,'rows':_0x4f8d68}:null;}})['then'](respondWithResult(_0x42a882,null))[_0x7abe('0x2b')](handleError(_0x42a882,null));};exports[_0x7abe('0x37')]=function(_0x58baa9,_0x75c2a8){if(_0x58baa9['body']['id']){delete _0x58baa9['body']['id'];}return db[_0x7abe('0x12')]['findOne']({'where':{'id':_0x58baa9['params']['id']}})[_0x7abe('0xe')](handleEntityNotFound(_0x75c2a8,null))[_0x7abe('0xe')](function(_0x182cb9){if(_0x182cb9){_0x58baa9[_0x7abe('0x32')][_0x7abe('0x38')]=_0x182cb9['id'];_0x58baa9['body'][_0x7abe('0x39')]=integrations[_0x7abe('0x3a')](_0x58baa9[_0x7abe('0x32')][_0x7abe('0x3b')],_0x58baa9[_0x7abe('0x32')][_0x7abe('0x13')]);_0x58baa9[_0x7abe('0x32')][_0x7abe('0x3c')]=integrations['getDescriptions'](_0x58baa9[_0x7abe('0x32')][_0x7abe('0x3b')],_0x58baa9['body'][_0x7abe('0x13')]);return db['Dynamics365Configuration'][_0x7abe('0x31')](_0x58baa9[_0x7abe('0x32')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0x7abe('0x3d')],'as':_0x7abe('0x3c')}]});}return null;})[_0x7abe('0xe')](respondWithResult(_0x75c2a8,null))[_0x7abe('0x2b')](handleError(_0x75c2a8,null));};function sanitizeRemoteUri(_0x39217c){var _0x17eab2=_0x39217c[_0x7abe('0x3e')](-0x1);if(_0x17eab2==='/')return _0x39217c['substring'](0x0,_0x39217c[_0x7abe('0x3f')](_0x17eab2));return _0x39217c;}function getWebApiUrl(_0x42bda8){return util['format'](_0x7abe('0x40'),_0x42bda8);}exports[_0x7abe('0x41')]=function(_0x20f7bd,_0x5b5aea){var _0x4c6d5d=_0x20f7bd[_0x7abe('0x18')][_0x7abe('0x42')];var _0x4af73c=_0x4c6d5d==='incident'?_0x7abe('0x43'):'PhoneCall';var _0x23629f='';var _0x5b38c5='';var _0x4b8f99='';var _0x2bbb18='';var _0x10283b='';var _0x25d24a='';var _0x56c16a='';var _0x113625='';var _0x34e3ff=[_0x7abe('0x44'),_0x7abe('0x45'),_0x7abe('0x46'),_0x7abe('0x47'),_0x7abe('0x48'),'subject',_0x7abe('0x49'),'regardingobjectid',_0x7abe('0x4a'),_0x7abe('0x4b')];var _0x1ab51d=[_0x7abe('0x4c'),_0x7abe('0x4d'),_0x7abe('0x4e'),_0x7abe('0x4f'),_0x7abe('0x50'),_0x7abe('0x51'),'contractdetailidname',_0x7abe('0x52'),'createdbyexternalpartyname',_0x7abe('0x53'),'createdbyname',_0x7abe('0x54'),_0x7abe('0x55'),_0x7abe('0x56'),_0x7abe('0x57'),_0x7abe('0x58'),_0x7abe('0x59'),'customeridyominame','emailaddress',_0x7abe('0x5a'),'entityimage_timestamp',_0x7abe('0x5b'),_0x7abe('0x5c'),_0x7abe('0x5d'),_0x7abe('0x5e'),_0x7abe('0x5f'),_0x7abe('0x60'),'influencescore',_0x7abe('0x61'),_0x7abe('0x62'),_0x7abe('0x63'),_0x7abe('0x64'),'modifiedbyexternalpartyyominame',_0x7abe('0x65'),_0x7abe('0x66'),'modifiedon',_0x7abe('0x67'),'modifiedonbehalfbyyominame',_0x7abe('0x68'),_0x7abe('0x69'),_0x7abe('0x6a'),_0x7abe('0x6b'),_0x7abe('0x6c'),_0x7abe('0x6d'),'owneridtype',_0x7abe('0x6e'),_0x7abe('0x6f'),'primarycontactidname',_0x7abe('0x70'),_0x7abe('0x71'),_0x7abe('0x72'),_0x7abe('0x73'),_0x7abe('0x74'),_0x7abe('0x75'),_0x7abe('0x76'),_0x7abe('0x77'),_0x7abe('0x78'),_0x7abe('0x79'),'slainvokedidname','slaname','socialprofileidname',_0x7abe('0x7a'),_0x7abe('0x7b'),_0x7abe('0x7c'),_0x7abe('0x7d'),_0x7abe('0x7e'),'transactioncurrencyidname','traversedpath',_0x7abe('0x7f'),_0x7abe('0x80')];var _0xc10dc2=_0x34e3ff['concat'](_0x1ab51d);return db[_0x7abe('0x12')][_0x7abe('0x36')]({'where':{'id':_0x20f7bd[_0x7abe('0x34')]['id']},'attributes':['id',_0x7abe('0x81'),'password',_0x7abe('0x82'),_0x7abe('0x83'),_0x7abe('0x84'),_0x7abe('0x85'),_0x7abe('0x86')],'include':[{'model':db['CloudProvider'],'as':_0x7abe('0x87'),'attributes':['id',_0x7abe('0x88'),_0x7abe('0x89')]}]})['then'](handleEntityNotFound(_0x5b5aea,null))['then'](function(_0x318645){if(_0x318645){if(_0x318645[_0x7abe('0x86')]){_0x318645[_0x7abe('0x8a')]=_0x318645[_0x7abe('0x87')][_0x7abe('0x88')];_0x113625=sanitizeRemoteUri(_0x318645[_0x7abe('0x87')][_0x7abe('0x89')]);_0x56c16a=getWebApiUrl(_0x113625);return _0x318645;}_0x113625=sanitizeRemoteUri(_0x318645['remoteUri']);_0x56c16a=getWebApiUrl(_0x113625);var _0x1266fc={'method':_0x7abe('0x8b'),'uri':_0x7abe('0x8c')+_0x318645[_0x7abe('0x83')]+'/oauth2/token','form':{'client_id':_0x318645['clientId'],'resource':_0x113625,'username':_0x318645['username'],'password':_0x318645[_0x7abe('0x8d')],'grant_type':'password','client_secret':_0x318645[_0x7abe('0x85')]},'json':!![]};return rp(_0x1266fc);}})[_0x7abe('0xe')](function(_0x404369){_0x25d24a=_0x404369['access_token'];var _0x587768={'method':_0x7abe('0x8e'),'uri':encodeURI(_0x56c16a+_0x7abe('0x8f')+_0x4af73c+'\x27'),'headers':{'Authorization':_0x7abe('0x90')+_0x25d24a,'If-None-Match':null,'OData-Version':_0x7abe('0x91')},'json':!![]};return rp(_0x587768);})[_0x7abe('0xe')](function(_0x27931f){var _0x216d40=_0x27931f[_0x7abe('0x92')][0x0];var _0xed6354=_0x216d40[_0x7abe('0x93')];var _0x4342ec={'method':_0x7abe('0x8e'),'uri':_0x56c16a+'EntityDefinitions('+_0xed6354+_0x7abe('0x94'),'headers':{'Authorization':_0x7abe('0x90')+_0x25d24a,'If-None-Match':null,'OData-Version':_0x7abe('0x91')},'json':!![]};return rp(_0x4342ec);})[_0x7abe('0xe')](function(_0x540c66){_0x23629f=_0x540c66;_0x5b38c5=_0x23629f[_0x7abe('0x95')];_0x5b38c5=_[_0x7abe('0x96')](_0x5b38c5,function(_0x4735fa){return!_0xc10dc2[_0x7abe('0x97')](_0x4735fa[_0x7abe('0x98')]);});var _0x2f87ef=[];var _0x1f710f=[];_0x5b38c5[_0x7abe('0x99')](function(_0x1370f5){if(_0x1370f5[_0x7abe('0x9a')]){var _0x56768e=_0x1370f5['@odata.type'][_0x7abe('0x9b')](_0x1370f5[_0x7abe('0x9a')]['lastIndexOf']('.')+0x1);if(_0x56768e===_0x7abe('0x9c')){_0x2f87ef[_0x7abe('0x9d')](getSelectList(_0x56c16a,_0x4c6d5d,_0x1f710f,_0x23629f['MetadataId'],_0x1370f5[_0x7abe('0x93')],_0x25d24a));}}});return Promise[_0x7abe('0x9e')](_0x2f87ef);})[_0x7abe('0xe')](function(_0xb32277){_0x4b8f99=_0xb32277[0x0];var _0x288320=[];var _0x3e2d95=[];_0x5b38c5[_0x7abe('0x99')](function(_0x158480){if(!_[_0x7abe('0x9f')](_0x158480['@odata.type'])){var _0xfe45c1=_0x158480[_0x7abe('0x9a')][_0x7abe('0x9b')](_0x158480['@odata.type'][_0x7abe('0x3f')]('.')+0x1);if(_0xfe45c1==='BooleanAttributeMetadata'){_0x288320['push'](getBooleanList(_0x56c16a,_0x4c6d5d,_0x3e2d95,_0x23629f[_0x7abe('0x93')],_0x158480[_0x7abe('0x93')],_0x25d24a));}}});return Promise[_0x7abe('0x9e')](_0x288320);})[_0x7abe('0xe')](function(_0x11c54f){_0x2bbb18=_0x11c54f[0x0];var _0x5a3f10=[];var _0x523f77=[];_0x5b38c5['forEach'](function(_0x5420d4){if(_0x5420d4['@odata.type']){var _0x2bf4c6=_0x5420d4['@odata.type'][_0x7abe('0x9b')](_0x5420d4[_0x7abe('0x9a')][_0x7abe('0x3f')]('.')+0x1);if(_0x2bf4c6===_0x7abe('0xa0')||_0x2bf4c6===_0x7abe('0xa1')||_0x2bf4c6===_0x7abe('0xa2')||_0x2bf4c6===_0x7abe('0xa3')||_0x2bf4c6===_0x7abe('0xa4')||_0x2bf4c6===_0x7abe('0xa5')||_0x2bf4c6===_0x7abe('0xa6')||_0x2bf4c6===_0x7abe('0xa7')||_0x2bf4c6===_0x7abe('0xa8')||_0x2bf4c6===_0x7abe('0xa9')){_0x5a3f10[_0x7abe('0x9d')](getInputList(_0x56c16a,_0x4c6d5d,_0x2bf4c6,_0x523f77,_0x23629f[_0x7abe('0x93')],_0x5420d4[_0x7abe('0x93')],_0x25d24a));}}});return Promise[_0x7abe('0x9e')](_0x5a3f10);})[_0x7abe('0xe')](function(_0x51a2f9){_0x10283b=_0x51a2f9[0x0];var _0xe033c0=_0x4b8f99[_0x7abe('0xaa')](_0x2bbb18)[_0x7abe('0xaa')](_0x10283b);var _0x238769={'count':_0xe033c0[_0x7abe('0x1d')],'rows':_0xe033c0};return _0x238769;})[_0x7abe('0xe')](respondWithResult(_0x5b5aea,null))[_0x7abe('0x2b')](function(_0xdbeec7){var _0x4fadd7=_0x20f7bd['query'][_0x7abe('0xab')]?0x1f4:_0xdbeec7[_0x7abe('0xac')]||0x1f4;logger[_0x7abe('0x10')](_0xdbeec7['stack']);delete _0xdbeec7['name'];if(_0x4fadd7===0x191){_0x4fadd7=0x190;}_0x5b5aea['status'](_0x4fadd7)[_0x7abe('0x11')](_0x20f7bd[_0x7abe('0x18')]['test']?{'message':'Wrong\x20credentials','statusCode':_0xdbeec7[_0x7abe('0xac')]}:_0xdbeec7);});};function getSelectList(_0x1c7a3e,_0x576a74,_0x23dbe8,_0x1fb95d,_0x341ce1,_0x525c9a){var _0x3150d8={'method':'GET','uri':_0x1c7a3e+_0x7abe('0xad')+_0x1fb95d+_0x7abe('0xae')+_0x341ce1+_0x7abe('0xaf')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x7abe('0x90')+_0x525c9a,'If-None-Match':null,'OData-Version':_0x7abe('0x91')},'json':!![]};return rp(_0x3150d8)['then'](function(_0x3a3cfd){var _0x4f199b=[];var _0x2b6447=_0x3a3cfd[_0x7abe('0xb0')]['Options'];_0x2b6447[_0x7abe('0x99')](function(_0x297a3f){_0x4f199b['push']({'name':_0x297a3f[_0x7abe('0xb1')][_0x7abe('0xb2')][_0x7abe('0xb1')],'value':String(_0x297a3f[_0x7abe('0xb3')])});});var _0x4d2add={'id':_0x576a74+'_'+_0x3a3cfd[_0x7abe('0x98')],'name':_0x3a3cfd[_0x7abe('0xb4')][_0x7abe('0xb2')][_0x7abe('0xb1')],'custom':![],'options':_0x4f199b};_0x23dbe8[_0x7abe('0x9d')](_0x4d2add);return _0x23dbe8;});}function getBooleanList(_0x473298,_0x44fbf2,_0xb4945d,_0x5f3881,_0x45fb7b,_0x544b3f){var _0x59d593={'method':_0x7abe('0x8e'),'uri':_0x473298+'EntityDefinitions('+_0x5f3881+_0x7abe('0xae')+_0x45fb7b+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x544b3f,'If-None-Match':null,'OData-Version':_0x7abe('0x91')},'json':!![]};return rp(_0x59d593)['then'](function(_0x337cc9){var _0x5eec0d=[];_0x5eec0d['push']({'name':_0x337cc9[_0x7abe('0xb0')][_0x7abe('0xb5')][_0x7abe('0xb1')]['UserLocalizedLabel'][_0x7abe('0xb1')],'value':_0x7abe('0xb6')},{'name':_0x337cc9[_0x7abe('0xb0')][_0x7abe('0xb7')][_0x7abe('0xb1')]['UserLocalizedLabel']['Label'],'value':'false'});var _0x37dd7f={'id':_0x44fbf2+'_'+_0x337cc9[_0x7abe('0x98')],'name':_0x337cc9[_0x7abe('0xb4')]['UserLocalizedLabel'][_0x7abe('0xb1')],'custom':![],'options':_0x5eec0d};_0xb4945d[_0x7abe('0x9d')](_0x37dd7f);return _0xb4945d;});}function getInputList(_0x5a9ba3,_0x495abd,_0x3c0f39,_0x5bd1b9,_0x523916,_0x40d21e,_0x199c67){var _0x4c1ccf={'method':_0x7abe('0x8e'),'uri':_0x5a9ba3+_0x7abe('0xad')+_0x523916+_0x7abe('0xae')+_0x40d21e+')/Microsoft.Dynamics.CRM.'+_0x3c0f39+_0x7abe('0xb8'),'headers':{'Authorization':_0x7abe('0x90')+_0x199c67,'If-None-Match':null,'OData-Version':_0x7abe('0x91')},'json':!![]};return rp(_0x4c1ccf)[_0x7abe('0xe')](function(_0x86717f){var _0x2350bf={'id':_0x495abd+'_'+_0x86717f[_0x7abe('0x98')],'name':_0x86717f[_0x7abe('0xb4')][_0x7abe('0xb2')]?_0x86717f[_0x7abe('0xb4')][_0x7abe('0xb2')]['Label']:_0x86717f[_0x7abe('0x98')],'custom':![],'options':[]};_0x5bd1b9[_0x7abe('0x9d')](_0x2350bf);return _0x5bd1b9;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index d168534..5f1cc65 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x37f6d1,_0xa77f3){var _0x165e9a=function(_0x5babfe){while(--_0x5babfe){_0x37f6d1['push'](_0x37f6d1['shift']());}};_0x165e9a(++_0xa77f3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x162dbb,_0x454e70){var _0x1fc0b7=function(_0x3ed785){while(--_0x3ed785){_0x162dbb['push'](_0x162dbb['shift']());}};_0x1fc0b7(++_0x454e70);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'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 diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index e31d8db..9b20628 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 _0x7d1d=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','include','map','model','catch','ShowDynamics365Account','find','where','debug'];(function(_0x24caf5,_0x323c58){var _0x16cc10=function(_0x392195){while(--_0x392195){_0x24caf5['push'](_0x24caf5['shift']());}};_0x16cc10(++_0x323c58);}(_0x7d1d,0x69));var _0xd7d1=function(_0x257495,_0x18269b){_0x257495=_0x257495-0x0;var _0x3849aa=_0x7d1d[_0x257495];return _0x3849aa;};'use strict';var _=require(_0xd7d1('0x0'));var util=require('util');var moment=require(_0xd7d1('0x1'));var BPromise=require(_0xd7d1('0x2'));var rs=require(_0xd7d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd7d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd7d1('0x5'));var jayson=require(_0xd7d1('0x6'));var client=jayson[_0xd7d1('0x7')][_0xd7d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31d8bf,_0x19b3ea,_0x131e60){return new BPromise(function(_0x13e5d2,_0x18e2d7){return client[_0xd7d1('0x9')](_0x31d8bf,_0x131e60)[_0xd7d1('0xa')](function(_0x1ddc36){logger[_0xd7d1('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x19b3ea,_0xd7d1('0xc'));logger['debug'](_0xd7d1('0xd'),_0x19b3ea,_0xd7d1('0xc'),JSON[_0xd7d1('0xe')](_0x1ddc36));if(_0x1ddc36[_0xd7d1('0xf')]){if(_0x1ddc36['error'][_0xd7d1('0x10')]===0x1f4){logger[_0xd7d1('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x19b3ea,_0x1ddc36[_0xd7d1('0xf')]['message']);return _0x18e2d7(_0x1ddc36[_0xd7d1('0xf')][_0xd7d1('0x11')]);}logger['error'](_0xd7d1('0x12'),_0x19b3ea,_0x1ddc36[_0xd7d1('0xf')][_0xd7d1('0x11')]);return _0x13e5d2(_0x1ddc36[_0xd7d1('0xf')][_0xd7d1('0x11')]);}else{logger[_0xd7d1('0xb')](_0xd7d1('0x12'),_0x19b3ea,'request\x20sent');_0x13e5d2(_0x1ddc36[_0xd7d1('0x13')][_0xd7d1('0x11')]);}})['catch'](function(_0x58e7ed){logger['error'](_0xd7d1('0x12'),_0x19b3ea,_0x58e7ed);_0x18e2d7(_0x58e7ed);});});}exports[_0xd7d1('0x14')]=function(_0x567920){var _0x1c44ac=this;return new Promise(function(_0x132efe,_0x339f7f){return db[_0xd7d1('0x15')][_0xd7d1('0x16')]({'raw':_0x567920['options']?_0x567920[_0xd7d1('0x17')][_0xd7d1('0x18')]===undefined?!![]:![]:!![],'where':_0x567920[_0xd7d1('0x17')]?_0x567920[_0xd7d1('0x17')]['where']||null:null,'attributes':_0x567920[_0xd7d1('0x17')]?_0x567920['options'][_0xd7d1('0x19')]||null:null,'limit':_0x567920[_0xd7d1('0x17')]?_0x567920['options'][_0xd7d1('0x1a')]||null:null,'include':_0x567920['options']?_0x567920[_0xd7d1('0x17')][_0xd7d1('0x1b')]?_[_0xd7d1('0x1c')](_0x567920[_0xd7d1('0x17')][_0xd7d1('0x1b')],function(_0xf3f04e){return{'model':db[_0xf3f04e['model']],'as':_0xf3f04e['as'],'attributes':_0xf3f04e[_0xd7d1('0x19')],'include':_0xf3f04e[_0xd7d1('0x1b')]?_[_0xd7d1('0x1c')](_0xf3f04e[_0xd7d1('0x1b')],function(_0x185b28){return{'model':db[_0x185b28[_0xd7d1('0x1d')]],'as':_0x185b28['as'],'attributes':_0x185b28[_0xd7d1('0x19')],'include':_0x185b28[_0xd7d1('0x1b')]?_[_0xd7d1('0x1c')](_0x185b28[_0xd7d1('0x1b')],function(_0x52d311){return{'model':db[_0x52d311[_0xd7d1('0x1d')]],'as':_0x52d311['as'],'attributes':_0x52d311['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d240b){logger[_0xd7d1('0xb')](_0xd7d1('0x14'),_0x567920);logger['debug'](_0xd7d1('0x14'),_0x567920,JSON['stringify'](_0x1d240b));_0x132efe(_0x1d240b);})[_0xd7d1('0x1e')](function(_0x251872){logger[_0xd7d1('0xf')]('GetDynamics365Account',_0x251872[_0xd7d1('0x11')],_0x567920);_0x339f7f(_0x1c44ac[_0xd7d1('0xf')](0x1f4,_0x251872['message']));});});};exports[_0xd7d1('0x1f')]=function(_0xac67ce){var _0x3c28cf=this;return new Promise(function(_0x171d33,_0x4de02e){return db[_0xd7d1('0x15')][_0xd7d1('0x20')]({'raw':_0xac67ce[_0xd7d1('0x17')]?_0xac67ce[_0xd7d1('0x17')][_0xd7d1('0x18')]===undefined?!![]:![]:!![],'where':_0xac67ce[_0xd7d1('0x17')]?_0xac67ce['options'][_0xd7d1('0x21')]||null:null,'attributes':_0xac67ce[_0xd7d1('0x17')]?_0xac67ce[_0xd7d1('0x17')]['attributes']||null:null,'include':_0xac67ce[_0xd7d1('0x17')]?_0xac67ce['options']['include']?_[_0xd7d1('0x1c')](_0xac67ce[_0xd7d1('0x17')][_0xd7d1('0x1b')],function(_0x59ee0e){return{'model':db[_0x59ee0e['model']],'as':_0x59ee0e['as'],'attributes':_0x59ee0e[_0xd7d1('0x19')],'include':_0x59ee0e[_0xd7d1('0x1b')]?_['map'](_0x59ee0e[_0xd7d1('0x1b')],function(_0x4754c4){return{'model':db[_0x4754c4[_0xd7d1('0x1d')]],'as':_0x4754c4['as'],'attributes':_0x4754c4[_0xd7d1('0x19')],'include':_0x4754c4[_0xd7d1('0x1b')]?_['map'](_0x4754c4[_0xd7d1('0x1b')],function(_0x25fb83){return{'model':db[_0x25fb83[_0xd7d1('0x1d')]],'as':_0x25fb83['as'],'attributes':_0x25fb83[_0xd7d1('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5dfa29){logger[_0xd7d1('0xb')](_0xd7d1('0x1f'),_0xac67ce);logger[_0xd7d1('0x22')](_0xd7d1('0x1f'),_0xac67ce,JSON['stringify'](_0x5dfa29));_0x171d33(_0x5dfa29);})['catch'](function(_0x29ea4d){logger[_0xd7d1('0xf')](_0xd7d1('0x1f'),_0x29ea4d[_0xd7d1('0x11')],_0xac67ce);_0x4de02e(_0x3c28cf['error'](0x1f4,_0x29ea4d['message']));});});}; \ No newline at end of file +var _0xee23=['code','Dynamics365Account,\x20%s,\x20%s','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowDynamics365Account','find','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error'];(function(_0x501a1b,_0x5d0e68){var _0x10d983=function(_0x2d0e0c){while(--_0x2d0e0c){_0x501a1b['push'](_0x501a1b['shift']());}};_0x10d983(++_0x5d0e68);}(_0xee23,0x1da));var _0x3ee2=function(_0x355eb7,_0x4649e3){_0x355eb7=_0x355eb7-0x0;var _0x4adb22=_0xee23[_0x355eb7];return _0x4adb22;};'use strict';var _=require(_0x3ee2('0x0'));var util=require('util');var moment=require(_0x3ee2('0x1'));var BPromise=require(_0x3ee2('0x2'));var rs=require(_0x3ee2('0x3'));var fs=require('fs');var Redis=require(_0x3ee2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3ee2('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3ee2('0x6'));var jayson=require(_0x3ee2('0x7'));var client=jayson['client'][_0x3ee2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4fc3b9,_0xfc7139,_0x89d7dd){return new BPromise(function(_0x233bc4,_0x456b82){return client[_0x3ee2('0x9')](_0x4fc3b9,_0x89d7dd)[_0x3ee2('0xa')](function(_0x3347f5){logger[_0x3ee2('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0xfc7139,_0x3ee2('0xc'));logger[_0x3ee2('0xd')](_0x3ee2('0xe'),_0xfc7139,_0x3ee2('0xc'),JSON['stringify'](_0x3347f5));if(_0x3347f5[_0x3ee2('0xf')]){if(_0x3347f5[_0x3ee2('0xf')][_0x3ee2('0x10')]===0x1f4){logger['error'](_0x3ee2('0x11'),_0xfc7139,_0x3347f5['error'][_0x3ee2('0x12')]);return _0x456b82(_0x3347f5[_0x3ee2('0xf')]['message']);}logger[_0x3ee2('0xf')](_0x3ee2('0x11'),_0xfc7139,_0x3347f5[_0x3ee2('0xf')][_0x3ee2('0x12')]);return _0x233bc4(_0x3347f5['error'][_0x3ee2('0x12')]);}else{logger['info'](_0x3ee2('0x11'),_0xfc7139,_0x3ee2('0xc'));_0x233bc4(_0x3347f5[_0x3ee2('0x13')][_0x3ee2('0x12')]);}})['catch'](function(_0x121a40){logger[_0x3ee2('0xf')](_0x3ee2('0x11'),_0xfc7139,_0x121a40);_0x456b82(_0x121a40);});});}exports[_0x3ee2('0x14')]=function(_0x618970){var _0x2c55e5=this;return new Promise(function(_0x88c881,_0x4f30be){return db[_0x3ee2('0x15')][_0x3ee2('0x16')]({'raw':_0x618970[_0x3ee2('0x17')]?_0x618970[_0x3ee2('0x17')][_0x3ee2('0x18')]===undefined?!![]:![]:!![],'where':_0x618970[_0x3ee2('0x17')]?_0x618970[_0x3ee2('0x17')][_0x3ee2('0x19')]||null:null,'attributes':_0x618970[_0x3ee2('0x17')]?_0x618970[_0x3ee2('0x17')][_0x3ee2('0x1a')]||null:null,'limit':_0x618970[_0x3ee2('0x17')]?_0x618970[_0x3ee2('0x17')][_0x3ee2('0x1b')]||null:null,'include':_0x618970['options']?_0x618970['options'][_0x3ee2('0x1c')]?_[_0x3ee2('0x1d')](_0x618970[_0x3ee2('0x17')]['include'],function(_0x538760){return{'model':db[_0x538760[_0x3ee2('0x1e')]],'as':_0x538760['as'],'attributes':_0x538760[_0x3ee2('0x1a')],'include':_0x538760[_0x3ee2('0x1c')]?_[_0x3ee2('0x1d')](_0x538760['include'],function(_0x39da37){return{'model':db[_0x39da37['model']],'as':_0x39da37['as'],'attributes':_0x39da37['attributes'],'include':_0x39da37[_0x3ee2('0x1c')]?_['map'](_0x39da37[_0x3ee2('0x1c')],function(_0x42f92f){return{'model':db[_0x42f92f[_0x3ee2('0x1e')]],'as':_0x42f92f['as'],'attributes':_0x42f92f[_0x3ee2('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c5099){logger[_0x3ee2('0xb')]('GetDynamics365Account',_0x618970);logger[_0x3ee2('0xd')](_0x3ee2('0x14'),_0x618970,JSON[_0x3ee2('0x1f')](_0x2c5099));_0x88c881(_0x2c5099);})['catch'](function(_0x1fa14f){logger[_0x3ee2('0xf')]('GetDynamics365Account',_0x1fa14f[_0x3ee2('0x12')],_0x618970);_0x4f30be(_0x2c55e5[_0x3ee2('0xf')](0x1f4,_0x1fa14f[_0x3ee2('0x12')]));});});};exports[_0x3ee2('0x20')]=function(_0x78ddf0){var _0x4e893a=this;return new Promise(function(_0xc46371,_0x3c2b99){return db['Dynamics365Account'][_0x3ee2('0x21')]({'raw':_0x78ddf0['options']?_0x78ddf0[_0x3ee2('0x17')][_0x3ee2('0x18')]===undefined?!![]:![]:!![],'where':_0x78ddf0[_0x3ee2('0x17')]?_0x78ddf0[_0x3ee2('0x17')]['where']||null:null,'attributes':_0x78ddf0[_0x3ee2('0x17')]?_0x78ddf0[_0x3ee2('0x17')][_0x3ee2('0x1a')]||null:null,'include':_0x78ddf0[_0x3ee2('0x17')]?_0x78ddf0['options'][_0x3ee2('0x1c')]?_['map'](_0x78ddf0[_0x3ee2('0x17')][_0x3ee2('0x1c')],function(_0x50d023){return{'model':db[_0x50d023[_0x3ee2('0x1e')]],'as':_0x50d023['as'],'attributes':_0x50d023[_0x3ee2('0x1a')],'include':_0x50d023[_0x3ee2('0x1c')]?_[_0x3ee2('0x1d')](_0x50d023['include'],function(_0x371737){return{'model':db[_0x371737[_0x3ee2('0x1e')]],'as':_0x371737['as'],'attributes':_0x371737[_0x3ee2('0x1a')],'include':_0x371737[_0x3ee2('0x1c')]?_['map'](_0x371737[_0x3ee2('0x1c')],function(_0x43ba0e){return{'model':db[_0x43ba0e[_0x3ee2('0x1e')]],'as':_0x43ba0e['as'],'attributes':_0x43ba0e[_0x3ee2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3ee2('0xa')](function(_0x198885){logger[_0x3ee2('0xb')](_0x3ee2('0x20'),_0x78ddf0);logger[_0x3ee2('0xd')]('ShowDynamics365Account',_0x78ddf0,JSON['stringify'](_0x198885));_0xc46371(_0x198885);})[_0x3ee2('0x22')](function(_0x408a32){logger[_0x3ee2('0xf')]('ShowDynamics365Account',_0x408a32[_0x3ee2('0x12')],_0x78ddf0);_0x3c2b99(_0x4e893a[_0x3ee2('0xf')](0x1f4,_0x408a32['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 90f4f09..1996c03 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 _0x1bba=['../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x1bba,0xa7));var _0xa1bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1bba[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xa1bb('0x0'));var util=require(_0xa1bb('0x1'));var path=require('path');var timeout=require(_0xa1bb('0x2'));var express=require(_0xa1bb('0x3'));var router=express[_0xa1bb('0x4')]();var fs_extra=require(_0xa1bb('0x5'));var auth=require(_0xa1bb('0x6'));var interaction=require(_0xa1bb('0x7'));var config=require(_0xa1bb('0x8'));var controller=require(_0xa1bb('0x9'));router[_0xa1bb('0xa')]('/',auth[_0xa1bb('0xb')](),controller[_0xa1bb('0xc')]);router[_0xa1bb('0xa')](_0xa1bb('0xd'),auth[_0xa1bb('0xb')](),controller[_0xa1bb('0xe')]);router[_0xa1bb('0xa')](_0xa1bb('0xf'),auth[_0xa1bb('0xb')](),controller[_0xa1bb('0x10')]);router[_0xa1bb('0xa')](_0xa1bb('0x11'),auth[_0xa1bb('0xb')](),controller[_0xa1bb('0x12')]);router[_0xa1bb('0xa')]('/:id/descriptions',auth[_0xa1bb('0xb')](),controller[_0xa1bb('0x13')]);router['post']('/',auth[_0xa1bb('0xb')](),controller['create']);router[_0xa1bb('0x14')](_0xa1bb('0xd'),auth[_0xa1bb('0xb')](),controller[_0xa1bb('0x15')]);router[_0xa1bb('0x16')](_0xa1bb('0xd'),auth['isAuthenticated'](),controller[_0xa1bb('0x17')]);module[_0xa1bb('0x18')]=router; \ No newline at end of file +var _0xa069=['get','index','/:id','show','/:id/fields','getFields','/:id/subjects','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa069,0xa6));var _0x9a06=function(_0x2d2a10,_0x18b98d){_0x2d2a10=_0x2d2a10-0x0;var _0xb171a0=_0xa069[_0x2d2a10];return _0xb171a0;};'use strict';var multer=require('multer');var util=require(_0x9a06('0x0'));var path=require(_0x9a06('0x1'));var timeout=require(_0x9a06('0x2'));var express=require(_0x9a06('0x3'));var router=express[_0x9a06('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9a06('0x5'));var interaction=require(_0x9a06('0x6'));var config=require(_0x9a06('0x7'));var controller=require(_0x9a06('0x8'));router[_0x9a06('0x9')]('/',auth['isAuthenticated'](),controller[_0x9a06('0xa')]);router[_0x9a06('0x9')](_0x9a06('0xb'),auth['isAuthenticated'](),controller[_0x9a06('0xc')]);router[_0x9a06('0x9')](_0x9a06('0xd'),auth['isAuthenticated'](),controller[_0x9a06('0xe')]);router[_0x9a06('0x9')](_0x9a06('0xf'),auth[_0x9a06('0x10')](),controller[_0x9a06('0x11')]);router[_0x9a06('0x9')](_0x9a06('0x12'),auth[_0x9a06('0x10')](),controller[_0x9a06('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9a06('0x14')]);router[_0x9a06('0x15')](_0x9a06('0xb'),auth[_0x9a06('0x10')](),controller[_0x9a06('0x16')]);router['delete']('/:id',auth[_0x9a06('0x10')](),controller[_0x9a06('0x17')]);module[_0x9a06('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 710755d..83a2007 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 _0x545a=['ENUM','incident','contact','nothing','BOOLEAN','sequelize','STRING'];(function(_0x402a93,_0x5089f7){var _0x34085b=function(_0x26a26b){while(--_0x26a26b){_0x402a93['push'](_0x402a93['shift']());}};_0x34085b(++_0x5089f7);}(_0x545a,0x19b));var _0xa545=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x545a[_0x4d613c];return _0x301fe3;};'use strict';var Sequelize=require(_0xa545('0x0'));module['exports']={'name':{'type':Sequelize[_0xa545('0x1')]},'description':{'type':Sequelize[_0xa545('0x1')]},'ticketType':{'type':Sequelize[_0xa545('0x2')](_0xa545('0x3'),'phonecall'),'defaultValue':_0xa545('0x3')},'moduleCreate':{'type':Sequelize['ENUM'](_0xa545('0x4'),_0xa545('0x5')),'defaultValue':_0xa545('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xa545('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xa545('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd02f=['phonecall','nothing','contact','BOOLEAN','sequelize','exports','STRING'];(function(_0x379d09,_0x3f807e){var _0x1fdd48=function(_0x6f56f9){while(--_0x6f56f9){_0x379d09['push'](_0x379d09['shift']());}};_0x1fdd48(++_0x3f807e);}(_0xd02f,0xf9));var _0xfd02=function(_0x556e63,_0x16abaf){_0x556e63=_0x556e63-0x0;var _0x1f18a9=_0xd02f[_0x556e63];return _0x1f18a9;};'use strict';var Sequelize=require(_0xfd02('0x0'));module[_0xfd02('0x1')]={'name':{'type':Sequelize[_0xfd02('0x2')]},'description':{'type':Sequelize[_0xfd02('0x2')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0xfd02('0x3')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize['ENUM']('contact',_0xfd02('0x4')),'defaultValue':_0xfd02('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xfd02('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index e02a47c..d8664d1 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 _0xaa45=['reject','save','update','then','end','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','getFields','Dynamics365Field','getSubjects','findOne','order','nolimit','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','offset','count','set','apply'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xaa45,0x7c));var _0x5aa4=function(_0x3e2489,_0x41d9dd){_0x3e2489=_0x3e2489-0x0;var _0x2254ce=_0xaa45[_0x3e2489];return _0x2254ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5aa4('0x0'));var zipdir=require(_0x5aa4('0x1'));var jsonpatch=require(_0x5aa4('0x2'));var rp=require(_0x5aa4('0x3'));var moment=require(_0x5aa4('0x4'));var BPromise=require(_0x5aa4('0x5'));var Mustache=require('mustache');var util=require(_0x5aa4('0x6'));var path=require(_0x5aa4('0x7'));var sox=require(_0x5aa4('0x8'));var csv=require(_0x5aa4('0x9'));var ejs=require(_0x5aa4('0xa'));var fs=require('fs');var fs_extra=require(_0x5aa4('0xb'));var _=require(_0x5aa4('0xc'));var squel=require(_0x5aa4('0xd'));var crypto=require('crypto');var jsforce=require(_0x5aa4('0xe'));var deskjs=require(_0x5aa4('0xf'));var toCsv=require(_0x5aa4('0x9'));var querystring=require(_0x5aa4('0x10'));var Papa=require(_0x5aa4('0x11'));var Redis=require(_0x5aa4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x5aa4('0x13'));var as=require(_0x5aa4('0x14'));var hardwareService=require(_0x5aa4('0x15'));var logger=require(_0x5aa4('0x16'))(_0x5aa4('0x17'));var utils=require(_0x5aa4('0x18'));var config=require(_0x5aa4('0x19'));var licenseUtil=require(_0x5aa4('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46504f,_0x56122d){_0x56122d=_0x56122d||0xcc;return function(_0x4bb0f1){if(_0x4bb0f1){return _0x46504f[_0x5aa4('0x1b')](_0x56122d);}return _0x46504f[_0x5aa4('0x1c')](_0x56122d)['end']();};}function respondWithResult(_0x2edcd2,_0x715026){_0x715026=_0x715026||0xc8;return function(_0x7e1db7){if(_0x7e1db7){return _0x2edcd2[_0x5aa4('0x1c')](_0x715026)[_0x5aa4('0x1d')](_0x7e1db7);}};}function respondWithFilteredResult(_0x429613,_0x2bdf55){return function(_0x3b06b4){if(_0x3b06b4){var _0xfe4969=typeof _0x2bdf55['offset']===_0x5aa4('0x1e')&&typeof _0x2bdf55[_0x5aa4('0x1f')]===_0x5aa4('0x1e');var _0x3fccfc=_0x3b06b4['count'];var _0x493cfc=_0xfe4969?0x0:_0x2bdf55[_0x5aa4('0x20')];var _0x1f8d07=_0xfe4969?_0x3b06b4[_0x5aa4('0x21')]:_0x2bdf55['offset']+_0x2bdf55[_0x5aa4('0x1f')];var _0x343934;if(_0x1f8d07>=_0x3fccfc){_0x1f8d07=_0x3fccfc;_0x343934=0xc8;}else{_0x343934=0xce;}_0x429613[_0x5aa4('0x1c')](_0x343934);return _0x429613[_0x5aa4('0x22')]('Content-Range',_0x493cfc+'-'+_0x1f8d07+'/'+_0x3fccfc)[_0x5aa4('0x1d')](_0x3b06b4);}return null;};}function patchUpdates(_0x1d42bc){return function(_0x4d0ed3){try{jsonpatch[_0x5aa4('0x23')](_0x4d0ed3,_0x1d42bc,!![]);}catch(_0x567948){return BPromise[_0x5aa4('0x24')](_0x567948);}return _0x4d0ed3[_0x5aa4('0x25')]();};}function saveUpdates(_0x370f3f,_0x536448){return function(_0x3034d6){if(_0x3034d6){return _0x3034d6[_0x5aa4('0x26')](_0x370f3f)[_0x5aa4('0x27')](function(_0x5b84f3){return _0x5b84f3;});}return null;};}function removeEntity(_0x2f0c13,_0x4e41b0){return function(_0x1974fd){if(_0x1974fd){return _0x1974fd['destroy']()[_0x5aa4('0x27')](function(){_0x2f0c13[_0x5aa4('0x1c')](0xcc)[_0x5aa4('0x28')]();});}};}function handleEntityNotFound(_0x322d00,_0x2812f2){return function(_0xa32495){if(!_0xa32495){_0x322d00[_0x5aa4('0x1b')](0x194);}return _0xa32495;};}function handleError(_0x2f39a1,_0x3da4e5){_0x3da4e5=_0x3da4e5||0x1f4;return function(_0x5e908c){logger['error'](_0x5e908c[_0x5aa4('0x29')]);if(_0x5e908c[_0x5aa4('0x2a')]){delete _0x5e908c[_0x5aa4('0x2a')];}_0x2f39a1[_0x5aa4('0x1c')](_0x3da4e5)[_0x5aa4('0x2b')](_0x5e908c);};}exports[_0x5aa4('0x2c')]=function(_0x5d902e,_0x3926e0){var _0xf194f6={},_0x5667c0={},_0x30c040={'count':0x0,'rows':[]};var _0x300835=_[_0x5aa4('0x2d')](db[_0x5aa4('0x2e')][_0x5aa4('0x2f')],function(_0x359919){return{'name':_0x359919['fieldName'],'type':_0x359919['type']['key']};});_0x5667c0[_0x5aa4('0x30')]=_[_0x5aa4('0x2d')](_0x300835,_0x5aa4('0x2a'));_0x5667c0[_0x5aa4('0x31')]=_[_0x5aa4('0x32')](_0x5d902e['query']);_0x5667c0[_0x5aa4('0x33')]=_[_0x5aa4('0x34')](_0x5667c0['model'],_0x5667c0[_0x5aa4('0x31')]);_0xf194f6[_0x5aa4('0x35')]=_[_0x5aa4('0x34')](_0x5667c0['model'],qs['fields'](_0x5d902e['query'][_0x5aa4('0x36')]));_0xf194f6[_0x5aa4('0x35')]=_0xf194f6[_0x5aa4('0x35')][_0x5aa4('0x37')]?_0xf194f6[_0x5aa4('0x35')]:_0x5667c0[_0x5aa4('0x30')];if(!_0x5d902e[_0x5aa4('0x31')][_0x5aa4('0x38')]('nolimit')){_0xf194f6[_0x5aa4('0x1f')]=qs[_0x5aa4('0x1f')](_0x5d902e['query'][_0x5aa4('0x1f')]);_0xf194f6[_0x5aa4('0x20')]=qs[_0x5aa4('0x20')](_0x5d902e['query'][_0x5aa4('0x20')]);}_0xf194f6['order']=qs[_0x5aa4('0x39')](_0x5d902e['query'][_0x5aa4('0x39')]);_0xf194f6[_0x5aa4('0x3a')]=qs[_0x5aa4('0x33')](_[_0x5aa4('0x3b')](_0x5d902e[_0x5aa4('0x31')],_0x5667c0[_0x5aa4('0x33')]),_0x300835);if(_0x5d902e[_0x5aa4('0x31')][_0x5aa4('0x3c')]){_0xf194f6[_0x5aa4('0x3a')]=_[_0x5aa4('0x3d')](_0xf194f6[_0x5aa4('0x3a')],{'$or':_['map'](_0x300835,function(_0x1901a8){if(_0x1901a8['type']!=='VIRTUAL'){var _0x351c74={};_0x351c74[_0x1901a8[_0x5aa4('0x2a')]]={'$like':'%'+_0x5d902e[_0x5aa4('0x31')][_0x5aa4('0x3c')]+'%'};return _0x351c74;}})});}_0xf194f6=_[_0x5aa4('0x3d')]({},_0xf194f6,_0x5d902e[_0x5aa4('0x3e')]);var _0x4e151e={'where':_0xf194f6['where']};return db['Dynamics365Configuration']['count'](_0x4e151e)[_0x5aa4('0x27')](function(_0x585d92){_0x30c040[_0x5aa4('0x21')]=_0x585d92;if(_0x5d902e['query'][_0x5aa4('0x3f')]){_0xf194f6['include']=[{'all':!![]}];}return db[_0x5aa4('0x2e')][_0x5aa4('0x40')](_0xf194f6);})[_0x5aa4('0x27')](function(_0x389c07){_0x30c040[_0x5aa4('0x41')]=_0x389c07;return _0x30c040;})[_0x5aa4('0x27')](respondWithFilteredResult(_0x3926e0,_0xf194f6))[_0x5aa4('0x42')](handleError(_0x3926e0,null));};exports[_0x5aa4('0x43')]=function(_0x2198ed,_0x707d89){var _0x1615bd={'raw':![],'where':{'id':_0x2198ed[_0x5aa4('0x44')]['id']}},_0x40241d={};_0x40241d[_0x5aa4('0x30')]=_[_0x5aa4('0x32')](db['Dynamics365Configuration'][_0x5aa4('0x2f')]);_0x40241d[_0x5aa4('0x31')]=_['keys'](_0x2198ed[_0x5aa4('0x31')]);_0x40241d[_0x5aa4('0x33')]=_['intersection'](_0x40241d[_0x5aa4('0x30')],_0x40241d[_0x5aa4('0x31')]);_0x1615bd[_0x5aa4('0x35')]=_['intersection'](_0x40241d[_0x5aa4('0x30')],qs[_0x5aa4('0x36')](_0x2198ed[_0x5aa4('0x31')][_0x5aa4('0x36')]));_0x1615bd['attributes']=_0x1615bd['attributes'][_0x5aa4('0x37')]?_0x1615bd[_0x5aa4('0x35')]:_0x40241d[_0x5aa4('0x30')];if(_0x2198ed[_0x5aa4('0x31')]['includeAll']){_0x1615bd[_0x5aa4('0x45')]=[{'all':!![]}];}_0x1615bd=_[_0x5aa4('0x3d')]({},_0x1615bd,_0x2198ed[_0x5aa4('0x3e')]);return db['Dynamics365Configuration'][_0x5aa4('0x46')](_0x1615bd)['then'](handleEntityNotFound(_0x707d89,null))['then'](respondWithResult(_0x707d89,null))[_0x5aa4('0x42')](handleError(_0x707d89,null));};exports['create']=function(_0x4c2c4d,_0x29ebb6){return db[_0x5aa4('0x2e')][_0x5aa4('0x47')](_0x4c2c4d['body'],{})[_0x5aa4('0x27')](respondWithResult(_0x29ebb6,0xc9))[_0x5aa4('0x42')](handleError(_0x29ebb6,null));};exports[_0x5aa4('0x26')]=function(_0x3d134a,_0x2f9bf5){if(_0x3d134a[_0x5aa4('0x48')]['id']){delete _0x3d134a[_0x5aa4('0x48')]['id'];}return db[_0x5aa4('0x2e')]['find']({'where':{'id':_0x3d134a['params']['id']}})[_0x5aa4('0x27')](handleEntityNotFound(_0x2f9bf5,null))['then'](saveUpdates(_0x3d134a[_0x5aa4('0x48')],null))[_0x5aa4('0x27')](respondWithResult(_0x2f9bf5,null))[_0x5aa4('0x42')](handleError(_0x2f9bf5,null));};exports['destroy']=function(_0x477085,_0x4193f4){return db[_0x5aa4('0x2e')][_0x5aa4('0x46')]({'where':{'id':_0x477085[_0x5aa4('0x44')]['id']}})[_0x5aa4('0x27')](handleEntityNotFound(_0x4193f4,null))['then'](removeEntity(_0x4193f4,null))[_0x5aa4('0x42')](handleError(_0x4193f4,null));};exports[_0x5aa4('0x49')]=function(_0x252ebb,_0x24dae2,_0xa4997c){var _0xb1e0e={};var _0x1a731f={};var _0x13e10e;var _0x5b9eef;return db[_0x5aa4('0x2e')]['findOne']({'where':{'id':_0x252ebb[_0x5aa4('0x44')]['id']}})[_0x5aa4('0x27')](handleEntityNotFound(_0x24dae2,null))[_0x5aa4('0x27')](function(_0x441593){if(_0x441593){_0x13e10e=_0x441593;_0x1a731f[_0x5aa4('0x30')]=_[_0x5aa4('0x32')](db[_0x5aa4('0x4a')][_0x5aa4('0x2f')]);_0x1a731f[_0x5aa4('0x31')]=_[_0x5aa4('0x32')](_0x252ebb[_0x5aa4('0x31')]);_0x1a731f[_0x5aa4('0x33')]=_[_0x5aa4('0x34')](_0x1a731f[_0x5aa4('0x30')],_0x1a731f[_0x5aa4('0x31')]);_0xb1e0e[_0x5aa4('0x35')]=_[_0x5aa4('0x34')](_0x1a731f[_0x5aa4('0x30')],qs[_0x5aa4('0x36')](_0x252ebb[_0x5aa4('0x31')][_0x5aa4('0x36')]));_0xb1e0e[_0x5aa4('0x35')]=_0xb1e0e[_0x5aa4('0x35')][_0x5aa4('0x37')]?_0xb1e0e['attributes']:_0x1a731f[_0x5aa4('0x30')];_0xb1e0e['order']=qs[_0x5aa4('0x39')](_0x252ebb[_0x5aa4('0x31')][_0x5aa4('0x39')]);_0xb1e0e[_0x5aa4('0x3a')]=qs[_0x5aa4('0x33')](_[_0x5aa4('0x3b')](_0x252ebb[_0x5aa4('0x31')],_0x1a731f[_0x5aa4('0x33')]));if(_0x252ebb[_0x5aa4('0x31')][_0x5aa4('0x3c')]){_0xb1e0e['where']=_[_0x5aa4('0x3d')](_0xb1e0e[_0x5aa4('0x3a')],{'$or':_['map'](_0xb1e0e[_0x5aa4('0x35')],function(_0x4cff87){var _0x499fdd={};_0x499fdd[_0x4cff87]={'$like':'%'+_0x252ebb['query']['filter']+'%'};return _0x499fdd;})});}_0xb1e0e=_[_0x5aa4('0x3d')]({},_0xb1e0e,_0x252ebb[_0x5aa4('0x3e')]);return _0x13e10e[_0x5aa4('0x49')](_0xb1e0e);}})[_0x5aa4('0x27')](function(_0x4efad8){if(_0x4efad8){_0x5b9eef=_0x4efad8[_0x5aa4('0x37')];if(!_0x252ebb[_0x5aa4('0x31')][_0x5aa4('0x38')]('nolimit')){_0xb1e0e[_0x5aa4('0x1f')]=qs['limit'](_0x252ebb[_0x5aa4('0x31')][_0x5aa4('0x1f')]);_0xb1e0e[_0x5aa4('0x20')]=qs[_0x5aa4('0x20')](_0x252ebb[_0x5aa4('0x31')][_0x5aa4('0x20')]);}return _0x13e10e[_0x5aa4('0x49')](_0xb1e0e);}})[_0x5aa4('0x27')](function(_0x26d703){if(_0x26d703){return _0x26d703?{'count':_0x5b9eef,'rows':_0x26d703}:null;}})[_0x5aa4('0x27')](respondWithResult(_0x24dae2,null))[_0x5aa4('0x42')](handleError(_0x24dae2,null));};exports[_0x5aa4('0x4b')]=function(_0x34fc41,_0x420b0d,_0x57db42){var _0x5527f5={};var _0x23e9d4={};var _0x3b3890;var _0xf3378c;return db[_0x5aa4('0x2e')][_0x5aa4('0x4c')]({'where':{'id':_0x34fc41[_0x5aa4('0x44')]['id']}})[_0x5aa4('0x27')](handleEntityNotFound(_0x420b0d,null))[_0x5aa4('0x27')](function(_0x5ce63f){if(_0x5ce63f){_0x3b3890=_0x5ce63f;_0x23e9d4[_0x5aa4('0x30')]=_[_0x5aa4('0x32')](db[_0x5aa4('0x4a')][_0x5aa4('0x2f')]);_0x23e9d4['query']=_[_0x5aa4('0x32')](_0x34fc41[_0x5aa4('0x31')]);_0x23e9d4[_0x5aa4('0x33')]=_[_0x5aa4('0x34')](_0x23e9d4[_0x5aa4('0x30')],_0x23e9d4['query']);_0x5527f5[_0x5aa4('0x35')]=_[_0x5aa4('0x34')](_0x23e9d4[_0x5aa4('0x30')],qs['fields'](_0x34fc41[_0x5aa4('0x31')][_0x5aa4('0x36')]));_0x5527f5[_0x5aa4('0x35')]=_0x5527f5[_0x5aa4('0x35')][_0x5aa4('0x37')]?_0x5527f5[_0x5aa4('0x35')]:_0x23e9d4[_0x5aa4('0x30')];_0x5527f5[_0x5aa4('0x4d')]=qs[_0x5aa4('0x39')](_0x34fc41['query'][_0x5aa4('0x39')]);_0x5527f5[_0x5aa4('0x3a')]=qs[_0x5aa4('0x33')](_[_0x5aa4('0x3b')](_0x34fc41[_0x5aa4('0x31')],_0x23e9d4[_0x5aa4('0x33')]));if(_0x34fc41[_0x5aa4('0x31')][_0x5aa4('0x3c')]){_0x5527f5['where']=_['merge'](_0x5527f5[_0x5aa4('0x3a')],{'$or':_[_0x5aa4('0x2d')](_0x5527f5[_0x5aa4('0x35')],function(_0x1ccd12){var _0x454b64={};_0x454b64[_0x1ccd12]={'$like':'%'+_0x34fc41[_0x5aa4('0x31')]['filter']+'%'};return _0x454b64;})});}_0x5527f5=_['merge']({},_0x5527f5,_0x34fc41[_0x5aa4('0x3e')]);return _0x3b3890['getSubjects'](_0x5527f5);}})['then'](function(_0x1cc17d){if(_0x1cc17d){_0xf3378c=_0x1cc17d['length'];if(!_0x34fc41['query']['hasOwnProperty'](_0x5aa4('0x4e'))){_0x5527f5['limit']=qs[_0x5aa4('0x1f')](_0x34fc41[_0x5aa4('0x31')][_0x5aa4('0x1f')]);_0x5527f5[_0x5aa4('0x20')]=qs[_0x5aa4('0x20')](_0x34fc41[_0x5aa4('0x31')]['offset']);}return _0x3b3890[_0x5aa4('0x4b')](_0x5527f5);}})[_0x5aa4('0x27')](function(_0x275592){if(_0x275592){return _0x275592?{'count':_0xf3378c,'rows':_0x275592}:null;}})['then'](respondWithResult(_0x420b0d,null))['catch'](handleError(_0x420b0d,null));};exports[_0x5aa4('0x4f')]=function(_0x10ba7c,_0x3c87df,_0x39f020){var _0x4a2788={};var _0x2144df={};var _0x5e562b;var _0xcd2b35;return db[_0x5aa4('0x2e')][_0x5aa4('0x4c')]({'where':{'id':_0x10ba7c[_0x5aa4('0x44')]['id']}})[_0x5aa4('0x27')](handleEntityNotFound(_0x3c87df,null))[_0x5aa4('0x27')](function(_0x376f5e){if(_0x376f5e){_0x5e562b=_0x376f5e;_0x2144df[_0x5aa4('0x30')]=_[_0x5aa4('0x32')](db[_0x5aa4('0x4a')][_0x5aa4('0x2f')]);_0x2144df[_0x5aa4('0x31')]=_[_0x5aa4('0x32')](_0x10ba7c[_0x5aa4('0x31')]);_0x2144df[_0x5aa4('0x33')]=_[_0x5aa4('0x34')](_0x2144df[_0x5aa4('0x30')],_0x2144df['query']);_0x4a2788[_0x5aa4('0x35')]=_['intersection'](_0x2144df[_0x5aa4('0x30')],qs[_0x5aa4('0x36')](_0x10ba7c[_0x5aa4('0x31')][_0x5aa4('0x36')]));_0x4a2788[_0x5aa4('0x35')]=_0x4a2788[_0x5aa4('0x35')][_0x5aa4('0x37')]?_0x4a2788[_0x5aa4('0x35')]:_0x2144df[_0x5aa4('0x30')];_0x4a2788[_0x5aa4('0x4d')]=qs['sort'](_0x10ba7c[_0x5aa4('0x31')][_0x5aa4('0x39')]);_0x4a2788[_0x5aa4('0x3a')]=qs[_0x5aa4('0x33')](_[_0x5aa4('0x3b')](_0x10ba7c['query'],_0x2144df['filters']));if(_0x10ba7c[_0x5aa4('0x31')][_0x5aa4('0x3c')]){_0x4a2788['where']=_[_0x5aa4('0x3d')](_0x4a2788[_0x5aa4('0x3a')],{'$or':_[_0x5aa4('0x2d')](_0x4a2788[_0x5aa4('0x35')],function(_0x3fbee9){var _0x2812be={};_0x2812be[_0x3fbee9]={'$like':'%'+_0x10ba7c['query']['filter']+'%'};return _0x2812be;})});}_0x4a2788=_[_0x5aa4('0x3d')]({},_0x4a2788,_0x10ba7c['options']);return _0x5e562b['getDescriptions'](_0x4a2788);}})[_0x5aa4('0x27')](function(_0x51aa4b){if(_0x51aa4b){_0xcd2b35=_0x51aa4b[_0x5aa4('0x37')];if(!_0x10ba7c[_0x5aa4('0x31')]['hasOwnProperty'](_0x5aa4('0x4e'))){_0x4a2788[_0x5aa4('0x1f')]=qs[_0x5aa4('0x1f')](_0x10ba7c['query'][_0x5aa4('0x1f')]);_0x4a2788[_0x5aa4('0x20')]=qs[_0x5aa4('0x20')](_0x10ba7c['query'][_0x5aa4('0x20')]);}return _0x5e562b[_0x5aa4('0x4f')](_0x4a2788);}})[_0x5aa4('0x27')](function(_0x12f83e){if(_0x12f83e){return _0x12f83e?{'count':_0xcd2b35,'rows':_0x12f83e}:null;}})[_0x5aa4('0x27')](respondWithResult(_0x3c87df,null))['catch'](handleError(_0x3c87df,null));}; \ No newline at end of file +var _0xe9da=['hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','then','rows','catch','show','params','rawAttributes','fields','find','create','body','getFields','findOne','keys','pick','getSubjects','Dynamics365Field','getDescriptions','eml-format','rimraf','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/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','destroy','error','name','send','index','map','Dynamics365Configuration','fieldName','type','key','query','filters','model','attributes','intersection','length'];(function(_0x11c69b,_0x31fd8b){var _0x385605=function(_0x2a556d){while(--_0x2a556d){_0x11c69b['push'](_0x11c69b['shift']());}};_0x385605(++_0x31fd8b);}(_0xe9da,0x6e));var _0xae9d=function(_0x3cb8fc,_0x3481db){_0x3cb8fc=_0x3cb8fc-0x0;var _0x4abb24=_0xe9da[_0x3cb8fc];return _0x4abb24;};'use strict';var emlformat=require(_0xae9d('0x0'));var rimraf=require(_0xae9d('0x1'));var zipdir=require(_0xae9d('0x2'));var jsonpatch=require(_0xae9d('0x3'));var rp=require(_0xae9d('0x4'));var moment=require(_0xae9d('0x5'));var BPromise=require(_0xae9d('0x6'));var Mustache=require(_0xae9d('0x7'));var util=require(_0xae9d('0x8'));var path=require('path');var sox=require(_0xae9d('0x9'));var csv=require(_0xae9d('0xa'));var ejs=require(_0xae9d('0xb'));var fs=require('fs');var fs_extra=require(_0xae9d('0xc'));var _=require('lodash');var squel=require(_0xae9d('0xd'));var crypto=require(_0xae9d('0xe'));var jsforce=require(_0xae9d('0xf'));var deskjs=require(_0xae9d('0x10'));var toCsv=require(_0xae9d('0xa'));var querystring=require(_0xae9d('0x11'));var Papa=require(_0xae9d('0x12'));var Redis=require(_0xae9d('0x13'));var authService=require(_0xae9d('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xae9d('0x15'));var hardwareService=require(_0xae9d('0x16'));var logger=require(_0xae9d('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xae9d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xae9d('0x19'))['db'];function respondWithStatusCode(_0x1f8958,_0xeb00e4){_0xeb00e4=_0xeb00e4||0xcc;return function(_0x2c94c5){if(_0x2c94c5){return _0x1f8958[_0xae9d('0x1a')](_0xeb00e4);}return _0x1f8958[_0xae9d('0x1b')](_0xeb00e4)[_0xae9d('0x1c')]();};}function respondWithResult(_0x55ff83,_0x251fd7){_0x251fd7=_0x251fd7||0xc8;return function(_0x50dbcd){if(_0x50dbcd){return _0x55ff83[_0xae9d('0x1b')](_0x251fd7)[_0xae9d('0x1d')](_0x50dbcd);}};}function respondWithFilteredResult(_0x5504cb,_0x90ee8e){return function(_0x2f326d){if(_0x2f326d){var _0x142e82=typeof _0x90ee8e[_0xae9d('0x1e')]==='undefined'&&typeof _0x90ee8e[_0xae9d('0x1f')]===_0xae9d('0x20');var _0x17fa5d=_0x2f326d['count'];var _0x567f1a=_0x142e82?0x0:_0x90ee8e[_0xae9d('0x1e')];var _0x1568ed=_0x142e82?_0x2f326d[_0xae9d('0x21')]:_0x90ee8e[_0xae9d('0x1e')]+_0x90ee8e['limit'];var _0x3a5657;if(_0x1568ed>=_0x17fa5d){_0x1568ed=_0x17fa5d;_0x3a5657=0xc8;}else{_0x3a5657=0xce;}_0x5504cb[_0xae9d('0x1b')](_0x3a5657);return _0x5504cb['set'](_0xae9d('0x22'),_0x567f1a+'-'+_0x1568ed+'/'+_0x17fa5d)[_0xae9d('0x1d')](_0x2f326d);}return null;};}function patchUpdates(_0x3d31cf){return function(_0x2b7d0d){try{jsonpatch[_0xae9d('0x23')](_0x2b7d0d,_0x3d31cf,!![]);}catch(_0x3e3e61){return BPromise[_0xae9d('0x24')](_0x3e3e61);}return _0x2b7d0d['save']();};}function saveUpdates(_0x416ef2,_0x3f1082){return function(_0x2931ad){if(_0x2931ad){return _0x2931ad[_0xae9d('0x25')](_0x416ef2)['then'](function(_0x2b40e4){return _0x2b40e4;});}return null;};}function removeEntity(_0xa06ecc,_0x51ba70){return function(_0x3bf551){if(_0x3bf551){return _0x3bf551[_0xae9d('0x26')]()['then'](function(){_0xa06ecc[_0xae9d('0x1b')](0xcc)[_0xae9d('0x1c')]();});}};}function handleEntityNotFound(_0x2ee5ed,_0x12edfd){return function(_0xcdc6a0){if(!_0xcdc6a0){_0x2ee5ed[_0xae9d('0x1a')](0x194);}return _0xcdc6a0;};}function handleError(_0x264b1b,_0x34fa47){_0x34fa47=_0x34fa47||0x1f4;return function(_0x39304f){logger[_0xae9d('0x27')](_0x39304f['stack']);if(_0x39304f[_0xae9d('0x28')]){delete _0x39304f[_0xae9d('0x28')];}_0x264b1b[_0xae9d('0x1b')](_0x34fa47)[_0xae9d('0x29')](_0x39304f);};}exports[_0xae9d('0x2a')]=function(_0x363495,_0x40c307){var _0x3e036e={},_0x2179c1={},_0x50a48e={'count':0x0,'rows':[]};var _0x5a2330=_[_0xae9d('0x2b')](db[_0xae9d('0x2c')]['rawAttributes'],function(_0x131402){return{'name':_0x131402[_0xae9d('0x2d')],'type':_0x131402[_0xae9d('0x2e')][_0xae9d('0x2f')]};});_0x2179c1['model']=_[_0xae9d('0x2b')](_0x5a2330,_0xae9d('0x28'));_0x2179c1[_0xae9d('0x30')]=_['keys'](_0x363495[_0xae9d('0x30')]);_0x2179c1[_0xae9d('0x31')]=_['intersection'](_0x2179c1[_0xae9d('0x32')],_0x2179c1['query']);_0x3e036e[_0xae9d('0x33')]=_[_0xae9d('0x34')](_0x2179c1[_0xae9d('0x32')],qs['fields'](_0x363495[_0xae9d('0x30')]['fields']));_0x3e036e[_0xae9d('0x33')]=_0x3e036e[_0xae9d('0x33')][_0xae9d('0x35')]?_0x3e036e[_0xae9d('0x33')]:_0x2179c1[_0xae9d('0x32')];if(!_0x363495[_0xae9d('0x30')][_0xae9d('0x36')](_0xae9d('0x37'))){_0x3e036e[_0xae9d('0x1f')]=qs['limit'](_0x363495['query'][_0xae9d('0x1f')]);_0x3e036e['offset']=qs['offset'](_0x363495[_0xae9d('0x30')][_0xae9d('0x1e')]);}_0x3e036e[_0xae9d('0x38')]=qs[_0xae9d('0x39')](_0x363495[_0xae9d('0x30')]['sort']);_0x3e036e['where']=qs[_0xae9d('0x31')](_['pick'](_0x363495[_0xae9d('0x30')],_0x2179c1[_0xae9d('0x31')]),_0x5a2330);if(_0x363495[_0xae9d('0x30')]['filter']){_0x3e036e[_0xae9d('0x3a')]=_['merge'](_0x3e036e['where'],{'$or':_[_0xae9d('0x2b')](_0x5a2330,function(_0x6f6935){if(_0x6f6935[_0xae9d('0x2e')]!=='VIRTUAL'){var _0x30f8b5={};_0x30f8b5[_0x6f6935['name']]={'$like':'%'+_0x363495[_0xae9d('0x30')][_0xae9d('0x3b')]+'%'};return _0x30f8b5;}})});}_0x3e036e=_[_0xae9d('0x3c')]({},_0x3e036e,_0x363495[_0xae9d('0x3d')]);var _0x442b13={'where':_0x3e036e[_0xae9d('0x3a')]};return db['Dynamics365Configuration'][_0xae9d('0x21')](_0x442b13)['then'](function(_0x5775dd){_0x50a48e['count']=_0x5775dd;if(_0x363495[_0xae9d('0x30')][_0xae9d('0x3e')]){_0x3e036e[_0xae9d('0x3f')]=[{'all':!![]}];}return db[_0xae9d('0x2c')][_0xae9d('0x40')](_0x3e036e);})[_0xae9d('0x41')](function(_0x4ad7b5){_0x50a48e[_0xae9d('0x42')]=_0x4ad7b5;return _0x50a48e;})[_0xae9d('0x41')](respondWithFilteredResult(_0x40c307,_0x3e036e))[_0xae9d('0x43')](handleError(_0x40c307,null));};exports[_0xae9d('0x44')]=function(_0x2f9ecf,_0x18043e){var _0x2d7b96={'raw':![],'where':{'id':_0x2f9ecf[_0xae9d('0x45')]['id']}},_0x511359={};_0x511359[_0xae9d('0x32')]=_['keys'](db['Dynamics365Configuration'][_0xae9d('0x46')]);_0x511359[_0xae9d('0x30')]=_['keys'](_0x2f9ecf[_0xae9d('0x30')]);_0x511359[_0xae9d('0x31')]=_[_0xae9d('0x34')](_0x511359[_0xae9d('0x32')],_0x511359[_0xae9d('0x30')]);_0x2d7b96[_0xae9d('0x33')]=_['intersection'](_0x511359['model'],qs[_0xae9d('0x47')](_0x2f9ecf['query']['fields']));_0x2d7b96[_0xae9d('0x33')]=_0x2d7b96[_0xae9d('0x33')][_0xae9d('0x35')]?_0x2d7b96[_0xae9d('0x33')]:_0x511359[_0xae9d('0x32')];if(_0x2f9ecf[_0xae9d('0x30')][_0xae9d('0x3e')]){_0x2d7b96['include']=[{'all':!![]}];}_0x2d7b96=_[_0xae9d('0x3c')]({},_0x2d7b96,_0x2f9ecf[_0xae9d('0x3d')]);return db['Dynamics365Configuration'][_0xae9d('0x48')](_0x2d7b96)['then'](handleEntityNotFound(_0x18043e,null))[_0xae9d('0x41')](respondWithResult(_0x18043e,null))[_0xae9d('0x43')](handleError(_0x18043e,null));};exports[_0xae9d('0x49')]=function(_0x3fa4e2,_0x2f8842){return db['Dynamics365Configuration'][_0xae9d('0x49')](_0x3fa4e2[_0xae9d('0x4a')],{})['then'](respondWithResult(_0x2f8842,0xc9))['catch'](handleError(_0x2f8842,null));};exports[_0xae9d('0x25')]=function(_0x42a04a,_0x52e043){if(_0x42a04a['body']['id']){delete _0x42a04a[_0xae9d('0x4a')]['id'];}return db[_0xae9d('0x2c')]['find']({'where':{'id':_0x42a04a[_0xae9d('0x45')]['id']}})[_0xae9d('0x41')](handleEntityNotFound(_0x52e043,null))[_0xae9d('0x41')](saveUpdates(_0x42a04a[_0xae9d('0x4a')],null))['then'](respondWithResult(_0x52e043,null))[_0xae9d('0x43')](handleError(_0x52e043,null));};exports[_0xae9d('0x26')]=function(_0x118b4e,_0x49f3a4){return db[_0xae9d('0x2c')][_0xae9d('0x48')]({'where':{'id':_0x118b4e[_0xae9d('0x45')]['id']}})[_0xae9d('0x41')](handleEntityNotFound(_0x49f3a4,null))[_0xae9d('0x41')](removeEntity(_0x49f3a4,null))['catch'](handleError(_0x49f3a4,null));};exports[_0xae9d('0x4b')]=function(_0x5d026b,_0x5f2a59,_0x49a89f){var _0x41548f={};var _0x55f463={};var _0x1ad2da;var _0x148f06;return db[_0xae9d('0x2c')][_0xae9d('0x4c')]({'where':{'id':_0x5d026b[_0xae9d('0x45')]['id']}})['then'](handleEntityNotFound(_0x5f2a59,null))['then'](function(_0x380a9d){if(_0x380a9d){_0x1ad2da=_0x380a9d;_0x55f463[_0xae9d('0x32')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x55f463[_0xae9d('0x30')]=_['keys'](_0x5d026b[_0xae9d('0x30')]);_0x55f463['filters']=_[_0xae9d('0x34')](_0x55f463[_0xae9d('0x32')],_0x55f463[_0xae9d('0x30')]);_0x41548f[_0xae9d('0x33')]=_[_0xae9d('0x34')](_0x55f463['model'],qs[_0xae9d('0x47')](_0x5d026b['query']['fields']));_0x41548f[_0xae9d('0x33')]=_0x41548f[_0xae9d('0x33')][_0xae9d('0x35')]?_0x41548f[_0xae9d('0x33')]:_0x55f463['model'];_0x41548f[_0xae9d('0x38')]=qs['sort'](_0x5d026b[_0xae9d('0x30')]['sort']);_0x41548f[_0xae9d('0x3a')]=qs[_0xae9d('0x31')](_['pick'](_0x5d026b['query'],_0x55f463[_0xae9d('0x31')]));if(_0x5d026b['query'][_0xae9d('0x3b')]){_0x41548f[_0xae9d('0x3a')]=_[_0xae9d('0x3c')](_0x41548f[_0xae9d('0x3a')],{'$or':_[_0xae9d('0x2b')](_0x41548f[_0xae9d('0x33')],function(_0x1f9a09){var _0x5be84b={};_0x5be84b[_0x1f9a09]={'$like':'%'+_0x5d026b[_0xae9d('0x30')]['filter']+'%'};return _0x5be84b;})});}_0x41548f=_['merge']({},_0x41548f,_0x5d026b[_0xae9d('0x3d')]);return _0x1ad2da[_0xae9d('0x4b')](_0x41548f);}})['then'](function(_0x1eacba){if(_0x1eacba){_0x148f06=_0x1eacba[_0xae9d('0x35')];if(!_0x5d026b[_0xae9d('0x30')][_0xae9d('0x36')](_0xae9d('0x37'))){_0x41548f['limit']=qs[_0xae9d('0x1f')](_0x5d026b[_0xae9d('0x30')][_0xae9d('0x1f')]);_0x41548f[_0xae9d('0x1e')]=qs[_0xae9d('0x1e')](_0x5d026b[_0xae9d('0x30')]['offset']);}return _0x1ad2da[_0xae9d('0x4b')](_0x41548f);}})['then'](function(_0x4c1c7f){if(_0x4c1c7f){return _0x4c1c7f?{'count':_0x148f06,'rows':_0x4c1c7f}:null;}})[_0xae9d('0x41')](respondWithResult(_0x5f2a59,null))[_0xae9d('0x43')](handleError(_0x5f2a59,null));};exports['getSubjects']=function(_0x47416a,_0x50a9b9,_0x272a6d){var _0x2939d4={};var _0x54c169={};var _0x359bc3;var _0x42895f;return db[_0xae9d('0x2c')]['findOne']({'where':{'id':_0x47416a[_0xae9d('0x45')]['id']}})[_0xae9d('0x41')](handleEntityNotFound(_0x50a9b9,null))[_0xae9d('0x41')](function(_0x1c1de1){if(_0x1c1de1){_0x359bc3=_0x1c1de1;_0x54c169[_0xae9d('0x32')]=_[_0xae9d('0x4d')](db['Dynamics365Field'][_0xae9d('0x46')]);_0x54c169[_0xae9d('0x30')]=_[_0xae9d('0x4d')](_0x47416a[_0xae9d('0x30')]);_0x54c169[_0xae9d('0x31')]=_[_0xae9d('0x34')](_0x54c169['model'],_0x54c169[_0xae9d('0x30')]);_0x2939d4[_0xae9d('0x33')]=_[_0xae9d('0x34')](_0x54c169[_0xae9d('0x32')],qs[_0xae9d('0x47')](_0x47416a[_0xae9d('0x30')][_0xae9d('0x47')]));_0x2939d4[_0xae9d('0x33')]=_0x2939d4['attributes'][_0xae9d('0x35')]?_0x2939d4[_0xae9d('0x33')]:_0x54c169[_0xae9d('0x32')];_0x2939d4[_0xae9d('0x38')]=qs['sort'](_0x47416a[_0xae9d('0x30')][_0xae9d('0x39')]);_0x2939d4[_0xae9d('0x3a')]=qs[_0xae9d('0x31')](_[_0xae9d('0x4e')](_0x47416a['query'],_0x54c169[_0xae9d('0x31')]));if(_0x47416a[_0xae9d('0x30')][_0xae9d('0x3b')]){_0x2939d4['where']=_[_0xae9d('0x3c')](_0x2939d4[_0xae9d('0x3a')],{'$or':_[_0xae9d('0x2b')](_0x2939d4['attributes'],function(_0x49b422){var _0x43e1ee={};_0x43e1ee[_0x49b422]={'$like':'%'+_0x47416a['query']['filter']+'%'};return _0x43e1ee;})});}_0x2939d4=_[_0xae9d('0x3c')]({},_0x2939d4,_0x47416a[_0xae9d('0x3d')]);return _0x359bc3['getSubjects'](_0x2939d4);}})[_0xae9d('0x41')](function(_0xe76838){if(_0xe76838){_0x42895f=_0xe76838[_0xae9d('0x35')];if(!_0x47416a[_0xae9d('0x30')]['hasOwnProperty'](_0xae9d('0x37'))){_0x2939d4['limit']=qs[_0xae9d('0x1f')](_0x47416a[_0xae9d('0x30')][_0xae9d('0x1f')]);_0x2939d4[_0xae9d('0x1e')]=qs[_0xae9d('0x1e')](_0x47416a[_0xae9d('0x30')][_0xae9d('0x1e')]);}return _0x359bc3[_0xae9d('0x4f')](_0x2939d4);}})['then'](function(_0x1e6882){if(_0x1e6882){return _0x1e6882?{'count':_0x42895f,'rows':_0x1e6882}:null;}})[_0xae9d('0x41')](respondWithResult(_0x50a9b9,null))[_0xae9d('0x43')](handleError(_0x50a9b9,null));};exports['getDescriptions']=function(_0xeb6398,_0x56c051,_0x5a1c43){var _0x45ceae={};var _0x56a0f6={};var _0x508df0;var _0x8364da;return db[_0xae9d('0x2c')][_0xae9d('0x4c')]({'where':{'id':_0xeb6398[_0xae9d('0x45')]['id']}})[_0xae9d('0x41')](handleEntityNotFound(_0x56c051,null))[_0xae9d('0x41')](function(_0x5b66f6){if(_0x5b66f6){_0x508df0=_0x5b66f6;_0x56a0f6[_0xae9d('0x32')]=_['keys'](db[_0xae9d('0x50')]['rawAttributes']);_0x56a0f6[_0xae9d('0x30')]=_[_0xae9d('0x4d')](_0xeb6398[_0xae9d('0x30')]);_0x56a0f6[_0xae9d('0x31')]=_[_0xae9d('0x34')](_0x56a0f6[_0xae9d('0x32')],_0x56a0f6[_0xae9d('0x30')]);_0x45ceae[_0xae9d('0x33')]=_['intersection'](_0x56a0f6['model'],qs['fields'](_0xeb6398['query'][_0xae9d('0x47')]));_0x45ceae[_0xae9d('0x33')]=_0x45ceae[_0xae9d('0x33')][_0xae9d('0x35')]?_0x45ceae[_0xae9d('0x33')]:_0x56a0f6['model'];_0x45ceae[_0xae9d('0x38')]=qs[_0xae9d('0x39')](_0xeb6398[_0xae9d('0x30')][_0xae9d('0x39')]);_0x45ceae[_0xae9d('0x3a')]=qs[_0xae9d('0x31')](_[_0xae9d('0x4e')](_0xeb6398[_0xae9d('0x30')],_0x56a0f6[_0xae9d('0x31')]));if(_0xeb6398[_0xae9d('0x30')][_0xae9d('0x3b')]){_0x45ceae[_0xae9d('0x3a')]=_['merge'](_0x45ceae[_0xae9d('0x3a')],{'$or':_['map'](_0x45ceae[_0xae9d('0x33')],function(_0x42f9c2){var _0x4620fa={};_0x4620fa[_0x42f9c2]={'$like':'%'+_0xeb6398[_0xae9d('0x30')]['filter']+'%'};return _0x4620fa;})});}_0x45ceae=_['merge']({},_0x45ceae,_0xeb6398[_0xae9d('0x3d')]);return _0x508df0['getDescriptions'](_0x45ceae);}})[_0xae9d('0x41')](function(_0x723274){if(_0x723274){_0x8364da=_0x723274[_0xae9d('0x35')];if(!_0xeb6398[_0xae9d('0x30')]['hasOwnProperty'](_0xae9d('0x37'))){_0x45ceae[_0xae9d('0x1f')]=qs[_0xae9d('0x1f')](_0xeb6398[_0xae9d('0x30')][_0xae9d('0x1f')]);_0x45ceae[_0xae9d('0x1e')]=qs['offset'](_0xeb6398[_0xae9d('0x30')][_0xae9d('0x1e')]);}return _0x508df0[_0xae9d('0x51')](_0x45ceae);}})[_0xae9d('0x41')](function(_0x362e7b){if(_0x362e7b){return _0x362e7b?{'count':_0x8364da,'rows':_0x362e7b}:null;}})[_0xae9d('0x41')](respondWithResult(_0x56c051,null))[_0xae9d('0x43')](handleError(_0x56c051,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index cafaaaf..3390af6 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 _0xf109=['Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x1daa1d,_0x331231){var _0x280124=function(_0x5ed1d3){while(--_0x5ed1d3){_0x1daa1d['push'](_0x1daa1d['shift']());}};_0x280124(++_0x331231);}(_0xf109,0xce));var _0x9f10=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xf109[_0x2aecb2];return _0x3ebb80;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var fs=require('fs');var path=require(_0x9f10('0x4'));var rimraf=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var attributes=require(_0x9f10('0x7'));module[_0x9f10('0x8')]=function(_0x408fe8,_0xd3137b){return _0x408fe8[_0x9f10('0x9')](_0x9f10('0xa'),attributes,{'tableName':_0x9f10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports'];(function(_0xfcdda0,_0x32479b){var _0x17ebe3=function(_0x5bfaa3){while(--_0x5bfaa3){_0xfcdda0['push'](_0xfcdda0['shift']());}};_0x17ebe3(++_0x32479b);}(_0x008c,0x188));var _0xc008=function(_0x77773a,_0x5a7026){_0x77773a=_0x77773a-0x0;var _0x1091a2=_0x008c[_0x77773a];return _0x1091a2;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Dynamics365Configuration',attributes,{'tableName':_0xc008('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 1622d9b..f605b4a 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 _0x2397=['http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x2397,0x119));var _0x7239=function(_0x2bcf94,_0x2a2b7d){_0x2bcf94=_0x2bcf94-0x0;var _0x2fb000=_0x2397[_0x2bcf94];return _0x2fb000;};'use strict';var _=require('lodash');var util=require(_0x7239('0x0'));var moment=require('moment');var BPromise=require(_0x7239('0x1'));var rs=require(_0x7239('0x2'));var fs=require('fs');var Redis=require(_0x7239('0x3'));var db=require(_0x7239('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7239('0x5'))(_0x7239('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7239('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5177ea,_0x37d6e9,_0x26c5b5){return new BPromise(function(_0x26232d,_0x186811){return client[_0x7239('0x8')](_0x5177ea,_0x26c5b5)['then'](function(_0x46d87a){logger[_0x7239('0x9')](_0x7239('0xa'),_0x37d6e9,_0x7239('0xb'));logger[_0x7239('0xc')](_0x7239('0xd'),_0x37d6e9,_0x7239('0xb'),JSON['stringify'](_0x46d87a));if(_0x46d87a[_0x7239('0xe')]){if(_0x46d87a[_0x7239('0xe')]['code']===0x1f4){logger[_0x7239('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x37d6e9,_0x46d87a['error'][_0x7239('0xf')]);return _0x186811(_0x46d87a[_0x7239('0xe')][_0x7239('0xf')]);}logger['error'](_0x7239('0xa'),_0x37d6e9,_0x46d87a[_0x7239('0xe')][_0x7239('0xf')]);return _0x26232d(_0x46d87a[_0x7239('0xe')]['message']);}else{logger[_0x7239('0x9')](_0x7239('0xa'),_0x37d6e9,'request\x20sent');_0x26232d(_0x46d87a[_0x7239('0x10')][_0x7239('0xf')]);}})[_0x7239('0x11')](function(_0x4aaeb6){logger[_0x7239('0xe')](_0x7239('0xa'),_0x37d6e9,_0x4aaeb6);_0x186811(_0x4aaeb6);});});} \ No newline at end of file +var _0xd2cd=['info','request\x20sent','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then'];(function(_0x5cc30e,_0x2646b6){var _0x208c6d=function(_0x1abc53){while(--_0x1abc53){_0x5cc30e['push'](_0x5cc30e['shift']());}};_0x208c6d(++_0x2646b6);}(_0xd2cd,0x7f));var _0xdd2c=function(_0x388899,_0x17f370){_0x388899=_0x388899-0x0;var _0x3be17d=_0xd2cd[_0x388899];return _0x3be17d;};'use strict';var _=require(_0xdd2c('0x0'));var util=require(_0xdd2c('0x1'));var moment=require(_0xdd2c('0x2'));var BPromise=require(_0xdd2c('0x3'));var rs=require(_0xdd2c('0x4'));var fs=require('fs');var Redis=require(_0xdd2c('0x5'));var db=require(_0xdd2c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd2c('0x7'))('rpc');var config=require(_0xdd2c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdd2c('0x9')][_0xdd2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36ccd7,_0x3c348b,_0x445f30){return new BPromise(function(_0x474012,_0x1042d3){return client[_0xdd2c('0xb')](_0x36ccd7,_0x445f30)[_0xdd2c('0xc')](function(_0x89c24d){logger[_0xdd2c('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3c348b,'request\x20sent');logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x3c348b,_0xdd2c('0xe'),JSON[_0xdd2c('0xf')](_0x89c24d));if(_0x89c24d[_0xdd2c('0x10')]){if(_0x89c24d['error'][_0xdd2c('0x11')]===0x1f4){logger[_0xdd2c('0x10')](_0xdd2c('0x12'),_0x3c348b,_0x89c24d[_0xdd2c('0x10')][_0xdd2c('0x13')]);return _0x1042d3(_0x89c24d['error'][_0xdd2c('0x13')]);}logger[_0xdd2c('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3c348b,_0x89c24d['error']['message']);return _0x474012(_0x89c24d[_0xdd2c('0x10')][_0xdd2c('0x13')]);}else{logger['info'](_0xdd2c('0x12'),_0x3c348b,_0xdd2c('0xe'));_0x474012(_0x89c24d['result'][_0xdd2c('0x13')]);}})['catch'](function(_0x55515c){logger[_0xdd2c('0x10')](_0xdd2c('0x12'),_0x3c348b,_0x55515c);_0x1042d3(_0x55515c);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index ba557cf..1bdf8b9 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 _0xf3f1=['../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','post','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x3d8c0c,_0x465b46){var _0x4f2e6e=function(_0x17512e){while(--_0x17512e){_0x3d8c0c['push'](_0x3d8c0c['shift']());}};_0x4f2e6e(++_0x465b46);}(_0xf3f1,0x13d));var _0x1f3f=function(_0x413727,_0x17adb1){_0x413727=_0x413727-0x0;var _0x5f46d7=_0xf3f1[_0x413727];return _0x5f46d7;};'use strict';var multer=require(_0x1f3f('0x0'));var util=require('util');var path=require(_0x1f3f('0x1'));var timeout=require(_0x1f3f('0x2'));var express=require(_0x1f3f('0x3'));var router=express[_0x1f3f('0x4')]();var fs_extra=require(_0x1f3f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1f3f('0x6'));var config=require(_0x1f3f('0x7'));var controller=require(_0x1f3f('0x8'));router[_0x1f3f('0x9')]('/',auth[_0x1f3f('0xa')](),controller['index']);router['get'](_0x1f3f('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1f3f('0xc')]('/',auth[_0x1f3f('0xa')](),controller['create']);router[_0x1f3f('0xd')](_0x1f3f('0xb'),auth[_0x1f3f('0xa')](),controller[_0x1f3f('0xe')]);router[_0x1f3f('0xf')]('/:id',auth[_0x1f3f('0xa')](),controller[_0x1f3f('0x10')]);module['exports']=router; \ No newline at end of file +var _0x7b05=['show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id'];(function(_0x2746fb,_0x2b7245){var _0x1e0640=function(_0xe8b05d){while(--_0xe8b05d){_0x2746fb['push'](_0x2746fb['shift']());}};_0x1e0640(++_0x2b7245);}(_0x7b05,0x85));var _0x57b0=function(_0x130d82,_0x25f49b){_0x130d82=_0x130d82-0x0;var _0x112070=_0x7b05[_0x130d82];return _0x112070;};'use strict';var multer=require(_0x57b0('0x0'));var util=require(_0x57b0('0x1'));var path=require(_0x57b0('0x2'));var timeout=require(_0x57b0('0x3'));var express=require('express');var router=express[_0x57b0('0x4')]();var fs_extra=require(_0x57b0('0x5'));var auth=require(_0x57b0('0x6'));var interaction=require(_0x57b0('0x7'));var config=require(_0x57b0('0x8'));var controller=require(_0x57b0('0x9'));router[_0x57b0('0xa')]('/',auth[_0x57b0('0xb')](),controller[_0x57b0('0xc')]);router[_0x57b0('0xa')](_0x57b0('0xd'),auth[_0x57b0('0xb')](),controller[_0x57b0('0xe')]);router[_0x57b0('0xf')]('/',auth[_0x57b0('0xb')](),controller[_0x57b0('0x10')]);router[_0x57b0('0x11')](_0x57b0('0xd'),auth[_0x57b0('0xb')](),controller[_0x57b0('0x12')]);router[_0x57b0('0x13')](_0x57b0('0xd'),auth[_0x57b0('0xb')](),controller[_0x57b0('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index c4e2c22..7ac19a9 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 _0x97bd=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x5aaf54,_0x116458){var _0xfad324=function(_0x4392e0){while(--_0x4392e0){_0x5aaf54['push'](_0x5aaf54['shift']());}};_0xfad324(++_0x116458);}(_0x97bd,0x93));var _0xd97b=function(_0x58cb21,_0x4737cc){_0x58cb21=_0x58cb21-0x0;var _0x37e679=_0x97bd[_0x58cb21];return _0x37e679;};'use strict';var Sequelize=require(_0xd97b('0x0'));module[_0xd97b('0x1')]={'type':{'type':Sequelize[_0xd97b('0x2')](_0xd97b('0x3'),_0xd97b('0x4'),_0xd97b('0x5'),_0xd97b('0x6'),'picklist'),'defaultValue':_0xd97b('0x3')},'content':{'type':Sequelize[_0xd97b('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd97b('0x2')](_0xd97b('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd97b('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd97b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2e50=['keyValue','STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2e50,0x187));var _0x02e5=function(_0x136a01,_0x3e0f10){_0x136a01=_0x136a01-0x0;var _0x39ccee=_0x2e50[_0x136a01];return _0x39ccee;};'use strict';var Sequelize=require(_0x02e5('0x0'));module[_0x02e5('0x1')]={'type':{'type':Sequelize['ENUM'](_0x02e5('0x2'),_0x02e5('0x3'),_0x02e5('0x4'),_0x02e5('0x5'),'picklist'),'defaultValue':_0x02e5('0x2')},'content':{'type':Sequelize[_0x02e5('0x6')]},'key':{'type':Sequelize[_0x02e5('0x6')]},'keyType':{'type':Sequelize[_0x02e5('0x7')]('string',_0x02e5('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x02e5('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x02e5('0x6')]},'customField':{'type':Sequelize[_0x02e5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x02e5('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 529a9eb..a0895d1 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 _0x491c=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','Dynamics365Field','key'];(function(_0x52e15b,_0xe484e5){var _0x524471=function(_0x34ea2b){while(--_0x34ea2b){_0x52e15b['push'](_0x52e15b['shift']());}};_0x524471(++_0xe484e5);}(_0x491c,0xee));var _0xc491=function(_0x5f5471,_0x2a3f5b){_0x5f5471=_0x5f5471-0x0;var _0x22c248=_0x491c[_0x5f5471];return _0x22c248;};'use strict';var emlformat=require(_0xc491('0x0'));var rimraf=require(_0xc491('0x1'));var zipdir=require(_0xc491('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc491('0x3'));var moment=require(_0xc491('0x4'));var BPromise=require(_0xc491('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc491('0x6'));var csv=require('to-csv');var ejs=require(_0xc491('0x7'));var fs=require('fs');var fs_extra=require(_0xc491('0x8'));var _=require('lodash');var squel=require(_0xc491('0x9'));var crypto=require('crypto');var jsforce=require(_0xc491('0xa'));var deskjs=require(_0xc491('0xb'));var toCsv=require(_0xc491('0xc'));var querystring=require(_0xc491('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc491('0xe'));var qs=require(_0xc491('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc491('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc491('0x11'));var licenseUtil=require(_0xc491('0x12'));var db=require(_0xc491('0x13'))['db'];function respondWithStatusCode(_0x4b45dc,_0x25ecab){_0x25ecab=_0x25ecab||0xcc;return function(_0xf7138e){if(_0xf7138e){return _0x4b45dc[_0xc491('0x14')](_0x25ecab);}return _0x4b45dc['status'](_0x25ecab)[_0xc491('0x15')]();};}function respondWithResult(_0x2148a5,_0x2ccc9e){_0x2ccc9e=_0x2ccc9e||0xc8;return function(_0x1a9689){if(_0x1a9689){return _0x2148a5[_0xc491('0x16')](_0x2ccc9e)['json'](_0x1a9689);}};}function respondWithFilteredResult(_0x583db8,_0x54615a){return function(_0x593d3c){if(_0x593d3c){var _0x55399e=typeof _0x54615a[_0xc491('0x17')]==='undefined'&&typeof _0x54615a['limit']==='undefined';var _0x440df3=_0x593d3c[_0xc491('0x18')];var _0x6e180d=_0x55399e?0x0:_0x54615a[_0xc491('0x17')];var _0x506d9a=_0x55399e?_0x593d3c[_0xc491('0x18')]:_0x54615a['offset']+_0x54615a[_0xc491('0x19')];var _0x41f5fd;if(_0x506d9a>=_0x440df3){_0x506d9a=_0x440df3;_0x41f5fd=0xc8;}else{_0x41f5fd=0xce;}_0x583db8[_0xc491('0x16')](_0x41f5fd);return _0x583db8[_0xc491('0x1a')](_0xc491('0x1b'),_0x6e180d+'-'+_0x506d9a+'/'+_0x440df3)[_0xc491('0x1c')](_0x593d3c);}return null;};}function patchUpdates(_0x3d77be){return function(_0x36de53){try{jsonpatch[_0xc491('0x1d')](_0x36de53,_0x3d77be,!![]);}catch(_0x12dc9c){return BPromise[_0xc491('0x1e')](_0x12dc9c);}return _0x36de53[_0xc491('0x1f')]();};}function saveUpdates(_0x408820,_0x780151){return function(_0x36ed7d){if(_0x36ed7d){return _0x36ed7d['update'](_0x408820)[_0xc491('0x20')](function(_0x435ca6){return _0x435ca6;});}return null;};}function removeEntity(_0x483ca3,_0x2decf5){return function(_0x317d2d){if(_0x317d2d){return _0x317d2d[_0xc491('0x21')]()[_0xc491('0x20')](function(){_0x483ca3[_0xc491('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f1561,_0x1000c7){return function(_0x3d6a95){if(!_0x3d6a95){_0x5f1561[_0xc491('0x14')](0x194);}return _0x3d6a95;};}function handleError(_0x454c4d,_0x29f371){_0x29f371=_0x29f371||0x1f4;return function(_0x25ba39){logger[_0xc491('0x22')](_0x25ba39[_0xc491('0x23')]);if(_0x25ba39[_0xc491('0x24')]){delete _0x25ba39[_0xc491('0x24')];}_0x454c4d['status'](_0x29f371)[_0xc491('0x25')](_0x25ba39);};}exports[_0xc491('0x26')]=function(_0x38fe7f,_0x54ab2){var _0x4579b1={},_0x50d187={},_0x4fe40b={'count':0x0,'rows':[]};var _0x588e56=_[_0xc491('0x27')](db[_0xc491('0x28')]['rawAttributes'],function(_0xf883d5){return{'name':_0xf883d5['fieldName'],'type':_0xf883d5['type'][_0xc491('0x29')]};});_0x50d187[_0xc491('0x2a')]=_['map'](_0x588e56,'name');_0x50d187[_0xc491('0x2b')]=_[_0xc491('0x2c')](_0x38fe7f[_0xc491('0x2b')]);_0x50d187[_0xc491('0x2d')]=_[_0xc491('0x2e')](_0x50d187[_0xc491('0x2a')],_0x50d187[_0xc491('0x2b')]);_0x4579b1[_0xc491('0x2f')]=_['intersection'](_0x50d187[_0xc491('0x2a')],qs[_0xc491('0x30')](_0x38fe7f['query'][_0xc491('0x30')]));_0x4579b1[_0xc491('0x2f')]=_0x4579b1[_0xc491('0x2f')][_0xc491('0x31')]?_0x4579b1[_0xc491('0x2f')]:_0x50d187[_0xc491('0x2a')];if(!_0x38fe7f['query'][_0xc491('0x32')](_0xc491('0x33'))){_0x4579b1['limit']=qs[_0xc491('0x19')](_0x38fe7f[_0xc491('0x2b')][_0xc491('0x19')]);_0x4579b1[_0xc491('0x17')]=qs[_0xc491('0x17')](_0x38fe7f[_0xc491('0x2b')]['offset']);}_0x4579b1[_0xc491('0x34')]=qs[_0xc491('0x35')](_0x38fe7f['query']['sort']);_0x4579b1['where']=qs[_0xc491('0x2d')](_[_0xc491('0x36')](_0x38fe7f['query'],_0x50d187[_0xc491('0x2d')]),_0x588e56);if(_0x38fe7f[_0xc491('0x2b')][_0xc491('0x37')]){_0x4579b1[_0xc491('0x38')]=_[_0xc491('0x39')](_0x4579b1[_0xc491('0x38')],{'$or':_['map'](_0x588e56,function(_0x479fd7){if(_0x479fd7['type']!=='VIRTUAL'){var _0x247d17={};_0x247d17[_0x479fd7[_0xc491('0x24')]]={'$like':'%'+_0x38fe7f[_0xc491('0x2b')][_0xc491('0x37')]+'%'};return _0x247d17;}})});}_0x4579b1=_[_0xc491('0x39')]({},_0x4579b1,_0x38fe7f[_0xc491('0x3a')]);var _0x422b3c={'where':_0x4579b1[_0xc491('0x38')]};return db[_0xc491('0x28')]['count'](_0x422b3c)[_0xc491('0x20')](function(_0x4c73c3){_0x4fe40b[_0xc491('0x18')]=_0x4c73c3;if(_0x38fe7f[_0xc491('0x2b')][_0xc491('0x3b')]){_0x4579b1[_0xc491('0x3c')]=[{'all':!![]}];}return db[_0xc491('0x28')][_0xc491('0x3d')](_0x4579b1);})[_0xc491('0x20')](function(_0x4f8f43){_0x4fe40b['rows']=_0x4f8f43;return _0x4fe40b;})[_0xc491('0x20')](respondWithFilteredResult(_0x54ab2,_0x4579b1))[_0xc491('0x3e')](handleError(_0x54ab2,null));};exports[_0xc491('0x3f')]=function(_0x1d00eb,_0xd9838d){var _0x2440a9={'raw':!![],'where':{'id':_0x1d00eb[_0xc491('0x40')]['id']}},_0x5481a8={};_0x5481a8['model']=_['keys'](db[_0xc491('0x28')][_0xc491('0x41')]);_0x5481a8[_0xc491('0x2b')]=_[_0xc491('0x2c')](_0x1d00eb['query']);_0x5481a8[_0xc491('0x2d')]=_[_0xc491('0x2e')](_0x5481a8[_0xc491('0x2a')],_0x5481a8['query']);_0x2440a9[_0xc491('0x2f')]=_[_0xc491('0x2e')](_0x5481a8[_0xc491('0x2a')],qs['fields'](_0x1d00eb['query'][_0xc491('0x30')]));_0x2440a9[_0xc491('0x2f')]=_0x2440a9[_0xc491('0x2f')]['length']?_0x2440a9[_0xc491('0x2f')]:_0x5481a8[_0xc491('0x2a')];if(_0x1d00eb['query']['includeAll']){_0x2440a9[_0xc491('0x3c')]=[{'all':!![]}];}_0x2440a9=_['merge']({},_0x2440a9,_0x1d00eb[_0xc491('0x3a')]);return db[_0xc491('0x28')][_0xc491('0x42')](_0x2440a9)[_0xc491('0x20')](handleEntityNotFound(_0xd9838d,null))[_0xc491('0x20')](respondWithResult(_0xd9838d,null))[_0xc491('0x3e')](handleError(_0xd9838d,null));};exports[_0xc491('0x43')]=function(_0x251b88,_0x47f927){return db[_0xc491('0x28')][_0xc491('0x43')](_0x251b88[_0xc491('0x44')],{})[_0xc491('0x20')](respondWithResult(_0x47f927,0xc9))[_0xc491('0x3e')](handleError(_0x47f927,null));};exports[_0xc491('0x45')]=function(_0x3569be,_0x599355){if(_0x3569be['body']['id']){delete _0x3569be[_0xc491('0x44')]['id'];}return db[_0xc491('0x28')][_0xc491('0x42')]({'where':{'id':_0x3569be[_0xc491('0x40')]['id']}})[_0xc491('0x20')](handleEntityNotFound(_0x599355,null))[_0xc491('0x20')](saveUpdates(_0x3569be[_0xc491('0x44')],null))[_0xc491('0x20')](respondWithResult(_0x599355,null))['catch'](handleError(_0x599355,null));};exports['destroy']=function(_0x4d135f,_0x260c0c){return db['Dynamics365Field'][_0xc491('0x42')]({'where':{'id':_0x4d135f[_0xc491('0x40')]['id']}})[_0xc491('0x20')](handleEntityNotFound(_0x260c0c,null))[_0xc491('0x20')](removeEntity(_0x260c0c,null))[_0xc491('0x3e')](handleError(_0x260c0c,null));}; \ No newline at end of file +var _0x6360=['end','error','stack','name','status','send','index','map','Dynamics365Field','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','rawAttributes','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x3a22dc,_0x4b65d0){var _0x35afd2=function(_0x423820){while(--_0x423820){_0x3a22dc['push'](_0x3a22dc['shift']());}};_0x35afd2(++_0x4b65d0);}(_0x6360,0x18b));var _0x0636=function(_0x44675b,_0x5b6515){_0x44675b=_0x44675b-0x0;var _0x484571=_0x6360[_0x44675b];return _0x484571;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0636('0x0'));var zipdir=require(_0x0636('0x1'));var jsonpatch=require(_0x0636('0x2'));var rp=require(_0x0636('0x3'));var moment=require(_0x0636('0x4'));var BPromise=require(_0x0636('0x5'));var Mustache=require(_0x0636('0x6'));var util=require(_0x0636('0x7'));var path=require(_0x0636('0x8'));var sox=require(_0x0636('0x9'));var csv=require('to-csv');var ejs=require(_0x0636('0xa'));var fs=require('fs');var fs_extra=require(_0x0636('0xb'));var _=require(_0x0636('0xc'));var squel=require(_0x0636('0xd'));var crypto=require(_0x0636('0xe'));var jsforce=require(_0x0636('0xf'));var deskjs=require(_0x0636('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0636('0x11'));var Redis=require('ioredis');var authService=require(_0x0636('0x12'));var qs=require(_0x0636('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0636('0x14'))(_0x0636('0x15'));var utils=require(_0x0636('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x166d16,_0xc860d){_0xc860d=_0xc860d||0xcc;return function(_0x534a9f){if(_0x534a9f){return _0x166d16[_0x0636('0x17')](_0xc860d);}return _0x166d16['status'](_0xc860d)['end']();};}function respondWithResult(_0x80f5bf,_0x5d79b2){_0x5d79b2=_0x5d79b2||0xc8;return function(_0x5148ea){if(_0x5148ea){return _0x80f5bf['status'](_0x5d79b2)[_0x0636('0x18')](_0x5148ea);}};}function respondWithFilteredResult(_0x379cd9,_0x1af290){return function(_0x403f49){if(_0x403f49){var _0x480637=typeof _0x1af290['offset']===_0x0636('0x19')&&typeof _0x1af290['limit']==='undefined';var _0x5744f5=_0x403f49[_0x0636('0x1a')];var _0x13f988=_0x480637?0x0:_0x1af290[_0x0636('0x1b')];var _0xf2ee87=_0x480637?_0x403f49['count']:_0x1af290['offset']+_0x1af290[_0x0636('0x1c')];var _0x119208;if(_0xf2ee87>=_0x5744f5){_0xf2ee87=_0x5744f5;_0x119208=0xc8;}else{_0x119208=0xce;}_0x379cd9['status'](_0x119208);return _0x379cd9[_0x0636('0x1d')](_0x0636('0x1e'),_0x13f988+'-'+_0xf2ee87+'/'+_0x5744f5)[_0x0636('0x18')](_0x403f49);}return null;};}function patchUpdates(_0x21c5e2){return function(_0x23c2dc){try{jsonpatch[_0x0636('0x1f')](_0x23c2dc,_0x21c5e2,!![]);}catch(_0x3d3928){return BPromise[_0x0636('0x20')](_0x3d3928);}return _0x23c2dc[_0x0636('0x21')]();};}function saveUpdates(_0x284f1f,_0x25a63c){return function(_0x2fd9fc){if(_0x2fd9fc){return _0x2fd9fc[_0x0636('0x22')](_0x284f1f)['then'](function(_0x3b9a3c){return _0x3b9a3c;});}return null;};}function removeEntity(_0x5029c5,_0x5a5df5){return function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0636('0x23')]()[_0x0636('0x24')](function(){_0x5029c5['status'](0xcc)[_0x0636('0x25')]();});}};}function handleEntityNotFound(_0x183849,_0x439d44){return function(_0x4f5826){if(!_0x4f5826){_0x183849['sendStatus'](0x194);}return _0x4f5826;};}function handleError(_0x224a79,_0x47d752){_0x47d752=_0x47d752||0x1f4;return function(_0x93ab6d){logger[_0x0636('0x26')](_0x93ab6d[_0x0636('0x27')]);if(_0x93ab6d['name']){delete _0x93ab6d[_0x0636('0x28')];}_0x224a79[_0x0636('0x29')](_0x47d752)[_0x0636('0x2a')](_0x93ab6d);};}exports[_0x0636('0x2b')]=function(_0xce955b,_0x1bdf18){var _0xefa644={},_0x36b7ef={},_0x1fe8ad={'count':0x0,'rows':[]};var _0x2a960b=_[_0x0636('0x2c')](db[_0x0636('0x2d')]['rawAttributes'],function(_0x1d1c09){return{'name':_0x1d1c09['fieldName'],'type':_0x1d1c09[_0x0636('0x2e')][_0x0636('0x2f')]};});_0x36b7ef[_0x0636('0x30')]=_[_0x0636('0x2c')](_0x2a960b,'name');_0x36b7ef[_0x0636('0x31')]=_[_0x0636('0x32')](_0xce955b[_0x0636('0x31')]);_0x36b7ef[_0x0636('0x33')]=_[_0x0636('0x34')](_0x36b7ef[_0x0636('0x30')],_0x36b7ef[_0x0636('0x31')]);_0xefa644[_0x0636('0x35')]=_['intersection'](_0x36b7ef[_0x0636('0x30')],qs['fields'](_0xce955b[_0x0636('0x31')][_0x0636('0x36')]));_0xefa644[_0x0636('0x35')]=_0xefa644['attributes'][_0x0636('0x37')]?_0xefa644['attributes']:_0x36b7ef[_0x0636('0x30')];if(!_0xce955b[_0x0636('0x31')][_0x0636('0x38')](_0x0636('0x39'))){_0xefa644[_0x0636('0x1c')]=qs[_0x0636('0x1c')](_0xce955b['query'][_0x0636('0x1c')]);_0xefa644[_0x0636('0x1b')]=qs['offset'](_0xce955b[_0x0636('0x31')][_0x0636('0x1b')]);}_0xefa644['order']=qs[_0x0636('0x3a')](_0xce955b[_0x0636('0x31')]['sort']);_0xefa644['where']=qs[_0x0636('0x33')](_['pick'](_0xce955b[_0x0636('0x31')],_0x36b7ef[_0x0636('0x33')]),_0x2a960b);if(_0xce955b['query'][_0x0636('0x3b')]){_0xefa644[_0x0636('0x3c')]=_[_0x0636('0x3d')](_0xefa644[_0x0636('0x3c')],{'$or':_[_0x0636('0x2c')](_0x2a960b,function(_0x322772){if(_0x322772[_0x0636('0x2e')]!==_0x0636('0x3e')){var _0xf01cae={};_0xf01cae[_0x322772[_0x0636('0x28')]]={'$like':'%'+_0xce955b[_0x0636('0x31')][_0x0636('0x3b')]+'%'};return _0xf01cae;}})});}_0xefa644=_[_0x0636('0x3d')]({},_0xefa644,_0xce955b[_0x0636('0x3f')]);var _0x5a2eef={'where':_0xefa644['where']};return db[_0x0636('0x2d')][_0x0636('0x1a')](_0x5a2eef)['then'](function(_0x2dc600){_0x1fe8ad['count']=_0x2dc600;if(_0xce955b['query'][_0x0636('0x40')]){_0xefa644[_0x0636('0x41')]=[{'all':!![]}];}return db[_0x0636('0x2d')]['findAll'](_0xefa644);})[_0x0636('0x24')](function(_0x145dca){_0x1fe8ad['rows']=_0x145dca;return _0x1fe8ad;})[_0x0636('0x24')](respondWithFilteredResult(_0x1bdf18,_0xefa644))[_0x0636('0x42')](handleError(_0x1bdf18,null));};exports[_0x0636('0x43')]=function(_0x1a97a4,_0x360e0e){var _0x584c87={'raw':!![],'where':{'id':_0x1a97a4['params']['id']}},_0x195fe3={};_0x195fe3[_0x0636('0x30')]=_[_0x0636('0x32')](db[_0x0636('0x2d')][_0x0636('0x44')]);_0x195fe3['query']=_['keys'](_0x1a97a4[_0x0636('0x31')]);_0x195fe3[_0x0636('0x33')]=_['intersection'](_0x195fe3[_0x0636('0x30')],_0x195fe3['query']);_0x584c87[_0x0636('0x35')]=_['intersection'](_0x195fe3[_0x0636('0x30')],qs[_0x0636('0x36')](_0x1a97a4[_0x0636('0x31')][_0x0636('0x36')]));_0x584c87[_0x0636('0x35')]=_0x584c87['attributes'][_0x0636('0x37')]?_0x584c87[_0x0636('0x35')]:_0x195fe3[_0x0636('0x30')];if(_0x1a97a4[_0x0636('0x31')][_0x0636('0x40')]){_0x584c87[_0x0636('0x41')]=[{'all':!![]}];}_0x584c87=_['merge']({},_0x584c87,_0x1a97a4[_0x0636('0x3f')]);return db[_0x0636('0x2d')][_0x0636('0x45')](_0x584c87)['then'](handleEntityNotFound(_0x360e0e,null))[_0x0636('0x24')](respondWithResult(_0x360e0e,null))[_0x0636('0x42')](handleError(_0x360e0e,null));};exports[_0x0636('0x46')]=function(_0x11ea2d,_0x569ac7){return db[_0x0636('0x2d')][_0x0636('0x46')](_0x11ea2d[_0x0636('0x47')],{})[_0x0636('0x24')](respondWithResult(_0x569ac7,0xc9))[_0x0636('0x42')](handleError(_0x569ac7,null));};exports[_0x0636('0x22')]=function(_0x15b824,_0x18b760){if(_0x15b824[_0x0636('0x47')]['id']){delete _0x15b824['body']['id'];}return db[_0x0636('0x2d')][_0x0636('0x45')]({'where':{'id':_0x15b824['params']['id']}})[_0x0636('0x24')](handleEntityNotFound(_0x18b760,null))[_0x0636('0x24')](saveUpdates(_0x15b824[_0x0636('0x47')],null))[_0x0636('0x24')](respondWithResult(_0x18b760,null))[_0x0636('0x42')](handleError(_0x18b760,null));};exports[_0x0636('0x23')]=function(_0x29f2d0,_0x549b84){return db[_0x0636('0x2d')]['find']({'where':{'id':_0x29f2d0['params']['id']}})[_0x0636('0x24')](handleEntityNotFound(_0x549b84,null))[_0x0636('0x24')](removeEntity(_0x549b84,null))['catch'](handleError(_0x549b84,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 5dc2047..053a430 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 _0xc20c=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields'];(function(_0x526002,_0x1789b1){var _0x35c347=function(_0x2508df){while(--_0x2508df){_0x526002['push'](_0x526002['shift']());}};_0x35c347(++_0x1789b1);}(_0xc20c,0x82));var _0xcc20=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0xc20c[_0x1477ef];return _0x164acd;};'use strict';var _=require(_0xcc20('0x0'));var util=require(_0xcc20('0x1'));var logger=require(_0xcc20('0x2'))(_0xcc20('0x3'));var moment=require(_0xcc20('0x4'));var BPromise=require(_0xcc20('0x5'));var rp=require(_0xcc20('0x6'));var fs=require('fs');var path=require(_0xcc20('0x7'));var rimraf=require(_0xcc20('0x8'));var config=require('../../config/environment');var attributes=require(_0xcc20('0x9'));module[_0xcc20('0xa')]=function(_0x3fe439,_0x3dcc89){return _0x3fe439[_0xcc20('0xb')](_0xcc20('0xc'),attributes,{'tableName':_0xcc20('0xd'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0xcc20('0xe'),_0xcc20('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xca51=['dynamics365_unique_index','idField','FieldId','lodash','util','api','bluebird','rimraf','./intDynamics365Field.attributes','exports','define','int_dynamics365_fields'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xca51,0xcf));var _0x1ca5=function(_0x54003c,_0x3e3ea0){_0x54003c=_0x54003c-0x0;var _0x16884=_0xca51[_0x54003c];return _0x16884;};'use strict';var _=require(_0x1ca5('0x0'));var util=require(_0x1ca5('0x1'));var logger=require('../../config/logger')(_0x1ca5('0x2'));var moment=require('moment');var BPromise=require(_0x1ca5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1ca5('0x4'));var config=require('../../config/environment');var attributes=require(_0x1ca5('0x5'));module[_0x1ca5('0x6')]=function(_0x1f4562,_0x5a6a46){return _0x1f4562[_0x1ca5('0x7')]('Dynamics365Field',attributes,{'tableName':_0x1ca5('0x8'),'paranoid':![],'indexes':[{'name':_0x1ca5('0x9'),'fields':[_0x1ca5('0xa'),_0x1ca5('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 456a4f6..267e07f 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 _0xe329=['lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0xe5097a,_0x5832ce){var _0x26e9a5=function(_0x4ef40d){while(--_0x4ef40d){_0xe5097a['push'](_0xe5097a['shift']());}};_0x26e9a5(++_0x5832ce);}(_0xe329,0xb8));var _0x9e32=function(_0x50f930,_0x2ddf02){_0x50f930=_0x50f930-0x0;var _0x5c9201=_0xe329[_0x50f930];return _0x5c9201;};'use strict';var _=require(_0x9e32('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9e32('0x1'));var rs=require(_0x9e32('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e32('0x3'))['db'];var utils=require(_0x9e32('0x4'));var logger=require(_0x9e32('0x5'))(_0x9e32('0x6'));var config=require('../../config/environment');var jayson=require(_0x9e32('0x7'));var client=jayson[_0x9e32('0x8')][_0x9e32('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x148e65,_0x5e0c72,_0x8215b5){return new BPromise(function(_0x5aede4,_0x1ef6c9){return client[_0x9e32('0xa')](_0x148e65,_0x8215b5)[_0x9e32('0xb')](function(_0x25706d){logger[_0x9e32('0xc')](_0x9e32('0xd'),_0x5e0c72,_0x9e32('0xe'));logger[_0x9e32('0xf')](_0x9e32('0x10'),_0x5e0c72,'request\x20sent',JSON[_0x9e32('0x11')](_0x25706d));if(_0x25706d[_0x9e32('0x12')]){if(_0x25706d[_0x9e32('0x12')][_0x9e32('0x13')]===0x1f4){logger[_0x9e32('0x12')](_0x9e32('0xd'),_0x5e0c72,_0x25706d['error'][_0x9e32('0x14')]);return _0x1ef6c9(_0x25706d[_0x9e32('0x12')][_0x9e32('0x14')]);}logger['error'](_0x9e32('0xd'),_0x5e0c72,_0x25706d['error'][_0x9e32('0x14')]);return _0x5aede4(_0x25706d[_0x9e32('0x12')][_0x9e32('0x14')]);}else{logger['info'](_0x9e32('0xd'),_0x5e0c72,_0x9e32('0xe'));_0x5aede4(_0x25706d[_0x9e32('0x15')][_0x9e32('0x14')]);}})[_0x9e32('0x16')](function(_0x8048f8){logger[_0x9e32('0x12')](_0x9e32('0xd'),_0x5e0c72,_0x8048f8);_0x1ef6c9(_0x8048f8);});});} \ No newline at end of file +var _0x186f=['message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s'];(function(_0xdea5b0,_0x28830f){var _0x5d10ac=function(_0x4b0aac){while(--_0x4b0aac){_0xdea5b0['push'](_0xdea5b0['shift']());}};_0x5d10ac(++_0x28830f);}(_0x186f,0x152));var _0xf186=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x186f[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xf186('0x0'));var util=require(_0xf186('0x1'));var moment=require(_0xf186('0x2'));var BPromise=require(_0xf186('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf186('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf186('0x5'));var logger=require(_0xf186('0x6'))('rpc');var config=require(_0xf186('0x7'));var jayson=require(_0xf186('0x8'));var client=jayson[_0xf186('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229761,_0x58ce57,_0x4db72c){return new BPromise(function(_0x4f1f67,_0x12a552){return client[_0xf186('0xa')](_0x229761,_0x4db72c)['then'](function(_0x11cfe9){logger[_0xf186('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x58ce57,_0xf186('0xc'));logger[_0xf186('0xd')](_0xf186('0xe'),_0x58ce57,_0xf186('0xc'),JSON[_0xf186('0xf')](_0x11cfe9));if(_0x11cfe9[_0xf186('0x10')]){if(_0x11cfe9['error'][_0xf186('0x11')]===0x1f4){logger[_0xf186('0x10')](_0xf186('0x12'),_0x58ce57,_0x11cfe9[_0xf186('0x10')]['message']);return _0x12a552(_0x11cfe9['error'][_0xf186('0x13')]);}logger[_0xf186('0x10')](_0xf186('0x12'),_0x58ce57,_0x11cfe9[_0xf186('0x10')][_0xf186('0x13')]);return _0x4f1f67(_0x11cfe9[_0xf186('0x10')][_0xf186('0x13')]);}else{logger[_0xf186('0xb')](_0xf186('0x12'),_0x58ce57,_0xf186('0xc'));_0x4f1f67(_0x11cfe9[_0xf186('0x14')][_0xf186('0x13')]);}})['catch'](function(_0x135e78){logger[_0xf186('0x10')](_0xf186('0x12'),_0x58ce57,_0x135e78);_0x12a552(_0x135e78);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 7145945..fb473b8 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 _0xaab4=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x163229,_0xc064ea){var _0x47b940=function(_0x25559d){while(--_0x25559d){_0x163229['push'](_0x163229['shift']());}};_0x47b940(++_0xc064ea);}(_0xaab4,0x83));var _0x4aab=function(_0x25566a,_0x5f0776){_0x25566a=_0x25566a-0x0;var _0x1de159=_0xaab4[_0x25566a];return _0x1de159;};'use strict';var multer=require(_0x4aab('0x0'));var util=require('util');var path=require(_0x4aab('0x1'));var timeout=require(_0x4aab('0x2'));var express=require(_0x4aab('0x3'));var router=express[_0x4aab('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4aab('0x5'));var interaction=require(_0x4aab('0x6'));var config=require(_0x4aab('0x7'));var controller=require(_0x4aab('0x8'));router[_0x4aab('0x9')]('/',auth[_0x4aab('0xa')](),controller[_0x4aab('0xb')]);router[_0x4aab('0x9')](_0x4aab('0xc'),auth[_0x4aab('0xa')](),controller[_0x4aab('0xd')]);router[_0x4aab('0x9')](_0x4aab('0xe'),auth[_0x4aab('0xa')](),controller[_0x4aab('0xf')]);router[_0x4aab('0x9')](_0x4aab('0x10'),auth[_0x4aab('0xa')](),controller[_0x4aab('0x11')]);router['post']('/',auth[_0x4aab('0xa')](),controller[_0x4aab('0x12')]);router[_0x4aab('0x13')]('/:id/configurations',auth[_0x4aab('0xa')](),controller[_0x4aab('0x14')]);router[_0x4aab('0x15')](_0x4aab('0xc'),auth[_0x4aab('0xa')](),controller['update']);router[_0x4aab('0x16')](_0x4aab('0xc'),auth[_0x4aab('0xa')](),controller[_0x4aab('0x17')]);module['exports']=router; \ No newline at end of file +var _0xcb05=['../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','multer','util','path','Router','fs-extra','../../components/auth/service'];(function(_0x25701b,_0x2a6976){var _0x3a8a2c=function(_0x1a5e78){while(--_0x1a5e78){_0x25701b['push'](_0x25701b['shift']());}};_0x3a8a2c(++_0x2a6976);}(_0xcb05,0x1de));var _0x5cb0=function(_0x225896,_0x2375e6){_0x225896=_0x225896-0x0;var _0xc9e16b=_0xcb05[_0x225896];return _0xc9e16b;};'use strict';var multer=require(_0x5cb0('0x0'));var util=require(_0x5cb0('0x1'));var path=require(_0x5cb0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5cb0('0x3')]();var fs_extra=require(_0x5cb0('0x4'));var auth=require(_0x5cb0('0x5'));var interaction=require(_0x5cb0('0x6'));var config=require(_0x5cb0('0x7'));var controller=require(_0x5cb0('0x8'));router['get']('/',auth[_0x5cb0('0x9')](),controller[_0x5cb0('0xa')]);router['get'](_0x5cb0('0xb'),auth[_0x5cb0('0x9')](),controller[_0x5cb0('0xc')]);router[_0x5cb0('0xd')](_0x5cb0('0xe'),auth[_0x5cb0('0x9')](),controller[_0x5cb0('0xf')]);router['get'](_0x5cb0('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x5cb0('0x11')]('/',auth[_0x5cb0('0x9')](),controller[_0x5cb0('0x12')]);router[_0x5cb0('0x11')]('/:id/configurations',auth[_0x5cb0('0x9')](),controller[_0x5cb0('0x13')]);router[_0x5cb0('0x14')](_0x5cb0('0xb'),auth['isAuthenticated'](),controller[_0x5cb0('0x15')]);router['delete'](_0x5cb0('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 5c36475..53e0dc8 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 _0xb78e=['username','remoteUri','sequelize','exports','STRING'];(function(_0x1b2255,_0x3de34f){var _0x33e57d=function(_0x2f9cce){while(--_0x2f9cce){_0x1b2255['push'](_0x1b2255['shift']());}};_0x33e57d(++_0x3de34f);}(_0xb78e,0x1c9));var _0xeb78=function(_0x41635d,_0x96b7e9){_0x41635d=_0x41635d-0x0;var _0x3ec047=_0xb78e[_0x41635d];return _0x3ec047;};'use strict';var Sequelize=require(_0xeb78('0x0'));module[_0xeb78('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeb78('0x2')]},'username':{'type':Sequelize[_0xeb78('0x2')],'unique':_0xeb78('0x3')},'apiKey':{'type':Sequelize[_0xeb78('0x2')]},'remoteUri':{'type':Sequelize[_0xeb78('0x2')],'unique':_0xeb78('0x4')},'serverUrl':{'type':Sequelize[_0xeb78('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1399=['exports','STRING','username','remoteUri','sequelize'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0x1399,0x16c));var _0x9139=function(_0x4e55a9,_0x241b22){_0x4e55a9=_0x4e55a9-0x0;var _0x4a9b67=_0x1399[_0x4e55a9];return _0x4a9b67;};'use strict';var Sequelize=require(_0x9139('0x0'));module[_0x9139('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9139('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x9139('0x3')},'apiKey':{'type':Sequelize[_0x9139('0x2')]},'remoteUri':{'type':Sequelize[_0x9139('0x2')],'unique':_0x9139('0x4')},'serverUrl':{'type':Sequelize[_0x9139('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 14bc9a7..54191e8 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 _0x74f4=['rows','catch','show','params','rawAttributes','includeAll','find','create','body','update','findOne','FreshdeskConfiguration','getConfigurations','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','agent','description','priority','source','ticket_type','group','remove','includes','default','custom_dropdown','label','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','then','error','name','send','index','map','FreshdeskAccount','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','type','merge','options','include','findAll'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x74f4,0xaa));var _0x474f=function(_0x2eb57a,_0x3138e3){_0x2eb57a=_0x2eb57a-0x0;var _0x1d29aa=_0x74f4[_0x2eb57a];return _0x1d29aa;};'use strict';var emlformat=require(_0x474f('0x0'));var rimraf=require(_0x474f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x474f('0x2'));var rp=require(_0x474f('0x3'));var moment=require('moment');var BPromise=require(_0x474f('0x4'));var Mustache=require('mustache');var util=require(_0x474f('0x5'));var path=require(_0x474f('0x6'));var sox=require(_0x474f('0x7'));var csv=require('to-csv');var ejs=require(_0x474f('0x8'));var fs=require('fs');var fs_extra=require(_0x474f('0x9'));var _=require(_0x474f('0xa'));var squel=require(_0x474f('0xb'));var crypto=require(_0x474f('0xc'));var jsforce=require(_0x474f('0xd'));var deskjs=require(_0x474f('0xe'));var toCsv=require(_0x474f('0xf'));var querystring=require(_0x474f('0x10'));var Papa=require(_0x474f('0x11'));var Redis=require(_0x474f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x474f('0x13'));var as=require(_0x474f('0x14'));var hardwareService=require(_0x474f('0x15'));var logger=require('../../config/logger')(_0x474f('0x16'));var utils=require(_0x474f('0x17'));var config=require(_0x474f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x474f('0x19'))['db'];var integrations=require(_0x474f('0x1a'));function respondWithStatusCode(_0x5e2235,_0xb3eb13){_0xb3eb13=_0xb3eb13||0xcc;return function(_0x30ba8d){if(_0x30ba8d){return _0x5e2235[_0x474f('0x1b')](_0xb3eb13);}return _0x5e2235['status'](_0xb3eb13)[_0x474f('0x1c')]();};}function respondWithResult(_0x7ffcb,_0x39885e){_0x39885e=_0x39885e||0xc8;return function(_0x3caae0){if(_0x3caae0){return _0x7ffcb[_0x474f('0x1d')](_0x39885e)[_0x474f('0x1e')](_0x3caae0);}};}function respondWithFilteredResult(_0x38d085,_0x591cbd){return function(_0xe4b5d3){if(_0xe4b5d3){var _0x5e1d32=typeof _0x591cbd[_0x474f('0x1f')]===_0x474f('0x20')&&typeof _0x591cbd['limit']===_0x474f('0x20');var _0x47a581=_0xe4b5d3[_0x474f('0x21')];var _0x2a172f=_0x5e1d32?0x0:_0x591cbd[_0x474f('0x1f')];var _0x3d13e3=_0x5e1d32?_0xe4b5d3[_0x474f('0x21')]:_0x591cbd['offset']+_0x591cbd[_0x474f('0x22')];var _0x32abe1;if(_0x3d13e3>=_0x47a581){_0x3d13e3=_0x47a581;_0x32abe1=0xc8;}else{_0x32abe1=0xce;}_0x38d085[_0x474f('0x1d')](_0x32abe1);return _0x38d085[_0x474f('0x23')](_0x474f('0x24'),_0x2a172f+'-'+_0x3d13e3+'/'+_0x47a581)['json'](_0xe4b5d3);}return null;};}function patchUpdates(_0x4a7df3){return function(_0x14dd1e){try{jsonpatch[_0x474f('0x25')](_0x14dd1e,_0x4a7df3,!![]);}catch(_0x5667af){return BPromise[_0x474f('0x26')](_0x5667af);}return _0x14dd1e['save']();};}function saveUpdates(_0x28dc37,_0x3f93a7){return function(_0x3988ae){if(_0x3988ae){return _0x3988ae['update'](_0x28dc37)['then'](function(_0x20a388){return _0x20a388;});}return null;};}function removeEntity(_0x202600,_0x4fccb6){return function(_0x39d825){if(_0x39d825){return _0x39d825[_0x474f('0x27')]()[_0x474f('0x28')](function(){_0x202600[_0x474f('0x1d')](0xcc)[_0x474f('0x1c')]();});}};}function handleEntityNotFound(_0x10f111,_0x53b059){return function(_0x2b5fb5){if(!_0x2b5fb5){_0x10f111[_0x474f('0x1b')](0x194);}return _0x2b5fb5;};}function handleError(_0xff871a,_0x315074){_0x315074=_0x315074||0x1f4;return function(_0x150de8){logger[_0x474f('0x29')](_0x150de8['stack']);if(_0x150de8[_0x474f('0x2a')]){delete _0x150de8[_0x474f('0x2a')];}_0xff871a[_0x474f('0x1d')](_0x315074)[_0x474f('0x2b')](_0x150de8);};}exports[_0x474f('0x2c')]=function(_0x4b3b3d,_0x531a57){var _0x198a6f={},_0x3c2cb6={},_0x27c3dc={'count':0x0,'rows':[]};var _0x13a4a2=_[_0x474f('0x2d')](db[_0x474f('0x2e')]['rawAttributes'],function(_0x956465){return{'name':_0x956465[_0x474f('0x2f')],'type':_0x956465['type']['key']};});_0x3c2cb6[_0x474f('0x30')]=_['map'](_0x13a4a2,_0x474f('0x2a'));_0x3c2cb6[_0x474f('0x31')]=_[_0x474f('0x32')](_0x4b3b3d[_0x474f('0x31')]);_0x3c2cb6[_0x474f('0x33')]=_[_0x474f('0x34')](_0x3c2cb6[_0x474f('0x30')],_0x3c2cb6[_0x474f('0x31')]);_0x198a6f[_0x474f('0x35')]=_[_0x474f('0x34')](_0x3c2cb6[_0x474f('0x30')],qs['fields'](_0x4b3b3d[_0x474f('0x31')][_0x474f('0x36')]));_0x198a6f[_0x474f('0x35')]=_0x198a6f[_0x474f('0x35')][_0x474f('0x37')]?_0x198a6f[_0x474f('0x35')]:_0x3c2cb6[_0x474f('0x30')];if(!_0x4b3b3d[_0x474f('0x31')][_0x474f('0x38')]('nolimit')){_0x198a6f['limit']=qs['limit'](_0x4b3b3d[_0x474f('0x31')]['limit']);_0x198a6f['offset']=qs[_0x474f('0x1f')](_0x4b3b3d[_0x474f('0x31')][_0x474f('0x1f')]);}_0x198a6f['order']=qs[_0x474f('0x39')](_0x4b3b3d['query'][_0x474f('0x39')]);_0x198a6f[_0x474f('0x3a')]=qs[_0x474f('0x33')](_[_0x474f('0x3b')](_0x4b3b3d[_0x474f('0x31')],_0x3c2cb6[_0x474f('0x33')]),_0x13a4a2);if(_0x4b3b3d[_0x474f('0x31')][_0x474f('0x3c')]){_0x198a6f[_0x474f('0x3a')]=_['merge'](_0x198a6f['where'],{'$or':_['map'](_0x13a4a2,function(_0x2710bc){if(_0x2710bc[_0x474f('0x3d')]!=='VIRTUAL'){var _0x49e68d={};_0x49e68d[_0x2710bc['name']]={'$like':'%'+_0x4b3b3d[_0x474f('0x31')][_0x474f('0x3c')]+'%'};return _0x49e68d;}})});}_0x198a6f=_[_0x474f('0x3e')]({},_0x198a6f,_0x4b3b3d[_0x474f('0x3f')]);var _0x15f8ca={'where':_0x198a6f[_0x474f('0x3a')]};return db[_0x474f('0x2e')][_0x474f('0x21')](_0x15f8ca)['then'](function(_0x462d60){_0x27c3dc[_0x474f('0x21')]=_0x462d60;if(_0x4b3b3d[_0x474f('0x31')]['includeAll']){_0x198a6f[_0x474f('0x40')]=[{'all':!![]}];}return db[_0x474f('0x2e')][_0x474f('0x41')](_0x198a6f);})['then'](function(_0x422144){_0x27c3dc[_0x474f('0x42')]=_0x422144;return _0x27c3dc;})[_0x474f('0x28')](respondWithFilteredResult(_0x531a57,_0x198a6f))[_0x474f('0x43')](handleError(_0x531a57,null));};exports[_0x474f('0x44')]=function(_0x11ff6b,_0x309801){var _0x41cd93={'raw':![],'where':{'id':_0x11ff6b[_0x474f('0x45')]['id']}},_0x35d758={};_0x35d758[_0x474f('0x30')]=_[_0x474f('0x32')](db[_0x474f('0x2e')][_0x474f('0x46')]);_0x35d758[_0x474f('0x31')]=_[_0x474f('0x32')](_0x11ff6b[_0x474f('0x31')]);_0x35d758['filters']=_[_0x474f('0x34')](_0x35d758[_0x474f('0x30')],_0x35d758[_0x474f('0x31')]);_0x41cd93[_0x474f('0x35')]=_[_0x474f('0x34')](_0x35d758[_0x474f('0x30')],qs['fields'](_0x11ff6b[_0x474f('0x31')]['fields']));_0x41cd93['attributes']=_0x41cd93[_0x474f('0x35')]['length']?_0x41cd93[_0x474f('0x35')]:_0x35d758['model'];if(_0x11ff6b[_0x474f('0x31')][_0x474f('0x47')]){_0x41cd93[_0x474f('0x40')]=[{'all':!![]}];}_0x41cd93=_[_0x474f('0x3e')]({},_0x41cd93,_0x11ff6b[_0x474f('0x3f')]);return db[_0x474f('0x2e')][_0x474f('0x48')](_0x41cd93)[_0x474f('0x28')](handleEntityNotFound(_0x309801,null))[_0x474f('0x28')](respondWithResult(_0x309801,null))[_0x474f('0x43')](handleError(_0x309801,null));};exports['create']=function(_0x102aa7,_0x137289){return db['FreshdeskAccount'][_0x474f('0x49')](_0x102aa7[_0x474f('0x4a')],{})[_0x474f('0x28')](respondWithResult(_0x137289,0xc9))[_0x474f('0x43')](handleError(_0x137289,null));};exports[_0x474f('0x4b')]=function(_0x228b7c,_0x436ea6){if(_0x228b7c['body']['id']){delete _0x228b7c[_0x474f('0x4a')]['id'];}return db[_0x474f('0x2e')][_0x474f('0x48')]({'where':{'id':_0x228b7c[_0x474f('0x45')]['id']}})[_0x474f('0x28')](handleEntityNotFound(_0x436ea6,null))[_0x474f('0x28')](saveUpdates(_0x228b7c[_0x474f('0x4a')],null))[_0x474f('0x28')](respondWithResult(_0x436ea6,null))[_0x474f('0x43')](handleError(_0x436ea6,null));};exports[_0x474f('0x27')]=function(_0x39ff0c,_0x239da5){return db[_0x474f('0x2e')][_0x474f('0x48')]({'where':{'id':_0x39ff0c[_0x474f('0x45')]['id']}})[_0x474f('0x28')](handleEntityNotFound(_0x239da5,null))[_0x474f('0x28')](removeEntity(_0x239da5,null))[_0x474f('0x43')](handleError(_0x239da5,null));};exports['getConfigurations']=function(_0x3809f8,_0x598bda,_0x28ef3e){var _0x323bfb={};var _0x5e1d98={};var _0x2d732f;var _0x199796;return db['FreshdeskAccount'][_0x474f('0x4c')]({'where':{'id':_0x3809f8[_0x474f('0x45')]['id']}})[_0x474f('0x28')](handleEntityNotFound(_0x598bda,null))[_0x474f('0x28')](function(_0x5b31ae){if(_0x5b31ae){_0x2d732f=_0x5b31ae;_0x5e1d98[_0x474f('0x30')]=_[_0x474f('0x32')](db[_0x474f('0x4d')]['rawAttributes']);_0x5e1d98[_0x474f('0x31')]=_['keys'](_0x3809f8[_0x474f('0x31')]);_0x5e1d98[_0x474f('0x33')]=_[_0x474f('0x34')](_0x5e1d98[_0x474f('0x30')],_0x5e1d98[_0x474f('0x31')]);_0x323bfb['attributes']=_[_0x474f('0x34')](_0x5e1d98[_0x474f('0x30')],qs[_0x474f('0x36')](_0x3809f8[_0x474f('0x31')]['fields']));_0x323bfb[_0x474f('0x35')]=_0x323bfb['attributes']['length']?_0x323bfb[_0x474f('0x35')]:_0x5e1d98[_0x474f('0x30')];_0x323bfb['order']=qs[_0x474f('0x39')](_0x3809f8['query'][_0x474f('0x39')]);_0x323bfb['where']=qs[_0x474f('0x33')](_[_0x474f('0x3b')](_0x3809f8['query'],_0x5e1d98['filters']));if(_0x3809f8[_0x474f('0x31')]['filter']){_0x323bfb[_0x474f('0x3a')]=_[_0x474f('0x3e')](_0x323bfb[_0x474f('0x3a')],{'$or':_['map'](_0x323bfb[_0x474f('0x35')],function(_0x2a603){var _0x68af9b={};_0x68af9b[_0x2a603]={'$like':'%'+_0x3809f8[_0x474f('0x31')][_0x474f('0x3c')]+'%'};return _0x68af9b;})});}_0x323bfb=_[_0x474f('0x3e')]({},_0x323bfb,_0x3809f8['options']);return _0x2d732f[_0x474f('0x4e')](_0x323bfb);}})[_0x474f('0x28')](function(_0x3cf539){if(_0x3cf539){_0x199796=_0x3cf539[_0x474f('0x37')];if(!_0x3809f8['query'][_0x474f('0x38')](_0x474f('0x4f'))){_0x323bfb[_0x474f('0x22')]=qs[_0x474f('0x22')](_0x3809f8[_0x474f('0x31')][_0x474f('0x22')]);_0x323bfb['offset']=qs['offset'](_0x3809f8[_0x474f('0x31')]['offset']);}return _0x2d732f[_0x474f('0x4e')](_0x323bfb);}})['then'](function(_0x4b0b2a){if(_0x4b0b2a){return _0x4b0b2a?{'count':_0x199796,'rows':_0x4b0b2a}:null;}})[_0x474f('0x28')](respondWithResult(_0x598bda,null))['catch'](handleError(_0x598bda,null));};exports[_0x474f('0x50')]=function(_0x4546e4,_0xcecefb,_0x1c1c90){if(_0x4546e4[_0x474f('0x4a')]['id']){delete _0x4546e4[_0x474f('0x4a')]['id'];}return db[_0x474f('0x2e')][_0x474f('0x4c')]({'where':{'id':_0x4546e4[_0x474f('0x45')]['id']}})[_0x474f('0x28')](handleEntityNotFound(_0xcecefb,null))[_0x474f('0x28')](function(_0x4add4c){if(_0x4add4c){_0x4546e4['body']['AccountId']=_0x4add4c['id'];_0x4546e4[_0x474f('0x4a')][_0x474f('0x51')]=integrations[_0x474f('0x52')](_0x4546e4[_0x474f('0x4a')][_0x474f('0x53')],_0x4546e4['body']['type']);_0x4546e4[_0x474f('0x4a')][_0x474f('0x54')]=integrations[_0x474f('0x55')](_0x4546e4[_0x474f('0x4a')][_0x474f('0x53')],_0x4546e4[_0x474f('0x4a')]['type']);return db['FreshdeskConfiguration'][_0x474f('0x49')](_0x4546e4[_0x474f('0x4a')],{'include':[{'model':db[_0x474f('0x56')],'as':_0x474f('0x51')},{'model':db[_0x474f('0x56')],'as':_0x474f('0x54')}]});}return null;})[_0x474f('0x28')](respondWithResult(_0xcecefb,null))['catch'](handleError(_0xcecefb,null));};exports[_0x474f('0x57')]=function(_0x9a14b8,_0x310246,_0x511ca5){var _0x331640='';return db[_0x474f('0x2e')][_0x474f('0x4c')]({'where':{'id':_0x9a14b8['params']['id']},'attributes':['id',_0x474f('0x58'),_0x474f('0x59')]})['then'](handleEntityNotFound(_0x310246,null))[_0x474f('0x28')](function(_0x56ece6){if(_0x56ece6){_0x331640=_0x56ece6[_0x474f('0x58')];var _0x5181c4=_0x331640[_0x474f('0x5a')](-0x1);if(_0x5181c4==='/'){_0x331640=_0x331640[_0x474f('0x5b')](0x0,_0x331640[_0x474f('0x5c')](_0x5181c4));}return rp({'method':_0x474f('0x5d'),'uri':util[_0x474f('0x5e')](_0x474f('0x5f'),_0x331640,_0x474f('0x60')),'headers':{'Authorization':util['format'](_0x474f('0x61'),new Buffer(util['format'](_0x474f('0x62'),_0x56ece6[_0x474f('0x59')]))[_0x474f('0x63')](_0x474f('0x64')))},'json':!![]});}})[_0x474f('0x28')](function(_0x5d7258){if(_0x5d7258){var _0x5bc7c2=[_0x474f('0x65'),'subject',_0x474f('0x66'),_0x474f('0x67'),'status',_0x474f('0x68'),'group',_0x474f('0x69'),_0x474f('0x6a'),_0x474f('0x6b'),'company'];_[_0x474f('0x6c')](_0x5d7258,function(_0x5e989c){return _0x5bc7c2[_0x474f('0x6d')](_0x5e989c['name'])||!_0x5e989c[_0x474f('0x6e')]&&_0x5e989c[_0x474f('0x3d')]!=='custom_text'&&_0x5e989c['type']!==_0x474f('0x6f');});return{'count':_0x5d7258[_0x474f('0x37')],'rows':_['map'](_0x5d7258,function(_0x410cb9){return{'id':_0x410cb9[_0x474f('0x2a')],'name':_0x410cb9[_0x474f('0x70')],'custom':!_0x410cb9[_0x474f('0x6e')],'options':_0x410cb9[_0x474f('0x71')]?_[_0x474f('0x2d')](_0x410cb9[_0x474f('0x71')],function(_0x1c03be){return{'name':_[_0x474f('0x72')](_0x1c03be),'value':_0x1c03be};}):[]};})};}})['then'](respondWithResult(_0x310246,null))[_0x474f('0x43')](function(_0xa1434e){var _0x9d6ffe=_0x9a14b8[_0x474f('0x31')][_0x474f('0x73')]?0x1f4:_0xa1434e['statusCode']||0x1f4;logger[_0x474f('0x29')](_0x474f('0x74'),'getFields',_0x9d6ffe,JSON[_0x474f('0x75')](_0xa1434e));delete _0xa1434e['name'];if(_0x9d6ffe===0x191){_0x9d6ffe=0x190;}_0x310246[_0x474f('0x1d')](_0x9d6ffe)['send'](_0x9a14b8[_0x474f('0x31')][_0x474f('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0xa1434e['statusCode']}:_0xa1434e);});}; \ No newline at end of file +var _0x58a4=['map','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','apiKey','remoteUri','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','toString','base64','requester','subject','agent','description','priority','group','source','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','stack','name','send'];(function(_0x154192,_0x2d360f){var _0x3c2792=function(_0x2e257b){while(--_0x2e257b){_0x154192['push'](_0x154192['shift']());}};_0x3c2792(++_0x2d360f);}(_0x58a4,0xbf));var _0x458a=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x58a4[_0x346737];return _0x1ade2e;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require(_0x458a('0x1'));var zipdir=require(_0x458a('0x2'));var jsonpatch=require(_0x458a('0x3'));var rp=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var BPromise=require(_0x458a('0x6'));var Mustache=require(_0x458a('0x7'));var util=require(_0x458a('0x8'));var path=require(_0x458a('0x9'));var sox=require(_0x458a('0xa'));var csv=require(_0x458a('0xb'));var ejs=require(_0x458a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];var integrations=require(_0x458a('0x1a'));function respondWithStatusCode(_0x2a4934,_0x2e788b){_0x2e788b=_0x2e788b||0xcc;return function(_0x5bd09e){if(_0x5bd09e){return _0x2a4934['sendStatus'](_0x2e788b);}return _0x2a4934[_0x458a('0x1b')](_0x2e788b)['end']();};}function respondWithResult(_0x2c7528,_0x44f683){_0x44f683=_0x44f683||0xc8;return function(_0x10133b){if(_0x10133b){return _0x2c7528[_0x458a('0x1b')](_0x44f683)[_0x458a('0x1c')](_0x10133b);}};}function respondWithFilteredResult(_0x29acee,_0x507b0f){return function(_0x4b26be){if(_0x4b26be){var _0x5c7993=typeof _0x507b0f[_0x458a('0x1d')]===_0x458a('0x1e')&&typeof _0x507b0f[_0x458a('0x1f')]==='undefined';var _0x310569=_0x4b26be[_0x458a('0x20')];var _0x18504d=_0x5c7993?0x0:_0x507b0f[_0x458a('0x1d')];var _0xa91473=_0x5c7993?_0x4b26be['count']:_0x507b0f['offset']+_0x507b0f[_0x458a('0x1f')];var _0x4d07a7;if(_0xa91473>=_0x310569){_0xa91473=_0x310569;_0x4d07a7=0xc8;}else{_0x4d07a7=0xce;}_0x29acee[_0x458a('0x1b')](_0x4d07a7);return _0x29acee[_0x458a('0x21')]('Content-Range',_0x18504d+'-'+_0xa91473+'/'+_0x310569)[_0x458a('0x1c')](_0x4b26be);}return null;};}function patchUpdates(_0x55a588){return function(_0x200213){try{jsonpatch[_0x458a('0x22')](_0x200213,_0x55a588,!![]);}catch(_0x59f44c){return BPromise[_0x458a('0x23')](_0x59f44c);}return _0x200213[_0x458a('0x24')]();};}function saveUpdates(_0x5a2bcb,_0xa6b8ff){return function(_0x5ad95a){if(_0x5ad95a){return _0x5ad95a[_0x458a('0x25')](_0x5a2bcb)['then'](function(_0x4080fc){return _0x4080fc;});}return null;};}function removeEntity(_0x5dfc6c,_0x36b08e){return function(_0x911eaf){if(_0x911eaf){return _0x911eaf[_0x458a('0x26')]()[_0x458a('0x27')](function(){_0x5dfc6c[_0x458a('0x1b')](0xcc)[_0x458a('0x28')]();});}};}function handleEntityNotFound(_0x340375,_0x3012c7){return function(_0x1f2d0){if(!_0x1f2d0){_0x340375[_0x458a('0x29')](0x194);}return _0x1f2d0;};}function handleError(_0x52efed,_0x327fcb){_0x327fcb=_0x327fcb||0x1f4;return function(_0x21ec38){logger['error'](_0x21ec38[_0x458a('0x2a')]);if(_0x21ec38[_0x458a('0x2b')]){delete _0x21ec38['name'];}_0x52efed['status'](_0x327fcb)[_0x458a('0x2c')](_0x21ec38);};}exports['index']=function(_0x33c5d8,_0x29f9b5){var _0x223f73={},_0x4a49e4={},_0xa6fdf={'count':0x0,'rows':[]};var _0x2531f7=_[_0x458a('0x2d')](db['FreshdeskAccount']['rawAttributes'],function(_0x18c890){return{'name':_0x18c890['fieldName'],'type':_0x18c890[_0x458a('0x2e')]['key']};});_0x4a49e4[_0x458a('0x2f')]=_[_0x458a('0x2d')](_0x2531f7,'name');_0x4a49e4[_0x458a('0x30')]=_[_0x458a('0x31')](_0x33c5d8[_0x458a('0x30')]);_0x4a49e4['filters']=_[_0x458a('0x32')](_0x4a49e4[_0x458a('0x2f')],_0x4a49e4[_0x458a('0x30')]);_0x223f73[_0x458a('0x33')]=_[_0x458a('0x32')](_0x4a49e4['model'],qs[_0x458a('0x34')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x34')]));_0x223f73[_0x458a('0x33')]=_0x223f73[_0x458a('0x33')][_0x458a('0x35')]?_0x223f73['attributes']:_0x4a49e4[_0x458a('0x2f')];if(!_0x33c5d8[_0x458a('0x30')][_0x458a('0x36')](_0x458a('0x37'))){_0x223f73[_0x458a('0x1f')]=qs[_0x458a('0x1f')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x1f')]);_0x223f73[_0x458a('0x1d')]=qs['offset'](_0x33c5d8[_0x458a('0x30')][_0x458a('0x1d')]);}_0x223f73[_0x458a('0x38')]=qs[_0x458a('0x39')](_0x33c5d8[_0x458a('0x30')][_0x458a('0x39')]);_0x223f73[_0x458a('0x3a')]=qs[_0x458a('0x3b')](_[_0x458a('0x3c')](_0x33c5d8[_0x458a('0x30')],_0x4a49e4[_0x458a('0x3b')]),_0x2531f7);if(_0x33c5d8[_0x458a('0x30')][_0x458a('0x3d')]){_0x223f73[_0x458a('0x3a')]=_[_0x458a('0x3e')](_0x223f73['where'],{'$or':_[_0x458a('0x2d')](_0x2531f7,function(_0x397a41){if(_0x397a41[_0x458a('0x2e')]!==_0x458a('0x3f')){var _0x3c5840={};_0x3c5840[_0x397a41[_0x458a('0x2b')]]={'$like':'%'+_0x33c5d8[_0x458a('0x30')][_0x458a('0x3d')]+'%'};return _0x3c5840;}})});}_0x223f73=_[_0x458a('0x3e')]({},_0x223f73,_0x33c5d8[_0x458a('0x40')]);var _0x20cf10={'where':_0x223f73['where']};return db[_0x458a('0x41')][_0x458a('0x20')](_0x20cf10)['then'](function(_0x430bda){_0xa6fdf[_0x458a('0x20')]=_0x430bda;if(_0x33c5d8[_0x458a('0x30')]['includeAll']){_0x223f73[_0x458a('0x42')]=[{'all':!![]}];}return db[_0x458a('0x41')][_0x458a('0x43')](_0x223f73);})[_0x458a('0x27')](function(_0xbcd632){_0xa6fdf[_0x458a('0x44')]=_0xbcd632;return _0xa6fdf;})[_0x458a('0x27')](respondWithFilteredResult(_0x29f9b5,_0x223f73))[_0x458a('0x45')](handleError(_0x29f9b5,null));};exports['show']=function(_0x296385,_0x145e3c){var _0x2b9030={'raw':![],'where':{'id':_0x296385[_0x458a('0x46')]['id']}},_0x5180ae={};_0x5180ae[_0x458a('0x2f')]=_['keys'](db[_0x458a('0x41')][_0x458a('0x47')]);_0x5180ae[_0x458a('0x30')]=_[_0x458a('0x31')](_0x296385[_0x458a('0x30')]);_0x5180ae['filters']=_['intersection'](_0x5180ae[_0x458a('0x2f')],_0x5180ae[_0x458a('0x30')]);_0x2b9030[_0x458a('0x33')]=_[_0x458a('0x32')](_0x5180ae['model'],qs[_0x458a('0x34')](_0x296385[_0x458a('0x30')]['fields']));_0x2b9030[_0x458a('0x33')]=_0x2b9030['attributes'][_0x458a('0x35')]?_0x2b9030[_0x458a('0x33')]:_0x5180ae[_0x458a('0x2f')];if(_0x296385['query'][_0x458a('0x48')]){_0x2b9030[_0x458a('0x42')]=[{'all':!![]}];}_0x2b9030=_[_0x458a('0x3e')]({},_0x2b9030,_0x296385['options']);return db['FreshdeskAccount'][_0x458a('0x49')](_0x2b9030)[_0x458a('0x27')](handleEntityNotFound(_0x145e3c,null))[_0x458a('0x27')](respondWithResult(_0x145e3c,null))['catch'](handleError(_0x145e3c,null));};exports['create']=function(_0x3a7005,_0xf362b5){return db[_0x458a('0x41')][_0x458a('0x4a')](_0x3a7005[_0x458a('0x4b')],{})[_0x458a('0x27')](respondWithResult(_0xf362b5,0xc9))[_0x458a('0x45')](handleError(_0xf362b5,null));};exports[_0x458a('0x25')]=function(_0xb22232,_0x213f86){if(_0xb22232[_0x458a('0x4b')]['id']){delete _0xb22232[_0x458a('0x4b')]['id'];}return db[_0x458a('0x41')][_0x458a('0x49')]({'where':{'id':_0xb22232[_0x458a('0x46')]['id']}})[_0x458a('0x27')](handleEntityNotFound(_0x213f86,null))['then'](saveUpdates(_0xb22232[_0x458a('0x4b')],null))[_0x458a('0x27')](respondWithResult(_0x213f86,null))[_0x458a('0x45')](handleError(_0x213f86,null));};exports[_0x458a('0x26')]=function(_0x44670a,_0x5630cf){return db['FreshdeskAccount']['find']({'where':{'id':_0x44670a[_0x458a('0x46')]['id']}})['then'](handleEntityNotFound(_0x5630cf,null))[_0x458a('0x27')](removeEntity(_0x5630cf,null))[_0x458a('0x45')](handleError(_0x5630cf,null));};exports[_0x458a('0x4c')]=function(_0x649553,_0xfa6e65,_0x5f0151){var _0x48f68e={};var _0x3d7616={};var _0x2d8b77;var _0x2587a1;return db[_0x458a('0x41')][_0x458a('0x4d')]({'where':{'id':_0x649553['params']['id']}})[_0x458a('0x27')](handleEntityNotFound(_0xfa6e65,null))['then'](function(_0xa51e28){if(_0xa51e28){_0x2d8b77=_0xa51e28;_0x3d7616['model']=_[_0x458a('0x31')](db['FreshdeskConfiguration']['rawAttributes']);_0x3d7616['query']=_[_0x458a('0x31')](_0x649553[_0x458a('0x30')]);_0x3d7616['filters']=_[_0x458a('0x32')](_0x3d7616[_0x458a('0x2f')],_0x3d7616[_0x458a('0x30')]);_0x48f68e['attributes']=_[_0x458a('0x32')](_0x3d7616[_0x458a('0x2f')],qs[_0x458a('0x34')](_0x649553[_0x458a('0x30')][_0x458a('0x34')]));_0x48f68e[_0x458a('0x33')]=_0x48f68e['attributes'][_0x458a('0x35')]?_0x48f68e[_0x458a('0x33')]:_0x3d7616[_0x458a('0x2f')];_0x48f68e[_0x458a('0x38')]=qs[_0x458a('0x39')](_0x649553[_0x458a('0x30')][_0x458a('0x39')]);_0x48f68e[_0x458a('0x3a')]=qs['filters'](_[_0x458a('0x3c')](_0x649553['query'],_0x3d7616[_0x458a('0x3b')]));if(_0x649553[_0x458a('0x30')][_0x458a('0x3d')]){_0x48f68e[_0x458a('0x3a')]=_['merge'](_0x48f68e['where'],{'$or':_[_0x458a('0x2d')](_0x48f68e[_0x458a('0x33')],function(_0x2b9aac){var _0x156a22={};_0x156a22[_0x2b9aac]={'$like':'%'+_0x649553[_0x458a('0x30')][_0x458a('0x3d')]+'%'};return _0x156a22;})});}_0x48f68e=_['merge']({},_0x48f68e,_0x649553[_0x458a('0x40')]);return _0x2d8b77[_0x458a('0x4c')](_0x48f68e);}})['then'](function(_0x18d83a){if(_0x18d83a){_0x2587a1=_0x18d83a['length'];if(!_0x649553[_0x458a('0x30')][_0x458a('0x36')](_0x458a('0x37'))){_0x48f68e[_0x458a('0x1f')]=qs[_0x458a('0x1f')](_0x649553[_0x458a('0x30')][_0x458a('0x1f')]);_0x48f68e[_0x458a('0x1d')]=qs['offset'](_0x649553[_0x458a('0x30')][_0x458a('0x1d')]);}return _0x2d8b77['getConfigurations'](_0x48f68e);}})[_0x458a('0x27')](function(_0x3da617){if(_0x3da617){return _0x3da617?{'count':_0x2587a1,'rows':_0x3da617}:null;}})['then'](respondWithResult(_0xfa6e65,null))[_0x458a('0x45')](handleError(_0xfa6e65,null));};exports[_0x458a('0x4e')]=function(_0x47cbcf,_0x17b611,_0x180df0){if(_0x47cbcf['body']['id']){delete _0x47cbcf[_0x458a('0x4b')]['id'];}return db[_0x458a('0x41')][_0x458a('0x4d')]({'where':{'id':_0x47cbcf[_0x458a('0x46')]['id']}})[_0x458a('0x27')](handleEntityNotFound(_0x17b611,null))[_0x458a('0x27')](function(_0x4199a7){if(_0x4199a7){_0x47cbcf[_0x458a('0x4b')]['AccountId']=_0x4199a7['id'];_0x47cbcf[_0x458a('0x4b')][_0x458a('0x4f')]=integrations[_0x458a('0x50')](_0x47cbcf[_0x458a('0x4b')][_0x458a('0x51')],_0x47cbcf[_0x458a('0x4b')][_0x458a('0x2e')]);_0x47cbcf[_0x458a('0x4b')][_0x458a('0x52')]=integrations[_0x458a('0x53')](_0x47cbcf['body'][_0x458a('0x51')],_0x47cbcf['body'][_0x458a('0x2e')]);return db[_0x458a('0x54')][_0x458a('0x4a')](_0x47cbcf[_0x458a('0x4b')],{'include':[{'model':db[_0x458a('0x55')],'as':_0x458a('0x4f')},{'model':db[_0x458a('0x55')],'as':_0x458a('0x52')}]});}return null;})[_0x458a('0x27')](respondWithResult(_0x17b611,null))[_0x458a('0x45')](handleError(_0x17b611,null));};exports[_0x458a('0x56')]=function(_0x448cbc,_0x11bbba,_0x435884){var _0x3948aa='';return db[_0x458a('0x41')]['findOne']({'where':{'id':_0x448cbc[_0x458a('0x46')]['id']},'attributes':['id','remoteUri',_0x458a('0x57')]})[_0x458a('0x27')](handleEntityNotFound(_0x11bbba,null))['then'](function(_0xdfc430){if(_0xdfc430){_0x3948aa=_0xdfc430[_0x458a('0x58')];var _0x350b73=_0x3948aa['slice'](-0x1);if(_0x350b73==='/'){_0x3948aa=_0x3948aa[_0x458a('0x59')](0x0,_0x3948aa[_0x458a('0x5a')](_0x350b73));}return rp({'method':_0x458a('0x5b'),'uri':util[_0x458a('0x5c')](_0x458a('0x5d'),_0x3948aa,_0x458a('0x5e')),'headers':{'Authorization':util['format'](_0x458a('0x5f'),new Buffer(util['format']('%s:X',_0xdfc430[_0x458a('0x57')]))[_0x458a('0x60')](_0x458a('0x61')))},'json':!![]});}})[_0x458a('0x27')](function(_0xaf6262){if(_0xaf6262){var _0x434d04=[_0x458a('0x62'),_0x458a('0x63'),_0x458a('0x64'),_0x458a('0x65'),_0x458a('0x1b'),_0x458a('0x66'),_0x458a('0x67'),_0x458a('0x68'),'ticket_type','group','company'];_[_0x458a('0x69')](_0xaf6262,function(_0x5c6a8d){return _0x434d04[_0x458a('0x6a')](_0x5c6a8d[_0x458a('0x2b')])||!_0x5c6a8d[_0x458a('0x6b')]&&_0x5c6a8d[_0x458a('0x2e')]!==_0x458a('0x6c')&&_0x5c6a8d[_0x458a('0x2e')]!==_0x458a('0x6d');});return{'count':_0xaf6262['length'],'rows':_[_0x458a('0x2d')](_0xaf6262,function(_0x15aecc){return{'id':_0x15aecc['name'],'name':_0x15aecc[_0x458a('0x6e')],'custom':!_0x15aecc['default'],'options':_0x15aecc[_0x458a('0x6f')]?_['map'](_0x15aecc[_0x458a('0x6f')],function(_0x177457){return{'name':_[_0x458a('0x70')](_0x177457),'value':_0x177457};}):[]};})};}})[_0x458a('0x27')](respondWithResult(_0x11bbba,null))['catch'](function(_0x191872){var _0x14b95e=_0x448cbc[_0x458a('0x30')][_0x458a('0x71')]?0x1f4:_0x191872[_0x458a('0x72')]||0x1f4;logger[_0x458a('0x73')](_0x458a('0x74'),_0x458a('0x56'),_0x14b95e,JSON['stringify'](_0x191872));delete _0x191872[_0x458a('0x2b')];if(_0x14b95e===0x191){_0x14b95e=0x190;}_0x11bbba[_0x458a('0x1b')](_0x14b95e)[_0x458a('0x2c')](_0x448cbc[_0x458a('0x30')]['test']?{'message':_0x458a('0x75'),'statusCode':_0x191872[_0x458a('0x72')]}:_0x191872);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 2092b3b..8711feb 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 _0xd19a=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount'];(function(_0x3eeb27,_0x57c88d){var _0x5de4d6=function(_0x2d0c6b){while(--_0x2d0c6b){_0x3eeb27['push'](_0x3eeb27['shift']());}};_0x5de4d6(++_0x57c88d);}(_0xd19a,0x138));var _0xad19=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd19a[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0xad19('0x0'));var logger=require(_0xad19('0x1'))(_0xad19('0x2'));var moment=require(_0xad19('0x3'));var BPromise=require(_0xad19('0x4'));var rp=require(_0xad19('0x5'));var fs=require('fs');var path=require(_0xad19('0x6'));var rimraf=require(_0xad19('0x7'));var config=require(_0xad19('0x8'));var attributes=require(_0xad19('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xad19('0xa')]=function(_0x467a94,_0x57c495){return _0x467a94[_0xad19('0xb')](_0xad19('0xc'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8a0=['api','moment','bluebird','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger'];(function(_0x56856c,_0x4de39b){var _0x102f4c=function(_0x1272c4){while(--_0x1272c4){_0x56856c['push'](_0x56856c['shift']());}};_0x102f4c(++_0x4de39b);}(_0xd8a0,0x123));var _0x0d8a=function(_0x3c48ee,_0x454380){_0x3c48ee=_0x3c48ee-0x0;var _0x5a6e24=_0xd8a0[_0x3c48ee];return _0x5a6e24;};'use strict';var _=require(_0x0d8a('0x0'));var util=require(_0x0d8a('0x1'));var logger=require(_0x0d8a('0x2'))(_0x0d8a('0x3'));var moment=require(_0x0d8a('0x4'));var BPromise=require(_0x0d8a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0d8a('0x6'));var config=require(_0x0d8a('0x7'));var attributes=require(_0x0d8a('0x8'));var integrations=require(_0x0d8a('0x9'));module[_0x0d8a('0xa')]=function(_0x4ac805,_0x103839){return _0x4ac805[_0x0d8a('0xb')](_0x0d8a('0xc'),attributes,{'tableName':_0x0d8a('0xd'),'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 73ca130..a3180c8 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 _0x7079=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFreshdeskAccount','findAll','options','raw','where','include','model','attributes','map','then','stringify','ShowFreshdeskAccount','FreshdeskAccount','find','lodash'];(function(_0x34b91,_0x1935f0){var _0x4370d4=function(_0x17e9d7){while(--_0x17e9d7){_0x34b91['push'](_0x34b91['shift']());}};_0x4370d4(++_0x1935f0);}(_0x7079,0x68));var _0x9707=function(_0x1ae5ca,_0x263120){_0x1ae5ca=_0x1ae5ca-0x0;var _0x162a85=_0x7079[_0x1ae5ca];return _0x162a85;};'use strict';var _=require(_0x9707('0x0'));var util=require(_0x9707('0x1'));var moment=require('moment');var BPromise=require(_0x9707('0x2'));var rs=require(_0x9707('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9707('0x4'))['db'];var utils=require(_0x9707('0x5'));var logger=require(_0x9707('0x6'))('rpc');var config=require(_0x9707('0x7'));var jayson=require(_0x9707('0x8'));var client=jayson[_0x9707('0x9')][_0x9707('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28160d,_0x40761e,_0x3c43c7){return new BPromise(function(_0x2c4afa,_0x20e436){return client['request'](_0x28160d,_0x3c43c7)['then'](function(_0x431bad){logger[_0x9707('0xb')](_0x9707('0xc'),_0x40761e,_0x9707('0xd'));logger[_0x9707('0xe')](_0x9707('0xf'),_0x40761e,_0x9707('0xd'),JSON['stringify'](_0x431bad));if(_0x431bad[_0x9707('0x10')]){if(_0x431bad['error'][_0x9707('0x11')]===0x1f4){logger[_0x9707('0x10')](_0x9707('0xc'),_0x40761e,_0x431bad[_0x9707('0x10')][_0x9707('0x12')]);return _0x20e436(_0x431bad['error'][_0x9707('0x12')]);}logger['error'](_0x9707('0xc'),_0x40761e,_0x431bad[_0x9707('0x10')][_0x9707('0x12')]);return _0x2c4afa(_0x431bad['error'][_0x9707('0x12')]);}else{logger['info'](_0x9707('0xc'),_0x40761e,_0x9707('0xd'));_0x2c4afa(_0x431bad[_0x9707('0x13')]['message']);}})[_0x9707('0x14')](function(_0x353d9e){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x40761e,_0x353d9e);_0x20e436(_0x353d9e);});});}exports[_0x9707('0x15')]=function(_0x4084eb){var _0x36e0d3=this;return new Promise(function(_0x3be78c,_0x48c86f){return db['FreshdeskAccount'][_0x9707('0x16')]({'raw':_0x4084eb[_0x9707('0x17')]?_0x4084eb[_0x9707('0x17')][_0x9707('0x18')]===undefined?!![]:![]:!![],'where':_0x4084eb[_0x9707('0x17')]?_0x4084eb[_0x9707('0x17')][_0x9707('0x19')]||null:null,'attributes':_0x4084eb[_0x9707('0x17')]?_0x4084eb[_0x9707('0x17')]['attributes']||null:null,'limit':_0x4084eb[_0x9707('0x17')]?_0x4084eb[_0x9707('0x17')]['limit']||null:null,'include':_0x4084eb['options']?_0x4084eb[_0x9707('0x17')][_0x9707('0x1a')]?_['map'](_0x4084eb['options'][_0x9707('0x1a')],function(_0x1f1e00){return{'model':db[_0x1f1e00[_0x9707('0x1b')]],'as':_0x1f1e00['as'],'attributes':_0x1f1e00[_0x9707('0x1c')],'include':_0x1f1e00['include']?_['map'](_0x1f1e00[_0x9707('0x1a')],function(_0x2f4671){return{'model':db[_0x2f4671[_0x9707('0x1b')]],'as':_0x2f4671['as'],'attributes':_0x2f4671[_0x9707('0x1c')],'include':_0x2f4671[_0x9707('0x1a')]?_[_0x9707('0x1d')](_0x2f4671[_0x9707('0x1a')],function(_0x382ad5){return{'model':db[_0x382ad5[_0x9707('0x1b')]],'as':_0x382ad5['as'],'attributes':_0x382ad5[_0x9707('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9707('0x1e')](function(_0x41f873){logger[_0x9707('0xb')](_0x9707('0x15'),_0x4084eb);logger[_0x9707('0xe')](_0x9707('0x15'),_0x4084eb,JSON[_0x9707('0x1f')](_0x41f873));_0x3be78c(_0x41f873);})[_0x9707('0x14')](function(_0x19accd){logger[_0x9707('0x10')]('GetFreshdeskAccount',_0x19accd[_0x9707('0x12')],_0x4084eb);_0x48c86f(_0x36e0d3[_0x9707('0x10')](0x1f4,_0x19accd[_0x9707('0x12')]));});});};exports[_0x9707('0x20')]=function(_0x2ee6b5){var _0x4183f7=this;return new Promise(function(_0x1ff43b,_0x1ec7e8){return db[_0x9707('0x21')][_0x9707('0x22')]({'raw':_0x2ee6b5[_0x9707('0x17')]?_0x2ee6b5[_0x9707('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2ee6b5['options']?_0x2ee6b5[_0x9707('0x17')]['where']||null:null,'attributes':_0x2ee6b5[_0x9707('0x17')]?_0x2ee6b5[_0x9707('0x17')][_0x9707('0x1c')]||null:null,'include':_0x2ee6b5[_0x9707('0x17')]?_0x2ee6b5['options'][_0x9707('0x1a')]?_[_0x9707('0x1d')](_0x2ee6b5[_0x9707('0x17')]['include'],function(_0x24079b){return{'model':db[_0x24079b[_0x9707('0x1b')]],'as':_0x24079b['as'],'attributes':_0x24079b[_0x9707('0x1c')],'include':_0x24079b[_0x9707('0x1a')]?_[_0x9707('0x1d')](_0x24079b[_0x9707('0x1a')],function(_0x5685d2){return{'model':db[_0x5685d2[_0x9707('0x1b')]],'as':_0x5685d2['as'],'attributes':_0x5685d2[_0x9707('0x1c')],'include':_0x5685d2[_0x9707('0x1a')]?_['map'](_0x5685d2[_0x9707('0x1a')],function(_0x1212b0){return{'model':db[_0x1212b0[_0x9707('0x1b')]],'as':_0x1212b0['as'],'attributes':_0x1212b0[_0x9707('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9707('0x1e')](function(_0x18285a){logger[_0x9707('0xb')](_0x9707('0x20'),_0x2ee6b5);logger[_0x9707('0xe')](_0x9707('0x20'),_0x2ee6b5,JSON[_0x9707('0x1f')](_0x18285a));_0x1ff43b(_0x18285a);})['catch'](function(_0x371336){logger[_0x9707('0x10')](_0x9707('0x20'),_0x371336['message'],_0x2ee6b5);_0x1ec7e8(_0x4183f7[_0x9707('0x10')](0x1f4,_0x371336[_0x9707('0x12')]));});});}; \ No newline at end of file +var _0x460c=['info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','debug','ShowFreshdeskAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x441c5d,_0x9c45a8){var _0x3793a5=function(_0x183250){while(--_0x183250){_0x441c5d['push'](_0x441c5d['shift']());}};_0x3793a5(++_0x9c45a8);}(_0x460c,0xe8));var _0xc460=function(_0x513306,_0x13d8af){_0x513306=_0x513306-0x0;var _0x38c9f5=_0x460c[_0x513306];return _0x38c9f5;};'use strict';var _=require('lodash');var util=require(_0xc460('0x0'));var moment=require(_0xc460('0x1'));var BPromise=require(_0xc460('0x2'));var rs=require(_0xc460('0x3'));var fs=require('fs');var Redis=require(_0xc460('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc460('0x5'));var logger=require(_0xc460('0x6'))(_0xc460('0x7'));var config=require(_0xc460('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc460('0x9')][_0xc460('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5454ff,_0x1d4cd1,_0x18775d){return new BPromise(function(_0x32322e,_0x314bd3){return client[_0xc460('0xb')](_0x5454ff,_0x18775d)[_0xc460('0xc')](function(_0x92258e){logger[_0xc460('0xd')](_0xc460('0xe'),_0x1d4cd1,_0xc460('0xf'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x1d4cd1,_0xc460('0xf'),JSON['stringify'](_0x92258e));if(_0x92258e[_0xc460('0x10')]){if(_0x92258e['error'][_0xc460('0x11')]===0x1f4){logger[_0xc460('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x1d4cd1,_0x92258e['error'][_0xc460('0x12')]);return _0x314bd3(_0x92258e[_0xc460('0x10')][_0xc460('0x12')]);}logger[_0xc460('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x1d4cd1,_0x92258e[_0xc460('0x10')]['message']);return _0x32322e(_0x92258e['error']['message']);}else{logger[_0xc460('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x1d4cd1,_0xc460('0xf'));_0x32322e(_0x92258e[_0xc460('0x13')]['message']);}})[_0xc460('0x14')](function(_0x3f6174){logger[_0xc460('0x10')](_0xc460('0xe'),_0x1d4cd1,_0x3f6174);_0x314bd3(_0x3f6174);});});}exports[_0xc460('0x15')]=function(_0x52374d){var _0x4ebe1f=this;return new Promise(function(_0x3c459a,_0x1e5a3a){return db[_0xc460('0x16')][_0xc460('0x17')]({'raw':_0x52374d['options']?_0x52374d[_0xc460('0x18')][_0xc460('0x19')]===undefined?!![]:![]:!![],'where':_0x52374d[_0xc460('0x18')]?_0x52374d['options'][_0xc460('0x1a')]||null:null,'attributes':_0x52374d[_0xc460('0x18')]?_0x52374d['options'][_0xc460('0x1b')]||null:null,'limit':_0x52374d['options']?_0x52374d[_0xc460('0x18')][_0xc460('0x1c')]||null:null,'include':_0x52374d['options']?_0x52374d['options']['include']?_[_0xc460('0x1d')](_0x52374d[_0xc460('0x18')][_0xc460('0x1e')],function(_0x56e4f4){return{'model':db[_0x56e4f4['model']],'as':_0x56e4f4['as'],'attributes':_0x56e4f4[_0xc460('0x1b')],'include':_0x56e4f4[_0xc460('0x1e')]?_[_0xc460('0x1d')](_0x56e4f4['include'],function(_0x501bab){return{'model':db[_0x501bab[_0xc460('0x1f')]],'as':_0x501bab['as'],'attributes':_0x501bab[_0xc460('0x1b')],'include':_0x501bab['include']?_['map'](_0x501bab[_0xc460('0x1e')],function(_0x291185){return{'model':db[_0x291185['model']],'as':_0x291185['as'],'attributes':_0x291185[_0xc460('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc460('0xc')](function(_0x558c76){logger['info'](_0xc460('0x15'),_0x52374d);logger[_0xc460('0x20')](_0xc460('0x15'),_0x52374d,JSON['stringify'](_0x558c76));_0x3c459a(_0x558c76);})[_0xc460('0x14')](function(_0x30cfe0){logger['error'](_0xc460('0x15'),_0x30cfe0[_0xc460('0x12')],_0x52374d);_0x1e5a3a(_0x4ebe1f[_0xc460('0x10')](0x1f4,_0x30cfe0[_0xc460('0x12')]));});});};exports[_0xc460('0x21')]=function(_0x24824f){var _0x2d0a1b=this;return new Promise(function(_0x32ec80,_0x49f1ad){return db[_0xc460('0x16')][_0xc460('0x22')]({'raw':_0x24824f[_0xc460('0x18')]?_0x24824f[_0xc460('0x18')][_0xc460('0x19')]===undefined?!![]:![]:!![],'where':_0x24824f['options']?_0x24824f[_0xc460('0x18')]['where']||null:null,'attributes':_0x24824f[_0xc460('0x18')]?_0x24824f[_0xc460('0x18')]['attributes']||null:null,'include':_0x24824f['options']?_0x24824f['options'][_0xc460('0x1e')]?_[_0xc460('0x1d')](_0x24824f[_0xc460('0x18')][_0xc460('0x1e')],function(_0x35ea3d){return{'model':db[_0x35ea3d['model']],'as':_0x35ea3d['as'],'attributes':_0x35ea3d[_0xc460('0x1b')],'include':_0x35ea3d[_0xc460('0x1e')]?_[_0xc460('0x1d')](_0x35ea3d['include'],function(_0xa7ac9d){return{'model':db[_0xa7ac9d[_0xc460('0x1f')]],'as':_0xa7ac9d['as'],'attributes':_0xa7ac9d[_0xc460('0x1b')],'include':_0xa7ac9d[_0xc460('0x1e')]?_[_0xc460('0x1d')](_0xa7ac9d[_0xc460('0x1e')],function(_0x4f5d86){return{'model':db[_0x4f5d86['model']],'as':_0x4f5d86['as'],'attributes':_0x4f5d86[_0xc460('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc460('0xc')](function(_0x4faccb){logger[_0xc460('0xd')](_0xc460('0x21'),_0x24824f);logger[_0xc460('0x20')]('ShowFreshdeskAccount',_0x24824f,JSON['stringify'](_0x4faccb));_0x32ec80(_0x4faccb);})[_0xc460('0x14')](function(_0x41d75c){logger[_0xc460('0x10')](_0xc460('0x21'),_0x41d75c['message'],_0x24824f);_0x49f1ad(_0x2d0a1b['error'](0x1f4,_0x41d75c[_0xc460('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index f2aa5f7..be1f0b5 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 _0x3bd2=['/:id/subjects','getSubjects','get','getDescriptions','/:id/tags','getTags','post','create','setTags','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3bd2,0x1bc));var _0x23bd=function(_0x40fd35,_0x411c14){_0x40fd35=_0x40fd35-0x0;var _0x57f52e=_0x3bd2[_0x40fd35];return _0x57f52e;};'use strict';var multer=require(_0x23bd('0x0'));var util=require(_0x23bd('0x1'));var path=require(_0x23bd('0x2'));var timeout=require(_0x23bd('0x3'));var express=require('express');var router=express[_0x23bd('0x4')]();var fs_extra=require(_0x23bd('0x5'));var auth=require(_0x23bd('0x6'));var interaction=require(_0x23bd('0x7'));var config=require(_0x23bd('0x8'));var controller=require(_0x23bd('0x9'));router['get']('/',auth[_0x23bd('0xa')](),controller[_0x23bd('0xb')]);router['get'](_0x23bd('0xc'),auth[_0x23bd('0xa')](),controller[_0x23bd('0xd')]);router['get'](_0x23bd('0xe'),auth[_0x23bd('0xa')](),controller['getFields']);router['get'](_0x23bd('0xf'),auth[_0x23bd('0xa')](),controller[_0x23bd('0x10')]);router[_0x23bd('0x11')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x23bd('0x12')]);router[_0x23bd('0x11')](_0x23bd('0x13'),auth[_0x23bd('0xa')](),controller[_0x23bd('0x14')]);router[_0x23bd('0x15')]('/',auth[_0x23bd('0xa')](),controller[_0x23bd('0x16')]);router[_0x23bd('0x15')](_0x23bd('0x13'),auth[_0x23bd('0xa')](),controller[_0x23bd('0x17')]);router['put'](_0x23bd('0xc'),auth[_0x23bd('0xa')](),controller[_0x23bd('0x18')]);router[_0x23bd('0x19')](_0x23bd('0xc'),auth[_0x23bd('0xa')](),controller['destroy']);module[_0x23bd('0x1a')]=router; \ No newline at end of file +var _0x423f=['put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags'];(function(_0x5ea2b1,_0x50f848){var _0x1773c0=function(_0x47bc96){while(--_0x47bc96){_0x5ea2b1['push'](_0x5ea2b1['shift']());}};_0x1773c0(++_0x50f848);}(_0x423f,0x126));var _0xf423=function(_0x1a8aef,_0x57fc60){_0x1a8aef=_0x1a8aef-0x0;var _0x460823=_0x423f[_0x1a8aef];return _0x460823;};'use strict';var multer=require(_0xf423('0x0'));var util=require('util');var path=require(_0xf423('0x1'));var timeout=require(_0xf423('0x2'));var express=require(_0xf423('0x3'));var router=express[_0xf423('0x4')]();var fs_extra=require(_0xf423('0x5'));var auth=require(_0xf423('0x6'));var interaction=require(_0xf423('0x7'));var config=require(_0xf423('0x8'));var controller=require(_0xf423('0x9'));router[_0xf423('0xa')]('/',auth[_0xf423('0xb')](),controller[_0xf423('0xc')]);router[_0xf423('0xa')](_0xf423('0xd'),auth[_0xf423('0xb')](),controller[_0xf423('0xe')]);router['get']('/:id/fields',auth[_0xf423('0xb')](),controller[_0xf423('0xf')]);router['get'](_0xf423('0x10'),auth[_0xf423('0xb')](),controller[_0xf423('0x11')]);router[_0xf423('0xa')](_0xf423('0x12'),auth[_0xf423('0xb')](),controller[_0xf423('0x13')]);router[_0xf423('0xa')](_0xf423('0x14'),auth[_0xf423('0xb')](),controller[_0xf423('0x15')]);router[_0xf423('0x16')]('/',auth[_0xf423('0xb')](),controller[_0xf423('0x17')]);router[_0xf423('0x16')](_0xf423('0x14'),auth[_0xf423('0xb')](),controller[_0xf423('0x18')]);router[_0xf423('0x19')](_0xf423('0xd'),auth['isAuthenticated'](),controller[_0xf423('0x1a')]);router['delete'](_0xf423('0xd'),auth['isAuthenticated'](),controller[_0xf423('0x1b')]);module[_0xf423('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index c87be15..a961690 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 _0xcd3e=['STRING','sequelize','exports'];(function(_0x309903,_0x5c4bed){var _0x457052=function(_0x481aae){while(--_0x481aae){_0x309903['push'](_0x309903['shift']());}};_0x457052(++_0x5c4bed);}(_0xcd3e,0x1e7));var _0xecd3=function(_0x274638,_0x578968){_0x274638=_0x274638-0x0;var _0x5755df=_0xcd3e[_0x274638];return _0x5755df;};'use strict';var Sequelize=require(_0xecd3('0x0'));module[_0xecd3('0x1')]={'name':{'type':Sequelize[_0xecd3('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1c9f=['exports','STRING'];(function(_0x2697a8,_0x17a759){var _0x122793=function(_0x59b946){while(--_0x59b946){_0x2697a8['push'](_0x2697a8['shift']());}};_0x122793(++_0x17a759);}(_0x1c9f,0xd8));var _0xf1c9=function(_0x11306c,_0x3ae1e3){_0x11306c=_0x11306c-0x0;var _0x4dd4c8=_0x1c9f[_0x11306c];return _0x4dd4c8;};'use strict';var Sequelize=require('sequelize');module[_0xf1c9('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf1c9('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 1a4491f..cb4c132 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 _0x3f26=['sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','rows','catch','params','length','find','create','body','destroy','getFields','findOne','FreshdeskField','pick','hasOwnProperty','getSubjects','getDescriptions','Tag','getTags','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x1cd23d,_0xec4ea5){var _0x5e8ad5=function(_0x1603d8){while(--_0x1603d8){_0x1cd23d['push'](_0x1cd23d['shift']());}};_0x5e8ad5(++_0xec4ea5);}(_0x3f26,0x132));var _0x63f2=function(_0x2cc509,_0x331f57){_0x2cc509=_0x2cc509-0x0;var _0x2e66f6=_0x3f26[_0x2cc509];return _0x2e66f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x63f2('0x0'));var zipdir=require(_0x63f2('0x1'));var jsonpatch=require(_0x63f2('0x2'));var rp=require('request-promise');var moment=require(_0x63f2('0x3'));var BPromise=require(_0x63f2('0x4'));var Mustache=require(_0x63f2('0x5'));var util=require('util');var path=require('path');var sox=require(_0x63f2('0x6'));var csv=require(_0x63f2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x63f2('0x8'));var _=require(_0x63f2('0x9'));var squel=require(_0x63f2('0xa'));var crypto=require('crypto');var jsforce=require(_0x63f2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x63f2('0x7'));var querystring=require('querystring');var Papa=require(_0x63f2('0xc'));var Redis=require(_0x63f2('0xd'));var authService=require(_0x63f2('0xe'));var qs=require(_0x63f2('0xf'));var as=require(_0x63f2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x63f2('0x11'));var utils=require(_0x63f2('0x12'));var config=require(_0x63f2('0x13'));var licenseUtil=require(_0x63f2('0x14'));var db=require(_0x63f2('0x15'))['db'];function respondWithStatusCode(_0x416d0b,_0x671360){_0x671360=_0x671360||0xcc;return function(_0x2e819a){if(_0x2e819a){return _0x416d0b[_0x63f2('0x16')](_0x671360);}return _0x416d0b[_0x63f2('0x17')](_0x671360)['end']();};}function respondWithResult(_0xe86b2d,_0x100d5e){_0x100d5e=_0x100d5e||0xc8;return function(_0x495122){if(_0x495122){return _0xe86b2d[_0x63f2('0x17')](_0x100d5e)[_0x63f2('0x18')](_0x495122);}};}function respondWithFilteredResult(_0x11bf17,_0xeda160){return function(_0x5e592d){if(_0x5e592d){var _0x36e7f4=typeof _0xeda160[_0x63f2('0x19')]==='undefined'&&typeof _0xeda160['limit']===_0x63f2('0x1a');var _0x4a27b9=_0x5e592d[_0x63f2('0x1b')];var _0x549831=_0x36e7f4?0x0:_0xeda160['offset'];var _0x40a610=_0x36e7f4?_0x5e592d[_0x63f2('0x1b')]:_0xeda160[_0x63f2('0x19')]+_0xeda160[_0x63f2('0x1c')];var _0x3c6b5d;if(_0x40a610>=_0x4a27b9){_0x40a610=_0x4a27b9;_0x3c6b5d=0xc8;}else{_0x3c6b5d=0xce;}_0x11bf17[_0x63f2('0x17')](_0x3c6b5d);return _0x11bf17['set'](_0x63f2('0x1d'),_0x549831+'-'+_0x40a610+'/'+_0x4a27b9)[_0x63f2('0x18')](_0x5e592d);}return null;};}function patchUpdates(_0x82854d){return function(_0x27ff9a){try{jsonpatch['apply'](_0x27ff9a,_0x82854d,!![]);}catch(_0x9e51e1){return BPromise[_0x63f2('0x1e')](_0x9e51e1);}return _0x27ff9a[_0x63f2('0x1f')]();};}function saveUpdates(_0x1b1b73,_0x176418){return function(_0x34cd26){if(_0x34cd26){return _0x34cd26[_0x63f2('0x20')](_0x1b1b73)[_0x63f2('0x21')](function(_0x53f319){return _0x53f319;});}return null;};}function removeEntity(_0x2a744e,_0x1b8012){return function(_0xdc510f){if(_0xdc510f){return _0xdc510f['destroy']()['then'](function(){_0x2a744e[_0x63f2('0x17')](0xcc)[_0x63f2('0x22')]();});}};}function handleEntityNotFound(_0x57d3f8,_0x392ecb){return function(_0x2e70dc){if(!_0x2e70dc){_0x57d3f8[_0x63f2('0x16')](0x194);}return _0x2e70dc;};}function handleError(_0x64bcec,_0x3aeb2f){_0x3aeb2f=_0x3aeb2f||0x1f4;return function(_0x11ea88){logger[_0x63f2('0x23')](_0x11ea88[_0x63f2('0x24')]);if(_0x11ea88[_0x63f2('0x25')]){delete _0x11ea88[_0x63f2('0x25')];}_0x64bcec[_0x63f2('0x17')](_0x3aeb2f)[_0x63f2('0x26')](_0x11ea88);};}exports[_0x63f2('0x27')]=function(_0x1b2efb,_0x27c9f6){var _0xc5891b={},_0x57b34e={},_0x2795b8={'count':0x0,'rows':[]};var _0x1a3b59=_[_0x63f2('0x28')](db[_0x63f2('0x29')][_0x63f2('0x2a')],function(_0x37e1fb){return{'name':_0x37e1fb['fieldName'],'type':_0x37e1fb[_0x63f2('0x2b')][_0x63f2('0x2c')]};});_0x57b34e[_0x63f2('0x2d')]=_[_0x63f2('0x28')](_0x1a3b59,_0x63f2('0x25'));_0x57b34e[_0x63f2('0x2e')]=_[_0x63f2('0x2f')](_0x1b2efb['query']);_0x57b34e['filters']=_[_0x63f2('0x30')](_0x57b34e['model'],_0x57b34e[_0x63f2('0x2e')]);_0xc5891b[_0x63f2('0x31')]=_[_0x63f2('0x30')](_0x57b34e[_0x63f2('0x2d')],qs[_0x63f2('0x32')](_0x1b2efb['query'][_0x63f2('0x32')]));_0xc5891b[_0x63f2('0x31')]=_0xc5891b[_0x63f2('0x31')]['length']?_0xc5891b['attributes']:_0x57b34e[_0x63f2('0x2d')];if(!_0x1b2efb[_0x63f2('0x2e')]['hasOwnProperty'](_0x63f2('0x33'))){_0xc5891b[_0x63f2('0x1c')]=qs[_0x63f2('0x1c')](_0x1b2efb['query']['limit']);_0xc5891b[_0x63f2('0x19')]=qs[_0x63f2('0x19')](_0x1b2efb[_0x63f2('0x2e')][_0x63f2('0x19')]);}_0xc5891b[_0x63f2('0x34')]=qs['sort'](_0x1b2efb[_0x63f2('0x2e')][_0x63f2('0x35')]);_0xc5891b[_0x63f2('0x36')]=qs[_0x63f2('0x37')](_['pick'](_0x1b2efb[_0x63f2('0x2e')],_0x57b34e[_0x63f2('0x37')]),_0x1a3b59);if(_0x1b2efb[_0x63f2('0x2e')]['filter']){_0xc5891b[_0x63f2('0x36')]=_['merge'](_0xc5891b[_0x63f2('0x36')],{'$or':_[_0x63f2('0x28')](_0x1a3b59,function(_0x5e4fad){if(_0x5e4fad[_0x63f2('0x2b')]!=='VIRTUAL'){var _0x20062b={};_0x20062b[_0x5e4fad[_0x63f2('0x25')]]={'$like':'%'+_0x1b2efb['query'][_0x63f2('0x38')]+'%'};return _0x20062b;}})});}_0xc5891b=_[_0x63f2('0x39')]({},_0xc5891b,_0x1b2efb[_0x63f2('0x3a')]);var _0x2f3eb6={'where':_0xc5891b[_0x63f2('0x36')]};return db[_0x63f2('0x29')][_0x63f2('0x1b')](_0x2f3eb6)[_0x63f2('0x21')](function(_0x5c5bfa){_0x2795b8[_0x63f2('0x1b')]=_0x5c5bfa;if(_0x1b2efb[_0x63f2('0x2e')][_0x63f2('0x3b')]){_0xc5891b[_0x63f2('0x3c')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0xc5891b);})[_0x63f2('0x21')](function(_0x2306eb){_0x2795b8[_0x63f2('0x3d')]=_0x2306eb;return _0x2795b8;})[_0x63f2('0x21')](respondWithFilteredResult(_0x27c9f6,_0xc5891b))[_0x63f2('0x3e')](handleError(_0x27c9f6,null));};exports['show']=function(_0x251902,_0x545432){var _0x2b59db={'raw':![],'where':{'id':_0x251902[_0x63f2('0x3f')]['id']}},_0x26227c={};_0x26227c['model']=_['keys'](db[_0x63f2('0x29')][_0x63f2('0x2a')]);_0x26227c[_0x63f2('0x2e')]=_['keys'](_0x251902[_0x63f2('0x2e')]);_0x26227c[_0x63f2('0x37')]=_[_0x63f2('0x30')](_0x26227c['model'],_0x26227c[_0x63f2('0x2e')]);_0x2b59db[_0x63f2('0x31')]=_[_0x63f2('0x30')](_0x26227c[_0x63f2('0x2d')],qs[_0x63f2('0x32')](_0x251902[_0x63f2('0x2e')][_0x63f2('0x32')]));_0x2b59db['attributes']=_0x2b59db[_0x63f2('0x31')][_0x63f2('0x40')]?_0x2b59db['attributes']:_0x26227c[_0x63f2('0x2d')];if(_0x251902['query'][_0x63f2('0x3b')]){_0x2b59db[_0x63f2('0x3c')]=[{'all':!![]}];}_0x2b59db=_[_0x63f2('0x39')]({},_0x2b59db,_0x251902[_0x63f2('0x3a')]);return db[_0x63f2('0x29')][_0x63f2('0x41')](_0x2b59db)['then'](handleEntityNotFound(_0x545432,null))[_0x63f2('0x21')](respondWithResult(_0x545432,null))['catch'](handleError(_0x545432,null));};exports[_0x63f2('0x42')]=function(_0x11cd26,_0x4478cd){return db[_0x63f2('0x29')][_0x63f2('0x42')](_0x11cd26[_0x63f2('0x43')],{})[_0x63f2('0x21')](respondWithResult(_0x4478cd,0xc9))[_0x63f2('0x3e')](handleError(_0x4478cd,null));};exports[_0x63f2('0x20')]=function(_0x3c1300,_0x4759f7){if(_0x3c1300[_0x63f2('0x43')]['id']){delete _0x3c1300[_0x63f2('0x43')]['id'];}return db[_0x63f2('0x29')][_0x63f2('0x41')]({'where':{'id':_0x3c1300[_0x63f2('0x3f')]['id']}})[_0x63f2('0x21')](handleEntityNotFound(_0x4759f7,null))['then'](saveUpdates(_0x3c1300[_0x63f2('0x43')],null))[_0x63f2('0x21')](respondWithResult(_0x4759f7,null))[_0x63f2('0x3e')](handleError(_0x4759f7,null));};exports[_0x63f2('0x44')]=function(_0xea45d1,_0x52fba6){return db[_0x63f2('0x29')][_0x63f2('0x41')]({'where':{'id':_0xea45d1[_0x63f2('0x3f')]['id']}})[_0x63f2('0x21')](handleEntityNotFound(_0x52fba6,null))[_0x63f2('0x21')](removeEntity(_0x52fba6,null))['catch'](handleError(_0x52fba6,null));};exports[_0x63f2('0x45')]=function(_0xb99134,_0x4ccf6f,_0x127dac){var _0x40d4c1={};var _0x5eeba3={};var _0x4f962a;var _0x252647;return db['FreshdeskConfiguration'][_0x63f2('0x46')]({'where':{'id':_0xb99134[_0x63f2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4ccf6f,null))[_0x63f2('0x21')](function(_0x4662c7){if(_0x4662c7){_0x4f962a=_0x4662c7;_0x5eeba3[_0x63f2('0x2d')]=_[_0x63f2('0x2f')](db[_0x63f2('0x47')]['rawAttributes']);_0x5eeba3['query']=_[_0x63f2('0x2f')](_0xb99134['query']);_0x5eeba3[_0x63f2('0x37')]=_[_0x63f2('0x30')](_0x5eeba3[_0x63f2('0x2d')],_0x5eeba3[_0x63f2('0x2e')]);_0x40d4c1['attributes']=_[_0x63f2('0x30')](_0x5eeba3[_0x63f2('0x2d')],qs['fields'](_0xb99134[_0x63f2('0x2e')][_0x63f2('0x32')]));_0x40d4c1[_0x63f2('0x31')]=_0x40d4c1['attributes']['length']?_0x40d4c1[_0x63f2('0x31')]:_0x5eeba3[_0x63f2('0x2d')];_0x40d4c1[_0x63f2('0x34')]=qs['sort'](_0xb99134[_0x63f2('0x2e')][_0x63f2('0x35')]);_0x40d4c1['where']=qs[_0x63f2('0x37')](_[_0x63f2('0x48')](_0xb99134['query'],_0x5eeba3[_0x63f2('0x37')]));if(_0xb99134[_0x63f2('0x2e')][_0x63f2('0x38')]){_0x40d4c1['where']=_[_0x63f2('0x39')](_0x40d4c1[_0x63f2('0x36')],{'$or':_['map'](_0x40d4c1[_0x63f2('0x31')],function(_0x503876){var _0x4c6f54={};_0x4c6f54[_0x503876]={'$like':'%'+_0xb99134[_0x63f2('0x2e')]['filter']+'%'};return _0x4c6f54;})});}_0x40d4c1=_[_0x63f2('0x39')]({},_0x40d4c1,_0xb99134[_0x63f2('0x3a')]);return _0x4f962a[_0x63f2('0x45')](_0x40d4c1);}})[_0x63f2('0x21')](function(_0x290bce){if(_0x290bce){_0x252647=_0x290bce[_0x63f2('0x40')];if(!_0xb99134[_0x63f2('0x2e')][_0x63f2('0x49')]('nolimit')){_0x40d4c1[_0x63f2('0x1c')]=qs[_0x63f2('0x1c')](_0xb99134[_0x63f2('0x2e')][_0x63f2('0x1c')]);_0x40d4c1[_0x63f2('0x19')]=qs[_0x63f2('0x19')](_0xb99134['query'][_0x63f2('0x19')]);}return _0x4f962a[_0x63f2('0x45')](_0x40d4c1);}})[_0x63f2('0x21')](function(_0x4aed96){if(_0x4aed96){return _0x4aed96?{'count':_0x252647,'rows':_0x4aed96}:null;}})[_0x63f2('0x21')](respondWithResult(_0x4ccf6f,null))[_0x63f2('0x3e')](handleError(_0x4ccf6f,null));};exports[_0x63f2('0x4a')]=function(_0x4bf7e5,_0x143c71,_0x34359c){var _0x4a97b7={};var _0x156cf0={};var _0x45007d;var _0x204b30;return db[_0x63f2('0x29')][_0x63f2('0x46')]({'where':{'id':_0x4bf7e5[_0x63f2('0x3f')]['id']}})[_0x63f2('0x21')](handleEntityNotFound(_0x143c71,null))[_0x63f2('0x21')](function(_0x3af1ab){if(_0x3af1ab){_0x45007d=_0x3af1ab;_0x156cf0[_0x63f2('0x2d')]=_[_0x63f2('0x2f')](db['FreshdeskField'][_0x63f2('0x2a')]);_0x156cf0['query']=_[_0x63f2('0x2f')](_0x4bf7e5['query']);_0x156cf0[_0x63f2('0x37')]=_[_0x63f2('0x30')](_0x156cf0[_0x63f2('0x2d')],_0x156cf0[_0x63f2('0x2e')]);_0x4a97b7[_0x63f2('0x31')]=_[_0x63f2('0x30')](_0x156cf0[_0x63f2('0x2d')],qs['fields'](_0x4bf7e5[_0x63f2('0x2e')]['fields']));_0x4a97b7[_0x63f2('0x31')]=_0x4a97b7[_0x63f2('0x31')]['length']?_0x4a97b7['attributes']:_0x156cf0[_0x63f2('0x2d')];_0x4a97b7['order']=qs['sort'](_0x4bf7e5[_0x63f2('0x2e')][_0x63f2('0x35')]);_0x4a97b7[_0x63f2('0x36')]=qs[_0x63f2('0x37')](_['pick'](_0x4bf7e5['query'],_0x156cf0[_0x63f2('0x37')]));if(_0x4bf7e5[_0x63f2('0x2e')][_0x63f2('0x38')]){_0x4a97b7['where']=_[_0x63f2('0x39')](_0x4a97b7['where'],{'$or':_[_0x63f2('0x28')](_0x4a97b7[_0x63f2('0x31')],function(_0x52533b){var _0x873dcf={};_0x873dcf[_0x52533b]={'$like':'%'+_0x4bf7e5['query'][_0x63f2('0x38')]+'%'};return _0x873dcf;})});}_0x4a97b7=_['merge']({},_0x4a97b7,_0x4bf7e5[_0x63f2('0x3a')]);return _0x45007d[_0x63f2('0x4a')](_0x4a97b7);}})['then'](function(_0x34181c){if(_0x34181c){_0x204b30=_0x34181c[_0x63f2('0x40')];if(!_0x4bf7e5[_0x63f2('0x2e')][_0x63f2('0x49')](_0x63f2('0x33'))){_0x4a97b7['limit']=qs[_0x63f2('0x1c')](_0x4bf7e5['query']['limit']);_0x4a97b7[_0x63f2('0x19')]=qs[_0x63f2('0x19')](_0x4bf7e5[_0x63f2('0x2e')][_0x63f2('0x19')]);}return _0x45007d['getSubjects'](_0x4a97b7);}})[_0x63f2('0x21')](function(_0x2f17b0){if(_0x2f17b0){return _0x2f17b0?{'count':_0x204b30,'rows':_0x2f17b0}:null;}})['then'](respondWithResult(_0x143c71,null))[_0x63f2('0x3e')](handleError(_0x143c71,null));};exports['getDescriptions']=function(_0x31ee52,_0x426159,_0x500d98){var _0x12b0d8={};var _0x5e2483={};var _0x355db7;var _0x5b0c21;return db[_0x63f2('0x29')]['findOne']({'where':{'id':_0x31ee52[_0x63f2('0x3f')]['id']}})[_0x63f2('0x21')](handleEntityNotFound(_0x426159,null))[_0x63f2('0x21')](function(_0x553403){if(_0x553403){_0x355db7=_0x553403;_0x5e2483[_0x63f2('0x2d')]=_['keys'](db[_0x63f2('0x47')][_0x63f2('0x2a')]);_0x5e2483['query']=_[_0x63f2('0x2f')](_0x31ee52[_0x63f2('0x2e')]);_0x5e2483[_0x63f2('0x37')]=_['intersection'](_0x5e2483['model'],_0x5e2483[_0x63f2('0x2e')]);_0x12b0d8['attributes']=_[_0x63f2('0x30')](_0x5e2483[_0x63f2('0x2d')],qs[_0x63f2('0x32')](_0x31ee52['query'][_0x63f2('0x32')]));_0x12b0d8['attributes']=_0x12b0d8['attributes'][_0x63f2('0x40')]?_0x12b0d8[_0x63f2('0x31')]:_0x5e2483[_0x63f2('0x2d')];_0x12b0d8[_0x63f2('0x34')]=qs[_0x63f2('0x35')](_0x31ee52[_0x63f2('0x2e')]['sort']);_0x12b0d8[_0x63f2('0x36')]=qs[_0x63f2('0x37')](_[_0x63f2('0x48')](_0x31ee52['query'],_0x5e2483['filters']));if(_0x31ee52[_0x63f2('0x2e')][_0x63f2('0x38')]){_0x12b0d8['where']=_[_0x63f2('0x39')](_0x12b0d8[_0x63f2('0x36')],{'$or':_['map'](_0x12b0d8['attributes'],function(_0xaaedf){var _0x2afa83={};_0x2afa83[_0xaaedf]={'$like':'%'+_0x31ee52[_0x63f2('0x2e')][_0x63f2('0x38')]+'%'};return _0x2afa83;})});}_0x12b0d8=_['merge']({},_0x12b0d8,_0x31ee52[_0x63f2('0x3a')]);return _0x355db7[_0x63f2('0x4b')](_0x12b0d8);}})[_0x63f2('0x21')](function(_0x2abf9a){if(_0x2abf9a){_0x5b0c21=_0x2abf9a['length'];if(!_0x31ee52['query'][_0x63f2('0x49')](_0x63f2('0x33'))){_0x12b0d8['limit']=qs[_0x63f2('0x1c')](_0x31ee52[_0x63f2('0x2e')][_0x63f2('0x1c')]);_0x12b0d8['offset']=qs[_0x63f2('0x19')](_0x31ee52['query']['offset']);}return _0x355db7[_0x63f2('0x4b')](_0x12b0d8);}})[_0x63f2('0x21')](function(_0x573dbf){if(_0x573dbf){return _0x573dbf?{'count':_0x5b0c21,'rows':_0x573dbf}:null;}})[_0x63f2('0x21')](respondWithResult(_0x426159,null))[_0x63f2('0x3e')](handleError(_0x426159,null));};exports['getTags']=function(_0xc902e9,_0x466210,_0x5d9b92){var _0x5dc09d={};var _0x559b43={};var _0x2a89b9;var _0x5026ef;return db[_0x63f2('0x29')][_0x63f2('0x46')]({'where':{'id':_0xc902e9['params']['id']}})[_0x63f2('0x21')](handleEntityNotFound(_0x466210,null))['then'](function(_0x24f4dc){if(_0x24f4dc){_0x2a89b9=_0x24f4dc;_0x559b43['model']=_[_0x63f2('0x2f')](db[_0x63f2('0x4c')][_0x63f2('0x2a')]);_0x559b43[_0x63f2('0x2e')]=_[_0x63f2('0x2f')](_0xc902e9[_0x63f2('0x2e')]);_0x559b43[_0x63f2('0x37')]=_[_0x63f2('0x30')](_0x559b43['model'],_0x559b43[_0x63f2('0x2e')]);_0x5dc09d[_0x63f2('0x31')]=_['intersection'](_0x559b43['model'],qs[_0x63f2('0x32')](_0xc902e9['query']['fields']));_0x5dc09d[_0x63f2('0x31')]=_0x5dc09d[_0x63f2('0x31')][_0x63f2('0x40')]?_0x5dc09d[_0x63f2('0x31')]:_0x559b43[_0x63f2('0x2d')];_0x5dc09d[_0x63f2('0x34')]=qs['sort'](_0xc902e9['query'][_0x63f2('0x35')]);_0x5dc09d['where']=qs['filters'](_[_0x63f2('0x48')](_0xc902e9['query'],_0x559b43[_0x63f2('0x37')]));if(_0xc902e9[_0x63f2('0x2e')][_0x63f2('0x38')]){_0x5dc09d[_0x63f2('0x36')]=_['merge'](_0x5dc09d[_0x63f2('0x36')],{'$or':_[_0x63f2('0x28')](_0x5dc09d['attributes'],function(_0x1855ff){var _0x55936b={};_0x55936b[_0x1855ff]={'$like':'%'+_0xc902e9[_0x63f2('0x2e')][_0x63f2('0x38')]+'%'};return _0x55936b;})});}_0x5dc09d=_[_0x63f2('0x39')]({},_0x5dc09d,_0xc902e9[_0x63f2('0x3a')]);return _0x2a89b9[_0x63f2('0x4d')](_0x5dc09d);}})['then'](function(_0x426c36){if(_0x426c36){_0x5026ef=_0x426c36[_0x63f2('0x40')];if(!_0xc902e9[_0x63f2('0x2e')][_0x63f2('0x49')]('nolimit')){_0x5dc09d[_0x63f2('0x1c')]=qs[_0x63f2('0x1c')](_0xc902e9[_0x63f2('0x2e')][_0x63f2('0x1c')]);_0x5dc09d[_0x63f2('0x19')]=qs[_0x63f2('0x19')](_0xc902e9[_0x63f2('0x2e')]['offset']);}return _0x2a89b9[_0x63f2('0x4d')](_0x5dc09d);}})[_0x63f2('0x21')](function(_0x40a2a1){if(_0x40a2a1){return _0x40a2a1?{'count':_0x5026ef,'rows':_0x40a2a1}:null;}})[_0x63f2('0x21')](respondWithResult(_0x466210,null))[_0x63f2('0x3e')](handleError(_0x466210,null));};exports['setTags']=function(_0x52aea5,_0x4b4500,_0x4cfd5f){if(_0x52aea5['body']['id']){delete _0x52aea5[_0x63f2('0x43')]['id'];}return db[_0x63f2('0x29')][_0x63f2('0x46')]({'where':{'id':_0x52aea5[_0x63f2('0x3f')]['id']}})[_0x63f2('0x21')](handleEntityNotFound(_0x4b4500,null))['then'](function(_0x3d4465){if(_0x3d4465){return _0x3d4465['setTags'](_0x52aea5[_0x63f2('0x43')]['ids']||[]);}return null;})['then'](respondWithResult(_0x4b4500,null))[_0x63f2('0x3e')](handleError(_0x4b4500,null));}; \ No newline at end of file +var _0x8f7f=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','sendStatus','error','stack','name','index','map','FreshdeskConfiguration','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','catch','show','find','create','body','params','getFields','findOne','FreshdeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x120564,_0x3c18cf){var _0x579980=function(_0x108c13){while(--_0x108c13){_0x120564['push'](_0x120564['shift']());}};_0x579980(++_0x3c18cf);}(_0x8f7f,0x141));var _0xf8f7=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x8f7f[_0x4a747d];return _0x3a5b5c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf8f7('0x0'));var zipdir=require(_0xf8f7('0x1'));var jsonpatch=require(_0xf8f7('0x2'));var rp=require('request-promise');var moment=require(_0xf8f7('0x3'));var BPromise=require(_0xf8f7('0x4'));var Mustache=require(_0xf8f7('0x5'));var util=require(_0xf8f7('0x6'));var path=require(_0xf8f7('0x7'));var sox=require(_0xf8f7('0x8'));var csv=require(_0xf8f7('0x9'));var ejs=require(_0xf8f7('0xa'));var fs=require('fs');var fs_extra=require(_0xf8f7('0xb'));var _=require(_0xf8f7('0xc'));var squel=require('squel');var crypto=require(_0xf8f7('0xd'));var jsforce=require(_0xf8f7('0xe'));var deskjs=require(_0xf8f7('0xf'));var toCsv=require(_0xf8f7('0x9'));var querystring=require(_0xf8f7('0x10'));var Papa=require(_0xf8f7('0x11'));var Redis=require(_0xf8f7('0x12'));var authService=require(_0xf8f7('0x13'));var qs=require(_0xf8f7('0x14'));var as=require(_0xf8f7('0x15'));var hardwareService=require(_0xf8f7('0x16'));var logger=require('../../config/logger')(_0xf8f7('0x17'));var utils=require('../../config/utils');var config=require(_0xf8f7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf8f7('0x19'))['db'];function respondWithStatusCode(_0xf20459,_0x37463b){_0x37463b=_0x37463b||0xcc;return function(_0x4129ca){if(_0x4129ca){return _0xf20459['sendStatus'](_0x37463b);}return _0xf20459[_0xf8f7('0x1a')](_0x37463b)[_0xf8f7('0x1b')]();};}function respondWithResult(_0x38fcaf,_0xfb3d7e){_0xfb3d7e=_0xfb3d7e||0xc8;return function(_0x53af90){if(_0x53af90){return _0x38fcaf[_0xf8f7('0x1a')](_0xfb3d7e)[_0xf8f7('0x1c')](_0x53af90);}};}function respondWithFilteredResult(_0x560cff,_0x2541d0){return function(_0x17865b){if(_0x17865b){var _0x1a2c1d=typeof _0x2541d0[_0xf8f7('0x1d')]===_0xf8f7('0x1e')&&typeof _0x2541d0[_0xf8f7('0x1f')]===_0xf8f7('0x1e');var _0x372413=_0x17865b[_0xf8f7('0x20')];var _0x1dd098=_0x1a2c1d?0x0:_0x2541d0[_0xf8f7('0x1d')];var _0xeb0d39=_0x1a2c1d?_0x17865b[_0xf8f7('0x20')]:_0x2541d0[_0xf8f7('0x1d')]+_0x2541d0['limit'];var _0x389395;if(_0xeb0d39>=_0x372413){_0xeb0d39=_0x372413;_0x389395=0xc8;}else{_0x389395=0xce;}_0x560cff[_0xf8f7('0x1a')](_0x389395);return _0x560cff['set'](_0xf8f7('0x21'),_0x1dd098+'-'+_0xeb0d39+'/'+_0x372413)[_0xf8f7('0x1c')](_0x17865b);}return null;};}function patchUpdates(_0x14d881){return function(_0x1e8413){try{jsonpatch[_0xf8f7('0x22')](_0x1e8413,_0x14d881,!![]);}catch(_0x262cd1){return BPromise[_0xf8f7('0x23')](_0x262cd1);}return _0x1e8413['save']();};}function saveUpdates(_0x509077,_0x4d83bc){return function(_0x338818){if(_0x338818){return _0x338818['update'](_0x509077)['then'](function(_0x2aa13f){return _0x2aa13f;});}return null;};}function removeEntity(_0x8f18b5,_0x21cf66){return function(_0xa7775c){if(_0xa7775c){return _0xa7775c[_0xf8f7('0x24')]()['then'](function(){_0x8f18b5[_0xf8f7('0x1a')](0xcc)[_0xf8f7('0x1b')]();});}};}function handleEntityNotFound(_0x5f1e09,_0x3d42fb){return function(_0x5a1adf){if(!_0x5a1adf){_0x5f1e09[_0xf8f7('0x25')](0x194);}return _0x5a1adf;};}function handleError(_0x4265ba,_0x25060d){_0x25060d=_0x25060d||0x1f4;return function(_0x1d2acd){logger[_0xf8f7('0x26')](_0x1d2acd[_0xf8f7('0x27')]);if(_0x1d2acd[_0xf8f7('0x28')]){delete _0x1d2acd[_0xf8f7('0x28')];}_0x4265ba[_0xf8f7('0x1a')](_0x25060d)['send'](_0x1d2acd);};}exports[_0xf8f7('0x29')]=function(_0x155eb5,_0x1e05ff){var _0x3de5fa={},_0x5b4809={},_0x4bc0ab={'count':0x0,'rows':[]};var _0x3cb61a=_[_0xf8f7('0x2a')](db[_0xf8f7('0x2b')][_0xf8f7('0x2c')],function(_0x43f17d){return{'name':_0x43f17d['fieldName'],'type':_0x43f17d[_0xf8f7('0x2d')][_0xf8f7('0x2e')]};});_0x5b4809[_0xf8f7('0x2f')]=_['map'](_0x3cb61a,_0xf8f7('0x28'));_0x5b4809['query']=_[_0xf8f7('0x30')](_0x155eb5['query']);_0x5b4809['filters']=_['intersection'](_0x5b4809['model'],_0x5b4809[_0xf8f7('0x31')]);_0x3de5fa[_0xf8f7('0x32')]=_[_0xf8f7('0x33')](_0x5b4809[_0xf8f7('0x2f')],qs[_0xf8f7('0x34')](_0x155eb5[_0xf8f7('0x31')][_0xf8f7('0x34')]));_0x3de5fa[_0xf8f7('0x32')]=_0x3de5fa[_0xf8f7('0x32')][_0xf8f7('0x35')]?_0x3de5fa[_0xf8f7('0x32')]:_0x5b4809['model'];if(!_0x155eb5[_0xf8f7('0x31')][_0xf8f7('0x36')]('nolimit')){_0x3de5fa[_0xf8f7('0x1f')]=qs[_0xf8f7('0x1f')](_0x155eb5['query'][_0xf8f7('0x1f')]);_0x3de5fa[_0xf8f7('0x1d')]=qs[_0xf8f7('0x1d')](_0x155eb5[_0xf8f7('0x31')][_0xf8f7('0x1d')]);}_0x3de5fa[_0xf8f7('0x37')]=qs['sort'](_0x155eb5['query'][_0xf8f7('0x38')]);_0x3de5fa['where']=qs[_0xf8f7('0x39')](_[_0xf8f7('0x3a')](_0x155eb5[_0xf8f7('0x31')],_0x5b4809[_0xf8f7('0x39')]),_0x3cb61a);if(_0x155eb5[_0xf8f7('0x31')][_0xf8f7('0x3b')]){_0x3de5fa['where']=_['merge'](_0x3de5fa[_0xf8f7('0x3c')],{'$or':_[_0xf8f7('0x2a')](_0x3cb61a,function(_0x5e7aba){if(_0x5e7aba[_0xf8f7('0x2d')]!==_0xf8f7('0x3d')){var _0x102cd1={};_0x102cd1[_0x5e7aba['name']]={'$like':'%'+_0x155eb5['query'][_0xf8f7('0x3b')]+'%'};return _0x102cd1;}})});}_0x3de5fa=_[_0xf8f7('0x3e')]({},_0x3de5fa,_0x155eb5[_0xf8f7('0x3f')]);var _0x3b3081={'where':_0x3de5fa[_0xf8f7('0x3c')]};return db[_0xf8f7('0x2b')]['count'](_0x3b3081)[_0xf8f7('0x40')](function(_0x97393a){_0x4bc0ab[_0xf8f7('0x20')]=_0x97393a;if(_0x155eb5[_0xf8f7('0x31')][_0xf8f7('0x41')]){_0x3de5fa[_0xf8f7('0x42')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xf8f7('0x43')](_0x3de5fa);})['then'](function(_0x2506ee){_0x4bc0ab[_0xf8f7('0x44')]=_0x2506ee;return _0x4bc0ab;})[_0xf8f7('0x40')](respondWithFilteredResult(_0x1e05ff,_0x3de5fa))[_0xf8f7('0x45')](handleError(_0x1e05ff,null));};exports[_0xf8f7('0x46')]=function(_0x20b385,_0x4135b7){var _0x3a2858={'raw':![],'where':{'id':_0x20b385['params']['id']}},_0x5444ee={};_0x5444ee[_0xf8f7('0x2f')]=_[_0xf8f7('0x30')](db[_0xf8f7('0x2b')][_0xf8f7('0x2c')]);_0x5444ee[_0xf8f7('0x31')]=_['keys'](_0x20b385[_0xf8f7('0x31')]);_0x5444ee[_0xf8f7('0x39')]=_['intersection'](_0x5444ee[_0xf8f7('0x2f')],_0x5444ee['query']);_0x3a2858[_0xf8f7('0x32')]=_['intersection'](_0x5444ee[_0xf8f7('0x2f')],qs[_0xf8f7('0x34')](_0x20b385[_0xf8f7('0x31')][_0xf8f7('0x34')]));_0x3a2858['attributes']=_0x3a2858[_0xf8f7('0x32')][_0xf8f7('0x35')]?_0x3a2858[_0xf8f7('0x32')]:_0x5444ee[_0xf8f7('0x2f')];if(_0x20b385[_0xf8f7('0x31')][_0xf8f7('0x41')]){_0x3a2858[_0xf8f7('0x42')]=[{'all':!![]}];}_0x3a2858=_[_0xf8f7('0x3e')]({},_0x3a2858,_0x20b385[_0xf8f7('0x3f')]);return db[_0xf8f7('0x2b')][_0xf8f7('0x47')](_0x3a2858)[_0xf8f7('0x40')](handleEntityNotFound(_0x4135b7,null))[_0xf8f7('0x40')](respondWithResult(_0x4135b7,null))[_0xf8f7('0x45')](handleError(_0x4135b7,null));};exports[_0xf8f7('0x48')]=function(_0x47b0fc,_0x586dad){return db[_0xf8f7('0x2b')][_0xf8f7('0x48')](_0x47b0fc[_0xf8f7('0x49')],{})[_0xf8f7('0x40')](respondWithResult(_0x586dad,0xc9))[_0xf8f7('0x45')](handleError(_0x586dad,null));};exports['update']=function(_0x4392eb,_0x5eedd2){if(_0x4392eb[_0xf8f7('0x49')]['id']){delete _0x4392eb['body']['id'];}return db[_0xf8f7('0x2b')][_0xf8f7('0x47')]({'where':{'id':_0x4392eb[_0xf8f7('0x4a')]['id']}})[_0xf8f7('0x40')](handleEntityNotFound(_0x5eedd2,null))[_0xf8f7('0x40')](saveUpdates(_0x4392eb['body'],null))['then'](respondWithResult(_0x5eedd2,null))[_0xf8f7('0x45')](handleError(_0x5eedd2,null));};exports[_0xf8f7('0x24')]=function(_0x49ada7,_0x8d3755){return db[_0xf8f7('0x2b')][_0xf8f7('0x47')]({'where':{'id':_0x49ada7['params']['id']}})[_0xf8f7('0x40')](handleEntityNotFound(_0x8d3755,null))[_0xf8f7('0x40')](removeEntity(_0x8d3755,null))['catch'](handleError(_0x8d3755,null));};exports[_0xf8f7('0x4b')]=function(_0x2ab3b5,_0x14e3bd,_0x4b58a7){var _0x379248={};var _0x5e670f={};var _0x49cc57;var _0x244320;return db[_0xf8f7('0x2b')][_0xf8f7('0x4c')]({'where':{'id':_0x2ab3b5['params']['id']}})[_0xf8f7('0x40')](handleEntityNotFound(_0x14e3bd,null))['then'](function(_0xa926d9){if(_0xa926d9){_0x49cc57=_0xa926d9;_0x5e670f[_0xf8f7('0x2f')]=_[_0xf8f7('0x30')](db[_0xf8f7('0x4d')][_0xf8f7('0x2c')]);_0x5e670f['query']=_[_0xf8f7('0x30')](_0x2ab3b5[_0xf8f7('0x31')]);_0x5e670f[_0xf8f7('0x39')]=_[_0xf8f7('0x33')](_0x5e670f[_0xf8f7('0x2f')],_0x5e670f[_0xf8f7('0x31')]);_0x379248[_0xf8f7('0x32')]=_[_0xf8f7('0x33')](_0x5e670f[_0xf8f7('0x2f')],qs[_0xf8f7('0x34')](_0x2ab3b5[_0xf8f7('0x31')][_0xf8f7('0x34')]));_0x379248[_0xf8f7('0x32')]=_0x379248[_0xf8f7('0x32')][_0xf8f7('0x35')]?_0x379248['attributes']:_0x5e670f[_0xf8f7('0x2f')];_0x379248[_0xf8f7('0x37')]=qs[_0xf8f7('0x38')](_0x2ab3b5[_0xf8f7('0x31')][_0xf8f7('0x38')]);_0x379248[_0xf8f7('0x3c')]=qs[_0xf8f7('0x39')](_['pick'](_0x2ab3b5[_0xf8f7('0x31')],_0x5e670f[_0xf8f7('0x39')]));if(_0x2ab3b5[_0xf8f7('0x31')][_0xf8f7('0x3b')]){_0x379248[_0xf8f7('0x3c')]=_[_0xf8f7('0x3e')](_0x379248[_0xf8f7('0x3c')],{'$or':_['map'](_0x379248[_0xf8f7('0x32')],function(_0x52e457){var _0xb06608={};_0xb06608[_0x52e457]={'$like':'%'+_0x2ab3b5[_0xf8f7('0x31')]['filter']+'%'};return _0xb06608;})});}_0x379248=_[_0xf8f7('0x3e')]({},_0x379248,_0x2ab3b5[_0xf8f7('0x3f')]);return _0x49cc57['getFields'](_0x379248);}})[_0xf8f7('0x40')](function(_0x5f51be){if(_0x5f51be){_0x244320=_0x5f51be[_0xf8f7('0x35')];if(!_0x2ab3b5['query'][_0xf8f7('0x36')](_0xf8f7('0x4e'))){_0x379248[_0xf8f7('0x1f')]=qs['limit'](_0x2ab3b5[_0xf8f7('0x31')]['limit']);_0x379248['offset']=qs[_0xf8f7('0x1d')](_0x2ab3b5[_0xf8f7('0x31')]['offset']);}return _0x49cc57['getFields'](_0x379248);}})[_0xf8f7('0x40')](function(_0x5ed8fa){if(_0x5ed8fa){return _0x5ed8fa?{'count':_0x244320,'rows':_0x5ed8fa}:null;}})[_0xf8f7('0x40')](respondWithResult(_0x14e3bd,null))[_0xf8f7('0x45')](handleError(_0x14e3bd,null));};exports[_0xf8f7('0x4f')]=function(_0x567fdc,_0x13c872,_0x41e9f2){var _0x1627f7={};var _0x6cf7ef={};var _0x4d3e65;var _0x1f0203;return db[_0xf8f7('0x2b')][_0xf8f7('0x4c')]({'where':{'id':_0x567fdc['params']['id']}})[_0xf8f7('0x40')](handleEntityNotFound(_0x13c872,null))[_0xf8f7('0x40')](function(_0xada9e4){if(_0xada9e4){_0x4d3e65=_0xada9e4;_0x6cf7ef[_0xf8f7('0x2f')]=_[_0xf8f7('0x30')](db[_0xf8f7('0x4d')][_0xf8f7('0x2c')]);_0x6cf7ef[_0xf8f7('0x31')]=_[_0xf8f7('0x30')](_0x567fdc['query']);_0x6cf7ef[_0xf8f7('0x39')]=_[_0xf8f7('0x33')](_0x6cf7ef['model'],_0x6cf7ef[_0xf8f7('0x31')]);_0x1627f7[_0xf8f7('0x32')]=_[_0xf8f7('0x33')](_0x6cf7ef[_0xf8f7('0x2f')],qs['fields'](_0x567fdc[_0xf8f7('0x31')][_0xf8f7('0x34')]));_0x1627f7[_0xf8f7('0x32')]=_0x1627f7[_0xf8f7('0x32')][_0xf8f7('0x35')]?_0x1627f7[_0xf8f7('0x32')]:_0x6cf7ef[_0xf8f7('0x2f')];_0x1627f7['order']=qs[_0xf8f7('0x38')](_0x567fdc['query'][_0xf8f7('0x38')]);_0x1627f7[_0xf8f7('0x3c')]=qs[_0xf8f7('0x39')](_['pick'](_0x567fdc['query'],_0x6cf7ef[_0xf8f7('0x39')]));if(_0x567fdc[_0xf8f7('0x31')]['filter']){_0x1627f7['where']=_[_0xf8f7('0x3e')](_0x1627f7[_0xf8f7('0x3c')],{'$or':_['map'](_0x1627f7[_0xf8f7('0x32')],function(_0x591868){var _0xdb0c74={};_0xdb0c74[_0x591868]={'$like':'%'+_0x567fdc[_0xf8f7('0x31')][_0xf8f7('0x3b')]+'%'};return _0xdb0c74;})});}_0x1627f7=_[_0xf8f7('0x3e')]({},_0x1627f7,_0x567fdc[_0xf8f7('0x3f')]);return _0x4d3e65['getSubjects'](_0x1627f7);}})[_0xf8f7('0x40')](function(_0xc946d){if(_0xc946d){_0x1f0203=_0xc946d[_0xf8f7('0x35')];if(!_0x567fdc[_0xf8f7('0x31')][_0xf8f7('0x36')](_0xf8f7('0x4e'))){_0x1627f7[_0xf8f7('0x1f')]=qs['limit'](_0x567fdc['query'][_0xf8f7('0x1f')]);_0x1627f7[_0xf8f7('0x1d')]=qs[_0xf8f7('0x1d')](_0x567fdc[_0xf8f7('0x31')][_0xf8f7('0x1d')]);}return _0x4d3e65[_0xf8f7('0x4f')](_0x1627f7);}})[_0xf8f7('0x40')](function(_0x57cc11){if(_0x57cc11){return _0x57cc11?{'count':_0x1f0203,'rows':_0x57cc11}:null;}})[_0xf8f7('0x40')](respondWithResult(_0x13c872,null))['catch'](handleError(_0x13c872,null));};exports[_0xf8f7('0x50')]=function(_0x279dca,_0x130c2c,_0x29358f){var _0x3003ab={};var _0x90bc16={};var _0x21f03f;var _0x542189;return db[_0xf8f7('0x2b')]['findOne']({'where':{'id':_0x279dca[_0xf8f7('0x4a')]['id']}})['then'](handleEntityNotFound(_0x130c2c,null))[_0xf8f7('0x40')](function(_0x5c9cba){if(_0x5c9cba){_0x21f03f=_0x5c9cba;_0x90bc16[_0xf8f7('0x2f')]=_[_0xf8f7('0x30')](db[_0xf8f7('0x4d')][_0xf8f7('0x2c')]);_0x90bc16[_0xf8f7('0x31')]=_['keys'](_0x279dca['query']);_0x90bc16[_0xf8f7('0x39')]=_['intersection'](_0x90bc16['model'],_0x90bc16[_0xf8f7('0x31')]);_0x3003ab[_0xf8f7('0x32')]=_[_0xf8f7('0x33')](_0x90bc16['model'],qs[_0xf8f7('0x34')](_0x279dca[_0xf8f7('0x31')][_0xf8f7('0x34')]));_0x3003ab[_0xf8f7('0x32')]=_0x3003ab[_0xf8f7('0x32')][_0xf8f7('0x35')]?_0x3003ab[_0xf8f7('0x32')]:_0x90bc16[_0xf8f7('0x2f')];_0x3003ab[_0xf8f7('0x37')]=qs[_0xf8f7('0x38')](_0x279dca[_0xf8f7('0x31')][_0xf8f7('0x38')]);_0x3003ab[_0xf8f7('0x3c')]=qs[_0xf8f7('0x39')](_[_0xf8f7('0x3a')](_0x279dca[_0xf8f7('0x31')],_0x90bc16['filters']));if(_0x279dca[_0xf8f7('0x31')][_0xf8f7('0x3b')]){_0x3003ab[_0xf8f7('0x3c')]=_[_0xf8f7('0x3e')](_0x3003ab[_0xf8f7('0x3c')],{'$or':_[_0xf8f7('0x2a')](_0x3003ab['attributes'],function(_0x1645d7){var _0x41e3eb={};_0x41e3eb[_0x1645d7]={'$like':'%'+_0x279dca[_0xf8f7('0x31')][_0xf8f7('0x3b')]+'%'};return _0x41e3eb;})});}_0x3003ab=_[_0xf8f7('0x3e')]({},_0x3003ab,_0x279dca[_0xf8f7('0x3f')]);return _0x21f03f[_0xf8f7('0x50')](_0x3003ab);}})[_0xf8f7('0x40')](function(_0x210a85){if(_0x210a85){_0x542189=_0x210a85['length'];if(!_0x279dca['query']['hasOwnProperty'](_0xf8f7('0x4e'))){_0x3003ab[_0xf8f7('0x1f')]=qs[_0xf8f7('0x1f')](_0x279dca[_0xf8f7('0x31')][_0xf8f7('0x1f')]);_0x3003ab[_0xf8f7('0x1d')]=qs['offset'](_0x279dca[_0xf8f7('0x31')]['offset']);}return _0x21f03f[_0xf8f7('0x50')](_0x3003ab);}})[_0xf8f7('0x40')](function(_0xbd28a3){if(_0xbd28a3){return _0xbd28a3?{'count':_0x542189,'rows':_0xbd28a3}:null;}})['then'](respondWithResult(_0x130c2c,null))[_0xf8f7('0x45')](handleError(_0x130c2c,null));};exports[_0xf8f7('0x51')]=function(_0x2a8d49,_0x42dcc4,_0x809705){var _0x47a1f3={};var _0x296690={};var _0x447e53;var _0x4db69a;return db[_0xf8f7('0x2b')]['findOne']({'where':{'id':_0x2a8d49[_0xf8f7('0x4a')]['id']}})[_0xf8f7('0x40')](handleEntityNotFound(_0x42dcc4,null))[_0xf8f7('0x40')](function(_0x19d1cb){if(_0x19d1cb){_0x447e53=_0x19d1cb;_0x296690['model']=_[_0xf8f7('0x30')](db[_0xf8f7('0x52')][_0xf8f7('0x2c')]);_0x296690[_0xf8f7('0x31')]=_[_0xf8f7('0x30')](_0x2a8d49[_0xf8f7('0x31')]);_0x296690[_0xf8f7('0x39')]=_['intersection'](_0x296690[_0xf8f7('0x2f')],_0x296690['query']);_0x47a1f3[_0xf8f7('0x32')]=_[_0xf8f7('0x33')](_0x296690[_0xf8f7('0x2f')],qs['fields'](_0x2a8d49[_0xf8f7('0x31')][_0xf8f7('0x34')]));_0x47a1f3['attributes']=_0x47a1f3['attributes'][_0xf8f7('0x35')]?_0x47a1f3[_0xf8f7('0x32')]:_0x296690[_0xf8f7('0x2f')];_0x47a1f3[_0xf8f7('0x37')]=qs['sort'](_0x2a8d49[_0xf8f7('0x31')][_0xf8f7('0x38')]);_0x47a1f3['where']=qs[_0xf8f7('0x39')](_[_0xf8f7('0x3a')](_0x2a8d49[_0xf8f7('0x31')],_0x296690[_0xf8f7('0x39')]));if(_0x2a8d49['query']['filter']){_0x47a1f3[_0xf8f7('0x3c')]=_[_0xf8f7('0x3e')](_0x47a1f3['where'],{'$or':_[_0xf8f7('0x2a')](_0x47a1f3[_0xf8f7('0x32')],function(_0x9a45af){var _0x410ea6={};_0x410ea6[_0x9a45af]={'$like':'%'+_0x2a8d49['query'][_0xf8f7('0x3b')]+'%'};return _0x410ea6;})});}_0x47a1f3=_[_0xf8f7('0x3e')]({},_0x47a1f3,_0x2a8d49['options']);return _0x447e53[_0xf8f7('0x51')](_0x47a1f3);}})[_0xf8f7('0x40')](function(_0x8a411a){if(_0x8a411a){_0x4db69a=_0x8a411a[_0xf8f7('0x35')];if(!_0x2a8d49[_0xf8f7('0x31')][_0xf8f7('0x36')](_0xf8f7('0x4e'))){_0x47a1f3[_0xf8f7('0x1f')]=qs[_0xf8f7('0x1f')](_0x2a8d49['query'][_0xf8f7('0x1f')]);_0x47a1f3[_0xf8f7('0x1d')]=qs[_0xf8f7('0x1d')](_0x2a8d49[_0xf8f7('0x31')]['offset']);}return _0x447e53['getTags'](_0x47a1f3);}})[_0xf8f7('0x40')](function(_0x57bffe){if(_0x57bffe){return _0x57bffe?{'count':_0x4db69a,'rows':_0x57bffe}:null;}})['then'](respondWithResult(_0x42dcc4,null))[_0xf8f7('0x45')](handleError(_0x42dcc4,null));};exports[_0xf8f7('0x53')]=function(_0x4f3bbb,_0x12ac89,_0x2676f6){if(_0x4f3bbb[_0xf8f7('0x49')]['id']){delete _0x4f3bbb['body']['id'];}return db[_0xf8f7('0x2b')][_0xf8f7('0x4c')]({'where':{'id':_0x4f3bbb['params']['id']}})[_0xf8f7('0x40')](handleEntityNotFound(_0x12ac89,null))['then'](function(_0x5b0134){if(_0x5b0134){return _0x5b0134[_0xf8f7('0x53')](_0x4f3bbb[_0xf8f7('0x49')][_0xf8f7('0x54')]||[]);}return null;})['then'](respondWithResult(_0x12ac89,null))['catch'](handleError(_0x12ac89,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index cfef543..272acbe 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 _0xcb8d=['int_freshdesk_configurations','util','api','moment','bluebird','request-promise','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration'];(function(_0x24ebbf,_0x4617ec){var _0x505722=function(_0x40e138){while(--_0x40e138){_0x24ebbf['push'](_0x24ebbf['shift']());}};_0x505722(++_0x4617ec);}(_0xcb8d,0x9b));var _0xdcb8=function(_0x1bd323,_0x1c16ab){_0x1bd323=_0x1bd323-0x0;var _0x13097b=_0xcb8d[_0x1bd323];return _0x13097b;};'use strict';var _=require('lodash');var util=require(_0xdcb8('0x0'));var logger=require('../../config/logger')(_0xdcb8('0x1'));var moment=require(_0xdcb8('0x2'));var BPromise=require(_0xdcb8('0x3'));var rp=require(_0xdcb8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdcb8('0x5'));var attributes=require(_0xdcb8('0x6'));module[_0xdcb8('0x7')]=function(_0x157208,_0x34a503){return _0x157208[_0xdcb8('0x8')](_0xdcb8('0x9'),attributes,{'tableName':_0xdcb8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5de8=['define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','moment','bluebird','path','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x7856c2,_0x1196e5){var _0x466fd0=function(_0x259208){while(--_0x259208){_0x7856c2['push'](_0x7856c2['shift']());}};_0x466fd0(++_0x1196e5);}(_0x5de8,0x163));var _0x85de=function(_0x2cc89a,_0x214c7a){_0x2cc89a=_0x2cc89a-0x0;var _0x7b185e=_0x5de8[_0x2cc89a];return _0x7b185e;};'use strict';var _=require(_0x85de('0x0'));var util=require('util');var logger=require(_0x85de('0x1'))('api');var moment=require(_0x85de('0x2'));var BPromise=require(_0x85de('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x85de('0x4'));var rimraf=require('rimraf');var config=require(_0x85de('0x5'));var attributes=require(_0x85de('0x6'));module[_0x85de('0x7')]=function(_0x4be2f0,_0x76a3bb){return _0x4be2f0[_0x85de('0x8')](_0x85de('0x9'),attributes,{'tableName':_0x85de('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index dae2283..b1c76a5 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 _0xd7a5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x529356,_0x2e38fc){var _0x317edb=function(_0x37786f){while(--_0x37786f){_0x529356['push'](_0x529356['shift']());}};_0x317edb(++_0x2e38fc);}(_0xd7a5,0x142));var _0x5d7a=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0xd7a5[_0x2b4448];return _0xb4b465;};'use strict';var _=require('lodash');var util=require(_0x5d7a('0x0'));var moment=require(_0x5d7a('0x1'));var BPromise=require(_0x5d7a('0x2'));var rs=require(_0x5d7a('0x3'));var fs=require('fs');var Redis=require(_0x5d7a('0x4'));var db=require(_0x5d7a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d7a('0x6'))(_0x5d7a('0x7'));var config=require(_0x5d7a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5d7a('0x9')][_0x5d7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1284bb,_0x1f82c1,_0x9d2dab){return new BPromise(function(_0x25e242,_0x38ad9d){return client[_0x5d7a('0xb')](_0x1284bb,_0x9d2dab)[_0x5d7a('0xc')](function(_0x34833c){logger[_0x5d7a('0xd')](_0x5d7a('0xe'),_0x1f82c1,'request\x20sent');logger[_0x5d7a('0xf')](_0x5d7a('0x10'),_0x1f82c1,_0x5d7a('0x11'),JSON[_0x5d7a('0x12')](_0x34833c));if(_0x34833c[_0x5d7a('0x13')]){if(_0x34833c[_0x5d7a('0x13')][_0x5d7a('0x14')]===0x1f4){logger[_0x5d7a('0x13')](_0x5d7a('0xe'),_0x1f82c1,_0x34833c[_0x5d7a('0x13')]['message']);return _0x38ad9d(_0x34833c[_0x5d7a('0x13')][_0x5d7a('0x15')]);}logger[_0x5d7a('0x13')](_0x5d7a('0xe'),_0x1f82c1,_0x34833c[_0x5d7a('0x13')][_0x5d7a('0x15')]);return _0x25e242(_0x34833c[_0x5d7a('0x13')][_0x5d7a('0x15')]);}else{logger[_0x5d7a('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1f82c1,_0x5d7a('0x11'));_0x25e242(_0x34833c[_0x5d7a('0x16')]['message']);}})['catch'](function(_0x45e808){logger['error'](_0x5d7a('0xe'),_0x1f82c1,_0x45e808);_0x38ad9d(_0x45e808);});});} \ No newline at end of file +var _0xf01a=['request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x5f24f2,_0x1c8846){var _0x82a9de=function(_0x19b2f1){while(--_0x19b2f1){_0x5f24f2['push'](_0x5f24f2['shift']());}};_0x82a9de(++_0x1c8846);}(_0xf01a,0xed));var _0xaf01=function(_0x397efc,_0x205995){_0x397efc=_0x397efc-0x0;var _0x546ea=_0xf01a[_0x397efc];return _0x546ea;};'use strict';var _=require(_0xaf01('0x0'));var util=require(_0xaf01('0x1'));var moment=require(_0xaf01('0x2'));var BPromise=require(_0xaf01('0x3'));var rs=require(_0xaf01('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf01('0x5'))['db'];var utils=require(_0xaf01('0x6'));var logger=require(_0xaf01('0x7'))('rpc');var config=require(_0xaf01('0x8'));var jayson=require(_0xaf01('0x9'));var client=jayson[_0xaf01('0xa')][_0xaf01('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x285cbc,_0x24ace2,_0x37468f){return new BPromise(function(_0x476a59,_0x16553f){return client[_0xaf01('0xc')](_0x285cbc,_0x37468f)[_0xaf01('0xd')](function(_0x49a837){logger[_0xaf01('0xe')](_0xaf01('0xf'),_0x24ace2,_0xaf01('0x10'));logger[_0xaf01('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x24ace2,_0xaf01('0x10'),JSON[_0xaf01('0x12')](_0x49a837));if(_0x49a837[_0xaf01('0x13')]){if(_0x49a837[_0xaf01('0x13')]['code']===0x1f4){logger[_0xaf01('0x13')](_0xaf01('0xf'),_0x24ace2,_0x49a837['error'][_0xaf01('0x14')]);return _0x16553f(_0x49a837[_0xaf01('0x13')][_0xaf01('0x14')]);}logger[_0xaf01('0x13')](_0xaf01('0xf'),_0x24ace2,_0x49a837['error'][_0xaf01('0x14')]);return _0x476a59(_0x49a837['error']['message']);}else{logger[_0xaf01('0xe')](_0xaf01('0xf'),_0x24ace2,_0xaf01('0x10'));_0x476a59(_0x49a837[_0xaf01('0x15')][_0xaf01('0x14')]);}})[_0xaf01('0x16')](function(_0x533bc9){logger[_0xaf01('0x13')](_0xaf01('0xf'),_0x24ace2,_0x533bc9);_0x16553f(_0x533bc9);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index cd5b51f..13ff216 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 _0x0323=['isAuthenticated','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0323,0xf8));var _0x3032=function(_0x375160,_0x14eabd){_0x375160=_0x375160-0x0;var _0x7776dc=_0x0323[_0x375160];return _0x7776dc;};'use strict';var multer=require(_0x3032('0x0'));var util=require('util');var path=require(_0x3032('0x1'));var timeout=require(_0x3032('0x2'));var express=require(_0x3032('0x3'));var router=express[_0x3032('0x4')]();var fs_extra=require(_0x3032('0x5'));var auth=require(_0x3032('0x6'));var interaction=require(_0x3032('0x7'));var config=require(_0x3032('0x8'));var controller=require('./intFreshdeskField.controller');router[_0x3032('0x9')]('/',auth['isAuthenticated'](),controller[_0x3032('0xa')]);router[_0x3032('0x9')](_0x3032('0xb'),auth[_0x3032('0xc')](),controller[_0x3032('0xd')]);router['post']('/',auth[_0x3032('0xc')](),controller[_0x3032('0xe')]);router[_0x3032('0xf')]('/:id',auth[_0x3032('0xc')](),controller[_0x3032('0x10')]);router[_0x3032('0x11')]('/:id',auth[_0x3032('0xc')](),controller[_0x3032('0x12')]);module[_0x3032('0x13')]=router; \ No newline at end of file +var _0x53e6=['put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show'];(function(_0x697f58,_0xcd5bf){var _0x156758=function(_0x34b0af){while(--_0x34b0af){_0x697f58['push'](_0x697f58['shift']());}};_0x156758(++_0xcd5bf);}(_0x53e6,0x64));var _0x653e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x53e6[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0x653e('0x0'));var path=require('path');var timeout=require(_0x653e('0x1'));var express=require(_0x653e('0x2'));var router=express[_0x653e('0x3')]();var fs_extra=require(_0x653e('0x4'));var auth=require(_0x653e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x653e('0x6'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth[_0x653e('0x7')](),controller[_0x653e('0x8')]);router[_0x653e('0x9')](_0x653e('0xa'),auth[_0x653e('0x7')](),controller[_0x653e('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x653e('0xc')]('/:id',auth[_0x653e('0x7')](),controller[_0x653e('0xd')]);router[_0x653e('0xe')](_0x653e('0xa'),auth[_0x653e('0x7')](),controller[_0x653e('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index e2cb86e..5406498 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 _0x2cb8=['ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x1aadc5,_0x5eebc0){var _0xe8aff1=function(_0x55bc82){while(--_0x55bc82){_0x1aadc5['push'](_0x1aadc5['shift']());}};_0xe8aff1(++_0x5eebc0);}(_0x2cb8,0x15c));var _0x82cb=function(_0x537ce6,_0x4a9bdd){_0x537ce6=_0x537ce6-0x0;var _0x4b0879=_0x2cb8[_0x537ce6];return _0x4b0879;};'use strict';var Sequelize=require(_0x82cb('0x0'));module[_0x82cb('0x1')]={'type':{'type':Sequelize[_0x82cb('0x2')](_0x82cb('0x3'),'variable',_0x82cb('0x4'),_0x82cb('0x5'),_0x82cb('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x82cb('0x7')]},'key':{'type':Sequelize[_0x82cb('0x7')]},'keyType':{'type':Sequelize[_0x82cb('0x2')](_0x82cb('0x3'),_0x82cb('0x8'),_0x82cb('0x4'))},'keyContent':{'type':Sequelize[_0x82cb('0x7')]},'idField':{'type':Sequelize[_0x82cb('0x7')]},'nameField':{'type':Sequelize[_0x82cb('0x7')]},'customField':{'type':Sequelize[_0x82cb('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x82cb('0x7')]}}; \ No newline at end of file +var _0x60bc=['picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x2715d9,_0x4d2846){var _0x4d0b12=function(_0x26914e){while(--_0x26914e){_0x2715d9['push'](_0x2715d9['shift']());}};_0x4d0b12(++_0x4d2846);}(_0x60bc,0x80));var _0xc60b=function(_0x5f1733,_0x5775d2){_0x5f1733=_0x5f1733-0x0;var _0x84575=_0x60bc[_0x5f1733];return _0x84575;};'use strict';var Sequelize=require(_0xc60b('0x0'));module[_0xc60b('0x1')]={'type':{'type':Sequelize[_0xc60b('0x2')](_0xc60b('0x3'),_0xc60b('0x4'),_0xc60b('0x5'),_0xc60b('0x6'),_0xc60b('0x7')),'defaultValue':_0xc60b('0x3')},'content':{'type':Sequelize[_0xc60b('0x8')]},'key':{'type':Sequelize[_0xc60b('0x8')]},'keyType':{'type':Sequelize[_0xc60b('0x2')](_0xc60b('0x3'),_0xc60b('0x4'),_0xc60b('0x5'))},'keyContent':{'type':Sequelize[_0xc60b('0x8')]},'idField':{'type':Sequelize[_0xc60b('0x8')]},'nameField':{'type':Sequelize[_0xc60b('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc60b('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 25baf54..bad81ef 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 _0x41bb=['../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','FreshdeskField','findAll','rows','show','params','includeAll','find','catch','create','body','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x584184,_0x254e7d){var _0x67a807=function(_0x3bc6dc){while(--_0x3bc6dc){_0x584184['push'](_0x584184['shift']());}};_0x67a807(++_0x254e7d);}(_0x41bb,0xc5));var _0xb41b=function(_0x16802c,_0x38a110){_0x16802c=_0x16802c-0x0;var _0xb430f6=_0x41bb[_0x16802c];return _0xb430f6;};'use strict';var emlformat=require(_0xb41b('0x0'));var rimraf=require(_0xb41b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb41b('0x2'));var rp=require('request-promise');var moment=require(_0xb41b('0x3'));var BPromise=require(_0xb41b('0x4'));var Mustache=require(_0xb41b('0x5'));var util=require(_0xb41b('0x6'));var path=require('path');var sox=require(_0xb41b('0x7'));var csv=require(_0xb41b('0x8'));var ejs=require(_0xb41b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb41b('0xa'));var jsforce=require(_0xb41b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb41b('0x8'));var querystring=require(_0xb41b('0xc'));var Papa=require(_0xb41b('0xd'));var Redis=require(_0xb41b('0xe'));var authService=require(_0xb41b('0xf'));var qs=require(_0xb41b('0x10'));var as=require(_0xb41b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb41b('0x12'))('api');var utils=require(_0xb41b('0x13'));var config=require(_0xb41b('0x14'));var licenseUtil=require(_0xb41b('0x15'));var db=require(_0xb41b('0x16'))['db'];function respondWithStatusCode(_0x2066d5,_0x5f1ea4){_0x5f1ea4=_0x5f1ea4||0xcc;return function(_0x353ba3){if(_0x353ba3){return _0x2066d5[_0xb41b('0x17')](_0x5f1ea4);}return _0x2066d5[_0xb41b('0x18')](_0x5f1ea4)[_0xb41b('0x19')]();};}function respondWithResult(_0x3be1ec,_0x4e8603){_0x4e8603=_0x4e8603||0xc8;return function(_0x4e7f11){if(_0x4e7f11){return _0x3be1ec['status'](_0x4e8603)[_0xb41b('0x1a')](_0x4e7f11);}};}function respondWithFilteredResult(_0xdc5fb0,_0x143a81){return function(_0x338920){if(_0x338920){var _0x29ea51=typeof _0x143a81['offset']===_0xb41b('0x1b')&&typeof _0x143a81[_0xb41b('0x1c')]===_0xb41b('0x1b');var _0xcf0728=_0x338920[_0xb41b('0x1d')];var _0x47154d=_0x29ea51?0x0:_0x143a81[_0xb41b('0x1e')];var _0x5df8c2=_0x29ea51?_0x338920['count']:_0x143a81['offset']+_0x143a81[_0xb41b('0x1c')];var _0x503e86;if(_0x5df8c2>=_0xcf0728){_0x5df8c2=_0xcf0728;_0x503e86=0xc8;}else{_0x503e86=0xce;}_0xdc5fb0[_0xb41b('0x18')](_0x503e86);return _0xdc5fb0[_0xb41b('0x1f')](_0xb41b('0x20'),_0x47154d+'-'+_0x5df8c2+'/'+_0xcf0728)['json'](_0x338920);}return null;};}function patchUpdates(_0x53bc44){return function(_0x1a1386){try{jsonpatch[_0xb41b('0x21')](_0x1a1386,_0x53bc44,!![]);}catch(_0xd1bc61){return BPromise[_0xb41b('0x22')](_0xd1bc61);}return _0x1a1386[_0xb41b('0x23')]();};}function saveUpdates(_0x42dccb,_0x4c73da){return function(_0x58f149){if(_0x58f149){return _0x58f149[_0xb41b('0x24')](_0x42dccb)[_0xb41b('0x25')](function(_0x871b35){return _0x871b35;});}return null;};}function removeEntity(_0x583741,_0x14e9c8){return function(_0x2441d6){if(_0x2441d6){return _0x2441d6['destroy']()[_0xb41b('0x25')](function(){_0x583741[_0xb41b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xed3c7e,_0x4a7992){return function(_0x2d0f27){if(!_0x2d0f27){_0xed3c7e[_0xb41b('0x17')](0x194);}return _0x2d0f27;};}function handleError(_0x53e3a2,_0x3af2c){_0x3af2c=_0x3af2c||0x1f4;return function(_0x4265b8){logger['error'](_0x4265b8['stack']);if(_0x4265b8[_0xb41b('0x26')]){delete _0x4265b8[_0xb41b('0x26')];}_0x53e3a2[_0xb41b('0x18')](_0x3af2c)[_0xb41b('0x27')](_0x4265b8);};}exports[_0xb41b('0x28')]=function(_0x181cbd,_0x253efb){var _0x545395={},_0x26ef96={},_0xb68029={'count':0x0,'rows':[]};var _0x5069aa=_[_0xb41b('0x29')](db['FreshdeskField'][_0xb41b('0x2a')],function(_0x31d4cd){return{'name':_0x31d4cd['fieldName'],'type':_0x31d4cd[_0xb41b('0x2b')]['key']};});_0x26ef96[_0xb41b('0x2c')]=_[_0xb41b('0x29')](_0x5069aa,'name');_0x26ef96[_0xb41b('0x2d')]=_[_0xb41b('0x2e')](_0x181cbd[_0xb41b('0x2d')]);_0x26ef96[_0xb41b('0x2f')]=_[_0xb41b('0x30')](_0x26ef96[_0xb41b('0x2c')],_0x26ef96[_0xb41b('0x2d')]);_0x545395[_0xb41b('0x31')]=_[_0xb41b('0x30')](_0x26ef96[_0xb41b('0x2c')],qs['fields'](_0x181cbd[_0xb41b('0x2d')]['fields']));_0x545395['attributes']=_0x545395[_0xb41b('0x31')][_0xb41b('0x32')]?_0x545395[_0xb41b('0x31')]:_0x26ef96[_0xb41b('0x2c')];if(!_0x181cbd[_0xb41b('0x2d')][_0xb41b('0x33')](_0xb41b('0x34'))){_0x545395[_0xb41b('0x1c')]=qs[_0xb41b('0x1c')](_0x181cbd[_0xb41b('0x2d')][_0xb41b('0x1c')]);_0x545395['offset']=qs[_0xb41b('0x1e')](_0x181cbd[_0xb41b('0x2d')][_0xb41b('0x1e')]);}_0x545395[_0xb41b('0x35')]=qs[_0xb41b('0x36')](_0x181cbd[_0xb41b('0x2d')]['sort']);_0x545395['where']=qs[_0xb41b('0x2f')](_[_0xb41b('0x37')](_0x181cbd['query'],_0x26ef96[_0xb41b('0x2f')]),_0x5069aa);if(_0x181cbd[_0xb41b('0x2d')][_0xb41b('0x38')]){_0x545395[_0xb41b('0x39')]=_[_0xb41b('0x3a')](_0x545395['where'],{'$or':_[_0xb41b('0x29')](_0x5069aa,function(_0x5775d3){if(_0x5775d3[_0xb41b('0x2b')]!==_0xb41b('0x3b')){var _0x799d6={};_0x799d6[_0x5775d3[_0xb41b('0x26')]]={'$like':'%'+_0x181cbd[_0xb41b('0x2d')][_0xb41b('0x38')]+'%'};return _0x799d6;}})});}_0x545395=_[_0xb41b('0x3a')]({},_0x545395,_0x181cbd[_0xb41b('0x3c')]);var _0x2b0721={'where':_0x545395['where']};return db['FreshdeskField']['count'](_0x2b0721)[_0xb41b('0x25')](function(_0x5147ce){_0xb68029['count']=_0x5147ce;if(_0x181cbd[_0xb41b('0x2d')]['includeAll']){_0x545395[_0xb41b('0x3d')]=[{'all':!![]}];}return db[_0xb41b('0x3e')][_0xb41b('0x3f')](_0x545395);})[_0xb41b('0x25')](function(_0x4fa390){_0xb68029[_0xb41b('0x40')]=_0x4fa390;return _0xb68029;})[_0xb41b('0x25')](respondWithFilteredResult(_0x253efb,_0x545395))['catch'](handleError(_0x253efb,null));};exports[_0xb41b('0x41')]=function(_0xa70324,_0x3f181c){var _0x174d6c={'raw':!![],'where':{'id':_0xa70324[_0xb41b('0x42')]['id']}},_0x47bab5={};_0x47bab5['model']=_[_0xb41b('0x2e')](db[_0xb41b('0x3e')][_0xb41b('0x2a')]);_0x47bab5['query']=_['keys'](_0xa70324[_0xb41b('0x2d')]);_0x47bab5[_0xb41b('0x2f')]=_[_0xb41b('0x30')](_0x47bab5[_0xb41b('0x2c')],_0x47bab5[_0xb41b('0x2d')]);_0x174d6c[_0xb41b('0x31')]=_[_0xb41b('0x30')](_0x47bab5['model'],qs['fields'](_0xa70324[_0xb41b('0x2d')]['fields']));_0x174d6c[_0xb41b('0x31')]=_0x174d6c['attributes'][_0xb41b('0x32')]?_0x174d6c['attributes']:_0x47bab5[_0xb41b('0x2c')];if(_0xa70324['query'][_0xb41b('0x43')]){_0x174d6c[_0xb41b('0x3d')]=[{'all':!![]}];}_0x174d6c=_[_0xb41b('0x3a')]({},_0x174d6c,_0xa70324[_0xb41b('0x3c')]);return db['FreshdeskField'][_0xb41b('0x44')](_0x174d6c)[_0xb41b('0x25')](handleEntityNotFound(_0x3f181c,null))['then'](respondWithResult(_0x3f181c,null))[_0xb41b('0x45')](handleError(_0x3f181c,null));};exports['create']=function(_0x5cc658,_0x5733d0){return db['FreshdeskField'][_0xb41b('0x46')](_0x5cc658[_0xb41b('0x47')],{})[_0xb41b('0x25')](respondWithResult(_0x5733d0,0xc9))[_0xb41b('0x45')](handleError(_0x5733d0,null));};exports[_0xb41b('0x24')]=function(_0x349a6c,_0x34d076){if(_0x349a6c[_0xb41b('0x47')]['id']){delete _0x349a6c[_0xb41b('0x47')]['id'];}return db[_0xb41b('0x3e')][_0xb41b('0x44')]({'where':{'id':_0x349a6c[_0xb41b('0x42')]['id']}})[_0xb41b('0x25')](handleEntityNotFound(_0x34d076,null))[_0xb41b('0x25')](saveUpdates(_0x349a6c[_0xb41b('0x47')],null))[_0xb41b('0x25')](respondWithResult(_0x34d076,null))['catch'](handleError(_0x34d076,null));};exports[_0xb41b('0x48')]=function(_0x5e041d,_0x4a7aa3){return db[_0xb41b('0x3e')][_0xb41b('0x44')]({'where':{'id':_0x5e041d[_0xb41b('0x42')]['id']}})[_0xb41b('0x25')](handleEntityNotFound(_0x4a7aa3,null))[_0xb41b('0x25')](removeEntity(_0x4a7aa3,null))[_0xb41b('0x45')](handleError(_0x4a7aa3,null));}; \ No newline at end of file +var _0xbdb7=['sort','where','filters','pick','merge','then','findAll','rows','catch','params','rawAttributes','length','include','options','find','create','body','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','update','error','stack','name','send','index','map','FreshdeskField','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order'];(function(_0x315f2c,_0x4ecca8){var _0x2eaefd=function(_0x21e3e7){while(--_0x21e3e7){_0x315f2c['push'](_0x315f2c['shift']());}};_0x2eaefd(++_0x4ecca8);}(_0xbdb7,0x12e));var _0x7bdb=function(_0xdc7170,_0x571276){_0xdc7170=_0xdc7170-0x0;var _0x9e8216=_0xbdb7[_0xdc7170];return _0x9e8216;};'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={},_0xd2d7be={},_0x25a1fe={'count':0x0,'rows':[]};var _0x365c02=_[_0x7bdb('0x28')](db[_0x7bdb('0x29')]['rawAttributes'],function(_0x388a45){return{'name':_0x388a45[_0x7bdb('0x2a')],'type':_0x388a45[_0x7bdb('0x2b')][_0x7bdb('0x2c')]};});_0xd2d7be[_0x7bdb('0x2d')]=_['map'](_0x365c02,_0x7bdb('0x25'));_0xd2d7be[_0x7bdb('0x2e')]=_[_0x7bdb('0x2f')](_0x371e8a[_0x7bdb('0x2e')]);_0xd2d7be['filters']=_['intersection'](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2e')]);_0x1e9996['attributes']=_[_0x7bdb('0x30')](_0xd2d7be['model'],qs[_0x7bdb('0x31')](_0x371e8a[_0x7bdb('0x2e')][_0x7bdb('0x31')]));_0x1e9996['attributes']=_0x1e9996[_0x7bdb('0x32')]['length']?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x2d')];if(!_0x371e8a['query'][_0x7bdb('0x33')]('nolimit')){_0x1e9996['limit']=qs[_0x7bdb('0x1b')](_0x371e8a[_0x7bdb('0x2e')][_0x7bdb('0x1b')]);_0x1e9996[_0x7bdb('0x19')]=qs[_0x7bdb('0x19')](_0x371e8a[_0x7bdb('0x2e')]['offset']);}_0x1e9996[_0x7bdb('0x34')]=qs[_0x7bdb('0x35')](_0x371e8a[_0x7bdb('0x2e')][_0x7bdb('0x35')]);_0x1e9996[_0x7bdb('0x36')]=qs[_0x7bdb('0x37')](_[_0x7bdb('0x38')](_0x371e8a[_0x7bdb('0x2e')],_0xd2d7be[_0x7bdb('0x37')]),_0x365c02);if(_0x371e8a['query']['filter']){_0x1e9996[_0x7bdb('0x36')]=_[_0x7bdb('0x39')](_0x1e9996[_0x7bdb('0x36')],{'$or':_[_0x7bdb('0x28')](_0x365c02,function(_0x3732b2){if(_0x3732b2['type']!=='VIRTUAL'){var _0x27164f={};_0x27164f[_0x3732b2['name']]={'$like':'%'+_0x371e8a[_0x7bdb('0x2e')]['filter']+'%'};return _0x27164f;}})});}_0x1e9996=_[_0x7bdb('0x39')]({},_0x1e9996,_0x371e8a['options']);var _0x4cf3fa={'where':_0x1e9996[_0x7bdb('0x36')]};return db[_0x7bdb('0x29')][_0x7bdb('0x1c')](_0x4cf3fa)[_0x7bdb('0x3a')](function(_0x43c7d3){_0x25a1fe[_0x7bdb('0x1c')]=_0x43c7d3;if(_0x371e8a[_0x7bdb('0x2e')]['includeAll']){_0x1e9996['include']=[{'all':!![]}];}return db[_0x7bdb('0x29')][_0x7bdb('0x3b')](_0x1e9996);})[_0x7bdb('0x3a')](function(_0x3509e4){_0x25a1fe[_0x7bdb('0x3c')]=_0x3509e4;return _0x25a1fe;})[_0x7bdb('0x3a')](respondWithFilteredResult(_0x2e8e65,_0x1e9996))[_0x7bdb('0x3d')](handleError(_0x2e8e65,null));};exports['show']=function(_0x4a2ebc,_0x1bcbcd){var _0x8e893e={'raw':!![],'where':{'id':_0x4a2ebc[_0x7bdb('0x3e')]['id']}},_0x4636f8={};_0x4636f8['model']=_[_0x7bdb('0x2f')](db['FreshdeskField'][_0x7bdb('0x3f')]);_0x4636f8[_0x7bdb('0x2e')]=_[_0x7bdb('0x2f')](_0x4a2ebc[_0x7bdb('0x2e')]);_0x4636f8[_0x7bdb('0x37')]=_[_0x7bdb('0x30')](_0x4636f8[_0x7bdb('0x2d')],_0x4636f8[_0x7bdb('0x2e')]);_0x8e893e[_0x7bdb('0x32')]=_['intersection'](_0x4636f8[_0x7bdb('0x2d')],qs[_0x7bdb('0x31')](_0x4a2ebc['query'][_0x7bdb('0x31')]));_0x8e893e['attributes']=_0x8e893e[_0x7bdb('0x32')][_0x7bdb('0x40')]?_0x8e893e[_0x7bdb('0x32')]:_0x4636f8[_0x7bdb('0x2d')];if(_0x4a2ebc[_0x7bdb('0x2e')]['includeAll']){_0x8e893e[_0x7bdb('0x41')]=[{'all':!![]}];}_0x8e893e=_[_0x7bdb('0x39')]({},_0x8e893e,_0x4a2ebc[_0x7bdb('0x42')]);return db[_0x7bdb('0x29')][_0x7bdb('0x43')](_0x8e893e)['then'](handleEntityNotFound(_0x1bcbcd,null))[_0x7bdb('0x3a')](respondWithResult(_0x1bcbcd,null))[_0x7bdb('0x3d')](handleError(_0x1bcbcd,null));};exports[_0x7bdb('0x44')]=function(_0xb26a9,_0x259007){return db[_0x7bdb('0x29')][_0x7bdb('0x44')](_0xb26a9[_0x7bdb('0x45')],{})[_0x7bdb('0x3a')](respondWithResult(_0x259007,0xc9))[_0x7bdb('0x3d')](handleError(_0x259007,null));};exports['update']=function(_0x189cf8,_0x58c4bc){if(_0x189cf8['body']['id']){delete _0x189cf8[_0x7bdb('0x45')]['id'];}return db[_0x7bdb('0x29')]['find']({'where':{'id':_0x189cf8[_0x7bdb('0x3e')]['id']}})[_0x7bdb('0x3a')](handleEntityNotFound(_0x58c4bc,null))['then'](saveUpdates(_0x189cf8['body'],null))['then'](respondWithResult(_0x58c4bc,null))[_0x7bdb('0x3d')](handleError(_0x58c4bc,null));};exports[_0x7bdb('0x46')]=function(_0x2fab74,_0x46410c){return db[_0x7bdb('0x29')][_0x7bdb('0x43')]({'where':{'id':_0x2fab74[_0x7bdb('0x3e')]['id']}})[_0x7bdb('0x3a')](handleEntityNotFound(_0x46410c,null))[_0x7bdb('0x3a')](removeEntity(_0x46410c,null))[_0x7bdb('0x3d')](handleError(_0x46410c,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 803aa62..7784ae2 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 _0x48a9=['api','moment','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','idField','FieldId','util','../../config/logger'];(function(_0x2b4c8f,_0x50c39e){var _0x1dde44=function(_0x2fbb63){while(--_0x2fbb63){_0x2b4c8f['push'](_0x2b4c8f['shift']());}};_0x1dde44(++_0x50c39e);}(_0x48a9,0x8a));var _0x948a=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0x48a9[_0x3ec122];return _0x4ecf41;};'use strict';var _=require('lodash');var util=require(_0x948a('0x0'));var logger=require(_0x948a('0x1'))(_0x948a('0x2'));var moment=require(_0x948a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x948a('0x4'));var rimraf=require(_0x948a('0x5'));var config=require(_0x948a('0x6'));var attributes=require(_0x948a('0x7'));module[_0x948a('0x8')]=function(_0x165416,_0x53583c){return _0x165416[_0x948a('0x9')](_0x948a('0xa'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x948a('0xb'),'fields':[_0x948a('0xc'),_0x948a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x81c2=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash'];(function(_0x3d6b14,_0x1f0d92){var _0x43b893=function(_0x57eee7){while(--_0x57eee7){_0x3d6b14['push'](_0x3d6b14['shift']());}};_0x43b893(++_0x1f0d92);}(_0x81c2,0xdf));var _0x281c=function(_0x2ea4f0,_0x420118){_0x2ea4f0=_0x2ea4f0-0x0;var _0x5c5877=_0x81c2[_0x2ea4f0];return _0x5c5877;};'use strict';var _=require(_0x281c('0x0'));var util=require(_0x281c('0x1'));var logger=require('../../config/logger')(_0x281c('0x2'));var moment=require(_0x281c('0x3'));var BPromise=require(_0x281c('0x4'));var rp=require(_0x281c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x281c('0x6'));var config=require(_0x281c('0x7'));var attributes=require('./intFreshdeskField.attributes');module[_0x281c('0x8')]=function(_0x227a27,_0x2e52f7){return _0x227a27[_0x281c('0x9')](_0x281c('0xa'),attributes,{'tableName':_0x281c('0xb'),'paranoid':![],'indexes':[{'name':_0x281c('0xc'),'fields':['idField',_0x281c('0xd')],'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 f547149..4ccd2a9 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 _0xc573=['catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x42d85c,_0x419c25){var _0x33f17f=function(_0xaf1c96){while(--_0xaf1c96){_0x42d85c['push'](_0x42d85c['shift']());}};_0x33f17f(++_0x419c25);}(_0xc573,0x1cd));var _0x3c57=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0xc573[_0x47a349];return _0x18ab75;};'use strict';var _=require('lodash');var util=require(_0x3c57('0x0'));var moment=require(_0x3c57('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c57('0x2'))['db'];var utils=require(_0x3c57('0x3'));var logger=require(_0x3c57('0x4'))(_0x3c57('0x5'));var config=require('../../config/environment');var jayson=require(_0x3c57('0x6'));var client=jayson[_0x3c57('0x7')][_0x3c57('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x415e0f,_0x42ce8d,_0x21f8f5){return new BPromise(function(_0x449ff7,_0x33c8f3){return client[_0x3c57('0x9')](_0x415e0f,_0x21f8f5)[_0x3c57('0xa')](function(_0xe7a7b9){logger[_0x3c57('0xb')](_0x3c57('0xc'),_0x42ce8d,_0x3c57('0xd'));logger[_0x3c57('0xe')](_0x3c57('0xf'),_0x42ce8d,'request\x20sent',JSON['stringify'](_0xe7a7b9));if(_0xe7a7b9[_0x3c57('0x10')]){if(_0xe7a7b9[_0x3c57('0x10')]['code']===0x1f4){logger['error'](_0x3c57('0xc'),_0x42ce8d,_0xe7a7b9[_0x3c57('0x10')][_0x3c57('0x11')]);return _0x33c8f3(_0xe7a7b9['error'][_0x3c57('0x11')]);}logger[_0x3c57('0x10')](_0x3c57('0xc'),_0x42ce8d,_0xe7a7b9[_0x3c57('0x10')][_0x3c57('0x11')]);return _0x449ff7(_0xe7a7b9[_0x3c57('0x10')][_0x3c57('0x11')]);}else{logger[_0x3c57('0xb')](_0x3c57('0xc'),_0x42ce8d,_0x3c57('0xd'));_0x449ff7(_0xe7a7b9[_0x3c57('0x12')][_0x3c57('0x11')]);}})[_0x3c57('0x13')](function(_0x35cfb9){logger[_0x3c57('0x10')](_0x3c57('0xc'),_0x42ce8d,_0x35cfb9);_0x33c8f3(_0x35cfb9);});});} \ No newline at end of file +var _0xff86=['FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','jayson/promise','client','http','then','info'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xff86,0x197));var _0x6ff8=function(_0x46b5c7,_0x562506){_0x46b5c7=_0x46b5c7-0x0;var _0x2d90fc=_0xff86[_0x46b5c7];return _0x2d90fc;};'use strict';var _=require(_0x6ff8('0x0'));var util=require(_0x6ff8('0x1'));var moment=require(_0x6ff8('0x2'));var BPromise=require(_0x6ff8('0x3'));var rs=require(_0x6ff8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ff8('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6ff8('0x6'));var client=jayson[_0x6ff8('0x7')][_0x6ff8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x32b38e,_0x45f52b,_0x7ad0e4){return new BPromise(function(_0x3a2332,_0x2d71cc){return client['request'](_0x32b38e,_0x7ad0e4)[_0x6ff8('0x9')](function(_0x405f98){logger[_0x6ff8('0xa')](_0x6ff8('0xb'),_0x45f52b,_0x6ff8('0xc'));logger[_0x6ff8('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x45f52b,_0x6ff8('0xc'),JSON[_0x6ff8('0xe')](_0x405f98));if(_0x405f98['error']){if(_0x405f98['error']['code']===0x1f4){logger[_0x6ff8('0xf')](_0x6ff8('0xb'),_0x45f52b,_0x405f98[_0x6ff8('0xf')][_0x6ff8('0x10')]);return _0x2d71cc(_0x405f98[_0x6ff8('0xf')][_0x6ff8('0x10')]);}logger[_0x6ff8('0xf')](_0x6ff8('0xb'),_0x45f52b,_0x405f98[_0x6ff8('0xf')]['message']);return _0x3a2332(_0x405f98[_0x6ff8('0xf')]['message']);}else{logger[_0x6ff8('0xa')]('FreshdeskField,\x20%s,\x20%s',_0x45f52b,_0x6ff8('0xc'));_0x3a2332(_0x405f98[_0x6ff8('0x11')][_0x6ff8('0x10')]);}})[_0x6ff8('0x12')](function(_0x160783){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x45f52b,_0x160783);_0x2d71cc(_0x160783);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 6d1521f..8b8522c 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 _0xefda=['update','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getFields','post','create','addConfiguration','put'];(function(_0x163bf0,_0x3c12ed){var _0x933c4=function(_0x4ceaf2){while(--_0x4ceaf2){_0x163bf0['push'](_0x163bf0['shift']());}};_0x933c4(++_0x3c12ed);}(_0xefda,0x96));var _0xaefd=function(_0x5804cf,_0xbe814e){_0x5804cf=_0x5804cf-0x0;var _0x3d97c0=_0xefda[_0x5804cf];return _0x3d97c0;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var fs_extra=require(_0xaefd('0x3'));var auth=require(_0xaefd('0x4'));var interaction=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var controller=require(_0xaefd('0x7'));router[_0xaefd('0x8')]('/',auth['isAuthenticated'](),controller[_0xaefd('0x9')]);router[_0xaefd('0x8')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller['show']);router[_0xaefd('0x8')](_0xaefd('0xc'),auth[_0xaefd('0xb')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0xaefd('0xb')](),controller[_0xaefd('0xd')]);router[_0xaefd('0xe')]('/',auth[_0xaefd('0xb')](),controller[_0xaefd('0xf')]);router[_0xaefd('0xe')](_0xaefd('0xc'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x10')]);router[_0xaefd('0x11')](_0xaefd('0xa'),auth['isAuthenticated'](),controller[_0xaefd('0x12')]);router['delete'](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x13')]);module[_0xaefd('0x14')]=router; \ No newline at end of file +var _0x57f8=['/:id','/:id/configurations','/:id/fields','post','create','addConfiguration','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated'];(function(_0x1c0c06,_0x1a2c06){var _0x2e83d8=function(_0x2fb6aa){while(--_0x2fb6aa){_0x1c0c06['push'](_0x1c0c06['shift']());}};_0x2e83d8(++_0x1a2c06);}(_0x57f8,0x198));var _0x857f=function(_0x3f807d,_0x32a3b1){_0x3f807d=_0x3f807d-0x0;var _0x45ad62=_0x57f8[_0x3f807d];return _0x45ad62;};'use strict';var multer=require('multer');var util=require(_0x857f('0x0'));var path=require(_0x857f('0x1'));var timeout=require(_0x857f('0x2'));var express=require(_0x857f('0x3'));var router=express[_0x857f('0x4')]();var fs_extra=require(_0x857f('0x5'));var auth=require(_0x857f('0x6'));var interaction=require(_0x857f('0x7'));var config=require(_0x857f('0x8'));var controller=require(_0x857f('0x9'));router[_0x857f('0xa')]('/',auth[_0x857f('0xb')](),controller['index']);router[_0x857f('0xa')](_0x857f('0xc'),auth[_0x857f('0xb')](),controller['show']);router[_0x857f('0xa')](_0x857f('0xd'),auth[_0x857f('0xb')](),controller['getConfigurations']);router[_0x857f('0xa')](_0x857f('0xe'),auth[_0x857f('0xb')](),controller['getFields']);router[_0x857f('0xf')]('/',auth[_0x857f('0xb')](),controller[_0x857f('0x10')]);router[_0x857f('0xf')](_0x857f('0xd'),auth[_0x857f('0xb')](),controller[_0x857f('0x11')]);router['put'](_0x857f('0xc'),auth[_0x857f('0xb')](),controller[_0x857f('0x12')]);router[_0x857f('0x13')](_0x857f('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x857f('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 2d99c54..02d8d3a 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 _0x2da6=['username','sequelize','exports','STRING'];(function(_0x1da8d4,_0x12ea2b){var _0x54f098=function(_0x129b4b){while(--_0x129b4b){_0x1da8d4['push'](_0x1da8d4['shift']());}};_0x54f098(++_0x12ea2b);}(_0x2da6,0x1dd));var _0x62da=function(_0xa678d7,_0x1aa168){_0xa678d7=_0xa678d7-0x0;var _0x12f909=_0x2da6[_0xa678d7];return _0x12f909;};'use strict';var Sequelize=require(_0x62da('0x0'));module[_0x62da('0x1')]={'name':{'type':Sequelize[_0x62da('0x2')]},'description':{'type':Sequelize[_0x62da('0x2')]},'username':{'type':Sequelize[_0x62da('0x2')],'unique':_0x62da('0x3')},'apiKey':{'type':Sequelize[_0x62da('0x2')]},'remoteUri':{'type':Sequelize[_0x62da('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xa30a=['sequelize','exports','STRING','username','remoteUri'];(function(_0x3df3d4,_0x282457){var _0x3c4e6f=function(_0x542ac9){while(--_0x542ac9){_0x3df3d4['push'](_0x3df3d4['shift']());}};_0x3c4e6f(++_0x282457);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xaa30('0x0'));module[_0xaa30('0x1')]={'name':{'type':Sequelize[_0xaa30('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xaa30('0x2')],'unique':_0xaa30('0x3')},'apiKey':{'type':Sequelize[_0xaa30('0x2')]},'remoteUri':{'type':Sequelize[_0xaa30('0x2')],'unique':_0xaa30('0x4')},'serverUrl':{'type':Sequelize[_0xaa30('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 f874582..f604977 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 _0xd338=['error','stack','name','index','map','FreshsalesAccount','fieldName','type','key','model','query','keys','filters','attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','intersection','length','find','create','body','destroy','params','getConfigurations','findOne','FreshsalesConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','FreshsalesField','username','remoteUri','slice','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','email','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','test','eml-format','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x21b62a,_0x1df188){var _0x3b3bcd=function(_0xe675bc){while(--_0xe675bc){_0x21b62a['push'](_0x21b62a['shift']());}};_0x3b3bcd(++_0x1df188);}(_0xd338,0x188));var _0x8d33=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xd338[_0x3fba9f];return _0x192cf1;};'use strict';var emlformat=require(_0x8d33('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8d33('0x1'));var jsonpatch=require(_0x8d33('0x2'));var rp=require(_0x8d33('0x3'));var moment=require('moment');var BPromise=require(_0x8d33('0x4'));var Mustache=require(_0x8d33('0x5'));var util=require(_0x8d33('0x6'));var path=require(_0x8d33('0x7'));var sox=require(_0x8d33('0x8'));var csv=require(_0x8d33('0x9'));var ejs=require(_0x8d33('0xa'));var fs=require('fs');var fs_extra=require(_0x8d33('0xb'));var _=require(_0x8d33('0xc'));var squel=require(_0x8d33('0xd'));var crypto=require(_0x8d33('0xe'));var jsforce=require(_0x8d33('0xf'));var deskjs=require(_0x8d33('0x10'));var toCsv=require('to-csv');var querystring=require(_0x8d33('0x11'));var Papa=require(_0x8d33('0x12'));var Redis=require(_0x8d33('0x13'));var authService=require(_0x8d33('0x14'));var qs=require(_0x8d33('0x15'));var as=require(_0x8d33('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8d33('0x17'))(_0x8d33('0x18'));var utils=require(_0x8d33('0x19'));var config=require(_0x8d33('0x1a'));var licenseUtil=require(_0x8d33('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8d33('0x1c'));function respondWithStatusCode(_0x1d7b94,_0xc79374){_0xc79374=_0xc79374||0xcc;return function(_0x2a58cd){if(_0x2a58cd){return _0x1d7b94[_0x8d33('0x1d')](_0xc79374);}return _0x1d7b94['status'](_0xc79374)[_0x8d33('0x1e')]();};}function respondWithResult(_0x353646,_0x4ff294){_0x4ff294=_0x4ff294||0xc8;return function(_0x3f6148){if(_0x3f6148){return _0x353646[_0x8d33('0x1f')](_0x4ff294)[_0x8d33('0x20')](_0x3f6148);}};}function respondWithFilteredResult(_0x53fdf8,_0x35e35d){return function(_0x5ea147){if(_0x5ea147){var _0x4f3d79=typeof _0x35e35d[_0x8d33('0x21')]==='undefined'&&typeof _0x35e35d[_0x8d33('0x22')]===_0x8d33('0x23');var _0x51643f=_0x5ea147[_0x8d33('0x24')];var _0x5226ff=_0x4f3d79?0x0:_0x35e35d[_0x8d33('0x21')];var _0x9726eb=_0x4f3d79?_0x5ea147[_0x8d33('0x24')]:_0x35e35d['offset']+_0x35e35d[_0x8d33('0x22')];var _0xb0a884;if(_0x9726eb>=_0x51643f){_0x9726eb=_0x51643f;_0xb0a884=0xc8;}else{_0xb0a884=0xce;}_0x53fdf8['status'](_0xb0a884);return _0x53fdf8[_0x8d33('0x25')](_0x8d33('0x26'),_0x5226ff+'-'+_0x9726eb+'/'+_0x51643f)[_0x8d33('0x20')](_0x5ea147);}return null;};}function patchUpdates(_0xa5c472){return function(_0x4acc19){try{jsonpatch[_0x8d33('0x27')](_0x4acc19,_0xa5c472,!![]);}catch(_0x5eff0b){return BPromise[_0x8d33('0x28')](_0x5eff0b);}return _0x4acc19[_0x8d33('0x29')]();};}function saveUpdates(_0x5b8620,_0x5005ae){return function(_0x32d809){if(_0x32d809){return _0x32d809[_0x8d33('0x2a')](_0x5b8620)[_0x8d33('0x2b')](function(_0x344b06){return _0x344b06;});}return null;};}function removeEntity(_0x56c8d4,_0x13a8fc){return function(_0x42d6d0){if(_0x42d6d0){return _0x42d6d0['destroy']()[_0x8d33('0x2b')](function(){_0x56c8d4['status'](0xcc)[_0x8d33('0x1e')]();});}};}function handleEntityNotFound(_0x30f04b,_0x51631c){return function(_0x4f34e0){if(!_0x4f34e0){_0x30f04b['sendStatus'](0x194);}return _0x4f34e0;};}function handleError(_0x280093,_0x195a32){_0x195a32=_0x195a32||0x1f4;return function(_0x28a04d){logger[_0x8d33('0x2c')](_0x28a04d[_0x8d33('0x2d')]);if(_0x28a04d['name']){delete _0x28a04d[_0x8d33('0x2e')];}_0x280093[_0x8d33('0x1f')](_0x195a32)['send'](_0x28a04d);};}exports[_0x8d33('0x2f')]=function(_0x1d3f1d,_0x40c4ae){var _0x40a8d6={},_0x58e35f={},_0xaa116b={'count':0x0,'rows':[]};var _0x1f0356=_[_0x8d33('0x30')](db[_0x8d33('0x31')]['rawAttributes'],function(_0xf75784){return{'name':_0xf75784[_0x8d33('0x32')],'type':_0xf75784[_0x8d33('0x33')][_0x8d33('0x34')]};});_0x58e35f[_0x8d33('0x35')]=_[_0x8d33('0x30')](_0x1f0356,'name');_0x58e35f[_0x8d33('0x36')]=_[_0x8d33('0x37')](_0x1d3f1d[_0x8d33('0x36')]);_0x58e35f[_0x8d33('0x38')]=_['intersection'](_0x58e35f[_0x8d33('0x35')],_0x58e35f[_0x8d33('0x36')]);_0x40a8d6[_0x8d33('0x39')]=_['intersection'](_0x58e35f[_0x8d33('0x35')],qs[_0x8d33('0x3a')](_0x1d3f1d['query'][_0x8d33('0x3a')]));_0x40a8d6[_0x8d33('0x39')]=_0x40a8d6[_0x8d33('0x39')]['length']?_0x40a8d6[_0x8d33('0x39')]:_0x58e35f[_0x8d33('0x35')];if(!_0x1d3f1d[_0x8d33('0x36')]['hasOwnProperty'](_0x8d33('0x3b'))){_0x40a8d6[_0x8d33('0x22')]=qs['limit'](_0x1d3f1d[_0x8d33('0x36')][_0x8d33('0x22')]);_0x40a8d6['offset']=qs[_0x8d33('0x21')](_0x1d3f1d['query']['offset']);}_0x40a8d6[_0x8d33('0x3c')]=qs[_0x8d33('0x3d')](_0x1d3f1d['query'][_0x8d33('0x3d')]);_0x40a8d6['where']=qs[_0x8d33('0x38')](_['pick'](_0x1d3f1d[_0x8d33('0x36')],_0x58e35f[_0x8d33('0x38')]),_0x1f0356);if(_0x1d3f1d[_0x8d33('0x36')]['filter']){_0x40a8d6[_0x8d33('0x3e')]=_[_0x8d33('0x3f')](_0x40a8d6[_0x8d33('0x3e')],{'$or':_[_0x8d33('0x30')](_0x1f0356,function(_0x504c9d){if(_0x504c9d[_0x8d33('0x33')]!==_0x8d33('0x40')){var _0x428eae={};_0x428eae[_0x504c9d[_0x8d33('0x2e')]]={'$like':'%'+_0x1d3f1d[_0x8d33('0x36')][_0x8d33('0x41')]+'%'};return _0x428eae;}})});}_0x40a8d6=_[_0x8d33('0x3f')]({},_0x40a8d6,_0x1d3f1d[_0x8d33('0x42')]);var _0x45e14c={'where':_0x40a8d6[_0x8d33('0x3e')]};return db[_0x8d33('0x31')][_0x8d33('0x24')](_0x45e14c)[_0x8d33('0x2b')](function(_0x326471){_0xaa116b[_0x8d33('0x24')]=_0x326471;if(_0x1d3f1d[_0x8d33('0x36')][_0x8d33('0x43')]){_0x40a8d6[_0x8d33('0x44')]=[{'all':!![]}];}return db[_0x8d33('0x31')][_0x8d33('0x45')](_0x40a8d6);})['then'](function(_0x5acfe9){_0xaa116b[_0x8d33('0x46')]=_0x5acfe9;return _0xaa116b;})[_0x8d33('0x2b')](respondWithFilteredResult(_0x40c4ae,_0x40a8d6))[_0x8d33('0x47')](handleError(_0x40c4ae,null));};exports[_0x8d33('0x48')]=function(_0x42a884,_0x2b2bdb){var _0x274d0b={'raw':![],'where':{'id':_0x42a884['params']['id']}},_0x3f8a78={};_0x3f8a78[_0x8d33('0x35')]=_[_0x8d33('0x37')](db['FreshsalesAccount'][_0x8d33('0x49')]);_0x3f8a78['query']=_['keys'](_0x42a884[_0x8d33('0x36')]);_0x3f8a78[_0x8d33('0x38')]=_[_0x8d33('0x4a')](_0x3f8a78[_0x8d33('0x35')],_0x3f8a78[_0x8d33('0x36')]);_0x274d0b['attributes']=_['intersection'](_0x3f8a78[_0x8d33('0x35')],qs[_0x8d33('0x3a')](_0x42a884['query'][_0x8d33('0x3a')]));_0x274d0b[_0x8d33('0x39')]=_0x274d0b[_0x8d33('0x39')][_0x8d33('0x4b')]?_0x274d0b[_0x8d33('0x39')]:_0x3f8a78[_0x8d33('0x35')];if(_0x42a884[_0x8d33('0x36')]['includeAll']){_0x274d0b[_0x8d33('0x44')]=[{'all':!![]}];}_0x274d0b=_[_0x8d33('0x3f')]({},_0x274d0b,_0x42a884[_0x8d33('0x42')]);return db['FreshsalesAccount'][_0x8d33('0x4c')](_0x274d0b)[_0x8d33('0x2b')](handleEntityNotFound(_0x2b2bdb,null))['then'](respondWithResult(_0x2b2bdb,null))[_0x8d33('0x47')](handleError(_0x2b2bdb,null));};exports[_0x8d33('0x4d')]=function(_0x504a48,_0xfeea1c){return db['FreshsalesAccount']['create'](_0x504a48[_0x8d33('0x4e')],{})[_0x8d33('0x2b')](respondWithResult(_0xfeea1c,0xc9))[_0x8d33('0x47')](handleError(_0xfeea1c,null));};exports['update']=function(_0x4813a7,_0x4385b6){if(_0x4813a7[_0x8d33('0x4e')]['id']){delete _0x4813a7[_0x8d33('0x4e')]['id'];}return db['FreshsalesAccount'][_0x8d33('0x4c')]({'where':{'id':_0x4813a7['params']['id']}})['then'](handleEntityNotFound(_0x4385b6,null))[_0x8d33('0x2b')](saveUpdates(_0x4813a7['body'],null))[_0x8d33('0x2b')](respondWithResult(_0x4385b6,null))[_0x8d33('0x47')](handleError(_0x4385b6,null));};exports[_0x8d33('0x4f')]=function(_0x1be11e,_0xc17fef){return db[_0x8d33('0x31')]['find']({'where':{'id':_0x1be11e[_0x8d33('0x50')]['id']}})[_0x8d33('0x2b')](handleEntityNotFound(_0xc17fef,null))[_0x8d33('0x2b')](removeEntity(_0xc17fef,null))[_0x8d33('0x47')](handleError(_0xc17fef,null));};exports[_0x8d33('0x51')]=function(_0x52bd9c,_0x5c2e62,_0x343a5f){var _0x3538b9={};var _0x28f412={};var _0x2237ab;var _0x2e343f;return db[_0x8d33('0x31')][_0x8d33('0x52')]({'where':{'id':_0x52bd9c[_0x8d33('0x50')]['id']}})['then'](handleEntityNotFound(_0x5c2e62,null))[_0x8d33('0x2b')](function(_0x128f6e){if(_0x128f6e){_0x2237ab=_0x128f6e;_0x28f412['model']=_['keys'](db[_0x8d33('0x53')]['rawAttributes']);_0x28f412[_0x8d33('0x36')]=_[_0x8d33('0x37')](_0x52bd9c['query']);_0x28f412[_0x8d33('0x38')]=_[_0x8d33('0x4a')](_0x28f412[_0x8d33('0x35')],_0x28f412[_0x8d33('0x36')]);_0x3538b9[_0x8d33('0x39')]=_['intersection'](_0x28f412['model'],qs['fields'](_0x52bd9c[_0x8d33('0x36')][_0x8d33('0x3a')]));_0x3538b9[_0x8d33('0x39')]=_0x3538b9[_0x8d33('0x39')][_0x8d33('0x4b')]?_0x3538b9['attributes']:_0x28f412[_0x8d33('0x35')];_0x3538b9[_0x8d33('0x3c')]=qs['sort'](_0x52bd9c[_0x8d33('0x36')][_0x8d33('0x3d')]);_0x3538b9[_0x8d33('0x3e')]=qs[_0x8d33('0x38')](_[_0x8d33('0x54')](_0x52bd9c[_0x8d33('0x36')],_0x28f412[_0x8d33('0x38')]));if(_0x52bd9c[_0x8d33('0x36')][_0x8d33('0x41')]){_0x3538b9[_0x8d33('0x3e')]=_[_0x8d33('0x3f')](_0x3538b9[_0x8d33('0x3e')],{'$or':_[_0x8d33('0x30')](_0x3538b9[_0x8d33('0x39')],function(_0x51336e){var _0x4b9bc7={};_0x4b9bc7[_0x51336e]={'$like':'%'+_0x52bd9c[_0x8d33('0x36')][_0x8d33('0x41')]+'%'};return _0x4b9bc7;})});}_0x3538b9=_[_0x8d33('0x3f')]({},_0x3538b9,_0x52bd9c['options']);return _0x2237ab[_0x8d33('0x51')](_0x3538b9);}})[_0x8d33('0x2b')](function(_0x44304d){if(_0x44304d){_0x2e343f=_0x44304d[_0x8d33('0x4b')];if(!_0x52bd9c['query'][_0x8d33('0x55')]('nolimit')){_0x3538b9[_0x8d33('0x22')]=qs[_0x8d33('0x22')](_0x52bd9c[_0x8d33('0x36')][_0x8d33('0x22')]);_0x3538b9[_0x8d33('0x21')]=qs['offset'](_0x52bd9c['query'][_0x8d33('0x21')]);}return _0x2237ab[_0x8d33('0x51')](_0x3538b9);}})[_0x8d33('0x2b')](function(_0x3cc67b){if(_0x3cc67b){return _0x3cc67b?{'count':_0x2e343f,'rows':_0x3cc67b}:null;}})[_0x8d33('0x2b')](respondWithResult(_0x5c2e62,null))[_0x8d33('0x47')](handleError(_0x5c2e62,null));};exports[_0x8d33('0x56')]=function(_0x4522f4,_0xe76804,_0x4c4f81){if(_0x4522f4[_0x8d33('0x4e')]['id']){delete _0x4522f4[_0x8d33('0x4e')]['id'];}return db[_0x8d33('0x31')][_0x8d33('0x52')]({'where':{'id':_0x4522f4['params']['id']}})[_0x8d33('0x2b')](handleEntityNotFound(_0xe76804,null))[_0x8d33('0x2b')](function(_0x5749e1){if(_0x5749e1){_0x4522f4[_0x8d33('0x4e')][_0x8d33('0x57')]=_0x5749e1['id'];_0x4522f4[_0x8d33('0x4e')][_0x8d33('0x58')]=integrations['getSubjects'](_0x4522f4[_0x8d33('0x4e')]['channel'],_0x4522f4[_0x8d33('0x4e')][_0x8d33('0x33')]);_0x4522f4[_0x8d33('0x4e')][_0x8d33('0x59')]=integrations[_0x8d33('0x5a')](_0x4522f4[_0x8d33('0x4e')][_0x8d33('0x5b')],_0x4522f4[_0x8d33('0x4e')][_0x8d33('0x33')]);return db['FreshsalesConfiguration'][_0x8d33('0x4d')](_0x4522f4[_0x8d33('0x4e')],{'include':[{'model':db[_0x8d33('0x5c')],'as':'Subjects'},{'model':db[_0x8d33('0x5c')],'as':_0x8d33('0x59')}]});}return null;})[_0x8d33('0x2b')](respondWithResult(_0xe76804,null))[_0x8d33('0x47')](handleError(_0xe76804,null));};exports['getFields']=function(_0x301209,_0x4e44a2,_0x257d08){var _0x2c5f9a='';var _0x42bd1e='';return db[_0x8d33('0x31')][_0x8d33('0x52')]({'where':{'id':_0x301209[_0x8d33('0x50')]['id']},'attributes':['id',_0x8d33('0x5d'),'remoteUri','apiKey']})['then'](handleEntityNotFound(_0x4e44a2,null))[_0x8d33('0x2b')](function(_0x19439a){if(_0x19439a){_0x42bd1e=_0x19439a['username'];_0x2c5f9a=_0x19439a['remoteUri'];var _0x3c1f8f=_0x19439a[_0x8d33('0x5e')][_0x8d33('0x5f')](-0x1);if(_0x3c1f8f==='/'){_0x2c5f9a=_0x2c5f9a['substring'](0x0,_0x2c5f9a[_0x8d33('0x60')](_0x3c1f8f));}return rp({'method':'GET','uri':util[_0x8d33('0x61')](_0x8d33('0x62'),_0x2c5f9a,_0x8d33('0x63')),'headers':{'Authorization':_0x8d33('0x64')+_0x19439a[_0x8d33('0x65')]},'json':!![]});}})[_0x8d33('0x2b')](function(_0x36020d){if(_0x36020d){var _0x37caab=_0x36020d['users'];var _0x4ffbac=![];var _0x1b2527=null;for(_0x1b2527=0x0;_0x1b2527<_0x37caab[_0x8d33('0x4b')];_0x1b2527++){if(_0x37caab[_0x1b2527][_0x8d33('0x66')]===_0x42bd1e){_0x4ffbac=!![];}}if(_0x4ffbac){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x8d33('0x2b')](respondWithResult(_0x4e44a2,null))[_0x8d33('0x47')](function(_0x5629c2){var _0x403703=_0x301209[_0x8d33('0x36')]['test']?0x1f4:_0x5629c2[_0x8d33('0x67')]||0x1f4;logger[_0x8d33('0x2c')](_0x8d33('0x68'),_0x8d33('0x69'),_0x403703,JSON[_0x8d33('0x6a')](_0x5629c2));delete _0x5629c2[_0x8d33('0x2e')];if(_0x403703===0x191){_0x403703=0x190;}_0x4e44a2[_0x8d33('0x1f')](_0x403703)[_0x8d33('0x6b')](_0x301209[_0x8d33('0x36')][_0x8d33('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x5629c2[_0x8d33('0x67')]}:_0x5629c2);});}; \ No newline at end of file +var _0x31af=['apiKey','slice','substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','send','rimraf','zip-dir','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','destroy','then','error','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','update','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','channel','Descriptions','getDescriptions','Subjects','getFields','username','remoteUri'];(function(_0x1ab18c,_0x4ea101){var _0x1fddb7=function(_0x4d1276){while(--_0x4d1276){_0x1ab18c['push'](_0x1ab18c['shift']());}};_0x1fddb7(++_0x4ea101);}(_0x31af,0x13b));var _0xf31a=function(_0x2ca1c3,_0x530fe0){_0x2ca1c3=_0x2ca1c3-0x0;var _0xff9b52=_0x31af[_0x2ca1c3];return _0xff9b52;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf31a('0x0'));var zipdir=require(_0xf31a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf31a('0x2'));var BPromise=require(_0xf31a('0x3'));var Mustache=require(_0xf31a('0x4'));var util=require('util');var path=require('path');var sox=require(_0xf31a('0x5'));var csv=require('to-csv');var ejs=require(_0xf31a('0x6'));var fs=require('fs');var fs_extra=require(_0xf31a('0x7'));var _=require(_0xf31a('0x8'));var squel=require(_0xf31a('0x9'));var crypto=require(_0xf31a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf31a('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf31a('0xc'));var Papa=require('papaparse');var Redis=require(_0xf31a('0xd'));var authService=require(_0xf31a('0xe'));var qs=require(_0xf31a('0xf'));var as=require(_0xf31a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf31a('0x11'))('api');var utils=require(_0xf31a('0x12'));var config=require(_0xf31a('0x13'));var licenseUtil=require(_0xf31a('0x14'));var db=require(_0xf31a('0x15'))['db'];var integrations=require(_0xf31a('0x16'));function respondWithStatusCode(_0x2c418d,_0xaca552){_0xaca552=_0xaca552||0xcc;return function(_0x3cec8f){if(_0x3cec8f){return _0x2c418d[_0xf31a('0x17')](_0xaca552);}return _0x2c418d['status'](_0xaca552)[_0xf31a('0x18')]();};}function respondWithResult(_0xda07ee,_0xd3101e){_0xd3101e=_0xd3101e||0xc8;return function(_0x4f7da7){if(_0x4f7da7){return _0xda07ee[_0xf31a('0x19')](_0xd3101e)[_0xf31a('0x1a')](_0x4f7da7);}};}function respondWithFilteredResult(_0x427383,_0x1c34e6){return function(_0x5db62b){if(_0x5db62b){var _0x5768d7=typeof _0x1c34e6[_0xf31a('0x1b')]==='undefined'&&typeof _0x1c34e6['limit']===_0xf31a('0x1c');var _0xe2de54=_0x5db62b['count'];var _0x317b5d=_0x5768d7?0x0:_0x1c34e6[_0xf31a('0x1b')];var _0xb27ff2=_0x5768d7?_0x5db62b[_0xf31a('0x1d')]:_0x1c34e6[_0xf31a('0x1b')]+_0x1c34e6[_0xf31a('0x1e')];var _0x34fd5e;if(_0xb27ff2>=_0xe2de54){_0xb27ff2=_0xe2de54;_0x34fd5e=0xc8;}else{_0x34fd5e=0xce;}_0x427383['status'](_0x34fd5e);return _0x427383['set'](_0xf31a('0x1f'),_0x317b5d+'-'+_0xb27ff2+'/'+_0xe2de54)[_0xf31a('0x1a')](_0x5db62b);}return null;};}function patchUpdates(_0x18e974){return function(_0x3f23dc){try{jsonpatch[_0xf31a('0x20')](_0x3f23dc,_0x18e974,!![]);}catch(_0x15a22d){return BPromise[_0xf31a('0x21')](_0x15a22d);}return _0x3f23dc[_0xf31a('0x22')]();};}function saveUpdates(_0x2eeb3a,_0xd9e755){return function(_0x2e0f3d){if(_0x2e0f3d){return _0x2e0f3d['update'](_0x2eeb3a)['then'](function(_0x4dbdcc){return _0x4dbdcc;});}return null;};}function removeEntity(_0x11aecf,_0x40ae3d){return function(_0x163ca2){if(_0x163ca2){return _0x163ca2[_0xf31a('0x23')]()[_0xf31a('0x24')](function(){_0x11aecf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49f57a,_0x136fe9){return function(_0xe42457){if(!_0xe42457){_0x49f57a[_0xf31a('0x17')](0x194);}return _0xe42457;};}function handleError(_0x13e8e7,_0x6029b8){_0x6029b8=_0x6029b8||0x1f4;return function(_0xf5a52f){logger[_0xf31a('0x25')](_0xf5a52f[_0xf31a('0x26')]);if(_0xf5a52f[_0xf31a('0x27')]){delete _0xf5a52f['name'];}_0x13e8e7[_0xf31a('0x19')](_0x6029b8)['send'](_0xf5a52f);};}exports[_0xf31a('0x28')]=function(_0xe2a275,_0x2e250b){var _0x383c0c={},_0x5b712d={},_0x41331a={'count':0x0,'rows':[]};var _0x1b8ced=_[_0xf31a('0x29')](db[_0xf31a('0x2a')][_0xf31a('0x2b')],function(_0x2e2ea6){return{'name':_0x2e2ea6[_0xf31a('0x2c')],'type':_0x2e2ea6['type'][_0xf31a('0x2d')]};});_0x5b712d[_0xf31a('0x2e')]=_[_0xf31a('0x29')](_0x1b8ced,_0xf31a('0x27'));_0x5b712d['query']=_[_0xf31a('0x2f')](_0xe2a275[_0xf31a('0x30')]);_0x5b712d['filters']=_[_0xf31a('0x31')](_0x5b712d['model'],_0x5b712d[_0xf31a('0x30')]);_0x383c0c[_0xf31a('0x32')]=_[_0xf31a('0x31')](_0x5b712d['model'],qs[_0xf31a('0x33')](_0xe2a275['query']['fields']));_0x383c0c[_0xf31a('0x32')]=_0x383c0c['attributes'][_0xf31a('0x34')]?_0x383c0c[_0xf31a('0x32')]:_0x5b712d[_0xf31a('0x2e')];if(!_0xe2a275[_0xf31a('0x30')][_0xf31a('0x35')](_0xf31a('0x36'))){_0x383c0c[_0xf31a('0x1e')]=qs[_0xf31a('0x1e')](_0xe2a275['query']['limit']);_0x383c0c[_0xf31a('0x1b')]=qs[_0xf31a('0x1b')](_0xe2a275[_0xf31a('0x30')][_0xf31a('0x1b')]);}_0x383c0c['order']=qs['sort'](_0xe2a275[_0xf31a('0x30')][_0xf31a('0x37')]);_0x383c0c[_0xf31a('0x38')]=qs['filters'](_[_0xf31a('0x39')](_0xe2a275[_0xf31a('0x30')],_0x5b712d[_0xf31a('0x3a')]),_0x1b8ced);if(_0xe2a275[_0xf31a('0x30')][_0xf31a('0x3b')]){_0x383c0c[_0xf31a('0x38')]=_[_0xf31a('0x3c')](_0x383c0c['where'],{'$or':_[_0xf31a('0x29')](_0x1b8ced,function(_0x1cd6c2){if(_0x1cd6c2[_0xf31a('0x3d')]!==_0xf31a('0x3e')){var _0x3119e6={};_0x3119e6[_0x1cd6c2[_0xf31a('0x27')]]={'$like':'%'+_0xe2a275[_0xf31a('0x30')]['filter']+'%'};return _0x3119e6;}})});}_0x383c0c=_[_0xf31a('0x3c')]({},_0x383c0c,_0xe2a275[_0xf31a('0x3f')]);var _0xdf2948={'where':_0x383c0c[_0xf31a('0x38')]};return db[_0xf31a('0x2a')][_0xf31a('0x1d')](_0xdf2948)[_0xf31a('0x24')](function(_0x3ed303){_0x41331a[_0xf31a('0x1d')]=_0x3ed303;if(_0xe2a275[_0xf31a('0x30')][_0xf31a('0x40')]){_0x383c0c[_0xf31a('0x41')]=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x383c0c);})[_0xf31a('0x24')](function(_0x51f8ca){_0x41331a['rows']=_0x51f8ca;return _0x41331a;})[_0xf31a('0x24')](respondWithFilteredResult(_0x2e250b,_0x383c0c))[_0xf31a('0x42')](handleError(_0x2e250b,null));};exports[_0xf31a('0x43')]=function(_0x3d8c18,_0x44502a){var _0xf25768={'raw':![],'where':{'id':_0x3d8c18[_0xf31a('0x44')]['id']}},_0x53a60b={};_0x53a60b['model']=_[_0xf31a('0x2f')](db[_0xf31a('0x2a')][_0xf31a('0x2b')]);_0x53a60b[_0xf31a('0x30')]=_['keys'](_0x3d8c18[_0xf31a('0x30')]);_0x53a60b[_0xf31a('0x3a')]=_[_0xf31a('0x31')](_0x53a60b[_0xf31a('0x2e')],_0x53a60b[_0xf31a('0x30')]);_0xf25768[_0xf31a('0x32')]=_[_0xf31a('0x31')](_0x53a60b['model'],qs['fields'](_0x3d8c18[_0xf31a('0x30')]['fields']));_0xf25768[_0xf31a('0x32')]=_0xf25768[_0xf31a('0x32')][_0xf31a('0x34')]?_0xf25768['attributes']:_0x53a60b['model'];if(_0x3d8c18[_0xf31a('0x30')][_0xf31a('0x40')]){_0xf25768['include']=[{'all':!![]}];}_0xf25768=_[_0xf31a('0x3c')]({},_0xf25768,_0x3d8c18[_0xf31a('0x3f')]);return db['FreshsalesAccount'][_0xf31a('0x45')](_0xf25768)['then'](handleEntityNotFound(_0x44502a,null))['then'](respondWithResult(_0x44502a,null))[_0xf31a('0x42')](handleError(_0x44502a,null));};exports['create']=function(_0x599c55,_0x204d9e){return db['FreshsalesAccount'][_0xf31a('0x46')](_0x599c55[_0xf31a('0x47')],{})[_0xf31a('0x24')](respondWithResult(_0x204d9e,0xc9))['catch'](handleError(_0x204d9e,null));};exports[_0xf31a('0x48')]=function(_0x14c165,_0x4fa14a){if(_0x14c165[_0xf31a('0x47')]['id']){delete _0x14c165['body']['id'];}return db[_0xf31a('0x2a')][_0xf31a('0x45')]({'where':{'id':_0x14c165['params']['id']}})[_0xf31a('0x24')](handleEntityNotFound(_0x4fa14a,null))['then'](saveUpdates(_0x14c165[_0xf31a('0x47')],null))[_0xf31a('0x24')](respondWithResult(_0x4fa14a,null))[_0xf31a('0x42')](handleError(_0x4fa14a,null));};exports[_0xf31a('0x23')]=function(_0x2aaa63,_0x44d916){return db[_0xf31a('0x2a')][_0xf31a('0x45')]({'where':{'id':_0x2aaa63[_0xf31a('0x44')]['id']}})[_0xf31a('0x24')](handleEntityNotFound(_0x44d916,null))[_0xf31a('0x24')](removeEntity(_0x44d916,null))[_0xf31a('0x42')](handleError(_0x44d916,null));};exports[_0xf31a('0x49')]=function(_0x175911,_0x16316e,_0x8daad3){var _0x52f5b9={};var _0x1897ea={};var _0x3973b5;var _0x1a6f30;return db[_0xf31a('0x2a')][_0xf31a('0x4a')]({'where':{'id':_0x175911[_0xf31a('0x44')]['id']}})[_0xf31a('0x24')](handleEntityNotFound(_0x16316e,null))[_0xf31a('0x24')](function(_0x11942b){if(_0x11942b){_0x3973b5=_0x11942b;_0x1897ea[_0xf31a('0x2e')]=_[_0xf31a('0x2f')](db[_0xf31a('0x4b')][_0xf31a('0x2b')]);_0x1897ea[_0xf31a('0x30')]=_[_0xf31a('0x2f')](_0x175911[_0xf31a('0x30')]);_0x1897ea[_0xf31a('0x3a')]=_['intersection'](_0x1897ea[_0xf31a('0x2e')],_0x1897ea[_0xf31a('0x30')]);_0x52f5b9['attributes']=_[_0xf31a('0x31')](_0x1897ea['model'],qs[_0xf31a('0x33')](_0x175911[_0xf31a('0x30')]['fields']));_0x52f5b9[_0xf31a('0x32')]=_0x52f5b9[_0xf31a('0x32')][_0xf31a('0x34')]?_0x52f5b9[_0xf31a('0x32')]:_0x1897ea[_0xf31a('0x2e')];_0x52f5b9['order']=qs[_0xf31a('0x37')](_0x175911[_0xf31a('0x30')][_0xf31a('0x37')]);_0x52f5b9[_0xf31a('0x38')]=qs[_0xf31a('0x3a')](_[_0xf31a('0x39')](_0x175911[_0xf31a('0x30')],_0x1897ea[_0xf31a('0x3a')]));if(_0x175911[_0xf31a('0x30')][_0xf31a('0x3b')]){_0x52f5b9['where']=_[_0xf31a('0x3c')](_0x52f5b9['where'],{'$or':_[_0xf31a('0x29')](_0x52f5b9[_0xf31a('0x32')],function(_0x3e3e7e){var _0x478d10={};_0x478d10[_0x3e3e7e]={'$like':'%'+_0x175911[_0xf31a('0x30')]['filter']+'%'};return _0x478d10;})});}_0x52f5b9=_[_0xf31a('0x3c')]({},_0x52f5b9,_0x175911[_0xf31a('0x3f')]);return _0x3973b5[_0xf31a('0x49')](_0x52f5b9);}})[_0xf31a('0x24')](function(_0x182fd0){if(_0x182fd0){_0x1a6f30=_0x182fd0[_0xf31a('0x34')];if(!_0x175911[_0xf31a('0x30')][_0xf31a('0x35')]('nolimit')){_0x52f5b9[_0xf31a('0x1e')]=qs[_0xf31a('0x1e')](_0x175911[_0xf31a('0x30')]['limit']);_0x52f5b9[_0xf31a('0x1b')]=qs['offset'](_0x175911['query']['offset']);}return _0x3973b5[_0xf31a('0x49')](_0x52f5b9);}})[_0xf31a('0x24')](function(_0x4980bc){if(_0x4980bc){return _0x4980bc?{'count':_0x1a6f30,'rows':_0x4980bc}:null;}})[_0xf31a('0x24')](respondWithResult(_0x16316e,null))['catch'](handleError(_0x16316e,null));};exports[_0xf31a('0x4c')]=function(_0x53652d,_0x3ee5c4,_0x390a6a){if(_0x53652d[_0xf31a('0x47')]['id']){delete _0x53652d[_0xf31a('0x47')]['id'];}return db[_0xf31a('0x2a')][_0xf31a('0x4a')]({'where':{'id':_0x53652d[_0xf31a('0x44')]['id']}})['then'](handleEntityNotFound(_0x3ee5c4,null))['then'](function(_0x1197e1){if(_0x1197e1){_0x53652d[_0xf31a('0x47')][_0xf31a('0x4d')]=_0x1197e1['id'];_0x53652d[_0xf31a('0x47')]['Subjects']=integrations['getSubjects'](_0x53652d[_0xf31a('0x47')][_0xf31a('0x4e')],_0x53652d[_0xf31a('0x47')][_0xf31a('0x3d')]);_0x53652d['body'][_0xf31a('0x4f')]=integrations[_0xf31a('0x50')](_0x53652d['body'][_0xf31a('0x4e')],_0x53652d[_0xf31a('0x47')][_0xf31a('0x3d')]);return db['FreshsalesConfiguration']['create'](_0x53652d['body'],{'include':[{'model':db['FreshsalesField'],'as':_0xf31a('0x51')},{'model':db['FreshsalesField'],'as':_0xf31a('0x4f')}]});}return null;})[_0xf31a('0x24')](respondWithResult(_0x3ee5c4,null))[_0xf31a('0x42')](handleError(_0x3ee5c4,null));};exports[_0xf31a('0x52')]=function(_0x1a7c35,_0x6c5af5,_0x35589e){var _0x13d553='';var _0x18627a='';return db[_0xf31a('0x2a')][_0xf31a('0x4a')]({'where':{'id':_0x1a7c35[_0xf31a('0x44')]['id']},'attributes':['id',_0xf31a('0x53'),_0xf31a('0x54'),_0xf31a('0x55')]})[_0xf31a('0x24')](handleEntityNotFound(_0x6c5af5,null))[_0xf31a('0x24')](function(_0x2adc94){if(_0x2adc94){_0x18627a=_0x2adc94[_0xf31a('0x53')];_0x13d553=_0x2adc94[_0xf31a('0x54')];var _0x104ebd=_0x2adc94['remoteUri'][_0xf31a('0x56')](-0x1);if(_0x104ebd==='/'){_0x13d553=_0x13d553[_0xf31a('0x57')](0x0,_0x13d553[_0xf31a('0x58')](_0x104ebd));}return rp({'method':_0xf31a('0x59'),'uri':util[_0xf31a('0x5a')]('%s%s',_0x13d553,_0xf31a('0x5b')),'headers':{'Authorization':_0xf31a('0x5c')+_0x2adc94[_0xf31a('0x55')]},'json':!![]});}})[_0xf31a('0x24')](function(_0x2fd037){if(_0x2fd037){var _0x3fadfa=_0x2fd037[_0xf31a('0x5d')];var _0x248654=![];var _0x54640c=null;for(_0x54640c=0x0;_0x54640c<_0x3fadfa[_0xf31a('0x34')];_0x54640c++){if(_0x3fadfa[_0x54640c][_0xf31a('0x5e')]===_0x18627a){_0x248654=!![];}}if(_0x248654){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xf31a('0x5f')});}}})[_0xf31a('0x24')](respondWithResult(_0x6c5af5,null))[_0xf31a('0x42')](function(_0x4757ec){var _0x5857a6=_0x1a7c35[_0xf31a('0x30')][_0xf31a('0x60')]?0x1f4:_0x4757ec[_0xf31a('0x61')]||0x1f4;logger[_0xf31a('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5857a6,JSON[_0xf31a('0x62')](_0x4757ec));delete _0x4757ec[_0xf31a('0x27')];if(_0x5857a6===0x191){_0x5857a6=0x190;}_0x6c5af5[_0xf31a('0x19')](_0x5857a6)[_0xf31a('0x63')](_0x1a7c35['query'][_0xf31a('0x60')]?{'message':'Wrong\x20credentials','statusCode':_0x4757ec[_0xf31a('0x61')]}:_0x4757ec);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index c90b315..bd224bb 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 _0x82c4=['define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshsalesAccount.attributes','exports'];(function(_0x2d0e02,_0x4599c3){var _0xc66090=function(_0x53e8ee){while(--_0x53e8ee){_0x2d0e02['push'](_0x2d0e02['shift']());}};_0xc66090(++_0x4599c3);}(_0x82c4,0x1ca));var _0x482c=function(_0xf83ad3,_0x1540cb){_0xf83ad3=_0xf83ad3-0x0;var _0x2ff6c8=_0x82c4[_0xf83ad3];return _0x2ff6c8;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x482c('0x9')]=function(_0x5d7c76,_0xfdb92){return _0x5d7c76[_0x482c('0xa')](_0x482c('0xb'),attributes,{'tableName':_0x482c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4991=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4991,0xf7));var _0x1499=function(_0x1a4494,_0x1879ec){_0x1a4494=_0x1a4494-0x0;var _0x37eb3d=_0x4991[_0x1a4494];return _0x37eb3d;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var logger=require(_0x1499('0x1'))('api');var moment=require(_0x1499('0x2'));var BPromise=require(_0x1499('0x3'));var rp=require(_0x1499('0x4'));var fs=require('fs');var path=require(_0x1499('0x5'));var rimraf=require(_0x1499('0x6'));var config=require(_0x1499('0x7'));var attributes=require(_0x1499('0x8'));var integrations=require(_0x1499('0x9'));module['exports']=function(_0x2a8e96,_0x1c3bd7){return _0x2a8e96[_0x1499('0xa')](_0x1499('0xb'),attributes,{'tableName':_0x1499('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 369a64e..a59cf0d 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 _0x68b3=['include','map','model','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit'];(function(_0x4eda22,_0x19d072){var _0x1021ef=function(_0x11c147){while(--_0x11c147){_0x4eda22['push'](_0x4eda22['shift']());}};_0x1021ef(++_0x19d072);}(_0x68b3,0x1d8));var _0x368b=function(_0x920bf8,_0x3d44cd){_0x920bf8=_0x920bf8-0x0;var _0x39cce4=_0x68b3[_0x920bf8];return _0x39cce4;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var BPromise=require(_0x368b('0x3'));var rs=require(_0x368b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x368b('0x5'))['db'];var utils=require(_0x368b('0x6'));var logger=require(_0x368b('0x7'))(_0x368b('0x8'));var config=require('../../config/environment');var jayson=require(_0x368b('0x9'));var client=jayson[_0x368b('0xa')][_0x368b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23584a,_0x4406c8,_0x127c1e){return new BPromise(function(_0x2dec1c,_0x142d05){return client[_0x368b('0xc')](_0x23584a,_0x127c1e)[_0x368b('0xd')](function(_0x2a7b9f){logger['info'](_0x368b('0xe'),_0x4406c8,_0x368b('0xf'));logger[_0x368b('0x10')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x4406c8,_0x368b('0xf'),JSON[_0x368b('0x11')](_0x2a7b9f));if(_0x2a7b9f[_0x368b('0x12')]){if(_0x2a7b9f['error'][_0x368b('0x13')]===0x1f4){logger[_0x368b('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x142d05(_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);}logger[_0x368b('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x2dec1c(_0x2a7b9f['error'][_0x368b('0x14')]);}else{logger[_0x368b('0x15')](_0x368b('0xe'),_0x4406c8,'request\x20sent');_0x2dec1c(_0x2a7b9f[_0x368b('0x16')][_0x368b('0x14')]);}})[_0x368b('0x17')](function(_0x4d6d9d){logger[_0x368b('0x12')](_0x368b('0xe'),_0x4406c8,_0x4d6d9d);_0x142d05(_0x4d6d9d);});});}exports[_0x368b('0x18')]=function(_0x540f57){var _0x5d543e=this;return new Promise(function(_0x3e2e9f,_0x27d2a0){return db[_0x368b('0x19')][_0x368b('0x1a')]({'raw':_0x540f57[_0x368b('0x1b')]?_0x540f57['options'][_0x368b('0x1c')]===undefined?!![]:![]:!![],'where':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x1d')]||null:null,'attributes':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x1e')]||null:null,'limit':_0x540f57[_0x368b('0x1b')]?_0x540f57['options'][_0x368b('0x1f')]||null:null,'include':_0x540f57[_0x368b('0x1b')]?_0x540f57[_0x368b('0x1b')][_0x368b('0x20')]?_[_0x368b('0x21')](_0x540f57['options'][_0x368b('0x20')],function(_0x1ca429){return{'model':db[_0x1ca429[_0x368b('0x22')]],'as':_0x1ca429['as'],'attributes':_0x1ca429[_0x368b('0x1e')],'include':_0x1ca429[_0x368b('0x20')]?_[_0x368b('0x21')](_0x1ca429[_0x368b('0x20')],function(_0x11ea2d){return{'model':db[_0x11ea2d[_0x368b('0x22')]],'as':_0x11ea2d['as'],'attributes':_0x11ea2d[_0x368b('0x1e')],'include':_0x11ea2d[_0x368b('0x20')]?_[_0x368b('0x21')](_0x11ea2d[_0x368b('0x20')],function(_0x376e61){return{'model':db[_0x376e61[_0x368b('0x22')]],'as':_0x376e61['as'],'attributes':_0x376e61[_0x368b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x368b('0xd')](function(_0x9f192e){logger[_0x368b('0x15')](_0x368b('0x18'),_0x540f57);logger[_0x368b('0x10')](_0x368b('0x18'),_0x540f57,JSON[_0x368b('0x11')](_0x9f192e));_0x3e2e9f(_0x9f192e);})[_0x368b('0x17')](function(_0x5db0b4){logger['error'](_0x368b('0x18'),_0x5db0b4[_0x368b('0x14')],_0x540f57);_0x27d2a0(_0x5d543e[_0x368b('0x12')](0x1f4,_0x5db0b4[_0x368b('0x14')]));});});};exports['ShowFreshsalesAccount']=function(_0x12ae59){var _0x1f3ed3=this;return new Promise(function(_0x3699fe,_0x1c68ca){return db[_0x368b('0x19')]['find']({'raw':_0x12ae59[_0x368b('0x1b')]?_0x12ae59[_0x368b('0x1b')][_0x368b('0x1c')]===undefined?!![]:![]:!![],'where':_0x12ae59[_0x368b('0x1b')]?_0x12ae59['options']['where']||null:null,'attributes':_0x12ae59['options']?_0x12ae59[_0x368b('0x1b')][_0x368b('0x1e')]||null:null,'include':_0x12ae59[_0x368b('0x1b')]?_0x12ae59[_0x368b('0x1b')][_0x368b('0x20')]?_['map'](_0x12ae59[_0x368b('0x1b')][_0x368b('0x20')],function(_0x54e7e5){return{'model':db[_0x54e7e5[_0x368b('0x22')]],'as':_0x54e7e5['as'],'attributes':_0x54e7e5[_0x368b('0x1e')],'include':_0x54e7e5['include']?_[_0x368b('0x21')](_0x54e7e5[_0x368b('0x20')],function(_0x4a3044){return{'model':db[_0x4a3044[_0x368b('0x22')]],'as':_0x4a3044['as'],'attributes':_0x4a3044['attributes'],'include':_0x4a3044['include']?_['map'](_0x4a3044[_0x368b('0x20')],function(_0x4d6f22){return{'model':db[_0x4d6f22[_0x368b('0x22')]],'as':_0x4d6f22['as'],'attributes':_0x4d6f22[_0x368b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x368b('0xd')](function(_0xd0f23f){logger[_0x368b('0x15')](_0x368b('0x23'),_0x12ae59);logger[_0x368b('0x10')](_0x368b('0x23'),_0x12ae59,JSON['stringify'](_0xd0f23f));_0x3699fe(_0xd0f23f);})[_0x368b('0x17')](function(_0x1f60ea){logger['error'](_0x368b('0x23'),_0x1f60ea[_0x368b('0x14')],_0x12ae59);_0x1c68ca(_0x1f3ed3[_0x368b('0x12')](0x1f4,_0x1f60ea[_0x368b('0x14')]));});});}; \ No newline at end of file +var _0x8e3f=['FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','limit','include','model','attributes','map','stringify','ShowFreshsalesAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1988b0,_0x1fa6a0){var _0x1240b2=function(_0x43d24c){while(--_0x43d24c){_0x1988b0['push'](_0x1988b0['shift']());}};_0x1240b2(++_0x1fa6a0);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8e3f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ee9f3,_0x4e9e57,_0x4504dd){return new BPromise(function(_0x2e39b7,_0x17f56c){return client[_0xf8e3('0xb')](_0x1ee9f3,_0x4504dd)[_0xf8e3('0xc')](function(_0x4055e2){logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));logger[_0xf8e3('0x10')](_0xf8e3('0x11'),_0x4e9e57,_0xf8e3('0xf'),JSON['stringify'](_0x4055e2));if(_0x4055e2[_0xf8e3('0x12')]){if(_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x13')]===0x1f4){logger['error'](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x14')]);return _0x17f56c(_0x4055e2[_0xf8e3('0x12')]['message']);}logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')]['message']);return _0x2e39b7(_0x4055e2[_0xf8e3('0x12')]['message']);}else{logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));_0x2e39b7(_0x4055e2['result']['message']);}})[_0xf8e3('0x15')](function(_0x385dde){logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x385dde);_0x17f56c(_0x385dde);});});}exports[_0xf8e3('0x16')]=function(_0x11d4cc){var _0x7a81c3=this;return new Promise(function(_0x2e27e3,_0x1337ae){return db[_0xf8e3('0x17')]['findAll']({'raw':_0x11d4cc[_0xf8e3('0x18')]?_0x11d4cc[_0xf8e3('0x18')][_0xf8e3('0x19')]===undefined?!![]:![]:!![],'where':_0x11d4cc[_0xf8e3('0x18')]?_0x11d4cc[_0xf8e3('0x18')][_0xf8e3('0x1a')]||null:null,'attributes':_0x11d4cc[_0xf8e3('0x18')]?_0x11d4cc[_0xf8e3('0x18')]['attributes']||null:null,'limit':_0x11d4cc[_0xf8e3('0x18')]?_0x11d4cc[_0xf8e3('0x18')][_0xf8e3('0x1b')]||null:null,'include':_0x11d4cc[_0xf8e3('0x18')]?_0x11d4cc['options'][_0xf8e3('0x1c')]?_['map'](_0x11d4cc[_0xf8e3('0x18')][_0xf8e3('0x1c')],function(_0x33d526){return{'model':db[_0x33d526[_0xf8e3('0x1d')]],'as':_0x33d526['as'],'attributes':_0x33d526[_0xf8e3('0x1e')],'include':_0x33d526[_0xf8e3('0x1c')]?_['map'](_0x33d526[_0xf8e3('0x1c')],function(_0x2fc674){return{'model':db[_0x2fc674[_0xf8e3('0x1d')]],'as':_0x2fc674['as'],'attributes':_0x2fc674[_0xf8e3('0x1e')],'include':_0x2fc674[_0xf8e3('0x1c')]?_[_0xf8e3('0x1f')](_0x2fc674[_0xf8e3('0x1c')],function(_0x157a2d){return{'model':db[_0x157a2d['model']],'as':_0x157a2d['as'],'attributes':_0x157a2d[_0xf8e3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf8e3('0xc')](function(_0x12ebd2){logger[_0xf8e3('0xd')](_0xf8e3('0x16'),_0x11d4cc);logger[_0xf8e3('0x10')](_0xf8e3('0x16'),_0x11d4cc,JSON[_0xf8e3('0x20')](_0x12ebd2));_0x2e27e3(_0x12ebd2);})['catch'](function(_0x21e1c0){logger[_0xf8e3('0x12')](_0xf8e3('0x16'),_0x21e1c0[_0xf8e3('0x14')],_0x11d4cc);_0x1337ae(_0x7a81c3['error'](0x1f4,_0x21e1c0[_0xf8e3('0x14')]));});});};exports[_0xf8e3('0x21')]=function(_0x40f64d){var _0x45df49=this;return new Promise(function(_0x33f208,_0x46c85d){return db[_0xf8e3('0x17')][_0xf8e3('0x22')]({'raw':_0x40f64d['options']?_0x40f64d[_0xf8e3('0x18')][_0xf8e3('0x19')]===undefined?!![]:![]:!![],'where':_0x40f64d['options']?_0x40f64d['options']['where']||null:null,'attributes':_0x40f64d[_0xf8e3('0x18')]?_0x40f64d['options'][_0xf8e3('0x1e')]||null:null,'include':_0x40f64d[_0xf8e3('0x18')]?_0x40f64d[_0xf8e3('0x18')][_0xf8e3('0x1c')]?_['map'](_0x40f64d['options'][_0xf8e3('0x1c')],function(_0x2f87d8){return{'model':db[_0x2f87d8[_0xf8e3('0x1d')]],'as':_0x2f87d8['as'],'attributes':_0x2f87d8[_0xf8e3('0x1e')],'include':_0x2f87d8[_0xf8e3('0x1c')]?_[_0xf8e3('0x1f')](_0x2f87d8['include'],function(_0x1afead){return{'model':db[_0x1afead['model']],'as':_0x1afead['as'],'attributes':_0x1afead['attributes'],'include':_0x1afead[_0xf8e3('0x1c')]?_[_0xf8e3('0x1f')](_0x1afead[_0xf8e3('0x1c')],function(_0x1b7af2){return{'model':db[_0x1b7af2['model']],'as':_0x1b7af2['as'],'attributes':_0x1b7af2['attributes']};}):[]};}):[]};}):[]:[]})[_0xf8e3('0xc')](function(_0x215183){logger['info'](_0xf8e3('0x21'),_0x40f64d);logger[_0xf8e3('0x10')](_0xf8e3('0x21'),_0x40f64d,JSON[_0xf8e3('0x20')](_0x215183));_0x33f208(_0x215183);})['catch'](function(_0x53cfea){logger['error'](_0xf8e3('0x21'),_0x53cfea[_0xf8e3('0x14')],_0x40f64d);_0x46c85d(_0x45df49[_0xf8e3('0x12')](0x1f4,_0x53cfea[_0xf8e3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 44a73de..96c1124 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 _0xd274=['create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','post'];(function(_0x4d389d,_0xec145d){var _0x22bd25=function(_0x22cd63){while(--_0x22cd63){_0x4d389d['push'](_0x4d389d['shift']());}};_0x22bd25(++_0xec145d);}(_0xd274,0xf6));var _0x4d27=function(_0x27007f,_0x2cab9a){_0x27007f=_0x27007f-0x0;var _0x2694d0=_0xd274[_0x27007f];return _0x2694d0;};'use strict';var multer=require(_0x4d27('0x0'));var util=require(_0x4d27('0x1'));var path=require(_0x4d27('0x2'));var timeout=require(_0x4d27('0x3'));var express=require('express');var router=express[_0x4d27('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4d27('0x5'));var config=require(_0x4d27('0x6'));var controller=require(_0x4d27('0x7'));router[_0x4d27('0x8')]('/',auth[_0x4d27('0x9')](),controller[_0x4d27('0xa')]);router[_0x4d27('0x8')]('/:id',auth[_0x4d27('0x9')](),controller[_0x4d27('0xb')]);router['get'](_0x4d27('0xc'),auth['isAuthenticated'](),controller[_0x4d27('0xd')]);router[_0x4d27('0x8')](_0x4d27('0xe'),auth[_0x4d27('0x9')](),controller['getDescriptions']);router[_0x4d27('0x8')](_0x4d27('0xf'),auth[_0x4d27('0x9')](),controller[_0x4d27('0x10')]);router[_0x4d27('0x11')]('/',auth[_0x4d27('0x9')](),controller[_0x4d27('0x12')]);router[_0x4d27('0x13')](_0x4d27('0x14'),auth[_0x4d27('0x9')](),controller[_0x4d27('0x15')]);router['delete'](_0x4d27('0x14'),auth[_0x4d27('0x9')](),controller[_0x4d27('0x16')]);module[_0x4d27('0x17')]=router; \ No newline at end of file +var _0x2d02=['/:id/subjects','/:id/descriptions','getDescriptions','getFields','post','create','/:id','update','delete','exports','util','path','../../components/interaction/service','./intFreshsalesConfiguration.controller','index','get','isAuthenticated','show'];(function(_0xa4a2fe,_0x1b8164){var _0x565c0f=function(_0x4ededf){while(--_0x4ededf){_0xa4a2fe['push'](_0xa4a2fe['shift']());}};_0x565c0f(++_0x1b8164);}(_0x2d02,0x1cc));var _0x22d0=function(_0x3cfcb9,_0x23afe8){_0x3cfcb9=_0x3cfcb9-0x0;var _0x53435f=_0x2d02[_0x3cfcb9];return _0x53435f;};'use strict';var multer=require('multer');var util=require(_0x22d0('0x0'));var path=require(_0x22d0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x22d0('0x2'));var config=require('../../config/environment');var controller=require(_0x22d0('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0x22d0('0x4')]);router[_0x22d0('0x5')]('/:id',auth[_0x22d0('0x6')](),controller[_0x22d0('0x7')]);router[_0x22d0('0x5')](_0x22d0('0x8'),auth[_0x22d0('0x6')](),controller['getSubjects']);router['get'](_0x22d0('0x9'),auth['isAuthenticated'](),controller[_0x22d0('0xa')]);router[_0x22d0('0x5')]('/:id/fields',auth[_0x22d0('0x6')](),controller[_0x22d0('0xb')]);router[_0x22d0('0xc')]('/',auth['isAuthenticated'](),controller[_0x22d0('0xd')]);router['put'](_0x22d0('0xe'),auth[_0x22d0('0x6')](),controller[_0x22d0('0xf')]);router[_0x22d0('0x10')](_0x22d0('0xe'),auth[_0x22d0('0x6')](),controller['destroy']);module[_0x22d0('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 0d580f1..486e44d 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 _0x4a95=['sequelize','exports','STRING'];(function(_0x1b62f1,_0x4ed920){var _0x161866=function(_0x4b6043){while(--_0x4b6043){_0x1b62f1['push'](_0x1b62f1['shift']());}};_0x161866(++_0x4ed920);}(_0x4a95,0x11a));var _0x54a9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4a95[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x54a9('0x0'));module[_0x54a9('0x1')]={'name':{'type':Sequelize[_0x54a9('0x2')]},'description':{'type':Sequelize[_0x54a9('0x2')]}}; \ No newline at end of file +var _0x3fd7=['exports','STRING','sequelize'];(function(_0x1c9762,_0x3ba902){var _0x34df82=function(_0x628e27){while(--_0x628e27){_0x1c9762['push'](_0x1c9762['shift']());}};_0x34df82(++_0x3ba902);}(_0x3fd7,0x1d0));var _0x73fd=function(_0x1a1d9b,_0x5ea65a){_0x1a1d9b=_0x1a1d9b-0x0;var _0x1d7a59=_0x3fd7[_0x1a1d9b];return _0x1d7a59;};'use strict';var Sequelize=require(_0x73fd('0x0'));module[_0x73fd('0x1')]={'name':{'type':Sequelize[_0x73fd('0x2')]},'description':{'type':Sequelize[_0x73fd('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 04b2d7a..9b773bc 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 _0xa147=['undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','fieldName','type','key','model','filters','intersection','fields','query','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','catch','show','params','keys','rawAttributes','length','includeAll','options','find','create','body','getSubjects','findOne','getDescriptions','FreshsalesField','hasOwnProperty','getFields','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x418874,_0x3c4c7e){var _0x1420e4=function(_0x26b306){while(--_0x26b306){_0x418874['push'](_0x418874['shift']());}};_0x1420e4(++_0x3c4c7e);}(_0xa147,0x83));var _0x7a14=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xa147[_0x50007c];return _0x5c1ec7;};'use strict';var emlformat=require(_0x7a14('0x0'));var rimraf=require(_0x7a14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7a14('0x2'));var moment=require(_0x7a14('0x3'));var BPromise=require(_0x7a14('0x4'));var Mustache=require(_0x7a14('0x5'));var util=require(_0x7a14('0x6'));var path=require(_0x7a14('0x7'));var sox=require(_0x7a14('0x8'));var csv=require(_0x7a14('0x9'));var ejs=require(_0x7a14('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7a14('0xb'));var crypto=require(_0x7a14('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7a14('0x9'));var querystring=require(_0x7a14('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7a14('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a14('0xf'));var logger=require('../../config/logger')(_0x7a14('0x10'));var utils=require(_0x7a14('0x11'));var config=require(_0x7a14('0x12'));var licenseUtil=require(_0x7a14('0x13'));var db=require(_0x7a14('0x14'))['db'];function respondWithStatusCode(_0x5021d9,_0x3b9123){_0x3b9123=_0x3b9123||0xcc;return function(_0x415a59){if(_0x415a59){return _0x5021d9[_0x7a14('0x15')](_0x3b9123);}return _0x5021d9[_0x7a14('0x16')](_0x3b9123)[_0x7a14('0x17')]();};}function respondWithResult(_0xc014cb,_0x3eb0c5){_0x3eb0c5=_0x3eb0c5||0xc8;return function(_0x2dae4f){if(_0x2dae4f){return _0xc014cb[_0x7a14('0x16')](_0x3eb0c5)[_0x7a14('0x18')](_0x2dae4f);}};}function respondWithFilteredResult(_0x423ca7,_0x751179){return function(_0x5c7f41){if(_0x5c7f41){var _0x3e17b1=typeof _0x751179['offset']===_0x7a14('0x19')&&typeof _0x751179[_0x7a14('0x1a')]==='undefined';var _0x12686e=_0x5c7f41[_0x7a14('0x1b')];var _0x3a702e=_0x3e17b1?0x0:_0x751179[_0x7a14('0x1c')];var _0x527913=_0x3e17b1?_0x5c7f41[_0x7a14('0x1b')]:_0x751179[_0x7a14('0x1c')]+_0x751179[_0x7a14('0x1a')];var _0x2edb12;if(_0x527913>=_0x12686e){_0x527913=_0x12686e;_0x2edb12=0xc8;}else{_0x2edb12=0xce;}_0x423ca7[_0x7a14('0x16')](_0x2edb12);return _0x423ca7[_0x7a14('0x1d')](_0x7a14('0x1e'),_0x3a702e+'-'+_0x527913+'/'+_0x12686e)[_0x7a14('0x18')](_0x5c7f41);}return null;};}function patchUpdates(_0x2e48e4){return function(_0x5eb7e7){try{jsonpatch['apply'](_0x5eb7e7,_0x2e48e4,!![]);}catch(_0x51c204){return BPromise[_0x7a14('0x1f')](_0x51c204);}return _0x5eb7e7[_0x7a14('0x20')]();};}function saveUpdates(_0x432261,_0x1da078){return function(_0x4dc2f1){if(_0x4dc2f1){return _0x4dc2f1[_0x7a14('0x21')](_0x432261)[_0x7a14('0x22')](function(_0x36eae1){return _0x36eae1;});}return null;};}function removeEntity(_0x2f0b10,_0x2d549e){return function(_0x2867b0){if(_0x2867b0){return _0x2867b0[_0x7a14('0x23')]()[_0x7a14('0x22')](function(){_0x2f0b10[_0x7a14('0x16')](0xcc)[_0x7a14('0x17')]();});}};}function handleEntityNotFound(_0x280556,_0x4d4627){return function(_0x26e199){if(!_0x26e199){_0x280556[_0x7a14('0x15')](0x194);}return _0x26e199;};}function handleError(_0x24cc04,_0x404301){_0x404301=_0x404301||0x1f4;return function(_0x122a89){logger[_0x7a14('0x24')](_0x122a89[_0x7a14('0x25')]);if(_0x122a89[_0x7a14('0x26')]){delete _0x122a89[_0x7a14('0x26')];}_0x24cc04[_0x7a14('0x16')](_0x404301)[_0x7a14('0x27')](_0x122a89);};}exports[_0x7a14('0x28')]=function(_0x17e975,_0x5756f9){var _0x5e8c5d={},_0x5742fe={},_0x2e4a92={'count':0x0,'rows':[]};var _0x13e8cc=_[_0x7a14('0x29')](db[_0x7a14('0x2a')]['rawAttributes'],function(_0x32fed6){return{'name':_0x32fed6[_0x7a14('0x2b')],'type':_0x32fed6[_0x7a14('0x2c')][_0x7a14('0x2d')]};});_0x5742fe[_0x7a14('0x2e')]=_[_0x7a14('0x29')](_0x13e8cc,_0x7a14('0x26'));_0x5742fe['query']=_['keys'](_0x17e975['query']);_0x5742fe[_0x7a14('0x2f')]=_['intersection'](_0x5742fe[_0x7a14('0x2e')],_0x5742fe['query']);_0x5e8c5d['attributes']=_[_0x7a14('0x30')](_0x5742fe[_0x7a14('0x2e')],qs[_0x7a14('0x31')](_0x17e975[_0x7a14('0x32')]['fields']));_0x5e8c5d[_0x7a14('0x33')]=_0x5e8c5d[_0x7a14('0x33')]['length']?_0x5e8c5d['attributes']:_0x5742fe[_0x7a14('0x2e')];if(!_0x17e975[_0x7a14('0x32')]['hasOwnProperty'](_0x7a14('0x34'))){_0x5e8c5d[_0x7a14('0x1a')]=qs[_0x7a14('0x1a')](_0x17e975[_0x7a14('0x32')][_0x7a14('0x1a')]);_0x5e8c5d[_0x7a14('0x1c')]=qs['offset'](_0x17e975['query'][_0x7a14('0x1c')]);}_0x5e8c5d[_0x7a14('0x35')]=qs[_0x7a14('0x36')](_0x17e975[_0x7a14('0x32')][_0x7a14('0x36')]);_0x5e8c5d[_0x7a14('0x37')]=qs[_0x7a14('0x2f')](_[_0x7a14('0x38')](_0x17e975['query'],_0x5742fe[_0x7a14('0x2f')]),_0x13e8cc);if(_0x17e975[_0x7a14('0x32')]['filter']){_0x5e8c5d[_0x7a14('0x37')]=_[_0x7a14('0x39')](_0x5e8c5d['where'],{'$or':_['map'](_0x13e8cc,function(_0x1a0575){if(_0x1a0575[_0x7a14('0x2c')]!==_0x7a14('0x3a')){var _0x4de36d={};_0x4de36d[_0x1a0575[_0x7a14('0x26')]]={'$like':'%'+_0x17e975[_0x7a14('0x32')][_0x7a14('0x3b')]+'%'};return _0x4de36d;}})});}_0x5e8c5d=_[_0x7a14('0x39')]({},_0x5e8c5d,_0x17e975['options']);var _0x2659a1={'where':_0x5e8c5d[_0x7a14('0x37')]};return db[_0x7a14('0x2a')][_0x7a14('0x1b')](_0x2659a1)['then'](function(_0x5f2c8c){_0x2e4a92[_0x7a14('0x1b')]=_0x5f2c8c;if(_0x17e975[_0x7a14('0x32')]['includeAll']){_0x5e8c5d[_0x7a14('0x3c')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x5e8c5d);})[_0x7a14('0x22')](function(_0x3ad4b4){_0x2e4a92['rows']=_0x3ad4b4;return _0x2e4a92;})[_0x7a14('0x22')](respondWithFilteredResult(_0x5756f9,_0x5e8c5d))[_0x7a14('0x3d')](handleError(_0x5756f9,null));};exports[_0x7a14('0x3e')]=function(_0x31d99e,_0xa6435e){var _0x1c8411={'raw':![],'where':{'id':_0x31d99e[_0x7a14('0x3f')]['id']}},_0x2ec626={};_0x2ec626[_0x7a14('0x2e')]=_[_0x7a14('0x40')](db[_0x7a14('0x2a')][_0x7a14('0x41')]);_0x2ec626[_0x7a14('0x32')]=_[_0x7a14('0x40')](_0x31d99e['query']);_0x2ec626['filters']=_[_0x7a14('0x30')](_0x2ec626[_0x7a14('0x2e')],_0x2ec626[_0x7a14('0x32')]);_0x1c8411['attributes']=_[_0x7a14('0x30')](_0x2ec626[_0x7a14('0x2e')],qs[_0x7a14('0x31')](_0x31d99e[_0x7a14('0x32')][_0x7a14('0x31')]));_0x1c8411[_0x7a14('0x33')]=_0x1c8411[_0x7a14('0x33')][_0x7a14('0x42')]?_0x1c8411[_0x7a14('0x33')]:_0x2ec626[_0x7a14('0x2e')];if(_0x31d99e[_0x7a14('0x32')][_0x7a14('0x43')]){_0x1c8411['include']=[{'all':!![]}];}_0x1c8411=_['merge']({},_0x1c8411,_0x31d99e[_0x7a14('0x44')]);return db[_0x7a14('0x2a')][_0x7a14('0x45')](_0x1c8411)['then'](handleEntityNotFound(_0xa6435e,null))[_0x7a14('0x22')](respondWithResult(_0xa6435e,null))[_0x7a14('0x3d')](handleError(_0xa6435e,null));};exports[_0x7a14('0x46')]=function(_0x3712ae,_0x56c4a7){return db[_0x7a14('0x2a')][_0x7a14('0x46')](_0x3712ae[_0x7a14('0x47')],{})[_0x7a14('0x22')](respondWithResult(_0x56c4a7,0xc9))[_0x7a14('0x3d')](handleError(_0x56c4a7,null));};exports[_0x7a14('0x21')]=function(_0x66bc23,_0x26a9b7){if(_0x66bc23['body']['id']){delete _0x66bc23[_0x7a14('0x47')]['id'];}return db[_0x7a14('0x2a')][_0x7a14('0x45')]({'where':{'id':_0x66bc23['params']['id']}})[_0x7a14('0x22')](handleEntityNotFound(_0x26a9b7,null))[_0x7a14('0x22')](saveUpdates(_0x66bc23[_0x7a14('0x47')],null))[_0x7a14('0x22')](respondWithResult(_0x26a9b7,null))[_0x7a14('0x3d')](handleError(_0x26a9b7,null));};exports[_0x7a14('0x23')]=function(_0x523c30,_0x1eb65e){return db[_0x7a14('0x2a')][_0x7a14('0x45')]({'where':{'id':_0x523c30[_0x7a14('0x3f')]['id']}})[_0x7a14('0x22')](handleEntityNotFound(_0x1eb65e,null))['then'](removeEntity(_0x1eb65e,null))[_0x7a14('0x3d')](handleError(_0x1eb65e,null));};exports[_0x7a14('0x48')]=function(_0x46bf0f,_0x571607,_0x38886d){var _0x44e6b0={};var _0x295597={};var _0x132f26;var _0x4c09a5;return db[_0x7a14('0x2a')][_0x7a14('0x49')]({'where':{'id':_0x46bf0f[_0x7a14('0x3f')]['id']}})[_0x7a14('0x22')](handleEntityNotFound(_0x571607,null))[_0x7a14('0x22')](function(_0x5d135b){if(_0x5d135b){_0x132f26=_0x5d135b;_0x295597[_0x7a14('0x2e')]=_['keys'](db['FreshsalesField'][_0x7a14('0x41')]);_0x295597[_0x7a14('0x32')]=_[_0x7a14('0x40')](_0x46bf0f[_0x7a14('0x32')]);_0x295597[_0x7a14('0x2f')]=_[_0x7a14('0x30')](_0x295597[_0x7a14('0x2e')],_0x295597[_0x7a14('0x32')]);_0x44e6b0['attributes']=_['intersection'](_0x295597[_0x7a14('0x2e')],qs[_0x7a14('0x31')](_0x46bf0f[_0x7a14('0x32')][_0x7a14('0x31')]));_0x44e6b0['attributes']=_0x44e6b0[_0x7a14('0x33')][_0x7a14('0x42')]?_0x44e6b0[_0x7a14('0x33')]:_0x295597[_0x7a14('0x2e')];_0x44e6b0[_0x7a14('0x35')]=qs[_0x7a14('0x36')](_0x46bf0f['query'][_0x7a14('0x36')]);_0x44e6b0[_0x7a14('0x37')]=qs[_0x7a14('0x2f')](_[_0x7a14('0x38')](_0x46bf0f[_0x7a14('0x32')],_0x295597[_0x7a14('0x2f')]));if(_0x46bf0f[_0x7a14('0x32')][_0x7a14('0x3b')]){_0x44e6b0[_0x7a14('0x37')]=_['merge'](_0x44e6b0[_0x7a14('0x37')],{'$or':_[_0x7a14('0x29')](_0x44e6b0[_0x7a14('0x33')],function(_0xe62d3d){var _0x3a3d9f={};_0x3a3d9f[_0xe62d3d]={'$like':'%'+_0x46bf0f[_0x7a14('0x32')]['filter']+'%'};return _0x3a3d9f;})});}_0x44e6b0=_[_0x7a14('0x39')]({},_0x44e6b0,_0x46bf0f[_0x7a14('0x44')]);return _0x132f26['getSubjects'](_0x44e6b0);}})[_0x7a14('0x22')](function(_0x5ca48f){if(_0x5ca48f){_0x4c09a5=_0x5ca48f[_0x7a14('0x42')];if(!_0x46bf0f[_0x7a14('0x32')]['hasOwnProperty']('nolimit')){_0x44e6b0['limit']=qs[_0x7a14('0x1a')](_0x46bf0f['query'][_0x7a14('0x1a')]);_0x44e6b0[_0x7a14('0x1c')]=qs[_0x7a14('0x1c')](_0x46bf0f[_0x7a14('0x32')]['offset']);}return _0x132f26[_0x7a14('0x48')](_0x44e6b0);}})['then'](function(_0x538299){if(_0x538299){return _0x538299?{'count':_0x4c09a5,'rows':_0x538299}:null;}})[_0x7a14('0x22')](respondWithResult(_0x571607,null))[_0x7a14('0x3d')](handleError(_0x571607,null));};exports[_0x7a14('0x4a')]=function(_0x2566c9,_0x49eafc,_0x5bcb01){var _0x46778f={};var _0x16f8f1={};var _0x2a98c4;var _0x5744f5;return db[_0x7a14('0x2a')]['findOne']({'where':{'id':_0x2566c9[_0x7a14('0x3f')]['id']}})['then'](handleEntityNotFound(_0x49eafc,null))[_0x7a14('0x22')](function(_0x2fa8ec){if(_0x2fa8ec){_0x2a98c4=_0x2fa8ec;_0x16f8f1[_0x7a14('0x2e')]=_[_0x7a14('0x40')](db[_0x7a14('0x4b')][_0x7a14('0x41')]);_0x16f8f1['query']=_['keys'](_0x2566c9[_0x7a14('0x32')]);_0x16f8f1[_0x7a14('0x2f')]=_[_0x7a14('0x30')](_0x16f8f1[_0x7a14('0x2e')],_0x16f8f1[_0x7a14('0x32')]);_0x46778f[_0x7a14('0x33')]=_[_0x7a14('0x30')](_0x16f8f1[_0x7a14('0x2e')],qs[_0x7a14('0x31')](_0x2566c9[_0x7a14('0x32')]['fields']));_0x46778f[_0x7a14('0x33')]=_0x46778f[_0x7a14('0x33')][_0x7a14('0x42')]?_0x46778f[_0x7a14('0x33')]:_0x16f8f1[_0x7a14('0x2e')];_0x46778f[_0x7a14('0x35')]=qs[_0x7a14('0x36')](_0x2566c9[_0x7a14('0x32')][_0x7a14('0x36')]);_0x46778f[_0x7a14('0x37')]=qs[_0x7a14('0x2f')](_['pick'](_0x2566c9[_0x7a14('0x32')],_0x16f8f1[_0x7a14('0x2f')]));if(_0x2566c9['query'][_0x7a14('0x3b')]){_0x46778f[_0x7a14('0x37')]=_[_0x7a14('0x39')](_0x46778f[_0x7a14('0x37')],{'$or':_[_0x7a14('0x29')](_0x46778f[_0x7a14('0x33')],function(_0x3a1606){var _0x3b2187={};_0x3b2187[_0x3a1606]={'$like':'%'+_0x2566c9['query'][_0x7a14('0x3b')]+'%'};return _0x3b2187;})});}_0x46778f=_['merge']({},_0x46778f,_0x2566c9[_0x7a14('0x44')]);return _0x2a98c4[_0x7a14('0x4a')](_0x46778f);}})[_0x7a14('0x22')](function(_0x38dc2c){if(_0x38dc2c){_0x5744f5=_0x38dc2c[_0x7a14('0x42')];if(!_0x2566c9[_0x7a14('0x32')][_0x7a14('0x4c')](_0x7a14('0x34'))){_0x46778f[_0x7a14('0x1a')]=qs['limit'](_0x2566c9[_0x7a14('0x32')][_0x7a14('0x1a')]);_0x46778f[_0x7a14('0x1c')]=qs['offset'](_0x2566c9[_0x7a14('0x32')][_0x7a14('0x1c')]);}return _0x2a98c4[_0x7a14('0x4a')](_0x46778f);}})[_0x7a14('0x22')](function(_0x535430){if(_0x535430){return _0x535430?{'count':_0x5744f5,'rows':_0x535430}:null;}})[_0x7a14('0x22')](respondWithResult(_0x49eafc,null))[_0x7a14('0x3d')](handleError(_0x49eafc,null));};exports[_0x7a14('0x4d')]=function(_0x39ee7e,_0x48bec4,_0x24feda){var _0x2e4c55={};var _0x9899d8={};var _0x3bd465;var _0x65b166;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x39ee7e[_0x7a14('0x3f')]['id']}})[_0x7a14('0x22')](handleEntityNotFound(_0x48bec4,null))[_0x7a14('0x22')](function(_0x41d8af){if(_0x41d8af){_0x3bd465=_0x41d8af;_0x9899d8[_0x7a14('0x2e')]=_['keys'](db[_0x7a14('0x4b')][_0x7a14('0x41')]);_0x9899d8[_0x7a14('0x32')]=_['keys'](_0x39ee7e['query']);_0x9899d8[_0x7a14('0x2f')]=_[_0x7a14('0x30')](_0x9899d8[_0x7a14('0x2e')],_0x9899d8[_0x7a14('0x32')]);_0x2e4c55[_0x7a14('0x33')]=_['intersection'](_0x9899d8[_0x7a14('0x2e')],qs[_0x7a14('0x31')](_0x39ee7e[_0x7a14('0x32')][_0x7a14('0x31')]));_0x2e4c55[_0x7a14('0x33')]=_0x2e4c55['attributes'][_0x7a14('0x42')]?_0x2e4c55[_0x7a14('0x33')]:_0x9899d8['model'];_0x2e4c55[_0x7a14('0x35')]=qs['sort'](_0x39ee7e['query'][_0x7a14('0x36')]);_0x2e4c55[_0x7a14('0x37')]=qs[_0x7a14('0x2f')](_[_0x7a14('0x38')](_0x39ee7e[_0x7a14('0x32')],_0x9899d8[_0x7a14('0x2f')]));if(_0x39ee7e[_0x7a14('0x32')]['filter']){_0x2e4c55['where']=_['merge'](_0x2e4c55[_0x7a14('0x37')],{'$or':_[_0x7a14('0x29')](_0x2e4c55[_0x7a14('0x33')],function(_0x12f043){var _0x574dc3={};_0x574dc3[_0x12f043]={'$like':'%'+_0x39ee7e['query'][_0x7a14('0x3b')]+'%'};return _0x574dc3;})});}_0x2e4c55=_[_0x7a14('0x39')]({},_0x2e4c55,_0x39ee7e[_0x7a14('0x44')]);return _0x3bd465[_0x7a14('0x4d')](_0x2e4c55);}})[_0x7a14('0x22')](function(_0x196fad){if(_0x196fad){_0x65b166=_0x196fad[_0x7a14('0x42')];if(!_0x39ee7e[_0x7a14('0x32')][_0x7a14('0x4c')](_0x7a14('0x34'))){_0x2e4c55[_0x7a14('0x1a')]=qs[_0x7a14('0x1a')](_0x39ee7e[_0x7a14('0x32')][_0x7a14('0x1a')]);_0x2e4c55[_0x7a14('0x1c')]=qs['offset'](_0x39ee7e[_0x7a14('0x32')]['offset']);}return _0x3bd465[_0x7a14('0x4d')](_0x2e4c55);}})[_0x7a14('0x22')](function(_0x17e3a2){if(_0x17e3a2){return _0x17e3a2?{'count':_0x65b166,'rows':_0x17e3a2}:null;}})[_0x7a14('0x22')](respondWithResult(_0x48bec4,null))[_0x7a14('0x3d')](handleError(_0x48bec4,null));}; \ No newline at end of file +var _0x969e=['findAll','catch','params','create','body','find','getSubjects','findOne','FreshsalesField','length','order','filter','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','FreshsalesConfiguration','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x969e,0xb0));var _0xe969=function(_0x10d99f,_0xc31f89){_0x10d99f=_0x10d99f-0x0;var _0x300d01=_0x969e[_0x10d99f];return _0x300d01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe969('0x0'));var zipdir=require(_0xe969('0x1'));var jsonpatch=require(_0xe969('0x2'));var rp=require(_0xe969('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe969('0x4'));var util=require(_0xe969('0x5'));var path=require('path');var sox=require(_0xe969('0x6'));var csv=require(_0xe969('0x7'));var ejs=require(_0xe969('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe969('0x9'));var squel=require(_0xe969('0xa'));var crypto=require('crypto');var jsforce=require(_0xe969('0xb'));var deskjs=require(_0xe969('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe969('0xd'));var Papa=require(_0xe969('0xe'));var Redis=require(_0xe969('0xf'));var authService=require(_0xe969('0x10'));var qs=require(_0xe969('0x11'));var as=require(_0xe969('0x12'));var hardwareService=require(_0xe969('0x13'));var logger=require(_0xe969('0x14'))('api');var utils=require(_0xe969('0x15'));var config=require(_0xe969('0x16'));var licenseUtil=require(_0xe969('0x17'));var db=require(_0xe969('0x18'))['db'];function respondWithStatusCode(_0x57532a,_0x510fee){_0x510fee=_0x510fee||0xcc;return function(_0x145b78){if(_0x145b78){return _0x57532a[_0xe969('0x19')](_0x510fee);}return _0x57532a[_0xe969('0x1a')](_0x510fee)[_0xe969('0x1b')]();};}function respondWithResult(_0x291a69,_0x3a7a32){_0x3a7a32=_0x3a7a32||0xc8;return function(_0x387b57){if(_0x387b57){return _0x291a69['status'](_0x3a7a32)[_0xe969('0x1c')](_0x387b57);}};}function respondWithFilteredResult(_0xe646d5,_0x55312c){return function(_0x4d97ad){if(_0x4d97ad){var _0x434698=typeof _0x55312c[_0xe969('0x1d')]===_0xe969('0x1e')&&typeof _0x55312c[_0xe969('0x1f')]===_0xe969('0x1e');var _0xb1da8d=_0x4d97ad[_0xe969('0x20')];var _0x4a41e1=_0x434698?0x0:_0x55312c['offset'];var _0x4c00a5=_0x434698?_0x4d97ad[_0xe969('0x20')]:_0x55312c['offset']+_0x55312c[_0xe969('0x1f')];var _0x262d26;if(_0x4c00a5>=_0xb1da8d){_0x4c00a5=_0xb1da8d;_0x262d26=0xc8;}else{_0x262d26=0xce;}_0xe646d5[_0xe969('0x1a')](_0x262d26);return _0xe646d5[_0xe969('0x21')](_0xe969('0x22'),_0x4a41e1+'-'+_0x4c00a5+'/'+_0xb1da8d)[_0xe969('0x1c')](_0x4d97ad);}return null;};}function patchUpdates(_0x32a3ad){return function(_0x4e516f){try{jsonpatch[_0xe969('0x23')](_0x4e516f,_0x32a3ad,!![]);}catch(_0x1e5153){return BPromise[_0xe969('0x24')](_0x1e5153);}return _0x4e516f[_0xe969('0x25')]();};}function saveUpdates(_0x1921df,_0x24e3f5){return function(_0x3cad58){if(_0x3cad58){return _0x3cad58[_0xe969('0x26')](_0x1921df)[_0xe969('0x27')](function(_0x4ccec3){return _0x4ccec3;});}return null;};}function removeEntity(_0x58fa4e,_0x15b884){return function(_0x1da811){if(_0x1da811){return _0x1da811[_0xe969('0x28')]()['then'](function(){_0x58fa4e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15b816,_0x146f0f){return function(_0x56e8dd){if(!_0x56e8dd){_0x15b816[_0xe969('0x19')](0x194);}return _0x56e8dd;};}function handleError(_0x3ffcc7,_0x49bc79){_0x49bc79=_0x49bc79||0x1f4;return function(_0x522e28){logger['error'](_0x522e28[_0xe969('0x29')]);if(_0x522e28[_0xe969('0x2a')]){delete _0x522e28[_0xe969('0x2a')];}_0x3ffcc7['status'](_0x49bc79)[_0xe969('0x2b')](_0x522e28);};}exports[_0xe969('0x2c')]=function(_0x4b18d4,_0x23ebe7){var _0x190bf2={},_0x101883={},_0x4d2519={'count':0x0,'rows':[]};var _0x15a4d2=_['map'](db[_0xe969('0x2d')][_0xe969('0x2e')],function(_0x5777fb){return{'name':_0x5777fb['fieldName'],'type':_0x5777fb['type'][_0xe969('0x2f')]};});_0x101883[_0xe969('0x30')]=_[_0xe969('0x31')](_0x15a4d2,_0xe969('0x2a'));_0x101883[_0xe969('0x32')]=_[_0xe969('0x33')](_0x4b18d4['query']);_0x101883['filters']=_[_0xe969('0x34')](_0x101883[_0xe969('0x30')],_0x101883[_0xe969('0x32')]);_0x190bf2[_0xe969('0x35')]=_[_0xe969('0x34')](_0x101883[_0xe969('0x30')],qs[_0xe969('0x36')](_0x4b18d4[_0xe969('0x32')][_0xe969('0x36')]));_0x190bf2[_0xe969('0x35')]=_0x190bf2[_0xe969('0x35')]['length']?_0x190bf2[_0xe969('0x35')]:_0x101883[_0xe969('0x30')];if(!_0x4b18d4[_0xe969('0x32')][_0xe969('0x37')](_0xe969('0x38'))){_0x190bf2[_0xe969('0x1f')]=qs[_0xe969('0x1f')](_0x4b18d4[_0xe969('0x32')]['limit']);_0x190bf2[_0xe969('0x1d')]=qs[_0xe969('0x1d')](_0x4b18d4['query'][_0xe969('0x1d')]);}_0x190bf2['order']=qs['sort'](_0x4b18d4[_0xe969('0x32')][_0xe969('0x39')]);_0x190bf2[_0xe969('0x3a')]=qs[_0xe969('0x3b')](_[_0xe969('0x3c')](_0x4b18d4[_0xe969('0x32')],_0x101883[_0xe969('0x3b')]),_0x15a4d2);if(_0x4b18d4['query']['filter']){_0x190bf2[_0xe969('0x3a')]=_[_0xe969('0x3d')](_0x190bf2['where'],{'$or':_['map'](_0x15a4d2,function(_0x1984bc){if(_0x1984bc[_0xe969('0x3e')]!==_0xe969('0x3f')){var _0x56f636={};_0x56f636[_0x1984bc[_0xe969('0x2a')]]={'$like':'%'+_0x4b18d4[_0xe969('0x32')]['filter']+'%'};return _0x56f636;}})});}_0x190bf2=_[_0xe969('0x3d')]({},_0x190bf2,_0x4b18d4[_0xe969('0x40')]);var _0x1aa68a={'where':_0x190bf2[_0xe969('0x3a')]};return db[_0xe969('0x2d')]['count'](_0x1aa68a)[_0xe969('0x27')](function(_0x182e41){_0x4d2519[_0xe969('0x20')]=_0x182e41;if(_0x4b18d4[_0xe969('0x32')][_0xe969('0x41')]){_0x190bf2[_0xe969('0x42')]=[{'all':!![]}];}return db[_0xe969('0x2d')][_0xe969('0x43')](_0x190bf2);})[_0xe969('0x27')](function(_0x276a00){_0x4d2519['rows']=_0x276a00;return _0x4d2519;})[_0xe969('0x27')](respondWithFilteredResult(_0x23ebe7,_0x190bf2))[_0xe969('0x44')](handleError(_0x23ebe7,null));};exports['show']=function(_0xc2490e,_0x32c911){var _0x5a3135={'raw':![],'where':{'id':_0xc2490e[_0xe969('0x45')]['id']}},_0x1fa485={};_0x1fa485[_0xe969('0x30')]=_[_0xe969('0x33')](db['FreshsalesConfiguration']['rawAttributes']);_0x1fa485['query']=_[_0xe969('0x33')](_0xc2490e[_0xe969('0x32')]);_0x1fa485[_0xe969('0x3b')]=_[_0xe969('0x34')](_0x1fa485[_0xe969('0x30')],_0x1fa485[_0xe969('0x32')]);_0x5a3135[_0xe969('0x35')]=_[_0xe969('0x34')](_0x1fa485['model'],qs[_0xe969('0x36')](_0xc2490e[_0xe969('0x32')]['fields']));_0x5a3135[_0xe969('0x35')]=_0x5a3135[_0xe969('0x35')]['length']?_0x5a3135[_0xe969('0x35')]:_0x1fa485['model'];if(_0xc2490e[_0xe969('0x32')]['includeAll']){_0x5a3135['include']=[{'all':!![]}];}_0x5a3135=_[_0xe969('0x3d')]({},_0x5a3135,_0xc2490e['options']);return db[_0xe969('0x2d')]['find'](_0x5a3135)[_0xe969('0x27')](handleEntityNotFound(_0x32c911,null))[_0xe969('0x27')](respondWithResult(_0x32c911,null))[_0xe969('0x44')](handleError(_0x32c911,null));};exports[_0xe969('0x46')]=function(_0x2031b2,_0x3bd574){return db[_0xe969('0x2d')]['create'](_0x2031b2['body'],{})['then'](respondWithResult(_0x3bd574,0xc9))[_0xe969('0x44')](handleError(_0x3bd574,null));};exports[_0xe969('0x26')]=function(_0x3b2aa7,_0x580ef5){if(_0x3b2aa7['body']['id']){delete _0x3b2aa7[_0xe969('0x47')]['id'];}return db[_0xe969('0x2d')][_0xe969('0x48')]({'where':{'id':_0x3b2aa7[_0xe969('0x45')]['id']}})[_0xe969('0x27')](handleEntityNotFound(_0x580ef5,null))[_0xe969('0x27')](saveUpdates(_0x3b2aa7[_0xe969('0x47')],null))['then'](respondWithResult(_0x580ef5,null))['catch'](handleError(_0x580ef5,null));};exports['destroy']=function(_0x53459c,_0x109fc7){return db[_0xe969('0x2d')]['find']({'where':{'id':_0x53459c[_0xe969('0x45')]['id']}})[_0xe969('0x27')](handleEntityNotFound(_0x109fc7,null))[_0xe969('0x27')](removeEntity(_0x109fc7,null))[_0xe969('0x44')](handleError(_0x109fc7,null));};exports[_0xe969('0x49')]=function(_0x24affa,_0x17abe1,_0x4dfe77){var _0x323801={};var _0xddd801={};var _0x22eca6;var _0x554bbb;return db[_0xe969('0x2d')][_0xe969('0x4a')]({'where':{'id':_0x24affa['params']['id']}})[_0xe969('0x27')](handleEntityNotFound(_0x17abe1,null))[_0xe969('0x27')](function(_0x194e1d){if(_0x194e1d){_0x22eca6=_0x194e1d;_0xddd801[_0xe969('0x30')]=_[_0xe969('0x33')](db[_0xe969('0x4b')][_0xe969('0x2e')]);_0xddd801[_0xe969('0x32')]=_[_0xe969('0x33')](_0x24affa[_0xe969('0x32')]);_0xddd801[_0xe969('0x3b')]=_['intersection'](_0xddd801[_0xe969('0x30')],_0xddd801[_0xe969('0x32')]);_0x323801[_0xe969('0x35')]=_[_0xe969('0x34')](_0xddd801['model'],qs[_0xe969('0x36')](_0x24affa['query'][_0xe969('0x36')]));_0x323801['attributes']=_0x323801[_0xe969('0x35')][_0xe969('0x4c')]?_0x323801[_0xe969('0x35')]:_0xddd801[_0xe969('0x30')];_0x323801['order']=qs[_0xe969('0x39')](_0x24affa[_0xe969('0x32')][_0xe969('0x39')]);_0x323801['where']=qs['filters'](_[_0xe969('0x3c')](_0x24affa['query'],_0xddd801[_0xe969('0x3b')]));if(_0x24affa['query']['filter']){_0x323801['where']=_[_0xe969('0x3d')](_0x323801[_0xe969('0x3a')],{'$or':_[_0xe969('0x31')](_0x323801[_0xe969('0x35')],function(_0xb6b5ec){var _0xf6c43f={};_0xf6c43f[_0xb6b5ec]={'$like':'%'+_0x24affa['query']['filter']+'%'};return _0xf6c43f;})});}_0x323801=_[_0xe969('0x3d')]({},_0x323801,_0x24affa[_0xe969('0x40')]);return _0x22eca6[_0xe969('0x49')](_0x323801);}})[_0xe969('0x27')](function(_0x5b62ea){if(_0x5b62ea){_0x554bbb=_0x5b62ea['length'];if(!_0x24affa[_0xe969('0x32')][_0xe969('0x37')]('nolimit')){_0x323801[_0xe969('0x1f')]=qs[_0xe969('0x1f')](_0x24affa[_0xe969('0x32')][_0xe969('0x1f')]);_0x323801[_0xe969('0x1d')]=qs[_0xe969('0x1d')](_0x24affa['query'][_0xe969('0x1d')]);}return _0x22eca6['getSubjects'](_0x323801);}})[_0xe969('0x27')](function(_0x16160f){if(_0x16160f){return _0x16160f?{'count':_0x554bbb,'rows':_0x16160f}:null;}})['then'](respondWithResult(_0x17abe1,null))[_0xe969('0x44')](handleError(_0x17abe1,null));};exports['getDescriptions']=function(_0x3d3e51,_0x99a1ef,_0x40848f){var _0x324e0b={};var _0xd04b1f={};var _0x515bb4;var _0xad3b79;return db['FreshsalesConfiguration'][_0xe969('0x4a')]({'where':{'id':_0x3d3e51[_0xe969('0x45')]['id']}})['then'](handleEntityNotFound(_0x99a1ef,null))['then'](function(_0x356ab8){if(_0x356ab8){_0x515bb4=_0x356ab8;_0xd04b1f[_0xe969('0x30')]=_['keys'](db[_0xe969('0x4b')]['rawAttributes']);_0xd04b1f[_0xe969('0x32')]=_['keys'](_0x3d3e51['query']);_0xd04b1f[_0xe969('0x3b')]=_[_0xe969('0x34')](_0xd04b1f[_0xe969('0x30')],_0xd04b1f[_0xe969('0x32')]);_0x324e0b['attributes']=_[_0xe969('0x34')](_0xd04b1f[_0xe969('0x30')],qs[_0xe969('0x36')](_0x3d3e51[_0xe969('0x32')][_0xe969('0x36')]));_0x324e0b[_0xe969('0x35')]=_0x324e0b[_0xe969('0x35')]['length']?_0x324e0b['attributes']:_0xd04b1f['model'];_0x324e0b[_0xe969('0x4d')]=qs[_0xe969('0x39')](_0x3d3e51[_0xe969('0x32')][_0xe969('0x39')]);_0x324e0b['where']=qs[_0xe969('0x3b')](_['pick'](_0x3d3e51['query'],_0xd04b1f['filters']));if(_0x3d3e51['query'][_0xe969('0x4e')]){_0x324e0b[_0xe969('0x3a')]=_[_0xe969('0x3d')](_0x324e0b[_0xe969('0x3a')],{'$or':_[_0xe969('0x31')](_0x324e0b[_0xe969('0x35')],function(_0x3c1288){var _0x29afb8={};_0x29afb8[_0x3c1288]={'$like':'%'+_0x3d3e51[_0xe969('0x32')]['filter']+'%'};return _0x29afb8;})});}_0x324e0b=_[_0xe969('0x3d')]({},_0x324e0b,_0x3d3e51['options']);return _0x515bb4[_0xe969('0x4f')](_0x324e0b);}})[_0xe969('0x27')](function(_0x5aa159){if(_0x5aa159){_0xad3b79=_0x5aa159[_0xe969('0x4c')];if(!_0x3d3e51['query']['hasOwnProperty'](_0xe969('0x38'))){_0x324e0b[_0xe969('0x1f')]=qs[_0xe969('0x1f')](_0x3d3e51[_0xe969('0x32')]['limit']);_0x324e0b[_0xe969('0x1d')]=qs[_0xe969('0x1d')](_0x3d3e51[_0xe969('0x32')][_0xe969('0x1d')]);}return _0x515bb4[_0xe969('0x4f')](_0x324e0b);}})[_0xe969('0x27')](function(_0x249321){if(_0x249321){return _0x249321?{'count':_0xad3b79,'rows':_0x249321}:null;}})[_0xe969('0x27')](respondWithResult(_0x99a1ef,null))[_0xe969('0x44')](handleError(_0x99a1ef,null));};exports[_0xe969('0x50')]=function(_0x308262,_0x3b4e0c,_0x1f471a){var _0x35708d={};var _0x4ea708={};var _0x5387da;var _0xe06e24;return db[_0xe969('0x2d')][_0xe969('0x4a')]({'where':{'id':_0x308262[_0xe969('0x45')]['id']}})[_0xe969('0x27')](handleEntityNotFound(_0x3b4e0c,null))['then'](function(_0xcb056e){if(_0xcb056e){_0x5387da=_0xcb056e;_0x4ea708[_0xe969('0x30')]=_[_0xe969('0x33')](db[_0xe969('0x4b')][_0xe969('0x2e')]);_0x4ea708[_0xe969('0x32')]=_['keys'](_0x308262[_0xe969('0x32')]);_0x4ea708[_0xe969('0x3b')]=_[_0xe969('0x34')](_0x4ea708[_0xe969('0x30')],_0x4ea708[_0xe969('0x32')]);_0x35708d[_0xe969('0x35')]=_[_0xe969('0x34')](_0x4ea708[_0xe969('0x30')],qs[_0xe969('0x36')](_0x308262[_0xe969('0x32')][_0xe969('0x36')]));_0x35708d[_0xe969('0x35')]=_0x35708d[_0xe969('0x35')][_0xe969('0x4c')]?_0x35708d[_0xe969('0x35')]:_0x4ea708[_0xe969('0x30')];_0x35708d[_0xe969('0x4d')]=qs[_0xe969('0x39')](_0x308262['query'][_0xe969('0x39')]);_0x35708d[_0xe969('0x3a')]=qs['filters'](_[_0xe969('0x3c')](_0x308262[_0xe969('0x32')],_0x4ea708[_0xe969('0x3b')]));if(_0x308262[_0xe969('0x32')][_0xe969('0x4e')]){_0x35708d[_0xe969('0x3a')]=_['merge'](_0x35708d[_0xe969('0x3a')],{'$or':_[_0xe969('0x31')](_0x35708d[_0xe969('0x35')],function(_0x3a111f){var _0xa7d62e={};_0xa7d62e[_0x3a111f]={'$like':'%'+_0x308262[_0xe969('0x32')][_0xe969('0x4e')]+'%'};return _0xa7d62e;})});}_0x35708d=_['merge']({},_0x35708d,_0x308262['options']);return _0x5387da[_0xe969('0x50')](_0x35708d);}})[_0xe969('0x27')](function(_0x441a23){if(_0x441a23){_0xe06e24=_0x441a23[_0xe969('0x4c')];if(!_0x308262[_0xe969('0x32')]['hasOwnProperty'](_0xe969('0x38'))){_0x35708d[_0xe969('0x1f')]=qs['limit'](_0x308262['query'][_0xe969('0x1f')]);_0x35708d['offset']=qs[_0xe969('0x1d')](_0x308262['query']['offset']);}return _0x5387da['getFields'](_0x35708d);}})[_0xe969('0x27')](function(_0x55fbd7){if(_0x55fbd7){return _0x55fbd7?{'count':_0xe06e24,'rows':_0x55fbd7}:null;}})[_0xe969('0x27')](respondWithResult(_0x3b4e0c,null))['catch'](handleError(_0x3b4e0c,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 4dc0a29..09a31bb 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 _0xdf77=['exports','define','FreshsalesConfiguration','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x5dda44,_0x40b720){var _0x25506a=function(_0x5bdca9){while(--_0x5bdca9){_0x5dda44['push'](_0x5dda44['shift']());}};_0x25506a(++_0x40b720);}(_0xdf77,0x1e7));var _0x7df7=function(_0x4c0b53,_0x3a65f1){_0x4c0b53=_0x4c0b53-0x0;var _0x23c388=_0xdf77[_0x4c0b53];return _0x23c388;};'use strict';var _=require(_0x7df7('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7df7('0x1'));var moment=require('moment');var BPromise=require(_0x7df7('0x2'));var rp=require(_0x7df7('0x3'));var fs=require('fs');var path=require(_0x7df7('0x4'));var rimraf=require(_0x7df7('0x5'));var config=require(_0x7df7('0x6'));var attributes=require(_0x7df7('0x7'));module[_0x7df7('0x8')]=function(_0x153e94,_0x146b10){return _0x153e94[_0x7df7('0x9')](_0x7df7('0xa'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x625e=['int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration'];(function(_0x4ef721,_0x1513f3){var _0x1b035e=function(_0x1b409f){while(--_0x1b409f){_0x4ef721['push'](_0x4ef721['shift']());}};_0x1b035e(++_0x1513f3);}(_0x625e,0x145));var _0xe625=function(_0x516927,_0xb4aad0){_0x516927=_0x516927-0x0;var _0x30749b=_0x625e[_0x516927];return _0x30749b;};'use strict';var _=require(_0xe625('0x0'));var util=require(_0xe625('0x1'));var logger=require(_0xe625('0x2'))(_0xe625('0x3'));var moment=require(_0xe625('0x4'));var BPromise=require(_0xe625('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe625('0x6'));var rimraf=require('rimraf');var config=require(_0xe625('0x7'));var attributes=require(_0xe625('0x8'));module[_0xe625('0x9')]=function(_0x2b0094,_0x234add){return _0x2b0094['define'](_0xe625('0xa'),attributes,{'tableName':_0xe625('0xb'),'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 685415d..cc63455 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 _0xa3a9=['error','code','message','catch','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4f21cd,_0x30f06f){var _0x1af331=function(_0x51145e){while(--_0x51145e){_0x4f21cd['push'](_0x4f21cd['shift']());}};_0x1af331(++_0x30f06f);}(_0xa3a9,0x7b));var _0x9a3a=function(_0x520281,_0x594413){_0x520281=_0x520281-0x0;var _0x29ca73=_0xa3a9[_0x520281];return _0x29ca73;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9a3a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a3a('0x1'))['db'];var utils=require(_0x9a3a('0x2'));var logger=require(_0x9a3a('0x3'))(_0x9a3a('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x9a3a('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x3428c0,_0x4ae455,_0x54cad4){return new BPromise(function(_0x485671,_0x315821){return client[_0x9a3a('0x6')](_0x3428c0,_0x54cad4)[_0x9a3a('0x7')](function(_0x50e606){logger[_0x9a3a('0x8')](_0x9a3a('0x9'),_0x4ae455,_0x9a3a('0xa'));logger['debug'](_0x9a3a('0xb'),_0x4ae455,'request\x20sent',JSON[_0x9a3a('0xc')](_0x50e606));if(_0x50e606[_0x9a3a('0xd')]){if(_0x50e606[_0x9a3a('0xd')][_0x9a3a('0xe')]===0x1f4){logger[_0x9a3a('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4ae455,_0x50e606[_0x9a3a('0xd')]['message']);return _0x315821(_0x50e606[_0x9a3a('0xd')][_0x9a3a('0xf')]);}logger[_0x9a3a('0xd')](_0x9a3a('0x9'),_0x4ae455,_0x50e606[_0x9a3a('0xd')][_0x9a3a('0xf')]);return _0x485671(_0x50e606[_0x9a3a('0xd')][_0x9a3a('0xf')]);}else{logger[_0x9a3a('0x8')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x4ae455,'request\x20sent');_0x485671(_0x50e606['result'][_0x9a3a('0xf')]);}})[_0x9a3a('0x10')](function(_0x42dc52){logger['error'](_0x9a3a('0x9'),_0x4ae455,_0x42dc52);_0x315821(_0x42dc52);});});} \ No newline at end of file +var _0xb7f3=['FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0xb7f3,0xa7));var _0x3b7f=function(_0xa5f98d,_0x48525f){_0xa5f98d=_0xa5f98d-0x0;var _0x59b0af=_0xb7f3[_0xa5f98d];return _0x59b0af;};'use strict';var _=require(_0x3b7f('0x0'));var util=require(_0x3b7f('0x1'));var moment=require('moment');var BPromise=require(_0x3b7f('0x2'));var rs=require(_0x3b7f('0x3'));var fs=require('fs');var Redis=require(_0x3b7f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b7f('0x5'));var logger=require(_0x3b7f('0x6'))(_0x3b7f('0x7'));var config=require(_0x3b7f('0x8'));var jayson=require(_0x3b7f('0x9'));var client=jayson[_0x3b7f('0xa')][_0x3b7f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdbee7b,_0x49426e,_0x8c2a02){return new BPromise(function(_0x3f75e9,_0x4f902d){return client[_0x3b7f('0xc')](_0xdbee7b,_0x8c2a02)[_0x3b7f('0xd')](function(_0x1a95d7){logger[_0x3b7f('0xe')](_0x3b7f('0xf'),_0x49426e,_0x3b7f('0x10'));logger['debug'](_0x3b7f('0x11'),_0x49426e,_0x3b7f('0x10'),JSON[_0x3b7f('0x12')](_0x1a95d7));if(_0x1a95d7['error']){if(_0x1a95d7[_0x3b7f('0x13')][_0x3b7f('0x14')]===0x1f4){logger[_0x3b7f('0x13')](_0x3b7f('0xf'),_0x49426e,_0x1a95d7[_0x3b7f('0x13')]['message']);return _0x4f902d(_0x1a95d7[_0x3b7f('0x13')][_0x3b7f('0x15')]);}logger[_0x3b7f('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x49426e,_0x1a95d7['error'][_0x3b7f('0x15')]);return _0x3f75e9(_0x1a95d7[_0x3b7f('0x13')][_0x3b7f('0x15')]);}else{logger[_0x3b7f('0xe')](_0x3b7f('0xf'),_0x49426e,'request\x20sent');_0x3f75e9(_0x1a95d7[_0x3b7f('0x16')][_0x3b7f('0x15')]);}})['catch'](function(_0x415894){logger[_0x3b7f('0x13')](_0x3b7f('0xf'),_0x49426e,_0x415894);_0x4f902d(_0x415894);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index d1d8ba2..f27a887 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 _0xdfcc=['/:id','show','post','create','update','delete','multer','util','path','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index'];(function(_0x265468,_0xcf7439){var _0x37d555=function(_0x47c742){while(--_0x47c742){_0x265468['push'](_0x265468['shift']());}};_0x37d555(++_0xcf7439);}(_0xdfcc,0x8d));var _0xcdfc=function(_0x57645b,_0x25f73a){_0x57645b=_0x57645b-0x0;var _0xe82f00=_0xdfcc[_0x57645b];return _0xe82f00;};'use strict';var multer=require(_0xcdfc('0x0'));var util=require(_0xcdfc('0x1'));var path=require(_0xcdfc('0x2'));var timeout=require('connect-timeout');var express=require(_0xcdfc('0x3'));var router=express[_0xcdfc('0x4')]();var fs_extra=require(_0xcdfc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcdfc('0x6'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0xcdfc('0x7')](),controller[_0xcdfc('0x8')]);router['get'](_0xcdfc('0x9'),auth[_0xcdfc('0x7')](),controller[_0xcdfc('0xa')]);router[_0xcdfc('0xb')]('/',auth['isAuthenticated'](),controller[_0xcdfc('0xc')]);router['put'](_0xcdfc('0x9'),auth[_0xcdfc('0x7')](),controller[_0xcdfc('0xd')]);router[_0xcdfc('0xe')](_0xcdfc('0x9'),auth[_0xcdfc('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb544=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','put','/:id','update','delete','exports'];(function(_0x2ab365,_0xa3812e){var _0x49fef3=function(_0x29b883){while(--_0x29b883){_0x2ab365['push'](_0x2ab365['shift']());}};_0x49fef3(++_0xa3812e);}(_0xb544,0xd0));var _0x4b54=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xb544[_0x5a776b];return _0xbbef59;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4b54('0x0'));var timeout=require(_0x4b54('0x1'));var express=require(_0x4b54('0x2'));var router=express[_0x4b54('0x3')]();var fs_extra=require(_0x4b54('0x4'));var auth=require(_0x4b54('0x5'));var interaction=require(_0x4b54('0x6'));var config=require(_0x4b54('0x7'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4b54('0x8')]('/:id',auth[_0x4b54('0x9')](),controller['show']);router[_0x4b54('0xa')]('/',auth[_0x4b54('0x9')](),controller['create']);router[_0x4b54('0xb')](_0x4b54('0xc'),auth[_0x4b54('0x9')](),controller[_0x4b54('0xd')]);router[_0x4b54('0xe')](_0x4b54('0xc'),auth[_0x4b54('0x9')](),controller['destroy']);module[_0x4b54('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 0679bdf..d372a01 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 _0x86b2=['keyValue','picklist','STRING','variable','customVariable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x809144,_0x4e5c53){var _0x52244c=function(_0x34a042){while(--_0x34a042){_0x809144['push'](_0x809144['shift']());}};_0x52244c(++_0x4e5c53);}(_0x86b2,0x92));var _0x286b=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x86b2[_0x45783c];return _0x1161da;};'use strict';var Sequelize=require(_0x286b('0x0'));module[_0x286b('0x1')]={'type':{'type':Sequelize[_0x286b('0x2')](_0x286b('0x3'),'variable','customVariable',_0x286b('0x4'),_0x286b('0x5')),'defaultValue':_0x286b('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x286b('0x6')]},'keyType':{'type':Sequelize[_0x286b('0x2')](_0x286b('0x3'),_0x286b('0x7'),_0x286b('0x8'))},'keyContent':{'type':Sequelize[_0x286b('0x6')]},'idField':{'type':Sequelize[_0x286b('0x6')]},'nameField':{'type':Sequelize[_0x286b('0x6')]},'customField':{'type':Sequelize[_0x286b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x55d2=['keyValue','STRING','customVariable','sequelize','exports','ENUM','string','variable'];(function(_0x5c6f7a,_0x34469b){var _0x3de323=function(_0x25267e){while(--_0x25267e){_0x5c6f7a['push'](_0x5c6f7a['shift']());}};_0x3de323(++_0x34469b);}(_0x55d2,0x193));var _0x255d=function(_0x17a28b,_0x5d1465){_0x17a28b=_0x17a28b-0x0;var _0x9cbb5a=_0x55d2[_0x17a28b];return _0x9cbb5a;};'use strict';var Sequelize=require(_0x255d('0x0'));module[_0x255d('0x1')]={'type':{'type':Sequelize[_0x255d('0x2')](_0x255d('0x3'),_0x255d('0x4'),'customVariable',_0x255d('0x5'),'picklist'),'defaultValue':_0x255d('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x255d('0x6')]},'keyType':{'type':Sequelize[_0x255d('0x2')]('string',_0x255d('0x4'),_0x255d('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x255d('0x6')]},'nameField':{'type':Sequelize[_0x255d('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x255d('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 509c891..ed9637a 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 _0x61d8=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','params','include','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x2f54d0,_0xbe8dd7){var _0x82651=function(_0x770bab){while(--_0x770bab){_0x2f54d0['push'](_0x2f54d0['shift']());}};_0x82651(++_0xbe8dd7);}(_0x61d8,0x14b));var _0x861d=function(_0x2598c5,_0x47d014){_0x2598c5=_0x2598c5-0x0;var _0x4bbb0f=_0x61d8[_0x2598c5];return _0x4bbb0f;};'use strict';var emlformat=require(_0x861d('0x0'));var rimraf=require(_0x861d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x861d('0x2'));var rp=require(_0x861d('0x3'));var moment=require('moment');var BPromise=require(_0x861d('0x4'));var Mustache=require(_0x861d('0x5'));var util=require(_0x861d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x861d('0x7'));var ejs=require(_0x861d('0x8'));var fs=require('fs');var fs_extra=require(_0x861d('0x9'));var _=require(_0x861d('0xa'));var squel=require(_0x861d('0xb'));var crypto=require('crypto');var jsforce=require(_0x861d('0xc'));var deskjs=require(_0x861d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x861d('0xe'));var Papa=require(_0x861d('0xf'));var Redis=require(_0x861d('0x10'));var authService=require(_0x861d('0x11'));var qs=require(_0x861d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x861d('0x13'));var logger=require(_0x861d('0x14'))(_0x861d('0x15'));var utils=require(_0x861d('0x16'));var config=require(_0x861d('0x17'));var licenseUtil=require(_0x861d('0x18'));var db=require(_0x861d('0x19'))['db'];function respondWithStatusCode(_0x20d847,_0x2adf04){_0x2adf04=_0x2adf04||0xcc;return function(_0x5f3441){if(_0x5f3441){return _0x20d847['sendStatus'](_0x2adf04);}return _0x20d847[_0x861d('0x1a')](_0x2adf04)[_0x861d('0x1b')]();};}function respondWithResult(_0x4f19ce,_0x1a23eb){_0x1a23eb=_0x1a23eb||0xc8;return function(_0x6ae144){if(_0x6ae144){return _0x4f19ce[_0x861d('0x1a')](_0x1a23eb)[_0x861d('0x1c')](_0x6ae144);}};}function respondWithFilteredResult(_0x21438b,_0x2c9cfd){return function(_0x453fe9){if(_0x453fe9){var _0xcc8854=typeof _0x2c9cfd[_0x861d('0x1d')]==='undefined'&&typeof _0x2c9cfd[_0x861d('0x1e')]==='undefined';var _0x2fad8f=_0x453fe9[_0x861d('0x1f')];var _0x321199=_0xcc8854?0x0:_0x2c9cfd[_0x861d('0x1d')];var _0x1ff75a=_0xcc8854?_0x453fe9[_0x861d('0x1f')]:_0x2c9cfd['offset']+_0x2c9cfd[_0x861d('0x1e')];var _0xed00f4;if(_0x1ff75a>=_0x2fad8f){_0x1ff75a=_0x2fad8f;_0xed00f4=0xc8;}else{_0xed00f4=0xce;}_0x21438b[_0x861d('0x1a')](_0xed00f4);return _0x21438b[_0x861d('0x20')](_0x861d('0x21'),_0x321199+'-'+_0x1ff75a+'/'+_0x2fad8f)[_0x861d('0x1c')](_0x453fe9);}return null;};}function patchUpdates(_0x2e3710){return function(_0x269862){try{jsonpatch[_0x861d('0x22')](_0x269862,_0x2e3710,!![]);}catch(_0x3bf70a){return BPromise[_0x861d('0x23')](_0x3bf70a);}return _0x269862[_0x861d('0x24')]();};}function saveUpdates(_0x483a28,_0x479603){return function(_0x398879){if(_0x398879){return _0x398879[_0x861d('0x25')](_0x483a28)[_0x861d('0x26')](function(_0x1ad4b6){return _0x1ad4b6;});}return null;};}function removeEntity(_0x16f7dc,_0xb5bbba){return function(_0x20ce9e){if(_0x20ce9e){return _0x20ce9e[_0x861d('0x27')]()['then'](function(){_0x16f7dc[_0x861d('0x1a')](0xcc)[_0x861d('0x1b')]();});}};}function handleEntityNotFound(_0x448d6a,_0x13e174){return function(_0x3a3b8f){if(!_0x3a3b8f){_0x448d6a[_0x861d('0x28')](0x194);}return _0x3a3b8f;};}function handleError(_0x3703a4,_0x566b5b){_0x566b5b=_0x566b5b||0x1f4;return function(_0xf69c06){logger[_0x861d('0x29')](_0xf69c06['stack']);if(_0xf69c06[_0x861d('0x2a')]){delete _0xf69c06[_0x861d('0x2a')];}_0x3703a4[_0x861d('0x1a')](_0x566b5b)[_0x861d('0x2b')](_0xf69c06);};}exports[_0x861d('0x2c')]=function(_0x19071c,_0x2ede6d){var _0x153c39={},_0x278fd2={},_0x1fba83={'count':0x0,'rows':[]};var _0x9b045=_[_0x861d('0x2d')](db[_0x861d('0x2e')][_0x861d('0x2f')],function(_0x399c26){return{'name':_0x399c26[_0x861d('0x30')],'type':_0x399c26[_0x861d('0x31')][_0x861d('0x32')]};});_0x278fd2[_0x861d('0x33')]=_[_0x861d('0x2d')](_0x9b045,'name');_0x278fd2['query']=_[_0x861d('0x34')](_0x19071c[_0x861d('0x35')]);_0x278fd2[_0x861d('0x36')]=_[_0x861d('0x37')](_0x278fd2[_0x861d('0x33')],_0x278fd2[_0x861d('0x35')]);_0x153c39[_0x861d('0x38')]=_[_0x861d('0x37')](_0x278fd2[_0x861d('0x33')],qs['fields'](_0x19071c['query'][_0x861d('0x39')]));_0x153c39[_0x861d('0x38')]=_0x153c39[_0x861d('0x38')][_0x861d('0x3a')]?_0x153c39['attributes']:_0x278fd2[_0x861d('0x33')];if(!_0x19071c[_0x861d('0x35')][_0x861d('0x3b')](_0x861d('0x3c'))){_0x153c39[_0x861d('0x1e')]=qs[_0x861d('0x1e')](_0x19071c[_0x861d('0x35')][_0x861d('0x1e')]);_0x153c39[_0x861d('0x1d')]=qs[_0x861d('0x1d')](_0x19071c[_0x861d('0x35')]['offset']);}_0x153c39[_0x861d('0x3d')]=qs[_0x861d('0x3e')](_0x19071c[_0x861d('0x35')]['sort']);_0x153c39[_0x861d('0x3f')]=qs[_0x861d('0x36')](_[_0x861d('0x40')](_0x19071c[_0x861d('0x35')],_0x278fd2[_0x861d('0x36')]),_0x9b045);if(_0x19071c[_0x861d('0x35')]['filter']){_0x153c39[_0x861d('0x3f')]=_[_0x861d('0x41')](_0x153c39[_0x861d('0x3f')],{'$or':_['map'](_0x9b045,function(_0x697c96){if(_0x697c96[_0x861d('0x31')]!==_0x861d('0x42')){var _0x53a5e0={};_0x53a5e0[_0x697c96['name']]={'$like':'%'+_0x19071c['query'][_0x861d('0x43')]+'%'};return _0x53a5e0;}})});}_0x153c39=_[_0x861d('0x41')]({},_0x153c39,_0x19071c[_0x861d('0x44')]);var _0x4c10ca={'where':_0x153c39[_0x861d('0x3f')]};return db[_0x861d('0x2e')]['count'](_0x4c10ca)[_0x861d('0x26')](function(_0x38de15){_0x1fba83[_0x861d('0x1f')]=_0x38de15;if(_0x19071c['query'][_0x861d('0x45')]){_0x153c39['include']=[{'all':!![]}];}return db[_0x861d('0x2e')]['findAll'](_0x153c39);})[_0x861d('0x26')](function(_0x55a587){_0x1fba83[_0x861d('0x46')]=_0x55a587;return _0x1fba83;})[_0x861d('0x26')](respondWithFilteredResult(_0x2ede6d,_0x153c39))[_0x861d('0x47')](handleError(_0x2ede6d,null));};exports['show']=function(_0x10a30e,_0x2525b0){var _0x1aacca={'raw':!![],'where':{'id':_0x10a30e[_0x861d('0x48')]['id']}},_0x4e7d6e={};_0x4e7d6e['model']=_[_0x861d('0x34')](db['FreshsalesField'][_0x861d('0x2f')]);_0x4e7d6e[_0x861d('0x35')]=_[_0x861d('0x34')](_0x10a30e[_0x861d('0x35')]);_0x4e7d6e[_0x861d('0x36')]=_['intersection'](_0x4e7d6e[_0x861d('0x33')],_0x4e7d6e[_0x861d('0x35')]);_0x1aacca[_0x861d('0x38')]=_['intersection'](_0x4e7d6e[_0x861d('0x33')],qs[_0x861d('0x39')](_0x10a30e[_0x861d('0x35')][_0x861d('0x39')]));_0x1aacca['attributes']=_0x1aacca[_0x861d('0x38')][_0x861d('0x3a')]?_0x1aacca[_0x861d('0x38')]:_0x4e7d6e[_0x861d('0x33')];if(_0x10a30e['query'][_0x861d('0x45')]){_0x1aacca[_0x861d('0x49')]=[{'all':!![]}];}_0x1aacca=_[_0x861d('0x41')]({},_0x1aacca,_0x10a30e[_0x861d('0x44')]);return db['FreshsalesField'][_0x861d('0x4a')](_0x1aacca)[_0x861d('0x26')](handleEntityNotFound(_0x2525b0,null))[_0x861d('0x26')](respondWithResult(_0x2525b0,null))['catch'](handleError(_0x2525b0,null));};exports[_0x861d('0x4b')]=function(_0x1aa2f5,_0x426eab){return db[_0x861d('0x2e')][_0x861d('0x4b')](_0x1aa2f5[_0x861d('0x4c')],{})[_0x861d('0x26')](respondWithResult(_0x426eab,0xc9))[_0x861d('0x47')](handleError(_0x426eab,null));};exports[_0x861d('0x25')]=function(_0x1c3ced,_0x24ca59){if(_0x1c3ced[_0x861d('0x4c')]['id']){delete _0x1c3ced['body']['id'];}return db[_0x861d('0x2e')][_0x861d('0x4a')]({'where':{'id':_0x1c3ced[_0x861d('0x48')]['id']}})[_0x861d('0x26')](handleEntityNotFound(_0x24ca59,null))[_0x861d('0x26')](saveUpdates(_0x1c3ced[_0x861d('0x4c')],null))['then'](respondWithResult(_0x24ca59,null))[_0x861d('0x47')](handleError(_0x24ca59,null));};exports[_0x861d('0x27')]=function(_0x2c3e89,_0x70f6ab){return db[_0x861d('0x2e')][_0x861d('0x4a')]({'where':{'id':_0x2c3e89[_0x861d('0x48')]['id']}})[_0x861d('0x26')](handleEntityNotFound(_0x70f6ab,null))['then'](removeEntity(_0x70f6ab,null))['catch'](handleError(_0x70f6ab,null));}; \ No newline at end of file +var _0xe2c8=['name','send','map','FreshsalesField','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','keys','length','includeAll','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','then','error','stack'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0xe2c8,0x1a7));var _0x8e2c=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xe2c8[_0x565c49];return _0x20ca34;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8e2c('0x0'));var zipdir=require(_0x8e2c('0x1'));var jsonpatch=require(_0x8e2c('0x2'));var rp=require(_0x8e2c('0x3'));var moment=require(_0x8e2c('0x4'));var BPromise=require(_0x8e2c('0x5'));var Mustache=require(_0x8e2c('0x6'));var util=require(_0x8e2c('0x7'));var path=require(_0x8e2c('0x8'));var sox=require(_0x8e2c('0x9'));var csv=require('to-csv');var ejs=require(_0x8e2c('0xa'));var fs=require('fs');var fs_extra=require(_0x8e2c('0xb'));var _=require(_0x8e2c('0xc'));var squel=require(_0x8e2c('0xd'));var crypto=require(_0x8e2c('0xe'));var jsforce=require(_0x8e2c('0xf'));var deskjs=require(_0x8e2c('0x10'));var toCsv=require(_0x8e2c('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8e2c('0x12'));var qs=require(_0x8e2c('0x13'));var as=require(_0x8e2c('0x14'));var hardwareService=require(_0x8e2c('0x15'));var logger=require(_0x8e2c('0x16'))(_0x8e2c('0x17'));var utils=require(_0x8e2c('0x18'));var config=require(_0x8e2c('0x19'));var licenseUtil=require(_0x8e2c('0x1a'));var db=require(_0x8e2c('0x1b'))['db'];function respondWithStatusCode(_0x9e64e8,_0x4d4a39){_0x4d4a39=_0x4d4a39||0xcc;return function(_0x2422c3){if(_0x2422c3){return _0x9e64e8[_0x8e2c('0x1c')](_0x4d4a39);}return _0x9e64e8[_0x8e2c('0x1d')](_0x4d4a39)[_0x8e2c('0x1e')]();};}function respondWithResult(_0x5ea8b0,_0x2f36c2){_0x2f36c2=_0x2f36c2||0xc8;return function(_0x5c87cc){if(_0x5c87cc){return _0x5ea8b0[_0x8e2c('0x1d')](_0x2f36c2)[_0x8e2c('0x1f')](_0x5c87cc);}};}function respondWithFilteredResult(_0x21a415,_0x1ea640){return function(_0x1daf11){if(_0x1daf11){var _0x422f84=typeof _0x1ea640[_0x8e2c('0x20')]===_0x8e2c('0x21')&&typeof _0x1ea640['limit']==='undefined';var _0x3599af=_0x1daf11[_0x8e2c('0x22')];var _0x5147e6=_0x422f84?0x0:_0x1ea640[_0x8e2c('0x20')];var _0x44b552=_0x422f84?_0x1daf11[_0x8e2c('0x22')]:_0x1ea640['offset']+_0x1ea640[_0x8e2c('0x23')];var _0x4f8294;if(_0x44b552>=_0x3599af){_0x44b552=_0x3599af;_0x4f8294=0xc8;}else{_0x4f8294=0xce;}_0x21a415['status'](_0x4f8294);return _0x21a415[_0x8e2c('0x24')]('Content-Range',_0x5147e6+'-'+_0x44b552+'/'+_0x3599af)['json'](_0x1daf11);}return null;};}function patchUpdates(_0x1bd6a2){return function(_0x3e40fb){try{jsonpatch[_0x8e2c('0x25')](_0x3e40fb,_0x1bd6a2,!![]);}catch(_0x1fe4de){return BPromise[_0x8e2c('0x26')](_0x1fe4de);}return _0x3e40fb[_0x8e2c('0x27')]();};}function saveUpdates(_0x5c4c17,_0x1346db){return function(_0x52580b){if(_0x52580b){return _0x52580b[_0x8e2c('0x28')](_0x5c4c17)['then'](function(_0x2feff7){return _0x2feff7;});}return null;};}function removeEntity(_0x3d2478,_0x47205f){return function(_0x474c4e){if(_0x474c4e){return _0x474c4e[_0x8e2c('0x29')]()[_0x8e2c('0x2a')](function(){_0x3d2478[_0x8e2c('0x1d')](0xcc)[_0x8e2c('0x1e')]();});}};}function handleEntityNotFound(_0x3dd9cc,_0x303539){return function(_0x4360e7){if(!_0x4360e7){_0x3dd9cc[_0x8e2c('0x1c')](0x194);}return _0x4360e7;};}function handleError(_0x180951,_0xbecfcf){_0xbecfcf=_0xbecfcf||0x1f4;return function(_0x34d2c8){logger[_0x8e2c('0x2b')](_0x34d2c8[_0x8e2c('0x2c')]);if(_0x34d2c8[_0x8e2c('0x2d')]){delete _0x34d2c8[_0x8e2c('0x2d')];}_0x180951[_0x8e2c('0x1d')](_0xbecfcf)[_0x8e2c('0x2e')](_0x34d2c8);};}exports['index']=function(_0x56de87,_0x4cc907){var _0x48a665={},_0x594f54={},_0x2440e6={'count':0x0,'rows':[]};var _0x11d38b=_[_0x8e2c('0x2f')](db[_0x8e2c('0x30')][_0x8e2c('0x31')],function(_0x4a0564){return{'name':_0x4a0564[_0x8e2c('0x32')],'type':_0x4a0564['type'][_0x8e2c('0x33')]};});_0x594f54[_0x8e2c('0x34')]=_['map'](_0x11d38b,_0x8e2c('0x2d'));_0x594f54['query']=_['keys'](_0x56de87[_0x8e2c('0x35')]);_0x594f54[_0x8e2c('0x36')]=_[_0x8e2c('0x37')](_0x594f54[_0x8e2c('0x34')],_0x594f54['query']);_0x48a665[_0x8e2c('0x38')]=_[_0x8e2c('0x37')](_0x594f54[_0x8e2c('0x34')],qs[_0x8e2c('0x39')](_0x56de87[_0x8e2c('0x35')][_0x8e2c('0x39')]));_0x48a665[_0x8e2c('0x38')]=_0x48a665[_0x8e2c('0x38')]['length']?_0x48a665['attributes']:_0x594f54['model'];if(!_0x56de87[_0x8e2c('0x35')][_0x8e2c('0x3a')](_0x8e2c('0x3b'))){_0x48a665['limit']=qs[_0x8e2c('0x23')](_0x56de87[_0x8e2c('0x35')][_0x8e2c('0x23')]);_0x48a665[_0x8e2c('0x20')]=qs['offset'](_0x56de87['query'][_0x8e2c('0x20')]);}_0x48a665[_0x8e2c('0x3c')]=qs[_0x8e2c('0x3d')](_0x56de87[_0x8e2c('0x35')][_0x8e2c('0x3d')]);_0x48a665[_0x8e2c('0x3e')]=qs[_0x8e2c('0x36')](_[_0x8e2c('0x3f')](_0x56de87[_0x8e2c('0x35')],_0x594f54['filters']),_0x11d38b);if(_0x56de87[_0x8e2c('0x35')][_0x8e2c('0x40')]){_0x48a665[_0x8e2c('0x3e')]=_[_0x8e2c('0x41')](_0x48a665[_0x8e2c('0x3e')],{'$or':_[_0x8e2c('0x2f')](_0x11d38b,function(_0x40b036){if(_0x40b036['type']!==_0x8e2c('0x42')){var _0x1916f6={};_0x1916f6[_0x40b036['name']]={'$like':'%'+_0x56de87['query'][_0x8e2c('0x40')]+'%'};return _0x1916f6;}})});}_0x48a665=_[_0x8e2c('0x41')]({},_0x48a665,_0x56de87[_0x8e2c('0x43')]);var _0x80aced={'where':_0x48a665['where']};return db[_0x8e2c('0x30')][_0x8e2c('0x22')](_0x80aced)['then'](function(_0x2fef64){_0x2440e6[_0x8e2c('0x22')]=_0x2fef64;if(_0x56de87[_0x8e2c('0x35')]['includeAll']){_0x48a665[_0x8e2c('0x44')]=[{'all':!![]}];}return db['FreshsalesField'][_0x8e2c('0x45')](_0x48a665);})[_0x8e2c('0x2a')](function(_0x3e67e3){_0x2440e6['rows']=_0x3e67e3;return _0x2440e6;})[_0x8e2c('0x2a')](respondWithFilteredResult(_0x4cc907,_0x48a665))[_0x8e2c('0x46')](handleError(_0x4cc907,null));};exports['show']=function(_0x49f862,_0x542512){var _0x5869c1={'raw':!![],'where':{'id':_0x49f862['params']['id']}},_0x5b23df={};_0x5b23df['model']=_[_0x8e2c('0x47')](db['FreshsalesField'][_0x8e2c('0x31')]);_0x5b23df[_0x8e2c('0x35')]=_[_0x8e2c('0x47')](_0x49f862[_0x8e2c('0x35')]);_0x5b23df[_0x8e2c('0x36')]=_['intersection'](_0x5b23df[_0x8e2c('0x34')],_0x5b23df[_0x8e2c('0x35')]);_0x5869c1[_0x8e2c('0x38')]=_[_0x8e2c('0x37')](_0x5b23df['model'],qs[_0x8e2c('0x39')](_0x49f862[_0x8e2c('0x35')][_0x8e2c('0x39')]));_0x5869c1['attributes']=_0x5869c1[_0x8e2c('0x38')][_0x8e2c('0x48')]?_0x5869c1[_0x8e2c('0x38')]:_0x5b23df[_0x8e2c('0x34')];if(_0x49f862[_0x8e2c('0x35')][_0x8e2c('0x49')]){_0x5869c1[_0x8e2c('0x44')]=[{'all':!![]}];}_0x5869c1=_[_0x8e2c('0x41')]({},_0x5869c1,_0x49f862[_0x8e2c('0x43')]);return db[_0x8e2c('0x30')][_0x8e2c('0x4a')](_0x5869c1)[_0x8e2c('0x2a')](handleEntityNotFound(_0x542512,null))['then'](respondWithResult(_0x542512,null))['catch'](handleError(_0x542512,null));};exports[_0x8e2c('0x4b')]=function(_0x82f024,_0x18b6ad){return db['FreshsalesField']['create'](_0x82f024[_0x8e2c('0x4c')],{})[_0x8e2c('0x2a')](respondWithResult(_0x18b6ad,0xc9))[_0x8e2c('0x46')](handleError(_0x18b6ad,null));};exports[_0x8e2c('0x28')]=function(_0x1222aa,_0x33451a){if(_0x1222aa[_0x8e2c('0x4c')]['id']){delete _0x1222aa['body']['id'];}return db['FreshsalesField'][_0x8e2c('0x4a')]({'where':{'id':_0x1222aa[_0x8e2c('0x4d')]['id']}})[_0x8e2c('0x2a')](handleEntityNotFound(_0x33451a,null))[_0x8e2c('0x2a')](saveUpdates(_0x1222aa[_0x8e2c('0x4c')],null))[_0x8e2c('0x2a')](respondWithResult(_0x33451a,null))[_0x8e2c('0x46')](handleError(_0x33451a,null));};exports[_0x8e2c('0x29')]=function(_0x78a515,_0x5e2cae){return db[_0x8e2c('0x30')][_0x8e2c('0x4a')]({'where':{'id':_0x78a515[_0x8e2c('0x4d')]['id']}})[_0x8e2c('0x2a')](handleEntityNotFound(_0x5e2cae,null))['then'](removeEntity(_0x5e2cae,null))[_0x8e2c('0x46')](handleError(_0x5e2cae,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 1d073e5..22d39c1 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 _0xdf94=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','util','../../config/logger','api'];(function(_0x20fb02,_0x96c029){var _0x24a33e=function(_0x4b5c8a){while(--_0x4b5c8a){_0x20fb02['push'](_0x20fb02['shift']());}};_0x24a33e(++_0x96c029);}(_0xdf94,0xad));var _0x4df9=function(_0x4a073e,_0xf76aeb){_0x4a073e=_0x4a073e-0x0;var _0x50d260=_0xdf94[_0x4a073e];return _0x50d260;};'use strict';var _=require('lodash');var util=require(_0x4df9('0x0'));var logger=require(_0x4df9('0x1'))(_0x4df9('0x2'));var moment=require(_0x4df9('0x3'));var BPromise=require(_0x4df9('0x4'));var rp=require(_0x4df9('0x5'));var fs=require('fs');var path=require(_0x4df9('0x6'));var rimraf=require(_0x4df9('0x7'));var config=require(_0x4df9('0x8'));var attributes=require(_0x4df9('0x9'));module[_0x4df9('0xa')]=function(_0x3635fb,_0xdcc9a1){return _0x3635fb[_0x4df9('0xb')](_0x4df9('0xc'),attributes,{'tableName':_0x4df9('0xd'),'paranoid':![],'indexes':[{'name':_0x4df9('0xe'),'fields':[_0x4df9('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8325=['define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4f6b77,_0x400c15){var _0x4a7fcd=function(_0x435a11){while(--_0x435a11){_0x4f6b77['push'](_0x4f6b77['shift']());}};_0x4a7fcd(++_0x400c15);}(_0x8325,0x1f1));var _0x5832=function(_0x1e3f0a,_0x3b07b9){_0x1e3f0a=_0x1e3f0a-0x0;var _0x41c74d=_0x8325[_0x1e3f0a];return _0x41c74d;};'use strict';var _=require(_0x5832('0x0'));var util=require('util');var logger=require(_0x5832('0x1'))('api');var moment=require(_0x5832('0x2'));var BPromise=require('bluebird');var rp=require(_0x5832('0x3'));var fs=require('fs');var path=require(_0x5832('0x4'));var rimraf=require(_0x5832('0x5'));var config=require(_0x5832('0x6'));var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x1c40ca,_0x2c7977){return _0x1c40ca[_0x5832('0x7')](_0x5832('0x8'),attributes,{'tableName':_0x5832('0x9'),'paranoid':![],'indexes':[{'name':_0x5832('0xa'),'fields':['idField',_0x5832('0xb')],'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 3622236..e944cbc 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 _0xd8fb=['info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0xa98302,_0x844f27){var _0x1ad8e3=function(_0x57e51d){while(--_0x57e51d){_0xa98302['push'](_0xa98302['shift']());}};_0x1ad8e3(++_0x844f27);}(_0xd8fb,0x99));var _0xbd8f=function(_0x49e740,_0x4cfe40){_0x49e740=_0x49e740-0x0;var _0x1a8fab=_0xd8fb[_0x49e740];return _0x1a8fab;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var moment=require(_0xbd8f('0x2'));var BPromise=require(_0xbd8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd8f('0x4'));var logger=require(_0xbd8f('0x5'))('rpc');var config=require(_0xbd8f('0x6'));var jayson=require(_0xbd8f('0x7'));var client=jayson['client'][_0xbd8f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e97cf,_0xf503c4,_0x578499){return new BPromise(function(_0x197827,_0x403edc){return client['request'](_0x4e97cf,_0x578499)['then'](function(_0x3caa93){logger[_0xbd8f('0x9')](_0xbd8f('0xa'),_0xf503c4,'request\x20sent');logger[_0xbd8f('0xb')](_0xbd8f('0xc'),_0xf503c4,'request\x20sent',JSON['stringify'](_0x3caa93));if(_0x3caa93[_0xbd8f('0xd')]){if(_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xe')]===0x1f4){logger['error'](_0xbd8f('0xa'),_0xf503c4,_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);return _0x403edc(_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);}logger[_0xbd8f('0xd')](_0xbd8f('0xa'),_0xf503c4,_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);return _0x197827(_0x3caa93['error'][_0xbd8f('0xf')]);}else{logger[_0xbd8f('0x9')](_0xbd8f('0xa'),_0xf503c4,_0xbd8f('0x10'));_0x197827(_0x3caa93['result'][_0xbd8f('0xf')]);}})[_0xbd8f('0x11')](function(_0x5ebf8b){logger[_0xbd8f('0xd')](_0xbd8f('0xa'),_0xf503c4,_0x5ebf8b);_0x403edc(_0x5ebf8b);});});} \ No newline at end of file +var _0x187d=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x553feb,_0x520910){var _0x5b46de=function(_0x1fc70d){while(--_0x1fc70d){_0x553feb['push'](_0x553feb['shift']());}};_0x5b46de(++_0x520910);}(_0x187d,0x93));var _0xd187=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x187d[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var moment=require(_0xd187('0x1'));var BPromise=require(_0xd187('0x2'));var rs=require(_0xd187('0x3'));var fs=require('fs');var Redis=require(_0xd187('0x4'));var db=require(_0xd187('0x5'))['db'];var utils=require(_0xd187('0x6'));var logger=require('../../config/logger')(_0xd187('0x7'));var config=require(_0xd187('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd187('0x9')][_0xd187('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x444a60,_0x1d3fe4,_0x28ce2f){return new BPromise(function(_0x2d6992,_0x358c45){return client[_0xd187('0xb')](_0x444a60,_0x28ce2f)['then'](function(_0x342539){logger[_0xd187('0xc')](_0xd187('0xd'),_0x1d3fe4,_0xd187('0xe'));logger[_0xd187('0xf')](_0xd187('0x10'),_0x1d3fe4,'request\x20sent',JSON[_0xd187('0x11')](_0x342539));if(_0x342539[_0xd187('0x12')]){if(_0x342539[_0xd187('0x12')]['code']===0x1f4){logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539[_0xd187('0x12')]['message']);return _0x358c45(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}logger[_0xd187('0x12')](_0xd187('0xd'),_0x1d3fe4,_0x342539['error'][_0xd187('0x13')]);return _0x2d6992(_0x342539[_0xd187('0x12')][_0xd187('0x13')]);}else{logger[_0xd187('0xc')]('FreshsalesField,\x20%s,\x20%s',_0x1d3fe4,_0xd187('0xe'));_0x2d6992(_0x342539['result']['message']);}})[_0xd187('0x14')](function(_0x5a4986){logger['error'](_0xd187('0xd'),_0x1d3fe4,_0x5a4986);_0x358c45(_0x5a4986);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 083db3a..202416c 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(_0x42f004,_0x2c4de6){var _0x8f9cba=function(_0x22495){while(--_0x22495){_0x42f004['push'](_0x42f004['shift']());}};_0x8f9cba(++_0x2c4de6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x2591d3,_0x1bcc36){var _0x34f39c=function(_0x5cdc9f){while(--_0x5cdc9f){_0x2591d3['push'](_0x2591d3['shift']());}};_0x34f39c(++_0x1bcc36);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 35836b9..0a1cab2 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 _0x97ce=['newTab','sequelize','exports','STRING','username','ENUM','integrationTab'];(function(_0xde9a57,_0x1ec3b3){var _0x4f22e2=function(_0x13e0a9){while(--_0x13e0a9){_0xde9a57['push'](_0xde9a57['shift']());}};_0x4f22e2(++_0x1ec3b3);}(_0x97ce,0x151));var _0xe97c=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x97ce[_0x42bc91];return _0x3f5507;};'use strict';var Sequelize=require(_0xe97c('0x0'));module[_0xe97c('0x1')]={'name':{'type':Sequelize[_0xe97c('0x2')]},'description':{'type':Sequelize[_0xe97c('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xe97c('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe97c('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xe97c('0x2')]},'securityToken':{'type':Sequelize[_0xe97c('0x2')]},'serverUrl':{'type':Sequelize[_0xe97c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xe97c('0x4')](_0xe97c('0x5'),_0xe97c('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xf3a8=['integrationTab','newTab','exports','STRING','ENUM'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xf3a8,0xf2));var _0x8f3a=function(_0x1ca9fd,_0x5b3177){_0x1ca9fd=_0x1ca9fd-0x0;var _0x2949c8=_0xf3a8[_0x1ca9fd];return _0x2949c8;};'use strict';var Sequelize=require('sequelize');module[_0x8f3a('0x0')]={'name':{'type':Sequelize[_0x8f3a('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8f3a('0x1')],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x8f3a('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x8f3a('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x8f3a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x8f3a('0x2')](_0x8f3a('0x3'),_0x8f3a('0x4')),'defaultValue':_0x8f3a('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index c25c430..e7de847 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 _0xfb32=['Subject','Description','string','int','picklist','boolean','textarea','remove','includes','label','custom','picklistValues','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','set','Content-Range','apply','reject','update','then','error','stack','name','send','map','SalesforceAccount','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','SalesforceConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientId','username','securityToken','remoteUri','slice','substring','lastIndexOf','Connection','clientSecret','concat','ticketType','ActivityDate','IsRecurrence'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xfb32,0x183));var _0x2fb3=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0xfb32[_0x34bc6c];return _0x168820;};'use strict';var emlformat=require(_0x2fb3('0x0'));var rimraf=require(_0x2fb3('0x1'));var zipdir=require(_0x2fb3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2fb3('0x3'));var moment=require(_0x2fb3('0x4'));var BPromise=require(_0x2fb3('0x5'));var Mustache=require(_0x2fb3('0x6'));var util=require('util');var path=require(_0x2fb3('0x7'));var sox=require(_0x2fb3('0x8'));var csv=require(_0x2fb3('0x9'));var ejs=require(_0x2fb3('0xa'));var fs=require('fs');var fs_extra=require(_0x2fb3('0xb'));var _=require('lodash');var squel=require(_0x2fb3('0xc'));var crypto=require(_0x2fb3('0xd'));var jsforce=require(_0x2fb3('0xe'));var deskjs=require(_0x2fb3('0xf'));var toCsv=require(_0x2fb3('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2fb3('0x10'));var authService=require(_0x2fb3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2fb3('0x12'));var hardwareService=require(_0x2fb3('0x13'));var logger=require(_0x2fb3('0x14'))(_0x2fb3('0x15'));var utils=require(_0x2fb3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2fb3('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xdf2830,_0x5a1dc9){_0x5a1dc9=_0x5a1dc9||0xcc;return function(_0x6aa012){if(_0x6aa012){return _0xdf2830[_0x2fb3('0x18')](_0x5a1dc9);}return _0xdf2830['status'](_0x5a1dc9)[_0x2fb3('0x19')]();};}function respondWithResult(_0x5e9b7f,_0x81cec9){_0x81cec9=_0x81cec9||0xc8;return function(_0x23f3a1){if(_0x23f3a1){return _0x5e9b7f[_0x2fb3('0x1a')](_0x81cec9)[_0x2fb3('0x1b')](_0x23f3a1);}};}function respondWithFilteredResult(_0x3b8ca8,_0x2c5e6e){return function(_0x15d26f){if(_0x15d26f){var _0x29b202=typeof _0x2c5e6e[_0x2fb3('0x1c')]==='undefined'&&typeof _0x2c5e6e[_0x2fb3('0x1d')]===_0x2fb3('0x1e');var _0x1ce40d=_0x15d26f['count'];var _0x4662bd=_0x29b202?0x0:_0x2c5e6e[_0x2fb3('0x1c')];var _0x2b7cd7=_0x29b202?_0x15d26f['count']:_0x2c5e6e[_0x2fb3('0x1c')]+_0x2c5e6e[_0x2fb3('0x1d')];var _0x12f4cd;if(_0x2b7cd7>=_0x1ce40d){_0x2b7cd7=_0x1ce40d;_0x12f4cd=0xc8;}else{_0x12f4cd=0xce;}_0x3b8ca8['status'](_0x12f4cd);return _0x3b8ca8[_0x2fb3('0x1f')](_0x2fb3('0x20'),_0x4662bd+'-'+_0x2b7cd7+'/'+_0x1ce40d)['json'](_0x15d26f);}return null;};}function patchUpdates(_0x2849c2){return function(_0x29fad3){try{jsonpatch[_0x2fb3('0x21')](_0x29fad3,_0x2849c2,!![]);}catch(_0x2cbfe1){return BPromise[_0x2fb3('0x22')](_0x2cbfe1);}return _0x29fad3['save']();};}function saveUpdates(_0xb1138a,_0x4ebe64){return function(_0x275426){if(_0x275426){return _0x275426[_0x2fb3('0x23')](_0xb1138a)[_0x2fb3('0x24')](function(_0x121a14){return _0x121a14;});}return null;};}function removeEntity(_0x3d5b06,_0x4e67e7){return function(_0x4f80ef){if(_0x4f80ef){return _0x4f80ef['destroy']()[_0x2fb3('0x24')](function(){_0x3d5b06[_0x2fb3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54ad61,_0x379a9b){return function(_0x278977){if(!_0x278977){_0x54ad61[_0x2fb3('0x18')](0x194);}return _0x278977;};}function handleError(_0x3a2bef,_0x5d337b){_0x5d337b=_0x5d337b||0x1f4;return function(_0x5b0c72){logger[_0x2fb3('0x25')](_0x5b0c72[_0x2fb3('0x26')]);if(_0x5b0c72['name']){delete _0x5b0c72[_0x2fb3('0x27')];}_0x3a2bef[_0x2fb3('0x1a')](_0x5d337b)[_0x2fb3('0x28')](_0x5b0c72);};}exports['index']=function(_0x1cca98,_0x5132a7){var _0x476380={},_0x12c89b={},_0x1bb30d={'count':0x0,'rows':[]};var _0x54a795=_[_0x2fb3('0x29')](db[_0x2fb3('0x2a')][_0x2fb3('0x2b')],function(_0x1be13c){return{'name':_0x1be13c['fieldName'],'type':_0x1be13c[_0x2fb3('0x2c')][_0x2fb3('0x2d')]};});_0x12c89b[_0x2fb3('0x2e')]=_[_0x2fb3('0x29')](_0x54a795,_0x2fb3('0x27'));_0x12c89b[_0x2fb3('0x2f')]=_[_0x2fb3('0x30')](_0x1cca98['query']);_0x12c89b['filters']=_[_0x2fb3('0x31')](_0x12c89b[_0x2fb3('0x2e')],_0x12c89b['query']);_0x476380['attributes']=_[_0x2fb3('0x31')](_0x12c89b[_0x2fb3('0x2e')],qs['fields'](_0x1cca98[_0x2fb3('0x2f')][_0x2fb3('0x32')]));_0x476380[_0x2fb3('0x33')]=_0x476380[_0x2fb3('0x33')][_0x2fb3('0x34')]?_0x476380[_0x2fb3('0x33')]:_0x12c89b['model'];if(!_0x1cca98[_0x2fb3('0x2f')][_0x2fb3('0x35')](_0x2fb3('0x36'))){_0x476380[_0x2fb3('0x1d')]=qs[_0x2fb3('0x1d')](_0x1cca98[_0x2fb3('0x2f')][_0x2fb3('0x1d')]);_0x476380[_0x2fb3('0x1c')]=qs['offset'](_0x1cca98[_0x2fb3('0x2f')]['offset']);}_0x476380[_0x2fb3('0x37')]=qs['sort'](_0x1cca98[_0x2fb3('0x2f')][_0x2fb3('0x38')]);_0x476380['where']=qs[_0x2fb3('0x39')](_['pick'](_0x1cca98[_0x2fb3('0x2f')],_0x12c89b[_0x2fb3('0x39')]),_0x54a795);if(_0x1cca98[_0x2fb3('0x2f')][_0x2fb3('0x3a')]){_0x476380[_0x2fb3('0x3b')]=_[_0x2fb3('0x3c')](_0x476380['where'],{'$or':_[_0x2fb3('0x29')](_0x54a795,function(_0x529ee8){if(_0x529ee8[_0x2fb3('0x2c')]!==_0x2fb3('0x3d')){var _0x18c2c0={};_0x18c2c0[_0x529ee8['name']]={'$like':'%'+_0x1cca98['query'][_0x2fb3('0x3a')]+'%'};return _0x18c2c0;}})});}_0x476380=_[_0x2fb3('0x3c')]({},_0x476380,_0x1cca98[_0x2fb3('0x3e')]);var _0x37918b={'where':_0x476380['where']};return db[_0x2fb3('0x2a')][_0x2fb3('0x3f')](_0x37918b)[_0x2fb3('0x24')](function(_0xa2a71c){_0x1bb30d[_0x2fb3('0x3f')]=_0xa2a71c;if(_0x1cca98[_0x2fb3('0x2f')]['includeAll']){_0x476380[_0x2fb3('0x40')]=[{'all':!![]}];}return db[_0x2fb3('0x2a')][_0x2fb3('0x41')](_0x476380);})[_0x2fb3('0x24')](function(_0x15ad26){_0x1bb30d[_0x2fb3('0x42')]=_0x15ad26;return _0x1bb30d;})['then'](respondWithFilteredResult(_0x5132a7,_0x476380))[_0x2fb3('0x43')](handleError(_0x5132a7,null));};exports[_0x2fb3('0x44')]=function(_0xd69ed2,_0x31eff8){var _0x595b58={'raw':![],'where':{'id':_0xd69ed2[_0x2fb3('0x45')]['id']}},_0x4be756={};_0x4be756['model']=_[_0x2fb3('0x30')](db['SalesforceAccount'][_0x2fb3('0x2b')]);_0x4be756[_0x2fb3('0x2f')]=_[_0x2fb3('0x30')](_0xd69ed2[_0x2fb3('0x2f')]);_0x4be756[_0x2fb3('0x39')]=_['intersection'](_0x4be756[_0x2fb3('0x2e')],_0x4be756[_0x2fb3('0x2f')]);_0x595b58[_0x2fb3('0x33')]=_[_0x2fb3('0x31')](_0x4be756[_0x2fb3('0x2e')],qs['fields'](_0xd69ed2[_0x2fb3('0x2f')][_0x2fb3('0x32')]));_0x595b58[_0x2fb3('0x33')]=_0x595b58['attributes']['length']?_0x595b58[_0x2fb3('0x33')]:_0x4be756['model'];if(_0xd69ed2[_0x2fb3('0x2f')]['includeAll']){_0x595b58['include']=[{'all':!![]}];}_0x595b58=_[_0x2fb3('0x3c')]({},_0x595b58,_0xd69ed2['options']);return db[_0x2fb3('0x2a')][_0x2fb3('0x46')](_0x595b58)[_0x2fb3('0x24')](handleEntityNotFound(_0x31eff8,null))[_0x2fb3('0x24')](respondWithResult(_0x31eff8,null))[_0x2fb3('0x43')](handleError(_0x31eff8,null));};exports[_0x2fb3('0x47')]=function(_0x1008f8,_0x3065cf){return db[_0x2fb3('0x2a')][_0x2fb3('0x47')](_0x1008f8['body'],{})[_0x2fb3('0x24')](respondWithResult(_0x3065cf,0xc9))['catch'](handleError(_0x3065cf,null));};exports[_0x2fb3('0x23')]=function(_0x10cacf,_0x27d4b1){if(_0x10cacf[_0x2fb3('0x48')]['id']){delete _0x10cacf['body']['id'];}return db[_0x2fb3('0x2a')]['find']({'where':{'id':_0x10cacf[_0x2fb3('0x45')]['id']}})[_0x2fb3('0x24')](handleEntityNotFound(_0x27d4b1,null))[_0x2fb3('0x24')](saveUpdates(_0x10cacf[_0x2fb3('0x48')],null))['then'](respondWithResult(_0x27d4b1,null))[_0x2fb3('0x43')](handleError(_0x27d4b1,null));};exports[_0x2fb3('0x49')]=function(_0x234bd8,_0x12f1ef){return db[_0x2fb3('0x2a')][_0x2fb3('0x46')]({'where':{'id':_0x234bd8[_0x2fb3('0x45')]['id']}})[_0x2fb3('0x24')](handleEntityNotFound(_0x12f1ef,null))[_0x2fb3('0x24')](removeEntity(_0x12f1ef,null))[_0x2fb3('0x43')](handleError(_0x12f1ef,null));};exports[_0x2fb3('0x4a')]=function(_0x417470,_0xa34cd1,_0x4e50ae){var _0xe0f754={};var _0x3e7439={};var _0x54a7b9;var _0x264f8f;return db[_0x2fb3('0x2a')][_0x2fb3('0x4b')]({'where':{'id':_0x417470[_0x2fb3('0x45')]['id']}})[_0x2fb3('0x24')](handleEntityNotFound(_0xa34cd1,null))[_0x2fb3('0x24')](function(_0x1c4dc8){if(_0x1c4dc8){_0x54a7b9=_0x1c4dc8;_0x3e7439[_0x2fb3('0x2e')]=_[_0x2fb3('0x30')](db[_0x2fb3('0x4c')][_0x2fb3('0x2b')]);_0x3e7439[_0x2fb3('0x2f')]=_[_0x2fb3('0x30')](_0x417470[_0x2fb3('0x2f')]);_0x3e7439[_0x2fb3('0x39')]=_['intersection'](_0x3e7439[_0x2fb3('0x2e')],_0x3e7439[_0x2fb3('0x2f')]);_0xe0f754[_0x2fb3('0x33')]=_['intersection'](_0x3e7439[_0x2fb3('0x2e')],qs[_0x2fb3('0x32')](_0x417470[_0x2fb3('0x2f')]['fields']));_0xe0f754[_0x2fb3('0x33')]=_0xe0f754['attributes'][_0x2fb3('0x34')]?_0xe0f754[_0x2fb3('0x33')]:_0x3e7439[_0x2fb3('0x2e')];_0xe0f754[_0x2fb3('0x37')]=qs[_0x2fb3('0x38')](_0x417470['query'][_0x2fb3('0x38')]);_0xe0f754['where']=qs[_0x2fb3('0x39')](_[_0x2fb3('0x4d')](_0x417470[_0x2fb3('0x2f')],_0x3e7439[_0x2fb3('0x39')]));if(_0x417470[_0x2fb3('0x2f')][_0x2fb3('0x3a')]){_0xe0f754[_0x2fb3('0x3b')]=_['merge'](_0xe0f754[_0x2fb3('0x3b')],{'$or':_[_0x2fb3('0x29')](_0xe0f754[_0x2fb3('0x33')],function(_0x51122d){var _0x4a3d21={};_0x4a3d21[_0x51122d]={'$like':'%'+_0x417470['query'][_0x2fb3('0x3a')]+'%'};return _0x4a3d21;})});}_0xe0f754=_[_0x2fb3('0x3c')]({},_0xe0f754,_0x417470[_0x2fb3('0x3e')]);return _0x54a7b9[_0x2fb3('0x4a')](_0xe0f754);}})[_0x2fb3('0x24')](function(_0x4b58b9){if(_0x4b58b9){_0x264f8f=_0x4b58b9[_0x2fb3('0x34')];if(!_0x417470[_0x2fb3('0x2f')][_0x2fb3('0x35')]('nolimit')){_0xe0f754[_0x2fb3('0x1d')]=qs[_0x2fb3('0x1d')](_0x417470[_0x2fb3('0x2f')][_0x2fb3('0x1d')]);_0xe0f754[_0x2fb3('0x1c')]=qs[_0x2fb3('0x1c')](_0x417470[_0x2fb3('0x2f')][_0x2fb3('0x1c')]);}return _0x54a7b9[_0x2fb3('0x4a')](_0xe0f754);}})[_0x2fb3('0x24')](function(_0x1459a0){if(_0x1459a0){return _0x1459a0?{'count':_0x264f8f,'rows':_0x1459a0}:null;}})[_0x2fb3('0x24')](respondWithResult(_0xa34cd1,null))['catch'](handleError(_0xa34cd1,null));};exports[_0x2fb3('0x4e')]=function(_0x41d682,_0x377061,_0x4ec123){if(_0x41d682['body']['id']){delete _0x41d682[_0x2fb3('0x48')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x41d682[_0x2fb3('0x45')]['id']}})['then'](handleEntityNotFound(_0x377061,null))[_0x2fb3('0x24')](function(_0x3198f6){if(_0x3198f6){_0x41d682[_0x2fb3('0x48')][_0x2fb3('0x4f')]=_0x3198f6['id'];_0x41d682[_0x2fb3('0x48')][_0x2fb3('0x50')]=integrations[_0x2fb3('0x51')](_0x41d682['body'][_0x2fb3('0x52')],_0x41d682[_0x2fb3('0x48')][_0x2fb3('0x2c')]);_0x41d682['body'][_0x2fb3('0x53')]=integrations[_0x2fb3('0x54')](_0x41d682['body'][_0x2fb3('0x52')],_0x41d682[_0x2fb3('0x48')][_0x2fb3('0x2c')]);return db['SalesforceConfiguration'][_0x2fb3('0x47')](_0x41d682[_0x2fb3('0x48')],{'include':[{'model':db[_0x2fb3('0x55')],'as':_0x2fb3('0x50')},{'model':db['SalesforceField'],'as':_0x2fb3('0x53')}]});}return null;})['then'](respondWithResult(_0x377061,null))[_0x2fb3('0x43')](handleError(_0x377061,null));};exports[_0x2fb3('0x56')]=function(_0x4e0172,_0x53d584,_0x28f3ab){var _0x3ce45b;var _0x49639c='';var _0x294ff0=_0x2fb3('0x57');return db['SalesforceAccount']['findOne']({'where':{'id':_0x4e0172[_0x2fb3('0x45')]['id']},'attributes':['id','remoteUri',_0x2fb3('0x58'),'clientSecret',_0x2fb3('0x59'),'password',_0x2fb3('0x5a')]})[_0x2fb3('0x24')](handleEntityNotFound(_0x53d584,null))['then'](function(_0x104332){if(_0x104332){_0x49639c=_0x104332[_0x2fb3('0x5b')];var _0x4ace4e=_0x49639c[_0x2fb3('0x5c')](-0x1);if(_0x4ace4e==='/'){_0x49639c=_0x49639c[_0x2fb3('0x5d')](0x0,_0x49639c[_0x2fb3('0x5e')](_0x4ace4e));}_0x3ce45b=new jsforce[(_0x2fb3('0x5f'))]({'oauth2':{'loginUrl':_0x49639c,'clientId':_0x104332[_0x2fb3('0x58')],'clientSecret':_0x104332[_0x2fb3('0x60')]}});return _0x3ce45b['login'](_0x104332[_0x2fb3('0x59')],_0x104332['password'][_0x2fb3('0x61')](_0x104332[_0x2fb3('0x5a')]));}})['then'](function(_0x38ed37){if(_0x38ed37){if(!_['isNil'](_0x4e0172['query'][_0x2fb3('0x62')])){_0x294ff0=_0x4e0172[_0x2fb3('0x2f')][_0x2fb3('0x62')];}return _0x3ce45b['sobject'](_0x294ff0)['describe']();}})['then'](function(_0x59c356){var _0x17c181=['OwnerId',_0x2fb3('0x63'),'IsReminderSet',_0x2fb3('0x64'),_0x2fb3('0x65'),_0x2fb3('0x66')];var _0x5609b2=[_0x2fb3('0x67'),_0x2fb3('0x68'),_0x2fb3('0x69'),_0x2fb3('0x6a'),'email',_0x2fb3('0x6b'),'phone'];if(_0x59c356){_[_0x2fb3('0x6c')](_0x59c356[_0x2fb3('0x32')],function(_0x570fd9){return _0x17c181[_0x2fb3('0x6d')](_0x570fd9[_0x2fb3('0x27')])||!_0x5609b2['includes'](_0x570fd9[_0x2fb3('0x2c')]);});return{'count':_0x59c356[_0x2fb3('0x32')][_0x2fb3('0x34')],'rows':_[_0x2fb3('0x29')](_0x59c356['fields'],function(_0x558039){return{'id':_0x558039[_0x2fb3('0x27')],'name':_0x558039[_0x2fb3('0x6e')],'custom':_0x558039[_0x2fb3('0x6f')],'options':_0x558039[_0x2fb3('0x70')][_0x2fb3('0x34')]>0x0?_[_0x2fb3('0x29')](_0x558039[_0x2fb3('0x70')],function(_0x27b1c4){return{'name':_0x27b1c4[_0x2fb3('0x6e')],'value':_0x27b1c4['value']};}):_0x558039['type']==_0x2fb3('0x6a')?[{'name':_0x2fb3('0x71'),'value':_0x2fb3('0x72')},{'name':_0x2fb3('0x73'),'value':_0x2fb3('0x74')}]:[]};})};}})[_0x2fb3('0x24')](respondWithResult(_0x53d584,null))['catch'](function(_0x1a2e00){var _0x2aea12=_0x4e0172['query'][_0x2fb3('0x75')]?0x1f4:_0x1a2e00[_0x2fb3('0x76')]||0x1f4;logger[_0x2fb3('0x25')](_0x2fb3('0x77'),_0x2fb3('0x56'),_0x2aea12,JSON[_0x2fb3('0x78')](_0x1a2e00));delete _0x1a2e00['name'];if(_0x2aea12===0x191){_0x2aea12=0x190;}_0x53d584[_0x2fb3('0x1a')](_0x2aea12)[_0x2fb3('0x28')](_0x4e0172[_0x2fb3('0x2f')]['test']?{'message':_0x2fb3('0x79'),'statusCode':_0x1a2e00[_0x2fb3('0x76')]}:_0x1a2e00);});}; \ No newline at end of file +var _0x0b6d=['order','addConfiguration','AccountId','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','securityToken','slice','substring','lastIndexOf','Connection','username','password','concat','isNil','sobject','describe','OwnerId','ActivityDate','IsReminderSet','string','int','picklist','boolean','email','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','set','Content-Range','reject','destroy','end','error','name','send','index','map','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','SalesforceAccount','then','includeAll','findAll','catch','params','keys','include','create','body','find','getConfigurations','findOne','SalesforceConfiguration'];(function(_0x371a92,_0x2de699){var _0x40c3b4=function(_0x51e4db){while(--_0x51e4db){_0x371a92['push'](_0x371a92['shift']());}};_0x40c3b4(++_0x2de699);}(_0x0b6d,0x120));var _0xd0b6=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x0b6d[_0x17406a];return _0x1501ff;};'use strict';var emlformat=require(_0xd0b6('0x0'));var rimraf=require(_0xd0b6('0x1'));var zipdir=require(_0xd0b6('0x2'));var jsonpatch=require(_0xd0b6('0x3'));var rp=require(_0xd0b6('0x4'));var moment=require(_0xd0b6('0x5'));var BPromise=require(_0xd0b6('0x6'));var Mustache=require(_0xd0b6('0x7'));var util=require(_0xd0b6('0x8'));var path=require(_0xd0b6('0x9'));var sox=require(_0xd0b6('0xa'));var csv=require('to-csv');var ejs=require(_0xd0b6('0xb'));var fs=require('fs');var fs_extra=require(_0xd0b6('0xc'));var _=require(_0xd0b6('0xd'));var squel=require(_0xd0b6('0xe'));var crypto=require(_0xd0b6('0xf'));var jsforce=require(_0xd0b6('0x10'));var deskjs=require(_0xd0b6('0x11'));var toCsv=require('to-csv');var querystring=require(_0xd0b6('0x12'));var Papa=require('papaparse');var Redis=require(_0xd0b6('0x13'));var authService=require(_0xd0b6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xd0b6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd0b6('0x16'))('api');var utils=require(_0xd0b6('0x17'));var config=require(_0xd0b6('0x18'));var licenseUtil=require(_0xd0b6('0x19'));var db=require(_0xd0b6('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x48cf3f,_0x3b35c4){_0x3b35c4=_0x3b35c4||0xcc;return function(_0x45421c){if(_0x45421c){return _0x48cf3f[_0xd0b6('0x1b')](_0x3b35c4);}return _0x48cf3f[_0xd0b6('0x1c')](_0x3b35c4)['end']();};}function respondWithResult(_0x1cdca0,_0x593232){_0x593232=_0x593232||0xc8;return function(_0x191ff6){if(_0x191ff6){return _0x1cdca0[_0xd0b6('0x1c')](_0x593232)[_0xd0b6('0x1d')](_0x191ff6);}};}function respondWithFilteredResult(_0x12ef32,_0x1ea9f3){return function(_0xecb1e1){if(_0xecb1e1){var _0x502ed0=typeof _0x1ea9f3['offset']==='undefined'&&typeof _0x1ea9f3[_0xd0b6('0x1e')]==='undefined';var _0x1b4b0b=_0xecb1e1[_0xd0b6('0x1f')];var _0x459a34=_0x502ed0?0x0:_0x1ea9f3[_0xd0b6('0x20')];var _0x2025d1=_0x502ed0?_0xecb1e1[_0xd0b6('0x1f')]:_0x1ea9f3['offset']+_0x1ea9f3[_0xd0b6('0x1e')];var _0x40c75a;if(_0x2025d1>=_0x1b4b0b){_0x2025d1=_0x1b4b0b;_0x40c75a=0xc8;}else{_0x40c75a=0xce;}_0x12ef32[_0xd0b6('0x1c')](_0x40c75a);return _0x12ef32[_0xd0b6('0x21')](_0xd0b6('0x22'),_0x459a34+'-'+_0x2025d1+'/'+_0x1b4b0b)['json'](_0xecb1e1);}return null;};}function patchUpdates(_0x542ead){return function(_0xa110d){try{jsonpatch['apply'](_0xa110d,_0x542ead,!![]);}catch(_0xb140c6){return BPromise[_0xd0b6('0x23')](_0xb140c6);}return _0xa110d['save']();};}function saveUpdates(_0x5bee1d,_0x5ceb97){return function(_0x27271f){if(_0x27271f){return _0x27271f['update'](_0x5bee1d)['then'](function(_0x100102){return _0x100102;});}return null;};}function removeEntity(_0x43de7b,_0x1e89e1){return function(_0x23fa15){if(_0x23fa15){return _0x23fa15[_0xd0b6('0x24')]()['then'](function(){_0x43de7b['status'](0xcc)[_0xd0b6('0x25')]();});}};}function handleEntityNotFound(_0x1d4380,_0x50a5bb){return function(_0x59c6eb){if(!_0x59c6eb){_0x1d4380[_0xd0b6('0x1b')](0x194);}return _0x59c6eb;};}function handleError(_0x53ad58,_0x3f9f68){_0x3f9f68=_0x3f9f68||0x1f4;return function(_0x177e23){logger[_0xd0b6('0x26')](_0x177e23['stack']);if(_0x177e23[_0xd0b6('0x27')]){delete _0x177e23[_0xd0b6('0x27')];}_0x53ad58[_0xd0b6('0x1c')](_0x3f9f68)[_0xd0b6('0x28')](_0x177e23);};}exports[_0xd0b6('0x29')]=function(_0x479a36,_0x543526){var _0x2e3943={},_0x1de1e5={},_0x271834={'count':0x0,'rows':[]};var _0x41d4fd=_[_0xd0b6('0x2a')](db['SalesforceAccount'][_0xd0b6('0x2b')],function(_0x1c74a5){return{'name':_0x1c74a5['fieldName'],'type':_0x1c74a5[_0xd0b6('0x2c')][_0xd0b6('0x2d')]};});_0x1de1e5[_0xd0b6('0x2e')]=_[_0xd0b6('0x2a')](_0x41d4fd,_0xd0b6('0x27'));_0x1de1e5[_0xd0b6('0x2f')]=_['keys'](_0x479a36['query']);_0x1de1e5[_0xd0b6('0x30')]=_['intersection'](_0x1de1e5['model'],_0x1de1e5[_0xd0b6('0x2f')]);_0x2e3943[_0xd0b6('0x31')]=_[_0xd0b6('0x32')](_0x1de1e5[_0xd0b6('0x2e')],qs[_0xd0b6('0x33')](_0x479a36[_0xd0b6('0x2f')][_0xd0b6('0x33')]));_0x2e3943['attributes']=_0x2e3943['attributes'][_0xd0b6('0x34')]?_0x2e3943[_0xd0b6('0x31')]:_0x1de1e5[_0xd0b6('0x2e')];if(!_0x479a36[_0xd0b6('0x2f')][_0xd0b6('0x35')](_0xd0b6('0x36'))){_0x2e3943['limit']=qs[_0xd0b6('0x1e')](_0x479a36[_0xd0b6('0x2f')][_0xd0b6('0x1e')]);_0x2e3943['offset']=qs[_0xd0b6('0x20')](_0x479a36[_0xd0b6('0x2f')][_0xd0b6('0x20')]);}_0x2e3943['order']=qs[_0xd0b6('0x37')](_0x479a36[_0xd0b6('0x2f')][_0xd0b6('0x37')]);_0x2e3943[_0xd0b6('0x38')]=qs['filters'](_[_0xd0b6('0x39')](_0x479a36[_0xd0b6('0x2f')],_0x1de1e5[_0xd0b6('0x30')]),_0x41d4fd);if(_0x479a36[_0xd0b6('0x2f')][_0xd0b6('0x3a')]){_0x2e3943['where']=_[_0xd0b6('0x3b')](_0x2e3943[_0xd0b6('0x38')],{'$or':_[_0xd0b6('0x2a')](_0x41d4fd,function(_0x263d76){if(_0x263d76['type']!==_0xd0b6('0x3c')){var _0x3b4568={};_0x3b4568[_0x263d76[_0xd0b6('0x27')]]={'$like':'%'+_0x479a36[_0xd0b6('0x2f')][_0xd0b6('0x3a')]+'%'};return _0x3b4568;}})});}_0x2e3943=_[_0xd0b6('0x3b')]({},_0x2e3943,_0x479a36['options']);var _0x54699f={'where':_0x2e3943[_0xd0b6('0x38')]};return db[_0xd0b6('0x3d')][_0xd0b6('0x1f')](_0x54699f)[_0xd0b6('0x3e')](function(_0x2f79c0){_0x271834[_0xd0b6('0x1f')]=_0x2f79c0;if(_0x479a36['query'][_0xd0b6('0x3f')]){_0x2e3943['include']=[{'all':!![]}];}return db[_0xd0b6('0x3d')][_0xd0b6('0x40')](_0x2e3943);})[_0xd0b6('0x3e')](function(_0x33f573){_0x271834['rows']=_0x33f573;return _0x271834;})[_0xd0b6('0x3e')](respondWithFilteredResult(_0x543526,_0x2e3943))[_0xd0b6('0x41')](handleError(_0x543526,null));};exports['show']=function(_0x40aa28,_0x4bd98b){var _0x2794f4={'raw':![],'where':{'id':_0x40aa28[_0xd0b6('0x42')]['id']}},_0x51433c={};_0x51433c[_0xd0b6('0x2e')]=_[_0xd0b6('0x43')](db[_0xd0b6('0x3d')][_0xd0b6('0x2b')]);_0x51433c[_0xd0b6('0x2f')]=_['keys'](_0x40aa28['query']);_0x51433c[_0xd0b6('0x30')]=_[_0xd0b6('0x32')](_0x51433c[_0xd0b6('0x2e')],_0x51433c[_0xd0b6('0x2f')]);_0x2794f4['attributes']=_['intersection'](_0x51433c[_0xd0b6('0x2e')],qs[_0xd0b6('0x33')](_0x40aa28['query']['fields']));_0x2794f4[_0xd0b6('0x31')]=_0x2794f4[_0xd0b6('0x31')][_0xd0b6('0x34')]?_0x2794f4[_0xd0b6('0x31')]:_0x51433c[_0xd0b6('0x2e')];if(_0x40aa28[_0xd0b6('0x2f')][_0xd0b6('0x3f')]){_0x2794f4[_0xd0b6('0x44')]=[{'all':!![]}];}_0x2794f4=_[_0xd0b6('0x3b')]({},_0x2794f4,_0x40aa28['options']);return db[_0xd0b6('0x3d')]['find'](_0x2794f4)[_0xd0b6('0x3e')](handleEntityNotFound(_0x4bd98b,null))[_0xd0b6('0x3e')](respondWithResult(_0x4bd98b,null))[_0xd0b6('0x41')](handleError(_0x4bd98b,null));};exports[_0xd0b6('0x45')]=function(_0x4f3117,_0x5beff2){return db[_0xd0b6('0x3d')][_0xd0b6('0x45')](_0x4f3117[_0xd0b6('0x46')],{})[_0xd0b6('0x3e')](respondWithResult(_0x5beff2,0xc9))[_0xd0b6('0x41')](handleError(_0x5beff2,null));};exports['update']=function(_0x16eb95,_0x3ef87a){if(_0x16eb95[_0xd0b6('0x46')]['id']){delete _0x16eb95[_0xd0b6('0x46')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x16eb95['params']['id']}})[_0xd0b6('0x3e')](handleEntityNotFound(_0x3ef87a,null))[_0xd0b6('0x3e')](saveUpdates(_0x16eb95[_0xd0b6('0x46')],null))['then'](respondWithResult(_0x3ef87a,null))[_0xd0b6('0x41')](handleError(_0x3ef87a,null));};exports[_0xd0b6('0x24')]=function(_0xfda3da,_0x2b84fe){return db[_0xd0b6('0x3d')][_0xd0b6('0x47')]({'where':{'id':_0xfda3da['params']['id']}})[_0xd0b6('0x3e')](handleEntityNotFound(_0x2b84fe,null))[_0xd0b6('0x3e')](removeEntity(_0x2b84fe,null))['catch'](handleError(_0x2b84fe,null));};exports[_0xd0b6('0x48')]=function(_0xc2d20b,_0x6ad919,_0x130869){var _0x20fe9b={};var _0x396815={};var _0x64544c;var _0x469de8;return db['SalesforceAccount'][_0xd0b6('0x49')]({'where':{'id':_0xc2d20b[_0xd0b6('0x42')]['id']}})['then'](handleEntityNotFound(_0x6ad919,null))['then'](function(_0x91a7d0){if(_0x91a7d0){_0x64544c=_0x91a7d0;_0x396815[_0xd0b6('0x2e')]=_[_0xd0b6('0x43')](db[_0xd0b6('0x4a')][_0xd0b6('0x2b')]);_0x396815[_0xd0b6('0x2f')]=_['keys'](_0xc2d20b[_0xd0b6('0x2f')]);_0x396815[_0xd0b6('0x30')]=_['intersection'](_0x396815['model'],_0x396815[_0xd0b6('0x2f')]);_0x20fe9b[_0xd0b6('0x31')]=_[_0xd0b6('0x32')](_0x396815['model'],qs[_0xd0b6('0x33')](_0xc2d20b[_0xd0b6('0x2f')][_0xd0b6('0x33')]));_0x20fe9b[_0xd0b6('0x31')]=_0x20fe9b[_0xd0b6('0x31')][_0xd0b6('0x34')]?_0x20fe9b[_0xd0b6('0x31')]:_0x396815[_0xd0b6('0x2e')];_0x20fe9b[_0xd0b6('0x4b')]=qs[_0xd0b6('0x37')](_0xc2d20b[_0xd0b6('0x2f')][_0xd0b6('0x37')]);_0x20fe9b['where']=qs[_0xd0b6('0x30')](_[_0xd0b6('0x39')](_0xc2d20b[_0xd0b6('0x2f')],_0x396815[_0xd0b6('0x30')]));if(_0xc2d20b[_0xd0b6('0x2f')]['filter']){_0x20fe9b['where']=_[_0xd0b6('0x3b')](_0x20fe9b[_0xd0b6('0x38')],{'$or':_[_0xd0b6('0x2a')](_0x20fe9b[_0xd0b6('0x31')],function(_0x53e878){var _0x2bc1cc={};_0x2bc1cc[_0x53e878]={'$like':'%'+_0xc2d20b[_0xd0b6('0x2f')][_0xd0b6('0x3a')]+'%'};return _0x2bc1cc;})});}_0x20fe9b=_[_0xd0b6('0x3b')]({},_0x20fe9b,_0xc2d20b['options']);return _0x64544c[_0xd0b6('0x48')](_0x20fe9b);}})[_0xd0b6('0x3e')](function(_0x4c56a7){if(_0x4c56a7){_0x469de8=_0x4c56a7[_0xd0b6('0x34')];if(!_0xc2d20b[_0xd0b6('0x2f')][_0xd0b6('0x35')](_0xd0b6('0x36'))){_0x20fe9b[_0xd0b6('0x1e')]=qs[_0xd0b6('0x1e')](_0xc2d20b[_0xd0b6('0x2f')][_0xd0b6('0x1e')]);_0x20fe9b[_0xd0b6('0x20')]=qs[_0xd0b6('0x20')](_0xc2d20b[_0xd0b6('0x2f')][_0xd0b6('0x20')]);}return _0x64544c[_0xd0b6('0x48')](_0x20fe9b);}})['then'](function(_0x1bd686){if(_0x1bd686){return _0x1bd686?{'count':_0x469de8,'rows':_0x1bd686}:null;}})[_0xd0b6('0x3e')](respondWithResult(_0x6ad919,null))[_0xd0b6('0x41')](handleError(_0x6ad919,null));};exports[_0xd0b6('0x4c')]=function(_0x5af13d,_0x2ea6e4,_0x3281f7){if(_0x5af13d[_0xd0b6('0x46')]['id']){delete _0x5af13d[_0xd0b6('0x46')]['id'];}return db[_0xd0b6('0x3d')][_0xd0b6('0x49')]({'where':{'id':_0x5af13d[_0xd0b6('0x42')]['id']}})[_0xd0b6('0x3e')](handleEntityNotFound(_0x2ea6e4,null))[_0xd0b6('0x3e')](function(_0x26f444){if(_0x26f444){_0x5af13d[_0xd0b6('0x46')][_0xd0b6('0x4d')]=_0x26f444['id'];_0x5af13d[_0xd0b6('0x46')]['Subjects']=integrations['getSubjects'](_0x5af13d['body']['channel'],_0x5af13d[_0xd0b6('0x46')][_0xd0b6('0x2c')]);_0x5af13d[_0xd0b6('0x46')][_0xd0b6('0x4e')]=integrations[_0xd0b6('0x4f')](_0x5af13d[_0xd0b6('0x46')][_0xd0b6('0x50')],_0x5af13d[_0xd0b6('0x46')][_0xd0b6('0x2c')]);return db['SalesforceConfiguration'][_0xd0b6('0x45')](_0x5af13d[_0xd0b6('0x46')],{'include':[{'model':db[_0xd0b6('0x51')],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0xd0b6('0x4e')}]});}return null;})[_0xd0b6('0x3e')](respondWithResult(_0x2ea6e4,null))[_0xd0b6('0x41')](handleError(_0x2ea6e4,null));};exports[_0xd0b6('0x52')]=function(_0x43482c,_0x26f606,_0x32f894){var _0x434282;var _0x16d37b='';var _0x6df389=_0xd0b6('0x53');return db[_0xd0b6('0x3d')][_0xd0b6('0x49')]({'where':{'id':_0x43482c[_0xd0b6('0x42')]['id']},'attributes':['id',_0xd0b6('0x54'),_0xd0b6('0x55'),_0xd0b6('0x56'),'username','password',_0xd0b6('0x57')]})[_0xd0b6('0x3e')](handleEntityNotFound(_0x26f606,null))[_0xd0b6('0x3e')](function(_0x4775cd){if(_0x4775cd){_0x16d37b=_0x4775cd[_0xd0b6('0x54')];var _0x1b5036=_0x16d37b[_0xd0b6('0x58')](-0x1);if(_0x1b5036==='/'){_0x16d37b=_0x16d37b[_0xd0b6('0x59')](0x0,_0x16d37b[_0xd0b6('0x5a')](_0x1b5036));}_0x434282=new jsforce[(_0xd0b6('0x5b'))]({'oauth2':{'loginUrl':_0x16d37b,'clientId':_0x4775cd[_0xd0b6('0x55')],'clientSecret':_0x4775cd['clientSecret']}});return _0x434282['login'](_0x4775cd[_0xd0b6('0x5c')],_0x4775cd[_0xd0b6('0x5d')][_0xd0b6('0x5e')](_0x4775cd[_0xd0b6('0x57')]));}})['then'](function(_0x27bee6){if(_0x27bee6){if(!_[_0xd0b6('0x5f')](_0x43482c[_0xd0b6('0x2f')]['ticketType'])){_0x6df389=_0x43482c['query']['ticketType'];}return _0x434282[_0xd0b6('0x60')](_0x6df389)[_0xd0b6('0x61')]();}})['then'](function(_0x3a3be2){var _0x4c295c=[_0xd0b6('0x62'),_0xd0b6('0x63'),_0xd0b6('0x64'),'IsRecurrence','Subject','Description'];var _0x27dfec=[_0xd0b6('0x65'),_0xd0b6('0x66'),_0xd0b6('0x67'),_0xd0b6('0x68'),_0xd0b6('0x69'),'textarea','phone'];if(_0x3a3be2){_[_0xd0b6('0x6a')](_0x3a3be2[_0xd0b6('0x33')],function(_0x3019f2){return _0x4c295c[_0xd0b6('0x6b')](_0x3019f2['name'])||!_0x27dfec[_0xd0b6('0x6b')](_0x3019f2[_0xd0b6('0x2c')]);});return{'count':_0x3a3be2['fields'][_0xd0b6('0x34')],'rows':_[_0xd0b6('0x2a')](_0x3a3be2[_0xd0b6('0x33')],function(_0x14c0b9){return{'id':_0x14c0b9[_0xd0b6('0x27')],'name':_0x14c0b9[_0xd0b6('0x6c')],'custom':_0x14c0b9[_0xd0b6('0x6d')],'options':_0x14c0b9[_0xd0b6('0x6e')][_0xd0b6('0x34')]>0x0?_[_0xd0b6('0x2a')](_0x14c0b9[_0xd0b6('0x6e')],function(_0x6aabf0){return{'name':_0x6aabf0[_0xd0b6('0x6c')],'value':_0x6aabf0[_0xd0b6('0x6f')]};}):_0x14c0b9[_0xd0b6('0x2c')]==_0xd0b6('0x68')?[{'name':_0xd0b6('0x70'),'value':_0xd0b6('0x71')},{'name':_0xd0b6('0x72'),'value':_0xd0b6('0x73')}]:[]};})};}})[_0xd0b6('0x3e')](respondWithResult(_0x26f606,null))['catch'](function(_0x5b60c4){var _0x5ae5d7=_0x43482c[_0xd0b6('0x2f')][_0xd0b6('0x74')]?0x1f4:_0x5b60c4['statusCode']||0x1f4;logger[_0xd0b6('0x26')](_0xd0b6('0x75'),_0xd0b6('0x52'),_0x5ae5d7,JSON[_0xd0b6('0x76')](_0x5b60c4));delete _0x5b60c4['name'];if(_0x5ae5d7===0x191){_0x5ae5d7=0x190;}_0x26f606[_0xd0b6('0x1c')](_0x5ae5d7)[_0xd0b6('0x28')](_0x43482c['query'][_0xd0b6('0x74')]?{'message':_0xd0b6('0x77'),'statusCode':_0x5b60c4[_0xd0b6('0x78')]}:_0x5b60c4);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 19aae22..04f0372 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 _0x9c54=['lodash','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','define','SalesforceAccount','int_salesforce_accounts'];(function(_0x333ef3,_0x20cfb7){var _0x4aabab=function(_0x7730b4){while(--_0x7730b4){_0x333ef3['push'](_0x333ef3['shift']());}};_0x4aabab(++_0x20cfb7);}(_0x9c54,0x120));var _0x49c5=function(_0x4054e5,_0x30ea26){_0x4054e5=_0x4054e5-0x0;var _0x1dfc06=_0x9c54[_0x4054e5];return _0x1dfc06;};'use strict';var _=require(_0x49c5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x49c5('0x1'));var rp=require(_0x49c5('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x49c5('0x3'));var config=require(_0x49c5('0x4'));var attributes=require(_0x49c5('0x5'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x30798b,_0x12795e){return _0x30798b[_0x49c5('0x6')](_0x49c5('0x7'),attributes,{'tableName':_0x49c5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x068e=['../../config/logger','api','bluebird','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','lodash','util'];(function(_0x30edb6,_0xe092e2){var _0x3fa4eb=function(_0x47c0b5){while(--_0x47c0b5){_0x30edb6['push'](_0x30edb6['shift']());}};_0x3fa4eb(++_0xe092e2);}(_0x068e,0x18a));var _0xe068=function(_0x163e23,_0x509bd9){_0x163e23=_0x163e23-0x0;var _0x126ade=_0x068e[_0x163e23];return _0x126ade;};'use strict';var _=require(_0xe068('0x0'));var util=require(_0xe068('0x1'));var logger=require(_0xe068('0x2'))(_0xe068('0x3'));var moment=require('moment');var BPromise=require(_0xe068('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(_0xe068('0x5'));var integrations=require(_0xe068('0x6'));module[_0xe068('0x7')]=function(_0x2d7ce0,_0x12eda2){return _0x2d7ce0['define'](_0xe068('0x8'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index c089100..b2f4c51 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 _0x4b8f=['model','map','info','find','ShowSalesforceAccount','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SalesforceAccount,\x20%s,\x20%s','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','limit','include'];(function(_0x5cfd02,_0x4ecf33){var _0x45a8f7=function(_0x2ccd88){while(--_0x2ccd88){_0x5cfd02['push'](_0x5cfd02['shift']());}};_0x45a8f7(++_0x4ecf33);}(_0x4b8f,0x6e));var _0xf4b8=function(_0x4e6b42,_0x1ecd62){_0x4e6b42=_0x4e6b42-0x0;var _0x38e2a8=_0x4b8f[_0x4e6b42];return _0x38e2a8;};'use strict';var _=require('lodash');var util=require(_0xf4b8('0x0'));var moment=require(_0xf4b8('0x1'));var BPromise=require(_0xf4b8('0x2'));var rs=require(_0xf4b8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4b8('0x4'))['db'];var utils=require(_0xf4b8('0x5'));var logger=require(_0xf4b8('0x6'))(_0xf4b8('0x7'));var config=require(_0xf4b8('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf4b8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x142d38,_0x2dd227,_0x4876b7){return new BPromise(function(_0x22ca90,_0x50b8ed){return client[_0xf4b8('0xa')](_0x142d38,_0x4876b7)[_0xf4b8('0xb')](function(_0xf1318d){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x2dd227,'request\x20sent');logger[_0xf4b8('0xc')](_0xf4b8('0xd'),_0x2dd227,_0xf4b8('0xe'),JSON[_0xf4b8('0xf')](_0xf1318d));if(_0xf1318d[_0xf4b8('0x10')]){if(_0xf1318d[_0xf4b8('0x10')][_0xf4b8('0x11')]===0x1f4){logger[_0xf4b8('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x2dd227,_0xf1318d['error'][_0xf4b8('0x12')]);return _0x50b8ed(_0xf1318d['error'][_0xf4b8('0x12')]);}logger[_0xf4b8('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x2dd227,_0xf1318d[_0xf4b8('0x10')][_0xf4b8('0x12')]);return _0x22ca90(_0xf1318d[_0xf4b8('0x10')][_0xf4b8('0x12')]);}else{logger['info'](_0xf4b8('0x13'),_0x2dd227,_0xf4b8('0xe'));_0x22ca90(_0xf1318d[_0xf4b8('0x14')][_0xf4b8('0x12')]);}})[_0xf4b8('0x15')](function(_0x1eb5cb){logger[_0xf4b8('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x2dd227,_0x1eb5cb);_0x50b8ed(_0x1eb5cb);});});}exports[_0xf4b8('0x16')]=function(_0x33dbf4){var _0x43d4ed=this;return new Promise(function(_0xbbd2f6,_0x12d4af){return db[_0xf4b8('0x17')][_0xf4b8('0x18')]({'raw':_0x33dbf4['options']?_0x33dbf4[_0xf4b8('0x19')][_0xf4b8('0x1a')]===undefined?!![]:![]:!![],'where':_0x33dbf4['options']?_0x33dbf4[_0xf4b8('0x19')]['where']||null:null,'attributes':_0x33dbf4[_0xf4b8('0x19')]?_0x33dbf4[_0xf4b8('0x19')][_0xf4b8('0x1b')]||null:null,'limit':_0x33dbf4['options']?_0x33dbf4[_0xf4b8('0x19')][_0xf4b8('0x1c')]||null:null,'include':_0x33dbf4[_0xf4b8('0x19')]?_0x33dbf4[_0xf4b8('0x19')][_0xf4b8('0x1d')]?_['map'](_0x33dbf4['options'][_0xf4b8('0x1d')],function(_0x2480f5){return{'model':db[_0x2480f5[_0xf4b8('0x1e')]],'as':_0x2480f5['as'],'attributes':_0x2480f5['attributes'],'include':_0x2480f5[_0xf4b8('0x1d')]?_['map'](_0x2480f5[_0xf4b8('0x1d')],function(_0x53fccc){return{'model':db[_0x53fccc[_0xf4b8('0x1e')]],'as':_0x53fccc['as'],'attributes':_0x53fccc[_0xf4b8('0x1b')],'include':_0x53fccc[_0xf4b8('0x1d')]?_[_0xf4b8('0x1f')](_0x53fccc['include'],function(_0x2f26ef){return{'model':db[_0x2f26ef[_0xf4b8('0x1e')]],'as':_0x2f26ef['as'],'attributes':_0x2f26ef[_0xf4b8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf4b8('0xb')](function(_0x455688){logger[_0xf4b8('0x20')](_0xf4b8('0x16'),_0x33dbf4);logger[_0xf4b8('0xc')](_0xf4b8('0x16'),_0x33dbf4,JSON[_0xf4b8('0xf')](_0x455688));_0xbbd2f6(_0x455688);})[_0xf4b8('0x15')](function(_0x57d96e){logger['error'](_0xf4b8('0x16'),_0x57d96e['message'],_0x33dbf4);_0x12d4af(_0x43d4ed[_0xf4b8('0x10')](0x1f4,_0x57d96e['message']));});});};exports['ShowSalesforceAccount']=function(_0x18a3b1){var _0x398396=this;return new Promise(function(_0x3aaa78,_0x13247b){return db['SalesforceAccount'][_0xf4b8('0x21')]({'raw':_0x18a3b1['options']?_0x18a3b1['options'][_0xf4b8('0x1a')]===undefined?!![]:![]:!![],'where':_0x18a3b1['options']?_0x18a3b1[_0xf4b8('0x19')]['where']||null:null,'attributes':_0x18a3b1[_0xf4b8('0x19')]?_0x18a3b1[_0xf4b8('0x19')][_0xf4b8('0x1b')]||null:null,'include':_0x18a3b1[_0xf4b8('0x19')]?_0x18a3b1[_0xf4b8('0x19')][_0xf4b8('0x1d')]?_['map'](_0x18a3b1['options'][_0xf4b8('0x1d')],function(_0x3018e0){return{'model':db[_0x3018e0['model']],'as':_0x3018e0['as'],'attributes':_0x3018e0[_0xf4b8('0x1b')],'include':_0x3018e0[_0xf4b8('0x1d')]?_[_0xf4b8('0x1f')](_0x3018e0['include'],function(_0x2ffd92){return{'model':db[_0x2ffd92[_0xf4b8('0x1e')]],'as':_0x2ffd92['as'],'attributes':_0x2ffd92[_0xf4b8('0x1b')],'include':_0x2ffd92[_0xf4b8('0x1d')]?_['map'](_0x2ffd92[_0xf4b8('0x1d')],function(_0x3f6f91){return{'model':db[_0x3f6f91[_0xf4b8('0x1e')]],'as':_0x3f6f91['as'],'attributes':_0x3f6f91[_0xf4b8('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x456eba){logger[_0xf4b8('0x20')](_0xf4b8('0x22'),_0x18a3b1);logger[_0xf4b8('0xc')]('ShowSalesforceAccount',_0x18a3b1,JSON[_0xf4b8('0xf')](_0x456eba));_0x3aaa78(_0x456eba);})[_0xf4b8('0x15')](function(_0x451162){logger[_0xf4b8('0x10')](_0xf4b8('0x22'),_0x451162['message'],_0x18a3b1);_0x13247b(_0x398396[_0xf4b8('0x10')](0x1f4,_0x451162[_0xf4b8('0x12')]));});});}; \ No newline at end of file +var _0x73a8=['ShowSalesforceAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','info','stringify'];(function(_0x57d323,_0x434bb9){var _0x142171=function(_0x1d7ae5){while(--_0x1d7ae5){_0x57d323['push'](_0x57d323['shift']());}};_0x142171(++_0x434bb9);}(_0x73a8,0x12a));var _0x873a=function(_0x50e7d1,_0x331d0c){_0x50e7d1=_0x50e7d1-0x0;var _0x59412a=_0x73a8[_0x50e7d1];return _0x59412a;};'use strict';var _=require('lodash');var util=require(_0x873a('0x0'));var moment=require('moment');var BPromise=require(_0x873a('0x1'));var rs=require(_0x873a('0x2'));var fs=require('fs');var Redis=require(_0x873a('0x3'));var db=require(_0x873a('0x4'))['db'];var utils=require(_0x873a('0x5'));var logger=require(_0x873a('0x6'))('rpc');var config=require(_0x873a('0x7'));var jayson=require(_0x873a('0x8'));var client=jayson[_0x873a('0x9')][_0x873a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x146675,_0x2fae77,_0x5d4a24){return new BPromise(function(_0x56c986,_0x4ab9f6){return client[_0x873a('0xb')](_0x146675,_0x5d4a24)[_0x873a('0xc')](function(_0x33add6){logger['info'](_0x873a('0xd'),_0x2fae77,'request\x20sent');logger[_0x873a('0xe')](_0x873a('0xf'),_0x2fae77,_0x873a('0x10'),JSON['stringify'](_0x33add6));if(_0x33add6[_0x873a('0x11')]){if(_0x33add6[_0x873a('0x11')][_0x873a('0x12')]===0x1f4){logger[_0x873a('0x11')](_0x873a('0xd'),_0x2fae77,_0x33add6[_0x873a('0x11')][_0x873a('0x13')]);return _0x4ab9f6(_0x33add6['error'][_0x873a('0x13')]);}logger[_0x873a('0x11')](_0x873a('0xd'),_0x2fae77,_0x33add6[_0x873a('0x11')][_0x873a('0x13')]);return _0x56c986(_0x33add6[_0x873a('0x11')][_0x873a('0x13')]);}else{logger['info'](_0x873a('0xd'),_0x2fae77,_0x873a('0x10'));_0x56c986(_0x33add6[_0x873a('0x14')][_0x873a('0x13')]);}})[_0x873a('0x15')](function(_0x2a82bb){logger['error'](_0x873a('0xd'),_0x2fae77,_0x2a82bb);_0x4ab9f6(_0x2a82bb);});});}exports[_0x873a('0x16')]=function(_0x4af920){var _0x30295f=this;return new Promise(function(_0xa4fc8c,_0xec38b7){return db[_0x873a('0x17')][_0x873a('0x18')]({'raw':_0x4af920[_0x873a('0x19')]?_0x4af920[_0x873a('0x19')][_0x873a('0x1a')]===undefined?!![]:![]:!![],'where':_0x4af920['options']?_0x4af920[_0x873a('0x19')][_0x873a('0x1b')]||null:null,'attributes':_0x4af920[_0x873a('0x19')]?_0x4af920['options'][_0x873a('0x1c')]||null:null,'limit':_0x4af920['options']?_0x4af920[_0x873a('0x19')][_0x873a('0x1d')]||null:null,'include':_0x4af920[_0x873a('0x19')]?_0x4af920[_0x873a('0x19')][_0x873a('0x1e')]?_['map'](_0x4af920[_0x873a('0x19')][_0x873a('0x1e')],function(_0x262995){return{'model':db[_0x262995['model']],'as':_0x262995['as'],'attributes':_0x262995['attributes'],'include':_0x262995['include']?_[_0x873a('0x1f')](_0x262995[_0x873a('0x1e')],function(_0x2a4213){return{'model':db[_0x2a4213[_0x873a('0x20')]],'as':_0x2a4213['as'],'attributes':_0x2a4213[_0x873a('0x1c')],'include':_0x2a4213[_0x873a('0x1e')]?_[_0x873a('0x1f')](_0x2a4213['include'],function(_0x4bd4cb){return{'model':db[_0x4bd4cb['model']],'as':_0x4bd4cb['as'],'attributes':_0x4bd4cb[_0x873a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x873a('0xc')](function(_0x337df4){logger[_0x873a('0x21')](_0x873a('0x16'),_0x4af920);logger[_0x873a('0xe')](_0x873a('0x16'),_0x4af920,JSON[_0x873a('0x22')](_0x337df4));_0xa4fc8c(_0x337df4);})['catch'](function(_0x1e9a80){logger[_0x873a('0x11')](_0x873a('0x16'),_0x1e9a80[_0x873a('0x13')],_0x4af920);_0xec38b7(_0x30295f['error'](0x1f4,_0x1e9a80['message']));});});};exports[_0x873a('0x23')]=function(_0x58150c){var _0x36b26e=this;return new Promise(function(_0x3b57f1,_0x39a987){return db[_0x873a('0x17')][_0x873a('0x24')]({'raw':_0x58150c[_0x873a('0x19')]?_0x58150c['options'][_0x873a('0x1a')]===undefined?!![]:![]:!![],'where':_0x58150c[_0x873a('0x19')]?_0x58150c['options']['where']||null:null,'attributes':_0x58150c['options']?_0x58150c[_0x873a('0x19')][_0x873a('0x1c')]||null:null,'include':_0x58150c[_0x873a('0x19')]?_0x58150c[_0x873a('0x19')][_0x873a('0x1e')]?_[_0x873a('0x1f')](_0x58150c[_0x873a('0x19')][_0x873a('0x1e')],function(_0x51a549){return{'model':db[_0x51a549[_0x873a('0x20')]],'as':_0x51a549['as'],'attributes':_0x51a549['attributes'],'include':_0x51a549[_0x873a('0x1e')]?_['map'](_0x51a549[_0x873a('0x1e')],function(_0x1a0215){return{'model':db[_0x1a0215[_0x873a('0x20')]],'as':_0x1a0215['as'],'attributes':_0x1a0215[_0x873a('0x1c')],'include':_0x1a0215[_0x873a('0x1e')]?_[_0x873a('0x1f')](_0x1a0215[_0x873a('0x1e')],function(_0xdf1df3){return{'model':db[_0xdf1df3[_0x873a('0x20')]],'as':_0xdf1df3['as'],'attributes':_0xdf1df3[_0x873a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x873a('0xc')](function(_0x42f746){logger[_0x873a('0x21')](_0x873a('0x23'),_0x58150c);logger[_0x873a('0xe')](_0x873a('0x23'),_0x58150c,JSON[_0x873a('0x22')](_0x42f746));_0x3b57f1(_0x42f746);})[_0x873a('0x15')](function(_0x4834b9){logger[_0x873a('0x11')]('ShowSalesforceAccount',_0x4834b9[_0x873a('0x13')],_0x58150c);_0x39a987(_0x36b26e[_0x873a('0x11')](0x1f4,_0x4834b9[_0x873a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index a8afb11..2176785 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 _0x2032=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','exports','util','path','connect-timeout'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2032,0xd9));var _0x2203=function(_0x2b13ee,_0x1cb195){_0x2b13ee=_0x2b13ee-0x0;var _0x223866=_0x2032[_0x2b13ee];return _0x223866;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x2203('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2203('0x13')]=router; \ No newline at end of file +var _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x9670f,_0x587aac){var _0x5650da=function(_0x5e8384){while(--_0x5e8384){_0x9670f['push'](_0x9670f['shift']());}};_0x5650da(++_0x587aac);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3c6090,_0x21d42d){_0x3c6090=_0x3c6090-0x0;var _0x5e8320=_0x5f2f[_0x3c6090];return _0x5e8320;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 876f62d..3b1e55d 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 _0x4cc0=['account_contact_lead','account','sequelize','exports','STRING','ENUM','Case','Task','contact','lead'];(function(_0xccf869,_0x2556a5){var _0x21a9db=function(_0xcc4835){while(--_0xcc4835){_0xccf869['push'](_0xccf869['shift']());}};_0x21a9db(++_0x2556a5);}(_0x4cc0,0x142));var _0x04cc=function(_0x343090,_0x433a80){_0x343090=_0x343090-0x0;var _0x3ff3e8=_0x4cc0[_0x343090];return _0x3ff3e8;};'use strict';var Sequelize=require(_0x04cc('0x0'));module[_0x04cc('0x1')]={'name':{'type':Sequelize[_0x04cc('0x2')]},'description':{'type':Sequelize[_0x04cc('0x2')]},'ticketType':{'type':Sequelize[_0x04cc('0x3')]('Task',_0x04cc('0x4')),'defaultValue':_0x04cc('0x5')},'moduleSearch':{'type':Sequelize[_0x04cc('0x3')]('contact_lead',_0x04cc('0x6'),_0x04cc('0x7'),_0x04cc('0x8'),_0x04cc('0x9')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x04cc('0x3')]('nothing','contact',_0x04cc('0x7'),_0x04cc('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x04cc('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x04cc('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x04cc('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x04cc('0x2')]}}; \ No newline at end of file +var _0x4df5=['account','sequelize','exports','STRING','ENUM','Task','Case','contact_lead','lead','nothing','contact'];(function(_0x34e2c1,_0x31e287){var _0xb3d893=function(_0x5e5436){while(--_0x5e5436){_0x34e2c1['push'](_0x34e2c1['shift']());}};_0xb3d893(++_0x31e287);}(_0x4df5,0x140));var _0x54df=function(_0x366cf5,_0x4a05d7){_0x366cf5=_0x366cf5-0x0;var _0x4c4887=_0x4df5[_0x366cf5];return _0x4c4887;};'use strict';var Sequelize=require(_0x54df('0x0'));module[_0x54df('0x1')]={'name':{'type':Sequelize[_0x54df('0x2')]},'description':{'type':Sequelize[_0x54df('0x2')]},'ticketType':{'type':Sequelize[_0x54df('0x3')](_0x54df('0x4'),_0x54df('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x54df('0x3')](_0x54df('0x6'),'contact',_0x54df('0x7'),'account_contact_lead','account'),'defaultValue':_0x54df('0x6')},'moduleCreate':{'type':Sequelize[_0x54df('0x3')](_0x54df('0x8'),_0x54df('0x9'),'lead',_0x54df('0xa')),'defaultValue':_0x54df('0x7')},'leadId':{'type':Sequelize[_0x54df('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x54df('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x54df('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x54df('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 0534e87..35d7e17 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 _0xd7ad=['destroy','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','offset','undefined','limit','set','apply','reject','save','update','then'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xd7ad,0x15c));var _0xdd7a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xd7ad[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0xdd7a('0x0'));var rimraf=require(_0xdd7a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdd7a('0x2'));var moment=require(_0xdd7a('0x3'));var BPromise=require(_0xdd7a('0x4'));var Mustache=require(_0xdd7a('0x5'));var util=require('util');var path=require(_0xdd7a('0x6'));var sox=require(_0xdd7a('0x7'));var csv=require(_0xdd7a('0x8'));var ejs=require(_0xdd7a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd7a('0xa'));var squel=require(_0xdd7a('0xb'));var crypto=require('crypto');var jsforce=require(_0xdd7a('0xc'));var deskjs=require(_0xdd7a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdd7a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdd7a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xdd7a('0x10'));var hardwareService=require(_0xdd7a('0x11'));var logger=require('../../config/logger')(_0xdd7a('0x12'));var utils=require('../../config/utils');var config=require(_0xdd7a('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bc530,_0x13b6b0){_0x13b6b0=_0x13b6b0||0xcc;return function(_0x76a002){if(_0x76a002){return _0x2bc530[_0xdd7a('0x14')](_0x13b6b0);}return _0x2bc530[_0xdd7a('0x15')](_0x13b6b0)[_0xdd7a('0x16')]();};}function respondWithResult(_0x21e9f8,_0x3dd532){_0x3dd532=_0x3dd532||0xc8;return function(_0x1ff800){if(_0x1ff800){return _0x21e9f8[_0xdd7a('0x15')](_0x3dd532)['json'](_0x1ff800);}};}function respondWithFilteredResult(_0x48c96f,_0x55017b){return function(_0x12a149){if(_0x12a149){var _0x9df6bd=typeof _0x55017b[_0xdd7a('0x17')]===_0xdd7a('0x18')&&typeof _0x55017b[_0xdd7a('0x19')]===_0xdd7a('0x18');var _0x3b64b3=_0x12a149['count'];var _0x2bada0=_0x9df6bd?0x0:_0x55017b[_0xdd7a('0x17')];var _0x3e96b6=_0x9df6bd?_0x12a149['count']:_0x55017b[_0xdd7a('0x17')]+_0x55017b[_0xdd7a('0x19')];var _0x25c62f;if(_0x3e96b6>=_0x3b64b3){_0x3e96b6=_0x3b64b3;_0x25c62f=0xc8;}else{_0x25c62f=0xce;}_0x48c96f['status'](_0x25c62f);return _0x48c96f[_0xdd7a('0x1a')]('Content-Range',_0x2bada0+'-'+_0x3e96b6+'/'+_0x3b64b3)['json'](_0x12a149);}return null;};}function patchUpdates(_0x32e674){return function(_0x2900cb){try{jsonpatch[_0xdd7a('0x1b')](_0x2900cb,_0x32e674,!![]);}catch(_0x3b2834){return BPromise[_0xdd7a('0x1c')](_0x3b2834);}return _0x2900cb[_0xdd7a('0x1d')]();};}function saveUpdates(_0x421a87,_0x1757cd){return function(_0xe11425){if(_0xe11425){return _0xe11425[_0xdd7a('0x1e')](_0x421a87)[_0xdd7a('0x1f')](function(_0x481474){return _0x481474;});}return null;};}function removeEntity(_0x35f7f4,_0x1ebcaa){return function(_0x2a5d55){if(_0x2a5d55){return _0x2a5d55[_0xdd7a('0x20')]()[_0xdd7a('0x1f')](function(){_0x35f7f4['status'](0xcc)[_0xdd7a('0x16')]();});}};}function handleEntityNotFound(_0x543b32,_0x4ce9a2){return function(_0x49fb2a){if(!_0x49fb2a){_0x543b32[_0xdd7a('0x14')](0x194);}return _0x49fb2a;};}function handleError(_0x12baea,_0x402804){_0x402804=_0x402804||0x1f4;return function(_0x54652e){logger['error'](_0x54652e[_0xdd7a('0x21')]);if(_0x54652e[_0xdd7a('0x22')]){delete _0x54652e[_0xdd7a('0x22')];}_0x12baea[_0xdd7a('0x15')](_0x402804)[_0xdd7a('0x23')](_0x54652e);};}exports[_0xdd7a('0x24')]=function(_0x52a364,_0x56dc8e){var _0x4ef105={},_0x3ba0d2={},_0x362e08={'count':0x0,'rows':[]};var _0x1d4ead=_[_0xdd7a('0x25')](db[_0xdd7a('0x26')][_0xdd7a('0x27')],function(_0xd560ee){return{'name':_0xd560ee[_0xdd7a('0x28')],'type':_0xd560ee['type'][_0xdd7a('0x29')]};});_0x3ba0d2[_0xdd7a('0x2a')]=_[_0xdd7a('0x25')](_0x1d4ead,_0xdd7a('0x22'));_0x3ba0d2[_0xdd7a('0x2b')]=_[_0xdd7a('0x2c')](_0x52a364[_0xdd7a('0x2b')]);_0x3ba0d2[_0xdd7a('0x2d')]=_[_0xdd7a('0x2e')](_0x3ba0d2[_0xdd7a('0x2a')],_0x3ba0d2[_0xdd7a('0x2b')]);_0x4ef105[_0xdd7a('0x2f')]=_[_0xdd7a('0x2e')](_0x3ba0d2[_0xdd7a('0x2a')],qs[_0xdd7a('0x30')](_0x52a364['query'][_0xdd7a('0x30')]));_0x4ef105['attributes']=_0x4ef105['attributes'][_0xdd7a('0x31')]?_0x4ef105['attributes']:_0x3ba0d2[_0xdd7a('0x2a')];if(!_0x52a364[_0xdd7a('0x2b')][_0xdd7a('0x32')](_0xdd7a('0x33'))){_0x4ef105['limit']=qs[_0xdd7a('0x19')](_0x52a364[_0xdd7a('0x2b')][_0xdd7a('0x19')]);_0x4ef105['offset']=qs[_0xdd7a('0x17')](_0x52a364[_0xdd7a('0x2b')][_0xdd7a('0x17')]);}_0x4ef105[_0xdd7a('0x34')]=qs[_0xdd7a('0x35')](_0x52a364[_0xdd7a('0x2b')][_0xdd7a('0x35')]);_0x4ef105[_0xdd7a('0x36')]=qs[_0xdd7a('0x2d')](_[_0xdd7a('0x37')](_0x52a364['query'],_0x3ba0d2[_0xdd7a('0x2d')]),_0x1d4ead);if(_0x52a364[_0xdd7a('0x2b')]['filter']){_0x4ef105[_0xdd7a('0x36')]=_['merge'](_0x4ef105['where'],{'$or':_[_0xdd7a('0x25')](_0x1d4ead,function(_0x19aecf){if(_0x19aecf[_0xdd7a('0x38')]!=='VIRTUAL'){var _0x18256c={};_0x18256c[_0x19aecf[_0xdd7a('0x22')]]={'$like':'%'+_0x52a364[_0xdd7a('0x2b')][_0xdd7a('0x39')]+'%'};return _0x18256c;}})});}_0x4ef105=_[_0xdd7a('0x3a')]({},_0x4ef105,_0x52a364['options']);var _0x220c87={'where':_0x4ef105[_0xdd7a('0x36')]};return db[_0xdd7a('0x26')][_0xdd7a('0x3b')](_0x220c87)['then'](function(_0x26bf23){_0x362e08[_0xdd7a('0x3b')]=_0x26bf23;if(_0x52a364['query'][_0xdd7a('0x3c')]){_0x4ef105[_0xdd7a('0x3d')]=[{'all':!![]}];}return db[_0xdd7a('0x26')][_0xdd7a('0x3e')](_0x4ef105);})[_0xdd7a('0x1f')](function(_0xf4f44e){_0x362e08[_0xdd7a('0x3f')]=_0xf4f44e;return _0x362e08;})[_0xdd7a('0x1f')](respondWithFilteredResult(_0x56dc8e,_0x4ef105))[_0xdd7a('0x40')](handleError(_0x56dc8e,null));};exports[_0xdd7a('0x41')]=function(_0x29d355,_0x454020){var _0x24566b={'raw':![],'where':{'id':_0x29d355[_0xdd7a('0x42')]['id']}},_0x25442e={};_0x25442e[_0xdd7a('0x2a')]=_[_0xdd7a('0x2c')](db[_0xdd7a('0x26')][_0xdd7a('0x27')]);_0x25442e[_0xdd7a('0x2b')]=_[_0xdd7a('0x2c')](_0x29d355[_0xdd7a('0x2b')]);_0x25442e['filters']=_[_0xdd7a('0x2e')](_0x25442e[_0xdd7a('0x2a')],_0x25442e['query']);_0x24566b[_0xdd7a('0x2f')]=_[_0xdd7a('0x2e')](_0x25442e[_0xdd7a('0x2a')],qs[_0xdd7a('0x30')](_0x29d355[_0xdd7a('0x2b')]['fields']));_0x24566b['attributes']=_0x24566b[_0xdd7a('0x2f')]['length']?_0x24566b['attributes']:_0x25442e['model'];if(_0x29d355['query'][_0xdd7a('0x3c')]){_0x24566b[_0xdd7a('0x3d')]=[{'all':!![]}];}_0x24566b=_[_0xdd7a('0x3a')]({},_0x24566b,_0x29d355[_0xdd7a('0x43')]);return db['SalesforceConfiguration'][_0xdd7a('0x44')](_0x24566b)[_0xdd7a('0x1f')](handleEntityNotFound(_0x454020,null))[_0xdd7a('0x1f')](respondWithResult(_0x454020,null))[_0xdd7a('0x40')](handleError(_0x454020,null));};exports[_0xdd7a('0x45')]=function(_0x2dfdfc,_0x204325){return db['SalesforceConfiguration'][_0xdd7a('0x45')](_0x2dfdfc[_0xdd7a('0x46')],{})['then'](respondWithResult(_0x204325,0xc9))[_0xdd7a('0x40')](handleError(_0x204325,null));};exports[_0xdd7a('0x1e')]=function(_0x506e7d,_0x2eb8c9){if(_0x506e7d[_0xdd7a('0x46')]['id']){delete _0x506e7d[_0xdd7a('0x46')]['id'];}return db[_0xdd7a('0x26')][_0xdd7a('0x44')]({'where':{'id':_0x506e7d[_0xdd7a('0x42')]['id']}})[_0xdd7a('0x1f')](handleEntityNotFound(_0x2eb8c9,null))[_0xdd7a('0x1f')](saveUpdates(_0x506e7d['body'],null))[_0xdd7a('0x1f')](respondWithResult(_0x2eb8c9,null))[_0xdd7a('0x40')](handleError(_0x2eb8c9,null));};exports['destroy']=function(_0x53edd0,_0x58fe72){return db['SalesforceConfiguration'][_0xdd7a('0x44')]({'where':{'id':_0x53edd0[_0xdd7a('0x42')]['id']}})[_0xdd7a('0x1f')](handleEntityNotFound(_0x58fe72,null))[_0xdd7a('0x1f')](removeEntity(_0x58fe72,null))[_0xdd7a('0x40')](handleError(_0x58fe72,null));};exports[_0xdd7a('0x47')]=function(_0x3b50e9,_0x22ea84,_0x200417){var _0x2e214f={};var _0x5b9b62={};var _0x34e5f7;var _0xcc38e4;return db[_0xdd7a('0x26')][_0xdd7a('0x48')]({'where':{'id':_0x3b50e9[_0xdd7a('0x42')]['id']}})['then'](handleEntityNotFound(_0x22ea84,null))[_0xdd7a('0x1f')](function(_0x5e8120){if(_0x5e8120){_0x34e5f7=_0x5e8120;_0x5b9b62['model']=_[_0xdd7a('0x2c')](db[_0xdd7a('0x49')][_0xdd7a('0x27')]);_0x5b9b62[_0xdd7a('0x2b')]=_['keys'](_0x3b50e9['query']);_0x5b9b62[_0xdd7a('0x2d')]=_['intersection'](_0x5b9b62[_0xdd7a('0x2a')],_0x5b9b62[_0xdd7a('0x2b')]);_0x2e214f[_0xdd7a('0x2f')]=_[_0xdd7a('0x2e')](_0x5b9b62['model'],qs[_0xdd7a('0x30')](_0x3b50e9['query'][_0xdd7a('0x30')]));_0x2e214f[_0xdd7a('0x2f')]=_0x2e214f[_0xdd7a('0x2f')][_0xdd7a('0x31')]?_0x2e214f[_0xdd7a('0x2f')]:_0x5b9b62['model'];_0x2e214f['order']=qs[_0xdd7a('0x35')](_0x3b50e9['query'][_0xdd7a('0x35')]);_0x2e214f[_0xdd7a('0x36')]=qs['filters'](_['pick'](_0x3b50e9[_0xdd7a('0x2b')],_0x5b9b62['filters']));if(_0x3b50e9['query'][_0xdd7a('0x39')]){_0x2e214f[_0xdd7a('0x36')]=_[_0xdd7a('0x3a')](_0x2e214f[_0xdd7a('0x36')],{'$or':_[_0xdd7a('0x25')](_0x2e214f[_0xdd7a('0x2f')],function(_0x71a3ce){var _0x1552aa={};_0x1552aa[_0x71a3ce]={'$like':'%'+_0x3b50e9[_0xdd7a('0x2b')]['filter']+'%'};return _0x1552aa;})});}_0x2e214f=_[_0xdd7a('0x3a')]({},_0x2e214f,_0x3b50e9[_0xdd7a('0x43')]);return _0x34e5f7[_0xdd7a('0x47')](_0x2e214f);}})[_0xdd7a('0x1f')](function(_0x14f937){if(_0x14f937){_0xcc38e4=_0x14f937[_0xdd7a('0x31')];if(!_0x3b50e9[_0xdd7a('0x2b')][_0xdd7a('0x32')]('nolimit')){_0x2e214f[_0xdd7a('0x19')]=qs[_0xdd7a('0x19')](_0x3b50e9[_0xdd7a('0x2b')][_0xdd7a('0x19')]);_0x2e214f['offset']=qs[_0xdd7a('0x17')](_0x3b50e9[_0xdd7a('0x2b')][_0xdd7a('0x17')]);}return _0x34e5f7['getFields'](_0x2e214f);}})[_0xdd7a('0x1f')](function(_0x201686){if(_0x201686){return _0x201686?{'count':_0xcc38e4,'rows':_0x201686}:null;}})[_0xdd7a('0x1f')](respondWithResult(_0x22ea84,null))[_0xdd7a('0x40')](handleError(_0x22ea84,null));};exports[_0xdd7a('0x4a')]=function(_0x4ba6e8,_0x56efd6,_0x4e6d10){var _0xb52a28={};var _0x23c9e7={};var _0x451978;var _0x37a02f;return db['SalesforceConfiguration'][_0xdd7a('0x48')]({'where':{'id':_0x4ba6e8[_0xdd7a('0x42')]['id']}})['then'](handleEntityNotFound(_0x56efd6,null))[_0xdd7a('0x1f')](function(_0x539f07){if(_0x539f07){_0x451978=_0x539f07;_0x23c9e7[_0xdd7a('0x2a')]=_[_0xdd7a('0x2c')](db[_0xdd7a('0x49')][_0xdd7a('0x27')]);_0x23c9e7[_0xdd7a('0x2b')]=_[_0xdd7a('0x2c')](_0x4ba6e8['query']);_0x23c9e7[_0xdd7a('0x2d')]=_[_0xdd7a('0x2e')](_0x23c9e7[_0xdd7a('0x2a')],_0x23c9e7[_0xdd7a('0x2b')]);_0xb52a28['attributes']=_[_0xdd7a('0x2e')](_0x23c9e7['model'],qs[_0xdd7a('0x30')](_0x4ba6e8[_0xdd7a('0x2b')][_0xdd7a('0x30')]));_0xb52a28[_0xdd7a('0x2f')]=_0xb52a28[_0xdd7a('0x2f')][_0xdd7a('0x31')]?_0xb52a28[_0xdd7a('0x2f')]:_0x23c9e7[_0xdd7a('0x2a')];_0xb52a28[_0xdd7a('0x34')]=qs[_0xdd7a('0x35')](_0x4ba6e8[_0xdd7a('0x2b')][_0xdd7a('0x35')]);_0xb52a28['where']=qs[_0xdd7a('0x2d')](_['pick'](_0x4ba6e8[_0xdd7a('0x2b')],_0x23c9e7['filters']));if(_0x4ba6e8[_0xdd7a('0x2b')][_0xdd7a('0x39')]){_0xb52a28[_0xdd7a('0x36')]=_[_0xdd7a('0x3a')](_0xb52a28[_0xdd7a('0x36')],{'$or':_[_0xdd7a('0x25')](_0xb52a28['attributes'],function(_0x412dc5){var _0x678320={};_0x678320[_0x412dc5]={'$like':'%'+_0x4ba6e8[_0xdd7a('0x2b')][_0xdd7a('0x39')]+'%'};return _0x678320;})});}_0xb52a28=_[_0xdd7a('0x3a')]({},_0xb52a28,_0x4ba6e8[_0xdd7a('0x43')]);return _0x451978[_0xdd7a('0x4a')](_0xb52a28);}})[_0xdd7a('0x1f')](function(_0x304bf7){if(_0x304bf7){_0x37a02f=_0x304bf7['length'];if(!_0x4ba6e8[_0xdd7a('0x2b')][_0xdd7a('0x32')](_0xdd7a('0x33'))){_0xb52a28[_0xdd7a('0x19')]=qs[_0xdd7a('0x19')](_0x4ba6e8['query'][_0xdd7a('0x19')]);_0xb52a28[_0xdd7a('0x17')]=qs[_0xdd7a('0x17')](_0x4ba6e8[_0xdd7a('0x2b')][_0xdd7a('0x17')]);}return _0x451978['getSubjects'](_0xb52a28);}})[_0xdd7a('0x1f')](function(_0x40b2a1){if(_0x40b2a1){return _0x40b2a1?{'count':_0x37a02f,'rows':_0x40b2a1}:null;}})['then'](respondWithResult(_0x56efd6,null))[_0xdd7a('0x40')](handleError(_0x56efd6,null));};exports['getDescriptions']=function(_0x340fd3,_0x26e344,_0x1073f7){var _0x59397d={};var _0x3ad155={};var _0x299a6a;var _0x144eb9;return db[_0xdd7a('0x26')]['findOne']({'where':{'id':_0x340fd3[_0xdd7a('0x42')]['id']}})[_0xdd7a('0x1f')](handleEntityNotFound(_0x26e344,null))['then'](function(_0x4b9695){if(_0x4b9695){_0x299a6a=_0x4b9695;_0x3ad155[_0xdd7a('0x2a')]=_[_0xdd7a('0x2c')](db[_0xdd7a('0x49')][_0xdd7a('0x27')]);_0x3ad155['query']=_['keys'](_0x340fd3[_0xdd7a('0x2b')]);_0x3ad155[_0xdd7a('0x2d')]=_[_0xdd7a('0x2e')](_0x3ad155[_0xdd7a('0x2a')],_0x3ad155['query']);_0x59397d[_0xdd7a('0x2f')]=_[_0xdd7a('0x2e')](_0x3ad155['model'],qs[_0xdd7a('0x30')](_0x340fd3[_0xdd7a('0x2b')][_0xdd7a('0x30')]));_0x59397d[_0xdd7a('0x2f')]=_0x59397d[_0xdd7a('0x2f')][_0xdd7a('0x31')]?_0x59397d[_0xdd7a('0x2f')]:_0x3ad155[_0xdd7a('0x2a')];_0x59397d['order']=qs[_0xdd7a('0x35')](_0x340fd3[_0xdd7a('0x2b')][_0xdd7a('0x35')]);_0x59397d[_0xdd7a('0x36')]=qs[_0xdd7a('0x2d')](_['pick'](_0x340fd3[_0xdd7a('0x2b')],_0x3ad155['filters']));if(_0x340fd3[_0xdd7a('0x2b')][_0xdd7a('0x39')]){_0x59397d['where']=_['merge'](_0x59397d[_0xdd7a('0x36')],{'$or':_[_0xdd7a('0x25')](_0x59397d[_0xdd7a('0x2f')],function(_0x1432fa){var _0x562f5b={};_0x562f5b[_0x1432fa]={'$like':'%'+_0x340fd3[_0xdd7a('0x2b')][_0xdd7a('0x39')]+'%'};return _0x562f5b;})});}_0x59397d=_[_0xdd7a('0x3a')]({},_0x59397d,_0x340fd3[_0xdd7a('0x43')]);return _0x299a6a[_0xdd7a('0x4b')](_0x59397d);}})['then'](function(_0x263840){if(_0x263840){_0x144eb9=_0x263840[_0xdd7a('0x31')];if(!_0x340fd3[_0xdd7a('0x2b')][_0xdd7a('0x32')](_0xdd7a('0x33'))){_0x59397d['limit']=qs['limit'](_0x340fd3['query'][_0xdd7a('0x19')]);_0x59397d['offset']=qs[_0xdd7a('0x17')](_0x340fd3[_0xdd7a('0x2b')][_0xdd7a('0x17')]);}return _0x299a6a[_0xdd7a('0x4b')](_0x59397d);}})[_0xdd7a('0x1f')](function(_0x48e583){if(_0x48e583){return _0x48e583?{'count':_0x144eb9,'rows':_0x48e583}:null;}})[_0xdd7a('0x1f')](respondWithResult(_0x26e344,null))[_0xdd7a('0x40')](handleError(_0x26e344,null));}; \ No newline at end of file +var _0x4250=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','destroy','findOne','SalesforceField','getFields','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x311e77,_0x49a459){var _0x559c54=function(_0x283a97){while(--_0x283a97){_0x311e77['push'](_0x311e77['shift']());}};_0x559c54(++_0x49a459);}(_0x4250,0x146));var _0x0425=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x4250[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x0425('0x0'));var rimraf=require(_0x0425('0x1'));var zipdir=require(_0x0425('0x2'));var jsonpatch=require(_0x0425('0x3'));var rp=require('request-promise');var moment=require(_0x0425('0x4'));var BPromise=require(_0x0425('0x5'));var Mustache=require(_0x0425('0x6'));var util=require('util');var path=require(_0x0425('0x7'));var sox=require(_0x0425('0x8'));var csv=require(_0x0425('0x9'));var ejs=require(_0x0425('0xa'));var fs=require('fs');var fs_extra=require(_0x0425('0xb'));var _=require(_0x0425('0xc'));var squel=require(_0x0425('0xd'));var crypto=require(_0x0425('0xe'));var jsforce=require(_0x0425('0xf'));var deskjs=require(_0x0425('0x10'));var toCsv=require(_0x0425('0x9'));var querystring=require(_0x0425('0x11'));var Papa=require(_0x0425('0x12'));var Redis=require(_0x0425('0x13'));var authService=require(_0x0425('0x14'));var qs=require(_0x0425('0x15'));var as=require(_0x0425('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0425('0x17'));var utils=require('../../config/utils');var config=require(_0x0425('0x18'));var licenseUtil=require(_0x0425('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x107fe1,_0x24dd34){_0x24dd34=_0x24dd34||0xcc;return function(_0x1c67ec){if(_0x1c67ec){return _0x107fe1[_0x0425('0x1a')](_0x24dd34);}return _0x107fe1['status'](_0x24dd34)[_0x0425('0x1b')]();};}function respondWithResult(_0x23e4fb,_0x5be3af){_0x5be3af=_0x5be3af||0xc8;return function(_0x4c8c50){if(_0x4c8c50){return _0x23e4fb['status'](_0x5be3af)[_0x0425('0x1c')](_0x4c8c50);}};}function respondWithFilteredResult(_0x33afcb,_0x1cd255){return function(_0x4a6389){if(_0x4a6389){var _0x4e439a=typeof _0x1cd255[_0x0425('0x1d')]===_0x0425('0x1e')&&typeof _0x1cd255[_0x0425('0x1f')]===_0x0425('0x1e');var _0x468821=_0x4a6389[_0x0425('0x20')];var _0x162730=_0x4e439a?0x0:_0x1cd255[_0x0425('0x1d')];var _0x10f5c7=_0x4e439a?_0x4a6389[_0x0425('0x20')]:_0x1cd255['offset']+_0x1cd255[_0x0425('0x1f')];var _0x157042;if(_0x10f5c7>=_0x468821){_0x10f5c7=_0x468821;_0x157042=0xc8;}else{_0x157042=0xce;}_0x33afcb[_0x0425('0x21')](_0x157042);return _0x33afcb[_0x0425('0x22')](_0x0425('0x23'),_0x162730+'-'+_0x10f5c7+'/'+_0x468821)[_0x0425('0x1c')](_0x4a6389);}return null;};}function patchUpdates(_0x152cf7){return function(_0x34765d){try{jsonpatch[_0x0425('0x24')](_0x34765d,_0x152cf7,!![]);}catch(_0x411760){return BPromise['reject'](_0x411760);}return _0x34765d[_0x0425('0x25')]();};}function saveUpdates(_0x573ba9,_0x4bcab6){return function(_0x1c4cd3){if(_0x1c4cd3){return _0x1c4cd3[_0x0425('0x26')](_0x573ba9)[_0x0425('0x27')](function(_0xdc9abd){return _0xdc9abd;});}return null;};}function removeEntity(_0x3f8728,_0x347c29){return function(_0x95eceb){if(_0x95eceb){return _0x95eceb['destroy']()[_0x0425('0x27')](function(){_0x3f8728['status'](0xcc)[_0x0425('0x1b')]();});}};}function handleEntityNotFound(_0x1d53a9,_0x31025f){return function(_0x5d4078){if(!_0x5d4078){_0x1d53a9[_0x0425('0x1a')](0x194);}return _0x5d4078;};}function handleError(_0x2b4e98,_0x317693){_0x317693=_0x317693||0x1f4;return function(_0x7c7e53){logger[_0x0425('0x28')](_0x7c7e53[_0x0425('0x29')]);if(_0x7c7e53[_0x0425('0x2a')]){delete _0x7c7e53[_0x0425('0x2a')];}_0x2b4e98[_0x0425('0x21')](_0x317693)[_0x0425('0x2b')](_0x7c7e53);};}exports[_0x0425('0x2c')]=function(_0x27dbdb,_0x40a577){var _0x564647={},_0x1a47a4={},_0x9ce829={'count':0x0,'rows':[]};var _0x3ecdd5=_[_0x0425('0x2d')](db[_0x0425('0x2e')][_0x0425('0x2f')],function(_0x327b45){return{'name':_0x327b45[_0x0425('0x30')],'type':_0x327b45[_0x0425('0x31')][_0x0425('0x32')]};});_0x1a47a4[_0x0425('0x33')]=_[_0x0425('0x2d')](_0x3ecdd5,_0x0425('0x2a'));_0x1a47a4[_0x0425('0x34')]=_[_0x0425('0x35')](_0x27dbdb[_0x0425('0x34')]);_0x1a47a4[_0x0425('0x36')]=_[_0x0425('0x37')](_0x1a47a4[_0x0425('0x33')],_0x1a47a4[_0x0425('0x34')]);_0x564647[_0x0425('0x38')]=_[_0x0425('0x37')](_0x1a47a4[_0x0425('0x33')],qs[_0x0425('0x39')](_0x27dbdb['query'][_0x0425('0x39')]));_0x564647['attributes']=_0x564647[_0x0425('0x38')][_0x0425('0x3a')]?_0x564647[_0x0425('0x38')]:_0x1a47a4[_0x0425('0x33')];if(!_0x27dbdb[_0x0425('0x34')]['hasOwnProperty'](_0x0425('0x3b'))){_0x564647['limit']=qs[_0x0425('0x1f')](_0x27dbdb[_0x0425('0x34')]['limit']);_0x564647[_0x0425('0x1d')]=qs[_0x0425('0x1d')](_0x27dbdb[_0x0425('0x34')]['offset']);}_0x564647[_0x0425('0x3c')]=qs[_0x0425('0x3d')](_0x27dbdb[_0x0425('0x34')][_0x0425('0x3d')]);_0x564647[_0x0425('0x3e')]=qs[_0x0425('0x36')](_[_0x0425('0x3f')](_0x27dbdb['query'],_0x1a47a4['filters']),_0x3ecdd5);if(_0x27dbdb['query'][_0x0425('0x40')]){_0x564647['where']=_[_0x0425('0x41')](_0x564647[_0x0425('0x3e')],{'$or':_[_0x0425('0x2d')](_0x3ecdd5,function(_0x21326f){if(_0x21326f[_0x0425('0x31')]!=='VIRTUAL'){var _0x14946c={};_0x14946c[_0x21326f[_0x0425('0x2a')]]={'$like':'%'+_0x27dbdb[_0x0425('0x34')][_0x0425('0x40')]+'%'};return _0x14946c;}})});}_0x564647=_[_0x0425('0x41')]({},_0x564647,_0x27dbdb[_0x0425('0x42')]);var _0x294f83={'where':_0x564647['where']};return db[_0x0425('0x2e')][_0x0425('0x20')](_0x294f83)[_0x0425('0x27')](function(_0x3238fe){_0x9ce829['count']=_0x3238fe;if(_0x27dbdb[_0x0425('0x34')][_0x0425('0x43')]){_0x564647['include']=[{'all':!![]}];}return db[_0x0425('0x2e')][_0x0425('0x44')](_0x564647);})[_0x0425('0x27')](function(_0x5930f3){_0x9ce829[_0x0425('0x45')]=_0x5930f3;return _0x9ce829;})[_0x0425('0x27')](respondWithFilteredResult(_0x40a577,_0x564647))[_0x0425('0x46')](handleError(_0x40a577,null));};exports[_0x0425('0x47')]=function(_0x8ba4f9,_0x153bd1){var _0x4128fb={'raw':![],'where':{'id':_0x8ba4f9['params']['id']}},_0x74a0da={};_0x74a0da[_0x0425('0x33')]=_[_0x0425('0x35')](db[_0x0425('0x2e')]['rawAttributes']);_0x74a0da[_0x0425('0x34')]=_[_0x0425('0x35')](_0x8ba4f9[_0x0425('0x34')]);_0x74a0da[_0x0425('0x36')]=_['intersection'](_0x74a0da[_0x0425('0x33')],_0x74a0da[_0x0425('0x34')]);_0x4128fb[_0x0425('0x38')]=_[_0x0425('0x37')](_0x74a0da[_0x0425('0x33')],qs[_0x0425('0x39')](_0x8ba4f9[_0x0425('0x34')][_0x0425('0x39')]));_0x4128fb[_0x0425('0x38')]=_0x4128fb[_0x0425('0x38')][_0x0425('0x3a')]?_0x4128fb[_0x0425('0x38')]:_0x74a0da[_0x0425('0x33')];if(_0x8ba4f9[_0x0425('0x34')][_0x0425('0x43')]){_0x4128fb[_0x0425('0x48')]=[{'all':!![]}];}_0x4128fb=_[_0x0425('0x41')]({},_0x4128fb,_0x8ba4f9[_0x0425('0x42')]);return db['SalesforceConfiguration'][_0x0425('0x49')](_0x4128fb)[_0x0425('0x27')](handleEntityNotFound(_0x153bd1,null))['then'](respondWithResult(_0x153bd1,null))[_0x0425('0x46')](handleError(_0x153bd1,null));};exports[_0x0425('0x4a')]=function(_0x36a5bf,_0x4ef90b){return db['SalesforceConfiguration'][_0x0425('0x4a')](_0x36a5bf[_0x0425('0x4b')],{})[_0x0425('0x27')](respondWithResult(_0x4ef90b,0xc9))[_0x0425('0x46')](handleError(_0x4ef90b,null));};exports[_0x0425('0x26')]=function(_0xbda450,_0x4b53ca){if(_0xbda450['body']['id']){delete _0xbda450[_0x0425('0x4b')]['id'];}return db[_0x0425('0x2e')][_0x0425('0x49')]({'where':{'id':_0xbda450[_0x0425('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4b53ca,null))[_0x0425('0x27')](saveUpdates(_0xbda450[_0x0425('0x4b')],null))['then'](respondWithResult(_0x4b53ca,null))['catch'](handleError(_0x4b53ca,null));};exports[_0x0425('0x4d')]=function(_0x178c8f,_0x4d7065){return db[_0x0425('0x2e')][_0x0425('0x49')]({'where':{'id':_0x178c8f[_0x0425('0x4c')]['id']}})[_0x0425('0x27')](handleEntityNotFound(_0x4d7065,null))[_0x0425('0x27')](removeEntity(_0x4d7065,null))[_0x0425('0x46')](handleError(_0x4d7065,null));};exports['getFields']=function(_0x2e418d,_0x3e1edd,_0x4cedab){var _0x297634={};var _0x69d4ab={};var _0x23f1b0;var _0x1a8fa4;return db[_0x0425('0x2e')][_0x0425('0x4e')]({'where':{'id':_0x2e418d[_0x0425('0x4c')]['id']}})[_0x0425('0x27')](handleEntityNotFound(_0x3e1edd,null))[_0x0425('0x27')](function(_0x5e8f4c){if(_0x5e8f4c){_0x23f1b0=_0x5e8f4c;_0x69d4ab['model']=_[_0x0425('0x35')](db[_0x0425('0x4f')]['rawAttributes']);_0x69d4ab[_0x0425('0x34')]=_[_0x0425('0x35')](_0x2e418d[_0x0425('0x34')]);_0x69d4ab[_0x0425('0x36')]=_[_0x0425('0x37')](_0x69d4ab['model'],_0x69d4ab[_0x0425('0x34')]);_0x297634[_0x0425('0x38')]=_[_0x0425('0x37')](_0x69d4ab[_0x0425('0x33')],qs[_0x0425('0x39')](_0x2e418d[_0x0425('0x34')][_0x0425('0x39')]));_0x297634[_0x0425('0x38')]=_0x297634[_0x0425('0x38')][_0x0425('0x3a')]?_0x297634[_0x0425('0x38')]:_0x69d4ab[_0x0425('0x33')];_0x297634[_0x0425('0x3c')]=qs['sort'](_0x2e418d['query'][_0x0425('0x3d')]);_0x297634['where']=qs[_0x0425('0x36')](_[_0x0425('0x3f')](_0x2e418d[_0x0425('0x34')],_0x69d4ab['filters']));if(_0x2e418d[_0x0425('0x34')][_0x0425('0x40')]){_0x297634[_0x0425('0x3e')]=_[_0x0425('0x41')](_0x297634[_0x0425('0x3e')],{'$or':_[_0x0425('0x2d')](_0x297634[_0x0425('0x38')],function(_0x42d9e3){var _0x42700d={};_0x42700d[_0x42d9e3]={'$like':'%'+_0x2e418d[_0x0425('0x34')][_0x0425('0x40')]+'%'};return _0x42700d;})});}_0x297634=_[_0x0425('0x41')]({},_0x297634,_0x2e418d[_0x0425('0x42')]);return _0x23f1b0[_0x0425('0x50')](_0x297634);}})[_0x0425('0x27')](function(_0x4044b6){if(_0x4044b6){_0x1a8fa4=_0x4044b6[_0x0425('0x3a')];if(!_0x2e418d[_0x0425('0x34')][_0x0425('0x51')](_0x0425('0x3b'))){_0x297634[_0x0425('0x1f')]=qs[_0x0425('0x1f')](_0x2e418d['query'][_0x0425('0x1f')]);_0x297634[_0x0425('0x1d')]=qs[_0x0425('0x1d')](_0x2e418d[_0x0425('0x34')][_0x0425('0x1d')]);}return _0x23f1b0[_0x0425('0x50')](_0x297634);}})[_0x0425('0x27')](function(_0x150691){if(_0x150691){return _0x150691?{'count':_0x1a8fa4,'rows':_0x150691}:null;}})['then'](respondWithResult(_0x3e1edd,null))[_0x0425('0x46')](handleError(_0x3e1edd,null));};exports['getSubjects']=function(_0x23f769,_0x5d4774,_0x3ca1ce){var _0x233828={};var _0x1b4d8c={};var _0x575bd4;var _0x488f5a;return db[_0x0425('0x2e')]['findOne']({'where':{'id':_0x23f769[_0x0425('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5d4774,null))[_0x0425('0x27')](function(_0x374838){if(_0x374838){_0x575bd4=_0x374838;_0x1b4d8c[_0x0425('0x33')]=_['keys'](db[_0x0425('0x4f')]['rawAttributes']);_0x1b4d8c['query']=_[_0x0425('0x35')](_0x23f769['query']);_0x1b4d8c[_0x0425('0x36')]=_[_0x0425('0x37')](_0x1b4d8c[_0x0425('0x33')],_0x1b4d8c[_0x0425('0x34')]);_0x233828[_0x0425('0x38')]=_[_0x0425('0x37')](_0x1b4d8c[_0x0425('0x33')],qs['fields'](_0x23f769[_0x0425('0x34')][_0x0425('0x39')]));_0x233828[_0x0425('0x38')]=_0x233828[_0x0425('0x38')][_0x0425('0x3a')]?_0x233828['attributes']:_0x1b4d8c[_0x0425('0x33')];_0x233828[_0x0425('0x3c')]=qs[_0x0425('0x3d')](_0x23f769[_0x0425('0x34')][_0x0425('0x3d')]);_0x233828[_0x0425('0x3e')]=qs['filters'](_['pick'](_0x23f769['query'],_0x1b4d8c[_0x0425('0x36')]));if(_0x23f769[_0x0425('0x34')][_0x0425('0x40')]){_0x233828[_0x0425('0x3e')]=_[_0x0425('0x41')](_0x233828[_0x0425('0x3e')],{'$or':_[_0x0425('0x2d')](_0x233828['attributes'],function(_0x45a522){var _0x251b10={};_0x251b10[_0x45a522]={'$like':'%'+_0x23f769[_0x0425('0x34')][_0x0425('0x40')]+'%'};return _0x251b10;})});}_0x233828=_['merge']({},_0x233828,_0x23f769['options']);return _0x575bd4[_0x0425('0x52')](_0x233828);}})['then'](function(_0x125276){if(_0x125276){_0x488f5a=_0x125276['length'];if(!_0x23f769['query'][_0x0425('0x51')](_0x0425('0x3b'))){_0x233828[_0x0425('0x1f')]=qs[_0x0425('0x1f')](_0x23f769[_0x0425('0x34')]['limit']);_0x233828[_0x0425('0x1d')]=qs['offset'](_0x23f769[_0x0425('0x34')]['offset']);}return _0x575bd4[_0x0425('0x52')](_0x233828);}})['then'](function(_0x26924a){if(_0x26924a){return _0x26924a?{'count':_0x488f5a,'rows':_0x26924a}:null;}})[_0x0425('0x27')](respondWithResult(_0x5d4774,null))[_0x0425('0x46')](handleError(_0x5d4774,null));};exports[_0x0425('0x53')]=function(_0x65c4cd,_0x3656f8,_0x328623){var _0x1a8a6f={};var _0x29ab53={};var _0x661bf0;var _0x18670c;return db[_0x0425('0x2e')][_0x0425('0x4e')]({'where':{'id':_0x65c4cd['params']['id']}})[_0x0425('0x27')](handleEntityNotFound(_0x3656f8,null))[_0x0425('0x27')](function(_0x411394){if(_0x411394){_0x661bf0=_0x411394;_0x29ab53[_0x0425('0x33')]=_[_0x0425('0x35')](db['SalesforceField'][_0x0425('0x2f')]);_0x29ab53[_0x0425('0x34')]=_['keys'](_0x65c4cd[_0x0425('0x34')]);_0x29ab53[_0x0425('0x36')]=_[_0x0425('0x37')](_0x29ab53[_0x0425('0x33')],_0x29ab53[_0x0425('0x34')]);_0x1a8a6f['attributes']=_[_0x0425('0x37')](_0x29ab53[_0x0425('0x33')],qs['fields'](_0x65c4cd[_0x0425('0x34')][_0x0425('0x39')]));_0x1a8a6f['attributes']=_0x1a8a6f['attributes'][_0x0425('0x3a')]?_0x1a8a6f[_0x0425('0x38')]:_0x29ab53[_0x0425('0x33')];_0x1a8a6f[_0x0425('0x3c')]=qs[_0x0425('0x3d')](_0x65c4cd['query'][_0x0425('0x3d')]);_0x1a8a6f[_0x0425('0x3e')]=qs['filters'](_[_0x0425('0x3f')](_0x65c4cd[_0x0425('0x34')],_0x29ab53['filters']));if(_0x65c4cd[_0x0425('0x34')][_0x0425('0x40')]){_0x1a8a6f[_0x0425('0x3e')]=_[_0x0425('0x41')](_0x1a8a6f[_0x0425('0x3e')],{'$or':_[_0x0425('0x2d')](_0x1a8a6f['attributes'],function(_0x411e81){var _0x13625f={};_0x13625f[_0x411e81]={'$like':'%'+_0x65c4cd['query'][_0x0425('0x40')]+'%'};return _0x13625f;})});}_0x1a8a6f=_[_0x0425('0x41')]({},_0x1a8a6f,_0x65c4cd[_0x0425('0x42')]);return _0x661bf0[_0x0425('0x53')](_0x1a8a6f);}})[_0x0425('0x27')](function(_0xa9ac96){if(_0xa9ac96){_0x18670c=_0xa9ac96[_0x0425('0x3a')];if(!_0x65c4cd[_0x0425('0x34')][_0x0425('0x51')](_0x0425('0x3b'))){_0x1a8a6f[_0x0425('0x1f')]=qs[_0x0425('0x1f')](_0x65c4cd[_0x0425('0x34')][_0x0425('0x1f')]);_0x1a8a6f[_0x0425('0x1d')]=qs['offset'](_0x65c4cd[_0x0425('0x34')][_0x0425('0x1d')]);}return _0x661bf0[_0x0425('0x53')](_0x1a8a6f);}})['then'](function(_0x5b67d8){if(_0x5b67d8){return _0x5b67d8?{'count':_0x18670c,'rows':_0x5b67d8}:null;}})[_0x0425('0x27')](respondWithResult(_0x3656f8,null))[_0x0425('0x46')](handleError(_0x3656f8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index a7005da..c21f0a1 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 _0x5a79=['int_salesforce_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','SalesforceConfiguration'];(function(_0x324496,_0x3a4cdd){var _0x899545=function(_0x506ef1){while(--_0x506ef1){_0x324496['push'](_0x324496['shift']());}};_0x899545(++_0x3a4cdd);}(_0x5a79,0x182));var _0x95a7=function(_0x35e6db,_0x53779d){_0x35e6db=_0x35e6db-0x0;var _0x249409=_0x5a79[_0x35e6db];return _0x249409;};'use strict';var _=require(_0x95a7('0x0'));var util=require(_0x95a7('0x1'));var logger=require(_0x95a7('0x2'))(_0x95a7('0x3'));var moment=require('moment');var BPromise=require(_0x95a7('0x4'));var rp=require(_0x95a7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x95a7('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x95a7('0x7')]=function(_0x1553c1,_0x907144){return _0x1553c1[_0x95a7('0x8')](_0x95a7('0x9'),attributes,{'tableName':_0x95a7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bcd=['int_salesforce_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','SalesforceConfiguration'];(function(_0x184f5f,_0x2034dd){var _0x467cd7=function(_0x5826b7){while(--_0x5826b7){_0x184f5f['push'](_0x184f5f['shift']());}};_0x467cd7(++_0x2034dd);}(_0x1bcd,0x1a3));var _0xd1bc=function(_0xf2570f,_0x34719e){_0xf2570f=_0xf2570f-0x0;var _0x4dea1a=_0x1bcd[_0xf2570f];return _0x4dea1a;};'use strict';var _=require(_0xd1bc('0x0'));var util=require('util');var logger=require(_0xd1bc('0x1'))(_0xd1bc('0x2'));var moment=require(_0xd1bc('0x3'));var BPromise=require(_0xd1bc('0x4'));var rp=require(_0xd1bc('0x5'));var fs=require('fs');var path=require(_0xd1bc('0x6'));var rimraf=require(_0xd1bc('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceConfiguration.attributes');module[_0xd1bc('0x8')]=function(_0x183e08,_0xa4a2b0){return _0x183e08['define'](_0xd1bc('0x9'),attributes,{'tableName':_0xd1bc('0xa'),'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 21d468a..ec646b1 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 _0x8bc4=['result','catch','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceConfiguration,\x20%s,\x20%s','message'];(function(_0xb14c00,_0x281183){var _0x236a87=function(_0x290067){while(--_0x290067){_0xb14c00['push'](_0xb14c00['shift']());}};_0x236a87(++_0x281183);}(_0x8bc4,0x191));var _0x48bc=function(_0x58663c,_0x10fdc6){_0x58663c=_0x58663c-0x0;var _0x26c791=_0x8bc4[_0x58663c];return _0x26c791;};'use strict';var _=require('lodash');var util=require(_0x48bc('0x0'));var moment=require('moment');var BPromise=require(_0x48bc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x48bc('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x48bc('0x3'));var logger=require(_0x48bc('0x4'))(_0x48bc('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x48bc('0x6')][_0x48bc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x17b9fe,_0x32a922,_0xa0865c){return new BPromise(function(_0x19bec1,_0x346320){return client[_0x48bc('0x8')](_0x17b9fe,_0xa0865c)[_0x48bc('0x9')](function(_0x285da1){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x32a922,_0x48bc('0xa'));logger[_0x48bc('0xb')](_0x48bc('0xc'),_0x32a922,_0x48bc('0xa'),JSON[_0x48bc('0xd')](_0x285da1));if(_0x285da1[_0x48bc('0xe')]){if(_0x285da1['error']['code']===0x1f4){logger[_0x48bc('0xe')](_0x48bc('0xf'),_0x32a922,_0x285da1['error'][_0x48bc('0x10')]);return _0x346320(_0x285da1[_0x48bc('0xe')]['message']);}logger[_0x48bc('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x32a922,_0x285da1[_0x48bc('0xe')][_0x48bc('0x10')]);return _0x19bec1(_0x285da1[_0x48bc('0xe')][_0x48bc('0x10')]);}else{logger['info'](_0x48bc('0xf'),_0x32a922,_0x48bc('0xa'));_0x19bec1(_0x285da1[_0x48bc('0x11')][_0x48bc('0x10')]);}})[_0x48bc('0x12')](function(_0x1a40a5){logger[_0x48bc('0xe')](_0x48bc('0xf'),_0x32a922,_0x1a40a5);_0x346320(_0x1a40a5);});});} \ No newline at end of file +var _0xd795=['message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x162a48,_0x4b93c2){var _0x4f4721=function(_0x6261e4){while(--_0x6261e4){_0x162a48['push'](_0x162a48['shift']());}};_0x4f4721(++_0x4b93c2);}(_0xd795,0x122));var _0x5d79=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xd795[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0x5d79('0x0'));var util=require(_0x5d79('0x1'));var moment=require(_0x5d79('0x2'));var BPromise=require('bluebird');var rs=require(_0x5d79('0x3'));var fs=require('fs');var Redis=require(_0x5d79('0x4'));var db=require(_0x5d79('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d79('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5d79('0x7')][_0x5d79('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x506a90,_0xd6e2bb,_0x42dc44){return new BPromise(function(_0x9405d5,_0x57b508){return client[_0x5d79('0x9')](_0x506a90,_0x42dc44)[_0x5d79('0xa')](function(_0x9c67e5){logger['info'](_0x5d79('0xb'),_0xd6e2bb,_0x5d79('0xc'));logger[_0x5d79('0xd')](_0x5d79('0xe'),_0xd6e2bb,_0x5d79('0xc'),JSON[_0x5d79('0xf')](_0x9c67e5));if(_0x9c67e5['error']){if(_0x9c67e5[_0x5d79('0x10')][_0x5d79('0x11')]===0x1f4){logger['error'](_0x5d79('0xb'),_0xd6e2bb,_0x9c67e5['error'][_0x5d79('0x12')]);return _0x57b508(_0x9c67e5[_0x5d79('0x10')][_0x5d79('0x12')]);}logger[_0x5d79('0x10')](_0x5d79('0xb'),_0xd6e2bb,_0x9c67e5['error'][_0x5d79('0x12')]);return _0x9405d5(_0x9c67e5[_0x5d79('0x10')][_0x5d79('0x12')]);}else{logger[_0x5d79('0x13')](_0x5d79('0xb'),_0xd6e2bb,_0x5d79('0xc'));_0x9405d5(_0x9c67e5[_0x5d79('0x14')]['message']);}})[_0x5d79('0x15')](function(_0x30da9f){logger[_0x5d79('0x10')](_0x5d79('0xb'),_0xd6e2bb,_0x30da9f);_0x57b508(_0x30da9f);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index cddcc63..c3998c9 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 _0xeac2=['post','put','/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','get','index','isAuthenticated','show'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0xeac2,0x136));var _0x2eac=function(_0x517cdc,_0x2e9479){_0x517cdc=_0x517cdc-0x0;var _0xfadbab=_0xeac2[_0x517cdc];return _0xfadbab;};'use strict';var multer=require(_0x2eac('0x0'));var util=require(_0x2eac('0x1'));var path=require(_0x2eac('0x2'));var timeout=require('connect-timeout');var express=require(_0x2eac('0x3'));var router=express[_0x2eac('0x4')]();var fs_extra=require(_0x2eac('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0x2eac('0x6')]('/',auth['isAuthenticated'](),controller[_0x2eac('0x7')]);router['get']('/:id',auth[_0x2eac('0x8')](),controller[_0x2eac('0x9')]);router[_0x2eac('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2eac('0xb')](_0x2eac('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x2eac('0xd')](_0x2eac('0xc'),auth[_0x2eac('0x8')](),controller[_0x2eac('0xe')]);module[_0x2eac('0xf')]=router; \ No newline at end of file +var _0x4d0f=['index','/:id','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated'];(function(_0x5e1302,_0x519fac){var _0x53b5d4=function(_0x1791e9){while(--_0x1791e9){_0x5e1302['push'](_0x5e1302['shift']());}};_0x53b5d4(++_0x519fac);}(_0x4d0f,0x7e));var _0xf4d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d0f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xf4d0('0x0'));var util=require(_0xf4d0('0x1'));var path=require(_0xf4d0('0x2'));var timeout=require(_0xf4d0('0x3'));var express=require(_0xf4d0('0x4'));var router=express[_0xf4d0('0x5')]();var fs_extra=require(_0xf4d0('0x6'));var auth=require(_0xf4d0('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0xf4d0('0x8')]('/',auth[_0xf4d0('0x9')](),controller[_0xf4d0('0xa')]);router[_0xf4d0('0x8')](_0xf4d0('0xb'),auth[_0xf4d0('0x9')](),controller['show']);router[_0xf4d0('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf4d0('0xd')](_0xf4d0('0xb'),auth[_0xf4d0('0x9')](),controller[_0xf4d0('0xe')]);router[_0xf4d0('0xf')](_0xf4d0('0xb'),auth[_0xf4d0('0x9')](),controller[_0xf4d0('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 601bab8..4cfc015 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 _0x6e60=['string','variable','customVariable','keyValue','picklist','STRING','sequelize','ENUM'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x6e60,0x14e));var _0x06e6=function(_0x4d31bd,_0x3edcb9){_0x4d31bd=_0x4d31bd-0x0;var _0x550316=_0x6e60[_0x4d31bd];return _0x550316;};'use strict';var Sequelize=require(_0x06e6('0x0'));module['exports']={'type':{'type':Sequelize[_0x06e6('0x1')](_0x06e6('0x2'),_0x06e6('0x3'),_0x06e6('0x4'),_0x06e6('0x5'),_0x06e6('0x6')),'defaultValue':_0x06e6('0x2')},'content':{'type':Sequelize[_0x06e6('0x7')]},'key':{'type':Sequelize[_0x06e6('0x7')]},'keyType':{'type':Sequelize[_0x06e6('0x1')](_0x06e6('0x2'),_0x06e6('0x3'),_0x06e6('0x4'))},'keyContent':{'type':Sequelize[_0x06e6('0x7')]},'idField':{'type':Sequelize[_0x06e6('0x7')]},'variableName':{'type':Sequelize[_0x06e6('0x7')]}}; \ No newline at end of file +var _0xa3e8=['exports','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x44714c,_0x2ac454){var _0x57d4d5=function(_0x5aca44){while(--_0x5aca44){_0x44714c['push'](_0x44714c['shift']());}};_0x57d4d5(++_0x2ac454);}(_0xa3e8,0x1dc));var _0x8a3e=function(_0x5265ae,_0x3b4ca6){_0x5265ae=_0x5265ae-0x0;var _0x2c1b73=_0xa3e8[_0x5265ae];return _0x2c1b73;};'use strict';var Sequelize=require('sequelize');module[_0x8a3e('0x0')]={'type':{'type':Sequelize[_0x8a3e('0x1')](_0x8a3e('0x2'),_0x8a3e('0x3'),'customVariable',_0x8a3e('0x4'),_0x8a3e('0x5')),'defaultValue':_0x8a3e('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8a3e('0x6')]},'keyType':{'type':Sequelize[_0x8a3e('0x1')](_0x8a3e('0x2'),_0x8a3e('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8a3e('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 06a547e..c269683 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 _0x524d=['error','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','find','create','body','params','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x1f9503,_0x8e450b){var _0xaab94f=function(_0x5b0c4d){while(--_0x5b0c4d){_0x1f9503['push'](_0x1f9503['shift']());}};_0xaab94f(++_0x8e450b);}(_0x524d,0x105));var _0xd524=function(_0x46702f,_0x488dad){_0x46702f=_0x46702f-0x0;var _0x3788f9=_0x524d[_0x46702f];return _0x3788f9;};'use strict';var emlformat=require(_0xd524('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd524('0x1'));var rp=require(_0xd524('0x2'));var moment=require(_0xd524('0x3'));var BPromise=require(_0xd524('0x4'));var Mustache=require(_0xd524('0x5'));var util=require(_0xd524('0x6'));var path=require(_0xd524('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd524('0x8'));var fs=require('fs');var fs_extra=require(_0xd524('0x9'));var _=require(_0xd524('0xa'));var squel=require(_0xd524('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd524('0xc'));var toCsv=require(_0xd524('0xd'));var querystring=require(_0xd524('0xe'));var Papa=require('papaparse');var Redis=require(_0xd524('0xf'));var authService=require(_0xd524('0x10'));var qs=require(_0xd524('0x11'));var as=require(_0xd524('0x12'));var hardwareService=require(_0xd524('0x13'));var logger=require(_0xd524('0x14'))('api');var utils=require(_0xd524('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd524('0x16'));var db=require(_0xd524('0x17'))['db'];function respondWithStatusCode(_0x1d869f,_0x2b30a4){_0x2b30a4=_0x2b30a4||0xcc;return function(_0x15e09c){if(_0x15e09c){return _0x1d869f[_0xd524('0x18')](_0x2b30a4);}return _0x1d869f[_0xd524('0x19')](_0x2b30a4)[_0xd524('0x1a')]();};}function respondWithResult(_0x329cdf,_0x5b99c5){_0x5b99c5=_0x5b99c5||0xc8;return function(_0x386d87){if(_0x386d87){return _0x329cdf[_0xd524('0x19')](_0x5b99c5)[_0xd524('0x1b')](_0x386d87);}};}function respondWithFilteredResult(_0xde5659,_0xfe569c){return function(_0x219a94){if(_0x219a94){var _0xc07845=typeof _0xfe569c['offset']===_0xd524('0x1c')&&typeof _0xfe569c['limit']===_0xd524('0x1c');var _0x15e732=_0x219a94[_0xd524('0x1d')];var _0x24c48e=_0xc07845?0x0:_0xfe569c[_0xd524('0x1e')];var _0x1ddcc2=_0xc07845?_0x219a94[_0xd524('0x1d')]:_0xfe569c['offset']+_0xfe569c[_0xd524('0x1f')];var _0x12224d;if(_0x1ddcc2>=_0x15e732){_0x1ddcc2=_0x15e732;_0x12224d=0xc8;}else{_0x12224d=0xce;}_0xde5659['status'](_0x12224d);return _0xde5659[_0xd524('0x20')](_0xd524('0x21'),_0x24c48e+'-'+_0x1ddcc2+'/'+_0x15e732)['json'](_0x219a94);}return null;};}function patchUpdates(_0x3b4a94){return function(_0x50651d){try{jsonpatch[_0xd524('0x22')](_0x50651d,_0x3b4a94,!![]);}catch(_0x1b58c5){return BPromise[_0xd524('0x23')](_0x1b58c5);}return _0x50651d[_0xd524('0x24')]();};}function saveUpdates(_0x1bdd21,_0x430def){return function(_0x543269){if(_0x543269){return _0x543269[_0xd524('0x25')](_0x1bdd21)[_0xd524('0x26')](function(_0x2b4fdf){return _0x2b4fdf;});}return null;};}function removeEntity(_0x40ec02,_0x37bf8c){return function(_0x9e6907){if(_0x9e6907){return _0x9e6907['destroy']()['then'](function(){_0x40ec02[_0xd524('0x19')](0xcc)[_0xd524('0x1a')]();});}};}function handleEntityNotFound(_0x5a05b0,_0x5eba23){return function(_0x74efdb){if(!_0x74efdb){_0x5a05b0['sendStatus'](0x194);}return _0x74efdb;};}function handleError(_0x280c66,_0x24f137){_0x24f137=_0x24f137||0x1f4;return function(_0x27d9f9){logger[_0xd524('0x27')](_0x27d9f9['stack']);if(_0x27d9f9[_0xd524('0x28')]){delete _0x27d9f9['name'];}_0x280c66[_0xd524('0x19')](_0x24f137)[_0xd524('0x29')](_0x27d9f9);};}exports[_0xd524('0x2a')]=function(_0x41c868,_0x1ea8f8){var _0x1b04de={},_0x29a6a6={},_0x3f24aa={'count':0x0,'rows':[]};var _0x340978=_[_0xd524('0x2b')](db[_0xd524('0x2c')][_0xd524('0x2d')],function(_0x181739){return{'name':_0x181739[_0xd524('0x2e')],'type':_0x181739[_0xd524('0x2f')][_0xd524('0x30')]};});_0x29a6a6[_0xd524('0x31')]=_['map'](_0x340978,_0xd524('0x28'));_0x29a6a6[_0xd524('0x32')]=_['keys'](_0x41c868['query']);_0x29a6a6['filters']=_[_0xd524('0x33')](_0x29a6a6[_0xd524('0x31')],_0x29a6a6[_0xd524('0x32')]);_0x1b04de[_0xd524('0x34')]=_[_0xd524('0x33')](_0x29a6a6[_0xd524('0x31')],qs[_0xd524('0x35')](_0x41c868[_0xd524('0x32')][_0xd524('0x35')]));_0x1b04de[_0xd524('0x34')]=_0x1b04de[_0xd524('0x34')][_0xd524('0x36')]?_0x1b04de['attributes']:_0x29a6a6[_0xd524('0x31')];if(!_0x41c868[_0xd524('0x32')][_0xd524('0x37')](_0xd524('0x38'))){_0x1b04de[_0xd524('0x1f')]=qs[_0xd524('0x1f')](_0x41c868[_0xd524('0x32')]['limit']);_0x1b04de['offset']=qs[_0xd524('0x1e')](_0x41c868['query'][_0xd524('0x1e')]);}_0x1b04de[_0xd524('0x39')]=qs['sort'](_0x41c868[_0xd524('0x32')][_0xd524('0x3a')]);_0x1b04de[_0xd524('0x3b')]=qs[_0xd524('0x3c')](_['pick'](_0x41c868[_0xd524('0x32')],_0x29a6a6['filters']),_0x340978);if(_0x41c868['query'][_0xd524('0x3d')]){_0x1b04de[_0xd524('0x3b')]=_['merge'](_0x1b04de[_0xd524('0x3b')],{'$or':_[_0xd524('0x2b')](_0x340978,function(_0x3cfa5f){if(_0x3cfa5f[_0xd524('0x2f')]!==_0xd524('0x3e')){var _0x827aa={};_0x827aa[_0x3cfa5f[_0xd524('0x28')]]={'$like':'%'+_0x41c868[_0xd524('0x32')][_0xd524('0x3d')]+'%'};return _0x827aa;}})});}_0x1b04de=_[_0xd524('0x3f')]({},_0x1b04de,_0x41c868[_0xd524('0x40')]);var _0x2d0f17={'where':_0x1b04de[_0xd524('0x3b')]};return db[_0xd524('0x2c')][_0xd524('0x1d')](_0x2d0f17)['then'](function(_0x5760d6){_0x3f24aa[_0xd524('0x1d')]=_0x5760d6;if(_0x41c868['query'][_0xd524('0x41')]){_0x1b04de[_0xd524('0x42')]=[{'all':!![]}];}return db[_0xd524('0x2c')]['findAll'](_0x1b04de);})[_0xd524('0x26')](function(_0x11becb){_0x3f24aa[_0xd524('0x43')]=_0x11becb;return _0x3f24aa;})[_0xd524('0x26')](respondWithFilteredResult(_0x1ea8f8,_0x1b04de))[_0xd524('0x44')](handleError(_0x1ea8f8,null));};exports[_0xd524('0x45')]=function(_0x42b4a9,_0x115c91){var _0x318d9b={'raw':!![],'where':{'id':_0x42b4a9['params']['id']}},_0x119e2c={};_0x119e2c[_0xd524('0x31')]=_['keys'](db[_0xd524('0x2c')]['rawAttributes']);_0x119e2c[_0xd524('0x32')]=_['keys'](_0x42b4a9[_0xd524('0x32')]);_0x119e2c[_0xd524('0x3c')]=_['intersection'](_0x119e2c[_0xd524('0x31')],_0x119e2c[_0xd524('0x32')]);_0x318d9b[_0xd524('0x34')]=_[_0xd524('0x33')](_0x119e2c[_0xd524('0x31')],qs['fields'](_0x42b4a9[_0xd524('0x32')]['fields']));_0x318d9b[_0xd524('0x34')]=_0x318d9b[_0xd524('0x34')]['length']?_0x318d9b[_0xd524('0x34')]:_0x119e2c['model'];if(_0x42b4a9[_0xd524('0x32')][_0xd524('0x41')]){_0x318d9b[_0xd524('0x42')]=[{'all':!![]}];}_0x318d9b=_['merge']({},_0x318d9b,_0x42b4a9[_0xd524('0x40')]);return db[_0xd524('0x2c')][_0xd524('0x46')](_0x318d9b)['then'](handleEntityNotFound(_0x115c91,null))[_0xd524('0x26')](respondWithResult(_0x115c91,null))[_0xd524('0x44')](handleError(_0x115c91,null));};exports['create']=function(_0x598b1d,_0x437354){return db[_0xd524('0x2c')][_0xd524('0x47')](_0x598b1d['body'],{})['then'](respondWithResult(_0x437354,0xc9))[_0xd524('0x44')](handleError(_0x437354,null));};exports[_0xd524('0x25')]=function(_0x4b436a,_0x58c26f){if(_0x4b436a['body']['id']){delete _0x4b436a[_0xd524('0x48')]['id'];}return db[_0xd524('0x2c')][_0xd524('0x46')]({'where':{'id':_0x4b436a[_0xd524('0x49')]['id']}})[_0xd524('0x26')](handleEntityNotFound(_0x58c26f,null))[_0xd524('0x26')](saveUpdates(_0x4b436a['body'],null))[_0xd524('0x26')](respondWithResult(_0x58c26f,null))['catch'](handleError(_0x58c26f,null));};exports[_0xd524('0x4a')]=function(_0xb52d6,_0x26c3a8){return db['SalesforceField']['find']({'where':{'id':_0xb52d6[_0xd524('0x49')]['id']}})[_0xd524('0x26')](handleEntityNotFound(_0x26c3a8,null))['then'](removeEntity(_0x26c3a8,null))[_0xd524('0x44')](handleError(_0x26c3a8,null));}; \ No newline at end of file +var _0x9de2=['moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','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','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','length','find','create','body','zip-dir','request-promise'];(function(_0x53b3ee,_0x12feb7){var _0x50fae3=function(_0x38a772){while(--_0x38a772){_0x53b3ee['push'](_0x53b3ee['shift']());}};_0x50fae3(++_0x12feb7);}(_0x9de2,0x96));var _0x29de=function(_0x1c6f62,_0xe819c5){_0x1c6f62=_0x1c6f62-0x0;var _0xd3dfbf=_0x9de2[_0x1c6f62];return _0xd3dfbf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x29de('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x29de('0x1'));var moment=require(_0x29de('0x2'));var BPromise=require(_0x29de('0x3'));var Mustache=require(_0x29de('0x4'));var util=require(_0x29de('0x5'));var path=require(_0x29de('0x6'));var sox=require(_0x29de('0x7'));var csv=require('to-csv');var ejs=require(_0x29de('0x8'));var fs=require('fs');var fs_extra=require(_0x29de('0x9'));var _=require('lodash');var squel=require(_0x29de('0xa'));var crypto=require('crypto');var jsforce=require(_0x29de('0xb'));var deskjs=require(_0x29de('0xc'));var toCsv=require(_0x29de('0xd'));var querystring=require('querystring');var Papa=require(_0x29de('0xe'));var Redis=require(_0x29de('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x29de('0x10'));var as=require(_0x29de('0x11'));var hardwareService=require(_0x29de('0x12'));var logger=require(_0x29de('0x13'))(_0x29de('0x14'));var utils=require(_0x29de('0x15'));var config=require(_0x29de('0x16'));var licenseUtil=require(_0x29de('0x17'));var db=require(_0x29de('0x18'))['db'];function respondWithStatusCode(_0x394005,_0x16ac90){_0x16ac90=_0x16ac90||0xcc;return function(_0x92f09c){if(_0x92f09c){return _0x394005[_0x29de('0x19')](_0x16ac90);}return _0x394005[_0x29de('0x1a')](_0x16ac90)[_0x29de('0x1b')]();};}function respondWithResult(_0x2ce3ac,_0x3f6937){_0x3f6937=_0x3f6937||0xc8;return function(_0x1974f0){if(_0x1974f0){return _0x2ce3ac[_0x29de('0x1a')](_0x3f6937)[_0x29de('0x1c')](_0x1974f0);}};}function respondWithFilteredResult(_0x390842,_0x8899bb){return function(_0x1cd1a1){if(_0x1cd1a1){var _0x11a054=typeof _0x8899bb[_0x29de('0x1d')]==='undefined'&&typeof _0x8899bb[_0x29de('0x1e')]===_0x29de('0x1f');var _0x17543f=_0x1cd1a1['count'];var _0x520f61=_0x11a054?0x0:_0x8899bb[_0x29de('0x1d')];var _0x3afa26=_0x11a054?_0x1cd1a1[_0x29de('0x20')]:_0x8899bb['offset']+_0x8899bb[_0x29de('0x1e')];var _0x2f660b;if(_0x3afa26>=_0x17543f){_0x3afa26=_0x17543f;_0x2f660b=0xc8;}else{_0x2f660b=0xce;}_0x390842[_0x29de('0x1a')](_0x2f660b);return _0x390842[_0x29de('0x21')](_0x29de('0x22'),_0x520f61+'-'+_0x3afa26+'/'+_0x17543f)['json'](_0x1cd1a1);}return null;};}function patchUpdates(_0x575120){return function(_0x142da7){try{jsonpatch['apply'](_0x142da7,_0x575120,!![]);}catch(_0x138271){return BPromise[_0x29de('0x23')](_0x138271);}return _0x142da7['save']();};}function saveUpdates(_0x242b2d,_0x180fa0){return function(_0x332e41){if(_0x332e41){return _0x332e41[_0x29de('0x24')](_0x242b2d)[_0x29de('0x25')](function(_0x3999e8){return _0x3999e8;});}return null;};}function removeEntity(_0x397ca1,_0x221877){return function(_0x466f79){if(_0x466f79){return _0x466f79[_0x29de('0x26')]()[_0x29de('0x25')](function(){_0x397ca1[_0x29de('0x1a')](0xcc)[_0x29de('0x1b')]();});}};}function handleEntityNotFound(_0x422942,_0x36f130){return function(_0x32d921){if(!_0x32d921){_0x422942[_0x29de('0x19')](0x194);}return _0x32d921;};}function handleError(_0x4fad3f,_0xa0db9){_0xa0db9=_0xa0db9||0x1f4;return function(_0x23c7f3){logger[_0x29de('0x27')](_0x23c7f3[_0x29de('0x28')]);if(_0x23c7f3[_0x29de('0x29')]){delete _0x23c7f3[_0x29de('0x29')];}_0x4fad3f[_0x29de('0x1a')](_0xa0db9)[_0x29de('0x2a')](_0x23c7f3);};}exports[_0x29de('0x2b')]=function(_0x376d8e,_0x778208){var _0x5e4b12={},_0x3a9c6b={},_0x1c1a70={'count':0x0,'rows':[]};var _0x30454e=_[_0x29de('0x2c')](db[_0x29de('0x2d')][_0x29de('0x2e')],function(_0x5cc894){return{'name':_0x5cc894[_0x29de('0x2f')],'type':_0x5cc894[_0x29de('0x30')][_0x29de('0x31')]};});_0x3a9c6b[_0x29de('0x32')]=_['map'](_0x30454e,_0x29de('0x29'));_0x3a9c6b['query']=_['keys'](_0x376d8e[_0x29de('0x33')]);_0x3a9c6b[_0x29de('0x34')]=_[_0x29de('0x35')](_0x3a9c6b[_0x29de('0x32')],_0x3a9c6b[_0x29de('0x33')]);_0x5e4b12[_0x29de('0x36')]=_['intersection'](_0x3a9c6b[_0x29de('0x32')],qs[_0x29de('0x37')](_0x376d8e[_0x29de('0x33')][_0x29de('0x37')]));_0x5e4b12[_0x29de('0x36')]=_0x5e4b12[_0x29de('0x36')]['length']?_0x5e4b12[_0x29de('0x36')]:_0x3a9c6b['model'];if(!_0x376d8e[_0x29de('0x33')]['hasOwnProperty'](_0x29de('0x38'))){_0x5e4b12[_0x29de('0x1e')]=qs[_0x29de('0x1e')](_0x376d8e[_0x29de('0x33')][_0x29de('0x1e')]);_0x5e4b12[_0x29de('0x1d')]=qs['offset'](_0x376d8e[_0x29de('0x33')][_0x29de('0x1d')]);}_0x5e4b12[_0x29de('0x39')]=qs[_0x29de('0x3a')](_0x376d8e['query']['sort']);_0x5e4b12[_0x29de('0x3b')]=qs[_0x29de('0x34')](_[_0x29de('0x3c')](_0x376d8e['query'],_0x3a9c6b[_0x29de('0x34')]),_0x30454e);if(_0x376d8e[_0x29de('0x33')]['filter']){_0x5e4b12[_0x29de('0x3b')]=_[_0x29de('0x3d')](_0x5e4b12[_0x29de('0x3b')],{'$or':_[_0x29de('0x2c')](_0x30454e,function(_0x5a9a84){if(_0x5a9a84['type']!==_0x29de('0x3e')){var _0xfede69={};_0xfede69[_0x5a9a84[_0x29de('0x29')]]={'$like':'%'+_0x376d8e[_0x29de('0x33')][_0x29de('0x3f')]+'%'};return _0xfede69;}})});}_0x5e4b12=_[_0x29de('0x3d')]({},_0x5e4b12,_0x376d8e[_0x29de('0x40')]);var _0x356c2c={'where':_0x5e4b12[_0x29de('0x3b')]};return db[_0x29de('0x2d')]['count'](_0x356c2c)[_0x29de('0x25')](function(_0x237fdf){_0x1c1a70['count']=_0x237fdf;if(_0x376d8e[_0x29de('0x33')][_0x29de('0x41')]){_0x5e4b12[_0x29de('0x42')]=[{'all':!![]}];}return db[_0x29de('0x2d')][_0x29de('0x43')](_0x5e4b12);})[_0x29de('0x25')](function(_0x14a33e){_0x1c1a70['rows']=_0x14a33e;return _0x1c1a70;})[_0x29de('0x25')](respondWithFilteredResult(_0x778208,_0x5e4b12))[_0x29de('0x44')](handleError(_0x778208,null));};exports[_0x29de('0x45')]=function(_0x10902f,_0x38da66){var _0x3a5f5a={'raw':!![],'where':{'id':_0x10902f[_0x29de('0x46')]['id']}},_0x5e9b0e={};_0x5e9b0e[_0x29de('0x32')]=_['keys'](db['SalesforceField'][_0x29de('0x2e')]);_0x5e9b0e['query']=_[_0x29de('0x47')](_0x10902f[_0x29de('0x33')]);_0x5e9b0e[_0x29de('0x34')]=_[_0x29de('0x35')](_0x5e9b0e[_0x29de('0x32')],_0x5e9b0e[_0x29de('0x33')]);_0x3a5f5a[_0x29de('0x36')]=_[_0x29de('0x35')](_0x5e9b0e[_0x29de('0x32')],qs[_0x29de('0x37')](_0x10902f['query'][_0x29de('0x37')]));_0x3a5f5a[_0x29de('0x36')]=_0x3a5f5a['attributes'][_0x29de('0x48')]?_0x3a5f5a[_0x29de('0x36')]:_0x5e9b0e[_0x29de('0x32')];if(_0x10902f[_0x29de('0x33')][_0x29de('0x41')]){_0x3a5f5a[_0x29de('0x42')]=[{'all':!![]}];}_0x3a5f5a=_[_0x29de('0x3d')]({},_0x3a5f5a,_0x10902f[_0x29de('0x40')]);return db[_0x29de('0x2d')][_0x29de('0x49')](_0x3a5f5a)['then'](handleEntityNotFound(_0x38da66,null))[_0x29de('0x25')](respondWithResult(_0x38da66,null))[_0x29de('0x44')](handleError(_0x38da66,null));};exports[_0x29de('0x4a')]=function(_0x53a101,_0x3c0b4a){return db[_0x29de('0x2d')][_0x29de('0x4a')](_0x53a101[_0x29de('0x4b')],{})[_0x29de('0x25')](respondWithResult(_0x3c0b4a,0xc9))[_0x29de('0x44')](handleError(_0x3c0b4a,null));};exports[_0x29de('0x24')]=function(_0x58595e,_0x4e8eb4){if(_0x58595e[_0x29de('0x4b')]['id']){delete _0x58595e['body']['id'];}return db[_0x29de('0x2d')][_0x29de('0x49')]({'where':{'id':_0x58595e[_0x29de('0x46')]['id']}})[_0x29de('0x25')](handleEntityNotFound(_0x4e8eb4,null))['then'](saveUpdates(_0x58595e[_0x29de('0x4b')],null))[_0x29de('0x25')](respondWithResult(_0x4e8eb4,null))[_0x29de('0x44')](handleError(_0x4e8eb4,null));};exports['destroy']=function(_0x194f0a,_0x5f1e06){return db[_0x29de('0x2d')][_0x29de('0x49')]({'where':{'id':_0x194f0a['params']['id']}})[_0x29de('0x25')](handleEntityNotFound(_0x5f1e06,null))[_0x29de('0x25')](removeEntity(_0x5f1e06,null))[_0x29de('0x44')](handleError(_0x5f1e06,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index def366d..3bd6ed7 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 _0x4c5b=['../../config/logger','api','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','define','int_salesforce_fields','salesforce_unique_index','idField','lodash','util'];(function(_0x542ae7,_0x57332f){var _0x5a96a6=function(_0x3c06ad){while(--_0x3c06ad){_0x542ae7['push'](_0x542ae7['shift']());}};_0x5a96a6(++_0x57332f);}(_0x4c5b,0x1d2));var _0xb4c5=function(_0x571fce,_0x3424be){_0x571fce=_0x571fce-0x0;var _0x3a7ae3=_0x4c5b[_0x571fce];return _0x3a7ae3;};'use strict';var _=require(_0xb4c5('0x0'));var util=require(_0xb4c5('0x1'));var logger=require(_0xb4c5('0x2'))(_0xb4c5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb4c5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb4c5('0x5'));var config=require(_0xb4c5('0x6'));var attributes=require(_0xb4c5('0x7'));module['exports']=function(_0x4df6f3,_0x1fa68f){return _0x4df6f3[_0xb4c5('0x8')]('SalesforceField',attributes,{'tableName':_0xb4c5('0x9'),'paranoid':![],'indexes':[{'name':_0xb4c5('0xa'),'fields':[_0xb4c5('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x61fd=['rimraf','./intSalesforceField.attributes','exports','define','idField','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x468a92,_0x47843b){var _0xf1f19f=function(_0x1ae14f){while(--_0x1ae14f){_0x468a92['push'](_0x468a92['shift']());}};_0xf1f19f(++_0x47843b);}(_0x61fd,0x125));var _0xd61f=function(_0x28a878,_0x2f6459){_0x28a878=_0x28a878-0x0;var _0xcb814f=_0x61fd[_0x28a878];return _0xcb814f;};'use strict';var _=require(_0xd61f('0x0'));var util=require('util');var logger=require(_0xd61f('0x1'))(_0xd61f('0x2'));var moment=require(_0xd61f('0x3'));var BPromise=require(_0xd61f('0x4'));var rp=require(_0xd61f('0x5'));var fs=require('fs');var path=require(_0xd61f('0x6'));var rimraf=require(_0xd61f('0x7'));var config=require('../../config/environment');var attributes=require(_0xd61f('0x8'));module[_0xd61f('0x9')]=function(_0x449151,_0x5634a5){return _0x449151[_0xd61f('0xa')]('SalesforceField',attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xd61f('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index fd01850..69ff6e6 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 _0xf2eb=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1e755d,_0xa870e6){var _0x3ad3b5=function(_0x2e0f79){while(--_0x2e0f79){_0x1e755d['push'](_0x1e755d['shift']());}};_0x3ad3b5(++_0xa870e6);}(_0xf2eb,0x186));var _0xbf2e=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xf2eb[_0x59c301];return _0x3866b9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbf2e('0x0'));var BPromise=require(_0xbf2e('0x1'));var rs=require(_0xbf2e('0x2'));var fs=require('fs');var Redis=require(_0xbf2e('0x3'));var db=require(_0xbf2e('0x4'))['db'];var utils=require(_0xbf2e('0x5'));var logger=require(_0xbf2e('0x6'))(_0xbf2e('0x7'));var config=require(_0xbf2e('0x8'));var jayson=require(_0xbf2e('0x9'));var client=jayson[_0xbf2e('0xa')][_0xbf2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c0efe,_0xd0fd3,_0x4bb48a){return new BPromise(function(_0x12586a,_0x49e11f){return client[_0xbf2e('0xc')](_0x4c0efe,_0x4bb48a)['then'](function(_0x1d2d8e){logger[_0xbf2e('0xd')](_0xbf2e('0xe'),_0xd0fd3,_0xbf2e('0xf'));logger['debug'](_0xbf2e('0x10'),_0xd0fd3,_0xbf2e('0xf'),JSON[_0xbf2e('0x11')](_0x1d2d8e));if(_0x1d2d8e[_0xbf2e('0x12')]){if(_0x1d2d8e['error'][_0xbf2e('0x13')]===0x1f4){logger[_0xbf2e('0x12')](_0xbf2e('0xe'),_0xd0fd3,_0x1d2d8e[_0xbf2e('0x12')][_0xbf2e('0x14')]);return _0x49e11f(_0x1d2d8e['error'][_0xbf2e('0x14')]);}logger[_0xbf2e('0x12')](_0xbf2e('0xe'),_0xd0fd3,_0x1d2d8e[_0xbf2e('0x12')][_0xbf2e('0x14')]);return _0x12586a(_0x1d2d8e[_0xbf2e('0x12')]['message']);}else{logger[_0xbf2e('0xd')](_0xbf2e('0xe'),_0xd0fd3,'request\x20sent');_0x12586a(_0x1d2d8e['result'][_0xbf2e('0x14')]);}})[_0xbf2e('0x15')](function(_0x695616){logger[_0xbf2e('0x12')](_0xbf2e('0xe'),_0xd0fd3,_0x695616);_0x49e11f(_0x695616);});});} \ No newline at end of file +var _0xdea7=['../../config/logger','../../config/environment','client','http','request','info','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5afb9a,_0xd8a2ae){var _0x4286ae=function(_0x56ff86){while(--_0x56ff86){_0x5afb9a['push'](_0x5afb9a['shift']());}};_0x4286ae(++_0xd8a2ae);}(_0xdea7,0x135));var _0x7dea=function(_0xce0f82,_0x4f5993){_0xce0f82=_0xce0f82-0x0;var _0x2569ec=_0xdea7[_0xce0f82];return _0x2569ec;};'use strict';var _=require('lodash');var util=require(_0x7dea('0x0'));var moment=require(_0x7dea('0x1'));var BPromise=require('bluebird');var rs=require(_0x7dea('0x2'));var fs=require('fs');var Redis=require(_0x7dea('0x3'));var db=require(_0x7dea('0x4'))['db'];var utils=require(_0x7dea('0x5'));var logger=require(_0x7dea('0x6'))('rpc');var config=require(_0x7dea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7dea('0x8')][_0x7dea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x925ecf,_0x96fbce,_0x4710f9){return new BPromise(function(_0x25e009,_0x6a3d41){return client[_0x7dea('0xa')](_0x925ecf,_0x4710f9)['then'](function(_0x5d4c34){logger[_0x7dea('0xb')]('SalesforceField,\x20%s,\x20%s',_0x96fbce,_0x7dea('0xc'));logger['debug'](_0x7dea('0xd'),_0x96fbce,_0x7dea('0xc'),JSON[_0x7dea('0xe')](_0x5d4c34));if(_0x5d4c34[_0x7dea('0xf')]){if(_0x5d4c34['error'][_0x7dea('0x10')]===0x1f4){logger[_0x7dea('0xf')](_0x7dea('0x11'),_0x96fbce,_0x5d4c34[_0x7dea('0xf')][_0x7dea('0x12')]);return _0x6a3d41(_0x5d4c34[_0x7dea('0xf')][_0x7dea('0x12')]);}logger['error'](_0x7dea('0x11'),_0x96fbce,_0x5d4c34['error'][_0x7dea('0x12')]);return _0x25e009(_0x5d4c34[_0x7dea('0xf')][_0x7dea('0x12')]);}else{logger[_0x7dea('0xb')]('SalesforceField,\x20%s,\x20%s',_0x96fbce,_0x7dea('0xc'));_0x25e009(_0x5d4c34[_0x7dea('0x13')][_0x7dea('0x12')]);}})[_0x7dea('0x14')](function(_0x580c4c){logger[_0x7dea('0xf')](_0x7dea('0x11'),_0x96fbce,_0x580c4c);_0x6a3d41(_0x580c4c);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 41478cd..afd069e 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 _0xde46=['update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','post','addConfiguration','put'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0xde46,0x174));var _0x6de4=function(_0xa2a725,_0xf69b29){_0xa2a725=_0xa2a725-0x0;var _0x2fe3df=_0xde46[_0xa2a725];return _0x2fe3df;};'use strict';var multer=require(_0x6de4('0x0'));var util=require('util');var path=require(_0x6de4('0x1'));var timeout=require('connect-timeout');var express=require(_0x6de4('0x2'));var router=express[_0x6de4('0x3')]();var fs_extra=require(_0x6de4('0x4'));var auth=require(_0x6de4('0x5'));var interaction=require(_0x6de4('0x6'));var config=require(_0x6de4('0x7'));var controller=require(_0x6de4('0x8'));router[_0x6de4('0x9')]('/',auth[_0x6de4('0xa')](),controller[_0x6de4('0xb')]);router[_0x6de4('0x9')](_0x6de4('0xc'),auth[_0x6de4('0xa')](),controller[_0x6de4('0xd')]);router[_0x6de4('0x9')](_0x6de4('0xe'),auth[_0x6de4('0xa')](),controller['getConfigurations']);router[_0x6de4('0x9')](_0x6de4('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x6de4('0x10')]('/',auth[_0x6de4('0xa')](),controller['create']);router['post'](_0x6de4('0xe'),auth[_0x6de4('0xa')](),controller[_0x6de4('0x11')]);router[_0x6de4('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x6de4('0x13')]);router[_0x6de4('0x14')]('/:id',auth[_0x6de4('0xa')](),controller[_0x6de4('0x15')]);module[_0x6de4('0x16')]=router; \ No newline at end of file +var _0x8ff3=['post','create','addConfiguration','put','update','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x10197a,_0x5b7bb6){var _0x11ad2b=function(_0x5b8bc9){while(--_0x5b8bc9){_0x10197a['push'](_0x10197a['shift']());}};_0x11ad2b(++_0x5b7bb6);}(_0x8ff3,0x1bb));var _0x38ff=function(_0x567ac9,_0x43b49e){_0x567ac9=_0x567ac9-0x0;var _0x101959=_0x8ff3[_0x567ac9];return _0x101959;};'use strict';var multer=require('multer');var util=require(_0x38ff('0x0'));var path=require('path');var timeout=require(_0x38ff('0x1'));var express=require(_0x38ff('0x2'));var router=express[_0x38ff('0x3')]();var fs_extra=require(_0x38ff('0x4'));var auth=require(_0x38ff('0x5'));var interaction=require(_0x38ff('0x6'));var config=require(_0x38ff('0x7'));var controller=require('./intServicenowAccount.controller');router[_0x38ff('0x8')]('/',auth[_0x38ff('0x9')](),controller[_0x38ff('0xa')]);router[_0x38ff('0x8')](_0x38ff('0xb'),auth[_0x38ff('0x9')](),controller[_0x38ff('0xc')]);router[_0x38ff('0x8')](_0x38ff('0xd'),auth[_0x38ff('0x9')](),controller[_0x38ff('0xe')]);router[_0x38ff('0x8')](_0x38ff('0xf'),auth['isAuthenticated'](),controller[_0x38ff('0x10')]);router[_0x38ff('0x11')]('/',auth[_0x38ff('0x9')](),controller[_0x38ff('0x12')]);router['post'](_0x38ff('0xd'),auth[_0x38ff('0x9')](),controller[_0x38ff('0x13')]);router[_0x38ff('0x14')](_0x38ff('0xb'),auth['isAuthenticated'](),controller[_0x38ff('0x15')]);router['delete'](_0x38ff('0xb'),auth[_0x38ff('0x9')](),controller[_0x38ff('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index ba0746f..8555440 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 _0x26aa=['username','sequelize','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x26aa,0xd6));var _0xa26a=function(_0x161dce,_0x292821){_0x161dce=_0x161dce-0x0;var _0x1e8fda=_0x26aa[_0x161dce];return _0x1e8fda;};'use strict';var Sequelize=require(_0xa26a('0x0'));module['exports']={'name':{'type':Sequelize[_0xa26a('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0xa26a('0x2')},'password':{'type':Sequelize[_0xa26a('0x1')]},'email':{'type':Sequelize[_0xa26a('0x1')]},'remoteUri':{'type':Sequelize[_0xa26a('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xa26a('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x3e44=['STRING','username','exports'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0x3e44,0xb6));var _0x43e4=function(_0x4de7d2,_0x26572e){_0x4de7d2=_0x4de7d2-0x0;var _0xc7693c=_0x3e44[_0x4de7d2];return _0xc7693c;};'use strict';var Sequelize=require('sequelize');module[_0x43e4('0x0')]={'name':{'type':Sequelize[_0x43e4('0x1')]},'description':{'type':Sequelize[_0x43e4('0x1')]},'username':{'type':Sequelize[_0x43e4('0x1')],'unique':_0x43e4('0x2')},'password':{'type':Sequelize[_0x43e4('0x1')]},'email':{'type':Sequelize[_0x43e4('0x1')]},'remoteUri':{'type':Sequelize[_0x43e4('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x43e4('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index fcd869d..c04d01f 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 _0x2465=['parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','expected_start','opened_at','business_duration','group_list','reopened_time','resolved_at','subcategory','work_notes','short_description','close_code','delivery_task','work_start','assignment_group','business_stc','description','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','activity_due','assigned_to','sla_due','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','email','remoteUri','slice','lastIndexOf','format','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','internalType','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','test','statusCode','send','Wrong\x20credentials','True','true','false','sys_choice?sysparm_query=name=incident^element=','inactive','label','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','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','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','error','stack','name','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','nolimit','order','sort','where','filter','merge','options','findAll','rows','catch','show','keys','filters','fields','includeAll','find','create','body','params','destroy','getConfigurations','findOne','ServicenowConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','notify','incident_state','severity','category'];(function(_0x3a23c1,_0x495d49){var _0x286863=function(_0x3accee){while(--_0x3accee){_0x3a23c1['push'](_0x3a23c1['shift']());}};_0x286863(++_0x495d49);}(_0x2465,0x10c));var _0x5246=function(_0x32ca60,_0x37357b){_0x32ca60=_0x32ca60-0x0;var _0xdd58a9=_0x2465[_0x32ca60];return _0xdd58a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5246('0x0'));var zipdir=require(_0x5246('0x1'));var jsonpatch=require(_0x5246('0x2'));var rp=require(_0x5246('0x3'));var moment=require(_0x5246('0x4'));var BPromise=require(_0x5246('0x5'));var Mustache=require('mustache');var util=require(_0x5246('0x6'));var path=require(_0x5246('0x7'));var sox=require('sox');var csv=require(_0x5246('0x8'));var ejs=require(_0x5246('0x9'));var fs=require('fs');var fs_extra=require(_0x5246('0xa'));var _=require('lodash');var squel=require(_0x5246('0xb'));var crypto=require(_0x5246('0xc'));var jsforce=require(_0x5246('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5246('0x8'));var querystring=require(_0x5246('0xe'));var Papa=require(_0x5246('0xf'));var Redis=require(_0x5246('0x10'));var authService=require(_0x5246('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5246('0x12'));var hardwareService=require(_0x5246('0x13'));var logger=require(_0x5246('0x14'))('api');var utils=require(_0x5246('0x15'));var config=require(_0x5246('0x16'));var licenseUtil=require(_0x5246('0x17'));var db=require(_0x5246('0x18'))['db'];var integrations=require(_0x5246('0x19'));function respondWithStatusCode(_0x4c9a5f,_0x54d6e9){_0x54d6e9=_0x54d6e9||0xcc;return function(_0x13beb2){if(_0x13beb2){return _0x4c9a5f[_0x5246('0x1a')](_0x54d6e9);}return _0x4c9a5f[_0x5246('0x1b')](_0x54d6e9)[_0x5246('0x1c')]();};}function respondWithResult(_0x20d9d0,_0x26ccc6){_0x26ccc6=_0x26ccc6||0xc8;return function(_0xd21a31){if(_0xd21a31){return _0x20d9d0[_0x5246('0x1b')](_0x26ccc6)[_0x5246('0x1d')](_0xd21a31);}};}function respondWithFilteredResult(_0x22a6a2,_0x14a7e1){return function(_0x56bfac){if(_0x56bfac){var _0x230a2d=typeof _0x14a7e1[_0x5246('0x1e')]==='undefined'&&typeof _0x14a7e1[_0x5246('0x1f')]==='undefined';var _0x3d5415=_0x56bfac[_0x5246('0x20')];var _0x5a718f=_0x230a2d?0x0:_0x14a7e1[_0x5246('0x1e')];var _0x1b1f3d=_0x230a2d?_0x56bfac['count']:_0x14a7e1['offset']+_0x14a7e1['limit'];var _0x12665e;if(_0x1b1f3d>=_0x3d5415){_0x1b1f3d=_0x3d5415;_0x12665e=0xc8;}else{_0x12665e=0xce;}_0x22a6a2[_0x5246('0x1b')](_0x12665e);return _0x22a6a2['set'](_0x5246('0x21'),_0x5a718f+'-'+_0x1b1f3d+'/'+_0x3d5415)[_0x5246('0x1d')](_0x56bfac);}return null;};}function patchUpdates(_0x81cfa0){return function(_0x28993f){try{jsonpatch['apply'](_0x28993f,_0x81cfa0,!![]);}catch(_0x597271){return BPromise[_0x5246('0x22')](_0x597271);}return _0x28993f[_0x5246('0x23')]();};}function saveUpdates(_0x53f25c,_0x92c562){return function(_0x117c3e){if(_0x117c3e){return _0x117c3e[_0x5246('0x24')](_0x53f25c)['then'](function(_0x1bdfef){return _0x1bdfef;});}return null;};}function removeEntity(_0x49aa55,_0x1a9fb9){return function(_0x500e1e){if(_0x500e1e){return _0x500e1e['destroy']()[_0x5246('0x25')](function(){_0x49aa55[_0x5246('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x538fd7,_0x23d5e0){return function(_0x33c50d){if(!_0x33c50d){_0x538fd7[_0x5246('0x1a')](0x194);}return _0x33c50d;};}function handleError(_0x5a6763,_0x53e2bd){_0x53e2bd=_0x53e2bd||0x1f4;return function(_0x2f109b){logger[_0x5246('0x26')](_0x2f109b[_0x5246('0x27')]);if(_0x2f109b[_0x5246('0x28')]){delete _0x2f109b[_0x5246('0x28')];}_0x5a6763[_0x5246('0x1b')](_0x53e2bd)['send'](_0x2f109b);};}exports[_0x5246('0x29')]=function(_0x1317fe,_0x1e22c3){var _0x136629={},_0x4fa666={},_0x240829={'count':0x0,'rows':[]};var _0x34c97d=_[_0x5246('0x2a')](db[_0x5246('0x2b')][_0x5246('0x2c')],function(_0x31ed40){return{'name':_0x31ed40[_0x5246('0x2d')],'type':_0x31ed40[_0x5246('0x2e')][_0x5246('0x2f')]};});_0x4fa666[_0x5246('0x30')]=_['map'](_0x34c97d,_0x5246('0x28'));_0x4fa666['query']=_['keys'](_0x1317fe[_0x5246('0x31')]);_0x4fa666['filters']=_[_0x5246('0x32')](_0x4fa666[_0x5246('0x30')],_0x4fa666[_0x5246('0x31')]);_0x136629[_0x5246('0x33')]=_[_0x5246('0x32')](_0x4fa666['model'],qs['fields'](_0x1317fe[_0x5246('0x31')]['fields']));_0x136629[_0x5246('0x33')]=_0x136629[_0x5246('0x33')][_0x5246('0x34')]?_0x136629[_0x5246('0x33')]:_0x4fa666[_0x5246('0x30')];if(!_0x1317fe[_0x5246('0x31')]['hasOwnProperty'](_0x5246('0x35'))){_0x136629[_0x5246('0x1f')]=qs['limit'](_0x1317fe['query'][_0x5246('0x1f')]);_0x136629['offset']=qs[_0x5246('0x1e')](_0x1317fe[_0x5246('0x31')][_0x5246('0x1e')]);}_0x136629[_0x5246('0x36')]=qs[_0x5246('0x37')](_0x1317fe['query'][_0x5246('0x37')]);_0x136629[_0x5246('0x38')]=qs['filters'](_['pick'](_0x1317fe['query'],_0x4fa666['filters']),_0x34c97d);if(_0x1317fe[_0x5246('0x31')][_0x5246('0x39')]){_0x136629[_0x5246('0x38')]=_[_0x5246('0x3a')](_0x136629['where'],{'$or':_[_0x5246('0x2a')](_0x34c97d,function(_0x42f9b3){if(_0x42f9b3[_0x5246('0x2e')]!=='VIRTUAL'){var _0x3b9293={};_0x3b9293[_0x42f9b3[_0x5246('0x28')]]={'$like':'%'+_0x1317fe[_0x5246('0x31')][_0x5246('0x39')]+'%'};return _0x3b9293;}})});}_0x136629=_['merge']({},_0x136629,_0x1317fe[_0x5246('0x3b')]);var _0x14475b={'where':_0x136629[_0x5246('0x38')]};return db[_0x5246('0x2b')][_0x5246('0x20')](_0x14475b)[_0x5246('0x25')](function(_0x4127fe){_0x240829[_0x5246('0x20')]=_0x4127fe;if(_0x1317fe['query']['includeAll']){_0x136629['include']=[{'all':!![]}];}return db[_0x5246('0x2b')][_0x5246('0x3c')](_0x136629);})[_0x5246('0x25')](function(_0x295fa1){_0x240829[_0x5246('0x3d')]=_0x295fa1;return _0x240829;})['then'](respondWithFilteredResult(_0x1e22c3,_0x136629))[_0x5246('0x3e')](handleError(_0x1e22c3,null));};exports[_0x5246('0x3f')]=function(_0x5ced66,_0x5772fd){var _0x1f6895={'raw':![],'where':{'id':_0x5ced66['params']['id']}},_0x11295={};_0x11295[_0x5246('0x30')]=_[_0x5246('0x40')](db['ServicenowAccount'][_0x5246('0x2c')]);_0x11295[_0x5246('0x31')]=_[_0x5246('0x40')](_0x5ced66['query']);_0x11295[_0x5246('0x41')]=_['intersection'](_0x11295[_0x5246('0x30')],_0x11295[_0x5246('0x31')]);_0x1f6895[_0x5246('0x33')]=_['intersection'](_0x11295[_0x5246('0x30')],qs[_0x5246('0x42')](_0x5ced66[_0x5246('0x31')][_0x5246('0x42')]));_0x1f6895[_0x5246('0x33')]=_0x1f6895['attributes'][_0x5246('0x34')]?_0x1f6895[_0x5246('0x33')]:_0x11295['model'];if(_0x5ced66[_0x5246('0x31')][_0x5246('0x43')]){_0x1f6895['include']=[{'all':!![]}];}_0x1f6895=_[_0x5246('0x3a')]({},_0x1f6895,_0x5ced66['options']);return db[_0x5246('0x2b')][_0x5246('0x44')](_0x1f6895)['then'](handleEntityNotFound(_0x5772fd,null))[_0x5246('0x25')](respondWithResult(_0x5772fd,null))['catch'](handleError(_0x5772fd,null));};exports['create']=function(_0x5c32ee,_0x16374f){return db['ServicenowAccount'][_0x5246('0x45')](_0x5c32ee[_0x5246('0x46')],{})['then'](respondWithResult(_0x16374f,0xc9))[_0x5246('0x3e')](handleError(_0x16374f,null));};exports[_0x5246('0x24')]=function(_0x3a3786,_0x542661){if(_0x3a3786[_0x5246('0x46')]['id']){delete _0x3a3786[_0x5246('0x46')]['id'];}return db[_0x5246('0x2b')][_0x5246('0x44')]({'where':{'id':_0x3a3786[_0x5246('0x47')]['id']}})[_0x5246('0x25')](handleEntityNotFound(_0x542661,null))[_0x5246('0x25')](saveUpdates(_0x3a3786[_0x5246('0x46')],null))['then'](respondWithResult(_0x542661,null))[_0x5246('0x3e')](handleError(_0x542661,null));};exports[_0x5246('0x48')]=function(_0x16e7b0,_0x19c110){return db[_0x5246('0x2b')][_0x5246('0x44')]({'where':{'id':_0x16e7b0[_0x5246('0x47')]['id']}})['then'](handleEntityNotFound(_0x19c110,null))[_0x5246('0x25')](removeEntity(_0x19c110,null))['catch'](handleError(_0x19c110,null));};exports[_0x5246('0x49')]=function(_0x275d33,_0x5eaca8,_0x57d13d){var _0xe67b03={};var _0xe172d2={};var _0x1aca85;var _0x5d7fd2;return db[_0x5246('0x2b')][_0x5246('0x4a')]({'where':{'id':_0x275d33[_0x5246('0x47')]['id']}})[_0x5246('0x25')](handleEntityNotFound(_0x5eaca8,null))[_0x5246('0x25')](function(_0x6a8929){if(_0x6a8929){_0x1aca85=_0x6a8929;_0xe172d2['model']=_[_0x5246('0x40')](db[_0x5246('0x4b')][_0x5246('0x2c')]);_0xe172d2[_0x5246('0x31')]=_[_0x5246('0x40')](_0x275d33['query']);_0xe172d2[_0x5246('0x41')]=_[_0x5246('0x32')](_0xe172d2[_0x5246('0x30')],_0xe172d2[_0x5246('0x31')]);_0xe67b03[_0x5246('0x33')]=_[_0x5246('0x32')](_0xe172d2[_0x5246('0x30')],qs[_0x5246('0x42')](_0x275d33['query']['fields']));_0xe67b03[_0x5246('0x33')]=_0xe67b03[_0x5246('0x33')][_0x5246('0x34')]?_0xe67b03[_0x5246('0x33')]:_0xe172d2[_0x5246('0x30')];_0xe67b03[_0x5246('0x36')]=qs['sort'](_0x275d33[_0x5246('0x31')][_0x5246('0x37')]);_0xe67b03['where']=qs[_0x5246('0x41')](_[_0x5246('0x4c')](_0x275d33[_0x5246('0x31')],_0xe172d2[_0x5246('0x41')]));if(_0x275d33['query'][_0x5246('0x39')]){_0xe67b03[_0x5246('0x38')]=_[_0x5246('0x3a')](_0xe67b03[_0x5246('0x38')],{'$or':_[_0x5246('0x2a')](_0xe67b03['attributes'],function(_0x280a03){var _0x2154b2={};_0x2154b2[_0x280a03]={'$like':'%'+_0x275d33['query'][_0x5246('0x39')]+'%'};return _0x2154b2;})});}_0xe67b03=_[_0x5246('0x3a')]({},_0xe67b03,_0x275d33[_0x5246('0x3b')]);return _0x1aca85[_0x5246('0x49')](_0xe67b03);}})[_0x5246('0x25')](function(_0x43494b){if(_0x43494b){_0x5d7fd2=_0x43494b['length'];if(!_0x275d33[_0x5246('0x31')][_0x5246('0x4d')]('nolimit')){_0xe67b03[_0x5246('0x1f')]=qs[_0x5246('0x1f')](_0x275d33[_0x5246('0x31')][_0x5246('0x1f')]);_0xe67b03[_0x5246('0x1e')]=qs['offset'](_0x275d33[_0x5246('0x31')][_0x5246('0x1e')]);}return _0x1aca85[_0x5246('0x49')](_0xe67b03);}})['then'](function(_0x5bef75){if(_0x5bef75){return _0x5bef75?{'count':_0x5d7fd2,'rows':_0x5bef75}:null;}})[_0x5246('0x25')](respondWithResult(_0x5eaca8,null))[_0x5246('0x3e')](handleError(_0x5eaca8,null));};exports[_0x5246('0x4e')]=function(_0x2a4314,_0x5ed2fd,_0x80286d){if(_0x2a4314[_0x5246('0x46')]['id']){delete _0x2a4314[_0x5246('0x46')]['id'];}return db[_0x5246('0x2b')][_0x5246('0x4a')]({'where':{'id':_0x2a4314['params']['id']}})[_0x5246('0x25')](handleEntityNotFound(_0x5ed2fd,null))['then'](function(_0x500c93){if(_0x500c93){_0x2a4314['body'][_0x5246('0x4f')]=_0x500c93['id'];_0x2a4314[_0x5246('0x46')][_0x5246('0x50')]=integrations[_0x5246('0x51')](_0x2a4314['body'][_0x5246('0x52')],_0x2a4314[_0x5246('0x46')]['type']);_0x2a4314['body'][_0x5246('0x53')]=integrations[_0x5246('0x54')](_0x2a4314[_0x5246('0x46')][_0x5246('0x52')],_0x2a4314[_0x5246('0x46')][_0x5246('0x2e')]);return db[_0x5246('0x4b')][_0x5246('0x45')](_0x2a4314['body'],{'include':[{'model':db[_0x5246('0x55')],'as':_0x5246('0x50')},{'model':db[_0x5246('0x55')],'as':_0x5246('0x53')}]});}return null;})[_0x5246('0x25')](respondWithResult(_0x5ed2fd,null))[_0x5246('0x3e')](handleError(_0x5ed2fd,null));};exports[_0x5246('0x56')]=function(_0x2a5545,_0x517492,_0x3356da){var _0x4b1cd7=[_0x5246('0x57'),_0x5246('0x58'),_0x5246('0x59'),'subcategory','close_code',_0x5246('0x5a'),_0x5246('0x5b'),_0x5246('0x5c'),_0x5246('0x5d')];var _0x4a55d4=[_0x5246('0x5e'),_0x5246('0x57'),_0x5246('0x5f'),'watch_list',_0x5246('0x60'),_0x5246('0x61'),_0x5246('0x62'),'hold_reason',_0x5246('0x63'),'number',_0x5246('0x64'),_0x5246('0x65'),_0x5246('0x66'),'user_input','sys_created_on',_0x5246('0x67'),_0x5246('0x68'),_0x5246('0x69'),_0x5246('0x59'),_0x5246('0x36'),_0x5246('0x6a'),_0x5246('0x6b'),_0x5246('0x6c'),_0x5246('0x6d'),_0x5246('0x6e'),_0x5246('0x6f'),_0x5246('0x70'),_0x5246('0x71'),_0x5246('0x72'),_0x5246('0x73'),_0x5246('0x74'),'time_worked',_0x5246('0x75'),_0x5246('0x76'),_0x5246('0x77'),_0x5246('0x78'),'work_end',_0x5246('0x79'),_0x5246('0x7a'),'caller_id','approval_set',_0x5246('0x7b'),_0x5246('0x7c'),_0x5246('0x7d'),_0x5246('0x7e'),'correlation_display',_0x5246('0x7f'),_0x5246('0x80'),_0x5246('0x81'),_0x5246('0x82'),'additional_assignee_list',_0x5246('0x83'),'calendar_duration',_0x5246('0x5a'),'sys_class_name','close_notes',_0x5246('0x84'),_0x5246('0x85'),'parent_incident',_0x5246('0x86'),_0x5246('0x87'),_0x5246('0x88'),'incident_state',_0x5246('0x89'),_0x5246('0x8a'),'company','reassignment_count',_0x5246('0x8b'),_0x5246('0x8c'),_0x5246('0x5c'),'comments',_0x5246('0x8d'),'approval',_0x5246('0x8e'),_0x5246('0x8f'),'sys_mod_count',_0x5246('0x90'),_0x5246('0x91'),_0x5246('0x92'),_0x5246('0x93'),_0x5246('0x94'),_0x5246('0x95'),_0x5246('0x5d')];var _0x18b756='';var _0x84be9a='';var _0x50502d=[];var _0x446fd4='';var _0x3d5cf1='';var _0x1a9162=[];var _0x36ecca='';var _0x2a01e6='';var _0x2a5253={};var _0x39493a='';return db[_0x5246('0x2b')][_0x5246('0x4a')]({'where':{'id':_0x2a5545['params']['id']},'attributes':['id',_0x5246('0x96'),'password',_0x5246('0x97'),_0x5246('0x98'),'serverUrl']})[_0x5246('0x25')](handleEntityNotFound(_0x517492,null))[_0x5246('0x25')](function(_0x5da797){if(_0x5da797){_0x39493a=_0x5da797[_0x5246('0x98')];var _0x2a5379=_0x39493a[_0x5246('0x99')](-0x1);if(_0x2a5379==='/'){_0x39493a=_0x39493a['substring'](0x0,_0x39493a[_0x5246('0x9a')](_0x2a5379));}_0x2a01e6=util[_0x5246('0x9b')]('%s/api/now/doc/table/schema/',_0x39493a);_0x36ecca=util['format'](_0x5246('0x9c'),_0x39493a);_0x2a5253={'user':_0x5da797[_0x5246('0x96')],'pass':_0x5da797[_0x5246('0x9d')]};var _0x4ffe58={'method':_0x5246('0x9e'),'uri':_0x2a01e6+_0x5246('0x9f'),'auth':_0x2a5253,'json':!![]};return rp(_0x4ffe58);}})['then'](function(_0x103890){if(_0x103890[_0x5246('0xa0')]['length']>0x0){_0x18b756=_0x103890[_0x5246('0xa0')];}console[_0x5246('0xa1')](_0x5246('0xa2'),_0x18b756);_0x1a9162=[];_0x84be9a=Object[_0x5246('0xa3')]([],_0x18b756);_[_0x5246('0xa4')](_0x84be9a,function(_0x465233){return!_0x4b1cd7['includes'](_0x465233['name']);});_0x84be9a['forEach'](function(_0x44459d){var _0x1c77e9=createFieldObject(_0x36ecca,_0x2a5253,_0x44459d[_0x5246('0xa5')],_0x44459d[_0x5246('0x28')],_0x44459d['label'],![]);_0x1a9162[_0x5246('0xa6')](_0x1c77e9);});return Promise['all'](_0x1a9162);})[_0x5246('0x25')](function(_0x17297b){_0x50502d=_0x17297b;_0x446fd4=Object['assign']([],_0x18b756);console[_0x5246('0xa1')](_0x5246('0xa7'),_0x18b756);_[_0x5246('0xa4')](_0x446fd4,function(_0x1e030b){return _0x4a55d4['includes'](_0x1e030b[_0x5246('0x28')]);});console['log'](_0x5246('0xa8'),_0x446fd4);_0x1a9162=[];_0x446fd4['forEach'](function(_0x463249){var _0x3d17e9=createFieldObject(_0x36ecca,_0x2a5253,_0x463249[_0x5246('0xa5')],_0x463249[_0x5246('0x28')],_0x463249['label'],!![]);_0x1a9162['push'](_0x3d17e9);});return Promise[_0x5246('0xa9')](_0x1a9162);})[_0x5246('0x25')](function(_0x1577bc){_0x3d5cf1=_0x1577bc;var _0x519439=_0x50502d[_0x5246('0xaa')](_0x3d5cf1);return{'count':_0x519439[_0x5246('0x34')],'rows':_0x519439};})['then'](respondWithResult(_0x517492,null))[_0x5246('0x3e')](function(_0xa95d09){console[_0x5246('0xa1')]('ServiceNow\x20error:\x20'+_0xa95d09);var _0x484321=_0x2a5545[_0x5246('0x31')][_0x5246('0xab')]?0x1f4:_0xa95d09[_0x5246('0xac')]||0x1f4;logger[_0x5246('0x26')](_0xa95d09[_0x5246('0x27')]);delete _0xa95d09[_0x5246('0x28')];if(_0x484321===0x191){_0x484321=0x190;}_0x517492[_0x5246('0x1b')](_0x484321)[_0x5246('0xad')](_0x2a5545[_0x5246('0x31')][_0x5246('0xab')]?{'message':_0x5246('0xae'),'statusCode':_0xa95d09[_0x5246('0xac')]}:_0xa95d09);});};function createFieldObject(_0x2771f9,_0x32f79d,_0x37d6ac,_0x54f76b,_0x199ffa,_0x29b43e){return new Promise(function(_0x3b4799,_0x5ab0b7){var _0x10c4e6={'id':_0x54f76b,'name':_0x199ffa,'custom':_0x29b43e};if(_0x37d6ac==='boolean'){_0x10c4e6['options']=[{'name':_0x5246('0xaf'),'value':_0x5246('0xb0')},{'name':'False','value':_0x5246('0xb1')}];_0x3b4799(_0x10c4e6);}else{var _0x5e65a4={'method':_0x5246('0x9e'),'uri':_0x2771f9+_0x5246('0xb2')+_0x54f76b,'auth':_0x32f79d,'json':!![]};return rp(_0x5e65a4)['then'](function(_0x3962d8){var _0x3784dc=[];if(_0x3962d8[_0x5246('0xa0')][_0x5246('0x34')]>0x0){_0x3962d8[_0x5246('0xa0')]['forEach'](function(_0x39bce4){if(_0x39bce4[_0x5246('0xb3')]===_0x5246('0xb1')){var _0x3dd4e4={'name':_0x39bce4[_0x5246('0xb4')],'value':_0x39bce4['value']};_0x3784dc[_0x5246('0xa6')](_0x3dd4e4);}});}_0x10c4e6['options']=_0x3784dc;if(_0x10c4e6[_0x5246('0x3b')][_0x5246('0x34')]>0x0){_0x3b4799(_0x10c4e6);}else{if(_0x29b43e==![]){_0x3b4799();}else{_0x3b4799(_0x10c4e6);}}});}});} \ No newline at end of file +var _0x2447=['forEach','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','all','concat','test','statusCode','Wrong\x20credentials','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','ServicenowAccount','includeAll','findAll','rows','catch','show','params','find','create','body','findOne','order','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','knowledge','subcategory','close_code','notify','incident_state','parent','made_sla','caused_by','watch_list','upon_reject','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','parent_incident','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','sys_tags','escalation','upon_approval','location','category','username','password','email','serverUrl','remoteUri','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','assign','includes'];(function(_0x14a862,_0x2b559d){var _0x245eb5=function(_0x6e014c){while(--_0x6e014c){_0x14a862['push'](_0x14a862['shift']());}};_0x245eb5(++_0x2b559d);}(_0x2447,0x183));var _0x7244=function(_0x4194ca,_0x4282de){_0x4194ca=_0x4194ca-0x0;var _0x30384e=_0x2447[_0x4194ca];return _0x30384e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7244('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7244('0x1'));var rp=require(_0x7244('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7244('0x3'));var util=require(_0x7244('0x4'));var path=require(_0x7244('0x5'));var sox=require(_0x7244('0x6'));var csv=require(_0x7244('0x7'));var ejs=require(_0x7244('0x8'));var fs=require('fs');var fs_extra=require(_0x7244('0x9'));var _=require(_0x7244('0xa'));var squel=require('squel');var crypto=require(_0x7244('0xb'));var jsforce=require(_0x7244('0xc'));var deskjs=require(_0x7244('0xd'));var toCsv=require(_0x7244('0x7'));var querystring=require('querystring');var Papa=require(_0x7244('0xe'));var Redis=require(_0x7244('0xf'));var authService=require(_0x7244('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7244('0x11'));var logger=require(_0x7244('0x12'))(_0x7244('0x13'));var utils=require(_0x7244('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7244('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7244('0x16'));function respondWithStatusCode(_0x5d480c,_0x5e9765){_0x5e9765=_0x5e9765||0xcc;return function(_0x3ecad5){if(_0x3ecad5){return _0x5d480c[_0x7244('0x17')](_0x5e9765);}return _0x5d480c['status'](_0x5e9765)[_0x7244('0x18')]();};}function respondWithResult(_0x503afd,_0x1faa3a){_0x1faa3a=_0x1faa3a||0xc8;return function(_0xc2cb63){if(_0xc2cb63){return _0x503afd[_0x7244('0x19')](_0x1faa3a)[_0x7244('0x1a')](_0xc2cb63);}};}function respondWithFilteredResult(_0x5cb1a4,_0x15bfb3){return function(_0x246ab7){if(_0x246ab7){var _0x1b7ec4=typeof _0x15bfb3[_0x7244('0x1b')]===_0x7244('0x1c')&&typeof _0x15bfb3['limit']===_0x7244('0x1c');var _0x433151=_0x246ab7[_0x7244('0x1d')];var _0x342815=_0x1b7ec4?0x0:_0x15bfb3[_0x7244('0x1b')];var _0x30ac43=_0x1b7ec4?_0x246ab7[_0x7244('0x1d')]:_0x15bfb3['offset']+_0x15bfb3[_0x7244('0x1e')];var _0x2c40d1;if(_0x30ac43>=_0x433151){_0x30ac43=_0x433151;_0x2c40d1=0xc8;}else{_0x2c40d1=0xce;}_0x5cb1a4[_0x7244('0x19')](_0x2c40d1);return _0x5cb1a4[_0x7244('0x1f')](_0x7244('0x20'),_0x342815+'-'+_0x30ac43+'/'+_0x433151)[_0x7244('0x1a')](_0x246ab7);}return null;};}function patchUpdates(_0x2c0888){return function(_0x7cf0f0){try{jsonpatch[_0x7244('0x21')](_0x7cf0f0,_0x2c0888,!![]);}catch(_0x42080f){return BPromise[_0x7244('0x22')](_0x42080f);}return _0x7cf0f0[_0x7244('0x23')]();};}function saveUpdates(_0x2ee5aa,_0x821a33){return function(_0x107ff6){if(_0x107ff6){return _0x107ff6[_0x7244('0x24')](_0x2ee5aa)[_0x7244('0x25')](function(_0x1bebe5){return _0x1bebe5;});}return null;};}function removeEntity(_0x5d50f3,_0x37abb5){return function(_0x26ef79){if(_0x26ef79){return _0x26ef79[_0x7244('0x26')]()[_0x7244('0x25')](function(){_0x5d50f3[_0x7244('0x19')](0xcc)[_0x7244('0x18')]();});}};}function handleEntityNotFound(_0x4b41c1,_0x47dfc8){return function(_0x25e881){if(!_0x25e881){_0x4b41c1[_0x7244('0x17')](0x194);}return _0x25e881;};}function handleError(_0x57352a,_0x1917cc){_0x1917cc=_0x1917cc||0x1f4;return function(_0x3f7a09){logger[_0x7244('0x27')](_0x3f7a09[_0x7244('0x28')]);if(_0x3f7a09[_0x7244('0x29')]){delete _0x3f7a09[_0x7244('0x29')];}_0x57352a[_0x7244('0x19')](_0x1917cc)[_0x7244('0x2a')](_0x3f7a09);};}exports[_0x7244('0x2b')]=function(_0xf0ad0b,_0x45c7d9){var _0x11d288={},_0x3f7ab9={},_0x531403={'count':0x0,'rows':[]};var _0x1f299d=_[_0x7244('0x2c')](db['ServicenowAccount'][_0x7244('0x2d')],function(_0x461417){return{'name':_0x461417[_0x7244('0x2e')],'type':_0x461417[_0x7244('0x2f')]['key']};});_0x3f7ab9[_0x7244('0x30')]=_[_0x7244('0x2c')](_0x1f299d,'name');_0x3f7ab9['query']=_[_0x7244('0x31')](_0xf0ad0b[_0x7244('0x32')]);_0x3f7ab9['filters']=_[_0x7244('0x33')](_0x3f7ab9[_0x7244('0x30')],_0x3f7ab9[_0x7244('0x32')]);_0x11d288[_0x7244('0x34')]=_[_0x7244('0x33')](_0x3f7ab9['model'],qs[_0x7244('0x35')](_0xf0ad0b[_0x7244('0x32')][_0x7244('0x35')]));_0x11d288['attributes']=_0x11d288['attributes'][_0x7244('0x36')]?_0x11d288[_0x7244('0x34')]:_0x3f7ab9['model'];if(!_0xf0ad0b[_0x7244('0x32')][_0x7244('0x37')](_0x7244('0x38'))){_0x11d288['limit']=qs[_0x7244('0x1e')](_0xf0ad0b['query'][_0x7244('0x1e')]);_0x11d288['offset']=qs['offset'](_0xf0ad0b[_0x7244('0x32')]['offset']);}_0x11d288['order']=qs['sort'](_0xf0ad0b['query'][_0x7244('0x39')]);_0x11d288[_0x7244('0x3a')]=qs[_0x7244('0x3b')](_['pick'](_0xf0ad0b['query'],_0x3f7ab9[_0x7244('0x3b')]),_0x1f299d);if(_0xf0ad0b[_0x7244('0x32')][_0x7244('0x3c')]){_0x11d288[_0x7244('0x3a')]=_[_0x7244('0x3d')](_0x11d288[_0x7244('0x3a')],{'$or':_[_0x7244('0x2c')](_0x1f299d,function(_0x42d338){if(_0x42d338[_0x7244('0x2f')]!=='VIRTUAL'){var _0x8c1276={};_0x8c1276[_0x42d338['name']]={'$like':'%'+_0xf0ad0b[_0x7244('0x32')]['filter']+'%'};return _0x8c1276;}})});}_0x11d288=_[_0x7244('0x3d')]({},_0x11d288,_0xf0ad0b[_0x7244('0x3e')]);var _0x447856={'where':_0x11d288['where']};return db[_0x7244('0x3f')][_0x7244('0x1d')](_0x447856)[_0x7244('0x25')](function(_0x143086){_0x531403[_0x7244('0x1d')]=_0x143086;if(_0xf0ad0b[_0x7244('0x32')][_0x7244('0x40')]){_0x11d288['include']=[{'all':!![]}];}return db[_0x7244('0x3f')][_0x7244('0x41')](_0x11d288);})[_0x7244('0x25')](function(_0x12377c){_0x531403[_0x7244('0x42')]=_0x12377c;return _0x531403;})[_0x7244('0x25')](respondWithFilteredResult(_0x45c7d9,_0x11d288))[_0x7244('0x43')](handleError(_0x45c7d9,null));};exports[_0x7244('0x44')]=function(_0x12d087,_0x5be0a3){var _0x14ee40={'raw':![],'where':{'id':_0x12d087[_0x7244('0x45')]['id']}},_0x2be792={};_0x2be792[_0x7244('0x30')]=_['keys'](db['ServicenowAccount']['rawAttributes']);_0x2be792[_0x7244('0x32')]=_[_0x7244('0x31')](_0x12d087[_0x7244('0x32')]);_0x2be792[_0x7244('0x3b')]=_[_0x7244('0x33')](_0x2be792['model'],_0x2be792[_0x7244('0x32')]);_0x14ee40[_0x7244('0x34')]=_[_0x7244('0x33')](_0x2be792['model'],qs[_0x7244('0x35')](_0x12d087[_0x7244('0x32')][_0x7244('0x35')]));_0x14ee40['attributes']=_0x14ee40[_0x7244('0x34')]['length']?_0x14ee40[_0x7244('0x34')]:_0x2be792[_0x7244('0x30')];if(_0x12d087[_0x7244('0x32')][_0x7244('0x40')]){_0x14ee40['include']=[{'all':!![]}];}_0x14ee40=_['merge']({},_0x14ee40,_0x12d087[_0x7244('0x3e')]);return db[_0x7244('0x3f')][_0x7244('0x46')](_0x14ee40)[_0x7244('0x25')](handleEntityNotFound(_0x5be0a3,null))[_0x7244('0x25')](respondWithResult(_0x5be0a3,null))[_0x7244('0x43')](handleError(_0x5be0a3,null));};exports[_0x7244('0x47')]=function(_0x59109d,_0x38caab){return db[_0x7244('0x3f')][_0x7244('0x47')](_0x59109d['body'],{})[_0x7244('0x25')](respondWithResult(_0x38caab,0xc9))[_0x7244('0x43')](handleError(_0x38caab,null));};exports[_0x7244('0x24')]=function(_0x14071b,_0x3c3734){if(_0x14071b['body']['id']){delete _0x14071b['body']['id'];}return db['ServicenowAccount'][_0x7244('0x46')]({'where':{'id':_0x14071b['params']['id']}})['then'](handleEntityNotFound(_0x3c3734,null))[_0x7244('0x25')](saveUpdates(_0x14071b[_0x7244('0x48')],null))[_0x7244('0x25')](respondWithResult(_0x3c3734,null))[_0x7244('0x43')](handleError(_0x3c3734,null));};exports[_0x7244('0x26')]=function(_0x3e37d4,_0x27179e){return db[_0x7244('0x3f')][_0x7244('0x46')]({'where':{'id':_0x3e37d4['params']['id']}})[_0x7244('0x25')](handleEntityNotFound(_0x27179e,null))[_0x7244('0x25')](removeEntity(_0x27179e,null))[_0x7244('0x43')](handleError(_0x27179e,null));};exports['getConfigurations']=function(_0x29a2dd,_0x4e9d4d,_0x366f52){var _0x476ad1={};var _0x373c60={};var _0x3c13e8;var _0xfb09f6;return db[_0x7244('0x3f')][_0x7244('0x49')]({'where':{'id':_0x29a2dd[_0x7244('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e9d4d,null))[_0x7244('0x25')](function(_0x5237d9){if(_0x5237d9){_0x3c13e8=_0x5237d9;_0x373c60[_0x7244('0x30')]=_[_0x7244('0x31')](db['ServicenowConfiguration'][_0x7244('0x2d')]);_0x373c60['query']=_[_0x7244('0x31')](_0x29a2dd[_0x7244('0x32')]);_0x373c60[_0x7244('0x3b')]=_['intersection'](_0x373c60[_0x7244('0x30')],_0x373c60['query']);_0x476ad1[_0x7244('0x34')]=_['intersection'](_0x373c60['model'],qs['fields'](_0x29a2dd[_0x7244('0x32')][_0x7244('0x35')]));_0x476ad1[_0x7244('0x34')]=_0x476ad1[_0x7244('0x34')][_0x7244('0x36')]?_0x476ad1[_0x7244('0x34')]:_0x373c60[_0x7244('0x30')];_0x476ad1[_0x7244('0x4a')]=qs[_0x7244('0x39')](_0x29a2dd['query'][_0x7244('0x39')]);_0x476ad1[_0x7244('0x3a')]=qs[_0x7244('0x3b')](_['pick'](_0x29a2dd['query'],_0x373c60[_0x7244('0x3b')]));if(_0x29a2dd[_0x7244('0x32')][_0x7244('0x3c')]){_0x476ad1['where']=_[_0x7244('0x3d')](_0x476ad1[_0x7244('0x3a')],{'$or':_['map'](_0x476ad1[_0x7244('0x34')],function(_0xd2d9aa){var _0x12bcfa={};_0x12bcfa[_0xd2d9aa]={'$like':'%'+_0x29a2dd[_0x7244('0x32')][_0x7244('0x3c')]+'%'};return _0x12bcfa;})});}_0x476ad1=_['merge']({},_0x476ad1,_0x29a2dd[_0x7244('0x3e')]);return _0x3c13e8[_0x7244('0x4b')](_0x476ad1);}})['then'](function(_0x13b099){if(_0x13b099){_0xfb09f6=_0x13b099[_0x7244('0x36')];if(!_0x29a2dd[_0x7244('0x32')][_0x7244('0x37')](_0x7244('0x38'))){_0x476ad1['limit']=qs[_0x7244('0x1e')](_0x29a2dd[_0x7244('0x32')][_0x7244('0x1e')]);_0x476ad1[_0x7244('0x1b')]=qs[_0x7244('0x1b')](_0x29a2dd[_0x7244('0x32')][_0x7244('0x1b')]);}return _0x3c13e8['getConfigurations'](_0x476ad1);}})[_0x7244('0x25')](function(_0x4a4e02){if(_0x4a4e02){return _0x4a4e02?{'count':_0xfb09f6,'rows':_0x4a4e02}:null;}})[_0x7244('0x25')](respondWithResult(_0x4e9d4d,null))[_0x7244('0x43')](handleError(_0x4e9d4d,null));};exports[_0x7244('0x4c')]=function(_0xdd460c,_0x23ae18,_0x335784){if(_0xdd460c[_0x7244('0x48')]['id']){delete _0xdd460c[_0x7244('0x48')]['id'];}return db[_0x7244('0x3f')]['findOne']({'where':{'id':_0xdd460c[_0x7244('0x45')]['id']}})['then'](handleEntityNotFound(_0x23ae18,null))[_0x7244('0x25')](function(_0xcfa0a9){if(_0xcfa0a9){_0xdd460c[_0x7244('0x48')][_0x7244('0x4d')]=_0xcfa0a9['id'];_0xdd460c[_0x7244('0x48')][_0x7244('0x4e')]=integrations[_0x7244('0x4f')](_0xdd460c['body'][_0x7244('0x50')],_0xdd460c['body'][_0x7244('0x2f')]);_0xdd460c[_0x7244('0x48')][_0x7244('0x51')]=integrations[_0x7244('0x52')](_0xdd460c['body']['channel'],_0xdd460c['body'][_0x7244('0x2f')]);return db[_0x7244('0x53')]['create'](_0xdd460c['body'],{'include':[{'model':db[_0x7244('0x54')],'as':_0x7244('0x4e')},{'model':db['ServicenowField'],'as':_0x7244('0x51')}]});}return null;})[_0x7244('0x25')](respondWithResult(_0x23ae18,null))[_0x7244('0x43')](handleError(_0x23ae18,null));};exports[_0x7244('0x55')]=function(_0x37a853,_0x52b245,_0x4364f6){var _0xa81c5a=['made_sla','hold_reason',_0x7244('0x56'),_0x7244('0x57'),_0x7244('0x58'),_0x7244('0x59'),_0x7244('0x5a'),'severity','category'];var _0x1555e3=[_0x7244('0x5b'),_0x7244('0x5c'),_0x7244('0x5d'),_0x7244('0x5e'),_0x7244('0x5f'),'sys_updated_on','child_incidents','hold_reason',_0x7244('0x60'),_0x7244('0x61'),_0x7244('0x62'),_0x7244('0x63'),_0x7244('0x64'),_0x7244('0x65'),_0x7244('0x66'),_0x7244('0x67'),_0x7244('0x68'),_0x7244('0x69'),_0x7244('0x56'),_0x7244('0x4a'),_0x7244('0x6a'),_0x7244('0x6b'),_0x7244('0x6c'),_0x7244('0x6d'),_0x7244('0x6e'),_0x7244('0x6f'),_0x7244('0x70'),_0x7244('0x71'),_0x7244('0x72'),'sys_domain_path','rfc',_0x7244('0x73'),_0x7244('0x74'),_0x7244('0x75'),_0x7244('0x76'),'group_list',_0x7244('0x77'),_0x7244('0x78'),_0x7244('0x79'),'caller_id',_0x7244('0x7a'),_0x7244('0x57'),_0x7244('0x7b'),_0x7244('0x7c'),'close_code',_0x7244('0x7d'),_0x7244('0x7e'),_0x7244('0x7f'),'assignment_group',_0x7244('0x80'),_0x7244('0x81'),_0x7244('0x82'),_0x7244('0x83'),'notify',_0x7244('0x84'),_0x7244('0x85'),'closed_by','follow_up',_0x7244('0x86'),'sys_id',_0x7244('0x87'),_0x7244('0x88'),_0x7244('0x5a'),_0x7244('0x89'),_0x7244('0x8a'),'company',_0x7244('0x8b'),_0x7244('0x8c'),_0x7244('0x8d'),_0x7244('0x8e'),_0x7244('0x8f'),_0x7244('0x90'),_0x7244('0x91'),_0x7244('0x92'),'due_date','sys_mod_count','reopen_count',_0x7244('0x93'),_0x7244('0x94'),_0x7244('0x95'),'correlation_id',_0x7244('0x96'),_0x7244('0x97')];var _0x332e62='';var _0x51d5b7='';var _0x4df895=[];var _0x23b841='';var _0x349c2e='';var _0x5582a2=[];var _0x3e14de='';var _0x515a92='';var _0x99a134={};var _0x17d363='';return db[_0x7244('0x3f')][_0x7244('0x49')]({'where':{'id':_0x37a853[_0x7244('0x45')]['id']},'attributes':['id',_0x7244('0x98'),_0x7244('0x99'),_0x7244('0x9a'),'remoteUri',_0x7244('0x9b')]})['then'](handleEntityNotFound(_0x52b245,null))['then'](function(_0x42c4cc){if(_0x42c4cc){_0x17d363=_0x42c4cc[_0x7244('0x9c')];var _0x2dea3e=_0x17d363[_0x7244('0x9d')](-0x1);if(_0x2dea3e==='/'){_0x17d363=_0x17d363['substring'](0x0,_0x17d363[_0x7244('0x9e')](_0x2dea3e));}_0x515a92=util[_0x7244('0x9f')](_0x7244('0xa0'),_0x17d363);_0x3e14de=util[_0x7244('0x9f')](_0x7244('0xa1'),_0x17d363);_0x99a134={'user':_0x42c4cc['username'],'pass':_0x42c4cc[_0x7244('0x99')]};var _0x8e7c82={'method':_0x7244('0xa2'),'uri':_0x515a92+_0x7244('0xa3'),'auth':_0x99a134,'json':!![]};return rp(_0x8e7c82);}})[_0x7244('0x25')](function(_0x3f54be){if(_0x3f54be[_0x7244('0xa4')]['length']>0x0){_0x332e62=_0x3f54be[_0x7244('0xa4')];}console[_0x7244('0xa5')]('incident\x20table\x20objects',_0x332e62);_0x5582a2=[];_0x51d5b7=Object[_0x7244('0xa6')]([],_0x332e62);_['remove'](_0x51d5b7,function(_0x5dd8d4){return!_0xa81c5a[_0x7244('0xa7')](_0x5dd8d4[_0x7244('0x29')]);});_0x51d5b7[_0x7244('0xa8')](function(_0x5c62da){var _0x71afe7=createFieldObject(_0x3e14de,_0x99a134,_0x5c62da['internalType'],_0x5c62da[_0x7244('0x29')],_0x5c62da[_0x7244('0xa9')],![]);_0x5582a2[_0x7244('0xaa')](_0x71afe7);});return Promise['all'](_0x5582a2);})[_0x7244('0x25')](function(_0x5166b0){_0x4df895=_0x5166b0;_0x23b841=Object['assign']([],_0x332e62);console['log'](_0x7244('0xab'),_0x332e62);_['remove'](_0x23b841,function(_0x437ddc){return _0x1555e3[_0x7244('0xa7')](_0x437ddc[_0x7244('0x29')]);});console[_0x7244('0xa5')](_0x7244('0xac'),_0x23b841);_0x5582a2=[];_0x23b841[_0x7244('0xa8')](function(_0xb6636d){var _0x264f7b=createFieldObject(_0x3e14de,_0x99a134,_0xb6636d[_0x7244('0xad')],_0xb6636d[_0x7244('0x29')],_0xb6636d[_0x7244('0xa9')],!![]);_0x5582a2[_0x7244('0xaa')](_0x264f7b);});return Promise[_0x7244('0xae')](_0x5582a2);})[_0x7244('0x25')](function(_0x2a7a4e){_0x349c2e=_0x2a7a4e;var _0x204cdf=_0x4df895[_0x7244('0xaf')](_0x349c2e);return{'count':_0x204cdf['length'],'rows':_0x204cdf};})['then'](respondWithResult(_0x52b245,null))['catch'](function(_0x28015b){console[_0x7244('0xa5')]('ServiceNow\x20error:\x20'+_0x28015b);var _0x37061f=_0x37a853[_0x7244('0x32')][_0x7244('0xb0')]?0x1f4:_0x28015b[_0x7244('0xb1')]||0x1f4;logger[_0x7244('0x27')](_0x28015b[_0x7244('0x28')]);delete _0x28015b[_0x7244('0x29')];if(_0x37061f===0x191){_0x37061f=0x190;}_0x52b245[_0x7244('0x19')](_0x37061f)[_0x7244('0x2a')](_0x37a853['query'][_0x7244('0xb0')]?{'message':_0x7244('0xb2'),'statusCode':_0x28015b[_0x7244('0xb1')]}:_0x28015b);});};function createFieldObject(_0x4c344f,_0x1b2dac,_0x5b15ab,_0x29b699,_0x597fad,_0x3d1493){return new Promise(function(_0x290f8e,_0x19e2d8){var _0x2ac0e4={'id':_0x29b699,'name':_0x597fad,'custom':_0x3d1493};if(_0x5b15ab==='boolean'){_0x2ac0e4['options']=[{'name':_0x7244('0xb3'),'value':_0x7244('0xb4')},{'name':_0x7244('0xb5'),'value':_0x7244('0xb6')}];_0x290f8e(_0x2ac0e4);}else{var _0x40f552={'method':_0x7244('0xa2'),'uri':_0x4c344f+_0x7244('0xb7')+_0x29b699,'auth':_0x1b2dac,'json':!![]};return rp(_0x40f552)[_0x7244('0x25')](function(_0x561d58){var _0xb8580b=[];if(_0x561d58['result']['length']>0x0){_0x561d58[_0x7244('0xa4')][_0x7244('0xa8')](function(_0x2d5402){if(_0x2d5402['inactive']==='false'){var _0x3ecf71={'name':_0x2d5402[_0x7244('0xa9')],'value':_0x2d5402[_0x7244('0xb8')]};_0xb8580b[_0x7244('0xaa')](_0x3ecf71);}});}_0x2ac0e4[_0x7244('0x3e')]=_0xb8580b;if(_0x2ac0e4['options'][_0x7244('0x36')]>0x0){_0x290f8e(_0x2ac0e4);}else{if(_0x3d1493==![]){_0x290f8e();}else{_0x290f8e(_0x2ac0e4);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 842a6ff..e2561ab 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 _0xeff8=['rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','int_servicenow_accounts','lodash','util','api','moment','bluebird','path'];(function(_0x240c03,_0x132524){var _0x455f30=function(_0x4912f4){while(--_0x4912f4){_0x240c03['push'](_0x240c03['shift']());}};_0x455f30(++_0x132524);}(_0xeff8,0x186));var _0x8eff=function(_0x4fbb15,_0x21be0c){_0x4fbb15=_0x4fbb15-0x0;var _0x436338=_0xeff8[_0x4fbb15];return _0x436338;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x8eff('0x9')]=function(_0xb54063,_0x3409bc){return _0xb54063[_0x8eff('0xa')]('ServicenowAccount',attributes,{'tableName':_0x8eff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x687b=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x2d07d6,_0x1c84cb){var _0x2524d2=function(_0x13f4e6){while(--_0x13f4e6){_0x2d07d6['push'](_0x2d07d6['shift']());}};_0x2524d2(++_0x1c84cb);}(_0x687b,0x14a));var _0xb687=function(_0x2ac8f0,_0x21d3df){_0x2ac8f0=_0x2ac8f0-0x0;var _0x4e9e93=_0x687b[_0x2ac8f0];return _0x4e9e93;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));var integrations=require(_0xb687('0x9'));module[_0xb687('0xa')]=function(_0xf43a1f,_0x47ffea){return _0xf43a1f[_0xb687('0xb')]('ServicenowAccount',attributes,{'tableName':_0xb687('0xc'),'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 8a5023c..e384187 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 _0x2c45=['options','raw','where','include','model','map','attributes','then','catch','ShowServicenowAccount','find','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetServicenowAccount','ServicenowAccount','findAll'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x2c45,0x8f));var _0x52c4=function(_0x9e191f,_0x9af4a8){_0x9e191f=_0x9e191f-0x0;var _0x35edce=_0x2c45[_0x9e191f];return _0x35edce;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x52c4('0x0'));var rs=require(_0x52c4('0x1'));var fs=require('fs');var Redis=require(_0x52c4('0x2'));var db=require(_0x52c4('0x3'))['db'];var utils=require(_0x52c4('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x52c4('0x5'));var client=jayson[_0x52c4('0x6')][_0x52c4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x364233,_0xbdd193,_0x10669c){return new BPromise(function(_0x21218c,_0x1e976d){return client[_0x52c4('0x8')](_0x364233,_0x10669c)['then'](function(_0x3d2b70){logger[_0x52c4('0x9')](_0x52c4('0xa'),_0xbdd193,_0x52c4('0xb'));logger[_0x52c4('0xc')](_0x52c4('0xd'),_0xbdd193,_0x52c4('0xb'),JSON[_0x52c4('0xe')](_0x3d2b70));if(_0x3d2b70[_0x52c4('0xf')]){if(_0x3d2b70[_0x52c4('0xf')][_0x52c4('0x10')]===0x1f4){logger[_0x52c4('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0xbdd193,_0x3d2b70[_0x52c4('0xf')][_0x52c4('0x11')]);return _0x1e976d(_0x3d2b70[_0x52c4('0xf')][_0x52c4('0x11')]);}logger[_0x52c4('0xf')](_0x52c4('0xa'),_0xbdd193,_0x3d2b70[_0x52c4('0xf')][_0x52c4('0x11')]);return _0x21218c(_0x3d2b70[_0x52c4('0xf')][_0x52c4('0x11')]);}else{logger[_0x52c4('0x9')](_0x52c4('0xa'),_0xbdd193,_0x52c4('0xb'));_0x21218c(_0x3d2b70[_0x52c4('0x12')][_0x52c4('0x11')]);}})['catch'](function(_0x4b55d0){logger[_0x52c4('0xf')](_0x52c4('0xa'),_0xbdd193,_0x4b55d0);_0x1e976d(_0x4b55d0);});});}exports[_0x52c4('0x13')]=function(_0xdc7e0a){var _0x1636ba=this;return new Promise(function(_0x277556,_0x445254){return db[_0x52c4('0x14')][_0x52c4('0x15')]({'raw':_0xdc7e0a[_0x52c4('0x16')]?_0xdc7e0a[_0x52c4('0x16')][_0x52c4('0x17')]===undefined?!![]:![]:!![],'where':_0xdc7e0a[_0x52c4('0x16')]?_0xdc7e0a[_0x52c4('0x16')][_0x52c4('0x18')]||null:null,'attributes':_0xdc7e0a[_0x52c4('0x16')]?_0xdc7e0a[_0x52c4('0x16')]['attributes']||null:null,'limit':_0xdc7e0a['options']?_0xdc7e0a[_0x52c4('0x16')]['limit']||null:null,'include':_0xdc7e0a[_0x52c4('0x16')]?_0xdc7e0a[_0x52c4('0x16')]['include']?_['map'](_0xdc7e0a[_0x52c4('0x16')][_0x52c4('0x19')],function(_0x45191d){return{'model':db[_0x45191d[_0x52c4('0x1a')]],'as':_0x45191d['as'],'attributes':_0x45191d['attributes'],'include':_0x45191d[_0x52c4('0x19')]?_[_0x52c4('0x1b')](_0x45191d[_0x52c4('0x19')],function(_0x167b47){return{'model':db[_0x167b47['model']],'as':_0x167b47['as'],'attributes':_0x167b47[_0x52c4('0x1c')],'include':_0x167b47[_0x52c4('0x19')]?_['map'](_0x167b47[_0x52c4('0x19')],function(_0x44d193){return{'model':db[_0x44d193[_0x52c4('0x1a')]],'as':_0x44d193['as'],'attributes':_0x44d193[_0x52c4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x52c4('0x1d')](function(_0x1bf5ee){logger[_0x52c4('0x9')](_0x52c4('0x13'),_0xdc7e0a);logger['debug'](_0x52c4('0x13'),_0xdc7e0a,JSON[_0x52c4('0xe')](_0x1bf5ee));_0x277556(_0x1bf5ee);})[_0x52c4('0x1e')](function(_0x4069d7){logger['error'](_0x52c4('0x13'),_0x4069d7[_0x52c4('0x11')],_0xdc7e0a);_0x445254(_0x1636ba[_0x52c4('0xf')](0x1f4,_0x4069d7[_0x52c4('0x11')]));});});};exports[_0x52c4('0x1f')]=function(_0x12fb24){var _0x269b60=this;return new Promise(function(_0x53c578,_0x4be2e2){return db[_0x52c4('0x14')][_0x52c4('0x20')]({'raw':_0x12fb24[_0x52c4('0x16')]?_0x12fb24[_0x52c4('0x16')][_0x52c4('0x17')]===undefined?!![]:![]:!![],'where':_0x12fb24[_0x52c4('0x16')]?_0x12fb24[_0x52c4('0x16')][_0x52c4('0x18')]||null:null,'attributes':_0x12fb24[_0x52c4('0x16')]?_0x12fb24[_0x52c4('0x16')][_0x52c4('0x1c')]||null:null,'include':_0x12fb24[_0x52c4('0x16')]?_0x12fb24[_0x52c4('0x16')][_0x52c4('0x19')]?_['map'](_0x12fb24[_0x52c4('0x16')][_0x52c4('0x19')],function(_0xfcc16c){return{'model':db[_0xfcc16c[_0x52c4('0x1a')]],'as':_0xfcc16c['as'],'attributes':_0xfcc16c['attributes'],'include':_0xfcc16c['include']?_[_0x52c4('0x1b')](_0xfcc16c['include'],function(_0x3d3c0f){return{'model':db[_0x3d3c0f[_0x52c4('0x1a')]],'as':_0x3d3c0f['as'],'attributes':_0x3d3c0f[_0x52c4('0x1c')],'include':_0x3d3c0f[_0x52c4('0x19')]?_[_0x52c4('0x1b')](_0x3d3c0f[_0x52c4('0x19')],function(_0x2951cc){return{'model':db[_0x2951cc[_0x52c4('0x1a')]],'as':_0x2951cc['as'],'attributes':_0x2951cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x52c4('0x1d')](function(_0x1cbf22){logger[_0x52c4('0x9')](_0x52c4('0x1f'),_0x12fb24);logger['debug'](_0x52c4('0x1f'),_0x12fb24,JSON['stringify'](_0x1cbf22));_0x53c578(_0x1cbf22);})[_0x52c4('0x1e')](function(_0x3108e9){logger[_0x52c4('0xf')]('ShowServicenowAccount',_0x3108e9['message'],_0x12fb24);_0x4be2e2(_0x269b60[_0x52c4('0xf')](0x1f4,_0x3108e9[_0x52c4('0x11')]));});});}; \ No newline at end of file +var _0xdff6=['attributes','map','include','model','catch','ShowServicenowAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw'];(function(_0x4ddab4,_0xc8a37e){var _0x1bddbb=function(_0x101608){while(--_0x101608){_0x4ddab4['push'](_0x4ddab4['shift']());}};_0x1bddbb(++_0xc8a37e);}(_0xdff6,0x199));var _0x6dff=function(_0x48c8e4,_0x3cba6f){_0x48c8e4=_0x48c8e4-0x0;var _0x43a82c=_0xdff6[_0x48c8e4];return _0x43a82c;};'use strict';var _=require(_0x6dff('0x0'));var util=require(_0x6dff('0x1'));var moment=require(_0x6dff('0x2'));var BPromise=require('bluebird');var rs=require(_0x6dff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6dff('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6dff('0x5'))(_0x6dff('0x6'));var config=require(_0x6dff('0x7'));var jayson=require(_0x6dff('0x8'));var client=jayson['client'][_0x6dff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ac6f1,_0x3e10ee,_0x38898f){return new BPromise(function(_0x1ad019,_0x463c63){return client[_0x6dff('0xa')](_0x2ac6f1,_0x38898f)[_0x6dff('0xb')](function(_0x2ededc){logger[_0x6dff('0xc')](_0x6dff('0xd'),_0x3e10ee,'request\x20sent');logger[_0x6dff('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x3e10ee,_0x6dff('0xf'),JSON[_0x6dff('0x10')](_0x2ededc));if(_0x2ededc[_0x6dff('0x11')]){if(_0x2ededc['error']['code']===0x1f4){logger['error'](_0x6dff('0xd'),_0x3e10ee,_0x2ededc[_0x6dff('0x11')][_0x6dff('0x12')]);return _0x463c63(_0x2ededc[_0x6dff('0x11')][_0x6dff('0x12')]);}logger[_0x6dff('0x11')](_0x6dff('0xd'),_0x3e10ee,_0x2ededc[_0x6dff('0x11')]['message']);return _0x1ad019(_0x2ededc['error'][_0x6dff('0x12')]);}else{logger[_0x6dff('0xc')](_0x6dff('0xd'),_0x3e10ee,_0x6dff('0xf'));_0x1ad019(_0x2ededc[_0x6dff('0x13')][_0x6dff('0x12')]);}})['catch'](function(_0x2543ae){logger['error'](_0x6dff('0xd'),_0x3e10ee,_0x2543ae);_0x463c63(_0x2543ae);});});}exports[_0x6dff('0x14')]=function(_0x6b9f08){var _0x2cd6a7=this;return new Promise(function(_0x55c78c,_0x5435ae){return db[_0x6dff('0x15')][_0x6dff('0x16')]({'raw':_0x6b9f08[_0x6dff('0x17')]?_0x6b9f08[_0x6dff('0x17')][_0x6dff('0x18')]===undefined?!![]:![]:!![],'where':_0x6b9f08[_0x6dff('0x17')]?_0x6b9f08[_0x6dff('0x17')]['where']||null:null,'attributes':_0x6b9f08[_0x6dff('0x17')]?_0x6b9f08[_0x6dff('0x17')][_0x6dff('0x19')]||null:null,'limit':_0x6b9f08[_0x6dff('0x17')]?_0x6b9f08[_0x6dff('0x17')]['limit']||null:null,'include':_0x6b9f08[_0x6dff('0x17')]?_0x6b9f08['options']['include']?_[_0x6dff('0x1a')](_0x6b9f08[_0x6dff('0x17')][_0x6dff('0x1b')],function(_0x4f49be){return{'model':db[_0x4f49be[_0x6dff('0x1c')]],'as':_0x4f49be['as'],'attributes':_0x4f49be['attributes'],'include':_0x4f49be[_0x6dff('0x1b')]?_[_0x6dff('0x1a')](_0x4f49be[_0x6dff('0x1b')],function(_0x2328e3){return{'model':db[_0x2328e3[_0x6dff('0x1c')]],'as':_0x2328e3['as'],'attributes':_0x2328e3[_0x6dff('0x19')],'include':_0x2328e3[_0x6dff('0x1b')]?_[_0x6dff('0x1a')](_0x2328e3[_0x6dff('0x1b')],function(_0x265fbc){return{'model':db[_0x265fbc['model']],'as':_0x265fbc['as'],'attributes':_0x265fbc[_0x6dff('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x179307){logger['info']('GetServicenowAccount',_0x6b9f08);logger[_0x6dff('0xe')]('GetServicenowAccount',_0x6b9f08,JSON['stringify'](_0x179307));_0x55c78c(_0x179307);})[_0x6dff('0x1d')](function(_0x2b1984){logger[_0x6dff('0x11')](_0x6dff('0x14'),_0x2b1984[_0x6dff('0x12')],_0x6b9f08);_0x5435ae(_0x2cd6a7['error'](0x1f4,_0x2b1984[_0x6dff('0x12')]));});});};exports[_0x6dff('0x1e')]=function(_0x43f2ca){var _0x5878e8=this;return new Promise(function(_0x43cedb,_0x520876){return db[_0x6dff('0x15')]['find']({'raw':_0x43f2ca[_0x6dff('0x17')]?_0x43f2ca[_0x6dff('0x17')][_0x6dff('0x18')]===undefined?!![]:![]:!![],'where':_0x43f2ca[_0x6dff('0x17')]?_0x43f2ca[_0x6dff('0x17')]['where']||null:null,'attributes':_0x43f2ca[_0x6dff('0x17')]?_0x43f2ca['options']['attributes']||null:null,'include':_0x43f2ca[_0x6dff('0x17')]?_0x43f2ca[_0x6dff('0x17')]['include']?_[_0x6dff('0x1a')](_0x43f2ca['options']['include'],function(_0x20eb63){return{'model':db[_0x20eb63['model']],'as':_0x20eb63['as'],'attributes':_0x20eb63[_0x6dff('0x19')],'include':_0x20eb63[_0x6dff('0x1b')]?_['map'](_0x20eb63[_0x6dff('0x1b')],function(_0x508654){return{'model':db[_0x508654[_0x6dff('0x1c')]],'as':_0x508654['as'],'attributes':_0x508654[_0x6dff('0x19')],'include':_0x508654['include']?_[_0x6dff('0x1a')](_0x508654['include'],function(_0x52743f){return{'model':db[_0x52743f['model']],'as':_0x52743f['as'],'attributes':_0x52743f[_0x6dff('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6dff('0xb')](function(_0x4d4f1c){logger[_0x6dff('0xc')]('ShowServicenowAccount',_0x43f2ca);logger[_0x6dff('0xe')](_0x6dff('0x1e'),_0x43f2ca,JSON['stringify'](_0x4d4f1c));_0x43cedb(_0x4d4f1c);})[_0x6dff('0x1d')](function(_0x5bb886){logger['error'](_0x6dff('0x1e'),_0x5bb886[_0x6dff('0x12')],_0x43f2ca);_0x520876(_0x5878e8[_0x6dff('0x11')](0x1f4,_0x5bb886['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 35c2b39..40e3ae2 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 _0xff34=['util','connect-timeout','express','fs-extra','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','update','delete','destroy','exports'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0xff34,0xf7));var _0x4ff3=function(_0x2bcf5e,_0x5d9059){_0x2bcf5e=_0x2bcf5e-0x0;var _0x94e486=_0xff34[_0x2bcf5e];return _0x94e486;};'use strict';var multer=require('multer');var util=require(_0x4ff3('0x0'));var path=require('path');var timeout=require(_0x4ff3('0x1'));var express=require(_0x4ff3('0x2'));var router=express['Router']();var fs_extra=require(_0x4ff3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4ff3('0x4'));var config=require('../../config/environment');var controller=require(_0x4ff3('0x5'));router[_0x4ff3('0x6')]('/',auth[_0x4ff3('0x7')](),controller[_0x4ff3('0x8')]);router['get'](_0x4ff3('0x9'),auth[_0x4ff3('0x7')](),controller[_0x4ff3('0xa')]);router[_0x4ff3('0x6')](_0x4ff3('0xb'),auth[_0x4ff3('0x7')](),controller['getFields']);router['get'](_0x4ff3('0xc'),auth[_0x4ff3('0x7')](),controller['getSubjects']);router['get'](_0x4ff3('0xd'),auth[_0x4ff3('0x7')](),controller[_0x4ff3('0xe')]);router['post']('/',auth[_0x4ff3('0x7')](),controller['create']);router['put']('/:id',auth[_0x4ff3('0x7')](),controller[_0x4ff3('0xf')]);router[_0x4ff3('0x10')](_0x4ff3('0x9'),auth[_0x4ff3('0x7')](),controller[_0x4ff3('0x11')]);module[_0x4ff3('0x12')]=router; \ No newline at end of file +var _0xb629=['post','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/descriptions','getDescriptions'];(function(_0x29f476,_0x2db883){var _0x18ded1=function(_0x221cc6){while(--_0x221cc6){_0x29f476['push'](_0x29f476['shift']());}};_0x18ded1(++_0x2db883);}(_0xb629,0xf9));var _0x9b62=function(_0x4e09e2,_0x84e11c){_0x4e09e2=_0x4e09e2-0x0;var _0x26b18f=_0xb629[_0x4e09e2];return _0x26b18f;};'use strict';var multer=require(_0x9b62('0x0'));var util=require(_0x9b62('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9b62('0x2'));var router=express[_0x9b62('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9b62('0x4'));var interaction=require(_0x9b62('0x5'));var config=require(_0x9b62('0x6'));var controller=require(_0x9b62('0x7'));router[_0x9b62('0x8')]('/',auth[_0x9b62('0x9')](),controller[_0x9b62('0xa')]);router[_0x9b62('0x8')](_0x9b62('0xb'),auth[_0x9b62('0x9')](),controller['show']);router[_0x9b62('0x8')](_0x9b62('0xc'),auth[_0x9b62('0x9')](),controller['getFields']);router[_0x9b62('0x8')]('/:id/subjects',auth[_0x9b62('0x9')](),controller['getSubjects']);router['get'](_0x9b62('0xd'),auth[_0x9b62('0x9')](),controller[_0x9b62('0xe')]);router[_0x9b62('0xf')]('/',auth[_0x9b62('0x9')](),controller[_0x9b62('0x10')]);router[_0x9b62('0x11')](_0x9b62('0xb'),auth[_0x9b62('0x9')](),controller[_0x9b62('0x12')]);router[_0x9b62('0x13')](_0x9b62('0xb'),auth[_0x9b62('0x9')](),controller[_0x9b62('0x14')]);module[_0x9b62('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 422bcdc..ca3b95c 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 _0x68f1=['STRING','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x68f1,0x1c5));var _0x168f=function(_0xa8e125,_0x447e2a){_0xa8e125=_0xa8e125-0x0;var _0x279b67=_0x68f1[_0xa8e125];return _0x279b67;};'use strict';var Sequelize=require('sequelize');module[_0x168f('0x0')]={'name':{'type':Sequelize[_0x168f('0x1')]},'description':{'type':Sequelize[_0x168f('0x1')]}}; \ No newline at end of file +var _0xeb31=['exports','STRING','sequelize'];(function(_0x1b49f7,_0x3c318b){var _0x5e8481=function(_0x1f4075){while(--_0x1f4075){_0x1b49f7['push'](_0x1b49f7['shift']());}};_0x5e8481(++_0x3c318b);}(_0xeb31,0xd4));var _0x1eb3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb31[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1eb3('0x0'));module[_0x1eb3('0x1')]={'name':{'type':Sequelize[_0x1eb3('0x2')]},'description':{'type':Sequelize[_0x1eb3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 0193b55..2ae3af9 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 _0x4000=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','reject','destroy','sendStatus','error','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','query','keys','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','findAll','rows','catch','show','params','intersection','include','find','create','body','update','getFields','findOne','ServicenowField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x17c7eb,_0x875de0){var _0x5f548e=function(_0xfb4ef){while(--_0xfb4ef){_0x17c7eb['push'](_0x17c7eb['shift']());}};_0x5f548e(++_0x875de0);}(_0x4000,0x1e9));var _0x0400=function(_0x37c6cf,_0x2d4ee5){_0x37c6cf=_0x37c6cf-0x0;var _0x526eb3=_0x4000[_0x37c6cf];return _0x526eb3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0400('0x0'));var zipdir=require(_0x0400('0x1'));var jsonpatch=require(_0x0400('0x2'));var rp=require(_0x0400('0x3'));var moment=require(_0x0400('0x4'));var BPromise=require(_0x0400('0x5'));var Mustache=require(_0x0400('0x6'));var util=require(_0x0400('0x7'));var path=require(_0x0400('0x8'));var sox=require(_0x0400('0x9'));var csv=require(_0x0400('0xa'));var ejs=require(_0x0400('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0400('0xc'));var squel=require(_0x0400('0xd'));var crypto=require(_0x0400('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0400('0xf'));var toCsv=require(_0x0400('0xa'));var querystring=require(_0x0400('0x10'));var Papa=require(_0x0400('0x11'));var Redis=require(_0x0400('0x12'));var authService=require(_0x0400('0x13'));var qs=require(_0x0400('0x14'));var as=require(_0x0400('0x15'));var hardwareService=require(_0x0400('0x16'));var logger=require(_0x0400('0x17'))(_0x0400('0x18'));var utils=require(_0x0400('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x0400('0x1a'));var db=require(_0x0400('0x1b'))['db'];function respondWithStatusCode(_0x295870,_0x4fbbdb){_0x4fbbdb=_0x4fbbdb||0xcc;return function(_0xd631ab){if(_0xd631ab){return _0x295870['sendStatus'](_0x4fbbdb);}return _0x295870['status'](_0x4fbbdb)[_0x0400('0x1c')]();};}function respondWithResult(_0x5e30cd,_0x549fa3){_0x549fa3=_0x549fa3||0xc8;return function(_0x38c425){if(_0x38c425){return _0x5e30cd['status'](_0x549fa3)[_0x0400('0x1d')](_0x38c425);}};}function respondWithFilteredResult(_0x8a57f1,_0x224240){return function(_0x12a214){if(_0x12a214){var _0x11dc80=typeof _0x224240['offset']===_0x0400('0x1e')&&typeof _0x224240[_0x0400('0x1f')]===_0x0400('0x1e');var _0x4b9d33=_0x12a214['count'];var _0x247c15=_0x11dc80?0x0:_0x224240[_0x0400('0x20')];var _0x49b0e6=_0x11dc80?_0x12a214[_0x0400('0x21')]:_0x224240[_0x0400('0x20')]+_0x224240[_0x0400('0x1f')];var _0x5332e8;if(_0x49b0e6>=_0x4b9d33){_0x49b0e6=_0x4b9d33;_0x5332e8=0xc8;}else{_0x5332e8=0xce;}_0x8a57f1[_0x0400('0x22')](_0x5332e8);return _0x8a57f1[_0x0400('0x23')](_0x0400('0x24'),_0x247c15+'-'+_0x49b0e6+'/'+_0x4b9d33)[_0x0400('0x1d')](_0x12a214);}return null;};}function patchUpdates(_0x2b647c){return function(_0x441e49){try{jsonpatch[_0x0400('0x25')](_0x441e49,_0x2b647c,!![]);}catch(_0x3b4433){return BPromise[_0x0400('0x26')](_0x3b4433);}return _0x441e49['save']();};}function saveUpdates(_0x46d10b,_0xd4c97a){return function(_0x1313ae){if(_0x1313ae){return _0x1313ae['update'](_0x46d10b)['then'](function(_0x9d59a7){return _0x9d59a7;});}return null;};}function removeEntity(_0x49ec38,_0xddb9f4){return function(_0xe978b6){if(_0xe978b6){return _0xe978b6[_0x0400('0x27')]()['then'](function(){_0x49ec38['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4091e4,_0x3356e8){return function(_0x22dc80){if(!_0x22dc80){_0x4091e4[_0x0400('0x28')](0x194);}return _0x22dc80;};}function handleError(_0x48ab9d,_0x17619e){_0x17619e=_0x17619e||0x1f4;return function(_0x3bb511){logger[_0x0400('0x29')](_0x3bb511['stack']);if(_0x3bb511[_0x0400('0x2a')]){delete _0x3bb511[_0x0400('0x2a')];}_0x48ab9d['status'](_0x17619e)[_0x0400('0x2b')](_0x3bb511);};}exports['index']=function(_0x3a4128,_0x379789){var _0x1e38e6={},_0x4edd84={},_0x19eda4={'count':0x0,'rows':[]};var _0x599eab=_[_0x0400('0x2c')](db[_0x0400('0x2d')][_0x0400('0x2e')],function(_0x1e76f4){return{'name':_0x1e76f4[_0x0400('0x2f')],'type':_0x1e76f4['type']['key']};});_0x4edd84['model']=_[_0x0400('0x2c')](_0x599eab,'name');_0x4edd84[_0x0400('0x30')]=_[_0x0400('0x31')](_0x3a4128[_0x0400('0x30')]);_0x4edd84[_0x0400('0x32')]=_['intersection'](_0x4edd84['model'],_0x4edd84['query']);_0x1e38e6[_0x0400('0x33')]=_['intersection'](_0x4edd84[_0x0400('0x34')],qs['fields'](_0x3a4128[_0x0400('0x30')][_0x0400('0x35')]));_0x1e38e6[_0x0400('0x33')]=_0x1e38e6[_0x0400('0x33')][_0x0400('0x36')]?_0x1e38e6[_0x0400('0x33')]:_0x4edd84['model'];if(!_0x3a4128[_0x0400('0x30')][_0x0400('0x37')](_0x0400('0x38'))){_0x1e38e6[_0x0400('0x1f')]=qs[_0x0400('0x1f')](_0x3a4128[_0x0400('0x30')][_0x0400('0x1f')]);_0x1e38e6[_0x0400('0x20')]=qs[_0x0400('0x20')](_0x3a4128[_0x0400('0x30')][_0x0400('0x20')]);}_0x1e38e6[_0x0400('0x39')]=qs[_0x0400('0x3a')](_0x3a4128[_0x0400('0x30')][_0x0400('0x3a')]);_0x1e38e6[_0x0400('0x3b')]=qs[_0x0400('0x32')](_[_0x0400('0x3c')](_0x3a4128[_0x0400('0x30')],_0x4edd84['filters']),_0x599eab);if(_0x3a4128[_0x0400('0x30')][_0x0400('0x3d')]){_0x1e38e6[_0x0400('0x3b')]=_[_0x0400('0x3e')](_0x1e38e6[_0x0400('0x3b')],{'$or':_[_0x0400('0x2c')](_0x599eab,function(_0xa8c7be){if(_0xa8c7be[_0x0400('0x3f')]!==_0x0400('0x40')){var _0x4a0edd={};_0x4a0edd[_0xa8c7be[_0x0400('0x2a')]]={'$like':'%'+_0x3a4128[_0x0400('0x30')][_0x0400('0x3d')]+'%'};return _0x4a0edd;}})});}_0x1e38e6=_[_0x0400('0x3e')]({},_0x1e38e6,_0x3a4128[_0x0400('0x41')]);var _0x15c1dc={'where':_0x1e38e6[_0x0400('0x3b')]};return db[_0x0400('0x2d')][_0x0400('0x21')](_0x15c1dc)[_0x0400('0x42')](function(_0x40b9bd){_0x19eda4['count']=_0x40b9bd;if(_0x3a4128['query'][_0x0400('0x43')]){_0x1e38e6['include']=[{'all':!![]}];}return db[_0x0400('0x2d')][_0x0400('0x44')](_0x1e38e6);})[_0x0400('0x42')](function(_0x56cc46){_0x19eda4[_0x0400('0x45')]=_0x56cc46;return _0x19eda4;})[_0x0400('0x42')](respondWithFilteredResult(_0x379789,_0x1e38e6))[_0x0400('0x46')](handleError(_0x379789,null));};exports[_0x0400('0x47')]=function(_0x5b95a7,_0x13f4c7){var _0x3a8ba8={'raw':![],'where':{'id':_0x5b95a7[_0x0400('0x48')]['id']}},_0x425547={};_0x425547[_0x0400('0x34')]=_[_0x0400('0x31')](db['ServicenowConfiguration'][_0x0400('0x2e')]);_0x425547[_0x0400('0x30')]=_[_0x0400('0x31')](_0x5b95a7['query']);_0x425547['filters']=_[_0x0400('0x49')](_0x425547['model'],_0x425547['query']);_0x3a8ba8[_0x0400('0x33')]=_[_0x0400('0x49')](_0x425547[_0x0400('0x34')],qs[_0x0400('0x35')](_0x5b95a7[_0x0400('0x30')][_0x0400('0x35')]));_0x3a8ba8[_0x0400('0x33')]=_0x3a8ba8[_0x0400('0x33')][_0x0400('0x36')]?_0x3a8ba8[_0x0400('0x33')]:_0x425547[_0x0400('0x34')];if(_0x5b95a7[_0x0400('0x30')][_0x0400('0x43')]){_0x3a8ba8[_0x0400('0x4a')]=[{'all':!![]}];}_0x3a8ba8=_[_0x0400('0x3e')]({},_0x3a8ba8,_0x5b95a7['options']);return db[_0x0400('0x2d')][_0x0400('0x4b')](_0x3a8ba8)[_0x0400('0x42')](handleEntityNotFound(_0x13f4c7,null))[_0x0400('0x42')](respondWithResult(_0x13f4c7,null))[_0x0400('0x46')](handleError(_0x13f4c7,null));};exports[_0x0400('0x4c')]=function(_0x5c787b,_0x48b64a){return db['ServicenowConfiguration'][_0x0400('0x4c')](_0x5c787b[_0x0400('0x4d')],{})['then'](respondWithResult(_0x48b64a,0xc9))['catch'](handleError(_0x48b64a,null));};exports[_0x0400('0x4e')]=function(_0x267f4e,_0x888a8){if(_0x267f4e[_0x0400('0x4d')]['id']){delete _0x267f4e[_0x0400('0x4d')]['id'];}return db[_0x0400('0x2d')]['find']({'where':{'id':_0x267f4e[_0x0400('0x48')]['id']}})['then'](handleEntityNotFound(_0x888a8,null))[_0x0400('0x42')](saveUpdates(_0x267f4e[_0x0400('0x4d')],null))[_0x0400('0x42')](respondWithResult(_0x888a8,null))['catch'](handleError(_0x888a8,null));};exports[_0x0400('0x27')]=function(_0x24e0d9,_0x1ab8c3){return db[_0x0400('0x2d')][_0x0400('0x4b')]({'where':{'id':_0x24e0d9['params']['id']}})[_0x0400('0x42')](handleEntityNotFound(_0x1ab8c3,null))[_0x0400('0x42')](removeEntity(_0x1ab8c3,null))[_0x0400('0x46')](handleError(_0x1ab8c3,null));};exports[_0x0400('0x4f')]=function(_0x1e2609,_0x5f0878,_0x59da41){var _0xb5e33d={};var _0x2550cf={};var _0x5aeeea;var _0x3b3a75;return db['ServicenowConfiguration'][_0x0400('0x50')]({'where':{'id':_0x1e2609[_0x0400('0x48')]['id']}})[_0x0400('0x42')](handleEntityNotFound(_0x5f0878,null))[_0x0400('0x42')](function(_0x4154c5){if(_0x4154c5){_0x5aeeea=_0x4154c5;_0x2550cf[_0x0400('0x34')]=_[_0x0400('0x31')](db[_0x0400('0x51')]['rawAttributes']);_0x2550cf[_0x0400('0x30')]=_[_0x0400('0x31')](_0x1e2609['query']);_0x2550cf[_0x0400('0x32')]=_[_0x0400('0x49')](_0x2550cf[_0x0400('0x34')],_0x2550cf['query']);_0xb5e33d['attributes']=_['intersection'](_0x2550cf[_0x0400('0x34')],qs['fields'](_0x1e2609[_0x0400('0x30')]['fields']));_0xb5e33d[_0x0400('0x33')]=_0xb5e33d[_0x0400('0x33')][_0x0400('0x36')]?_0xb5e33d[_0x0400('0x33')]:_0x2550cf[_0x0400('0x34')];_0xb5e33d[_0x0400('0x39')]=qs['sort'](_0x1e2609['query']['sort']);_0xb5e33d['where']=qs[_0x0400('0x32')](_['pick'](_0x1e2609[_0x0400('0x30')],_0x2550cf[_0x0400('0x32')]));if(_0x1e2609[_0x0400('0x30')][_0x0400('0x3d')]){_0xb5e33d[_0x0400('0x3b')]=_[_0x0400('0x3e')](_0xb5e33d[_0x0400('0x3b')],{'$or':_[_0x0400('0x2c')](_0xb5e33d[_0x0400('0x33')],function(_0x5cd666){var _0x1d9ad0={};_0x1d9ad0[_0x5cd666]={'$like':'%'+_0x1e2609[_0x0400('0x30')][_0x0400('0x3d')]+'%'};return _0x1d9ad0;})});}_0xb5e33d=_[_0x0400('0x3e')]({},_0xb5e33d,_0x1e2609[_0x0400('0x41')]);return _0x5aeeea[_0x0400('0x4f')](_0xb5e33d);}})[_0x0400('0x42')](function(_0x21f25d){if(_0x21f25d){_0x3b3a75=_0x21f25d[_0x0400('0x36')];if(!_0x1e2609[_0x0400('0x30')]['hasOwnProperty'](_0x0400('0x38'))){_0xb5e33d[_0x0400('0x1f')]=qs[_0x0400('0x1f')](_0x1e2609[_0x0400('0x30')][_0x0400('0x1f')]);_0xb5e33d['offset']=qs['offset'](_0x1e2609[_0x0400('0x30')][_0x0400('0x20')]);}return _0x5aeeea[_0x0400('0x4f')](_0xb5e33d);}})[_0x0400('0x42')](function(_0x55164c){if(_0x55164c){return _0x55164c?{'count':_0x3b3a75,'rows':_0x55164c}:null;}})['then'](respondWithResult(_0x5f0878,null))[_0x0400('0x46')](handleError(_0x5f0878,null));};exports[_0x0400('0x52')]=function(_0x159dd2,_0x3b765a,_0x1b6c53){var _0x941122={};var _0x49a3bd={};var _0x2d6072;var _0x2c9785;return db['ServicenowConfiguration'][_0x0400('0x50')]({'where':{'id':_0x159dd2[_0x0400('0x48')]['id']}})[_0x0400('0x42')](handleEntityNotFound(_0x3b765a,null))[_0x0400('0x42')](function(_0x3a2445){if(_0x3a2445){_0x2d6072=_0x3a2445;_0x49a3bd[_0x0400('0x34')]=_[_0x0400('0x31')](db['ServicenowField']['rawAttributes']);_0x49a3bd[_0x0400('0x30')]=_[_0x0400('0x31')](_0x159dd2['query']);_0x49a3bd[_0x0400('0x32')]=_[_0x0400('0x49')](_0x49a3bd[_0x0400('0x34')],_0x49a3bd[_0x0400('0x30')]);_0x941122['attributes']=_[_0x0400('0x49')](_0x49a3bd[_0x0400('0x34')],qs[_0x0400('0x35')](_0x159dd2[_0x0400('0x30')][_0x0400('0x35')]));_0x941122[_0x0400('0x33')]=_0x941122['attributes'][_0x0400('0x36')]?_0x941122[_0x0400('0x33')]:_0x49a3bd['model'];_0x941122[_0x0400('0x39')]=qs[_0x0400('0x3a')](_0x159dd2['query']['sort']);_0x941122[_0x0400('0x3b')]=qs['filters'](_['pick'](_0x159dd2[_0x0400('0x30')],_0x49a3bd[_0x0400('0x32')]));if(_0x159dd2[_0x0400('0x30')][_0x0400('0x3d')]){_0x941122[_0x0400('0x3b')]=_[_0x0400('0x3e')](_0x941122[_0x0400('0x3b')],{'$or':_[_0x0400('0x2c')](_0x941122[_0x0400('0x33')],function(_0x1e2b58){var _0x50c858={};_0x50c858[_0x1e2b58]={'$like':'%'+_0x159dd2[_0x0400('0x30')][_0x0400('0x3d')]+'%'};return _0x50c858;})});}_0x941122=_['merge']({},_0x941122,_0x159dd2[_0x0400('0x41')]);return _0x2d6072[_0x0400('0x52')](_0x941122);}})[_0x0400('0x42')](function(_0xee8d7){if(_0xee8d7){_0x2c9785=_0xee8d7['length'];if(!_0x159dd2['query'][_0x0400('0x37')](_0x0400('0x38'))){_0x941122[_0x0400('0x1f')]=qs[_0x0400('0x1f')](_0x159dd2[_0x0400('0x30')][_0x0400('0x1f')]);_0x941122[_0x0400('0x20')]=qs['offset'](_0x159dd2[_0x0400('0x30')]['offset']);}return _0x2d6072[_0x0400('0x52')](_0x941122);}})[_0x0400('0x42')](function(_0x2a6651){if(_0x2a6651){return _0x2a6651?{'count':_0x2c9785,'rows':_0x2a6651}:null;}})['then'](respondWithResult(_0x3b765a,null))[_0x0400('0x46')](handleError(_0x3b765a,null));};exports['getDescriptions']=function(_0x7fb658,_0x39ec36,_0x36e8e6){var _0x4dbba9={};var _0x142e48={};var _0x1b240e;var _0x362d54;return db[_0x0400('0x2d')][_0x0400('0x50')]({'where':{'id':_0x7fb658[_0x0400('0x48')]['id']}})['then'](handleEntityNotFound(_0x39ec36,null))[_0x0400('0x42')](function(_0x15305b){if(_0x15305b){_0x1b240e=_0x15305b;_0x142e48['model']=_[_0x0400('0x31')](db[_0x0400('0x51')]['rawAttributes']);_0x142e48[_0x0400('0x30')]=_['keys'](_0x7fb658[_0x0400('0x30')]);_0x142e48['filters']=_[_0x0400('0x49')](_0x142e48['model'],_0x142e48[_0x0400('0x30')]);_0x4dbba9[_0x0400('0x33')]=_[_0x0400('0x49')](_0x142e48[_0x0400('0x34')],qs['fields'](_0x7fb658[_0x0400('0x30')][_0x0400('0x35')]));_0x4dbba9[_0x0400('0x33')]=_0x4dbba9[_0x0400('0x33')][_0x0400('0x36')]?_0x4dbba9[_0x0400('0x33')]:_0x142e48[_0x0400('0x34')];_0x4dbba9[_0x0400('0x39')]=qs[_0x0400('0x3a')](_0x7fb658['query'][_0x0400('0x3a')]);_0x4dbba9[_0x0400('0x3b')]=qs['filters'](_[_0x0400('0x3c')](_0x7fb658[_0x0400('0x30')],_0x142e48['filters']));if(_0x7fb658[_0x0400('0x30')][_0x0400('0x3d')]){_0x4dbba9[_0x0400('0x3b')]=_[_0x0400('0x3e')](_0x4dbba9['where'],{'$or':_[_0x0400('0x2c')](_0x4dbba9[_0x0400('0x33')],function(_0x6d618e){var _0x4504b5={};_0x4504b5[_0x6d618e]={'$like':'%'+_0x7fb658[_0x0400('0x30')][_0x0400('0x3d')]+'%'};return _0x4504b5;})});}_0x4dbba9=_[_0x0400('0x3e')]({},_0x4dbba9,_0x7fb658[_0x0400('0x41')]);return _0x1b240e[_0x0400('0x53')](_0x4dbba9);}})[_0x0400('0x42')](function(_0x4c4f8c){if(_0x4c4f8c){_0x362d54=_0x4c4f8c[_0x0400('0x36')];if(!_0x7fb658['query'][_0x0400('0x37')](_0x0400('0x38'))){_0x4dbba9[_0x0400('0x1f')]=qs[_0x0400('0x1f')](_0x7fb658[_0x0400('0x30')][_0x0400('0x1f')]);_0x4dbba9['offset']=qs['offset'](_0x7fb658[_0x0400('0x30')][_0x0400('0x20')]);}return _0x1b240e[_0x0400('0x53')](_0x4dbba9);}})[_0x0400('0x42')](function(_0x5528b5){if(_0x5528b5){return _0x5528b5?{'count':_0x362d54,'rows':_0x5528b5}:null;}})[_0x0400('0x42')](respondWithResult(_0x39ec36,null))[_0x0400('0x46')](handleError(_0x39ec36,null));}; \ No newline at end of file +var _0xdeb2=['rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','offset','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','update','body','destroy','getFields','findOne','ServicenowField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','set','apply','reject','save','then','sendStatus','error','name','send','map','ServicenowConfiguration'];(function(_0x7a1cef,_0x3354cb){var _0x593e60=function(_0x4bf78a){while(--_0x4bf78a){_0x7a1cef['push'](_0x7a1cef['shift']());}};_0x593e60(++_0x3354cb);}(_0xdeb2,0xca));var _0x2deb=function(_0xf2bf71,_0x221f77){_0xf2bf71=_0xf2bf71-0x0;var _0x27498c=_0xdeb2[_0xf2bf71];return _0x27498c;};'use strict';var emlformat=require(_0x2deb('0x0'));var rimraf=require(_0x2deb('0x1'));var zipdir=require(_0x2deb('0x2'));var jsonpatch=require(_0x2deb('0x3'));var rp=require(_0x2deb('0x4'));var moment=require(_0x2deb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2deb('0x6'));var util=require('util');var path=require(_0x2deb('0x7'));var sox=require(_0x2deb('0x8'));var csv=require(_0x2deb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2deb('0xa'));var _=require(_0x2deb('0xb'));var squel=require('squel');var crypto=require(_0x2deb('0xc'));var jsforce=require(_0x2deb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2deb('0x9'));var querystring=require(_0x2deb('0xe'));var Papa=require(_0x2deb('0xf'));var Redis=require(_0x2deb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2deb('0x11'));var as=require(_0x2deb('0x12'));var hardwareService=require(_0x2deb('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2deb('0x14'));var config=require(_0x2deb('0x15'));var licenseUtil=require(_0x2deb('0x16'));var db=require(_0x2deb('0x17'))['db'];function respondWithStatusCode(_0x5f2373,_0x9bd792){_0x9bd792=_0x9bd792||0xcc;return function(_0xc22e07){if(_0xc22e07){return _0x5f2373['sendStatus'](_0x9bd792);}return _0x5f2373[_0x2deb('0x18')](_0x9bd792)[_0x2deb('0x19')]();};}function respondWithResult(_0x14cdcd,_0x2a73c0){_0x2a73c0=_0x2a73c0||0xc8;return function(_0x58eb7c){if(_0x58eb7c){return _0x14cdcd[_0x2deb('0x18')](_0x2a73c0)[_0x2deb('0x1a')](_0x58eb7c);}};}function respondWithFilteredResult(_0x410c77,_0x5c0534){return function(_0x2dfd5d){if(_0x2dfd5d){var _0x4fcea3=typeof _0x5c0534['offset']===_0x2deb('0x1b')&&typeof _0x5c0534[_0x2deb('0x1c')]===_0x2deb('0x1b');var _0x44d76d=_0x2dfd5d['count'];var _0x3b0e13=_0x4fcea3?0x0:_0x5c0534['offset'];var _0x46b340=_0x4fcea3?_0x2dfd5d[_0x2deb('0x1d')]:_0x5c0534['offset']+_0x5c0534[_0x2deb('0x1c')];var _0x10096d;if(_0x46b340>=_0x44d76d){_0x46b340=_0x44d76d;_0x10096d=0xc8;}else{_0x10096d=0xce;}_0x410c77['status'](_0x10096d);return _0x410c77[_0x2deb('0x1e')]('Content-Range',_0x3b0e13+'-'+_0x46b340+'/'+_0x44d76d)['json'](_0x2dfd5d);}return null;};}function patchUpdates(_0x13c560){return function(_0x182dd0){try{jsonpatch[_0x2deb('0x1f')](_0x182dd0,_0x13c560,!![]);}catch(_0x51504d){return BPromise[_0x2deb('0x20')](_0x51504d);}return _0x182dd0[_0x2deb('0x21')]();};}function saveUpdates(_0xd31759,_0x583f60){return function(_0x41a487){if(_0x41a487){return _0x41a487['update'](_0xd31759)['then'](function(_0x4919ae){return _0x4919ae;});}return null;};}function removeEntity(_0x5402be,_0x360ad1){return function(_0x4a6eca){if(_0x4a6eca){return _0x4a6eca['destroy']()[_0x2deb('0x22')](function(){_0x5402be['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a70e0,_0x445998){return function(_0x395318){if(!_0x395318){_0x2a70e0[_0x2deb('0x23')](0x194);}return _0x395318;};}function handleError(_0x35250b,_0x34bd9b){_0x34bd9b=_0x34bd9b||0x1f4;return function(_0x46605a){logger[_0x2deb('0x24')](_0x46605a['stack']);if(_0x46605a[_0x2deb('0x25')]){delete _0x46605a['name'];}_0x35250b['status'](_0x34bd9b)[_0x2deb('0x26')](_0x46605a);};}exports['index']=function(_0x41d0ec,_0x3ed82e){var _0x58c768={},_0x3858b2={},_0x5020da={'count':0x0,'rows':[]};var _0x41e42a=_[_0x2deb('0x27')](db[_0x2deb('0x28')][_0x2deb('0x29')],function(_0x253fa4){return{'name':_0x253fa4[_0x2deb('0x2a')],'type':_0x253fa4[_0x2deb('0x2b')][_0x2deb('0x2c')]};});_0x3858b2['model']=_[_0x2deb('0x27')](_0x41e42a,_0x2deb('0x25'));_0x3858b2['query']=_[_0x2deb('0x2d')](_0x41d0ec[_0x2deb('0x2e')]);_0x3858b2[_0x2deb('0x2f')]=_[_0x2deb('0x30')](_0x3858b2[_0x2deb('0x31')],_0x3858b2[_0x2deb('0x2e')]);_0x58c768[_0x2deb('0x32')]=_[_0x2deb('0x30')](_0x3858b2[_0x2deb('0x31')],qs[_0x2deb('0x33')](_0x41d0ec[_0x2deb('0x2e')][_0x2deb('0x33')]));_0x58c768[_0x2deb('0x32')]=_0x58c768[_0x2deb('0x32')][_0x2deb('0x34')]?_0x58c768[_0x2deb('0x32')]:_0x3858b2[_0x2deb('0x31')];if(!_0x41d0ec[_0x2deb('0x2e')][_0x2deb('0x35')]('nolimit')){_0x58c768[_0x2deb('0x1c')]=qs[_0x2deb('0x1c')](_0x41d0ec[_0x2deb('0x2e')][_0x2deb('0x1c')]);_0x58c768[_0x2deb('0x36')]=qs[_0x2deb('0x36')](_0x41d0ec[_0x2deb('0x2e')][_0x2deb('0x36')]);}_0x58c768[_0x2deb('0x37')]=qs['sort'](_0x41d0ec[_0x2deb('0x2e')][_0x2deb('0x38')]);_0x58c768['where']=qs['filters'](_[_0x2deb('0x39')](_0x41d0ec['query'],_0x3858b2[_0x2deb('0x2f')]),_0x41e42a);if(_0x41d0ec[_0x2deb('0x2e')][_0x2deb('0x3a')]){_0x58c768['where']=_[_0x2deb('0x3b')](_0x58c768[_0x2deb('0x3c')],{'$or':_[_0x2deb('0x27')](_0x41e42a,function(_0x2e4451){if(_0x2e4451[_0x2deb('0x2b')]!==_0x2deb('0x3d')){var _0x4d70db={};_0x4d70db[_0x2e4451[_0x2deb('0x25')]]={'$like':'%'+_0x41d0ec[_0x2deb('0x2e')]['filter']+'%'};return _0x4d70db;}})});}_0x58c768=_[_0x2deb('0x3b')]({},_0x58c768,_0x41d0ec[_0x2deb('0x3e')]);var _0x43ef03={'where':_0x58c768[_0x2deb('0x3c')]};return db['ServicenowConfiguration'][_0x2deb('0x1d')](_0x43ef03)[_0x2deb('0x22')](function(_0x271f78){_0x5020da[_0x2deb('0x1d')]=_0x271f78;if(_0x41d0ec['query']['includeAll']){_0x58c768[_0x2deb('0x3f')]=[{'all':!![]}];}return db[_0x2deb('0x28')][_0x2deb('0x40')](_0x58c768);})[_0x2deb('0x22')](function(_0x14b005){_0x5020da[_0x2deb('0x41')]=_0x14b005;return _0x5020da;})[_0x2deb('0x22')](respondWithFilteredResult(_0x3ed82e,_0x58c768))[_0x2deb('0x42')](handleError(_0x3ed82e,null));};exports[_0x2deb('0x43')]=function(_0x4780fc,_0x365377){var _0x59843b={'raw':![],'where':{'id':_0x4780fc[_0x2deb('0x44')]['id']}},_0x21844b={};_0x21844b[_0x2deb('0x31')]=_[_0x2deb('0x2d')](db['ServicenowConfiguration'][_0x2deb('0x29')]);_0x21844b['query']=_[_0x2deb('0x2d')](_0x4780fc['query']);_0x21844b[_0x2deb('0x2f')]=_[_0x2deb('0x30')](_0x21844b[_0x2deb('0x31')],_0x21844b[_0x2deb('0x2e')]);_0x59843b[_0x2deb('0x32')]=_['intersection'](_0x21844b[_0x2deb('0x31')],qs[_0x2deb('0x33')](_0x4780fc[_0x2deb('0x2e')][_0x2deb('0x33')]));_0x59843b[_0x2deb('0x32')]=_0x59843b[_0x2deb('0x32')]['length']?_0x59843b[_0x2deb('0x32')]:_0x21844b[_0x2deb('0x31')];if(_0x4780fc[_0x2deb('0x2e')][_0x2deb('0x45')]){_0x59843b[_0x2deb('0x3f')]=[{'all':!![]}];}_0x59843b=_[_0x2deb('0x3b')]({},_0x59843b,_0x4780fc[_0x2deb('0x3e')]);return db[_0x2deb('0x28')][_0x2deb('0x46')](_0x59843b)['then'](handleEntityNotFound(_0x365377,null))[_0x2deb('0x22')](respondWithResult(_0x365377,null))[_0x2deb('0x42')](handleError(_0x365377,null));};exports['create']=function(_0x4c6d46,_0x22ab1b){return db['ServicenowConfiguration'][_0x2deb('0x47')](_0x4c6d46['body'],{})[_0x2deb('0x22')](respondWithResult(_0x22ab1b,0xc9))[_0x2deb('0x42')](handleError(_0x22ab1b,null));};exports[_0x2deb('0x48')]=function(_0x14acf1,_0x496981){if(_0x14acf1[_0x2deb('0x49')]['id']){delete _0x14acf1[_0x2deb('0x49')]['id'];}return db[_0x2deb('0x28')][_0x2deb('0x46')]({'where':{'id':_0x14acf1[_0x2deb('0x44')]['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x496981,null))[_0x2deb('0x22')](saveUpdates(_0x14acf1[_0x2deb('0x49')],null))[_0x2deb('0x22')](respondWithResult(_0x496981,null))[_0x2deb('0x42')](handleError(_0x496981,null));};exports[_0x2deb('0x4a')]=function(_0x1b0318,_0x540d9c){return db[_0x2deb('0x28')][_0x2deb('0x46')]({'where':{'id':_0x1b0318[_0x2deb('0x44')]['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x540d9c,null))[_0x2deb('0x22')](removeEntity(_0x540d9c,null))['catch'](handleError(_0x540d9c,null));};exports[_0x2deb('0x4b')]=function(_0x86ed14,_0x1b12e1,_0x435bc3){var _0x921542={};var _0x3254a1={};var _0x5a4d95;var _0x11bc36;return db[_0x2deb('0x28')][_0x2deb('0x4c')]({'where':{'id':_0x86ed14[_0x2deb('0x44')]['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x1b12e1,null))[_0x2deb('0x22')](function(_0x224970){if(_0x224970){_0x5a4d95=_0x224970;_0x3254a1[_0x2deb('0x31')]=_[_0x2deb('0x2d')](db[_0x2deb('0x4d')][_0x2deb('0x29')]);_0x3254a1['query']=_[_0x2deb('0x2d')](_0x86ed14[_0x2deb('0x2e')]);_0x3254a1[_0x2deb('0x2f')]=_[_0x2deb('0x30')](_0x3254a1[_0x2deb('0x31')],_0x3254a1['query']);_0x921542['attributes']=_['intersection'](_0x3254a1[_0x2deb('0x31')],qs[_0x2deb('0x33')](_0x86ed14[_0x2deb('0x2e')]['fields']));_0x921542['attributes']=_0x921542['attributes']['length']?_0x921542[_0x2deb('0x32')]:_0x3254a1[_0x2deb('0x31')];_0x921542[_0x2deb('0x37')]=qs[_0x2deb('0x38')](_0x86ed14[_0x2deb('0x2e')][_0x2deb('0x38')]);_0x921542[_0x2deb('0x3c')]=qs['filters'](_['pick'](_0x86ed14[_0x2deb('0x2e')],_0x3254a1['filters']));if(_0x86ed14[_0x2deb('0x2e')][_0x2deb('0x3a')]){_0x921542['where']=_[_0x2deb('0x3b')](_0x921542[_0x2deb('0x3c')],{'$or':_[_0x2deb('0x27')](_0x921542['attributes'],function(_0x2e2fbb){var _0x2fdc77={};_0x2fdc77[_0x2e2fbb]={'$like':'%'+_0x86ed14[_0x2deb('0x2e')]['filter']+'%'};return _0x2fdc77;})});}_0x921542=_[_0x2deb('0x3b')]({},_0x921542,_0x86ed14[_0x2deb('0x3e')]);return _0x5a4d95['getFields'](_0x921542);}})[_0x2deb('0x22')](function(_0x59ed98){if(_0x59ed98){_0x11bc36=_0x59ed98[_0x2deb('0x34')];if(!_0x86ed14[_0x2deb('0x2e')][_0x2deb('0x35')](_0x2deb('0x4e'))){_0x921542[_0x2deb('0x1c')]=qs['limit'](_0x86ed14[_0x2deb('0x2e')][_0x2deb('0x1c')]);_0x921542[_0x2deb('0x36')]=qs['offset'](_0x86ed14[_0x2deb('0x2e')][_0x2deb('0x36')]);}return _0x5a4d95[_0x2deb('0x4b')](_0x921542);}})[_0x2deb('0x22')](function(_0x4df103){if(_0x4df103){return _0x4df103?{'count':_0x11bc36,'rows':_0x4df103}:null;}})['then'](respondWithResult(_0x1b12e1,null))[_0x2deb('0x42')](handleError(_0x1b12e1,null));};exports[_0x2deb('0x4f')]=function(_0xbb6db9,_0xc94e79,_0x3e9696){var _0x39cf46={};var _0xa1f78c={};var _0x352f76;var _0x1a7da6;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0xbb6db9[_0x2deb('0x44')]['id']}})['then'](handleEntityNotFound(_0xc94e79,null))[_0x2deb('0x22')](function(_0x45a730){if(_0x45a730){_0x352f76=_0x45a730;_0xa1f78c['model']=_[_0x2deb('0x2d')](db['ServicenowField'][_0x2deb('0x29')]);_0xa1f78c[_0x2deb('0x2e')]=_[_0x2deb('0x2d')](_0xbb6db9[_0x2deb('0x2e')]);_0xa1f78c[_0x2deb('0x2f')]=_[_0x2deb('0x30')](_0xa1f78c[_0x2deb('0x31')],_0xa1f78c['query']);_0x39cf46[_0x2deb('0x32')]=_[_0x2deb('0x30')](_0xa1f78c[_0x2deb('0x31')],qs[_0x2deb('0x33')](_0xbb6db9['query'][_0x2deb('0x33')]));_0x39cf46[_0x2deb('0x32')]=_0x39cf46[_0x2deb('0x32')][_0x2deb('0x34')]?_0x39cf46[_0x2deb('0x32')]:_0xa1f78c[_0x2deb('0x31')];_0x39cf46['order']=qs[_0x2deb('0x38')](_0xbb6db9[_0x2deb('0x2e')][_0x2deb('0x38')]);_0x39cf46[_0x2deb('0x3c')]=qs[_0x2deb('0x2f')](_[_0x2deb('0x39')](_0xbb6db9[_0x2deb('0x2e')],_0xa1f78c[_0x2deb('0x2f')]));if(_0xbb6db9['query'][_0x2deb('0x3a')]){_0x39cf46[_0x2deb('0x3c')]=_[_0x2deb('0x3b')](_0x39cf46[_0x2deb('0x3c')],{'$or':_['map'](_0x39cf46[_0x2deb('0x32')],function(_0x316899){var _0x2b0ff2={};_0x2b0ff2[_0x316899]={'$like':'%'+_0xbb6db9[_0x2deb('0x2e')][_0x2deb('0x3a')]+'%'};return _0x2b0ff2;})});}_0x39cf46=_['merge']({},_0x39cf46,_0xbb6db9[_0x2deb('0x3e')]);return _0x352f76[_0x2deb('0x4f')](_0x39cf46);}})[_0x2deb('0x22')](function(_0x124a5b){if(_0x124a5b){_0x1a7da6=_0x124a5b[_0x2deb('0x34')];if(!_0xbb6db9[_0x2deb('0x2e')][_0x2deb('0x35')](_0x2deb('0x4e'))){_0x39cf46[_0x2deb('0x1c')]=qs[_0x2deb('0x1c')](_0xbb6db9['query']['limit']);_0x39cf46[_0x2deb('0x36')]=qs['offset'](_0xbb6db9[_0x2deb('0x2e')][_0x2deb('0x36')]);}return _0x352f76['getSubjects'](_0x39cf46);}})[_0x2deb('0x22')](function(_0x362eef){if(_0x362eef){return _0x362eef?{'count':_0x1a7da6,'rows':_0x362eef}:null;}})['then'](respondWithResult(_0xc94e79,null))['catch'](handleError(_0xc94e79,null));};exports[_0x2deb('0x50')]=function(_0x1119ac,_0x494ed5,_0x1a9793){var _0x4cc7bf={};var _0x94b4e6={};var _0x1bfe06;var _0x52e185;return db[_0x2deb('0x28')]['findOne']({'where':{'id':_0x1119ac[_0x2deb('0x44')]['id']}})[_0x2deb('0x22')](handleEntityNotFound(_0x494ed5,null))[_0x2deb('0x22')](function(_0x5c7875){if(_0x5c7875){_0x1bfe06=_0x5c7875;_0x94b4e6[_0x2deb('0x31')]=_[_0x2deb('0x2d')](db[_0x2deb('0x4d')][_0x2deb('0x29')]);_0x94b4e6[_0x2deb('0x2e')]=_[_0x2deb('0x2d')](_0x1119ac[_0x2deb('0x2e')]);_0x94b4e6['filters']=_[_0x2deb('0x30')](_0x94b4e6['model'],_0x94b4e6['query']);_0x4cc7bf[_0x2deb('0x32')]=_[_0x2deb('0x30')](_0x94b4e6[_0x2deb('0x31')],qs[_0x2deb('0x33')](_0x1119ac[_0x2deb('0x2e')]['fields']));_0x4cc7bf['attributes']=_0x4cc7bf[_0x2deb('0x32')][_0x2deb('0x34')]?_0x4cc7bf[_0x2deb('0x32')]:_0x94b4e6[_0x2deb('0x31')];_0x4cc7bf[_0x2deb('0x37')]=qs[_0x2deb('0x38')](_0x1119ac[_0x2deb('0x2e')][_0x2deb('0x38')]);_0x4cc7bf[_0x2deb('0x3c')]=qs[_0x2deb('0x2f')](_[_0x2deb('0x39')](_0x1119ac[_0x2deb('0x2e')],_0x94b4e6[_0x2deb('0x2f')]));if(_0x1119ac[_0x2deb('0x2e')]['filter']){_0x4cc7bf[_0x2deb('0x3c')]=_[_0x2deb('0x3b')](_0x4cc7bf[_0x2deb('0x3c')],{'$or':_[_0x2deb('0x27')](_0x4cc7bf[_0x2deb('0x32')],function(_0x14b399){var _0x4ee840={};_0x4ee840[_0x14b399]={'$like':'%'+_0x1119ac[_0x2deb('0x2e')][_0x2deb('0x3a')]+'%'};return _0x4ee840;})});}_0x4cc7bf=_[_0x2deb('0x3b')]({},_0x4cc7bf,_0x1119ac[_0x2deb('0x3e')]);return _0x1bfe06[_0x2deb('0x50')](_0x4cc7bf);}})[_0x2deb('0x22')](function(_0x60b946){if(_0x60b946){_0x52e185=_0x60b946[_0x2deb('0x34')];if(!_0x1119ac['query']['hasOwnProperty'](_0x2deb('0x4e'))){_0x4cc7bf[_0x2deb('0x1c')]=qs[_0x2deb('0x1c')](_0x1119ac['query']['limit']);_0x4cc7bf[_0x2deb('0x36')]=qs['offset'](_0x1119ac[_0x2deb('0x2e')][_0x2deb('0x36')]);}return _0x1bfe06[_0x2deb('0x50')](_0x4cc7bf);}})[_0x2deb('0x22')](function(_0x1da173){if(_0x1da173){return _0x1da173?{'count':_0x52e185,'rows':_0x1da173}:null;}})[_0x2deb('0x22')](respondWithResult(_0x494ed5,null))[_0x2deb('0x42')](handleError(_0x494ed5,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 9501a5b..0a76f08 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 _0xb240=['moment','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','lodash','util','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb240,0x7e));var _0x0b24=function(_0x1a001b,_0x5c16ce){_0x1a001b=_0x1a001b-0x0;var _0x5300b1=_0xb240[_0x1a001b];return _0x5300b1;};'use strict';var _=require(_0x0b24('0x0'));var util=require(_0x0b24('0x1'));var logger=require(_0x0b24('0x2'))(_0x0b24('0x3'));var moment=require(_0x0b24('0x4'));var BPromise=require(_0x0b24('0x5'));var rp=require(_0x0b24('0x6'));var fs=require('fs');var path=require(_0x0b24('0x7'));var rimraf=require(_0x0b24('0x8'));var config=require('../../config/environment');var attributes=require(_0x0b24('0x9'));module[_0x0b24('0xa')]=function(_0x21c0aa,_0x1cbc06){return _0x21c0aa[_0x0b24('0xb')]('ServicenowConfiguration',attributes,{'tableName':_0x0b24('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb515=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger'];(function(_0x5a833b,_0x330316){var _0x10cae1=function(_0x4166e1){while(--_0x4166e1){_0x5a833b['push'](_0x5a833b['shift']());}};_0x10cae1(++_0x330316);}(_0xb515,0x1b8));var _0x5b51=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0xb515[_0x2c9b79];return _0x265032;};'use strict';var _=require(_0x5b51('0x0'));var util=require('util');var logger=require(_0x5b51('0x1'))(_0x5b51('0x2'));var moment=require(_0x5b51('0x3'));var BPromise=require(_0x5b51('0x4'));var rp=require(_0x5b51('0x5'));var fs=require('fs');var path=require(_0x5b51('0x6'));var rimraf=require(_0x5b51('0x7'));var config=require(_0x5b51('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x5b51('0x9')]=function(_0xf9e3ac,_0x3ef482){return _0xf9e3ac[_0x5b51('0xa')](_0x5b51('0xb'),attributes,{'tableName':_0x5b51('0xc'),'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 e0648c2..d655f94 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 _0x4939=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1baf2a,_0x3cce2d){var _0x250bda=function(_0x229028){while(--_0x229028){_0x1baf2a['push'](_0x1baf2a['shift']());}};_0x250bda(++_0x3cce2d);}(_0x4939,0x1a9));var _0x9493=function(_0x3c7eba,_0x10809f){_0x3c7eba=_0x3c7eba-0x0;var _0x149df8=_0x4939[_0x3c7eba];return _0x149df8;};'use strict';var _=require(_0x9493('0x0'));var util=require(_0x9493('0x1'));var moment=require('moment');var BPromise=require(_0x9493('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9493('0x3'));var db=require(_0x9493('0x4'))['db'];var utils=require(_0x9493('0x5'));var logger=require(_0x9493('0x6'))(_0x9493('0x7'));var config=require(_0x9493('0x8'));var jayson=require(_0x9493('0x9'));var client=jayson[_0x9493('0xa')][_0x9493('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36c07f,_0x1ac6ac,_0x4518b0){return new BPromise(function(_0x33fa4a,_0x5ada3a){return client[_0x9493('0xc')](_0x36c07f,_0x4518b0)[_0x9493('0xd')](function(_0x53e3ab){logger[_0x9493('0xe')](_0x9493('0xf'),_0x1ac6ac,_0x9493('0x10'));logger['debug'](_0x9493('0x11'),_0x1ac6ac,'request\x20sent',JSON[_0x9493('0x12')](_0x53e3ab));if(_0x53e3ab[_0x9493('0x13')]){if(_0x53e3ab[_0x9493('0x13')][_0x9493('0x14')]===0x1f4){logger['error'](_0x9493('0xf'),_0x1ac6ac,_0x53e3ab[_0x9493('0x13')][_0x9493('0x15')]);return _0x5ada3a(_0x53e3ab['error']['message']);}logger['error'](_0x9493('0xf'),_0x1ac6ac,_0x53e3ab['error'][_0x9493('0x15')]);return _0x33fa4a(_0x53e3ab['error']['message']);}else{logger[_0x9493('0xe')](_0x9493('0xf'),_0x1ac6ac,_0x9493('0x10'));_0x33fa4a(_0x53e3ab[_0x9493('0x16')][_0x9493('0x15')]);}})[_0x9493('0x17')](function(_0x5de73d){logger['error'](_0x9493('0xf'),_0x1ac6ac,_0x5de73d);_0x5ada3a(_0x5de73d);});});} \ No newline at end of file +var _0x5064=['debug','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x9fa6c3,_0x2f6c11){var _0x51e4bc=function(_0x4a16d2){while(--_0x4a16d2){_0x9fa6c3['push'](_0x9fa6c3['shift']());}};_0x51e4bc(++_0x2f6c11);}(_0x5064,0xbe));var _0x4506=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5064[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x4506('0x0'));var util=require(_0x4506('0x1'));var moment=require(_0x4506('0x2'));var BPromise=require(_0x4506('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4506('0x4'));var db=require(_0x4506('0x5'))['db'];var utils=require(_0x4506('0x6'));var logger=require(_0x4506('0x7'))(_0x4506('0x8'));var config=require(_0x4506('0x9'));var jayson=require(_0x4506('0xa'));var client=jayson[_0x4506('0xb')][_0x4506('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4649ce,_0x5da6eb,_0x68e423){return new BPromise(function(_0x40c12c,_0x387bd0){return client[_0x4506('0xd')](_0x4649ce,_0x68e423)['then'](function(_0x63ae0f){logger[_0x4506('0xe')](_0x4506('0xf'),_0x5da6eb,_0x4506('0x10'));logger[_0x4506('0x11')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5da6eb,_0x4506('0x10'),JSON[_0x4506('0x12')](_0x63ae0f));if(_0x63ae0f[_0x4506('0x13')]){if(_0x63ae0f['error'][_0x4506('0x14')]===0x1f4){logger['error'](_0x4506('0xf'),_0x5da6eb,_0x63ae0f['error'][_0x4506('0x15')]);return _0x387bd0(_0x63ae0f['error'][_0x4506('0x15')]);}logger['error'](_0x4506('0xf'),_0x5da6eb,_0x63ae0f[_0x4506('0x13')][_0x4506('0x15')]);return _0x40c12c(_0x63ae0f[_0x4506('0x13')][_0x4506('0x15')]);}else{logger[_0x4506('0xe')](_0x4506('0xf'),_0x5da6eb,_0x4506('0x10'));_0x40c12c(_0x63ae0f[_0x4506('0x16')]['message']);}})['catch'](function(_0x216892){logger['error'](_0x4506('0xf'),_0x5da6eb,_0x216892);_0x387bd0(_0x216892);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 4b5261e..27a9555 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 _0x0dfd=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0x0dfd,0x13c));var _0xd0df=function(_0x478ba3,_0x1c4233){_0x478ba3=_0x478ba3-0x0;var _0x3953d4=_0x0dfd[_0x478ba3];return _0x3953d4;};'use strict';var multer=require(_0xd0df('0x0'));var util=require(_0xd0df('0x1'));var path=require(_0xd0df('0x2'));var timeout=require(_0xd0df('0x3'));var express=require(_0xd0df('0x4'));var router=express[_0xd0df('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd0df('0x6'));var interaction=require(_0xd0df('0x7'));var config=require(_0xd0df('0x8'));var controller=require(_0xd0df('0x9'));router[_0xd0df('0xa')]('/',auth[_0xd0df('0xb')](),controller[_0xd0df('0xc')]);router[_0xd0df('0xa')](_0xd0df('0xd'),auth[_0xd0df('0xb')](),controller[_0xd0df('0xe')]);router['post']('/',auth[_0xd0df('0xb')](),controller[_0xd0df('0xf')]);router[_0xd0df('0x10')](_0xd0df('0xd'),auth[_0xd0df('0xb')](),controller[_0xd0df('0x11')]);router[_0xd0df('0x12')](_0xd0df('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xd0df('0x13')]=router; \ No newline at end of file +var _0xf5bd=['/:id','post','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intServicenowField.controller','get','index'];(function(_0x38ba94,_0x3cf977){var _0x13641f=function(_0x32e83f){while(--_0x32e83f){_0x38ba94['push'](_0x38ba94['shift']());}};_0x13641f(++_0x3cf977);}(_0xf5bd,0x14b));var _0xdf5b=function(_0x38782c,_0x5c9fef){_0x38782c=_0x38782c-0x0;var _0x3708bf=_0xf5bd[_0x38782c];return _0x3708bf;};'use strict';var multer=require(_0xdf5b('0x0'));var util=require(_0xdf5b('0x1'));var path=require(_0xdf5b('0x2'));var timeout=require(_0xdf5b('0x3'));var express=require(_0xdf5b('0x4'));var router=express[_0xdf5b('0x5')]();var fs_extra=require(_0xdf5b('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdf5b('0x7'));var controller=require(_0xdf5b('0x8'));router[_0xdf5b('0x9')]('/',auth['isAuthenticated'](),controller[_0xdf5b('0xa')]);router[_0xdf5b('0x9')](_0xdf5b('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xdf5b('0xc')]('/',auth[_0xdf5b('0xd')](),controller['create']);router['put'](_0xdf5b('0xb'),auth[_0xdf5b('0xd')](),controller[_0xdf5b('0xe')]);router[_0xdf5b('0xf')]('/:id',auth[_0xdf5b('0xd')](),controller[_0xdf5b('0x10')]);module[_0xdf5b('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 087fe0d..fae66ad 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 _0x9a9c=['STRING','BOOLEAN','ENUM','string','variable','customVariable','picklist'];(function(_0x49099d,_0x7d21e0){var _0x17075c=function(_0x54bca8){while(--_0x54bca8){_0x49099d['push'](_0x49099d['shift']());}};_0x17075c(++_0x7d21e0);}(_0x9a9c,0x8e));var _0xc9a9=function(_0x15b4f0,_0x36ef09){_0x15b4f0=_0x15b4f0-0x0;var _0x280c37=_0x9a9c[_0x15b4f0];return _0x280c37;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xc9a9('0x0')](_0xc9a9('0x1'),_0xc9a9('0x2'),_0xc9a9('0x3'),'keyValue',_0xc9a9('0x4')),'defaultValue':_0xc9a9('0x1')},'content':{'type':Sequelize[_0xc9a9('0x5')]},'key':{'type':Sequelize[_0xc9a9('0x5')]},'keyType':{'type':Sequelize[_0xc9a9('0x0')](_0xc9a9('0x1'),'variable',_0xc9a9('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc9a9('0x5')]},'nameField':{'type':Sequelize[_0xc9a9('0x5')]},'customField':{'type':Sequelize[_0xc9a9('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc9a9('0x5')]}}; \ No newline at end of file +var _0x9d39=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x5153e5,_0x1b298d){var _0x47d221=function(_0x6a605e){while(--_0x6a605e){_0x5153e5['push'](_0x5153e5['shift']());}};_0x47d221(++_0x1b298d);}(_0x9d39,0x86));var _0x99d3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9d39[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x99d3('0x0'));module[_0x99d3('0x1')]={'type':{'type':Sequelize[_0x99d3('0x2')](_0x99d3('0x3'),_0x99d3('0x4'),_0x99d3('0x5'),_0x99d3('0x6'),_0x99d3('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x99d3('0x8')]},'key':{'type':Sequelize[_0x99d3('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x99d3('0x3'),_0x99d3('0x4'),_0x99d3('0x5'))},'keyContent':{'type':Sequelize[_0x99d3('0x8')]},'idField':{'type':Sequelize[_0x99d3('0x8')]},'nameField':{'type':Sequelize[_0x99d3('0x8')]},'customField':{'type':Sequelize[_0x99d3('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x99d3('0x8')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index f62a951..bc5a111 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 _0x1f0b=['key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','save','update','then','end','error','stack','name','index','map','ServicenowField','rawAttributes','fieldName','type'];(function(_0x231fd5,_0x3d869b){var _0x27e097=function(_0x39ee35){while(--_0x39ee35){_0x231fd5['push'](_0x231fd5['shift']());}};_0x27e097(++_0x3d869b);}(_0x1f0b,0xb1));var _0xb1f0=function(_0x25dd3b,_0x27e043){_0x25dd3b=_0x25dd3b-0x0;var _0x3084aa=_0x1f0b[_0x25dd3b];return _0x3084aa;};'use strict';var emlformat=require(_0xb1f0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb1f0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb1f0('0x2'));var moment=require('moment');var BPromise=require(_0xb1f0('0x3'));var Mustache=require(_0xb1f0('0x4'));var util=require('util');var path=require(_0xb1f0('0x5'));var sox=require(_0xb1f0('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb1f0('0x7'));var _=require(_0xb1f0('0x8'));var squel=require(_0xb1f0('0x9'));var crypto=require('crypto');var jsforce=require(_0xb1f0('0xa'));var deskjs=require(_0xb1f0('0xb'));var toCsv=require(_0xb1f0('0xc'));var querystring=require(_0xb1f0('0xd'));var Papa=require('papaparse');var Redis=require(_0xb1f0('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb1f0('0xf'));var hardwareService=require(_0xb1f0('0x10'));var logger=require(_0xb1f0('0x11'))(_0xb1f0('0x12'));var utils=require(_0xb1f0('0x13'));var config=require(_0xb1f0('0x14'));var licenseUtil=require(_0xb1f0('0x15'));var db=require(_0xb1f0('0x16'))['db'];function respondWithStatusCode(_0x9dc56e,_0x31068b){_0x31068b=_0x31068b||0xcc;return function(_0x534d9b){if(_0x534d9b){return _0x9dc56e[_0xb1f0('0x17')](_0x31068b);}return _0x9dc56e['status'](_0x31068b)['end']();};}function respondWithResult(_0x358e8e,_0x24e378){_0x24e378=_0x24e378||0xc8;return function(_0x5a297c){if(_0x5a297c){return _0x358e8e[_0xb1f0('0x18')](_0x24e378)['json'](_0x5a297c);}};}function respondWithFilteredResult(_0x43d63b,_0x2cda39){return function(_0x4f61f2){if(_0x4f61f2){var _0x56a5e0=typeof _0x2cda39['offset']===_0xb1f0('0x19')&&typeof _0x2cda39['limit']===_0xb1f0('0x19');var _0x287e5b=_0x4f61f2[_0xb1f0('0x1a')];var _0x265ad1=_0x56a5e0?0x0:_0x2cda39[_0xb1f0('0x1b')];var _0x1d0b09=_0x56a5e0?_0x4f61f2[_0xb1f0('0x1a')]:_0x2cda39[_0xb1f0('0x1b')]+_0x2cda39[_0xb1f0('0x1c')];var _0xac5611;if(_0x1d0b09>=_0x287e5b){_0x1d0b09=_0x287e5b;_0xac5611=0xc8;}else{_0xac5611=0xce;}_0x43d63b[_0xb1f0('0x18')](_0xac5611);return _0x43d63b[_0xb1f0('0x1d')](_0xb1f0('0x1e'),_0x265ad1+'-'+_0x1d0b09+'/'+_0x287e5b)[_0xb1f0('0x1f')](_0x4f61f2);}return null;};}function patchUpdates(_0x16055c){return function(_0x160b33){try{jsonpatch['apply'](_0x160b33,_0x16055c,!![]);}catch(_0xe1a429){return BPromise['reject'](_0xe1a429);}return _0x160b33[_0xb1f0('0x20')]();};}function saveUpdates(_0x436407,_0x22e8f2){return function(_0x29a717){if(_0x29a717){return _0x29a717[_0xb1f0('0x21')](_0x436407)[_0xb1f0('0x22')](function(_0xaf4d6e){return _0xaf4d6e;});}return null;};}function removeEntity(_0x5b9d41,_0x17acad){return function(_0x526709){if(_0x526709){return _0x526709['destroy']()['then'](function(){_0x5b9d41['status'](0xcc)[_0xb1f0('0x23')]();});}};}function handleEntityNotFound(_0xd07ba0,_0x10818f){return function(_0x747f9d){if(!_0x747f9d){_0xd07ba0[_0xb1f0('0x17')](0x194);}return _0x747f9d;};}function handleError(_0x5b59db,_0xd0a3ca){_0xd0a3ca=_0xd0a3ca||0x1f4;return function(_0x23d457){logger[_0xb1f0('0x24')](_0x23d457[_0xb1f0('0x25')]);if(_0x23d457[_0xb1f0('0x26')]){delete _0x23d457[_0xb1f0('0x26')];}_0x5b59db['status'](_0xd0a3ca)['send'](_0x23d457);};}exports[_0xb1f0('0x27')]=function(_0x8e1f6d,_0x371707){var _0x4fd473={},_0x314cb8={},_0x49b4cd={'count':0x0,'rows':[]};var _0x5e30d8=_[_0xb1f0('0x28')](db[_0xb1f0('0x29')][_0xb1f0('0x2a')],function(_0x58f342){return{'name':_0x58f342[_0xb1f0('0x2b')],'type':_0x58f342[_0xb1f0('0x2c')][_0xb1f0('0x2d')]};});_0x314cb8['model']=_['map'](_0x5e30d8,'name');_0x314cb8[_0xb1f0('0x2e')]=_[_0xb1f0('0x2f')](_0x8e1f6d[_0xb1f0('0x2e')]);_0x314cb8[_0xb1f0('0x30')]=_[_0xb1f0('0x31')](_0x314cb8[_0xb1f0('0x32')],_0x314cb8[_0xb1f0('0x2e')]);_0x4fd473['attributes']=_['intersection'](_0x314cb8[_0xb1f0('0x32')],qs[_0xb1f0('0x33')](_0x8e1f6d[_0xb1f0('0x2e')]['fields']));_0x4fd473[_0xb1f0('0x34')]=_0x4fd473[_0xb1f0('0x34')][_0xb1f0('0x35')]?_0x4fd473[_0xb1f0('0x34')]:_0x314cb8[_0xb1f0('0x32')];if(!_0x8e1f6d[_0xb1f0('0x2e')][_0xb1f0('0x36')](_0xb1f0('0x37'))){_0x4fd473['limit']=qs[_0xb1f0('0x1c')](_0x8e1f6d[_0xb1f0('0x2e')][_0xb1f0('0x1c')]);_0x4fd473[_0xb1f0('0x1b')]=qs[_0xb1f0('0x1b')](_0x8e1f6d[_0xb1f0('0x2e')][_0xb1f0('0x1b')]);}_0x4fd473[_0xb1f0('0x38')]=qs[_0xb1f0('0x39')](_0x8e1f6d[_0xb1f0('0x2e')][_0xb1f0('0x39')]);_0x4fd473[_0xb1f0('0x3a')]=qs[_0xb1f0('0x30')](_[_0xb1f0('0x3b')](_0x8e1f6d[_0xb1f0('0x2e')],_0x314cb8[_0xb1f0('0x30')]),_0x5e30d8);if(_0x8e1f6d['query']['filter']){_0x4fd473[_0xb1f0('0x3a')]=_['merge'](_0x4fd473[_0xb1f0('0x3a')],{'$or':_[_0xb1f0('0x28')](_0x5e30d8,function(_0x1da4dc){if(_0x1da4dc[_0xb1f0('0x2c')]!==_0xb1f0('0x3c')){var _0x6c18d3={};_0x6c18d3[_0x1da4dc[_0xb1f0('0x26')]]={'$like':'%'+_0x8e1f6d[_0xb1f0('0x2e')][_0xb1f0('0x3d')]+'%'};return _0x6c18d3;}})});}_0x4fd473=_[_0xb1f0('0x3e')]({},_0x4fd473,_0x8e1f6d[_0xb1f0('0x3f')]);var _0x5f4e34={'where':_0x4fd473[_0xb1f0('0x3a')]};return db[_0xb1f0('0x29')][_0xb1f0('0x1a')](_0x5f4e34)['then'](function(_0x5b3021){_0x49b4cd['count']=_0x5b3021;if(_0x8e1f6d[_0xb1f0('0x2e')]['includeAll']){_0x4fd473[_0xb1f0('0x40')]=[{'all':!![]}];}return db[_0xb1f0('0x29')][_0xb1f0('0x41')](_0x4fd473);})['then'](function(_0x33d398){_0x49b4cd[_0xb1f0('0x42')]=_0x33d398;return _0x49b4cd;})[_0xb1f0('0x22')](respondWithFilteredResult(_0x371707,_0x4fd473))[_0xb1f0('0x43')](handleError(_0x371707,null));};exports[_0xb1f0('0x44')]=function(_0x58649f,_0x1ace97){var _0x208571={'raw':!![],'where':{'id':_0x58649f[_0xb1f0('0x45')]['id']}},_0x5ec736={};_0x5ec736[_0xb1f0('0x32')]=_['keys'](db['ServicenowField'][_0xb1f0('0x2a')]);_0x5ec736[_0xb1f0('0x2e')]=_[_0xb1f0('0x2f')](_0x58649f[_0xb1f0('0x2e')]);_0x5ec736['filters']=_[_0xb1f0('0x31')](_0x5ec736['model'],_0x5ec736['query']);_0x208571[_0xb1f0('0x34')]=_[_0xb1f0('0x31')](_0x5ec736['model'],qs['fields'](_0x58649f['query'][_0xb1f0('0x33')]));_0x208571[_0xb1f0('0x34')]=_0x208571['attributes'][_0xb1f0('0x35')]?_0x208571[_0xb1f0('0x34')]:_0x5ec736[_0xb1f0('0x32')];if(_0x58649f[_0xb1f0('0x2e')][_0xb1f0('0x46')]){_0x208571[_0xb1f0('0x40')]=[{'all':!![]}];}_0x208571=_[_0xb1f0('0x3e')]({},_0x208571,_0x58649f[_0xb1f0('0x3f')]);return db[_0xb1f0('0x29')][_0xb1f0('0x47')](_0x208571)['then'](handleEntityNotFound(_0x1ace97,null))[_0xb1f0('0x22')](respondWithResult(_0x1ace97,null))[_0xb1f0('0x43')](handleError(_0x1ace97,null));};exports[_0xb1f0('0x48')]=function(_0x343c47,_0x22947a){return db[_0xb1f0('0x29')][_0xb1f0('0x48')](_0x343c47['body'],{})['then'](respondWithResult(_0x22947a,0xc9))[_0xb1f0('0x43')](handleError(_0x22947a,null));};exports[_0xb1f0('0x21')]=function(_0x34fa8b,_0x4194d9){if(_0x34fa8b['body']['id']){delete _0x34fa8b[_0xb1f0('0x49')]['id'];}return db[_0xb1f0('0x29')]['find']({'where':{'id':_0x34fa8b[_0xb1f0('0x45')]['id']}})[_0xb1f0('0x22')](handleEntityNotFound(_0x4194d9,null))[_0xb1f0('0x22')](saveUpdates(_0x34fa8b[_0xb1f0('0x49')],null))[_0xb1f0('0x22')](respondWithResult(_0x4194d9,null))[_0xb1f0('0x43')](handleError(_0x4194d9,null));};exports['destroy']=function(_0x3c0eba,_0x2b871f){return db[_0xb1f0('0x29')][_0xb1f0('0x47')]({'where':{'id':_0x3c0eba['params']['id']}})['then'](handleEntityNotFound(_0x2b871f,null))[_0xb1f0('0x22')](removeEntity(_0x2b871f,null))[_0xb1f0('0x43')](handleError(_0x2b871f,null));}; \ No newline at end of file +var _0x54ac=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','ServicenowField','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','filters','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x54ac,0x161));var _0xc54a=function(_0x1a73f7,_0x274c12){_0x1a73f7=_0x1a73f7-0x0;var _0x3570fa=_0x54ac[_0x1a73f7];return _0x3570fa;};'use strict';var emlformat=require(_0xc54a('0x0'));var rimraf=require(_0xc54a('0x1'));var zipdir=require(_0xc54a('0x2'));var jsonpatch=require(_0xc54a('0x3'));var rp=require('request-promise');var moment=require(_0xc54a('0x4'));var BPromise=require(_0xc54a('0x5'));var Mustache=require(_0xc54a('0x6'));var util=require('util');var path=require(_0xc54a('0x7'));var sox=require('sox');var csv=require(_0xc54a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc54a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc54a('0xa'));var jsforce=require(_0xc54a('0xb'));var deskjs=require(_0xc54a('0xc'));var toCsv=require(_0xc54a('0x8'));var querystring=require('querystring');var Papa=require(_0xc54a('0xd'));var Redis=require(_0xc54a('0xe'));var authService=require(_0xc54a('0xf'));var qs=require(_0xc54a('0x10'));var as=require(_0xc54a('0x11'));var hardwareService=require(_0xc54a('0x12'));var logger=require(_0xc54a('0x13'))(_0xc54a('0x14'));var utils=require(_0xc54a('0x15'));var config=require(_0xc54a('0x16'));var licenseUtil=require(_0xc54a('0x17'));var db=require(_0xc54a('0x18'))['db'];function respondWithStatusCode(_0x45ba73,_0x5cb028){_0x5cb028=_0x5cb028||0xcc;return function(_0xddc02){if(_0xddc02){return _0x45ba73[_0xc54a('0x19')](_0x5cb028);}return _0x45ba73[_0xc54a('0x1a')](_0x5cb028)[_0xc54a('0x1b')]();};}function respondWithResult(_0x4211d8,_0x468dc2){_0x468dc2=_0x468dc2||0xc8;return function(_0x5f0fbd){if(_0x5f0fbd){return _0x4211d8['status'](_0x468dc2)[_0xc54a('0x1c')](_0x5f0fbd);}};}function respondWithFilteredResult(_0x5f4644,_0x1e53c5){return function(_0x5d550d){if(_0x5d550d){var _0x4131b3=typeof _0x1e53c5[_0xc54a('0x1d')]===_0xc54a('0x1e')&&typeof _0x1e53c5['limit']===_0xc54a('0x1e');var _0x9e913b=_0x5d550d[_0xc54a('0x1f')];var _0x297902=_0x4131b3?0x0:_0x1e53c5['offset'];var _0x18dccf=_0x4131b3?_0x5d550d[_0xc54a('0x1f')]:_0x1e53c5[_0xc54a('0x1d')]+_0x1e53c5[_0xc54a('0x20')];var _0x548c55;if(_0x18dccf>=_0x9e913b){_0x18dccf=_0x9e913b;_0x548c55=0xc8;}else{_0x548c55=0xce;}_0x5f4644['status'](_0x548c55);return _0x5f4644[_0xc54a('0x21')](_0xc54a('0x22'),_0x297902+'-'+_0x18dccf+'/'+_0x9e913b)[_0xc54a('0x1c')](_0x5d550d);}return null;};}function patchUpdates(_0x206204){return function(_0x4660f5){try{jsonpatch[_0xc54a('0x23')](_0x4660f5,_0x206204,!![]);}catch(_0x39063d){return BPromise[_0xc54a('0x24')](_0x39063d);}return _0x4660f5['save']();};}function saveUpdates(_0x4da273,_0x57105d){return function(_0x26c033){if(_0x26c033){return _0x26c033[_0xc54a('0x25')](_0x4da273)[_0xc54a('0x26')](function(_0x1df6e5){return _0x1df6e5;});}return null;};}function removeEntity(_0x160176,_0x10d19e){return function(_0x88f0ec){if(_0x88f0ec){return _0x88f0ec[_0xc54a('0x27')]()['then'](function(){_0x160176[_0xc54a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1aed1a,_0x2f02b0){return function(_0x16cc35){if(!_0x16cc35){_0x1aed1a[_0xc54a('0x19')](0x194);}return _0x16cc35;};}function handleError(_0x310b40,_0x1d8416){_0x1d8416=_0x1d8416||0x1f4;return function(_0x222eb1){logger[_0xc54a('0x28')](_0x222eb1[_0xc54a('0x29')]);if(_0x222eb1[_0xc54a('0x2a')]){delete _0x222eb1[_0xc54a('0x2a')];}_0x310b40[_0xc54a('0x1a')](_0x1d8416)['send'](_0x222eb1);};}exports['index']=function(_0x353d41,_0xe399fe){var _0x3b070f={},_0x4353e6={},_0x22bb28={'count':0x0,'rows':[]};var _0x2c3e94=_['map'](db[_0xc54a('0x2b')][_0xc54a('0x2c')],function(_0x4be52c){return{'name':_0x4be52c[_0xc54a('0x2d')],'type':_0x4be52c[_0xc54a('0x2e')][_0xc54a('0x2f')]};});_0x4353e6[_0xc54a('0x30')]=_[_0xc54a('0x31')](_0x2c3e94,_0xc54a('0x2a'));_0x4353e6[_0xc54a('0x32')]=_['keys'](_0x353d41[_0xc54a('0x32')]);_0x4353e6['filters']=_['intersection'](_0x4353e6[_0xc54a('0x30')],_0x4353e6[_0xc54a('0x32')]);_0x3b070f[_0xc54a('0x33')]=_[_0xc54a('0x34')](_0x4353e6[_0xc54a('0x30')],qs[_0xc54a('0x35')](_0x353d41['query']['fields']));_0x3b070f[_0xc54a('0x33')]=_0x3b070f['attributes'][_0xc54a('0x36')]?_0x3b070f[_0xc54a('0x33')]:_0x4353e6[_0xc54a('0x30')];if(!_0x353d41[_0xc54a('0x32')][_0xc54a('0x37')](_0xc54a('0x38'))){_0x3b070f[_0xc54a('0x20')]=qs[_0xc54a('0x20')](_0x353d41[_0xc54a('0x32')]['limit']);_0x3b070f[_0xc54a('0x1d')]=qs['offset'](_0x353d41[_0xc54a('0x32')][_0xc54a('0x1d')]);}_0x3b070f[_0xc54a('0x39')]=qs['sort'](_0x353d41[_0xc54a('0x32')]['sort']);_0x3b070f['where']=qs['filters'](_['pick'](_0x353d41[_0xc54a('0x32')],_0x4353e6[_0xc54a('0x3a')]),_0x2c3e94);if(_0x353d41[_0xc54a('0x32')][_0xc54a('0x3b')]){_0x3b070f[_0xc54a('0x3c')]=_['merge'](_0x3b070f[_0xc54a('0x3c')],{'$or':_[_0xc54a('0x31')](_0x2c3e94,function(_0x4cc35a){if(_0x4cc35a['type']!==_0xc54a('0x3d')){var _0x5d760c={};_0x5d760c[_0x4cc35a[_0xc54a('0x2a')]]={'$like':'%'+_0x353d41[_0xc54a('0x32')][_0xc54a('0x3b')]+'%'};return _0x5d760c;}})});}_0x3b070f=_[_0xc54a('0x3e')]({},_0x3b070f,_0x353d41[_0xc54a('0x3f')]);var _0x37f53a={'where':_0x3b070f['where']};return db[_0xc54a('0x2b')][_0xc54a('0x1f')](_0x37f53a)[_0xc54a('0x26')](function(_0x42e15b){_0x22bb28[_0xc54a('0x1f')]=_0x42e15b;if(_0x353d41[_0xc54a('0x32')][_0xc54a('0x40')]){_0x3b070f[_0xc54a('0x41')]=[{'all':!![]}];}return db[_0xc54a('0x2b')][_0xc54a('0x42')](_0x3b070f);})[_0xc54a('0x26')](function(_0xa4ca98){_0x22bb28[_0xc54a('0x43')]=_0xa4ca98;return _0x22bb28;})[_0xc54a('0x26')](respondWithFilteredResult(_0xe399fe,_0x3b070f))[_0xc54a('0x44')](handleError(_0xe399fe,null));};exports[_0xc54a('0x45')]=function(_0x4283eb,_0x147a43){var _0x1bf3b1={'raw':!![],'where':{'id':_0x4283eb[_0xc54a('0x46')]['id']}},_0x23ae6b={};_0x23ae6b[_0xc54a('0x30')]=_['keys'](db[_0xc54a('0x2b')][_0xc54a('0x2c')]);_0x23ae6b[_0xc54a('0x32')]=_[_0xc54a('0x47')](_0x4283eb[_0xc54a('0x32')]);_0x23ae6b[_0xc54a('0x3a')]=_[_0xc54a('0x34')](_0x23ae6b[_0xc54a('0x30')],_0x23ae6b['query']);_0x1bf3b1['attributes']=_['intersection'](_0x23ae6b[_0xc54a('0x30')],qs[_0xc54a('0x35')](_0x4283eb[_0xc54a('0x32')][_0xc54a('0x35')]));_0x1bf3b1[_0xc54a('0x33')]=_0x1bf3b1[_0xc54a('0x33')]['length']?_0x1bf3b1['attributes']:_0x23ae6b[_0xc54a('0x30')];if(_0x4283eb['query'][_0xc54a('0x40')]){_0x1bf3b1[_0xc54a('0x41')]=[{'all':!![]}];}_0x1bf3b1=_[_0xc54a('0x3e')]({},_0x1bf3b1,_0x4283eb['options']);return db['ServicenowField'][_0xc54a('0x48')](_0x1bf3b1)['then'](handleEntityNotFound(_0x147a43,null))[_0xc54a('0x26')](respondWithResult(_0x147a43,null))['catch'](handleError(_0x147a43,null));};exports[_0xc54a('0x49')]=function(_0x45a41,_0x302692){return db[_0xc54a('0x2b')][_0xc54a('0x49')](_0x45a41[_0xc54a('0x4a')],{})[_0xc54a('0x26')](respondWithResult(_0x302692,0xc9))[_0xc54a('0x44')](handleError(_0x302692,null));};exports['update']=function(_0x39d3bf,_0x54d833){if(_0x39d3bf[_0xc54a('0x4a')]['id']){delete _0x39d3bf[_0xc54a('0x4a')]['id'];}return db[_0xc54a('0x2b')]['find']({'where':{'id':_0x39d3bf['params']['id']}})['then'](handleEntityNotFound(_0x54d833,null))[_0xc54a('0x26')](saveUpdates(_0x39d3bf[_0xc54a('0x4a')],null))[_0xc54a('0x26')](respondWithResult(_0x54d833,null))[_0xc54a('0x44')](handleError(_0x54d833,null));};exports[_0xc54a('0x27')]=function(_0x3c1f1e,_0x34a32b){return db[_0xc54a('0x2b')][_0xc54a('0x48')]({'where':{'id':_0x3c1f1e['params']['id']}})[_0xc54a('0x26')](handleEntityNotFound(_0x34a32b,null))[_0xc54a('0x26')](removeEntity(_0x34a32b,null))['catch'](handleError(_0x34a32b,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index a2254ba..44db93d 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 _0x93c9=['bluebird','request-promise','../../config/environment','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','moment'];(function(_0x31026b,_0x585c1f){var _0x449e9a=function(_0x55c8b8){while(--_0x55c8b8){_0x31026b['push'](_0x31026b['shift']());}};_0x449e9a(++_0x585c1f);}(_0x93c9,0x1e9));var _0x993c=function(_0x75b621,_0x288def){_0x75b621=_0x75b621-0x0;var _0x1bcb38=_0x93c9[_0x75b621];return _0x1bcb38;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x993c('0x0'));var BPromise=require(_0x993c('0x1'));var rp=require(_0x993c('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x993c('0x3'));var attributes=require(_0x993c('0x4'));module['exports']=function(_0x3c6568,_0x676429){return _0x3c6568[_0x993c('0x5')](_0x993c('0x6'),attributes,{'tableName':_0x993c('0x7'),'paranoid':![],'indexes':[{'name':_0x993c('0x8'),'fields':['idField',_0x993c('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1da3=['int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','request-promise','../../config/environment','./intServicenowField.attributes','exports','define'];(function(_0xfec4f2,_0x27b2aa){var _0x4ee052=function(_0x195ba5){while(--_0x195ba5){_0xfec4f2['push'](_0xfec4f2['shift']());}};_0x4ee052(++_0x27b2aa);}(_0x1da3,0x156));var _0x31da=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x1da3[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x31da('0x0'));var util=require(_0x31da('0x1'));var logger=require(_0x31da('0x2'))('api');var moment=require(_0x31da('0x3'));var BPromise=require('bluebird');var rp=require(_0x31da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x31da('0x5'));var attributes=require(_0x31da('0x6'));module[_0x31da('0x7')]=function(_0x53081b,_0x4c6389){return _0x53081b[_0x31da('0x8')]('ServicenowField',attributes,{'tableName':_0x31da('0x9'),'paranoid':![],'indexes':[{'name':_0x31da('0xa'),'fields':[_0x31da('0xb'),_0x31da('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 549a834..ea3848e 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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x31c6b6,_0xdd33b7){var _0x32b27b=function(_0x32f195){while(--_0x32f195){_0x31c6b6['push'](_0x31c6b6['shift']());}};_0x32b27b(++_0xdd33b7);}(_0xaa88,0x137));var _0x8aa8=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xaa88[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x1270f5,_0x31313e){var _0x45a30e=function(_0x5f56c5){while(--_0x5f56c5){_0x1270f5['push'](_0x1270f5['shift']());}};_0x45a30e(++_0x31313e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xb7e7[_0x55abd9];return _0x3e5669;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 9b99e2e..e648fac 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x586d1a,_0x35296e){var _0x227b09=function(_0x2f27e3){while(--_0x2f27e3){_0x586d1a['push'](_0x586d1a['shift']());}};_0x227b09(++_0x35296e);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _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(_0x392de9,_0x94b377){var _0x984fd9=function(_0x842c6a){while(--_0x842c6a){_0x392de9['push'](_0x392de9['shift']());}};_0x984fd9(++_0x94b377);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 dca2202..1962a9a 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(_0x16edd0,_0x19e433){var _0x4320e3=function(_0x18f068){while(--_0x18f068){_0x16edd0['push'](_0x16edd0['shift']());}};_0x4320e3(++_0x19e433);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x52890c,_0x3c7d66){var _0x14ebba=function(_0x422608){while(--_0x422608){_0x52890c['push'](_0x52890c['shift']());}};_0x14ebba(++_0x3c7d66);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 2e4c44b..3e98284 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 _0xd8c4=['merge','options','includeAll','include','findAll','then','catch','show','params','create','body','find','getConfigurations','findOne','hasOwnProperty','addConfiguration','Subjects','getDescriptions','channel','SugarcrmConfiguration','SugarcrmField','Descriptions','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','POST','format','/service/v4_1/rest.php','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','%s%s','get_module_fields','Calls','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','json','apply','save','update','destroy','end','error','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','pick','filter','where'];(function(_0x32a81f,_0x4eee66){var _0x5b67a2=function(_0x35d368){while(--_0x35d368){_0x32a81f['push'](_0x32a81f['shift']());}};_0x5b67a2(++_0x4eee66);}(_0xd8c4,0x126));var _0x4d8c=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xd8c4[_0x2b9b7f];return _0x4ed19a;};'use strict';var emlformat=require(_0x4d8c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4d8c('0x1'));var rp=require(_0x4d8c('0x2'));var moment=require(_0x4d8c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4d8c('0x4'));var util=require(_0x4d8c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x4d8c('0x6'));var ejs=require(_0x4d8c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d8c('0x8'));var squel=require(_0x4d8c('0x9'));var crypto=require('crypto');var jsforce=require(_0x4d8c('0xa'));var deskjs=require(_0x4d8c('0xb'));var toCsv=require(_0x4d8c('0x6'));var querystring=require(_0x4d8c('0xc'));var Papa=require(_0x4d8c('0xd'));var Redis=require(_0x4d8c('0xe'));var authService=require(_0x4d8c('0xf'));var qs=require(_0x4d8c('0x10'));var as=require(_0x4d8c('0x11'));var hardwareService=require(_0x4d8c('0x12'));var logger=require(_0x4d8c('0x13'))(_0x4d8c('0x14'));var utils=require('../../config/utils');var config=require(_0x4d8c('0x15'));var licenseUtil=require(_0x4d8c('0x16'));var db=require(_0x4d8c('0x17'))['db'];var integrations=require(_0x4d8c('0x18'));function respondWithStatusCode(_0x90299b,_0x1656fb){_0x1656fb=_0x1656fb||0xcc;return function(_0x392180){if(_0x392180){return _0x90299b[_0x4d8c('0x19')](_0x1656fb);}return _0x90299b[_0x4d8c('0x1a')](_0x1656fb)['end']();};}function respondWithResult(_0x111b95,_0x11e7f4){_0x11e7f4=_0x11e7f4||0xc8;return function(_0x381e91){if(_0x381e91){return _0x111b95[_0x4d8c('0x1a')](_0x11e7f4)['json'](_0x381e91);}};}function respondWithFilteredResult(_0x5c0546,_0x190172){return function(_0x1ca739){if(_0x1ca739){var _0x5b8397=typeof _0x190172[_0x4d8c('0x1b')]===_0x4d8c('0x1c')&&typeof _0x190172[_0x4d8c('0x1d')]==='undefined';var _0x31a7c2=_0x1ca739['count'];var _0x57e6fc=_0x5b8397?0x0:_0x190172[_0x4d8c('0x1b')];var _0x1577db=_0x5b8397?_0x1ca739[_0x4d8c('0x1e')]:_0x190172[_0x4d8c('0x1b')]+_0x190172[_0x4d8c('0x1d')];var _0x314f73;if(_0x1577db>=_0x31a7c2){_0x1577db=_0x31a7c2;_0x314f73=0xc8;}else{_0x314f73=0xce;}_0x5c0546[_0x4d8c('0x1a')](_0x314f73);return _0x5c0546[_0x4d8c('0x1f')]('Content-Range',_0x57e6fc+'-'+_0x1577db+'/'+_0x31a7c2)[_0x4d8c('0x20')](_0x1ca739);}return null;};}function patchUpdates(_0x4a5c36){return function(_0x3e9e2d){try{jsonpatch[_0x4d8c('0x21')](_0x3e9e2d,_0x4a5c36,!![]);}catch(_0x1bdee9){return BPromise['reject'](_0x1bdee9);}return _0x3e9e2d[_0x4d8c('0x22')]();};}function saveUpdates(_0x1dfac9,_0x240c90){return function(_0x4a4e28){if(_0x4a4e28){return _0x4a4e28[_0x4d8c('0x23')](_0x1dfac9)['then'](function(_0x37f41e){return _0x37f41e;});}return null;};}function removeEntity(_0x5aa9ab,_0xbc53e0){return function(_0x98da94){if(_0x98da94){return _0x98da94[_0x4d8c('0x24')]()['then'](function(){_0x5aa9ab[_0x4d8c('0x1a')](0xcc)[_0x4d8c('0x25')]();});}};}function handleEntityNotFound(_0x8b38c6,_0xddbe86){return function(_0x5acacc){if(!_0x5acacc){_0x8b38c6[_0x4d8c('0x19')](0x194);}return _0x5acacc;};}function handleError(_0x5eddf2,_0x337dbd){_0x337dbd=_0x337dbd||0x1f4;return function(_0x39662e){logger[_0x4d8c('0x26')](_0x39662e['stack']);if(_0x39662e[_0x4d8c('0x27')]){delete _0x39662e[_0x4d8c('0x27')];}_0x5eddf2['status'](_0x337dbd)[_0x4d8c('0x28')](_0x39662e);};}exports[_0x4d8c('0x29')]=function(_0x8bbdec,_0x320b9f){var _0x169eab={},_0xaf3b55={},_0x5f0277={'count':0x0,'rows':[]};var _0x43b3de=_[_0x4d8c('0x2a')](db[_0x4d8c('0x2b')][_0x4d8c('0x2c')],function(_0x180799){return{'name':_0x180799[_0x4d8c('0x2d')],'type':_0x180799[_0x4d8c('0x2e')]['key']};});_0xaf3b55['model']=_[_0x4d8c('0x2a')](_0x43b3de,'name');_0xaf3b55['query']=_[_0x4d8c('0x2f')](_0x8bbdec[_0x4d8c('0x30')]);_0xaf3b55[_0x4d8c('0x31')]=_[_0x4d8c('0x32')](_0xaf3b55[_0x4d8c('0x33')],_0xaf3b55[_0x4d8c('0x30')]);_0x169eab[_0x4d8c('0x34')]=_[_0x4d8c('0x32')](_0xaf3b55[_0x4d8c('0x33')],qs[_0x4d8c('0x35')](_0x8bbdec[_0x4d8c('0x30')]['fields']));_0x169eab[_0x4d8c('0x34')]=_0x169eab['attributes'][_0x4d8c('0x36')]?_0x169eab[_0x4d8c('0x34')]:_0xaf3b55['model'];if(!_0x8bbdec[_0x4d8c('0x30')]['hasOwnProperty'](_0x4d8c('0x37'))){_0x169eab[_0x4d8c('0x1d')]=qs['limit'](_0x8bbdec[_0x4d8c('0x30')]['limit']);_0x169eab[_0x4d8c('0x1b')]=qs[_0x4d8c('0x1b')](_0x8bbdec[_0x4d8c('0x30')]['offset']);}_0x169eab['order']=qs[_0x4d8c('0x38')](_0x8bbdec[_0x4d8c('0x30')][_0x4d8c('0x38')]);_0x169eab['where']=qs[_0x4d8c('0x31')](_[_0x4d8c('0x39')](_0x8bbdec[_0x4d8c('0x30')],_0xaf3b55['filters']),_0x43b3de);if(_0x8bbdec[_0x4d8c('0x30')][_0x4d8c('0x3a')]){_0x169eab[_0x4d8c('0x3b')]=_['merge'](_0x169eab['where'],{'$or':_[_0x4d8c('0x2a')](_0x43b3de,function(_0x296657){if(_0x296657['type']!=='VIRTUAL'){var _0xa5f5e={};_0xa5f5e[_0x296657['name']]={'$like':'%'+_0x8bbdec[_0x4d8c('0x30')][_0x4d8c('0x3a')]+'%'};return _0xa5f5e;}})});}_0x169eab=_[_0x4d8c('0x3c')]({},_0x169eab,_0x8bbdec[_0x4d8c('0x3d')]);var _0x470085={'where':_0x169eab[_0x4d8c('0x3b')]};return db['SugarcrmAccount'][_0x4d8c('0x1e')](_0x470085)['then'](function(_0x447e12){_0x5f0277[_0x4d8c('0x1e')]=_0x447e12;if(_0x8bbdec[_0x4d8c('0x30')][_0x4d8c('0x3e')]){_0x169eab[_0x4d8c('0x3f')]=[{'all':!![]}];}return db[_0x4d8c('0x2b')][_0x4d8c('0x40')](_0x169eab);})[_0x4d8c('0x41')](function(_0x89d212){_0x5f0277['rows']=_0x89d212;return _0x5f0277;})['then'](respondWithFilteredResult(_0x320b9f,_0x169eab))[_0x4d8c('0x42')](handleError(_0x320b9f,null));};exports[_0x4d8c('0x43')]=function(_0x38f3b0,_0x56b0aa){var _0x2cf8f5={'raw':![],'where':{'id':_0x38f3b0[_0x4d8c('0x44')]['id']}},_0x3072da={};_0x3072da[_0x4d8c('0x33')]=_['keys'](db[_0x4d8c('0x2b')]['rawAttributes']);_0x3072da[_0x4d8c('0x30')]=_[_0x4d8c('0x2f')](_0x38f3b0[_0x4d8c('0x30')]);_0x3072da['filters']=_[_0x4d8c('0x32')](_0x3072da[_0x4d8c('0x33')],_0x3072da[_0x4d8c('0x30')]);_0x2cf8f5[_0x4d8c('0x34')]=_[_0x4d8c('0x32')](_0x3072da[_0x4d8c('0x33')],qs[_0x4d8c('0x35')](_0x38f3b0[_0x4d8c('0x30')][_0x4d8c('0x35')]));_0x2cf8f5[_0x4d8c('0x34')]=_0x2cf8f5['attributes'][_0x4d8c('0x36')]?_0x2cf8f5[_0x4d8c('0x34')]:_0x3072da[_0x4d8c('0x33')];if(_0x38f3b0[_0x4d8c('0x30')][_0x4d8c('0x3e')]){_0x2cf8f5['include']=[{'all':!![]}];}_0x2cf8f5=_[_0x4d8c('0x3c')]({},_0x2cf8f5,_0x38f3b0[_0x4d8c('0x3d')]);return db[_0x4d8c('0x2b')]['find'](_0x2cf8f5)[_0x4d8c('0x41')](handleEntityNotFound(_0x56b0aa,null))['then'](respondWithResult(_0x56b0aa,null))['catch'](handleError(_0x56b0aa,null));};exports[_0x4d8c('0x45')]=function(_0x3f0b89,_0x415000){return db['SugarcrmAccount'][_0x4d8c('0x45')](_0x3f0b89[_0x4d8c('0x46')],{})['then'](respondWithResult(_0x415000,0xc9))['catch'](handleError(_0x415000,null));};exports[_0x4d8c('0x23')]=function(_0x189710,_0x5ab296){if(_0x189710[_0x4d8c('0x46')]['id']){delete _0x189710['body']['id'];}return db[_0x4d8c('0x2b')][_0x4d8c('0x47')]({'where':{'id':_0x189710[_0x4d8c('0x44')]['id']}})[_0x4d8c('0x41')](handleEntityNotFound(_0x5ab296,null))[_0x4d8c('0x41')](saveUpdates(_0x189710[_0x4d8c('0x46')],null))[_0x4d8c('0x41')](respondWithResult(_0x5ab296,null))[_0x4d8c('0x42')](handleError(_0x5ab296,null));};exports['destroy']=function(_0x4637b0,_0x51d954){return db[_0x4d8c('0x2b')][_0x4d8c('0x47')]({'where':{'id':_0x4637b0[_0x4d8c('0x44')]['id']}})[_0x4d8c('0x41')](handleEntityNotFound(_0x51d954,null))[_0x4d8c('0x41')](removeEntity(_0x51d954,null))['catch'](handleError(_0x51d954,null));};exports[_0x4d8c('0x48')]=function(_0x227227,_0x55cf02,_0x6eed6f){var _0x30278a={};var _0x56a51a={};var _0x217f06;var _0x1eb1ec;return db['SugarcrmAccount'][_0x4d8c('0x49')]({'where':{'id':_0x227227[_0x4d8c('0x44')]['id']}})[_0x4d8c('0x41')](handleEntityNotFound(_0x55cf02,null))[_0x4d8c('0x41')](function(_0x475caf){if(_0x475caf){_0x217f06=_0x475caf;_0x56a51a[_0x4d8c('0x33')]=_[_0x4d8c('0x2f')](db['SugarcrmConfiguration']['rawAttributes']);_0x56a51a[_0x4d8c('0x30')]=_[_0x4d8c('0x2f')](_0x227227['query']);_0x56a51a[_0x4d8c('0x31')]=_['intersection'](_0x56a51a[_0x4d8c('0x33')],_0x56a51a[_0x4d8c('0x30')]);_0x30278a[_0x4d8c('0x34')]=_[_0x4d8c('0x32')](_0x56a51a[_0x4d8c('0x33')],qs[_0x4d8c('0x35')](_0x227227[_0x4d8c('0x30')][_0x4d8c('0x35')]));_0x30278a[_0x4d8c('0x34')]=_0x30278a['attributes'][_0x4d8c('0x36')]?_0x30278a[_0x4d8c('0x34')]:_0x56a51a['model'];_0x30278a['order']=qs[_0x4d8c('0x38')](_0x227227['query'][_0x4d8c('0x38')]);_0x30278a[_0x4d8c('0x3b')]=qs[_0x4d8c('0x31')](_[_0x4d8c('0x39')](_0x227227[_0x4d8c('0x30')],_0x56a51a[_0x4d8c('0x31')]));if(_0x227227[_0x4d8c('0x30')][_0x4d8c('0x3a')]){_0x30278a['where']=_[_0x4d8c('0x3c')](_0x30278a['where'],{'$or':_[_0x4d8c('0x2a')](_0x30278a[_0x4d8c('0x34')],function(_0x1c6188){var _0x53ed90={};_0x53ed90[_0x1c6188]={'$like':'%'+_0x227227[_0x4d8c('0x30')][_0x4d8c('0x3a')]+'%'};return _0x53ed90;})});}_0x30278a=_['merge']({},_0x30278a,_0x227227[_0x4d8c('0x3d')]);return _0x217f06[_0x4d8c('0x48')](_0x30278a);}})[_0x4d8c('0x41')](function(_0x20ad20){if(_0x20ad20){_0x1eb1ec=_0x20ad20[_0x4d8c('0x36')];if(!_0x227227['query'][_0x4d8c('0x4a')](_0x4d8c('0x37'))){_0x30278a[_0x4d8c('0x1d')]=qs[_0x4d8c('0x1d')](_0x227227[_0x4d8c('0x30')]['limit']);_0x30278a[_0x4d8c('0x1b')]=qs['offset'](_0x227227['query'][_0x4d8c('0x1b')]);}return _0x217f06[_0x4d8c('0x48')](_0x30278a);}})[_0x4d8c('0x41')](function(_0x3de875){if(_0x3de875){return _0x3de875?{'count':_0x1eb1ec,'rows':_0x3de875}:null;}})['then'](respondWithResult(_0x55cf02,null))[_0x4d8c('0x42')](handleError(_0x55cf02,null));};exports[_0x4d8c('0x4b')]=function(_0x42641a,_0x697a9a,_0x56a301){if(_0x42641a[_0x4d8c('0x46')]['id']){delete _0x42641a['body']['id'];}return db[_0x4d8c('0x2b')][_0x4d8c('0x49')]({'where':{'id':_0x42641a[_0x4d8c('0x44')]['id']}})[_0x4d8c('0x41')](handleEntityNotFound(_0x697a9a,null))[_0x4d8c('0x41')](function(_0x5d5a76){if(_0x5d5a76){_0x42641a['body']['AccountId']=_0x5d5a76['id'];_0x42641a[_0x4d8c('0x46')][_0x4d8c('0x4c')]=integrations['getSubjects'](_0x42641a[_0x4d8c('0x46')]['channel'],_0x42641a[_0x4d8c('0x46')][_0x4d8c('0x2e')]);_0x42641a[_0x4d8c('0x46')]['Descriptions']=integrations[_0x4d8c('0x4d')](_0x42641a['body'][_0x4d8c('0x4e')],_0x42641a['body'][_0x4d8c('0x2e')]);return db[_0x4d8c('0x4f')][_0x4d8c('0x45')](_0x42641a[_0x4d8c('0x46')],{'include':[{'model':db['SugarcrmField'],'as':_0x4d8c('0x4c')},{'model':db[_0x4d8c('0x50')],'as':_0x4d8c('0x51')}]});}return null;})[_0x4d8c('0x41')](respondWithResult(_0x697a9a,null))[_0x4d8c('0x42')](handleError(_0x697a9a,null));};exports[_0x4d8c('0x52')]=function(_0x4de76c,_0x23ee11,_0x199b8a){var _0x10f147='';var _0x5f3826=['id',_0x4d8c('0x27'),'assigned_user_id',_0x4d8c('0x53'),_0x4d8c('0x54'),_0x4d8c('0x55'),_0x4d8c('0x56'),_0x4d8c('0x57'),_0x4d8c('0x58'),_0x4d8c('0x59'),_0x4d8c('0x5a'),_0x4d8c('0x5b')];return db[_0x4d8c('0x2b')][_0x4d8c('0x49')]({'where':{'id':_0x4de76c[_0x4d8c('0x44')]['id']},'attributes':['id',_0x4d8c('0x5c'),_0x4d8c('0x5d'),_0x4d8c('0x5e')]})['then'](handleEntityNotFound(_0x23ee11,null))[_0x4d8c('0x41')](function(_0x2ba8f4){if(_0x2ba8f4){_0x10f147=_0x2ba8f4[_0x4d8c('0x5e')];var _0x4e5ecb=_0x10f147[_0x4d8c('0x5f')](-0x1);if(_0x4e5ecb==='/'){_0x10f147=_0x10f147[_0x4d8c('0x60')](0x0,_0x10f147['lastIndexOf'](_0x4e5ecb));}return rp({'method':_0x4d8c('0x61'),'uri':util[_0x4d8c('0x62')]('%s%s',_0x10f147,_0x4d8c('0x63')),'json':!![],'form':{'method':'login','input_type':_0x4d8c('0x64'),'response_type':_0x4d8c('0x64'),'rest_data':JSON[_0x4d8c('0x65')]({'user_auth':{'user_name':_0x2ba8f4[_0x4d8c('0x5c')],'password':_0x2ba8f4['password'],'encryption':_0x4d8c('0x66')},'application':_0x4d8c('0x67')})}});}})[_0x4d8c('0x41')](function(_0xac927e){if(_0xac927e&&_0xac927e[_0x4d8c('0x27')]!=='Invalid\x20Login'&&_0xac927e['name']!==_0x4d8c('0x68')){return rp({'method':_0x4d8c('0x61'),'uri':util[_0x4d8c('0x62')](_0x4d8c('0x69'),_0x10f147,_0x4d8c('0x63')),'json':!![],'form':{'method':_0x4d8c('0x6a'),'input_type':_0x4d8c('0x64'),'response_type':_0x4d8c('0x64'),'rest_data':JSON[_0x4d8c('0x65')]({'session':_0xac927e['id'],'module_name':_0x4d8c('0x6b')})}})[_0x4d8c('0x41')](function(_0x274d30){if(_0x274d30){var _0x595bce=_['values'](_0x274d30[_0x4d8c('0x6c')]);_[_0x4d8c('0x6d')](_0x595bce,function(_0x23df33){return _0x5f3826[_0x4d8c('0x6e')](_0x23df33[_0x4d8c('0x27')]);});return{'count':_0x595bce[_0x4d8c('0x36')],'rows':_[_0x4d8c('0x2a')](_0x595bce,function(_0x23d93f){return{'id':_0x23d93f[_0x4d8c('0x27')],'name':_0x23d93f[_0x4d8c('0x6f')],'custom':_[_0x4d8c('0x70')](_0x23d93f[_0x4d8c('0x27')],'_c')?!![]:![],'options':_0x23d93f[_0x4d8c('0x3d')]?_[_0x4d8c('0x2a')](_['values'](_0x23d93f[_0x4d8c('0x3d')]),function(_0x1a216e){return{'name':_0x1a216e[_0x4d8c('0x71')],'value':_0x1a216e['name']};}):[]};})};}})['then'](respondWithResult(_0x23ee11,null))['catch'](function(_0x6a2ef5){var _0x3e3c66=_0x4de76c[_0x4d8c('0x30')][_0x4d8c('0x72')]?0x1f4:_0x6a2ef5[_0x4d8c('0x73')]||0x1f4;logger[_0x4d8c('0x26')](_0x4d8c('0x74'),_0x4d8c('0x52'),_0x3e3c66,JSON['stringify'](_0x6a2ef5));delete _0x6a2ef5[_0x4d8c('0x27')];if(_0x3e3c66===0x191){_0x3e3c66=0x190;}_0x23ee11[_0x4d8c('0x1a')](_0x3e3c66)[_0x4d8c('0x28')](_0x4de76c[_0x4d8c('0x30')]['test']?{'message':_0x4d8c('0x75'),'statusCode':_0x6a2ef5['statusCode']}:_0x6a2ef5);});}else{var _0x4a1dca=0x1f4;_0x23ee11[_0x4d8c('0x1a')](_0x4a1dca)[_0x4d8c('0x28')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xcd75=['type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','VIRTUAL','merge','options','SugarcrmAccount','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','order','filter','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','%s%s','get_module_fields','JSON','stringify','Calls','values','module_fields','includes','endsWith','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','end','name','send','map','rawAttributes','fieldName'];(function(_0x3d1870,_0x58555a){var _0x407e83=function(_0x1675d1){while(--_0x1675d1){_0x3d1870['push'](_0x3d1870['shift']());}};_0x407e83(++_0x58555a);}(_0xcd75,0xca));var _0x5cd7=function(_0x57fe01,_0x25a794){_0x57fe01=_0x57fe01-0x0;var _0x3217b6=_0xcd75[_0x57fe01];return _0x3217b6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5cd7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5cd7('0x1'));var rp=require(_0x5cd7('0x2'));var moment=require(_0x5cd7('0x3'));var BPromise=require(_0x5cd7('0x4'));var Mustache=require('mustache');var util=require(_0x5cd7('0x5'));var path=require(_0x5cd7('0x6'));var sox=require(_0x5cd7('0x7'));var csv=require(_0x5cd7('0x8'));var ejs=require(_0x5cd7('0x9'));var fs=require('fs');var fs_extra=require(_0x5cd7('0xa'));var _=require(_0x5cd7('0xb'));var squel=require(_0x5cd7('0xc'));var crypto=require(_0x5cd7('0xd'));var jsforce=require(_0x5cd7('0xe'));var deskjs=require(_0x5cd7('0xf'));var toCsv=require(_0x5cd7('0x8'));var querystring=require(_0x5cd7('0x10'));var Papa=require(_0x5cd7('0x11'));var Redis=require(_0x5cd7('0x12'));var authService=require(_0x5cd7('0x13'));var qs=require(_0x5cd7('0x14'));var as=require(_0x5cd7('0x15'));var hardwareService=require(_0x5cd7('0x16'));var logger=require(_0x5cd7('0x17'))('api');var utils=require(_0x5cd7('0x18'));var config=require(_0x5cd7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5cd7('0x1a'))['db'];var integrations=require(_0x5cd7('0x1b'));function respondWithStatusCode(_0x4bca22,_0x585109){_0x585109=_0x585109||0xcc;return function(_0x20444a){if(_0x20444a){return _0x4bca22[_0x5cd7('0x1c')](_0x585109);}return _0x4bca22[_0x5cd7('0x1d')](_0x585109)['end']();};}function respondWithResult(_0x185446,_0x2d7d3c){_0x2d7d3c=_0x2d7d3c||0xc8;return function(_0x3d8cf8){if(_0x3d8cf8){return _0x185446[_0x5cd7('0x1d')](_0x2d7d3c)[_0x5cd7('0x1e')](_0x3d8cf8);}};}function respondWithFilteredResult(_0x4033ec,_0x26663a){return function(_0x4e58b4){if(_0x4e58b4){var _0x485d35=typeof _0x26663a[_0x5cd7('0x1f')]===_0x5cd7('0x20')&&typeof _0x26663a[_0x5cd7('0x21')]===_0x5cd7('0x20');var _0x3596e3=_0x4e58b4[_0x5cd7('0x22')];var _0x4d78a5=_0x485d35?0x0:_0x26663a[_0x5cd7('0x1f')];var _0xc80509=_0x485d35?_0x4e58b4[_0x5cd7('0x22')]:_0x26663a['offset']+_0x26663a[_0x5cd7('0x21')];var _0x147c21;if(_0xc80509>=_0x3596e3){_0xc80509=_0x3596e3;_0x147c21=0xc8;}else{_0x147c21=0xce;}_0x4033ec[_0x5cd7('0x1d')](_0x147c21);return _0x4033ec['set'](_0x5cd7('0x23'),_0x4d78a5+'-'+_0xc80509+'/'+_0x3596e3)['json'](_0x4e58b4);}return null;};}function patchUpdates(_0x5b7d91){return function(_0x125761){try{jsonpatch['apply'](_0x125761,_0x5b7d91,!![]);}catch(_0x5e81e1){return BPromise[_0x5cd7('0x24')](_0x5e81e1);}return _0x125761[_0x5cd7('0x25')]();};}function saveUpdates(_0x2a4cc5,_0x2ae7f2){return function(_0x214bad){if(_0x214bad){return _0x214bad[_0x5cd7('0x26')](_0x2a4cc5)['then'](function(_0xa530f0){return _0xa530f0;});}return null;};}function removeEntity(_0x40d25c,_0x38be7a){return function(_0x338f7f){if(_0x338f7f){return _0x338f7f['destroy']()[_0x5cd7('0x27')](function(){_0x40d25c[_0x5cd7('0x1d')](0xcc)[_0x5cd7('0x28')]();});}};}function handleEntityNotFound(_0x33f862,_0x564bac){return function(_0x23e927){if(!_0x23e927){_0x33f862[_0x5cd7('0x1c')](0x194);}return _0x23e927;};}function handleError(_0x186cb6,_0x3fae56){_0x3fae56=_0x3fae56||0x1f4;return function(_0x43f509){logger['error'](_0x43f509['stack']);if(_0x43f509[_0x5cd7('0x29')]){delete _0x43f509[_0x5cd7('0x29')];}_0x186cb6[_0x5cd7('0x1d')](_0x3fae56)[_0x5cd7('0x2a')](_0x43f509);};}exports['index']=function(_0x399e9d,_0x4a32fa){var _0x40ed6f={},_0x59b293={},_0x2d8c5d={'count':0x0,'rows':[]};var _0x11b76b=_[_0x5cd7('0x2b')](db['SugarcrmAccount'][_0x5cd7('0x2c')],function(_0x56b366){return{'name':_0x56b366[_0x5cd7('0x2d')],'type':_0x56b366[_0x5cd7('0x2e')][_0x5cd7('0x2f')]};});_0x59b293[_0x5cd7('0x30')]=_[_0x5cd7('0x2b')](_0x11b76b,_0x5cd7('0x29'));_0x59b293[_0x5cd7('0x31')]=_['keys'](_0x399e9d[_0x5cd7('0x31')]);_0x59b293[_0x5cd7('0x32')]=_['intersection'](_0x59b293[_0x5cd7('0x30')],_0x59b293[_0x5cd7('0x31')]);_0x40ed6f['attributes']=_[_0x5cd7('0x33')](_0x59b293[_0x5cd7('0x30')],qs[_0x5cd7('0x34')](_0x399e9d['query']['fields']));_0x40ed6f[_0x5cd7('0x35')]=_0x40ed6f[_0x5cd7('0x35')][_0x5cd7('0x36')]?_0x40ed6f['attributes']:_0x59b293[_0x5cd7('0x30')];if(!_0x399e9d[_0x5cd7('0x31')][_0x5cd7('0x37')]('nolimit')){_0x40ed6f[_0x5cd7('0x21')]=qs[_0x5cd7('0x21')](_0x399e9d['query'][_0x5cd7('0x21')]);_0x40ed6f['offset']=qs['offset'](_0x399e9d['query'][_0x5cd7('0x1f')]);}_0x40ed6f['order']=qs[_0x5cd7('0x38')](_0x399e9d[_0x5cd7('0x31')][_0x5cd7('0x38')]);_0x40ed6f[_0x5cd7('0x39')]=qs[_0x5cd7('0x32')](_[_0x5cd7('0x3a')](_0x399e9d[_0x5cd7('0x31')],_0x59b293['filters']),_0x11b76b);if(_0x399e9d[_0x5cd7('0x31')]['filter']){_0x40ed6f[_0x5cd7('0x39')]=_['merge'](_0x40ed6f[_0x5cd7('0x39')],{'$or':_[_0x5cd7('0x2b')](_0x11b76b,function(_0xa5b379){if(_0xa5b379[_0x5cd7('0x2e')]!==_0x5cd7('0x3b')){var _0x342d38={};_0x342d38[_0xa5b379[_0x5cd7('0x29')]]={'$like':'%'+_0x399e9d[_0x5cd7('0x31')]['filter']+'%'};return _0x342d38;}})});}_0x40ed6f=_[_0x5cd7('0x3c')]({},_0x40ed6f,_0x399e9d[_0x5cd7('0x3d')]);var _0xa7035={'where':_0x40ed6f['where']};return db[_0x5cd7('0x3e')][_0x5cd7('0x22')](_0xa7035)[_0x5cd7('0x27')](function(_0x3a453d){_0x2d8c5d[_0x5cd7('0x22')]=_0x3a453d;if(_0x399e9d[_0x5cd7('0x31')][_0x5cd7('0x3f')]){_0x40ed6f[_0x5cd7('0x40')]=[{'all':!![]}];}return db[_0x5cd7('0x3e')][_0x5cd7('0x41')](_0x40ed6f);})[_0x5cd7('0x27')](function(_0x13315e){_0x2d8c5d[_0x5cd7('0x42')]=_0x13315e;return _0x2d8c5d;})[_0x5cd7('0x27')](respondWithFilteredResult(_0x4a32fa,_0x40ed6f))[_0x5cd7('0x43')](handleError(_0x4a32fa,null));};exports[_0x5cd7('0x44')]=function(_0x1575f6,_0x194f4a){var _0x5c3574={'raw':![],'where':{'id':_0x1575f6[_0x5cd7('0x45')]['id']}},_0x1e76c4={};_0x1e76c4[_0x5cd7('0x30')]=_[_0x5cd7('0x46')](db[_0x5cd7('0x3e')][_0x5cd7('0x2c')]);_0x1e76c4[_0x5cd7('0x31')]=_[_0x5cd7('0x46')](_0x1575f6[_0x5cd7('0x31')]);_0x1e76c4[_0x5cd7('0x32')]=_[_0x5cd7('0x33')](_0x1e76c4['model'],_0x1e76c4[_0x5cd7('0x31')]);_0x5c3574['attributes']=_[_0x5cd7('0x33')](_0x1e76c4[_0x5cd7('0x30')],qs[_0x5cd7('0x34')](_0x1575f6['query'][_0x5cd7('0x34')]));_0x5c3574[_0x5cd7('0x35')]=_0x5c3574[_0x5cd7('0x35')][_0x5cd7('0x36')]?_0x5c3574['attributes']:_0x1e76c4['model'];if(_0x1575f6[_0x5cd7('0x31')][_0x5cd7('0x3f')]){_0x5c3574[_0x5cd7('0x40')]=[{'all':!![]}];}_0x5c3574=_['merge']({},_0x5c3574,_0x1575f6[_0x5cd7('0x3d')]);return db[_0x5cd7('0x3e')][_0x5cd7('0x47')](_0x5c3574)[_0x5cd7('0x27')](handleEntityNotFound(_0x194f4a,null))[_0x5cd7('0x27')](respondWithResult(_0x194f4a,null))[_0x5cd7('0x43')](handleError(_0x194f4a,null));};exports[_0x5cd7('0x48')]=function(_0x6701c0,_0x4ee8e4){return db[_0x5cd7('0x3e')]['create'](_0x6701c0[_0x5cd7('0x49')],{})[_0x5cd7('0x27')](respondWithResult(_0x4ee8e4,0xc9))[_0x5cd7('0x43')](handleError(_0x4ee8e4,null));};exports['update']=function(_0x344fcd,_0x41481f){if(_0x344fcd[_0x5cd7('0x49')]['id']){delete _0x344fcd[_0x5cd7('0x49')]['id'];}return db[_0x5cd7('0x3e')][_0x5cd7('0x47')]({'where':{'id':_0x344fcd[_0x5cd7('0x45')]['id']}})[_0x5cd7('0x27')](handleEntityNotFound(_0x41481f,null))['then'](saveUpdates(_0x344fcd[_0x5cd7('0x49')],null))[_0x5cd7('0x27')](respondWithResult(_0x41481f,null))['catch'](handleError(_0x41481f,null));};exports['destroy']=function(_0x4c84b8,_0x7b1bd9){return db['SugarcrmAccount']['find']({'where':{'id':_0x4c84b8[_0x5cd7('0x45')]['id']}})['then'](handleEntityNotFound(_0x7b1bd9,null))['then'](removeEntity(_0x7b1bd9,null))[_0x5cd7('0x43')](handleError(_0x7b1bd9,null));};exports[_0x5cd7('0x4a')]=function(_0x215907,_0x4790ef,_0x13e347){var _0x4e4874={};var _0x464173={};var _0x2bfb5d;var _0x4429cd;return db['SugarcrmAccount'][_0x5cd7('0x4b')]({'where':{'id':_0x215907[_0x5cd7('0x45')]['id']}})[_0x5cd7('0x27')](handleEntityNotFound(_0x4790ef,null))[_0x5cd7('0x27')](function(_0x53dc89){if(_0x53dc89){_0x2bfb5d=_0x53dc89;_0x464173[_0x5cd7('0x30')]=_[_0x5cd7('0x46')](db[_0x5cd7('0x4c')]['rawAttributes']);_0x464173[_0x5cd7('0x31')]=_[_0x5cd7('0x46')](_0x215907[_0x5cd7('0x31')]);_0x464173['filters']=_['intersection'](_0x464173[_0x5cd7('0x30')],_0x464173[_0x5cd7('0x31')]);_0x4e4874[_0x5cd7('0x35')]=_[_0x5cd7('0x33')](_0x464173[_0x5cd7('0x30')],qs[_0x5cd7('0x34')](_0x215907[_0x5cd7('0x31')][_0x5cd7('0x34')]));_0x4e4874[_0x5cd7('0x35')]=_0x4e4874[_0x5cd7('0x35')][_0x5cd7('0x36')]?_0x4e4874['attributes']:_0x464173[_0x5cd7('0x30')];_0x4e4874[_0x5cd7('0x4d')]=qs[_0x5cd7('0x38')](_0x215907[_0x5cd7('0x31')]['sort']);_0x4e4874[_0x5cd7('0x39')]=qs[_0x5cd7('0x32')](_['pick'](_0x215907['query'],_0x464173['filters']));if(_0x215907[_0x5cd7('0x31')][_0x5cd7('0x4e')]){_0x4e4874[_0x5cd7('0x39')]=_[_0x5cd7('0x3c')](_0x4e4874[_0x5cd7('0x39')],{'$or':_[_0x5cd7('0x2b')](_0x4e4874[_0x5cd7('0x35')],function(_0x24458c){var _0x3517a5={};_0x3517a5[_0x24458c]={'$like':'%'+_0x215907['query'][_0x5cd7('0x4e')]+'%'};return _0x3517a5;})});}_0x4e4874=_[_0x5cd7('0x3c')]({},_0x4e4874,_0x215907[_0x5cd7('0x3d')]);return _0x2bfb5d[_0x5cd7('0x4a')](_0x4e4874);}})[_0x5cd7('0x27')](function(_0x5d4d17){if(_0x5d4d17){_0x4429cd=_0x5d4d17[_0x5cd7('0x36')];if(!_0x215907[_0x5cd7('0x31')][_0x5cd7('0x37')](_0x5cd7('0x4f'))){_0x4e4874[_0x5cd7('0x21')]=qs[_0x5cd7('0x21')](_0x215907[_0x5cd7('0x31')]['limit']);_0x4e4874['offset']=qs['offset'](_0x215907[_0x5cd7('0x31')]['offset']);}return _0x2bfb5d[_0x5cd7('0x4a')](_0x4e4874);}})[_0x5cd7('0x27')](function(_0x5b8572){if(_0x5b8572){return _0x5b8572?{'count':_0x4429cd,'rows':_0x5b8572}:null;}})[_0x5cd7('0x27')](respondWithResult(_0x4790ef,null))[_0x5cd7('0x43')](handleError(_0x4790ef,null));};exports[_0x5cd7('0x50')]=function(_0x57a5c0,_0x15a14b,_0x17b491){if(_0x57a5c0[_0x5cd7('0x49')]['id']){delete _0x57a5c0[_0x5cd7('0x49')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x57a5c0[_0x5cd7('0x45')]['id']}})['then'](handleEntityNotFound(_0x15a14b,null))[_0x5cd7('0x27')](function(_0xe50075){if(_0xe50075){_0x57a5c0[_0x5cd7('0x49')][_0x5cd7('0x51')]=_0xe50075['id'];_0x57a5c0[_0x5cd7('0x49')][_0x5cd7('0x52')]=integrations['getSubjects'](_0x57a5c0['body'][_0x5cd7('0x53')],_0x57a5c0[_0x5cd7('0x49')]['type']);_0x57a5c0['body'][_0x5cd7('0x54')]=integrations[_0x5cd7('0x55')](_0x57a5c0[_0x5cd7('0x49')][_0x5cd7('0x53')],_0x57a5c0[_0x5cd7('0x49')][_0x5cd7('0x2e')]);return db[_0x5cd7('0x4c')][_0x5cd7('0x48')](_0x57a5c0['body'],{'include':[{'model':db['SugarcrmField'],'as':_0x5cd7('0x52')},{'model':db[_0x5cd7('0x56')],'as':_0x5cd7('0x54')}]});}return null;})[_0x5cd7('0x27')](respondWithResult(_0x15a14b,null))[_0x5cd7('0x43')](handleError(_0x15a14b,null));};exports[_0x5cd7('0x57')]=function(_0x5a3228,_0x251bac,_0x2b1dc1){var _0x4f4737='';var _0x7fdba7=['id',_0x5cd7('0x29'),_0x5cd7('0x58'),_0x5cd7('0x59'),_0x5cd7('0x5a'),_0x5cd7('0x5b'),_0x5cd7('0x5c'),'duration_minutes',_0x5cd7('0x5d'),'parent_type',_0x5cd7('0x5e'),_0x5cd7('0x5f')];return db[_0x5cd7('0x3e')][_0x5cd7('0x4b')]({'where':{'id':_0x5a3228[_0x5cd7('0x45')]['id']},'attributes':['id',_0x5cd7('0x60'),_0x5cd7('0x61'),_0x5cd7('0x62')]})[_0x5cd7('0x27')](handleEntityNotFound(_0x251bac,null))[_0x5cd7('0x27')](function(_0xca0dd4){if(_0xca0dd4){_0x4f4737=_0xca0dd4[_0x5cd7('0x62')];var _0x3a738e=_0x4f4737[_0x5cd7('0x63')](-0x1);if(_0x3a738e==='/'){_0x4f4737=_0x4f4737[_0x5cd7('0x64')](0x0,_0x4f4737[_0x5cd7('0x65')](_0x3a738e));}return rp({'method':_0x5cd7('0x66'),'uri':util[_0x5cd7('0x67')]('%s%s',_0x4f4737,_0x5cd7('0x68')),'json':!![],'form':{'method':_0x5cd7('0x69'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0xca0dd4[_0x5cd7('0x60')],'password':_0xca0dd4[_0x5cd7('0x61')],'encryption':_0x5cd7('0x6a')},'application':_0x5cd7('0x6b')})}});}})['then'](function(_0x187da8){if(_0x187da8&&_0x187da8[_0x5cd7('0x29')]!==_0x5cd7('0x6c')&&_0x187da8[_0x5cd7('0x29')]!=='Password\x20Expired'){return rp({'method':_0x5cd7('0x66'),'uri':util[_0x5cd7('0x67')](_0x5cd7('0x6d'),_0x4f4737,_0x5cd7('0x68')),'json':!![],'form':{'method':_0x5cd7('0x6e'),'input_type':_0x5cd7('0x6f'),'response_type':_0x5cd7('0x6f'),'rest_data':JSON[_0x5cd7('0x70')]({'session':_0x187da8['id'],'module_name':_0x5cd7('0x71')})}})['then'](function(_0x1862ae){if(_0x1862ae){var _0x195da0=_[_0x5cd7('0x72')](_0x1862ae[_0x5cd7('0x73')]);_['remove'](_0x195da0,function(_0x3958c9){return _0x7fdba7[_0x5cd7('0x74')](_0x3958c9[_0x5cd7('0x29')]);});return{'count':_0x195da0[_0x5cd7('0x36')],'rows':_[_0x5cd7('0x2b')](_0x195da0,function(_0x3594e7){return{'id':_0x3594e7[_0x5cd7('0x29')],'name':_0x3594e7['label'],'custom':_[_0x5cd7('0x75')](_0x3594e7['name'],'_c')?!![]:![],'options':_0x3594e7[_0x5cd7('0x3d')]?_[_0x5cd7('0x2b')](_[_0x5cd7('0x72')](_0x3594e7[_0x5cd7('0x3d')]),function(_0x5499d8){return{'name':_0x5499d8[_0x5cd7('0x76')],'value':_0x5499d8['name']};}):[]};})};}})['then'](respondWithResult(_0x251bac,null))[_0x5cd7('0x43')](function(_0x2ab3f8){var _0x575330=_0x5a3228[_0x5cd7('0x31')][_0x5cd7('0x77')]?0x1f4:_0x2ab3f8[_0x5cd7('0x78')]||0x1f4;logger[_0x5cd7('0x79')](_0x5cd7('0x7a'),_0x5cd7('0x57'),_0x575330,JSON[_0x5cd7('0x70')](_0x2ab3f8));delete _0x2ab3f8['name'];if(_0x575330===0x191){_0x575330=0x190;}_0x251bac[_0x5cd7('0x1d')](_0x575330)[_0x5cd7('0x2a')](_0x5a3228['query'][_0x5cd7('0x77')]?{'message':_0x5cd7('0x7b'),'statusCode':_0x2ab3f8[_0x5cd7('0x78')]}:_0x2ab3f8);});}else{var _0xe09356=0x1f4;_0x251bac['status'](_0xe09356)[_0x5cd7('0x2a')]({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 96894d3..e92545b 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 _0xe265=['moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api'];(function(_0x170b20,_0x49fc52){var _0xbe0395=function(_0x410eea){while(--_0x410eea){_0x170b20['push'](_0x170b20['shift']());}};_0xbe0395(++_0x49fc52);}(_0xe265,0x111));var _0x5e26=function(_0x3458f1,_0x480a94){_0x3458f1=_0x3458f1-0x0;var _0x219ef6=_0xe265[_0x3458f1];return _0x219ef6;};'use strict';var _=require(_0x5e26('0x0'));var util=require(_0x5e26('0x1'));var logger=require('../../config/logger')(_0x5e26('0x2'));var moment=require(_0x5e26('0x3'));var BPromise=require(_0x5e26('0x4'));var rp=require(_0x5e26('0x5'));var fs=require('fs');var path=require(_0x5e26('0x6'));var rimraf=require('rimraf');var config=require(_0x5e26('0x7'));var attributes=require(_0x5e26('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x5e26('0x9')]=function(_0x4999f4,_0x1d4b28){return _0x4999f4['define'](_0x5e26('0xa'),attributes,{'tableName':_0x5e26('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf69c=['int_sugarcrm_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x46b4ee,_0x17f402){var _0xbd965f=function(_0x3e1a42){while(--_0x3e1a42){_0x46b4ee['push'](_0x46b4ee['shift']());}};_0xbd965f(++_0x17f402);}(_0xf69c,0x1e2));var _0xcf69=function(_0x3f4bef,_0x359a87){_0x3f4bef=_0x3f4bef-0x0;var _0x1989b7=_0xf69c[_0x3f4bef];return _0x1989b7;};'use strict';var _=require(_0xcf69('0x0'));var util=require(_0xcf69('0x1'));var logger=require(_0xcf69('0x2'))(_0xcf69('0x3'));var moment=require('moment');var BPromise=require(_0xcf69('0x4'));var rp=require(_0xcf69('0x5'));var fs=require('fs');var path=require(_0xcf69('0x6'));var rimraf=require('rimraf');var config=require(_0xcf69('0x7'));var attributes=require(_0xcf69('0x8'));var integrations=require(_0xcf69('0x9'));module[_0xcf69('0xa')]=function(_0x2ec528,_0x352ff9){return _0x2ec528[_0xcf69('0xb')]('SugarcrmAccount',attributes,{'tableName':_0xcf69('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 79f45ec..79bd1be 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 _0x9354=['info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','attributes','limit','include','map','model','debug','ShowSugarcrmAccount','find','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x455f19,_0x4f8f3a){var _0x422f21=function(_0x4537cd){while(--_0x4537cd){_0x455f19['push'](_0x455f19['shift']());}};_0x422f21(++_0x4f8f3a);}(_0x9354,0x11e));var _0x4935=function(_0x117473,_0x485375){_0x117473=_0x117473-0x0;var _0x38711a=_0x9354[_0x117473];return _0x38711a;};'use strict';var _=require(_0x4935('0x0'));var util=require('util');var moment=require(_0x4935('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4935('0x2'));var db=require(_0x4935('0x3'))['db'];var utils=require(_0x4935('0x4'));var logger=require('../../config/logger')(_0x4935('0x5'));var config=require(_0x4935('0x6'));var jayson=require(_0x4935('0x7'));var client=jayson[_0x4935('0x8')][_0x4935('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x147a5e,_0x290679,_0x2de53a){return new BPromise(function(_0x1f0800,_0x4fb61a){return client['request'](_0x147a5e,_0x2de53a)[_0x4935('0xa')](function(_0x35f126){logger[_0x4935('0xb')](_0x4935('0xc'),_0x290679,_0x4935('0xd'));logger['debug'](_0x4935('0xe'),_0x290679,_0x4935('0xd'),JSON[_0x4935('0xf')](_0x35f126));if(_0x35f126[_0x4935('0x10')]){if(_0x35f126['error']['code']===0x1f4){logger[_0x4935('0x10')](_0x4935('0xc'),_0x290679,_0x35f126[_0x4935('0x10')][_0x4935('0x11')]);return _0x4fb61a(_0x35f126[_0x4935('0x10')][_0x4935('0x11')]);}logger[_0x4935('0x10')](_0x4935('0xc'),_0x290679,_0x35f126['error']['message']);return _0x1f0800(_0x35f126['error']['message']);}else{logger[_0x4935('0xb')](_0x4935('0xc'),_0x290679,'request\x20sent');_0x1f0800(_0x35f126[_0x4935('0x12')][_0x4935('0x11')]);}})[_0x4935('0x13')](function(_0x5ba0ed){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x290679,_0x5ba0ed);_0x4fb61a(_0x5ba0ed);});});}exports[_0x4935('0x14')]=function(_0x6d786a){var _0x4ebf77=this;return new Promise(function(_0x47f577,_0x1e9249){return db[_0x4935('0x15')][_0x4935('0x16')]({'raw':_0x6d786a['options']?_0x6d786a[_0x4935('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x6d786a[_0x4935('0x17')]?_0x6d786a[_0x4935('0x17')][_0x4935('0x18')]||null:null,'attributes':_0x6d786a['options']?_0x6d786a[_0x4935('0x17')][_0x4935('0x19')]||null:null,'limit':_0x6d786a['options']?_0x6d786a[_0x4935('0x17')][_0x4935('0x1a')]||null:null,'include':_0x6d786a[_0x4935('0x17')]?_0x6d786a[_0x4935('0x17')][_0x4935('0x1b')]?_[_0x4935('0x1c')](_0x6d786a[_0x4935('0x17')][_0x4935('0x1b')],function(_0xc40b02){return{'model':db[_0xc40b02[_0x4935('0x1d')]],'as':_0xc40b02['as'],'attributes':_0xc40b02['attributes'],'include':_0xc40b02[_0x4935('0x1b')]?_['map'](_0xc40b02[_0x4935('0x1b')],function(_0x4a8dfb){return{'model':db[_0x4a8dfb[_0x4935('0x1d')]],'as':_0x4a8dfb['as'],'attributes':_0x4a8dfb[_0x4935('0x19')],'include':_0x4a8dfb[_0x4935('0x1b')]?_[_0x4935('0x1c')](_0x4a8dfb[_0x4935('0x1b')],function(_0x1b6733){return{'model':db[_0x1b6733['model']],'as':_0x1b6733['as'],'attributes':_0x1b6733[_0x4935('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4935('0xa')](function(_0x1352eb){logger[_0x4935('0xb')]('GetSugarcrmAccount',_0x6d786a);logger[_0x4935('0x1e')](_0x4935('0x14'),_0x6d786a,JSON['stringify'](_0x1352eb));_0x47f577(_0x1352eb);})[_0x4935('0x13')](function(_0x474827){logger[_0x4935('0x10')](_0x4935('0x14'),_0x474827[_0x4935('0x11')],_0x6d786a);_0x1e9249(_0x4ebf77[_0x4935('0x10')](0x1f4,_0x474827['message']));});});};exports[_0x4935('0x1f')]=function(_0x1f08e5){var _0xe99426=this;return new Promise(function(_0x56e4a5,_0x484cb7){return db[_0x4935('0x15')][_0x4935('0x20')]({'raw':_0x1f08e5[_0x4935('0x17')]?_0x1f08e5['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f08e5[_0x4935('0x17')]?_0x1f08e5[_0x4935('0x17')][_0x4935('0x18')]||null:null,'attributes':_0x1f08e5[_0x4935('0x17')]?_0x1f08e5['options']['attributes']||null:null,'include':_0x1f08e5[_0x4935('0x17')]?_0x1f08e5[_0x4935('0x17')][_0x4935('0x1b')]?_['map'](_0x1f08e5[_0x4935('0x17')][_0x4935('0x1b')],function(_0x1fe030){return{'model':db[_0x1fe030['model']],'as':_0x1fe030['as'],'attributes':_0x1fe030[_0x4935('0x19')],'include':_0x1fe030[_0x4935('0x1b')]?_['map'](_0x1fe030[_0x4935('0x1b')],function(_0x4a93d4){return{'model':db[_0x4a93d4[_0x4935('0x1d')]],'as':_0x4a93d4['as'],'attributes':_0x4a93d4[_0x4935('0x19')],'include':_0x4a93d4[_0x4935('0x1b')]?_[_0x4935('0x1c')](_0x4a93d4[_0x4935('0x1b')],function(_0x2cb945){return{'model':db[_0x2cb945[_0x4935('0x1d')]],'as':_0x2cb945['as'],'attributes':_0x2cb945[_0x4935('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4935('0xa')](function(_0x2d335d){logger[_0x4935('0xb')](_0x4935('0x1f'),_0x1f08e5);logger[_0x4935('0x1e')](_0x4935('0x1f'),_0x1f08e5,JSON[_0x4935('0xf')](_0x2d335d));_0x56e4a5(_0x2d335d);})[_0x4935('0x13')](function(_0xe91fcb){logger[_0x4935('0x10')](_0x4935('0x1f'),_0xe91fcb[_0x4935('0x11')],_0x1f08e5);_0x484cb7(_0xe99426[_0x4935('0x10')](0x1f4,_0xe91fcb['message']));});});}; \ No newline at end of file +var _0x6e3d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','attributes','limit','include','map','model','ShowSugarcrmAccount','find','where','lodash','util','bluebird','randomstring'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0x6e3d,0xf1));var _0xd6e3=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0x6e3d[_0x28509b];return _0x1e0b6;};'use strict';var _=require(_0xd6e3('0x0'));var util=require(_0xd6e3('0x1'));var moment=require('moment');var BPromise=require(_0xd6e3('0x2'));var rs=require(_0xd6e3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd6e3('0x4'));var logger=require(_0xd6e3('0x5'))(_0xd6e3('0x6'));var config=require(_0xd6e3('0x7'));var jayson=require(_0xd6e3('0x8'));var client=jayson[_0xd6e3('0x9')][_0xd6e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x432b3c,_0x4ebaec,_0x27baf0){return new BPromise(function(_0x34c6ed,_0x2e373c){return client[_0xd6e3('0xb')](_0x432b3c,_0x27baf0)[_0xd6e3('0xc')](function(_0x3f8d10){logger[_0xd6e3('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x4ebaec,'request\x20sent');logger[_0xd6e3('0xe')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x4ebaec,_0xd6e3('0xf'),JSON[_0xd6e3('0x10')](_0x3f8d10));if(_0x3f8d10[_0xd6e3('0x11')]){if(_0x3f8d10[_0xd6e3('0x11')][_0xd6e3('0x12')]===0x1f4){logger['error'](_0xd6e3('0x13'),_0x4ebaec,_0x3f8d10[_0xd6e3('0x11')][_0xd6e3('0x14')]);return _0x2e373c(_0x3f8d10['error'][_0xd6e3('0x14')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x4ebaec,_0x3f8d10[_0xd6e3('0x11')][_0xd6e3('0x14')]);return _0x34c6ed(_0x3f8d10['error'][_0xd6e3('0x14')]);}else{logger['info'](_0xd6e3('0x13'),_0x4ebaec,'request\x20sent');_0x34c6ed(_0x3f8d10[_0xd6e3('0x15')][_0xd6e3('0x14')]);}})[_0xd6e3('0x16')](function(_0x3fe5e){logger[_0xd6e3('0x11')](_0xd6e3('0x13'),_0x4ebaec,_0x3fe5e);_0x2e373c(_0x3fe5e);});});}exports[_0xd6e3('0x17')]=function(_0x5e9372){var _0x2688d0=this;return new Promise(function(_0x267098,_0x15ef8c){return db[_0xd6e3('0x18')]['findAll']({'raw':_0x5e9372[_0xd6e3('0x19')]?_0x5e9372[_0xd6e3('0x19')][_0xd6e3('0x1a')]===undefined?!![]:![]:!![],'where':_0x5e9372[_0xd6e3('0x19')]?_0x5e9372['options']['where']||null:null,'attributes':_0x5e9372[_0xd6e3('0x19')]?_0x5e9372[_0xd6e3('0x19')][_0xd6e3('0x1b')]||null:null,'limit':_0x5e9372[_0xd6e3('0x19')]?_0x5e9372['options'][_0xd6e3('0x1c')]||null:null,'include':_0x5e9372[_0xd6e3('0x19')]?_0x5e9372[_0xd6e3('0x19')][_0xd6e3('0x1d')]?_[_0xd6e3('0x1e')](_0x5e9372['options'][_0xd6e3('0x1d')],function(_0x387d7e){return{'model':db[_0x387d7e[_0xd6e3('0x1f')]],'as':_0x387d7e['as'],'attributes':_0x387d7e[_0xd6e3('0x1b')],'include':_0x387d7e[_0xd6e3('0x1d')]?_['map'](_0x387d7e[_0xd6e3('0x1d')],function(_0x4f8914){return{'model':db[_0x4f8914[_0xd6e3('0x1f')]],'as':_0x4f8914['as'],'attributes':_0x4f8914[_0xd6e3('0x1b')],'include':_0x4f8914[_0xd6e3('0x1d')]?_['map'](_0x4f8914['include'],function(_0x2abaab){return{'model':db[_0x2abaab[_0xd6e3('0x1f')]],'as':_0x2abaab['as'],'attributes':_0x2abaab[_0xd6e3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd6e3('0xc')](function(_0x44ba84){logger[_0xd6e3('0xd')](_0xd6e3('0x17'),_0x5e9372);logger[_0xd6e3('0xe')](_0xd6e3('0x17'),_0x5e9372,JSON[_0xd6e3('0x10')](_0x44ba84));_0x267098(_0x44ba84);})[_0xd6e3('0x16')](function(_0x5b1384){logger[_0xd6e3('0x11')](_0xd6e3('0x17'),_0x5b1384['message'],_0x5e9372);_0x15ef8c(_0x2688d0[_0xd6e3('0x11')](0x1f4,_0x5b1384[_0xd6e3('0x14')]));});});};exports[_0xd6e3('0x20')]=function(_0x3073c8){var _0x5c9def=this;return new Promise(function(_0x52f6da,_0x546dd6){return db[_0xd6e3('0x18')][_0xd6e3('0x21')]({'raw':_0x3073c8[_0xd6e3('0x19')]?_0x3073c8['options'][_0xd6e3('0x1a')]===undefined?!![]:![]:!![],'where':_0x3073c8[_0xd6e3('0x19')]?_0x3073c8['options'][_0xd6e3('0x22')]||null:null,'attributes':_0x3073c8[_0xd6e3('0x19')]?_0x3073c8['options'][_0xd6e3('0x1b')]||null:null,'include':_0x3073c8['options']?_0x3073c8[_0xd6e3('0x19')][_0xd6e3('0x1d')]?_[_0xd6e3('0x1e')](_0x3073c8[_0xd6e3('0x19')][_0xd6e3('0x1d')],function(_0x57a0ef){return{'model':db[_0x57a0ef[_0xd6e3('0x1f')]],'as':_0x57a0ef['as'],'attributes':_0x57a0ef[_0xd6e3('0x1b')],'include':_0x57a0ef[_0xd6e3('0x1d')]?_[_0xd6e3('0x1e')](_0x57a0ef[_0xd6e3('0x1d')],function(_0x207964){return{'model':db[_0x207964['model']],'as':_0x207964['as'],'attributes':_0x207964[_0xd6e3('0x1b')],'include':_0x207964['include']?_[_0xd6e3('0x1e')](_0x207964[_0xd6e3('0x1d')],function(_0x36d72b){return{'model':db[_0x36d72b[_0xd6e3('0x1f')]],'as':_0x36d72b['as'],'attributes':_0x36d72b[_0xd6e3('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x853b1){logger[_0xd6e3('0xd')](_0xd6e3('0x20'),_0x3073c8);logger[_0xd6e3('0xe')]('ShowSugarcrmAccount',_0x3073c8,JSON['stringify'](_0x853b1));_0x52f6da(_0x853b1);})['catch'](function(_0x20b7b5){logger[_0xd6e3('0x11')](_0xd6e3('0x20'),_0x20b7b5[_0xd6e3('0x14')],_0x3073c8);_0x546dd6(_0x5c9def[_0xd6e3('0x11')](0x1f4,_0x20b7b5[_0xd6e3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 559712e..95f773e 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 _0xb3d3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1b535d,_0x2fb5e0){var _0x5ece8c=function(_0x19cf6c){while(--_0x19cf6c){_0x1b535d['push'](_0x1b535d['shift']());}};_0x5ece8c(++_0x2fb5e0);}(_0xb3d3,0x75));var _0x3b3d=function(_0x497b1e,_0x586379){_0x497b1e=_0x497b1e-0x0;var _0x3f72e1=_0xb3d3[_0x497b1e];return _0x3f72e1;};'use strict';var multer=require(_0x3b3d('0x0'));var util=require(_0x3b3d('0x1'));var path=require(_0x3b3d('0x2'));var timeout=require(_0x3b3d('0x3'));var express=require(_0x3b3d('0x4'));var router=express[_0x3b3d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3b3d('0x6'));var interaction=require(_0x3b3d('0x7'));var config=require(_0x3b3d('0x8'));var controller=require(_0x3b3d('0x9'));router[_0x3b3d('0xa')]('/',auth[_0x3b3d('0xb')](),controller[_0x3b3d('0xc')]);router[_0x3b3d('0xa')](_0x3b3d('0xd'),auth[_0x3b3d('0xb')](),controller['show']);router[_0x3b3d('0xa')](_0x3b3d('0xe'),auth[_0x3b3d('0xb')](),controller['getFields']);router[_0x3b3d('0xa')](_0x3b3d('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x3b3d('0xa')]('/:id/descriptions',auth[_0x3b3d('0xb')](),controller[_0x3b3d('0x10')]);router[_0x3b3d('0x11')]('/',auth['isAuthenticated'](),controller[_0x3b3d('0x12')]);router[_0x3b3d('0x13')]('/:id',auth[_0x3b3d('0xb')](),controller[_0x3b3d('0x14')]);router[_0x3b3d('0x15')](_0x3b3d('0xd'),auth[_0x3b3d('0xb')](),controller[_0x3b3d('0x16')]);module[_0x3b3d('0x17')]=router; \ No newline at end of file +var _0xb7a7=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x3d42fd,_0x189fec){var _0x1548f7=function(_0x17c5f3){while(--_0x17c5f3){_0x3d42fd['push'](_0x3d42fd['shift']());}};_0x1548f7(++_0x189fec);}(_0xb7a7,0xb4));var _0x7b7a=function(_0x3923e7,_0xcb1856){_0x3923e7=_0x3923e7-0x0;var _0x10a0cd=_0xb7a7[_0x3923e7];return _0x10a0cd;};'use strict';var multer=require(_0x7b7a('0x0'));var util=require(_0x7b7a('0x1'));var path=require(_0x7b7a('0x2'));var timeout=require(_0x7b7a('0x3'));var express=require('express');var router=express[_0x7b7a('0x4')]();var fs_extra=require(_0x7b7a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7b7a('0x6'));var controller=require(_0x7b7a('0x7'));router[_0x7b7a('0x8')]('/',auth[_0x7b7a('0x9')](),controller[_0x7b7a('0xa')]);router[_0x7b7a('0x8')](_0x7b7a('0xb'),auth['isAuthenticated'](),controller[_0x7b7a('0xc')]);router[_0x7b7a('0x8')](_0x7b7a('0xd'),auth[_0x7b7a('0x9')](),controller[_0x7b7a('0xe')]);router[_0x7b7a('0x8')](_0x7b7a('0xf'),auth[_0x7b7a('0x9')](),controller[_0x7b7a('0x10')]);router['get'](_0x7b7a('0x11'),auth[_0x7b7a('0x9')](),controller[_0x7b7a('0x12')]);router[_0x7b7a('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7b7a('0x14')](_0x7b7a('0xb'),auth[_0x7b7a('0x9')](),controller[_0x7b7a('0x15')]);router['delete'](_0x7b7a('0xb'),auth['isAuthenticated'](),controller[_0x7b7a('0x16')]);module[_0x7b7a('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 4e6716d..be0f4bc 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 _0x0ae7=['STRING','sequelize'];(function(_0x56cf98,_0x28de81){var _0x2f0f11=function(_0x2b4f35){while(--_0x2b4f35){_0x56cf98['push'](_0x56cf98['shift']());}};_0x2f0f11(++_0x28de81);}(_0x0ae7,0x157));var _0x70ae=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x0ae7[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0x70ae('0x0'));module['exports']={'name':{'type':Sequelize[_0x70ae('0x1')]},'description':{'type':Sequelize[_0x70ae('0x1')]}}; \ No newline at end of file +var _0xacea=['STRING','sequelize'];(function(_0x366078,_0x43009e){var _0xbe1005=function(_0x1abb20){while(--_0x1abb20){_0x366078['push'](_0x366078['shift']());}};_0xbe1005(++_0x43009e);}(_0xacea,0xe5));var _0xaace=function(_0x2ec145,_0x33970d){_0x2ec145=_0x2ec145-0x0;var _0x4e0cf0=_0xacea[_0x2ec145];return _0x4e0cf0;};'use strict';var Sequelize=require(_0xaace('0x0'));module['exports']={'name':{'type':Sequelize[_0xaace('0x1')]},'description':{'type':Sequelize[_0xaace('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 31a59be..555f531 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 _0x66d1=['SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','VIRTUAL','filter','options','include','findAll','catch','show','params','includeAll','find','create','body','getFields','findOne','SugarcrmField','merge','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','count','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x66d1,0xbb));var _0x166d=function(_0xbcbd76,_0x25722b){_0xbcbd76=_0xbcbd76-0x0;var _0x503680=_0x66d1[_0xbcbd76];return _0x503680;};'use strict';var emlformat=require(_0x166d('0x0'));var rimraf=require(_0x166d('0x1'));var zipdir=require(_0x166d('0x2'));var jsonpatch=require(_0x166d('0x3'));var rp=require(_0x166d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x166d('0x5'));var path=require('path');var sox=require(_0x166d('0x6'));var csv=require(_0x166d('0x7'));var ejs=require(_0x166d('0x8'));var fs=require('fs');var fs_extra=require(_0x166d('0x9'));var _=require('lodash');var squel=require(_0x166d('0xa'));var crypto=require(_0x166d('0xb'));var jsforce=require(_0x166d('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x166d('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x166d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x166d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x166d('0x10'));var utils=require(_0x166d('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x166d('0x12'));var db=require(_0x166d('0x13'))['db'];function respondWithStatusCode(_0x5fb5e7,_0x329c14){_0x329c14=_0x329c14||0xcc;return function(_0x42aed5){if(_0x42aed5){return _0x5fb5e7[_0x166d('0x14')](_0x329c14);}return _0x5fb5e7[_0x166d('0x15')](_0x329c14)[_0x166d('0x16')]();};}function respondWithResult(_0x3cdd22,_0x224b9d){_0x224b9d=_0x224b9d||0xc8;return function(_0x4ea3c8){if(_0x4ea3c8){return _0x3cdd22[_0x166d('0x15')](_0x224b9d)['json'](_0x4ea3c8);}};}function respondWithFilteredResult(_0x512b00,_0x2a0d55){return function(_0x5430c8){if(_0x5430c8){var _0x103493=typeof _0x2a0d55[_0x166d('0x17')]==='undefined'&&typeof _0x2a0d55['limit']==='undefined';var _0x2b28d5=_0x5430c8[_0x166d('0x18')];var _0x19a370=_0x103493?0x0:_0x2a0d55[_0x166d('0x17')];var _0x55c500=_0x103493?_0x5430c8[_0x166d('0x18')]:_0x2a0d55[_0x166d('0x17')]+_0x2a0d55[_0x166d('0x19')];var _0x1bb4ec;if(_0x55c500>=_0x2b28d5){_0x55c500=_0x2b28d5;_0x1bb4ec=0xc8;}else{_0x1bb4ec=0xce;}_0x512b00[_0x166d('0x15')](_0x1bb4ec);return _0x512b00[_0x166d('0x1a')](_0x166d('0x1b'),_0x19a370+'-'+_0x55c500+'/'+_0x2b28d5)['json'](_0x5430c8);}return null;};}function patchUpdates(_0x3efe16){return function(_0x280078){try{jsonpatch[_0x166d('0x1c')](_0x280078,_0x3efe16,!![]);}catch(_0xe419b5){return BPromise['reject'](_0xe419b5);}return _0x280078[_0x166d('0x1d')]();};}function saveUpdates(_0x219fea,_0x439e41){return function(_0x125ee8){if(_0x125ee8){return _0x125ee8[_0x166d('0x1e')](_0x219fea)[_0x166d('0x1f')](function(_0x195622){return _0x195622;});}return null;};}function removeEntity(_0x498eff,_0xe0072e){return function(_0x4c2542){if(_0x4c2542){return _0x4c2542[_0x166d('0x20')]()[_0x166d('0x1f')](function(){_0x498eff[_0x166d('0x15')](0xcc)[_0x166d('0x16')]();});}};}function handleEntityNotFound(_0x3f5a5a,_0x2234ab){return function(_0x122f47){if(!_0x122f47){_0x3f5a5a[_0x166d('0x14')](0x194);}return _0x122f47;};}function handleError(_0x55822c,_0x23c0ed){_0x23c0ed=_0x23c0ed||0x1f4;return function(_0x4db6e6){logger[_0x166d('0x21')](_0x4db6e6['stack']);if(_0x4db6e6[_0x166d('0x22')]){delete _0x4db6e6[_0x166d('0x22')];}_0x55822c[_0x166d('0x15')](_0x23c0ed)[_0x166d('0x23')](_0x4db6e6);};}exports[_0x166d('0x24')]=function(_0x22f395,_0x4cca19){var _0xc69062={},_0x54ce84={},_0x31bb05={'count':0x0,'rows':[]};var _0x5d803e=_[_0x166d('0x25')](db[_0x166d('0x26')][_0x166d('0x27')],function(_0x4bf906){return{'name':_0x4bf906[_0x166d('0x28')],'type':_0x4bf906[_0x166d('0x29')][_0x166d('0x2a')]};});_0x54ce84[_0x166d('0x2b')]=_['map'](_0x5d803e,_0x166d('0x22'));_0x54ce84[_0x166d('0x2c')]=_[_0x166d('0x2d')](_0x22f395['query']);_0x54ce84[_0x166d('0x2e')]=_[_0x166d('0x2f')](_0x54ce84['model'],_0x54ce84[_0x166d('0x2c')]);_0xc69062[_0x166d('0x30')]=_[_0x166d('0x2f')](_0x54ce84[_0x166d('0x2b')],qs['fields'](_0x22f395[_0x166d('0x2c')][_0x166d('0x31')]));_0xc69062[_0x166d('0x30')]=_0xc69062[_0x166d('0x30')][_0x166d('0x32')]?_0xc69062['attributes']:_0x54ce84[_0x166d('0x2b')];if(!_0x22f395[_0x166d('0x2c')][_0x166d('0x33')]('nolimit')){_0xc69062[_0x166d('0x19')]=qs[_0x166d('0x19')](_0x22f395[_0x166d('0x2c')]['limit']);_0xc69062[_0x166d('0x17')]=qs[_0x166d('0x17')](_0x22f395[_0x166d('0x2c')][_0x166d('0x17')]);}_0xc69062[_0x166d('0x34')]=qs[_0x166d('0x35')](_0x22f395[_0x166d('0x2c')][_0x166d('0x35')]);_0xc69062['where']=qs[_0x166d('0x2e')](_[_0x166d('0x36')](_0x22f395[_0x166d('0x2c')],_0x54ce84['filters']),_0x5d803e);if(_0x22f395[_0x166d('0x2c')]['filter']){_0xc69062[_0x166d('0x37')]=_['merge'](_0xc69062[_0x166d('0x37')],{'$or':_[_0x166d('0x25')](_0x5d803e,function(_0x33b7f4){if(_0x33b7f4[_0x166d('0x29')]!==_0x166d('0x38')){var _0x52713a={};_0x52713a[_0x33b7f4['name']]={'$like':'%'+_0x22f395['query'][_0x166d('0x39')]+'%'};return _0x52713a;}})});}_0xc69062=_['merge']({},_0xc69062,_0x22f395[_0x166d('0x3a')]);var _0x5dbad2={'where':_0xc69062[_0x166d('0x37')]};return db['SugarcrmConfiguration'][_0x166d('0x18')](_0x5dbad2)['then'](function(_0x23419a){_0x31bb05['count']=_0x23419a;if(_0x22f395[_0x166d('0x2c')]['includeAll']){_0xc69062[_0x166d('0x3b')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x166d('0x3c')](_0xc69062);})[_0x166d('0x1f')](function(_0x1bbeaa){_0x31bb05['rows']=_0x1bbeaa;return _0x31bb05;})['then'](respondWithFilteredResult(_0x4cca19,_0xc69062))[_0x166d('0x3d')](handleError(_0x4cca19,null));};exports[_0x166d('0x3e')]=function(_0x2f2aed,_0x3a7a91){var _0x1192ec={'raw':![],'where':{'id':_0x2f2aed[_0x166d('0x3f')]['id']}},_0x391998={};_0x391998['model']=_[_0x166d('0x2d')](db[_0x166d('0x26')][_0x166d('0x27')]);_0x391998[_0x166d('0x2c')]=_['keys'](_0x2f2aed[_0x166d('0x2c')]);_0x391998[_0x166d('0x2e')]=_[_0x166d('0x2f')](_0x391998['model'],_0x391998[_0x166d('0x2c')]);_0x1192ec['attributes']=_[_0x166d('0x2f')](_0x391998[_0x166d('0x2b')],qs[_0x166d('0x31')](_0x2f2aed[_0x166d('0x2c')]['fields']));_0x1192ec[_0x166d('0x30')]=_0x1192ec[_0x166d('0x30')][_0x166d('0x32')]?_0x1192ec['attributes']:_0x391998[_0x166d('0x2b')];if(_0x2f2aed[_0x166d('0x2c')][_0x166d('0x40')]){_0x1192ec[_0x166d('0x3b')]=[{'all':!![]}];}_0x1192ec=_['merge']({},_0x1192ec,_0x2f2aed[_0x166d('0x3a')]);return db[_0x166d('0x26')][_0x166d('0x41')](_0x1192ec)[_0x166d('0x1f')](handleEntityNotFound(_0x3a7a91,null))['then'](respondWithResult(_0x3a7a91,null))[_0x166d('0x3d')](handleError(_0x3a7a91,null));};exports[_0x166d('0x42')]=function(_0x33a8df,_0x26353c){return db[_0x166d('0x26')][_0x166d('0x42')](_0x33a8df[_0x166d('0x43')],{})[_0x166d('0x1f')](respondWithResult(_0x26353c,0xc9))[_0x166d('0x3d')](handleError(_0x26353c,null));};exports[_0x166d('0x1e')]=function(_0x56ac27,_0x137ff2){if(_0x56ac27['body']['id']){delete _0x56ac27[_0x166d('0x43')]['id'];}return db['SugarcrmConfiguration'][_0x166d('0x41')]({'where':{'id':_0x56ac27[_0x166d('0x3f')]['id']}})[_0x166d('0x1f')](handleEntityNotFound(_0x137ff2,null))['then'](saveUpdates(_0x56ac27[_0x166d('0x43')],null))[_0x166d('0x1f')](respondWithResult(_0x137ff2,null))['catch'](handleError(_0x137ff2,null));};exports[_0x166d('0x20')]=function(_0x43ed27,_0x22ff98){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x43ed27[_0x166d('0x3f')]['id']}})['then'](handleEntityNotFound(_0x22ff98,null))[_0x166d('0x1f')](removeEntity(_0x22ff98,null))[_0x166d('0x3d')](handleError(_0x22ff98,null));};exports[_0x166d('0x44')]=function(_0x28f511,_0x432b24,_0x1dd419){var _0x5a2760={};var _0x361449={};var _0x121863;var _0x13e2fc;return db[_0x166d('0x26')][_0x166d('0x45')]({'where':{'id':_0x28f511[_0x166d('0x3f')]['id']}})[_0x166d('0x1f')](handleEntityNotFound(_0x432b24,null))[_0x166d('0x1f')](function(_0x2ea9e5){if(_0x2ea9e5){_0x121863=_0x2ea9e5;_0x361449[_0x166d('0x2b')]=_['keys'](db[_0x166d('0x46')][_0x166d('0x27')]);_0x361449[_0x166d('0x2c')]=_['keys'](_0x28f511['query']);_0x361449[_0x166d('0x2e')]=_[_0x166d('0x2f')](_0x361449[_0x166d('0x2b')],_0x361449[_0x166d('0x2c')]);_0x5a2760[_0x166d('0x30')]=_[_0x166d('0x2f')](_0x361449[_0x166d('0x2b')],qs[_0x166d('0x31')](_0x28f511[_0x166d('0x2c')]['fields']));_0x5a2760[_0x166d('0x30')]=_0x5a2760[_0x166d('0x30')][_0x166d('0x32')]?_0x5a2760[_0x166d('0x30')]:_0x361449[_0x166d('0x2b')];_0x5a2760['order']=qs['sort'](_0x28f511[_0x166d('0x2c')][_0x166d('0x35')]);_0x5a2760[_0x166d('0x37')]=qs[_0x166d('0x2e')](_[_0x166d('0x36')](_0x28f511[_0x166d('0x2c')],_0x361449[_0x166d('0x2e')]));if(_0x28f511[_0x166d('0x2c')][_0x166d('0x39')]){_0x5a2760[_0x166d('0x37')]=_[_0x166d('0x47')](_0x5a2760[_0x166d('0x37')],{'$or':_[_0x166d('0x25')](_0x5a2760[_0x166d('0x30')],function(_0xbb83f1){var _0x26a6ba={};_0x26a6ba[_0xbb83f1]={'$like':'%'+_0x28f511[_0x166d('0x2c')]['filter']+'%'};return _0x26a6ba;})});}_0x5a2760=_[_0x166d('0x47')]({},_0x5a2760,_0x28f511[_0x166d('0x3a')]);return _0x121863[_0x166d('0x44')](_0x5a2760);}})[_0x166d('0x1f')](function(_0x1cf60b){if(_0x1cf60b){_0x13e2fc=_0x1cf60b['length'];if(!_0x28f511[_0x166d('0x2c')][_0x166d('0x33')]('nolimit')){_0x5a2760['limit']=qs['limit'](_0x28f511[_0x166d('0x2c')]['limit']);_0x5a2760[_0x166d('0x17')]=qs[_0x166d('0x17')](_0x28f511[_0x166d('0x2c')][_0x166d('0x17')]);}return _0x121863[_0x166d('0x44')](_0x5a2760);}})[_0x166d('0x1f')](function(_0x5d9e29){if(_0x5d9e29){return _0x5d9e29?{'count':_0x13e2fc,'rows':_0x5d9e29}:null;}})[_0x166d('0x1f')](respondWithResult(_0x432b24,null))['catch'](handleError(_0x432b24,null));};exports[_0x166d('0x48')]=function(_0x253d6b,_0x5d2f0a,_0x4f9dc1){var _0x4d30e2={};var _0x3b6cc2={};var _0x12c7c7;var _0x330e7a;return db[_0x166d('0x26')][_0x166d('0x45')]({'where':{'id':_0x253d6b[_0x166d('0x3f')]['id']}})[_0x166d('0x1f')](handleEntityNotFound(_0x5d2f0a,null))[_0x166d('0x1f')](function(_0x1d48f2){if(_0x1d48f2){_0x12c7c7=_0x1d48f2;_0x3b6cc2[_0x166d('0x2b')]=_['keys'](db['SugarcrmField'][_0x166d('0x27')]);_0x3b6cc2[_0x166d('0x2c')]=_[_0x166d('0x2d')](_0x253d6b[_0x166d('0x2c')]);_0x3b6cc2[_0x166d('0x2e')]=_[_0x166d('0x2f')](_0x3b6cc2['model'],_0x3b6cc2[_0x166d('0x2c')]);_0x4d30e2[_0x166d('0x30')]=_['intersection'](_0x3b6cc2[_0x166d('0x2b')],qs[_0x166d('0x31')](_0x253d6b[_0x166d('0x2c')][_0x166d('0x31')]));_0x4d30e2[_0x166d('0x30')]=_0x4d30e2[_0x166d('0x30')][_0x166d('0x32')]?_0x4d30e2[_0x166d('0x30')]:_0x3b6cc2[_0x166d('0x2b')];_0x4d30e2[_0x166d('0x34')]=qs['sort'](_0x253d6b[_0x166d('0x2c')][_0x166d('0x35')]);_0x4d30e2['where']=qs['filters'](_[_0x166d('0x36')](_0x253d6b[_0x166d('0x2c')],_0x3b6cc2[_0x166d('0x2e')]));if(_0x253d6b[_0x166d('0x2c')][_0x166d('0x39')]){_0x4d30e2[_0x166d('0x37')]=_[_0x166d('0x47')](_0x4d30e2[_0x166d('0x37')],{'$or':_[_0x166d('0x25')](_0x4d30e2[_0x166d('0x30')],function(_0x68aa03){var _0x34d034={};_0x34d034[_0x68aa03]={'$like':'%'+_0x253d6b[_0x166d('0x2c')][_0x166d('0x39')]+'%'};return _0x34d034;})});}_0x4d30e2=_[_0x166d('0x47')]({},_0x4d30e2,_0x253d6b['options']);return _0x12c7c7[_0x166d('0x48')](_0x4d30e2);}})[_0x166d('0x1f')](function(_0x84d1b9){if(_0x84d1b9){_0x330e7a=_0x84d1b9[_0x166d('0x32')];if(!_0x253d6b[_0x166d('0x2c')]['hasOwnProperty']('nolimit')){_0x4d30e2[_0x166d('0x19')]=qs[_0x166d('0x19')](_0x253d6b['query'][_0x166d('0x19')]);_0x4d30e2['offset']=qs[_0x166d('0x17')](_0x253d6b['query'][_0x166d('0x17')]);}return _0x12c7c7['getSubjects'](_0x4d30e2);}})[_0x166d('0x1f')](function(_0x458cf5){if(_0x458cf5){return _0x458cf5?{'count':_0x330e7a,'rows':_0x458cf5}:null;}})[_0x166d('0x1f')](respondWithResult(_0x5d2f0a,null))[_0x166d('0x3d')](handleError(_0x5d2f0a,null));};exports['getDescriptions']=function(_0x69ab64,_0x6ce0e4,_0x583d54){var _0x4fe3f0={};var _0x2d6470={};var _0x47e3b2;var _0x2fead3;return db['SugarcrmConfiguration'][_0x166d('0x45')]({'where':{'id':_0x69ab64[_0x166d('0x3f')]['id']}})[_0x166d('0x1f')](handleEntityNotFound(_0x6ce0e4,null))[_0x166d('0x1f')](function(_0x2c5239){if(_0x2c5239){_0x47e3b2=_0x2c5239;_0x2d6470[_0x166d('0x2b')]=_[_0x166d('0x2d')](db['SugarcrmField'][_0x166d('0x27')]);_0x2d6470[_0x166d('0x2c')]=_[_0x166d('0x2d')](_0x69ab64['query']);_0x2d6470['filters']=_[_0x166d('0x2f')](_0x2d6470[_0x166d('0x2b')],_0x2d6470['query']);_0x4fe3f0[_0x166d('0x30')]=_[_0x166d('0x2f')](_0x2d6470[_0x166d('0x2b')],qs[_0x166d('0x31')](_0x69ab64[_0x166d('0x2c')]['fields']));_0x4fe3f0['attributes']=_0x4fe3f0[_0x166d('0x30')][_0x166d('0x32')]?_0x4fe3f0[_0x166d('0x30')]:_0x2d6470[_0x166d('0x2b')];_0x4fe3f0[_0x166d('0x34')]=qs[_0x166d('0x35')](_0x69ab64[_0x166d('0x2c')][_0x166d('0x35')]);_0x4fe3f0[_0x166d('0x37')]=qs['filters'](_[_0x166d('0x36')](_0x69ab64[_0x166d('0x2c')],_0x2d6470['filters']));if(_0x69ab64[_0x166d('0x2c')][_0x166d('0x39')]){_0x4fe3f0['where']=_[_0x166d('0x47')](_0x4fe3f0['where'],{'$or':_[_0x166d('0x25')](_0x4fe3f0[_0x166d('0x30')],function(_0x40a8db){var _0x520098={};_0x520098[_0x40a8db]={'$like':'%'+_0x69ab64[_0x166d('0x2c')][_0x166d('0x39')]+'%'};return _0x520098;})});}_0x4fe3f0=_['merge']({},_0x4fe3f0,_0x69ab64['options']);return _0x47e3b2['getDescriptions'](_0x4fe3f0);}})[_0x166d('0x1f')](function(_0x3a340b){if(_0x3a340b){_0x2fead3=_0x3a340b[_0x166d('0x32')];if(!_0x69ab64[_0x166d('0x2c')]['hasOwnProperty'](_0x166d('0x49'))){_0x4fe3f0[_0x166d('0x19')]=qs[_0x166d('0x19')](_0x69ab64[_0x166d('0x2c')][_0x166d('0x19')]);_0x4fe3f0[_0x166d('0x17')]=qs[_0x166d('0x17')](_0x69ab64[_0x166d('0x2c')]['offset']);}return _0x47e3b2[_0x166d('0x4a')](_0x4fe3f0);}})[_0x166d('0x1f')](function(_0x1ab978){if(_0x1ab978){return _0x1ab978?{'count':_0x2fead3,'rows':_0x1ab978}:null;}})['then'](respondWithResult(_0x6ce0e4,null))[_0x166d('0x3d')](handleError(_0x6ce0e4,null));}; \ No newline at end of file +var _0x21ed=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','end','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','SugarcrmConfiguration','includeAll','include','findAll','show','attributes','length','options','find','body','catch','update','params','getFields','SugarcrmField','getSubjects','getDescriptions','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x142d5b,_0x2e3388){var _0x210f4a=function(_0x5d51bf){while(--_0x5d51bf){_0x142d5b['push'](_0x142d5b['shift']());}};_0x210f4a(++_0x2e3388);}(_0x21ed,0xe0));var _0xd21e=function(_0x190b51,_0x5b3786){_0x190b51=_0x190b51-0x0;var _0x91beb9=_0x21ed[_0x190b51];return _0x91beb9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd21e('0x0'));var zipdir=require(_0xd21e('0x1'));var jsonpatch=require(_0xd21e('0x2'));var rp=require(_0xd21e('0x3'));var moment=require(_0xd21e('0x4'));var BPromise=require(_0xd21e('0x5'));var Mustache=require(_0xd21e('0x6'));var util=require(_0xd21e('0x7'));var path=require(_0xd21e('0x8'));var sox=require(_0xd21e('0x9'));var csv=require(_0xd21e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd21e('0xb'));var squel=require('squel');var crypto=require(_0xd21e('0xc'));var jsforce=require(_0xd21e('0xd'));var deskjs=require(_0xd21e('0xe'));var toCsv=require(_0xd21e('0xa'));var querystring=require(_0xd21e('0xf'));var Papa=require(_0xd21e('0x10'));var Redis=require(_0xd21e('0x11'));var authService=require(_0xd21e('0x12'));var qs=require(_0xd21e('0x13'));var as=require(_0xd21e('0x14'));var hardwareService=require(_0xd21e('0x15'));var logger=require(_0xd21e('0x16'))(_0xd21e('0x17'));var utils=require('../../config/utils');var config=require(_0xd21e('0x18'));var licenseUtil=require(_0xd21e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e988a,_0x39813f){_0x39813f=_0x39813f||0xcc;return function(_0x358c50){if(_0x358c50){return _0x4e988a[_0xd21e('0x1a')](_0x39813f);}return _0x4e988a[_0xd21e('0x1b')](_0x39813f)['end']();};}function respondWithResult(_0x1cb04a,_0x389d06){_0x389d06=_0x389d06||0xc8;return function(_0x1016bf){if(_0x1016bf){return _0x1cb04a[_0xd21e('0x1b')](_0x389d06)[_0xd21e('0x1c')](_0x1016bf);}};}function respondWithFilteredResult(_0x4bc3ea,_0x2265f9){return function(_0x55c0f6){if(_0x55c0f6){var _0x1c5328=typeof _0x2265f9[_0xd21e('0x1d')]===_0xd21e('0x1e')&&typeof _0x2265f9[_0xd21e('0x1f')]===_0xd21e('0x1e');var _0x138c12=_0x55c0f6[_0xd21e('0x20')];var _0xd8e4d3=_0x1c5328?0x0:_0x2265f9[_0xd21e('0x1d')];var _0x2a5404=_0x1c5328?_0x55c0f6[_0xd21e('0x20')]:_0x2265f9[_0xd21e('0x1d')]+_0x2265f9[_0xd21e('0x1f')];var _0x1fbabc;if(_0x2a5404>=_0x138c12){_0x2a5404=_0x138c12;_0x1fbabc=0xc8;}else{_0x1fbabc=0xce;}_0x4bc3ea[_0xd21e('0x1b')](_0x1fbabc);return _0x4bc3ea[_0xd21e('0x21')](_0xd21e('0x22'),_0xd8e4d3+'-'+_0x2a5404+'/'+_0x138c12)['json'](_0x55c0f6);}return null;};}function patchUpdates(_0x32e1b9){return function(_0x31db01){try{jsonpatch[_0xd21e('0x23')](_0x31db01,_0x32e1b9,!![]);}catch(_0x31d9df){return BPromise['reject'](_0x31d9df);}return _0x31db01[_0xd21e('0x24')]();};}function saveUpdates(_0x9afa11,_0x5c08dc){return function(_0x13c609){if(_0x13c609){return _0x13c609['update'](_0x9afa11)['then'](function(_0x497edb){return _0x497edb;});}return null;};}function removeEntity(_0x2bf9fa,_0x18775d){return function(_0x321595){if(_0x321595){return _0x321595[_0xd21e('0x25')]()[_0xd21e('0x26')](function(){_0x2bf9fa[_0xd21e('0x1b')](0xcc)[_0xd21e('0x27')]();});}};}function handleEntityNotFound(_0x365bdf,_0xc9e6d5){return function(_0x5b2c29){if(!_0x5b2c29){_0x365bdf[_0xd21e('0x1a')](0x194);}return _0x5b2c29;};}function handleError(_0x108d81,_0x120cad){_0x120cad=_0x120cad||0x1f4;return function(_0x5e57d9){logger['error'](_0x5e57d9[_0xd21e('0x28')]);if(_0x5e57d9[_0xd21e('0x29')]){delete _0x5e57d9[_0xd21e('0x29')];}_0x108d81[_0xd21e('0x1b')](_0x120cad)[_0xd21e('0x2a')](_0x5e57d9);};}exports[_0xd21e('0x2b')]=function(_0x367654,_0x2ebc83){var _0x24d7f6={},_0x44f120={},_0x4dd969={'count':0x0,'rows':[]};var _0x24b785=_[_0xd21e('0x2c')](db['SugarcrmConfiguration'][_0xd21e('0x2d')],function(_0x3630fd){return{'name':_0x3630fd['fieldName'],'type':_0x3630fd[_0xd21e('0x2e')][_0xd21e('0x2f')]};});_0x44f120['model']=_[_0xd21e('0x2c')](_0x24b785,'name');_0x44f120[_0xd21e('0x30')]=_[_0xd21e('0x31')](_0x367654[_0xd21e('0x30')]);_0x44f120[_0xd21e('0x32')]=_['intersection'](_0x44f120['model'],_0x44f120[_0xd21e('0x30')]);_0x24d7f6['attributes']=_[_0xd21e('0x33')](_0x44f120[_0xd21e('0x34')],qs[_0xd21e('0x35')](_0x367654[_0xd21e('0x30')][_0xd21e('0x35')]));_0x24d7f6['attributes']=_0x24d7f6['attributes']['length']?_0x24d7f6['attributes']:_0x44f120['model'];if(!_0x367654['query'][_0xd21e('0x36')](_0xd21e('0x37'))){_0x24d7f6['limit']=qs[_0xd21e('0x1f')](_0x367654['query'][_0xd21e('0x1f')]);_0x24d7f6['offset']=qs[_0xd21e('0x1d')](_0x367654['query']['offset']);}_0x24d7f6[_0xd21e('0x38')]=qs[_0xd21e('0x39')](_0x367654[_0xd21e('0x30')]['sort']);_0x24d7f6['where']=qs[_0xd21e('0x32')](_[_0xd21e('0x3a')](_0x367654[_0xd21e('0x30')],_0x44f120[_0xd21e('0x32')]),_0x24b785);if(_0x367654[_0xd21e('0x30')]['filter']){_0x24d7f6[_0xd21e('0x3b')]=_[_0xd21e('0x3c')](_0x24d7f6['where'],{'$or':_[_0xd21e('0x2c')](_0x24b785,function(_0x60df13){if(_0x60df13[_0xd21e('0x2e')]!==_0xd21e('0x3d')){var _0x33145c={};_0x33145c[_0x60df13[_0xd21e('0x29')]]={'$like':'%'+_0x367654['query'][_0xd21e('0x3e')]+'%'};return _0x33145c;}})});}_0x24d7f6=_[_0xd21e('0x3c')]({},_0x24d7f6,_0x367654['options']);var _0xd56670={'where':_0x24d7f6[_0xd21e('0x3b')]};return db[_0xd21e('0x3f')]['count'](_0xd56670)['then'](function(_0x1fb923){_0x4dd969[_0xd21e('0x20')]=_0x1fb923;if(_0x367654[_0xd21e('0x30')][_0xd21e('0x40')]){_0x24d7f6[_0xd21e('0x41')]=[{'all':!![]}];}return db[_0xd21e('0x3f')][_0xd21e('0x42')](_0x24d7f6);})[_0xd21e('0x26')](function(_0x1016e2){_0x4dd969['rows']=_0x1016e2;return _0x4dd969;})[_0xd21e('0x26')](respondWithFilteredResult(_0x2ebc83,_0x24d7f6))['catch'](handleError(_0x2ebc83,null));};exports[_0xd21e('0x43')]=function(_0x45228f,_0x74ef2f){var _0x266af2={'raw':![],'where':{'id':_0x45228f['params']['id']}},_0x512fda={};_0x512fda['model']=_[_0xd21e('0x31')](db['SugarcrmConfiguration']['rawAttributes']);_0x512fda['query']=_[_0xd21e('0x31')](_0x45228f[_0xd21e('0x30')]);_0x512fda[_0xd21e('0x32')]=_['intersection'](_0x512fda[_0xd21e('0x34')],_0x512fda[_0xd21e('0x30')]);_0x266af2[_0xd21e('0x44')]=_[_0xd21e('0x33')](_0x512fda[_0xd21e('0x34')],qs['fields'](_0x45228f['query'][_0xd21e('0x35')]));_0x266af2['attributes']=_0x266af2[_0xd21e('0x44')][_0xd21e('0x45')]?_0x266af2['attributes']:_0x512fda[_0xd21e('0x34')];if(_0x45228f['query'][_0xd21e('0x40')]){_0x266af2[_0xd21e('0x41')]=[{'all':!![]}];}_0x266af2=_[_0xd21e('0x3c')]({},_0x266af2,_0x45228f[_0xd21e('0x46')]);return db['SugarcrmConfiguration'][_0xd21e('0x47')](_0x266af2)[_0xd21e('0x26')](handleEntityNotFound(_0x74ef2f,null))[_0xd21e('0x26')](respondWithResult(_0x74ef2f,null))['catch'](handleError(_0x74ef2f,null));};exports['create']=function(_0xa20424,_0x51e8a8){return db[_0xd21e('0x3f')]['create'](_0xa20424[_0xd21e('0x48')],{})['then'](respondWithResult(_0x51e8a8,0xc9))[_0xd21e('0x49')](handleError(_0x51e8a8,null));};exports[_0xd21e('0x4a')]=function(_0x28eab3,_0x3ba6a9){if(_0x28eab3['body']['id']){delete _0x28eab3['body']['id'];}return db[_0xd21e('0x3f')]['find']({'where':{'id':_0x28eab3[_0xd21e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3ba6a9,null))['then'](saveUpdates(_0x28eab3[_0xd21e('0x48')],null))[_0xd21e('0x26')](respondWithResult(_0x3ba6a9,null))[_0xd21e('0x49')](handleError(_0x3ba6a9,null));};exports[_0xd21e('0x25')]=function(_0x5f5746,_0x150fc7){return db[_0xd21e('0x3f')][_0xd21e('0x47')]({'where':{'id':_0x5f5746[_0xd21e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x150fc7,null))[_0xd21e('0x26')](removeEntity(_0x150fc7,null))[_0xd21e('0x49')](handleError(_0x150fc7,null));};exports[_0xd21e('0x4c')]=function(_0x43a420,_0x31a893,_0x383c70){var _0x2906ee={};var _0x2e4c71={};var _0x509bee;var _0x33de1e;return db[_0xd21e('0x3f')]['findOne']({'where':{'id':_0x43a420[_0xd21e('0x4b')]['id']}})[_0xd21e('0x26')](handleEntityNotFound(_0x31a893,null))[_0xd21e('0x26')](function(_0x3b2585){if(_0x3b2585){_0x509bee=_0x3b2585;_0x2e4c71['model']=_[_0xd21e('0x31')](db[_0xd21e('0x4d')][_0xd21e('0x2d')]);_0x2e4c71[_0xd21e('0x30')]=_[_0xd21e('0x31')](_0x43a420[_0xd21e('0x30')]);_0x2e4c71[_0xd21e('0x32')]=_[_0xd21e('0x33')](_0x2e4c71[_0xd21e('0x34')],_0x2e4c71[_0xd21e('0x30')]);_0x2906ee[_0xd21e('0x44')]=_[_0xd21e('0x33')](_0x2e4c71[_0xd21e('0x34')],qs['fields'](_0x43a420['query']['fields']));_0x2906ee[_0xd21e('0x44')]=_0x2906ee[_0xd21e('0x44')][_0xd21e('0x45')]?_0x2906ee[_0xd21e('0x44')]:_0x2e4c71['model'];_0x2906ee[_0xd21e('0x38')]=qs[_0xd21e('0x39')](_0x43a420[_0xd21e('0x30')][_0xd21e('0x39')]);_0x2906ee[_0xd21e('0x3b')]=qs[_0xd21e('0x32')](_[_0xd21e('0x3a')](_0x43a420['query'],_0x2e4c71[_0xd21e('0x32')]));if(_0x43a420[_0xd21e('0x30')][_0xd21e('0x3e')]){_0x2906ee[_0xd21e('0x3b')]=_[_0xd21e('0x3c')](_0x2906ee['where'],{'$or':_[_0xd21e('0x2c')](_0x2906ee[_0xd21e('0x44')],function(_0x1af76c){var _0x4e034a={};_0x4e034a[_0x1af76c]={'$like':'%'+_0x43a420[_0xd21e('0x30')]['filter']+'%'};return _0x4e034a;})});}_0x2906ee=_[_0xd21e('0x3c')]({},_0x2906ee,_0x43a420[_0xd21e('0x46')]);return _0x509bee[_0xd21e('0x4c')](_0x2906ee);}})[_0xd21e('0x26')](function(_0x344807){if(_0x344807){_0x33de1e=_0x344807[_0xd21e('0x45')];if(!_0x43a420[_0xd21e('0x30')]['hasOwnProperty'](_0xd21e('0x37'))){_0x2906ee[_0xd21e('0x1f')]=qs[_0xd21e('0x1f')](_0x43a420[_0xd21e('0x30')][_0xd21e('0x1f')]);_0x2906ee[_0xd21e('0x1d')]=qs[_0xd21e('0x1d')](_0x43a420[_0xd21e('0x30')][_0xd21e('0x1d')]);}return _0x509bee[_0xd21e('0x4c')](_0x2906ee);}})[_0xd21e('0x26')](function(_0x395454){if(_0x395454){return _0x395454?{'count':_0x33de1e,'rows':_0x395454}:null;}})['then'](respondWithResult(_0x31a893,null))[_0xd21e('0x49')](handleError(_0x31a893,null));};exports[_0xd21e('0x4e')]=function(_0x383cbe,_0xcc182e,_0x1c330b){var _0x586d14={};var _0xfbef8={};var _0x34b4a8;var _0x470706;return db[_0xd21e('0x3f')]['findOne']({'where':{'id':_0x383cbe[_0xd21e('0x4b')]['id']}})[_0xd21e('0x26')](handleEntityNotFound(_0xcc182e,null))[_0xd21e('0x26')](function(_0x2005fe){if(_0x2005fe){_0x34b4a8=_0x2005fe;_0xfbef8[_0xd21e('0x34')]=_[_0xd21e('0x31')](db[_0xd21e('0x4d')]['rawAttributes']);_0xfbef8[_0xd21e('0x30')]=_['keys'](_0x383cbe['query']);_0xfbef8[_0xd21e('0x32')]=_['intersection'](_0xfbef8[_0xd21e('0x34')],_0xfbef8[_0xd21e('0x30')]);_0x586d14['attributes']=_[_0xd21e('0x33')](_0xfbef8['model'],qs[_0xd21e('0x35')](_0x383cbe[_0xd21e('0x30')][_0xd21e('0x35')]));_0x586d14[_0xd21e('0x44')]=_0x586d14[_0xd21e('0x44')][_0xd21e('0x45')]?_0x586d14[_0xd21e('0x44')]:_0xfbef8[_0xd21e('0x34')];_0x586d14[_0xd21e('0x38')]=qs[_0xd21e('0x39')](_0x383cbe[_0xd21e('0x30')][_0xd21e('0x39')]);_0x586d14['where']=qs[_0xd21e('0x32')](_[_0xd21e('0x3a')](_0x383cbe['query'],_0xfbef8[_0xd21e('0x32')]));if(_0x383cbe[_0xd21e('0x30')][_0xd21e('0x3e')]){_0x586d14[_0xd21e('0x3b')]=_[_0xd21e('0x3c')](_0x586d14['where'],{'$or':_['map'](_0x586d14[_0xd21e('0x44')],function(_0x14f1a6){var _0x5ddcd9={};_0x5ddcd9[_0x14f1a6]={'$like':'%'+_0x383cbe[_0xd21e('0x30')][_0xd21e('0x3e')]+'%'};return _0x5ddcd9;})});}_0x586d14=_[_0xd21e('0x3c')]({},_0x586d14,_0x383cbe[_0xd21e('0x46')]);return _0x34b4a8['getSubjects'](_0x586d14);}})[_0xd21e('0x26')](function(_0x470e87){if(_0x470e87){_0x470706=_0x470e87['length'];if(!_0x383cbe[_0xd21e('0x30')][_0xd21e('0x36')](_0xd21e('0x37'))){_0x586d14[_0xd21e('0x1f')]=qs[_0xd21e('0x1f')](_0x383cbe['query'][_0xd21e('0x1f')]);_0x586d14[_0xd21e('0x1d')]=qs[_0xd21e('0x1d')](_0x383cbe['query'][_0xd21e('0x1d')]);}return _0x34b4a8[_0xd21e('0x4e')](_0x586d14);}})[_0xd21e('0x26')](function(_0x4a9288){if(_0x4a9288){return _0x4a9288?{'count':_0x470706,'rows':_0x4a9288}:null;}})['then'](respondWithResult(_0xcc182e,null))[_0xd21e('0x49')](handleError(_0xcc182e,null));};exports[_0xd21e('0x4f')]=function(_0x2576c3,_0x1aa640,_0x56cde6){var _0x521107={};var _0x4b1d42={};var _0x1df85d;var _0x13f35a;return db[_0xd21e('0x3f')][_0xd21e('0x50')]({'where':{'id':_0x2576c3[_0xd21e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1aa640,null))[_0xd21e('0x26')](function(_0xe090ac){if(_0xe090ac){_0x1df85d=_0xe090ac;_0x4b1d42['model']=_[_0xd21e('0x31')](db[_0xd21e('0x4d')][_0xd21e('0x2d')]);_0x4b1d42[_0xd21e('0x30')]=_[_0xd21e('0x31')](_0x2576c3[_0xd21e('0x30')]);_0x4b1d42['filters']=_['intersection'](_0x4b1d42[_0xd21e('0x34')],_0x4b1d42['query']);_0x521107['attributes']=_[_0xd21e('0x33')](_0x4b1d42[_0xd21e('0x34')],qs[_0xd21e('0x35')](_0x2576c3['query'][_0xd21e('0x35')]));_0x521107[_0xd21e('0x44')]=_0x521107[_0xd21e('0x44')][_0xd21e('0x45')]?_0x521107['attributes']:_0x4b1d42[_0xd21e('0x34')];_0x521107[_0xd21e('0x38')]=qs[_0xd21e('0x39')](_0x2576c3['query'][_0xd21e('0x39')]);_0x521107[_0xd21e('0x3b')]=qs['filters'](_['pick'](_0x2576c3[_0xd21e('0x30')],_0x4b1d42['filters']));if(_0x2576c3[_0xd21e('0x30')][_0xd21e('0x3e')]){_0x521107['where']=_['merge'](_0x521107[_0xd21e('0x3b')],{'$or':_['map'](_0x521107[_0xd21e('0x44')],function(_0x1a7c37){var _0x70d160={};_0x70d160[_0x1a7c37]={'$like':'%'+_0x2576c3['query'][_0xd21e('0x3e')]+'%'};return _0x70d160;})});}_0x521107=_[_0xd21e('0x3c')]({},_0x521107,_0x2576c3['options']);return _0x1df85d['getDescriptions'](_0x521107);}})['then'](function(_0x20f1b3){if(_0x20f1b3){_0x13f35a=_0x20f1b3[_0xd21e('0x45')];if(!_0x2576c3[_0xd21e('0x30')][_0xd21e('0x36')](_0xd21e('0x37'))){_0x521107[_0xd21e('0x1f')]=qs[_0xd21e('0x1f')](_0x2576c3['query'][_0xd21e('0x1f')]);_0x521107[_0xd21e('0x1d')]=qs[_0xd21e('0x1d')](_0x2576c3[_0xd21e('0x30')]['offset']);}return _0x1df85d['getDescriptions'](_0x521107);}})[_0xd21e('0x26')](function(_0x40c326){if(_0x40c326){return _0x40c326?{'count':_0x13f35a,'rows':_0x40c326}:null;}})[_0xd21e('0x26')](respondWithResult(_0x1aa640,null))[_0xd21e('0x49')](handleError(_0x1aa640,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 9ff498a..3b9edb8 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 _0x7785=['int_sugarcrm_configurations','util','../../config/logger','api','moment','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration'];(function(_0x53e4fa,_0x1e5aac){var _0x10cae4=function(_0x343f0a){while(--_0x343f0a){_0x53e4fa['push'](_0x53e4fa['shift']());}};_0x10cae4(++_0x1e5aac);}(_0x7785,0x7a));var _0x5778=function(_0x310ee6,_0x1c7405){_0x310ee6=_0x310ee6-0x0;var _0x48ab49=_0x7785[_0x310ee6];return _0x48ab49;};'use strict';var _=require('lodash');var util=require(_0x5778('0x0'));var logger=require(_0x5778('0x1'))(_0x5778('0x2'));var moment=require(_0x5778('0x3'));var BPromise=require('bluebird');var rp=require(_0x5778('0x4'));var fs=require('fs');var path=require(_0x5778('0x5'));var rimraf=require(_0x5778('0x6'));var config=require('../../config/environment');var attributes=require(_0x5778('0x7'));module[_0x5778('0x8')]=function(_0x395f7f,_0x360342){return _0x395f7f['define'](_0x5778('0x9'),attributes,{'tableName':_0x5778('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ae3=['./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2d5796,_0x48a380){var _0x4f6b36=function(_0x25c2e2){while(--_0x25c2e2){_0x2d5796['push'](_0x2d5796['shift']());}};_0x4f6b36(++_0x48a380);}(_0x7ae3,0x1b1));var _0x37ae=function(_0x3924a8,_0x242cb6){_0x3924a8=_0x3924a8-0x0;var _0x37dca9=_0x7ae3[_0x3924a8];return _0x37dca9;};'use strict';var _=require(_0x37ae('0x0'));var util=require(_0x37ae('0x1'));var logger=require(_0x37ae('0x2'))(_0x37ae('0x3'));var moment=require(_0x37ae('0x4'));var BPromise=require(_0x37ae('0x5'));var rp=require(_0x37ae('0x6'));var fs=require('fs');var path=require(_0x37ae('0x7'));var rimraf=require(_0x37ae('0x8'));var config=require('../../config/environment');var attributes=require(_0x37ae('0x9'));module[_0x37ae('0xa')]=function(_0x467aec,_0xa5e9f1){return _0x467aec[_0x37ae('0xb')]('SugarcrmConfiguration',attributes,{'tableName':_0x37ae('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 0c957c2..80e58a6 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 _0xb80e=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','request\x20sent','error'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0xb80e,0x18e));var _0xeb80=function(_0x3a3a8e,_0x2c7822){_0x3a3a8e=_0x3a3a8e-0x0;var _0x3cdf16=_0xb80e[_0x3a3a8e];return _0x3cdf16;};'use strict';var _=require(_0xeb80('0x0'));var util=require(_0xeb80('0x1'));var moment=require(_0xeb80('0x2'));var BPromise=require(_0xeb80('0x3'));var rs=require(_0xeb80('0x4'));var fs=require('fs');var Redis=require(_0xeb80('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeb80('0x6'));var config=require(_0xeb80('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xeb80('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53f5c9,_0x50057f,_0x4557f6){return new BPromise(function(_0x12de23,_0x50743e){return client[_0xeb80('0x9')](_0x53f5c9,_0x4557f6)[_0xeb80('0xa')](function(_0x4a1990){logger[_0xeb80('0xb')](_0xeb80('0xc'),_0x50057f,'request\x20sent');logger[_0xeb80('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x50057f,_0xeb80('0xe'),JSON['stringify'](_0x4a1990));if(_0x4a1990['error']){if(_0x4a1990[_0xeb80('0xf')]['code']===0x1f4){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x50057f,_0x4a1990[_0xeb80('0xf')][_0xeb80('0x10')]);return _0x50743e(_0x4a1990[_0xeb80('0xf')]['message']);}logger['error'](_0xeb80('0xc'),_0x50057f,_0x4a1990[_0xeb80('0xf')]['message']);return _0x12de23(_0x4a1990['error'][_0xeb80('0x10')]);}else{logger['info'](_0xeb80('0xc'),_0x50057f,_0xeb80('0xe'));_0x12de23(_0x4a1990[_0xeb80('0x11')][_0xeb80('0x10')]);}})['catch'](function(_0x31a8a2){logger[_0xeb80('0xf')](_0xeb80('0xc'),_0x50057f,_0x31a8a2);_0x50743e(_0x31a8a2);});});} \ No newline at end of file +var _0xdfe4=['info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then'];(function(_0x1f31af,_0x5d781b){var _0x5f3e00=function(_0x486f5d){while(--_0x486f5d){_0x1f31af['push'](_0x1f31af['shift']());}};_0x5f3e00(++_0x5d781b);}(_0xdfe4,0x18a));var _0x4dfe=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xdfe4[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x4dfe('0x0'));var util=require(_0x4dfe('0x1'));var moment=require(_0x4dfe('0x2'));var BPromise=require(_0x4dfe('0x3'));var rs=require(_0x4dfe('0x4'));var fs=require('fs');var Redis=require(_0x4dfe('0x5'));var db=require(_0x4dfe('0x6'))['db'];var utils=require(_0x4dfe('0x7'));var logger=require(_0x4dfe('0x8'))('rpc');var config=require(_0x4dfe('0x9'));var jayson=require(_0x4dfe('0xa'));var client=jayson[_0x4dfe('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b8bf8,_0x36c2a8,_0x43950d){return new BPromise(function(_0x3d7cf7,_0x6c787b){return client[_0x4dfe('0xc')](_0x3b8bf8,_0x43950d)[_0x4dfe('0xd')](function(_0x5033d6){logger[_0x4dfe('0xe')](_0x4dfe('0xf'),_0x36c2a8,_0x4dfe('0x10'));logger[_0x4dfe('0x11')](_0x4dfe('0x12'),_0x36c2a8,_0x4dfe('0x10'),JSON[_0x4dfe('0x13')](_0x5033d6));if(_0x5033d6[_0x4dfe('0x14')]){if(_0x5033d6['error']['code']===0x1f4){logger[_0x4dfe('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x36c2a8,_0x5033d6[_0x4dfe('0x14')][_0x4dfe('0x15')]);return _0x6c787b(_0x5033d6[_0x4dfe('0x14')][_0x4dfe('0x15')]);}logger[_0x4dfe('0x14')](_0x4dfe('0xf'),_0x36c2a8,_0x5033d6[_0x4dfe('0x14')]['message']);return _0x3d7cf7(_0x5033d6[_0x4dfe('0x14')][_0x4dfe('0x15')]);}else{logger[_0x4dfe('0xe')](_0x4dfe('0xf'),_0x36c2a8,_0x4dfe('0x10'));_0x3d7cf7(_0x5033d6[_0x4dfe('0x16')][_0x4dfe('0x15')]);}})[_0x4dfe('0x17')](function(_0x5797ab){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x36c2a8,_0x5797ab);_0x6c787b(_0x5797ab);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 5ea6356..0c49673 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 _0xa605=['index','show','post','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','get','isAuthenticated'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xa605,0xec));var _0x5a60=function(_0x15eaea,_0x486b70){_0x15eaea=_0x15eaea-0x0;var _0x3edf8f=_0xa605[_0x15eaea];return _0x3edf8f;};'use strict';var multer=require(_0x5a60('0x0'));var util=require(_0x5a60('0x1'));var path=require('path');var timeout=require(_0x5a60('0x2'));var express=require(_0x5a60('0x3'));var router=express[_0x5a60('0x4')]();var fs_extra=require(_0x5a60('0x5'));var auth=require(_0x5a60('0x6'));var interaction=require(_0x5a60('0x7'));var config=require('../../config/environment');var controller=require(_0x5a60('0x8'));router[_0x5a60('0x9')]('/',auth[_0x5a60('0xa')](),controller[_0x5a60('0xb')]);router[_0x5a60('0x9')]('/:id',auth[_0x5a60('0xa')](),controller[_0x5a60('0xc')]);router[_0x5a60('0xd')]('/',auth[_0x5a60('0xa')](),controller['create']);router[_0x5a60('0xe')](_0x5a60('0xf'),auth[_0x5a60('0xa')](),controller[_0x5a60('0x10')]);router[_0x5a60('0x11')](_0x5a60('0xf'),auth[_0x5a60('0xa')](),controller[_0x5a60('0x12')]);module['exports']=router; \ No newline at end of file +var _0x956c=['util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated','show','create','update','delete','destroy','exports','multer'];(function(_0x23f8c8,_0xb536b9){var _0x3dc718=function(_0x25d719){while(--_0x25d719){_0x23f8c8['push'](_0x23f8c8['shift']());}};_0x3dc718(++_0xb536b9);}(_0x956c,0x6b));var _0xc956=function(_0x5a2567,_0x2fa0b3){_0x5a2567=_0x5a2567-0x0;var _0x367ca4=_0x956c[_0x5a2567];return _0x367ca4;};'use strict';var multer=require(_0xc956('0x0'));var util=require(_0xc956('0x1'));var path=require('path');var timeout=require(_0xc956('0x2'));var express=require(_0xc956('0x3'));var router=express[_0xc956('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc956('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc956('0x6'));var controller=require(_0xc956('0x7'));router[_0xc956('0x8')]('/',auth['isAuthenticated'](),controller[_0xc956('0x9')]);router[_0xc956('0x8')](_0xc956('0xa'),auth[_0xc956('0xb')](),controller[_0xc956('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc956('0xd')]);router['put'](_0xc956('0xa'),auth[_0xc956('0xb')](),controller[_0xc956('0xe')]);router[_0xc956('0xf')](_0xc956('0xa'),auth['isAuthenticated'](),controller[_0xc956('0x10')]);module[_0xc956('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 3d5b906..9e4b45d 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 _0xd4a9=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd4a9,0x78));var _0x9d4a=function(_0xf36d79,_0x2985aa){_0xf36d79=_0xf36d79-0x0;var _0x65dc01=_0xd4a9[_0xf36d79];return _0x65dc01;};'use strict';var Sequelize=require(_0x9d4a('0x0'));module[_0x9d4a('0x1')]={'type':{'type':Sequelize[_0x9d4a('0x2')](_0x9d4a('0x3'),'variable',_0x9d4a('0x4'),'keyValue','picklist'),'defaultValue':_0x9d4a('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9d4a('0x2')](_0x9d4a('0x3'),'variable',_0x9d4a('0x4'))},'keyContent':{'type':Sequelize[_0x9d4a('0x5')]},'idField':{'type':Sequelize[_0x9d4a('0x5')]},'nameField':{'type':Sequelize[_0x9d4a('0x5')]},'customField':{'type':Sequelize[_0x9d4a('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9d4a('0x5')]}}; \ No newline at end of file +var _0x91b8=['customVariable','picklist','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x91b8,0x1d3));var _0x891b=function(_0x542835,_0x5093be){_0x542835=_0x542835-0x0;var _0x35f73c=_0x91b8[_0x542835];return _0x35f73c;};'use strict';var Sequelize=require(_0x891b('0x0'));module[_0x891b('0x1')]={'type':{'type':Sequelize[_0x891b('0x2')](_0x891b('0x3'),_0x891b('0x4'),_0x891b('0x5'),'keyValue',_0x891b('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x891b('0x7')]},'key':{'type':Sequelize[_0x891b('0x7')]},'keyType':{'type':Sequelize[_0x891b('0x2')](_0x891b('0x3'),'variable',_0x891b('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x891b('0x7')]},'nameField':{'type':Sequelize[_0x891b('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x891b('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index d02c0bb..4280d8a 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 _0x79c9=['rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','status','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll'];(function(_0x1a362a,_0x532d2e){var _0x1c6fc4=function(_0x57b081){while(--_0x57b081){_0x1a362a['push'](_0x1a362a['shift']());}};_0x1c6fc4(++_0x532d2e);}(_0x79c9,0xf4));var _0x979c=function(_0x497e2b,_0x3b0709){_0x497e2b=_0x497e2b-0x0;var _0x1f96d8=_0x79c9[_0x497e2b];return _0x1f96d8;};'use strict';var emlformat=require(_0x979c('0x0'));var rimraf=require(_0x979c('0x1'));var zipdir=require(_0x979c('0x2'));var jsonpatch=require(_0x979c('0x3'));var rp=require(_0x979c('0x4'));var moment=require(_0x979c('0x5'));var BPromise=require(_0x979c('0x6'));var Mustache=require(_0x979c('0x7'));var util=require(_0x979c('0x8'));var path=require(_0x979c('0x9'));var sox=require(_0x979c('0xa'));var csv=require(_0x979c('0xb'));var ejs=require(_0x979c('0xc'));var fs=require('fs');var fs_extra=require(_0x979c('0xd'));var _=require(_0x979c('0xe'));var squel=require('squel');var crypto=require(_0x979c('0xf'));var jsforce=require(_0x979c('0x10'));var deskjs=require(_0x979c('0x11'));var toCsv=require(_0x979c('0xb'));var querystring=require(_0x979c('0x12'));var Papa=require(_0x979c('0x13'));var Redis=require(_0x979c('0x14'));var authService=require(_0x979c('0x15'));var qs=require(_0x979c('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x979c('0x17'))(_0x979c('0x18'));var utils=require(_0x979c('0x19'));var config=require(_0x979c('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x979c('0x1b'))['db'];function respondWithStatusCode(_0x493fcc,_0x17109e){_0x17109e=_0x17109e||0xcc;return function(_0x1fe743){if(_0x1fe743){return _0x493fcc[_0x979c('0x1c')](_0x17109e);}return _0x493fcc['status'](_0x17109e)[_0x979c('0x1d')]();};}function respondWithResult(_0xfe9309,_0x11cf2b){_0x11cf2b=_0x11cf2b||0xc8;return function(_0x55aff4){if(_0x55aff4){return _0xfe9309['status'](_0x11cf2b)[_0x979c('0x1e')](_0x55aff4);}};}function respondWithFilteredResult(_0x4cbef7,_0x123512){return function(_0x5b24c2){if(_0x5b24c2){var _0x30afe9=typeof _0x123512[_0x979c('0x1f')]===_0x979c('0x20')&&typeof _0x123512[_0x979c('0x21')]==='undefined';var _0x517ecf=_0x5b24c2['count'];var _0x512dcd=_0x30afe9?0x0:_0x123512[_0x979c('0x1f')];var _0x5791d9=_0x30afe9?_0x5b24c2[_0x979c('0x22')]:_0x123512[_0x979c('0x1f')]+_0x123512[_0x979c('0x21')];var _0x2fc106;if(_0x5791d9>=_0x517ecf){_0x5791d9=_0x517ecf;_0x2fc106=0xc8;}else{_0x2fc106=0xce;}_0x4cbef7['status'](_0x2fc106);return _0x4cbef7[_0x979c('0x23')](_0x979c('0x24'),_0x512dcd+'-'+_0x5791d9+'/'+_0x517ecf)[_0x979c('0x1e')](_0x5b24c2);}return null;};}function patchUpdates(_0x1417df){return function(_0x553870){try{jsonpatch[_0x979c('0x25')](_0x553870,_0x1417df,!![]);}catch(_0xeeabf8){return BPromise['reject'](_0xeeabf8);}return _0x553870[_0x979c('0x26')]();};}function saveUpdates(_0x59e76e,_0x34bad4){return function(_0x15f165){if(_0x15f165){return _0x15f165[_0x979c('0x27')](_0x59e76e)[_0x979c('0x28')](function(_0x4e2e47){return _0x4e2e47;});}return null;};}function removeEntity(_0x2d00bb,_0x119545){return function(_0x4b2fde){if(_0x4b2fde){return _0x4b2fde[_0x979c('0x29')]()[_0x979c('0x28')](function(){_0x2d00bb[_0x979c('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e9d78,_0x5c9883){return function(_0x1d606f){if(!_0x1d606f){_0x5e9d78['sendStatus'](0x194);}return _0x1d606f;};}function handleError(_0x76db,_0x4dbaaf){_0x4dbaaf=_0x4dbaaf||0x1f4;return function(_0x13c5f3){logger[_0x979c('0x2b')](_0x13c5f3[_0x979c('0x2c')]);if(_0x13c5f3['name']){delete _0x13c5f3[_0x979c('0x2d')];}_0x76db[_0x979c('0x2a')](_0x4dbaaf)[_0x979c('0x2e')](_0x13c5f3);};}exports[_0x979c('0x2f')]=function(_0x39dc06,_0x4d805e){var _0x5a273c={},_0xbd694={},_0xa9cd5d={'count':0x0,'rows':[]};var _0x170e67=_[_0x979c('0x30')](db[_0x979c('0x31')][_0x979c('0x32')],function(_0x45ce01){return{'name':_0x45ce01[_0x979c('0x33')],'type':_0x45ce01[_0x979c('0x34')]['key']};});_0xbd694[_0x979c('0x35')]=_[_0x979c('0x30')](_0x170e67,_0x979c('0x2d'));_0xbd694[_0x979c('0x36')]=_[_0x979c('0x37')](_0x39dc06[_0x979c('0x36')]);_0xbd694[_0x979c('0x38')]=_[_0x979c('0x39')](_0xbd694[_0x979c('0x35')],_0xbd694[_0x979c('0x36')]);_0x5a273c[_0x979c('0x3a')]=_[_0x979c('0x39')](_0xbd694[_0x979c('0x35')],qs[_0x979c('0x3b')](_0x39dc06[_0x979c('0x36')]['fields']));_0x5a273c[_0x979c('0x3a')]=_0x5a273c[_0x979c('0x3a')][_0x979c('0x3c')]?_0x5a273c['attributes']:_0xbd694[_0x979c('0x35')];if(!_0x39dc06[_0x979c('0x36')][_0x979c('0x3d')]('nolimit')){_0x5a273c['limit']=qs[_0x979c('0x21')](_0x39dc06['query'][_0x979c('0x21')]);_0x5a273c[_0x979c('0x1f')]=qs[_0x979c('0x1f')](_0x39dc06[_0x979c('0x36')][_0x979c('0x1f')]);}_0x5a273c['order']=qs[_0x979c('0x3e')](_0x39dc06['query'][_0x979c('0x3e')]);_0x5a273c[_0x979c('0x3f')]=qs['filters'](_[_0x979c('0x40')](_0x39dc06['query'],_0xbd694[_0x979c('0x38')]),_0x170e67);if(_0x39dc06['query']['filter']){_0x5a273c[_0x979c('0x3f')]=_[_0x979c('0x41')](_0x5a273c[_0x979c('0x3f')],{'$or':_[_0x979c('0x30')](_0x170e67,function(_0x444406){if(_0x444406[_0x979c('0x34')]!==_0x979c('0x42')){var _0x3885a5={};_0x3885a5[_0x444406[_0x979c('0x2d')]]={'$like':'%'+_0x39dc06['query'][_0x979c('0x43')]+'%'};return _0x3885a5;}})});}_0x5a273c=_[_0x979c('0x41')]({},_0x5a273c,_0x39dc06[_0x979c('0x44')]);var _0x364a37={'where':_0x5a273c[_0x979c('0x3f')]};return db[_0x979c('0x31')]['count'](_0x364a37)['then'](function(_0x58361e){_0xa9cd5d[_0x979c('0x22')]=_0x58361e;if(_0x39dc06[_0x979c('0x36')][_0x979c('0x45')]){_0x5a273c[_0x979c('0x46')]=[{'all':!![]}];}return db[_0x979c('0x31')][_0x979c('0x47')](_0x5a273c);})[_0x979c('0x28')](function(_0x49324d){_0xa9cd5d[_0x979c('0x48')]=_0x49324d;return _0xa9cd5d;})[_0x979c('0x28')](respondWithFilteredResult(_0x4d805e,_0x5a273c))['catch'](handleError(_0x4d805e,null));};exports[_0x979c('0x49')]=function(_0x2ad333,_0x1d542e){var _0x30ee17={'raw':!![],'where':{'id':_0x2ad333[_0x979c('0x4a')]['id']}},_0x41658b={};_0x41658b[_0x979c('0x35')]=_[_0x979c('0x37')](db[_0x979c('0x31')][_0x979c('0x32')]);_0x41658b[_0x979c('0x36')]=_[_0x979c('0x37')](_0x2ad333[_0x979c('0x36')]);_0x41658b[_0x979c('0x38')]=_[_0x979c('0x39')](_0x41658b[_0x979c('0x35')],_0x41658b[_0x979c('0x36')]);_0x30ee17[_0x979c('0x3a')]=_['intersection'](_0x41658b[_0x979c('0x35')],qs['fields'](_0x2ad333[_0x979c('0x36')]['fields']));_0x30ee17[_0x979c('0x3a')]=_0x30ee17[_0x979c('0x3a')][_0x979c('0x3c')]?_0x30ee17[_0x979c('0x3a')]:_0x41658b['model'];if(_0x2ad333[_0x979c('0x36')]['includeAll']){_0x30ee17[_0x979c('0x46')]=[{'all':!![]}];}_0x30ee17=_[_0x979c('0x41')]({},_0x30ee17,_0x2ad333[_0x979c('0x44')]);return db[_0x979c('0x31')][_0x979c('0x4b')](_0x30ee17)['then'](handleEntityNotFound(_0x1d542e,null))[_0x979c('0x28')](respondWithResult(_0x1d542e,null))[_0x979c('0x4c')](handleError(_0x1d542e,null));};exports[_0x979c('0x4d')]=function(_0x4f720a,_0x3a459d){return db[_0x979c('0x31')]['create'](_0x4f720a['body'],{})[_0x979c('0x28')](respondWithResult(_0x3a459d,0xc9))[_0x979c('0x4c')](handleError(_0x3a459d,null));};exports[_0x979c('0x27')]=function(_0x422ec0,_0x38d719){if(_0x422ec0[_0x979c('0x4e')]['id']){delete _0x422ec0[_0x979c('0x4e')]['id'];}return db[_0x979c('0x31')][_0x979c('0x4b')]({'where':{'id':_0x422ec0[_0x979c('0x4a')]['id']}})[_0x979c('0x28')](handleEntityNotFound(_0x38d719,null))['then'](saveUpdates(_0x422ec0['body'],null))[_0x979c('0x28')](respondWithResult(_0x38d719,null))['catch'](handleError(_0x38d719,null));};exports['destroy']=function(_0x1d7f58,_0x7be101){return db[_0x979c('0x31')][_0x979c('0x4b')]({'where':{'id':_0x1d7f58[_0x979c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x7be101,null))[_0x979c('0x28')](removeEntity(_0x7be101,null))['catch'](handleError(_0x7be101,null));}; \ No newline at end of file +var _0x7618=['request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','SugarcrmField','includeAll','rows','show','params','include','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x7618,0x1be));var _0x8761=function(_0x84a742,_0x3964d7){_0x84a742=_0x84a742-0x0;var _0x268bc4=_0x7618[_0x84a742];return _0x268bc4;};'use strict';var emlformat=require(_0x8761('0x0'));var rimraf=require(_0x8761('0x1'));var zipdir=require(_0x8761('0x2'));var jsonpatch=require(_0x8761('0x3'));var rp=require(_0x8761('0x4'));var moment=require(_0x8761('0x5'));var BPromise=require(_0x8761('0x6'));var Mustache=require(_0x8761('0x7'));var util=require('util');var path=require(_0x8761('0x8'));var sox=require(_0x8761('0x9'));var csv=require(_0x8761('0xa'));var ejs=require(_0x8761('0xb'));var fs=require('fs');var fs_extra=require(_0x8761('0xc'));var _=require(_0x8761('0xd'));var squel=require(_0x8761('0xe'));var crypto=require(_0x8761('0xf'));var jsforce=require(_0x8761('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8761('0x11'));var Papa=require(_0x8761('0x12'));var Redis=require(_0x8761('0x13'));var authService=require(_0x8761('0x14'));var qs=require(_0x8761('0x15'));var as=require(_0x8761('0x16'));var hardwareService=require(_0x8761('0x17'));var logger=require('../../config/logger')(_0x8761('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8761('0x19'));var db=require(_0x8761('0x1a'))['db'];function respondWithStatusCode(_0x14861e,_0x107364){_0x107364=_0x107364||0xcc;return function(_0x5aa2af){if(_0x5aa2af){return _0x14861e[_0x8761('0x1b')](_0x107364);}return _0x14861e[_0x8761('0x1c')](_0x107364)[_0x8761('0x1d')]();};}function respondWithResult(_0x417231,_0x148365){_0x148365=_0x148365||0xc8;return function(_0x2d5d26){if(_0x2d5d26){return _0x417231[_0x8761('0x1c')](_0x148365)['json'](_0x2d5d26);}};}function respondWithFilteredResult(_0x1c290c,_0x4b7a95){return function(_0x199c54){if(_0x199c54){var _0x1e6c0b=typeof _0x4b7a95[_0x8761('0x1e')]===_0x8761('0x1f')&&typeof _0x4b7a95[_0x8761('0x20')]===_0x8761('0x1f');var _0x584d25=_0x199c54['count'];var _0x1d7760=_0x1e6c0b?0x0:_0x4b7a95[_0x8761('0x1e')];var _0x2602a8=_0x1e6c0b?_0x199c54[_0x8761('0x21')]:_0x4b7a95['offset']+_0x4b7a95[_0x8761('0x20')];var _0x151111;if(_0x2602a8>=_0x584d25){_0x2602a8=_0x584d25;_0x151111=0xc8;}else{_0x151111=0xce;}_0x1c290c['status'](_0x151111);return _0x1c290c[_0x8761('0x22')](_0x8761('0x23'),_0x1d7760+'-'+_0x2602a8+'/'+_0x584d25)['json'](_0x199c54);}return null;};}function patchUpdates(_0xb90170){return function(_0x269929){try{jsonpatch[_0x8761('0x24')](_0x269929,_0xb90170,!![]);}catch(_0x4f916a){return BPromise['reject'](_0x4f916a);}return _0x269929['save']();};}function saveUpdates(_0x3909bf,_0x460d1c){return function(_0x5051b6){if(_0x5051b6){return _0x5051b6[_0x8761('0x25')](_0x3909bf)[_0x8761('0x26')](function(_0x47365c){return _0x47365c;});}return null;};}function removeEntity(_0x5038fc,_0x1aafff){return function(_0x3805cd){if(_0x3805cd){return _0x3805cd[_0x8761('0x27')]()['then'](function(){_0x5038fc[_0x8761('0x1c')](0xcc)[_0x8761('0x1d')]();});}};}function handleEntityNotFound(_0x1ab533,_0x47de4e){return function(_0x3d34ee){if(!_0x3d34ee){_0x1ab533['sendStatus'](0x194);}return _0x3d34ee;};}function handleError(_0x4b09f8,_0xf3dc31){_0xf3dc31=_0xf3dc31||0x1f4;return function(_0xa52c0e){logger[_0x8761('0x28')](_0xa52c0e[_0x8761('0x29')]);if(_0xa52c0e[_0x8761('0x2a')]){delete _0xa52c0e[_0x8761('0x2a')];}_0x4b09f8[_0x8761('0x1c')](_0xf3dc31)[_0x8761('0x2b')](_0xa52c0e);};}exports[_0x8761('0x2c')]=function(_0x2d3e7c,_0x2d440b){var _0xfb246c={},_0x2f8c71={},_0x213bc6={'count':0x0,'rows':[]};var _0x3ec880=_[_0x8761('0x2d')](db['SugarcrmField'][_0x8761('0x2e')],function(_0x15d6e3){return{'name':_0x15d6e3[_0x8761('0x2f')],'type':_0x15d6e3['type']['key']};});_0x2f8c71[_0x8761('0x30')]=_[_0x8761('0x2d')](_0x3ec880,_0x8761('0x2a'));_0x2f8c71[_0x8761('0x31')]=_[_0x8761('0x32')](_0x2d3e7c[_0x8761('0x31')]);_0x2f8c71[_0x8761('0x33')]=_['intersection'](_0x2f8c71['model'],_0x2f8c71[_0x8761('0x31')]);_0xfb246c['attributes']=_[_0x8761('0x34')](_0x2f8c71[_0x8761('0x30')],qs[_0x8761('0x35')](_0x2d3e7c[_0x8761('0x31')][_0x8761('0x35')]));_0xfb246c[_0x8761('0x36')]=_0xfb246c[_0x8761('0x36')][_0x8761('0x37')]?_0xfb246c['attributes']:_0x2f8c71['model'];if(!_0x2d3e7c['query'][_0x8761('0x38')](_0x8761('0x39'))){_0xfb246c[_0x8761('0x20')]=qs[_0x8761('0x20')](_0x2d3e7c[_0x8761('0x31')]['limit']);_0xfb246c[_0x8761('0x1e')]=qs[_0x8761('0x1e')](_0x2d3e7c[_0x8761('0x31')][_0x8761('0x1e')]);}_0xfb246c[_0x8761('0x3a')]=qs['sort'](_0x2d3e7c[_0x8761('0x31')]['sort']);_0xfb246c['where']=qs[_0x8761('0x33')](_[_0x8761('0x3b')](_0x2d3e7c[_0x8761('0x31')],_0x2f8c71[_0x8761('0x33')]),_0x3ec880);if(_0x2d3e7c[_0x8761('0x31')][_0x8761('0x3c')]){_0xfb246c['where']=_[_0x8761('0x3d')](_0xfb246c[_0x8761('0x3e')],{'$or':_[_0x8761('0x2d')](_0x3ec880,function(_0x182b81){if(_0x182b81[_0x8761('0x3f')]!=='VIRTUAL'){var _0xf4327a={};_0xf4327a[_0x182b81[_0x8761('0x2a')]]={'$like':'%'+_0x2d3e7c[_0x8761('0x31')]['filter']+'%'};return _0xf4327a;}})});}_0xfb246c=_[_0x8761('0x3d')]({},_0xfb246c,_0x2d3e7c[_0x8761('0x40')]);var _0x1c5352={'where':_0xfb246c[_0x8761('0x3e')]};return db[_0x8761('0x41')][_0x8761('0x21')](_0x1c5352)[_0x8761('0x26')](function(_0x506f0c){_0x213bc6[_0x8761('0x21')]=_0x506f0c;if(_0x2d3e7c[_0x8761('0x31')][_0x8761('0x42')]){_0xfb246c['include']=[{'all':!![]}];}return db[_0x8761('0x41')]['findAll'](_0xfb246c);})[_0x8761('0x26')](function(_0x541928){_0x213bc6[_0x8761('0x43')]=_0x541928;return _0x213bc6;})[_0x8761('0x26')](respondWithFilteredResult(_0x2d440b,_0xfb246c))['catch'](handleError(_0x2d440b,null));};exports[_0x8761('0x44')]=function(_0x10d46b,_0x3a173a){var _0xfc10f8={'raw':!![],'where':{'id':_0x10d46b[_0x8761('0x45')]['id']}},_0x5531e1={};_0x5531e1[_0x8761('0x30')]=_[_0x8761('0x32')](db[_0x8761('0x41')][_0x8761('0x2e')]);_0x5531e1[_0x8761('0x31')]=_['keys'](_0x10d46b[_0x8761('0x31')]);_0x5531e1[_0x8761('0x33')]=_[_0x8761('0x34')](_0x5531e1['model'],_0x5531e1[_0x8761('0x31')]);_0xfc10f8['attributes']=_[_0x8761('0x34')](_0x5531e1['model'],qs[_0x8761('0x35')](_0x10d46b[_0x8761('0x31')][_0x8761('0x35')]));_0xfc10f8[_0x8761('0x36')]=_0xfc10f8[_0x8761('0x36')][_0x8761('0x37')]?_0xfc10f8[_0x8761('0x36')]:_0x5531e1['model'];if(_0x10d46b[_0x8761('0x31')][_0x8761('0x42')]){_0xfc10f8[_0x8761('0x46')]=[{'all':!![]}];}_0xfc10f8=_[_0x8761('0x3d')]({},_0xfc10f8,_0x10d46b[_0x8761('0x40')]);return db[_0x8761('0x41')]['find'](_0xfc10f8)[_0x8761('0x26')](handleEntityNotFound(_0x3a173a,null))[_0x8761('0x26')](respondWithResult(_0x3a173a,null))[_0x8761('0x47')](handleError(_0x3a173a,null));};exports[_0x8761('0x48')]=function(_0x51ab53,_0x34d6c2){return db['SugarcrmField'][_0x8761('0x48')](_0x51ab53[_0x8761('0x49')],{})[_0x8761('0x26')](respondWithResult(_0x34d6c2,0xc9))[_0x8761('0x47')](handleError(_0x34d6c2,null));};exports[_0x8761('0x25')]=function(_0x369d5c,_0x46f828){if(_0x369d5c['body']['id']){delete _0x369d5c[_0x8761('0x49')]['id'];}return db['SugarcrmField'][_0x8761('0x4a')]({'where':{'id':_0x369d5c['params']['id']}})[_0x8761('0x26')](handleEntityNotFound(_0x46f828,null))[_0x8761('0x26')](saveUpdates(_0x369d5c['body'],null))[_0x8761('0x26')](respondWithResult(_0x46f828,null))[_0x8761('0x47')](handleError(_0x46f828,null));};exports[_0x8761('0x27')]=function(_0x4faee6,_0xd9958c){return db[_0x8761('0x41')][_0x8761('0x4a')]({'where':{'id':_0x4faee6[_0x8761('0x45')]['id']}})[_0x8761('0x26')](handleEntityNotFound(_0xd9958c,null))['then'](removeEntity(_0xd9958c,null))['catch'](handleError(_0xd9958c,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 5413ff2..5ad0890 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 _0xcb07=['bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','lodash','util','../../config/logger','api','moment'];(function(_0x513047,_0x2199c5){var _0x15b779=function(_0x412fd5){while(--_0x412fd5){_0x513047['push'](_0x513047['shift']());}};_0x15b779(++_0x2199c5);}(_0xcb07,0x191));var _0x7cb0=function(_0x531cb8,_0x8ef36f){_0x531cb8=_0x531cb8-0x0;var _0x5cf297=_0xcb07[_0x531cb8];return _0x5cf297;};'use strict';var _=require(_0x7cb0('0x0'));var util=require(_0x7cb0('0x1'));var logger=require(_0x7cb0('0x2'))(_0x7cb0('0x3'));var moment=require(_0x7cb0('0x4'));var BPromise=require(_0x7cb0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cb0('0x6'));var rimraf=require(_0x7cb0('0x7'));var config=require(_0x7cb0('0x8'));var attributes=require(_0x7cb0('0x9'));module[_0x7cb0('0xa')]=function(_0x1bc511,_0x4e6a3d){return _0x1bc511[_0x7cb0('0xb')](_0x7cb0('0xc'),attributes,{'tableName':_0x7cb0('0xd'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf58a=['int_sugarcrm_fields','idField','FieldId','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x4877e5,_0x49253c){var _0x2c8fd5=function(_0x3997c1){while(--_0x3997c1){_0x4877e5['push'](_0x4877e5['shift']());}};_0x2c8fd5(++_0x49253c);}(_0xf58a,0x1e3));var _0xaf58=function(_0x3945d3,_0x59cfd6){_0x3945d3=_0x3945d3-0x0;var _0x4aa906=_0xf58a[_0x3945d3];return _0x4aa906;};'use strict';var _=require('lodash');var util=require(_0xaf58('0x0'));var logger=require(_0xaf58('0x1'))(_0xaf58('0x2'));var moment=require('moment');var BPromise=require(_0xaf58('0x3'));var rp=require(_0xaf58('0x4'));var fs=require('fs');var path=require(_0xaf58('0x5'));var rimraf=require(_0xaf58('0x6'));var config=require(_0xaf58('0x7'));var attributes=require(_0xaf58('0x8'));module[_0xaf58('0x9')]=function(_0x57969c,_0x4d3e8b){return _0x57969c[_0xaf58('0xa')](_0xaf58('0xb'),attributes,{'tableName':_0xaf58('0xc'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xaf58('0xd'),_0xaf58('0xe')],'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 9229c90..112304a 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 _0x8956=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmField,\x20%s,\x20%s','message','info','catch','util'];(function(_0x540742,_0xeba66d){var _0x3e8113=function(_0xa93471){while(--_0xa93471){_0x540742['push'](_0x540742['shift']());}};_0x3e8113(++_0xeba66d);}(_0x8956,0x18e));var _0x6895=function(_0x5f423c,_0x2daaf0){_0x5f423c=_0x5f423c-0x0;var _0x16e2fe=_0x8956[_0x5f423c];return _0x16e2fe;};'use strict';var _=require('lodash');var util=require(_0x6895('0x0'));var moment=require(_0x6895('0x1'));var BPromise=require('bluebird');var rs=require(_0x6895('0x2'));var fs=require('fs');var Redis=require(_0x6895('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6895('0x4'));var logger=require(_0x6895('0x5'))(_0x6895('0x6'));var config=require(_0x6895('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6895('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x60e459,_0x2494dc,_0x3dcefd){return new BPromise(function(_0x1f4c73,_0x36742f){return client['request'](_0x60e459,_0x3dcefd)[_0x6895('0x9')](function(_0x4cfa4a){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x2494dc,_0x6895('0xa'));logger[_0x6895('0xb')](_0x6895('0xc'),_0x2494dc,_0x6895('0xa'),JSON[_0x6895('0xd')](_0x4cfa4a));if(_0x4cfa4a[_0x6895('0xe')]){if(_0x4cfa4a[_0x6895('0xe')]['code']===0x1f4){logger['error'](_0x6895('0xf'),_0x2494dc,_0x4cfa4a['error'][_0x6895('0x10')]);return _0x36742f(_0x4cfa4a['error'][_0x6895('0x10')]);}logger[_0x6895('0xe')](_0x6895('0xf'),_0x2494dc,_0x4cfa4a[_0x6895('0xe')][_0x6895('0x10')]);return _0x1f4c73(_0x4cfa4a[_0x6895('0xe')][_0x6895('0x10')]);}else{logger[_0x6895('0x11')](_0x6895('0xf'),_0x2494dc,_0x6895('0xa'));_0x1f4c73(_0x4cfa4a['result'][_0x6895('0x10')]);}})[_0x6895('0x12')](function(_0x3c8187){logger[_0x6895('0xe')](_0x6895('0xf'),_0x2494dc,_0x3c8187);_0x36742f(_0x3c8187);});});} \ No newline at end of file +var _0x18ce=['http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x510c8a,_0x1c5548){var _0x56ed11=function(_0x265e89){while(--_0x265e89){_0x510c8a['push'](_0x510c8a['shift']());}};_0x56ed11(++_0x1c5548);}(_0x18ce,0x113));var _0xe18c=function(_0xd5ae00,_0x4ae23b){_0xd5ae00=_0xd5ae00-0x0;var _0x1435e7=_0x18ce[_0xd5ae00];return _0x1435e7;};'use strict';var _=require(_0xe18c('0x0'));var util=require(_0xe18c('0x1'));var moment=require(_0xe18c('0x2'));var BPromise=require('bluebird');var rs=require(_0xe18c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe18c('0x4'))['db'];var utils=require(_0xe18c('0x5'));var logger=require(_0xe18c('0x6'))(_0xe18c('0x7'));var config=require(_0xe18c('0x8'));var jayson=require(_0xe18c('0x9'));var client=jayson[_0xe18c('0xa')][_0xe18c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4757ff,_0x2ecbdc,_0x428e8a){return new BPromise(function(_0x32fb9a,_0x296198){return client[_0xe18c('0xc')](_0x4757ff,_0x428e8a)[_0xe18c('0xd')](function(_0x205d3b){logger[_0xe18c('0xe')](_0xe18c('0xf'),_0x2ecbdc,_0xe18c('0x10'));logger[_0xe18c('0x11')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x2ecbdc,_0xe18c('0x10'),JSON[_0xe18c('0x12')](_0x205d3b));if(_0x205d3b[_0xe18c('0x13')]){if(_0x205d3b[_0xe18c('0x13')]['code']===0x1f4){logger[_0xe18c('0x13')](_0xe18c('0xf'),_0x2ecbdc,_0x205d3b[_0xe18c('0x13')]['message']);return _0x296198(_0x205d3b['error']['message']);}logger[_0xe18c('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x2ecbdc,_0x205d3b[_0xe18c('0x13')]['message']);return _0x32fb9a(_0x205d3b['error'][_0xe18c('0x14')]);}else{logger[_0xe18c('0xe')](_0xe18c('0xf'),_0x2ecbdc,_0xe18c('0x10'));_0x32fb9a(_0x205d3b['result']['message']);}})[_0xe18c('0x15')](function(_0x2e6c86){logger[_0xe18c('0x13')](_0xe18c('0xf'),_0x2ecbdc,_0x2e6c86);_0x296198(_0x2e6c86);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 6d36314..c9a7691 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 _0xaab2=['getConfigurations','getFields','post','create','addConfiguration','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x24a5b8,_0x292cf0){var _0x454182=function(_0x4eee90){while(--_0x4eee90){_0x24a5b8['push'](_0x24a5b8['shift']());}};_0x454182(++_0x292cf0);}(_0xaab2,0x15b));var _0x2aab=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xaab2[_0x1d9aa0];return _0x226868;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2aab('0x0'));var timeout=require(_0x2aab('0x1'));var express=require(_0x2aab('0x2'));var router=express['Router']();var fs_extra=require(_0x2aab('0x3'));var auth=require(_0x2aab('0x4'));var interaction=require(_0x2aab('0x5'));var config=require('../../config/environment');var controller=require(_0x2aab('0x6'));router[_0x2aab('0x7')]('/',auth[_0x2aab('0x8')](),controller[_0x2aab('0x9')]);router[_0x2aab('0x7')](_0x2aab('0xa'),auth[_0x2aab('0x8')](),controller[_0x2aab('0xb')]);router[_0x2aab('0x7')](_0x2aab('0xc'),auth[_0x2aab('0x8')](),controller[_0x2aab('0xd')]);router[_0x2aab('0x7')]('/:id/fields',auth[_0x2aab('0x8')](),controller[_0x2aab('0xe')]);router[_0x2aab('0xf')]('/',auth[_0x2aab('0x8')](),controller[_0x2aab('0x10')]);router[_0x2aab('0xf')]('/:id/configurations',auth[_0x2aab('0x8')](),controller[_0x2aab('0x11')]);router['put']('/:id',auth[_0x2aab('0x8')](),controller['update']);router['delete'](_0x2aab('0xa'),auth['isAuthenticated'](),controller[_0x2aab('0x12')]);module[_0x2aab('0x13')]=router; \ No newline at end of file +var _0x447b=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated'];(function(_0xd7abaa,_0x338c17){var _0x22044d=function(_0x3250f1){while(--_0x3250f1){_0xd7abaa['push'](_0xd7abaa['shift']());}};_0x22044d(++_0x338c17);}(_0x447b,0xe4));var _0xb447=function(_0x13e55f,_0x48eb7a){_0x13e55f=_0x13e55f-0x0;var _0x5a094a=_0x447b[_0x13e55f];return _0x5a094a;};'use strict';var multer=require(_0xb447('0x0'));var util=require(_0xb447('0x1'));var path=require('path');var timeout=require(_0xb447('0x2'));var express=require(_0xb447('0x3'));var router=express[_0xb447('0x4')]();var fs_extra=require(_0xb447('0x5'));var auth=require(_0xb447('0x6'));var interaction=require(_0xb447('0x7'));var config=require(_0xb447('0x8'));var controller=require(_0xb447('0x9'));router[_0xb447('0xa')]('/',auth[_0xb447('0xb')](),controller['index']);router['get'](_0xb447('0xc'),auth['isAuthenticated'](),controller[_0xb447('0xd')]);router[_0xb447('0xa')](_0xb447('0xe'),auth[_0xb447('0xb')](),controller[_0xb447('0xf')]);router['get'](_0xb447('0x10'),auth[_0xb447('0xb')](),controller[_0xb447('0x11')]);router[_0xb447('0x12')]('/',auth['isAuthenticated'](),controller[_0xb447('0x13')]);router[_0xb447('0x12')](_0xb447('0xe'),auth[_0xb447('0xb')](),controller[_0xb447('0x14')]);router[_0xb447('0x15')](_0xb447('0xc'),auth[_0xb447('0xb')](),controller[_0xb447('0x16')]);router['delete']('/:id',auth[_0xb447('0xb')](),controller[_0xb447('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 9d840c7..51878bc 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 _0xd993=['exports','STRING','HelpDesk','sequelize'];(function(_0x57a670,_0x30e402){var _0x41ce21=function(_0x11bd34){while(--_0x11bd34){_0x57a670['push'](_0x57a670['shift']());}};_0x41ce21(++_0x30e402);}(_0xd993,0x8f));var _0x3d99=function(_0x1356a2,_0x4cecfa){_0x1356a2=_0x1356a2-0x0;var _0x133dd3=_0xd993[_0x1356a2];return _0x133dd3;};'use strict';var Sequelize=require(_0x3d99('0x0'));module[_0x3d99('0x1')]={'name':{'type':Sequelize[_0x3d99('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3d99('0x2')]},'username':{'type':Sequelize[_0x3d99('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3d99('0x3')},'remoteUri':{'type':Sequelize[_0x3d99('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3d99('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x3d99('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x8cd5=['exports','STRING','HelpDesk','sequelize'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x8cd5,0x73));var _0x58cd=function(_0x20524e,_0xf05e55){_0x20524e=_0x20524e-0x0;var _0x36d460=_0x8cd5[_0x20524e];return _0x36d460;};'use strict';var Sequelize=require(_0x58cd('0x0'));module[_0x58cd('0x1')]={'name':{'type':Sequelize[_0x58cd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x58cd('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x58cd('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x58cd('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x58cd('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 d09f5db..d2ccacc 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 _0x9483=['owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','limit','count','offset','set','json','apply','update','then','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','findOne','filter','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerConfiguration','VtigerField','md5','getFields','description','remoteUri','accessKey','username','moduleName','slice','substring','format','success','POST','result','token','GET','sessionName','autogenerated'];(function(_0xdcd57c,_0x5628f8){var _0x45c197=function(_0x435e10){while(--_0x435e10){_0xdcd57c['push'](_0xdcd57c['shift']());}};_0x45c197(++_0x5628f8);}(_0x9483,0x87));var _0x3948=function(_0x3fa684,_0x312171){_0x3fa684=_0x3fa684-0x0;var _0x24b26c=_0x9483[_0x3fa684];return _0x24b26c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3948('0x0'));var zipdir=require(_0x3948('0x1'));var jsonpatch=require(_0x3948('0x2'));var rp=require(_0x3948('0x3'));var moment=require(_0x3948('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3948('0x5'));var path=require('path');var sox=require(_0x3948('0x6'));var csv=require(_0x3948('0x7'));var ejs=require(_0x3948('0x8'));var fs=require('fs');var fs_extra=require(_0x3948('0x9'));var _=require(_0x3948('0xa'));var squel=require(_0x3948('0xb'));var crypto=require(_0x3948('0xc'));var jsforce=require(_0x3948('0xd'));var deskjs=require(_0x3948('0xe'));var toCsv=require(_0x3948('0x7'));var querystring=require(_0x3948('0xf'));var Papa=require(_0x3948('0x10'));var Redis=require(_0x3948('0x11'));var authService=require(_0x3948('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3948('0x13'));var hardwareService=require(_0x3948('0x14'));var logger=require(_0x3948('0x15'))(_0x3948('0x16'));var utils=require(_0x3948('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3948('0x18'));var db=require(_0x3948('0x19'))['db'];var integrations=require(_0x3948('0x1a'));function respondWithStatusCode(_0x128a04,_0x37bb45){_0x37bb45=_0x37bb45||0xcc;return function(_0x230683){if(_0x230683){return _0x128a04[_0x3948('0x1b')](_0x37bb45);}return _0x128a04[_0x3948('0x1c')](_0x37bb45)[_0x3948('0x1d')]();};}function respondWithResult(_0x3671da,_0x156045){_0x156045=_0x156045||0xc8;return function(_0x21835a){if(_0x21835a){return _0x3671da['status'](_0x156045)['json'](_0x21835a);}};}function respondWithFilteredResult(_0x4b676e,_0x337826){return function(_0x3a5ff4){if(_0x3a5ff4){var _0x24ee34=typeof _0x337826['offset']==='undefined'&&typeof _0x337826[_0x3948('0x1e')]==='undefined';var _0x1b192b=_0x3a5ff4[_0x3948('0x1f')];var _0x5da167=_0x24ee34?0x0:_0x337826[_0x3948('0x20')];var _0x5961e8=_0x24ee34?_0x3a5ff4[_0x3948('0x1f')]:_0x337826[_0x3948('0x20')]+_0x337826[_0x3948('0x1e')];var _0x368f47;if(_0x5961e8>=_0x1b192b){_0x5961e8=_0x1b192b;_0x368f47=0xc8;}else{_0x368f47=0xce;}_0x4b676e[_0x3948('0x1c')](_0x368f47);return _0x4b676e[_0x3948('0x21')]('Content-Range',_0x5da167+'-'+_0x5961e8+'/'+_0x1b192b)[_0x3948('0x22')](_0x3a5ff4);}return null;};}function patchUpdates(_0x44f19f){return function(_0x3433b6){try{jsonpatch[_0x3948('0x23')](_0x3433b6,_0x44f19f,!![]);}catch(_0xd0547){return BPromise['reject'](_0xd0547);}return _0x3433b6['save']();};}function saveUpdates(_0x211385,_0xc221c2){return function(_0x33bdfb){if(_0x33bdfb){return _0x33bdfb[_0x3948('0x24')](_0x211385)[_0x3948('0x25')](function(_0x27110e){return _0x27110e;});}return null;};}function removeEntity(_0x31b662,_0xfeba8a){return function(_0x3267b9){if(_0x3267b9){return _0x3267b9['destroy']()[_0x3948('0x25')](function(){_0x31b662['status'](0xcc)[_0x3948('0x1d')]();});}};}function handleEntityNotFound(_0x3801cc,_0x1616b3){return function(_0x2eb263){if(!_0x2eb263){_0x3801cc[_0x3948('0x1b')](0x194);}return _0x2eb263;};}function handleError(_0x1d6d75,_0x11ef61){_0x11ef61=_0x11ef61||0x1f4;return function(_0x110d99){logger[_0x3948('0x26')](_0x110d99[_0x3948('0x27')]);if(_0x110d99[_0x3948('0x28')]){delete _0x110d99[_0x3948('0x28')];}_0x1d6d75[_0x3948('0x1c')](_0x11ef61)[_0x3948('0x29')](_0x110d99);};}exports[_0x3948('0x2a')]=function(_0x44b6ae,_0xa43b03){var _0x15326a={},_0x1d9e9e={},_0x559c60={'count':0x0,'rows':[]};var _0x4457fe=_[_0x3948('0x2b')](db[_0x3948('0x2c')][_0x3948('0x2d')],function(_0x1eb0bf){return{'name':_0x1eb0bf[_0x3948('0x2e')],'type':_0x1eb0bf[_0x3948('0x2f')]['key']};});_0x1d9e9e[_0x3948('0x30')]=_[_0x3948('0x2b')](_0x4457fe,_0x3948('0x28'));_0x1d9e9e[_0x3948('0x31')]=_[_0x3948('0x32')](_0x44b6ae[_0x3948('0x31')]);_0x1d9e9e[_0x3948('0x33')]=_['intersection'](_0x1d9e9e[_0x3948('0x30')],_0x1d9e9e[_0x3948('0x31')]);_0x15326a[_0x3948('0x34')]=_[_0x3948('0x35')](_0x1d9e9e[_0x3948('0x30')],qs['fields'](_0x44b6ae[_0x3948('0x31')][_0x3948('0x36')]));_0x15326a[_0x3948('0x34')]=_0x15326a[_0x3948('0x34')][_0x3948('0x37')]?_0x15326a[_0x3948('0x34')]:_0x1d9e9e['model'];if(!_0x44b6ae[_0x3948('0x31')][_0x3948('0x38')](_0x3948('0x39'))){_0x15326a[_0x3948('0x1e')]=qs['limit'](_0x44b6ae[_0x3948('0x31')]['limit']);_0x15326a[_0x3948('0x20')]=qs[_0x3948('0x20')](_0x44b6ae[_0x3948('0x31')]['offset']);}_0x15326a[_0x3948('0x3a')]=qs[_0x3948('0x3b')](_0x44b6ae[_0x3948('0x31')][_0x3948('0x3b')]);_0x15326a[_0x3948('0x3c')]=qs[_0x3948('0x33')](_[_0x3948('0x3d')](_0x44b6ae[_0x3948('0x31')],_0x1d9e9e[_0x3948('0x33')]),_0x4457fe);if(_0x44b6ae['query']['filter']){_0x15326a[_0x3948('0x3c')]=_[_0x3948('0x3e')](_0x15326a['where'],{'$or':_[_0x3948('0x2b')](_0x4457fe,function(_0x2eb8bd){if(_0x2eb8bd['type']!==_0x3948('0x3f')){var _0x1bfb87={};_0x1bfb87[_0x2eb8bd[_0x3948('0x28')]]={'$like':'%'+_0x44b6ae[_0x3948('0x31')]['filter']+'%'};return _0x1bfb87;}})});}_0x15326a=_[_0x3948('0x3e')]({},_0x15326a,_0x44b6ae[_0x3948('0x40')]);var _0x2b349a={'where':_0x15326a[_0x3948('0x3c')]};return db[_0x3948('0x2c')][_0x3948('0x1f')](_0x2b349a)[_0x3948('0x25')](function(_0x4a3251){_0x559c60[_0x3948('0x1f')]=_0x4a3251;if(_0x44b6ae[_0x3948('0x31')][_0x3948('0x41')]){_0x15326a[_0x3948('0x42')]=[{'all':!![]}];}return db[_0x3948('0x2c')][_0x3948('0x43')](_0x15326a);})[_0x3948('0x25')](function(_0x4540fa){_0x559c60[_0x3948('0x44')]=_0x4540fa;return _0x559c60;})[_0x3948('0x25')](respondWithFilteredResult(_0xa43b03,_0x15326a))[_0x3948('0x45')](handleError(_0xa43b03,null));};exports[_0x3948('0x46')]=function(_0x2ed663,_0x3810dc){var _0x49fbeb={'raw':![],'where':{'id':_0x2ed663[_0x3948('0x47')]['id']}},_0x4b348a={};_0x4b348a[_0x3948('0x30')]=_[_0x3948('0x32')](db[_0x3948('0x2c')][_0x3948('0x2d')]);_0x4b348a['query']=_[_0x3948('0x32')](_0x2ed663[_0x3948('0x31')]);_0x4b348a[_0x3948('0x33')]=_['intersection'](_0x4b348a['model'],_0x4b348a[_0x3948('0x31')]);_0x49fbeb['attributes']=_['intersection'](_0x4b348a[_0x3948('0x30')],qs[_0x3948('0x36')](_0x2ed663[_0x3948('0x31')]['fields']));_0x49fbeb[_0x3948('0x34')]=_0x49fbeb[_0x3948('0x34')]['length']?_0x49fbeb[_0x3948('0x34')]:_0x4b348a['model'];if(_0x2ed663['query'][_0x3948('0x41')]){_0x49fbeb[_0x3948('0x42')]=[{'all':!![]}];}_0x49fbeb=_['merge']({},_0x49fbeb,_0x2ed663['options']);return db[_0x3948('0x2c')][_0x3948('0x48')](_0x49fbeb)[_0x3948('0x25')](handleEntityNotFound(_0x3810dc,null))[_0x3948('0x25')](respondWithResult(_0x3810dc,null))[_0x3948('0x45')](handleError(_0x3810dc,null));};exports[_0x3948('0x49')]=function(_0x316678,_0xb96506){return db[_0x3948('0x2c')]['create'](_0x316678[_0x3948('0x4a')],{})[_0x3948('0x25')](respondWithResult(_0xb96506,0xc9))['catch'](handleError(_0xb96506,null));};exports[_0x3948('0x24')]=function(_0x1d4d12,_0x4271b5){if(_0x1d4d12['body']['id']){delete _0x1d4d12['body']['id'];}return db[_0x3948('0x2c')]['find']({'where':{'id':_0x1d4d12[_0x3948('0x47')]['id']}})[_0x3948('0x25')](handleEntityNotFound(_0x4271b5,null))['then'](saveUpdates(_0x1d4d12[_0x3948('0x4a')],null))['then'](respondWithResult(_0x4271b5,null))[_0x3948('0x45')](handleError(_0x4271b5,null));};exports[_0x3948('0x4b')]=function(_0x5a61cd,_0x554269){return db[_0x3948('0x2c')][_0x3948('0x48')]({'where':{'id':_0x5a61cd[_0x3948('0x47')]['id']}})[_0x3948('0x25')](handleEntityNotFound(_0x554269,null))['then'](removeEntity(_0x554269,null))[_0x3948('0x45')](handleError(_0x554269,null));};exports['getConfigurations']=function(_0x547520,_0x35e1af,_0x26bcad){var _0x41521e={};var _0x1c98c4={};var _0x5f5a2f;var _0x412897;return db[_0x3948('0x2c')][_0x3948('0x4c')]({'where':{'id':_0x547520[_0x3948('0x47')]['id']}})[_0x3948('0x25')](handleEntityNotFound(_0x35e1af,null))['then'](function(_0x18345b){if(_0x18345b){_0x5f5a2f=_0x18345b;_0x1c98c4['model']=_[_0x3948('0x32')](db['VtigerConfiguration'][_0x3948('0x2d')]);_0x1c98c4[_0x3948('0x31')]=_[_0x3948('0x32')](_0x547520[_0x3948('0x31')]);_0x1c98c4['filters']=_[_0x3948('0x35')](_0x1c98c4[_0x3948('0x30')],_0x1c98c4[_0x3948('0x31')]);_0x41521e[_0x3948('0x34')]=_['intersection'](_0x1c98c4[_0x3948('0x30')],qs[_0x3948('0x36')](_0x547520[_0x3948('0x31')]['fields']));_0x41521e[_0x3948('0x34')]=_0x41521e['attributes']['length']?_0x41521e[_0x3948('0x34')]:_0x1c98c4[_0x3948('0x30')];_0x41521e[_0x3948('0x3a')]=qs[_0x3948('0x3b')](_0x547520['query'][_0x3948('0x3b')]);_0x41521e[_0x3948('0x3c')]=qs[_0x3948('0x33')](_[_0x3948('0x3d')](_0x547520[_0x3948('0x31')],_0x1c98c4[_0x3948('0x33')]));if(_0x547520[_0x3948('0x31')][_0x3948('0x4d')]){_0x41521e['where']=_[_0x3948('0x3e')](_0x41521e[_0x3948('0x3c')],{'$or':_[_0x3948('0x2b')](_0x41521e['attributes'],function(_0x4de6ff){var _0x7dd319={};_0x7dd319[_0x4de6ff]={'$like':'%'+_0x547520[_0x3948('0x31')][_0x3948('0x4d')]+'%'};return _0x7dd319;})});}_0x41521e=_[_0x3948('0x3e')]({},_0x41521e,_0x547520[_0x3948('0x40')]);return _0x5f5a2f['getConfigurations'](_0x41521e);}})[_0x3948('0x25')](function(_0x39d3c6){if(_0x39d3c6){_0x412897=_0x39d3c6[_0x3948('0x37')];if(!_0x547520[_0x3948('0x31')][_0x3948('0x38')](_0x3948('0x39'))){_0x41521e['limit']=qs[_0x3948('0x1e')](_0x547520[_0x3948('0x31')][_0x3948('0x1e')]);_0x41521e[_0x3948('0x20')]=qs['offset'](_0x547520[_0x3948('0x31')][_0x3948('0x20')]);}return _0x5f5a2f[_0x3948('0x4e')](_0x41521e);}})[_0x3948('0x25')](function(_0xbb0e9e){if(_0xbb0e9e){return _0xbb0e9e?{'count':_0x412897,'rows':_0xbb0e9e}:null;}})['then'](respondWithResult(_0x35e1af,null))[_0x3948('0x45')](handleError(_0x35e1af,null));};exports[_0x3948('0x4f')]=function(_0x385daf,_0x4d2193,_0x4c2c7b){if(_0x385daf[_0x3948('0x4a')]['id']){delete _0x385daf[_0x3948('0x4a')]['id'];}return db[_0x3948('0x2c')]['findOne']({'where':{'id':_0x385daf['params']['id']}})[_0x3948('0x25')](handleEntityNotFound(_0x4d2193,null))['then'](function(_0x458e37){if(_0x458e37){_0x385daf[_0x3948('0x4a')][_0x3948('0x50')]=_0x458e37['id'];_0x385daf['body'][_0x3948('0x51')]=integrations[_0x3948('0x52')](_0x385daf['body']['channel'],_0x385daf['body'][_0x3948('0x2f')]);_0x385daf['body'][_0x3948('0x53')]=integrations[_0x3948('0x54')](_0x385daf[_0x3948('0x4a')][_0x3948('0x55')],_0x385daf[_0x3948('0x4a')][_0x3948('0x2f')]);return db[_0x3948('0x56')][_0x3948('0x49')](_0x385daf['body'],{'include':[{'model':db[_0x3948('0x57')],'as':_0x3948('0x51')},{'model':db[_0x3948('0x57')],'as':_0x3948('0x53')}]});}return null;})[_0x3948('0x25')](respondWithResult(_0x4d2193,null))[_0x3948('0x45')](handleError(_0x4d2193,null));};var md5=require(_0x3948('0x58'));exports[_0x3948('0x59')]=function(_0x364aaf,_0x5280ce,_0x2c02db){var _0x3fbc3b=null;var _0x356502=null;var _0x37e13b=null;var _0x2ffe46=null;var _0x81e524='';return db[_0x3948('0x2c')][_0x3948('0x4c')]({'where':{'id':_0x364aaf['params']['id']},'attributes':['id',_0x3948('0x28'),'username',_0x3948('0x5a'),'moduleName',_0x3948('0x5b'),'serverUrl',_0x3948('0x5c')]})[_0x3948('0x25')](handleEntityNotFound(_0x5280ce,null))[_0x3948('0x25')](function(_0x25dfa9){if(_0x25dfa9){_0x3fbc3b=_0x25dfa9[_0x3948('0x5d')];_0x356502=_0x25dfa9[_0x3948('0x5c')];_0x37e13b=_0x25dfa9[_0x3948('0x5e')];_0x81e524=_0x25dfa9['remoteUri'];var _0x242da7=_0x81e524[_0x3948('0x5f')](-0x1);if(_0x242da7==='/'){_0x81e524=_0x81e524[_0x3948('0x60')](0x0,_0x81e524['lastIndexOf'](_0x242da7));}_0x2ffe46=util[_0x3948('0x61')]('%s/webservice.php',_0x81e524);var _0x56c450={'method':'GET','uri':_0x2ffe46,'qs':{'operation':'getchallenge','username':_0x25dfa9[_0x3948('0x5d')]},'json':!![]};return rp(_0x56c450);}})['then'](function(_0x4eaec5){if(_0x4eaec5[_0x3948('0x62')]){var _0x36fdfb={'method':_0x3948('0x63'),'uri':_0x2ffe46,'form':{'operation':'login','username':_0x3fbc3b,'accessKey':md5(_0x4eaec5[_0x3948('0x64')][_0x3948('0x65')]+_0x356502)},'json':!![]};return rp(_0x36fdfb);}})[_0x3948('0x25')](function(_0x198605){if(_0x198605[_0x3948('0x62')]){var _0x110301={'method':_0x3948('0x66'),'uri':_0x2ffe46,'qs':{'operation':'describe','username':_0x3fbc3b,'sessionName':_0x198605[_0x3948('0x64')][_0x3948('0x67')],'elementType':_0x37e13b},'json':!![]};return rp(_0x110301);}})[_0x3948('0x25')](function(_0xfaecb2){if(_0xfaecb2['success']){var _0x52dc45=[_0x3948('0x68'),'reference',_0x3948('0x69')];_[_0x3948('0x6a')](_0xfaecb2['result'][_0x3948('0x36')],function(_0x25d75f){return _0x52dc45[_0x3948('0x6b')](_0x25d75f[_0x3948('0x2f')][_0x3948('0x28')]);});_[_0x3948('0x6a')](_0xfaecb2[_0x3948('0x64')][_0x3948('0x36')],function(_0x575f89){return _0x575f89[_0x3948('0x6c')]===_0x3948('0x6d');});return{'count':_0xfaecb2[_0x3948('0x64')][_0x3948('0x36')][_0x3948('0x37')],'rows':_[_0x3948('0x2b')](_0xfaecb2[_0x3948('0x64')][_0x3948('0x36')],function(_0x575a52){return{'id':_0x575a52['name'],'name':_0x575a52[_0x3948('0x6e')],'custom':_[_0x3948('0x6f')](_0x575a52[_0x3948('0x28')],_0x3948('0x70'))?!![]:![],'options':_0x575a52[_0x3948('0x2f')][_0x3948('0x28')]===_0x3948('0x71')&&_0x575a52[_0x3948('0x2f')][_0x3948('0x72')][_0x3948('0x37')]>0x0?_[_0x3948('0x2b')](_0x575a52[_0x3948('0x2f')]['picklistValues'],function(_0x1c8e98){return{'name':_0x1c8e98[_0x3948('0x6e')],'value':_0x1c8e98[_0x3948('0x73')]};}):[]};})};}})[_0x3948('0x25')](respondWithResult(_0x5280ce,null))['catch'](function(_0x398ae3){console['log']('vTiger\x20error:\x20'+_0x398ae3);var _0x489a08=_0x364aaf[_0x3948('0x31')][_0x3948('0x74')]?0x1f4:_0x398ae3[_0x3948('0x75')]||0x1f4;logger[_0x3948('0x26')](_0x3948('0x76'),_0x3948('0x59'),_0x489a08,JSON['stringify'](_0x398ae3));delete _0x398ae3[_0x3948('0x28')];if(_0x489a08===0x191){_0x489a08=0x190;}_0x5280ce['status'](_0x489a08)[_0x3948('0x29')](_0x364aaf['query']['test']?{'message':_0x3948('0x77'),'statusCode':_0x398ae3[_0x3948('0x75')]}:_0x398ae3);});}; \ No newline at end of file +var _0x7c86=['length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','VtigerAccount','includeAll','include','findAll','rows','catch','params','create','update','body','find','destroy','getConfigurations','findOne','VtigerConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','format','%s/webservice.php','GET','success','POST','result','token','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','intersection','fields','attributes'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x7c86,0x13f));var _0x67c8=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x7c86[_0x5f3f88];return _0xd08119;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x67c8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x67c8('0x1'));var moment=require('moment');var BPromise=require(_0x67c8('0x2'));var Mustache=require(_0x67c8('0x3'));var util=require(_0x67c8('0x4'));var path=require(_0x67c8('0x5'));var sox=require(_0x67c8('0x6'));var csv=require('to-csv');var ejs=require(_0x67c8('0x7'));var fs=require('fs');var fs_extra=require(_0x67c8('0x8'));var _=require(_0x67c8('0x9'));var squel=require(_0x67c8('0xa'));var crypto=require('crypto');var jsforce=require(_0x67c8('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x67c8('0xc'));var querystring=require(_0x67c8('0xd'));var Papa=require(_0x67c8('0xe'));var Redis=require(_0x67c8('0xf'));var authService=require(_0x67c8('0x10'));var qs=require(_0x67c8('0x11'));var as=require(_0x67c8('0x12'));var hardwareService=require(_0x67c8('0x13'));var logger=require(_0x67c8('0x14'))('api');var utils=require(_0x67c8('0x15'));var config=require(_0x67c8('0x16'));var licenseUtil=require(_0x67c8('0x17'));var db=require(_0x67c8('0x18'))['db'];var integrations=require(_0x67c8('0x19'));function respondWithStatusCode(_0x405295,_0x2cf7fa){_0x2cf7fa=_0x2cf7fa||0xcc;return function(_0x564e07){if(_0x564e07){return _0x405295['sendStatus'](_0x2cf7fa);}return _0x405295['status'](_0x2cf7fa)[_0x67c8('0x1a')]();};}function respondWithResult(_0x447414,_0x1b26bc){_0x1b26bc=_0x1b26bc||0xc8;return function(_0x787940){if(_0x787940){return _0x447414[_0x67c8('0x1b')](_0x1b26bc)['json'](_0x787940);}};}function respondWithFilteredResult(_0x2305ce,_0x35093b){return function(_0x155fcf){if(_0x155fcf){var _0x43775c=typeof _0x35093b[_0x67c8('0x1c')]===_0x67c8('0x1d')&&typeof _0x35093b[_0x67c8('0x1e')]===_0x67c8('0x1d');var _0x205185=_0x155fcf[_0x67c8('0x1f')];var _0x232978=_0x43775c?0x0:_0x35093b[_0x67c8('0x1c')];var _0x462bc1=_0x43775c?_0x155fcf[_0x67c8('0x1f')]:_0x35093b[_0x67c8('0x1c')]+_0x35093b[_0x67c8('0x1e')];var _0x422427;if(_0x462bc1>=_0x205185){_0x462bc1=_0x205185;_0x422427=0xc8;}else{_0x422427=0xce;}_0x2305ce['status'](_0x422427);return _0x2305ce[_0x67c8('0x20')](_0x67c8('0x21'),_0x232978+'-'+_0x462bc1+'/'+_0x205185)[_0x67c8('0x22')](_0x155fcf);}return null;};}function patchUpdates(_0x4265db){return function(_0x11cb56){try{jsonpatch[_0x67c8('0x23')](_0x11cb56,_0x4265db,!![]);}catch(_0xcf7c88){return BPromise['reject'](_0xcf7c88);}return _0x11cb56[_0x67c8('0x24')]();};}function saveUpdates(_0x309c97,_0x3c24a9){return function(_0x4fb594){if(_0x4fb594){return _0x4fb594['update'](_0x309c97)[_0x67c8('0x25')](function(_0x8b2a31){return _0x8b2a31;});}return null;};}function removeEntity(_0x420b24,_0x478f7f){return function(_0x474b28){if(_0x474b28){return _0x474b28['destroy']()[_0x67c8('0x25')](function(){_0x420b24[_0x67c8('0x1b')](0xcc)[_0x67c8('0x1a')]();});}};}function handleEntityNotFound(_0x41a2ed,_0x54a5ed){return function(_0x1296d8){if(!_0x1296d8){_0x41a2ed[_0x67c8('0x26')](0x194);}return _0x1296d8;};}function handleError(_0xed9d76,_0x495d77){_0x495d77=_0x495d77||0x1f4;return function(_0x2856fb){logger['error'](_0x2856fb[_0x67c8('0x27')]);if(_0x2856fb[_0x67c8('0x28')]){delete _0x2856fb['name'];}_0xed9d76[_0x67c8('0x1b')](_0x495d77)[_0x67c8('0x29')](_0x2856fb);};}exports[_0x67c8('0x2a')]=function(_0x5cb195,_0x304f47){var _0x583fff={},_0x4b1ef8={},_0x57b86e={'count':0x0,'rows':[]};var _0x3f108b=_['map'](db['VtigerAccount'][_0x67c8('0x2b')],function(_0x19611a){return{'name':_0x19611a[_0x67c8('0x2c')],'type':_0x19611a[_0x67c8('0x2d')]['key']};});_0x4b1ef8[_0x67c8('0x2e')]=_[_0x67c8('0x2f')](_0x3f108b,_0x67c8('0x28'));_0x4b1ef8['query']=_[_0x67c8('0x30')](_0x5cb195[_0x67c8('0x31')]);_0x4b1ef8['filters']=_[_0x67c8('0x32')](_0x4b1ef8['model'],_0x4b1ef8[_0x67c8('0x31')]);_0x583fff['attributes']=_[_0x67c8('0x32')](_0x4b1ef8[_0x67c8('0x2e')],qs[_0x67c8('0x33')](_0x5cb195[_0x67c8('0x31')]['fields']));_0x583fff[_0x67c8('0x34')]=_0x583fff[_0x67c8('0x34')][_0x67c8('0x35')]?_0x583fff[_0x67c8('0x34')]:_0x4b1ef8['model'];if(!_0x5cb195[_0x67c8('0x31')][_0x67c8('0x36')](_0x67c8('0x37'))){_0x583fff[_0x67c8('0x1e')]=qs[_0x67c8('0x1e')](_0x5cb195['query'][_0x67c8('0x1e')]);_0x583fff[_0x67c8('0x1c')]=qs[_0x67c8('0x1c')](_0x5cb195[_0x67c8('0x31')][_0x67c8('0x1c')]);}_0x583fff[_0x67c8('0x38')]=qs[_0x67c8('0x39')](_0x5cb195['query'][_0x67c8('0x39')]);_0x583fff[_0x67c8('0x3a')]=qs['filters'](_['pick'](_0x5cb195[_0x67c8('0x31')],_0x4b1ef8[_0x67c8('0x3b')]),_0x3f108b);if(_0x5cb195[_0x67c8('0x31')][_0x67c8('0x3c')]){_0x583fff[_0x67c8('0x3a')]=_[_0x67c8('0x3d')](_0x583fff[_0x67c8('0x3a')],{'$or':_[_0x67c8('0x2f')](_0x3f108b,function(_0x32a3e9){if(_0x32a3e9[_0x67c8('0x2d')]!=='VIRTUAL'){var _0x407e63={};_0x407e63[_0x32a3e9[_0x67c8('0x28')]]={'$like':'%'+_0x5cb195[_0x67c8('0x31')]['filter']+'%'};return _0x407e63;}})});}_0x583fff=_['merge']({},_0x583fff,_0x5cb195[_0x67c8('0x3e')]);var _0x37f122={'where':_0x583fff['where']};return db[_0x67c8('0x3f')][_0x67c8('0x1f')](_0x37f122)[_0x67c8('0x25')](function(_0x2d1e83){_0x57b86e[_0x67c8('0x1f')]=_0x2d1e83;if(_0x5cb195[_0x67c8('0x31')][_0x67c8('0x40')]){_0x583fff[_0x67c8('0x41')]=[{'all':!![]}];}return db['VtigerAccount'][_0x67c8('0x42')](_0x583fff);})[_0x67c8('0x25')](function(_0x248565){_0x57b86e[_0x67c8('0x43')]=_0x248565;return _0x57b86e;})[_0x67c8('0x25')](respondWithFilteredResult(_0x304f47,_0x583fff))[_0x67c8('0x44')](handleError(_0x304f47,null));};exports['show']=function(_0x4199f9,_0x47db23){var _0x40008a={'raw':![],'where':{'id':_0x4199f9[_0x67c8('0x45')]['id']}},_0x3a7192={};_0x3a7192[_0x67c8('0x2e')]=_['keys'](db['VtigerAccount'][_0x67c8('0x2b')]);_0x3a7192[_0x67c8('0x31')]=_[_0x67c8('0x30')](_0x4199f9[_0x67c8('0x31')]);_0x3a7192['filters']=_[_0x67c8('0x32')](_0x3a7192[_0x67c8('0x2e')],_0x3a7192[_0x67c8('0x31')]);_0x40008a[_0x67c8('0x34')]=_[_0x67c8('0x32')](_0x3a7192[_0x67c8('0x2e')],qs[_0x67c8('0x33')](_0x4199f9[_0x67c8('0x31')][_0x67c8('0x33')]));_0x40008a['attributes']=_0x40008a[_0x67c8('0x34')][_0x67c8('0x35')]?_0x40008a['attributes']:_0x3a7192[_0x67c8('0x2e')];if(_0x4199f9[_0x67c8('0x31')][_0x67c8('0x40')]){_0x40008a[_0x67c8('0x41')]=[{'all':!![]}];}_0x40008a=_[_0x67c8('0x3d')]({},_0x40008a,_0x4199f9[_0x67c8('0x3e')]);return db[_0x67c8('0x3f')]['find'](_0x40008a)[_0x67c8('0x25')](handleEntityNotFound(_0x47db23,null))[_0x67c8('0x25')](respondWithResult(_0x47db23,null))[_0x67c8('0x44')](handleError(_0x47db23,null));};exports['create']=function(_0x1618a8,_0x1d19dc){return db[_0x67c8('0x3f')][_0x67c8('0x46')](_0x1618a8['body'],{})[_0x67c8('0x25')](respondWithResult(_0x1d19dc,0xc9))[_0x67c8('0x44')](handleError(_0x1d19dc,null));};exports[_0x67c8('0x47')]=function(_0x182bab,_0x38c55c){if(_0x182bab[_0x67c8('0x48')]['id']){delete _0x182bab[_0x67c8('0x48')]['id'];}return db[_0x67c8('0x3f')][_0x67c8('0x49')]({'where':{'id':_0x182bab['params']['id']}})['then'](handleEntityNotFound(_0x38c55c,null))[_0x67c8('0x25')](saveUpdates(_0x182bab[_0x67c8('0x48')],null))['then'](respondWithResult(_0x38c55c,null))['catch'](handleError(_0x38c55c,null));};exports[_0x67c8('0x4a')]=function(_0x19fa71,_0x264cc6){return db['VtigerAccount'][_0x67c8('0x49')]({'where':{'id':_0x19fa71['params']['id']}})[_0x67c8('0x25')](handleEntityNotFound(_0x264cc6,null))['then'](removeEntity(_0x264cc6,null))[_0x67c8('0x44')](handleError(_0x264cc6,null));};exports[_0x67c8('0x4b')]=function(_0xc43e31,_0x202d08,_0x2cea6a){var _0x3a2c14={};var _0x154369={};var _0x13d6c6;var _0x3b1192;return db[_0x67c8('0x3f')][_0x67c8('0x4c')]({'where':{'id':_0xc43e31[_0x67c8('0x45')]['id']}})[_0x67c8('0x25')](handleEntityNotFound(_0x202d08,null))[_0x67c8('0x25')](function(_0xab0d98){if(_0xab0d98){_0x13d6c6=_0xab0d98;_0x154369[_0x67c8('0x2e')]=_[_0x67c8('0x30')](db[_0x67c8('0x4d')][_0x67c8('0x2b')]);_0x154369[_0x67c8('0x31')]=_[_0x67c8('0x30')](_0xc43e31[_0x67c8('0x31')]);_0x154369[_0x67c8('0x3b')]=_[_0x67c8('0x32')](_0x154369[_0x67c8('0x2e')],_0x154369[_0x67c8('0x31')]);_0x3a2c14[_0x67c8('0x34')]=_['intersection'](_0x154369[_0x67c8('0x2e')],qs[_0x67c8('0x33')](_0xc43e31['query'][_0x67c8('0x33')]));_0x3a2c14[_0x67c8('0x34')]=_0x3a2c14['attributes']['length']?_0x3a2c14[_0x67c8('0x34')]:_0x154369[_0x67c8('0x2e')];_0x3a2c14['order']=qs[_0x67c8('0x39')](_0xc43e31['query'][_0x67c8('0x39')]);_0x3a2c14['where']=qs['filters'](_[_0x67c8('0x4e')](_0xc43e31[_0x67c8('0x31')],_0x154369[_0x67c8('0x3b')]));if(_0xc43e31[_0x67c8('0x31')][_0x67c8('0x3c')]){_0x3a2c14['where']=_[_0x67c8('0x3d')](_0x3a2c14[_0x67c8('0x3a')],{'$or':_['map'](_0x3a2c14['attributes'],function(_0x50e4dc){var _0x27da3a={};_0x27da3a[_0x50e4dc]={'$like':'%'+_0xc43e31[_0x67c8('0x31')]['filter']+'%'};return _0x27da3a;})});}_0x3a2c14=_['merge']({},_0x3a2c14,_0xc43e31['options']);return _0x13d6c6[_0x67c8('0x4b')](_0x3a2c14);}})[_0x67c8('0x25')](function(_0x4b5a39){if(_0x4b5a39){_0x3b1192=_0x4b5a39[_0x67c8('0x35')];if(!_0xc43e31['query'][_0x67c8('0x36')](_0x67c8('0x37'))){_0x3a2c14[_0x67c8('0x1e')]=qs[_0x67c8('0x1e')](_0xc43e31[_0x67c8('0x31')][_0x67c8('0x1e')]);_0x3a2c14[_0x67c8('0x1c')]=qs['offset'](_0xc43e31[_0x67c8('0x31')][_0x67c8('0x1c')]);}return _0x13d6c6[_0x67c8('0x4b')](_0x3a2c14);}})[_0x67c8('0x25')](function(_0x2a16de){if(_0x2a16de){return _0x2a16de?{'count':_0x3b1192,'rows':_0x2a16de}:null;}})[_0x67c8('0x25')](respondWithResult(_0x202d08,null))[_0x67c8('0x44')](handleError(_0x202d08,null));};exports[_0x67c8('0x4f')]=function(_0x10e64d,_0x4eb828,_0x2b7ef7){if(_0x10e64d[_0x67c8('0x48')]['id']){delete _0x10e64d[_0x67c8('0x48')]['id'];}return db['VtigerAccount'][_0x67c8('0x4c')]({'where':{'id':_0x10e64d[_0x67c8('0x45')]['id']}})[_0x67c8('0x25')](handleEntityNotFound(_0x4eb828,null))[_0x67c8('0x25')](function(_0x3b15a2){if(_0x3b15a2){_0x10e64d[_0x67c8('0x48')][_0x67c8('0x50')]=_0x3b15a2['id'];_0x10e64d[_0x67c8('0x48')][_0x67c8('0x51')]=integrations[_0x67c8('0x52')](_0x10e64d[_0x67c8('0x48')][_0x67c8('0x53')],_0x10e64d[_0x67c8('0x48')][_0x67c8('0x2d')]);_0x10e64d[_0x67c8('0x48')][_0x67c8('0x54')]=integrations[_0x67c8('0x55')](_0x10e64d['body'][_0x67c8('0x53')],_0x10e64d[_0x67c8('0x48')][_0x67c8('0x2d')]);return db[_0x67c8('0x4d')]['create'](_0x10e64d['body'],{'include':[{'model':db[_0x67c8('0x56')],'as':_0x67c8('0x51')},{'model':db[_0x67c8('0x56')],'as':_0x67c8('0x54')}]});}return null;})[_0x67c8('0x25')](respondWithResult(_0x4eb828,null))[_0x67c8('0x44')](handleError(_0x4eb828,null));};var md5=require('md5');exports[_0x67c8('0x57')]=function(_0x8de975,_0x2f02a9,_0x7d0e1c){var _0xe90d49=null;var _0x23ea7c=null;var _0x31d1c4=null;var _0xc194e4=null;var _0x54aec3='';return db[_0x67c8('0x3f')][_0x67c8('0x4c')]({'where':{'id':_0x8de975[_0x67c8('0x45')]['id']},'attributes':['id','name','username',_0x67c8('0x58'),_0x67c8('0x59'),_0x67c8('0x5a'),_0x67c8('0x5b'),_0x67c8('0x5c')]})[_0x67c8('0x25')](handleEntityNotFound(_0x2f02a9,null))['then'](function(_0x2c3ece){if(_0x2c3ece){_0xe90d49=_0x2c3ece[_0x67c8('0x5d')];_0x23ea7c=_0x2c3ece[_0x67c8('0x5c')];_0x31d1c4=_0x2c3ece[_0x67c8('0x59')];_0x54aec3=_0x2c3ece[_0x67c8('0x5a')];var _0x5b7621=_0x54aec3[_0x67c8('0x5e')](-0x1);if(_0x5b7621==='/'){_0x54aec3=_0x54aec3[_0x67c8('0x5f')](0x0,_0x54aec3[_0x67c8('0x60')](_0x5b7621));}_0xc194e4=util[_0x67c8('0x61')](_0x67c8('0x62'),_0x54aec3);var _0x5b8690={'method':_0x67c8('0x63'),'uri':_0xc194e4,'qs':{'operation':'getchallenge','username':_0x2c3ece[_0x67c8('0x5d')]},'json':!![]};return rp(_0x5b8690);}})[_0x67c8('0x25')](function(_0x240cd0){if(_0x240cd0[_0x67c8('0x64')]){var _0xb7ee7a={'method':_0x67c8('0x65'),'uri':_0xc194e4,'form':{'operation':'login','username':_0xe90d49,'accessKey':md5(_0x240cd0[_0x67c8('0x66')][_0x67c8('0x67')]+_0x23ea7c)},'json':!![]};return rp(_0xb7ee7a);}})[_0x67c8('0x25')](function(_0x4e7722){if(_0x4e7722[_0x67c8('0x64')]){var _0x16580d={'method':'GET','uri':_0xc194e4,'qs':{'operation':_0x67c8('0x68'),'username':_0xe90d49,'sessionName':_0x4e7722[_0x67c8('0x66')][_0x67c8('0x69')],'elementType':_0x31d1c4},'json':!![]};return rp(_0x16580d);}})[_0x67c8('0x25')](function(_0x884aa9){if(_0x884aa9['success']){var _0xc034f6=[_0x67c8('0x6a'),_0x67c8('0x6b'),_0x67c8('0x6c')];_[_0x67c8('0x6d')](_0x884aa9[_0x67c8('0x66')][_0x67c8('0x33')],function(_0x52c300){return _0xc034f6[_0x67c8('0x6e')](_0x52c300[_0x67c8('0x2d')]['name']);});_[_0x67c8('0x6d')](_0x884aa9[_0x67c8('0x66')][_0x67c8('0x33')],function(_0x2aaadf){return _0x2aaadf[_0x67c8('0x6f')]===_0x67c8('0x70');});return{'count':_0x884aa9[_0x67c8('0x66')][_0x67c8('0x33')][_0x67c8('0x35')],'rows':_[_0x67c8('0x2f')](_0x884aa9[_0x67c8('0x66')]['fields'],function(_0x282d16){return{'id':_0x282d16['name'],'name':_0x282d16[_0x67c8('0x71')],'custom':_[_0x67c8('0x72')](_0x282d16['name'],'cf_')?!![]:![],'options':_0x282d16[_0x67c8('0x2d')]['name']===_0x67c8('0x73')&&_0x282d16['type']['picklistValues']['length']>0x0?_[_0x67c8('0x2f')](_0x282d16[_0x67c8('0x2d')][_0x67c8('0x74')],function(_0x561a2f){return{'name':_0x561a2f[_0x67c8('0x71')],'value':_0x561a2f[_0x67c8('0x75')]};}):[]};})};}})['then'](respondWithResult(_0x2f02a9,null))[_0x67c8('0x44')](function(_0x4630c9){console[_0x67c8('0x76')](_0x67c8('0x77')+_0x4630c9);var _0x46016e=_0x8de975[_0x67c8('0x31')]['test']?0x1f4:_0x4630c9[_0x67c8('0x78')]||0x1f4;logger[_0x67c8('0x79')](_0x67c8('0x7a'),'getFields',_0x46016e,JSON[_0x67c8('0x7b')](_0x4630c9));delete _0x4630c9[_0x67c8('0x28')];if(_0x46016e===0x191){_0x46016e=0x190;}_0x2f02a9[_0x67c8('0x1b')](_0x46016e)[_0x67c8('0x29')](_0x8de975['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x4630c9[_0x67c8('0x78')]}:_0x4630c9);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 886ca00..c14a1cb 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 _0x0252=['./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x49d21f,_0x6e7f5){var _0x1b93f2=function(_0x1cd8e7){while(--_0x1cd8e7){_0x49d21f['push'](_0x49d21f['shift']());}};_0x1b93f2(++_0x6e7f5);}(_0x0252,0xf6));var _0x2025=function(_0x5962aa,_0x50f05e){_0x5962aa=_0x5962aa-0x0;var _0x2a80a1=_0x0252[_0x5962aa];return _0x2a80a1;};'use strict';var _=require('lodash');var util=require(_0x2025('0x0'));var logger=require(_0x2025('0x1'))(_0x2025('0x2'));var moment=require(_0x2025('0x3'));var BPromise=require(_0x2025('0x4'));var rp=require(_0x2025('0x5'));var fs=require('fs');var path=require(_0x2025('0x6'));var rimraf=require(_0x2025('0x7'));var config=require(_0x2025('0x8'));var attributes=require(_0x2025('0x9'));var integrations=require(_0x2025('0xa'));module[_0x2025('0xb')]=function(_0x446b71,_0x13979a){return _0x446b71[_0x2025('0xc')](_0x2025('0xd'),attributes,{'tableName':_0x2025('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d79=['VtigerAccount','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x2ce226,_0x18ecc5){var _0x7e34b3=function(_0x2c4794){while(--_0x2c4794){_0x2ce226['push'](_0x2ce226['shift']());}};_0x7e34b3(++_0x18ecc5);}(_0x6d79,0xfe));var _0x96d7=function(_0x4c6891,_0x50b886){_0x4c6891=_0x4c6891-0x0;var _0x5102af=_0x6d79[_0x4c6891];return _0x5102af;};'use strict';var _=require(_0x96d7('0x0'));var util=require(_0x96d7('0x1'));var logger=require(_0x96d7('0x2'))('api');var moment=require(_0x96d7('0x3'));var BPromise=require(_0x96d7('0x4'));var rp=require(_0x96d7('0x5'));var fs=require('fs');var path=require(_0x96d7('0x6'));var rimraf=require('rimraf');var config=require(_0x96d7('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x96d7('0x8'));module[_0x96d7('0x9')]=function(_0x32190b,_0x2b5ba3){return _0x32190b['define'](_0x96d7('0xa'),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 fddbf12..b8c323d 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 _0xde2c=['findAll','options','raw','where','limit','include','model','attributes','GetVtigerAccount','stringify','find','map','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','VtigerAccount'];(function(_0x5232a9,_0x30a72d){var _0x5cc4e2=function(_0x2e8236){while(--_0x2e8236){_0x5232a9['push'](_0x5232a9['shift']());}};_0x5cc4e2(++_0x30a72d);}(_0xde2c,0x7f));var _0xcde2=function(_0x53b133,_0x176261){_0x53b133=_0x53b133-0x0;var _0x5647e0=_0xde2c[_0x53b133];return _0x5647e0;};'use strict';var _=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var moment=require(_0xcde2('0x2'));var BPromise=require(_0xcde2('0x3'));var rs=require(_0xcde2('0x4'));var fs=require('fs');var Redis=require(_0xcde2('0x5'));var db=require(_0xcde2('0x6'))['db'];var utils=require(_0xcde2('0x7'));var logger=require('../../config/logger')(_0xcde2('0x8'));var config=require(_0xcde2('0x9'));var jayson=require(_0xcde2('0xa'));var client=jayson[_0xcde2('0xb')][_0xcde2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53c558,_0x2b27ef,_0x385e83){return new BPromise(function(_0x9c7036,_0x544235){return client['request'](_0x53c558,_0x385e83)[_0xcde2('0xd')](function(_0x1c8b3c){logger['info'](_0xcde2('0xe'),_0x2b27ef,_0xcde2('0xf'));logger[_0xcde2('0x10')](_0xcde2('0x11'),_0x2b27ef,'request\x20sent',JSON['stringify'](_0x1c8b3c));if(_0x1c8b3c[_0xcde2('0x12')]){if(_0x1c8b3c[_0xcde2('0x12')][_0xcde2('0x13')]===0x1f4){logger[_0xcde2('0x12')](_0xcde2('0xe'),_0x2b27ef,_0x1c8b3c[_0xcde2('0x12')]['message']);return _0x544235(_0x1c8b3c[_0xcde2('0x12')]['message']);}logger[_0xcde2('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x2b27ef,_0x1c8b3c['error'][_0xcde2('0x14')]);return _0x9c7036(_0x1c8b3c[_0xcde2('0x12')][_0xcde2('0x14')]);}else{logger[_0xcde2('0x15')](_0xcde2('0xe'),_0x2b27ef,'request\x20sent');_0x9c7036(_0x1c8b3c[_0xcde2('0x16')]['message']);}})[_0xcde2('0x17')](function(_0x198840){logger[_0xcde2('0x12')](_0xcde2('0xe'),_0x2b27ef,_0x198840);_0x544235(_0x198840);});});}exports['GetVtigerAccount']=function(_0x4fd5aa){var _0x4fe586=this;return new Promise(function(_0x2b4468,_0x582e84){return db[_0xcde2('0x18')][_0xcde2('0x19')]({'raw':_0x4fd5aa[_0xcde2('0x1a')]?_0x4fd5aa['options'][_0xcde2('0x1b')]===undefined?!![]:![]:!![],'where':_0x4fd5aa[_0xcde2('0x1a')]?_0x4fd5aa[_0xcde2('0x1a')][_0xcde2('0x1c')]||null:null,'attributes':_0x4fd5aa[_0xcde2('0x1a')]?_0x4fd5aa['options']['attributes']||null:null,'limit':_0x4fd5aa['options']?_0x4fd5aa[_0xcde2('0x1a')][_0xcde2('0x1d')]||null:null,'include':_0x4fd5aa[_0xcde2('0x1a')]?_0x4fd5aa[_0xcde2('0x1a')][_0xcde2('0x1e')]?_['map'](_0x4fd5aa[_0xcde2('0x1a')]['include'],function(_0x280d8c){return{'model':db[_0x280d8c[_0xcde2('0x1f')]],'as':_0x280d8c['as'],'attributes':_0x280d8c[_0xcde2('0x20')],'include':_0x280d8c['include']?_['map'](_0x280d8c[_0xcde2('0x1e')],function(_0x207a12){return{'model':db[_0x207a12[_0xcde2('0x1f')]],'as':_0x207a12['as'],'attributes':_0x207a12[_0xcde2('0x20')],'include':_0x207a12[_0xcde2('0x1e')]?_['map'](_0x207a12[_0xcde2('0x1e')],function(_0x45275a){return{'model':db[_0x45275a[_0xcde2('0x1f')]],'as':_0x45275a['as'],'attributes':_0x45275a['attributes']};}):[]};}):[]};}):[]:[]})[_0xcde2('0xd')](function(_0x348ca1){logger[_0xcde2('0x15')](_0xcde2('0x21'),_0x4fd5aa);logger[_0xcde2('0x10')](_0xcde2('0x21'),_0x4fd5aa,JSON[_0xcde2('0x22')](_0x348ca1));_0x2b4468(_0x348ca1);})[_0xcde2('0x17')](function(_0x5bf1e6){logger[_0xcde2('0x12')]('GetVtigerAccount',_0x5bf1e6[_0xcde2('0x14')],_0x4fd5aa);_0x582e84(_0x4fe586[_0xcde2('0x12')](0x1f4,_0x5bf1e6[_0xcde2('0x14')]));});});};exports['ShowVtigerAccount']=function(_0xae46dc){var _0x28fedd=this;return new Promise(function(_0x58afb1,_0x26ec42){return db[_0xcde2('0x18')][_0xcde2('0x23')]({'raw':_0xae46dc[_0xcde2('0x1a')]?_0xae46dc[_0xcde2('0x1a')][_0xcde2('0x1b')]===undefined?!![]:![]:!![],'where':_0xae46dc[_0xcde2('0x1a')]?_0xae46dc[_0xcde2('0x1a')]['where']||null:null,'attributes':_0xae46dc[_0xcde2('0x1a')]?_0xae46dc[_0xcde2('0x1a')][_0xcde2('0x20')]||null:null,'include':_0xae46dc[_0xcde2('0x1a')]?_0xae46dc['options'][_0xcde2('0x1e')]?_[_0xcde2('0x24')](_0xae46dc[_0xcde2('0x1a')][_0xcde2('0x1e')],function(_0x498339){return{'model':db[_0x498339[_0xcde2('0x1f')]],'as':_0x498339['as'],'attributes':_0x498339[_0xcde2('0x20')],'include':_0x498339[_0xcde2('0x1e')]?_[_0xcde2('0x24')](_0x498339['include'],function(_0xb9c8d2){return{'model':db[_0xb9c8d2[_0xcde2('0x1f')]],'as':_0xb9c8d2['as'],'attributes':_0xb9c8d2[_0xcde2('0x20')],'include':_0xb9c8d2[_0xcde2('0x1e')]?_[_0xcde2('0x24')](_0xb9c8d2['include'],function(_0x2cd313){return{'model':db[_0x2cd313[_0xcde2('0x1f')]],'as':_0x2cd313['as'],'attributes':_0x2cd313[_0xcde2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcde2('0xd')](function(_0x4a64c1){logger['info'](_0xcde2('0x25'),_0xae46dc);logger[_0xcde2('0x10')](_0xcde2('0x25'),_0xae46dc,JSON[_0xcde2('0x22')](_0x4a64c1));_0x58afb1(_0x4a64c1);})[_0xcde2('0x17')](function(_0x45af6e){logger[_0xcde2('0x12')](_0xcde2('0x25'),_0x45af6e[_0xcde2('0x14')],_0xae46dc);_0x26ec42(_0x28fedd['error'](0x1f4,_0x45af6e[_0xcde2('0x14')]));});});}; \ No newline at end of file +var _0xee5b=['map','model','attributes','catch','ShowVtigerAccount','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','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','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','include'];(function(_0x117576,_0x1ced1a){var _0x4533f5=function(_0x19bc33){while(--_0x19bc33){_0x117576['push'](_0x117576['shift']());}};_0x4533f5(++_0x1ced1a);}(_0xee5b,0x1f4));var _0xbee5=function(_0x392ee1,_0x31ae50){_0x392ee1=_0x392ee1-0x0;var _0x3decd9=_0xee5b[_0x392ee1];return _0x3decd9;};'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')]('VtigerAccount,\x20%s,\x20%s',_0x4f5065,_0xbee5('0xf'));_0x53d5b9(_0x7dda04[_0xbee5('0x14')][_0xbee5('0x13')]);}})['catch'](function(_0x27e034){logger[_0xbee5('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x4f5065,_0x27e034);_0x5baf5c(_0x27e034);});});}exports[_0xbee5('0x15')]=function(_0x538460){var _0x11b4a3=this;return new Promise(function(_0x3c3f4e,_0x35eb5c){return db[_0xbee5('0x16')][_0xbee5('0x17')]({'raw':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x19')]===undefined?!![]:![]:!![],'where':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x1a')]||null:null,'attributes':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')]['attributes']||null:null,'limit':_0x538460['options']?_0x538460[_0xbee5('0x18')]['limit']||null:null,'include':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x1b')]?_[_0xbee5('0x1c')](_0x538460[_0xbee5('0x18')][_0xbee5('0x1b')],function(_0x359ccf){return{'model':db[_0x359ccf[_0xbee5('0x1d')]],'as':_0x359ccf['as'],'attributes':_0x359ccf[_0xbee5('0x1e')],'include':_0x359ccf['include']?_['map'](_0x359ccf['include'],function(_0x519473){return{'model':db[_0x519473['model']],'as':_0x519473['as'],'attributes':_0x519473[_0xbee5('0x1e')],'include':_0x519473[_0xbee5('0x1b')]?_[_0xbee5('0x1c')](_0x519473[_0xbee5('0x1b')],function(_0x169042){return{'model':db[_0x169042[_0xbee5('0x1d')]],'as':_0x169042['as'],'attributes':_0x169042[_0xbee5('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36b50f){logger[_0xbee5('0xb')](_0xbee5('0x15'),_0x538460);logger[_0xbee5('0xd')](_0xbee5('0x15'),_0x538460,JSON['stringify'](_0x36b50f));_0x3c3f4e(_0x36b50f);})[_0xbee5('0x1f')](function(_0x15ffb1){logger[_0xbee5('0x11')](_0xbee5('0x15'),_0x15ffb1[_0xbee5('0x13')],_0x538460);_0x35eb5c(_0x11b4a3[_0xbee5('0x11')](0x1f4,_0x15ffb1[_0xbee5('0x13')]));});});};exports[_0xbee5('0x20')]=function(_0x2ccb91){var _0x59c2e4=this;return new Promise(function(_0x22df5f,_0x5b10a6){return db[_0xbee5('0x16')]['find']({'raw':_0x2ccb91[_0xbee5('0x18')]?_0x2ccb91['options'][_0xbee5('0x19')]===undefined?!![]:![]:!![],'where':_0x2ccb91['options']?_0x2ccb91[_0xbee5('0x18')][_0xbee5('0x1a')]||null:null,'attributes':_0x2ccb91[_0xbee5('0x18')]?_0x2ccb91[_0xbee5('0x18')]['attributes']||null:null,'include':_0x2ccb91[_0xbee5('0x18')]?_0x2ccb91[_0xbee5('0x18')][_0xbee5('0x1b')]?_[_0xbee5('0x1c')](_0x2ccb91['options'][_0xbee5('0x1b')],function(_0x28f8e3){return{'model':db[_0x28f8e3[_0xbee5('0x1d')]],'as':_0x28f8e3['as'],'attributes':_0x28f8e3[_0xbee5('0x1e')],'include':_0x28f8e3['include']?_[_0xbee5('0x1c')](_0x28f8e3[_0xbee5('0x1b')],function(_0x3e854){return{'model':db[_0x3e854[_0xbee5('0x1d')]],'as':_0x3e854['as'],'attributes':_0x3e854['attributes'],'include':_0x3e854[_0xbee5('0x1b')]?_['map'](_0x3e854[_0xbee5('0x1b')],function(_0x58a2e3){return{'model':db[_0x58a2e3['model']],'as':_0x58a2e3['as'],'attributes':_0x58a2e3['attributes']};}):[]};}):[]};}):[]:[]})[_0xbee5('0xa')](function(_0x315523){logger[_0xbee5('0xb')](_0xbee5('0x20'),_0x2ccb91);logger[_0xbee5('0xd')](_0xbee5('0x20'),_0x2ccb91,JSON[_0xbee5('0x10')](_0x315523));_0x22df5f(_0x315523);})[_0xbee5('0x1f')](function(_0x58452a){logger[_0xbee5('0x11')]('ShowVtigerAccount',_0x58452a[_0xbee5('0x13')],_0x2ccb91);_0x5b10a6(_0x59c2e4[_0xbee5('0x11')](0x1f4,_0x58452a[_0xbee5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index ae34fa5..d971c09 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 _0x7f91=['update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id'];(function(_0x5d4cb5,_0x22025e){var _0x25561e=function(_0x4d792a){while(--_0x4d792a){_0x5d4cb5['push'](_0x5d4cb5['shift']());}};_0x25561e(++_0x22025e);}(_0x7f91,0x95));var _0x17f9=function(_0xeb0035,_0x2c3d9a){_0xeb0035=_0xeb0035-0x0;var _0x190e57=_0x7f91[_0xeb0035];return _0x190e57;};'use strict';var multer=require(_0x17f9('0x0'));var util=require(_0x17f9('0x1'));var path=require(_0x17f9('0x2'));var timeout=require('connect-timeout');var express=require(_0x17f9('0x3'));var router=express[_0x17f9('0x4')]();var fs_extra=require(_0x17f9('0x5'));var auth=require(_0x17f9('0x6'));var interaction=require(_0x17f9('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0x17f9('0x8')]('/',auth[_0x17f9('0x9')](),controller[_0x17f9('0xa')]);router[_0x17f9('0x8')]('/:id',auth[_0x17f9('0x9')](),controller['show']);router[_0x17f9('0x8')](_0x17f9('0xb'),auth[_0x17f9('0x9')](),controller['getFields']);router[_0x17f9('0x8')](_0x17f9('0xc'),auth[_0x17f9('0x9')](),controller['getSubjects']);router[_0x17f9('0x8')](_0x17f9('0xd'),auth[_0x17f9('0x9')](),controller[_0x17f9('0xe')]);router[_0x17f9('0xf')]('/',auth[_0x17f9('0x9')](),controller[_0x17f9('0x10')]);router[_0x17f9('0x11')](_0x17f9('0x12'),auth['isAuthenticated'](),controller[_0x17f9('0x13')]);router['delete'](_0x17f9('0x12'),auth[_0x17f9('0x9')](),controller['destroy']);module[_0x17f9('0x14')]=router; \ No newline at end of file +var _0x2d6b=['delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x23604b,_0x3d651e){var _0x1a56de=function(_0x281cb7){while(--_0x281cb7){_0x23604b['push'](_0x23604b['shift']());}};_0x1a56de(++_0x3d651e);}(_0x2d6b,0x1bb));var _0xb2d6=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x2d6b[_0x26462c];return _0x509a42;};'use strict';var multer=require(_0xb2d6('0x0'));var util=require('util');var path=require(_0xb2d6('0x1'));var timeout=require('connect-timeout');var express=require(_0xb2d6('0x2'));var router=express['Router']();var fs_extra=require(_0xb2d6('0x3'));var auth=require(_0xb2d6('0x4'));var interaction=require(_0xb2d6('0x5'));var config=require(_0xb2d6('0x6'));var controller=require(_0xb2d6('0x7'));router[_0xb2d6('0x8')]('/',auth[_0xb2d6('0x9')](),controller[_0xb2d6('0xa')]);router[_0xb2d6('0x8')](_0xb2d6('0xb'),auth[_0xb2d6('0x9')](),controller['show']);router['get'](_0xb2d6('0xc'),auth['isAuthenticated'](),controller[_0xb2d6('0xd')]);router[_0xb2d6('0x8')]('/:id/subjects',auth[_0xb2d6('0x9')](),controller[_0xb2d6('0xe')]);router[_0xb2d6('0x8')](_0xb2d6('0xf'),auth[_0xb2d6('0x9')](),controller[_0xb2d6('0x10')]);router[_0xb2d6('0x11')]('/',auth['isAuthenticated'](),controller[_0xb2d6('0x12')]);router['put'](_0xb2d6('0xb'),auth[_0xb2d6('0x9')](),controller['update']);router[_0xb2d6('0x13')](_0xb2d6('0xb'),auth[_0xb2d6('0x9')](),controller[_0xb2d6('0x14')]);module[_0xb2d6('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 8e8278a..d2a4451 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 _0xe4e2=['exports','STRING','sequelize'];(function(_0x4a7fa2,_0x170466){var _0x2c371d=function(_0x1a2db1){while(--_0x1a2db1){_0x4a7fa2['push'](_0x4a7fa2['shift']());}};_0x2c371d(++_0x170466);}(_0xe4e2,0x1af));var _0x2e4e=function(_0xcd2975,_0x27d718){_0xcd2975=_0xcd2975-0x0;var _0x284074=_0xe4e2[_0xcd2975];return _0x284074;};'use strict';var Sequelize=require(_0x2e4e('0x0'));module[_0x2e4e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2e4e('0x2')]}}; \ No newline at end of file +var _0x89a7=['exports','STRING'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x89a7,0xbe));var _0x789a=function(_0x31ca35,_0x2b3bad){_0x31ca35=_0x31ca35-0x0;var _0x2a0105=_0x89a7[_0x31ca35];return _0x2a0105;};'use strict';var Sequelize=require('sequelize');module[_0x789a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x789a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index a4062c2..0598f2d 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 _0xb642=['update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','VtigerConfiguration','rows','catch','params','keys','options','find','create','body','getFields','findOne','order','getSubjects','getDescriptions','VtigerField','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject'];(function(_0x186841,_0x21ce3a){var _0x519e76=function(_0x1dd42c){while(--_0x1dd42c){_0x186841['push'](_0x186841['shift']());}};_0x519e76(++_0x21ce3a);}(_0xb642,0x15d));var _0x2b64=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xb642[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2b64('0x0'));var zipdir=require(_0x2b64('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b64('0x2'));var moment=require(_0x2b64('0x3'));var BPromise=require(_0x2b64('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2b64('0x5'));var sox=require('sox');var csv=require(_0x2b64('0x6'));var ejs=require(_0x2b64('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b64('0x8'));var squel=require(_0x2b64('0x9'));var crypto=require(_0x2b64('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x2b64('0xb'));var toCsv=require(_0x2b64('0x6'));var querystring=require(_0x2b64('0xc'));var Papa=require('papaparse');var Redis=require(_0x2b64('0xd'));var authService=require(_0x2b64('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b64('0xf'));var logger=require(_0x2b64('0x10'))(_0x2b64('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2b64('0x12'));var db=require(_0x2b64('0x13'))['db'];function respondWithStatusCode(_0x1c8a6d,_0x1f1bfd){_0x1f1bfd=_0x1f1bfd||0xcc;return function(_0x135a8b){if(_0x135a8b){return _0x1c8a6d[_0x2b64('0x14')](_0x1f1bfd);}return _0x1c8a6d[_0x2b64('0x15')](_0x1f1bfd)[_0x2b64('0x16')]();};}function respondWithResult(_0x4a6d40,_0x3cd9c3){_0x3cd9c3=_0x3cd9c3||0xc8;return function(_0x49e0cc){if(_0x49e0cc){return _0x4a6d40[_0x2b64('0x15')](_0x3cd9c3)['json'](_0x49e0cc);}};}function respondWithFilteredResult(_0x6897a9,_0x762c03){return function(_0x272ad6){if(_0x272ad6){var _0x3e1675=typeof _0x762c03[_0x2b64('0x17')]===_0x2b64('0x18')&&typeof _0x762c03[_0x2b64('0x19')]==='undefined';var _0x49f71e=_0x272ad6['count'];var _0x356a18=_0x3e1675?0x0:_0x762c03[_0x2b64('0x17')];var _0x26a6ef=_0x3e1675?_0x272ad6[_0x2b64('0x1a')]:_0x762c03[_0x2b64('0x17')]+_0x762c03['limit'];var _0x3c6c62;if(_0x26a6ef>=_0x49f71e){_0x26a6ef=_0x49f71e;_0x3c6c62=0xc8;}else{_0x3c6c62=0xce;}_0x6897a9['status'](_0x3c6c62);return _0x6897a9[_0x2b64('0x1b')](_0x2b64('0x1c'),_0x356a18+'-'+_0x26a6ef+'/'+_0x49f71e)[_0x2b64('0x1d')](_0x272ad6);}return null;};}function patchUpdates(_0x35e8d2){return function(_0xa3c626){try{jsonpatch['apply'](_0xa3c626,_0x35e8d2,!![]);}catch(_0x322c96){return BPromise[_0x2b64('0x1e')](_0x322c96);}return _0xa3c626['save']();};}function saveUpdates(_0x37ccfa,_0x5871bc){return function(_0x14416f){if(_0x14416f){return _0x14416f[_0x2b64('0x1f')](_0x37ccfa)[_0x2b64('0x20')](function(_0xb664ce){return _0xb664ce;});}return null;};}function removeEntity(_0x4210e2,_0x39c08b){return function(_0x4be1f1){if(_0x4be1f1){return _0x4be1f1[_0x2b64('0x21')]()[_0x2b64('0x20')](function(){_0x4210e2[_0x2b64('0x15')](0xcc)[_0x2b64('0x16')]();});}};}function handleEntityNotFound(_0x30a93e,_0x4f4ec9){return function(_0xd94601){if(!_0xd94601){_0x30a93e[_0x2b64('0x14')](0x194);}return _0xd94601;};}function handleError(_0x149e97,_0xc2f3ed){_0xc2f3ed=_0xc2f3ed||0x1f4;return function(_0x2b5c19){logger[_0x2b64('0x22')](_0x2b5c19[_0x2b64('0x23')]);if(_0x2b5c19[_0x2b64('0x24')]){delete _0x2b5c19[_0x2b64('0x24')];}_0x149e97[_0x2b64('0x15')](_0xc2f3ed)[_0x2b64('0x25')](_0x2b5c19);};}exports[_0x2b64('0x26')]=function(_0x4a5188,_0x224763){var _0x3cf5fc={},_0x1ab1d2={},_0x463a0d={'count':0x0,'rows':[]};var _0x55fd7a=_[_0x2b64('0x27')](db['VtigerConfiguration'][_0x2b64('0x28')],function(_0x234312){return{'name':_0x234312[_0x2b64('0x29')],'type':_0x234312[_0x2b64('0x2a')][_0x2b64('0x2b')]};});_0x1ab1d2['model']=_[_0x2b64('0x27')](_0x55fd7a,_0x2b64('0x24'));_0x1ab1d2[_0x2b64('0x2c')]=_['keys'](_0x4a5188['query']);_0x1ab1d2[_0x2b64('0x2d')]=_[_0x2b64('0x2e')](_0x1ab1d2[_0x2b64('0x2f')],_0x1ab1d2[_0x2b64('0x2c')]);_0x3cf5fc[_0x2b64('0x30')]=_['intersection'](_0x1ab1d2['model'],qs[_0x2b64('0x31')](_0x4a5188[_0x2b64('0x2c')][_0x2b64('0x31')]));_0x3cf5fc[_0x2b64('0x30')]=_0x3cf5fc[_0x2b64('0x30')][_0x2b64('0x32')]?_0x3cf5fc[_0x2b64('0x30')]:_0x1ab1d2[_0x2b64('0x2f')];if(!_0x4a5188[_0x2b64('0x2c')][_0x2b64('0x33')](_0x2b64('0x34'))){_0x3cf5fc['limit']=qs[_0x2b64('0x19')](_0x4a5188[_0x2b64('0x2c')][_0x2b64('0x19')]);_0x3cf5fc['offset']=qs['offset'](_0x4a5188[_0x2b64('0x2c')][_0x2b64('0x17')]);}_0x3cf5fc['order']=qs[_0x2b64('0x35')](_0x4a5188[_0x2b64('0x2c')][_0x2b64('0x35')]);_0x3cf5fc[_0x2b64('0x36')]=qs[_0x2b64('0x2d')](_[_0x2b64('0x37')](_0x4a5188['query'],_0x1ab1d2[_0x2b64('0x2d')]),_0x55fd7a);if(_0x4a5188[_0x2b64('0x2c')][_0x2b64('0x38')]){_0x3cf5fc['where']=_[_0x2b64('0x39')](_0x3cf5fc['where'],{'$or':_[_0x2b64('0x27')](_0x55fd7a,function(_0x15e999){if(_0x15e999[_0x2b64('0x2a')]!==_0x2b64('0x3a')){var _0x4f21d0={};_0x4f21d0[_0x15e999[_0x2b64('0x24')]]={'$like':'%'+_0x4a5188[_0x2b64('0x2c')][_0x2b64('0x38')]+'%'};return _0x4f21d0;}})});}_0x3cf5fc=_[_0x2b64('0x39')]({},_0x3cf5fc,_0x4a5188['options']);var _0x17603e={'where':_0x3cf5fc[_0x2b64('0x36')]};return db['VtigerConfiguration']['count'](_0x17603e)['then'](function(_0x5aa7fb){_0x463a0d[_0x2b64('0x1a')]=_0x5aa7fb;if(_0x4a5188[_0x2b64('0x2c')][_0x2b64('0x3b')]){_0x3cf5fc[_0x2b64('0x3c')]=[{'all':!![]}];}return db[_0x2b64('0x3d')]['findAll'](_0x3cf5fc);})['then'](function(_0x340e1a){_0x463a0d[_0x2b64('0x3e')]=_0x340e1a;return _0x463a0d;})[_0x2b64('0x20')](respondWithFilteredResult(_0x224763,_0x3cf5fc))[_0x2b64('0x3f')](handleError(_0x224763,null));};exports['show']=function(_0x1da8bc,_0x5db4af){var _0x42bd9d={'raw':![],'where':{'id':_0x1da8bc[_0x2b64('0x40')]['id']}},_0x3dd6d0={};_0x3dd6d0['model']=_[_0x2b64('0x41')](db[_0x2b64('0x3d')][_0x2b64('0x28')]);_0x3dd6d0[_0x2b64('0x2c')]=_[_0x2b64('0x41')](_0x1da8bc['query']);_0x3dd6d0[_0x2b64('0x2d')]=_[_0x2b64('0x2e')](_0x3dd6d0[_0x2b64('0x2f')],_0x3dd6d0[_0x2b64('0x2c')]);_0x42bd9d[_0x2b64('0x30')]=_[_0x2b64('0x2e')](_0x3dd6d0['model'],qs[_0x2b64('0x31')](_0x1da8bc[_0x2b64('0x2c')][_0x2b64('0x31')]));_0x42bd9d[_0x2b64('0x30')]=_0x42bd9d[_0x2b64('0x30')][_0x2b64('0x32')]?_0x42bd9d[_0x2b64('0x30')]:_0x3dd6d0[_0x2b64('0x2f')];if(_0x1da8bc[_0x2b64('0x2c')][_0x2b64('0x3b')]){_0x42bd9d[_0x2b64('0x3c')]=[{'all':!![]}];}_0x42bd9d=_[_0x2b64('0x39')]({},_0x42bd9d,_0x1da8bc[_0x2b64('0x42')]);return db['VtigerConfiguration'][_0x2b64('0x43')](_0x42bd9d)['then'](handleEntityNotFound(_0x5db4af,null))[_0x2b64('0x20')](respondWithResult(_0x5db4af,null))[_0x2b64('0x3f')](handleError(_0x5db4af,null));};exports['create']=function(_0xf652e5,_0x192fe4){return db[_0x2b64('0x3d')][_0x2b64('0x44')](_0xf652e5[_0x2b64('0x45')],{})['then'](respondWithResult(_0x192fe4,0xc9))[_0x2b64('0x3f')](handleError(_0x192fe4,null));};exports[_0x2b64('0x1f')]=function(_0x49fda3,_0x45960b){if(_0x49fda3['body']['id']){delete _0x49fda3['body']['id'];}return db[_0x2b64('0x3d')]['find']({'where':{'id':_0x49fda3[_0x2b64('0x40')]['id']}})[_0x2b64('0x20')](handleEntityNotFound(_0x45960b,null))['then'](saveUpdates(_0x49fda3['body'],null))['then'](respondWithResult(_0x45960b,null))[_0x2b64('0x3f')](handleError(_0x45960b,null));};exports[_0x2b64('0x21')]=function(_0x414b89,_0x5197fd){return db[_0x2b64('0x3d')][_0x2b64('0x43')]({'where':{'id':_0x414b89[_0x2b64('0x40')]['id']}})['then'](handleEntityNotFound(_0x5197fd,null))[_0x2b64('0x20')](removeEntity(_0x5197fd,null))['catch'](handleError(_0x5197fd,null));};exports[_0x2b64('0x46')]=function(_0x58a529,_0x1149f9,_0x478a20){var _0xe9c1e4={};var _0x4be22d={};var _0x410bae;var _0x2cf0bd;return db[_0x2b64('0x3d')][_0x2b64('0x47')]({'where':{'id':_0x58a529[_0x2b64('0x40')]['id']}})[_0x2b64('0x20')](handleEntityNotFound(_0x1149f9,null))[_0x2b64('0x20')](function(_0x23ff33){if(_0x23ff33){_0x410bae=_0x23ff33;_0x4be22d[_0x2b64('0x2f')]=_[_0x2b64('0x41')](db['VtigerField'][_0x2b64('0x28')]);_0x4be22d[_0x2b64('0x2c')]=_['keys'](_0x58a529[_0x2b64('0x2c')]);_0x4be22d['filters']=_[_0x2b64('0x2e')](_0x4be22d[_0x2b64('0x2f')],_0x4be22d[_0x2b64('0x2c')]);_0xe9c1e4[_0x2b64('0x30')]=_[_0x2b64('0x2e')](_0x4be22d[_0x2b64('0x2f')],qs[_0x2b64('0x31')](_0x58a529['query']['fields']));_0xe9c1e4[_0x2b64('0x30')]=_0xe9c1e4[_0x2b64('0x30')]['length']?_0xe9c1e4[_0x2b64('0x30')]:_0x4be22d[_0x2b64('0x2f')];_0xe9c1e4[_0x2b64('0x48')]=qs[_0x2b64('0x35')](_0x58a529[_0x2b64('0x2c')]['sort']);_0xe9c1e4['where']=qs[_0x2b64('0x2d')](_['pick'](_0x58a529['query'],_0x4be22d[_0x2b64('0x2d')]));if(_0x58a529[_0x2b64('0x2c')]['filter']){_0xe9c1e4['where']=_[_0x2b64('0x39')](_0xe9c1e4[_0x2b64('0x36')],{'$or':_[_0x2b64('0x27')](_0xe9c1e4[_0x2b64('0x30')],function(_0xa11be3){var _0x221455={};_0x221455[_0xa11be3]={'$like':'%'+_0x58a529[_0x2b64('0x2c')][_0x2b64('0x38')]+'%'};return _0x221455;})});}_0xe9c1e4=_[_0x2b64('0x39')]({},_0xe9c1e4,_0x58a529[_0x2b64('0x42')]);return _0x410bae[_0x2b64('0x46')](_0xe9c1e4);}})[_0x2b64('0x20')](function(_0x3fa142){if(_0x3fa142){_0x2cf0bd=_0x3fa142[_0x2b64('0x32')];if(!_0x58a529[_0x2b64('0x2c')]['hasOwnProperty'](_0x2b64('0x34'))){_0xe9c1e4[_0x2b64('0x19')]=qs['limit'](_0x58a529['query'][_0x2b64('0x19')]);_0xe9c1e4['offset']=qs[_0x2b64('0x17')](_0x58a529['query'][_0x2b64('0x17')]);}return _0x410bae[_0x2b64('0x46')](_0xe9c1e4);}})[_0x2b64('0x20')](function(_0x50d5d6){if(_0x50d5d6){return _0x50d5d6?{'count':_0x2cf0bd,'rows':_0x50d5d6}:null;}})[_0x2b64('0x20')](respondWithResult(_0x1149f9,null))[_0x2b64('0x3f')](handleError(_0x1149f9,null));};exports[_0x2b64('0x49')]=function(_0x8b78f9,_0x3d9574,_0x3c3705){var _0x2ada91={};var _0x36e311={};var _0x245c98;var _0x4478a9;return db[_0x2b64('0x3d')][_0x2b64('0x47')]({'where':{'id':_0x8b78f9[_0x2b64('0x40')]['id']}})[_0x2b64('0x20')](handleEntityNotFound(_0x3d9574,null))[_0x2b64('0x20')](function(_0x50d0a0){if(_0x50d0a0){_0x245c98=_0x50d0a0;_0x36e311['model']=_[_0x2b64('0x41')](db['VtigerField']['rawAttributes']);_0x36e311['query']=_[_0x2b64('0x41')](_0x8b78f9[_0x2b64('0x2c')]);_0x36e311['filters']=_[_0x2b64('0x2e')](_0x36e311['model'],_0x36e311['query']);_0x2ada91[_0x2b64('0x30')]=_[_0x2b64('0x2e')](_0x36e311['model'],qs['fields'](_0x8b78f9[_0x2b64('0x2c')]['fields']));_0x2ada91[_0x2b64('0x30')]=_0x2ada91['attributes'][_0x2b64('0x32')]?_0x2ada91[_0x2b64('0x30')]:_0x36e311[_0x2b64('0x2f')];_0x2ada91[_0x2b64('0x48')]=qs[_0x2b64('0x35')](_0x8b78f9[_0x2b64('0x2c')][_0x2b64('0x35')]);_0x2ada91[_0x2b64('0x36')]=qs['filters'](_[_0x2b64('0x37')](_0x8b78f9[_0x2b64('0x2c')],_0x36e311[_0x2b64('0x2d')]));if(_0x8b78f9['query'][_0x2b64('0x38')]){_0x2ada91['where']=_[_0x2b64('0x39')](_0x2ada91['where'],{'$or':_[_0x2b64('0x27')](_0x2ada91[_0x2b64('0x30')],function(_0x334810){var _0xb8ddee={};_0xb8ddee[_0x334810]={'$like':'%'+_0x8b78f9[_0x2b64('0x2c')][_0x2b64('0x38')]+'%'};return _0xb8ddee;})});}_0x2ada91=_[_0x2b64('0x39')]({},_0x2ada91,_0x8b78f9[_0x2b64('0x42')]);return _0x245c98['getSubjects'](_0x2ada91);}})['then'](function(_0x2bc20a){if(_0x2bc20a){_0x4478a9=_0x2bc20a[_0x2b64('0x32')];if(!_0x8b78f9['query']['hasOwnProperty'](_0x2b64('0x34'))){_0x2ada91[_0x2b64('0x19')]=qs[_0x2b64('0x19')](_0x8b78f9['query'][_0x2b64('0x19')]);_0x2ada91[_0x2b64('0x17')]=qs[_0x2b64('0x17')](_0x8b78f9[_0x2b64('0x2c')][_0x2b64('0x17')]);}return _0x245c98['getSubjects'](_0x2ada91);}})[_0x2b64('0x20')](function(_0x3cf79d){if(_0x3cf79d){return _0x3cf79d?{'count':_0x4478a9,'rows':_0x3cf79d}:null;}})[_0x2b64('0x20')](respondWithResult(_0x3d9574,null))['catch'](handleError(_0x3d9574,null));};exports[_0x2b64('0x4a')]=function(_0x22d499,_0x122fa8,_0x4b593e){var _0x2d9fc3={};var _0x4bcbba={};var _0x426279;var _0x19a12f;return db[_0x2b64('0x3d')]['findOne']({'where':{'id':_0x22d499[_0x2b64('0x40')]['id']}})['then'](handleEntityNotFound(_0x122fa8,null))[_0x2b64('0x20')](function(_0x11e347){if(_0x11e347){_0x426279=_0x11e347;_0x4bcbba[_0x2b64('0x2f')]=_['keys'](db[_0x2b64('0x4b')][_0x2b64('0x28')]);_0x4bcbba[_0x2b64('0x2c')]=_['keys'](_0x22d499[_0x2b64('0x2c')]);_0x4bcbba[_0x2b64('0x2d')]=_['intersection'](_0x4bcbba[_0x2b64('0x2f')],_0x4bcbba[_0x2b64('0x2c')]);_0x2d9fc3[_0x2b64('0x30')]=_[_0x2b64('0x2e')](_0x4bcbba[_0x2b64('0x2f')],qs[_0x2b64('0x31')](_0x22d499['query']['fields']));_0x2d9fc3['attributes']=_0x2d9fc3[_0x2b64('0x30')]['length']?_0x2d9fc3['attributes']:_0x4bcbba['model'];_0x2d9fc3[_0x2b64('0x48')]=qs['sort'](_0x22d499[_0x2b64('0x2c')][_0x2b64('0x35')]);_0x2d9fc3['where']=qs[_0x2b64('0x2d')](_[_0x2b64('0x37')](_0x22d499[_0x2b64('0x2c')],_0x4bcbba[_0x2b64('0x2d')]));if(_0x22d499[_0x2b64('0x2c')]['filter']){_0x2d9fc3[_0x2b64('0x36')]=_['merge'](_0x2d9fc3[_0x2b64('0x36')],{'$or':_[_0x2b64('0x27')](_0x2d9fc3[_0x2b64('0x30')],function(_0xc36dd2){var _0x18a46d={};_0x18a46d[_0xc36dd2]={'$like':'%'+_0x22d499[_0x2b64('0x2c')][_0x2b64('0x38')]+'%'};return _0x18a46d;})});}_0x2d9fc3=_[_0x2b64('0x39')]({},_0x2d9fc3,_0x22d499[_0x2b64('0x42')]);return _0x426279['getDescriptions'](_0x2d9fc3);}})[_0x2b64('0x20')](function(_0xe40302){if(_0xe40302){_0x19a12f=_0xe40302[_0x2b64('0x32')];if(!_0x22d499[_0x2b64('0x2c')][_0x2b64('0x33')]('nolimit')){_0x2d9fc3['limit']=qs[_0x2b64('0x19')](_0x22d499[_0x2b64('0x2c')][_0x2b64('0x19')]);_0x2d9fc3[_0x2b64('0x17')]=qs[_0x2b64('0x17')](_0x22d499[_0x2b64('0x2c')][_0x2b64('0x17')]);}return _0x426279[_0x2b64('0x4a')](_0x2d9fc3);}})['then'](function(_0x219e5d){if(_0x219e5d){return _0x219e5d?{'count':_0x19a12f,'rows':_0x219e5d}:null;}})[_0x2b64('0x20')](respondWithResult(_0x122fa8,null))[_0x2b64('0x3f')](handleError(_0x122fa8,null));}; \ No newline at end of file +var _0x6127=['filters','pick','filter','VIRTUAL','merge','options','includeAll','include','VtigerConfiguration','findAll','catch','show','params','find','body','getFields','findOne','VtigerField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0x1f4aaa,_0x3d3fb2){var _0x4db89e=function(_0x19a3f5){while(--_0x19a3f5){_0x1f4aaa['push'](_0x1f4aaa['shift']());}};_0x4db89e(++_0x3d3fb2);}(_0x6127,0x165));var _0x7612=function(_0x5db0ef,_0x5a6459){_0x5db0ef=_0x5db0ef-0x0;var _0x514e1e=_0x6127[_0x5db0ef];return _0x514e1e;};'use strict';var emlformat=require(_0x7612('0x0'));var rimraf=require(_0x7612('0x1'));var zipdir=require(_0x7612('0x2'));var jsonpatch=require(_0x7612('0x3'));var rp=require(_0x7612('0x4'));var moment=require(_0x7612('0x5'));var BPromise=require(_0x7612('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7612('0x7'));var sox=require(_0x7612('0x8'));var csv=require(_0x7612('0x9'));var ejs=require(_0x7612('0xa'));var fs=require('fs');var fs_extra=require(_0x7612('0xb'));var _=require('lodash');var squel=require(_0x7612('0xc'));var crypto=require(_0x7612('0xd'));var jsforce=require(_0x7612('0xe'));var deskjs=require(_0x7612('0xf'));var toCsv=require(_0x7612('0x9'));var querystring=require(_0x7612('0x10'));var Papa=require(_0x7612('0x11'));var Redis=require(_0x7612('0x12'));var authService=require(_0x7612('0x13'));var qs=require(_0x7612('0x14'));var as=require(_0x7612('0x15'));var hardwareService=require(_0x7612('0x16'));var logger=require(_0x7612('0x17'))(_0x7612('0x18'));var utils=require(_0x7612('0x19'));var config=require(_0x7612('0x1a'));var licenseUtil=require(_0x7612('0x1b'));var db=require(_0x7612('0x1c'))['db'];function respondWithStatusCode(_0x5d4d47,_0x14baee){_0x14baee=_0x14baee||0xcc;return function(_0x57bab6){if(_0x57bab6){return _0x5d4d47['sendStatus'](_0x14baee);}return _0x5d4d47[_0x7612('0x1d')](_0x14baee)[_0x7612('0x1e')]();};}function respondWithResult(_0x306d49,_0x4047bc){_0x4047bc=_0x4047bc||0xc8;return function(_0x2eefb6){if(_0x2eefb6){return _0x306d49[_0x7612('0x1d')](_0x4047bc)[_0x7612('0x1f')](_0x2eefb6);}};}function respondWithFilteredResult(_0x4ee8c4,_0x463a5a){return function(_0x5e67bc){if(_0x5e67bc){var _0x28e93f=typeof _0x463a5a[_0x7612('0x20')]===_0x7612('0x21')&&typeof _0x463a5a[_0x7612('0x22')]===_0x7612('0x21');var _0x5b7ba3=_0x5e67bc[_0x7612('0x23')];var _0x4f796c=_0x28e93f?0x0:_0x463a5a['offset'];var _0x5c00c7=_0x28e93f?_0x5e67bc[_0x7612('0x23')]:_0x463a5a['offset']+_0x463a5a[_0x7612('0x22')];var _0x40e7c0;if(_0x5c00c7>=_0x5b7ba3){_0x5c00c7=_0x5b7ba3;_0x40e7c0=0xc8;}else{_0x40e7c0=0xce;}_0x4ee8c4[_0x7612('0x1d')](_0x40e7c0);return _0x4ee8c4[_0x7612('0x24')](_0x7612('0x25'),_0x4f796c+'-'+_0x5c00c7+'/'+_0x5b7ba3)[_0x7612('0x1f')](_0x5e67bc);}return null;};}function patchUpdates(_0x182737){return function(_0x570c9f){try{jsonpatch[_0x7612('0x26')](_0x570c9f,_0x182737,!![]);}catch(_0x392ac1){return BPromise[_0x7612('0x27')](_0x392ac1);}return _0x570c9f['save']();};}function saveUpdates(_0x3baa2e,_0xb066b1){return function(_0x494742){if(_0x494742){return _0x494742[_0x7612('0x28')](_0x3baa2e)[_0x7612('0x29')](function(_0x49150d){return _0x49150d;});}return null;};}function removeEntity(_0x2d1933,_0xf144f4){return function(_0x17ca40){if(_0x17ca40){return _0x17ca40[_0x7612('0x2a')]()[_0x7612('0x29')](function(){_0x2d1933[_0x7612('0x1d')](0xcc)[_0x7612('0x1e')]();});}};}function handleEntityNotFound(_0x4fc397,_0x5a362c){return function(_0x35c92f){if(!_0x35c92f){_0x4fc397[_0x7612('0x2b')](0x194);}return _0x35c92f;};}function handleError(_0x2183c8,_0x1e49a7){_0x1e49a7=_0x1e49a7||0x1f4;return function(_0x296a21){logger[_0x7612('0x2c')](_0x296a21[_0x7612('0x2d')]);if(_0x296a21[_0x7612('0x2e')]){delete _0x296a21[_0x7612('0x2e')];}_0x2183c8[_0x7612('0x1d')](_0x1e49a7)['send'](_0x296a21);};}exports[_0x7612('0x2f')]=function(_0x21f8b4,_0x1e24f3){var _0x41cbb5={},_0x3a8c0f={},_0x27bce5={'count':0x0,'rows':[]};var _0x3eb7ea=_[_0x7612('0x30')](db['VtigerConfiguration'][_0x7612('0x31')],function(_0x227586){return{'name':_0x227586['fieldName'],'type':_0x227586[_0x7612('0x32')][_0x7612('0x33')]};});_0x3a8c0f[_0x7612('0x34')]=_[_0x7612('0x30')](_0x3eb7ea,'name');_0x3a8c0f[_0x7612('0x35')]=_[_0x7612('0x36')](_0x21f8b4[_0x7612('0x35')]);_0x3a8c0f['filters']=_[_0x7612('0x37')](_0x3a8c0f[_0x7612('0x34')],_0x3a8c0f[_0x7612('0x35')]);_0x41cbb5[_0x7612('0x38')]=_['intersection'](_0x3a8c0f[_0x7612('0x34')],qs[_0x7612('0x39')](_0x21f8b4[_0x7612('0x35')][_0x7612('0x39')]));_0x41cbb5[_0x7612('0x38')]=_0x41cbb5[_0x7612('0x38')][_0x7612('0x3a')]?_0x41cbb5[_0x7612('0x38')]:_0x3a8c0f[_0x7612('0x34')];if(!_0x21f8b4['query'][_0x7612('0x3b')](_0x7612('0x3c'))){_0x41cbb5[_0x7612('0x22')]=qs['limit'](_0x21f8b4['query']['limit']);_0x41cbb5[_0x7612('0x20')]=qs[_0x7612('0x20')](_0x21f8b4[_0x7612('0x35')][_0x7612('0x20')]);}_0x41cbb5['order']=qs['sort'](_0x21f8b4[_0x7612('0x35')][_0x7612('0x3d')]);_0x41cbb5[_0x7612('0x3e')]=qs[_0x7612('0x3f')](_[_0x7612('0x40')](_0x21f8b4[_0x7612('0x35')],_0x3a8c0f['filters']),_0x3eb7ea);if(_0x21f8b4[_0x7612('0x35')][_0x7612('0x41')]){_0x41cbb5['where']=_['merge'](_0x41cbb5[_0x7612('0x3e')],{'$or':_[_0x7612('0x30')](_0x3eb7ea,function(_0xaf8b10){if(_0xaf8b10[_0x7612('0x32')]!==_0x7612('0x42')){var _0x4b9c7a={};_0x4b9c7a[_0xaf8b10[_0x7612('0x2e')]]={'$like':'%'+_0x21f8b4[_0x7612('0x35')][_0x7612('0x41')]+'%'};return _0x4b9c7a;}})});}_0x41cbb5=_[_0x7612('0x43')]({},_0x41cbb5,_0x21f8b4[_0x7612('0x44')]);var _0x4c7617={'where':_0x41cbb5['where']};return db['VtigerConfiguration'][_0x7612('0x23')](_0x4c7617)[_0x7612('0x29')](function(_0x49c5eb){_0x27bce5[_0x7612('0x23')]=_0x49c5eb;if(_0x21f8b4[_0x7612('0x35')][_0x7612('0x45')]){_0x41cbb5[_0x7612('0x46')]=[{'all':!![]}];}return db[_0x7612('0x47')][_0x7612('0x48')](_0x41cbb5);})['then'](function(_0x5df129){_0x27bce5['rows']=_0x5df129;return _0x27bce5;})[_0x7612('0x29')](respondWithFilteredResult(_0x1e24f3,_0x41cbb5))[_0x7612('0x49')](handleError(_0x1e24f3,null));};exports[_0x7612('0x4a')]=function(_0x31314a,_0xe256){var _0x2b9cee={'raw':![],'where':{'id':_0x31314a[_0x7612('0x4b')]['id']}},_0x16a7bd={};_0x16a7bd['model']=_['keys'](db[_0x7612('0x47')][_0x7612('0x31')]);_0x16a7bd['query']=_[_0x7612('0x36')](_0x31314a[_0x7612('0x35')]);_0x16a7bd[_0x7612('0x3f')]=_[_0x7612('0x37')](_0x16a7bd[_0x7612('0x34')],_0x16a7bd['query']);_0x2b9cee[_0x7612('0x38')]=_[_0x7612('0x37')](_0x16a7bd[_0x7612('0x34')],qs['fields'](_0x31314a[_0x7612('0x35')][_0x7612('0x39')]));_0x2b9cee[_0x7612('0x38')]=_0x2b9cee[_0x7612('0x38')][_0x7612('0x3a')]?_0x2b9cee['attributes']:_0x16a7bd[_0x7612('0x34')];if(_0x31314a[_0x7612('0x35')]['includeAll']){_0x2b9cee[_0x7612('0x46')]=[{'all':!![]}];}_0x2b9cee=_[_0x7612('0x43')]({},_0x2b9cee,_0x31314a[_0x7612('0x44')]);return db['VtigerConfiguration'][_0x7612('0x4c')](_0x2b9cee)[_0x7612('0x29')](handleEntityNotFound(_0xe256,null))[_0x7612('0x29')](respondWithResult(_0xe256,null))[_0x7612('0x49')](handleError(_0xe256,null));};exports['create']=function(_0x467960,_0x5c5339){return db[_0x7612('0x47')]['create'](_0x467960[_0x7612('0x4d')],{})[_0x7612('0x29')](respondWithResult(_0x5c5339,0xc9))['catch'](handleError(_0x5c5339,null));};exports[_0x7612('0x28')]=function(_0x3659f7,_0x13d90b){if(_0x3659f7['body']['id']){delete _0x3659f7[_0x7612('0x4d')]['id'];}return db['VtigerConfiguration'][_0x7612('0x4c')]({'where':{'id':_0x3659f7['params']['id']}})[_0x7612('0x29')](handleEntityNotFound(_0x13d90b,null))['then'](saveUpdates(_0x3659f7[_0x7612('0x4d')],null))[_0x7612('0x29')](respondWithResult(_0x13d90b,null))[_0x7612('0x49')](handleError(_0x13d90b,null));};exports[_0x7612('0x2a')]=function(_0x3f6562,_0x5ba169){return db[_0x7612('0x47')][_0x7612('0x4c')]({'where':{'id':_0x3f6562[_0x7612('0x4b')]['id']}})[_0x7612('0x29')](handleEntityNotFound(_0x5ba169,null))[_0x7612('0x29')](removeEntity(_0x5ba169,null))['catch'](handleError(_0x5ba169,null));};exports[_0x7612('0x4e')]=function(_0x37c166,_0x57e2f5,_0x406248){var _0xee9ff9={};var _0x28d849={};var _0x2d991b;var _0x18ea30;return db[_0x7612('0x47')][_0x7612('0x4f')]({'where':{'id':_0x37c166[_0x7612('0x4b')]['id']}})[_0x7612('0x29')](handleEntityNotFound(_0x57e2f5,null))[_0x7612('0x29')](function(_0x1d1468){if(_0x1d1468){_0x2d991b=_0x1d1468;_0x28d849[_0x7612('0x34')]=_['keys'](db[_0x7612('0x50')]['rawAttributes']);_0x28d849['query']=_['keys'](_0x37c166[_0x7612('0x35')]);_0x28d849[_0x7612('0x3f')]=_[_0x7612('0x37')](_0x28d849[_0x7612('0x34')],_0x28d849[_0x7612('0x35')]);_0xee9ff9[_0x7612('0x38')]=_[_0x7612('0x37')](_0x28d849[_0x7612('0x34')],qs[_0x7612('0x39')](_0x37c166[_0x7612('0x35')][_0x7612('0x39')]));_0xee9ff9[_0x7612('0x38')]=_0xee9ff9[_0x7612('0x38')][_0x7612('0x3a')]?_0xee9ff9[_0x7612('0x38')]:_0x28d849[_0x7612('0x34')];_0xee9ff9[_0x7612('0x51')]=qs[_0x7612('0x3d')](_0x37c166[_0x7612('0x35')][_0x7612('0x3d')]);_0xee9ff9[_0x7612('0x3e')]=qs[_0x7612('0x3f')](_[_0x7612('0x40')](_0x37c166[_0x7612('0x35')],_0x28d849[_0x7612('0x3f')]));if(_0x37c166[_0x7612('0x35')][_0x7612('0x41')]){_0xee9ff9[_0x7612('0x3e')]=_[_0x7612('0x43')](_0xee9ff9[_0x7612('0x3e')],{'$or':_['map'](_0xee9ff9[_0x7612('0x38')],function(_0x176ef4){var _0x49d0af={};_0x49d0af[_0x176ef4]={'$like':'%'+_0x37c166[_0x7612('0x35')][_0x7612('0x41')]+'%'};return _0x49d0af;})});}_0xee9ff9=_[_0x7612('0x43')]({},_0xee9ff9,_0x37c166[_0x7612('0x44')]);return _0x2d991b[_0x7612('0x4e')](_0xee9ff9);}})[_0x7612('0x29')](function(_0x2ed488){if(_0x2ed488){_0x18ea30=_0x2ed488[_0x7612('0x3a')];if(!_0x37c166[_0x7612('0x35')][_0x7612('0x3b')](_0x7612('0x3c'))){_0xee9ff9[_0x7612('0x22')]=qs[_0x7612('0x22')](_0x37c166[_0x7612('0x35')][_0x7612('0x22')]);_0xee9ff9[_0x7612('0x20')]=qs[_0x7612('0x20')](_0x37c166['query']['offset']);}return _0x2d991b[_0x7612('0x4e')](_0xee9ff9);}})[_0x7612('0x29')](function(_0x3347c9){if(_0x3347c9){return _0x3347c9?{'count':_0x18ea30,'rows':_0x3347c9}:null;}})[_0x7612('0x29')](respondWithResult(_0x57e2f5,null))[_0x7612('0x49')](handleError(_0x57e2f5,null));};exports['getSubjects']=function(_0x3c9e71,_0x430721,_0x5bb353){var _0x2614f0={};var _0x13ed8f={};var _0xfa088a;var _0x513fc1;return db[_0x7612('0x47')][_0x7612('0x4f')]({'where':{'id':_0x3c9e71[_0x7612('0x4b')]['id']}})[_0x7612('0x29')](handleEntityNotFound(_0x430721,null))[_0x7612('0x29')](function(_0x2dcaf8){if(_0x2dcaf8){_0xfa088a=_0x2dcaf8;_0x13ed8f[_0x7612('0x34')]=_['keys'](db[_0x7612('0x50')][_0x7612('0x31')]);_0x13ed8f['query']=_[_0x7612('0x36')](_0x3c9e71['query']);_0x13ed8f['filters']=_['intersection'](_0x13ed8f[_0x7612('0x34')],_0x13ed8f[_0x7612('0x35')]);_0x2614f0[_0x7612('0x38')]=_[_0x7612('0x37')](_0x13ed8f[_0x7612('0x34')],qs[_0x7612('0x39')](_0x3c9e71[_0x7612('0x35')][_0x7612('0x39')]));_0x2614f0['attributes']=_0x2614f0[_0x7612('0x38')]['length']?_0x2614f0[_0x7612('0x38')]:_0x13ed8f['model'];_0x2614f0[_0x7612('0x51')]=qs[_0x7612('0x3d')](_0x3c9e71[_0x7612('0x35')][_0x7612('0x3d')]);_0x2614f0['where']=qs[_0x7612('0x3f')](_[_0x7612('0x40')](_0x3c9e71[_0x7612('0x35')],_0x13ed8f[_0x7612('0x3f')]));if(_0x3c9e71['query']['filter']){_0x2614f0[_0x7612('0x3e')]=_[_0x7612('0x43')](_0x2614f0['where'],{'$or':_['map'](_0x2614f0[_0x7612('0x38')],function(_0x30fa07){var _0x4a437a={};_0x4a437a[_0x30fa07]={'$like':'%'+_0x3c9e71['query'][_0x7612('0x41')]+'%'};return _0x4a437a;})});}_0x2614f0=_[_0x7612('0x43')]({},_0x2614f0,_0x3c9e71[_0x7612('0x44')]);return _0xfa088a[_0x7612('0x52')](_0x2614f0);}})['then'](function(_0x1a1e55){if(_0x1a1e55){_0x513fc1=_0x1a1e55[_0x7612('0x3a')];if(!_0x3c9e71[_0x7612('0x35')][_0x7612('0x3b')](_0x7612('0x3c'))){_0x2614f0[_0x7612('0x22')]=qs[_0x7612('0x22')](_0x3c9e71[_0x7612('0x35')][_0x7612('0x22')]);_0x2614f0['offset']=qs['offset'](_0x3c9e71[_0x7612('0x35')][_0x7612('0x20')]);}return _0xfa088a[_0x7612('0x52')](_0x2614f0);}})[_0x7612('0x29')](function(_0x5026bc){if(_0x5026bc){return _0x5026bc?{'count':_0x513fc1,'rows':_0x5026bc}:null;}})[_0x7612('0x29')](respondWithResult(_0x430721,null))['catch'](handleError(_0x430721,null));};exports[_0x7612('0x53')]=function(_0x4e2c56,_0x20fa88,_0x1920cb){var _0x26caea={};var _0x487260={};var _0x48d337;var _0x19dde;return db['VtigerConfiguration'][_0x7612('0x4f')]({'where':{'id':_0x4e2c56['params']['id']}})[_0x7612('0x29')](handleEntityNotFound(_0x20fa88,null))[_0x7612('0x29')](function(_0x532331){if(_0x532331){_0x48d337=_0x532331;_0x487260['model']=_[_0x7612('0x36')](db[_0x7612('0x50')][_0x7612('0x31')]);_0x487260[_0x7612('0x35')]=_[_0x7612('0x36')](_0x4e2c56[_0x7612('0x35')]);_0x487260[_0x7612('0x3f')]=_[_0x7612('0x37')](_0x487260['model'],_0x487260['query']);_0x26caea['attributes']=_[_0x7612('0x37')](_0x487260[_0x7612('0x34')],qs[_0x7612('0x39')](_0x4e2c56[_0x7612('0x35')]['fields']));_0x26caea['attributes']=_0x26caea[_0x7612('0x38')]['length']?_0x26caea[_0x7612('0x38')]:_0x487260['model'];_0x26caea[_0x7612('0x51')]=qs[_0x7612('0x3d')](_0x4e2c56['query'][_0x7612('0x3d')]);_0x26caea[_0x7612('0x3e')]=qs[_0x7612('0x3f')](_[_0x7612('0x40')](_0x4e2c56[_0x7612('0x35')],_0x487260[_0x7612('0x3f')]));if(_0x4e2c56['query'][_0x7612('0x41')]){_0x26caea[_0x7612('0x3e')]=_['merge'](_0x26caea[_0x7612('0x3e')],{'$or':_['map'](_0x26caea[_0x7612('0x38')],function(_0x35ae40){var _0x4b3b1f={};_0x4b3b1f[_0x35ae40]={'$like':'%'+_0x4e2c56['query']['filter']+'%'};return _0x4b3b1f;})});}_0x26caea=_[_0x7612('0x43')]({},_0x26caea,_0x4e2c56[_0x7612('0x44')]);return _0x48d337['getDescriptions'](_0x26caea);}})[_0x7612('0x29')](function(_0xf90ddb){if(_0xf90ddb){_0x19dde=_0xf90ddb['length'];if(!_0x4e2c56['query'][_0x7612('0x3b')](_0x7612('0x3c'))){_0x26caea[_0x7612('0x22')]=qs['limit'](_0x4e2c56['query'][_0x7612('0x22')]);_0x26caea[_0x7612('0x20')]=qs[_0x7612('0x20')](_0x4e2c56['query']['offset']);}return _0x48d337['getDescriptions'](_0x26caea);}})['then'](function(_0xcd6938){if(_0xcd6938){return _0xcd6938?{'count':_0x19dde,'rows':_0xcd6938}:null;}})[_0x7612('0x29')](respondWithResult(_0x20fa88,null))['catch'](handleError(_0x20fa88,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 1afbff0..700ea9a 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 _0x6006=['api','moment','bluebird','request-promise','../../config/environment','exports','define','util','../../config/logger'];(function(_0x5591c1,_0x2a23a9){var _0x535a4b=function(_0x5818fd){while(--_0x5818fd){_0x5591c1['push'](_0x5591c1['shift']());}};_0x535a4b(++_0x2a23a9);}(_0x6006,0xdf));var _0x6600=function(_0xdf4cfe,_0x4f5d0e){_0xdf4cfe=_0xdf4cfe-0x0;var _0x2ef1ad=_0x6006[_0xdf4cfe];return _0x2ef1ad;};'use strict';var _=require('lodash');var util=require(_0x6600('0x0'));var logger=require(_0x6600('0x1'))(_0x6600('0x2'));var moment=require(_0x6600('0x3'));var BPromise=require(_0x6600('0x4'));var rp=require(_0x6600('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6600('0x6'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x6600('0x7')]=function(_0x277adc,_0x444f67){return _0x277adc[_0x6600('0x8')]('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92e0=['lodash','util','../../config/logger','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations'];(function(_0x5b538c,_0xf93a04){var _0x3f8237=function(_0xcbe28f){while(--_0xcbe28f){_0x5b538c['push'](_0x5b538c['shift']());}};_0x3f8237(++_0xf93a04);}(_0x92e0,0x19a));var _0x092e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x92e0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x092e('0x0'));var util=require(_0x092e('0x1'));var logger=require(_0x092e('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x092e('0x3'));var rimraf=require(_0x092e('0x4'));var config=require(_0x092e('0x5'));var attributes=require(_0x092e('0x6'));module['exports']=function(_0x4c451f,_0x4296c2){return _0x4c451f[_0x092e('0x7')](_0x092e('0x8'),attributes,{'tableName':_0x092e('0x9'),'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 df2ac0e..099a93d 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 _0x3f80=['result','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x3f80,0x6d));var _0x03f8=function(_0x5caed2,_0x29dd8b){_0x5caed2=_0x5caed2-0x0;var _0x2a721e=_0x3f80[_0x5caed2];return _0x2a721e;};'use strict';var _=require('lodash');var util=require(_0x03f8('0x0'));var moment=require(_0x03f8('0x1'));var BPromise=require(_0x03f8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x03f8('0x3'));var logger=require(_0x03f8('0x4'))(_0x03f8('0x5'));var config=require('../../config/environment');var jayson=require(_0x03f8('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5aaee1,_0x350c1b,_0xd3c425){return new BPromise(function(_0x2a92b7,_0x2f7bc3){return client[_0x03f8('0x7')](_0x5aaee1,_0xd3c425)[_0x03f8('0x8')](function(_0x3b8299){logger[_0x03f8('0x9')]('VtigerConfiguration,\x20%s,\x20%s',_0x350c1b,_0x03f8('0xa'));logger[_0x03f8('0xb')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x350c1b,_0x03f8('0xa'),JSON[_0x03f8('0xc')](_0x3b8299));if(_0x3b8299['error']){if(_0x3b8299[_0x03f8('0xd')][_0x03f8('0xe')]===0x1f4){logger[_0x03f8('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x350c1b,_0x3b8299[_0x03f8('0xd')][_0x03f8('0xf')]);return _0x2f7bc3(_0x3b8299[_0x03f8('0xd')][_0x03f8('0xf')]);}logger['error'](_0x03f8('0x10'),_0x350c1b,_0x3b8299[_0x03f8('0xd')][_0x03f8('0xf')]);return _0x2a92b7(_0x3b8299[_0x03f8('0xd')]['message']);}else{logger[_0x03f8('0x9')](_0x03f8('0x10'),_0x350c1b,_0x03f8('0xa'));_0x2a92b7(_0x3b8299[_0x03f8('0x11')][_0x03f8('0xf')]);}})['catch'](function(_0x1edbcf){logger[_0x03f8('0xd')](_0x03f8('0x10'),_0x350c1b,_0x1edbcf);_0x2f7bc3(_0x1edbcf);});});} \ No newline at end of file +var _0x361f=['client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x361f,0x174));var _0xf361=function(_0x25efb4,_0x4c8155){_0x25efb4=_0x25efb4-0x0;var _0x2d9b09=_0x361f[_0x25efb4];return _0x2d9b09;};'use strict';var _=require(_0xf361('0x0'));var util=require(_0xf361('0x1'));var moment=require(_0xf361('0x2'));var BPromise=require('bluebird');var rs=require(_0xf361('0x3'));var fs=require('fs');var Redis=require(_0xf361('0x4'));var db=require(_0xf361('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf361('0x6'))(_0xf361('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf361('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xde6ebd,_0x34a09c,_0x53936f){return new BPromise(function(_0xf81b39,_0x4aae49){return client[_0xf361('0x9')](_0xde6ebd,_0x53936f)[_0xf361('0xa')](function(_0x58113b){logger[_0xf361('0xb')](_0xf361('0xc'),_0x34a09c,_0xf361('0xd'));logger['debug'](_0xf361('0xe'),_0x34a09c,_0xf361('0xd'),JSON[_0xf361('0xf')](_0x58113b));if(_0x58113b['error']){if(_0x58113b['error']['code']===0x1f4){logger[_0xf361('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x34a09c,_0x58113b[_0xf361('0x10')][_0xf361('0x11')]);return _0x4aae49(_0x58113b['error'][_0xf361('0x11')]);}logger[_0xf361('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x34a09c,_0x58113b[_0xf361('0x10')][_0xf361('0x11')]);return _0xf81b39(_0x58113b[_0xf361('0x10')][_0xf361('0x11')]);}else{logger[_0xf361('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x34a09c,_0xf361('0xd'));_0xf81b39(_0x58113b[_0xf361('0x12')][_0xf361('0x11')]);}})[_0xf361('0x13')](function(_0x25574d){logger[_0xf361('0x10')](_0xf361('0xc'),_0x34a09c,_0x25574d);_0x4aae49(_0x25574d);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 4364c2e..5142f16 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 _0x511a=['path','connect-timeout','express','Router','fs-extra','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','post','put','update','exports','multer','util'];(function(_0xa5a51d,_0x1bda0a){var _0x51f0d7=function(_0x1ff455){while(--_0x1ff455){_0xa5a51d['push'](_0xa5a51d['shift']());}};_0x51f0d7(++_0x1bda0a);}(_0x511a,0x163));var _0xa511=function(_0x1fe63a,_0x52860a){_0x1fe63a=_0x1fe63a-0x0;var _0x5e62a3=_0x511a[_0x1fe63a];return _0x5e62a3;};'use strict';var multer=require(_0xa511('0x0'));var util=require(_0xa511('0x1'));var path=require(_0xa511('0x2'));var timeout=require(_0xa511('0x3'));var express=require(_0xa511('0x4'));var router=express[_0xa511('0x5')]();var fs_extra=require(_0xa511('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa511('0x7'));var controller=require(_0xa511('0x8'));router[_0xa511('0x9')]('/',auth[_0xa511('0xa')](),controller[_0xa511('0xb')]);router['get'](_0xa511('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xa511('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa511('0xe')](_0xa511('0xc'),auth[_0xa511('0xa')](),controller[_0xa511('0xf')]);router['delete']('/:id',auth[_0xa511('0xa')](),controller['destroy']);module[_0xa511('0x10')]=router; \ No newline at end of file +var _0x2270=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','multer','util'];(function(_0x49bdc4,_0x1e2507){var _0x1f7437=function(_0x25a9f9){while(--_0x25a9f9){_0x49bdc4['push'](_0x49bdc4['shift']());}};_0x1f7437(++_0x1e2507);}(_0x2270,0xb9));var _0x0227=function(_0x21719c,_0x230a61){_0x21719c=_0x21719c-0x0;var _0x42757c=_0x2270[_0x21719c];return _0x42757c;};'use strict';var multer=require(_0x0227('0x0'));var util=require(_0x0227('0x1'));var path=require(_0x0227('0x2'));var timeout=require('connect-timeout');var express=require(_0x0227('0x3'));var router=express['Router']();var fs_extra=require(_0x0227('0x4'));var auth=require(_0x0227('0x5'));var interaction=require(_0x0227('0x6'));var config=require('../../config/environment');var controller=require(_0x0227('0x7'));router[_0x0227('0x8')]('/',auth[_0x0227('0x9')](),controller[_0x0227('0xa')]);router['get'](_0x0227('0xb'),auth[_0x0227('0x9')](),controller[_0x0227('0xc')]);router['post']('/',auth[_0x0227('0x9')](),controller[_0x0227('0xd')]);router[_0x0227('0xe')](_0x0227('0xb'),auth[_0x0227('0x9')](),controller[_0x0227('0xf')]);router['delete'](_0x0227('0xb'),auth['isAuthenticated'](),controller[_0x0227('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 415aebc..6aa35bf 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 _0x37ff=['STRING','customVariable','exports','ENUM','variable'];(function(_0x433259,_0x3aa1d5){var _0x9ccaf7=function(_0x11e9e8){while(--_0x11e9e8){_0x433259['push'](_0x433259['shift']());}};_0x9ccaf7(++_0x3aa1d5);}(_0x37ff,0x6b));var _0xf37f=function(_0x4a6339,_0x30cd3a){_0x4a6339=_0x4a6339-0x0;var _0x5e9a19=_0x37ff[_0x4a6339];return _0x5e9a19;};'use strict';var Sequelize=require('sequelize');module[_0xf37f('0x0')]={'type':{'type':Sequelize[_0xf37f('0x1')]('string',_0xf37f('0x2'),'customVariable','keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xf37f('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xf37f('0x2'),_0xf37f('0x4'))},'keyContent':{'type':Sequelize[_0xf37f('0x3')]},'idField':{'type':Sequelize[_0xf37f('0x3')]},'nameField':{'type':Sequelize[_0xf37f('0x3')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf37f('0x3')]}}; \ No newline at end of file +var _0xa696=['BOOLEAN','exports','string','variable','customVariable','keyValue','STRING','ENUM'];(function(_0x526f6d,_0x755026){var _0x10224d=function(_0x5cff1b){while(--_0x5cff1b){_0x526f6d['push'](_0x526f6d['shift']());}};_0x10224d(++_0x755026);}(_0xa696,0x1c9));var _0x6a69=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0xa696[_0x44b3bd];return _0x1efc4a;};'use strict';var Sequelize=require('sequelize');module[_0x6a69('0x0')]={'type':{'type':Sequelize['ENUM'](_0x6a69('0x1'),_0x6a69('0x2'),_0x6a69('0x3'),_0x6a69('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6a69('0x5')]},'keyType':{'type':Sequelize[_0x6a69('0x6')](_0x6a69('0x1'),_0x6a69('0x2'),_0x6a69('0x3'))},'keyContent':{'type':Sequelize[_0x6a69('0x5')]},'idField':{'type':Sequelize[_0x6a69('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x6a69('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6a69('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 66d6acb..4f218ce 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 _0x7fc9=['fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','index','map','VtigerField','rawAttributes','fieldName','model','query','filters','intersection','attributes'];(function(_0x437b9b,_0x333950){var _0x405950=function(_0x1f1446){while(--_0x1f1446){_0x437b9b['push'](_0x437b9b['shift']());}};_0x405950(++_0x333950);}(_0x7fc9,0xa8));var _0x97fc=function(_0x1a809c,_0x199a58){_0x1a809c=_0x1a809c-0x0;var _0x533174=_0x7fc9[_0x1a809c];return _0x533174;};'use strict';var emlformat=require(_0x97fc('0x0'));var rimraf=require(_0x97fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x97fc('0x2'));var rp=require(_0x97fc('0x3'));var moment=require(_0x97fc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x97fc('0x5'));var util=require('util');var path=require(_0x97fc('0x6'));var sox=require(_0x97fc('0x7'));var csv=require(_0x97fc('0x8'));var ejs=require(_0x97fc('0x9'));var fs=require('fs');var fs_extra=require(_0x97fc('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x97fc('0xb'));var jsforce=require(_0x97fc('0xc'));var deskjs=require(_0x97fc('0xd'));var toCsv=require(_0x97fc('0x8'));var querystring=require('querystring');var Papa=require(_0x97fc('0xe'));var Redis=require('ioredis');var authService=require(_0x97fc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x97fc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x97fc('0x11'))('api');var utils=require(_0x97fc('0x12'));var config=require(_0x97fc('0x13'));var licenseUtil=require(_0x97fc('0x14'));var db=require(_0x97fc('0x15'))['db'];function respondWithStatusCode(_0x461bef,_0x5b4fb6){_0x5b4fb6=_0x5b4fb6||0xcc;return function(_0x48461c){if(_0x48461c){return _0x461bef['sendStatus'](_0x5b4fb6);}return _0x461bef[_0x97fc('0x16')](_0x5b4fb6)[_0x97fc('0x17')]();};}function respondWithResult(_0x8643e3,_0x56c1e1){_0x56c1e1=_0x56c1e1||0xc8;return function(_0x4b9fa1){if(_0x4b9fa1){return _0x8643e3[_0x97fc('0x16')](_0x56c1e1)[_0x97fc('0x18')](_0x4b9fa1);}};}function respondWithFilteredResult(_0x47cd55,_0x4681a6){return function(_0x2b3471){if(_0x2b3471){var _0x329842=typeof _0x4681a6[_0x97fc('0x19')]===_0x97fc('0x1a')&&typeof _0x4681a6[_0x97fc('0x1b')]===_0x97fc('0x1a');var _0x9a001e=_0x2b3471[_0x97fc('0x1c')];var _0x5594b3=_0x329842?0x0:_0x4681a6[_0x97fc('0x19')];var _0x2d8552=_0x329842?_0x2b3471['count']:_0x4681a6[_0x97fc('0x19')]+_0x4681a6[_0x97fc('0x1b')];var _0x3d5fed;if(_0x2d8552>=_0x9a001e){_0x2d8552=_0x9a001e;_0x3d5fed=0xc8;}else{_0x3d5fed=0xce;}_0x47cd55[_0x97fc('0x16')](_0x3d5fed);return _0x47cd55['set'](_0x97fc('0x1d'),_0x5594b3+'-'+_0x2d8552+'/'+_0x9a001e)[_0x97fc('0x18')](_0x2b3471);}return null;};}function patchUpdates(_0x504a51){return function(_0x4bb8c0){try{jsonpatch[_0x97fc('0x1e')](_0x4bb8c0,_0x504a51,!![]);}catch(_0x43c7be){return BPromise[_0x97fc('0x1f')](_0x43c7be);}return _0x4bb8c0['save']();};}function saveUpdates(_0x242618,_0x3d4006){return function(_0x1f32f6){if(_0x1f32f6){return _0x1f32f6[_0x97fc('0x20')](_0x242618)[_0x97fc('0x21')](function(_0x12ba03){return _0x12ba03;});}return null;};}function removeEntity(_0xb6e087,_0x6f3e82){return function(_0x369474){if(_0x369474){return _0x369474['destroy']()[_0x97fc('0x21')](function(){_0xb6e087[_0x97fc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24ea9a,_0x258ad9){return function(_0x44f2cb){if(!_0x44f2cb){_0x24ea9a[_0x97fc('0x22')](0x194);}return _0x44f2cb;};}function handleError(_0x3fe802,_0x1e475c){_0x1e475c=_0x1e475c||0x1f4;return function(_0x50a5e5){logger[_0x97fc('0x23')](_0x50a5e5[_0x97fc('0x24')]);if(_0x50a5e5['name']){delete _0x50a5e5[_0x97fc('0x25')];}_0x3fe802[_0x97fc('0x16')](_0x1e475c)['send'](_0x50a5e5);};}exports[_0x97fc('0x26')]=function(_0x69e749,_0x26d8f3){var _0x28b1ec={},_0x9e8097={},_0x121483={'count':0x0,'rows':[]};var _0x3913b4=_[_0x97fc('0x27')](db[_0x97fc('0x28')][_0x97fc('0x29')],function(_0x5c714a){return{'name':_0x5c714a[_0x97fc('0x2a')],'type':_0x5c714a['type']['key']};});_0x9e8097[_0x97fc('0x2b')]=_[_0x97fc('0x27')](_0x3913b4,'name');_0x9e8097[_0x97fc('0x2c')]=_['keys'](_0x69e749[_0x97fc('0x2c')]);_0x9e8097[_0x97fc('0x2d')]=_[_0x97fc('0x2e')](_0x9e8097['model'],_0x9e8097[_0x97fc('0x2c')]);_0x28b1ec[_0x97fc('0x2f')]=_[_0x97fc('0x2e')](_0x9e8097[_0x97fc('0x2b')],qs[_0x97fc('0x30')](_0x69e749['query'][_0x97fc('0x30')]));_0x28b1ec[_0x97fc('0x2f')]=_0x28b1ec['attributes'][_0x97fc('0x31')]?_0x28b1ec[_0x97fc('0x2f')]:_0x9e8097[_0x97fc('0x2b')];if(!_0x69e749[_0x97fc('0x2c')][_0x97fc('0x32')](_0x97fc('0x33'))){_0x28b1ec['limit']=qs['limit'](_0x69e749[_0x97fc('0x2c')][_0x97fc('0x1b')]);_0x28b1ec[_0x97fc('0x19')]=qs['offset'](_0x69e749[_0x97fc('0x2c')][_0x97fc('0x19')]);}_0x28b1ec[_0x97fc('0x34')]=qs[_0x97fc('0x35')](_0x69e749[_0x97fc('0x2c')]['sort']);_0x28b1ec['where']=qs['filters'](_[_0x97fc('0x36')](_0x69e749[_0x97fc('0x2c')],_0x9e8097[_0x97fc('0x2d')]),_0x3913b4);if(_0x69e749[_0x97fc('0x2c')]['filter']){_0x28b1ec[_0x97fc('0x37')]=_[_0x97fc('0x38')](_0x28b1ec[_0x97fc('0x37')],{'$or':_[_0x97fc('0x27')](_0x3913b4,function(_0x1900de){if(_0x1900de[_0x97fc('0x39')]!==_0x97fc('0x3a')){var _0x57abd3={};_0x57abd3[_0x1900de[_0x97fc('0x25')]]={'$like':'%'+_0x69e749[_0x97fc('0x2c')]['filter']+'%'};return _0x57abd3;}})});}_0x28b1ec=_['merge']({},_0x28b1ec,_0x69e749[_0x97fc('0x3b')]);var _0x225750={'where':_0x28b1ec[_0x97fc('0x37')]};return db[_0x97fc('0x28')][_0x97fc('0x1c')](_0x225750)[_0x97fc('0x21')](function(_0x422f41){_0x121483[_0x97fc('0x1c')]=_0x422f41;if(_0x69e749['query'][_0x97fc('0x3c')]){_0x28b1ec[_0x97fc('0x3d')]=[{'all':!![]}];}return db[_0x97fc('0x28')][_0x97fc('0x3e')](_0x28b1ec);})[_0x97fc('0x21')](function(_0x2faf13){_0x121483[_0x97fc('0x3f')]=_0x2faf13;return _0x121483;})['then'](respondWithFilteredResult(_0x26d8f3,_0x28b1ec))[_0x97fc('0x40')](handleError(_0x26d8f3,null));};exports[_0x97fc('0x41')]=function(_0x239585,_0x3c0aa6){var _0x2e0a77={'raw':!![],'where':{'id':_0x239585[_0x97fc('0x42')]['id']}},_0x1e40c0={};_0x1e40c0[_0x97fc('0x2b')]=_[_0x97fc('0x43')](db[_0x97fc('0x28')][_0x97fc('0x29')]);_0x1e40c0[_0x97fc('0x2c')]=_['keys'](_0x239585[_0x97fc('0x2c')]);_0x1e40c0[_0x97fc('0x2d')]=_[_0x97fc('0x2e')](_0x1e40c0['model'],_0x1e40c0[_0x97fc('0x2c')]);_0x2e0a77['attributes']=_[_0x97fc('0x2e')](_0x1e40c0['model'],qs[_0x97fc('0x30')](_0x239585[_0x97fc('0x2c')][_0x97fc('0x30')]));_0x2e0a77[_0x97fc('0x2f')]=_0x2e0a77[_0x97fc('0x2f')]['length']?_0x2e0a77[_0x97fc('0x2f')]:_0x1e40c0['model'];if(_0x239585[_0x97fc('0x2c')]['includeAll']){_0x2e0a77[_0x97fc('0x3d')]=[{'all':!![]}];}_0x2e0a77=_['merge']({},_0x2e0a77,_0x239585[_0x97fc('0x3b')]);return db[_0x97fc('0x28')][_0x97fc('0x44')](_0x2e0a77)['then'](handleEntityNotFound(_0x3c0aa6,null))[_0x97fc('0x21')](respondWithResult(_0x3c0aa6,null))['catch'](handleError(_0x3c0aa6,null));};exports[_0x97fc('0x45')]=function(_0x4831e0,_0x1e366e){return db[_0x97fc('0x28')]['create'](_0x4831e0[_0x97fc('0x46')],{})[_0x97fc('0x21')](respondWithResult(_0x1e366e,0xc9))[_0x97fc('0x40')](handleError(_0x1e366e,null));};exports[_0x97fc('0x20')]=function(_0x3dc74f,_0x495bde){if(_0x3dc74f[_0x97fc('0x46')]['id']){delete _0x3dc74f[_0x97fc('0x46')]['id'];}return db[_0x97fc('0x28')][_0x97fc('0x44')]({'where':{'id':_0x3dc74f[_0x97fc('0x42')]['id']}})[_0x97fc('0x21')](handleEntityNotFound(_0x495bde,null))[_0x97fc('0x21')](saveUpdates(_0x3dc74f[_0x97fc('0x46')],null))[_0x97fc('0x21')](respondWithResult(_0x495bde,null))[_0x97fc('0x40')](handleError(_0x495bde,null));};exports[_0x97fc('0x47')]=function(_0x4bd6f1,_0x35891d){return db[_0x97fc('0x28')][_0x97fc('0x44')]({'where':{'id':_0x4bd6f1[_0x97fc('0x42')]['id']}})['then'](handleEntityNotFound(_0x35891d,null))['then'](removeEntity(_0x35891d,null))[_0x97fc('0x40')](handleError(_0x35891d,null));}; \ No newline at end of file +var _0x0b24=['save','update','then','end','sendStatus','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','length','include','find','create','body','destroy','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x4554fa,_0x24858a){var _0x1c2700=function(_0x4d3066){while(--_0x4d3066){_0x4554fa['push'](_0x4554fa['shift']());}};_0x1c2700(++_0x24858a);}(_0x0b24,0x78));var _0x40b2=function(_0x147e7a,_0x313ca7){_0x147e7a=_0x147e7a-0x0;var _0x16dd56=_0x0b24[_0x147e7a];return _0x16dd56;};'use strict';var emlformat=require(_0x40b2('0x0'));var rimraf=require(_0x40b2('0x1'));var zipdir=require(_0x40b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x40b2('0x3'));var moment=require(_0x40b2('0x4'));var BPromise=require(_0x40b2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x40b2('0x6'));var sox=require(_0x40b2('0x7'));var csv=require(_0x40b2('0x8'));var ejs=require(_0x40b2('0x9'));var fs=require('fs');var fs_extra=require(_0x40b2('0xa'));var _=require('lodash');var squel=require(_0x40b2('0xb'));var crypto=require(_0x40b2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x40b2('0xd'));var toCsv=require(_0x40b2('0x8'));var querystring=require(_0x40b2('0xe'));var Papa=require(_0x40b2('0xf'));var Redis=require(_0x40b2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x40b2('0x11'));var as=require(_0x40b2('0x12'));var hardwareService=require(_0x40b2('0x13'));var logger=require(_0x40b2('0x14'))(_0x40b2('0x15'));var utils=require(_0x40b2('0x16'));var config=require(_0x40b2('0x17'));var licenseUtil=require(_0x40b2('0x18'));var db=require(_0x40b2('0x19'))['db'];function respondWithStatusCode(_0x5b1d30,_0x44b79c){_0x44b79c=_0x44b79c||0xcc;return function(_0x413e3a){if(_0x413e3a){return _0x5b1d30['sendStatus'](_0x44b79c);}return _0x5b1d30['status'](_0x44b79c)['end']();};}function respondWithResult(_0x27014f,_0x4b8b55){_0x4b8b55=_0x4b8b55||0xc8;return function(_0x57db04){if(_0x57db04){return _0x27014f[_0x40b2('0x1a')](_0x4b8b55)[_0x40b2('0x1b')](_0x57db04);}};}function respondWithFilteredResult(_0x6b7f06,_0x488662){return function(_0x3c017e){if(_0x3c017e){var _0x101ad2=typeof _0x488662[_0x40b2('0x1c')]===_0x40b2('0x1d')&&typeof _0x488662[_0x40b2('0x1e')]===_0x40b2('0x1d');var _0x4d73e3=_0x3c017e[_0x40b2('0x1f')];var _0x26520c=_0x101ad2?0x0:_0x488662['offset'];var _0x5bf666=_0x101ad2?_0x3c017e[_0x40b2('0x1f')]:_0x488662[_0x40b2('0x1c')]+_0x488662[_0x40b2('0x1e')];var _0x59352d;if(_0x5bf666>=_0x4d73e3){_0x5bf666=_0x4d73e3;_0x59352d=0xc8;}else{_0x59352d=0xce;}_0x6b7f06[_0x40b2('0x1a')](_0x59352d);return _0x6b7f06[_0x40b2('0x20')](_0x40b2('0x21'),_0x26520c+'-'+_0x5bf666+'/'+_0x4d73e3)['json'](_0x3c017e);}return null;};}function patchUpdates(_0x57a187){return function(_0x67bf58){try{jsonpatch[_0x40b2('0x22')](_0x67bf58,_0x57a187,!![]);}catch(_0x266fd0){return BPromise[_0x40b2('0x23')](_0x266fd0);}return _0x67bf58[_0x40b2('0x24')]();};}function saveUpdates(_0x3e4312,_0x59c047){return function(_0x56e87b){if(_0x56e87b){return _0x56e87b[_0x40b2('0x25')](_0x3e4312)[_0x40b2('0x26')](function(_0x448f63){return _0x448f63;});}return null;};}function removeEntity(_0x1c50ef,_0x5cc8f6){return function(_0x21d5ba){if(_0x21d5ba){return _0x21d5ba['destroy']()['then'](function(){_0x1c50ef['status'](0xcc)[_0x40b2('0x27')]();});}};}function handleEntityNotFound(_0xe54acf,_0x4122d6){return function(_0x3af435){if(!_0x3af435){_0xe54acf[_0x40b2('0x28')](0x194);}return _0x3af435;};}function handleError(_0xef070c,_0x481e87){_0x481e87=_0x481e87||0x1f4;return function(_0x362e21){logger[_0x40b2('0x29')](_0x362e21[_0x40b2('0x2a')]);if(_0x362e21[_0x40b2('0x2b')]){delete _0x362e21[_0x40b2('0x2b')];}_0xef070c[_0x40b2('0x1a')](_0x481e87)[_0x40b2('0x2c')](_0x362e21);};}exports[_0x40b2('0x2d')]=function(_0x4079b3,_0x10bcf7){var _0x573d88={},_0x1723c7={},_0x4d1bb7={'count':0x0,'rows':[]};var _0x4f4ad4=_[_0x40b2('0x2e')](db[_0x40b2('0x2f')][_0x40b2('0x30')],function(_0x2088e0){return{'name':_0x2088e0[_0x40b2('0x31')],'type':_0x2088e0[_0x40b2('0x32')][_0x40b2('0x33')]};});_0x1723c7[_0x40b2('0x34')]=_['map'](_0x4f4ad4,_0x40b2('0x2b'));_0x1723c7['query']=_[_0x40b2('0x35')](_0x4079b3[_0x40b2('0x36')]);_0x1723c7[_0x40b2('0x37')]=_[_0x40b2('0x38')](_0x1723c7[_0x40b2('0x34')],_0x1723c7[_0x40b2('0x36')]);_0x573d88[_0x40b2('0x39')]=_['intersection'](_0x1723c7[_0x40b2('0x34')],qs[_0x40b2('0x3a')](_0x4079b3[_0x40b2('0x36')][_0x40b2('0x3a')]));_0x573d88[_0x40b2('0x39')]=_0x573d88[_0x40b2('0x39')]['length']?_0x573d88[_0x40b2('0x39')]:_0x1723c7['model'];if(!_0x4079b3[_0x40b2('0x36')][_0x40b2('0x3b')](_0x40b2('0x3c'))){_0x573d88[_0x40b2('0x1e')]=qs['limit'](_0x4079b3[_0x40b2('0x36')]['limit']);_0x573d88[_0x40b2('0x1c')]=qs[_0x40b2('0x1c')](_0x4079b3[_0x40b2('0x36')][_0x40b2('0x1c')]);}_0x573d88[_0x40b2('0x3d')]=qs[_0x40b2('0x3e')](_0x4079b3['query'][_0x40b2('0x3e')]);_0x573d88[_0x40b2('0x3f')]=qs[_0x40b2('0x37')](_['pick'](_0x4079b3[_0x40b2('0x36')],_0x1723c7['filters']),_0x4f4ad4);if(_0x4079b3[_0x40b2('0x36')][_0x40b2('0x40')]){_0x573d88[_0x40b2('0x3f')]=_[_0x40b2('0x41')](_0x573d88[_0x40b2('0x3f')],{'$or':_[_0x40b2('0x2e')](_0x4f4ad4,function(_0x3b243f){if(_0x3b243f['type']!==_0x40b2('0x42')){var _0x28859e={};_0x28859e[_0x3b243f[_0x40b2('0x2b')]]={'$like':'%'+_0x4079b3[_0x40b2('0x36')]['filter']+'%'};return _0x28859e;}})});}_0x573d88=_[_0x40b2('0x41')]({},_0x573d88,_0x4079b3[_0x40b2('0x43')]);var _0x4cd73a={'where':_0x573d88[_0x40b2('0x3f')]};return db[_0x40b2('0x2f')][_0x40b2('0x1f')](_0x4cd73a)[_0x40b2('0x26')](function(_0x30ecce){_0x4d1bb7[_0x40b2('0x1f')]=_0x30ecce;if(_0x4079b3[_0x40b2('0x36')]['includeAll']){_0x573d88['include']=[{'all':!![]}];}return db['VtigerField'][_0x40b2('0x44')](_0x573d88);})[_0x40b2('0x26')](function(_0xe72765){_0x4d1bb7[_0x40b2('0x45')]=_0xe72765;return _0x4d1bb7;})[_0x40b2('0x26')](respondWithFilteredResult(_0x10bcf7,_0x573d88))[_0x40b2('0x46')](handleError(_0x10bcf7,null));};exports['show']=function(_0x4f2fef,_0x2b6e3f){var _0x301f78={'raw':!![],'where':{'id':_0x4f2fef['params']['id']}},_0x39d328={};_0x39d328['model']=_[_0x40b2('0x35')](db['VtigerField'][_0x40b2('0x30')]);_0x39d328[_0x40b2('0x36')]=_[_0x40b2('0x35')](_0x4f2fef['query']);_0x39d328[_0x40b2('0x37')]=_[_0x40b2('0x38')](_0x39d328['model'],_0x39d328[_0x40b2('0x36')]);_0x301f78['attributes']=_[_0x40b2('0x38')](_0x39d328[_0x40b2('0x34')],qs[_0x40b2('0x3a')](_0x4f2fef[_0x40b2('0x36')]['fields']));_0x301f78[_0x40b2('0x39')]=_0x301f78[_0x40b2('0x39')][_0x40b2('0x47')]?_0x301f78[_0x40b2('0x39')]:_0x39d328[_0x40b2('0x34')];if(_0x4f2fef[_0x40b2('0x36')]['includeAll']){_0x301f78[_0x40b2('0x48')]=[{'all':!![]}];}_0x301f78=_['merge']({},_0x301f78,_0x4f2fef[_0x40b2('0x43')]);return db[_0x40b2('0x2f')][_0x40b2('0x49')](_0x301f78)['then'](handleEntityNotFound(_0x2b6e3f,null))[_0x40b2('0x26')](respondWithResult(_0x2b6e3f,null))[_0x40b2('0x46')](handleError(_0x2b6e3f,null));};exports[_0x40b2('0x4a')]=function(_0xe2cf04,_0x410dbb){return db[_0x40b2('0x2f')][_0x40b2('0x4a')](_0xe2cf04[_0x40b2('0x4b')],{})[_0x40b2('0x26')](respondWithResult(_0x410dbb,0xc9))[_0x40b2('0x46')](handleError(_0x410dbb,null));};exports[_0x40b2('0x25')]=function(_0x2aaa72,_0x10ba0d){if(_0x2aaa72['body']['id']){delete _0x2aaa72[_0x40b2('0x4b')]['id'];}return db[_0x40b2('0x2f')][_0x40b2('0x49')]({'where':{'id':_0x2aaa72['params']['id']}})[_0x40b2('0x26')](handleEntityNotFound(_0x10ba0d,null))[_0x40b2('0x26')](saveUpdates(_0x2aaa72[_0x40b2('0x4b')],null))['then'](respondWithResult(_0x10ba0d,null))[_0x40b2('0x46')](handleError(_0x10ba0d,null));};exports[_0x40b2('0x4c')]=function(_0xd45c65,_0x5158a1){return db[_0x40b2('0x2f')][_0x40b2('0x49')]({'where':{'id':_0xd45c65[_0x40b2('0x4d')]['id']}})[_0x40b2('0x26')](handleEntityNotFound(_0x5158a1,null))[_0x40b2('0x26')](removeEntity(_0x5158a1,null))[_0x40b2('0x46')](handleError(_0x5158a1,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 3f0b6d5..407edd2 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 _0x5da4=['../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5da4,0xca));var _0x45da=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5da4[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x45da('0x0'));var util=require(_0x45da('0x1'));var logger=require(_0x45da('0x2'))('api');var moment=require(_0x45da('0x3'));var BPromise=require(_0x45da('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x45da('0x5'));var config=require(_0x45da('0x6'));var attributes=require(_0x45da('0x7'));module['exports']=function(_0x2b282c,_0x232b1c){return _0x2b282c[_0x45da('0x8')](_0x45da('0x9'),attributes,{'tableName':_0x45da('0xa'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x45da('0xb'),_0x45da('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2278=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','lodash'];(function(_0x2125f0,_0x2f23b9){var _0x12d6eb=function(_0x7a43ea){while(--_0x7a43ea){_0x2125f0['push'](_0x2125f0['shift']());}};_0x12d6eb(++_0x2f23b9);}(_0x2278,0x187));var _0x8227=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2278[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8227('0x0'));var util=require(_0x8227('0x1'));var logger=require(_0x8227('0x2'))('api');var moment=require(_0x8227('0x3'));var BPromise=require(_0x8227('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8227('0x5'));var rimraf=require(_0x8227('0x6'));var config=require(_0x8227('0x7'));var attributes=require('./intVtigerField.attributes');module[_0x8227('0x8')]=function(_0x1f76fe,_0x38dc0b){return _0x1f76fe[_0x8227('0x9')](_0x8227('0xa'),attributes,{'tableName':_0x8227('0xb'),'paranoid':![],'indexes':[{'name':_0x8227('0xc'),'fields':[_0x8227('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 4bcbe79..5c6d77d 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 _0x745d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird'];(function(_0x1212d7,_0x1bf004){var _0x468d88=function(_0x2c2aa5){while(--_0x2c2aa5){_0x1212d7['push'](_0x1212d7['shift']());}};_0x468d88(++_0x1bf004);}(_0x745d,0x6b));var _0xd745=function(_0x472ca3,_0x19be91){_0x472ca3=_0x472ca3-0x0;var _0x2b05f5=_0x745d[_0x472ca3];return _0x2b05f5;};'use strict';var _=require(_0xd745('0x0'));var util=require(_0xd745('0x1'));var moment=require('moment');var BPromise=require(_0xd745('0x2'));var rs=require(_0xd745('0x3'));var fs=require('fs');var Redis=require(_0xd745('0x4'));var db=require(_0xd745('0x5'))['db'];var utils=require(_0xd745('0x6'));var logger=require(_0xd745('0x7'))('rpc');var config=require(_0xd745('0x8'));var jayson=require(_0xd745('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xc20c60,_0x1f51c4,_0x58a2ae){return new BPromise(function(_0x9a05ad,_0x6fc021){return client[_0xd745('0xa')](_0xc20c60,_0x58a2ae)[_0xd745('0xb')](function(_0x54a3e9){logger['info'](_0xd745('0xc'),_0x1f51c4,_0xd745('0xd'));logger[_0xd745('0xe')](_0xd745('0xf'),_0x1f51c4,_0xd745('0xd'),JSON[_0xd745('0x10')](_0x54a3e9));if(_0x54a3e9[_0xd745('0x11')]){if(_0x54a3e9[_0xd745('0x11')][_0xd745('0x12')]===0x1f4){logger['error'](_0xd745('0xc'),_0x1f51c4,_0x54a3e9[_0xd745('0x11')]['message']);return _0x6fc021(_0x54a3e9[_0xd745('0x11')]['message']);}logger['error'](_0xd745('0xc'),_0x1f51c4,_0x54a3e9[_0xd745('0x11')][_0xd745('0x13')]);return _0x9a05ad(_0x54a3e9[_0xd745('0x11')][_0xd745('0x13')]);}else{logger[_0xd745('0x14')](_0xd745('0xc'),_0x1f51c4,_0xd745('0xd'));_0x9a05ad(_0x54a3e9[_0xd745('0x15')]['message']);}})['catch'](function(_0xd87f66){logger[_0xd745('0x11')](_0xd745('0xc'),_0x1f51c4,_0xd87f66);_0x6fc021(_0xd87f66);});});} \ No newline at end of file +var _0x597d=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x285c85,_0x132c21){var _0x2f81cd=function(_0x9b9962){while(--_0x9b9962){_0x285c85['push'](_0x285c85['shift']());}};_0x2f81cd(++_0x132c21);}(_0x597d,0xe7));var _0xd597=function(_0x1361bc,_0x4a5977){_0x1361bc=_0x1361bc-0x0;var _0x5a2d3a=_0x597d[_0x1361bc];return _0x5a2d3a;};'use strict';var _=require(_0xd597('0x0'));var util=require(_0xd597('0x1'));var moment=require(_0xd597('0x2'));var BPromise=require(_0xd597('0x3'));var rs=require(_0xd597('0x4'));var fs=require('fs');var Redis=require(_0xd597('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd597('0x6'))('rpc');var config=require(_0xd597('0x7'));var jayson=require(_0xd597('0x8'));var client=jayson[_0xd597('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3322a9,_0x21f8f0,_0x32b375){return new BPromise(function(_0x3866e9,_0x593e03){return client[_0xd597('0xa')](_0x3322a9,_0x32b375)[_0xd597('0xb')](function(_0x534640){logger[_0xd597('0xc')](_0xd597('0xd'),_0x21f8f0,_0xd597('0xe'));logger['debug'](_0xd597('0xf'),_0x21f8f0,_0xd597('0xe'),JSON[_0xd597('0x10')](_0x534640));if(_0x534640[_0xd597('0x11')]){if(_0x534640[_0xd597('0x11')]['code']===0x1f4){logger[_0xd597('0x11')](_0xd597('0xd'),_0x21f8f0,_0x534640[_0xd597('0x11')][_0xd597('0x12')]);return _0x593e03(_0x534640['error']['message']);}logger[_0xd597('0x11')]('VtigerField,\x20%s,\x20%s',_0x21f8f0,_0x534640[_0xd597('0x11')][_0xd597('0x12')]);return _0x3866e9(_0x534640[_0xd597('0x11')][_0xd597('0x12')]);}else{logger[_0xd597('0xc')](_0xd597('0xd'),_0x21f8f0,'request\x20sent');_0x3866e9(_0x534640[_0xd597('0x13')][_0xd597('0x12')]);}})[_0xd597('0x14')](function(_0x42400e){logger[_0xd597('0x11')](_0xd597('0xd'),_0x21f8f0,_0x42400e);_0x593e03(_0x42400e);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 1c6f9df..7311db7 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 _0xc701=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','post','create'];(function(_0x25adc0,_0x4d1fcd){var _0x5b4024=function(_0x4799f3){while(--_0x4799f3){_0x25adc0['push'](_0x25adc0['shift']());}};_0x5b4024(++_0x4d1fcd);}(_0xc701,0x82));var _0x1c70=function(_0x5cb0b7,_0x393d63){_0x5cb0b7=_0x5cb0b7-0x0;var _0x54bbb2=_0xc701[_0x5cb0b7];return _0x54bbb2;};'use strict';var multer=require(_0x1c70('0x0'));var util=require(_0x1c70('0x1'));var path=require(_0x1c70('0x2'));var timeout=require(_0x1c70('0x3'));var express=require(_0x1c70('0x4'));var router=express[_0x1c70('0x5')]();var fs_extra=require(_0x1c70('0x6'));var auth=require(_0x1c70('0x7'));var interaction=require(_0x1c70('0x8'));var config=require(_0x1c70('0x9'));var controller=require('./intZendeskAccount.controller');router[_0x1c70('0xa')]('/',auth['isAuthenticated'](),controller[_0x1c70('0xb')]);router[_0x1c70('0xa')](_0x1c70('0xc'),auth['isAuthenticated'](),controller[_0x1c70('0xd')]);router['get'](_0x1c70('0xe'),auth[_0x1c70('0xf')](),controller[_0x1c70('0x10')]);router[_0x1c70('0xa')](_0x1c70('0x11'),auth['isAuthenticated'](),controller['getFields']);router[_0x1c70('0x12')]('/',auth[_0x1c70('0xf')](),controller[_0x1c70('0x13')]);router[_0x1c70('0x12')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x1c70('0x14')](_0x1c70('0xc'),auth[_0x1c70('0xf')](),controller[_0x1c70('0x15')]);router[_0x1c70('0x16')](_0x1c70('0xc'),auth[_0x1c70('0xf')](),controller[_0x1c70('0x17')]);module[_0x1c70('0x18')]=router; \ No newline at end of file +var _0x271a=['getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields'];(function(_0x28cb18,_0x3b12b7){var _0x5c1210=function(_0x3c64d1){while(--_0x3c64d1){_0x28cb18['push'](_0x28cb18['shift']());}};_0x5c1210(++_0x3b12b7);}(_0x271a,0xeb));var _0xa271=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x271a[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xa271('0x0'));var util=require(_0xa271('0x1'));var path=require(_0xa271('0x2'));var timeout=require('connect-timeout');var express=require(_0xa271('0x3'));var router=express[_0xa271('0x4')]();var fs_extra=require(_0xa271('0x5'));var auth=require(_0xa271('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa271('0x7'));var controller=require('./intZendeskAccount.controller');router[_0xa271('0x8')]('/',auth[_0xa271('0x9')](),controller[_0xa271('0xa')]);router[_0xa271('0x8')](_0xa271('0xb'),auth[_0xa271('0x9')](),controller[_0xa271('0xc')]);router[_0xa271('0x8')]('/:id/configurations',auth[_0xa271('0x9')](),controller[_0xa271('0xd')]);router[_0xa271('0x8')](_0xa271('0xe'),auth[_0xa271('0x9')](),controller[_0xa271('0xf')]);router[_0xa271('0x10')]('/',auth[_0xa271('0x9')](),controller[_0xa271('0x11')]);router[_0xa271('0x10')](_0xa271('0x12'),auth[_0xa271('0x9')](),controller[_0xa271('0x13')]);router[_0xa271('0x14')](_0xa271('0xb'),auth[_0xa271('0x9')](),controller[_0xa271('0x15')]);router[_0xa271('0x16')]('/:id',auth[_0xa271('0x9')](),controller[_0xa271('0x17')]);module[_0xa271('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index fffebed..ef5fe08 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 _0x49c1=['integrationTab','sequelize','STRING','remoteUri','ENUM','token','newTab'];(function(_0x14baa1,_0x3c9424){var _0x2cc134=function(_0x5e7982){while(--_0x5e7982){_0x14baa1['push'](_0x14baa1['shift']());}};_0x2cc134(++_0x3c9424);}(_0x49c1,0xef));var _0x149c=function(_0x56d162,_0x18e42a){_0x56d162=_0x56d162-0x0;var _0x53a553=_0x49c1[_0x56d162];return _0x53a553;};'use strict';var Sequelize=require(_0x149c('0x0'));module['exports']={'name':{'type':Sequelize[_0x149c('0x1')]},'description':{'type':Sequelize[_0x149c('0x1')]},'username':{'type':Sequelize[_0x149c('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x149c('0x1')]},'token':{'type':Sequelize[_0x149c('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x149c('0x2')},'authType':{'type':Sequelize[_0x149c('0x3')]('password',_0x149c('0x4')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x149c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x149c('0x3')]('integrationTab',_0x149c('0x5')),'defaultValue':_0x149c('0x6')}}; \ No newline at end of file +var _0xda81=['newTab','sequelize','exports','STRING','username','remoteUri','ENUM','token','integrationTab'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0xda81,0x1c3));var _0x1da8=function(_0x128e7e,_0x2d6553){_0x128e7e=_0x128e7e-0x0;var _0xfff110=_0xda81[_0x128e7e];return _0xfff110;};'use strict';var Sequelize=require(_0x1da8('0x0'));module[_0x1da8('0x1')]={'name':{'type':Sequelize[_0x1da8('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1da8('0x2')],'unique':_0x1da8('0x3')},'password':{'type':Sequelize[_0x1da8('0x2')]},'token':{'type':Sequelize[_0x1da8('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x1da8('0x4')},'authType':{'type':Sequelize[_0x1da8('0x5')]('password',_0x1da8('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x1da8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1da8('0x5')](_0x1da8('0x7'),_0x1da8('0x8')),'defaultValue':_0x1da8('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index d0b4c8f..d2252d8 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 _0xd914=['channel','ZendeskField','username','token','authType','remoteUri','substring','lastIndexOf','format','%s/%s','ticket_fields','password','headers','%s:%s','Basic\x20%s','%s/token:%s','toString','ValidationError','Unknown\x20authentication\x20type','group','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','getConfigurations','findOne','ZendeskConfiguration','order','pick','map','options','nolimit','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd914,0x17f));var _0x4d91=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0xd914[_0x47e549];return _0x251374;};'use strict';var emlformat=require(_0x4d91('0x0'));var rimraf=require(_0x4d91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d91('0x2'));var rp=require(_0x4d91('0x3'));var moment=require(_0x4d91('0x4'));var BPromise=require(_0x4d91('0x5'));var Mustache=require(_0x4d91('0x6'));var util=require(_0x4d91('0x7'));var path=require('path');var sox=require(_0x4d91('0x8'));var csv=require('to-csv');var ejs=require(_0x4d91('0x9'));var fs=require('fs');var fs_extra=require(_0x4d91('0xa'));var _=require(_0x4d91('0xb'));var squel=require(_0x4d91('0xc'));var crypto=require(_0x4d91('0xd'));var jsforce=require(_0x4d91('0xe'));var deskjs=require(_0x4d91('0xf'));var toCsv=require(_0x4d91('0x10'));var querystring=require('querystring');var Papa=require(_0x4d91('0x11'));var Redis=require(_0x4d91('0x12'));var authService=require(_0x4d91('0x13'));var qs=require(_0x4d91('0x14'));var as=require(_0x4d91('0x15'));var hardwareService=require(_0x4d91('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x4d91('0x17'));var config=require(_0x4d91('0x18'));var licenseUtil=require(_0x4d91('0x19'));var db=require(_0x4d91('0x1a'))['db'];var integrations=require(_0x4d91('0x1b'));function respondWithStatusCode(_0x318e0c,_0x4ea591){_0x4ea591=_0x4ea591||0xcc;return function(_0x577a69){if(_0x577a69){return _0x318e0c[_0x4d91('0x1c')](_0x4ea591);}return _0x318e0c[_0x4d91('0x1d')](_0x4ea591)[_0x4d91('0x1e')]();};}function respondWithResult(_0x3c9fd6,_0x33fbd4){_0x33fbd4=_0x33fbd4||0xc8;return function(_0x25bafc){if(_0x25bafc){return _0x3c9fd6[_0x4d91('0x1d')](_0x33fbd4)['json'](_0x25bafc);}};}function respondWithFilteredResult(_0x3a8ec9,_0x42631a){return function(_0x1e2ef7){if(_0x1e2ef7){var _0xb92681=typeof _0x42631a[_0x4d91('0x1f')]==='undefined'&&typeof _0x42631a[_0x4d91('0x20')]===_0x4d91('0x21');var _0x241564=_0x1e2ef7[_0x4d91('0x22')];var _0x4cfa40=_0xb92681?0x0:_0x42631a[_0x4d91('0x1f')];var _0x3b579b=_0xb92681?_0x1e2ef7[_0x4d91('0x22')]:_0x42631a['offset']+_0x42631a[_0x4d91('0x20')];var _0x127911;if(_0x3b579b>=_0x241564){_0x3b579b=_0x241564;_0x127911=0xc8;}else{_0x127911=0xce;}_0x3a8ec9[_0x4d91('0x1d')](_0x127911);return _0x3a8ec9[_0x4d91('0x23')](_0x4d91('0x24'),_0x4cfa40+'-'+_0x3b579b+'/'+_0x241564)[_0x4d91('0x25')](_0x1e2ef7);}return null;};}function patchUpdates(_0xc1d44f){return function(_0x193ca9){try{jsonpatch[_0x4d91('0x26')](_0x193ca9,_0xc1d44f,!![]);}catch(_0x226d85){return BPromise['reject'](_0x226d85);}return _0x193ca9[_0x4d91('0x27')]();};}function saveUpdates(_0x5f5236,_0x57913e){return function(_0x74a697){if(_0x74a697){return _0x74a697[_0x4d91('0x28')](_0x5f5236)[_0x4d91('0x29')](function(_0x9cb864){return _0x9cb864;});}return null;};}function removeEntity(_0x7d8cbf,_0x12b722){return function(_0x100cd4){if(_0x100cd4){return _0x100cd4[_0x4d91('0x2a')]()['then'](function(){_0x7d8cbf['status'](0xcc)[_0x4d91('0x1e')]();});}};}function handleEntityNotFound(_0x112923,_0x3bed98){return function(_0x45fc91){if(!_0x45fc91){_0x112923[_0x4d91('0x1c')](0x194);}return _0x45fc91;};}function handleError(_0x2c7d7a,_0x14bdb4){_0x14bdb4=_0x14bdb4||0x1f4;return function(_0x560966){logger[_0x4d91('0x2b')](_0x560966[_0x4d91('0x2c')]);if(_0x560966[_0x4d91('0x2d')]){delete _0x560966['name'];}_0x2c7d7a['status'](_0x14bdb4)[_0x4d91('0x2e')](_0x560966);};}exports[_0x4d91('0x2f')]=function(_0x5ed948,_0x50fe76){var _0x42d5a0={},_0x2d6981={},_0x43371e={'count':0x0,'rows':[]};var _0x17c7bc=_['map'](db[_0x4d91('0x30')][_0x4d91('0x31')],function(_0x468e95){return{'name':_0x468e95[_0x4d91('0x32')],'type':_0x468e95[_0x4d91('0x33')][_0x4d91('0x34')]};});_0x2d6981[_0x4d91('0x35')]=_['map'](_0x17c7bc,_0x4d91('0x2d'));_0x2d6981['query']=_['keys'](_0x5ed948[_0x4d91('0x36')]);_0x2d6981[_0x4d91('0x37')]=_['intersection'](_0x2d6981[_0x4d91('0x35')],_0x2d6981[_0x4d91('0x36')]);_0x42d5a0[_0x4d91('0x38')]=_[_0x4d91('0x39')](_0x2d6981[_0x4d91('0x35')],qs['fields'](_0x5ed948[_0x4d91('0x36')][_0x4d91('0x3a')]));_0x42d5a0[_0x4d91('0x38')]=_0x42d5a0[_0x4d91('0x38')][_0x4d91('0x3b')]?_0x42d5a0[_0x4d91('0x38')]:_0x2d6981['model'];if(!_0x5ed948[_0x4d91('0x36')][_0x4d91('0x3c')]('nolimit')){_0x42d5a0[_0x4d91('0x20')]=qs[_0x4d91('0x20')](_0x5ed948[_0x4d91('0x36')]['limit']);_0x42d5a0[_0x4d91('0x1f')]=qs[_0x4d91('0x1f')](_0x5ed948[_0x4d91('0x36')][_0x4d91('0x1f')]);}_0x42d5a0['order']=qs[_0x4d91('0x3d')](_0x5ed948[_0x4d91('0x36')][_0x4d91('0x3d')]);_0x42d5a0[_0x4d91('0x3e')]=qs['filters'](_['pick'](_0x5ed948[_0x4d91('0x36')],_0x2d6981[_0x4d91('0x37')]),_0x17c7bc);if(_0x5ed948['query'][_0x4d91('0x3f')]){_0x42d5a0[_0x4d91('0x3e')]=_[_0x4d91('0x40')](_0x42d5a0[_0x4d91('0x3e')],{'$or':_['map'](_0x17c7bc,function(_0x2eb7c7){if(_0x2eb7c7[_0x4d91('0x33')]!=='VIRTUAL'){var _0x1ba6cd={};_0x1ba6cd[_0x2eb7c7['name']]={'$like':'%'+_0x5ed948[_0x4d91('0x36')]['filter']+'%'};return _0x1ba6cd;}})});}_0x42d5a0=_[_0x4d91('0x40')]({},_0x42d5a0,_0x5ed948['options']);var _0x24fc69={'where':_0x42d5a0[_0x4d91('0x3e')]};return db[_0x4d91('0x30')][_0x4d91('0x22')](_0x24fc69)['then'](function(_0x5bcc9b){_0x43371e[_0x4d91('0x22')]=_0x5bcc9b;if(_0x5ed948['query'][_0x4d91('0x41')]){_0x42d5a0[_0x4d91('0x42')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x4d91('0x43')](_0x42d5a0);})[_0x4d91('0x29')](function(_0x14db37){_0x43371e[_0x4d91('0x44')]=_0x14db37;return _0x43371e;})[_0x4d91('0x29')](respondWithFilteredResult(_0x50fe76,_0x42d5a0))[_0x4d91('0x45')](handleError(_0x50fe76,null));};exports[_0x4d91('0x46')]=function(_0x4f6254,_0x1e4c6d){var _0x4c70af={'raw':![],'where':{'id':_0x4f6254[_0x4d91('0x47')]['id']}},_0x41c06a={};_0x41c06a[_0x4d91('0x35')]=_[_0x4d91('0x48')](db[_0x4d91('0x30')][_0x4d91('0x31')]);_0x41c06a['query']=_['keys'](_0x4f6254[_0x4d91('0x36')]);_0x41c06a[_0x4d91('0x37')]=_['intersection'](_0x41c06a[_0x4d91('0x35')],_0x41c06a[_0x4d91('0x36')]);_0x4c70af[_0x4d91('0x38')]=_[_0x4d91('0x39')](_0x41c06a[_0x4d91('0x35')],qs[_0x4d91('0x3a')](_0x4f6254[_0x4d91('0x36')][_0x4d91('0x3a')]));_0x4c70af[_0x4d91('0x38')]=_0x4c70af['attributes']['length']?_0x4c70af[_0x4d91('0x38')]:_0x41c06a['model'];if(_0x4f6254[_0x4d91('0x36')][_0x4d91('0x41')]){_0x4c70af[_0x4d91('0x42')]=[{'all':!![]}];}_0x4c70af=_[_0x4d91('0x40')]({},_0x4c70af,_0x4f6254['options']);return db[_0x4d91('0x30')]['find'](_0x4c70af)['then'](handleEntityNotFound(_0x1e4c6d,null))[_0x4d91('0x29')](respondWithResult(_0x1e4c6d,null))[_0x4d91('0x45')](handleError(_0x1e4c6d,null));};exports[_0x4d91('0x49')]=function(_0xa03d75,_0x1f91ec){return db[_0x4d91('0x30')]['create'](_0xa03d75[_0x4d91('0x4a')],{})[_0x4d91('0x29')](respondWithResult(_0x1f91ec,0xc9))[_0x4d91('0x45')](handleError(_0x1f91ec,null));};exports[_0x4d91('0x28')]=function(_0x106e5b,_0x44e9ec){if(_0x106e5b[_0x4d91('0x4a')]['id']){delete _0x106e5b[_0x4d91('0x4a')]['id'];}return db[_0x4d91('0x30')][_0x4d91('0x4b')]({'where':{'id':_0x106e5b[_0x4d91('0x47')]['id']}})['then'](handleEntityNotFound(_0x44e9ec,null))[_0x4d91('0x29')](saveUpdates(_0x106e5b['body'],null))[_0x4d91('0x29')](respondWithResult(_0x44e9ec,null))[_0x4d91('0x45')](handleError(_0x44e9ec,null));};exports[_0x4d91('0x2a')]=function(_0x386935,_0x436a3d){return db[_0x4d91('0x30')][_0x4d91('0x4b')]({'where':{'id':_0x386935[_0x4d91('0x47')]['id']}})['then'](handleEntityNotFound(_0x436a3d,null))[_0x4d91('0x29')](removeEntity(_0x436a3d,null))[_0x4d91('0x45')](handleError(_0x436a3d,null));};exports[_0x4d91('0x4c')]=function(_0x2bba43,_0x26ecd7,_0x19e57e){var _0x5765ce={};var _0x4aae23={};var _0x392cc3;var _0x2159e4;return db[_0x4d91('0x30')][_0x4d91('0x4d')]({'where':{'id':_0x2bba43[_0x4d91('0x47')]['id']}})[_0x4d91('0x29')](handleEntityNotFound(_0x26ecd7,null))[_0x4d91('0x29')](function(_0x4138c5){if(_0x4138c5){_0x392cc3=_0x4138c5;_0x4aae23[_0x4d91('0x35')]=_[_0x4d91('0x48')](db[_0x4d91('0x4e')][_0x4d91('0x31')]);_0x4aae23[_0x4d91('0x36')]=_[_0x4d91('0x48')](_0x2bba43[_0x4d91('0x36')]);_0x4aae23[_0x4d91('0x37')]=_[_0x4d91('0x39')](_0x4aae23['model'],_0x4aae23['query']);_0x5765ce['attributes']=_[_0x4d91('0x39')](_0x4aae23[_0x4d91('0x35')],qs[_0x4d91('0x3a')](_0x2bba43['query'][_0x4d91('0x3a')]));_0x5765ce[_0x4d91('0x38')]=_0x5765ce[_0x4d91('0x38')]['length']?_0x5765ce['attributes']:_0x4aae23['model'];_0x5765ce[_0x4d91('0x4f')]=qs[_0x4d91('0x3d')](_0x2bba43[_0x4d91('0x36')][_0x4d91('0x3d')]);_0x5765ce[_0x4d91('0x3e')]=qs['filters'](_[_0x4d91('0x50')](_0x2bba43[_0x4d91('0x36')],_0x4aae23['filters']));if(_0x2bba43['query'][_0x4d91('0x3f')]){_0x5765ce['where']=_[_0x4d91('0x40')](_0x5765ce[_0x4d91('0x3e')],{'$or':_[_0x4d91('0x51')](_0x5765ce['attributes'],function(_0x2e0bff){var _0x3d6c26={};_0x3d6c26[_0x2e0bff]={'$like':'%'+_0x2bba43[_0x4d91('0x36')][_0x4d91('0x3f')]+'%'};return _0x3d6c26;})});}_0x5765ce=_[_0x4d91('0x40')]({},_0x5765ce,_0x2bba43[_0x4d91('0x52')]);return _0x392cc3[_0x4d91('0x4c')](_0x5765ce);}})['then'](function(_0x533572){if(_0x533572){_0x2159e4=_0x533572['length'];if(!_0x2bba43['query'][_0x4d91('0x3c')](_0x4d91('0x53'))){_0x5765ce[_0x4d91('0x20')]=qs['limit'](_0x2bba43[_0x4d91('0x36')]['limit']);_0x5765ce[_0x4d91('0x1f')]=qs[_0x4d91('0x1f')](_0x2bba43['query']['offset']);}return _0x392cc3[_0x4d91('0x4c')](_0x5765ce);}})[_0x4d91('0x29')](function(_0x31150f){if(_0x31150f){return _0x31150f?{'count':_0x2159e4,'rows':_0x31150f}:null;}})[_0x4d91('0x29')](respondWithResult(_0x26ecd7,null))[_0x4d91('0x45')](handleError(_0x26ecd7,null));};exports[_0x4d91('0x54')]=function(_0x7a94e2,_0x42e550,_0xd384a9){if(_0x7a94e2[_0x4d91('0x4a')]['id']){delete _0x7a94e2['body']['id'];}return db['ZendeskAccount'][_0x4d91('0x4d')]({'where':{'id':_0x7a94e2[_0x4d91('0x47')]['id']}})[_0x4d91('0x29')](handleEntityNotFound(_0x42e550,null))[_0x4d91('0x29')](function(_0x16ba26){if(_0x16ba26){_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x55')]=_0x16ba26['id'];_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x56')]=integrations['getSubjects'](_0x7a94e2['body']['channel'],_0x7a94e2['body'][_0x4d91('0x33')]);_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x57')]=integrations[_0x4d91('0x58')](_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x59')],_0x7a94e2[_0x4d91('0x4a')][_0x4d91('0x33')]);return db[_0x4d91('0x4e')][_0x4d91('0x49')](_0x7a94e2[_0x4d91('0x4a')],{'include':[{'model':db[_0x4d91('0x5a')],'as':_0x4d91('0x56')},{'model':db[_0x4d91('0x5a')],'as':_0x4d91('0x57')}]});}return null;})[_0x4d91('0x29')](respondWithResult(_0x42e550,null))[_0x4d91('0x45')](handleError(_0x42e550,null));};exports['getFields']=function(_0x4062c6,_0x1be4b1,_0xc4ef10){var _0x2e2105='';return db[_0x4d91('0x30')]['findOne']({'where':{'id':_0x4062c6[_0x4d91('0x47')]['id']},'attributes':['id',_0x4d91('0x5b'),'password',_0x4d91('0x5c'),_0x4d91('0x5d'),_0x4d91('0x5e')]})[_0x4d91('0x29')](handleEntityNotFound(_0x1be4b1,null))[_0x4d91('0x29')](function(_0x4bc5a0){if(_0x4bc5a0){_0x2e2105=_0x4bc5a0[_0x4d91('0x5e')];var _0x2a5bc0=_0x2e2105['slice'](-0x1);if(_0x2a5bc0==='/'){_0x2e2105=_0x2e2105[_0x4d91('0x5f')](0x0,_0x2e2105[_0x4d91('0x60')](_0x2a5bc0));}var _0xd94b29={'method':'GET','uri':util[_0x4d91('0x61')](_0x4d91('0x62'),_0x2e2105,_0x4d91('0x63')),'json':!![]};switch(_0x4bc5a0[_0x4d91('0x5d')]){case _0x4d91('0x64'):_0xd94b29[_0x4d91('0x65')]={'Authorization':util[_0x4d91('0x61')]('Basic\x20%s',new Buffer(util[_0x4d91('0x61')](_0x4d91('0x66'),_0x4bc5a0['username'],_0x4bc5a0[_0x4d91('0x64')]))['toString']('base64'))};break;case _0x4d91('0x5c'):_0xd94b29['headers']={'Authorization':util[_0x4d91('0x61')](_0x4d91('0x67'),new Buffer(util[_0x4d91('0x61')](_0x4d91('0x68'),_0x4bc5a0[_0x4d91('0x5b')],_0x4bc5a0[_0x4d91('0x5c')]))[_0x4d91('0x69')]('base64'))};break;default:throw new db['Sequelize'][(_0x4d91('0x6a'))](_0x4d91('0x6b'));}return rp(_0xd94b29);}})[_0x4d91('0x29')](function(_0x42164f){if(_0x42164f){var _0x1e3838=['subject','description',_0x4d91('0x6c'),'assignee'];_['remove'](_0x42164f[_0x4d91('0x63')],function(_0x54fea8){return _0x1e3838['includes'](_0x54fea8[_0x4d91('0x33')]);});return{'count':_0x42164f[_0x4d91('0x63')][_0x4d91('0x3b')],'rows':_['map'](_0x42164f['ticket_fields'],function(_0x52604d){return{'id':_0x52604d['id'],'name':_0x52604d[_0x4d91('0x6d')]>0x7?_0x52604d[_0x4d91('0x6e')]:_0x52604d[_0x4d91('0x33')],'custom':_0x52604d[_0x4d91('0x6d')]>0x7?!![]:![],'options':_0x52604d[_0x4d91('0x6f')]?_0x52604d[_0x4d91('0x6f')]:_0x52604d[_0x4d91('0x70')]?_0x52604d[_0x4d91('0x70')]:[]};})};}})[_0x4d91('0x29')](respondWithResult(_0x1be4b1,null))['catch'](function(_0xb9d1ff){var _0x579a9e=_0x4062c6['query'][_0x4d91('0x71')]?0x1f4:_0xb9d1ff[_0x4d91('0x72')]||0x1f4;logger[_0x4d91('0x2b')](_0x4d91('0x73'),'getFields',_0x579a9e,JSON[_0x4d91('0x74')](_0xb9d1ff));delete _0xb9d1ff[_0x4d91('0x2d')];if(_0x579a9e===0x191){_0x579a9e=0x190;}_0x1be4b1[_0x4d91('0x1d')](_0x579a9e)[_0x4d91('0x2e')](_0x4062c6[_0x4d91('0x36')][_0x4d91('0x71')]?{'message':_0x4d91('0x75'),'statusCode':_0xb9d1ff['statusCode']}:_0xb9d1ff);});}; \ No newline at end of file +var _0x8f59=['keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','ZendeskAccount','includeAll','include','rows','params','find','catch','create','body','getConfigurations','findOne','ZendeskConfiguration','filter','Subjects','getSubjects','channel','ZendeskField','Descriptions','getFields','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','ticket_fields','headers','Basic\x20%s','username','toString','base64','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','remove','position','system_field_options','custom_field_options','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x526ac4,_0x4210a5){var _0x473ceb=function(_0x17cf3e){while(--_0x17cf3e){_0x526ac4['push'](_0x526ac4['shift']());}};_0x473ceb(++_0x4210a5);}(_0x8f59,0x11d));var _0x98f5=function(_0x42bbd8,_0x32af99){_0x42bbd8=_0x42bbd8-0x0;var _0x2d4a1c=_0x8f59[_0x42bbd8];return _0x2d4a1c;};'use strict';var emlformat=require(_0x98f5('0x0'));var rimraf=require(_0x98f5('0x1'));var zipdir=require(_0x98f5('0x2'));var jsonpatch=require(_0x98f5('0x3'));var rp=require(_0x98f5('0x4'));var moment=require(_0x98f5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x98f5('0x6'));var util=require(_0x98f5('0x7'));var path=require(_0x98f5('0x8'));var sox=require(_0x98f5('0x9'));var csv=require('to-csv');var ejs=require(_0x98f5('0xa'));var fs=require('fs');var fs_extra=require(_0x98f5('0xb'));var _=require(_0x98f5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98f5('0xd'));var deskjs=require(_0x98f5('0xe'));var toCsv=require(_0x98f5('0xf'));var querystring=require('querystring');var Papa=require(_0x98f5('0x10'));var Redis=require(_0x98f5('0x11'));var authService=require(_0x98f5('0x12'));var qs=require(_0x98f5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98f5('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x98f5('0x15'));var config=require(_0x98f5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x98f5('0x17'))['db'];var integrations=require(_0x98f5('0x18'));function respondWithStatusCode(_0x1f00e8,_0x160626){_0x160626=_0x160626||0xcc;return function(_0x3286f7){if(_0x3286f7){return _0x1f00e8[_0x98f5('0x19')](_0x160626);}return _0x1f00e8['status'](_0x160626)[_0x98f5('0x1a')]();};}function respondWithResult(_0xbade31,_0x5b8bab){_0x5b8bab=_0x5b8bab||0xc8;return function(_0x9df84){if(_0x9df84){return _0xbade31[_0x98f5('0x1b')](_0x5b8bab)[_0x98f5('0x1c')](_0x9df84);}};}function respondWithFilteredResult(_0x4ae70d,_0x2437e7){return function(_0xc7a49b){if(_0xc7a49b){var _0x113545=typeof _0x2437e7['offset']===_0x98f5('0x1d')&&typeof _0x2437e7[_0x98f5('0x1e')]==='undefined';var _0x1df52d=_0xc7a49b['count'];var _0x10c57c=_0x113545?0x0:_0x2437e7[_0x98f5('0x1f')];var _0x2291d5=_0x113545?_0xc7a49b[_0x98f5('0x20')]:_0x2437e7[_0x98f5('0x1f')]+_0x2437e7[_0x98f5('0x1e')];var _0x484e1d;if(_0x2291d5>=_0x1df52d){_0x2291d5=_0x1df52d;_0x484e1d=0xc8;}else{_0x484e1d=0xce;}_0x4ae70d[_0x98f5('0x1b')](_0x484e1d);return _0x4ae70d['set'](_0x98f5('0x21'),_0x10c57c+'-'+_0x2291d5+'/'+_0x1df52d)[_0x98f5('0x1c')](_0xc7a49b);}return null;};}function patchUpdates(_0x5deca0){return function(_0x146db1){try{jsonpatch[_0x98f5('0x22')](_0x146db1,_0x5deca0,!![]);}catch(_0x331695){return BPromise[_0x98f5('0x23')](_0x331695);}return _0x146db1[_0x98f5('0x24')]();};}function saveUpdates(_0x3dc7c2,_0x38b46d){return function(_0x5ac2b7){if(_0x5ac2b7){return _0x5ac2b7[_0x98f5('0x25')](_0x3dc7c2)['then'](function(_0xcb10d6){return _0xcb10d6;});}return null;};}function removeEntity(_0x495889,_0x44bfbb){return function(_0x40c69b){if(_0x40c69b){return _0x40c69b[_0x98f5('0x26')]()[_0x98f5('0x27')](function(){_0x495889[_0x98f5('0x1b')](0xcc)[_0x98f5('0x1a')]();});}};}function handleEntityNotFound(_0x46dbd4,_0x58d506){return function(_0x27a533){if(!_0x27a533){_0x46dbd4[_0x98f5('0x19')](0x194);}return _0x27a533;};}function handleError(_0x5d7423,_0x1a1c55){_0x1a1c55=_0x1a1c55||0x1f4;return function(_0x18b0af){logger[_0x98f5('0x28')](_0x18b0af[_0x98f5('0x29')]);if(_0x18b0af[_0x98f5('0x2a')]){delete _0x18b0af[_0x98f5('0x2a')];}_0x5d7423[_0x98f5('0x1b')](_0x1a1c55)[_0x98f5('0x2b')](_0x18b0af);};}exports['index']=function(_0x4c10b8,_0x428c85){var _0x71661e={},_0x18bb29={},_0x209d15={'count':0x0,'rows':[]};var _0x15bf92=_[_0x98f5('0x2c')](db['ZendeskAccount'][_0x98f5('0x2d')],function(_0x6d7418){return{'name':_0x6d7418[_0x98f5('0x2e')],'type':_0x6d7418[_0x98f5('0x2f')][_0x98f5('0x30')]};});_0x18bb29[_0x98f5('0x31')]=_['map'](_0x15bf92,_0x98f5('0x2a'));_0x18bb29[_0x98f5('0x32')]=_[_0x98f5('0x33')](_0x4c10b8[_0x98f5('0x32')]);_0x18bb29['filters']=_[_0x98f5('0x34')](_0x18bb29[_0x98f5('0x31')],_0x18bb29[_0x98f5('0x32')]);_0x71661e[_0x98f5('0x35')]=_[_0x98f5('0x34')](_0x18bb29[_0x98f5('0x31')],qs[_0x98f5('0x36')](_0x4c10b8[_0x98f5('0x32')][_0x98f5('0x36')]));_0x71661e[_0x98f5('0x35')]=_0x71661e[_0x98f5('0x35')][_0x98f5('0x37')]?_0x71661e[_0x98f5('0x35')]:_0x18bb29[_0x98f5('0x31')];if(!_0x4c10b8[_0x98f5('0x32')][_0x98f5('0x38')](_0x98f5('0x39'))){_0x71661e[_0x98f5('0x1e')]=qs[_0x98f5('0x1e')](_0x4c10b8[_0x98f5('0x32')]['limit']);_0x71661e[_0x98f5('0x1f')]=qs['offset'](_0x4c10b8['query'][_0x98f5('0x1f')]);}_0x71661e[_0x98f5('0x3a')]=qs[_0x98f5('0x3b')](_0x4c10b8[_0x98f5('0x32')]['sort']);_0x71661e[_0x98f5('0x3c')]=qs[_0x98f5('0x3d')](_[_0x98f5('0x3e')](_0x4c10b8['query'],_0x18bb29[_0x98f5('0x3d')]),_0x15bf92);if(_0x4c10b8[_0x98f5('0x32')]['filter']){_0x71661e[_0x98f5('0x3c')]=_[_0x98f5('0x3f')](_0x71661e[_0x98f5('0x3c')],{'$or':_['map'](_0x15bf92,function(_0x15d704){if(_0x15d704[_0x98f5('0x2f')]!==_0x98f5('0x40')){var _0x544fbf={};_0x544fbf[_0x15d704[_0x98f5('0x2a')]]={'$like':'%'+_0x4c10b8['query']['filter']+'%'};return _0x544fbf;}})});}_0x71661e=_[_0x98f5('0x3f')]({},_0x71661e,_0x4c10b8[_0x98f5('0x41')]);var _0x33e6e2={'where':_0x71661e[_0x98f5('0x3c')]};return db[_0x98f5('0x42')][_0x98f5('0x20')](_0x33e6e2)['then'](function(_0x4a4129){_0x209d15[_0x98f5('0x20')]=_0x4a4129;if(_0x4c10b8[_0x98f5('0x32')][_0x98f5('0x43')]){_0x71661e[_0x98f5('0x44')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x71661e);})[_0x98f5('0x27')](function(_0x469d2c){_0x209d15[_0x98f5('0x45')]=_0x469d2c;return _0x209d15;})[_0x98f5('0x27')](respondWithFilteredResult(_0x428c85,_0x71661e))['catch'](handleError(_0x428c85,null));};exports['show']=function(_0x3db067,_0x3a191f){var _0x372c33={'raw':![],'where':{'id':_0x3db067[_0x98f5('0x46')]['id']}},_0x4a9b53={};_0x4a9b53['model']=_[_0x98f5('0x33')](db['ZendeskAccount'][_0x98f5('0x2d')]);_0x4a9b53[_0x98f5('0x32')]=_[_0x98f5('0x33')](_0x3db067['query']);_0x4a9b53[_0x98f5('0x3d')]=_[_0x98f5('0x34')](_0x4a9b53['model'],_0x4a9b53[_0x98f5('0x32')]);_0x372c33[_0x98f5('0x35')]=_['intersection'](_0x4a9b53[_0x98f5('0x31')],qs['fields'](_0x3db067[_0x98f5('0x32')][_0x98f5('0x36')]));_0x372c33['attributes']=_0x372c33['attributes']['length']?_0x372c33['attributes']:_0x4a9b53[_0x98f5('0x31')];if(_0x3db067['query'][_0x98f5('0x43')]){_0x372c33[_0x98f5('0x44')]=[{'all':!![]}];}_0x372c33=_[_0x98f5('0x3f')]({},_0x372c33,_0x3db067[_0x98f5('0x41')]);return db[_0x98f5('0x42')][_0x98f5('0x47')](_0x372c33)['then'](handleEntityNotFound(_0x3a191f,null))[_0x98f5('0x27')](respondWithResult(_0x3a191f,null))[_0x98f5('0x48')](handleError(_0x3a191f,null));};exports[_0x98f5('0x49')]=function(_0x2c3cef,_0x178867){return db[_0x98f5('0x42')]['create'](_0x2c3cef[_0x98f5('0x4a')],{})[_0x98f5('0x27')](respondWithResult(_0x178867,0xc9))[_0x98f5('0x48')](handleError(_0x178867,null));};exports[_0x98f5('0x25')]=function(_0x4a0cda,_0x2c5f96){if(_0x4a0cda[_0x98f5('0x4a')]['id']){delete _0x4a0cda[_0x98f5('0x4a')]['id'];}return db[_0x98f5('0x42')][_0x98f5('0x47')]({'where':{'id':_0x4a0cda['params']['id']}})[_0x98f5('0x27')](handleEntityNotFound(_0x2c5f96,null))[_0x98f5('0x27')](saveUpdates(_0x4a0cda['body'],null))[_0x98f5('0x27')](respondWithResult(_0x2c5f96,null))['catch'](handleError(_0x2c5f96,null));};exports[_0x98f5('0x26')]=function(_0x4cb157,_0x1bd2b9){return db[_0x98f5('0x42')][_0x98f5('0x47')]({'where':{'id':_0x4cb157['params']['id']}})[_0x98f5('0x27')](handleEntityNotFound(_0x1bd2b9,null))[_0x98f5('0x27')](removeEntity(_0x1bd2b9,null))[_0x98f5('0x48')](handleError(_0x1bd2b9,null));};exports[_0x98f5('0x4b')]=function(_0xde3d2d,_0xf39073,_0x37e620){var _0x1891ac={};var _0x2c3a23={};var _0x2e48a1;var _0x50343c;return db[_0x98f5('0x42')][_0x98f5('0x4c')]({'where':{'id':_0xde3d2d[_0x98f5('0x46')]['id']}})[_0x98f5('0x27')](handleEntityNotFound(_0xf39073,null))[_0x98f5('0x27')](function(_0x23e955){if(_0x23e955){_0x2e48a1=_0x23e955;_0x2c3a23['model']=_[_0x98f5('0x33')](db[_0x98f5('0x4d')][_0x98f5('0x2d')]);_0x2c3a23[_0x98f5('0x32')]=_[_0x98f5('0x33')](_0xde3d2d[_0x98f5('0x32')]);_0x2c3a23['filters']=_['intersection'](_0x2c3a23['model'],_0x2c3a23[_0x98f5('0x32')]);_0x1891ac[_0x98f5('0x35')]=_[_0x98f5('0x34')](_0x2c3a23[_0x98f5('0x31')],qs['fields'](_0xde3d2d[_0x98f5('0x32')]['fields']));_0x1891ac[_0x98f5('0x35')]=_0x1891ac['attributes']['length']?_0x1891ac[_0x98f5('0x35')]:_0x2c3a23[_0x98f5('0x31')];_0x1891ac[_0x98f5('0x3a')]=qs['sort'](_0xde3d2d['query'][_0x98f5('0x3b')]);_0x1891ac[_0x98f5('0x3c')]=qs['filters'](_[_0x98f5('0x3e')](_0xde3d2d[_0x98f5('0x32')],_0x2c3a23['filters']));if(_0xde3d2d[_0x98f5('0x32')][_0x98f5('0x4e')]){_0x1891ac[_0x98f5('0x3c')]=_['merge'](_0x1891ac[_0x98f5('0x3c')],{'$or':_[_0x98f5('0x2c')](_0x1891ac[_0x98f5('0x35')],function(_0xabde69){var _0x459c64={};_0x459c64[_0xabde69]={'$like':'%'+_0xde3d2d[_0x98f5('0x32')][_0x98f5('0x4e')]+'%'};return _0x459c64;})});}_0x1891ac=_['merge']({},_0x1891ac,_0xde3d2d[_0x98f5('0x41')]);return _0x2e48a1[_0x98f5('0x4b')](_0x1891ac);}})[_0x98f5('0x27')](function(_0x58041d){if(_0x58041d){_0x50343c=_0x58041d['length'];if(!_0xde3d2d[_0x98f5('0x32')][_0x98f5('0x38')]('nolimit')){_0x1891ac['limit']=qs['limit'](_0xde3d2d['query'][_0x98f5('0x1e')]);_0x1891ac['offset']=qs[_0x98f5('0x1f')](_0xde3d2d[_0x98f5('0x32')][_0x98f5('0x1f')]);}return _0x2e48a1[_0x98f5('0x4b')](_0x1891ac);}})[_0x98f5('0x27')](function(_0x26cc86){if(_0x26cc86){return _0x26cc86?{'count':_0x50343c,'rows':_0x26cc86}:null;}})[_0x98f5('0x27')](respondWithResult(_0xf39073,null))[_0x98f5('0x48')](handleError(_0xf39073,null));};exports['addConfiguration']=function(_0x4d89b6,_0x3b8229,_0x505209){if(_0x4d89b6[_0x98f5('0x4a')]['id']){delete _0x4d89b6[_0x98f5('0x4a')]['id'];}return db[_0x98f5('0x42')]['findOne']({'where':{'id':_0x4d89b6[_0x98f5('0x46')]['id']}})['then'](handleEntityNotFound(_0x3b8229,null))['then'](function(_0x595aee){if(_0x595aee){_0x4d89b6[_0x98f5('0x4a')]['AccountId']=_0x595aee['id'];_0x4d89b6[_0x98f5('0x4a')][_0x98f5('0x4f')]=integrations[_0x98f5('0x50')](_0x4d89b6['body']['channel'],_0x4d89b6['body'][_0x98f5('0x2f')]);_0x4d89b6[_0x98f5('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x4d89b6[_0x98f5('0x4a')][_0x98f5('0x51')],_0x4d89b6[_0x98f5('0x4a')][_0x98f5('0x2f')]);return db[_0x98f5('0x4d')][_0x98f5('0x49')](_0x4d89b6[_0x98f5('0x4a')],{'include':[{'model':db[_0x98f5('0x52')],'as':_0x98f5('0x4f')},{'model':db['ZendeskField'],'as':_0x98f5('0x53')}]});}return null;})[_0x98f5('0x27')](respondWithResult(_0x3b8229,null))[_0x98f5('0x48')](handleError(_0x3b8229,null));};exports[_0x98f5('0x54')]=function(_0x50911c,_0x3e00bf,_0x48b175){var _0x42c7a6='';return db['ZendeskAccount'][_0x98f5('0x4c')]({'where':{'id':_0x50911c[_0x98f5('0x46')]['id']},'attributes':['id','username',_0x98f5('0x55'),_0x98f5('0x56'),_0x98f5('0x57'),'remoteUri']})[_0x98f5('0x27')](handleEntityNotFound(_0x3e00bf,null))[_0x98f5('0x27')](function(_0x14c4f1){if(_0x14c4f1){_0x42c7a6=_0x14c4f1[_0x98f5('0x58')];var _0x154e19=_0x42c7a6[_0x98f5('0x59')](-0x1);if(_0x154e19==='/'){_0x42c7a6=_0x42c7a6[_0x98f5('0x5a')](0x0,_0x42c7a6[_0x98f5('0x5b')](_0x154e19));}var _0x368f76={'method':'GET','uri':util[_0x98f5('0x5c')]('%s/%s',_0x42c7a6,_0x98f5('0x5d')),'json':!![]};switch(_0x14c4f1[_0x98f5('0x57')]){case _0x98f5('0x55'):_0x368f76[_0x98f5('0x5e')]={'Authorization':util['format'](_0x98f5('0x5f'),new Buffer(util[_0x98f5('0x5c')]('%s:%s',_0x14c4f1[_0x98f5('0x60')],_0x14c4f1['password']))[_0x98f5('0x61')](_0x98f5('0x62')))};break;case _0x98f5('0x56'):_0x368f76[_0x98f5('0x5e')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x98f5('0x5c')](_0x98f5('0x63'),_0x14c4f1['username'],_0x14c4f1[_0x98f5('0x56')]))[_0x98f5('0x61')](_0x98f5('0x62')))};break;default:throw new db[(_0x98f5('0x64'))][(_0x98f5('0x65'))](_0x98f5('0x66'));}return rp(_0x368f76);}})[_0x98f5('0x27')](function(_0x1a3cb8){if(_0x1a3cb8){var _0x2e0484=[_0x98f5('0x67'),_0x98f5('0x68'),'group','assignee'];_[_0x98f5('0x69')](_0x1a3cb8[_0x98f5('0x5d')],function(_0x10cd2d){return _0x2e0484['includes'](_0x10cd2d[_0x98f5('0x2f')]);});return{'count':_0x1a3cb8[_0x98f5('0x5d')]['length'],'rows':_[_0x98f5('0x2c')](_0x1a3cb8[_0x98f5('0x5d')],function(_0x4c1dda){return{'id':_0x4c1dda['id'],'name':_0x4c1dda['position']>0x7?_0x4c1dda['title']:_0x4c1dda['type'],'custom':_0x4c1dda[_0x98f5('0x6a')]>0x7?!![]:![],'options':_0x4c1dda[_0x98f5('0x6b')]?_0x4c1dda['system_field_options']:_0x4c1dda[_0x98f5('0x6c')]?_0x4c1dda[_0x98f5('0x6c')]:[]};})};}})['then'](respondWithResult(_0x3e00bf,null))[_0x98f5('0x48')](function(_0x4f582b){var _0x4814da=_0x50911c[_0x98f5('0x32')][_0x98f5('0x6d')]?0x1f4:_0x4f582b[_0x98f5('0x6e')]||0x1f4;logger[_0x98f5('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x98f5('0x54'),_0x4814da,JSON['stringify'](_0x4f582b));delete _0x4f582b['name'];if(_0x4814da===0x191){_0x4814da=0x190;}_0x3e00bf['status'](_0x4814da)[_0x98f5('0x2b')](_0x50911c[_0x98f5('0x32')][_0x98f5('0x6d')]?{'message':_0x98f5('0x6f'),'statusCode':_0x4f582b[_0x98f5('0x6e')]}:_0x4f582b);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index b430f05..62264d9 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 _0x46c2=['bluebird','request-promise','rimraf','exports','define','lodash','util','moment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x46c2,0x75));var _0x246c=function(_0x274ac2,_0x4093a9){_0x274ac2=_0x274ac2-0x0;var _0x3facdc=_0x46c2[_0x274ac2];return _0x3facdc;};'use strict';var _=require(_0x246c('0x0'));var util=require(_0x246c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x246c('0x2'));var BPromise=require(_0x246c('0x3'));var rp=require(_0x246c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x246c('0x5'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x246c('0x6')]=function(_0x35baa7,_0x3c2c07){return _0x35baa7[_0x246c('0x7')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3692=['int_zendesk_accounts','util','api','bluebird','request-promise','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','define'];(function(_0x46e475,_0x303a01){var _0x4a82e8=function(_0x5111c3){while(--_0x5111c3){_0x46e475['push'](_0x46e475['shift']());}};_0x4a82e8(++_0x303a01);}(_0x3692,0xf4));var _0x2369=function(_0x517724,_0x51e5c0){_0x517724=_0x517724-0x0;var _0x4c73a5=_0x3692[_0x517724];return _0x4c73a5;};'use strict';var _=require('lodash');var util=require(_0x2369('0x0'));var logger=require('../../config/logger')(_0x2369('0x1'));var moment=require('moment');var BPromise=require(_0x2369('0x2'));var rp=require(_0x2369('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2369('0x4'));var config=require('../../config/environment');var attributes=require(_0x2369('0x5'));var integrations=require(_0x2369('0x6'));module['exports']=function(_0x4d502f,_0x19f449){return _0x4d502f[_0x2369('0x7')]('ZendeskAccount',attributes,{'tableName':_0x2369('0x8'),'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 709bf06..bb252c1 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 _0xbb6e=['include','stringify','ShowZendeskAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetZendeskAccount','ZendeskAccount','options','raw','where','attributes','limit','map','model'];(function(_0xce54ff,_0x494d55){var _0xf01ad2=function(_0x36e897){while(--_0x36e897){_0xce54ff['push'](_0xce54ff['shift']());}};_0xf01ad2(++_0x494d55);}(_0xbb6e,0xdc));var _0xebb6=function(_0x17bc5d,_0x59645e){_0x17bc5d=_0x17bc5d-0x0;var _0x2b8af0=_0xbb6e[_0x17bc5d];return _0x2b8af0;};'use strict';var _=require('lodash');var util=require(_0xebb6('0x0'));var moment=require(_0xebb6('0x1'));var BPromise=require(_0xebb6('0x2'));var rs=require(_0xebb6('0x3'));var fs=require('fs');var Redis=require(_0xebb6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xebb6('0x5'));var logger=require(_0xebb6('0x6'))(_0xebb6('0x7'));var config=require(_0xebb6('0x8'));var jayson=require(_0xebb6('0x9'));var client=jayson['client'][_0xebb6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ada66,_0x587e41,_0x1ff383){return new BPromise(function(_0x2af4c4,_0x22d4f8){return client[_0xebb6('0xb')](_0x5ada66,_0x1ff383)[_0xebb6('0xc')](function(_0x1d3ef7){logger['info'](_0xebb6('0xd'),_0x587e41,_0xebb6('0xe'));logger[_0xebb6('0xf')](_0xebb6('0x10'),_0x587e41,_0xebb6('0xe'),JSON['stringify'](_0x1d3ef7));if(_0x1d3ef7[_0xebb6('0x11')]){if(_0x1d3ef7['error'][_0xebb6('0x12')]===0x1f4){logger[_0xebb6('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x587e41,_0x1d3ef7[_0xebb6('0x11')]['message']);return _0x22d4f8(_0x1d3ef7[_0xebb6('0x11')][_0xebb6('0x13')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x587e41,_0x1d3ef7[_0xebb6('0x11')][_0xebb6('0x13')]);return _0x2af4c4(_0x1d3ef7[_0xebb6('0x11')]['message']);}else{logger[_0xebb6('0x14')]('ZendeskAccount,\x20%s,\x20%s',_0x587e41,_0xebb6('0xe'));_0x2af4c4(_0x1d3ef7[_0xebb6('0x15')]['message']);}})[_0xebb6('0x16')](function(_0x1e8e6f){logger['error'](_0xebb6('0xd'),_0x587e41,_0x1e8e6f);_0x22d4f8(_0x1e8e6f);});});}exports[_0xebb6('0x17')]=function(_0x4f25f7){var _0x368952=this;return new Promise(function(_0x29bf87,_0x368a4b){return db[_0xebb6('0x18')]['findAll']({'raw':_0x4f25f7['options']?_0x4f25f7[_0xebb6('0x19')][_0xebb6('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f25f7[_0xebb6('0x19')]?_0x4f25f7[_0xebb6('0x19')][_0xebb6('0x1b')]||null:null,'attributes':_0x4f25f7[_0xebb6('0x19')]?_0x4f25f7[_0xebb6('0x19')][_0xebb6('0x1c')]||null:null,'limit':_0x4f25f7[_0xebb6('0x19')]?_0x4f25f7[_0xebb6('0x19')][_0xebb6('0x1d')]||null:null,'include':_0x4f25f7[_0xebb6('0x19')]?_0x4f25f7[_0xebb6('0x19')]['include']?_[_0xebb6('0x1e')](_0x4f25f7[_0xebb6('0x19')]['include'],function(_0x301304){return{'model':db[_0x301304[_0xebb6('0x1f')]],'as':_0x301304['as'],'attributes':_0x301304[_0xebb6('0x1c')],'include':_0x301304[_0xebb6('0x20')]?_[_0xebb6('0x1e')](_0x301304[_0xebb6('0x20')],function(_0x39b0e3){return{'model':db[_0x39b0e3['model']],'as':_0x39b0e3['as'],'attributes':_0x39b0e3['attributes'],'include':_0x39b0e3['include']?_[_0xebb6('0x1e')](_0x39b0e3[_0xebb6('0x20')],function(_0x45bf79){return{'model':db[_0x45bf79[_0xebb6('0x1f')]],'as':_0x45bf79['as'],'attributes':_0x45bf79['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x15e3ca){logger[_0xebb6('0x14')]('GetZendeskAccount',_0x4f25f7);logger[_0xebb6('0xf')](_0xebb6('0x17'),_0x4f25f7,JSON[_0xebb6('0x21')](_0x15e3ca));_0x29bf87(_0x15e3ca);})['catch'](function(_0x4d5ce9){logger[_0xebb6('0x11')](_0xebb6('0x17'),_0x4d5ce9['message'],_0x4f25f7);_0x368a4b(_0x368952['error'](0x1f4,_0x4d5ce9[_0xebb6('0x13')]));});});};exports[_0xebb6('0x22')]=function(_0x28dc1e){var _0x52da9e=this;return new Promise(function(_0x56210a,_0x25cd6e){return db[_0xebb6('0x18')][_0xebb6('0x23')]({'raw':_0x28dc1e[_0xebb6('0x19')]?_0x28dc1e['options']['raw']===undefined?!![]:![]:!![],'where':_0x28dc1e['options']?_0x28dc1e[_0xebb6('0x19')][_0xebb6('0x1b')]||null:null,'attributes':_0x28dc1e[_0xebb6('0x19')]?_0x28dc1e[_0xebb6('0x19')][_0xebb6('0x1c')]||null:null,'include':_0x28dc1e[_0xebb6('0x19')]?_0x28dc1e[_0xebb6('0x19')][_0xebb6('0x20')]?_[_0xebb6('0x1e')](_0x28dc1e[_0xebb6('0x19')]['include'],function(_0x2123e1){return{'model':db[_0x2123e1[_0xebb6('0x1f')]],'as':_0x2123e1['as'],'attributes':_0x2123e1[_0xebb6('0x1c')],'include':_0x2123e1[_0xebb6('0x20')]?_['map'](_0x2123e1[_0xebb6('0x20')],function(_0x11812c){return{'model':db[_0x11812c[_0xebb6('0x1f')]],'as':_0x11812c['as'],'attributes':_0x11812c[_0xebb6('0x1c')],'include':_0x11812c[_0xebb6('0x20')]?_[_0xebb6('0x1e')](_0x11812c[_0xebb6('0x20')],function(_0x2c7013){return{'model':db[_0x2c7013['model']],'as':_0x2c7013['as'],'attributes':_0x2c7013['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ae329){logger['info'](_0xebb6('0x22'),_0x28dc1e);logger[_0xebb6('0xf')](_0xebb6('0x22'),_0x28dc1e,JSON[_0xebb6('0x21')](_0x2ae329));_0x56210a(_0x2ae329);})[_0xebb6('0x16')](function(_0x12299e){logger[_0xebb6('0x11')]('ShowZendeskAccount',_0x12299e[_0xebb6('0x13')],_0x28dc1e);_0x25cd6e(_0x52da9e[_0xebb6('0x11')](0x1f4,_0x12299e[_0xebb6('0x13')]));});});}; \ No newline at end of file +var _0x9663=['raw','limit','include','map','model','attributes','GetZendeskAccount','debug','stringify','ShowZendeskAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ZendeskAccount','options'];(function(_0x67e90a,_0x5328b6){var _0x359bdc=function(_0x41467b){while(--_0x41467b){_0x67e90a['push'](_0x67e90a['shift']());}};_0x359bdc(++_0x5328b6);}(_0x9663,0xe3));var _0x3966=function(_0x2a392d,_0x4f943a){_0x2a392d=_0x2a392d-0x0;var _0x187948=_0x9663[_0x2a392d];return _0x187948;};'use strict';var _=require(_0x3966('0x0'));var util=require(_0x3966('0x1'));var moment=require(_0x3966('0x2'));var BPromise=require(_0x3966('0x3'));var rs=require(_0x3966('0x4'));var fs=require('fs');var Redis=require(_0x3966('0x5'));var db=require(_0x3966('0x6'))['db'];var utils=require(_0x3966('0x7'));var logger=require(_0x3966('0x8'))(_0x3966('0x9'));var config=require('../../config/environment');var jayson=require(_0x3966('0xa'));var client=jayson[_0x3966('0xb')][_0x3966('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x17bc19,_0x427dd0,_0x112c25){return new BPromise(function(_0x4f7c69,_0x4d449a){return client['request'](_0x17bc19,_0x112c25)[_0x3966('0xd')](function(_0x19ac9c){logger[_0x3966('0xe')](_0x3966('0xf'),_0x427dd0,_0x3966('0x10'));logger['debug'](_0x3966('0x11'),_0x427dd0,_0x3966('0x10'),JSON['stringify'](_0x19ac9c));if(_0x19ac9c[_0x3966('0x12')]){if(_0x19ac9c[_0x3966('0x12')][_0x3966('0x13')]===0x1f4){logger[_0x3966('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x427dd0,_0x19ac9c['error'][_0x3966('0x14')]);return _0x4d449a(_0x19ac9c[_0x3966('0x12')]['message']);}logger['error'](_0x3966('0xf'),_0x427dd0,_0x19ac9c[_0x3966('0x12')][_0x3966('0x14')]);return _0x4f7c69(_0x19ac9c[_0x3966('0x12')][_0x3966('0x14')]);}else{logger[_0x3966('0xe')](_0x3966('0xf'),_0x427dd0,'request\x20sent');_0x4f7c69(_0x19ac9c[_0x3966('0x15')][_0x3966('0x14')]);}})[_0x3966('0x16')](function(_0x37dd36){logger[_0x3966('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x427dd0,_0x37dd36);_0x4d449a(_0x37dd36);});});}exports['GetZendeskAccount']=function(_0xefd7a6){var _0xf573d9=this;return new Promise(function(_0x364b2a,_0x7f71be){return db[_0x3966('0x17')]['findAll']({'raw':_0xefd7a6[_0x3966('0x18')]?_0xefd7a6[_0x3966('0x18')][_0x3966('0x19')]===undefined?!![]:![]:!![],'where':_0xefd7a6['options']?_0xefd7a6[_0x3966('0x18')]['where']||null:null,'attributes':_0xefd7a6[_0x3966('0x18')]?_0xefd7a6[_0x3966('0x18')]['attributes']||null:null,'limit':_0xefd7a6[_0x3966('0x18')]?_0xefd7a6[_0x3966('0x18')][_0x3966('0x1a')]||null:null,'include':_0xefd7a6[_0x3966('0x18')]?_0xefd7a6[_0x3966('0x18')][_0x3966('0x1b')]?_[_0x3966('0x1c')](_0xefd7a6['options']['include'],function(_0x431fc9){return{'model':db[_0x431fc9[_0x3966('0x1d')]],'as':_0x431fc9['as'],'attributes':_0x431fc9['attributes'],'include':_0x431fc9[_0x3966('0x1b')]?_[_0x3966('0x1c')](_0x431fc9['include'],function(_0x3702ce){return{'model':db[_0x3702ce['model']],'as':_0x3702ce['as'],'attributes':_0x3702ce[_0x3966('0x1e')],'include':_0x3702ce['include']?_[_0x3966('0x1c')](_0x3702ce[_0x3966('0x1b')],function(_0x3459e2){return{'model':db[_0x3459e2[_0x3966('0x1d')]],'as':_0x3459e2['as'],'attributes':_0x3459e2['attributes']};}):[]};}):[]};}):[]:[]})[_0x3966('0xd')](function(_0x2a80c0){logger[_0x3966('0xe')](_0x3966('0x1f'),_0xefd7a6);logger[_0x3966('0x20')](_0x3966('0x1f'),_0xefd7a6,JSON[_0x3966('0x21')](_0x2a80c0));_0x364b2a(_0x2a80c0);})[_0x3966('0x16')](function(_0x42d1ed){logger[_0x3966('0x12')]('GetZendeskAccount',_0x42d1ed[_0x3966('0x14')],_0xefd7a6);_0x7f71be(_0xf573d9[_0x3966('0x12')](0x1f4,_0x42d1ed['message']));});});};exports[_0x3966('0x22')]=function(_0x43949d){var _0x1a167e=this;return new Promise(function(_0x47c3ba,_0x4fb114){return db['ZendeskAccount']['find']({'raw':_0x43949d[_0x3966('0x18')]?_0x43949d[_0x3966('0x18')][_0x3966('0x19')]===undefined?!![]:![]:!![],'where':_0x43949d[_0x3966('0x18')]?_0x43949d['options'][_0x3966('0x23')]||null:null,'attributes':_0x43949d[_0x3966('0x18')]?_0x43949d[_0x3966('0x18')][_0x3966('0x1e')]||null:null,'include':_0x43949d[_0x3966('0x18')]?_0x43949d[_0x3966('0x18')][_0x3966('0x1b')]?_[_0x3966('0x1c')](_0x43949d[_0x3966('0x18')][_0x3966('0x1b')],function(_0x1b6ddd){return{'model':db[_0x1b6ddd['model']],'as':_0x1b6ddd['as'],'attributes':_0x1b6ddd['attributes'],'include':_0x1b6ddd[_0x3966('0x1b')]?_[_0x3966('0x1c')](_0x1b6ddd[_0x3966('0x1b')],function(_0x3e02e0){return{'model':db[_0x3e02e0[_0x3966('0x1d')]],'as':_0x3e02e0['as'],'attributes':_0x3e02e0[_0x3966('0x1e')],'include':_0x3e02e0['include']?_['map'](_0x3e02e0[_0x3966('0x1b')],function(_0x27d152){return{'model':db[_0x27d152[_0x3966('0x1d')]],'as':_0x27d152['as'],'attributes':_0x27d152['attributes']};}):[]};}):[]};}):[]:[]})[_0x3966('0xd')](function(_0x450285){logger[_0x3966('0xe')]('ShowZendeskAccount',_0x43949d);logger[_0x3966('0x20')](_0x3966('0x22'),_0x43949d,JSON[_0x3966('0x21')](_0x450285));_0x47c3ba(_0x450285);})[_0x3966('0x16')](function(_0x229642){logger[_0x3966('0x12')](_0x3966('0x22'),_0x229642['message'],_0x43949d);_0x4fb114(_0x1a167e[_0x3966('0x12')](0x1f4,_0x229642[_0x3966('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 8632c05..4373fd9 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5b5=['../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x522e5f,_0x12cab5){var _0x2d0dd2=function(_0x44caed){while(--_0x44caed){_0x522e5f['push'](_0x522e5f['shift']());}};_0x2d0dd2(++_0x12cab5);}(_0xe5b5,0x12b));var _0x5e5b=function(_0xa3fadc,_0xd1e16){_0xa3fadc=_0xa3fadc-0x0;var _0x23ecb8=_0xe5b5[_0xa3fadc];return _0x23ecb8;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/subjects',auth[_0x5e5b('0xc')](),controller['getSubjects']);router[_0x5e5b('0xb')](_0x5e5b('0x12'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x13')]);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x5e5b('0x14')]);router[_0x5e5b('0x15')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x16')]);router[_0x5e5b('0x15')](_0x5e5b('0x17'),auth[_0x5e5b('0xc')](),controller['setTags']);router[_0x5e5b('0x18')](_0x5e5b('0xe'),auth['isAuthenticated'](),controller[_0x5e5b('0x19')]);router['delete']('/:id',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x1a')]);module[_0x5e5b('0x1b')]=router; \ No newline at end of file +var _0xea28=['Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x40fd0b,_0xd176ee){var _0x54cbf6=function(_0x153a66){while(--_0x153a66){_0x40fd0b['push'](_0x40fd0b['shift']());}};_0x54cbf6(++_0xd176ee);}(_0xea28,0x13a));var _0x8ea2=function(_0x204b54,_0x448f4c){_0x204b54=_0x204b54-0x0;var _0x2ac5da=_0xea28[_0x204b54];return _0x2ac5da;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getSubjects']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['get'](_0x8ea2('0x14'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x15')]);router[_0x8ea2('0x16')]('/',auth[_0x8ea2('0xd')](),controller['create']);router[_0x8ea2('0x16')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8ea2('0x17')]);router[_0x8ea2('0x18')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x1b')]);module[_0x8ea2('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index e7d35ee..a8cfc4c 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 _0xa711=['STRING','sequelize'];(function(_0x2c6484,_0x4fe72c){var _0x3b9d94=function(_0x3d8bd4){while(--_0x3d8bd4){_0x2c6484['push'](_0x2c6484['shift']());}};_0x3b9d94(++_0x4fe72c);}(_0xa711,0x169));var _0x1a71=function(_0x4456bb,_0x15ee5a){_0x4456bb=_0x4456bb-0x0;var _0x2d6a88=_0xa711[_0x4456bb];return _0x2d6a88;};'use strict';var Sequelize=require(_0x1a71('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a71('0x1')]},'description':{'type':Sequelize[_0x1a71('0x1')]}}; \ No newline at end of file +var _0x2655=['exports','STRING','sequelize'];(function(_0x73f87f,_0x2eb5c5){var _0x11899b=function(_0x5b2560){while(--_0x5b2560){_0x73f87f['push'](_0x73f87f['shift']());}};_0x11899b(++_0x2eb5c5);}(_0x2655,0x1e2));var _0x5265=function(_0x33d17f,_0x14fcdb){_0x33d17f=_0x33d17f-0x0;var _0x1187fe=_0x2655[_0x33d17f];return _0x1187fe;};'use strict';var Sequelize=require(_0x5265('0x0'));module[_0x5265('0x1')]={'name':{'type':Sequelize[_0x5265('0x2')]},'description':{'type':Sequelize[_0x5265('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index ae3a88c..b1251bf 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 _0x7c6d=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','getFields','findOne','getSubjects','ZendeskField','rawAttributes','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','error','stack','name','send','index','map','ZendeskConfiguration','fieldName','type','model','query','keys'];(function(_0x48c938,_0x14ac2c){var _0x5625b2=function(_0x3edffd){while(--_0x3edffd){_0x48c938['push'](_0x48c938['shift']());}};_0x5625b2(++_0x14ac2c);}(_0x7c6d,0xd0));var _0xd7c6=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x7c6d[_0x24061a];return _0x82054e;};'use strict';var emlformat=require(_0xd7c6('0x0'));var rimraf=require(_0xd7c6('0x1'));var zipdir=require(_0xd7c6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd7c6('0x3'));var moment=require(_0xd7c6('0x4'));var BPromise=require(_0xd7c6('0x5'));var Mustache=require(_0xd7c6('0x6'));var util=require('util');var path=require(_0xd7c6('0x7'));var sox=require(_0xd7c6('0x8'));var csv=require(_0xd7c6('0x9'));var ejs=require(_0xd7c6('0xa'));var fs=require('fs');var fs_extra=require(_0xd7c6('0xb'));var _=require(_0xd7c6('0xc'));var squel=require(_0xd7c6('0xd'));var crypto=require(_0xd7c6('0xe'));var jsforce=require(_0xd7c6('0xf'));var deskjs=require(_0xd7c6('0x10'));var toCsv=require(_0xd7c6('0x9'));var querystring=require('querystring');var Papa=require(_0xd7c6('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd7c6('0x12'));var as=require(_0xd7c6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd7c6('0x14'))(_0xd7c6('0x15'));var utils=require(_0xd7c6('0x16'));var config=require(_0xd7c6('0x17'));var licenseUtil=require(_0xd7c6('0x18'));var db=require(_0xd7c6('0x19'))['db'];function respondWithStatusCode(_0x3d346b,_0x16a449){_0x16a449=_0x16a449||0xcc;return function(_0x1839bc){if(_0x1839bc){return _0x3d346b[_0xd7c6('0x1a')](_0x16a449);}return _0x3d346b[_0xd7c6('0x1b')](_0x16a449)[_0xd7c6('0x1c')]();};}function respondWithResult(_0x29f7d1,_0x31c8d9){_0x31c8d9=_0x31c8d9||0xc8;return function(_0x571582){if(_0x571582){return _0x29f7d1['status'](_0x31c8d9)[_0xd7c6('0x1d')](_0x571582);}};}function respondWithFilteredResult(_0x58f3f4,_0x227bd6){return function(_0x30a87e){if(_0x30a87e){var _0x3684ff=typeof _0x227bd6[_0xd7c6('0x1e')]===_0xd7c6('0x1f')&&typeof _0x227bd6[_0xd7c6('0x20')]==='undefined';var _0x4e4645=_0x30a87e[_0xd7c6('0x21')];var _0x5474e5=_0x3684ff?0x0:_0x227bd6[_0xd7c6('0x1e')];var _0x4c84a4=_0x3684ff?_0x30a87e[_0xd7c6('0x21')]:_0x227bd6[_0xd7c6('0x1e')]+_0x227bd6[_0xd7c6('0x20')];var _0x47d41b;if(_0x4c84a4>=_0x4e4645){_0x4c84a4=_0x4e4645;_0x47d41b=0xc8;}else{_0x47d41b=0xce;}_0x58f3f4['status'](_0x47d41b);return _0x58f3f4[_0xd7c6('0x22')](_0xd7c6('0x23'),_0x5474e5+'-'+_0x4c84a4+'/'+_0x4e4645)[_0xd7c6('0x1d')](_0x30a87e);}return null;};}function patchUpdates(_0x4f4bd8){return function(_0x14dbc1){try{jsonpatch['apply'](_0x14dbc1,_0x4f4bd8,!![]);}catch(_0x1f82e9){return BPromise[_0xd7c6('0x24')](_0x1f82e9);}return _0x14dbc1['save']();};}function saveUpdates(_0x2a2aa7,_0x42f8bd){return function(_0x11ab49){if(_0x11ab49){return _0x11ab49[_0xd7c6('0x25')](_0x2a2aa7)['then'](function(_0x3fef95){return _0x3fef95;});}return null;};}function removeEntity(_0x59754a,_0x98383e){return function(_0x2787b1){if(_0x2787b1){return _0x2787b1['destroy']()['then'](function(){_0x59754a[_0xd7c6('0x1b')](0xcc)[_0xd7c6('0x1c')]();});}};}function handleEntityNotFound(_0x4338f0,_0x191492){return function(_0x4a509a){if(!_0x4a509a){_0x4338f0[_0xd7c6('0x1a')](0x194);}return _0x4a509a;};}function handleError(_0x51b93a,_0x13662b){_0x13662b=_0x13662b||0x1f4;return function(_0x5098ad){logger[_0xd7c6('0x26')](_0x5098ad[_0xd7c6('0x27')]);if(_0x5098ad['name']){delete _0x5098ad[_0xd7c6('0x28')];}_0x51b93a[_0xd7c6('0x1b')](_0x13662b)[_0xd7c6('0x29')](_0x5098ad);};}exports[_0xd7c6('0x2a')]=function(_0x5b767e,_0x1a0634){var _0x4b9736={},_0x1e9fb8={},_0x489273={'count':0x0,'rows':[]};var _0x296fea=_[_0xd7c6('0x2b')](db[_0xd7c6('0x2c')]['rawAttributes'],function(_0x28947b){return{'name':_0x28947b[_0xd7c6('0x2d')],'type':_0x28947b[_0xd7c6('0x2e')]['key']};});_0x1e9fb8[_0xd7c6('0x2f')]=_['map'](_0x296fea,_0xd7c6('0x28'));_0x1e9fb8[_0xd7c6('0x30')]=_[_0xd7c6('0x31')](_0x5b767e[_0xd7c6('0x30')]);_0x1e9fb8[_0xd7c6('0x32')]=_[_0xd7c6('0x33')](_0x1e9fb8[_0xd7c6('0x2f')],_0x1e9fb8[_0xd7c6('0x30')]);_0x4b9736[_0xd7c6('0x34')]=_['intersection'](_0x1e9fb8[_0xd7c6('0x2f')],qs[_0xd7c6('0x35')](_0x5b767e[_0xd7c6('0x30')][_0xd7c6('0x35')]));_0x4b9736[_0xd7c6('0x34')]=_0x4b9736['attributes'][_0xd7c6('0x36')]?_0x4b9736[_0xd7c6('0x34')]:_0x1e9fb8[_0xd7c6('0x2f')];if(!_0x5b767e['query'][_0xd7c6('0x37')](_0xd7c6('0x38'))){_0x4b9736[_0xd7c6('0x20')]=qs[_0xd7c6('0x20')](_0x5b767e[_0xd7c6('0x30')]['limit']);_0x4b9736[_0xd7c6('0x1e')]=qs[_0xd7c6('0x1e')](_0x5b767e[_0xd7c6('0x30')][_0xd7c6('0x1e')]);}_0x4b9736[_0xd7c6('0x39')]=qs['sort'](_0x5b767e['query'][_0xd7c6('0x3a')]);_0x4b9736[_0xd7c6('0x3b')]=qs[_0xd7c6('0x32')](_[_0xd7c6('0x3c')](_0x5b767e['query'],_0x1e9fb8['filters']),_0x296fea);if(_0x5b767e['query'][_0xd7c6('0x3d')]){_0x4b9736[_0xd7c6('0x3b')]=_[_0xd7c6('0x3e')](_0x4b9736['where'],{'$or':_[_0xd7c6('0x2b')](_0x296fea,function(_0x2634b9){if(_0x2634b9['type']!==_0xd7c6('0x3f')){var _0x4ba442={};_0x4ba442[_0x2634b9[_0xd7c6('0x28')]]={'$like':'%'+_0x5b767e[_0xd7c6('0x30')][_0xd7c6('0x3d')]+'%'};return _0x4ba442;}})});}_0x4b9736=_[_0xd7c6('0x3e')]({},_0x4b9736,_0x5b767e[_0xd7c6('0x40')]);var _0x2e3281={'where':_0x4b9736[_0xd7c6('0x3b')]};return db['ZendeskConfiguration'][_0xd7c6('0x21')](_0x2e3281)[_0xd7c6('0x41')](function(_0x48035a){_0x489273[_0xd7c6('0x21')]=_0x48035a;if(_0x5b767e[_0xd7c6('0x30')][_0xd7c6('0x42')]){_0x4b9736[_0xd7c6('0x43')]=[{'all':!![]}];}return db[_0xd7c6('0x2c')][_0xd7c6('0x44')](_0x4b9736);})['then'](function(_0x753ab8){_0x489273[_0xd7c6('0x45')]=_0x753ab8;return _0x489273;})[_0xd7c6('0x41')](respondWithFilteredResult(_0x1a0634,_0x4b9736))['catch'](handleError(_0x1a0634,null));};exports[_0xd7c6('0x46')]=function(_0x432b3a,_0x5437f8){var _0x5347e6={'raw':![],'where':{'id':_0x432b3a[_0xd7c6('0x47')]['id']}},_0x4ad959={};_0x4ad959['model']=_[_0xd7c6('0x31')](db[_0xd7c6('0x2c')]['rawAttributes']);_0x4ad959[_0xd7c6('0x30')]=_[_0xd7c6('0x31')](_0x432b3a[_0xd7c6('0x30')]);_0x4ad959[_0xd7c6('0x32')]=_['intersection'](_0x4ad959[_0xd7c6('0x2f')],_0x4ad959[_0xd7c6('0x30')]);_0x5347e6['attributes']=_[_0xd7c6('0x33')](_0x4ad959[_0xd7c6('0x2f')],qs[_0xd7c6('0x35')](_0x432b3a['query'][_0xd7c6('0x35')]));_0x5347e6['attributes']=_0x5347e6[_0xd7c6('0x34')][_0xd7c6('0x36')]?_0x5347e6[_0xd7c6('0x34')]:_0x4ad959[_0xd7c6('0x2f')];if(_0x432b3a[_0xd7c6('0x30')][_0xd7c6('0x42')]){_0x5347e6['include']=[{'all':!![]}];}_0x5347e6=_[_0xd7c6('0x3e')]({},_0x5347e6,_0x432b3a[_0xd7c6('0x40')]);return db[_0xd7c6('0x2c')][_0xd7c6('0x48')](_0x5347e6)[_0xd7c6('0x41')](handleEntityNotFound(_0x5437f8,null))[_0xd7c6('0x41')](respondWithResult(_0x5437f8,null))[_0xd7c6('0x49')](handleError(_0x5437f8,null));};exports[_0xd7c6('0x4a')]=function(_0x30bd75,_0x2c3133){return db[_0xd7c6('0x2c')][_0xd7c6('0x4a')](_0x30bd75[_0xd7c6('0x4b')],{})[_0xd7c6('0x41')](respondWithResult(_0x2c3133,0xc9))[_0xd7c6('0x49')](handleError(_0x2c3133,null));};exports[_0xd7c6('0x25')]=function(_0x16838d,_0x3af84c){if(_0x16838d[_0xd7c6('0x4b')]['id']){delete _0x16838d[_0xd7c6('0x4b')]['id'];}return db['ZendeskConfiguration'][_0xd7c6('0x48')]({'where':{'id':_0x16838d['params']['id']}})[_0xd7c6('0x41')](handleEntityNotFound(_0x3af84c,null))[_0xd7c6('0x41')](saveUpdates(_0x16838d[_0xd7c6('0x4b')],null))[_0xd7c6('0x41')](respondWithResult(_0x3af84c,null))[_0xd7c6('0x49')](handleError(_0x3af84c,null));};exports[_0xd7c6('0x4c')]=function(_0x1da2e5,_0xeb81be){return db['ZendeskConfiguration'][_0xd7c6('0x48')]({'where':{'id':_0x1da2e5[_0xd7c6('0x47')]['id']}})[_0xd7c6('0x41')](handleEntityNotFound(_0xeb81be,null))[_0xd7c6('0x41')](removeEntity(_0xeb81be,null))[_0xd7c6('0x49')](handleError(_0xeb81be,null));};exports[_0xd7c6('0x4d')]=function(_0x1ffb54,_0x1ec595,_0xd0a9a7){var _0x350191={};var _0x3b1994={};var _0x122695;var _0xbb1c0d;return db[_0xd7c6('0x2c')][_0xd7c6('0x4e')]({'where':{'id':_0x1ffb54[_0xd7c6('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ec595,null))['then'](function(_0x5b4d11){if(_0x5b4d11){_0x122695=_0x5b4d11;_0x3b1994['model']=_['keys'](db['ZendeskField']['rawAttributes']);_0x3b1994[_0xd7c6('0x30')]=_[_0xd7c6('0x31')](_0x1ffb54['query']);_0x3b1994[_0xd7c6('0x32')]=_[_0xd7c6('0x33')](_0x3b1994[_0xd7c6('0x2f')],_0x3b1994['query']);_0x350191[_0xd7c6('0x34')]=_['intersection'](_0x3b1994[_0xd7c6('0x2f')],qs[_0xd7c6('0x35')](_0x1ffb54[_0xd7c6('0x30')][_0xd7c6('0x35')]));_0x350191[_0xd7c6('0x34')]=_0x350191[_0xd7c6('0x34')][_0xd7c6('0x36')]?_0x350191[_0xd7c6('0x34')]:_0x3b1994['model'];_0x350191[_0xd7c6('0x39')]=qs[_0xd7c6('0x3a')](_0x1ffb54[_0xd7c6('0x30')]['sort']);_0x350191[_0xd7c6('0x3b')]=qs['filters'](_[_0xd7c6('0x3c')](_0x1ffb54[_0xd7c6('0x30')],_0x3b1994['filters']));if(_0x1ffb54[_0xd7c6('0x30')][_0xd7c6('0x3d')]){_0x350191[_0xd7c6('0x3b')]=_[_0xd7c6('0x3e')](_0x350191[_0xd7c6('0x3b')],{'$or':_['map'](_0x350191[_0xd7c6('0x34')],function(_0x14aed9){var _0x3f4f97={};_0x3f4f97[_0x14aed9]={'$like':'%'+_0x1ffb54[_0xd7c6('0x30')][_0xd7c6('0x3d')]+'%'};return _0x3f4f97;})});}_0x350191=_[_0xd7c6('0x3e')]({},_0x350191,_0x1ffb54['options']);return _0x122695[_0xd7c6('0x4d')](_0x350191);}})['then'](function(_0x2831f1){if(_0x2831f1){_0xbb1c0d=_0x2831f1[_0xd7c6('0x36')];if(!_0x1ffb54[_0xd7c6('0x30')]['hasOwnProperty']('nolimit')){_0x350191[_0xd7c6('0x20')]=qs[_0xd7c6('0x20')](_0x1ffb54['query']['limit']);_0x350191[_0xd7c6('0x1e')]=qs[_0xd7c6('0x1e')](_0x1ffb54['query'][_0xd7c6('0x1e')]);}return _0x122695[_0xd7c6('0x4d')](_0x350191);}})[_0xd7c6('0x41')](function(_0x2d6c48){if(_0x2d6c48){return _0x2d6c48?{'count':_0xbb1c0d,'rows':_0x2d6c48}:null;}})[_0xd7c6('0x41')](respondWithResult(_0x1ec595,null))[_0xd7c6('0x49')](handleError(_0x1ec595,null));};exports[_0xd7c6('0x4f')]=function(_0x3caaf1,_0x4a7a12,_0x186eb9){var _0x996c16={};var _0x428f8c={};var _0x1d6e68;var _0x3b3a4d;return db['ZendeskConfiguration'][_0xd7c6('0x4e')]({'where':{'id':_0x3caaf1[_0xd7c6('0x47')]['id']}})[_0xd7c6('0x41')](handleEntityNotFound(_0x4a7a12,null))[_0xd7c6('0x41')](function(_0x2b10a3){if(_0x2b10a3){_0x1d6e68=_0x2b10a3;_0x428f8c['model']=_[_0xd7c6('0x31')](db[_0xd7c6('0x50')][_0xd7c6('0x51')]);_0x428f8c[_0xd7c6('0x30')]=_[_0xd7c6('0x31')](_0x3caaf1['query']);_0x428f8c[_0xd7c6('0x32')]=_[_0xd7c6('0x33')](_0x428f8c['model'],_0x428f8c['query']);_0x996c16['attributes']=_[_0xd7c6('0x33')](_0x428f8c['model'],qs[_0xd7c6('0x35')](_0x3caaf1['query'][_0xd7c6('0x35')]));_0x996c16[_0xd7c6('0x34')]=_0x996c16[_0xd7c6('0x34')][_0xd7c6('0x36')]?_0x996c16[_0xd7c6('0x34')]:_0x428f8c[_0xd7c6('0x2f')];_0x996c16[_0xd7c6('0x39')]=qs[_0xd7c6('0x3a')](_0x3caaf1[_0xd7c6('0x30')][_0xd7c6('0x3a')]);_0x996c16['where']=qs[_0xd7c6('0x32')](_['pick'](_0x3caaf1['query'],_0x428f8c[_0xd7c6('0x32')]));if(_0x3caaf1['query'][_0xd7c6('0x3d')]){_0x996c16[_0xd7c6('0x3b')]=_[_0xd7c6('0x3e')](_0x996c16[_0xd7c6('0x3b')],{'$or':_[_0xd7c6('0x2b')](_0x996c16[_0xd7c6('0x34')],function(_0x168cc9){var _0x159032={};_0x159032[_0x168cc9]={'$like':'%'+_0x3caaf1[_0xd7c6('0x30')][_0xd7c6('0x3d')]+'%'};return _0x159032;})});}_0x996c16=_[_0xd7c6('0x3e')]({},_0x996c16,_0x3caaf1['options']);return _0x1d6e68[_0xd7c6('0x4f')](_0x996c16);}})[_0xd7c6('0x41')](function(_0x5def10){if(_0x5def10){_0x3b3a4d=_0x5def10['length'];if(!_0x3caaf1[_0xd7c6('0x30')]['hasOwnProperty'](_0xd7c6('0x38'))){_0x996c16[_0xd7c6('0x20')]=qs[_0xd7c6('0x20')](_0x3caaf1['query'][_0xd7c6('0x20')]);_0x996c16[_0xd7c6('0x1e')]=qs[_0xd7c6('0x1e')](_0x3caaf1[_0xd7c6('0x30')]['offset']);}return _0x1d6e68[_0xd7c6('0x4f')](_0x996c16);}})['then'](function(_0xbc73f5){if(_0xbc73f5){return _0xbc73f5?{'count':_0x3b3a4d,'rows':_0xbc73f5}:null;}})[_0xd7c6('0x41')](respondWithResult(_0x4a7a12,null))[_0xd7c6('0x49')](handleError(_0x4a7a12,null));};exports[_0xd7c6('0x52')]=function(_0x42a15e,_0x294f5e,_0x321bb6){var _0x4cf92e={};var _0x2adf49={};var _0x510379;var _0x4dda68;return db[_0xd7c6('0x2c')][_0xd7c6('0x4e')]({'where':{'id':_0x42a15e[_0xd7c6('0x47')]['id']}})[_0xd7c6('0x41')](handleEntityNotFound(_0x294f5e,null))[_0xd7c6('0x41')](function(_0x23eef2){if(_0x23eef2){_0x510379=_0x23eef2;_0x2adf49[_0xd7c6('0x2f')]=_['keys'](db[_0xd7c6('0x50')][_0xd7c6('0x51')]);_0x2adf49[_0xd7c6('0x30')]=_[_0xd7c6('0x31')](_0x42a15e[_0xd7c6('0x30')]);_0x2adf49[_0xd7c6('0x32')]=_['intersection'](_0x2adf49[_0xd7c6('0x2f')],_0x2adf49[_0xd7c6('0x30')]);_0x4cf92e[_0xd7c6('0x34')]=_['intersection'](_0x2adf49[_0xd7c6('0x2f')],qs['fields'](_0x42a15e[_0xd7c6('0x30')]['fields']));_0x4cf92e[_0xd7c6('0x34')]=_0x4cf92e[_0xd7c6('0x34')]['length']?_0x4cf92e[_0xd7c6('0x34')]:_0x2adf49[_0xd7c6('0x2f')];_0x4cf92e[_0xd7c6('0x39')]=qs[_0xd7c6('0x3a')](_0x42a15e[_0xd7c6('0x30')][_0xd7c6('0x3a')]);_0x4cf92e[_0xd7c6('0x3b')]=qs['filters'](_[_0xd7c6('0x3c')](_0x42a15e[_0xd7c6('0x30')],_0x2adf49[_0xd7c6('0x32')]));if(_0x42a15e[_0xd7c6('0x30')][_0xd7c6('0x3d')]){_0x4cf92e['where']=_[_0xd7c6('0x3e')](_0x4cf92e[_0xd7c6('0x3b')],{'$or':_[_0xd7c6('0x2b')](_0x4cf92e[_0xd7c6('0x34')],function(_0x51041c){var _0x2cec21={};_0x2cec21[_0x51041c]={'$like':'%'+_0x42a15e[_0xd7c6('0x30')][_0xd7c6('0x3d')]+'%'};return _0x2cec21;})});}_0x4cf92e=_[_0xd7c6('0x3e')]({},_0x4cf92e,_0x42a15e['options']);return _0x510379[_0xd7c6('0x52')](_0x4cf92e);}})[_0xd7c6('0x41')](function(_0xcb8c23){if(_0xcb8c23){_0x4dda68=_0xcb8c23[_0xd7c6('0x36')];if(!_0x42a15e[_0xd7c6('0x30')][_0xd7c6('0x37')](_0xd7c6('0x38'))){_0x4cf92e[_0xd7c6('0x20')]=qs[_0xd7c6('0x20')](_0x42a15e[_0xd7c6('0x30')][_0xd7c6('0x20')]);_0x4cf92e['offset']=qs[_0xd7c6('0x1e')](_0x42a15e[_0xd7c6('0x30')][_0xd7c6('0x1e')]);}return _0x510379[_0xd7c6('0x52')](_0x4cf92e);}})[_0xd7c6('0x41')](function(_0x189db6){if(_0x189db6){return _0x189db6?{'count':_0x4dda68,'rows':_0x189db6}:null;}})[_0xd7c6('0x41')](respondWithResult(_0x294f5e,null))['catch'](handleError(_0x294f5e,null));};exports['getTags']=function(_0x248d4c,_0x1084c4,_0x3def36){var _0x48a010={};var _0x1c0c0f={};var _0x286b11;var _0x4d20fe;return db[_0xd7c6('0x2c')][_0xd7c6('0x4e')]({'where':{'id':_0x248d4c['params']['id']}})[_0xd7c6('0x41')](handleEntityNotFound(_0x1084c4,null))[_0xd7c6('0x41')](function(_0x29b879){if(_0x29b879){_0x286b11=_0x29b879;_0x1c0c0f[_0xd7c6('0x2f')]=_[_0xd7c6('0x31')](db[_0xd7c6('0x53')][_0xd7c6('0x51')]);_0x1c0c0f[_0xd7c6('0x30')]=_[_0xd7c6('0x31')](_0x248d4c[_0xd7c6('0x30')]);_0x1c0c0f['filters']=_['intersection'](_0x1c0c0f['model'],_0x1c0c0f[_0xd7c6('0x30')]);_0x48a010['attributes']=_['intersection'](_0x1c0c0f[_0xd7c6('0x2f')],qs[_0xd7c6('0x35')](_0x248d4c['query'][_0xd7c6('0x35')]));_0x48a010[_0xd7c6('0x34')]=_0x48a010['attributes'][_0xd7c6('0x36')]?_0x48a010['attributes']:_0x1c0c0f[_0xd7c6('0x2f')];_0x48a010[_0xd7c6('0x39')]=qs[_0xd7c6('0x3a')](_0x248d4c['query'][_0xd7c6('0x3a')]);_0x48a010[_0xd7c6('0x3b')]=qs[_0xd7c6('0x32')](_['pick'](_0x248d4c[_0xd7c6('0x30')],_0x1c0c0f['filters']));if(_0x248d4c[_0xd7c6('0x30')][_0xd7c6('0x3d')]){_0x48a010[_0xd7c6('0x3b')]=_[_0xd7c6('0x3e')](_0x48a010[_0xd7c6('0x3b')],{'$or':_[_0xd7c6('0x2b')](_0x48a010[_0xd7c6('0x34')],function(_0x1182e0){var _0x37ae2b={};_0x37ae2b[_0x1182e0]={'$like':'%'+_0x248d4c['query']['filter']+'%'};return _0x37ae2b;})});}_0x48a010=_['merge']({},_0x48a010,_0x248d4c[_0xd7c6('0x40')]);return _0x286b11[_0xd7c6('0x54')](_0x48a010);}})[_0xd7c6('0x41')](function(_0x4e0457){if(_0x4e0457){_0x4d20fe=_0x4e0457['length'];if(!_0x248d4c[_0xd7c6('0x30')][_0xd7c6('0x37')]('nolimit')){_0x48a010['limit']=qs['limit'](_0x248d4c[_0xd7c6('0x30')][_0xd7c6('0x20')]);_0x48a010[_0xd7c6('0x1e')]=qs[_0xd7c6('0x1e')](_0x248d4c[_0xd7c6('0x30')]['offset']);}return _0x286b11[_0xd7c6('0x54')](_0x48a010);}})['then'](function(_0x45e5c7){if(_0x45e5c7){return _0x45e5c7?{'count':_0x4d20fe,'rows':_0x45e5c7}:null;}})['then'](respondWithResult(_0x1084c4,null))['catch'](handleError(_0x1084c4,null));};exports['setTags']=function(_0x3757aa,_0x482975,_0x23c2d3){if(_0x3757aa[_0xd7c6('0x4b')]['id']){delete _0x3757aa['body']['id'];}return db[_0xd7c6('0x2c')]['findOne']({'where':{'id':_0x3757aa[_0xd7c6('0x47')]['id']}})[_0xd7c6('0x41')](handleEntityNotFound(_0x482975,null))[_0xd7c6('0x41')](function(_0x3dc5ad){if(_0x3dc5ad){return _0x3dc5ad[_0xd7c6('0x55')](_0x3757aa[_0xd7c6('0x4b')]['ids']||[]);}return null;})['then'](respondWithResult(_0x482975,null))[_0xd7c6('0x49')](handleError(_0x482975,null));}; \ No newline at end of file +var _0x76ce=['../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','ZendeskConfiguration','type','key','map','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','destroy','getFields','findOne','order','sort','length','getSubjects','getDescriptions','ZendeskField','getTags','setTags','ids','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/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x76ce,0x99));var _0xe76c=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0x76ce[_0x102e37];return _0x35a07c;};'use strict';var emlformat=require(_0xe76c('0x0'));var rimraf=require(_0xe76c('0x1'));var zipdir=require(_0xe76c('0x2'));var jsonpatch=require(_0xe76c('0x3'));var rp=require(_0xe76c('0x4'));var moment=require(_0xe76c('0x5'));var BPromise=require(_0xe76c('0x6'));var Mustache=require(_0xe76c('0x7'));var util=require(_0xe76c('0x8'));var path=require(_0xe76c('0x9'));var sox=require(_0xe76c('0xa'));var csv=require(_0xe76c('0xb'));var ejs=require(_0xe76c('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe76c('0xd'));var squel=require(_0xe76c('0xe'));var crypto=require(_0xe76c('0xf'));var jsforce=require(_0xe76c('0x10'));var deskjs=require(_0xe76c('0x11'));var toCsv=require(_0xe76c('0xb'));var querystring=require(_0xe76c('0x12'));var Papa=require('papaparse');var Redis=require(_0xe76c('0x13'));var authService=require(_0xe76c('0x14'));var qs=require(_0xe76c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe76c('0x16'));var logger=require(_0xe76c('0x17'))(_0xe76c('0x18'));var utils=require(_0xe76c('0x19'));var config=require(_0xe76c('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe76c('0x1b'))['db'];function respondWithStatusCode(_0x3b5218,_0x2ff195){_0x2ff195=_0x2ff195||0xcc;return function(_0x3cc63b){if(_0x3cc63b){return _0x3b5218[_0xe76c('0x1c')](_0x2ff195);}return _0x3b5218['status'](_0x2ff195)['end']();};}function respondWithResult(_0xe074cf,_0x2fa644){_0x2fa644=_0x2fa644||0xc8;return function(_0x55627f){if(_0x55627f){return _0xe074cf[_0xe76c('0x1d')](_0x2fa644)[_0xe76c('0x1e')](_0x55627f);}};}function respondWithFilteredResult(_0x2e7b79,_0x449ca6){return function(_0x580ca2){if(_0x580ca2){var _0xae2e42=typeof _0x449ca6[_0xe76c('0x1f')]==='undefined'&&typeof _0x449ca6[_0xe76c('0x20')]===_0xe76c('0x21');var _0x2f75d0=_0x580ca2[_0xe76c('0x22')];var _0x3a714d=_0xae2e42?0x0:_0x449ca6[_0xe76c('0x1f')];var _0x3d3a74=_0xae2e42?_0x580ca2[_0xe76c('0x22')]:_0x449ca6['offset']+_0x449ca6[_0xe76c('0x20')];var _0x23d429;if(_0x3d3a74>=_0x2f75d0){_0x3d3a74=_0x2f75d0;_0x23d429=0xc8;}else{_0x23d429=0xce;}_0x2e7b79[_0xe76c('0x1d')](_0x23d429);return _0x2e7b79[_0xe76c('0x23')](_0xe76c('0x24'),_0x3a714d+'-'+_0x3d3a74+'/'+_0x2f75d0)['json'](_0x580ca2);}return null;};}function patchUpdates(_0x2e0315){return function(_0x5cd984){try{jsonpatch[_0xe76c('0x25')](_0x5cd984,_0x2e0315,!![]);}catch(_0x5a2281){return BPromise[_0xe76c('0x26')](_0x5a2281);}return _0x5cd984[_0xe76c('0x27')]();};}function saveUpdates(_0x1a6e72,_0x402859){return function(_0x5d8aaf){if(_0x5d8aaf){return _0x5d8aaf[_0xe76c('0x28')](_0x1a6e72)[_0xe76c('0x29')](function(_0x14e635){return _0x14e635;});}return null;};}function removeEntity(_0x257105,_0x12a887){return function(_0x22ef00){if(_0x22ef00){return _0x22ef00['destroy']()[_0xe76c('0x29')](function(){_0x257105[_0xe76c('0x1d')](0xcc)[_0xe76c('0x2a')]();});}};}function handleEntityNotFound(_0x1d1e5f,_0x3bb18d){return function(_0x3bd777){if(!_0x3bd777){_0x1d1e5f['sendStatus'](0x194);}return _0x3bd777;};}function handleError(_0xfe4851,_0x223235){_0x223235=_0x223235||0x1f4;return function(_0x443873){logger[_0xe76c('0x2b')](_0x443873[_0xe76c('0x2c')]);if(_0x443873[_0xe76c('0x2d')]){delete _0x443873[_0xe76c('0x2d')];}_0xfe4851['status'](_0x223235)[_0xe76c('0x2e')](_0x443873);};}exports[_0xe76c('0x2f')]=function(_0x4d3e1b,_0x95da5e){var _0x466286={},_0x2c1f08={},_0x3fb37a={'count':0x0,'rows':[]};var _0x280397=_['map'](db[_0xe76c('0x30')]['rawAttributes'],function(_0x5b1539){return{'name':_0x5b1539['fieldName'],'type':_0x5b1539[_0xe76c('0x31')][_0xe76c('0x32')]};});_0x2c1f08['model']=_[_0xe76c('0x33')](_0x280397,_0xe76c('0x2d'));_0x2c1f08[_0xe76c('0x34')]=_['keys'](_0x4d3e1b[_0xe76c('0x34')]);_0x2c1f08['filters']=_[_0xe76c('0x35')](_0x2c1f08[_0xe76c('0x36')],_0x2c1f08[_0xe76c('0x34')]);_0x466286[_0xe76c('0x37')]=_[_0xe76c('0x35')](_0x2c1f08[_0xe76c('0x36')],qs[_0xe76c('0x38')](_0x4d3e1b[_0xe76c('0x34')]['fields']));_0x466286[_0xe76c('0x37')]=_0x466286[_0xe76c('0x37')]['length']?_0x466286[_0xe76c('0x37')]:_0x2c1f08['model'];if(!_0x4d3e1b[_0xe76c('0x34')][_0xe76c('0x39')](_0xe76c('0x3a'))){_0x466286[_0xe76c('0x20')]=qs[_0xe76c('0x20')](_0x4d3e1b[_0xe76c('0x34')][_0xe76c('0x20')]);_0x466286[_0xe76c('0x1f')]=qs[_0xe76c('0x1f')](_0x4d3e1b[_0xe76c('0x34')][_0xe76c('0x1f')]);}_0x466286['order']=qs['sort'](_0x4d3e1b[_0xe76c('0x34')]['sort']);_0x466286[_0xe76c('0x3b')]=qs[_0xe76c('0x3c')](_[_0xe76c('0x3d')](_0x4d3e1b[_0xe76c('0x34')],_0x2c1f08[_0xe76c('0x3c')]),_0x280397);if(_0x4d3e1b[_0xe76c('0x34')]['filter']){_0x466286[_0xe76c('0x3b')]=_[_0xe76c('0x3e')](_0x466286[_0xe76c('0x3b')],{'$or':_['map'](_0x280397,function(_0x3477df){if(_0x3477df[_0xe76c('0x31')]!==_0xe76c('0x3f')){var _0x3a88e9={};_0x3a88e9[_0x3477df[_0xe76c('0x2d')]]={'$like':'%'+_0x4d3e1b[_0xe76c('0x34')][_0xe76c('0x40')]+'%'};return _0x3a88e9;}})});}_0x466286=_[_0xe76c('0x3e')]({},_0x466286,_0x4d3e1b[_0xe76c('0x41')]);var _0x25fb78={'where':_0x466286[_0xe76c('0x3b')]};return db[_0xe76c('0x30')]['count'](_0x25fb78)['then'](function(_0x57d010){_0x3fb37a[_0xe76c('0x22')]=_0x57d010;if(_0x4d3e1b[_0xe76c('0x34')][_0xe76c('0x42')]){_0x466286[_0xe76c('0x43')]=[{'all':!![]}];}return db[_0xe76c('0x30')][_0xe76c('0x44')](_0x466286);})[_0xe76c('0x29')](function(_0x2b30e1){_0x3fb37a[_0xe76c('0x45')]=_0x2b30e1;return _0x3fb37a;})[_0xe76c('0x29')](respondWithFilteredResult(_0x95da5e,_0x466286))['catch'](handleError(_0x95da5e,null));};exports[_0xe76c('0x46')]=function(_0x3e44f3,_0x4dd2e8){var _0xbe222d={'raw':![],'where':{'id':_0x3e44f3[_0xe76c('0x47')]['id']}},_0x48f9b8={};_0x48f9b8[_0xe76c('0x36')]=_[_0xe76c('0x48')](db[_0xe76c('0x30')][_0xe76c('0x49')]);_0x48f9b8[_0xe76c('0x34')]=_[_0xe76c('0x48')](_0x3e44f3['query']);_0x48f9b8[_0xe76c('0x3c')]=_['intersection'](_0x48f9b8[_0xe76c('0x36')],_0x48f9b8[_0xe76c('0x34')]);_0xbe222d['attributes']=_['intersection'](_0x48f9b8[_0xe76c('0x36')],qs['fields'](_0x3e44f3['query'][_0xe76c('0x38')]));_0xbe222d[_0xe76c('0x37')]=_0xbe222d[_0xe76c('0x37')]['length']?_0xbe222d[_0xe76c('0x37')]:_0x48f9b8[_0xe76c('0x36')];if(_0x3e44f3[_0xe76c('0x34')][_0xe76c('0x42')]){_0xbe222d[_0xe76c('0x43')]=[{'all':!![]}];}_0xbe222d=_[_0xe76c('0x3e')]({},_0xbe222d,_0x3e44f3['options']);return db[_0xe76c('0x30')][_0xe76c('0x4a')](_0xbe222d)[_0xe76c('0x29')](handleEntityNotFound(_0x4dd2e8,null))[_0xe76c('0x29')](respondWithResult(_0x4dd2e8,null))[_0xe76c('0x4b')](handleError(_0x4dd2e8,null));};exports[_0xe76c('0x4c')]=function(_0x50b126,_0x5f275c){return db[_0xe76c('0x30')][_0xe76c('0x4c')](_0x50b126[_0xe76c('0x4d')],{})[_0xe76c('0x29')](respondWithResult(_0x5f275c,0xc9))[_0xe76c('0x4b')](handleError(_0x5f275c,null));};exports[_0xe76c('0x28')]=function(_0x12e083,_0x445ae7){if(_0x12e083[_0xe76c('0x4d')]['id']){delete _0x12e083[_0xe76c('0x4d')]['id'];}return db[_0xe76c('0x30')][_0xe76c('0x4a')]({'where':{'id':_0x12e083['params']['id']}})[_0xe76c('0x29')](handleEntityNotFound(_0x445ae7,null))['then'](saveUpdates(_0x12e083['body'],null))[_0xe76c('0x29')](respondWithResult(_0x445ae7,null))[_0xe76c('0x4b')](handleError(_0x445ae7,null));};exports[_0xe76c('0x4e')]=function(_0x534826,_0x279944){return db['ZendeskConfiguration'][_0xe76c('0x4a')]({'where':{'id':_0x534826[_0xe76c('0x47')]['id']}})[_0xe76c('0x29')](handleEntityNotFound(_0x279944,null))['then'](removeEntity(_0x279944,null))[_0xe76c('0x4b')](handleError(_0x279944,null));};exports[_0xe76c('0x4f')]=function(_0x4db60e,_0x560bcd,_0x258228){var _0x332652={};var _0x20ba15={};var _0x5e2fce;var _0x599a73;return db[_0xe76c('0x30')][_0xe76c('0x50')]({'where':{'id':_0x4db60e[_0xe76c('0x47')]['id']}})[_0xe76c('0x29')](handleEntityNotFound(_0x560bcd,null))[_0xe76c('0x29')](function(_0x3ef1f2){if(_0x3ef1f2){_0x5e2fce=_0x3ef1f2;_0x20ba15[_0xe76c('0x36')]=_[_0xe76c('0x48')](db['ZendeskField'][_0xe76c('0x49')]);_0x20ba15[_0xe76c('0x34')]=_[_0xe76c('0x48')](_0x4db60e['query']);_0x20ba15[_0xe76c('0x3c')]=_[_0xe76c('0x35')](_0x20ba15['model'],_0x20ba15['query']);_0x332652[_0xe76c('0x37')]=_[_0xe76c('0x35')](_0x20ba15['model'],qs[_0xe76c('0x38')](_0x4db60e[_0xe76c('0x34')][_0xe76c('0x38')]));_0x332652[_0xe76c('0x37')]=_0x332652[_0xe76c('0x37')]['length']?_0x332652[_0xe76c('0x37')]:_0x20ba15['model'];_0x332652[_0xe76c('0x51')]=qs[_0xe76c('0x52')](_0x4db60e[_0xe76c('0x34')][_0xe76c('0x52')]);_0x332652[_0xe76c('0x3b')]=qs[_0xe76c('0x3c')](_[_0xe76c('0x3d')](_0x4db60e['query'],_0x20ba15[_0xe76c('0x3c')]));if(_0x4db60e[_0xe76c('0x34')][_0xe76c('0x40')]){_0x332652[_0xe76c('0x3b')]=_[_0xe76c('0x3e')](_0x332652[_0xe76c('0x3b')],{'$or':_[_0xe76c('0x33')](_0x332652['attributes'],function(_0x478a74){var _0x55eb1d={};_0x55eb1d[_0x478a74]={'$like':'%'+_0x4db60e[_0xe76c('0x34')][_0xe76c('0x40')]+'%'};return _0x55eb1d;})});}_0x332652=_[_0xe76c('0x3e')]({},_0x332652,_0x4db60e[_0xe76c('0x41')]);return _0x5e2fce['getFields'](_0x332652);}})[_0xe76c('0x29')](function(_0x325911){if(_0x325911){_0x599a73=_0x325911[_0xe76c('0x53')];if(!_0x4db60e[_0xe76c('0x34')][_0xe76c('0x39')](_0xe76c('0x3a'))){_0x332652['limit']=qs[_0xe76c('0x20')](_0x4db60e[_0xe76c('0x34')][_0xe76c('0x20')]);_0x332652[_0xe76c('0x1f')]=qs[_0xe76c('0x1f')](_0x4db60e[_0xe76c('0x34')][_0xe76c('0x1f')]);}return _0x5e2fce[_0xe76c('0x4f')](_0x332652);}})['then'](function(_0x41c6ae){if(_0x41c6ae){return _0x41c6ae?{'count':_0x599a73,'rows':_0x41c6ae}:null;}})[_0xe76c('0x29')](respondWithResult(_0x560bcd,null))[_0xe76c('0x4b')](handleError(_0x560bcd,null));};exports[_0xe76c('0x54')]=function(_0x319e00,_0x23887e,_0x2e3203){var _0x22a0cf={};var _0x59e941={};var _0x3cdfb3;var _0x314ef3;return db[_0xe76c('0x30')][_0xe76c('0x50')]({'where':{'id':_0x319e00['params']['id']}})[_0xe76c('0x29')](handleEntityNotFound(_0x23887e,null))[_0xe76c('0x29')](function(_0x18d771){if(_0x18d771){_0x3cdfb3=_0x18d771;_0x59e941['model']=_['keys'](db['ZendeskField'][_0xe76c('0x49')]);_0x59e941['query']=_[_0xe76c('0x48')](_0x319e00[_0xe76c('0x34')]);_0x59e941[_0xe76c('0x3c')]=_['intersection'](_0x59e941[_0xe76c('0x36')],_0x59e941['query']);_0x22a0cf[_0xe76c('0x37')]=_[_0xe76c('0x35')](_0x59e941[_0xe76c('0x36')],qs[_0xe76c('0x38')](_0x319e00[_0xe76c('0x34')][_0xe76c('0x38')]));_0x22a0cf[_0xe76c('0x37')]=_0x22a0cf[_0xe76c('0x37')][_0xe76c('0x53')]?_0x22a0cf['attributes']:_0x59e941[_0xe76c('0x36')];_0x22a0cf[_0xe76c('0x51')]=qs['sort'](_0x319e00[_0xe76c('0x34')][_0xe76c('0x52')]);_0x22a0cf[_0xe76c('0x3b')]=qs[_0xe76c('0x3c')](_['pick'](_0x319e00[_0xe76c('0x34')],_0x59e941[_0xe76c('0x3c')]));if(_0x319e00['query'][_0xe76c('0x40')]){_0x22a0cf['where']=_[_0xe76c('0x3e')](_0x22a0cf[_0xe76c('0x3b')],{'$or':_[_0xe76c('0x33')](_0x22a0cf['attributes'],function(_0x158a25){var _0x39aa10={};_0x39aa10[_0x158a25]={'$like':'%'+_0x319e00[_0xe76c('0x34')][_0xe76c('0x40')]+'%'};return _0x39aa10;})});}_0x22a0cf=_[_0xe76c('0x3e')]({},_0x22a0cf,_0x319e00[_0xe76c('0x41')]);return _0x3cdfb3['getSubjects'](_0x22a0cf);}})['then'](function(_0xead1ef){if(_0xead1ef){_0x314ef3=_0xead1ef[_0xe76c('0x53')];if(!_0x319e00[_0xe76c('0x34')]['hasOwnProperty'](_0xe76c('0x3a'))){_0x22a0cf[_0xe76c('0x20')]=qs[_0xe76c('0x20')](_0x319e00['query'][_0xe76c('0x20')]);_0x22a0cf['offset']=qs['offset'](_0x319e00[_0xe76c('0x34')][_0xe76c('0x1f')]);}return _0x3cdfb3[_0xe76c('0x54')](_0x22a0cf);}})[_0xe76c('0x29')](function(_0x2258b7){if(_0x2258b7){return _0x2258b7?{'count':_0x314ef3,'rows':_0x2258b7}:null;}})['then'](respondWithResult(_0x23887e,null))[_0xe76c('0x4b')](handleError(_0x23887e,null));};exports[_0xe76c('0x55')]=function(_0x4d2352,_0x3bb0f3,_0x3d3a81){var _0x1a2b9b={};var _0x19e5e1={};var _0x3caba4;var _0x6a2128;return db[_0xe76c('0x30')]['findOne']({'where':{'id':_0x4d2352[_0xe76c('0x47')]['id']}})[_0xe76c('0x29')](handleEntityNotFound(_0x3bb0f3,null))[_0xe76c('0x29')](function(_0x193e34){if(_0x193e34){_0x3caba4=_0x193e34;_0x19e5e1[_0xe76c('0x36')]=_[_0xe76c('0x48')](db[_0xe76c('0x56')]['rawAttributes']);_0x19e5e1[_0xe76c('0x34')]=_[_0xe76c('0x48')](_0x4d2352['query']);_0x19e5e1[_0xe76c('0x3c')]=_['intersection'](_0x19e5e1[_0xe76c('0x36')],_0x19e5e1['query']);_0x1a2b9b[_0xe76c('0x37')]=_['intersection'](_0x19e5e1['model'],qs[_0xe76c('0x38')](_0x4d2352[_0xe76c('0x34')]['fields']));_0x1a2b9b[_0xe76c('0x37')]=_0x1a2b9b[_0xe76c('0x37')][_0xe76c('0x53')]?_0x1a2b9b[_0xe76c('0x37')]:_0x19e5e1[_0xe76c('0x36')];_0x1a2b9b['order']=qs[_0xe76c('0x52')](_0x4d2352[_0xe76c('0x34')][_0xe76c('0x52')]);_0x1a2b9b['where']=qs['filters'](_[_0xe76c('0x3d')](_0x4d2352[_0xe76c('0x34')],_0x19e5e1[_0xe76c('0x3c')]));if(_0x4d2352[_0xe76c('0x34')][_0xe76c('0x40')]){_0x1a2b9b['where']=_[_0xe76c('0x3e')](_0x1a2b9b[_0xe76c('0x3b')],{'$or':_['map'](_0x1a2b9b[_0xe76c('0x37')],function(_0x3b5221){var _0x3c5032={};_0x3c5032[_0x3b5221]={'$like':'%'+_0x4d2352[_0xe76c('0x34')][_0xe76c('0x40')]+'%'};return _0x3c5032;})});}_0x1a2b9b=_[_0xe76c('0x3e')]({},_0x1a2b9b,_0x4d2352[_0xe76c('0x41')]);return _0x3caba4[_0xe76c('0x55')](_0x1a2b9b);}})[_0xe76c('0x29')](function(_0x9a7fd4){if(_0x9a7fd4){_0x6a2128=_0x9a7fd4[_0xe76c('0x53')];if(!_0x4d2352['query'][_0xe76c('0x39')]('nolimit')){_0x1a2b9b['limit']=qs[_0xe76c('0x20')](_0x4d2352[_0xe76c('0x34')][_0xe76c('0x20')]);_0x1a2b9b[_0xe76c('0x1f')]=qs[_0xe76c('0x1f')](_0x4d2352[_0xe76c('0x34')]['offset']);}return _0x3caba4[_0xe76c('0x55')](_0x1a2b9b);}})[_0xe76c('0x29')](function(_0x5af882){if(_0x5af882){return _0x5af882?{'count':_0x6a2128,'rows':_0x5af882}:null;}})['then'](respondWithResult(_0x3bb0f3,null))[_0xe76c('0x4b')](handleError(_0x3bb0f3,null));};exports[_0xe76c('0x57')]=function(_0x43b549,_0x3da767,_0x4f9165){var _0x56f294={};var _0x297d20={};var _0x50ea49;var _0x5b4677;return db[_0xe76c('0x30')][_0xe76c('0x50')]({'where':{'id':_0x43b549['params']['id']}})[_0xe76c('0x29')](handleEntityNotFound(_0x3da767,null))[_0xe76c('0x29')](function(_0x440654){if(_0x440654){_0x50ea49=_0x440654;_0x297d20[_0xe76c('0x36')]=_['keys'](db['Tag'][_0xe76c('0x49')]);_0x297d20[_0xe76c('0x34')]=_[_0xe76c('0x48')](_0x43b549[_0xe76c('0x34')]);_0x297d20[_0xe76c('0x3c')]=_[_0xe76c('0x35')](_0x297d20['model'],_0x297d20[_0xe76c('0x34')]);_0x56f294[_0xe76c('0x37')]=_['intersection'](_0x297d20[_0xe76c('0x36')],qs[_0xe76c('0x38')](_0x43b549[_0xe76c('0x34')]['fields']));_0x56f294[_0xe76c('0x37')]=_0x56f294[_0xe76c('0x37')][_0xe76c('0x53')]?_0x56f294[_0xe76c('0x37')]:_0x297d20['model'];_0x56f294['order']=qs[_0xe76c('0x52')](_0x43b549[_0xe76c('0x34')][_0xe76c('0x52')]);_0x56f294[_0xe76c('0x3b')]=qs[_0xe76c('0x3c')](_[_0xe76c('0x3d')](_0x43b549[_0xe76c('0x34')],_0x297d20[_0xe76c('0x3c')]));if(_0x43b549[_0xe76c('0x34')][_0xe76c('0x40')]){_0x56f294[_0xe76c('0x3b')]=_['merge'](_0x56f294[_0xe76c('0x3b')],{'$or':_[_0xe76c('0x33')](_0x56f294[_0xe76c('0x37')],function(_0x3344a7){var _0x46c549={};_0x46c549[_0x3344a7]={'$like':'%'+_0x43b549[_0xe76c('0x34')][_0xe76c('0x40')]+'%'};return _0x46c549;})});}_0x56f294=_[_0xe76c('0x3e')]({},_0x56f294,_0x43b549[_0xe76c('0x41')]);return _0x50ea49[_0xe76c('0x57')](_0x56f294);}})[_0xe76c('0x29')](function(_0x3edc6d){if(_0x3edc6d){_0x5b4677=_0x3edc6d['length'];if(!_0x43b549[_0xe76c('0x34')][_0xe76c('0x39')](_0xe76c('0x3a'))){_0x56f294['limit']=qs[_0xe76c('0x20')](_0x43b549[_0xe76c('0x34')][_0xe76c('0x20')]);_0x56f294['offset']=qs[_0xe76c('0x1f')](_0x43b549[_0xe76c('0x34')][_0xe76c('0x1f')]);}return _0x50ea49[_0xe76c('0x57')](_0x56f294);}})[_0xe76c('0x29')](function(_0x4e08af){if(_0x4e08af){return _0x4e08af?{'count':_0x5b4677,'rows':_0x4e08af}:null;}})[_0xe76c('0x29')](respondWithResult(_0x3da767,null))[_0xe76c('0x4b')](handleError(_0x3da767,null));};exports[_0xe76c('0x58')]=function(_0x1ce730,_0x289397,_0x5165b3){if(_0x1ce730['body']['id']){delete _0x1ce730[_0xe76c('0x4d')]['id'];}return db[_0xe76c('0x30')]['findOne']({'where':{'id':_0x1ce730[_0xe76c('0x47')]['id']}})[_0xe76c('0x29')](handleEntityNotFound(_0x289397,null))['then'](function(_0x4f099f){if(_0x4f099f){return _0x4f099f[_0xe76c('0x58')](_0x1ce730[_0xe76c('0x4d')][_0xe76c('0x59')]||[]);}return null;})[_0xe76c('0x29')](respondWithResult(_0x289397,null))[_0xe76c('0x4b')](handleError(_0x289397,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index f5b3cd7..7961e6c 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 _0x065e=['moment','bluebird','request-promise','../../config/environment','./intZendeskConfiguration.attributes','define','int_zendesk_configurations','lodash'];(function(_0x32dd47,_0x48ca53){var _0x4f4559=function(_0x268fe5){while(--_0x268fe5){_0x32dd47['push'](_0x32dd47['shift']());}};_0x4f4559(++_0x48ca53);}(_0x065e,0x1a7));var _0xe065=function(_0x2da84e,_0x32cf26){_0x2da84e=_0x2da84e-0x0;var _0x49699d=_0x065e[_0x2da84e];return _0x49699d;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe065('0x1'));var BPromise=require(_0xe065('0x2'));var rp=require(_0xe065('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe065('0x4'));var attributes=require(_0xe065('0x5'));module['exports']=function(_0x10b45f,_0x1e7e69){return _0x10b45f[_0xe065('0x6')]('ZendeskConfiguration',attributes,{'tableName':_0xe065('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4f4=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x4ea728,_0x3ba8a8){_0x4ea728=_0x4ea728-0x0;var _0x290764=_0xf4f4[_0x4ea728];return _0x290764;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var logger=require('../../config/logger')(_0x4f4f('0x2'));var moment=require(_0x4f4f('0x3'));var BPromise=require(_0x4f4f('0x4'));var rp=require(_0x4f4f('0x5'));var fs=require('fs');var path=require(_0x4f4f('0x6'));var rimraf=require('rimraf');var config=require(_0x4f4f('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x4f4f('0x8')]=function(_0x132d5c,_0x20ee6e){return _0x132d5c[_0x4f4f('0x9')](_0x4f4f('0xa'),attributes,{'tableName':_0x4f4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index b7d6814..d18c5b1 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 _0x3c4b=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0x2cc303,_0x2c4a2a){var _0x82a2ca=function(_0x3d9eae){while(--_0x3d9eae){_0x2cc303['push'](_0x2cc303['shift']());}};_0x82a2ca(++_0x2c4a2a);}(_0x3c4b,0x1db));var _0xb3c4=function(_0x1e67de,_0x501efd){_0x1e67de=_0x1e67de-0x0;var _0x3a2a28=_0x3c4b[_0x1e67de];return _0x3a2a28;};'use strict';var _=require(_0xb3c4('0x0'));var util=require('util');var moment=require(_0xb3c4('0x1'));var BPromise=require(_0xb3c4('0x2'));var rs=require(_0xb3c4('0x3'));var fs=require('fs');var Redis=require(_0xb3c4('0x4'));var db=require(_0xb3c4('0x5'))['db'];var utils=require(_0xb3c4('0x6'));var logger=require('../../config/logger')(_0xb3c4('0x7'));var config=require('../../config/environment');var jayson=require(_0xb3c4('0x8'));var client=jayson['client'][_0xb3c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcb747,_0x354712,_0x3ffc11){return new BPromise(function(_0x547743,_0x139fa2){return client[_0xb3c4('0xa')](_0xcb747,_0x3ffc11)['then'](function(_0x21ea82){logger[_0xb3c4('0xb')](_0xb3c4('0xc'),_0x354712,_0xb3c4('0xd'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x354712,_0xb3c4('0xd'),JSON['stringify'](_0x21ea82));if(_0x21ea82[_0xb3c4('0xe')]){if(_0x21ea82[_0xb3c4('0xe')][_0xb3c4('0xf')]===0x1f4){logger[_0xb3c4('0xe')](_0xb3c4('0xc'),_0x354712,_0x21ea82[_0xb3c4('0xe')][_0xb3c4('0x10')]);return _0x139fa2(_0x21ea82[_0xb3c4('0xe')]['message']);}logger[_0xb3c4('0xe')](_0xb3c4('0xc'),_0x354712,_0x21ea82[_0xb3c4('0xe')]['message']);return _0x547743(_0x21ea82[_0xb3c4('0xe')][_0xb3c4('0x10')]);}else{logger[_0xb3c4('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x354712,_0xb3c4('0xd'));_0x547743(_0x21ea82[_0xb3c4('0x11')][_0xb3c4('0x10')]);}})[_0xb3c4('0x12')](function(_0x50acb7){logger['error'](_0xb3c4('0xc'),_0x354712,_0x50acb7);_0x139fa2(_0x50acb7);});});} \ No newline at end of file +var _0x1332=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util'];(function(_0x85ad48,_0x5af3ae){var _0x5b27a0=function(_0x586e9b){while(--_0x586e9b){_0x85ad48['push'](_0x85ad48['shift']());}};_0x5b27a0(++_0x5af3ae);}(_0x1332,0xf0));var _0x2133=function(_0x3d95ad,_0x40bb18){_0x3d95ad=_0x3d95ad-0x0;var _0x45a2b6=_0x1332[_0x3d95ad];return _0x45a2b6;};'use strict';var _=require(_0x2133('0x0'));var util=require(_0x2133('0x1'));var moment=require(_0x2133('0x2'));var BPromise=require('bluebird');var rs=require(_0x2133('0x3'));var fs=require('fs');var Redis=require(_0x2133('0x4'));var db=require(_0x2133('0x5'))['db'];var utils=require(_0x2133('0x6'));var logger=require('../../config/logger')(_0x2133('0x7'));var config=require(_0x2133('0x8'));var jayson=require(_0x2133('0x9'));var client=jayson[_0x2133('0xa')][_0x2133('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b15dc,_0x434c13,_0x47f19a){return new BPromise(function(_0x5da009,_0x20ce95){return client['request'](_0x2b15dc,_0x47f19a)[_0x2133('0xc')](function(_0x14bf54){logger[_0x2133('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x434c13,'request\x20sent');logger['debug'](_0x2133('0xe'),_0x434c13,'request\x20sent',JSON[_0x2133('0xf')](_0x14bf54));if(_0x14bf54['error']){if(_0x14bf54[_0x2133('0x10')]['code']===0x1f4){logger['error'](_0x2133('0x11'),_0x434c13,_0x14bf54[_0x2133('0x10')][_0x2133('0x12')]);return _0x20ce95(_0x14bf54[_0x2133('0x10')][_0x2133('0x12')]);}logger[_0x2133('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x434c13,_0x14bf54[_0x2133('0x10')][_0x2133('0x12')]);return _0x5da009(_0x14bf54['error']['message']);}else{logger[_0x2133('0xd')](_0x2133('0x11'),_0x434c13,_0x2133('0x13'));_0x5da009(_0x14bf54[_0x2133('0x14')]['message']);}})[_0x2133('0x15')](function(_0x19a85b){logger[_0x2133('0x10')](_0x2133('0x11'),_0x434c13,_0x19a85b);_0x20ce95(_0x19a85b);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 8987e09..ce4691b 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 _0x0cad=['./intZendeskField.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5c3c82,_0x24587f){var _0x25c601=function(_0x167bb0){while(--_0x167bb0){_0x5c3c82['push'](_0x5c3c82['shift']());}};_0x25c601(++_0x24587f);}(_0x0cad,0x84));var _0xd0ca=function(_0x40bfc2,_0x538e26){_0x40bfc2=_0x40bfc2-0x0;var _0x14d1db=_0x0cad[_0x40bfc2];return _0x14d1db;};'use strict';var multer=require(_0xd0ca('0x0'));var util=require('util');var path=require(_0xd0ca('0x1'));var timeout=require(_0xd0ca('0x2'));var express=require(_0xd0ca('0x3'));var router=express[_0xd0ca('0x4')]();var fs_extra=require(_0xd0ca('0x5'));var auth=require(_0xd0ca('0x6'));var interaction=require(_0xd0ca('0x7'));var config=require('../../config/environment');var controller=require(_0xd0ca('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd0ca('0x9')]);router[_0xd0ca('0xa')](_0xd0ca('0xb'),auth[_0xd0ca('0xc')](),controller[_0xd0ca('0xd')]);router[_0xd0ca('0xe')]('/',auth[_0xd0ca('0xc')](),controller[_0xd0ca('0xf')]);router[_0xd0ca('0x10')](_0xd0ca('0xb'),auth[_0xd0ca('0xc')](),controller[_0xd0ca('0x11')]);router[_0xd0ca('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xd0ca('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe77c=['isAuthenticated','index','/:id','show','post','create','put','update','exports','multer','util','path','express','Router','fs-extra','../../config/environment','get'];(function(_0xe9dddf,_0x35475a){var _0x59209c=function(_0x481809){while(--_0x481809){_0xe9dddf['push'](_0xe9dddf['shift']());}};_0x59209c(++_0x35475a);}(_0xe77c,0x1d4));var _0xce77=function(_0x282c88,_0x595f0e){_0x282c88=_0x282c88-0x0;var _0x48ec5c=_0xe77c[_0x282c88];return _0x48ec5c;};'use strict';var multer=require(_0xce77('0x0'));var util=require(_0xce77('0x1'));var path=require(_0xce77('0x2'));var timeout=require('connect-timeout');var express=require(_0xce77('0x3'));var router=express[_0xce77('0x4')]();var fs_extra=require(_0xce77('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xce77('0x6'));var controller=require('./intZendeskField.controller');router[_0xce77('0x7')]('/',auth[_0xce77('0x8')](),controller[_0xce77('0x9')]);router[_0xce77('0x7')](_0xce77('0xa'),auth['isAuthenticated'](),controller[_0xce77('0xb')]);router[_0xce77('0xc')]('/',auth[_0xce77('0x8')](),controller[_0xce77('0xd')]);router[_0xce77('0xe')](_0xce77('0xa'),auth[_0xce77('0x8')](),controller[_0xce77('0xf')]);router['delete'](_0xce77('0xa'),auth[_0xce77('0x8')](),controller['destroy']);module[_0xce77('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 20c6278..0d4bb1f 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 _0x9a3a=['string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN','exports','ENUM'];(function(_0x2c044e,_0x28657b){var _0x118b5e=function(_0x26816d){while(--_0x26816d){_0x2c044e['push'](_0x2c044e['shift']());}};_0x118b5e(++_0x28657b);}(_0x9a3a,0x1c0));var _0xa9a3=function(_0x3f6808,_0x17cddb){_0x3f6808=_0x3f6808-0x0;var _0x4311d3=_0x9a3a[_0x3f6808];return _0x4311d3;};'use strict';var Sequelize=require('sequelize');module[_0xa9a3('0x0')]={'type':{'type':Sequelize[_0xa9a3('0x1')](_0xa9a3('0x2'),_0xa9a3('0x3'),'customVariable',_0xa9a3('0x4'),_0xa9a3('0x5')),'defaultValue':_0xa9a3('0x2')},'content':{'type':Sequelize[_0xa9a3('0x6')]},'key':{'type':Sequelize[_0xa9a3('0x6')]},'keyType':{'type':Sequelize[_0xa9a3('0x1')]('string',_0xa9a3('0x3'),_0xa9a3('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa9a3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x84b0=['customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','exports','string','variable'];(function(_0x10fa8a,_0x12e906){var _0x341e02=function(_0x26ae3d){while(--_0x26ae3d){_0x10fa8a['push'](_0x10fa8a['shift']());}};_0x341e02(++_0x12e906);}(_0x84b0,0x1bf));var _0x084b=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x84b0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x084b('0x0')]={'type':{'type':Sequelize['ENUM'](_0x084b('0x1'),_0x084b('0x2'),_0x084b('0x3'),_0x084b('0x4'),_0x084b('0x5')),'defaultValue':_0x084b('0x1')},'content':{'type':Sequelize[_0x084b('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x084b('0x7')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x084b('0x6')]},'idField':{'type':Sequelize[_0x084b('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x084b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index d262888..17249f4 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 _0xc36d=['desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','stack','name','send','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','options','includeAll','include','rows','catch','show','params','ZendeskField','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x20f888,_0x304f3e){var _0x3698d7=function(_0x2b5576){while(--_0x2b5576){_0x20f888['push'](_0x20f888['shift']());}};_0x3698d7(++_0x304f3e);}(_0xc36d,0x7d));var _0xdc36=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xc36d[_0x36dfbd];return _0x4ecad9;};'use strict';var emlformat=require(_0xdc36('0x0'));var rimraf=require(_0xdc36('0x1'));var zipdir=require(_0xdc36('0x2'));var jsonpatch=require(_0xdc36('0x3'));var rp=require(_0xdc36('0x4'));var moment=require(_0xdc36('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdc36('0x6'));var util=require(_0xdc36('0x7'));var path=require('path');var sox=require(_0xdc36('0x8'));var csv=require(_0xdc36('0x9'));var ejs=require(_0xdc36('0xa'));var fs=require('fs');var fs_extra=require(_0xdc36('0xb'));var _=require(_0xdc36('0xc'));var squel=require('squel');var crypto=require(_0xdc36('0xd'));var jsforce=require(_0xdc36('0xe'));var deskjs=require(_0xdc36('0xf'));var toCsv=require(_0xdc36('0x9'));var querystring=require('querystring');var Papa=require(_0xdc36('0x10'));var Redis=require(_0xdc36('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdc36('0x12'));var as=require(_0xdc36('0x13'));var hardwareService=require(_0xdc36('0x14'));var logger=require('../../config/logger')(_0xdc36('0x15'));var utils=require(_0xdc36('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdc36('0x17'))['db'];function respondWithStatusCode(_0x276692,_0x519fa5){_0x519fa5=_0x519fa5||0xcc;return function(_0x5d62ee){if(_0x5d62ee){return _0x276692['sendStatus'](_0x519fa5);}return _0x276692[_0xdc36('0x18')](_0x519fa5)[_0xdc36('0x19')]();};}function respondWithResult(_0x243d54,_0xae6ad3){_0xae6ad3=_0xae6ad3||0xc8;return function(_0x30803d){if(_0x30803d){return _0x243d54[_0xdc36('0x18')](_0xae6ad3)[_0xdc36('0x1a')](_0x30803d);}};}function respondWithFilteredResult(_0x809cf0,_0x57ebde){return function(_0x155cce){if(_0x155cce){var _0x526ac8=typeof _0x57ebde['offset']==='undefined'&&typeof _0x57ebde[_0xdc36('0x1b')]===_0xdc36('0x1c');var _0x5a498f=_0x155cce[_0xdc36('0x1d')];var _0x219a73=_0x526ac8?0x0:_0x57ebde[_0xdc36('0x1e')];var _0x225878=_0x526ac8?_0x155cce[_0xdc36('0x1d')]:_0x57ebde[_0xdc36('0x1e')]+_0x57ebde['limit'];var _0x3d4c4c;if(_0x225878>=_0x5a498f){_0x225878=_0x5a498f;_0x3d4c4c=0xc8;}else{_0x3d4c4c=0xce;}_0x809cf0[_0xdc36('0x18')](_0x3d4c4c);return _0x809cf0['set'](_0xdc36('0x1f'),_0x219a73+'-'+_0x225878+'/'+_0x5a498f)[_0xdc36('0x1a')](_0x155cce);}return null;};}function patchUpdates(_0x3f25f0){return function(_0x5f15ef){try{jsonpatch[_0xdc36('0x20')](_0x5f15ef,_0x3f25f0,!![]);}catch(_0x235a39){return BPromise['reject'](_0x235a39);}return _0x5f15ef[_0xdc36('0x21')]();};}function saveUpdates(_0x480277,_0x5a6e35){return function(_0x12f9d8){if(_0x12f9d8){return _0x12f9d8[_0xdc36('0x22')](_0x480277)[_0xdc36('0x23')](function(_0xda916b){return _0xda916b;});}return null;};}function removeEntity(_0x2d83c0,_0x34d261){return function(_0x14b595){if(_0x14b595){return _0x14b595[_0xdc36('0x24')]()['then'](function(){_0x2d83c0[_0xdc36('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2338d7,_0x38bd73){return function(_0x15e686){if(!_0x15e686){_0x2338d7['sendStatus'](0x194);}return _0x15e686;};}function handleError(_0xbc4322,_0x6e3906){_0x6e3906=_0x6e3906||0x1f4;return function(_0x337091){logger['error'](_0x337091[_0xdc36('0x25')]);if(_0x337091[_0xdc36('0x26')]){delete _0x337091[_0xdc36('0x26')];}_0xbc4322['status'](_0x6e3906)[_0xdc36('0x27')](_0x337091);};}exports[_0xdc36('0x28')]=function(_0x4b15b4,_0x3fe57f){var _0x12fed2={},_0x4ea2ad={},_0x21151b={'count':0x0,'rows':[]};var _0x5bba0b=_['map'](db['ZendeskField'][_0xdc36('0x29')],function(_0x2f2bb4){return{'name':_0x2f2bb4['fieldName'],'type':_0x2f2bb4[_0xdc36('0x2a')][_0xdc36('0x2b')]};});_0x4ea2ad[_0xdc36('0x2c')]=_['map'](_0x5bba0b,_0xdc36('0x26'));_0x4ea2ad[_0xdc36('0x2d')]=_[_0xdc36('0x2e')](_0x4b15b4[_0xdc36('0x2d')]);_0x4ea2ad[_0xdc36('0x2f')]=_[_0xdc36('0x30')](_0x4ea2ad[_0xdc36('0x2c')],_0x4ea2ad['query']);_0x12fed2[_0xdc36('0x31')]=_[_0xdc36('0x30')](_0x4ea2ad['model'],qs['fields'](_0x4b15b4[_0xdc36('0x2d')][_0xdc36('0x32')]));_0x12fed2[_0xdc36('0x31')]=_0x12fed2['attributes']['length']?_0x12fed2[_0xdc36('0x31')]:_0x4ea2ad[_0xdc36('0x2c')];if(!_0x4b15b4[_0xdc36('0x2d')][_0xdc36('0x33')](_0xdc36('0x34'))){_0x12fed2[_0xdc36('0x1b')]=qs[_0xdc36('0x1b')](_0x4b15b4[_0xdc36('0x2d')][_0xdc36('0x1b')]);_0x12fed2[_0xdc36('0x1e')]=qs[_0xdc36('0x1e')](_0x4b15b4['query'][_0xdc36('0x1e')]);}_0x12fed2[_0xdc36('0x35')]=qs[_0xdc36('0x36')](_0x4b15b4[_0xdc36('0x2d')]['sort']);_0x12fed2[_0xdc36('0x37')]=qs[_0xdc36('0x2f')](_[_0xdc36('0x38')](_0x4b15b4[_0xdc36('0x2d')],_0x4ea2ad['filters']),_0x5bba0b);if(_0x4b15b4[_0xdc36('0x2d')]['filter']){_0x12fed2['where']=_[_0xdc36('0x39')](_0x12fed2[_0xdc36('0x37')],{'$or':_[_0xdc36('0x3a')](_0x5bba0b,function(_0x54c45d){if(_0x54c45d[_0xdc36('0x2a')]!=='VIRTUAL'){var _0x45760b={};_0x45760b[_0x54c45d[_0xdc36('0x26')]]={'$like':'%'+_0x4b15b4[_0xdc36('0x2d')]['filter']+'%'};return _0x45760b;}})});}_0x12fed2=_[_0xdc36('0x39')]({},_0x12fed2,_0x4b15b4[_0xdc36('0x3b')]);var _0xd98d42={'where':_0x12fed2[_0xdc36('0x37')]};return db['ZendeskField'][_0xdc36('0x1d')](_0xd98d42)[_0xdc36('0x23')](function(_0x68816d){_0x21151b['count']=_0x68816d;if(_0x4b15b4['query'][_0xdc36('0x3c')]){_0x12fed2[_0xdc36('0x3d')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x12fed2);})[_0xdc36('0x23')](function(_0x8f4c80){_0x21151b[_0xdc36('0x3e')]=_0x8f4c80;return _0x21151b;})[_0xdc36('0x23')](respondWithFilteredResult(_0x3fe57f,_0x12fed2))[_0xdc36('0x3f')](handleError(_0x3fe57f,null));};exports[_0xdc36('0x40')]=function(_0x932213,_0x2a83ee){var _0x2f4c89={'raw':!![],'where':{'id':_0x932213[_0xdc36('0x41')]['id']}},_0x125f0e={};_0x125f0e[_0xdc36('0x2c')]=_[_0xdc36('0x2e')](db[_0xdc36('0x42')][_0xdc36('0x29')]);_0x125f0e[_0xdc36('0x2d')]=_[_0xdc36('0x2e')](_0x932213[_0xdc36('0x2d')]);_0x125f0e[_0xdc36('0x2f')]=_[_0xdc36('0x30')](_0x125f0e[_0xdc36('0x2c')],_0x125f0e[_0xdc36('0x2d')]);_0x2f4c89[_0xdc36('0x31')]=_[_0xdc36('0x30')](_0x125f0e[_0xdc36('0x2c')],qs[_0xdc36('0x32')](_0x932213['query'][_0xdc36('0x32')]));_0x2f4c89[_0xdc36('0x31')]=_0x2f4c89['attributes']['length']?_0x2f4c89[_0xdc36('0x31')]:_0x125f0e['model'];if(_0x932213[_0xdc36('0x2d')]['includeAll']){_0x2f4c89[_0xdc36('0x3d')]=[{'all':!![]}];}_0x2f4c89=_[_0xdc36('0x39')]({},_0x2f4c89,_0x932213[_0xdc36('0x3b')]);return db[_0xdc36('0x42')][_0xdc36('0x43')](_0x2f4c89)[_0xdc36('0x23')](handleEntityNotFound(_0x2a83ee,null))[_0xdc36('0x23')](respondWithResult(_0x2a83ee,null))[_0xdc36('0x3f')](handleError(_0x2a83ee,null));};exports[_0xdc36('0x44')]=function(_0x38c24b,_0x3c27c7){return db[_0xdc36('0x42')][_0xdc36('0x44')](_0x38c24b[_0xdc36('0x45')],{})[_0xdc36('0x23')](respondWithResult(_0x3c27c7,0xc9))[_0xdc36('0x3f')](handleError(_0x3c27c7,null));};exports[_0xdc36('0x22')]=function(_0x3399cc,_0x562c86){if(_0x3399cc['body']['id']){delete _0x3399cc[_0xdc36('0x45')]['id'];}return db[_0xdc36('0x42')][_0xdc36('0x43')]({'where':{'id':_0x3399cc[_0xdc36('0x41')]['id']}})[_0xdc36('0x23')](handleEntityNotFound(_0x562c86,null))[_0xdc36('0x23')](saveUpdates(_0x3399cc['body'],null))[_0xdc36('0x23')](respondWithResult(_0x562c86,null))[_0xdc36('0x3f')](handleError(_0x562c86,null));};exports[_0xdc36('0x24')]=function(_0x49f456,_0x2c6856){return db[_0xdc36('0x42')][_0xdc36('0x43')]({'where':{'id':_0x49f456[_0xdc36('0x41')]['id']}})[_0xdc36('0x23')](handleEntityNotFound(_0x2c6856,null))[_0xdc36('0x23')](removeEntity(_0x2c6856,null))['catch'](handleError(_0x2c6856,null));}; \ No newline at end of file +var _0x6f7a=['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','sendStatus','error','name','index','map','ZendeskField','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','then','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x2be12b,_0x3f0b16){var _0x287bd6=function(_0x4f557f){while(--_0x4f557f){_0x2be12b['push'](_0x2be12b['shift']());}};_0x287bd6(++_0x3f0b16);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x17c34d,_0x392322){_0x17c34d=_0x17c34d-0x0;var _0x5d6574=_0x6f7a[_0x17c34d];return _0x5d6574;};'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(){_0x2b6a84[_0xa6f7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47ef97,_0x402d25){return function(_0x5efdce){if(!_0x5efdce){_0x47ef97[_0xa6f7('0x23')](0x194);}return _0x5efdce;};}function handleError(_0x126d24,_0x3c79ea){_0x3c79ea=_0x3c79ea||0x1f4;return function(_0x2b4c6c){logger[_0xa6f7('0x24')](_0x2b4c6c['stack']);if(_0x2b4c6c['name']){delete _0x2b4c6c[_0xa6f7('0x25')];}_0x126d24[_0xa6f7('0x19')](_0x3c79ea)['send'](_0x2b4c6c);};}exports[_0xa6f7('0x26')]=function(_0x27babb,_0x87bccc){var _0x3a7ff9={},_0x224f5a={},_0x10bf77={'count':0x0,'rows':[]};var _0x353de8=_[_0xa6f7('0x27')](db[_0xa6f7('0x28')][_0xa6f7('0x29')],function(_0x40b0f8){return{'name':_0x40b0f8[_0xa6f7('0x2a')],'type':_0x40b0f8['type'][_0xa6f7('0x2b')]};});_0x224f5a[_0xa6f7('0x2c')]=_['map'](_0x353de8,_0xa6f7('0x25'));_0x224f5a[_0xa6f7('0x2d')]=_['keys'](_0x27babb['query']);_0x224f5a[_0xa6f7('0x2e')]=_[_0xa6f7('0x2f')](_0x224f5a[_0xa6f7('0x2c')],_0x224f5a[_0xa6f7('0x2d')]);_0x3a7ff9[_0xa6f7('0x30')]=_['intersection'](_0x224f5a['model'],qs[_0xa6f7('0x31')](_0x27babb['query'][_0xa6f7('0x31')]));_0x3a7ff9[_0xa6f7('0x30')]=_0x3a7ff9[_0xa6f7('0x30')][_0xa6f7('0x32')]?_0x3a7ff9[_0xa6f7('0x30')]:_0x224f5a[_0xa6f7('0x2c')];if(!_0x27babb['query'][_0xa6f7('0x33')](_0xa6f7('0x34'))){_0x3a7ff9[_0xa6f7('0x1d')]=qs['limit'](_0x27babb[_0xa6f7('0x2d')]['limit']);_0x3a7ff9[_0xa6f7('0x1e')]=qs[_0xa6f7('0x1e')](_0x27babb[_0xa6f7('0x2d')]['offset']);}_0x3a7ff9[_0xa6f7('0x35')]=qs[_0xa6f7('0x36')](_0x27babb[_0xa6f7('0x2d')][_0xa6f7('0x36')]);_0x3a7ff9[_0xa6f7('0x37')]=qs[_0xa6f7('0x2e')](_['pick'](_0x27babb[_0xa6f7('0x2d')],_0x224f5a[_0xa6f7('0x2e')]),_0x353de8);if(_0x27babb[_0xa6f7('0x2d')][_0xa6f7('0x38')]){_0x3a7ff9[_0xa6f7('0x37')]=_[_0xa6f7('0x39')](_0x3a7ff9[_0xa6f7('0x37')],{'$or':_[_0xa6f7('0x27')](_0x353de8,function(_0x4c2d2e){if(_0x4c2d2e[_0xa6f7('0x3a')]!==_0xa6f7('0x3b')){var _0x353e54={};_0x353e54[_0x4c2d2e['name']]={'$like':'%'+_0x27babb[_0xa6f7('0x2d')][_0xa6f7('0x38')]+'%'};return _0x353e54;}})});}_0x3a7ff9=_['merge']({},_0x3a7ff9,_0x27babb[_0xa6f7('0x3c')]);var _0x13c7c4={'where':_0x3a7ff9[_0xa6f7('0x37')]};return db[_0xa6f7('0x28')][_0xa6f7('0x1f')](_0x13c7c4)['then'](function(_0x2e3eb2){_0x10bf77[_0xa6f7('0x1f')]=_0x2e3eb2;if(_0x27babb[_0xa6f7('0x2d')][_0xa6f7('0x3d')]){_0x3a7ff9[_0xa6f7('0x3e')]=[{'all':!![]}];}return db[_0xa6f7('0x28')][_0xa6f7('0x3f')](_0x3a7ff9);})[_0xa6f7('0x40')](function(_0x5646b9){_0x10bf77['rows']=_0x5646b9;return _0x10bf77;})[_0xa6f7('0x40')](respondWithFilteredResult(_0x87bccc,_0x3a7ff9))[_0xa6f7('0x41')](handleError(_0x87bccc,null));};exports[_0xa6f7('0x42')]=function(_0x2546a3,_0x2ac07f){var _0x387714={'raw':!![],'where':{'id':_0x2546a3[_0xa6f7('0x43')]['id']}},_0x21fdd7={};_0x21fdd7[_0xa6f7('0x2c')]=_[_0xa6f7('0x44')](db['ZendeskField'][_0xa6f7('0x29')]);_0x21fdd7[_0xa6f7('0x2d')]=_['keys'](_0x2546a3[_0xa6f7('0x2d')]);_0x21fdd7[_0xa6f7('0x2e')]=_[_0xa6f7('0x2f')](_0x21fdd7[_0xa6f7('0x2c')],_0x21fdd7['query']);_0x387714[_0xa6f7('0x30')]=_['intersection'](_0x21fdd7['model'],qs[_0xa6f7('0x31')](_0x2546a3[_0xa6f7('0x2d')][_0xa6f7('0x31')]));_0x387714[_0xa6f7('0x30')]=_0x387714[_0xa6f7('0x30')][_0xa6f7('0x32')]?_0x387714[_0xa6f7('0x30')]:_0x21fdd7['model'];if(_0x2546a3[_0xa6f7('0x2d')][_0xa6f7('0x3d')]){_0x387714['include']=[{'all':!![]}];}_0x387714=_[_0xa6f7('0x39')]({},_0x387714,_0x2546a3[_0xa6f7('0x3c')]);return db[_0xa6f7('0x28')]['find'](_0x387714)[_0xa6f7('0x40')](handleEntityNotFound(_0x2ac07f,null))['then'](respondWithResult(_0x2ac07f,null))[_0xa6f7('0x41')](handleError(_0x2ac07f,null));};exports[_0xa6f7('0x45')]=function(_0x260e77,_0x5f3c84){return db['ZendeskField'][_0xa6f7('0x45')](_0x260e77['body'],{})[_0xa6f7('0x40')](respondWithResult(_0x5f3c84,0xc9))['catch'](handleError(_0x5f3c84,null));};exports['update']=function(_0x1e7089,_0x2e3a04){if(_0x1e7089[_0xa6f7('0x46')]['id']){delete _0x1e7089[_0xa6f7('0x46')]['id'];}return db[_0xa6f7('0x28')][_0xa6f7('0x47')]({'where':{'id':_0x1e7089['params']['id']}})[_0xa6f7('0x40')](handleEntityNotFound(_0x2e3a04,null))[_0xa6f7('0x40')](saveUpdates(_0x1e7089['body'],null))[_0xa6f7('0x40')](respondWithResult(_0x2e3a04,null))['catch'](handleError(_0x2e3a04,null));};exports[_0xa6f7('0x48')]=function(_0x59091a,_0x488efc){return db[_0xa6f7('0x28')][_0xa6f7('0x47')]({'where':{'id':_0x59091a[_0xa6f7('0x43')]['id']}})[_0xa6f7('0x40')](handleEntityNotFound(_0x488efc,null))[_0xa6f7('0x40')](removeEntity(_0x488efc,null))['catch'](handleError(_0x488efc,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 6387f8f..606f5dd 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 _0xceb9=['util','api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','ZendeskField','int_zendesk_fields','FieldId','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xceb9,0x12b));var _0x9ceb=function(_0x38fc22,_0x565119){_0x38fc22=_0x38fc22-0x0;var _0x218820=_0xceb9[_0x38fc22];return _0x218820;};'use strict';var _=require(_0x9ceb('0x0'));var util=require(_0x9ceb('0x1'));var logger=require('../../config/logger')(_0x9ceb('0x2'));var moment=require(_0x9ceb('0x3'));var BPromise=require(_0x9ceb('0x4'));var rp=require(_0x9ceb('0x5'));var fs=require('fs');var path=require(_0x9ceb('0x6'));var rimraf=require(_0x9ceb('0x7'));var config=require('../../config/environment');var attributes=require(_0x9ceb('0x8'));module['exports']=function(_0x5c42d7,_0x202535){return _0x5c42d7['define'](_0x9ceb('0x9'),attributes,{'tableName':_0x9ceb('0xa'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0x9ceb('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d05=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField'];(function(_0x4fdae9,_0x510dd2){var _0x735724=function(_0x2bd4bd){while(--_0x2bd4bd){_0x4fdae9['push'](_0x4fdae9['shift']());}};_0x735724(++_0x510dd2);}(_0x1d05,0xcd));var _0x51d0=function(_0x2c3f35,_0x57221b){_0x2c3f35=_0x2c3f35-0x0;var _0xf9105e=_0x1d05[_0x2c3f35];return _0xf9105e;};'use strict';var _=require(_0x51d0('0x0'));var util=require(_0x51d0('0x1'));var logger=require(_0x51d0('0x2'))(_0x51d0('0x3'));var moment=require(_0x51d0('0x4'));var BPromise=require(_0x51d0('0x5'));var rp=require(_0x51d0('0x6'));var fs=require('fs');var path=require(_0x51d0('0x7'));var rimraf=require(_0x51d0('0x8'));var config=require(_0x51d0('0x9'));var attributes=require(_0x51d0('0xa'));module[_0x51d0('0xb')]=function(_0x2fe9af,_0x274492){return _0x2fe9af[_0x51d0('0xc')](_0x51d0('0xd'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x51d0('0xe'),'fields':[_0x51d0('0xf'),_0x51d0('0x10')],'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 729169a..df5ef9f 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 _0x53ab=['ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ZendeskField,\x20%s,\x20%s'];(function(_0x5d14dd,_0x24ed64){var _0x17a031=function(_0x477fcd){while(--_0x477fcd){_0x5d14dd['push'](_0x5d14dd['shift']());}};_0x17a031(++_0x24ed64);}(_0x53ab,0x1ab));var _0xb53a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53ab[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb53a('0x0'));var util=require('util');var moment=require(_0xb53a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb53a('0x2'));var db=require(_0xb53a('0x3'))['db'];var utils=require(_0xb53a('0x4'));var logger=require(_0xb53a('0x5'))(_0xb53a('0x6'));var config=require(_0xb53a('0x7'));var jayson=require(_0xb53a('0x8'));var client=jayson[_0xb53a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x567cbf,_0x38ffdf,_0x5827c6){return new BPromise(function(_0xb045b4,_0x5bb0b4){return client[_0xb53a('0xa')](_0x567cbf,_0x5827c6)['then'](function(_0xd87874){logger[_0xb53a('0xb')](_0xb53a('0xc'),_0x38ffdf,'request\x20sent');logger['debug'](_0xb53a('0xd'),_0x38ffdf,_0xb53a('0xe'),JSON[_0xb53a('0xf')](_0xd87874));if(_0xd87874[_0xb53a('0x10')]){if(_0xd87874[_0xb53a('0x10')]['code']===0x1f4){logger[_0xb53a('0x10')](_0xb53a('0xc'),_0x38ffdf,_0xd87874[_0xb53a('0x10')]['message']);return _0x5bb0b4(_0xd87874[_0xb53a('0x10')][_0xb53a('0x11')]);}logger[_0xb53a('0x10')](_0xb53a('0xc'),_0x38ffdf,_0xd87874['error'][_0xb53a('0x11')]);return _0xb045b4(_0xd87874[_0xb53a('0x10')][_0xb53a('0x11')]);}else{logger[_0xb53a('0xb')](_0xb53a('0xc'),_0x38ffdf,_0xb53a('0xe'));_0xb045b4(_0xd87874[_0xb53a('0x12')][_0xb53a('0x11')]);}})[_0xb53a('0x13')](function(_0x2bc239){logger[_0xb53a('0x10')](_0xb53a('0xc'),_0x38ffdf,_0x2bc239);_0x5bb0b4(_0x2bc239);});});} \ No newline at end of file +var _0x8bfd=['jayson/promise','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x446d66,_0x59dc41){var _0x35a945=function(_0x325310){while(--_0x325310){_0x446d66['push'](_0x446d66['shift']());}};_0x35a945(++_0x59dc41);}(_0x8bfd,0x170));var _0xd8bf=function(_0x33c98e,_0x4eb3d0){_0x33c98e=_0x33c98e-0x0;var _0x39a756=_0x8bfd[_0x33c98e];return _0x39a756;};'use strict';var _=require(_0xd8bf('0x0'));var util=require(_0xd8bf('0x1'));var moment=require(_0xd8bf('0x2'));var BPromise=require(_0xd8bf('0x3'));var rs=require(_0xd8bf('0x4'));var fs=require('fs');var Redis=require(_0xd8bf('0x5'));var db=require(_0xd8bf('0x6'))['db'];var utils=require(_0xd8bf('0x7'));var logger=require(_0xd8bf('0x8'))(_0xd8bf('0x9'));var config=require('../../config/environment');var jayson=require(_0xd8bf('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1209d1,_0x47e0cb,_0x3bdfc7){return new BPromise(function(_0x50a5dd,_0x188a25){return client['request'](_0x1209d1,_0x3bdfc7)[_0xd8bf('0xb')](function(_0x2749ef){logger[_0xd8bf('0xc')](_0xd8bf('0xd'),_0x47e0cb,_0xd8bf('0xe'));logger['debug'](_0xd8bf('0xf'),_0x47e0cb,_0xd8bf('0xe'),JSON[_0xd8bf('0x10')](_0x2749ef));if(_0x2749ef['error']){if(_0x2749ef[_0xd8bf('0x11')][_0xd8bf('0x12')]===0x1f4){logger['error'](_0xd8bf('0xd'),_0x47e0cb,_0x2749ef[_0xd8bf('0x11')]['message']);return _0x188a25(_0x2749ef[_0xd8bf('0x11')]['message']);}logger[_0xd8bf('0x11')](_0xd8bf('0xd'),_0x47e0cb,_0x2749ef[_0xd8bf('0x11')][_0xd8bf('0x13')]);return _0x50a5dd(_0x2749ef[_0xd8bf('0x11')][_0xd8bf('0x13')]);}else{logger[_0xd8bf('0xc')]('ZendeskField,\x20%s,\x20%s',_0x47e0cb,_0xd8bf('0xe'));_0x50a5dd(_0x2749ef['result']['message']);}})[_0xd8bf('0x14')](function(_0x253b9a){logger[_0xd8bf('0x11')](_0xd8bf('0xd'),_0x47e0cb,_0x253b9a);_0x188a25(_0x253b9a);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index a7eb55e..0d2fb85 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 _0x1d86=['create','addConfiguration','put','update','destroy','exports','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','/:id','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x3be18a,_0x3acf61){var _0x25ceaa=function(_0x497fe8){while(--_0x497fe8){_0x3be18a['push'](_0x3be18a['shift']());}};_0x25ceaa(++_0x3acf61);}(_0x1d86,0x7e));var _0x61d8=function(_0x33dedf,_0x565197){_0x33dedf=_0x33dedf-0x0;var _0x3322a6=_0x1d86[_0x33dedf];return _0x3322a6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x61d8('0x0'));var express=require('express');var router=express[_0x61d8('0x1')]();var fs_extra=require(_0x61d8('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x61d8('0x3'));var config=require(_0x61d8('0x4'));var controller=require(_0x61d8('0x5'));router['get']('/',auth[_0x61d8('0x6')](),controller['index']);router['get'](_0x61d8('0x7'),auth[_0x61d8('0x6')](),controller['show']);router[_0x61d8('0x8')](_0x61d8('0x9'),auth[_0x61d8('0x6')](),controller[_0x61d8('0xa')]);router[_0x61d8('0x8')](_0x61d8('0xb'),auth[_0x61d8('0x6')](),controller[_0x61d8('0xc')]);router[_0x61d8('0xd')]('/',auth['isAuthenticated'](),controller[_0x61d8('0xe')]);router[_0x61d8('0xd')](_0x61d8('0x9'),auth[_0x61d8('0x6')](),controller[_0x61d8('0xf')]);router[_0x61d8('0x10')](_0x61d8('0x7'),auth[_0x61d8('0x6')](),controller[_0x61d8('0x11')]);router['delete'](_0x61d8('0x7'),auth[_0x61d8('0x6')](),controller[_0x61d8('0x12')]);module[_0x61d8('0x13')]=router; \ No newline at end of file +var _0x8a6c=['post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','index','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields'];(function(_0xe2d07,_0x138f4e){var _0x435a40=function(_0x4e539e){while(--_0x4e539e){_0xe2d07['push'](_0xe2d07['shift']());}};_0x435a40(++_0x138f4e);}(_0x8a6c,0x7f));var _0xc8a6=function(_0x5024e6,_0x3aaa08){_0x5024e6=_0x5024e6-0x0;var _0x51ec48=_0x8a6c[_0x5024e6];return _0x51ec48;};'use strict';var multer=require(_0xc8a6('0x0'));var util=require(_0xc8a6('0x1'));var path=require(_0xc8a6('0x2'));var timeout=require(_0xc8a6('0x3'));var express=require(_0xc8a6('0x4'));var router=express[_0xc8a6('0x5')]();var fs_extra=require(_0xc8a6('0x6'));var auth=require(_0xc8a6('0x7'));var interaction=require(_0xc8a6('0x8'));var config=require('../../config/environment');var controller=require(_0xc8a6('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xc8a6('0xa')]);router[_0xc8a6('0xb')](_0xc8a6('0xc'),auth[_0xc8a6('0xd')](),controller['show']);router[_0xc8a6('0xb')](_0xc8a6('0xe'),auth[_0xc8a6('0xd')](),controller[_0xc8a6('0xf')]);router[_0xc8a6('0xb')](_0xc8a6('0x10'),auth[_0xc8a6('0xd')](),controller['getFields']);router[_0xc8a6('0x11')]('/',auth[_0xc8a6('0xd')](),controller['create']);router[_0xc8a6('0x11')](_0xc8a6('0xe'),auth[_0xc8a6('0xd')](),controller[_0xc8a6('0x12')]);router[_0xc8a6('0x13')](_0xc8a6('0xc'),auth[_0xc8a6('0xd')](),controller[_0xc8a6('0x14')]);router[_0xc8a6('0x15')](_0xc8a6('0xc'),auth[_0xc8a6('0xd')](),controller[_0xc8a6('0x16')]);module[_0xc8a6('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 1f08177..a7e6429 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 _0x00bb=['STRING','sequelize','exports'];(function(_0x367792,_0xbc102d){var _0x58f614=function(_0x4f7d13){while(--_0x4f7d13){_0x367792['push'](_0x367792['shift']());}};_0x58f614(++_0xbc102d);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x00bb[_0x1d9aa0];return _0x226868;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'name':{'type':Sequelize[_0xb00b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb00b('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb00b('0x2')]},'clientSecret':{'type':Sequelize[_0xb00b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xb00b('0x2')]},'refreshToken':{'type':Sequelize[_0xb00b('0x2')]}}; \ No newline at end of file +var _0xb43b=['exports','STRING','sequelize'];(function(_0xb833b1,_0x1c3d3f){var _0x1ab87a=function(_0x1c9f6c){while(--_0x1c9f6c){_0xb833b1['push'](_0xb833b1['shift']());}};_0x1ab87a(++_0x1c3d3f);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4df35f,_0x1791c8){_0x4df35f=_0x4df35f-0x0;var _0x24f86f=_0xb43b[_0x4df35f];return _0x24f86f;};'use strict';var Sequelize=require(_0xbb43('0x0'));module[_0xbb43('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbb43('0x2')]},'host':{'type':Sequelize[_0xbb43('0x2')]},'zone':{'type':Sequelize[_0xbb43('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xbb43('0x2')]},'serverUrl':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xbb43('0x2')]},'refreshToken':{'type':Sequelize[_0xbb43('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index abb3905..17a3b53 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 _0x4b1c=['clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','refreshToken','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Owner','Subject','WhoId','Call_Duration','Call_Start_Time','Call_Type','remove','api_name','system_mandatory','push','custom_field','data_type','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','ZohoAccount','includeAll','include','params','length','options','find','catch','create','body','getConfigurations','findOne','ZohoConfiguration','hasOwnProperty','addConfiguration','AccountId','channel','Descriptions','getDescriptions','Subjects','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','clientId'];(function(_0x40001a,_0x57f2ae){var _0x4cec45=function(_0x5e4166){while(--_0x5e4166){_0x40001a['push'](_0x40001a['shift']());}};_0x4cec45(++_0x57f2ae);}(_0x4b1c,0x11c));var _0xc4b1=function(_0x3002ce,_0x34d68a){_0x3002ce=_0x3002ce-0x0;var _0x5f2fb5=_0x4b1c[_0x3002ce];return _0x5f2fb5;};'use strict';var emlformat=require(_0xc4b1('0x0'));var rimraf=require(_0xc4b1('0x1'));var zipdir=require(_0xc4b1('0x2'));var jsonpatch=require(_0xc4b1('0x3'));var rp=require(_0xc4b1('0x4'));var moment=require('moment');var BPromise=require(_0xc4b1('0x5'));var Mustache=require(_0xc4b1('0x6'));var util=require(_0xc4b1('0x7'));var path=require(_0xc4b1('0x8'));var sox=require(_0xc4b1('0x9'));var csv=require(_0xc4b1('0xa'));var ejs=require(_0xc4b1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc4b1('0xc'));var jsforce=require(_0xc4b1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc4b1('0xa'));var querystring=require(_0xc4b1('0xe'));var Papa=require(_0xc4b1('0xf'));var Redis=require(_0xc4b1('0x10'));var authService=require(_0xc4b1('0x11'));var qs=require(_0xc4b1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4b1('0x13'));var logger=require(_0xc4b1('0x14'))(_0xc4b1('0x15'));var utils=require('../../config/utils');var config=require(_0xc4b1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc4b1('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1c847a,_0xbca407){_0xbca407=_0xbca407||0xcc;return function(_0x350e79){if(_0x350e79){return _0x1c847a[_0xc4b1('0x18')](_0xbca407);}return _0x1c847a['status'](_0xbca407)[_0xc4b1('0x19')]();};}function respondWithResult(_0x2f89b5,_0x446bfb){_0x446bfb=_0x446bfb||0xc8;return function(_0x362a63){if(_0x362a63){return _0x2f89b5[_0xc4b1('0x1a')](_0x446bfb)[_0xc4b1('0x1b')](_0x362a63);}};}function respondWithFilteredResult(_0x50b829,_0x26af4c){return function(_0x4ed7cd){if(_0x4ed7cd){var _0x22422d=typeof _0x26af4c[_0xc4b1('0x1c')]===_0xc4b1('0x1d')&&typeof _0x26af4c[_0xc4b1('0x1e')]==='undefined';var _0x148acb=_0x4ed7cd[_0xc4b1('0x1f')];var _0x524c7f=_0x22422d?0x0:_0x26af4c['offset'];var _0x3dbc11=_0x22422d?_0x4ed7cd[_0xc4b1('0x1f')]:_0x26af4c[_0xc4b1('0x1c')]+_0x26af4c[_0xc4b1('0x1e')];var _0x47012b;if(_0x3dbc11>=_0x148acb){_0x3dbc11=_0x148acb;_0x47012b=0xc8;}else{_0x47012b=0xce;}_0x50b829[_0xc4b1('0x1a')](_0x47012b);return _0x50b829[_0xc4b1('0x20')](_0xc4b1('0x21'),_0x524c7f+'-'+_0x3dbc11+'/'+_0x148acb)[_0xc4b1('0x1b')](_0x4ed7cd);}return null;};}function patchUpdates(_0x416c6f){return function(_0x559b9f){try{jsonpatch[_0xc4b1('0x22')](_0x559b9f,_0x416c6f,!![]);}catch(_0x4b3d6c){return BPromise[_0xc4b1('0x23')](_0x4b3d6c);}return _0x559b9f['save']();};}function saveUpdates(_0x558415,_0x215a70){return function(_0x81174e){if(_0x81174e){return _0x81174e[_0xc4b1('0x24')](_0x558415)[_0xc4b1('0x25')](function(_0x50d37e){return _0x50d37e;});}return null;};}function removeEntity(_0x15f2df,_0x16ebe3){return function(_0xf188b3){if(_0xf188b3){return _0xf188b3[_0xc4b1('0x26')]()[_0xc4b1('0x25')](function(){_0x15f2df['status'](0xcc)[_0xc4b1('0x19')]();});}};}function handleEntityNotFound(_0x9441ce,_0x37ce77){return function(_0x425545){if(!_0x425545){_0x9441ce[_0xc4b1('0x18')](0x194);}return _0x425545;};}function handleError(_0x2584ae,_0x1126a4){_0x1126a4=_0x1126a4||0x1f4;return function(_0x5c4c9e){logger[_0xc4b1('0x27')](_0x5c4c9e['stack']);if(_0x5c4c9e[_0xc4b1('0x28')]){delete _0x5c4c9e[_0xc4b1('0x28')];}_0x2584ae['status'](_0x1126a4)[_0xc4b1('0x29')](_0x5c4c9e);};}exports[_0xc4b1('0x2a')]=function(_0x3dd357,_0x322122){var _0x9fc52={},_0x5bc007={},_0x211d10={'count':0x0,'rows':[]};var _0x599890=_[_0xc4b1('0x2b')](db['ZohoAccount'][_0xc4b1('0x2c')],function(_0x5868c8){return{'name':_0x5868c8[_0xc4b1('0x2d')],'type':_0x5868c8[_0xc4b1('0x2e')][_0xc4b1('0x2f')]};});_0x5bc007['model']=_[_0xc4b1('0x2b')](_0x599890,_0xc4b1('0x28'));_0x5bc007[_0xc4b1('0x30')]=_[_0xc4b1('0x31')](_0x3dd357['query']);_0x5bc007['filters']=_[_0xc4b1('0x32')](_0x5bc007[_0xc4b1('0x33')],_0x5bc007['query']);_0x9fc52['attributes']=_[_0xc4b1('0x32')](_0x5bc007[_0xc4b1('0x33')],qs['fields'](_0x3dd357[_0xc4b1('0x30')][_0xc4b1('0x34')]));_0x9fc52[_0xc4b1('0x35')]=_0x9fc52[_0xc4b1('0x35')]['length']?_0x9fc52[_0xc4b1('0x35')]:_0x5bc007['model'];if(!_0x3dd357[_0xc4b1('0x30')]['hasOwnProperty'](_0xc4b1('0x36'))){_0x9fc52[_0xc4b1('0x1e')]=qs[_0xc4b1('0x1e')](_0x3dd357[_0xc4b1('0x30')][_0xc4b1('0x1e')]);_0x9fc52[_0xc4b1('0x1c')]=qs[_0xc4b1('0x1c')](_0x3dd357['query']['offset']);}_0x9fc52[_0xc4b1('0x37')]=qs[_0xc4b1('0x38')](_0x3dd357[_0xc4b1('0x30')][_0xc4b1('0x38')]);_0x9fc52[_0xc4b1('0x39')]=qs[_0xc4b1('0x3a')](_[_0xc4b1('0x3b')](_0x3dd357['query'],_0x5bc007[_0xc4b1('0x3a')]),_0x599890);if(_0x3dd357[_0xc4b1('0x30')]['filter']){_0x9fc52[_0xc4b1('0x39')]=_[_0xc4b1('0x3c')](_0x9fc52[_0xc4b1('0x39')],{'$or':_[_0xc4b1('0x2b')](_0x599890,function(_0x49d97f){if(_0x49d97f[_0xc4b1('0x2e')]!==_0xc4b1('0x3d')){var _0x40598b={};_0x40598b[_0x49d97f[_0xc4b1('0x28')]]={'$like':'%'+_0x3dd357[_0xc4b1('0x30')][_0xc4b1('0x3e')]+'%'};return _0x40598b;}})});}_0x9fc52=_[_0xc4b1('0x3c')]({},_0x9fc52,_0x3dd357['options']);var _0x49d5ae={'where':_0x9fc52[_0xc4b1('0x39')]};return db[_0xc4b1('0x3f')][_0xc4b1('0x1f')](_0x49d5ae)[_0xc4b1('0x25')](function(_0x624303){_0x211d10['count']=_0x624303;if(_0x3dd357[_0xc4b1('0x30')][_0xc4b1('0x40')]){_0x9fc52[_0xc4b1('0x41')]=[{'all':!![]}];}return db[_0xc4b1('0x3f')]['findAll'](_0x9fc52);})['then'](function(_0x47c956){_0x211d10['rows']=_0x47c956;return _0x211d10;})['then'](respondWithFilteredResult(_0x322122,_0x9fc52))['catch'](handleError(_0x322122,null));};exports['show']=function(_0x19099e,_0x252351){var _0x1057a7={'raw':![],'where':{'id':_0x19099e[_0xc4b1('0x42')]['id']}},_0x3a3c0e={};_0x3a3c0e[_0xc4b1('0x33')]=_[_0xc4b1('0x31')](db[_0xc4b1('0x3f')][_0xc4b1('0x2c')]);_0x3a3c0e[_0xc4b1('0x30')]=_[_0xc4b1('0x31')](_0x19099e['query']);_0x3a3c0e['filters']=_[_0xc4b1('0x32')](_0x3a3c0e['model'],_0x3a3c0e['query']);_0x1057a7[_0xc4b1('0x35')]=_['intersection'](_0x3a3c0e['model'],qs[_0xc4b1('0x34')](_0x19099e[_0xc4b1('0x30')][_0xc4b1('0x34')]));_0x1057a7[_0xc4b1('0x35')]=_0x1057a7[_0xc4b1('0x35')][_0xc4b1('0x43')]?_0x1057a7['attributes']:_0x3a3c0e['model'];if(_0x19099e[_0xc4b1('0x30')][_0xc4b1('0x40')]){_0x1057a7[_0xc4b1('0x41')]=[{'all':!![]}];}_0x1057a7=_[_0xc4b1('0x3c')]({},_0x1057a7,_0x19099e[_0xc4b1('0x44')]);return db['ZohoAccount'][_0xc4b1('0x45')](_0x1057a7)[_0xc4b1('0x25')](handleEntityNotFound(_0x252351,null))[_0xc4b1('0x25')](respondWithResult(_0x252351,null))[_0xc4b1('0x46')](handleError(_0x252351,null));};exports['create']=function(_0xdc621,_0x4c64c9){return db[_0xc4b1('0x3f')][_0xc4b1('0x47')](_0xdc621[_0xc4b1('0x48')],{})[_0xc4b1('0x25')](respondWithResult(_0x4c64c9,0xc9))[_0xc4b1('0x46')](handleError(_0x4c64c9,null));};exports[_0xc4b1('0x24')]=function(_0x36613b,_0x137636){if(_0x36613b[_0xc4b1('0x48')]['id']){delete _0x36613b[_0xc4b1('0x48')]['id'];}return db[_0xc4b1('0x3f')][_0xc4b1('0x45')]({'where':{'id':_0x36613b[_0xc4b1('0x42')]['id']}})['then'](handleEntityNotFound(_0x137636,null))[_0xc4b1('0x25')](saveUpdates(_0x36613b['body'],null))[_0xc4b1('0x25')](respondWithResult(_0x137636,null))[_0xc4b1('0x46')](handleError(_0x137636,null));};exports[_0xc4b1('0x26')]=function(_0x984143,_0x36d91e){return db[_0xc4b1('0x3f')][_0xc4b1('0x45')]({'where':{'id':_0x984143[_0xc4b1('0x42')]['id']}})['then'](handleEntityNotFound(_0x36d91e,null))['then'](removeEntity(_0x36d91e,null))[_0xc4b1('0x46')](handleError(_0x36d91e,null));};exports[_0xc4b1('0x49')]=function(_0x58a808,_0x3b95c9,_0x15dfd7){var _0x3237c3={};var _0x27b5c4={};var _0xfd3352;var _0x5d6dc5;return db[_0xc4b1('0x3f')][_0xc4b1('0x4a')]({'where':{'id':_0x58a808[_0xc4b1('0x42')]['id']}})[_0xc4b1('0x25')](handleEntityNotFound(_0x3b95c9,null))[_0xc4b1('0x25')](function(_0xfac40b){if(_0xfac40b){_0xfd3352=_0xfac40b;_0x27b5c4[_0xc4b1('0x33')]=_[_0xc4b1('0x31')](db[_0xc4b1('0x4b')][_0xc4b1('0x2c')]);_0x27b5c4['query']=_[_0xc4b1('0x31')](_0x58a808[_0xc4b1('0x30')]);_0x27b5c4[_0xc4b1('0x3a')]=_['intersection'](_0x27b5c4[_0xc4b1('0x33')],_0x27b5c4[_0xc4b1('0x30')]);_0x3237c3[_0xc4b1('0x35')]=_[_0xc4b1('0x32')](_0x27b5c4[_0xc4b1('0x33')],qs['fields'](_0x58a808[_0xc4b1('0x30')][_0xc4b1('0x34')]));_0x3237c3[_0xc4b1('0x35')]=_0x3237c3[_0xc4b1('0x35')][_0xc4b1('0x43')]?_0x3237c3['attributes']:_0x27b5c4['model'];_0x3237c3[_0xc4b1('0x37')]=qs[_0xc4b1('0x38')](_0x58a808['query']['sort']);_0x3237c3['where']=qs[_0xc4b1('0x3a')](_[_0xc4b1('0x3b')](_0x58a808['query'],_0x27b5c4['filters']));if(_0x58a808[_0xc4b1('0x30')][_0xc4b1('0x3e')]){_0x3237c3[_0xc4b1('0x39')]=_[_0xc4b1('0x3c')](_0x3237c3[_0xc4b1('0x39')],{'$or':_[_0xc4b1('0x2b')](_0x3237c3[_0xc4b1('0x35')],function(_0x37624f){var _0x4f2965={};_0x4f2965[_0x37624f]={'$like':'%'+_0x58a808[_0xc4b1('0x30')]['filter']+'%'};return _0x4f2965;})});}_0x3237c3=_[_0xc4b1('0x3c')]({},_0x3237c3,_0x58a808[_0xc4b1('0x44')]);return _0xfd3352[_0xc4b1('0x49')](_0x3237c3);}})[_0xc4b1('0x25')](function(_0x3f1ba5){if(_0x3f1ba5){_0x5d6dc5=_0x3f1ba5[_0xc4b1('0x43')];if(!_0x58a808[_0xc4b1('0x30')][_0xc4b1('0x4c')](_0xc4b1('0x36'))){_0x3237c3[_0xc4b1('0x1e')]=qs['limit'](_0x58a808[_0xc4b1('0x30')][_0xc4b1('0x1e')]);_0x3237c3[_0xc4b1('0x1c')]=qs[_0xc4b1('0x1c')](_0x58a808[_0xc4b1('0x30')][_0xc4b1('0x1c')]);}return _0xfd3352[_0xc4b1('0x49')](_0x3237c3);}})[_0xc4b1('0x25')](function(_0x5a47bd){if(_0x5a47bd){return _0x5a47bd?{'count':_0x5d6dc5,'rows':_0x5a47bd}:null;}})[_0xc4b1('0x25')](respondWithResult(_0x3b95c9,null))[_0xc4b1('0x46')](handleError(_0x3b95c9,null));};exports[_0xc4b1('0x4d')]=function(_0x3fcd33,_0x5b54c7,_0x148c9f){if(_0x3fcd33[_0xc4b1('0x48')]['id']){delete _0x3fcd33['body']['id'];}return db['ZohoAccount'][_0xc4b1('0x4a')]({'where':{'id':_0x3fcd33['params']['id']}})[_0xc4b1('0x25')](handleEntityNotFound(_0x5b54c7,null))[_0xc4b1('0x25')](function(_0x504ebe){if(_0x504ebe){_0x3fcd33['body'][_0xc4b1('0x4e')]=_0x504ebe['id'];_0x3fcd33['body']['Subjects']=integrations['getSubjects'](_0x3fcd33[_0xc4b1('0x48')][_0xc4b1('0x4f')],_0x3fcd33['body'][_0xc4b1('0x2e')]);_0x3fcd33[_0xc4b1('0x48')][_0xc4b1('0x50')]=integrations[_0xc4b1('0x51')](_0x3fcd33['body']['channel'],_0x3fcd33[_0xc4b1('0x48')][_0xc4b1('0x2e')]);return db[_0xc4b1('0x4b')][_0xc4b1('0x47')](_0x3fcd33[_0xc4b1('0x48')],{'include':[{'model':db['ZohoField'],'as':_0xc4b1('0x52')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0xc4b1('0x25')](respondWithResult(_0x5b54c7,null))['catch'](handleError(_0x5b54c7,null));};function getAccessToken(_0x57446e){return new Promise(function(_0x2c3311,_0x322f91){var _0x54adf4;switch(_0x57446e['zone']){case'US':_0x54adf4=_0xc4b1('0x53');break;case'AU':_0x54adf4=_0xc4b1('0x54');break;case'EU':_0x54adf4='https://accounts.zoho.eu';break;case'IN':_0x54adf4=_0xc4b1('0x55');break;case'CN':_0x54adf4=_0xc4b1('0x56');break;default:_0x54adf4='https://accounts.zoho.eu';break;}var _0x2cdf20={'method':'POST','uri':_0x54adf4+'/oauth/v2/token','qs':{'refresh_token':_0x57446e['refreshToken'],'client_id':_0x57446e[_0xc4b1('0x57')],'client_secret':_0x57446e[_0xc4b1('0x58')],'grant_type':_0xc4b1('0x59')},'json':!![]};return rp(_0x2cdf20)[_0xc4b1('0x25')](function(_0x478537){if(_0x478537['access_token']){_0x2c3311(_0x478537[_0xc4b1('0x5a')]);}else{_0x322f91(_0xc4b1('0x5b'));}})['catch'](function(_0xa4c42f){_0x322f91(_0xa4c42f);});});}exports[_0xc4b1('0x5c')]=function(_0x25ba3b,_0x793de9,_0x4f84d3){var _0x225777,_0x168559,_0x58a2e7,_0xbe1768,_0x29e1a4;return db[_0xc4b1('0x3f')]['findOne']({'where':{'id':_0x25ba3b[_0xc4b1('0x42')]['id']},'attributes':['id',_0xc4b1('0x5d'),_0xc4b1('0x5e'),_0xc4b1('0x57'),_0xc4b1('0x58'),'serverUrl','code',_0xc4b1('0x5f')]})[_0xc4b1('0x25')](handleEntityNotFound(_0x793de9,null))['then'](function(_0x5e2110){_0x29e1a4=_0x5e2110;_0x225777=_0x29e1a4[_0xc4b1('0x5d')];_0x168559=_0x225777===_0xc4b1('0x60')?'eu':_0xc4b1('0x61');_0x58a2e7=_0x29e1a4[_0xc4b1('0x62')];var _0x21f2ec=_0x58a2e7[_0xc4b1('0x63')](-0x1);if(_0x21f2ec==='/'||_0x21f2ec==='\x5c'||_0x21f2ec===':'){_0x58a2e7=_0x58a2e7[_0xc4b1('0x64')](0x0,_0x58a2e7[_0xc4b1('0x65')](_0x21f2ec));}if(!_0x29e1a4[_0xc4b1('0x5f')]){throw new Error(_0xc4b1('0x66'));}return getAccessToken(_0x29e1a4);})['then'](function(_0x402f4a){if(_0x402f4a){return rp({'method':_0xc4b1('0x67'),'uri':util[_0xc4b1('0x68')](_0xc4b1('0x69'),_0x168559),'qs':{'module':_0xc4b1('0x6a')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x402f4a},'json':!![]});}})[_0xc4b1('0x25')](function(_0x29e3d3){if(_0x29e3d3){if(_0x29e3d3['response']&&_0x29e3d3[_0xc4b1('0x6b')][_0xc4b1('0x27')]){throw new Error(_0x29e3d3[_0xc4b1('0x6b')][_0xc4b1('0x27')][_0xc4b1('0x6c')]);}var _0x218671=[];var _0x540e89=[];var _0x4df1be=[_0xc4b1('0x6d'),_0xc4b1('0x6e'),'Description',_0xc4b1('0x6f'),_0xc4b1('0x70'),'Call_Result',_0xc4b1('0x71'),_0xc4b1('0x72')];_0x540e89=_[_0xc4b1('0x73')](_0x29e3d3[_0xc4b1('0x34')],function(_0x3c9ad7){return _0x4df1be['includes'](_0x3c9ad7[_0xc4b1('0x74')]);});for(var _0x1c9f4a=0x0;_0x1c9f4a<_0x540e89[_0xc4b1('0x43')];_0x1c9f4a++){if(_0x540e89[_0x1c9f4a][_0xc4b1('0x75')]===![]){_0x218671[_0xc4b1('0x76')]({'id':_0x540e89[_0x1c9f4a]['id'],'name':_0x540e89[_0x1c9f4a]['display_label'],'custom':_0x540e89[_0x1c9f4a][_0xc4b1('0x77')],'options':_0x540e89[_0x1c9f4a][_0xc4b1('0x78')]==='picklist'&&_0x540e89[_0x1c9f4a][_0xc4b1('0x79')][_0xc4b1('0x43')]>-0x1?_[_0xc4b1('0x2b')](_0x540e89[_0x1c9f4a][_0xc4b1('0x79')],function(_0x4cc005){return{'name':_0x4cc005,'value':_0x4cc005};}):[]});}}return{'count':_0x218671[_0xc4b1('0x43')],'rows':_0x218671};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x793de9,null))[_0xc4b1('0x46')](function(_0x4fed8a){var _0x11f522=_0x25ba3b[_0xc4b1('0x30')]['test']?0x1f4:_0x4fed8a['statusCode']||0x1f4;logger[_0xc4b1('0x27')](_0xc4b1('0x7a'),_0xc4b1('0x5c'),_0x11f522,JSON['stringify'](_0x4fed8a));delete _0x4fed8a['name'];if(_0x11f522===0x191){_0x11f522=0x190;}_0x793de9[_0xc4b1('0x1a')](_0x11f522)[_0xc4b1('0x29')](_0x25ba3b[_0xc4b1('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4fed8a[_0xc4b1('0x7b')]}:_0x4fed8a);});}; \ No newline at end of file +var _0xb4e9=['where','pick','merge','VIRTUAL','filter','includeAll','include','rows','show','params','intersection','find','catch','create','body','getConfigurations','ZohoConfiguration','options','nolimit','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZohoField','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','findOne','host','zone','clientId','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Zoho-oauthtoken\x20','response','error','message','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','destroy','then','end','stack','name','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x2a9495,_0x4df774){var _0x412a9e=function(_0x21195e){while(--_0x21195e){_0x2a9495['push'](_0x2a9495['shift']());}};_0x412a9e(++_0x4df774);}(_0xb4e9,0xd7));var _0x9b4e=function(_0x50150f,_0x92b2ca){_0x50150f=_0x50150f-0x0;var _0x3f3764=_0xb4e9[_0x50150f];return _0x3f3764;};'use strict';var emlformat=require(_0x9b4e('0x0'));var rimraf=require(_0x9b4e('0x1'));var zipdir=require(_0x9b4e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9b4e('0x3'));var moment=require(_0x9b4e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9b4e('0x5'));var util=require(_0x9b4e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9b4e('0x7'));var ejs=require(_0x9b4e('0x8'));var fs=require('fs');var fs_extra=require(_0x9b4e('0x9'));var _=require(_0x9b4e('0xa'));var squel=require(_0x9b4e('0xb'));var crypto=require(_0x9b4e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9b4e('0xd'));var toCsv=require(_0x9b4e('0x7'));var querystring=require(_0x9b4e('0xe'));var Papa=require('papaparse');var Redis=require(_0x9b4e('0xf'));var authService=require(_0x9b4e('0x10'));var qs=require(_0x9b4e('0x11'));var as=require(_0x9b4e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b4e('0x13'))(_0x9b4e('0x14'));var utils=require(_0x9b4e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9b4e('0x16'));var db=require(_0x9b4e('0x17'))['db'];var integrations=require(_0x9b4e('0x18'));function respondWithStatusCode(_0x50ff8e,_0x1c6356){_0x1c6356=_0x1c6356||0xcc;return function(_0x128958){if(_0x128958){return _0x50ff8e[_0x9b4e('0x19')](_0x1c6356);}return _0x50ff8e['status'](_0x1c6356)['end']();};}function respondWithResult(_0x9968d9,_0x161ed6){_0x161ed6=_0x161ed6||0xc8;return function(_0x1e9464){if(_0x1e9464){return _0x9968d9[_0x9b4e('0x1a')](_0x161ed6)['json'](_0x1e9464);}};}function respondWithFilteredResult(_0x654f93,_0x458251){return function(_0x5b046c){if(_0x5b046c){var _0x4402ca=typeof _0x458251[_0x9b4e('0x1b')]==='undefined'&&typeof _0x458251[_0x9b4e('0x1c')]===_0x9b4e('0x1d');var _0x2ee03b=_0x5b046c['count'];var _0x3d5f5d=_0x4402ca?0x0:_0x458251['offset'];var _0xdfc991=_0x4402ca?_0x5b046c[_0x9b4e('0x1e')]:_0x458251[_0x9b4e('0x1b')]+_0x458251[_0x9b4e('0x1c')];var _0x19d3ca;if(_0xdfc991>=_0x2ee03b){_0xdfc991=_0x2ee03b;_0x19d3ca=0xc8;}else{_0x19d3ca=0xce;}_0x654f93[_0x9b4e('0x1a')](_0x19d3ca);return _0x654f93['set'](_0x9b4e('0x1f'),_0x3d5f5d+'-'+_0xdfc991+'/'+_0x2ee03b)[_0x9b4e('0x20')](_0x5b046c);}return null;};}function patchUpdates(_0x1004db){return function(_0x1892fd){try{jsonpatch[_0x9b4e('0x21')](_0x1892fd,_0x1004db,!![]);}catch(_0x18b989){return BPromise[_0x9b4e('0x22')](_0x18b989);}return _0x1892fd[_0x9b4e('0x23')]();};}function saveUpdates(_0x492a56,_0xda510e){return function(_0x416a1d){if(_0x416a1d){return _0x416a1d[_0x9b4e('0x24')](_0x492a56)['then'](function(_0x105a0e){return _0x105a0e;});}return null;};}function removeEntity(_0xc869d6,_0x4fe26e){return function(_0x15086f){if(_0x15086f){return _0x15086f[_0x9b4e('0x25')]()[_0x9b4e('0x26')](function(){_0xc869d6[_0x9b4e('0x1a')](0xcc)[_0x9b4e('0x27')]();});}};}function handleEntityNotFound(_0x274084,_0x340ebb){return function(_0x42c491){if(!_0x42c491){_0x274084[_0x9b4e('0x19')](0x194);}return _0x42c491;};}function handleError(_0x5c10e8,_0x2d9d10){_0x2d9d10=_0x2d9d10||0x1f4;return function(_0x45b724){logger['error'](_0x45b724[_0x9b4e('0x28')]);if(_0x45b724[_0x9b4e('0x29')]){delete _0x45b724[_0x9b4e('0x29')];}_0x5c10e8[_0x9b4e('0x1a')](_0x2d9d10)['send'](_0x45b724);};}exports[_0x9b4e('0x2a')]=function(_0x57c09,_0x35a1d4){var _0x599de={},_0x5e17b1={},_0x276a5c={'count':0x0,'rows':[]};var _0x590038=_[_0x9b4e('0x2b')](db[_0x9b4e('0x2c')][_0x9b4e('0x2d')],function(_0x388ad7){return{'name':_0x388ad7[_0x9b4e('0x2e')],'type':_0x388ad7[_0x9b4e('0x2f')][_0x9b4e('0x30')]};});_0x5e17b1[_0x9b4e('0x31')]=_[_0x9b4e('0x2b')](_0x590038,'name');_0x5e17b1[_0x9b4e('0x32')]=_[_0x9b4e('0x33')](_0x57c09[_0x9b4e('0x32')]);_0x5e17b1[_0x9b4e('0x34')]=_['intersection'](_0x5e17b1[_0x9b4e('0x31')],_0x5e17b1[_0x9b4e('0x32')]);_0x599de[_0x9b4e('0x35')]=_['intersection'](_0x5e17b1['model'],qs[_0x9b4e('0x36')](_0x57c09[_0x9b4e('0x32')]['fields']));_0x599de['attributes']=_0x599de[_0x9b4e('0x35')][_0x9b4e('0x37')]?_0x599de[_0x9b4e('0x35')]:_0x5e17b1[_0x9b4e('0x31')];if(!_0x57c09[_0x9b4e('0x32')][_0x9b4e('0x38')]('nolimit')){_0x599de[_0x9b4e('0x1c')]=qs['limit'](_0x57c09[_0x9b4e('0x32')][_0x9b4e('0x1c')]);_0x599de['offset']=qs[_0x9b4e('0x1b')](_0x57c09[_0x9b4e('0x32')][_0x9b4e('0x1b')]);}_0x599de[_0x9b4e('0x39')]=qs[_0x9b4e('0x3a')](_0x57c09[_0x9b4e('0x32')][_0x9b4e('0x3a')]);_0x599de[_0x9b4e('0x3b')]=qs[_0x9b4e('0x34')](_[_0x9b4e('0x3c')](_0x57c09[_0x9b4e('0x32')],_0x5e17b1['filters']),_0x590038);if(_0x57c09[_0x9b4e('0x32')]['filter']){_0x599de[_0x9b4e('0x3b')]=_[_0x9b4e('0x3d')](_0x599de['where'],{'$or':_[_0x9b4e('0x2b')](_0x590038,function(_0x16b0fa){if(_0x16b0fa[_0x9b4e('0x2f')]!==_0x9b4e('0x3e')){var _0x27c0be={};_0x27c0be[_0x16b0fa[_0x9b4e('0x29')]]={'$like':'%'+_0x57c09[_0x9b4e('0x32')][_0x9b4e('0x3f')]+'%'};return _0x27c0be;}})});}_0x599de=_[_0x9b4e('0x3d')]({},_0x599de,_0x57c09['options']);var _0x50b899={'where':_0x599de[_0x9b4e('0x3b')]};return db[_0x9b4e('0x2c')][_0x9b4e('0x1e')](_0x50b899)['then'](function(_0xbff5d1){_0x276a5c[_0x9b4e('0x1e')]=_0xbff5d1;if(_0x57c09['query'][_0x9b4e('0x40')]){_0x599de[_0x9b4e('0x41')]=[{'all':!![]}];}return db[_0x9b4e('0x2c')]['findAll'](_0x599de);})[_0x9b4e('0x26')](function(_0x2c996a){_0x276a5c[_0x9b4e('0x42')]=_0x2c996a;return _0x276a5c;})[_0x9b4e('0x26')](respondWithFilteredResult(_0x35a1d4,_0x599de))['catch'](handleError(_0x35a1d4,null));};exports[_0x9b4e('0x43')]=function(_0x113985,_0x371200){var _0x4f4b2f={'raw':![],'where':{'id':_0x113985[_0x9b4e('0x44')]['id']}},_0x2f71a0={};_0x2f71a0['model']=_[_0x9b4e('0x33')](db[_0x9b4e('0x2c')]['rawAttributes']);_0x2f71a0[_0x9b4e('0x32')]=_[_0x9b4e('0x33')](_0x113985[_0x9b4e('0x32')]);_0x2f71a0[_0x9b4e('0x34')]=_[_0x9b4e('0x45')](_0x2f71a0[_0x9b4e('0x31')],_0x2f71a0[_0x9b4e('0x32')]);_0x4f4b2f[_0x9b4e('0x35')]=_[_0x9b4e('0x45')](_0x2f71a0['model'],qs['fields'](_0x113985[_0x9b4e('0x32')][_0x9b4e('0x36')]));_0x4f4b2f[_0x9b4e('0x35')]=_0x4f4b2f['attributes'][_0x9b4e('0x37')]?_0x4f4b2f[_0x9b4e('0x35')]:_0x2f71a0['model'];if(_0x113985[_0x9b4e('0x32')]['includeAll']){_0x4f4b2f[_0x9b4e('0x41')]=[{'all':!![]}];}_0x4f4b2f=_[_0x9b4e('0x3d')]({},_0x4f4b2f,_0x113985['options']);return db[_0x9b4e('0x2c')][_0x9b4e('0x46')](_0x4f4b2f)[_0x9b4e('0x26')](handleEntityNotFound(_0x371200,null))[_0x9b4e('0x26')](respondWithResult(_0x371200,null))[_0x9b4e('0x47')](handleError(_0x371200,null));};exports[_0x9b4e('0x48')]=function(_0x3bf551,_0x2ab050){return db[_0x9b4e('0x2c')][_0x9b4e('0x48')](_0x3bf551['body'],{})['then'](respondWithResult(_0x2ab050,0xc9))[_0x9b4e('0x47')](handleError(_0x2ab050,null));};exports[_0x9b4e('0x24')]=function(_0x25d5af,_0x33f6c9){if(_0x25d5af[_0x9b4e('0x49')]['id']){delete _0x25d5af[_0x9b4e('0x49')]['id'];}return db[_0x9b4e('0x2c')]['find']({'where':{'id':_0x25d5af[_0x9b4e('0x44')]['id']}})[_0x9b4e('0x26')](handleEntityNotFound(_0x33f6c9,null))['then'](saveUpdates(_0x25d5af[_0x9b4e('0x49')],null))[_0x9b4e('0x26')](respondWithResult(_0x33f6c9,null))['catch'](handleError(_0x33f6c9,null));};exports[_0x9b4e('0x25')]=function(_0x3e537c,_0x120a9f){return db[_0x9b4e('0x2c')]['find']({'where':{'id':_0x3e537c[_0x9b4e('0x44')]['id']}})[_0x9b4e('0x26')](handleEntityNotFound(_0x120a9f,null))['then'](removeEntity(_0x120a9f,null))[_0x9b4e('0x47')](handleError(_0x120a9f,null));};exports[_0x9b4e('0x4a')]=function(_0x29997b,_0x22f088,_0x4b6fe7){var _0x2e854c={};var _0x5b027e={};var _0x497b15;var _0x20ed9c;return db[_0x9b4e('0x2c')]['findOne']({'where':{'id':_0x29997b[_0x9b4e('0x44')]['id']}})[_0x9b4e('0x26')](handleEntityNotFound(_0x22f088,null))['then'](function(_0x5c3a58){if(_0x5c3a58){_0x497b15=_0x5c3a58;_0x5b027e[_0x9b4e('0x31')]=_[_0x9b4e('0x33')](db[_0x9b4e('0x4b')][_0x9b4e('0x2d')]);_0x5b027e[_0x9b4e('0x32')]=_[_0x9b4e('0x33')](_0x29997b['query']);_0x5b027e[_0x9b4e('0x34')]=_['intersection'](_0x5b027e[_0x9b4e('0x31')],_0x5b027e[_0x9b4e('0x32')]);_0x2e854c['attributes']=_[_0x9b4e('0x45')](_0x5b027e['model'],qs['fields'](_0x29997b[_0x9b4e('0x32')][_0x9b4e('0x36')]));_0x2e854c[_0x9b4e('0x35')]=_0x2e854c[_0x9b4e('0x35')][_0x9b4e('0x37')]?_0x2e854c[_0x9b4e('0x35')]:_0x5b027e[_0x9b4e('0x31')];_0x2e854c[_0x9b4e('0x39')]=qs['sort'](_0x29997b[_0x9b4e('0x32')]['sort']);_0x2e854c[_0x9b4e('0x3b')]=qs[_0x9b4e('0x34')](_[_0x9b4e('0x3c')](_0x29997b[_0x9b4e('0x32')],_0x5b027e[_0x9b4e('0x34')]));if(_0x29997b[_0x9b4e('0x32')][_0x9b4e('0x3f')]){_0x2e854c[_0x9b4e('0x3b')]=_['merge'](_0x2e854c[_0x9b4e('0x3b')],{'$or':_['map'](_0x2e854c[_0x9b4e('0x35')],function(_0x2b1756){var _0x5db44f={};_0x5db44f[_0x2b1756]={'$like':'%'+_0x29997b[_0x9b4e('0x32')][_0x9b4e('0x3f')]+'%'};return _0x5db44f;})});}_0x2e854c=_[_0x9b4e('0x3d')]({},_0x2e854c,_0x29997b[_0x9b4e('0x4c')]);return _0x497b15[_0x9b4e('0x4a')](_0x2e854c);}})[_0x9b4e('0x26')](function(_0x347001){if(_0x347001){_0x20ed9c=_0x347001[_0x9b4e('0x37')];if(!_0x29997b[_0x9b4e('0x32')]['hasOwnProperty'](_0x9b4e('0x4d'))){_0x2e854c[_0x9b4e('0x1c')]=qs[_0x9b4e('0x1c')](_0x29997b[_0x9b4e('0x32')][_0x9b4e('0x1c')]);_0x2e854c[_0x9b4e('0x1b')]=qs[_0x9b4e('0x1b')](_0x29997b[_0x9b4e('0x32')]['offset']);}return _0x497b15[_0x9b4e('0x4a')](_0x2e854c);}})['then'](function(_0x449422){if(_0x449422){return _0x449422?{'count':_0x20ed9c,'rows':_0x449422}:null;}})[_0x9b4e('0x26')](respondWithResult(_0x22f088,null))[_0x9b4e('0x47')](handleError(_0x22f088,null));};exports['addConfiguration']=function(_0x1af244,_0xe50936,_0x53f54f){if(_0x1af244[_0x9b4e('0x49')]['id']){delete _0x1af244[_0x9b4e('0x49')]['id'];}return db[_0x9b4e('0x2c')]['findOne']({'where':{'id':_0x1af244[_0x9b4e('0x44')]['id']}})['then'](handleEntityNotFound(_0xe50936,null))['then'](function(_0x2fab47){if(_0x2fab47){_0x1af244[_0x9b4e('0x49')][_0x9b4e('0x4e')]=_0x2fab47['id'];_0x1af244[_0x9b4e('0x49')][_0x9b4e('0x4f')]=integrations[_0x9b4e('0x50')](_0x1af244['body']['channel'],_0x1af244['body']['type']);_0x1af244[_0x9b4e('0x49')][_0x9b4e('0x51')]=integrations[_0x9b4e('0x52')](_0x1af244['body'][_0x9b4e('0x53')],_0x1af244[_0x9b4e('0x49')][_0x9b4e('0x2f')]);return db[_0x9b4e('0x4b')]['create'](_0x1af244[_0x9b4e('0x49')],{'include':[{'model':db[_0x9b4e('0x54')],'as':_0x9b4e('0x4f')},{'model':db[_0x9b4e('0x54')],'as':_0x9b4e('0x51')}]});}return null;})[_0x9b4e('0x26')](respondWithResult(_0xe50936,null))['catch'](handleError(_0xe50936,null));};function getAccessToken(_0x2c5a60){return new Promise(function(_0x5d62ae,_0x1cabc6){var _0x10a12a;switch(_0x2c5a60['zone']){case'US':_0x10a12a='https://accounts.zoho.com';break;case'AU':_0x10a12a=_0x9b4e('0x55');break;case'EU':_0x10a12a=_0x9b4e('0x56');break;case'IN':_0x10a12a=_0x9b4e('0x57');break;case'CN':_0x10a12a=_0x9b4e('0x58');break;default:_0x10a12a=_0x9b4e('0x56');break;}var _0x3db17e={'method':_0x9b4e('0x59'),'uri':_0x10a12a+_0x9b4e('0x5a'),'qs':{'refresh_token':_0x2c5a60[_0x9b4e('0x5b')],'client_id':_0x2c5a60['clientId'],'client_secret':_0x2c5a60[_0x9b4e('0x5c')],'grant_type':_0x9b4e('0x5d')},'json':!![]};return rp(_0x3db17e)[_0x9b4e('0x26')](function(_0x3ed21b){if(_0x3ed21b[_0x9b4e('0x5e')]){_0x5d62ae(_0x3ed21b[_0x9b4e('0x5e')]);}else{_0x1cabc6(_0x9b4e('0x5f'));}})[_0x9b4e('0x47')](function(_0x46c50a){_0x1cabc6(_0x46c50a);});});}exports['getFields']=function(_0x2a6455,_0x507493,_0x3c071b){var _0x4d7ab0,_0x3f9c51,_0x1a129e,_0x19545d,_0x50cc7f;return db[_0x9b4e('0x2c')][_0x9b4e('0x60')]({'where':{'id':_0x2a6455[_0x9b4e('0x44')]['id']},'attributes':['id',_0x9b4e('0x61'),_0x9b4e('0x62'),_0x9b4e('0x63'),'clientSecret',_0x9b4e('0x64'),_0x9b4e('0x65'),_0x9b4e('0x5b')]})[_0x9b4e('0x26')](handleEntityNotFound(_0x507493,null))[_0x9b4e('0x26')](function(_0x5c8894){_0x50cc7f=_0x5c8894;_0x4d7ab0=_0x50cc7f[_0x9b4e('0x61')];_0x3f9c51=_0x4d7ab0===_0x9b4e('0x66')?'eu':_0x9b4e('0x67');_0x1a129e=_0x50cc7f[_0x9b4e('0x64')];var _0x1ff3a6=_0x1a129e[_0x9b4e('0x68')](-0x1);if(_0x1ff3a6==='/'||_0x1ff3a6==='\x5c'||_0x1ff3a6===':'){_0x1a129e=_0x1a129e[_0x9b4e('0x69')](0x0,_0x1a129e[_0x9b4e('0x6a')](_0x1ff3a6));}if(!_0x50cc7f[_0x9b4e('0x5b')]){throw new Error(_0x9b4e('0x6b'));}return getAccessToken(_0x50cc7f);})[_0x9b4e('0x26')](function(_0x3abd90){if(_0x3abd90){return rp({'method':_0x9b4e('0x6c'),'uri':util[_0x9b4e('0x6d')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x3f9c51),'qs':{'module':'Calls'},'headers':{'Authorization':_0x9b4e('0x6e')+_0x3abd90},'json':!![]});}})['then'](function(_0x241e2b){if(_0x241e2b){if(_0x241e2b[_0x9b4e('0x6f')]&&_0x241e2b['response'][_0x9b4e('0x70')]){throw new Error(_0x241e2b[_0x9b4e('0x6f')][_0x9b4e('0x70')][_0x9b4e('0x71')]);}var _0x4f7ab4=[];var _0x5d5870=[];var _0x288105=['Owner',_0x9b4e('0x72'),_0x9b4e('0x73'),_0x9b4e('0x74'),_0x9b4e('0x75'),_0x9b4e('0x76'),_0x9b4e('0x77'),_0x9b4e('0x78')];_0x5d5870=_[_0x9b4e('0x79')](_0x241e2b[_0x9b4e('0x36')],function(_0x17acda){return _0x288105[_0x9b4e('0x7a')](_0x17acda[_0x9b4e('0x7b')]);});for(var _0x1909c7=0x0;_0x1909c7<_0x5d5870[_0x9b4e('0x37')];_0x1909c7++){if(_0x5d5870[_0x1909c7][_0x9b4e('0x7c')]===![]){_0x4f7ab4[_0x9b4e('0x7d')]({'id':_0x5d5870[_0x1909c7]['id'],'name':_0x5d5870[_0x1909c7][_0x9b4e('0x7e')],'custom':_0x5d5870[_0x1909c7][_0x9b4e('0x7f')],'options':_0x5d5870[_0x1909c7][_0x9b4e('0x80')]===_0x9b4e('0x81')&&_0x5d5870[_0x1909c7][_0x9b4e('0x82')][_0x9b4e('0x37')]>-0x1?_[_0x9b4e('0x2b')](_0x5d5870[_0x1909c7][_0x9b4e('0x82')],function(_0x2f47d9){return{'name':_0x2f47d9,'value':_0x2f47d9};}):[]});}}return{'count':_0x4f7ab4[_0x9b4e('0x37')],'rows':_0x4f7ab4};}else{return{'count':0x0,'rows':[]};}})[_0x9b4e('0x26')](respondWithResult(_0x507493,null))[_0x9b4e('0x47')](function(_0x1feb52){var _0x4ee3fa=_0x2a6455['query'][_0x9b4e('0x83')]?0x1f4:_0x1feb52['statusCode']||0x1f4;logger[_0x9b4e('0x70')](_0x9b4e('0x84'),_0x9b4e('0x85'),_0x4ee3fa,JSON['stringify'](_0x1feb52));delete _0x1feb52[_0x9b4e('0x29')];if(_0x4ee3fa===0x191){_0x4ee3fa=0x190;}_0x507493['status'](_0x4ee3fa)[_0x9b4e('0x86')](_0x2a6455['query'][_0x9b4e('0x83')]?{'message':_0x9b4e('0x87'),'statusCode':_0x1feb52[_0x9b4e('0x88')]}:_0x1feb52);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index f8d646c..a010beb 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 _0xe9f2=['clientId','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','catch','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','application/x-www-form-urlencoded','then','refreshToken','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','ZohoAccount','int_zoho_accounts','changed','zone','clientSecret','code','host','serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xe9f2,0x10f));var _0x2e9f=function(_0x1f96b5,_0x3cec60){_0x1f96b5=_0x1f96b5-0x0;var _0xe59e96=_0xe9f2[_0x1f96b5];return _0xe59e96;};'use strict';var _=require(_0x2e9f('0x0'));var util=require(_0x2e9f('0x1'));var logger=require(_0x2e9f('0x2'))('api');var moment=require(_0x2e9f('0x3'));var BPromise=require(_0x2e9f('0x4'));var rp=require(_0x2e9f('0x5'));var fs=require('fs');var path=require(_0x2e9f('0x6'));var rimraf=require(_0x2e9f('0x7'));var config=require(_0x2e9f('0x8'));var attributes=require(_0x2e9f('0x9'));var integrations=require(_0x2e9f('0xa'));module['exports']=function(_0x55efd6,_0x15dd34){return _0x55efd6['define'](_0x2e9f('0xb'),attributes,{'tableName':_0x2e9f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xcecdf9,_0xc4901f,_0x99b721){if(_0xcecdf9[_0x2e9f('0xd')](_0x2e9f('0xe'))||_0xcecdf9[_0x2e9f('0xd')]('serverUrl')||_0xcecdf9[_0x2e9f('0xd')]('clientId')||_0xcecdf9[_0x2e9f('0xd')](_0x2e9f('0xf'))||_0xcecdf9[_0x2e9f('0xd')](_0x2e9f('0x10'))||_0xcecdf9[_0x2e9f('0xd')](_0x2e9f('0x11'))){var _0x41fc6f,_0x165491;_0x41fc6f=_0xcecdf9[_0x2e9f('0x12')];var _0xadd9ab=_0x41fc6f[_0x2e9f('0x13')](-0x1);if(_0xadd9ab==='/'||_0xadd9ab==='\x5c'||_0xadd9ab===':'){_0x41fc6f=_0x41fc6f[_0x2e9f('0x14')](0x0,_0x41fc6f[_0x2e9f('0x15')](_0xadd9ab));}switch(_0xcecdf9[_0x2e9f('0xe')]){case'US':_0x165491=_0x2e9f('0x16');break;case'AU':_0x165491=_0x2e9f('0x17');break;case'IN':_0x165491=_0x2e9f('0x18');break;case'CN':_0x165491=_0x2e9f('0x19');break;default:_0x165491=_0x2e9f('0x1a');break;}var _0x51dfbb={'method':_0x2e9f('0x1b'),'uri':_0x165491+_0x2e9f('0x1c'),'form':{'grant_type':_0x2e9f('0x1d'),'client_id':_0xcecdf9[_0x2e9f('0x1e')],'client_secret':_0xcecdf9[_0x2e9f('0xf')],'redirect_uri':_0xcecdf9[_0x2e9f('0x12')],'code':_0xcecdf9[_0x2e9f('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x51dfbb)['then'](function(_0x1b74ac){var _0x364c2c=JSON['parse'](_0x1b74ac);if(_0x364c2c[_0x2e9f('0x1f')]){_0xcecdf9['refreshToken']=_0x364c2c[_0x2e9f('0x1f')];logger[_0x2e9f('0x20')](util[_0x2e9f('0x21')](_0x2e9f('0x22'),_0xcecdf9[_0x2e9f('0x23')],_0xcecdf9['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xcecdf9[_0x2e9f('0x23')],_0xcecdf9['id']),util[_0x2e9f('0x24')](_0x364c2c,{'showHidden':![],'depth':null}));}return _0x99b721(null,_0xc4901f);})[_0x2e9f('0x25')](function(_0x479579){logger[_0x2e9f('0x26')](util['format'](_0x2e9f('0x27'),_0xcecdf9[_0x2e9f('0x23')],_0xcecdf9['id']),util[_0x2e9f('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x99b721(_0x479579);});}else{return _0x99b721(null,_0xc4901f);}},'beforeUpdate':function(_0x20cda9,_0x2892af,_0xb0a3be){if(_0x20cda9['changed'](_0x2e9f('0xe'))||_0x20cda9[_0x2e9f('0xd')](_0x2e9f('0x12'))||_0x20cda9[_0x2e9f('0xd')](_0x2e9f('0x1e'))||_0x20cda9[_0x2e9f('0xd')](_0x2e9f('0xf'))||_0x20cda9[_0x2e9f('0xd')]('code')||_0x20cda9['changed'](_0x2e9f('0x11'))){var _0x1dbbf5,_0x3afc8f;_0x1dbbf5=_0x20cda9[_0x2e9f('0x12')];var _0xa1a675=_0x1dbbf5[_0x2e9f('0x13')](-0x1);if(_0xa1a675==='/'||_0xa1a675==='\x5c'||_0xa1a675===':'){_0x1dbbf5=_0x1dbbf5[_0x2e9f('0x14')](0x0,_0x1dbbf5[_0x2e9f('0x15')](_0xa1a675));}switch(_0x20cda9[_0x2e9f('0xe')]){case'US':_0x3afc8f=_0x2e9f('0x16');break;case'AU':_0x3afc8f=_0x2e9f('0x17');break;case'IN':_0x3afc8f=_0x2e9f('0x18');break;case'CN':_0x3afc8f=_0x2e9f('0x19');break;default:_0x3afc8f='https://accounts.zoho.eu';break;}var _0x138376={'method':_0x2e9f('0x1b'),'uri':_0x3afc8f+_0x2e9f('0x1c'),'form':{'grant_type':_0x2e9f('0x1d'),'client_id':_0x20cda9[_0x2e9f('0x1e')],'client_secret':_0x20cda9[_0x2e9f('0xf')],'redirect_uri':_0x20cda9[_0x2e9f('0x12')],'code':_0x20cda9[_0x2e9f('0x10')]},'headers':{'Content-Type':_0x2e9f('0x28')}};return rp(_0x138376)[_0x2e9f('0x29')](function(_0x261ff3){var _0xad8e0e=JSON['parse'](_0x261ff3);if(_0xad8e0e[_0x2e9f('0x1f')]){_0x20cda9[_0x2e9f('0x2a')]=_0xad8e0e[_0x2e9f('0x1f')];logger[_0x2e9f('0x20')](util[_0x2e9f('0x21')](_0x2e9f('0x22'),_0x20cda9['name'],_0x20cda9['id']));}else{logger['error'](util['format'](_0x2e9f('0x27'),_0x20cda9['name'],_0x20cda9['id']),util['inspect'](_0xad8e0e,{'showHidden':![],'depth':null}));}return _0xb0a3be(null,_0x2892af);})[_0x2e9f('0x25')](function(_0x167abd){logger[_0x2e9f('0x26')](util[_0x2e9f('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x20cda9['name'],_0x20cda9['id']),util[_0x2e9f('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0xb0a3be(_0x167abd);});}else{return _0xb0a3be(null,_0x2892af);}}}});}; \ No newline at end of file +var _0x6a0b=['clientId','clientSecret','changed','host','serverUrl','slice','substring','lastIndexOf','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','https://accounts.zoho.com','then','info','catch','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts'];(function(_0x5bd938,_0x1f02f2){var _0x283b61=function(_0x8eae88){while(--_0x8eae88){_0x5bd938['push'](_0x5bd938['shift']());}};_0x283b61(++_0x1f02f2);}(_0x6a0b,0xf6));var _0xb6a0=function(_0x117b9d,_0x26720b){_0x117b9d=_0x117b9d-0x0;var _0x3950db=_0x6a0b[_0x117b9d];return _0x3950db;};'use strict';var _=require(_0xb6a0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb6a0('0x1'));var moment=require(_0xb6a0('0x2'));var BPromise=require('bluebird');var rp=require(_0xb6a0('0x3'));var fs=require('fs');var path=require(_0xb6a0('0x4'));var rimraf=require(_0xb6a0('0x5'));var config=require(_0xb6a0('0x6'));var attributes=require(_0xb6a0('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xb6a0('0x8')]=function(_0x348d1b,_0x41bec1){return _0x348d1b[_0xb6a0('0x9')](_0xb6a0('0xa'),attributes,{'tableName':_0xb6a0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4357a5,_0x32f7e8,_0x1d1427){if(_0x4357a5['changed']('zone')||_0x4357a5['changed']('serverUrl')||_0x4357a5['changed'](_0xb6a0('0xc'))||_0x4357a5['changed'](_0xb6a0('0xd'))||_0x4357a5[_0xb6a0('0xe')]('code')||_0x4357a5[_0xb6a0('0xe')](_0xb6a0('0xf'))){var _0x22c772,_0x205531;_0x22c772=_0x4357a5[_0xb6a0('0x10')];var _0x275d5d=_0x22c772[_0xb6a0('0x11')](-0x1);if(_0x275d5d==='/'||_0x275d5d==='\x5c'||_0x275d5d===':'){_0x22c772=_0x22c772[_0xb6a0('0x12')](0x0,_0x22c772[_0xb6a0('0x13')](_0x275d5d));}switch(_0x4357a5[_0xb6a0('0x14')]){case'US':_0x205531='https://accounts.zoho.com';break;case'AU':_0x205531=_0xb6a0('0x15');break;case'IN':_0x205531=_0xb6a0('0x16');break;case'CN':_0x205531=_0xb6a0('0x17');break;default:_0x205531=_0xb6a0('0x18');break;}var _0x45a4df={'method':_0xb6a0('0x19'),'uri':_0x205531+_0xb6a0('0x1a'),'form':{'grant_type':_0xb6a0('0x1b'),'client_id':_0x4357a5[_0xb6a0('0xc')],'client_secret':_0x4357a5['clientSecret'],'redirect_uri':_0x4357a5[_0xb6a0('0x10')],'code':_0x4357a5[_0xb6a0('0x1c')]},'headers':{'Content-Type':_0xb6a0('0x1d')}};return rp(_0x45a4df)['then'](function(_0x3e5455){var _0xc1a971=JSON[_0xb6a0('0x1e')](_0x3e5455);if(_0xc1a971[_0xb6a0('0x1f')]){_0x4357a5[_0xb6a0('0x20')]=_0xc1a971['refresh_token'];logger['info'](util[_0xb6a0('0x21')](_0xb6a0('0x22'),_0x4357a5['name'],_0x4357a5['id']));}else{logger[_0xb6a0('0x23')](util['format'](_0xb6a0('0x24'),_0x4357a5[_0xb6a0('0x25')],_0x4357a5['id']),util[_0xb6a0('0x26')](_0xc1a971,{'showHidden':![],'depth':null}));}return _0x1d1427(null,_0x32f7e8);})['catch'](function(_0x2f7c95){logger[_0xb6a0('0x23')](util[_0xb6a0('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4357a5[_0xb6a0('0x25')],_0x4357a5['id']),util[_0xb6a0('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x1d1427(_0x2f7c95);});}else{return _0x1d1427(null,_0x32f7e8);}},'beforeUpdate':function(_0x5eb55f,_0x75bbe7,_0x4ddb3a){if(_0x5eb55f['changed'](_0xb6a0('0x14'))||_0x5eb55f['changed'](_0xb6a0('0x10'))||_0x5eb55f[_0xb6a0('0xe')](_0xb6a0('0xc'))||_0x5eb55f[_0xb6a0('0xe')](_0xb6a0('0xd'))||_0x5eb55f[_0xb6a0('0xe')](_0xb6a0('0x1c'))||_0x5eb55f['changed'](_0xb6a0('0xf'))){var _0x29dbb9,_0xd6e536;_0x29dbb9=_0x5eb55f[_0xb6a0('0x10')];var _0x2cbcd3=_0x29dbb9['slice'](-0x1);if(_0x2cbcd3==='/'||_0x2cbcd3==='\x5c'||_0x2cbcd3===':'){_0x29dbb9=_0x29dbb9[_0xb6a0('0x12')](0x0,_0x29dbb9['lastIndexOf'](_0x2cbcd3));}switch(_0x5eb55f[_0xb6a0('0x14')]){case'US':_0xd6e536=_0xb6a0('0x27');break;case'AU':_0xd6e536=_0xb6a0('0x15');break;case'IN':_0xd6e536=_0xb6a0('0x16');break;case'CN':_0xd6e536=_0xb6a0('0x17');break;default:_0xd6e536=_0xb6a0('0x18');break;}var _0x5a2137={'method':'POST','uri':_0xd6e536+_0xb6a0('0x1a'),'form':{'grant_type':_0xb6a0('0x1b'),'client_id':_0x5eb55f[_0xb6a0('0xc')],'client_secret':_0x5eb55f[_0xb6a0('0xd')],'redirect_uri':_0x5eb55f[_0xb6a0('0x10')],'code':_0x5eb55f['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x5a2137)[_0xb6a0('0x28')](function(_0x25fe3d){var _0x2faba2=JSON[_0xb6a0('0x1e')](_0x25fe3d);if(_0x2faba2['refresh_token']){_0x5eb55f['refreshToken']=_0x2faba2[_0xb6a0('0x1f')];logger[_0xb6a0('0x29')](util[_0xb6a0('0x21')](_0xb6a0('0x22'),_0x5eb55f[_0xb6a0('0x25')],_0x5eb55f['id']));}else{logger['error'](util['format'](_0xb6a0('0x24'),_0x5eb55f[_0xb6a0('0x25')],_0x5eb55f['id']),util[_0xb6a0('0x26')](_0x2faba2,{'showHidden':![],'depth':null}));}return _0x4ddb3a(null,_0x75bbe7);})[_0xb6a0('0x2a')](function(_0x3b1d35){logger[_0xb6a0('0x23')](util[_0xb6a0('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5eb55f[_0xb6a0('0x25')],_0x5eb55f['id']),util[_0xb6a0('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x4ddb3a(_0x3b1d35);});}else{return _0x4ddb3a(null,_0x75bbe7);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index e069186..16c59a9 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 _0x5942=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','limit','include','model','map','then','ShowZohoAccount','lodash'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x5942,0x16a));var _0x2594=function(_0x2a9da4,_0x19ea45){_0x2a9da4=_0x2a9da4-0x0;var _0x16ad7c=_0x5942[_0x2a9da4];return _0x16ad7c;};'use strict';var _=require(_0x2594('0x0'));var util=require(_0x2594('0x1'));var moment=require(_0x2594('0x2'));var BPromise=require(_0x2594('0x3'));var rs=require(_0x2594('0x4'));var fs=require('fs');var Redis=require(_0x2594('0x5'));var db=require(_0x2594('0x6'))['db'];var utils=require(_0x2594('0x7'));var logger=require(_0x2594('0x8'))(_0x2594('0x9'));var config=require(_0x2594('0xa'));var jayson=require(_0x2594('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x381472,_0xd0ada5,_0x3d20aa){return new BPromise(function(_0x5707a0,_0x2b42d3){return client[_0x2594('0xc')](_0x381472,_0x3d20aa)['then'](function(_0x29517f){logger['info'](_0x2594('0xd'),_0xd0ada5,_0x2594('0xe'));logger[_0x2594('0xf')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0xd0ada5,_0x2594('0xe'),JSON[_0x2594('0x10')](_0x29517f));if(_0x29517f[_0x2594('0x11')]){if(_0x29517f[_0x2594('0x11')]['code']===0x1f4){logger[_0x2594('0x11')](_0x2594('0xd'),_0xd0ada5,_0x29517f[_0x2594('0x11')][_0x2594('0x12')]);return _0x2b42d3(_0x29517f[_0x2594('0x11')][_0x2594('0x12')]);}logger[_0x2594('0x11')](_0x2594('0xd'),_0xd0ada5,_0x29517f[_0x2594('0x11')]['message']);return _0x5707a0(_0x29517f[_0x2594('0x11')][_0x2594('0x12')]);}else{logger['info'](_0x2594('0xd'),_0xd0ada5,'request\x20sent');_0x5707a0(_0x29517f[_0x2594('0x13')][_0x2594('0x12')]);}})[_0x2594('0x14')](function(_0x33b4bc){logger[_0x2594('0x11')]('ZohoAccount,\x20%s,\x20%s',_0xd0ada5,_0x33b4bc);_0x2b42d3(_0x33b4bc);});});}exports[_0x2594('0x15')]=function(_0x457beb){var _0x223099=this;return new Promise(function(_0x31f24a,_0x373533){return db[_0x2594('0x16')][_0x2594('0x17')]({'raw':_0x457beb[_0x2594('0x18')]?_0x457beb[_0x2594('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x457beb['options']?_0x457beb[_0x2594('0x18')][_0x2594('0x19')]||null:null,'attributes':_0x457beb[_0x2594('0x18')]?_0x457beb[_0x2594('0x18')][_0x2594('0x1a')]||null:null,'limit':_0x457beb[_0x2594('0x18')]?_0x457beb['options'][_0x2594('0x1b')]||null:null,'include':_0x457beb[_0x2594('0x18')]?_0x457beb[_0x2594('0x18')][_0x2594('0x1c')]?_['map'](_0x457beb[_0x2594('0x18')]['include'],function(_0x281987){return{'model':db[_0x281987['model']],'as':_0x281987['as'],'attributes':_0x281987[_0x2594('0x1a')],'include':_0x281987[_0x2594('0x1c')]?_['map'](_0x281987[_0x2594('0x1c')],function(_0x48a306){return{'model':db[_0x48a306[_0x2594('0x1d')]],'as':_0x48a306['as'],'attributes':_0x48a306[_0x2594('0x1a')],'include':_0x48a306[_0x2594('0x1c')]?_[_0x2594('0x1e')](_0x48a306[_0x2594('0x1c')],function(_0xf60655){return{'model':db[_0xf60655[_0x2594('0x1d')]],'as':_0xf60655['as'],'attributes':_0xf60655[_0x2594('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a1058){logger['info']('GetZohoAccount',_0x457beb);logger[_0x2594('0xf')](_0x2594('0x15'),_0x457beb,JSON['stringify'](_0x3a1058));_0x31f24a(_0x3a1058);})[_0x2594('0x14')](function(_0xa8ee54){logger['error'](_0x2594('0x15'),_0xa8ee54[_0x2594('0x12')],_0x457beb);_0x373533(_0x223099[_0x2594('0x11')](0x1f4,_0xa8ee54[_0x2594('0x12')]));});});};exports['ShowZohoAccount']=function(_0x43ac77){var _0x139602=this;return new Promise(function(_0x2737ea,_0x11133a){return db[_0x2594('0x16')]['find']({'raw':_0x43ac77[_0x2594('0x18')]?_0x43ac77[_0x2594('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x43ac77['options']?_0x43ac77[_0x2594('0x18')][_0x2594('0x19')]||null:null,'attributes':_0x43ac77[_0x2594('0x18')]?_0x43ac77[_0x2594('0x18')]['attributes']||null:null,'include':_0x43ac77[_0x2594('0x18')]?_0x43ac77[_0x2594('0x18')]['include']?_['map'](_0x43ac77['options']['include'],function(_0x597915){return{'model':db[_0x597915[_0x2594('0x1d')]],'as':_0x597915['as'],'attributes':_0x597915[_0x2594('0x1a')],'include':_0x597915[_0x2594('0x1c')]?_[_0x2594('0x1e')](_0x597915[_0x2594('0x1c')],function(_0x20e253){return{'model':db[_0x20e253[_0x2594('0x1d')]],'as':_0x20e253['as'],'attributes':_0x20e253[_0x2594('0x1a')],'include':_0x20e253[_0x2594('0x1c')]?_[_0x2594('0x1e')](_0x20e253[_0x2594('0x1c')],function(_0x4271fd){return{'model':db[_0x4271fd[_0x2594('0x1d')]],'as':_0x4271fd['as'],'attributes':_0x4271fd[_0x2594('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2594('0x1f')](function(_0x5b9052){logger['info'](_0x2594('0x20'),_0x43ac77);logger[_0x2594('0xf')](_0x2594('0x20'),_0x43ac77,JSON[_0x2594('0x10')](_0x5b9052));_0x2737ea(_0x5b9052);})[_0x2594('0x14')](function(_0x2e975b){logger[_0x2594('0x11')](_0x2594('0x20'),_0x2e975b[_0x2594('0x12')],_0x43ac77);_0x11133a(_0x139602['error'](0x1f4,_0x2e975b['message']));});});}; \ No newline at end of file +var _0xc891=['include','map','model','find','raw','attributes','debug','ShowZohoAccount','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','error','code','ZohoAccount,\x20%s,\x20%s','message','catch','GetZohoAccount','ZohoAccount','options','where','limit'];(function(_0x2dcf83,_0xbc34b2){var _0x340718=function(_0x598334){while(--_0x598334){_0x2dcf83['push'](_0x2dcf83['shift']());}};_0x340718(++_0xbc34b2);}(_0xc891,0x152));var _0x1c89=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xc891[_0x54d4a8];return _0x3b321b;};'use strict';var _=require(_0x1c89('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1c89('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c89('0x2'));var db=require(_0x1c89('0x3'))['db'];var utils=require(_0x1c89('0x4'));var logger=require('../../config/logger')(_0x1c89('0x5'));var config=require(_0x1c89('0x6'));var jayson=require(_0x1c89('0x7'));var client=jayson[_0x1c89('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14436b,_0x30aa4d,_0x4cbacb){return new BPromise(function(_0x44b3cf,_0x300289){return client['request'](_0x14436b,_0x4cbacb)[_0x1c89('0x9')](function(_0x4e9b16){logger[_0x1c89('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x30aa4d,'request\x20sent');logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x30aa4d,_0x1c89('0xb'),JSON['stringify'](_0x4e9b16));if(_0x4e9b16[_0x1c89('0xc')]){if(_0x4e9b16[_0x1c89('0xc')][_0x1c89('0xd')]===0x1f4){logger[_0x1c89('0xc')](_0x1c89('0xe'),_0x30aa4d,_0x4e9b16[_0x1c89('0xc')][_0x1c89('0xf')]);return _0x300289(_0x4e9b16[_0x1c89('0xc')]['message']);}logger[_0x1c89('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x30aa4d,_0x4e9b16[_0x1c89('0xc')][_0x1c89('0xf')]);return _0x44b3cf(_0x4e9b16[_0x1c89('0xc')]['message']);}else{logger[_0x1c89('0xa')](_0x1c89('0xe'),_0x30aa4d,_0x1c89('0xb'));_0x44b3cf(_0x4e9b16['result'][_0x1c89('0xf')]);}})[_0x1c89('0x10')](function(_0x266ad8){logger[_0x1c89('0xc')](_0x1c89('0xe'),_0x30aa4d,_0x266ad8);_0x300289(_0x266ad8);});});}exports[_0x1c89('0x11')]=function(_0x2cb186){var _0x2b856c=this;return new Promise(function(_0x166444,_0x35bd99){return db[_0x1c89('0x12')]['findAll']({'raw':_0x2cb186[_0x1c89('0x13')]?_0x2cb186[_0x1c89('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x2cb186[_0x1c89('0x13')]?_0x2cb186[_0x1c89('0x13')][_0x1c89('0x14')]||null:null,'attributes':_0x2cb186[_0x1c89('0x13')]?_0x2cb186['options']['attributes']||null:null,'limit':_0x2cb186[_0x1c89('0x13')]?_0x2cb186[_0x1c89('0x13')][_0x1c89('0x15')]||null:null,'include':_0x2cb186[_0x1c89('0x13')]?_0x2cb186['options'][_0x1c89('0x16')]?_[_0x1c89('0x17')](_0x2cb186['options'][_0x1c89('0x16')],function(_0x26a1cc){return{'model':db[_0x26a1cc[_0x1c89('0x18')]],'as':_0x26a1cc['as'],'attributes':_0x26a1cc['attributes'],'include':_0x26a1cc[_0x1c89('0x16')]?_[_0x1c89('0x17')](_0x26a1cc[_0x1c89('0x16')],function(_0x59a87e){return{'model':db[_0x59a87e[_0x1c89('0x18')]],'as':_0x59a87e['as'],'attributes':_0x59a87e['attributes'],'include':_0x59a87e['include']?_[_0x1c89('0x17')](_0x59a87e[_0x1c89('0x16')],function(_0x4c4694){return{'model':db[_0x4c4694['model']],'as':_0x4c4694['as'],'attributes':_0x4c4694['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c89('0x9')](function(_0x5ce91f){logger['info'](_0x1c89('0x11'),_0x2cb186);logger['debug'](_0x1c89('0x11'),_0x2cb186,JSON['stringify'](_0x5ce91f));_0x166444(_0x5ce91f);})['catch'](function(_0x25500d){logger[_0x1c89('0xc')](_0x1c89('0x11'),_0x25500d['message'],_0x2cb186);_0x35bd99(_0x2b856c[_0x1c89('0xc')](0x1f4,_0x25500d[_0x1c89('0xf')]));});});};exports['ShowZohoAccount']=function(_0x438970){var _0x545e37=this;return new Promise(function(_0x13bb07,_0x38679f){return db[_0x1c89('0x12')][_0x1c89('0x19')]({'raw':_0x438970[_0x1c89('0x13')]?_0x438970[_0x1c89('0x13')][_0x1c89('0x1a')]===undefined?!![]:![]:!![],'where':_0x438970[_0x1c89('0x13')]?_0x438970[_0x1c89('0x13')][_0x1c89('0x14')]||null:null,'attributes':_0x438970['options']?_0x438970[_0x1c89('0x13')]['attributes']||null:null,'include':_0x438970['options']?_0x438970[_0x1c89('0x13')][_0x1c89('0x16')]?_[_0x1c89('0x17')](_0x438970[_0x1c89('0x13')][_0x1c89('0x16')],function(_0x1c7ce2){return{'model':db[_0x1c7ce2[_0x1c89('0x18')]],'as':_0x1c7ce2['as'],'attributes':_0x1c7ce2[_0x1c89('0x1b')],'include':_0x1c7ce2[_0x1c89('0x16')]?_[_0x1c89('0x17')](_0x1c7ce2[_0x1c89('0x16')],function(_0x4e4872){return{'model':db[_0x4e4872['model']],'as':_0x4e4872['as'],'attributes':_0x4e4872[_0x1c89('0x1b')],'include':_0x4e4872['include']?_['map'](_0x4e4872[_0x1c89('0x16')],function(_0x238c6d){return{'model':db[_0x238c6d[_0x1c89('0x18')]],'as':_0x238c6d['as'],'attributes':_0x238c6d[_0x1c89('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1c89('0x9')](function(_0x42d93d){logger[_0x1c89('0xa')]('ShowZohoAccount',_0x438970);logger[_0x1c89('0x1c')](_0x1c89('0x1d'),_0x438970,JSON['stringify'](_0x42d93d));_0x13bb07(_0x42d93d);})[_0x1c89('0x10')](function(_0x3f6ce0){logger[_0x1c89('0xc')](_0x1c89('0x1d'),_0x3f6ce0[_0x1c89('0xf')],_0x438970);_0x38679f(_0x545e37['error'](0x1f4,_0x3f6ce0[_0x1c89('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 84ab3d2..ae86708 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 _0x1ee0=['./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','post','create','put','update','delete','exports','util','express','Router','fs-extra','../../config/environment'];(function(_0x5f1c02,_0x1f1cba){var _0x2653c9=function(_0x4713bf){while(--_0x4713bf){_0x5f1c02['push'](_0x5f1c02['shift']());}};_0x2653c9(++_0x1f1cba);}(_0x1ee0,0x177));var _0x01ee=function(_0x2dbf07,_0x12496d){_0x2dbf07=_0x2dbf07-0x0;var _0x528fb9=_0x1ee0[_0x2dbf07];return _0x528fb9;};'use strict';var multer=require('multer');var util=require(_0x01ee('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x01ee('0x1'));var router=express[_0x01ee('0x2')]();var fs_extra=require(_0x01ee('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x01ee('0x4'));var controller=require(_0x01ee('0x5'));router[_0x01ee('0x6')]('/',auth[_0x01ee('0x7')](),controller[_0x01ee('0x8')]);router['get'](_0x01ee('0x9'),auth['isAuthenticated'](),controller[_0x01ee('0xa')]);router[_0x01ee('0x6')](_0x01ee('0xb'),auth[_0x01ee('0x7')](),controller['getFields']);router['get'](_0x01ee('0xc'),auth[_0x01ee('0x7')](),controller['getSubjects']);router[_0x01ee('0x6')](_0x01ee('0xd'),auth[_0x01ee('0x7')](),controller['getDescriptions']);router[_0x01ee('0xe')]('/',auth[_0x01ee('0x7')](),controller[_0x01ee('0xf')]);router[_0x01ee('0x10')](_0x01ee('0x9'),auth[_0x01ee('0x7')](),controller[_0x01ee('0x11')]);router[_0x01ee('0x12')](_0x01ee('0x9'),auth[_0x01ee('0x7')](),controller['destroy']);module[_0x01ee('0x13')]=router; \ No newline at end of file +var _0xf387=['destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf387,0x1d0));var _0x7f38=function(_0x5b9c2a,_0x2997a9){_0x5b9c2a=_0x5b9c2a-0x0;var _0x1b556b=_0xf387[_0x5b9c2a];return _0x1b556b;};'use strict';var multer=require(_0x7f38('0x0'));var util=require('util');var path=require(_0x7f38('0x1'));var timeout=require(_0x7f38('0x2'));var express=require('express');var router=express[_0x7f38('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7f38('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7f38('0x5'));var controller=require(_0x7f38('0x6'));router[_0x7f38('0x7')]('/',auth[_0x7f38('0x8')](),controller[_0x7f38('0x9')]);router[_0x7f38('0x7')](_0x7f38('0xa'),auth['isAuthenticated'](),controller[_0x7f38('0xb')]);router[_0x7f38('0x7')](_0x7f38('0xc'),auth[_0x7f38('0x8')](),controller['getFields']);router[_0x7f38('0x7')](_0x7f38('0xd'),auth['isAuthenticated'](),controller[_0x7f38('0xe')]);router[_0x7f38('0x7')](_0x7f38('0xf'),auth[_0x7f38('0x8')](),controller[_0x7f38('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7f38('0x11')]);router[_0x7f38('0x12')](_0x7f38('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x7f38('0x8')](),controller[_0x7f38('0x13')]);module[_0x7f38('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index fee4513..94ce039 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 _0xd843=['exports','ENUM','nothing','lead','contact_lead','STRING','sequelize'];(function(_0x5bb029,_0x58d7de){var _0x13f474=function(_0x20aae2){while(--_0x20aae2){_0x5bb029['push'](_0x5bb029['shift']());}};_0x13f474(++_0x58d7de);}(_0xd843,0x172));var _0x3d84=function(_0x3ba566,_0x5e009d){_0x3ba566=_0x3ba566-0x0;var _0x480317=_0xd843[_0x3ba566];return _0x480317;};'use strict';var Sequelize=require(_0x3d84('0x0'));module[_0x3d84('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x3d84('0x2')]('lead','contact',_0x3d84('0x3')),'defaultValue':_0x3d84('0x4')},'moduleSearch':{'type':Sequelize[_0x3d84('0x2')](_0x3d84('0x5'),'contact','lead'),'defaultValue':_0x3d84('0x5')},'description':{'type':Sequelize[_0x3d84('0x6')]}}; \ No newline at end of file +var _0xf293=['STRING','ENUM','lead','contact','nothing','contact_lead','sequelize','exports'];(function(_0x606fe8,_0x10b084){var _0x28b517=function(_0x5e90f4){while(--_0x5e90f4){_0x606fe8['push'](_0x606fe8['shift']());}};_0x28b517(++_0x10b084);}(_0xf293,0xde));var _0x3f29=function(_0x2d80af,_0x418b65){_0x2d80af=_0x2d80af-0x0;var _0x11296f=_0xf293[_0x2d80af];return _0x11296f;};'use strict';var Sequelize=require(_0x3f29('0x0'));module[_0x3f29('0x1')]={'name':{'type':Sequelize[_0x3f29('0x2')]},'moduleCreate':{'type':Sequelize[_0x3f29('0x3')](_0x3f29('0x4'),_0x3f29('0x5'),_0x3f29('0x6')),'defaultValue':_0x3f29('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x3f29('0x7'),'contact',_0x3f29('0x4')),'defaultValue':_0x3f29('0x7')},'description':{'type':Sequelize[_0x3f29('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 5aa9bb4..7545d0e 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 _0xf00c=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filter','merge','where','VIRTUAL','ZohoConfiguration','includeAll','rows','catch','include','options','find','create','body','params','getFields','findOne','ZohoField','sort','getSubjects','pick','getDescriptions','eml-format'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xf00c,0x13f));var _0xcf00=function(_0x5e4808,_0x1740a1){_0x5e4808=_0x5e4808-0x0;var _0x1007d6=_0xf00c[_0x5e4808];return _0x1007d6;};'use strict';var emlformat=require(_0xcf00('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcf00('0x1'));var jsonpatch=require(_0xcf00('0x2'));var rp=require(_0xcf00('0x3'));var moment=require(_0xcf00('0x4'));var BPromise=require(_0xcf00('0x5'));var Mustache=require(_0xcf00('0x6'));var util=require(_0xcf00('0x7'));var path=require(_0xcf00('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf00('0x9'));var _=require(_0xcf00('0xa'));var squel=require(_0xcf00('0xb'));var crypto=require('crypto');var jsforce=require(_0xcf00('0xc'));var deskjs=require(_0xcf00('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xcf00('0xe'));var Redis=require(_0xcf00('0xf'));var authService=require(_0xcf00('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xcf00('0x11'));var hardwareService=require(_0xcf00('0x12'));var logger=require(_0xcf00('0x13'))(_0xcf00('0x14'));var utils=require(_0xcf00('0x15'));var config=require(_0xcf00('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xcf00('0x17'))['db'];function respondWithStatusCode(_0x29df18,_0x1f6358){_0x1f6358=_0x1f6358||0xcc;return function(_0x6f4321){if(_0x6f4321){return _0x29df18[_0xcf00('0x18')](_0x1f6358);}return _0x29df18[_0xcf00('0x19')](_0x1f6358)[_0xcf00('0x1a')]();};}function respondWithResult(_0x42e92e,_0x214d05){_0x214d05=_0x214d05||0xc8;return function(_0x5f3228){if(_0x5f3228){return _0x42e92e[_0xcf00('0x19')](_0x214d05)[_0xcf00('0x1b')](_0x5f3228);}};}function respondWithFilteredResult(_0x5d9932,_0x43e073){return function(_0x706e2e){if(_0x706e2e){var _0xe7c299=typeof _0x43e073[_0xcf00('0x1c')]===_0xcf00('0x1d')&&typeof _0x43e073[_0xcf00('0x1e')]===_0xcf00('0x1d');var _0xd92755=_0x706e2e['count'];var _0x20d597=_0xe7c299?0x0:_0x43e073[_0xcf00('0x1c')];var _0x2bf5be=_0xe7c299?_0x706e2e[_0xcf00('0x1f')]:_0x43e073[_0xcf00('0x1c')]+_0x43e073[_0xcf00('0x1e')];var _0x232316;if(_0x2bf5be>=_0xd92755){_0x2bf5be=_0xd92755;_0x232316=0xc8;}else{_0x232316=0xce;}_0x5d9932['status'](_0x232316);return _0x5d9932['set'](_0xcf00('0x20'),_0x20d597+'-'+_0x2bf5be+'/'+_0xd92755)['json'](_0x706e2e);}return null;};}function patchUpdates(_0x33f647){return function(_0x1f80f3){try{jsonpatch['apply'](_0x1f80f3,_0x33f647,!![]);}catch(_0x38ce1c){return BPromise[_0xcf00('0x21')](_0x38ce1c);}return _0x1f80f3[_0xcf00('0x22')]();};}function saveUpdates(_0x59f0a5,_0x23ed33){return function(_0x36feda){if(_0x36feda){return _0x36feda[_0xcf00('0x23')](_0x59f0a5)[_0xcf00('0x24')](function(_0x4d370e){return _0x4d370e;});}return null;};}function removeEntity(_0x53996a,_0x911036){return function(_0x15a7de){if(_0x15a7de){return _0x15a7de[_0xcf00('0x25')]()[_0xcf00('0x24')](function(){_0x53996a[_0xcf00('0x19')](0xcc)[_0xcf00('0x1a')]();});}};}function handleEntityNotFound(_0x2d4233,_0x441bb4){return function(_0x1f941d){if(!_0x1f941d){_0x2d4233[_0xcf00('0x18')](0x194);}return _0x1f941d;};}function handleError(_0x31bede,_0x2255dd){_0x2255dd=_0x2255dd||0x1f4;return function(_0x2c468a){logger[_0xcf00('0x26')](_0x2c468a[_0xcf00('0x27')]);if(_0x2c468a[_0xcf00('0x28')]){delete _0x2c468a[_0xcf00('0x28')];}_0x31bede[_0xcf00('0x19')](_0x2255dd)[_0xcf00('0x29')](_0x2c468a);};}exports[_0xcf00('0x2a')]=function(_0x55b28d,_0xb5a74d){var _0x478da5={},_0x11397e={},_0x1a1913={'count':0x0,'rows':[]};var _0x58decc=_[_0xcf00('0x2b')](db['ZohoConfiguration'][_0xcf00('0x2c')],function(_0x22ad82){return{'name':_0x22ad82[_0xcf00('0x2d')],'type':_0x22ad82[_0xcf00('0x2e')][_0xcf00('0x2f')]};});_0x11397e[_0xcf00('0x30')]=_[_0xcf00('0x2b')](_0x58decc,'name');_0x11397e[_0xcf00('0x31')]=_[_0xcf00('0x32')](_0x55b28d[_0xcf00('0x31')]);_0x11397e[_0xcf00('0x33')]=_[_0xcf00('0x34')](_0x11397e['model'],_0x11397e['query']);_0x478da5[_0xcf00('0x35')]=_[_0xcf00('0x34')](_0x11397e['model'],qs[_0xcf00('0x36')](_0x55b28d['query'][_0xcf00('0x36')]));_0x478da5[_0xcf00('0x35')]=_0x478da5[_0xcf00('0x35')][_0xcf00('0x37')]?_0x478da5[_0xcf00('0x35')]:_0x11397e[_0xcf00('0x30')];if(!_0x55b28d[_0xcf00('0x31')][_0xcf00('0x38')](_0xcf00('0x39'))){_0x478da5['limit']=qs[_0xcf00('0x1e')](_0x55b28d['query'][_0xcf00('0x1e')]);_0x478da5[_0xcf00('0x1c')]=qs[_0xcf00('0x1c')](_0x55b28d[_0xcf00('0x31')][_0xcf00('0x1c')]);}_0x478da5[_0xcf00('0x3a')]=qs['sort'](_0x55b28d[_0xcf00('0x31')]['sort']);_0x478da5['where']=qs['filters'](_['pick'](_0x55b28d[_0xcf00('0x31')],_0x11397e[_0xcf00('0x33')]),_0x58decc);if(_0x55b28d[_0xcf00('0x31')][_0xcf00('0x3b')]){_0x478da5['where']=_[_0xcf00('0x3c')](_0x478da5[_0xcf00('0x3d')],{'$or':_[_0xcf00('0x2b')](_0x58decc,function(_0x29cbba){if(_0x29cbba[_0xcf00('0x2e')]!==_0xcf00('0x3e')){var _0x28ef44={};_0x28ef44[_0x29cbba[_0xcf00('0x28')]]={'$like':'%'+_0x55b28d['query'][_0xcf00('0x3b')]+'%'};return _0x28ef44;}})});}_0x478da5=_[_0xcf00('0x3c')]({},_0x478da5,_0x55b28d['options']);var _0x4c7115={'where':_0x478da5['where']};return db[_0xcf00('0x3f')][_0xcf00('0x1f')](_0x4c7115)[_0xcf00('0x24')](function(_0x31e206){_0x1a1913[_0xcf00('0x1f')]=_0x31e206;if(_0x55b28d[_0xcf00('0x31')][_0xcf00('0x40')]){_0x478da5['include']=[{'all':!![]}];}return db[_0xcf00('0x3f')]['findAll'](_0x478da5);})[_0xcf00('0x24')](function(_0x370c7a){_0x1a1913[_0xcf00('0x41')]=_0x370c7a;return _0x1a1913;})[_0xcf00('0x24')](respondWithFilteredResult(_0xb5a74d,_0x478da5))[_0xcf00('0x42')](handleError(_0xb5a74d,null));};exports['show']=function(_0x158ee4,_0x36d20d){var _0x1419ad={'raw':![],'where':{'id':_0x158ee4['params']['id']}},_0x180f7f={};_0x180f7f[_0xcf00('0x30')]=_['keys'](db[_0xcf00('0x3f')][_0xcf00('0x2c')]);_0x180f7f['query']=_['keys'](_0x158ee4[_0xcf00('0x31')]);_0x180f7f[_0xcf00('0x33')]=_[_0xcf00('0x34')](_0x180f7f[_0xcf00('0x30')],_0x180f7f[_0xcf00('0x31')]);_0x1419ad['attributes']=_[_0xcf00('0x34')](_0x180f7f[_0xcf00('0x30')],qs[_0xcf00('0x36')](_0x158ee4[_0xcf00('0x31')][_0xcf00('0x36')]));_0x1419ad[_0xcf00('0x35')]=_0x1419ad['attributes'][_0xcf00('0x37')]?_0x1419ad[_0xcf00('0x35')]:_0x180f7f['model'];if(_0x158ee4['query']['includeAll']){_0x1419ad[_0xcf00('0x43')]=[{'all':!![]}];}_0x1419ad=_[_0xcf00('0x3c')]({},_0x1419ad,_0x158ee4[_0xcf00('0x44')]);return db['ZohoConfiguration'][_0xcf00('0x45')](_0x1419ad)[_0xcf00('0x24')](handleEntityNotFound(_0x36d20d,null))['then'](respondWithResult(_0x36d20d,null))[_0xcf00('0x42')](handleError(_0x36d20d,null));};exports[_0xcf00('0x46')]=function(_0x41db27,_0x15ab48){return db['ZohoConfiguration'][_0xcf00('0x46')](_0x41db27[_0xcf00('0x47')],{})[_0xcf00('0x24')](respondWithResult(_0x15ab48,0xc9))[_0xcf00('0x42')](handleError(_0x15ab48,null));};exports[_0xcf00('0x23')]=function(_0x545758,_0x1c197a){if(_0x545758[_0xcf00('0x47')]['id']){delete _0x545758[_0xcf00('0x47')]['id'];}return db[_0xcf00('0x3f')]['find']({'where':{'id':_0x545758[_0xcf00('0x48')]['id']}})[_0xcf00('0x24')](handleEntityNotFound(_0x1c197a,null))[_0xcf00('0x24')](saveUpdates(_0x545758[_0xcf00('0x47')],null))[_0xcf00('0x24')](respondWithResult(_0x1c197a,null))[_0xcf00('0x42')](handleError(_0x1c197a,null));};exports[_0xcf00('0x25')]=function(_0xa2d16c,_0x3b3474){return db['ZohoConfiguration'][_0xcf00('0x45')]({'where':{'id':_0xa2d16c[_0xcf00('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b3474,null))['then'](removeEntity(_0x3b3474,null))[_0xcf00('0x42')](handleError(_0x3b3474,null));};exports[_0xcf00('0x49')]=function(_0x42e1c5,_0x4ea5c0,_0x5dd72d){var _0x4da450={};var _0x29be9d={};var _0x51498e;var _0x5c963f;return db[_0xcf00('0x3f')][_0xcf00('0x4a')]({'where':{'id':_0x42e1c5[_0xcf00('0x48')]['id']}})[_0xcf00('0x24')](handleEntityNotFound(_0x4ea5c0,null))[_0xcf00('0x24')](function(_0x7319e){if(_0x7319e){_0x51498e=_0x7319e;_0x29be9d['model']=_[_0xcf00('0x32')](db[_0xcf00('0x4b')][_0xcf00('0x2c')]);_0x29be9d['query']=_[_0xcf00('0x32')](_0x42e1c5[_0xcf00('0x31')]);_0x29be9d[_0xcf00('0x33')]=_['intersection'](_0x29be9d[_0xcf00('0x30')],_0x29be9d[_0xcf00('0x31')]);_0x4da450['attributes']=_[_0xcf00('0x34')](_0x29be9d['model'],qs[_0xcf00('0x36')](_0x42e1c5[_0xcf00('0x31')][_0xcf00('0x36')]));_0x4da450[_0xcf00('0x35')]=_0x4da450[_0xcf00('0x35')][_0xcf00('0x37')]?_0x4da450['attributes']:_0x29be9d[_0xcf00('0x30')];_0x4da450[_0xcf00('0x3a')]=qs[_0xcf00('0x4c')](_0x42e1c5[_0xcf00('0x31')]['sort']);_0x4da450[_0xcf00('0x3d')]=qs['filters'](_['pick'](_0x42e1c5[_0xcf00('0x31')],_0x29be9d['filters']));if(_0x42e1c5[_0xcf00('0x31')][_0xcf00('0x3b')]){_0x4da450['where']=_[_0xcf00('0x3c')](_0x4da450[_0xcf00('0x3d')],{'$or':_[_0xcf00('0x2b')](_0x4da450['attributes'],function(_0x483fd2){var _0xaf38d4={};_0xaf38d4[_0x483fd2]={'$like':'%'+_0x42e1c5['query'][_0xcf00('0x3b')]+'%'};return _0xaf38d4;})});}_0x4da450=_[_0xcf00('0x3c')]({},_0x4da450,_0x42e1c5[_0xcf00('0x44')]);return _0x51498e['getFields'](_0x4da450);}})['then'](function(_0x15d08e){if(_0x15d08e){_0x5c963f=_0x15d08e[_0xcf00('0x37')];if(!_0x42e1c5[_0xcf00('0x31')][_0xcf00('0x38')](_0xcf00('0x39'))){_0x4da450['limit']=qs['limit'](_0x42e1c5[_0xcf00('0x31')][_0xcf00('0x1e')]);_0x4da450[_0xcf00('0x1c')]=qs[_0xcf00('0x1c')](_0x42e1c5['query'][_0xcf00('0x1c')]);}return _0x51498e[_0xcf00('0x49')](_0x4da450);}})[_0xcf00('0x24')](function(_0x1f2ad3){if(_0x1f2ad3){return _0x1f2ad3?{'count':_0x5c963f,'rows':_0x1f2ad3}:null;}})[_0xcf00('0x24')](respondWithResult(_0x4ea5c0,null))[_0xcf00('0x42')](handleError(_0x4ea5c0,null));};exports[_0xcf00('0x4d')]=function(_0x22963,_0x343bef,_0x4edbb2){var _0x2afba1={};var _0x50687b={};var _0x255f0c;var _0x54e013;return db[_0xcf00('0x3f')][_0xcf00('0x4a')]({'where':{'id':_0x22963['params']['id']}})[_0xcf00('0x24')](handleEntityNotFound(_0x343bef,null))['then'](function(_0x15f1a7){if(_0x15f1a7){_0x255f0c=_0x15f1a7;_0x50687b[_0xcf00('0x30')]=_['keys'](db[_0xcf00('0x4b')][_0xcf00('0x2c')]);_0x50687b['query']=_[_0xcf00('0x32')](_0x22963[_0xcf00('0x31')]);_0x50687b[_0xcf00('0x33')]=_['intersection'](_0x50687b[_0xcf00('0x30')],_0x50687b[_0xcf00('0x31')]);_0x2afba1['attributes']=_[_0xcf00('0x34')](_0x50687b[_0xcf00('0x30')],qs[_0xcf00('0x36')](_0x22963[_0xcf00('0x31')][_0xcf00('0x36')]));_0x2afba1[_0xcf00('0x35')]=_0x2afba1[_0xcf00('0x35')][_0xcf00('0x37')]?_0x2afba1[_0xcf00('0x35')]:_0x50687b[_0xcf00('0x30')];_0x2afba1['order']=qs[_0xcf00('0x4c')](_0x22963[_0xcf00('0x31')][_0xcf00('0x4c')]);_0x2afba1['where']=qs[_0xcf00('0x33')](_['pick'](_0x22963[_0xcf00('0x31')],_0x50687b[_0xcf00('0x33')]));if(_0x22963[_0xcf00('0x31')][_0xcf00('0x3b')]){_0x2afba1[_0xcf00('0x3d')]=_[_0xcf00('0x3c')](_0x2afba1[_0xcf00('0x3d')],{'$or':_[_0xcf00('0x2b')](_0x2afba1[_0xcf00('0x35')],function(_0x32958a){var _0x1ff6b4={};_0x1ff6b4[_0x32958a]={'$like':'%'+_0x22963[_0xcf00('0x31')][_0xcf00('0x3b')]+'%'};return _0x1ff6b4;})});}_0x2afba1=_[_0xcf00('0x3c')]({},_0x2afba1,_0x22963[_0xcf00('0x44')]);return _0x255f0c[_0xcf00('0x4d')](_0x2afba1);}})[_0xcf00('0x24')](function(_0x288e74){if(_0x288e74){_0x54e013=_0x288e74[_0xcf00('0x37')];if(!_0x22963[_0xcf00('0x31')][_0xcf00('0x38')](_0xcf00('0x39'))){_0x2afba1[_0xcf00('0x1e')]=qs['limit'](_0x22963['query'][_0xcf00('0x1e')]);_0x2afba1[_0xcf00('0x1c')]=qs[_0xcf00('0x1c')](_0x22963[_0xcf00('0x31')]['offset']);}return _0x255f0c[_0xcf00('0x4d')](_0x2afba1);}})[_0xcf00('0x24')](function(_0x38d7bc){if(_0x38d7bc){return _0x38d7bc?{'count':_0x54e013,'rows':_0x38d7bc}:null;}})['then'](respondWithResult(_0x343bef,null))[_0xcf00('0x42')](handleError(_0x343bef,null));};exports['getDescriptions']=function(_0x2e02c4,_0x314374,_0x464603){var _0x381775={};var _0x39d19b={};var _0x45295e;var _0x44129f;return db['ZohoConfiguration'][_0xcf00('0x4a')]({'where':{'id':_0x2e02c4[_0xcf00('0x48')]['id']}})['then'](handleEntityNotFound(_0x314374,null))[_0xcf00('0x24')](function(_0x318530){if(_0x318530){_0x45295e=_0x318530;_0x39d19b['model']=_['keys'](db[_0xcf00('0x4b')]['rawAttributes']);_0x39d19b[_0xcf00('0x31')]=_['keys'](_0x2e02c4[_0xcf00('0x31')]);_0x39d19b[_0xcf00('0x33')]=_[_0xcf00('0x34')](_0x39d19b['model'],_0x39d19b[_0xcf00('0x31')]);_0x381775['attributes']=_['intersection'](_0x39d19b[_0xcf00('0x30')],qs[_0xcf00('0x36')](_0x2e02c4['query'][_0xcf00('0x36')]));_0x381775[_0xcf00('0x35')]=_0x381775[_0xcf00('0x35')][_0xcf00('0x37')]?_0x381775[_0xcf00('0x35')]:_0x39d19b['model'];_0x381775[_0xcf00('0x3a')]=qs[_0xcf00('0x4c')](_0x2e02c4['query'][_0xcf00('0x4c')]);_0x381775[_0xcf00('0x3d')]=qs[_0xcf00('0x33')](_[_0xcf00('0x4e')](_0x2e02c4[_0xcf00('0x31')],_0x39d19b[_0xcf00('0x33')]));if(_0x2e02c4['query'][_0xcf00('0x3b')]){_0x381775[_0xcf00('0x3d')]=_[_0xcf00('0x3c')](_0x381775[_0xcf00('0x3d')],{'$or':_[_0xcf00('0x2b')](_0x381775['attributes'],function(_0x8d143d){var _0x2daafa={};_0x2daafa[_0x8d143d]={'$like':'%'+_0x2e02c4[_0xcf00('0x31')][_0xcf00('0x3b')]+'%'};return _0x2daafa;})});}_0x381775=_[_0xcf00('0x3c')]({},_0x381775,_0x2e02c4['options']);return _0x45295e[_0xcf00('0x4f')](_0x381775);}})[_0xcf00('0x24')](function(_0x11d8a5){if(_0x11d8a5){_0x44129f=_0x11d8a5[_0xcf00('0x37')];if(!_0x2e02c4[_0xcf00('0x31')][_0xcf00('0x38')](_0xcf00('0x39'))){_0x381775[_0xcf00('0x1e')]=qs['limit'](_0x2e02c4[_0xcf00('0x31')]['limit']);_0x381775[_0xcf00('0x1c')]=qs[_0xcf00('0x1c')](_0x2e02c4[_0xcf00('0x31')]['offset']);}return _0x45295e[_0xcf00('0x4f')](_0x381775);}})[_0xcf00('0x24')](function(_0x51b630){if(_0x51b630){return _0x51b630?{'count':_0x44129f,'rows':_0x51b630}:null;}})[_0xcf00('0x24')](respondWithResult(_0x314374,null))[_0xcf00('0x42')](handleError(_0x314374,null));}; \ No newline at end of file +var _0x4f87=['../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','rawAttributes','type','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','ZohoConfiguration','includeAll','include','findAll','rows','catch','show','find','create','body','destroy','getFields','params','ZohoField','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x21ca6c,_0x452d2c){var _0x2d407a=function(_0x4137e3){while(--_0x4137e3){_0x21ca6c['push'](_0x21ca6c['shift']());}};_0x2d407a(++_0x452d2c);}(_0x4f87,0xd8));var _0x74f8=function(_0x40f9a9,_0x36b37d){_0x40f9a9=_0x40f9a9-0x0;var _0x316d51=_0x4f87[_0x40f9a9];return _0x316d51;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x74f8('0x0'));var zipdir=require(_0x74f8('0x1'));var jsonpatch=require(_0x74f8('0x2'));var rp=require(_0x74f8('0x3'));var moment=require('moment');var BPromise=require(_0x74f8('0x4'));var Mustache=require(_0x74f8('0x5'));var util=require('util');var path=require(_0x74f8('0x6'));var sox=require(_0x74f8('0x7'));var csv=require(_0x74f8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x74f8('0x9'));var squel=require(_0x74f8('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x74f8('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x74f8('0xc'));var Redis=require(_0x74f8('0xd'));var authService=require(_0x74f8('0xe'));var qs=require(_0x74f8('0xf'));var as=require(_0x74f8('0x10'));var hardwareService=require(_0x74f8('0x11'));var logger=require(_0x74f8('0x12'))(_0x74f8('0x13'));var utils=require(_0x74f8('0x14'));var config=require(_0x74f8('0x15'));var licenseUtil=require(_0x74f8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24e1d5,_0x5f3371){_0x5f3371=_0x5f3371||0xcc;return function(_0x23ef7b){if(_0x23ef7b){return _0x24e1d5[_0x74f8('0x17')](_0x5f3371);}return _0x24e1d5[_0x74f8('0x18')](_0x5f3371)[_0x74f8('0x19')]();};}function respondWithResult(_0x2595ea,_0x3247fb){_0x3247fb=_0x3247fb||0xc8;return function(_0x384188){if(_0x384188){return _0x2595ea[_0x74f8('0x18')](_0x3247fb)[_0x74f8('0x1a')](_0x384188);}};}function respondWithFilteredResult(_0x2f6c70,_0x214895){return function(_0x9f7634){if(_0x9f7634){var _0x4ea744=typeof _0x214895[_0x74f8('0x1b')]===_0x74f8('0x1c')&&typeof _0x214895['limit']==='undefined';var _0x45e4ae=_0x9f7634[_0x74f8('0x1d')];var _0x132f2f=_0x4ea744?0x0:_0x214895['offset'];var _0x5eb8eb=_0x4ea744?_0x9f7634[_0x74f8('0x1d')]:_0x214895[_0x74f8('0x1b')]+_0x214895[_0x74f8('0x1e')];var _0x3861bf;if(_0x5eb8eb>=_0x45e4ae){_0x5eb8eb=_0x45e4ae;_0x3861bf=0xc8;}else{_0x3861bf=0xce;}_0x2f6c70[_0x74f8('0x18')](_0x3861bf);return _0x2f6c70[_0x74f8('0x1f')](_0x74f8('0x20'),_0x132f2f+'-'+_0x5eb8eb+'/'+_0x45e4ae)[_0x74f8('0x1a')](_0x9f7634);}return null;};}function patchUpdates(_0x1ba7fd){return function(_0x345909){try{jsonpatch[_0x74f8('0x21')](_0x345909,_0x1ba7fd,!![]);}catch(_0x157ba7){return BPromise[_0x74f8('0x22')](_0x157ba7);}return _0x345909[_0x74f8('0x23')]();};}function saveUpdates(_0x1e70e9,_0x1e35f3){return function(_0x4a3480){if(_0x4a3480){return _0x4a3480[_0x74f8('0x24')](_0x1e70e9)[_0x74f8('0x25')](function(_0x54e18b){return _0x54e18b;});}return null;};}function removeEntity(_0x80a287,_0x1a4096){return function(_0x486699){if(_0x486699){return _0x486699['destroy']()['then'](function(){_0x80a287[_0x74f8('0x18')](0xcc)[_0x74f8('0x19')]();});}};}function handleEntityNotFound(_0x288070,_0x2e7de6){return function(_0x1f8c13){if(!_0x1f8c13){_0x288070[_0x74f8('0x17')](0x194);}return _0x1f8c13;};}function handleError(_0x195af1,_0x441a6b){_0x441a6b=_0x441a6b||0x1f4;return function(_0x45ea9a){logger['error'](_0x45ea9a[_0x74f8('0x26')]);if(_0x45ea9a[_0x74f8('0x27')]){delete _0x45ea9a[_0x74f8('0x27')];}_0x195af1['status'](_0x441a6b)[_0x74f8('0x28')](_0x45ea9a);};}exports[_0x74f8('0x29')]=function(_0x23c48c,_0x465e01){var _0x5e807c={},_0x5622e9={},_0xd5acbb={'count':0x0,'rows':[]};var _0x2f5a08=_['map'](db['ZohoConfiguration'][_0x74f8('0x2a')],function(_0x49ed06){return{'name':_0x49ed06['fieldName'],'type':_0x49ed06[_0x74f8('0x2b')]['key']};});_0x5622e9['model']=_[_0x74f8('0x2c')](_0x2f5a08,_0x74f8('0x27'));_0x5622e9[_0x74f8('0x2d')]=_[_0x74f8('0x2e')](_0x23c48c[_0x74f8('0x2d')]);_0x5622e9[_0x74f8('0x2f')]=_[_0x74f8('0x30')](_0x5622e9[_0x74f8('0x31')],_0x5622e9[_0x74f8('0x2d')]);_0x5e807c['attributes']=_[_0x74f8('0x30')](_0x5622e9[_0x74f8('0x31')],qs[_0x74f8('0x32')](_0x23c48c[_0x74f8('0x2d')][_0x74f8('0x32')]));_0x5e807c['attributes']=_0x5e807c[_0x74f8('0x33')][_0x74f8('0x34')]?_0x5e807c['attributes']:_0x5622e9['model'];if(!_0x23c48c[_0x74f8('0x2d')][_0x74f8('0x35')]('nolimit')){_0x5e807c['limit']=qs[_0x74f8('0x1e')](_0x23c48c['query'][_0x74f8('0x1e')]);_0x5e807c[_0x74f8('0x1b')]=qs[_0x74f8('0x1b')](_0x23c48c[_0x74f8('0x2d')][_0x74f8('0x1b')]);}_0x5e807c[_0x74f8('0x36')]=qs[_0x74f8('0x37')](_0x23c48c[_0x74f8('0x2d')][_0x74f8('0x37')]);_0x5e807c[_0x74f8('0x38')]=qs[_0x74f8('0x2f')](_[_0x74f8('0x39')](_0x23c48c['query'],_0x5622e9[_0x74f8('0x2f')]),_0x2f5a08);if(_0x23c48c[_0x74f8('0x2d')][_0x74f8('0x3a')]){_0x5e807c['where']=_['merge'](_0x5e807c[_0x74f8('0x38')],{'$or':_[_0x74f8('0x2c')](_0x2f5a08,function(_0x31b7b2){if(_0x31b7b2['type']!==_0x74f8('0x3b')){var _0x4fda02={};_0x4fda02[_0x31b7b2[_0x74f8('0x27')]]={'$like':'%'+_0x23c48c[_0x74f8('0x2d')][_0x74f8('0x3a')]+'%'};return _0x4fda02;}})});}_0x5e807c=_[_0x74f8('0x3c')]({},_0x5e807c,_0x23c48c[_0x74f8('0x3d')]);var _0x54e21b={'where':_0x5e807c[_0x74f8('0x38')]};return db[_0x74f8('0x3e')][_0x74f8('0x1d')](_0x54e21b)['then'](function(_0x2cb744){_0xd5acbb['count']=_0x2cb744;if(_0x23c48c[_0x74f8('0x2d')][_0x74f8('0x3f')]){_0x5e807c[_0x74f8('0x40')]=[{'all':!![]}];}return db[_0x74f8('0x3e')][_0x74f8('0x41')](_0x5e807c);})[_0x74f8('0x25')](function(_0x38d4c5){_0xd5acbb[_0x74f8('0x42')]=_0x38d4c5;return _0xd5acbb;})['then'](respondWithFilteredResult(_0x465e01,_0x5e807c))[_0x74f8('0x43')](handleError(_0x465e01,null));};exports[_0x74f8('0x44')]=function(_0x125b71,_0x152549){var _0x30f48c={'raw':![],'where':{'id':_0x125b71['params']['id']}},_0x2828d3={};_0x2828d3[_0x74f8('0x31')]=_['keys'](db['ZohoConfiguration'][_0x74f8('0x2a')]);_0x2828d3[_0x74f8('0x2d')]=_[_0x74f8('0x2e')](_0x125b71[_0x74f8('0x2d')]);_0x2828d3[_0x74f8('0x2f')]=_[_0x74f8('0x30')](_0x2828d3[_0x74f8('0x31')],_0x2828d3[_0x74f8('0x2d')]);_0x30f48c['attributes']=_[_0x74f8('0x30')](_0x2828d3['model'],qs['fields'](_0x125b71[_0x74f8('0x2d')][_0x74f8('0x32')]));_0x30f48c[_0x74f8('0x33')]=_0x30f48c[_0x74f8('0x33')][_0x74f8('0x34')]?_0x30f48c[_0x74f8('0x33')]:_0x2828d3[_0x74f8('0x31')];if(_0x125b71[_0x74f8('0x2d')][_0x74f8('0x3f')]){_0x30f48c[_0x74f8('0x40')]=[{'all':!![]}];}_0x30f48c=_[_0x74f8('0x3c')]({},_0x30f48c,_0x125b71[_0x74f8('0x3d')]);return db[_0x74f8('0x3e')][_0x74f8('0x45')](_0x30f48c)[_0x74f8('0x25')](handleEntityNotFound(_0x152549,null))[_0x74f8('0x25')](respondWithResult(_0x152549,null))['catch'](handleError(_0x152549,null));};exports[_0x74f8('0x46')]=function(_0x4808af,_0x5d4e5b){return db[_0x74f8('0x3e')]['create'](_0x4808af['body'],{})[_0x74f8('0x25')](respondWithResult(_0x5d4e5b,0xc9))['catch'](handleError(_0x5d4e5b,null));};exports[_0x74f8('0x24')]=function(_0x4b2828,_0x8d0bc2){if(_0x4b2828[_0x74f8('0x47')]['id']){delete _0x4b2828[_0x74f8('0x47')]['id'];}return db[_0x74f8('0x3e')]['find']({'where':{'id':_0x4b2828['params']['id']}})[_0x74f8('0x25')](handleEntityNotFound(_0x8d0bc2,null))[_0x74f8('0x25')](saveUpdates(_0x4b2828[_0x74f8('0x47')],null))[_0x74f8('0x25')](respondWithResult(_0x8d0bc2,null))['catch'](handleError(_0x8d0bc2,null));};exports[_0x74f8('0x48')]=function(_0x33ef97,_0xf78da5){return db[_0x74f8('0x3e')][_0x74f8('0x45')]({'where':{'id':_0x33ef97['params']['id']}})[_0x74f8('0x25')](handleEntityNotFound(_0xf78da5,null))[_0x74f8('0x25')](removeEntity(_0xf78da5,null))['catch'](handleError(_0xf78da5,null));};exports[_0x74f8('0x49')]=function(_0x340650,_0x133a49,_0xf5f6fd){var _0x218c65={};var _0x2a19f5={};var _0x573309;var _0x6f5b52;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x340650[_0x74f8('0x4a')]['id']}})[_0x74f8('0x25')](handleEntityNotFound(_0x133a49,null))['then'](function(_0x5b1ede){if(_0x5b1ede){_0x573309=_0x5b1ede;_0x2a19f5[_0x74f8('0x31')]=_[_0x74f8('0x2e')](db[_0x74f8('0x4b')][_0x74f8('0x2a')]);_0x2a19f5['query']=_[_0x74f8('0x2e')](_0x340650[_0x74f8('0x2d')]);_0x2a19f5['filters']=_[_0x74f8('0x30')](_0x2a19f5[_0x74f8('0x31')],_0x2a19f5[_0x74f8('0x2d')]);_0x218c65[_0x74f8('0x33')]=_[_0x74f8('0x30')](_0x2a19f5[_0x74f8('0x31')],qs[_0x74f8('0x32')](_0x340650[_0x74f8('0x2d')][_0x74f8('0x32')]));_0x218c65['attributes']=_0x218c65[_0x74f8('0x33')][_0x74f8('0x34')]?_0x218c65[_0x74f8('0x33')]:_0x2a19f5['model'];_0x218c65[_0x74f8('0x36')]=qs['sort'](_0x340650['query'][_0x74f8('0x37')]);_0x218c65[_0x74f8('0x38')]=qs['filters'](_[_0x74f8('0x39')](_0x340650['query'],_0x2a19f5[_0x74f8('0x2f')]));if(_0x340650[_0x74f8('0x2d')][_0x74f8('0x3a')]){_0x218c65[_0x74f8('0x38')]=_['merge'](_0x218c65[_0x74f8('0x38')],{'$or':_['map'](_0x218c65['attributes'],function(_0x339947){var _0x180119={};_0x180119[_0x339947]={'$like':'%'+_0x340650[_0x74f8('0x2d')][_0x74f8('0x3a')]+'%'};return _0x180119;})});}_0x218c65=_['merge']({},_0x218c65,_0x340650[_0x74f8('0x3d')]);return _0x573309['getFields'](_0x218c65);}})[_0x74f8('0x25')](function(_0x7406b2){if(_0x7406b2){_0x6f5b52=_0x7406b2[_0x74f8('0x34')];if(!_0x340650[_0x74f8('0x2d')]['hasOwnProperty'](_0x74f8('0x4c'))){_0x218c65[_0x74f8('0x1e')]=qs['limit'](_0x340650[_0x74f8('0x2d')][_0x74f8('0x1e')]);_0x218c65[_0x74f8('0x1b')]=qs[_0x74f8('0x1b')](_0x340650['query']['offset']);}return _0x573309['getFields'](_0x218c65);}})[_0x74f8('0x25')](function(_0xac41b7){if(_0xac41b7){return _0xac41b7?{'count':_0x6f5b52,'rows':_0xac41b7}:null;}})[_0x74f8('0x25')](respondWithResult(_0x133a49,null))[_0x74f8('0x43')](handleError(_0x133a49,null));};exports[_0x74f8('0x4d')]=function(_0x3df916,_0x11fcbf,_0x24faef){var _0x90291f={};var _0x48f881={};var _0x22ce75;var _0x2f52f1;return db[_0x74f8('0x3e')]['findOne']({'where':{'id':_0x3df916[_0x74f8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x11fcbf,null))[_0x74f8('0x25')](function(_0x5696a4){if(_0x5696a4){_0x22ce75=_0x5696a4;_0x48f881[_0x74f8('0x31')]=_[_0x74f8('0x2e')](db[_0x74f8('0x4b')][_0x74f8('0x2a')]);_0x48f881[_0x74f8('0x2d')]=_[_0x74f8('0x2e')](_0x3df916[_0x74f8('0x2d')]);_0x48f881[_0x74f8('0x2f')]=_['intersection'](_0x48f881[_0x74f8('0x31')],_0x48f881['query']);_0x90291f['attributes']=_[_0x74f8('0x30')](_0x48f881['model'],qs[_0x74f8('0x32')](_0x3df916['query'][_0x74f8('0x32')]));_0x90291f['attributes']=_0x90291f[_0x74f8('0x33')][_0x74f8('0x34')]?_0x90291f[_0x74f8('0x33')]:_0x48f881[_0x74f8('0x31')];_0x90291f['order']=qs[_0x74f8('0x37')](_0x3df916['query'][_0x74f8('0x37')]);_0x90291f[_0x74f8('0x38')]=qs['filters'](_['pick'](_0x3df916[_0x74f8('0x2d')],_0x48f881[_0x74f8('0x2f')]));if(_0x3df916[_0x74f8('0x2d')]['filter']){_0x90291f[_0x74f8('0x38')]=_[_0x74f8('0x3c')](_0x90291f[_0x74f8('0x38')],{'$or':_['map'](_0x90291f[_0x74f8('0x33')],function(_0x34387e){var _0x181509={};_0x181509[_0x34387e]={'$like':'%'+_0x3df916[_0x74f8('0x2d')][_0x74f8('0x3a')]+'%'};return _0x181509;})});}_0x90291f=_[_0x74f8('0x3c')]({},_0x90291f,_0x3df916[_0x74f8('0x3d')]);return _0x22ce75[_0x74f8('0x4d')](_0x90291f);}})[_0x74f8('0x25')](function(_0x1549eb){if(_0x1549eb){_0x2f52f1=_0x1549eb[_0x74f8('0x34')];if(!_0x3df916[_0x74f8('0x2d')]['hasOwnProperty'](_0x74f8('0x4c'))){_0x90291f[_0x74f8('0x1e')]=qs[_0x74f8('0x1e')](_0x3df916['query'][_0x74f8('0x1e')]);_0x90291f['offset']=qs[_0x74f8('0x1b')](_0x3df916[_0x74f8('0x2d')]['offset']);}return _0x22ce75[_0x74f8('0x4d')](_0x90291f);}})[_0x74f8('0x25')](function(_0x2476e8){if(_0x2476e8){return _0x2476e8?{'count':_0x2f52f1,'rows':_0x2476e8}:null;}})[_0x74f8('0x25')](respondWithResult(_0x11fcbf,null))['catch'](handleError(_0x11fcbf,null));};exports[_0x74f8('0x4e')]=function(_0x434c78,_0x12b5ba,_0x22622e){var _0x18343a={};var _0x3e4365={};var _0x1a1f7e;var _0x5f1002;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x434c78[_0x74f8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12b5ba,null))[_0x74f8('0x25')](function(_0xda9303){if(_0xda9303){_0x1a1f7e=_0xda9303;_0x3e4365['model']=_[_0x74f8('0x2e')](db[_0x74f8('0x4b')]['rawAttributes']);_0x3e4365[_0x74f8('0x2d')]=_[_0x74f8('0x2e')](_0x434c78[_0x74f8('0x2d')]);_0x3e4365[_0x74f8('0x2f')]=_[_0x74f8('0x30')](_0x3e4365['model'],_0x3e4365['query']);_0x18343a[_0x74f8('0x33')]=_[_0x74f8('0x30')](_0x3e4365[_0x74f8('0x31')],qs[_0x74f8('0x32')](_0x434c78[_0x74f8('0x2d')][_0x74f8('0x32')]));_0x18343a[_0x74f8('0x33')]=_0x18343a['attributes'][_0x74f8('0x34')]?_0x18343a[_0x74f8('0x33')]:_0x3e4365[_0x74f8('0x31')];_0x18343a[_0x74f8('0x36')]=qs[_0x74f8('0x37')](_0x434c78['query'][_0x74f8('0x37')]);_0x18343a[_0x74f8('0x38')]=qs[_0x74f8('0x2f')](_[_0x74f8('0x39')](_0x434c78[_0x74f8('0x2d')],_0x3e4365['filters']));if(_0x434c78[_0x74f8('0x2d')][_0x74f8('0x3a')]){_0x18343a['where']=_['merge'](_0x18343a[_0x74f8('0x38')],{'$or':_[_0x74f8('0x2c')](_0x18343a[_0x74f8('0x33')],function(_0x14ab21){var _0x2a985b={};_0x2a985b[_0x14ab21]={'$like':'%'+_0x434c78[_0x74f8('0x2d')]['filter']+'%'};return _0x2a985b;})});}_0x18343a=_[_0x74f8('0x3c')]({},_0x18343a,_0x434c78[_0x74f8('0x3d')]);return _0x1a1f7e[_0x74f8('0x4e')](_0x18343a);}})['then'](function(_0x2403b3){if(_0x2403b3){_0x5f1002=_0x2403b3[_0x74f8('0x34')];if(!_0x434c78['query'][_0x74f8('0x35')](_0x74f8('0x4c'))){_0x18343a[_0x74f8('0x1e')]=qs['limit'](_0x434c78[_0x74f8('0x2d')][_0x74f8('0x1e')]);_0x18343a[_0x74f8('0x1b')]=qs[_0x74f8('0x1b')](_0x434c78['query'][_0x74f8('0x1b')]);}return _0x1a1f7e['getDescriptions'](_0x18343a);}})[_0x74f8('0x25')](function(_0xd30d50){if(_0xd30d50){return _0xd30d50?{'count':_0x5f1002,'rows':_0xd30d50}:null;}})[_0x74f8('0x25')](respondWithResult(_0x12b5ba,null))[_0x74f8('0x43')](handleError(_0x12b5ba,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 0fe5f94..9406e65 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 _0xb6f1=['bluebird','path','rimraf','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','util','../../config/logger','api','moment'];(function(_0x3a4f18,_0x1af741){var _0x4c20fc=function(_0x27115f){while(--_0x27115f){_0x3a4f18['push'](_0x3a4f18['shift']());}};_0x4c20fc(++_0x1af741);}(_0xb6f1,0x1d5));var _0x1b6f=function(_0x1bd3ab,_0x352c42){_0x1bd3ab=_0x1bd3ab-0x0;var _0x37e394=_0xb6f1[_0x1bd3ab];return _0x37e394;};'use strict';var _=require('lodash');var util=require(_0x1b6f('0x0'));var logger=require(_0x1b6f('0x1'))(_0x1b6f('0x2'));var moment=require(_0x1b6f('0x3'));var BPromise=require(_0x1b6f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b6f('0x5'));var rimraf=require(_0x1b6f('0x6'));var config=require('../../config/environment');var attributes=require(_0x1b6f('0x7'));module[_0x1b6f('0x8')]=function(_0x88997e,_0x2cb568){return _0x88997e[_0x1b6f('0x9')]('ZohoConfiguration',attributes,{'tableName':_0x1b6f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0010=['moment','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','../../config/logger','api'];(function(_0x2510c4,_0x4a7f5c){var _0x5bd516=function(_0x454806){while(--_0x454806){_0x2510c4['push'](_0x2510c4['shift']());}};_0x5bd516(++_0x4a7f5c);}(_0x0010,0x1d7));var _0x0001=function(_0x3a98cf,_0x237708){_0x3a98cf=_0x3a98cf-0x0;var _0x4ea20c=_0x0010[_0x3a98cf];return _0x4ea20c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0001('0x0'))(_0x0001('0x1'));var moment=require(_0x0001('0x2'));var BPromise=require('bluebird');var rp=require(_0x0001('0x3'));var fs=require('fs');var path=require(_0x0001('0x4'));var rimraf=require(_0x0001('0x5'));var config=require(_0x0001('0x6'));var attributes=require(_0x0001('0x7'));module[_0x0001('0x8')]=function(_0x2b3e0f,_0x41a450){return _0x2b3e0f[_0x0001('0x9')]('ZohoConfiguration',attributes,{'tableName':_0x0001('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index e3c3243..26f53e7 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 _0xa3ff=['message','info','result','catch','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','request','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa3ff,0xb4));var _0xfa3f=function(_0x3a412f,_0x1634db){_0x3a412f=_0x3a412f-0x0;var _0x41ddbf=_0xa3ff[_0x3a412f];return _0x41ddbf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfa3f('0x0'));var BPromise=require(_0xfa3f('0x1'));var rs=require(_0xfa3f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa3f('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfa3f('0x4'));var config=require(_0xfa3f('0x5'));var jayson=require(_0xfa3f('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13b8f1,_0x44aa40,_0x5ccc25){return new BPromise(function(_0x4fb40a,_0x91e537){return client[_0xfa3f('0x7')](_0x13b8f1,_0x5ccc25)['then'](function(_0x5ac436){logger['info'](_0xfa3f('0x8'),_0x44aa40,_0xfa3f('0x9'));logger['debug'](_0xfa3f('0xa'),_0x44aa40,'request\x20sent',JSON['stringify'](_0x5ac436));if(_0x5ac436[_0xfa3f('0xb')]){if(_0x5ac436['error']['code']===0x1f4){logger['error'](_0xfa3f('0x8'),_0x44aa40,_0x5ac436['error'][_0xfa3f('0xc')]);return _0x91e537(_0x5ac436[_0xfa3f('0xb')][_0xfa3f('0xc')]);}logger['error'](_0xfa3f('0x8'),_0x44aa40,_0x5ac436[_0xfa3f('0xb')][_0xfa3f('0xc')]);return _0x4fb40a(_0x5ac436['error'][_0xfa3f('0xc')]);}else{logger[_0xfa3f('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x44aa40,_0xfa3f('0x9'));_0x4fb40a(_0x5ac436[_0xfa3f('0xe')]['message']);}})[_0xfa3f('0xf')](function(_0x7c900a){logger['error'](_0xfa3f('0x8'),_0x44aa40,_0x7c900a);_0x91e537(_0x7c900a);});});} \ No newline at end of file +var _0xe3ec=['error','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x29db25,_0x457467){var _0x48b1a5=function(_0x5cb05f){while(--_0x5cb05f){_0x29db25['push'](_0x29db25['shift']());}};_0x48b1a5(++_0x457467);}(_0xe3ec,0xe8));var _0xce3e=function(_0x2021c2,_0x412622){_0x2021c2=_0x2021c2-0x0;var _0x216ffc=_0xe3ec[_0x2021c2];return _0x216ffc;};'use strict';var _=require(_0xce3e('0x0'));var util=require(_0xce3e('0x1'));var moment=require('moment');var BPromise=require(_0xce3e('0x2'));var rs=require(_0xce3e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xce3e('0x4'));var logger=require(_0xce3e('0x5'))('rpc');var config=require(_0xce3e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xce3e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x12649b,_0x43035c,_0x34953f){return new BPromise(function(_0x23e333,_0x2949de){return client[_0xce3e('0x8')](_0x12649b,_0x34953f)[_0xce3e('0x9')](function(_0x8afb0c){logger[_0xce3e('0xa')](_0xce3e('0xb'),_0x43035c,'request\x20sent');logger['debug'](_0xce3e('0xc'),_0x43035c,_0xce3e('0xd'),JSON[_0xce3e('0xe')](_0x8afb0c));if(_0x8afb0c['error']){if(_0x8afb0c[_0xce3e('0xf')]['code']===0x1f4){logger['error'](_0xce3e('0xb'),_0x43035c,_0x8afb0c[_0xce3e('0xf')][_0xce3e('0x10')]);return _0x2949de(_0x8afb0c['error'][_0xce3e('0x10')]);}logger['error'](_0xce3e('0xb'),_0x43035c,_0x8afb0c['error'][_0xce3e('0x10')]);return _0x23e333(_0x8afb0c['error'][_0xce3e('0x10')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x43035c,_0xce3e('0xd'));_0x23e333(_0x8afb0c[_0xce3e('0x11')]['message']);}})[_0xce3e('0x12')](function(_0x2a2983){logger[_0xce3e('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x43035c,_0x2a2983);_0x2949de(_0x2a2983);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 14019ea..9eb9cd7 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 _0x8b9a=['create','put','/:id','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../config/environment','./intZohoField.controller','get','isAuthenticated','show','post'];(function(_0x22cb40,_0x45dd39){var _0x2ede76=function(_0x4db6bd){while(--_0x4db6bd){_0x22cb40['push'](_0x22cb40['shift']());}};_0x2ede76(++_0x45dd39);}(_0x8b9a,0xe5));var _0xa8b9=function(_0xbd78e1,_0x18e70a){_0xbd78e1=_0xbd78e1-0x0;var _0x506528=_0x8b9a[_0xbd78e1];return _0x506528;};'use strict';var multer=require(_0xa8b9('0x0'));var util=require('util');var path=require(_0xa8b9('0x1'));var timeout=require(_0xa8b9('0x2'));var express=require(_0xa8b9('0x3'));var router=express['Router']();var fs_extra=require(_0xa8b9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa8b9('0x5'));var controller=require(_0xa8b9('0x6'));router[_0xa8b9('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa8b9('0x7')]('/:id',auth[_0xa8b9('0x8')](),controller[_0xa8b9('0x9')]);router[_0xa8b9('0xa')]('/',auth[_0xa8b9('0x8')](),controller[_0xa8b9('0xb')]);router[_0xa8b9('0xc')](_0xa8b9('0xd'),auth[_0xa8b9('0x8')](),controller['update']);router[_0xa8b9('0xe')](_0xa8b9('0xd'),auth[_0xa8b9('0x8')](),controller[_0xa8b9('0xf')]);module['exports']=router; \ No newline at end of file +var _0xd5e5=['connect-timeout','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','put','update','delete','destroy','exports','multer','util','path'];(function(_0x3da144,_0x578cbd){var _0x13fdc7=function(_0x2d2919){while(--_0x2d2919){_0x3da144['push'](_0x3da144['shift']());}};_0x13fdc7(++_0x578cbd);}(_0xd5e5,0x1c8));var _0x5d5e=function(_0x55a2ba,_0x2fd4cc){_0x55a2ba=_0x55a2ba-0x0;var _0x39028d=_0xd5e5[_0x55a2ba];return _0x39028d;};'use strict';var multer=require(_0x5d5e('0x0'));var util=require(_0x5d5e('0x1'));var path=require(_0x5d5e('0x2'));var timeout=require(_0x5d5e('0x3'));var express=require('express');var router=express[_0x5d5e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5d5e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5d5e('0x6'));var controller=require('./intZohoField.controller');router['get']('/',auth[_0x5d5e('0x7')](),controller[_0x5d5e('0x8')]);router[_0x5d5e('0x9')](_0x5d5e('0xa'),auth[_0x5d5e('0x7')](),controller[_0x5d5e('0xb')]);router['post']('/',auth[_0x5d5e('0x7')](),controller['create']);router[_0x5d5e('0xc')]('/:id',auth[_0x5d5e('0x7')](),controller[_0x5d5e('0xd')]);router[_0x5d5e('0xe')]('/:id',auth[_0x5d5e('0x7')](),controller[_0x5d5e('0xf')]);module[_0x5d5e('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 13f2e73..c2c78b3 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 _0xbd98=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x169dff,_0x57be0){var _0x91cf22=function(_0x527498){while(--_0x527498){_0x169dff['push'](_0x169dff['shift']());}};_0x91cf22(++_0x57be0);}(_0xbd98,0xa8));var _0x8bd9=function(_0x21be04,_0x3f98a0){_0x21be04=_0x21be04-0x0;var _0x16b3c0=_0xbd98[_0x21be04];return _0x16b3c0;};'use strict';var Sequelize=require(_0x8bd9('0x0'));module[_0x8bd9('0x1')]={'type':{'type':Sequelize[_0x8bd9('0x2')](_0x8bd9('0x3'),_0x8bd9('0x4'),_0x8bd9('0x5'),_0x8bd9('0x6'),'picklist'),'defaultValue':_0x8bd9('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x8bd9('0x4'),_0x8bd9('0x5'))},'keyContent':{'type':Sequelize[_0x8bd9('0x7')]},'idField':{'type':Sequelize[_0x8bd9('0x7')]},'nameField':{'type':Sequelize[_0x8bd9('0x7')]},'customField':{'type':Sequelize[_0x8bd9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa39f=['variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x1081bf,_0xae32e0){var _0x59b720=function(_0x3d8c2f){while(--_0x3d8c2f){_0x1081bf['push'](_0x1081bf['shift']());}};_0x59b720(++_0xae32e0);}(_0xa39f,0xd4));var _0xfa39=function(_0x2b3e7e,_0x37c887){_0x2b3e7e=_0x2b3e7e-0x0;var _0x1e24b2=_0xa39f[_0x2b3e7e];return _0x1e24b2;};'use strict';var Sequelize=require(_0xfa39('0x0'));module[_0xfa39('0x1')]={'type':{'type':Sequelize[_0xfa39('0x2')](_0xfa39('0x3'),_0xfa39('0x4'),_0xfa39('0x5'),'keyValue',_0xfa39('0x6')),'defaultValue':_0xfa39('0x3')},'content':{'type':Sequelize[_0xfa39('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfa39('0x2')](_0xfa39('0x3'),_0xfa39('0x4'),_0xfa39('0x5'))},'keyContent':{'type':Sequelize[_0xfa39('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfa39('0x7')]},'customField':{'type':Sequelize[_0xfa39('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfa39('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 537795e..886a810 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 _0x5a72=['VIRTUAL','merge','options','then','includeAll','include','rows','catch','show','params','intersection','length','find','create','body','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','save','update','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','type','key','query','keys','filters','model','fields','attributes','nolimit','sort','where','pick','filter'];(function(_0x344b79,_0xdca84e){var _0x234b46=function(_0x138dfd){while(--_0x138dfd){_0x344b79['push'](_0x344b79['shift']());}};_0x234b46(++_0xdca84e);}(_0x5a72,0x1c5));var _0x25a7=function(_0x3020e2,_0x15643b){_0x3020e2=_0x3020e2-0x0;var _0x4841e2=_0x5a72[_0x3020e2];return _0x4841e2;};'use strict';var emlformat=require(_0x25a7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x25a7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x25a7('0x2'));var moment=require(_0x25a7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x25a7('0x4'));var util=require(_0x25a7('0x5'));var path=require(_0x25a7('0x6'));var sox=require(_0x25a7('0x7'));var csv=require(_0x25a7('0x8'));var ejs=require(_0x25a7('0x9'));var fs=require('fs');var fs_extra=require(_0x25a7('0xa'));var _=require(_0x25a7('0xb'));var squel=require('squel');var crypto=require(_0x25a7('0xc'));var jsforce=require(_0x25a7('0xd'));var deskjs=require(_0x25a7('0xe'));var toCsv=require(_0x25a7('0x8'));var querystring=require('querystring');var Papa=require(_0x25a7('0xf'));var Redis=require('ioredis');var authService=require(_0x25a7('0x10'));var qs=require(_0x25a7('0x11'));var as=require(_0x25a7('0x12'));var hardwareService=require(_0x25a7('0x13'));var logger=require(_0x25a7('0x14'))(_0x25a7('0x15'));var utils=require('../../config/utils');var config=require(_0x25a7('0x16'));var licenseUtil=require(_0x25a7('0x17'));var db=require(_0x25a7('0x18'))['db'];function respondWithStatusCode(_0x3507dd,_0x26a420){_0x26a420=_0x26a420||0xcc;return function(_0x28d38b){if(_0x28d38b){return _0x3507dd[_0x25a7('0x19')](_0x26a420);}return _0x3507dd[_0x25a7('0x1a')](_0x26a420)[_0x25a7('0x1b')]();};}function respondWithResult(_0x42ea6c,_0x4ba060){_0x4ba060=_0x4ba060||0xc8;return function(_0x22ad36){if(_0x22ad36){return _0x42ea6c[_0x25a7('0x1a')](_0x4ba060)[_0x25a7('0x1c')](_0x22ad36);}};}function respondWithFilteredResult(_0x1f5fa3,_0x110875){return function(_0x7b7899){if(_0x7b7899){var _0x375334=typeof _0x110875['offset']===_0x25a7('0x1d')&&typeof _0x110875[_0x25a7('0x1e')]===_0x25a7('0x1d');var _0x24b7b0=_0x7b7899[_0x25a7('0x1f')];var _0x1e6374=_0x375334?0x0:_0x110875[_0x25a7('0x20')];var _0x4ec5d0=_0x375334?_0x7b7899[_0x25a7('0x1f')]:_0x110875[_0x25a7('0x20')]+_0x110875[_0x25a7('0x1e')];var _0x444cc4;if(_0x4ec5d0>=_0x24b7b0){_0x4ec5d0=_0x24b7b0;_0x444cc4=0xc8;}else{_0x444cc4=0xce;}_0x1f5fa3[_0x25a7('0x1a')](_0x444cc4);return _0x1f5fa3['set']('Content-Range',_0x1e6374+'-'+_0x4ec5d0+'/'+_0x24b7b0)[_0x25a7('0x1c')](_0x7b7899);}return null;};}function patchUpdates(_0x3aab1c){return function(_0x44c567){try{jsonpatch[_0x25a7('0x21')](_0x44c567,_0x3aab1c,!![]);}catch(_0x3931f2){return BPromise['reject'](_0x3931f2);}return _0x44c567[_0x25a7('0x22')]();};}function saveUpdates(_0x1c1cf1,_0x1d1d76){return function(_0x37952d){if(_0x37952d){return _0x37952d[_0x25a7('0x23')](_0x1c1cf1)['then'](function(_0x9f46e9){return _0x9f46e9;});}return null;};}function removeEntity(_0x53c4ef,_0x4ab15e){return function(_0x382efd){if(_0x382efd){return _0x382efd[_0x25a7('0x24')]()['then'](function(){_0x53c4ef['status'](0xcc)[_0x25a7('0x1b')]();});}};}function handleEntityNotFound(_0x2e0317,_0x474ceb){return function(_0x210d5f){if(!_0x210d5f){_0x2e0317[_0x25a7('0x19')](0x194);}return _0x210d5f;};}function handleError(_0x3a8626,_0x359590){_0x359590=_0x359590||0x1f4;return function(_0xd4494){logger[_0x25a7('0x25')](_0xd4494[_0x25a7('0x26')]);if(_0xd4494[_0x25a7('0x27')]){delete _0xd4494['name'];}_0x3a8626['status'](_0x359590)[_0x25a7('0x28')](_0xd4494);};}exports[_0x25a7('0x29')]=function(_0x82068f,_0x19ee12){var _0x47fefc={},_0x3d027d={},_0x21ef4b={'count':0x0,'rows':[]};var _0x193351=_[_0x25a7('0x2a')](db[_0x25a7('0x2b')][_0x25a7('0x2c')],function(_0x1775b9){return{'name':_0x1775b9['fieldName'],'type':_0x1775b9[_0x25a7('0x2d')][_0x25a7('0x2e')]};});_0x3d027d['model']=_[_0x25a7('0x2a')](_0x193351,_0x25a7('0x27'));_0x3d027d[_0x25a7('0x2f')]=_[_0x25a7('0x30')](_0x82068f[_0x25a7('0x2f')]);_0x3d027d[_0x25a7('0x31')]=_['intersection'](_0x3d027d[_0x25a7('0x32')],_0x3d027d[_0x25a7('0x2f')]);_0x47fefc['attributes']=_['intersection'](_0x3d027d[_0x25a7('0x32')],qs[_0x25a7('0x33')](_0x82068f['query'][_0x25a7('0x33')]));_0x47fefc[_0x25a7('0x34')]=_0x47fefc['attributes']['length']?_0x47fefc[_0x25a7('0x34')]:_0x3d027d[_0x25a7('0x32')];if(!_0x82068f['query']['hasOwnProperty'](_0x25a7('0x35'))){_0x47fefc[_0x25a7('0x1e')]=qs[_0x25a7('0x1e')](_0x82068f[_0x25a7('0x2f')]['limit']);_0x47fefc[_0x25a7('0x20')]=qs[_0x25a7('0x20')](_0x82068f[_0x25a7('0x2f')][_0x25a7('0x20')]);}_0x47fefc['order']=qs[_0x25a7('0x36')](_0x82068f[_0x25a7('0x2f')][_0x25a7('0x36')]);_0x47fefc[_0x25a7('0x37')]=qs[_0x25a7('0x31')](_[_0x25a7('0x38')](_0x82068f['query'],_0x3d027d[_0x25a7('0x31')]),_0x193351);if(_0x82068f[_0x25a7('0x2f')][_0x25a7('0x39')]){_0x47fefc[_0x25a7('0x37')]=_['merge'](_0x47fefc[_0x25a7('0x37')],{'$or':_[_0x25a7('0x2a')](_0x193351,function(_0x463e50){if(_0x463e50[_0x25a7('0x2d')]!==_0x25a7('0x3a')){var _0x5d57e1={};_0x5d57e1[_0x463e50[_0x25a7('0x27')]]={'$like':'%'+_0x82068f[_0x25a7('0x2f')]['filter']+'%'};return _0x5d57e1;}})});}_0x47fefc=_[_0x25a7('0x3b')]({},_0x47fefc,_0x82068f[_0x25a7('0x3c')]);var _0x1f8006={'where':_0x47fefc['where']};return db['ZohoField'][_0x25a7('0x1f')](_0x1f8006)[_0x25a7('0x3d')](function(_0x535dec){_0x21ef4b[_0x25a7('0x1f')]=_0x535dec;if(_0x82068f[_0x25a7('0x2f')][_0x25a7('0x3e')]){_0x47fefc[_0x25a7('0x3f')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x47fefc);})[_0x25a7('0x3d')](function(_0x5e54c5){_0x21ef4b[_0x25a7('0x40')]=_0x5e54c5;return _0x21ef4b;})[_0x25a7('0x3d')](respondWithFilteredResult(_0x19ee12,_0x47fefc))[_0x25a7('0x41')](handleError(_0x19ee12,null));};exports[_0x25a7('0x42')]=function(_0xbcaf72,_0x592487){var _0x92e4e={'raw':!![],'where':{'id':_0xbcaf72[_0x25a7('0x43')]['id']}},_0x59d956={};_0x59d956[_0x25a7('0x32')]=_[_0x25a7('0x30')](db[_0x25a7('0x2b')]['rawAttributes']);_0x59d956[_0x25a7('0x2f')]=_[_0x25a7('0x30')](_0xbcaf72[_0x25a7('0x2f')]);_0x59d956[_0x25a7('0x31')]=_[_0x25a7('0x44')](_0x59d956[_0x25a7('0x32')],_0x59d956[_0x25a7('0x2f')]);_0x92e4e['attributes']=_[_0x25a7('0x44')](_0x59d956['model'],qs[_0x25a7('0x33')](_0xbcaf72['query']['fields']));_0x92e4e[_0x25a7('0x34')]=_0x92e4e[_0x25a7('0x34')][_0x25a7('0x45')]?_0x92e4e[_0x25a7('0x34')]:_0x59d956[_0x25a7('0x32')];if(_0xbcaf72[_0x25a7('0x2f')][_0x25a7('0x3e')]){_0x92e4e[_0x25a7('0x3f')]=[{'all':!![]}];}_0x92e4e=_['merge']({},_0x92e4e,_0xbcaf72[_0x25a7('0x3c')]);return db[_0x25a7('0x2b')][_0x25a7('0x46')](_0x92e4e)[_0x25a7('0x3d')](handleEntityNotFound(_0x592487,null))['then'](respondWithResult(_0x592487,null))[_0x25a7('0x41')](handleError(_0x592487,null));};exports[_0x25a7('0x47')]=function(_0x583cfd,_0x3026cb){return db[_0x25a7('0x2b')][_0x25a7('0x47')](_0x583cfd[_0x25a7('0x48')],{})['then'](respondWithResult(_0x3026cb,0xc9))[_0x25a7('0x41')](handleError(_0x3026cb,null));};exports[_0x25a7('0x23')]=function(_0x25fdcb,_0x40d41e){if(_0x25fdcb[_0x25a7('0x48')]['id']){delete _0x25fdcb[_0x25a7('0x48')]['id'];}return db[_0x25a7('0x2b')][_0x25a7('0x46')]({'where':{'id':_0x25fdcb[_0x25a7('0x43')]['id']}})[_0x25a7('0x3d')](handleEntityNotFound(_0x40d41e,null))['then'](saveUpdates(_0x25fdcb[_0x25a7('0x48')],null))[_0x25a7('0x3d')](respondWithResult(_0x40d41e,null))['catch'](handleError(_0x40d41e,null));};exports[_0x25a7('0x24')]=function(_0x269132,_0x2d3322){return db[_0x25a7('0x2b')][_0x25a7('0x46')]({'where':{'id':_0x269132[_0x25a7('0x43')]['id']}})[_0x25a7('0x3d')](handleEntityNotFound(_0x2d3322,null))[_0x25a7('0x3d')](removeEntity(_0x2d3322,null))[_0x25a7('0x41')](handleError(_0x2d3322,null));}; \ No newline at end of file +var _0xf0a3=['key','model','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','pick','filter','where','merge','include','rows','catch','show','params','length','includeAll','options','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','name','send','index','map','ZohoField','rawAttributes','type'];(function(_0x379157,_0x21fbc5){var _0x4947c6=function(_0x438de1){while(--_0x438de1){_0x379157['push'](_0x379157['shift']());}};_0x4947c6(++_0x21fbc5);}(_0xf0a3,0x18d));var _0x3f0a=function(_0x242642,_0x2f1cd7){_0x242642=_0x242642-0x0;var _0x49b341=_0xf0a3[_0x242642];return _0x49b341;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f0a('0x0'));var zipdir=require(_0x3f0a('0x1'));var jsonpatch=require(_0x3f0a('0x2'));var rp=require('request-promise');var moment=require(_0x3f0a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3f0a('0x4'));var util=require('util');var path=require(_0x3f0a('0x5'));var sox=require(_0x3f0a('0x6'));var csv=require(_0x3f0a('0x7'));var ejs=require(_0x3f0a('0x8'));var fs=require('fs');var fs_extra=require(_0x3f0a('0x9'));var _=require(_0x3f0a('0xa'));var squel=require(_0x3f0a('0xb'));var crypto=require(_0x3f0a('0xc'));var jsforce=require(_0x3f0a('0xd'));var deskjs=require(_0x3f0a('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3f0a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3f0a('0x10'));var as=require(_0x3f0a('0x11'));var hardwareService=require(_0x3f0a('0x12'));var logger=require(_0x3f0a('0x13'))(_0x3f0a('0x14'));var utils=require(_0x3f0a('0x15'));var config=require(_0x3f0a('0x16'));var licenseUtil=require(_0x3f0a('0x17'));var db=require(_0x3f0a('0x18'))['db'];function respondWithStatusCode(_0x1fea68,_0x4ddbba){_0x4ddbba=_0x4ddbba||0xcc;return function(_0x1f2052){if(_0x1f2052){return _0x1fea68[_0x3f0a('0x19')](_0x4ddbba);}return _0x1fea68[_0x3f0a('0x1a')](_0x4ddbba)[_0x3f0a('0x1b')]();};}function respondWithResult(_0x25d059,_0x5d6be0){_0x5d6be0=_0x5d6be0||0xc8;return function(_0x47cac7){if(_0x47cac7){return _0x25d059['status'](_0x5d6be0)[_0x3f0a('0x1c')](_0x47cac7);}};}function respondWithFilteredResult(_0x256e07,_0x4dbd9b){return function(_0x3b0802){if(_0x3b0802){var _0x157173=typeof _0x4dbd9b['offset']===_0x3f0a('0x1d')&&typeof _0x4dbd9b[_0x3f0a('0x1e')]===_0x3f0a('0x1d');var _0x1d61a3=_0x3b0802[_0x3f0a('0x1f')];var _0x11bc31=_0x157173?0x0:_0x4dbd9b[_0x3f0a('0x20')];var _0x4bea9e=_0x157173?_0x3b0802[_0x3f0a('0x1f')]:_0x4dbd9b[_0x3f0a('0x20')]+_0x4dbd9b[_0x3f0a('0x1e')];var _0x291c51;if(_0x4bea9e>=_0x1d61a3){_0x4bea9e=_0x1d61a3;_0x291c51=0xc8;}else{_0x291c51=0xce;}_0x256e07[_0x3f0a('0x1a')](_0x291c51);return _0x256e07[_0x3f0a('0x21')](_0x3f0a('0x22'),_0x11bc31+'-'+_0x4bea9e+'/'+_0x1d61a3)[_0x3f0a('0x1c')](_0x3b0802);}return null;};}function patchUpdates(_0x37528e){return function(_0x13c321){try{jsonpatch['apply'](_0x13c321,_0x37528e,!![]);}catch(_0x245faf){return BPromise[_0x3f0a('0x23')](_0x245faf);}return _0x13c321[_0x3f0a('0x24')]();};}function saveUpdates(_0x4aa0e4,_0x470248){return function(_0x3a28ca){if(_0x3a28ca){return _0x3a28ca[_0x3f0a('0x25')](_0x4aa0e4)[_0x3f0a('0x26')](function(_0x256ad8){return _0x256ad8;});}return null;};}function removeEntity(_0x5b140f,_0x42883c){return function(_0x119116){if(_0x119116){return _0x119116['destroy']()[_0x3f0a('0x26')](function(){_0x5b140f[_0x3f0a('0x1a')](0xcc)[_0x3f0a('0x1b')]();});}};}function handleEntityNotFound(_0x4a5bdc,_0xf038d7){return function(_0x33e1a6){if(!_0x33e1a6){_0x4a5bdc['sendStatus'](0x194);}return _0x33e1a6;};}function handleError(_0x5608e0,_0x3fab4d){_0x3fab4d=_0x3fab4d||0x1f4;return function(_0x5cd719){logger[_0x3f0a('0x27')](_0x5cd719['stack']);if(_0x5cd719['name']){delete _0x5cd719[_0x3f0a('0x28')];}_0x5608e0[_0x3f0a('0x1a')](_0x3fab4d)[_0x3f0a('0x29')](_0x5cd719);};}exports[_0x3f0a('0x2a')]=function(_0x128a91,_0x533af4){var _0x3e8200={},_0x2ff935={},_0x10445f={'count':0x0,'rows':[]};var _0x28dca6=_[_0x3f0a('0x2b')](db[_0x3f0a('0x2c')][_0x3f0a('0x2d')],function(_0x962928){return{'name':_0x962928['fieldName'],'type':_0x962928[_0x3f0a('0x2e')][_0x3f0a('0x2f')]};});_0x2ff935[_0x3f0a('0x30')]=_[_0x3f0a('0x2b')](_0x28dca6,_0x3f0a('0x28'));_0x2ff935['query']=_[_0x3f0a('0x31')](_0x128a91['query']);_0x2ff935[_0x3f0a('0x32')]=_[_0x3f0a('0x33')](_0x2ff935[_0x3f0a('0x30')],_0x2ff935[_0x3f0a('0x34')]);_0x3e8200[_0x3f0a('0x35')]=_[_0x3f0a('0x33')](_0x2ff935[_0x3f0a('0x30')],qs[_0x3f0a('0x36')](_0x128a91[_0x3f0a('0x34')][_0x3f0a('0x36')]));_0x3e8200['attributes']=_0x3e8200[_0x3f0a('0x35')]['length']?_0x3e8200[_0x3f0a('0x35')]:_0x2ff935[_0x3f0a('0x30')];if(!_0x128a91[_0x3f0a('0x34')]['hasOwnProperty'](_0x3f0a('0x37'))){_0x3e8200[_0x3f0a('0x1e')]=qs[_0x3f0a('0x1e')](_0x128a91['query'][_0x3f0a('0x1e')]);_0x3e8200[_0x3f0a('0x20')]=qs[_0x3f0a('0x20')](_0x128a91[_0x3f0a('0x34')]['offset']);}_0x3e8200[_0x3f0a('0x38')]=qs['sort'](_0x128a91[_0x3f0a('0x34')][_0x3f0a('0x39')]);_0x3e8200['where']=qs['filters'](_[_0x3f0a('0x3a')](_0x128a91[_0x3f0a('0x34')],_0x2ff935[_0x3f0a('0x32')]),_0x28dca6);if(_0x128a91[_0x3f0a('0x34')][_0x3f0a('0x3b')]){_0x3e8200[_0x3f0a('0x3c')]=_[_0x3f0a('0x3d')](_0x3e8200[_0x3f0a('0x3c')],{'$or':_[_0x3f0a('0x2b')](_0x28dca6,function(_0xe2226a){if(_0xe2226a[_0x3f0a('0x2e')]!=='VIRTUAL'){var _0x41aa39={};_0x41aa39[_0xe2226a[_0x3f0a('0x28')]]={'$like':'%'+_0x128a91[_0x3f0a('0x34')][_0x3f0a('0x3b')]+'%'};return _0x41aa39;}})});}_0x3e8200=_[_0x3f0a('0x3d')]({},_0x3e8200,_0x128a91['options']);var _0x4d3f74={'where':_0x3e8200['where']};return db[_0x3f0a('0x2c')][_0x3f0a('0x1f')](_0x4d3f74)[_0x3f0a('0x26')](function(_0x157d94){_0x10445f[_0x3f0a('0x1f')]=_0x157d94;if(_0x128a91['query']['includeAll']){_0x3e8200[_0x3f0a('0x3e')]=[{'all':!![]}];}return db[_0x3f0a('0x2c')]['findAll'](_0x3e8200);})[_0x3f0a('0x26')](function(_0x349cab){_0x10445f[_0x3f0a('0x3f')]=_0x349cab;return _0x10445f;})[_0x3f0a('0x26')](respondWithFilteredResult(_0x533af4,_0x3e8200))[_0x3f0a('0x40')](handleError(_0x533af4,null));};exports[_0x3f0a('0x41')]=function(_0xf88858,_0x47d126){var _0x3f7d58={'raw':!![],'where':{'id':_0xf88858[_0x3f0a('0x42')]['id']}},_0x251393={};_0x251393[_0x3f0a('0x30')]=_[_0x3f0a('0x31')](db[_0x3f0a('0x2c')]['rawAttributes']);_0x251393[_0x3f0a('0x34')]=_[_0x3f0a('0x31')](_0xf88858[_0x3f0a('0x34')]);_0x251393['filters']=_[_0x3f0a('0x33')](_0x251393[_0x3f0a('0x30')],_0x251393[_0x3f0a('0x34')]);_0x3f7d58['attributes']=_[_0x3f0a('0x33')](_0x251393[_0x3f0a('0x30')],qs[_0x3f0a('0x36')](_0xf88858[_0x3f0a('0x34')][_0x3f0a('0x36')]));_0x3f7d58[_0x3f0a('0x35')]=_0x3f7d58['attributes'][_0x3f0a('0x43')]?_0x3f7d58[_0x3f0a('0x35')]:_0x251393['model'];if(_0xf88858[_0x3f0a('0x34')][_0x3f0a('0x44')]){_0x3f7d58[_0x3f0a('0x3e')]=[{'all':!![]}];}_0x3f7d58=_[_0x3f0a('0x3d')]({},_0x3f7d58,_0xf88858[_0x3f0a('0x45')]);return db[_0x3f0a('0x2c')][_0x3f0a('0x46')](_0x3f7d58)['then'](handleEntityNotFound(_0x47d126,null))[_0x3f0a('0x26')](respondWithResult(_0x47d126,null))[_0x3f0a('0x40')](handleError(_0x47d126,null));};exports[_0x3f0a('0x47')]=function(_0x112459,_0x5429ff){return db[_0x3f0a('0x2c')][_0x3f0a('0x47')](_0x112459['body'],{})[_0x3f0a('0x26')](respondWithResult(_0x5429ff,0xc9))[_0x3f0a('0x40')](handleError(_0x5429ff,null));};exports[_0x3f0a('0x25')]=function(_0x5c0a47,_0x3ce704){if(_0x5c0a47['body']['id']){delete _0x5c0a47[_0x3f0a('0x48')]['id'];}return db[_0x3f0a('0x2c')][_0x3f0a('0x46')]({'where':{'id':_0x5c0a47[_0x3f0a('0x42')]['id']}})[_0x3f0a('0x26')](handleEntityNotFound(_0x3ce704,null))[_0x3f0a('0x26')](saveUpdates(_0x5c0a47['body'],null))[_0x3f0a('0x26')](respondWithResult(_0x3ce704,null))[_0x3f0a('0x40')](handleError(_0x3ce704,null));};exports[_0x3f0a('0x49')]=function(_0x524fb7,_0x440d33){return db[_0x3f0a('0x2c')][_0x3f0a('0x46')]({'where':{'id':_0x524fb7[_0x3f0a('0x42')]['id']}})[_0x3f0a('0x26')](handleEntityNotFound(_0x440d33,null))[_0x3f0a('0x26')](removeEntity(_0x440d33,null))[_0x3f0a('0x40')](handleError(_0x440d33,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index d86d27c..1a11492 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 _0xf61e=['idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','int_zoho_fields','zoho_unique_index'];(function(_0x180cd0,_0x386c6e){var _0x49fc32=function(_0x551c2c){while(--_0x551c2c){_0x180cd0['push'](_0x180cd0['shift']());}};_0x49fc32(++_0x386c6e);}(_0xf61e,0x191));var _0xef61=function(_0x125890,_0x14b076){_0x125890=_0x125890-0x0;var _0x536c10=_0xf61e[_0x125890];return _0x536c10;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var logger=require(_0xef61('0x2'))(_0xef61('0x3'));var moment=require(_0xef61('0x4'));var BPromise=require(_0xef61('0x5'));var rp=require(_0xef61('0x6'));var fs=require('fs');var path=require(_0xef61('0x7'));var rimraf=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var attributes=require(_0xef61('0xa'));module[_0xef61('0xb')]=function(_0x5b00b2,_0x9e17f4){return _0x5b00b2[_0xef61('0xc')]('ZohoField',attributes,{'tableName':_0xef61('0xd'),'paranoid':![],'indexes':[{'name':_0xef61('0xe'),'fields':[_0xef61('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a07=['api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x2f8ae5,_0x2ee374){var _0xdf46c4=function(_0x7e4026){while(--_0x7e4026){_0x2f8ae5['push'](_0x2f8ae5['shift']());}};_0xdf46c4(++_0x2ee374);}(_0x2a07,0x74));var _0x72a0=function(_0x2b9ac8,_0xf820cb){_0x2b9ac8=_0x2b9ac8-0x0;var _0x3ceea9=_0x2a07[_0x2b9ac8];return _0x3ceea9;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var logger=require(_0x72a0('0x2'))(_0x72a0('0x3'));var moment=require(_0x72a0('0x4'));var BPromise=require('bluebird');var rp=require(_0x72a0('0x5'));var fs=require('fs');var path=require(_0x72a0('0x6'));var rimraf=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var attributes=require(_0x72a0('0x9'));module[_0x72a0('0xa')]=function(_0x3ccf6d,_0x20dab9){return _0x3ccf6d[_0x72a0('0xb')](_0x72a0('0xc'),attributes,{'tableName':_0x72a0('0xd'),'paranoid':![],'indexes':[{'name':_0x72a0('0xe'),'fields':[_0x72a0('0xf'),_0x72a0('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 5836654..99e3f46 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 _0x8323=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird','../../mysqldb'];(function(_0x8b96c1,_0x434825){var _0x3262bb=function(_0x8f5981){while(--_0x8f5981){_0x8b96c1['push'](_0x8b96c1['shift']());}};_0x3262bb(++_0x434825);}(_0x8323,0x128));var _0x3832=function(_0x245c08,_0x31b799){_0x245c08=_0x245c08-0x0;var _0x3e94ac=_0x8323[_0x245c08];return _0x3e94ac;};'use strict';var _=require(_0x3832('0x0'));var util=require(_0x3832('0x1'));var moment=require('moment');var BPromise=require(_0x3832('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3832('0x3'))['db'];var utils=require(_0x3832('0x4'));var logger=require(_0x3832('0x5'))('rpc');var config=require(_0x3832('0x6'));var jayson=require(_0x3832('0x7'));var client=jayson['client'][_0x3832('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b9a90,_0x1a0c39,_0x5dc1a3){return new BPromise(function(_0x690f61,_0x1dea18){return client[_0x3832('0x9')](_0x4b9a90,_0x5dc1a3)['then'](function(_0x10aca6){logger['info'](_0x3832('0xa'),_0x1a0c39,_0x3832('0xb'));logger[_0x3832('0xc')](_0x3832('0xd'),_0x1a0c39,_0x3832('0xb'),JSON[_0x3832('0xe')](_0x10aca6));if(_0x10aca6[_0x3832('0xf')]){if(_0x10aca6[_0x3832('0xf')][_0x3832('0x10')]===0x1f4){logger[_0x3832('0xf')](_0x3832('0xa'),_0x1a0c39,_0x10aca6[_0x3832('0xf')][_0x3832('0x11')]);return _0x1dea18(_0x10aca6[_0x3832('0xf')][_0x3832('0x11')]);}logger[_0x3832('0xf')](_0x3832('0xa'),_0x1a0c39,_0x10aca6[_0x3832('0xf')]['message']);return _0x690f61(_0x10aca6[_0x3832('0xf')][_0x3832('0x11')]);}else{logger[_0x3832('0x12')](_0x3832('0xa'),_0x1a0c39,_0x3832('0xb'));_0x690f61(_0x10aca6[_0x3832('0x13')][_0x3832('0x11')]);}})['catch'](function(_0x5de9a){logger[_0x3832('0xf')](_0x3832('0xa'),_0x1a0c39,_0x5de9a);_0x1dea18(_0x5de9a);});});} \ No newline at end of file +var _0x860d=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','ZohoField,\x20%s,\x20%s'];(function(_0xf04d75,_0x20270b){var _0x3edd32=function(_0x31cda0){while(--_0x31cda0){_0xf04d75['push'](_0xf04d75['shift']());}};_0x3edd32(++_0x20270b);}(_0x860d,0x12e));var _0xd860=function(_0x98225d,_0x76bc17){_0x98225d=_0x98225d-0x0;var _0x176967=_0x860d[_0x98225d];return _0x176967;};'use strict';var _=require('lodash');var util=require(_0xd860('0x0'));var moment=require(_0xd860('0x1'));var BPromise=require(_0xd860('0x2'));var rs=require(_0xd860('0x3'));var fs=require('fs');var Redis=require(_0xd860('0x4'));var db=require(_0xd860('0x5'))['db'];var utils=require(_0xd860('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd860('0x7'));var jayson=require(_0xd860('0x8'));var client=jayson[_0xd860('0x9')][_0xd860('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b2e89,_0x5de355,_0x10a604){return new BPromise(function(_0x33010f,_0x675c89){return client['request'](_0x4b2e89,_0x10a604)['then'](function(_0x280792){logger[_0xd860('0xb')](_0xd860('0xc'),_0x5de355,_0xd860('0xd'));logger[_0xd860('0xe')](_0xd860('0xf'),_0x5de355,_0xd860('0xd'),JSON[_0xd860('0x10')](_0x280792));if(_0x280792[_0xd860('0x11')]){if(_0x280792[_0xd860('0x11')][_0xd860('0x12')]===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x5de355,_0x280792[_0xd860('0x11')][_0xd860('0x13')]);return _0x675c89(_0x280792['error'][_0xd860('0x13')]);}logger[_0xd860('0x11')](_0xd860('0xc'),_0x5de355,_0x280792[_0xd860('0x11')][_0xd860('0x13')]);return _0x33010f(_0x280792[_0xd860('0x11')][_0xd860('0x13')]);}else{logger[_0xd860('0xb')]('ZohoField,\x20%s,\x20%s',_0x5de355,'request\x20sent');_0x33010f(_0x280792['result'][_0xd860('0x13')]);}})[_0xd860('0x14')](function(_0x2c9173){logger[_0xd860('0x11')](_0xd860('0xc'),_0x5de355,_0x2c9173);_0x675c89(_0x2c9173);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index f3fc628..8abcebf 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1c1ee5,_0x5782b0){var _0x5c1acd=function(_0x2972b3){while(--_0x2972b3){_0x1c1ee5['push'](_0x1c1ee5['shift']());}};_0x5c1acd(++_0x5782b0);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x266abd,_0x5a9192){var _0x5d687d=function(_0xec677e){while(--_0xec677e){_0x266abd['push'](_0x266abd['shift']());}};_0x5d687d(++_0x5a9192);}(_0x70e0,0x17b));var _0x070e=function(_0x5c8100,_0x335e2f){_0x5c8100=_0x5c8100-0x0;var _0x436ea3=_0x70e0[_0x5c8100];return _0x436ea3;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 9a99a4a..6d92126 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 _0xe8f0=['STRING','unique_name_and_version','app.js','BOOLEAN','state','sequelize'];(function(_0x26e0d6,_0x30c4ac){var _0xd0777e=function(_0x22c27f){while(--_0x22c27f){_0x26e0d6['push'](_0x26e0d6['shift']());}};_0xd0777e(++_0x30c4ac);}(_0xe8f0,0x83));var _0x0e8f=function(_0x5af2fd,_0x3db6f9){_0x5af2fd=_0x5af2fd-0x0;var _0x17492a=_0xe8f0[_0x5af2fd];return _0x17492a;};'use strict';var Sequelize=require(_0x0e8f('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e8f('0x1')],'allowNull':![],'unique':_0x0e8f('0x2')},'version':{'type':Sequelize[_0x0e8f('0x1')],'allowNull':![],'unique':_0x0e8f('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x0e8f('0x3')},'filename':{'type':Sequelize[_0x0e8f('0x1')]},'path':{'type':Sequelize[_0x0e8f('0x1')]},'type':{'type':Sequelize[_0x0e8f('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x0e8f('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x0e8f('0x1')]},'state':{'type':Sequelize[_0x0e8f('0x1')],'unique':_0x0e8f('0x5')},'description':{'type':Sequelize[_0x0e8f('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0e8f('0x1')]},'link':{'type':Sequelize[_0x0e8f('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x7d3f=['BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x302a46,_0xc5d7cc){var _0x2c4e48=function(_0x55fe4a){while(--_0x55fe4a){_0x302a46['push'](_0x302a46['shift']());}};_0x2c4e48(++_0xc5d7cc);}(_0x7d3f,0xd2));var _0xf7d3=function(_0x2bcd1f,_0x4f1972){_0x2bcd1f=_0x2bcd1f-0x0;var _0x2381ca=_0x7d3f[_0x2bcd1f];return _0x2381ca;};'use strict';var Sequelize=require(_0xf7d3('0x0'));module[_0xf7d3('0x1')]={'name':{'type':Sequelize[_0xf7d3('0x2')],'allowNull':![],'unique':_0xf7d3('0x3')},'version':{'type':Sequelize[_0xf7d3('0x2')],'allowNull':![],'unique':_0xf7d3('0x3')},'main':{'type':Sequelize[_0xf7d3('0x2')],'defaultValue':_0xf7d3('0x4')},'filename':{'type':Sequelize[_0xf7d3('0x2')]},'path':{'type':Sequelize[_0xf7d3('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xf7d3('0x5')]},'active':{'type':Sequelize[_0xf7d3('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xf7d3('0x2')]},'logo':{'type':Sequelize[_0xf7d3('0x2')]},'state':{'type':Sequelize[_0xf7d3('0x2')],'unique':_0xf7d3('0x7')},'description':{'type':Sequelize[_0xf7d3('0x2')]},'title':{'type':Sequelize[_0xf7d3('0x2')]},'remoteUri':{'type':Sequelize[_0xf7d3('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index a9aad64..e96f4ca 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 _0x4888=['lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','Integration','includeAll','include','rows','catch','params','options','create','body','update','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x9a3e0f,_0x2f796d){var _0x3d2a9a=function(_0x3aeb03){while(--_0x3aeb03){_0x9a3e0f['push'](_0x9a3e0f['shift']());}};_0x3d2a9a(++_0x2f796d);}(_0x4888,0x198));var _0x8488=function(_0x4bfb8b,_0x10b39f){_0x4bfb8b=_0x4bfb8b-0x0;var _0x48f13c=_0x4888[_0x4bfb8b];return _0x48f13c;};'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'];function respondWithStatusCode(_0x14462e,_0x3d1f7a){_0x3d1f7a=_0x3d1f7a||0xcc;return function(_0x58f83d){if(_0x58f83d){return _0x14462e['sendStatus'](_0x3d1f7a);}return _0x14462e[_0x8488('0x17')](_0x3d1f7a)['end']();};}function respondWithResult(_0x214083,_0x4e94fc){_0x4e94fc=_0x4e94fc||0xc8;return function(_0x5161a3){if(_0x5161a3){return _0x214083[_0x8488('0x17')](_0x4e94fc)[_0x8488('0x18')](_0x5161a3);}};}function respondWithFilteredResult(_0x5700b,_0x2bcb7c){return function(_0x3b3cfa){if(_0x3b3cfa){var _0x8d3b3d=typeof _0x2bcb7c[_0x8488('0x19')]==='undefined'&&typeof _0x2bcb7c[_0x8488('0x1a')]===_0x8488('0x1b');var _0x3edfe4=_0x3b3cfa[_0x8488('0x1c')];var _0x60ae2f=_0x8d3b3d?0x0:_0x2bcb7c[_0x8488('0x19')];var _0x1aedb1=_0x8d3b3d?_0x3b3cfa[_0x8488('0x1c')]:_0x2bcb7c[_0x8488('0x19')]+_0x2bcb7c[_0x8488('0x1a')];var _0x10bfd6;if(_0x1aedb1>=_0x3edfe4){_0x1aedb1=_0x3edfe4;_0x10bfd6=0xc8;}else{_0x10bfd6=0xce;}_0x5700b[_0x8488('0x17')](_0x10bfd6);return _0x5700b[_0x8488('0x1d')]('Content-Range',_0x60ae2f+'-'+_0x1aedb1+'/'+_0x3edfe4)['json'](_0x3b3cfa);}return null;};}function patchUpdates(_0x340d6b){return function(_0x12d40f){try{jsonpatch[_0x8488('0x1e')](_0x12d40f,_0x340d6b,!![]);}catch(_0x3c9fc2){return BPromise[_0x8488('0x1f')](_0x3c9fc2);}return _0x12d40f[_0x8488('0x20')]();};}function saveUpdates(_0x43b672,_0x3c078c){return function(_0x39dd43){if(_0x39dd43){return _0x39dd43['update'](_0x43b672)[_0x8488('0x21')](function(_0x4e07e1){return _0x4e07e1;});}return null;};}function removeEntity(_0x140b0b,_0x1361a6){return function(_0x290b33){if(_0x290b33){return _0x290b33['destroy']()['then'](function(){_0x140b0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x472624,_0x51fe30){return function(_0x58057a){if(!_0x58057a){_0x472624[_0x8488('0x22')](0x194);}return _0x58057a;};}function handleError(_0x2f350a,_0x2b3c97){_0x2b3c97=_0x2b3c97||0x1f4;return function(_0x6ebee0){logger[_0x8488('0x23')](_0x6ebee0['stack']);if(_0x6ebee0[_0x8488('0x24')]){delete _0x6ebee0[_0x8488('0x24')];}_0x2f350a[_0x8488('0x17')](_0x2b3c97)[_0x8488('0x25')](_0x6ebee0);};}exports[_0x8488('0x26')]=function(_0x27f5cf,_0x2c15ff){var _0x296b6c={},_0x368f9c={},_0x1d9317={'count':0x0,'rows':[]};var _0x888b24=_['map'](db['Integration']['rawAttributes'],function(_0x292fe8){return{'name':_0x292fe8[_0x8488('0x27')],'type':_0x292fe8[_0x8488('0x28')][_0x8488('0x29')]};});_0x368f9c[_0x8488('0x2a')]=_[_0x8488('0x2b')](_0x888b24,'name');_0x368f9c[_0x8488('0x2c')]=_[_0x8488('0x2d')](_0x27f5cf[_0x8488('0x2c')]);_0x368f9c[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x368f9c['model'],_0x368f9c[_0x8488('0x2c')]);_0x296b6c[_0x8488('0x30')]=_['intersection'](_0x368f9c[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x31')]));_0x296b6c[_0x8488('0x30')]=_0x296b6c['attributes'][_0x8488('0x32')]?_0x296b6c[_0x8488('0x30')]:_0x368f9c[_0x8488('0x2a')];if(!_0x27f5cf['query'][_0x8488('0x33')]('nolimit')){_0x296b6c[_0x8488('0x1a')]=qs[_0x8488('0x1a')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x1a')]);_0x296b6c['offset']=qs[_0x8488('0x19')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x19')]);}_0x296b6c['order']=qs[_0x8488('0x34')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x34')]);_0x296b6c[_0x8488('0x35')]=qs[_0x8488('0x2e')](_[_0x8488('0x36')](_0x27f5cf[_0x8488('0x2c')],_0x368f9c[_0x8488('0x2e')]),_0x888b24);if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]){_0x296b6c[_0x8488('0x35')]=_['merge'](_0x296b6c['where'],{'$or':_[_0x8488('0x2b')](_0x888b24,function(_0x36c17a){if(_0x36c17a[_0x8488('0x28')]!==_0x8488('0x38')){var _0x2d9fa1={};_0x2d9fa1[_0x36c17a[_0x8488('0x24')]]={'$like':'%'+_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]+'%'};return _0x2d9fa1;}})});}_0x296b6c=_[_0x8488('0x39')]({},_0x296b6c,_0x27f5cf['options']);var _0xf5a0a0={'where':_0x296b6c[_0x8488('0x35')]};return db[_0x8488('0x3a')]['count'](_0xf5a0a0)[_0x8488('0x21')](function(_0xa50c4b){_0x1d9317[_0x8488('0x1c')]=_0xa50c4b;if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x3b')]){_0x296b6c[_0x8488('0x3c')]=[{'all':!![]}];}return db[_0x8488('0x3a')]['findAll'](_0x296b6c);})[_0x8488('0x21')](function(_0x1c33a1){_0x1d9317[_0x8488('0x3d')]=_0x1c33a1;return _0x1d9317;})['then'](respondWithFilteredResult(_0x2c15ff,_0x296b6c))[_0x8488('0x3e')](handleError(_0x2c15ff,null));};exports['show']=function(_0x40ee7e,_0x34b11b){var _0x5cbd11={'raw':![],'where':{'id':_0x40ee7e[_0x8488('0x3f')]['id']}},_0x22a3f3={};_0x22a3f3[_0x8488('0x2a')]=_[_0x8488('0x2d')](db[_0x8488('0x3a')]['rawAttributes']);_0x22a3f3[_0x8488('0x2c')]=_['keys'](_0x40ee7e[_0x8488('0x2c')]);_0x22a3f3[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],_0x22a3f3[_0x8488('0x2c')]);_0x5cbd11[_0x8488('0x30')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x40ee7e[_0x8488('0x2c')][_0x8488('0x31')]));_0x5cbd11[_0x8488('0x30')]=_0x5cbd11[_0x8488('0x30')][_0x8488('0x32')]?_0x5cbd11[_0x8488('0x30')]:_0x22a3f3[_0x8488('0x2a')];if(_0x40ee7e[_0x8488('0x2c')]['includeAll']){_0x5cbd11[_0x8488('0x3c')]=[{'all':!![]}];}_0x5cbd11=_[_0x8488('0x39')]({},_0x5cbd11,_0x40ee7e[_0x8488('0x40')]);return db[_0x8488('0x3a')]['find'](_0x5cbd11)[_0x8488('0x21')](handleEntityNotFound(_0x34b11b,null))[_0x8488('0x21')](respondWithResult(_0x34b11b,null))[_0x8488('0x3e')](handleError(_0x34b11b,null));};exports[_0x8488('0x41')]=function(_0x52042c,_0x1f0516){return db[_0x8488('0x3a')][_0x8488('0x41')](_0x52042c[_0x8488('0x42')],{})[_0x8488('0x21')](respondWithResult(_0x1f0516,0xc9))[_0x8488('0x3e')](handleError(_0x1f0516,null));};exports[_0x8488('0x43')]=function(_0x299d8e,_0x1bc2e1){if(_0x299d8e[_0x8488('0x42')]['id']){delete _0x299d8e[_0x8488('0x42')]['id'];}return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x299d8e['params']['id']}})['then'](handleEntityNotFound(_0x1bc2e1,null))[_0x8488('0x21')](saveUpdates(_0x299d8e[_0x8488('0x42')],null))[_0x8488('0x21')](respondWithResult(_0x1bc2e1,null))[_0x8488('0x3e')](handleError(_0x1bc2e1,null));};exports[_0x8488('0x45')]=function(_0x22d22c,_0x25f2dc){return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x22d22c['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x25f2dc,null))[_0x8488('0x21')](removeEntity(_0x25f2dc,null))['catch'](handleError(_0x25f2dc,null));}; \ No newline at end of file +var _0x430c=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x57c2f6,_0x1ee1bf){var _0x1cbd95=function(_0x295da4){while(--_0x295da4){_0x57c2f6['push'](_0x57c2f6['shift']());}};_0x1cbd95(++_0x1ee1bf);}(_0x430c,0x1a1));var _0xc430=function(_0x4733d3,_0x454290){_0x4733d3=_0x4733d3-0x0;var _0x1b9a44=_0x430c[_0x4733d3];return _0x1b9a44;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){_0x23425d['status'](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x59c498,_0x3aa85e){return function(_0x4b5280){if(!_0x4b5280){_0x59c498[_0xc430('0x14')](0x194);}return _0x4b5280;};}function handleError(_0x21e28a,_0x50110b){_0x50110b=_0x50110b||0x1f4;return function(_0x33433f){logger[_0xc430('0x20')](_0x33433f[_0xc430('0x21')]);if(_0x33433f[_0xc430('0x22')]){delete _0x33433f[_0xc430('0x22')];}_0x21e28a['status'](_0x50110b)[_0xc430('0x23')](_0x33433f);};}exports[_0xc430('0x24')]=function(_0x1c1da9,_0x1591e3){var _0x542cba={},_0x1f8086={},_0x4cf56c={'count':0x0,'rows':[]};var _0x1d65ee=_['map'](db[_0xc430('0x25')][_0xc430('0x26')],function(_0xfc8767){return{'name':_0xfc8767[_0xc430('0x27')],'type':_0xfc8767['type'][_0xc430('0x28')]};});_0x1f8086[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1d65ee,_0xc430('0x22'));_0x1f8086['query']=_[_0xc430('0x2b')](_0x1c1da9[_0xc430('0x2c')]);_0x1f8086['filters']=_[_0xc430('0x2d')](_0x1f8086['model'],_0x1f8086['query']);_0x542cba[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x1f8086[_0xc430('0x29')],qs[_0xc430('0x2f')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x2f')]));_0x542cba[_0xc430('0x2e')]=_0x542cba[_0xc430('0x2e')]['length']?_0x542cba[_0xc430('0x2e')]:_0x1f8086['model'];if(!_0x1c1da9[_0xc430('0x2c')][_0xc430('0x30')](_0xc430('0x31'))){_0x542cba[_0xc430('0x18')]=qs['limit'](_0x1c1da9[_0xc430('0x2c')]['limit']);_0x542cba['offset']=qs[_0xc430('0x1a')](_0x1c1da9[_0xc430('0x2c')]['offset']);}_0x542cba[_0xc430('0x32')]=qs[_0xc430('0x33')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x33')]);_0x542cba[_0xc430('0x34')]=qs[_0xc430('0x35')](_[_0xc430('0x36')](_0x1c1da9[_0xc430('0x2c')],_0x1f8086[_0xc430('0x35')]),_0x1d65ee);if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x37')]){_0x542cba[_0xc430('0x34')]=_[_0xc430('0x38')](_0x542cba[_0xc430('0x34')],{'$or':_[_0xc430('0x2a')](_0x1d65ee,function(_0x537e4c){if(_0x537e4c[_0xc430('0x39')]!==_0xc430('0x3a')){var _0x24363b={};_0x24363b[_0x537e4c[_0xc430('0x22')]]={'$like':'%'+_0x1c1da9['query'][_0xc430('0x37')]+'%'};return _0x24363b;}})});}_0x542cba=_[_0xc430('0x38')]({},_0x542cba,_0x1c1da9[_0xc430('0x3b')]);var _0x45b3dc={'where':_0x542cba[_0xc430('0x34')]};return db[_0xc430('0x25')]['count'](_0x45b3dc)[_0xc430('0x1e')](function(_0x348f2f){_0x4cf56c[_0xc430('0x1b')]=_0x348f2f;if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x3c')]){_0x542cba[_0xc430('0x3d')]=[{'all':!![]}];}return db[_0xc430('0x25')][_0xc430('0x3e')](_0x542cba);})[_0xc430('0x1e')](function(_0x4174d2){_0x4cf56c[_0xc430('0x3f')]=_0x4174d2;return _0x4cf56c;})[_0xc430('0x1e')](respondWithFilteredResult(_0x1591e3,_0x542cba))[_0xc430('0x40')](handleError(_0x1591e3,null));};exports[_0xc430('0x41')]=function(_0x5a9c4b,_0x47edb0){var _0x4983e0={'raw':![],'where':{'id':_0x5a9c4b[_0xc430('0x42')]['id']}},_0x262063={};_0x262063[_0xc430('0x29')]=_[_0xc430('0x2b')](db[_0xc430('0x25')][_0xc430('0x26')]);_0x262063[_0xc430('0x2c')]=_[_0xc430('0x2b')](_0x5a9c4b[_0xc430('0x2c')]);_0x262063[_0xc430('0x35')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],_0x262063[_0xc430('0x2c')]);_0x4983e0[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],qs['fields'](_0x5a9c4b[_0xc430('0x2c')][_0xc430('0x2f')]));_0x4983e0[_0xc430('0x2e')]=_0x4983e0[_0xc430('0x2e')][_0xc430('0x43')]?_0x4983e0[_0xc430('0x2e')]:_0x262063[_0xc430('0x29')];if(_0x5a9c4b[_0xc430('0x2c')]['includeAll']){_0x4983e0[_0xc430('0x3d')]=[{'all':!![]}];}_0x4983e0=_['merge']({},_0x4983e0,_0x5a9c4b[_0xc430('0x3b')]);return db[_0xc430('0x25')]['find'](_0x4983e0)['then'](handleEntityNotFound(_0x47edb0,null))[_0xc430('0x1e')](respondWithResult(_0x47edb0,null))['catch'](handleError(_0x47edb0,null));};exports['create']=function(_0x10db27,_0x4eafae){return db[_0xc430('0x25')][_0xc430('0x44')](_0x10db27[_0xc430('0x45')],{})['then'](respondWithResult(_0x4eafae,0xc9))[_0xc430('0x40')](handleError(_0x4eafae,null));};exports[_0xc430('0x46')]=function(_0x19e563,_0x549400){if(_0x19e563[_0xc430('0x45')]['id']){delete _0x19e563[_0xc430('0x45')]['id'];}return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x19e563[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x549400,null))[_0xc430('0x1e')](saveUpdates(_0x19e563['body'],null))[_0xc430('0x1e')](respondWithResult(_0x549400,null))[_0xc430('0x40')](handleError(_0x549400,null));};exports[_0xc430('0x1f')]=function(_0x4e9aff,_0x23cb41){return db[_0xc430('0x25')][_0xc430('0x47')]({'where':{'id':_0x4e9aff[_0xc430('0x42')]['id']}})['then'](handleEntityNotFound(_0x23cb41,null))[_0xc430('0x1e')](removeEntity(_0x23cb41,null))['catch'](handleError(_0x23cb41,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 7a80ee2..de957ea 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 _0x0b2d=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./integration.attributes','exports','Integration','integrations','lodash','util'];(function(_0x8b631b,_0x386724){var _0x3e6832=function(_0x17a132){while(--_0x17a132){_0x8b631b['push'](_0x8b631b['shift']());}};_0x3e6832(++_0x386724);}(_0x0b2d,0x10f));var _0xd0b2=function(_0x48d408,_0x3e8283){_0x48d408=_0x48d408-0x0;var _0x4dd39a=_0x0b2d[_0x48d408];return _0x4dd39a;};'use strict';var _=require(_0xd0b2('0x0'));var util=require(_0xd0b2('0x1'));var logger=require(_0xd0b2('0x2'))(_0xd0b2('0x3'));var moment=require(_0xd0b2('0x4'));var BPromise=require(_0xd0b2('0x5'));var rp=require(_0xd0b2('0x6'));var fs=require('fs');var path=require(_0xd0b2('0x7'));var rimraf=require('rimraf');var config=require(_0xd0b2('0x8'));var attributes=require(_0xd0b2('0x9'));module[_0xd0b2('0xa')]=function(_0xc1d120,_0x5a6d6b){return _0xc1d120['define'](_0xd0b2('0xb'),attributes,{'tableName':_0xd0b2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3fea=['./integration.attributes','exports','define','Integration','integrations','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5ddaf9,_0x3f96cd){var _0x314feb=function(_0x4148cf){while(--_0x4148cf){_0x5ddaf9['push'](_0x5ddaf9['shift']());}};_0x314feb(++_0x3f96cd);}(_0x3fea,0x155));var _0xa3fe=function(_0x37afde,_0x3b70dd){_0x37afde=_0x37afde-0x0;var _0x242a21=_0x3fea[_0x37afde];return _0x242a21;};'use strict';var _=require(_0xa3fe('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa3fe('0x1'));var moment=require(_0xa3fe('0x2'));var BPromise=require(_0xa3fe('0x3'));var rp=require(_0xa3fe('0x4'));var fs=require('fs');var path=require(_0xa3fe('0x5'));var rimraf=require(_0xa3fe('0x6'));var config=require('../../config/environment');var attributes=require(_0xa3fe('0x7'));module[_0xa3fe('0x8')]=function(_0xcf0037,_0x2b10a7){return _0xcf0037[_0xa3fe('0x9')](_0xa3fe('0xa'),attributes,{'tableName':_0xa3fe('0xb'),'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 8cb35c3..41868b6 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 _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x4137,0xf8));var _0x7413=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4137[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('Integration,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file +var _0x0b0e=['Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','debug'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4c2c23,_0x3d8d28){_0x4c2c23=_0x4c2c23-0x0;var _0x5c992e=_0x0b0e[_0x4c2c23];return _0x5c992e;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('Integration,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 006d369..bf2c8bb 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 _0xef0f=['update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x62b062,_0x3edb10){var _0x235f9e=function(_0x2f757e){while(--_0x2f757e){_0x62b062['push'](_0x62b062['shift']());}};_0x235f9e(++_0x3edb10);}(_0xef0f,0x168));var _0xfef0=function(_0x17376f,_0x2c8ae6){_0x17376f=_0x17376f-0x0;var _0x432c95=_0xef0f[_0x17376f];return _0x432c95;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var fs_extra=require(_0xfef0('0x4'));var auth=require(_0xfef0('0x5'));var interaction=require(_0xfef0('0x6'));var config=require('../../config/environment');var controller=require(_0xfef0('0x7'));router[_0xfef0('0x8')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0x8')](_0xfef0('0xb'),auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router['get'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xe')]);router[_0xfef0('0xf')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x11')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x12')]);router[_0xfef0('0x13')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x14')]);module['exports']=router; \ No newline at end of file +var _0x2542=['put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x2e18fa,_0x50b25c){var _0x2e8e9d=function(_0xc71508){while(--_0xc71508){_0x2e18fa['push'](_0x2e18fa['shift']());}};_0x2e8e9d(++_0x50b25c);}(_0x2542,0x169));var _0x2254=function(_0x16f284,_0x59d8a3){_0x16f284=_0x16f284-0x0;var _0x3fd4a7=_0x2542[_0x16f284];return _0x3fd4a7;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x10')]('/',auth[_0x2254('0xc')](),controller['create']);router[_0x2254('0x11')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0x12')]);router['delete']('/:id',auth[_0x2254('0xc')](),controller[_0x2254('0x13')]);module[_0x2254('0x14')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index e999228..575b81c 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 _0xbc24=['sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xbc24,0xb0));var _0x4bc2=function(_0x225ef0,_0x2d412e){_0x225ef0=_0x225ef0-0x0;var _0x3b194f=_0xbc24[_0x225ef0];return _0x3b194f;};'use strict';var Sequelize=require(_0x4bc2('0x0'));module[_0x4bc2('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x4bc2('0x2')]},'exitStatus':{'type':Sequelize[_0x4bc2('0x2')]},'ticketId':{'type':Sequelize[_0x4bc2('0x2')]},'integrationId':{'type':Sequelize[_0x4bc2('0x3')]},'contacts':{'type':Sequelize[_0x4bc2('0x2')]},'uniqueid':{'type':Sequelize[_0x4bc2('0x2')]},'calleridnum':{'type':Sequelize[_0x4bc2('0x2')]},'calleridname':{'type':Sequelize[_0x4bc2('0x2')]},'queue':{'type':Sequelize[_0x4bc2('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x4bc2('0x4')]},'holdtime':{'type':Sequelize[_0x4bc2('0x3')]},'agentcomplete':{'type':Sequelize[_0x4bc2('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x4bc2('0x3')]},'agentacw':{'type':Sequelize[_0x4bc2('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4bc2('0x3')]},'reason':{'type':Sequelize[_0x4bc2('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x4bc2('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x4bc2('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4bc2('0x4')]},'lastevent':{'type':Sequelize[_0x4bc2('0x2')]},'channel':{'type':Sequelize[_0x4bc2('0x2')]},'channelstate':{'type':Sequelize[_0x4bc2('0x3')]},'channelstatedesc':{'type':Sequelize[_0x4bc2('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4bc2('0x2')]},'connectedlinename':{'type':Sequelize[_0x4bc2('0x2')]},'language':{'type':Sequelize[_0x4bc2('0x2')]},'accountcode':{'type':Sequelize[_0x4bc2('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4bc2('0x2')]},'priority':{'type':Sequelize[_0x4bc2('0x2')]},'destchannel':{'type':Sequelize[_0x4bc2('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x4bc2('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4bc2('0x2')]},'destcalleridname':{'type':Sequelize[_0x4bc2('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4bc2('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4bc2('0x2')]},'destlanguage':{'type':Sequelize[_0x4bc2('0x2')]},'destaccountcode':{'type':Sequelize[_0x4bc2('0x2')]},'destcontext':{'type':Sequelize[_0x4bc2('0x2')]},'destexten':{'type':Sequelize[_0x4bc2('0x2')]},'destpriority':{'type':Sequelize[_0x4bc2('0x2')]},'destuniqueid':{'type':Sequelize[_0x4bc2('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x4bc2('0x2')]},'from':{'type':Sequelize[_0x4bc2('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x4bc2('0x2')]},'attachment':{'type':Sequelize[_0x4bc2('0x6')]},'html':{'type':Sequelize[_0x4bc2('0x6')]},'text':{'type':Sequelize[_0x4bc2('0x6')]},'status':{'type':Sequelize[_0x4bc2('0x7')](_0x4bc2('0x8'),_0x4bc2('0x9'),_0x4bc2('0xa'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x4bc2('0x2')]},'appdata':{'type':Sequelize[_0x4bc2('0x2')]},'projectId':{'type':Sequelize[_0x4bc2('0x3')]}}; \ No newline at end of file +var _0x233b=['BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','STRING','INTEGER','DATE'];(function(_0x4bedc0,_0x702461){var _0x5a3cb4=function(_0x51cc1e){while(--_0x51cc1e){_0x4bedc0['push'](_0x4bedc0['shift']());}};_0x5a3cb4(++_0x702461);}(_0x233b,0x19e));var _0xb233=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x233b[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0xb233('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xb233('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xb233('0x2')]},'contacts':{'type':Sequelize[_0xb233('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb233('0x1')]},'calleridname':{'type':Sequelize[_0xb233('0x1')]},'queue':{'type':Sequelize[_0xb233('0x1')]},'interface':{'type':Sequelize[_0xb233('0x1')]},'membername':{'type':Sequelize[_0xb233('0x1')]},'agentcalledAt':{'type':Sequelize[_0xb233('0x3')]},'agentconnectAt':{'type':Sequelize[_0xb233('0x3')]},'holdtime':{'type':Sequelize[_0xb233('0x2')]},'agentcomplete':{'type':Sequelize[_0xb233('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xb233('0x3')]},'talktime':{'type':Sequelize[_0xb233('0x2')]},'agentacw':{'type':Sequelize[_0xb233('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb233('0x2')]},'reason':{'type':Sequelize[_0xb233('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xb233('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xb233('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xb233('0x3')]},'lastevent':{'type':Sequelize[_0xb233('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb233('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xb233('0x1')]},'connectedlinename':{'type':Sequelize[_0xb233('0x1')]},'language':{'type':Sequelize[_0xb233('0x1')]},'accountcode':{'type':Sequelize[_0xb233('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb233('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb233('0x1')]},'destchannelstate':{'type':Sequelize[_0xb233('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xb233('0x1')]},'destcalleridnum':{'type':Sequelize[_0xb233('0x1')]},'destcalleridname':{'type':Sequelize[_0xb233('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xb233('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xb233('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xb233('0x1')]},'destpriority':{'type':Sequelize[_0xb233('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xb233('0x1')]},'inReplyTo':{'type':Sequelize[_0xb233('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xb233('0x1')]},'cc':{'type':Sequelize[_0xb233('0x1')]},'attachment':{'type':Sequelize[_0xb233('0x5')]},'html':{'type':Sequelize[_0xb233('0x5')]},'text':{'type':Sequelize[_0xb233('0x5')]},'status':{'type':Sequelize[_0xb233('0x6')](_0xb233('0x7'),_0xb233('0x8'),_0xb233('0x9'),_0xb233('0xa'))},'url':{'type':Sequelize[_0xb233('0x1')]},'app':{'type':Sequelize[_0xb233('0x1')]},'appdata':{'type':Sequelize[_0xb233('0x1')]},'projectId':{'type':Sequelize[_0xb233('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 9338f4c..63f5216 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 _0xb3d5=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','sendStatus','name','send','index','IntegrationReport','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x16c7f0,_0x343576){var _0x4da7a3=function(_0xc01854){while(--_0xc01854){_0x16c7f0['push'](_0x16c7f0['shift']());}};_0x4da7a3(++_0x343576);}(_0xb3d5,0xdc));var _0x5b3d=function(_0x58a224,_0x936cce){_0x58a224=_0x58a224-0x0;var _0x1aa02d=_0xb3d5[_0x58a224];return _0x1aa02d;};'use strict';var emlformat=require(_0x5b3d('0x0'));var rimraf=require(_0x5b3d('0x1'));var zipdir=require(_0x5b3d('0x2'));var jsonpatch=require(_0x5b3d('0x3'));var rp=require(_0x5b3d('0x4'));var moment=require(_0x5b3d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5b3d('0x6'));var util=require(_0x5b3d('0x7'));var path=require(_0x5b3d('0x8'));var sox=require(_0x5b3d('0x9'));var csv=require(_0x5b3d('0xa'));var ejs=require(_0x5b3d('0xb'));var fs=require('fs');var fs_extra=require(_0x5b3d('0xc'));var _=require(_0x5b3d('0xd'));var squel=require(_0x5b3d('0xe'));var crypto=require('crypto');var jsforce=require(_0x5b3d('0xf'));var deskjs=require(_0x5b3d('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5b3d('0x11'));var Papa=require(_0x5b3d('0x12'));var Redis=require('ioredis');var authService=require(_0x5b3d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x5b3d('0x14'));var hardwareService=require(_0x5b3d('0x15'));var logger=require(_0x5b3d('0x16'))(_0x5b3d('0x17'));var utils=require('../../config/utils');var config=require(_0x5b3d('0x18'));var licenseUtil=require(_0x5b3d('0x19'));var db=require(_0x5b3d('0x1a'))['db'];function respondWithStatusCode(_0x6b66f2,_0x126c77){_0x126c77=_0x126c77||0xcc;return function(_0x385f0e){if(_0x385f0e){return _0x6b66f2['sendStatus'](_0x126c77);}return _0x6b66f2[_0x5b3d('0x1b')](_0x126c77)[_0x5b3d('0x1c')]();};}function respondWithResult(_0x1ccad6,_0xd57934){_0xd57934=_0xd57934||0xc8;return function(_0x9c932a){if(_0x9c932a){return _0x1ccad6[_0x5b3d('0x1b')](_0xd57934)[_0x5b3d('0x1d')](_0x9c932a);}};}function respondWithFilteredResult(_0x478347,_0x123a57){return function(_0xe6c67c){if(_0xe6c67c){var _0x782ac5=typeof _0x123a57['offset']===_0x5b3d('0x1e')&&typeof _0x123a57[_0x5b3d('0x1f')]===_0x5b3d('0x1e');var _0x13f0bb=_0xe6c67c[_0x5b3d('0x20')];var _0x10a041=_0x782ac5?0x0:_0x123a57[_0x5b3d('0x21')];var _0xefcaf=_0x782ac5?_0xe6c67c['count']:_0x123a57['offset']+_0x123a57['limit'];var _0x3eacbe;if(_0xefcaf>=_0x13f0bb){_0xefcaf=_0x13f0bb;_0x3eacbe=0xc8;}else{_0x3eacbe=0xce;}_0x478347[_0x5b3d('0x1b')](_0x3eacbe);return _0x478347[_0x5b3d('0x22')](_0x5b3d('0x23'),_0x10a041+'-'+_0xefcaf+'/'+_0x13f0bb)['json'](_0xe6c67c);}return null;};}function patchUpdates(_0x2fe5db){return function(_0x41e5d6){try{jsonpatch['apply'](_0x41e5d6,_0x2fe5db,!![]);}catch(_0x4a1b9b){return BPromise[_0x5b3d('0x24')](_0x4a1b9b);}return _0x41e5d6['save']();};}function saveUpdates(_0x322a6f,_0x3bf78c){return function(_0xbe2ff8){if(_0xbe2ff8){return _0xbe2ff8[_0x5b3d('0x25')](_0x322a6f)[_0x5b3d('0x26')](function(_0x255103){return _0x255103;});}return null;};}function removeEntity(_0xe9c072,_0x35ab23){return function(_0x44887d){if(_0x44887d){return _0x44887d[_0x5b3d('0x27')]()[_0x5b3d('0x26')](function(){_0xe9c072['status'](0xcc)[_0x5b3d('0x1c')]();});}};}function handleEntityNotFound(_0x488c12,_0x3c0d6c){return function(_0x1093a0){if(!_0x1093a0){_0x488c12[_0x5b3d('0x28')](0x194);}return _0x1093a0;};}function handleError(_0x27a4d7,_0x5a5c51){_0x5a5c51=_0x5a5c51||0x1f4;return function(_0xb3c48b){logger['error'](_0xb3c48b['stack']);if(_0xb3c48b[_0x5b3d('0x29')]){delete _0xb3c48b[_0x5b3d('0x29')];}_0x27a4d7[_0x5b3d('0x1b')](_0x5a5c51)[_0x5b3d('0x2a')](_0xb3c48b);};}exports[_0x5b3d('0x2b')]=function(_0x164fa7,_0x2b85af){var _0x21a601={},_0x3e2963={},_0x54ca8f={'count':0x0,'rows':[]};var _0x560ac8=_['map'](db[_0x5b3d('0x2c')][_0x5b3d('0x2d')],function(_0x2a185e){return{'name':_0x2a185e['fieldName'],'type':_0x2a185e[_0x5b3d('0x2e')][_0x5b3d('0x2f')]};});_0x3e2963[_0x5b3d('0x30')]=_[_0x5b3d('0x31')](_0x560ac8,_0x5b3d('0x29'));_0x3e2963[_0x5b3d('0x32')]=_[_0x5b3d('0x33')](_0x164fa7[_0x5b3d('0x32')]);_0x3e2963['filters']=_[_0x5b3d('0x34')](_0x3e2963['model'],_0x3e2963[_0x5b3d('0x32')]);_0x21a601[_0x5b3d('0x35')]=_[_0x5b3d('0x34')](_0x3e2963['model'],qs[_0x5b3d('0x36')](_0x164fa7[_0x5b3d('0x32')][_0x5b3d('0x36')]));_0x21a601[_0x5b3d('0x35')]=_0x21a601[_0x5b3d('0x35')][_0x5b3d('0x37')]?_0x21a601[_0x5b3d('0x35')]:_0x3e2963[_0x5b3d('0x30')];if(!_0x164fa7['query'][_0x5b3d('0x38')](_0x5b3d('0x39'))){_0x21a601[_0x5b3d('0x1f')]=qs['limit'](_0x164fa7[_0x5b3d('0x32')][_0x5b3d('0x1f')]);_0x21a601[_0x5b3d('0x21')]=qs[_0x5b3d('0x21')](_0x164fa7[_0x5b3d('0x32')]['offset']);}_0x21a601[_0x5b3d('0x3a')]=qs['sort'](_0x164fa7[_0x5b3d('0x32')]['sort']);_0x21a601[_0x5b3d('0x3b')]=qs[_0x5b3d('0x3c')](_[_0x5b3d('0x3d')](_0x164fa7[_0x5b3d('0x32')],_0x3e2963[_0x5b3d('0x3c')]),_0x560ac8);if(_0x164fa7[_0x5b3d('0x32')][_0x5b3d('0x3e')]){_0x21a601[_0x5b3d('0x3b')]=_['merge'](_0x21a601[_0x5b3d('0x3b')],{'$or':_[_0x5b3d('0x31')](_0x560ac8,function(_0x26b836){if(_0x26b836[_0x5b3d('0x2e')]!==_0x5b3d('0x3f')){var _0x1735c8={};_0x1735c8[_0x26b836[_0x5b3d('0x29')]]={'$like':'%'+_0x164fa7[_0x5b3d('0x32')][_0x5b3d('0x3e')]+'%'};return _0x1735c8;}})});}_0x21a601=_[_0x5b3d('0x40')]({},_0x21a601,_0x164fa7[_0x5b3d('0x41')]);var _0x1aae3b={'where':_0x21a601['where']};return db[_0x5b3d('0x2c')][_0x5b3d('0x20')](_0x1aae3b)[_0x5b3d('0x26')](function(_0x33f90f){_0x54ca8f[_0x5b3d('0x20')]=_0x33f90f;if(_0x164fa7[_0x5b3d('0x32')][_0x5b3d('0x42')]){_0x21a601[_0x5b3d('0x43')]=[{'all':!![]}];}return db[_0x5b3d('0x2c')][_0x5b3d('0x44')](_0x21a601);})['then'](function(_0x251a50){_0x54ca8f[_0x5b3d('0x45')]=_0x251a50;return _0x54ca8f;})[_0x5b3d('0x26')](respondWithFilteredResult(_0x2b85af,_0x21a601))[_0x5b3d('0x46')](handleError(_0x2b85af,null));};exports[_0x5b3d('0x47')]=function(_0x239339,_0x301150){var _0x473dcc={'raw':![],'where':{'id':_0x239339[_0x5b3d('0x48')]['id']}},_0x5ca3ec={};_0x5ca3ec[_0x5b3d('0x30')]=_[_0x5b3d('0x33')](db['IntegrationReport'][_0x5b3d('0x2d')]);_0x5ca3ec[_0x5b3d('0x32')]=_[_0x5b3d('0x33')](_0x239339[_0x5b3d('0x32')]);_0x5ca3ec['filters']=_['intersection'](_0x5ca3ec[_0x5b3d('0x30')],_0x5ca3ec['query']);_0x473dcc[_0x5b3d('0x35')]=_[_0x5b3d('0x34')](_0x5ca3ec[_0x5b3d('0x30')],qs[_0x5b3d('0x36')](_0x239339[_0x5b3d('0x32')][_0x5b3d('0x36')]));_0x473dcc[_0x5b3d('0x35')]=_0x473dcc[_0x5b3d('0x35')][_0x5b3d('0x37')]?_0x473dcc[_0x5b3d('0x35')]:_0x5ca3ec[_0x5b3d('0x30')];if(_0x239339[_0x5b3d('0x32')][_0x5b3d('0x42')]){_0x473dcc[_0x5b3d('0x43')]=[{'all':!![]}];}_0x473dcc=_[_0x5b3d('0x40')]({},_0x473dcc,_0x239339[_0x5b3d('0x41')]);return db[_0x5b3d('0x2c')][_0x5b3d('0x49')](_0x473dcc)[_0x5b3d('0x26')](handleEntityNotFound(_0x301150,null))[_0x5b3d('0x26')](respondWithResult(_0x301150,null))[_0x5b3d('0x46')](handleError(_0x301150,null));};exports[_0x5b3d('0x4a')]=function(_0x18384a,_0x442830){return db['IntegrationReport'][_0x5b3d('0x4a')](_0x18384a['body'],{})[_0x5b3d('0x26')](respondWithResult(_0x442830,0xc9))[_0x5b3d('0x46')](handleError(_0x442830,null));};exports[_0x5b3d('0x25')]=function(_0xd37276,_0x327cc2){if(_0xd37276['body']['id']){delete _0xd37276[_0x5b3d('0x4b')]['id'];}return db[_0x5b3d('0x2c')][_0x5b3d('0x49')]({'where':{'id':_0xd37276[_0x5b3d('0x48')]['id']}})[_0x5b3d('0x26')](handleEntityNotFound(_0x327cc2,null))[_0x5b3d('0x26')](saveUpdates(_0xd37276[_0x5b3d('0x4b')],null))['then'](respondWithResult(_0x327cc2,null))[_0x5b3d('0x46')](handleError(_0x327cc2,null));};exports[_0x5b3d('0x27')]=function(_0x388948,_0x1bed86){return db[_0x5b3d('0x2c')]['find']({'where':{'id':_0x388948[_0x5b3d('0x48')]['id']}})[_0x5b3d('0x26')](handleEntityNotFound(_0x1bed86,null))['then'](removeEntity(_0x1bed86,null))[_0x5b3d('0x46')](handleError(_0x1bed86,null));};exports[_0x5b3d('0x4c')]=function(_0x1dd2f6,_0x3a191d){return db[_0x5b3d('0x2c')]['describe']()['then'](respondWithResult(_0x3a191d,null))['catch'](handleError(_0x3a191d,null));}; \ No newline at end of file +var _0x2ca9=['include','IntegrationReport','findAll','rows','show','find','create','body','catch','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll'];(function(_0x2b7406,_0x1e8b65){var _0x1c4e3b=function(_0x1c9fea){while(--_0x1c9fea){_0x2b7406['push'](_0x2b7406['shift']());}};_0x1c4e3b(++_0x1e8b65);}(_0x2ca9,0x188));var _0x92ca=function(_0x1a6445,_0x1efe69){_0x1a6445=_0x1a6445-0x0;var _0x2d2f42=_0x2ca9[_0x1a6445];return _0x2d2f42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x92ca('0x0'));var zipdir=require(_0x92ca('0x1'));var jsonpatch=require(_0x92ca('0x2'));var rp=require(_0x92ca('0x3'));var moment=require(_0x92ca('0x4'));var BPromise=require(_0x92ca('0x5'));var Mustache=require('mustache');var util=require(_0x92ca('0x6'));var path=require('path');var sox=require(_0x92ca('0x7'));var csv=require(_0x92ca('0x8'));var ejs=require(_0x92ca('0x9'));var fs=require('fs');var fs_extra=require(_0x92ca('0xa'));var _=require(_0x92ca('0xb'));var squel=require(_0x92ca('0xc'));var crypto=require(_0x92ca('0xd'));var jsforce=require(_0x92ca('0xe'));var deskjs=require(_0x92ca('0xf'));var toCsv=require(_0x92ca('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x92ca('0x10'));var qs=require(_0x92ca('0x11'));var as=require(_0x92ca('0x12'));var hardwareService=require(_0x92ca('0x13'));var logger=require(_0x92ca('0x14'))(_0x92ca('0x15'));var utils=require(_0x92ca('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x92ca('0x17'))['db'];function respondWithStatusCode(_0x2389e8,_0x3f1e93){_0x3f1e93=_0x3f1e93||0xcc;return function(_0x13a151){if(_0x13a151){return _0x2389e8['sendStatus'](_0x3f1e93);}return _0x2389e8[_0x92ca('0x18')](_0x3f1e93)[_0x92ca('0x19')]();};}function respondWithResult(_0x1692b3,_0xfe8a9b){_0xfe8a9b=_0xfe8a9b||0xc8;return function(_0x1788e8){if(_0x1788e8){return _0x1692b3[_0x92ca('0x18')](_0xfe8a9b)['json'](_0x1788e8);}};}function respondWithFilteredResult(_0x108f42,_0x1ac8a2){return function(_0x2d1950){if(_0x2d1950){var _0x213bfd=typeof _0x1ac8a2[_0x92ca('0x1a')]===_0x92ca('0x1b')&&typeof _0x1ac8a2[_0x92ca('0x1c')]===_0x92ca('0x1b');var _0x287524=_0x2d1950[_0x92ca('0x1d')];var _0x2bb486=_0x213bfd?0x0:_0x1ac8a2[_0x92ca('0x1a')];var _0x3e90e5=_0x213bfd?_0x2d1950[_0x92ca('0x1d')]:_0x1ac8a2[_0x92ca('0x1a')]+_0x1ac8a2['limit'];var _0x44be9e;if(_0x3e90e5>=_0x287524){_0x3e90e5=_0x287524;_0x44be9e=0xc8;}else{_0x44be9e=0xce;}_0x108f42['status'](_0x44be9e);return _0x108f42[_0x92ca('0x1e')]('Content-Range',_0x2bb486+'-'+_0x3e90e5+'/'+_0x287524)[_0x92ca('0x1f')](_0x2d1950);}return null;};}function patchUpdates(_0x343e62){return function(_0x1f1f5e){try{jsonpatch[_0x92ca('0x20')](_0x1f1f5e,_0x343e62,!![]);}catch(_0x13d8a1){return BPromise[_0x92ca('0x21')](_0x13d8a1);}return _0x1f1f5e[_0x92ca('0x22')]();};}function saveUpdates(_0x54d1fa,_0x5a9ffb){return function(_0x19731e){if(_0x19731e){return _0x19731e[_0x92ca('0x23')](_0x54d1fa)[_0x92ca('0x24')](function(_0x252b2d){return _0x252b2d;});}return null;};}function removeEntity(_0x281103,_0x5cbfec){return function(_0x44ffb5){if(_0x44ffb5){return _0x44ffb5['destroy']()[_0x92ca('0x24')](function(){_0x281103[_0x92ca('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2021cf,_0x3deda2){return function(_0x8e4267){if(!_0x8e4267){_0x2021cf['sendStatus'](0x194);}return _0x8e4267;};}function handleError(_0x4b121b,_0xb4dfa2){_0xb4dfa2=_0xb4dfa2||0x1f4;return function(_0x74d22a){logger[_0x92ca('0x25')](_0x74d22a[_0x92ca('0x26')]);if(_0x74d22a[_0x92ca('0x27')]){delete _0x74d22a[_0x92ca('0x27')];}_0x4b121b[_0x92ca('0x18')](_0xb4dfa2)['send'](_0x74d22a);};}exports[_0x92ca('0x28')]=function(_0x5284ec,_0x17d2b7){var _0x483f76={},_0x171f00={},_0x2178f3={'count':0x0,'rows':[]};var _0x1af936=_[_0x92ca('0x29')](db['IntegrationReport'][_0x92ca('0x2a')],function(_0x53359f){return{'name':_0x53359f[_0x92ca('0x2b')],'type':_0x53359f[_0x92ca('0x2c')][_0x92ca('0x2d')]};});_0x171f00[_0x92ca('0x2e')]=_[_0x92ca('0x29')](_0x1af936,_0x92ca('0x27'));_0x171f00['query']=_[_0x92ca('0x2f')](_0x5284ec[_0x92ca('0x30')]);_0x171f00[_0x92ca('0x31')]=_[_0x92ca('0x32')](_0x171f00[_0x92ca('0x2e')],_0x171f00[_0x92ca('0x30')]);_0x483f76[_0x92ca('0x33')]=_[_0x92ca('0x32')](_0x171f00[_0x92ca('0x2e')],qs[_0x92ca('0x34')](_0x5284ec[_0x92ca('0x30')][_0x92ca('0x34')]));_0x483f76[_0x92ca('0x33')]=_0x483f76['attributes'][_0x92ca('0x35')]?_0x483f76[_0x92ca('0x33')]:_0x171f00[_0x92ca('0x2e')];if(!_0x5284ec[_0x92ca('0x30')][_0x92ca('0x36')](_0x92ca('0x37'))){_0x483f76[_0x92ca('0x1c')]=qs[_0x92ca('0x1c')](_0x5284ec[_0x92ca('0x30')][_0x92ca('0x1c')]);_0x483f76['offset']=qs['offset'](_0x5284ec['query'][_0x92ca('0x1a')]);}_0x483f76[_0x92ca('0x38')]=qs[_0x92ca('0x39')](_0x5284ec[_0x92ca('0x30')][_0x92ca('0x39')]);_0x483f76[_0x92ca('0x3a')]=qs[_0x92ca('0x31')](_[_0x92ca('0x3b')](_0x5284ec[_0x92ca('0x30')],_0x171f00['filters']),_0x1af936);if(_0x5284ec[_0x92ca('0x30')]['filter']){_0x483f76[_0x92ca('0x3a')]=_[_0x92ca('0x3c')](_0x483f76['where'],{'$or':_[_0x92ca('0x29')](_0x1af936,function(_0x5085c3){if(_0x5085c3['type']!=='VIRTUAL'){var _0x31c772={};_0x31c772[_0x5085c3[_0x92ca('0x27')]]={'$like':'%'+_0x5284ec['query'][_0x92ca('0x3d')]+'%'};return _0x31c772;}})});}_0x483f76=_[_0x92ca('0x3c')]({},_0x483f76,_0x5284ec[_0x92ca('0x3e')]);var _0x310e4d={'where':_0x483f76['where']};return db['IntegrationReport'][_0x92ca('0x1d')](_0x310e4d)['then'](function(_0x4b3c8d){_0x2178f3['count']=_0x4b3c8d;if(_0x5284ec['query'][_0x92ca('0x3f')]){_0x483f76[_0x92ca('0x40')]=[{'all':!![]}];}return db[_0x92ca('0x41')][_0x92ca('0x42')](_0x483f76);})[_0x92ca('0x24')](function(_0x4b9cea){_0x2178f3[_0x92ca('0x43')]=_0x4b9cea;return _0x2178f3;})[_0x92ca('0x24')](respondWithFilteredResult(_0x17d2b7,_0x483f76))['catch'](handleError(_0x17d2b7,null));};exports[_0x92ca('0x44')]=function(_0x4b4c36,_0x1ed1b5){var _0x1e9b39={'raw':![],'where':{'id':_0x4b4c36['params']['id']}},_0x4633bb={};_0x4633bb[_0x92ca('0x2e')]=_[_0x92ca('0x2f')](db['IntegrationReport']['rawAttributes']);_0x4633bb[_0x92ca('0x30')]=_['keys'](_0x4b4c36[_0x92ca('0x30')]);_0x4633bb['filters']=_[_0x92ca('0x32')](_0x4633bb[_0x92ca('0x2e')],_0x4633bb['query']);_0x1e9b39['attributes']=_[_0x92ca('0x32')](_0x4633bb['model'],qs[_0x92ca('0x34')](_0x4b4c36[_0x92ca('0x30')][_0x92ca('0x34')]));_0x1e9b39[_0x92ca('0x33')]=_0x1e9b39['attributes'][_0x92ca('0x35')]?_0x1e9b39[_0x92ca('0x33')]:_0x4633bb[_0x92ca('0x2e')];if(_0x4b4c36['query']['includeAll']){_0x1e9b39[_0x92ca('0x40')]=[{'all':!![]}];}_0x1e9b39=_[_0x92ca('0x3c')]({},_0x1e9b39,_0x4b4c36[_0x92ca('0x3e')]);return db[_0x92ca('0x41')][_0x92ca('0x45')](_0x1e9b39)[_0x92ca('0x24')](handleEntityNotFound(_0x1ed1b5,null))['then'](respondWithResult(_0x1ed1b5,null))['catch'](handleError(_0x1ed1b5,null));};exports[_0x92ca('0x46')]=function(_0x45658b,_0x663316){return db[_0x92ca('0x41')][_0x92ca('0x46')](_0x45658b[_0x92ca('0x47')],{})['then'](respondWithResult(_0x663316,0xc9))[_0x92ca('0x48')](handleError(_0x663316,null));};exports['update']=function(_0x48aebc,_0x30db46){if(_0x48aebc[_0x92ca('0x47')]['id']){delete _0x48aebc[_0x92ca('0x47')]['id'];}return db[_0x92ca('0x41')][_0x92ca('0x45')]({'where':{'id':_0x48aebc[_0x92ca('0x49')]['id']}})[_0x92ca('0x24')](handleEntityNotFound(_0x30db46,null))[_0x92ca('0x24')](saveUpdates(_0x48aebc['body'],null))[_0x92ca('0x24')](respondWithResult(_0x30db46,null))[_0x92ca('0x48')](handleError(_0x30db46,null));};exports[_0x92ca('0x4a')]=function(_0x52c2e3,_0x24fd69){return db['IntegrationReport'][_0x92ca('0x45')]({'where':{'id':_0x52c2e3[_0x92ca('0x49')]['id']}})[_0x92ca('0x24')](handleEntityNotFound(_0x24fd69,null))['then'](removeEntity(_0x24fd69,null))[_0x92ca('0x48')](handleError(_0x24fd69,null));};exports['describe']=function(_0x5c0a14,_0x287a81){return db[_0x92ca('0x41')][_0x92ca('0x4b')]()[_0x92ca('0x24')](respondWithResult(_0x287a81,null))['catch'](handleError(_0x287a81,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index b002821..6252d08 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 _0xbb93=['report_integration','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport'];(function(_0x356e8d,_0x24c719){var _0x39e65a=function(_0x27ecc2){while(--_0x27ecc2){_0x356e8d['push'](_0x356e8d['shift']());}};_0x39e65a(++_0x24c719);}(_0xbb93,0xb7));var _0x3bb9=function(_0x542341,_0x17a327){_0x542341=_0x542341-0x0;var _0x3078d3=_0xbb93[_0x542341];return _0x3078d3;};'use strict';var _=require('lodash');var util=require(_0x3bb9('0x0'));var logger=require(_0x3bb9('0x1'))(_0x3bb9('0x2'));var moment=require(_0x3bb9('0x3'));var BPromise=require(_0x3bb9('0x4'));var rp=require(_0x3bb9('0x5'));var fs=require('fs');var path=require(_0x3bb9('0x6'));var rimraf=require(_0x3bb9('0x7'));var config=require(_0x3bb9('0x8'));var attributes=require(_0x3bb9('0x9'));module[_0x3bb9('0xa')]=function(_0x968d4,_0xc9f237){return _0x968d4[_0x3bb9('0xb')](_0x3bb9('0xc'),attributes,{'tableName':_0x3bb9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd044=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','IntegrationReport','report_integration','lodash'];(function(_0x3f54f5,_0x402d82){var _0x58d838=function(_0x5c720e){while(--_0x5c720e){_0x3f54f5['push'](_0x3f54f5['shift']());}};_0x58d838(++_0x402d82);}(_0xd044,0x185));var _0x4d04=function(_0x2a12c1,_0x20dd3d){_0x2a12c1=_0x2a12c1-0x0;var _0xd296c4=_0xd044[_0x2a12c1];return _0xd296c4;};'use strict';var _=require(_0x4d04('0x0'));var util=require(_0x4d04('0x1'));var logger=require(_0x4d04('0x2'))(_0x4d04('0x3'));var moment=require(_0x4d04('0x4'));var BPromise=require(_0x4d04('0x5'));var rp=require(_0x4d04('0x6'));var fs=require('fs');var path=require(_0x4d04('0x7'));var rimraf=require(_0x4d04('0x8'));var config=require(_0x4d04('0x9'));var attributes=require(_0x4d04('0xa'));module['exports']=function(_0x261545,_0x69e8b8){return _0x261545['define'](_0x4d04('0xb'),attributes,{'tableName':_0x4d04('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index dc5b4e3..a5034dc 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 _0x1967=['then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0x1967,0x173));var _0x7196=function(_0x5ea118,_0x444d88){_0x5ea118=_0x5ea118-0x0;var _0x125923=_0x1967[_0x5ea118];return _0x125923;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','IntegrationReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3e1353,_0x138834){var _0x2e6cae=function(_0x52fedf){while(--_0x52fedf){_0x3e1353['push'](_0x3e1353['shift']());}};_0x2e6cae(++_0x138834);}(_0x5fab,0x177));var _0xb5fa=function(_0x5bda4f,_0x22b15f){_0x5bda4f=_0x5bda4f-0x0;var _0x11f675=_0x5fab[_0x5bda4f];return _0x11f675;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index d333d0e..93ab442 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 _0xeece=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','getIntervals','post','create'];(function(_0x1f61cd,_0x4bfe47){var _0x270833=function(_0x124b3a){while(--_0x124b3a){_0x1f61cd['push'](_0x1f61cd['shift']());}};_0x270833(++_0x4bfe47);}(_0xeece,0x159));var _0xeeec=function(_0x284540,_0x55261d){_0x284540=_0x284540-0x0;var _0x5239dc=_0xeece[_0x284540];return _0x5239dc;};'use strict';var multer=require('multer');var util=require(_0xeeec('0x0'));var path=require(_0xeeec('0x1'));var timeout=require(_0xeeec('0x2'));var express=require('express');var router=express[_0xeeec('0x3')]();var fs_extra=require(_0xeeec('0x4'));var auth=require(_0xeeec('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./interval.controller');router['get']('/',auth[_0xeeec('0x6')](),controller[_0xeeec('0x7')]);router[_0xeeec('0x8')]('/:id',auth[_0xeeec('0x6')](),controller['show']);router['get']('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0xeeec('0x9')]);router[_0xeeec('0xa')]('/',auth[_0xeeec('0x6')](),controller[_0xeeec('0xb')]);router[_0xeeec('0xa')](_0xeeec('0xc'),auth['isAuthenticated'](),controller[_0xeeec('0xd')]);router[_0xeeec('0xa')](_0xeeec('0xe'),auth[_0xeeec('0x6')](),controller[_0xeeec('0xf')]);router[_0xeeec('0x10')](_0xeeec('0x11'),auth[_0xeeec('0x6')](),controller[_0xeeec('0x12')]);router['delete'](_0xeeec('0x11'),auth[_0xeeec('0x6')](),controller[_0xeeec('0x13')]);module[_0xeeec('0x14')]=router; \ No newline at end of file +var _0x9dc0=['get','isAuthenticated','index','/:id/sub_intervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','/:id','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x41d684,_0x52f976){var _0x83b011=function(_0x1060f5){while(--_0x1060f5){_0x41d684['push'](_0x41d684['shift']());}};_0x83b011(++_0x52f976);}(_0x9dc0,0xd6));var _0x09dc=function(_0x1ec65c,_0x354923){_0x1ec65c=_0x1ec65c-0x0;var _0x5249c2=_0x9dc0[_0x1ec65c];return _0x5249c2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x09dc('0x0'));var timeout=require('connect-timeout');var express=require(_0x09dc('0x1'));var router=express[_0x09dc('0x2')]();var fs_extra=require(_0x09dc('0x3'));var auth=require(_0x09dc('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x09dc('0x5'));var controller=require('./interval.controller');router[_0x09dc('0x6')]('/',auth[_0x09dc('0x7')](),controller[_0x09dc('0x8')]);router[_0x09dc('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x09dc('0x9'),auth[_0x09dc('0x7')](),controller['getIntervals']);router[_0x09dc('0xa')]('/',auth[_0x09dc('0x7')](),controller[_0x09dc('0xb')]);router['post'](_0x09dc('0x9'),auth[_0x09dc('0x7')](),controller[_0x09dc('0xc')]);router[_0x09dc('0xa')](_0x09dc('0xd'),auth[_0x09dc('0x7')](),controller[_0x09dc('0xe')]);router[_0x09dc('0xf')]('/:id',auth[_0x09dc('0x7')](),controller['update']);router[_0x09dc('0x10')](_0x09dc('0x11'),auth['isAuthenticated'](),controller[_0x09dc('0x12')]);module[_0x09dc('0x13')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index aad668f..60ba172 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 _0x73e3=['sequelize','exports','STRING'];(function(_0x2c83d7,_0xc5a661){var _0x177ea4=function(_0x35588a){while(--_0x35588a){_0x2c83d7['push'](_0x2c83d7['shift']());}};_0x177ea4(++_0xc5a661);}(_0x73e3,0xdb));var _0x373e=function(_0x5d72da,_0xb7ce32){_0x5d72da=_0x5d72da-0x0;var _0x43ebe7=_0x73e3[_0x5d72da];return _0x43ebe7;};'use strict';var Sequelize=require(_0x373e('0x0'));module[_0x373e('0x1')]={'name':{'type':Sequelize[_0x373e('0x2')]},'description':{'type':Sequelize[_0x373e('0x2')]},'interval':{'type':Sequelize[_0x373e('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x7d7d=['exports','STRING','sequelize'];(function(_0x167203,_0x22924f){var _0x2ce9d0=function(_0x5dc966){while(--_0x5dc966){_0x167203['push'](_0x167203['shift']());}};_0x2ce9d0(++_0x22924f);}(_0x7d7d,0xb3));var _0xd7d7=function(_0x30c51a,_0x2d92bf){_0x30c51a=_0x30c51a-0x0;var _0x40acf0=_0x7d7d[_0x30c51a];return _0x40acf0;};'use strict';var Sequelize=require(_0xd7d7('0x0'));module[_0xd7d7('0x1')]={'name':{'type':Sequelize[_0xd7d7('0x2')]},'description':{'type':Sequelize[_0xd7d7('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 676633d..c4e6d51 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 _0xd9c7=['moment','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','limit','count','offset','set','reject','save','update','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','map','Interval','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addInterval','getIntervals','addIntervals','sequelize','IntervalId','bulkCreate','eml-format','zip-dir'];(function(_0x28e633,_0x30b180){var _0x58fd06=function(_0x468ed6){while(--_0x468ed6){_0x28e633['push'](_0x28e633['shift']());}};_0x58fd06(++_0x30b180);}(_0xd9c7,0xa8));var _0x7d9c=function(_0x3ec270,_0xba3154){_0x3ec270=_0x3ec270-0x0;var _0x869f8f=_0xd9c7[_0x3ec270];return _0x869f8f;};'use strict';var emlformat=require(_0x7d9c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d9c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7d9c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x7d9c('0x3'));var util=require(_0x7d9c('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x7d9c('0x5'));var ejs=require(_0x7d9c('0x6'));var fs=require('fs');var fs_extra=require(_0x7d9c('0x7'));var _=require('lodash');var squel=require(_0x7d9c('0x8'));var crypto=require('crypto');var jsforce=require(_0x7d9c('0x9'));var deskjs=require(_0x7d9c('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7d9c('0xb'));var Papa=require(_0x7d9c('0xc'));var Redis=require(_0x7d9c('0xd'));var authService=require(_0x7d9c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7d9c('0xf'));var hardwareService=require(_0x7d9c('0x10'));var logger=require('../../config/logger')(_0x7d9c('0x11'));var utils=require(_0x7d9c('0x12'));var config=require(_0x7d9c('0x13'));var licenseUtil=require(_0x7d9c('0x14'));var db=require(_0x7d9c('0x15'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x5a2db8,_0x1e5655){_0x1e5655=_0x1e5655||0xcc;return function(_0x7e9fe1){if(_0x7e9fe1){return _0x5a2db8['sendStatus'](_0x1e5655);}return _0x5a2db8[_0x7d9c('0x16')](_0x1e5655)['end']();};}function respondWithResult(_0x18252a,_0x68bf8a){_0x68bf8a=_0x68bf8a||0xc8;return function(_0x48463a){if(_0x48463a){return _0x18252a['status'](_0x68bf8a)[_0x7d9c('0x17')](_0x48463a);}};}function respondWithFilteredResult(_0x3b8f8c,_0x2f870e){return function(_0x3a5cac){if(_0x3a5cac){var _0x59b6db=typeof _0x2f870e['offset']==='undefined'&&typeof _0x2f870e[_0x7d9c('0x18')]==='undefined';var _0x306d3f=_0x3a5cac[_0x7d9c('0x19')];var _0x25a987=_0x59b6db?0x0:_0x2f870e['offset'];var _0x9a3421=_0x59b6db?_0x3a5cac[_0x7d9c('0x19')]:_0x2f870e[_0x7d9c('0x1a')]+_0x2f870e[_0x7d9c('0x18')];var _0x320aa4;if(_0x9a3421>=_0x306d3f){_0x9a3421=_0x306d3f;_0x320aa4=0xc8;}else{_0x320aa4=0xce;}_0x3b8f8c['status'](_0x320aa4);return _0x3b8f8c[_0x7d9c('0x1b')]('Content-Range',_0x25a987+'-'+_0x9a3421+'/'+_0x306d3f)[_0x7d9c('0x17')](_0x3a5cac);}return null;};}function patchUpdates(_0x108469){return function(_0x25e8b7){try{jsonpatch['apply'](_0x25e8b7,_0x108469,!![]);}catch(_0x58404a){return BPromise[_0x7d9c('0x1c')](_0x58404a);}return _0x25e8b7[_0x7d9c('0x1d')]();};}function saveUpdates(_0x1933e6,_0x1cfbea){return function(_0x5cfc20){if(_0x5cfc20){return _0x5cfc20[_0x7d9c('0x1e')](_0x1933e6)[_0x7d9c('0x1f')](function(_0x2cc612){return _0x2cc612;});}return null;};}function removeEntity(_0x47ecc3,_0xccbe76){return function(_0x425361){if(_0x425361){return _0x425361[_0x7d9c('0x20')]()[_0x7d9c('0x1f')](function(){var _0x31f906=_0x425361[_0x7d9c('0x21')]({'plain':!![]});var _0xe2bc05='Intervals';return db[_0x7d9c('0x22')][_0x7d9c('0x20')]({'where':{'type':_0xe2bc05,'resourceId':_0x31f906['id']}})[_0x7d9c('0x1f')](function(){return _0x425361;});})[_0x7d9c('0x1f')](function(){_0x47ecc3[_0x7d9c('0x16')](0xcc)[_0x7d9c('0x23')]();});}};}function handleEntityNotFound(_0x5e7079,_0x21680f){return function(_0x557c93){if(!_0x557c93){_0x5e7079[_0x7d9c('0x24')](0x194);}return _0x557c93;};}function handleError(_0x478d92,_0x382b7f){_0x382b7f=_0x382b7f||0x1f4;return function(_0x4f74da){logger[_0x7d9c('0x25')](_0x4f74da[_0x7d9c('0x26')]);if(_0x4f74da[_0x7d9c('0x27')]){delete _0x4f74da[_0x7d9c('0x27')];}_0x478d92[_0x7d9c('0x16')](_0x382b7f)[_0x7d9c('0x28')](_0x4f74da);};}exports['index']=function(_0x9b560,_0x42d156){var _0x529dab={},_0x4f6d8d={},_0x1451c8={'count':0x0,'rows':[]};var _0xcf1ff8=_[_0x7d9c('0x29')](db[_0x7d9c('0x2a')][_0x7d9c('0x2b')],function(_0x8a0eb3){return{'name':_0x8a0eb3[_0x7d9c('0x2c')],'type':_0x8a0eb3[_0x7d9c('0x2d')][_0x7d9c('0x2e')]};});_0x4f6d8d['model']=_[_0x7d9c('0x29')](_0xcf1ff8,_0x7d9c('0x27'));_0x4f6d8d[_0x7d9c('0x2f')]=_[_0x7d9c('0x30')](_0x9b560[_0x7d9c('0x2f')]);_0x4f6d8d['filters']=_[_0x7d9c('0x31')](_0x4f6d8d['model'],_0x4f6d8d[_0x7d9c('0x2f')]);_0x529dab[_0x7d9c('0x32')]=_[_0x7d9c('0x31')](_0x4f6d8d[_0x7d9c('0x33')],qs[_0x7d9c('0x34')](_0x9b560[_0x7d9c('0x2f')][_0x7d9c('0x34')]));_0x529dab[_0x7d9c('0x32')]=_0x529dab['attributes'][_0x7d9c('0x35')]?_0x529dab[_0x7d9c('0x32')]:_0x4f6d8d[_0x7d9c('0x33')];if(!_0x9b560[_0x7d9c('0x2f')]['hasOwnProperty'](_0x7d9c('0x36'))){_0x529dab['limit']=qs['limit'](_0x9b560[_0x7d9c('0x2f')][_0x7d9c('0x18')]);_0x529dab[_0x7d9c('0x1a')]=qs[_0x7d9c('0x1a')](_0x9b560[_0x7d9c('0x2f')][_0x7d9c('0x1a')]);}_0x529dab[_0x7d9c('0x37')]=qs[_0x7d9c('0x38')](_0x9b560[_0x7d9c('0x2f')][_0x7d9c('0x38')]);_0x529dab['where']=qs[_0x7d9c('0x39')](_[_0x7d9c('0x3a')](_0x9b560[_0x7d9c('0x2f')],_0x4f6d8d[_0x7d9c('0x39')]),_0xcf1ff8);if(_0x9b560['query'][_0x7d9c('0x3b')]){_0x529dab[_0x7d9c('0x3c')]=_[_0x7d9c('0x3d')](_0x529dab[_0x7d9c('0x3c')],{'$or':_[_0x7d9c('0x29')](_0xcf1ff8,function(_0x2653eb){if(_0x2653eb[_0x7d9c('0x2d')]!==_0x7d9c('0x3e')){var _0x4c3f59={};_0x4c3f59[_0x2653eb[_0x7d9c('0x27')]]={'$like':'%'+_0x9b560[_0x7d9c('0x2f')][_0x7d9c('0x3b')]+'%'};return _0x4c3f59;}})});}_0x529dab=_[_0x7d9c('0x3d')]({},_0x529dab,_0x9b560[_0x7d9c('0x3f')]);var _0x11b821={'where':_0x529dab[_0x7d9c('0x3c')]};return db[_0x7d9c('0x2a')][_0x7d9c('0x19')](_0x11b821)['then'](function(_0x45dfb5){_0x1451c8[_0x7d9c('0x19')]=_0x45dfb5;if(_0x9b560[_0x7d9c('0x2f')][_0x7d9c('0x40')]){_0x529dab[_0x7d9c('0x41')]=[{'all':!![]}];}return db[_0x7d9c('0x2a')][_0x7d9c('0x42')](_0x529dab);})[_0x7d9c('0x1f')](function(_0x4b63da){_0x1451c8[_0x7d9c('0x43')]=_0x4b63da;return _0x1451c8;})[_0x7d9c('0x1f')](respondWithFilteredResult(_0x42d156,_0x529dab))['catch'](handleError(_0x42d156,null));};exports['show']=function(_0xf0a1c9,_0x22a756){var _0x38bec0={'raw':!![],'where':{'id':_0xf0a1c9[_0x7d9c('0x44')]['id']}},_0x44c22f={};_0x44c22f[_0x7d9c('0x33')]=_[_0x7d9c('0x30')](db[_0x7d9c('0x2a')][_0x7d9c('0x2b')]);_0x44c22f[_0x7d9c('0x2f')]=_[_0x7d9c('0x30')](_0xf0a1c9[_0x7d9c('0x2f')]);_0x44c22f['filters']=_[_0x7d9c('0x31')](_0x44c22f[_0x7d9c('0x33')],_0x44c22f[_0x7d9c('0x2f')]);_0x38bec0[_0x7d9c('0x32')]=_['intersection'](_0x44c22f[_0x7d9c('0x33')],qs[_0x7d9c('0x34')](_0xf0a1c9[_0x7d9c('0x2f')][_0x7d9c('0x34')]));_0x38bec0['attributes']=_0x38bec0[_0x7d9c('0x32')][_0x7d9c('0x35')]?_0x38bec0[_0x7d9c('0x32')]:_0x44c22f[_0x7d9c('0x33')];if(_0xf0a1c9['query'][_0x7d9c('0x40')]){_0x38bec0[_0x7d9c('0x41')]=[{'all':!![]}];}_0x38bec0=_['merge']({},_0x38bec0,_0xf0a1c9['options']);return db[_0x7d9c('0x2a')]['find'](_0x38bec0)[_0x7d9c('0x1f')](handleEntityNotFound(_0x22a756,null))[_0x7d9c('0x1f')](respondWithResult(_0x22a756,null))[_0x7d9c('0x45')](handleError(_0x22a756,null));};exports[_0x7d9c('0x46')]=function(_0x4efd73,_0x47b7b4){return db[_0x7d9c('0x2a')][_0x7d9c('0x46')](_0x4efd73[_0x7d9c('0x47')],{})[_0x7d9c('0x1f')](function(_0x1e5aa6){var _0x4f8491=_0x4efd73[_0x7d9c('0x48')][_0x7d9c('0x21')]({'plain':!![]});if(!_0x4f8491)throw new Error(_0x7d9c('0x49'));if(_0x4f8491[_0x7d9c('0x4a')]==='user'){var _0x2c4971=_0x1e5aa6['get']({'plain':!![]});var _0x4effe7=_0x7d9c('0x4b');return db[_0x7d9c('0x4c')]['find']({'where':{'name':_0x4effe7,'userProfileId':_0x4f8491['userProfileId']},'raw':!![]})['then'](function(_0x34d9a8){if(_0x34d9a8&&_0x34d9a8['autoAssociation']===0x0){return db['UserProfileResource'][_0x7d9c('0x46')]({'name':_0x2c4971[_0x7d9c('0x27')],'resourceId':_0x2c4971['id'],'type':_0x34d9a8[_0x7d9c('0x27')],'sectionId':_0x34d9a8['id']},{})[_0x7d9c('0x1f')](function(){return _0x1e5aa6;});}else{return _0x1e5aa6;}})[_0x7d9c('0x45')](function(_0x49208e){logger['error'](_0x7d9c('0x4d'),_0x49208e);throw _0x49208e;});}return _0x1e5aa6;})[_0x7d9c('0x1f')](respondWithResult(_0x47b7b4,0xc9))[_0x7d9c('0x45')](handleError(_0x47b7b4,null));};exports[_0x7d9c('0x1e')]=function(_0x5f04a3,_0x12b670){if(_0x5f04a3[_0x7d9c('0x47')]['id']){delete _0x5f04a3[_0x7d9c('0x47')]['id'];}return db[_0x7d9c('0x2a')][_0x7d9c('0x4e')]({'where':{'id':_0x5f04a3['params']['id']}})['then'](handleEntityNotFound(_0x12b670,null))['then'](saveUpdates(_0x5f04a3[_0x7d9c('0x47')],null))[_0x7d9c('0x1f')](respondWithResult(_0x12b670,null))[_0x7d9c('0x45')](handleError(_0x12b670,null));};exports[_0x7d9c('0x20')]=function(_0x1c4196,_0x1988a2){return db['Interval'][_0x7d9c('0x4e')]({'where':{'id':_0x1c4196[_0x7d9c('0x44')]['id']}})[_0x7d9c('0x1f')](handleEntityNotFound(_0x1988a2,null))[_0x7d9c('0x1f')](removeEntity(_0x1988a2,null))[_0x7d9c('0x45')](handleError(_0x1988a2,null));};exports[_0x7d9c('0x4f')]=function(_0x4db6e5,_0x3c0e99,_0x4dfe4e){if(_0x4db6e5[_0x7d9c('0x47')]['id']){delete _0x4db6e5[_0x7d9c('0x47')]['id'];}return db[_0x7d9c('0x2a')][_0x7d9c('0x4e')]({'where':{'id':_0x4db6e5[_0x7d9c('0x44')]['id']}})['then'](handleEntityNotFound(_0x3c0e99,null))[_0x7d9c('0x1f')](function(_0x1102e8){if(_0x1102e8){_0x4db6e5[_0x7d9c('0x47')]['IntervalId']=_0x1102e8['id'];return db[_0x7d9c('0x2a')][_0x7d9c('0x46')](_0x4db6e5[_0x7d9c('0x47')]);}})[_0x7d9c('0x1f')](respondWithResult(_0x3c0e99,null))[_0x7d9c('0x45')](handleError(_0x3c0e99,null));};exports[_0x7d9c('0x50')]=function(_0x3cfee2,_0x2bc056,_0x88cd5b){var _0x4cd4b1={};var _0x19edbd={};var _0x17bcdb;var _0x34e330;return db[_0x7d9c('0x2a')]['findOne']({'where':{'id':_0x3cfee2['params']['id']}})['then'](handleEntityNotFound(_0x2bc056,null))[_0x7d9c('0x1f')](function(_0x13dc73){if(_0x13dc73){_0x17bcdb=_0x13dc73;_0x19edbd[_0x7d9c('0x33')]=_[_0x7d9c('0x30')](db[_0x7d9c('0x2a')]['rawAttributes']);_0x19edbd[_0x7d9c('0x2f')]=_[_0x7d9c('0x30')](_0x3cfee2[_0x7d9c('0x2f')]);_0x19edbd[_0x7d9c('0x39')]=_['intersection'](_0x19edbd[_0x7d9c('0x33')],_0x19edbd[_0x7d9c('0x2f')]);_0x4cd4b1[_0x7d9c('0x32')]=_[_0x7d9c('0x31')](_0x19edbd[_0x7d9c('0x33')],qs[_0x7d9c('0x34')](_0x3cfee2[_0x7d9c('0x2f')][_0x7d9c('0x34')]));_0x4cd4b1[_0x7d9c('0x32')]=_0x4cd4b1[_0x7d9c('0x32')]['length']?_0x4cd4b1['attributes']:_0x19edbd[_0x7d9c('0x33')];_0x4cd4b1[_0x7d9c('0x37')]=qs[_0x7d9c('0x38')](_0x3cfee2[_0x7d9c('0x2f')][_0x7d9c('0x38')]);_0x4cd4b1[_0x7d9c('0x3c')]=qs['filters'](_['pick'](_0x3cfee2[_0x7d9c('0x2f')],_0x19edbd[_0x7d9c('0x39')]));if(_0x3cfee2['query']['filter']){_0x4cd4b1['where']=_[_0x7d9c('0x3d')](_0x4cd4b1[_0x7d9c('0x3c')],{'$or':_[_0x7d9c('0x29')](_0x4cd4b1[_0x7d9c('0x32')],function(_0x17f4e0){var _0x28a8ad={};_0x28a8ad[_0x17f4e0]={'$like':'%'+_0x3cfee2['query'][_0x7d9c('0x3b')]+'%'};return _0x28a8ad;})});}_0x4cd4b1=_['merge']({},_0x4cd4b1,_0x3cfee2[_0x7d9c('0x3f')]);return _0x17bcdb['getIntervals'](_0x4cd4b1);}})[_0x7d9c('0x1f')](function(_0x3a1631){if(_0x3a1631){_0x34e330=_0x3a1631[_0x7d9c('0x35')];if(!_0x3cfee2[_0x7d9c('0x2f')]['hasOwnProperty'](_0x7d9c('0x36'))){_0x4cd4b1[_0x7d9c('0x18')]=qs[_0x7d9c('0x18')](_0x3cfee2[_0x7d9c('0x2f')]['limit']);_0x4cd4b1['offset']=qs[_0x7d9c('0x1a')](_0x3cfee2[_0x7d9c('0x2f')]['offset']);}return _0x17bcdb[_0x7d9c('0x50')](_0x4cd4b1);}})['then'](function(_0x2abfbd){if(_0x2abfbd){return _0x2abfbd?{'count':_0x34e330,'rows':_0x2abfbd}:null;}})['then'](respondWithResult(_0x2bc056,null))[_0x7d9c('0x45')](handleError(_0x2bc056,null));};exports[_0x7d9c('0x51')]=function(_0x58cdea,_0x2c22dc,_0x39797e){return db['Interval']['findOne']({'where':{'id':_0x58cdea[_0x7d9c('0x44')]['id']}})[_0x7d9c('0x1f')](handleEntityNotFound(_0x2c22dc,null))[_0x7d9c('0x1f')](function(_0x457651){if(_0x457651){return db[_0x7d9c('0x52')]['transaction'](function(_0x1e87ba){return db[_0x7d9c('0x2a')][_0x7d9c('0x20')]({'where':{'IntervalId':_0x58cdea[_0x7d9c('0x44')]['id']},'transaction':_0x1e87ba})['then'](function(_0x4fe892){var _0x12c4ce=_[_0x7d9c('0x29')](_0x58cdea[_0x7d9c('0x47')],function(_0x4b6c10){delete _0x4b6c10['id'];_0x4b6c10[_0x7d9c('0x53')]=_0x58cdea['params']['id'];return _0x4b6c10;});return db[_0x7d9c('0x2a')][_0x7d9c('0x54')](_0x12c4ce,{'transaction':_0x1e87ba});});})[_0x7d9c('0x1f')](function(){return db['Interval'][_0x7d9c('0x42')]({'where':{'IntervalId':_0x58cdea[_0x7d9c('0x44')]['id']}});});}})[_0x7d9c('0x1f')](respondWithResult(_0x2c22dc,null))['catch'](handleError(_0x2c22dc,null));}; \ No newline at end of file +var _0x17fa=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','includeAll','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','addInterval','IntervalId','findOne','pick','merge','options','getIntervals','sequelize','transaction','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0xce3c10,_0xef68fc){var _0x494e1e=function(_0x4f4a13){while(--_0x4f4a13){_0xce3c10['push'](_0xce3c10['shift']());}};_0x494e1e(++_0xef68fc);}(_0x17fa,0x14e));var _0xa17f=function(_0x26793a,_0x2530c1){_0x26793a=_0x26793a-0x0;var _0x281092=_0x17fa[_0x26793a];return _0x281092;};'use strict';var emlformat=require(_0xa17f('0x0'));var rimraf=require(_0xa17f('0x1'));var zipdir=require(_0xa17f('0x2'));var jsonpatch=require(_0xa17f('0x3'));var rp=require(_0xa17f('0x4'));var moment=require('moment');var BPromise=require(_0xa17f('0x5'));var Mustache=require(_0xa17f('0x6'));var util=require(_0xa17f('0x7'));var path=require(_0xa17f('0x8'));var sox=require(_0xa17f('0x9'));var csv=require(_0xa17f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa17f('0xb'));var _=require(_0xa17f('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa17f('0xd'));var deskjs=require(_0xa17f('0xe'));var toCsv=require(_0xa17f('0xa'));var querystring=require(_0xa17f('0xf'));var Papa=require(_0xa17f('0x10'));var Redis=require('ioredis');var authService=require(_0xa17f('0x11'));var qs=require(_0xa17f('0x12'));var as=require(_0xa17f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa17f('0x14'))(_0xa17f('0x15'));var utils=require(_0xa17f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa17f('0x17'));var db=require(_0xa17f('0x18'))['db'];var extensions=require(_0xa17f('0x19'));function respondWithStatusCode(_0x49bf8d,_0x1f2830){_0x1f2830=_0x1f2830||0xcc;return function(_0x3741f5){if(_0x3741f5){return _0x49bf8d[_0xa17f('0x1a')](_0x1f2830);}return _0x49bf8d[_0xa17f('0x1b')](_0x1f2830)[_0xa17f('0x1c')]();};}function respondWithResult(_0x3c10eb,_0x2a53f6){_0x2a53f6=_0x2a53f6||0xc8;return function(_0x3f1f04){if(_0x3f1f04){return _0x3c10eb[_0xa17f('0x1b')](_0x2a53f6)[_0xa17f('0x1d')](_0x3f1f04);}};}function respondWithFilteredResult(_0x4f30e6,_0x2ec55f){return function(_0x544cec){if(_0x544cec){var _0x5a4238=typeof _0x2ec55f[_0xa17f('0x1e')]===_0xa17f('0x1f')&&typeof _0x2ec55f[_0xa17f('0x20')]===_0xa17f('0x1f');var _0x1e2cd6=_0x544cec['count'];var _0x4062bb=_0x5a4238?0x0:_0x2ec55f[_0xa17f('0x1e')];var _0x3736ef=_0x5a4238?_0x544cec[_0xa17f('0x21')]:_0x2ec55f[_0xa17f('0x1e')]+_0x2ec55f['limit'];var _0xc3d9c7;if(_0x3736ef>=_0x1e2cd6){_0x3736ef=_0x1e2cd6;_0xc3d9c7=0xc8;}else{_0xc3d9c7=0xce;}_0x4f30e6[_0xa17f('0x1b')](_0xc3d9c7);return _0x4f30e6[_0xa17f('0x22')](_0xa17f('0x23'),_0x4062bb+'-'+_0x3736ef+'/'+_0x1e2cd6)[_0xa17f('0x1d')](_0x544cec);}return null;};}function patchUpdates(_0x34cc64){return function(_0x366878){try{jsonpatch[_0xa17f('0x24')](_0x366878,_0x34cc64,!![]);}catch(_0x213a41){return BPromise['reject'](_0x213a41);}return _0x366878[_0xa17f('0x25')]();};}function saveUpdates(_0x3d529a,_0x357315){return function(_0x6fdabb){if(_0x6fdabb){return _0x6fdabb[_0xa17f('0x26')](_0x3d529a)[_0xa17f('0x27')](function(_0x4ceed4){return _0x4ceed4;});}return null;};}function removeEntity(_0x48c98f,_0x4e3c65){return function(_0xb28157){if(_0xb28157){return _0xb28157[_0xa17f('0x28')]()[_0xa17f('0x27')](function(){var _0xa63967=_0xb28157[_0xa17f('0x29')]({'plain':!![]});var _0xacd61e='Intervals';return db[_0xa17f('0x2a')][_0xa17f('0x28')]({'where':{'type':_0xacd61e,'resourceId':_0xa63967['id']}})[_0xa17f('0x27')](function(){return _0xb28157;});})['then'](function(){_0x48c98f[_0xa17f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14fab0,_0x191fef){return function(_0x854e06){if(!_0x854e06){_0x14fab0[_0xa17f('0x1a')](0x194);}return _0x854e06;};}function handleError(_0x1a8cb4,_0x205726){_0x205726=_0x205726||0x1f4;return function(_0x28e7e4){logger[_0xa17f('0x2b')](_0x28e7e4[_0xa17f('0x2c')]);if(_0x28e7e4[_0xa17f('0x2d')]){delete _0x28e7e4[_0xa17f('0x2d')];}_0x1a8cb4['status'](_0x205726)['send'](_0x28e7e4);};}exports[_0xa17f('0x2e')]=function(_0x3bf6b4,_0x41232d){var _0x36135c={},_0x5beb5e={},_0x589040={'count':0x0,'rows':[]};var _0xf3706f=_[_0xa17f('0x2f')](db[_0xa17f('0x30')][_0xa17f('0x31')],function(_0x449a8e){return{'name':_0x449a8e[_0xa17f('0x32')],'type':_0x449a8e[_0xa17f('0x33')][_0xa17f('0x34')]};});_0x5beb5e[_0xa17f('0x35')]=_['map'](_0xf3706f,'name');_0x5beb5e[_0xa17f('0x36')]=_[_0xa17f('0x37')](_0x3bf6b4[_0xa17f('0x36')]);_0x5beb5e[_0xa17f('0x38')]=_[_0xa17f('0x39')](_0x5beb5e[_0xa17f('0x35')],_0x5beb5e[_0xa17f('0x36')]);_0x36135c['attributes']=_[_0xa17f('0x39')](_0x5beb5e[_0xa17f('0x35')],qs['fields'](_0x3bf6b4[_0xa17f('0x36')][_0xa17f('0x3a')]));_0x36135c[_0xa17f('0x3b')]=_0x36135c[_0xa17f('0x3b')][_0xa17f('0x3c')]?_0x36135c[_0xa17f('0x3b')]:_0x5beb5e[_0xa17f('0x35')];if(!_0x3bf6b4['query'][_0xa17f('0x3d')](_0xa17f('0x3e'))){_0x36135c['limit']=qs['limit'](_0x3bf6b4[_0xa17f('0x36')]['limit']);_0x36135c['offset']=qs['offset'](_0x3bf6b4['query'][_0xa17f('0x1e')]);}_0x36135c['order']=qs[_0xa17f('0x3f')](_0x3bf6b4[_0xa17f('0x36')][_0xa17f('0x3f')]);_0x36135c[_0xa17f('0x40')]=qs[_0xa17f('0x38')](_['pick'](_0x3bf6b4['query'],_0x5beb5e['filters']),_0xf3706f);if(_0x3bf6b4[_0xa17f('0x36')][_0xa17f('0x41')]){_0x36135c['where']=_['merge'](_0x36135c[_0xa17f('0x40')],{'$or':_[_0xa17f('0x2f')](_0xf3706f,function(_0x27fcc5){if(_0x27fcc5[_0xa17f('0x33')]!==_0xa17f('0x42')){var _0x137e71={};_0x137e71[_0x27fcc5[_0xa17f('0x2d')]]={'$like':'%'+_0x3bf6b4['query'][_0xa17f('0x41')]+'%'};return _0x137e71;}})});}_0x36135c=_['merge']({},_0x36135c,_0x3bf6b4['options']);var _0x16b815={'where':_0x36135c[_0xa17f('0x40')]};return db['Interval'][_0xa17f('0x21')](_0x16b815)['then'](function(_0xf199a2){_0x589040[_0xa17f('0x21')]=_0xf199a2;if(_0x3bf6b4['query'][_0xa17f('0x43')]){_0x36135c['include']=[{'all':!![]}];}return db[_0xa17f('0x30')]['findAll'](_0x36135c);})[_0xa17f('0x27')](function(_0x27fbb9){_0x589040['rows']=_0x27fbb9;return _0x589040;})[_0xa17f('0x27')](respondWithFilteredResult(_0x41232d,_0x36135c))[_0xa17f('0x44')](handleError(_0x41232d,null));};exports['show']=function(_0x2d7db5,_0x4063b5){var _0x2e3fa0={'raw':!![],'where':{'id':_0x2d7db5[_0xa17f('0x45')]['id']}},_0x1526b4={};_0x1526b4[_0xa17f('0x35')]=_[_0xa17f('0x37')](db[_0xa17f('0x30')]['rawAttributes']);_0x1526b4[_0xa17f('0x36')]=_[_0xa17f('0x37')](_0x2d7db5['query']);_0x1526b4[_0xa17f('0x38')]=_[_0xa17f('0x39')](_0x1526b4[_0xa17f('0x35')],_0x1526b4[_0xa17f('0x36')]);_0x2e3fa0[_0xa17f('0x3b')]=_['intersection'](_0x1526b4[_0xa17f('0x35')],qs[_0xa17f('0x3a')](_0x2d7db5[_0xa17f('0x36')]['fields']));_0x2e3fa0[_0xa17f('0x3b')]=_0x2e3fa0[_0xa17f('0x3b')][_0xa17f('0x3c')]?_0x2e3fa0[_0xa17f('0x3b')]:_0x1526b4[_0xa17f('0x35')];if(_0x2d7db5['query'][_0xa17f('0x43')]){_0x2e3fa0['include']=[{'all':!![]}];}_0x2e3fa0=_['merge']({},_0x2e3fa0,_0x2d7db5['options']);return db['Interval']['find'](_0x2e3fa0)['then'](handleEntityNotFound(_0x4063b5,null))['then'](respondWithResult(_0x4063b5,null))[_0xa17f('0x44')](handleError(_0x4063b5,null));};exports[_0xa17f('0x46')]=function(_0x3aec07,_0x15b2a7){return db[_0xa17f('0x30')]['create'](_0x3aec07[_0xa17f('0x47')],{})['then'](function(_0xc906fb){var _0x1c15f1=_0x3aec07[_0xa17f('0x48')][_0xa17f('0x29')]({'plain':!![]});if(!_0x1c15f1)throw new Error(_0xa17f('0x49'));if(_0x1c15f1['role']===_0xa17f('0x48')){var _0x159458=_0xc906fb[_0xa17f('0x29')]({'plain':!![]});var _0x3427e1='Intervals';return db[_0xa17f('0x4a')][_0xa17f('0x4b')]({'where':{'name':_0x3427e1,'userProfileId':_0x1c15f1[_0xa17f('0x4c')]},'raw':!![]})[_0xa17f('0x27')](function(_0x3b98ab){if(_0x3b98ab&&_0x3b98ab['autoAssociation']===0x0){return db['UserProfileResource'][_0xa17f('0x46')]({'name':_0x159458[_0xa17f('0x2d')],'resourceId':_0x159458['id'],'type':_0x3b98ab[_0xa17f('0x2d')],'sectionId':_0x3b98ab['id']},{})[_0xa17f('0x27')](function(){return _0xc906fb;});}else{return _0xc906fb;}})[_0xa17f('0x44')](function(_0x54f03a){logger[_0xa17f('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54f03a);throw _0x54f03a;});}return _0xc906fb;})['then'](respondWithResult(_0x15b2a7,0xc9))[_0xa17f('0x44')](handleError(_0x15b2a7,null));};exports[_0xa17f('0x26')]=function(_0x55d546,_0x2f586d){if(_0x55d546['body']['id']){delete _0x55d546[_0xa17f('0x47')]['id'];}return db[_0xa17f('0x30')][_0xa17f('0x4b')]({'where':{'id':_0x55d546[_0xa17f('0x45')]['id']}})[_0xa17f('0x27')](handleEntityNotFound(_0x2f586d,null))['then'](saveUpdates(_0x55d546[_0xa17f('0x47')],null))['then'](respondWithResult(_0x2f586d,null))[_0xa17f('0x44')](handleError(_0x2f586d,null));};exports[_0xa17f('0x28')]=function(_0x159180,_0x39fb5b){return db[_0xa17f('0x30')]['find']({'where':{'id':_0x159180[_0xa17f('0x45')]['id']}})[_0xa17f('0x27')](handleEntityNotFound(_0x39fb5b,null))[_0xa17f('0x27')](removeEntity(_0x39fb5b,null))[_0xa17f('0x44')](handleError(_0x39fb5b,null));};exports[_0xa17f('0x4d')]=function(_0x500f6a,_0xfbf358,_0x50d61b){if(_0x500f6a[_0xa17f('0x47')]['id']){delete _0x500f6a[_0xa17f('0x47')]['id'];}return db[_0xa17f('0x30')]['find']({'where':{'id':_0x500f6a[_0xa17f('0x45')]['id']}})['then'](handleEntityNotFound(_0xfbf358,null))[_0xa17f('0x27')](function(_0x2c76c8){if(_0x2c76c8){_0x500f6a[_0xa17f('0x47')][_0xa17f('0x4e')]=_0x2c76c8['id'];return db[_0xa17f('0x30')][_0xa17f('0x46')](_0x500f6a['body']);}})['then'](respondWithResult(_0xfbf358,null))[_0xa17f('0x44')](handleError(_0xfbf358,null));};exports['getIntervals']=function(_0x5b1cdc,_0x54554d,_0x2d6709){var _0x44eee3={};var _0x52f8df={};var _0x5b1574;var _0x2680b7;return db['Interval'][_0xa17f('0x4f')]({'where':{'id':_0x5b1cdc[_0xa17f('0x45')]['id']}})[_0xa17f('0x27')](handleEntityNotFound(_0x54554d,null))[_0xa17f('0x27')](function(_0x5a4d48){if(_0x5a4d48){_0x5b1574=_0x5a4d48;_0x52f8df[_0xa17f('0x35')]=_[_0xa17f('0x37')](db[_0xa17f('0x30')]['rawAttributes']);_0x52f8df[_0xa17f('0x36')]=_[_0xa17f('0x37')](_0x5b1cdc['query']);_0x52f8df[_0xa17f('0x38')]=_[_0xa17f('0x39')](_0x52f8df['model'],_0x52f8df[_0xa17f('0x36')]);_0x44eee3['attributes']=_[_0xa17f('0x39')](_0x52f8df[_0xa17f('0x35')],qs[_0xa17f('0x3a')](_0x5b1cdc[_0xa17f('0x36')][_0xa17f('0x3a')]));_0x44eee3[_0xa17f('0x3b')]=_0x44eee3[_0xa17f('0x3b')][_0xa17f('0x3c')]?_0x44eee3[_0xa17f('0x3b')]:_0x52f8df[_0xa17f('0x35')];_0x44eee3['order']=qs[_0xa17f('0x3f')](_0x5b1cdc[_0xa17f('0x36')][_0xa17f('0x3f')]);_0x44eee3[_0xa17f('0x40')]=qs[_0xa17f('0x38')](_[_0xa17f('0x50')](_0x5b1cdc[_0xa17f('0x36')],_0x52f8df[_0xa17f('0x38')]));if(_0x5b1cdc[_0xa17f('0x36')][_0xa17f('0x41')]){_0x44eee3[_0xa17f('0x40')]=_['merge'](_0x44eee3[_0xa17f('0x40')],{'$or':_[_0xa17f('0x2f')](_0x44eee3[_0xa17f('0x3b')],function(_0x368071){var _0x45ca86={};_0x45ca86[_0x368071]={'$like':'%'+_0x5b1cdc[_0xa17f('0x36')][_0xa17f('0x41')]+'%'};return _0x45ca86;})});}_0x44eee3=_[_0xa17f('0x51')]({},_0x44eee3,_0x5b1cdc[_0xa17f('0x52')]);return _0x5b1574[_0xa17f('0x53')](_0x44eee3);}})[_0xa17f('0x27')](function(_0x268155){if(_0x268155){_0x2680b7=_0x268155['length'];if(!_0x5b1cdc[_0xa17f('0x36')]['hasOwnProperty'](_0xa17f('0x3e'))){_0x44eee3[_0xa17f('0x20')]=qs[_0xa17f('0x20')](_0x5b1cdc[_0xa17f('0x36')][_0xa17f('0x20')]);_0x44eee3[_0xa17f('0x1e')]=qs[_0xa17f('0x1e')](_0x5b1cdc[_0xa17f('0x36')][_0xa17f('0x1e')]);}return _0x5b1574[_0xa17f('0x53')](_0x44eee3);}})[_0xa17f('0x27')](function(_0x20174c){if(_0x20174c){return _0x20174c?{'count':_0x2680b7,'rows':_0x20174c}:null;}})[_0xa17f('0x27')](respondWithResult(_0x54554d,null))[_0xa17f('0x44')](handleError(_0x54554d,null));};exports['addIntervals']=function(_0xa0de32,_0x216bbc,_0x27ad55){return db[_0xa17f('0x30')]['findOne']({'where':{'id':_0xa0de32['params']['id']}})[_0xa17f('0x27')](handleEntityNotFound(_0x216bbc,null))['then'](function(_0x373668){if(_0x373668){return db[_0xa17f('0x54')][_0xa17f('0x55')](function(_0x4bdcb3){return db['Interval']['destroy']({'where':{'IntervalId':_0xa0de32['params']['id']},'transaction':_0x4bdcb3})[_0xa17f('0x27')](function(_0x372c0f){var _0x1c8431=_[_0xa17f('0x2f')](_0xa0de32[_0xa17f('0x47')],function(_0x1ec3bb){delete _0x1ec3bb['id'];_0x1ec3bb[_0xa17f('0x4e')]=_0xa0de32[_0xa17f('0x45')]['id'];return _0x1ec3bb;});return db['Interval'][_0xa17f('0x56')](_0x1c8431,{'transaction':_0x4bdcb3});});})[_0xa17f('0x27')](function(){return db[_0xa17f('0x30')][_0xa17f('0x57')]({'where':{'IntervalId':_0xa0de32[_0xa17f('0x45')]['id']}});});}})[_0xa17f('0x27')](respondWithResult(_0x216bbc,null))['catch'](handleError(_0x216bbc,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 4207b23..ef0a8df 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 _0x514d=['bluebird','request-promise','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment'];(function(_0xbee1d4,_0x237b70){var _0xa9376f=function(_0x18c842){while(--_0x18c842){_0xbee1d4['push'](_0xbee1d4['shift']());}};_0xa9376f(++_0x237b70);}(_0x514d,0x87));var _0xd514=function(_0x4c3bd8,_0x55172a){_0x4c3bd8=_0x4c3bd8-0x0;var _0x1ee00b=_0x514d[_0x4c3bd8];return _0x1ee00b;};'use strict';var _=require(_0xd514('0x0'));var util=require(_0xd514('0x1'));var logger=require(_0xd514('0x2'))(_0xd514('0x3'));var moment=require(_0xd514('0x4'));var BPromise=require(_0xd514('0x5'));var rp=require(_0xd514('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd514('0x7'));var attributes=require(_0xd514('0x8'));var extensions=require(_0xd514('0x9'));module[_0xd514('0xa')]=function(_0x5bf378,_0x20e981){return _0x5bf378[_0xd514('0xb')]('Interval',attributes,{'tableName':_0xd514('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x58f5a8,_0x21cd1b){extensions[_0xd514('0xd')](_0x5bf378,_0x58f5a8);},'afterBulkCreate':function(_0x34aa43,_0x50d2b7,_0x293b75){_0x293b75();extensions[_0xd514('0xd')](_0x5bf378,_0x34aa43[0x0]);},'afterUpdate':function(_0x25795f,_0x578845){extensions[_0xd514('0xd')](_0x5bf378,_0x25795f);},'afterDestroy':function(_0x3c2e48,_0x23510c){extensions[_0xd514('0xd')](_0x5bf378,_0x3c2e48);}}});}; \ No newline at end of file +var _0x90ad=['util','../../config/logger','api','moment','request-promise','path','rimraf','./interval.attributes','exports','define','Interval','tools_intervals','rewrite','lodash'];(function(_0x53208e,_0x4a1eb8){var _0xa97d9b=function(_0xefd3c1){while(--_0xefd3c1){_0x53208e['push'](_0x53208e['shift']());}};_0xa97d9b(++_0x4a1eb8);}(_0x90ad,0x195));var _0xd90a=function(_0x5466ab,_0x227b13){_0x5466ab=_0x5466ab-0x0;var _0x40751a=_0x90ad[_0x5466ab];return _0x40751a;};'use strict';var _=require(_0xd90a('0x0'));var util=require(_0xd90a('0x1'));var logger=require(_0xd90a('0x2'))(_0xd90a('0x3'));var moment=require(_0xd90a('0x4'));var BPromise=require('bluebird');var rp=require(_0xd90a('0x5'));var fs=require('fs');var path=require(_0xd90a('0x6'));var rimraf=require(_0xd90a('0x7'));var config=require('../../config/environment');var attributes=require(_0xd90a('0x8'));var extensions=require('../../components/extensions/rewrite');module[_0xd90a('0x9')]=function(_0x21da8b,_0x4ce546){return _0x21da8b[_0xd90a('0xa')](_0xd90a('0xb'),attributes,{'tableName':_0xd90a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ed7fa,_0x491c30){extensions[_0xd90a('0xd')](_0x21da8b,_0x5ed7fa);},'afterBulkCreate':function(_0x4a1c6b,_0x50b213,_0x59f493){_0x59f493();extensions[_0xd90a('0xd')](_0x21da8b,_0x4a1c6b[0x0]);},'afterUpdate':function(_0x2d70f9,_0x1d8933){extensions[_0xd90a('0xd')](_0x21da8b,_0x2d70f9);},'afterDestroy':function(_0x5a66e0,_0x2815e8){extensions[_0xd90a('0xd')](_0x21da8b,_0x5a66e0);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 7b0ff85..e225549 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(_0x34d275,_0x5d84ee){var _0x1379cc=function(_0x320fbe){while(--_0x320fbe){_0x34d275['push'](_0x34d275['shift']());}};_0x1379cc(++_0x5d84ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 ce4572f..03577f2 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(_0x2c9169,_0x47fcae){var _0x50d349=function(_0x309637){while(--_0x309637){_0x2c9169['push'](_0x2c9169['shift']());}};_0x50d349(++_0x47fcae);}(_0x2032,0xd9));var _0x2203=function(_0x451451,_0x4aa4de){_0x451451=_0x451451-0x0;var _0x224070=_0x2032[_0x451451];return _0x224070;};'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(_0x20c35e,_0x5825a9){var _0x20c800=function(_0x40c993){while(--_0x40c993){_0x20c35e['push'](_0x20c35e['shift']());}};_0x20c800(++_0x5825a9);}(_0x2ef3,0xba));var _0x32ef=function(_0xb18ec2,_0x56d352){_0xb18ec2=_0xb18ec2-0x0;var _0x40c04b=_0x2ef3[_0xb18ec2];return _0x40c04b;};'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 89af7a0..014bb0e 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 _0xee42=['Basic\x20','toString','setEncoding','utf8','data','statusCode','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','end','openIssue','send','body','headers','remoteAddress','socket','connection','bluebird','https','../../config/logger','support','3eAmWpBVP0','MOTGUI','summary','Report','description','stringify','issuetype','customfield_11500','email','customfield_11501','oldToken','fields','customfield_11502','newToken','name','customfield_11504','customfield_10102','track.xcallymotion.com','POST','application/json'];(function(_0x542d51,_0x3dfd29){var _0x369e01=function(_0x1d2822){while(--_0x1d2822){_0x542d51['push'](_0x542d51['shift']());}};_0x369e01(++_0x3dfd29);}(_0xee42,0xea));var _0x2ee4=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xee42[_0x2aec52];return _0x3b8835;};'use strict';var BPromise=require(_0x2ee4('0x0'));var https=require(_0x2ee4('0x1'));var logger=require(_0x2ee4('0x2'))('api');var USERNAME=_0x2ee4('0x3');var PASSWORD=_0x2ee4('0x4');function openIssue(_0x53f815,_0x3c5de6){var _0x38dfea={'fields':{'project':{'key':_0x53f815['key']||_0x2ee4('0x5')},'summary':(_0x53f815[_0x2ee4('0x6')]||_0x2ee4('0x7'))+'\x20from\x20'+_0x53f815['ip'],'description':_0x53f815[_0x2ee4('0x8')]||JSON[_0x2ee4('0x9')](_0x53f815),'issuetype':{'name':_0x53f815[_0x2ee4('0xa')]||'Bug'}}};_0x38dfea['fields'][_0x2ee4('0xb')]=_0x53f815[_0x2ee4('0xc')];_0x38dfea['fields'][_0x2ee4('0xd')]=_0x53f815[_0x2ee4('0xe')];_0x38dfea[_0x2ee4('0xf')][_0x2ee4('0x10')]=_0x53f815[_0x2ee4('0x11')];_0x38dfea[_0x2ee4('0xf')]['customfield_11503']=_0x53f815[_0x2ee4('0x12')];_0x38dfea['fields'][_0x2ee4('0x13')]=_0x53f815['reason'];_0x38dfea['fields'][_0x2ee4('0x14')]=_0x53f815['ip'];var _0x1b22ed={'host':_0x2ee4('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x2ee4('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x2ee4('0x17'),'Authorization':_0x2ee4('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x2ee4('0x19')]('base64')}};var _0xce4be6=JSON[_0x2ee4('0x9')](_0x38dfea);var _0x2ed717=https['request'](_0x1b22ed,function(_0x78b2db){_0x78b2db[_0x2ee4('0x1a')](_0x2ee4('0x1b'));var _0x28a6de='';_0x78b2db['on'](_0x2ee4('0x1c'),function(_0x24536d){_0x28a6de+=_0x24536d;});_0x78b2db['on']('end',function(){if(_0x3c5de6){return _0x3c5de6['status'](_0x78b2db[_0x2ee4('0x1d')])[_0x2ee4('0x1e')](JSON[_0x2ee4('0x1f')](_0x28a6de));}});});_0x2ed717['on'](_0x2ee4('0x20'),function(_0x4a18f0){if(_0x3c5de6){return _0x3c5de6[_0x2ee4('0x21')](0x1f4)[_0x2ee4('0x1e')]({'errors':[{'message':_0x2ee4('0x22'),'type':'api.jira'}]});}});_0x2ed717['write'](_0xce4be6);_0x2ed717[_0x2ee4('0x23')]();}exports[_0x2ee4('0x24')]=openIssue;exports[_0x2ee4('0x25')]=function(_0x2fabd1,_0x539c57){_0x2fabd1[_0x2ee4('0x26')]['ip']=_0x2fabd1[_0x2ee4('0x27')]['x-forwarded-for']||_0x2fabd1['connection'][_0x2ee4('0x28')]||_0x2fabd1[_0x2ee4('0x29')]['remoteAddress']||_0x2fabd1[_0x2ee4('0x2a')]['socket'][_0x2ee4('0x28')];return openIssue(_0x2fabd1[_0x2ee4('0x26')],_0x539c57);}; \ No newline at end of file +var _0x682a=['Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','description','stringify','Bug','customfield_11500','email','fields','customfield_11502','newToken','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','toString','setEncoding','utf8','end','status','statusCode','parse','error','json'];(function(_0x591e16,_0x5aefc1){var _0x543b35=function(_0x81e3be){while(--_0x81e3be){_0x591e16['push'](_0x591e16['shift']());}};_0x543b35(++_0x5aefc1);}(_0x682a,0x152));var _0xa682=function(_0xdab411,_0x1c4d4c){_0xdab411=_0xdab411-0x0;var _0x2d777b=_0x682a[_0xdab411];return _0x2d777b;};'use strict';var BPromise=require(_0xa682('0x0'));var https=require(_0xa682('0x1'));var logger=require(_0xa682('0x2'))(_0xa682('0x3'));var USERNAME=_0xa682('0x4');var PASSWORD=_0xa682('0x5');function openIssue(_0x520ccb,_0x58bb3d){var _0x31b845={'fields':{'project':{'key':_0x520ccb[_0xa682('0x6')]||_0xa682('0x7')},'summary':(_0x520ccb['summary']||'Report')+'\x20from\x20'+_0x520ccb['ip'],'description':_0x520ccb[_0xa682('0x8')]||JSON[_0xa682('0x9')](_0x520ccb),'issuetype':{'name':_0x520ccb['issuetype']||_0xa682('0xa')}}};_0x31b845['fields'][_0xa682('0xb')]=_0x520ccb[_0xa682('0xc')];_0x31b845['fields']['customfield_11501']=_0x520ccb['oldToken'];_0x31b845[_0xa682('0xd')][_0xa682('0xe')]=_0x520ccb[_0xa682('0xf')];_0x31b845[_0xa682('0xd')]['customfield_11503']=_0x520ccb['name'];_0x31b845[_0xa682('0xd')][_0xa682('0x10')]=_0x520ccb[_0xa682('0x11')];_0x31b845[_0xa682('0xd')][_0xa682('0x12')]=_0x520ccb['ip'];var _0x1abb32={'host':_0xa682('0x13'),'port':0x1bb,'path':_0xa682('0x14'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0xa682('0x15'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xa682('0x16')]('base64')}};var _0x345a96=JSON[_0xa682('0x9')](_0x31b845);var _0x1b444d=https['request'](_0x1abb32,function(_0x3d0ea2){_0x3d0ea2[_0xa682('0x17')](_0xa682('0x18'));var _0x396932='';_0x3d0ea2['on']('data',function(_0x4f35dd){_0x396932+=_0x4f35dd;});_0x3d0ea2['on'](_0xa682('0x19'),function(){if(_0x58bb3d){return _0x58bb3d[_0xa682('0x1a')](_0x3d0ea2[_0xa682('0x1b')])['json'](JSON[_0xa682('0x1c')](_0x396932));}});});_0x1b444d['on'](_0xa682('0x1d'),function(_0x5774db){if(_0x58bb3d){return _0x58bb3d[_0xa682('0x1a')](0x1f4)[_0xa682('0x1e')]({'errors':[{'message':_0xa682('0x1f'),'type':_0xa682('0x20')}]});}});_0x1b444d[_0xa682('0x21')](_0x345a96);_0x1b444d[_0xa682('0x19')]();}exports['openIssue']=openIssue;exports[_0xa682('0x22')]=function(_0xf2ddd5,_0x396776){_0xf2ddd5[_0xa682('0x23')]['ip']=_0xf2ddd5[_0xa682('0x24')][_0xa682('0x25')]||_0xf2ddd5['connection'][_0xa682('0x26')]||_0xf2ddd5[_0xa682('0x27')][_0xa682('0x26')]||_0xf2ddd5[_0xa682('0x28')][_0xa682('0x27')][_0xa682('0x26')];return openIssue(_0xf2ddd5[_0xa682('0x23')],_0x396776);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 71c9d68..19946de 100644 --- a/server/api/jscriptyAnswerReport/index.js +++ b/server/api/jscriptyAnswerReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','delete','destroy','util','connect-timeout','Router'];(function(_0x3b8201,_0xbb2b1b){var _0x598e43=function(_0x24ab92){while(--_0x24ab92){_0x3b8201['push'](_0x3b8201['shift']());}};_0x598e43(++_0xbb2b1b);}(_0x9bde,0xe1));var _0xe9bd=function(_0x5991b1,_0x18670f){_0x5991b1=_0x5991b1-0x0;var _0x2790f2=_0x9bde[_0x5991b1];return _0x2790f2;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var fs_extra=require(_0xe9bd('0x3'));var auth=require(_0xe9bd('0x4'));var interaction=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var controller=require(_0xe9bd('0x7'));router[_0xe9bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x9')]);router[_0xe9bd('0x8')](_0xe9bd('0xa'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xc')]);router[_0xe9bd('0x8')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe9bd('0x10')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller['update']);router[_0xe9bd('0x11')](_0xe9bd('0xd'),auth[_0xe9bd('0xb')](),controller[_0xe9bd('0x12')]);module['exports']=router; \ No newline at end of file +var _0xec56=['put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x2f174a,_0x373422){var _0x261635=function(_0xdf2901){while(--_0xdf2901){_0x2f174a['push'](_0x2f174a['shift']());}};_0x261635(++_0x373422);}(_0xec56,0x1bd));var _0x6ec5=function(_0x292519,_0x4c11f4){_0x292519=_0x292519-0x0;var _0x5c31f1=_0xec56[_0x292519];return _0x5c31f1;};'use strict';var multer=require(_0x6ec5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ec5('0x1'));var express=require(_0x6ec5('0x2'));var router=express[_0x6ec5('0x3')]();var fs_extra=require(_0x6ec5('0x4'));var auth=require(_0x6ec5('0x5'));var interaction=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var controller=require(_0x6ec5('0x8'));router[_0x6ec5('0x9')]('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xb')]);router[_0x6ec5('0x9')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xd')]);router[_0x6ec5('0x9')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xf')]);router['post']('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x10')]);router[_0x6ec5('0x11')](_0x6ec5('0xe'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x12')]);router[_0x6ec5('0x13')]('/:id',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x14')]);module[_0x6ec5('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index b85175d..19bb9b5 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7a54,0x106));var _0x47a5=function(_0x51dbac,_0x58dbe8){_0x51dbac=_0x51dbac-0x0;var _0x90f1a4=_0x7a54[_0x51dbac];return _0x90f1a4;};'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(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x7a54,0x106));var _0x47a5=function(_0x2663b9,_0x34494b){_0x2663b9=_0x2663b9-0x0;var _0x434b1b=_0x7a54[_0x2663b9];return _0x434b1b;};'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 8e670e9..de5b7ca 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 _0x7250=['crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','type','VIRTUAL','merge','includeAll','include','rows','catch','show','params','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','squel'];(function(_0x448f8,_0x2aa1d7){var _0xa73126=function(_0x1fcafa){while(--_0x1fcafa){_0x448f8['push'](_0x448f8['shift']());}};_0xa73126(++_0x2aa1d7);}(_0x7250,0x1b1));var _0x0725=function(_0x440529,_0x52205a){_0x440529=_0x440529-0x0;var _0x540dfc=_0x7250[_0x440529];return _0x540dfc;};'use strict';var emlformat=require(_0x0725('0x0'));var rimraf=require(_0x0725('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0725('0x2'));var rp=require(_0x0725('0x3'));var moment=require(_0x0725('0x4'));var BPromise=require(_0x0725('0x5'));var Mustache=require(_0x0725('0x6'));var util=require(_0x0725('0x7'));var path=require('path');var sox=require(_0x0725('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0725('0x9'));var _=require('lodash');var squel=require(_0x0725('0xa'));var crypto=require(_0x0725('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0725('0xc'));var toCsv=require(_0x0725('0xd'));var querystring=require(_0x0725('0xe'));var Papa=require(_0x0725('0xf'));var Redis=require(_0x0725('0x10'));var authService=require(_0x0725('0x11'));var qs=require(_0x0725('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0725('0x13'));var logger=require(_0x0725('0x14'))(_0x0725('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0725('0x16'));var db=require(_0x0725('0x17'))['db'];function respondWithStatusCode(_0x353a5f,_0x4024f3){_0x4024f3=_0x4024f3||0xcc;return function(_0x181725){if(_0x181725){return _0x353a5f[_0x0725('0x18')](_0x4024f3);}return _0x353a5f[_0x0725('0x19')](_0x4024f3)[_0x0725('0x1a')]();};}function respondWithResult(_0x5eead9,_0x4ab495){_0x4ab495=_0x4ab495||0xc8;return function(_0x180021){if(_0x180021){return _0x5eead9[_0x0725('0x19')](_0x4ab495)[_0x0725('0x1b')](_0x180021);}};}function respondWithFilteredResult(_0x163d77,_0x18b40a){return function(_0x14a229){if(_0x14a229){var _0x5c3cea=typeof _0x18b40a['offset']===_0x0725('0x1c')&&typeof _0x18b40a['limit']===_0x0725('0x1c');var _0x4dfc36=_0x14a229['count'];var _0x534c52=_0x5c3cea?0x0:_0x18b40a[_0x0725('0x1d')];var _0x21722a=_0x5c3cea?_0x14a229[_0x0725('0x1e')]:_0x18b40a[_0x0725('0x1d')]+_0x18b40a[_0x0725('0x1f')];var _0x2364ad;if(_0x21722a>=_0x4dfc36){_0x21722a=_0x4dfc36;_0x2364ad=0xc8;}else{_0x2364ad=0xce;}_0x163d77[_0x0725('0x19')](_0x2364ad);return _0x163d77[_0x0725('0x20')](_0x0725('0x21'),_0x534c52+'-'+_0x21722a+'/'+_0x4dfc36)[_0x0725('0x1b')](_0x14a229);}return null;};}function patchUpdates(_0x194c5f){return function(_0x4b04a3){try{jsonpatch[_0x0725('0x22')](_0x4b04a3,_0x194c5f,!![]);}catch(_0x316a6e){return BPromise[_0x0725('0x23')](_0x316a6e);}return _0x4b04a3[_0x0725('0x24')]();};}function saveUpdates(_0x1934af,_0x4f44c8){return function(_0x5d2966){if(_0x5d2966){return _0x5d2966[_0x0725('0x25')](_0x1934af)[_0x0725('0x26')](function(_0x51f1bd){return _0x51f1bd;});}return null;};}function removeEntity(_0x5c2850,_0x4597a4){return function(_0x3cc430){if(_0x3cc430){return _0x3cc430[_0x0725('0x27')]()[_0x0725('0x26')](function(){_0x5c2850[_0x0725('0x19')](0xcc)[_0x0725('0x1a')]();});}};}function handleEntityNotFound(_0x4b52ca,_0x257bcb){return function(_0x5ec7de){if(!_0x5ec7de){_0x4b52ca['sendStatus'](0x194);}return _0x5ec7de;};}function handleError(_0x5b63ae,_0x5560c4){_0x5560c4=_0x5560c4||0x1f4;return function(_0x10af19){logger[_0x0725('0x28')](_0x10af19['stack']);if(_0x10af19[_0x0725('0x29')]){delete _0x10af19[_0x0725('0x29')];}_0x5b63ae[_0x0725('0x19')](_0x5560c4)[_0x0725('0x2a')](_0x10af19);};}exports['index']=function(_0x587c61,_0x131f2b){var _0x11e7d1={},_0x73d6ab={},_0xb1578b={'count':0x0,'rows':[]};var _0x50f9a9=_[_0x0725('0x2b')](db[_0x0725('0x2c')][_0x0725('0x2d')],function(_0x553fae){return{'name':_0x553fae[_0x0725('0x2e')],'type':_0x553fae['type'][_0x0725('0x2f')]};});_0x73d6ab[_0x0725('0x30')]=_['map'](_0x50f9a9,_0x0725('0x29'));_0x73d6ab[_0x0725('0x31')]=_[_0x0725('0x32')](_0x587c61[_0x0725('0x31')]);_0x73d6ab[_0x0725('0x33')]=_[_0x0725('0x34')](_0x73d6ab[_0x0725('0x30')],_0x73d6ab[_0x0725('0x31')]);_0x11e7d1[_0x0725('0x35')]=_['intersection'](_0x73d6ab['model'],qs[_0x0725('0x36')](_0x587c61['query'][_0x0725('0x36')]));_0x11e7d1['attributes']=_0x11e7d1[_0x0725('0x35')][_0x0725('0x37')]?_0x11e7d1[_0x0725('0x35')]:_0x73d6ab[_0x0725('0x30')];if(!_0x587c61[_0x0725('0x31')][_0x0725('0x38')](_0x0725('0x39'))){_0x11e7d1[_0x0725('0x1f')]=qs[_0x0725('0x1f')](_0x587c61['query'][_0x0725('0x1f')]);_0x11e7d1['offset']=qs[_0x0725('0x1d')](_0x587c61[_0x0725('0x31')]['offset']);}_0x11e7d1['order']=qs[_0x0725('0x3a')](_0x587c61[_0x0725('0x31')][_0x0725('0x3a')]);_0x11e7d1['where']=qs['filters'](_['pick'](_0x587c61[_0x0725('0x31')],_0x73d6ab[_0x0725('0x33')]),_0x50f9a9);if(_0x587c61[_0x0725('0x31')][_0x0725('0x3b')]){_0x11e7d1[_0x0725('0x3c')]=_['merge'](_0x11e7d1[_0x0725('0x3c')],{'$or':_[_0x0725('0x2b')](_0x50f9a9,function(_0xec26ab){if(_0xec26ab[_0x0725('0x3d')]!==_0x0725('0x3e')){var _0x2ad78b={};_0x2ad78b[_0xec26ab[_0x0725('0x29')]]={'$like':'%'+_0x587c61[_0x0725('0x31')][_0x0725('0x3b')]+'%'};return _0x2ad78b;}})});}_0x11e7d1=_[_0x0725('0x3f')]({},_0x11e7d1,_0x587c61['options']);var _0x16920d={'where':_0x11e7d1[_0x0725('0x3c')]};return db['JscriptyAnswerReport'][_0x0725('0x1e')](_0x16920d)[_0x0725('0x26')](function(_0x2dda54){_0xb1578b[_0x0725('0x1e')]=_0x2dda54;if(_0x587c61[_0x0725('0x31')][_0x0725('0x40')]){_0x11e7d1[_0x0725('0x41')]=[{'all':!![]}];}return db[_0x0725('0x2c')]['findAll'](_0x11e7d1);})[_0x0725('0x26')](function(_0x4f4066){_0xb1578b[_0x0725('0x42')]=_0x4f4066;return _0xb1578b;})[_0x0725('0x26')](respondWithFilteredResult(_0x131f2b,_0x11e7d1))[_0x0725('0x43')](handleError(_0x131f2b,null));};exports[_0x0725('0x44')]=function(_0x310471,_0x66f840){var _0x3aebcb={'raw':!![],'where':{'id':_0x310471[_0x0725('0x45')]['id']}},_0x224def={};_0x224def['model']=_[_0x0725('0x32')](db[_0x0725('0x2c')][_0x0725('0x2d')]);_0x224def[_0x0725('0x31')]=_[_0x0725('0x32')](_0x310471[_0x0725('0x31')]);_0x224def[_0x0725('0x33')]=_[_0x0725('0x34')](_0x224def[_0x0725('0x30')],_0x224def[_0x0725('0x31')]);_0x3aebcb[_0x0725('0x35')]=_[_0x0725('0x34')](_0x224def[_0x0725('0x30')],qs['fields'](_0x310471[_0x0725('0x31')][_0x0725('0x36')]));_0x3aebcb[_0x0725('0x35')]=_0x3aebcb[_0x0725('0x35')][_0x0725('0x37')]?_0x3aebcb[_0x0725('0x35')]:_0x224def[_0x0725('0x30')];if(_0x310471['query']['includeAll']){_0x3aebcb['include']=[{'all':!![]}];}_0x3aebcb=_[_0x0725('0x3f')]({},_0x3aebcb,_0x310471[_0x0725('0x46')]);return db[_0x0725('0x2c')]['find'](_0x3aebcb)[_0x0725('0x26')](handleEntityNotFound(_0x66f840,null))[_0x0725('0x26')](respondWithResult(_0x66f840,null))[_0x0725('0x43')](handleError(_0x66f840,null));};exports['create']=function(_0x415a0f,_0x1a4b19){return db['JscriptyAnswerReport'][_0x0725('0x47')](_0x415a0f[_0x0725('0x48')],{})[_0x0725('0x26')](respondWithResult(_0x1a4b19,0xc9))[_0x0725('0x43')](handleError(_0x1a4b19,null));};exports[_0x0725('0x25')]=function(_0xcd6c87,_0x191ea2){if(_0xcd6c87[_0x0725('0x48')]['id']){delete _0xcd6c87['body']['id'];}return db[_0x0725('0x2c')][_0x0725('0x49')]({'where':{'id':_0xcd6c87[_0x0725('0x45')]['id']}})['then'](handleEntityNotFound(_0x191ea2,null))['then'](saveUpdates(_0xcd6c87[_0x0725('0x48')],null))[_0x0725('0x26')](respondWithResult(_0x191ea2,null))[_0x0725('0x43')](handleError(_0x191ea2,null));};exports[_0x0725('0x27')]=function(_0x44a3da,_0x1b0043){return db[_0x0725('0x2c')][_0x0725('0x49')]({'where':{'id':_0x44a3da['params']['id']}})['then'](handleEntityNotFound(_0x1b0043,null))[_0x0725('0x26')](removeEntity(_0x1b0043,null))[_0x0725('0x43')](handleError(_0x1b0043,null));};exports['describe']=function(_0x434e96,_0x18d615){return db[_0x0725('0x2c')]['describe']()[_0x0725('0x26')](respondWithResult(_0x18d615,null))[_0x0725('0x43')](handleError(_0x18d615,null));}; \ No newline at end of file +var _0x8c46=['filter','VIRTUAL','merge','options','include','JscriptyAnswerReport','rows','catch','includeAll','find','create','body','params','describe','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick'];(function(_0x2d8e84,_0x14ad2e){var _0x508d3b=function(_0x644bc7){while(--_0x644bc7){_0x2d8e84['push'](_0x2d8e84['shift']());}};_0x508d3b(++_0x14ad2e);}(_0x8c46,0x171));var _0x68c4=function(_0x2927f6,_0x53bdb3){_0x2927f6=_0x2927f6-0x0;var _0x57bd36=_0x8c46[_0x2927f6];return _0x57bd36;};'use strict';var emlformat=require(_0x68c4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x68c4('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x68c4('0x2'));var Mustache=require(_0x68c4('0x3'));var util=require(_0x68c4('0x4'));var path=require(_0x68c4('0x5'));var sox=require(_0x68c4('0x6'));var csv=require(_0x68c4('0x7'));var ejs=require(_0x68c4('0x8'));var fs=require('fs');var fs_extra=require(_0x68c4('0x9'));var _=require(_0x68c4('0xa'));var squel=require(_0x68c4('0xb'));var crypto=require('crypto');var jsforce=require(_0x68c4('0xc'));var deskjs=require(_0x68c4('0xd'));var toCsv=require(_0x68c4('0x7'));var querystring=require('querystring');var Papa=require(_0x68c4('0xe'));var Redis=require(_0x68c4('0xf'));var authService=require(_0x68c4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68c4('0x11'));var logger=require(_0x68c4('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x68c4('0x13'));var licenseUtil=require(_0x68c4('0x14'));var db=require(_0x68c4('0x15'))['db'];function respondWithStatusCode(_0x48783b,_0x3a432a){_0x3a432a=_0x3a432a||0xcc;return function(_0x1f5f42){if(_0x1f5f42){return _0x48783b[_0x68c4('0x16')](_0x3a432a);}return _0x48783b['status'](_0x3a432a)[_0x68c4('0x17')]();};}function respondWithResult(_0x14919c,_0x5e1341){_0x5e1341=_0x5e1341||0xc8;return function(_0x52f031){if(_0x52f031){return _0x14919c[_0x68c4('0x18')](_0x5e1341)[_0x68c4('0x19')](_0x52f031);}};}function respondWithFilteredResult(_0x5be0de,_0xc25f7b){return function(_0x4ea2a4){if(_0x4ea2a4){var _0x1a7045=typeof _0xc25f7b['offset']==='undefined'&&typeof _0xc25f7b[_0x68c4('0x1a')]===_0x68c4('0x1b');var _0x4f4797=_0x4ea2a4[_0x68c4('0x1c')];var _0x1d757c=_0x1a7045?0x0:_0xc25f7b[_0x68c4('0x1d')];var _0x33c5c5=_0x1a7045?_0x4ea2a4[_0x68c4('0x1c')]:_0xc25f7b[_0x68c4('0x1d')]+_0xc25f7b[_0x68c4('0x1a')];var _0x415ef2;if(_0x33c5c5>=_0x4f4797){_0x33c5c5=_0x4f4797;_0x415ef2=0xc8;}else{_0x415ef2=0xce;}_0x5be0de[_0x68c4('0x18')](_0x415ef2);return _0x5be0de[_0x68c4('0x1e')](_0x68c4('0x1f'),_0x1d757c+'-'+_0x33c5c5+'/'+_0x4f4797)['json'](_0x4ea2a4);}return null;};}function patchUpdates(_0x398a71){return function(_0x4edf9f){try{jsonpatch['apply'](_0x4edf9f,_0x398a71,!![]);}catch(_0x34d3a6){return BPromise[_0x68c4('0x20')](_0x34d3a6);}return _0x4edf9f[_0x68c4('0x21')]();};}function saveUpdates(_0x42f0bc,_0x5b8135){return function(_0x35e865){if(_0x35e865){return _0x35e865[_0x68c4('0x22')](_0x42f0bc)['then'](function(_0x201742){return _0x201742;});}return null;};}function removeEntity(_0x392ccf,_0x45f9be){return function(_0x10278e){if(_0x10278e){return _0x10278e[_0x68c4('0x23')]()[_0x68c4('0x24')](function(){_0x392ccf[_0x68c4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ff4a5,_0x55355d){return function(_0xf16a78){if(!_0xf16a78){_0x2ff4a5[_0x68c4('0x16')](0x194);}return _0xf16a78;};}function handleError(_0x57f32,_0x4f9d32){_0x4f9d32=_0x4f9d32||0x1f4;return function(_0x1e14db){logger[_0x68c4('0x25')](_0x1e14db[_0x68c4('0x26')]);if(_0x1e14db[_0x68c4('0x27')]){delete _0x1e14db[_0x68c4('0x27')];}_0x57f32[_0x68c4('0x18')](_0x4f9d32)[_0x68c4('0x28')](_0x1e14db);};}exports['index']=function(_0x26d56b,_0x4b4634){var _0x3772b3={},_0x1442ba={},_0x56ed70={'count':0x0,'rows':[]};var _0x2847d1=_[_0x68c4('0x29')](db['JscriptyAnswerReport'][_0x68c4('0x2a')],function(_0x3a1b69){return{'name':_0x3a1b69[_0x68c4('0x2b')],'type':_0x3a1b69[_0x68c4('0x2c')][_0x68c4('0x2d')]};});_0x1442ba[_0x68c4('0x2e')]=_[_0x68c4('0x29')](_0x2847d1,_0x68c4('0x27'));_0x1442ba[_0x68c4('0x2f')]=_[_0x68c4('0x30')](_0x26d56b[_0x68c4('0x2f')]);_0x1442ba[_0x68c4('0x31')]=_[_0x68c4('0x32')](_0x1442ba[_0x68c4('0x2e')],_0x1442ba[_0x68c4('0x2f')]);_0x3772b3[_0x68c4('0x33')]=_[_0x68c4('0x32')](_0x1442ba[_0x68c4('0x2e')],qs['fields'](_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x34')]));_0x3772b3[_0x68c4('0x33')]=_0x3772b3[_0x68c4('0x33')][_0x68c4('0x35')]?_0x3772b3['attributes']:_0x1442ba[_0x68c4('0x2e')];if(!_0x26d56b['query']['hasOwnProperty']('nolimit')){_0x3772b3[_0x68c4('0x1a')]=qs[_0x68c4('0x1a')](_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x1a')]);_0x3772b3['offset']=qs[_0x68c4('0x1d')](_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x1d')]);}_0x3772b3['order']=qs[_0x68c4('0x36')](_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x36')]);_0x3772b3[_0x68c4('0x37')]=qs[_0x68c4('0x31')](_[_0x68c4('0x38')](_0x26d56b[_0x68c4('0x2f')],_0x1442ba[_0x68c4('0x31')]),_0x2847d1);if(_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x39')]){_0x3772b3['where']=_['merge'](_0x3772b3[_0x68c4('0x37')],{'$or':_[_0x68c4('0x29')](_0x2847d1,function(_0x460e11){if(_0x460e11[_0x68c4('0x2c')]!==_0x68c4('0x3a')){var _0x13386d={};_0x13386d[_0x460e11[_0x68c4('0x27')]]={'$like':'%'+_0x26d56b[_0x68c4('0x2f')][_0x68c4('0x39')]+'%'};return _0x13386d;}})});}_0x3772b3=_[_0x68c4('0x3b')]({},_0x3772b3,_0x26d56b[_0x68c4('0x3c')]);var _0x30a1cd={'where':_0x3772b3[_0x68c4('0x37')]};return db['JscriptyAnswerReport']['count'](_0x30a1cd)[_0x68c4('0x24')](function(_0x2785b4){_0x56ed70[_0x68c4('0x1c')]=_0x2785b4;if(_0x26d56b[_0x68c4('0x2f')]['includeAll']){_0x3772b3[_0x68c4('0x3d')]=[{'all':!![]}];}return db[_0x68c4('0x3e')]['findAll'](_0x3772b3);})['then'](function(_0x4c564a){_0x56ed70[_0x68c4('0x3f')]=_0x4c564a;return _0x56ed70;})['then'](respondWithFilteredResult(_0x4b4634,_0x3772b3))[_0x68c4('0x40')](handleError(_0x4b4634,null));};exports['show']=function(_0x18da6f,_0x2406b1){var _0xbd848f={'raw':!![],'where':{'id':_0x18da6f['params']['id']}},_0xefe68d={};_0xefe68d[_0x68c4('0x2e')]=_[_0x68c4('0x30')](db[_0x68c4('0x3e')][_0x68c4('0x2a')]);_0xefe68d['query']=_[_0x68c4('0x30')](_0x18da6f[_0x68c4('0x2f')]);_0xefe68d[_0x68c4('0x31')]=_[_0x68c4('0x32')](_0xefe68d[_0x68c4('0x2e')],_0xefe68d['query']);_0xbd848f['attributes']=_['intersection'](_0xefe68d[_0x68c4('0x2e')],qs[_0x68c4('0x34')](_0x18da6f[_0x68c4('0x2f')][_0x68c4('0x34')]));_0xbd848f['attributes']=_0xbd848f[_0x68c4('0x33')][_0x68c4('0x35')]?_0xbd848f[_0x68c4('0x33')]:_0xefe68d[_0x68c4('0x2e')];if(_0x18da6f[_0x68c4('0x2f')][_0x68c4('0x41')]){_0xbd848f[_0x68c4('0x3d')]=[{'all':!![]}];}_0xbd848f=_[_0x68c4('0x3b')]({},_0xbd848f,_0x18da6f[_0x68c4('0x3c')]);return db[_0x68c4('0x3e')][_0x68c4('0x42')](_0xbd848f)['then'](handleEntityNotFound(_0x2406b1,null))[_0x68c4('0x24')](respondWithResult(_0x2406b1,null))['catch'](handleError(_0x2406b1,null));};exports[_0x68c4('0x43')]=function(_0x44e3c9,_0x463a6b){return db[_0x68c4('0x3e')]['create'](_0x44e3c9[_0x68c4('0x44')],{})['then'](respondWithResult(_0x463a6b,0xc9))[_0x68c4('0x40')](handleError(_0x463a6b,null));};exports[_0x68c4('0x22')]=function(_0x570e25,_0x250941){if(_0x570e25[_0x68c4('0x44')]['id']){delete _0x570e25[_0x68c4('0x44')]['id'];}return db[_0x68c4('0x3e')][_0x68c4('0x42')]({'where':{'id':_0x570e25[_0x68c4('0x45')]['id']}})['then'](handleEntityNotFound(_0x250941,null))[_0x68c4('0x24')](saveUpdates(_0x570e25[_0x68c4('0x44')],null))[_0x68c4('0x24')](respondWithResult(_0x250941,null))[_0x68c4('0x40')](handleError(_0x250941,null));};exports['destroy']=function(_0x40ecf6,_0x19aec2){return db[_0x68c4('0x3e')][_0x68c4('0x42')]({'where':{'id':_0x40ecf6[_0x68c4('0x45')]['id']}})[_0x68c4('0x24')](handleEntityNotFound(_0x19aec2,null))['then'](removeEntity(_0x19aec2,null))[_0x68c4('0x40')](handleError(_0x19aec2,null));};exports[_0x68c4('0x46')]=function(_0x3db854,_0x51db14){return db[_0x68c4('0x3e')][_0x68c4('0x46')]()['then'](respondWithResult(_0x51db14,null))['catch'](handleError(_0x51db14,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 8362592..92f6e74 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 _0xd509=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','lodash','util'];(function(_0x5ce726,_0x411fe8){var _0x103552=function(_0x4d5121){while(--_0x4d5121){_0x5ce726['push'](_0x5ce726['shift']());}};_0x103552(++_0x411fe8);}(_0xd509,0x80));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9d50('0x0'));var util=require(_0x9d50('0x1'));var logger=require(_0x9d50('0x2'))(_0x9d50('0x3'));var moment=require(_0x9d50('0x4'));var BPromise=require(_0x9d50('0x5'));var rp=require(_0x9d50('0x6'));var fs=require('fs');var path=require(_0x9d50('0x7'));var rimraf=require('rimraf');var config=require(_0x9d50('0x8'));var attributes=require(_0x9d50('0x9'));module[_0x9d50('0xa')]=function(_0x52c56b,_0x4f3d5e){return _0x52c56b[_0x9d50('0xb')]('JscriptyAnswerReport',attributes,{'tableName':_0x9d50('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdac2=['rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','lodash','util','api','bluebird','path'];(function(_0xc3e15c,_0x5871b6){var _0x4c0204=function(_0x488f15){while(--_0x488f15){_0xc3e15c['push'](_0xc3e15c['shift']());}};_0x4c0204(++_0x5871b6);}(_0xdac2,0x13b));var _0x2dac=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0xdac2[_0x4c7935];return _0x30651d;};'use strict';var _=require(_0x2dac('0x0'));var util=require(_0x2dac('0x1'));var logger=require('../../config/logger')(_0x2dac('0x2'));var moment=require('moment');var BPromise=require(_0x2dac('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2dac('0x4'));var rimraf=require(_0x2dac('0x5'));var config=require(_0x2dac('0x6'));var attributes=require(_0x2dac('0x7'));module['exports']=function(_0x2143bc,_0xd6e4eb){return _0x2143bc[_0x2dac('0x8')](_0x2dac('0x9'),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 6d9b861..6875adb 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 _0x8451=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x3e0e8a,_0x38e31e){var _0x2c7aaf=function(_0x56e191){while(--_0x56e191){_0x3e0e8a['push'](_0x3e0e8a['shift']());}};_0x2c7aaf(++_0x38e31e);}(_0x8451,0x1f1));var _0x1845=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x8451[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0x1845('0x0'));var util=require('util');var moment=require(_0x1845('0x1'));var BPromise=require(_0x1845('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1845('0x3'));var logger=require(_0x1845('0x4'))(_0x1845('0x5'));var config=require('../../config/environment');var jayson=require(_0x1845('0x6'));var client=jayson[_0x1845('0x7')][_0x1845('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x557125,_0x4546b4,_0x5888da){return new BPromise(function(_0x553038,_0x30e2ba){return client['request'](_0x557125,_0x5888da)[_0x1845('0x9')](function(_0x1ce910){logger[_0x1845('0xa')](_0x1845('0xb'),_0x4546b4,_0x1845('0xc'));logger['debug'](_0x1845('0xd'),_0x4546b4,'request\x20sent',JSON[_0x1845('0xe')](_0x1ce910));if(_0x1ce910[_0x1845('0xf')]){if(_0x1ce910[_0x1845('0xf')][_0x1845('0x10')]===0x1f4){logger[_0x1845('0xf')](_0x1845('0xb'),_0x4546b4,_0x1ce910[_0x1845('0xf')]['message']);return _0x30e2ba(_0x1ce910[_0x1845('0xf')][_0x1845('0x11')]);}logger[_0x1845('0xf')](_0x1845('0xb'),_0x4546b4,_0x1ce910[_0x1845('0xf')][_0x1845('0x11')]);return _0x553038(_0x1ce910['error'][_0x1845('0x11')]);}else{logger['info'](_0x1845('0xb'),_0x4546b4,_0x1845('0xc'));_0x553038(_0x1ce910[_0x1845('0x12')][_0x1845('0x11')]);}})[_0x1845('0x13')](function(_0x3d98b4){logger[_0x1845('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4546b4,_0x3d98b4);_0x30e2ba(_0x3d98b4);});});} \ No newline at end of file +var _0x6664=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x5a3599,_0x5b349a){var _0x4a9107=function(_0x5f76f5){while(--_0x5f76f5){_0x5a3599['push'](_0x5a3599['shift']());}};_0x4a9107(++_0x5b349a);}(_0x6664,0x74));var _0x4666=function(_0x30d25b,_0x37748a){_0x30d25b=_0x30d25b-0x0;var _0x52e28c=_0x6664[_0x30d25b];return _0x52e28c;};'use strict';var _=require(_0x4666('0x0'));var util=require(_0x4666('0x1'));var moment=require('moment');var BPromise=require(_0x4666('0x2'));var rs=require(_0x4666('0x3'));var fs=require('fs');var Redis=require(_0x4666('0x4'));var db=require(_0x4666('0x5'))['db'];var utils=require(_0x4666('0x6'));var logger=require(_0x4666('0x7'))(_0x4666('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4666('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3752bf,_0x1cd7ee,_0x2f8d52){return new BPromise(function(_0x44f089,_0x49d46e){return client['request'](_0x3752bf,_0x2f8d52)[_0x4666('0xa')](function(_0x277b8b){logger[_0x4666('0xb')](_0x4666('0xc'),_0x1cd7ee,_0x4666('0xd'));logger[_0x4666('0xe')](_0x4666('0xf'),_0x1cd7ee,_0x4666('0xd'),JSON['stringify'](_0x277b8b));if(_0x277b8b['error']){if(_0x277b8b[_0x4666('0x10')]['code']===0x1f4){logger[_0x4666('0x10')](_0x4666('0xc'),_0x1cd7ee,_0x277b8b['error'][_0x4666('0x11')]);return _0x49d46e(_0x277b8b['error']['message']);}logger[_0x4666('0x10')](_0x4666('0xc'),_0x1cd7ee,_0x277b8b[_0x4666('0x10')][_0x4666('0x11')]);return _0x44f089(_0x277b8b['error'][_0x4666('0x11')]);}else{logger[_0x4666('0xb')](_0x4666('0xc'),_0x1cd7ee,'request\x20sent');_0x44f089(_0x277b8b[_0x4666('0x12')][_0x4666('0x11')]);}})[_0x4666('0x13')](function(_0x476ace){logger[_0x4666('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1cd7ee,_0x476ace);_0x49d46e(_0x476ace);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 67dde3c..3f9a356 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 _0x521c=['./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x261f47,_0x5a179d){var _0x213805=function(_0xc2ebc9){while(--_0xc2ebc9){_0x261f47['push'](_0x261f47['shift']());}};_0x213805(++_0x5a179d);}(_0x521c,0xf3));var _0xc521=function(_0x2ced76,_0x24cd81){_0x2ced76=_0x2ced76-0x0;var _0x46e2eb=_0x521c[_0x2ced76];return _0x46e2eb;};'use strict';var multer=require(_0xc521('0x0'));var util=require(_0xc521('0x1'));var path=require(_0xc521('0x2'));var timeout=require(_0xc521('0x3'));var express=require('express');var router=express[_0xc521('0x4')]();var fs_extra=require(_0xc521('0x5'));var auth=require(_0xc521('0x6'));var interaction=require(_0xc521('0x7'));var config=require(_0xc521('0x8'));var controller=require(_0xc521('0x9'));router['get']('/',auth[_0xc521('0xa')](),controller[_0xc521('0xb')]);router[_0xc521('0xc')](_0xc521('0xd'),auth[_0xc521('0xa')](),controller[_0xc521('0xe')]);router[_0xc521('0xc')](_0xc521('0xf'),auth[_0xc521('0xa')](),controller[_0xc521('0x10')]);router['get'](_0xc521('0x11'),auth['isAuthenticated'](),controller[_0xc521('0x12')]);router[_0xc521('0xc')](_0xc521('0x13'),auth[_0xc521('0xa')](),timeout(_0xc521('0x14')),controller[_0xc521('0x15')]);router[_0xc521('0x16')]('/',auth[_0xc521('0xa')](),controller['create']);router[_0xc521('0x16')](_0xc521('0x17'),auth[_0xc521('0xa')](),controller['clone']);router['put'](_0xc521('0xd'),auth['isAuthenticated'](),controller[_0xc521('0x18')]);router[_0xc521('0x19')](_0xc521('0xd'),auth[_0xc521('0xa')](),controller[_0xc521('0x1a')]);module[_0xc521('0x1b')]=router; \ No newline at end of file +var _0x9303=['post','/:id/clone','clone','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','getAnswers','30s','getSummary','create'];(function(_0x1d5966,_0x196f2d){var _0x261bd5=function(_0x361952){while(--_0x361952){_0x1d5966['push'](_0x1d5966['shift']());}};_0x261bd5(++_0x196f2d);}(_0x9303,0x1dc));var _0x3930=function(_0x25c7fb,_0x2e4e86){_0x25c7fb=_0x25c7fb-0x0;var _0x214b77=_0x9303[_0x25c7fb];return _0x214b77;};'use strict';var multer=require(_0x3930('0x0'));var util=require(_0x3930('0x1'));var path=require(_0x3930('0x2'));var timeout=require(_0x3930('0x3'));var express=require(_0x3930('0x4'));var router=express[_0x3930('0x5')]();var fs_extra=require(_0x3930('0x6'));var auth=require(_0x3930('0x7'));var interaction=require(_0x3930('0x8'));var config=require(_0x3930('0x9'));var controller=require(_0x3930('0xa'));router[_0x3930('0xb')]('/',auth[_0x3930('0xc')](),controller[_0x3930('0xd')]);router['get']('/:id',auth[_0x3930('0xc')](),controller['show']);router[_0x3930('0xb')]('/:id/sessions',auth[_0x3930('0xc')](),controller['getSessions']);router[_0x3930('0xb')]('/:id/answers',auth[_0x3930('0xc')](),controller[_0x3930('0xe')]);router[_0x3930('0xb')]('/:id/summary',auth[_0x3930('0xc')](),timeout(_0x3930('0xf')),controller[_0x3930('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3930('0x11')]);router[_0x3930('0x12')](_0x3930('0x13'),auth[_0x3930('0xc')](),controller[_0x3930('0x14')]);router[_0x3930('0x15')](_0x3930('0x16'),auth[_0x3930('0xc')](),controller[_0x3930('0x17')]);router[_0x3930('0x18')](_0x3930('0x16'),auth['isAuthenticated'](),controller['destroy']);module[_0x3930('0x19')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index d1bc099..e1fe5fa 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 _0x20fb=['formData','setDataValue','format','name','getDataValue','BOOLEAN','sequelize','lodash','util','exports','STRING','long','stringify'];(function(_0x58a4ab,_0x32d18c){var _0x3067ec=function(_0x262170){while(--_0x262170){_0x58a4ab['push'](_0x58a4ab['shift']());}};_0x3067ec(++_0x32d18c);}(_0x20fb,0xc9));var _0xb20f=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x20fb[_0x4b7b62];return _0x2280df;};'use strict';var Sequelize=require(_0xb20f('0x0'));var _=require(_0xb20f('0x1'));var util=require(_0xb20f('0x2'));module[_0xb20f('0x3')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xb20f('0x4')]},'formData':{'type':Sequelize['TEXT'](_0xb20f('0x5')),'set':function(_0x152033){if(_['isObjectLike'](_0x152033)){this['setDataValue']('formData',JSON[_0xb20f('0x6')](_0x152033));}else if(_['isString'](_0x152033)){this['setDataValue'](_0xb20f('0x7'),_0x152033);}else{this[_0xb20f('0x8')]('formData',util[_0xb20f('0x9')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0xb20f('0xa'))||'',this[_0xb20f('0xb')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb20f('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xb20f('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0x759a=['stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','description','BOOLEAN','sequelize','lodash','util','STRING','TEXT','isObjectLike','setDataValue'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x759a,0xf9));var _0xa759=function(_0x440172,_0x56443c){_0x440172=_0x440172-0x0;var _0x4e243d=_0x759a[_0x440172];return _0x4e243d;};'use strict';var Sequelize=require(_0xa759('0x0'));var _=require(_0xa759('0x1'));var util=require(_0xa759('0x2'));module['exports']={'name':{'type':Sequelize[_0xa759('0x3')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xa759('0x4')]('long'),'set':function(_0x4f7e36){if(_[_0xa759('0x5')](_0x4f7e36)){this[_0xa759('0x6')]('formData',JSON[_0xa759('0x7')](_0x4f7e36));}else if(_[_0xa759('0x8')](_0x4f7e36)){this[_0xa759('0x6')](_0xa759('0x9'),_0x4f7e36);}else{this[_0xa759('0x6')](_0xa759('0x9'),util[_0xa759('0xa')](_0xa759('0xb'),this[_0xa759('0xc')](_0xa759('0xd'))||'',this[_0xa759('0xc')](_0xa759('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xa759('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 0658b06..fc9a0e0 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 _0x7461=['end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','fields','length','body','user','role','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','Projects','getSessions','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7461,0xdb));var _0x1746=function(_0x295a92,_0x7d70dc){_0x295a92=_0x295a92-0x0;var _0x3f5dac=_0x7461[_0x295a92];return _0x3f5dac;};'use strict';var emlformat=require(_0x1746('0x0'));var rimraf=require(_0x1746('0x1'));var zipdir=require(_0x1746('0x2'));var jsonpatch=require(_0x1746('0x3'));var rp=require(_0x1746('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x1746('0x5'));var sox=require(_0x1746('0x6'));var csv=require(_0x1746('0x7'));var ejs=require(_0x1746('0x8'));var fs=require('fs');var fs_extra=require(_0x1746('0x9'));var _=require(_0x1746('0xa'));var squel=require(_0x1746('0xb'));var crypto=require(_0x1746('0xc'));var jsforce=require(_0x1746('0xd'));var deskjs=require(_0x1746('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1746('0xf'));var Papa=require('papaparse');var Redis=require(_0x1746('0x10'));var authService=require(_0x1746('0x11'));var qs=require(_0x1746('0x12'));var as=require(_0x1746('0x13'));var hardwareService=require(_0x1746('0x14'));var logger=require(_0x1746('0x15'))(_0x1746('0x16'));var utils=require(_0x1746('0x17'));var config=require(_0x1746('0x18'));var licenseUtil=require(_0x1746('0x19'));var db=require(_0x1746('0x1a'))['db'];function respondWithStatusCode(_0x39b57e,_0x35f0b0){_0x35f0b0=_0x35f0b0||0xcc;return function(_0x11ea81){if(_0x11ea81){return _0x39b57e[_0x1746('0x1b')](_0x35f0b0);}return _0x39b57e[_0x1746('0x1c')](_0x35f0b0)[_0x1746('0x1d')]();};}function respondWithResult(_0x243cad,_0x2b2ec8){_0x2b2ec8=_0x2b2ec8||0xc8;return function(_0x5654d7){if(_0x5654d7){return _0x243cad[_0x1746('0x1c')](_0x2b2ec8)[_0x1746('0x1e')](_0x5654d7);}};}function respondWithFilteredResult(_0x19f09d,_0x3bb7bd){return function(_0x34880f){if(_0x34880f){var _0x32e67f=typeof _0x3bb7bd['offset']===_0x1746('0x1f')&&typeof _0x3bb7bd[_0x1746('0x20')]===_0x1746('0x1f');var _0x1f4dd5=_0x34880f[_0x1746('0x21')];var _0x47aaf4=_0x32e67f?0x0:_0x3bb7bd[_0x1746('0x22')];var _0x1545c3=_0x32e67f?_0x34880f[_0x1746('0x21')]:_0x3bb7bd[_0x1746('0x22')]+_0x3bb7bd['limit'];var _0x4461f2;if(_0x1545c3>=_0x1f4dd5){_0x1545c3=_0x1f4dd5;_0x4461f2=0xc8;}else{_0x4461f2=0xce;}_0x19f09d[_0x1746('0x1c')](_0x4461f2);return _0x19f09d[_0x1746('0x23')](_0x1746('0x24'),_0x47aaf4+'-'+_0x1545c3+'/'+_0x1f4dd5)[_0x1746('0x1e')](_0x34880f);}return null;};}function patchUpdates(_0xab2a5a){return function(_0x28ecc0){try{jsonpatch[_0x1746('0x25')](_0x28ecc0,_0xab2a5a,!![]);}catch(_0x9e1a77){return BPromise[_0x1746('0x26')](_0x9e1a77);}return _0x28ecc0[_0x1746('0x27')]();};}function saveUpdates(_0x34f0d8,_0xb87d6e){return function(_0x4b737b){if(_0x4b737b){return _0x4b737b[_0x1746('0x28')](_0x34f0d8)['then'](function(_0x16e9dc){return _0x16e9dc;});}return null;};}function removeEntity(_0x51a380,_0x3428be){return function(_0x4b9ab2){if(_0x4b9ab2){return _0x4b9ab2['destroy']()[_0x1746('0x29')](function(){var _0x188e64=_0x4b9ab2[_0x1746('0x2a')]({'plain':!![]});var _0x59fc66='Projects';return db[_0x1746('0x2b')][_0x1746('0x2c')]({'where':{'type':_0x59fc66,'resourceId':_0x188e64['id']}})[_0x1746('0x29')](function(){return _0x4b9ab2;});})['then'](function(){_0x51a380['status'](0xcc)[_0x1746('0x1d')]();});}};}function handleEntityNotFound(_0x513e31,_0x54dc1e){return function(_0x2bbbca){if(!_0x2bbbca){_0x513e31[_0x1746('0x1b')](0x194);}return _0x2bbbca;};}function handleError(_0x20dc43,_0x1c4d47){_0x1c4d47=_0x1c4d47||0x1f4;return function(_0x2124f3){logger[_0x1746('0x2d')](_0x2124f3[_0x1746('0x2e')]);if(_0x2124f3[_0x1746('0x2f')]){delete _0x2124f3['name'];}_0x20dc43[_0x1746('0x1c')](_0x1c4d47)['send'](_0x2124f3);};}exports[_0x1746('0x30')]=function(_0xaea714,_0x6e58c3){var _0x49ba0e={},_0x286396={},_0x21a2d0={'count':0x0,'rows':[]};var _0x1fff91=_[_0x1746('0x31')](db[_0x1746('0x32')][_0x1746('0x33')],function(_0xd7d9c1){return{'name':_0xd7d9c1[_0x1746('0x34')],'type':_0xd7d9c1[_0x1746('0x35')][_0x1746('0x36')]};});_0x286396[_0x1746('0x37')]=_['map'](_0x1fff91,_0x1746('0x2f'));_0x286396[_0x1746('0x38')]=_['keys'](_0xaea714[_0x1746('0x38')]);_0x286396[_0x1746('0x39')]=_[_0x1746('0x3a')](_0x286396[_0x1746('0x37')],_0x286396['query']);_0x49ba0e['attributes']=_['intersection'](_0x286396[_0x1746('0x37')],qs['fields'](_0xaea714['query']['fields']));_0x49ba0e[_0x1746('0x3b')]=_0x49ba0e['attributes']['length']?_0x49ba0e[_0x1746('0x3b')]:_0x286396[_0x1746('0x37')];if(!_0xaea714['query'][_0x1746('0x3c')](_0x1746('0x3d'))){_0x49ba0e[_0x1746('0x20')]=qs[_0x1746('0x20')](_0xaea714[_0x1746('0x38')][_0x1746('0x20')]);_0x49ba0e[_0x1746('0x22')]=qs['offset'](_0xaea714[_0x1746('0x38')][_0x1746('0x22')]);}_0x49ba0e[_0x1746('0x3e')]=qs[_0x1746('0x3f')](_0xaea714[_0x1746('0x38')][_0x1746('0x3f')]);_0x49ba0e[_0x1746('0x40')]=qs[_0x1746('0x39')](_[_0x1746('0x41')](_0xaea714['query'],_0x286396[_0x1746('0x39')]),_0x1fff91);if(_0xaea714[_0x1746('0x38')][_0x1746('0x42')]){_0x49ba0e['where']=_[_0x1746('0x43')](_0x49ba0e[_0x1746('0x40')],{'$or':_[_0x1746('0x31')](_0x1fff91,function(_0x5a5b65){if(_0x5a5b65[_0x1746('0x35')]!==_0x1746('0x44')){var _0x25b757={};_0x25b757[_0x5a5b65[_0x1746('0x2f')]]={'$like':'%'+_0xaea714['query'][_0x1746('0x42')]+'%'};return _0x25b757;}})});}_0x49ba0e=_[_0x1746('0x43')]({},_0x49ba0e,_0xaea714[_0x1746('0x45')]);var _0x2bc28d={'where':_0x49ba0e[_0x1746('0x40')]};return db['JscriptyProject'][_0x1746('0x21')](_0x2bc28d)[_0x1746('0x29')](function(_0x33033b){_0x21a2d0[_0x1746('0x21')]=_0x33033b;if(_0xaea714[_0x1746('0x38')][_0x1746('0x46')]){_0x49ba0e[_0x1746('0x47')]=[{'all':!![]}];}return db[_0x1746('0x32')][_0x1746('0x48')](_0x49ba0e);})['then'](function(_0x1589bd){_0x21a2d0[_0x1746('0x49')]=_0x1589bd;return _0x21a2d0;})['then'](respondWithFilteredResult(_0x6e58c3,_0x49ba0e))[_0x1746('0x4a')](handleError(_0x6e58c3,null));};exports['show']=function(_0x5225ca,_0x20b9d7){var _0x24296a={'raw':![],'where':{'id':_0x5225ca['params']['id']}},_0x3eec47={};_0x3eec47['model']=_['keys'](db['JscriptyProject'][_0x1746('0x33')]);_0x3eec47[_0x1746('0x38')]=_[_0x1746('0x4b')](_0x5225ca[_0x1746('0x38')]);_0x3eec47[_0x1746('0x39')]=_[_0x1746('0x3a')](_0x3eec47[_0x1746('0x37')],_0x3eec47[_0x1746('0x38')]);_0x24296a['attributes']=_['intersection'](_0x3eec47[_0x1746('0x37')],qs[_0x1746('0x4c')](_0x5225ca['query'][_0x1746('0x4c')]));_0x24296a['attributes']=_0x24296a[_0x1746('0x3b')][_0x1746('0x4d')]?_0x24296a[_0x1746('0x3b')]:_0x3eec47[_0x1746('0x37')];if(_0x5225ca[_0x1746('0x38')][_0x1746('0x46')]){_0x24296a[_0x1746('0x47')]=[{'all':!![]}];}_0x24296a=_[_0x1746('0x43')]({},_0x24296a,_0x5225ca['options']);return db[_0x1746('0x32')]['find'](_0x24296a)[_0x1746('0x29')](handleEntityNotFound(_0x20b9d7,null))[_0x1746('0x29')](respondWithResult(_0x20b9d7,null))['catch'](handleError(_0x20b9d7,null));};exports['create']=function(_0xf04149,_0x4eb440){return db[_0x1746('0x32')]['create'](_0xf04149[_0x1746('0x4e')],{})[_0x1746('0x29')](function(_0x57fdaa){var _0xb3c7ef=_0xf04149[_0x1746('0x4f')][_0x1746('0x2a')]({'plain':!![]});if(!_0xb3c7ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb3c7ef[_0x1746('0x50')]===_0x1746('0x4f')){var _0x1441bc=_0x57fdaa[_0x1746('0x2a')]({'plain':!![]});var _0x20962b='Projects';return db[_0x1746('0x51')][_0x1746('0x52')]({'where':{'name':_0x20962b,'userProfileId':_0xb3c7ef[_0x1746('0x53')]},'raw':!![]})[_0x1746('0x29')](function(_0x5a5560){if(_0x5a5560&&_0x5a5560['autoAssociation']===0x0){return db[_0x1746('0x2b')][_0x1746('0x54')]({'name':_0x1441bc[_0x1746('0x2f')],'resourceId':_0x1441bc['id'],'type':_0x5a5560[_0x1746('0x2f')],'sectionId':_0x5a5560['id']},{})[_0x1746('0x29')](function(){return _0x57fdaa;});}else{return _0x57fdaa;}})[_0x1746('0x4a')](function(_0x4a3971){logger[_0x1746('0x2d')](_0x1746('0x55'),_0x4a3971);throw _0x4a3971;});}return _0x57fdaa;})[_0x1746('0x29')](respondWithResult(_0x4eb440,0xc9))[_0x1746('0x4a')](handleError(_0x4eb440,null));};exports[_0x1746('0x56')]=function(_0x2158dc,_0x218e8c){var _0x5ae343={'where':{'id':_0x2158dc[_0x1746('0x57')]['id']}},_0x34f96e={};_0x34f96e['model']=_[_0x1746('0x4b')](db['JscriptyProject'][_0x1746('0x33')]);_0x5ae343['attributes']=_[_0x1746('0x3a')](_0x34f96e[_0x1746('0x37')],qs[_0x1746('0x4c')](_0x2158dc['query'][_0x1746('0x4c')]));_0x5ae343[_0x1746('0x3b')]=_0x5ae343[_0x1746('0x3b')][_0x1746('0x4d')]?_0x5ae343[_0x1746('0x3b')]:_0x34f96e[_0x1746('0x37')];if(_0x2158dc[_0x1746('0x38')][_0x1746('0x46')]){_0x5ae343[_0x1746('0x47')]=[{'all':!![]}];}_0x5ae343=_['merge']({},_0x5ae343,_0x2158dc[_0x1746('0x45')]);return db['JscriptyProject'][_0x1746('0x52')](_0x5ae343)[_0x1746('0x29')](handleEntityNotFound(_0x218e8c,null))['then'](function(_0x1c2c23){if(_0x1c2c23){var _0x14c0cf=_0x1c2c23[_0x1746('0x2a')]({'plain':!![]});_0x14c0cf=qs[_0x1746('0x58')](_0x14c0cf,['id',_0x1746('0x59'),_0x1746('0x5a')]);_0x2158dc[_0x1746('0x4e')]=_[_0x1746('0x58')](_0x2158dc['body'],['id',_0x1746('0x59'),_0x1746('0x5a')]);return db[_0x1746('0x32')][_0x1746('0x54')](_['merge'](_0x14c0cf,_0x2158dc[_0x1746('0x4e')]),{'include':_0x2158dc[_0x1746('0x38')][_0x1746('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x57cac5){var _0x248654=_0x2158dc[_0x1746('0x4f')][_0x1746('0x2a')]({'plain':!![]});if(!_0x248654)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x248654[_0x1746('0x50')]===_0x1746('0x4f')){var _0x46b111=_0x57cac5[_0x1746('0x2a')]({'plain':!![]});var _0x3b591a=_0x1746('0x5b');return db[_0x1746('0x51')][_0x1746('0x52')]({'where':{'name':_0x3b591a,'userProfileId':_0x248654[_0x1746('0x53')]},'raw':!![]})['then'](function(_0x566188){if(_0x566188&&_0x566188['autoAssociation']===0x0){return db[_0x1746('0x2b')][_0x1746('0x54')]({'name':_0x46b111[_0x1746('0x2f')],'resourceId':_0x46b111['id'],'type':_0x566188[_0x1746('0x2f')],'sectionId':_0x566188['id']},{})['then'](function(){return _0x57cac5;});}else{return _0x57cac5;}})[_0x1746('0x4a')](function(_0x4fd808){logger[_0x1746('0x2d')](_0x1746('0x55'),_0x4fd808);throw _0x4fd808;});}return _0x57cac5;});}})[_0x1746('0x29')](respondWithResult(_0x218e8c,0xc9))['catch'](handleError(_0x218e8c,null));};exports[_0x1746('0x28')]=function(_0x4b1e77,_0x42beff){if(_0x4b1e77['body']['id']){delete _0x4b1e77[_0x1746('0x4e')]['id'];}return db['JscriptyProject'][_0x1746('0x52')]({'where':{'id':_0x4b1e77['params']['id']}})[_0x1746('0x29')](handleEntityNotFound(_0x42beff,null))[_0x1746('0x29')](saveUpdates(_0x4b1e77[_0x1746('0x4e')],null))[_0x1746('0x29')](respondWithResult(_0x42beff,null))[_0x1746('0x4a')](handleError(_0x42beff,null));};exports['destroy']=function(_0x4b641a,_0x5dd2cc){return db[_0x1746('0x32')][_0x1746('0x52')]({'where':{'id':_0x4b641a[_0x1746('0x57')]['id']}})[_0x1746('0x29')](handleEntityNotFound(_0x5dd2cc,null))[_0x1746('0x29')](removeEntity(_0x5dd2cc,null))[_0x1746('0x4a')](handleError(_0x5dd2cc,null));};exports[_0x1746('0x5c')]=function(_0x57b391,_0x376bf0,_0x353336){var _0x797f0f={'raw':!![],'where':{}};var _0x221782={};var _0x224d07={'count':0x0,'rows':[]};return db[_0x1746('0x32')][_0x1746('0x5d')]({'where':{'id':_0x57b391[_0x1746('0x57')]['id']}})[_0x1746('0x29')](handleEntityNotFound(_0x376bf0,null))[_0x1746('0x29')](function(_0x145c23){if(_0x145c23){_0x221782['model']=_[_0x1746('0x4b')](db[_0x1746('0x5e')][_0x1746('0x33')]);_0x221782[_0x1746('0x38')]=_[_0x1746('0x4b')](_0x57b391[_0x1746('0x38')]);_0x221782[_0x1746('0x39')]=_[_0x1746('0x3a')](_0x221782[_0x1746('0x37')],_0x221782[_0x1746('0x38')]);_0x797f0f[_0x1746('0x3b')]=_['intersection'](_0x221782['model'],qs['fields'](_0x57b391[_0x1746('0x38')][_0x1746('0x4c')]));_0x797f0f[_0x1746('0x3b')]=_0x797f0f[_0x1746('0x3b')][_0x1746('0x4d')]?_0x797f0f[_0x1746('0x3b')]:_0x221782['model'];if(!_0x57b391[_0x1746('0x38')]['hasOwnProperty'](_0x1746('0x3d'))){_0x797f0f[_0x1746('0x20')]=qs['limit'](_0x57b391['query']['limit']);_0x797f0f[_0x1746('0x22')]=qs[_0x1746('0x22')](_0x57b391[_0x1746('0x38')][_0x1746('0x22')]);}_0x797f0f[_0x1746('0x3e')]=qs['sort'](_0x57b391[_0x1746('0x38')][_0x1746('0x3f')]);_0x797f0f[_0x1746('0x40')]=qs[_0x1746('0x39')](_[_0x1746('0x41')](_0x57b391['query'],_0x221782[_0x1746('0x39')]));_0x797f0f[_0x1746('0x40')][_0x1746('0x5f')]=_0x145c23['id'];if(_0x57b391['query'][_0x1746('0x42')]){_0x797f0f[_0x1746('0x40')]=_['merge'](_0x797f0f['where'],{'$or':_[_0x1746('0x31')](_0x797f0f[_0x1746('0x3b')],function(_0x255f35){var _0x27965c={};_0x27965c[_0x255f35]={'$like':'%'+_0x57b391[_0x1746('0x38')][_0x1746('0x42')]+'%'};return _0x27965c;})});}_0x797f0f=_[_0x1746('0x43')]({},_0x797f0f,_0x57b391[_0x1746('0x45')]);return db[_0x1746('0x5e')][_0x1746('0x21')]({'where':_0x797f0f[_0x1746('0x40')]})[_0x1746('0x29')](function(_0x1054f0){_0x224d07[_0x1746('0x21')]=_0x1054f0;if(_0x57b391[_0x1746('0x38')][_0x1746('0x46')]){_0x797f0f['include']=[{'all':!![]}];}return db[_0x1746('0x5e')]['findAll'](_0x797f0f);})[_0x1746('0x29')](function(_0x16b3c6){_0x224d07[_0x1746('0x49')]=_0x16b3c6;return _0x224d07;});}})['then'](respondWithFilteredResult(_0x376bf0,_0x797f0f))[_0x1746('0x4a')](handleError(_0x376bf0,null));};exports[_0x1746('0x60')]=function(_0x12ec14,_0xa184e5,_0x506fb3){var _0x42523a={'raw':!![],'where':{}};var _0x188e7a={};var _0x491a79={'count':0x0,'rows':[]};return db[_0x1746('0x32')][_0x1746('0x5d')]({'where':{'id':_0x12ec14[_0x1746('0x57')]['id']}})[_0x1746('0x29')](handleEntityNotFound(_0xa184e5,null))[_0x1746('0x29')](function(_0x4cb009){if(_0x4cb009){_0x188e7a[_0x1746('0x37')]=_['keys'](db[_0x1746('0x61')][_0x1746('0x33')]);_0x188e7a['query']=_[_0x1746('0x4b')](_0x12ec14[_0x1746('0x38')]);_0x188e7a[_0x1746('0x39')]=_[_0x1746('0x3a')](_0x188e7a[_0x1746('0x37')],_0x188e7a[_0x1746('0x38')]);_0x42523a['attributes']=_[_0x1746('0x3a')](_0x188e7a['model'],qs[_0x1746('0x4c')](_0x12ec14[_0x1746('0x38')]['fields']));_0x42523a['attributes']=_0x42523a['attributes']['length']?_0x42523a[_0x1746('0x3b')]:_0x188e7a[_0x1746('0x37')];if(!_0x12ec14['query'][_0x1746('0x3c')](_0x1746('0x3d'))){_0x42523a[_0x1746('0x20')]=qs[_0x1746('0x20')](_0x12ec14['query'][_0x1746('0x20')]);_0x42523a[_0x1746('0x22')]=qs[_0x1746('0x22')](_0x12ec14[_0x1746('0x38')]['offset']);}_0x42523a[_0x1746('0x3e')]=qs[_0x1746('0x3f')](_0x12ec14['query'][_0x1746('0x3f')]);_0x42523a[_0x1746('0x40')]=qs[_0x1746('0x39')](_['pick'](_0x12ec14['query'],_0x188e7a['filters']));_0x42523a[_0x1746('0x40')][_0x1746('0x5f')]=_0x4cb009['id'];if(_0x12ec14[_0x1746('0x38')][_0x1746('0x42')]){_0x42523a[_0x1746('0x40')]=_[_0x1746('0x43')](_0x42523a['where'],{'$or':_['map'](_0x42523a[_0x1746('0x3b')],function(_0x76a9b3){var _0x114a0c={};_0x114a0c[_0x76a9b3]={'$like':'%'+_0x12ec14['query']['filter']+'%'};return _0x114a0c;})});}_0x42523a=_[_0x1746('0x43')]({},_0x42523a,_0x12ec14[_0x1746('0x45')]);return db['JscriptyAnswerReport'][_0x1746('0x21')]({'where':_0x42523a[_0x1746('0x40')]})[_0x1746('0x29')](function(_0x4d59de){_0x491a79[_0x1746('0x21')]=_0x4d59de;if(_0x12ec14[_0x1746('0x38')][_0x1746('0x46')]){_0x42523a[_0x1746('0x47')]=[{'all':!![]}];}return db[_0x1746('0x61')]['findAll'](_0x42523a);})[_0x1746('0x29')](function(_0x583731){_0x491a79[_0x1746('0x49')]=_0x583731;return _0x491a79;});}})[_0x1746('0x29')](respondWithFilteredResult(_0xa184e5,_0x42523a))[_0x1746('0x4a')](handleError(_0xa184e5,null));};function char(_0x22f0eb){return _0x1746('0x62')===typeof _0x22f0eb?String[_0x1746('0x63')][_0x1746('0x25')](null,arguments):_0x22f0eb;}function needsEncapsulation(_0x55a4a2){return!!_0x55a4a2&&(_0x55a4a2[_0x1746('0x64')]()[_0x1746('0x65')](char(0xd))>=0x0||_0x55a4a2[_0x1746('0x64')]()['indexOf'](char(0xa))>=0x0||_0x55a4a2[_0x1746('0x64')]()['indexOf'](char(0x2c))>=0x0||_0x55a4a2[_0x1746('0x64')]()[_0x1746('0x65')](char(0x22))>=0x0);}function encapsulate(_0x3568d7){var _0x1750a9=char(0x22),_0x42bd62='\x5c'+char(0x22),_0xf6928a=_0x3568d7['toString']()[_0x1746('0x66')](new RegExp(_0x1750a9,'g'),_0x42bd62);return _0x1750a9+_0xf6928a+_0x1750a9;}exports[_0x1746('0x67')]=function(_0x5c5828,_0x56058b,_0xe6ae7f){var _0x111a26,_0x246f07;var _0xbaba90={'where':{'ProjectId':_0x5c5828[_0x1746('0x57')]['id']}};if(_0x5c5828[_0x1746('0x38')][_0x1746('0x68')]){_0xbaba90[_0x1746('0x40')]['starttime']=JSON[_0x1746('0x69')](_0x5c5828['query']['startTime']);}return db[_0x1746('0x5e')][_0x1746('0x48')](_0xbaba90)['then'](handleEntityNotFound(_0x56058b,null))[_0x1746('0x29')](function(_0x378847){if(_0x378847){_0x111a26=_0x378847;return db[_0x1746('0x6a')][_0x1746('0x48')]({'where':{'SessionId':{'$in':_[_0x1746('0x31')](_0x111a26,'id')},'ProjectId':_0x5c5828[_0x1746('0x57')]['id']},'order':_0x1746('0x6b')});}})[_0x1746('0x29')](handleEntityNotFound(_0x56058b,null))[_0x1746('0x29')](function(_0x2bc6fa){if(_0x2bc6fa){_0x246f07=_0x2bc6fa;var _0x591bae={};for(var _0x37e82c=0x0,_0xe7f2e8=_0x246f07[_0x1746('0x4d')];_0x37e82c<_0xe7f2e8;_0x37e82c++){if(!_0x591bae[_0x1746('0x3c')](_0x246f07[_0x37e82c][_0x1746('0x6c')])){_0x591bae[_0x246f07[_0x37e82c]['questionId']]=needsEncapsulation(_0x246f07[_0x37e82c][_0x1746('0x6d')])?encapsulate(_0x246f07[_0x37e82c][_0x1746('0x6d')]):_0x246f07[_0x37e82c][_0x1746('0x6d')];}}var _0x44a213=[],_0x3de2e8={};for(var _0x40dddd=0x0,_0x4956bf=_0x111a26['length'];_0x40dddd<_0x4956bf;_0x40dddd++){_0x3de2e8={'ProjectId':_0x5c5828['params']['id'],'SessionId':_0x111a26[_0x40dddd]['id'],'StartTime':moment(_0x111a26[_0x40dddd]['starttime'])[_0x1746('0x6e')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x37820f=0x0,_0x21e042=_0x246f07['length'];_0x37820f<_0x21e042;_0x37820f++){if(_0x246f07[_0x37820f]['SessionId']==_0x111a26[_0x40dddd]['id']&&_0x591bae[_0x1746('0x3c')](_0x246f07[_0x37820f][_0x1746('0x6c')])){_0x3de2e8[_0x591bae[_0x246f07[_0x37820f][_0x1746('0x6c')]]]=_0x246f07[_0x37820f][_0x1746('0x6f')];}}for(var _0x3ef419 in _0x591bae){if(!_0x3de2e8[_0x1746('0x3c')](_0x591bae[_0x3ef419])){_0x3de2e8[_0x591bae[_0x3ef419]]=null;}}_0x44a213[_0x1746('0x70')](_0x3de2e8);}return _0x44a213;}})[_0x1746('0x29')](function(_0x17e73b){if(!_[_0x1746('0x71')](_0x17e73b)){var _0x47b794=toCsv(_0x17e73b);var _0x24ca28=Date[_0x1746('0x72')]();fs[_0x1746('0x73')](util[_0x1746('0x6e')](_0x1746('0x74'),_0x5c5828['params']['id'],_0x24ca28),_0x47b794);_0x56058b[_0x1746('0x75')](_0x1746('0x76'),_0x1746('0x77')+util[_0x1746('0x6e')](_0x1746('0x78'),_0x5c5828[_0x1746('0x57')]['id'],_0x24ca28));_0x56058b[_0x1746('0x75')](_0x1746('0x79'),_0x1746('0x7a'));return _0x56058b[_0x1746('0x7b')](util['format'](_0x1746('0x74'),_0x5c5828[_0x1746('0x57')]['id'],_0x24ca28));}else{return _0x56058b['sendStatus'](0xcc);}})[_0x1746('0x4a')](handleError(_0x56058b,null));}; \ No newline at end of file +var _0xa67e=['../../mysqldb','sendStatus','end','status','offset','count','limit','set','Content-Range','json','apply','reject','then','destroy','Projects','UserProfileResource','error','stack','name','send','map','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','JscriptyProject','include','params','keys','includeAll','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','update','getSessions','findOne','JscriptySessionReport','sort','rows','getAnswers','JscriptyAnswerReport','ProjectId','number','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','findAll','questionId','question','format','push','now','writeFileSync','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','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/license/util'];(function(_0x496a2d,_0x17a7f6){var _0x3a3d60=function(_0x22e357){while(--_0x22e357){_0x496a2d['push'](_0x496a2d['shift']());}};_0x3a3d60(++_0x17a7f6);}(_0xa67e,0xce));var _0xea67=function(_0x4fb59e,_0x15fbb8){_0x4fb59e=_0x4fb59e-0x0;var _0x30fa57=_0xa67e[_0x4fb59e];return _0x30fa57;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea67('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea67('0x1'));var rp=require(_0xea67('0x2'));var moment=require(_0xea67('0x3'));var BPromise=require(_0xea67('0x4'));var Mustache=require(_0xea67('0x5'));var util=require('util');var path=require('path');var sox=require(_0xea67('0x6'));var csv=require(_0xea67('0x7'));var ejs=require(_0xea67('0x8'));var fs=require('fs');var fs_extra=require(_0xea67('0x9'));var _=require(_0xea67('0xa'));var squel=require(_0xea67('0xb'));var crypto=require(_0xea67('0xc'));var jsforce=require(_0xea67('0xd'));var deskjs=require(_0xea67('0xe'));var toCsv=require(_0xea67('0x7'));var querystring=require(_0xea67('0xf'));var Papa=require('papaparse');var Redis=require(_0xea67('0x10'));var authService=require(_0xea67('0x11'));var qs=require(_0xea67('0x12'));var as=require(_0xea67('0x13'));var hardwareService=require(_0xea67('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xea67('0x15'));var db=require(_0xea67('0x16'))['db'];function respondWithStatusCode(_0x37db50,_0x52babc){_0x52babc=_0x52babc||0xcc;return function(_0x40707e){if(_0x40707e){return _0x37db50[_0xea67('0x17')](_0x52babc);}return _0x37db50['status'](_0x52babc)[_0xea67('0x18')]();};}function respondWithResult(_0x2cd1ea,_0x4e0ab0){_0x4e0ab0=_0x4e0ab0||0xc8;return function(_0x4c0ca7){if(_0x4c0ca7){return _0x2cd1ea[_0xea67('0x19')](_0x4e0ab0)['json'](_0x4c0ca7);}};}function respondWithFilteredResult(_0x476294,_0x185bf0){return function(_0x43d221){if(_0x43d221){var _0x19b1a1=typeof _0x185bf0[_0xea67('0x1a')]==='undefined'&&typeof _0x185bf0['limit']==='undefined';var _0x7a2994=_0x43d221[_0xea67('0x1b')];var _0x3ab5ee=_0x19b1a1?0x0:_0x185bf0[_0xea67('0x1a')];var _0x2d26bb=_0x19b1a1?_0x43d221[_0xea67('0x1b')]:_0x185bf0['offset']+_0x185bf0[_0xea67('0x1c')];var _0x236a27;if(_0x2d26bb>=_0x7a2994){_0x2d26bb=_0x7a2994;_0x236a27=0xc8;}else{_0x236a27=0xce;}_0x476294[_0xea67('0x19')](_0x236a27);return _0x476294[_0xea67('0x1d')](_0xea67('0x1e'),_0x3ab5ee+'-'+_0x2d26bb+'/'+_0x7a2994)[_0xea67('0x1f')](_0x43d221);}return null;};}function patchUpdates(_0x45663f){return function(_0x5744d7){try{jsonpatch[_0xea67('0x20')](_0x5744d7,_0x45663f,!![]);}catch(_0xeb776f){return BPromise[_0xea67('0x21')](_0xeb776f);}return _0x5744d7['save']();};}function saveUpdates(_0x59be22,_0x21235b){return function(_0x232e53){if(_0x232e53){return _0x232e53['update'](_0x59be22)[_0xea67('0x22')](function(_0x35cce4){return _0x35cce4;});}return null;};}function removeEntity(_0x3f8b6a,_0x11cede){return function(_0x3e13c3){if(_0x3e13c3){return _0x3e13c3[_0xea67('0x23')]()[_0xea67('0x22')](function(){var _0x337c1b=_0x3e13c3['get']({'plain':!![]});var _0x32bf2b=_0xea67('0x24');return db[_0xea67('0x25')]['destroy']({'where':{'type':_0x32bf2b,'resourceId':_0x337c1b['id']}})[_0xea67('0x22')](function(){return _0x3e13c3;});})['then'](function(){_0x3f8b6a[_0xea67('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d2403,_0x46d047){return function(_0x5b945c){if(!_0x5b945c){_0x3d2403[_0xea67('0x17')](0x194);}return _0x5b945c;};}function handleError(_0x2f6840,_0x332ac1){_0x332ac1=_0x332ac1||0x1f4;return function(_0x30ccdb){logger[_0xea67('0x26')](_0x30ccdb[_0xea67('0x27')]);if(_0x30ccdb[_0xea67('0x28')]){delete _0x30ccdb[_0xea67('0x28')];}_0x2f6840[_0xea67('0x19')](_0x332ac1)[_0xea67('0x29')](_0x30ccdb);};}exports['index']=function(_0x3699c9,_0x2964eb){var _0xeedec9={},_0x29f221={},_0x3c1c21={'count':0x0,'rows':[]};var _0x4368b0=_[_0xea67('0x2a')](db['JscriptyProject'][_0xea67('0x2b')],function(_0x2977a3){return{'name':_0x2977a3['fieldName'],'type':_0x2977a3[_0xea67('0x2c')][_0xea67('0x2d')]};});_0x29f221['model']=_[_0xea67('0x2a')](_0x4368b0,'name');_0x29f221[_0xea67('0x2e')]=_['keys'](_0x3699c9[_0xea67('0x2e')]);_0x29f221[_0xea67('0x2f')]=_[_0xea67('0x30')](_0x29f221[_0xea67('0x31')],_0x29f221[_0xea67('0x2e')]);_0xeedec9['attributes']=_[_0xea67('0x30')](_0x29f221[_0xea67('0x31')],qs[_0xea67('0x32')](_0x3699c9[_0xea67('0x2e')]['fields']));_0xeedec9[_0xea67('0x33')]=_0xeedec9[_0xea67('0x33')][_0xea67('0x34')]?_0xeedec9[_0xea67('0x33')]:_0x29f221[_0xea67('0x31')];if(!_0x3699c9[_0xea67('0x2e')][_0xea67('0x35')](_0xea67('0x36'))){_0xeedec9[_0xea67('0x1c')]=qs[_0xea67('0x1c')](_0x3699c9[_0xea67('0x2e')]['limit']);_0xeedec9[_0xea67('0x1a')]=qs[_0xea67('0x1a')](_0x3699c9['query'][_0xea67('0x1a')]);}_0xeedec9[_0xea67('0x37')]=qs['sort'](_0x3699c9[_0xea67('0x2e')]['sort']);_0xeedec9[_0xea67('0x38')]=qs[_0xea67('0x2f')](_[_0xea67('0x39')](_0x3699c9[_0xea67('0x2e')],_0x29f221['filters']),_0x4368b0);if(_0x3699c9[_0xea67('0x2e')][_0xea67('0x3a')]){_0xeedec9['where']=_['merge'](_0xeedec9['where'],{'$or':_[_0xea67('0x2a')](_0x4368b0,function(_0x125687){if(_0x125687[_0xea67('0x2c')]!==_0xea67('0x3b')){var _0x3b4770={};_0x3b4770[_0x125687[_0xea67('0x28')]]={'$like':'%'+_0x3699c9['query']['filter']+'%'};return _0x3b4770;}})});}_0xeedec9=_[_0xea67('0x3c')]({},_0xeedec9,_0x3699c9[_0xea67('0x3d')]);var _0x4dba16={'where':_0xeedec9[_0xea67('0x38')]};return db[_0xea67('0x3e')][_0xea67('0x1b')](_0x4dba16)[_0xea67('0x22')](function(_0x1b5a54){_0x3c1c21['count']=_0x1b5a54;if(_0x3699c9[_0xea67('0x2e')]['includeAll']){_0xeedec9[_0xea67('0x3f')]=[{'all':!![]}];}return db[_0xea67('0x3e')]['findAll'](_0xeedec9);})['then'](function(_0x519edd){_0x3c1c21['rows']=_0x519edd;return _0x3c1c21;})[_0xea67('0x22')](respondWithFilteredResult(_0x2964eb,_0xeedec9))['catch'](handleError(_0x2964eb,null));};exports['show']=function(_0x5cbf4a,_0x57229d){var _0x52f4e7={'raw':![],'where':{'id':_0x5cbf4a[_0xea67('0x40')]['id']}},_0x1751fd={};_0x1751fd[_0xea67('0x31')]=_[_0xea67('0x41')](db[_0xea67('0x3e')][_0xea67('0x2b')]);_0x1751fd[_0xea67('0x2e')]=_[_0xea67('0x41')](_0x5cbf4a[_0xea67('0x2e')]);_0x1751fd[_0xea67('0x2f')]=_[_0xea67('0x30')](_0x1751fd['model'],_0x1751fd[_0xea67('0x2e')]);_0x52f4e7[_0xea67('0x33')]=_[_0xea67('0x30')](_0x1751fd['model'],qs[_0xea67('0x32')](_0x5cbf4a[_0xea67('0x2e')][_0xea67('0x32')]));_0x52f4e7['attributes']=_0x52f4e7[_0xea67('0x33')][_0xea67('0x34')]?_0x52f4e7[_0xea67('0x33')]:_0x1751fd[_0xea67('0x31')];if(_0x5cbf4a[_0xea67('0x2e')][_0xea67('0x42')]){_0x52f4e7[_0xea67('0x3f')]=[{'all':!![]}];}_0x52f4e7=_['merge']({},_0x52f4e7,_0x5cbf4a[_0xea67('0x3d')]);return db[_0xea67('0x3e')][_0xea67('0x43')](_0x52f4e7)[_0xea67('0x22')](handleEntityNotFound(_0x57229d,null))[_0xea67('0x22')](respondWithResult(_0x57229d,null))['catch'](handleError(_0x57229d,null));};exports[_0xea67('0x44')]=function(_0x17810c,_0x31dc18){return db[_0xea67('0x3e')][_0xea67('0x44')](_0x17810c['body'],{})[_0xea67('0x22')](function(_0x1e6490){var _0x44ec3f=_0x17810c['user'][_0xea67('0x45')]({'plain':!![]});if(!_0x44ec3f)throw new Error(_0xea67('0x46'));if(_0x44ec3f[_0xea67('0x47')]===_0xea67('0x48')){var _0x2dc38d=_0x1e6490[_0xea67('0x45')]({'plain':!![]});var _0x1d6cd7='Projects';return db[_0xea67('0x49')][_0xea67('0x43')]({'where':{'name':_0x1d6cd7,'userProfileId':_0x44ec3f[_0xea67('0x4a')]},'raw':!![]})['then'](function(_0x492bca){if(_0x492bca&&_0x492bca[_0xea67('0x4b')]===0x0){return db[_0xea67('0x25')]['create']({'name':_0x2dc38d[_0xea67('0x28')],'resourceId':_0x2dc38d['id'],'type':_0x492bca['name'],'sectionId':_0x492bca['id']},{})[_0xea67('0x22')](function(){return _0x1e6490;});}else{return _0x1e6490;}})[_0xea67('0x4c')](function(_0x6939b2){logger['error'](_0xea67('0x4d'),_0x6939b2);throw _0x6939b2;});}return _0x1e6490;})[_0xea67('0x22')](respondWithResult(_0x31dc18,0xc9))[_0xea67('0x4c')](handleError(_0x31dc18,null));};exports[_0xea67('0x4e')]=function(_0x58fb7a,_0x22cf3b){var _0x370b63={'where':{'id':_0x58fb7a[_0xea67('0x40')]['id']}},_0x2f5e20={};_0x2f5e20['model']=_['keys'](db[_0xea67('0x3e')][_0xea67('0x2b')]);_0x370b63[_0xea67('0x33')]=_['intersection'](_0x2f5e20[_0xea67('0x31')],qs[_0xea67('0x32')](_0x58fb7a['query'][_0xea67('0x32')]));_0x370b63[_0xea67('0x33')]=_0x370b63[_0xea67('0x33')]['length']?_0x370b63['attributes']:_0x2f5e20[_0xea67('0x31')];if(_0x58fb7a[_0xea67('0x2e')][_0xea67('0x42')]){_0x370b63[_0xea67('0x3f')]=[{'all':!![]}];}_0x370b63=_[_0xea67('0x3c')]({},_0x370b63,_0x58fb7a[_0xea67('0x3d')]);return db['JscriptyProject'][_0xea67('0x43')](_0x370b63)['then'](handleEntityNotFound(_0x22cf3b,null))['then'](function(_0xf0c90e){if(_0xf0c90e){var _0x380d42=_0xf0c90e[_0xea67('0x45')]({'plain':!![]});_0x380d42=qs[_0xea67('0x4f')](_0x380d42,['id',_0xea67('0x50'),_0xea67('0x51')]);_0x58fb7a['body']=_[_0xea67('0x4f')](_0x58fb7a['body'],['id',_0xea67('0x50'),'updatedAt']);return db[_0xea67('0x3e')][_0xea67('0x44')](_[_0xea67('0x3c')](_0x380d42,_0x58fb7a[_0xea67('0x52')]),{'include':_0x58fb7a[_0xea67('0x2e')][_0xea67('0x42')]?[{'all':!![]}]:undefined})[_0xea67('0x22')](function(_0x42e5d6){var _0x36fb15=_0x58fb7a[_0xea67('0x48')]['get']({'plain':!![]});if(!_0x36fb15)throw new Error(_0xea67('0x46'));if(_0x36fb15['role']==='user'){var _0x505c0e=_0x42e5d6[_0xea67('0x45')]({'plain':!![]});var _0xe593fc=_0xea67('0x24');return db[_0xea67('0x49')][_0xea67('0x43')]({'where':{'name':_0xe593fc,'userProfileId':_0x36fb15['userProfileId']},'raw':!![]})['then'](function(_0x2f2486){if(_0x2f2486&&_0x2f2486[_0xea67('0x4b')]===0x0){return db[_0xea67('0x25')][_0xea67('0x44')]({'name':_0x505c0e['name'],'resourceId':_0x505c0e['id'],'type':_0x2f2486[_0xea67('0x28')],'sectionId':_0x2f2486['id']},{})[_0xea67('0x22')](function(){return _0x42e5d6;});}else{return _0x42e5d6;}})['catch'](function(_0x5257a1){logger[_0xea67('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5257a1);throw _0x5257a1;});}return _0x42e5d6;});}})['then'](respondWithResult(_0x22cf3b,0xc9))['catch'](handleError(_0x22cf3b,null));};exports[_0xea67('0x53')]=function(_0x58987b,_0xa87d5c){if(_0x58987b[_0xea67('0x52')]['id']){delete _0x58987b[_0xea67('0x52')]['id'];}return db[_0xea67('0x3e')]['find']({'where':{'id':_0x58987b[_0xea67('0x40')]['id']}})[_0xea67('0x22')](handleEntityNotFound(_0xa87d5c,null))[_0xea67('0x22')](saveUpdates(_0x58987b[_0xea67('0x52')],null))['then'](respondWithResult(_0xa87d5c,null))[_0xea67('0x4c')](handleError(_0xa87d5c,null));};exports[_0xea67('0x23')]=function(_0x15f1f1,_0x124121){return db[_0xea67('0x3e')][_0xea67('0x43')]({'where':{'id':_0x15f1f1[_0xea67('0x40')]['id']}})[_0xea67('0x22')](handleEntityNotFound(_0x124121,null))['then'](removeEntity(_0x124121,null))[_0xea67('0x4c')](handleError(_0x124121,null));};exports[_0xea67('0x54')]=function(_0x16bb70,_0x49a3fe,_0x350ca9){var _0x22753b={'raw':!![],'where':{}};var _0x302858={};var _0x220799={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xea67('0x55')]({'where':{'id':_0x16bb70[_0xea67('0x40')]['id']}})['then'](handleEntityNotFound(_0x49a3fe,null))[_0xea67('0x22')](function(_0x3c2db9){if(_0x3c2db9){_0x302858[_0xea67('0x31')]=_[_0xea67('0x41')](db[_0xea67('0x56')][_0xea67('0x2b')]);_0x302858[_0xea67('0x2e')]=_['keys'](_0x16bb70['query']);_0x302858['filters']=_['intersection'](_0x302858[_0xea67('0x31')],_0x302858[_0xea67('0x2e')]);_0x22753b[_0xea67('0x33')]=_[_0xea67('0x30')](_0x302858[_0xea67('0x31')],qs[_0xea67('0x32')](_0x16bb70[_0xea67('0x2e')][_0xea67('0x32')]));_0x22753b[_0xea67('0x33')]=_0x22753b[_0xea67('0x33')][_0xea67('0x34')]?_0x22753b[_0xea67('0x33')]:_0x302858[_0xea67('0x31')];if(!_0x16bb70[_0xea67('0x2e')][_0xea67('0x35')](_0xea67('0x36'))){_0x22753b[_0xea67('0x1c')]=qs[_0xea67('0x1c')](_0x16bb70[_0xea67('0x2e')][_0xea67('0x1c')]);_0x22753b['offset']=qs[_0xea67('0x1a')](_0x16bb70[_0xea67('0x2e')]['offset']);}_0x22753b[_0xea67('0x37')]=qs['sort'](_0x16bb70[_0xea67('0x2e')][_0xea67('0x57')]);_0x22753b['where']=qs[_0xea67('0x2f')](_[_0xea67('0x39')](_0x16bb70[_0xea67('0x2e')],_0x302858[_0xea67('0x2f')]));_0x22753b['where']['ProjectId']=_0x3c2db9['id'];if(_0x16bb70[_0xea67('0x2e')][_0xea67('0x3a')]){_0x22753b[_0xea67('0x38')]=_[_0xea67('0x3c')](_0x22753b[_0xea67('0x38')],{'$or':_[_0xea67('0x2a')](_0x22753b[_0xea67('0x33')],function(_0x36be1a){var _0x2126e4={};_0x2126e4[_0x36be1a]={'$like':'%'+_0x16bb70['query'][_0xea67('0x3a')]+'%'};return _0x2126e4;})});}_0x22753b=_[_0xea67('0x3c')]({},_0x22753b,_0x16bb70[_0xea67('0x3d')]);return db[_0xea67('0x56')][_0xea67('0x1b')]({'where':_0x22753b[_0xea67('0x38')]})[_0xea67('0x22')](function(_0x264d14){_0x220799[_0xea67('0x1b')]=_0x264d14;if(_0x16bb70[_0xea67('0x2e')][_0xea67('0x42')]){_0x22753b['include']=[{'all':!![]}];}return db[_0xea67('0x56')]['findAll'](_0x22753b);})['then'](function(_0x34ad0b){_0x220799[_0xea67('0x58')]=_0x34ad0b;return _0x220799;});}})[_0xea67('0x22')](respondWithFilteredResult(_0x49a3fe,_0x22753b))[_0xea67('0x4c')](handleError(_0x49a3fe,null));};exports[_0xea67('0x59')]=function(_0x133994,_0x34827c,_0x356f1c){var _0x3477d4={'raw':!![],'where':{}};var _0x5b8824={};var _0x1b1036={'count':0x0,'rows':[]};return db[_0xea67('0x3e')]['findOne']({'where':{'id':_0x133994[_0xea67('0x40')]['id']}})[_0xea67('0x22')](handleEntityNotFound(_0x34827c,null))[_0xea67('0x22')](function(_0x54923e){if(_0x54923e){_0x5b8824[_0xea67('0x31')]=_[_0xea67('0x41')](db[_0xea67('0x5a')][_0xea67('0x2b')]);_0x5b8824['query']=_[_0xea67('0x41')](_0x133994['query']);_0x5b8824[_0xea67('0x2f')]=_['intersection'](_0x5b8824[_0xea67('0x31')],_0x5b8824['query']);_0x3477d4[_0xea67('0x33')]=_[_0xea67('0x30')](_0x5b8824[_0xea67('0x31')],qs[_0xea67('0x32')](_0x133994[_0xea67('0x2e')][_0xea67('0x32')]));_0x3477d4[_0xea67('0x33')]=_0x3477d4['attributes'][_0xea67('0x34')]?_0x3477d4[_0xea67('0x33')]:_0x5b8824['model'];if(!_0x133994[_0xea67('0x2e')][_0xea67('0x35')]('nolimit')){_0x3477d4[_0xea67('0x1c')]=qs[_0xea67('0x1c')](_0x133994['query']['limit']);_0x3477d4[_0xea67('0x1a')]=qs[_0xea67('0x1a')](_0x133994[_0xea67('0x2e')][_0xea67('0x1a')]);}_0x3477d4[_0xea67('0x37')]=qs[_0xea67('0x57')](_0x133994[_0xea67('0x2e')]['sort']);_0x3477d4[_0xea67('0x38')]=qs[_0xea67('0x2f')](_[_0xea67('0x39')](_0x133994[_0xea67('0x2e')],_0x5b8824[_0xea67('0x2f')]));_0x3477d4[_0xea67('0x38')][_0xea67('0x5b')]=_0x54923e['id'];if(_0x133994[_0xea67('0x2e')][_0xea67('0x3a')]){_0x3477d4[_0xea67('0x38')]=_[_0xea67('0x3c')](_0x3477d4[_0xea67('0x38')],{'$or':_[_0xea67('0x2a')](_0x3477d4['attributes'],function(_0x2f1a8c){var _0x133ee7={};_0x133ee7[_0x2f1a8c]={'$like':'%'+_0x133994[_0xea67('0x2e')][_0xea67('0x3a')]+'%'};return _0x133ee7;})});}_0x3477d4=_['merge']({},_0x3477d4,_0x133994[_0xea67('0x3d')]);return db[_0xea67('0x5a')][_0xea67('0x1b')]({'where':_0x3477d4[_0xea67('0x38')]})['then'](function(_0x51f203){_0x1b1036[_0xea67('0x1b')]=_0x51f203;if(_0x133994[_0xea67('0x2e')][_0xea67('0x42')]){_0x3477d4[_0xea67('0x3f')]=[{'all':!![]}];}return db[_0xea67('0x5a')]['findAll'](_0x3477d4);})[_0xea67('0x22')](function(_0x141441){_0x1b1036['rows']=_0x141441;return _0x1b1036;});}})['then'](respondWithFilteredResult(_0x34827c,_0x3477d4))[_0xea67('0x4c')](handleError(_0x34827c,null));};function char(_0x1489f8){return _0xea67('0x5c')===typeof _0x1489f8?String[_0xea67('0x5d')][_0xea67('0x20')](null,arguments):_0x1489f8;}function needsEncapsulation(_0x45005d){return!!_0x45005d&&(_0x45005d[_0xea67('0x5e')]()[_0xea67('0x5f')](char(0xd))>=0x0||_0x45005d[_0xea67('0x5e')]()[_0xea67('0x5f')](char(0xa))>=0x0||_0x45005d[_0xea67('0x5e')]()[_0xea67('0x5f')](char(0x2c))>=0x0||_0x45005d[_0xea67('0x5e')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x10294f){var _0x241780=char(0x22),_0x3a2d80='\x5c'+char(0x22),_0x3d3b2b=_0x10294f['toString']()[_0xea67('0x60')](new RegExp(_0x241780,'g'),_0x3a2d80);return _0x241780+_0x3d3b2b+_0x241780;}exports['getSummary']=function(_0x4fdc34,_0x2a50b9,_0x3e143f){var _0x3f7f2b,_0x124c4f;var _0x1d6dd7={'where':{'ProjectId':_0x4fdc34[_0xea67('0x40')]['id']}};if(_0x4fdc34[_0xea67('0x2e')][_0xea67('0x61')]){_0x1d6dd7[_0xea67('0x38')][_0xea67('0x62')]=JSON[_0xea67('0x63')](_0x4fdc34[_0xea67('0x2e')]['startTime']);}return db['JscriptySessionReport'][_0xea67('0x64')](_0x1d6dd7)[_0xea67('0x22')](handleEntityNotFound(_0x2a50b9,null))[_0xea67('0x22')](function(_0x3db72b){if(_0x3db72b){_0x3f7f2b=_0x3db72b;return db['JscriptyQuestionReport']['findAll']({'where':{'SessionId':{'$in':_[_0xea67('0x2a')](_0x3f7f2b,'id')},'ProjectId':_0x4fdc34[_0xea67('0x40')]['id']},'order':'-createdAt'});}})[_0xea67('0x22')](handleEntityNotFound(_0x2a50b9,null))[_0xea67('0x22')](function(_0x4e5bf){if(_0x4e5bf){_0x124c4f=_0x4e5bf;var _0x5209d3={};for(var _0x401414=0x0,_0x440a84=_0x124c4f[_0xea67('0x34')];_0x401414<_0x440a84;_0x401414++){if(!_0x5209d3[_0xea67('0x35')](_0x124c4f[_0x401414][_0xea67('0x65')])){_0x5209d3[_0x124c4f[_0x401414][_0xea67('0x65')]]=needsEncapsulation(_0x124c4f[_0x401414][_0xea67('0x66')])?encapsulate(_0x124c4f[_0x401414][_0xea67('0x66')]):_0x124c4f[_0x401414][_0xea67('0x66')];}}var _0x3f2a2e=[],_0x20a843={};for(var _0x3a30d4=0x0,_0x4da43e=_0x3f7f2b[_0xea67('0x34')];_0x3a30d4<_0x4da43e;_0x3a30d4++){_0x20a843={'ProjectId':_0x4fdc34[_0xea67('0x40')]['id'],'SessionId':_0x3f7f2b[_0x3a30d4]['id'],'StartTime':moment(_0x3f7f2b[_0x3a30d4][_0xea67('0x62')])[_0xea67('0x67')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0xc047d4=0x0,_0x540a85=_0x124c4f[_0xea67('0x34')];_0xc047d4<_0x540a85;_0xc047d4++){if(_0x124c4f[_0xc047d4]['SessionId']==_0x3f7f2b[_0x3a30d4]['id']&&_0x5209d3[_0xea67('0x35')](_0x124c4f[_0xc047d4][_0xea67('0x65')])){_0x20a843[_0x5209d3[_0x124c4f[_0xc047d4][_0xea67('0x65')]]]=_0x124c4f[_0xc047d4]['answer'];}}for(var _0xc8ba04 in _0x5209d3){if(!_0x20a843[_0xea67('0x35')](_0x5209d3[_0xc8ba04])){_0x20a843[_0x5209d3[_0xc8ba04]]=null;}}_0x3f2a2e[_0xea67('0x68')](_0x20a843);}return _0x3f2a2e;}})[_0xea67('0x22')](function(_0x5b365c){if(!_['isEmpty'](_0x5b365c)){var _0x4ccb50=toCsv(_0x5b365c);var _0x3dcc53=Date[_0xea67('0x69')]();fs[_0xea67('0x6a')](util[_0xea67('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4fdc34[_0xea67('0x40')]['id'],_0x3dcc53),_0x4ccb50);_0x2a50b9[_0xea67('0x6b')](_0xea67('0x6c'),'attachment;\x20filename='+util[_0xea67('0x67')](_0xea67('0x6d'),_0x4fdc34['params']['id'],_0x3dcc53));_0x2a50b9[_0xea67('0x6b')](_0xea67('0x6e'),_0xea67('0x6f'));return _0x2a50b9[_0xea67('0x70')](util[_0xea67('0x67')](_0xea67('0x71'),_0x4fdc34[_0xea67('0x40')]['id'],_0x3dcc53));}else{return _0x2a50b9[_0xea67('0x17')](0xcc);}})['catch'](handleError(_0x2a50b9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index e8ee8f6..6835f82 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 _0x95f4=['JscriptyProject','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./jscriptyProject.attributes','exports','define'];(function(_0x56f84f,_0x209711){var _0x4cc193=function(_0x58d7d2){while(--_0x58d7d2){_0x56f84f['push'](_0x56f84f['shift']());}};_0x4cc193(++_0x209711);}(_0x95f4,0xf1));var _0x495f=function(_0x4a5b65,_0x30f4f1){_0x4a5b65=_0x4a5b65-0x0;var _0x38324d=_0x95f4[_0x4a5b65];return _0x38324d;};'use strict';var _=require(_0x495f('0x0'));var util=require(_0x495f('0x1'));var logger=require(_0x495f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x495f('0x3'));var rp=require(_0x495f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x495f('0x5'));var attributes=require(_0x495f('0x6'));module[_0x495f('0x7')]=function(_0x4a56a5,_0x704a46){return _0x4a56a5[_0x495f('0x8')](_0x495f('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2e0=['util','api','moment','request-promise','path','rimraf','./jscriptyProject.attributes','exports','JscriptyProject','lodash'];(function(_0x40482b,_0x7626bc){var _0x53a96d=function(_0x5bf0d2){while(--_0x5bf0d2){_0x40482b['push'](_0x40482b['shift']());}};_0x53a96d(++_0x7626bc);}(_0xf2e0,0xc7));var _0x0f2e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xf2e0[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x0f2e('0x0'));var util=require(_0x0f2e('0x1'));var logger=require('../../config/logger')(_0x0f2e('0x2'));var moment=require(_0x0f2e('0x3'));var BPromise=require('bluebird');var rp=require(_0x0f2e('0x4'));var fs=require('fs');var path=require(_0x0f2e('0x5'));var rimraf=require(_0x0f2e('0x6'));var config=require('../../config/environment');var attributes=require(_0x0f2e('0x7'));module[_0x0f2e('0x8')]=function(_0x256aba,_0x47c448){return _0x256aba['define'](_0x0f2e('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index a8de111..e8ef1ff 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 _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x138fe6,_0x5c587c){var _0x455d35=function(_0x485579){while(--_0x485579){_0x138fe6['push'](_0x138fe6['shift']());}};_0x455d35(++_0x5c587c);}(_0x54ef,0x112));var _0xf54e=function(_0x49a145,_0x5ae2cf){_0x49a145=_0x49a145-0x0;var _0x23ad19=_0x54ef[_0x49a145];return _0x23ad19;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ 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','JscriptyProject,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x4c6417,_0x3d27dd){var _0x56da89=function(_0x327032){while(--_0x327032){_0x4c6417['push'](_0x4c6417['shift']());}};_0x56da89(++_0x3d27dd);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('JscriptyProject,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 9016a41..2b43a3b 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 _0xb420=['get','describe','/:id','isAuthenticated','show','post','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./jscriptyQuestionReport.controller','index'];(function(_0x3311ae,_0x362cee){var _0x107949=function(_0x2082a3){while(--_0x2082a3){_0x3311ae['push'](_0x3311ae['shift']());}};_0x107949(++_0x362cee);}(_0xb420,0xc4));var _0x0b42=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb420[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0b42('0x0'));var util=require(_0x0b42('0x1'));var path=require('path');var timeout=require(_0x0b42('0x2'));var express=require(_0x0b42('0x3'));var router=express[_0x0b42('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0b42('0x5'));var config=require('../../config/environment');var controller=require(_0x0b42('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0b42('0x7')]);router[_0x0b42('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x0b42('0x9')]);router['get'](_0x0b42('0xa'),auth[_0x0b42('0xb')](),controller[_0x0b42('0xc')]);router[_0x0b42('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0b42('0xa'),auth[_0x0b42('0xb')](),controller[_0x0b42('0xe')]);router[_0x0b42('0xf')]('/:id',auth[_0x0b42('0xb')](),controller['destroy']);module[_0x0b42('0x10')]=router; \ No newline at end of file +var _0x76fd=['index','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','util','connect-timeout','express','Router','../../components/auth/service','./jscriptyQuestionReport.controller'];(function(_0x1b3a3f,_0x78c6aa){var _0x4de7fd=function(_0x254e20){while(--_0x254e20){_0x1b3a3f['push'](_0x1b3a3f['shift']());}};_0x4de7fd(++_0x78c6aa);}(_0x76fd,0xd7));var _0xd76f=function(_0x117821,_0xaa1933){_0x117821=_0x117821-0x0;var _0x4ae9ff=_0x76fd[_0x117821];return _0x4ae9ff;};'use strict';var multer=require('multer');var util=require(_0xd76f('0x0'));var path=require('path');var timeout=require(_0xd76f('0x1'));var express=require(_0xd76f('0x2'));var router=express[_0xd76f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd76f('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd76f('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xd76f('0x6')]);router[_0xd76f('0x7')]('/describe',auth[_0xd76f('0x8')](),controller['describe']);router[_0xd76f('0x7')](_0xd76f('0x9'),auth[_0xd76f('0x8')](),controller[_0xd76f('0xa')]);router[_0xd76f('0xb')]('/',auth[_0xd76f('0x8')](),controller[_0xd76f('0xc')]);router[_0xd76f('0xd')]('/:id',auth[_0xd76f('0x8')](),controller[_0xd76f('0xe')]);router[_0xd76f('0xf')](_0xd76f('0x9'),auth[_0xd76f('0x8')](),controller['destroy']);module[_0xd76f('0x10')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 21f1cf3..f3ca071 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(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x7a54,0x106));var _0x47a5=function(_0x2f522f,_0x1a11d1){_0x2f522f=_0x2f522f-0x0;var _0x5b4ded=_0x7a54[_0x2f522f];return _0x5b4ded;};'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(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x7a54,0x106));var _0x47a5=function(_0x3b09b1,_0x49f40e){_0x3b09b1=_0x3b09b1-0x0;var _0x4ca72c=_0x7a54[_0x3b09b1];return _0x4ca72c;};'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 839390f..2016ada 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 _0x3c8b=['pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','fields','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/environment','status','json','undefined','count','set','apply','reject','update','then','destroy','end','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','limit','offset','order','sort'];(function(_0x352705,_0x464d63){var _0x12cd25=function(_0xa271df){while(--_0xa271df){_0x352705['push'](_0x352705['shift']());}};_0x12cd25(++_0x464d63);}(_0x3c8b,0x1cd));var _0xb3c8=function(_0x36e381,_0x4dcd56){_0x36e381=_0x36e381-0x0;var _0xcbbdf3=_0x3c8b[_0x36e381];return _0xcbbdf3;};'use strict';var emlformat=require(_0xb3c8('0x0'));var rimraf=require(_0xb3c8('0x1'));var zipdir=require(_0xb3c8('0x2'));var jsonpatch=require(_0xb3c8('0x3'));var rp=require(_0xb3c8('0x4'));var moment=require(_0xb3c8('0x5'));var BPromise=require(_0xb3c8('0x6'));var Mustache=require(_0xb3c8('0x7'));var util=require(_0xb3c8('0x8'));var path=require(_0xb3c8('0x9'));var sox=require(_0xb3c8('0xa'));var csv=require(_0xb3c8('0xb'));var ejs=require(_0xb3c8('0xc'));var fs=require('fs');var fs_extra=require(_0xb3c8('0xd'));var _=require(_0xb3c8('0xe'));var squel=require(_0xb3c8('0xf'));var crypto=require(_0xb3c8('0x10'));var jsforce=require(_0xb3c8('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xb3c8('0xb'));var querystring=require(_0xb3c8('0x12'));var Papa=require(_0xb3c8('0x13'));var Redis=require(_0xb3c8('0x14'));var authService=require(_0xb3c8('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xb3c8('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xb3c8('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e368a,_0x2d6a54){_0x2d6a54=_0x2d6a54||0xcc;return function(_0x4732c7){if(_0x4732c7){return _0x4e368a['sendStatus'](_0x2d6a54);}return _0x4e368a[_0xb3c8('0x18')](_0x2d6a54)['end']();};}function respondWithResult(_0xc6403f,_0x47b459){_0x47b459=_0x47b459||0xc8;return function(_0x3bd7fa){if(_0x3bd7fa){return _0xc6403f['status'](_0x47b459)[_0xb3c8('0x19')](_0x3bd7fa);}};}function respondWithFilteredResult(_0x4a8443,_0x2ecd9b){return function(_0x3c0f8f){if(_0x3c0f8f){var _0x538b16=typeof _0x2ecd9b['offset']===_0xb3c8('0x1a')&&typeof _0x2ecd9b['limit']===_0xb3c8('0x1a');var _0x584efc=_0x3c0f8f[_0xb3c8('0x1b')];var _0x14ab5f=_0x538b16?0x0:_0x2ecd9b['offset'];var _0x538c3f=_0x538b16?_0x3c0f8f['count']:_0x2ecd9b['offset']+_0x2ecd9b['limit'];var _0x3981a6;if(_0x538c3f>=_0x584efc){_0x538c3f=_0x584efc;_0x3981a6=0xc8;}else{_0x3981a6=0xce;}_0x4a8443[_0xb3c8('0x18')](_0x3981a6);return _0x4a8443[_0xb3c8('0x1c')]('Content-Range',_0x14ab5f+'-'+_0x538c3f+'/'+_0x584efc)[_0xb3c8('0x19')](_0x3c0f8f);}return null;};}function patchUpdates(_0x584d16){return function(_0x2239cb){try{jsonpatch[_0xb3c8('0x1d')](_0x2239cb,_0x584d16,!![]);}catch(_0x168698){return BPromise[_0xb3c8('0x1e')](_0x168698);}return _0x2239cb['save']();};}function saveUpdates(_0x4f1cda,_0x3243ca){return function(_0x250c03){if(_0x250c03){return _0x250c03[_0xb3c8('0x1f')](_0x4f1cda)[_0xb3c8('0x20')](function(_0x3a81e4){return _0x3a81e4;});}return null;};}function removeEntity(_0x234a68,_0x2b12cc){return function(_0x16e1c1){if(_0x16e1c1){return _0x16e1c1[_0xb3c8('0x21')]()[_0xb3c8('0x20')](function(){_0x234a68['status'](0xcc)[_0xb3c8('0x22')]();});}};}function handleEntityNotFound(_0x1c0e3b,_0x109630){return function(_0x2ac754){if(!_0x2ac754){_0x1c0e3b['sendStatus'](0x194);}return _0x2ac754;};}function handleError(_0x31bfc1,_0x307f2b){_0x307f2b=_0x307f2b||0x1f4;return function(_0x5358e4){logger['error'](_0x5358e4[_0xb3c8('0x23')]);if(_0x5358e4[_0xb3c8('0x24')]){delete _0x5358e4[_0xb3c8('0x24')];}_0x31bfc1['status'](_0x307f2b)[_0xb3c8('0x25')](_0x5358e4);};}exports[_0xb3c8('0x26')]=function(_0x1be226,_0x1426e5){var _0x158260={},_0x40090a={},_0x334828={'count':0x0,'rows':[]};var _0x1ba510=_['map'](db[_0xb3c8('0x27')][_0xb3c8('0x28')],function(_0x1219fc){return{'name':_0x1219fc[_0xb3c8('0x29')],'type':_0x1219fc['type'][_0xb3c8('0x2a')]};});_0x40090a[_0xb3c8('0x2b')]=_[_0xb3c8('0x2c')](_0x1ba510,_0xb3c8('0x24'));_0x40090a[_0xb3c8('0x2d')]=_[_0xb3c8('0x2e')](_0x1be226['query']);_0x40090a[_0xb3c8('0x2f')]=_['intersection'](_0x40090a[_0xb3c8('0x2b')],_0x40090a[_0xb3c8('0x2d')]);_0x158260[_0xb3c8('0x30')]=_[_0xb3c8('0x31')](_0x40090a[_0xb3c8('0x2b')],qs['fields'](_0x1be226['query']['fields']));_0x158260['attributes']=_0x158260['attributes'][_0xb3c8('0x32')]?_0x158260['attributes']:_0x40090a['model'];if(!_0x1be226['query'][_0xb3c8('0x33')](_0xb3c8('0x34'))){_0x158260[_0xb3c8('0x35')]=qs['limit'](_0x1be226[_0xb3c8('0x2d')][_0xb3c8('0x35')]);_0x158260[_0xb3c8('0x36')]=qs[_0xb3c8('0x36')](_0x1be226[_0xb3c8('0x2d')][_0xb3c8('0x36')]);}_0x158260[_0xb3c8('0x37')]=qs[_0xb3c8('0x38')](_0x1be226[_0xb3c8('0x2d')][_0xb3c8('0x38')]);_0x158260['where']=qs['filters'](_[_0xb3c8('0x39')](_0x1be226[_0xb3c8('0x2d')],_0x40090a[_0xb3c8('0x2f')]),_0x1ba510);if(_0x1be226[_0xb3c8('0x2d')][_0xb3c8('0x3a')]){_0x158260[_0xb3c8('0x3b')]=_[_0xb3c8('0x3c')](_0x158260['where'],{'$or':_[_0xb3c8('0x2c')](_0x1ba510,function(_0xd70d9e){if(_0xd70d9e[_0xb3c8('0x3d')]!==_0xb3c8('0x3e')){var _0x244f19={};_0x244f19[_0xd70d9e[_0xb3c8('0x24')]]={'$like':'%'+_0x1be226[_0xb3c8('0x2d')][_0xb3c8('0x3a')]+'%'};return _0x244f19;}})});}_0x158260=_['merge']({},_0x158260,_0x1be226[_0xb3c8('0x3f')]);var _0x28c593={'where':_0x158260[_0xb3c8('0x3b')]};return db[_0xb3c8('0x27')][_0xb3c8('0x1b')](_0x28c593)[_0xb3c8('0x20')](function(_0x4f7574){_0x334828['count']=_0x4f7574;if(_0x1be226['query'][_0xb3c8('0x40')]){_0x158260[_0xb3c8('0x41')]=[{'all':!![]}];}return db[_0xb3c8('0x27')]['findAll'](_0x158260);})['then'](function(_0x7b989b){_0x334828[_0xb3c8('0x42')]=_0x7b989b;return _0x334828;})[_0xb3c8('0x20')](respondWithFilteredResult(_0x1426e5,_0x158260))['catch'](handleError(_0x1426e5,null));};exports[_0xb3c8('0x43')]=function(_0x3c9d42,_0x2dc8aa){var _0x5b10e0={'raw':!![],'where':{'id':_0x3c9d42[_0xb3c8('0x44')]['id']}},_0x4a1f08={};_0x4a1f08['model']=_['keys'](db['JscriptyQuestionReport'][_0xb3c8('0x28')]);_0x4a1f08[_0xb3c8('0x2d')]=_['keys'](_0x3c9d42[_0xb3c8('0x2d')]);_0x4a1f08['filters']=_['intersection'](_0x4a1f08[_0xb3c8('0x2b')],_0x4a1f08['query']);_0x5b10e0[_0xb3c8('0x30')]=_['intersection'](_0x4a1f08['model'],qs[_0xb3c8('0x45')](_0x3c9d42[_0xb3c8('0x2d')][_0xb3c8('0x45')]));_0x5b10e0[_0xb3c8('0x30')]=_0x5b10e0[_0xb3c8('0x30')][_0xb3c8('0x32')]?_0x5b10e0['attributes']:_0x4a1f08[_0xb3c8('0x2b')];if(_0x3c9d42['query'][_0xb3c8('0x40')]){_0x5b10e0[_0xb3c8('0x41')]=[{'all':!![]}];}_0x5b10e0=_[_0xb3c8('0x3c')]({},_0x5b10e0,_0x3c9d42[_0xb3c8('0x3f')]);return db[_0xb3c8('0x27')][_0xb3c8('0x46')](_0x5b10e0)[_0xb3c8('0x20')](handleEntityNotFound(_0x2dc8aa,null))[_0xb3c8('0x20')](respondWithResult(_0x2dc8aa,null))[_0xb3c8('0x47')](handleError(_0x2dc8aa,null));};exports[_0xb3c8('0x48')]=function(_0x281d9d,_0x1094e3){return db[_0xb3c8('0x27')][_0xb3c8('0x48')](_0x281d9d['body'],{})[_0xb3c8('0x20')](respondWithResult(_0x1094e3,0xc9))[_0xb3c8('0x47')](handleError(_0x1094e3,null));};exports[_0xb3c8('0x1f')]=function(_0x5b2207,_0x89a860){if(_0x5b2207[_0xb3c8('0x49')]['id']){delete _0x5b2207[_0xb3c8('0x49')]['id'];}return db['JscriptyQuestionReport'][_0xb3c8('0x46')]({'where':{'id':_0x5b2207[_0xb3c8('0x44')]['id']}})[_0xb3c8('0x20')](handleEntityNotFound(_0x89a860,null))[_0xb3c8('0x20')](saveUpdates(_0x5b2207['body'],null))[_0xb3c8('0x20')](respondWithResult(_0x89a860,null))[_0xb3c8('0x47')](handleError(_0x89a860,null));};exports[_0xb3c8('0x21')]=function(_0x37387d,_0xa028e1){return db[_0xb3c8('0x27')]['find']({'where':{'id':_0x37387d[_0xb3c8('0x44')]['id']}})[_0xb3c8('0x20')](handleEntityNotFound(_0xa028e1,null))[_0xb3c8('0x20')](removeEntity(_0xa028e1,null))[_0xb3c8('0x47')](handleError(_0xa028e1,null));};exports['describe']=function(_0x387895,_0x2882ad){return db[_0xb3c8('0x27')]['describe']()['then'](respondWithResult(_0x2882ad,null))[_0xb3c8('0x47')](handleError(_0x2882ad,null));}; \ No newline at end of file +var _0x6f6c=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','destroy','describe','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x6f6c,0x8d));var _0xc6f6=function(_0x2c30e1,_0x2658d3){_0x2c30e1=_0x2c30e1-0x0;var _0x32fbda=_0x6f6c[_0x2c30e1];return _0x32fbda;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc6f6('0x0'));var jsonpatch=require(_0xc6f6('0x1'));var rp=require(_0xc6f6('0x2'));var moment=require('moment');var BPromise=require(_0xc6f6('0x3'));var Mustache=require('mustache');var util=require(_0xc6f6('0x4'));var path=require(_0xc6f6('0x5'));var sox=require(_0xc6f6('0x6'));var csv=require(_0xc6f6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6f6('0x8'));var squel=require('squel');var crypto=require(_0xc6f6('0x9'));var jsforce=require(_0xc6f6('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc6f6('0x7'));var querystring=require(_0xc6f6('0xb'));var Papa=require(_0xc6f6('0xc'));var Redis=require(_0xc6f6('0xd'));var authService=require(_0xc6f6('0xe'));var qs=require(_0xc6f6('0xf'));var as=require(_0xc6f6('0x10'));var hardwareService=require(_0xc6f6('0x11'));var logger=require(_0xc6f6('0x12'))(_0xc6f6('0x13'));var utils=require(_0xc6f6('0x14'));var config=require(_0xc6f6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6f6('0x16'))['db'];function respondWithStatusCode(_0x395cad,_0x58f8b2){_0x58f8b2=_0x58f8b2||0xcc;return function(_0x5479e0){if(_0x5479e0){return _0x395cad['sendStatus'](_0x58f8b2);}return _0x395cad[_0xc6f6('0x17')](_0x58f8b2)[_0xc6f6('0x18')]();};}function respondWithResult(_0x194f84,_0x99d6f2){_0x99d6f2=_0x99d6f2||0xc8;return function(_0xba7004){if(_0xba7004){return _0x194f84[_0xc6f6('0x17')](_0x99d6f2)[_0xc6f6('0x19')](_0xba7004);}};}function respondWithFilteredResult(_0x2c4def,_0x1f0855){return function(_0x493013){if(_0x493013){var _0x3e064e=typeof _0x1f0855[_0xc6f6('0x1a')]===_0xc6f6('0x1b')&&typeof _0x1f0855[_0xc6f6('0x1c')]===_0xc6f6('0x1b');var _0x400c86=_0x493013[_0xc6f6('0x1d')];var _0x16c901=_0x3e064e?0x0:_0x1f0855[_0xc6f6('0x1a')];var _0x177d0e=_0x3e064e?_0x493013[_0xc6f6('0x1d')]:_0x1f0855[_0xc6f6('0x1a')]+_0x1f0855['limit'];var _0x1d4df7;if(_0x177d0e>=_0x400c86){_0x177d0e=_0x400c86;_0x1d4df7=0xc8;}else{_0x1d4df7=0xce;}_0x2c4def['status'](_0x1d4df7);return _0x2c4def['set'](_0xc6f6('0x1e'),_0x16c901+'-'+_0x177d0e+'/'+_0x400c86)['json'](_0x493013);}return null;};}function patchUpdates(_0x329daf){return function(_0x2435ad){try{jsonpatch[_0xc6f6('0x1f')](_0x2435ad,_0x329daf,!![]);}catch(_0x34d847){return BPromise[_0xc6f6('0x20')](_0x34d847);}return _0x2435ad[_0xc6f6('0x21')]();};}function saveUpdates(_0xa9cd12,_0x5c4ea4){return function(_0x4a9beb){if(_0x4a9beb){return _0x4a9beb[_0xc6f6('0x22')](_0xa9cd12)[_0xc6f6('0x23')](function(_0x27832d){return _0x27832d;});}return null;};}function removeEntity(_0x4419d1,_0x4d1aa5){return function(_0x1745ce){if(_0x1745ce){return _0x1745ce['destroy']()[_0xc6f6('0x23')](function(){_0x4419d1[_0xc6f6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1be8b8,_0x579f73){return function(_0x29e917){if(!_0x29e917){_0x1be8b8[_0xc6f6('0x24')](0x194);}return _0x29e917;};}function handleError(_0x3fd096,_0x3a99e1){_0x3a99e1=_0x3a99e1||0x1f4;return function(_0x51a994){logger[_0xc6f6('0x25')](_0x51a994[_0xc6f6('0x26')]);if(_0x51a994[_0xc6f6('0x27')]){delete _0x51a994[_0xc6f6('0x27')];}_0x3fd096[_0xc6f6('0x17')](_0x3a99e1)['send'](_0x51a994);};}exports[_0xc6f6('0x28')]=function(_0x5c96f8,_0x4b283d){var _0x526e07={},_0x53159c={},_0x517bc9={'count':0x0,'rows':[]};var _0x54c537=_[_0xc6f6('0x29')](db[_0xc6f6('0x2a')][_0xc6f6('0x2b')],function(_0x2eff31){return{'name':_0x2eff31[_0xc6f6('0x2c')],'type':_0x2eff31[_0xc6f6('0x2d')][_0xc6f6('0x2e')]};});_0x53159c[_0xc6f6('0x2f')]=_[_0xc6f6('0x29')](_0x54c537,_0xc6f6('0x27'));_0x53159c[_0xc6f6('0x30')]=_[_0xc6f6('0x31')](_0x5c96f8['query']);_0x53159c[_0xc6f6('0x32')]=_[_0xc6f6('0x33')](_0x53159c[_0xc6f6('0x2f')],_0x53159c[_0xc6f6('0x30')]);_0x526e07[_0xc6f6('0x34')]=_['intersection'](_0x53159c[_0xc6f6('0x2f')],qs[_0xc6f6('0x35')](_0x5c96f8[_0xc6f6('0x30')][_0xc6f6('0x35')]));_0x526e07[_0xc6f6('0x34')]=_0x526e07['attributes'][_0xc6f6('0x36')]?_0x526e07[_0xc6f6('0x34')]:_0x53159c['model'];if(!_0x5c96f8[_0xc6f6('0x30')]['hasOwnProperty'](_0xc6f6('0x37'))){_0x526e07['limit']=qs[_0xc6f6('0x1c')](_0x5c96f8[_0xc6f6('0x30')][_0xc6f6('0x1c')]);_0x526e07['offset']=qs[_0xc6f6('0x1a')](_0x5c96f8['query'][_0xc6f6('0x1a')]);}_0x526e07[_0xc6f6('0x38')]=qs[_0xc6f6('0x39')](_0x5c96f8[_0xc6f6('0x30')]['sort']);_0x526e07[_0xc6f6('0x3a')]=qs['filters'](_[_0xc6f6('0x3b')](_0x5c96f8[_0xc6f6('0x30')],_0x53159c[_0xc6f6('0x32')]),_0x54c537);if(_0x5c96f8[_0xc6f6('0x30')]['filter']){_0x526e07[_0xc6f6('0x3a')]=_[_0xc6f6('0x3c')](_0x526e07[_0xc6f6('0x3a')],{'$or':_[_0xc6f6('0x29')](_0x54c537,function(_0x537903){if(_0x537903[_0xc6f6('0x2d')]!==_0xc6f6('0x3d')){var _0x2508b9={};_0x2508b9[_0x537903[_0xc6f6('0x27')]]={'$like':'%'+_0x5c96f8[_0xc6f6('0x30')][_0xc6f6('0x3e')]+'%'};return _0x2508b9;}})});}_0x526e07=_[_0xc6f6('0x3c')]({},_0x526e07,_0x5c96f8[_0xc6f6('0x3f')]);var _0x3e4e5d={'where':_0x526e07['where']};return db['JscriptyQuestionReport'][_0xc6f6('0x1d')](_0x3e4e5d)[_0xc6f6('0x23')](function(_0x749c1c){_0x517bc9['count']=_0x749c1c;if(_0x5c96f8['query'][_0xc6f6('0x40')]){_0x526e07[_0xc6f6('0x41')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xc6f6('0x42')](_0x526e07);})[_0xc6f6('0x23')](function(_0x4d738f){_0x517bc9[_0xc6f6('0x43')]=_0x4d738f;return _0x517bc9;})[_0xc6f6('0x23')](respondWithFilteredResult(_0x4b283d,_0x526e07))['catch'](handleError(_0x4b283d,null));};exports[_0xc6f6('0x44')]=function(_0x12cc91,_0x47e96d){var _0x59dca4={'raw':!![],'where':{'id':_0x12cc91[_0xc6f6('0x45')]['id']}},_0x34ae18={};_0x34ae18['model']=_[_0xc6f6('0x31')](db[_0xc6f6('0x2a')][_0xc6f6('0x2b')]);_0x34ae18[_0xc6f6('0x30')]=_['keys'](_0x12cc91[_0xc6f6('0x30')]);_0x34ae18['filters']=_[_0xc6f6('0x33')](_0x34ae18['model'],_0x34ae18[_0xc6f6('0x30')]);_0x59dca4[_0xc6f6('0x34')]=_[_0xc6f6('0x33')](_0x34ae18[_0xc6f6('0x2f')],qs[_0xc6f6('0x35')](_0x12cc91[_0xc6f6('0x30')][_0xc6f6('0x35')]));_0x59dca4['attributes']=_0x59dca4[_0xc6f6('0x34')][_0xc6f6('0x36')]?_0x59dca4[_0xc6f6('0x34')]:_0x34ae18[_0xc6f6('0x2f')];if(_0x12cc91[_0xc6f6('0x30')]['includeAll']){_0x59dca4[_0xc6f6('0x41')]=[{'all':!![]}];}_0x59dca4=_[_0xc6f6('0x3c')]({},_0x59dca4,_0x12cc91[_0xc6f6('0x3f')]);return db[_0xc6f6('0x2a')][_0xc6f6('0x46')](_0x59dca4)[_0xc6f6('0x23')](handleEntityNotFound(_0x47e96d,null))[_0xc6f6('0x23')](respondWithResult(_0x47e96d,null))['catch'](handleError(_0x47e96d,null));};exports[_0xc6f6('0x47')]=function(_0x7ba49b,_0x13bba5){return db[_0xc6f6('0x2a')][_0xc6f6('0x47')](_0x7ba49b[_0xc6f6('0x48')],{})[_0xc6f6('0x23')](respondWithResult(_0x13bba5,0xc9))[_0xc6f6('0x49')](handleError(_0x13bba5,null));};exports[_0xc6f6('0x22')]=function(_0x26b3fb,_0x2e8f1b){if(_0x26b3fb[_0xc6f6('0x48')]['id']){delete _0x26b3fb[_0xc6f6('0x48')]['id'];}return db['JscriptyQuestionReport'][_0xc6f6('0x46')]({'where':{'id':_0x26b3fb[_0xc6f6('0x45')]['id']}})[_0xc6f6('0x23')](handleEntityNotFound(_0x2e8f1b,null))[_0xc6f6('0x23')](saveUpdates(_0x26b3fb[_0xc6f6('0x48')],null))['then'](respondWithResult(_0x2e8f1b,null))['catch'](handleError(_0x2e8f1b,null));};exports[_0xc6f6('0x4a')]=function(_0x2feaf4,_0x1aa013){return db[_0xc6f6('0x2a')][_0xc6f6('0x46')]({'where':{'id':_0x2feaf4[_0xc6f6('0x45')]['id']}})['then'](handleEntityNotFound(_0x1aa013,null))[_0xc6f6('0x23')](removeEntity(_0x1aa013,null))[_0xc6f6('0x49')](handleError(_0x1aa013,null));};exports['describe']=function(_0x5de380,_0x88a34e){return db[_0xc6f6('0x2a')][_0xc6f6('0x4b')]()[_0xc6f6('0x23')](respondWithResult(_0x88a34e,null))['catch'](handleError(_0x88a34e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index db44a65..c6637ed 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 _0x4754=['JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define'];(function(_0x4bda99,_0x5f39e0){var _0x29737b=function(_0x5afe04){while(--_0x5afe04){_0x4bda99['push'](_0x4bda99['shift']());}};_0x29737b(++_0x5f39e0);}(_0x4754,0x198));var _0x4475=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4754[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4475('0x0'));var util=require(_0x4475('0x1'));var logger=require(_0x4475('0x2'))(_0x4475('0x3'));var moment=require(_0x4475('0x4'));var BPromise=require(_0x4475('0x5'));var rp=require(_0x4475('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4475('0x7'));var config=require(_0x4475('0x8'));var attributes=require(_0x4475('0x9'));module[_0x4475('0xa')]=function(_0xc8f6ef,_0x2b98ae){return _0xc8f6ef[_0x4475('0xb')](_0x4475('0xc'),attributes,{'tableName':_0x4475('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb0c=['define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptyQuestionReport.attributes','exports'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0xeb0c,0x8f));var _0xceb0=function(_0x4de9e8,_0x565ffa){_0x4de9e8=_0x4de9e8-0x0;var _0x4db0de=_0xeb0c[_0x4de9e8];return _0x4db0de;};'use strict';var _=require(_0xceb0('0x0'));var util=require(_0xceb0('0x1'));var logger=require(_0xceb0('0x2'))(_0xceb0('0x3'));var moment=require(_0xceb0('0x4'));var BPromise=require(_0xceb0('0x5'));var rp=require(_0xceb0('0x6'));var fs=require('fs');var path=require(_0xceb0('0x7'));var rimraf=require(_0xceb0('0x8'));var config=require('../../config/environment');var attributes=require(_0xceb0('0x9'));module[_0xceb0('0xa')]=function(_0x5048ab,_0x7c1bfb){return _0x5048ab[_0xceb0('0xb')](_0xceb0('0xc'),attributes,{'tableName':_0xceb0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 5366359..12173fc 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 _0x24de=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x15876a,_0x15383d){var _0xbd900f=function(_0x103e59){while(--_0x103e59){_0x15876a['push'](_0x15876a['shift']());}};_0xbd900f(++_0x15383d);}(_0x24de,0xca));var _0xe24d=function(_0x1f204b,_0x50a818){_0x1f204b=_0x1f204b-0x0;var _0x745d3b=_0x24de[_0x1f204b];return _0x745d3b;};'use strict';var _=require('lodash');var util=require(_0xe24d('0x0'));var moment=require(_0xe24d('0x1'));var BPromise=require(_0xe24d('0x2'));var rs=require(_0xe24d('0x3'));var fs=require('fs');var Redis=require(_0xe24d('0x4'));var db=require(_0xe24d('0x5'))['db'];var utils=require(_0xe24d('0x6'));var logger=require(_0xe24d('0x7'))(_0xe24d('0x8'));var config=require(_0xe24d('0x9'));var jayson=require(_0xe24d('0xa'));var client=jayson[_0xe24d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37320d,_0x213a5d,_0x318d1c){return new BPromise(function(_0x41d53b,_0x2c660a){return client[_0xe24d('0xc')](_0x37320d,_0x318d1c)[_0xe24d('0xd')](function(_0xf3a44a){logger[_0xe24d('0xe')](_0xe24d('0xf'),_0x213a5d,_0xe24d('0x10'));logger[_0xe24d('0x11')](_0xe24d('0x12'),_0x213a5d,_0xe24d('0x10'),JSON[_0xe24d('0x13')](_0xf3a44a));if(_0xf3a44a['error']){if(_0xf3a44a[_0xe24d('0x14')][_0xe24d('0x15')]===0x1f4){logger[_0xe24d('0x14')](_0xe24d('0xf'),_0x213a5d,_0xf3a44a[_0xe24d('0x14')][_0xe24d('0x16')]);return _0x2c660a(_0xf3a44a[_0xe24d('0x14')]['message']);}logger[_0xe24d('0x14')](_0xe24d('0xf'),_0x213a5d,_0xf3a44a[_0xe24d('0x14')][_0xe24d('0x16')]);return _0x41d53b(_0xf3a44a[_0xe24d('0x14')][_0xe24d('0x16')]);}else{logger[_0xe24d('0xe')](_0xe24d('0xf'),_0x213a5d,_0xe24d('0x10'));_0x41d53b(_0xf3a44a[_0xe24d('0x17')][_0xe24d('0x16')]);}})[_0xe24d('0x18')](function(_0x2e1959){logger[_0xe24d('0x14')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x213a5d,_0x2e1959);_0x2c660a(_0x2e1959);});});} \ No newline at end of file +var _0x9f73=['client','http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1f951b,_0x654997){var _0x503af0=function(_0x40a7d9){while(--_0x40a7d9){_0x1f951b['push'](_0x1f951b['shift']());}};_0x503af0(++_0x654997);}(_0x9f73,0x69));var _0x39f7=function(_0x42c7c0,_0x59c1e3){_0x42c7c0=_0x42c7c0-0x0;var _0x3ad75a=_0x9f73[_0x42c7c0];return _0x3ad75a;};'use strict';var _=require(_0x39f7('0x0'));var util=require(_0x39f7('0x1'));var moment=require(_0x39f7('0x2'));var BPromise=require(_0x39f7('0x3'));var rs=require(_0x39f7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x39f7('0x5'));var logger=require(_0x39f7('0x6'))(_0x39f7('0x7'));var config=require(_0x39f7('0x8'));var jayson=require(_0x39f7('0x9'));var client=jayson[_0x39f7('0xa')][_0x39f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb5950b,_0x26b1db,_0x37a791){return new BPromise(function(_0x86ff47,_0x1a8ce1){return client['request'](_0xb5950b,_0x37a791)[_0x39f7('0xc')](function(_0x154b1b){logger[_0x39f7('0xd')](_0x39f7('0xe'),_0x26b1db,_0x39f7('0xf'));logger[_0x39f7('0x10')](_0x39f7('0x11'),_0x26b1db,'request\x20sent',JSON[_0x39f7('0x12')](_0x154b1b));if(_0x154b1b[_0x39f7('0x13')]){if(_0x154b1b['error'][_0x39f7('0x14')]===0x1f4){logger[_0x39f7('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x26b1db,_0x154b1b[_0x39f7('0x13')][_0x39f7('0x15')]);return _0x1a8ce1(_0x154b1b[_0x39f7('0x13')][_0x39f7('0x15')]);}logger[_0x39f7('0x13')](_0x39f7('0xe'),_0x26b1db,_0x154b1b[_0x39f7('0x13')][_0x39f7('0x15')]);return _0x86ff47(_0x154b1b[_0x39f7('0x13')][_0x39f7('0x15')]);}else{logger[_0x39f7('0xd')](_0x39f7('0xe'),_0x26b1db,_0x39f7('0xf'));_0x86ff47(_0x154b1b[_0x39f7('0x16')][_0x39f7('0x15')]);}})['catch'](function(_0x94e019){logger[_0x39f7('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x26b1db,_0x94e019);_0x1a8ce1(_0x94e019);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 7f145b5..c483a5c 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 _0xa3a2=['multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/questions','getQuestions','post','create','put','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3a2,0xa8));var _0x2a3a=function(_0x35d59c,_0x341ef9){_0x35d59c=_0x35d59c-0x0;var _0x18cd27=_0xa3a2[_0x35d59c];return _0x18cd27;};'use strict';var multer=require(_0x2a3a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2a3a('0x1'));var express=require(_0x2a3a('0x2'));var router=express['Router']();var fs_extra=require(_0x2a3a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x2a3a('0x4'));var config=require(_0x2a3a('0x5'));var controller=require(_0x2a3a('0x6'));router[_0x2a3a('0x7')]('/',auth['isAuthenticated'](),controller[_0x2a3a('0x8')]);router['get'](_0x2a3a('0x9'),auth[_0x2a3a('0xa')](),controller['describe']);router[_0x2a3a('0x7')](_0x2a3a('0xb'),auth[_0x2a3a('0xa')](),controller[_0x2a3a('0xc')]);router[_0x2a3a('0x7')](_0x2a3a('0xd'),auth[_0x2a3a('0xa')](),controller[_0x2a3a('0xe')]);router[_0x2a3a('0xf')]('/',auth[_0x2a3a('0xa')](),controller[_0x2a3a('0x10')]);router[_0x2a3a('0x11')](_0x2a3a('0xb'),auth[_0x2a3a('0xa')](),controller['update']);router[_0x2a3a('0x12')](_0x2a3a('0xb'),auth[_0x2a3a('0xa')](),controller[_0x2a3a('0x13')]);module[_0x2a3a('0x14')]=router; \ No newline at end of file +var _0x0c1b=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','index','get','describe','/:id','show','/:id/questions','isAuthenticated','getQuestions','post','create','put','delete'];(function(_0x3f50f5,_0xb4a4ea){var _0xd6916f=function(_0x1378c2){while(--_0x1378c2){_0x3f50f5['push'](_0x3f50f5['shift']());}};_0xd6916f(++_0xb4a4ea);}(_0x0c1b,0x6f));var _0xb0c1=function(_0x4d7a70,_0x2d3bfa){_0x4d7a70=_0x4d7a70-0x0;var _0x3aafbb=_0x0c1b[_0x4d7a70];return _0x3aafbb;};'use strict';var multer=require(_0xb0c1('0x0'));var util=require(_0xb0c1('0x1'));var path=require(_0xb0c1('0x2'));var timeout=require(_0xb0c1('0x3'));var express=require('express');var router=express[_0xb0c1('0x4')]();var fs_extra=require(_0xb0c1('0x5'));var auth=require(_0xb0c1('0x6'));var interaction=require(_0xb0c1('0x7'));var config=require('../../config/environment');var controller=require(_0xb0c1('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb0c1('0x9')]);router[_0xb0c1('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xb0c1('0xb')]);router[_0xb0c1('0xa')](_0xb0c1('0xc'),auth['isAuthenticated'](),controller[_0xb0c1('0xd')]);router['get'](_0xb0c1('0xe'),auth[_0xb0c1('0xf')](),controller[_0xb0c1('0x10')]);router[_0xb0c1('0x11')]('/',auth[_0xb0c1('0xf')](),controller[_0xb0c1('0x12')]);router[_0xb0c1('0x13')]('/:id',auth[_0xb0c1('0xf')](),controller['update']);router[_0xb0c1('0x14')](_0xb0c1('0xc'),auth[_0xb0c1('0xf')](),controller['destroy']);module[_0xb0c1('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index c9f72e1..26a2f01 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 _0xff20=['format','STRING','BOOLEAN','DATE','setDataValue','endtime'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xff20,0x87));var _0x0ff2=function(_0x2383c8,_0x5418f9){_0x2383c8=_0x2383c8-0x0;var _0x2ec663=_0xff20[_0x2383c8];return _0x2ec663;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0x0ff2('0x0')],'set':function(_0x5a7374){this[_0x0ff2('0x1')]('starttime',_0x5a7374);this[_0x0ff2('0x1')](_0x0ff2('0x2'),moment()[_0x0ff2('0x3')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x0ff2('0x4')]},'queue':{'type':Sequelize[_0x0ff2('0x4')]},'uniqueid':{'type':Sequelize[_0x0ff2('0x4')]},'calleridname':{'type':Sequelize[_0x0ff2('0x4')]},'calleridnum':{'type':Sequelize[_0x0ff2('0x4')]},'completed':{'type':Sequelize[_0x0ff2('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xdcd5=['DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports'];(function(_0x58ceb9,_0x5601df){var _0x3d0ff5=function(_0x3a79d0){while(--_0x3a79d0){_0x58ceb9['push'](_0x58ceb9['shift']());}};_0x3d0ff5(++_0x5601df);}(_0xdcd5,0x110));var _0x5dcd=function(_0x4ac424,_0x554b5d){_0x4ac424=_0x4ac424-0x0;var _0xe1b890=_0xdcd5[_0x4ac424];return _0xe1b890;};'use strict';var moment=require(_0x5dcd('0x0'));var Sequelize=require(_0x5dcd('0x1'));module[_0x5dcd('0x2')]={'starttime':{'type':Sequelize[_0x5dcd('0x3')],'set':function(_0x21234e){this[_0x5dcd('0x4')](_0x5dcd('0x5'),_0x21234e);this['setDataValue'](_0x5dcd('0x6'),moment()[_0x5dcd('0x7')](_0x5dcd('0x8')));}},'endtime':{'type':Sequelize[_0x5dcd('0x3')]},'membername':{'type':Sequelize[_0x5dcd('0x9')]},'projectname':{'type':Sequelize[_0x5dcd('0x9')]},'queue':{'type':Sequelize[_0x5dcd('0x9')]},'uniqueid':{'type':Sequelize[_0x5dcd('0x9')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x5dcd('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 7b039cf..edc5eb2 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 _0xaed1=['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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','error','stack','name','send','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','nolimit','pick','SessionId'];(function(_0x5cd8a1,_0x437b45){var _0x3d7ce1=function(_0x42e8a7){while(--_0x42e8a7){_0x5cd8a1['push'](_0x5cd8a1['shift']());}};_0x3d7ce1(++_0x437b45);}(_0xaed1,0x1a9));var _0x1aed=function(_0x22a409,_0x1e7083){_0x22a409=_0x22a409-0x0;var _0x4ffcf0=_0xaed1[_0x22a409];return _0x4ffcf0;};'use strict';var emlformat=require(_0x1aed('0x0'));var rimraf=require(_0x1aed('0x1'));var zipdir=require(_0x1aed('0x2'));var jsonpatch=require(_0x1aed('0x3'));var rp=require(_0x1aed('0x4'));var moment=require(_0x1aed('0x5'));var BPromise=require(_0x1aed('0x6'));var Mustache=require(_0x1aed('0x7'));var util=require(_0x1aed('0x8'));var path=require(_0x1aed('0x9'));var sox=require(_0x1aed('0xa'));var csv=require(_0x1aed('0xb'));var ejs=require(_0x1aed('0xc'));var fs=require('fs');var fs_extra=require(_0x1aed('0xd'));var _=require(_0x1aed('0xe'));var squel=require(_0x1aed('0xf'));var crypto=require('crypto');var jsforce=require(_0x1aed('0x10'));var deskjs=require(_0x1aed('0x11'));var toCsv=require(_0x1aed('0xb'));var querystring=require(_0x1aed('0x12'));var Papa=require(_0x1aed('0x13'));var Redis=require(_0x1aed('0x14'));var authService=require(_0x1aed('0x15'));var qs=require(_0x1aed('0x16'));var as=require(_0x1aed('0x17'));var hardwareService=require(_0x1aed('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0x1aed('0x19'));var config=require(_0x1aed('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x1aed('0x1b'))['db'];function respondWithStatusCode(_0x23a51d,_0x19fe1d){_0x19fe1d=_0x19fe1d||0xcc;return function(_0x56bd30){if(_0x56bd30){return _0x23a51d[_0x1aed('0x1c')](_0x19fe1d);}return _0x23a51d[_0x1aed('0x1d')](_0x19fe1d)['end']();};}function respondWithResult(_0xe9d743,_0x2adf5b){_0x2adf5b=_0x2adf5b||0xc8;return function(_0x1a4ae1){if(_0x1a4ae1){return _0xe9d743[_0x1aed('0x1d')](_0x2adf5b)['json'](_0x1a4ae1);}};}function respondWithFilteredResult(_0xffc4a6,_0x5e7923){return function(_0x57260a){if(_0x57260a){var _0x50dc4a=typeof _0x5e7923[_0x1aed('0x1e')]===_0x1aed('0x1f')&&typeof _0x5e7923[_0x1aed('0x20')]===_0x1aed('0x1f');var _0x5c1752=_0x57260a[_0x1aed('0x21')];var _0x2a1640=_0x50dc4a?0x0:_0x5e7923[_0x1aed('0x1e')];var _0x2969ae=_0x50dc4a?_0x57260a['count']:_0x5e7923[_0x1aed('0x1e')]+_0x5e7923[_0x1aed('0x20')];var _0x2588dd;if(_0x2969ae>=_0x5c1752){_0x2969ae=_0x5c1752;_0x2588dd=0xc8;}else{_0x2588dd=0xce;}_0xffc4a6[_0x1aed('0x1d')](_0x2588dd);return _0xffc4a6[_0x1aed('0x22')](_0x1aed('0x23'),_0x2a1640+'-'+_0x2969ae+'/'+_0x5c1752)[_0x1aed('0x24')](_0x57260a);}return null;};}function patchUpdates(_0x5a34e5){return function(_0x224200){try{jsonpatch[_0x1aed('0x25')](_0x224200,_0x5a34e5,!![]);}catch(_0x4e82f5){return BPromise[_0x1aed('0x26')](_0x4e82f5);}return _0x224200[_0x1aed('0x27')]();};}function saveUpdates(_0x3d1c2d,_0x7f5c6d){return function(_0x30e9b0){if(_0x30e9b0){return _0x30e9b0[_0x1aed('0x28')](_0x3d1c2d)['then'](function(_0x24d6df){return _0x24d6df;});}return null;};}function removeEntity(_0x5b16f7,_0x591161){return function(_0x3dd7a3){if(_0x3dd7a3){return _0x3dd7a3['destroy']()[_0x1aed('0x29')](function(){_0x5b16f7[_0x1aed('0x1d')](0xcc)[_0x1aed('0x2a')]();});}};}function handleEntityNotFound(_0x3e580a,_0xde5278){return function(_0xa42903){if(!_0xa42903){_0x3e580a[_0x1aed('0x1c')](0x194);}return _0xa42903;};}function handleError(_0x3edc99,_0x55d706){_0x55d706=_0x55d706||0x1f4;return function(_0xaa7527){logger[_0x1aed('0x2b')](_0xaa7527[_0x1aed('0x2c')]);if(_0xaa7527[_0x1aed('0x2d')]){delete _0xaa7527[_0x1aed('0x2d')];}_0x3edc99[_0x1aed('0x1d')](_0x55d706)[_0x1aed('0x2e')](_0xaa7527);};}exports['index']=function(_0x496f28,_0xe71b86){var _0x2c1f7b={},_0x3b0d0d={},_0x4dbd24={'count':0x0,'rows':[]};var _0x2200ab=_[_0x1aed('0x2f')](db[_0x1aed('0x30')][_0x1aed('0x31')],function(_0x30387e){return{'name':_0x30387e[_0x1aed('0x32')],'type':_0x30387e[_0x1aed('0x33')][_0x1aed('0x34')]};});_0x3b0d0d[_0x1aed('0x35')]=_[_0x1aed('0x2f')](_0x2200ab,'name');_0x3b0d0d['query']=_[_0x1aed('0x36')](_0x496f28[_0x1aed('0x37')]);_0x3b0d0d[_0x1aed('0x38')]=_['intersection'](_0x3b0d0d[_0x1aed('0x35')],_0x3b0d0d['query']);_0x2c1f7b[_0x1aed('0x39')]=_[_0x1aed('0x3a')](_0x3b0d0d['model'],qs[_0x1aed('0x3b')](_0x496f28[_0x1aed('0x37')][_0x1aed('0x3b')]));_0x2c1f7b[_0x1aed('0x39')]=_0x2c1f7b[_0x1aed('0x39')][_0x1aed('0x3c')]?_0x2c1f7b[_0x1aed('0x39')]:_0x3b0d0d[_0x1aed('0x35')];if(!_0x496f28[_0x1aed('0x37')]['hasOwnProperty']('nolimit')){_0x2c1f7b['limit']=qs['limit'](_0x496f28[_0x1aed('0x37')]['limit']);_0x2c1f7b[_0x1aed('0x1e')]=qs[_0x1aed('0x1e')](_0x496f28[_0x1aed('0x37')][_0x1aed('0x1e')]);}_0x2c1f7b[_0x1aed('0x3d')]=qs[_0x1aed('0x3e')](_0x496f28[_0x1aed('0x37')]['sort']);_0x2c1f7b[_0x1aed('0x3f')]=qs[_0x1aed('0x38')](_['pick'](_0x496f28['query'],_0x3b0d0d[_0x1aed('0x38')]),_0x2200ab);if(_0x496f28[_0x1aed('0x37')][_0x1aed('0x40')]){_0x2c1f7b[_0x1aed('0x3f')]=_[_0x1aed('0x41')](_0x2c1f7b[_0x1aed('0x3f')],{'$or':_[_0x1aed('0x2f')](_0x2200ab,function(_0x183bb9){if(_0x183bb9[_0x1aed('0x33')]!==_0x1aed('0x42')){var _0x496f4f={};_0x496f4f[_0x183bb9['name']]={'$like':'%'+_0x496f28['query'][_0x1aed('0x40')]+'%'};return _0x496f4f;}})});}_0x2c1f7b=_['merge']({},_0x2c1f7b,_0x496f28[_0x1aed('0x43')]);var _0x2cffbe={'where':_0x2c1f7b['where']};return db[_0x1aed('0x30')][_0x1aed('0x21')](_0x2cffbe)['then'](function(_0x552cfa){_0x4dbd24[_0x1aed('0x21')]=_0x552cfa;if(_0x496f28[_0x1aed('0x37')][_0x1aed('0x44')]){_0x2c1f7b[_0x1aed('0x45')]=[{'all':!![]}];}return db[_0x1aed('0x30')][_0x1aed('0x46')](_0x2c1f7b);})['then'](function(_0x31f870){_0x4dbd24[_0x1aed('0x47')]=_0x31f870;return _0x4dbd24;})[_0x1aed('0x29')](respondWithFilteredResult(_0xe71b86,_0x2c1f7b))[_0x1aed('0x48')](handleError(_0xe71b86,null));};exports['show']=function(_0x2fce01,_0x128513){var _0x293977={'raw':!![],'where':{'id':_0x2fce01[_0x1aed('0x49')]['id']}},_0x551808={};_0x551808['model']=_[_0x1aed('0x36')](db[_0x1aed('0x30')]['rawAttributes']);_0x551808['query']=_[_0x1aed('0x36')](_0x2fce01[_0x1aed('0x37')]);_0x551808[_0x1aed('0x38')]=_[_0x1aed('0x3a')](_0x551808[_0x1aed('0x35')],_0x551808[_0x1aed('0x37')]);_0x293977[_0x1aed('0x39')]=_[_0x1aed('0x3a')](_0x551808['model'],qs['fields'](_0x2fce01['query'][_0x1aed('0x3b')]));_0x293977[_0x1aed('0x39')]=_0x293977['attributes'][_0x1aed('0x3c')]?_0x293977['attributes']:_0x551808['model'];if(_0x2fce01['query'][_0x1aed('0x44')]){_0x293977[_0x1aed('0x45')]=[{'all':!![]}];}_0x293977=_[_0x1aed('0x41')]({},_0x293977,_0x2fce01['options']);return db[_0x1aed('0x30')][_0x1aed('0x4a')](_0x293977)[_0x1aed('0x29')](handleEntityNotFound(_0x128513,null))[_0x1aed('0x29')](respondWithResult(_0x128513,null))['catch'](handleError(_0x128513,null));};exports[_0x1aed('0x4b')]=function(_0x4adb8b,_0x1f9bed){return db[_0x1aed('0x30')][_0x1aed('0x4b')](_0x4adb8b[_0x1aed('0x4c')],{})[_0x1aed('0x29')](respondWithResult(_0x1f9bed,0xc9))['catch'](handleError(_0x1f9bed,null));};exports[_0x1aed('0x28')]=function(_0x103ee8,_0x498697){if(_0x103ee8[_0x1aed('0x4c')]['id']){delete _0x103ee8['body']['id'];}return db[_0x1aed('0x30')][_0x1aed('0x4a')]({'where':{'id':_0x103ee8[_0x1aed('0x49')]['id']}})['then'](handleEntityNotFound(_0x498697,null))['then'](saveUpdates(_0x103ee8['body'],null))[_0x1aed('0x29')](respondWithResult(_0x498697,null))[_0x1aed('0x48')](handleError(_0x498697,null));};exports['destroy']=function(_0x3138c7,_0x26337a){return db[_0x1aed('0x30')][_0x1aed('0x4a')]({'where':{'id':_0x3138c7[_0x1aed('0x49')]['id']}})[_0x1aed('0x29')](handleEntityNotFound(_0x26337a,null))[_0x1aed('0x29')](removeEntity(_0x26337a,null))[_0x1aed('0x48')](handleError(_0x26337a,null));};exports[_0x1aed('0x4d')]=function(_0xebede0,_0x2bf9f0){return db['JscriptySessionReport'][_0x1aed('0x4d')]()[_0x1aed('0x29')](respondWithResult(_0x2bf9f0,null))['catch'](handleError(_0x2bf9f0,null));};exports[_0x1aed('0x4e')]=function(_0x5d49d0,_0x3ec4c1,_0x24a25c){var _0x478693={'raw':!![],'where':{}};var _0x4ddb64={};var _0x582c8f={'count':0x0,'rows':[]};return db[_0x1aed('0x30')][_0x1aed('0x4f')]({'where':{'id':_0x5d49d0[_0x1aed('0x49')]['id']}})[_0x1aed('0x29')](handleEntityNotFound(_0x3ec4c1,null))[_0x1aed('0x29')](function(_0x220991){if(_0x220991){_0x4ddb64['model']=_['keys'](db[_0x1aed('0x50')]['rawAttributes']);_0x4ddb64['query']=_['keys'](_0x5d49d0[_0x1aed('0x37')]);_0x4ddb64[_0x1aed('0x38')]=_['intersection'](_0x4ddb64[_0x1aed('0x35')],_0x4ddb64['query']);_0x478693[_0x1aed('0x39')]=_['intersection'](_0x4ddb64[_0x1aed('0x35')],qs[_0x1aed('0x3b')](_0x5d49d0['query'][_0x1aed('0x3b')]));_0x478693[_0x1aed('0x39')]=_0x478693['attributes'][_0x1aed('0x3c')]?_0x478693[_0x1aed('0x39')]:_0x4ddb64[_0x1aed('0x35')];if(!_0x5d49d0[_0x1aed('0x37')][_0x1aed('0x51')](_0x1aed('0x52'))){_0x478693[_0x1aed('0x20')]=qs['limit'](_0x5d49d0[_0x1aed('0x37')][_0x1aed('0x20')]);_0x478693[_0x1aed('0x1e')]=qs[_0x1aed('0x1e')](_0x5d49d0[_0x1aed('0x37')][_0x1aed('0x1e')]);}_0x478693[_0x1aed('0x3d')]=qs['sort'](_0x5d49d0['query'][_0x1aed('0x3e')]);_0x478693['where']=qs[_0x1aed('0x38')](_[_0x1aed('0x53')](_0x5d49d0['query'],_0x4ddb64[_0x1aed('0x38')]));_0x478693[_0x1aed('0x3f')][_0x1aed('0x54')]=_0x220991['id'];if(_0x5d49d0[_0x1aed('0x37')][_0x1aed('0x40')]){_0x478693[_0x1aed('0x3f')]=_[_0x1aed('0x41')](_0x478693[_0x1aed('0x3f')],{'$or':_[_0x1aed('0x2f')](_0x478693[_0x1aed('0x39')],function(_0x48a1cb){var _0x3bee6a={};_0x3bee6a[_0x48a1cb]={'$like':'%'+_0x5d49d0[_0x1aed('0x37')]['filter']+'%'};return _0x3bee6a;})});}_0x478693=_[_0x1aed('0x41')]({},_0x478693,_0x5d49d0[_0x1aed('0x43')]);return db[_0x1aed('0x50')]['count']({'where':_0x478693[_0x1aed('0x3f')]})['then'](function(_0x14815f){_0x582c8f[_0x1aed('0x21')]=_0x14815f;if(_0x5d49d0[_0x1aed('0x37')]['includeAll']){_0x478693[_0x1aed('0x45')]=[{'all':!![]}];}return db[_0x1aed('0x50')][_0x1aed('0x46')](_0x478693);})[_0x1aed('0x29')](function(_0x2647c7){_0x582c8f[_0x1aed('0x47')]=_0x2647c7;return _0x582c8f;});}})[_0x1aed('0x29')](respondWithFilteredResult(_0x3ec4c1,_0x478693))[_0x1aed('0x48')](handleError(_0x3ec4c1,null));}; \ No newline at end of file +var _0x7a47=['map','JscriptySessionReport','rawAttributes','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','describe','length','nolimit','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','name','index'];(function(_0x534a9e,_0x215df0){var _0x28f158=function(_0x2fb1a4){while(--_0x2fb1a4){_0x534a9e['push'](_0x534a9e['shift']());}};_0x28f158(++_0x215df0);}(_0x7a47,0x69));var _0x77a4=function(_0x167f4f,_0x42c54f){_0x167f4f=_0x167f4f-0x0;var _0x336743=_0x7a47[_0x167f4f];return _0x336743;};'use strict';var emlformat=require(_0x77a4('0x0'));var rimraf=require(_0x77a4('0x1'));var zipdir=require(_0x77a4('0x2'));var jsonpatch=require(_0x77a4('0x3'));var rp=require(_0x77a4('0x4'));var moment=require(_0x77a4('0x5'));var BPromise=require(_0x77a4('0x6'));var Mustache=require('mustache');var util=require(_0x77a4('0x7'));var path=require(_0x77a4('0x8'));var sox=require(_0x77a4('0x9'));var csv=require(_0x77a4('0xa'));var ejs=require(_0x77a4('0xb'));var fs=require('fs');var fs_extra=require(_0x77a4('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x77a4('0xd'));var jsforce=require(_0x77a4('0xe'));var deskjs=require(_0x77a4('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x77a4('0x10'));var Redis=require(_0x77a4('0x11'));var authService=require(_0x77a4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x77a4('0x13'));var hardwareService=require(_0x77a4('0x14'));var logger=require('../../config/logger')(_0x77a4('0x15'));var utils=require('../../config/utils');var config=require(_0x77a4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x77a4('0x17'))['db'];function respondWithStatusCode(_0x435090,_0x175a93){_0x175a93=_0x175a93||0xcc;return function(_0xa85a00){if(_0xa85a00){return _0x435090[_0x77a4('0x18')](_0x175a93);}return _0x435090[_0x77a4('0x19')](_0x175a93)['end']();};}function respondWithResult(_0x26d1df,_0x583f98){_0x583f98=_0x583f98||0xc8;return function(_0x120706){if(_0x120706){return _0x26d1df[_0x77a4('0x19')](_0x583f98)[_0x77a4('0x1a')](_0x120706);}};}function respondWithFilteredResult(_0x59ddd6,_0xaffb0d){return function(_0xd6177b){if(_0xd6177b){var _0x4d10fd=typeof _0xaffb0d[_0x77a4('0x1b')]===_0x77a4('0x1c')&&typeof _0xaffb0d[_0x77a4('0x1d')]===_0x77a4('0x1c');var _0x1a7887=_0xd6177b[_0x77a4('0x1e')];var _0x3b7928=_0x4d10fd?0x0:_0xaffb0d[_0x77a4('0x1b')];var _0x393f99=_0x4d10fd?_0xd6177b['count']:_0xaffb0d[_0x77a4('0x1b')]+_0xaffb0d[_0x77a4('0x1d')];var _0x2319c9;if(_0x393f99>=_0x1a7887){_0x393f99=_0x1a7887;_0x2319c9=0xc8;}else{_0x2319c9=0xce;}_0x59ddd6['status'](_0x2319c9);return _0x59ddd6[_0x77a4('0x1f')](_0x77a4('0x20'),_0x3b7928+'-'+_0x393f99+'/'+_0x1a7887)[_0x77a4('0x1a')](_0xd6177b);}return null;};}function patchUpdates(_0x56d42d){return function(_0x3c15d3){try{jsonpatch[_0x77a4('0x21')](_0x3c15d3,_0x56d42d,!![]);}catch(_0x51c44b){return BPromise['reject'](_0x51c44b);}return _0x3c15d3[_0x77a4('0x22')]();};}function saveUpdates(_0xd3ac11,_0x3145cd){return function(_0x35994c){if(_0x35994c){return _0x35994c['update'](_0xd3ac11)[_0x77a4('0x23')](function(_0x1c60fe){return _0x1c60fe;});}return null;};}function removeEntity(_0x369559,_0x3c5056){return function(_0x477ba2){if(_0x477ba2){return _0x477ba2[_0x77a4('0x24')]()[_0x77a4('0x23')](function(){_0x369559[_0x77a4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1261f5,_0x33816f){return function(_0x42d464){if(!_0x42d464){_0x1261f5['sendStatus'](0x194);}return _0x42d464;};}function handleError(_0x59c85f,_0x5ba3bf){_0x5ba3bf=_0x5ba3bf||0x1f4;return function(_0x2878f7){logger['error'](_0x2878f7['stack']);if(_0x2878f7[_0x77a4('0x25')]){delete _0x2878f7['name'];}_0x59c85f[_0x77a4('0x19')](_0x5ba3bf)['send'](_0x2878f7);};}exports[_0x77a4('0x26')]=function(_0x2a97e0,_0x58bea0){var _0x4e3309={},_0x504d21={},_0x42b672={'count':0x0,'rows':[]};var _0x52eb5a=_[_0x77a4('0x27')](db[_0x77a4('0x28')][_0x77a4('0x29')],function(_0x18cbc8){return{'name':_0x18cbc8['fieldName'],'type':_0x18cbc8['type'][_0x77a4('0x2a')]};});_0x504d21[_0x77a4('0x2b')]=_[_0x77a4('0x27')](_0x52eb5a,_0x77a4('0x25'));_0x504d21[_0x77a4('0x2c')]=_[_0x77a4('0x2d')](_0x2a97e0[_0x77a4('0x2c')]);_0x504d21['filters']=_['intersection'](_0x504d21['model'],_0x504d21[_0x77a4('0x2c')]);_0x4e3309['attributes']=_[_0x77a4('0x2e')](_0x504d21[_0x77a4('0x2b')],qs[_0x77a4('0x2f')](_0x2a97e0['query']['fields']));_0x4e3309['attributes']=_0x4e3309[_0x77a4('0x30')]['length']?_0x4e3309['attributes']:_0x504d21[_0x77a4('0x2b')];if(!_0x2a97e0[_0x77a4('0x2c')][_0x77a4('0x31')]('nolimit')){_0x4e3309['limit']=qs[_0x77a4('0x1d')](_0x2a97e0['query'][_0x77a4('0x1d')]);_0x4e3309[_0x77a4('0x1b')]=qs[_0x77a4('0x1b')](_0x2a97e0[_0x77a4('0x2c')][_0x77a4('0x1b')]);}_0x4e3309[_0x77a4('0x32')]=qs[_0x77a4('0x33')](_0x2a97e0[_0x77a4('0x2c')][_0x77a4('0x33')]);_0x4e3309[_0x77a4('0x34')]=qs[_0x77a4('0x35')](_['pick'](_0x2a97e0['query'],_0x504d21[_0x77a4('0x35')]),_0x52eb5a);if(_0x2a97e0[_0x77a4('0x2c')][_0x77a4('0x36')]){_0x4e3309['where']=_[_0x77a4('0x37')](_0x4e3309[_0x77a4('0x34')],{'$or':_[_0x77a4('0x27')](_0x52eb5a,function(_0x515cc8){if(_0x515cc8['type']!=='VIRTUAL'){var _0x42877f={};_0x42877f[_0x515cc8[_0x77a4('0x25')]]={'$like':'%'+_0x2a97e0['query']['filter']+'%'};return _0x42877f;}})});}_0x4e3309=_['merge']({},_0x4e3309,_0x2a97e0[_0x77a4('0x38')]);var _0x1c92c8={'where':_0x4e3309[_0x77a4('0x34')]};return db[_0x77a4('0x28')][_0x77a4('0x1e')](_0x1c92c8)[_0x77a4('0x23')](function(_0x3fcae3){_0x42b672['count']=_0x3fcae3;if(_0x2a97e0[_0x77a4('0x2c')][_0x77a4('0x39')]){_0x4e3309[_0x77a4('0x3a')]=[{'all':!![]}];}return db[_0x77a4('0x28')][_0x77a4('0x3b')](_0x4e3309);})[_0x77a4('0x23')](function(_0x3a57ec){_0x42b672[_0x77a4('0x3c')]=_0x3a57ec;return _0x42b672;})[_0x77a4('0x23')](respondWithFilteredResult(_0x58bea0,_0x4e3309))['catch'](handleError(_0x58bea0,null));};exports[_0x77a4('0x3d')]=function(_0x275a6c,_0x2290ec){var _0x52f3e1={'raw':!![],'where':{'id':_0x275a6c[_0x77a4('0x3e')]['id']}},_0x57135e={};_0x57135e[_0x77a4('0x2b')]=_['keys'](db['JscriptySessionReport'][_0x77a4('0x29')]);_0x57135e[_0x77a4('0x2c')]=_[_0x77a4('0x2d')](_0x275a6c[_0x77a4('0x2c')]);_0x57135e['filters']=_[_0x77a4('0x2e')](_0x57135e[_0x77a4('0x2b')],_0x57135e[_0x77a4('0x2c')]);_0x52f3e1[_0x77a4('0x30')]=_[_0x77a4('0x2e')](_0x57135e['model'],qs[_0x77a4('0x2f')](_0x275a6c[_0x77a4('0x2c')][_0x77a4('0x2f')]));_0x52f3e1['attributes']=_0x52f3e1[_0x77a4('0x30')]['length']?_0x52f3e1[_0x77a4('0x30')]:_0x57135e[_0x77a4('0x2b')];if(_0x275a6c[_0x77a4('0x2c')][_0x77a4('0x39')]){_0x52f3e1[_0x77a4('0x3a')]=[{'all':!![]}];}_0x52f3e1=_['merge']({},_0x52f3e1,_0x275a6c[_0x77a4('0x38')]);return db[_0x77a4('0x28')][_0x77a4('0x3f')](_0x52f3e1)[_0x77a4('0x23')](handleEntityNotFound(_0x2290ec,null))[_0x77a4('0x23')](respondWithResult(_0x2290ec,null))[_0x77a4('0x40')](handleError(_0x2290ec,null));};exports[_0x77a4('0x41')]=function(_0xd76310,_0x46c723){return db['JscriptySessionReport'][_0x77a4('0x41')](_0xd76310[_0x77a4('0x42')],{})[_0x77a4('0x23')](respondWithResult(_0x46c723,0xc9))[_0x77a4('0x40')](handleError(_0x46c723,null));};exports[_0x77a4('0x43')]=function(_0x43af80,_0x3e0bbb){if(_0x43af80[_0x77a4('0x42')]['id']){delete _0x43af80[_0x77a4('0x42')]['id'];}return db[_0x77a4('0x28')]['find']({'where':{'id':_0x43af80['params']['id']}})[_0x77a4('0x23')](handleEntityNotFound(_0x3e0bbb,null))[_0x77a4('0x23')](saveUpdates(_0x43af80['body'],null))['then'](respondWithResult(_0x3e0bbb,null))[_0x77a4('0x40')](handleError(_0x3e0bbb,null));};exports[_0x77a4('0x24')]=function(_0x3dbc93,_0x4fda79){return db['JscriptySessionReport']['find']({'where':{'id':_0x3dbc93[_0x77a4('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4fda79,null))[_0x77a4('0x23')](removeEntity(_0x4fda79,null))[_0x77a4('0x40')](handleError(_0x4fda79,null));};exports[_0x77a4('0x44')]=function(_0xdb9eff,_0x12b899){return db[_0x77a4('0x28')][_0x77a4('0x44')]()['then'](respondWithResult(_0x12b899,null))[_0x77a4('0x40')](handleError(_0x12b899,null));};exports['getQuestions']=function(_0x4a9e33,_0x4bf828,_0x178f57){var _0x261412={'raw':!![],'where':{}};var _0x55226e={};var _0xeb0e17={'count':0x0,'rows':[]};return db[_0x77a4('0x28')]['findOne']({'where':{'id':_0x4a9e33[_0x77a4('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4bf828,null))[_0x77a4('0x23')](function(_0x2a93ce){if(_0x2a93ce){_0x55226e[_0x77a4('0x2b')]=_[_0x77a4('0x2d')](db['JscriptyQuestionReport'][_0x77a4('0x29')]);_0x55226e['query']=_[_0x77a4('0x2d')](_0x4a9e33[_0x77a4('0x2c')]);_0x55226e[_0x77a4('0x35')]=_[_0x77a4('0x2e')](_0x55226e[_0x77a4('0x2b')],_0x55226e[_0x77a4('0x2c')]);_0x261412[_0x77a4('0x30')]=_['intersection'](_0x55226e[_0x77a4('0x2b')],qs['fields'](_0x4a9e33[_0x77a4('0x2c')][_0x77a4('0x2f')]));_0x261412[_0x77a4('0x30')]=_0x261412[_0x77a4('0x30')][_0x77a4('0x45')]?_0x261412[_0x77a4('0x30')]:_0x55226e['model'];if(!_0x4a9e33[_0x77a4('0x2c')]['hasOwnProperty'](_0x77a4('0x46'))){_0x261412['limit']=qs[_0x77a4('0x1d')](_0x4a9e33[_0x77a4('0x2c')][_0x77a4('0x1d')]);_0x261412['offset']=qs['offset'](_0x4a9e33[_0x77a4('0x2c')][_0x77a4('0x1b')]);}_0x261412[_0x77a4('0x32')]=qs[_0x77a4('0x33')](_0x4a9e33[_0x77a4('0x2c')][_0x77a4('0x33')]);_0x261412[_0x77a4('0x34')]=qs[_0x77a4('0x35')](_['pick'](_0x4a9e33[_0x77a4('0x2c')],_0x55226e[_0x77a4('0x35')]));_0x261412[_0x77a4('0x34')]['SessionId']=_0x2a93ce['id'];if(_0x4a9e33[_0x77a4('0x2c')]['filter']){_0x261412[_0x77a4('0x34')]=_['merge'](_0x261412[_0x77a4('0x34')],{'$or':_[_0x77a4('0x27')](_0x261412['attributes'],function(_0x54e6bf){var _0x124af8={};_0x124af8[_0x54e6bf]={'$like':'%'+_0x4a9e33[_0x77a4('0x2c')][_0x77a4('0x36')]+'%'};return _0x124af8;})});}_0x261412=_['merge']({},_0x261412,_0x4a9e33['options']);return db[_0x77a4('0x47')]['count']({'where':_0x261412[_0x77a4('0x34')]})[_0x77a4('0x23')](function(_0x2b73fb){_0xeb0e17[_0x77a4('0x1e')]=_0x2b73fb;if(_0x4a9e33[_0x77a4('0x2c')][_0x77a4('0x39')]){_0x261412[_0x77a4('0x3a')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x77a4('0x3b')](_0x261412);})[_0x77a4('0x23')](function(_0x5657f6){_0xeb0e17[_0x77a4('0x3c')]=_0x5657f6;return _0xeb0e17;});}})[_0x77a4('0x23')](respondWithFilteredResult(_0x4bf828,_0x261412))['catch'](handleError(_0x4bf828,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index d163b28..433dd2a 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 _0x5d58=['request-promise','rimraf','../../config/environment','exports','define','report_jscripty_sessions','bluebird'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x5d58,0x187));var _0x85d5=function(_0x27d185,_0x18c08a){_0x27d185=_0x27d185-0x0;var _0x4f67be=_0x5d58[_0x27d185];return _0x4f67be;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x85d5('0x0'));var rp=require(_0x85d5('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var attributes=require('./jscriptySessionReport.attributes');module[_0x85d5('0x4')]=function(_0x2d457a,_0x578fad){return _0x2d457a[_0x85d5('0x5')]('JscriptySessionReport',attributes,{'tableName':_0x85d5('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3baf=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x3baf,0xf7));var _0xf3ba=function(_0x4e1777,_0x43da87){_0x4e1777=_0x4e1777-0x0;var _0x52f2bd=_0x3baf[_0x4e1777];return _0x52f2bd;};'use strict';var _=require(_0xf3ba('0x0'));var util=require(_0xf3ba('0x1'));var logger=require(_0xf3ba('0x2'))(_0xf3ba('0x3'));var moment=require(_0xf3ba('0x4'));var BPromise=require(_0xf3ba('0x5'));var rp=require(_0xf3ba('0x6'));var fs=require('fs');var path=require(_0xf3ba('0x7'));var rimraf=require(_0xf3ba('0x8'));var config=require(_0xf3ba('0x9'));var attributes=require(_0xf3ba('0xa'));module[_0xf3ba('0xb')]=function(_0x475268,_0x2e6df2){return _0x475268[_0xf3ba('0xc')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 584135f..e85f7fc 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 _0x1967=['then','info','JscriptySessionReport,\x20%s,\x20%s','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x1967,0x173));var _0x7196=function(_0x1a482e,_0x809778){_0x1a482e=_0x1a482e-0x0;var _0x12ec5c=_0x1967[_0x1a482e];return _0x12ec5c;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file +var _0x77d4=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x77d4,0x108));var _0x477d=function(_0x2e9b68,_0x516625){_0x2e9b68=_0x2e9b68-0x0;var _0x2129f9=_0x77d4[_0x2e9b68];return _0x2129f9;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var moment=require('moment');var BPromise=require(_0x477d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x477d('0x2'));var db=require(_0x477d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x477d('0x4'));var config=require(_0x477d('0x5'));var jayson=require(_0x477d('0x6'));var client=jayson[_0x477d('0x7')][_0x477d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45ca2d,_0x5153df,_0x4f4fb4){return new BPromise(function(_0x2dd5d2,_0x579859){return client['request'](_0x45ca2d,_0x4f4fb4)[_0x477d('0x9')](function(_0x29f11b){logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));logger['debug'](_0x477d('0xd'),_0x5153df,'request\x20sent',JSON[_0x477d('0xe')](_0x29f11b));if(_0x29f11b[_0x477d('0xf')]){if(_0x29f11b['error'][_0x477d('0x10')]===0x1f4){logger[_0x477d('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x5153df,_0x29f11b['error'][_0x477d('0x11')]);return _0x579859(_0x29f11b[_0x477d('0xf')]['message']);}logger[_0x477d('0xf')](_0x477d('0xb'),_0x5153df,_0x29f11b['error']['message']);return _0x2dd5d2(_0x29f11b[_0x477d('0xf')]['message']);}else{logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));_0x2dd5d2(_0x29f11b['result'][_0x477d('0x11')]);}})[_0x477d('0x12')](function(_0x29c6f8){logger[_0x477d('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x5153df,_0x29c6f8);_0x579859(_0x29c6f8);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 2f06579..d4e83d8 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 _0x3d47=['util','express','Router','fs-extra','../../components/interaction/service','./license.controller','get','index','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','multer'];(function(_0x2be9e6,_0x46d6ef){var _0x1dfbda=function(_0x58a672){while(--_0x58a672){_0x2be9e6['push'](_0x2be9e6['shift']());}};_0x1dfbda(++_0x46d6ef);}(_0x3d47,0x1df));var _0x73d4=function(_0x49035f,_0x5f3aa2){_0x49035f=_0x49035f-0x0;var _0x590e58=_0x3d47[_0x49035f];return _0x590e58;};'use strict';var multer=require(_0x73d4('0x0'));var util=require(_0x73d4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x73d4('0x2'));var router=express[_0x73d4('0x3')]();var fs_extra=require(_0x73d4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x73d4('0x5'));var config=require('../../config/environment');var controller=require(_0x73d4('0x6'));router[_0x73d4('0x7')]('/',controller[_0x73d4('0x8')]);router[_0x73d4('0x9')](_0x73d4('0xa'),auth[_0x73d4('0xb')](),controller[_0x73d4('0xc')]);router[_0x73d4('0x7')](_0x73d4('0xd'),auth[_0x73d4('0xb')](),controller[_0x73d4('0xe')]);module[_0x73d4('0xf')]=router; \ No newline at end of file +var _0x21b5=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','index','put','/:id','update','get','/download_log_file','isAuthenticated','exports','util','path','connect-timeout'];(function(_0x4d96d8,_0x31e935){var _0x43ed07=function(_0xb0524b){while(--_0xb0524b){_0x4d96d8['push'](_0x4d96d8['shift']());}};_0x43ed07(++_0x31e935);}(_0x21b5,0x1e3));var _0x521b=function(_0x37eee1,_0x542cdf){_0x37eee1=_0x37eee1-0x0;var _0x4bd209=_0x21b5[_0x37eee1];return _0x4bd209;};'use strict';var multer=require('multer');var util=require(_0x521b('0x0'));var path=require(_0x521b('0x1'));var timeout=require(_0x521b('0x2'));var express=require(_0x521b('0x3'));var router=express[_0x521b('0x4')]();var fs_extra=require(_0x521b('0x5'));var auth=require(_0x521b('0x6'));var interaction=require(_0x521b('0x7'));var config=require(_0x521b('0x8'));var controller=require(_0x521b('0x9'));router['get']('/',controller[_0x521b('0xa')]);router[_0x521b('0xb')](_0x521b('0xc'),auth['isAuthenticated'](),controller[_0x521b('0xd')]);router[_0x521b('0xe')](_0x521b('0xf'),auth[_0x521b('0x10')](),controller['downloadLogFile']);module[_0x521b('0x11')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 8f78418..bdf97fa 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 _0xbc22=['INTEGER','sequelize','exports','STRING'];(function(_0x564208,_0xc63d5a){var _0x4e379d=function(_0x313cc5){while(--_0x313cc5){_0x564208['push'](_0x564208['shift']());}};_0x4e379d(++_0xc63d5a);}(_0xbc22,0xe1));var _0x2bc2=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xbc22[_0x2b9b7f];return _0x4ed19a;};'use strict';var Sequelize=require(_0x2bc2('0x0'));module[_0x2bc2('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x2bc2('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x2bc2('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf960=['exports','TEXT','STRING'];(function(_0x17045c,_0x470ebe){var _0x844ac5=function(_0x1ce250){while(--_0x1ce250){_0x17045c['push'](_0x17045c['shift']());}};_0x844ac5(++_0x470ebe);}(_0xf960,0xed));var _0x0f96=function(_0x46efd7,_0x43f84d){_0x46efd7=_0x46efd7-0x0;var _0x5637e4=_0xf960[_0x46efd7];return _0x5637e4;};'use strict';var Sequelize=require('sequelize');module[_0x0f96('0x0')]={'license':{'type':Sequelize[_0x0f96('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x0f96('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 4c98a9e..6b3d84f 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 _0xf6f7=['Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','model','License','rawAttributes','keys','intersection','fields','query','attributes','merge','options','getLicense','catch','body','params','get','checkLicense','key','demo','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xf6f7,0x106));var _0x7f6f=function(_0x37d0bc,_0x109b96){_0x37d0bc=_0x37d0bc-0x0;var _0x170e60=_0xf6f7[_0x37d0bc];return _0x170e60;};'use strict';var emlformat=require(_0x7f6f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7f6f('0x1'));var jsonpatch=require(_0x7f6f('0x2'));var rp=require(_0x7f6f('0x3'));var moment=require(_0x7f6f('0x4'));var BPromise=require(_0x7f6f('0x5'));var Mustache=require(_0x7f6f('0x6'));var util=require(_0x7f6f('0x7'));var path=require(_0x7f6f('0x8'));var sox=require(_0x7f6f('0x9'));var csv=require(_0x7f6f('0xa'));var ejs=require(_0x7f6f('0xb'));var fs=require('fs');var fs_extra=require(_0x7f6f('0xc'));var _=require(_0x7f6f('0xd'));var squel=require(_0x7f6f('0xe'));var crypto=require(_0x7f6f('0xf'));var jsforce=require(_0x7f6f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x7f6f('0xa'));var querystring=require(_0x7f6f('0x11'));var Papa=require(_0x7f6f('0x12'));var Redis=require(_0x7f6f('0x13'));var authService=require(_0x7f6f('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f6f('0x15'));var logger=require(_0x7f6f('0x16'))(_0x7f6f('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7f6f('0x18'));var db=require(_0x7f6f('0x19'))['db'];function respondWithStatusCode(_0x27cbf4,_0xab379b){_0xab379b=_0xab379b||0xcc;return function(_0x1fb922){if(_0x1fb922){return _0x27cbf4[_0x7f6f('0x1a')](_0xab379b);}return _0x27cbf4[_0x7f6f('0x1b')](_0xab379b)[_0x7f6f('0x1c')]();};}function respondWithResult(_0x1d106a,_0x565a21){_0x565a21=_0x565a21||0xc8;return function(_0xb57141){if(_0xb57141){return _0x1d106a['status'](_0x565a21)[_0x7f6f('0x1d')](_0xb57141);}};}function respondWithFilteredResult(_0x3ed7e1,_0x1986bd){return function(_0x593bc3){if(_0x593bc3){var _0x477d3d=typeof _0x1986bd[_0x7f6f('0x1e')]===_0x7f6f('0x1f')&&typeof _0x1986bd['limit']==='undefined';var _0x119627=_0x593bc3[_0x7f6f('0x20')];var _0x5dbb68=_0x477d3d?0x0:_0x1986bd[_0x7f6f('0x1e')];var _0x339a08=_0x477d3d?_0x593bc3[_0x7f6f('0x20')]:_0x1986bd[_0x7f6f('0x1e')]+_0x1986bd[_0x7f6f('0x21')];var _0xd70b35;if(_0x339a08>=_0x119627){_0x339a08=_0x119627;_0xd70b35=0xc8;}else{_0xd70b35=0xce;}_0x3ed7e1[_0x7f6f('0x1b')](_0xd70b35);return _0x3ed7e1['set'](_0x7f6f('0x22'),_0x5dbb68+'-'+_0x339a08+'/'+_0x119627)[_0x7f6f('0x1d')](_0x593bc3);}return null;};}function patchUpdates(_0x4ad4fc){return function(_0x522cde){try{jsonpatch[_0x7f6f('0x23')](_0x522cde,_0x4ad4fc,!![]);}catch(_0x1cb7cd){return BPromise[_0x7f6f('0x24')](_0x1cb7cd);}return _0x522cde['save']();};}function saveUpdates(_0x5e175a,_0x4dcae0){return function(_0xcb9cd7){if(_0xcb9cd7){return _0xcb9cd7[_0x7f6f('0x25')](_0x5e175a)[_0x7f6f('0x26')](function(_0x49e2d5){return _0x49e2d5;});}return null;};}function removeEntity(_0xa4706d,_0x21586a){return function(_0xb028d8){if(_0xb028d8){return _0xb028d8[_0x7f6f('0x27')]()[_0x7f6f('0x26')](function(){_0xa4706d['status'](0xcc)[_0x7f6f('0x1c')]();});}};}function handleEntityNotFound(_0x2943df,_0x1c4e81){return function(_0x358465){if(!_0x358465){_0x2943df['sendStatus'](0x194);}return _0x358465;};}function handleError(_0x5463d3,_0x4dae91){_0x4dae91=_0x4dae91||0x1f4;return function(_0x51c4ea){logger[_0x7f6f('0x28')](_0x51c4ea[_0x7f6f('0x29')]);if(_0x51c4ea[_0x7f6f('0x2a')]){delete _0x51c4ea[_0x7f6f('0x2a')];}_0x5463d3[_0x7f6f('0x1b')](_0x4dae91)[_0x7f6f('0x2b')](_0x51c4ea);};}var utilLicense=require(_0x7f6f('0x18'));exports[_0x7f6f('0x2c')]=function(_0x2069b3,_0x59ca64){var _0x10ce6a={'raw':!![],'where':{'id':0x1}},_0x1b1732={};_0x1b1732[_0x7f6f('0x2d')]=_['keys'](db[_0x7f6f('0x2e')][_0x7f6f('0x2f')]);_0x1b1732['query']=_[_0x7f6f('0x30')](_0x2069b3['query']);_0x1b1732['filters']=_[_0x7f6f('0x31')](_0x1b1732[_0x7f6f('0x2d')],_0x1b1732['query']);_0x10ce6a['attributes']=_[_0x7f6f('0x31')](_0x1b1732[_0x7f6f('0x2d')],qs[_0x7f6f('0x32')](_0x2069b3[_0x7f6f('0x33')]['fields']));_0x10ce6a[_0x7f6f('0x34')]=_0x10ce6a[_0x7f6f('0x34')]['length']?_0x10ce6a[_0x7f6f('0x34')]:_0x1b1732[_0x7f6f('0x2d')];_0x10ce6a=_[_0x7f6f('0x35')]({},_0x10ce6a,_0x2069b3[_0x7f6f('0x36')]);return utilLicense[_0x7f6f('0x37')](_0x10ce6a)['then'](respondWithResult(_0x59ca64,null))[_0x7f6f('0x38')](handleError(_0x59ca64,null));};exports[_0x7f6f('0x25')]=function(_0x2a518d,_0x358dce){if(_0x2a518d[_0x7f6f('0x39')]['id']){delete _0x2a518d['body']['id'];}return db[_0x7f6f('0x2e')]['find']({'where':{'id':_0x2a518d[_0x7f6f('0x3a')]['id']}})[_0x7f6f('0x26')](handleEntityNotFound(_0x358dce,null))[_0x7f6f('0x26')](function(_0x1ee4ad){var _0x5dba1c=_0x1ee4ad[_0x7f6f('0x3b')]({'plain':!![]});return utilLicense[_0x7f6f('0x3c')](_0x5dba1c,_0x2a518d[_0x7f6f('0x39')][_0x7f6f('0x3d')]);})[_0x7f6f('0x26')](function(_0x8688fa){if(!_0x8688fa[_0x7f6f('0x3e')]){return saveUpdates(_0x2a518d[_0x7f6f('0x39')],null);}return _0x8688fa;})[_0x7f6f('0x26')](respondWithResult(_0x358dce,null))[_0x7f6f('0x38')](handleError(_0x358dce,null));};exports['downloadLogFile']=function(_0x2e8f2a,_0xabc33c){var _0x12b17a=_0x7f6f('0x3f');var _0x4d375a=path[_0x7f6f('0x40')](_0x7f6f('0x41'),_0x7f6f('0x42'),_0x7f6f('0x43'),_0x12b17a);_0xabc33c[_0x7f6f('0x44')](_0x7f6f('0x45'),_0x7f6f('0x46')+_0x12b17a);_0xabc33c['set'](_0x7f6f('0x47'),_0x7f6f('0x48'));_0xabc33c[_0x7f6f('0x49')](_0x4d375a);}; \ No newline at end of file +var _0x864c=['get','checkLicense','key','downloadLogFile','license-info.log','join','/var','log','xcally','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','offset','undefined','count','set','Content-Range','json','update','then','destroy','sendStatus','stack','name','send','index','model','keys','License','rawAttributes','query','filters','fields','attributes','length','merge','options','getLicense','body','find','params'];(function(_0x325274,_0x48a679){var _0x3831aa=function(_0x5daccd){while(--_0x5daccd){_0x325274['push'](_0x325274['shift']());}};_0x3831aa(++_0x48a679);}(_0x864c,0x1b8));var _0xc864=function(_0x18346f,_0x894371){_0x18346f=_0x18346f-0x0;var _0x43097f=_0x864c[_0x18346f];return _0x43097f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc864('0x0'));var zipdir=require(_0xc864('0x1'));var jsonpatch=require(_0xc864('0x2'));var rp=require(_0xc864('0x3'));var moment=require('moment');var BPromise=require(_0xc864('0x4'));var Mustache=require('mustache');var util=require(_0xc864('0x5'));var path=require('path');var sox=require(_0xc864('0x6'));var csv=require(_0xc864('0x7'));var ejs=require(_0xc864('0x8'));var fs=require('fs');var fs_extra=require(_0xc864('0x9'));var _=require(_0xc864('0xa'));var squel=require(_0xc864('0xb'));var crypto=require(_0xc864('0xc'));var jsforce=require(_0xc864('0xd'));var deskjs=require(_0xc864('0xe'));var toCsv=require(_0xc864('0x7'));var querystring=require(_0xc864('0xf'));var Papa=require(_0xc864('0x10'));var Redis=require(_0xc864('0x11'));var authService=require(_0xc864('0x12'));var qs=require(_0xc864('0x13'));var as=require(_0xc864('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc864('0x15'))(_0xc864('0x16'));var utils=require(_0xc864('0x17'));var config=require(_0xc864('0x18'));var licenseUtil=require(_0xc864('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x517535,_0x5a26c2){_0x5a26c2=_0x5a26c2||0xcc;return function(_0x3e76ca){if(_0x3e76ca){return _0x517535['sendStatus'](_0x5a26c2);}return _0x517535['status'](_0x5a26c2)[_0xc864('0x1a')]();};}function respondWithResult(_0x1e965e,_0x57907b){_0x57907b=_0x57907b||0xc8;return function(_0x142b7b){if(_0x142b7b){return _0x1e965e[_0xc864('0x1b')](_0x57907b)['json'](_0x142b7b);}};}function respondWithFilteredResult(_0x5e12dc,_0x38a70b){return function(_0x290013){if(_0x290013){var _0x5604e9=typeof _0x38a70b[_0xc864('0x1c')]===_0xc864('0x1d')&&typeof _0x38a70b['limit']==='undefined';var _0x4bf961=_0x290013[_0xc864('0x1e')];var _0x3b639c=_0x5604e9?0x0:_0x38a70b['offset'];var _0x48f90d=_0x5604e9?_0x290013[_0xc864('0x1e')]:_0x38a70b[_0xc864('0x1c')]+_0x38a70b['limit'];var _0x29a73e;if(_0x48f90d>=_0x4bf961){_0x48f90d=_0x4bf961;_0x29a73e=0xc8;}else{_0x29a73e=0xce;}_0x5e12dc[_0xc864('0x1b')](_0x29a73e);return _0x5e12dc[_0xc864('0x1f')](_0xc864('0x20'),_0x3b639c+'-'+_0x48f90d+'/'+_0x4bf961)[_0xc864('0x21')](_0x290013);}return null;};}function patchUpdates(_0x11ac29){return function(_0x3f6250){try{jsonpatch['apply'](_0x3f6250,_0x11ac29,!![]);}catch(_0x825fa8){return BPromise['reject'](_0x825fa8);}return _0x3f6250['save']();};}function saveUpdates(_0x229e40,_0xb4760f){return function(_0x5ca873){if(_0x5ca873){return _0x5ca873[_0xc864('0x22')](_0x229e40)[_0xc864('0x23')](function(_0x63c8a1){return _0x63c8a1;});}return null;};}function removeEntity(_0x1a08d0,_0x5685f7){return function(_0x5b4e86){if(_0x5b4e86){return _0x5b4e86[_0xc864('0x24')]()['then'](function(){_0x1a08d0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c2655,_0x442790){return function(_0xfc9d71){if(!_0xfc9d71){_0x2c2655[_0xc864('0x25')](0x194);}return _0xfc9d71;};}function handleError(_0x42bfeb,_0x3c0902){_0x3c0902=_0x3c0902||0x1f4;return function(_0x20f8fd){logger['error'](_0x20f8fd[_0xc864('0x26')]);if(_0x20f8fd['name']){delete _0x20f8fd[_0xc864('0x27')];}_0x42bfeb[_0xc864('0x1b')](_0x3c0902)[_0xc864('0x28')](_0x20f8fd);};}var utilLicense=require(_0xc864('0x19'));exports[_0xc864('0x29')]=function(_0x28b81b,_0x32dc13){var _0x595412={'raw':!![],'where':{'id':0x1}},_0x20940c={};_0x20940c[_0xc864('0x2a')]=_[_0xc864('0x2b')](db[_0xc864('0x2c')][_0xc864('0x2d')]);_0x20940c[_0xc864('0x2e')]=_[_0xc864('0x2b')](_0x28b81b[_0xc864('0x2e')]);_0x20940c[_0xc864('0x2f')]=_['intersection'](_0x20940c[_0xc864('0x2a')],_0x20940c[_0xc864('0x2e')]);_0x595412['attributes']=_['intersection'](_0x20940c[_0xc864('0x2a')],qs[_0xc864('0x30')](_0x28b81b[_0xc864('0x2e')]['fields']));_0x595412['attributes']=_0x595412[_0xc864('0x31')][_0xc864('0x32')]?_0x595412[_0xc864('0x31')]:_0x20940c[_0xc864('0x2a')];_0x595412=_[_0xc864('0x33')]({},_0x595412,_0x28b81b[_0xc864('0x34')]);return utilLicense[_0xc864('0x35')](_0x595412)[_0xc864('0x23')](respondWithResult(_0x32dc13,null))['catch'](handleError(_0x32dc13,null));};exports[_0xc864('0x22')]=function(_0x44ee65,_0x3ea270){if(_0x44ee65[_0xc864('0x36')]['id']){delete _0x44ee65[_0xc864('0x36')]['id'];}return db[_0xc864('0x2c')][_0xc864('0x37')]({'where':{'id':_0x44ee65[_0xc864('0x38')]['id']}})[_0xc864('0x23')](handleEntityNotFound(_0x3ea270,null))['then'](function(_0x1f4218){var _0x20bb8c=_0x1f4218[_0xc864('0x39')]({'plain':!![]});return utilLicense[_0xc864('0x3a')](_0x20bb8c,_0x44ee65[_0xc864('0x36')][_0xc864('0x3b')]);})[_0xc864('0x23')](function(_0x2b8daf){if(!_0x2b8daf['demo']){return saveUpdates(_0x44ee65[_0xc864('0x36')],null);}return _0x2b8daf;})[_0xc864('0x23')](respondWithResult(_0x3ea270,null))['catch'](handleError(_0x3ea270,null));};exports[_0xc864('0x3c')]=function(_0x430ffd,_0x2ef471){var _0x35c0fa=_0xc864('0x3d');var _0x1d7110=path[_0xc864('0x3e')](_0xc864('0x3f'),_0xc864('0x40'),_0xc864('0x41'),_0x35c0fa);_0x2ef471['setHeader'](_0xc864('0x42'),_0xc864('0x43')+_0x35c0fa);_0x2ef471['set'](_0xc864('0x44'),_0xc864('0x45'));_0x2ef471[_0xc864('0x46')](_0x1d7110);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index aa61af6..43c1734 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 _0x7d6a=['moment','bluebird','path','rimraf','../../config/environment','./license.attributes','exports','define','License','license','util','../../config/logger','api'];(function(_0x3336ed,_0x2e6799){var _0x559cf8=function(_0x5636a9){while(--_0x5636a9){_0x3336ed['push'](_0x3336ed['shift']());}};_0x559cf8(++_0x2e6799);}(_0x7d6a,0x1d1));var _0xa7d6=function(_0x22710d,_0x47a45d){_0x22710d=_0x22710d-0x0;var _0x36d53d=_0x7d6a[_0x22710d];return _0x36d53d;};'use strict';var _=require('lodash');var util=require(_0xa7d6('0x0'));var logger=require(_0xa7d6('0x1'))(_0xa7d6('0x2'));var moment=require(_0xa7d6('0x3'));var BPromise=require(_0xa7d6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa7d6('0x5'));var rimraf=require(_0xa7d6('0x6'));var config=require(_0xa7d6('0x7'));var attributes=require(_0xa7d6('0x8'));module[_0xa7d6('0x9')]=function(_0x3a8764,_0x1bc1db){return _0x3a8764[_0xa7d6('0xa')](_0xa7d6('0xb'),attributes,{'tableName':_0xa7d6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8850=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','License','license'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0x8850,0x8f));var _0x0885=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8850[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x0885('0x0'));var util=require('util');var logger=require(_0x0885('0x1'))(_0x0885('0x2'));var moment=require(_0x0885('0x3'));var BPromise=require(_0x0885('0x4'));var rp=require(_0x0885('0x5'));var fs=require('fs');var path=require(_0x0885('0x6'));var rimraf=require(_0x0885('0x7'));var config=require(_0x0885('0x8'));var attributes=require(_0x0885('0x9'));module[_0x0885('0xa')]=function(_0x1aa41d,_0x4e6e5e){return _0x1aa41d['define'](_0x0885('0xb'),attributes,{'tableName':_0x0885('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 37d9799..b7c8406 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 _0xd86b=['request','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xd86b,0x90));var _0xbd86=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0xd86b[_0x466bc5];return _0x138952;};'use strict';var _=require(_0xbd86('0x0'));var util=require('util');var moment=require(_0xbd86('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd86('0x2'));var db=require(_0xbd86('0x3'))['db'];var utils=require(_0xbd86('0x4'));var logger=require(_0xbd86('0x5'))(_0xbd86('0x6'));var config=require(_0xbd86('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbd86('0x8')][_0xbd86('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd45682,_0x1e5d30,_0x55dbc7){return new BPromise(function(_0x4d5fea,_0x50ca2c){return client[_0xbd86('0xa')](_0xd45682,_0x55dbc7)[_0xbd86('0xb')](function(_0x4a3f1a){logger[_0xbd86('0xc')]('License,\x20%s,\x20%s',_0x1e5d30,_0xbd86('0xd'));logger[_0xbd86('0xe')](_0xbd86('0xf'),_0x1e5d30,_0xbd86('0xd'),JSON['stringify'](_0x4a3f1a));if(_0x4a3f1a[_0xbd86('0x10')]){if(_0x4a3f1a['error'][_0xbd86('0x11')]===0x1f4){logger['error'](_0xbd86('0x12'),_0x1e5d30,_0x4a3f1a[_0xbd86('0x10')][_0xbd86('0x13')]);return _0x50ca2c(_0x4a3f1a[_0xbd86('0x10')][_0xbd86('0x13')]);}logger[_0xbd86('0x10')]('License,\x20%s,\x20%s',_0x1e5d30,_0x4a3f1a[_0xbd86('0x10')]['message']);return _0x4d5fea(_0x4a3f1a[_0xbd86('0x10')][_0xbd86('0x13')]);}else{logger['info'](_0xbd86('0x12'),_0x1e5d30,_0xbd86('0xd'));_0x4d5fea(_0x4a3f1a[_0xbd86('0x14')][_0xbd86('0x13')]);}})[_0xbd86('0x15')](function(_0x3c7a2f){logger[_0xbd86('0x10')]('License,\x20%s,\x20%s',_0x1e5d30,_0x3c7a2f);_0x50ca2c(_0x3c7a2f);});});} \ No newline at end of file +var _0x8f64=['request','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x51d4c2,_0x2f589b){var _0x31189c=function(_0xb840ac){while(--_0xb840ac){_0x51d4c2['push'](_0x51d4c2['shift']());}};_0x31189c(++_0x2f589b);}(_0x8f64,0xdb));var _0x48f6=function(_0x4e30dc,_0x2c4617){_0x4e30dc=_0x4e30dc-0x0;var _0x4ff101=_0x8f64[_0x4e30dc];return _0x4ff101;};'use strict';var _=require(_0x48f6('0x0'));var util=require(_0x48f6('0x1'));var moment=require(_0x48f6('0x2'));var BPromise=require(_0x48f6('0x3'));var rs=require(_0x48f6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48f6('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x48f6('0x6'));var config=require(_0x48f6('0x7'));var jayson=require(_0x48f6('0x8'));var client=jayson[_0x48f6('0x9')][_0x48f6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4aa192,_0x287835,_0x285b70){return new BPromise(function(_0x1ab08f,_0x22682e){return client[_0x48f6('0xb')](_0x4aa192,_0x285b70)[_0x48f6('0xc')](function(_0x54ac5b){logger[_0x48f6('0xd')]('License,\x20%s,\x20%s',_0x287835,_0x48f6('0xe'));logger[_0x48f6('0xf')](_0x48f6('0x10'),_0x287835,_0x48f6('0xe'),JSON[_0x48f6('0x11')](_0x54ac5b));if(_0x54ac5b['error']){if(_0x54ac5b[_0x48f6('0x12')][_0x48f6('0x13')]===0x1f4){logger[_0x48f6('0x12')](_0x48f6('0x14'),_0x287835,_0x54ac5b[_0x48f6('0x12')][_0x48f6('0x15')]);return _0x22682e(_0x54ac5b[_0x48f6('0x12')][_0x48f6('0x15')]);}logger['error'](_0x48f6('0x14'),_0x287835,_0x54ac5b[_0x48f6('0x12')]['message']);return _0x1ab08f(_0x54ac5b[_0x48f6('0x12')]['message']);}else{logger[_0x48f6('0xd')](_0x48f6('0x14'),_0x287835,_0x48f6('0xe'));_0x1ab08f(_0x54ac5b[_0x48f6('0x16')][_0x48f6('0x15')]);}})['catch'](function(_0x4f9d54){logger['error'](_0x48f6('0x14'),_0x287835,_0x4f9d54);_0x22682e(_0x4f9d54);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index a60b680..b161a64 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 _0xb2b3=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','addAnswer','create','/:id/out_servers','addSmtp','addInteraction','send','/:id/users','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x43e43e,_0x34af4b){var _0x19c995=function(_0x2d8366){while(--_0x2d8366){_0x43e43e['push'](_0x43e43e['shift']());}};_0x19c995(++_0x34af4b);}(_0xb2b3,0x8e));var _0x3b2b=function(_0x33e44a,_0x197c2a){_0x33e44a=_0x33e44a-0x0;var _0xe8fada=_0xb2b3[_0x33e44a];return _0xe8fada;};'use strict';var multer=require(_0x3b2b('0x0'));var util=require(_0x3b2b('0x1'));var path=require(_0x3b2b('0x2'));var timeout=require(_0x3b2b('0x3'));var express=require(_0x3b2b('0x4'));var router=express[_0x3b2b('0x5')]();var fs_extra=require(_0x3b2b('0x6'));var auth=require(_0x3b2b('0x7'));var interaction=require(_0x3b2b('0x8'));var config=require(_0x3b2b('0x9'));var controller=require('./mailAccount.controller');router[_0x3b2b('0xa')]('/',auth[_0x3b2b('0xb')](),controller[_0x3b2b('0xc')]);router[_0x3b2b('0xa')](_0x3b2b('0xd'),auth['isAuthenticated'](),controller[_0x3b2b('0xe')]);router[_0x3b2b('0xa')](_0x3b2b('0xf'),auth[_0x3b2b('0xb')](),controller[_0x3b2b('0x10')]);router[_0x3b2b('0xa')](_0x3b2b('0x11'),auth[_0x3b2b('0xb')](),controller[_0x3b2b('0x12')]);router[_0x3b2b('0xa')](_0x3b2b('0x13'),auth['isAuthenticated'](),controller[_0x3b2b('0x14')]);router['get'](_0x3b2b('0x15'),auth[_0x3b2b('0xb')](),controller['getImap']);router[_0x3b2b('0xa')]('/:id/out_servers',auth[_0x3b2b('0xb')](),controller[_0x3b2b('0x16')]);router[_0x3b2b('0xa')](_0x3b2b('0x17'),auth['isAuthenticated'](),controller[_0x3b2b('0x18')]);router[_0x3b2b('0xa')](_0x3b2b('0x19'),auth[_0x3b2b('0xb')](),controller[_0x3b2b('0x1a')]);router[_0x3b2b('0xa')](_0x3b2b('0x1b'),auth[_0x3b2b('0xb')](),controller[_0x3b2b('0x1c')]);router[_0x3b2b('0xa')](_0x3b2b('0x1d'),auth['isAuthenticated'](),controller[_0x3b2b('0x1e')]);router[_0x3b2b('0xa')]('/:id/users',auth[_0x3b2b('0xb')](),controller[_0x3b2b('0x1f')]);router[_0x3b2b('0x20')](_0x3b2b('0x11'),auth[_0x3b2b('0xb')](),controller[_0x3b2b('0x21')]);router[_0x3b2b('0x20')](_0x3b2b('0x13'),auth[_0x3b2b('0xb')](),controller[_0x3b2b('0x22')]);router[_0x3b2b('0x20')]('/',auth[_0x3b2b('0xb')](),controller[_0x3b2b('0x23')]);router[_0x3b2b('0x20')](_0x3b2b('0x15'),auth[_0x3b2b('0xb')](),controller['addImap']);router[_0x3b2b('0x20')](_0x3b2b('0x24'),auth[_0x3b2b('0xb')](),controller[_0x3b2b('0x25')]);router[_0x3b2b('0x20')](_0x3b2b('0x17'),auth['isAuthenticated'](),controller[_0x3b2b('0x26')]);router[_0x3b2b('0x20')](_0x3b2b('0x19'),auth[_0x3b2b('0xb')](),controller['addApplications']);router['post']('/:id/send',auth[_0x3b2b('0xb')](),controller[_0x3b2b('0x27')]);router[_0x3b2b('0x20')](_0x3b2b('0x28'),auth[_0x3b2b('0xb')](),controller[_0x3b2b('0x29')]);router[_0x3b2b('0x2a')](_0x3b2b('0xf'),auth[_0x3b2b('0xb')](),controller[_0x3b2b('0x2b')]);router[_0x3b2b('0x2c')](_0x3b2b('0x11'),auth[_0x3b2b('0xb')](),controller[_0x3b2b('0x2d')]);router[_0x3b2b('0x2c')](_0x3b2b('0x13'),auth[_0x3b2b('0xb')](),controller[_0x3b2b('0x2e')]);router[_0x3b2b('0x2c')]('/:id/in_servers',auth[_0x3b2b('0xb')](),controller[_0x3b2b('0x2f')]);router['delete'](_0x3b2b('0x24'),auth[_0x3b2b('0xb')](),controller[_0x3b2b('0x30')]);router['delete']('/:id',auth[_0x3b2b('0xb')](),controller['destroy']);router['delete']('/:id/users',auth[_0x3b2b('0xb')](),controller[_0x3b2b('0x31')]);module['exports']=router; \ No newline at end of file +var _0xe5f7=['/:id/send','send','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','post','addDisposition','addSmtp','/:id/interactions','addInteraction','addApplications'];(function(_0x58a07b,_0x45274f){var _0x5926e0=function(_0x2e4fc4){while(--_0x2e4fc4){_0x58a07b['push'](_0x58a07b['shift']());}};_0x5926e0(++_0x45274f);}(_0xe5f7,0xb7));var _0x7e5f=function(_0x39b984,_0x1ce802){_0x39b984=_0x39b984-0x0;var _0x389bd6=_0xe5f7[_0x39b984];return _0x389bd6;};'use strict';var multer=require(_0x7e5f('0x0'));var util=require(_0x7e5f('0x1'));var path=require(_0x7e5f('0x2'));var timeout=require(_0x7e5f('0x3'));var express=require('express');var router=express[_0x7e5f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7e5f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7e5f('0x6'));var controller=require(_0x7e5f('0x7'));router[_0x7e5f('0x8')]('/',auth[_0x7e5f('0x9')](),controller['index']);router[_0x7e5f('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7e5f('0xa')]);router['get'](_0x7e5f('0xb'),auth[_0x7e5f('0x9')](),controller['show']);router['get'](_0x7e5f('0xc'),auth[_0x7e5f('0x9')](),controller[_0x7e5f('0xd')]);router[_0x7e5f('0x8')](_0x7e5f('0xe'),auth['isAuthenticated'](),controller[_0x7e5f('0xf')]);router[_0x7e5f('0x8')](_0x7e5f('0x10'),auth[_0x7e5f('0x9')](),controller[_0x7e5f('0x11')]);router['get'](_0x7e5f('0x12'),auth[_0x7e5f('0x9')](),controller[_0x7e5f('0x13')]);router[_0x7e5f('0x8')]('/:id/interactions',auth[_0x7e5f('0x9')](),controller['getInteractions']);router[_0x7e5f('0x8')](_0x7e5f('0x14'),auth[_0x7e5f('0x9')](),controller[_0x7e5f('0x15')]);router[_0x7e5f('0x8')]('/:id/messages',auth[_0x7e5f('0x9')](),controller[_0x7e5f('0x16')]);router['get'](_0x7e5f('0x17'),auth['isAuthenticated'](),controller[_0x7e5f('0x18')]);router[_0x7e5f('0x8')](_0x7e5f('0x19'),auth[_0x7e5f('0x9')](),controller['getAgents']);router[_0x7e5f('0x1a')](_0x7e5f('0xc'),auth['isAuthenticated'](),controller[_0x7e5f('0x1b')]);router[_0x7e5f('0x1a')]('/:id/canned_answers',auth[_0x7e5f('0x9')](),controller['addAnswer']);router[_0x7e5f('0x1a')]('/',auth[_0x7e5f('0x9')](),controller['create']);router[_0x7e5f('0x1a')](_0x7e5f('0x10'),auth['isAuthenticated'](),controller['addImap']);router[_0x7e5f('0x1a')](_0x7e5f('0x12'),auth['isAuthenticated'](),controller[_0x7e5f('0x1c')]);router['post'](_0x7e5f('0x1d'),auth[_0x7e5f('0x9')](),controller[_0x7e5f('0x1e')]);router[_0x7e5f('0x1a')](_0x7e5f('0x14'),auth[_0x7e5f('0x9')](),controller[_0x7e5f('0x1f')]);router[_0x7e5f('0x1a')](_0x7e5f('0x20'),auth[_0x7e5f('0x9')](),controller[_0x7e5f('0x21')]);router[_0x7e5f('0x1a')](_0x7e5f('0x19'),auth[_0x7e5f('0x9')](),controller['addAgents']);router[_0x7e5f('0x22')]('/:id',auth[_0x7e5f('0x9')](),controller[_0x7e5f('0x23')]);router[_0x7e5f('0x24')](_0x7e5f('0xc'),auth[_0x7e5f('0x9')](),controller[_0x7e5f('0x25')]);router[_0x7e5f('0x24')]('/:id/canned_answers',auth[_0x7e5f('0x9')](),controller[_0x7e5f('0x26')]);router[_0x7e5f('0x24')](_0x7e5f('0x10'),auth['isAuthenticated'](),controller[_0x7e5f('0x27')]);router[_0x7e5f('0x24')](_0x7e5f('0x12'),auth[_0x7e5f('0x9')](),controller[_0x7e5f('0x28')]);router[_0x7e5f('0x24')]('/:id',auth[_0x7e5f('0x9')](),controller[_0x7e5f('0x29')]);router[_0x7e5f('0x24')]('/:id/users',auth['isAuthenticated'](),controller[_0x7e5f('0x2a')]);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 cac8755..616b9c3 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 _0x2d5e=['sequelize','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','TEXT','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','mandatoryDispositionPauseId','mandatoryDisposition','gmail','hotmail','yahoo','getDataValue','provider','custom','setDataValue'];(function(_0x970959,_0x41dc3b){var _0x4b9448=function(_0xdcdfef){while(--_0xdcdfef){_0x970959['push'](_0x970959['shift']());}};_0x4b9448(++_0x41dc3b);}(_0x2d5e,0x1d4));var _0xe2d5=function(_0x4a749b,_0x4fe998){_0x4a749b=_0x4a749b-0x0;var _0xafdd0c=_0x2d5e[_0x4a749b];return _0xafdd0c;};'use strict';var Sequelize=require(_0xe2d5('0x0'));module['exports']={'description':{'type':Sequelize[_0xe2d5('0x1')]},'name':{'type':Sequelize[_0xe2d5('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xe2d5('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xe2d5('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xe2d5('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xe2d5('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xe2d5('0x1')],'allowNull':![],'defaultValue':_0xe2d5('0x3')},'fontSize':{'type':Sequelize[_0xe2d5('0x4')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xe2d5('0x5')],'defaultValue':function(){return _0xe2d5('0x6');}},'notificationSound':{'type':Sequelize[_0xe2d5('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe2d5('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe2d5('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe2d5('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe2d5('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe2d5('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xe2d5('0x7')},'mandatoryDisposition':{'type':Sequelize[_0xe2d5('0x2')],'defaultValue':![],'comment':_0xe2d5('0x8'),'set':function(_0x4c696e){if(!_0x4c696e)this['setDataValue'](_0xe2d5('0x9'),null);this['setDataValue'](_0xe2d5('0xa'),_0x4c696e);}},'provider':{'type':Sequelize['ENUM'](_0xe2d5('0xb'),_0xe2d5('0xc'),_0xe2d5('0xd'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0xe2d5('0xe')](_0xe2d5('0xf')))return _0xe2d5('0x10');return this[_0xe2d5('0xe')](_0xe2d5('0xf'));},'set':function(_0x1844cd){if(_0x1844cd===_0xe2d5('0x10'))_0x1844cd=null;return this[_0xe2d5('0x11')]('provider',_0x1844cd);}}}; \ No newline at end of file +var _0x902e=['mandatoryDispositionPauseId','setDataValue','ENUM','gmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','STRING','TEXT','BOOLEAN','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x2170b3,_0x380989){var _0x2a1541=function(_0x423f27){while(--_0x423f27){_0x2170b3['push'](_0x2170b3['shift']());}};_0x2a1541(++_0x380989);}(_0x902e,0x185));var _0xe902=function(_0x134302,_0xffe023){_0x134302=_0x134302-0x0;var _0x5a8ec9=_0x902e[_0x134302];return _0x5a8ec9;};'use strict';var Sequelize=require(_0xe902('0x0'));module['exports']={'description':{'type':Sequelize[_0xe902('0x1')]},'name':{'type':Sequelize[_0xe902('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xe902('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0xe902('0x2')]},'markAsUnread':{'type':Sequelize[_0xe902('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xe902('0x1')],'allowNull':![],'defaultValue':_0xe902('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xe902('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xe902('0x2')],'defaultValue':function(){return _0xe902('0x6');}},'notificationSound':{'type':Sequelize[_0xe902('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe902('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe902('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe902('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe902('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe902('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe902('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xe902('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xe902('0x3')],'defaultValue':![],'comment':_0xe902('0x9'),'set':function(_0x5f1890){if(!_0x5f1890)this['setDataValue'](_0xe902('0xa'),null);this[_0xe902('0xb')]('mandatoryDisposition',_0x5f1890);}},'provider':{'type':Sequelize[_0xe902('0xc')](_0xe902('0xd'),'hotmail',_0xe902('0xe'),_0xe902('0xf')),'defaultValue':null,'get':function(){if(!this[_0xe902('0x10')](_0xe902('0x11')))return _0xe902('0x12');return this[_0xe902('0x10')]('provider');},'set':function(_0x2cc01d){if(_0x2cc01d==='custom')_0x2cc01d=null;return this[_0xe902('0xb')](_0xe902('0x11'),_0x2cc01d);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index a1785a4..ac660b2 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 _0x4026=['getAgents','moment','bluebird','util','path','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','message','MailAccount,\x20%s,\x20%s','sendStatus','json','offset','undefined','count','limit','status','set','update','destroy','get','MailAccounts','end','name','send','gmail','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','sort','where','pick','filter','VIRTUAL','MailAccount','includeAll','findAll','rows','catch','show','params','keys','options','find','body','provider','custom','secure','Pause','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','nolimit','order','merge','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','User','Owner','internal','Tag','Tags','tag','addApplications','transaction','sequelize','ISOLATION_LEVELS','MailApplication','findAndCountAll','stack','getApplications','hasOwnProperty','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','split','CmList','List','Contacts','updatedAt','DESC','CloudProvider','from','%s\x20<%s>','attachments','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','out','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','removeAgents','isArray','emit','userMailAccount:remove'];(function(_0x373198,_0x20c3ab){var _0x36c501=function(_0x69eb61){while(--_0x69eb61){_0x373198['push'](_0x373198['shift']());}};_0x36c501(++_0x20c3ab);}(_0x4026,0x181));var _0x6402=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4026[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0x6402('0x0'));var BPromise=require(_0x6402('0x1'));var util=require(_0x6402('0x2'));var path=require(_0x6402('0x3'));var _=require(_0x6402('0x4'));var juice=require('juice');var Redis=require(_0x6402('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x6402('0x6'))('api');var config=require(_0x6402('0x7'));var db=require(_0x6402('0x8'))['db'];config[_0x6402('0x9')]=_[_0x6402('0xa')](config['redis'],{'host':_0x6402('0xb'),'port':0x18eb});var socket=require(_0x6402('0xc'))(new Redis(config['redis']));require('./mailAccount.socket')[_0x6402('0xd')](socket);var jayson=require(_0x6402('0xe'));var client=jayson[_0x6402('0xf')][_0x6402('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x27df3e,_0x77f277,_0x4be883,_0x1225bd){return new BPromise(function(_0x2c1f9d,_0x6793e5){var _0x53b924=_0x1225bd||client;return _0x53b924['request'](_0x27df3e,_0x4be883)[_0x6402('0x11')](function(_0x36a54){logger[_0x6402('0x12')]('MailAccount,\x20%s,\x20%s',_0x77f277,_0x6402('0x13'));logger[_0x6402('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x77f277,_0x6402('0x13'),JSON[_0x6402('0x15')](_0x36a54));if(_0x36a54[_0x6402('0x16')]){if(_0x36a54[_0x6402('0x16')][_0x6402('0x17')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x77f277,_0x36a54['error'][_0x6402('0x18')]);return _0x6793e5(_0x36a54[_0x6402('0x16')][_0x6402('0x18')]);}logger[_0x6402('0x16')](_0x6402('0x19'),_0x77f277,_0x36a54[_0x6402('0x16')]['message']);return _0x2c1f9d(_0x36a54[_0x6402('0x16')][_0x6402('0x18')]);}else{logger[_0x6402('0x12')]('MailAccount,\x20%s,\x20%s',_0x77f277,_0x6402('0x13'));_0x2c1f9d(_0x36a54['result'][_0x6402('0x18')]);}})['catch'](function(_0x524302){logger[_0x6402('0x16')](_0x6402('0x19'),_0x77f277,_0x524302);_0x6793e5(_0x524302);});});}function respondWithStatusCode(_0x500541,_0x2bae81){_0x2bae81=_0x2bae81||0xcc;return function(_0x2f2a44){if(_0x2f2a44){return _0x500541[_0x6402('0x1a')](_0x2bae81);}return _0x500541['status'](_0x2bae81)['end']();};}function respondWithResult(_0x454f56,_0x361113){_0x361113=_0x361113||0xc8;return function(_0x55407e){if(_0x55407e){return _0x454f56['status'](_0x361113)[_0x6402('0x1b')](_0x55407e);}};}function respondWithFilteredResult(_0xdf4df9,_0x22e347){return function(_0x35d143){if(_0x35d143){var _0x378d5b=typeof _0x22e347[_0x6402('0x1c')]===_0x6402('0x1d')&&typeof _0x22e347['limit']==='undefined';var _0x1051ff=_0x35d143['count'];var _0x1b0e78=_0x378d5b?0x0:_0x22e347['offset'];var _0x4369fa=_0x378d5b?_0x35d143[_0x6402('0x1e')]:_0x22e347[_0x6402('0x1c')]+_0x22e347[_0x6402('0x1f')];var _0x358d85;if(_0x4369fa>=_0x1051ff){_0x4369fa=_0x1051ff;_0x358d85=0xc8;}else{_0x358d85=0xce;}_0xdf4df9[_0x6402('0x20')](_0x358d85);return _0xdf4df9[_0x6402('0x21')]('Content-Range',_0x1b0e78+'-'+_0x4369fa+'/'+_0x1051ff)[_0x6402('0x1b')](_0x35d143);}return null;};}function saveUpdates(_0x35ca27){return function(_0x5c0317){if(_0x5c0317){return _0x5c0317[_0x6402('0x22')](_0x35ca27)[_0x6402('0x11')](function(_0x1d0d66){return _0x1d0d66;});}return null;};}function removeEntity(_0x4595af){return function(_0x588d93){if(_0x588d93){return _0x588d93[_0x6402('0x23')]()['then'](function(){var _0x4fda41=_0x588d93[_0x6402('0x24')]({'plain':!![]});var _0x3d219c=_0x6402('0x25');return db['UserProfileResource'][_0x6402('0x23')]({'where':{'type':_0x3d219c,'resourceId':_0x4fda41['id']}})['then'](function(){return _0x588d93;});})[_0x6402('0x11')](function(){_0x4595af[_0x6402('0x20')](0xcc)[_0x6402('0x26')]();});}};}function handleEntityNotFound(_0x445d7b){return function(_0x1274b7){if(!_0x1274b7){_0x445d7b['sendStatus'](0x194);}return _0x1274b7;};}function handleError(_0x4cc00b,_0x36b526){_0x36b526=_0x36b526||0x1f4;return function(_0x630fdb){logger[_0x6402('0x16')](_0x630fdb['stack']);if(_0x630fdb[_0x6402('0x27')]){delete _0x630fdb[_0x6402('0x27')];}_0x4cc00b[_0x6402('0x20')](_0x36b526)[_0x6402('0x28')](_0x630fdb);};}function getImapHost(_0x4f187a){switch(_0x4f187a){case _0x6402('0x29'):return'imap.gmail.com';case _0x6402('0x2a'):return _0x6402('0x2b');case _0x6402('0x2c'):return'imap-mail.outlook.com';case _0x6402('0x2d'):return _0x6402('0x2e');}throw new Error(_0x6402('0x2f'),_0x4f187a);}function getSmtpHost(_0x5210f7){switch(_0x5210f7){case _0x6402('0x29'):return _0x6402('0x30');case _0x6402('0x2a'):return'smtp.mail.yahoo.com';case'hotmail':return'smtp-mail.outlook.com';case _0x6402('0x2d'):return _0x6402('0x31');}throw new Error('Unknown\x20email\x20service\x20provider',_0x5210f7);}function getAuthenticationOptions(_0x523c96,_0x4dec86){var _0xb54d15={};var _0x38b307={};if(_0x523c96){_0xb54d15['user']=_0x38b307[_0x6402('0x32')]=_0x4dec86[_0x6402('0x33')];_0xb54d15[_0x6402('0x34')]=_0x38b307[_0x6402('0x35')]=_0x4dec86['password'];if(_0x4dec86[_0x6402('0x36')]){_0xb54d15['modernAuthentication']=_0x38b307['modernAuthentication']=!![];_0xb54d15['CloudProviderId']=_0x38b307[_0x6402('0x37')]=_0x4dec86[_0x6402('0x37')];_0xb54d15[_0x6402('0x34')]=_0x38b307[_0x6402('0x35')]=null;}else{_0xb54d15[_0x6402('0x37')]=_0x38b307[_0x6402('0x37')]=null;}_0xb54d15[_0x6402('0x38')]=getImapHost(_0x523c96);_0xb54d15[_0x6402('0x39')]=0x3e1;_0x38b307[_0x6402('0x38')]=getSmtpHost(_0x523c96);_0x38b307[_0x6402('0x39')]=0x24b;_0x38b307['secure']=![];_0xb54d15[_0x6402('0x3a')]=_0x38b307['service']=null;}else{if(_0x4dec86[_0x6402('0x3b')]){_0xb54d15[_0x6402('0x32')]=_0x38b307[_0x6402('0x32')]=_0x4dec86[_0x6402('0x33')];_0xb54d15[_0x6402('0x34')]=_0x38b307['pass']=_0x4dec86[_0x6402('0x34')];}else{_0xb54d15[_0x6402('0x3b')]=_0x38b307[_0x6402('0x3b')]=![];_0xb54d15[_0x6402('0x32')]=_0x38b307[_0x6402('0x32')]=null;_0xb54d15[_0x6402('0x34')]=_0x38b307[_0x6402('0x35')]=null;}_0xb54d15[_0x6402('0x38')]=_0x4dec86[_0x6402('0x3c')][_0x6402('0x38')];_0xb54d15['port']=_0x4dec86[_0x6402('0x3c')]['port'];_0x38b307[_0x6402('0x38')]=_0x4dec86[_0x6402('0x3d')][_0x6402('0x38')];_0x38b307['port']=_0x4dec86[_0x6402('0x3d')]['port'];}return{'Imap':_0xb54d15,'Smtp':_0x38b307};}exports[_0x6402('0x3e')]=function(_0x12e9fb,_0x163739){var _0x446289={'include':[{'model':db[_0x6402('0x3f')],'as':_0x6402('0x3c')},{'model':db[_0x6402('0x40')],'as':_0x6402('0x3d')},{'model':db['Pause'],'as':_0x6402('0x41')}]},_0x4bfb8e={},_0x37f19e={'count':0x0,'rows':[]};var _0x4aa149=_[_0x6402('0x42')](db['MailAccount'][_0x6402('0x43')],function(_0x528c69){return{'name':_0x528c69['fieldName'],'type':_0x528c69[_0x6402('0x44')][_0x6402('0x45')]};});_0x4bfb8e[_0x6402('0x46')]=_[_0x6402('0x42')](_0x4aa149,_0x6402('0x27'));_0x4bfb8e[_0x6402('0x47')]=_['keys'](_0x12e9fb[_0x6402('0x47')]);_0x4bfb8e[_0x6402('0x48')]=_[_0x6402('0x49')](_0x4bfb8e[_0x6402('0x46')],_0x4bfb8e['query']);_0x446289['attributes']=_[_0x6402('0x49')](_0x4bfb8e[_0x6402('0x46')],qs[_0x6402('0x4a')](_0x12e9fb[_0x6402('0x47')]['fields']));_0x446289[_0x6402('0x4b')]=_0x446289[_0x6402('0x4b')][_0x6402('0x4c')]?_0x446289[_0x6402('0x4b')]:_0x4bfb8e['model'];if(!_0x12e9fb[_0x6402('0x47')]['hasOwnProperty']('nolimit')){_0x446289[_0x6402('0x1f')]=qs[_0x6402('0x1f')](_0x12e9fb[_0x6402('0x47')]['limit']);_0x446289[_0x6402('0x1c')]=qs[_0x6402('0x1c')](_0x12e9fb[_0x6402('0x47')]['offset']);}_0x446289['order']=qs[_0x6402('0x4d')](_0x12e9fb[_0x6402('0x47')][_0x6402('0x4d')]);_0x446289[_0x6402('0x4e')]=qs['filters'](_[_0x6402('0x4f')](_0x12e9fb[_0x6402('0x47')],_0x4bfb8e['filters']),_0x4aa149);if(_0x12e9fb[_0x6402('0x47')][_0x6402('0x50')]){_0x446289['where']=_['merge'](_0x446289[_0x6402('0x4e')],{'$or':_[_0x6402('0x42')](_0x4aa149,function(_0x47a851){if(_0x47a851[_0x6402('0x44')]!==_0x6402('0x51')){var _0x45eee8={};_0x45eee8[_0x47a851[_0x6402('0x27')]]={'$like':'%'+_0x12e9fb['query'][_0x6402('0x50')]+'%'};return _0x45eee8;}})});}_0x446289=_['merge']({},_0x446289,_0x12e9fb['options']);var _0x5189f7={'where':_0x446289[_0x6402('0x4e')]};return db[_0x6402('0x52')]['count'](_0x5189f7)[_0x6402('0x11')](function(_0x709dc8){_0x37f19e[_0x6402('0x1e')]=_0x709dc8;if(_0x12e9fb[_0x6402('0x47')][_0x6402('0x53')]){_0x446289['include']=[{'all':!![]}];}return db[_0x6402('0x52')][_0x6402('0x54')](_0x446289);})[_0x6402('0x11')](function(_0x12e394){_0x37f19e[_0x6402('0x55')]=_0x12e394;return _0x37f19e;})[_0x6402('0x11')](respondWithFilteredResult(_0x163739,_0x446289))[_0x6402('0x56')](handleError(_0x163739,null));};exports[_0x6402('0x57')]=function(_0x11323a,_0x35cbf9){var _0x1d586d={'raw':![],'where':{'id':_0x11323a[_0x6402('0x58')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x6402('0x3c')},{'model':db[_0x6402('0x40')],'as':_0x6402('0x3d')},{'model':db['Pause'],'as':_0x6402('0x41')}]},_0x206137={};_0x206137[_0x6402('0x46')]=_[_0x6402('0x59')](db[_0x6402('0x52')][_0x6402('0x43')]);_0x206137[_0x6402('0x47')]=_[_0x6402('0x59')](_0x11323a[_0x6402('0x47')]);_0x206137[_0x6402('0x48')]=_[_0x6402('0x49')](_0x206137['model'],_0x206137['query']);_0x1d586d[_0x6402('0x4b')]=_[_0x6402('0x49')](_0x206137[_0x6402('0x46')],qs[_0x6402('0x4a')](_0x11323a[_0x6402('0x47')][_0x6402('0x4a')]));_0x1d586d[_0x6402('0x4b')]=_0x1d586d[_0x6402('0x4b')][_0x6402('0x4c')]?_0x1d586d['attributes']:_0x206137[_0x6402('0x46')];if(_0x11323a['query']['includeAll']){_0x1d586d['include']=[{'all':!![]}];}_0x1d586d=_['merge']({},_0x1d586d,_0x11323a[_0x6402('0x5a')]);return db[_0x6402('0x52')][_0x6402('0x5b')](_0x1d586d)[_0x6402('0x11')](handleEntityNotFound(_0x35cbf9,null))['then'](respondWithResult(_0x35cbf9,null))[_0x6402('0x56')](handleError(_0x35cbf9,null));};exports[_0x6402('0x22')]=function(_0x50f07a,_0x4c3e02){if(_0x50f07a[_0x6402('0x5c')]['id']){delete _0x50f07a['body']['id'];}var _0x243e94=_0x50f07a['body'][_0x6402('0x5d')]===_0x6402('0x5e')?null:_0x50f07a[_0x6402('0x5c')][_0x6402('0x5d')];var _0x20f1ef=_0x50f07a[_0x6402('0x5c')][_0x6402('0x3c')]||{};var _0x1fd0b2=_0x50f07a[_0x6402('0x5c')][_0x6402('0x3d')]||{};if(_0x243e94){_0x20f1ef['host']=getImapHost(_0x243e94);_0x20f1ef[_0x6402('0x39')]=0x3e1;_0x1fd0b2[_0x6402('0x38')]=getSmtpHost(_0x243e94);_0x1fd0b2['port']=0x24b;_0x1fd0b2[_0x6402('0x5f')]=![];}if(_0x1fd0b2[_0x6402('0x36')]){_0x1fd0b2[_0x6402('0x5f')]=![];}else{_0x1fd0b2['CloudProviderId']=null;}if(!_0x20f1ef['modernAuthentication'])_0x20f1ef[_0x6402('0x37')]=null;_0x50f07a[_0x6402('0x5c')][_0x6402('0x3c')]=_0x20f1ef;_0x50f07a[_0x6402('0x5c')][_0x6402('0x3d')]=_0x1fd0b2;return db['MailAccount']['find']({'where':{'id':_0x50f07a[_0x6402('0x58')]['id']},'include':[{'model':db[_0x6402('0x3f')],'as':_0x6402('0x3c')},{'model':db[_0x6402('0x40')],'as':'Smtp'},{'model':db[_0x6402('0x60')],'as':'mandatoryDispositionPause'}]})[_0x6402('0x11')](handleEntityNotFound(_0x4c3e02,null))['then'](function(_0x5eb54a){if(!_0x5eb54a)throw new Error(_0x6402('0x61'));if(_0x5eb54a['service'])delete _0x50f07a['body'][_0x6402('0x3c')];return _0x5eb54a;})[_0x6402('0x11')](saveUpdates(_0x50f07a['body'],null))[_0x6402('0x11')](function(_0x54a228){if(!_0x50f07a[_0x6402('0x5c')][_0x6402('0x3c')])return _0x54a228;return db[_0x6402('0x3f')][_0x6402('0x22')](_0x50f07a['body']['Imap'],{'where':{'MailAccountId':_0x54a228['id']}})[_0x6402('0x11')](function(){return _0x54a228;});})[_0x6402('0x11')](function(_0x2e5a19){if(!_0x50f07a['body']['Smtp'])return _0x2e5a19;return db[_0x6402('0x40')][_0x6402('0x22')](_0x50f07a[_0x6402('0x5c')][_0x6402('0x3d')],{'where':{'MailAccountId':_0x2e5a19['id']}})['then'](function(){return _0x2e5a19;});})[_0x6402('0x11')](respondWithResult(_0x4c3e02,null))[_0x6402('0x56')](handleError(_0x4c3e02,null));};exports[_0x6402('0x62')]=function(_0x2407b9,_0x2fa037){return db[_0x6402('0x52')][_0x6402('0x62')]()[_0x6402('0x11')](respondWithResult(_0x2fa037,null))['catch'](handleError(_0x2fa037,null));};exports[_0x6402('0x63')]=function(_0x3628cf,_0x14886b){if(_0x3628cf['body']['id']){delete _0x3628cf[_0x6402('0x5c')]['id'];}return db[_0x6402('0x52')]['find']({'where':{'id':_0x3628cf[_0x6402('0x58')]['id']}})['then'](handleEntityNotFound(_0x14886b,null))[_0x6402('0x11')](function(_0x2e4bf2){if(_0x2e4bf2){_0x3628cf[_0x6402('0x5c')][_0x6402('0x64')]=_0x2e4bf2['id'];return db[_0x6402('0x65')][_0x6402('0x66')](_0x3628cf[_0x6402('0x5c')]);}})['then'](respondWithResult(_0x14886b,null))['catch'](handleError(_0x14886b,null));};exports[_0x6402('0x67')]=function(_0x5fc9c5,_0xb7bc40){var _0x377b42={'raw':![],'where':{}};var _0xace2fd={};var _0x45f6ca={'count':0x0,'rows':[]};return db[_0x6402('0x52')][_0x6402('0x68')]({'where':{'id':_0x5fc9c5[_0x6402('0x58')]['id']}})['then'](handleEntityNotFound(_0xb7bc40,null))[_0x6402('0x11')](function(_0x301ed8){if(_0x301ed8){_0xace2fd[_0x6402('0x46')]=_[_0x6402('0x59')](db['Disposition'][_0x6402('0x43')]);_0xace2fd['query']=_[_0x6402('0x59')](_0x5fc9c5[_0x6402('0x47')]);_0xace2fd[_0x6402('0x48')]=_[_0x6402('0x49')](_0xace2fd[_0x6402('0x46')],_0xace2fd[_0x6402('0x47')]);_0x377b42[_0x6402('0x4b')]=_[_0x6402('0x49')](_0xace2fd['model'],qs[_0x6402('0x4a')](_0x5fc9c5[_0x6402('0x47')][_0x6402('0x4a')]));_0x377b42[_0x6402('0x4b')]=_0x377b42[_0x6402('0x4b')][_0x6402('0x4c')]?_0x377b42['attributes']:_0xace2fd[_0x6402('0x46')];if(!_0x5fc9c5[_0x6402('0x47')]['hasOwnProperty'](_0x6402('0x69'))){_0x377b42[_0x6402('0x1f')]=qs[_0x6402('0x1f')](_0x5fc9c5[_0x6402('0x47')]['limit']);_0x377b42[_0x6402('0x1c')]=qs[_0x6402('0x1c')](_0x5fc9c5[_0x6402('0x47')][_0x6402('0x1c')]);}_0x377b42[_0x6402('0x6a')]=qs[_0x6402('0x4d')](_0x5fc9c5[_0x6402('0x47')][_0x6402('0x4d')]);_0x377b42[_0x6402('0x4e')]=qs['filters'](_['pick'](_0x5fc9c5['query'],_0xace2fd[_0x6402('0x48')]));_0x377b42[_0x6402('0x4e')]['MailAccountId']=_0x301ed8['id'];if(_0x5fc9c5[_0x6402('0x47')]['filter']){_0x377b42[_0x6402('0x4e')]=_['merge'](_0x377b42[_0x6402('0x4e')],{'$or':_[_0x6402('0x42')](_0x377b42[_0x6402('0x4b')],function(_0x47e1e3){var _0x40d95a={};_0x40d95a[_0x47e1e3]={'$like':'%'+_0x5fc9c5[_0x6402('0x47')][_0x6402('0x50')]+'%'};return _0x40d95a;})});}_0x377b42=_[_0x6402('0x6b')]({},_0x377b42,_0x5fc9c5[_0x6402('0x5a')]);return db['Disposition'][_0x6402('0x1e')]({'where':_0x377b42[_0x6402('0x4e')]})[_0x6402('0x11')](function(_0x413166){_0x45f6ca[_0x6402('0x1e')]=_0x413166;if(_0x5fc9c5['query'][_0x6402('0x53')]){_0x377b42[_0x6402('0x6c')]=[{'all':!![]}];}return db[_0x6402('0x65')][_0x6402('0x54')](_0x377b42);})[_0x6402('0x11')](function(_0x317ca1){_0x45f6ca[_0x6402('0x55')]=_0x317ca1;return _0x45f6ca;});}})['then'](respondWithFilteredResult(_0xb7bc40,_0x377b42))['catch'](handleError(_0xb7bc40,null));};exports[_0x6402('0x6d')]=function(_0x1f42cb,_0x2af22d){return db[_0x6402('0x52')][_0x6402('0x5b')]({'where':{'id':_0x1f42cb[_0x6402('0x58')]['id']}})[_0x6402('0x11')](handleEntityNotFound(_0x2af22d,null))['then'](function(_0x28660b){if(_0x28660b){return _0x28660b[_0x6402('0x6d')](_0x1f42cb['query'][_0x6402('0x6e')]);}})[_0x6402('0x11')](respondWithStatusCode(_0x2af22d,null))[_0x6402('0x56')](handleError(_0x2af22d,null));};exports[_0x6402('0x6f')]=function(_0x2931fd,_0x2f82cb){if(_0x2931fd['body']['id']){delete _0x2931fd[_0x6402('0x5c')]['id'];}return db[_0x6402('0x52')]['find']({'where':{'id':_0x2931fd[_0x6402('0x58')]['id']}})[_0x6402('0x11')](handleEntityNotFound(_0x2f82cb,null))[_0x6402('0x11')](function(_0x3c53f8){if(_0x3c53f8){_0x2931fd['body'][_0x6402('0x64')]=_0x3c53f8['id'];return db[_0x6402('0x70')]['create'](_0x2931fd[_0x6402('0x5c')]);}})[_0x6402('0x11')](respondWithResult(_0x2f82cb,null))[_0x6402('0x56')](handleError(_0x2f82cb,null));};exports[_0x6402('0x71')]=function(_0x4b7dc5,_0x36afcb){var _0x2bb7d7={'raw':![],'where':{}};var _0x613b4a={};var _0x45d65d={'count':0x0,'rows':[]};return db[_0x6402('0x52')]['findOne']({'where':{'id':_0x4b7dc5['params']['id']}})[_0x6402('0x11')](handleEntityNotFound(_0x36afcb,null))[_0x6402('0x11')](function(_0xde93b8){if(_0xde93b8){_0x613b4a[_0x6402('0x46')]=_['keys'](db[_0x6402('0x70')][_0x6402('0x43')]);_0x613b4a['query']=_[_0x6402('0x59')](_0x4b7dc5[_0x6402('0x47')]);_0x613b4a['filters']=_['intersection'](_0x613b4a[_0x6402('0x46')],_0x613b4a[_0x6402('0x47')]);_0x2bb7d7['attributes']=_[_0x6402('0x49')](_0x613b4a[_0x6402('0x46')],qs[_0x6402('0x4a')](_0x4b7dc5['query']['fields']));_0x2bb7d7[_0x6402('0x4b')]=_0x2bb7d7[_0x6402('0x4b')][_0x6402('0x4c')]?_0x2bb7d7[_0x6402('0x4b')]:_0x613b4a[_0x6402('0x46')];if(!_0x4b7dc5['query']['hasOwnProperty'](_0x6402('0x69'))){_0x2bb7d7[_0x6402('0x1f')]=qs['limit'](_0x4b7dc5[_0x6402('0x47')][_0x6402('0x1f')]);_0x2bb7d7[_0x6402('0x1c')]=qs['offset'](_0x4b7dc5['query'][_0x6402('0x1c')]);}_0x2bb7d7['order']=qs[_0x6402('0x4d')](_0x4b7dc5[_0x6402('0x47')][_0x6402('0x4d')]);_0x2bb7d7[_0x6402('0x4e')]=qs[_0x6402('0x48')](_['pick'](_0x4b7dc5[_0x6402('0x47')],_0x613b4a['filters']));_0x2bb7d7[_0x6402('0x4e')][_0x6402('0x64')]=_0xde93b8['id'];if(_0x4b7dc5[_0x6402('0x47')][_0x6402('0x50')]){_0x2bb7d7[_0x6402('0x4e')]=_[_0x6402('0x6b')](_0x2bb7d7[_0x6402('0x4e')],{'$or':_[_0x6402('0x42')](_0x2bb7d7[_0x6402('0x4b')],function(_0x4c544d){var _0x1e597e={};_0x1e597e[_0x4c544d]={'$like':'%'+_0x4b7dc5[_0x6402('0x47')][_0x6402('0x50')]+'%'};return _0x1e597e;})});}_0x2bb7d7=_[_0x6402('0x6b')]({},_0x2bb7d7,_0x4b7dc5[_0x6402('0x5a')]);return db[_0x6402('0x70')][_0x6402('0x1e')]({'where':_0x2bb7d7[_0x6402('0x4e')]})[_0x6402('0x11')](function(_0x5d62ab){_0x45d65d['count']=_0x5d62ab;if(_0x4b7dc5[_0x6402('0x47')]['includeAll']){_0x2bb7d7[_0x6402('0x6c')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6402('0x54')](_0x2bb7d7);})[_0x6402('0x11')](function(_0x1f7d08){_0x45d65d[_0x6402('0x55')]=_0x1f7d08;return _0x45d65d;});}})[_0x6402('0x11')](respondWithFilteredResult(_0x36afcb,_0x2bb7d7))[_0x6402('0x56')](handleError(_0x36afcb,null));};exports[_0x6402('0x72')]=function(_0x10ad4b,_0x814ca7){return db[_0x6402('0x52')]['find']({'where':{'id':_0x10ad4b['params']['id']}})[_0x6402('0x11')](handleEntityNotFound(_0x814ca7,null))[_0x6402('0x11')](function(_0x171575){if(_0x171575){return _0x171575[_0x6402('0x72')](_0x10ad4b[_0x6402('0x47')][_0x6402('0x6e')]);}})[_0x6402('0x11')](respondWithStatusCode(_0x814ca7,null))['catch'](handleError(_0x814ca7,null));};exports[_0x6402('0x66')]=function(_0x2fbc6e,_0x260f2d){var _0x481a6d={'name':_0x2fbc6e[_0x6402('0x5c')][_0x6402('0x27')],'key':_0x2fbc6e['body'][_0x6402('0x45')],'provider':_0x2fbc6e[_0x6402('0x5c')][_0x6402('0x5d')]===_0x6402('0x5e')?null:_0x2fbc6e[_0x6402('0x5c')][_0x6402('0x5d')],'email':_0x2fbc6e['body'][_0x6402('0x73')],'ListId':_0x2fbc6e[_0x6402('0x5c')][_0x6402('0x74')],'active':!_[_0x6402('0x75')](_0x2fbc6e[_0x6402('0x5c')][_0x6402('0x76')])?_0x2fbc6e[_0x6402('0x5c')][_0x6402('0x76')]:!![],'description':_0x2fbc6e['body'][_0x6402('0x77')]||null};var _0xf3de22=getAuthenticationOptions(_0x481a6d[_0x6402('0x5d')],_0x2fbc6e[_0x6402('0x5c')]);_0x481a6d[_0x6402('0x3c')]=_0xf3de22['Imap'];_0x481a6d[_0x6402('0x3d')]=_0xf3de22[_0x6402('0x3d')];return db['MailAccount'][_0x6402('0x66')](_0x481a6d,{'include':[{'model':db[_0x6402('0x40')],'as':'Smtp'},{'model':db[_0x6402('0x3f')],'as':'Imap'}]})[_0x6402('0x11')](function(_0x4969d5){var _0x470ccd=_0x2fbc6e[_0x6402('0x32')][_0x6402('0x24')]({'plain':!![]});if(!_0x470ccd)throw new Error(_0x6402('0x78'));if(_0x470ccd[_0x6402('0x79')]==='user'){var _0x1208bd=_0x4969d5['get']({'plain':!![]});return db['UserProfileSection'][_0x6402('0x5b')]({'where':{'name':_0x6402('0x25'),'userProfileId':_0x470ccd['userProfileId']},'raw':!![]})['then'](function(_0x418fea){if(_0x418fea&&_0x418fea[_0x6402('0x7a')]===0x0){return db[_0x6402('0x7b')][_0x6402('0x66')]({'name':_0x1208bd[_0x6402('0x27')],'resourceId':_0x1208bd['id'],'type':_0x418fea[_0x6402('0x27')],'sectionId':_0x418fea['id']},{})[_0x6402('0x11')](function(){return _0x4969d5;});}else{return _0x4969d5;}})[_0x6402('0x56')](function(_0x1a368b){logger[_0x6402('0x16')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a368b);throw _0x1a368b;});}return _0x4969d5;})['then'](respondWithResult(_0x260f2d,0xc9))[_0x6402('0x56')](handleError(_0x260f2d,null));};exports[_0x6402('0x7c')]=function(_0x5535c3,_0x4ead8a){return db[_0x6402('0x52')][_0x6402('0x68')]({'where':{'id':_0x5535c3[_0x6402('0x58')]['id']}})[_0x6402('0x11')](handleEntityNotFound(_0x4ead8a,null))[_0x6402('0x11')](function(_0xf4e179){if(_0xf4e179){return _0xf4e179[_0x6402('0x7c')]();}return null;})['then'](respondWithResult(_0x4ead8a,null))[_0x6402('0x56')](handleError(_0x4ead8a,null));};exports[_0x6402('0x7d')]=function(_0x3ba426,_0x46f446){if(_0x3ba426['body']['id']){delete _0x3ba426[_0x6402('0x5c')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x3ba426[_0x6402('0x58')]['id']}})[_0x6402('0x11')](handleEntityNotFound(_0x46f446,null))['then'](function(_0x3ce1e8){if(_0x3ce1e8){_0x3ba426[_0x6402('0x5c')][_0x6402('0x64')]=_0x3ce1e8['id'];return db[_0x6402('0x3f')][_0x6402('0x66')](_0x3ba426[_0x6402('0x5c')]);}})[_0x6402('0x11')](respondWithResult(_0x46f446,null))[_0x6402('0x56')](handleError(_0x46f446,null));};exports[_0x6402('0x7e')]=function(_0x5d749c,_0x2c2568){return db[_0x6402('0x52')]['findOne']({'where':{'id':_0x5d749c[_0x6402('0x58')]['id']}})[_0x6402('0x11')](handleEntityNotFound(_0x2c2568,null))[_0x6402('0x11')](function(_0x23ad5b){if(_0x23ad5b){return _0x23ad5b[_0x6402('0x7f')](null);}return null;})[_0x6402('0x11')](respondWithStatusCode(_0x2c2568,null))[_0x6402('0x56')](handleError(_0x2c2568,null));};exports[_0x6402('0x80')]=function(_0x4866ca,_0x549868){return db[_0x6402('0x52')][_0x6402('0x68')]({'where':{'id':_0x4866ca[_0x6402('0x58')]['id']}})['then'](handleEntityNotFound(_0x549868,null))[_0x6402('0x11')](function(_0x136f8c){if(_0x136f8c){return _0x136f8c[_0x6402('0x80')]();}return null;})[_0x6402('0x11')](respondWithResult(_0x549868,null))[_0x6402('0x56')](handleError(_0x549868,null));};exports[_0x6402('0x81')]=function(_0x80e783,_0x3ffc8d){if(_0x80e783[_0x6402('0x5c')]['id']){delete _0x80e783[_0x6402('0x5c')]['id'];}return db[_0x6402('0x52')]['find']({'where':{'id':_0x80e783[_0x6402('0x58')]['id']}})[_0x6402('0x11')](handleEntityNotFound(_0x3ffc8d,null))[_0x6402('0x11')](function(_0xf0f4f7){if(_0xf0f4f7){_0x80e783['body']['MailAccountId']=_0xf0f4f7['id'];return db[_0x6402('0x40')][_0x6402('0x66')](_0x80e783['body']);}})['then'](respondWithResult(_0x3ffc8d,null))[_0x6402('0x56')](handleError(_0x3ffc8d,null));};exports['removeSmtp']=function(_0x272c07,_0x2a1de2){return db[_0x6402('0x52')][_0x6402('0x68')]({'where':{'id':_0x272c07['params']['id']}})[_0x6402('0x11')](handleEntityNotFound(_0x2a1de2,null))[_0x6402('0x11')](function(_0x495294){if(_0x495294){return _0x495294[_0x6402('0x82')](null);}return null;})['then'](respondWithStatusCode(_0x2a1de2,null))[_0x6402('0x56')](handleError(_0x2a1de2,null));};exports['addInteraction']=function(_0x1df69a,_0xee394a){return db[_0x6402('0x83')][_0x6402('0x5b')]({'where':{'id':_0x1df69a[_0x6402('0x58')]['id']}})[_0x6402('0x11')](handleEntityNotFound(_0xee394a,null))[_0x6402('0x11')](function(_0x94a8cf){if(_0x94a8cf){return _0x94a8cf[_0x6402('0x84')](_0x1df69a[_0x6402('0x5c')][_0x6402('0x6e')],_[_0x6402('0x85')](_0x1df69a[_0x6402('0x5c')],[_0x6402('0x6e'),'id'])||{});}})['then'](respondWithResult(_0xee394a,null))[_0x6402('0x56')](handleError(_0xee394a,null));};exports[_0x6402('0x86')]=function(_0x43a598,_0x27dfe1){var _0x41c726={'raw':![],'where':{}};var _0x5d414c={};var _0x59ced7={'count':0x0,'rows':[]};return db['MailAccount'][_0x6402('0x68')]({'where':{'id':_0x43a598[_0x6402('0x58')]['id']}})[_0x6402('0x11')](handleEntityNotFound(_0x27dfe1,null))[_0x6402('0x11')](function(_0x662fcd){if(_0x662fcd){_0x5d414c[_0x6402('0x46')]=_[_0x6402('0x59')](db[_0x6402('0x83')]['rawAttributes']);_0x5d414c[_0x6402('0x47')]=_[_0x6402('0x59')](_0x43a598[_0x6402('0x47')]);_0x5d414c['filters']=_['intersection'](_0x5d414c['model'],_0x5d414c[_0x6402('0x47')]);_0x41c726[_0x6402('0x4b')]=_['intersection'](_0x5d414c[_0x6402('0x46')],qs[_0x6402('0x4a')](_0x43a598[_0x6402('0x47')][_0x6402('0x4a')]));_0x41c726[_0x6402('0x4b')]=_0x41c726[_0x6402('0x4b')][_0x6402('0x4c')]?_0x41c726['attributes']:_0x5d414c[_0x6402('0x46')];if(!_0x43a598[_0x6402('0x47')]['hasOwnProperty'](_0x6402('0x69'))){_0x41c726[_0x6402('0x1f')]=qs[_0x6402('0x1f')](_0x43a598['query'][_0x6402('0x1f')]);_0x41c726[_0x6402('0x1c')]=qs['offset'](_0x43a598['query']['offset']);}_0x41c726[_0x6402('0x6a')]=qs[_0x6402('0x4d')](_0x43a598[_0x6402('0x47')][_0x6402('0x4d')]);_0x41c726[_0x6402('0x4e')]=qs[_0x6402('0x48')](_[_0x6402('0x4f')](_0x43a598[_0x6402('0x47')],_0x5d414c[_0x6402('0x48')]));_0x41c726[_0x6402('0x4e')]['MailAccountId']=_0x662fcd['id'];if(_0x43a598[_0x6402('0x47')]['filter']){_0x41c726[_0x6402('0x4e')]=_[_0x6402('0x6b')](_0x41c726[_0x6402('0x4e')],{'$or':_['map'](_0x41c726[_0x6402('0x4b')],function(_0x4a8a50){var _0x3983ba={};_0x3983ba[_0x4a8a50]={'$like':'%'+_0x43a598[_0x6402('0x47')][_0x6402('0x50')]+'%'};return _0x3983ba;})});}_0x41c726=_[_0x6402('0x6b')]({},_0x41c726,_0x43a598[_0x6402('0x5a')]);return db[_0x6402('0x83')][_0x6402('0x1e')]({'where':_0x41c726[_0x6402('0x4e')]})[_0x6402('0x11')](function(_0x1f5105){_0x59ced7[_0x6402('0x1e')]=_0x1f5105;if(_0x43a598[_0x6402('0x47')][_0x6402('0x53')]){_0x41c726[_0x6402('0x6c')]=[{'model':db[_0x6402('0x87')],'as':'Contact','required':![]},{'model':db[_0x6402('0x88')],'as':_0x6402('0x89'),'attributes':[_0x6402('0x27'),'fullname',_0x6402('0x8a')],'required':![]},{'model':db[_0x6402('0x8b')],'as':_0x6402('0x8c'),'attributes':['id','name','color'],'where':_0x43a598['query'][_0x6402('0x8d')]?{'id':_0x43a598[_0x6402('0x47')][_0x6402('0x8d')]}:undefined,'required':_0x43a598['query'][_0x6402('0x8d')]?!![]:![]}];}return db[_0x6402('0x83')][_0x6402('0x54')](_0x41c726);})[_0x6402('0x11')](function(_0x44500e){_0x59ced7['rows']=_0x44500e;return _0x59ced7;});}})['then'](respondWithFilteredResult(_0x27dfe1,_0x41c726))[_0x6402('0x56')](handleError(_0x27dfe1,null));};exports[_0x6402('0x8e')]=function addApplications(_0x146ba4,_0x26e40b){var _0x2603e4=_0x146ba4[_0x6402('0x58')]['id'];var _0x2e167e=_0x146ba4[_0x6402('0x5c')];var _0x31f40c=0xc8;var _0x15b6a7=null;return db['sequelize'][_0x6402('0x8f')]({'isolationLevel':db[_0x6402('0x90')]['Transaction'][_0x6402('0x91')]['READ_COMMITTED']},function(_0x430029){return db['MailAccount']['findOne']({'where':{'id':_0x2603e4},'transaction':_0x430029})[_0x6402('0x11')](function(_0x282d4d){if(_0x282d4d){return db[_0x6402('0x92')][_0x6402('0x23')]({'where':{'MailAccountId':_0x2603e4},'transaction':_0x430029})[_0x6402('0x11')](function(){var _0x4c80a3=_[_0x6402('0x42')](_0x2e167e,function(_0x5bdae4){_0x5bdae4[_0x6402('0x64')]=_0x2603e4;return _0x5bdae4;});return db[_0x6402('0x92')]['bulkCreate'](_0x4c80a3,{'transaction':_0x430029});});}else{_0x31f40c=0x194;_0x15b6a7=[];}});})[_0x6402('0x11')](function(){if(_0x31f40c!==0x194){return db['MailApplication'][_0x6402('0x93')]({'where':{'MailAccountId':_0x2603e4},'order':'priority'})['then'](function(_0x2480b7){_0x15b6a7=_0x2480b7;});}})[_0x6402('0x56')](function(_0x3128a0){_0x31f40c=0x1f4;logger[_0x6402('0x16')](_0x3128a0[_0x6402('0x94')]);if(_0x3128a0[_0x6402('0x27')]){delete _0x3128a0[_0x6402('0x27')];}_0x15b6a7=_0x3128a0;})['finally'](function(){if(_0x15b6a7===null){_0x26e40b[_0x6402('0x1a')](_0x31f40c);}else{if(_0x31f40c===0x1f4){_0x26e40b[_0x6402('0x20')](_0x31f40c)[_0x6402('0x28')](_0x15b6a7);}else{_0x26e40b[_0x6402('0x20')](_0x31f40c)[_0x6402('0x1b')](_0x15b6a7);}}});};exports['getApplications']=function(_0x3a3db2,_0x55e9a2){var _0x4a5063={};var _0x5c9aa2={};var _0x5c45a6;var _0x1b71af;return db['MailAccount'][_0x6402('0x68')]({'where':{'id':_0x3a3db2[_0x6402('0x58')]['id']}})[_0x6402('0x11')](handleEntityNotFound(_0x55e9a2,null))[_0x6402('0x11')](function(_0x2c857f){if(_0x2c857f){_0x5c45a6=_0x2c857f;_0x5c9aa2[_0x6402('0x46')]=_[_0x6402('0x59')](db[_0x6402('0x92')][_0x6402('0x43')]);_0x5c9aa2[_0x6402('0x47')]=_[_0x6402('0x59')](_0x3a3db2[_0x6402('0x47')]);_0x5c9aa2[_0x6402('0x48')]=_[_0x6402('0x49')](_0x5c9aa2[_0x6402('0x46')],_0x5c9aa2[_0x6402('0x47')]);_0x4a5063['attributes']=_[_0x6402('0x49')](_0x5c9aa2[_0x6402('0x46')],qs[_0x6402('0x4a')](_0x3a3db2['query'][_0x6402('0x4a')]));_0x4a5063[_0x6402('0x4b')]=_0x4a5063[_0x6402('0x4b')]['length']?_0x4a5063[_0x6402('0x4b')]:_0x5c9aa2['model'];_0x4a5063[_0x6402('0x6a')]=qs['sort'](_0x3a3db2[_0x6402('0x47')]['sort']);_0x4a5063[_0x6402('0x4e')]=qs[_0x6402('0x48')](_[_0x6402('0x4f')](_0x3a3db2[_0x6402('0x47')],_0x5c9aa2[_0x6402('0x48')]));if(_0x3a3db2[_0x6402('0x47')][_0x6402('0x50')]){_0x4a5063[_0x6402('0x4e')]=_[_0x6402('0x6b')](_0x4a5063[_0x6402('0x4e')],{'$or':_[_0x6402('0x42')](_0x4a5063[_0x6402('0x4b')],function(_0x3bf37b){var _0x31d7a2={};_0x31d7a2[_0x3bf37b]={'$like':'%'+_0x3a3db2['query'][_0x6402('0x50')]+'%'};return _0x31d7a2;})});}_0x4a5063=_[_0x6402('0x6b')]({},_0x4a5063,_0x3a3db2[_0x6402('0x5a')]);return _0x5c45a6[_0x6402('0x95')](_0x4a5063);}})['then'](function(_0x11a9b7){if(_0x11a9b7){_0x1b71af=_0x11a9b7[_0x6402('0x4c')];if(!_0x3a3db2[_0x6402('0x47')][_0x6402('0x96')](_0x6402('0x69'))){_0x4a5063['limit']=qs[_0x6402('0x1f')](_0x3a3db2[_0x6402('0x47')][_0x6402('0x1f')]);_0x4a5063['offset']=qs[_0x6402('0x1c')](_0x3a3db2[_0x6402('0x47')][_0x6402('0x1c')]);}return _0x5c45a6[_0x6402('0x95')](_0x4a5063);}})[_0x6402('0x11')](function(_0x25adfd){if(_0x25adfd){return _0x25adfd?{'count':_0x1b71af,'rows':_0x25adfd}:null;}})[_0x6402('0x11')](respondWithResult(_0x55e9a2,null))['catch'](handleError(_0x55e9a2,null));};exports[_0x6402('0x97')]=function(_0x1c5c19,_0x2b0191){var _0x3dc443={'raw':!![],'where':{}};var _0x414e89={};var _0x47f692={'count':0x0,'rows':[]};return db[_0x6402('0x52')][_0x6402('0x68')]({'where':{'id':_0x1c5c19['params']['id']}})[_0x6402('0x11')](handleEntityNotFound(_0x2b0191,null))[_0x6402('0x11')](function(_0x1d5b88){if(_0x1d5b88){_0x414e89[_0x6402('0x46')]=_[_0x6402('0x59')](db[_0x6402('0x98')]['rawAttributes']);_0x414e89[_0x6402('0x47')]=_[_0x6402('0x59')](_0x1c5c19[_0x6402('0x47')]);_0x414e89['filters']=_['intersection'](_0x414e89[_0x6402('0x46')],_0x414e89[_0x6402('0x47')]);_0x3dc443[_0x6402('0x4b')]=_['intersection'](_0x414e89[_0x6402('0x46')],qs['fields'](_0x1c5c19[_0x6402('0x47')][_0x6402('0x4a')]));_0x3dc443['attributes']=_0x3dc443[_0x6402('0x4b')][_0x6402('0x4c')]?_0x3dc443['attributes']:_0x414e89[_0x6402('0x46')];if(!_0x1c5c19['query']['hasOwnProperty'](_0x6402('0x69'))){_0x3dc443[_0x6402('0x1f')]=qs[_0x6402('0x1f')](_0x1c5c19[_0x6402('0x47')][_0x6402('0x1f')]);_0x3dc443[_0x6402('0x1c')]=qs[_0x6402('0x1c')](_0x1c5c19[_0x6402('0x47')][_0x6402('0x1c')]);}_0x3dc443[_0x6402('0x6a')]=qs['sort'](_0x1c5c19[_0x6402('0x47')][_0x6402('0x4d')]);_0x3dc443[_0x6402('0x4e')]=qs[_0x6402('0x48')](_[_0x6402('0x4f')](_0x1c5c19[_0x6402('0x47')],_0x414e89[_0x6402('0x48')]));_0x3dc443[_0x6402('0x4e')]['MailAccountId']=_0x1d5b88['id'];if(_0x1c5c19['query'][_0x6402('0x50')]){_0x3dc443['where']=_['merge'](_0x3dc443[_0x6402('0x4e')],{'$or':_['map'](_0x3dc443[_0x6402('0x4b')],function(_0x349251){var _0x4a6b5f={};_0x4a6b5f[_0x349251]={'$like':'%'+_0x1c5c19[_0x6402('0x47')][_0x6402('0x50')]+'%'};return _0x4a6b5f;})});}if(_0x1c5c19[_0x6402('0x47')][_0x6402('0x99')]){var _0x4eb86c=_0x1c5c19[_0x6402('0x47')][_0x6402('0x99')]['split'](',');var _0x3f7bb6={};_0x3f7bb6[_0x4eb86c[0x0]]={'$gte':moment(_0x4eb86c[0x1])[_0x6402('0x9a')](_0x6402('0x9b'))};_0x3dc443[_0x6402('0x4e')]=_[_0x6402('0x6b')](_0x3dc443[_0x6402('0x4e')],_0x3f7bb6);}_0x3dc443=_[_0x6402('0x6b')]({},_0x3dc443,_0x1c5c19[_0x6402('0x5a')]);return db[_0x6402('0x98')][_0x6402('0x1e')]({'where':_0x3dc443['where']})['then'](function(_0x242a3b){_0x47f692[_0x6402('0x1e')]=_0x242a3b;if(_0x1c5c19[_0x6402('0x47')][_0x6402('0x53')]){_0x3dc443['include']=[{'all':!![]}];}return db[_0x6402('0x98')][_0x6402('0x54')](_0x3dc443);})[_0x6402('0x11')](function(_0x20e0ca){if(_0x1c5c19['query'][_0x6402('0x9c')]===_0x6402('0x9d')){for(var _0x2525fe=0x0;_0x2525fe<_0x20e0ca[_0x6402('0x4c')];_0x2525fe++){_0x20e0ca[_0x2525fe][_0x6402('0x5c')]=juice(_0x20e0ca[_0x2525fe]['body']);}}_0x47f692[_0x6402('0x55')]=_0x20e0ca;return _0x47f692;});}})[_0x6402('0x11')](respondWithFilteredResult(_0x2b0191,_0x3dc443))[_0x6402('0x56')](handleError(_0x2b0191,null));};exports[_0x6402('0x28')]=function(_0x1332ef,_0x445454){var _0x52c9c0,_0x283fa6={},_0x4119bf;if(_0x1332ef[_0x6402('0x5c')]['to']){_0x4119bf=_0x1332ef[_0x6402('0x5c')]['to'][_0x6402('0x9e')](',')[0x0];}return db[_0x6402('0x52')]['find']({'where':{'id':_0x1332ef[_0x6402('0x58')]['id']},'include':[{'model':db[_0x6402('0x9f')],'as':_0x6402('0xa0'),'include':[{'model':db[_0x6402('0x87')],'as':_0x6402('0xa1'),'where':{'email':_0x4119bf},'limit':0x1,'order':[[_0x6402('0xa2'),_0x6402('0xa3')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x6402('0xa4')],'as':_0x6402('0xa4'),'raw':!![]}]}]})[_0x6402('0x11')](handleEntityNotFound(_0x445454,null))[_0x6402('0x11')](function(_0x28dbc3){if(!_0x28dbc3)return;_0x52c9c0=_0x28dbc3;if(!_0x28dbc3[_0x6402('0x3d')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x6402('0x75')](_0x1332ef['body'][_0x6402('0xa5')])){_0x1332ef['body'][_0x6402('0xa5')]=util[_0x6402('0x9a')](_0x6402('0xa6'),_0x28dbc3[_0x6402('0x27')],_0x28dbc3[_0x6402('0x73')]||_0x28dbc3[_0x6402('0x3d')][_0x6402('0x32')]);}if(_0x1332ef[_0x6402('0x5c')]['attachments']&&_0x1332ef['body'][_0x6402('0xa7')][_0x6402('0x4c')]){for(var _0x19e60d=0x0;_0x19e60d<_0x1332ef[_0x6402('0x5c')][_0x6402('0xa7')][_0x6402('0x4c')];_0x19e60d+=0x1){_0x1332ef[_0x6402('0x5c')][_0x6402('0xa7')][_0x19e60d]={'filename':_0x1332ef['body'][_0x6402('0xa7')][_0x19e60d][_0x6402('0x27')],'path':path['join'](config[_0x6402('0xa8')],_0x6402('0xa9'),_0x1332ef[_0x6402('0x5c')][_0x6402('0xa7')][_0x19e60d][_0x6402('0xaa')])};}}var _0x24537a=_0x28dbc3[_0x6402('0xab')]();return respondWithRpcPromise(_0x6402('0xac'),_0x6402('0xad'),{'account':_0x24537a,'message':_0x1332ef[_0x6402('0x5c')]});})[_0x6402('0x11')](function(_0x2172c7){if(!_0x2172c7)return;_0x283fa6=_0x2172c7;if(!_0x52c9c0[_0x6402('0xa0')])throw new Error(_0x6402('0xae'));if(_0x52c9c0[_0x6402('0xa0')][_0x6402('0xa1')][_0x6402('0x4c')])return _0x52c9c0[_0x6402('0xa0')][_0x6402('0xa1')][0x0];return db['CmContact'][_0x6402('0x66')](_[_0x6402('0xa')](_0x1332ef[_0x6402('0x5c')],{'firstName':_0x1332ef['body']['to'],'email':_0x1332ef['body']['to'],'phone':_0x1332ef['body']['to'],'ListId':_0x52c9c0[_0x6402('0x74')]}));})[_0x6402('0x11')](function(_0x133d18){if(!_0x133d18)return;var _0x291a07={'UserId':_0x1332ef['user']['id'],'ContactId':_0x133d18['id'],'MailAccountId':_0x52c9c0['id'],'inReplyTo':_0x283fa6[_0x6402('0xaf')],'to':_0x1332ef['body'][_0x6402('0xa5')],'cc':_0x1332ef[_0x6402('0x5c')]['cc'],'subject':_0x1332ef[_0x6402('0x5c')][_0x6402('0xb0')],'attach':_0x1332ef[_0x6402('0x5c')]['attach'],'firstMsgDirection':_0x6402('0xb1'),'lastMsgAt':moment()['format'](_0x6402('0x9b')),'lastMsgDirection':_0x6402('0xb1'),'Messages':[_[_0x6402('0x6b')](_0x1332ef[_0x6402('0x5c')],{'messageId':_0x283fa6[_0x6402('0xaf')],'sentAt':moment()[_0x6402('0x9a')](_0x6402('0x9b')),'read':!![],'MailAccountId':_0x52c9c0['id'],'UserId':_0x1332ef[_0x6402('0x32')]['id'],'ContactId':_0x133d18['id']})]};if(_0x1332ef[_0x6402('0x5c')]['Interaction']){_0x291a07=_['merge'](_0x291a07,_0x1332ef['body'][_0x6402('0xb2')]);}return db['MailInteraction']['create'](_0x291a07,{'include':[{'model':db[_0x6402('0x98')],'as':_0x6402('0xb3')}]});})['then'](respondWithResult(_0x445454,null))[_0x6402('0x56')](handleError(_0x445454,null));};exports['verifySmtp']=function(_0x2815db,_0x31a9e0){return db[_0x6402('0x52')][_0x6402('0x5b')]({'where':{'id':_0x2815db['params']['id']},'include':[{'model':db['MailServerOut'],'as':_0x6402('0x3d'),'raw':!![],'include':[{'model':db[_0x6402('0xa4')],'as':_0x6402('0xa4'),'raw':!![]}]}]})[_0x6402('0x11')](handleEntityNotFound(_0x31a9e0,null))[_0x6402('0x11')](function(_0x4f7340){if(!_0x4f7340[_0x6402('0x3d')])return;var _0x5636ce=_0x4f7340['getSmtpOptions']();return respondWithRpcPromise(_0x6402('0xb4'),_0x6402('0xb5'),{'account':_0x5636ce});})[_0x6402('0x11')](respondWithResult(_0x31a9e0,null))[_0x6402('0x56')](handleError(_0x31a9e0,null));};exports['destroy']=function(_0x19b6cd,_0x3db3bc){return db[_0x6402('0x52')][_0x6402('0x5b')]({'where':{'id':_0x19b6cd[_0x6402('0x58')]['id']}})['then'](handleEntityNotFound(_0x3db3bc,null))[_0x6402('0x11')](function(_0x12740a){if(_0x12740a&&_0x12740a[_0x6402('0x3a')]){throw new db[(_0x6402('0xb6'))][(_0x6402('0xb7'))](_0x6402('0xb8'));}return _0x12740a;})['then'](removeEntity(_0x3db3bc,null))[_0x6402('0x56')](handleError(_0x3db3bc,null));};exports[_0x6402('0xb9')]=function(_0x5eaec7,_0x440706){return db[_0x6402('0x52')]['find']({'where':{'id':_0x5eaec7[_0x6402('0x58')]['id']}})[_0x6402('0x11')](handleEntityNotFound(_0x440706,null))[_0x6402('0x11')](function(_0x4386c0){if(_0x4386c0){return _0x4386c0[_0x6402('0xb9')](_0x5eaec7[_0x6402('0x5c')][_0x6402('0x6e')],_['omit'](_0x5eaec7[_0x6402('0x5c')],[_0x6402('0x6e'),'id'])||{})[_0x6402('0xba')](function(_0x3c12f3){for(var _0x549a49=0x0;_0x549a49<_0x5eaec7[_0x6402('0x5c')][_0x6402('0x6e')]['length'];_0x549a49+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x5eaec7[_0x6402('0x5c')][_0x6402('0x6e')][_0x549a49]),'MailAccountId':Number(_0x5eaec7[_0x6402('0x58')]['id'])});}return _0x3c12f3;});}})['then'](respondWithResult(_0x440706,null))[_0x6402('0x56')](handleError(_0x440706,null));};exports[_0x6402('0xbb')]=function(_0x4e096d,_0x33b913){return db[_0x6402('0x52')][_0x6402('0x5b')]({'where':{'id':_0x4e096d[_0x6402('0x58')]['id']}})[_0x6402('0x11')](handleEntityNotFound(_0x33b913,null))[_0x6402('0x11')](function(_0x51d276){if(_0x51d276){return _0x51d276[_0x6402('0xbb')](_0x4e096d[_0x6402('0x47')]['ids'])[_0x6402('0x11')](function(){if(_[_0x6402('0xbc')](_0x4e096d[_0x6402('0x47')][_0x6402('0x6e')])){for(var _0x5b5ef9=0x0;_0x5b5ef9<_0x4e096d[_0x6402('0x47')][_0x6402('0x6e')][_0x6402('0x4c')];_0x5b5ef9+=0x1){socket[_0x6402('0xbd')](_0x6402('0xbe'),{'UserId':Number(_0x4e096d[_0x6402('0x47')]['ids'][_0x5b5ef9]),'MailAccountId':Number(_0x4e096d['params']['id'])});}}else{socket['emit'](_0x6402('0xbe'),{'UserId':Number(_0x4e096d[_0x6402('0x47')]['ids']),'MailAccountId':Number(_0x4e096d['params']['id'])});}});}})[_0x6402('0x11')](respondWithStatusCode(_0x33b913,null))['catch'](handleError(_0x33b913,null));};exports[_0x6402('0xbf')]=function(_0x35dadb,_0x2d17eb){var _0x688f60={};var _0x39205d={};var _0x3c9834;var _0x22c03d;return db[_0x6402('0x52')][_0x6402('0x68')]({'where':{'id':_0x35dadb[_0x6402('0x58')]['id']}})[_0x6402('0x11')](handleEntityNotFound(_0x2d17eb,null))[_0x6402('0x11')](function(_0x3eb6e6){if(_0x3eb6e6){_0x3c9834=_0x3eb6e6;_0x39205d['model']=_['keys'](db[_0x6402('0x88')][_0x6402('0x43')]);_0x39205d[_0x6402('0x47')]=_['keys'](_0x35dadb[_0x6402('0x47')]);_0x39205d['filters']=_[_0x6402('0x49')](_0x39205d['model'],_0x39205d[_0x6402('0x47')]);_0x688f60['attributes']=_[_0x6402('0x49')](_0x39205d[_0x6402('0x46')],qs[_0x6402('0x4a')](_0x35dadb[_0x6402('0x47')][_0x6402('0x4a')]));_0x688f60[_0x6402('0x4b')]=_0x688f60[_0x6402('0x4b')][_0x6402('0x4c')]?_0x688f60[_0x6402('0x4b')]:_0x39205d[_0x6402('0x46')];_0x688f60[_0x6402('0x6a')]=qs[_0x6402('0x4d')](_0x35dadb[_0x6402('0x47')][_0x6402('0x4d')]);_0x688f60[_0x6402('0x4e')]=qs[_0x6402('0x48')](_[_0x6402('0x4f')](_0x35dadb[_0x6402('0x47')],_0x39205d[_0x6402('0x48')]));if(_0x35dadb[_0x6402('0x47')][_0x6402('0x50')]){_0x688f60[_0x6402('0x4e')]=_[_0x6402('0x6b')](_0x688f60[_0x6402('0x4e')],{'$or':_[_0x6402('0x42')](_0x688f60[_0x6402('0x4b')],function(_0x2ab256){var _0x2967d9={};_0x2967d9[_0x2ab256]={'$like':'%'+_0x35dadb['query'][_0x6402('0x50')]+'%'};return _0x2967d9;})});}_0x688f60=_[_0x6402('0x6b')]({},_0x688f60,_0x35dadb[_0x6402('0x5a')]);return _0x3c9834[_0x6402('0xbf')](_0x688f60);}})['then'](function(_0x29d897){if(_0x29d897){_0x22c03d=_0x29d897[_0x6402('0x4c')];if(!_0x35dadb['query'][_0x6402('0x96')]('nolimit')){_0x688f60['limit']=qs[_0x6402('0x1f')](_0x35dadb['query'][_0x6402('0x1f')]);_0x688f60[_0x6402('0x1c')]=qs[_0x6402('0x1c')](_0x35dadb['query'][_0x6402('0x1c')]);}return _0x3c9834[_0x6402('0xbf')](_0x688f60);}})['then'](function(_0x290505){if(_0x290505){return _0x290505?{'count':_0x22c03d,'rows':_0x290505}:null;}})[_0x6402('0x11')](respondWithResult(_0x2d17eb,null))['catch'](handleError(_0x2d17eb,null));}; \ No newline at end of file +var _0x5737=['attachments','join','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','subject','YYYY-MM-DD\x20HH:mm:ss','out','messageId','Messages','verifySmtp','Sequelize','ValidationError','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','bluebird','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','MailAccounts','UserProfileResource','status','stack','name','send','gmail','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','hotmail','smtp-mail.outlook.com','smtp.office365.com','user','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerIn','Pause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','MailServerOut','mandatoryDispositionPause','find','body','provider','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','custom','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','CmContact','Contact','User','fullname','Tag','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','getApplications','length','getMessages','MailMessage','$gte','split','inlineCss','true','CmList','List','Contacts','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','format','%s\x20<%s>'];(function(_0x566a93,_0x1a33f9){var _0x591bec=function(_0x3d3a4a){while(--_0x3d3a4a){_0x566a93['push'](_0x566a93['shift']());}};_0x591bec(++_0x1a33f9);}(_0x5737,0xdb));var _0x7573=function(_0x1f9faf,_0x227808){_0x1f9faf=_0x1f9faf-0x0;var _0x13ab2c=_0x5737[_0x1f9faf];return _0x13ab2c;};'use strict';var moment=require('moment');var BPromise=require(_0x7573('0x0'));var util=require('util');var path=require(_0x7573('0x1'));var _=require(_0x7573('0x2'));var juice=require('juice');var Redis=require(_0x7573('0x3'));var qs=require(_0x7573('0x4'));var logger=require(_0x7573('0x5'))(_0x7573('0x6'));var config=require(_0x7573('0x7'));var db=require(_0x7573('0x8'))['db'];config[_0x7573('0x9')]=_[_0x7573('0xa')](config[_0x7573('0x9')],{'host':_0x7573('0xb'),'port':0x18eb});var socket=require(_0x7573('0xc'))(new Redis(config[_0x7573('0x9')]));require(_0x7573('0xd'))[_0x7573('0xe')](socket);var jayson=require(_0x7573('0xf'));var client=jayson[_0x7573('0x10')][_0x7573('0x11')]({'port':0x232b});function respondWithRpcPromise(_0xe068d9,_0x161abf,_0x96d291,_0x12f8ae){return new BPromise(function(_0x1bb9d9,_0x5ec15f){var _0x5ade1f=_0x12f8ae||client;return _0x5ade1f[_0x7573('0x12')](_0xe068d9,_0x96d291)['then'](function(_0x5ea8a0){logger[_0x7573('0x13')](_0x7573('0x14'),_0x161abf,_0x7573('0x15'));logger['debug'](_0x7573('0x16'),_0x161abf,_0x7573('0x15'),JSON['stringify'](_0x5ea8a0));if(_0x5ea8a0[_0x7573('0x17')]){if(_0x5ea8a0[_0x7573('0x17')]['code']===0x1f4){logger[_0x7573('0x17')](_0x7573('0x14'),_0x161abf,_0x5ea8a0[_0x7573('0x17')][_0x7573('0x18')]);return _0x5ec15f(_0x5ea8a0[_0x7573('0x17')][_0x7573('0x18')]);}logger[_0x7573('0x17')]('MailAccount,\x20%s,\x20%s',_0x161abf,_0x5ea8a0[_0x7573('0x17')]['message']);return _0x1bb9d9(_0x5ea8a0[_0x7573('0x17')]['message']);}else{logger[_0x7573('0x13')]('MailAccount,\x20%s,\x20%s',_0x161abf,_0x7573('0x15'));_0x1bb9d9(_0x5ea8a0['result'][_0x7573('0x18')]);}})[_0x7573('0x19')](function(_0x2a28e5){logger[_0x7573('0x17')]('MailAccount,\x20%s,\x20%s',_0x161abf,_0x2a28e5);_0x5ec15f(_0x2a28e5);});});}function respondWithStatusCode(_0x3f02bb,_0x37beba){_0x37beba=_0x37beba||0xcc;return function(_0x2b34fe){if(_0x2b34fe){return _0x3f02bb[_0x7573('0x1a')](_0x37beba);}return _0x3f02bb['status'](_0x37beba)[_0x7573('0x1b')]();};}function respondWithResult(_0x2edecf,_0x38a726){_0x38a726=_0x38a726||0xc8;return function(_0x5563ac){if(_0x5563ac){return _0x2edecf['status'](_0x38a726)[_0x7573('0x1c')](_0x5563ac);}};}function respondWithFilteredResult(_0x56ebd0,_0x12afdb){return function(_0x4bd189){if(_0x4bd189){var _0x583305=typeof _0x12afdb[_0x7573('0x1d')]===_0x7573('0x1e')&&typeof _0x12afdb[_0x7573('0x1f')]===_0x7573('0x1e');var _0x39b693=_0x4bd189[_0x7573('0x20')];var _0x600e3b=_0x583305?0x0:_0x12afdb[_0x7573('0x1d')];var _0x123318=_0x583305?_0x4bd189[_0x7573('0x20')]:_0x12afdb[_0x7573('0x1d')]+_0x12afdb[_0x7573('0x1f')];var _0x58fd45;if(_0x123318>=_0x39b693){_0x123318=_0x39b693;_0x58fd45=0xc8;}else{_0x58fd45=0xce;}_0x56ebd0['status'](_0x58fd45);return _0x56ebd0['set'](_0x7573('0x21'),_0x600e3b+'-'+_0x123318+'/'+_0x39b693)['json'](_0x4bd189);}return null;};}function saveUpdates(_0x31ee2c){return function(_0x17cac3){if(_0x17cac3){return _0x17cac3[_0x7573('0x22')](_0x31ee2c)[_0x7573('0x23')](function(_0x797467){return _0x797467;});}return null;};}function removeEntity(_0x334f11){return function(_0x420990){if(_0x420990){return _0x420990[_0x7573('0x24')]()[_0x7573('0x23')](function(){var _0x1fc0fe=_0x420990[_0x7573('0x25')]({'plain':!![]});var _0x58f8db=_0x7573('0x26');return db[_0x7573('0x27')][_0x7573('0x24')]({'where':{'type':_0x58f8db,'resourceId':_0x1fc0fe['id']}})[_0x7573('0x23')](function(){return _0x420990;});})[_0x7573('0x23')](function(){_0x334f11[_0x7573('0x28')](0xcc)[_0x7573('0x1b')]();});}};}function handleEntityNotFound(_0xf01b2){return function(_0x199825){if(!_0x199825){_0xf01b2[_0x7573('0x1a')](0x194);}return _0x199825;};}function handleError(_0x1a19cb,_0x5d1ae9){_0x5d1ae9=_0x5d1ae9||0x1f4;return function(_0x4e33e5){logger[_0x7573('0x17')](_0x4e33e5[_0x7573('0x29')]);if(_0x4e33e5[_0x7573('0x2a')]){delete _0x4e33e5[_0x7573('0x2a')];}_0x1a19cb[_0x7573('0x28')](_0x5d1ae9)[_0x7573('0x2b')](_0x4e33e5);};}function getImapHost(_0x418dd0){switch(_0x418dd0){case _0x7573('0x2c'):return'imap.gmail.com';case'yahoo':return _0x7573('0x2d');case'hotmail':return _0x7573('0x2e');case _0x7573('0x2f'):return _0x7573('0x30');}throw new Error(_0x7573('0x31'),_0x418dd0);}function getSmtpHost(_0x2ed87b){switch(_0x2ed87b){case _0x7573('0x2c'):return _0x7573('0x32');case'yahoo':return _0x7573('0x33');case _0x7573('0x34'):return _0x7573('0x35');case _0x7573('0x2f'):return _0x7573('0x36');}throw new Error('Unknown\x20email\x20service\x20provider',_0x2ed87b);}function getAuthenticationOptions(_0x21f78e,_0x11380d){var _0x5d0dff={};var _0x107f6e={};if(_0x21f78e){_0x5d0dff[_0x7573('0x37')]=_0x107f6e[_0x7573('0x37')]=_0x11380d['username'];_0x5d0dff[_0x7573('0x38')]=_0x107f6e[_0x7573('0x39')]=_0x11380d[_0x7573('0x38')];if(_0x11380d[_0x7573('0x3a')]){_0x5d0dff['modernAuthentication']=_0x107f6e[_0x7573('0x3a')]=!![];_0x5d0dff[_0x7573('0x3b')]=_0x107f6e['CloudProviderId']=_0x11380d[_0x7573('0x3b')];_0x5d0dff[_0x7573('0x38')]=_0x107f6e[_0x7573('0x39')]=null;}else{_0x5d0dff[_0x7573('0x3b')]=_0x107f6e[_0x7573('0x3b')]=null;}_0x5d0dff[_0x7573('0x3c')]=getImapHost(_0x21f78e);_0x5d0dff[_0x7573('0x3d')]=0x3e1;_0x107f6e[_0x7573('0x3c')]=getSmtpHost(_0x21f78e);_0x107f6e['port']=0x24b;_0x107f6e[_0x7573('0x3e')]=![];_0x5d0dff[_0x7573('0x3f')]=_0x107f6e['service']=null;}else{if(_0x11380d[_0x7573('0x40')]){_0x5d0dff[_0x7573('0x37')]=_0x107f6e[_0x7573('0x37')]=_0x11380d['username'];_0x5d0dff[_0x7573('0x38')]=_0x107f6e[_0x7573('0x39')]=_0x11380d[_0x7573('0x38')];}else{_0x5d0dff['authentication']=_0x107f6e['authentication']=![];_0x5d0dff['user']=_0x107f6e[_0x7573('0x37')]=null;_0x5d0dff[_0x7573('0x38')]=_0x107f6e[_0x7573('0x39')]=null;}_0x5d0dff['host']=_0x11380d[_0x7573('0x41')][_0x7573('0x3c')];_0x5d0dff['port']=_0x11380d[_0x7573('0x41')]['port'];_0x107f6e[_0x7573('0x3c')]=_0x11380d['Smtp'][_0x7573('0x3c')];_0x107f6e[_0x7573('0x3d')]=_0x11380d[_0x7573('0x42')]['port'];}return{'Imap':_0x5d0dff,'Smtp':_0x107f6e};}exports[_0x7573('0x43')]=function(_0x20af43,_0xae0e49){var _0xcd7a26={'include':[{'model':db[_0x7573('0x44')],'as':_0x7573('0x41')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x7573('0x45')],'as':'mandatoryDispositionPause'}]},_0x28f606={},_0xa8d068={'count':0x0,'rows':[]};var _0x1892d3=_[_0x7573('0x46')](db[_0x7573('0x47')][_0x7573('0x48')],function(_0x3226aa){return{'name':_0x3226aa[_0x7573('0x49')],'type':_0x3226aa[_0x7573('0x4a')][_0x7573('0x4b')]};});_0x28f606[_0x7573('0x4c')]=_['map'](_0x1892d3,_0x7573('0x2a'));_0x28f606[_0x7573('0x4d')]=_[_0x7573('0x4e')](_0x20af43['query']);_0x28f606[_0x7573('0x4f')]=_[_0x7573('0x50')](_0x28f606['model'],_0x28f606[_0x7573('0x4d')]);_0xcd7a26[_0x7573('0x51')]=_['intersection'](_0x28f606[_0x7573('0x4c')],qs[_0x7573('0x52')](_0x20af43['query'][_0x7573('0x52')]));_0xcd7a26[_0x7573('0x51')]=_0xcd7a26[_0x7573('0x51')]['length']?_0xcd7a26[_0x7573('0x51')]:_0x28f606['model'];if(!_0x20af43[_0x7573('0x4d')][_0x7573('0x53')]('nolimit')){_0xcd7a26[_0x7573('0x1f')]=qs[_0x7573('0x1f')](_0x20af43['query'][_0x7573('0x1f')]);_0xcd7a26['offset']=qs['offset'](_0x20af43[_0x7573('0x4d')][_0x7573('0x1d')]);}_0xcd7a26[_0x7573('0x54')]=qs[_0x7573('0x55')](_0x20af43[_0x7573('0x4d')]['sort']);_0xcd7a26[_0x7573('0x56')]=qs[_0x7573('0x4f')](_[_0x7573('0x57')](_0x20af43[_0x7573('0x4d')],_0x28f606[_0x7573('0x4f')]),_0x1892d3);if(_0x20af43['query'][_0x7573('0x58')]){_0xcd7a26[_0x7573('0x56')]=_[_0x7573('0x59')](_0xcd7a26[_0x7573('0x56')],{'$or':_[_0x7573('0x46')](_0x1892d3,function(_0x119de6){if(_0x119de6[_0x7573('0x4a')]!==_0x7573('0x5a')){var _0x26f39e={};_0x26f39e[_0x119de6['name']]={'$like':'%'+_0x20af43[_0x7573('0x4d')][_0x7573('0x58')]+'%'};return _0x26f39e;}})});}_0xcd7a26=_[_0x7573('0x59')]({},_0xcd7a26,_0x20af43[_0x7573('0x5b')]);var _0x52f31c={'where':_0xcd7a26[_0x7573('0x56')]};return db['MailAccount'][_0x7573('0x20')](_0x52f31c)[_0x7573('0x23')](function(_0x4a955d){_0xa8d068[_0x7573('0x20')]=_0x4a955d;if(_0x20af43[_0x7573('0x4d')][_0x7573('0x5c')]){_0xcd7a26[_0x7573('0x5d')]=[{'all':!![]}];}return db[_0x7573('0x47')][_0x7573('0x5e')](_0xcd7a26);})[_0x7573('0x23')](function(_0x5bdc17){_0xa8d068[_0x7573('0x5f')]=_0x5bdc17;return _0xa8d068;})[_0x7573('0x23')](respondWithFilteredResult(_0xae0e49,_0xcd7a26))['catch'](handleError(_0xae0e49,null));};exports[_0x7573('0x60')]=function(_0x202b5c,_0xc72617){var _0x335c03={'raw':![],'where':{'id':_0x202b5c[_0x7573('0x61')]['id']},'include':[{'model':db[_0x7573('0x44')],'as':'Imap'},{'model':db[_0x7573('0x62')],'as':_0x7573('0x42')},{'model':db['Pause'],'as':_0x7573('0x63')}]},_0x18c731={};_0x18c731[_0x7573('0x4c')]=_[_0x7573('0x4e')](db['MailAccount'][_0x7573('0x48')]);_0x18c731[_0x7573('0x4d')]=_['keys'](_0x202b5c[_0x7573('0x4d')]);_0x18c731[_0x7573('0x4f')]=_[_0x7573('0x50')](_0x18c731[_0x7573('0x4c')],_0x18c731[_0x7573('0x4d')]);_0x335c03[_0x7573('0x51')]=_['intersection'](_0x18c731[_0x7573('0x4c')],qs[_0x7573('0x52')](_0x202b5c[_0x7573('0x4d')][_0x7573('0x52')]));_0x335c03['attributes']=_0x335c03['attributes']['length']?_0x335c03[_0x7573('0x51')]:_0x18c731[_0x7573('0x4c')];if(_0x202b5c[_0x7573('0x4d')]['includeAll']){_0x335c03['include']=[{'all':!![]}];}_0x335c03=_[_0x7573('0x59')]({},_0x335c03,_0x202b5c[_0x7573('0x5b')]);return db[_0x7573('0x47')][_0x7573('0x64')](_0x335c03)[_0x7573('0x23')](handleEntityNotFound(_0xc72617,null))[_0x7573('0x23')](respondWithResult(_0xc72617,null))[_0x7573('0x19')](handleError(_0xc72617,null));};exports['update']=function(_0x116211,_0x2675e3){if(_0x116211[_0x7573('0x65')]['id']){delete _0x116211[_0x7573('0x65')]['id'];}var _0x19e060=_0x116211['body'][_0x7573('0x66')]==='custom'?null:_0x116211[_0x7573('0x65')][_0x7573('0x66')];var _0x22a93e=_0x116211[_0x7573('0x65')][_0x7573('0x41')]||{};var _0x354985=_0x116211['body']['Smtp']||{};if(_0x19e060){_0x22a93e[_0x7573('0x3c')]=getImapHost(_0x19e060);_0x22a93e[_0x7573('0x3d')]=0x3e1;_0x354985[_0x7573('0x3c')]=getSmtpHost(_0x19e060);_0x354985[_0x7573('0x3d')]=0x24b;_0x354985[_0x7573('0x3e')]=![];}if(_0x354985['modernAuthentication']){_0x354985['secure']=![];}else{_0x354985[_0x7573('0x3b')]=null;}if(!_0x22a93e['modernAuthentication'])_0x22a93e[_0x7573('0x3b')]=null;_0x116211[_0x7573('0x65')][_0x7573('0x41')]=_0x22a93e;_0x116211['body'][_0x7573('0x42')]=_0x354985;return db[_0x7573('0x47')][_0x7573('0x64')]({'where':{'id':_0x116211[_0x7573('0x61')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x7573('0x41')},{'model':db['MailServerOut'],'as':_0x7573('0x42')},{'model':db[_0x7573('0x45')],'as':'mandatoryDispositionPause'}]})[_0x7573('0x23')](handleEntityNotFound(_0x2675e3,null))[_0x7573('0x23')](function(_0x535b3f){if(!_0x535b3f)throw new Error(_0x7573('0x67'));if(_0x535b3f[_0x7573('0x3f')])delete _0x116211[_0x7573('0x65')][_0x7573('0x41')];return _0x535b3f;})[_0x7573('0x23')](saveUpdates(_0x116211['body'],null))[_0x7573('0x23')](function(_0x1528fb){if(!_0x116211[_0x7573('0x65')][_0x7573('0x41')])return _0x1528fb;return db['MailServerIn'][_0x7573('0x22')](_0x116211[_0x7573('0x65')]['Imap'],{'where':{'MailAccountId':_0x1528fb['id']}})['then'](function(){return _0x1528fb;});})['then'](function(_0x1fedf3){if(!_0x116211[_0x7573('0x65')][_0x7573('0x42')])return _0x1fedf3;return db['MailServerOut'][_0x7573('0x22')](_0x116211[_0x7573('0x65')]['Smtp'],{'where':{'MailAccountId':_0x1fedf3['id']}})[_0x7573('0x23')](function(){return _0x1fedf3;});})['then'](respondWithResult(_0x2675e3,null))[_0x7573('0x19')](handleError(_0x2675e3,null));};exports[_0x7573('0x68')]=function(_0x5f3199,_0x343881){return db[_0x7573('0x47')][_0x7573('0x68')]()[_0x7573('0x23')](respondWithResult(_0x343881,null))['catch'](handleError(_0x343881,null));};exports[_0x7573('0x69')]=function(_0xb3db6f,_0x391f76){if(_0xb3db6f[_0x7573('0x65')]['id']){delete _0xb3db6f[_0x7573('0x65')]['id'];}return db[_0x7573('0x47')]['find']({'where':{'id':_0xb3db6f[_0x7573('0x61')]['id']}})[_0x7573('0x23')](handleEntityNotFound(_0x391f76,null))[_0x7573('0x23')](function(_0x1d6761){if(_0x1d6761){_0xb3db6f['body'][_0x7573('0x6a')]=_0x1d6761['id'];return db[_0x7573('0x6b')][_0x7573('0x6c')](_0xb3db6f['body']);}})[_0x7573('0x23')](respondWithResult(_0x391f76,null))[_0x7573('0x19')](handleError(_0x391f76,null));};exports[_0x7573('0x6d')]=function(_0x319e18,_0x2e4a7f){var _0x470016={'raw':![],'where':{}};var _0x4b6b49={};var _0x48b0ac={'count':0x0,'rows':[]};return db[_0x7573('0x47')][_0x7573('0x6e')]({'where':{'id':_0x319e18[_0x7573('0x61')]['id']}})[_0x7573('0x23')](handleEntityNotFound(_0x2e4a7f,null))[_0x7573('0x23')](function(_0x39fa0e){if(_0x39fa0e){_0x4b6b49[_0x7573('0x4c')]=_['keys'](db['Disposition'][_0x7573('0x48')]);_0x4b6b49['query']=_[_0x7573('0x4e')](_0x319e18['query']);_0x4b6b49[_0x7573('0x4f')]=_[_0x7573('0x50')](_0x4b6b49[_0x7573('0x4c')],_0x4b6b49[_0x7573('0x4d')]);_0x470016[_0x7573('0x51')]=_[_0x7573('0x50')](_0x4b6b49[_0x7573('0x4c')],qs[_0x7573('0x52')](_0x319e18[_0x7573('0x4d')][_0x7573('0x52')]));_0x470016[_0x7573('0x51')]=_0x470016['attributes']['length']?_0x470016[_0x7573('0x51')]:_0x4b6b49[_0x7573('0x4c')];if(!_0x319e18[_0x7573('0x4d')][_0x7573('0x53')]('nolimit')){_0x470016[_0x7573('0x1f')]=qs[_0x7573('0x1f')](_0x319e18[_0x7573('0x4d')][_0x7573('0x1f')]);_0x470016['offset']=qs[_0x7573('0x1d')](_0x319e18[_0x7573('0x4d')][_0x7573('0x1d')]);}_0x470016[_0x7573('0x54')]=qs['sort'](_0x319e18[_0x7573('0x4d')][_0x7573('0x55')]);_0x470016[_0x7573('0x56')]=qs[_0x7573('0x4f')](_[_0x7573('0x57')](_0x319e18[_0x7573('0x4d')],_0x4b6b49[_0x7573('0x4f')]));_0x470016[_0x7573('0x56')][_0x7573('0x6a')]=_0x39fa0e['id'];if(_0x319e18['query'][_0x7573('0x58')]){_0x470016[_0x7573('0x56')]=_[_0x7573('0x59')](_0x470016[_0x7573('0x56')],{'$or':_[_0x7573('0x46')](_0x470016[_0x7573('0x51')],function(_0x6f8eee){var _0x5e858f={};_0x5e858f[_0x6f8eee]={'$like':'%'+_0x319e18[_0x7573('0x4d')]['filter']+'%'};return _0x5e858f;})});}_0x470016=_[_0x7573('0x59')]({},_0x470016,_0x319e18['options']);return db[_0x7573('0x6b')][_0x7573('0x20')]({'where':_0x470016['where']})['then'](function(_0x3ef5e1){_0x48b0ac['count']=_0x3ef5e1;if(_0x319e18['query'][_0x7573('0x5c')]){_0x470016[_0x7573('0x5d')]=[{'all':!![]}];}return db[_0x7573('0x6b')][_0x7573('0x5e')](_0x470016);})[_0x7573('0x23')](function(_0x32380d){_0x48b0ac[_0x7573('0x5f')]=_0x32380d;return _0x48b0ac;});}})[_0x7573('0x23')](respondWithFilteredResult(_0x2e4a7f,_0x470016))[_0x7573('0x19')](handleError(_0x2e4a7f,null));};exports[_0x7573('0x6f')]=function(_0x4c55f7,_0xbb91e7){return db[_0x7573('0x47')][_0x7573('0x64')]({'where':{'id':_0x4c55f7[_0x7573('0x61')]['id']}})[_0x7573('0x23')](handleEntityNotFound(_0xbb91e7,null))['then'](function(_0x57e04d){if(_0x57e04d){return _0x57e04d[_0x7573('0x6f')](_0x4c55f7[_0x7573('0x4d')][_0x7573('0x70')]);}})[_0x7573('0x23')](respondWithStatusCode(_0xbb91e7,null))[_0x7573('0x19')](handleError(_0xbb91e7,null));};exports[_0x7573('0x71')]=function(_0x511e03,_0x2f4419){if(_0x511e03[_0x7573('0x65')]['id']){delete _0x511e03[_0x7573('0x65')]['id'];}return db['MailAccount'][_0x7573('0x64')]({'where':{'id':_0x511e03[_0x7573('0x61')]['id']}})[_0x7573('0x23')](handleEntityNotFound(_0x2f4419,null))[_0x7573('0x23')](function(_0x41c646){if(_0x41c646){_0x511e03[_0x7573('0x65')][_0x7573('0x6a')]=_0x41c646['id'];return db[_0x7573('0x72')][_0x7573('0x6c')](_0x511e03['body']);}})[_0x7573('0x23')](respondWithResult(_0x2f4419,null))[_0x7573('0x19')](handleError(_0x2f4419,null));};exports[_0x7573('0x73')]=function(_0x4fb9cf,_0x2082ec){var _0x4ef6ff={'raw':![],'where':{}};var _0x5db87b={};var _0x292936={'count':0x0,'rows':[]};return db[_0x7573('0x47')][_0x7573('0x6e')]({'where':{'id':_0x4fb9cf['params']['id']}})[_0x7573('0x23')](handleEntityNotFound(_0x2082ec,null))[_0x7573('0x23')](function(_0x1311fc){if(_0x1311fc){_0x5db87b[_0x7573('0x4c')]=_[_0x7573('0x4e')](db['CannedAnswer'][_0x7573('0x48')]);_0x5db87b[_0x7573('0x4d')]=_[_0x7573('0x4e')](_0x4fb9cf[_0x7573('0x4d')]);_0x5db87b[_0x7573('0x4f')]=_[_0x7573('0x50')](_0x5db87b[_0x7573('0x4c')],_0x5db87b['query']);_0x4ef6ff[_0x7573('0x51')]=_[_0x7573('0x50')](_0x5db87b['model'],qs[_0x7573('0x52')](_0x4fb9cf[_0x7573('0x4d')]['fields']));_0x4ef6ff['attributes']=_0x4ef6ff[_0x7573('0x51')]['length']?_0x4ef6ff[_0x7573('0x51')]:_0x5db87b[_0x7573('0x4c')];if(!_0x4fb9cf[_0x7573('0x4d')][_0x7573('0x53')](_0x7573('0x74'))){_0x4ef6ff['limit']=qs[_0x7573('0x1f')](_0x4fb9cf['query']['limit']);_0x4ef6ff[_0x7573('0x1d')]=qs[_0x7573('0x1d')](_0x4fb9cf[_0x7573('0x4d')]['offset']);}_0x4ef6ff[_0x7573('0x54')]=qs['sort'](_0x4fb9cf[_0x7573('0x4d')][_0x7573('0x55')]);_0x4ef6ff[_0x7573('0x56')]=qs[_0x7573('0x4f')](_[_0x7573('0x57')](_0x4fb9cf[_0x7573('0x4d')],_0x5db87b[_0x7573('0x4f')]));_0x4ef6ff[_0x7573('0x56')][_0x7573('0x6a')]=_0x1311fc['id'];if(_0x4fb9cf['query'][_0x7573('0x58')]){_0x4ef6ff[_0x7573('0x56')]=_[_0x7573('0x59')](_0x4ef6ff[_0x7573('0x56')],{'$or':_['map'](_0x4ef6ff[_0x7573('0x51')],function(_0x4437eb){var _0x41ade9={};_0x41ade9[_0x4437eb]={'$like':'%'+_0x4fb9cf[_0x7573('0x4d')]['filter']+'%'};return _0x41ade9;})});}_0x4ef6ff=_[_0x7573('0x59')]({},_0x4ef6ff,_0x4fb9cf[_0x7573('0x5b')]);return db[_0x7573('0x72')]['count']({'where':_0x4ef6ff['where']})[_0x7573('0x23')](function(_0x5def94){_0x292936[_0x7573('0x20')]=_0x5def94;if(_0x4fb9cf[_0x7573('0x4d')][_0x7573('0x5c')]){_0x4ef6ff[_0x7573('0x5d')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x4ef6ff);})[_0x7573('0x23')](function(_0x36ce3c){_0x292936['rows']=_0x36ce3c;return _0x292936;});}})['then'](respondWithFilteredResult(_0x2082ec,_0x4ef6ff))[_0x7573('0x19')](handleError(_0x2082ec,null));};exports[_0x7573('0x75')]=function(_0x325393,_0x4b894f){return db['MailAccount']['find']({'where':{'id':_0x325393['params']['id']}})[_0x7573('0x23')](handleEntityNotFound(_0x4b894f,null))[_0x7573('0x23')](function(_0x301937){if(_0x301937){return _0x301937[_0x7573('0x75')](_0x325393[_0x7573('0x4d')]['ids']);}})[_0x7573('0x23')](respondWithStatusCode(_0x4b894f,null))[_0x7573('0x19')](handleError(_0x4b894f,null));};exports['create']=function(_0x11a6a3,_0x216df){var _0xe6bd3a={'name':_0x11a6a3[_0x7573('0x65')][_0x7573('0x2a')],'key':_0x11a6a3[_0x7573('0x65')][_0x7573('0x4b')],'provider':_0x11a6a3[_0x7573('0x65')][_0x7573('0x66')]===_0x7573('0x76')?null:_0x11a6a3[_0x7573('0x65')][_0x7573('0x66')],'email':_0x11a6a3[_0x7573('0x65')][_0x7573('0x77')],'ListId':_0x11a6a3['body'][_0x7573('0x78')],'active':!_[_0x7573('0x79')](_0x11a6a3['body'][_0x7573('0x7a')])?_0x11a6a3[_0x7573('0x65')][_0x7573('0x7a')]:!![],'description':_0x11a6a3['body'][_0x7573('0x7b')]||null};var _0x4b7632=getAuthenticationOptions(_0xe6bd3a[_0x7573('0x66')],_0x11a6a3[_0x7573('0x65')]);_0xe6bd3a[_0x7573('0x41')]=_0x4b7632[_0x7573('0x41')];_0xe6bd3a['Smtp']=_0x4b7632[_0x7573('0x42')];return db['MailAccount'][_0x7573('0x6c')](_0xe6bd3a,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x7573('0x44')],'as':_0x7573('0x41')}]})[_0x7573('0x23')](function(_0x64b1e7){var _0x1c6047=_0x11a6a3[_0x7573('0x37')][_0x7573('0x25')]({'plain':!![]});if(!_0x1c6047)throw new Error(_0x7573('0x7c'));if(_0x1c6047['role']===_0x7573('0x37')){var _0x116bfb=_0x64b1e7[_0x7573('0x25')]({'plain':!![]});return db['UserProfileSection'][_0x7573('0x64')]({'where':{'name':_0x7573('0x26'),'userProfileId':_0x1c6047[_0x7573('0x7d')]},'raw':!![]})[_0x7573('0x23')](function(_0x22a75c){if(_0x22a75c&&_0x22a75c[_0x7573('0x7e')]===0x0){return db[_0x7573('0x27')][_0x7573('0x6c')]({'name':_0x116bfb['name'],'resourceId':_0x116bfb['id'],'type':_0x22a75c['name'],'sectionId':_0x22a75c['id']},{})[_0x7573('0x23')](function(){return _0x64b1e7;});}else{return _0x64b1e7;}})[_0x7573('0x19')](function(_0x3addae){logger[_0x7573('0x17')](_0x7573('0x7f'),_0x3addae);throw _0x3addae;});}return _0x64b1e7;})['then'](respondWithResult(_0x216df,0xc9))[_0x7573('0x19')](handleError(_0x216df,null));};exports[_0x7573('0x80')]=function(_0x247ebe,_0x54b4f7){return db['MailAccount']['findOne']({'where':{'id':_0x247ebe['params']['id']}})[_0x7573('0x23')](handleEntityNotFound(_0x54b4f7,null))[_0x7573('0x23')](function(_0x5248a1){if(_0x5248a1){return _0x5248a1['getImap']();}return null;})[_0x7573('0x23')](respondWithResult(_0x54b4f7,null))[_0x7573('0x19')](handleError(_0x54b4f7,null));};exports['addImap']=function(_0x292425,_0x1aede3){if(_0x292425[_0x7573('0x65')]['id']){delete _0x292425[_0x7573('0x65')]['id'];}return db[_0x7573('0x47')]['find']({'where':{'id':_0x292425['params']['id']}})['then'](handleEntityNotFound(_0x1aede3,null))['then'](function(_0xcca372){if(_0xcca372){_0x292425['body']['MailAccountId']=_0xcca372['id'];return db['MailServerIn'][_0x7573('0x6c')](_0x292425[_0x7573('0x65')]);}})['then'](respondWithResult(_0x1aede3,null))[_0x7573('0x19')](handleError(_0x1aede3,null));};exports[_0x7573('0x81')]=function(_0x1763b3,_0x51671f){return db[_0x7573('0x47')][_0x7573('0x6e')]({'where':{'id':_0x1763b3[_0x7573('0x61')]['id']}})[_0x7573('0x23')](handleEntityNotFound(_0x51671f,null))[_0x7573('0x23')](function(_0x371eb2){if(_0x371eb2){return _0x371eb2[_0x7573('0x82')](null);}return null;})[_0x7573('0x23')](respondWithStatusCode(_0x51671f,null))['catch'](handleError(_0x51671f,null));};exports[_0x7573('0x83')]=function(_0x15e68c,_0x545d17){return db[_0x7573('0x47')]['findOne']({'where':{'id':_0x15e68c['params']['id']}})[_0x7573('0x23')](handleEntityNotFound(_0x545d17,null))['then'](function(_0xfe3015){if(_0xfe3015){return _0xfe3015[_0x7573('0x83')]();}return null;})[_0x7573('0x23')](respondWithResult(_0x545d17,null))[_0x7573('0x19')](handleError(_0x545d17,null));};exports['addSmtp']=function(_0x245642,_0x130032){if(_0x245642[_0x7573('0x65')]['id']){delete _0x245642[_0x7573('0x65')]['id'];}return db['MailAccount'][_0x7573('0x64')]({'where':{'id':_0x245642[_0x7573('0x61')]['id']}})[_0x7573('0x23')](handleEntityNotFound(_0x130032,null))['then'](function(_0x318fdc){if(_0x318fdc){_0x245642[_0x7573('0x65')][_0x7573('0x6a')]=_0x318fdc['id'];return db['MailServerOut'][_0x7573('0x6c')](_0x245642['body']);}})[_0x7573('0x23')](respondWithResult(_0x130032,null))[_0x7573('0x19')](handleError(_0x130032,null));};exports[_0x7573('0x84')]=function(_0x3d56ee,_0x3a75ce){return db[_0x7573('0x47')]['findOne']({'where':{'id':_0x3d56ee['params']['id']}})[_0x7573('0x23')](handleEntityNotFound(_0x3a75ce,null))[_0x7573('0x23')](function(_0x26b5d9){if(_0x26b5d9){return _0x26b5d9[_0x7573('0x85')](null);}return null;})[_0x7573('0x23')](respondWithStatusCode(_0x3a75ce,null))['catch'](handleError(_0x3a75ce,null));};exports['addInteraction']=function(_0xb26617,_0x26f226){return db[_0x7573('0x86')][_0x7573('0x64')]({'where':{'id':_0xb26617[_0x7573('0x61')]['id']}})[_0x7573('0x23')](handleEntityNotFound(_0x26f226,null))[_0x7573('0x23')](function(_0x40e459){if(_0x40e459){return _0x40e459[_0x7573('0x87')](_0xb26617[_0x7573('0x65')][_0x7573('0x70')],_[_0x7573('0x88')](_0xb26617[_0x7573('0x65')],[_0x7573('0x70'),'id'])||{});}})[_0x7573('0x23')](respondWithResult(_0x26f226,null))['catch'](handleError(_0x26f226,null));};exports['getInteractions']=function(_0x3fd0c2,_0x25c053){var _0x237f04={'raw':![],'where':{}};var _0x1e06f9={};var _0x965007={'count':0x0,'rows':[]};return db[_0x7573('0x47')][_0x7573('0x6e')]({'where':{'id':_0x3fd0c2[_0x7573('0x61')]['id']}})['then'](handleEntityNotFound(_0x25c053,null))['then'](function(_0xf96461){if(_0xf96461){_0x1e06f9[_0x7573('0x4c')]=_[_0x7573('0x4e')](db[_0x7573('0x86')][_0x7573('0x48')]);_0x1e06f9[_0x7573('0x4d')]=_[_0x7573('0x4e')](_0x3fd0c2['query']);_0x1e06f9[_0x7573('0x4f')]=_['intersection'](_0x1e06f9['model'],_0x1e06f9['query']);_0x237f04['attributes']=_[_0x7573('0x50')](_0x1e06f9[_0x7573('0x4c')],qs['fields'](_0x3fd0c2[_0x7573('0x4d')]['fields']));_0x237f04['attributes']=_0x237f04[_0x7573('0x51')]['length']?_0x237f04['attributes']:_0x1e06f9[_0x7573('0x4c')];if(!_0x3fd0c2[_0x7573('0x4d')][_0x7573('0x53')](_0x7573('0x74'))){_0x237f04[_0x7573('0x1f')]=qs[_0x7573('0x1f')](_0x3fd0c2[_0x7573('0x4d')][_0x7573('0x1f')]);_0x237f04[_0x7573('0x1d')]=qs['offset'](_0x3fd0c2[_0x7573('0x4d')][_0x7573('0x1d')]);}_0x237f04[_0x7573('0x54')]=qs[_0x7573('0x55')](_0x3fd0c2[_0x7573('0x4d')][_0x7573('0x55')]);_0x237f04['where']=qs[_0x7573('0x4f')](_['pick'](_0x3fd0c2[_0x7573('0x4d')],_0x1e06f9[_0x7573('0x4f')]));_0x237f04[_0x7573('0x56')][_0x7573('0x6a')]=_0xf96461['id'];if(_0x3fd0c2[_0x7573('0x4d')][_0x7573('0x58')]){_0x237f04[_0x7573('0x56')]=_[_0x7573('0x59')](_0x237f04[_0x7573('0x56')],{'$or':_[_0x7573('0x46')](_0x237f04[_0x7573('0x51')],function(_0x6510df){var _0x50d514={};_0x50d514[_0x6510df]={'$like':'%'+_0x3fd0c2['query'][_0x7573('0x58')]+'%'};return _0x50d514;})});}_0x237f04=_['merge']({},_0x237f04,_0x3fd0c2[_0x7573('0x5b')]);return db[_0x7573('0x86')][_0x7573('0x20')]({'where':_0x237f04[_0x7573('0x56')]})[_0x7573('0x23')](function(_0x1ba9ee){_0x965007[_0x7573('0x20')]=_0x1ba9ee;if(_0x3fd0c2[_0x7573('0x4d')][_0x7573('0x5c')]){_0x237f04[_0x7573('0x5d')]=[{'model':db[_0x7573('0x89')],'as':_0x7573('0x8a'),'required':![]},{'model':db[_0x7573('0x8b')],'as':'Owner','attributes':[_0x7573('0x2a'),_0x7573('0x8c'),'internal'],'required':![]},{'model':db[_0x7573('0x8d')],'as':'Tags','attributes':['id',_0x7573('0x2a'),_0x7573('0x8e')],'where':_0x3fd0c2['query']['tag']?{'id':_0x3fd0c2['query'][_0x7573('0x8f')]}:undefined,'required':_0x3fd0c2[_0x7573('0x4d')][_0x7573('0x8f')]?!![]:![]}];}return db[_0x7573('0x86')][_0x7573('0x5e')](_0x237f04);})[_0x7573('0x23')](function(_0x6605c6){_0x965007[_0x7573('0x5f')]=_0x6605c6;return _0x965007;});}})[_0x7573('0x23')](respondWithFilteredResult(_0x25c053,_0x237f04))[_0x7573('0x19')](handleError(_0x25c053,null));};exports[_0x7573('0x90')]=function addApplications(_0x24581d,_0x3054a4){var _0x20bf54=_0x24581d[_0x7573('0x61')]['id'];var _0x1040ff=_0x24581d['body'];var _0x1b436c=0xc8;var _0x2e9f77=null;return db[_0x7573('0x91')][_0x7573('0x92')]({'isolationLevel':db[_0x7573('0x91')][_0x7573('0x93')][_0x7573('0x94')][_0x7573('0x95')]},function(_0x1c03ef){return db[_0x7573('0x47')][_0x7573('0x6e')]({'where':{'id':_0x20bf54},'transaction':_0x1c03ef})[_0x7573('0x23')](function(_0x456edc){if(_0x456edc){return db[_0x7573('0x96')][_0x7573('0x24')]({'where':{'MailAccountId':_0x20bf54},'transaction':_0x1c03ef})[_0x7573('0x23')](function(){var _0x999c2=_['map'](_0x1040ff,function(_0x2de09d){_0x2de09d['MailAccountId']=_0x20bf54;return _0x2de09d;});return db[_0x7573('0x96')]['bulkCreate'](_0x999c2,{'transaction':_0x1c03ef});});}else{_0x1b436c=0x194;_0x2e9f77=[];}});})[_0x7573('0x23')](function(){if(_0x1b436c!==0x194){return db[_0x7573('0x96')][_0x7573('0x97')]({'where':{'MailAccountId':_0x20bf54},'order':_0x7573('0x98')})['then'](function(_0x1d9530){_0x2e9f77=_0x1d9530;});}})[_0x7573('0x19')](function(_0x36a177){_0x1b436c=0x1f4;logger[_0x7573('0x17')](_0x36a177['stack']);if(_0x36a177[_0x7573('0x2a')]){delete _0x36a177[_0x7573('0x2a')];}_0x2e9f77=_0x36a177;})[_0x7573('0x99')](function(){if(_0x2e9f77===null){_0x3054a4[_0x7573('0x1a')](_0x1b436c);}else{if(_0x1b436c===0x1f4){_0x3054a4[_0x7573('0x28')](_0x1b436c)[_0x7573('0x2b')](_0x2e9f77);}else{_0x3054a4[_0x7573('0x28')](_0x1b436c)[_0x7573('0x1c')](_0x2e9f77);}}});};exports[_0x7573('0x9a')]=function(_0xf51fcd,_0x2f59ce){var _0x38f2ca={};var _0x1dcc52={};var _0xb6f331;var _0x224498;return db[_0x7573('0x47')][_0x7573('0x6e')]({'where':{'id':_0xf51fcd[_0x7573('0x61')]['id']}})[_0x7573('0x23')](handleEntityNotFound(_0x2f59ce,null))[_0x7573('0x23')](function(_0x5845a2){if(_0x5845a2){_0xb6f331=_0x5845a2;_0x1dcc52['model']=_[_0x7573('0x4e')](db[_0x7573('0x96')][_0x7573('0x48')]);_0x1dcc52[_0x7573('0x4d')]=_[_0x7573('0x4e')](_0xf51fcd[_0x7573('0x4d')]);_0x1dcc52[_0x7573('0x4f')]=_['intersection'](_0x1dcc52['model'],_0x1dcc52[_0x7573('0x4d')]);_0x38f2ca[_0x7573('0x51')]=_[_0x7573('0x50')](_0x1dcc52['model'],qs[_0x7573('0x52')](_0xf51fcd['query'][_0x7573('0x52')]));_0x38f2ca[_0x7573('0x51')]=_0x38f2ca[_0x7573('0x51')]['length']?_0x38f2ca[_0x7573('0x51')]:_0x1dcc52['model'];_0x38f2ca[_0x7573('0x54')]=qs['sort'](_0xf51fcd[_0x7573('0x4d')][_0x7573('0x55')]);_0x38f2ca['where']=qs[_0x7573('0x4f')](_[_0x7573('0x57')](_0xf51fcd['query'],_0x1dcc52[_0x7573('0x4f')]));if(_0xf51fcd[_0x7573('0x4d')][_0x7573('0x58')]){_0x38f2ca[_0x7573('0x56')]=_[_0x7573('0x59')](_0x38f2ca[_0x7573('0x56')],{'$or':_[_0x7573('0x46')](_0x38f2ca[_0x7573('0x51')],function(_0x3b2aef){var _0x211ef8={};_0x211ef8[_0x3b2aef]={'$like':'%'+_0xf51fcd[_0x7573('0x4d')][_0x7573('0x58')]+'%'};return _0x211ef8;})});}_0x38f2ca=_[_0x7573('0x59')]({},_0x38f2ca,_0xf51fcd['options']);return _0xb6f331[_0x7573('0x9a')](_0x38f2ca);}})[_0x7573('0x23')](function(_0x15209e){if(_0x15209e){_0x224498=_0x15209e[_0x7573('0x9b')];if(!_0xf51fcd['query'][_0x7573('0x53')](_0x7573('0x74'))){_0x38f2ca[_0x7573('0x1f')]=qs[_0x7573('0x1f')](_0xf51fcd[_0x7573('0x4d')]['limit']);_0x38f2ca[_0x7573('0x1d')]=qs[_0x7573('0x1d')](_0xf51fcd[_0x7573('0x4d')][_0x7573('0x1d')]);}return _0xb6f331[_0x7573('0x9a')](_0x38f2ca);}})[_0x7573('0x23')](function(_0x58c1b4){if(_0x58c1b4){return _0x58c1b4?{'count':_0x224498,'rows':_0x58c1b4}:null;}})[_0x7573('0x23')](respondWithResult(_0x2f59ce,null))['catch'](handleError(_0x2f59ce,null));};exports[_0x7573('0x9c')]=function(_0x1244db,_0x3c766f){var _0x226c9b={'raw':!![],'where':{}};var _0x9dddc3={};var _0x2b1990={'count':0x0,'rows':[]};return db[_0x7573('0x47')][_0x7573('0x6e')]({'where':{'id':_0x1244db[_0x7573('0x61')]['id']}})[_0x7573('0x23')](handleEntityNotFound(_0x3c766f,null))[_0x7573('0x23')](function(_0x1895bc){if(_0x1895bc){_0x9dddc3[_0x7573('0x4c')]=_[_0x7573('0x4e')](db[_0x7573('0x9d')]['rawAttributes']);_0x9dddc3[_0x7573('0x4d')]=_['keys'](_0x1244db[_0x7573('0x4d')]);_0x9dddc3[_0x7573('0x4f')]=_[_0x7573('0x50')](_0x9dddc3[_0x7573('0x4c')],_0x9dddc3[_0x7573('0x4d')]);_0x226c9b[_0x7573('0x51')]=_[_0x7573('0x50')](_0x9dddc3[_0x7573('0x4c')],qs[_0x7573('0x52')](_0x1244db[_0x7573('0x4d')][_0x7573('0x52')]));_0x226c9b[_0x7573('0x51')]=_0x226c9b[_0x7573('0x51')][_0x7573('0x9b')]?_0x226c9b[_0x7573('0x51')]:_0x9dddc3[_0x7573('0x4c')];if(!_0x1244db[_0x7573('0x4d')][_0x7573('0x53')](_0x7573('0x74'))){_0x226c9b[_0x7573('0x1f')]=qs[_0x7573('0x1f')](_0x1244db['query'][_0x7573('0x1f')]);_0x226c9b[_0x7573('0x1d')]=qs[_0x7573('0x1d')](_0x1244db[_0x7573('0x4d')]['offset']);}_0x226c9b[_0x7573('0x54')]=qs[_0x7573('0x55')](_0x1244db[_0x7573('0x4d')]['sort']);_0x226c9b[_0x7573('0x56')]=qs[_0x7573('0x4f')](_[_0x7573('0x57')](_0x1244db[_0x7573('0x4d')],_0x9dddc3[_0x7573('0x4f')]));_0x226c9b[_0x7573('0x56')][_0x7573('0x6a')]=_0x1895bc['id'];if(_0x1244db[_0x7573('0x4d')][_0x7573('0x58')]){_0x226c9b['where']=_['merge'](_0x226c9b['where'],{'$or':_['map'](_0x226c9b[_0x7573('0x51')],function(_0x312a34){var _0xefe47c={};_0xefe47c[_0x312a34]={'$like':'%'+_0x1244db[_0x7573('0x4d')][_0x7573('0x58')]+'%'};return _0xefe47c;})});}if(_0x1244db[_0x7573('0x4d')][_0x7573('0x9e')]){var _0x677f96=_0x1244db['query']['$gte'][_0x7573('0x9f')](',');var _0x7eac5f={};_0x7eac5f[_0x677f96[0x0]]={'$gte':moment(_0x677f96[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x226c9b[_0x7573('0x56')]=_[_0x7573('0x59')](_0x226c9b['where'],_0x7eac5f);}_0x226c9b=_[_0x7573('0x59')]({},_0x226c9b,_0x1244db[_0x7573('0x5b')]);return db['MailMessage']['count']({'where':_0x226c9b[_0x7573('0x56')]})[_0x7573('0x23')](function(_0x59d0ea){_0x2b1990[_0x7573('0x20')]=_0x59d0ea;if(_0x1244db[_0x7573('0x4d')][_0x7573('0x5c')]){_0x226c9b['include']=[{'all':!![]}];}return db[_0x7573('0x9d')][_0x7573('0x5e')](_0x226c9b);})[_0x7573('0x23')](function(_0x419a85){if(_0x1244db['query'][_0x7573('0xa0')]===_0x7573('0xa1')){for(var _0x3af2bc=0x0;_0x3af2bc<_0x419a85[_0x7573('0x9b')];_0x3af2bc++){_0x419a85[_0x3af2bc][_0x7573('0x65')]=juice(_0x419a85[_0x3af2bc][_0x7573('0x65')]);}}_0x2b1990[_0x7573('0x5f')]=_0x419a85;return _0x2b1990;});}})[_0x7573('0x23')](respondWithFilteredResult(_0x3c766f,_0x226c9b))[_0x7573('0x19')](handleError(_0x3c766f,null));};exports[_0x7573('0x2b')]=function(_0x2af8f3,_0x3c1565){var _0x38601c,_0x340223={},_0x5d15e8;if(_0x2af8f3[_0x7573('0x65')]['to']){_0x5d15e8=_0x2af8f3[_0x7573('0x65')]['to']['split'](',')[0x0];}return db[_0x7573('0x47')][_0x7573('0x64')]({'where':{'id':_0x2af8f3[_0x7573('0x61')]['id']},'include':[{'model':db[_0x7573('0xa2')],'as':_0x7573('0xa3'),'include':[{'model':db[_0x7573('0x89')],'as':_0x7573('0xa4'),'where':{'email':_0x5d15e8},'limit':0x1,'order':[['updatedAt',_0x7573('0xa5')]]}]},{'model':db[_0x7573('0x62')],'as':_0x7573('0x42'),'raw':!![],'include':[{'model':db[_0x7573('0xa6')],'as':_0x7573('0xa6'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3c1565,null))['then'](function(_0x21e51c){if(!_0x21e51c)return;_0x38601c=_0x21e51c;if(!_0x21e51c[_0x7573('0x42')])throw new Error(_0x7573('0xa7'));if(_[_0x7573('0x79')](_0x2af8f3['body'][_0x7573('0xa8')])){_0x2af8f3['body'][_0x7573('0xa8')]=util[_0x7573('0xa9')](_0x7573('0xaa'),_0x21e51c[_0x7573('0x2a')],_0x21e51c[_0x7573('0x77')]||_0x21e51c['Smtp'][_0x7573('0x37')]);}if(_0x2af8f3[_0x7573('0x65')]['attachments']&&_0x2af8f3[_0x7573('0x65')][_0x7573('0xab')][_0x7573('0x9b')]){for(var _0x5a10b7=0x0;_0x5a10b7<_0x2af8f3[_0x7573('0x65')][_0x7573('0xab')]['length'];_0x5a10b7+=0x1){_0x2af8f3[_0x7573('0x65')][_0x7573('0xab')][_0x5a10b7]={'filename':_0x2af8f3[_0x7573('0x65')][_0x7573('0xab')][_0x5a10b7]['name'],'path':path[_0x7573('0xac')](config['root'],_0x7573('0xad'),_0x2af8f3[_0x7573('0x65')][_0x7573('0xab')][_0x5a10b7][_0x7573('0xae')])};}}var _0x5abfad=_0x21e51c[_0x7573('0xaf')]();return respondWithRpcPromise(_0x7573('0xb0'),_0x7573('0xb1'),{'account':_0x5abfad,'message':_0x2af8f3[_0x7573('0x65')]});})[_0x7573('0x23')](function(_0x15f9a4){if(!_0x15f9a4)return;_0x340223=_0x15f9a4;if(!_0x38601c[_0x7573('0xa3')])throw new Error(_0x7573('0xb2'));if(_0x38601c[_0x7573('0xa3')][_0x7573('0xa4')][_0x7573('0x9b')])return _0x38601c[_0x7573('0xa3')]['Contacts'][0x0];return db[_0x7573('0x89')][_0x7573('0x6c')](_[_0x7573('0xa')](_0x2af8f3[_0x7573('0x65')],{'firstName':_0x2af8f3[_0x7573('0x65')]['to'],'email':_0x2af8f3[_0x7573('0x65')]['to'],'phone':_0x2af8f3['body']['to'],'ListId':_0x38601c['ListId']}));})[_0x7573('0x23')](function(_0x47d961){if(!_0x47d961)return;var _0x315a94={'UserId':_0x2af8f3[_0x7573('0x37')]['id'],'ContactId':_0x47d961['id'],'MailAccountId':_0x38601c['id'],'inReplyTo':_0x340223['messageId'],'to':_0x2af8f3[_0x7573('0x65')][_0x7573('0xa8')],'cc':_0x2af8f3[_0x7573('0x65')]['cc'],'subject':_0x2af8f3[_0x7573('0x65')][_0x7573('0xb3')],'attach':_0x2af8f3[_0x7573('0x65')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0x7573('0xa9')](_0x7573('0xb4')),'lastMsgDirection':_0x7573('0xb5'),'Messages':[_['merge'](_0x2af8f3[_0x7573('0x65')],{'messageId':_0x340223[_0x7573('0xb6')],'sentAt':moment()[_0x7573('0xa9')](_0x7573('0xb4')),'read':!![],'MailAccountId':_0x38601c['id'],'UserId':_0x2af8f3['user']['id'],'ContactId':_0x47d961['id']})]};if(_0x2af8f3[_0x7573('0x65')]['Interaction']){_0x315a94=_[_0x7573('0x59')](_0x315a94,_0x2af8f3[_0x7573('0x65')]['Interaction']);}return db[_0x7573('0x86')]['create'](_0x315a94,{'include':[{'model':db[_0x7573('0x9d')],'as':_0x7573('0xb7')}]});})[_0x7573('0x23')](respondWithResult(_0x3c1565,null))['catch'](handleError(_0x3c1565,null));};exports[_0x7573('0xb8')]=function(_0x47ccd3,_0x4c8a80){return db[_0x7573('0x47')][_0x7573('0x64')]({'where':{'id':_0x47ccd3[_0x7573('0x61')]['id']},'include':[{'model':db[_0x7573('0x62')],'as':_0x7573('0x42'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x7573('0xa6'),'raw':!![]}]}]})[_0x7573('0x23')](handleEntityNotFound(_0x4c8a80,null))[_0x7573('0x23')](function(_0x534ef2){if(!_0x534ef2[_0x7573('0x42')])return;var _0x5c6b7b=_0x534ef2[_0x7573('0xaf')]();return respondWithRpcPromise('VerifySmtp',_0x7573('0xb8'),{'account':_0x5c6b7b});})[_0x7573('0x23')](respondWithResult(_0x4c8a80,null))['catch'](handleError(_0x4c8a80,null));};exports['destroy']=function(_0x5023a4,_0x272f72){return db['MailAccount'][_0x7573('0x64')]({'where':{'id':_0x5023a4['params']['id']}})[_0x7573('0x23')](handleEntityNotFound(_0x272f72,null))[_0x7573('0x23')](function(_0x57fff8){if(_0x57fff8&&_0x57fff8['service']){throw new db[(_0x7573('0xb9'))][(_0x7573('0xba'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x57fff8;})[_0x7573('0x23')](removeEntity(_0x272f72,null))['catch'](handleError(_0x272f72,null));};exports[_0x7573('0xbb')]=function(_0x2a2410,_0x36f0e8){return db[_0x7573('0x47')][_0x7573('0x64')]({'where':{'id':_0x2a2410['params']['id']}})[_0x7573('0x23')](handleEntityNotFound(_0x36f0e8,null))[_0x7573('0x23')](function(_0x1ba8e4){if(_0x1ba8e4){return _0x1ba8e4[_0x7573('0xbb')](_0x2a2410['body'][_0x7573('0x70')],_['omit'](_0x2a2410[_0x7573('0x65')],['ids','id'])||{})[_0x7573('0xbc')](function(_0x17e20b){for(var _0x5e3a26=0x0;_0x5e3a26<_0x2a2410[_0x7573('0x65')][_0x7573('0x70')]['length'];_0x5e3a26+=0x1){socket[_0x7573('0xbd')](_0x7573('0xbe'),{'UserId':Number(_0x2a2410[_0x7573('0x65')][_0x7573('0x70')][_0x5e3a26]),'MailAccountId':Number(_0x2a2410[_0x7573('0x61')]['id'])});}return _0x17e20b;});}})['then'](respondWithResult(_0x36f0e8,null))[_0x7573('0x19')](handleError(_0x36f0e8,null));};exports['removeAgents']=function(_0x52bb85,_0x37a01a){return db[_0x7573('0x47')][_0x7573('0x64')]({'where':{'id':_0x52bb85['params']['id']}})[_0x7573('0x23')](handleEntityNotFound(_0x37a01a,null))['then'](function(_0x215036){if(_0x215036){return _0x215036[_0x7573('0xbf')](_0x52bb85['query'][_0x7573('0x70')])[_0x7573('0x23')](function(){if(_[_0x7573('0xc0')](_0x52bb85[_0x7573('0x4d')]['ids'])){for(var _0x5c4617=0x0;_0x5c4617<_0x52bb85['query'][_0x7573('0x70')]['length'];_0x5c4617+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x52bb85[_0x7573('0x4d')][_0x7573('0x70')][_0x5c4617]),'MailAccountId':Number(_0x52bb85[_0x7573('0x61')]['id'])});}}else{socket[_0x7573('0xbd')](_0x7573('0xc1'),{'UserId':Number(_0x52bb85['query']['ids']),'MailAccountId':Number(_0x52bb85[_0x7573('0x61')]['id'])});}});}})[_0x7573('0x23')](respondWithStatusCode(_0x37a01a,null))[_0x7573('0x19')](handleError(_0x37a01a,null));};exports['getAgents']=function(_0x4686f0,_0x464071){var _0x234c2a={};var _0x1f0c95={};var _0x3fc7e6;var _0x129cad;return db[_0x7573('0x47')][_0x7573('0x6e')]({'where':{'id':_0x4686f0[_0x7573('0x61')]['id']}})['then'](handleEntityNotFound(_0x464071,null))[_0x7573('0x23')](function(_0x573d61){if(_0x573d61){_0x3fc7e6=_0x573d61;_0x1f0c95[_0x7573('0x4c')]=_['keys'](db[_0x7573('0x8b')][_0x7573('0x48')]);_0x1f0c95[_0x7573('0x4d')]=_[_0x7573('0x4e')](_0x4686f0[_0x7573('0x4d')]);_0x1f0c95[_0x7573('0x4f')]=_[_0x7573('0x50')](_0x1f0c95[_0x7573('0x4c')],_0x1f0c95['query']);_0x234c2a[_0x7573('0x51')]=_[_0x7573('0x50')](_0x1f0c95[_0x7573('0x4c')],qs['fields'](_0x4686f0['query'][_0x7573('0x52')]));_0x234c2a[_0x7573('0x51')]=_0x234c2a[_0x7573('0x51')][_0x7573('0x9b')]?_0x234c2a[_0x7573('0x51')]:_0x1f0c95[_0x7573('0x4c')];_0x234c2a[_0x7573('0x54')]=qs[_0x7573('0x55')](_0x4686f0['query']['sort']);_0x234c2a[_0x7573('0x56')]=qs[_0x7573('0x4f')](_[_0x7573('0x57')](_0x4686f0[_0x7573('0x4d')],_0x1f0c95['filters']));if(_0x4686f0[_0x7573('0x4d')][_0x7573('0x58')]){_0x234c2a[_0x7573('0x56')]=_[_0x7573('0x59')](_0x234c2a[_0x7573('0x56')],{'$or':_[_0x7573('0x46')](_0x234c2a[_0x7573('0x51')],function(_0x42c525){var _0x218fab={};_0x218fab[_0x42c525]={'$like':'%'+_0x4686f0[_0x7573('0x4d')][_0x7573('0x58')]+'%'};return _0x218fab;})});}_0x234c2a=_[_0x7573('0x59')]({},_0x234c2a,_0x4686f0[_0x7573('0x5b')]);return _0x3fc7e6[_0x7573('0xc2')](_0x234c2a);}})[_0x7573('0x23')](function(_0x2c0abe){if(_0x2c0abe){_0x129cad=_0x2c0abe['length'];if(!_0x4686f0[_0x7573('0x4d')]['hasOwnProperty'](_0x7573('0x74'))){_0x234c2a[_0x7573('0x1f')]=qs['limit'](_0x4686f0[_0x7573('0x4d')][_0x7573('0x1f')]);_0x234c2a[_0x7573('0x1d')]=qs['offset'](_0x4686f0[_0x7573('0x4d')][_0x7573('0x1d')]);}return _0x3fc7e6[_0x7573('0xc2')](_0x234c2a);}})[_0x7573('0x23')](function(_0x1f917d){if(_0x1f917d){return _0x1f917d?{'count':_0x129cad,'rows':_0x1f917d}:null;}})[_0x7573('0x23')](respondWithResult(_0x464071,null))['catch'](handleError(_0x464071,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 3808bdd..b7ef2b8 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 _0x8294=['../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook','events'];(function(_0x3fe06b,_0x2b9479){var _0x54fa77=function(_0x1ea485){while(--_0x1ea485){_0x3fe06b['push'](_0x3fe06b['shift']());}};_0x54fa77(++_0x2b9479);}(_0x8294,0x1c6));var _0x4829=function(_0x501ea2,_0xa6ec3a){_0x501ea2=_0x501ea2-0x0;var _0x31fa3d=_0x8294[_0x501ea2];return _0x31fa3d;};'use strict';var EventEmitter=require(_0x4829('0x0'));var MailAccount=require(_0x4829('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4829('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4829('0x3')};function emitEvent(_0x31c3ac){return function(_0x27a714,_0x494a7d,_0x1cbde3){MailAccountEvents['emit'](_0x31c3ac+':'+_0x27a714['id'],_0x27a714);MailAccountEvents[_0x4829('0x4')](_0x31c3ac,_0x27a714);_0x1cbde3(null);};}for(var e in events){if(events[_0x4829('0x5')](e)){var event=events[e];MailAccount[_0x4829('0x6')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x3c8e=['hook','exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x64c6e3,_0x3b5371){var _0x69c52f=function(_0x573d04){while(--_0x573d04){_0x64c6e3['push'](_0x64c6e3['shift']());}};_0x69c52f(++_0x3b5371);}(_0x3c8e,0x89));var _0xe3c8=function(_0x2e8a79,_0x29e68a){_0x2e8a79=_0x2e8a79-0x0;var _0x13c957=_0x3c8e[_0x2e8a79];return _0x13c957;};'use strict';var EventEmitter=require(_0xe3c8('0x0'));var MailAccount=require(_0xe3c8('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe3c8('0x2'),'afterUpdate':_0xe3c8('0x3'),'afterDestroy':_0xe3c8('0x4')};function emitEvent(_0x563970){return function(_0x3f8a4b,_0x21efc9,_0xbd43ef){MailAccountEvents[_0xe3c8('0x5')](_0x563970+':'+_0x3f8a4b['id'],_0x3f8a4b);MailAccountEvents['emit'](_0x563970,_0x3f8a4b);_0xbd43ef(null);};}for(var e in events){if(events[_0xe3c8('0x6')](e)){var event=events[e];MailAccount[_0xe3c8('0x7')](e,emitEvent(event));}}module[_0xe3c8('0x8')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 9ee0969..2ed2180 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 _0xf4db=['Smtp','port','secure','authentication','modernAuthentication','CloudProvider','OAuth2','data5','user','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','host'];(function(_0x174a14,_0x2a7e9a){var _0x11f156=function(_0x4a230a){while(--_0x4a230a){_0x174a14['push'](_0x174a14['shift']());}};_0x11f156(++_0x2a7e9a);}(_0xf4db,0x16f));var _0xbf4d=function(_0x2ecdbe,_0x114206){_0x2ecdbe=_0x2ecdbe-0x0;var _0x44d6d4=_0xf4db[_0x2ecdbe];return _0x44d6d4;};'use strict';var attributes=require(_0xbf4d('0x0'));module[_0xbf4d('0x1')]=function(_0x4c36ce){return _0x4c36ce[_0xbf4d('0x2')](_0xbf4d('0x3'),attributes,{'tableName':_0xbf4d('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x51f9e7=this;var _0xaf9978={'id':_0x51f9e7['id'],'tls':{'rejectUnauthorized':![]}};if(_0x51f9e7[_0xbf4d('0x5')]!=='custom'){_0xaf9978['service']=_0x51f9e7[_0xbf4d('0x5')];}else{_0xaf9978[_0xbf4d('0x6')]=_0x51f9e7[_0xbf4d('0x7')][_0xbf4d('0x6')];_0xaf9978[_0xbf4d('0x8')]=_0x51f9e7[_0xbf4d('0x7')][_0xbf4d('0x8')];_0xaf9978['secure']=_0x51f9e7[_0xbf4d('0x7')][_0xbf4d('0x9')];}if(_0x51f9e7[_0xbf4d('0x7')][_0xbf4d('0xa')]){if(_0x51f9e7[_0xbf4d('0x7')][_0xbf4d('0xb')]){if(!_0x51f9e7[_0xbf4d('0x7')][_0xbf4d('0xc')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0xaf9978['auth']={'type':_0xbf4d('0xd'),'user':_0x51f9e7[_0xbf4d('0x7')]['user'],'accessToken':_0x51f9e7[_0xbf4d('0x7')]['CloudProvider'][_0xbf4d('0xe')]};}else{_0xaf9978['auth']={'user':_0x51f9e7[_0xbf4d('0x7')][_0xbf4d('0xf')],'pass':_0x51f9e7[_0xbf4d('0x7')][_0xbf4d('0x10')]};}}return _0xaf9978;}}});}; \ No newline at end of file +var _0x659e=['port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','data5','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom','host','Smtp'];(function(_0x66a6c5,_0x42e61b){var _0xdd66dd=function(_0x194294){while(--_0x194294){_0x66a6c5['push'](_0x66a6c5['shift']());}};_0xdd66dd(++_0x42e61b);}(_0x659e,0xcf));var _0xe659=function(_0x25ec8f,_0x211599){_0x25ec8f=_0x25ec8f-0x0;var _0x32db85=_0x659e[_0x25ec8f];return _0x32db85;};'use strict';var attributes=require(_0xe659('0x0'));module[_0xe659('0x1')]=function(_0x1b75d0){return _0x1b75d0[_0xe659('0x2')](_0xe659('0x3'),attributes,{'tableName':_0xe659('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x551ff9=this;var _0x13331b={'id':_0x551ff9['id'],'tls':{'rejectUnauthorized':![]}};if(_0x551ff9[_0xe659('0x5')]!==_0xe659('0x6')){_0x13331b['service']=_0x551ff9[_0xe659('0x5')];}else{_0x13331b[_0xe659('0x7')]=_0x551ff9[_0xe659('0x8')]['host'];_0x13331b[_0xe659('0x9')]=_0x551ff9[_0xe659('0x8')]['port'];_0x13331b['secure']=_0x551ff9['Smtp'][_0xe659('0xa')];}if(_0x551ff9[_0xe659('0x8')][_0xe659('0xb')]){if(_0x551ff9[_0xe659('0x8')][_0xe659('0xc')]){if(!_0x551ff9[_0xe659('0x8')][_0xe659('0xd')])throw new Error(_0xe659('0xe'));_0x13331b[_0xe659('0xf')]={'type':'OAuth2','user':_0x551ff9[_0xe659('0x8')]['user'],'accessToken':_0x551ff9['Smtp']['CloudProvider'][_0xe659('0x10')]};}else{_0x13331b[_0xe659('0xf')]={'user':_0x551ff9['Smtp']['user'],'pass':_0x551ff9[_0xe659('0x8')][_0xe659('0x11')]};}}return _0x13331b;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 8fc5562..9feca86 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 _0x7880=['info','ShowMailAccount','find','where','smtp','smtpOptions','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','body','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','CmList','List','DESC','MailApplication','Applications','Smtp','CloudProvider','get','getSmtpOptions','applications','list','priority','asc','autoclose','push','length','close','*,*,*,*','Contacts','ListId','contact','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','create','Contact\x20not\x20found','update','format','interaction','created','attachments','originTo','originCc','bcc','originChannel','Attachment','Attachments','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','include','map','model'];(function(_0x479ae7,_0x232d97){var _0x1e51ce=function(_0x17353b){while(--_0x17353b){_0x479ae7['push'](_0x479ae7['shift']());}};_0x1e51ce(++_0x232d97);}(_0x7880,0x1f4));var _0x0788=function(_0x4bf853,_0x1fc141){_0x4bf853=_0x4bf853-0x0;var _0x38994f=_0x7880[_0x4bf853];return _0x38994f;};'use strict';var _=require('lodash');var moment=require(_0x0788('0x0'));var BPromise=require(_0x0788('0x1'));var rs=require(_0x0788('0x2'));var Redis=require(_0x0788('0x3'));var db=require(_0x0788('0x4'))['db'];var logger=require(_0x0788('0x5'))('rpc');var config=require(_0x0788('0x6'));var jayson=require(_0x0788('0x7'));var client=jayson[_0x0788('0x8')][_0x0788('0x9')]({'port':0x232c});config[_0x0788('0xa')]=_[_0x0788('0xb')](config[_0x0788('0xa')],{'host':_0x0788('0xc'),'port':0x18eb});var socket=require(_0x0788('0xd'))(new Redis(config[_0x0788('0xa')]));require('./mailAccount.socket')[_0x0788('0xe')](socket);function respondWithRpcPromise(_0x49f53b,_0xabaf81,_0x53b2f2){return new BPromise(function(_0x433c26,_0x3c6d18){return client[_0x0788('0xf')](_0x49f53b,_0x53b2f2)[_0x0788('0x10')](function(_0x469ebe){logger['info'](_0x0788('0x11'),_0xabaf81,_0x0788('0x12'));logger[_0x0788('0x13')](_0x0788('0x14'),_0xabaf81,_0x0788('0x12'),JSON[_0x0788('0x15')](_0x469ebe));if(_0x469ebe[_0x0788('0x16')]){if(_0x469ebe['error'][_0x0788('0x17')]===0x1f4){logger[_0x0788('0x16')](_0x0788('0x11'),_0xabaf81,_0x469ebe[_0x0788('0x16')]['message']);return _0x3c6d18(_0x469ebe[_0x0788('0x16')]['message']);}logger[_0x0788('0x16')](_0x0788('0x11'),_0xabaf81,_0x469ebe[_0x0788('0x16')][_0x0788('0x18')]);return _0x433c26(_0x469ebe[_0x0788('0x16')][_0x0788('0x18')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0xabaf81,_0x0788('0x12'));_0x433c26(_0x469ebe[_0x0788('0x19')]['message']);}})[_0x0788('0x1a')](function(_0x415f19){logger[_0x0788('0x16')]('MailAccount,\x20%s,\x20%s',_0xabaf81,_0x415f19);_0x3c6d18(_0x415f19);});});}exports[_0x0788('0x1b')]=function(_0x3fb723){var _0x492c2c=this;return new Promise(function(_0x11ea01,_0x5173d6){return db[_0x0788('0x1c')]['findAll']({'raw':_0x3fb723[_0x0788('0x1d')]?_0x3fb723[_0x0788('0x1d')][_0x0788('0x1e')]===undefined?!![]:![]:!![],'where':_0x3fb723[_0x0788('0x1d')]?_0x3fb723[_0x0788('0x1d')]['where']||null:null,'attributes':_0x3fb723['options']?_0x3fb723[_0x0788('0x1d')][_0x0788('0x1f')]||null:null,'limit':_0x3fb723[_0x0788('0x1d')]?_0x3fb723[_0x0788('0x1d')]['limit']||null:null,'include':_0x3fb723['options']?_0x3fb723[_0x0788('0x1d')][_0x0788('0x20')]?_[_0x0788('0x21')](_0x3fb723['options']['include'],function(_0x240459){return{'model':db[_0x240459[_0x0788('0x22')]],'as':_0x240459['as'],'attributes':_0x240459['attributes'],'include':_0x240459['include']?_[_0x0788('0x21')](_0x240459[_0x0788('0x20')],function(_0x57fda1){return{'model':db[_0x57fda1[_0x0788('0x22')]],'as':_0x57fda1['as'],'attributes':_0x57fda1[_0x0788('0x1f')],'include':_0x57fda1[_0x0788('0x20')]?_[_0x0788('0x21')](_0x57fda1[_0x0788('0x20')],function(_0xb2f4a5){return{'model':db[_0xb2f4a5[_0x0788('0x22')]],'as':_0xb2f4a5['as'],'attributes':_0xb2f4a5[_0x0788('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a5178){logger[_0x0788('0x23')](_0x0788('0x1b'),_0x3fb723);logger['debug']('GetMailAccount',_0x3fb723,JSON[_0x0788('0x15')](_0x5a5178));_0x11ea01(_0x5a5178);})[_0x0788('0x1a')](function(_0x20fcd8){logger[_0x0788('0x16')](_0x0788('0x1b'),_0x20fcd8[_0x0788('0x18')],_0x3fb723);_0x5173d6(_0x492c2c[_0x0788('0x16')](0x1f4,_0x20fcd8[_0x0788('0x18')]));});});};exports[_0x0788('0x24')]=function(_0x85e579){var _0x5ec0ed=this;return new Promise(function(_0x2a08b7,_0x1aab6a){return db[_0x0788('0x1c')][_0x0788('0x25')]({'raw':_0x85e579[_0x0788('0x1d')]?_0x85e579[_0x0788('0x1d')][_0x0788('0x1e')]===undefined?!![]:![]:!![],'where':_0x85e579[_0x0788('0x1d')]?_0x85e579[_0x0788('0x1d')][_0x0788('0x26')]||null:null,'attributes':_0x85e579['options']?_0x85e579['options']['attributes']||null:null,'include':_0x85e579['options']?_0x85e579['options']['include']?_[_0x0788('0x21')](_0x85e579[_0x0788('0x1d')][_0x0788('0x20')],function(_0x574576){return{'model':db[_0x574576[_0x0788('0x22')]],'as':_0x574576['as'],'attributes':_0x574576[_0x0788('0x1f')],'include':_0x574576[_0x0788('0x20')]?_[_0x0788('0x21')](_0x574576['include'],function(_0x2ed940){return{'model':db[_0x2ed940['model']],'as':_0x2ed940['as'],'attributes':_0x2ed940[_0x0788('0x1f')],'include':_0x2ed940['include']?_[_0x0788('0x21')](_0x2ed940[_0x0788('0x20')],function(_0x498e16){return{'model':db[_0x498e16[_0x0788('0x22')]],'as':_0x498e16['as'],'attributes':_0x498e16[_0x0788('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17240e){if(_0x85e579['options'][_0x0788('0x27')]===!![])_0x17240e['setDataValue'](_0x0788('0x28'),_0x17240e['getSmtpOptions']());logger[_0x0788('0x23')]('ShowMailAccount',_0x85e579);logger['debug'](_0x0788('0x24'),_0x85e579,JSON[_0x0788('0x15')](_0x17240e));_0x2a08b7(_0x17240e);})[_0x0788('0x1a')](function(_0x2d17b0){logger[_0x0788('0x16')]('ShowMailAccount',_0x2d17b0['message'],_0x85e579);_0x1aab6a(_0x5ec0ed['error'](0x1f4,_0x2d17b0['message']));});});};exports[_0x0788('0x29')]=function(_0x1202c4){var _0x45b247=this;return new Promise(function(_0x358a22,_0x362c49){var _0x5993ad={'body':_0x1202c4['body'],'channel':_0x0788('0x2a')};var _0x6770a8=_[_0x0788('0x2b')](_[_0x0788('0x2c')](db[_0x0788('0x2d')][_0x0788('0x2e')]),[_0x0788('0x2f'),_0x0788('0x30'),_0x0788('0x31'),'ListId']);var _0x5581e6=![];if(_0x1202c4[_0x0788('0x32')]['id']){delete _0x1202c4[_0x0788('0x32')]['id'];}if(_[_0x0788('0x33')](_0x1202c4['body']['from'])){return _0x362c49(_0x45b247['error'](0x1f4,_0x0788('0x34')));}if(_[_0x0788('0x33')](_0x1202c4[_0x0788('0x32')][_0x0788('0x32')])||_0x1202c4[_0x0788('0x32')][_0x0788('0x32')]===''){return _0x362c49(_0x45b247[_0x0788('0x16')](0x1f4,_0x0788('0x35')));}if(_['isNil'](_0x1202c4[_0x0788('0x32')][_0x0788('0x36')])){return _0x362c49(_0x45b247[_0x0788('0x16')](0x1f4,_0x0788('0x37')+_0x6770a8));}if(!_['includes'](_0x6770a8,_0x1202c4[_0x0788('0x32')][_0x0788('0x36')])){return _0x362c49(_0x45b247['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x6770a8));}var _0x524b43={};_0x524b43[_0x1202c4[_0x0788('0x32')]['mapKey']]=_0x1202c4[_0x0788('0x32')][_0x0788('0x38')];return db[_0x0788('0x1c')][_0x0788('0x25')]({'where':{'id':_0x1202c4[_0x0788('0x39')]['id']},'include':[{'model':db[_0x0788('0x3a')],'as':_0x0788('0x3b'),'include':[{'model':db[_0x0788('0x2d')],'as':'Contacts','where':_0x524b43,'limit':0x1,'order':[['updatedAt',_0x0788('0x3c')]]}]},{'model':db[_0x0788('0x3d')],'as':_0x0788('0x3e')},{'model':db['MailServerOut'],'as':_0x0788('0x3f'),'include':[{'model':db[_0x0788('0x40')],'as':_0x0788('0x40')}]}]})[_0x0788('0x10')](function(_0x2395ad){if(_0x2395ad&&_0x2395ad['List']){var _0x5c436a=_0x2395ad[_0x0788('0x41')]({'plain':!![]});_0x5993ad[_0x0788('0x39')]=_['omit'](_0x5c436a,[_0x0788('0x3e'),'List']);_0x5993ad[_0x0788('0x39')][_0x0788('0x28')]=_0x2395ad[_0x0788('0x42')]();_0x5993ad[_0x0788('0x43')]=_0x5c436a[_0x0788('0x3e')];_0x5993ad[_0x0788('0x44')]=_0x5c436a[_0x0788('0x3b')];_0x5993ad[_0x0788('0x43')]=_['orderBy'](_0x5993ad[_0x0788('0x43')],[_0x0788('0x45')],[_0x0788('0x46')]);if(_0x5993ad['account']&&_0x5993ad[_0x0788('0x39')][_0x0788('0x47')]){_0x5993ad['applications'][_0x0788('0x48')]({'id':0x0,'priority':_0x5993ad[_0x0788('0x43')][_0x0788('0x49')]+0x1,'app':_0x0788('0x4a'),'appdata':_0x0788('0x47'),'interval':_0x0788('0x4b')});}if(_0x5993ad['account']['Applications']){delete _0x5993ad[_0x0788('0x39')][_0x0788('0x3e')];}if(_0x5993ad['account'][_0x0788('0x3b')]){delete _0x5993ad[_0x0788('0x39')][_0x0788('0x3b')];}if(_0x5c436a[_0x0788('0x3b')][_0x0788('0x4c')][_0x0788('0x49')]){return _0x5c436a[_0x0788('0x3b')][_0x0788('0x4c')][0x0];}var _0x35f290=_[_0x0788('0xb')](_0x1202c4[_0x0788('0x32')],{'firstName':_0x1202c4[_0x0788('0x32')]['from'],'ListId':_0x5c436a[_0x0788('0x4d')]});_0x35f290[_0x1202c4[_0x0788('0x32')][_0x0788('0x36')]]=_0x1202c4['body'][_0x0788('0x38')];return db[_0x0788('0x2d')]['create'](_0x35f290);}else{throw new Error('List\x20not\x20found');}})[_0x0788('0x10')](function(_0x26826a){_0x5993ad[_0x0788('0x4e')]=_0x26826a;if(_0x26826a){if(!_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x4f')]){_0x1202c4['body'][_0x0788('0x18')][_0x0788('0x4f')]=rs[_0x0788('0x50')]()+'\x20'+_0x1202c4['body']['message'][_0x0788('0x38')];}var _0x5419d9={'ContactId':_0x26826a['id'],'MailAccountId':_0x1202c4[_0x0788('0x39')]['id'],'inReplyTo':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x4f')],'to':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x38')],'cc':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')]['cc'],'subject':_0x1202c4[_0x0788('0x32')]['message'][_0x0788('0x51')],'attach':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x52')],'lastMsgAt':moment()['format'](_0x0788('0x53')),'lastMsgDirection':'in'};return db[_0x0788('0x54')][_0x0788('0x25')]({'where':{'closed':![],'MailAccountId':_0x1202c4[_0x0788('0x39')]['id']},'include':[{'model':db[_0x0788('0x55')],'as':'Messages','attributes':[_0x0788('0x4f')],'where':{'messageId':_0x1202c4['body'][_0x0788('0x18')][_0x0788('0x56')]}}]})[_0x0788('0x10')](function(_0x47f22c){if(_0x47f22c){return[_0x47f22c,![]];}return db[_0x0788('0x54')][_0x0788('0x57')](_0x5419d9)[_0x0788('0x10')](function(_0x150403){return[_0x150403,!![]];});});}else{throw new Error(_0x0788('0x58'));}})['spread'](function(_0x25201f,_0x2dea6c){if(_0x25201f){_0x5581e6=_0x2dea6c;if(!_0x2dea6c){return _0x25201f[_0x0788('0x59')]({'inReplyTo':_0x1202c4['body']['message'][_0x0788('0x4f')],'to':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')]['from'],'cc':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')]['cc'],'subject':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')]['subject'],'attach':_0x25201f['attach']?_0x25201f['attach']:_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x52')],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x0788('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x25201f;}}})[_0x0788('0x10')](function(_0x3d1181){_0x5993ad[_0x0788('0x5b')]=_0x3d1181[_0x0788('0x41')]({'plain':!![]});_0x5993ad[_0x0788('0x5b')][_0x0788('0x5c')]=_0x5581e6;return db[_0x0788('0x55')][_0x0788('0x57')]({'body':_0x1202c4[_0x0788('0x32')][_0x0788('0x32')],'MailAccountId':_0x1202c4['account']['id'],'MailInteractionId':_0x3d1181['id'],'direction':'in','ContactId':_0x5993ad[_0x0788('0x4e')]['id'],'messageId':_0x1202c4[_0x0788('0x32')]['message']['messageId'],'from':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x38')],'to':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')]['to'],'cc':_0x1202c4[_0x0788('0x32')]['message']['cc'],'subject':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x51')],'attach':_0x1202c4[_0x0788('0x32')]['message'][_0x0788('0x52')],'Attachments':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x5d')],'originTo':_0x1202c4['body']['message'][_0x0788('0x5e')],'originCc':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x5f')],'bcc':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x60')],'ChatWebsiteId':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')]['ChatWebsiteId']||null,'originChannel':_0x1202c4[_0x0788('0x32')][_0x0788('0x18')][_0x0788('0x61')]||'Email','ChatOfflineMessageId':_0x1202c4['body'][_0x0788('0x18')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x0788('0x62')],'as':_0x0788('0x63')}]});})[_0x0788('0x10')](function(_0xa4b3f8){_0x5993ad[_0x0788('0x18')]=_0xa4b3f8;if(_0x5993ad[_0x0788('0x5b')][_0x0788('0x64')]){return db[_0x0788('0x65')][_0x0788('0x25')]({'attributes':['id','name'],'where':{'id':_0x5993ad[_0x0788('0x5b')][_0x0788('0x64')]}})[_0x0788('0x10')](function(_0x54fd89){if(_0x54fd89){_0x5993ad[_0x0788('0x43')][_0x0788('0x66')]({'id':0x0,'priority':0x0,'app':_0x0788('0x67'),'appdata':_0x54fd89['name']+','+(_0x5993ad[_0x0788('0x39')][_0x0788('0x68')]||0xa),'interval':_0x0788('0x4b')});}return respondWithRpcPromise(_0x0788('0x69'),_0x0788('0x6a'),_0x5993ad);});}return respondWithRpcPromise(_0x0788('0x69'),_0x0788('0x6a'),_0x5993ad);})[_0x0788('0x10')](function(_0x25058b){_0x358a22(_0x25058b);})['catch'](function(_0x471b3a){_0x362c49(_0x45b247[_0x0788('0x16')](0x1f4,_0x471b3a[_0x0788('0x18')]));});});}; \ No newline at end of file +var _0x2ef3=['result','catch','MailAccount','findAll','options','attributes','limit','model','include','map','GetMailAccount','find','raw','smtp','setDataValue','smtpOptions','ShowMailAccount','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','getSmtpOptions','applications','list','orderBy','priority','autoclose','push','length','close','*,*,*,*','defaults','create','List\x20not\x20found','messageId','generate','attach','MailInteraction','update','subject','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','ChatWebsiteId','Email','ChatOfflineMessageId','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','message'];(function(_0x79fdb4,_0x2e4500){var _0x4b98dd=function(_0x426bb6){while(--_0x426bb6){_0x79fdb4['push'](_0x79fdb4['shift']());}};_0x4b98dd(++_0x2e4500);}(_0x2ef3,0xba));var _0x32ef=function(_0x2a0fb9,_0x510b16){_0x2a0fb9=_0x2a0fb9-0x0;var _0x1235f5=_0x2ef3[_0x2a0fb9];return _0x1235f5;};'use strict';var _=require(_0x32ef('0x0'));var moment=require(_0x32ef('0x1'));var BPromise=require(_0x32ef('0x2'));var rs=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var db=require(_0x32ef('0x5'))['db'];var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x32ef('0x8')][_0x32ef('0x9')]({'port':0x232c});config['redis']=_['defaults'](config[_0x32ef('0xa')],{'host':_0x32ef('0xb'),'port':0x18eb});var socket=require(_0x32ef('0xc'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xd'))[_0x32ef('0xe')](socket);function respondWithRpcPromise(_0x2484a0,_0x2bbb50,_0x28275c){return new BPromise(function(_0x77df79,_0x56eb42){return client['request'](_0x2484a0,_0x28275c)[_0x32ef('0xf')](function(_0x33281d){logger[_0x32ef('0x10')](_0x32ef('0x11'),_0x2bbb50,'request\x20sent');logger[_0x32ef('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2bbb50,_0x32ef('0x13'),JSON['stringify'](_0x33281d));if(_0x33281d[_0x32ef('0x14')]){if(_0x33281d[_0x32ef('0x14')]['code']===0x1f4){logger['error'](_0x32ef('0x11'),_0x2bbb50,_0x33281d['error'][_0x32ef('0x15')]);return _0x56eb42(_0x33281d[_0x32ef('0x14')][_0x32ef('0x15')]);}logger[_0x32ef('0x14')]('MailAccount,\x20%s,\x20%s',_0x2bbb50,_0x33281d['error']['message']);return _0x77df79(_0x33281d[_0x32ef('0x14')][_0x32ef('0x15')]);}else{logger[_0x32ef('0x10')]('MailAccount,\x20%s,\x20%s',_0x2bbb50,'request\x20sent');_0x77df79(_0x33281d[_0x32ef('0x16')][_0x32ef('0x15')]);}})[_0x32ef('0x17')](function(_0x57863c){logger[_0x32ef('0x14')](_0x32ef('0x11'),_0x2bbb50,_0x57863c);_0x56eb42(_0x57863c);});});}exports['GetMailAccount']=function(_0x304505){var _0x314ef1=this;return new Promise(function(_0x26aff3,_0x251084){return db[_0x32ef('0x18')][_0x32ef('0x19')]({'raw':_0x304505['options']?_0x304505[_0x32ef('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')]['where']||null:null,'attributes':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')][_0x32ef('0x1b')]||null:null,'limit':_0x304505['options']?_0x304505['options'][_0x32ef('0x1c')]||null:null,'include':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')]['include']?_['map'](_0x304505[_0x32ef('0x1a')]['include'],function(_0x51a412){return{'model':db[_0x51a412[_0x32ef('0x1d')]],'as':_0x51a412['as'],'attributes':_0x51a412[_0x32ef('0x1b')],'include':_0x51a412[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x51a412[_0x32ef('0x1e')],function(_0x234175){return{'model':db[_0x234175[_0x32ef('0x1d')]],'as':_0x234175['as'],'attributes':_0x234175[_0x32ef('0x1b')],'include':_0x234175[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x234175[_0x32ef('0x1e')],function(_0xba4b3f){return{'model':db[_0xba4b3f['model']],'as':_0xba4b3f['as'],'attributes':_0xba4b3f[_0x32ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xf')](function(_0x5a04cd){logger[_0x32ef('0x10')](_0x32ef('0x20'),_0x304505);logger[_0x32ef('0x12')](_0x32ef('0x20'),_0x304505,JSON['stringify'](_0x5a04cd));_0x26aff3(_0x5a04cd);})[_0x32ef('0x17')](function(_0x22bf86){logger[_0x32ef('0x14')](_0x32ef('0x20'),_0x22bf86[_0x32ef('0x15')],_0x304505);_0x251084(_0x314ef1[_0x32ef('0x14')](0x1f4,_0x22bf86[_0x32ef('0x15')]));});});};exports['ShowMailAccount']=function(_0x36ac37){var _0x537214=this;return new Promise(function(_0x38bf73,_0x2b6c6a){return db['MailAccount'][_0x32ef('0x21')]({'raw':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x22')]===undefined?!![]:![]:!![],'where':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37['options']['where']||null:null,'attributes':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37['options'][_0x32ef('0x1b')]||null:null,'include':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x36ac37[_0x32ef('0x1a')]['include'],function(_0x482d3a){return{'model':db[_0x482d3a['model']],'as':_0x482d3a['as'],'attributes':_0x482d3a[_0x32ef('0x1b')],'include':_0x482d3a[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x482d3a['include'],function(_0x4fb402){return{'model':db[_0x4fb402[_0x32ef('0x1d')]],'as':_0x4fb402['as'],'attributes':_0x4fb402[_0x32ef('0x1b')],'include':_0x4fb402[_0x32ef('0x1e')]?_['map'](_0x4fb402['include'],function(_0xcbdec8){return{'model':db[_0xcbdec8[_0x32ef('0x1d')]],'as':_0xcbdec8['as'],'attributes':_0xcbdec8[_0x32ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xf')](function(_0x3a7c49){if(_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x23')]===!![])_0x3a7c49[_0x32ef('0x24')](_0x32ef('0x25'),_0x3a7c49['getSmtpOptions']());logger[_0x32ef('0x10')](_0x32ef('0x26'),_0x36ac37);logger[_0x32ef('0x12')]('ShowMailAccount',_0x36ac37,JSON[_0x32ef('0x27')](_0x3a7c49));_0x38bf73(_0x3a7c49);})[_0x32ef('0x17')](function(_0x879e33){logger[_0x32ef('0x14')](_0x32ef('0x26'),_0x879e33[_0x32ef('0x15')],_0x36ac37);_0x2b6c6a(_0x537214[_0x32ef('0x14')](0x1f4,_0x879e33[_0x32ef('0x15')]));});});};exports[_0x32ef('0x28')]=function(_0x57a3c0){var _0xb4db74=this;return new Promise(function(_0x4615b4,_0x48e071){var _0x3cac2e={'body':_0x57a3c0[_0x32ef('0x29')],'channel':_0x32ef('0x2a')};var _0x1733e3=_[_0x32ef('0x2b')](_[_0x32ef('0x2c')](db[_0x32ef('0x2d')]['rawAttributes']),['createdAt',_0x32ef('0x2e'),_0x32ef('0x2f'),_0x32ef('0x30')]);var _0x765c63=![];if(_0x57a3c0['body']['id']){delete _0x57a3c0[_0x32ef('0x29')]['id'];}if(_[_0x32ef('0x31')](_0x57a3c0['body'][_0x32ef('0x32')])){return _0x48e071(_0xb4db74['error'](0x1f4,_0x32ef('0x33')));}if(_[_0x32ef('0x31')](_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x29')])||_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x29')]===''){return _0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,_0x32ef('0x34')));}if(_[_0x32ef('0x31')](_0x57a3c0[_0x32ef('0x29')]['mapKey'])){return _0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1733e3));}if(!_[_0x32ef('0x35')](_0x1733e3,_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x36')])){return _0x48e071(_0xb4db74['error'](0x1f4,_0x32ef('0x37')+_0x1733e3));}var _0x230ac9={};_0x230ac9[_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x36')]]=_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')];return db[_0x32ef('0x18')]['find']({'where':{'id':_0x57a3c0['account']['id']},'include':[{'model':db[_0x32ef('0x38')],'as':_0x32ef('0x39'),'include':[{'model':db[_0x32ef('0x2d')],'as':_0x32ef('0x3a'),'where':_0x230ac9,'limit':0x1,'order':[[_0x32ef('0x2e'),_0x32ef('0x3b')]]}]},{'model':db[_0x32ef('0x3c')],'as':_0x32ef('0x3d')},{'model':db[_0x32ef('0x3e')],'as':_0x32ef('0x3f'),'include':[{'model':db[_0x32ef('0x40')],'as':_0x32ef('0x40')}]}]})[_0x32ef('0xf')](function(_0x4c2534){if(_0x4c2534&&_0x4c2534[_0x32ef('0x39')]){var _0x12fbd7=_0x4c2534[_0x32ef('0x41')]({'plain':!![]});_0x3cac2e[_0x32ef('0x42')]=_[_0x32ef('0x43')](_0x12fbd7,[_0x32ef('0x3d'),_0x32ef('0x39')]);_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x25')]=_0x4c2534[_0x32ef('0x44')]();_0x3cac2e[_0x32ef('0x45')]=_0x12fbd7[_0x32ef('0x3d')];_0x3cac2e[_0x32ef('0x46')]=_0x12fbd7[_0x32ef('0x39')];_0x3cac2e[_0x32ef('0x45')]=_[_0x32ef('0x47')](_0x3cac2e[_0x32ef('0x45')],[_0x32ef('0x48')],['asc']);if(_0x3cac2e['account']&&_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x49')]){_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x4a')]({'id':0x0,'priority':_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x4b')]+0x1,'app':_0x32ef('0x4c'),'appdata':_0x32ef('0x49'),'interval':_0x32ef('0x4d')});}if(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x3d')]){delete _0x3cac2e['account'][_0x32ef('0x3d')];}if(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x39')]){delete _0x3cac2e[_0x32ef('0x42')][_0x32ef('0x39')];}if(_0x12fbd7[_0x32ef('0x39')]['Contacts'][_0x32ef('0x4b')]){return _0x12fbd7[_0x32ef('0x39')][_0x32ef('0x3a')][0x0];}var _0x56b7ce=_[_0x32ef('0x4e')](_0x57a3c0['body'],{'firstName':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')],'ListId':_0x12fbd7['ListId']});_0x56b7ce[_0x57a3c0[_0x32ef('0x29')]['mapKey']]=_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')];return db[_0x32ef('0x2d')][_0x32ef('0x4f')](_0x56b7ce);}else{throw new Error(_0x32ef('0x50'));}})[_0x32ef('0xf')](function(_0x42c7f4){_0x3cac2e['contact']=_0x42c7f4;if(_0x42c7f4){if(!_0x57a3c0['body'][_0x32ef('0x15')]['messageId']){_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x51')]=rs[_0x32ef('0x52')]()+'\x20'+_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x32')];}var _0x316547={'ContactId':_0x42c7f4['id'],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id'],'inReplyTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['messageId'],'to':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x32')],'cc':_0x57a3c0['body'][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['subject'],'attach':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x53')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x32ef('0x54')]['find']({'where':{'closed':![],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x32ef('0x51')],'where':{'messageId':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['inReplyTo']}}]})[_0x32ef('0xf')](function(_0x222b24){if(_0x222b24){return[_0x222b24,![]];}return db[_0x32ef('0x54')]['create'](_0x316547)[_0x32ef('0xf')](function(_0x12b7f8){return[_0x12b7f8,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2e20dc,_0x3a6697){if(_0x2e20dc){_0x765c63=_0x3a6697;if(!_0x3a6697){return _0x2e20dc[_0x32ef('0x55')]({'inReplyTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x51')],'to':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x32')],'cc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x56')],'attach':_0x2e20dc[_0x32ef('0x53')]?_0x2e20dc[_0x32ef('0x53')]:_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x53')],'substatus':null,'substatusAt':moment()[_0x32ef('0x57')](_0x32ef('0x58')),'lastMsgAt':moment()[_0x32ef('0x57')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x2e20dc;}}})['then'](function(_0x2125de){_0x3cac2e[_0x32ef('0x59')]=_0x2125de[_0x32ef('0x41')]({'plain':!![]});_0x3cac2e[_0x32ef('0x59')][_0x32ef('0x5a')]=_0x765c63;return db['MailMessage'][_0x32ef('0x4f')]({'body':_0x57a3c0['body'][_0x32ef('0x29')],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id'],'MailInteractionId':_0x2125de['id'],'direction':'in','ContactId':_0x3cac2e['contact']['id'],'messageId':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x51')],'from':_0x57a3c0[_0x32ef('0x29')]['message']['from'],'to':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['to'],'cc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x56')],'attach':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x53')],'Attachments':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x5b')],'originTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x5c')],'originCc':_0x57a3c0[_0x32ef('0x29')]['message']['originCc'],'bcc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['bcc'],'ChatWebsiteId':_0x57a3c0[_0x32ef('0x29')]['message'][_0x32ef('0x5d')]||null,'originChannel':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['originChannel']||_0x32ef('0x5e'),'ChatOfflineMessageId':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x5f')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0x32ef('0xf')](function(_0x5970db){_0x3cac2e[_0x32ef('0x15')]=_0x5970db;if(_0x3cac2e['interaction'][_0x32ef('0x60')]){return db[_0x32ef('0x61')][_0x32ef('0x21')]({'attributes':['id','name'],'where':{'id':_0x3cac2e['interaction']['UserId']}})[_0x32ef('0xf')](function(_0x5e5766){if(_0x5e5766){_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x62')]({'id':0x0,'priority':0x0,'app':_0x32ef('0x63'),'appdata':_0x5e5766[_0x32ef('0x64')]+','+(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x65')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x32ef('0x66'),'startRouting',_0x3cac2e);});}return respondWithRpcPromise('Start',_0x32ef('0x67'),_0x3cac2e);})['then'](function(_0x145e27){_0x4615b4(_0x145e27);})[_0x32ef('0x17')](function(_0x4d64ec){_0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,_0x4d64ec[_0x32ef('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index f1e2d3a..d1cba22 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 _0x9db7=['update','emit','removeListener','register','length','mailAccount:','./mailAccount.events','save','remove'];(function(_0x248155,_0x16fbb5){var _0x2a9b14=function(_0x4c2ad4){while(--_0x4c2ad4){_0x248155['push'](_0x248155['shift']());}};_0x2a9b14(++_0x16fbb5);}(_0x9db7,0x1bf));var _0x79db=function(_0x5714be,_0x1076d5){_0x5714be=_0x5714be-0x0;var _0x7c8adb=_0x9db7[_0x5714be];return _0x7c8adb;};'use strict';var MailAccountEvents=require(_0x79db('0x0'));var events=[_0x79db('0x1'),_0x79db('0x2'),_0x79db('0x3')];function createListener(_0x5b7e65,_0x298400){return function(_0x5c858f){_0x298400[_0x79db('0x4')](_0x5b7e65,_0x5c858f);};}function removeListener(_0x3a9568,_0x59ad03){return function(){MailAccountEvents[_0x79db('0x5')](_0x3a9568,_0x59ad03);};}exports[_0x79db('0x6')]=function(_0xfb8328){for(var _0x45c9d1=0x0,_0x7980b1=events[_0x79db('0x7')];_0x45c9d1<_0x7980b1;_0x45c9d1++){var _0x214bf9=events[_0x45c9d1];var _0x792510=createListener(_0x79db('0x8')+_0x214bf9,_0xfb8328);MailAccountEvents['on'](_0x214bf9,_0x792510);}}; \ No newline at end of file +var _0x0852=['update','emit','register','length','mailAccount:','./mailAccount.events','remove'];(function(_0xfeb69f,_0x3e1852){var _0x249003=function(_0x65df1b){while(--_0x65df1b){_0xfeb69f['push'](_0xfeb69f['shift']());}};_0x249003(++_0x3e1852);}(_0x0852,0xe5));var _0x2085=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x0852[_0x4a53d];return _0x27410e;};'use strict';var MailAccountEvents=require(_0x2085('0x0'));var events=['save',_0x2085('0x1'),_0x2085('0x2')];function createListener(_0x52d620,_0x1b372a){return function(_0x13633f){_0x1b372a[_0x2085('0x3')](_0x52d620,_0x13633f);};}function removeListener(_0xeb4d28,_0x1dca8a){return function(){MailAccountEvents['removeListener'](_0xeb4d28,_0x1dca8a);};}exports[_0x2085('0x4')]=function(_0x5d19fe){for(var _0x5cb84f=0x0,_0x147b61=events[_0x2085('0x5')];_0x5cb84f<_0x147b61;_0x5cb84f++){var _0x4b0ccb=events[_0x5cb84f];var _0x26b82c=createListener(_0x2085('0x6')+_0x4b0ccb,_0x5d19fe);MailAccountEvents['on'](_0x4b0ccb,_0x26b82c);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 5536829..8b53361 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 _0x14d6=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','put','delete','exports','multer'];(function(_0x3dbfb7,_0x5eba11){var _0x265985=function(_0x16a57a){while(--_0x16a57a){_0x3dbfb7['push'](_0x3dbfb7['shift']());}};_0x265985(++_0x5eba11);}(_0x14d6,0x176));var _0x614d=function(_0x50a398,_0x130b09){_0x50a398=_0x50a398-0x0;var _0x2dac3f=_0x14d6[_0x50a398];return _0x2dac3f;};'use strict';var multer=require(_0x614d('0x0'));var util=require(_0x614d('0x1'));var path=require('path');var timeout=require(_0x614d('0x2'));var express=require(_0x614d('0x3'));var router=express[_0x614d('0x4')]();var fs_extra=require(_0x614d('0x5'));var auth=require(_0x614d('0x6'));var interaction=require(_0x614d('0x7'));var config=require(_0x614d('0x8'));var controller=require('./mailApplication.controller');router[_0x614d('0x9')](_0x614d('0xa'),auth[_0x614d('0xb')](),controller['show']);router[_0x614d('0xc')]('/:id',auth[_0x614d('0xb')](),controller['update']);router[_0x614d('0xd')](_0x614d('0xa'),auth[_0x614d('0xb')](),controller['destroy']);module[_0x614d('0xe')]=router; \ No newline at end of file +var _0x3f0d=['exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','show','put','isAuthenticated','update','delete','destroy'];(function(_0x4095fb,_0x5ac437){var _0x1d55dd=function(_0x35e036){while(--_0x35e036){_0x4095fb['push'](_0x4095fb['shift']());}};_0x1d55dd(++_0x5ac437);}(_0x3f0d,0x122));var _0xd3f0=function(_0x4dede3,_0x14b62a){_0x4dede3=_0x4dede3-0x0;var _0xa8652c=_0x3f0d[_0x4dede3];return _0xa8652c;};'use strict';var multer=require('multer');var util=require(_0xd3f0('0x0'));var path=require(_0xd3f0('0x1'));var timeout=require(_0xd3f0('0x2'));var express=require(_0xd3f0('0x3'));var router=express['Router']();var fs_extra=require(_0xd3f0('0x4'));var auth=require(_0xd3f0('0x5'));var interaction=require(_0xd3f0('0x6'));var config=require(_0xd3f0('0x7'));var controller=require(_0xd3f0('0x8'));router['get'](_0xd3f0('0x9'),auth['isAuthenticated'](),controller[_0xd3f0('0xa')]);router[_0xd3f0('0xb')](_0xd3f0('0x9'),auth[_0xd3f0('0xc')](),controller[_0xd3f0('0xd')]);router[_0xd3f0('0xe')](_0xd3f0('0x9'),auth['isAuthenticated'](),controller[_0xd3f0('0xf')]);module[_0xd3f0('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index efb9a2f..9203032 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 _0xd696=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x5cf998,_0x511906){var _0x3a8a30=function(_0x4dc092){while(--_0x4dc092){_0x5cf998['push'](_0x5cf998['shift']());}};_0x3a8a30(++_0x511906);}(_0xd696,0xea));var _0x6d69=function(_0xfbdf56,_0x3e2e22){_0xfbdf56=_0xfbdf56-0x0;var _0x2e3349=_0xd696[_0xfbdf56];return _0x2e3349;};'use strict';var Sequelize=require(_0x6d69('0x0'));module[_0x6d69('0x1')]={'priority':{'type':Sequelize[_0x6d69('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6d69('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6d69('0x4')]()},'description':{'type':Sequelize[_0x6d69('0x3')]},'interval':{'type':Sequelize[_0x6d69('0x3')],'defaultValue':_0x6d69('0x5')}}; \ No newline at end of file +var _0x4263=['*,*,*,*','sequelize','exports','INTEGER','noop','TEXT','STRING'];(function(_0x2f899e,_0x31bfe7){var _0x569db8=function(_0x6929d9){while(--_0x6929d9){_0x2f899e['push'](_0x2f899e['shift']());}};_0x569db8(++_0x31bfe7);}(_0x4263,0xc5));var _0x3426=function(_0x3b51f6,_0x22eefd){_0x3b51f6=_0x3b51f6-0x0;var _0x43da4b=_0x4263[_0x3b51f6];return _0x43da4b;};'use strict';var Sequelize=require(_0x3426('0x0'));module[_0x3426('0x1')]={'priority':{'type':Sequelize[_0x3426('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3426('0x3')},'appdata':{'type':Sequelize[_0x3426('0x4')]()},'description':{'type':Sequelize[_0x3426('0x5')]},'interval':{'type':Sequelize[_0x3426('0x5')],'defaultValue':_0x3426('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index f36b6ac..9c3e7f3 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 _0xf4eb=['limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','includeAll','include','options','find','catch','body','eml-format','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined'];(function(_0x260c58,_0x5f54bb){var _0x58b6d4=function(_0x2cf339){while(--_0x2cf339){_0x260c58['push'](_0x260c58['shift']());}};_0x58b6d4(++_0x5f54bb);}(_0xf4eb,0xec));var _0xbf4e=function(_0x3d36ce,_0x3be3e6){_0x3d36ce=_0x3d36ce-0x0;var _0x20568f=_0xf4eb[_0x3d36ce];return _0x20568f;};'use strict';var emlformat=require(_0xbf4e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbf4e('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbf4e('0x2'));var path=require(_0xbf4e('0x3'));var sox=require(_0xbf4e('0x4'));var csv=require(_0xbf4e('0x5'));var ejs=require(_0xbf4e('0x6'));var fs=require('fs');var fs_extra=require(_0xbf4e('0x7'));var _=require(_0xbf4e('0x8'));var squel=require('squel');var crypto=require(_0xbf4e('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbf4e('0x5'));var querystring=require(_0xbf4e('0xa'));var Papa=require(_0xbf4e('0xb'));var Redis=require(_0xbf4e('0xc'));var authService=require(_0xbf4e('0xd'));var qs=require(_0xbf4e('0xe'));var as=require(_0xbf4e('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xbf4e('0x10'));var utils=require('../../config/utils');var config=require(_0xbf4e('0x11'));var licenseUtil=require(_0xbf4e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17fd01,_0x5a3035){_0x5a3035=_0x5a3035||0xcc;return function(_0x56d185){if(_0x56d185){return _0x17fd01[_0xbf4e('0x13')](_0x5a3035);}return _0x17fd01[_0xbf4e('0x14')](_0x5a3035)[_0xbf4e('0x15')]();};}function respondWithResult(_0x302841,_0x3b74bd){_0x3b74bd=_0x3b74bd||0xc8;return function(_0x61bd54){if(_0x61bd54){return _0x302841['status'](_0x3b74bd)['json'](_0x61bd54);}};}function respondWithFilteredResult(_0x180432,_0x1735ae){return function(_0x28fc6b){if(_0x28fc6b){var _0x542909=typeof _0x1735ae[_0xbf4e('0x16')]===_0xbf4e('0x17')&&typeof _0x1735ae[_0xbf4e('0x18')]===_0xbf4e('0x17');var _0x5a631e=_0x28fc6b[_0xbf4e('0x19')];var _0x577c27=_0x542909?0x0:_0x1735ae['offset'];var _0x566ec3=_0x542909?_0x28fc6b['count']:_0x1735ae[_0xbf4e('0x16')]+_0x1735ae[_0xbf4e('0x18')];var _0x1fc800;if(_0x566ec3>=_0x5a631e){_0x566ec3=_0x5a631e;_0x1fc800=0xc8;}else{_0x1fc800=0xce;}_0x180432['status'](_0x1fc800);return _0x180432['set'](_0xbf4e('0x1a'),_0x577c27+'-'+_0x566ec3+'/'+_0x5a631e)[_0xbf4e('0x1b')](_0x28fc6b);}return null;};}function patchUpdates(_0x3be138){return function(_0x3a875b){try{jsonpatch[_0xbf4e('0x1c')](_0x3a875b,_0x3be138,!![]);}catch(_0x1e2a68){return BPromise[_0xbf4e('0x1d')](_0x1e2a68);}return _0x3a875b[_0xbf4e('0x1e')]();};}function saveUpdates(_0xd09e12,_0x376832){return function(_0x30539b){if(_0x30539b){return _0x30539b['update'](_0xd09e12)[_0xbf4e('0x1f')](function(_0x2e7673){return _0x2e7673;});}return null;};}function removeEntity(_0x51648c,_0x31e3f5){return function(_0x30994d){if(_0x30994d){return _0x30994d[_0xbf4e('0x20')]()[_0xbf4e('0x1f')](function(){_0x51648c[_0xbf4e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x90635e,_0x36688a){return function(_0x3d6863){if(!_0x3d6863){_0x90635e['sendStatus'](0x194);}return _0x3d6863;};}function handleError(_0x2fb490,_0x5e08b1){_0x5e08b1=_0x5e08b1||0x1f4;return function(_0x5bcf71){logger[_0xbf4e('0x21')](_0x5bcf71['stack']);if(_0x5bcf71[_0xbf4e('0x22')]){delete _0x5bcf71[_0xbf4e('0x22')];}_0x2fb490[_0xbf4e('0x14')](_0x5e08b1)[_0xbf4e('0x23')](_0x5bcf71);};}exports['show']=function(_0x2d4686,_0x8e0ab5){var _0x43879d={'raw':!![],'where':{'id':_0x2d4686[_0xbf4e('0x24')]['id']}},_0x4cd4a1={};_0x4cd4a1['model']=_[_0xbf4e('0x25')](db[_0xbf4e('0x26')][_0xbf4e('0x27')]);_0x4cd4a1['query']=_[_0xbf4e('0x25')](_0x2d4686[_0xbf4e('0x28')]);_0x4cd4a1[_0xbf4e('0x29')]=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],_0x4cd4a1[_0xbf4e('0x28')]);_0x43879d['attributes']=_[_0xbf4e('0x2a')](_0x4cd4a1[_0xbf4e('0x2b')],qs['fields'](_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2c')]));_0x43879d['attributes']=_0x43879d[_0xbf4e('0x2d')]['length']?_0x43879d[_0xbf4e('0x2d')]:_0x4cd4a1['model'];if(_0x2d4686[_0xbf4e('0x28')][_0xbf4e('0x2e')]){_0x43879d[_0xbf4e('0x2f')]=[{'all':!![]}];}_0x43879d=_['merge']({},_0x43879d,_0x2d4686[_0xbf4e('0x30')]);return db[_0xbf4e('0x26')][_0xbf4e('0x31')](_0x43879d)[_0xbf4e('0x1f')](handleEntityNotFound(_0x8e0ab5,null))[_0xbf4e('0x1f')](respondWithResult(_0x8e0ab5,null))[_0xbf4e('0x32')](handleError(_0x8e0ab5,null));};exports['update']=function(_0x99b320,_0x3dbb2b){if(_0x99b320[_0xbf4e('0x33')]['id']){delete _0x99b320[_0xbf4e('0x33')]['id'];}return db[_0xbf4e('0x26')]['find']({'where':{'id':_0x99b320['params']['id']}})['then'](handleEntityNotFound(_0x3dbb2b,null))['then'](saveUpdates(_0x99b320[_0xbf4e('0x33')],null))[_0xbf4e('0x1f')](respondWithResult(_0x3dbb2b,null))[_0xbf4e('0x32')](handleError(_0x3dbb2b,null));};exports[_0xbf4e('0x20')]=function(_0x22ddde,_0x257b74){return db[_0xbf4e('0x26')][_0xbf4e('0x31')]({'where':{'id':_0x22ddde[_0xbf4e('0x24')]['id']}})['then'](handleEntityNotFound(_0x257b74,null))['then'](removeEntity(_0x257b74,null))[_0xbf4e('0x32')](handleError(_0x257b74,null));}; \ No newline at end of file +var _0x0713=['catch','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x117f48,_0x489cd1){var _0x422384=function(_0x5181f3){while(--_0x5181f3){_0x117f48['push'](_0x117f48['shift']());}};_0x422384(++_0x489cd1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 9c7f074..06df0bc 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 _0x5308=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','mail_applications'];(function(_0x3e345c,_0xd7f83e){var _0x24e547=function(_0x464735){while(--_0x464735){_0x3e345c['push'](_0x3e345c['shift']());}};_0x24e547(++_0xd7f83e);}(_0x5308,0x101));var _0x8530=function(_0x7dbd65,_0x18da49){_0x7dbd65=_0x7dbd65-0x0;var _0x33d551=_0x5308[_0x7dbd65];return _0x33d551;};'use strict';var _=require(_0x8530('0x0'));var util=require(_0x8530('0x1'));var logger=require(_0x8530('0x2'))(_0x8530('0x3'));var moment=require(_0x8530('0x4'));var BPromise=require(_0x8530('0x5'));var rp=require(_0x8530('0x6'));var fs=require('fs');var path=require(_0x8530('0x7'));var rimraf=require(_0x8530('0x8'));var config=require(_0x8530('0x9'));var attributes=require('./mailApplication.attributes');module[_0x8530('0xa')]=function(_0x500149,_0x352c12){return _0x500149[_0x8530('0xb')]('MailApplication',attributes,{'tableName':_0x8530('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8530('0xd'),'collate':_0x8530('0xe')});}; \ No newline at end of file +var _0x4a85=['../../config/environment','exports','define','MailApplication','mail_applications','utf8mb4','util','../../config/logger','api','moment','request-promise','path'];(function(_0x40be8b,_0x5e2f58){var _0x413f84=function(_0x3be76d){while(--_0x3be76d){_0x40be8b['push'](_0x40be8b['shift']());}};_0x413f84(++_0x5e2f58);}(_0x4a85,0xf6));var _0x54a8=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x4a85[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require('lodash');var util=require(_0x54a8('0x0'));var logger=require(_0x54a8('0x1'))(_0x54a8('0x2'));var moment=require(_0x54a8('0x3'));var BPromise=require('bluebird');var rp=require(_0x54a8('0x4'));var fs=require('fs');var path=require(_0x54a8('0x5'));var rimraf=require('rimraf');var config=require(_0x54a8('0x6'));var attributes=require('./mailApplication.attributes');module[_0x54a8('0x7')]=function(_0x5b7461,_0x2d2cfb){return _0x5b7461[_0x54a8('0x8')](_0x54a8('0x9'),attributes,{'tableName':_0x54a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x54a8('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 47bdec9..768189e 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 _0xa580=['stringify','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','error','code','MailApplication,\x20%s,\x20%s','message','result','UpdateMailApplication','MailApplication','body','options','attributes','limit'];(function(_0x2f3d29,_0x150e7b){var _0x53d69d=function(_0x45f6ec){while(--_0x45f6ec){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x53d69d(++_0x150e7b);}(_0xa580,0x107));var _0x0a58=function(_0x2689d0,_0x4af7a4){_0x2689d0=_0x2689d0-0x0;var _0x48603c=_0xa580[_0x2689d0];return _0x48603c;};'use strict';var _=require(_0x0a58('0x0'));var util=require(_0x0a58('0x1'));var moment=require('moment');var BPromise=require(_0x0a58('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a58('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a58('0x4'));var logger=require(_0x0a58('0x5'))(_0x0a58('0x6'));var config=require('../../config/environment');var jayson=require(_0x0a58('0x7'));var client=jayson[_0x0a58('0x8')][_0x0a58('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x196bb1,_0x2d189f,_0x16e7a2){return new BPromise(function(_0x1c35c2,_0x573e06){return client[_0x0a58('0xa')](_0x196bb1,_0x16e7a2)[_0x0a58('0xb')](function(_0x4ba4f0){logger[_0x0a58('0xc')]('MailApplication,\x20%s,\x20%s',_0x2d189f,_0x0a58('0xd'));logger[_0x0a58('0xe')](_0x0a58('0xf'),_0x2d189f,_0x0a58('0xd'),JSON['stringify'](_0x4ba4f0));if(_0x4ba4f0[_0x0a58('0x10')]){if(_0x4ba4f0['error'][_0x0a58('0x11')]===0x1f4){logger[_0x0a58('0x10')](_0x0a58('0x12'),_0x2d189f,_0x4ba4f0[_0x0a58('0x10')][_0x0a58('0x13')]);return _0x573e06(_0x4ba4f0[_0x0a58('0x10')][_0x0a58('0x13')]);}logger[_0x0a58('0x10')]('MailApplication,\x20%s,\x20%s',_0x2d189f,_0x4ba4f0[_0x0a58('0x10')][_0x0a58('0x13')]);return _0x1c35c2(_0x4ba4f0['error'][_0x0a58('0x13')]);}else{logger['info'](_0x0a58('0x12'),_0x2d189f,'request\x20sent');_0x1c35c2(_0x4ba4f0[_0x0a58('0x14')][_0x0a58('0x13')]);}})['catch'](function(_0x43b727){logger[_0x0a58('0x10')](_0x0a58('0x12'),_0x2d189f,_0x43b727);_0x573e06(_0x43b727);});});}exports[_0x0a58('0x15')]=function(_0x590952){var _0x7e626c=this;return new Promise(function(_0x5f5a64,_0x3f53ad){return db[_0x0a58('0x16')]['update'](_0x590952[_0x0a58('0x17')],{'raw':_0x590952['options']?_0x590952['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x590952[_0x0a58('0x18')]?_0x590952[_0x0a58('0x18')]['where']||null:null,'attributes':_0x590952[_0x0a58('0x18')]?_0x590952[_0x0a58('0x18')][_0x0a58('0x19')]||null:null,'limit':_0x590952['options']?_0x590952[_0x0a58('0x18')][_0x0a58('0x1a')]||null:null})[_0x0a58('0xb')](function(_0x2511e2){logger['info']('UpdateMailApplication',_0x590952);logger[_0x0a58('0xe')](_0x0a58('0x15'),_0x590952,JSON[_0x0a58('0x1b')](_0x2511e2));_0x5f5a64(_0x2511e2);})[_0x0a58('0x1c')](function(_0x13ae80){logger[_0x0a58('0x10')](_0x0a58('0x15'),_0x13ae80[_0x0a58('0x13')],_0x590952);_0x3f53ad(_0x7e626c['error'](0x1f4,_0x13ae80['message']));});});}; \ No newline at end of file +var _0x53cc=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateMailApplication','update','body','options','raw','limit','stringify','lodash','util'];(function(_0x702962,_0x136ec1){var _0x5aacd2=function(_0x57b7f7){while(--_0x57b7f7){_0x702962['push'](_0x702962['shift']());}};_0x5aacd2(++_0x136ec1);}(_0x53cc,0x1a2));var _0xc53c=function(_0x3b53b0,_0x23dc58){_0x3b53b0=_0x3b53b0-0x0;var _0x4eddc6=_0x53cc[_0x3b53b0];return _0x4eddc6;};'use strict';var _=require(_0xc53c('0x0'));var util=require(_0xc53c('0x1'));var moment=require('moment');var BPromise=require(_0xc53c('0x2'));var rs=require(_0xc53c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc53c('0x4'))['db'];var utils=require(_0xc53c('0x5'));var logger=require(_0xc53c('0x6'))(_0xc53c('0x7'));var config=require(_0xc53c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53c('0x9')][_0xc53c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32e36f,_0x1c788a,_0x2bf438){return new BPromise(function(_0x45b15b,_0xc48e8f){return client[_0xc53c('0xb')](_0x32e36f,_0x2bf438)['then'](function(_0x498a30){logger[_0xc53c('0xc')](_0xc53c('0xd'),_0x1c788a,_0xc53c('0xe'));logger[_0xc53c('0xf')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x1c788a,'request\x20sent',JSON['stringify'](_0x498a30));if(_0x498a30[_0xc53c('0x10')]){if(_0x498a30[_0xc53c('0x10')][_0xc53c('0x11')]===0x1f4){logger['error'](_0xc53c('0xd'),_0x1c788a,_0x498a30['error'][_0xc53c('0x12')]);return _0xc48e8f(_0x498a30[_0xc53c('0x10')]['message']);}logger['error']('MailApplication,\x20%s,\x20%s',_0x1c788a,_0x498a30[_0xc53c('0x10')]['message']);return _0x45b15b(_0x498a30['error'][_0xc53c('0x12')]);}else{logger['info'](_0xc53c('0xd'),_0x1c788a,_0xc53c('0xe'));_0x45b15b(_0x498a30[_0xc53c('0x13')][_0xc53c('0x12')]);}})[_0xc53c('0x14')](function(_0x2a5308){logger['error'](_0xc53c('0xd'),_0x1c788a,_0x2a5308);_0xc48e8f(_0x2a5308);});});}exports[_0xc53c('0x15')]=function(_0x15c755){var _0x329b66=this;return new Promise(function(_0x4a3263,_0x3a2183){return db['MailApplication'][_0xc53c('0x16')](_0x15c755[_0xc53c('0x17')],{'raw':_0x15c755[_0xc53c('0x18')]?_0x15c755[_0xc53c('0x18')][_0xc53c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15c755[_0xc53c('0x18')]?_0x15c755[_0xc53c('0x18')]['where']||null:null,'attributes':_0x15c755[_0xc53c('0x18')]?_0x15c755['options']['attributes']||null:null,'limit':_0x15c755['options']?_0x15c755[_0xc53c('0x18')][_0xc53c('0x1a')]||null:null})['then'](function(_0x474dfd){logger[_0xc53c('0xc')](_0xc53c('0x15'),_0x15c755);logger[_0xc53c('0xf')](_0xc53c('0x15'),_0x15c755,JSON[_0xc53c('0x1b')](_0x474dfd));_0x4a3263(_0x474dfd);})[_0xc53c('0x14')](function(_0x2aac79){logger[_0xc53c('0x10')](_0xc53c('0x15'),_0x2aac79['message'],_0x15c755);_0x3a2183(_0x329b66[_0xc53c('0x10')](0x1f4,_0x2aac79['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 90f8617..7a422fa 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 _0x078e=['getMessages','download','post','create','/:id/tags','tracked','mailinteraction:addtags','addTags','put','/:id','mailinteraction:update','delete','mail','destroy','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x078e,0x1e9));var _0xe078=function(_0x55fc09,_0x115afe){_0x55fc09=_0x55fc09-0x0;var _0xe70f62=_0x078e[_0x55fc09];return _0xe70f62;};'use strict';var express=require('express');var router=express[_0xe078('0x0')]();var auth=require(_0xe078('0x1'));var interaction=require(_0xe078('0x2'));var controller=require(_0xe078('0x3'));router[_0xe078('0x4')]('/',auth[_0xe078('0x5')](),controller[_0xe078('0x6')]);router[_0xe078('0x4')](_0xe078('0x7'),auth[_0xe078('0x5')](),controller[_0xe078('0x8')]);router[_0xe078('0x4')]('/:id',auth[_0xe078('0x5')](),controller[_0xe078('0x9')]);router[_0xe078('0x4')](_0xe078('0xa'),auth[_0xe078('0x5')](),controller[_0xe078('0xb')]);router['get']('/:id/download',auth[_0xe078('0x5')](),controller[_0xe078('0xc')]);router[_0xe078('0xd')]('/',auth[_0xe078('0x5')](),controller[_0xe078('0xe')]);router[_0xe078('0xd')](_0xe078('0xa'),auth[_0xe078('0x5')](),controller['addMessage']);router['post'](_0xe078('0xf'),auth[_0xe078('0x5')](),interaction[_0xe078('0x10')]('mail',_0xe078('0x11')),controller[_0xe078('0x12')]);router[_0xe078('0x13')](_0xe078('0x14'),auth[_0xe078('0x5')](),interaction['tracked']('mail',_0xe078('0x15')),controller['update']);router[_0xe078('0x16')]('/:id',auth[_0xe078('0x5')](),interaction[_0xe078('0x10')](_0xe078('0x17'),'mailinteraction:destroy'),controller[_0xe078('0x18')]);router[_0xe078('0x16')](_0xe078('0xf'),auth[_0xe078('0x5')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x2493=['addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','removeTags','express','Router','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','/:id','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','mail'];(function(_0x3a721e,_0x176fd9){var _0x551348=function(_0x278d44){while(--_0x278d44){_0x3a721e['push'](_0x3a721e['shift']());}};_0x551348(++_0x176fd9);}(_0x2493,0x173));var _0x3249=function(_0x2dc4f4,_0x540a35){_0x2dc4f4=_0x2dc4f4-0x0;var _0xc1f75a=_0x2493[_0x2dc4f4];return _0xc1f75a;};'use strict';var express=require(_0x3249('0x0'));var router=express[_0x3249('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x3249('0x2'));var controller=require(_0x3249('0x3'));router[_0x3249('0x4')]('/',auth['isAuthenticated'](),controller[_0x3249('0x5')]);router[_0x3249('0x4')](_0x3249('0x6'),auth[_0x3249('0x7')](),controller['describe']);router[_0x3249('0x4')](_0x3249('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x3249('0x4')](_0x3249('0x9'),auth[_0x3249('0x7')](),controller[_0x3249('0xa')]);router['get'](_0x3249('0xb'),auth['isAuthenticated'](),controller[_0x3249('0xc')]);router['post']('/',auth[_0x3249('0x7')](),controller[_0x3249('0xd')]);router[_0x3249('0xe')](_0x3249('0x9'),auth[_0x3249('0x7')](),controller[_0x3249('0xf')]);router['post'](_0x3249('0x10'),auth[_0x3249('0x7')](),interaction[_0x3249('0x11')](_0x3249('0x12'),'mailinteraction:addtags'),controller[_0x3249('0x13')]);router[_0x3249('0x14')](_0x3249('0x8'),auth[_0x3249('0x7')](),interaction[_0x3249('0x11')](_0x3249('0x12'),_0x3249('0x15')),controller[_0x3249('0x16')]);router[_0x3249('0x17')](_0x3249('0x8'),auth[_0x3249('0x7')](),interaction[_0x3249('0x11')](_0x3249('0x12'),_0x3249('0x18')),controller['destroy']);router['delete']('/:id/tags',auth[_0x3249('0x7')](),controller[_0x3249('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 9f04d6f..ec546c2 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 _0xdf86=['TEXT','DATE','out','ENUM','sequelize','exports','BOOLEAN','STRING'];(function(_0x44913b,_0x2b60cd){var _0x509a6c=function(_0x407f9d){while(--_0x407f9d){_0x44913b['push'](_0x44913b['shift']());}};_0x509a6c(++_0x2b60cd);}(_0xdf86,0x174));var _0x6df8=function(_0x5a6644,_0x45d612){_0x5a6644=_0x5a6644-0x0;var _0x3a2a5d=_0xdf86[_0x5a6644];return _0x3a2a5d;};'use strict';var Sequelize=require(_0x6df8('0x0'));var iconv=require('iconv');module[_0x6df8('0x1')]={'closed':{'type':Sequelize[_0x6df8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6df8('0x3')]},'secondDisposition':{'type':Sequelize[_0x6df8('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6df8('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x6df8('0x3')](0x1fe)},'to':{'type':Sequelize[_0x6df8('0x3')]},'cc':{'type':Sequelize[_0x6df8('0x4')]('long')},'subject':{'type':Sequelize[_0x6df8('0x4')]()},'attach':{'type':Sequelize[_0x6df8('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x6df8('0x5')]},'substatus':{'type':Sequelize[_0x6df8('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x6df8('0x5')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6df8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6df8('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x6df8('0x7')]('in',_0x6df8('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6df8('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x37b1=['ENUM','BOOLEAN','sequelize','exports','STRING','TEXT','long','DATE','out'];(function(_0xa33156,_0x40f459){var _0x519ec6=function(_0x1b4d0c){while(--_0x1b4d0c){_0xa33156['push'](_0xa33156['shift']());}};_0x519ec6(++_0x40f459);}(_0x37b1,0x92));var _0x137b=function(_0x589878,_0x4e25ff){_0x589878=_0x589878-0x0;var _0x58d9d2=_0x37b1[_0x589878];return _0x58d9d2;};'use strict';var Sequelize=require(_0x137b('0x0'));var iconv=require('iconv');module[_0x137b('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x137b('0x2')]},'thirdDisposition':{'type':Sequelize[_0x137b('0x2')]},'note':{'type':Sequelize[_0x137b('0x2')]},'inReplyTo':{'type':Sequelize[_0x137b('0x2')](0x1fe)},'to':{'type':Sequelize[_0x137b('0x2')]},'cc':{'type':Sequelize[_0x137b('0x3')](_0x137b('0x4'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x137b('0x5')]},'substatus':{'type':Sequelize[_0x137b('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0x137b('0x5')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x137b('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x137b('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x137b('0x7')]('in',_0x137b('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x137b('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index c36bcff..4937b4c 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 _0x9212=['user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','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','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','forEach','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','isEmail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','MailAccountId','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','MailInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','create','body','update','describe','addMessage','ids','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','addTags','setTags','spread','findAll','emit','removeTags','download','unix','join','server','files','tmp','root','transcript-%d-%s.zip','Attachment','Messages','bcc','subject','get','mkdirSync','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','attachments','readFileSync','build','writeFileSync','eml-format','rimraf','zip-dir','moment','bluebird','util','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','html-entities','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','status','json','limit','offset','count','set','Content-Range','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','TagIds','split','push','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','then','waiting','talking','answered','unmanaged','total','UserId','closed','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','field','from','tools_tags','select','u.id','u.fullname','ui.MailInteractionId'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x9212,0xa0));var _0x2921=function(_0x215dc8,_0x52c245){_0x215dc8=_0x215dc8-0x0;var _0x583ea3=_0x9212[_0x215dc8];return _0x583ea3;};'use strict';var emlformat=require(_0x2921('0x0'));var rimraf=require(_0x2921('0x1'));var zipdir=require(_0x2921('0x2'));var moment=require(_0x2921('0x3'));var BPromise=require(_0x2921('0x4'));var util=require(_0x2921('0x5'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require('squel');var juice=require(_0x2921('0x6'));var Redis=require(_0x2921('0x7'));var qs=require(_0x2921('0x8'));var as=require(_0x2921('0x9'));var logger=require(_0x2921('0xa'))('api');var config=require('../../config/environment');var db=require(_0x2921('0xb'))['db'];var htmlEntities=require(_0x2921('0xc'));config['redis']=_[_0x2921('0xd')](config[_0x2921('0xe')],{'host':_0x2921('0xf'),'port':0x18eb});var socket=require(_0x2921('0x10'))(new Redis(config[_0x2921('0xe')]));require(_0x2921('0x11'))[_0x2921('0x12')](socket);function respondWithStatusCode(_0x2e661f,_0x51f8a0){_0x51f8a0=_0x51f8a0||0xcc;return function(_0x5af298){if(_0x5af298){return _0x2e661f['sendStatus'](_0x51f8a0);}return _0x2e661f[_0x2921('0x13')](_0x51f8a0)['end']();};}function respondWithResult(_0x2b7500,_0x2b7f3e){_0x2b7f3e=_0x2b7f3e||0xc8;return function(_0xd83b14){if(_0xd83b14){return _0x2b7500[_0x2921('0x13')](_0x2b7f3e)[_0x2921('0x14')](_0xd83b14);}};}function respondWithFilteredResult(_0x29ae5f,_0x29cf03){return function(_0x19c102){if(_0x19c102){var _0x3deb0f=typeof _0x29cf03['offset']==='undefined'&&typeof _0x29cf03[_0x2921('0x15')]==='undefined';var _0x3d4cbc=_0x19c102['count'];var _0x3c8caf=_0x3deb0f?0x0:_0x29cf03[_0x2921('0x16')];var _0x5f5c40=_0x3deb0f?_0x19c102[_0x2921('0x17')]:_0x29cf03[_0x2921('0x16')]+_0x29cf03[_0x2921('0x15')];var _0x21f821;if(_0x5f5c40>=_0x3d4cbc){_0x5f5c40=_0x3d4cbc;_0x21f821=0xc8;}else{_0x21f821=0xce;}_0x29ae5f[_0x2921('0x13')](_0x21f821);return _0x29ae5f[_0x2921('0x18')](_0x2921('0x19'),_0x3c8caf+'-'+_0x5f5c40+'/'+_0x3d4cbc)[_0x2921('0x14')](_0x19c102);}return null;};}function saveUpdates(_0x1004a5){return function(_0x104651){if(_0x104651){return _0x104651['update'](_0x1004a5)['then'](function(_0x2acd2b){return _0x2acd2b;});}return null;};}function removeEntity(_0x28eac4){return function(_0x3069a9){if(_0x3069a9){return _0x3069a9[_0x2921('0x1a')]()['then'](function(){_0x28eac4[_0x2921('0x13')](0xcc)[_0x2921('0x1b')]();});}};}function handleEntityNotFound(_0x4a295a){return function(_0x52c628){if(!_0x52c628){_0x4a295a[_0x2921('0x1c')](0x194);}return _0x52c628;};}function handleError(_0x39d91f,_0x14fb1f){_0x14fb1f=_0x14fb1f||0x1f4;return function(_0x3779af){logger[_0x2921('0x1d')](_0x3779af[_0x2921('0x1e')]);if(_0x3779af[_0x2921('0x1f')]){delete _0x3779af[_0x2921('0x1f')];}_0x39d91f['status'](_0x14fb1f)[_0x2921('0x20')](_0x3779af);};}function getInteractionUsers(_0x5daaf6,_0x10e935){return new BPromise(function(_0x3a900d,_0x3d6b1a){try{if(_0x10e935[_0x5daaf6['id']]){_0x5daaf6[_0x2921('0x21')]=_['map'](_0x10e935[_0x5daaf6['id']],function(_0x5d28bd){return{'id':_0x5d28bd['id'],'fullname':_0x5d28bd[_0x2921('0x22')]};});}}catch(_0x1dba28){_0x3d6b1a(_0x1dba28);}_0x3a900d(_0x5daaf6);});}function getInteractionTags(_0x8e5ecf,_0xfe3aac){return new BPromise(function(_0x564a9e,_0x7bdc7){try{if(_0x8e5ecf['TagIds']){_0x8e5ecf[_0x2921('0x23')]=[];_0x8e5ecf[_0x2921('0x24')][_0x2921('0x25')](',')['forEach'](function(_0xc4c3e1){_0x8e5ecf[_0x2921('0x23')][_0x2921('0x26')](_0xfe3aac[_0xc4c3e1]);});}delete _0x8e5ecf[_0x2921('0x24')];}catch(_0x18a14c){_0x7bdc7(_0x18a14c);}_0x564a9e(_0x8e5ecf);});}function getLastMessageText(_0x50f08f){return new BPromise(function(_0xa69914,_0x2b673f){return db[_0x2921('0x27')][_0x2921('0x28')]({'where':{'$and':[{'MailInteractionId':_0x50f08f['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x2921('0x29')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x2921('0x2a')],'order':_0x2921('0x2b'),'raw':!![]})['then'](function(_0x82ca2a){if(_0x82ca2a&&_0x82ca2a[_0x2921('0x2a')]){_0x50f08f[_0x2921('0x2c')]=_[_0x2921('0x2d')](_0x82ca2a[_0x2921('0x2a')]);}_0xa69914(_0x50f08f);})[_0x2921('0x2e')](function(_0x56e1c4){_0x2b673f(_0x56e1c4);});});}function updateMailInteraction(_0x458e67,_0x14e60b,_0x157ddf,_0x53919d){return new BPromise(function(_0x5f5dc1,_0x50f122){return getInteractionUsers(_0x458e67,_0x157ddf)[_0x2921('0x2f')](function(_0x4314a2){return getInteractionTags(_0x4314a2,_0x14e60b);})['then'](function(_0x30f4d8){return getStateInteraction(_0x30f4d8);})[_0x2921('0x2f')](function(_0x167efb){if(_0x53919d){_0x5f5dc1(getLastMessageText(_0x167efb));}else{_0x5f5dc1(_0x167efb);}})['catch'](function(_0x5afb67){_0x50f122(_0x5afb67);});});}function getStateInteraction(_0x4d91ce){return new BPromise(function(_0x2c7001){_0x4d91ce[_0x2921('0x30')]=0x0;_0x4d91ce[_0x2921('0x31')]=0x0;_0x4d91ce[_0x2921('0x32')]=0x0;_0x4d91ce[_0x2921('0x33')]=0x0;_0x4d91ce[_0x2921('0x34')]=0x0;if(!_0x4d91ce['closed']&&!_0x4d91ce[_0x2921('0x35')]){_0x4d91ce[_0x2921('0x30')]+=0x1;}if(!_0x4d91ce[_0x2921('0x36')]&&_0x4d91ce['UserId']){_0x4d91ce[_0x2921('0x31')]+=0x1;if(_0x4d91ce['waiting']){_0x4d91ce[_0x2921('0x30')]-=0x1;}}if(_0x4d91ce[_0x2921('0x36')]&&_0x4d91ce[_0x2921('0x35')]){_0x4d91ce[_0x2921('0x32')]+=0x1;if(_0x4d91ce['talking']){_0x4d91ce[_0x2921('0x31')]-=0x1;}}if(_0x4d91ce['closed']&&!_0x4d91ce[_0x2921('0x35')]){_0x4d91ce[_0x2921('0x33')]+=0x1;if(_0x4d91ce[_0x2921('0x30')]){_0x4d91ce[_0x2921('0x30')]-=0x1;}}_0x4d91ce[_0x2921('0x34')]+=0x1;_0x2c7001(_0x4d91ce);});}exports['index']=function(_0x283beb,_0x13fc70){var _0x14969c={},_0x4a0aef={},_0x54acd7={'count':0x0,'rows':[]};var _0x6c314e=_[_0x2921('0x37')](db['MailInteraction'][_0x2921('0x38')],function(_0xe0cb9a){return{'name':_0xe0cb9a[_0x2921('0x39')],'type':_0xe0cb9a[_0x2921('0x3a')][_0x2921('0x3b')]};});_0x4a0aef[_0x2921('0x3c')]=_['map'](_0x6c314e,_0x2921('0x1f'));_0x4a0aef[_0x2921('0x3d')]=_[_0x2921('0x3e')](_0x283beb[_0x2921('0x3d')]);_0x4a0aef[_0x2921('0x3f')]=_[_0x2921('0x40')](_0x4a0aef[_0x2921('0x3c')],_0x4a0aef[_0x2921('0x3d')]);_0x14969c[_0x2921('0x41')]=_[_0x2921('0x40')](_0x4a0aef['model'],qs['fields'](_0x283beb['query'][_0x2921('0x42')]));_0x14969c[_0x2921('0x41')]=_0x14969c[_0x2921('0x41')][_0x2921('0x43')]?_0x14969c[_0x2921('0x41')]:_0x4a0aef[_0x2921('0x3c')];if(!_0x283beb[_0x2921('0x3d')][_0x2921('0x44')]('nolimit')){_0x14969c['limit']=qs[_0x2921('0x15')](_0x283beb['query'][_0x2921('0x15')]);_0x14969c['offset']=qs[_0x2921('0x16')](_0x283beb[_0x2921('0x3d')]['offset']);}_0x14969c[_0x2921('0x45')]=qs[_0x2921('0x46')](_0x283beb['query'][_0x2921('0x46')]);_0x14969c[_0x2921('0x47')]=qs[_0x2921('0x3f')](_[_0x2921('0x48')](_0x283beb['query'],_0x4a0aef[_0x2921('0x3f')]),_0x6c314e);var _0x20e02a=[];var _0x2e006e=squel['select']()[_0x2921('0x49')]('id')[_0x2921('0x49')](_0x2921('0x1f'))[_0x2921('0x49')]('color')[_0x2921('0x4a')](_0x2921('0x4b'));var _0x34659b=squel[_0x2921('0x4c')]()[_0x2921('0x49')](_0x2921('0x4d'))[_0x2921('0x49')](_0x2921('0x4e'))[_0x2921('0x49')](_0x2921('0x4f'))[_0x2921('0x4a')](_0x2921('0x50'),'ui')['left_join'](_0x2921('0x51'),'u',_0x2921('0x52'));var _0x2342be=squel['select']()[_0x2921('0x4a')](_0x2921('0x53'),'i')['left_join'](_0x2921('0x54'),'c',_0x2921('0x55'))[_0x2921('0x56')](_0x2921('0x51'),'o',_0x2921('0x57'))[_0x2921('0x56')](_0x2921('0x58'),'a',_0x2921('0x59'))[_0x2921('0x56')](_0x2921('0x5a'),'me',_0x2921('0x5b'))[_0x2921('0x56')]('mail_interaction_has_tags','it',_0x2921('0x5c'))[_0x2921('0x56')](_0x2921('0x4b'),'t','t.id\x20=\x20it.TagId');var _0x1fc5e5=squel[_0x2921('0x5d')]();var _0x3a26cd=[];var _0x1e4292=squel[_0x2921('0x5d')]();var _0x2ab2d6;if(_0x283beb[_0x2921('0x3d')][_0x2921('0x5e')]){_0x2ab2d6=as['parseSearch'](_0x283beb[_0x2921('0x3d')]['search']);var _0x5956e4=_0x2ab2d6[_0x2921('0x5f')];for(var _0xe8312d=0x0;_0xe8312d<_0x2ab2d6['conditions'][_0x2921('0x43')];_0xe8312d++){var _0x326a47=_0x2ab2d6[_0x2921('0x60')][_0xe8312d];var _0x168d61='i';var _0x52193d=_[_0x2921('0x61')](_0x6c314e,[_0x2921('0x1f'),_0x326a47[_0x2921('0x49')]]);if(!_0x52193d){switch(_0x326a47['field']){case _0x2921('0x62'):if(_0x326a47[_0x2921('0x63')]==0x1){_0x2342be[_0x2921('0x64')]('`'+_0x326a47[_0x2921('0x49')]+'`\x20=\x200');}else{_0x2342be[_0x2921('0x64')]('`'+_0x326a47['field']+'`\x20>\x200');}break;case _0x2921('0x65'):if(_0x326a47[_0x2921('0x66')]===_0x2921('0x67')){if(_0x326a47[_0x2921('0x63')][_0x2921('0x25')]('\x20')['length']>0x1){_0x1fc5e5[_0x5956e4](_0x2921('0x68'),qs[_0x2921('0x69')](_0x326a47['value']),null);}else{var _0x917ab7='%'+_0x326a47[_0x2921('0x63')]+'%';_0x1fc5e5[_0x5956e4](_0x2921('0x6a'),_0x917ab7,_0x917ab7,_0x917ab7);}}else{_0x52193d=_[_0x2921('0x61')](_0x6c314e,[_0x2921('0x1f'),_0x2921('0x6b')]);_0x326a47[_0x2921('0x49')]='ContactId';_0x41cc58=as[_0x2921('0x6c')](_0x168d61,_0x52193d[_0x2921('0x3a')],_0x326a47);_0x1fc5e5[_0x5956e4](_0x41cc58[_0x2921('0x6d')],_0x41cc58['value'][_0x2921('0x6e')],_0x41cc58[_0x2921('0x63')]['end']);}break;case _0x2921('0x6f'):var _0x28755f=_0x326a47[_0x2921('0x63')]['split'](',')[_0x2921('0x37')](function(_0x1a2231){return Number(_0x1a2231);});_0x28755f['forEach'](function(_0x112a7f){_0x1e4292['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x112a7f+',%');});_0x3a26cd=_['union'](_0x3a26cd,_0x28755f);break;case'User':if(_0x326a47[_0x2921('0x66')]===_0x2921('0x67')){_0x1fc5e5[_0x5956e4](_0x2921('0x70'),'%'+_0x326a47[_0x2921('0x63')]+'%',null);}else{_0x52193d=_[_0x2921('0x61')](_0x6c314e,['name','UserId']);_0x326a47[_0x2921('0x49')]=_0x2921('0x35');_0x41cc58=as[_0x2921('0x6c')](_0x168d61,_0x52193d[_0x2921('0x3a')],_0x326a47);_0x1fc5e5[_0x5956e4](_0x41cc58[_0x2921('0x6d')],_0x41cc58['value'][_0x2921('0x6e')],_0x41cc58[_0x2921('0x63')][_0x2921('0x1b')]);}break;case'plainBody':_0x41cc58=as[_0x2921('0x6c')]('me',null,_0x326a47);_0x1fc5e5[_0x5956e4](_0x41cc58[_0x2921('0x6d')],_0x41cc58['value'][_0x2921('0x6e')],_0x41cc58['value']['end']);break;}}else{var _0x41cc58=as[_0x2921('0x6c')](_0x168d61,_0x52193d[_0x2921('0x3a')],_0x326a47);_0x1fc5e5[_0x5956e4](_0x41cc58[_0x2921('0x6d')],_0x41cc58[_0x2921('0x63')][_0x2921('0x6e')],_0x41cc58[_0x2921('0x63')][_0x2921('0x1b')]);}}}else{var _0x58cbad=_(_0x283beb[_0x2921('0x3d')])['keys']()[_0x2921('0x37')](function(_0x16ae0f){return _[_0x2921('0x71')](_0x6c314e,[_0x2921('0x1f'),_0x16ae0f])?_0x16ae0f:undefined;})[_0x2921('0x72')]()['value']();if(!_[_0x2921('0x73')](_0x58cbad)){_0x58cbad[_0x2921('0x74')](function(_0x399b87){if(_0x399b87==='MailAccountId'){_0x2342be['where'](_0x2921('0x75'),[][_0x2921('0x76')](_0x283beb['query'][_0x399b87]));}else if(_0x399b87===_0x2921('0x77')){var _0x114565=JSON[_0x2921('0x78')](_0x283beb[_0x2921('0x3d')][_0x399b87])[_0x2921('0x79')];var _0x26427d=JSON[_0x2921('0x78')](_0x283beb[_0x2921('0x3d')][_0x399b87])[_0x2921('0x7a')];_0x2342be[_0x2921('0x47')](_0x2921('0x7b'),_0x114565,_0x26427d);}else{if(_0x283beb[_0x2921('0x3d')][_0x399b87]==='null'){_0x2342be[_0x2921('0x47')]('i.'+_0x399b87+_0x2921('0x7c'));}else{_0x2342be[_0x2921('0x47')]('i.'+_0x399b87+_0x2921('0x7d'),_0x283beb[_0x2921('0x3d')][_0x399b87]);}}});}if(_0x283beb['query'][_0x2921('0x7e')]){if(_0x283beb[_0x2921('0x3d')][_0x2921('0x7e')]==0x1){_0x2342be[_0x2921('0x64')](_0x2921('0x7f'));}else{_0x2342be['having'](_0x2921('0x80'));}}if(_0x283beb[_0x2921('0x3d')]['tag']){_0x3a26cd=_[_0x2921('0x81')](_0x283beb[_0x2921('0x3d')][_0x2921('0x82')])?_0x283beb['query'][_0x2921('0x82')]:new Array(_0x283beb['query'][_0x2921('0x82')]);_0x3a26cd[_0x2921('0x74')](function(_0x45640a){_0x1e4292['or'](_0x2921('0x83'),'%,'+_0x45640a+',%');});}if(_0x283beb['query']['filter']){var _0x5909b4=_0x283beb['query'][_0x2921('0x84')]['replace']('\x5c','\x5c\x5c')[_0x2921('0x85')](/'/g,'\x27\x27');if(qs[_0x2921('0x86')](_0x5909b4)){_0x1fc5e5['or']('i.id\x20LIKE\x20?',_0x5909b4+'%');}else if(qs[_0x2921('0x87')](_0x5909b4)){_0x1fc5e5['or']('c.email\x20LIKE\x20?',_0x5909b4+'%');}else{_0x1fc5e5['or'](_0x2921('0x88'),qs['getFullTextValue'](_0x5909b4))['or'](_0x2921('0x89'),qs['getFullTextValue'](_0x5909b4));}}}_0x2342be['where'](_0x1fc5e5);_0x2342be[_0x2921('0x8a')](_0x2921('0x8b'));var _0x59abc0={'type':db[_0x2921('0x8c')][_0x2921('0x8d')][_0x2921('0x8e')],'raw':!![]};var _0x33e183=_0x2342be[_0x2921('0x8f')]();_0x33e183[_0x2921('0x49')](_0x2921('0x8b'));_0x33e183[_0x2921('0x49')](_0x2921('0x90'),'unreadMessages');if(_0x14969c[_0x2921('0x45')]){_0x14969c['order'][_0x2921('0x74')](function(_0x3fddc5){var _0x688be2=_0x3fddc5[0x0]===_0x2921('0x91')?_0x3fddc5[0x0]:'i.'+_0x3fddc5[0x0];_0x2342be[_0x2921('0x45')](_0x688be2,_0x3fddc5[0x1]==='DESC'?![]:!![]);});}if(!_[_0x2921('0x73')](_0x3a26cd)){_0x2342be[_0x2921('0x64')](_0x1e4292);_0x33e183[_0x2921('0x47')](_0x2921('0x92'),_0x3a26cd);}BPromise[_0x2921('0x93')]()['then'](function(){if(!_0x2ab2d6){if(_0x283beb[_0x2921('0x3d')][_0x2921('0x94')])return;_0x33e183[_0x2921('0x47')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x2342be[_0x2921('0x47')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x283beb[_0x2921('0x95')][_0x2921('0x96')]!==_0x2921('0x97'))return;return _0x283beb[_0x2921('0x95')][_0x2921('0x98')]({'attributes':['id'],'raw':!![]})[_0x2921('0x2f')](function(_0x44a3ff){if(_[_0x2921('0x73')](_0x44a3ff)){_0x33e183[_0x2921('0x47')](_0x2921('0x99'));_0x2342be[_0x2921('0x47')](_0x2921('0x99'));}else{_0x33e183[_0x2921('0x47')](_0x2921('0x75'),_[_0x2921('0x37')](_0x44a3ff,'id'));_0x2342be[_0x2921('0x47')](_0x2921('0x75'),_[_0x2921('0x37')](_0x44a3ff,'id'));}});})['then'](function(){if(_0x283beb['user'][_0x2921('0x96')]===_0x2921('0x97')&&!_0x2ab2d6&&!_0x283beb[_0x2921('0x3d')][_0x2921('0x94')])return[];return db[_0x2921('0x9a')][_0x2921('0x3d')](_0x33e183[_0x2921('0x9b')](),_0x59abc0);})[_0x2921('0x2f')](function(_0x3db0ae){_0x54acd7[_0x2921('0x17')]=_0x3db0ae['length'];if(_0x54acd7[_0x2921('0x17')]===0x0)return[];return db['sequelize'][_0x2921('0x3d')](_0x2e006e['toString'](),_0x59abc0)[_0x2921('0x2f')](function(_0x1a8631){_0x20e02a=_[_0x2921('0x9c')](_0x1a8631,'id');_0x59abc0=_[_0x2921('0x9d')](_0x59abc0,{'model':db[_0x2921('0x9e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x283beb[_0x2921('0x3d')][_0x2921('0x42')]){_0x14969c[_0x2921('0x41')][_0x2921('0x74')](function(_0x1070cf){_0x2342be[_0x2921('0x49')]('i.'+_0x1070cf);});}else{_0x2342be[_0x2921('0x49')](_0x2921('0x90'),_0x2921('0x62'));_0x2342be[_0x2921('0x49')](_0x2921('0x9f'),_0x2921('0xa0'));_0x2342be[_0x2921('0x49')](_0x2921('0xa1'),_0x2921('0xa2'));_0x2342be[_0x2921('0x49')](_0x2921('0xa3'),'Account.email');_0x2342be[_0x2921('0x49')](_0x2921('0xa4'),_0x2921('0x91'));_0x2342be[_0x2921('0x49')](_0x2921('0x8b'));_0x2342be[_0x2921('0x49')](_0x2921('0xa5'));_0x2342be['field']('i.updatedAt');_0x2342be[_0x2921('0x49')](_0x2921('0xa6'));_0x2342be[_0x2921('0x49')](_0x2921('0xa7'));_0x2342be[_0x2921('0x49')](_0x2921('0xa8'));_0x2342be['field'](_0x2921('0xa9'));_0x2342be[_0x2921('0x49')](_0x2921('0xaa'));_0x2342be[_0x2921('0x49')](_0x2921('0xab'));_0x2342be[_0x2921('0x49')](_0x2921('0xac'));_0x2342be['field']('i.secondDisposition');_0x2342be[_0x2921('0x49')](_0x2921('0xad'));_0x2342be['field'](_0x2921('0xae'));_0x2342be[_0x2921('0x49')](_0x2921('0xaf'));_0x2342be['field'](_0x2921('0xb0'));_0x2342be[_0x2921('0x49')](_0x2921('0xb1'));_0x2342be['field']('i.UserId');_0x2342be[_0x2921('0x49')](_0x2921('0xb2'),_0x2921('0xb3'));_0x2342be['field']('c.lastName',_0x2921('0xb4'));_0x2342be[_0x2921('0x49')]('c.email',_0x2921('0xb5'));_0x2342be[_0x2921('0x49')](_0x2921('0xb6'),_0x2921('0xb7'));_0x2342be[_0x2921('0x49')]('c.mobile',_0x2921('0xb8'));_0x2342be[_0x2921('0x49')](_0x2921('0xb9'),'Contact.fax');_0x2342be['field']('o.fullname','Owner.fullname');_0x2342be['field']('o.internal','Owner.internal');_0x2342be[_0x2921('0x49')](_0x2921('0xba'),'TagIds');}if(_0x14969c[_0x2921('0x15')])_0x2342be[_0x2921('0x15')](_0x14969c[_0x2921('0x15')]);if(_0x14969c[_0x2921('0x16')])_0x2342be[_0x2921('0x16')](_0x14969c['offset']);return db[_0x2921('0x9a')]['query'](_0x2342be['toString'](),_0x59abc0);})[_0x2921('0x2f')](function(_0x5d4b72){if(_0x5d4b72['length']>0x0)_0x34659b[_0x2921('0x47')](_0x2921('0xbb'),_[_0x2921('0x37')](_0x5d4b72,'id'));return db['sequelize'][_0x2921('0x3d')](_0x34659b[_0x2921('0x9b')](),_0x59abc0)[_0x2921('0x2f')](function(_0x5e0002){var _0x2bf079=_[_0x2921('0xbc')](_0x5e0002,_0x2921('0xbd'));var _0xda084a=[];return db[_0x2921('0xbe')][_0x2921('0x28')]({'attributes':[_0x2921('0xbf')],'raw':!![]})[_0x2921('0x2f')](function(_0x23b810){var _0x371afc=_0x23b810['enableEmailPreview'];_0x5d4b72[_0x2921('0x74')](function(_0x5d2df){_0xda084a[_0x2921('0x26')](updateMailInteraction(_0x5d2df,_0x20e02a,_0x2bf079,_0x371afc));});return BPromise[_0x2921('0xc0')](_0xda084a);});});});})[_0x2921('0x2f')](function(_0x10f00e){_0x54acd7[_0x2921('0xc1')]=_0x10f00e;return _0x54acd7;})[_0x2921('0x2f')](respondWithFilteredResult(_0x13fc70,_0x14969c))[_0x2921('0x2e')](handleError(_0x13fc70,null));};exports[_0x2921('0xc2')]=function(_0x17ff2f,_0x4d629f){var _0x2b97ad={'raw':![],'where':{'id':_0x17ff2f[_0x2921('0xc3')]['id']}},_0x339cd={};_0x339cd[_0x2921('0x3c')]=_['keys'](db[_0x2921('0x9e')][_0x2921('0x38')]);_0x339cd['query']=_['keys'](_0x17ff2f[_0x2921('0x3d')]);_0x339cd[_0x2921('0x3f')]=_[_0x2921('0x40')](_0x339cd[_0x2921('0x3c')],_0x339cd['query']);_0x2b97ad['attributes']=_[_0x2921('0x40')](_0x339cd[_0x2921('0x3c')],qs[_0x2921('0x42')](_0x17ff2f[_0x2921('0x3d')][_0x2921('0x42')]));_0x2b97ad['attributes']=_0x2b97ad[_0x2921('0x41')][_0x2921('0x43')]?_0x2b97ad['attributes']:_0x339cd[_0x2921('0x3c')];if(_0x17ff2f[_0x2921('0x3d')][_0x2921('0xc4')]){_0x2b97ad[_0x2921('0xc5')]=[{'all':!![]}];}_0x2b97ad=_['merge']({},_0x2b97ad,_0x17ff2f['options']);return db[_0x2921('0x9e')]['find'](_0x2b97ad)[_0x2921('0x2f')](handleEntityNotFound(_0x4d629f,null))[_0x2921('0x2f')](respondWithResult(_0x4d629f,null))[_0x2921('0x2e')](handleError(_0x4d629f,null));};exports[_0x2921('0xc6')]=function(_0xcc0d60,_0xc3a38f){return db['MailInteraction']['create'](_0xcc0d60[_0x2921('0xc7')],{})[_0x2921('0x2f')](respondWithResult(_0xc3a38f,0xc9))['catch'](handleError(_0xc3a38f,null));};exports[_0x2921('0xc8')]=function(_0x23ef5a,_0x4db83c){if(_0x23ef5a[_0x2921('0xc7')]['id']){delete _0x23ef5a['body']['id'];}return db[_0x2921('0x9e')][_0x2921('0x61')]({'where':{'id':_0x23ef5a['params']['id']}})[_0x2921('0x2f')](handleEntityNotFound(_0x4db83c,null))['then'](saveUpdates(_0x23ef5a[_0x2921('0xc7')],null))['then'](respondWithResult(_0x4db83c,null))['catch'](handleError(_0x4db83c,null));};exports[_0x2921('0x1a')]=function(_0x39d042,_0x1c710d){return db[_0x2921('0x9e')][_0x2921('0x61')]({'where':{'id':_0x39d042[_0x2921('0xc3')]['id']}})[_0x2921('0x2f')](handleEntityNotFound(_0x1c710d,null))['then'](removeEntity(_0x1c710d,null))[_0x2921('0x2e')](handleError(_0x1c710d,null));};exports[_0x2921('0xc9')]=function(_0x54ddfa,_0x1936f0){return db[_0x2921('0x9e')][_0x2921('0xc9')]()['then'](respondWithResult(_0x1936f0,null))[_0x2921('0x2e')](handleError(_0x1936f0,null));};exports['addMessage']=function(_0x259494,_0x2551c2){return db[_0x2921('0x27')][_0x2921('0x61')]({'where':{'id':_0x259494[_0x2921('0xc3')]['id']}})[_0x2921('0x2f')](handleEntityNotFound(_0x2551c2,null))[_0x2921('0x2f')](function(_0x2f7807){if(_0x2f7807){return _0x2f7807[_0x2921('0xca')](_0x259494[_0x2921('0xc7')]['ids'],_['omit'](_0x259494[_0x2921('0xc7')],[_0x2921('0xcb'),'id'])||{});}})[_0x2921('0x2f')](respondWithResult(_0x2551c2,null))[_0x2921('0x2e')](handleError(_0x2551c2,null));};exports['getMessages']=function(_0x3aed92,_0x1a4cba){var _0x7f57a5={'raw':![],'where':{}};var _0xf8e4bb={};var _0x331cf2={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x3aed92[_0x2921('0xc3')]['id']}})[_0x2921('0x2f')](handleEntityNotFound(_0x1a4cba,null))[_0x2921('0x2f')](function(_0x214e19){if(_0x214e19){_0xf8e4bb[_0x2921('0x3c')]=_[_0x2921('0x3e')](db[_0x2921('0x27')][_0x2921('0x38')]);_0xf8e4bb[_0x2921('0x3d')]=_[_0x2921('0x3e')](_0x3aed92[_0x2921('0x3d')]);_0xf8e4bb[_0x2921('0x3f')]=_[_0x2921('0x40')](_0xf8e4bb['model'],_0xf8e4bb[_0x2921('0x3d')]);_0x7f57a5['attributes']=_[_0x2921('0x40')](_0xf8e4bb['model'],qs[_0x2921('0x42')](_0x3aed92[_0x2921('0x3d')]['fields']));_0x7f57a5['attributes']=_0x7f57a5[_0x2921('0x41')][_0x2921('0x43')]?_0x7f57a5[_0x2921('0x41')]:_0xf8e4bb[_0x2921('0x3c')];if(!_0x3aed92[_0x2921('0x3d')]['hasOwnProperty']('nolimit')){_0x7f57a5[_0x2921('0x15')]=qs[_0x2921('0x15')](_0x3aed92[_0x2921('0x3d')][_0x2921('0x15')]);_0x7f57a5[_0x2921('0x16')]=qs['offset'](_0x3aed92[_0x2921('0x3d')][_0x2921('0x16')]);}_0x7f57a5['order']=qs[_0x2921('0x46')](_0x3aed92[_0x2921('0x3d')][_0x2921('0x46')]);_0x7f57a5[_0x2921('0x47')]=qs[_0x2921('0x3f')](_[_0x2921('0x48')](_0x3aed92[_0x2921('0x3d')],_0xf8e4bb[_0x2921('0x3f')]));_0x7f57a5['where'][_0x2921('0xbd')]=_0x214e19['id'];if(_0x3aed92[_0x2921('0x3d')]['filter']){_0x7f57a5[_0x2921('0x47')]=_[_0x2921('0x9d')](_0x7f57a5[_0x2921('0x47')],{'$or':_[_0x2921('0x37')](_0x7f57a5[_0x2921('0x41')],function(_0x4fc645){var _0x49498={};_0x49498[_0x4fc645]={'$like':'%'+_0x3aed92['query'][_0x2921('0x84')]+'%'};return _0x49498;})});}if(_0x3aed92['query'][_0x2921('0x79')]){var _0x51ddd4=_0x3aed92['query']['$gte'][_0x2921('0x25')](',');var _0x170e7d={};_0x170e7d[_0x51ddd4[0x0]]={'$gte':moment(_0x51ddd4[0x1])[_0x2921('0xcc')](_0x2921('0xcd'))};_0x7f57a5[_0x2921('0x47')]=_[_0x2921('0x9d')](_0x7f57a5['where'],_0x170e7d);}_0x7f57a5=_[_0x2921('0x9d')]({},_0x7f57a5,_0x3aed92['options']);return db['MailMessage'][_0x2921('0x17')]({'where':_0x7f57a5[_0x2921('0x47')]})['then'](function(_0x4b9bda){_0x331cf2[_0x2921('0x17')]=_0x4b9bda;if(_0x3aed92[_0x2921('0x3d')][_0x2921('0xc4')]){_0x7f57a5[_0x2921('0xc5')]=[{'all':!![]}];}return db[_0x2921('0x27')]['findAll'](_0x7f57a5);})[_0x2921('0x2f')](function(_0x137044){if(_0x3aed92['query'][_0x2921('0xce')]===_0x2921('0xcf')){for(var _0x35ba0e=0x0;_0x35ba0e<_0x137044[_0x2921('0x43')];_0x35ba0e++){_0x137044[_0x35ba0e][_0x2921('0xc7')]=juice(_0x137044[_0x35ba0e][_0x2921('0xc7')]);}}_0x331cf2[_0x2921('0xc1')]=_0x137044;return _0x331cf2;});}})[_0x2921('0x2f')](respondWithFilteredResult(_0x1a4cba,_0x7f57a5))['catch'](handleError(_0x1a4cba,null));};exports[_0x2921('0xd0')]=function(_0x3475a4,_0x4295d0){return db['MailInteraction'][_0x2921('0x61')]({'where':{'id':_0x3475a4[_0x2921('0xc3')]['id']}})[_0x2921('0x2f')](handleEntityNotFound(_0x4295d0,null))['then'](function(_0x4d0385){if(_0x4d0385){return _0x4d0385[_0x2921('0xd1')](_0x3475a4[_0x2921('0xc7')][_0x2921('0xcb')],_['omit'](_0x3475a4[_0x2921('0xc7')],[_0x2921('0xcb'),'id'])||{})[_0x2921('0xd2')](function(){return db[_0x2921('0x6f')][_0x2921('0xd3')]({'attributes':['id',_0x2921('0x1f'),'color'],'where':{'id':_0x3475a4[_0x2921('0xc7')][_0x2921('0xcb')]}});})[_0x2921('0x2f')](function(_0x478a11){socket[_0x2921('0xd4')]('mailInteractionTags:save',{'id':Number(_0x3475a4['params']['id']),'tags':_0x478a11||[]});return{'id':Number(_0x3475a4['params']['id']),'tags':_0x478a11||[]};});}})[_0x2921('0x2f')](respondWithResult(_0x4295d0,null))['catch'](handleError(_0x4295d0,null));};exports[_0x2921('0xd5')]=function(_0x2e9c10,_0x27e993){return db[_0x2921('0x9e')]['find']({'where':{'id':_0x2e9c10[_0x2921('0xc3')]['id']}})[_0x2921('0x2f')](handleEntityNotFound(_0x27e993,null))[_0x2921('0x2f')](function(_0x353a61){if(_0x353a61){return _0x353a61[_0x2921('0xd5')](_0x2e9c10[_0x2921('0x3d')]['ids']);}})['then'](respondWithStatusCode(_0x27e993,null))[_0x2921('0x2e')](handleError(_0x27e993,null));};exports[_0x2921('0xd6')]=function(_0x417eeb,_0xea5e4f){var _0x32f654=moment()[_0x2921('0xd7')]()[_0x2921('0x9b')]();var _0x2e110c=path[_0x2921('0xd8')](config['root'],_0x2921('0xd9'),_0x2921('0xda'),_0x2921('0xdb'));var _0x30544a=path[_0x2921('0xd8')](config[_0x2921('0xdc')],_0x2921('0xd9'),_0x2921('0xda'),'attachments');var _0xf854aa=path['join'](_0x2e110c,_0x32f654);var _0x3dad88=util[_0x2921('0xcc')](_0x2921('0xdd'),_0x417eeb[_0x2921('0xc3')]['id'],_0x32f654);var _0x48c581=path[_0x2921('0xd8')](_0x2e110c,_0x3dad88);var _0x381574=[];if(_0x417eeb[_0x2921('0x3d')]['attachments']){_0x381574[_0x2921('0x26')]({'model':db[_0x2921('0xde')],'as':'Attachments','raw':!![]});}var _0x22a4e7=[{'model':db['MailMessage'],'as':_0x2921('0xdf'),'attributes':['id',_0x2921('0xc7'),_0x2921('0x4a'),'to','cc',_0x2921('0xe0'),_0x2921('0xe1'),'createdAt'],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x381574}];return db[_0x2921('0x9e')][_0x2921('0x61')]({'where':{'id':_0x417eeb['params']['id']},'include':_0x22a4e7})[_0x2921('0x2f')](handleEntityNotFound(_0xea5e4f,null))[_0x2921('0x2f')](function(_0x516a96){if(_0x516a96&&_0x516a96[_0x2921('0xdf')]){var _0x2dc215=_0x516a96[_0x2921('0xe2')]({'plain':!![]});fs[_0x2921('0xe3')](_0xf854aa);return BPromise[_0x2921('0xe4')](_0x2dc215['Messages'],function(_0x50f0c5,_0x4f7b61){var _0x30d7a8={'from':_0x50f0c5['from'],'to':_0x50f0c5['to'],'subject':_0x50f0c5[_0x2921('0xe1')],'html':htmlEntities[_0x2921('0xe5')](_0x50f0c5[_0x2921('0xc7')]),'headers':{'Date':moment(_0x50f0c5[_0x2921('0x77')])[_0x2921('0xcc')](_0x2921('0xe6'))},'attachments':[]};if(_0x50f0c5['cc']){_0x30d7a8[_0x2921('0xe7')]['Cc']=_0x50f0c5['cc'];}if(_0x50f0c5[_0x2921('0xe0')]){_0x30d7a8[_0x2921('0xe7')][_0x2921('0xe8')]=_0x50f0c5['bcc'];}return new BPromise(function(_0x4be1db,_0x28a6c5){if(_0x50f0c5[_0x2921('0xe9')]){for(var _0x5c5b02=0x0;_0x5c5b02<_0x50f0c5[_0x2921('0xe9')]['length'];_0x5c5b02++){var _0x28d781=_0x50f0c5[_0x2921('0xe9')][_0x5c5b02];var _0x1381b2=path[_0x2921('0xd8')](_0x30544a,_0x28d781[_0x2921('0xea')]);if(fs[_0x2921('0xeb')](_0x1381b2)){_0x30d7a8[_0x2921('0xec')][_0x2921('0x26')]({'name':_0x28d781['name'],'contentType':_0x28d781['type'],'data':fs[_0x2921('0xed')](_0x1381b2)});}}}emlformat[_0x2921('0xee')](_0x30d7a8,function(_0x5b38cf,_0x4f5b6e){if(_0x5b38cf)return _0x28a6c5(_0x5b38cf);fs[_0x2921('0xef')](path[_0x2921('0xd8')](_0xf854aa,util[_0x2921('0xcc')]('message%d.eml',_0x4f7b61)),_0x4f5b6e);return _0x4be1db(_0x4f5b6e);});});})[_0x2921('0x2f')](function(){return new BPromise(function(_0x75ed65,_0x57adf9){zipdir(_0xf854aa,{'saveTo':_0x48c581},function(_0x52845f,_0x5527d7){if(_0x52845f)return _0x57adf9(_0x52845f);return _0x75ed65(_0x5527d7);});})[_0x2921('0x2f')](function(){return new BPromise(function(_0x6f2b45,_0x4f8ccb){rimraf(_0xf854aa,function(_0x2e8f89){if(_0x2e8f89)_0x4f8ccb(_0x2e8f89);return _0x6f2b45();});});})[_0x2921('0x2f')](function(){return _0xea5e4f[_0x2921('0xd6')](_0x48c581,_0x3dad88,function(_0x5c106f){if(!_0x5c106f)fs['unlinkSync'](_0x48c581);});});});}else{return _0xea5e4f['sendStatus'](0xc8);}})[_0x2921('0x2e')](handleError(_0xea5e4f,null));}; \ No newline at end of file +var _0x5e2f=['filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','role','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','sequelize','toString','merge','Account.key','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','Contact.lastName','Contact.email','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','rawAttributes','includeAll','include','options','create','body','update','addMessage','MailMessage','ids','getMessages','format','findAll','inlineCss','true','setTags','omit','spread','emit','removeTags','download','unix','join','root','server','files','attachments','Attachment','Attachments','Messages','get','each','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','basename','build','writeFileSync','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','html-entities','redis','defaults','./mailInteraction.socket','register','sendStatus','status','end','json','offset','limit','count','set','then','destroy','error','stack','name','Users','map','fullname','Tags','TagIds','forEach','push','findOne','out','-id','catch','waiting','unmanaged','total','closed','UserId','answered','talking','index','MailInteraction','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','select','field','color','from','tools_tags','u.id','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','expr','parseSearch','search','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','find','some','isEmpty','MailAccountId','i.MailAccountId\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'];(function(_0x86527a,_0x2787c6){var _0x2f14b6=function(_0x4f1613){while(--_0x4f1613){_0x86527a['push'](_0x86527a['shift']());}};_0x2f14b6(++_0x2787c6);}(_0x5e2f,0x14b));var _0xf5e2=function(_0x5947e,_0x1f43d8){_0x5947e=_0x5947e-0x0;var _0x155687=_0x5e2f[_0x5947e];return _0x155687;};'use strict';var emlformat=require(_0xf5e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf5e2('0x1'));var moment=require(_0xf5e2('0x2'));var BPromise=require(_0xf5e2('0x3'));var util=require('util');var path=require(_0xf5e2('0x4'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var juice=require(_0xf5e2('0x5'));var Redis=require(_0xf5e2('0x6'));var qs=require(_0xf5e2('0x7'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xf5e2('0x8'))(_0xf5e2('0x9'));var config=require('../../config/environment');var db=require(_0xf5e2('0xa'))['db'];var htmlEntities=require(_0xf5e2('0xb'));config[_0xf5e2('0xc')]=_[_0xf5e2('0xd')](config[_0xf5e2('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5e2('0xc')]));require(_0xf5e2('0xe'))[_0xf5e2('0xf')](socket);function respondWithStatusCode(_0x1b7202,_0x2f6413){_0x2f6413=_0x2f6413||0xcc;return function(_0x39dcb9){if(_0x39dcb9){return _0x1b7202[_0xf5e2('0x10')](_0x2f6413);}return _0x1b7202[_0xf5e2('0x11')](_0x2f6413)[_0xf5e2('0x12')]();};}function respondWithResult(_0x1b80b1,_0x28669f){_0x28669f=_0x28669f||0xc8;return function(_0x21347e){if(_0x21347e){return _0x1b80b1[_0xf5e2('0x11')](_0x28669f)[_0xf5e2('0x13')](_0x21347e);}};}function respondWithFilteredResult(_0x2dbcb1,_0x57241d){return function(_0x2a7d89){if(_0x2a7d89){var _0x4ea7e4=typeof _0x57241d[_0xf5e2('0x14')]==='undefined'&&typeof _0x57241d[_0xf5e2('0x15')]==='undefined';var _0x4793a4=_0x2a7d89['count'];var _0x47df1b=_0x4ea7e4?0x0:_0x57241d[_0xf5e2('0x14')];var _0x2b1273=_0x4ea7e4?_0x2a7d89[_0xf5e2('0x16')]:_0x57241d[_0xf5e2('0x14')]+_0x57241d['limit'];var _0x4c80f6;if(_0x2b1273>=_0x4793a4){_0x2b1273=_0x4793a4;_0x4c80f6=0xc8;}else{_0x4c80f6=0xce;}_0x2dbcb1[_0xf5e2('0x11')](_0x4c80f6);return _0x2dbcb1[_0xf5e2('0x17')]('Content-Range',_0x47df1b+'-'+_0x2b1273+'/'+_0x4793a4)[_0xf5e2('0x13')](_0x2a7d89);}return null;};}function saveUpdates(_0x24df5b){return function(_0x14a9d9){if(_0x14a9d9){return _0x14a9d9['update'](_0x24df5b)[_0xf5e2('0x18')](function(_0x445843){return _0x445843;});}return null;};}function removeEntity(_0x17637c){return function(_0x3da106){if(_0x3da106){return _0x3da106[_0xf5e2('0x19')]()[_0xf5e2('0x18')](function(){_0x17637c['status'](0xcc)[_0xf5e2('0x12')]();});}};}function handleEntityNotFound(_0x2ae9e4){return function(_0x2593fb){if(!_0x2593fb){_0x2ae9e4[_0xf5e2('0x10')](0x194);}return _0x2593fb;};}function handleError(_0x4baef6,_0x28cf1e){_0x28cf1e=_0x28cf1e||0x1f4;return function(_0x4406b9){logger[_0xf5e2('0x1a')](_0x4406b9[_0xf5e2('0x1b')]);if(_0x4406b9[_0xf5e2('0x1c')]){delete _0x4406b9[_0xf5e2('0x1c')];}_0x4baef6[_0xf5e2('0x11')](_0x28cf1e)['send'](_0x4406b9);};}function getInteractionUsers(_0x292e8c,_0x342dd9){return new BPromise(function(_0x44d5c5,_0x53be3f){try{if(_0x342dd9[_0x292e8c['id']]){_0x292e8c[_0xf5e2('0x1d')]=_[_0xf5e2('0x1e')](_0x342dd9[_0x292e8c['id']],function(_0x1aa684){return{'id':_0x1aa684['id'],'fullname':_0x1aa684[_0xf5e2('0x1f')]};});}}catch(_0x5e274a){_0x53be3f(_0x5e274a);}_0x44d5c5(_0x292e8c);});}function getInteractionTags(_0x1f7e5e,_0x5b2b36){return new BPromise(function(_0x44f4bf,_0x30a9fb){try{if(_0x1f7e5e['TagIds']){_0x1f7e5e[_0xf5e2('0x20')]=[];_0x1f7e5e[_0xf5e2('0x21')]['split'](',')[_0xf5e2('0x22')](function(_0x69b6a8){_0x1f7e5e[_0xf5e2('0x20')][_0xf5e2('0x23')](_0x5b2b36[_0x69b6a8]);});}delete _0x1f7e5e[_0xf5e2('0x21')];}catch(_0x8648e9){_0x30a9fb(_0x8648e9);}_0x44f4bf(_0x1f7e5e);});}function getLastMessageText(_0x2c1ab8){return new BPromise(function(_0x4b1291,_0x193e71){return db['MailMessage'][_0xf5e2('0x24')]({'where':{'$and':[{'MailInteractionId':_0x2c1ab8['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xf5e2('0x25')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xf5e2('0x26'),'raw':!![]})['then'](function(_0x38aa9f){if(_0x38aa9f&&_0x38aa9f['plainBody']){_0x2c1ab8['lastMsgText']=_['trimStart'](_0x38aa9f['plainBody']);}_0x4b1291(_0x2c1ab8);})[_0xf5e2('0x27')](function(_0x2340c6){_0x193e71(_0x2340c6);});});}function updateMailInteraction(_0x8ed1b6,_0x89dfc6,_0x2029d2,_0x312768){return new BPromise(function(_0xca9d52,_0x14d7e9){return getInteractionUsers(_0x8ed1b6,_0x2029d2)['then'](function(_0x4011f4){return getInteractionTags(_0x4011f4,_0x89dfc6);})[_0xf5e2('0x18')](function(_0x44b863){return getStateInteraction(_0x44b863);})[_0xf5e2('0x18')](function(_0x353c9c){if(_0x312768){_0xca9d52(getLastMessageText(_0x353c9c));}else{_0xca9d52(_0x353c9c);}})['catch'](function(_0x1a2489){_0x14d7e9(_0x1a2489);});});}function getStateInteraction(_0x42b209){return new BPromise(function(_0x32cc84){_0x42b209[_0xf5e2('0x28')]=0x0;_0x42b209['talking']=0x0;_0x42b209['answered']=0x0;_0x42b209[_0xf5e2('0x29')]=0x0;_0x42b209[_0xf5e2('0x2a')]=0x0;if(!_0x42b209[_0xf5e2('0x2b')]&&!_0x42b209[_0xf5e2('0x2c')]){_0x42b209['waiting']+=0x1;}if(!_0x42b209['closed']&&_0x42b209[_0xf5e2('0x2c')]){_0x42b209['talking']+=0x1;if(_0x42b209[_0xf5e2('0x28')]){_0x42b209[_0xf5e2('0x28')]-=0x1;}}if(_0x42b209[_0xf5e2('0x2b')]&&_0x42b209[_0xf5e2('0x2c')]){_0x42b209[_0xf5e2('0x2d')]+=0x1;if(_0x42b209[_0xf5e2('0x2e')]){_0x42b209['talking']-=0x1;}}if(_0x42b209[_0xf5e2('0x2b')]&&!_0x42b209['UserId']){_0x42b209[_0xf5e2('0x29')]+=0x1;if(_0x42b209[_0xf5e2('0x28')]){_0x42b209[_0xf5e2('0x28')]-=0x1;}}_0x42b209[_0xf5e2('0x2a')]+=0x1;_0x32cc84(_0x42b209);});}exports[_0xf5e2('0x2f')]=function(_0x4ad17f,_0x44e0e2){var _0x3f3d2a={},_0x392592={},_0xfd3a9a={'count':0x0,'rows':[]};var _0x263c2a=_[_0xf5e2('0x1e')](db[_0xf5e2('0x30')]['rawAttributes'],function(_0x5b69b6){return{'name':_0x5b69b6['fieldName'],'type':_0x5b69b6[_0xf5e2('0x31')][_0xf5e2('0x32')]};});_0x392592[_0xf5e2('0x33')]=_['map'](_0x263c2a,_0xf5e2('0x1c'));_0x392592[_0xf5e2('0x34')]=_[_0xf5e2('0x35')](_0x4ad17f[_0xf5e2('0x34')]);_0x392592['filters']=_[_0xf5e2('0x36')](_0x392592['model'],_0x392592[_0xf5e2('0x34')]);_0x3f3d2a[_0xf5e2('0x37')]=_[_0xf5e2('0x36')](_0x392592['model'],qs[_0xf5e2('0x38')](_0x4ad17f['query'][_0xf5e2('0x38')]));_0x3f3d2a['attributes']=_0x3f3d2a[_0xf5e2('0x37')][_0xf5e2('0x39')]?_0x3f3d2a['attributes']:_0x392592[_0xf5e2('0x33')];if(!_0x4ad17f[_0xf5e2('0x34')][_0xf5e2('0x3a')](_0xf5e2('0x3b'))){_0x3f3d2a['limit']=qs[_0xf5e2('0x15')](_0x4ad17f['query'][_0xf5e2('0x15')]);_0x3f3d2a[_0xf5e2('0x14')]=qs[_0xf5e2('0x14')](_0x4ad17f[_0xf5e2('0x34')][_0xf5e2('0x14')]);}_0x3f3d2a['order']=qs[_0xf5e2('0x3c')](_0x4ad17f[_0xf5e2('0x34')][_0xf5e2('0x3c')]);_0x3f3d2a[_0xf5e2('0x3d')]=qs[_0xf5e2('0x3e')](_['pick'](_0x4ad17f[_0xf5e2('0x34')],_0x392592[_0xf5e2('0x3e')]),_0x263c2a);var _0x8e3898=[];var _0x1e163e=squel[_0xf5e2('0x3f')]()[_0xf5e2('0x40')]('id')[_0xf5e2('0x40')](_0xf5e2('0x1c'))['field'](_0xf5e2('0x41'))[_0xf5e2('0x42')](_0xf5e2('0x43'));var _0x403e34=squel[_0xf5e2('0x3f')]()[_0xf5e2('0x40')](_0xf5e2('0x44'))[_0xf5e2('0x40')]('u.fullname')[_0xf5e2('0x40')](_0xf5e2('0x45'))[_0xf5e2('0x42')](_0xf5e2('0x46'),'ui')[_0xf5e2('0x47')](_0xf5e2('0x48'),'u',_0xf5e2('0x49'));var _0x4d0de9=squel['select']()[_0xf5e2('0x42')](_0xf5e2('0x4a'),'i')[_0xf5e2('0x47')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xf5e2('0x47')]('users','o','o.id\x20=\x20i.UserId')[_0xf5e2('0x47')]('mail_accounts','a',_0xf5e2('0x4b'))[_0xf5e2('0x47')](_0xf5e2('0x4c'),'me',_0xf5e2('0x4d'))['left_join']('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')[_0xf5e2('0x47')](_0xf5e2('0x43'),'t','t.id\x20=\x20it.TagId');var _0x1ead47=squel[_0xf5e2('0x4e')]();var _0x589a41=[];var _0x12d4c9=squel[_0xf5e2('0x4e')]();var _0x54c3a5;if(_0x4ad17f['query']['search']){_0x54c3a5=as[_0xf5e2('0x4f')](_0x4ad17f['query'][_0xf5e2('0x50')]);var _0x424a74=_0x54c3a5['sqlOperator'];for(var _0x4eafc3=0x0;_0x4eafc3<_0x54c3a5[_0xf5e2('0x51')][_0xf5e2('0x39')];_0x4eafc3++){var _0x1087ee=_0x54c3a5[_0xf5e2('0x51')][_0x4eafc3];var _0x42a09e='i';var _0x5d59f2=_['find'](_0x263c2a,[_0xf5e2('0x1c'),_0x1087ee['field']]);if(!_0x5d59f2){switch(_0x1087ee[_0xf5e2('0x40')]){case _0xf5e2('0x52'):if(_0x1087ee[_0xf5e2('0x53')]==0x1){_0x4d0de9[_0xf5e2('0x54')]('`'+_0x1087ee[_0xf5e2('0x40')]+_0xf5e2('0x55'));}else{_0x4d0de9[_0xf5e2('0x54')]('`'+_0x1087ee['field']+_0xf5e2('0x56'));}break;case _0xf5e2('0x57'):if(_0x1087ee[_0xf5e2('0x58')]===_0xf5e2('0x59')){if(_0x1087ee[_0xf5e2('0x53')][_0xf5e2('0x5a')]('\x20')[_0xf5e2('0x39')]>0x1){_0x1ead47[_0x424a74](_0xf5e2('0x5b'),qs[_0xf5e2('0x5c')](_0x1087ee[_0xf5e2('0x53')]),null);}else{var _0x395a2c='%'+_0x1087ee[_0xf5e2('0x53')]+'%';_0x1ead47[_0x424a74](_0xf5e2('0x5d'),_0x395a2c,_0x395a2c,_0x395a2c);}}else{_0x5d59f2=_['find'](_0x263c2a,[_0xf5e2('0x1c'),_0xf5e2('0x5e')]);_0x1087ee[_0xf5e2('0x40')]=_0xf5e2('0x5e');_0x5f1280=as[_0xf5e2('0x5f')](_0x42a09e,_0x5d59f2[_0xf5e2('0x31')],_0x1087ee);_0x1ead47[_0x424a74](_0x5f1280[_0xf5e2('0x60')],_0x5f1280[_0xf5e2('0x53')][_0xf5e2('0x61')],_0x5f1280[_0xf5e2('0x53')][_0xf5e2('0x12')]);}break;case _0xf5e2('0x62'):var _0x33dca5=_0x1087ee[_0xf5e2('0x53')]['split'](',')[_0xf5e2('0x1e')](function(_0x1623b6){return Number(_0x1623b6);});_0x33dca5[_0xf5e2('0x22')](function(_0x5d0729){_0x12d4c9['or'](_0xf5e2('0x63'),'%,'+_0x5d0729+',%');});_0x589a41=_[_0xf5e2('0x64')](_0x589a41,_0x33dca5);break;case _0xf5e2('0x65'):if(_0x1087ee[_0xf5e2('0x58')]===_0xf5e2('0x59')){_0x1ead47[_0x424a74]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1087ee[_0xf5e2('0x53')]+'%',null);}else{_0x5d59f2=_[_0xf5e2('0x66')](_0x263c2a,[_0xf5e2('0x1c'),'UserId']);_0x1087ee[_0xf5e2('0x40')]=_0xf5e2('0x2c');_0x5f1280=as['buildExpression'](_0x42a09e,_0x5d59f2[_0xf5e2('0x31')],_0x1087ee);_0x1ead47[_0x424a74](_0x5f1280[_0xf5e2('0x60')],_0x5f1280[_0xf5e2('0x53')][_0xf5e2('0x61')],_0x5f1280[_0xf5e2('0x53')][_0xf5e2('0x12')]);}break;case'plainBody':_0x5f1280=as['buildExpression']('me',null,_0x1087ee);_0x1ead47[_0x424a74](_0x5f1280['text'],_0x5f1280[_0xf5e2('0x53')]['start'],_0x5f1280[_0xf5e2('0x53')]['end']);break;}}else{var _0x5f1280=as[_0xf5e2('0x5f')](_0x42a09e,_0x5d59f2[_0xf5e2('0x31')],_0x1087ee);_0x1ead47[_0x424a74](_0x5f1280[_0xf5e2('0x60')],_0x5f1280['value'][_0xf5e2('0x61')],_0x5f1280[_0xf5e2('0x53')][_0xf5e2('0x12')]);}}}else{var _0x287177=_(_0x4ad17f[_0xf5e2('0x34')])[_0xf5e2('0x35')]()[_0xf5e2('0x1e')](function(_0x211430){return _[_0xf5e2('0x67')](_0x263c2a,[_0xf5e2('0x1c'),_0x211430])?_0x211430:undefined;})['compact']()[_0xf5e2('0x53')]();if(!_[_0xf5e2('0x68')](_0x287177)){_0x287177['forEach'](function(_0x3995c4){if(_0x3995c4===_0xf5e2('0x69')){_0x4d0de9[_0xf5e2('0x3d')](_0xf5e2('0x6a'),[][_0xf5e2('0x6b')](_0x4ad17f['query'][_0x3995c4]));}else if(_0x3995c4===_0xf5e2('0x6c')){var _0x2480d8=JSON[_0xf5e2('0x6d')](_0x4ad17f['query'][_0x3995c4])[_0xf5e2('0x6e')];var _0x2bc449=JSON['parse'](_0x4ad17f[_0xf5e2('0x34')][_0x3995c4])['$lte'];_0x4d0de9[_0xf5e2('0x3d')](_0xf5e2('0x6f'),_0x2480d8,_0x2bc449);}else{if(_0x4ad17f[_0xf5e2('0x34')][_0x3995c4]===_0xf5e2('0x70')){_0x4d0de9[_0xf5e2('0x3d')]('i.'+_0x3995c4+_0xf5e2('0x71'));}else{_0x4d0de9[_0xf5e2('0x3d')]('i.'+_0x3995c4+_0xf5e2('0x72'),_0x4ad17f[_0xf5e2('0x34')][_0x3995c4]);}}});}if(_0x4ad17f[_0xf5e2('0x34')][_0xf5e2('0x73')]){if(_0x4ad17f[_0xf5e2('0x34')]['read']==0x1){_0x4d0de9['having'](_0xf5e2('0x74'));}else{_0x4d0de9[_0xf5e2('0x54')](_0xf5e2('0x75'));}}if(_0x4ad17f[_0xf5e2('0x34')][_0xf5e2('0x76')]){_0x589a41=_['isArray'](_0x4ad17f[_0xf5e2('0x34')][_0xf5e2('0x76')])?_0x4ad17f['query'][_0xf5e2('0x76')]:new Array(_0x4ad17f[_0xf5e2('0x34')][_0xf5e2('0x76')]);_0x589a41[_0xf5e2('0x22')](function(_0x3229b1){_0x12d4c9['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3229b1+',%');});}if(_0x4ad17f[_0xf5e2('0x34')][_0xf5e2('0x77')]){var _0x5884d7=_0x4ad17f['query'][_0xf5e2('0x77')][_0xf5e2('0x78')]('\x5c','\x5c\x5c')[_0xf5e2('0x78')](/'/g,'\x27\x27');if(qs[_0xf5e2('0x79')](_0x5884d7)){_0x1ead47['or'](_0xf5e2('0x7a'),_0x5884d7+'%');}else if(qs[_0xf5e2('0x7b')](_0x5884d7)){_0x1ead47['or'](_0xf5e2('0x7c'),_0x5884d7+'%');}else{_0x1ead47['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xf5e2('0x5c')](_0x5884d7))['or'](_0xf5e2('0x7d'),qs[_0xf5e2('0x5c')](_0x5884d7));}}}_0x4d0de9[_0xf5e2('0x3d')](_0x1ead47);_0x4d0de9[_0xf5e2('0x7e')](_0xf5e2('0x7f'));var _0x1f2ece={'type':db[_0xf5e2('0x80')][_0xf5e2('0x81')][_0xf5e2('0x82')],'raw':!![]};var _0x17cf56=_0x4d0de9['clone']();_0x17cf56[_0xf5e2('0x40')](_0xf5e2('0x7f'));_0x17cf56[_0xf5e2('0x40')](_0xf5e2('0x83'),_0xf5e2('0x52'));if(_0x3f3d2a[_0xf5e2('0x84')]){_0x3f3d2a[_0xf5e2('0x84')][_0xf5e2('0x22')](function(_0x4dff17){var _0x2f4ebd=_0x4dff17[0x0]===_0xf5e2('0x85')?_0x4dff17[0x0]:'i.'+_0x4dff17[0x0];_0x4d0de9[_0xf5e2('0x84')](_0x2f4ebd,_0x4dff17[0x1]===_0xf5e2('0x86')?![]:!![]);});}if(!_[_0xf5e2('0x68')](_0x589a41)){_0x4d0de9['having'](_0x12d4c9);_0x17cf56[_0xf5e2('0x3d')](_0xf5e2('0x87'),_0x589a41);}BPromise[_0xf5e2('0x88')]()[_0xf5e2('0x18')](function(){if(!_0x54c3a5){if(_0x4ad17f[_0xf5e2('0x34')][_0xf5e2('0x69')])return;_0x17cf56['where'](_0xf5e2('0x89'));_0x4d0de9[_0xf5e2('0x3d')](_0xf5e2('0x89'));return;}if(_0x4ad17f['user'][_0xf5e2('0x8a')]!=='agent')return;return _0x4ad17f[_0xf5e2('0x8b')][_0xf5e2('0x8c')]({'attributes':['id'],'raw':!![]})[_0xf5e2('0x18')](function(_0x5e5583){if(_[_0xf5e2('0x68')](_0x5e5583)){_0x17cf56[_0xf5e2('0x3d')](_0xf5e2('0x8d'));_0x4d0de9['where'](_0xf5e2('0x8d'));}else{_0x17cf56[_0xf5e2('0x3d')](_0xf5e2('0x6a'),_[_0xf5e2('0x1e')](_0x5e5583,'id'));_0x4d0de9[_0xf5e2('0x3d')](_0xf5e2('0x6a'),_[_0xf5e2('0x1e')](_0x5e5583,'id'));}});})[_0xf5e2('0x18')](function(){if(_0x4ad17f[_0xf5e2('0x8b')][_0xf5e2('0x8a')]===_0xf5e2('0x8e')&&!_0x54c3a5&&!_0x4ad17f[_0xf5e2('0x34')][_0xf5e2('0x69')])return[];return db[_0xf5e2('0x8f')][_0xf5e2('0x34')](_0x17cf56[_0xf5e2('0x90')](),_0x1f2ece);})[_0xf5e2('0x18')](function(_0x56afd2){_0xfd3a9a[_0xf5e2('0x16')]=_0x56afd2[_0xf5e2('0x39')];if(_0xfd3a9a[_0xf5e2('0x16')]===0x0)return[];return db[_0xf5e2('0x8f')][_0xf5e2('0x34')](_0x1e163e['toString'](),_0x1f2ece)['then'](function(_0x5c4c6d){_0x8e3898=_['keyBy'](_0x5c4c6d,'id');_0x1f2ece=_[_0xf5e2('0x91')](_0x1f2ece,{'model':db[_0xf5e2('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4ad17f[_0xf5e2('0x34')]['fields']){_0x3f3d2a[_0xf5e2('0x37')][_0xf5e2('0x22')](function(_0x57d710){_0x4d0de9[_0xf5e2('0x40')]('i.'+_0x57d710);});}else{_0x4d0de9[_0xf5e2('0x40')](_0xf5e2('0x83'),_0xf5e2('0x52'));_0x4d0de9[_0xf5e2('0x40')]('a.key',_0xf5e2('0x92'));_0x4d0de9['field']('a.mandatoryDisposition','Account.mandatoryDisposition');_0x4d0de9[_0xf5e2('0x40')](_0xf5e2('0x93'),'Account.email');_0x4d0de9['field'](_0xf5e2('0x94'),'contactName');_0x4d0de9[_0xf5e2('0x40')](_0xf5e2('0x7f'));_0x4d0de9[_0xf5e2('0x40')]('i.createdAt');_0x4d0de9[_0xf5e2('0x40')](_0xf5e2('0x95'));_0x4d0de9['field'](_0xf5e2('0x96'));_0x4d0de9[_0xf5e2('0x40')]('i.closedAt');_0x4d0de9[_0xf5e2('0x40')](_0xf5e2('0x97'));_0x4d0de9['field'](_0xf5e2('0x98'));_0x4d0de9[_0xf5e2('0x40')](_0xf5e2('0x99'));_0x4d0de9['field'](_0xf5e2('0x9a'));_0x4d0de9[_0xf5e2('0x40')](_0xf5e2('0x9b'));_0x4d0de9[_0xf5e2('0x40')](_0xf5e2('0x9c'));_0x4d0de9[_0xf5e2('0x40')](_0xf5e2('0x9d'));_0x4d0de9[_0xf5e2('0x40')](_0xf5e2('0x9e'));_0x4d0de9[_0xf5e2('0x40')](_0xf5e2('0x9f'));_0x4d0de9[_0xf5e2('0x40')](_0xf5e2('0xa0'));_0x4d0de9[_0xf5e2('0x40')](_0xf5e2('0xa1'));_0x4d0de9[_0xf5e2('0x40')](_0xf5e2('0xa2'));_0x4d0de9[_0xf5e2('0x40')](_0xf5e2('0xa3'),_0xf5e2('0xa4'));_0x4d0de9[_0xf5e2('0x40')]('c.lastName',_0xf5e2('0xa5'));_0x4d0de9['field']('c.email',_0xf5e2('0xa6'));_0x4d0de9[_0xf5e2('0x40')]('c.phone','Contact.phone');_0x4d0de9[_0xf5e2('0x40')]('c.mobile',_0xf5e2('0xa7'));_0x4d0de9[_0xf5e2('0x40')]('c.fax',_0xf5e2('0xa8'));_0x4d0de9[_0xf5e2('0x40')](_0xf5e2('0xa9'),_0xf5e2('0xaa'));_0x4d0de9[_0xf5e2('0x40')](_0xf5e2('0xab'),_0xf5e2('0xac'));_0x4d0de9['field'](_0xf5e2('0xad'),_0xf5e2('0x21'));}if(_0x3f3d2a[_0xf5e2('0x15')])_0x4d0de9['limit'](_0x3f3d2a[_0xf5e2('0x15')]);if(_0x3f3d2a['offset'])_0x4d0de9[_0xf5e2('0x14')](_0x3f3d2a[_0xf5e2('0x14')]);return db[_0xf5e2('0x8f')][_0xf5e2('0x34')](_0x4d0de9[_0xf5e2('0x90')](),_0x1f2ece);})[_0xf5e2('0x18')](function(_0xe0bf34){if(_0xe0bf34[_0xf5e2('0x39')]>0x0)_0x403e34[_0xf5e2('0x3d')](_0xf5e2('0xae'),_[_0xf5e2('0x1e')](_0xe0bf34,'id'));return db[_0xf5e2('0x8f')]['query'](_0x403e34[_0xf5e2('0x90')](),_0x1f2ece)['then'](function(_0x3462d7){var _0xdb5cca=_[_0xf5e2('0xaf')](_0x3462d7,_0xf5e2('0xb0'));var _0xc1c31a=[];return db[_0xf5e2('0xb1')][_0xf5e2('0x24')]({'attributes':[_0xf5e2('0xb2')],'raw':!![]})[_0xf5e2('0x18')](function(_0x47b501){var _0x15094b=_0x47b501[_0xf5e2('0xb2')];_0xe0bf34[_0xf5e2('0x22')](function(_0x531a76){_0xc1c31a['push'](updateMailInteraction(_0x531a76,_0x8e3898,_0xdb5cca,_0x15094b));});return BPromise[_0xf5e2('0xb3')](_0xc1c31a);});});});})[_0xf5e2('0x18')](function(_0x37b31e){_0xfd3a9a[_0xf5e2('0xb4')]=_0x37b31e;return _0xfd3a9a;})[_0xf5e2('0x18')](respondWithFilteredResult(_0x44e0e2,_0x3f3d2a))[_0xf5e2('0x27')](handleError(_0x44e0e2,null));};exports[_0xf5e2('0xb5')]=function(_0x1ac4f8,_0x4afdda){var _0x1530e9={'raw':![],'where':{'id':_0x1ac4f8[_0xf5e2('0xb6')]['id']}},_0x3f5b60={};_0x3f5b60[_0xf5e2('0x33')]=_[_0xf5e2('0x35')](db['MailInteraction'][_0xf5e2('0xb7')]);_0x3f5b60['query']=_['keys'](_0x1ac4f8['query']);_0x3f5b60[_0xf5e2('0x3e')]=_['intersection'](_0x3f5b60[_0xf5e2('0x33')],_0x3f5b60[_0xf5e2('0x34')]);_0x1530e9[_0xf5e2('0x37')]=_[_0xf5e2('0x36')](_0x3f5b60['model'],qs[_0xf5e2('0x38')](_0x1ac4f8['query'][_0xf5e2('0x38')]));_0x1530e9[_0xf5e2('0x37')]=_0x1530e9['attributes'][_0xf5e2('0x39')]?_0x1530e9[_0xf5e2('0x37')]:_0x3f5b60['model'];if(_0x1ac4f8[_0xf5e2('0x34')][_0xf5e2('0xb8')]){_0x1530e9[_0xf5e2('0xb9')]=[{'all':!![]}];}_0x1530e9=_['merge']({},_0x1530e9,_0x1ac4f8[_0xf5e2('0xba')]);return db[_0xf5e2('0x30')][_0xf5e2('0x66')](_0x1530e9)[_0xf5e2('0x18')](handleEntityNotFound(_0x4afdda,null))['then'](respondWithResult(_0x4afdda,null))['catch'](handleError(_0x4afdda,null));};exports['create']=function(_0x400c8e,_0x1e9030){return db[_0xf5e2('0x30')][_0xf5e2('0xbb')](_0x400c8e[_0xf5e2('0xbc')],{})['then'](respondWithResult(_0x1e9030,0xc9))[_0xf5e2('0x27')](handleError(_0x1e9030,null));};exports[_0xf5e2('0xbd')]=function(_0xfe54fa,_0x2692de){if(_0xfe54fa[_0xf5e2('0xbc')]['id']){delete _0xfe54fa['body']['id'];}return db[_0xf5e2('0x30')][_0xf5e2('0x66')]({'where':{'id':_0xfe54fa[_0xf5e2('0xb6')]['id']}})[_0xf5e2('0x18')](handleEntityNotFound(_0x2692de,null))['then'](saveUpdates(_0xfe54fa['body'],null))[_0xf5e2('0x18')](respondWithResult(_0x2692de,null))[_0xf5e2('0x27')](handleError(_0x2692de,null));};exports[_0xf5e2('0x19')]=function(_0x13dd5d,_0x3b7c2b){return db[_0xf5e2('0x30')]['find']({'where':{'id':_0x13dd5d[_0xf5e2('0xb6')]['id']}})[_0xf5e2('0x18')](handleEntityNotFound(_0x3b7c2b,null))['then'](removeEntity(_0x3b7c2b,null))['catch'](handleError(_0x3b7c2b,null));};exports['describe']=function(_0x18e2dc,_0x45098e){return db['MailInteraction']['describe']()['then'](respondWithResult(_0x45098e,null))[_0xf5e2('0x27')](handleError(_0x45098e,null));};exports[_0xf5e2('0xbe')]=function(_0x2ec15b,_0x4708f2){return db[_0xf5e2('0xbf')]['find']({'where':{'id':_0x2ec15b['params']['id']}})[_0xf5e2('0x18')](handleEntityNotFound(_0x4708f2,null))[_0xf5e2('0x18')](function(_0x3f90d4){if(_0x3f90d4){return _0x3f90d4[_0xf5e2('0xbe')](_0x2ec15b[_0xf5e2('0xbc')][_0xf5e2('0xc0')],_['omit'](_0x2ec15b[_0xf5e2('0xbc')],[_0xf5e2('0xc0'),'id'])||{});}})[_0xf5e2('0x18')](respondWithResult(_0x4708f2,null))[_0xf5e2('0x27')](handleError(_0x4708f2,null));};exports[_0xf5e2('0xc1')]=function(_0x55b62b,_0x1968b3){var _0x5478a9={'raw':![],'where':{}};var _0x7f7fbd={};var _0x5e11d2={'count':0x0,'rows':[]};return db[_0xf5e2('0x30')][_0xf5e2('0x24')]({'where':{'id':_0x55b62b[_0xf5e2('0xb6')]['id']}})[_0xf5e2('0x18')](handleEntityNotFound(_0x1968b3,null))['then'](function(_0x120534){if(_0x120534){_0x7f7fbd[_0xf5e2('0x33')]=_[_0xf5e2('0x35')](db['MailMessage'][_0xf5e2('0xb7')]);_0x7f7fbd[_0xf5e2('0x34')]=_['keys'](_0x55b62b[_0xf5e2('0x34')]);_0x7f7fbd['filters']=_[_0xf5e2('0x36')](_0x7f7fbd['model'],_0x7f7fbd[_0xf5e2('0x34')]);_0x5478a9['attributes']=_[_0xf5e2('0x36')](_0x7f7fbd['model'],qs[_0xf5e2('0x38')](_0x55b62b[_0xf5e2('0x34')]['fields']));_0x5478a9[_0xf5e2('0x37')]=_0x5478a9['attributes']['length']?_0x5478a9[_0xf5e2('0x37')]:_0x7f7fbd[_0xf5e2('0x33')];if(!_0x55b62b[_0xf5e2('0x34')][_0xf5e2('0x3a')](_0xf5e2('0x3b'))){_0x5478a9[_0xf5e2('0x15')]=qs['limit'](_0x55b62b[_0xf5e2('0x34')][_0xf5e2('0x15')]);_0x5478a9[_0xf5e2('0x14')]=qs[_0xf5e2('0x14')](_0x55b62b[_0xf5e2('0x34')]['offset']);}_0x5478a9[_0xf5e2('0x84')]=qs[_0xf5e2('0x3c')](_0x55b62b['query'][_0xf5e2('0x3c')]);_0x5478a9[_0xf5e2('0x3d')]=qs[_0xf5e2('0x3e')](_['pick'](_0x55b62b[_0xf5e2('0x34')],_0x7f7fbd[_0xf5e2('0x3e')]));_0x5478a9[_0xf5e2('0x3d')]['MailInteractionId']=_0x120534['id'];if(_0x55b62b[_0xf5e2('0x34')]['filter']){_0x5478a9[_0xf5e2('0x3d')]=_[_0xf5e2('0x91')](_0x5478a9[_0xf5e2('0x3d')],{'$or':_[_0xf5e2('0x1e')](_0x5478a9[_0xf5e2('0x37')],function(_0x41dc4e){var _0x1effa5={};_0x1effa5[_0x41dc4e]={'$like':'%'+_0x55b62b[_0xf5e2('0x34')][_0xf5e2('0x77')]+'%'};return _0x1effa5;})});}if(_0x55b62b[_0xf5e2('0x34')][_0xf5e2('0x6e')]){var _0x1e3d38=_0x55b62b[_0xf5e2('0x34')][_0xf5e2('0x6e')][_0xf5e2('0x5a')](',');var _0x4ae348={};_0x4ae348[_0x1e3d38[0x0]]={'$gte':moment(_0x1e3d38[0x1])[_0xf5e2('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5478a9[_0xf5e2('0x3d')]=_[_0xf5e2('0x91')](_0x5478a9[_0xf5e2('0x3d')],_0x4ae348);}_0x5478a9=_[_0xf5e2('0x91')]({},_0x5478a9,_0x55b62b[_0xf5e2('0xba')]);return db[_0xf5e2('0xbf')][_0xf5e2('0x16')]({'where':_0x5478a9[_0xf5e2('0x3d')]})[_0xf5e2('0x18')](function(_0x35b42d){_0x5e11d2[_0xf5e2('0x16')]=_0x35b42d;if(_0x55b62b[_0xf5e2('0x34')][_0xf5e2('0xb8')]){_0x5478a9[_0xf5e2('0xb9')]=[{'all':!![]}];}return db['MailMessage'][_0xf5e2('0xc3')](_0x5478a9);})[_0xf5e2('0x18')](function(_0x732c0){if(_0x55b62b[_0xf5e2('0x34')][_0xf5e2('0xc4')]===_0xf5e2('0xc5')){for(var _0x5dc649=0x0;_0x5dc649<_0x732c0[_0xf5e2('0x39')];_0x5dc649++){_0x732c0[_0x5dc649][_0xf5e2('0xbc')]=juice(_0x732c0[_0x5dc649][_0xf5e2('0xbc')]);}}_0x5e11d2[_0xf5e2('0xb4')]=_0x732c0;return _0x5e11d2;});}})[_0xf5e2('0x18')](respondWithFilteredResult(_0x1968b3,_0x5478a9))['catch'](handleError(_0x1968b3,null));};exports['addTags']=function(_0x202941,_0x18008e){return db[_0xf5e2('0x30')][_0xf5e2('0x66')]({'where':{'id':_0x202941['params']['id']}})[_0xf5e2('0x18')](handleEntityNotFound(_0x18008e,null))[_0xf5e2('0x18')](function(_0x1f988){if(_0x1f988){return _0x1f988[_0xf5e2('0xc6')](_0x202941[_0xf5e2('0xbc')][_0xf5e2('0xc0')],_[_0xf5e2('0xc7')](_0x202941['body'],[_0xf5e2('0xc0'),'id'])||{})[_0xf5e2('0xc8')](function(){return db[_0xf5e2('0x62')][_0xf5e2('0xc3')]({'attributes':['id','name','color'],'where':{'id':_0x202941[_0xf5e2('0xbc')][_0xf5e2('0xc0')]}});})[_0xf5e2('0x18')](function(_0x401d7c){socket[_0xf5e2('0xc9')]('mailInteractionTags:save',{'id':Number(_0x202941[_0xf5e2('0xb6')]['id']),'tags':_0x401d7c||[]});return{'id':Number(_0x202941['params']['id']),'tags':_0x401d7c||[]};});}})[_0xf5e2('0x18')](respondWithResult(_0x18008e,null))[_0xf5e2('0x27')](handleError(_0x18008e,null));};exports[_0xf5e2('0xca')]=function(_0x46886b,_0x2499c1){return db[_0xf5e2('0x30')]['find']({'where':{'id':_0x46886b[_0xf5e2('0xb6')]['id']}})[_0xf5e2('0x18')](handleEntityNotFound(_0x2499c1,null))[_0xf5e2('0x18')](function(_0x512c65){if(_0x512c65){return _0x512c65[_0xf5e2('0xca')](_0x46886b[_0xf5e2('0x34')][_0xf5e2('0xc0')]);}})[_0xf5e2('0x18')](respondWithStatusCode(_0x2499c1,null))[_0xf5e2('0x27')](handleError(_0x2499c1,null));};exports[_0xf5e2('0xcb')]=function(_0xa09286,_0x2df126){var _0x2f5392=moment()[_0xf5e2('0xcc')]()['toString']();var _0x3cf951=path[_0xf5e2('0xcd')](config[_0xf5e2('0xce')],_0xf5e2('0xcf'),_0xf5e2('0xd0'),'tmp');var _0x48153f=path['join'](config[_0xf5e2('0xce')],_0xf5e2('0xcf'),_0xf5e2('0xd0'),'attachments');var _0x54326e=path['join'](_0x3cf951,_0x2f5392);var _0x5e752a=util[_0xf5e2('0xc2')]('transcript-%d-%s.zip',_0xa09286[_0xf5e2('0xb6')]['id'],_0x2f5392);var _0x1305d0=path[_0xf5e2('0xcd')](_0x3cf951,_0x5e752a);var _0xba79=[];if(_0xa09286[_0xf5e2('0x34')][_0xf5e2('0xd1')]){_0xba79['push']({'model':db[_0xf5e2('0xd2')],'as':_0xf5e2('0xd3'),'raw':!![]});}var _0x55e951=[{'model':db[_0xf5e2('0xbf')],'as':_0xf5e2('0xd4'),'attributes':['id',_0xf5e2('0xbc'),_0xf5e2('0x42'),'to','cc','bcc','subject',_0xf5e2('0x6c')],'where':{'secret':![]},'order':qs[_0xf5e2('0x3c')]('id'),'include':_0xba79}];return db['MailInteraction'][_0xf5e2('0x66')]({'where':{'id':_0xa09286['params']['id']},'include':_0x55e951})[_0xf5e2('0x18')](handleEntityNotFound(_0x2df126,null))[_0xf5e2('0x18')](function(_0x397db6){if(_0x397db6&&_0x397db6[_0xf5e2('0xd4')]){var _0x2064ca=_0x397db6[_0xf5e2('0xd5')]({'plain':!![]});fs['mkdirSync'](_0x54326e);return BPromise[_0xf5e2('0xd6')](_0x2064ca[_0xf5e2('0xd4')],function(_0xcd71c7,_0xa352a8){var _0x283d46={'from':_0xcd71c7[_0xf5e2('0x42')],'to':_0xcd71c7['to'],'subject':_0xcd71c7[_0xf5e2('0xd7')],'html':htmlEntities[_0xf5e2('0xd8')](_0xcd71c7['body']),'headers':{'Date':moment(_0xcd71c7[_0xf5e2('0x6c')])['format'](_0xf5e2('0xd9'))},'attachments':[]};if(_0xcd71c7['cc']){_0x283d46[_0xf5e2('0xda')]['Cc']=_0xcd71c7['cc'];}if(_0xcd71c7['bcc']){_0x283d46[_0xf5e2('0xda')]['Bcc']=_0xcd71c7[_0xf5e2('0xdb')];}return new BPromise(function(_0x30c5f3,_0x54e23e){if(_0xcd71c7[_0xf5e2('0xd3')]){for(var _0x47192d=0x0;_0x47192d<_0xcd71c7[_0xf5e2('0xd3')][_0xf5e2('0x39')];_0x47192d++){var _0x2876ad=_0xcd71c7['Attachments'][_0x47192d];var _0x7efee1=path[_0xf5e2('0xcd')](_0x48153f,_0x2876ad[_0xf5e2('0xdc')]);if(fs['existsSync'](_0x7efee1)){_0x283d46[_0xf5e2('0xd1')]['push']({'name':_0x2876ad['name'],'contentType':_0x2876ad[_0xf5e2('0x31')],'data':fs['readFileSync'](_0x7efee1)});}}}emlformat[_0xf5e2('0xdd')](_0x283d46,function(_0x246977,_0x364ac5){if(_0x246977)return _0x54e23e(_0x246977);fs[_0xf5e2('0xde')](path[_0xf5e2('0xcd')](_0x54326e,util[_0xf5e2('0xc2')](_0xf5e2('0xdf'),_0xa352a8)),_0x364ac5);return _0x30c5f3(_0x364ac5);});});})[_0xf5e2('0x18')](function(){return new BPromise(function(_0x8323ff,_0x46b0c3){zipdir(_0x54326e,{'saveTo':_0x1305d0},function(_0x2d38f6,_0x55718){if(_0x2d38f6)return _0x46b0c3(_0x2d38f6);return _0x8323ff(_0x55718);});})['then'](function(){return new BPromise(function(_0x130e25,_0x27e6ac){rimraf(_0x54326e,function(_0x539dc9){if(_0x539dc9)_0x27e6ac(_0x539dc9);return _0x130e25();});});})[_0xf5e2('0x18')](function(){return _0x2df126['download'](_0x1305d0,_0x5e752a,function(_0x5ac62b){if(!_0x5ac62b)fs[_0xf5e2('0xe0')](_0x1305d0);});});});}else{return _0x2df126[_0xf5e2('0x10')](0xc8);}})[_0xf5e2('0x27')](handleError(_0x2df126,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 2d98b62..65c9af4 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 _0x4c62=['remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','../../mysqldb','MailMessage','setMaxListeners','update'];(function(_0x1ab26d,_0x5d4ad7){var _0x3d6167=function(_0x303a58){while(--_0x303a58){_0x1ab26d['push'](_0x1ab26d['shift']());}};_0x3d6167(++_0x5d4ad7);}(_0x4c62,0x14b));var _0x24c6=function(_0x103c06,_0x519e42){_0x103c06=_0x103c06-0x0;var _0x46446a=_0x4c62[_0x103c06];return _0x46446a;};'use strict';var EventEmitter=require(_0x24c6('0x0'));var MailInteraction=require(_0x24c6('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x24c6('0x1'))['db'][_0x24c6('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x24c6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x24c6('0x4'),'afterDestroy':_0x24c6('0x5')};function emitEvent(_0x350e70){return function(_0x25611f,_0x472aa5,_0x58313d){_0x25611f[_0x24c6('0x6')]({'attributes':['id'],'raw':!![]})[_0x24c6('0x7')](function(_0xa2259f){_0x25611f[_0x24c6('0x8')](_0x24c6('0x9'),_0xa2259f['map'](function(_0x35aa6a){return{'id':_0x35aa6a['id']};}));return MailMessage[_0x24c6('0xa')]({'where':{'MailInteractionId':_0x25611f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x24c6('0x7')](function(_0x1a1cf0){_0x25611f[_0x24c6('0x8')](_0x24c6('0xb'),_0x1a1cf0['length']);MailInteractionEvents[_0x24c6('0xc')](_0x350e70+':'+_0x25611f['id'],_0x25611f);MailInteractionEvents[_0x24c6('0xc')](_0x350e70,_0x25611f);_0x58313d(null);})[_0x24c6('0xd')](_0x58313d(null));};}for(var e in events){if(events[_0x24c6('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x24c6('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x1dd1=['setDataValue','unreadMessages','length','catch','hasOwnProperty','exports','../../mysqldb','MailMessage','save','update','remove','getUsers','Users','findAll','then'];(function(_0x3eabfc,_0x2ebe39){var _0x8b86d4=function(_0x5db660){while(--_0x5db660){_0x3eabfc['push'](_0x3eabfc['shift']());}};_0x8b86d4(++_0x2ebe39);}(_0x1dd1,0x7e));var _0x11dd=function(_0x2f20f8,_0x54a3f2){_0x2f20f8=_0x2f20f8-0x0;var _0xfcb1b7=_0x1dd1[_0x2f20f8];return _0xfcb1b7;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x11dd('0x0'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0x11dd('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x11dd('0x2'),'afterUpdate':_0x11dd('0x3'),'afterDestroy':_0x11dd('0x4')};function emitEvent(_0x37da20){return function(_0x166135,_0x3a6739,_0x140d90){_0x166135[_0x11dd('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3c5d03){_0x166135['setDataValue'](_0x11dd('0x6'),_0x3c5d03['map'](function(_0x36837a){return{'id':_0x36837a['id']};}));return MailMessage[_0x11dd('0x7')]({'where':{'MailInteractionId':_0x166135['id'],'direction':'in','read':![]},'raw':!![]});})[_0x11dd('0x8')](function(_0x1faacb){_0x166135[_0x11dd('0x9')](_0x11dd('0xa'),_0x1faacb[_0x11dd('0xb')]);MailInteractionEvents['emit'](_0x37da20+':'+_0x166135['id'],_0x166135);MailInteractionEvents['emit'](_0x37da20,_0x166135);_0x140d90(null);})[_0x11dd('0xc')](_0x140d90(null));};}for(var e in events){if(events[_0x11dd('0xd')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x11dd('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 ee930ea..ab92d2b 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 _0x4398=['rimraf','../../config/environment','define','MailInteraction','mail_interactions','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','models','MailMessage','update','utf8mb4_unicode_ci','util','bluebird','request-promise','path'];(function(_0x504137,_0x1c7053){var _0x1e01ad=function(_0x12ddc6){while(--_0x12ddc6){_0x504137['push'](_0x504137['shift']());}};_0x1e01ad(++_0x1c7053);}(_0x4398,0x1f4));var _0x8439=function(_0x5dbb4a,_0x4ccf13){_0x5dbb4a=_0x5dbb4a-0x0;var _0x5f269c=_0x4398[_0x5dbb4a];return _0x5f269c;};'use strict';var _=require('lodash');var util=require(_0x8439('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8439('0x1'));var rp=require(_0x8439('0x2'));var fs=require('fs');var path=require(_0x8439('0x3'));var rimraf=require(_0x8439('0x4'));var config=require(_0x8439('0x5'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x5ebde4,_0x12b3b9){return _0x5ebde4[_0x8439('0x6')](_0x8439('0x7'),attributes,{'tableName':_0x8439('0x8'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0x8439('0x9')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4ca701,_0x3d1569,_0x131b11){if(_0x4ca701['substatus']){_0x4ca701[_0x8439('0xa')]=moment()[_0x8439('0xb')](_0x8439('0xc'));}if(_0x4ca701[_0x8439('0xd')]){_0x4ca701[_0x8439('0xe')]=moment()[_0x8439('0xb')](_0x8439('0xc'));}_0x131b11(null,_0x3d1569);},'beforeUpdate':function(_0x3b662e,_0x3c02e8,_0x83fb58){if(_0x3b662e[_0x8439('0xf')](_0x8439('0x10'))){_0x3b662e['substatusAt']=_0x3b662e[_0x8439('0x10')]?moment()[_0x8439('0xb')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x3b662e[_0x8439('0xf')](_0x8439('0xd'))){_0x3b662e['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3b662e[_0x8439('0x10')]=null;_0x3b662e[_0x8439('0xa')]=null;}_0x83fb58(null,_0x3b662e);},'afterUpdate':function(_0x1b5ba9,_0x1f4d70,_0x169dcf){var _0x26f5ba=_0x5ebde4[_0x8439('0x11')];var _0x21eb09=_0x1b5ba9['get']({'plain':!![]});if(_0x21eb09[_0x8439('0xd')]){return _0x26f5ba[_0x8439('0x12')][_0x8439('0x13')]({'read':!![]},{'where':{'MailInteractionId':_0x21eb09['id']}})['then'](function(){_0x169dcf();})['catch'](function(_0x286dc9){_0x169dcf(_0x286dc9);});}else{_0x169dcf();}}},'charset':'utf8mb4','collate':_0x8439('0x14')});}; \ No newline at end of file +var _0x8564=['changed','models','get','update','then','catch','utf8mb4','util','../../config/logger','api','moment','rimraf','exports','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','substatus','format'];(function(_0x35485a,_0x91cdd4){var _0x5148e6=function(_0x27ed1d){while(--_0x27ed1d){_0x35485a['push'](_0x35485a['shift']());}};_0x5148e6(++_0x91cdd4);}(_0x8564,0x1d3));var _0x4856=function(_0x5ede71,_0x1aab67){_0x5ede71=_0x5ede71-0x0;var _0x99bcb4=_0x8564[_0x5ede71];return _0x99bcb4;};'use strict';var _=require('lodash');var util=require(_0x4856('0x0'));var logger=require(_0x4856('0x1'))(_0x4856('0x2'));var moment=require(_0x4856('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4856('0x4'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0x4856('0x5')]=function(_0x48454c,_0x32ea1f){return _0x48454c['define']('MailInteraction',attributes,{'tableName':_0x4856('0x6'),'paranoid':![],'indexes':[{'name':_0x4856('0x7'),'fields':[_0x4856('0x8'),'to'],'type':_0x4856('0x9')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x418036,_0x24b3ce,_0xe908fb){if(_0x418036['substatus']){_0x418036[_0x4856('0xa')]=moment()['format'](_0x4856('0xb'));}if(_0x418036[_0x4856('0xc')]){_0x418036[_0x4856('0xd')]=moment()['format'](_0x4856('0xb'));}_0xe908fb(null,_0x24b3ce);},'beforeUpdate':function(_0x5ce8d0,_0x3caba7,_0x49cd2b){if(_0x5ce8d0['changed'](_0x4856('0xe'))){_0x5ce8d0[_0x4856('0xa')]=_0x5ce8d0[_0x4856('0xe')]?moment()[_0x4856('0xf')](_0x4856('0xb')):null;}if(_0x5ce8d0[_0x4856('0x10')]('closed')){_0x5ce8d0['closedAt']=moment()[_0x4856('0xf')](_0x4856('0xb'));_0x5ce8d0[_0x4856('0xe')]=null;_0x5ce8d0[_0x4856('0xa')]=null;}_0x49cd2b(null,_0x5ce8d0);},'afterUpdate':function(_0x2f6a61,_0x207ad6,_0x4d33df){var _0x593555=_0x48454c[_0x4856('0x11')];var _0x3e9441=_0x2f6a61[_0x4856('0x12')]({'plain':!![]});if(_0x3e9441[_0x4856('0xc')]){return _0x593555['MailMessage'][_0x4856('0x13')]({'read':!![]},{'where':{'MailInteractionId':_0x3e9441['id']}})[_0x4856('0x14')](function(){_0x4d33df();})[_0x4856('0x15')](function(_0x401dca){_0x4d33df(_0x401dca);});}else{_0x4d33df();}}},'charset':_0x4856('0x16'),'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 b641a29..5c24308 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 _0xcb41=['message','result','catch','UpdateMailInteraction','update','body','options','attributes','limit','AddTagsToMailInteraction','MailInteraction','find','where','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1e9c82,_0xa85d3b){var _0x29bfed=function(_0x416244){while(--_0x416244){_0x1e9c82['push'](_0x1e9c82['shift']());}};_0x29bfed(++_0xa85d3b);}(_0xcb41,0x1df));var _0x1cb4=function(_0x51d0ee,_0x49b4c7){_0x51d0ee=_0x51d0ee-0x0;var _0x375751=_0xcb41[_0x51d0ee];return _0x375751;};'use strict';var _=require(_0x1cb4('0x0'));var util=require(_0x1cb4('0x1'));var moment=require(_0x1cb4('0x2'));var BPromise=require(_0x1cb4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cb4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb4('0x5'));var logger=require(_0x1cb4('0x6'))(_0x1cb4('0x7'));var config=require(_0x1cb4('0x8'));var jayson=require(_0x1cb4('0x9'));var client=jayson[_0x1cb4('0xa')][_0x1cb4('0xb')]({'port':0x232a});config[_0x1cb4('0xc')]=_['defaults'](config[_0x1cb4('0xc')],{'host':_0x1cb4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1cb4('0xc')]));require(_0x1cb4('0xe'))[_0x1cb4('0xf')](socket);function respondWithRpcPromise(_0x5afadd,_0x2f5ddc,_0x21d6a7){return new BPromise(function(_0x30c281,_0x4c8bde){return client['request'](_0x5afadd,_0x21d6a7)[_0x1cb4('0x10')](function(_0x574f01){logger[_0x1cb4('0x11')](_0x1cb4('0x12'),_0x2f5ddc,_0x1cb4('0x13'));logger[_0x1cb4('0x14')](_0x1cb4('0x15'),_0x2f5ddc,'request\x20sent',JSON[_0x1cb4('0x16')](_0x574f01));if(_0x574f01['error']){if(_0x574f01[_0x1cb4('0x17')][_0x1cb4('0x18')]===0x1f4){logger[_0x1cb4('0x17')](_0x1cb4('0x12'),_0x2f5ddc,_0x574f01[_0x1cb4('0x17')][_0x1cb4('0x19')]);return _0x4c8bde(_0x574f01[_0x1cb4('0x17')][_0x1cb4('0x19')]);}logger[_0x1cb4('0x17')](_0x1cb4('0x12'),_0x2f5ddc,_0x574f01['error'][_0x1cb4('0x19')]);return _0x30c281(_0x574f01['error'][_0x1cb4('0x19')]);}else{logger[_0x1cb4('0x11')]('MailInteraction,\x20%s,\x20%s',_0x2f5ddc,'request\x20sent');_0x30c281(_0x574f01[_0x1cb4('0x1a')][_0x1cb4('0x19')]);}})[_0x1cb4('0x1b')](function(_0x3c4493){logger[_0x1cb4('0x17')](_0x1cb4('0x12'),_0x2f5ddc,_0x3c4493);_0x4c8bde(_0x3c4493);});});}exports[_0x1cb4('0x1c')]=function(_0xdbb325){var _0x544001=this;return new Promise(function(_0x3ae54d,_0x1d1a19){return db['MailInteraction'][_0x1cb4('0x1d')](_0xdbb325[_0x1cb4('0x1e')],{'raw':_0xdbb325[_0x1cb4('0x1f')]?_0xdbb325[_0x1cb4('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdbb325[_0x1cb4('0x1f')]?_0xdbb325['options']['where']||null:null,'attributes':_0xdbb325[_0x1cb4('0x1f')]?_0xdbb325[_0x1cb4('0x1f')][_0x1cb4('0x20')]||null:null,'limit':_0xdbb325['options']?_0xdbb325[_0x1cb4('0x1f')][_0x1cb4('0x21')]||null:null})[_0x1cb4('0x10')](function(_0x5bce36){logger[_0x1cb4('0x11')](_0x1cb4('0x1c'),_0xdbb325);logger[_0x1cb4('0x14')](_0x1cb4('0x1c'),_0xdbb325,JSON['stringify'](_0x5bce36));_0x3ae54d(_0x5bce36);})[_0x1cb4('0x1b')](function(_0x4b9f62){logger['error']('UpdateMailInteraction',_0x4b9f62[_0x1cb4('0x19')],_0xdbb325);_0x1d1a19(_0x544001['error'](0x1f4,_0x4b9f62[_0x1cb4('0x19')]));});});};exports[_0x1cb4('0x22')]=function(_0x569fff){return new Promise(function(_0x5ef7b0,_0x2eced0){return db[_0x1cb4('0x23')][_0x1cb4('0x24')]({'where':_0x569fff[_0x1cb4('0x1f')]?_0x569fff[_0x1cb4('0x1f')][_0x1cb4('0x25')]||null:null})['then'](function(_0x54cf24){if(_0x54cf24){return _0x54cf24['addTags'](_0x569fff[_0x1cb4('0x1e')][_0x1cb4('0x26')],_[_0x1cb4('0x27')](_0x569fff[_0x1cb4('0x1e')],[_0x1cb4('0x26'),'id'])||{});}})[_0x1cb4('0x28')](function(_0x46a356){logger[_0x1cb4('0x11')](_0x1cb4('0x29'),_0x569fff);logger[_0x1cb4('0x14')](_0x1cb4('0x29'),_0x569fff,JSON[_0x1cb4('0x16')](_0x46a356));_0x5ef7b0(_0x46a356);})[_0x1cb4('0x1b')](function(_0xd1202b){logger[_0x1cb4('0x17')](_0x1cb4('0x29'),_0xd1202b[_0x1cb4('0x19')],_0x569fff);_0x2eced0(_this[_0x1cb4('0x17')](0x1f4,_0xd1202b['message']));});});}; \ No newline at end of file +var _0xf693=['limit','catch','AddTagsToMailInteraction','find','addTags','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','UpdateMailInteraction','MailInteraction','body','options','raw','where'];(function(_0xdd7fd,_0x3eec81){var _0x2191e9=function(_0x4488d7){while(--_0x4488d7){_0xdd7fd['push'](_0xdd7fd['shift']());}};_0x2191e9(++_0x3eec81);}(_0xf693,0x181));var _0x3f69=function(_0x28a55d,_0x3b128a){_0x28a55d=_0x28a55d-0x0;var _0x4b6dee=_0xf693[_0x28a55d];return _0x4b6dee;};'use strict';var _=require('lodash');var util=require(_0x3f69('0x0'));var moment=require(_0x3f69('0x1'));var BPromise=require(_0x3f69('0x2'));var rs=require(_0x3f69('0x3'));var fs=require('fs');var Redis=require(_0x3f69('0x4'));var db=require(_0x3f69('0x5'))['db'];var utils=require(_0x3f69('0x6'));var logger=require('../../config/logger')(_0x3f69('0x7'));var config=require(_0x3f69('0x8'));var jayson=require(_0x3f69('0x9'));var client=jayson[_0x3f69('0xa')][_0x3f69('0xb')]({'port':0x232a});config[_0x3f69('0xc')]=_[_0x3f69('0xd')](config[_0x3f69('0xc')],{'host':_0x3f69('0xe'),'port':0x18eb});var socket=require(_0x3f69('0xf'))(new Redis(config[_0x3f69('0xc')]));require(_0x3f69('0x10'))[_0x3f69('0x11')](socket);function respondWithRpcPromise(_0x3d79e4,_0x3214f9,_0x2d7305){return new BPromise(function(_0x1feeb3,_0x558498){return client[_0x3f69('0x12')](_0x3d79e4,_0x2d7305)[_0x3f69('0x13')](function(_0x37d68d){logger[_0x3f69('0x14')](_0x3f69('0x15'),_0x3214f9,'request\x20sent');logger[_0x3f69('0x16')](_0x3f69('0x17'),_0x3214f9,'request\x20sent',JSON[_0x3f69('0x18')](_0x37d68d));if(_0x37d68d['error']){if(_0x37d68d['error'][_0x3f69('0x19')]===0x1f4){logger[_0x3f69('0x1a')](_0x3f69('0x15'),_0x3214f9,_0x37d68d['error'][_0x3f69('0x1b')]);return _0x558498(_0x37d68d[_0x3f69('0x1a')]['message']);}logger[_0x3f69('0x1a')](_0x3f69('0x15'),_0x3214f9,_0x37d68d[_0x3f69('0x1a')][_0x3f69('0x1b')]);return _0x1feeb3(_0x37d68d[_0x3f69('0x1a')]['message']);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x3214f9,_0x3f69('0x1c'));_0x1feeb3(_0x37d68d['result']['message']);}})['catch'](function(_0x427eb9){logger['error'](_0x3f69('0x15'),_0x3214f9,_0x427eb9);_0x558498(_0x427eb9);});});}exports[_0x3f69('0x1d')]=function(_0x1684f7){var _0x3a056f=this;return new Promise(function(_0x337aae,_0x1b3e7f){return db[_0x3f69('0x1e')]['update'](_0x1684f7[_0x3f69('0x1f')],{'raw':_0x1684f7[_0x3f69('0x20')]?_0x1684f7[_0x3f69('0x20')][_0x3f69('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1684f7[_0x3f69('0x20')]?_0x1684f7[_0x3f69('0x20')][_0x3f69('0x22')]||null:null,'attributes':_0x1684f7['options']?_0x1684f7[_0x3f69('0x20')]['attributes']||null:null,'limit':_0x1684f7[_0x3f69('0x20')]?_0x1684f7['options'][_0x3f69('0x23')]||null:null})['then'](function(_0x437fd8){logger['info'](_0x3f69('0x1d'),_0x1684f7);logger[_0x3f69('0x16')]('UpdateMailInteraction',_0x1684f7,JSON[_0x3f69('0x18')](_0x437fd8));_0x337aae(_0x437fd8);})[_0x3f69('0x24')](function(_0x4f2d30){logger[_0x3f69('0x1a')]('UpdateMailInteraction',_0x4f2d30[_0x3f69('0x1b')],_0x1684f7);_0x1b3e7f(_0x3a056f[_0x3f69('0x1a')](0x1f4,_0x4f2d30[_0x3f69('0x1b')]));});});};exports[_0x3f69('0x25')]=function(_0x30c65a){return new Promise(function(_0x2c9dc4,_0x395efd){return db[_0x3f69('0x1e')][_0x3f69('0x26')]({'where':_0x30c65a[_0x3f69('0x20')]?_0x30c65a[_0x3f69('0x20')][_0x3f69('0x22')]||null:null})[_0x3f69('0x13')](function(_0x13166e){if(_0x13166e){return _0x13166e[_0x3f69('0x27')](_0x30c65a['body']['ids'],_['omit'](_0x30c65a[_0x3f69('0x1f')],['ids','id'])||{});}})[_0x3f69('0x28')](function(_0x10c657){logger[_0x3f69('0x14')](_0x3f69('0x29'),_0x30c65a);logger[_0x3f69('0x16')](_0x3f69('0x29'),_0x30c65a,JSON[_0x3f69('0x18')](_0x10c657));_0x2c9dc4(_0x10c657);})[_0x3f69('0x24')](function(_0x35d7fe){logger[_0x3f69('0x1a')]('AddTags',_0x35d7fe[_0x3f69('0x1b')],_0x30c65a);_0x395efd(_this[_0x3f69('0x1a')](0x1f4,_0x35d7fe['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index dedc1b8..6e0638c 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 _0xc1a7=['register','length','mailInteraction:','save','update','emit','removeListener'];(function(_0x194750,_0x2f8a0b){var _0x5b9b1e=function(_0x111ba0){while(--_0x111ba0){_0x194750['push'](_0x194750['shift']());}};_0x5b9b1e(++_0x2f8a0b);}(_0xc1a7,0x1ae));var _0x7c1a=function(_0x284d8f,_0x1afc9e){_0x284d8f=_0x284d8f-0x0;var _0x6acf64=_0xc1a7[_0x284d8f];return _0x6acf64;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0x7c1a('0x0'),'remove',_0x7c1a('0x1')];function createListener(_0x41da00,_0x54dc0c){return function(_0x4f4eb9){_0x54dc0c[_0x7c1a('0x2')](_0x41da00,_0x4f4eb9);};}function removeListener(_0x1af76c,_0x530917){return function(){MailInteractionEvents[_0x7c1a('0x3')](_0x1af76c,_0x530917);};}exports[_0x7c1a('0x4')]=function(_0x16b635){for(var _0xfd01e0=0x0,_0x35c171=events[_0x7c1a('0x5')];_0xfd01e0<_0x35c171;_0xfd01e0++){var _0x5a6df7=events[_0xfd01e0];var _0x589667=createListener(_0x7c1a('0x6')+_0x5a6df7,_0x16b635);MailInteractionEvents['on'](_0x5a6df7,_0x589667);}}; \ No newline at end of file +var _0x4e5b=['length','mailInteraction:','./mailInteraction.events','save','update','emit','removeListener'];(function(_0x409af1,_0x1693fb){var _0x5084d6=function(_0x22e30e){while(--_0x22e30e){_0x409af1['push'](_0x409af1['shift']());}};_0x5084d6(++_0x1693fb);}(_0x4e5b,0x144));var _0xb4e5=function(_0x1bee9c,_0x326740){_0x1bee9c=_0x1bee9c-0x0;var _0x5f57f1=_0x4e5b[_0x1bee9c];return _0x5f57f1;};'use strict';var MailInteractionEvents=require(_0xb4e5('0x0'));var events=[_0xb4e5('0x1'),'remove',_0xb4e5('0x2')];function createListener(_0xf452d4,_0x2bb3b5){return function(_0x432078){_0x2bb3b5[_0xb4e5('0x3')](_0xf452d4,_0x432078);};}function removeListener(_0x3d8e14,_0x4fcdb4){return function(){MailInteractionEvents[_0xb4e5('0x4')](_0x3d8e14,_0x4fcdb4);};}exports['register']=function(_0x5c5b6d){for(var _0x1ff1fe=0x0,_0x3d9973=events[_0xb4e5('0x5')];_0x1ff1fe<_0x3d9973;_0x1ff1fe++){var _0x157128=events[_0x1ff1fe];var _0x2f2ec9=createListener(_0xb4e5('0x6')+_0x157128,_0x5c5b6d);MailInteractionEvents['on'](_0x157128,_0x2f2ec9);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 89d4596..38d5244 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 _0xce25=['create','put','/:id/accept','reject','delete','destroy','exports','path','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','index','get','/describe','isAuthenticated','/:id','/:id/download','download','post','mail'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xce25,0x196));var _0x5ce2=function(_0x4ea86,_0x9c41f7){_0x4ea86=_0x4ea86-0x0;var _0x3d9ab0=_0xce25[_0x4ea86];return _0x3d9ab0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5ce2('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5ce2('0x1'));var auth=require(_0x5ce2('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x5ce2('0x3'));var controller=require(_0x5ce2('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x5ce2('0x5')]);router[_0x5ce2('0x6')](_0x5ce2('0x7'),auth[_0x5ce2('0x8')](),controller['describe']);router[_0x5ce2('0x6')](_0x5ce2('0x9'),auth[_0x5ce2('0x8')](),controller['show']);router[_0x5ce2('0x6')](_0x5ce2('0xa'),auth[_0x5ce2('0x8')](),controller[_0x5ce2('0xb')]);router[_0x5ce2('0xc')]('/',auth[_0x5ce2('0x8')](),interaction['tracked'](_0x5ce2('0xd'),'mailmessage:create'),controller[_0x5ce2('0xe')]);router[_0x5ce2('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['put'](_0x5ce2('0x10'),auth['isAuthenticated'](),controller['accept']);router[_0x5ce2('0xf')]('/:id/reject',auth[_0x5ce2('0x8')](),controller[_0x5ce2('0x11')]);router[_0x5ce2('0x12')]('/:id',auth[_0x5ce2('0x8')](),controller[_0x5ce2('0x13')]);module[_0x5ce2('0x14')]=router; \ No newline at end of file +var _0xf7c3=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/download','download','tracked','mail','create','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x22a8a8,_0x3c0a37){var _0x40dc36=function(_0x52a469){while(--_0x52a469){_0x22a8a8['push'](_0x22a8a8['shift']());}};_0x40dc36(++_0x3c0a37);}(_0xf7c3,0x154));var _0x3f7c=function(_0x4dd091,_0x3e43bf){_0x4dd091=_0x4dd091-0x0;var _0x6b1908=_0xf7c3[_0x4dd091];return _0x6b1908;};'use strict';var multer=require(_0x3f7c('0x0'));var util=require(_0x3f7c('0x1'));var path=require(_0x3f7c('0x2'));var timeout=require(_0x3f7c('0x3'));var express=require('express');var router=express[_0x3f7c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3f7c('0x5'));var interaction=require(_0x3f7c('0x6'));var config=require(_0x3f7c('0x7'));var controller=require('./mailMessage.controller');router[_0x3f7c('0x8')]('/',auth[_0x3f7c('0x9')](),controller['index']);router[_0x3f7c('0x8')]('/describe',auth[_0x3f7c('0x9')](),controller['describe']);router[_0x3f7c('0x8')](_0x3f7c('0xa'),auth[_0x3f7c('0x9')](),controller['show']);router[_0x3f7c('0x8')](_0x3f7c('0xb'),auth[_0x3f7c('0x9')](),controller[_0x3f7c('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x3f7c('0xd')](_0x3f7c('0xe'),'mailmessage:create'),controller[_0x3f7c('0xf')]);router[_0x3f7c('0x10')](_0x3f7c('0xa'),auth[_0x3f7c('0x9')](),controller['update']);router[_0x3f7c('0x10')](_0x3f7c('0x11'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x3f7c('0x12'),auth[_0x3f7c('0x9')](),controller[_0x3f7c('0x13')]);router[_0x3f7c('0x14')](_0x3f7c('0xa'),auth['isAuthenticated'](),controller[_0x3f7c('0x15')]);module[_0x3f7c('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 2f55b57..f76b495 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 _0xda23=['out','STRING','DATE','Email','Chat','lodash','TEXT','long','medium','BOOLEAN'];(function(_0x50e40b,_0x338d17){var _0x2608b7=function(_0x4ded5e){while(--_0x4ded5e){_0x50e40b['push'](_0x50e40b['shift']());}};_0x2608b7(++_0x338d17);}(_0xda23,0x1d1));var _0x3da2=function(_0x514260,_0x1891e1){_0x514260=_0x514260-0x0;var _0x4ac81b=_0xda23[_0x514260];return _0x4ac81b;};'use strict';var Sequelize=require('sequelize');var _=require(_0x3da2('0x0'));module['exports']={'body':{'type':Sequelize[_0x3da2('0x1')](_0x3da2('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x3da2('0x1')](_0x3da2('0x3'))},'read':{'type':Sequelize[_0x3da2('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x3da2('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x3da2('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x3da2('0x1')](_0x3da2('0x2'))},'cc':{'type':Sequelize[_0x3da2('0x1')]('long')},'bcc':{'type':Sequelize[_0x3da2('0x1')](_0x3da2('0x2'))},'subject':{'type':Sequelize[_0x3da2('0x1')]},'sentAt':{'type':Sequelize[_0x3da2('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x3da2('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x3da2('0x7')]},'originTo':{'type':Sequelize[_0x3da2('0x1')](_0x3da2('0x2'))},'originCc':{'type':Sequelize[_0x3da2('0x1')]('long')},'originChannel':{'type':Sequelize['ENUM'](_0x3da2('0x8'),_0x3da2('0x9')),'defaultValue':_0x3da2('0x8'),'allowNull':![]}}; \ No newline at end of file +var _0xe08e=['Chat','sequelize','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER'];(function(_0x241941,_0x4f19fe){var _0x3710d1=function(_0x56bf25){while(--_0x56bf25){_0x241941['push'](_0x241941['shift']());}};_0x3710d1(++_0x4f19fe);}(_0xe08e,0x1a5));var _0xee08=function(_0x95c81b,_0x538cd2){_0x95c81b=_0x95c81b-0x0;var _0x5dd811=_0xe08e[_0x95c81b];return _0x5dd811;};'use strict';var Sequelize=require(_0xee08('0x0'));var _=require('lodash');module[_0xee08('0x1')]={'body':{'type':Sequelize[_0xee08('0x2')](_0xee08('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xee08('0x2')](_0xee08('0x4'))},'read':{'type':Sequelize[_0xee08('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xee08('0x6')]('in',_0xee08('0x7')),'defaultValue':_0xee08('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xee08('0x8')](0x1fe)},'from':{'type':Sequelize[_0xee08('0x8')]},'to':{'type':Sequelize['TEXT'](_0xee08('0x3'))},'cc':{'type':Sequelize[_0xee08('0x2')](_0xee08('0x3'))},'bcc':{'type':Sequelize[_0xee08('0x2')](_0xee08('0x3'))},'subject':{'type':Sequelize[_0xee08('0x2')]},'sentAt':{'type':Sequelize[_0xee08('0x9')]},'attach':{'type':Sequelize[_0xee08('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xee08('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xee08('0x9')]},'originTo':{'type':Sequelize[_0xee08('0x2')](_0xee08('0x3'))},'originCc':{'type':Sequelize['TEXT'](_0xee08('0x3'))},'originChannel':{'type':Sequelize[_0xee08('0x6')]('Email',_0xee08('0xb')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 7a136c7..cb9ca81 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 _0xcf5f=['order','sort','where','filters','filter','type','options','includeAll','include','findAll','rows','show','params','find','update','body','describe','create','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','join','root','server/files/attachments','ListId','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','format','UserId','user','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','RejectMessage','rejectMessage','QueryTypes','SELECT','contact','rejectmessage','toString','files','tmp','server','message-%s.eml','from','bcc','subject','Attachments','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','readFileSync','writeFileSync','unlinkSync','moment','util','path','ioredis','../../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','request','then','info','MailMessage,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','status','json','offset','undefined','limit','count','set','destroy','sendStatus','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','nolimit'];(function(_0x5d7a65,_0x2787c2){var _0x3f251c=function(_0x125ca3){while(--_0x125ca3){_0x5d7a65['push'](_0x5d7a65['shift']());}};_0x3f251c(++_0x2787c2);}(_0xcf5f,0x101));var _0xfcf5=function(_0xc7a393,_0x3e150e){_0xc7a393=_0xc7a393-0x0;var _0x3c32c2=_0xcf5f[_0xc7a393];return _0x3c32c2;};'use strict';var emlformat=require('eml-format');var moment=require(_0xfcf5('0x0'));var BPromise=require('bluebird');var util=require(_0xfcf5('0x1'));var path=require(_0xfcf5('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xfcf5('0x3'));var htmlToText=require('html-to-text');var qs=require(_0xfcf5('0x4'));var logger=require(_0xfcf5('0x5'))(_0xfcf5('0x6'));var interaction_log=require(_0xfcf5('0x5'))(_0xfcf5('0x7'));var config=require(_0xfcf5('0x8'));var db=require('../../mysqldb')['db'];config[_0xfcf5('0x9')]=_[_0xfcf5('0xa')](config[_0xfcf5('0x9')],{'host':_0xfcf5('0xb'),'port':0x18eb});var socket=require(_0xfcf5('0xc'))(new Redis(config[_0xfcf5('0x9')]));var htmlEntities=require(_0xfcf5('0xd'));require(_0xfcf5('0xe'))[_0xfcf5('0xf')](socket);var jayson=require(_0xfcf5('0x10'));var client=jayson[_0xfcf5('0x11')][_0xfcf5('0x12')]({'port':0x232c});var client9003=jayson[_0xfcf5('0x11')]['http']({'port':0x232b});var client9002=jayson['client'][_0xfcf5('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x4a1b47,_0x70cdf2,_0x36cc86,_0x4eb474){return new BPromise(function(_0x1ba19a,_0x97bede){var _0x177b0a=_0x4eb474||client;return _0x177b0a[_0xfcf5('0x13')](_0x4a1b47,_0x36cc86)[_0xfcf5('0x14')](function(_0xd291cc){logger[_0xfcf5('0x15')](_0xfcf5('0x16'),_0x70cdf2,'request\x20sent');logger[_0xfcf5('0x17')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x70cdf2,'request\x20sent',JSON[_0xfcf5('0x18')](_0xd291cc));if(_0xd291cc[_0xfcf5('0x19')]){if(_0xd291cc['error'][_0xfcf5('0x1a')]===0x1f4){logger[_0xfcf5('0x19')]('MailMessage,\x20%s,\x20%s',_0x70cdf2,_0xd291cc['error'][_0xfcf5('0x1b')]);return _0x97bede(_0xd291cc[_0xfcf5('0x19')]['message']);}logger['error']('MailMessage,\x20%s,\x20%s',_0x70cdf2,_0xd291cc['error']['message']);return _0x1ba19a(_0xd291cc[_0xfcf5('0x19')][_0xfcf5('0x1b')]);}else{logger[_0xfcf5('0x15')]('MailMessage,\x20%s,\x20%s',_0x70cdf2,'request\x20sent');_0x1ba19a(_0xd291cc[_0xfcf5('0x1c')][_0xfcf5('0x1b')]);}})[_0xfcf5('0x1d')](function(_0x114f59){logger[_0xfcf5('0x19')](_0xfcf5('0x16'),_0x70cdf2,_0x114f59);_0x97bede(_0x114f59);});});}function respondWithResult(_0x2d2b51,_0x59359e){_0x59359e=_0x59359e||0xc8;return function(_0x591e7b){if(_0x591e7b){return _0x2d2b51[_0xfcf5('0x1e')](_0x59359e)[_0xfcf5('0x1f')](_0x591e7b);}};}function respondWithFilteredResult(_0x51266d,_0x2ffbba){return function(_0x9d153){if(_0x9d153){var _0x615a8a=typeof _0x2ffbba[_0xfcf5('0x20')]===_0xfcf5('0x21')&&typeof _0x2ffbba[_0xfcf5('0x22')]===_0xfcf5('0x21');var _0xb449ce=_0x9d153[_0xfcf5('0x23')];var _0x42eca3=_0x615a8a?0x0:_0x2ffbba['offset'];var _0x543e37=_0x615a8a?_0x9d153[_0xfcf5('0x23')]:_0x2ffbba[_0xfcf5('0x20')]+_0x2ffbba[_0xfcf5('0x22')];var _0x4d4588;if(_0x543e37>=_0xb449ce){_0x543e37=_0xb449ce;_0x4d4588=0xc8;}else{_0x4d4588=0xce;}_0x51266d['status'](_0x4d4588);return _0x51266d[_0xfcf5('0x24')]('Content-Range',_0x42eca3+'-'+_0x543e37+'/'+_0xb449ce)[_0xfcf5('0x1f')](_0x9d153);}return null;};}function saveUpdates(_0x4bd514){return function(_0x58a965){if(_0x58a965){return _0x58a965['update'](_0x4bd514)[_0xfcf5('0x14')](function(_0x45b8ee){return _0x45b8ee;});}return null;};}function removeEntity(_0x260094){return function(_0x19a147){if(_0x19a147){return _0x19a147[_0xfcf5('0x25')]()[_0xfcf5('0x14')](function(){_0x260094['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53cb9d){return function(_0x3e7a12){if(!_0x3e7a12){_0x53cb9d[_0xfcf5('0x26')](0x194);}return _0x3e7a12;};}function handleError(_0x4f0ed3,_0x51fa15){_0x51fa15=_0x51fa15||0x1f4;return function(_0x380f0b){logger['error'](_0x380f0b[_0xfcf5('0x27')]);if(_0x380f0b[_0xfcf5('0x28')]){delete _0x380f0b[_0xfcf5('0x28')];}_0x4f0ed3[_0xfcf5('0x1e')](_0x51fa15)[_0xfcf5('0x29')](_0x380f0b);};}exports[_0xfcf5('0x2a')]=function(_0x355376,_0x14856e){var _0x72d64c={},_0x2f417c={},_0x3b678f={'count':0x0,'rows':[]};var _0x1f0c44=_[_0xfcf5('0x2b')](db[_0xfcf5('0x2c')][_0xfcf5('0x2d')],function(_0x26716f){return{'name':_0x26716f[_0xfcf5('0x2e')],'type':_0x26716f['type']['key']};});_0x2f417c[_0xfcf5('0x2f')]=_[_0xfcf5('0x2b')](_0x1f0c44,_0xfcf5('0x28'));_0x2f417c[_0xfcf5('0x30')]=_[_0xfcf5('0x31')](_0x355376['query']);_0x2f417c['filters']=_['intersection'](_0x2f417c[_0xfcf5('0x2f')],_0x2f417c['query']);_0x72d64c[_0xfcf5('0x32')]=_[_0xfcf5('0x33')](_0x2f417c['model'],qs[_0xfcf5('0x34')](_0x355376[_0xfcf5('0x30')][_0xfcf5('0x34')]));_0x72d64c[_0xfcf5('0x32')]=_0x72d64c[_0xfcf5('0x32')][_0xfcf5('0x35')]?_0x72d64c[_0xfcf5('0x32')]:_0x2f417c[_0xfcf5('0x2f')];if(!_0x355376[_0xfcf5('0x30')]['hasOwnProperty'](_0xfcf5('0x36'))){_0x72d64c[_0xfcf5('0x22')]=qs[_0xfcf5('0x22')](_0x355376[_0xfcf5('0x30')][_0xfcf5('0x22')]);_0x72d64c[_0xfcf5('0x20')]=qs[_0xfcf5('0x20')](_0x355376[_0xfcf5('0x30')][_0xfcf5('0x20')]);}_0x72d64c[_0xfcf5('0x37')]=qs[_0xfcf5('0x38')](_0x355376[_0xfcf5('0x30')][_0xfcf5('0x38')]);_0x72d64c[_0xfcf5('0x39')]=qs['filters'](_['pick'](_0x355376[_0xfcf5('0x30')],_0x2f417c[_0xfcf5('0x3a')]),_0x1f0c44);if(_0x355376[_0xfcf5('0x30')][_0xfcf5('0x3b')]){_0x72d64c['where']=_['merge'](_0x72d64c[_0xfcf5('0x39')],{'$or':_[_0xfcf5('0x2b')](_0x1f0c44,function(_0x12d8b9){if(_0x12d8b9[_0xfcf5('0x3c')]!=='VIRTUAL'){var _0x41e8ef={};_0x41e8ef[_0x12d8b9['name']]={'$like':'%'+_0x355376[_0xfcf5('0x30')]['filter']+'%'};return _0x41e8ef;}})});}_0x72d64c=_['merge']({},_0x72d64c,_0x355376[_0xfcf5('0x3d')]);var _0x6cefac={'where':_0x72d64c['where']};return db['MailMessage']['count'](_0x6cefac)['then'](function(_0x3e2403){_0x3b678f[_0xfcf5('0x23')]=_0x3e2403;if(_0x355376['query'][_0xfcf5('0x3e')]){_0x72d64c[_0xfcf5('0x3f')]=[{'all':!![]}];}return db[_0xfcf5('0x2c')][_0xfcf5('0x40')](_0x72d64c);})[_0xfcf5('0x14')](function(_0x15295f){_0x3b678f[_0xfcf5('0x41')]=_0x15295f;return _0x3b678f;})[_0xfcf5('0x14')](respondWithFilteredResult(_0x14856e,_0x72d64c))['catch'](handleError(_0x14856e,null));};exports[_0xfcf5('0x42')]=function(_0x5f1e75,_0x59e779){var _0x54d24b={'raw':!![],'where':{'id':_0x5f1e75[_0xfcf5('0x43')]['id']}},_0x5c89e0={};_0x5c89e0[_0xfcf5('0x2f')]=_['keys'](db['MailMessage'][_0xfcf5('0x2d')]);_0x5c89e0[_0xfcf5('0x30')]=_[_0xfcf5('0x31')](_0x5f1e75['query']);_0x5c89e0[_0xfcf5('0x3a')]=_[_0xfcf5('0x33')](_0x5c89e0[_0xfcf5('0x2f')],_0x5c89e0[_0xfcf5('0x30')]);_0x54d24b['attributes']=_[_0xfcf5('0x33')](_0x5c89e0[_0xfcf5('0x2f')],qs[_0xfcf5('0x34')](_0x5f1e75[_0xfcf5('0x30')][_0xfcf5('0x34')]));_0x54d24b[_0xfcf5('0x32')]=_0x54d24b[_0xfcf5('0x32')]['length']?_0x54d24b['attributes']:_0x5c89e0[_0xfcf5('0x2f')];if(_0x5f1e75[_0xfcf5('0x30')][_0xfcf5('0x3e')]){_0x54d24b[_0xfcf5('0x3f')]=[{'all':!![]}];}_0x54d24b=_['merge']({},_0x54d24b,_0x5f1e75['options']);return db[_0xfcf5('0x2c')][_0xfcf5('0x44')](_0x54d24b)[_0xfcf5('0x14')](handleEntityNotFound(_0x59e779,null))[_0xfcf5('0x14')](respondWithResult(_0x59e779,null))[_0xfcf5('0x1d')](handleError(_0x59e779,null));};exports[_0xfcf5('0x45')]=function(_0x14f29f,_0x2c4d6b){if(_0x14f29f['body']['id']){delete _0x14f29f[_0xfcf5('0x46')]['id'];}return db[_0xfcf5('0x2c')][_0xfcf5('0x44')]({'where':{'id':_0x14f29f[_0xfcf5('0x43')]['id']}})[_0xfcf5('0x14')](handleEntityNotFound(_0x2c4d6b,null))[_0xfcf5('0x14')](saveUpdates(_0x14f29f[_0xfcf5('0x46')],null))[_0xfcf5('0x14')](respondWithResult(_0x2c4d6b,null))[_0xfcf5('0x1d')](handleError(_0x2c4d6b,null));};exports[_0xfcf5('0x25')]=function(_0x307947,_0x33dd8a){return db[_0xfcf5('0x2c')][_0xfcf5('0x44')]({'where':{'id':_0x307947[_0xfcf5('0x43')]['id']}})[_0xfcf5('0x14')](handleEntityNotFound(_0x33dd8a,null))[_0xfcf5('0x14')](removeEntity(_0x33dd8a,null))['catch'](handleError(_0x33dd8a,null));};exports['describe']=function(_0x28649b,_0x2f0d28){return db[_0xfcf5('0x2c')][_0xfcf5('0x47')]()['then'](respondWithResult(_0x2f0d28,null))['catch'](handleError(_0x2f0d28,null));};exports[_0xfcf5('0x48')]=function(_0x4d2827,_0x292eb5){return db['MailMessage'][_0xfcf5('0x48')](_0x4d2827['body'])[_0xfcf5('0x14')](function(_0x2a3dfa){if(_0x2a3dfa){if(_0x2a3dfa['direction']==='out'&&!_0x2a3dfa['secret']){var _0x43618e,_0x431ac4,_0x324a67;if(_0x4d2827[_0xfcf5('0x46')]['to']){_0x431ac4=_0x4d2827[_0xfcf5('0x46')]['to'][_0xfcf5('0x49')](',')[0x0];}return db[_0xfcf5('0x4a')][_0xfcf5('0x4b')]({'where':{'id':_0x2a3dfa[_0xfcf5('0x4c')]},'include':[{'model':db[_0xfcf5('0x4d')],'as':_0xfcf5('0x4e'),'include':[{'model':db[_0xfcf5('0x4f')],'as':_0xfcf5('0x50'),'where':{'email':_0x431ac4},'limit':0x1,'order':[[_0xfcf5('0x51'),_0xfcf5('0x52')]]}]},{'model':db[_0xfcf5('0x53')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xfcf5('0x54')],'as':_0xfcf5('0x54'),'raw':!![]}]}]})[_0xfcf5('0x14')](function(_0x452f4e){_0x43618e=_0x452f4e;if(!_0x43618e||!_0x43618e[_0xfcf5('0x55')])return;var _0x32b948=_0x43618e[_0xfcf5('0x56')]();if(_0x4d2827['body'][_0xfcf5('0x57')]&&_0x4d2827[_0xfcf5('0x46')][_0xfcf5('0x57')]['length']){for(var _0x13ae5c=0x0;_0x13ae5c<_0x4d2827[_0xfcf5('0x46')][_0xfcf5('0x57')][_0xfcf5('0x35')];_0x13ae5c+=0x1){_0x4d2827[_0xfcf5('0x46')][_0xfcf5('0x57')][_0x13ae5c]={'filename':_0x4d2827['body'][_0xfcf5('0x57')][_0x13ae5c][_0xfcf5('0x28')],'path':path[_0xfcf5('0x58')](config[_0xfcf5('0x59')],_0xfcf5('0x5a'),_0x4d2827[_0xfcf5('0x46')]['attachments'][_0x13ae5c]['basename'])};}}_0x324a67={'account':_0x32b948,'message':_0x4d2827[_0xfcf5('0x46')]};return;})[_0xfcf5('0x14')](function(){if(_0x43618e['List']){if(_0x43618e[_0xfcf5('0x4e')][_0xfcf5('0x50')]['length']){return _0x43618e['List'][_0xfcf5('0x50')][0x0];}else{return db[_0xfcf5('0x4f')][_0xfcf5('0x48')](_[_0xfcf5('0xa')](_0x4d2827[_0xfcf5('0x46')],{'firstName':_0x4d2827['body']['to'],'email':_0x4d2827[_0xfcf5('0x46')]['to'],'phone':_0x4d2827[_0xfcf5('0x46')]['to'],'ListId':_0x43618e[_0xfcf5('0x5b')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xfcf5('0x14')](function(){if(_0x324a67){return respondWithRpcPromise(_0xfcf5('0x5c'),_0xfcf5('0x5d'),_0x324a67,client9003)[_0xfcf5('0x14')](function(_0x1c0625){return _0x2a3dfa['update']({'read':!![],'messageId':_0x1c0625['messageId'],'sentAt':moment()['format'](_0xfcf5('0x5e'))});})[_0xfcf5('0x1d')](function(_0x37e436){logger[_0xfcf5('0x19')]('%s',JSON[_0xfcf5('0x18')](_0x37e436));return _0x2a3dfa;});}return _0x2a3dfa;});}return _0x2a3dfa;}})[_0xfcf5('0x14')](respondWithResult(_0x292eb5,0xc9))[_0xfcf5('0x1d')](handleError(_0x292eb5,null));};exports[_0xfcf5('0x5f')]=function(_0x5d11e3,_0x1ebc81){var _0x111ae7={'agent':{},'channel':_0xfcf5('0x60')};if(_0x5d11e3['body']['id']){delete _0x5d11e3['body']['id'];}_0x5d11e3[_0xfcf5('0x46')][_0xfcf5('0x61')]=!![];_0x5d11e3[_0xfcf5('0x46')][_0xfcf5('0x62')]=moment()[_0xfcf5('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x5d11e3[_0xfcf5('0x46')][_0xfcf5('0x64')]=_0x5d11e3[_0xfcf5('0x46')][_0xfcf5('0x64')]||_0x5d11e3[_0xfcf5('0x65')]['id'];_0x111ae7[_0xfcf5('0x66')]['id']=_0x5d11e3[_0xfcf5('0x46')][_0xfcf5('0x64')];return db[_0xfcf5('0x2c')][_0xfcf5('0x44')]({'where':{'id':_0x5d11e3['params']['id'],'UserId':null}})[_0xfcf5('0x14')](handleEntityNotFound(_0x1ebc81,null))[_0xfcf5('0x14')](saveUpdates(_0x5d11e3[_0xfcf5('0x46')],null))['then'](function(_0x4de592){if(_0x4de592){_0x111ae7[_0xfcf5('0x1b')]=_0x4de592[_0xfcf5('0x67')]({'plain':!![]});return db[_0xfcf5('0x68')][_0xfcf5('0x44')]({'where':{'id':_0x4de592[_0xfcf5('0x69')]}});}return null;})[_0xfcf5('0x14')](handleEntityNotFound(_0x1ebc81,null))[_0xfcf5('0x14')](function(_0x3d7c56){if(_0x3d7c56){return _0x3d7c56[_0xfcf5('0x45')]({'UserId':_0x5d11e3[_0xfcf5('0x46')][_0xfcf5('0x64')],'read1stAt':_['isNil'](_0x3d7c56[_0xfcf5('0x6a')])?moment()[_0xfcf5('0x63')](_0xfcf5('0x5e')):undefined});}return null;})[_0xfcf5('0x14')](function(_0xb8d2ea){if(_0xb8d2ea){_0x111ae7[_0xfcf5('0x6b')]=_0xb8d2ea[_0xfcf5('0x67')]({'plain':!![]});interaction_log['info'](_0xfcf5('0x6c'),_0x5d11e3['user']['id'],_0x5d11e3[_0xfcf5('0x65')][_0xfcf5('0x28')],_0x5d11e3['user'][_0xfcf5('0x6d')],_0x111ae7[_0xfcf5('0x6b')]['id'],_0x5d11e3['body']?JSON[_0xfcf5('0x18')](_0x5d11e3['body']):_0xfcf5('0x6e'));return respondWithRpcPromise(_0xfcf5('0x6f'),_0xfcf5('0x70'),_0x111ae7);}return null;})[_0xfcf5('0x14')](function(_0x537c9b){var _0x385e8a=_0xfcf5('0x71')+_0x537c9b['message'][_0xfcf5('0x72')];return db[_0xfcf5('0x73')][_0xfcf5('0x30')](_0x385e8a,{'type':db[_0xfcf5('0x74')]['QueryTypes']['SELECT'],'raw':!![]})[_0xfcf5('0x14')](function(_0x81907e){return _0x81907e;});})['then'](function(_0x1fb894){if(_0x1fb894){_0x111ae7['message']['contact']=_0x1fb894[0x0];if(!_0x5d11e3[_0xfcf5('0x46')][_0xfcf5('0x64')])return;return db[_0xfcf5('0x75')][_0xfcf5('0x44')]({'where':{'id':_0x5d11e3[_0xfcf5('0x46')][_0xfcf5('0x64')],'role':_0xfcf5('0x66')},'attributes':['id',_0xfcf5('0x28'),_0xfcf5('0x76'),_0xfcf5('0x77'),_0xfcf5('0x78')],'raw':!![]});}return null;})['then'](function(_0x5358fc){if(!_0x5358fc)return null;_0x111ae7[_0xfcf5('0x1b')]['agent']=_0x5358fc;return _0x111ae7;})['then'](function(_0x429ace){if(_0x429ace){if(_0x5d11e3[_0xfcf5('0x46')][_0xfcf5('0x79')]){_0x111ae7['message'][_0xfcf5('0x7a')]=util['format'](_0xfcf5('0x7b'),_0x5d11e3[_0xfcf5('0x65')][_0xfcf5('0x28')]);_0x111ae7['message'][_0xfcf5('0x7c')]=_0x111ae7[_0xfcf5('0x7c')];_0x111ae7[_0xfcf5('0x1b')][_0xfcf5('0x7d')]=_0x111ae7[_0xfcf5('0x7c')];_0x111ae7['message'][_0xfcf5('0x7e')]=_0xfcf5('0x5f');_0x111ae7[_0xfcf5('0x1b')][_0xfcf5('0x46')]=htmlToText[_0xfcf5('0x7f')](_0x111ae7['message'][_0xfcf5('0x46')]);return respondWithRpcPromise(_0xfcf5('0x80'),'EventManager',{'event':_0xfcf5('0x81'),'message':_0x111ae7[_0xfcf5('0x1b')]},client9002)[_0xfcf5('0x14')](function(){return _0x111ae7;});}return _0x111ae7;}return null;})[_0xfcf5('0x14')](respondWithResult(_0x1ebc81,null))[_0xfcf5('0x1d')](handleError(_0x1ebc81,null));};exports[_0xfcf5('0x82')]=function(_0x2274b8,_0x5caf57){var _0x56bcd5={'agent':{},'channel':_0xfcf5('0x60')};if(_0x2274b8[_0xfcf5('0x46')]['id']){delete _0x2274b8[_0xfcf5('0x46')]['id'];}_0x2274b8['body'][_0xfcf5('0x64')]=_0x2274b8[_0xfcf5('0x46')]['UserId']||_0x2274b8['user']['id'];_0x56bcd5[_0xfcf5('0x66')]['id']=_0x2274b8[_0xfcf5('0x46')][_0xfcf5('0x64')];return db[_0xfcf5('0x2c')][_0xfcf5('0x44')]({'where':{'id':_0x2274b8[_0xfcf5('0x43')]['id'],'UserId':null}})[_0xfcf5('0x14')](handleEntityNotFound(_0x5caf57,null))[_0xfcf5('0x14')](function(_0x2bfaf8){if(_0x2bfaf8){_0x56bcd5[_0xfcf5('0x1b')]=_0x2bfaf8[_0xfcf5('0x67')]({'plain':!![]});return db['MailInteraction'][_0xfcf5('0x44')]({'where':{'id':_0x2bfaf8[_0xfcf5('0x69')]}});}return null;})[_0xfcf5('0x14')](handleEntityNotFound(_0x5caf57,null))[_0xfcf5('0x14')](function(_0x53bce2){if(_0x53bce2){_0x56bcd5[_0xfcf5('0x6b')]=_0x53bce2['get']({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2274b8[_0xfcf5('0x65')]['id'],_0x2274b8[_0xfcf5('0x65')]['name'],_0x2274b8[_0xfcf5('0x65')]['role'],_0x56bcd5['interaction']['id'],_0x2274b8['body']?JSON[_0xfcf5('0x18')](_0x2274b8[_0xfcf5('0x46')]):_0xfcf5('0x6e'));return respondWithRpcPromise(_0xfcf5('0x83'),_0xfcf5('0x84'),_0x56bcd5);}return null;})['then'](function(_0x9dfd24){var _0x490a0e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x9dfd24[_0xfcf5('0x1b')][_0xfcf5('0x72')];return db[_0xfcf5('0x73')][_0xfcf5('0x30')](_0x490a0e,{'type':db[_0xfcf5('0x74')][_0xfcf5('0x85')][_0xfcf5('0x86')],'raw':!![]})['then'](function(_0x613cf4){return _0x613cf4;});})[_0xfcf5('0x14')](function(_0x89099f){if(_0x89099f){_0x56bcd5[_0xfcf5('0x1b')][_0xfcf5('0x87')]=_0x89099f[0x0];if(!_0x2274b8[_0xfcf5('0x46')][_0xfcf5('0x64')])return;return db[_0xfcf5('0x75')][_0xfcf5('0x44')]({'where':{'id':_0x2274b8[_0xfcf5('0x46')][_0xfcf5('0x64')],'role':'agent'},'attributes':['id',_0xfcf5('0x28'),_0xfcf5('0x76'),'email','internal'],'raw':!![]});}return null;})[_0xfcf5('0x14')](function(_0x21d513){if(!_0x21d513)return null;_0x56bcd5[_0xfcf5('0x1b')][_0xfcf5('0x66')]=_0x21d513;return _0x56bcd5;})['then'](function(_0x52b913){if(_0x52b913){_0x52b913['message'][_0xfcf5('0x7a')]=util[_0xfcf5('0x63')](_0xfcf5('0x7b'),_0x2274b8[_0xfcf5('0x65')][_0xfcf5('0x28')]);_0x52b913['message'][_0xfcf5('0x7c')]=_0x56bcd5['channel'];_0x52b913[_0xfcf5('0x1b')]['motionChannel']=_0x56bcd5['channel'];_0x52b913[_0xfcf5('0x1b')][_0xfcf5('0x7e')]=_0xfcf5('0x82');_0x52b913['message'][_0xfcf5('0x46')]=htmlToText[_0xfcf5('0x7f')](_0x56bcd5[_0xfcf5('0x1b')][_0xfcf5('0x46')]);respondWithRpcPromise('EventManager',_0xfcf5('0x80'),{'event':_0xfcf5('0x88'),'message':_0x52b913[_0xfcf5('0x1b')]},client9002);return _0x56bcd5;}return null;})[_0xfcf5('0x14')](respondWithResult(_0x5caf57,null))[_0xfcf5('0x1d')](handleError(_0x5caf57,null));};exports['download']=function(_0x20667e,_0x5616ea){var _0x4094a4=moment()['unix']()[_0xfcf5('0x89')]();var _0x237ff5=path[_0xfcf5('0x58')](config['root'],'server',_0xfcf5('0x8a'),_0xfcf5('0x8b'));var _0x410546=path['join'](config[_0xfcf5('0x59')],_0xfcf5('0x8c'),_0xfcf5('0x8a'),_0xfcf5('0x57'));var _0x487e48=util[_0xfcf5('0x63')](_0xfcf5('0x8d'),_0x4094a4);return db[_0xfcf5('0x2c')][_0xfcf5('0x44')]({'where':{'id':_0x20667e['params']['id']},'attributes':['id',_0xfcf5('0x46'),_0xfcf5('0x8e'),'to','cc',_0xfcf5('0x8f'),_0xfcf5('0x90'),'createdAt'],'include':_0x20667e[_0xfcf5('0x30')]['attachments']?[{'model':db['Attachment'],'as':_0xfcf5('0x91')}]:undefined})['then'](handleEntityNotFound(_0x5616ea,null))[_0xfcf5('0x14')](function(_0x15c092){if(_0x15c092){var _0x3d2d23=_0x15c092;var _0x343506={'from':_0x3d2d23['from'],'to':_0x3d2d23['to'],'subject':_0x3d2d23[_0xfcf5('0x90')],'html':htmlEntities[_0xfcf5('0x92')](_0x3d2d23[_0xfcf5('0x46')]),'headers':{'Date':moment(_0x3d2d23[_0xfcf5('0x93')])[_0xfcf5('0x63')](_0xfcf5('0x94'))},'attachments':[]};if(_0x15c092['cc']){_0x343506[_0xfcf5('0x95')]['Cc']=_0x15c092['cc'];}if(_0x15c092[_0xfcf5('0x8f')]){_0x343506[_0xfcf5('0x95')][_0xfcf5('0x96')]=_0x15c092['bcc'];}return new BPromise(function(_0x2ae884,_0x323ab1){if(_0x15c092['Attachments']){for(var _0x38746e=0x0;_0x38746e<_0x15c092[_0xfcf5('0x91')][_0xfcf5('0x35')];_0x38746e++){var _0x225969=_0x15c092[_0xfcf5('0x91')][_0x38746e];var _0x32ec0f=path[_0xfcf5('0x58')](_0x410546,_0x225969['basename']);if(fs[_0xfcf5('0x97')](_0x32ec0f)){_0x343506[_0xfcf5('0x57')][_0xfcf5('0x98')]({'name':_0x225969['name'],'contentType':_0x225969['type'],'data':fs[_0xfcf5('0x99')](_0x32ec0f)});}}}emlformat['build'](_0x343506,function(_0x130f6a,_0x532b58){if(_0x130f6a)return _0x323ab1(_0x130f6a);fs[_0xfcf5('0x9a')](path[_0xfcf5('0x58')](_0x237ff5,_0x487e48),_0x532b58);return _0x2ae884(_0x532b58);});});}})[_0xfcf5('0x14')](function(_0x295848){if(_0x295848){return _0x5616ea['download'](path[_0xfcf5('0x58')](_0x237ff5,_0x487e48),_0x487e48,function(_0x3bbd09){if(!_0x3bbd09)fs[_0xfcf5('0x9b')](path[_0xfcf5('0x58')](_0x237ff5,_0x487e48));});}})[_0xfcf5('0x1d')](handleError(_0x5616ea,null));}; \ No newline at end of file +var _0x23fe=['key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','filter','options','includeAll','include','findAll','rows','show','params','find','body','describe','create','direction','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','readAt','UserId','user','agent','MailInteraction','MailInteractionId','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','sequelize','SELECT','contact','fullname','email','manual','channel','motionChannel','event','EventManager','reject','mail','get','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','Sequelize','QueryTypes','interface','fromString','rejectmessage','download','toString','root','server','files','message-%s.eml','from','bcc','createdAt','Attachment','subject','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','moment','bluebird','util','lodash','ioredis','html-to-text','../../config/logger','mail-interactions','../../config/environment','redis','defaults','socket.io-emitter','./mailMessage.socket','jayson/promise','client','http','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','status','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','map','MailMessage','fieldName','type'];(function(_0x263b0e,_0xc6479f){var _0x113fee=function(_0x803881){while(--_0x803881){_0x263b0e['push'](_0x263b0e['shift']());}};_0x113fee(++_0xc6479f);}(_0x23fe,0x193));var _0xe23f=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x23fe[_0x3ea913];return _0x2b4f28;};'use strict';var emlformat=require('eml-format');var moment=require(_0xe23f('0x0'));var BPromise=require(_0xe23f('0x1'));var util=require(_0xe23f('0x2'));var path=require('path');var fs=require('fs');var _=require(_0xe23f('0x3'));var Redis=require(_0xe23f('0x4'));var htmlToText=require(_0xe23f('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xe23f('0x6'))('api');var interaction_log=require(_0xe23f('0x6'))(_0xe23f('0x7'));var config=require(_0xe23f('0x8'));var db=require('../../mysqldb')['db'];config[_0xe23f('0x9')]=_[_0xe23f('0xa')](config[_0xe23f('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xe23f('0xb'))(new Redis(config[_0xe23f('0x9')]));var htmlEntities=require('html-entities');require(_0xe23f('0xc'))['register'](socket);var jayson=require(_0xe23f('0xd'));var client=jayson[_0xe23f('0xe')]['http']({'port':0x232c});var client9003=jayson[_0xe23f('0xe')][_0xe23f('0xf')]({'port':0x232b});var client9002=jayson['client'][_0xe23f('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x465b07,_0x3d5f66,_0x47ee8d,_0x14fe48){return new BPromise(function(_0x5d6ae5,_0xbad45d){var _0x576495=_0x14fe48||client;return _0x576495['request'](_0x465b07,_0x47ee8d)[_0xe23f('0x10')](function(_0x3bed1c){logger[_0xe23f('0x11')]('MailMessage,\x20%s,\x20%s',_0x3d5f66,_0xe23f('0x12'));logger[_0xe23f('0x13')](_0xe23f('0x14'),_0x3d5f66,'request\x20sent',JSON[_0xe23f('0x15')](_0x3bed1c));if(_0x3bed1c[_0xe23f('0x16')]){if(_0x3bed1c[_0xe23f('0x16')][_0xe23f('0x17')]===0x1f4){logger[_0xe23f('0x16')](_0xe23f('0x18'),_0x3d5f66,_0x3bed1c['error'][_0xe23f('0x19')]);return _0xbad45d(_0x3bed1c[_0xe23f('0x16')][_0xe23f('0x19')]);}logger[_0xe23f('0x16')](_0xe23f('0x18'),_0x3d5f66,_0x3bed1c[_0xe23f('0x16')][_0xe23f('0x19')]);return _0x5d6ae5(_0x3bed1c[_0xe23f('0x16')][_0xe23f('0x19')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x3d5f66,_0xe23f('0x12'));_0x5d6ae5(_0x3bed1c[_0xe23f('0x1a')]['message']);}})[_0xe23f('0x1b')](function(_0x1b21fc){logger['error'](_0xe23f('0x18'),_0x3d5f66,_0x1b21fc);_0xbad45d(_0x1b21fc);});});}function respondWithResult(_0x1a7283,_0x2abd95){_0x2abd95=_0x2abd95||0xc8;return function(_0x50d266){if(_0x50d266){return _0x1a7283[_0xe23f('0x1c')](_0x2abd95)['json'](_0x50d266);}};}function respondWithFilteredResult(_0x479998,_0x614798){return function(_0x181edd){if(_0x181edd){var _0x4865e9=typeof _0x614798[_0xe23f('0x1d')]===_0xe23f('0x1e')&&typeof _0x614798[_0xe23f('0x1f')]===_0xe23f('0x1e');var _0x353c49=_0x181edd['count'];var _0x544697=_0x4865e9?0x0:_0x614798[_0xe23f('0x1d')];var _0x11595f=_0x4865e9?_0x181edd[_0xe23f('0x20')]:_0x614798[_0xe23f('0x1d')]+_0x614798[_0xe23f('0x1f')];var _0x5aef17;if(_0x11595f>=_0x353c49){_0x11595f=_0x353c49;_0x5aef17=0xc8;}else{_0x5aef17=0xce;}_0x479998[_0xe23f('0x1c')](_0x5aef17);return _0x479998[_0xe23f('0x21')](_0xe23f('0x22'),_0x544697+'-'+_0x11595f+'/'+_0x353c49)['json'](_0x181edd);}return null;};}function saveUpdates(_0x4dd10f){return function(_0xab29c7){if(_0xab29c7){return _0xab29c7[_0xe23f('0x23')](_0x4dd10f)[_0xe23f('0x10')](function(_0x25903e){return _0x25903e;});}return null;};}function removeEntity(_0x1f053e){return function(_0x39ec6e){if(_0x39ec6e){return _0x39ec6e[_0xe23f('0x24')]()[_0xe23f('0x10')](function(){_0x1f053e[_0xe23f('0x1c')](0xcc)[_0xe23f('0x25')]();});}};}function handleEntityNotFound(_0x20234e){return function(_0x132a78){if(!_0x132a78){_0x20234e[_0xe23f('0x26')](0x194);}return _0x132a78;};}function handleError(_0x133551,_0x38bf3d){_0x38bf3d=_0x38bf3d||0x1f4;return function(_0x2c1b05){logger[_0xe23f('0x16')](_0x2c1b05[_0xe23f('0x27')]);if(_0x2c1b05[_0xe23f('0x28')]){delete _0x2c1b05[_0xe23f('0x28')];}_0x133551['status'](_0x38bf3d)[_0xe23f('0x29')](_0x2c1b05);};}exports[_0xe23f('0x2a')]=function(_0x1e7e5c,_0x5bf3db){var _0x137d13={},_0x407751={},_0x2f9631={'count':0x0,'rows':[]};var _0x4b9cf6=_[_0xe23f('0x2b')](db[_0xe23f('0x2c')]['rawAttributes'],function(_0x459879){return{'name':_0x459879[_0xe23f('0x2d')],'type':_0x459879[_0xe23f('0x2e')][_0xe23f('0x2f')]};});_0x407751['model']=_[_0xe23f('0x2b')](_0x4b9cf6,_0xe23f('0x28'));_0x407751[_0xe23f('0x30')]=_[_0xe23f('0x31')](_0x1e7e5c['query']);_0x407751[_0xe23f('0x32')]=_[_0xe23f('0x33')](_0x407751[_0xe23f('0x34')],_0x407751['query']);_0x137d13[_0xe23f('0x35')]=_[_0xe23f('0x33')](_0x407751[_0xe23f('0x34')],qs[_0xe23f('0x36')](_0x1e7e5c['query'][_0xe23f('0x36')]));_0x137d13[_0xe23f('0x35')]=_0x137d13[_0xe23f('0x35')][_0xe23f('0x37')]?_0x137d13[_0xe23f('0x35')]:_0x407751['model'];if(!_0x1e7e5c[_0xe23f('0x30')][_0xe23f('0x38')](_0xe23f('0x39'))){_0x137d13[_0xe23f('0x1f')]=qs[_0xe23f('0x1f')](_0x1e7e5c['query']['limit']);_0x137d13['offset']=qs[_0xe23f('0x1d')](_0x1e7e5c[_0xe23f('0x30')][_0xe23f('0x1d')]);}_0x137d13['order']=qs[_0xe23f('0x3a')](_0x1e7e5c[_0xe23f('0x30')]['sort']);_0x137d13['where']=qs['filters'](_['pick'](_0x1e7e5c['query'],_0x407751[_0xe23f('0x32')]),_0x4b9cf6);if(_0x1e7e5c[_0xe23f('0x30')]['filter']){_0x137d13[_0xe23f('0x3b')]=_[_0xe23f('0x3c')](_0x137d13[_0xe23f('0x3b')],{'$or':_['map'](_0x4b9cf6,function(_0x25c045){if(_0x25c045[_0xe23f('0x2e')]!=='VIRTUAL'){var _0x1dd6c6={};_0x1dd6c6[_0x25c045['name']]={'$like':'%'+_0x1e7e5c[_0xe23f('0x30')][_0xe23f('0x3d')]+'%'};return _0x1dd6c6;}})});}_0x137d13=_[_0xe23f('0x3c')]({},_0x137d13,_0x1e7e5c[_0xe23f('0x3e')]);var _0x19d73d={'where':_0x137d13[_0xe23f('0x3b')]};return db[_0xe23f('0x2c')][_0xe23f('0x20')](_0x19d73d)[_0xe23f('0x10')](function(_0x3d8578){_0x2f9631[_0xe23f('0x20')]=_0x3d8578;if(_0x1e7e5c['query'][_0xe23f('0x3f')]){_0x137d13[_0xe23f('0x40')]=[{'all':!![]}];}return db[_0xe23f('0x2c')][_0xe23f('0x41')](_0x137d13);})['then'](function(_0x350b61){_0x2f9631[_0xe23f('0x42')]=_0x350b61;return _0x2f9631;})[_0xe23f('0x10')](respondWithFilteredResult(_0x5bf3db,_0x137d13))['catch'](handleError(_0x5bf3db,null));};exports[_0xe23f('0x43')]=function(_0x26550b,_0x1074f8){var _0x2ab283={'raw':!![],'where':{'id':_0x26550b[_0xe23f('0x44')]['id']}},_0x4eb93e={};_0x4eb93e['model']=_[_0xe23f('0x31')](db['MailMessage']['rawAttributes']);_0x4eb93e[_0xe23f('0x30')]=_['keys'](_0x26550b[_0xe23f('0x30')]);_0x4eb93e[_0xe23f('0x32')]=_['intersection'](_0x4eb93e['model'],_0x4eb93e[_0xe23f('0x30')]);_0x2ab283[_0xe23f('0x35')]=_[_0xe23f('0x33')](_0x4eb93e[_0xe23f('0x34')],qs[_0xe23f('0x36')](_0x26550b['query'][_0xe23f('0x36')]));_0x2ab283[_0xe23f('0x35')]=_0x2ab283[_0xe23f('0x35')][_0xe23f('0x37')]?_0x2ab283['attributes']:_0x4eb93e[_0xe23f('0x34')];if(_0x26550b['query'][_0xe23f('0x3f')]){_0x2ab283[_0xe23f('0x40')]=[{'all':!![]}];}_0x2ab283=_['merge']({},_0x2ab283,_0x26550b[_0xe23f('0x3e')]);return db['MailMessage'][_0xe23f('0x45')](_0x2ab283)[_0xe23f('0x10')](handleEntityNotFound(_0x1074f8,null))[_0xe23f('0x10')](respondWithResult(_0x1074f8,null))['catch'](handleError(_0x1074f8,null));};exports[_0xe23f('0x23')]=function(_0x187283,_0x282616){if(_0x187283[_0xe23f('0x46')]['id']){delete _0x187283[_0xe23f('0x46')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x187283[_0xe23f('0x44')]['id']}})[_0xe23f('0x10')](handleEntityNotFound(_0x282616,null))[_0xe23f('0x10')](saveUpdates(_0x187283[_0xe23f('0x46')],null))[_0xe23f('0x10')](respondWithResult(_0x282616,null))[_0xe23f('0x1b')](handleError(_0x282616,null));};exports['destroy']=function(_0x29c8bc,_0xca4662){return db[_0xe23f('0x2c')][_0xe23f('0x45')]({'where':{'id':_0x29c8bc['params']['id']}})[_0xe23f('0x10')](handleEntityNotFound(_0xca4662,null))[_0xe23f('0x10')](removeEntity(_0xca4662,null))[_0xe23f('0x1b')](handleError(_0xca4662,null));};exports[_0xe23f('0x47')]=function(_0xad054c,_0x592099){return db[_0xe23f('0x2c')][_0xe23f('0x47')]()[_0xe23f('0x10')](respondWithResult(_0x592099,null))[_0xe23f('0x1b')](handleError(_0x592099,null));};exports[_0xe23f('0x48')]=function(_0x30752a,_0xefb17e){return db[_0xe23f('0x2c')]['create'](_0x30752a['body'])[_0xe23f('0x10')](function(_0x41b974){if(_0x41b974){if(_0x41b974[_0xe23f('0x49')]==='out'&&!_0x41b974['secret']){var _0x106df4,_0x35680a,_0x1667be;if(_0x30752a['body']['to']){_0x35680a=_0x30752a[_0xe23f('0x46')]['to'][_0xe23f('0x4a')](',')[0x0];}return db[_0xe23f('0x4b')][_0xe23f('0x4c')]({'where':{'id':_0x41b974[_0xe23f('0x4d')]},'include':[{'model':db[_0xe23f('0x4e')],'as':_0xe23f('0x4f'),'include':[{'model':db[_0xe23f('0x50')],'as':_0xe23f('0x51'),'where':{'email':_0x35680a},'limit':0x1,'order':[[_0xe23f('0x52'),_0xe23f('0x53')]]}]},{'model':db[_0xe23f('0x54')],'as':_0xe23f('0x55'),'raw':!![],'include':[{'model':db[_0xe23f('0x56')],'as':_0xe23f('0x56'),'raw':!![]}]}]})[_0xe23f('0x10')](function(_0x1b740d){_0x106df4=_0x1b740d;if(!_0x106df4||!_0x106df4[_0xe23f('0x55')])return;var _0x50bc94=_0x106df4[_0xe23f('0x57')]();if(_0x30752a[_0xe23f('0x46')][_0xe23f('0x58')]&&_0x30752a['body'][_0xe23f('0x58')][_0xe23f('0x37')]){for(var _0x5b0e07=0x0;_0x5b0e07<_0x30752a[_0xe23f('0x46')]['attachments']['length'];_0x5b0e07+=0x1){_0x30752a[_0xe23f('0x46')][_0xe23f('0x58')][_0x5b0e07]={'filename':_0x30752a[_0xe23f('0x46')]['attachments'][_0x5b0e07][_0xe23f('0x28')],'path':path[_0xe23f('0x59')](config['root'],_0xe23f('0x5a'),_0x30752a[_0xe23f('0x46')][_0xe23f('0x58')][_0x5b0e07]['basename'])};}}_0x1667be={'account':_0x50bc94,'message':_0x30752a[_0xe23f('0x46')]};return;})[_0xe23f('0x10')](function(){if(_0x106df4[_0xe23f('0x4f')]){if(_0x106df4['List']['Contacts']['length']){return _0x106df4[_0xe23f('0x4f')]['Contacts'][0x0];}else{return db[_0xe23f('0x50')]['create'](_[_0xe23f('0xa')](_0x30752a[_0xe23f('0x46')],{'firstName':_0x30752a[_0xe23f('0x46')]['to'],'email':_0x30752a[_0xe23f('0x46')]['to'],'phone':_0x30752a[_0xe23f('0x46')]['to'],'ListId':_0x106df4[_0xe23f('0x5b')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xe23f('0x10')](function(){if(_0x1667be){return respondWithRpcPromise(_0xe23f('0x5c'),_0xe23f('0x5d'),_0x1667be,client9003)[_0xe23f('0x10')](function(_0x1c0a70){return _0x41b974['update']({'read':!![],'messageId':_0x1c0a70[_0xe23f('0x5e')],'sentAt':moment()[_0xe23f('0x5f')](_0xe23f('0x60'))});})[_0xe23f('0x1b')](function(_0x53df64){logger[_0xe23f('0x16')]('%s',JSON[_0xe23f('0x15')](_0x53df64));return _0x41b974;});}return _0x41b974;});}return _0x41b974;}})[_0xe23f('0x10')](respondWithResult(_0xefb17e,0xc9))[_0xe23f('0x1b')](handleError(_0xefb17e,null));};exports[_0xe23f('0x61')]=function(_0x156ab8,_0x11cd0b){var _0x2ea0ec={'agent':{},'channel':'mail'};if(_0x156ab8['body']['id']){delete _0x156ab8['body']['id'];}_0x156ab8['body']['read']=!![];_0x156ab8[_0xe23f('0x46')][_0xe23f('0x62')]=moment()[_0xe23f('0x5f')](_0xe23f('0x60'));_0x156ab8[_0xe23f('0x46')][_0xe23f('0x63')]=_0x156ab8[_0xe23f('0x46')][_0xe23f('0x63')]||_0x156ab8[_0xe23f('0x64')]['id'];_0x2ea0ec[_0xe23f('0x65')]['id']=_0x156ab8[_0xe23f('0x46')][_0xe23f('0x63')];return db[_0xe23f('0x2c')][_0xe23f('0x45')]({'where':{'id':_0x156ab8['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x11cd0b,null))[_0xe23f('0x10')](saveUpdates(_0x156ab8['body'],null))[_0xe23f('0x10')](function(_0x14b31e){if(_0x14b31e){_0x2ea0ec[_0xe23f('0x19')]=_0x14b31e['get']({'plain':!![]});return db[_0xe23f('0x66')][_0xe23f('0x45')]({'where':{'id':_0x14b31e[_0xe23f('0x67')]}});}return null;})[_0xe23f('0x10')](handleEntityNotFound(_0x11cd0b,null))[_0xe23f('0x10')](function(_0x429c79){if(_0x429c79){return _0x429c79[_0xe23f('0x23')]({'UserId':_0x156ab8[_0xe23f('0x46')][_0xe23f('0x63')],'read1stAt':_['isNil'](_0x429c79[_0xe23f('0x68')])?moment()[_0xe23f('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe23f('0x10')](function(_0x30770b){if(_0x30770b){_0x2ea0ec['interaction']=_0x30770b['get']({'plain':!![]});interaction_log[_0xe23f('0x11')](_0xe23f('0x69'),_0x156ab8[_0xe23f('0x64')]['id'],_0x156ab8['user'][_0xe23f('0x28')],_0x156ab8['user'][_0xe23f('0x6a')],_0x2ea0ec[_0xe23f('0x6b')]['id'],_0x156ab8[_0xe23f('0x46')]?JSON[_0xe23f('0x15')](_0x156ab8[_0xe23f('0x46')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x2ea0ec);}return null;})[_0xe23f('0x10')](function(_0x1d133f){var _0x29f7d5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1d133f[_0xe23f('0x19')]['ContactId'];return db[_0xe23f('0x6c')][_0xe23f('0x30')](_0x29f7d5,{'type':db['Sequelize']['QueryTypes'][_0xe23f('0x6d')],'raw':!![]})[_0xe23f('0x10')](function(_0x244218){return _0x244218;});})[_0xe23f('0x10')](function(_0x2502bb){if(_0x2502bb){_0x2ea0ec[_0xe23f('0x19')][_0xe23f('0x6e')]=_0x2502bb[0x0];if(!_0x156ab8[_0xe23f('0x46')][_0xe23f('0x63')])return;return db['User']['find']({'where':{'id':_0x156ab8[_0xe23f('0x46')][_0xe23f('0x63')],'role':_0xe23f('0x65')},'attributes':['id',_0xe23f('0x28'),_0xe23f('0x6f'),_0xe23f('0x70'),'internal'],'raw':!![]});}return null;})[_0xe23f('0x10')](function(_0x5d92bd){if(!_0x5d92bd)return null;_0x2ea0ec[_0xe23f('0x19')][_0xe23f('0x65')]=_0x5d92bd;return _0x2ea0ec;})['then'](function(_0x4b546f){if(_0x4b546f){if(_0x156ab8[_0xe23f('0x46')][_0xe23f('0x71')]){_0x2ea0ec['message']['interface']=util[_0xe23f('0x5f')]('SIP/%s',_0x156ab8['user'][_0xe23f('0x28')]);_0x2ea0ec[_0xe23f('0x19')][_0xe23f('0x72')]=_0x2ea0ec[_0xe23f('0x72')];_0x2ea0ec['message'][_0xe23f('0x73')]=_0x2ea0ec[_0xe23f('0x72')];_0x2ea0ec[_0xe23f('0x19')][_0xe23f('0x74')]=_0xe23f('0x61');_0x2ea0ec['message']['body']=htmlToText['fromString'](_0x2ea0ec['message'][_0xe23f('0x46')]);return respondWithRpcPromise(_0xe23f('0x75'),'EventManager',{'event':'acceptmessage','message':_0x2ea0ec[_0xe23f('0x19')]},client9002)[_0xe23f('0x10')](function(){return _0x2ea0ec;});}return _0x2ea0ec;}return null;})[_0xe23f('0x10')](respondWithResult(_0x11cd0b,null))['catch'](handleError(_0x11cd0b,null));};exports[_0xe23f('0x76')]=function(_0x2a02f4,_0x7de4ae){var _0x580a96={'agent':{},'channel':_0xe23f('0x77')};if(_0x2a02f4[_0xe23f('0x46')]['id']){delete _0x2a02f4[_0xe23f('0x46')]['id'];}_0x2a02f4[_0xe23f('0x46')][_0xe23f('0x63')]=_0x2a02f4[_0xe23f('0x46')][_0xe23f('0x63')]||_0x2a02f4['user']['id'];_0x580a96[_0xe23f('0x65')]['id']=_0x2a02f4[_0xe23f('0x46')][_0xe23f('0x63')];return db['MailMessage'][_0xe23f('0x45')]({'where':{'id':_0x2a02f4['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x7de4ae,null))['then'](function(_0x4418e1){if(_0x4418e1){_0x580a96['message']=_0x4418e1[_0xe23f('0x78')]({'plain':!![]});return db[_0xe23f('0x66')][_0xe23f('0x45')]({'where':{'id':_0x4418e1[_0xe23f('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x7de4ae,null))[_0xe23f('0x10')](function(_0x33fc56){if(_0x33fc56){_0x580a96[_0xe23f('0x6b')]=_0x33fc56[_0xe23f('0x78')]({'plain':!![]});interaction_log[_0xe23f('0x11')](_0xe23f('0x79'),_0x2a02f4[_0xe23f('0x64')]['id'],_0x2a02f4[_0xe23f('0x64')][_0xe23f('0x28')],_0x2a02f4[_0xe23f('0x64')][_0xe23f('0x6a')],_0x580a96[_0xe23f('0x6b')]['id'],_0x2a02f4['body']?JSON[_0xe23f('0x15')](_0x2a02f4[_0xe23f('0x46')]):_0xe23f('0x7a'));return respondWithRpcPromise(_0xe23f('0x7b'),_0xe23f('0x7c'),_0x580a96);}return null;})[_0xe23f('0x10')](function(_0x4df96f){var _0xa6ea97='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4df96f[_0xe23f('0x19')][_0xe23f('0x7d')];return db['sequelize']['query'](_0xa6ea97,{'type':db[_0xe23f('0x7e')][_0xe23f('0x7f')][_0xe23f('0x6d')],'raw':!![]})[_0xe23f('0x10')](function(_0x1cb531){return _0x1cb531;});})[_0xe23f('0x10')](function(_0xdb6278){if(_0xdb6278){_0x580a96[_0xe23f('0x19')][_0xe23f('0x6e')]=_0xdb6278[0x0];if(!_0x2a02f4['body'][_0xe23f('0x63')])return;return db['User'][_0xe23f('0x45')]({'where':{'id':_0x2a02f4[_0xe23f('0x46')]['UserId'],'role':_0xe23f('0x65')},'attributes':['id',_0xe23f('0x28'),_0xe23f('0x6f'),_0xe23f('0x70'),'internal'],'raw':!![]});}return null;})[_0xe23f('0x10')](function(_0x57e54a){if(!_0x57e54a)return null;_0x580a96['message'][_0xe23f('0x65')]=_0x57e54a;return _0x580a96;})['then'](function(_0x175d15){if(_0x175d15){_0x175d15[_0xe23f('0x19')][_0xe23f('0x80')]=util[_0xe23f('0x5f')]('SIP/%s',_0x2a02f4['user'][_0xe23f('0x28')]);_0x175d15[_0xe23f('0x19')]['channel']=_0x580a96['channel'];_0x175d15[_0xe23f('0x19')]['motionChannel']=_0x580a96['channel'];_0x175d15[_0xe23f('0x19')][_0xe23f('0x74')]='reject';_0x175d15['message'][_0xe23f('0x46')]=htmlToText[_0xe23f('0x81')](_0x580a96[_0xe23f('0x19')][_0xe23f('0x46')]);respondWithRpcPromise('EventManager',_0xe23f('0x75'),{'event':_0xe23f('0x82'),'message':_0x175d15[_0xe23f('0x19')]},client9002);return _0x580a96;}return null;})['then'](respondWithResult(_0x7de4ae,null))[_0xe23f('0x1b')](handleError(_0x7de4ae,null));};exports[_0xe23f('0x83')]=function(_0x1807c0,_0x102201){var _0x1069b7=moment()['unix']()[_0xe23f('0x84')]();var _0x4d95cd=path[_0xe23f('0x59')](config[_0xe23f('0x85')],'server','files','tmp');var _0x228640=path[_0xe23f('0x59')](config[_0xe23f('0x85')],_0xe23f('0x86'),_0xe23f('0x87'),'attachments');var _0x198a58=util[_0xe23f('0x5f')](_0xe23f('0x88'),_0x1069b7);return db[_0xe23f('0x2c')][_0xe23f('0x45')]({'where':{'id':_0x1807c0[_0xe23f('0x44')]['id']},'attributes':['id','body',_0xe23f('0x89'),'to','cc',_0xe23f('0x8a'),'subject',_0xe23f('0x8b')],'include':_0x1807c0[_0xe23f('0x30')][_0xe23f('0x58')]?[{'model':db[_0xe23f('0x8c')],'as':'Attachments'}]:undefined})[_0xe23f('0x10')](handleEntityNotFound(_0x102201,null))[_0xe23f('0x10')](function(_0x1f31c8){if(_0x1f31c8){var _0x35d58f=_0x1f31c8;var _0x34e277={'from':_0x35d58f[_0xe23f('0x89')],'to':_0x35d58f['to'],'subject':_0x35d58f[_0xe23f('0x8d')],'html':htmlEntities['decode'](_0x35d58f[_0xe23f('0x46')]),'headers':{'Date':moment(_0x35d58f[_0xe23f('0x8b')])[_0xe23f('0x5f')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1f31c8['cc']){_0x34e277[_0xe23f('0x8e')]['Cc']=_0x1f31c8['cc'];}if(_0x1f31c8[_0xe23f('0x8a')]){_0x34e277[_0xe23f('0x8e')][_0xe23f('0x8f')]=_0x1f31c8['bcc'];}return new BPromise(function(_0x8419c3,_0x14246b){if(_0x1f31c8[_0xe23f('0x90')]){for(var _0x35ced4=0x0;_0x35ced4<_0x1f31c8[_0xe23f('0x90')][_0xe23f('0x37')];_0x35ced4++){var _0x31729a=_0x1f31c8[_0xe23f('0x90')][_0x35ced4];var _0x3ffea8=path[_0xe23f('0x59')](_0x228640,_0x31729a[_0xe23f('0x91')]);if(fs[_0xe23f('0x92')](_0x3ffea8)){_0x34e277[_0xe23f('0x58')]['push']({'name':_0x31729a[_0xe23f('0x28')],'contentType':_0x31729a[_0xe23f('0x2e')],'data':fs[_0xe23f('0x93')](_0x3ffea8)});}}}emlformat[_0xe23f('0x94')](_0x34e277,function(_0x17c76e,_0x216e68){if(_0x17c76e)return _0x14246b(_0x17c76e);fs[_0xe23f('0x95')](path['join'](_0x4d95cd,_0x198a58),_0x216e68);return _0x8419c3(_0x216e68);});});}})[_0xe23f('0x10')](function(_0x315b8a){if(_0x315b8a){return _0x102201['download'](path[_0xe23f('0x59')](_0x4d95cd,_0x198a58),_0x198a58,function(_0x360af4){if(!_0x360af4)fs['unlinkSync'](path['join'](_0x4d95cd,_0x198a58));});}})[_0xe23f('0x1b')](handleError(_0x102201,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 249977c..a034b0d 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 _0xebcf=['hook','exports','../../mysqldb','MailMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x52d4a0,_0x52d4b5){var _0x493670=function(_0x30b448){while(--_0x30b448){_0x52d4a0['push'](_0x52d4a0['shift']());}};_0x493670(++_0x52d4b5);}(_0xebcf,0xa4));var _0xfebc=function(_0x234a42,_0x5a1b0c){_0x234a42=_0x234a42-0x0;var _0x4425da=_0xebcf[_0x234a42];return _0x4425da;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xfebc('0x0'))['db'][_0xfebc('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xfebc('0x2')](0x0);var events={'afterCreate':_0xfebc('0x3'),'afterUpdate':_0xfebc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x6623d2){return function(_0x4f2e3f,_0x2df975,_0xf66666){MailMessageEvents[_0xfebc('0x5')](_0x6623d2+':'+_0x4f2e3f['id'],_0x4f2e3f);MailMessageEvents[_0xfebc('0x5')](_0x6623d2,_0x4f2e3f);_0xf66666(null);};}for(var e in events){if(events[_0xfebc('0x6')](e)){var event=events[e];MailMessage[_0xfebc('0x7')](e,emitEvent(event));}}module[_0xfebc('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x491d=['hasOwnProperty','hook','exports','../../mysqldb','MailMessage','setMaxListeners','save','remove','emit'];(function(_0x58175c,_0x2d9373){var _0x55b88f=function(_0x13ed84){while(--_0x13ed84){_0x58175c['push'](_0x58175c['shift']());}};_0x55b88f(++_0x2d9373);}(_0x491d,0x13e));var _0xd491=function(_0x40645d,_0x3c2da9){_0x40645d=_0x40645d-0x0;var _0x5758c4=_0x491d[_0x40645d];return _0x5758c4;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xd491('0x0'))['db'][_0xd491('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xd491('0x2')](0x0);var events={'afterCreate':_0xd491('0x3'),'afterUpdate':'update','afterDestroy':_0xd491('0x4')};function emitEvent(_0xe948e1){return function(_0x189447,_0x331455,_0x261912){MailMessageEvents[_0xd491('0x5')](_0xe948e1+':'+_0x189447['id'],_0x189447);MailMessageEvents[_0xd491('0x5')](_0xe948e1,_0x189447);_0x261912(null);};}for(var e in events){if(events[_0xd491('0x6')](e)){var event=events[e];MailMessage[_0xd491('0x7')](e,emitEvent(event));}}module[_0xd491('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 a44f89d..fc040d4 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 _0x210d=['define','MailMessage','mail_messages','messageId','plainBody','FULLTEXT','fromString','models','get','toLowerCase','direction','secret','UserId','MailInteraction','then','update','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports'];(function(_0x231dda,_0x5b04cc){var _0x3f88cb=function(_0x16eb77){while(--_0x16eb77){_0x231dda['push'](_0x231dda['shift']());}};_0x3f88cb(++_0x5b04cc);}(_0x210d,0xbf));var _0xd210=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x210d[_0x3fba9f];return _0x192cf1;};'use strict';var _=require(_0xd210('0x0'));var util=require(_0xd210('0x1'));var logger=require(_0xd210('0x2'))('api');var moment=require(_0xd210('0x3'));var BPromise=require(_0xd210('0x4'));var rp=require(_0xd210('0x5'));var htmlToText=require(_0xd210('0x6'));var fs=require('fs');var path=require(_0xd210('0x7'));var rimraf=require(_0xd210('0x8'));var config=require(_0xd210('0x9'));var attributes=require(_0xd210('0xa'));module[_0xd210('0xb')]=function(_0x183c5f,_0x5e6dce){return _0x183c5f[_0xd210('0xc')](_0xd210('0xd'),attributes,{'tableName':_0xd210('0xe'),'paranoid':![],'indexes':[{'name':_0xd210('0xf'),'fields':['messageId']},{'name':'fti_mail_messages','fields':[_0xd210('0x10'),'subject'],'type':_0xd210('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x6bfabe,_0x26af25,_0x3afe2c){if(_0x6bfabe['body']){_0x6bfabe[_0xd210('0x10')]=htmlToText[_0xd210('0x12')](_0x6bfabe['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3afe2c(null,_0x26af25);},'afterCreate':function(_0x39a572,_0x416467,_0x54738b){var _0x3c4f0e=_0x183c5f[_0xd210('0x13')];var _0x4bda30=_0x39a572[_0xd210('0x14')]({'plain':!![]});if(_0x4bda30['direction'][_0xd210('0x15')]()==='in'||_0x4bda30[_0xd210('0x16')]['toLowerCase']()==='out'&&!_0x4bda30[_0xd210('0x17')]&&!_['isNil'](_0x4bda30[_0xd210('0x18')])){_0x3c4f0e[_0xd210('0x19')]['findOne']({'where':{'id':_0x4bda30['MailInteractionId']}})[_0xd210('0x1a')](function(_0x3ca786){if(_0x3ca786){_0x3ca786[_0xd210('0x1b')]({'lastMsgAt':_0x4bda30['createdAt'],'lastMsgDirection':_0x4bda30[_0xd210('0x16')]['toLowerCase']()});}})['catch'](function(_0x47b6a5){console['error'](_0x47b6a5);});}_0x54738b();}},'charset':'utf8mb4','collate':_0xd210('0x1c')});}; \ No newline at end of file +var _0x67d1=['findOne','update','createdAt','catch','utf8mb4','lodash','util','../../config/logger','api','bluebird','html-to-text','rimraf','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','MailInteraction'];(function(_0x1d92e7,_0x1d599a){var _0x6434c4=function(_0x486dda){while(--_0x486dda){_0x1d92e7['push'](_0x1d92e7['shift']());}};_0x6434c4(++_0x1d599a);}(_0x67d1,0x9b));var _0x167d=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x67d1[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0x167d('0x0'));var util=require(_0x167d('0x1'));var logger=require(_0x167d('0x2'))(_0x167d('0x3'));var moment=require('moment');var BPromise=require(_0x167d('0x4'));var rp=require('request-promise');var htmlToText=require(_0x167d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x167d('0x6'));var config=require('../../config/environment');var attributes=require(_0x167d('0x7'));module[_0x167d('0x8')]=function(_0x1981d3,_0x146fd5){return _0x1981d3[_0x167d('0x9')](_0x167d('0xa'),attributes,{'tableName':_0x167d('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x167d('0xc')]},{'name':_0x167d('0xd'),'fields':[_0x167d('0xe'),'subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3f0372,_0x1d8fb4,_0x8d4aa){if(_0x3f0372[_0x167d('0xf')]){_0x3f0372['plainBody']=htmlToText[_0x167d('0x10')](_0x3f0372[_0x167d('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x8d4aa(null,_0x1d8fb4);},'afterCreate':function(_0x5d7ab2,_0x328662,_0x2b8636){var _0x9ab7bb=_0x1981d3[_0x167d('0x11')];var _0x5ca351=_0x5d7ab2[_0x167d('0x12')]({'plain':!![]});if(_0x5ca351[_0x167d('0x13')][_0x167d('0x14')]()==='in'||_0x5ca351['direction'][_0x167d('0x14')]()===_0x167d('0x15')&&!_0x5ca351[_0x167d('0x16')]&&!_[_0x167d('0x17')](_0x5ca351['UserId'])){_0x9ab7bb[_0x167d('0x18')][_0x167d('0x19')]({'where':{'id':_0x5ca351['MailInteractionId']}})['then'](function(_0x413ff9){if(_0x413ff9){_0x413ff9[_0x167d('0x1a')]({'lastMsgAt':_0x5ca351[_0x167d('0x1b')],'lastMsgDirection':_0x5ca351[_0x167d('0x13')][_0x167d('0x14')]()});}})[_0x167d('0x1c')](function(_0x2e21f9){console['error'](_0x2e21f9);});}_0x2b8636();}},'charset':_0x167d('0x1d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 4411e37..42c437e 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 _0x4cf8=['./mailMessage.socket','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateMailMessage','MailMessage','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost'];(function(_0x589c88,_0x4d0369){var _0x3f7fb2=function(_0x45f9ad){while(--_0x45f9ad){_0x589c88['push'](_0x589c88['shift']());}};_0x3f7fb2(++_0x4d0369);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x5ad67c,_0x144860){_0x5ad67c=_0x5ad67c-0x0;var _0xccce2e=_0x4cf8[_0x5ad67c];return _0xccce2e;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var moment=require(_0x84cf('0x2'));var BPromise=require(_0x84cf('0x3'));var rs=require(_0x84cf('0x4'));var fs=require('fs');var Redis=require(_0x84cf('0x5'));var db=require(_0x84cf('0x6'))['db'];var utils=require(_0x84cf('0x7'));var logger=require(_0x84cf('0x8'))(_0x84cf('0x9'));var config=require(_0x84cf('0xa'));var jayson=require(_0x84cf('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0x84cf('0xc')]=_['defaults'](config[_0x84cf('0xc')],{'host':_0x84cf('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x84cf('0xc')]));require(_0x84cf('0xe'))['register'](socket);function respondWithRpcPromise(_0xfb5398,_0x1b223d,_0x390ce9){return new BPromise(function(_0x369ce6,_0x50d667){return client[_0x84cf('0xf')](_0xfb5398,_0x390ce9)[_0x84cf('0x10')](function(_0x4db0a7){logger['info'](_0x84cf('0x11'),_0x1b223d,_0x84cf('0x12'));logger[_0x84cf('0x13')](_0x84cf('0x14'),_0x1b223d,_0x84cf('0x12'),JSON[_0x84cf('0x15')](_0x4db0a7));if(_0x4db0a7[_0x84cf('0x16')]){if(_0x4db0a7[_0x84cf('0x16')][_0x84cf('0x17')]===0x1f4){logger[_0x84cf('0x16')](_0x84cf('0x11'),_0x1b223d,_0x4db0a7[_0x84cf('0x16')][_0x84cf('0x18')]);return _0x50d667(_0x4db0a7[_0x84cf('0x16')][_0x84cf('0x18')]);}logger[_0x84cf('0x16')](_0x84cf('0x11'),_0x1b223d,_0x4db0a7[_0x84cf('0x16')][_0x84cf('0x18')]);return _0x369ce6(_0x4db0a7['error'][_0x84cf('0x18')]);}else{logger[_0x84cf('0x19')](_0x84cf('0x11'),_0x1b223d,_0x84cf('0x12'));_0x369ce6(_0x4db0a7[_0x84cf('0x1a')][_0x84cf('0x18')]);}})[_0x84cf('0x1b')](function(_0x5d5650){logger['error'](_0x84cf('0x11'),_0x1b223d,_0x5d5650);_0x50d667(_0x5d5650);});});}exports[_0x84cf('0x1c')]=function(_0x346b43){var _0x3e65e3=this;return new Promise(function(_0x219afa,_0x5dda3f){return db[_0x84cf('0x1d')][_0x84cf('0x1e')](_0x346b43[_0x84cf('0x1f')],{'raw':_0x346b43[_0x84cf('0x20')]?_0x346b43[_0x84cf('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x84cf('0x10')](function(_0x160f86){logger[_0x84cf('0x19')](_0x84cf('0x1c'),_0x346b43);logger[_0x84cf('0x13')](_0x84cf('0x1c'),_0x346b43,JSON[_0x84cf('0x15')](_0x160f86));_0x219afa(_0x160f86);})['catch'](function(_0x2b2c90){logger[_0x84cf('0x16')](_0x84cf('0x1c'),_0x2b2c90[_0x84cf('0x18')],_0x346b43);_0x5dda3f(_0x3e65e3[_0x84cf('0x16')](0x1f4,_0x2b2c90[_0x84cf('0x18')]));});});}; \ No newline at end of file +var _0xbaf0=['request','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','MailMessage','create','body','options','raw','CreateMailMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register'];(function(_0x585a0b,_0x2d2876){var _0xee649=function(_0xcae5bc){while(--_0xcae5bc){_0x585a0b['push'](_0x585a0b['shift']());}};_0xee649(++_0x2d2876);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});config[_0x0baf('0xc')]=_[_0x0baf('0xd')](config[_0x0baf('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0baf('0xe'))(new Redis(config['redis']));require(_0x0baf('0xf'))[_0x0baf('0x10')](socket);function respondWithRpcPromise(_0x465528,_0x2f46e8,_0x7f54d4){return new BPromise(function(_0xf4c8ac,_0x41cead){return client[_0x0baf('0x11')](_0x465528,_0x7f54d4)[_0x0baf('0x12')](function(_0x1d60a2){logger[_0x0baf('0x13')]('MailMessage,\x20%s,\x20%s',_0x2f46e8,'request\x20sent');logger[_0x0baf('0x14')](_0x0baf('0x15'),_0x2f46e8,_0x0baf('0x16'),JSON[_0x0baf('0x17')](_0x1d60a2));if(_0x1d60a2['error']){if(_0x1d60a2[_0x0baf('0x18')]['code']===0x1f4){logger[_0x0baf('0x18')](_0x0baf('0x19'),_0x2f46e8,_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);return _0x41cead(_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x2f46e8,_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);return _0xf4c8ac(_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);}else{logger[_0x0baf('0x13')](_0x0baf('0x19'),_0x2f46e8,'request\x20sent');_0xf4c8ac(_0x1d60a2[_0x0baf('0x1b')][_0x0baf('0x1a')]);}})[_0x0baf('0x1c')](function(_0x3e9cb4){logger[_0x0baf('0x18')](_0x0baf('0x19'),_0x2f46e8,_0x3e9cb4);_0x41cead(_0x3e9cb4);});});}exports['CreateMailMessage']=function(_0x5cff5d){var _0x1410ec=this;return new Promise(function(_0x154f48,_0x32e839){return db[_0x0baf('0x1d')][_0x0baf('0x1e')](_0x5cff5d[_0x0baf('0x1f')],{'raw':_0x5cff5d[_0x0baf('0x20')]?_0x5cff5d[_0x0baf('0x20')][_0x0baf('0x21')]===undefined?!![]:![]:!![]})[_0x0baf('0x12')](function(_0x54f2fa){logger[_0x0baf('0x13')]('CreateMailMessage',_0x5cff5d);logger[_0x0baf('0x14')]('CreateMailMessage',_0x5cff5d,JSON['stringify'](_0x54f2fa));_0x154f48(_0x54f2fa);})[_0x0baf('0x1c')](function(_0x48a0e9){logger['error'](_0x0baf('0x22'),_0x48a0e9[_0x0baf('0x1a')],_0x5cff5d);_0x32e839(_0x1410ec[_0x0baf('0x18')](0x1f4,_0x48a0e9[_0x0baf('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 53524f8..8b5727f 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 _0xc8f3=['removeListener','register','mailMessage:','./mailMessage.events','save','remove','update','emit'];(function(_0x3f6117,_0x3e2eff){var _0x41a3be=function(_0x2784d8){while(--_0x2784d8){_0x3f6117['push'](_0x3f6117['shift']());}};_0x41a3be(++_0x3e2eff);}(_0xc8f3,0x1d3));var _0x3c8f=function(_0x180e4a,_0x3a0c1c){_0x180e4a=_0x180e4a-0x0;var _0xd53fed=_0xc8f3[_0x180e4a];return _0xd53fed;};'use strict';var MailMessageEvents=require(_0x3c8f('0x0'));var events=[_0x3c8f('0x1'),_0x3c8f('0x2'),_0x3c8f('0x3')];function createListener(_0x2d46c2,_0xd5e40){return function(_0x52e9d5){_0xd5e40[_0x3c8f('0x4')](_0x2d46c2,_0x52e9d5);};}function removeListener(_0x58ead0,_0x4b2dfe){return function(){MailMessageEvents[_0x3c8f('0x5')](_0x58ead0,_0x4b2dfe);};}exports[_0x3c8f('0x6')]=function(_0x2f220e){for(var _0x26559d=0x0,_0x1373d1=events['length'];_0x26559d<_0x1373d1;_0x26559d++){var _0x416355=events[_0x26559d];var _0x3039cc=createListener(_0x3c8f('0x7')+_0x416355,_0x2f220e);MailMessageEvents['on'](_0x416355,_0x3039cc);}}; \ No newline at end of file +var _0xba85=['./mailMessage.events','save','remove','update','removeListener','register','length','mailMessage:'];(function(_0x127783,_0x258715){var _0x14f298=function(_0x32090e){while(--_0x32090e){_0x127783['push'](_0x127783['shift']());}};_0x14f298(++_0x258715);}(_0xba85,0x78));var _0x5ba8=function(_0x4a03a9,_0x4521d7){_0x4a03a9=_0x4a03a9-0x0;var _0x584caf=_0xba85[_0x4a03a9];return _0x584caf;};'use strict';var MailMessageEvents=require(_0x5ba8('0x0'));var events=[_0x5ba8('0x1'),_0x5ba8('0x2'),_0x5ba8('0x3')];function createListener(_0x575742,_0x38b52a){return function(_0x1ed918){_0x38b52a['emit'](_0x575742,_0x1ed918);};}function removeListener(_0xc802b7,_0x28f4b7){return function(){MailMessageEvents[_0x5ba8('0x4')](_0xc802b7,_0x28f4b7);};}exports[_0x5ba8('0x5')]=function(_0x4ace2d){for(var _0x2fa1dd=0x0,_0x3a60c2=events[_0x5ba8('0x6')];_0x2fa1dd<_0x3a60c2;_0x2fa1dd++){var _0x429925=events[_0x2fa1dd];var _0x1eddbd=createListener(_0x5ba8('0x7')+_0x429925,_0x4ace2d);MailMessageEvents['on'](_0x429925,_0x1eddbd);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 00857a3..2601894 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 _0xd239=['get','index','/describe','describe','/:id','isAuthenticated','show','getMembers','/:id/teams','getTeams','getAgents','post','addAgents','put','update','delete','/:id/users','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller'];(function(_0x4e3d17,_0x1ba0c){var _0x4c275e=function(_0x57e1a9){while(--_0x57e1a9){_0x4e3d17['push'](_0x4e3d17['shift']());}};_0x4c275e(++_0x1ba0c);}(_0xd239,0x69));var _0x9d23=function(_0x2d2c6c,_0x4aa7c2){_0x2d2c6c=_0x2d2c6c-0x0;var _0x4f1e2e=_0xd239[_0x2d2c6c];return _0x4f1e2e;};'use strict';var multer=require(_0x9d23('0x0'));var util=require(_0x9d23('0x1'));var path=require(_0x9d23('0x2'));var timeout=require(_0x9d23('0x3'));var express=require(_0x9d23('0x4'));var router=express[_0x9d23('0x5')]();var fs_extra=require(_0x9d23('0x6'));var auth=require(_0x9d23('0x7'));var interaction=require(_0x9d23('0x8'));var config=require(_0x9d23('0x9'));var controller=require(_0x9d23('0xa'));router[_0x9d23('0xb')]('/',auth['isAuthenticated'](),controller[_0x9d23('0xc')]);router[_0x9d23('0xb')](_0x9d23('0xd'),auth['isAuthenticated'](),controller[_0x9d23('0xe')]);router['get'](_0x9d23('0xf'),auth[_0x9d23('0x10')](),controller[_0x9d23('0x11')]);router[_0x9d23('0xb')]('/:id/members',auth[_0x9d23('0x10')](),controller[_0x9d23('0x12')]);router[_0x9d23('0xb')](_0x9d23('0x13'),auth[_0x9d23('0x10')](),controller[_0x9d23('0x14')]);router[_0x9d23('0xb')]('/:id/users',auth[_0x9d23('0x10')](),controller[_0x9d23('0x15')]);router[_0x9d23('0x16')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x9d23('0x13'),auth['isAuthenticated'](),controller['addTeams']);router[_0x9d23('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0x9d23('0x17')]);router[_0x9d23('0x18')](_0x9d23('0xf'),auth[_0x9d23('0x10')](),controller[_0x9d23('0x19')]);router[_0x9d23('0x1a')](_0x9d23('0xf'),auth[_0x9d23('0x10')](),controller['destroy']);router['delete'](_0x9d23('0x13'),auth[_0x9d23('0x10')](),controller['removeTeams']);router['delete'](_0x9d23('0x1b'),auth[_0x9d23('0x10')](),controller[_0x9d23('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xa667=['index','/describe','/:id/members','getMembers','/:id/teams','/:id/users','post','addTeams','addAgents','put','/:id','destroy','delete','removeTeams','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated'];(function(_0x3ab968,_0x1036ed){var _0x4fce5a=function(_0x32ff5d){while(--_0x32ff5d){_0x3ab968['push'](_0x3ab968['shift']());}};_0x4fce5a(++_0x1036ed);}(_0xa667,0x16e));var _0x7a66=function(_0x5ddb37,_0x2eb2ce){_0x5ddb37=_0x5ddb37-0x0;var _0x283429=_0xa667[_0x5ddb37];return _0x283429;};'use strict';var multer=require('multer');var util=require(_0x7a66('0x0'));var path=require(_0x7a66('0x1'));var timeout=require(_0x7a66('0x2'));var express=require(_0x7a66('0x3'));var router=express[_0x7a66('0x4')]();var fs_extra=require(_0x7a66('0x5'));var auth=require(_0x7a66('0x6'));var interaction=require(_0x7a66('0x7'));var config=require(_0x7a66('0x8'));var controller=require(_0x7a66('0x9'));router[_0x7a66('0xa')]('/',auth[_0x7a66('0xb')](),controller[_0x7a66('0xc')]);router[_0x7a66('0xa')](_0x7a66('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x7a66('0xa')]('/:id',auth[_0x7a66('0xb')](),controller['show']);router[_0x7a66('0xa')](_0x7a66('0xe'),auth[_0x7a66('0xb')](),controller[_0x7a66('0xf')]);router[_0x7a66('0xa')](_0x7a66('0x10'),auth[_0x7a66('0xb')](),controller['getTeams']);router['get'](_0x7a66('0x11'),auth[_0x7a66('0xb')](),controller['getAgents']);router[_0x7a66('0x12')]('/',auth[_0x7a66('0xb')](),controller['create']);router[_0x7a66('0x12')](_0x7a66('0x10'),auth[_0x7a66('0xb')](),controller[_0x7a66('0x13')]);router[_0x7a66('0x12')]('/:id/users',auth[_0x7a66('0xb')](),controller[_0x7a66('0x14')]);router[_0x7a66('0x15')](_0x7a66('0x16'),auth[_0x7a66('0xb')](),controller['update']);router['delete'](_0x7a66('0x16'),auth[_0x7a66('0xb')](),controller[_0x7a66('0x17')]);router[_0x7a66('0x18')](_0x7a66('0x10'),auth[_0x7a66('0xb')](),controller[_0x7a66('0x19')]);router[_0x7a66('0x18')](_0x7a66('0x11'),auth[_0x7a66('0xb')](),controller[_0x7a66('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index e67f658..5290aee 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 _0xf555=['INTEGER','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x30e1f5,_0x3de54f){var _0x3b5419=function(_0x27c7bd){while(--_0x27c7bd){_0x30e1f5['push'](_0x30e1f5['shift']());}};_0x3b5419(++_0x3de54f);}(_0xf555,0xb2));var _0x5f55=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf555[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5f55('0x0'));module['exports']={'name':{'type':Sequelize[_0x5f55('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5f55('0x1')]},'timeout':{'type':Sequelize[_0x5f55('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x5f55('0x3'),_0x5f55('0x4'),_0x5f55('0x5'))}}; \ No newline at end of file +var _0x8e17=['rrmemory','beepall','roundrobin','STRING','INTEGER','ENUM'];(function(_0x364770,_0x375392){var _0x14e9d1=function(_0x32a8e4){while(--_0x32a8e4){_0x364770['push'](_0x364770['shift']());}};_0x14e9d1(++_0x375392);}(_0x8e17,0x16b));var _0x78e1=function(_0x14e84d,_0x5a3010){_0x14e84d=_0x14e84d-0x0;var _0x3ca8a9=_0x8e17[_0x14e84d];return _0x3ca8a9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x78e1('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x78e1('0x0')]},'timeout':{'type':Sequelize[_0x78e1('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x78e1('0x2')](_0x78e1('0x3'),_0x78e1('0x4'),_0x78e1('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index d73d484..bd3668b 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 _0x766b=['where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','user','get','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserMailQueue','findAll','User','findAndCountAll','UserId','agent','updatedAt','SIP','mailPause','createdAt','getTeams','Team','addTeams','voicePause','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userMailQueue:remove','addAgents','isArray','getAgents','eml-format','rimraf','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','count','offset','limit','Content-Range','reject','then','destroy','MailQueues','UserProfileResource','end','sendStatus','stack','name','send','index','MailQueue','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x300d5d,_0x5f5213){var _0x3f7bf0=function(_0x1a2686){while(--_0x1a2686){_0x300d5d['push'](_0x300d5d['shift']());}};_0x3f7bf0(++_0x5f5213);}(_0x766b,0x158));var _0xb766=function(_0x379cec,_0x89cf39){_0x379cec=_0x379cec-0x0;var _0x25eab7=_0x766b[_0x379cec];return _0x25eab7;};'use strict';var emlformat=require(_0xb766('0x0'));var rimraf=require(_0xb766('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb766('0x2'));var BPromise=require(_0xb766('0x3'));var Mustache=require(_0xb766('0x4'));var util=require('util');var path=require(_0xb766('0x5'));var sox=require(_0xb766('0x6'));var csv=require('to-csv');var ejs=require(_0xb766('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb766('0x8'));var squel=require(_0xb766('0x9'));var crypto=require(_0xb766('0xa'));var jsforce=require(_0xb766('0xb'));var deskjs=require(_0xb766('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb766('0xd'));var Papa=require(_0xb766('0xe'));var Redis=require(_0xb766('0xf'));var authService=require(_0xb766('0x10'));var qs=require(_0xb766('0x11'));var as=require(_0xb766('0x12'));var hardwareService=require(_0xb766('0x13'));var logger=require(_0xb766('0x14'))('api');var utils=require(_0xb766('0x15'));var config=require(_0xb766('0x16'));var licenseUtil=require(_0xb766('0x17'));var db=require(_0xb766('0x18'))['db'];config[_0xb766('0x19')]=_[_0xb766('0x1a')](config[_0xb766('0x19')],{'host':_0xb766('0x1b'),'port':0x18eb});var socket=require(_0xb766('0x1c'))(new Redis(config['redis']));require(_0xb766('0x1d'))[_0xb766('0x1e')](socket);function respondWithStatusCode(_0x494503,_0x11f36c){_0x11f36c=_0x11f36c||0xcc;return function(_0x20ab1c){if(_0x20ab1c){return _0x494503['sendStatus'](_0x11f36c);}return _0x494503[_0xb766('0x1f')](_0x11f36c)['end']();};}function respondWithResult(_0x3e11ed,_0x27aef1){_0x27aef1=_0x27aef1||0xc8;return function(_0x36ec92){if(_0x36ec92){return _0x3e11ed[_0xb766('0x1f')](_0x27aef1)['json'](_0x36ec92);}};}function respondWithFilteredResult(_0x74721a,_0x498a31){return function(_0x470e86){if(_0x470e86){var _0x3db2ad=typeof _0x498a31['offset']==='undefined'&&typeof _0x498a31['limit']==='undefined';var _0x5daae2=_0x470e86['count'];var _0x557b25=_0x3db2ad?0x0:_0x498a31['offset'];var _0x116ab4=_0x3db2ad?_0x470e86[_0xb766('0x20')]:_0x498a31[_0xb766('0x21')]+_0x498a31[_0xb766('0x22')];var _0x1ac921;if(_0x116ab4>=_0x5daae2){_0x116ab4=_0x5daae2;_0x1ac921=0xc8;}else{_0x1ac921=0xce;}_0x74721a[_0xb766('0x1f')](_0x1ac921);return _0x74721a['set'](_0xb766('0x23'),_0x557b25+'-'+_0x116ab4+'/'+_0x5daae2)['json'](_0x470e86);}return null;};}function patchUpdates(_0x11a06c){return function(_0x3a2f89){try{jsonpatch['apply'](_0x3a2f89,_0x11a06c,!![]);}catch(_0x5891a6){return BPromise[_0xb766('0x24')](_0x5891a6);}return _0x3a2f89['save']();};}function saveUpdates(_0x3dc3ac,_0x2e4565){return function(_0x2986b8){if(_0x2986b8){return _0x2986b8['update'](_0x3dc3ac)[_0xb766('0x25')](function(_0x495a46){return _0x495a46;});}return null;};}function removeEntity(_0x27073d,_0x4435c2){return function(_0xf205b3){if(_0xf205b3){return _0xf205b3[_0xb766('0x26')]()[_0xb766('0x25')](function(){var _0x697f73=_0xf205b3['get']({'plain':!![]});var _0x34a133=_0xb766('0x27');return db[_0xb766('0x28')]['destroy']({'where':{'type':_0x34a133,'resourceId':_0x697f73['id']}})['then'](function(){return _0xf205b3;});})[_0xb766('0x25')](function(){_0x27073d[_0xb766('0x1f')](0xcc)[_0xb766('0x29')]();});}};}function handleEntityNotFound(_0x3fe6b4,_0x219f40){return function(_0x83e02){if(!_0x83e02){_0x3fe6b4[_0xb766('0x2a')](0x194);}return _0x83e02;};}function handleError(_0x5c515a,_0x5e8d1d){_0x5e8d1d=_0x5e8d1d||0x1f4;return function(_0x36adb3){logger['error'](_0x36adb3[_0xb766('0x2b')]);if(_0x36adb3[_0xb766('0x2c')]){delete _0x36adb3[_0xb766('0x2c')];}_0x5c515a[_0xb766('0x1f')](_0x5e8d1d)[_0xb766('0x2d')](_0x36adb3);};}exports[_0xb766('0x2e')]=function(_0xa53c57,_0x15abaa){var _0x391b5f={},_0x1d578c={},_0x2b81e8={'count':0x0,'rows':[]};var _0x1ddef5=_['map'](db[_0xb766('0x2f')][_0xb766('0x30')],function(_0x33ffa8){return{'name':_0x33ffa8['fieldName'],'type':_0x33ffa8[_0xb766('0x31')][_0xb766('0x32')]};});_0x1d578c[_0xb766('0x33')]=_[_0xb766('0x34')](_0x1ddef5,_0xb766('0x2c'));_0x1d578c[_0xb766('0x35')]=_[_0xb766('0x36')](_0xa53c57[_0xb766('0x35')]);_0x1d578c[_0xb766('0x37')]=_[_0xb766('0x38')](_0x1d578c[_0xb766('0x33')],_0x1d578c[_0xb766('0x35')]);_0x391b5f[_0xb766('0x39')]=_[_0xb766('0x38')](_0x1d578c['model'],qs[_0xb766('0x3a')](_0xa53c57[_0xb766('0x35')][_0xb766('0x3a')]));_0x391b5f[_0xb766('0x39')]=_0x391b5f['attributes'][_0xb766('0x3b')]?_0x391b5f[_0xb766('0x39')]:_0x1d578c[_0xb766('0x33')];if(!_0xa53c57[_0xb766('0x35')][_0xb766('0x3c')](_0xb766('0x3d'))){_0x391b5f[_0xb766('0x22')]=qs['limit'](_0xa53c57[_0xb766('0x35')][_0xb766('0x22')]);_0x391b5f[_0xb766('0x21')]=qs['offset'](_0xa53c57[_0xb766('0x35')]['offset']);}_0x391b5f[_0xb766('0x3e')]=qs['sort'](_0xa53c57['query'][_0xb766('0x3f')]);_0x391b5f[_0xb766('0x40')]=qs[_0xb766('0x37')](_[_0xb766('0x41')](_0xa53c57[_0xb766('0x35')],_0x1d578c[_0xb766('0x37')]),_0x1ddef5);if(_0xa53c57[_0xb766('0x35')][_0xb766('0x42')]){_0x391b5f[_0xb766('0x40')]=_[_0xb766('0x43')](_0x391b5f['where'],{'$or':_[_0xb766('0x34')](_0x1ddef5,function(_0x2ee3df){if(_0x2ee3df[_0xb766('0x31')]!==_0xb766('0x44')){var _0x38e7c0={};_0x38e7c0[_0x2ee3df[_0xb766('0x2c')]]={'$like':'%'+_0xa53c57[_0xb766('0x35')][_0xb766('0x42')]+'%'};return _0x38e7c0;}})});}_0x391b5f=_[_0xb766('0x43')]({},_0x391b5f,_0xa53c57['options']);var _0x468f0d={'where':_0x391b5f[_0xb766('0x40')]};return db[_0xb766('0x2f')]['count'](_0x468f0d)[_0xb766('0x25')](function(_0x573d21){_0x2b81e8[_0xb766('0x20')]=_0x573d21;if(_0xa53c57[_0xb766('0x35')][_0xb766('0x45')]){_0x391b5f[_0xb766('0x46')]=[{'all':!![]}];}return db[_0xb766('0x2f')]['findAll'](_0x391b5f);})[_0xb766('0x25')](function(_0x417382){_0x2b81e8[_0xb766('0x47')]=_0x417382;return _0x2b81e8;})[_0xb766('0x25')](respondWithFilteredResult(_0x15abaa,_0x391b5f))[_0xb766('0x48')](handleError(_0x15abaa,null));};exports[_0xb766('0x49')]=function(_0xefbb6d,_0x158b4c){var _0x2865ab={'raw':!![],'where':{'id':_0xefbb6d[_0xb766('0x4a')]['id']}},_0x29f76a={};_0x29f76a[_0xb766('0x33')]=_[_0xb766('0x36')](db[_0xb766('0x2f')][_0xb766('0x30')]);_0x29f76a[_0xb766('0x35')]=_[_0xb766('0x36')](_0xefbb6d[_0xb766('0x35')]);_0x29f76a[_0xb766('0x37')]=_['intersection'](_0x29f76a['model'],_0x29f76a[_0xb766('0x35')]);_0x2865ab['attributes']=_[_0xb766('0x38')](_0x29f76a['model'],qs[_0xb766('0x3a')](_0xefbb6d[_0xb766('0x35')][_0xb766('0x3a')]));_0x2865ab[_0xb766('0x39')]=_0x2865ab['attributes'][_0xb766('0x3b')]?_0x2865ab[_0xb766('0x39')]:_0x29f76a['model'];if(_0xefbb6d['query']['includeAll']){_0x2865ab[_0xb766('0x46')]=[{'all':!![]}];}_0x2865ab=_['merge']({},_0x2865ab,_0xefbb6d[_0xb766('0x4b')]);return db[_0xb766('0x2f')][_0xb766('0x4c')](_0x2865ab)[_0xb766('0x25')](handleEntityNotFound(_0x158b4c,null))['then'](respondWithResult(_0x158b4c,null))[_0xb766('0x48')](handleError(_0x158b4c,null));};exports[_0xb766('0x4d')]=function(_0x3d96c4,_0x294414){return db[_0xb766('0x2f')]['create'](_0x3d96c4[_0xb766('0x4e')],{})[_0xb766('0x25')](function(_0x366759){var _0x36d276=_0x3d96c4[_0xb766('0x4f')][_0xb766('0x50')]({'plain':!![]});if(!_0x36d276)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36d276['role']===_0xb766('0x4f')){var _0xf03d55=_0x366759[_0xb766('0x50')]({'plain':!![]});var _0x571978=_0xb766('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x571978,'userProfileId':_0x36d276[_0xb766('0x51')]},'raw':!![]})[_0xb766('0x25')](function(_0x15d7bc){if(_0x15d7bc&&_0x15d7bc[_0xb766('0x52')]===0x0){return db[_0xb766('0x28')][_0xb766('0x4d')]({'name':_0xf03d55[_0xb766('0x2c')],'resourceId':_0xf03d55['id'],'type':_0x15d7bc['name'],'sectionId':_0x15d7bc['id']},{})[_0xb766('0x25')](function(){return _0x366759;});}else{return _0x366759;}})[_0xb766('0x48')](function(_0x40546c){logger[_0xb766('0x53')](_0xb766('0x54'),_0x40546c);throw _0x40546c;});}return _0x366759;})[_0xb766('0x25')](respondWithResult(_0x294414,0xc9))[_0xb766('0x48')](handleError(_0x294414,null));};exports[_0xb766('0x55')]=function(_0x20753c,_0x37e8f1){if(_0x20753c[_0xb766('0x4e')]['id']){delete _0x20753c[_0xb766('0x4e')]['id'];}return db['MailQueue'][_0xb766('0x4c')]({'where':{'id':_0x20753c[_0xb766('0x4a')]['id']}})[_0xb766('0x25')](handleEntityNotFound(_0x37e8f1,null))['then'](saveUpdates(_0x20753c['body'],null))['then'](respondWithResult(_0x37e8f1,null))['catch'](handleError(_0x37e8f1,null));};exports['destroy']=function(_0x3b2ec6,_0x53b32b){return db[_0xb766('0x2f')][_0xb766('0x4c')]({'where':{'id':_0x3b2ec6[_0xb766('0x4a')]['id']}})['then'](handleEntityNotFound(_0x53b32b,null))[_0xb766('0x25')](removeEntity(_0x53b32b,null))['catch'](handleError(_0x53b32b,null));};exports[_0xb766('0x56')]=function(_0x1cd4f0,_0xa13aa6){return db[_0xb766('0x2f')][_0xb766('0x56')]()['then'](respondWithResult(_0xa13aa6,null))[_0xb766('0x48')](handleError(_0xa13aa6,null));};exports[_0xb766('0x57')]=function(_0x3670a3,_0x34b9be,_0x4b7df9){var _0x4a5da8={'raw':!![],'where':{}},_0xacc735={},_0x28fcba;return db[_0xb766('0x2f')][_0xb766('0x58')]({'where':{'id':_0x3670a3['params']['id']}})['then'](handleEntityNotFound(_0x34b9be,null))['then'](function(_0x59e001){if(_0x59e001){_0x28fcba=_0x59e001[_0xb766('0x50')]({'plain':!![]});_0xacc735['model']=_[_0xb766('0x36')](db[_0xb766('0x59')][_0xb766('0x30')]);_0xacc735[_0xb766('0x35')]=_[_0xb766('0x36')](_0x3670a3['query']);_0xacc735[_0xb766('0x37')]=_['intersection'](_0xacc735[_0xb766('0x33')],_0xacc735[_0xb766('0x35')]);_0x4a5da8[_0xb766('0x39')]=_[_0xb766('0x38')](_0xacc735['model'],qs[_0xb766('0x3a')](_0x3670a3[_0xb766('0x35')][_0xb766('0x3a')]));_0x4a5da8['attributes']=_0x4a5da8['attributes']['length']?_0x4a5da8[_0xb766('0x39')]:_0xacc735['model'];if(!_0x3670a3[_0xb766('0x35')]['hasOwnProperty'](_0xb766('0x3d'))){_0x4a5da8[_0xb766('0x22')]=qs[_0xb766('0x22')](_0x3670a3['query']['limit']);_0x4a5da8['offset']=qs['offset'](_0x3670a3[_0xb766('0x35')]['offset']);}_0x4a5da8[_0xb766('0x3e')]=qs[_0xb766('0x3f')](_0x3670a3['query'][_0xb766('0x3f')]);_0x4a5da8[_0xb766('0x40')]=qs['filters'](_['pick'](_0x3670a3['query'],_0xacc735[_0xb766('0x37')]));_0x4a5da8['where']['MailQueueId']=_0x59e001['id'];if(_0x3670a3[_0xb766('0x35')][_0xb766('0x42')]){_0x4a5da8[_0xb766('0x40')]=_[_0xb766('0x43')](_0x4a5da8[_0xb766('0x40')],{'$or':_[_0xb766('0x34')](_0x4a5da8[_0xb766('0x39')],function(_0xf8b220){var _0x3c7e08={};_0x3c7e08[_0xf8b220]={'$like':'%'+_0x3670a3[_0xb766('0x35')]['filter']+'%'};return _0x3c7e08;})});}_0x4a5da8=_[_0xb766('0x43')]({},_0x4a5da8,_0x3670a3[_0xb766('0x4b')]);return db[_0xb766('0x59')][_0xb766('0x5a')](_0x4a5da8);}})[_0xb766('0x25')](function(_0x1ea04c){if(_0x1ea04c){return db[_0xb766('0x5b')][_0xb766('0x5c')]({'where':{'id':_['map'](_0x1ea04c,_0xb766('0x5d')),'role':_0xb766('0x5e')},'attributes':['id',_0xb766('0x2c'),'mailPause',_0xb766('0x5f'),'createdAt']});}})[_0xb766('0x25')](function(_0x4bfdee){if(_0x4bfdee){return{'count':_0x4bfdee[_0xb766('0x20')],'rows':_[_0xb766('0x34')](_0x4bfdee['rows'],function(_0x3cc9da){return{'membername':_0x3cc9da[_0xb766('0x2c')],'UserId':_0x3cc9da['id'],'queue_name':_0x28fcba[_0xb766('0x2c')],'MailQueueId':_0x28fcba['id'],'interface':util['format']('%s/%s',_0xb766('0x60'),_0x3cc9da[_0xb766('0x2c')]),'penalty':0x0,'paused':_0x3cc9da[_0xb766('0x61')],'createdAt':_0x3cc9da[_0xb766('0x62')],'updatedAt':_0x3cc9da[_0xb766('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb766('0x25')](respondWithFilteredResult(_0x34b9be,_0x4a5da8))['catch'](handleError(_0x34b9be,null));};exports[_0xb766('0x63')]=function(_0x5457d2,_0x1bc108,_0x5a1e6b){var _0x1a4cf9={};var _0x29adc4={};var _0x33d430;var _0x2e541c;return db[_0xb766('0x2f')][_0xb766('0x58')]({'where':{'id':_0x5457d2['params']['id']}})[_0xb766('0x25')](handleEntityNotFound(_0x1bc108,null))[_0xb766('0x25')](function(_0x413868){if(_0x413868){_0x33d430=_0x413868;_0x29adc4[_0xb766('0x33')]=_['keys'](db[_0xb766('0x64')][_0xb766('0x30')]);_0x29adc4['query']=_[_0xb766('0x36')](_0x5457d2[_0xb766('0x35')]);_0x29adc4[_0xb766('0x37')]=_['intersection'](_0x29adc4[_0xb766('0x33')],_0x29adc4[_0xb766('0x35')]);_0x1a4cf9['attributes']=_[_0xb766('0x38')](_0x29adc4[_0xb766('0x33')],qs[_0xb766('0x3a')](_0x5457d2[_0xb766('0x35')]['fields']));_0x1a4cf9[_0xb766('0x39')]=_0x1a4cf9['attributes'][_0xb766('0x3b')]?_0x1a4cf9['attributes']:_0x29adc4[_0xb766('0x33')];_0x1a4cf9[_0xb766('0x3e')]=qs['sort'](_0x5457d2['query']['sort']);_0x1a4cf9[_0xb766('0x40')]=qs['filters'](_['pick'](_0x5457d2['query'],_0x29adc4[_0xb766('0x37')]));if(_0x5457d2[_0xb766('0x35')][_0xb766('0x42')]){_0x1a4cf9['where']=_['merge'](_0x1a4cf9['where'],{'$or':_[_0xb766('0x34')](_0x1a4cf9[_0xb766('0x39')],function(_0x5626a2){var _0x4f08ea={};_0x4f08ea[_0x5626a2]={'$like':'%'+_0x5457d2[_0xb766('0x35')][_0xb766('0x42')]+'%'};return _0x4f08ea;})});}_0x1a4cf9=_[_0xb766('0x43')]({},_0x1a4cf9,_0x5457d2['options']);return _0x33d430['getTeams'](_0x1a4cf9);}})['then'](function(_0x3bbc81){if(_0x3bbc81){_0x2e541c=_0x3bbc81[_0xb766('0x3b')];if(!_0x5457d2[_0xb766('0x35')][_0xb766('0x3c')](_0xb766('0x3d'))){_0x1a4cf9[_0xb766('0x22')]=qs[_0xb766('0x22')](_0x5457d2[_0xb766('0x35')][_0xb766('0x22')]);_0x1a4cf9[_0xb766('0x21')]=qs[_0xb766('0x21')](_0x5457d2[_0xb766('0x35')][_0xb766('0x21')]);}return _0x33d430[_0xb766('0x63')](_0x1a4cf9);}})[_0xb766('0x25')](function(_0x385325){if(_0x385325){return _0x385325?{'count':_0x2e541c,'rows':_0x385325}:null;}})[_0xb766('0x25')](respondWithResult(_0x1bc108,null))['catch'](handleError(_0x1bc108,null));};exports[_0xb766('0x65')]=function(_0x1acfcd,_0x47e734,_0x59bc24){var _0xdb00d6=_0x1acfcd[_0xb766('0x4e')]['ids'];return db[_0xb766('0x64')][_0xb766('0x5a')]({'where':{'id':_0xdb00d6},'attributes':['id'],'include':[{'model':db[_0xb766('0x5b')],'as':'Agents','attributes':['id','name','online',_0xb766('0x66'),_0xb766('0x67')],'raw':!![]}]})[_0xb766('0x25')](function(_0x3d10ab){if(_0x3d10ab){var _0x54f5f4=_[_0xb766('0x68')](_0x3d10ab,function(_0x3728e7){var _0x5b01d8=_0x3728e7[_0xb766('0x50')]({'plain':!![]});return _0x5b01d8[_0xb766('0x69')];});return db[_0xb766('0x2f')][_0xb766('0x4c')]({'where':{'id':_0x1acfcd[_0xb766('0x4a')]['id']}})[_0xb766('0x25')](function(_0x4d34fd){return db[_0xb766('0x6a')]['transaction'](function(_0x347a68){return _0x4d34fd['addTeams'](_0xdb00d6,{'transaction':_0x347a68})['then'](function(){return BPromise[_0xb766('0x6b')](_0x54f5f4,function(_0x7d1e54){return db[_0xb766('0x59')][_0xb766('0x6c')]({'where':{'UserId':_0x7d1e54['id'],'MailQueueId':_0x1acfcd[_0xb766('0x4a')]['id']},'transaction':_0x347a68});});})['then'](function(){_0x54f5f4[_0xb766('0x6d')](function(_0x4fe003){socket[_0xb766('0x6e')](_0xb766('0x6f'),{'UserId':_0x4fe003['id'],'MailQueueId':_0x4d34fd['id']});});});});});}})[_0xb766('0x25')](respondWithStatusCode(_0x47e734,null))[_0xb766('0x48')](handleError(_0x47e734,null));};exports[_0xb766('0x70')]=function(_0x525314,_0x3c84d2,_0x4ae709){return db['Team'][_0xb766('0x5a')]({'where':{'id':_0x525314['query'][_0xb766('0x71')]},'attributes':['id'],'include':[{'model':db[_0xb766('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb766('0x25')](handleEntityNotFound(_0x3c84d2,null))[_0xb766('0x25')](function(_0xc25a2e){var _0x1c4309=_['map'](_0xc25a2e,'id');var _0x2f9da8=[];var _0x5a6a6e=[];var _0x127b0b=squel[_0xb766('0x72')]();_0x127b0b['field']('tq.TeamId')['from'](_0xb766('0x73'),'tq')[_0xb766('0x74')]('user_has_teams','ut',_0xb766('0x75'))[_0xb766('0x40')](_0xb766('0x76'),_0x525314[_0xb766('0x4a')]['id']);for(var _0xcddffb=0x0;_0xcddffb<_0xc25a2e[_0xb766('0x3b')];_0xcddffb+=0x1){let _0x2fab3c=_0xc25a2e[_0xcddffb];for(var _0x7cc724=0x0;_0x7cc724<_0x2fab3c[_0xb766('0x69')]['length'];_0x7cc724+=0x1){let _0x220e56=_0x2fab3c[_0xb766('0x69')][_0x7cc724];var _0x1fc574=_0x127b0b['clone']();_0x1fc574[_0xb766('0x40')]('ut.UserId\x20=\x20?',_0x220e56['id']);_0x5a6a6e[_0xb766('0x77')](db[_0xb766('0x6a')]['query'](_0x1fc574['toString'](),{'type':db[_0xb766('0x6a')][_0xb766('0x78')][_0xb766('0x79')]})[_0xb766('0x25')](function(_0x5ca6dd){if(_0x5ca6dd[_0xb766('0x3b')]===0x1){return _0x220e56['id'];}else{var _0x44212b=_[_0xb766('0x7a')](_[_0xb766('0x34')](_0x5ca6dd,_0xb766('0x7b')),function(_0x3af54e){return _[_0xb766('0x7c')](_0x1c4309,_0x3af54e);});if(_0x44212b){return _0x220e56['id'];}}}));}}return BPromise[_0xb766('0x7d')](_0x5a6a6e)['then'](function(_0x5868b5){_0x2f9da8=_(_0x2f9da8)[_0xb766('0x7e')](_0x5868b5)[_0xb766('0x7f')]()[_0xb766('0x80')]();return db[_0xb766('0x2f')][_0xb766('0x4c')]({'where':{'id':_0x525314['params']['id']}})[_0xb766('0x25')](function(_0x51d932){return db['sequelize'][_0xb766('0x81')](function(_0xa3497){return _0x51d932[_0xb766('0x70')](_0x525314[_0xb766('0x35')]['ids'],{'transaction':_0xa3497})[_0xb766('0x25')](function(){if(!_[_0xb766('0x82')](_0x2f9da8)){return _0x51d932[_0xb766('0x83')](_0x2f9da8,{'transaction':_0xa3497});}})[_0xb766('0x25')](function(){_0x2f9da8[_0xb766('0x6d')](function(_0x197814){socket['emit'](_0xb766('0x84'),{'UserId':_0x197814,'MailQueueId':_0x51d932['id']});});});});});});})[_0xb766('0x25')](respondWithStatusCode(_0x3c84d2,null))['catch'](handleError(_0x3c84d2,null));};exports['addAgents']=function(_0x362736,_0x5e318e,_0x3183b4){return db['MailQueue'][_0xb766('0x4c')]({'where':{'id':_0x362736['params']['id']}})[_0xb766('0x25')](handleEntityNotFound(_0x5e318e,null))[_0xb766('0x25')](function(_0x570627){if(_0x570627){return _0x570627[_0xb766('0x85')](_0x362736['body'][_0xb766('0x71')],_['omit'](_0x362736[_0xb766('0x4e')],[_0xb766('0x71'),'id'])||{})['spread'](function(_0x34e96d){for(var _0x4f54e6=0x0;_0x4f54e6<_0x362736['body'][_0xb766('0x71')][_0xb766('0x3b')];_0x4f54e6+=0x1){socket[_0xb766('0x6e')](_0xb766('0x6f'),{'UserId':Number(_0x362736['body'][_0xb766('0x71')][_0x4f54e6]),'MailQueueId':Number(_0x362736['params']['id'])});}return _0x34e96d;});}})[_0xb766('0x25')](respondWithResult(_0x5e318e,null))[_0xb766('0x48')](handleError(_0x5e318e,null));};exports[_0xb766('0x83')]=function(_0x450e65,_0x278fbf,_0x1306b5){return db[_0xb766('0x2f')][_0xb766('0x4c')]({'where':{'id':_0x450e65['params']['id']}})[_0xb766('0x25')](handleEntityNotFound(_0x278fbf,null))[_0xb766('0x25')](function(_0x100156){if(_0x100156){return _0x100156[_0xb766('0x83')](_0x450e65[_0xb766('0x35')][_0xb766('0x71')])['then'](function(){if(_[_0xb766('0x86')](_0x450e65[_0xb766('0x35')][_0xb766('0x71')])){for(var _0x135970=0x0;_0x135970<_0x450e65[_0xb766('0x35')][_0xb766('0x71')]['length'];_0x135970+=0x1){socket[_0xb766('0x6e')](_0xb766('0x84'),{'UserId':Number(_0x450e65['query']['ids'][_0x135970]),'MailQueueId':Number(_0x450e65[_0xb766('0x4a')]['id'])});}}else{socket[_0xb766('0x6e')](_0xb766('0x84'),{'UserId':Number(_0x450e65[_0xb766('0x35')][_0xb766('0x71')]),'MailQueueId':Number(_0x450e65[_0xb766('0x4a')]['id'])});}});}})[_0xb766('0x25')](respondWithStatusCode(_0x278fbf,null))[_0xb766('0x48')](handleError(_0x278fbf,null));};exports[_0xb766('0x87')]=function(_0x55bd10,_0x56dea6,_0x4a5d88){var _0x409f65={};var _0x483bce={};var _0x2ecaa4;var _0x1a3c61;return db[_0xb766('0x2f')][_0xb766('0x58')]({'where':{'id':_0x55bd10[_0xb766('0x4a')]['id']}})[_0xb766('0x25')](handleEntityNotFound(_0x56dea6,null))[_0xb766('0x25')](function(_0x249992){if(_0x249992){_0x2ecaa4=_0x249992;_0x483bce['model']=_[_0xb766('0x36')](db[_0xb766('0x5b')][_0xb766('0x30')]);_0x483bce[_0xb766('0x35')]=_[_0xb766('0x36')](_0x55bd10[_0xb766('0x35')]);_0x483bce[_0xb766('0x37')]=_[_0xb766('0x38')](_0x483bce[_0xb766('0x33')],_0x483bce[_0xb766('0x35')]);_0x409f65[_0xb766('0x39')]=_[_0xb766('0x38')](_0x483bce[_0xb766('0x33')],qs['fields'](_0x55bd10['query'][_0xb766('0x3a')]));_0x409f65[_0xb766('0x39')]=_0x409f65[_0xb766('0x39')][_0xb766('0x3b')]?_0x409f65[_0xb766('0x39')]:_0x483bce[_0xb766('0x33')];_0x409f65[_0xb766('0x3e')]=qs[_0xb766('0x3f')](_0x55bd10[_0xb766('0x35')][_0xb766('0x3f')]);_0x409f65[_0xb766('0x40')]=qs[_0xb766('0x37')](_[_0xb766('0x41')](_0x55bd10[_0xb766('0x35')],_0x483bce[_0xb766('0x37')]));if(_0x55bd10[_0xb766('0x35')]['filter']){_0x409f65[_0xb766('0x40')]=_['merge'](_0x409f65[_0xb766('0x40')],{'$or':_['map'](_0x409f65[_0xb766('0x39')],function(_0x1cc267){var _0x248518={};_0x248518[_0x1cc267]={'$like':'%'+_0x55bd10[_0xb766('0x35')][_0xb766('0x42')]+'%'};return _0x248518;})});}_0x409f65=_['merge']({},_0x409f65,_0x55bd10[_0xb766('0x4b')]);return _0x2ecaa4[_0xb766('0x87')](_0x409f65);}})[_0xb766('0x25')](function(_0x3a8e89){if(_0x3a8e89){_0x1a3c61=_0x3a8e89[_0xb766('0x3b')];if(!_0x55bd10[_0xb766('0x35')][_0xb766('0x3c')](_0xb766('0x3d'))){_0x409f65['limit']=qs[_0xb766('0x22')](_0x55bd10['query'][_0xb766('0x22')]);_0x409f65[_0xb766('0x21')]=qs[_0xb766('0x21')](_0x55bd10[_0xb766('0x35')][_0xb766('0x21')]);}return _0x2ecaa4[_0xb766('0x87')](_0x409f65);}})[_0xb766('0x25')](function(_0x2491a3){if(_0x2491a3){return _0x2491a3?{'count':_0x1a3c61,'rows':_0x2491a3}:null;}})[_0xb766('0x25')](respondWithResult(_0x56dea6,null))[_0xb766('0x48')](handleError(_0x56dea6,null));}; \ No newline at end of file +var _0xbf3f=['util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','status','json','undefined','limit','count','offset','Content-Range','apply','then','get','MailQueues','UserProfileResource','end','sendStatus','error','name','send','map','MailQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','type','VIRTUAL','filter','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','nolimit','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','SIP','getTeams','Team','addTeams','Agents','online','interface','sequelize','transaction','each','emit','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','union','compact','isEmpty','removeAgents','forEach','addAgents','omit','spread','userMailQueue:save','isArray','userMailQueue:remove','getAgents','eml-format','bluebird','mustache'];(function(_0x3e3d9e,_0xa3271d){var _0x1514d1=function(_0x2b825a){while(--_0x2b825a){_0x3e3d9e['push'](_0x3e3d9e['shift']());}};_0x1514d1(++_0xa3271d);}(_0xbf3f,0x10f));var _0xfbf3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf3f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfbf3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfbf3('0x1'));var Mustache=require(_0xfbf3('0x2'));var util=require(_0xfbf3('0x3'));var path=require('path');var sox=require(_0xfbf3('0x4'));var csv=require(_0xfbf3('0x5'));var ejs=require(_0xfbf3('0x6'));var fs=require('fs');var fs_extra=require(_0xfbf3('0x7'));var _=require(_0xfbf3('0x8'));var squel=require(_0xfbf3('0x9'));var crypto=require(_0xfbf3('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfbf3('0xb'));var toCsv=require(_0xfbf3('0x5'));var querystring=require(_0xfbf3('0xc'));var Papa=require(_0xfbf3('0xd'));var Redis=require(_0xfbf3('0xe'));var authService=require(_0xfbf3('0xf'));var qs=require(_0xfbf3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfbf3('0x11'));var logger=require(_0xfbf3('0x12'))('api');var utils=require(_0xfbf3('0x13'));var config=require(_0xfbf3('0x14'));var licenseUtil=require(_0xfbf3('0x15'));var db=require(_0xfbf3('0x16'))['db'];config['redis']=_['defaults'](config[_0xfbf3('0x17')],{'host':_0xfbf3('0x18'),'port':0x18eb});var socket=require(_0xfbf3('0x19'))(new Redis(config[_0xfbf3('0x17')]));require(_0xfbf3('0x1a'))[_0xfbf3('0x1b')](socket);function respondWithStatusCode(_0x46c54c,_0x17afec){_0x17afec=_0x17afec||0xcc;return function(_0x49fe4c){if(_0x49fe4c){return _0x46c54c['sendStatus'](_0x17afec);}return _0x46c54c[_0xfbf3('0x1c')](_0x17afec)['end']();};}function respondWithResult(_0x3cb3de,_0x9abb8a){_0x9abb8a=_0x9abb8a||0xc8;return function(_0x48e5b0){if(_0x48e5b0){return _0x3cb3de[_0xfbf3('0x1c')](_0x9abb8a)[_0xfbf3('0x1d')](_0x48e5b0);}};}function respondWithFilteredResult(_0x2e139b,_0x479424){return function(_0x543b69){if(_0x543b69){var _0x3936ee=typeof _0x479424['offset']===_0xfbf3('0x1e')&&typeof _0x479424[_0xfbf3('0x1f')]===_0xfbf3('0x1e');var _0x228dfd=_0x543b69[_0xfbf3('0x20')];var _0x4b100e=_0x3936ee?0x0:_0x479424[_0xfbf3('0x21')];var _0xf6fab8=_0x3936ee?_0x543b69[_0xfbf3('0x20')]:_0x479424[_0xfbf3('0x21')]+_0x479424[_0xfbf3('0x1f')];var _0x589300;if(_0xf6fab8>=_0x228dfd){_0xf6fab8=_0x228dfd;_0x589300=0xc8;}else{_0x589300=0xce;}_0x2e139b['status'](_0x589300);return _0x2e139b['set'](_0xfbf3('0x22'),_0x4b100e+'-'+_0xf6fab8+'/'+_0x228dfd)[_0xfbf3('0x1d')](_0x543b69);}return null;};}function patchUpdates(_0x4eb4dc){return function(_0x2a335c){try{jsonpatch[_0xfbf3('0x23')](_0x2a335c,_0x4eb4dc,!![]);}catch(_0x512cec){return BPromise['reject'](_0x512cec);}return _0x2a335c['save']();};}function saveUpdates(_0x147306,_0x432923){return function(_0x1aff37){if(_0x1aff37){return _0x1aff37['update'](_0x147306)['then'](function(_0xf72528){return _0xf72528;});}return null;};}function removeEntity(_0xc9240f,_0x441a99){return function(_0x5bd47c){if(_0x5bd47c){return _0x5bd47c['destroy']()[_0xfbf3('0x24')](function(){var _0x5d6a07=_0x5bd47c[_0xfbf3('0x25')]({'plain':!![]});var _0x3b6273=_0xfbf3('0x26');return db[_0xfbf3('0x27')]['destroy']({'where':{'type':_0x3b6273,'resourceId':_0x5d6a07['id']}})[_0xfbf3('0x24')](function(){return _0x5bd47c;});})[_0xfbf3('0x24')](function(){_0xc9240f[_0xfbf3('0x1c')](0xcc)[_0xfbf3('0x28')]();});}};}function handleEntityNotFound(_0x4dbb5b,_0x2315ba){return function(_0x22e436){if(!_0x22e436){_0x4dbb5b[_0xfbf3('0x29')](0x194);}return _0x22e436;};}function handleError(_0x3b3a68,_0x3f8b7b){_0x3f8b7b=_0x3f8b7b||0x1f4;return function(_0xbd7c46){logger[_0xfbf3('0x2a')](_0xbd7c46['stack']);if(_0xbd7c46[_0xfbf3('0x2b')]){delete _0xbd7c46[_0xfbf3('0x2b')];}_0x3b3a68[_0xfbf3('0x1c')](_0x3f8b7b)[_0xfbf3('0x2c')](_0xbd7c46);};}exports['index']=function(_0x3d5d2c,_0x2a9596){var _0x3da796={},_0x5464da={},_0x20d0df={'count':0x0,'rows':[]};var _0x407221=_[_0xfbf3('0x2d')](db[_0xfbf3('0x2e')][_0xfbf3('0x2f')],function(_0x3d7ce9){return{'name':_0x3d7ce9[_0xfbf3('0x30')],'type':_0x3d7ce9['type'][_0xfbf3('0x31')]};});_0x5464da[_0xfbf3('0x32')]=_['map'](_0x407221,_0xfbf3('0x2b'));_0x5464da['query']=_[_0xfbf3('0x33')](_0x3d5d2c[_0xfbf3('0x34')]);_0x5464da[_0xfbf3('0x35')]=_[_0xfbf3('0x36')](_0x5464da[_0xfbf3('0x32')],_0x5464da[_0xfbf3('0x34')]);_0x3da796[_0xfbf3('0x37')]=_[_0xfbf3('0x36')](_0x5464da['model'],qs[_0xfbf3('0x38')](_0x3d5d2c['query'][_0xfbf3('0x38')]));_0x3da796[_0xfbf3('0x37')]=_0x3da796[_0xfbf3('0x37')][_0xfbf3('0x39')]?_0x3da796[_0xfbf3('0x37')]:_0x5464da['model'];if(!_0x3d5d2c[_0xfbf3('0x34')]['hasOwnProperty']('nolimit')){_0x3da796['limit']=qs[_0xfbf3('0x1f')](_0x3d5d2c[_0xfbf3('0x34')][_0xfbf3('0x1f')]);_0x3da796[_0xfbf3('0x21')]=qs[_0xfbf3('0x21')](_0x3d5d2c[_0xfbf3('0x34')][_0xfbf3('0x21')]);}_0x3da796[_0xfbf3('0x3a')]=qs[_0xfbf3('0x3b')](_0x3d5d2c['query'][_0xfbf3('0x3b')]);_0x3da796[_0xfbf3('0x3c')]=qs[_0xfbf3('0x35')](_[_0xfbf3('0x3d')](_0x3d5d2c[_0xfbf3('0x34')],_0x5464da['filters']),_0x407221);if(_0x3d5d2c['query']['filter']){_0x3da796['where']=_[_0xfbf3('0x3e')](_0x3da796[_0xfbf3('0x3c')],{'$or':_[_0xfbf3('0x2d')](_0x407221,function(_0x141b91){if(_0x141b91[_0xfbf3('0x3f')]!==_0xfbf3('0x40')){var _0xf32a17={};_0xf32a17[_0x141b91[_0xfbf3('0x2b')]]={'$like':'%'+_0x3d5d2c[_0xfbf3('0x34')][_0xfbf3('0x41')]+'%'};return _0xf32a17;}})});}_0x3da796=_[_0xfbf3('0x3e')]({},_0x3da796,_0x3d5d2c['options']);var _0x1a1bbe={'where':_0x3da796[_0xfbf3('0x3c')]};return db['MailQueue'][_0xfbf3('0x20')](_0x1a1bbe)['then'](function(_0x79bee2){_0x20d0df['count']=_0x79bee2;if(_0x3d5d2c[_0xfbf3('0x34')]['includeAll']){_0x3da796[_0xfbf3('0x42')]=[{'all':!![]}];}return db[_0xfbf3('0x2e')][_0xfbf3('0x43')](_0x3da796);})[_0xfbf3('0x24')](function(_0x3156c6){_0x20d0df[_0xfbf3('0x44')]=_0x3156c6;return _0x20d0df;})[_0xfbf3('0x24')](respondWithFilteredResult(_0x2a9596,_0x3da796))[_0xfbf3('0x45')](handleError(_0x2a9596,null));};exports[_0xfbf3('0x46')]=function(_0x121321,_0x3c42f5){var _0x18c888={'raw':!![],'where':{'id':_0x121321[_0xfbf3('0x47')]['id']}},_0x38cc53={};_0x38cc53[_0xfbf3('0x32')]=_[_0xfbf3('0x33')](db['MailQueue'][_0xfbf3('0x2f')]);_0x38cc53[_0xfbf3('0x34')]=_['keys'](_0x121321[_0xfbf3('0x34')]);_0x38cc53['filters']=_[_0xfbf3('0x36')](_0x38cc53['model'],_0x38cc53[_0xfbf3('0x34')]);_0x18c888[_0xfbf3('0x37')]=_[_0xfbf3('0x36')](_0x38cc53['model'],qs[_0xfbf3('0x38')](_0x121321[_0xfbf3('0x34')]['fields']));_0x18c888[_0xfbf3('0x37')]=_0x18c888[_0xfbf3('0x37')][_0xfbf3('0x39')]?_0x18c888[_0xfbf3('0x37')]:_0x38cc53[_0xfbf3('0x32')];if(_0x121321[_0xfbf3('0x34')][_0xfbf3('0x48')]){_0x18c888[_0xfbf3('0x42')]=[{'all':!![]}];}_0x18c888=_['merge']({},_0x18c888,_0x121321[_0xfbf3('0x49')]);return db['MailQueue'][_0xfbf3('0x4a')](_0x18c888)['then'](handleEntityNotFound(_0x3c42f5,null))[_0xfbf3('0x24')](respondWithResult(_0x3c42f5,null))[_0xfbf3('0x45')](handleError(_0x3c42f5,null));};exports['create']=function(_0x30a524,_0x412d28){return db[_0xfbf3('0x2e')][_0xfbf3('0x4b')](_0x30a524[_0xfbf3('0x4c')],{})['then'](function(_0x2c610a){var _0x117d90=_0x30a524['user'][_0xfbf3('0x25')]({'plain':!![]});if(!_0x117d90)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x117d90[_0xfbf3('0x4d')]===_0xfbf3('0x4e')){var _0x501fa5=_0x2c610a[_0xfbf3('0x25')]({'plain':!![]});var _0x5a61a3='MailQueues';return db[_0xfbf3('0x4f')][_0xfbf3('0x4a')]({'where':{'name':_0x5a61a3,'userProfileId':_0x117d90[_0xfbf3('0x50')]},'raw':!![]})[_0xfbf3('0x24')](function(_0x5875cd){if(_0x5875cd&&_0x5875cd[_0xfbf3('0x51')]===0x0){return db['UserProfileResource'][_0xfbf3('0x4b')]({'name':_0x501fa5['name'],'resourceId':_0x501fa5['id'],'type':_0x5875cd[_0xfbf3('0x2b')],'sectionId':_0x5875cd['id']},{})[_0xfbf3('0x24')](function(){return _0x2c610a;});}else{return _0x2c610a;}})[_0xfbf3('0x45')](function(_0x49f218){logger[_0xfbf3('0x2a')](_0xfbf3('0x52'),_0x49f218);throw _0x49f218;});}return _0x2c610a;})[_0xfbf3('0x24')](respondWithResult(_0x412d28,0xc9))[_0xfbf3('0x45')](handleError(_0x412d28,null));};exports[_0xfbf3('0x53')]=function(_0x320dba,_0x14817e){if(_0x320dba[_0xfbf3('0x4c')]['id']){delete _0x320dba[_0xfbf3('0x4c')]['id'];}return db[_0xfbf3('0x2e')][_0xfbf3('0x4a')]({'where':{'id':_0x320dba[_0xfbf3('0x47')]['id']}})[_0xfbf3('0x24')](handleEntityNotFound(_0x14817e,null))['then'](saveUpdates(_0x320dba[_0xfbf3('0x4c')],null))[_0xfbf3('0x24')](respondWithResult(_0x14817e,null))[_0xfbf3('0x45')](handleError(_0x14817e,null));};exports[_0xfbf3('0x54')]=function(_0x796782,_0xdd09d0){return db['MailQueue'][_0xfbf3('0x4a')]({'where':{'id':_0x796782[_0xfbf3('0x47')]['id']}})['then'](handleEntityNotFound(_0xdd09d0,null))['then'](removeEntity(_0xdd09d0,null))['catch'](handleError(_0xdd09d0,null));};exports[_0xfbf3('0x55')]=function(_0x5ceb72,_0x2985ff){return db['MailQueue'][_0xfbf3('0x55')]()[_0xfbf3('0x24')](respondWithResult(_0x2985ff,null))[_0xfbf3('0x45')](handleError(_0x2985ff,null));};exports[_0xfbf3('0x56')]=function(_0x23de98,_0xabc9ce,_0xc32ee7){var _0x282175={'raw':!![],'where':{}},_0x167f26={},_0x3cce1d;return db['MailQueue'][_0xfbf3('0x57')]({'where':{'id':_0x23de98[_0xfbf3('0x47')]['id']}})[_0xfbf3('0x24')](handleEntityNotFound(_0xabc9ce,null))[_0xfbf3('0x24')](function(_0x4fcb1c){if(_0x4fcb1c){_0x3cce1d=_0x4fcb1c['get']({'plain':!![]});_0x167f26['model']=_[_0xfbf3('0x33')](db[_0xfbf3('0x58')][_0xfbf3('0x2f')]);_0x167f26[_0xfbf3('0x34')]=_[_0xfbf3('0x33')](_0x23de98[_0xfbf3('0x34')]);_0x167f26[_0xfbf3('0x35')]=_['intersection'](_0x167f26[_0xfbf3('0x32')],_0x167f26[_0xfbf3('0x34')]);_0x282175[_0xfbf3('0x37')]=_[_0xfbf3('0x36')](_0x167f26['model'],qs[_0xfbf3('0x38')](_0x23de98[_0xfbf3('0x34')][_0xfbf3('0x38')]));_0x282175['attributes']=_0x282175[_0xfbf3('0x37')][_0xfbf3('0x39')]?_0x282175[_0xfbf3('0x37')]:_0x167f26['model'];if(!_0x23de98[_0xfbf3('0x34')][_0xfbf3('0x59')](_0xfbf3('0x5a'))){_0x282175['limit']=qs[_0xfbf3('0x1f')](_0x23de98['query']['limit']);_0x282175[_0xfbf3('0x21')]=qs[_0xfbf3('0x21')](_0x23de98[_0xfbf3('0x34')][_0xfbf3('0x21')]);}_0x282175[_0xfbf3('0x3a')]=qs['sort'](_0x23de98[_0xfbf3('0x34')][_0xfbf3('0x3b')]);_0x282175[_0xfbf3('0x3c')]=qs['filters'](_['pick'](_0x23de98[_0xfbf3('0x34')],_0x167f26[_0xfbf3('0x35')]));_0x282175['where']['MailQueueId']=_0x4fcb1c['id'];if(_0x23de98[_0xfbf3('0x34')][_0xfbf3('0x41')]){_0x282175[_0xfbf3('0x3c')]=_[_0xfbf3('0x3e')](_0x282175[_0xfbf3('0x3c')],{'$or':_[_0xfbf3('0x2d')](_0x282175[_0xfbf3('0x37')],function(_0x2efd6a){var _0xfc8a72={};_0xfc8a72[_0x2efd6a]={'$like':'%'+_0x23de98[_0xfbf3('0x34')][_0xfbf3('0x41')]+'%'};return _0xfc8a72;})});}_0x282175=_[_0xfbf3('0x3e')]({},_0x282175,_0x23de98[_0xfbf3('0x49')]);return db['UserMailQueue'][_0xfbf3('0x43')](_0x282175);}})[_0xfbf3('0x24')](function(_0x49290b){if(_0x49290b){return db[_0xfbf3('0x5b')][_0xfbf3('0x5c')]({'where':{'id':_[_0xfbf3('0x2d')](_0x49290b,_0xfbf3('0x5d')),'role':_0xfbf3('0x5e')},'attributes':['id',_0xfbf3('0x2b'),_0xfbf3('0x5f'),_0xfbf3('0x60'),_0xfbf3('0x61')]});}})['then'](function(_0x2c449a){if(_0x2c449a){return{'count':_0x2c449a[_0xfbf3('0x20')],'rows':_[_0xfbf3('0x2d')](_0x2c449a['rows'],function(_0x1c876c){return{'membername':_0x1c876c['name'],'UserId':_0x1c876c['id'],'queue_name':_0x3cce1d[_0xfbf3('0x2b')],'MailQueueId':_0x3cce1d['id'],'interface':util['format']('%s/%s',_0xfbf3('0x62'),_0x1c876c[_0xfbf3('0x2b')]),'penalty':0x0,'paused':_0x1c876c[_0xfbf3('0x5f')],'createdAt':_0x1c876c[_0xfbf3('0x61')],'updatedAt':_0x1c876c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xabc9ce,_0x282175))[_0xfbf3('0x45')](handleError(_0xabc9ce,null));};exports[_0xfbf3('0x63')]=function(_0x360e47,_0x53dc2b,_0x5bd4c8){var _0x12b1ff={};var _0x16f21c={};var _0x42f0a1;var _0x286dda;return db[_0xfbf3('0x2e')][_0xfbf3('0x57')]({'where':{'id':_0x360e47[_0xfbf3('0x47')]['id']}})['then'](handleEntityNotFound(_0x53dc2b,null))[_0xfbf3('0x24')](function(_0x34d51f){if(_0x34d51f){_0x42f0a1=_0x34d51f;_0x16f21c['model']=_['keys'](db[_0xfbf3('0x64')]['rawAttributes']);_0x16f21c[_0xfbf3('0x34')]=_[_0xfbf3('0x33')](_0x360e47[_0xfbf3('0x34')]);_0x16f21c[_0xfbf3('0x35')]=_[_0xfbf3('0x36')](_0x16f21c[_0xfbf3('0x32')],_0x16f21c[_0xfbf3('0x34')]);_0x12b1ff['attributes']=_['intersection'](_0x16f21c[_0xfbf3('0x32')],qs[_0xfbf3('0x38')](_0x360e47['query']['fields']));_0x12b1ff[_0xfbf3('0x37')]=_0x12b1ff[_0xfbf3('0x37')][_0xfbf3('0x39')]?_0x12b1ff['attributes']:_0x16f21c[_0xfbf3('0x32')];_0x12b1ff[_0xfbf3('0x3a')]=qs[_0xfbf3('0x3b')](_0x360e47[_0xfbf3('0x34')][_0xfbf3('0x3b')]);_0x12b1ff['where']=qs[_0xfbf3('0x35')](_[_0xfbf3('0x3d')](_0x360e47[_0xfbf3('0x34')],_0x16f21c['filters']));if(_0x360e47[_0xfbf3('0x34')][_0xfbf3('0x41')]){_0x12b1ff[_0xfbf3('0x3c')]=_[_0xfbf3('0x3e')](_0x12b1ff['where'],{'$or':_[_0xfbf3('0x2d')](_0x12b1ff['attributes'],function(_0x450c88){var _0x3cf5f1={};_0x3cf5f1[_0x450c88]={'$like':'%'+_0x360e47[_0xfbf3('0x34')][_0xfbf3('0x41')]+'%'};return _0x3cf5f1;})});}_0x12b1ff=_['merge']({},_0x12b1ff,_0x360e47[_0xfbf3('0x49')]);return _0x42f0a1['getTeams'](_0x12b1ff);}})['then'](function(_0x1f1407){if(_0x1f1407){_0x286dda=_0x1f1407[_0xfbf3('0x39')];if(!_0x360e47[_0xfbf3('0x34')][_0xfbf3('0x59')](_0xfbf3('0x5a'))){_0x12b1ff['limit']=qs[_0xfbf3('0x1f')](_0x360e47['query'][_0xfbf3('0x1f')]);_0x12b1ff[_0xfbf3('0x21')]=qs[_0xfbf3('0x21')](_0x360e47[_0xfbf3('0x34')][_0xfbf3('0x21')]);}return _0x42f0a1[_0xfbf3('0x63')](_0x12b1ff);}})['then'](function(_0x2d5be5){if(_0x2d5be5){return _0x2d5be5?{'count':_0x286dda,'rows':_0x2d5be5}:null;}})[_0xfbf3('0x24')](respondWithResult(_0x53dc2b,null))['catch'](handleError(_0x53dc2b,null));};exports[_0xfbf3('0x65')]=function(_0x4d4091,_0x4d3544,_0x4db001){var _0x15a657=_0x4d4091[_0xfbf3('0x4c')]['ids'];return db['Team']['findAll']({'where':{'id':_0x15a657},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfbf3('0x66'),'attributes':['id',_0xfbf3('0x2b'),_0xfbf3('0x67'),'voicePause',_0xfbf3('0x68')],'raw':!![]}]})[_0xfbf3('0x24')](function(_0x537797){if(_0x537797){var _0x290887=_['flatMap'](_0x537797,function(_0x1f4d4c){var _0x2e4268=_0x1f4d4c[_0xfbf3('0x25')]({'plain':!![]});return _0x2e4268[_0xfbf3('0x66')];});return db['MailQueue'][_0xfbf3('0x4a')]({'where':{'id':_0x4d4091['params']['id']}})['then'](function(_0x25de03){return db[_0xfbf3('0x69')][_0xfbf3('0x6a')](function(_0x26b843){return _0x25de03[_0xfbf3('0x65')](_0x15a657,{'transaction':_0x26b843})[_0xfbf3('0x24')](function(){return BPromise[_0xfbf3('0x6b')](_0x290887,function(_0x23ceae){return db[_0xfbf3('0x58')]['findOrCreate']({'where':{'UserId':_0x23ceae['id'],'MailQueueId':_0x4d4091[_0xfbf3('0x47')]['id']},'transaction':_0x26b843});});})[_0xfbf3('0x24')](function(){_0x290887['forEach'](function(_0x17f544){socket[_0xfbf3('0x6c')]('userMailQueue:save',{'UserId':_0x17f544['id'],'MailQueueId':_0x25de03['id']});});});});});}})[_0xfbf3('0x24')](respondWithStatusCode(_0x4d3544,null))[_0xfbf3('0x45')](handleError(_0x4d3544,null));};exports[_0xfbf3('0x6d')]=function(_0x3d9582,_0x2e54fb,_0x1abb7d){return db[_0xfbf3('0x64')]['findAll']({'where':{'id':_0x3d9582[_0xfbf3('0x34')][_0xfbf3('0x6e')]},'attributes':['id'],'include':[{'model':db[_0xfbf3('0x5b')],'as':_0xfbf3('0x66'),'attributes':['id'],'raw':!![]}]})[_0xfbf3('0x24')](handleEntityNotFound(_0x2e54fb,null))['then'](function(_0x4459e9){var _0x2c5405=_[_0xfbf3('0x2d')](_0x4459e9,'id');var _0x4ff688=[];var _0x183e13=[];var _0x1f44d2=squel[_0xfbf3('0x6f')]();_0x1f44d2[_0xfbf3('0x70')](_0xfbf3('0x71'))[_0xfbf3('0x72')]('team_has_mail_queues','tq')[_0xfbf3('0x73')](_0xfbf3('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xfbf3('0x3c')](_0xfbf3('0x75'),_0x3d9582['params']['id']);for(var _0x33bbf9=0x0;_0x33bbf9<_0x4459e9['length'];_0x33bbf9+=0x1){let _0x5644d9=_0x4459e9[_0x33bbf9];for(var _0x5dc487=0x0;_0x5dc487<_0x5644d9[_0xfbf3('0x66')][_0xfbf3('0x39')];_0x5dc487+=0x1){let _0x268f7=_0x5644d9[_0xfbf3('0x66')][_0x5dc487];var _0x2b25e2=_0x1f44d2[_0xfbf3('0x76')]();_0x2b25e2[_0xfbf3('0x3c')](_0xfbf3('0x77'),_0x268f7['id']);_0x183e13['push'](db['sequelize']['query'](_0x2b25e2[_0xfbf3('0x78')](),{'type':db['sequelize']['QueryTypes'][_0xfbf3('0x79')]})['then'](function(_0x5cffa2){if(_0x5cffa2[_0xfbf3('0x39')]===0x1){return _0x268f7['id'];}else{var _0x59e757=_[_0xfbf3('0x7a')](_['map'](_0x5cffa2,_0xfbf3('0x7b')),function(_0x311fcf){return _[_0xfbf3('0x7c')](_0x2c5405,_0x311fcf);});if(_0x59e757){return _0x268f7['id'];}}}));}}return BPromise['all'](_0x183e13)[_0xfbf3('0x24')](function(_0x1560ec){_0x4ff688=_(_0x4ff688)[_0xfbf3('0x7d')](_0x1560ec)[_0xfbf3('0x7e')]()['value']();return db['MailQueue'][_0xfbf3('0x4a')]({'where':{'id':_0x3d9582['params']['id']}})['then'](function(_0x5332de){return db[_0xfbf3('0x69')][_0xfbf3('0x6a')](function(_0x1bc341){return _0x5332de[_0xfbf3('0x6d')](_0x3d9582[_0xfbf3('0x34')][_0xfbf3('0x6e')],{'transaction':_0x1bc341})[_0xfbf3('0x24')](function(){if(!_[_0xfbf3('0x7f')](_0x4ff688)){return _0x5332de[_0xfbf3('0x80')](_0x4ff688,{'transaction':_0x1bc341});}})[_0xfbf3('0x24')](function(){_0x4ff688[_0xfbf3('0x81')](function(_0x25fb09){socket['emit']('userMailQueue:remove',{'UserId':_0x25fb09,'MailQueueId':_0x5332de['id']});});});});});});})[_0xfbf3('0x24')](respondWithStatusCode(_0x2e54fb,null))[_0xfbf3('0x45')](handleError(_0x2e54fb,null));};exports[_0xfbf3('0x82')]=function(_0x4dabc6,_0x5ef613,_0x5bcc9e){return db[_0xfbf3('0x2e')][_0xfbf3('0x4a')]({'where':{'id':_0x4dabc6['params']['id']}})[_0xfbf3('0x24')](handleEntityNotFound(_0x5ef613,null))[_0xfbf3('0x24')](function(_0x562292){if(_0x562292){return _0x562292['addAgents'](_0x4dabc6['body'][_0xfbf3('0x6e')],_[_0xfbf3('0x83')](_0x4dabc6[_0xfbf3('0x4c')],[_0xfbf3('0x6e'),'id'])||{})[_0xfbf3('0x84')](function(_0x3ced6e){for(var _0x37797b=0x0;_0x37797b<_0x4dabc6[_0xfbf3('0x4c')]['ids']['length'];_0x37797b+=0x1){socket[_0xfbf3('0x6c')](_0xfbf3('0x85'),{'UserId':Number(_0x4dabc6[_0xfbf3('0x4c')][_0xfbf3('0x6e')][_0x37797b]),'MailQueueId':Number(_0x4dabc6[_0xfbf3('0x47')]['id'])});}return _0x3ced6e;});}})[_0xfbf3('0x24')](respondWithResult(_0x5ef613,null))['catch'](handleError(_0x5ef613,null));};exports[_0xfbf3('0x80')]=function(_0x29b195,_0x377358,_0x15a6d2){return db[_0xfbf3('0x2e')][_0xfbf3('0x4a')]({'where':{'id':_0x29b195[_0xfbf3('0x47')]['id']}})[_0xfbf3('0x24')](handleEntityNotFound(_0x377358,null))['then'](function(_0x87ad8c){if(_0x87ad8c){return _0x87ad8c[_0xfbf3('0x80')](_0x29b195[_0xfbf3('0x34')][_0xfbf3('0x6e')])[_0xfbf3('0x24')](function(){if(_[_0xfbf3('0x86')](_0x29b195[_0xfbf3('0x34')][_0xfbf3('0x6e')])){for(var _0x1ad48a=0x0;_0x1ad48a<_0x29b195[_0xfbf3('0x34')][_0xfbf3('0x6e')][_0xfbf3('0x39')];_0x1ad48a+=0x1){socket[_0xfbf3('0x6c')](_0xfbf3('0x87'),{'UserId':Number(_0x29b195[_0xfbf3('0x34')][_0xfbf3('0x6e')][_0x1ad48a]),'MailQueueId':Number(_0x29b195[_0xfbf3('0x47')]['id'])});}}else{socket[_0xfbf3('0x6c')]('userMailQueue:remove',{'UserId':Number(_0x29b195[_0xfbf3('0x34')][_0xfbf3('0x6e')]),'MailQueueId':Number(_0x29b195[_0xfbf3('0x47')]['id'])});}});}})[_0xfbf3('0x24')](respondWithStatusCode(_0x377358,null))[_0xfbf3('0x45')](handleError(_0x377358,null));};exports[_0xfbf3('0x88')]=function(_0x3bf3ca,_0xe2cc43,_0x2d3425){var _0x2d4ebf={};var _0x508093={};var _0x4670a6;var _0x35b450;return db['MailQueue'][_0xfbf3('0x57')]({'where':{'id':_0x3bf3ca['params']['id']}})['then'](handleEntityNotFound(_0xe2cc43,null))['then'](function(_0x29342d){if(_0x29342d){_0x4670a6=_0x29342d;_0x508093[_0xfbf3('0x32')]=_[_0xfbf3('0x33')](db[_0xfbf3('0x5b')][_0xfbf3('0x2f')]);_0x508093['query']=_['keys'](_0x3bf3ca['query']);_0x508093['filters']=_[_0xfbf3('0x36')](_0x508093[_0xfbf3('0x32')],_0x508093[_0xfbf3('0x34')]);_0x2d4ebf[_0xfbf3('0x37')]=_[_0xfbf3('0x36')](_0x508093[_0xfbf3('0x32')],qs['fields'](_0x3bf3ca[_0xfbf3('0x34')]['fields']));_0x2d4ebf[_0xfbf3('0x37')]=_0x2d4ebf[_0xfbf3('0x37')][_0xfbf3('0x39')]?_0x2d4ebf[_0xfbf3('0x37')]:_0x508093[_0xfbf3('0x32')];_0x2d4ebf[_0xfbf3('0x3a')]=qs['sort'](_0x3bf3ca[_0xfbf3('0x34')][_0xfbf3('0x3b')]);_0x2d4ebf[_0xfbf3('0x3c')]=qs[_0xfbf3('0x35')](_[_0xfbf3('0x3d')](_0x3bf3ca['query'],_0x508093[_0xfbf3('0x35')]));if(_0x3bf3ca['query']['filter']){_0x2d4ebf['where']=_['merge'](_0x2d4ebf[_0xfbf3('0x3c')],{'$or':_[_0xfbf3('0x2d')](_0x2d4ebf['attributes'],function(_0x2ad72c){var _0x5dabe9={};_0x5dabe9[_0x2ad72c]={'$like':'%'+_0x3bf3ca['query'][_0xfbf3('0x41')]+'%'};return _0x5dabe9;})});}_0x2d4ebf=_[_0xfbf3('0x3e')]({},_0x2d4ebf,_0x3bf3ca[_0xfbf3('0x49')]);return _0x4670a6[_0xfbf3('0x88')](_0x2d4ebf);}})[_0xfbf3('0x24')](function(_0x20365b){if(_0x20365b){_0x35b450=_0x20365b['length'];if(!_0x3bf3ca[_0xfbf3('0x34')][_0xfbf3('0x59')](_0xfbf3('0x5a'))){_0x2d4ebf['limit']=qs['limit'](_0x3bf3ca[_0xfbf3('0x34')][_0xfbf3('0x1f')]);_0x2d4ebf[_0xfbf3('0x21')]=qs[_0xfbf3('0x21')](_0x3bf3ca[_0xfbf3('0x34')]['offset']);}return _0x4670a6[_0xfbf3('0x88')](_0x2d4ebf);}})['then'](function(_0x20924b){if(_0x20924b){return _0x20924b?{'count':_0x35b450,'rows':_0x20924b}:null;}})[_0xfbf3('0x24')](respondWithResult(_0xe2cc43,null))[_0xfbf3('0x45')](handleError(_0xe2cc43,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 04ea1d5..f0009cc 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 _0xd72c=['hasOwnProperty','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','remove','emit'];(function(_0x110b9a,_0x7b64ed){var _0x16ac6a=function(_0x4759d0){while(--_0x4759d0){_0x110b9a['push'](_0x110b9a['shift']());}};_0x16ac6a(++_0x7b64ed);}(_0xd72c,0xbf));var _0xcd72=function(_0x436413,_0x2caf35){_0x436413=_0x436413-0x0;var _0x460580=_0xd72c[_0x436413];return _0x460580;};'use strict';var EventEmitter=require(_0xcd72('0x0'));var MailQueue=require(_0xcd72('0x1'))['db'][_0xcd72('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xcd72('0x3')](0x0);var events={'afterCreate':_0xcd72('0x4'),'afterUpdate':'update','afterDestroy':_0xcd72('0x5')};function emitEvent(_0xa3d369){return function(_0x4a9e8e,_0x122cd0,_0x5afc99){MailQueueEvents['emit'](_0xa3d369+':'+_0x4a9e8e['id'],_0x4a9e8e);MailQueueEvents[_0xcd72('0x6')](_0xa3d369,_0x4a9e8e);_0x5afc99(null);};}for(var e in events){if(events[_0xcd72('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xcd72('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xeb32=['../../mysqldb','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1abf7f,_0x1c515d){var _0x2518f0=function(_0x445d59){while(--_0x445d59){_0x1abf7f['push'](_0x1abf7f['shift']());}};_0x2518f0(++_0x1c515d);}(_0xeb32,0x164));var _0x2eb3=function(_0x4edc8b,_0x394fb7){_0x4edc8b=_0x4edc8b-0x0;var _0x5a348d=_0xeb32[_0x4edc8b];return _0x5a348d;};'use strict';var EventEmitter=require(_0x2eb3('0x0'));var MailQueue=require(_0x2eb3('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2eb3('0x2')};function emitEvent(_0x481c97){return function(_0x22f05f,_0x152685,_0xdd503f){MailQueueEvents[_0x2eb3('0x3')](_0x481c97+':'+_0x22f05f['id'],_0x22f05f);MailQueueEvents['emit'](_0x481c97,_0x22f05f);_0xdd503f(null);};}for(var e in events){if(events[_0x2eb3('0x4')](e)){var event=events[e];MailQueue[_0x2eb3('0x5')](e,emitEvent(event));}}module[_0x2eb3('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index c5c40d4..5405757 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 _0x02e8=['define','MailQueue','mail_queues','lodash','util','../../config/logger','bluebird','request-promise','rimraf','./mailQueue.attributes','exports'];(function(_0x43ad21,_0x55d053){var _0x12f48e=function(_0x1eb7d5){while(--_0x1eb7d5){_0x43ad21['push'](_0x43ad21['shift']());}};_0x12f48e(++_0x55d053);}(_0x02e8,0x1d1));var _0x802e=function(_0xa4044e,_0x397c38){_0xa4044e=_0xa4044e-0x0;var _0x1be1fc=_0x02e8[_0xa4044e];return _0x1be1fc;};'use strict';var _=require(_0x802e('0x0'));var util=require(_0x802e('0x1'));var logger=require(_0x802e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x802e('0x3'));var rp=require(_0x802e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x802e('0x5'));var config=require('../../config/environment');var attributes=require(_0x802e('0x6'));module[_0x802e('0x7')]=function(_0x2da326,_0x491ea6){return _0x2da326[_0x802e('0x8')](_0x802e('0x9'),attributes,{'tableName':_0x802e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca12=['request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xca12,0x14d));var _0x2ca1=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xca12[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x2ca1('0x0'));var util=require('util');var logger=require(_0x2ca1('0x1'))(_0x2ca1('0x2'));var moment=require(_0x2ca1('0x3'));var BPromise=require(_0x2ca1('0x4'));var rp=require(_0x2ca1('0x5'));var fs=require('fs');var path=require(_0x2ca1('0x6'));var rimraf=require(_0x2ca1('0x7'));var config=require(_0x2ca1('0x8'));var attributes=require(_0x2ca1('0x9'));module[_0x2ca1('0xa')]=function(_0x120acb,_0x555b2f){return _0x120acb['define'](_0x2ca1('0xb'),attributes,{'tableName':_0x2ca1('0xc'),'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 13a5590..0982c53 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 _0x6e69=['client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetMailQueue','MailQueue','findAll','options','raw','attributes','limit','map','include','model','catch','ShowMailQueue','find','where','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5ed024,_0x20fcac){var _0x529b32=function(_0x373b27){while(--_0x373b27){_0x5ed024['push'](_0x5ed024['shift']());}};_0x529b32(++_0x20fcac);}(_0x6e69,0x9a));var _0x96e6=function(_0x3bfde8,_0x4cc6ae){_0x3bfde8=_0x3bfde8-0x0;var _0x2c4150=_0x6e69[_0x3bfde8];return _0x2c4150;};'use strict';var _=require(_0x96e6('0x0'));var util=require('util');var moment=require(_0x96e6('0x1'));var BPromise=require(_0x96e6('0x2'));var rs=require(_0x96e6('0x3'));var fs=require('fs');var Redis=require(_0x96e6('0x4'));var db=require(_0x96e6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x96e6('0x6'))(_0x96e6('0x7'));var config=require(_0x96e6('0x8'));var jayson=require(_0x96e6('0x9'));var client=jayson[_0x96e6('0xa')]['http']({'port':0x232a});config[_0x96e6('0xb')]=_[_0x96e6('0xc')](config[_0x96e6('0xb')],{'host':_0x96e6('0xd'),'port':0x18eb});var socket=require(_0x96e6('0xe'))(new Redis(config[_0x96e6('0xb')]));require(_0x96e6('0xf'))['register'](socket);function respondWithRpcPromise(_0x34208c,_0x2e20a1,_0x311e6b){return new BPromise(function(_0x13398c,_0x555f9f){return client[_0x96e6('0x10')](_0x34208c,_0x311e6b)['then'](function(_0xcade23){logger[_0x96e6('0x11')](_0x96e6('0x12'),_0x2e20a1,_0x96e6('0x13'));logger[_0x96e6('0x14')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x2e20a1,_0x96e6('0x13'),JSON[_0x96e6('0x15')](_0xcade23));if(_0xcade23[_0x96e6('0x16')]){if(_0xcade23[_0x96e6('0x16')][_0x96e6('0x17')]===0x1f4){logger[_0x96e6('0x16')](_0x96e6('0x12'),_0x2e20a1,_0xcade23[_0x96e6('0x16')][_0x96e6('0x18')]);return _0x555f9f(_0xcade23[_0x96e6('0x16')][_0x96e6('0x18')]);}logger['error'](_0x96e6('0x12'),_0x2e20a1,_0xcade23[_0x96e6('0x16')]['message']);return _0x13398c(_0xcade23['error'][_0x96e6('0x18')]);}else{logger['info'](_0x96e6('0x12'),_0x2e20a1,_0x96e6('0x13'));_0x13398c(_0xcade23[_0x96e6('0x19')][_0x96e6('0x18')]);}})['catch'](function(_0x4b3ecc){logger[_0x96e6('0x16')](_0x96e6('0x12'),_0x2e20a1,_0x4b3ecc);_0x555f9f(_0x4b3ecc);});});}exports[_0x96e6('0x1a')]=function(_0x3b6ef8){var _0x32e7aa=this;return new Promise(function(_0x26d867,_0x23705d){return db[_0x96e6('0x1b')][_0x96e6('0x1c')]({'raw':_0x3b6ef8[_0x96e6('0x1d')]?_0x3b6ef8[_0x96e6('0x1d')][_0x96e6('0x1e')]===undefined?!![]:![]:!![],'where':_0x3b6ef8[_0x96e6('0x1d')]?_0x3b6ef8[_0x96e6('0x1d')]['where']||null:null,'attributes':_0x3b6ef8['options']?_0x3b6ef8[_0x96e6('0x1d')][_0x96e6('0x1f')]||null:null,'limit':_0x3b6ef8['options']?_0x3b6ef8[_0x96e6('0x1d')][_0x96e6('0x20')]||null:null,'include':_0x3b6ef8[_0x96e6('0x1d')]?_0x3b6ef8[_0x96e6('0x1d')]['include']?_[_0x96e6('0x21')](_0x3b6ef8[_0x96e6('0x1d')][_0x96e6('0x22')],function(_0x35c041){return{'model':db[_0x35c041[_0x96e6('0x23')]],'as':_0x35c041['as'],'attributes':_0x35c041[_0x96e6('0x1f')],'include':_0x35c041[_0x96e6('0x22')]?_[_0x96e6('0x21')](_0x35c041['include'],function(_0x267247){return{'model':db[_0x267247['model']],'as':_0x267247['as'],'attributes':_0x267247[_0x96e6('0x1f')],'include':_0x267247[_0x96e6('0x22')]?_[_0x96e6('0x21')](_0x267247[_0x96e6('0x22')],function(_0x5c8b57){return{'model':db[_0x5c8b57[_0x96e6('0x23')]],'as':_0x5c8b57['as'],'attributes':_0x5c8b57[_0x96e6('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f6dc1){logger['info'](_0x96e6('0x1a'),_0x3b6ef8);logger[_0x96e6('0x14')](_0x96e6('0x1a'),_0x3b6ef8,JSON[_0x96e6('0x15')](_0x2f6dc1));_0x26d867(_0x2f6dc1);})[_0x96e6('0x24')](function(_0x4ec542){logger[_0x96e6('0x16')](_0x96e6('0x1a'),_0x4ec542['message'],_0x3b6ef8);_0x23705d(_0x32e7aa[_0x96e6('0x16')](0x1f4,_0x4ec542[_0x96e6('0x18')]));});});};exports[_0x96e6('0x25')]=function(_0x4b86dc){var _0x5a53f8=this;return new Promise(function(_0x1c7879,_0x173b74){return db[_0x96e6('0x1b')][_0x96e6('0x26')]({'raw':_0x4b86dc[_0x96e6('0x1d')]?_0x4b86dc[_0x96e6('0x1d')][_0x96e6('0x1e')]===undefined?!![]:![]:!![],'where':_0x4b86dc[_0x96e6('0x1d')]?_0x4b86dc[_0x96e6('0x1d')][_0x96e6('0x27')]||null:null,'attributes':_0x4b86dc[_0x96e6('0x1d')]?_0x4b86dc['options']['attributes']||null:null,'include':_0x4b86dc[_0x96e6('0x1d')]?_0x4b86dc[_0x96e6('0x1d')][_0x96e6('0x22')]?_[_0x96e6('0x21')](_0x4b86dc[_0x96e6('0x1d')]['include'],function(_0x183c0b){return{'model':db[_0x183c0b[_0x96e6('0x23')]],'as':_0x183c0b['as'],'attributes':_0x183c0b['attributes'],'include':_0x183c0b[_0x96e6('0x22')]?_[_0x96e6('0x21')](_0x183c0b[_0x96e6('0x22')],function(_0x3baf58){return{'model':db[_0x3baf58[_0x96e6('0x23')]],'as':_0x3baf58['as'],'attributes':_0x3baf58[_0x96e6('0x1f')],'include':_0x3baf58[_0x96e6('0x22')]?_[_0x96e6('0x21')](_0x3baf58['include'],function(_0x5f46b6){return{'model':db[_0x5f46b6[_0x96e6('0x23')]],'as':_0x5f46b6['as'],'attributes':_0x5f46b6[_0x96e6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x96e6('0x28')](function(_0x5fadf7){logger[_0x96e6('0x11')](_0x96e6('0x25'),_0x4b86dc);logger[_0x96e6('0x14')](_0x96e6('0x25'),_0x4b86dc,JSON[_0x96e6('0x15')](_0x5fadf7));_0x1c7879(_0x5fadf7);})[_0x96e6('0x24')](function(_0x2f7e00){logger[_0x96e6('0x16')](_0x96e6('0x25'),_0x2f7e00['message'],_0x4b86dc);_0x173b74(_0x5a53f8['error'](0x1f4,_0x2f7e00['message']));});});}; \ No newline at end of file +var _0x61ee=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','redis','localhost','./mailQueue.socket','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','limit','include','attributes','map','model','then','find','ShowMailQueue','lodash','moment'];(function(_0x1d8d19,_0x118a50){var _0x22a336=function(_0xe3a3c4){while(--_0xe3a3c4){_0x1d8d19['push'](_0x1d8d19['shift']());}};_0x22a336(++_0x118a50);}(_0x61ee,0x1ba));var _0xe61e=function(_0x15f8ad,_0x5275c3){_0x15f8ad=_0x15f8ad-0x0;var _0xc0238a=_0x61ee[_0x15f8ad];return _0xc0238a;};'use strict';var _=require(_0xe61e('0x0'));var util=require('util');var moment=require(_0xe61e('0x1'));var BPromise=require(_0xe61e('0x2'));var rs=require(_0xe61e('0x3'));var fs=require('fs');var Redis=require(_0xe61e('0x4'));var db=require(_0xe61e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe61e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe61e('0x7')][_0xe61e('0x8')]({'port':0x232a});config[_0xe61e('0x9')]=_['defaults'](config[_0xe61e('0x9')],{'host':_0xe61e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe61e('0x9')]));require(_0xe61e('0xb'))['register'](socket);function respondWithRpcPromise(_0x33fdf2,_0x121ace,_0x507ab7){return new BPromise(function(_0xb72a76,_0x363aad){return client[_0xe61e('0xc')](_0x33fdf2,_0x507ab7)['then'](function(_0x464870){logger[_0xe61e('0xd')](_0xe61e('0xe'),_0x121ace,_0xe61e('0xf'));logger[_0xe61e('0x10')](_0xe61e('0x11'),_0x121ace,_0xe61e('0xf'),JSON[_0xe61e('0x12')](_0x464870));if(_0x464870[_0xe61e('0x13')]){if(_0x464870['error'][_0xe61e('0x14')]===0x1f4){logger[_0xe61e('0x13')]('MailQueue,\x20%s,\x20%s',_0x121ace,_0x464870[_0xe61e('0x13')][_0xe61e('0x15')]);return _0x363aad(_0x464870[_0xe61e('0x13')][_0xe61e('0x15')]);}logger[_0xe61e('0x13')](_0xe61e('0xe'),_0x121ace,_0x464870[_0xe61e('0x13')][_0xe61e('0x15')]);return _0xb72a76(_0x464870[_0xe61e('0x13')][_0xe61e('0x15')]);}else{logger['info'](_0xe61e('0xe'),_0x121ace,_0xe61e('0xf'));_0xb72a76(_0x464870['result']['message']);}})[_0xe61e('0x16')](function(_0x4b12de){logger['error'](_0xe61e('0xe'),_0x121ace,_0x4b12de);_0x363aad(_0x4b12de);});});}exports[_0xe61e('0x17')]=function(_0x5b7d6b){var _0x529dc0=this;return new Promise(function(_0xac44ff,_0x4d3d56){return db[_0xe61e('0x18')][_0xe61e('0x19')]({'raw':_0x5b7d6b['options']?_0x5b7d6b[_0xe61e('0x1a')][_0xe61e('0x1b')]===undefined?!![]:![]:!![],'where':_0x5b7d6b[_0xe61e('0x1a')]?_0x5b7d6b[_0xe61e('0x1a')][_0xe61e('0x1c')]||null:null,'attributes':_0x5b7d6b[_0xe61e('0x1a')]?_0x5b7d6b[_0xe61e('0x1a')]['attributes']||null:null,'limit':_0x5b7d6b[_0xe61e('0x1a')]?_0x5b7d6b[_0xe61e('0x1a')][_0xe61e('0x1d')]||null:null,'include':_0x5b7d6b[_0xe61e('0x1a')]?_0x5b7d6b['options'][_0xe61e('0x1e')]?_['map'](_0x5b7d6b[_0xe61e('0x1a')][_0xe61e('0x1e')],function(_0x361bf6){return{'model':db[_0x361bf6['model']],'as':_0x361bf6['as'],'attributes':_0x361bf6[_0xe61e('0x1f')],'include':_0x361bf6[_0xe61e('0x1e')]?_[_0xe61e('0x20')](_0x361bf6[_0xe61e('0x1e')],function(_0xc8f76c){return{'model':db[_0xc8f76c[_0xe61e('0x21')]],'as':_0xc8f76c['as'],'attributes':_0xc8f76c[_0xe61e('0x1f')],'include':_0xc8f76c['include']?_[_0xe61e('0x20')](_0xc8f76c[_0xe61e('0x1e')],function(_0x26d54a){return{'model':db[_0x26d54a['model']],'as':_0x26d54a['as'],'attributes':_0x26d54a[_0xe61e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe61e('0x22')](function(_0x2c8bd1){logger[_0xe61e('0xd')](_0xe61e('0x17'),_0x5b7d6b);logger[_0xe61e('0x10')](_0xe61e('0x17'),_0x5b7d6b,JSON[_0xe61e('0x12')](_0x2c8bd1));_0xac44ff(_0x2c8bd1);})[_0xe61e('0x16')](function(_0x404910){logger[_0xe61e('0x13')]('GetMailQueue',_0x404910[_0xe61e('0x15')],_0x5b7d6b);_0x4d3d56(_0x529dc0[_0xe61e('0x13')](0x1f4,_0x404910[_0xe61e('0x15')]));});});};exports['ShowMailQueue']=function(_0x4d9e79){var _0x392aca=this;return new Promise(function(_0x4e5c0e,_0x10cb38){return db['MailQueue'][_0xe61e('0x23')]({'raw':_0x4d9e79[_0xe61e('0x1a')]?_0x4d9e79['options'][_0xe61e('0x1b')]===undefined?!![]:![]:!![],'where':_0x4d9e79[_0xe61e('0x1a')]?_0x4d9e79[_0xe61e('0x1a')][_0xe61e('0x1c')]||null:null,'attributes':_0x4d9e79[_0xe61e('0x1a')]?_0x4d9e79['options'][_0xe61e('0x1f')]||null:null,'include':_0x4d9e79[_0xe61e('0x1a')]?_0x4d9e79[_0xe61e('0x1a')]['include']?_[_0xe61e('0x20')](_0x4d9e79[_0xe61e('0x1a')]['include'],function(_0x599d4c){return{'model':db[_0x599d4c[_0xe61e('0x21')]],'as':_0x599d4c['as'],'attributes':_0x599d4c[_0xe61e('0x1f')],'include':_0x599d4c[_0xe61e('0x1e')]?_[_0xe61e('0x20')](_0x599d4c['include'],function(_0x54a614){return{'model':db[_0x54a614['model']],'as':_0x54a614['as'],'attributes':_0x54a614['attributes'],'include':_0x54a614[_0xe61e('0x1e')]?_['map'](_0x54a614[_0xe61e('0x1e')],function(_0x585aa8){return{'model':db[_0x585aa8[_0xe61e('0x21')]],'as':_0x585aa8['as'],'attributes':_0x585aa8[_0xe61e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe61e('0x22')](function(_0x1a07a1){logger[_0xe61e('0xd')](_0xe61e('0x24'),_0x4d9e79);logger[_0xe61e('0x10')](_0xe61e('0x24'),_0x4d9e79,JSON[_0xe61e('0x12')](_0x1a07a1));_0x4e5c0e(_0x1a07a1);})[_0xe61e('0x16')](function(_0x49347e){logger['error'](_0xe61e('0x24'),_0x49347e['message'],_0x4d9e79);_0x10cb38(_0x392aca[_0xe61e('0x13')](0x1f4,_0x49347e['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 6d2802d..cc209cc 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 _0xc052=['./mailQueue.events','save','update','removeListener','register','length','mailQueue:'];(function(_0x510808,_0x37bca8){var _0x26448d=function(_0x1c2076){while(--_0x1c2076){_0x510808['push'](_0x510808['shift']());}};_0x26448d(++_0x37bca8);}(_0xc052,0x70));var _0x2c05=function(_0x1e6273,_0x208f12){_0x1e6273=_0x1e6273-0x0;var _0x12201d=_0xc052[_0x1e6273];return _0x12201d;};'use strict';var MailQueueEvents=require(_0x2c05('0x0'));var events=[_0x2c05('0x1'),'remove',_0x2c05('0x2')];function createListener(_0x33ec2d,_0x526d2d){return function(_0x5f5b9f){_0x526d2d['emit'](_0x33ec2d,_0x5f5b9f);};}function removeListener(_0x7740c,_0x4cadc6){return function(){MailQueueEvents[_0x2c05('0x3')](_0x7740c,_0x4cadc6);};}exports[_0x2c05('0x4')]=function(_0x41a498){for(var _0x3921a0=0x0,_0x2dd7c9=events[_0x2c05('0x5')];_0x3921a0<_0x2dd7c9;_0x3921a0++){var _0x13d267=events[_0x3921a0];var _0x177fba=createListener(_0x2c05('0x6')+_0x13d267,_0x41a498);MailQueueEvents['on'](_0x13d267,_0x177fba);}}; \ No newline at end of file +var _0x1ae4=['./mailQueue.events','save','remove','emit','removeListener','length'];(function(_0x41d928,_0x4e9912){var _0x3538c1=function(_0x18765f){while(--_0x18765f){_0x41d928['push'](_0x41d928['shift']());}};_0x3538c1(++_0x4e9912);}(_0x1ae4,0x114));var _0x41ae=function(_0xd5622c,_0x6e4e9e){_0xd5622c=_0xd5622c-0x0;var _0x1920c0=_0x1ae4[_0xd5622c];return _0x1920c0;};'use strict';var MailQueueEvents=require(_0x41ae('0x0'));var events=[_0x41ae('0x1'),_0x41ae('0x2'),'update'];function createListener(_0x3cd2d1,_0x56f474){return function(_0x104278){_0x56f474[_0x41ae('0x3')](_0x3cd2d1,_0x104278);};}function removeListener(_0x1e13c7,_0x3ee740){return function(){MailQueueEvents[_0x41ae('0x4')](_0x1e13c7,_0x3ee740);};}exports['register']=function(_0x13dcf2){for(var _0x1c060f=0x0,_0x41ae40=events[_0x41ae('0x5')];_0x1c060f<_0x41ae40;_0x1c060f++){var _0x533a15=events[_0x1c060f];var _0x12a66c=createListener('mailQueue:'+_0x533a15,_0x13dcf2);MailQueueEvents['on'](_0x533a15,_0x12a66c);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 7e9a175..b9ebc48 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 _0xd454=['/describe','describe','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated'];(function(_0x375dde,_0x5027fc){var _0x4f58d7=function(_0x71647d){while(--_0x71647d){_0x375dde['push'](_0x375dde['shift']());}};_0x4f58d7(++_0x5027fc);}(_0xd454,0xd2));var _0x4d45=function(_0xdedab4,_0x2fd353){_0xdedab4=_0xdedab4-0x0;var _0x262896=_0xd454[_0xdedab4];return _0x262896;};'use strict';var multer=require(_0x4d45('0x0'));var util=require(_0x4d45('0x1'));var path=require(_0x4d45('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4d45('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4d45('0x4'));var interaction=require(_0x4d45('0x5'));var config=require(_0x4d45('0x6'));var controller=require(_0x4d45('0x7'));router[_0x4d45('0x8')]('/',auth[_0x4d45('0x9')](),controller['index']);router[_0x4d45('0x8')](_0x4d45('0xa'),auth[_0x4d45('0x9')](),controller[_0x4d45('0xb')]);router[_0x4d45('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4d45('0xc')]('/',auth['isAuthenticated'](),controller[_0x4d45('0xd')]);router[_0x4d45('0xe')](_0x4d45('0xf'),auth['isAuthenticated'](),controller[_0x4d45('0x10')]);router[_0x4d45('0x11')](_0x4d45('0xf'),auth[_0x4d45('0x9')](),controller[_0x4d45('0x12')]);module[_0x4d45('0x13')]=router; \ No newline at end of file +var _0x9061=['exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x9061,0x112));var _0x1906=function(_0x4e3c79,_0x2ab695){_0x4e3c79=_0x4e3c79-0x0;var _0xace74e=_0x9061[_0x4e3c79];return _0xace74e;};'use strict';var multer=require('multer');var util=require(_0x1906('0x0'));var path=require(_0x1906('0x1'));var timeout=require(_0x1906('0x2'));var express=require(_0x1906('0x3'));var router=express['Router']();var fs_extra=require(_0x1906('0x4'));var auth=require(_0x1906('0x5'));var interaction=require(_0x1906('0x6'));var config=require(_0x1906('0x7'));var controller=require('./mailQueueReport.controller');router[_0x1906('0x8')]('/',auth[_0x1906('0x9')](),controller[_0x1906('0xa')]);router[_0x1906('0x8')](_0x1906('0xb'),auth[_0x1906('0x9')](),controller[_0x1906('0xc')]);router[_0x1906('0x8')](_0x1906('0xd'),auth[_0x1906('0x9')](),controller[_0x1906('0xe')]);router[_0x1906('0xf')]('/',auth[_0x1906('0x9')](),controller[_0x1906('0x10')]);router['put'](_0x1906('0xd'),auth['isAuthenticated'](),controller[_0x1906('0x11')]);router[_0x1906('0x12')](_0x1906('0xd'),auth[_0x1906('0x9')](),controller[_0x1906('0x13')]);module[_0x1906('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 715621c..56964be 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 _0x790b=['moment','exports','STRING','DATE'];(function(_0x1cdb25,_0x2f1d25){var _0x17895d=function(_0x103152){while(--_0x103152){_0x1cdb25['push'](_0x1cdb25['shift']());}};_0x17895d(++_0x2f1d25);}(_0x790b,0x160));var _0xb790=function(_0x5c45fa,_0x5d36ef){_0x5c45fa=_0x5c45fa-0x0;var _0x2a90af=_0x790b[_0x5c45fa];return _0x2a90af;};'use strict';var moment=require(_0xb790('0x0'));var Sequelize=require('sequelize');module[_0xb790('0x1')]={'uniqueid':{'type':Sequelize[_0xb790('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb790('0x2')]},'joinAt':{'type':Sequelize[_0xb790('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xb790('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xb790('0x2')]}}; \ No newline at end of file +var _0xbef8=['exports','DATE','moment','sequelize'];(function(_0x4cf2ef,_0x158a4c){var _0x1c4adc=function(_0x1aa380){while(--_0x1aa380){_0x4cf2ef['push'](_0x4cf2ef['shift']());}};_0x1c4adc(++_0x158a4c);}(_0xbef8,0x1ea));var _0x8bef=function(_0x43e3e6,_0x54284b){_0x43e3e6=_0x43e3e6-0x0;var _0x21633a=_0xbef8[_0x43e3e6];return _0x21633a;};'use strict';var moment=require(_0x8bef('0x0'));var Sequelize=require(_0x8bef('0x1'));module[_0x8bef('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x8bef('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x8bef('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 26b4cbc..7cb4b50 100644 --- a/server/api/mailQueueReport/mailQueueReport.controller.js +++ b/server/api/mailQueueReport/mailQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','MailQueueReport','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack'];(function(_0x55ae94,_0x9c5753){var _0x6dcfa0=function(_0xfa790){while(--_0xfa790){_0x55ae94['push'](_0x55ae94['shift']());}};_0x6dcfa0(++_0x9c5753);}(_0x2ef3,0xba));var _0x32ef=function(_0x38525d,_0x21771b){_0x38525d=_0x38525d-0x0;var _0x5355fc=_0x2ef3[_0x38525d];return _0x5355fc;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['MailQueueReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['MailQueueReport'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['MailQueueReport']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));};exports['describe']=function(_0x179c2f,_0x259c32){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]()[_0x32ef('0x3e')](respondWithResult(_0x259c32,null))[_0x32ef('0x42')](handleError(_0x259c32,null));}; \ No newline at end of file +var _0xe2fe=['find','body','params','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','MailQueueReport','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show'];(function(_0x5cc71f,_0x4f6f52){var _0x4e1b52=function(_0x1bea3b){while(--_0x1bea3b){_0x5cc71f['push'](_0x5cc71f['shift']());}};_0x4e1b52(++_0x4f6f52);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['MailQueueReport']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':!![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['create']=function(_0x1609f0,_0x54cc44){return db['MailQueueReport']['create'](_0x1609f0['body'],{})[_0xee2f('0x1c')](respondWithResult(_0x54cc44,0xc9))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x584383,_0x22506e){if(_0x584383['body']['id']){delete _0x584383[_0xee2f('0x3e')]['id'];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'id':_0x584383[_0xee2f('0x3f')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x22506e,null))['then'](saveUpdates(_0x584383['body'],null))[_0xee2f('0x1c')](respondWithResult(_0x22506e,null))['catch'](handleError(_0x22506e,null));};exports[_0xee2f('0x1d')]=function(_0x282e89,_0x1928f8){return db[_0xee2f('0x23')]['find']({'where':{'id':_0x282e89['params']['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x1928f8,null))[_0xee2f('0x1c')](removeEntity(_0x1928f8,null))[_0xee2f('0x3b')](handleError(_0x1928f8,null));};exports[_0xee2f('0x40')]=function(_0x3acae6,_0x2a450f){return db[_0xee2f('0x23')][_0xee2f('0x40')]()[_0xee2f('0x1c')](respondWithResult(_0x2a450f,null))[_0xee2f('0x3b')](handleError(_0x2a450f,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 0704671..080eb5b 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 _0x1f33=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','report_mail_queue'];(function(_0x9c607a,_0x1cb2c6){var _0x3b1311=function(_0x1b3fec){while(--_0x1b3fec){_0x9c607a['push'](_0x9c607a['shift']());}};_0x3b1311(++_0x1cb2c6);}(_0x1f33,0xd2));var _0x31f3=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x1f33[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x31f3('0x0'));var util=require(_0x31f3('0x1'));var logger=require('../../config/logger')(_0x31f3('0x2'));var moment=require(_0x31f3('0x3'));var BPromise=require(_0x31f3('0x4'));var rp=require(_0x31f3('0x5'));var fs=require('fs');var path=require(_0x31f3('0x6'));var rimraf=require(_0x31f3('0x7'));var config=require(_0x31f3('0x8'));var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x294e9b,_0x3cad9e){return _0x294e9b['define']('MailQueueReport',attributes,{'tableName':_0x31f3('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ab9=['MailQueueReport','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','./mailQueueReport.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ab9,0x19a));var _0x96ab=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x6ab9[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0x96ab('0x0'));var util=require(_0x96ab('0x1'));var logger=require('../../config/logger')(_0x96ab('0x2'));var moment=require(_0x96ab('0x3'));var BPromise=require(_0x96ab('0x4'));var rp=require(_0x96ab('0x5'));var fs=require('fs');var path=require(_0x96ab('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x96ab('0x7'));module[_0x96ab('0x8')]=function(_0x1ce450,_0x52339d){return _0x1ce450[_0x96ab('0x9')](_0x96ab('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x96ab('0xb'),'fields':[_0x96ab('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 000c4eb..0bc2ae4 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x40de6f,_0x3d5f9c){var _0x44a887=function(_0x2d6564){while(--_0x2d6564){_0x40de6f['push'](_0x40de6f['shift']());}};_0x44a887(++_0x3d5f9c);}(_0x2ef3,0xba));var _0x32ef=function(_0x384ca1,_0x30a160){_0x384ca1=_0x384ca1-0x0;var _0x18c982=_0x2ef3[_0x384ca1];return _0x18c982;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _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(_0x55aa9e,_0x2815f5){var _0x513d9c=function(_0x20b29c){while(--_0x20b29c){_0x55aa9e['push'](_0x55aa9e['shift']());}};_0x513d9c(++_0x2815f5);}(_0x326f,0xd1));var _0xf326=function(_0x1f59d6,_0x36b4ae){_0x1f59d6=_0x1f59d6-0x0;var _0xfa3a5e=_0x326f[_0x1f59d6];return _0xfa3a5e;};'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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index d803f98..7b1f531 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x353c53,_0x2102c0){var _0x2c55da=function(_0x3fe2d5){while(--_0x3fe2d5){_0x353c53['push'](_0x353c53['shift']());}};_0x2c55da(++_0x2102c0);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4b4a4b,_0xf29d3b){var _0x8ca386=function(_0x257b1a){while(--_0x257b1a){_0x4b4a4b['push'](_0x4b4a4b['shift']());}};_0x8ca386(++_0xf29d3b);}(_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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index b6d3cae..6394b95 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 _0x20f5=['INBOX','sequelize','STRING','BOOLEAN','INTEGER'];(function(_0x16b1a5,_0x318267){var _0x475e25=function(_0x2e3bf6){while(--_0x2e3bf6){_0x16b1a5['push'](_0x16b1a5['shift']());}};_0x475e25(++_0x318267);}(_0x20f5,0xd8));var _0x520f=function(_0x15bb00,_0x221fae){_0x15bb00=_0x15bb00-0x0;var _0xaea5dd=_0x20f5[_0x15bb00];return _0xaea5dd;};'use strict';var Sequelize=require(_0x520f('0x0'));module['exports']={'description':{'type':Sequelize[_0x520f('0x1')]},'host':{'type':Sequelize[_0x520f('0x1')]},'authentication':{'type':Sequelize[_0x520f('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x520f('0x1')]},'password':{'type':Sequelize[_0x520f('0x1')]},'port':{'type':Sequelize[_0x520f('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x520f('0x4')},'connTimeout':{'type':Sequelize[_0x520f('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x520f('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x520f('0x1')]},'modernAuthentication':{'type':Sequelize[_0x520f('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x5aeb=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x3e7c24,_0x43228a){var _0x3d91aa=function(_0x1f9806){while(--_0x1f9806){_0x3e7c24['push'](_0x3e7c24['shift']());}};_0x3d91aa(++_0x43228a);}(_0x5aeb,0xc5));var _0xb5ae=function(_0x37b678,_0x479773){_0x37b678=_0x37b678-0x0;var _0xc824c6=_0x5aeb[_0x37b678];return _0xc824c6;};'use strict';var Sequelize=require(_0xb5ae('0x0'));module[_0xb5ae('0x1')]={'description':{'type':Sequelize[_0xb5ae('0x2')]},'host':{'type':Sequelize[_0xb5ae('0x2')]},'authentication':{'type':Sequelize[_0xb5ae('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xb5ae('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xb5ae('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb5ae('0x4')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 5926ff8..7f68acd 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 _0x2c2c=['exports','define','MailServerIn','mail_servers_in','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x3e438f,_0x4439e7){var _0x35f7ff=function(_0x5c643a){while(--_0x5c643a){_0x3e438f['push'](_0x3e438f['shift']());}};_0x35f7ff(++_0x4439e7);}(_0x2c2c,0x1bc));var _0xc2c2=function(_0x556351,_0x4c6170){_0x556351=_0x556351-0x0;var _0xca3b3=_0x2c2c[_0x556351];return _0xca3b3;};'use strict';var _=require('lodash');var util=require(_0xc2c2('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc2c2('0x1'));var BPromise=require('bluebird');var rp=require(_0xc2c2('0x2'));var fs=require('fs');var path=require(_0xc2c2('0x3'));var rimraf=require(_0xc2c2('0x4'));var config=require(_0xc2c2('0x5'));var attributes=require('./mailServerIn.attributes');module[_0xc2c2('0x6')]=function(_0x5e2a8f,_0x188a34){return _0x5e2a8f[_0xc2c2('0x7')](_0xc2c2('0x8'),attributes,{'tableName':_0xc2c2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16fb=['exports','define','MailServerIn','mail_servers_in','api','request-promise','rimraf','../../config/environment'];(function(_0x1770da,_0x145c69){var _0xb53efc=function(_0x1d4baa){while(--_0x1d4baa){_0x1770da['push'](_0x1770da['shift']());}};_0xb53efc(++_0x145c69);}(_0x16fb,0xfc));var _0xb16f=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0x16fb[_0x2a56ad];return _0x425175;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb16f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb16f('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb16f('0x2'));var config=require(_0xb16f('0x3'));var attributes=require('./mailServerIn.attributes');module[_0xb16f('0x4')]=function(_0x3dc11e,_0x4f155b){return _0x3dc11e[_0xb16f('0x5')](_0xb16f('0x6'),attributes,{'tableName':_0xb16f('0x7'),'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 87b60c9..9d9c922 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 _0x222b=['limit','map','include','model','then','debug','stringify','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes'];(function(_0x18f5d8,_0x3b1a11){var _0x5313a7=function(_0x2dd02d){while(--_0x2dd02d){_0x18f5d8['push'](_0x18f5d8['shift']());}};_0x5313a7(++_0x3b1a11);}(_0x222b,0xee));var _0xb222=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0x222b[_0x3e3bee];return _0x3ae14c;};'use strict';var _=require(_0xb222('0x0'));var util=require('util');var moment=require(_0xb222('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb222('0x2'));var db=require(_0xb222('0x3'))['db'];var utils=require(_0xb222('0x4'));var logger=require(_0xb222('0x5'))('rpc');var config=require(_0xb222('0x6'));var jayson=require(_0xb222('0x7'));var client=jayson[_0xb222('0x8')][_0xb222('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x406fcf,_0x49fbf9,_0x5e4d1a){return new BPromise(function(_0x37be1f,_0x477ce0){return client[_0xb222('0xa')](_0x406fcf,_0x5e4d1a)['then'](function(_0x41b716){logger[_0xb222('0xb')](_0xb222('0xc'),_0x49fbf9,_0xb222('0xd'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x49fbf9,'request\x20sent',JSON['stringify'](_0x41b716));if(_0x41b716[_0xb222('0xe')]){if(_0x41b716[_0xb222('0xe')][_0xb222('0xf')]===0x1f4){logger['error']('MailServerIn,\x20%s,\x20%s',_0x49fbf9,_0x41b716[_0xb222('0xe')][_0xb222('0x10')]);return _0x477ce0(_0x41b716['error'][_0xb222('0x10')]);}logger[_0xb222('0xe')](_0xb222('0xc'),_0x49fbf9,_0x41b716[_0xb222('0xe')][_0xb222('0x10')]);return _0x37be1f(_0x41b716[_0xb222('0xe')][_0xb222('0x10')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x49fbf9,_0xb222('0xd'));_0x37be1f(_0x41b716[_0xb222('0x11')]['message']);}})[_0xb222('0x12')](function(_0x215511){logger[_0xb222('0xe')](_0xb222('0xc'),_0x49fbf9,_0x215511);_0x477ce0(_0x215511);});});}exports[_0xb222('0x13')]=function(_0x4e4169){var _0x11d703=this;return new Promise(function(_0x2ed352,_0x5e3623){return db[_0xb222('0x14')][_0xb222('0x15')]({'raw':_0x4e4169[_0xb222('0x16')]?_0x4e4169['options'][_0xb222('0x17')]===undefined?!![]:![]:!![],'where':_0x4e4169['options']?_0x4e4169['options'][_0xb222('0x18')]||null:null,'attributes':_0x4e4169[_0xb222('0x16')]?_0x4e4169[_0xb222('0x16')][_0xb222('0x19')]||null:null,'limit':_0x4e4169[_0xb222('0x16')]?_0x4e4169[_0xb222('0x16')][_0xb222('0x1a')]||null:null,'include':_0x4e4169['options']?_0x4e4169[_0xb222('0x16')]['include']?_[_0xb222('0x1b')](_0x4e4169[_0xb222('0x16')][_0xb222('0x1c')],function(_0x32f7b){return{'model':db[_0x32f7b[_0xb222('0x1d')]],'as':_0x32f7b['as'],'attributes':_0x32f7b[_0xb222('0x19')],'include':_0x32f7b[_0xb222('0x1c')]?_[_0xb222('0x1b')](_0x32f7b['include'],function(_0x59bb2c){return{'model':db[_0x59bb2c['model']],'as':_0x59bb2c['as'],'attributes':_0x59bb2c[_0xb222('0x19')],'include':_0x59bb2c[_0xb222('0x1c')]?_[_0xb222('0x1b')](_0x59bb2c[_0xb222('0x1c')],function(_0x52a025){return{'model':db[_0x52a025[_0xb222('0x1d')]],'as':_0x52a025['as'],'attributes':_0x52a025[_0xb222('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb222('0x1e')](function(_0x12e877){logger[_0xb222('0xb')](_0xb222('0x13'),_0x4e4169);logger[_0xb222('0x1f')](_0xb222('0x13'),_0x4e4169,JSON[_0xb222('0x20')](_0x12e877));_0x2ed352(_0x12e877);})[_0xb222('0x12')](function(_0x3c7f53){logger[_0xb222('0xe')](_0xb222('0x13'),_0x3c7f53['message'],_0x4e4169);_0x5e3623(_0x11d703[_0xb222('0xe')](0x1f4,_0x3c7f53[_0xb222('0x10')]));});});}; \ No newline at end of file +var _0xed59=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','include','map','model','then','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xed59,0x112));var _0x9ed5=function(_0x44b4b4,_0x2b9204){_0x44b4b4=_0x44b4b4-0x0;var _0x304e1a=_0xed59[_0x44b4b4];return _0x304e1a;};'use strict';var _=require(_0x9ed5('0x0'));var util=require(_0x9ed5('0x1'));var moment=require(_0x9ed5('0x2'));var BPromise=require('bluebird');var rs=require(_0x9ed5('0x3'));var fs=require('fs');var Redis=require(_0x9ed5('0x4'));var db=require(_0x9ed5('0x5'))['db'];var utils=require(_0x9ed5('0x6'));var logger=require(_0x9ed5('0x7'))(_0x9ed5('0x8'));var config=require(_0x9ed5('0x9'));var jayson=require(_0x9ed5('0xa'));var client=jayson[_0x9ed5('0xb')][_0x9ed5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x30dd85,_0x493b0f,_0x15d9b1){return new BPromise(function(_0x108ae4,_0x483827){return client[_0x9ed5('0xd')](_0x30dd85,_0x15d9b1)['then'](function(_0x15960e){logger['info'](_0x9ed5('0xe'),_0x493b0f,_0x9ed5('0xf'));logger[_0x9ed5('0x10')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x493b0f,_0x9ed5('0xf'),JSON['stringify'](_0x15960e));if(_0x15960e[_0x9ed5('0x11')]){if(_0x15960e[_0x9ed5('0x11')][_0x9ed5('0x12')]===0x1f4){logger['error'](_0x9ed5('0xe'),_0x493b0f,_0x15960e[_0x9ed5('0x11')][_0x9ed5('0x13')]);return _0x483827(_0x15960e[_0x9ed5('0x11')][_0x9ed5('0x13')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x493b0f,_0x15960e[_0x9ed5('0x11')]['message']);return _0x108ae4(_0x15960e[_0x9ed5('0x11')][_0x9ed5('0x13')]);}else{logger[_0x9ed5('0x14')](_0x9ed5('0xe'),_0x493b0f,_0x9ed5('0xf'));_0x108ae4(_0x15960e[_0x9ed5('0x15')][_0x9ed5('0x13')]);}})[_0x9ed5('0x16')](function(_0x5949e1){logger[_0x9ed5('0x11')]('MailServerIn,\x20%s,\x20%s',_0x493b0f,_0x5949e1);_0x483827(_0x5949e1);});});}exports[_0x9ed5('0x17')]=function(_0x4cd40e){var _0x5a8ee3=this;return new Promise(function(_0x53bd5d,_0x5c072c){return db[_0x9ed5('0x18')][_0x9ed5('0x19')]({'raw':_0x4cd40e[_0x9ed5('0x1a')]?_0x4cd40e[_0x9ed5('0x1a')][_0x9ed5('0x1b')]===undefined?!![]:![]:!![],'where':_0x4cd40e[_0x9ed5('0x1a')]?_0x4cd40e[_0x9ed5('0x1a')][_0x9ed5('0x1c')]||null:null,'attributes':_0x4cd40e['options']?_0x4cd40e[_0x9ed5('0x1a')][_0x9ed5('0x1d')]||null:null,'limit':_0x4cd40e[_0x9ed5('0x1a')]?_0x4cd40e[_0x9ed5('0x1a')]['limit']||null:null,'include':_0x4cd40e[_0x9ed5('0x1a')]?_0x4cd40e[_0x9ed5('0x1a')][_0x9ed5('0x1e')]?_[_0x9ed5('0x1f')](_0x4cd40e[_0x9ed5('0x1a')][_0x9ed5('0x1e')],function(_0x1e0648){return{'model':db[_0x1e0648[_0x9ed5('0x20')]],'as':_0x1e0648['as'],'attributes':_0x1e0648[_0x9ed5('0x1d')],'include':_0x1e0648[_0x9ed5('0x1e')]?_[_0x9ed5('0x1f')](_0x1e0648[_0x9ed5('0x1e')],function(_0x77151d){return{'model':db[_0x77151d[_0x9ed5('0x20')]],'as':_0x77151d['as'],'attributes':_0x77151d['attributes'],'include':_0x77151d[_0x9ed5('0x1e')]?_[_0x9ed5('0x1f')](_0x77151d[_0x9ed5('0x1e')],function(_0x28dccf){return{'model':db[_0x28dccf[_0x9ed5('0x20')]],'as':_0x28dccf['as'],'attributes':_0x28dccf[_0x9ed5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9ed5('0x21')](function(_0x5815ef){logger[_0x9ed5('0x14')]('GetMailServerIn',_0x4cd40e);logger['debug'](_0x9ed5('0x17'),_0x4cd40e,JSON[_0x9ed5('0x22')](_0x5815ef));_0x53bd5d(_0x5815ef);})['catch'](function(_0x5d9768){logger[_0x9ed5('0x11')](_0x9ed5('0x17'),_0x5d9768[_0x9ed5('0x13')],_0x4cd40e);_0x5c072c(_0x5a8ee3[_0x9ed5('0x11')](0x1f4,_0x5d9768['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index f372e7c..8f3bfaa 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(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7a54,0x106));var _0x47a5=function(_0x310cc8,_0x3b5a5e){_0x310cc8=_0x310cc8-0x0;var _0x5e8eed=_0x7a54[_0x310cc8];return _0x5e8eed;};'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(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x7a54,0x106));var _0x47a5=function(_0xabb850,_0x30bf34){_0xabb850=_0xabb850-0x0;var _0x2daad7=_0x7a54[_0xabb850];return _0x2daad7;};'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 7498f3b..4b13f49 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 _0x1775=['STRING','INTEGER','BOOLEAN','exports'];(function(_0x2d119f,_0x982429){var _0x23c3a4=function(_0x559b66){while(--_0x559b66){_0x2d119f['push'](_0x2d119f['shift']());}};_0x23c3a4(++_0x982429);}(_0x1775,0x1db));var _0x5177=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1775[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x5177('0x0')]={'description':{'type':Sequelize[_0x5177('0x1')]},'host':{'type':Sequelize[_0x5177('0x1')]},'user':{'type':Sequelize[_0x5177('0x1')]},'pass':{'type':Sequelize[_0x5177('0x1')]},'port':{'type':Sequelize[_0x5177('0x2')]},'secure':{'type':Sequelize[_0x5177('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x5177('0x1')]},'authentication':{'type':Sequelize[_0x5177('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x5177('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x6f7a=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x446c0a,_0x812620){_0x446c0a=_0x446c0a-0x0;var _0x137545=_0x6f7a[_0x446c0a];return _0x137545;};'use strict';var Sequelize=require(_0xa6f7('0x0'));module[_0xa6f7('0x1')]={'description':{'type':Sequelize[_0xa6f7('0x2')]},'host':{'type':Sequelize[_0xa6f7('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0xa6f7('0x2')]},'port':{'type':Sequelize[_0xa6f7('0x3')]},'secure':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xa6f7('0x2')]},'authentication':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xa6f7('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 7c07c42..32e2922 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 _0x6956=['options','create','body','update','find','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','save','destroy','error','stack','name','send','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','MailServerOut','count','includeAll','include','findAll','rows','then','catch','show','rawAttributes'];(function(_0x4a5516,_0x4cf973){var _0x161148=function(_0xe05e8a){while(--_0xe05e8a){_0x4a5516['push'](_0x4a5516['shift']());}};_0x161148(++_0x4cf973);}(_0x6956,0x173));var _0x6695=function(_0x279ab1,_0x527374){_0x279ab1=_0x279ab1-0x0;var _0x8ba87c=_0x6956[_0x279ab1];return _0x8ba87c;};'use strict';var emlformat=require(_0x6695('0x0'));var rimraf=require(_0x6695('0x1'));var zipdir=require(_0x6695('0x2'));var jsonpatch=require(_0x6695('0x3'));var rp=require('request-promise');var moment=require(_0x6695('0x4'));var BPromise=require(_0x6695('0x5'));var Mustache=require(_0x6695('0x6'));var util=require(_0x6695('0x7'));var path=require(_0x6695('0x8'));var sox=require(_0x6695('0x9'));var csv=require('to-csv');var ejs=require(_0x6695('0xa'));var fs=require('fs');var fs_extra=require(_0x6695('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6695('0xc'));var jsforce=require(_0x6695('0xd'));var deskjs=require(_0x6695('0xe'));var toCsv=require(_0x6695('0xf'));var querystring=require(_0x6695('0x10'));var Papa=require('papaparse');var Redis=require(_0x6695('0x11'));var authService=require(_0x6695('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6695('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6695('0x14'))(_0x6695('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6695('0x16'))['db'];function respondWithStatusCode(_0x421fa9,_0x1c3345){_0x1c3345=_0x1c3345||0xcc;return function(_0x45aca5){if(_0x45aca5){return _0x421fa9[_0x6695('0x17')](_0x1c3345);}return _0x421fa9['status'](_0x1c3345)[_0x6695('0x18')]();};}function respondWithResult(_0x50dcdd,_0x1f69aa){_0x1f69aa=_0x1f69aa||0xc8;return function(_0x1cca8b){if(_0x1cca8b){return _0x50dcdd[_0x6695('0x19')](_0x1f69aa)[_0x6695('0x1a')](_0x1cca8b);}};}function respondWithFilteredResult(_0x581423,_0x427d07){return function(_0x5b60f8){if(_0x5b60f8){var _0x5dcc5=typeof _0x427d07[_0x6695('0x1b')]===_0x6695('0x1c')&&typeof _0x427d07[_0x6695('0x1d')]===_0x6695('0x1c');var _0x3c8a6a=_0x5b60f8['count'];var _0x4e7389=_0x5dcc5?0x0:_0x427d07['offset'];var _0x1258dd=_0x5dcc5?_0x5b60f8['count']:_0x427d07[_0x6695('0x1b')]+_0x427d07[_0x6695('0x1d')];var _0x1c8050;if(_0x1258dd>=_0x3c8a6a){_0x1258dd=_0x3c8a6a;_0x1c8050=0xc8;}else{_0x1c8050=0xce;}_0x581423['status'](_0x1c8050);return _0x581423[_0x6695('0x1e')](_0x6695('0x1f'),_0x4e7389+'-'+_0x1258dd+'/'+_0x3c8a6a)[_0x6695('0x1a')](_0x5b60f8);}return null;};}function patchUpdates(_0x5ee847){return function(_0x3fbb3e){try{jsonpatch[_0x6695('0x20')](_0x3fbb3e,_0x5ee847,!![]);}catch(_0x5cdf65){return BPromise['reject'](_0x5cdf65);}return _0x3fbb3e[_0x6695('0x21')]();};}function saveUpdates(_0x5752a7,_0x43dfaa){return function(_0x15a1bc){if(_0x15a1bc){return _0x15a1bc['update'](_0x5752a7)['then'](function(_0x49e6f3){return _0x49e6f3;});}return null;};}function removeEntity(_0x2cf870,_0x5df965){return function(_0x694f57){if(_0x694f57){return _0x694f57[_0x6695('0x22')]()['then'](function(){_0x2cf870[_0x6695('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ce4e0,_0x467ee1){return function(_0x37aec1){if(!_0x37aec1){_0x2ce4e0[_0x6695('0x17')](0x194);}return _0x37aec1;};}function handleError(_0x188244,_0x1f5d17){_0x1f5d17=_0x1f5d17||0x1f4;return function(_0x34c613){logger[_0x6695('0x23')](_0x34c613[_0x6695('0x24')]);if(_0x34c613[_0x6695('0x25')]){delete _0x34c613[_0x6695('0x25')];}_0x188244['status'](_0x1f5d17)[_0x6695('0x26')](_0x34c613);};}exports['index']=function(_0x3c576c,_0xf0cda7){var _0x5879e4={},_0x2ee1c7={},_0x13e07f={'count':0x0,'rows':[]};var _0xe1e862=_[_0x6695('0x27')](db['MailServerOut']['rawAttributes'],function(_0x1d1ea8){return{'name':_0x1d1ea8['fieldName'],'type':_0x1d1ea8[_0x6695('0x28')][_0x6695('0x29')]};});_0x2ee1c7[_0x6695('0x2a')]=_['map'](_0xe1e862,_0x6695('0x25'));_0x2ee1c7[_0x6695('0x2b')]=_[_0x6695('0x2c')](_0x3c576c[_0x6695('0x2b')]);_0x2ee1c7[_0x6695('0x2d')]=_[_0x6695('0x2e')](_0x2ee1c7[_0x6695('0x2a')],_0x2ee1c7[_0x6695('0x2b')]);_0x5879e4[_0x6695('0x2f')]=_[_0x6695('0x2e')](_0x2ee1c7[_0x6695('0x2a')],qs[_0x6695('0x30')](_0x3c576c[_0x6695('0x2b')][_0x6695('0x30')]));_0x5879e4[_0x6695('0x2f')]=_0x5879e4[_0x6695('0x2f')][_0x6695('0x31')]?_0x5879e4[_0x6695('0x2f')]:_0x2ee1c7[_0x6695('0x2a')];if(!_0x3c576c[_0x6695('0x2b')]['hasOwnProperty'](_0x6695('0x32'))){_0x5879e4['limit']=qs[_0x6695('0x1d')](_0x3c576c[_0x6695('0x2b')][_0x6695('0x1d')]);_0x5879e4[_0x6695('0x1b')]=qs[_0x6695('0x1b')](_0x3c576c[_0x6695('0x2b')]['offset']);}_0x5879e4[_0x6695('0x33')]=qs[_0x6695('0x34')](_0x3c576c['query'][_0x6695('0x34')]);_0x5879e4[_0x6695('0x35')]=qs[_0x6695('0x2d')](_['pick'](_0x3c576c[_0x6695('0x2b')],_0x2ee1c7[_0x6695('0x2d')]),_0xe1e862);if(_0x3c576c[_0x6695('0x2b')][_0x6695('0x36')]){_0x5879e4[_0x6695('0x35')]=_[_0x6695('0x37')](_0x5879e4[_0x6695('0x35')],{'$or':_['map'](_0xe1e862,function(_0x919e6){if(_0x919e6[_0x6695('0x28')]!==_0x6695('0x38')){var _0x133c40={};_0x133c40[_0x919e6[_0x6695('0x25')]]={'$like':'%'+_0x3c576c[_0x6695('0x2b')][_0x6695('0x36')]+'%'};return _0x133c40;}})});}_0x5879e4=_['merge']({},_0x5879e4,_0x3c576c['options']);var _0x4a6b55={'where':_0x5879e4[_0x6695('0x35')]};return db[_0x6695('0x39')]['count'](_0x4a6b55)['then'](function(_0x33cf19){_0x13e07f[_0x6695('0x3a')]=_0x33cf19;if(_0x3c576c['query'][_0x6695('0x3b')]){_0x5879e4[_0x6695('0x3c')]=[{'all':!![]}];}return db['MailServerOut'][_0x6695('0x3d')](_0x5879e4);})['then'](function(_0x596758){_0x13e07f[_0x6695('0x3e')]=_0x596758;return _0x13e07f;})[_0x6695('0x3f')](respondWithFilteredResult(_0xf0cda7,_0x5879e4))[_0x6695('0x40')](handleError(_0xf0cda7,null));};exports[_0x6695('0x41')]=function(_0x3c312e,_0xb93330){var _0x16410f={'raw':!![],'where':{'id':_0x3c312e['params']['id']}},_0x1cb3ad={};_0x1cb3ad[_0x6695('0x2a')]=_['keys'](db['MailServerOut'][_0x6695('0x42')]);_0x1cb3ad[_0x6695('0x2b')]=_[_0x6695('0x2c')](_0x3c312e[_0x6695('0x2b')]);_0x1cb3ad[_0x6695('0x2d')]=_[_0x6695('0x2e')](_0x1cb3ad['model'],_0x1cb3ad[_0x6695('0x2b')]);_0x16410f[_0x6695('0x2f')]=_[_0x6695('0x2e')](_0x1cb3ad[_0x6695('0x2a')],qs[_0x6695('0x30')](_0x3c312e[_0x6695('0x2b')][_0x6695('0x30')]));_0x16410f[_0x6695('0x2f')]=_0x16410f[_0x6695('0x2f')][_0x6695('0x31')]?_0x16410f[_0x6695('0x2f')]:_0x1cb3ad[_0x6695('0x2a')];if(_0x3c312e[_0x6695('0x2b')][_0x6695('0x3b')]){_0x16410f[_0x6695('0x3c')]=[{'all':!![]}];}_0x16410f=_[_0x6695('0x37')]({},_0x16410f,_0x3c312e[_0x6695('0x43')]);return db[_0x6695('0x39')]['find'](_0x16410f)[_0x6695('0x3f')](handleEntityNotFound(_0xb93330,null))[_0x6695('0x3f')](respondWithResult(_0xb93330,null))[_0x6695('0x40')](handleError(_0xb93330,null));};exports[_0x6695('0x44')]=function(_0x1154d1,_0x2c0ad3){return db[_0x6695('0x39')][_0x6695('0x44')](_0x1154d1[_0x6695('0x45')],{})[_0x6695('0x3f')](respondWithResult(_0x2c0ad3,0xc9))[_0x6695('0x40')](handleError(_0x2c0ad3,null));};exports[_0x6695('0x46')]=function(_0x4371be,_0x21148e){if(_0x4371be['body']['id']){delete _0x4371be[_0x6695('0x45')]['id'];}return db[_0x6695('0x39')][_0x6695('0x47')]({'where':{'id':_0x4371be[_0x6695('0x48')]['id']}})[_0x6695('0x3f')](handleEntityNotFound(_0x21148e,null))[_0x6695('0x3f')](saveUpdates(_0x4371be[_0x6695('0x45')],null))[_0x6695('0x3f')](respondWithResult(_0x21148e,null))[_0x6695('0x40')](handleError(_0x21148e,null));};exports[_0x6695('0x22')]=function(_0x4256df,_0x11e2fa){return db[_0x6695('0x39')][_0x6695('0x47')]({'where':{'id':_0x4256df[_0x6695('0x48')]['id']}})[_0x6695('0x3f')](handleEntityNotFound(_0x11e2fa,null))[_0x6695('0x3f')](removeEntity(_0x11e2fa,null))[_0x6695('0x40')](handleError(_0x11e2fa,null));}; \ No newline at end of file +var _0xb0f0=['map','fieldName','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','MailServerOut','count','include','findAll','catch','show','params','rawAttributes','includeAll','find','body','update','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','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','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','apply','save','then','destroy','end','error','stack','name','send','index'];(function(_0x2bfd0e,_0x47f204){var _0x8bd819=function(_0x47bcb0){while(--_0x47bcb0){_0x2bfd0e['push'](_0x2bfd0e['shift']());}};_0x8bd819(++_0x47f204);}(_0xb0f0,0x1cd));var _0x0b0f=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xb0f0[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x0b0f('0x0'));var rimraf=require(_0x0b0f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b0f('0x2'));var rp=require(_0x0b0f('0x3'));var moment=require('moment');var BPromise=require(_0x0b0f('0x4'));var Mustache=require(_0x0b0f('0x5'));var util=require(_0x0b0f('0x6'));var path=require(_0x0b0f('0x7'));var sox=require(_0x0b0f('0x8'));var csv=require(_0x0b0f('0x9'));var ejs=require(_0x0b0f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b0f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0b0f('0xc'));var deskjs=require(_0x0b0f('0xd'));var toCsv=require(_0x0b0f('0x9'));var querystring=require(_0x0b0f('0xe'));var Papa=require(_0x0b0f('0xf'));var Redis=require(_0x0b0f('0x10'));var authService=require(_0x0b0f('0x11'));var qs=require(_0x0b0f('0x12'));var as=require(_0x0b0f('0x13'));var hardwareService=require(_0x0b0f('0x14'));var logger=require('../../config/logger')(_0x0b0f('0x15'));var utils=require(_0x0b0f('0x16'));var config=require(_0x0b0f('0x17'));var licenseUtil=require(_0x0b0f('0x18'));var db=require(_0x0b0f('0x19'))['db'];function respondWithStatusCode(_0x496484,_0x31c5a1){_0x31c5a1=_0x31c5a1||0xcc;return function(_0x40b470){if(_0x40b470){return _0x496484[_0x0b0f('0x1a')](_0x31c5a1);}return _0x496484[_0x0b0f('0x1b')](_0x31c5a1)['end']();};}function respondWithResult(_0x4c473b,_0x4a2c3b){_0x4a2c3b=_0x4a2c3b||0xc8;return function(_0x211379){if(_0x211379){return _0x4c473b[_0x0b0f('0x1b')](_0x4a2c3b)[_0x0b0f('0x1c')](_0x211379);}};}function respondWithFilteredResult(_0x1dbe70,_0x469555){return function(_0x506946){if(_0x506946){var _0x1f90cc=typeof _0x469555[_0x0b0f('0x1d')]===_0x0b0f('0x1e')&&typeof _0x469555['limit']===_0x0b0f('0x1e');var _0x5215b8=_0x506946['count'];var _0x90eee0=_0x1f90cc?0x0:_0x469555[_0x0b0f('0x1d')];var _0x3b4529=_0x1f90cc?_0x506946['count']:_0x469555[_0x0b0f('0x1d')]+_0x469555[_0x0b0f('0x1f')];var _0x647657;if(_0x3b4529>=_0x5215b8){_0x3b4529=_0x5215b8;_0x647657=0xc8;}else{_0x647657=0xce;}_0x1dbe70[_0x0b0f('0x1b')](_0x647657);return _0x1dbe70[_0x0b0f('0x20')]('Content-Range',_0x90eee0+'-'+_0x3b4529+'/'+_0x5215b8)[_0x0b0f('0x1c')](_0x506946);}return null;};}function patchUpdates(_0x494e28){return function(_0x3af89c){try{jsonpatch[_0x0b0f('0x21')](_0x3af89c,_0x494e28,!![]);}catch(_0x295aee){return BPromise['reject'](_0x295aee);}return _0x3af89c[_0x0b0f('0x22')]();};}function saveUpdates(_0x11fb6c,_0x1676f4){return function(_0x17206e){if(_0x17206e){return _0x17206e['update'](_0x11fb6c)[_0x0b0f('0x23')](function(_0x50396d){return _0x50396d;});}return null;};}function removeEntity(_0x291641,_0x5d787b){return function(_0x56c0c8){if(_0x56c0c8){return _0x56c0c8[_0x0b0f('0x24')]()['then'](function(){_0x291641['status'](0xcc)[_0x0b0f('0x25')]();});}};}function handleEntityNotFound(_0xdc83bf,_0x44f018){return function(_0x4826d4){if(!_0x4826d4){_0xdc83bf[_0x0b0f('0x1a')](0x194);}return _0x4826d4;};}function handleError(_0x1503d9,_0x318c1a){_0x318c1a=_0x318c1a||0x1f4;return function(_0x196e58){logger[_0x0b0f('0x26')](_0x196e58[_0x0b0f('0x27')]);if(_0x196e58[_0x0b0f('0x28')]){delete _0x196e58[_0x0b0f('0x28')];}_0x1503d9[_0x0b0f('0x1b')](_0x318c1a)[_0x0b0f('0x29')](_0x196e58);};}exports[_0x0b0f('0x2a')]=function(_0x85e945,_0x507930){var _0xbd01bd={},_0x334a7e={},_0x5492e7={'count':0x0,'rows':[]};var _0x882271=_[_0x0b0f('0x2b')](db['MailServerOut']['rawAttributes'],function(_0x4c49f0){return{'name':_0x4c49f0[_0x0b0f('0x2c')],'type':_0x4c49f0['type']['key']};});_0x334a7e['model']=_[_0x0b0f('0x2b')](_0x882271,_0x0b0f('0x28'));_0x334a7e[_0x0b0f('0x2d')]=_[_0x0b0f('0x2e')](_0x85e945[_0x0b0f('0x2d')]);_0x334a7e[_0x0b0f('0x2f')]=_[_0x0b0f('0x30')](_0x334a7e['model'],_0x334a7e[_0x0b0f('0x2d')]);_0xbd01bd['attributes']=_[_0x0b0f('0x30')](_0x334a7e[_0x0b0f('0x31')],qs[_0x0b0f('0x32')](_0x85e945['query']['fields']));_0xbd01bd[_0x0b0f('0x33')]=_0xbd01bd[_0x0b0f('0x33')][_0x0b0f('0x34')]?_0xbd01bd[_0x0b0f('0x33')]:_0x334a7e[_0x0b0f('0x31')];if(!_0x85e945[_0x0b0f('0x2d')][_0x0b0f('0x35')](_0x0b0f('0x36'))){_0xbd01bd[_0x0b0f('0x1f')]=qs[_0x0b0f('0x1f')](_0x85e945['query'][_0x0b0f('0x1f')]);_0xbd01bd['offset']=qs['offset'](_0x85e945['query'][_0x0b0f('0x1d')]);}_0xbd01bd['order']=qs[_0x0b0f('0x37')](_0x85e945[_0x0b0f('0x2d')][_0x0b0f('0x37')]);_0xbd01bd[_0x0b0f('0x38')]=qs[_0x0b0f('0x2f')](_['pick'](_0x85e945[_0x0b0f('0x2d')],_0x334a7e[_0x0b0f('0x2f')]),_0x882271);if(_0x85e945[_0x0b0f('0x2d')][_0x0b0f('0x39')]){_0xbd01bd[_0x0b0f('0x38')]=_[_0x0b0f('0x3a')](_0xbd01bd[_0x0b0f('0x38')],{'$or':_[_0x0b0f('0x2b')](_0x882271,function(_0x451d3a){if(_0x451d3a['type']!=='VIRTUAL'){var _0x1d3451={};_0x1d3451[_0x451d3a[_0x0b0f('0x28')]]={'$like':'%'+_0x85e945[_0x0b0f('0x2d')]['filter']+'%'};return _0x1d3451;}})});}_0xbd01bd=_[_0x0b0f('0x3a')]({},_0xbd01bd,_0x85e945[_0x0b0f('0x3b')]);var _0x56f30b={'where':_0xbd01bd[_0x0b0f('0x38')]};return db[_0x0b0f('0x3c')]['count'](_0x56f30b)[_0x0b0f('0x23')](function(_0x12b520){_0x5492e7[_0x0b0f('0x3d')]=_0x12b520;if(_0x85e945[_0x0b0f('0x2d')]['includeAll']){_0xbd01bd[_0x0b0f('0x3e')]=[{'all':!![]}];}return db[_0x0b0f('0x3c')][_0x0b0f('0x3f')](_0xbd01bd);})['then'](function(_0x2d6d9a){_0x5492e7['rows']=_0x2d6d9a;return _0x5492e7;})[_0x0b0f('0x23')](respondWithFilteredResult(_0x507930,_0xbd01bd))[_0x0b0f('0x40')](handleError(_0x507930,null));};exports[_0x0b0f('0x41')]=function(_0x35fc44,_0x216af9){var _0x2ab8ae={'raw':!![],'where':{'id':_0x35fc44[_0x0b0f('0x42')]['id']}},_0x1b3be5={};_0x1b3be5[_0x0b0f('0x31')]=_[_0x0b0f('0x2e')](db[_0x0b0f('0x3c')][_0x0b0f('0x43')]);_0x1b3be5[_0x0b0f('0x2d')]=_['keys'](_0x35fc44[_0x0b0f('0x2d')]);_0x1b3be5[_0x0b0f('0x2f')]=_[_0x0b0f('0x30')](_0x1b3be5[_0x0b0f('0x31')],_0x1b3be5[_0x0b0f('0x2d')]);_0x2ab8ae[_0x0b0f('0x33')]=_[_0x0b0f('0x30')](_0x1b3be5[_0x0b0f('0x31')],qs[_0x0b0f('0x32')](_0x35fc44[_0x0b0f('0x2d')][_0x0b0f('0x32')]));_0x2ab8ae[_0x0b0f('0x33')]=_0x2ab8ae[_0x0b0f('0x33')][_0x0b0f('0x34')]?_0x2ab8ae[_0x0b0f('0x33')]:_0x1b3be5[_0x0b0f('0x31')];if(_0x35fc44['query'][_0x0b0f('0x44')]){_0x2ab8ae['include']=[{'all':!![]}];}_0x2ab8ae=_['merge']({},_0x2ab8ae,_0x35fc44[_0x0b0f('0x3b')]);return db[_0x0b0f('0x3c')][_0x0b0f('0x45')](_0x2ab8ae)[_0x0b0f('0x23')](handleEntityNotFound(_0x216af9,null))[_0x0b0f('0x23')](respondWithResult(_0x216af9,null))[_0x0b0f('0x40')](handleError(_0x216af9,null));};exports['create']=function(_0x11a3c0,_0x4082c0){return db[_0x0b0f('0x3c')]['create'](_0x11a3c0[_0x0b0f('0x46')],{})[_0x0b0f('0x23')](respondWithResult(_0x4082c0,0xc9))[_0x0b0f('0x40')](handleError(_0x4082c0,null));};exports[_0x0b0f('0x47')]=function(_0xadd740,_0x206daa){if(_0xadd740[_0x0b0f('0x46')]['id']){delete _0xadd740[_0x0b0f('0x46')]['id'];}return db['MailServerOut'][_0x0b0f('0x45')]({'where':{'id':_0xadd740['params']['id']}})[_0x0b0f('0x23')](handleEntityNotFound(_0x206daa,null))[_0x0b0f('0x23')](saveUpdates(_0xadd740[_0x0b0f('0x46')],null))[_0x0b0f('0x23')](respondWithResult(_0x206daa,null))[_0x0b0f('0x40')](handleError(_0x206daa,null));};exports[_0x0b0f('0x24')]=function(_0x1998a7,_0x35ed28){return db[_0x0b0f('0x3c')][_0x0b0f('0x45')]({'where':{'id':_0x1998a7[_0x0b0f('0x42')]['id']}})[_0x0b0f('0x23')](handleEntityNotFound(_0x35ed28,null))[_0x0b0f('0x23')](removeEntity(_0x35ed28,null))[_0x0b0f('0x40')](handleError(_0x35ed28,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index ac3d3ed..99bbe95 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 _0x3726=['./mailServerOut.attributes','exports','define','mail_servers_out','lodash','../../config/logger','api','bluebird'];(function(_0x22ee1e,_0x3eff80){var _0x49a5c9=function(_0x373480){while(--_0x373480){_0x22ee1e['push'](_0x22ee1e['shift']());}};_0x49a5c9(++_0x3eff80);}(_0x3726,0x144));var _0x6372=function(_0x3f6eb8,_0x3bba68){_0x3f6eb8=_0x3f6eb8-0x0;var _0x58bef9=_0x3726[_0x3f6eb8];return _0x58bef9;};'use strict';var _=require(_0x6372('0x0'));var util=require('util');var logger=require(_0x6372('0x1'))(_0x6372('0x2'));var moment=require('moment');var BPromise=require(_0x6372('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(_0x6372('0x4'));module[_0x6372('0x5')]=function(_0x556326,_0x2d851f){return _0x556326[_0x6372('0x6')]('MailServerOut',attributes,{'tableName':_0x6372('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc37c=['../../config/logger','api','moment','bluebird','request-promise','path','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util'];(function(_0x2a63ba,_0x2195c0){var _0x48b3a5=function(_0x5143a1){while(--_0x5143a1){_0x2a63ba['push'](_0x2a63ba['shift']());}};_0x48b3a5(++_0x2195c0);}(_0xc37c,0xc1));var _0xcc37=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0xc37c[_0x4394b6];return _0x360244;};'use strict';var _=require(_0xcc37('0x0'));var util=require(_0xcc37('0x1'));var logger=require(_0xcc37('0x2'))(_0xcc37('0x3'));var moment=require(_0xcc37('0x4'));var BPromise=require(_0xcc37('0x5'));var rp=require(_0xcc37('0x6'));var fs=require('fs');var path=require(_0xcc37('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcc37('0x8'));module[_0xcc37('0x9')]=function(_0x362dc0,_0x4f66df){return _0x362dc0[_0xcc37('0xa')](_0xcc37('0xb'),attributes,{'tableName':_0xcc37('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 5f57743..73d485d 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(_0x389fb1,_0x431673){var _0x3d3520=function(_0x2dcab7){while(--_0x2dcab7){_0x389fb1['push'](_0x389fb1['shift']());}};_0x3d3520(++_0x431673);}(_0xadb5,0xad));var _0x5adb=function(_0xe1f663,_0x1f05fd){_0xe1f663=_0xe1f663-0x0;var _0x5247fc=_0xadb5[_0xe1f663];return _0x5247fc;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file +var _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x114461,_0x4e45f9){_0x114461=_0x114461-0x0;var _0x197549=_0x7a54[_0x114461];return _0x197549;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 343c6e4..d3821b2 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 _0xef49=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','delete','exports','multer'];(function(_0x50311e,_0x213302){var _0x4592bb=function(_0x4fd142){while(--_0x4fd142){_0x50311e['push'](_0x50311e['shift']());}};_0x4592bb(++_0x213302);}(_0xef49,0x168));var _0x9ef4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xef49[_0x68c979];return _0x4f0001;};'use strict';var multer=require(_0x9ef4('0x0'));var util=require(_0x9ef4('0x1'));var path=require('path');var timeout=require(_0x9ef4('0x2'));var express=require('express');var router=express[_0x9ef4('0x3')]();var fs_extra=require(_0x9ef4('0x4'));var auth=require(_0x9ef4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9ef4('0x6'));var controller=require(_0x9ef4('0x7'));router[_0x9ef4('0x8')]('/',auth[_0x9ef4('0x9')](),controller['index']);router['get'](_0x9ef4('0xa'),auth[_0x9ef4('0x9')](),controller[_0x9ef4('0xb')]);router['get'](_0x9ef4('0xc'),auth[_0x9ef4('0x9')](),controller[_0x9ef4('0xd')]);router[_0x9ef4('0xe')]('/',auth[_0x9ef4('0x9')](),controller[_0x9ef4('0xf')]);router[_0x9ef4('0x10')](_0x9ef4('0xc'),auth[_0x9ef4('0x9')](),controller['update']);router[_0x9ef4('0x11')](_0x9ef4('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x9ef4('0x12')]=router; \ No newline at end of file +var _0x661b=['index','get','describe','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x388a5b,_0x176028){var _0x3fe853=function(_0xe10f45){while(--_0xe10f45){_0x388a5b['push'](_0x388a5b['shift']());}};_0x3fe853(++_0x176028);}(_0x661b,0xdc));var _0xb661=function(_0x44ae5c,_0x45952b){_0x44ae5c=_0x44ae5c-0x0;var _0x38977c=_0x661b[_0x44ae5c];return _0x38977c;};'use strict';var multer=require(_0xb661('0x0'));var util=require(_0xb661('0x1'));var path=require(_0xb661('0x2'));var timeout=require(_0xb661('0x3'));var express=require(_0xb661('0x4'));var router=express[_0xb661('0x5')]();var fs_extra=require(_0xb661('0x6'));var auth=require(_0xb661('0x7'));var interaction=require(_0xb661('0x8'));var config=require(_0xb661('0x9'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0xb661('0xa')](),controller[_0xb661('0xb')]);router[_0xb661('0xc')]('/describe',auth[_0xb661('0xa')](),controller[_0xb661('0xd')]);router[_0xb661('0xc')](_0xb661('0xe'),auth[_0xb661('0xa')](),controller[_0xb661('0xf')]);router[_0xb661('0x10')]('/',auth[_0xb661('0xa')](),controller[_0xb661('0x11')]);router['put'](_0xb661('0xe'),auth[_0xb661('0xa')](),controller[_0xb661('0x12')]);router[_0xb661('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xb661('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 2a22bcb..4f067a5 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 _0x6c7b=['STRING','sequelize'];(function(_0x162297,_0x343f0e){var _0x40d0e9=function(_0x21ce75){while(--_0x21ce75){_0x162297['push'](_0x162297['shift']());}};_0x40d0e9(++_0x343f0e);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x5b1a91,_0x3beea1){_0x5b1a91=_0x5b1a91-0x0;var _0x7712c5=_0x6c7b[_0x5b1a91];return _0x7712c5;};'use strict';var Sequelize=require(_0xb6c7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb6c7('0x1')]}}; \ No newline at end of file +var _0x1623=['sequelize','name','STRING'];(function(_0x1038c3,_0x576228){var _0x56ea35=function(_0x24dabd){while(--_0x24dabd){_0x1038c3['push'](_0x1038c3['shift']());}};_0x56ea35(++_0x576228);}(_0x1623,0xab));var _0x3162=function(_0x27588a,_0x5c2fbf){_0x27588a=_0x27588a-0x0;var _0x2fc421=_0x1623[_0x27588a];return _0x2fc421;};'use strict';var Sequelize=require(_0x3162('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3162('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3162('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index c2aa8ad..1ebae3a 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 _0x182e=['merge','map','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','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','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','MailSubstatus','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter'];(function(_0xde0b6,_0x67d2e0){var _0x400c8f=function(_0x575154){while(--_0x575154){_0xde0b6['push'](_0xde0b6['shift']());}};_0x400c8f(++_0x67d2e0);}(_0x182e,0x1d0));var _0xe182=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0x182e[_0x10dbf6];return _0x452147;};'use strict';var emlformat=require(_0xe182('0x0'));var rimraf=require(_0xe182('0x1'));var zipdir=require(_0xe182('0x2'));var jsonpatch=require(_0xe182('0x3'));var rp=require(_0xe182('0x4'));var moment=require('moment');var BPromise=require(_0xe182('0x5'));var Mustache=require(_0xe182('0x6'));var util=require('util');var path=require(_0xe182('0x7'));var sox=require(_0xe182('0x8'));var csv=require(_0xe182('0x9'));var ejs=require(_0xe182('0xa'));var fs=require('fs');var fs_extra=require(_0xe182('0xb'));var _=require('lodash');var squel=require(_0xe182('0xc'));var crypto=require('crypto');var jsforce=require(_0xe182('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe182('0xe'));var Redis=require(_0xe182('0xf'));var authService=require(_0xe182('0x10'));var qs=require(_0xe182('0x11'));var as=require(_0xe182('0x12'));var hardwareService=require(_0xe182('0x13'));var logger=require(_0xe182('0x14'))(_0xe182('0x15'));var utils=require(_0xe182('0x16'));var config=require(_0xe182('0x17'));var licenseUtil=require(_0xe182('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x339639,_0x1ecf73){_0x1ecf73=_0x1ecf73||0xcc;return function(_0x5ad127){if(_0x5ad127){return _0x339639[_0xe182('0x19')](_0x1ecf73);}return _0x339639['status'](_0x1ecf73)[_0xe182('0x1a')]();};}function respondWithResult(_0x2e7526,_0x71022d){_0x71022d=_0x71022d||0xc8;return function(_0x17ad2a){if(_0x17ad2a){return _0x2e7526[_0xe182('0x1b')](_0x71022d)[_0xe182('0x1c')](_0x17ad2a);}};}function respondWithFilteredResult(_0x4e5fa1,_0x19a412){return function(_0x245018){if(_0x245018){var _0x2e9df9=typeof _0x19a412[_0xe182('0x1d')]==='undefined'&&typeof _0x19a412[_0xe182('0x1e')]===_0xe182('0x1f');var _0x327476=_0x245018[_0xe182('0x20')];var _0x36165c=_0x2e9df9?0x0:_0x19a412[_0xe182('0x1d')];var _0x1971af=_0x2e9df9?_0x245018[_0xe182('0x20')]:_0x19a412['offset']+_0x19a412[_0xe182('0x1e')];var _0x408421;if(_0x1971af>=_0x327476){_0x1971af=_0x327476;_0x408421=0xc8;}else{_0x408421=0xce;}_0x4e5fa1[_0xe182('0x1b')](_0x408421);return _0x4e5fa1[_0xe182('0x21')](_0xe182('0x22'),_0x36165c+'-'+_0x1971af+'/'+_0x327476)[_0xe182('0x1c')](_0x245018);}return null;};}function patchUpdates(_0x354122){return function(_0xdca426){try{jsonpatch[_0xe182('0x23')](_0xdca426,_0x354122,!![]);}catch(_0x3b71b4){return BPromise[_0xe182('0x24')](_0x3b71b4);}return _0xdca426['save']();};}function saveUpdates(_0x407b31,_0x21bdac){return function(_0x59edf5){if(_0x59edf5){return _0x59edf5['update'](_0x407b31)[_0xe182('0x25')](function(_0x2670c6){return _0x2670c6;});}return null;};}function removeEntity(_0x225cf1,_0x3f7fe2){return function(_0x14c849){if(_0x14c849){return _0x14c849[_0xe182('0x26')]()[_0xe182('0x25')](function(){_0x225cf1[_0xe182('0x1b')](0xcc)[_0xe182('0x1a')]();});}};}function handleEntityNotFound(_0x17f1a5,_0x4d99e7){return function(_0x2e184e){if(!_0x2e184e){_0x17f1a5['sendStatus'](0x194);}return _0x2e184e;};}function handleError(_0x4bbd0a,_0x38a290){_0x38a290=_0x38a290||0x1f4;return function(_0x53b2d4){logger['error'](_0x53b2d4[_0xe182('0x27')]);if(_0x53b2d4[_0xe182('0x28')]){delete _0x53b2d4[_0xe182('0x28')];}_0x4bbd0a['status'](_0x38a290)[_0xe182('0x29')](_0x53b2d4);};}exports[_0xe182('0x2a')]=function(_0x39afd1,_0x2e9e1c){var _0x520c4d={},_0x5087b8={},_0x1461fb={'count':0x0,'rows':[]};var _0x497e83=_['map'](db[_0xe182('0x2b')]['rawAttributes'],function(_0x1dcbbc){return{'name':_0x1dcbbc[_0xe182('0x2c')],'type':_0x1dcbbc[_0xe182('0x2d')][_0xe182('0x2e')]};});_0x5087b8['model']=_['map'](_0x497e83,_0xe182('0x28'));_0x5087b8[_0xe182('0x2f')]=_[_0xe182('0x30')](_0x39afd1[_0xe182('0x2f')]);_0x5087b8[_0xe182('0x31')]=_[_0xe182('0x32')](_0x5087b8[_0xe182('0x33')],_0x5087b8['query']);_0x520c4d[_0xe182('0x34')]=_[_0xe182('0x32')](_0x5087b8[_0xe182('0x33')],qs[_0xe182('0x35')](_0x39afd1[_0xe182('0x2f')][_0xe182('0x35')]));_0x520c4d[_0xe182('0x34')]=_0x520c4d['attributes'][_0xe182('0x36')]?_0x520c4d[_0xe182('0x34')]:_0x5087b8[_0xe182('0x33')];if(!_0x39afd1['query'][_0xe182('0x37')](_0xe182('0x38'))){_0x520c4d[_0xe182('0x1e')]=qs[_0xe182('0x1e')](_0x39afd1[_0xe182('0x2f')]['limit']);_0x520c4d[_0xe182('0x1d')]=qs[_0xe182('0x1d')](_0x39afd1['query'][_0xe182('0x1d')]);}_0x520c4d[_0xe182('0x39')]=qs['sort'](_0x39afd1[_0xe182('0x2f')]['sort']);_0x520c4d[_0xe182('0x3a')]=qs[_0xe182('0x31')](_[_0xe182('0x3b')](_0x39afd1[_0xe182('0x2f')],_0x5087b8[_0xe182('0x31')]),_0x497e83);if(_0x39afd1[_0xe182('0x2f')][_0xe182('0x3c')]){_0x520c4d[_0xe182('0x3a')]=_[_0xe182('0x3d')](_0x520c4d[_0xe182('0x3a')],{'$or':_[_0xe182('0x3e')](_0x497e83,function(_0x57c4c7){if(_0x57c4c7[_0xe182('0x2d')]!==_0xe182('0x3f')){var _0xfde29a={};_0xfde29a[_0x57c4c7['name']]={'$like':'%'+_0x39afd1['query'][_0xe182('0x3c')]+'%'};return _0xfde29a;}})});}_0x520c4d=_['merge']({},_0x520c4d,_0x39afd1[_0xe182('0x40')]);var _0x59c5cb={'where':_0x520c4d[_0xe182('0x3a')]};return db[_0xe182('0x2b')][_0xe182('0x20')](_0x59c5cb)[_0xe182('0x25')](function(_0x1971dd){_0x1461fb[_0xe182('0x20')]=_0x1971dd;if(_0x39afd1[_0xe182('0x2f')]['includeAll']){_0x520c4d[_0xe182('0x41')]=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x520c4d);})['then'](function(_0x33296f){_0x1461fb[_0xe182('0x42')]=_0x33296f;return _0x1461fb;})[_0xe182('0x25')](respondWithFilteredResult(_0x2e9e1c,_0x520c4d))[_0xe182('0x43')](handleError(_0x2e9e1c,null));};exports[_0xe182('0x44')]=function(_0x475eb6,_0x49b0d1){var _0x5c29b0={'raw':!![],'where':{'id':_0x475eb6[_0xe182('0x45')]['id']}},_0x171938={};_0x171938[_0xe182('0x33')]=_[_0xe182('0x30')](db[_0xe182('0x2b')][_0xe182('0x46')]);_0x171938['query']=_[_0xe182('0x30')](_0x475eb6[_0xe182('0x2f')]);_0x171938[_0xe182('0x31')]=_[_0xe182('0x32')](_0x171938[_0xe182('0x33')],_0x171938[_0xe182('0x2f')]);_0x5c29b0[_0xe182('0x34')]=_[_0xe182('0x32')](_0x171938[_0xe182('0x33')],qs['fields'](_0x475eb6[_0xe182('0x2f')][_0xe182('0x35')]));_0x5c29b0[_0xe182('0x34')]=_0x5c29b0[_0xe182('0x34')]['length']?_0x5c29b0[_0xe182('0x34')]:_0x171938['model'];if(_0x475eb6[_0xe182('0x2f')]['includeAll']){_0x5c29b0[_0xe182('0x41')]=[{'all':!![]}];}_0x5c29b0=_[_0xe182('0x3d')]({},_0x5c29b0,_0x475eb6[_0xe182('0x40')]);return db[_0xe182('0x2b')][_0xe182('0x47')](_0x5c29b0)[_0xe182('0x25')](handleEntityNotFound(_0x49b0d1,null))[_0xe182('0x25')](respondWithResult(_0x49b0d1,null))['catch'](handleError(_0x49b0d1,null));};exports[_0xe182('0x48')]=function(_0x353239,_0x498323){return db[_0xe182('0x2b')][_0xe182('0x48')](_0x353239[_0xe182('0x49')],{})['then'](respondWithResult(_0x498323,0xc9))[_0xe182('0x43')](handleError(_0x498323,null));};exports['update']=function(_0x4db739,_0x5113df){if(_0x4db739[_0xe182('0x49')]['id']){delete _0x4db739[_0xe182('0x49')]['id'];}return db[_0xe182('0x2b')][_0xe182('0x47')]({'where':{'id':_0x4db739[_0xe182('0x45')]['id']}})[_0xe182('0x25')](handleEntityNotFound(_0x5113df,null))[_0xe182('0x25')](saveUpdates(_0x4db739[_0xe182('0x49')],null))['then'](respondWithResult(_0x5113df,null))[_0xe182('0x43')](handleError(_0x5113df,null));};exports[_0xe182('0x26')]=function(_0x133062,_0x1b06ac){return db[_0xe182('0x2b')]['find']({'where':{'id':_0x133062[_0xe182('0x45')]['id']}})['then'](handleEntityNotFound(_0x1b06ac,null))[_0xe182('0x25')](removeEntity(_0x1b06ac,null))['catch'](handleError(_0x1b06ac,null));};exports[_0xe182('0x4a')]=function(_0x17b6de,_0x1b1fef){return db[_0xe182('0x2b')][_0xe182('0x4a')]()['then'](respondWithResult(_0x1b1fef,null))['catch'](handleError(_0x1b1fef,null));}; \ No newline at end of file +var _0x1fd9=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1fd9,0xdb));var _0x91fd=function(_0x502b94,_0x391940){_0x502b94=_0x502b94-0x0;var _0x3f4b50=_0x1fd9[_0x502b94];return _0x3f4b50;};'use strict';var emlformat=require(_0x91fd('0x0'));var rimraf=require(_0x91fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x91fd('0x2'));var rp=require(_0x91fd('0x3'));var moment=require(_0x91fd('0x4'));var BPromise=require(_0x91fd('0x5'));var Mustache=require(_0x91fd('0x6'));var util=require('util');var path=require(_0x91fd('0x7'));var sox=require(_0x91fd('0x8'));var csv=require('to-csv');var ejs=require(_0x91fd('0x9'));var fs=require('fs');var fs_extra=require(_0x91fd('0xa'));var _=require(_0x91fd('0xb'));var squel=require(_0x91fd('0xc'));var crypto=require(_0x91fd('0xd'));var jsforce=require(_0x91fd('0xe'));var deskjs=require(_0x91fd('0xf'));var toCsv=require(_0x91fd('0x10'));var querystring=require(_0x91fd('0x11'));var Papa=require(_0x91fd('0x12'));var Redis=require(_0x91fd('0x13'));var authService=require(_0x91fd('0x14'));var qs=require(_0x91fd('0x15'));var as=require(_0x91fd('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x91fd('0x17'));var utils=require('../../config/utils');var config=require(_0x91fd('0x18'));var licenseUtil=require(_0x91fd('0x19'));var db=require(_0x91fd('0x1a'))['db'];function respondWithStatusCode(_0x129a0f,_0x4ca20e){_0x4ca20e=_0x4ca20e||0xcc;return function(_0x261436){if(_0x261436){return _0x129a0f[_0x91fd('0x1b')](_0x4ca20e);}return _0x129a0f[_0x91fd('0x1c')](_0x4ca20e)[_0x91fd('0x1d')]();};}function respondWithResult(_0x493e8c,_0x2e39fc){_0x2e39fc=_0x2e39fc||0xc8;return function(_0x2b964c){if(_0x2b964c){return _0x493e8c[_0x91fd('0x1c')](_0x2e39fc)['json'](_0x2b964c);}};}function respondWithFilteredResult(_0x46ec06,_0x2595e8){return function(_0x1ea02d){if(_0x1ea02d){var _0x1e923e=typeof _0x2595e8['offset']===_0x91fd('0x1e')&&typeof _0x2595e8[_0x91fd('0x1f')]===_0x91fd('0x1e');var _0x3451a7=_0x1ea02d[_0x91fd('0x20')];var _0x9a00a4=_0x1e923e?0x0:_0x2595e8[_0x91fd('0x21')];var _0x1e1b95=_0x1e923e?_0x1ea02d[_0x91fd('0x20')]:_0x2595e8[_0x91fd('0x21')]+_0x2595e8[_0x91fd('0x1f')];var _0x2609c4;if(_0x1e1b95>=_0x3451a7){_0x1e1b95=_0x3451a7;_0x2609c4=0xc8;}else{_0x2609c4=0xce;}_0x46ec06[_0x91fd('0x1c')](_0x2609c4);return _0x46ec06[_0x91fd('0x22')]('Content-Range',_0x9a00a4+'-'+_0x1e1b95+'/'+_0x3451a7)['json'](_0x1ea02d);}return null;};}function patchUpdates(_0x227d5b){return function(_0x2eb1b3){try{jsonpatch[_0x91fd('0x23')](_0x2eb1b3,_0x227d5b,!![]);}catch(_0xf750c){return BPromise[_0x91fd('0x24')](_0xf750c);}return _0x2eb1b3[_0x91fd('0x25')]();};}function saveUpdates(_0x22263f,_0x2eb39e){return function(_0x564da2){if(_0x564da2){return _0x564da2[_0x91fd('0x26')](_0x22263f)[_0x91fd('0x27')](function(_0x40fa5e){return _0x40fa5e;});}return null;};}function removeEntity(_0x4771f9,_0x319dbc){return function(_0x1b5613){if(_0x1b5613){return _0x1b5613[_0x91fd('0x28')]()[_0x91fd('0x27')](function(){_0x4771f9['status'](0xcc)[_0x91fd('0x1d')]();});}};}function handleEntityNotFound(_0x1706ee,_0x2f264f){return function(_0x44a01d){if(!_0x44a01d){_0x1706ee[_0x91fd('0x1b')](0x194);}return _0x44a01d;};}function handleError(_0x31047f,_0x22a40e){_0x22a40e=_0x22a40e||0x1f4;return function(_0x162f15){logger[_0x91fd('0x29')](_0x162f15[_0x91fd('0x2a')]);if(_0x162f15[_0x91fd('0x2b')]){delete _0x162f15['name'];}_0x31047f[_0x91fd('0x1c')](_0x22a40e)[_0x91fd('0x2c')](_0x162f15);};}exports[_0x91fd('0x2d')]=function(_0x2aa759,_0x5b31bd){var _0x16198d={},_0x2ce196={},_0x56e23a={'count':0x0,'rows':[]};var _0x530b26=_[_0x91fd('0x2e')](db[_0x91fd('0x2f')]['rawAttributes'],function(_0x31c389){return{'name':_0x31c389['fieldName'],'type':_0x31c389[_0x91fd('0x30')][_0x91fd('0x31')]};});_0x2ce196[_0x91fd('0x32')]=_[_0x91fd('0x2e')](_0x530b26,_0x91fd('0x2b'));_0x2ce196[_0x91fd('0x33')]=_['keys'](_0x2aa759[_0x91fd('0x33')]);_0x2ce196[_0x91fd('0x34')]=_[_0x91fd('0x35')](_0x2ce196[_0x91fd('0x32')],_0x2ce196[_0x91fd('0x33')]);_0x16198d[_0x91fd('0x36')]=_[_0x91fd('0x35')](_0x2ce196[_0x91fd('0x32')],qs[_0x91fd('0x37')](_0x2aa759[_0x91fd('0x33')][_0x91fd('0x37')]));_0x16198d['attributes']=_0x16198d[_0x91fd('0x36')][_0x91fd('0x38')]?_0x16198d[_0x91fd('0x36')]:_0x2ce196[_0x91fd('0x32')];if(!_0x2aa759[_0x91fd('0x33')][_0x91fd('0x39')](_0x91fd('0x3a'))){_0x16198d[_0x91fd('0x1f')]=qs[_0x91fd('0x1f')](_0x2aa759[_0x91fd('0x33')]['limit']);_0x16198d[_0x91fd('0x21')]=qs[_0x91fd('0x21')](_0x2aa759[_0x91fd('0x33')][_0x91fd('0x21')]);}_0x16198d[_0x91fd('0x3b')]=qs[_0x91fd('0x3c')](_0x2aa759['query'][_0x91fd('0x3c')]);_0x16198d['where']=qs['filters'](_[_0x91fd('0x3d')](_0x2aa759[_0x91fd('0x33')],_0x2ce196[_0x91fd('0x34')]),_0x530b26);if(_0x2aa759[_0x91fd('0x33')][_0x91fd('0x3e')]){_0x16198d[_0x91fd('0x3f')]=_[_0x91fd('0x40')](_0x16198d[_0x91fd('0x3f')],{'$or':_[_0x91fd('0x2e')](_0x530b26,function(_0x329fdb){if(_0x329fdb[_0x91fd('0x30')]!==_0x91fd('0x41')){var _0xd2f11d={};_0xd2f11d[_0x329fdb[_0x91fd('0x2b')]]={'$like':'%'+_0x2aa759[_0x91fd('0x33')]['filter']+'%'};return _0xd2f11d;}})});}_0x16198d=_['merge']({},_0x16198d,_0x2aa759[_0x91fd('0x42')]);var _0x5a4aac={'where':_0x16198d[_0x91fd('0x3f')]};return db[_0x91fd('0x2f')][_0x91fd('0x20')](_0x5a4aac)[_0x91fd('0x27')](function(_0x4555d9){_0x56e23a['count']=_0x4555d9;if(_0x2aa759[_0x91fd('0x33')][_0x91fd('0x43')]){_0x16198d[_0x91fd('0x44')]=[{'all':!![]}];}return db['MailSubstatus'][_0x91fd('0x45')](_0x16198d);})['then'](function(_0x49d896){_0x56e23a['rows']=_0x49d896;return _0x56e23a;})['then'](respondWithFilteredResult(_0x5b31bd,_0x16198d))[_0x91fd('0x46')](handleError(_0x5b31bd,null));};exports[_0x91fd('0x47')]=function(_0x424027,_0x1af9e0){var _0x2bebb0={'raw':!![],'where':{'id':_0x424027[_0x91fd('0x48')]['id']}},_0x36b55a={};_0x36b55a[_0x91fd('0x32')]=_[_0x91fd('0x49')](db[_0x91fd('0x2f')][_0x91fd('0x4a')]);_0x36b55a[_0x91fd('0x33')]=_[_0x91fd('0x49')](_0x424027[_0x91fd('0x33')]);_0x36b55a[_0x91fd('0x34')]=_['intersection'](_0x36b55a[_0x91fd('0x32')],_0x36b55a[_0x91fd('0x33')]);_0x2bebb0[_0x91fd('0x36')]=_['intersection'](_0x36b55a['model'],qs[_0x91fd('0x37')](_0x424027[_0x91fd('0x33')][_0x91fd('0x37')]));_0x2bebb0[_0x91fd('0x36')]=_0x2bebb0[_0x91fd('0x36')]['length']?_0x2bebb0[_0x91fd('0x36')]:_0x36b55a[_0x91fd('0x32')];if(_0x424027[_0x91fd('0x33')][_0x91fd('0x43')]){_0x2bebb0[_0x91fd('0x44')]=[{'all':!![]}];}_0x2bebb0=_[_0x91fd('0x40')]({},_0x2bebb0,_0x424027[_0x91fd('0x42')]);return db[_0x91fd('0x2f')][_0x91fd('0x4b')](_0x2bebb0)[_0x91fd('0x27')](handleEntityNotFound(_0x1af9e0,null))[_0x91fd('0x27')](respondWithResult(_0x1af9e0,null))[_0x91fd('0x46')](handleError(_0x1af9e0,null));};exports[_0x91fd('0x4c')]=function(_0x7ea92f,_0x158d99){return db[_0x91fd('0x2f')][_0x91fd('0x4c')](_0x7ea92f[_0x91fd('0x4d')],{})[_0x91fd('0x27')](respondWithResult(_0x158d99,0xc9))[_0x91fd('0x46')](handleError(_0x158d99,null));};exports['update']=function(_0x19b877,_0x5d90c0){if(_0x19b877[_0x91fd('0x4d')]['id']){delete _0x19b877[_0x91fd('0x4d')]['id'];}return db[_0x91fd('0x2f')][_0x91fd('0x4b')]({'where':{'id':_0x19b877[_0x91fd('0x48')]['id']}})[_0x91fd('0x27')](handleEntityNotFound(_0x5d90c0,null))[_0x91fd('0x27')](saveUpdates(_0x19b877[_0x91fd('0x4d')],null))['then'](respondWithResult(_0x5d90c0,null))[_0x91fd('0x46')](handleError(_0x5d90c0,null));};exports['destroy']=function(_0xd8a9bb,_0x21c2f5){return db['MailSubstatus'][_0x91fd('0x4b')]({'where':{'id':_0xd8a9bb[_0x91fd('0x48')]['id']}})[_0x91fd('0x27')](handleEntityNotFound(_0x21c2f5,null))[_0x91fd('0x27')](removeEntity(_0x21c2f5,null))[_0x91fd('0x46')](handleError(_0x21c2f5,null));};exports[_0x91fd('0x4e')]=function(_0x501fbe,_0x356d91){return db[_0x91fd('0x2f')][_0x91fd('0x4e')]()[_0x91fd('0x27')](respondWithResult(_0x356d91,null))[_0x91fd('0x46')](handleError(_0x356d91,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index fc6a8af..e3534db 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0eba=['emit','exports','events','MailSubstatus','update'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x0eba,0x1dd));var _0xa0eb=function(_0x4b0547,_0x5aeed3){_0x4b0547=_0x4b0547-0x0;var _0xfa5c4=_0x0eba[_0x4b0547];return _0xfa5c4;};'use strict';var EventEmitter=require(_0xa0eb('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0xa0eb('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0xa0eb('0x2')};function emitEvent(_0x41bb72){return function(_0x288308,_0xe4a825,_0x436251){MailSubstatusEvents[_0xa0eb('0x3')](_0x41bb72+':'+_0x288308['id'],_0x288308);MailSubstatusEvents[_0xa0eb('0x3')](_0x41bb72,_0x288308);_0x436251(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0xa0eb('0x4')]=MailSubstatusEvents; \ No newline at end of file +var _0x9e8b=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','MailSubstatus','setMaxListeners'];(function(_0xd39959,_0x302d09){var _0x1ff69c=function(_0x17c97f){while(--_0x17c97f){_0xd39959['push'](_0xd39959['shift']());}};_0x1ff69c(++_0x302d09);}(_0x9e8b,0x6d));var _0xb9e8=function(_0x53c739,_0x34dd56){_0x53c739=_0x53c739-0x0;var _0x1cf22e=_0x9e8b[_0x53c739];return _0x1cf22e;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0xb9e8('0x0'))['db'][_0xb9e8('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xb9e8('0x2')](0x0);var events={'afterUpdate':_0xb9e8('0x3')};function emitEvent(_0x471756){return function(_0x4ac774,_0x58da46,_0x5ee617){MailSubstatusEvents[_0xb9e8('0x4')](_0x471756+':'+_0x4ac774['id'],_0x4ac774);MailSubstatusEvents[_0xb9e8('0x4')](_0x471756,_0x4ac774);_0x5ee617(null);};}for(var e in events){if(events[_0xb9e8('0x5')](e)){var event=events[e];MailSubstatus[_0xb9e8('0x6')](e,emitEvent(event));}}module[_0xb9e8('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index da29bf9..0a1d10b 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 _0x0b94=['mail_substatuses','Condition','mailSubstatus','_previousDataValues','name','then','catch','./mailSubstatus.attributes','exports','models','define','MailSubstatus'];(function(_0x332c7f,_0x2ddc1e){var _0x40b733=function(_0x1cb8d6){while(--_0x1cb8d6){_0x332c7f['push'](_0x332c7f['shift']());}};_0x40b733(++_0x2ddc1e);}(_0x0b94,0x193));var _0x40b9=function(_0x459016,_0xb15fe8){_0x459016=_0x459016-0x0;var _0xa7965c=_0x0b94[_0x459016];return _0xa7965c;};'use strict';var attributes=require(_0x40b9('0x0'));module[_0x40b9('0x1')]=function(_0x22cecb){var _0x4ca5fc=_0x22cecb[_0x40b9('0x2')];return _0x22cecb[_0x40b9('0x3')](_0x40b9('0x4'),attributes,{'tableName':_0x40b9('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5b017b,_0xe5ffdd,_0xdb330a){return _0x4ca5fc[_0x40b9('0x6')]['update']({'value':_0x5b017b['name']},{'where':{'field':_0x40b9('0x7'),'value':_0x5b017b[_0x40b9('0x8')][_0x40b9('0x9')]}})[_0x40b9('0xa')](function(){_0xdb330a();})[_0x40b9('0xb')](function(_0x28f69c){_0xdb330a(_0x28f69c);});}}});}; \ No newline at end of file +var _0xf086=['Condition','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','MailSubstatus','mail_substatuses'];(function(_0x549366,_0x27ab70){var _0x72a1cd=function(_0x538175){while(--_0x538175){_0x549366['push'](_0x549366['shift']());}};_0x72a1cd(++_0x27ab70);}(_0xf086,0x84));var _0x6f08=function(_0x556b16,_0x51f863){_0x556b16=_0x556b16-0x0;var _0x3f2a44=_0xf086[_0x556b16];return _0x3f2a44;};'use strict';var attributes=require(_0x6f08('0x0'));module['exports']=function(_0x382f48){var _0x12cbb4=_0x382f48['models'];return _0x382f48['define'](_0x6f08('0x1'),attributes,{'tableName':_0x6f08('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x17f02d,_0x256d0e,_0x9f5e48){return _0x12cbb4[_0x6f08('0x3')]['update']({'value':_0x17f02d[_0x6f08('0x4')]},{'where':{'field':_0x6f08('0x5'),'value':_0x17f02d[_0x6f08('0x6')][_0x6f08('0x4')]}})[_0x6f08('0x7')](function(){_0x9f5e48();})[_0x6f08('0x8')](function(_0x2a67d9){_0x9f5e48(_0x2a67d9);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 0df876d..fab75bc 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 _0xb889=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x45a4e0,_0x345f4d){var _0x43f49d=function(_0x564c57){while(--_0x564c57){_0x45a4e0['push'](_0x45a4e0['shift']());}};_0x43f49d(++_0x345f4d);}(_0xb889,0x16f));var _0x9b88=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xb889[_0x45bf86];return _0x1f02b7;};'use strict';var _=require(_0x9b88('0x0'));var util=require(_0x9b88('0x1'));var moment=require(_0x9b88('0x2'));var BPromise=require(_0x9b88('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b88('0x4'));var db=require(_0x9b88('0x5'))['db'];var utils=require(_0x9b88('0x6'));var logger=require(_0x9b88('0x7'))(_0x9b88('0x8'));var config=require(_0x9b88('0x9'));var jayson=require(_0x9b88('0xa'));var client=jayson[_0x9b88('0xb')][_0x9b88('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2b1323,_0x53956e,_0x356d21){return new BPromise(function(_0x23b6f0,_0x143302){return client[_0x9b88('0xd')](_0x2b1323,_0x356d21)[_0x9b88('0xe')](function(_0x5c4fc4){logger[_0x9b88('0xf')](_0x9b88('0x10'),_0x53956e,_0x9b88('0x11'));logger[_0x9b88('0x12')](_0x9b88('0x13'),_0x53956e,_0x9b88('0x11'),JSON[_0x9b88('0x14')](_0x5c4fc4));if(_0x5c4fc4[_0x9b88('0x15')]){if(_0x5c4fc4[_0x9b88('0x15')][_0x9b88('0x16')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x53956e,_0x5c4fc4[_0x9b88('0x15')]['message']);return _0x143302(_0x5c4fc4['error'][_0x9b88('0x17')]);}logger[_0x9b88('0x15')](_0x9b88('0x10'),_0x53956e,_0x5c4fc4['error'][_0x9b88('0x17')]);return _0x23b6f0(_0x5c4fc4['error'][_0x9b88('0x17')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x53956e,'request\x20sent');_0x23b6f0(_0x5c4fc4[_0x9b88('0x18')][_0x9b88('0x17')]);}})[_0x9b88('0x19')](function(_0x2d9556){logger[_0x9b88('0x15')](_0x9b88('0x10'),_0x53956e,_0x2d9556);_0x143302(_0x2d9556);});});} \ No newline at end of file +var _0xa9b1=['stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug'];(function(_0xda540d,_0x6102ee){var _0x488543=function(_0x146370){while(--_0x146370){_0xda540d['push'](_0xda540d['shift']());}};_0x488543(++_0x6102ee);}(_0xa9b1,0x1bf));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1a9b('0x0'));var util=require(_0x1a9b('0x1'));var moment=require(_0x1a9b('0x2'));var BPromise=require(_0x1a9b('0x3'));var rs=require(_0x1a9b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a9b('0x5'))['db'];var utils=require(_0x1a9b('0x6'));var logger=require(_0x1a9b('0x7'))('rpc');var config=require(_0x1a9b('0x8'));var jayson=require(_0x1a9b('0x9'));var client=jayson['client'][_0x1a9b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2672c5,_0x428739,_0x604841){return new BPromise(function(_0x8900d1,_0x21ce03){return client[_0x1a9b('0xb')](_0x2672c5,_0x604841)[_0x1a9b('0xc')](function(_0x5a75b2){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x428739,_0x1a9b('0xd'));logger[_0x1a9b('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x428739,_0x1a9b('0xd'),JSON[_0x1a9b('0xf')](_0x5a75b2));if(_0x5a75b2[_0x1a9b('0x10')]){if(_0x5a75b2[_0x1a9b('0x10')][_0x1a9b('0x11')]===0x1f4){logger[_0x1a9b('0x10')](_0x1a9b('0x12'),_0x428739,_0x5a75b2[_0x1a9b('0x10')][_0x1a9b('0x13')]);return _0x21ce03(_0x5a75b2['error']['message']);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x428739,_0x5a75b2[_0x1a9b('0x10')][_0x1a9b('0x13')]);return _0x8900d1(_0x5a75b2[_0x1a9b('0x10')][_0x1a9b('0x13')]);}else{logger[_0x1a9b('0x14')](_0x1a9b('0x12'),_0x428739,_0x1a9b('0xd'));_0x8900d1(_0x5a75b2[_0x1a9b('0x15')]['message']);}})['catch'](function(_0x287543){logger[_0x1a9b('0x10')](_0x1a9b('0x12'),_0x428739,_0x287543);_0x21ce03(_0x287543);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 28e1eff..1aed61f 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 _0xae1c=['./mailTransferReport.controller','index','get','/:id','isAuthenticated','create','update','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x40d2e4,_0x510171){var _0x8b84d1=function(_0x577bed){while(--_0x577bed){_0x40d2e4['push'](_0x40d2e4['shift']());}};_0x8b84d1(++_0x510171);}(_0xae1c,0xd9));var _0xcae1=function(_0x3c6837,_0x2312fb){_0x3c6837=_0x3c6837-0x0;var _0x5c187c=_0xae1c[_0x3c6837];return _0x5c187c;};'use strict';var multer=require(_0xcae1('0x0'));var util=require(_0xcae1('0x1'));var path=require('path');var timeout=require(_0xcae1('0x2'));var express=require(_0xcae1('0x3'));var router=express[_0xcae1('0x4')]();var fs_extra=require(_0xcae1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcae1('0x6'));var controller=require(_0xcae1('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xcae1('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xcae1('0x9')](_0xcae1('0xa'),auth[_0xcae1('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xcae1('0xc')]);router['put'](_0xcae1('0xa'),auth[_0xcae1('0xb')](),controller[_0xcae1('0xd')]);router['delete']('/:id',auth[_0xcae1('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9f5e=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x1c557c,_0x2cff90){var _0xc9ba94=function(_0x24c488){while(--_0x24c488){_0x1c557c['push'](_0x1c557c['shift']());}};_0xc9ba94(++_0x2cff90);}(_0x9f5e,0x7a));var _0xe9f5=function(_0x4a34ab,_0x5b648e){_0x4a34ab=_0x4a34ab-0x0;var _0x12c395=_0x9f5e[_0x4a34ab];return _0x12c395;};'use strict';var multer=require(_0xe9f5('0x0'));var util=require(_0xe9f5('0x1'));var path=require(_0xe9f5('0x2'));var timeout=require(_0xe9f5('0x3'));var express=require(_0xe9f5('0x4'));var router=express[_0xe9f5('0x5')]();var fs_extra=require(_0xe9f5('0x6'));var auth=require(_0xe9f5('0x7'));var interaction=require(_0xe9f5('0x8'));var config=require(_0xe9f5('0x9'));var controller=require(_0xe9f5('0xa'));router[_0xe9f5('0xb')]('/',auth['isAuthenticated'](),controller[_0xe9f5('0xc')]);router[_0xe9f5('0xb')](_0xe9f5('0xd'),auth[_0xe9f5('0xe')](),controller['describe']);router[_0xe9f5('0xb')](_0xe9f5('0xf'),auth['isAuthenticated'](),controller[_0xe9f5('0x10')]);router[_0xe9f5('0x11')]('/',auth['isAuthenticated'](),controller[_0xe9f5('0x12')]);router[_0xe9f5('0x13')](_0xe9f5('0xf'),auth[_0xe9f5('0xe')](),controller[_0xe9f5('0x14')]);router[_0xe9f5('0x15')]('/:id',auth[_0xe9f5('0xe')](),controller[_0xe9f5('0x16')]);module[_0xe9f5('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index d2119bb..bed9fc6 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x394dd1,_0x4e7c44){var _0x59eab2=function(_0x4dd218){while(--_0x4dd218){_0x394dd1['push'](_0x394dd1['shift']());}};_0x59eab2(++_0x4e7c44);}(_0x00bb,0x1d8));var _0xb00b=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x00bb[_0x29b609];return _0x54c952;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x14363e,_0x4f0e0d){var _0x17c56d=function(_0x1c7bac){while(--_0x1c7bac){_0x14363e['push'](_0x14363e['shift']());}};_0x17c56d(++_0x4f0e0d);}(_0xb43b,0x1b2));var _0xbb43=function(_0x80d668,_0x36feb7){_0x80d668=_0x80d668-0x0;var _0x2e2e3a=_0xb43b[_0x80d668];return _0x2e2e3a;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 5c9b850..fb5e91f 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 _0x77cf=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','findAll','rows','catch','params','includeAll','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','update','then','name','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x3102af,_0x8694d4){var _0x414bc1=function(_0x11d772){while(--_0x11d772){_0x3102af['push'](_0x3102af['shift']());}};_0x414bc1(++_0x8694d4);}(_0x77cf,0x1d3));var _0xf77c=function(_0x4e04dc,_0x169b32){_0x4e04dc=_0x4e04dc-0x0;var _0x538361=_0x77cf[_0x4e04dc];return _0x538361;};'use strict';var emlformat=require(_0xf77c('0x0'));var rimraf=require(_0xf77c('0x1'));var zipdir=require(_0xf77c('0x2'));var jsonpatch=require(_0xf77c('0x3'));var rp=require(_0xf77c('0x4'));var moment=require(_0xf77c('0x5'));var BPromise=require(_0xf77c('0x6'));var Mustache=require(_0xf77c('0x7'));var util=require(_0xf77c('0x8'));var path=require(_0xf77c('0x9'));var sox=require(_0xf77c('0xa'));var csv=require('to-csv');var ejs=require(_0xf77c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf77c('0xc'));var squel=require(_0xf77c('0xd'));var crypto=require(_0xf77c('0xe'));var jsforce=require(_0xf77c('0xf'));var deskjs=require(_0xf77c('0x10'));var toCsv=require(_0xf77c('0x11'));var querystring=require('querystring');var Papa=require(_0xf77c('0x12'));var Redis=require(_0xf77c('0x13'));var authService=require(_0xf77c('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf77c('0x15'));var logger=require('../../config/logger')(_0xf77c('0x16'));var utils=require(_0xf77c('0x17'));var config=require(_0xf77c('0x18'));var licenseUtil=require(_0xf77c('0x19'));var db=require(_0xf77c('0x1a'))['db'];function respondWithStatusCode(_0xc42db5,_0x24b645){_0x24b645=_0x24b645||0xcc;return function(_0x3da2f8){if(_0x3da2f8){return _0xc42db5[_0xf77c('0x1b')](_0x24b645);}return _0xc42db5[_0xf77c('0x1c')](_0x24b645)['end']();};}function respondWithResult(_0x9b22c4,_0xc2adef){_0xc2adef=_0xc2adef||0xc8;return function(_0x2e99cb){if(_0x2e99cb){return _0x9b22c4[_0xf77c('0x1c')](_0xc2adef)['json'](_0x2e99cb);}};}function respondWithFilteredResult(_0x4449d9,_0x3bf72b){return function(_0x11e70e){if(_0x11e70e){var _0x42cc7d=typeof _0x3bf72b['offset']===_0xf77c('0x1d')&&typeof _0x3bf72b[_0xf77c('0x1e')]===_0xf77c('0x1d');var _0x3ada30=_0x11e70e[_0xf77c('0x1f')];var _0x28efd8=_0x42cc7d?0x0:_0x3bf72b[_0xf77c('0x20')];var _0x2d315f=_0x42cc7d?_0x11e70e['count']:_0x3bf72b['offset']+_0x3bf72b[_0xf77c('0x1e')];var _0x42f853;if(_0x2d315f>=_0x3ada30){_0x2d315f=_0x3ada30;_0x42f853=0xc8;}else{_0x42f853=0xce;}_0x4449d9[_0xf77c('0x1c')](_0x42f853);return _0x4449d9['set'](_0xf77c('0x21'),_0x28efd8+'-'+_0x2d315f+'/'+_0x3ada30)[_0xf77c('0x22')](_0x11e70e);}return null;};}function patchUpdates(_0x56a0f6){return function(_0x4c5c2d){try{jsonpatch[_0xf77c('0x23')](_0x4c5c2d,_0x56a0f6,!![]);}catch(_0x157f3b){return BPromise[_0xf77c('0x24')](_0x157f3b);}return _0x4c5c2d['save']();};}function saveUpdates(_0x52b506,_0x5512ce){return function(_0x1565d8){if(_0x1565d8){return _0x1565d8[_0xf77c('0x25')](_0x52b506)['then'](function(_0x1a5833){return _0x1a5833;});}return null;};}function removeEntity(_0x46fab1,_0x355949){return function(_0x48a1ad){if(_0x48a1ad){return _0x48a1ad['destroy']()[_0xf77c('0x26')](function(){_0x46fab1[_0xf77c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43c6f2,_0x242d56){return function(_0xa99593){if(!_0xa99593){_0x43c6f2[_0xf77c('0x1b')](0x194);}return _0xa99593;};}function handleError(_0xa16afb,_0x505afc){_0x505afc=_0x505afc||0x1f4;return function(_0x11a273){logger['error'](_0x11a273['stack']);if(_0x11a273['name']){delete _0x11a273[_0xf77c('0x27')];}_0xa16afb[_0xf77c('0x1c')](_0x505afc)['send'](_0x11a273);};}exports[_0xf77c('0x28')]=function(_0x26d71b,_0x18480c){var _0x2857a0={},_0x30ed82={},_0x14afc8={'count':0x0,'rows':[]};var _0x6ca134=_[_0xf77c('0x29')](db[_0xf77c('0x2a')][_0xf77c('0x2b')],function(_0x5bcef4){return{'name':_0x5bcef4[_0xf77c('0x2c')],'type':_0x5bcef4[_0xf77c('0x2d')][_0xf77c('0x2e')]};});_0x30ed82[_0xf77c('0x2f')]=_['map'](_0x6ca134,_0xf77c('0x27'));_0x30ed82[_0xf77c('0x30')]=_[_0xf77c('0x31')](_0x26d71b[_0xf77c('0x30')]);_0x30ed82[_0xf77c('0x32')]=_[_0xf77c('0x33')](_0x30ed82[_0xf77c('0x2f')],_0x30ed82[_0xf77c('0x30')]);_0x2857a0['attributes']=_[_0xf77c('0x33')](_0x30ed82[_0xf77c('0x2f')],qs[_0xf77c('0x34')](_0x26d71b[_0xf77c('0x30')][_0xf77c('0x34')]));_0x2857a0[_0xf77c('0x35')]=_0x2857a0['attributes'][_0xf77c('0x36')]?_0x2857a0[_0xf77c('0x35')]:_0x30ed82[_0xf77c('0x2f')];if(!_0x26d71b['query'][_0xf77c('0x37')](_0xf77c('0x38'))){_0x2857a0[_0xf77c('0x1e')]=qs[_0xf77c('0x1e')](_0x26d71b['query'][_0xf77c('0x1e')]);_0x2857a0[_0xf77c('0x20')]=qs[_0xf77c('0x20')](_0x26d71b[_0xf77c('0x30')]['offset']);}_0x2857a0[_0xf77c('0x39')]=qs['sort'](_0x26d71b[_0xf77c('0x30')][_0xf77c('0x3a')]);_0x2857a0[_0xf77c('0x3b')]=qs['filters'](_['pick'](_0x26d71b['query'],_0x30ed82[_0xf77c('0x32')]),_0x6ca134);if(_0x26d71b['query'][_0xf77c('0x3c')]){_0x2857a0['where']=_[_0xf77c('0x3d')](_0x2857a0['where'],{'$or':_['map'](_0x6ca134,function(_0x5cc2f1){if(_0x5cc2f1[_0xf77c('0x2d')]!==_0xf77c('0x3e')){var _0x4d76a6={};_0x4d76a6[_0x5cc2f1[_0xf77c('0x27')]]={'$like':'%'+_0x26d71b[_0xf77c('0x30')][_0xf77c('0x3c')]+'%'};return _0x4d76a6;}})});}_0x2857a0=_['merge']({},_0x2857a0,_0x26d71b['options']);var _0x5d14fe={'where':_0x2857a0[_0xf77c('0x3b')]};return db[_0xf77c('0x2a')][_0xf77c('0x1f')](_0x5d14fe)[_0xf77c('0x26')](function(_0xe8e3df){_0x14afc8[_0xf77c('0x1f')]=_0xe8e3df;if(_0x26d71b[_0xf77c('0x30')]['includeAll']){_0x2857a0['include']=[{'all':!![]}];}return db[_0xf77c('0x2a')][_0xf77c('0x3f')](_0x2857a0);})[_0xf77c('0x26')](function(_0x3bf510){_0x14afc8[_0xf77c('0x40')]=_0x3bf510;return _0x14afc8;})[_0xf77c('0x26')](respondWithFilteredResult(_0x18480c,_0x2857a0))[_0xf77c('0x41')](handleError(_0x18480c,null));};exports['show']=function(_0x581b5f,_0x36450e){var _0x269ca3={'raw':!![],'where':{'id':_0x581b5f[_0xf77c('0x42')]['id']}},_0x38413f={};_0x38413f[_0xf77c('0x2f')]=_[_0xf77c('0x31')](db[_0xf77c('0x2a')]['rawAttributes']);_0x38413f['query']=_[_0xf77c('0x31')](_0x581b5f[_0xf77c('0x30')]);_0x38413f[_0xf77c('0x32')]=_[_0xf77c('0x33')](_0x38413f['model'],_0x38413f['query']);_0x269ca3[_0xf77c('0x35')]=_[_0xf77c('0x33')](_0x38413f[_0xf77c('0x2f')],qs[_0xf77c('0x34')](_0x581b5f[_0xf77c('0x30')][_0xf77c('0x34')]));_0x269ca3[_0xf77c('0x35')]=_0x269ca3['attributes'][_0xf77c('0x36')]?_0x269ca3[_0xf77c('0x35')]:_0x38413f['model'];if(_0x581b5f[_0xf77c('0x30')][_0xf77c('0x43')]){_0x269ca3[_0xf77c('0x44')]=[{'all':!![]}];}_0x269ca3=_[_0xf77c('0x3d')]({},_0x269ca3,_0x581b5f[_0xf77c('0x45')]);return db[_0xf77c('0x2a')][_0xf77c('0x46')](_0x269ca3)[_0xf77c('0x26')](handleEntityNotFound(_0x36450e,null))[_0xf77c('0x26')](respondWithResult(_0x36450e,null))[_0xf77c('0x41')](handleError(_0x36450e,null));};exports['create']=function(_0x195841,_0x5090ad){return db['MailTransferReport'][_0xf77c('0x47')](_0x195841['body'],{})[_0xf77c('0x26')](respondWithResult(_0x5090ad,0xc9))[_0xf77c('0x41')](handleError(_0x5090ad,null));};exports[_0xf77c('0x25')]=function(_0x1cbd5a,_0x52e0b8){if(_0x1cbd5a[_0xf77c('0x48')]['id']){delete _0x1cbd5a[_0xf77c('0x48')]['id'];}return db[_0xf77c('0x2a')][_0xf77c('0x46')]({'where':{'id':_0x1cbd5a['params']['id']}})[_0xf77c('0x26')](handleEntityNotFound(_0x52e0b8,null))['then'](saveUpdates(_0x1cbd5a[_0xf77c('0x48')],null))[_0xf77c('0x26')](respondWithResult(_0x52e0b8,null))[_0xf77c('0x41')](handleError(_0x52e0b8,null));};exports['destroy']=function(_0x3a6084,_0x5604c1){return db[_0xf77c('0x2a')]['find']({'where':{'id':_0x3a6084[_0xf77c('0x42')]['id']}})[_0xf77c('0x26')](handleEntityNotFound(_0x5604c1,null))[_0xf77c('0x26')](removeEntity(_0x5604c1,null))[_0xf77c('0x41')](handleError(_0x5604c1,null));};exports[_0xf77c('0x49')]=function(_0x1a7a03,_0x20a1dc){return db[_0xf77c('0x2a')][_0xf77c('0x49')]()['then'](respondWithResult(_0x20a1dc,null))[_0xf77c('0x41')](handleError(_0x20a1dc,null));}; \ No newline at end of file +var _0x7391=['filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','rows','show','params','model','find','create','body','catch','destroy','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','querystring','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','limit','undefined','count','offset','status','set','Content-Range','json','apply','reject','save','update','then','error','name','index','map','MailTransferReport','rawAttributes','fieldName','type','key','keys'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7391,0x196));var _0x1739=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0x7391[_0x28a5ad];return _0x176b8a;};'use strict';var emlformat=require(_0x1739('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1739('0x1'));var jsonpatch=require(_0x1739('0x2'));var rp=require(_0x1739('0x3'));var moment=require(_0x1739('0x4'));var BPromise=require(_0x1739('0x5'));var Mustache=require(_0x1739('0x6'));var util=require(_0x1739('0x7'));var path=require(_0x1739('0x8'));var sox=require(_0x1739('0x9'));var csv=require(_0x1739('0xa'));var ejs=require(_0x1739('0xb'));var fs=require('fs');var fs_extra=require(_0x1739('0xc'));var _=require(_0x1739('0xd'));var squel=require(_0x1739('0xe'));var crypto=require(_0x1739('0xf'));var jsforce=require(_0x1739('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x1739('0xa'));var querystring=require(_0x1739('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1739('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1739('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1739('0x14'));var utils=require(_0x1739('0x15'));var config=require(_0x1739('0x16'));var licenseUtil=require(_0x1739('0x17'));var db=require(_0x1739('0x18'))['db'];function respondWithStatusCode(_0x2e3884,_0x427eea){_0x427eea=_0x427eea||0xcc;return function(_0x55026f){if(_0x55026f){return _0x2e3884[_0x1739('0x19')](_0x427eea);}return _0x2e3884['status'](_0x427eea)[_0x1739('0x1a')]();};}function respondWithResult(_0x1a8c35,_0x1671c7){_0x1671c7=_0x1671c7||0xc8;return function(_0x285b07){if(_0x285b07){return _0x1a8c35['status'](_0x1671c7)['json'](_0x285b07);}};}function respondWithFilteredResult(_0x2bcc12,_0x50d958){return function(_0x1c2b7e){if(_0x1c2b7e){var _0x59f871=typeof _0x50d958['offset']==='undefined'&&typeof _0x50d958[_0x1739('0x1b')]===_0x1739('0x1c');var _0x4136be=_0x1c2b7e[_0x1739('0x1d')];var _0x58e8d9=_0x59f871?0x0:_0x50d958[_0x1739('0x1e')];var _0x3a977d=_0x59f871?_0x1c2b7e[_0x1739('0x1d')]:_0x50d958[_0x1739('0x1e')]+_0x50d958[_0x1739('0x1b')];var _0xeb77c3;if(_0x3a977d>=_0x4136be){_0x3a977d=_0x4136be;_0xeb77c3=0xc8;}else{_0xeb77c3=0xce;}_0x2bcc12[_0x1739('0x1f')](_0xeb77c3);return _0x2bcc12[_0x1739('0x20')](_0x1739('0x21'),_0x58e8d9+'-'+_0x3a977d+'/'+_0x4136be)[_0x1739('0x22')](_0x1c2b7e);}return null;};}function patchUpdates(_0x5ddd29){return function(_0x16d4cd){try{jsonpatch[_0x1739('0x23')](_0x16d4cd,_0x5ddd29,!![]);}catch(_0x27d465){return BPromise[_0x1739('0x24')](_0x27d465);}return _0x16d4cd[_0x1739('0x25')]();};}function saveUpdates(_0x2a1863,_0xc2c12c){return function(_0x3d2d64){if(_0x3d2d64){return _0x3d2d64[_0x1739('0x26')](_0x2a1863)['then'](function(_0x2090db){return _0x2090db;});}return null;};}function removeEntity(_0x21ee9e,_0x4a9f65){return function(_0x276777){if(_0x276777){return _0x276777['destroy']()[_0x1739('0x27')](function(){_0x21ee9e[_0x1739('0x1f')](0xcc)[_0x1739('0x1a')]();});}};}function handleEntityNotFound(_0x35ed86,_0x262d25){return function(_0x23e510){if(!_0x23e510){_0x35ed86[_0x1739('0x19')](0x194);}return _0x23e510;};}function handleError(_0x394a47,_0x2f891f){_0x2f891f=_0x2f891f||0x1f4;return function(_0x4b8f33){logger[_0x1739('0x28')](_0x4b8f33['stack']);if(_0x4b8f33[_0x1739('0x29')]){delete _0x4b8f33[_0x1739('0x29')];}_0x394a47[_0x1739('0x1f')](_0x2f891f)['send'](_0x4b8f33);};}exports[_0x1739('0x2a')]=function(_0x53f093,_0x416c7d){var _0x2f9cc1={},_0x20361c={},_0x5d99ac={'count':0x0,'rows':[]};var _0x41e186=_[_0x1739('0x2b')](db[_0x1739('0x2c')][_0x1739('0x2d')],function(_0x362efa){return{'name':_0x362efa[_0x1739('0x2e')],'type':_0x362efa[_0x1739('0x2f')][_0x1739('0x30')]};});_0x20361c['model']=_[_0x1739('0x2b')](_0x41e186,_0x1739('0x29'));_0x20361c['query']=_[_0x1739('0x31')](_0x53f093['query']);_0x20361c[_0x1739('0x32')]=_[_0x1739('0x33')](_0x20361c['model'],_0x20361c[_0x1739('0x34')]);_0x2f9cc1[_0x1739('0x35')]=_[_0x1739('0x33')](_0x20361c['model'],qs[_0x1739('0x36')](_0x53f093[_0x1739('0x34')]['fields']));_0x2f9cc1[_0x1739('0x35')]=_0x2f9cc1[_0x1739('0x35')][_0x1739('0x37')]?_0x2f9cc1[_0x1739('0x35')]:_0x20361c['model'];if(!_0x53f093[_0x1739('0x34')][_0x1739('0x38')](_0x1739('0x39'))){_0x2f9cc1[_0x1739('0x1b')]=qs['limit'](_0x53f093[_0x1739('0x34')]['limit']);_0x2f9cc1[_0x1739('0x1e')]=qs[_0x1739('0x1e')](_0x53f093[_0x1739('0x34')][_0x1739('0x1e')]);}_0x2f9cc1[_0x1739('0x3a')]=qs[_0x1739('0x3b')](_0x53f093[_0x1739('0x34')]['sort']);_0x2f9cc1[_0x1739('0x3c')]=qs[_0x1739('0x32')](_['pick'](_0x53f093[_0x1739('0x34')],_0x20361c['filters']),_0x41e186);if(_0x53f093[_0x1739('0x34')][_0x1739('0x3d')]){_0x2f9cc1[_0x1739('0x3c')]=_[_0x1739('0x3e')](_0x2f9cc1[_0x1739('0x3c')],{'$or':_[_0x1739('0x2b')](_0x41e186,function(_0x28038f){if(_0x28038f[_0x1739('0x2f')]!==_0x1739('0x3f')){var _0x3f2ee0={};_0x3f2ee0[_0x28038f[_0x1739('0x29')]]={'$like':'%'+_0x53f093[_0x1739('0x34')][_0x1739('0x3d')]+'%'};return _0x3f2ee0;}})});}_0x2f9cc1=_[_0x1739('0x3e')]({},_0x2f9cc1,_0x53f093[_0x1739('0x40')]);var _0x3d1d34={'where':_0x2f9cc1[_0x1739('0x3c')]};return db['MailTransferReport']['count'](_0x3d1d34)[_0x1739('0x27')](function(_0x421e15){_0x5d99ac[_0x1739('0x1d')]=_0x421e15;if(_0x53f093[_0x1739('0x34')]['includeAll']){_0x2f9cc1[_0x1739('0x41')]=[{'all':!![]}];}return db[_0x1739('0x2c')]['findAll'](_0x2f9cc1);})[_0x1739('0x27')](function(_0xa1b702){_0x5d99ac[_0x1739('0x42')]=_0xa1b702;return _0x5d99ac;})[_0x1739('0x27')](respondWithFilteredResult(_0x416c7d,_0x2f9cc1))['catch'](handleError(_0x416c7d,null));};exports[_0x1739('0x43')]=function(_0x4d281b,_0x104764){var _0x203b97={'raw':!![],'where':{'id':_0x4d281b[_0x1739('0x44')]['id']}},_0x16218f={};_0x16218f[_0x1739('0x45')]=_[_0x1739('0x31')](db[_0x1739('0x2c')][_0x1739('0x2d')]);_0x16218f[_0x1739('0x34')]=_[_0x1739('0x31')](_0x4d281b[_0x1739('0x34')]);_0x16218f['filters']=_['intersection'](_0x16218f[_0x1739('0x45')],_0x16218f[_0x1739('0x34')]);_0x203b97[_0x1739('0x35')]=_[_0x1739('0x33')](_0x16218f['model'],qs[_0x1739('0x36')](_0x4d281b[_0x1739('0x34')][_0x1739('0x36')]));_0x203b97['attributes']=_0x203b97[_0x1739('0x35')][_0x1739('0x37')]?_0x203b97[_0x1739('0x35')]:_0x16218f[_0x1739('0x45')];if(_0x4d281b[_0x1739('0x34')]['includeAll']){_0x203b97[_0x1739('0x41')]=[{'all':!![]}];}_0x203b97=_[_0x1739('0x3e')]({},_0x203b97,_0x4d281b['options']);return db[_0x1739('0x2c')][_0x1739('0x46')](_0x203b97)[_0x1739('0x27')](handleEntityNotFound(_0x104764,null))[_0x1739('0x27')](respondWithResult(_0x104764,null))['catch'](handleError(_0x104764,null));};exports[_0x1739('0x47')]=function(_0x3df8dd,_0x1d03ef){return db[_0x1739('0x2c')]['create'](_0x3df8dd[_0x1739('0x48')],{})[_0x1739('0x27')](respondWithResult(_0x1d03ef,0xc9))[_0x1739('0x49')](handleError(_0x1d03ef,null));};exports[_0x1739('0x26')]=function(_0x11a6c0,_0x353536){if(_0x11a6c0[_0x1739('0x48')]['id']){delete _0x11a6c0[_0x1739('0x48')]['id'];}return db[_0x1739('0x2c')][_0x1739('0x46')]({'where':{'id':_0x11a6c0['params']['id']}})[_0x1739('0x27')](handleEntityNotFound(_0x353536,null))[_0x1739('0x27')](saveUpdates(_0x11a6c0[_0x1739('0x48')],null))[_0x1739('0x27')](respondWithResult(_0x353536,null))['catch'](handleError(_0x353536,null));};exports[_0x1739('0x4a')]=function(_0x51b19c,_0x807d16){return db['MailTransferReport'][_0x1739('0x46')]({'where':{'id':_0x51b19c[_0x1739('0x44')]['id']}})['then'](handleEntityNotFound(_0x807d16,null))[_0x1739('0x27')](removeEntity(_0x807d16,null))[_0x1739('0x49')](handleError(_0x807d16,null));};exports[_0x1739('0x4b')]=function(_0x49d4ae,_0x138a8b){return db['MailTransferReport'][_0x1739('0x4b')]()[_0x1739('0x27')](respondWithResult(_0x138a8b,null))['catch'](handleError(_0x138a8b,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index efdc343..19bf3bc 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 _0x25b0=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util'];(function(_0x557f5f,_0x31d8e7){var _0x196eba=function(_0x433d89){while(--_0x433d89){_0x557f5f['push'](_0x557f5f['shift']());}};_0x196eba(++_0x31d8e7);}(_0x25b0,0x140));var _0x025b=function(_0x1d211b,_0x475f3b){_0x1d211b=_0x1d211b-0x0;var _0x47c88b=_0x25b0[_0x1d211b];return _0x47c88b;};'use strict';var _=require(_0x025b('0x0'));var util=require(_0x025b('0x1'));var logger=require(_0x025b('0x2'))(_0x025b('0x3'));var moment=require(_0x025b('0x4'));var BPromise=require(_0x025b('0x5'));var rp=require(_0x025b('0x6'));var fs=require('fs');var path=require(_0x025b('0x7'));var rimraf=require(_0x025b('0x8'));var config=require(_0x025b('0x9'));var attributes=require('./mailTransferReport.attributes');module[_0x025b('0xa')]=function(_0x41b88b,_0x41d8a4){return _0x41b88b['define'](_0x025b('0xb'),attributes,{'tableName':_0x025b('0xc'),'paranoid':![],'indexes':[{'name':_0x025b('0xd'),'fields':[_0x025b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xab33=['../../config/environment','define','uniqueid','util','../../config/logger','moment','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab33,0x1a3));var _0x3ab3=function(_0x46970a,_0x577a1b){_0x46970a=_0x46970a-0x0;var _0x4a54b4=_0xab33[_0x46970a];return _0x4a54b4;};'use strict';var _=require('lodash');var util=require(_0x3ab3('0x0'));var logger=require(_0x3ab3('0x1'))('api');var moment=require(_0x3ab3('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ab3('0x3'));var rimraf=require(_0x3ab3('0x4'));var config=require(_0x3ab3('0x5'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x1495c2,_0x543906){return _0x1495c2[_0x3ab3('0x6')]('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x3ab3('0x7'),'fields':[_0x3ab3('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index bfbd095..52d8e72 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 _0xaf23=['client','http','then','info','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x542d06,_0x226827){var _0x2c11fa=function(_0x5d0305){while(--_0x5d0305){_0x542d06['push'](_0x542d06['shift']());}};_0x2c11fa(++_0x226827);}(_0xaf23,0x109));var _0x3af2=function(_0x3a33ff,_0x431390){_0x3a33ff=_0x3a33ff-0x0;var _0x214ba7=_0xaf23[_0x3a33ff];return _0x214ba7;};'use strict';var _=require(_0x3af2('0x0'));var util=require('util');var moment=require(_0x3af2('0x1'));var BPromise=require(_0x3af2('0x2'));var rs=require(_0x3af2('0x3'));var fs=require('fs');var Redis=require(_0x3af2('0x4'));var db=require(_0x3af2('0x5'))['db'];var utils=require(_0x3af2('0x6'));var logger=require(_0x3af2('0x7'))(_0x3af2('0x8'));var config=require(_0x3af2('0x9'));var jayson=require(_0x3af2('0xa'));var client=jayson[_0x3af2('0xb')][_0x3af2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x916d75,_0x55cb07,_0x5768eb){return new BPromise(function(_0x43118f,_0x191f84){return client['request'](_0x916d75,_0x5768eb)[_0x3af2('0xd')](function(_0x28e0a5){logger[_0x3af2('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x55cb07,_0x3af2('0xf'));logger['debug'](_0x3af2('0x10'),_0x55cb07,'request\x20sent',JSON[_0x3af2('0x11')](_0x28e0a5));if(_0x28e0a5[_0x3af2('0x12')]){if(_0x28e0a5[_0x3af2('0x12')]['code']===0x1f4){logger[_0x3af2('0x12')](_0x3af2('0x13'),_0x55cb07,_0x28e0a5['error']['message']);return _0x191f84(_0x28e0a5[_0x3af2('0x12')][_0x3af2('0x14')]);}logger['error'](_0x3af2('0x13'),_0x55cb07,_0x28e0a5['error']['message']);return _0x43118f(_0x28e0a5[_0x3af2('0x12')][_0x3af2('0x14')]);}else{logger['info'](_0x3af2('0x13'),_0x55cb07,'request\x20sent');_0x43118f(_0x28e0a5[_0x3af2('0x15')][_0x3af2('0x14')]);}})[_0x3af2('0x16')](function(_0x1d897a){logger[_0x3af2('0x12')](_0x3af2('0x13'),_0x55cb07,_0x1d897a);_0x191f84(_0x1d897a);});});} \ No newline at end of file +var _0x3559=['code','MailTransferReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','request\x20sent','error'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0x3559,0xdc));var _0x9355=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3559[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x9355('0x0'));var util=require(_0x9355('0x1'));var moment=require(_0x9355('0x2'));var BPromise=require(_0x9355('0x3'));var rs=require(_0x9355('0x4'));var fs=require('fs');var Redis=require(_0x9355('0x5'));var db=require(_0x9355('0x6'))['db'];var utils=require(_0x9355('0x7'));var logger=require(_0x9355('0x8'))(_0x9355('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9355('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x215ed0,_0x58ca2f,_0x13af93){return new BPromise(function(_0x9ae102,_0x55b080){return client['request'](_0x215ed0,_0x13af93)['then'](function(_0x5818e2){logger[_0x9355('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x58ca2f,_0x9355('0xc'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x58ca2f,'request\x20sent',JSON['stringify'](_0x5818e2));if(_0x5818e2[_0x9355('0xd')]){if(_0x5818e2['error'][_0x9355('0xe')]===0x1f4){logger[_0x9355('0xd')](_0x9355('0xf'),_0x58ca2f,_0x5818e2[_0x9355('0xd')][_0x9355('0x10')]);return _0x55b080(_0x5818e2[_0x9355('0xd')]['message']);}logger[_0x9355('0xd')](_0x9355('0xf'),_0x58ca2f,_0x5818e2[_0x9355('0xd')]['message']);return _0x9ae102(_0x5818e2[_0x9355('0xd')][_0x9355('0x10')]);}else{logger[_0x9355('0xb')](_0x9355('0xf'),_0x58ca2f,_0x9355('0xc'));_0x9ae102(_0x5818e2['result']['message']);}})[_0x9355('0x11')](function(_0x2420d9){logger[_0x9355('0xd')](_0x9355('0xf'),_0x58ca2f,_0x2420d9);_0x55b080(_0x2420d9);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index a8e1433..d8077d3 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 _0xae6f=['../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x3d17f5,_0x248c4e){var _0x3a2dbf=function(_0x3d5928){while(--_0x3d5928){_0x3d17f5['push'](_0x3d17f5['shift']());}};_0x3a2dbf(++_0x248c4e);}(_0xae6f,0x13d));var _0xfae6=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xae6f[_0x49b207];return _0x2dc8fa;};'use strict';var multer=require(_0xfae6('0x0'));var util=require('util');var path=require(_0xfae6('0x1'));var timeout=require(_0xfae6('0x2'));var express=require(_0xfae6('0x3'));var router=express[_0xfae6('0x4')]();var fs_extra=require(_0xfae6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfae6('0x6'));var config=require(_0xfae6('0x7'));var controller=require(_0xfae6('0x8'));router[_0xfae6('0x9')]('/',auth[_0xfae6('0xa')](),controller[_0xfae6('0xb')]);router['get'](_0xfae6('0xc'),auth[_0xfae6('0xa')](),controller[_0xfae6('0xd')]);router[_0xfae6('0x9')](_0xfae6('0xe'),auth[_0xfae6('0xa')](),controller[_0xfae6('0xf')]);router[_0xfae6('0x10')]('/',auth[_0xfae6('0xa')](),controller['create']);router[_0xfae6('0x11')](_0xfae6('0xe'),auth[_0xfae6('0xa')](),controller['update']);router[_0xfae6('0x12')](_0xfae6('0xe'),auth[_0xfae6('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa2e2=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','destroy','exports','multer','path'];(function(_0x364593,_0x5945e6){var _0x94f358=function(_0x4b0e35){while(--_0x4b0e35){_0x364593['push'](_0x364593['shift']());}};_0x94f358(++_0x5945e6);}(_0xa2e2,0x1ec));var _0x2a2e=function(_0xafceaf,_0x5c65ad){_0xafceaf=_0xafceaf-0x0;var _0x3684e4=_0xa2e2[_0xafceaf];return _0x3684e4;};'use strict';var multer=require(_0x2a2e('0x0'));var util=require('util');var path=require(_0x2a2e('0x1'));var timeout=require(_0x2a2e('0x2'));var express=require('express');var router=express[_0x2a2e('0x3')]();var fs_extra=require(_0x2a2e('0x4'));var auth=require(_0x2a2e('0x5'));var interaction=require(_0x2a2e('0x6'));var config=require(_0x2a2e('0x7'));var controller=require('./memberReport.controller');router[_0x2a2e('0x8')]('/',auth[_0x2a2e('0x9')](),controller['index']);router[_0x2a2e('0x8')](_0x2a2e('0xa'),auth[_0x2a2e('0x9')](),controller[_0x2a2e('0xb')]);router[_0x2a2e('0x8')](_0x2a2e('0xc'),auth['isAuthenticated'](),controller[_0x2a2e('0xd')]);router['post']('/',auth[_0x2a2e('0x9')](),controller[_0x2a2e('0xe')]);router[_0x2a2e('0xf')](_0x2a2e('0xc'),auth[_0x2a2e('0x9')](),controller[_0x2a2e('0x10')]);router['delete'](_0x2a2e('0xc'),auth[_0x2a2e('0x9')](),controller[_0x2a2e('0x11')]);module[_0x2a2e('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index ef54a87..9bb73ca 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 _0x3242=['enterAt','diff','seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue'];(function(_0x39c293,_0x3c5a37){var _0x2101c9=function(_0x12d45a){while(--_0x12d45a){_0x39c293['push'](_0x39c293['shift']());}};_0x2101c9(++_0x3c5a37);}(_0x3242,0x185));var _0x2324=function(_0x2744ad,_0x3aa49d){_0x2744ad=_0x2744ad-0x0;var _0x3a0f8c=_0x3242[_0x2744ad];return _0x3a0f8c;};'use strict';var Sequelize=require(_0x2324('0x0'));var moment=require(_0x2324('0x1'));module['exports']={'channel':{'type':Sequelize[_0x2324('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x2324('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x2324('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x2324('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x2324('0x5')],'set':function(_0x479057){var _0x596ba2=moment(_0x479057);var _0x1733f7=moment(this[_0x2324('0x6')](_0x2324('0x7')));var _0x1a8646=_0x596ba2[_0x2324('0x8')](_0x1733f7,_0x2324('0x9'));this['setDataValue'](_0x2324('0xa'),_0x479057);this[_0x2324('0xb')](_0x2324('0xc'),_0x1a8646>=0x0?_0x1a8646:null);}},'data1':{'type':Sequelize[_0x2324('0x2')],'comment':_0x2324('0xd')},'data2':{'type':Sequelize[_0x2324('0x2')],'comment':_0x2324('0xe')},'data3':{'type':Sequelize[_0x2324('0x2')],'comment':_0x2324('0xf')},'data4':{'type':Sequelize['STRING'],'comment':_0x2324('0x10')},'data5':{'type':Sequelize['STRING'],'comment':_0x2324('0x11')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x2324('0x2')]}}; \ No newline at end of file +var _0xb085=['talk:[queue]','INTEGER','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]'];(function(_0x2d136e,_0x4e0d01){var _0x34fac5=function(_0x31d9fa){while(--_0x31d9fa){_0x2d136e['push'](_0x2d136e['shift']());}};_0x34fac5(++_0x4e0d01);}(_0xb085,0x145));var _0x5b08=function(_0x3cfb91,_0x592c86){_0x3cfb91=_0x3cfb91-0x0;var _0x4366ce=_0xb085[_0x3cfb91];return _0x4366ce;};'use strict';var Sequelize=require(_0x5b08('0x0'));var moment=require('moment');module[_0x5b08('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x5b08('0x2')]},'interface':{'type':Sequelize[_0x5b08('0x2')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0x5b08('0x3'),'comment':_0x5b08('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x5b08('0x5')]},'exitAt':{'type':Sequelize[_0x5b08('0x5')],'set':function(_0x1f661){var _0x5676e7=moment(_0x1f661);var _0xe771df=moment(this[_0x5b08('0x6')](_0x5b08('0x7')));var _0x30dc09=_0x5676e7[_0x5b08('0x8')](_0xe771df,'seconds');this[_0x5b08('0x9')](_0x5b08('0xa'),_0x1f661);this[_0x5b08('0x9')](_0x5b08('0xb'),_0x30dc09>=0x0?_0x30dc09:null);}},'data1':{'type':Sequelize[_0x5b08('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0x5b08('0xc')},'data3':{'type':Sequelize['STRING'],'comment':_0x5b08('0xd')},'data4':{'type':Sequelize[_0x5b08('0x2')],'comment':_0x5b08('0xe')},'data5':{'type':Sequelize[_0x5b08('0x2')],'comment':_0x5b08('0xf')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x5b08('0x10')]},'uniqueid':{'type':Sequelize[_0x5b08('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index fec72f7..3a8f0f2 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','MemberReport','fieldName','type','model','name','keys'];(function(_0x29cce5,_0x3966e8){var _0x50a8da=function(_0x52f326){while(--_0x52f326){_0x29cce5['push'](_0x29cce5['shift']());}};_0x50a8da(++_0x3966e8);}(_0x7217,0x19e));var _0x7721=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x7217[_0x5b78e8];return _0xf2c321;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x2f')](_0x5c54f0,_0x7721('0x34'));_0xd7d703['query']=_[_0x7721('0x35')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x37')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],_0xd7d703['query']);_0x37b9f0[_0x7721('0x39')]=_[_0x7721('0x38')](_0xd7d703[_0x7721('0x33')],qs['fields'](_0x158d98[_0x7721('0x36')][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')]['length']?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3b')](_0x7721('0x3c'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0['order']=qs[_0x7721('0x3d')](_0x158d98[_0x7721('0x36')][_0x7721('0x3d')]);_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x37')](_[_0x7721('0x3f')](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98['query']['filter']){_0x37b9f0[_0x7721('0x3e')]=_[_0x7721('0x40')](_0x37b9f0[_0x7721('0x3e')],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4a90ce){if(_0x4a90ce[_0x7721('0x32')]!=='VIRTUAL'){var _0xfab37b={};_0xfab37b[_0x4a90ce[_0x7721('0x34')]]={'$like':'%'+_0x158d98['query'][_0x7721('0x41')]+'%'};return _0xfab37b;}})});}_0x37b9f0=_[_0x7721('0x40')]({},_0x37b9f0,_0x158d98['options']);var _0x4d0111={'where':_0x37b9f0[_0x7721('0x3e')]};return db[_0x7721('0x30')][_0x7721('0x22')](_0x4d0111)[_0x7721('0x29')](function(_0x577af9){_0x1da2d8[_0x7721('0x22')]=_0x577af9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x42')]){_0x37b9f0[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a2c28){_0x1da2d8[_0x7721('0x44')]=_0x4a2c28;return _0x1da2d8;})['then'](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x45')](handleError(_0x1ea4d,null));};exports[_0x7721('0x46')]=function(_0x231dad,_0x49e0c5){var _0x1453d4={'raw':!![],'where':{'id':_0x231dad[_0x7721('0x47')]['id']}},_0x11d853={};_0x11d853['model']=_[_0x7721('0x35')](db[_0x7721('0x30')][_0x7721('0x48')]);_0x11d853[_0x7721('0x36')]=_[_0x7721('0x35')](_0x231dad[_0x7721('0x36')]);_0x11d853[_0x7721('0x37')]=_['intersection'](_0x11d853['model'],_0x11d853[_0x7721('0x36')]);_0x1453d4[_0x7721('0x39')]=_[_0x7721('0x38')](_0x11d853[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x231dad[_0x7721('0x36')][_0x7721('0x3a')]));_0x1453d4[_0x7721('0x39')]=_0x1453d4[_0x7721('0x39')][_0x7721('0x49')]?_0x1453d4['attributes']:_0x11d853['model'];if(_0x231dad[_0x7721('0x36')][_0x7721('0x42')]){_0x1453d4[_0x7721('0x43')]=[{'all':!![]}];}_0x1453d4=_[_0x7721('0x40')]({},_0x1453d4,_0x231dad['options']);return db[_0x7721('0x30')][_0x7721('0x4a')](_0x1453d4)['then'](handleEntityNotFound(_0x49e0c5,null))[_0x7721('0x29')](respondWithResult(_0x49e0c5,null))['catch'](handleError(_0x49e0c5,null));};exports[_0x7721('0x4b')]=function(_0x5c6922,_0x334f23){return db[_0x7721('0x30')][_0x7721('0x4b')](_0x5c6922['body'],{})[_0x7721('0x29')](respondWithResult(_0x334f23,0xc9))[_0x7721('0x45')](handleError(_0x334f23,null));};exports['update']=function(_0x223d93,_0x1196c2){if(_0x223d93[_0x7721('0x4c')]['id']){delete _0x223d93['body']['id'];}return db[_0x7721('0x30')]['find']({'where':{'id':_0x223d93[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x1196c2,null))[_0x7721('0x29')](saveUpdates(_0x223d93[_0x7721('0x4c')],null))[_0x7721('0x29')](respondWithResult(_0x1196c2,null))[_0x7721('0x45')](handleError(_0x1196c2,null));};exports[_0x7721('0x2a')]=function(_0x7fbb73,_0x694d2f){return db[_0x7721('0x30')][_0x7721('0x4a')]({'where':{'id':_0x7fbb73[_0x7721('0x47')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x694d2f,null))[_0x7721('0x29')](removeEntity(_0x694d2f,null))[_0x7721('0x45')](handleError(_0x694d2f,null));};exports['describe']=function(_0x474f32,_0x2f6f30){return db[_0x7721('0x30')][_0x7721('0x4d')]()[_0x7721('0x29')](respondWithResult(_0x2f6f30,null))[_0x7721('0x45')](handleError(_0x2f6f30,null));}; \ No newline at end of file +var _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(_0x8ca080,_0x54c826){var _0x47c8c7=function(_0x75f500){while(--_0x75f500){_0x8ca080['push'](_0x8ca080['shift']());}};_0x47c8c7(++_0x54c826);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'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 diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 77c45ab..2fca732 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 _0x7eef=['request-promise','../../config/environment','./memberReport.attributes','exports','MemberReport','report_member','membername_interface','membername','interface','util','../../config/logger','api','moment','bluebird'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7eef,0x87));var _0xf7ee=function(_0x32f6b9,_0x2d4aa9){_0x32f6b9=_0x32f6b9-0x0;var _0x267d52=_0x7eef[_0x32f6b9];return _0x267d52;};'use strict';var _=require('lodash');var util=require(_0xf7ee('0x0'));var logger=require(_0xf7ee('0x1'))(_0xf7ee('0x2'));var moment=require(_0xf7ee('0x3'));var BPromise=require(_0xf7ee('0x4'));var rp=require(_0xf7ee('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf7ee('0x6'));var attributes=require(_0xf7ee('0x7'));module[_0xf7ee('0x8')]=function(_0x4f0b23,_0x320d93){return _0x4f0b23['define'](_0xf7ee('0x9'),attributes,{'tableName':_0xf7ee('0xa'),'paranoid':![],'indexes':[{'name':_0xf7ee('0xb'),'fields':[_0xf7ee('0xc'),_0xf7ee('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3a67=['rimraf','./memberReport.attributes','exports','define','MemberReport','report_member','membername','interface','lodash','util','moment','request-promise'];(function(_0x1c7bcd,_0x478875){var _0x554320=function(_0x1acb8d){while(--_0x1acb8d){_0x1c7bcd['push'](_0x1c7bcd['shift']());}};_0x554320(++_0x478875);}(_0x3a67,0x11c));var _0x73a6=function(_0x3fb61c,_0x1cee9a){_0x3fb61c=_0x3fb61c-0x0;var _0x4894d7=_0x3a67[_0x3fb61c];return _0x4894d7;};'use strict';var _=require(_0x73a6('0x0'));var util=require(_0x73a6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x73a6('0x2'));var BPromise=require('bluebird');var rp=require(_0x73a6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73a6('0x4'));var config=require('../../config/environment');var attributes=require(_0x73a6('0x5'));module[_0x73a6('0x6')]=function(_0x11ee9e,_0x181b2d){return _0x11ee9e[_0x73a6('0x7')](_0x73a6('0x8'),attributes,{'tableName':_0x73a6('0x9'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x73a6('0xa'),_0x73a6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 9f70ea9..986c2d8 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 _0x0b3d=['result','GetMemberReport','MemberReport','options','raw','where','attributes','limit','map','include','model','then','CreateMemberReport','create','body','catch','UpdateMemberReport','update','debug','lodash','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','MemberReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x0b3d,0x76));var _0xd0b3=function(_0x2c534a,_0x18a19e){_0x2c534a=_0x2c534a-0x0;var _0x3f5c99=_0x0b3d[_0x2c534a];return _0x3f5c99;};'use strict';var _=require(_0xd0b3('0x0'));var util=require('util');var moment=require(_0xd0b3('0x1'));var BPromise=require('bluebird');var rs=require(_0xd0b3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0b3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0b3('0x4'))('rpc');var config=require(_0xd0b3('0x5'));var jayson=require(_0xd0b3('0x6'));var client=jayson['client'][_0xd0b3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5bc883,_0x872957,_0x5f3196){return new BPromise(function(_0x5ab5b2,_0x2f79f7){return client['request'](_0x5bc883,_0x5f3196)['then'](function(_0x7b8b92){logger['info'](_0xd0b3('0x8'),_0x872957,_0xd0b3('0x9'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x872957,_0xd0b3('0x9'),JSON[_0xd0b3('0xa')](_0x7b8b92));if(_0x7b8b92[_0xd0b3('0xb')]){if(_0x7b8b92[_0xd0b3('0xb')]['code']===0x1f4){logger['error'](_0xd0b3('0x8'),_0x872957,_0x7b8b92[_0xd0b3('0xb')][_0xd0b3('0xc')]);return _0x2f79f7(_0x7b8b92[_0xd0b3('0xb')][_0xd0b3('0xc')]);}logger[_0xd0b3('0xb')](_0xd0b3('0x8'),_0x872957,_0x7b8b92['error'][_0xd0b3('0xc')]);return _0x5ab5b2(_0x7b8b92[_0xd0b3('0xb')][_0xd0b3('0xc')]);}else{logger[_0xd0b3('0xd')]('MemberReport,\x20%s,\x20%s',_0x872957,_0xd0b3('0x9'));_0x5ab5b2(_0x7b8b92[_0xd0b3('0xe')][_0xd0b3('0xc')]);}})['catch'](function(_0x537e76){logger[_0xd0b3('0xb')]('MemberReport,\x20%s,\x20%s',_0x872957,_0x537e76);_0x2f79f7(_0x537e76);});});}exports[_0xd0b3('0xf')]=function(_0x232e6a){var _0x5045b4=this;return new Promise(function(_0x4ed917,_0x3fc7be){return db[_0xd0b3('0x10')]['findAll']({'raw':_0x232e6a[_0xd0b3('0x11')]?_0x232e6a[_0xd0b3('0x11')][_0xd0b3('0x12')]===undefined?!![]:![]:!![],'where':_0x232e6a['options']?_0x232e6a['options'][_0xd0b3('0x13')]||null:null,'attributes':_0x232e6a['options']?_0x232e6a[_0xd0b3('0x11')][_0xd0b3('0x14')]||null:null,'limit':_0x232e6a[_0xd0b3('0x11')]?_0x232e6a[_0xd0b3('0x11')][_0xd0b3('0x15')]||null:null,'include':_0x232e6a['options']?_0x232e6a['options']['include']?_[_0xd0b3('0x16')](_0x232e6a[_0xd0b3('0x11')][_0xd0b3('0x17')],function(_0x1bfe7b){return{'model':db[_0x1bfe7b[_0xd0b3('0x18')]],'as':_0x1bfe7b['as'],'attributes':_0x1bfe7b['attributes'],'include':_0x1bfe7b[_0xd0b3('0x17')]?_[_0xd0b3('0x16')](_0x1bfe7b[_0xd0b3('0x17')],function(_0x2e0dcc){return{'model':db[_0x2e0dcc['model']],'as':_0x2e0dcc['as'],'attributes':_0x2e0dcc[_0xd0b3('0x14')],'include':_0x2e0dcc[_0xd0b3('0x17')]?_[_0xd0b3('0x16')](_0x2e0dcc['include'],function(_0x48fb43){return{'model':db[_0x48fb43[_0xd0b3('0x18')]],'as':_0x48fb43['as'],'attributes':_0x48fb43[_0xd0b3('0x14')]};}):[]};}):[]};}):[]:[]})[_0xd0b3('0x19')](function(_0x4d42b4){logger[_0xd0b3('0xd')](_0xd0b3('0xf'),_0x232e6a);logger['debug'](_0xd0b3('0xf'),_0x232e6a,JSON[_0xd0b3('0xa')](_0x4d42b4));_0x4ed917(_0x4d42b4);})['catch'](function(_0x2b2d05){logger['error'](_0xd0b3('0xf'),_0x2b2d05['message'],_0x232e6a);_0x3fc7be(_0x5045b4[_0xd0b3('0xb')](0x1f4,_0x2b2d05[_0xd0b3('0xc')]));});});};exports[_0xd0b3('0x1a')]=function(_0x366931){var _0x23609e=this;return new Promise(function(_0x2f79cd,_0x44e5ad){return db['MemberReport'][_0xd0b3('0x1b')](_0x366931[_0xd0b3('0x1c')],{'raw':_0x366931[_0xd0b3('0x11')]?_0x366931[_0xd0b3('0x11')]['raw']===undefined?!![]:![]:!![]})[_0xd0b3('0x19')](function(_0x246bee){logger[_0xd0b3('0xd')](_0xd0b3('0x1a'),_0x366931);logger['debug'](_0xd0b3('0x1a'),_0x366931,JSON[_0xd0b3('0xa')](_0x246bee));_0x2f79cd(_0x246bee);})[_0xd0b3('0x1d')](function(_0x2f2e00){logger[_0xd0b3('0xb')](_0xd0b3('0x1a'),_0x2f2e00[_0xd0b3('0xc')],_0x366931);_0x44e5ad(_0x23609e[_0xd0b3('0xb')](0x1f4,_0x2f2e00[_0xd0b3('0xc')]));});});};exports[_0xd0b3('0x1e')]=function(_0x22de39){var _0xa53787=this;return new Promise(function(_0x1926ca,_0x1f587f){return db['MemberReport'][_0xd0b3('0x1f')](_0x22de39[_0xd0b3('0x1c')],{'raw':_0x22de39[_0xd0b3('0x11')]?_0x22de39[_0xd0b3('0x11')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22de39['options']?_0x22de39['options'][_0xd0b3('0x13')]||null:null,'attributes':_0x22de39[_0xd0b3('0x11')]?_0x22de39[_0xd0b3('0x11')][_0xd0b3('0x14')]||null:null,'limit':_0x22de39[_0xd0b3('0x11')]?_0x22de39[_0xd0b3('0x11')]['limit']||null:null})[_0xd0b3('0x19')](function(_0x4504e5){logger[_0xd0b3('0xd')](_0xd0b3('0x1e'),_0x22de39);logger[_0xd0b3('0x20')](_0xd0b3('0x1e'),_0x22de39,JSON[_0xd0b3('0xa')](_0x4504e5));_0x1926ca(_0x4504e5);})[_0xd0b3('0x1d')](function(_0x3be7ee){logger[_0xd0b3('0xb')](_0xd0b3('0x1e'),_0x3be7ee['message'],_0x22de39);_0x1f587f(_0xa53787['error'](0x1f4,_0x3be7ee[_0xd0b3('0xc')]));});});}; \ No newline at end of file +var _0x7958=['MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetMemberReport','MemberReport','options','where','attributes','limit','include','model','map','catch','CreateMemberReport','create','body','raw','UpdateMemberReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x531cd7,_0x2249b0){var _0x992d2f=function(_0xc27c8e){while(--_0xc27c8e){_0x531cd7['push'](_0x531cd7['shift']());}};_0x992d2f(++_0x2249b0);}(_0x7958,0x126));var _0x8795=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7958[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8795('0x0'));var util=require(_0x8795('0x1'));var moment=require('moment');var BPromise=require(_0x8795('0x2'));var rs=require(_0x8795('0x3'));var fs=require('fs');var Redis=require(_0x8795('0x4'));var db=require(_0x8795('0x5'))['db'];var utils=require(_0x8795('0x6'));var logger=require(_0x8795('0x7'))(_0x8795('0x8'));var config=require(_0x8795('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8795('0xa')][_0x8795('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x427ba5,_0x527da1,_0x12c15c){return new BPromise(function(_0x4ea71f,_0x10506d){return client[_0x8795('0xc')](_0x427ba5,_0x12c15c)[_0x8795('0xd')](function(_0x29746f){logger[_0x8795('0xe')](_0x8795('0xf'),_0x527da1,_0x8795('0x10'));logger[_0x8795('0x11')](_0x8795('0x12'),_0x527da1,_0x8795('0x10'),JSON[_0x8795('0x13')](_0x29746f));if(_0x29746f[_0x8795('0x14')]){if(_0x29746f[_0x8795('0x14')]['code']===0x1f4){logger[_0x8795('0x14')](_0x8795('0xf'),_0x527da1,_0x29746f[_0x8795('0x14')][_0x8795('0x15')]);return _0x10506d(_0x29746f[_0x8795('0x14')][_0x8795('0x15')]);}logger[_0x8795('0x14')]('MemberReport,\x20%s,\x20%s',_0x527da1,_0x29746f['error']['message']);return _0x4ea71f(_0x29746f[_0x8795('0x14')][_0x8795('0x15')]);}else{logger[_0x8795('0xe')](_0x8795('0xf'),_0x527da1,_0x8795('0x10'));_0x4ea71f(_0x29746f[_0x8795('0x16')][_0x8795('0x15')]);}})['catch'](function(_0x15f1db){logger['error'](_0x8795('0xf'),_0x527da1,_0x15f1db);_0x10506d(_0x15f1db);});});}exports[_0x8795('0x17')]=function(_0x498eea){var _0x2e5452=this;return new Promise(function(_0x322110,_0x275f1f){return db[_0x8795('0x18')]['findAll']({'raw':_0x498eea[_0x8795('0x19')]?_0x498eea[_0x8795('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x498eea[_0x8795('0x19')]?_0x498eea[_0x8795('0x19')][_0x8795('0x1a')]||null:null,'attributes':_0x498eea[_0x8795('0x19')]?_0x498eea['options'][_0x8795('0x1b')]||null:null,'limit':_0x498eea['options']?_0x498eea['options'][_0x8795('0x1c')]||null:null,'include':_0x498eea['options']?_0x498eea[_0x8795('0x19')][_0x8795('0x1d')]?_['map'](_0x498eea[_0x8795('0x19')][_0x8795('0x1d')],function(_0xb1becd){return{'model':db[_0xb1becd[_0x8795('0x1e')]],'as':_0xb1becd['as'],'attributes':_0xb1becd[_0x8795('0x1b')],'include':_0xb1becd[_0x8795('0x1d')]?_['map'](_0xb1becd['include'],function(_0x163707){return{'model':db[_0x163707['model']],'as':_0x163707['as'],'attributes':_0x163707[_0x8795('0x1b')],'include':_0x163707[_0x8795('0x1d')]?_[_0x8795('0x1f')](_0x163707[_0x8795('0x1d')],function(_0x26365b){return{'model':db[_0x26365b['model']],'as':_0x26365b['as'],'attributes':_0x26365b[_0x8795('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8795('0xd')](function(_0x5e06c5){logger[_0x8795('0xe')](_0x8795('0x17'),_0x498eea);logger[_0x8795('0x11')](_0x8795('0x17'),_0x498eea,JSON[_0x8795('0x13')](_0x5e06c5));_0x322110(_0x5e06c5);})[_0x8795('0x20')](function(_0x41428b){logger[_0x8795('0x14')](_0x8795('0x17'),_0x41428b[_0x8795('0x15')],_0x498eea);_0x275f1f(_0x2e5452[_0x8795('0x14')](0x1f4,_0x41428b['message']));});});};exports[_0x8795('0x21')]=function(_0xa5c815){var _0x3aab08=this;return new Promise(function(_0x2840b5,_0x4fbaee){return db[_0x8795('0x18')][_0x8795('0x22')](_0xa5c815[_0x8795('0x23')],{'raw':_0xa5c815[_0x8795('0x19')]?_0xa5c815[_0x8795('0x19')][_0x8795('0x24')]===undefined?!![]:![]:!![]})[_0x8795('0xd')](function(_0x2a358a){logger['info']('CreateMemberReport',_0xa5c815);logger[_0x8795('0x11')](_0x8795('0x21'),_0xa5c815,JSON[_0x8795('0x13')](_0x2a358a));_0x2840b5(_0x2a358a);})[_0x8795('0x20')](function(_0x4f556f){logger[_0x8795('0x14')](_0x8795('0x21'),_0x4f556f[_0x8795('0x15')],_0xa5c815);_0x4fbaee(_0x3aab08[_0x8795('0x14')](0x1f4,_0x4f556f[_0x8795('0x15')]));});});};exports[_0x8795('0x25')]=function(_0x3f10a6){var _0x3677af=this;return new Promise(function(_0x3809f0,_0x33fcdb){return db[_0x8795('0x18')][_0x8795('0x26')](_0x3f10a6[_0x8795('0x23')],{'raw':_0x3f10a6[_0x8795('0x19')]?_0x3f10a6[_0x8795('0x19')][_0x8795('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f10a6[_0x8795('0x19')]?_0x3f10a6[_0x8795('0x19')][_0x8795('0x1a')]||null:null,'attributes':_0x3f10a6[_0x8795('0x19')]?_0x3f10a6[_0x8795('0x19')][_0x8795('0x1b')]||null:null,'limit':_0x3f10a6[_0x8795('0x19')]?_0x3f10a6[_0x8795('0x19')][_0x8795('0x1c')]||null:null})[_0x8795('0xd')](function(_0x5b26a2){logger['info'](_0x8795('0x25'),_0x3f10a6);logger[_0x8795('0x11')](_0x8795('0x25'),_0x3f10a6,JSON[_0x8795('0x13')](_0x5b26a2));_0x3809f0(_0x5b26a2);})['catch'](function(_0x182878){logger['error'](_0x8795('0x25'),_0x182878[_0x8795('0x15')],_0x3f10a6);_0x33fcdb(_0x3677af['error'](0x1f4,_0x182878[_0x8795('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index b1b7f1e..07d2fd1 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 _0xd417=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./migration.controller','index','util','path'];(function(_0x5170d9,_0x5ca385){var _0x413c54=function(_0x29c3db){while(--_0x29c3db){_0x5170d9['push'](_0x5170d9['shift']());}};_0x413c54(++_0x5ca385);}(_0xd417,0x130));var _0x7d41=function(_0x23cb9e,_0x503adb){_0x23cb9e=_0x23cb9e-0x0;var _0x337b1d=_0xd417[_0x23cb9e];return _0x337b1d;};'use strict';var multer=require('multer');var util=require(_0x7d41('0x0'));var path=require(_0x7d41('0x1'));var timeout=require(_0x7d41('0x2'));var express=require('express');var router=express[_0x7d41('0x3')]();var fs_extra=require(_0x7d41('0x4'));var auth=require(_0x7d41('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7d41('0x6'));var controller=require(_0x7d41('0x7'));router['get']('/',controller[_0x7d41('0x8')]);module['exports']=router; \ No newline at end of file +var _0xd04e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','exports','multer','util','path','connect-timeout'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd04e,0x10d));var _0xed04=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0xd04e[_0xbf8ebe];return _0x1e25e8;};'use strict';var multer=require(_0xed04('0x0'));var util=require(_0xed04('0x1'));var path=require(_0xed04('0x2'));var timeout=require(_0xed04('0x3'));var express=require(_0xed04('0x4'));var router=express[_0xed04('0x5')]();var fs_extra=require(_0xed04('0x6'));var auth=require(_0xed04('0x7'));var interaction=require(_0xed04('0x8'));var config=require('../../config/environment');var controller=require(_0xed04('0x9'));router[_0xed04('0xa')]('/',controller[_0xed04('0xb')]);module[_0xed04('0xc')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index b67042e..98211ff 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 _0xcfea=['version','sequelize','STRING'];(function(_0x466bc7,_0x553523){var _0x629f82=function(_0x398fa8){while(--_0x398fa8){_0x466bc7['push'](_0x466bc7['shift']());}};_0x629f82(++_0x553523);}(_0xcfea,0x1c0));var _0xacfe=function(_0x3fda8c,_0x4eb703){_0x3fda8c=_0x3fda8c-0x0;var _0xa3a965=_0xcfea[_0x3fda8c];return _0xa3a965;};'use strict';var Sequelize=require(_0xacfe('0x0'));module['exports']={'version':{'type':Sequelize[_0xacfe('0x1')],'unique':_0xacfe('0x2')}}; \ No newline at end of file +var _0x5256=['sequelize','exports','version'];(function(_0x528a8e,_0xc2aba0){var _0x1e5256=function(_0x1c0963){while(--_0x1c0963){_0x528a8e['push'](_0x528a8e['shift']());}};_0x1e5256(++_0xc2aba0);}(_0x5256,0x69));var _0x6525=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x5256[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0x6525('0x0'));module[_0x6525('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x6525('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 48615d5..98b2461 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 _0x6335=['json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','Migration','type','key','model','query','intersection','attributes','length','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','eml-format','zip-dir','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x35e51e,_0x1efaed){var _0x44fc62=function(_0x32a3bd){while(--_0x32a3bd){_0x35e51e['push'](_0x35e51e['shift']());}};_0x44fc62(++_0x1efaed);}(_0x6335,0xab));var _0x5633=function(_0x115997,_0x308977){_0x115997=_0x115997-0x0;var _0x327fc8=_0x6335[_0x115997];return _0x327fc8;};'use strict';var emlformat=require(_0x5633('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5633('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5633('0x2'));var Mustache=require(_0x5633('0x3'));var util=require(_0x5633('0x4'));var path=require(_0x5633('0x5'));var sox=require('sox');var csv=require(_0x5633('0x6'));var ejs=require(_0x5633('0x7'));var fs=require('fs');var fs_extra=require(_0x5633('0x8'));var _=require(_0x5633('0x9'));var squel=require(_0x5633('0xa'));var crypto=require(_0x5633('0xb'));var jsforce=require(_0x5633('0xc'));var deskjs=require(_0x5633('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5633('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5633('0xf'));var qs=require(_0x5633('0x10'));var as=require(_0x5633('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5633('0x12'))(_0x5633('0x13'));var utils=require(_0x5633('0x14'));var config=require(_0x5633('0x15'));var licenseUtil=require(_0x5633('0x16'));var db=require(_0x5633('0x17'))['db'];function respondWithStatusCode(_0x168bef,_0x227edc){_0x227edc=_0x227edc||0xcc;return function(_0x45fc3e){if(_0x45fc3e){return _0x168bef[_0x5633('0x18')](_0x227edc);}return _0x168bef[_0x5633('0x19')](_0x227edc)[_0x5633('0x1a')]();};}function respondWithResult(_0x544d4c,_0x48c656){_0x48c656=_0x48c656||0xc8;return function(_0x30d445){if(_0x30d445){return _0x544d4c['status'](_0x48c656)[_0x5633('0x1b')](_0x30d445);}};}function respondWithFilteredResult(_0x161a12,_0x5dfeaf){return function(_0x5b679f){if(_0x5b679f){var _0x1f9a1b=typeof _0x5dfeaf[_0x5633('0x1c')]==='undefined'&&typeof _0x5dfeaf[_0x5633('0x1d')]==='undefined';var _0x9cf238=_0x5b679f[_0x5633('0x1e')];var _0x4703d3=_0x1f9a1b?0x0:_0x5dfeaf[_0x5633('0x1c')];var _0x23fb92=_0x1f9a1b?_0x5b679f[_0x5633('0x1e')]:_0x5dfeaf[_0x5633('0x1c')]+_0x5dfeaf[_0x5633('0x1d')];var _0x2369d4;if(_0x23fb92>=_0x9cf238){_0x23fb92=_0x9cf238;_0x2369d4=0xc8;}else{_0x2369d4=0xce;}_0x161a12['status'](_0x2369d4);return _0x161a12[_0x5633('0x1f')](_0x5633('0x20'),_0x4703d3+'-'+_0x23fb92+'/'+_0x9cf238)[_0x5633('0x1b')](_0x5b679f);}return null;};}function patchUpdates(_0x2cd916){return function(_0x5ab9e9){try{jsonpatch[_0x5633('0x21')](_0x5ab9e9,_0x2cd916,!![]);}catch(_0x192181){return BPromise[_0x5633('0x22')](_0x192181);}return _0x5ab9e9[_0x5633('0x23')]();};}function saveUpdates(_0x540115,_0x134496){return function(_0x1e7ecc){if(_0x1e7ecc){return _0x1e7ecc[_0x5633('0x24')](_0x540115)['then'](function(_0x5b590a){return _0x5b590a;});}return null;};}function removeEntity(_0x57f111,_0xcfe92b){return function(_0x42460e){if(_0x42460e){return _0x42460e[_0x5633('0x25')]()[_0x5633('0x26')](function(){_0x57f111[_0x5633('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52da92,_0x57f663){return function(_0x716002){if(!_0x716002){_0x52da92['sendStatus'](0x194);}return _0x716002;};}function handleError(_0x393309,_0x4d5e72){_0x4d5e72=_0x4d5e72||0x1f4;return function(_0x3b5b33){logger[_0x5633('0x27')](_0x3b5b33[_0x5633('0x28')]);if(_0x3b5b33[_0x5633('0x29')]){delete _0x3b5b33[_0x5633('0x29')];}_0x393309[_0x5633('0x19')](_0x4d5e72)[_0x5633('0x2a')](_0x3b5b33);};}exports[_0x5633('0x2b')]=function(_0x12ed37,_0x3ddd8a){var _0x321470={},_0x3c5dbe={},_0x3e641b={'count':0x0,'rows':[]};var _0x420d6e=_[_0x5633('0x2c')](db[_0x5633('0x2d')]['rawAttributes'],function(_0x56a690){return{'name':_0x56a690['fieldName'],'type':_0x56a690[_0x5633('0x2e')][_0x5633('0x2f')]};});_0x3c5dbe[_0x5633('0x30')]=_['map'](_0x420d6e,_0x5633('0x29'));_0x3c5dbe['query']=_['keys'](_0x12ed37[_0x5633('0x31')]);_0x3c5dbe['filters']=_[_0x5633('0x32')](_0x3c5dbe['model'],_0x3c5dbe['query']);_0x321470[_0x5633('0x33')]=_[_0x5633('0x32')](_0x3c5dbe['model'],qs['fields'](_0x12ed37['query']['fields']));_0x321470[_0x5633('0x33')]=_0x321470[_0x5633('0x33')][_0x5633('0x34')]?_0x321470[_0x5633('0x33')]:_0x3c5dbe['model'];if(!_0x12ed37['query']['hasOwnProperty'](_0x5633('0x35'))){_0x321470[_0x5633('0x1d')]=qs[_0x5633('0x1d')](_0x12ed37[_0x5633('0x31')][_0x5633('0x1d')]);_0x321470[_0x5633('0x1c')]=qs[_0x5633('0x1c')](_0x12ed37[_0x5633('0x31')][_0x5633('0x1c')]);}_0x321470[_0x5633('0x36')]=qs[_0x5633('0x37')](_0x12ed37[_0x5633('0x31')][_0x5633('0x37')]);_0x321470['where']=qs[_0x5633('0x38')](_['pick'](_0x12ed37[_0x5633('0x31')],_0x3c5dbe['filters']),_0x420d6e);if(_0x12ed37[_0x5633('0x31')][_0x5633('0x39')]){_0x321470['where']=_[_0x5633('0x3a')](_0x321470[_0x5633('0x3b')],{'$or':_[_0x5633('0x2c')](_0x420d6e,function(_0x13566e){if(_0x13566e[_0x5633('0x2e')]!==_0x5633('0x3c')){var _0x4fb0ea={};_0x4fb0ea[_0x13566e[_0x5633('0x29')]]={'$like':'%'+_0x12ed37[_0x5633('0x31')][_0x5633('0x39')]+'%'};return _0x4fb0ea;}})});}_0x321470=_[_0x5633('0x3a')]({},_0x321470,_0x12ed37[_0x5633('0x3d')]);var _0x60817d={'where':_0x321470[_0x5633('0x3b')]};return db[_0x5633('0x2d')][_0x5633('0x1e')](_0x60817d)[_0x5633('0x26')](function(_0x3c9527){_0x3e641b[_0x5633('0x1e')]=_0x3c9527;if(_0x12ed37['query'][_0x5633('0x3e')]){_0x321470[_0x5633('0x3f')]=[{'all':!![]}];}return db['Migration'][_0x5633('0x40')](_0x321470);})[_0x5633('0x26')](function(_0x54b2cf){_0x3e641b[_0x5633('0x41')]=_0x54b2cf;return _0x3e641b;})[_0x5633('0x26')](respondWithFilteredResult(_0x3ddd8a,_0x321470))['catch'](handleError(_0x3ddd8a,null));}; \ No newline at end of file +var _0x2b42=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','catch','rimraf','zip-dir'];(function(_0xab456c,_0x55261c){var _0x3d8767=function(_0x53a833){while(--_0x53a833){_0xab456c['push'](_0xab456c['shift']());}};_0x3d8767(++_0x55261c);}(_0x2b42,0x122));var _0x22b4=function(_0x4753b7,_0x2660d1){_0x4753b7=_0x4753b7-0x0;var _0x3e6fa9=_0x2b42[_0x4753b7];return _0x3e6fa9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22b4('0x0'));var zipdir=require(_0x22b4('0x1'));var jsonpatch=require(_0x22b4('0x2'));var rp=require(_0x22b4('0x3'));var moment=require(_0x22b4('0x4'));var BPromise=require(_0x22b4('0x5'));var Mustache=require(_0x22b4('0x6'));var util=require(_0x22b4('0x7'));var path=require(_0x22b4('0x8'));var sox=require(_0x22b4('0x9'));var csv=require(_0x22b4('0xa'));var ejs=require(_0x22b4('0xb'));var fs=require('fs');var fs_extra=require(_0x22b4('0xc'));var _=require(_0x22b4('0xd'));var squel=require(_0x22b4('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x22b4('0xf'));var toCsv=require('to-csv');var querystring=require(_0x22b4('0x10'));var Papa=require(_0x22b4('0x11'));var Redis=require(_0x22b4('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x22b4('0x13'));var as=require(_0x22b4('0x14'));var hardwareService=require(_0x22b4('0x15'));var logger=require(_0x22b4('0x16'))(_0x22b4('0x17'));var utils=require(_0x22b4('0x18'));var config=require(_0x22b4('0x19'));var licenseUtil=require(_0x22b4('0x1a'));var db=require(_0x22b4('0x1b'))['db'];function respondWithStatusCode(_0x1ab6bc,_0x1e9de2){_0x1e9de2=_0x1e9de2||0xcc;return function(_0x4ce731){if(_0x4ce731){return _0x1ab6bc[_0x22b4('0x1c')](_0x1e9de2);}return _0x1ab6bc[_0x22b4('0x1d')](_0x1e9de2)[_0x22b4('0x1e')]();};}function respondWithResult(_0x366529,_0x4a156d){_0x4a156d=_0x4a156d||0xc8;return function(_0x31c559){if(_0x31c559){return _0x366529[_0x22b4('0x1d')](_0x4a156d)['json'](_0x31c559);}};}function respondWithFilteredResult(_0xe5ce0,_0x227880){return function(_0x148d50){if(_0x148d50){var _0x56bf68=typeof _0x227880[_0x22b4('0x1f')]==='undefined'&&typeof _0x227880[_0x22b4('0x20')]==='undefined';var _0x1a559b=_0x148d50[_0x22b4('0x21')];var _0x546c9c=_0x56bf68?0x0:_0x227880['offset'];var _0x4911ab=_0x56bf68?_0x148d50[_0x22b4('0x21')]:_0x227880[_0x22b4('0x1f')]+_0x227880[_0x22b4('0x20')];var _0x2c6080;if(_0x4911ab>=_0x1a559b){_0x4911ab=_0x1a559b;_0x2c6080=0xc8;}else{_0x2c6080=0xce;}_0xe5ce0[_0x22b4('0x1d')](_0x2c6080);return _0xe5ce0[_0x22b4('0x22')](_0x22b4('0x23'),_0x546c9c+'-'+_0x4911ab+'/'+_0x1a559b)[_0x22b4('0x24')](_0x148d50);}return null;};}function patchUpdates(_0x281bb5){return function(_0x35f1db){try{jsonpatch[_0x22b4('0x25')](_0x35f1db,_0x281bb5,!![]);}catch(_0x1a29f0){return BPromise[_0x22b4('0x26')](_0x1a29f0);}return _0x35f1db[_0x22b4('0x27')]();};}function saveUpdates(_0x3bcc1b,_0x4457f0){return function(_0x25991b){if(_0x25991b){return _0x25991b[_0x22b4('0x28')](_0x3bcc1b)[_0x22b4('0x29')](function(_0x38ff03){return _0x38ff03;});}return null;};}function removeEntity(_0x5792d0,_0x741523){return function(_0x1825bc){if(_0x1825bc){return _0x1825bc[_0x22b4('0x2a')]()[_0x22b4('0x29')](function(){_0x5792d0[_0x22b4('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x424a66,_0x2ccb16){return function(_0x396c01){if(!_0x396c01){_0x424a66[_0x22b4('0x1c')](0x194);}return _0x396c01;};}function handleError(_0x37b22d,_0x116134){_0x116134=_0x116134||0x1f4;return function(_0x42263e){logger[_0x22b4('0x2b')](_0x42263e[_0x22b4('0x2c')]);if(_0x42263e[_0x22b4('0x2d')]){delete _0x42263e[_0x22b4('0x2d')];}_0x37b22d['status'](_0x116134)[_0x22b4('0x2e')](_0x42263e);};}exports[_0x22b4('0x2f')]=function(_0x190530,_0x7c2b01){var _0x3a467a={},_0x4c3868={},_0x2571ab={'count':0x0,'rows':[]};var _0x27c46a=_['map'](db['Migration']['rawAttributes'],function(_0x2c0148){return{'name':_0x2c0148[_0x22b4('0x30')],'type':_0x2c0148[_0x22b4('0x31')][_0x22b4('0x32')]};});_0x4c3868[_0x22b4('0x33')]=_[_0x22b4('0x34')](_0x27c46a,_0x22b4('0x2d'));_0x4c3868[_0x22b4('0x35')]=_[_0x22b4('0x36')](_0x190530['query']);_0x4c3868[_0x22b4('0x37')]=_[_0x22b4('0x38')](_0x4c3868[_0x22b4('0x33')],_0x4c3868[_0x22b4('0x35')]);_0x3a467a[_0x22b4('0x39')]=_['intersection'](_0x4c3868['model'],qs[_0x22b4('0x3a')](_0x190530[_0x22b4('0x35')]['fields']));_0x3a467a['attributes']=_0x3a467a['attributes'][_0x22b4('0x3b')]?_0x3a467a[_0x22b4('0x39')]:_0x4c3868[_0x22b4('0x33')];if(!_0x190530[_0x22b4('0x35')][_0x22b4('0x3c')](_0x22b4('0x3d'))){_0x3a467a[_0x22b4('0x20')]=qs[_0x22b4('0x20')](_0x190530[_0x22b4('0x35')][_0x22b4('0x20')]);_0x3a467a[_0x22b4('0x1f')]=qs[_0x22b4('0x1f')](_0x190530[_0x22b4('0x35')][_0x22b4('0x1f')]);}_0x3a467a[_0x22b4('0x3e')]=qs['sort'](_0x190530[_0x22b4('0x35')][_0x22b4('0x3f')]);_0x3a467a['where']=qs['filters'](_[_0x22b4('0x40')](_0x190530[_0x22b4('0x35')],_0x4c3868[_0x22b4('0x37')]),_0x27c46a);if(_0x190530[_0x22b4('0x35')][_0x22b4('0x41')]){_0x3a467a[_0x22b4('0x42')]=_[_0x22b4('0x43')](_0x3a467a['where'],{'$or':_[_0x22b4('0x34')](_0x27c46a,function(_0x50a38a){if(_0x50a38a[_0x22b4('0x31')]!==_0x22b4('0x44')){var _0x42e6ca={};_0x42e6ca[_0x50a38a[_0x22b4('0x2d')]]={'$like':'%'+_0x190530[_0x22b4('0x35')][_0x22b4('0x41')]+'%'};return _0x42e6ca;}})});}_0x3a467a=_[_0x22b4('0x43')]({},_0x3a467a,_0x190530['options']);var _0x5ecc29={'where':_0x3a467a[_0x22b4('0x42')]};return db['Migration'][_0x22b4('0x21')](_0x5ecc29)['then'](function(_0x255dbf){_0x2571ab['count']=_0x255dbf;if(_0x190530[_0x22b4('0x35')][_0x22b4('0x45')]){_0x3a467a['include']=[{'all':!![]}];}return db['Migration'][_0x22b4('0x46')](_0x3a467a);})['then'](function(_0xadbe0b){_0x2571ab[_0x22b4('0x47')]=_0xadbe0b;return _0x2571ab;})['then'](respondWithFilteredResult(_0x7c2b01,_0x3a467a))[_0x22b4('0x48')](handleError(_0x7c2b01,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 4a1b504..b4224c2 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 _0x8ed9=['path','rimraf','../../config/environment','exports','define','Migration','migrations','lodash','util','api','bluebird'];(function(_0x41c234,_0x31e470){var _0xb5503a=function(_0x3a757d){while(--_0x3a757d){_0x41c234['push'](_0x41c234['shift']());}};_0xb5503a(++_0x31e470);}(_0x8ed9,0x17d));var _0x98ed=function(_0x5cd43b,_0x2052f7){_0x5cd43b=_0x5cd43b-0x0;var _0x5635a9=_0x8ed9[_0x5cd43b];return _0x5635a9;};'use strict';var _=require(_0x98ed('0x0'));var util=require(_0x98ed('0x1'));var logger=require('../../config/logger')(_0x98ed('0x2'));var moment=require('moment');var BPromise=require(_0x98ed('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98ed('0x4'));var rimraf=require(_0x98ed('0x5'));var config=require(_0x98ed('0x6'));var attributes=require('./migration.attributes');module[_0x98ed('0x7')]=function(_0x9612c,_0x3e2d10){return _0x9612c[_0x98ed('0x8')](_0x98ed('0x9'),attributes,{'tableName':_0x98ed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06ee=['bluebird','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment'];(function(_0x4edb98,_0xfcb383){var _0x545b1a=function(_0x2cc5d2){while(--_0x2cc5d2){_0x4edb98['push'](_0x4edb98['shift']());}};_0x545b1a(++_0xfcb383);}(_0x06ee,0x1bb));var _0xe06e=function(_0x474cc2,_0x4c930b){_0x474cc2=_0x474cc2-0x0;var _0x5f5360=_0x06ee[_0x474cc2];return _0x5f5360;};'use strict';var _=require(_0xe06e('0x0'));var util=require(_0xe06e('0x1'));var logger=require(_0xe06e('0x2'))(_0xe06e('0x3'));var moment=require(_0xe06e('0x4'));var BPromise=require(_0xe06e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe06e('0x6'));var rimraf=require(_0xe06e('0x7'));var config=require(_0xe06e('0x8'));var attributes=require(_0xe06e('0x9'));module[_0xe06e('0xa')]=function(_0x2f3de7,_0x4df991){return _0x2f3de7[_0xe06e('0xb')](_0xe06e('0xc'),attributes,{'tableName':_0xe06e('0xd'),'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 dc2ddc0..1bf19fe 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 _0xdbfc=['client','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3242cd,_0x3bbe1a){var _0x20baa7=function(_0x35c47f){while(--_0x35c47f){_0x3242cd['push'](_0x3242cd['shift']());}};_0x20baa7(++_0x3bbe1a);}(_0xdbfc,0x11d));var _0xcdbf=function(_0x2309fe,_0x1130e1){_0x2309fe=_0x2309fe-0x0;var _0x106fbe=_0xdbfc[_0x2309fe];return _0x106fbe;};'use strict';var _=require(_0xcdbf('0x0'));var util=require(_0xcdbf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcdbf('0x2'));var fs=require('fs');var Redis=require(_0xcdbf('0x3'));var db=require(_0xcdbf('0x4'))['db'];var utils=require(_0xcdbf('0x5'));var logger=require(_0xcdbf('0x6'))(_0xcdbf('0x7'));var config=require(_0xcdbf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcdbf('0x9')][_0xcdbf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54aeaf,_0x369d61,_0x3c077d){return new BPromise(function(_0x409a4e,_0xf4dfb5){return client['request'](_0x54aeaf,_0x3c077d)[_0xcdbf('0xb')](function(_0x30e0a4){logger[_0xcdbf('0xc')](_0xcdbf('0xd'),_0x369d61,_0xcdbf('0xe'));logger['debug'](_0xcdbf('0xf'),_0x369d61,'request\x20sent',JSON[_0xcdbf('0x10')](_0x30e0a4));if(_0x30e0a4['error']){if(_0x30e0a4[_0xcdbf('0x11')]['code']===0x1f4){logger[_0xcdbf('0x11')](_0xcdbf('0xd'),_0x369d61,_0x30e0a4[_0xcdbf('0x11')]['message']);return _0xf4dfb5(_0x30e0a4[_0xcdbf('0x11')]['message']);}logger[_0xcdbf('0x11')](_0xcdbf('0xd'),_0x369d61,_0x30e0a4[_0xcdbf('0x11')][_0xcdbf('0x12')]);return _0x409a4e(_0x30e0a4[_0xcdbf('0x11')]['message']);}else{logger[_0xcdbf('0xc')](_0xcdbf('0xd'),_0x369d61,_0xcdbf('0xe'));_0x409a4e(_0x30e0a4[_0xcdbf('0x13')][_0xcdbf('0x12')]);}})[_0xcdbf('0x14')](function(_0x19b5bd){logger[_0xcdbf('0x11')](_0xcdbf('0xd'),_0x369d61,_0x19b5bd);_0xf4dfb5(_0x19b5bd);});});} \ No newline at end of file +var _0x9d02=['rpc','../../config/environment','jayson/promise','request','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','Migration,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0x9d02,0x118));var _0x29d0=function(_0x8d26a9,_0x36e071){_0x8d26a9=_0x8d26a9-0x0;var _0x1688e3=_0x9d02[_0x8d26a9];return _0x1688e3;};'use strict';var _=require(_0x29d0('0x0'));var util=require('util');var moment=require(_0x29d0('0x1'));var BPromise=require('bluebird');var rs=require(_0x29d0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x29d0('0x3'))['db'];var utils=require(_0x29d0('0x4'));var logger=require('../../config/logger')(_0x29d0('0x5'));var config=require(_0x29d0('0x6'));var jayson=require(_0x29d0('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5e35b3,_0x351d26,_0x18a02c){return new BPromise(function(_0x4a4019,_0x402fa6){return client[_0x29d0('0x8')](_0x5e35b3,_0x18a02c)['then'](function(_0x4bc0f9){logger[_0x29d0('0x9')]('Migration,\x20%s,\x20%s',_0x351d26,_0x29d0('0xa'));logger[_0x29d0('0xb')](_0x29d0('0xc'),_0x351d26,_0x29d0('0xa'),JSON['stringify'](_0x4bc0f9));if(_0x4bc0f9['error']){if(_0x4bc0f9[_0x29d0('0xd')][_0x29d0('0xe')]===0x1f4){logger[_0x29d0('0xd')](_0x29d0('0xf'),_0x351d26,_0x4bc0f9[_0x29d0('0xd')][_0x29d0('0x10')]);return _0x402fa6(_0x4bc0f9[_0x29d0('0xd')][_0x29d0('0x10')]);}logger[_0x29d0('0xd')]('Migration,\x20%s,\x20%s',_0x351d26,_0x4bc0f9[_0x29d0('0xd')][_0x29d0('0x10')]);return _0x4a4019(_0x4bc0f9[_0x29d0('0xd')][_0x29d0('0x10')]);}else{logger[_0x29d0('0x9')](_0x29d0('0xf'),_0x351d26,'request\x20sent');_0x4a4019(_0x4bc0f9[_0x29d0('0x11')][_0x29d0('0x10')]);}})[_0x29d0('0x12')](function(_0x49e919){logger[_0x29d0('0xd')](_0x29d0('0xf'),_0x351d26,_0x49e919);_0x402fa6(_0x49e919);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 22198ac..be9b26d 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 _0x4cd3=['get','/:id','show','post','isAuthenticated','put','update','delete','destroy','exports','multer','util','fs-extra','../../components/auth/service'];(function(_0x58b96b,_0x22afb8){var _0x2e3725=function(_0x22c46d){while(--_0x22c46d){_0x58b96b['push'](_0x58b96b['shift']());}};_0x2e3725(++_0x22afb8);}(_0x4cd3,0x1ca));var _0x34cd=function(_0x5a25f6,_0x3db5cb){_0x5a25f6=_0x5a25f6-0x0;var _0x5a524d=_0x4cd3[_0x5a25f6];return _0x5a524d;};'use strict';var multer=require(_0x34cd('0x0'));var util=require(_0x34cd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x34cd('0x2'));var auth=require(_0x34cd('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./network.controller');router[_0x34cd('0x4')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x34cd('0x5'),auth['isAuthenticated'](),controller[_0x34cd('0x6')]);router[_0x34cd('0x7')]('/',auth[_0x34cd('0x8')](),controller['create']);router[_0x34cd('0x9')](_0x34cd('0x5'),auth[_0x34cd('0x8')](),controller[_0x34cd('0xa')]);router[_0x34cd('0xb')](_0x34cd('0x5'),auth[_0x34cd('0x8')](),controller[_0x34cd('0xc')]);module[_0x34cd('0xd')]=router; \ No newline at end of file +var _0x0648=['put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','/:id','post'];(function(_0x4e7844,_0x74bac5){var _0x1f9393=function(_0x4d9655){while(--_0x4d9655){_0x4e7844['push'](_0x4e7844['shift']());}};_0x1f9393(++_0x74bac5);}(_0x0648,0x1a5));var _0x8064=function(_0x491d56,_0x18e466){_0x491d56=_0x491d56-0x0;var _0x5ae09b=_0x0648[_0x491d56];return _0x5ae09b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8064('0x0'));var timeout=require(_0x8064('0x1'));var express=require(_0x8064('0x2'));var router=express['Router']();var fs_extra=require(_0x8064('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8064('0x4'));var config=require(_0x8064('0x5'));var controller=require(_0x8064('0x6'));router[_0x8064('0x7')]('/',auth[_0x8064('0x8')](),controller['index']);router[_0x8064('0x7')](_0x8064('0x9'),auth[_0x8064('0x8')](),controller['show']);router[_0x8064('0xa')]('/',auth[_0x8064('0x8')](),controller['create']);router[_0x8064('0xb')](_0x8064('0x9'),auth[_0x8064('0x8')](),controller[_0x8064('0xc')]);router[_0x8064('0xd')](_0x8064('0x9'),auth[_0x8064('0x8')](),controller[_0x8064('0xe')]);module[_0x8064('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index ca5f880..7275208 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 _0x904d=['localnet','externip','turn','STRING','sequelize','exports','ENUM'];(function(_0x22ad0c,_0x56e8a1){var _0x3787a9=function(_0x1d87a9){while(--_0x1d87a9){_0x22ad0c['push'](_0x22ad0c['shift']());}};_0x3787a9(++_0x56e8a1);}(_0x904d,0x107));var _0xd904=function(_0x4db40c,_0x5aebda){_0x4db40c=_0x4db40c-0x0;var _0x572a4b=_0x904d[_0x4db40c];return _0x572a4b;};'use strict';var Sequelize=require(_0xd904('0x0'));module[_0xd904('0x1')]={'type':{'type':Sequelize[_0xd904('0x2')](_0xd904('0x3'),_0xd904('0x4'),'stun',_0xd904('0x5'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd904('0x6')]},'password':{'type':Sequelize[_0xd904('0x6')]}}; \ No newline at end of file +var _0x2bce=['exports','ENUM','localnet','externip','STRING'];(function(_0x4ed6c7,_0x2e6803){var _0x112d0c=function(_0x188c4f){while(--_0x188c4f){_0x4ed6c7['push'](_0x4ed6c7['shift']());}};_0x112d0c(++_0x2e6803);}(_0x2bce,0x19f));var _0xe2bc=function(_0x3e2166,_0x2a5fd1){_0x3e2166=_0x3e2166-0x0;var _0x392f82=_0x2bce[_0x3e2166];return _0x392f82;};'use strict';var Sequelize=require('sequelize');module[_0xe2bc('0x0')]={'type':{'type':Sequelize[_0xe2bc('0x1')](_0xe2bc('0x2'),_0xe2bc('0x3'),'stun','turn')},'value':{'type':Sequelize[_0xe2bc('0x4')]},'username':{'type':Sequelize[_0xe2bc('0x4')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 6175048..4f4a7a9 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 _0x1f42=['VIRTUAL','options','findAll','show','params','includeAll','merge','find','create','body','toUpperCase','join','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','TURN','readFileSync','root','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','toLowerCase','chan_sip.so','STUN','/etc/asterisk/sip_xcally_%s.conf','res_stun_monitor.so','util','path','ejs','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','undefined','count','offset','limit','set','Content-Range','update','destroy','end','send','index','Network','rawAttributes','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','type'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x1f42,0xc2));var _0x21f4=function(_0x453ed8,_0xbf85e4){_0x453ed8=_0x453ed8-0x0;var _0x23132b=_0x1f42[_0x453ed8];return _0x23132b;};'use strict';var util=require(_0x21f4('0x0'));var path=require(_0x21f4('0x1'));var ejs=require(_0x21f4('0x2'));var fs=require('fs');var _=require(_0x21f4('0x3'));var qs=require(_0x21f4('0x4'));var logger=require('../../config/logger')(_0x21f4('0x5'));var config=require(_0x21f4('0x6'));var db=require(_0x21f4('0x7'))['db'];var jayson=require(_0x21f4('0x8'));var client=jayson[_0x21f4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13b8d1,_0x5c6d28,_0x23f875,_0x2d150f){return new Promise(function(_0x5071e1,_0xf68b2f){var _0x336c73=_0x2d150f||client;return _0x336c73[_0x21f4('0xa')](_0x13b8d1,_0x23f875)[_0x21f4('0xb')](function(_0x3a88b9){logger[_0x21f4('0xc')](_0x21f4('0xd'),_0x5c6d28,_0x21f4('0xe'));logger[_0x21f4('0xf')](_0x21f4('0x10'),_0x5c6d28,'request\x20sent',JSON[_0x21f4('0x11')](_0x3a88b9));if(_0x3a88b9[_0x21f4('0x12')]){if(_0x3a88b9['error'][_0x21f4('0x13')]===0x1f4){logger[_0x21f4('0x12')]('Network,\x20%s,\x20%s',_0x5c6d28,_0x3a88b9[_0x21f4('0x12')][_0x21f4('0x14')]);return _0xf68b2f(_0x3a88b9[_0x21f4('0x12')][_0x21f4('0x14')]);}logger[_0x21f4('0x12')](_0x21f4('0xd'),_0x5c6d28,_0x3a88b9[_0x21f4('0x12')][_0x21f4('0x14')]);return _0x5071e1(_0x3a88b9['error'][_0x21f4('0x14')]);}else{logger[_0x21f4('0xc')](_0x21f4('0xd'),_0x5c6d28,_0x21f4('0xe'));_0x5071e1(_0x3a88b9[_0x21f4('0x15')][_0x21f4('0x14')]);}})[_0x21f4('0x16')](function(_0x1869b4){logger[_0x21f4('0x12')](_0x21f4('0xd'),_0x5c6d28,_0x1869b4);_0xf68b2f(_0x1869b4);});});}function respondWithResult(_0x4ea801,_0xa2583c){_0xa2583c=_0xa2583c||0xc8;return function(_0x3c3a7f){if(_0x3c3a7f){return _0x4ea801[_0x21f4('0x17')](_0xa2583c)[_0x21f4('0x18')](_0x3c3a7f);}};}function respondWithFilteredResult(_0x136790,_0x2a1f19){return function(_0x4ec23d){if(_0x4ec23d){var _0x5e87d3=typeof _0x2a1f19['offset']===_0x21f4('0x19')&&typeof _0x2a1f19['limit']===_0x21f4('0x19');var _0x4bfa9b=_0x4ec23d[_0x21f4('0x1a')];var _0x4686cc=_0x5e87d3?0x0:_0x2a1f19[_0x21f4('0x1b')];var _0x37d8e0=_0x5e87d3?_0x4ec23d[_0x21f4('0x1a')]:_0x2a1f19['offset']+_0x2a1f19[_0x21f4('0x1c')];var _0x3ab44c;if(_0x37d8e0>=_0x4bfa9b){_0x37d8e0=_0x4bfa9b;_0x3ab44c=0xc8;}else{_0x3ab44c=0xce;}_0x136790['status'](_0x3ab44c);return _0x136790[_0x21f4('0x1d')](_0x21f4('0x1e'),_0x4686cc+'-'+_0x37d8e0+'/'+_0x4bfa9b)['json'](_0x4ec23d);}return null;};}function saveUpdates(_0x58e7de){return function(_0x5d8ef2){if(_0x5d8ef2){return _0x5d8ef2[_0x21f4('0x1f')](_0x58e7de)['then'](function(_0x3bf425){return _0x3bf425;});}return null;};}function removeEntity(_0x3c6fcd){return function(_0x40f666){if(_0x40f666){return _0x40f666[_0x21f4('0x20')]()[_0x21f4('0xb')](function(){_0x3c6fcd[_0x21f4('0x17')](0xcc)[_0x21f4('0x21')]();});}};}function handleEntityNotFound(_0x3b924f){return function(_0x1cfbc8){if(!_0x1cfbc8){_0x3b924f['sendStatus'](0x194);}return _0x1cfbc8;};}function handleError(_0x1fa1f9,_0x4ed325){_0x4ed325=_0x4ed325||0x1f4;return function(_0x30ae1e){logger[_0x21f4('0x12')](_0x30ae1e['stack']);if(_0x30ae1e['name']){delete _0x30ae1e['name'];}_0x1fa1f9[_0x21f4('0x17')](_0x4ed325)[_0x21f4('0x22')](_0x30ae1e);};}exports[_0x21f4('0x23')]=function(_0x24f840,_0x45cce5){var _0x4edb3a={},_0x4354d8={},_0x31a085={'count':0x0,'rows':[]};var _0x3d7e66=_['map'](db[_0x21f4('0x24')][_0x21f4('0x25')],function(_0x37adac){return{'name':_0x37adac['fieldName'],'type':_0x37adac['type']['key']};});_0x4354d8[_0x21f4('0x26')]=_['map'](_0x3d7e66,_0x21f4('0x27'));_0x4354d8[_0x21f4('0x28')]=_[_0x21f4('0x29')](_0x24f840[_0x21f4('0x28')]);_0x4354d8['filters']=_[_0x21f4('0x2a')](_0x4354d8['model'],_0x4354d8[_0x21f4('0x28')]);_0x4edb3a[_0x21f4('0x2b')]=_[_0x21f4('0x2a')](_0x4354d8['model'],qs[_0x21f4('0x2c')](_0x24f840['query'][_0x21f4('0x2c')]));_0x4edb3a['attributes']=_0x4edb3a[_0x21f4('0x2b')][_0x21f4('0x2d')]?_0x4edb3a['attributes']:_0x4354d8[_0x21f4('0x26')];if(!_0x24f840[_0x21f4('0x28')][_0x21f4('0x2e')]('nolimit')){_0x4edb3a[_0x21f4('0x1c')]=qs[_0x21f4('0x1c')](_0x24f840[_0x21f4('0x28')][_0x21f4('0x1c')]);_0x4edb3a[_0x21f4('0x1b')]=qs[_0x21f4('0x1b')](_0x24f840[_0x21f4('0x28')][_0x21f4('0x1b')]);}_0x4edb3a['order']=qs[_0x21f4('0x2f')](_0x24f840[_0x21f4('0x28')][_0x21f4('0x2f')]);_0x4edb3a['where']=qs['filters'](_[_0x21f4('0x30')](_0x24f840[_0x21f4('0x28')],_0x4354d8['filters']),_0x3d7e66);if(_0x24f840['query'][_0x21f4('0x31')]){_0x4edb3a['where']=_['merge'](_0x4edb3a[_0x21f4('0x32')],{'$or':_['map'](_0x3d7e66,function(_0x44d95d){if(_0x44d95d[_0x21f4('0x33')]!==_0x21f4('0x34')){var _0x22e8ba={};_0x22e8ba[_0x44d95d[_0x21f4('0x27')]]={'$like':'%'+_0x24f840[_0x21f4('0x28')][_0x21f4('0x31')]+'%'};return _0x22e8ba;}})});}_0x4edb3a=_['merge']({},_0x4edb3a,_0x24f840[_0x21f4('0x35')]);var _0x4c5ea0={'where':_0x4edb3a[_0x21f4('0x32')]};return db['Network'][_0x21f4('0x1a')](_0x4c5ea0)['then'](function(_0xbb1ca4){_0x31a085['count']=_0xbb1ca4;if(_0x24f840[_0x21f4('0x28')]['includeAll']){_0x4edb3a['include']=[{'all':!![]}];}return db[_0x21f4('0x24')][_0x21f4('0x36')](_0x4edb3a);})[_0x21f4('0xb')](function(_0x3780b7){_0x31a085['rows']=_0x3780b7;return _0x31a085;})[_0x21f4('0xb')](respondWithFilteredResult(_0x45cce5,_0x4edb3a))[_0x21f4('0x16')](handleError(_0x45cce5,null));};exports[_0x21f4('0x37')]=function(_0x54ea26,_0x40c1a1){var _0x2c709d={'raw':!![],'where':{'id':_0x54ea26[_0x21f4('0x38')]['id']}},_0x1ca068={};_0x1ca068[_0x21f4('0x26')]=_['keys'](db[_0x21f4('0x24')][_0x21f4('0x25')]);_0x1ca068['query']=_[_0x21f4('0x29')](_0x54ea26[_0x21f4('0x28')]);_0x1ca068['filters']=_[_0x21f4('0x2a')](_0x1ca068[_0x21f4('0x26')],_0x1ca068[_0x21f4('0x28')]);_0x2c709d[_0x21f4('0x2b')]=_[_0x21f4('0x2a')](_0x1ca068['model'],qs[_0x21f4('0x2c')](_0x54ea26['query'][_0x21f4('0x2c')]));_0x2c709d[_0x21f4('0x2b')]=_0x2c709d[_0x21f4('0x2b')][_0x21f4('0x2d')]?_0x2c709d['attributes']:_0x1ca068[_0x21f4('0x26')];if(_0x54ea26[_0x21f4('0x28')][_0x21f4('0x39')]){_0x2c709d['include']=[{'all':!![]}];}_0x2c709d=_[_0x21f4('0x3a')]({},_0x2c709d,_0x54ea26[_0x21f4('0x35')]);return db['Network'][_0x21f4('0x3b')](_0x2c709d)['then'](handleEntityNotFound(_0x40c1a1,null))['then'](respondWithResult(_0x40c1a1,null))[_0x21f4('0x16')](handleError(_0x40c1a1,null));};exports[_0x21f4('0x3c')]=function(_0x2f2658,_0xd786ff){var _0x2a4b05;return db[_0x21f4('0x24')][_0x21f4('0x3c')](_0x2f2658[_0x21f4('0x3d')],{'raw':!![]})['then'](function(_0x4abe90){_0x2a4b05=_0x4abe90;return db[_0x21f4('0x24')][_0x21f4('0x36')]({'where':{'type':_0x2f2658[_0x21f4('0x3d')][_0x21f4('0x33')]},'raw':!![]});})['then'](function(_0x22bbac){if(_0x2a4b05[_0x21f4('0x33')][_0x21f4('0x3e')]()=='STUN'){var _0x59b5d9=fs['readFileSync'](path[_0x21f4('0x3f')](config['root'],_0x21f4('0x40')),_0x21f4('0x41'));var _0x471ac6=ejs[_0x21f4('0x42')](_0x59b5d9,{'networks':_0x22bbac||[]});fs['writeFileSync'](_0x21f4('0x43'),_0x471ac6);return respondWithRpcPromise(_0x21f4('0x44'),'create',{'module':'res_stun_monitor.so'});}else if(_0x2a4b05['type'][_0x21f4('0x3e')]()==_0x21f4('0x45')){var _0x57966e=fs[_0x21f4('0x46')](path['join'](config[_0x21f4('0x47')],_0x21f4('0x48')),_0x21f4('0x41'));var _0x5e40b3=ejs[_0x21f4('0x42')](_0x57966e,{'networks':_0x22bbac||[]});fs[_0x21f4('0x49')](_0x21f4('0x4a'),_0x5e40b3);return respondWithRpcPromise(_0x21f4('0x44'),_0x21f4('0x3c'),{'module':'res_stun_monitor.so'});}else{var _0x23e089=fs[_0x21f4('0x46')](path[_0x21f4('0x3f')](config[_0x21f4('0x47')],_0x21f4('0x4b')),_0x21f4('0x41'));var _0x29a8f6=ejs[_0x21f4('0x42')](_0x23e089,{'networks':_0x22bbac||[]});fs[_0x21f4('0x49')](util[_0x21f4('0x4c')]('/etc/asterisk/sip_xcally_%s.conf',_0x2f2658[_0x21f4('0x3d')][_0x21f4('0x33')][_0x21f4('0x4d')]()),_0x29a8f6);return respondWithRpcPromise('Reload','create',{'module':_0x21f4('0x4e')});}})[_0x21f4('0xb')](function(){return _0x2a4b05;})[_0x21f4('0xb')](respondWithResult(_0xd786ff,0xc9))[_0x21f4('0x16')](handleError(_0xd786ff,null));};exports[_0x21f4('0x1f')]=function(_0x158a0c,_0x5e78c3){var _0xb5e76e;return db[_0x21f4('0x24')][_0x21f4('0x3b')]({'where':{'id':_0x158a0c[_0x21f4('0x38')]['id']}})[_0x21f4('0xb')](handleEntityNotFound(_0x5e78c3,null))[_0x21f4('0xb')](saveUpdates(_0x158a0c[_0x21f4('0x3d')],null))['then'](function(_0x20a42b){if(_0x20a42b){_0xb5e76e=_0x20a42b;return db[_0x21f4('0x24')]['findAll']({'where':{'type':_0xb5e76e['type']},'raw':!![]});}return null;})['then'](function(_0x5776b9){if(_0xb5e76e['type'][_0x21f4('0x3e')]()==_0x21f4('0x4f')){var _0x4a08e0=fs[_0x21f4('0x46')](path[_0x21f4('0x3f')](config[_0x21f4('0x47')],'server/files/templates/stun_multiple.ejs'),_0x21f4('0x41'));var _0x3ce0c1=ejs[_0x21f4('0x42')](_0x4a08e0,{'networks':_0x5776b9||[]});fs[_0x21f4('0x49')]('/etc/asterisk/stun_xcally.conf',_0x3ce0c1);return respondWithRpcPromise(_0x21f4('0x44'),_0x21f4('0x1f'),{'module':'res_stun_monitor.so'});}else if(_0xb5e76e[_0x21f4('0x33')][_0x21f4('0x3e')]()==_0x21f4('0x45')){var _0x5e25e7=fs['readFileSync'](path[_0x21f4('0x3f')](config[_0x21f4('0x47')],_0x21f4('0x48')),_0x21f4('0x41'));var _0x22b17a=ejs[_0x21f4('0x42')](_0x5e25e7,{'networks':_0x5776b9||[]});fs['writeFileSync'](_0x21f4('0x4a'),_0x22b17a);return respondWithRpcPromise('Reload',_0x21f4('0x1f'),{'module':'res_stun_monitor.so'});}else{var _0x13b8b6=fs['readFileSync'](path[_0x21f4('0x3f')](config['root'],_0x21f4('0x4b')),_0x21f4('0x41'));var _0x580249=ejs[_0x21f4('0x42')](_0x13b8b6,{'networks':_0x5776b9||[]});fs['writeFileSync'](util[_0x21f4('0x4c')](_0x21f4('0x50'),_0x158a0c[_0x21f4('0x3d')][_0x21f4('0x33')][_0x21f4('0x4d')]()),_0x580249);return respondWithRpcPromise(_0x21f4('0x44'),_0x21f4('0x1f'),{'module':'chan_sip.so'});}})['then'](function(_0x4fb8ea){if(_0x4fb8ea){return _0xb5e76e;}return null;})['then'](respondWithResult(_0x5e78c3,null))[_0x21f4('0x16')](handleError(_0x5e78c3,null));};exports[_0x21f4('0x20')]=function(_0xc2095a,_0xeefbbf){var _0x170db3;return db[_0x21f4('0x24')]['find']({'where':{'id':_0xc2095a[_0x21f4('0x38')]['id']}})[_0x21f4('0xb')](function(_0x55d991){_0x170db3=_0x55d991;return _0x55d991;})[_0x21f4('0xb')](handleEntityNotFound(_0xeefbbf,null))[_0x21f4('0xb')](removeEntity(_0xeefbbf,null))[_0x21f4('0xb')](function(){if(_0x170db3){return db[_0x21f4('0x24')][_0x21f4('0x36')]({'where':{'type':_0x170db3[_0x21f4('0x33')]},'raw':!![]});}})[_0x21f4('0xb')](function(_0x37d08c){if(_0x170db3[_0x21f4('0x33')][_0x21f4('0x3e')]()==_0x21f4('0x4f')){var _0x307748=fs[_0x21f4('0x46')](path['join'](config[_0x21f4('0x47')],'server/files/templates/stun_multiple.ejs'),_0x21f4('0x41'));var _0x4d8e57=ejs['render'](_0x307748,{'networks':_0x37d08c||[]});fs[_0x21f4('0x49')](_0x21f4('0x43'),_0x4d8e57);return respondWithRpcPromise(_0x21f4('0x44'),_0x21f4('0x20'),{'module':_0x21f4('0x51')});}else if(_0x170db3['type'][_0x21f4('0x3e')]()==_0x21f4('0x45')){var _0x427c9a=fs[_0x21f4('0x46')](path[_0x21f4('0x3f')](config[_0x21f4('0x47')],_0x21f4('0x48')),_0x21f4('0x41'));var _0xb06ac2=ejs[_0x21f4('0x42')](_0x427c9a,{'networks':_0x37d08c||[]});fs['writeFileSync'](_0x21f4('0x4a'),_0xb06ac2);return respondWithRpcPromise(_0x21f4('0x44'),_0x21f4('0x20'),{'module':_0x21f4('0x51')});}else{var _0x2bfa41=fs['readFileSync'](path[_0x21f4('0x3f')](config[_0x21f4('0x47')],_0x21f4('0x4b')),_0x21f4('0x41'));var _0x1543d9=ejs['render'](_0x2bfa41,{'networks':_0x37d08c||[]});fs[_0x21f4('0x49')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x170db3['type']['toLowerCase']()),_0x1543d9);return respondWithRpcPromise(_0x21f4('0x44'),'destroy',{'module':_0x21f4('0x4e')});}})[_0x21f4('0x16')](handleError(_0xeefbbf,null));}; \ No newline at end of file +var _0x42e4=['offset','set','Content-Range','update','destroy','end','sendStatus','stack','name','status','send','index','map','Network','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','params','include','find','create','body','findAll','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','toLowerCase','chan_sip.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','util','ejs','lodash','../../components/parsers/qs','api','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','json','undefined','limit','count'];(function(_0x14f3ad,_0x4cc94b){var _0x1eb1ce=function(_0xf430dd){while(--_0xf430dd){_0x14f3ad['push'](_0x14f3ad['shift']());}};_0x1eb1ce(++_0x4cc94b);}(_0x42e4,0x140));var _0x442e=function(_0x2263c5,_0x3a8311){_0x2263c5=_0x2263c5-0x0;var _0x4e10e6=_0x42e4[_0x2263c5];return _0x4e10e6;};'use strict';var util=require(_0x442e('0x0'));var path=require('path');var ejs=require(_0x442e('0x1'));var fs=require('fs');var _=require(_0x442e('0x2'));var qs=require(_0x442e('0x3'));var logger=require('../../config/logger')(_0x442e('0x4'));var config=require('../../config/environment');var db=require(_0x442e('0x5'))['db'];var jayson=require(_0x442e('0x6'));var client=jayson[_0x442e('0x7')][_0x442e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7c9c8b,_0x9705d4,_0x5ad771,_0x3a1416){return new Promise(function(_0x3d5738,_0x4a31ed){var _0x3dde75=_0x3a1416||client;return _0x3dde75[_0x442e('0x9')](_0x7c9c8b,_0x5ad771)[_0x442e('0xa')](function(_0x318cfc){logger[_0x442e('0xb')](_0x442e('0xc'),_0x9705d4,_0x442e('0xd'));logger['debug'](_0x442e('0xe'),_0x9705d4,_0x442e('0xd'),JSON[_0x442e('0xf')](_0x318cfc));if(_0x318cfc[_0x442e('0x10')]){if(_0x318cfc['error']['code']===0x1f4){logger[_0x442e('0x10')]('Network,\x20%s,\x20%s',_0x9705d4,_0x318cfc[_0x442e('0x10')][_0x442e('0x11')]);return _0x4a31ed(_0x318cfc[_0x442e('0x10')][_0x442e('0x11')]);}logger['error'](_0x442e('0xc'),_0x9705d4,_0x318cfc['error'][_0x442e('0x11')]);return _0x3d5738(_0x318cfc['error']['message']);}else{logger[_0x442e('0xb')]('Network,\x20%s,\x20%s',_0x9705d4,_0x442e('0xd'));_0x3d5738(_0x318cfc[_0x442e('0x12')][_0x442e('0x11')]);}})[_0x442e('0x13')](function(_0x429a3f){logger[_0x442e('0x10')](_0x442e('0xc'),_0x9705d4,_0x429a3f);_0x4a31ed(_0x429a3f);});});}function respondWithResult(_0x51303d,_0x6adc57){_0x6adc57=_0x6adc57||0xc8;return function(_0x3eb296){if(_0x3eb296){return _0x51303d['status'](_0x6adc57)[_0x442e('0x14')](_0x3eb296);}};}function respondWithFilteredResult(_0x8cb5a4,_0x1a2340){return function(_0x15f433){if(_0x15f433){var _0x3b6071=typeof _0x1a2340['offset']===_0x442e('0x15')&&typeof _0x1a2340[_0x442e('0x16')]===_0x442e('0x15');var _0x25ac8a=_0x15f433[_0x442e('0x17')];var _0x527ab2=_0x3b6071?0x0:_0x1a2340[_0x442e('0x18')];var _0x1fbec9=_0x3b6071?_0x15f433[_0x442e('0x17')]:_0x1a2340[_0x442e('0x18')]+_0x1a2340[_0x442e('0x16')];var _0x413b50;if(_0x1fbec9>=_0x25ac8a){_0x1fbec9=_0x25ac8a;_0x413b50=0xc8;}else{_0x413b50=0xce;}_0x8cb5a4['status'](_0x413b50);return _0x8cb5a4[_0x442e('0x19')](_0x442e('0x1a'),_0x527ab2+'-'+_0x1fbec9+'/'+_0x25ac8a)[_0x442e('0x14')](_0x15f433);}return null;};}function saveUpdates(_0x5effff){return function(_0x574aed){if(_0x574aed){return _0x574aed[_0x442e('0x1b')](_0x5effff)[_0x442e('0xa')](function(_0x401231){return _0x401231;});}return null;};}function removeEntity(_0x421656){return function(_0xbe0cda){if(_0xbe0cda){return _0xbe0cda[_0x442e('0x1c')]()[_0x442e('0xa')](function(){_0x421656['status'](0xcc)[_0x442e('0x1d')]();});}};}function handleEntityNotFound(_0xb17059){return function(_0x9ed63f){if(!_0x9ed63f){_0xb17059[_0x442e('0x1e')](0x194);}return _0x9ed63f;};}function handleError(_0xa4a38a,_0x28baf4){_0x28baf4=_0x28baf4||0x1f4;return function(_0x48f190){logger['error'](_0x48f190[_0x442e('0x1f')]);if(_0x48f190[_0x442e('0x20')]){delete _0x48f190['name'];}_0xa4a38a[_0x442e('0x21')](_0x28baf4)[_0x442e('0x22')](_0x48f190);};}exports[_0x442e('0x23')]=function(_0x2d0dc0,_0x5a400c){var _0x3b692e={},_0x24f1d4={},_0x209dbd={'count':0x0,'rows':[]};var _0x58d857=_[_0x442e('0x24')](db[_0x442e('0x25')][_0x442e('0x26')],function(_0x15170f){return{'name':_0x15170f[_0x442e('0x27')],'type':_0x15170f[_0x442e('0x28')][_0x442e('0x29')]};});_0x24f1d4['model']=_[_0x442e('0x24')](_0x58d857,_0x442e('0x20'));_0x24f1d4[_0x442e('0x2a')]=_[_0x442e('0x2b')](_0x2d0dc0['query']);_0x24f1d4[_0x442e('0x2c')]=_[_0x442e('0x2d')](_0x24f1d4[_0x442e('0x2e')],_0x24f1d4[_0x442e('0x2a')]);_0x3b692e[_0x442e('0x2f')]=_[_0x442e('0x2d')](_0x24f1d4['model'],qs[_0x442e('0x30')](_0x2d0dc0[_0x442e('0x2a')][_0x442e('0x30')]));_0x3b692e[_0x442e('0x2f')]=_0x3b692e[_0x442e('0x2f')][_0x442e('0x31')]?_0x3b692e['attributes']:_0x24f1d4['model'];if(!_0x2d0dc0[_0x442e('0x2a')][_0x442e('0x32')](_0x442e('0x33'))){_0x3b692e['limit']=qs[_0x442e('0x16')](_0x2d0dc0['query'][_0x442e('0x16')]);_0x3b692e['offset']=qs[_0x442e('0x18')](_0x2d0dc0['query'][_0x442e('0x18')]);}_0x3b692e[_0x442e('0x34')]=qs[_0x442e('0x35')](_0x2d0dc0[_0x442e('0x2a')]['sort']);_0x3b692e['where']=qs[_0x442e('0x2c')](_[_0x442e('0x36')](_0x2d0dc0[_0x442e('0x2a')],_0x24f1d4[_0x442e('0x2c')]),_0x58d857);if(_0x2d0dc0['query'][_0x442e('0x37')]){_0x3b692e[_0x442e('0x38')]=_[_0x442e('0x39')](_0x3b692e['where'],{'$or':_[_0x442e('0x24')](_0x58d857,function(_0x56e8a0){if(_0x56e8a0[_0x442e('0x28')]!=='VIRTUAL'){var _0x2bb77f={};_0x2bb77f[_0x56e8a0[_0x442e('0x20')]]={'$like':'%'+_0x2d0dc0[_0x442e('0x2a')][_0x442e('0x37')]+'%'};return _0x2bb77f;}})});}_0x3b692e=_[_0x442e('0x39')]({},_0x3b692e,_0x2d0dc0[_0x442e('0x3a')]);var _0x3c99f8={'where':_0x3b692e['where']};return db[_0x442e('0x25')]['count'](_0x3c99f8)[_0x442e('0xa')](function(_0x2a8332){_0x209dbd[_0x442e('0x17')]=_0x2a8332;if(_0x2d0dc0[_0x442e('0x2a')][_0x442e('0x3b')]){_0x3b692e['include']=[{'all':!![]}];}return db[_0x442e('0x25')]['findAll'](_0x3b692e);})[_0x442e('0xa')](function(_0xe713cc){_0x209dbd['rows']=_0xe713cc;return _0x209dbd;})[_0x442e('0xa')](respondWithFilteredResult(_0x5a400c,_0x3b692e))[_0x442e('0x13')](handleError(_0x5a400c,null));};exports['show']=function(_0x3efee2,_0x42d04c){var _0x42a622={'raw':!![],'where':{'id':_0x3efee2[_0x442e('0x3c')]['id']}},_0xcef01b={};_0xcef01b[_0x442e('0x2e')]=_[_0x442e('0x2b')](db['Network'][_0x442e('0x26')]);_0xcef01b['query']=_[_0x442e('0x2b')](_0x3efee2[_0x442e('0x2a')]);_0xcef01b[_0x442e('0x2c')]=_['intersection'](_0xcef01b[_0x442e('0x2e')],_0xcef01b[_0x442e('0x2a')]);_0x42a622['attributes']=_[_0x442e('0x2d')](_0xcef01b[_0x442e('0x2e')],qs[_0x442e('0x30')](_0x3efee2[_0x442e('0x2a')][_0x442e('0x30')]));_0x42a622[_0x442e('0x2f')]=_0x42a622[_0x442e('0x2f')][_0x442e('0x31')]?_0x42a622[_0x442e('0x2f')]:_0xcef01b[_0x442e('0x2e')];if(_0x3efee2[_0x442e('0x2a')][_0x442e('0x3b')]){_0x42a622[_0x442e('0x3d')]=[{'all':!![]}];}_0x42a622=_['merge']({},_0x42a622,_0x3efee2[_0x442e('0x3a')]);return db[_0x442e('0x25')][_0x442e('0x3e')](_0x42a622)['then'](handleEntityNotFound(_0x42d04c,null))[_0x442e('0xa')](respondWithResult(_0x42d04c,null))[_0x442e('0x13')](handleError(_0x42d04c,null));};exports[_0x442e('0x3f')]=function(_0x1c50e9,_0xbfc62b){var _0xf4ce79;return db['Network'][_0x442e('0x3f')](_0x1c50e9[_0x442e('0x40')],{'raw':!![]})[_0x442e('0xa')](function(_0x42cb87){_0xf4ce79=_0x42cb87;return db['Network'][_0x442e('0x41')]({'where':{'type':_0x1c50e9[_0x442e('0x40')][_0x442e('0x28')]},'raw':!![]});})['then'](function(_0xbdb52a){if(_0xf4ce79[_0x442e('0x28')]['toUpperCase']()==_0x442e('0x42')){var _0x1b679d=fs[_0x442e('0x43')](path[_0x442e('0x44')](config[_0x442e('0x45')],_0x442e('0x46')),_0x442e('0x47'));var _0x13d93d=ejs[_0x442e('0x48')](_0x1b679d,{'networks':_0xbdb52a||[]});fs[_0x442e('0x49')](_0x442e('0x4a'),_0x13d93d);return respondWithRpcPromise(_0x442e('0x4b'),_0x442e('0x3f'),{'module':_0x442e('0x4c')});}else if(_0xf4ce79[_0x442e('0x28')][_0x442e('0x4d')]()==_0x442e('0x4e')){var _0x150def=fs[_0x442e('0x43')](path[_0x442e('0x44')](config[_0x442e('0x45')],_0x442e('0x4f')),'utf8');var _0x56c014=ejs[_0x442e('0x48')](_0x150def,{'networks':_0xbdb52a||[]});fs[_0x442e('0x49')](_0x442e('0x50'),_0x56c014);return respondWithRpcPromise(_0x442e('0x4b'),_0x442e('0x3f'),{'module':_0x442e('0x4c')});}else{var _0x2d37b1=fs[_0x442e('0x43')](path[_0x442e('0x44')](config[_0x442e('0x45')],'server/files/templates/network.ejs'),'utf8');var _0x57fb47=ejs[_0x442e('0x48')](_0x2d37b1,{'networks':_0xbdb52a||[]});fs[_0x442e('0x49')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x1c50e9[_0x442e('0x40')][_0x442e('0x28')][_0x442e('0x51')]()),_0x57fb47);return respondWithRpcPromise('Reload','create',{'module':_0x442e('0x52')});}})[_0x442e('0xa')](function(){return _0xf4ce79;})[_0x442e('0xa')](respondWithResult(_0xbfc62b,0xc9))[_0x442e('0x13')](handleError(_0xbfc62b,null));};exports[_0x442e('0x1b')]=function(_0x380f3a,_0x4cdee7){var _0x368e74;return db[_0x442e('0x25')][_0x442e('0x3e')]({'where':{'id':_0x380f3a[_0x442e('0x3c')]['id']}})[_0x442e('0xa')](handleEntityNotFound(_0x4cdee7,null))['then'](saveUpdates(_0x380f3a['body'],null))[_0x442e('0xa')](function(_0x232606){if(_0x232606){_0x368e74=_0x232606;return db[_0x442e('0x25')][_0x442e('0x41')]({'where':{'type':_0x368e74[_0x442e('0x28')]},'raw':!![]});}return null;})[_0x442e('0xa')](function(_0x31ecdb){if(_0x368e74[_0x442e('0x28')][_0x442e('0x4d')]()==_0x442e('0x42')){var _0x59b9c6=fs['readFileSync'](path[_0x442e('0x44')](config[_0x442e('0x45')],_0x442e('0x46')),_0x442e('0x47'));var _0x322b6a=ejs[_0x442e('0x48')](_0x59b9c6,{'networks':_0x31ecdb||[]});fs[_0x442e('0x49')](_0x442e('0x4a'),_0x322b6a);return respondWithRpcPromise('Reload',_0x442e('0x1b'),{'module':_0x442e('0x4c')});}else if(_0x368e74['type'][_0x442e('0x4d')]()=='TURN'){var _0x37f449=fs[_0x442e('0x43')](path['join'](config[_0x442e('0x45')],_0x442e('0x4f')),'utf8');var _0x2686b9=ejs[_0x442e('0x48')](_0x37f449,{'networks':_0x31ecdb||[]});fs[_0x442e('0x49')](_0x442e('0x50'),_0x2686b9);return respondWithRpcPromise(_0x442e('0x4b'),'update',{'module':'res_stun_monitor.so'});}else{var _0x35d09c=fs[_0x442e('0x43')](path['join'](config[_0x442e('0x45')],_0x442e('0x53')),'utf8');var _0x3887e2=ejs[_0x442e('0x48')](_0x35d09c,{'networks':_0x31ecdb||[]});fs[_0x442e('0x49')](util[_0x442e('0x54')]('/etc/asterisk/sip_xcally_%s.conf',_0x380f3a[_0x442e('0x40')][_0x442e('0x28')][_0x442e('0x51')]()),_0x3887e2);return respondWithRpcPromise(_0x442e('0x4b'),_0x442e('0x1b'),{'module':'chan_sip.so'});}})['then'](function(_0x3aa62e){if(_0x3aa62e){return _0x368e74;}return null;})[_0x442e('0xa')](respondWithResult(_0x4cdee7,null))[_0x442e('0x13')](handleError(_0x4cdee7,null));};exports[_0x442e('0x1c')]=function(_0x12993b,_0x3e1406){var _0x18ef0e;return db[_0x442e('0x25')][_0x442e('0x3e')]({'where':{'id':_0x12993b[_0x442e('0x3c')]['id']}})[_0x442e('0xa')](function(_0x266655){_0x18ef0e=_0x266655;return _0x266655;})[_0x442e('0xa')](handleEntityNotFound(_0x3e1406,null))[_0x442e('0xa')](removeEntity(_0x3e1406,null))['then'](function(){if(_0x18ef0e){return db['Network']['findAll']({'where':{'type':_0x18ef0e[_0x442e('0x28')]},'raw':!![]});}})[_0x442e('0xa')](function(_0x26ac9a){if(_0x18ef0e['type'][_0x442e('0x4d')]()==_0x442e('0x42')){var _0x1daf33=fs[_0x442e('0x43')](path['join'](config[_0x442e('0x45')],'server/files/templates/stun_multiple.ejs'),_0x442e('0x47'));var _0x5742a6=ejs['render'](_0x1daf33,{'networks':_0x26ac9a||[]});fs[_0x442e('0x49')](_0x442e('0x4a'),_0x5742a6);return respondWithRpcPromise('Reload','destroy',{'module':_0x442e('0x4c')});}else if(_0x18ef0e[_0x442e('0x28')]['toUpperCase']()==_0x442e('0x4e')){var _0x1fbe44=fs[_0x442e('0x43')](path[_0x442e('0x44')](config[_0x442e('0x45')],'server/files/templates/turn_multiple.ejs'),_0x442e('0x47'));var _0x5da1c3=ejs[_0x442e('0x48')](_0x1fbe44,{'networks':_0x26ac9a||[]});fs[_0x442e('0x49')](_0x442e('0x50'),_0x5da1c3);return respondWithRpcPromise(_0x442e('0x4b'),_0x442e('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x283878=fs[_0x442e('0x43')](path[_0x442e('0x44')](config[_0x442e('0x45')],_0x442e('0x53')),_0x442e('0x47'));var _0x155453=ejs[_0x442e('0x48')](_0x283878,{'networks':_0x26ac9a||[]});fs[_0x442e('0x49')](util['format'](_0x442e('0x55'),_0x18ef0e[_0x442e('0x28')][_0x442e('0x51')]()),_0x155453);return respondWithRpcPromise(_0x442e('0x4b'),_0x442e('0x1c'),{'module':_0x442e('0x52')});}})[_0x442e('0x13')](handleError(_0x3e1406,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 1a62faa..4be2643 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 _0x44a3=['moment','bluebird','request-promise','path','../../config/environment','./network.attributes','exports','lodash','util','../../config/logger','api'];(function(_0x3e7a1e,_0x1589be){var _0x267c30=function(_0x1f6a70){while(--_0x1f6a70){_0x3e7a1e['push'](_0x3e7a1e['shift']());}};_0x267c30(++_0x1589be);}(_0x44a3,0x1a9));var _0x344a=function(_0x2d6df9,_0x45da50){_0x2d6df9=_0x2d6df9-0x0;var _0x429b18=_0x44a3[_0x2d6df9];return _0x429b18;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var logger=require(_0x344a('0x2'))(_0x344a('0x3'));var moment=require(_0x344a('0x4'));var BPromise=require(_0x344a('0x5'));var rp=require(_0x344a('0x6'));var fs=require('fs');var path=require(_0x344a('0x7'));var rimraf=require('rimraf');var config=require(_0x344a('0x8'));var attributes=require(_0x344a('0x9'));module[_0x344a('0xa')]=function(_0x28b51e,_0x39984a){return _0x28b51e['define']('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9567=['lodash','util','../../config/logger','api','moment','path','rimraf','./network.attributes','define','Network'];(function(_0x38b28b,_0x385ecf){var _0x202c86=function(_0x15cd9b){while(--_0x15cd9b){_0x38b28b['push'](_0x38b28b['shift']());}};_0x202c86(++_0x385ecf);}(_0x9567,0xdc));var _0x7956=function(_0x348050,_0x2ae61d){_0x348050=_0x348050-0x0;var _0x315664=_0x9567[_0x348050];return _0x315664;};'use strict';var _=require(_0x7956('0x0'));var util=require(_0x7956('0x1'));var logger=require(_0x7956('0x2'))(_0x7956('0x3'));var moment=require(_0x7956('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7956('0x5'));var rimraf=require(_0x7956('0x6'));var config=require('../../config/environment');var attributes=require(_0x7956('0x7'));module['exports']=function(_0x12c09e,_0x48c4b6){return _0x12c09e[_0x7956('0x8')](_0x7956('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 2e3b9e6..40bfe4d 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(_0x34c870,_0x5df6dc){_0x34c870=_0x34c870-0x0;var _0x1be0a3=_0x7a54[_0x34c870];return _0x1be0a3;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x41bbcd,_0x5647f3){_0x41bbcd=_0x41bbcd-0x0;var _0x1cf91e=_0x7a54[_0x41bbcd];return _0x1cf91e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 84af339..ba6a978 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 _0x8af7=['post','create','/:id/dispositions','addDisposition','notify','addAgents','/:id/send','send','put','/:id','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','/describe','show','getDispositions','/:id/canned_answers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x8af7,0x19c));var _0x78af=function(_0x1d6d86,_0x3a18a7){_0x1d6d86=_0x1d6d86-0x0;var _0x161855=_0x8af7[_0x1d6d86];return _0x161855;};'use strict';var multer=require(_0x78af('0x0'));var util=require(_0x78af('0x1'));var path=require('path');var timeout=require(_0x78af('0x2'));var express=require(_0x78af('0x3'));var router=express[_0x78af('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x78af('0x5'));var interaction=require(_0x78af('0x6'));var config=require(_0x78af('0x7'));var controller=require(_0x78af('0x8'));router[_0x78af('0x9')]('/',auth[_0x78af('0xa')](),controller['index']);router[_0x78af('0x9')](_0x78af('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x78af('0xa')](),controller[_0x78af('0xc')]);router[_0x78af('0x9')]('/:id/dispositions',auth[_0x78af('0xa')](),controller[_0x78af('0xd')]);router['get'](_0x78af('0xe'),auth[_0x78af('0xa')](),controller['getAnswers']);router['get'](_0x78af('0xf'),auth[_0x78af('0xa')](),controller[_0x78af('0x10')]);router[_0x78af('0x9')]('/:id/interactions',auth[_0x78af('0xa')](),controller[_0x78af('0x11')]);router[_0x78af('0x9')](_0x78af('0x12'),auth[_0x78af('0xa')](),controller[_0x78af('0x13')]);router[_0x78af('0x14')]('/',auth[_0x78af('0xa')](),controller[_0x78af('0x15')]);router['post'](_0x78af('0x16'),auth[_0x78af('0xa')](),controller[_0x78af('0x17')]);router['post'](_0x78af('0xe'),auth[_0x78af('0xa')](),controller['addAnswer']);router[_0x78af('0x14')]('/:id/notify',controller[_0x78af('0x18')]);router['post'](_0x78af('0xf'),auth[_0x78af('0xa')](),controller['addApplications']);router['post'](_0x78af('0x12'),auth[_0x78af('0xa')](),controller[_0x78af('0x19')]);router[_0x78af('0x14')](_0x78af('0x1a'),auth[_0x78af('0xa')](),controller[_0x78af('0x1b')]);router[_0x78af('0x1c')](_0x78af('0x1d'),auth[_0x78af('0xa')](),controller[_0x78af('0x1e')]);router[_0x78af('0x1f')](_0x78af('0x1d'),auth['isAuthenticated'](),controller['destroy']);router[_0x78af('0x1f')](_0x78af('0x16'),auth[_0x78af('0xa')](),controller[_0x78af('0x20')]);router[_0x78af('0x1f')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x78af('0x21')]);router[_0x78af('0x1f')](_0x78af('0x12'),auth['isAuthenticated'](),controller[_0x78af('0x22')]);module[_0x78af('0x23')]=router; \ No newline at end of file +var _0x2dcb=['isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','/:id/users','getAgents','post','/:id/notify','notify','addApplications','addAgents','/:id/send','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get'];(function(_0x280875,_0x3370d4){var _0x1f181e=function(_0x4cb04a){while(--_0x4cb04a){_0x280875['push'](_0x280875['shift']());}};_0x1f181e(++_0x3370d4);}(_0x2dcb,0xf1));var _0xb2dc=function(_0x30c951,_0x17845f){_0x30c951=_0x30c951-0x0;var _0x578d97=_0x2dcb[_0x30c951];return _0x578d97;};'use strict';var multer=require(_0xb2dc('0x0'));var util=require(_0xb2dc('0x1'));var path=require('path');var timeout=require(_0xb2dc('0x2'));var express=require(_0xb2dc('0x3'));var router=express[_0xb2dc('0x4')]();var fs_extra=require(_0xb2dc('0x5'));var auth=require(_0xb2dc('0x6'));var interaction=require(_0xb2dc('0x7'));var config=require(_0xb2dc('0x8'));var controller=require(_0xb2dc('0x9'));router[_0xb2dc('0xa')]('/',auth[_0xb2dc('0xb')](),controller['index']);router['get'](_0xb2dc('0xc'),auth[_0xb2dc('0xb')](),controller[_0xb2dc('0xd')]);router['get'](_0xb2dc('0xe'),auth['isAuthenticated'](),controller[_0xb2dc('0xf')]);router[_0xb2dc('0xa')](_0xb2dc('0x10'),auth[_0xb2dc('0xb')](),controller['getDispositions']);router[_0xb2dc('0xa')](_0xb2dc('0x11'),auth[_0xb2dc('0xb')](),controller['getAnswers']);router[_0xb2dc('0xa')](_0xb2dc('0x12'),auth[_0xb2dc('0xb')](),controller[_0xb2dc('0x13')]);router[_0xb2dc('0xa')](_0xb2dc('0x14'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xb2dc('0xa')](_0xb2dc('0x15'),auth[_0xb2dc('0xb')](),controller[_0xb2dc('0x16')]);router['post']('/',auth[_0xb2dc('0xb')](),controller['create']);router[_0xb2dc('0x17')](_0xb2dc('0x10'),auth[_0xb2dc('0xb')](),controller['addDisposition']);router[_0xb2dc('0x17')]('/:id/canned_answers',auth[_0xb2dc('0xb')](),controller['addAnswer']);router[_0xb2dc('0x17')](_0xb2dc('0x18'),controller[_0xb2dc('0x19')]);router[_0xb2dc('0x17')]('/:id/applications',auth[_0xb2dc('0xb')](),controller[_0xb2dc('0x1a')]);router[_0xb2dc('0x17')](_0xb2dc('0x15'),auth[_0xb2dc('0xb')](),controller[_0xb2dc('0x1b')]);router[_0xb2dc('0x17')](_0xb2dc('0x1c'),auth[_0xb2dc('0xb')](),controller['send']);router[_0xb2dc('0x1d')](_0xb2dc('0xe'),auth[_0xb2dc('0xb')](),controller[_0xb2dc('0x1e')]);router[_0xb2dc('0x1f')](_0xb2dc('0xe'),auth['isAuthenticated'](),controller[_0xb2dc('0x20')]);router['delete']('/:id/dispositions',auth[_0xb2dc('0xb')](),controller['removeDispositions']);router[_0xb2dc('0x1f')](_0xb2dc('0x11'),auth['isAuthenticated'](),controller[_0xb2dc('0x21')]);router[_0xb2dc('0x1f')](_0xb2dc('0x15'),auth[_0xb2dc('0xb')](),controller[_0xb2dc('0x22')]);module[_0xb2dc('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index c34a1ed..e70caac 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 _0x8ce9=['STRING','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','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports'];(function(_0x5c2762,_0x5692c1){var _0x33e650=function(_0x2a7283){while(--_0x2a7283){_0x5c2762['push'](_0x5c2762['shift']());}};_0x33e650(++_0x5692c1);}(_0x8ce9,0xed));var _0x98ce=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x8ce9[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0x98ce('0x0'));var rs=require(_0x98ce('0x1'));module[_0x98ce('0x2')]={'name':{'type':Sequelize[_0x98ce('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x98ce('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x98ce('0x4')]();}},'replyUri':{'type':Sequelize[_0x98ce('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x98ce('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x98ce('0x5')],'defaultValue':function(){return _0x98ce('0x6');}},'notificationSound':{'type':Sequelize[_0x98ce('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x98ce('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x98ce('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x98ce('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x98ce('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x98ce('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x98ce('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x20690a){if(!_0x20690a)this[_0x98ce('0xa')](_0x98ce('0xb'),null);this['setDataValue']('mandatoryDisposition',_0x20690a);}}}; \ No newline at end of file +var _0xef07=['name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING'];(function(_0x19a455,_0x297430){var _0xe28e37=function(_0x5c9fcc){while(--_0x5c9fcc){_0x19a455['push'](_0x19a455['shift']());}};_0xe28e37(++_0x297430);}(_0xef07,0x135));var _0x7ef0=function(_0x228641,_0x25d636){_0x228641=_0x228641-0x0;var _0x5d5d78=_0xef07[_0x228641];return _0x5d5d78;};'use strict';var Sequelize=require(_0x7ef0('0x0'));var rs=require(_0x7ef0('0x1'));module['exports']={'name':{'type':Sequelize[_0x7ef0('0x2')],'unique':_0x7ef0('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7ef0('0x2')]},'token':{'type':Sequelize[_0x7ef0('0x2')],'defaultValue':function(){return rs[_0x7ef0('0x4')]();}},'replyUri':{'type':Sequelize[_0x7ef0('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x7ef0('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7ef0('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7ef0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x7ef0('0x2')]},'queueTransfer':{'type':Sequelize[_0x7ef0('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7ef0('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7ef0('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7ef0('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x7ef0('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x7ef0('0x7')],'defaultValue':![],'comment':_0x7ef0('0x9'),'set':function(_0x282878){if(!_0x282878)this[_0x7ef0('0xa')](_0x7ef0('0xb'),null);this[_0x7ef0('0xa')](_0x7ef0('0xc'),_0x282878);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 1997648..faa71c1 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 _0x3297=['unshift','waitForTheAssignedAgent','Start','startRouting','sequelize','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','stack','finally','getApplications','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','isArray','userOpenchannelAccount:remove','getAgents','defaults','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','get','OpenchannelAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','VIRTUAL','OpenchannelAccount','includeAll','include','findAll','rows','show','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','destroy','describe','addDisposition','params','OpenchannelAccountId','getDispositions','hasOwnProperty','pick','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','Contacts','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','UserId'];(function(_0xcf93ad,_0x4717dd){var _0x20764c=function(_0x258ecc){while(--_0x258ecc){_0xcf93ad['push'](_0xcf93ad['shift']());}};_0x20764c(++_0x4717dd);}(_0x3297,0x19f));var _0x7329=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3297[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7329('0x0'));var rimraf=require(_0x7329('0x1'));var zipdir=require(_0x7329('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7329('0x3'));var moment=require(_0x7329('0x4'));var BPromise=require(_0x7329('0x5'));var Mustache=require('mustache');var util=require(_0x7329('0x6'));var path=require(_0x7329('0x7'));var sox=require(_0x7329('0x8'));var csv=require(_0x7329('0x9'));var ejs=require(_0x7329('0xa'));var fs=require('fs');var fs_extra=require(_0x7329('0xb'));var _=require(_0x7329('0xc'));var squel=require(_0x7329('0xd'));var crypto=require(_0x7329('0xe'));var jsforce=require(_0x7329('0xf'));var deskjs=require(_0x7329('0x10'));var toCsv=require(_0x7329('0x9'));var querystring=require('querystring');var Papa=require(_0x7329('0x11'));var Redis=require('ioredis');var authService=require(_0x7329('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7329('0x13'));var logger=require('../../config/logger')(_0x7329('0x14'));var utils=require(_0x7329('0x15'));var config=require(_0x7329('0x16'));var licenseUtil=require(_0x7329('0x17'));var db=require(_0x7329('0x18'))['db'];config[_0x7329('0x19')]=_['defaults'](config[_0x7329('0x19')],{'host':_0x7329('0x1a'),'port':0x18eb});var socket=require(_0x7329('0x1b'))(new Redis(config[_0x7329('0x19')]));require(_0x7329('0x1c'))[_0x7329('0x1d')](socket);var jayson=require(_0x7329('0x1e'));var client=jayson[_0x7329('0x1f')][_0x7329('0x20')]({'port':0x232c});var client9002=jayson[_0x7329('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a2059,_0x45127e,_0x6b78bd,_0x34daf4){return new BPromise(function(_0x581dd5,_0x156df8){var _0xe7e620=_0x34daf4||client;return _0xe7e620[_0x7329('0x21')](_0x4a2059,_0x6b78bd)[_0x7329('0x22')](function(_0x21bec9){logger[_0x7329('0x23')](_0x7329('0x24'),_0x45127e,_0x7329('0x25'));logger[_0x7329('0x26')](_0x7329('0x27'),_0x45127e,_0x7329('0x25'),JSON['stringify'](_0x21bec9));if(_0x21bec9[_0x7329('0x28')]){if(_0x21bec9[_0x7329('0x28')][_0x7329('0x29')]===0x1f4){logger[_0x7329('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x45127e,_0x21bec9[_0x7329('0x28')][_0x7329('0x2a')]);return _0x156df8(_0x21bec9[_0x7329('0x28')][_0x7329('0x2a')]);}logger[_0x7329('0x28')](_0x7329('0x24'),_0x45127e,_0x21bec9[_0x7329('0x28')][_0x7329('0x2a')]);return _0x581dd5(_0x21bec9[_0x7329('0x28')]['message']);}else{logger['info'](_0x7329('0x24'),_0x45127e,_0x7329('0x25'));_0x581dd5(_0x21bec9[_0x7329('0x2b')][_0x7329('0x2a')]);}})[_0x7329('0x2c')](function(_0x433db6){logger[_0x7329('0x28')](_0x7329('0x24'),_0x45127e,_0x433db6);_0x156df8(_0x433db6);});});}function respondWithStatusCode(_0x3d8bd1,_0x104a8e){_0x104a8e=_0x104a8e||0xcc;return function(_0x52e6fd){if(_0x52e6fd){return _0x3d8bd1[_0x7329('0x2d')](_0x104a8e);}return _0x3d8bd1[_0x7329('0x2e')](_0x104a8e)[_0x7329('0x2f')]();};}function respondWithResult(_0x30af75,_0x4af8aa){_0x4af8aa=_0x4af8aa||0xc8;return function(_0x591719){if(_0x591719){return _0x30af75[_0x7329('0x2e')](_0x4af8aa)[_0x7329('0x30')](_0x591719);}};}function respondWithFilteredResult(_0x412266,_0x34d4e0){return function(_0x3b7f9a){if(_0x3b7f9a){var _0x5a3be1=typeof _0x34d4e0[_0x7329('0x31')]===_0x7329('0x32')&&typeof _0x34d4e0[_0x7329('0x33')]===_0x7329('0x32');var _0x29ee4a=_0x3b7f9a[_0x7329('0x34')];var _0x3e7f42=_0x5a3be1?0x0:_0x34d4e0[_0x7329('0x31')];var _0x4d5b91=_0x5a3be1?_0x3b7f9a['count']:_0x34d4e0[_0x7329('0x31')]+_0x34d4e0[_0x7329('0x33')];var _0x2c3a60;if(_0x4d5b91>=_0x29ee4a){_0x4d5b91=_0x29ee4a;_0x2c3a60=0xc8;}else{_0x2c3a60=0xce;}_0x412266['status'](_0x2c3a60);return _0x412266[_0x7329('0x35')](_0x7329('0x36'),_0x3e7f42+'-'+_0x4d5b91+'/'+_0x29ee4a)[_0x7329('0x30')](_0x3b7f9a);}return null;};}function patchUpdates(_0x26d24f){return function(_0x112bcf){try{jsonpatch[_0x7329('0x37')](_0x112bcf,_0x26d24f,!![]);}catch(_0x392047){return BPromise[_0x7329('0x38')](_0x392047);}return _0x112bcf[_0x7329('0x39')]();};}function saveUpdates(_0x376c64,_0x1d9bb2){return function(_0x53b2cf){if(_0x53b2cf){return _0x53b2cf['update'](_0x376c64)['then'](function(_0x561c83){return _0x561c83;});}return null;};}function removeEntity(_0x307529,_0x1d20f9){return function(_0x3063af){if(_0x3063af){return _0x3063af['destroy']()[_0x7329('0x22')](function(){var _0x49e4cc=_0x3063af[_0x7329('0x3a')]({'plain':!![]});var _0x217f94=_0x7329('0x3b');return db[_0x7329('0x3c')]['destroy']({'where':{'type':_0x217f94,'resourceId':_0x49e4cc['id']}})[_0x7329('0x22')](function(){return _0x3063af;});})[_0x7329('0x22')](function(){_0x307529[_0x7329('0x2e')](0xcc)[_0x7329('0x2f')]();});}};}function handleEntityNotFound(_0x17a4b1,_0x2f4fb8){return function(_0xda7a0e){if(!_0xda7a0e){_0x17a4b1[_0x7329('0x2d')](0x194);}return _0xda7a0e;};}function handleError(_0x3b40be,_0x54584f){_0x54584f=_0x54584f||0x1f4;return function(_0x55fdef){logger['error'](_0x55fdef['stack']);if(_0x55fdef[_0x7329('0x3d')]){delete _0x55fdef[_0x7329('0x3d')];}_0x3b40be['status'](_0x54584f)[_0x7329('0x3e')](_0x55fdef);};}exports[_0x7329('0x3f')]=function(_0x80af9b,_0x1ba7f2){var _0x8788a0={'include':[{'model':db[_0x7329('0x40')],'as':_0x7329('0x41')}]},_0x356a24={},_0x5a031c={'count':0x0,'rows':[]};var _0x4eedb2=_[_0x7329('0x42')](db['OpenchannelAccount'][_0x7329('0x43')],function(_0x319796){return{'name':_0x319796['fieldName'],'type':_0x319796[_0x7329('0x44')]['key']};});_0x356a24[_0x7329('0x45')]=_['map'](_0x4eedb2,_0x7329('0x3d'));_0x356a24[_0x7329('0x46')]=_[_0x7329('0x47')](_0x80af9b[_0x7329('0x46')]);_0x356a24[_0x7329('0x48')]=_[_0x7329('0x49')](_0x356a24['model'],_0x356a24['query']);_0x8788a0[_0x7329('0x4a')]=_['intersection'](_0x356a24[_0x7329('0x45')],qs[_0x7329('0x4b')](_0x80af9b['query'][_0x7329('0x4b')]));_0x8788a0[_0x7329('0x4a')]=_0x8788a0[_0x7329('0x4a')]['length']?_0x8788a0[_0x7329('0x4a')]:_0x356a24['model'];if(!_0x80af9b['query']['hasOwnProperty'](_0x7329('0x4c'))){_0x8788a0[_0x7329('0x33')]=qs[_0x7329('0x33')](_0x80af9b['query'][_0x7329('0x33')]);_0x8788a0[_0x7329('0x31')]=qs[_0x7329('0x31')](_0x80af9b[_0x7329('0x46')]['offset']);}_0x8788a0[_0x7329('0x4d')]=qs['sort'](_0x80af9b[_0x7329('0x46')][_0x7329('0x4e')]);_0x8788a0[_0x7329('0x4f')]=qs[_0x7329('0x48')](_['pick'](_0x80af9b['query'],_0x356a24['filters']),_0x4eedb2);if(_0x80af9b[_0x7329('0x46')][_0x7329('0x50')]){_0x8788a0[_0x7329('0x4f')]=_[_0x7329('0x51')](_0x8788a0['where'],{'$or':_[_0x7329('0x42')](_0x4eedb2,function(_0x3f4ebe){if(_0x3f4ebe['type']!==_0x7329('0x52')){var _0x31aeb5={};_0x31aeb5[_0x3f4ebe[_0x7329('0x3d')]]={'$like':'%'+_0x80af9b[_0x7329('0x46')][_0x7329('0x50')]+'%'};return _0x31aeb5;}})});}_0x8788a0=_[_0x7329('0x51')]({},_0x8788a0,_0x80af9b['options']);var _0x290713={'where':_0x8788a0[_0x7329('0x4f')]};return db[_0x7329('0x53')][_0x7329('0x34')](_0x290713)[_0x7329('0x22')](function(_0x1faaf5){_0x5a031c[_0x7329('0x34')]=_0x1faaf5;if(_0x80af9b[_0x7329('0x46')][_0x7329('0x54')]){_0x8788a0[_0x7329('0x55')]=[{'all':!![]}];}return db[_0x7329('0x53')][_0x7329('0x56')](_0x8788a0);})['then'](function(_0x2f5151){_0x5a031c[_0x7329('0x57')]=_0x2f5151;return _0x5a031c;})[_0x7329('0x22')](respondWithFilteredResult(_0x1ba7f2,_0x8788a0))[_0x7329('0x2c')](handleError(_0x1ba7f2,null));};exports[_0x7329('0x58')]=function(_0x5c5c97,_0x155d59){var _0x37083f={'raw':![],'where':{'id':_0x5c5c97['params']['id']},'include':[{'model':db[_0x7329('0x40')],'as':'mandatoryDispositionPause'}]},_0x3556af={};_0x3556af[_0x7329('0x45')]=_[_0x7329('0x47')](db[_0x7329('0x53')]['rawAttributes']);_0x3556af[_0x7329('0x46')]=_['keys'](_0x5c5c97['query']);_0x3556af[_0x7329('0x48')]=_[_0x7329('0x49')](_0x3556af[_0x7329('0x45')],_0x3556af[_0x7329('0x46')]);_0x37083f[_0x7329('0x4a')]=_[_0x7329('0x49')](_0x3556af[_0x7329('0x45')],qs[_0x7329('0x4b')](_0x5c5c97[_0x7329('0x46')][_0x7329('0x4b')]));_0x37083f[_0x7329('0x4a')]=_0x37083f[_0x7329('0x4a')][_0x7329('0x59')]?_0x37083f['attributes']:_0x3556af['model'];if(_0x5c5c97[_0x7329('0x46')][_0x7329('0x54')]){_0x37083f[_0x7329('0x55')]=[{'all':!![]}];}_0x37083f=_[_0x7329('0x51')]({},_0x37083f,_0x5c5c97[_0x7329('0x5a')]);return db[_0x7329('0x53')][_0x7329('0x5b')](_0x37083f)['then'](handleEntityNotFound(_0x155d59,null))[_0x7329('0x22')](respondWithResult(_0x155d59,null))['catch'](handleError(_0x155d59,null));};exports[_0x7329('0x5c')]=function(_0x264a60,_0x34f36f){return db[_0x7329('0x53')][_0x7329('0x5c')](_0x264a60['body'],{})[_0x7329('0x22')](function(_0x3ca055){var _0x33ed39=_0x264a60[_0x7329('0x5d')][_0x7329('0x3a')]({'plain':!![]});if(!_0x33ed39)throw new Error(_0x7329('0x5e'));if(_0x33ed39[_0x7329('0x5f')]===_0x7329('0x5d')){var _0x461247=_0x3ca055[_0x7329('0x3a')]({'plain':!![]});var _0x1bd292='OpenchannelAccounts';return db[_0x7329('0x60')][_0x7329('0x5b')]({'where':{'name':_0x1bd292,'userProfileId':_0x33ed39[_0x7329('0x61')]},'raw':!![]})[_0x7329('0x22')](function(_0x5a065b){if(_0x5a065b&&_0x5a065b['autoAssociation']===0x0){return db[_0x7329('0x3c')][_0x7329('0x5c')]({'name':_0x461247[_0x7329('0x3d')],'resourceId':_0x461247['id'],'type':_0x5a065b[_0x7329('0x3d')],'sectionId':_0x5a065b['id']},{})[_0x7329('0x22')](function(){return _0x3ca055;});}else{return _0x3ca055;}})[_0x7329('0x2c')](function(_0x2758bb){logger[_0x7329('0x28')](_0x7329('0x62'),_0x2758bb);throw _0x2758bb;});}return _0x3ca055;})[_0x7329('0x22')](respondWithResult(_0x34f36f,0xc9))[_0x7329('0x2c')](handleError(_0x34f36f,null));};exports[_0x7329('0x63')]=function(_0x2d7c11,_0xedb8bc){if(_0x2d7c11[_0x7329('0x64')]['id']){delete _0x2d7c11[_0x7329('0x64')]['id'];}return db[_0x7329('0x53')]['find']({'where':{'id':_0x2d7c11['params']['id']},'include':[{'model':db[_0x7329('0x40')],'as':_0x7329('0x41')}]})['then'](handleEntityNotFound(_0xedb8bc,null))[_0x7329('0x22')](saveUpdates(_0x2d7c11[_0x7329('0x64')],null))[_0x7329('0x22')](respondWithResult(_0xedb8bc,null))['catch'](handleError(_0xedb8bc,null));};exports[_0x7329('0x65')]=function(_0x83303b,_0x57735d){return db['OpenchannelAccount']['find']({'where':{'id':_0x83303b['params']['id']}})[_0x7329('0x22')](handleEntityNotFound(_0x57735d,null))[_0x7329('0x22')](removeEntity(_0x57735d,null))[_0x7329('0x2c')](handleError(_0x57735d,null));};exports[_0x7329('0x66')]=function(_0xe6c4ea,_0x436880){return db[_0x7329('0x53')][_0x7329('0x66')]()[_0x7329('0x22')](respondWithResult(_0x436880,null))[_0x7329('0x2c')](handleError(_0x436880,null));};exports[_0x7329('0x67')]=function(_0xf430a8,_0x65ecff,_0x469b7a){if(_0xf430a8[_0x7329('0x64')]['id']){delete _0xf430a8[_0x7329('0x64')]['id'];}return db[_0x7329('0x53')][_0x7329('0x5b')]({'where':{'id':_0xf430a8[_0x7329('0x68')]['id']}})[_0x7329('0x22')](handleEntityNotFound(_0x65ecff,null))[_0x7329('0x22')](function(_0x2f5aa1){if(_0x2f5aa1){_0xf430a8[_0x7329('0x64')][_0x7329('0x69')]=_0x2f5aa1['id'];return db['Disposition'][_0x7329('0x5c')](_0xf430a8[_0x7329('0x64')]);}})['then'](respondWithResult(_0x65ecff,null))['catch'](handleError(_0x65ecff,null));};exports[_0x7329('0x6a')]=function(_0x45ac9b,_0x363532,_0x418b5b){var _0x25a5d1={'raw':![],'where':{}};var _0x2f4a65={};var _0x58d491={'count':0x0,'rows':[]};return db[_0x7329('0x53')]['findOne']({'where':{'id':_0x45ac9b[_0x7329('0x68')]['id']}})[_0x7329('0x22')](handleEntityNotFound(_0x363532,null))[_0x7329('0x22')](function(_0x5a1c9f){if(_0x5a1c9f){_0x2f4a65[_0x7329('0x45')]=_[_0x7329('0x47')](db['Disposition']['rawAttributes']);_0x2f4a65[_0x7329('0x46')]=_[_0x7329('0x47')](_0x45ac9b[_0x7329('0x46')]);_0x2f4a65['filters']=_['intersection'](_0x2f4a65['model'],_0x2f4a65[_0x7329('0x46')]);_0x25a5d1[_0x7329('0x4a')]=_[_0x7329('0x49')](_0x2f4a65[_0x7329('0x45')],qs[_0x7329('0x4b')](_0x45ac9b[_0x7329('0x46')][_0x7329('0x4b')]));_0x25a5d1[_0x7329('0x4a')]=_0x25a5d1['attributes'][_0x7329('0x59')]?_0x25a5d1[_0x7329('0x4a')]:_0x2f4a65['model'];if(!_0x45ac9b[_0x7329('0x46')][_0x7329('0x6b')](_0x7329('0x4c'))){_0x25a5d1[_0x7329('0x33')]=qs[_0x7329('0x33')](_0x45ac9b[_0x7329('0x46')][_0x7329('0x33')]);_0x25a5d1[_0x7329('0x31')]=qs['offset'](_0x45ac9b[_0x7329('0x46')]['offset']);}_0x25a5d1[_0x7329('0x4d')]=qs[_0x7329('0x4e')](_0x45ac9b[_0x7329('0x46')][_0x7329('0x4e')]);_0x25a5d1[_0x7329('0x4f')]=qs[_0x7329('0x48')](_[_0x7329('0x6c')](_0x45ac9b[_0x7329('0x46')],_0x2f4a65[_0x7329('0x48')]));_0x25a5d1[_0x7329('0x4f')][_0x7329('0x69')]=_0x5a1c9f['id'];if(_0x45ac9b[_0x7329('0x46')][_0x7329('0x50')]){_0x25a5d1[_0x7329('0x4f')]=_['merge'](_0x25a5d1[_0x7329('0x4f')],{'$or':_[_0x7329('0x42')](_0x25a5d1['attributes'],function(_0x198898){var _0x4867b9={};_0x4867b9[_0x198898]={'$like':'%'+_0x45ac9b[_0x7329('0x46')]['filter']+'%'};return _0x4867b9;})});}_0x25a5d1=_[_0x7329('0x51')]({},_0x25a5d1,_0x45ac9b[_0x7329('0x5a')]);return db[_0x7329('0x6d')][_0x7329('0x34')]({'where':_0x25a5d1[_0x7329('0x4f')]})[_0x7329('0x22')](function(_0xc2218f){_0x58d491[_0x7329('0x34')]=_0xc2218f;if(_0x45ac9b[_0x7329('0x46')][_0x7329('0x54')]){_0x25a5d1['include']=[{'all':!![]}];}return db['Disposition'][_0x7329('0x56')](_0x25a5d1);})[_0x7329('0x22')](function(_0x49fa75){_0x58d491[_0x7329('0x57')]=_0x49fa75;return _0x58d491;});}})[_0x7329('0x22')](respondWithFilteredResult(_0x363532,_0x25a5d1))[_0x7329('0x2c')](handleError(_0x363532,null));};exports[_0x7329('0x6e')]=function(_0x536040,_0x534439,_0x1193bd){return db[_0x7329('0x53')][_0x7329('0x5b')]({'where':{'id':_0x536040[_0x7329('0x68')]['id']}})['then'](handleEntityNotFound(_0x534439,null))[_0x7329('0x22')](function(_0x32afaa){if(_0x32afaa){return _0x32afaa['removeDispositions'](_0x536040['query'][_0x7329('0x6f')]);}})[_0x7329('0x22')](respondWithStatusCode(_0x534439,null))[_0x7329('0x2c')](handleError(_0x534439,null));};exports[_0x7329('0x70')]=function(_0x142fd1,_0xf602ed,_0x9c6703){if(_0x142fd1[_0x7329('0x64')]['id']){delete _0x142fd1['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x142fd1[_0x7329('0x68')]['id']}})[_0x7329('0x22')](handleEntityNotFound(_0xf602ed,null))[_0x7329('0x22')](function(_0x41dda2){if(_0x41dda2){_0x142fd1[_0x7329('0x64')][_0x7329('0x69')]=_0x41dda2['id'];return db[_0x7329('0x71')][_0x7329('0x5c')](_0x142fd1[_0x7329('0x64')]);}})['then'](respondWithResult(_0xf602ed,null))[_0x7329('0x2c')](handleError(_0xf602ed,null));};exports[_0x7329('0x72')]=function(_0x4bfc7e,_0x3140ec,_0x432b50){var _0x55fa0b={'raw':![],'where':{}};var _0x4304e1={};var _0x58492b={'count':0x0,'rows':[]};return db[_0x7329('0x53')][_0x7329('0x73')]({'where':{'id':_0x4bfc7e['params']['id']}})[_0x7329('0x22')](handleEntityNotFound(_0x3140ec,null))[_0x7329('0x22')](function(_0x4950f1){if(_0x4950f1){_0x4304e1[_0x7329('0x45')]=_['keys'](db[_0x7329('0x71')][_0x7329('0x43')]);_0x4304e1[_0x7329('0x46')]=_[_0x7329('0x47')](_0x4bfc7e[_0x7329('0x46')]);_0x4304e1['filters']=_[_0x7329('0x49')](_0x4304e1[_0x7329('0x45')],_0x4304e1[_0x7329('0x46')]);_0x55fa0b['attributes']=_['intersection'](_0x4304e1[_0x7329('0x45')],qs['fields'](_0x4bfc7e[_0x7329('0x46')][_0x7329('0x4b')]));_0x55fa0b[_0x7329('0x4a')]=_0x55fa0b[_0x7329('0x4a')]['length']?_0x55fa0b[_0x7329('0x4a')]:_0x4304e1[_0x7329('0x45')];if(!_0x4bfc7e[_0x7329('0x46')]['hasOwnProperty'](_0x7329('0x4c'))){_0x55fa0b[_0x7329('0x33')]=qs['limit'](_0x4bfc7e['query']['limit']);_0x55fa0b[_0x7329('0x31')]=qs['offset'](_0x4bfc7e[_0x7329('0x46')]['offset']);}_0x55fa0b['order']=qs[_0x7329('0x4e')](_0x4bfc7e[_0x7329('0x46')][_0x7329('0x4e')]);_0x55fa0b[_0x7329('0x4f')]=qs[_0x7329('0x48')](_[_0x7329('0x6c')](_0x4bfc7e['query'],_0x4304e1[_0x7329('0x48')]));_0x55fa0b[_0x7329('0x4f')][_0x7329('0x69')]=_0x4950f1['id'];if(_0x4bfc7e[_0x7329('0x46')][_0x7329('0x50')]){_0x55fa0b['where']=_['merge'](_0x55fa0b['where'],{'$or':_[_0x7329('0x42')](_0x55fa0b[_0x7329('0x4a')],function(_0x57d43c){var _0x2a26b1={};_0x2a26b1[_0x57d43c]={'$like':'%'+_0x4bfc7e[_0x7329('0x46')][_0x7329('0x50')]+'%'};return _0x2a26b1;})});}_0x55fa0b=_[_0x7329('0x51')]({},_0x55fa0b,_0x4bfc7e[_0x7329('0x5a')]);return db['CannedAnswer'][_0x7329('0x34')]({'where':_0x55fa0b['where']})[_0x7329('0x22')](function(_0xf18770){_0x58492b[_0x7329('0x34')]=_0xf18770;if(_0x4bfc7e[_0x7329('0x46')][_0x7329('0x54')]){_0x55fa0b['include']=[{'all':!![]}];}return db[_0x7329('0x71')][_0x7329('0x56')](_0x55fa0b);})[_0x7329('0x22')](function(_0x85fd8){_0x58492b['rows']=_0x85fd8;return _0x58492b;});}})[_0x7329('0x22')](respondWithFilteredResult(_0x3140ec,_0x55fa0b))[_0x7329('0x2c')](handleError(_0x3140ec,null));};exports[_0x7329('0x74')]=function(_0x2b0116,_0x2ac585,_0x40b05d){return db[_0x7329('0x53')][_0x7329('0x5b')]({'where':{'id':_0x2b0116['params']['id']}})[_0x7329('0x22')](handleEntityNotFound(_0x2ac585,null))[_0x7329('0x22')](function(_0x336628){if(_0x336628){return _0x336628[_0x7329('0x74')](_0x2b0116[_0x7329('0x46')][_0x7329('0x6f')]);}})[_0x7329('0x22')](respondWithStatusCode(_0x2ac585,null))['catch'](handleError(_0x2ac585,null));};exports[_0x7329('0x75')]=function(_0x1881e9,_0x22436f,_0x43a63a){var _0x509d2b={'body':_0x1881e9[_0x7329('0x64')],'channel':_0x7329('0x76')};var _0x13543f=[];var _0x3e03c7=[];var _0x385bf0={};var _0x385334=![];return db[_0x7329('0x77')][_0x7329('0x66')]()[_0x7329('0x22')](function(_0x4986c6){if(!_0x4986c6){throw new db['Sequelize'][(_0x7329('0x78'))](_0x7329('0x79'));}_0x13543f=_['difference'](_['keys'](_0x4986c6),[_0x7329('0x7a'),_0x7329('0x7b')]);_0x3e03c7=_[_0x7329('0x7c')](_['keys'](_0x4986c6),[_0x7329('0x7a'),_0x7329('0x7b'),'CompanyId',_0x7329('0x7d')]);if(_0x1881e9[_0x7329('0x64')]['id']){delete _0x1881e9[_0x7329('0x64')]['id'];}if(_[_0x7329('0x7e')](_0x1881e9[_0x7329('0x64')][_0x7329('0x7f')])){throw new db[(_0x7329('0x80'))][(_0x7329('0x78'))](_0x7329('0x81'));}if(_[_0x7329('0x7e')](_0x1881e9['body'][_0x7329('0x64')])||_0x1881e9['body'][_0x7329('0x64')]===''){throw new db['Sequelize'][(_0x7329('0x78'))](_0x7329('0x82'));}if(_['isNil'](_0x1881e9[_0x7329('0x64')][_0x7329('0x83')])){throw new db[(_0x7329('0x80'))][(_0x7329('0x78'))](_0x7329('0x84')+_0x3e03c7);}if(!_[_0x7329('0x85')](_0x3e03c7,_0x1881e9[_0x7329('0x64')][_0x7329('0x83')])){throw new db[(_0x7329('0x80'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3e03c7);}_0x385bf0[_0x1881e9[_0x7329('0x64')][_0x7329('0x83')]]=_0x1881e9[_0x7329('0x64')][_0x7329('0x7f')];})['then'](function(){return db['OpenchannelAccount'][_0x7329('0x5b')]({'where':{'id':_0x1881e9[_0x7329('0x68')]['id']},'include':[{'model':db['CmList'],'as':_0x7329('0x86'),'include':[{'model':db[_0x7329('0x77')],'as':'Contacts','where':_0x385bf0,'limit':0x1,'order':[[_0x7329('0x7b'),_0x7329('0x87')]]}]},{'model':db[_0x7329('0x88')],'as':_0x7329('0x89')}]});})['then'](handleEntityNotFound(_0x22436f,null))[_0x7329('0x22')](function(_0x524e37){if(_0x524e37&&_0x524e37[_0x7329('0x86')]){_0x509d2b[_0x7329('0x8a')]=_0x524e37;_0x509d2b[_0x7329('0x8b')]=_0x524e37['Applications'];_0x509d2b[_0x7329('0x8c')]=_0x524e37[_0x7329('0x86')];_0x509d2b[_0x7329('0x8b')]=_[_0x7329('0x8d')](_0x509d2b['applications'],[_0x7329('0x8e')],[_0x7329('0x8f')]);if(_0x509d2b['account']['Applications']){delete _0x509d2b[_0x7329('0x8a')]['Applications'];}if(_0x509d2b[_0x7329('0x8a')]['List']&&_0x509d2b['account'][_0x7329('0x86')][_0x7329('0x90')][_0x7329('0x59')]){return _0x509d2b[_0x7329('0x8a')]['List'][_0x7329('0x90')][0x0];}var _0x12ed1f=_['defaults'](_0x1881e9[_0x7329('0x64')],{'firstName':_0x1881e9[_0x7329('0x64')][_0x7329('0x7f')],'ListId':_0x524e37['ListId']});_0x12ed1f[_0x1881e9['body'][_0x7329('0x83')]]=_0x1881e9['body']['from'];return db[_0x7329('0x77')][_0x7329('0x5c')](_0x12ed1f,{'fields':_0x13543f,'raw':!![]});}})['then'](handleEntityNotFound(_0x22436f,null))[_0x7329('0x22')](function(_0x1721ed){_0x509d2b[_0x7329('0x91')]=_0x1721ed;if(_0x1721ed){var _0x21d19e={'ContactId':_0x1721ed['id'],'OpenchannelAccountId':_0x1881e9[_0x7329('0x68')]['id'],'from':(_0x1721ed[_0x7329('0x92')]||'')+'\x20'+(_0x1721ed[_0x7329('0x93')]||'')};var _0x178f3e={'OpenchannelAccountId':_0x1881e9['params']['id'],'closed':![]};if(_0x1881e9[_0x7329('0x64')]['threadId']){_0x178f3e[_0x7329('0x94')]=_0x1881e9[_0x7329('0x64')][_0x7329('0x94')];return db[_0x7329('0x95')][_0x7329('0x5b')]({'where':_0x178f3e})[_0x7329('0x22')](function(_0x31b3c3){if(_0x31b3c3){return[_0x31b3c3,![]];}_0x21d19e['threadId']=_0x1881e9[_0x7329('0x64')][_0x7329('0x94')];_0x21d19e[_0x7329('0x96')]=_0x1881e9[_0x7329('0x64')][_0x7329('0x96')];return db['OpenchannelInteraction'][_0x7329('0x5c')](_0x21d19e)['then'](function(_0x3a8bb1){return[_0x3a8bb1,!![]];});});}else{_0x178f3e[_0x7329('0x94')]=null;}_0x178f3e['ContactId']=_0x1721ed['id'];return db[_0x7329('0x95')][_0x7329('0x5b')]({'where':_0x178f3e})[_0x7329('0x22')](function(_0x295abe){if(_0x295abe){return[_0x295abe,![]];}return db['OpenchannelInteraction'][_0x7329('0x5c')](_0x21d19e)[_0x7329('0x22')](function(_0x4f2abc){return[_0x4f2abc,!![]];});});}})[_0x7329('0x97')](function(_0x575f70,_0x3b3531){if(_0x575f70){_0x385334=_0x3b3531;if(!_0x3b3531){var _0x41ff00={'from':(_0x509d2b['contact'][_0x7329('0x92')]||'')+'\x20'+(_0x509d2b[_0x7329('0x91')][_0x7329('0x93')]||'')};if(_0x1881e9[_0x7329('0x64')][_0x7329('0x94')]&&_0x1881e9[_0x7329('0x64')][_0x7329('0x98')]&&_0x1881e9[_0x7329('0x64')][_0x7329('0x94')]!=_0x1881e9[_0x7329('0x64')][_0x7329('0x98')]){_0x41ff00[_0x7329('0x94')]=_0x1881e9[_0x7329('0x64')][_0x7329('0x98')];}return _0x575f70[_0x7329('0x63')](_0x41ff00);}else{return _0x575f70;}}})['then'](function(_0x21be88){_0x509d2b['interaction']=_0x21be88[_0x7329('0x3a')]({'plain':!![]});_0x509d2b[_0x7329('0x99')][_0x7329('0x9a')]=_0x385334;if(_0x509d2b[_0x7329('0x99')][_0x7329('0x9a')]){if(_0x509d2b['account'][_0x7329('0x9b')]){_0x509d2b['applications'][_0x7329('0x9c')]({'id':0x0,'priority':_0x509d2b[_0x7329('0x8b')][_0x7329('0x59')]+0x1,'app':'close','appdata':_0x7329('0x9d'),'interval':_0x7329('0x9e')});}}return db[_0x7329('0x9f')][_0x7329('0x5c')]({'body':_0x1881e9[_0x7329('0x64')][_0x7329('0x64')],'OpenchannelAccountId':_0x1881e9[_0x7329('0x68')]['id'],'OpenchannelInteractionId':_0x21be88['id'],'direction':'in','ContactId':_0x509d2b[_0x7329('0x91')]['id'],'AttachmentId':_0x1881e9[_0x7329('0x64')]['AttachmentId']});})[_0x7329('0x22')](function(_0x3914eb){_0x509d2b['message']=_0x3914eb;if(_0x509d2b['interaction'][_0x7329('0xa0')]){return db['User']['find']({'attributes':['id',_0x7329('0x3d')],'where':{'id':_0x509d2b[_0x7329('0x99')][_0x7329('0xa0')]}})['then'](function(_0x4853c1){if(_0x4853c1){_0x509d2b[_0x7329('0x8b')][_0x7329('0xa1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4853c1[_0x7329('0x3d')]+','+(_0x509d2b['account'][_0x7329('0xa2')]||0xa),'interval':'*,*,*,*'});_0x509d2b['forcedOwnership']=![];}return respondWithRpcPromise(_0x7329('0xa3'),_0x7329('0xa4'),_0x509d2b);});}return respondWithRpcPromise(_0x7329('0xa3'),_0x7329('0xa4'),_0x509d2b);})[_0x7329('0x22')](function(_0x1d6e62){respondWithRpcPromise('EventManager','EventManager',{'event':_0x7329('0x75'),'message':_0x1d6e62},client9002);return _0x1d6e62;})['then'](respondWithResult(_0x22436f,null))[_0x7329('0x2c')](handleError(_0x22436f,null));};exports['addApplications']=function(_0x5b7958,_0x3f50f5){var _0x2987d9=_0x5b7958[_0x7329('0x68')]['id'];var _0x40cedb=_0x5b7958[_0x7329('0x64')];var _0x5a510c=0xc8;var _0x2d1358=null;return db[_0x7329('0xa5')][_0x7329('0xa6')]({'isolationLevel':db[_0x7329('0xa5')][_0x7329('0xa7')][_0x7329('0xa8')]['READ_COMMITTED']},function(_0x2c8659){return db['OpenchannelAccount'][_0x7329('0x73')]({'where':{'id':_0x2987d9},'transaction':_0x2c8659})[_0x7329('0x22')](function(_0x40739e){if(_0x40739e){return db[_0x7329('0x88')][_0x7329('0x65')]({'where':{'OpenchannelAccountId':_0x2987d9},'transaction':_0x2c8659})[_0x7329('0x22')](function(){var _0x14e637=_['map'](_0x40cedb,function(_0xde56e1){_0xde56e1['OpenchannelAccountId']=_0x2987d9;return _0xde56e1;});return db[_0x7329('0x88')][_0x7329('0xa9')](_0x14e637,{'transaction':_0x2c8659});});}else{_0x5a510c=0x194;_0x2d1358=[];}});})[_0x7329('0x22')](function(){if(_0x5a510c!==0x194){return db[_0x7329('0x88')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x2987d9},'order':'priority'})[_0x7329('0x22')](function(_0x3f8631){_0x2d1358=_0x3f8631;});}})[_0x7329('0x2c')](function(_0x17f803){_0x5a510c=0x1f4;logger['error'](_0x17f803[_0x7329('0xaa')]);if(_0x17f803[_0x7329('0x3d')]){delete _0x17f803[_0x7329('0x3d')];}_0x2d1358=_0x17f803;})[_0x7329('0xab')](function(){if(_0x2d1358===null){_0x3f50f5['sendStatus'](_0x5a510c);}else{if(_0x5a510c===0x1f4){_0x3f50f5['status'](_0x5a510c)['send'](_0x2d1358);}else{_0x3f50f5['status'](_0x5a510c)['json'](_0x2d1358);}}});};exports[_0x7329('0xac')]=function(_0x49ef67,_0x222a76,_0x985f74){var _0x54d3e0={};var _0x28c4ca={};var _0x475f2b;var _0x558025;return db['OpenchannelAccount'][_0x7329('0x73')]({'where':{'id':_0x49ef67[_0x7329('0x68')]['id']}})[_0x7329('0x22')](handleEntityNotFound(_0x222a76,null))[_0x7329('0x22')](function(_0x4a08a0){if(_0x4a08a0){_0x475f2b=_0x4a08a0;_0x28c4ca[_0x7329('0x45')]=_[_0x7329('0x47')](db['OpenchannelApplication'][_0x7329('0x43')]);_0x28c4ca[_0x7329('0x46')]=_[_0x7329('0x47')](_0x49ef67['query']);_0x28c4ca[_0x7329('0x48')]=_[_0x7329('0x49')](_0x28c4ca[_0x7329('0x45')],_0x28c4ca['query']);_0x54d3e0['attributes']=_[_0x7329('0x49')](_0x28c4ca[_0x7329('0x45')],qs['fields'](_0x49ef67['query'][_0x7329('0x4b')]));_0x54d3e0['attributes']=_0x54d3e0[_0x7329('0x4a')][_0x7329('0x59')]?_0x54d3e0[_0x7329('0x4a')]:_0x28c4ca[_0x7329('0x45')];_0x54d3e0[_0x7329('0x4d')]=qs[_0x7329('0x4e')](_0x49ef67[_0x7329('0x46')][_0x7329('0x4e')]);_0x54d3e0[_0x7329('0x4f')]=qs[_0x7329('0x48')](_['pick'](_0x49ef67[_0x7329('0x46')],_0x28c4ca[_0x7329('0x48')]));if(_0x49ef67[_0x7329('0x46')][_0x7329('0x50')]){_0x54d3e0['where']=_['merge'](_0x54d3e0[_0x7329('0x4f')],{'$or':_[_0x7329('0x42')](_0x54d3e0[_0x7329('0x4a')],function(_0x2a0233){var _0x988843={};_0x988843[_0x2a0233]={'$like':'%'+_0x49ef67[_0x7329('0x46')][_0x7329('0x50')]+'%'};return _0x988843;})});}_0x54d3e0=_[_0x7329('0x51')]({},_0x54d3e0,_0x49ef67[_0x7329('0x5a')]);return _0x475f2b[_0x7329('0xac')](_0x54d3e0);}})[_0x7329('0x22')](function(_0x5d9164){if(_0x5d9164){_0x558025=_0x5d9164[_0x7329('0x59')];if(!_0x49ef67[_0x7329('0x46')]['hasOwnProperty']('nolimit')){_0x54d3e0['limit']=qs[_0x7329('0x33')](_0x49ef67[_0x7329('0x46')]['limit']);_0x54d3e0[_0x7329('0x31')]=qs['offset'](_0x49ef67[_0x7329('0x46')][_0x7329('0x31')]);}return _0x475f2b[_0x7329('0xac')](_0x54d3e0);}})['then'](function(_0x49550e){if(_0x49550e){return _0x49550e?{'count':_0x558025,'rows':_0x49550e}:null;}})[_0x7329('0x22')](respondWithResult(_0x222a76,null))[_0x7329('0x2c')](handleError(_0x222a76,null));};exports['getInteractions']=function(_0x135fb3,_0x16c466,_0x2a85d7){var _0x180e46={'raw':![],'where':{}};var _0x129aeb={};var _0x4345c1={'count':0x0,'rows':[]};return db[_0x7329('0x53')]['findOne']({'where':{'id':_0x135fb3[_0x7329('0x68')]['id']}})[_0x7329('0x22')](handleEntityNotFound(_0x16c466,null))['then'](function(_0x4b742f){if(_0x4b742f){_0x129aeb[_0x7329('0x45')]=_[_0x7329('0x47')](db['OpenchannelInteraction']['rawAttributes']);_0x129aeb['query']=_[_0x7329('0x47')](_0x135fb3[_0x7329('0x46')]);_0x129aeb[_0x7329('0x48')]=_['intersection'](_0x129aeb[_0x7329('0x45')],_0x129aeb[_0x7329('0x46')]);_0x180e46[_0x7329('0x4a')]=_['intersection'](_0x129aeb[_0x7329('0x45')],qs[_0x7329('0x4b')](_0x135fb3[_0x7329('0x46')][_0x7329('0x4b')]));_0x180e46[_0x7329('0x4a')]=_0x180e46[_0x7329('0x4a')][_0x7329('0x59')]?_0x180e46[_0x7329('0x4a')]:_0x129aeb['model'];if(!_0x135fb3['query'][_0x7329('0x6b')](_0x7329('0x4c'))){_0x180e46['limit']=qs[_0x7329('0x33')](_0x135fb3[_0x7329('0x46')][_0x7329('0x33')]);_0x180e46[_0x7329('0x31')]=qs['offset'](_0x135fb3[_0x7329('0x46')][_0x7329('0x31')]);}_0x180e46[_0x7329('0x4d')]=qs[_0x7329('0x4e')](_0x135fb3[_0x7329('0x46')]['sort']);_0x180e46[_0x7329('0x4f')]=qs[_0x7329('0x48')](_['pick'](_0x135fb3[_0x7329('0x46')],_0x129aeb[_0x7329('0x48')]));_0x180e46[_0x7329('0x4f')]['OpenchannelAccountId']=_0x4b742f['id'];if(_0x135fb3[_0x7329('0x46')][_0x7329('0x50')]){_0x180e46[_0x7329('0x4f')]=_['merge'](_0x180e46['where'],{'$or':_[_0x7329('0x42')](_0x180e46['attributes'],function(_0x4625cb){var _0x342e8a={};_0x342e8a[_0x4625cb]={'$like':'%'+_0x135fb3[_0x7329('0x46')][_0x7329('0x50')]+'%'};return _0x342e8a;})});}_0x180e46=_[_0x7329('0x51')]({},_0x180e46,_0x135fb3[_0x7329('0x5a')]);return db[_0x7329('0x95')][_0x7329('0x34')]({'where':_0x180e46[_0x7329('0x4f')]})[_0x7329('0x22')](function(_0x1858ba){_0x4345c1[_0x7329('0x34')]=_0x1858ba;if(_0x135fb3[_0x7329('0x46')][_0x7329('0x54')]){_0x180e46[_0x7329('0x55')]=[{'model':db[_0x7329('0x77')],'as':_0x7329('0xad'),'required':![]},{'model':db[_0x7329('0xae')],'as':_0x7329('0xaf'),'attributes':[_0x7329('0x3d'),_0x7329('0xb0'),_0x7329('0xb1')],'required':![]},{'model':db[_0x7329('0xb2')],'as':_0x7329('0xb3'),'attributes':['id',_0x7329('0x3d'),_0x7329('0xb4')],'where':_0x135fb3['query'][_0x7329('0xb5')]?{'id':_0x135fb3['query']['tag']}:undefined,'required':_0x135fb3[_0x7329('0x46')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0x7329('0x56')](_0x180e46);})[_0x7329('0x22')](function(_0xebd5b9){_0x4345c1['rows']=_0xebd5b9;return _0x4345c1;});}})[_0x7329('0x22')](respondWithFilteredResult(_0x16c466,_0x180e46))['catch'](handleError(_0x16c466,null));};exports[_0x7329('0xb6')]=function(_0x2bd73e,_0x4e1d69,_0x3fad09){return db[_0x7329('0x53')]['find']({'where':{'id':_0x2bd73e[_0x7329('0x68')]['id']}})[_0x7329('0x22')](handleEntityNotFound(_0x4e1d69,null))[_0x7329('0x22')](function(_0x51f7db){if(_0x51f7db){return _0x51f7db[_0x7329('0xb6')](_0x2bd73e['body'][_0x7329('0x6f')],_['omit'](_0x2bd73e[_0x7329('0x64')],[_0x7329('0x6f'),'id'])||{})[_0x7329('0x97')](function(_0x47e3bc){for(var _0x4e4915=0x0;_0x4e4915<_0x2bd73e[_0x7329('0x64')][_0x7329('0x6f')][_0x7329('0x59')];_0x4e4915+=0x1){socket[_0x7329('0xb7')](_0x7329('0xb8'),{'UserId':Number(_0x2bd73e[_0x7329('0x64')][_0x7329('0x6f')][_0x4e4915]),'OpenchannelAccountId':Number(_0x2bd73e['params']['id'])});}return _0x47e3bc;});}})[_0x7329('0x22')](respondWithResult(_0x4e1d69,null))['catch'](handleError(_0x4e1d69,null));};exports['removeAgents']=function(_0x4d24cf,_0x4c76a0,_0x5bb7d7){return db[_0x7329('0x53')][_0x7329('0x5b')]({'where':{'id':_0x4d24cf['params']['id']}})['then'](handleEntityNotFound(_0x4c76a0,null))['then'](function(_0x1fa329){if(_0x1fa329){return _0x1fa329['removeAgents'](_0x4d24cf[_0x7329('0x46')][_0x7329('0x6f')])[_0x7329('0x22')](function(){if(_[_0x7329('0xb9')](_0x4d24cf[_0x7329('0x46')]['ids'])){for(var _0x3c7b39=0x0;_0x3c7b39<_0x4d24cf[_0x7329('0x46')][_0x7329('0x6f')][_0x7329('0x59')];_0x3c7b39+=0x1){socket[_0x7329('0xb7')](_0x7329('0xba'),{'UserId':Number(_0x4d24cf[_0x7329('0x46')][_0x7329('0x6f')][_0x3c7b39]),'OpenchannelAccountId':Number(_0x4d24cf['params']['id'])});}}else{socket[_0x7329('0xb7')](_0x7329('0xba'),{'UserId':Number(_0x4d24cf[_0x7329('0x46')][_0x7329('0x6f')]),'OpenchannelAccountId':Number(_0x4d24cf['params']['id'])});}});}})[_0x7329('0x22')](respondWithStatusCode(_0x4c76a0,null))[_0x7329('0x2c')](handleError(_0x4c76a0,null));};exports[_0x7329('0xbb')]=function(_0x9384e3,_0xe29956,_0x4c21c4){var _0x3dbbaa={};var _0x16f811={};var _0x2bfc51;var _0x5f11e0;return db[_0x7329('0x53')][_0x7329('0x73')]({'where':{'id':_0x9384e3['params']['id']}})[_0x7329('0x22')](handleEntityNotFound(_0xe29956,null))[_0x7329('0x22')](function(_0x31c18f){if(_0x31c18f){_0x2bfc51=_0x31c18f;_0x16f811[_0x7329('0x45')]=_[_0x7329('0x47')](db['User'][_0x7329('0x43')]);_0x16f811[_0x7329('0x46')]=_['keys'](_0x9384e3['query']);_0x16f811['filters']=_['intersection'](_0x16f811[_0x7329('0x45')],_0x16f811[_0x7329('0x46')]);_0x3dbbaa[_0x7329('0x4a')]=_[_0x7329('0x49')](_0x16f811[_0x7329('0x45')],qs[_0x7329('0x4b')](_0x9384e3[_0x7329('0x46')][_0x7329('0x4b')]));_0x3dbbaa[_0x7329('0x4a')]=_0x3dbbaa[_0x7329('0x4a')][_0x7329('0x59')]?_0x3dbbaa[_0x7329('0x4a')]:_0x16f811[_0x7329('0x45')];_0x3dbbaa['order']=qs[_0x7329('0x4e')](_0x9384e3[_0x7329('0x46')]['sort']);_0x3dbbaa[_0x7329('0x4f')]=qs[_0x7329('0x48')](_[_0x7329('0x6c')](_0x9384e3['query'],_0x16f811[_0x7329('0x48')]));if(_0x9384e3[_0x7329('0x46')][_0x7329('0x50')]){_0x3dbbaa['where']=_[_0x7329('0x51')](_0x3dbbaa[_0x7329('0x4f')],{'$or':_[_0x7329('0x42')](_0x3dbbaa[_0x7329('0x4a')],function(_0x39297a){var _0x28bc0d={};_0x28bc0d[_0x39297a]={'$like':'%'+_0x9384e3[_0x7329('0x46')][_0x7329('0x50')]+'%'};return _0x28bc0d;})});}_0x3dbbaa=_[_0x7329('0x51')]({},_0x3dbbaa,_0x9384e3[_0x7329('0x5a')]);return _0x2bfc51[_0x7329('0xbb')](_0x3dbbaa);}})['then'](function(_0x45a663){if(_0x45a663){_0x5f11e0=_0x45a663['length'];if(!_0x9384e3['query'][_0x7329('0x6b')](_0x7329('0x4c'))){_0x3dbbaa[_0x7329('0x33')]=qs['limit'](_0x9384e3[_0x7329('0x46')][_0x7329('0x33')]);_0x3dbbaa[_0x7329('0x31')]=qs[_0x7329('0x31')](_0x9384e3[_0x7329('0x46')][_0x7329('0x31')]);}return _0x2bfc51['getAgents'](_0x3dbbaa);}})[_0x7329('0x22')](function(_0x3aa466){if(_0x3aa466){return _0x3aa466?{'count':_0x5f11e0,'rows':_0x3aa466}:null;}})[_0x7329('0x22')](respondWithResult(_0xe29956,null))[_0x7329('0x2c')](handleError(_0xe29956,null));};exports[_0x7329('0x3e')]=function(_0x501152,_0xf7299c,_0xcaf51a){var _0x2c3ced,_0x403969,_0x56d4b5;if(_['isNil'](_0x501152[_0x7329('0x64')][_0x7329('0x64')])||_0x501152[_0x7329('0x64')][_0x7329('0x64')]===''){throw new db[(_0x7329('0x80'))]['ValidationError'](_0x7329('0x82'));}if(_[_0x7329('0x7e')](_0x501152[_0x7329('0x64')]['to'])){}_0x2c3ced=_0x501152['body']['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x501152[_0x7329('0x68')]['id']}})['then'](handleEntityNotFound(_0xf7299c,null))[_0x7329('0x22')](function(_0x55c419){if(_0x55c419){return db['OpenchannelAccount'][_0x7329('0x5b')]({'where':{'id':_0x55c419['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x7329('0x77')],'as':_0x7329('0x90'),'where':{[_0x55c419['mapKey']]:_0x2c3ced},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x7329('0x22')](handleEntityNotFound(_0xf7299c,null))[_0x7329('0x22')](function(_0x55f14e){if(_0x55f14e&&_0x55f14e[_0x7329('0x86')]){_0x403969=_0x55f14e[_0x7329('0x3a')]({'plain':!![]});if(_0x403969[_0x7329('0x86')]&&_0x403969[_0x7329('0x86')][_0x7329('0x90')][_0x7329('0x59')]){return _0x403969['List']['Contacts'][0x0];}return db['CmContact']['create'](_[_0x7329('0xbc')](_0x501152[_0x7329('0x64')],{'firstName':_0x2c3ced,[_0x55f14e[_0x7329('0x83')]]:_0x2c3ced,'phone':_0x2c3ced,'ListId':_0x403969[_0x7329('0x7d')]}));}})[_0x7329('0x22')](handleEntityNotFound(_0xf7299c,null))[_0x7329('0x22')](function(_0x5c6ef7){if(_0x5c6ef7){_0x56d4b5=_0x5c6ef7;return db[_0x7329('0x95')]['find']({'where':{'ContactId':_0x56d4b5['id'],'closed':![],'OpenchannelAccountId':_0x403969['id']}})[_0x7329('0x22')](function(_0x1d9913){if(_0x1d9913){return[_0x1d9913,![]];}return db['OpenchannelInteraction'][_0x7329('0x5c')]({'UserId':_0x501152[_0x7329('0x5d')]['id'],'ContactId':_0x56d4b5['id'],'OpenchannelAccountId':_0x403969['id'],'lastMsgDirection':'out','firstMsgDirection':_0x7329('0xbd'),'Messages':[_['merge'](_0x501152[_0x7329('0x64')],{'read':![],'body':_0x501152[_0x7329('0x64')][_0x7329('0x64')],'OpenchannelAccountId':_0x403969['id'],'UserId':_0x501152[_0x7329('0x5d')]['id'],'ContactId':_0x56d4b5['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x7329('0xbe')}]})[_0x7329('0x22')](function(_0x2ef6a7){return[_0x2ef6a7,!![]];});});}})[_0x7329('0x97')](function(_0x32d811,_0xcb5fbc){if(_0xcb5fbc){return _0x32d811;}return db[_0x7329('0x9f')][_0x7329('0x5c')](_[_0x7329('0x51')](_0x501152['body'],{'read':![],'body':_0x501152['body'][_0x7329('0x64')],'OpenchannelAccountId':_0x403969['id'],'OpenchannelInteractionId':_0x32d811['id'],'UserId':_0x501152[_0x7329('0x5d')]['id'],'ContactId':_0x56d4b5['id']}))['then'](function(_0x5cbffc){_0x32d811[_0x7329('0xbf')]['Messages']=[];_0x32d811[_0x7329('0xbf')][_0x7329('0xbe')][_0x7329('0x9c')](_0x5cbffc[_0x7329('0xbf')]);return _0x32d811;});});}})[_0x7329('0x22')](respondWithResult(_0xf7299c,null))[_0x7329('0x2c')](handleError(_0xf7299c,null));}; \ No newline at end of file +var _0xc70b=['order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelAccount','includeAll','include','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','OpenchannelAccountId','findOne','Disposition','rawAttributes','nolimit','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','messageId','interaction','created','autoclose','push','unmanaged','OpenchannelMessage','AttachmentId','UserId','unshift','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','tag','findAll','addAgents','omit','spread','emit','removeAgents','userOpenchannelAccount:remove','getAgents','User','DESC','out','dataValues','Messages','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x5cb5b2,_0x1180fe){var _0x16bb2a=function(_0x26546a){while(--_0x26546a){_0x5cb5b2['push'](_0x5cb5b2['shift']());}};_0x16bb2a(++_0x1180fe);}(_0xc70b,0x13b));var _0xbc70=function(_0x20f019,_0x4eabf9){_0x20f019=_0x20f019-0x0;var _0x4a36ea=_0xc70b[_0x20f019];return _0x4a36ea;};'use strict';var emlformat=require(_0xbc70('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbc70('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc70('0x2'));var moment=require(_0xbc70('0x3'));var BPromise=require(_0xbc70('0x4'));var Mustache=require(_0xbc70('0x5'));var util=require(_0xbc70('0x6'));var path=require('path');var sox=require(_0xbc70('0x7'));var csv=require(_0xbc70('0x8'));var ejs=require(_0xbc70('0x9'));var fs=require('fs');var fs_extra=require(_0xbc70('0xa'));var _=require(_0xbc70('0xb'));var squel=require(_0xbc70('0xc'));var crypto=require(_0xbc70('0xd'));var jsforce=require(_0xbc70('0xe'));var deskjs=require(_0xbc70('0xf'));var toCsv=require(_0xbc70('0x8'));var querystring=require('querystring');var Papa=require(_0xbc70('0x10'));var Redis=require(_0xbc70('0x11'));var authService=require(_0xbc70('0x12'));var qs=require(_0xbc70('0x13'));var as=require(_0xbc70('0x14'));var hardwareService=require(_0xbc70('0x15'));var logger=require('../../config/logger')(_0xbc70('0x16'));var utils=require(_0xbc70('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbc70('0x18'));var db=require(_0xbc70('0x19'))['db'];config[_0xbc70('0x1a')]=_[_0xbc70('0x1b')](config[_0xbc70('0x1a')],{'host':_0xbc70('0x1c'),'port':0x18eb});var socket=require(_0xbc70('0x1d'))(new Redis(config[_0xbc70('0x1a')]));require(_0xbc70('0x1e'))[_0xbc70('0x1f')](socket);var jayson=require(_0xbc70('0x20'));var client=jayson['client'][_0xbc70('0x21')]({'port':0x232c});var client9002=jayson[_0xbc70('0x22')][_0xbc70('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5015e4,_0xbea64b,_0x544024,_0x486941){return new BPromise(function(_0x1a350d,_0x3e6cdd){var _0xf0c4ca=_0x486941||client;return _0xf0c4ca[_0xbc70('0x23')](_0x5015e4,_0x544024)['then'](function(_0x4d8630){logger['info'](_0xbc70('0x24'),_0xbea64b,_0xbc70('0x25'));logger[_0xbc70('0x26')](_0xbc70('0x27'),_0xbea64b,'request\x20sent',JSON['stringify'](_0x4d8630));if(_0x4d8630[_0xbc70('0x28')]){if(_0x4d8630[_0xbc70('0x28')][_0xbc70('0x29')]===0x1f4){logger[_0xbc70('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0xbea64b,_0x4d8630['error'][_0xbc70('0x2a')]);return _0x3e6cdd(_0x4d8630[_0xbc70('0x28')]['message']);}logger[_0xbc70('0x28')](_0xbc70('0x24'),_0xbea64b,_0x4d8630[_0xbc70('0x28')][_0xbc70('0x2a')]);return _0x1a350d(_0x4d8630['error'][_0xbc70('0x2a')]);}else{logger[_0xbc70('0x2b')](_0xbc70('0x24'),_0xbea64b,_0xbc70('0x25'));_0x1a350d(_0x4d8630[_0xbc70('0x2c')][_0xbc70('0x2a')]);}})['catch'](function(_0x2bfef6){logger[_0xbc70('0x28')](_0xbc70('0x24'),_0xbea64b,_0x2bfef6);_0x3e6cdd(_0x2bfef6);});});}function respondWithStatusCode(_0x3bbdf1,_0x15b533){_0x15b533=_0x15b533||0xcc;return function(_0x4c999c){if(_0x4c999c){return _0x3bbdf1[_0xbc70('0x2d')](_0x15b533);}return _0x3bbdf1[_0xbc70('0x2e')](_0x15b533)[_0xbc70('0x2f')]();};}function respondWithResult(_0x1958d5,_0x4c625e){_0x4c625e=_0x4c625e||0xc8;return function(_0x341f60){if(_0x341f60){return _0x1958d5[_0xbc70('0x2e')](_0x4c625e)[_0xbc70('0x30')](_0x341f60);}};}function respondWithFilteredResult(_0x5d339d,_0x87db35){return function(_0x476e42){if(_0x476e42){var _0x25a0f8=typeof _0x87db35[_0xbc70('0x31')]==='undefined'&&typeof _0x87db35[_0xbc70('0x32')]===_0xbc70('0x33');var _0x135063=_0x476e42['count'];var _0x4923bf=_0x25a0f8?0x0:_0x87db35['offset'];var _0x5e6d03=_0x25a0f8?_0x476e42[_0xbc70('0x34')]:_0x87db35[_0xbc70('0x31')]+_0x87db35[_0xbc70('0x32')];var _0x5728c6;if(_0x5e6d03>=_0x135063){_0x5e6d03=_0x135063;_0x5728c6=0xc8;}else{_0x5728c6=0xce;}_0x5d339d[_0xbc70('0x2e')](_0x5728c6);return _0x5d339d['set'](_0xbc70('0x35'),_0x4923bf+'-'+_0x5e6d03+'/'+_0x135063)[_0xbc70('0x30')](_0x476e42);}return null;};}function patchUpdates(_0x568c35){return function(_0x99eb33){try{jsonpatch[_0xbc70('0x36')](_0x99eb33,_0x568c35,!![]);}catch(_0x4ada88){return BPromise[_0xbc70('0x37')](_0x4ada88);}return _0x99eb33[_0xbc70('0x38')]();};}function saveUpdates(_0x33cb86,_0x17ca40){return function(_0x12e18c){if(_0x12e18c){return _0x12e18c['update'](_0x33cb86)[_0xbc70('0x39')](function(_0x2c0d5d){return _0x2c0d5d;});}return null;};}function removeEntity(_0x1e4dbe,_0x26e0db){return function(_0x173748){if(_0x173748){return _0x173748[_0xbc70('0x3a')]()['then'](function(){var _0x14d2f6=_0x173748[_0xbc70('0x3b')]({'plain':!![]});var _0x547f6c='OpenchannelAccounts';return db[_0xbc70('0x3c')]['destroy']({'where':{'type':_0x547f6c,'resourceId':_0x14d2f6['id']}})['then'](function(){return _0x173748;});})['then'](function(){_0x1e4dbe[_0xbc70('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x230f20,_0x1f6b97){return function(_0x217edf){if(!_0x217edf){_0x230f20[_0xbc70('0x2d')](0x194);}return _0x217edf;};}function handleError(_0x103188,_0x2a417a){_0x2a417a=_0x2a417a||0x1f4;return function(_0x423df6){logger[_0xbc70('0x28')](_0x423df6[_0xbc70('0x3d')]);if(_0x423df6[_0xbc70('0x3e')]){delete _0x423df6['name'];}_0x103188[_0xbc70('0x2e')](_0x2a417a)['send'](_0x423df6);};}exports[_0xbc70('0x3f')]=function(_0x59d9ac,_0x53d963){var _0x504676={'include':[{'model':db[_0xbc70('0x40')],'as':_0xbc70('0x41')}]},_0x115660={},_0x2c98db={'count':0x0,'rows':[]};var _0x4b136d=_['map'](db['OpenchannelAccount']['rawAttributes'],function(_0x57942d){return{'name':_0x57942d[_0xbc70('0x42')],'type':_0x57942d[_0xbc70('0x43')][_0xbc70('0x44')]};});_0x115660['model']=_[_0xbc70('0x45')](_0x4b136d,_0xbc70('0x3e'));_0x115660[_0xbc70('0x46')]=_[_0xbc70('0x47')](_0x59d9ac[_0xbc70('0x46')]);_0x115660[_0xbc70('0x48')]=_[_0xbc70('0x49')](_0x115660[_0xbc70('0x4a')],_0x115660[_0xbc70('0x46')]);_0x504676['attributes']=_['intersection'](_0x115660[_0xbc70('0x4a')],qs[_0xbc70('0x4b')](_0x59d9ac['query'][_0xbc70('0x4b')]));_0x504676[_0xbc70('0x4c')]=_0x504676[_0xbc70('0x4c')][_0xbc70('0x4d')]?_0x504676['attributes']:_0x115660[_0xbc70('0x4a')];if(!_0x59d9ac['query'][_0xbc70('0x4e')]('nolimit')){_0x504676[_0xbc70('0x32')]=qs[_0xbc70('0x32')](_0x59d9ac['query'][_0xbc70('0x32')]);_0x504676[_0xbc70('0x31')]=qs['offset'](_0x59d9ac[_0xbc70('0x46')][_0xbc70('0x31')]);}_0x504676[_0xbc70('0x4f')]=qs[_0xbc70('0x50')](_0x59d9ac[_0xbc70('0x46')][_0xbc70('0x50')]);_0x504676[_0xbc70('0x51')]=qs[_0xbc70('0x48')](_[_0xbc70('0x52')](_0x59d9ac[_0xbc70('0x46')],_0x115660['filters']),_0x4b136d);if(_0x59d9ac['query'][_0xbc70('0x53')]){_0x504676['where']=_[_0xbc70('0x54')](_0x504676['where'],{'$or':_[_0xbc70('0x45')](_0x4b136d,function(_0x4f7807){if(_0x4f7807['type']!==_0xbc70('0x55')){var _0x231e08={};_0x231e08[_0x4f7807[_0xbc70('0x3e')]]={'$like':'%'+_0x59d9ac[_0xbc70('0x46')][_0xbc70('0x53')]+'%'};return _0x231e08;}})});}_0x504676=_['merge']({},_0x504676,_0x59d9ac[_0xbc70('0x56')]);var _0x118422={'where':_0x504676['where']};return db[_0xbc70('0x57')][_0xbc70('0x34')](_0x118422)[_0xbc70('0x39')](function(_0x247630){_0x2c98db[_0xbc70('0x34')]=_0x247630;if(_0x59d9ac['query'][_0xbc70('0x58')]){_0x504676[_0xbc70('0x59')]=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x504676);})['then'](function(_0x405ce1){_0x2c98db['rows']=_0x405ce1;return _0x2c98db;})['then'](respondWithFilteredResult(_0x53d963,_0x504676))[_0xbc70('0x5a')](handleError(_0x53d963,null));};exports['show']=function(_0x2a2d20,_0x2f8e50){var _0x2c1d08={'raw':![],'where':{'id':_0x2a2d20[_0xbc70('0x5b')]['id']},'include':[{'model':db[_0xbc70('0x40')],'as':_0xbc70('0x41')}]},_0x428a50={};_0x428a50['model']=_['keys'](db[_0xbc70('0x57')]['rawAttributes']);_0x428a50[_0xbc70('0x46')]=_['keys'](_0x2a2d20[_0xbc70('0x46')]);_0x428a50['filters']=_[_0xbc70('0x49')](_0x428a50['model'],_0x428a50[_0xbc70('0x46')]);_0x2c1d08[_0xbc70('0x4c')]=_[_0xbc70('0x49')](_0x428a50[_0xbc70('0x4a')],qs[_0xbc70('0x4b')](_0x2a2d20['query'][_0xbc70('0x4b')]));_0x2c1d08[_0xbc70('0x4c')]=_0x2c1d08[_0xbc70('0x4c')][_0xbc70('0x4d')]?_0x2c1d08[_0xbc70('0x4c')]:_0x428a50[_0xbc70('0x4a')];if(_0x2a2d20[_0xbc70('0x46')][_0xbc70('0x58')]){_0x2c1d08[_0xbc70('0x59')]=[{'all':!![]}];}_0x2c1d08=_[_0xbc70('0x54')]({},_0x2c1d08,_0x2a2d20['options']);return db[_0xbc70('0x57')][_0xbc70('0x5c')](_0x2c1d08)[_0xbc70('0x39')](handleEntityNotFound(_0x2f8e50,null))[_0xbc70('0x39')](respondWithResult(_0x2f8e50,null))['catch'](handleError(_0x2f8e50,null));};exports[_0xbc70('0x5d')]=function(_0x560e53,_0x3df172){return db['OpenchannelAccount'][_0xbc70('0x5d')](_0x560e53[_0xbc70('0x5e')],{})[_0xbc70('0x39')](function(_0x559f69){var _0x20b19e=_0x560e53['user'][_0xbc70('0x3b')]({'plain':!![]});if(!_0x20b19e)throw new Error(_0xbc70('0x5f'));if(_0x20b19e['role']===_0xbc70('0x60')){var _0x2f0be6=_0x559f69[_0xbc70('0x3b')]({'plain':!![]});var _0x5b64a0=_0xbc70('0x61');return db[_0xbc70('0x62')][_0xbc70('0x5c')]({'where':{'name':_0x5b64a0,'userProfileId':_0x20b19e[_0xbc70('0x63')]},'raw':!![]})['then'](function(_0x24384c){if(_0x24384c&&_0x24384c[_0xbc70('0x64')]===0x0){return db[_0xbc70('0x3c')][_0xbc70('0x5d')]({'name':_0x2f0be6[_0xbc70('0x3e')],'resourceId':_0x2f0be6['id'],'type':_0x24384c[_0xbc70('0x3e')],'sectionId':_0x24384c['id']},{})[_0xbc70('0x39')](function(){return _0x559f69;});}else{return _0x559f69;}})['catch'](function(_0x415143){logger['error'](_0xbc70('0x65'),_0x415143);throw _0x415143;});}return _0x559f69;})[_0xbc70('0x39')](respondWithResult(_0x3df172,0xc9))[_0xbc70('0x5a')](handleError(_0x3df172,null));};exports[_0xbc70('0x66')]=function(_0x48fa0f,_0x5b4d68){if(_0x48fa0f[_0xbc70('0x5e')]['id']){delete _0x48fa0f[_0xbc70('0x5e')]['id'];}return db[_0xbc70('0x57')]['find']({'where':{'id':_0x48fa0f[_0xbc70('0x5b')]['id']},'include':[{'model':db[_0xbc70('0x40')],'as':'mandatoryDispositionPause'}]})[_0xbc70('0x39')](handleEntityNotFound(_0x5b4d68,null))['then'](saveUpdates(_0x48fa0f['body'],null))[_0xbc70('0x39')](respondWithResult(_0x5b4d68,null))[_0xbc70('0x5a')](handleError(_0x5b4d68,null));};exports[_0xbc70('0x3a')]=function(_0x1158f4,_0x507c13){return db[_0xbc70('0x57')][_0xbc70('0x5c')]({'where':{'id':_0x1158f4['params']['id']}})[_0xbc70('0x39')](handleEntityNotFound(_0x507c13,null))['then'](removeEntity(_0x507c13,null))[_0xbc70('0x5a')](handleError(_0x507c13,null));};exports['describe']=function(_0x2347a6,_0x101ea3){return db[_0xbc70('0x57')][_0xbc70('0x67')]()[_0xbc70('0x39')](respondWithResult(_0x101ea3,null))[_0xbc70('0x5a')](handleError(_0x101ea3,null));};exports[_0xbc70('0x68')]=function(_0x34e099,_0x10b558,_0x4eea77){if(_0x34e099[_0xbc70('0x5e')]['id']){delete _0x34e099['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x34e099['params']['id']}})[_0xbc70('0x39')](handleEntityNotFound(_0x10b558,null))[_0xbc70('0x39')](function(_0x5bd9ae){if(_0x5bd9ae){_0x34e099[_0xbc70('0x5e')][_0xbc70('0x69')]=_0x5bd9ae['id'];return db['Disposition'][_0xbc70('0x5d')](_0x34e099[_0xbc70('0x5e')]);}})[_0xbc70('0x39')](respondWithResult(_0x10b558,null))[_0xbc70('0x5a')](handleError(_0x10b558,null));};exports['getDispositions']=function(_0x312a41,_0x57b569,_0x12bf0d){var _0x4866ba={'raw':![],'where':{}};var _0x3f4d5e={};var _0x523457={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xbc70('0x6a')]({'where':{'id':_0x312a41[_0xbc70('0x5b')]['id']}})[_0xbc70('0x39')](handleEntityNotFound(_0x57b569,null))[_0xbc70('0x39')](function(_0x1ab8ac){if(_0x1ab8ac){_0x3f4d5e['model']=_[_0xbc70('0x47')](db[_0xbc70('0x6b')][_0xbc70('0x6c')]);_0x3f4d5e['query']=_[_0xbc70('0x47')](_0x312a41['query']);_0x3f4d5e['filters']=_[_0xbc70('0x49')](_0x3f4d5e[_0xbc70('0x4a')],_0x3f4d5e['query']);_0x4866ba[_0xbc70('0x4c')]=_[_0xbc70('0x49')](_0x3f4d5e[_0xbc70('0x4a')],qs['fields'](_0x312a41[_0xbc70('0x46')][_0xbc70('0x4b')]));_0x4866ba[_0xbc70('0x4c')]=_0x4866ba[_0xbc70('0x4c')][_0xbc70('0x4d')]?_0x4866ba[_0xbc70('0x4c')]:_0x3f4d5e[_0xbc70('0x4a')];if(!_0x312a41[_0xbc70('0x46')][_0xbc70('0x4e')](_0xbc70('0x6d'))){_0x4866ba[_0xbc70('0x32')]=qs[_0xbc70('0x32')](_0x312a41[_0xbc70('0x46')][_0xbc70('0x32')]);_0x4866ba[_0xbc70('0x31')]=qs[_0xbc70('0x31')](_0x312a41[_0xbc70('0x46')][_0xbc70('0x31')]);}_0x4866ba[_0xbc70('0x4f')]=qs[_0xbc70('0x50')](_0x312a41['query']['sort']);_0x4866ba[_0xbc70('0x51')]=qs['filters'](_[_0xbc70('0x52')](_0x312a41['query'],_0x3f4d5e[_0xbc70('0x48')]));_0x4866ba[_0xbc70('0x51')][_0xbc70('0x69')]=_0x1ab8ac['id'];if(_0x312a41[_0xbc70('0x46')][_0xbc70('0x53')]){_0x4866ba[_0xbc70('0x51')]=_['merge'](_0x4866ba[_0xbc70('0x51')],{'$or':_['map'](_0x4866ba[_0xbc70('0x4c')],function(_0x435fea){var _0x3cf18e={};_0x3cf18e[_0x435fea]={'$like':'%'+_0x312a41[_0xbc70('0x46')]['filter']+'%'};return _0x3cf18e;})});}_0x4866ba=_[_0xbc70('0x54')]({},_0x4866ba,_0x312a41[_0xbc70('0x56')]);return db[_0xbc70('0x6b')][_0xbc70('0x34')]({'where':_0x4866ba[_0xbc70('0x51')]})[_0xbc70('0x39')](function(_0x1275ac){_0x523457[_0xbc70('0x34')]=_0x1275ac;if(_0x312a41[_0xbc70('0x46')][_0xbc70('0x58')]){_0x4866ba[_0xbc70('0x59')]=[{'all':!![]}];}return db[_0xbc70('0x6b')]['findAll'](_0x4866ba);})['then'](function(_0x42ce38){_0x523457[_0xbc70('0x6e')]=_0x42ce38;return _0x523457;});}})['then'](respondWithFilteredResult(_0x57b569,_0x4866ba))[_0xbc70('0x5a')](handleError(_0x57b569,null));};exports[_0xbc70('0x6f')]=function(_0x5490ba,_0x3c8850,_0x34ee72){return db[_0xbc70('0x57')][_0xbc70('0x5c')]({'where':{'id':_0x5490ba[_0xbc70('0x5b')]['id']}})[_0xbc70('0x39')](handleEntityNotFound(_0x3c8850,null))['then'](function(_0x50a20d){if(_0x50a20d){return _0x50a20d[_0xbc70('0x6f')](_0x5490ba['query'][_0xbc70('0x70')]);}})[_0xbc70('0x39')](respondWithStatusCode(_0x3c8850,null))['catch'](handleError(_0x3c8850,null));};exports[_0xbc70('0x71')]=function(_0x4b7a83,_0x547269,_0x1d9b43){if(_0x4b7a83['body']['id']){delete _0x4b7a83['body']['id'];}return db[_0xbc70('0x57')][_0xbc70('0x5c')]({'where':{'id':_0x4b7a83[_0xbc70('0x5b')]['id']}})[_0xbc70('0x39')](handleEntityNotFound(_0x547269,null))['then'](function(_0x59cd5a){if(_0x59cd5a){_0x4b7a83[_0xbc70('0x5e')]['OpenchannelAccountId']=_0x59cd5a['id'];return db['CannedAnswer'][_0xbc70('0x5d')](_0x4b7a83[_0xbc70('0x5e')]);}})[_0xbc70('0x39')](respondWithResult(_0x547269,null))[_0xbc70('0x5a')](handleError(_0x547269,null));};exports['getAnswers']=function(_0x98b2e1,_0x1253de,_0x51db71){var _0x482bb1={'raw':![],'where':{}};var _0x28737e={};var _0x29bdd7={'count':0x0,'rows':[]};return db[_0xbc70('0x57')]['findOne']({'where':{'id':_0x98b2e1[_0xbc70('0x5b')]['id']}})[_0xbc70('0x39')](handleEntityNotFound(_0x1253de,null))[_0xbc70('0x39')](function(_0x4ca264){if(_0x4ca264){_0x28737e[_0xbc70('0x4a')]=_[_0xbc70('0x47')](db['CannedAnswer']['rawAttributes']);_0x28737e[_0xbc70('0x46')]=_['keys'](_0x98b2e1[_0xbc70('0x46')]);_0x28737e['filters']=_[_0xbc70('0x49')](_0x28737e['model'],_0x28737e[_0xbc70('0x46')]);_0x482bb1[_0xbc70('0x4c')]=_[_0xbc70('0x49')](_0x28737e[_0xbc70('0x4a')],qs[_0xbc70('0x4b')](_0x98b2e1[_0xbc70('0x46')][_0xbc70('0x4b')]));_0x482bb1['attributes']=_0x482bb1[_0xbc70('0x4c')]['length']?_0x482bb1['attributes']:_0x28737e[_0xbc70('0x4a')];if(!_0x98b2e1[_0xbc70('0x46')][_0xbc70('0x4e')]('nolimit')){_0x482bb1[_0xbc70('0x32')]=qs[_0xbc70('0x32')](_0x98b2e1[_0xbc70('0x46')][_0xbc70('0x32')]);_0x482bb1[_0xbc70('0x31')]=qs['offset'](_0x98b2e1[_0xbc70('0x46')][_0xbc70('0x31')]);}_0x482bb1[_0xbc70('0x4f')]=qs[_0xbc70('0x50')](_0x98b2e1[_0xbc70('0x46')][_0xbc70('0x50')]);_0x482bb1[_0xbc70('0x51')]=qs[_0xbc70('0x48')](_['pick'](_0x98b2e1[_0xbc70('0x46')],_0x28737e[_0xbc70('0x48')]));_0x482bb1[_0xbc70('0x51')][_0xbc70('0x69')]=_0x4ca264['id'];if(_0x98b2e1[_0xbc70('0x46')][_0xbc70('0x53')]){_0x482bb1[_0xbc70('0x51')]=_['merge'](_0x482bb1[_0xbc70('0x51')],{'$or':_[_0xbc70('0x45')](_0x482bb1[_0xbc70('0x4c')],function(_0xf06341){var _0x1341cf={};_0x1341cf[_0xf06341]={'$like':'%'+_0x98b2e1[_0xbc70('0x46')]['filter']+'%'};return _0x1341cf;})});}_0x482bb1=_[_0xbc70('0x54')]({},_0x482bb1,_0x98b2e1[_0xbc70('0x56')]);return db[_0xbc70('0x72')][_0xbc70('0x34')]({'where':_0x482bb1[_0xbc70('0x51')]})[_0xbc70('0x39')](function(_0x3ef206){_0x29bdd7['count']=_0x3ef206;if(_0x98b2e1[_0xbc70('0x46')][_0xbc70('0x58')]){_0x482bb1[_0xbc70('0x59')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x482bb1);})['then'](function(_0x4dcb57){_0x29bdd7[_0xbc70('0x6e')]=_0x4dcb57;return _0x29bdd7;});}})[_0xbc70('0x39')](respondWithFilteredResult(_0x1253de,_0x482bb1))[_0xbc70('0x5a')](handleError(_0x1253de,null));};exports[_0xbc70('0x73')]=function(_0x4f7d85,_0x4cb0f1,_0x49880f){return db[_0xbc70('0x57')][_0xbc70('0x5c')]({'where':{'id':_0x4f7d85[_0xbc70('0x5b')]['id']}})[_0xbc70('0x39')](handleEntityNotFound(_0x4cb0f1,null))[_0xbc70('0x39')](function(_0x96c05){if(_0x96c05){return _0x96c05[_0xbc70('0x73')](_0x4f7d85['query'][_0xbc70('0x70')]);}})[_0xbc70('0x39')](respondWithStatusCode(_0x4cb0f1,null))[_0xbc70('0x5a')](handleError(_0x4cb0f1,null));};exports[_0xbc70('0x74')]=function(_0x3a1463,_0x315c4f,_0x373684){var _0xe9d7dd={'body':_0x3a1463[_0xbc70('0x5e')],'channel':_0xbc70('0x75')};var _0x4f3b3e=[];var _0x322606=[];var _0x2aae92={};var _0xbd0a98=![];return db[_0xbc70('0x76')]['describe']()['then'](function(_0x28f598){if(!_0x28f598){throw new db[(_0xbc70('0x77'))][(_0xbc70('0x78'))](_0xbc70('0x79'));}_0x4f3b3e=_[_0xbc70('0x7a')](_['keys'](_0x28f598),[_0xbc70('0x7b'),_0xbc70('0x7c')]);_0x322606=_[_0xbc70('0x7a')](_[_0xbc70('0x47')](_0x28f598),['createdAt',_0xbc70('0x7c'),_0xbc70('0x7d'),_0xbc70('0x7e')]);if(_0x3a1463[_0xbc70('0x5e')]['id']){delete _0x3a1463[_0xbc70('0x5e')]['id'];}if(_['isNil'](_0x3a1463[_0xbc70('0x5e')][_0xbc70('0x7f')])){throw new db['Sequelize'][(_0xbc70('0x78'))](_0xbc70('0x80'));}if(_[_0xbc70('0x81')](_0x3a1463[_0xbc70('0x5e')][_0xbc70('0x5e')])||_0x3a1463[_0xbc70('0x5e')][_0xbc70('0x5e')]===''){throw new db['Sequelize'][(_0xbc70('0x78'))](_0xbc70('0x82'));}if(_[_0xbc70('0x81')](_0x3a1463[_0xbc70('0x5e')][_0xbc70('0x83')])){throw new db[(_0xbc70('0x77'))][(_0xbc70('0x78'))](_0xbc70('0x84')+_0x322606);}if(!_[_0xbc70('0x85')](_0x322606,_0x3a1463[_0xbc70('0x5e')]['mapKey'])){throw new db[(_0xbc70('0x77'))][(_0xbc70('0x78'))](_0xbc70('0x86')+_0x322606);}_0x2aae92[_0x3a1463[_0xbc70('0x5e')][_0xbc70('0x83')]]=_0x3a1463[_0xbc70('0x5e')]['from'];})['then'](function(){return db[_0xbc70('0x57')]['find']({'where':{'id':_0x3a1463[_0xbc70('0x5b')]['id']},'include':[{'model':db[_0xbc70('0x87')],'as':_0xbc70('0x88'),'include':[{'model':db[_0xbc70('0x76')],'as':_0xbc70('0x89'),'where':_0x2aae92,'limit':0x1,'order':[[_0xbc70('0x7c'),'DESC']]}]},{'model':db[_0xbc70('0x8a')],'as':_0xbc70('0x8b')}]});})['then'](handleEntityNotFound(_0x315c4f,null))[_0xbc70('0x39')](function(_0x54092a){if(_0x54092a&&_0x54092a[_0xbc70('0x88')]){_0xe9d7dd[_0xbc70('0x8c')]=_0x54092a;_0xe9d7dd[_0xbc70('0x8d')]=_0x54092a[_0xbc70('0x8b')];_0xe9d7dd[_0xbc70('0x8e')]=_0x54092a[_0xbc70('0x88')];_0xe9d7dd[_0xbc70('0x8d')]=_[_0xbc70('0x8f')](_0xe9d7dd[_0xbc70('0x8d')],[_0xbc70('0x90')],[_0xbc70('0x91')]);if(_0xe9d7dd[_0xbc70('0x8c')]['Applications']){delete _0xe9d7dd[_0xbc70('0x8c')][_0xbc70('0x8b')];}if(_0xe9d7dd['account']['List']&&_0xe9d7dd[_0xbc70('0x8c')][_0xbc70('0x88')][_0xbc70('0x89')][_0xbc70('0x4d')]){return _0xe9d7dd[_0xbc70('0x8c')][_0xbc70('0x88')][_0xbc70('0x89')][0x0];}var _0x2acffd=_[_0xbc70('0x1b')](_0x3a1463[_0xbc70('0x5e')],{'firstName':_0x3a1463[_0xbc70('0x5e')]['from'],'ListId':_0x54092a[_0xbc70('0x7e')]});_0x2acffd[_0x3a1463[_0xbc70('0x5e')][_0xbc70('0x83')]]=_0x3a1463[_0xbc70('0x5e')][_0xbc70('0x7f')];return db[_0xbc70('0x76')][_0xbc70('0x5d')](_0x2acffd,{'fields':_0x4f3b3e,'raw':!![]});}})[_0xbc70('0x39')](handleEntityNotFound(_0x315c4f,null))[_0xbc70('0x39')](function(_0x5657f6){_0xe9d7dd[_0xbc70('0x92')]=_0x5657f6;if(_0x5657f6){var _0xbd4a24={'ContactId':_0x5657f6['id'],'OpenchannelAccountId':_0x3a1463[_0xbc70('0x5b')]['id'],'from':(_0x5657f6[_0xbc70('0x93')]||'')+'\x20'+(_0x5657f6[_0xbc70('0x94')]||'')};var _0x316583={'OpenchannelAccountId':_0x3a1463[_0xbc70('0x5b')]['id'],'closed':![]};if(_0x3a1463['body']['threadId']){_0x316583[_0xbc70('0x95')]=_0x3a1463[_0xbc70('0x5e')]['threadId'];return db['OpenchannelInteraction'][_0xbc70('0x5c')]({'where':_0x316583})[_0xbc70('0x39')](function(_0xbd0107){if(_0xbd0107){return[_0xbd0107,![]];}_0xbd4a24[_0xbc70('0x95')]=_0x3a1463[_0xbc70('0x5e')]['threadId'];_0xbd4a24[_0xbc70('0x96')]=_0x3a1463[_0xbc70('0x5e')][_0xbc70('0x96')];return db[_0xbc70('0x97')][_0xbc70('0x5d')](_0xbd4a24)['then'](function(_0x183481){return[_0x183481,!![]];});});}else{_0x316583[_0xbc70('0x95')]=null;}_0x316583[_0xbc70('0x98')]=_0x5657f6['id'];return db['OpenchannelInteraction'][_0xbc70('0x5c')]({'where':_0x316583})['then'](function(_0x2c6268){if(_0x2c6268){return[_0x2c6268,![]];}return db[_0xbc70('0x97')][_0xbc70('0x5d')](_0xbd4a24)['then'](function(_0x4b0646){return[_0x4b0646,!![]];});});}})['spread'](function(_0x5e74e1,_0x3073d2){if(_0x5e74e1){_0xbd0a98=_0x3073d2;if(!_0x3073d2){var _0x54314f={'from':(_0xe9d7dd[_0xbc70('0x92')][_0xbc70('0x93')]||'')+'\x20'+(_0xe9d7dd['contact']['lastName']||'')};if(_0x3a1463[_0xbc70('0x5e')]['threadId']&&_0x3a1463[_0xbc70('0x5e')]['messageId']&&_0x3a1463[_0xbc70('0x5e')][_0xbc70('0x95')]!=_0x3a1463[_0xbc70('0x5e')][_0xbc70('0x99')]){_0x54314f[_0xbc70('0x95')]=_0x3a1463[_0xbc70('0x5e')][_0xbc70('0x99')];}return _0x5e74e1[_0xbc70('0x66')](_0x54314f);}else{return _0x5e74e1;}}})[_0xbc70('0x39')](function(_0x5bf8f0){_0xe9d7dd[_0xbc70('0x9a')]=_0x5bf8f0[_0xbc70('0x3b')]({'plain':!![]});_0xe9d7dd['interaction'][_0xbc70('0x9b')]=_0xbd0a98;if(_0xe9d7dd['interaction'][_0xbc70('0x9b')]){if(_0xe9d7dd[_0xbc70('0x8c')][_0xbc70('0x9c')]){_0xe9d7dd[_0xbc70('0x8d')][_0xbc70('0x9d')]({'id':0x0,'priority':_0xe9d7dd[_0xbc70('0x8d')][_0xbc70('0x4d')]+0x1,'app':'close','appdata':_0xbc70('0x9e'),'interval':'*,*,*,*'});}}return db[_0xbc70('0x9f')]['create']({'body':_0x3a1463[_0xbc70('0x5e')][_0xbc70('0x5e')],'OpenchannelAccountId':_0x3a1463['params']['id'],'OpenchannelInteractionId':_0x5bf8f0['id'],'direction':'in','ContactId':_0xe9d7dd[_0xbc70('0x92')]['id'],'AttachmentId':_0x3a1463[_0xbc70('0x5e')][_0xbc70('0xa0')]});})[_0xbc70('0x39')](function(_0x528825){_0xe9d7dd[_0xbc70('0x2a')]=_0x528825;if(_0xe9d7dd[_0xbc70('0x9a')][_0xbc70('0xa1')]){return db['User'][_0xbc70('0x5c')]({'attributes':['id','name'],'where':{'id':_0xe9d7dd['interaction'][_0xbc70('0xa1')]}})[_0xbc70('0x39')](function(_0x40d112){if(_0x40d112){_0xe9d7dd[_0xbc70('0x8d')][_0xbc70('0xa2')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x40d112[_0xbc70('0x3e')]+','+(_0xe9d7dd['account']['waitForTheAssignedAgent']||0xa),'interval':_0xbc70('0xa3')});_0xe9d7dd[_0xbc70('0xa4')]=![];}return respondWithRpcPromise(_0xbc70('0xa5'),_0xbc70('0xa6'),_0xe9d7dd);});}return respondWithRpcPromise(_0xbc70('0xa5'),_0xbc70('0xa6'),_0xe9d7dd);})[_0xbc70('0x39')](function(_0x447782){respondWithRpcPromise(_0xbc70('0xa7'),_0xbc70('0xa7'),{'event':_0xbc70('0x74'),'message':_0x447782},client9002);return _0x447782;})[_0xbc70('0x39')](respondWithResult(_0x315c4f,null))[_0xbc70('0x5a')](handleError(_0x315c4f,null));};exports[_0xbc70('0xa8')]=function(_0x3b6a96,_0x3adc3f){var _0x2626b1=_0x3b6a96['params']['id'];var _0x4efc16=_0x3b6a96[_0xbc70('0x5e')];var _0x5395a2=0xc8;var _0x2f2369=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xbc70('0xa9')][_0xbc70('0xaa')][_0xbc70('0xab')][_0xbc70('0xac')]},function(_0x47dbc0){return db[_0xbc70('0x57')][_0xbc70('0x6a')]({'where':{'id':_0x2626b1},'transaction':_0x47dbc0})[_0xbc70('0x39')](function(_0x576cd9){if(_0x576cd9){return db[_0xbc70('0x8a')][_0xbc70('0x3a')]({'where':{'OpenchannelAccountId':_0x2626b1},'transaction':_0x47dbc0})[_0xbc70('0x39')](function(){var _0x24b998=_['map'](_0x4efc16,function(_0x2f69c7){_0x2f69c7[_0xbc70('0x69')]=_0x2626b1;return _0x2f69c7;});return db['OpenchannelApplication'][_0xbc70('0xad')](_0x24b998,{'transaction':_0x47dbc0});});}else{_0x5395a2=0x194;_0x2f2369=[];}});})[_0xbc70('0x39')](function(){if(_0x5395a2!==0x194){return db[_0xbc70('0x8a')][_0xbc70('0xae')]({'where':{'OpenchannelAccountId':_0x2626b1},'order':_0xbc70('0x90')})[_0xbc70('0x39')](function(_0x2c8488){_0x2f2369=_0x2c8488;});}})[_0xbc70('0x5a')](function(_0x2916f8){_0x5395a2=0x1f4;logger['error'](_0x2916f8[_0xbc70('0x3d')]);if(_0x2916f8[_0xbc70('0x3e')]){delete _0x2916f8[_0xbc70('0x3e')];}_0x2f2369=_0x2916f8;})[_0xbc70('0xaf')](function(){if(_0x2f2369===null){_0x3adc3f['sendStatus'](_0x5395a2);}else{if(_0x5395a2===0x1f4){_0x3adc3f[_0xbc70('0x2e')](_0x5395a2)['send'](_0x2f2369);}else{_0x3adc3f['status'](_0x5395a2)[_0xbc70('0x30')](_0x2f2369);}}});};exports['getApplications']=function(_0x3aae70,_0x31f1c0,_0xe2cc5a){var _0x280b3c={};var _0x1bb114={};var _0x319bdc;var _0x48f0bc;return db[_0xbc70('0x57')][_0xbc70('0x6a')]({'where':{'id':_0x3aae70[_0xbc70('0x5b')]['id']}})[_0xbc70('0x39')](handleEntityNotFound(_0x31f1c0,null))[_0xbc70('0x39')](function(_0x365106){if(_0x365106){_0x319bdc=_0x365106;_0x1bb114[_0xbc70('0x4a')]=_[_0xbc70('0x47')](db[_0xbc70('0x8a')][_0xbc70('0x6c')]);_0x1bb114[_0xbc70('0x46')]=_[_0xbc70('0x47')](_0x3aae70[_0xbc70('0x46')]);_0x1bb114[_0xbc70('0x48')]=_[_0xbc70('0x49')](_0x1bb114[_0xbc70('0x4a')],_0x1bb114[_0xbc70('0x46')]);_0x280b3c['attributes']=_[_0xbc70('0x49')](_0x1bb114[_0xbc70('0x4a')],qs[_0xbc70('0x4b')](_0x3aae70[_0xbc70('0x46')][_0xbc70('0x4b')]));_0x280b3c[_0xbc70('0x4c')]=_0x280b3c[_0xbc70('0x4c')][_0xbc70('0x4d')]?_0x280b3c['attributes']:_0x1bb114[_0xbc70('0x4a')];_0x280b3c[_0xbc70('0x4f')]=qs[_0xbc70('0x50')](_0x3aae70[_0xbc70('0x46')]['sort']);_0x280b3c[_0xbc70('0x51')]=qs[_0xbc70('0x48')](_[_0xbc70('0x52')](_0x3aae70[_0xbc70('0x46')],_0x1bb114[_0xbc70('0x48')]));if(_0x3aae70[_0xbc70('0x46')]['filter']){_0x280b3c['where']=_[_0xbc70('0x54')](_0x280b3c[_0xbc70('0x51')],{'$or':_[_0xbc70('0x45')](_0x280b3c['attributes'],function(_0x2d885e){var _0x4cd117={};_0x4cd117[_0x2d885e]={'$like':'%'+_0x3aae70['query'][_0xbc70('0x53')]+'%'};return _0x4cd117;})});}_0x280b3c=_['merge']({},_0x280b3c,_0x3aae70[_0xbc70('0x56')]);return _0x319bdc[_0xbc70('0xb0')](_0x280b3c);}})['then'](function(_0x465c5e){if(_0x465c5e){_0x48f0bc=_0x465c5e[_0xbc70('0x4d')];if(!_0x3aae70[_0xbc70('0x46')][_0xbc70('0x4e')](_0xbc70('0x6d'))){_0x280b3c['limit']=qs['limit'](_0x3aae70[_0xbc70('0x46')][_0xbc70('0x32')]);_0x280b3c[_0xbc70('0x31')]=qs[_0xbc70('0x31')](_0x3aae70[_0xbc70('0x46')][_0xbc70('0x31')]);}return _0x319bdc[_0xbc70('0xb0')](_0x280b3c);}})[_0xbc70('0x39')](function(_0x1e67fb){if(_0x1e67fb){return _0x1e67fb?{'count':_0x48f0bc,'rows':_0x1e67fb}:null;}})[_0xbc70('0x39')](respondWithResult(_0x31f1c0,null))[_0xbc70('0x5a')](handleError(_0x31f1c0,null));};exports[_0xbc70('0xb1')]=function(_0x5d9ed1,_0x8bb38,_0xfd54d4){var _0x227a65={'raw':![],'where':{}};var _0x1c19b5={};var _0x3987e4={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xbc70('0x6a')]({'where':{'id':_0x5d9ed1[_0xbc70('0x5b')]['id']}})['then'](handleEntityNotFound(_0x8bb38,null))[_0xbc70('0x39')](function(_0x3e95b6){if(_0x3e95b6){_0x1c19b5[_0xbc70('0x4a')]=_['keys'](db['OpenchannelInteraction'][_0xbc70('0x6c')]);_0x1c19b5[_0xbc70('0x46')]=_['keys'](_0x5d9ed1[_0xbc70('0x46')]);_0x1c19b5['filters']=_[_0xbc70('0x49')](_0x1c19b5[_0xbc70('0x4a')],_0x1c19b5['query']);_0x227a65[_0xbc70('0x4c')]=_[_0xbc70('0x49')](_0x1c19b5[_0xbc70('0x4a')],qs[_0xbc70('0x4b')](_0x5d9ed1['query'][_0xbc70('0x4b')]));_0x227a65[_0xbc70('0x4c')]=_0x227a65[_0xbc70('0x4c')]['length']?_0x227a65['attributes']:_0x1c19b5[_0xbc70('0x4a')];if(!_0x5d9ed1[_0xbc70('0x46')][_0xbc70('0x4e')](_0xbc70('0x6d'))){_0x227a65['limit']=qs[_0xbc70('0x32')](_0x5d9ed1[_0xbc70('0x46')][_0xbc70('0x32')]);_0x227a65[_0xbc70('0x31')]=qs[_0xbc70('0x31')](_0x5d9ed1['query'][_0xbc70('0x31')]);}_0x227a65[_0xbc70('0x4f')]=qs['sort'](_0x5d9ed1[_0xbc70('0x46')][_0xbc70('0x50')]);_0x227a65[_0xbc70('0x51')]=qs[_0xbc70('0x48')](_[_0xbc70('0x52')](_0x5d9ed1[_0xbc70('0x46')],_0x1c19b5[_0xbc70('0x48')]));_0x227a65[_0xbc70('0x51')][_0xbc70('0x69')]=_0x3e95b6['id'];if(_0x5d9ed1[_0xbc70('0x46')][_0xbc70('0x53')]){_0x227a65[_0xbc70('0x51')]=_[_0xbc70('0x54')](_0x227a65[_0xbc70('0x51')],{'$or':_[_0xbc70('0x45')](_0x227a65[_0xbc70('0x4c')],function(_0x35e896){var _0x5be002={};_0x5be002[_0x35e896]={'$like':'%'+_0x5d9ed1[_0xbc70('0x46')][_0xbc70('0x53')]+'%'};return _0x5be002;})});}_0x227a65=_[_0xbc70('0x54')]({},_0x227a65,_0x5d9ed1['options']);return db['OpenchannelInteraction']['count']({'where':_0x227a65[_0xbc70('0x51')]})[_0xbc70('0x39')](function(_0x2e3cc7){_0x3987e4[_0xbc70('0x34')]=_0x2e3cc7;if(_0x5d9ed1[_0xbc70('0x46')]['includeAll']){_0x227a65['include']=[{'model':db['CmContact'],'as':_0xbc70('0xb2'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xbc70('0x3e'),_0xbc70('0xb3'),_0xbc70('0xb4')],'required':![]},{'model':db[_0xbc70('0xb5')],'as':_0xbc70('0xb6'),'attributes':['id',_0xbc70('0x3e'),'color'],'where':_0x5d9ed1[_0xbc70('0x46')]['tag']?{'id':_0x5d9ed1[_0xbc70('0x46')][_0xbc70('0xb7')]}:undefined,'required':_0x5d9ed1[_0xbc70('0x46')][_0xbc70('0xb7')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xbc70('0xb8')](_0x227a65);})[_0xbc70('0x39')](function(_0x3288d7){_0x3987e4[_0xbc70('0x6e')]=_0x3288d7;return _0x3987e4;});}})[_0xbc70('0x39')](respondWithFilteredResult(_0x8bb38,_0x227a65))[_0xbc70('0x5a')](handleError(_0x8bb38,null));};exports['addAgents']=function(_0x297821,_0x7ccffa,_0x39dbc3){return db[_0xbc70('0x57')][_0xbc70('0x5c')]({'where':{'id':_0x297821[_0xbc70('0x5b')]['id']}})[_0xbc70('0x39')](handleEntityNotFound(_0x7ccffa,null))[_0xbc70('0x39')](function(_0x46a64a){if(_0x46a64a){return _0x46a64a[_0xbc70('0xb9')](_0x297821[_0xbc70('0x5e')]['ids'],_[_0xbc70('0xba')](_0x297821[_0xbc70('0x5e')],[_0xbc70('0x70'),'id'])||{})[_0xbc70('0xbb')](function(_0x3ed1f4){for(var _0x4ff442=0x0;_0x4ff442<_0x297821[_0xbc70('0x5e')][_0xbc70('0x70')][_0xbc70('0x4d')];_0x4ff442+=0x1){socket[_0xbc70('0xbc')]('userOpenchannelAccount:save',{'UserId':Number(_0x297821[_0xbc70('0x5e')][_0xbc70('0x70')][_0x4ff442]),'OpenchannelAccountId':Number(_0x297821['params']['id'])});}return _0x3ed1f4;});}})[_0xbc70('0x39')](respondWithResult(_0x7ccffa,null))[_0xbc70('0x5a')](handleError(_0x7ccffa,null));};exports[_0xbc70('0xbd')]=function(_0x100852,_0x5dd90b,_0x28ca41){return db[_0xbc70('0x57')][_0xbc70('0x5c')]({'where':{'id':_0x100852['params']['id']}})[_0xbc70('0x39')](handleEntityNotFound(_0x5dd90b,null))['then'](function(_0x435ab9){if(_0x435ab9){return _0x435ab9[_0xbc70('0xbd')](_0x100852['query'][_0xbc70('0x70')])[_0xbc70('0x39')](function(){if(_['isArray'](_0x100852['query'][_0xbc70('0x70')])){for(var _0x2d5da2=0x0;_0x2d5da2<_0x100852[_0xbc70('0x46')][_0xbc70('0x70')][_0xbc70('0x4d')];_0x2d5da2+=0x1){socket[_0xbc70('0xbc')](_0xbc70('0xbe'),{'UserId':Number(_0x100852[_0xbc70('0x46')][_0xbc70('0x70')][_0x2d5da2]),'OpenchannelAccountId':Number(_0x100852[_0xbc70('0x5b')]['id'])});}}else{socket[_0xbc70('0xbc')]('userOpenchannelAccount:remove',{'UserId':Number(_0x100852['query'][_0xbc70('0x70')]),'OpenchannelAccountId':Number(_0x100852['params']['id'])});}});}})[_0xbc70('0x39')](respondWithStatusCode(_0x5dd90b,null))[_0xbc70('0x5a')](handleError(_0x5dd90b,null));};exports[_0xbc70('0xbf')]=function(_0x1af936,_0x41f801,_0x5defdd){var _0x285506={};var _0xd4fcce={};var _0x441426;var _0x4cb68d;return db[_0xbc70('0x57')][_0xbc70('0x6a')]({'where':{'id':_0x1af936['params']['id']}})[_0xbc70('0x39')](handleEntityNotFound(_0x41f801,null))['then'](function(_0x40e6a5){if(_0x40e6a5){_0x441426=_0x40e6a5;_0xd4fcce[_0xbc70('0x4a')]=_['keys'](db[_0xbc70('0xc0')][_0xbc70('0x6c')]);_0xd4fcce['query']=_[_0xbc70('0x47')](_0x1af936[_0xbc70('0x46')]);_0xd4fcce[_0xbc70('0x48')]=_[_0xbc70('0x49')](_0xd4fcce['model'],_0xd4fcce['query']);_0x285506[_0xbc70('0x4c')]=_['intersection'](_0xd4fcce[_0xbc70('0x4a')],qs[_0xbc70('0x4b')](_0x1af936[_0xbc70('0x46')][_0xbc70('0x4b')]));_0x285506[_0xbc70('0x4c')]=_0x285506[_0xbc70('0x4c')][_0xbc70('0x4d')]?_0x285506['attributes']:_0xd4fcce[_0xbc70('0x4a')];_0x285506[_0xbc70('0x4f')]=qs[_0xbc70('0x50')](_0x1af936[_0xbc70('0x46')][_0xbc70('0x50')]);_0x285506[_0xbc70('0x51')]=qs[_0xbc70('0x48')](_[_0xbc70('0x52')](_0x1af936[_0xbc70('0x46')],_0xd4fcce['filters']));if(_0x1af936[_0xbc70('0x46')][_0xbc70('0x53')]){_0x285506['where']=_[_0xbc70('0x54')](_0x285506['where'],{'$or':_['map'](_0x285506[_0xbc70('0x4c')],function(_0x46b9db){var _0x4bdd2e={};_0x4bdd2e[_0x46b9db]={'$like':'%'+_0x1af936[_0xbc70('0x46')][_0xbc70('0x53')]+'%'};return _0x4bdd2e;})});}_0x285506=_['merge']({},_0x285506,_0x1af936[_0xbc70('0x56')]);return _0x441426[_0xbc70('0xbf')](_0x285506);}})[_0xbc70('0x39')](function(_0x1cf110){if(_0x1cf110){_0x4cb68d=_0x1cf110[_0xbc70('0x4d')];if(!_0x1af936[_0xbc70('0x46')][_0xbc70('0x4e')]('nolimit')){_0x285506[_0xbc70('0x32')]=qs[_0xbc70('0x32')](_0x1af936[_0xbc70('0x46')]['limit']);_0x285506[_0xbc70('0x31')]=qs[_0xbc70('0x31')](_0x1af936[_0xbc70('0x46')][_0xbc70('0x31')]);}return _0x441426[_0xbc70('0xbf')](_0x285506);}})[_0xbc70('0x39')](function(_0x1e00d7){if(_0x1e00d7){return _0x1e00d7?{'count':_0x4cb68d,'rows':_0x1e00d7}:null;}})[_0xbc70('0x39')](respondWithResult(_0x41f801,null))[_0xbc70('0x5a')](handleError(_0x41f801,null));};exports['send']=function(_0x4025b3,_0x45c5a6,_0x491f31){var _0x43aaa5,_0x431e35,_0x2d6d64;if(_[_0xbc70('0x81')](_0x4025b3[_0xbc70('0x5e')]['body'])||_0x4025b3['body'][_0xbc70('0x5e')]===''){throw new db['Sequelize'][(_0xbc70('0x78'))](_0xbc70('0x82'));}if(_[_0xbc70('0x81')](_0x4025b3[_0xbc70('0x5e')]['to'])){}_0x43aaa5=_0x4025b3[_0xbc70('0x5e')]['to'];return db[_0xbc70('0x57')][_0xbc70('0x6a')]({'where':{'id':_0x4025b3[_0xbc70('0x5b')]['id']}})['then'](handleEntityNotFound(_0x45c5a6,null))['then'](function(_0x109677){if(_0x109677){return db[_0xbc70('0x57')][_0xbc70('0x5c')]({'where':{'id':_0x109677['id']},'include':[{'model':db[_0xbc70('0x87')],'as':'List','include':[{'model':db[_0xbc70('0x76')],'as':_0xbc70('0x89'),'where':{[_0x109677[_0xbc70('0x83')]]:_0x43aaa5},'limit':0x1,'order':[['updatedAt',_0xbc70('0xc1')]]}]}]})[_0xbc70('0x39')](handleEntityNotFound(_0x45c5a6,null))['then'](function(_0x285516){if(_0x285516&&_0x285516[_0xbc70('0x88')]){_0x431e35=_0x285516['get']({'plain':!![]});if(_0x431e35[_0xbc70('0x88')]&&_0x431e35[_0xbc70('0x88')]['Contacts']['length']){return _0x431e35['List'][_0xbc70('0x89')][0x0];}return db[_0xbc70('0x76')][_0xbc70('0x5d')](_[_0xbc70('0x1b')](_0x4025b3[_0xbc70('0x5e')],{'firstName':_0x43aaa5,[_0x285516['mapKey']]:_0x43aaa5,'phone':_0x43aaa5,'ListId':_0x431e35['ListId']}));}})['then'](handleEntityNotFound(_0x45c5a6,null))[_0xbc70('0x39')](function(_0x3fe0b8){if(_0x3fe0b8){_0x2d6d64=_0x3fe0b8;return db[_0xbc70('0x97')][_0xbc70('0x5c')]({'where':{'ContactId':_0x2d6d64['id'],'closed':![],'OpenchannelAccountId':_0x431e35['id']}})[_0xbc70('0x39')](function(_0x4bfdea){if(_0x4bfdea){return[_0x4bfdea,![]];}return db[_0xbc70('0x97')][_0xbc70('0x5d')]({'UserId':_0x4025b3[_0xbc70('0x60')]['id'],'ContactId':_0x2d6d64['id'],'OpenchannelAccountId':_0x431e35['id'],'lastMsgDirection':_0xbc70('0xc2'),'firstMsgDirection':_0xbc70('0xc2'),'Messages':[_[_0xbc70('0x54')](_0x4025b3['body'],{'read':![],'body':_0x4025b3['body'][_0xbc70('0x5e')],'OpenchannelAccountId':_0x431e35['id'],'UserId':_0x4025b3[_0xbc70('0x60')]['id'],'ContactId':_0x2d6d64['id']})]},{'include':[{'model':db[_0xbc70('0x9f')],'as':'Messages'}]})[_0xbc70('0x39')](function(_0x16df8d){return[_0x16df8d,!![]];});});}})[_0xbc70('0xbb')](function(_0x4b7ac3,_0x2a5fea){if(_0x2a5fea){return _0x4b7ac3;}return db[_0xbc70('0x9f')]['create'](_[_0xbc70('0x54')](_0x4025b3[_0xbc70('0x5e')],{'read':![],'body':_0x4025b3[_0xbc70('0x5e')][_0xbc70('0x5e')],'OpenchannelAccountId':_0x431e35['id'],'OpenchannelInteractionId':_0x4b7ac3['id'],'UserId':_0x4025b3[_0xbc70('0x60')]['id'],'ContactId':_0x2d6d64['id']}))['then'](function(_0x41f45c){_0x4b7ac3[_0xbc70('0xc3')][_0xbc70('0xc4')]=[];_0x4b7ac3[_0xbc70('0xc3')][_0xbc70('0xc4')][_0xbc70('0x9d')](_0x41f45c[_0xbc70('0xc3')]);return _0x4b7ac3;});});}})[_0xbc70('0x39')](respondWithResult(_0x45c5a6,null))[_0xbc70('0x5a')](handleError(_0x45c5a6,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 38cf875..5cc8e40 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 _0xb43b=['events','../../mysqldb','setMaxListeners','save','update','hasOwnProperty','exports'];(function(_0x944e70,_0x342eb8){var _0x18a210=function(_0x908ab2){while(--_0x908ab2){_0x944e70['push'](_0x944e70['shift']());}};_0x18a210(++_0x342eb8);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2d7af3,_0x584179){_0x2d7af3=_0x2d7af3-0x0;var _0xc32d94=_0xb43b[_0x2d7af3];return _0xc32d94;};'use strict';var EventEmitter=require(_0xbb43('0x0'));var OpenchannelAccount=require(_0xbb43('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xbb43('0x2')](0x0);var events={'afterCreate':_0xbb43('0x3'),'afterUpdate':_0xbb43('0x4'),'afterDestroy':'remove'};function emitEvent(_0x131e9e){return function(_0x41aff6,_0x351254,_0x16432a){OpenchannelAccountEvents['emit'](_0x131e9e+':'+_0x41aff6['id'],_0x41aff6);OpenchannelAccountEvents['emit'](_0x131e9e,_0x41aff6);_0x16432a(null);};}for(var e in events){if(events[_0xbb43('0x5')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xbb43('0x6')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xda3f=['exports','../../mysqldb','OpenchannelAccount','remove','emit'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0xda3f,0xec));var _0xfda3=function(_0x400717,_0x166ab1){_0x400717=_0x400717-0x0;var _0x2ce2b9=_0xda3f[_0x400717];return _0x2ce2b9;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xfda3('0x0'))['db'][_0xfda3('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfda3('0x2')};function emitEvent(_0x581693){return function(_0x36dc71,_0x22187d,_0x516500){OpenchannelAccountEvents[_0xfda3('0x3')](_0x581693+':'+_0x36dc71['id'],_0x36dc71);OpenchannelAccountEvents[_0xfda3('0x3')](_0x581693,_0x36dc71);_0x516500(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xfda3('0x4')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 18b2a3a..f1a89c2 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(_0x5b6e90,_0xf5315a){var _0x452c3f=function(_0x15b7d8){while(--_0x15b7d8){_0x5b6e90['push'](_0x5b6e90['shift']());}};_0x452c3f(++_0xf5315a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0xdbc42c,_0x279adc){var _0x14da68=function(_0x1f7ff2){while(--_0x1f7ff2){_0xdbc42c['push'](_0xdbc42c['shift']());}};_0x14da68(++_0x279adc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 7f77d39..b10dd9b 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 _0x9e6b=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','register','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','../../mysqldb'];(function(_0x55ff37,_0x47e66b){var _0x4175f6=function(_0x45d213){while(--_0x45d213){_0x55ff37['push'](_0x55ff37['shift']());}};_0x4175f6(++_0x47e66b);}(_0x9e6b,0x11c));var _0xb9e6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9e6b[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xb9e6('0x0'));var util=require(_0xb9e6('0x1'));var moment=require('moment');var BPromise=require(_0xb9e6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9e6('0x3'))['db'];var utils=require(_0xb9e6('0x4'));var logger=require(_0xb9e6('0x5'))(_0xb9e6('0x6'));var config=require('../../config/environment');var jayson=require(_0xb9e6('0x7'));var client=jayson[_0xb9e6('0x8')][_0xb9e6('0x9')]({'port':0x232a});config['redis']=_[_0xb9e6('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb9e6('0xb')]));require('./openchannelAccount.socket')[_0xb9e6('0xc')](socket);function respondWithRpcPromise(_0x216b1a,_0x477b52,_0x3e18bf){return new BPromise(function(_0x40d57b,_0x43e8c8){return client[_0xb9e6('0xd')](_0x216b1a,_0x3e18bf)[_0xb9e6('0xe')](function(_0x165903){logger[_0xb9e6('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x477b52,_0xb9e6('0x10'));logger[_0xb9e6('0x11')](_0xb9e6('0x12'),_0x477b52,_0xb9e6('0x10'),JSON['stringify'](_0x165903));if(_0x165903[_0xb9e6('0x13')]){if(_0x165903[_0xb9e6('0x13')]['code']===0x1f4){logger['error'](_0xb9e6('0x14'),_0x477b52,_0x165903[_0xb9e6('0x13')][_0xb9e6('0x15')]);return _0x43e8c8(_0x165903[_0xb9e6('0x13')]['message']);}logger[_0xb9e6('0x13')](_0xb9e6('0x14'),_0x477b52,_0x165903[_0xb9e6('0x13')][_0xb9e6('0x15')]);return _0x40d57b(_0x165903[_0xb9e6('0x13')][_0xb9e6('0x15')]);}else{logger[_0xb9e6('0xf')](_0xb9e6('0x14'),_0x477b52,_0xb9e6('0x10'));_0x40d57b(_0x165903[_0xb9e6('0x16')]['message']);}})[_0xb9e6('0x17')](function(_0x53a357){logger[_0xb9e6('0x13')](_0xb9e6('0x14'),_0x477b52,_0x53a357);_0x43e8c8(_0x53a357);});});} \ No newline at end of file +var _0xe5b5=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x52719d,_0x20b94d){var _0x24a0be=function(_0x32fe01){while(--_0x32fe01){_0x52719d['push'](_0x52719d['shift']());}};_0x24a0be(++_0x20b94d);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x56a871,_0x18b7fe){_0x56a871=_0x56a871-0x0;var _0x124954=_0xe5b5[_0x56a871];return _0x124954;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});config[_0x5e5b('0xe')]=_[_0x5e5b('0xf')](config[_0x5e5b('0xe')],{'host':_0x5e5b('0x10'),'port':0x18eb});var socket=require(_0x5e5b('0x11'))(new Redis(config[_0x5e5b('0xe')]));require(_0x5e5b('0x12'))[_0x5e5b('0x13')](socket);function respondWithRpcPromise(_0x3f8534,_0x492a0e,_0x300890){return new BPromise(function(_0x59112d,_0x108c34){return client[_0x5e5b('0x14')](_0x3f8534,_0x300890)[_0x5e5b('0x15')](function(_0x3f64b6){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x492a0e,'request\x20sent');logger[_0x5e5b('0x16')](_0x5e5b('0x17'),_0x492a0e,_0x5e5b('0x18'),JSON[_0x5e5b('0x19')](_0x3f64b6));if(_0x3f64b6[_0x5e5b('0x1a')]){if(_0x3f64b6[_0x5e5b('0x1a')][_0x5e5b('0x1b')]===0x1f4){logger['error'](_0x5e5b('0x1c'),_0x492a0e,_0x3f64b6[_0x5e5b('0x1a')]['message']);return _0x108c34(_0x3f64b6[_0x5e5b('0x1a')]['message']);}logger['error'](_0x5e5b('0x1c'),_0x492a0e,_0x3f64b6[_0x5e5b('0x1a')][_0x5e5b('0x1d')]);return _0x59112d(_0x3f64b6['error'][_0x5e5b('0x1d')]);}else{logger['info'](_0x5e5b('0x1c'),_0x492a0e,_0x5e5b('0x18'));_0x59112d(_0x3f64b6['result'][_0x5e5b('0x1d')]);}})[_0x5e5b('0x1e')](function(_0x2281c8){logger['error'](_0x5e5b('0x1c'),_0x492a0e,_0x2281c8);_0x108c34(_0x2281c8);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 7866b0f..3ccbd23 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 _0x4b8a=['openchannelAccount:','save','update','emit','removeListener','register','length'];(function(_0x45716e,_0x24787f){var _0x340341=function(_0x5dfcfd){while(--_0x5dfcfd){_0x45716e['push'](_0x45716e['shift']());}};_0x340341(++_0x24787f);}(_0x4b8a,0xd3));var _0xa4b8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4b8a[_0x2dafbe];return _0x58a45a;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xa4b8('0x0'),'remove',_0xa4b8('0x1')];function createListener(_0x3ed3b6,_0x20eea6){return function(_0x34c820){_0x20eea6[_0xa4b8('0x2')](_0x3ed3b6,_0x34c820);};}function removeListener(_0x3a22d1,_0xb147cb){return function(){OpenchannelAccountEvents[_0xa4b8('0x3')](_0x3a22d1,_0xb147cb);};}exports[_0xa4b8('0x4')]=function(_0x719605){for(var _0x2c9e45=0x0,_0x2de84d=events[_0xa4b8('0x5')];_0x2c9e45<_0x2de84d;_0x2c9e45++){var _0x1fea78=events[_0x2c9e45];var _0x517970=createListener(_0xa4b8('0x6')+_0x1fea78,_0x719605);OpenchannelAccountEvents['on'](_0x1fea78,_0x517970);}}; \ No newline at end of file +var _0xbf1a=['remove','update','removeListener','length','openchannelAccount:','./openchannelAccount.events','save'];(function(_0x1a7d3a,_0x470f74){var _0x587d9b=function(_0x51102e){while(--_0x51102e){_0x1a7d3a['push'](_0x1a7d3a['shift']());}};_0x587d9b(++_0x470f74);}(_0xbf1a,0x7c));var _0xabf1=function(_0x9bb562,_0x16cce5){_0x9bb562=_0x9bb562-0x0;var _0x5d7f9e=_0xbf1a[_0x9bb562];return _0x5d7f9e;};'use strict';var OpenchannelAccountEvents=require(_0xabf1('0x0'));var events=[_0xabf1('0x1'),_0xabf1('0x2'),_0xabf1('0x3')];function createListener(_0x690e59,_0x567007){return function(_0x132189){_0x567007['emit'](_0x690e59,_0x132189);};}function removeListener(_0x1b5f1a,_0x288b6c){return function(){OpenchannelAccountEvents[_0xabf1('0x4')](_0x1b5f1a,_0x288b6c);};}exports['register']=function(_0x5a477e){for(var _0x2a4ebd=0x0,_0x4f5b53=events[_0xabf1('0x5')];_0x2a4ebd<_0x4f5b53;_0x2a4ebd++){var _0x1cc1f6=events[_0x2a4ebd];var _0x1f48f5=createListener(_0xabf1('0x6')+_0x1cc1f6,_0x5a477e);OpenchannelAccountEvents['on'](_0x1cc1f6,_0x1f48f5);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 0e6bb53..06c6bc2 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 _0x8b45=['put','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','/:id','create'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x8b45,0xc4));var _0x58b4=function(_0x1b48c1,_0x118b15){_0x1b48c1=_0x1b48c1-0x0;var _0x28661f=_0x8b45[_0x1b48c1];return _0x28661f;};'use strict';var multer=require(_0x58b4('0x0'));var util=require(_0x58b4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x58b4('0x2'));var router=express[_0x58b4('0x3')]();var fs_extra=require(_0x58b4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x58b4('0x5'));var config=require(_0x58b4('0x6'));var controller=require(_0x58b4('0x7'));router[_0x58b4('0x8')]('/',auth[_0x58b4('0x9')](),controller['index']);router['get'](_0x58b4('0xa'),auth[_0x58b4('0x9')](),controller['show']);router['post']('/',auth[_0x58b4('0x9')](),controller[_0x58b4('0xb')]);router[_0x58b4('0xc')](_0x58b4('0xa'),auth['isAuthenticated'](),controller[_0x58b4('0xd')]);router['delete']('/:id',auth[_0x58b4('0x9')](),controller[_0x58b4('0xe')]);module[_0x58b4('0xf')]=router; \ No newline at end of file +var _0xf114=['index','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated'];(function(_0x2c7425,_0x252555){var _0x330897=function(_0x3ab67c){while(--_0x3ab67c){_0x2c7425['push'](_0x2c7425['shift']());}};_0x330897(++_0x252555);}(_0xf114,0x10d));var _0x4f11=function(_0x403727,_0x3f3a36){_0x403727=_0x403727-0x0;var _0x4c9430=_0xf114[_0x403727];return _0x4c9430;};'use strict';var multer=require(_0x4f11('0x0'));var util=require(_0x4f11('0x1'));var path=require('path');var timeout=require(_0x4f11('0x2'));var express=require('express');var router=express[_0x4f11('0x3')]();var fs_extra=require(_0x4f11('0x4'));var auth=require(_0x4f11('0x5'));var interaction=require(_0x4f11('0x6'));var config=require(_0x4f11('0x7'));var controller=require(_0x4f11('0x8'));router[_0x4f11('0x9')]('/',auth[_0x4f11('0xa')](),controller[_0x4f11('0xb')]);router[_0x4f11('0x9')](_0x4f11('0xc'),auth[_0x4f11('0xa')](),controller[_0x4f11('0xd')]);router[_0x4f11('0xe')]('/',auth[_0x4f11('0xa')](),controller[_0x4f11('0xf')]);router[_0x4f11('0x10')](_0x4f11('0xc'),auth[_0x4f11('0xa')](),controller[_0x4f11('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4f11('0x12')]);module[_0x4f11('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 312f7be..291ae61 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 _0x1d52=['STRING','sequelize','noop'];(function(_0x169f7e,_0x5cf1e7){var _0x484646=function(_0x531328){while(--_0x531328){_0x169f7e['push'](_0x169f7e['shift']());}};_0x484646(++_0x5cf1e7);}(_0x1d52,0x1c0));var _0x21d5=function(_0x552af7,_0x22e853){_0x552af7=_0x552af7-0x0;var _0x442b2c=_0x1d52[_0x552af7];return _0x442b2c;};'use strict';var Sequelize=require(_0x21d5('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x21d5('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x21d5('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2951=['exports','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x2951,0xfb));var _0x1295=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0x2951[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0x1295('0x0'));module[_0x1295('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1295('0x2')},'appdata':{'type':Sequelize[_0x1295('0x3')]()},'description':{'type':Sequelize[_0x1295('0x4')]},'interval':{'type':Sequelize[_0x1295('0x4')],'defaultValue':_0x1295('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 729a422..6647c55 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 _0xe905=['fieldName','type','key','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','filter','where','VIRTUAL','merge','options','include','catch','show','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','apply','update','then','destroy','error','stack','index','map','OpenchannelApplication','rawAttributes'];(function(_0x51b51b,_0x5b6bec){var _0x58b9ae=function(_0x9d10cd){while(--_0x9d10cd){_0x51b51b['push'](_0x51b51b['shift']());}};_0x58b9ae(++_0x5b6bec);}(_0xe905,0xe9));var _0x5e90=function(_0x4f8f53,_0x12115b){_0x4f8f53=_0x4f8f53-0x0;var _0x374ea4=_0xe905[_0x4f8f53];return _0x374ea4;};'use strict';var emlformat=require(_0x5e90('0x0'));var rimraf=require(_0x5e90('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5e90('0x2'));var rp=require(_0x5e90('0x3'));var moment=require(_0x5e90('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5e90('0x5'));var util=require(_0x5e90('0x6'));var path=require(_0x5e90('0x7'));var sox=require(_0x5e90('0x8'));var csv=require(_0x5e90('0x9'));var ejs=require(_0x5e90('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5e90('0xb'));var squel=require(_0x5e90('0xc'));var crypto=require(_0x5e90('0xd'));var jsforce=require(_0x5e90('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5e90('0x9'));var querystring=require(_0x5e90('0xf'));var Papa=require(_0x5e90('0x10'));var Redis=require(_0x5e90('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5e90('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e90('0x13'))('api');var utils=require(_0x5e90('0x14'));var config=require(_0x5e90('0x15'));var licenseUtil=require(_0x5e90('0x16'));var db=require(_0x5e90('0x17'))['db'];function respondWithStatusCode(_0x26c2ee,_0xededf6){_0xededf6=_0xededf6||0xcc;return function(_0x48635f){if(_0x48635f){return _0x26c2ee[_0x5e90('0x18')](_0xededf6);}return _0x26c2ee['status'](_0xededf6)[_0x5e90('0x19')]();};}function respondWithResult(_0x45abc0,_0x113948){_0x113948=_0x113948||0xc8;return function(_0x3f926b){if(_0x3f926b){return _0x45abc0[_0x5e90('0x1a')](_0x113948)['json'](_0x3f926b);}};}function respondWithFilteredResult(_0x4c8106,_0x259b94){return function(_0x4df05c){if(_0x4df05c){var _0x3d28f4=typeof _0x259b94['offset']==='undefined'&&typeof _0x259b94[_0x5e90('0x1b')]===_0x5e90('0x1c');var _0x45e111=_0x4df05c[_0x5e90('0x1d')];var _0x4a1316=_0x3d28f4?0x0:_0x259b94['offset'];var _0x2841a0=_0x3d28f4?_0x4df05c[_0x5e90('0x1d')]:_0x259b94[_0x5e90('0x1e')]+_0x259b94[_0x5e90('0x1b')];var _0x422b06;if(_0x2841a0>=_0x45e111){_0x2841a0=_0x45e111;_0x422b06=0xc8;}else{_0x422b06=0xce;}_0x4c8106[_0x5e90('0x1a')](_0x422b06);return _0x4c8106[_0x5e90('0x1f')](_0x5e90('0x20'),_0x4a1316+'-'+_0x2841a0+'/'+_0x45e111)['json'](_0x4df05c);}return null;};}function patchUpdates(_0xb5e959){return function(_0x3ec3c5){try{jsonpatch[_0x5e90('0x21')](_0x3ec3c5,_0xb5e959,!![]);}catch(_0x15791e){return BPromise['reject'](_0x15791e);}return _0x3ec3c5['save']();};}function saveUpdates(_0x351dc6,_0x182f4a){return function(_0x529f65){if(_0x529f65){return _0x529f65[_0x5e90('0x22')](_0x351dc6)[_0x5e90('0x23')](function(_0x5164ef){return _0x5164ef;});}return null;};}function removeEntity(_0x3a9b7c,_0x3df0fb){return function(_0x17a54b){if(_0x17a54b){return _0x17a54b[_0x5e90('0x24')]()[_0x5e90('0x23')](function(){_0x3a9b7c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x27f55c,_0x1fa7f3){return function(_0x565db6){if(!_0x565db6){_0x27f55c[_0x5e90('0x18')](0x194);}return _0x565db6;};}function handleError(_0x535257,_0x22b87e){_0x22b87e=_0x22b87e||0x1f4;return function(_0x28ec86){logger[_0x5e90('0x25')](_0x28ec86[_0x5e90('0x26')]);if(_0x28ec86['name']){delete _0x28ec86['name'];}_0x535257[_0x5e90('0x1a')](_0x22b87e)['send'](_0x28ec86);};}exports[_0x5e90('0x27')]=function(_0x34ed43,_0x4d9431){var _0x220579={},_0x5bffcb={},_0x5c930b={'count':0x0,'rows':[]};var _0x471519=_[_0x5e90('0x28')](db[_0x5e90('0x29')][_0x5e90('0x2a')],function(_0x34986b){return{'name':_0x34986b[_0x5e90('0x2b')],'type':_0x34986b[_0x5e90('0x2c')][_0x5e90('0x2d')]};});_0x5bffcb[_0x5e90('0x2e')]=_[_0x5e90('0x28')](_0x471519,_0x5e90('0x2f'));_0x5bffcb['query']=_[_0x5e90('0x30')](_0x34ed43[_0x5e90('0x31')]);_0x5bffcb['filters']=_[_0x5e90('0x32')](_0x5bffcb[_0x5e90('0x2e')],_0x5bffcb['query']);_0x220579[_0x5e90('0x33')]=_[_0x5e90('0x32')](_0x5bffcb[_0x5e90('0x2e')],qs['fields'](_0x34ed43[_0x5e90('0x31')][_0x5e90('0x34')]));_0x220579[_0x5e90('0x33')]=_0x220579[_0x5e90('0x33')][_0x5e90('0x35')]?_0x220579[_0x5e90('0x33')]:_0x5bffcb[_0x5e90('0x2e')];if(!_0x34ed43[_0x5e90('0x31')][_0x5e90('0x36')]('nolimit')){_0x220579[_0x5e90('0x1b')]=qs[_0x5e90('0x1b')](_0x34ed43[_0x5e90('0x31')][_0x5e90('0x1b')]);_0x220579[_0x5e90('0x1e')]=qs['offset'](_0x34ed43['query'][_0x5e90('0x1e')]);}_0x220579['order']=qs['sort'](_0x34ed43[_0x5e90('0x31')][_0x5e90('0x37')]);_0x220579['where']=qs[_0x5e90('0x38')](_['pick'](_0x34ed43['query'],_0x5bffcb[_0x5e90('0x38')]),_0x471519);if(_0x34ed43['query'][_0x5e90('0x39')]){_0x220579[_0x5e90('0x3a')]=_['merge'](_0x220579[_0x5e90('0x3a')],{'$or':_[_0x5e90('0x28')](_0x471519,function(_0x3c3c79){if(_0x3c3c79[_0x5e90('0x2c')]!==_0x5e90('0x3b')){var _0x23b7d3={};_0x23b7d3[_0x3c3c79[_0x5e90('0x2f')]]={'$like':'%'+_0x34ed43[_0x5e90('0x31')]['filter']+'%'};return _0x23b7d3;}})});}_0x220579=_[_0x5e90('0x3c')]({},_0x220579,_0x34ed43[_0x5e90('0x3d')]);var _0x5f2f20={'where':_0x220579['where']};return db['OpenchannelApplication'][_0x5e90('0x1d')](_0x5f2f20)[_0x5e90('0x23')](function(_0xdbcfc6){_0x5c930b[_0x5e90('0x1d')]=_0xdbcfc6;if(_0x34ed43[_0x5e90('0x31')]['includeAll']){_0x220579[_0x5e90('0x3e')]=[{'all':!![]}];}return db[_0x5e90('0x29')]['findAll'](_0x220579);})[_0x5e90('0x23')](function(_0x507311){_0x5c930b['rows']=_0x507311;return _0x5c930b;})[_0x5e90('0x23')](respondWithFilteredResult(_0x4d9431,_0x220579))[_0x5e90('0x3f')](handleError(_0x4d9431,null));};exports[_0x5e90('0x40')]=function(_0xad9595,_0xfa76b8){var _0x5dcc6a={'raw':!![],'where':{'id':_0xad9595['params']['id']}},_0x525b5f={};_0x525b5f[_0x5e90('0x2e')]=_[_0x5e90('0x30')](db[_0x5e90('0x29')][_0x5e90('0x2a')]);_0x525b5f['query']=_[_0x5e90('0x30')](_0xad9595[_0x5e90('0x31')]);_0x525b5f['filters']=_[_0x5e90('0x32')](_0x525b5f[_0x5e90('0x2e')],_0x525b5f['query']);_0x5dcc6a[_0x5e90('0x33')]=_[_0x5e90('0x32')](_0x525b5f[_0x5e90('0x2e')],qs['fields'](_0xad9595[_0x5e90('0x31')][_0x5e90('0x34')]));_0x5dcc6a[_0x5e90('0x33')]=_0x5dcc6a[_0x5e90('0x33')][_0x5e90('0x35')]?_0x5dcc6a[_0x5e90('0x33')]:_0x525b5f[_0x5e90('0x2e')];if(_0xad9595[_0x5e90('0x31')]['includeAll']){_0x5dcc6a[_0x5e90('0x3e')]=[{'all':!![]}];}_0x5dcc6a=_[_0x5e90('0x3c')]({},_0x5dcc6a,_0xad9595[_0x5e90('0x3d')]);return db[_0x5e90('0x29')][_0x5e90('0x41')](_0x5dcc6a)['then'](handleEntityNotFound(_0xfa76b8,null))[_0x5e90('0x23')](respondWithResult(_0xfa76b8,null))[_0x5e90('0x3f')](handleError(_0xfa76b8,null));};exports[_0x5e90('0x42')]=function(_0x292a7c,_0x3920c3){return db['OpenchannelApplication']['create'](_0x292a7c[_0x5e90('0x43')],{})[_0x5e90('0x23')](respondWithResult(_0x3920c3,0xc9))[_0x5e90('0x3f')](handleError(_0x3920c3,null));};exports[_0x5e90('0x22')]=function(_0x5e2fdf,_0x5b0325){if(_0x5e2fdf[_0x5e90('0x43')]['id']){delete _0x5e2fdf[_0x5e90('0x43')]['id'];}return db[_0x5e90('0x29')][_0x5e90('0x41')]({'where':{'id':_0x5e2fdf[_0x5e90('0x44')]['id']}})[_0x5e90('0x23')](handleEntityNotFound(_0x5b0325,null))[_0x5e90('0x23')](saveUpdates(_0x5e2fdf['body'],null))[_0x5e90('0x23')](respondWithResult(_0x5b0325,null))[_0x5e90('0x3f')](handleError(_0x5b0325,null));};exports[_0x5e90('0x24')]=function(_0x7bb736,_0x673982){return db[_0x5e90('0x29')][_0x5e90('0x41')]({'where':{'id':_0x7bb736['params']['id']}})[_0x5e90('0x23')](handleEntityNotFound(_0x673982,null))[_0x5e90('0x23')](removeEntity(_0x673982,null))[_0x5e90('0x3f')](handleError(_0x673982,null));}; \ No newline at end of file +var _0x1b56=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','error','name','index','map','OpenchannelApplication','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','includeAll','findAll','rows','catch','create','body','find','params','destroy','eml-format','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1b56,0x16b));var _0x61b5=function(_0x48961c,_0x280e9d){_0x48961c=_0x48961c-0x0;var _0x1d895d=_0x1b56[_0x48961c];return _0x1d895d;};'use strict';var emlformat=require(_0x61b5('0x0'));var rimraf=require(_0x61b5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x61b5('0x2'));var rp=require(_0x61b5('0x3'));var moment=require('moment');var BPromise=require(_0x61b5('0x4'));var Mustache=require(_0x61b5('0x5'));var util=require(_0x61b5('0x6'));var path=require(_0x61b5('0x7'));var sox=require(_0x61b5('0x8'));var csv=require(_0x61b5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x61b5('0xa'));var squel=require(_0x61b5('0xb'));var crypto=require('crypto');var jsforce=require(_0x61b5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x61b5('0x9'));var querystring=require(_0x61b5('0xd'));var Papa=require(_0x61b5('0xe'));var Redis=require(_0x61b5('0xf'));var authService=require(_0x61b5('0x10'));var qs=require(_0x61b5('0x11'));var as=require(_0x61b5('0x12'));var hardwareService=require(_0x61b5('0x13'));var logger=require(_0x61b5('0x14'))('api');var utils=require(_0x61b5('0x15'));var config=require(_0x61b5('0x16'));var licenseUtil=require(_0x61b5('0x17'));var db=require(_0x61b5('0x18'))['db'];function respondWithStatusCode(_0x4193d1,_0x3c8d01){_0x3c8d01=_0x3c8d01||0xcc;return function(_0x3ea50b){if(_0x3ea50b){return _0x4193d1[_0x61b5('0x19')](_0x3c8d01);}return _0x4193d1[_0x61b5('0x1a')](_0x3c8d01)[_0x61b5('0x1b')]();};}function respondWithResult(_0x20ec69,_0x217a93){_0x217a93=_0x217a93||0xc8;return function(_0x41eec3){if(_0x41eec3){return _0x20ec69[_0x61b5('0x1a')](_0x217a93)[_0x61b5('0x1c')](_0x41eec3);}};}function respondWithFilteredResult(_0x41404b,_0x319527){return function(_0x378822){if(_0x378822){var _0xf95657=typeof _0x319527[_0x61b5('0x1d')]===_0x61b5('0x1e')&&typeof _0x319527['limit']===_0x61b5('0x1e');var _0x2e7fd2=_0x378822[_0x61b5('0x1f')];var _0x1ac5d8=_0xf95657?0x0:_0x319527[_0x61b5('0x1d')];var _0x4f5008=_0xf95657?_0x378822['count']:_0x319527['offset']+_0x319527['limit'];var _0x541ce1;if(_0x4f5008>=_0x2e7fd2){_0x4f5008=_0x2e7fd2;_0x541ce1=0xc8;}else{_0x541ce1=0xce;}_0x41404b[_0x61b5('0x1a')](_0x541ce1);return _0x41404b[_0x61b5('0x20')](_0x61b5('0x21'),_0x1ac5d8+'-'+_0x4f5008+'/'+_0x2e7fd2)[_0x61b5('0x1c')](_0x378822);}return null;};}function patchUpdates(_0x4d034c){return function(_0x363763){try{jsonpatch[_0x61b5('0x22')](_0x363763,_0x4d034c,!![]);}catch(_0x4400e8){return BPromise['reject'](_0x4400e8);}return _0x363763[_0x61b5('0x23')]();};}function saveUpdates(_0x562695,_0x265d69){return function(_0x271ef3){if(_0x271ef3){return _0x271ef3[_0x61b5('0x24')](_0x562695)[_0x61b5('0x25')](function(_0x215a39){return _0x215a39;});}return null;};}function removeEntity(_0x20d38b,_0x344781){return function(_0x15d431){if(_0x15d431){return _0x15d431['destroy']()['then'](function(){_0x20d38b['status'](0xcc)[_0x61b5('0x1b')]();});}};}function handleEntityNotFound(_0x48e1ac,_0x2028e5){return function(_0x13b715){if(!_0x13b715){_0x48e1ac[_0x61b5('0x19')](0x194);}return _0x13b715;};}function handleError(_0x3121e6,_0x9e4a85){_0x9e4a85=_0x9e4a85||0x1f4;return function(_0x46418b){logger[_0x61b5('0x26')](_0x46418b['stack']);if(_0x46418b[_0x61b5('0x27')]){delete _0x46418b['name'];}_0x3121e6[_0x61b5('0x1a')](_0x9e4a85)['send'](_0x46418b);};}exports[_0x61b5('0x28')]=function(_0x53c950,_0xdcfe77){var _0x3642f6={},_0x4292ad={},_0x21d564={'count':0x0,'rows':[]};var _0x51358a=_[_0x61b5('0x29')](db[_0x61b5('0x2a')][_0x61b5('0x2b')],function(_0x55be7b){return{'name':_0x55be7b[_0x61b5('0x2c')],'type':_0x55be7b['type'][_0x61b5('0x2d')]};});_0x4292ad['model']=_[_0x61b5('0x29')](_0x51358a,'name');_0x4292ad['query']=_[_0x61b5('0x2e')](_0x53c950[_0x61b5('0x2f')]);_0x4292ad[_0x61b5('0x30')]=_[_0x61b5('0x31')](_0x4292ad[_0x61b5('0x32')],_0x4292ad[_0x61b5('0x2f')]);_0x3642f6[_0x61b5('0x33')]=_['intersection'](_0x4292ad[_0x61b5('0x32')],qs[_0x61b5('0x34')](_0x53c950[_0x61b5('0x2f')]['fields']));_0x3642f6[_0x61b5('0x33')]=_0x3642f6[_0x61b5('0x33')][_0x61b5('0x35')]?_0x3642f6['attributes']:_0x4292ad['model'];if(!_0x53c950['query'][_0x61b5('0x36')](_0x61b5('0x37'))){_0x3642f6['limit']=qs['limit'](_0x53c950[_0x61b5('0x2f')][_0x61b5('0x38')]);_0x3642f6[_0x61b5('0x1d')]=qs['offset'](_0x53c950[_0x61b5('0x2f')][_0x61b5('0x1d')]);}_0x3642f6[_0x61b5('0x39')]=qs[_0x61b5('0x3a')](_0x53c950['query'][_0x61b5('0x3a')]);_0x3642f6[_0x61b5('0x3b')]=qs['filters'](_[_0x61b5('0x3c')](_0x53c950[_0x61b5('0x2f')],_0x4292ad[_0x61b5('0x30')]),_0x51358a);if(_0x53c950[_0x61b5('0x2f')]['filter']){_0x3642f6['where']=_[_0x61b5('0x3d')](_0x3642f6[_0x61b5('0x3b')],{'$or':_[_0x61b5('0x29')](_0x51358a,function(_0xbfd39e){if(_0xbfd39e[_0x61b5('0x3e')]!==_0x61b5('0x3f')){var _0x2f75c3={};_0x2f75c3[_0xbfd39e[_0x61b5('0x27')]]={'$like':'%'+_0x53c950[_0x61b5('0x2f')]['filter']+'%'};return _0x2f75c3;}})});}_0x3642f6=_[_0x61b5('0x3d')]({},_0x3642f6,_0x53c950['options']);var _0x397faf={'where':_0x3642f6[_0x61b5('0x3b')]};return db[_0x61b5('0x2a')]['count'](_0x397faf)[_0x61b5('0x25')](function(_0x3b3f1f){_0x21d564[_0x61b5('0x1f')]=_0x3b3f1f;if(_0x53c950[_0x61b5('0x2f')][_0x61b5('0x40')]){_0x3642f6['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x61b5('0x41')](_0x3642f6);})[_0x61b5('0x25')](function(_0x1295c9){_0x21d564[_0x61b5('0x42')]=_0x1295c9;return _0x21d564;})[_0x61b5('0x25')](respondWithFilteredResult(_0xdcfe77,_0x3642f6))[_0x61b5('0x43')](handleError(_0xdcfe77,null));};exports['show']=function(_0x1f8023,_0x2fec8b){var _0x4997be={'raw':!![],'where':{'id':_0x1f8023['params']['id']}},_0x1f8fdd={};_0x1f8fdd[_0x61b5('0x32')]=_[_0x61b5('0x2e')](db[_0x61b5('0x2a')][_0x61b5('0x2b')]);_0x1f8fdd[_0x61b5('0x2f')]=_[_0x61b5('0x2e')](_0x1f8023[_0x61b5('0x2f')]);_0x1f8fdd[_0x61b5('0x30')]=_['intersection'](_0x1f8fdd[_0x61b5('0x32')],_0x1f8fdd[_0x61b5('0x2f')]);_0x4997be[_0x61b5('0x33')]=_[_0x61b5('0x31')](_0x1f8fdd[_0x61b5('0x32')],qs[_0x61b5('0x34')](_0x1f8023[_0x61b5('0x2f')][_0x61b5('0x34')]));_0x4997be['attributes']=_0x4997be[_0x61b5('0x33')][_0x61b5('0x35')]?_0x4997be[_0x61b5('0x33')]:_0x1f8fdd[_0x61b5('0x32')];if(_0x1f8023['query'][_0x61b5('0x40')]){_0x4997be['include']=[{'all':!![]}];}_0x4997be=_[_0x61b5('0x3d')]({},_0x4997be,_0x1f8023['options']);return db[_0x61b5('0x2a')]['find'](_0x4997be)[_0x61b5('0x25')](handleEntityNotFound(_0x2fec8b,null))[_0x61b5('0x25')](respondWithResult(_0x2fec8b,null))[_0x61b5('0x43')](handleError(_0x2fec8b,null));};exports[_0x61b5('0x44')]=function(_0x51e3e5,_0x3f43e8){return db['OpenchannelApplication'][_0x61b5('0x44')](_0x51e3e5[_0x61b5('0x45')],{})['then'](respondWithResult(_0x3f43e8,0xc9))['catch'](handleError(_0x3f43e8,null));};exports['update']=function(_0x3361ad,_0x58294d){if(_0x3361ad[_0x61b5('0x45')]['id']){delete _0x3361ad['body']['id'];}return db['OpenchannelApplication'][_0x61b5('0x46')]({'where':{'id':_0x3361ad[_0x61b5('0x47')]['id']}})['then'](handleEntityNotFound(_0x58294d,null))['then'](saveUpdates(_0x3361ad[_0x61b5('0x45')],null))['then'](respondWithResult(_0x58294d,null))['catch'](handleError(_0x58294d,null));};exports[_0x61b5('0x48')]=function(_0x14a183,_0x36de5b){return db[_0x61b5('0x2a')][_0x61b5('0x46')]({'where':{'id':_0x14a183[_0x61b5('0x47')]['id']}})[_0x61b5('0x25')](handleEntityNotFound(_0x36de5b,null))[_0x61b5('0x25')](removeEntity(_0x36de5b,null))['catch'](handleError(_0x36de5b,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index d13d2fc..719647a 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 _0x91cc=['define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1760c6,_0x372523){var _0x19e9f1=function(_0x1e9ee0){while(--_0x1e9ee0){_0x1760c6['push'](_0x1760c6['shift']());}};_0x19e9f1(++_0x372523);}(_0x91cc,0xf4));var _0xc91c=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x91cc[_0x5d4607];return _0x5e4a86;};'use strict';var _=require(_0xc91c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc91c('0x1'));var moment=require(_0xc91c('0x2'));var BPromise=require('bluebird');var rp=require(_0xc91c('0x3'));var fs=require('fs');var path=require(_0xc91c('0x4'));var rimraf=require(_0xc91c('0x5'));var config=require(_0xc91c('0x6'));var attributes=require('./openchannelApplication.attributes');module[_0xc91c('0x7')]=function(_0x18d89a,_0x3cc1f8){return _0x18d89a[_0xc91c('0x8')](_0xc91c('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc91c('0xa'),'collate':_0xc91c('0xb')});}; \ No newline at end of file +var _0xeefa=['openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','exports','define','OpenchannelApplication'];(function(_0x4db2d7,_0x47a08a){var _0x583e73=function(_0x4c5786){while(--_0x4c5786){_0x4db2d7['push'](_0x4db2d7['shift']());}};_0x583e73(++_0x47a08a);}(_0xeefa,0x9f));var _0xaeef=function(_0x3b204d,_0x2868c6){_0x3b204d=_0x3b204d-0x0;var _0x31c4dd=_0xeefa[_0x3b204d];return _0x31c4dd;};'use strict';var _=require('lodash');var util=require(_0xaeef('0x0'));var logger=require('../../config/logger')(_0xaeef('0x1'));var moment=require(_0xaeef('0x2'));var BPromise=require(_0xaeef('0x3'));var rp=require(_0xaeef('0x4'));var fs=require('fs');var path=require(_0xaeef('0x5'));var rimraf=require(_0xaeef('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0xaeef('0x7')]=function(_0x2fb819,_0x45b991){return _0x2fb819[_0xaeef('0x8')](_0xaeef('0x9'),attributes,{'tableName':_0xaeef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaeef('0xb'),'collate':_0xaeef('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 7d9d524..ffc21a6 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 _0x3ca8=['http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','OpenchannelApplication','update','options','raw','where','attributes','limit','UpdateOpenchannelApplication','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x85e62c,_0x124a78){var _0x4f84b7=function(_0x59b3f1){while(--_0x59b3f1){_0x85e62c['push'](_0x85e62c['shift']());}};_0x4f84b7(++_0x124a78);}(_0x3ca8,0x119));var _0x83ca=function(_0x5ed5ca,_0x272f13){_0x5ed5ca=_0x5ed5ca-0x0;var _0xf51af7=_0x3ca8[_0x5ed5ca];return _0xf51af7;};'use strict';var _=require(_0x83ca('0x0'));var util=require(_0x83ca('0x1'));var moment=require('moment');var BPromise=require(_0x83ca('0x2'));var rs=require(_0x83ca('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x83ca('0x4'))['db'];var utils=require(_0x83ca('0x5'));var logger=require(_0x83ca('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x83ca('0x7'));var client=jayson[_0x83ca('0x8')][_0x83ca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44a7ae,_0x40f8a9,_0x4afbd4){return new BPromise(function(_0x38b23a,_0x14ffcb){return client['request'](_0x44a7ae,_0x4afbd4)[_0x83ca('0xa')](function(_0x103d0f){logger[_0x83ca('0xb')](_0x83ca('0xc'),_0x40f8a9,_0x83ca('0xd'));logger[_0x83ca('0xe')](_0x83ca('0xf'),_0x40f8a9,_0x83ca('0xd'),JSON[_0x83ca('0x10')](_0x103d0f));if(_0x103d0f['error']){if(_0x103d0f[_0x83ca('0x11')]['code']===0x1f4){logger[_0x83ca('0x11')](_0x83ca('0xc'),_0x40f8a9,_0x103d0f[_0x83ca('0x11')][_0x83ca('0x12')]);return _0x14ffcb(_0x103d0f[_0x83ca('0x11')][_0x83ca('0x12')]);}logger[_0x83ca('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x40f8a9,_0x103d0f[_0x83ca('0x11')]['message']);return _0x38b23a(_0x103d0f[_0x83ca('0x11')][_0x83ca('0x12')]);}else{logger[_0x83ca('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x40f8a9,_0x83ca('0xd'));_0x38b23a(_0x103d0f[_0x83ca('0x13')][_0x83ca('0x12')]);}})[_0x83ca('0x14')](function(_0x4d02b1){logger[_0x83ca('0x11')](_0x83ca('0xc'),_0x40f8a9,_0x4d02b1);_0x14ffcb(_0x4d02b1);});});}exports['UpdateOpenchannelApplication']=function(_0x3e1c4a){var _0x270c5e=this;return new Promise(function(_0x583b50,_0x4f9cf0){return db[_0x83ca('0x15')][_0x83ca('0x16')](_0x3e1c4a['body'],{'raw':_0x3e1c4a['options']?_0x3e1c4a[_0x83ca('0x17')][_0x83ca('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e1c4a[_0x83ca('0x17')]?_0x3e1c4a[_0x83ca('0x17')][_0x83ca('0x19')]||null:null,'attributes':_0x3e1c4a[_0x83ca('0x17')]?_0x3e1c4a[_0x83ca('0x17')][_0x83ca('0x1a')]||null:null,'limit':_0x3e1c4a[_0x83ca('0x17')]?_0x3e1c4a['options'][_0x83ca('0x1b')]||null:null})[_0x83ca('0xa')](function(_0x27c310){logger[_0x83ca('0xb')]('UpdateOpenchannelApplication',_0x3e1c4a);logger[_0x83ca('0xe')](_0x83ca('0x1c'),_0x3e1c4a,JSON[_0x83ca('0x10')](_0x27c310));_0x583b50(_0x27c310);})[_0x83ca('0x14')](function(_0x5e6337){logger['error'](_0x83ca('0x1c'),_0x5e6337['message'],_0x3e1c4a);_0x4f9cf0(_0x270c5e[_0x83ca('0x11')](0x1f4,_0x5e6337[_0x83ca('0x12')]));});});}; \ No newline at end of file +var _0xf97a=['then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateOpenchannelApplication','update','options','raw','where','attributes','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3bcfab,_0x358e5e){var _0xaaf362=function(_0x45d1cc){while(--_0x45d1cc){_0x3bcfab['push'](_0x3bcfab['shift']());}};_0xaaf362(++_0x358e5e);}(_0xf97a,0x170));var _0xaf97=function(_0x384b58,_0x6d5a4e){_0x384b58=_0x384b58-0x0;var _0x12b2e8=_0xf97a[_0x384b58];return _0x12b2e8;};'use strict';var _=require(_0xaf97('0x0'));var util=require(_0xaf97('0x1'));var moment=require(_0xaf97('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf97('0x3'));var fs=require('fs');var Redis=require(_0xaf97('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaf97('0x5'))(_0xaf97('0x6'));var config=require(_0xaf97('0x7'));var jayson=require(_0xaf97('0x8'));var client=jayson[_0xaf97('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b993a,_0x53b1bd,_0x5976e3){return new BPromise(function(_0x46d0bd,_0x453fe2){return client['request'](_0x2b993a,_0x5976e3)[_0xaf97('0xa')](function(_0x359558){logger['info'](_0xaf97('0xb'),_0x53b1bd,_0xaf97('0xc'));logger[_0xaf97('0xd')](_0xaf97('0xe'),_0x53b1bd,_0xaf97('0xc'),JSON[_0xaf97('0xf')](_0x359558));if(_0x359558[_0xaf97('0x10')]){if(_0x359558[_0xaf97('0x10')][_0xaf97('0x11')]===0x1f4){logger[_0xaf97('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x53b1bd,_0x359558[_0xaf97('0x10')][_0xaf97('0x12')]);return _0x453fe2(_0x359558[_0xaf97('0x10')][_0xaf97('0x12')]);}logger[_0xaf97('0x10')](_0xaf97('0xb'),_0x53b1bd,_0x359558[_0xaf97('0x10')]['message']);return _0x46d0bd(_0x359558['error']['message']);}else{logger[_0xaf97('0x13')](_0xaf97('0xb'),_0x53b1bd,_0xaf97('0xc'));_0x46d0bd(_0x359558['result'][_0xaf97('0x12')]);}})[_0xaf97('0x14')](function(_0xad297f){logger[_0xaf97('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x53b1bd,_0xad297f);_0x453fe2(_0xad297f);});});}exports[_0xaf97('0x15')]=function(_0x1126d1){var _0x2da04f=this;return new Promise(function(_0x385e6b,_0x3c75c6){return db['OpenchannelApplication'][_0xaf97('0x16')](_0x1126d1['body'],{'raw':_0x1126d1[_0xaf97('0x17')]?_0x1126d1[_0xaf97('0x17')][_0xaf97('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1126d1[_0xaf97('0x17')]?_0x1126d1['options'][_0xaf97('0x19')]||null:null,'attributes':_0x1126d1[_0xaf97('0x17')]?_0x1126d1[_0xaf97('0x17')][_0xaf97('0x1a')]||null:null,'limit':_0x1126d1[_0xaf97('0x17')]?_0x1126d1[_0xaf97('0x17')]['limit']||null:null})['then'](function(_0x3757da){logger[_0xaf97('0x13')](_0xaf97('0x15'),_0x1126d1);logger[_0xaf97('0xd')](_0xaf97('0x15'),_0x1126d1,JSON['stringify'](_0x3757da));_0x385e6b(_0x3757da);})[_0xaf97('0x14')](function(_0x143f4a){logger[_0xaf97('0x10')](_0xaf97('0x15'),_0x143f4a['message'],_0x1126d1);_0x3c75c6(_0x2da04f['error'](0x1f4,_0x143f4a[_0xaf97('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 46b676b..1a3aa25 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 _0x9899=['openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','openchannelinteraction:destroy','removeTags','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','download','post','tracked'];(function(_0x1ee7ed,_0x10ff59){var _0x800d25=function(_0x4179a0){while(--_0x4179a0){_0x1ee7ed['push'](_0x1ee7ed['shift']());}};_0x800d25(++_0x10ff59);}(_0x9899,0xaa));var _0x9989=function(_0x34c224,_0x524ae9){_0x34c224=_0x34c224-0x0;var _0x45b50f=_0x9899[_0x34c224];return _0x45b50f;};'use strict';var multer=require(_0x9989('0x0'));var util=require('util');var path=require(_0x9989('0x1'));var timeout=require('connect-timeout');var express=require(_0x9989('0x2'));var router=express[_0x9989('0x3')]();var fs_extra=require(_0x9989('0x4'));var auth=require(_0x9989('0x5'));var interaction=require(_0x9989('0x6'));var config=require('../../config/environment');var controller=require(_0x9989('0x7'));router[_0x9989('0x8')]('/',auth[_0x9989('0x9')](),controller[_0x9989('0xa')]);router['get'](_0x9989('0xb'),auth[_0x9989('0x9')](),controller[_0x9989('0xc')]);router[_0x9989('0x8')](_0x9989('0xd'),auth[_0x9989('0x9')](),controller[_0x9989('0xe')]);router[_0x9989('0x8')](_0x9989('0xf'),auth[_0x9989('0x9')](),controller['getMessages']);router[_0x9989('0x8')]('/:id/download',auth[_0x9989('0x9')](),controller[_0x9989('0x10')]);router['post']('/',auth[_0x9989('0x9')](),controller['create']);router[_0x9989('0x11')]('/:id/messages',auth[_0x9989('0x9')](),controller['addMessage']);router[_0x9989('0x11')]('/:id/tags',auth[_0x9989('0x9')](),interaction[_0x9989('0x12')](_0x9989('0x13'),_0x9989('0x14')),controller[_0x9989('0x15')]);router[_0x9989('0x16')](_0x9989('0xd'),auth[_0x9989('0x9')](),interaction[_0x9989('0x12')](_0x9989('0x13'),_0x9989('0x17')),controller['update']);router[_0x9989('0x18')](_0x9989('0xd'),auth[_0x9989('0x9')](),interaction['tracked']('openchannel',_0x9989('0x19')),controller['destroy']);router[_0x9989('0x18')]('/:id/tags',auth[_0x9989('0x9')](),controller[_0x9989('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x6f70=['isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','/:id/tags','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','delete','openchannel','openchannelinteraction:destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6f70,0x149));var _0x06f7=function(_0x4bd92e,_0x4c5b8a){_0x4bd92e=_0x4bd92e-0x0;var _0x5e8e3f=_0x6f70[_0x4bd92e];return _0x5e8e3f;};'use strict';var multer=require(_0x06f7('0x0'));var util=require(_0x06f7('0x1'));var path=require(_0x06f7('0x2'));var timeout=require(_0x06f7('0x3'));var express=require(_0x06f7('0x4'));var router=express[_0x06f7('0x5')]();var fs_extra=require(_0x06f7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x06f7('0x7'));var config=require(_0x06f7('0x8'));var controller=require(_0x06f7('0x9'));router[_0x06f7('0xa')]('/',auth[_0x06f7('0xb')](),controller[_0x06f7('0xc')]);router[_0x06f7('0xa')](_0x06f7('0xd'),auth[_0x06f7('0xb')](),controller[_0x06f7('0xe')]);router['get'](_0x06f7('0xf'),auth[_0x06f7('0xb')](),controller[_0x06f7('0x10')]);router[_0x06f7('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0x06f7('0x11')]);router['get'](_0x06f7('0x12'),auth[_0x06f7('0xb')](),controller[_0x06f7('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x06f7('0x14')]);router[_0x06f7('0x15')](_0x06f7('0x16'),auth['isAuthenticated'](),controller[_0x06f7('0x17')]);router[_0x06f7('0x15')](_0x06f7('0x18'),auth[_0x06f7('0xb')](),interaction['tracked']('openchannel',_0x06f7('0x19')),controller[_0x06f7('0x1a')]);router[_0x06f7('0x1b')](_0x06f7('0xf'),auth[_0x06f7('0xb')](),interaction[_0x06f7('0x1c')]('openchannel',_0x06f7('0x1d')),controller['update']);router[_0x06f7('0x1e')](_0x06f7('0xf'),auth[_0x06f7('0xb')](),interaction['tracked'](_0x06f7('0x1f'),_0x06f7('0x20')),controller['destroy']);router[_0x06f7('0x1e')](_0x06f7('0x18'),auth[_0x06f7('0xb')](),controller['removeTags']);module[_0x06f7('0x21')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index dcb9cbc..66f3ed9 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 _0xa991=['BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x3d7cb7,_0x4e2c89){var _0xed162a=function(_0x4b9a25){while(--_0x4b9a25){_0x3d7cb7['push'](_0x3d7cb7['shift']());}};_0xed162a(++_0x4e2c89);}(_0xa991,0x143));var _0x1a99=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xa991[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0x1a99('0x0'));module['exports']={'closed':{'type':Sequelize[_0x1a99('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1a99('0x2')]},'disposition':{'type':Sequelize[_0x1a99('0x3')]},'secondDisposition':{'type':Sequelize[_0x1a99('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1a99('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x1a99('0x2')]},'threadId':{'type':Sequelize[_0x1a99('0x3')]},'externalUrl':{'type':Sequelize[_0x1a99('0x3')]},'lastMsgAt':{'type':Sequelize[_0x1a99('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x1a99('0x4')]('in',_0x1a99('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x1a99('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x1a99('0x3')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xbc17=['sequelize','exports','DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xbc17,0x1ab));var _0x7bc1=function(_0x40911a,_0x55ec99){_0x40911a=_0x40911a-0x0;var _0x27e8e3=_0xbc17[_0x40911a];return _0x27e8e3;};'use strict';var Sequelize=require(_0x7bc1('0x0'));module[_0x7bc1('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7bc1('0x2')]},'disposition':{'type':Sequelize[_0x7bc1('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7bc1('0x3')]},'read1stAt':{'type':Sequelize[_0x7bc1('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x7bc1('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x7bc1('0x4')]('in',_0x7bc1('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x7bc1('0x4')]('in',_0x7bc1('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7bc1('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x7bc1('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 5590c06..d50cf23 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 _0x5875=['moment','bluebird','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','update','then','destroy','end','name','send','Users','map','fullname','Tags','forEach','push','TagIds','catch','talking','answered','UserId','waiting','closed','unmanaged','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','select','field','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','openchannel_interactions','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','concat','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','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','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','include','options','create','body','describe','OpenchannelMessage','addMessage','ids','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','tmp','attachments','CmContact','firstName','lastName','Attachment','Messages','OpenchannelAccount','Owner','get','mkdirSync','disposition','threadId','Private','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','secret','renderFile','server','downloadInteraction.ejs','transcript-','.pdf','Openchannel','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3d5ca7,_0x4872ef){var _0x1186aa=function(_0x46f0d0){while(--_0x46f0d0){_0x3d5ca7['push'](_0x3d5ca7['shift']());}};_0x1186aa(++_0x4872ef);}(_0x5875,0xf0));var _0x5587=function(_0x375242,_0x4fe67f){_0x375242=_0x375242-0x0;var _0xf3426b=_0x5875[_0x375242];return _0xf3426b;};'use strict';var emlformat=require(_0x5587('0x0'));var rimraf=require(_0x5587('0x1'));var zipdir=require(_0x5587('0x2'));var jsonpatch=require(_0x5587('0x3'));var rp=require(_0x5587('0x4'));var moment=require(_0x5587('0x5'));var BPromise=require(_0x5587('0x6'));var Mustache=require('mustache');var util=require(_0x5587('0x7'));var path=require('path');var sox=require(_0x5587('0x8'));var csv=require('to-csv');var ejs=require(_0x5587('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5587('0xa'));var squel=require(_0x5587('0xb'));var crypto=require('crypto');var jsforce=require(_0x5587('0xc'));var deskjs=require(_0x5587('0xd'));var toCsv=require(_0x5587('0xe'));var querystring=require('querystring');var Papa=require(_0x5587('0xf'));var Redis=require(_0x5587('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5587('0x11'));var pdf=require(_0x5587('0x12'));var hardwareService=require(_0x5587('0x13'));var logger=require('../../config/logger')(_0x5587('0x14'));var utils=require(_0x5587('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5587('0x16'));var db=require(_0x5587('0x17'))['db'];config[_0x5587('0x18')]=_[_0x5587('0x19')](config[_0x5587('0x18')],{'host':_0x5587('0x1a'),'port':0x18eb});var socket=require(_0x5587('0x1b'))(new Redis(config[_0x5587('0x18')]));require(_0x5587('0x1c'))[_0x5587('0x1d')](socket);function respondWithStatusCode(_0xa257ff,_0x147c6c){_0x147c6c=_0x147c6c||0xcc;return function(_0x1637de){if(_0x1637de){return _0xa257ff[_0x5587('0x1e')](_0x147c6c);}return _0xa257ff['status'](_0x147c6c)['end']();};}function respondWithResult(_0x26bce8,_0x558ab3){_0x558ab3=_0x558ab3||0xc8;return function(_0x3a4bcd){if(_0x3a4bcd){return _0x26bce8['status'](_0x558ab3)[_0x5587('0x1f')](_0x3a4bcd);}};}function respondWithFilteredResult(_0x370930,_0x589193){return function(_0x393973){if(_0x393973){var _0x1578fc=typeof _0x589193[_0x5587('0x20')]===_0x5587('0x21')&&typeof _0x589193[_0x5587('0x22')]===_0x5587('0x21');var _0x104459=_0x393973[_0x5587('0x23')];var _0x29b25b=_0x1578fc?0x0:_0x589193[_0x5587('0x20')];var _0x36d3da=_0x1578fc?_0x393973[_0x5587('0x23')]:_0x589193[_0x5587('0x20')]+_0x589193[_0x5587('0x22')];var _0x56df8d;if(_0x36d3da>=_0x104459){_0x36d3da=_0x104459;_0x56df8d=0xc8;}else{_0x56df8d=0xce;}_0x370930[_0x5587('0x24')](_0x56df8d);return _0x370930[_0x5587('0x25')](_0x5587('0x26'),_0x29b25b+'-'+_0x36d3da+'/'+_0x104459)[_0x5587('0x1f')](_0x393973);}return null;};}function patchUpdates(_0x116834){return function(_0x4eb2e9){try{jsonpatch[_0x5587('0x27')](_0x4eb2e9,_0x116834,!![]);}catch(_0x1c74bc){return BPromise['reject'](_0x1c74bc);}return _0x4eb2e9['save']();};}function saveUpdates(_0x4ef7e6,_0x1b7096){return function(_0x1c8634){if(_0x1c8634){return _0x1c8634[_0x5587('0x28')](_0x4ef7e6)[_0x5587('0x29')](function(_0x5c791f){return _0x5c791f;});}return null;};}function removeEntity(_0x244808,_0x5be51e){return function(_0x3dd551){if(_0x3dd551){return _0x3dd551[_0x5587('0x2a')]()['then'](function(){_0x244808['status'](0xcc)[_0x5587('0x2b')]();});}};}function handleEntityNotFound(_0x43e846,_0x18180a){return function(_0x2aafc3){if(!_0x2aafc3){_0x43e846[_0x5587('0x1e')](0x194);}return _0x2aafc3;};}function handleError(_0x3f87ef,_0x718394){_0x718394=_0x718394||0x1f4;return function(_0x453086){logger['error'](_0x453086['stack']);if(_0x453086[_0x5587('0x2c')]){delete _0x453086[_0x5587('0x2c')];}_0x3f87ef[_0x5587('0x24')](_0x718394)[_0x5587('0x2d')](_0x453086);};}function getInteractionUsers(_0x552cd0,_0x28cd73){return new BPromise(function(_0x53de18,_0x54a2e1){try{if(_0x28cd73[_0x552cd0['id']]){_0x552cd0[_0x5587('0x2e')]=_[_0x5587('0x2f')](_0x28cd73[_0x552cd0['id']],function(_0x284dcd){return{'id':_0x284dcd['id'],'fullname':_0x284dcd[_0x5587('0x30')]};});}}catch(_0x3dfaa1){_0x54a2e1(_0x3dfaa1);}_0x53de18(_0x552cd0);});}function getInteractionTags(_0x127bcc,_0x3a5f46){return new BPromise(function(_0x15c21d,_0x561bfd){try{if(_0x127bcc['TagIds']){_0x127bcc[_0x5587('0x31')]=[];_0x127bcc['TagIds']['split'](',')[_0x5587('0x32')](function(_0x189b4c){_0x127bcc[_0x5587('0x31')][_0x5587('0x33')](_0x3a5f46[_0x189b4c]);});}delete _0x127bcc[_0x5587('0x34')];}catch(_0x164be8){_0x561bfd(_0x164be8);}_0x15c21d(_0x127bcc);});}function updateOpenchannelInteraction(_0x24f968,_0x3ed81d,_0x1f6f9a){return new BPromise(function(_0x27d904,_0x43dd89){return getInteractionUsers(_0x24f968,_0x1f6f9a)[_0x5587('0x29')](function(_0x593a2f){return getInteractionTags(_0x593a2f,_0x3ed81d);})[_0x5587('0x29')](function(_0x1579e7){return getStateInteraction(_0x1579e7);})[_0x5587('0x29')](function(_0x667d44){_0x27d904(_0x667d44);})[_0x5587('0x35')](function(_0x599b6e){_0x43dd89(_0x599b6e);});});}function getStateInteraction(_0x421917){return new BPromise(function(_0x2f7bd9){_0x421917['waiting']=0x0;_0x421917[_0x5587('0x36')]=0x0;_0x421917[_0x5587('0x37')]=0x0;_0x421917['unmanaged']=0x0;_0x421917['total']=0x0;if(!_0x421917['closed']&&!_0x421917[_0x5587('0x38')]){_0x421917[_0x5587('0x39')]+=0x1;}if(!_0x421917[_0x5587('0x3a')]&&_0x421917[_0x5587('0x38')]){_0x421917[_0x5587('0x36')]+=0x1;if(_0x421917[_0x5587('0x39')]){_0x421917[_0x5587('0x39')]-=0x1;}}if(_0x421917[_0x5587('0x3a')]&&_0x421917[_0x5587('0x38')]){_0x421917[_0x5587('0x37')]+=0x1;if(_0x421917['talking']){_0x421917['talking']-=0x1;}}if(_0x421917[_0x5587('0x3a')]&&!_0x421917[_0x5587('0x38')]){_0x421917[_0x5587('0x3b')]+=0x1;if(_0x421917[_0x5587('0x39')]){_0x421917[_0x5587('0x39')]-=0x1;}}_0x421917['total']+=0x1;_0x2f7bd9(_0x421917);});}exports[_0x5587('0x3c')]=function(_0x3b23b1,_0x1ae783){var _0x2da16d={},_0x262611={},_0x3cdca8={'count':0x0,'rows':[]};var _0x4342a4=_['map'](db[_0x5587('0x3d')][_0x5587('0x3e')],function(_0x6b72c4){return{'name':_0x6b72c4[_0x5587('0x3f')],'type':_0x6b72c4[_0x5587('0x40')][_0x5587('0x41')]};});_0x262611[_0x5587('0x42')]=_['map'](_0x4342a4,'name');_0x262611[_0x5587('0x43')]=_[_0x5587('0x44')](_0x3b23b1['query']);_0x262611[_0x5587('0x45')]=_[_0x5587('0x46')](_0x262611[_0x5587('0x42')],_0x262611['query']);_0x2da16d['attributes']=_[_0x5587('0x46')](_0x262611[_0x5587('0x42')],qs[_0x5587('0x47')](_0x3b23b1[_0x5587('0x43')]['fields']));_0x2da16d[_0x5587('0x48')]=_0x2da16d[_0x5587('0x48')][_0x5587('0x49')]?_0x2da16d[_0x5587('0x48')]:_0x262611[_0x5587('0x42')];if(!_0x3b23b1[_0x5587('0x43')][_0x5587('0x4a')](_0x5587('0x4b'))){_0x2da16d[_0x5587('0x22')]=qs['limit'](_0x3b23b1[_0x5587('0x43')][_0x5587('0x22')]);_0x2da16d['offset']=qs[_0x5587('0x20')](_0x3b23b1[_0x5587('0x43')]['offset']);}_0x2da16d[_0x5587('0x4c')]=qs['sort'](_0x3b23b1['query'][_0x5587('0x4d')]);_0x2da16d['where']=qs[_0x5587('0x45')](_[_0x5587('0x4e')](_0x3b23b1[_0x5587('0x43')],_0x262611[_0x5587('0x45')]),_0x4342a4);var _0x3e3a7e=[];var _0x1f2fc2=squel[_0x5587('0x4f')]()['field']('id')[_0x5587('0x50')](_0x5587('0x2c'))[_0x5587('0x50')]('color')[_0x5587('0x51')](_0x5587('0x52'));var _0xbe8f8=squel['select']()[_0x5587('0x50')](_0x5587('0x53'))[_0x5587('0x50')](_0x5587('0x54'))[_0x5587('0x50')](_0x5587('0x55'))[_0x5587('0x51')](_0x5587('0x56'),'ui')[_0x5587('0x57')](_0x5587('0x58'),'u','u.id\x20=\x20ui.UserId');var _0xee5d0b=squel[_0x5587('0x4f')]()['from'](_0x5587('0x59'),'i')[_0x5587('0x57')](_0x5587('0x5a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x5587('0x57')](_0x5587('0x58'),'o',_0x5587('0x5b'))[_0x5587('0x57')](_0x5587('0x5c'),'a',_0x5587('0x5d'))[_0x5587('0x57')](_0x5587('0x5e'),'me',_0x5587('0x5f'))[_0x5587('0x57')]('openchannel_interaction_has_tags','it',_0x5587('0x60'))[_0x5587('0x57')]('tools_tags','t',_0x5587('0x61'));var _0x5d51e4=squel[_0x5587('0x62')]();var _0x1629c0=[];var _0x5b5f02=squel[_0x5587('0x62')]();var _0x5a0a2e;if(_0x3b23b1[_0x5587('0x43')][_0x5587('0x63')]){_0x5a0a2e=as[_0x5587('0x64')](_0x3b23b1[_0x5587('0x43')]['search']);var _0xce4b9b=_0x5a0a2e[_0x5587('0x65')];for(var _0x262dfe=0x0;_0x262dfe<_0x5a0a2e['conditions']['length'];_0x262dfe++){var _0x59a62a=_0x5a0a2e[_0x5587('0x66')][_0x262dfe];var _0x295b10='i';var _0x564d5c=_[_0x5587('0x67')](_0x4342a4,['name',_0x59a62a[_0x5587('0x50')]]);if(!_0x564d5c){switch(_0x59a62a['field']){case _0x5587('0x68'):if(_0x59a62a[_0x5587('0x69')]==0x1){_0xee5d0b[_0x5587('0x6a')]('`'+_0x59a62a[_0x5587('0x50')]+_0x5587('0x6b'));}else{_0xee5d0b[_0x5587('0x6a')]('`'+_0x59a62a[_0x5587('0x50')]+_0x5587('0x6c'));}break;case _0x5587('0x6d'):if(_0x59a62a[_0x5587('0x6e')]==='$substring'){if(_0x59a62a[_0x5587('0x69')][_0x5587('0x6f')]('\x20')[_0x5587('0x49')]>0x1){_0x5d51e4[_0xce4b9b](_0x5587('0x70'),qs[_0x5587('0x71')](_0x59a62a['value']),null);}else{var _0x48645b='%'+_0x59a62a[_0x5587('0x69')]+'%';_0x5d51e4[_0xce4b9b](_0x5587('0x72'),_0x48645b,_0x48645b,_0x48645b);}}else{_0x564d5c=_['find'](_0x4342a4,['name',_0x5587('0x73')]);_0x59a62a[_0x5587('0x50')]=_0x5587('0x73');_0x5be023=as['buildExpression'](_0x295b10,_0x564d5c['type'],_0x59a62a);_0x5d51e4[_0xce4b9b](_0x5be023[_0x5587('0x74')],_0x5be023[_0x5587('0x69')][_0x5587('0x75')],_0x5be023[_0x5587('0x69')]['end']);}break;case _0x5587('0x76'):var _0x726239=_0x59a62a[_0x5587('0x69')][_0x5587('0x6f')](',')[_0x5587('0x2f')](function(_0x4dfb71){return Number(_0x4dfb71);});_0x726239[_0x5587('0x32')](function(_0x1506ac){_0x5b5f02['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1506ac+',%');});_0x1629c0=_[_0x5587('0x77')](_0x1629c0,_0x726239);break;case _0x5587('0x78'):if(_0x59a62a['operator']==='$substring'){_0x5d51e4[_0xce4b9b](_0x5587('0x79'),'%'+_0x59a62a[_0x5587('0x69')]+'%',null);}else{_0x564d5c=_['find'](_0x4342a4,[_0x5587('0x2c'),_0x5587('0x38')]);_0x59a62a[_0x5587('0x50')]='UserId';_0x5be023=as[_0x5587('0x7a')](_0x295b10,_0x564d5c[_0x5587('0x40')],_0x59a62a);_0x5d51e4[_0xce4b9b](_0x5be023['text'],_0x5be023[_0x5587('0x69')][_0x5587('0x75')],_0x5be023[_0x5587('0x69')]['end']);}break;case'body':_0x5be023=as[_0x5587('0x7a')]('me',null,_0x59a62a);_0x5d51e4[_0xce4b9b](_0x5be023[_0x5587('0x74')],_0x5be023['value'][_0x5587('0x75')],_0x5be023[_0x5587('0x69')][_0x5587('0x2b')]);break;}}else{var _0x5be023=as[_0x5587('0x7a')](_0x295b10,_0x564d5c[_0x5587('0x40')],_0x59a62a);_0x5d51e4[_0xce4b9b](_0x5be023['text'],_0x5be023[_0x5587('0x69')][_0x5587('0x75')],_0x5be023[_0x5587('0x69')]['end']);}}}else{var _0x3a1f57=_(_0x3b23b1[_0x5587('0x43')])[_0x5587('0x44')]()[_0x5587('0x2f')](function(_0x564d13){return _['some'](_0x4342a4,[_0x5587('0x2c'),_0x564d13])?_0x564d13:undefined;})[_0x5587('0x7b')]()[_0x5587('0x69')]();if(!_[_0x5587('0x7c')](_0x3a1f57)){_0x3a1f57[_0x5587('0x32')](function(_0x8606d6){if(_0x8606d6===_0x5587('0x7d')){_0xee5d0b[_0x5587('0x7e')](_0x5587('0x7f'),[][_0x5587('0x80')](_0x3b23b1[_0x5587('0x43')][_0x8606d6]));}else if(_0x8606d6==='createdAt'){var _0x38dc70=JSON['parse'](_0x3b23b1[_0x5587('0x43')][_0x8606d6])[_0x5587('0x81')];var _0x2ed44a=JSON[_0x5587('0x82')](_0x3b23b1['query'][_0x8606d6])[_0x5587('0x83')];_0xee5d0b['where'](_0x5587('0x84'),_0x38dc70,_0x2ed44a);}else{if(_0x3b23b1[_0x5587('0x43')][_0x8606d6]==='null'){_0xee5d0b[_0x5587('0x7e')]('i.'+_0x8606d6+_0x5587('0x85'));}else{_0xee5d0b[_0x5587('0x7e')]('i.'+_0x8606d6+_0x5587('0x86'),_0x3b23b1['query'][_0x8606d6]);}}});}if(_0x3b23b1[_0x5587('0x43')][_0x5587('0x87')]){if(_0x3b23b1[_0x5587('0x43')]['read']==0x1){_0xee5d0b[_0x5587('0x6a')](_0x5587('0x88'));}else{_0xee5d0b[_0x5587('0x6a')](_0x5587('0x89'));}}if(_0x3b23b1[_0x5587('0x43')][_0x5587('0x8a')]){_0x1629c0=_[_0x5587('0x8b')](_0x3b23b1[_0x5587('0x43')][_0x5587('0x8a')])?_0x3b23b1['query'][_0x5587('0x8a')]:new Array(_0x3b23b1['query'][_0x5587('0x8a')]);_0x1629c0[_0x5587('0x32')](function(_0x50378f){_0x5b5f02['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x50378f+',%');});}if(_0x3b23b1[_0x5587('0x43')][_0x5587('0x8c')]){var _0x3fcf59=_0x3b23b1[_0x5587('0x43')][_0x5587('0x8c')][_0x5587('0x8d')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3fcf59)){_0x5d51e4['or'](_0x5587('0x8e'),_0x3fcf59+'%');}else{_0x5d51e4['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x5587('0x71')](_0x3fcf59))['or'](_0x5587('0x8f'),_0x3fcf59+'%')['or'](_0x5587('0x90'),_0x3fcf59+'%');}}}_0xee5d0b[_0x5587('0x7e')](_0x5d51e4);_0xee5d0b[_0x5587('0x91')](_0x5587('0x92'));var _0x5b3a3e={'type':db[_0x5587('0x93')][_0x5587('0x94')][_0x5587('0x95')],'raw':!![]};var _0x26639b=_0xee5d0b[_0x5587('0x96')]();_0x26639b[_0x5587('0x50')](_0x5587('0x92'));_0x26639b[_0x5587('0x50')](_0x5587('0x97'),'unreadMessages');if(_0x2da16d[_0x5587('0x4c')]){_0x2da16d['order']['forEach'](function(_0x1eac41){var _0xb160c1=_0x1eac41[0x0]===_0x5587('0x98')?_0x1eac41[0x0]:'i.'+_0x1eac41[0x0];_0xee5d0b[_0x5587('0x4c')](_0xb160c1,_0x1eac41[0x1]===_0x5587('0x99')?![]:!![]);});}if(!_['isEmpty'](_0x1629c0)){_0xee5d0b[_0x5587('0x6a')](_0x5b5f02);_0x26639b['where'](_0x5587('0x9a'),_0x1629c0);}BPromise['resolve']()['then'](function(){if(!_0x5a0a2e){if(_0x3b23b1[_0x5587('0x43')][_0x5587('0x7d')])return;_0x26639b['where'](_0x5587('0x9b'));_0xee5d0b[_0x5587('0x7e')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3b23b1[_0x5587('0x9c')]['role']!==_0x5587('0x9d'))return;return _0x3b23b1['user'][_0x5587('0x9e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x320174){if(_['isEmpty'](_0x320174)){_0x26639b['where'](_0x5587('0x9f'));_0xee5d0b[_0x5587('0x7e')](_0x5587('0x9f'));}else{_0x26639b[_0x5587('0x7e')](_0x5587('0x7f'),_['map'](_0x320174,'id'));_0xee5d0b[_0x5587('0x7e')](_0x5587('0x7f'),_[_0x5587('0x2f')](_0x320174,'id'));}});})['then'](function(){if(_0x3b23b1[_0x5587('0x9c')][_0x5587('0xa0')]==='agent'&&!_0x5a0a2e&&!_0x3b23b1[_0x5587('0x43')][_0x5587('0x7d')])return[];return db['sequelize']['query'](_0x26639b[_0x5587('0xa1')](),_0x5b3a3e);})[_0x5587('0x29')](function(_0x26f78a){_0x3cdca8['count']=_0x26f78a['length'];if(_0x3cdca8[_0x5587('0x23')]===0x0)return[];return db['sequelize']['query'](_0x1f2fc2['toString'](),_0x5b3a3e)[_0x5587('0x29')](function(_0x3c1502){_0x3e3a7e=_[_0x5587('0xa2')](_0x3c1502,'id');_0x5b3a3e=_[_0x5587('0xa3')](_0x5b3a3e,{'model':db[_0x5587('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3b23b1[_0x5587('0x43')][_0x5587('0x47')]){_0x2da16d[_0x5587('0x48')][_0x5587('0x32')](function(_0x4fd43e){_0xee5d0b[_0x5587('0x50')]('i.'+_0x4fd43e);});}else{_0xee5d0b[_0x5587('0x50')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0xee5d0b[_0x5587('0x50')]('a.key',_0x5587('0xa4'));_0xee5d0b[_0x5587('0x50')](_0x5587('0xa5'),_0x5587('0xa6'));_0xee5d0b[_0x5587('0x50')](_0x5587('0xa7'),_0x5587('0x98'));_0xee5d0b[_0x5587('0x50')](_0x5587('0xa8'));_0xee5d0b[_0x5587('0x50')](_0x5587('0xa9'),_0x5587('0xaa'));_0xee5d0b['field'](_0x5587('0xab'),_0x5587('0xac'));_0xee5d0b[_0x5587('0x50')](_0x5587('0xad'),'Contact.email');_0xee5d0b[_0x5587('0x50')](_0x5587('0xae'),_0x5587('0xaf'));_0xee5d0b[_0x5587('0x50')](_0x5587('0xb0'),_0x5587('0xb1'));_0xee5d0b[_0x5587('0x50')]('c.fax',_0x5587('0xb2'));_0xee5d0b[_0x5587('0x50')]('o.fullname','Owner.fullname');_0xee5d0b[_0x5587('0x50')](_0x5587('0xb3'),_0x5587('0xb4'));_0xee5d0b[_0x5587('0x50')](_0x5587('0xb5'),'TagIds');}if(_0x2da16d[_0x5587('0x22')])_0xee5d0b['limit'](_0x2da16d[_0x5587('0x22')]);if(_0x2da16d[_0x5587('0x20')])_0xee5d0b[_0x5587('0x20')](_0x2da16d[_0x5587('0x20')]);return db[_0x5587('0xb6')][_0x5587('0x43')](_0xee5d0b[_0x5587('0xa1')](),_0x5b3a3e);})[_0x5587('0x29')](function(_0x4fe681){if(_0x4fe681['length']>0x0)_0xbe8f8[_0x5587('0x7e')](_0x5587('0xb7'),_[_0x5587('0x2f')](_0x4fe681,'id'));return db[_0x5587('0xb6')][_0x5587('0x43')](_0xbe8f8[_0x5587('0xa1')](),_0x5b3a3e)[_0x5587('0x29')](function(_0x2a5301){var _0xae71df=_[_0x5587('0xb8')](_0x2a5301,_0x5587('0xb9'));var _0x470518=[];_0x4fe681[_0x5587('0x32')](function(_0x22f5a5){_0x470518[_0x5587('0x33')](updateOpenchannelInteraction(_0x22f5a5,_0x3e3a7e,_0xae71df));});return BPromise[_0x5587('0xba')](_0x470518);});});})[_0x5587('0x29')](function(_0x40661a){_0x3cdca8[_0x5587('0xbb')]=_0x40661a;return _0x3cdca8;})['then'](respondWithFilteredResult(_0x1ae783,_0x2da16d))[_0x5587('0x35')](handleError(_0x1ae783,null));};exports[_0x5587('0xbc')]=function(_0x5cd3ef,_0x2508f8){var _0x5814e9={};if(_0x5cd3ef[_0x5587('0x43')][_0x5587('0x40')]&&_0x5cd3ef[_0x5587('0x43')][_0x5587('0x40')]==='from'){_0x5814e9['from']=_0x5cd3ef[_0x5587('0xbd')]['id'];}else{_0x5814e9['id']=_0x5cd3ef[_0x5587('0xbd')]['id'];}var _0x3ed587={'raw':![],'where':_0x5814e9},_0x1441d0={};_0x1441d0[_0x5587('0x42')]=_[_0x5587('0x44')](db[_0x5587('0x3d')][_0x5587('0x3e')]);_0x1441d0[_0x5587('0x43')]=_['keys'](_0x5cd3ef[_0x5587('0x43')]);_0x1441d0[_0x5587('0x45')]=_[_0x5587('0x46')](_0x1441d0['model'],_0x1441d0[_0x5587('0x43')]);_0x3ed587[_0x5587('0x48')]=_[_0x5587('0x46')](_0x1441d0[_0x5587('0x42')],qs[_0x5587('0x47')](_0x5cd3ef['query'][_0x5587('0x47')]));_0x3ed587['attributes']=_0x3ed587[_0x5587('0x48')][_0x5587('0x49')]?_0x3ed587[_0x5587('0x48')]:_0x1441d0[_0x5587('0x42')];if(_0x5cd3ef[_0x5587('0x43')]['includeAll']){_0x3ed587[_0x5587('0xbe')]=[{'all':!![]}];}_0x3ed587=_['merge']({},_0x3ed587,_0x5cd3ef[_0x5587('0xbf')]);return db[_0x5587('0x3d')][_0x5587('0x67')](_0x3ed587)['then'](handleEntityNotFound(_0x2508f8,null))['then'](respondWithResult(_0x2508f8,null))[_0x5587('0x35')](handleError(_0x2508f8,null));};exports[_0x5587('0xc0')]=function(_0x18fb5f,_0x4e5da4){return db[_0x5587('0x3d')]['create'](_0x18fb5f[_0x5587('0xc1')],{})[_0x5587('0x29')](respondWithResult(_0x4e5da4,0xc9))[_0x5587('0x35')](handleError(_0x4e5da4,null));};exports[_0x5587('0x28')]=function(_0x51baa4,_0xfd1f38){if(_0x51baa4['body']['id']){delete _0x51baa4[_0x5587('0xc1')]['id'];}return db[_0x5587('0x3d')][_0x5587('0x67')]({'where':{'id':_0x51baa4['params']['id']}})[_0x5587('0x29')](handleEntityNotFound(_0xfd1f38,null))[_0x5587('0x29')](saveUpdates(_0x51baa4[_0x5587('0xc1')],null))[_0x5587('0x29')](respondWithResult(_0xfd1f38,null))[_0x5587('0x35')](handleError(_0xfd1f38,null));};exports['destroy']=function(_0x40f4eb,_0x294309){return db[_0x5587('0x3d')]['find']({'where':{'id':_0x40f4eb[_0x5587('0xbd')]['id']}})[_0x5587('0x29')](handleEntityNotFound(_0x294309,null))['then'](removeEntity(_0x294309,null))[_0x5587('0x35')](handleError(_0x294309,null));};exports[_0x5587('0xc2')]=function(_0x5e606e,_0x2b5e39){return db[_0x5587('0x3d')]['describe']()[_0x5587('0x29')](respondWithResult(_0x2b5e39,null))['catch'](handleError(_0x2b5e39,null));};exports['addMessage']=function(_0x13cb1a,_0x745d35,_0x1c3f40){return db[_0x5587('0xc3')]['find']({'where':{'id':_0x13cb1a[_0x5587('0xbd')]['id']}})['then'](handleEntityNotFound(_0x745d35,null))[_0x5587('0x29')](function(_0x1df8e6){if(_0x1df8e6){return _0x1df8e6[_0x5587('0xc4')](_0x13cb1a['body']['ids'],_['omit'](_0x13cb1a[_0x5587('0xc1')],[_0x5587('0xc5'),'id'])||{});}})[_0x5587('0x29')](respondWithResult(_0x745d35,null))['catch'](handleError(_0x745d35,null));};exports['getMessages']=function(_0xf82a50,_0x20c785,_0x3fdcac){var _0x488afb={'raw':![],'where':{}};var _0x5cc2cf={};var _0x2b81eb={'count':0x0,'rows':[]};return db['OpenchannelInteraction']['findOne']({'where':{'id':_0xf82a50[_0x5587('0xbd')]['id']}})[_0x5587('0x29')](handleEntityNotFound(_0x20c785,null))[_0x5587('0x29')](function(_0xea31ed){if(_0xea31ed){_0x5cc2cf[_0x5587('0x42')]=_[_0x5587('0x44')](db[_0x5587('0xc3')][_0x5587('0x3e')]);_0x5cc2cf[_0x5587('0x43')]=_[_0x5587('0x44')](_0xf82a50[_0x5587('0x43')]);_0x5cc2cf['filters']=_['intersection'](_0x5cc2cf['model'],_0x5cc2cf[_0x5587('0x43')]);_0x488afb[_0x5587('0x48')]=_['intersection'](_0x5cc2cf['model'],qs[_0x5587('0x47')](_0xf82a50['query'][_0x5587('0x47')]));_0x488afb[_0x5587('0x48')]=_0x488afb[_0x5587('0x48')][_0x5587('0x49')]?_0x488afb[_0x5587('0x48')]:_0x5cc2cf[_0x5587('0x42')];if(!_0xf82a50[_0x5587('0x43')][_0x5587('0x4a')](_0x5587('0x4b'))){_0x488afb['limit']=qs[_0x5587('0x22')](_0xf82a50[_0x5587('0x43')][_0x5587('0x22')]);_0x488afb[_0x5587('0x20')]=qs['offset'](_0xf82a50[_0x5587('0x43')][_0x5587('0x20')]);}_0x488afb[_0x5587('0x4c')]=qs[_0x5587('0x4d')](_0xf82a50[_0x5587('0x43')][_0x5587('0x4d')]);_0x488afb['where']=qs['filters'](_[_0x5587('0x4e')](_0xf82a50['query'],_0x5cc2cf[_0x5587('0x45')]));_0x488afb[_0x5587('0x7e')][_0x5587('0xb9')]=_0xea31ed['id'];if(_0xf82a50[_0x5587('0x43')]['filter']){_0x488afb[_0x5587('0x7e')]=_[_0x5587('0xa3')](_0x488afb[_0x5587('0x7e')],{'$or':_[_0x5587('0x2f')](_0x488afb[_0x5587('0x48')],function(_0x802c93){var _0xf99273={};_0xf99273[_0x802c93]={'$like':'%'+_0xf82a50[_0x5587('0x43')][_0x5587('0x8c')]+'%'};return _0xf99273;})});}if(_0xf82a50[_0x5587('0x43')]['$gte']){var _0x4b9a15=_0xf82a50['query']['$gte'][_0x5587('0x6f')](',');var _0x505a65={};_0x505a65[_0x4b9a15[0x0]]={'$gte':moment(_0x4b9a15[0x1])[_0x5587('0xc6')](_0x5587('0xc7'))};_0x488afb['where']=_[_0x5587('0xa3')](_0x488afb[_0x5587('0x7e')],_0x505a65);}_0x488afb=_[_0x5587('0xa3')]({},_0x488afb,_0xf82a50[_0x5587('0xbf')]);return db[_0x5587('0xc3')][_0x5587('0x23')]({'where':_0x488afb[_0x5587('0x7e')]})[_0x5587('0x29')](function(_0x441dca){_0x2b81eb[_0x5587('0x23')]=_0x441dca;if(_0xf82a50[_0x5587('0x43')][_0x5587('0xc8')]){_0x488afb[_0x5587('0xbe')]=[{'all':!![]}];}return db[_0x5587('0xc3')][_0x5587('0xc9')](_0x488afb);})['then'](function(_0x5516c6){_0x2b81eb[_0x5587('0xbb')]=_0x5516c6;return _0x2b81eb;});}})[_0x5587('0x29')](respondWithFilteredResult(_0x20c785,_0x488afb))[_0x5587('0x35')](handleError(_0x20c785,null));};exports[_0x5587('0xca')]=function(_0x548f8b,_0x597636,_0x1d6860){return db[_0x5587('0x3d')][_0x5587('0x67')]({'where':{'id':_0x548f8b[_0x5587('0xbd')]['id']}})[_0x5587('0x29')](handleEntityNotFound(_0x597636,null))['then'](function(_0x1c3a39){if(_0x1c3a39){return _0x1c3a39[_0x5587('0xcb')](_0x548f8b[_0x5587('0xc1')][_0x5587('0xc5')],_['omit'](_0x548f8b[_0x5587('0xc1')],[_0x5587('0xc5'),'id'])||{})[_0x5587('0xcc')](function(){return db[_0x5587('0x76')][_0x5587('0xc9')]({'attributes':['id',_0x5587('0x2c'),_0x5587('0xcd')],'where':{'id':_0x548f8b[_0x5587('0xc1')]['ids']}});})['then'](function(_0x5c2bb6){socket[_0x5587('0xce')](_0x5587('0xcf'),{'id':Number(_0x548f8b[_0x5587('0xbd')]['id']),'tags':_0x5c2bb6||[]});return{'id':Number(_0x548f8b[_0x5587('0xbd')]['id']),'tags':_0x5c2bb6||[]};});}})['then'](respondWithResult(_0x597636,null))[_0x5587('0x35')](handleError(_0x597636,null));};exports['removeTags']=function(_0x2bf321,_0xe0aa18,_0x3878f){return db[_0x5587('0x3d')][_0x5587('0x67')]({'where':{'id':_0x2bf321[_0x5587('0xbd')]['id']}})[_0x5587('0x29')](handleEntityNotFound(_0xe0aa18,null))['then'](function(_0x5dcf26){if(_0x5dcf26){return _0x5dcf26[_0x5587('0xd0')](_0x2bf321[_0x5587('0x43')][_0x5587('0xc5')]);}})[_0x5587('0x29')](respondWithStatusCode(_0xe0aa18,null))['catch'](handleError(_0xe0aa18,null));};exports[_0x5587('0xd1')]=function(_0x24069a,_0x2495c9){var _0x22b8f1=moment()[_0x5587('0xd2')]()['toString']();var _0x5d3436=path[_0x5587('0xd3')](config[_0x5587('0xd4')],'server','files',_0x5587('0xd5'));var _0x1cd762=path[_0x5587('0xd3')](config[_0x5587('0xd4')],'server','files',_0x5587('0xd6'));var _0x2869d0=path[_0x5587('0xd3')](_0x5d3436,_0x22b8f1);var _0xb35a09=util[_0x5587('0xc6')]('transcript-%d-%s.zip',_0x24069a[_0x5587('0xbd')]['id'],_0x22b8f1);var _0x42646f=path[_0x5587('0xd3')](_0x5d3436,_0xb35a09);var _0x26b595=[];_0x26b595[_0x5587('0x33')]({'model':db['User'],'as':_0x5587('0x78'),'attributes':['id',_0x5587('0x30')],'raw':!![]});_0x26b595[_0x5587('0x33')]({'model':db[_0x5587('0xd7')],'as':'Contact','attributes':['id',_0x5587('0xd8'),_0x5587('0xd9')],'raw':!![]});if(_0x24069a[_0x5587('0x43')][_0x5587('0xd6')]){_0x26b595[_0x5587('0x33')]({'model':db[_0x5587('0xda')],'as':_0x5587('0xda'),'raw':!![]});}var _0x4da55b=[{'model':db[_0x5587('0xc3')],'as':_0x5587('0xdb'),'attributes':['id',_0x5587('0xc1'),'createdAt','direction','secret',_0x5587('0x87')],'include':_0x26b595}];_0x4da55b['push']({'model':db[_0x5587('0xdc')],'as':'Account','attributes':['id',_0x5587('0x2c')]});_0x4da55b[_0x5587('0x33')]({'model':db[_0x5587('0x78')],'as':_0x5587('0xdd'),'attributes':['id',_0x5587('0x30')]});return db[_0x5587('0x3d')][_0x5587('0x67')]({'where':{'id':_0x24069a[_0x5587('0xbd')]['id']},'include':_0x4da55b})['then'](handleEntityNotFound(_0x2495c9,null))[_0x5587('0x29')](function(_0x109c4b){if(_0x109c4b){var _0x37608c=_0x109c4b[_0x5587('0xde')]({'plain':!![]});fs[_0x5587('0xdf')](_0x2869d0);var _0x44d7be={'channel':'Openchannel','account':_0x37608c['Account'][_0x5587('0x2c')],'agent':_0x37608c['Owner']?_0x37608c[_0x5587('0xdd')][_0x5587('0x30')]:'N.A.','createdAt':moment(_0x37608c['createdAt'])[_0x5587('0xc6')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5587('0xa1')](),'closedAt':_0x37608c[_0x5587('0x3a')]?moment(_0x37608c['closedAt'])[_0x5587('0xc6')](_0x5587('0xc7'))[_0x5587('0xa1')]():'','disposition':_0x37608c[_0x5587('0xe0')],'visibility':_0x37608c[_0x5587('0xe1')]?'Public':_0x5587('0xe2'),'messages':_(_0x37608c[_0x5587('0xdb')])[_0x5587('0x8c')]({'secret':![]})['map'](function(_0xb6b544){if(_0xb6b544['Attachment']){var _0x545310=path['join'](_0x1cd762,_0xb6b544[_0x5587('0xda')][_0x5587('0xe3')]);if(fs[_0x5587('0xe4')](_0x545310)){fs[_0x5587('0xe5')](_0x545310)[_0x5587('0xe6')](fs[_0x5587('0xe7')](path[_0x5587('0xd3')](_0x2869d0,_0xb6b544[_0x5587('0xda')][_0x5587('0xe3')])));}}return{'date':moment(_0xb6b544['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x5587('0xa1')](),'sender':_0xb6b544[_0x5587('0xe8')]===_0x5587('0xe9')?_0xb6b544[_0x5587('0x78')]?_0xb6b544[_0x5587('0x78')][_0x5587('0x30')]:_0x5587('0xea'):_0xb6b544['Contact'][_0x5587('0xd8')]+(_0xb6b544[_0x5587('0x6d')][_0x5587('0xd9')]?'\x20'+_0xb6b544[_0x5587('0x6d')][_0x5587('0xd9')]:''),'body':_0xb6b544[_0x5587('0xda')]?_0xb6b544[_0x5587('0xda')][_0x5587('0xe3')]:_0xb6b544['body'],'direction':_0xb6b544[_0x5587('0xe8')]===_0x5587('0xe9')?'A':'C','secret':_0xb6b544[_0x5587('0xeb')],'read':_0xb6b544[_0x5587('0x87')],'attachment':_0xb6b544[_0x5587('0xda')]};})['value']()};return ejs[_0x5587('0xec')](path['join'](config[_0x5587('0xd4')],_0x5587('0xed'),'views',_0x5587('0xee')),{'interaction':_0x44d7be})[_0x5587('0x29')](function(_0x3cb6ba){var _0x192476=path[_0x5587('0xd3')](_0x2869d0,_0x5587('0xef')+_0x37608c['id']+'-'+_0x22b8f1+_0x5587('0xf0'));var _0x2d10bb={'path':_0x192476,'channel':_0x5587('0xf1'),'interactionId':_0x37608c['id']};return pdf['createPdfFromHTML'](_0x3cb6ba,_0x2d10bb);})['then'](function(){return new BPromise(function(_0xed9da5,_0x56f90e){zipdir(_0x2869d0,{'saveTo':_0x42646f},function(_0x3fc076,_0xbe0016){if(_0x3fc076)return _0x56f90e(_0x3fc076);return _0xed9da5(_0xbe0016);});})[_0x5587('0x29')](function(){return new BPromise(function(_0x2d469f,_0x1dd658){rimraf(_0x2869d0,function(_0x4b01ef){if(_0x4b01ef)_0x1dd658(_0x4b01ef);return _0x2d469f();});});})[_0x5587('0x29')](function(){return _0x2495c9['download'](_0x42646f,_0xb35a09,function(_0x10af43){if(_0x10af43){console[_0x5587('0xf2')](_0x5587('0xf3'),_0x10af43);}else{fs[_0x5587('0xf4')](_0x42646f);}});});});}else{return _0x2495c9[_0x5587('0x1e')](0xc8);}})[_0x5587('0x35')](handleError(_0x2495c9,null));}; \ No newline at end of file +var _0xeeb0=['read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','role','toString','sequelize','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','rawAttributes','includeAll','merge','options','create','body','describe','addMessage','ids','getMessages','findOne','OpenchannelMessage','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','join','server','tmp','root','attachments','format','transcript-%d-%s.zip','User','Contact','firstName','lastName','Attachment','direction','secret','Account','Owner','get','mkdirSync','Openchannel','N.A.','closedAt','disposition','threadId','Public','Private','Messages','basename','existsSync','pipe','createWriteStream','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','sendStatus','error','stack','send','Users','map','fullname','TagIds','Tags','forEach','push','catch','waiting','talking','unmanaged','closed','UserId','answered','total','index','OpenchannelInteraction','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','select','field','color','from','tools_tags','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','having','`\x20=\x200','`\x20>\x200','operator','$substring','value','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','OpenchannelAccountId','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20IS\x20NULL'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xeeb0,0x73));var _0x0eeb=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0xeeb0[_0x27bd2c];return _0x3784ea;};'use strict';var emlformat=require(_0x0eeb('0x0'));var rimraf=require(_0x0eeb('0x1'));var zipdir=require(_0x0eeb('0x2'));var jsonpatch=require(_0x0eeb('0x3'));var rp=require('request-promise');var moment=require(_0x0eeb('0x4'));var BPromise=require(_0x0eeb('0x5'));var Mustache=require('mustache');var util=require(_0x0eeb('0x6'));var path=require(_0x0eeb('0x7'));var sox=require('sox');var csv=require(_0x0eeb('0x8'));var ejs=require(_0x0eeb('0x9'));var fs=require('fs');var fs_extra=require(_0x0eeb('0xa'));var _=require(_0x0eeb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0eeb('0xc'));var deskjs=require(_0x0eeb('0xd'));var toCsv=require(_0x0eeb('0x8'));var querystring=require(_0x0eeb('0xe'));var Papa=require(_0x0eeb('0xf'));var Redis=require(_0x0eeb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0eeb('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0eeb('0x12'))(_0x0eeb('0x13'));var utils=require('../../config/utils');var config=require(_0x0eeb('0x14'));var licenseUtil=require(_0x0eeb('0x15'));var db=require(_0x0eeb('0x16'))['db'];config[_0x0eeb('0x17')]=_[_0x0eeb('0x18')](config[_0x0eeb('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x0eeb('0x19'))(new Redis(config[_0x0eeb('0x17')]));require(_0x0eeb('0x1a'))[_0x0eeb('0x1b')](socket);function respondWithStatusCode(_0x21df22,_0x4dde43){_0x4dde43=_0x4dde43||0xcc;return function(_0x2a4048){if(_0x2a4048){return _0x21df22['sendStatus'](_0x4dde43);}return _0x21df22[_0x0eeb('0x1c')](_0x4dde43)[_0x0eeb('0x1d')]();};}function respondWithResult(_0x38c6df,_0x2ecb23){_0x2ecb23=_0x2ecb23||0xc8;return function(_0xaeac08){if(_0xaeac08){return _0x38c6df[_0x0eeb('0x1c')](_0x2ecb23)[_0x0eeb('0x1e')](_0xaeac08);}};}function respondWithFilteredResult(_0xa7280c,_0x50ea4b){return function(_0x2e1322){if(_0x2e1322){var _0x284c41=typeof _0x50ea4b[_0x0eeb('0x1f')]===_0x0eeb('0x20')&&typeof _0x50ea4b[_0x0eeb('0x21')]===_0x0eeb('0x20');var _0x57bb4c=_0x2e1322[_0x0eeb('0x22')];var _0x2d4db7=_0x284c41?0x0:_0x50ea4b[_0x0eeb('0x1f')];var _0x5b3593=_0x284c41?_0x2e1322[_0x0eeb('0x22')]:_0x50ea4b[_0x0eeb('0x1f')]+_0x50ea4b['limit'];var _0x293acc;if(_0x5b3593>=_0x57bb4c){_0x5b3593=_0x57bb4c;_0x293acc=0xc8;}else{_0x293acc=0xce;}_0xa7280c['status'](_0x293acc);return _0xa7280c['set']('Content-Range',_0x2d4db7+'-'+_0x5b3593+'/'+_0x57bb4c)[_0x0eeb('0x1e')](_0x2e1322);}return null;};}function patchUpdates(_0xbd2fa3){return function(_0x482043){try{jsonpatch[_0x0eeb('0x23')](_0x482043,_0xbd2fa3,!![]);}catch(_0x1d2607){return BPromise['reject'](_0x1d2607);}return _0x482043[_0x0eeb('0x24')]();};}function saveUpdates(_0x243871,_0x4d4320){return function(_0xe4af9b){if(_0xe4af9b){return _0xe4af9b[_0x0eeb('0x25')](_0x243871)[_0x0eeb('0x26')](function(_0x22f354){return _0x22f354;});}return null;};}function removeEntity(_0x2bde69,_0x4b1d13){return function(_0x4a8d44){if(_0x4a8d44){return _0x4a8d44[_0x0eeb('0x27')]()[_0x0eeb('0x26')](function(){_0x2bde69[_0x0eeb('0x1c')](0xcc)[_0x0eeb('0x1d')]();});}};}function handleEntityNotFound(_0x37735b,_0x29fbe6){return function(_0x41ee98){if(!_0x41ee98){_0x37735b[_0x0eeb('0x28')](0x194);}return _0x41ee98;};}function handleError(_0xb6b40b,_0x4b4723){_0x4b4723=_0x4b4723||0x1f4;return function(_0xdab5d9){logger[_0x0eeb('0x29')](_0xdab5d9[_0x0eeb('0x2a')]);if(_0xdab5d9['name']){delete _0xdab5d9['name'];}_0xb6b40b[_0x0eeb('0x1c')](_0x4b4723)[_0x0eeb('0x2b')](_0xdab5d9);};}function getInteractionUsers(_0x16001a,_0x285102){return new BPromise(function(_0x2db4a2,_0x49379d){try{if(_0x285102[_0x16001a['id']]){_0x16001a[_0x0eeb('0x2c')]=_[_0x0eeb('0x2d')](_0x285102[_0x16001a['id']],function(_0xc23dc0){return{'id':_0xc23dc0['id'],'fullname':_0xc23dc0[_0x0eeb('0x2e')]};});}}catch(_0x253370){_0x49379d(_0x253370);}_0x2db4a2(_0x16001a);});}function getInteractionTags(_0x30660d,_0x197b36){return new BPromise(function(_0x410fbd,_0x11946d){try{if(_0x30660d[_0x0eeb('0x2f')]){_0x30660d[_0x0eeb('0x30')]=[];_0x30660d[_0x0eeb('0x2f')]['split'](',')[_0x0eeb('0x31')](function(_0x3e6cc5){_0x30660d[_0x0eeb('0x30')][_0x0eeb('0x32')](_0x197b36[_0x3e6cc5]);});}delete _0x30660d[_0x0eeb('0x2f')];}catch(_0x1ad99b){_0x11946d(_0x1ad99b);}_0x410fbd(_0x30660d);});}function updateOpenchannelInteraction(_0x4813aa,_0x21c547,_0x46b0e0){return new BPromise(function(_0x3350f9,_0x271bea){return getInteractionUsers(_0x4813aa,_0x46b0e0)[_0x0eeb('0x26')](function(_0x4e5761){return getInteractionTags(_0x4e5761,_0x21c547);})['then'](function(_0x36896b){return getStateInteraction(_0x36896b);})[_0x0eeb('0x26')](function(_0x2bed87){_0x3350f9(_0x2bed87);})[_0x0eeb('0x33')](function(_0x2125dc){_0x271bea(_0x2125dc);});});}function getStateInteraction(_0x1e6de7){return new BPromise(function(_0x1076ea){_0x1e6de7[_0x0eeb('0x34')]=0x0;_0x1e6de7[_0x0eeb('0x35')]=0x0;_0x1e6de7['answered']=0x0;_0x1e6de7[_0x0eeb('0x36')]=0x0;_0x1e6de7['total']=0x0;if(!_0x1e6de7[_0x0eeb('0x37')]&&!_0x1e6de7[_0x0eeb('0x38')]){_0x1e6de7[_0x0eeb('0x34')]+=0x1;}if(!_0x1e6de7[_0x0eeb('0x37')]&&_0x1e6de7[_0x0eeb('0x38')]){_0x1e6de7[_0x0eeb('0x35')]+=0x1;if(_0x1e6de7['waiting']){_0x1e6de7[_0x0eeb('0x34')]-=0x1;}}if(_0x1e6de7['closed']&&_0x1e6de7[_0x0eeb('0x38')]){_0x1e6de7[_0x0eeb('0x39')]+=0x1;if(_0x1e6de7[_0x0eeb('0x35')]){_0x1e6de7['talking']-=0x1;}}if(_0x1e6de7[_0x0eeb('0x37')]&&!_0x1e6de7[_0x0eeb('0x38')]){_0x1e6de7['unmanaged']+=0x1;if(_0x1e6de7['waiting']){_0x1e6de7['waiting']-=0x1;}}_0x1e6de7[_0x0eeb('0x3a')]+=0x1;_0x1076ea(_0x1e6de7);});}exports[_0x0eeb('0x3b')]=function(_0x3f377e,_0x4a930a){var _0x2049ec={},_0x1f8842={},_0x3b8f00={'count':0x0,'rows':[]};var _0x50751f=_[_0x0eeb('0x2d')](db[_0x0eeb('0x3c')]['rawAttributes'],function(_0x1ccffa){return{'name':_0x1ccffa[_0x0eeb('0x3d')],'type':_0x1ccffa[_0x0eeb('0x3e')][_0x0eeb('0x3f')]};});_0x1f8842[_0x0eeb('0x40')]=_['map'](_0x50751f,_0x0eeb('0x41'));_0x1f8842[_0x0eeb('0x42')]=_[_0x0eeb('0x43')](_0x3f377e['query']);_0x1f8842[_0x0eeb('0x44')]=_[_0x0eeb('0x45')](_0x1f8842[_0x0eeb('0x40')],_0x1f8842['query']);_0x2049ec[_0x0eeb('0x46')]=_[_0x0eeb('0x45')](_0x1f8842['model'],qs[_0x0eeb('0x47')](_0x3f377e[_0x0eeb('0x42')][_0x0eeb('0x47')]));_0x2049ec['attributes']=_0x2049ec[_0x0eeb('0x46')][_0x0eeb('0x48')]?_0x2049ec[_0x0eeb('0x46')]:_0x1f8842['model'];if(!_0x3f377e['query']['hasOwnProperty'](_0x0eeb('0x49'))){_0x2049ec[_0x0eeb('0x21')]=qs[_0x0eeb('0x21')](_0x3f377e[_0x0eeb('0x42')][_0x0eeb('0x21')]);_0x2049ec[_0x0eeb('0x1f')]=qs[_0x0eeb('0x1f')](_0x3f377e[_0x0eeb('0x42')][_0x0eeb('0x1f')]);}_0x2049ec['order']=qs[_0x0eeb('0x4a')](_0x3f377e['query']['sort']);_0x2049ec['where']=qs[_0x0eeb('0x44')](_[_0x0eeb('0x4b')](_0x3f377e[_0x0eeb('0x42')],_0x1f8842[_0x0eeb('0x44')]),_0x50751f);var _0x319029=[];var _0x2a0228=squel[_0x0eeb('0x4c')]()['field']('id')[_0x0eeb('0x4d')](_0x0eeb('0x41'))[_0x0eeb('0x4d')](_0x0eeb('0x4e'))[_0x0eeb('0x4f')](_0x0eeb('0x50'));var _0x3a8c0f=squel['select']()[_0x0eeb('0x4d')](_0x0eeb('0x51'))['field']('u.fullname')[_0x0eeb('0x4d')](_0x0eeb('0x52'))[_0x0eeb('0x4f')](_0x0eeb('0x53'),'ui')['left_join'](_0x0eeb('0x54'),'u','u.id\x20=\x20ui.UserId');var _0x4d9a18=squel[_0x0eeb('0x4c')]()[_0x0eeb('0x4f')]('openchannel_interactions','i')['left_join'](_0x0eeb('0x55'),'c',_0x0eeb('0x56'))[_0x0eeb('0x57')]('users','o',_0x0eeb('0x58'))[_0x0eeb('0x57')](_0x0eeb('0x59'),'a',_0x0eeb('0x5a'))[_0x0eeb('0x57')]('openchannel_messages','me',_0x0eeb('0x5b'))['left_join'](_0x0eeb('0x5c'),'it',_0x0eeb('0x5d'))[_0x0eeb('0x57')](_0x0eeb('0x50'),'t',_0x0eeb('0x5e'));var _0x3947b2=squel[_0x0eeb('0x5f')]();var _0x2c2e67=[];var _0x28cdb9=squel[_0x0eeb('0x5f')]();var _0x3e3ea1;if(_0x3f377e[_0x0eeb('0x42')][_0x0eeb('0x60')]){_0x3e3ea1=as['parseSearch'](_0x3f377e[_0x0eeb('0x42')]['search']);var _0x30eb7d=_0x3e3ea1[_0x0eeb('0x61')];for(var _0x2ed0cf=0x0;_0x2ed0cf<_0x3e3ea1['conditions']['length'];_0x2ed0cf++){var _0x498fd8=_0x3e3ea1[_0x0eeb('0x62')][_0x2ed0cf];var _0xbd4953='i';var _0xefafe3=_['find'](_0x50751f,[_0x0eeb('0x41'),_0x498fd8['field']]);if(!_0xefafe3){switch(_0x498fd8[_0x0eeb('0x4d')]){case _0x0eeb('0x63'):if(_0x498fd8['value']==0x1){_0x4d9a18[_0x0eeb('0x64')]('`'+_0x498fd8['field']+_0x0eeb('0x65'));}else{_0x4d9a18['having']('`'+_0x498fd8[_0x0eeb('0x4d')]+_0x0eeb('0x66'));}break;case'Contact':if(_0x498fd8[_0x0eeb('0x67')]===_0x0eeb('0x68')){if(_0x498fd8[_0x0eeb('0x69')][_0x0eeb('0x6a')]('\x20')[_0x0eeb('0x48')]>0x1){_0x3947b2[_0x30eb7d](_0x0eeb('0x6b'),qs[_0x0eeb('0x6c')](_0x498fd8['value']),null);}else{var _0x2a9a1f='%'+_0x498fd8[_0x0eeb('0x69')]+'%';_0x3947b2[_0x30eb7d](_0x0eeb('0x6d'),_0x2a9a1f,_0x2a9a1f,_0x2a9a1f);}}else{_0xefafe3=_[_0x0eeb('0x6e')](_0x50751f,[_0x0eeb('0x41'),'ContactId']);_0x498fd8[_0x0eeb('0x4d')]=_0x0eeb('0x6f');_0x220dce=as[_0x0eeb('0x70')](_0xbd4953,_0xefafe3[_0x0eeb('0x3e')],_0x498fd8);_0x3947b2[_0x30eb7d](_0x220dce[_0x0eeb('0x71')],_0x220dce[_0x0eeb('0x69')][_0x0eeb('0x72')],_0x220dce['value'][_0x0eeb('0x1d')]);}break;case _0x0eeb('0x73'):var _0x47ca17=_0x498fd8['value'][_0x0eeb('0x6a')](',')[_0x0eeb('0x2d')](function(_0x470feb){return Number(_0x470feb);});_0x47ca17[_0x0eeb('0x31')](function(_0x384ddb){_0x28cdb9['or'](_0x0eeb('0x74'),'%,'+_0x384ddb+',%');});_0x2c2e67=_['union'](_0x2c2e67,_0x47ca17);break;case'User':if(_0x498fd8[_0x0eeb('0x67')]==='$substring'){_0x3947b2[_0x30eb7d](_0x0eeb('0x75'),'%'+_0x498fd8[_0x0eeb('0x69')]+'%',null);}else{_0xefafe3=_[_0x0eeb('0x6e')](_0x50751f,[_0x0eeb('0x41'),_0x0eeb('0x38')]);_0x498fd8[_0x0eeb('0x4d')]=_0x0eeb('0x38');_0x220dce=as[_0x0eeb('0x70')](_0xbd4953,_0xefafe3[_0x0eeb('0x3e')],_0x498fd8);_0x3947b2[_0x30eb7d](_0x220dce[_0x0eeb('0x71')],_0x220dce[_0x0eeb('0x69')][_0x0eeb('0x72')],_0x220dce[_0x0eeb('0x69')][_0x0eeb('0x1d')]);}break;case'body':_0x220dce=as[_0x0eeb('0x70')]('me',null,_0x498fd8);_0x3947b2[_0x30eb7d](_0x220dce[_0x0eeb('0x71')],_0x220dce[_0x0eeb('0x69')][_0x0eeb('0x72')],_0x220dce[_0x0eeb('0x69')][_0x0eeb('0x1d')]);break;}}else{var _0x220dce=as['buildExpression'](_0xbd4953,_0xefafe3[_0x0eeb('0x3e')],_0x498fd8);_0x3947b2[_0x30eb7d](_0x220dce[_0x0eeb('0x71')],_0x220dce[_0x0eeb('0x69')][_0x0eeb('0x72')],_0x220dce[_0x0eeb('0x69')][_0x0eeb('0x1d')]);}}}else{var _0x2f4557=_(_0x3f377e[_0x0eeb('0x42')])[_0x0eeb('0x43')]()[_0x0eeb('0x2d')](function(_0x4fb432){return _[_0x0eeb('0x76')](_0x50751f,[_0x0eeb('0x41'),_0x4fb432])?_0x4fb432:undefined;})[_0x0eeb('0x77')]()[_0x0eeb('0x69')]();if(!_['isEmpty'](_0x2f4557)){_0x2f4557[_0x0eeb('0x31')](function(_0x281d4c){if(_0x281d4c===_0x0eeb('0x78')){_0x4d9a18['where']('i.OpenchannelAccountId\x20IN\x20?',[][_0x0eeb('0x79')](_0x3f377e['query'][_0x281d4c]));}else if(_0x281d4c===_0x0eeb('0x7a')){var _0xc8bf42=JSON['parse'](_0x3f377e[_0x0eeb('0x42')][_0x281d4c])[_0x0eeb('0x7b')];var _0x5d9733=JSON[_0x0eeb('0x7c')](_0x3f377e[_0x0eeb('0x42')][_0x281d4c])[_0x0eeb('0x7d')];_0x4d9a18['where'](_0x0eeb('0x7e'),_0xc8bf42,_0x5d9733);}else{if(_0x3f377e['query'][_0x281d4c]===_0x0eeb('0x7f')){_0x4d9a18[_0x0eeb('0x80')]('i.'+_0x281d4c+_0x0eeb('0x81'));}else{_0x4d9a18[_0x0eeb('0x80')]('i.'+_0x281d4c+'\x20=\x20?',_0x3f377e['query'][_0x281d4c]);}}});}if(_0x3f377e['query'][_0x0eeb('0x82')]){if(_0x3f377e[_0x0eeb('0x42')]['read']==0x1){_0x4d9a18[_0x0eeb('0x64')](_0x0eeb('0x83'));}else{_0x4d9a18[_0x0eeb('0x64')](_0x0eeb('0x84'));}}if(_0x3f377e['query'][_0x0eeb('0x85')]){_0x2c2e67=_['isArray'](_0x3f377e[_0x0eeb('0x42')][_0x0eeb('0x85')])?_0x3f377e[_0x0eeb('0x42')][_0x0eeb('0x85')]:new Array(_0x3f377e[_0x0eeb('0x42')][_0x0eeb('0x85')]);_0x2c2e67[_0x0eeb('0x31')](function(_0x3f22c6){_0x28cdb9['or'](_0x0eeb('0x74'),'%,'+_0x3f22c6+',%');});}if(_0x3f377e['query'][_0x0eeb('0x86')]){var _0x3f4f00=_0x3f377e['query'][_0x0eeb('0x86')][_0x0eeb('0x87')]('\x5c','\x5c\x5c')[_0x0eeb('0x87')](/'/g,'\x27\x27');if(qs[_0x0eeb('0x88')](_0x3f4f00)){_0x3947b2['or'](_0x0eeb('0x89'),_0x3f4f00+'%');}else{_0x3947b2['or'](_0x0eeb('0x8a'),qs[_0x0eeb('0x6c')](_0x3f4f00))['or'](_0x0eeb('0x8b'),_0x3f4f00+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3f4f00+'%');}}}_0x4d9a18[_0x0eeb('0x80')](_0x3947b2);_0x4d9a18[_0x0eeb('0x8c')](_0x0eeb('0x8d'));var _0x4f3f85={'type':db['Sequelize'][_0x0eeb('0x8e')][_0x0eeb('0x8f')],'raw':!![]};var _0x2c5dd0=_0x4d9a18['clone']();_0x2c5dd0[_0x0eeb('0x4d')](_0x0eeb('0x8d'));_0x2c5dd0[_0x0eeb('0x4d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0eeb('0x63'));if(_0x2049ec[_0x0eeb('0x90')]){_0x2049ec[_0x0eeb('0x90')]['forEach'](function(_0x1ba084){var _0x5c625b=_0x1ba084[0x0]===_0x0eeb('0x91')?_0x1ba084[0x0]:'i.'+_0x1ba084[0x0];_0x4d9a18[_0x0eeb('0x90')](_0x5c625b,_0x1ba084[0x1]===_0x0eeb('0x92')?![]:!![]);});}if(!_[_0x0eeb('0x93')](_0x2c2e67)){_0x4d9a18[_0x0eeb('0x64')](_0x28cdb9);_0x2c5dd0[_0x0eeb('0x80')](_0x0eeb('0x94'),_0x2c2e67);}BPromise[_0x0eeb('0x95')]()[_0x0eeb('0x26')](function(){if(!_0x3e3ea1){if(_0x3f377e['query']['OpenchannelAccountId'])return;_0x2c5dd0[_0x0eeb('0x80')](_0x0eeb('0x96'));_0x4d9a18[_0x0eeb('0x80')](_0x0eeb('0x96'));return;}if(_0x3f377e[_0x0eeb('0x97')]['role']!==_0x0eeb('0x98'))return;return _0x3f377e[_0x0eeb('0x97')][_0x0eeb('0x99')]({'attributes':['id'],'raw':!![]})[_0x0eeb('0x26')](function(_0x105a1){if(_[_0x0eeb('0x93')](_0x105a1)){_0x2c5dd0[_0x0eeb('0x80')](_0x0eeb('0x9a'));_0x4d9a18[_0x0eeb('0x80')](_0x0eeb('0x9a'));}else{_0x2c5dd0[_0x0eeb('0x80')](_0x0eeb('0x9b'),_[_0x0eeb('0x2d')](_0x105a1,'id'));_0x4d9a18[_0x0eeb('0x80')](_0x0eeb('0x9b'),_[_0x0eeb('0x2d')](_0x105a1,'id'));}});})[_0x0eeb('0x26')](function(){if(_0x3f377e[_0x0eeb('0x97')][_0x0eeb('0x9c')]==='agent'&&!_0x3e3ea1&&!_0x3f377e[_0x0eeb('0x42')]['OpenchannelAccountId'])return[];return db['sequelize'][_0x0eeb('0x42')](_0x2c5dd0[_0x0eeb('0x9d')](),_0x4f3f85);})[_0x0eeb('0x26')](function(_0x507cfc){_0x3b8f00[_0x0eeb('0x22')]=_0x507cfc[_0x0eeb('0x48')];if(_0x3b8f00[_0x0eeb('0x22')]===0x0)return[];return db[_0x0eeb('0x9e')]['query'](_0x2a0228[_0x0eeb('0x9d')](),_0x4f3f85)['then'](function(_0x1d8acc){_0x319029=_[_0x0eeb('0x9f')](_0x1d8acc,'id');_0x4f3f85=_['merge'](_0x4f3f85,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3f377e[_0x0eeb('0x42')][_0x0eeb('0x47')]){_0x2049ec[_0x0eeb('0x46')][_0x0eeb('0x31')](function(_0x58f9d8){_0x4d9a18[_0x0eeb('0x4d')]('i.'+_0x58f9d8);});}else{_0x4d9a18[_0x0eeb('0x4d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0eeb('0x63'));_0x4d9a18[_0x0eeb('0x4d')](_0x0eeb('0xa0'),'Account.key');_0x4d9a18['field'](_0x0eeb('0xa1'),_0x0eeb('0xa2'));_0x4d9a18[_0x0eeb('0x4d')]('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x4d9a18[_0x0eeb('0x4d')]('i.*');_0x4d9a18['field']('c.firstName',_0x0eeb('0xa3'));_0x4d9a18[_0x0eeb('0x4d')]('c.lastName',_0x0eeb('0xa4'));_0x4d9a18['field'](_0x0eeb('0xa5'),_0x0eeb('0xa6'));_0x4d9a18[_0x0eeb('0x4d')](_0x0eeb('0xa7'),_0x0eeb('0xa8'));_0x4d9a18[_0x0eeb('0x4d')](_0x0eeb('0xa9'),'Contact.mobile');_0x4d9a18['field'](_0x0eeb('0xaa'),_0x0eeb('0xab'));_0x4d9a18[_0x0eeb('0x4d')](_0x0eeb('0xac'),'Owner.fullname');_0x4d9a18[_0x0eeb('0x4d')](_0x0eeb('0xad'),_0x0eeb('0xae'));_0x4d9a18['field'](_0x0eeb('0xaf'),_0x0eeb('0x2f'));}if(_0x2049ec['limit'])_0x4d9a18[_0x0eeb('0x21')](_0x2049ec[_0x0eeb('0x21')]);if(_0x2049ec[_0x0eeb('0x1f')])_0x4d9a18[_0x0eeb('0x1f')](_0x2049ec[_0x0eeb('0x1f')]);return db[_0x0eeb('0x9e')][_0x0eeb('0x42')](_0x4d9a18['toString'](),_0x4f3f85);})[_0x0eeb('0x26')](function(_0x1e6a52){if(_0x1e6a52[_0x0eeb('0x48')]>0x0)_0x3a8c0f[_0x0eeb('0x80')](_0x0eeb('0xb0'),_[_0x0eeb('0x2d')](_0x1e6a52,'id'));return db[_0x0eeb('0x9e')][_0x0eeb('0x42')](_0x3a8c0f[_0x0eeb('0x9d')](),_0x4f3f85)[_0x0eeb('0x26')](function(_0x16500f){var _0x20b5d0=_[_0x0eeb('0xb1')](_0x16500f,_0x0eeb('0xb2'));var _0x26aa9f=[];_0x1e6a52['forEach'](function(_0x3d5c29){_0x26aa9f['push'](updateOpenchannelInteraction(_0x3d5c29,_0x319029,_0x20b5d0));});return BPromise[_0x0eeb('0xb3')](_0x26aa9f);});});})[_0x0eeb('0x26')](function(_0x2c177e){_0x3b8f00[_0x0eeb('0xb4')]=_0x2c177e;return _0x3b8f00;})[_0x0eeb('0x26')](respondWithFilteredResult(_0x4a930a,_0x2049ec))[_0x0eeb('0x33')](handleError(_0x4a930a,null));};exports[_0x0eeb('0xb5')]=function(_0xdc3add,_0xb1580c){var _0x24eae0={};if(_0xdc3add[_0x0eeb('0x42')][_0x0eeb('0x3e')]&&_0xdc3add[_0x0eeb('0x42')][_0x0eeb('0x3e')]===_0x0eeb('0x4f')){_0x24eae0['from']=_0xdc3add[_0x0eeb('0xb6')]['id'];}else{_0x24eae0['id']=_0xdc3add[_0x0eeb('0xb6')]['id'];}var _0x463de6={'raw':![],'where':_0x24eae0},_0x3b92af={};_0x3b92af[_0x0eeb('0x40')]=_[_0x0eeb('0x43')](db['OpenchannelInteraction'][_0x0eeb('0xb7')]);_0x3b92af[_0x0eeb('0x42')]=_['keys'](_0xdc3add[_0x0eeb('0x42')]);_0x3b92af['filters']=_[_0x0eeb('0x45')](_0x3b92af['model'],_0x3b92af[_0x0eeb('0x42')]);_0x463de6['attributes']=_[_0x0eeb('0x45')](_0x3b92af['model'],qs[_0x0eeb('0x47')](_0xdc3add['query'][_0x0eeb('0x47')]));_0x463de6[_0x0eeb('0x46')]=_0x463de6[_0x0eeb('0x46')][_0x0eeb('0x48')]?_0x463de6[_0x0eeb('0x46')]:_0x3b92af['model'];if(_0xdc3add['query'][_0x0eeb('0xb8')]){_0x463de6['include']=[{'all':!![]}];}_0x463de6=_[_0x0eeb('0xb9')]({},_0x463de6,_0xdc3add[_0x0eeb('0xba')]);return db[_0x0eeb('0x3c')][_0x0eeb('0x6e')](_0x463de6)[_0x0eeb('0x26')](handleEntityNotFound(_0xb1580c,null))[_0x0eeb('0x26')](respondWithResult(_0xb1580c,null))[_0x0eeb('0x33')](handleError(_0xb1580c,null));};exports[_0x0eeb('0xbb')]=function(_0xf0b80b,_0x156f7a){return db['OpenchannelInteraction'][_0x0eeb('0xbb')](_0xf0b80b[_0x0eeb('0xbc')],{})[_0x0eeb('0x26')](respondWithResult(_0x156f7a,0xc9))[_0x0eeb('0x33')](handleError(_0x156f7a,null));};exports[_0x0eeb('0x25')]=function(_0x298d06,_0x2ebec7){if(_0x298d06['body']['id']){delete _0x298d06[_0x0eeb('0xbc')]['id'];}return db[_0x0eeb('0x3c')]['find']({'where':{'id':_0x298d06[_0x0eeb('0xb6')]['id']}})[_0x0eeb('0x26')](handleEntityNotFound(_0x2ebec7,null))['then'](saveUpdates(_0x298d06[_0x0eeb('0xbc')],null))['then'](respondWithResult(_0x2ebec7,null))['catch'](handleError(_0x2ebec7,null));};exports['destroy']=function(_0x57c702,_0x4630eb){return db[_0x0eeb('0x3c')][_0x0eeb('0x6e')]({'where':{'id':_0x57c702[_0x0eeb('0xb6')]['id']}})[_0x0eeb('0x26')](handleEntityNotFound(_0x4630eb,null))[_0x0eeb('0x26')](removeEntity(_0x4630eb,null))[_0x0eeb('0x33')](handleError(_0x4630eb,null));};exports[_0x0eeb('0xbd')]=function(_0x203b7c,_0x57f2d9){return db[_0x0eeb('0x3c')][_0x0eeb('0xbd')]()[_0x0eeb('0x26')](respondWithResult(_0x57f2d9,null))[_0x0eeb('0x33')](handleError(_0x57f2d9,null));};exports[_0x0eeb('0xbe')]=function(_0x24a76b,_0x5e849e,_0x24e3db){return db['OpenchannelMessage'][_0x0eeb('0x6e')]({'where':{'id':_0x24a76b[_0x0eeb('0xb6')]['id']}})[_0x0eeb('0x26')](handleEntityNotFound(_0x5e849e,null))['then'](function(_0x5b3e36){if(_0x5b3e36){return _0x5b3e36[_0x0eeb('0xbe')](_0x24a76b['body'][_0x0eeb('0xbf')],_['omit'](_0x24a76b[_0x0eeb('0xbc')],[_0x0eeb('0xbf'),'id'])||{});}})[_0x0eeb('0x26')](respondWithResult(_0x5e849e,null))['catch'](handleError(_0x5e849e,null));};exports[_0x0eeb('0xc0')]=function(_0x32d871,_0x19db3f,_0x54e5c9){var _0x18b803={'raw':![],'where':{}};var _0x9dfce4={};var _0x3048e={'count':0x0,'rows':[]};return db[_0x0eeb('0x3c')][_0x0eeb('0xc1')]({'where':{'id':_0x32d871['params']['id']}})['then'](handleEntityNotFound(_0x19db3f,null))[_0x0eeb('0x26')](function(_0x134bf7){if(_0x134bf7){_0x9dfce4['model']=_[_0x0eeb('0x43')](db[_0x0eeb('0xc2')][_0x0eeb('0xb7')]);_0x9dfce4[_0x0eeb('0x42')]=_['keys'](_0x32d871[_0x0eeb('0x42')]);_0x9dfce4[_0x0eeb('0x44')]=_['intersection'](_0x9dfce4[_0x0eeb('0x40')],_0x9dfce4[_0x0eeb('0x42')]);_0x18b803['attributes']=_[_0x0eeb('0x45')](_0x9dfce4[_0x0eeb('0x40')],qs[_0x0eeb('0x47')](_0x32d871[_0x0eeb('0x42')][_0x0eeb('0x47')]));_0x18b803[_0x0eeb('0x46')]=_0x18b803[_0x0eeb('0x46')]['length']?_0x18b803['attributes']:_0x9dfce4[_0x0eeb('0x40')];if(!_0x32d871[_0x0eeb('0x42')][_0x0eeb('0xc3')]('nolimit')){_0x18b803[_0x0eeb('0x21')]=qs['limit'](_0x32d871[_0x0eeb('0x42')][_0x0eeb('0x21')]);_0x18b803['offset']=qs[_0x0eeb('0x1f')](_0x32d871['query']['offset']);}_0x18b803['order']=qs[_0x0eeb('0x4a')](_0x32d871[_0x0eeb('0x42')][_0x0eeb('0x4a')]);_0x18b803[_0x0eeb('0x80')]=qs[_0x0eeb('0x44')](_[_0x0eeb('0x4b')](_0x32d871['query'],_0x9dfce4['filters']));_0x18b803['where'][_0x0eeb('0xb2')]=_0x134bf7['id'];if(_0x32d871['query'][_0x0eeb('0x86')]){_0x18b803[_0x0eeb('0x80')]=_[_0x0eeb('0xb9')](_0x18b803[_0x0eeb('0x80')],{'$or':_[_0x0eeb('0x2d')](_0x18b803[_0x0eeb('0x46')],function(_0x7de1e2){var _0x49d770={};_0x49d770[_0x7de1e2]={'$like':'%'+_0x32d871[_0x0eeb('0x42')]['filter']+'%'};return _0x49d770;})});}if(_0x32d871[_0x0eeb('0x42')][_0x0eeb('0x7b')]){var _0x25ffef=_0x32d871[_0x0eeb('0x42')]['$gte']['split'](',');var _0x37327d={};_0x37327d[_0x25ffef[0x0]]={'$gte':moment(_0x25ffef[0x1])['format'](_0x0eeb('0xc4'))};_0x18b803[_0x0eeb('0x80')]=_[_0x0eeb('0xb9')](_0x18b803['where'],_0x37327d);}_0x18b803=_['merge']({},_0x18b803,_0x32d871[_0x0eeb('0xba')]);return db['OpenchannelMessage']['count']({'where':_0x18b803[_0x0eeb('0x80')]})['then'](function(_0x279581){_0x3048e[_0x0eeb('0x22')]=_0x279581;if(_0x32d871[_0x0eeb('0x42')][_0x0eeb('0xb8')]){_0x18b803['include']=[{'all':!![]}];}return db[_0x0eeb('0xc2')]['findAll'](_0x18b803);})['then'](function(_0x565b73){_0x3048e[_0x0eeb('0xb4')]=_0x565b73;return _0x3048e;});}})[_0x0eeb('0x26')](respondWithFilteredResult(_0x19db3f,_0x18b803))[_0x0eeb('0x33')](handleError(_0x19db3f,null));};exports[_0x0eeb('0xc5')]=function(_0x5f277a,_0x4de7f0,_0x58b6b1){return db['OpenchannelInteraction']['find']({'where':{'id':_0x5f277a['params']['id']}})['then'](handleEntityNotFound(_0x4de7f0,null))[_0x0eeb('0x26')](function(_0x1a178c){if(_0x1a178c){return _0x1a178c[_0x0eeb('0xc6')](_0x5f277a[_0x0eeb('0xbc')][_0x0eeb('0xbf')],_[_0x0eeb('0xc7')](_0x5f277a['body'],[_0x0eeb('0xbf'),'id'])||{})['spread'](function(){return db[_0x0eeb('0x73')][_0x0eeb('0xc8')]({'attributes':['id','name','color'],'where':{'id':_0x5f277a[_0x0eeb('0xbc')][_0x0eeb('0xbf')]}});})['then'](function(_0x558971){socket[_0x0eeb('0xc9')](_0x0eeb('0xca'),{'id':Number(_0x5f277a[_0x0eeb('0xb6')]['id']),'tags':_0x558971||[]});return{'id':Number(_0x5f277a[_0x0eeb('0xb6')]['id']),'tags':_0x558971||[]};});}})[_0x0eeb('0x26')](respondWithResult(_0x4de7f0,null))['catch'](handleError(_0x4de7f0,null));};exports[_0x0eeb('0xcb')]=function(_0x123d56,_0x31a73c,_0x36d007){return db[_0x0eeb('0x3c')][_0x0eeb('0x6e')]({'where':{'id':_0x123d56[_0x0eeb('0xb6')]['id']}})[_0x0eeb('0x26')](handleEntityNotFound(_0x31a73c,null))[_0x0eeb('0x26')](function(_0x196436){if(_0x196436){return _0x196436['removeTags'](_0x123d56[_0x0eeb('0x42')][_0x0eeb('0xbf')]);}})[_0x0eeb('0x26')](respondWithStatusCode(_0x31a73c,null))[_0x0eeb('0x33')](handleError(_0x31a73c,null));};exports[_0x0eeb('0xcc')]=function(_0x4dd680,_0x52ab5a){var _0x561bb7=moment()[_0x0eeb('0xcd')]()['toString']();var _0xb8e706=path[_0x0eeb('0xce')](config['root'],_0x0eeb('0xcf'),'files',_0x0eeb('0xd0'));var _0x4f309f=path['join'](config[_0x0eeb('0xd1')],'server','files',_0x0eeb('0xd2'));var _0x90fcc9=path[_0x0eeb('0xce')](_0xb8e706,_0x561bb7);var _0x50c77b=util[_0x0eeb('0xd3')](_0x0eeb('0xd4'),_0x4dd680[_0x0eeb('0xb6')]['id'],_0x561bb7);var _0x466320=path[_0x0eeb('0xce')](_0xb8e706,_0x50c77b);var _0x14ab62=[];_0x14ab62['push']({'model':db[_0x0eeb('0xd5')],'as':_0x0eeb('0xd5'),'attributes':['id',_0x0eeb('0x2e')],'raw':!![]});_0x14ab62['push']({'model':db['CmContact'],'as':_0x0eeb('0xd6'),'attributes':['id',_0x0eeb('0xd7'),_0x0eeb('0xd8')],'raw':!![]});if(_0x4dd680[_0x0eeb('0x42')]['attachments']){_0x14ab62['push']({'model':db[_0x0eeb('0xd9')],'as':_0x0eeb('0xd9'),'raw':!![]});}var _0x3ec852=[{'model':db[_0x0eeb('0xc2')],'as':'Messages','attributes':['id','body',_0x0eeb('0x7a'),_0x0eeb('0xda'),_0x0eeb('0xdb'),_0x0eeb('0x82')],'include':_0x14ab62}];_0x3ec852[_0x0eeb('0x32')]({'model':db['OpenchannelAccount'],'as':_0x0eeb('0xdc'),'attributes':['id','name']});_0x3ec852[_0x0eeb('0x32')]({'model':db['User'],'as':_0x0eeb('0xdd'),'attributes':['id',_0x0eeb('0x2e')]});return db[_0x0eeb('0x3c')][_0x0eeb('0x6e')]({'where':{'id':_0x4dd680[_0x0eeb('0xb6')]['id']},'include':_0x3ec852})[_0x0eeb('0x26')](handleEntityNotFound(_0x52ab5a,null))[_0x0eeb('0x26')](function(_0x5020b8){if(_0x5020b8){var _0x479921=_0x5020b8[_0x0eeb('0xde')]({'plain':!![]});fs[_0x0eeb('0xdf')](_0x90fcc9);var _0x40e75d={'channel':_0x0eeb('0xe0'),'account':_0x479921[_0x0eeb('0xdc')][_0x0eeb('0x41')],'agent':_0x479921[_0x0eeb('0xdd')]?_0x479921[_0x0eeb('0xdd')]['fullname']:_0x0eeb('0xe1'),'createdAt':moment(_0x479921[_0x0eeb('0x7a')])[_0x0eeb('0xd3')](_0x0eeb('0xc4'))[_0x0eeb('0x9d')](),'closedAt':_0x479921[_0x0eeb('0x37')]?moment(_0x479921[_0x0eeb('0xe2')])[_0x0eeb('0xd3')](_0x0eeb('0xc4'))['toString']():'','disposition':_0x479921[_0x0eeb('0xe3')],'visibility':_0x479921[_0x0eeb('0xe4')]?_0x0eeb('0xe5'):_0x0eeb('0xe6'),'messages':_(_0x479921[_0x0eeb('0xe7')])['filter']({'secret':![]})[_0x0eeb('0x2d')](function(_0x482596){if(_0x482596[_0x0eeb('0xd9')]){var _0x2d70f4=path[_0x0eeb('0xce')](_0x4f309f,_0x482596[_0x0eeb('0xd9')][_0x0eeb('0xe8')]);if(fs[_0x0eeb('0xe9')](_0x2d70f4)){fs['createReadStream'](_0x2d70f4)[_0x0eeb('0xea')](fs[_0x0eeb('0xeb')](path['join'](_0x90fcc9,_0x482596[_0x0eeb('0xd9')][_0x0eeb('0xe8')])));}}return{'date':moment(_0x482596['createdAt'])[_0x0eeb('0xd3')](_0x0eeb('0xc4'))[_0x0eeb('0x9d')](),'sender':_0x482596['direction']==='out'?_0x482596[_0x0eeb('0xd5')]?_0x482596[_0x0eeb('0xd5')][_0x0eeb('0x2e')]:'System':_0x482596[_0x0eeb('0xd6')][_0x0eeb('0xd7')]+(_0x482596[_0x0eeb('0xd6')][_0x0eeb('0xd8')]?'\x20'+_0x482596[_0x0eeb('0xd6')][_0x0eeb('0xd8')]:''),'body':_0x482596['Attachment']?_0x482596['Attachment']['basename']:_0x482596[_0x0eeb('0xbc')],'direction':_0x482596[_0x0eeb('0xda')]===_0x0eeb('0xec')?'A':'C','secret':_0x482596['secret'],'read':_0x482596['read'],'attachment':_0x482596[_0x0eeb('0xd9')]};})[_0x0eeb('0x69')]()};return ejs[_0x0eeb('0xed')](path[_0x0eeb('0xce')](config[_0x0eeb('0xd1')],_0x0eeb('0xcf'),_0x0eeb('0xee'),_0x0eeb('0xef')),{'interaction':_0x40e75d})[_0x0eeb('0x26')](function(_0x263b73){var _0x539ef4=path[_0x0eeb('0xce')](_0x90fcc9,_0x0eeb('0xf0')+_0x479921['id']+'-'+_0x561bb7+_0x0eeb('0xf1'));var _0x5c7077={'path':_0x539ef4,'channel':_0x0eeb('0xe0'),'interactionId':_0x479921['id']};return pdf[_0x0eeb('0xf2')](_0x263b73,_0x5c7077);})[_0x0eeb('0x26')](function(){return new BPromise(function(_0x468b7f,_0x1d344f){zipdir(_0x90fcc9,{'saveTo':_0x466320},function(_0x29e2df,_0x3e60f3){if(_0x29e2df)return _0x1d344f(_0x29e2df);return _0x468b7f(_0x3e60f3);});})[_0x0eeb('0x26')](function(){return new BPromise(function(_0x3b2d87,_0x16ca4c){rimraf(_0x90fcc9,function(_0xd51051){if(_0xd51051)_0x16ca4c(_0xd51051);return _0x3b2d87();});});})[_0x0eeb('0x26')](function(){return _0x52ab5a[_0x0eeb('0xcc')](_0x466320,_0x50c77b,function(_0xf9c5d){if(_0xf9c5d){console[_0x0eeb('0xf3')](_0x0eeb('0xf4'),_0xf9c5d);}else{fs['unlinkSync'](_0x466320);}});});});}else{return _0x52ab5a[_0x0eeb('0x28')](0xc8);}})[_0x0eeb('0x33')](handleError(_0x52ab5a,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 5a2f207..43ee620 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 _0x2fac=['getUsers','setDataValue','Users','map','findAll','then','length','catch','hasOwnProperty','hook','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x4f4757,_0x44241a){var _0x549c37=function(_0x3c3cfb){while(--_0x3c3cfb){_0x4f4757['push'](_0x4f4757['shift']());}};_0x549c37(++_0x44241a);}(_0x2fac,0xd6));var _0xc2fa=function(_0x5e7896,_0x1d2617){_0x5e7896=_0x5e7896-0x0;var _0x1e6059=_0x2fac[_0x5e7896];return _0x1e6059;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0xc2fa('0x0')];var OpenchannelMessage=require(_0xc2fa('0x1'))['db'][_0xc2fa('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xc2fa('0x3')](0x0);var events={'afterCreate':_0xc2fa('0x4'),'afterUpdate':_0xc2fa('0x5'),'afterDestroy':_0xc2fa('0x6')};function emitEvent(_0x1dac50){return function(_0x36a342,_0x158a79,_0x143ea9){_0x36a342[_0xc2fa('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4d61fe){_0x36a342[_0xc2fa('0x8')](_0xc2fa('0x9'),_0x4d61fe[_0xc2fa('0xa')](function(_0x29dfc4){return{'id':_0x29dfc4['id']};}));return OpenchannelMessage[_0xc2fa('0xb')]({'where':{'OpenchannelInteractionId':_0x36a342['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc2fa('0xc')](function(_0x10fc2e){_0x36a342[_0xc2fa('0x8')]('unreadMessages',_0x10fc2e[_0xc2fa('0xd')]);OpenchannelInteractionEvents['emit'](_0x1dac50+':'+_0x36a342['id'],_0x36a342);OpenchannelInteractionEvents['emit'](_0x1dac50,_0x36a342);_0x143ea9(null);})[_0xc2fa('0xe')](_0x143ea9(null));};}for(var e in events){if(events[_0xc2fa('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xc2fa('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x7c49=['exports','../../mysqldb','OpenchannelMessage','save','update','remove','getUsers','setDataValue','Users','map','then','unreadMessages','length','emit','catch','hook'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7c49,0x121));var _0x97c4=function(_0x443027,_0x528eee){_0x443027=_0x443027-0x0;var _0x29a344=_0x7c49[_0x443027];return _0x29a344;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x97c4('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x97c4('0x0'))['db'][_0x97c4('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x97c4('0x2'),'afterUpdate':_0x97c4('0x3'),'afterDestroy':_0x97c4('0x4')};function emitEvent(_0x17b46f){return function(_0x21a287,_0x3ce1a3,_0x2641a6){_0x21a287[_0x97c4('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2ffd20){_0x21a287[_0x97c4('0x6')](_0x97c4('0x7'),_0x2ffd20[_0x97c4('0x8')](function(_0x325dff){return{'id':_0x325dff['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x21a287['id'],'direction':'in','read':![]},'raw':!![]});})[_0x97c4('0x9')](function(_0x57d53d){_0x21a287['setDataValue'](_0x97c4('0xa'),_0x57d53d[_0x97c4('0xb')]);OpenchannelInteractionEvents[_0x97c4('0xc')](_0x17b46f+':'+_0x21a287['id'],_0x21a287);OpenchannelInteractionEvents['emit'](_0x17b46f,_0x21a287);_0x2641a6(null);})[_0x97c4('0xd')](_0x2641a6(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x97c4('0xe')](e,emitEvent(event));}}module[_0x97c4('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 557dec1..cdc6166 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 _0x334f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1a8fbc,_0x42d7db){var _0x9bb3fd=function(_0x390336){while(--_0x390336){_0x1a8fbc['push'](_0x1a8fbc['shift']());}};_0x9bb3fd(++_0x42d7db);}(_0x334f,0xa2));var _0xf334=function(_0x2c6abf,_0xa6477a){_0x2c6abf=_0x2c6abf-0x0;var _0x4b1002=_0x334f[_0x2c6abf];return _0x4b1002;};'use strict';var _=require(_0xf334('0x0'));var util=require(_0xf334('0x1'));var logger=require(_0xf334('0x2'))(_0xf334('0x3'));var moment=require(_0xf334('0x4'));var BPromise=require(_0xf334('0x5'));var rp=require(_0xf334('0x6'));var fs=require('fs');var path=require(_0xf334('0x7'));var rimraf=require('rimraf');var config=require(_0xf334('0x8'));var attributes=require(_0xf334('0x9'));module[_0xf334('0xa')]=function(_0x1c946a,_0x470172){return _0x1c946a[_0xf334('0xb')](_0xf334('0xc'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf334('0xd'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x7ee6cd,_0x454afd,_0x1efad6){if(_0x7ee6cd['changed'](_0xf334('0xe'))){_0x7ee6cd[_0xf334('0xf')]=moment()[_0xf334('0x10')](_0xf334('0x11'));}_0x1efad6(null,_0x7ee6cd);}}});}; \ No newline at end of file +var _0x786b=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','utf8mb4','utf8mb4_unicode_ci','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x2eb091,_0xc8dbaa){var _0x54e641=function(_0x24f26b){while(--_0x24f26b){_0x2eb091['push'](_0x2eb091['shift']());}};_0x54e641(++_0xc8dbaa);}(_0x786b,0x164));var _0xb786=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0x786b[_0x59bcb1];return _0x4a737f;};'use strict';var _=require(_0xb786('0x0'));var util=require(_0xb786('0x1'));var logger=require(_0xb786('0x2'))(_0xb786('0x3'));var moment=require(_0xb786('0x4'));var BPromise=require(_0xb786('0x5'));var rp=require(_0xb786('0x6'));var fs=require('fs');var path=require(_0xb786('0x7'));var rimraf=require(_0xb786('0x8'));var config=require(_0xb786('0x9'));var attributes=require(_0xb786('0xa'));module['exports']=function(_0x5626a3,_0x22acaa){return _0x5626a3['define']('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb786('0xb'),'collate':_0xb786('0xc'),'hooks':{'beforeUpdate':function(_0x20980f,_0x5cee55,_0x580e62){if(_0x20980f['changed'](_0xb786('0xd'))){_0x20980f[_0xb786('0xe')]=moment()[_0xb786('0xf')](_0xb786('0x10'));}_0x580e62(null,_0x20980f);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 2c717f8..492039e 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 _0x35dd=['AddTags','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','./openchannelInteraction.socket','register','request','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','OpenchannelInteraction','update','body','options','raw','where','attributes','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','addTags','ids','omit'];(function(_0x482214,_0x2550ff){var _0x38d0cb=function(_0x2ba281){while(--_0x2ba281){_0x482214['push'](_0x482214['shift']());}};_0x38d0cb(++_0x2550ff);}(_0x35dd,0x139));var _0xd35d=function(_0x284fec,_0x5c3a8e){_0x284fec=_0x284fec-0x0;var _0x1289e8=_0x35dd[_0x284fec];return _0x1289e8;};'use strict';var _=require(_0xd35d('0x0'));var util=require(_0xd35d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd35d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd35d('0x3'))['db'];var utils=require(_0xd35d('0x4'));var logger=require('../../config/logger')(_0xd35d('0x5'));var config=require('../../config/environment');var jayson=require(_0xd35d('0x6'));var client=jayson[_0xd35d('0x7')][_0xd35d('0x8')]({'port':0x232a});config[_0xd35d('0x9')]=_['defaults'](config[_0xd35d('0x9')],{'host':_0xd35d('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd35d('0xb'))[_0xd35d('0xc')](socket);function respondWithRpcPromise(_0x1f13f2,_0x3e61ea,_0x1724dd){return new BPromise(function(_0xd50a05,_0x42824f){return client[_0xd35d('0xd')](_0x1f13f2,_0x1724dd)[_0xd35d('0xe')](function(_0x54ef17){logger[_0xd35d('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3e61ea,_0xd35d('0x10'));logger[_0xd35d('0x11')](_0xd35d('0x12'),_0x3e61ea,_0xd35d('0x10'),JSON['stringify'](_0x54ef17));if(_0x54ef17['error']){if(_0x54ef17[_0xd35d('0x13')][_0xd35d('0x14')]===0x1f4){logger[_0xd35d('0x13')](_0xd35d('0x15'),_0x3e61ea,_0x54ef17[_0xd35d('0x13')][_0xd35d('0x16')]);return _0x42824f(_0x54ef17['error'][_0xd35d('0x16')]);}logger[_0xd35d('0x13')](_0xd35d('0x15'),_0x3e61ea,_0x54ef17[_0xd35d('0x13')][_0xd35d('0x16')]);return _0xd50a05(_0x54ef17[_0xd35d('0x13')][_0xd35d('0x16')]);}else{logger['info'](_0xd35d('0x15'),_0x3e61ea,_0xd35d('0x10'));_0xd50a05(_0x54ef17[_0xd35d('0x17')][_0xd35d('0x16')]);}})[_0xd35d('0x18')](function(_0x26fa9d){logger[_0xd35d('0x13')](_0xd35d('0x15'),_0x3e61ea,_0x26fa9d);_0x42824f(_0x26fa9d);});});}exports['UpdateOpenchannelInteraction']=function(_0x1cd0c1){var _0x3619b3=this;return new Promise(function(_0x48836f,_0x5054bf){return db[_0xd35d('0x19')][_0xd35d('0x1a')](_0x1cd0c1[_0xd35d('0x1b')],{'raw':_0x1cd0c1[_0xd35d('0x1c')]?_0x1cd0c1[_0xd35d('0x1c')][_0xd35d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cd0c1[_0xd35d('0x1c')]?_0x1cd0c1['options'][_0xd35d('0x1e')]||null:null,'attributes':_0x1cd0c1[_0xd35d('0x1c')]?_0x1cd0c1[_0xd35d('0x1c')][_0xd35d('0x1f')]||null:null,'limit':_0x1cd0c1[_0xd35d('0x1c')]?_0x1cd0c1['options']['limit']||null:null})[_0xd35d('0xe')](function(_0x1dd7fe){logger[_0xd35d('0xf')](_0xd35d('0x20'),_0x1cd0c1);logger['debug'](_0xd35d('0x20'),_0x1cd0c1,JSON['stringify'](_0x1dd7fe));_0x48836f(_0x1dd7fe);})[_0xd35d('0x18')](function(_0x1be4fd){logger[_0xd35d('0x13')](_0xd35d('0x20'),_0x1be4fd['message'],_0x1cd0c1);_0x5054bf(_0x3619b3[_0xd35d('0x13')](0x1f4,_0x1be4fd[_0xd35d('0x16')]));});});};exports[_0xd35d('0x21')]=function(_0x543b70){return new Promise(function(_0x7c389c,_0x304d8a){return db[_0xd35d('0x19')][_0xd35d('0x22')]({'where':_0x543b70['options']?_0x543b70[_0xd35d('0x1c')][_0xd35d('0x1e')]||null:null})['then'](function(_0x50c58b){if(_0x50c58b){return _0x50c58b[_0xd35d('0x23')](_0x543b70[_0xd35d('0x1b')][_0xd35d('0x24')],_[_0xd35d('0x25')](_0x543b70[_0xd35d('0x1b')],[_0xd35d('0x24'),'id'])||{});}})['spread'](function(_0x802915){logger[_0xd35d('0xf')](_0xd35d('0x26'),_0x543b70);logger['debug']('AddTags',_0x543b70,JSON['stringify'](_0x802915));_0x7c389c(_0x802915);})[_0xd35d('0x18')](function(_0x5acb5c){logger[_0xd35d('0x13')](_0xd35d('0x26'),_0x5acb5c['message'],_0x543b70);_0x304d8a(_this[_0xd35d('0x13')](0x1f4,_0x5acb5c[_0xd35d('0x16')]));});});}; \ No newline at end of file +var _0xd9ea=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','where','attributes','then','find','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x25f686,_0x199629){var _0x54ad10=function(_0x1f9083){while(--_0x1f9083){_0x25f686['push'](_0x25f686['shift']());}};_0x54ad10(++_0x199629);}(_0xd9ea,0x1d2));var _0xad9e=function(_0x21f9c2,_0x2b3d2a){_0x21f9c2=_0x21f9c2-0x0;var _0x3da17f=_0xd9ea[_0x21f9c2];return _0x3da17f;};'use strict';var _=require(_0xad9e('0x0'));var util=require(_0xad9e('0x1'));var moment=require(_0xad9e('0x2'));var BPromise=require(_0xad9e('0x3'));var rs=require(_0xad9e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xad9e('0x5'));var logger=require(_0xad9e('0x6'))(_0xad9e('0x7'));var config=require(_0xad9e('0x8'));var jayson=require(_0xad9e('0x9'));var client=jayson[_0xad9e('0xa')][_0xad9e('0xb')]({'port':0x232a});config[_0xad9e('0xc')]=_[_0xad9e('0xd')](config[_0xad9e('0xc')],{'host':_0xad9e('0xe'),'port':0x18eb});var socket=require(_0xad9e('0xf'))(new Redis(config[_0xad9e('0xc')]));require('./openchannelInteraction.socket')[_0xad9e('0x10')](socket);function respondWithRpcPromise(_0x166a9f,_0x2efc15,_0xaf5329){return new BPromise(function(_0x504ed0,_0x5ab9fb){return client[_0xad9e('0x11')](_0x166a9f,_0xaf5329)['then'](function(_0x59fd0d){logger[_0xad9e('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2efc15,'request\x20sent');logger[_0xad9e('0x13')](_0xad9e('0x14'),_0x2efc15,_0xad9e('0x15'),JSON[_0xad9e('0x16')](_0x59fd0d));if(_0x59fd0d[_0xad9e('0x17')]){if(_0x59fd0d[_0xad9e('0x17')][_0xad9e('0x18')]===0x1f4){logger[_0xad9e('0x17')](_0xad9e('0x19'),_0x2efc15,_0x59fd0d[_0xad9e('0x17')][_0xad9e('0x1a')]);return _0x5ab9fb(_0x59fd0d['error'][_0xad9e('0x1a')]);}logger[_0xad9e('0x17')](_0xad9e('0x19'),_0x2efc15,_0x59fd0d[_0xad9e('0x17')]['message']);return _0x504ed0(_0x59fd0d['error'][_0xad9e('0x1a')]);}else{logger[_0xad9e('0x12')](_0xad9e('0x19'),_0x2efc15,_0xad9e('0x15'));_0x504ed0(_0x59fd0d[_0xad9e('0x1b')][_0xad9e('0x1a')]);}})[_0xad9e('0x1c')](function(_0x57f75d){logger[_0xad9e('0x17')](_0xad9e('0x19'),_0x2efc15,_0x57f75d);_0x5ab9fb(_0x57f75d);});});}exports[_0xad9e('0x1d')]=function(_0x50b855){var _0x43ddc0=this;return new Promise(function(_0x363cdb,_0x468e09){return db[_0xad9e('0x1e')][_0xad9e('0x1f')](_0x50b855['body'],{'raw':_0x50b855['options']?_0x50b855[_0xad9e('0x20')][_0xad9e('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50b855['options']?_0x50b855['options'][_0xad9e('0x22')]||null:null,'attributes':_0x50b855[_0xad9e('0x20')]?_0x50b855[_0xad9e('0x20')][_0xad9e('0x23')]||null:null,'limit':_0x50b855[_0xad9e('0x20')]?_0x50b855['options']['limit']||null:null})[_0xad9e('0x24')](function(_0x373076){logger[_0xad9e('0x12')]('UpdateOpenchannelInteraction',_0x50b855);logger[_0xad9e('0x13')](_0xad9e('0x1d'),_0x50b855,JSON[_0xad9e('0x16')](_0x373076));_0x363cdb(_0x373076);})[_0xad9e('0x1c')](function(_0x9ebaf2){logger[_0xad9e('0x17')]('UpdateOpenchannelInteraction',_0x9ebaf2[_0xad9e('0x1a')],_0x50b855);_0x468e09(_0x43ddc0[_0xad9e('0x17')](0x1f4,_0x9ebaf2[_0xad9e('0x1a')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x203b7a){return new Promise(function(_0x55a180,_0x35ca2b){return db[_0xad9e('0x1e')][_0xad9e('0x25')]({'where':_0x203b7a[_0xad9e('0x20')]?_0x203b7a[_0xad9e('0x20')][_0xad9e('0x22')]||null:null})[_0xad9e('0x24')](function(_0x55158b){if(_0x55158b){return _0x55158b[_0xad9e('0x26')](_0x203b7a[_0xad9e('0x27')]['ids'],_['omit'](_0x203b7a[_0xad9e('0x27')],[_0xad9e('0x28'),'id'])||{});}})[_0xad9e('0x29')](function(_0x2ff2dc){logger['info'](_0xad9e('0x2a'),_0x203b7a);logger[_0xad9e('0x13')](_0xad9e('0x2a'),_0x203b7a,JSON[_0xad9e('0x16')](_0x2ff2dc));_0x55a180(_0x2ff2dc);})[_0xad9e('0x1c')](function(_0x470a90){logger[_0xad9e('0x17')](_0xad9e('0x2a'),_0x470a90[_0xad9e('0x1a')],_0x203b7a);_0x35ca2b(_this['error'](0x1f4,_0x470a90['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 4a0275a..e442d05 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 _0x9b9b=['emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update'];(function(_0x28ca56,_0x4e1b4d){var _0x5de0e0=function(_0x67af8b){while(--_0x67af8b){_0x28ca56['push'](_0x28ca56['shift']());}};_0x5de0e0(++_0x4e1b4d);}(_0x9b9b,0x1ac));var _0xb9b9=function(_0x1a2581,_0x44dab6){_0x1a2581=_0x1a2581-0x0;var _0x21ef3e=_0x9b9b[_0x1a2581];return _0x21ef3e;};'use strict';var OpenchannelInteractionEvents=require(_0xb9b9('0x0'));var events=[_0xb9b9('0x1'),_0xb9b9('0x2'),_0xb9b9('0x3')];function createListener(_0x383dc5,_0x5ce153){return function(_0x42837e){_0x5ce153[_0xb9b9('0x4')](_0x383dc5,_0x42837e);};}function removeListener(_0x98e9d4,_0x58eb0e){return function(){OpenchannelInteractionEvents[_0xb9b9('0x5')](_0x98e9d4,_0x58eb0e);};}exports[_0xb9b9('0x6')]=function(_0x55fa1e){for(var _0x719f09=0x0,_0x202702=events[_0xb9b9('0x7')];_0x719f09<_0x202702;_0x719f09++){var _0x128d82=events[_0x719f09];var _0x5ea559=createListener(_0xb9b9('0x8')+_0x128d82,_0x55fa1e);OpenchannelInteractionEvents['on'](_0x128d82,_0x5ea559);}}; \ No newline at end of file +var _0xa162=['emit','removeListener','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update'];(function(_0x46639f,_0x246643){var _0x5ddfed=function(_0x382211){while(--_0x382211){_0x46639f['push'](_0x46639f['shift']());}};_0x5ddfed(++_0x246643);}(_0xa162,0x12c));var _0x2a16=function(_0x9dc35,_0x44cd54){_0x9dc35=_0x9dc35-0x0;var _0x364e52=_0xa162[_0x9dc35];return _0x364e52;};'use strict';var OpenchannelInteractionEvents=require(_0x2a16('0x0'));var events=[_0x2a16('0x1'),_0x2a16('0x2'),_0x2a16('0x3')];function createListener(_0xa79b9c,_0x364b35){return function(_0x506ee9){_0x364b35[_0x2a16('0x4')](_0xa79b9c,_0x506ee9);};}function removeListener(_0x3e3fe4,_0x58e238){return function(){OpenchannelInteractionEvents[_0x2a16('0x5')](_0x3e3fe4,_0x58e238);};}exports['register']=function(_0x5875f6){for(var _0x182589=0x0,_0x1d754b=events[_0x2a16('0x6')];_0x182589<_0x1d754b;_0x182589++){var _0x25a532=events[_0x182589];var _0xadc0ed=createListener(_0x2a16('0x7')+_0x25a532,_0x5875f6);OpenchannelInteractionEvents['on'](_0x25a532,_0xadc0ed);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 2718db2..72abc62 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 _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(_0x313c63,_0x3ee39c){var _0x37c316=function(_0x1b62c5){while(--_0x1b62c5){_0x313c63['push'](_0x313c63['shift']());}};_0x37c316(++_0x3ee39c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x70e0,0x17b));var _0x070e=function(_0x5da6d1,_0x533566){_0x5da6d1=_0x5da6d1-0x0;var _0x16cfeb=_0x70e0[_0x5da6d1];return _0x16cfeb;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 6da46ca..9870376 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 _0xd139=['BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports'];(function(_0x545d44,_0x405d26){var _0x2492d8=function(_0x4e9c6b){while(--_0x4e9c6b){_0x545d44['push'](_0x545d44['shift']());}};_0x2492d8(++_0x405d26);}(_0xd139,0x14e));var _0x9d13=function(_0x2e52bd,_0x3bbf8d){_0x2e52bd=_0x2e52bd-0x0;var _0x3e705a=_0xd139[_0x2e52bd];return _0x3e705a;};'use strict';var Sequelize=require(_0x9d13('0x0'));module[_0x9d13('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x9d13('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x9d13('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9d13('0x3')]('in',_0x9d13('0x4')),'defaultValue':_0x9d13('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x9d13('0x5')]},'providerName':{'type':Sequelize[_0x9d13('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x3014=['exports','medium','BOOLEAN','out','DATE','STRING','TEXT','sequelize'];(function(_0x41cda5,_0x3d62e8){var _0x5890a1=function(_0x22f8e7){while(--_0x22f8e7){_0x41cda5['push'](_0x41cda5['shift']());}};_0x5890a1(++_0x3d62e8);}(_0x3014,0x1d7));var _0x4301=function(_0x2a9112,_0x26bc4f){_0x2a9112=_0x2a9112-0x0;var _0x293d43=_0x3014[_0x2a9112];return _0x293d43;};'use strict';var Sequelize=require(_0x4301('0x0'));module[_0x4301('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4301('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4301('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x4301('0x4')),'defaultValue':_0x4301('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4301('0x5')]},'providerName':{'type':Sequelize[_0x4301('0x6')]},'providerResponse':{'type':Sequelize[_0x4301('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 206bc32..2b8df8a 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 _0xcb07=['AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','internal','manual','channel','event','EventManager','acceptmessage','../../config/logger','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','contact','interface','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','redis','localhost','socket.io-emitter','register','jayson/promise','client','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','set','apply','reject','update','stack','send','index','map','OpenchannelMessage','fieldName','type','name','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','filter','merge','options','count','includeAll','findAll','rows','params','rawAttributes','length','include','find','create','body','destroy','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','isNil','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null'];(function(_0x3f4769,_0xa1147){var _0x382a0a=function(_0x1b08a5){while(--_0x1b08a5){_0x3f4769['push'](_0x3f4769['shift']());}};_0x382a0a(++_0xa1147);}(_0xcb07,0x98));var _0x7cb0=function(_0x5a4400,_0xfae3b6){_0x5a4400=_0x5a4400-0x0;var _0xf9b532=_0xcb07[_0x5a4400];return _0xf9b532;};'use strict';var emlformat=require(_0x7cb0('0x0'));var rimraf=require(_0x7cb0('0x1'));var zipdir=require(_0x7cb0('0x2'));var jsonpatch=require(_0x7cb0('0x3'));var rp=require(_0x7cb0('0x4'));var moment=require('moment');var BPromise=require(_0x7cb0('0x5'));var Mustache=require(_0x7cb0('0x6'));var util=require(_0x7cb0('0x7'));var path=require('path');var sox=require(_0x7cb0('0x8'));var csv=require('to-csv');var ejs=require(_0x7cb0('0x9'));var fs=require('fs');var fs_extra=require(_0x7cb0('0xa'));var _=require('lodash');var squel=require(_0x7cb0('0xb'));var crypto=require(_0x7cb0('0xc'));var jsforce=require(_0x7cb0('0xd'));var deskjs=require(_0x7cb0('0xe'));var toCsv=require(_0x7cb0('0xf'));var querystring=require(_0x7cb0('0x10'));var Papa=require(_0x7cb0('0x11'));var Redis=require('ioredis');var authService=require(_0x7cb0('0x12'));var qs=require(_0x7cb0('0x13'));var as=require(_0x7cb0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7cb0('0x15'));var utils=require(_0x7cb0('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7cb0('0x17')]=_['defaults'](config[_0x7cb0('0x17')],{'host':_0x7cb0('0x18'),'port':0x18eb});var socket=require(_0x7cb0('0x19'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0x7cb0('0x1a')](socket);var jayson=require(_0x7cb0('0x1b'));var client=jayson[_0x7cb0('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x7cb0('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58aec0,_0x3c7578,_0x55dd62,_0x2573df){return new BPromise(function(_0x4309a3,_0x378ef9){var _0x34f163=_0x2573df||client;return _0x34f163['request'](_0x58aec0,_0x55dd62)[_0x7cb0('0x1d')](function(_0x66546f){logger[_0x7cb0('0x1e')](_0x7cb0('0x1f'),_0x3c7578,_0x7cb0('0x20'));logger[_0x7cb0('0x21')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x3c7578,_0x7cb0('0x20'),JSON[_0x7cb0('0x22')](_0x66546f));if(_0x66546f[_0x7cb0('0x23')]){if(_0x66546f['error'][_0x7cb0('0x24')]===0x1f4){logger['error'](_0x7cb0('0x1f'),_0x3c7578,_0x66546f[_0x7cb0('0x23')][_0x7cb0('0x25')]);return _0x378ef9(_0x66546f[_0x7cb0('0x23')][_0x7cb0('0x25')]);}logger[_0x7cb0('0x23')](_0x7cb0('0x1f'),_0x3c7578,_0x66546f[_0x7cb0('0x23')][_0x7cb0('0x25')]);return _0x4309a3(_0x66546f[_0x7cb0('0x23')]['message']);}else{logger[_0x7cb0('0x1e')](_0x7cb0('0x1f'),_0x3c7578,_0x7cb0('0x20'));_0x4309a3(_0x66546f[_0x7cb0('0x26')][_0x7cb0('0x25')]);}})[_0x7cb0('0x27')](function(_0x2a3c2c){logger['error'](_0x7cb0('0x1f'),_0x3c7578,_0x2a3c2c);_0x378ef9(_0x2a3c2c);});});}function respondWithStatusCode(_0x1ae7d6,_0x27d3e1){_0x27d3e1=_0x27d3e1||0xcc;return function(_0x355c1f){if(_0x355c1f){return _0x1ae7d6[_0x7cb0('0x28')](_0x27d3e1);}return _0x1ae7d6['status'](_0x27d3e1)[_0x7cb0('0x29')]();};}function respondWithResult(_0x6c38b,_0x1e0dd3){_0x1e0dd3=_0x1e0dd3||0xc8;return function(_0x4c5a04){if(_0x4c5a04){return _0x6c38b[_0x7cb0('0x2a')](_0x1e0dd3)[_0x7cb0('0x2b')](_0x4c5a04);}};}function respondWithFilteredResult(_0x14a645,_0x3676d1){return function(_0x1989af){if(_0x1989af){var _0x4006b0=typeof _0x3676d1[_0x7cb0('0x2c')]===_0x7cb0('0x2d')&&typeof _0x3676d1[_0x7cb0('0x2e')]===_0x7cb0('0x2d');var _0x152607=_0x1989af['count'];var _0x54ba78=_0x4006b0?0x0:_0x3676d1[_0x7cb0('0x2c')];var _0x744377=_0x4006b0?_0x1989af['count']:_0x3676d1['offset']+_0x3676d1[_0x7cb0('0x2e')];var _0x19057d;if(_0x744377>=_0x152607){_0x744377=_0x152607;_0x19057d=0xc8;}else{_0x19057d=0xce;}_0x14a645[_0x7cb0('0x2a')](_0x19057d);return _0x14a645[_0x7cb0('0x2f')]('Content-Range',_0x54ba78+'-'+_0x744377+'/'+_0x152607)[_0x7cb0('0x2b')](_0x1989af);}return null;};}function patchUpdates(_0x221bbd){return function(_0x40c9db){try{jsonpatch[_0x7cb0('0x30')](_0x40c9db,_0x221bbd,!![]);}catch(_0x14a717){return BPromise[_0x7cb0('0x31')](_0x14a717);}return _0x40c9db['save']();};}function saveUpdates(_0x2d6dba,_0x31326d){return function(_0x57e866){if(_0x57e866){return _0x57e866[_0x7cb0('0x32')](_0x2d6dba)['then'](function(_0x57226a){return _0x57226a;});}return null;};}function removeEntity(_0x36538f,_0x52f21a){return function(_0xe683ea){if(_0xe683ea){return _0xe683ea['destroy']()[_0x7cb0('0x1d')](function(){_0x36538f[_0x7cb0('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44b14a,_0x7bfc81){return function(_0x27725d){if(!_0x27725d){_0x44b14a[_0x7cb0('0x28')](0x194);}return _0x27725d;};}function handleError(_0x5a3bb6,_0x365cf6){_0x365cf6=_0x365cf6||0x1f4;return function(_0xa1d620){logger['error'](_0xa1d620[_0x7cb0('0x33')]);if(_0xa1d620['name']){delete _0xa1d620['name'];}_0x5a3bb6[_0x7cb0('0x2a')](_0x365cf6)[_0x7cb0('0x34')](_0xa1d620);};}exports[_0x7cb0('0x35')]=function(_0x348461,_0x5342af){var _0x32ff8f={},_0xe4417={},_0x539320={'count':0x0,'rows':[]};var _0x349f11=_[_0x7cb0('0x36')](db[_0x7cb0('0x37')]['rawAttributes'],function(_0x32d709){return{'name':_0x32d709[_0x7cb0('0x38')],'type':_0x32d709[_0x7cb0('0x39')]['key']};});_0xe4417['model']=_[_0x7cb0('0x36')](_0x349f11,_0x7cb0('0x3a'));_0xe4417[_0x7cb0('0x3b')]=_[_0x7cb0('0x3c')](_0x348461[_0x7cb0('0x3b')]);_0xe4417[_0x7cb0('0x3d')]=_[_0x7cb0('0x3e')](_0xe4417['model'],_0xe4417[_0x7cb0('0x3b')]);_0x32ff8f[_0x7cb0('0x3f')]=_[_0x7cb0('0x3e')](_0xe4417[_0x7cb0('0x40')],qs['fields'](_0x348461[_0x7cb0('0x3b')][_0x7cb0('0x41')]));_0x32ff8f[_0x7cb0('0x3f')]=_0x32ff8f['attributes']['length']?_0x32ff8f['attributes']:_0xe4417['model'];if(!_0x348461[_0x7cb0('0x3b')][_0x7cb0('0x42')]('nolimit')){_0x32ff8f[_0x7cb0('0x2e')]=qs['limit'](_0x348461['query']['limit']);_0x32ff8f['offset']=qs['offset'](_0x348461[_0x7cb0('0x3b')][_0x7cb0('0x2c')]);}_0x32ff8f[_0x7cb0('0x43')]=qs['sort'](_0x348461['query'][_0x7cb0('0x44')]);_0x32ff8f[_0x7cb0('0x45')]=qs['filters'](_['pick'](_0x348461['query'],_0xe4417['filters']),_0x349f11);if(_0x348461[_0x7cb0('0x3b')][_0x7cb0('0x46')]){_0x32ff8f[_0x7cb0('0x45')]=_[_0x7cb0('0x47')](_0x32ff8f[_0x7cb0('0x45')],{'$or':_['map'](_0x349f11,function(_0x3d50ca){if(_0x3d50ca[_0x7cb0('0x39')]!=='VIRTUAL'){var _0x1cdc32={};_0x1cdc32[_0x3d50ca[_0x7cb0('0x3a')]]={'$like':'%'+_0x348461[_0x7cb0('0x3b')]['filter']+'%'};return _0x1cdc32;}})});}_0x32ff8f=_['merge']({},_0x32ff8f,_0x348461[_0x7cb0('0x48')]);var _0x45a96a={'where':_0x32ff8f[_0x7cb0('0x45')]};return db[_0x7cb0('0x37')][_0x7cb0('0x49')](_0x45a96a)[_0x7cb0('0x1d')](function(_0x1e072b){_0x539320[_0x7cb0('0x49')]=_0x1e072b;if(_0x348461[_0x7cb0('0x3b')][_0x7cb0('0x4a')]){_0x32ff8f['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x7cb0('0x4b')](_0x32ff8f);})[_0x7cb0('0x1d')](function(_0x1f2f38){_0x539320[_0x7cb0('0x4c')]=_0x1f2f38;return _0x539320;})[_0x7cb0('0x1d')](respondWithFilteredResult(_0x5342af,_0x32ff8f))[_0x7cb0('0x27')](handleError(_0x5342af,null));};exports['show']=function(_0x233f3e,_0x5dac2c){var _0x2a3d65={'raw':!![],'where':{'id':_0x233f3e[_0x7cb0('0x4d')]['id']}},_0x20b10e={};_0x20b10e[_0x7cb0('0x40')]=_['keys'](db[_0x7cb0('0x37')][_0x7cb0('0x4e')]);_0x20b10e[_0x7cb0('0x3b')]=_[_0x7cb0('0x3c')](_0x233f3e[_0x7cb0('0x3b')]);_0x20b10e[_0x7cb0('0x3d')]=_[_0x7cb0('0x3e')](_0x20b10e[_0x7cb0('0x40')],_0x20b10e[_0x7cb0('0x3b')]);_0x2a3d65[_0x7cb0('0x3f')]=_[_0x7cb0('0x3e')](_0x20b10e[_0x7cb0('0x40')],qs[_0x7cb0('0x41')](_0x233f3e[_0x7cb0('0x3b')]['fields']));_0x2a3d65['attributes']=_0x2a3d65['attributes'][_0x7cb0('0x4f')]?_0x2a3d65[_0x7cb0('0x3f')]:_0x20b10e[_0x7cb0('0x40')];if(_0x233f3e['query'][_0x7cb0('0x4a')]){_0x2a3d65[_0x7cb0('0x50')]=[{'all':!![]}];}_0x2a3d65=_['merge']({},_0x2a3d65,_0x233f3e['options']);return db['OpenchannelMessage'][_0x7cb0('0x51')](_0x2a3d65)[_0x7cb0('0x1d')](handleEntityNotFound(_0x5dac2c,null))[_0x7cb0('0x1d')](respondWithResult(_0x5dac2c,null))[_0x7cb0('0x27')](handleError(_0x5dac2c,null));};exports[_0x7cb0('0x52')]=function(_0x2c0b91,_0x64a0d3){return db[_0x7cb0('0x37')][_0x7cb0('0x52')](_0x2c0b91[_0x7cb0('0x53')],{})[_0x7cb0('0x1d')](respondWithResult(_0x64a0d3,0xc9))[_0x7cb0('0x27')](handleError(_0x64a0d3,null));};exports[_0x7cb0('0x32')]=function(_0x5d0517,_0xd31be9){if(_0x5d0517['body']['id']){delete _0x5d0517['body']['id'];}return db[_0x7cb0('0x37')]['find']({'where':{'id':_0x5d0517[_0x7cb0('0x4d')]['id']}})[_0x7cb0('0x1d')](handleEntityNotFound(_0xd31be9,null))[_0x7cb0('0x1d')](saveUpdates(_0x5d0517[_0x7cb0('0x53')],null))['then'](respondWithResult(_0xd31be9,null))[_0x7cb0('0x27')](handleError(_0xd31be9,null));};exports[_0x7cb0('0x54')]=function(_0x530c56,_0x23b59b){return db[_0x7cb0('0x37')][_0x7cb0('0x51')]({'where':{'id':_0x530c56[_0x7cb0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x23b59b,null))['then'](removeEntity(_0x23b59b,null))[_0x7cb0('0x27')](handleError(_0x23b59b,null));};exports[_0x7cb0('0x55')]=function(_0x4e9530,_0x3eed2c){return db['OpenchannelMessage'][_0x7cb0('0x55')]()[_0x7cb0('0x1d')](respondWithResult(_0x3eed2c,null))[_0x7cb0('0x27')](handleError(_0x3eed2c,null));};var interaction_log=require('../../config/logger')(_0x7cb0('0x56'));exports[_0x7cb0('0x57')]=function(_0x5e1c7d,_0x1f8c47,_0xb55902){var _0x4a66e6={'agent':{},'channel':_0x7cb0('0x58')};if(_0x5e1c7d[_0x7cb0('0x53')]['id']){delete _0x5e1c7d[_0x7cb0('0x53')]['id'];}_0x5e1c7d['body'][_0x7cb0('0x59')]=!![];_0x5e1c7d[_0x7cb0('0x53')][_0x7cb0('0x5a')]=moment()[_0x7cb0('0x5b')](_0x7cb0('0x5c'));_0x5e1c7d[_0x7cb0('0x53')][_0x7cb0('0x5d')]=_0x5e1c7d[_0x7cb0('0x53')]['UserId']||_0x5e1c7d['user']['id'];_0x4a66e6[_0x7cb0('0x5e')]['id']=_0x5e1c7d[_0x7cb0('0x53')]['UserId'];return db[_0x7cb0('0x37')]['find']({'where':{'id':_0x5e1c7d[_0x7cb0('0x4d')]['id'],'UserId':null}})[_0x7cb0('0x1d')](handleEntityNotFound(_0x1f8c47,null))[_0x7cb0('0x1d')](saveUpdates(_0x5e1c7d[_0x7cb0('0x53')],null))[_0x7cb0('0x1d')](function(_0x44646d){if(_0x44646d){_0x4a66e6['message']=_0x44646d[_0x7cb0('0x5f')]({'plain':!![]});return db[_0x7cb0('0x60')][_0x7cb0('0x51')]({'where':{'id':_0x44646d['OpenchannelInteractionId']}});}return null;})[_0x7cb0('0x1d')](handleEntityNotFound(_0x1f8c47,null))[_0x7cb0('0x1d')](function(_0x3ab7e8){if(_0x3ab7e8){return _0x3ab7e8['update']({'UserId':_0x5e1c7d[_0x7cb0('0x53')][_0x7cb0('0x5d')],'read1stAt':_[_0x7cb0('0x61')](_0x3ab7e8[_0x7cb0('0x62')])?moment()['format'](_0x7cb0('0x5c')):undefined});}return null;})[_0x7cb0('0x1d')](function(_0x555c5f){if(_0x555c5f){_0x4a66e6['interaction']=_0x555c5f[_0x7cb0('0x5f')]({'plain':!![]});interaction_log[_0x7cb0('0x1e')](_0x7cb0('0x63'),_0x5e1c7d[_0x7cb0('0x64')]['id'],_0x5e1c7d[_0x7cb0('0x64')]['name'],_0x5e1c7d[_0x7cb0('0x64')][_0x7cb0('0x65')],_0x4a66e6[_0x7cb0('0x66')]['id'],_0x5e1c7d['body']?JSON[_0x7cb0('0x22')](_0x5e1c7d['body']):_0x7cb0('0x67'));return respondWithRpcPromise(_0x7cb0('0x68'),_0x7cb0('0x69'),_0x4a66e6);}return null;})[_0x7cb0('0x1d')](function(_0x156f20){var _0x95a124=_0x7cb0('0x6a')+_0x156f20[_0x7cb0('0x25')][_0x7cb0('0x6b')];return db[_0x7cb0('0x6c')]['query'](_0x95a124,{'type':db[_0x7cb0('0x6d')][_0x7cb0('0x6e')]['SELECT'],'raw':!![]})[_0x7cb0('0x1d')](function(_0x1fc052){return _0x1fc052;});})['then'](function(_0x23cf20){if(_0x23cf20){_0x4a66e6[_0x7cb0('0x25')]['contact']=_0x23cf20[0x0];if(!_0x5e1c7d[_0x7cb0('0x53')][_0x7cb0('0x5d')])return;return db[_0x7cb0('0x6f')][_0x7cb0('0x51')]({'where':{'id':_0x5e1c7d[_0x7cb0('0x53')][_0x7cb0('0x5d')],'role':_0x7cb0('0x5e')},'attributes':['id',_0x7cb0('0x3a'),_0x7cb0('0x70'),_0x7cb0('0x71'),_0x7cb0('0x72')],'raw':!![]});}return null;})[_0x7cb0('0x1d')](function(_0x26a6af){if(!_0x26a6af)return null;_0x4a66e6[_0x7cb0('0x25')][_0x7cb0('0x5e')]=_0x26a6af;return _0x4a66e6;})[_0x7cb0('0x1d')](function(_0x379f82){if(_0x379f82){if(_0x5e1c7d['body'][_0x7cb0('0x73')]){_0x4a66e6['message']['interface']=util[_0x7cb0('0x5b')]('SIP/%s',_0x5e1c7d[_0x7cb0('0x64')][_0x7cb0('0x3a')]);_0x4a66e6[_0x7cb0('0x25')][_0x7cb0('0x74')]=_0x4a66e6['channel'];_0x4a66e6[_0x7cb0('0x25')]['motionChannel']=_0x4a66e6[_0x7cb0('0x74')];_0x4a66e6[_0x7cb0('0x25')][_0x7cb0('0x75')]=_0x7cb0('0x57');return respondWithRpcPromise(_0x7cb0('0x76'),_0x7cb0('0x76'),{'event':_0x7cb0('0x77'),'message':_0x4a66e6[_0x7cb0('0x25')]},client9002)[_0x7cb0('0x1d')](function(){return _0x4a66e6;});}return _0x4a66e6;}return null;})[_0x7cb0('0x1d')](respondWithResult(_0x1f8c47,null))[_0x7cb0('0x27')](handleError(_0x1f8c47,null));};var interaction_log=require(_0x7cb0('0x78'))('openchannel-interactions');exports[_0x7cb0('0x31')]=function(_0x3bfbc6,_0x536b4b,_0x2d0e68){var _0x38ca03={'agent':{},'channel':_0x7cb0('0x58')};if(_0x3bfbc6[_0x7cb0('0x53')]['id']){delete _0x3bfbc6[_0x7cb0('0x53')]['id'];}_0x3bfbc6[_0x7cb0('0x53')][_0x7cb0('0x5d')]=_0x3bfbc6['body']['UserId']||_0x3bfbc6['user']['id'];_0x38ca03[_0x7cb0('0x5e')]['id']=_0x3bfbc6['body']['UserId'];return db[_0x7cb0('0x37')][_0x7cb0('0x51')]({'where':{'id':_0x3bfbc6['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x536b4b,null))[_0x7cb0('0x1d')](function(_0x538322){if(_0x538322){_0x38ca03[_0x7cb0('0x25')]=_0x538322[_0x7cb0('0x5f')]({'plain':!![]});return db['OpenchannelInteraction'][_0x7cb0('0x51')]({'where':{'id':_0x538322[_0x7cb0('0x79')]}});}return null;})['then'](handleEntityNotFound(_0x536b4b,null))[_0x7cb0('0x1d')](function(_0x491be1){if(_0x491be1){_0x38ca03[_0x7cb0('0x66')]=_0x491be1[_0x7cb0('0x5f')]({'plain':!![]});interaction_log[_0x7cb0('0x1e')](_0x7cb0('0x7a'),_0x3bfbc6[_0x7cb0('0x64')]['id'],_0x3bfbc6[_0x7cb0('0x64')]['name'],_0x3bfbc6[_0x7cb0('0x64')][_0x7cb0('0x65')],_0x38ca03[_0x7cb0('0x66')]['id'],_0x3bfbc6['body']?JSON['stringify'](_0x3bfbc6[_0x7cb0('0x53')]):'null');return respondWithRpcPromise('RejectMessage',_0x7cb0('0x7b'),_0x38ca03);}return null;})[_0x7cb0('0x1d')](function(_0x49faad){var _0x4551be=_0x7cb0('0x6a')+_0x49faad[_0x7cb0('0x25')]['ContactId'];return db[_0x7cb0('0x6c')][_0x7cb0('0x3b')](_0x4551be,{'type':db[_0x7cb0('0x6d')]['QueryTypes']['SELECT'],'raw':!![]})[_0x7cb0('0x1d')](function(_0x28529a){return _0x28529a;});})['then'](function(_0x48d93a){if(_0x48d93a){_0x38ca03[_0x7cb0('0x25')][_0x7cb0('0x7c')]=_0x48d93a[0x0];if(!_0x3bfbc6[_0x7cb0('0x53')][_0x7cb0('0x5d')])return;return db[_0x7cb0('0x6f')][_0x7cb0('0x51')]({'where':{'id':_0x3bfbc6[_0x7cb0('0x53')][_0x7cb0('0x5d')],'role':'agent'},'attributes':['id',_0x7cb0('0x3a'),'fullname',_0x7cb0('0x71'),_0x7cb0('0x72')],'raw':!![]});}return null;})[_0x7cb0('0x1d')](function(_0x2ad4cc){if(!_0x2ad4cc)return null;_0x38ca03[_0x7cb0('0x25')][_0x7cb0('0x5e')]=_0x2ad4cc;return _0x38ca03;})['then'](function(_0x1b0cad){if(_0x1b0cad){_0x1b0cad[_0x7cb0('0x25')][_0x7cb0('0x7d')]=util[_0x7cb0('0x5b')](_0x7cb0('0x7e'),_0x3bfbc6[_0x7cb0('0x64')]['name']);_0x1b0cad[_0x7cb0('0x25')][_0x7cb0('0x74')]=_0x38ca03[_0x7cb0('0x74')];_0x1b0cad['message']['motionChannel']=_0x38ca03[_0x7cb0('0x74')];_0x1b0cad[_0x7cb0('0x25')]['event']=_0x7cb0('0x31');respondWithRpcPromise(_0x7cb0('0x76'),_0x7cb0('0x76'),{'event':_0x7cb0('0x7f'),'message':_0x1b0cad[_0x7cb0('0x25')]},client9002);return _0x38ca03;}return null;})[_0x7cb0('0x1d')](respondWithResult(_0x536b4b,null))[_0x7cb0('0x27')](handleError(_0x536b4b,null));}; \ No newline at end of file +var _0xd652=['find','create','body','destroy','params','catch','describe','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','interface','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','sendStatus','name','send','map','OpenchannelMessage','fieldName','type','model','query','fields','attributes','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','show','keys','rawAttributes','intersection','length','options'];(function(_0x229396,_0x13d243){var _0x4c76a0=function(_0x289502){while(--_0x289502){_0x229396['push'](_0x229396['shift']());}};_0x4c76a0(++_0x13d243);}(_0xd652,0x1b3));var _0x2d65=function(_0x1a6363,_0x205f25){_0x1a6363=_0x1a6363-0x0;var _0xd22157=_0xd652[_0x1a6363];return _0xd22157;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d65('0x0'));var zipdir=require(_0x2d65('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2d65('0x2'));var moment=require(_0x2d65('0x3'));var BPromise=require(_0x2d65('0x4'));var Mustache=require(_0x2d65('0x5'));var util=require(_0x2d65('0x6'));var path=require(_0x2d65('0x7'));var sox=require(_0x2d65('0x8'));var csv=require('to-csv');var ejs=require(_0x2d65('0x9'));var fs=require('fs');var fs_extra=require(_0x2d65('0xa'));var _=require(_0x2d65('0xb'));var squel=require(_0x2d65('0xc'));var crypto=require(_0x2d65('0xd'));var jsforce=require(_0x2d65('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2d65('0xf'));var Papa=require(_0x2d65('0x10'));var Redis=require(_0x2d65('0x11'));var authService=require(_0x2d65('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2d65('0x13'));var hardwareService=require(_0x2d65('0x14'));var logger=require('../../config/logger')(_0x2d65('0x15'));var utils=require(_0x2d65('0x16'));var config=require(_0x2d65('0x17'));var licenseUtil=require(_0x2d65('0x18'));var db=require(_0x2d65('0x19'))['db'];config['redis']=_[_0x2d65('0x1a')](config['redis'],{'host':_0x2d65('0x1b'),'port':0x18eb});var socket=require(_0x2d65('0x1c'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x2d65('0x1d')][_0x2d65('0x1e')]({'port':0x232c});var client9002=jayson[_0x2d65('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41f965,_0x5eef9e,_0x17ba1c,_0x10aa68){return new BPromise(function(_0x4e80ae,_0x284c21){var _0x26ecfd=_0x10aa68||client;return _0x26ecfd[_0x2d65('0x1f')](_0x41f965,_0x17ba1c)[_0x2d65('0x20')](function(_0x3de933){logger['info'](_0x2d65('0x21'),_0x5eef9e,_0x2d65('0x22'));logger[_0x2d65('0x23')](_0x2d65('0x24'),_0x5eef9e,'request\x20sent',JSON[_0x2d65('0x25')](_0x3de933));if(_0x3de933[_0x2d65('0x26')]){if(_0x3de933['error'][_0x2d65('0x27')]===0x1f4){logger['error'](_0x2d65('0x21'),_0x5eef9e,_0x3de933[_0x2d65('0x26')]['message']);return _0x284c21(_0x3de933['error'][_0x2d65('0x28')]);}logger[_0x2d65('0x26')](_0x2d65('0x21'),_0x5eef9e,_0x3de933[_0x2d65('0x26')][_0x2d65('0x28')]);return _0x4e80ae(_0x3de933['error'][_0x2d65('0x28')]);}else{logger[_0x2d65('0x29')](_0x2d65('0x21'),_0x5eef9e,_0x2d65('0x22'));_0x4e80ae(_0x3de933[_0x2d65('0x2a')]['message']);}})['catch'](function(_0x1fe744){logger[_0x2d65('0x26')](_0x2d65('0x21'),_0x5eef9e,_0x1fe744);_0x284c21(_0x1fe744);});});}function respondWithStatusCode(_0x196ddc,_0xab3393){_0xab3393=_0xab3393||0xcc;return function(_0x5558d2){if(_0x5558d2){return _0x196ddc['sendStatus'](_0xab3393);}return _0x196ddc['status'](_0xab3393)[_0x2d65('0x2b')]();};}function respondWithResult(_0x1b5670,_0xdaeb6b){_0xdaeb6b=_0xdaeb6b||0xc8;return function(_0x1b35ab){if(_0x1b35ab){return _0x1b5670['status'](_0xdaeb6b)[_0x2d65('0x2c')](_0x1b35ab);}};}function respondWithFilteredResult(_0x57fe53,_0x45075b){return function(_0x40ac03){if(_0x40ac03){var _0x5ea182=typeof _0x45075b['offset']===_0x2d65('0x2d')&&typeof _0x45075b[_0x2d65('0x2e')]===_0x2d65('0x2d');var _0x3ea36c=_0x40ac03['count'];var _0x35939b=_0x5ea182?0x0:_0x45075b['offset'];var _0x3984e9=_0x5ea182?_0x40ac03[_0x2d65('0x2f')]:_0x45075b[_0x2d65('0x30')]+_0x45075b[_0x2d65('0x2e')];var _0x44a0a8;if(_0x3984e9>=_0x3ea36c){_0x3984e9=_0x3ea36c;_0x44a0a8=0xc8;}else{_0x44a0a8=0xce;}_0x57fe53[_0x2d65('0x31')](_0x44a0a8);return _0x57fe53[_0x2d65('0x32')](_0x2d65('0x33'),_0x35939b+'-'+_0x3984e9+'/'+_0x3ea36c)[_0x2d65('0x2c')](_0x40ac03);}return null;};}function patchUpdates(_0xc1fcfb){return function(_0x17f651){try{jsonpatch[_0x2d65('0x34')](_0x17f651,_0xc1fcfb,!![]);}catch(_0x4406e){return BPromise[_0x2d65('0x35')](_0x4406e);}return _0x17f651[_0x2d65('0x36')]();};}function saveUpdates(_0x977ca4,_0x52a9e3){return function(_0xf274f3){if(_0xf274f3){return _0xf274f3[_0x2d65('0x37')](_0x977ca4)[_0x2d65('0x20')](function(_0x230318){return _0x230318;});}return null;};}function removeEntity(_0x11300a,_0x476009){return function(_0x5a3c32){if(_0x5a3c32){return _0x5a3c32['destroy']()[_0x2d65('0x20')](function(){_0x11300a[_0x2d65('0x31')](0xcc)[_0x2d65('0x2b')]();});}};}function handleEntityNotFound(_0x2d49fa,_0x552751){return function(_0x9c4c67){if(!_0x9c4c67){_0x2d49fa[_0x2d65('0x38')](0x194);}return _0x9c4c67;};}function handleError(_0x202e03,_0x4496b4){_0x4496b4=_0x4496b4||0x1f4;return function(_0x43b6ef){logger[_0x2d65('0x26')](_0x43b6ef['stack']);if(_0x43b6ef[_0x2d65('0x39')]){delete _0x43b6ef[_0x2d65('0x39')];}_0x202e03['status'](_0x4496b4)[_0x2d65('0x3a')](_0x43b6ef);};}exports['index']=function(_0x45858d,_0x409ae6){var _0x10b4cb={},_0xd13455={},_0x1958b2={'count':0x0,'rows':[]};var _0x381c31=_[_0x2d65('0x3b')](db[_0x2d65('0x3c')]['rawAttributes'],function(_0x36e624){return{'name':_0x36e624[_0x2d65('0x3d')],'type':_0x36e624[_0x2d65('0x3e')]['key']};});_0xd13455[_0x2d65('0x3f')]=_[_0x2d65('0x3b')](_0x381c31,_0x2d65('0x39'));_0xd13455[_0x2d65('0x40')]=_['keys'](_0x45858d['query']);_0xd13455['filters']=_['intersection'](_0xd13455[_0x2d65('0x3f')],_0xd13455[_0x2d65('0x40')]);_0x10b4cb['attributes']=_['intersection'](_0xd13455[_0x2d65('0x3f')],qs[_0x2d65('0x41')](_0x45858d[_0x2d65('0x40')]['fields']));_0x10b4cb['attributes']=_0x10b4cb[_0x2d65('0x42')]['length']?_0x10b4cb[_0x2d65('0x42')]:_0xd13455[_0x2d65('0x3f')];if(!_0x45858d['query']['hasOwnProperty'](_0x2d65('0x43'))){_0x10b4cb['limit']=qs[_0x2d65('0x2e')](_0x45858d['query'][_0x2d65('0x2e')]);_0x10b4cb[_0x2d65('0x30')]=qs[_0x2d65('0x30')](_0x45858d[_0x2d65('0x40')]['offset']);}_0x10b4cb[_0x2d65('0x44')]=qs[_0x2d65('0x45')](_0x45858d['query']['sort']);_0x10b4cb[_0x2d65('0x46')]=qs[_0x2d65('0x47')](_[_0x2d65('0x48')](_0x45858d['query'],_0xd13455[_0x2d65('0x47')]),_0x381c31);if(_0x45858d[_0x2d65('0x40')][_0x2d65('0x49')]){_0x10b4cb[_0x2d65('0x46')]=_['merge'](_0x10b4cb[_0x2d65('0x46')],{'$or':_[_0x2d65('0x3b')](_0x381c31,function(_0x50af35){if(_0x50af35[_0x2d65('0x3e')]!==_0x2d65('0x4a')){var _0x70aa4c={};_0x70aa4c[_0x50af35[_0x2d65('0x39')]]={'$like':'%'+_0x45858d['query'][_0x2d65('0x49')]+'%'};return _0x70aa4c;}})});}_0x10b4cb=_[_0x2d65('0x4b')]({},_0x10b4cb,_0x45858d['options']);var _0x4e8221={'where':_0x10b4cb[_0x2d65('0x46')]};return db[_0x2d65('0x3c')][_0x2d65('0x2f')](_0x4e8221)[_0x2d65('0x20')](function(_0x50404c){_0x1958b2['count']=_0x50404c;if(_0x45858d[_0x2d65('0x40')][_0x2d65('0x4c')]){_0x10b4cb['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0x2d65('0x4d')](_0x10b4cb);})['then'](function(_0x50472c){_0x1958b2[_0x2d65('0x4e')]=_0x50472c;return _0x1958b2;})[_0x2d65('0x20')](respondWithFilteredResult(_0x409ae6,_0x10b4cb))['catch'](handleError(_0x409ae6,null));};exports[_0x2d65('0x4f')]=function(_0xb95258,_0x59bbf8){var _0x14e327={'raw':!![],'where':{'id':_0xb95258['params']['id']}},_0x50aedd={};_0x50aedd['model']=_[_0x2d65('0x50')](db[_0x2d65('0x3c')][_0x2d65('0x51')]);_0x50aedd[_0x2d65('0x40')]=_[_0x2d65('0x50')](_0xb95258[_0x2d65('0x40')]);_0x50aedd[_0x2d65('0x47')]=_[_0x2d65('0x52')](_0x50aedd['model'],_0x50aedd[_0x2d65('0x40')]);_0x14e327[_0x2d65('0x42')]=_[_0x2d65('0x52')](_0x50aedd[_0x2d65('0x3f')],qs['fields'](_0xb95258[_0x2d65('0x40')][_0x2d65('0x41')]));_0x14e327[_0x2d65('0x42')]=_0x14e327[_0x2d65('0x42')][_0x2d65('0x53')]?_0x14e327['attributes']:_0x50aedd[_0x2d65('0x3f')];if(_0xb95258[_0x2d65('0x40')][_0x2d65('0x4c')]){_0x14e327['include']=[{'all':!![]}];}_0x14e327=_['merge']({},_0x14e327,_0xb95258[_0x2d65('0x54')]);return db[_0x2d65('0x3c')][_0x2d65('0x55')](_0x14e327)[_0x2d65('0x20')](handleEntityNotFound(_0x59bbf8,null))['then'](respondWithResult(_0x59bbf8,null))['catch'](handleError(_0x59bbf8,null));};exports[_0x2d65('0x56')]=function(_0x2fbf94,_0x2edf08){return db[_0x2d65('0x3c')][_0x2d65('0x56')](_0x2fbf94[_0x2d65('0x57')],{})[_0x2d65('0x20')](respondWithResult(_0x2edf08,0xc9))['catch'](handleError(_0x2edf08,null));};exports[_0x2d65('0x37')]=function(_0x57f905,_0x9bbe20){if(_0x57f905['body']['id']){delete _0x57f905['body']['id'];}return db[_0x2d65('0x3c')]['find']({'where':{'id':_0x57f905['params']['id']}})[_0x2d65('0x20')](handleEntityNotFound(_0x9bbe20,null))[_0x2d65('0x20')](saveUpdates(_0x57f905['body'],null))[_0x2d65('0x20')](respondWithResult(_0x9bbe20,null))['catch'](handleError(_0x9bbe20,null));};exports[_0x2d65('0x58')]=function(_0x3c5bea,_0x6f6f33){return db['OpenchannelMessage'][_0x2d65('0x55')]({'where':{'id':_0x3c5bea[_0x2d65('0x59')]['id']}})[_0x2d65('0x20')](handleEntityNotFound(_0x6f6f33,null))['then'](removeEntity(_0x6f6f33,null))[_0x2d65('0x5a')](handleError(_0x6f6f33,null));};exports[_0x2d65('0x5b')]=function(_0xab28c2,_0xf207f8){return db[_0x2d65('0x3c')][_0x2d65('0x5b')]()[_0x2d65('0x20')](respondWithResult(_0xf207f8,null))['catch'](handleError(_0xf207f8,null));};var interaction_log=require('../../config/logger')(_0x2d65('0x5c'));exports[_0x2d65('0x5d')]=function(_0x4232b2,_0x31862f,_0x13a94e){var _0x5b7ebd={'agent':{},'channel':_0x2d65('0x5e')};if(_0x4232b2[_0x2d65('0x57')]['id']){delete _0x4232b2[_0x2d65('0x57')]['id'];}_0x4232b2[_0x2d65('0x57')]['read']=!![];_0x4232b2[_0x2d65('0x57')][_0x2d65('0x5f')]=moment()[_0x2d65('0x60')](_0x2d65('0x61'));_0x4232b2[_0x2d65('0x57')]['UserId']=_0x4232b2['body'][_0x2d65('0x62')]||_0x4232b2[_0x2d65('0x63')]['id'];_0x5b7ebd[_0x2d65('0x64')]['id']=_0x4232b2[_0x2d65('0x57')][_0x2d65('0x62')];return db['OpenchannelMessage'][_0x2d65('0x55')]({'where':{'id':_0x4232b2[_0x2d65('0x59')]['id'],'UserId':null}})[_0x2d65('0x20')](handleEntityNotFound(_0x31862f,null))[_0x2d65('0x20')](saveUpdates(_0x4232b2['body'],null))[_0x2d65('0x20')](function(_0x266c88){if(_0x266c88){_0x5b7ebd[_0x2d65('0x28')]=_0x266c88[_0x2d65('0x65')]({'plain':!![]});return db[_0x2d65('0x66')][_0x2d65('0x55')]({'where':{'id':_0x266c88[_0x2d65('0x67')]}});}return null;})[_0x2d65('0x20')](handleEntityNotFound(_0x31862f,null))[_0x2d65('0x20')](function(_0x1eb730){if(_0x1eb730){return _0x1eb730['update']({'UserId':_0x4232b2[_0x2d65('0x57')][_0x2d65('0x62')],'read1stAt':_[_0x2d65('0x68')](_0x1eb730[_0x2d65('0x69')])?moment()[_0x2d65('0x60')](_0x2d65('0x61')):undefined});}return null;})[_0x2d65('0x20')](function(_0x46b91c){if(_0x46b91c){_0x5b7ebd[_0x2d65('0x6a')]=_0x46b91c[_0x2d65('0x65')]({'plain':!![]});interaction_log[_0x2d65('0x29')](_0x2d65('0x6b'),_0x4232b2[_0x2d65('0x63')]['id'],_0x4232b2['user'][_0x2d65('0x39')],_0x4232b2[_0x2d65('0x63')]['role'],_0x5b7ebd[_0x2d65('0x6a')]['id'],_0x4232b2[_0x2d65('0x57')]?JSON[_0x2d65('0x25')](_0x4232b2[_0x2d65('0x57')]):_0x2d65('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x2d65('0x6d'),_0x5b7ebd);}return null;})[_0x2d65('0x20')](function(_0x27b3bb){var _0x51c664=_0x2d65('0x6e')+_0x27b3bb['message'][_0x2d65('0x6f')];return db['sequelize'][_0x2d65('0x40')](_0x51c664,{'type':db[_0x2d65('0x70')]['QueryTypes'][_0x2d65('0x71')],'raw':!![]})[_0x2d65('0x20')](function(_0x4444a8){return _0x4444a8;});})[_0x2d65('0x20')](function(_0x291e37){if(_0x291e37){_0x5b7ebd[_0x2d65('0x28')][_0x2d65('0x72')]=_0x291e37[0x0];if(!_0x4232b2['body'][_0x2d65('0x62')])return;return db['User'][_0x2d65('0x55')]({'where':{'id':_0x4232b2[_0x2d65('0x57')][_0x2d65('0x62')],'role':'agent'},'attributes':['id',_0x2d65('0x39'),_0x2d65('0x73'),_0x2d65('0x74'),_0x2d65('0x75')],'raw':!![]});}return null;})[_0x2d65('0x20')](function(_0x53a393){if(!_0x53a393)return null;_0x5b7ebd[_0x2d65('0x28')][_0x2d65('0x64')]=_0x53a393;return _0x5b7ebd;})[_0x2d65('0x20')](function(_0xe03419){if(_0xe03419){if(_0x4232b2[_0x2d65('0x57')][_0x2d65('0x76')]){_0x5b7ebd[_0x2d65('0x28')]['interface']=util[_0x2d65('0x60')](_0x2d65('0x77'),_0x4232b2[_0x2d65('0x63')][_0x2d65('0x39')]);_0x5b7ebd['message'][_0x2d65('0x78')]=_0x5b7ebd[_0x2d65('0x78')];_0x5b7ebd[_0x2d65('0x28')][_0x2d65('0x79')]=_0x5b7ebd[_0x2d65('0x78')];_0x5b7ebd[_0x2d65('0x28')][_0x2d65('0x7a')]=_0x2d65('0x5d');return respondWithRpcPromise(_0x2d65('0x7b'),_0x2d65('0x7b'),{'event':_0x2d65('0x7c'),'message':_0x5b7ebd['message']},client9002)[_0x2d65('0x20')](function(){return _0x5b7ebd;});}return _0x5b7ebd;}return null;})[_0x2d65('0x20')](respondWithResult(_0x31862f,null))[_0x2d65('0x5a')](handleError(_0x31862f,null));};var interaction_log=require('../../config/logger')(_0x2d65('0x5c'));exports[_0x2d65('0x35')]=function(_0x3bd155,_0x150f31,_0x11fa68){var _0x23d3f9={'agent':{},'channel':_0x2d65('0x5e')};if(_0x3bd155['body']['id']){delete _0x3bd155['body']['id'];}_0x3bd155[_0x2d65('0x57')][_0x2d65('0x62')]=_0x3bd155[_0x2d65('0x57')][_0x2d65('0x62')]||_0x3bd155[_0x2d65('0x63')]['id'];_0x23d3f9[_0x2d65('0x64')]['id']=_0x3bd155[_0x2d65('0x57')][_0x2d65('0x62')];return db['OpenchannelMessage']['find']({'where':{'id':_0x3bd155['params']['id'],'UserId':null}})[_0x2d65('0x20')](handleEntityNotFound(_0x150f31,null))[_0x2d65('0x20')](function(_0x6bd142){if(_0x6bd142){_0x23d3f9[_0x2d65('0x28')]=_0x6bd142[_0x2d65('0x65')]({'plain':!![]});return db[_0x2d65('0x66')]['find']({'where':{'id':_0x6bd142[_0x2d65('0x67')]}});}return null;})[_0x2d65('0x20')](handleEntityNotFound(_0x150f31,null))[_0x2d65('0x20')](function(_0x5de665){if(_0x5de665){_0x23d3f9['interaction']=_0x5de665[_0x2d65('0x65')]({'plain':!![]});interaction_log[_0x2d65('0x29')](_0x2d65('0x7d'),_0x3bd155[_0x2d65('0x63')]['id'],_0x3bd155[_0x2d65('0x63')]['name'],_0x3bd155[_0x2d65('0x63')][_0x2d65('0x7e')],_0x23d3f9[_0x2d65('0x6a')]['id'],_0x3bd155[_0x2d65('0x57')]?JSON[_0x2d65('0x25')](_0x3bd155['body']):_0x2d65('0x6c'));return respondWithRpcPromise(_0x2d65('0x7f'),_0x2d65('0x80'),_0x23d3f9);}return null;})[_0x2d65('0x20')](function(_0x230807){var _0x3185ec=_0x2d65('0x6e')+_0x230807[_0x2d65('0x28')][_0x2d65('0x6f')];return db['sequelize'][_0x2d65('0x40')](_0x3185ec,{'type':db[_0x2d65('0x70')]['QueryTypes']['SELECT'],'raw':!![]})[_0x2d65('0x20')](function(_0x2ad804){return _0x2ad804;});})[_0x2d65('0x20')](function(_0x11f819){if(_0x11f819){_0x23d3f9[_0x2d65('0x28')][_0x2d65('0x72')]=_0x11f819[0x0];if(!_0x3bd155[_0x2d65('0x57')][_0x2d65('0x62')])return;return db['User'][_0x2d65('0x55')]({'where':{'id':_0x3bd155[_0x2d65('0x57')]['UserId'],'role':'agent'},'attributes':['id',_0x2d65('0x39'),'fullname',_0x2d65('0x74'),_0x2d65('0x75')],'raw':!![]});}return null;})[_0x2d65('0x20')](function(_0x34037a){if(!_0x34037a)return null;_0x23d3f9[_0x2d65('0x28')]['agent']=_0x34037a;return _0x23d3f9;})[_0x2d65('0x20')](function(_0x266a56){if(_0x266a56){_0x266a56['message'][_0x2d65('0x81')]=util['format'](_0x2d65('0x77'),_0x3bd155[_0x2d65('0x63')][_0x2d65('0x39')]);_0x266a56[_0x2d65('0x28')][_0x2d65('0x78')]=_0x23d3f9[_0x2d65('0x78')];_0x266a56[_0x2d65('0x28')][_0x2d65('0x79')]=_0x23d3f9['channel'];_0x266a56[_0x2d65('0x28')][_0x2d65('0x7a')]=_0x2d65('0x35');respondWithRpcPromise(_0x2d65('0x7b'),_0x2d65('0x7b'),{'event':'rejectmessage','message':_0x266a56[_0x2d65('0x28')]},client9002);return _0x23d3f9;}return null;})[_0x2d65('0x20')](respondWithResult(_0x150f31,null))[_0x2d65('0x5a')](handleError(_0x150f31,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index ccbfb44..2b6ddab 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 _0x1cc0=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0x45bd84,_0x4a61bb){var _0x551b62=function(_0x3b03cf){while(--_0x3b03cf){_0x45bd84['push'](_0x45bd84['shift']());}};_0x551b62(++_0x4a61bb);}(_0x1cc0,0x87));var _0x01cc=function(_0x206900,_0x1f0b46){_0x206900=_0x206900-0x0;var _0x3f442a=_0x1cc0[_0x206900];return _0x3f442a;};'use strict';var EventEmitter=require(_0x01cc('0x0'));var OpenchannelMessage=require(_0x01cc('0x1'))['db'][_0x01cc('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x01cc('0x3')](0x0);var events={'afterCreate':_0x01cc('0x4'),'afterUpdate':_0x01cc('0x5'),'afterDestroy':_0x01cc('0x6')};function emitEvent(_0xc0ead5){return function(_0x33810a,_0x4fa585,_0xe84d0c){OpenchannelMessageEvents[_0x01cc('0x7')](_0xc0ead5+':'+_0x33810a['id'],_0x33810a);OpenchannelMessageEvents[_0x01cc('0x7')](_0xc0ead5,_0x33810a);_0xe84d0c(null);};}for(var e in events){if(events[_0x01cc('0x8')](e)){var event=events[e];OpenchannelMessage[_0x01cc('0x9')](e,emitEvent(event));}}module[_0x01cc('0xa')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x251f=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','save','update','emit'];(function(_0x1521be,_0x34aa83){var _0x156a8e=function(_0x1b803c){while(--_0x1b803c){_0x1521be['push'](_0x1521be['shift']());}};_0x156a8e(++_0x34aa83);}(_0x251f,0x111));var _0xf251=function(_0x38223f,_0x3a0dfc){_0x38223f=_0x38223f-0x0;var _0x3e3fab=_0x251f[_0x38223f];return _0x3e3fab;};'use strict';var EventEmitter=require(_0xf251('0x0'));var OpenchannelMessage=require(_0xf251('0x1'))['db'][_0xf251('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf251('0x3'),'afterUpdate':_0xf251('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5731a0){return function(_0x357c5e,_0x673017,_0x21945a){OpenchannelMessageEvents[_0xf251('0x5')](_0x5731a0+':'+_0x357c5e['id'],_0x357c5e);OpenchannelMessageEvents[_0xf251('0x5')](_0x5731a0,_0x357c5e);_0x21945a(null);};}for(var e in events){if(events[_0xf251('0x6')](e)){var event=events[e];OpenchannelMessage[_0xf251('0x7')](e,emitEvent(event));}}module[_0xf251('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 0099546..2d94440 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 _0x03fa=['path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','secret','isNil','UserId','OpenchannelInteraction','findOne','createdAt','error','out','OpenchannelAccount','find','OpenchannelAccountId','Interactions','CmContact','then','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','Interaction','omit','Contact','method','GET','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','catch','finally','utf8mb4','utf8mb4_unicode_ci','api'];(function(_0x3dc94d,_0x42fbd4){var _0x589a52=function(_0x8102b2){while(--_0x8102b2){_0x3dc94d['push'](_0x3dc94d['shift']());}};_0x589a52(++_0x42fbd4);}(_0x03fa,0x1c1));var _0xa03f=function(_0x324c5d,_0x4c536c){_0x324c5d=_0x324c5d-0x0;var _0xf09dfa=_0x03fa[_0x324c5d];return _0xf09dfa;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa03f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa03f('0x1'));var rimraf=require(_0xa03f('0x2'));var config=require(_0xa03f('0x3'));var attributes=require(_0xa03f('0x4'));module[_0xa03f('0x5')]=function(_0x17e5f0,_0x40b47a){return _0x17e5f0['define']('OpenchannelMessage',attributes,{'tableName':_0xa03f('0x6'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0xa03f('0x7')],'type':_0xa03f('0x8')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x207c34,_0x24db93,_0xa4d2c4){var _0x169979=_0x17e5f0[_0xa03f('0x9')];var _0x6b7e11=_0x207c34[_0xa03f('0xa')]({'plain':!![]});if(_0x6b7e11['direction'][_0xa03f('0xb')]()==='in'||_0x6b7e11[_0xa03f('0xc')][_0xa03f('0xb')]()==='out'&&!_0x6b7e11[_0xa03f('0xd')]&&!_[_0xa03f('0xe')](_0x6b7e11[_0xa03f('0xf')])){_0x169979[_0xa03f('0x10')][_0xa03f('0x11')]({'where':{'id':_0x6b7e11['OpenchannelInteractionId']}})['then'](function(_0x146ce4){if(_0x146ce4){_0x146ce4['update']({'lastMsgAt':_0x6b7e11[_0xa03f('0x12')],'lastMsgDirection':_0x6b7e11[_0xa03f('0xc')][_0xa03f('0xb')]()});}})['catch'](function(_0x54d645){console[_0xa03f('0x13')](_0x54d645);});}if(_0x6b7e11[_0xa03f('0xc')]===_0xa03f('0x14')&&!_0x6b7e11[_0xa03f('0xd')]){var _0x4fbada;_0x169979['CmContact']['describe']()['then'](function(_0x3d4240){return _0x169979[_0xa03f('0x15')][_0xa03f('0x16')]({'where':{'id':_0x6b7e11[_0xa03f('0x17')]},'include':[{'model':_0x169979['OpenchannelInteraction'],'as':_0xa03f('0x18'),'where':{'id':_0x6b7e11['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x169979[_0xa03f('0x19')],'as':'Contact','attributes':_['keys'](_0x3d4240)}]}]});})[_0xa03f('0x1a')](function(_0x56598e){_0x4fbada=_0x56598e[_0xa03f('0xa')]({'plain':!![]});if(_0x4fbada&&_0x4fbada['replyUri']){logger['info'](_0xa03f('0x1b'),_0xa03f('0x1c'),util[_0xa03f('0x1d')](_0xa03f('0x1e'),_0x6b7e11['id'],_0x4fbada[_0xa03f('0x1f')]));if(_0x4fbada[_0xa03f('0x18')]&&_0x4fbada[_0xa03f('0x18')]['length']){_0x6b7e11[_0xa03f('0x20')]=_[_0xa03f('0x21')](_0x4fbada['Interactions'][0x0],_0xa03f('0x22'));_0x6b7e11[_0xa03f('0x22')]=_0x4fbada[_0xa03f('0x18')][0x0][_0xa03f('0x22')];}var _0x24db93={'method':'POST','uri':encodeURI(_0x4fbada[_0xa03f('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x24db93[_0xa03f('0x23')]){case _0xa03f('0x24'):_0x24db93['qs']=_0x6b7e11;break;case'POST':_0x24db93['body']=_0x6b7e11;break;}return rp(_0x24db93)[_0xa03f('0x1a')](function(_0x10e161){logger[_0xa03f('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0xa03f('0x1c'),util['format'](_0xa03f('0x26'),_0x6b7e11['id'],_0x4fbada[_0xa03f('0x1f')]));if(_0x10e161[_0xa03f('0x7')]['threadId']&&_0x10e161[_0xa03f('0x7')][_0xa03f('0x27')]!=_0x6b7e11[_0xa03f('0x20')][_0xa03f('0x27')]){return _0x169979[_0xa03f('0x10')][_0xa03f('0x28')]({'threadId':_0x10e161[_0xa03f('0x7')]['threadId']},{'where':{'id':_0x6b7e11['Interaction']['id']}});}else{return;}})[_0xa03f('0x1a')](function(){return _0x207c34[_0xa03f('0x28')]({'read':!![]});})[_0xa03f('0x29')](function(_0x16484f){logger['error'](_0xa03f('0x1b'),'afterCreate',util['inspect'](_0x16484f,{'showHidden':![],'depth':null}));_0xa4d2c4();});}else{_0xa4d2c4();}})[_0xa03f('0x2a')](function(){_0xa4d2c4();});}else{_0xa4d2c4();}}},'charset':_0xa03f('0x2b'),'collate':_0xa03f('0x2c')});}; \ No newline at end of file +var _0x4d98=['finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','toLowerCase','direction','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','error','OpenchannelAccount','find','Interactions','CmContact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','omit','Contact','method','GET','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction'];(function(_0x4d79bc,_0x32c905){var _0x4b4760=function(_0x212302){while(--_0x212302){_0x4d79bc['push'](_0x4d79bc['shift']());}};_0x4b4760(++_0x32c905);}(_0x4d98,0x129));var _0x84d9=function(_0x5e9934,_0x59a99f){_0x5e9934=_0x5e9934-0x0;var _0x2ecf91=_0x4d98[_0x5e9934];return _0x2ecf91;};'use strict';var _=require(_0x84d9('0x0'));var util=require(_0x84d9('0x1'));var logger=require(_0x84d9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x84d9('0x3'));var rp=require(_0x84d9('0x4'));var fs=require('fs');var path=require(_0x84d9('0x5'));var rimraf=require(_0x84d9('0x6'));var config=require('../../config/environment');var attributes=require(_0x84d9('0x7'));module[_0x84d9('0x8')]=function(_0x43fb34,_0x5b6200){return _0x43fb34[_0x84d9('0x9')](_0x84d9('0xa'),attributes,{'tableName':_0x84d9('0xb'),'paranoid':![],'indexes':[{'name':_0x84d9('0xc'),'fields':[_0x84d9('0xd')],'type':_0x84d9('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7f7554,_0x24a472,_0x3e85ee){var _0x11931f=_0x43fb34['models'];var _0x259e4c=_0x7f7554['get']({'plain':!![]});if(_0x259e4c['direction'][_0x84d9('0xf')]()==='in'||_0x259e4c[_0x84d9('0x10')][_0x84d9('0xf')]()===_0x84d9('0x11')&&!_0x259e4c[_0x84d9('0x12')]&&!_[_0x84d9('0x13')](_0x259e4c[_0x84d9('0x14')])){_0x11931f[_0x84d9('0x15')][_0x84d9('0x16')]({'where':{'id':_0x259e4c[_0x84d9('0x17')]}})[_0x84d9('0x18')](function(_0x323e48){if(_0x323e48){_0x323e48[_0x84d9('0x19')]({'lastMsgAt':_0x259e4c[_0x84d9('0x1a')],'lastMsgDirection':_0x259e4c[_0x84d9('0x10')][_0x84d9('0xf')]()});}})['catch'](function(_0x4372c9){console[_0x84d9('0x1b')](_0x4372c9);});}if(_0x259e4c[_0x84d9('0x10')]==='out'&&!_0x259e4c[_0x84d9('0x12')]){var _0x21c486;_0x11931f['CmContact']['describe']()[_0x84d9('0x18')](function(_0x288fb1){return _0x11931f[_0x84d9('0x1c')][_0x84d9('0x1d')]({'where':{'id':_0x259e4c['OpenchannelAccountId']},'include':[{'model':_0x11931f[_0x84d9('0x15')],'as':_0x84d9('0x1e'),'where':{'id':_0x259e4c[_0x84d9('0x17')]},'limit':0x1,'include':[{'model':_0x11931f[_0x84d9('0x1f')],'as':'Contact','attributes':_[_0x84d9('0x20')](_0x288fb1)}]}]});})[_0x84d9('0x18')](function(_0x5f26ed){_0x21c486=_0x5f26ed['get']({'plain':!![]});if(_0x21c486&&_0x21c486[_0x84d9('0x21')]){logger['info'](_0x84d9('0x22'),_0x84d9('0x23'),util[_0x84d9('0x24')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x259e4c['id'],_0x21c486[_0x84d9('0x21')]));if(_0x21c486[_0x84d9('0x1e')]&&_0x21c486[_0x84d9('0x1e')][_0x84d9('0x25')]){_0x259e4c['Interaction']=_[_0x84d9('0x26')](_0x21c486[_0x84d9('0x1e')][0x0],_0x84d9('0x27'));_0x259e4c[_0x84d9('0x27')]=_0x21c486[_0x84d9('0x1e')][0x0]['Contact'];}var _0x24a472={'method':'POST','uri':encodeURI(_0x21c486[_0x84d9('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x24a472[_0x84d9('0x28')]){case _0x84d9('0x29'):_0x24a472['qs']=_0x259e4c;break;case'POST':_0x24a472[_0x84d9('0xd')]=_0x259e4c;break;}return rp(_0x24a472)['then'](function(_0x1c6ad2){logger[_0x84d9('0x2a')](_0x84d9('0x22'),_0x84d9('0x23'),util[_0x84d9('0x24')](_0x84d9('0x2b'),_0x259e4c['id'],_0x21c486[_0x84d9('0x21')]));if(_0x1c6ad2['body'][_0x84d9('0x2c')]&&_0x1c6ad2['body'][_0x84d9('0x2c')]!=_0x259e4c[_0x84d9('0x2d')][_0x84d9('0x2c')]){return _0x11931f[_0x84d9('0x15')]['update']({'threadId':_0x1c6ad2['body'][_0x84d9('0x2c')]},{'where':{'id':_0x259e4c[_0x84d9('0x2d')]['id']}});}else{return;}})[_0x84d9('0x18')](function(){return _0x7f7554[_0x84d9('0x19')]({'read':!![]});})['catch'](function(_0x46f59e){logger[_0x84d9('0x1b')]('OpenchannelMessage,\x20%s,\x20%s',_0x84d9('0x23'),util['inspect'](_0x46f59e,{'showHidden':![],'depth':null}));_0x3e85ee();});}else{_0x3e85ee();}})[_0x84d9('0x2e')](function(){_0x3e85ee();});}else{_0x3e85ee();}}},'charset':_0x84d9('0x2f'),'collate':_0x84d9('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index d69bcac..f4a7dde 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 _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(_0x4fd649,_0x288334){var _0x584e5f=function(_0x2dcff5){while(--_0x2dcff5){_0x4fd649['push'](_0x4fd649['shift']());}};_0x584e5f(++_0x288334);}(_0x1261,0x144));var _0x1126=function(_0x4caf0d,_0x580ea2){_0x4caf0d=_0x4caf0d-0x0;var _0x473297=_0x1261[_0x4caf0d];return _0x473297;};'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 +var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x42dc4c,_0x5e4fa3){var _0x52745a=function(_0x4d7413){while(--_0x4d7413){_0x42dc4c['push'](_0x42dc4c['shift']());}};_0x52745a(++_0x5e4fa3);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 6835da4..8143fcb 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 _0x88f5=['emit','register','length','openchannelMessage:','./openchannelMessage.events','remove','update'];(function(_0x261c53,_0x497f83){var _0xa39042=function(_0x2673fb){while(--_0x2673fb){_0x261c53['push'](_0x261c53['shift']());}};_0xa39042(++_0x497f83);}(_0x88f5,0x162));var _0x588f=function(_0x87f43b,_0x9d785b){_0x87f43b=_0x87f43b-0x0;var _0x458510=_0x88f5[_0x87f43b];return _0x458510;};'use strict';var OpenchannelMessageEvents=require(_0x588f('0x0'));var events=['save',_0x588f('0x1'),_0x588f('0x2')];function createListener(_0x2220bb,_0x47170a){return function(_0x580656){_0x47170a[_0x588f('0x3')](_0x2220bb,_0x580656);};}function removeListener(_0x5d1099,_0x5c87ae){return function(){OpenchannelMessageEvents['removeListener'](_0x5d1099,_0x5c87ae);};}exports[_0x588f('0x4')]=function(_0x5d7ba3){for(var _0x2e8c7f=0x0,_0x2af8c1=events[_0x588f('0x5')];_0x2e8c7f<_0x2af8c1;_0x2e8c7f++){var _0x437e0e=events[_0x2e8c7f];var _0x4bf7e2=createListener(_0x588f('0x6')+_0x437e0e,_0x5d7ba3);OpenchannelMessageEvents['on'](_0x437e0e,_0x4bf7e2);}}; \ No newline at end of file +var _0x8f9d=['removeListener','length','openchannelMessage:','./openchannelMessage.events','remove','emit'];(function(_0x3c3079,_0x49dc00){var _0x4e2049=function(_0x28c18c){while(--_0x28c18c){_0x3c3079['push'](_0x3c3079['shift']());}};_0x4e2049(++_0x49dc00);}(_0x8f9d,0x93));var _0xd8f9=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8f9d[_0x40a045];return _0x1a687c;};'use strict';var OpenchannelMessageEvents=require(_0xd8f9('0x0'));var events=['save',_0xd8f9('0x1'),'update'];function createListener(_0x682953,_0x421dcb){return function(_0x119296){_0x421dcb[_0xd8f9('0x2')](_0x682953,_0x119296);};}function removeListener(_0x1f9331,_0x1b82b8){return function(){OpenchannelMessageEvents[_0xd8f9('0x3')](_0x1f9331,_0x1b82b8);};}exports['register']=function(_0x1c37be){for(var _0x24dd1e=0x0,_0x25d417=events[_0xd8f9('0x4')];_0x24dd1e<_0x25d417;_0x24dd1e++){var _0xf6105=events[_0x24dd1e];var _0x5c410f=createListener(_0xd8f9('0x5')+_0xf6105,_0x1c37be);OpenchannelMessageEvents['on'](_0xf6105,_0x5c410f);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index c2bdb35..52dd1c3 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 _0x2dc2=['delete','removeTeams','/:id/users','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','index','isAuthenticated','describe','show','getAgents','create','post','/:id','destroy'];(function(_0x1d36e9,_0x486977){var _0x824c53=function(_0x3dfce2){while(--_0x3dfce2){_0x1d36e9['push'](_0x1d36e9['shift']());}};_0x824c53(++_0x486977);}(_0x2dc2,0x10d));var _0x22dc=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x2dc2[_0x5783f4];return _0x28e380;};'use strict';var multer=require('multer');var util=require(_0x22dc('0x0'));var path=require(_0x22dc('0x1'));var timeout=require(_0x22dc('0x2'));var express=require(_0x22dc('0x3'));var router=express[_0x22dc('0x4')]();var fs_extra=require(_0x22dc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x22dc('0x6'));var config=require(_0x22dc('0x7'));var controller=require(_0x22dc('0x8'));router[_0x22dc('0x9')]('/',auth['isAuthenticated'](),controller[_0x22dc('0xa')]);router[_0x22dc('0x9')]('/describe',auth[_0x22dc('0xb')](),controller[_0x22dc('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x22dc('0xd')]);router[_0x22dc('0x9')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0x22dc('0x9')]('/:id/teams',auth[_0x22dc('0xb')](),controller['getTeams']);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x22dc('0xe')]);router['post']('/',auth[_0x22dc('0xb')](),controller[_0x22dc('0xf')]);router[_0x22dc('0x10')]('/:id/teams',auth[_0x22dc('0xb')](),controller['addTeams']);router[_0x22dc('0x10')]('/:id/users',auth[_0x22dc('0xb')](),controller['addAgents']);router['put'](_0x22dc('0x11'),auth[_0x22dc('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x22dc('0x12')]);router[_0x22dc('0x13')]('/:id/teams',auth[_0x22dc('0xb')](),controller[_0x22dc('0x14')]);router[_0x22dc('0x13')](_0x22dc('0x15'),auth[_0x22dc('0xb')](),controller[_0x22dc('0x16')]);module[_0x22dc('0x17')]=router; \ No newline at end of file +var _0x516a=['/describe','describe','get','/:id','show','getMembers','getAgents','post','create','addTeams','/:id/users','update','destroy','delete','removeTeams','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index'];(function(_0x15772c,_0xb32153){var _0x5cb09a=function(_0x346160){while(--_0x346160){_0x15772c['push'](_0x15772c['shift']());}};_0x5cb09a(++_0xb32153);}(_0x516a,0x64));var _0xa516=function(_0x50934b,_0x3133b6){_0x50934b=_0x50934b-0x0;var _0x2ce0e5=_0x516a[_0x50934b];return _0x2ce0e5;};'use strict';var multer=require(_0xa516('0x0'));var util=require('util');var path=require(_0xa516('0x1'));var timeout=require(_0xa516('0x2'));var express=require(_0xa516('0x3'));var router=express[_0xa516('0x4')]();var fs_extra=require(_0xa516('0x5'));var auth=require(_0xa516('0x6'));var interaction=require(_0xa516('0x7'));var config=require(_0xa516('0x8'));var controller=require(_0xa516('0x9'));router['get']('/',auth[_0xa516('0xa')](),controller[_0xa516('0xb')]);router['get'](_0xa516('0xc'),auth['isAuthenticated'](),controller[_0xa516('0xd')]);router[_0xa516('0xe')](_0xa516('0xf'),auth[_0xa516('0xa')](),controller[_0xa516('0x10')]);router[_0xa516('0xe')]('/:id/members',auth[_0xa516('0xa')](),controller[_0xa516('0x11')]);router[_0xa516('0xe')]('/:id/teams',auth[_0xa516('0xa')](),controller['getTeams']);router['get']('/:id/users',auth[_0xa516('0xa')](),controller[_0xa516('0x12')]);router[_0xa516('0x13')]('/',auth['isAuthenticated'](),controller[_0xa516('0x14')]);router[_0xa516('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0xa516('0x15')]);router[_0xa516('0x13')](_0xa516('0x16'),auth[_0xa516('0xa')](),controller['addAgents']);router['put'](_0xa516('0xf'),auth[_0xa516('0xa')](),controller[_0xa516('0x17')]);router['delete'](_0xa516('0xf'),auth['isAuthenticated'](),controller[_0xa516('0x18')]);router[_0xa516('0x19')]('/:id/teams',auth[_0xa516('0xa')](),controller[_0xa516('0x1a')]);router['delete'](_0xa516('0x16'),auth[_0xa516('0xa')](),controller[_0xa516('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 8876884..182a3e5 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 _0x73c4=['sequelize','STRING','ENUM','rrmemory'];(function(_0x4f2bc2,_0x1520ed){var _0x45e3e1=function(_0x274f00){while(--_0x274f00){_0x4f2bc2['push'](_0x4f2bc2['shift']());}};_0x45e3e1(++_0x1520ed);}(_0x73c4,0x1a0));var _0x473c=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0x73c4[_0x3c4f1f];return _0x19cb69;};'use strict';var Sequelize=require(_0x473c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x473c('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x473c('0x2')](_0x473c('0x3'),'beepall','roundrobin')}}; \ No newline at end of file +var _0xe64b=['ENUM','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x43564a,_0x4f584a){var _0x512fda=function(_0x4c21ab){while(--_0x4c21ab){_0x43564a['push'](_0x43564a['shift']());}};_0x512fda(++_0x4f584a);}(_0xe64b,0x9b));var _0xbe64=function(_0x2b93a9,_0xee8ea1){_0x2b93a9=_0x2b93a9-0x0;var _0x54acc2=_0xe64b[_0x2b93a9];return _0x54acc2;};'use strict';var Sequelize=require(_0xbe64('0x0'));module[_0xbe64('0x1')]={'name':{'type':Sequelize[_0xbe64('0x2')],'unique':_0xbe64('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbe64('0x2')]},'timeout':{'type':Sequelize[_0xbe64('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbe64('0x5')]('rrmemory',_0xbe64('0x6'),_0xbe64('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index f81b51b..503a154 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 _0xa0df=['filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','User','findAndCountAll','UserId','updatedAt','createdAt','format','SIP','openchannelPause','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','union','compact','value','isEmpty','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','OpenchannelQueue','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x2e3bd4,_0x54e47a){var _0x287107=function(_0x3aa6c2){while(--_0x3aa6c2){_0x2e3bd4['push'](_0x2e3bd4['shift']());}};_0x287107(++_0x54e47a);}(_0xa0df,0xd0));var _0xfa0d=function(_0x26f271,_0x50dada){_0x26f271=_0x26f271-0x0;var _0x4d8983=_0xa0df[_0x26f271];return _0x4d8983;};'use strict';var emlformat=require(_0xfa0d('0x0'));var rimraf=require(_0xfa0d('0x1'));var zipdir=require(_0xfa0d('0x2'));var jsonpatch=require(_0xfa0d('0x3'));var rp=require('request-promise');var moment=require(_0xfa0d('0x4'));var BPromise=require(_0xfa0d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfa0d('0x6'));var sox=require(_0xfa0d('0x7'));var csv=require(_0xfa0d('0x8'));var ejs=require(_0xfa0d('0x9'));var fs=require('fs');var fs_extra=require(_0xfa0d('0xa'));var _=require(_0xfa0d('0xb'));var squel=require(_0xfa0d('0xc'));var crypto=require(_0xfa0d('0xd'));var jsforce=require(_0xfa0d('0xe'));var deskjs=require(_0xfa0d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfa0d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfa0d('0x11'));var qs=require(_0xfa0d('0x12'));var as=require(_0xfa0d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfa0d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfa0d('0x15'));var db=require(_0xfa0d('0x16'))['db'];config[_0xfa0d('0x17')]=_['defaults'](config[_0xfa0d('0x17')],{'host':_0xfa0d('0x18'),'port':0x18eb});var socket=require(_0xfa0d('0x19'))(new Redis(config[_0xfa0d('0x17')]));require(_0xfa0d('0x1a'))[_0xfa0d('0x1b')](socket);function respondWithStatusCode(_0x19cfb9,_0x501b9f){_0x501b9f=_0x501b9f||0xcc;return function(_0x34f1b2){if(_0x34f1b2){return _0x19cfb9['sendStatus'](_0x501b9f);}return _0x19cfb9[_0xfa0d('0x1c')](_0x501b9f)['end']();};}function respondWithResult(_0x28222b,_0x360087){_0x360087=_0x360087||0xc8;return function(_0x1e936e){if(_0x1e936e){return _0x28222b['status'](_0x360087)[_0xfa0d('0x1d')](_0x1e936e);}};}function respondWithFilteredResult(_0x509d60,_0xbb025c){return function(_0x4b0ee7){if(_0x4b0ee7){var _0x51359e=typeof _0xbb025c[_0xfa0d('0x1e')]===_0xfa0d('0x1f')&&typeof _0xbb025c[_0xfa0d('0x20')]===_0xfa0d('0x1f');var _0xda54f=_0x4b0ee7['count'];var _0x844102=_0x51359e?0x0:_0xbb025c[_0xfa0d('0x1e')];var _0x5cc4b7=_0x51359e?_0x4b0ee7[_0xfa0d('0x21')]:_0xbb025c[_0xfa0d('0x1e')]+_0xbb025c[_0xfa0d('0x20')];var _0x1014da;if(_0x5cc4b7>=_0xda54f){_0x5cc4b7=_0xda54f;_0x1014da=0xc8;}else{_0x1014da=0xce;}_0x509d60[_0xfa0d('0x1c')](_0x1014da);return _0x509d60[_0xfa0d('0x22')](_0xfa0d('0x23'),_0x844102+'-'+_0x5cc4b7+'/'+_0xda54f)[_0xfa0d('0x1d')](_0x4b0ee7);}return null;};}function patchUpdates(_0x199f9d){return function(_0xf6f863){try{jsonpatch[_0xfa0d('0x24')](_0xf6f863,_0x199f9d,!![]);}catch(_0x376cb6){return BPromise['reject'](_0x376cb6);}return _0xf6f863[_0xfa0d('0x25')]();};}function saveUpdates(_0x5690e7,_0x117efc){return function(_0x17bf40){if(_0x17bf40){return _0x17bf40[_0xfa0d('0x26')](_0x5690e7)[_0xfa0d('0x27')](function(_0x11c75c){return _0x11c75c;});}return null;};}function removeEntity(_0x3535a7,_0x5e39dc){return function(_0x1bd4a6){if(_0x1bd4a6){return _0x1bd4a6[_0xfa0d('0x28')]()['then'](function(){var _0x4e0d7b=_0x1bd4a6[_0xfa0d('0x29')]({'plain':!![]});var _0x3220e6=_0xfa0d('0x2a');return db[_0xfa0d('0x2b')][_0xfa0d('0x28')]({'where':{'type':_0x3220e6,'resourceId':_0x4e0d7b['id']}})[_0xfa0d('0x27')](function(){return _0x1bd4a6;});})[_0xfa0d('0x27')](function(){_0x3535a7[_0xfa0d('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xda426b,_0x2e7f29){return function(_0x12dedf){if(!_0x12dedf){_0xda426b[_0xfa0d('0x2c')](0x194);}return _0x12dedf;};}function handleError(_0x88fc51,_0x378328){_0x378328=_0x378328||0x1f4;return function(_0x3600fd){logger[_0xfa0d('0x2d')](_0x3600fd[_0xfa0d('0x2e')]);if(_0x3600fd[_0xfa0d('0x2f')]){delete _0x3600fd[_0xfa0d('0x2f')];}_0x88fc51[_0xfa0d('0x1c')](_0x378328)[_0xfa0d('0x30')](_0x3600fd);};}exports[_0xfa0d('0x31')]=function(_0x1f02f5,_0x3aa9e5){var _0x57857e={},_0x2aa498={},_0x445465={'count':0x0,'rows':[]};var _0x48372c=_[_0xfa0d('0x32')](db[_0xfa0d('0x33')]['rawAttributes'],function(_0x3b3d92){return{'name':_0x3b3d92[_0xfa0d('0x34')],'type':_0x3b3d92[_0xfa0d('0x35')][_0xfa0d('0x36')]};});_0x2aa498[_0xfa0d('0x37')]=_[_0xfa0d('0x32')](_0x48372c,_0xfa0d('0x2f'));_0x2aa498[_0xfa0d('0x38')]=_[_0xfa0d('0x39')](_0x1f02f5[_0xfa0d('0x38')]);_0x2aa498['filters']=_[_0xfa0d('0x3a')](_0x2aa498[_0xfa0d('0x37')],_0x2aa498[_0xfa0d('0x38')]);_0x57857e[_0xfa0d('0x3b')]=_[_0xfa0d('0x3a')](_0x2aa498[_0xfa0d('0x37')],qs[_0xfa0d('0x3c')](_0x1f02f5[_0xfa0d('0x38')]['fields']));_0x57857e[_0xfa0d('0x3b')]=_0x57857e['attributes'][_0xfa0d('0x3d')]?_0x57857e[_0xfa0d('0x3b')]:_0x2aa498[_0xfa0d('0x37')];if(!_0x1f02f5['query'][_0xfa0d('0x3e')](_0xfa0d('0x3f'))){_0x57857e[_0xfa0d('0x20')]=qs[_0xfa0d('0x20')](_0x1f02f5[_0xfa0d('0x38')][_0xfa0d('0x20')]);_0x57857e['offset']=qs[_0xfa0d('0x1e')](_0x1f02f5[_0xfa0d('0x38')][_0xfa0d('0x1e')]);}_0x57857e[_0xfa0d('0x40')]=qs[_0xfa0d('0x41')](_0x1f02f5[_0xfa0d('0x38')][_0xfa0d('0x41')]);_0x57857e[_0xfa0d('0x42')]=qs['filters'](_[_0xfa0d('0x43')](_0x1f02f5[_0xfa0d('0x38')],_0x2aa498[_0xfa0d('0x44')]),_0x48372c);if(_0x1f02f5[_0xfa0d('0x38')][_0xfa0d('0x45')]){_0x57857e[_0xfa0d('0x42')]=_[_0xfa0d('0x46')](_0x57857e['where'],{'$or':_['map'](_0x48372c,function(_0x466c4a){if(_0x466c4a['type']!=='VIRTUAL'){var _0x22ddba={};_0x22ddba[_0x466c4a[_0xfa0d('0x2f')]]={'$like':'%'+_0x1f02f5['query'][_0xfa0d('0x45')]+'%'};return _0x22ddba;}})});}_0x57857e=_[_0xfa0d('0x46')]({},_0x57857e,_0x1f02f5[_0xfa0d('0x47')]);var _0x3b6bc6={'where':_0x57857e['where']};return db[_0xfa0d('0x33')][_0xfa0d('0x21')](_0x3b6bc6)[_0xfa0d('0x27')](function(_0x20dcb5){_0x445465[_0xfa0d('0x21')]=_0x20dcb5;if(_0x1f02f5[_0xfa0d('0x38')][_0xfa0d('0x48')]){_0x57857e[_0xfa0d('0x49')]=[{'all':!![]}];}return db[_0xfa0d('0x33')][_0xfa0d('0x4a')](_0x57857e);})[_0xfa0d('0x27')](function(_0x5a6146){_0x445465[_0xfa0d('0x4b')]=_0x5a6146;return _0x445465;})['then'](respondWithFilteredResult(_0x3aa9e5,_0x57857e))[_0xfa0d('0x4c')](handleError(_0x3aa9e5,null));};exports[_0xfa0d('0x4d')]=function(_0x54782d,_0x502738){var _0x32e3a9={'raw':!![],'where':{'id':_0x54782d[_0xfa0d('0x4e')]['id']}},_0x5c6c51={};_0x5c6c51['model']=_['keys'](db[_0xfa0d('0x33')][_0xfa0d('0x4f')]);_0x5c6c51[_0xfa0d('0x38')]=_[_0xfa0d('0x39')](_0x54782d[_0xfa0d('0x38')]);_0x5c6c51[_0xfa0d('0x44')]=_[_0xfa0d('0x3a')](_0x5c6c51['model'],_0x5c6c51[_0xfa0d('0x38')]);_0x32e3a9[_0xfa0d('0x3b')]=_[_0xfa0d('0x3a')](_0x5c6c51[_0xfa0d('0x37')],qs[_0xfa0d('0x3c')](_0x54782d[_0xfa0d('0x38')][_0xfa0d('0x3c')]));_0x32e3a9[_0xfa0d('0x3b')]=_0x32e3a9[_0xfa0d('0x3b')][_0xfa0d('0x3d')]?_0x32e3a9['attributes']:_0x5c6c51['model'];if(_0x54782d['query'][_0xfa0d('0x48')]){_0x32e3a9[_0xfa0d('0x49')]=[{'all':!![]}];}_0x32e3a9=_[_0xfa0d('0x46')]({},_0x32e3a9,_0x54782d[_0xfa0d('0x47')]);return db[_0xfa0d('0x33')][_0xfa0d('0x50')](_0x32e3a9)[_0xfa0d('0x27')](handleEntityNotFound(_0x502738,null))[_0xfa0d('0x27')](respondWithResult(_0x502738,null))[_0xfa0d('0x4c')](handleError(_0x502738,null));};exports['create']=function(_0x9ceb24,_0x430aee){return db[_0xfa0d('0x33')][_0xfa0d('0x51')](_0x9ceb24[_0xfa0d('0x52')],{})[_0xfa0d('0x27')](function(_0x2fe6ad){var _0x3eb6b8=_0x9ceb24[_0xfa0d('0x53')][_0xfa0d('0x29')]({'plain':!![]});if(!_0x3eb6b8)throw new Error(_0xfa0d('0x54'));if(_0x3eb6b8['role']===_0xfa0d('0x53')){var _0x1a9212=_0x2fe6ad[_0xfa0d('0x29')]({'plain':!![]});var _0x174198=_0xfa0d('0x2a');return db[_0xfa0d('0x55')][_0xfa0d('0x50')]({'where':{'name':_0x174198,'userProfileId':_0x3eb6b8[_0xfa0d('0x56')]},'raw':!![]})[_0xfa0d('0x27')](function(_0x3608e5){if(_0x3608e5&&_0x3608e5['autoAssociation']===0x0){return db[_0xfa0d('0x2b')][_0xfa0d('0x51')]({'name':_0x1a9212[_0xfa0d('0x2f')],'resourceId':_0x1a9212['id'],'type':_0x3608e5['name'],'sectionId':_0x3608e5['id']},{})[_0xfa0d('0x27')](function(){return _0x2fe6ad;});}else{return _0x2fe6ad;}})[_0xfa0d('0x4c')](function(_0x2077b3){logger['error'](_0xfa0d('0x57'),_0x2077b3);throw _0x2077b3;});}return _0x2fe6ad;})[_0xfa0d('0x27')](respondWithResult(_0x430aee,0xc9))[_0xfa0d('0x4c')](handleError(_0x430aee,null));};exports[_0xfa0d('0x26')]=function(_0x206ded,_0xd0988c){if(_0x206ded['body']['id']){delete _0x206ded[_0xfa0d('0x52')]['id'];}return db['OpenchannelQueue'][_0xfa0d('0x50')]({'where':{'id':_0x206ded[_0xfa0d('0x4e')]['id']}})[_0xfa0d('0x27')](handleEntityNotFound(_0xd0988c,null))[_0xfa0d('0x27')](saveUpdates(_0x206ded[_0xfa0d('0x52')],null))[_0xfa0d('0x27')](respondWithResult(_0xd0988c,null))[_0xfa0d('0x4c')](handleError(_0xd0988c,null));};exports[_0xfa0d('0x28')]=function(_0x23df79,_0xf9fd41){return db[_0xfa0d('0x33')][_0xfa0d('0x50')]({'where':{'id':_0x23df79[_0xfa0d('0x4e')]['id']}})[_0xfa0d('0x27')](handleEntityNotFound(_0xf9fd41,null))['then'](removeEntity(_0xf9fd41,null))['catch'](handleError(_0xf9fd41,null));};exports[_0xfa0d('0x58')]=function(_0x20cd9b,_0x1d7c3e){return db[_0xfa0d('0x33')][_0xfa0d('0x58')]()[_0xfa0d('0x27')](respondWithResult(_0x1d7c3e,null))['catch'](handleError(_0x1d7c3e,null));};exports[_0xfa0d('0x59')]=function(_0x37de96,_0x52ece5,_0x4c2fce){var _0x58336a={'raw':!![],'where':{}},_0x4d3e13={},_0x22cc0d;return db[_0xfa0d('0x33')][_0xfa0d('0x5a')]({'where':{'id':_0x37de96[_0xfa0d('0x4e')]['id']}})[_0xfa0d('0x27')](handleEntityNotFound(_0x52ece5,null))[_0xfa0d('0x27')](function(_0x315531){if(_0x315531){_0x22cc0d=_0x315531[_0xfa0d('0x29')]({'plain':!![]});_0x4d3e13[_0xfa0d('0x37')]=_[_0xfa0d('0x39')](db['UserOpenchannelQueue']['rawAttributes']);_0x4d3e13['query']=_['keys'](_0x37de96[_0xfa0d('0x38')]);_0x4d3e13[_0xfa0d('0x44')]=_[_0xfa0d('0x3a')](_0x4d3e13['model'],_0x4d3e13[_0xfa0d('0x38')]);_0x58336a[_0xfa0d('0x3b')]=_['intersection'](_0x4d3e13['model'],qs[_0xfa0d('0x3c')](_0x37de96[_0xfa0d('0x38')][_0xfa0d('0x3c')]));_0x58336a[_0xfa0d('0x3b')]=_0x58336a['attributes']['length']?_0x58336a[_0xfa0d('0x3b')]:_0x4d3e13[_0xfa0d('0x37')];if(!_0x37de96[_0xfa0d('0x38')][_0xfa0d('0x3e')](_0xfa0d('0x3f'))){_0x58336a[_0xfa0d('0x20')]=qs['limit'](_0x37de96[_0xfa0d('0x38')][_0xfa0d('0x20')]);_0x58336a[_0xfa0d('0x1e')]=qs[_0xfa0d('0x1e')](_0x37de96[_0xfa0d('0x38')]['offset']);}_0x58336a[_0xfa0d('0x40')]=qs[_0xfa0d('0x41')](_0x37de96[_0xfa0d('0x38')][_0xfa0d('0x41')]);_0x58336a[_0xfa0d('0x42')]=qs[_0xfa0d('0x44')](_[_0xfa0d('0x43')](_0x37de96['query'],_0x4d3e13[_0xfa0d('0x44')]));_0x58336a[_0xfa0d('0x42')]['OpenchannelQueueId']=_0x315531['id'];if(_0x37de96[_0xfa0d('0x38')][_0xfa0d('0x45')]){_0x58336a['where']=_['merge'](_0x58336a['where'],{'$or':_[_0xfa0d('0x32')](_0x58336a['attributes'],function(_0xad9b93){var _0x2eba45={};_0x2eba45[_0xad9b93]={'$like':'%'+_0x37de96['query'][_0xfa0d('0x45')]+'%'};return _0x2eba45;})});}_0x58336a=_[_0xfa0d('0x46')]({},_0x58336a,_0x37de96[_0xfa0d('0x47')]);return db[_0xfa0d('0x5b')][_0xfa0d('0x4a')](_0x58336a);}})[_0xfa0d('0x27')](function(_0x55a4de){if(_0x55a4de){return db[_0xfa0d('0x5c')][_0xfa0d('0x5d')]({'where':{'id':_[_0xfa0d('0x32')](_0x55a4de,_0xfa0d('0x5e')),'role':'agent'},'attributes':['id','name','openchannelPause',_0xfa0d('0x5f'),_0xfa0d('0x60')]});}})[_0xfa0d('0x27')](function(_0x4fa608){if(_0x4fa608){return{'count':_0x4fa608['count'],'rows':_[_0xfa0d('0x32')](_0x4fa608['rows'],function(_0x1fea1a){return{'membername':_0x1fea1a[_0xfa0d('0x2f')],'UserId':_0x1fea1a['id'],'queue_name':_0x22cc0d[_0xfa0d('0x2f')],'OpenchannelQueueId':_0x22cc0d['id'],'interface':util[_0xfa0d('0x61')]('%s/%s',_0xfa0d('0x62'),_0x1fea1a[_0xfa0d('0x2f')]),'penalty':0x0,'paused':_0x1fea1a[_0xfa0d('0x63')],'createdAt':_0x1fea1a[_0xfa0d('0x60')],'updatedAt':_0x1fea1a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xfa0d('0x27')](respondWithFilteredResult(_0x52ece5,_0x58336a))[_0xfa0d('0x4c')](handleError(_0x52ece5,null));};exports[_0xfa0d('0x64')]=function(_0x5714d6,_0x2ae195,_0xc413be){var _0x3611cd={};var _0x541933={};var _0x306915;var _0x2aec88;return db[_0xfa0d('0x33')][_0xfa0d('0x5a')]({'where':{'id':_0x5714d6['params']['id']}})[_0xfa0d('0x27')](handleEntityNotFound(_0x2ae195,null))[_0xfa0d('0x27')](function(_0x2bf2c0){if(_0x2bf2c0){_0x306915=_0x2bf2c0;_0x541933[_0xfa0d('0x37')]=_[_0xfa0d('0x39')](db[_0xfa0d('0x65')][_0xfa0d('0x4f')]);_0x541933[_0xfa0d('0x38')]=_[_0xfa0d('0x39')](_0x5714d6[_0xfa0d('0x38')]);_0x541933[_0xfa0d('0x44')]=_[_0xfa0d('0x3a')](_0x541933[_0xfa0d('0x37')],_0x541933[_0xfa0d('0x38')]);_0x3611cd[_0xfa0d('0x3b')]=_[_0xfa0d('0x3a')](_0x541933['model'],qs['fields'](_0x5714d6[_0xfa0d('0x38')][_0xfa0d('0x3c')]));_0x3611cd[_0xfa0d('0x3b')]=_0x3611cd[_0xfa0d('0x3b')][_0xfa0d('0x3d')]?_0x3611cd[_0xfa0d('0x3b')]:_0x541933[_0xfa0d('0x37')];_0x3611cd[_0xfa0d('0x40')]=qs['sort'](_0x5714d6[_0xfa0d('0x38')][_0xfa0d('0x41')]);_0x3611cd[_0xfa0d('0x42')]=qs[_0xfa0d('0x44')](_[_0xfa0d('0x43')](_0x5714d6[_0xfa0d('0x38')],_0x541933[_0xfa0d('0x44')]));if(_0x5714d6['query'][_0xfa0d('0x45')]){_0x3611cd['where']=_[_0xfa0d('0x46')](_0x3611cd[_0xfa0d('0x42')],{'$or':_['map'](_0x3611cd[_0xfa0d('0x3b')],function(_0x347263){var _0x5de2aa={};_0x5de2aa[_0x347263]={'$like':'%'+_0x5714d6[_0xfa0d('0x38')][_0xfa0d('0x45')]+'%'};return _0x5de2aa;})});}_0x3611cd=_[_0xfa0d('0x46')]({},_0x3611cd,_0x5714d6[_0xfa0d('0x47')]);return _0x306915[_0xfa0d('0x64')](_0x3611cd);}})[_0xfa0d('0x27')](function(_0x55eccc){if(_0x55eccc){_0x2aec88=_0x55eccc['length'];if(!_0x5714d6[_0xfa0d('0x38')][_0xfa0d('0x3e')](_0xfa0d('0x3f'))){_0x3611cd['limit']=qs['limit'](_0x5714d6[_0xfa0d('0x38')][_0xfa0d('0x20')]);_0x3611cd[_0xfa0d('0x1e')]=qs[_0xfa0d('0x1e')](_0x5714d6['query'][_0xfa0d('0x1e')]);}return _0x306915[_0xfa0d('0x64')](_0x3611cd);}})[_0xfa0d('0x27')](function(_0x1d07da){if(_0x1d07da){return _0x1d07da?{'count':_0x2aec88,'rows':_0x1d07da}:null;}})[_0xfa0d('0x27')](respondWithResult(_0x2ae195,null))[_0xfa0d('0x4c')](handleError(_0x2ae195,null));};exports['addTeams']=function(_0x567cb2,_0x1b0c9f,_0x3f98af){var _0x333ccf=_0x567cb2[_0xfa0d('0x52')][_0xfa0d('0x66')];return db[_0xfa0d('0x65')][_0xfa0d('0x4a')]({'where':{'id':_0x333ccf},'attributes':['id'],'include':[{'model':db[_0xfa0d('0x5c')],'as':_0xfa0d('0x67'),'attributes':['id',_0xfa0d('0x2f'),_0xfa0d('0x68'),_0xfa0d('0x69'),_0xfa0d('0x6a')],'raw':!![]}]})['then'](function(_0x31374d){if(_0x31374d){var _0x1a4bef=_[_0xfa0d('0x6b')](_0x31374d,function(_0xfc369b){var _0x383df7=_0xfc369b[_0xfa0d('0x29')]({'plain':!![]});return _0x383df7[_0xfa0d('0x67')];});return db[_0xfa0d('0x33')]['find']({'where':{'id':_0x567cb2[_0xfa0d('0x4e')]['id']}})[_0xfa0d('0x27')](function(_0x13d79e){return db[_0xfa0d('0x6c')][_0xfa0d('0x6d')](function(_0x3ac4f5){return _0x13d79e['addTeams'](_0x333ccf,{'transaction':_0x3ac4f5})['then'](function(){return BPromise[_0xfa0d('0x6e')](_0x1a4bef,function(_0x441b80){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x441b80['id'],'OpenchannelQueueId':_0x567cb2[_0xfa0d('0x4e')]['id']},'transaction':_0x3ac4f5});});})[_0xfa0d('0x27')](function(){_0x1a4bef[_0xfa0d('0x6f')](function(_0x5a76d2){socket['emit'](_0xfa0d('0x70'),{'UserId':_0x5a76d2['id'],'OpenchannelQueueId':_0x13d79e['id']});});});});});}})[_0xfa0d('0x27')](respondWithStatusCode(_0x1b0c9f,null))['catch'](handleError(_0x1b0c9f,null));};exports[_0xfa0d('0x71')]=function(_0xb5318d,_0x190434,_0x15d4dd){return db[_0xfa0d('0x65')][_0xfa0d('0x4a')]({'where':{'id':_0xb5318d['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x190434,null))[_0xfa0d('0x27')](function(_0x18b5a3){var _0x8adfd5=_[_0xfa0d('0x32')](_0x18b5a3,'id');var _0x59e54b=[];var _0x381fd9=[];var _0x3de970=squel[_0xfa0d('0x72')]();_0x3de970[_0xfa0d('0x73')](_0xfa0d('0x74'))['from'](_0xfa0d('0x75'),'tq')[_0xfa0d('0x76')](_0xfa0d('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xfa0d('0x42')]('OpenchannelQueueId\x20=\x20?',_0xb5318d[_0xfa0d('0x4e')]['id']);for(var _0x42fbf6=0x0;_0x42fbf6<_0x18b5a3[_0xfa0d('0x3d')];_0x42fbf6+=0x1){let _0x101d7f=_0x18b5a3[_0x42fbf6];for(var _0x57def0=0x0;_0x57def0<_0x101d7f[_0xfa0d('0x67')][_0xfa0d('0x3d')];_0x57def0+=0x1){let _0xb6a927=_0x101d7f[_0xfa0d('0x67')][_0x57def0];var _0x563530=_0x3de970['clone']();_0x563530[_0xfa0d('0x42')](_0xfa0d('0x78'),_0xb6a927['id']);_0x381fd9['push'](db['sequelize']['query'](_0x563530[_0xfa0d('0x79')](),{'type':db[_0xfa0d('0x6c')][_0xfa0d('0x7a')][_0xfa0d('0x7b')]})[_0xfa0d('0x27')](function(_0x9890d2){if(_0x9890d2['length']===0x1){return _0xb6a927['id'];}else{var _0x16bc96=_[_0xfa0d('0x7c')](_['map'](_0x9890d2,'TeamId'),function(_0x503e82){return _[_0xfa0d('0x7d')](_0x8adfd5,_0x503e82);});if(_0x16bc96){return _0xb6a927['id'];}}}));}}return BPromise['all'](_0x381fd9)[_0xfa0d('0x27')](function(_0xe8ad91){_0x59e54b=_(_0x59e54b)[_0xfa0d('0x7e')](_0xe8ad91)[_0xfa0d('0x7f')]()[_0xfa0d('0x80')]();return db['OpenchannelQueue'][_0xfa0d('0x50')]({'where':{'id':_0xb5318d[_0xfa0d('0x4e')]['id']}})[_0xfa0d('0x27')](function(_0x4d3a6b){return db[_0xfa0d('0x6c')]['transaction'](function(_0x484a4f){return _0x4d3a6b[_0xfa0d('0x71')](_0xb5318d[_0xfa0d('0x38')][_0xfa0d('0x66')],{'transaction':_0x484a4f})[_0xfa0d('0x27')](function(){if(!_[_0xfa0d('0x81')](_0x59e54b)){return _0x4d3a6b[_0xfa0d('0x82')](_0x59e54b,{'transaction':_0x484a4f});}})['then'](function(){_0x59e54b[_0xfa0d('0x6f')](function(_0x224059){socket[_0xfa0d('0x83')](_0xfa0d('0x84'),{'UserId':_0x224059,'OpenchannelQueueId':_0x4d3a6b['id']});});});});});});})['then'](respondWithStatusCode(_0x190434,null))[_0xfa0d('0x4c')](handleError(_0x190434,null));};exports[_0xfa0d('0x85')]=function(_0x24fd55,_0x3e618c,_0xa6bbbe){return db['OpenchannelQueue']['find']({'where':{'id':_0x24fd55[_0xfa0d('0x4e')]['id']}})[_0xfa0d('0x27')](handleEntityNotFound(_0x3e618c,null))[_0xfa0d('0x27')](function(_0x1e5af4){if(_0x1e5af4){return _0x1e5af4[_0xfa0d('0x85')](_0x24fd55['body']['ids'],_[_0xfa0d('0x86')](_0x24fd55[_0xfa0d('0x52')],['ids','id'])||{})[_0xfa0d('0x87')](function(_0xcb4491){for(var _0x525765=0x0;_0x525765<_0x24fd55[_0xfa0d('0x52')][_0xfa0d('0x66')]['length'];_0x525765+=0x1){socket['emit'](_0xfa0d('0x70'),{'UserId':Number(_0x24fd55[_0xfa0d('0x52')][_0xfa0d('0x66')][_0x525765]),'OpenchannelQueueId':Number(_0x24fd55[_0xfa0d('0x4e')]['id'])});}return _0xcb4491;});}})[_0xfa0d('0x27')](respondWithResult(_0x3e618c,null))['catch'](handleError(_0x3e618c,null));};exports[_0xfa0d('0x82')]=function(_0x6b4001,_0x3130d3,_0x412083){return db[_0xfa0d('0x33')][_0xfa0d('0x50')]({'where':{'id':_0x6b4001[_0xfa0d('0x4e')]['id']}})[_0xfa0d('0x27')](handleEntityNotFound(_0x3130d3,null))[_0xfa0d('0x27')](function(_0x4730c4){if(_0x4730c4){return _0x4730c4['removeAgents'](_0x6b4001[_0xfa0d('0x38')][_0xfa0d('0x66')])['then'](function(){if(_[_0xfa0d('0x88')](_0x6b4001[_0xfa0d('0x38')]['ids'])){for(var _0x23976f=0x0;_0x23976f<_0x6b4001[_0xfa0d('0x38')]['ids'][_0xfa0d('0x3d')];_0x23976f+=0x1){socket['emit'](_0xfa0d('0x84'),{'UserId':Number(_0x6b4001[_0xfa0d('0x38')][_0xfa0d('0x66')][_0x23976f]),'OpenchannelQueueId':Number(_0x6b4001[_0xfa0d('0x4e')]['id'])});}}else{socket[_0xfa0d('0x83')]('userOpenchannelQueue:remove',{'UserId':Number(_0x6b4001[_0xfa0d('0x38')][_0xfa0d('0x66')]),'OpenchannelQueueId':Number(_0x6b4001['params']['id'])});}});}})[_0xfa0d('0x27')](respondWithStatusCode(_0x3130d3,null))[_0xfa0d('0x4c')](handleError(_0x3130d3,null));};exports[_0xfa0d('0x89')]=function(_0x55e4f6,_0xf4fca2,_0x1aaf4d){var _0x5a05ac={};var _0x2d30d5={};var _0x359e7c;var _0x10b0af;return db[_0xfa0d('0x33')][_0xfa0d('0x5a')]({'where':{'id':_0x55e4f6[_0xfa0d('0x4e')]['id']}})[_0xfa0d('0x27')](handleEntityNotFound(_0xf4fca2,null))[_0xfa0d('0x27')](function(_0x5f44e1){if(_0x5f44e1){_0x359e7c=_0x5f44e1;_0x2d30d5[_0xfa0d('0x37')]=_['keys'](db['User'][_0xfa0d('0x4f')]);_0x2d30d5['query']=_[_0xfa0d('0x39')](_0x55e4f6['query']);_0x2d30d5[_0xfa0d('0x44')]=_[_0xfa0d('0x3a')](_0x2d30d5[_0xfa0d('0x37')],_0x2d30d5[_0xfa0d('0x38')]);_0x5a05ac[_0xfa0d('0x3b')]=_[_0xfa0d('0x3a')](_0x2d30d5[_0xfa0d('0x37')],qs[_0xfa0d('0x3c')](_0x55e4f6[_0xfa0d('0x38')][_0xfa0d('0x3c')]));_0x5a05ac[_0xfa0d('0x3b')]=_0x5a05ac['attributes'][_0xfa0d('0x3d')]?_0x5a05ac[_0xfa0d('0x3b')]:_0x2d30d5[_0xfa0d('0x37')];_0x5a05ac[_0xfa0d('0x40')]=qs['sort'](_0x55e4f6[_0xfa0d('0x38')][_0xfa0d('0x41')]);_0x5a05ac[_0xfa0d('0x42')]=qs[_0xfa0d('0x44')](_['pick'](_0x55e4f6[_0xfa0d('0x38')],_0x2d30d5['filters']));if(_0x55e4f6[_0xfa0d('0x38')]['filter']){_0x5a05ac[_0xfa0d('0x42')]=_[_0xfa0d('0x46')](_0x5a05ac[_0xfa0d('0x42')],{'$or':_[_0xfa0d('0x32')](_0x5a05ac[_0xfa0d('0x3b')],function(_0x4c494e){var _0x256369={};_0x256369[_0x4c494e]={'$like':'%'+_0x55e4f6[_0xfa0d('0x38')][_0xfa0d('0x45')]+'%'};return _0x256369;})});}_0x5a05ac=_['merge']({},_0x5a05ac,_0x55e4f6['options']);return _0x359e7c['getAgents'](_0x5a05ac);}})['then'](function(_0x6076a9){if(_0x6076a9){_0x10b0af=_0x6076a9[_0xfa0d('0x3d')];if(!_0x55e4f6[_0xfa0d('0x38')][_0xfa0d('0x3e')]('nolimit')){_0x5a05ac[_0xfa0d('0x20')]=qs[_0xfa0d('0x20')](_0x55e4f6[_0xfa0d('0x38')][_0xfa0d('0x20')]);_0x5a05ac[_0xfa0d('0x1e')]=qs[_0xfa0d('0x1e')](_0x55e4f6[_0xfa0d('0x38')]['offset']);}return _0x359e7c[_0xfa0d('0x89')](_0x5a05ac);}})[_0xfa0d('0x27')](function(_0x5a856f){if(_0x5a856f){return _0x5a856f?{'count':_0x10b0af,'rows':_0x5a856f}:null;}})[_0xfa0d('0x27')](respondWithResult(_0xf4fca2,null))[_0xfa0d('0x4c')](handleError(_0xf4fca2,null));}; \ No newline at end of file +var _0xcb79=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','nolimit','order','pick','OpenchannelQueueId','findAll','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','hasOwnProperty','addTeams','ids','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','removeTeams','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','emit','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','end','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','name','send','index','map','OpenchannelQueue','rawAttributes','model','query','filters','intersection','attributes','fields','length','offset','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0xcb79,0xd6));var _0x9cb7=function(_0x1fe9d7,_0x174d5c){_0x1fe9d7=_0x1fe9d7-0x0;var _0x39442f=_0xcb79[_0x1fe9d7];return _0x39442f;};'use strict';var emlformat=require(_0x9cb7('0x0'));var rimraf=require(_0x9cb7('0x1'));var zipdir=require(_0x9cb7('0x2'));var jsonpatch=require(_0x9cb7('0x3'));var rp=require(_0x9cb7('0x4'));var moment=require('moment');var BPromise=require(_0x9cb7('0x5'));var Mustache=require(_0x9cb7('0x6'));var util=require(_0x9cb7('0x7'));var path=require(_0x9cb7('0x8'));var sox=require(_0x9cb7('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9cb7('0xa'));var squel=require(_0x9cb7('0xb'));var crypto=require(_0x9cb7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9cb7('0xd'));var toCsv=require(_0x9cb7('0xe'));var querystring=require(_0x9cb7('0xf'));var Papa=require(_0x9cb7('0x10'));var Redis=require(_0x9cb7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9cb7('0x12'));var as=require(_0x9cb7('0x13'));var hardwareService=require(_0x9cb7('0x14'));var logger=require(_0x9cb7('0x15'))(_0x9cb7('0x16'));var utils=require(_0x9cb7('0x17'));var config=require(_0x9cb7('0x18'));var licenseUtil=require(_0x9cb7('0x19'));var db=require(_0x9cb7('0x1a'))['db'];config[_0x9cb7('0x1b')]=_[_0x9cb7('0x1c')](config[_0x9cb7('0x1b')],{'host':_0x9cb7('0x1d'),'port':0x18eb});var socket=require(_0x9cb7('0x1e'))(new Redis(config['redis']));require(_0x9cb7('0x1f'))[_0x9cb7('0x20')](socket);function respondWithStatusCode(_0x4afe95,_0x427d9e){_0x427d9e=_0x427d9e||0xcc;return function(_0x17cebf){if(_0x17cebf){return _0x4afe95[_0x9cb7('0x21')](_0x427d9e);}return _0x4afe95[_0x9cb7('0x22')](_0x427d9e)[_0x9cb7('0x23')]();};}function respondWithResult(_0x8967bb,_0x450336){_0x450336=_0x450336||0xc8;return function(_0x5c6524){if(_0x5c6524){return _0x8967bb[_0x9cb7('0x22')](_0x450336)['json'](_0x5c6524);}};}function respondWithFilteredResult(_0x25376b,_0x390707){return function(_0x11b54b){if(_0x11b54b){var _0x2cac72=typeof _0x390707['offset']==='undefined'&&typeof _0x390707['limit']===_0x9cb7('0x24');var _0x2d23d5=_0x11b54b[_0x9cb7('0x25')];var _0x3278be=_0x2cac72?0x0:_0x390707['offset'];var _0x869443=_0x2cac72?_0x11b54b[_0x9cb7('0x25')]:_0x390707['offset']+_0x390707[_0x9cb7('0x26')];var _0x1841b0;if(_0x869443>=_0x2d23d5){_0x869443=_0x2d23d5;_0x1841b0=0xc8;}else{_0x1841b0=0xce;}_0x25376b['status'](_0x1841b0);return _0x25376b[_0x9cb7('0x27')](_0x9cb7('0x28'),_0x3278be+'-'+_0x869443+'/'+_0x2d23d5)['json'](_0x11b54b);}return null;};}function patchUpdates(_0x20750a){return function(_0x57b626){try{jsonpatch['apply'](_0x57b626,_0x20750a,!![]);}catch(_0x6d7613){return BPromise[_0x9cb7('0x29')](_0x6d7613);}return _0x57b626[_0x9cb7('0x2a')]();};}function saveUpdates(_0x41cae5,_0x1a94f0){return function(_0x4fbfce){if(_0x4fbfce){return _0x4fbfce[_0x9cb7('0x2b')](_0x41cae5)[_0x9cb7('0x2c')](function(_0x3415b1){return _0x3415b1;});}return null;};}function removeEntity(_0x387acc,_0x388892){return function(_0x250b3a){if(_0x250b3a){return _0x250b3a[_0x9cb7('0x2d')]()['then'](function(){var _0xce6686=_0x250b3a[_0x9cb7('0x2e')]({'plain':!![]});var _0x15c3e6=_0x9cb7('0x2f');return db[_0x9cb7('0x30')][_0x9cb7('0x2d')]({'where':{'type':_0x15c3e6,'resourceId':_0xce6686['id']}})[_0x9cb7('0x2c')](function(){return _0x250b3a;});})[_0x9cb7('0x2c')](function(){_0x387acc[_0x9cb7('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52eb40,_0x1a8eaf){return function(_0x54fc02){if(!_0x54fc02){_0x52eb40[_0x9cb7('0x21')](0x194);}return _0x54fc02;};}function handleError(_0x10d6b8,_0x444b3c){_0x444b3c=_0x444b3c||0x1f4;return function(_0x530f70){logger['error'](_0x530f70['stack']);if(_0x530f70[_0x9cb7('0x31')]){delete _0x530f70['name'];}_0x10d6b8[_0x9cb7('0x22')](_0x444b3c)[_0x9cb7('0x32')](_0x530f70);};}exports[_0x9cb7('0x33')]=function(_0x2fa5f7,_0x1b55d2){var _0x262216={},_0x32407e={},_0x1098aa={'count':0x0,'rows':[]};var _0x20459a=_[_0x9cb7('0x34')](db[_0x9cb7('0x35')][_0x9cb7('0x36')],function(_0x3d056d){return{'name':_0x3d056d['fieldName'],'type':_0x3d056d['type']['key']};});_0x32407e[_0x9cb7('0x37')]=_[_0x9cb7('0x34')](_0x20459a,_0x9cb7('0x31'));_0x32407e[_0x9cb7('0x38')]=_['keys'](_0x2fa5f7[_0x9cb7('0x38')]);_0x32407e[_0x9cb7('0x39')]=_[_0x9cb7('0x3a')](_0x32407e[_0x9cb7('0x37')],_0x32407e[_0x9cb7('0x38')]);_0x262216[_0x9cb7('0x3b')]=_[_0x9cb7('0x3a')](_0x32407e[_0x9cb7('0x37')],qs[_0x9cb7('0x3c')](_0x2fa5f7['query'][_0x9cb7('0x3c')]));_0x262216[_0x9cb7('0x3b')]=_0x262216[_0x9cb7('0x3b')][_0x9cb7('0x3d')]?_0x262216[_0x9cb7('0x3b')]:_0x32407e[_0x9cb7('0x37')];if(!_0x2fa5f7[_0x9cb7('0x38')]['hasOwnProperty']('nolimit')){_0x262216[_0x9cb7('0x26')]=qs['limit'](_0x2fa5f7[_0x9cb7('0x38')]['limit']);_0x262216[_0x9cb7('0x3e')]=qs[_0x9cb7('0x3e')](_0x2fa5f7['query']['offset']);}_0x262216['order']=qs[_0x9cb7('0x3f')](_0x2fa5f7[_0x9cb7('0x38')][_0x9cb7('0x3f')]);_0x262216[_0x9cb7('0x40')]=qs[_0x9cb7('0x39')](_['pick'](_0x2fa5f7[_0x9cb7('0x38')],_0x32407e[_0x9cb7('0x39')]),_0x20459a);if(_0x2fa5f7[_0x9cb7('0x38')][_0x9cb7('0x41')]){_0x262216['where']=_[_0x9cb7('0x42')](_0x262216[_0x9cb7('0x40')],{'$or':_['map'](_0x20459a,function(_0xc3236d){if(_0xc3236d[_0x9cb7('0x43')]!==_0x9cb7('0x44')){var _0x2ab458={};_0x2ab458[_0xc3236d['name']]={'$like':'%'+_0x2fa5f7['query'][_0x9cb7('0x41')]+'%'};return _0x2ab458;}})});}_0x262216=_[_0x9cb7('0x42')]({},_0x262216,_0x2fa5f7[_0x9cb7('0x45')]);var _0x230587={'where':_0x262216[_0x9cb7('0x40')]};return db[_0x9cb7('0x35')][_0x9cb7('0x25')](_0x230587)['then'](function(_0x464444){_0x1098aa[_0x9cb7('0x25')]=_0x464444;if(_0x2fa5f7[_0x9cb7('0x38')][_0x9cb7('0x46')]){_0x262216[_0x9cb7('0x47')]=[{'all':!![]}];}return db[_0x9cb7('0x35')]['findAll'](_0x262216);})[_0x9cb7('0x2c')](function(_0x49f380){_0x1098aa[_0x9cb7('0x48')]=_0x49f380;return _0x1098aa;})[_0x9cb7('0x2c')](respondWithFilteredResult(_0x1b55d2,_0x262216))[_0x9cb7('0x49')](handleError(_0x1b55d2,null));};exports[_0x9cb7('0x4a')]=function(_0x2f329f,_0x314b10){var _0x51a565={'raw':!![],'where':{'id':_0x2f329f[_0x9cb7('0x4b')]['id']}},_0x5b2076={};_0x5b2076[_0x9cb7('0x37')]=_[_0x9cb7('0x4c')](db['OpenchannelQueue'][_0x9cb7('0x36')]);_0x5b2076['query']=_[_0x9cb7('0x4c')](_0x2f329f[_0x9cb7('0x38')]);_0x5b2076[_0x9cb7('0x39')]=_['intersection'](_0x5b2076['model'],_0x5b2076['query']);_0x51a565['attributes']=_[_0x9cb7('0x3a')](_0x5b2076[_0x9cb7('0x37')],qs['fields'](_0x2f329f[_0x9cb7('0x38')][_0x9cb7('0x3c')]));_0x51a565['attributes']=_0x51a565['attributes'][_0x9cb7('0x3d')]?_0x51a565[_0x9cb7('0x3b')]:_0x5b2076[_0x9cb7('0x37')];if(_0x2f329f['query'][_0x9cb7('0x46')]){_0x51a565['include']=[{'all':!![]}];}_0x51a565=_[_0x9cb7('0x42')]({},_0x51a565,_0x2f329f[_0x9cb7('0x45')]);return db[_0x9cb7('0x35')][_0x9cb7('0x4d')](_0x51a565)[_0x9cb7('0x2c')](handleEntityNotFound(_0x314b10,null))[_0x9cb7('0x2c')](respondWithResult(_0x314b10,null))[_0x9cb7('0x49')](handleError(_0x314b10,null));};exports['create']=function(_0x26cb66,_0xf6a2eb){return db[_0x9cb7('0x35')][_0x9cb7('0x4e')](_0x26cb66[_0x9cb7('0x4f')],{})['then'](function(_0x22b3c3){var _0x39b055=_0x26cb66[_0x9cb7('0x50')][_0x9cb7('0x2e')]({'plain':!![]});if(!_0x39b055)throw new Error(_0x9cb7('0x51'));if(_0x39b055['role']===_0x9cb7('0x50')){var _0x38f76f=_0x22b3c3[_0x9cb7('0x2e')]({'plain':!![]});var _0x56edeb=_0x9cb7('0x2f');return db[_0x9cb7('0x52')]['find']({'where':{'name':_0x56edeb,'userProfileId':_0x39b055[_0x9cb7('0x53')]},'raw':!![]})[_0x9cb7('0x2c')](function(_0x1b5430){if(_0x1b5430&&_0x1b5430[_0x9cb7('0x54')]===0x0){return db['UserProfileResource'][_0x9cb7('0x4e')]({'name':_0x38f76f[_0x9cb7('0x31')],'resourceId':_0x38f76f['id'],'type':_0x1b5430[_0x9cb7('0x31')],'sectionId':_0x1b5430['id']},{})[_0x9cb7('0x2c')](function(){return _0x22b3c3;});}else{return _0x22b3c3;}})['catch'](function(_0x4973b4){logger[_0x9cb7('0x55')](_0x9cb7('0x56'),_0x4973b4);throw _0x4973b4;});}return _0x22b3c3;})['then'](respondWithResult(_0xf6a2eb,0xc9))[_0x9cb7('0x49')](handleError(_0xf6a2eb,null));};exports[_0x9cb7('0x2b')]=function(_0x3951c3,_0x480a4c){if(_0x3951c3[_0x9cb7('0x4f')]['id']){delete _0x3951c3['body']['id'];}return db[_0x9cb7('0x35')][_0x9cb7('0x4d')]({'where':{'id':_0x3951c3['params']['id']}})[_0x9cb7('0x2c')](handleEntityNotFound(_0x480a4c,null))['then'](saveUpdates(_0x3951c3[_0x9cb7('0x4f')],null))['then'](respondWithResult(_0x480a4c,null))[_0x9cb7('0x49')](handleError(_0x480a4c,null));};exports[_0x9cb7('0x2d')]=function(_0x1a0fcc,_0x340f01){return db[_0x9cb7('0x35')][_0x9cb7('0x4d')]({'where':{'id':_0x1a0fcc['params']['id']}})['then'](handleEntityNotFound(_0x340f01,null))['then'](removeEntity(_0x340f01,null))[_0x9cb7('0x49')](handleError(_0x340f01,null));};exports[_0x9cb7('0x57')]=function(_0x30565f,_0x39760f){return db[_0x9cb7('0x35')][_0x9cb7('0x57')]()[_0x9cb7('0x2c')](respondWithResult(_0x39760f,null))[_0x9cb7('0x49')](handleError(_0x39760f,null));};exports[_0x9cb7('0x58')]=function(_0x6cb2af,_0x51cead,_0x1bb4b7){var _0x42c86e={'raw':!![],'where':{}},_0x26e9fc={},_0x1d2520;return db[_0x9cb7('0x35')][_0x9cb7('0x59')]({'where':{'id':_0x6cb2af['params']['id']}})['then'](handleEntityNotFound(_0x51cead,null))['then'](function(_0x473ab4){if(_0x473ab4){_0x1d2520=_0x473ab4[_0x9cb7('0x2e')]({'plain':!![]});_0x26e9fc['model']=_[_0x9cb7('0x4c')](db[_0x9cb7('0x5a')][_0x9cb7('0x36')]);_0x26e9fc['query']=_[_0x9cb7('0x4c')](_0x6cb2af['query']);_0x26e9fc[_0x9cb7('0x39')]=_['intersection'](_0x26e9fc[_0x9cb7('0x37')],_0x26e9fc[_0x9cb7('0x38')]);_0x42c86e[_0x9cb7('0x3b')]=_[_0x9cb7('0x3a')](_0x26e9fc[_0x9cb7('0x37')],qs[_0x9cb7('0x3c')](_0x6cb2af[_0x9cb7('0x38')][_0x9cb7('0x3c')]));_0x42c86e[_0x9cb7('0x3b')]=_0x42c86e[_0x9cb7('0x3b')][_0x9cb7('0x3d')]?_0x42c86e['attributes']:_0x26e9fc[_0x9cb7('0x37')];if(!_0x6cb2af[_0x9cb7('0x38')]['hasOwnProperty'](_0x9cb7('0x5b'))){_0x42c86e[_0x9cb7('0x26')]=qs['limit'](_0x6cb2af[_0x9cb7('0x38')][_0x9cb7('0x26')]);_0x42c86e['offset']=qs['offset'](_0x6cb2af['query']['offset']);}_0x42c86e[_0x9cb7('0x5c')]=qs[_0x9cb7('0x3f')](_0x6cb2af[_0x9cb7('0x38')][_0x9cb7('0x3f')]);_0x42c86e['where']=qs['filters'](_[_0x9cb7('0x5d')](_0x6cb2af[_0x9cb7('0x38')],_0x26e9fc[_0x9cb7('0x39')]));_0x42c86e['where'][_0x9cb7('0x5e')]=_0x473ab4['id'];if(_0x6cb2af['query']['filter']){_0x42c86e['where']=_[_0x9cb7('0x42')](_0x42c86e[_0x9cb7('0x40')],{'$or':_[_0x9cb7('0x34')](_0x42c86e['attributes'],function(_0x1096a7){var _0x3e5d35={};_0x3e5d35[_0x1096a7]={'$like':'%'+_0x6cb2af[_0x9cb7('0x38')][_0x9cb7('0x41')]+'%'};return _0x3e5d35;})});}_0x42c86e=_[_0x9cb7('0x42')]({},_0x42c86e,_0x6cb2af[_0x9cb7('0x45')]);return db[_0x9cb7('0x5a')][_0x9cb7('0x5f')](_0x42c86e);}})[_0x9cb7('0x2c')](function(_0x5ca827){if(_0x5ca827){return db[_0x9cb7('0x60')][_0x9cb7('0x61')]({'where':{'id':_[_0x9cb7('0x34')](_0x5ca827,_0x9cb7('0x62')),'role':_0x9cb7('0x63')},'attributes':['id',_0x9cb7('0x31'),_0x9cb7('0x64'),_0x9cb7('0x65'),_0x9cb7('0x66')]});}})[_0x9cb7('0x2c')](function(_0x293415){if(_0x293415){return{'count':_0x293415[_0x9cb7('0x25')],'rows':_[_0x9cb7('0x34')](_0x293415['rows'],function(_0xcaeaea){return{'membername':_0xcaeaea[_0x9cb7('0x31')],'UserId':_0xcaeaea['id'],'queue_name':_0x1d2520[_0x9cb7('0x31')],'OpenchannelQueueId':_0x1d2520['id'],'interface':util[_0x9cb7('0x67')](_0x9cb7('0x68'),'SIP',_0xcaeaea[_0x9cb7('0x31')]),'penalty':0x0,'paused':_0xcaeaea[_0x9cb7('0x64')],'createdAt':_0xcaeaea[_0x9cb7('0x66')],'updatedAt':_0xcaeaea[_0x9cb7('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9cb7('0x2c')](respondWithFilteredResult(_0x51cead,_0x42c86e))[_0x9cb7('0x49')](handleError(_0x51cead,null));};exports[_0x9cb7('0x69')]=function(_0x54fd76,_0x93537b,_0x5a6b15){var _0x38c8dc={};var _0x5e5ea5={};var _0xf7a72d;var _0x1eb3a0;return db[_0x9cb7('0x35')][_0x9cb7('0x59')]({'where':{'id':_0x54fd76[_0x9cb7('0x4b')]['id']}})[_0x9cb7('0x2c')](handleEntityNotFound(_0x93537b,null))[_0x9cb7('0x2c')](function(_0x33032d){if(_0x33032d){_0xf7a72d=_0x33032d;_0x5e5ea5[_0x9cb7('0x37')]=_[_0x9cb7('0x4c')](db[_0x9cb7('0x6a')][_0x9cb7('0x36')]);_0x5e5ea5[_0x9cb7('0x38')]=_[_0x9cb7('0x4c')](_0x54fd76[_0x9cb7('0x38')]);_0x5e5ea5[_0x9cb7('0x39')]=_[_0x9cb7('0x3a')](_0x5e5ea5['model'],_0x5e5ea5[_0x9cb7('0x38')]);_0x38c8dc[_0x9cb7('0x3b')]=_['intersection'](_0x5e5ea5[_0x9cb7('0x37')],qs[_0x9cb7('0x3c')](_0x54fd76[_0x9cb7('0x38')]['fields']));_0x38c8dc[_0x9cb7('0x3b')]=_0x38c8dc[_0x9cb7('0x3b')][_0x9cb7('0x3d')]?_0x38c8dc[_0x9cb7('0x3b')]:_0x5e5ea5[_0x9cb7('0x37')];_0x38c8dc[_0x9cb7('0x5c')]=qs[_0x9cb7('0x3f')](_0x54fd76['query']['sort']);_0x38c8dc[_0x9cb7('0x40')]=qs[_0x9cb7('0x39')](_[_0x9cb7('0x5d')](_0x54fd76[_0x9cb7('0x38')],_0x5e5ea5[_0x9cb7('0x39')]));if(_0x54fd76[_0x9cb7('0x38')][_0x9cb7('0x41')]){_0x38c8dc[_0x9cb7('0x40')]=_['merge'](_0x38c8dc['where'],{'$or':_[_0x9cb7('0x34')](_0x38c8dc[_0x9cb7('0x3b')],function(_0x4e2f6a){var _0x58bd64={};_0x58bd64[_0x4e2f6a]={'$like':'%'+_0x54fd76[_0x9cb7('0x38')]['filter']+'%'};return _0x58bd64;})});}_0x38c8dc=_[_0x9cb7('0x42')]({},_0x38c8dc,_0x54fd76[_0x9cb7('0x45')]);return _0xf7a72d['getTeams'](_0x38c8dc);}})[_0x9cb7('0x2c')](function(_0xda6132){if(_0xda6132){_0x1eb3a0=_0xda6132[_0x9cb7('0x3d')];if(!_0x54fd76['query'][_0x9cb7('0x6b')](_0x9cb7('0x5b'))){_0x38c8dc[_0x9cb7('0x26')]=qs[_0x9cb7('0x26')](_0x54fd76[_0x9cb7('0x38')][_0x9cb7('0x26')]);_0x38c8dc[_0x9cb7('0x3e')]=qs[_0x9cb7('0x3e')](_0x54fd76['query'][_0x9cb7('0x3e')]);}return _0xf7a72d['getTeams'](_0x38c8dc);}})[_0x9cb7('0x2c')](function(_0x49eec5){if(_0x49eec5){return _0x49eec5?{'count':_0x1eb3a0,'rows':_0x49eec5}:null;}})['then'](respondWithResult(_0x93537b,null))['catch'](handleError(_0x93537b,null));};exports[_0x9cb7('0x6c')]=function(_0xf91f27,_0x39cd81,_0x3e58b1){var _0xe424fc=_0xf91f27[_0x9cb7('0x4f')][_0x9cb7('0x6d')];return db[_0x9cb7('0x6a')][_0x9cb7('0x5f')]({'where':{'id':_0xe424fc},'attributes':['id'],'include':[{'model':db[_0x9cb7('0x60')],'as':'Agents','attributes':['id',_0x9cb7('0x31'),_0x9cb7('0x6e'),_0x9cb7('0x6f'),_0x9cb7('0x70')],'raw':!![]}]})[_0x9cb7('0x2c')](function(_0x44b69a){if(_0x44b69a){var _0x49d69f=_[_0x9cb7('0x71')](_0x44b69a,function(_0x4ed938){var _0x227aa7=_0x4ed938[_0x9cb7('0x2e')]({'plain':!![]});return _0x227aa7['Agents'];});return db[_0x9cb7('0x35')][_0x9cb7('0x4d')]({'where':{'id':_0xf91f27[_0x9cb7('0x4b')]['id']}})[_0x9cb7('0x2c')](function(_0x3bb71a){return db[_0x9cb7('0x72')][_0x9cb7('0x73')](function(_0x512c67){return _0x3bb71a[_0x9cb7('0x6c')](_0xe424fc,{'transaction':_0x512c67})[_0x9cb7('0x2c')](function(){return BPromise[_0x9cb7('0x74')](_0x49d69f,function(_0x611cf){return db[_0x9cb7('0x5a')]['findOrCreate']({'where':{'UserId':_0x611cf['id'],'OpenchannelQueueId':_0xf91f27[_0x9cb7('0x4b')]['id']},'transaction':_0x512c67});});})[_0x9cb7('0x2c')](function(){_0x49d69f[_0x9cb7('0x75')](function(_0x5e3a8f){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x5e3a8f['id'],'OpenchannelQueueId':_0x3bb71a['id']});});});});});}})[_0x9cb7('0x2c')](respondWithStatusCode(_0x39cd81,null))[_0x9cb7('0x49')](handleError(_0x39cd81,null));};exports[_0x9cb7('0x76')]=function(_0xac3b1a,_0x3c4cb7,_0x39cc19){return db[_0x9cb7('0x6a')][_0x9cb7('0x5f')]({'where':{'id':_0xac3b1a['query'][_0x9cb7('0x6d')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3c4cb7,null))[_0x9cb7('0x2c')](function(_0x5331a8){var _0x2abf51=_['map'](_0x5331a8,'id');var _0x4b84eb=[];var _0x481be1=[];var _0x353847=squel['select']();_0x353847[_0x9cb7('0x77')](_0x9cb7('0x78'))['from']('team_has_openchannel_queues','tq')[_0x9cb7('0x79')](_0x9cb7('0x7a'),'ut',_0x9cb7('0x7b'))[_0x9cb7('0x40')](_0x9cb7('0x7c'),_0xac3b1a[_0x9cb7('0x4b')]['id']);for(var _0x17e168=0x0;_0x17e168<_0x5331a8[_0x9cb7('0x3d')];_0x17e168+=0x1){let _0x2a1206=_0x5331a8[_0x17e168];for(var _0x635ce7=0x0;_0x635ce7<_0x2a1206[_0x9cb7('0x7d')][_0x9cb7('0x3d')];_0x635ce7+=0x1){let _0x432073=_0x2a1206['Agents'][_0x635ce7];var _0x583b2c=_0x353847[_0x9cb7('0x7e')]();_0x583b2c[_0x9cb7('0x40')](_0x9cb7('0x7f'),_0x432073['id']);_0x481be1[_0x9cb7('0x80')](db[_0x9cb7('0x72')]['query'](_0x583b2c[_0x9cb7('0x81')](),{'type':db[_0x9cb7('0x72')][_0x9cb7('0x82')]['SELECT']})[_0x9cb7('0x2c')](function(_0x58c20e){if(_0x58c20e[_0x9cb7('0x3d')]===0x1){return _0x432073['id'];}else{var _0x31afca=_[_0x9cb7('0x83')](_['map'](_0x58c20e,_0x9cb7('0x84')),function(_0x325c9a){return _[_0x9cb7('0x85')](_0x2abf51,_0x325c9a);});if(_0x31afca){return _0x432073['id'];}}}));}}return BPromise[_0x9cb7('0x86')](_0x481be1)[_0x9cb7('0x2c')](function(_0x5dda50){_0x4b84eb=_(_0x4b84eb)[_0x9cb7('0x87')](_0x5dda50)[_0x9cb7('0x88')]()[_0x9cb7('0x89')]();return db[_0x9cb7('0x35')]['find']({'where':{'id':_0xac3b1a[_0x9cb7('0x4b')]['id']}})[_0x9cb7('0x2c')](function(_0x2bfdb3){return db[_0x9cb7('0x72')][_0x9cb7('0x73')](function(_0x28574f){return _0x2bfdb3['removeTeams'](_0xac3b1a[_0x9cb7('0x38')]['ids'],{'transaction':_0x28574f})[_0x9cb7('0x2c')](function(){if(!_['isEmpty'](_0x4b84eb)){return _0x2bfdb3['removeAgents'](_0x4b84eb,{'transaction':_0x28574f});}})[_0x9cb7('0x2c')](function(){_0x4b84eb['forEach'](function(_0x560bcc){socket[_0x9cb7('0x8a')](_0x9cb7('0x8b'),{'UserId':_0x560bcc,'OpenchannelQueueId':_0x2bfdb3['id']});});});});});});})[_0x9cb7('0x2c')](respondWithStatusCode(_0x3c4cb7,null))[_0x9cb7('0x49')](handleError(_0x3c4cb7,null));};exports[_0x9cb7('0x8c')]=function(_0x2cc734,_0x172d31,_0x27a57d){return db[_0x9cb7('0x35')][_0x9cb7('0x4d')]({'where':{'id':_0x2cc734[_0x9cb7('0x4b')]['id']}})[_0x9cb7('0x2c')](handleEntityNotFound(_0x172d31,null))[_0x9cb7('0x2c')](function(_0x5dabcb){if(_0x5dabcb){return _0x5dabcb[_0x9cb7('0x8c')](_0x2cc734[_0x9cb7('0x4f')][_0x9cb7('0x6d')],_[_0x9cb7('0x8d')](_0x2cc734['body'],[_0x9cb7('0x6d'),'id'])||{})[_0x9cb7('0x8e')](function(_0x4675ff){for(var _0x16f1e5=0x0;_0x16f1e5<_0x2cc734[_0x9cb7('0x4f')]['ids'][_0x9cb7('0x3d')];_0x16f1e5+=0x1){socket[_0x9cb7('0x8a')](_0x9cb7('0x8f'),{'UserId':Number(_0x2cc734[_0x9cb7('0x4f')]['ids'][_0x16f1e5]),'OpenchannelQueueId':Number(_0x2cc734[_0x9cb7('0x4b')]['id'])});}return _0x4675ff;});}})[_0x9cb7('0x2c')](respondWithResult(_0x172d31,null))[_0x9cb7('0x49')](handleError(_0x172d31,null));};exports[_0x9cb7('0x90')]=function(_0x3ac9a0,_0x3118bc,_0x2af957){return db[_0x9cb7('0x35')][_0x9cb7('0x4d')]({'where':{'id':_0x3ac9a0[_0x9cb7('0x4b')]['id']}})[_0x9cb7('0x2c')](handleEntityNotFound(_0x3118bc,null))['then'](function(_0x20f1bb){if(_0x20f1bb){return _0x20f1bb['removeAgents'](_0x3ac9a0[_0x9cb7('0x38')][_0x9cb7('0x6d')])['then'](function(){if(_[_0x9cb7('0x91')](_0x3ac9a0['query'][_0x9cb7('0x6d')])){for(var _0x525c9f=0x0;_0x525c9f<_0x3ac9a0[_0x9cb7('0x38')][_0x9cb7('0x6d')]['length'];_0x525c9f+=0x1){socket[_0x9cb7('0x8a')](_0x9cb7('0x8b'),{'UserId':Number(_0x3ac9a0[_0x9cb7('0x38')][_0x9cb7('0x6d')][_0x525c9f]),'OpenchannelQueueId':Number(_0x3ac9a0[_0x9cb7('0x4b')]['id'])});}}else{socket[_0x9cb7('0x8a')]('userOpenchannelQueue:remove',{'UserId':Number(_0x3ac9a0['query'][_0x9cb7('0x6d')]),'OpenchannelQueueId':Number(_0x3ac9a0[_0x9cb7('0x4b')]['id'])});}});}})[_0x9cb7('0x2c')](respondWithStatusCode(_0x3118bc,null))['catch'](handleError(_0x3118bc,null));};exports['getAgents']=function(_0x51e017,_0x1fdc6e,_0x1ddd89){var _0x3ec4bd={};var _0x9eebd3={};var _0x4c7fe7;var _0x106ff0;return db['OpenchannelQueue'][_0x9cb7('0x59')]({'where':{'id':_0x51e017[_0x9cb7('0x4b')]['id']}})[_0x9cb7('0x2c')](handleEntityNotFound(_0x1fdc6e,null))[_0x9cb7('0x2c')](function(_0x529e61){if(_0x529e61){_0x4c7fe7=_0x529e61;_0x9eebd3[_0x9cb7('0x37')]=_[_0x9cb7('0x4c')](db[_0x9cb7('0x60')]['rawAttributes']);_0x9eebd3['query']=_[_0x9cb7('0x4c')](_0x51e017['query']);_0x9eebd3[_0x9cb7('0x39')]=_[_0x9cb7('0x3a')](_0x9eebd3[_0x9cb7('0x37')],_0x9eebd3[_0x9cb7('0x38')]);_0x3ec4bd[_0x9cb7('0x3b')]=_[_0x9cb7('0x3a')](_0x9eebd3[_0x9cb7('0x37')],qs['fields'](_0x51e017['query'][_0x9cb7('0x3c')]));_0x3ec4bd[_0x9cb7('0x3b')]=_0x3ec4bd[_0x9cb7('0x3b')][_0x9cb7('0x3d')]?_0x3ec4bd[_0x9cb7('0x3b')]:_0x9eebd3[_0x9cb7('0x37')];_0x3ec4bd[_0x9cb7('0x5c')]=qs[_0x9cb7('0x3f')](_0x51e017[_0x9cb7('0x38')]['sort']);_0x3ec4bd['where']=qs[_0x9cb7('0x39')](_[_0x9cb7('0x5d')](_0x51e017['query'],_0x9eebd3[_0x9cb7('0x39')]));if(_0x51e017[_0x9cb7('0x38')]['filter']){_0x3ec4bd[_0x9cb7('0x40')]=_[_0x9cb7('0x42')](_0x3ec4bd[_0x9cb7('0x40')],{'$or':_['map'](_0x3ec4bd[_0x9cb7('0x3b')],function(_0x40a079){var _0x4c469b={};_0x4c469b[_0x40a079]={'$like':'%'+_0x51e017[_0x9cb7('0x38')][_0x9cb7('0x41')]+'%'};return _0x4c469b;})});}_0x3ec4bd=_[_0x9cb7('0x42')]({},_0x3ec4bd,_0x51e017[_0x9cb7('0x45')]);return _0x4c7fe7[_0x9cb7('0x92')](_0x3ec4bd);}})[_0x9cb7('0x2c')](function(_0x1c3e4b){if(_0x1c3e4b){_0x106ff0=_0x1c3e4b[_0x9cb7('0x3d')];if(!_0x51e017['query'][_0x9cb7('0x6b')](_0x9cb7('0x5b'))){_0x3ec4bd[_0x9cb7('0x26')]=qs[_0x9cb7('0x26')](_0x51e017['query'][_0x9cb7('0x26')]);_0x3ec4bd[_0x9cb7('0x3e')]=qs[_0x9cb7('0x3e')](_0x51e017['query'][_0x9cb7('0x3e')]);}return _0x4c7fe7[_0x9cb7('0x92')](_0x3ec4bd);}})[_0x9cb7('0x2c')](function(_0x4885e7){if(_0x4885e7){return _0x4885e7?{'count':_0x106ff0,'rows':_0x4885e7}:null;}})['then'](respondWithResult(_0x1fdc6e,null))[_0x9cb7('0x49')](handleError(_0x1fdc6e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 8f672d8..08de8f3 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 _0x1c68=['OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x162d33,_0x49b23d){var _0x55fa06=function(_0x45c4af){while(--_0x45c4af){_0x162d33['push'](_0x162d33['shift']());}};_0x55fa06(++_0x49b23d);}(_0x1c68,0x6c));var _0x81c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c68[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db'][_0x81c6('0x0')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x81c6('0x1')](0x0);var events={'afterCreate':_0x81c6('0x2'),'afterUpdate':_0x81c6('0x3'),'afterDestroy':_0x81c6('0x4')};function emitEvent(_0x271e59){return function(_0x384130,_0x106414,_0x1db5d3){OpenchannelQueueEvents[_0x81c6('0x5')](_0x271e59+':'+_0x384130['id'],_0x384130);OpenchannelQueueEvents[_0x81c6('0x5')](_0x271e59,_0x384130);_0x1db5d3(null);};}for(var e in events){if(events[_0x81c6('0x6')](e)){var event=events[e];OpenchannelQueue[_0x81c6('0x7')](e,emitEvent(event));}}module[_0x81c6('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xddfe=['OpenchannelQueue','setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xddfe,0x1ee));var _0xeddf=function(_0x347cd9,_0x5ee8c3){_0x347cd9=_0x347cd9-0x0;var _0x3bba5a=_0xddfe[_0x347cd9];return _0x3bba5a;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xeddf('0x0'))['db'][_0xeddf('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xeddf('0x2')](0x0);var events={'afterCreate':_0xeddf('0x3'),'afterUpdate':_0xeddf('0x4'),'afterDestroy':_0xeddf('0x5')};function emitEvent(_0x5a8ef2){return function(_0x43843e,_0x58edf2,_0x4e018a){OpenchannelQueueEvents[_0xeddf('0x6')](_0x5a8ef2+':'+_0x43843e['id'],_0x43843e);OpenchannelQueueEvents[_0xeddf('0x6')](_0x5a8ef2,_0x43843e);_0x4e018a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xeddf('0x7')](e,emitEvent(event));}}module[_0xeddf('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 550c817..e381cc6 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 _0x7bad=['define','OpenchannelQueue','util','bluebird','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0x7bad,0x8e));var _0xd7ba=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0x7bad[_0x5d30b4];return _0x1acfb8;};'use strict';var _=require('lodash');var util=require(_0xd7ba('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd7ba('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd7ba('0x2'));var attributes=require(_0xd7ba('0x3'));module[_0xd7ba('0x4')]=function(_0x1b796c,_0x1294ee){return _0x1b796c[_0xd7ba('0x5')](_0xd7ba('0x6'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacb7=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','util'];(function(_0x5e4cf8,_0x5f2417){var _0x8f3b7c=function(_0x5b6e1b){while(--_0x5b6e1b){_0x5e4cf8['push'](_0x5e4cf8['shift']());}};_0x8f3b7c(++_0x5f2417);}(_0xacb7,0x1c7));var _0x7acb=function(_0x353d59,_0x30d5c6){_0x353d59=_0x353d59-0x0;var _0x549b80=_0xacb7[_0x353d59];return _0x549b80;};'use strict';var _=require('lodash');var util=require(_0x7acb('0x0'));var logger=require(_0x7acb('0x1'))(_0x7acb('0x2'));var moment=require(_0x7acb('0x3'));var BPromise=require(_0x7acb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7acb('0x5'));var config=require(_0x7acb('0x6'));var attributes=require(_0x7acb('0x7'));module[_0x7acb('0x8')]=function(_0x2e2ce8,_0x35c9b2){return _0x2e2ce8[_0x7acb('0x9')](_0x7acb('0xa'),attributes,{'tableName':_0x7acb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 6e5e5ff..6545a9d 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 _0x9304=['findAll','options','where','limit','include','attributes','map','model','debug','find','raw','then','ShowOpenchannelQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9304,0x8b));var _0x4930=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9304[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4930('0x0'));var util=require('util');var moment=require(_0x4930('0x1'));var BPromise=require(_0x4930('0x2'));var rs=require(_0x4930('0x3'));var fs=require('fs');var Redis=require(_0x4930('0x4'));var db=require(_0x4930('0x5'))['db'];var utils=require(_0x4930('0x6'));var logger=require(_0x4930('0x7'))(_0x4930('0x8'));var config=require('../../config/environment');var jayson=require(_0x4930('0x9'));var client=jayson[_0x4930('0xa')][_0x4930('0xb')]({'port':0x232a});config[_0x4930('0xc')]=_['defaults'](config[_0x4930('0xc')],{'host':_0x4930('0xd'),'port':0x18eb});var socket=require(_0x4930('0xe'))(new Redis(config['redis']));require(_0x4930('0xf'))[_0x4930('0x10')](socket);function respondWithRpcPromise(_0x19aa4c,_0x10b3ba,_0x3cfcc8){return new BPromise(function(_0x1381d7,_0x23e95a){return client[_0x4930('0x11')](_0x19aa4c,_0x3cfcc8)['then'](function(_0x5a8a1c){logger[_0x4930('0x12')](_0x4930('0x13'),_0x10b3ba,'request\x20sent');logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x10b3ba,_0x4930('0x14'),JSON[_0x4930('0x15')](_0x5a8a1c));if(_0x5a8a1c[_0x4930('0x16')]){if(_0x5a8a1c[_0x4930('0x16')][_0x4930('0x17')]===0x1f4){logger[_0x4930('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x10b3ba,_0x5a8a1c['error'][_0x4930('0x18')]);return _0x23e95a(_0x5a8a1c[_0x4930('0x16')][_0x4930('0x18')]);}logger['error'](_0x4930('0x13'),_0x10b3ba,_0x5a8a1c['error'][_0x4930('0x18')]);return _0x1381d7(_0x5a8a1c[_0x4930('0x16')]['message']);}else{logger[_0x4930('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x10b3ba,'request\x20sent');_0x1381d7(_0x5a8a1c[_0x4930('0x19')][_0x4930('0x18')]);}})[_0x4930('0x1a')](function(_0x245875){logger[_0x4930('0x16')](_0x4930('0x13'),_0x10b3ba,_0x245875);_0x23e95a(_0x245875);});});}exports[_0x4930('0x1b')]=function(_0x27017b){var _0x3a9bd2=this;return new Promise(function(_0x38cdb4,_0x5dde3e){return db[_0x4930('0x1c')][_0x4930('0x1d')]({'raw':_0x27017b[_0x4930('0x1e')]?_0x27017b[_0x4930('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x27017b[_0x4930('0x1e')]?_0x27017b[_0x4930('0x1e')][_0x4930('0x1f')]||null:null,'attributes':_0x27017b[_0x4930('0x1e')]?_0x27017b[_0x4930('0x1e')]['attributes']||null:null,'limit':_0x27017b['options']?_0x27017b[_0x4930('0x1e')][_0x4930('0x20')]||null:null,'include':_0x27017b[_0x4930('0x1e')]?_0x27017b[_0x4930('0x1e')][_0x4930('0x21')]?_['map'](_0x27017b[_0x4930('0x1e')][_0x4930('0x21')],function(_0x41efc8){return{'model':db[_0x41efc8['model']],'as':_0x41efc8['as'],'attributes':_0x41efc8[_0x4930('0x22')],'include':_0x41efc8[_0x4930('0x21')]?_[_0x4930('0x23')](_0x41efc8['include'],function(_0x175e8f){return{'model':db[_0x175e8f[_0x4930('0x24')]],'as':_0x175e8f['as'],'attributes':_0x175e8f[_0x4930('0x22')],'include':_0x175e8f['include']?_[_0x4930('0x23')](_0x175e8f['include'],function(_0x25d355){return{'model':db[_0x25d355[_0x4930('0x24')]],'as':_0x25d355['as'],'attributes':_0x25d355[_0x4930('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6e7b1b){logger['info']('GetOpenchannelQueue',_0x27017b);logger[_0x4930('0x25')](_0x4930('0x1b'),_0x27017b,JSON[_0x4930('0x15')](_0x6e7b1b));_0x38cdb4(_0x6e7b1b);})[_0x4930('0x1a')](function(_0x32589c){logger[_0x4930('0x16')](_0x4930('0x1b'),_0x32589c[_0x4930('0x18')],_0x27017b);_0x5dde3e(_0x3a9bd2[_0x4930('0x16')](0x1f4,_0x32589c['message']));});});};exports['ShowOpenchannelQueue']=function(_0x11da49){var _0x2414e4=this;return new Promise(function(_0x3900bc,_0x241f06){return db[_0x4930('0x1c')][_0x4930('0x26')]({'raw':_0x11da49[_0x4930('0x1e')]?_0x11da49['options'][_0x4930('0x27')]===undefined?!![]:![]:!![],'where':_0x11da49[_0x4930('0x1e')]?_0x11da49['options'][_0x4930('0x1f')]||null:null,'attributes':_0x11da49[_0x4930('0x1e')]?_0x11da49[_0x4930('0x1e')][_0x4930('0x22')]||null:null,'include':_0x11da49[_0x4930('0x1e')]?_0x11da49[_0x4930('0x1e')]['include']?_['map'](_0x11da49[_0x4930('0x1e')][_0x4930('0x21')],function(_0x48daa5){return{'model':db[_0x48daa5[_0x4930('0x24')]],'as':_0x48daa5['as'],'attributes':_0x48daa5[_0x4930('0x22')],'include':_0x48daa5[_0x4930('0x21')]?_['map'](_0x48daa5['include'],function(_0x1d789c){return{'model':db[_0x1d789c[_0x4930('0x24')]],'as':_0x1d789c['as'],'attributes':_0x1d789c[_0x4930('0x22')],'include':_0x1d789c[_0x4930('0x21')]?_['map'](_0x1d789c[_0x4930('0x21')],function(_0x48220f){return{'model':db[_0x48220f[_0x4930('0x24')]],'as':_0x48220f['as'],'attributes':_0x48220f[_0x4930('0x22')]};}):[]};}):[]};}):[]:[]})[_0x4930('0x28')](function(_0x2f2da7){logger[_0x4930('0x12')](_0x4930('0x29'),_0x11da49);logger[_0x4930('0x25')](_0x4930('0x29'),_0x11da49,JSON['stringify'](_0x2f2da7));_0x3900bc(_0x2f2da7);})['catch'](function(_0x11fa1c){logger[_0x4930('0x16')](_0x4930('0x29'),_0x11fa1c['message'],_0x11da49);_0x241f06(_0x2414e4['error'](0x1f4,_0x11fa1c[_0x4930('0x18')]));});});}; \ No newline at end of file +var _0xf95d=['findAll','options','raw','where','limit','include','map','model','attributes','find','ShowOpenchannelQueue','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./openchannelQueue.socket','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueue,\x20%s,\x20%s','message','result','GetOpenchannelQueue','OpenchannelQueue'];(function(_0x234c0a,_0x682242){var _0x1f6cc2=function(_0x28fa42){while(--_0x28fa42){_0x234c0a['push'](_0x234c0a['shift']());}};_0x1f6cc2(++_0x682242);}(_0xf95d,0x1c8));var _0xdf95=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xf95d[_0x4b2863];return _0x567d67;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xdf95('0x0'));var rs=require(_0xdf95('0x1'));var fs=require('fs');var Redis=require(_0xdf95('0x2'));var db=require(_0xdf95('0x3'))['db'];var utils=require(_0xdf95('0x4'));var logger=require(_0xdf95('0x5'))(_0xdf95('0x6'));var config=require(_0xdf95('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdf95('0x8')]({'port':0x232a});config[_0xdf95('0x9')]=_[_0xdf95('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xdf95('0xb'))(new Redis(config[_0xdf95('0x9')]));require(_0xdf95('0xc'))['register'](socket);function respondWithRpcPromise(_0x4c1329,_0x22bd36,_0x158494){return new BPromise(function(_0x58d6eb,_0x3aba12){return client['request'](_0x4c1329,_0x158494)[_0xdf95('0xd')](function(_0x6d2aad){logger[_0xdf95('0xe')]('OpenchannelQueue,\x20%s,\x20%s',_0x22bd36,_0xdf95('0xf'));logger[_0xdf95('0x10')](_0xdf95('0x11'),_0x22bd36,_0xdf95('0xf'),JSON[_0xdf95('0x12')](_0x6d2aad));if(_0x6d2aad['error']){if(_0x6d2aad[_0xdf95('0x13')]['code']===0x1f4){logger[_0xdf95('0x13')](_0xdf95('0x14'),_0x22bd36,_0x6d2aad[_0xdf95('0x13')][_0xdf95('0x15')]);return _0x3aba12(_0x6d2aad['error'][_0xdf95('0x15')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x22bd36,_0x6d2aad[_0xdf95('0x13')][_0xdf95('0x15')]);return _0x58d6eb(_0x6d2aad[_0xdf95('0x13')][_0xdf95('0x15')]);}else{logger['info'](_0xdf95('0x14'),_0x22bd36,_0xdf95('0xf'));_0x58d6eb(_0x6d2aad[_0xdf95('0x16')][_0xdf95('0x15')]);}})['catch'](function(_0x3bede1){logger[_0xdf95('0x13')](_0xdf95('0x14'),_0x22bd36,_0x3bede1);_0x3aba12(_0x3bede1);});});}exports[_0xdf95('0x17')]=function(_0x2fb850){var _0x4f6f5c=this;return new Promise(function(_0x276395,_0x3edbe6){return db[_0xdf95('0x18')][_0xdf95('0x19')]({'raw':_0x2fb850[_0xdf95('0x1a')]?_0x2fb850[_0xdf95('0x1a')][_0xdf95('0x1b')]===undefined?!![]:![]:!![],'where':_0x2fb850[_0xdf95('0x1a')]?_0x2fb850['options'][_0xdf95('0x1c')]||null:null,'attributes':_0x2fb850[_0xdf95('0x1a')]?_0x2fb850['options']['attributes']||null:null,'limit':_0x2fb850[_0xdf95('0x1a')]?_0x2fb850[_0xdf95('0x1a')][_0xdf95('0x1d')]||null:null,'include':_0x2fb850[_0xdf95('0x1a')]?_0x2fb850['options'][_0xdf95('0x1e')]?_[_0xdf95('0x1f')](_0x2fb850[_0xdf95('0x1a')][_0xdf95('0x1e')],function(_0x2dfdaf){return{'model':db[_0x2dfdaf[_0xdf95('0x20')]],'as':_0x2dfdaf['as'],'attributes':_0x2dfdaf['attributes'],'include':_0x2dfdaf[_0xdf95('0x1e')]?_[_0xdf95('0x1f')](_0x2dfdaf[_0xdf95('0x1e')],function(_0x2460e9){return{'model':db[_0x2460e9['model']],'as':_0x2460e9['as'],'attributes':_0x2460e9[_0xdf95('0x21')],'include':_0x2460e9[_0xdf95('0x1e')]?_[_0xdf95('0x1f')](_0x2460e9[_0xdf95('0x1e')],function(_0x101b13){return{'model':db[_0x101b13['model']],'as':_0x101b13['as'],'attributes':_0x101b13[_0xdf95('0x21')]};}):[]};}):[]};}):[]:[]})[_0xdf95('0xd')](function(_0x5d978f){logger[_0xdf95('0xe')](_0xdf95('0x17'),_0x2fb850);logger[_0xdf95('0x10')]('GetOpenchannelQueue',_0x2fb850,JSON[_0xdf95('0x12')](_0x5d978f));_0x276395(_0x5d978f);})['catch'](function(_0x5951f2){logger[_0xdf95('0x13')](_0xdf95('0x17'),_0x5951f2[_0xdf95('0x15')],_0x2fb850);_0x3edbe6(_0x4f6f5c[_0xdf95('0x13')](0x1f4,_0x5951f2[_0xdf95('0x15')]));});});};exports['ShowOpenchannelQueue']=function(_0x3c7d27){var _0x547fed=this;return new Promise(function(_0x27499b,_0x5bc71c){return db[_0xdf95('0x18')][_0xdf95('0x22')]({'raw':_0x3c7d27['options']?_0x3c7d27['options'][_0xdf95('0x1b')]===undefined?!![]:![]:!![],'where':_0x3c7d27['options']?_0x3c7d27[_0xdf95('0x1a')][_0xdf95('0x1c')]||null:null,'attributes':_0x3c7d27[_0xdf95('0x1a')]?_0x3c7d27[_0xdf95('0x1a')]['attributes']||null:null,'include':_0x3c7d27['options']?_0x3c7d27[_0xdf95('0x1a')]['include']?_[_0xdf95('0x1f')](_0x3c7d27[_0xdf95('0x1a')][_0xdf95('0x1e')],function(_0x22286c){return{'model':db[_0x22286c['model']],'as':_0x22286c['as'],'attributes':_0x22286c[_0xdf95('0x21')],'include':_0x22286c['include']?_[_0xdf95('0x1f')](_0x22286c['include'],function(_0x18cfd6){return{'model':db[_0x18cfd6[_0xdf95('0x20')]],'as':_0x18cfd6['as'],'attributes':_0x18cfd6[_0xdf95('0x21')],'include':_0x18cfd6[_0xdf95('0x1e')]?_[_0xdf95('0x1f')](_0x18cfd6[_0xdf95('0x1e')],function(_0x14c3d0){return{'model':db[_0x14c3d0[_0xdf95('0x20')]],'as':_0x14c3d0['as'],'attributes':_0x14c3d0[_0xdf95('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b98b8){logger[_0xdf95('0xe')]('ShowOpenchannelQueue',_0x3c7d27);logger['debug'](_0xdf95('0x23'),_0x3c7d27,JSON[_0xdf95('0x12')](_0x1b98b8));_0x27499b(_0x1b98b8);})[_0xdf95('0x24')](function(_0x5ac906){logger[_0xdf95('0x13')](_0xdf95('0x23'),_0x5ac906[_0xdf95('0x15')],_0x3c7d27);_0x5bc71c(_0x547fed['error'](0x1f4,_0x5ac906['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 7918300..714d8f5 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 _0x1593=['length','./openchannelQueue.events','save','remove','update','emit','register'];(function(_0x3b632f,_0x453380){var _0x10e788=function(_0x2228a4){while(--_0x2228a4){_0x3b632f['push'](_0x3b632f['shift']());}};_0x10e788(++_0x453380);}(_0x1593,0x1c1));var _0x3159=function(_0x25f850,_0x527cbc){_0x25f850=_0x25f850-0x0;var _0x386a65=_0x1593[_0x25f850];return _0x386a65;};'use strict';var OpenchannelQueueEvents=require(_0x3159('0x0'));var events=[_0x3159('0x1'),_0x3159('0x2'),_0x3159('0x3')];function createListener(_0x3b3ead,_0x5718e9){return function(_0x1e9791){_0x5718e9[_0x3159('0x4')](_0x3b3ead,_0x1e9791);};}function removeListener(_0x3cdbd3,_0x390e8f){return function(){OpenchannelQueueEvents['removeListener'](_0x3cdbd3,_0x390e8f);};}exports[_0x3159('0x5')]=function(_0x3481be){for(var _0x2bcac5=0x0,_0x1525b7=events[_0x3159('0x6')];_0x2bcac5<_0x1525b7;_0x2bcac5++){var _0x58e3a6=events[_0x2bcac5];var _0xa5a37=createListener('openchannelQueue:'+_0x58e3a6,_0x3481be);OpenchannelQueueEvents['on'](_0x58e3a6,_0xa5a37);}}; \ No newline at end of file +var _0x856c=['save','remove','update','emit','removeListener','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x1f602d,_0x48e98e){var _0x244411=function(_0x44ca34){while(--_0x44ca34){_0x1f602d['push'](_0x1f602d['shift']());}};_0x244411(++_0x48e98e);}(_0x856c,0x1a7));var _0xc856=function(_0xc40c1a,_0x475c5b){_0xc40c1a=_0xc40c1a-0x0;var _0x113064=_0x856c[_0xc40c1a];return _0x113064;};'use strict';var OpenchannelQueueEvents=require(_0xc856('0x0'));var events=[_0xc856('0x1'),_0xc856('0x2'),_0xc856('0x3')];function createListener(_0x99044f,_0x3b6a70){return function(_0x56bd73){_0x3b6a70[_0xc856('0x4')](_0x99044f,_0x56bd73);};}function removeListener(_0x78b89e,_0x5228aa){return function(){OpenchannelQueueEvents[_0xc856('0x5')](_0x78b89e,_0x5228aa);};}exports['register']=function(_0x5c108a){for(var _0x28ebac=0x0,_0x2c2827=events[_0xc856('0x6')];_0x28ebac<_0x2c2827;_0x28ebac++){var _0xf83b13=events[_0x28ebac];var _0xc16a97=createListener(_0xc856('0x7')+_0xf83b13,_0x5c108a);OpenchannelQueueEvents['on'](_0xf83b13,_0xc16a97);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 9aabfd8..42486ff 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 _0x9cf2=['./openchannelQueueReport.controller','get','isAuthenticated','/describe','/:id','post','create','update','delete','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3e733e,_0x57fffa){var _0x461d56=function(_0x23db86){while(--_0x23db86){_0x3e733e['push'](_0x3e733e['shift']());}};_0x461d56(++_0x57fffa);}(_0x9cf2,0x1cb));var _0x29cf=function(_0x230827,_0x9b1055){_0x230827=_0x230827-0x0;var _0x2e2a59=_0x9cf2[_0x230827];return _0x2e2a59;};'use strict';var multer=require(_0x29cf('0x0'));var util=require('util');var path=require(_0x29cf('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x29cf('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x29cf('0x3'));var interaction=require(_0x29cf('0x4'));var config=require(_0x29cf('0x5'));var controller=require(_0x29cf('0x6'));router[_0x29cf('0x7')]('/',auth[_0x29cf('0x8')](),controller['index']);router[_0x29cf('0x7')](_0x29cf('0x9'),auth[_0x29cf('0x8')](),controller['describe']);router[_0x29cf('0x7')](_0x29cf('0xa'),auth[_0x29cf('0x8')](),controller['show']);router[_0x29cf('0xb')]('/',auth['isAuthenticated'](),controller[_0x29cf('0xc')]);router['put'](_0x29cf('0xa'),auth[_0x29cf('0x8')](),controller[_0x29cf('0xd')]);router[_0x29cf('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2b14=['../../config/environment','./openchannelQueueReport.controller','isAuthenticated','get','/describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x2b14,0x133));var _0x42b1=function(_0x62b286,_0x2efab6){_0x62b286=_0x62b286-0x0;var _0x46bc79=_0x2b14[_0x62b286];return _0x46bc79;};'use strict';var multer=require(_0x42b1('0x0'));var util=require(_0x42b1('0x1'));var path=require(_0x42b1('0x2'));var timeout=require(_0x42b1('0x3'));var express=require(_0x42b1('0x4'));var router=express[_0x42b1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x42b1('0x6'));var interaction=require(_0x42b1('0x7'));var config=require(_0x42b1('0x8'));var controller=require(_0x42b1('0x9'));router['get']('/',auth[_0x42b1('0xa')](),controller['index']);router[_0x42b1('0xb')](_0x42b1('0xc'),auth[_0x42b1('0xa')](),controller['describe']);router[_0x42b1('0xb')](_0x42b1('0xd'),auth[_0x42b1('0xa')](),controller[_0x42b1('0xe')]);router[_0x42b1('0xf')]('/',auth[_0x42b1('0xa')](),controller[_0x42b1('0x10')]);router[_0x42b1('0x11')](_0x42b1('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x42b1('0x12')](_0x42b1('0xd'),auth[_0x42b1('0xa')](),controller[_0x42b1('0x13')]);module[_0x42b1('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 4a2c286..2b434af 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 _0x9c8d=['moment','sequelize','exports','STRING','DATE'];(function(_0x10bfd7,_0x38dd2d){var _0x4a1015=function(_0x513232){while(--_0x513232){_0x10bfd7['push'](_0x10bfd7['shift']());}};_0x4a1015(++_0x38dd2d);}(_0x9c8d,0x177));var _0xd9c8=function(_0x34e14c,_0x50a436){_0x34e14c=_0x34e14c-0x0;var _0x53df14=_0x9c8d[_0x34e14c];return _0x53df14;};'use strict';var moment=require(_0xd9c8('0x0'));var Sequelize=require(_0xd9c8('0x1'));module[_0xd9c8('0x2')]={'uniqueid':{'type':Sequelize[_0xd9c8('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd9c8('0x3')]},'joinAt':{'type':Sequelize[_0xd9c8('0x4')]},'leaveAt':{'type':Sequelize[_0xd9c8('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd9c8('0x4')]},'reason':{'type':Sequelize[_0xd9c8('0x3')]}}; \ No newline at end of file +var _0xe084=['STRING','DATE','sequelize','exports'];(function(_0x3348a1,_0x4907f3){var _0x1d4652=function(_0xb8a3a2){while(--_0xb8a3a2){_0x3348a1['push'](_0x3348a1['shift']());}};_0x1d4652(++_0x4907f3);}(_0xe084,0x192));var _0x4e08=function(_0x45cfed,_0x4bc053){_0x45cfed=_0x45cfed-0x0;var _0x1d51f0=_0xe084[_0x45cfed];return _0x1d51f0;};'use strict';var moment=require('moment');var Sequelize=require(_0x4e08('0x0'));module[_0x4e08('0x1')]={'uniqueid':{'type':Sequelize[_0x4e08('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x4e08('0x2')]},'joinAt':{'type':Sequelize[_0x4e08('0x3')]},'leaveAt':{'type':Sequelize[_0x4e08('0x3')]},'acceptAt':{'type':Sequelize[_0x4e08('0x3')]},'exitAt':{'type':Sequelize[_0x4e08('0x3')]},'reason':{'type':Sequelize[_0x4e08('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 6330ace..4b0c4e0 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 _0xdfb7=['offset','undefined','limit','count','Content-Range','json','apply','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x14a79a,_0x281ce9){var _0x55d55b=function(_0x1cd245){while(--_0x1cd245){_0x14a79a['push'](_0x14a79a['shift']());}};_0x55d55b(++_0x281ce9);}(_0xdfb7,0x1a4));var _0x7dfb=function(_0x1b67e0,_0x40a968){_0x1b67e0=_0x1b67e0-0x0;var _0xaf188f=_0xdfb7[_0x1b67e0];return _0xaf188f;};'use strict';var emlformat=require(_0x7dfb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7dfb('0x1'));var rp=require(_0x7dfb('0x2'));var moment=require(_0x7dfb('0x3'));var BPromise=require(_0x7dfb('0x4'));var Mustache=require(_0x7dfb('0x5'));var util=require('util');var path=require('path');var sox=require(_0x7dfb('0x6'));var csv=require(_0x7dfb('0x7'));var ejs=require(_0x7dfb('0x8'));var fs=require('fs');var fs_extra=require(_0x7dfb('0x9'));var _=require(_0x7dfb('0xa'));var squel=require(_0x7dfb('0xb'));var crypto=require(_0x7dfb('0xc'));var jsforce=require(_0x7dfb('0xd'));var deskjs=require(_0x7dfb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7dfb('0xf'));var Papa=require(_0x7dfb('0x10'));var Redis=require(_0x7dfb('0x11'));var authService=require(_0x7dfb('0x12'));var qs=require(_0x7dfb('0x13'));var as=require(_0x7dfb('0x14'));var hardwareService=require(_0x7dfb('0x15'));var logger=require('../../config/logger')(_0x7dfb('0x16'));var utils=require(_0x7dfb('0x17'));var config=require(_0x7dfb('0x18'));var licenseUtil=require(_0x7dfb('0x19'));var db=require(_0x7dfb('0x1a'))['db'];function respondWithStatusCode(_0x13789e,_0x1a4f01){_0x1a4f01=_0x1a4f01||0xcc;return function(_0x122e68){if(_0x122e68){return _0x13789e[_0x7dfb('0x1b')](_0x1a4f01);}return _0x13789e[_0x7dfb('0x1c')](_0x1a4f01)[_0x7dfb('0x1d')]();};}function respondWithResult(_0x50641f,_0x3f588f){_0x3f588f=_0x3f588f||0xc8;return function(_0x376d51){if(_0x376d51){return _0x50641f[_0x7dfb('0x1c')](_0x3f588f)['json'](_0x376d51);}};}function respondWithFilteredResult(_0x57933e,_0x693f86){return function(_0x1951f6){if(_0x1951f6){var _0x432e91=typeof _0x693f86[_0x7dfb('0x1e')]===_0x7dfb('0x1f')&&typeof _0x693f86[_0x7dfb('0x20')]===_0x7dfb('0x1f');var _0x5eaa1e=_0x1951f6[_0x7dfb('0x21')];var _0x1bb56e=_0x432e91?0x0:_0x693f86[_0x7dfb('0x1e')];var _0x590434=_0x432e91?_0x1951f6[_0x7dfb('0x21')]:_0x693f86['offset']+_0x693f86[_0x7dfb('0x20')];var _0x4f3947;if(_0x590434>=_0x5eaa1e){_0x590434=_0x5eaa1e;_0x4f3947=0xc8;}else{_0x4f3947=0xce;}_0x57933e[_0x7dfb('0x1c')](_0x4f3947);return _0x57933e['set'](_0x7dfb('0x22'),_0x1bb56e+'-'+_0x590434+'/'+_0x5eaa1e)[_0x7dfb('0x23')](_0x1951f6);}return null;};}function patchUpdates(_0x4236f4){return function(_0x40b73f){try{jsonpatch[_0x7dfb('0x24')](_0x40b73f,_0x4236f4,!![]);}catch(_0x790353){return BPromise['reject'](_0x790353);}return _0x40b73f['save']();};}function saveUpdates(_0x54b234,_0x454197){return function(_0x76cdca){if(_0x76cdca){return _0x76cdca['update'](_0x54b234)[_0x7dfb('0x25')](function(_0x128c92){return _0x128c92;});}return null;};}function removeEntity(_0x5c878d,_0x4fafc0){return function(_0x2d29f0){if(_0x2d29f0){return _0x2d29f0[_0x7dfb('0x26')]()[_0x7dfb('0x25')](function(){_0x5c878d[_0x7dfb('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a8673,_0x42350a){return function(_0x5e08b7){if(!_0x5e08b7){_0x3a8673[_0x7dfb('0x1b')](0x194);}return _0x5e08b7;};}function handleError(_0x39f3e8,_0x18aa05){_0x18aa05=_0x18aa05||0x1f4;return function(_0x38d5f3){logger[_0x7dfb('0x27')](_0x38d5f3[_0x7dfb('0x28')]);if(_0x38d5f3['name']){delete _0x38d5f3[_0x7dfb('0x29')];}_0x39f3e8['status'](_0x18aa05)[_0x7dfb('0x2a')](_0x38d5f3);};}exports[_0x7dfb('0x2b')]=function(_0x4937c2,_0x4e84eb){var _0x2df285={},_0x3882ff={},_0x57e1f2={'count':0x0,'rows':[]};var _0x2c688e=_[_0x7dfb('0x2c')](db[_0x7dfb('0x2d')]['rawAttributes'],function(_0x33a09c){return{'name':_0x33a09c['fieldName'],'type':_0x33a09c[_0x7dfb('0x2e')]['key']};});_0x3882ff[_0x7dfb('0x2f')]=_[_0x7dfb('0x2c')](_0x2c688e,_0x7dfb('0x29'));_0x3882ff[_0x7dfb('0x30')]=_[_0x7dfb('0x31')](_0x4937c2[_0x7dfb('0x30')]);_0x3882ff[_0x7dfb('0x32')]=_[_0x7dfb('0x33')](_0x3882ff[_0x7dfb('0x2f')],_0x3882ff[_0x7dfb('0x30')]);_0x2df285[_0x7dfb('0x34')]=_['intersection'](_0x3882ff[_0x7dfb('0x2f')],qs[_0x7dfb('0x35')](_0x4937c2['query'][_0x7dfb('0x35')]));_0x2df285[_0x7dfb('0x34')]=_0x2df285[_0x7dfb('0x34')][_0x7dfb('0x36')]?_0x2df285[_0x7dfb('0x34')]:_0x3882ff[_0x7dfb('0x2f')];if(!_0x4937c2['query'][_0x7dfb('0x37')](_0x7dfb('0x38'))){_0x2df285[_0x7dfb('0x20')]=qs[_0x7dfb('0x20')](_0x4937c2[_0x7dfb('0x30')][_0x7dfb('0x20')]);_0x2df285[_0x7dfb('0x1e')]=qs[_0x7dfb('0x1e')](_0x4937c2[_0x7dfb('0x30')][_0x7dfb('0x1e')]);}_0x2df285[_0x7dfb('0x39')]=qs[_0x7dfb('0x3a')](_0x4937c2[_0x7dfb('0x30')][_0x7dfb('0x3a')]);_0x2df285[_0x7dfb('0x3b')]=qs[_0x7dfb('0x32')](_[_0x7dfb('0x3c')](_0x4937c2[_0x7dfb('0x30')],_0x3882ff['filters']),_0x2c688e);if(_0x4937c2['query'][_0x7dfb('0x3d')]){_0x2df285[_0x7dfb('0x3b')]=_[_0x7dfb('0x3e')](_0x2df285['where'],{'$or':_[_0x7dfb('0x2c')](_0x2c688e,function(_0x4bf254){if(_0x4bf254['type']!==_0x7dfb('0x3f')){var _0x38893a={};_0x38893a[_0x4bf254[_0x7dfb('0x29')]]={'$like':'%'+_0x4937c2[_0x7dfb('0x30')][_0x7dfb('0x3d')]+'%'};return _0x38893a;}})});}_0x2df285=_['merge']({},_0x2df285,_0x4937c2[_0x7dfb('0x40')]);var _0x2d17cd={'where':_0x2df285[_0x7dfb('0x3b')]};return db[_0x7dfb('0x2d')][_0x7dfb('0x21')](_0x2d17cd)[_0x7dfb('0x25')](function(_0x4d6415){_0x57e1f2['count']=_0x4d6415;if(_0x4937c2[_0x7dfb('0x30')][_0x7dfb('0x41')]){_0x2df285['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x7dfb('0x42')](_0x2df285);})[_0x7dfb('0x25')](function(_0x7cde64){_0x57e1f2['rows']=_0x7cde64;return _0x57e1f2;})['then'](respondWithFilteredResult(_0x4e84eb,_0x2df285))[_0x7dfb('0x43')](handleError(_0x4e84eb,null));};exports[_0x7dfb('0x44')]=function(_0x28060c,_0x292728){var _0x5cf1b3={'raw':!![],'where':{'id':_0x28060c[_0x7dfb('0x45')]['id']}},_0x31f60e={};_0x31f60e[_0x7dfb('0x2f')]=_[_0x7dfb('0x31')](db[_0x7dfb('0x2d')][_0x7dfb('0x46')]);_0x31f60e[_0x7dfb('0x30')]=_[_0x7dfb('0x31')](_0x28060c[_0x7dfb('0x30')]);_0x31f60e['filters']=_[_0x7dfb('0x33')](_0x31f60e[_0x7dfb('0x2f')],_0x31f60e[_0x7dfb('0x30')]);_0x5cf1b3[_0x7dfb('0x34')]=_[_0x7dfb('0x33')](_0x31f60e[_0x7dfb('0x2f')],qs[_0x7dfb('0x35')](_0x28060c[_0x7dfb('0x30')][_0x7dfb('0x35')]));_0x5cf1b3[_0x7dfb('0x34')]=_0x5cf1b3[_0x7dfb('0x34')][_0x7dfb('0x36')]?_0x5cf1b3[_0x7dfb('0x34')]:_0x31f60e[_0x7dfb('0x2f')];if(_0x28060c[_0x7dfb('0x30')][_0x7dfb('0x41')]){_0x5cf1b3[_0x7dfb('0x47')]=[{'all':!![]}];}_0x5cf1b3=_[_0x7dfb('0x3e')]({},_0x5cf1b3,_0x28060c[_0x7dfb('0x40')]);return db[_0x7dfb('0x2d')][_0x7dfb('0x48')](_0x5cf1b3)[_0x7dfb('0x25')](handleEntityNotFound(_0x292728,null))[_0x7dfb('0x25')](respondWithResult(_0x292728,null))[_0x7dfb('0x43')](handleError(_0x292728,null));};exports['create']=function(_0xa48285,_0x1e4e79){return db['OpenchannelQueueReport'][_0x7dfb('0x49')](_0xa48285[_0x7dfb('0x4a')],{})[_0x7dfb('0x25')](respondWithResult(_0x1e4e79,0xc9))[_0x7dfb('0x43')](handleError(_0x1e4e79,null));};exports['update']=function(_0x40bad7,_0x5988ff){if(_0x40bad7[_0x7dfb('0x4a')]['id']){delete _0x40bad7['body']['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x40bad7[_0x7dfb('0x45')]['id']}})[_0x7dfb('0x25')](handleEntityNotFound(_0x5988ff,null))[_0x7dfb('0x25')](saveUpdates(_0x40bad7[_0x7dfb('0x4a')],null))['then'](respondWithResult(_0x5988ff,null))[_0x7dfb('0x43')](handleError(_0x5988ff,null));};exports['destroy']=function(_0x3c7f76,_0x59c018){return db[_0x7dfb('0x2d')][_0x7dfb('0x48')]({'where':{'id':_0x3c7f76['params']['id']}})[_0x7dfb('0x25')](handleEntityNotFound(_0x59c018,null))[_0x7dfb('0x25')](removeEntity(_0x59c018,null))[_0x7dfb('0x43')](handleError(_0x59c018,null));};exports['describe']=function(_0xd20724,_0x5a7c14){return db[_0x7dfb('0x2d')]['describe']()[_0x7dfb('0x25')](respondWithResult(_0x5a7c14,null))['catch'](handleError(_0x5a7c14,null));}; \ No newline at end of file +var _0x8862=['find','body','catch','update','params','describe','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','includeAll','include','findAll','rows','show','options'];(function(_0x1c8c91,_0x8c509e){var _0x480265=function(_0x496b74){while(--_0x496b74){_0x1c8c91['push'](_0x1c8c91['shift']());}};_0x480265(++_0x8c509e);}(_0x8862,0x16e));var _0x2886=function(_0x23478b,_0x366a88){_0x23478b=_0x23478b-0x0;var _0xfd2e4f=_0x8862[_0x23478b];return _0xfd2e4f;};'use strict';var emlformat=require(_0x2886('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2886('0x1'));var jsonpatch=require(_0x2886('0x2'));var rp=require('request-promise');var moment=require(_0x2886('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2886('0x4'));var path=require(_0x2886('0x5'));var sox=require(_0x2886('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2886('0x7'));var _=require(_0x2886('0x8'));var squel=require(_0x2886('0x9'));var crypto=require(_0x2886('0xa'));var jsforce=require(_0x2886('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2886('0xc'));var Redis=require(_0x2886('0xd'));var authService=require(_0x2886('0xe'));var qs=require(_0x2886('0xf'));var as=require(_0x2886('0x10'));var hardwareService=require(_0x2886('0x11'));var logger=require(_0x2886('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x2886('0x13'));var licenseUtil=require(_0x2886('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10bd23,_0x3d71a5){_0x3d71a5=_0x3d71a5||0xcc;return function(_0x7c95f3){if(_0x7c95f3){return _0x10bd23[_0x2886('0x15')](_0x3d71a5);}return _0x10bd23[_0x2886('0x16')](_0x3d71a5)[_0x2886('0x17')]();};}function respondWithResult(_0x2c08e1,_0x4f1842){_0x4f1842=_0x4f1842||0xc8;return function(_0x296c57){if(_0x296c57){return _0x2c08e1['status'](_0x4f1842)[_0x2886('0x18')](_0x296c57);}};}function respondWithFilteredResult(_0x49273e,_0x42b7d6){return function(_0x380046){if(_0x380046){var _0x556e82=typeof _0x42b7d6[_0x2886('0x19')]===_0x2886('0x1a')&&typeof _0x42b7d6[_0x2886('0x1b')]==='undefined';var _0x3b3b8c=_0x380046[_0x2886('0x1c')];var _0x579edf=_0x556e82?0x0:_0x42b7d6['offset'];var _0x418296=_0x556e82?_0x380046[_0x2886('0x1c')]:_0x42b7d6[_0x2886('0x19')]+_0x42b7d6[_0x2886('0x1b')];var _0x1d9e35;if(_0x418296>=_0x3b3b8c){_0x418296=_0x3b3b8c;_0x1d9e35=0xc8;}else{_0x1d9e35=0xce;}_0x49273e[_0x2886('0x16')](_0x1d9e35);return _0x49273e['set'](_0x2886('0x1d'),_0x579edf+'-'+_0x418296+'/'+_0x3b3b8c)['json'](_0x380046);}return null;};}function patchUpdates(_0x3477a1){return function(_0x5c91da){try{jsonpatch[_0x2886('0x1e')](_0x5c91da,_0x3477a1,!![]);}catch(_0x290057){return BPromise[_0x2886('0x1f')](_0x290057);}return _0x5c91da[_0x2886('0x20')]();};}function saveUpdates(_0x39a430,_0x4a1f78){return function(_0x2cf61d){if(_0x2cf61d){return _0x2cf61d['update'](_0x39a430)[_0x2886('0x21')](function(_0x9ba327){return _0x9ba327;});}return null;};}function removeEntity(_0x5dc384,_0x5d1ff0){return function(_0x31e961){if(_0x31e961){return _0x31e961[_0x2886('0x22')]()[_0x2886('0x21')](function(){_0x5dc384['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40f8f6,_0x21c448){return function(_0x381ca8){if(!_0x381ca8){_0x40f8f6[_0x2886('0x15')](0x194);}return _0x381ca8;};}function handleError(_0x32cf14,_0x83c84d){_0x83c84d=_0x83c84d||0x1f4;return function(_0x221b54){logger[_0x2886('0x23')](_0x221b54[_0x2886('0x24')]);if(_0x221b54[_0x2886('0x25')]){delete _0x221b54[_0x2886('0x25')];}_0x32cf14['status'](_0x83c84d)[_0x2886('0x26')](_0x221b54);};}exports[_0x2886('0x27')]=function(_0x473efe,_0x15a520){var _0x201395={},_0x3b30a4={},_0x571f8b={'count':0x0,'rows':[]};var _0x5532ed=_[_0x2886('0x28')](db[_0x2886('0x29')][_0x2886('0x2a')],function(_0x182148){return{'name':_0x182148['fieldName'],'type':_0x182148['type']['key']};});_0x3b30a4[_0x2886('0x2b')]=_[_0x2886('0x28')](_0x5532ed,'name');_0x3b30a4['query']=_[_0x2886('0x2c')](_0x473efe[_0x2886('0x2d')]);_0x3b30a4[_0x2886('0x2e')]=_[_0x2886('0x2f')](_0x3b30a4[_0x2886('0x2b')],_0x3b30a4[_0x2886('0x2d')]);_0x201395[_0x2886('0x30')]=_[_0x2886('0x2f')](_0x3b30a4[_0x2886('0x2b')],qs[_0x2886('0x31')](_0x473efe[_0x2886('0x2d')][_0x2886('0x31')]));_0x201395[_0x2886('0x30')]=_0x201395['attributes'][_0x2886('0x32')]?_0x201395[_0x2886('0x30')]:_0x3b30a4['model'];if(!_0x473efe[_0x2886('0x2d')][_0x2886('0x33')](_0x2886('0x34'))){_0x201395['limit']=qs[_0x2886('0x1b')](_0x473efe[_0x2886('0x2d')]['limit']);_0x201395[_0x2886('0x19')]=qs['offset'](_0x473efe[_0x2886('0x2d')][_0x2886('0x19')]);}_0x201395[_0x2886('0x35')]=qs[_0x2886('0x36')](_0x473efe[_0x2886('0x2d')][_0x2886('0x36')]);_0x201395[_0x2886('0x37')]=qs[_0x2886('0x2e')](_[_0x2886('0x38')](_0x473efe['query'],_0x3b30a4[_0x2886('0x2e')]),_0x5532ed);if(_0x473efe[_0x2886('0x2d')]['filter']){_0x201395[_0x2886('0x37')]=_[_0x2886('0x39')](_0x201395[_0x2886('0x37')],{'$or':_[_0x2886('0x28')](_0x5532ed,function(_0x5b8707){if(_0x5b8707[_0x2886('0x3a')]!=='VIRTUAL'){var _0x2dffca={};_0x2dffca[_0x5b8707[_0x2886('0x25')]]={'$like':'%'+_0x473efe[_0x2886('0x2d')][_0x2886('0x3b')]+'%'};return _0x2dffca;}})});}_0x201395=_[_0x2886('0x39')]({},_0x201395,_0x473efe['options']);var _0x441c33={'where':_0x201395[_0x2886('0x37')]};return db[_0x2886('0x29')][_0x2886('0x1c')](_0x441c33)[_0x2886('0x21')](function(_0x5ef82e){_0x571f8b['count']=_0x5ef82e;if(_0x473efe['query'][_0x2886('0x3c')]){_0x201395[_0x2886('0x3d')]=[{'all':!![]}];}return db[_0x2886('0x29')][_0x2886('0x3e')](_0x201395);})[_0x2886('0x21')](function(_0x1a78ab){_0x571f8b[_0x2886('0x3f')]=_0x1a78ab;return _0x571f8b;})['then'](respondWithFilteredResult(_0x15a520,_0x201395))['catch'](handleError(_0x15a520,null));};exports[_0x2886('0x40')]=function(_0x2b8e0b,_0x10091e){var _0x5460cf={'raw':!![],'where':{'id':_0x2b8e0b['params']['id']}},_0x130e12={};_0x130e12[_0x2886('0x2b')]=_[_0x2886('0x2c')](db['OpenchannelQueueReport'][_0x2886('0x2a')]);_0x130e12[_0x2886('0x2d')]=_[_0x2886('0x2c')](_0x2b8e0b[_0x2886('0x2d')]);_0x130e12[_0x2886('0x2e')]=_[_0x2886('0x2f')](_0x130e12[_0x2886('0x2b')],_0x130e12['query']);_0x5460cf['attributes']=_[_0x2886('0x2f')](_0x130e12[_0x2886('0x2b')],qs[_0x2886('0x31')](_0x2b8e0b[_0x2886('0x2d')]['fields']));_0x5460cf[_0x2886('0x30')]=_0x5460cf[_0x2886('0x30')][_0x2886('0x32')]?_0x5460cf[_0x2886('0x30')]:_0x130e12[_0x2886('0x2b')];if(_0x2b8e0b[_0x2886('0x2d')][_0x2886('0x3c')]){_0x5460cf['include']=[{'all':!![]}];}_0x5460cf=_['merge']({},_0x5460cf,_0x2b8e0b[_0x2886('0x41')]);return db[_0x2886('0x29')][_0x2886('0x42')](_0x5460cf)['then'](handleEntityNotFound(_0x10091e,null))[_0x2886('0x21')](respondWithResult(_0x10091e,null))['catch'](handleError(_0x10091e,null));};exports['create']=function(_0x2b486b,_0x1c08d3){return db['OpenchannelQueueReport']['create'](_0x2b486b[_0x2886('0x43')],{})['then'](respondWithResult(_0x1c08d3,0xc9))[_0x2886('0x44')](handleError(_0x1c08d3,null));};exports[_0x2886('0x45')]=function(_0x47e00c,_0x1d10ee){if(_0x47e00c[_0x2886('0x43')]['id']){delete _0x47e00c[_0x2886('0x43')]['id'];}return db[_0x2886('0x29')][_0x2886('0x42')]({'where':{'id':_0x47e00c[_0x2886('0x46')]['id']}})[_0x2886('0x21')](handleEntityNotFound(_0x1d10ee,null))['then'](saveUpdates(_0x47e00c[_0x2886('0x43')],null))[_0x2886('0x21')](respondWithResult(_0x1d10ee,null))['catch'](handleError(_0x1d10ee,null));};exports['destroy']=function(_0x2cdbfc,_0x50c5ba){return db[_0x2886('0x29')][_0x2886('0x42')]({'where':{'id':_0x2cdbfc[_0x2886('0x46')]['id']}})[_0x2886('0x21')](handleEntityNotFound(_0x50c5ba,null))[_0x2886('0x21')](removeEntity(_0x50c5ba,null))[_0x2886('0x44')](handleError(_0x50c5ba,null));};exports[_0x2886('0x47')]=function(_0x8aaa03,_0x559c3f){return db[_0x2886('0x29')]['describe']()['then'](respondWithResult(_0x559c3f,null))[_0x2886('0x44')](handleError(_0x559c3f,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index a0392ab..c477ddd 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x1a9f01,_0x5ecf83){var _0xcb147d=function(_0x58467a){while(--_0x58467a){_0x1a9f01['push'](_0x1a9f01['shift']());}};_0xcb147d(++_0x5ecf83);}(_0x2ef3,0xba));var _0x32ef=function(_0x4ebce,_0x4432cc){_0x4ebce=_0x4ebce-0x0;var _0x4fe830=_0x2ef3[_0x4ebce];return _0x4fe830;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x343c26,_0x52ec0f){var _0x57771d=function(_0x461d1c){while(--_0x461d1c){_0x343c26['push'](_0x343c26['shift']());}};_0x57771d(++_0x52ec0f);}(_0xe14b,0x93));var _0xbe14=function(_0x4219bb,_0x5f0304){_0x4219bb=_0x4219bb-0x0;var _0x119271=_0xe14b[_0x4219bb];return _0x119271;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 93c20aa..143ee2b 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 _0x9158=['where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','debug','UpdateOpenchannelQueueReport','update'];(function(_0x52b7b9,_0x43ed4b){var _0x5b5d30=function(_0x4a5b9c){while(--_0x4a5b9c){_0x52b7b9['push'](_0x52b7b9['shift']());}};_0x5b5d30(++_0x43ed4b);}(_0x9158,0x16e));var _0x8915=function(_0x4a1e71,_0x4c24b2){_0x4a1e71=_0x4a1e71-0x0;var _0x2f2f5b=_0x9158[_0x4a1e71];return _0x2f2f5b;};'use strict';var _=require(_0x8915('0x0'));var util=require(_0x8915('0x1'));var moment=require(_0x8915('0x2'));var BPromise=require('bluebird');var rs=require(_0x8915('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8915('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8915('0x5'));var config=require(_0x8915('0x6'));var jayson=require(_0x8915('0x7'));var client=jayson[_0x8915('0x8')][_0x8915('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20ff3d,_0x33abdd,_0x100d72){return new BPromise(function(_0x50d1f8,_0x41be04){return client[_0x8915('0xa')](_0x20ff3d,_0x100d72)[_0x8915('0xb')](function(_0x1a5403){logger[_0x8915('0xc')](_0x8915('0xd'),_0x33abdd,_0x8915('0xe'));logger['debug']('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x33abdd,_0x8915('0xe'),JSON[_0x8915('0xf')](_0x1a5403));if(_0x1a5403[_0x8915('0x10')]){if(_0x1a5403[_0x8915('0x10')][_0x8915('0x11')]===0x1f4){logger[_0x8915('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x33abdd,_0x1a5403[_0x8915('0x10')][_0x8915('0x12')]);return _0x41be04(_0x1a5403['error'][_0x8915('0x12')]);}logger['error'](_0x8915('0xd'),_0x33abdd,_0x1a5403['error'][_0x8915('0x12')]);return _0x50d1f8(_0x1a5403[_0x8915('0x10')][_0x8915('0x12')]);}else{logger[_0x8915('0xc')](_0x8915('0xd'),_0x33abdd,_0x8915('0xe'));_0x50d1f8(_0x1a5403[_0x8915('0x13')][_0x8915('0x12')]);}})[_0x8915('0x14')](function(_0x3f541c){logger[_0x8915('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x33abdd,_0x3f541c);_0x41be04(_0x3f541c);});});}exports[_0x8915('0x15')]=function(_0x913dc){var _0x5ccd36=this;return new Promise(function(_0x5987d4,_0x17bb6c){return db[_0x8915('0x16')][_0x8915('0x17')](_0x913dc[_0x8915('0x18')],{'raw':_0x913dc[_0x8915('0x19')]?_0x913dc[_0x8915('0x19')][_0x8915('0x1a')]===undefined?!![]:![]:!![]})[_0x8915('0xb')](function(_0x511dcd){logger['info'](_0x8915('0x15'),_0x913dc);logger[_0x8915('0x1b')](_0x8915('0x15'),_0x913dc,JSON[_0x8915('0xf')](_0x511dcd));_0x5987d4(_0x511dcd);})['catch'](function(_0x2eebe1){logger[_0x8915('0x10')](_0x8915('0x15'),_0x2eebe1[_0x8915('0x12')],_0x913dc);_0x17bb6c(_0x5ccd36[_0x8915('0x10')](0x1f4,_0x2eebe1[_0x8915('0x12')]));});});};exports[_0x8915('0x1c')]=function(_0x2568d8){var _0x5c061d=this;return new Promise(function(_0x4159c9,_0x4e5973){return db[_0x8915('0x16')][_0x8915('0x1d')](_0x2568d8['body'],{'raw':_0x2568d8[_0x8915('0x19')]?_0x2568d8[_0x8915('0x19')][_0x8915('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2568d8[_0x8915('0x19')]?_0x2568d8[_0x8915('0x19')][_0x8915('0x1e')]||null:null,'attributes':_0x2568d8[_0x8915('0x19')]?_0x2568d8['options'][_0x8915('0x1f')]||null:null,'limit':_0x2568d8[_0x8915('0x19')]?_0x2568d8['options'][_0x8915('0x20')]||null:null})['then'](function(_0x3b133c){logger['info'](_0x8915('0x1c'),_0x2568d8);logger[_0x8915('0x1b')]('UpdateOpenchannelQueueReport',_0x2568d8,JSON[_0x8915('0xf')](_0x3b133c));_0x4159c9(_0x3b133c);})[_0x8915('0x14')](function(_0x18296c){logger[_0x8915('0x10')](_0x8915('0x1c'),_0x18296c['message'],_0x2568d8);_0x4e5973(_0x5c061d[_0x8915('0x10')](0x1f4,_0x18296c['message']));});});}; \ No newline at end of file +var _0x47c5=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4cdfd5,_0x1d3838){var _0x33cc64=function(_0x39f1d2){while(--_0x39f1d2){_0x4cdfd5['push'](_0x4cdfd5['shift']());}};_0x33cc64(++_0x1d3838);}(_0x47c5,0x165));var _0x547c=function(_0x4192ad,_0x488f5c){_0x4192ad=_0x4192ad-0x0;var _0x415dc3=_0x47c5[_0x4192ad];return _0x415dc3;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});}exports['CreateOpenchannelQueueReport']=function(_0x23fa9e){var _0x199e4f=this;return new Promise(function(_0xeb059e,_0x4a8901){return db[_0x547c('0x18')][_0x547c('0x19')](_0x23fa9e[_0x547c('0x1a')],{'raw':_0x23fa9e['options']?_0x23fa9e[_0x547c('0x1b')][_0x547c('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5453f9){logger[_0x547c('0xd')](_0x547c('0x1d'),_0x23fa9e);logger['debug'](_0x547c('0x1d'),_0x23fa9e,JSON[_0x547c('0x12')](_0x5453f9));_0xeb059e(_0x5453f9);})['catch'](function(_0x2e317a){logger[_0x547c('0x13')](_0x547c('0x1d'),_0x2e317a['message'],_0x23fa9e);_0x4a8901(_0x199e4f[_0x547c('0x13')](0x1f4,_0x2e317a[_0x547c('0x15')]));});});};exports[_0x547c('0x1e')]=function(_0x26823c){var _0x1f3581=this;return new Promise(function(_0x2663bc,_0x2ab2cc){return db[_0x547c('0x18')]['update'](_0x26823c[_0x547c('0x1a')],{'raw':_0x26823c['options']?_0x26823c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26823c['options']?_0x26823c[_0x547c('0x1b')]['where']||null:null,'attributes':_0x26823c[_0x547c('0x1b')]?_0x26823c['options'][_0x547c('0x1f')]||null:null,'limit':_0x26823c['options']?_0x26823c[_0x547c('0x1b')][_0x547c('0x20')]||null:null})[_0x547c('0xc')](function(_0x30a96c){logger[_0x547c('0xd')]('UpdateOpenchannelQueueReport',_0x26823c);logger['debug'](_0x547c('0x1e'),_0x26823c,JSON['stringify'](_0x30a96c));_0x2663bc(_0x30a96c);})[_0x547c('0x17')](function(_0xed2d39){logger[_0x547c('0x13')](_0x547c('0x1e'),_0xed2d39[_0x547c('0x15')],_0x26823c);_0x2ab2cc(_0x1f3581[_0x547c('0x13')](0x1f4,_0xed2d39[_0x547c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 97a3855..88d9d72 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 _0x2fe3=['create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','post'];(function(_0x527824,_0xc824a9){var _0xc8b8ed=function(_0x1b0e19){while(--_0x1b0e19){_0x527824['push'](_0x527824['shift']());}};_0xc8b8ed(++_0xc824a9);}(_0x2fe3,0x1f3));var _0x32fe=function(_0x2d5575,_0x8e29c7){_0x2d5575=_0x2d5575-0x0;var _0xd5804f=_0x2fe3[_0x2d5575];return _0xd5804f;};'use strict';var multer=require(_0x32fe('0x0'));var util=require('util');var path=require(_0x32fe('0x1'));var timeout=require(_0x32fe('0x2'));var express=require(_0x32fe('0x3'));var router=express[_0x32fe('0x4')]();var fs_extra=require(_0x32fe('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x32fe('0x6'));var config=require(_0x32fe('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0x32fe('0x8')]('/',auth[_0x32fe('0x9')](),controller['index']);router[_0x32fe('0x8')](_0x32fe('0xa'),auth['isAuthenticated'](),controller[_0x32fe('0xb')]);router['get'](_0x32fe('0xc'),auth[_0x32fe('0x9')](),controller['show']);router[_0x32fe('0xd')]('/',auth['isAuthenticated'](),controller[_0x32fe('0xe')]);router['put']('/:id',auth[_0x32fe('0x9')](),controller[_0x32fe('0xf')]);router[_0x32fe('0x10')]('/:id',auth[_0x32fe('0x9')](),controller[_0x32fe('0x11')]);module[_0x32fe('0x12')]=router; \ No newline at end of file +var _0xc148=['/describe','describe','/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index'];(function(_0x367646,_0x10235d){var _0x204c96=function(_0x47343f){while(--_0x47343f){_0x367646['push'](_0x367646['shift']());}};_0x204c96(++_0x10235d);}(_0xc148,0x12f));var _0x8c14=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xc148[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x8c14('0x0'));var util=require(_0x8c14('0x1'));var path=require(_0x8c14('0x2'));var timeout=require(_0x8c14('0x3'));var express=require('express');var router=express[_0x8c14('0x4')]();var fs_extra=require(_0x8c14('0x5'));var auth=require(_0x8c14('0x6'));var interaction=require(_0x8c14('0x7'));var config=require('../../config/environment');var controller=require(_0x8c14('0x8'));router[_0x8c14('0x9')]('/',auth[_0x8c14('0xa')](),controller[_0x8c14('0xb')]);router[_0x8c14('0x9')](_0x8c14('0xc'),auth[_0x8c14('0xa')](),controller[_0x8c14('0xd')]);router[_0x8c14('0x9')](_0x8c14('0xe'),auth[_0x8c14('0xa')](),controller['show']);router[_0x8c14('0xf')]('/',auth[_0x8c14('0xa')](),controller['create']);router[_0x8c14('0x10')](_0x8c14('0xe'),auth[_0x8c14('0xa')](),controller[_0x8c14('0x11')]);router[_0x8c14('0x12')](_0x8c14('0xe'),auth[_0x8c14('0xa')](),controller[_0x8c14('0x13')]);module[_0x8c14('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 8f8bd01..79ab2ac 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x18a794,_0x335c63){var _0x4fadaa=function(_0x49b618){while(--_0x49b618){_0x18a794['push'](_0x18a794['shift']());}};_0x4fadaa(++_0x335c63);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x2341ab,_0x326a6c){var _0x54533e=function(_0x413273){while(--_0x413273){_0x2341ab['push'](_0x2341ab['shift']());}};_0x54533e(++_0x326a6c);}(_0x34e8,0x12c));var _0x834e=function(_0x57812b,_0x222a56){_0x57812b=_0x57812b-0x0;var _0x55bca5=_0x34e8[_0x57812b];return _0x55bca5;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index f993e46..ee73452 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 _0xbaf8=['json','offset','limit','count','apply','reject','update','then','error','stack','send','index','map','OpenchannelTransferReport','rawAttributes','type','key','model','name','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','filter','includeAll','include','findAll','rows','show','params','keys','options','create','body','catch','find','destroy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x350000,_0x3dcfce){var _0x5b757f=function(_0x47c2a6){while(--_0x47c2a6){_0x350000['push'](_0x350000['shift']());}};_0x5b757f(++_0x3dcfce);}(_0xbaf8,0xc1));var _0x8baf=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xbaf8[_0x5d2803];return _0xdcad2c;};'use strict';var emlformat=require(_0x8baf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8baf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8baf('0x2'));var moment=require(_0x8baf('0x3'));var BPromise=require(_0x8baf('0x4'));var Mustache=require(_0x8baf('0x5'));var util=require('util');var path=require(_0x8baf('0x6'));var sox=require(_0x8baf('0x7'));var csv=require(_0x8baf('0x8'));var ejs=require(_0x8baf('0x9'));var fs=require('fs');var fs_extra=require(_0x8baf('0xa'));var _=require(_0x8baf('0xb'));var squel=require(_0x8baf('0xc'));var crypto=require(_0x8baf('0xd'));var jsforce=require(_0x8baf('0xe'));var deskjs=require(_0x8baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8baf('0x10'));var Papa=require(_0x8baf('0x11'));var Redis=require(_0x8baf('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8baf('0x13'));var as=require(_0x8baf('0x14'));var hardwareService=require(_0x8baf('0x15'));var logger=require(_0x8baf('0x16'))('api');var utils=require(_0x8baf('0x17'));var config=require(_0x8baf('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8baf('0x19'))['db'];function respondWithStatusCode(_0xdb9dc9,_0x2ad082){_0x2ad082=_0x2ad082||0xcc;return function(_0x3a53e6){if(_0x3a53e6){return _0xdb9dc9[_0x8baf('0x1a')](_0x2ad082);}return _0xdb9dc9[_0x8baf('0x1b')](_0x2ad082)[_0x8baf('0x1c')]();};}function respondWithResult(_0x824a74,_0x21b103){_0x21b103=_0x21b103||0xc8;return function(_0x50c70e){if(_0x50c70e){return _0x824a74[_0x8baf('0x1b')](_0x21b103)[_0x8baf('0x1d')](_0x50c70e);}};}function respondWithFilteredResult(_0x5e434a,_0x3e7b2f){return function(_0x459379){if(_0x459379){var _0x1f5aa0=typeof _0x3e7b2f[_0x8baf('0x1e')]==='undefined'&&typeof _0x3e7b2f[_0x8baf('0x1f')]==='undefined';var _0x168a70=_0x459379[_0x8baf('0x20')];var _0x5364c2=_0x1f5aa0?0x0:_0x3e7b2f[_0x8baf('0x1e')];var _0x46ef59=_0x1f5aa0?_0x459379[_0x8baf('0x20')]:_0x3e7b2f['offset']+_0x3e7b2f['limit'];var _0x200cad;if(_0x46ef59>=_0x168a70){_0x46ef59=_0x168a70;_0x200cad=0xc8;}else{_0x200cad=0xce;}_0x5e434a[_0x8baf('0x1b')](_0x200cad);return _0x5e434a['set']('Content-Range',_0x5364c2+'-'+_0x46ef59+'/'+_0x168a70)[_0x8baf('0x1d')](_0x459379);}return null;};}function patchUpdates(_0x54bf30){return function(_0x51e7a9){try{jsonpatch[_0x8baf('0x21')](_0x51e7a9,_0x54bf30,!![]);}catch(_0x580fb6){return BPromise[_0x8baf('0x22')](_0x580fb6);}return _0x51e7a9['save']();};}function saveUpdates(_0x4c2211,_0x55515a){return function(_0x5be169){if(_0x5be169){return _0x5be169[_0x8baf('0x23')](_0x4c2211)[_0x8baf('0x24')](function(_0x2e36cd){return _0x2e36cd;});}return null;};}function removeEntity(_0x4eb3bf,_0x3f0823){return function(_0x8abbe5){if(_0x8abbe5){return _0x8abbe5['destroy']()['then'](function(){_0x4eb3bf[_0x8baf('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a66c,_0x337f4c){return function(_0x47f86c){if(!_0x47f86c){_0x54a66c['sendStatus'](0x194);}return _0x47f86c;};}function handleError(_0x4317c1,_0x21c139){_0x21c139=_0x21c139||0x1f4;return function(_0x4665ac){logger[_0x8baf('0x25')](_0x4665ac[_0x8baf('0x26')]);if(_0x4665ac['name']){delete _0x4665ac['name'];}_0x4317c1[_0x8baf('0x1b')](_0x21c139)[_0x8baf('0x27')](_0x4665ac);};}exports[_0x8baf('0x28')]=function(_0x534869,_0x5de032){var _0x98190e={},_0x22deeb={},_0x1dfe41={'count':0x0,'rows':[]};var _0x231bae=_[_0x8baf('0x29')](db[_0x8baf('0x2a')][_0x8baf('0x2b')],function(_0x2056ba){return{'name':_0x2056ba['fieldName'],'type':_0x2056ba[_0x8baf('0x2c')][_0x8baf('0x2d')]};});_0x22deeb[_0x8baf('0x2e')]=_[_0x8baf('0x29')](_0x231bae,_0x8baf('0x2f'));_0x22deeb[_0x8baf('0x30')]=_['keys'](_0x534869[_0x8baf('0x30')]);_0x22deeb['filters']=_[_0x8baf('0x31')](_0x22deeb[_0x8baf('0x2e')],_0x22deeb[_0x8baf('0x30')]);_0x98190e['attributes']=_['intersection'](_0x22deeb[_0x8baf('0x2e')],qs['fields'](_0x534869[_0x8baf('0x30')][_0x8baf('0x32')]));_0x98190e[_0x8baf('0x33')]=_0x98190e[_0x8baf('0x33')][_0x8baf('0x34')]?_0x98190e['attributes']:_0x22deeb[_0x8baf('0x2e')];if(!_0x534869[_0x8baf('0x30')][_0x8baf('0x35')]('nolimit')){_0x98190e['limit']=qs[_0x8baf('0x1f')](_0x534869[_0x8baf('0x30')]['limit']);_0x98190e[_0x8baf('0x1e')]=qs['offset'](_0x534869['query'][_0x8baf('0x1e')]);}_0x98190e[_0x8baf('0x36')]=qs[_0x8baf('0x37')](_0x534869[_0x8baf('0x30')][_0x8baf('0x37')]);_0x98190e[_0x8baf('0x38')]=qs[_0x8baf('0x39')](_[_0x8baf('0x3a')](_0x534869[_0x8baf('0x30')],_0x22deeb[_0x8baf('0x39')]),_0x231bae);if(_0x534869[_0x8baf('0x30')]['filter']){_0x98190e[_0x8baf('0x38')]=_[_0x8baf('0x3b')](_0x98190e[_0x8baf('0x38')],{'$or':_[_0x8baf('0x29')](_0x231bae,function(_0x390cb9){if(_0x390cb9[_0x8baf('0x2c')]!=='VIRTUAL'){var _0x4ee829={};_0x4ee829[_0x390cb9[_0x8baf('0x2f')]]={'$like':'%'+_0x534869['query'][_0x8baf('0x3c')]+'%'};return _0x4ee829;}})});}_0x98190e=_[_0x8baf('0x3b')]({},_0x98190e,_0x534869['options']);var _0x2c9a4d={'where':_0x98190e[_0x8baf('0x38')]};return db[_0x8baf('0x2a')]['count'](_0x2c9a4d)[_0x8baf('0x24')](function(_0x12c46b){_0x1dfe41[_0x8baf('0x20')]=_0x12c46b;if(_0x534869[_0x8baf('0x30')][_0x8baf('0x3d')]){_0x98190e[_0x8baf('0x3e')]=[{'all':!![]}];}return db[_0x8baf('0x2a')][_0x8baf('0x3f')](_0x98190e);})[_0x8baf('0x24')](function(_0x1e46af){_0x1dfe41[_0x8baf('0x40')]=_0x1e46af;return _0x1dfe41;})['then'](respondWithFilteredResult(_0x5de032,_0x98190e))['catch'](handleError(_0x5de032,null));};exports[_0x8baf('0x41')]=function(_0x3b7839,_0xf3c858){var _0x2df50f={'raw':!![],'where':{'id':_0x3b7839[_0x8baf('0x42')]['id']}},_0x113711={};_0x113711['model']=_[_0x8baf('0x43')](db[_0x8baf('0x2a')]['rawAttributes']);_0x113711[_0x8baf('0x30')]=_[_0x8baf('0x43')](_0x3b7839[_0x8baf('0x30')]);_0x113711[_0x8baf('0x39')]=_['intersection'](_0x113711[_0x8baf('0x2e')],_0x113711[_0x8baf('0x30')]);_0x2df50f[_0x8baf('0x33')]=_[_0x8baf('0x31')](_0x113711[_0x8baf('0x2e')],qs[_0x8baf('0x32')](_0x3b7839['query'][_0x8baf('0x32')]));_0x2df50f[_0x8baf('0x33')]=_0x2df50f['attributes'][_0x8baf('0x34')]?_0x2df50f[_0x8baf('0x33')]:_0x113711['model'];if(_0x3b7839['query'][_0x8baf('0x3d')]){_0x2df50f[_0x8baf('0x3e')]=[{'all':!![]}];}_0x2df50f=_[_0x8baf('0x3b')]({},_0x2df50f,_0x3b7839[_0x8baf('0x44')]);return db[_0x8baf('0x2a')]['find'](_0x2df50f)[_0x8baf('0x24')](handleEntityNotFound(_0xf3c858,null))[_0x8baf('0x24')](respondWithResult(_0xf3c858,null))['catch'](handleError(_0xf3c858,null));};exports[_0x8baf('0x45')]=function(_0x3a1557,_0x71d415){return db[_0x8baf('0x2a')][_0x8baf('0x45')](_0x3a1557[_0x8baf('0x46')],{})['then'](respondWithResult(_0x71d415,0xc9))[_0x8baf('0x47')](handleError(_0x71d415,null));};exports[_0x8baf('0x23')]=function(_0x359b59,_0x53f786){if(_0x359b59['body']['id']){delete _0x359b59['body']['id'];}return db[_0x8baf('0x2a')][_0x8baf('0x48')]({'where':{'id':_0x359b59[_0x8baf('0x42')]['id']}})[_0x8baf('0x24')](handleEntityNotFound(_0x53f786,null))[_0x8baf('0x24')](saveUpdates(_0x359b59[_0x8baf('0x46')],null))[_0x8baf('0x24')](respondWithResult(_0x53f786,null))[_0x8baf('0x47')](handleError(_0x53f786,null));};exports[_0x8baf('0x49')]=function(_0x108853,_0x230c8a){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x108853[_0x8baf('0x42')]['id']}})[_0x8baf('0x24')](handleEntityNotFound(_0x230c8a,null))[_0x8baf('0x24')](removeEntity(_0x230c8a,null))[_0x8baf('0x47')](handleError(_0x230c8a,null));};exports['describe']=function(_0x2012af,_0x298868){return db[_0x8baf('0x2a')]['describe']()['then'](respondWithResult(_0x298868,null))[_0x8baf('0x47')](handleError(_0x298868,null));}; \ No newline at end of file +var _0x55d3=['sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','OpenchannelTransferReport','rawAttributes','fieldName','type','key','map','name','query','keys','model','attributes','fields','length','hasOwnProperty','order'];(function(_0x2ce28d,_0x52734d){var _0x58b480=function(_0x57a165){while(--_0x57a165){_0x2ce28d['push'](_0x2ce28d['shift']());}};_0x58b480(++_0x52734d);}(_0x55d3,0xee));var _0x355d=function(_0x437253,_0x3efaa1){_0x437253=_0x437253-0x0;var _0x2c8333=_0x55d3[_0x437253];return _0x2c8333;};'use strict';var emlformat=require(_0x355d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x355d('0x1'));var jsonpatch=require(_0x355d('0x2'));var rp=require(_0x355d('0x3'));var moment=require(_0x355d('0x4'));var BPromise=require(_0x355d('0x5'));var Mustache=require(_0x355d('0x6'));var util=require('util');var path=require(_0x355d('0x7'));var sox=require(_0x355d('0x8'));var csv=require(_0x355d('0x9'));var ejs=require(_0x355d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x355d('0xb'));var crypto=require(_0x355d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x355d('0xd'));var toCsv=require(_0x355d('0x9'));var querystring=require(_0x355d('0xe'));var Papa=require(_0x355d('0xf'));var Redis=require(_0x355d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x355d('0x11'));var as=require(_0x355d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x355d('0x13'))('api');var utils=require(_0x355d('0x14'));var config=require(_0x355d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x355d('0x16'))['db'];function respondWithStatusCode(_0x2e1674,_0x2dee1b){_0x2dee1b=_0x2dee1b||0xcc;return function(_0xe43756){if(_0xe43756){return _0x2e1674['sendStatus'](_0x2dee1b);}return _0x2e1674[_0x355d('0x17')](_0x2dee1b)['end']();};}function respondWithResult(_0x1010e3,_0x6c3c9a){_0x6c3c9a=_0x6c3c9a||0xc8;return function(_0x4524f1){if(_0x4524f1){return _0x1010e3[_0x355d('0x17')](_0x6c3c9a)[_0x355d('0x18')](_0x4524f1);}};}function respondWithFilteredResult(_0x16f948,_0x3f108a){return function(_0x5ab0b1){if(_0x5ab0b1){var _0x581177=typeof _0x3f108a['offset']==='undefined'&&typeof _0x3f108a[_0x355d('0x19')]==='undefined';var _0x16cf3c=_0x5ab0b1[_0x355d('0x1a')];var _0x5aca10=_0x581177?0x0:_0x3f108a['offset'];var _0x4274cb=_0x581177?_0x5ab0b1[_0x355d('0x1a')]:_0x3f108a[_0x355d('0x1b')]+_0x3f108a[_0x355d('0x19')];var _0x34b5c3;if(_0x4274cb>=_0x16cf3c){_0x4274cb=_0x16cf3c;_0x34b5c3=0xc8;}else{_0x34b5c3=0xce;}_0x16f948['status'](_0x34b5c3);return _0x16f948[_0x355d('0x1c')](_0x355d('0x1d'),_0x5aca10+'-'+_0x4274cb+'/'+_0x16cf3c)[_0x355d('0x18')](_0x5ab0b1);}return null;};}function patchUpdates(_0x1fdbed){return function(_0x5cf733){try{jsonpatch[_0x355d('0x1e')](_0x5cf733,_0x1fdbed,!![]);}catch(_0x52e349){return BPromise['reject'](_0x52e349);}return _0x5cf733[_0x355d('0x1f')]();};}function saveUpdates(_0x4225a2,_0x45d3b3){return function(_0x10c12b){if(_0x10c12b){return _0x10c12b[_0x355d('0x20')](_0x4225a2)[_0x355d('0x21')](function(_0x19cd72){return _0x19cd72;});}return null;};}function removeEntity(_0x45fae4,_0x1140e3){return function(_0xc51ec9){if(_0xc51ec9){return _0xc51ec9[_0x355d('0x22')]()['then'](function(){_0x45fae4['status'](0xcc)[_0x355d('0x23')]();});}};}function handleEntityNotFound(_0xd8523,_0x4e6071){return function(_0x46c643){if(!_0x46c643){_0xd8523[_0x355d('0x24')](0x194);}return _0x46c643;};}function handleError(_0x57dab1,_0xd3b7b9){_0xd3b7b9=_0xd3b7b9||0x1f4;return function(_0x5ad424){logger[_0x355d('0x25')](_0x5ad424[_0x355d('0x26')]);if(_0x5ad424['name']){delete _0x5ad424['name'];}_0x57dab1['status'](_0xd3b7b9)['send'](_0x5ad424);};}exports['index']=function(_0x44d9bb,_0x2aa54b){var _0x28a4b5={},_0x45c156={},_0x37b0dd={'count':0x0,'rows':[]};var _0xb6f084=_['map'](db[_0x355d('0x27')][_0x355d('0x28')],function(_0x11257a){return{'name':_0x11257a[_0x355d('0x29')],'type':_0x11257a[_0x355d('0x2a')][_0x355d('0x2b')]};});_0x45c156['model']=_[_0x355d('0x2c')](_0xb6f084,_0x355d('0x2d'));_0x45c156[_0x355d('0x2e')]=_[_0x355d('0x2f')](_0x44d9bb[_0x355d('0x2e')]);_0x45c156['filters']=_['intersection'](_0x45c156[_0x355d('0x30')],_0x45c156[_0x355d('0x2e')]);_0x28a4b5[_0x355d('0x31')]=_['intersection'](_0x45c156[_0x355d('0x30')],qs[_0x355d('0x32')](_0x44d9bb[_0x355d('0x2e')]['fields']));_0x28a4b5['attributes']=_0x28a4b5[_0x355d('0x31')][_0x355d('0x33')]?_0x28a4b5[_0x355d('0x31')]:_0x45c156[_0x355d('0x30')];if(!_0x44d9bb[_0x355d('0x2e')][_0x355d('0x34')]('nolimit')){_0x28a4b5[_0x355d('0x19')]=qs['limit'](_0x44d9bb[_0x355d('0x2e')][_0x355d('0x19')]);_0x28a4b5[_0x355d('0x1b')]=qs['offset'](_0x44d9bb[_0x355d('0x2e')]['offset']);}_0x28a4b5[_0x355d('0x35')]=qs[_0x355d('0x36')](_0x44d9bb['query'][_0x355d('0x36')]);_0x28a4b5[_0x355d('0x37')]=qs[_0x355d('0x38')](_[_0x355d('0x39')](_0x44d9bb[_0x355d('0x2e')],_0x45c156[_0x355d('0x38')]),_0xb6f084);if(_0x44d9bb['query'][_0x355d('0x3a')]){_0x28a4b5[_0x355d('0x37')]=_[_0x355d('0x3b')](_0x28a4b5[_0x355d('0x37')],{'$or':_[_0x355d('0x2c')](_0xb6f084,function(_0x1815ce){if(_0x1815ce[_0x355d('0x2a')]!=='VIRTUAL'){var _0x49b699={};_0x49b699[_0x1815ce['name']]={'$like':'%'+_0x44d9bb[_0x355d('0x2e')][_0x355d('0x3a')]+'%'};return _0x49b699;}})});}_0x28a4b5=_[_0x355d('0x3b')]({},_0x28a4b5,_0x44d9bb[_0x355d('0x3c')]);var _0x5b902a={'where':_0x28a4b5[_0x355d('0x37')]};return db['OpenchannelTransferReport'][_0x355d('0x1a')](_0x5b902a)[_0x355d('0x21')](function(_0x479f29){_0x37b0dd['count']=_0x479f29;if(_0x44d9bb[_0x355d('0x2e')][_0x355d('0x3d')]){_0x28a4b5[_0x355d('0x3e')]=[{'all':!![]}];}return db[_0x355d('0x27')][_0x355d('0x3f')](_0x28a4b5);})[_0x355d('0x21')](function(_0x2d0e7c){_0x37b0dd[_0x355d('0x40')]=_0x2d0e7c;return _0x37b0dd;})[_0x355d('0x21')](respondWithFilteredResult(_0x2aa54b,_0x28a4b5))[_0x355d('0x41')](handleError(_0x2aa54b,null));};exports[_0x355d('0x42')]=function(_0x546906,_0x4fc2a9){var _0x330fdd={'raw':!![],'where':{'id':_0x546906[_0x355d('0x43')]['id']}},_0x281885={};_0x281885[_0x355d('0x30')]=_['keys'](db[_0x355d('0x27')][_0x355d('0x28')]);_0x281885[_0x355d('0x2e')]=_['keys'](_0x546906[_0x355d('0x2e')]);_0x281885[_0x355d('0x38')]=_[_0x355d('0x44')](_0x281885[_0x355d('0x30')],_0x281885[_0x355d('0x2e')]);_0x330fdd[_0x355d('0x31')]=_['intersection'](_0x281885[_0x355d('0x30')],qs['fields'](_0x546906[_0x355d('0x2e')][_0x355d('0x32')]));_0x330fdd[_0x355d('0x31')]=_0x330fdd[_0x355d('0x31')][_0x355d('0x33')]?_0x330fdd['attributes']:_0x281885[_0x355d('0x30')];if(_0x546906['query']['includeAll']){_0x330fdd[_0x355d('0x3e')]=[{'all':!![]}];}_0x330fdd=_[_0x355d('0x3b')]({},_0x330fdd,_0x546906[_0x355d('0x3c')]);return db[_0x355d('0x27')][_0x355d('0x45')](_0x330fdd)[_0x355d('0x21')](handleEntityNotFound(_0x4fc2a9,null))[_0x355d('0x21')](respondWithResult(_0x4fc2a9,null))[_0x355d('0x41')](handleError(_0x4fc2a9,null));};exports['create']=function(_0x5d85fd,_0x13acb7){return db['OpenchannelTransferReport'][_0x355d('0x46')](_0x5d85fd['body'],{})[_0x355d('0x21')](respondWithResult(_0x13acb7,0xc9))[_0x355d('0x41')](handleError(_0x13acb7,null));};exports[_0x355d('0x20')]=function(_0x116d94,_0x1a495f){if(_0x116d94[_0x355d('0x47')]['id']){delete _0x116d94[_0x355d('0x47')]['id'];}return db[_0x355d('0x27')][_0x355d('0x45')]({'where':{'id':_0x116d94['params']['id']}})['then'](handleEntityNotFound(_0x1a495f,null))[_0x355d('0x21')](saveUpdates(_0x116d94[_0x355d('0x47')],null))[_0x355d('0x21')](respondWithResult(_0x1a495f,null))['catch'](handleError(_0x1a495f,null));};exports[_0x355d('0x22')]=function(_0x3792bc,_0x414f67){return db[_0x355d('0x27')]['find']({'where':{'id':_0x3792bc[_0x355d('0x43')]['id']}})[_0x355d('0x21')](handleEntityNotFound(_0x414f67,null))[_0x355d('0x21')](removeEntity(_0x414f67,null))[_0x355d('0x41')](handleError(_0x414f67,null));};exports['describe']=function(_0xc25510,_0x188ba3){return db[_0x355d('0x27')][_0x355d('0x48')]()[_0x355d('0x21')](respondWithResult(_0x188ba3,null))['catch'](handleError(_0x188ba3,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index c5e211f..28c2908 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 _0x43cf=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','../../config/logger','api','moment','request-promise','rimraf','exports','define'];(function(_0x231686,_0x2746da){var _0x25ba7c=function(_0x34f060){while(--_0x34f060){_0x231686['push'](_0x231686['shift']());}};_0x25ba7c(++_0x2746da);}(_0x43cf,0x1bb));var _0xf43c=function(_0x277af0,_0x1f0361){_0x277af0=_0x277af0-0x0;var _0x43bd7c=_0x43cf[_0x277af0];return _0x43bd7c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf43c('0x0'))(_0xf43c('0x1'));var moment=require(_0xf43c('0x2'));var BPromise=require('bluebird');var rp=require(_0xf43c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf43c('0x4'));var config=require('../../config/environment');var attributes=require('./openchannelTransferReport.attributes');module[_0xf43c('0x5')]=function(_0x1b77e5,_0x4c8379){return _0x1b77e5[_0xf43c('0x6')](_0xf43c('0x7'),attributes,{'tableName':_0xf43c('0x8'),'paranoid':![],'indexes':[{'name':_0xf43c('0x9'),'fields':[_0xf43c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7e91=['exports','define','OpenchannelTransferReport','uniqueid','lodash','util','api','moment','bluebird','path','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e91,0x64));var _0x17e9=function(_0x19edc9,_0x5ea8e4){_0x19edc9=_0x19edc9-0x0;var _0x56c83a=_0x7e91[_0x19edc9];return _0x56c83a;};'use strict';var _=require(_0x17e9('0x0'));var util=require(_0x17e9('0x1'));var logger=require('../../config/logger')(_0x17e9('0x2'));var moment=require(_0x17e9('0x3'));var BPromise=require(_0x17e9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x17e9('0x5'));var rimraf=require('rimraf');var config=require(_0x17e9('0x6'));var attributes=require(_0x17e9('0x7'));module[_0x17e9('0x8')]=function(_0x485f42,_0x51dd93){return _0x485f42[_0x17e9('0x9')](_0x17e9('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x17e9('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 5dd464a..725781a 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 _0xce50=['randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird'];(function(_0x14bdf1,_0x2c5db6){var _0xd0ab9b=function(_0x5e3918){while(--_0x5e3918){_0x14bdf1['push'](_0x14bdf1['shift']());}};_0xd0ab9b(++_0x2c5db6);}(_0xce50,0x1d8));var _0x0ce5=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xce50[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0x0ce5('0x0'));var moment=require(_0x0ce5('0x1'));var BPromise=require(_0x0ce5('0x2'));var rs=require(_0x0ce5('0x3'));var fs=require('fs');var Redis=require(_0x0ce5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0ce5('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0ce5('0x6'));var client=jayson[_0x0ce5('0x7')][_0x0ce5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3eb5b2,_0x4b2c43,_0x32610d){return new BPromise(function(_0x8d611f,_0x4d9a49){return client[_0x0ce5('0x9')](_0x3eb5b2,_0x32610d)['then'](function(_0x4475c9){logger[_0x0ce5('0xa')](_0x0ce5('0xb'),_0x4b2c43,_0x0ce5('0xc'));logger['debug'](_0x0ce5('0xd'),_0x4b2c43,_0x0ce5('0xc'),JSON[_0x0ce5('0xe')](_0x4475c9));if(_0x4475c9[_0x0ce5('0xf')]){if(_0x4475c9[_0x0ce5('0xf')]['code']===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x4b2c43,_0x4475c9[_0x0ce5('0xf')][_0x0ce5('0x10')]);return _0x4d9a49(_0x4475c9[_0x0ce5('0xf')][_0x0ce5('0x10')]);}logger['error'](_0x0ce5('0xb'),_0x4b2c43,_0x4475c9[_0x0ce5('0xf')]['message']);return _0x8d611f(_0x4475c9[_0x0ce5('0xf')]['message']);}else{logger[_0x0ce5('0xa')](_0x0ce5('0xb'),_0x4b2c43,_0x0ce5('0xc'));_0x8d611f(_0x4475c9[_0x0ce5('0x11')][_0x0ce5('0x10')]);}})[_0x0ce5('0x12')](function(_0x13486a){logger[_0x0ce5('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4b2c43,_0x13486a);_0x4d9a49(_0x13486a);});});} \ No newline at end of file +var _0x4148=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4148,0xc6));var _0x8414=function(_0x43ad57,_0x463504){_0x43ad57=_0x43ad57-0x0;var _0x38c75f=_0x4148[_0x43ad57];return _0x38c75f;};'use strict';var _=require(_0x8414('0x0'));var util=require(_0x8414('0x1'));var moment=require(_0x8414('0x2'));var BPromise=require(_0x8414('0x3'));var rs=require(_0x8414('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8414('0x5'))['db'];var utils=require(_0x8414('0x6'));var logger=require(_0x8414('0x7'))(_0x8414('0x8'));var config=require('../../config/environment');var jayson=require(_0x8414('0x9'));var client=jayson['client'][_0x8414('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x507e0b,_0x51ab01,_0x131b88){return new BPromise(function(_0x2444b7,_0x1623c3){return client[_0x8414('0xb')](_0x507e0b,_0x131b88)[_0x8414('0xc')](function(_0xd625a7){logger[_0x8414('0xd')](_0x8414('0xe'),_0x51ab01,_0x8414('0xf'));logger[_0x8414('0x10')](_0x8414('0x11'),_0x51ab01,'request\x20sent',JSON[_0x8414('0x12')](_0xd625a7));if(_0xd625a7['error']){if(_0xd625a7[_0x8414('0x13')][_0x8414('0x14')]===0x1f4){logger[_0x8414('0x13')](_0x8414('0xe'),_0x51ab01,_0xd625a7['error'][_0x8414('0x15')]);return _0x1623c3(_0xd625a7['error'][_0x8414('0x15')]);}logger[_0x8414('0x13')](_0x8414('0xe'),_0x51ab01,_0xd625a7['error'][_0x8414('0x15')]);return _0x2444b7(_0xd625a7[_0x8414('0x13')][_0x8414('0x15')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x51ab01,_0x8414('0xf'));_0x2444b7(_0xd625a7[_0x8414('0x16')][_0x8414('0x15')]);}})[_0x8414('0x17')](function(_0x5b92aa){logger[_0x8414('0x13')](_0x8414('0xe'),_0x51ab01,_0x5b92aa);_0x1623c3(_0x5b92aa);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index ba59f0d..75e8621 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 _0x7d12=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0x7d12,0xc0));var _0x27d1=function(_0x34acae,_0x1472d8){_0x34acae=_0x34acae-0x0;var _0x2d475f=_0x7d12[_0x34acae];return _0x2d475f;};'use strict';var multer=require(_0x27d1('0x0'));var util=require(_0x27d1('0x1'));var path=require(_0x27d1('0x2'));var timeout=require('connect-timeout');var express=require(_0x27d1('0x3'));var router=express[_0x27d1('0x4')]();var fs_extra=require(_0x27d1('0x5'));var auth=require(_0x27d1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x27d1('0x7'));var controller=require('./pause.controller');router['get']('/',auth[_0x27d1('0x8')](),controller[_0x27d1('0x9')]);router[_0x27d1('0xa')](_0x27d1('0xb'),auth[_0x27d1('0x8')](),controller[_0x27d1('0xc')]);router[_0x27d1('0xd')]('/',auth['isAuthenticated'](),controller[_0x27d1('0xe')]);router[_0x27d1('0xf')](_0x27d1('0xb'),auth[_0x27d1('0x8')](),controller[_0x27d1('0x10')]);router[_0x27d1('0x11')]('/:id',auth[_0x27d1('0x8')](),controller[_0x27d1('0x12')]);module[_0x27d1('0x13')]=router; \ No newline at end of file +var _0x37c9=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./pause.controller','get'];(function(_0x1c8c07,_0x2579af){var _0x4aa88f=function(_0x2ad13d){while(--_0x2ad13d){_0x1c8c07['push'](_0x1c8c07['shift']());}};_0x4aa88f(++_0x2579af);}(_0x37c9,0x1d7));var _0x937c=function(_0x324255,_0x1455f0){_0x324255=_0x324255-0x0;var _0x14bb02=_0x37c9[_0x324255];return _0x14bb02;};'use strict';var multer=require(_0x937c('0x0'));var util=require(_0x937c('0x1'));var path=require('path');var timeout=require(_0x937c('0x2'));var express=require(_0x937c('0x3'));var router=express[_0x937c('0x4')]();var fs_extra=require(_0x937c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x937c('0x6'));var config=require('../../config/environment');var controller=require(_0x937c('0x7'));router[_0x937c('0x8')]('/',auth[_0x937c('0x9')](),controller[_0x937c('0xa')]);router[_0x937c('0x8')](_0x937c('0xb'),auth[_0x937c('0x9')](),controller[_0x937c('0xc')]);router[_0x937c('0xd')]('/',auth[_0x937c('0x9')](),controller[_0x937c('0xe')]);router[_0x937c('0xf')](_0x937c('0xb'),auth[_0x937c('0x9')](),controller[_0x937c('0x10')]);router[_0x937c('0x11')](_0x937c('0xb'),auth[_0x937c('0x9')](),controller[_0x937c('0x12')]);module[_0x937c('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 07728f4..5e8f0d8 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 _0x041b=['name','STRING','exports'];(function(_0x2dd3a3,_0x544c5e){var _0x329cdf=function(_0x4b59da){while(--_0x4b59da){_0x2dd3a3['push'](_0x2dd3a3['shift']());}};_0x329cdf(++_0x544c5e);}(_0x041b,0x1e2));var _0xb041=function(_0xb68e1e,_0x23c57f){_0xb68e1e=_0xb68e1e-0x0;var _0x3f3a74=_0x041b[_0xb68e1e];return _0x3f3a74;};'use strict';var Sequelize=require('sequelize');module[_0xb041('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xb041('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xb041('0x2')]}}; \ No newline at end of file +var _0x87b3=['name','STRING','sequelize'];(function(_0x10bd27,_0xa2db61){var _0x1678da=function(_0x581ef6){while(--_0x581ef6){_0x10bd27['push'](_0x10bd27['shift']());}};_0x1678da(++_0xa2db61);}(_0x87b3,0x173));var _0x387b=function(_0x46a12b,_0x30a223){_0x46a12b=_0x46a12b-0x0;var _0x42f240=_0x87b3[_0x46a12b];return _0x42f240;};'use strict';var Sequelize=require(_0x387b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x387b('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x387b('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 32e5bcb..a20362f 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 _0x540f=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','count','set','Content-Range','json','apply','reject','save','update','destroy','then','get','Pauses','UserProfileResource','error','name','send','index','map','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','Pause','includeAll','include','findAll','rows','catch','params','keys','length','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','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x5829cf,_0xc4e655){var _0x296c00=function(_0x9aa760){while(--_0x9aa760){_0x5829cf['push'](_0x5829cf['shift']());}};_0x296c00(++_0xc4e655);}(_0x540f,0x1a3));var _0xf540=function(_0x231a47,_0x46a963){_0x231a47=_0x231a47-0x0;var _0x48d7c9=_0x540f[_0x231a47];return _0x48d7c9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf540('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf540('0x1'));var moment=require(_0xf540('0x2'));var BPromise=require(_0xf540('0x3'));var Mustache=require(_0xf540('0x4'));var util=require(_0xf540('0x5'));var path=require(_0xf540('0x6'));var sox=require(_0xf540('0x7'));var csv=require(_0xf540('0x8'));var ejs=require(_0xf540('0x9'));var fs=require('fs');var fs_extra=require(_0xf540('0xa'));var _=require(_0xf540('0xb'));var squel=require(_0xf540('0xc'));var crypto=require(_0xf540('0xd'));var jsforce=require(_0xf540('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf540('0x8'));var querystring=require(_0xf540('0xf'));var Papa=require(_0xf540('0x10'));var Redis=require(_0xf540('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf540('0x12'));var as=require(_0xf540('0x13'));var hardwareService=require(_0xf540('0x14'));var logger=require(_0xf540('0x15'))(_0xf540('0x16'));var utils=require(_0xf540('0x17'));var config=require(_0xf540('0x18'));var licenseUtil=require(_0xf540('0x19'));var db=require(_0xf540('0x1a'))['db'];function respondWithStatusCode(_0x4d9928,_0x46ba83){_0x46ba83=_0x46ba83||0xcc;return function(_0x45454e){if(_0x45454e){return _0x4d9928[_0xf540('0x1b')](_0x46ba83);}return _0x4d9928[_0xf540('0x1c')](_0x46ba83)[_0xf540('0x1d')]();};}function respondWithResult(_0x3922ec,_0x3820b5){_0x3820b5=_0x3820b5||0xc8;return function(_0x12a3a8){if(_0x12a3a8){return _0x3922ec[_0xf540('0x1c')](_0x3820b5)['json'](_0x12a3a8);}};}function respondWithFilteredResult(_0x2b593e,_0x54d63a){return function(_0xe163b9){if(_0xe163b9){var _0x53b28f=typeof _0x54d63a[_0xf540('0x1e')]==='undefined'&&typeof _0x54d63a['limit']==='undefined';var _0xe1218f=_0xe163b9[_0xf540('0x1f')];var _0x54ccc6=_0x53b28f?0x0:_0x54d63a['offset'];var _0x4ebcdb=_0x53b28f?_0xe163b9[_0xf540('0x1f')]:_0x54d63a[_0xf540('0x1e')]+_0x54d63a['limit'];var _0x50c7b6;if(_0x4ebcdb>=_0xe1218f){_0x4ebcdb=_0xe1218f;_0x50c7b6=0xc8;}else{_0x50c7b6=0xce;}_0x2b593e[_0xf540('0x1c')](_0x50c7b6);return _0x2b593e[_0xf540('0x20')](_0xf540('0x21'),_0x54ccc6+'-'+_0x4ebcdb+'/'+_0xe1218f)[_0xf540('0x22')](_0xe163b9);}return null;};}function patchUpdates(_0x426aa8){return function(_0x1a13fc){try{jsonpatch[_0xf540('0x23')](_0x1a13fc,_0x426aa8,!![]);}catch(_0x4491c6){return BPromise[_0xf540('0x24')](_0x4491c6);}return _0x1a13fc[_0xf540('0x25')]();};}function saveUpdates(_0x3f36c7,_0x3a0ef2){return function(_0x62a6e8){if(_0x62a6e8){return _0x62a6e8[_0xf540('0x26')](_0x3f36c7)['then'](function(_0x2cad56){return _0x2cad56;});}return null;};}function removeEntity(_0x3933e8,_0x4a2a84){return function(_0x664d79){if(_0x664d79){return _0x664d79[_0xf540('0x27')]()[_0xf540('0x28')](function(){var _0x535c57=_0x664d79[_0xf540('0x29')]({'plain':!![]});var _0x4ce61a=_0xf540('0x2a');return db[_0xf540('0x2b')]['destroy']({'where':{'type':_0x4ce61a,'resourceId':_0x535c57['id']}})[_0xf540('0x28')](function(){return _0x664d79;});})['then'](function(){_0x3933e8[_0xf540('0x1c')](0xcc)[_0xf540('0x1d')]();});}};}function handleEntityNotFound(_0x4f115f,_0x5957e1){return function(_0x2983ca){if(!_0x2983ca){_0x4f115f[_0xf540('0x1b')](0x194);}return _0x2983ca;};}function handleError(_0x1de6a7,_0x427cd0){_0x427cd0=_0x427cd0||0x1f4;return function(_0x3773e5){logger[_0xf540('0x2c')](_0x3773e5['stack']);if(_0x3773e5[_0xf540('0x2d')]){delete _0x3773e5[_0xf540('0x2d')];}_0x1de6a7[_0xf540('0x1c')](_0x427cd0)[_0xf540('0x2e')](_0x3773e5);};}exports[_0xf540('0x2f')]=function(_0x173e4d,_0x4095cd){var _0x2d934c={},_0x55d8e7={},_0x24caa2={'count':0x0,'rows':[]};var _0x2ca340=_[_0xf540('0x30')](db['Pause']['rawAttributes'],function(_0x488fe0){return{'name':_0x488fe0[_0xf540('0x31')],'type':_0x488fe0[_0xf540('0x32')][_0xf540('0x33')]};});_0x55d8e7['model']=_[_0xf540('0x30')](_0x2ca340,_0xf540('0x2d'));_0x55d8e7[_0xf540('0x34')]=_['keys'](_0x173e4d[_0xf540('0x34')]);_0x55d8e7[_0xf540('0x35')]=_[_0xf540('0x36')](_0x55d8e7[_0xf540('0x37')],_0x55d8e7[_0xf540('0x34')]);_0x2d934c['attributes']=_['intersection'](_0x55d8e7[_0xf540('0x37')],qs[_0xf540('0x38')](_0x173e4d['query']['fields']));_0x2d934c['attributes']=_0x2d934c['attributes']['length']?_0x2d934c[_0xf540('0x39')]:_0x55d8e7[_0xf540('0x37')];if(!_0x173e4d['query'][_0xf540('0x3a')]('nolimit')){_0x2d934c['limit']=qs[_0xf540('0x3b')](_0x173e4d[_0xf540('0x34')][_0xf540('0x3b')]);_0x2d934c[_0xf540('0x1e')]=qs[_0xf540('0x1e')](_0x173e4d[_0xf540('0x34')][_0xf540('0x1e')]);}_0x2d934c[_0xf540('0x3c')]=qs['sort'](_0x173e4d[_0xf540('0x34')][_0xf540('0x3d')]);_0x2d934c[_0xf540('0x3e')]=qs[_0xf540('0x35')](_[_0xf540('0x3f')](_0x173e4d['query'],_0x55d8e7[_0xf540('0x35')]),_0x2ca340);if(_0x173e4d[_0xf540('0x34')][_0xf540('0x40')]){_0x2d934c[_0xf540('0x3e')]=_['merge'](_0x2d934c[_0xf540('0x3e')],{'$or':_[_0xf540('0x30')](_0x2ca340,function(_0x252204){if(_0x252204['type']!==_0xf540('0x41')){var _0x57f1d9={};_0x57f1d9[_0x252204[_0xf540('0x2d')]]={'$like':'%'+_0x173e4d[_0xf540('0x34')][_0xf540('0x40')]+'%'};return _0x57f1d9;}})});}_0x2d934c=_[_0xf540('0x42')]({},_0x2d934c,_0x173e4d[_0xf540('0x43')]);var _0x548141={'where':_0x2d934c[_0xf540('0x3e')]};return db[_0xf540('0x44')][_0xf540('0x1f')](_0x548141)[_0xf540('0x28')](function(_0x2a1201){_0x24caa2[_0xf540('0x1f')]=_0x2a1201;if(_0x173e4d[_0xf540('0x34')][_0xf540('0x45')]){_0x2d934c[_0xf540('0x46')]=[{'all':!![]}];}return db['Pause'][_0xf540('0x47')](_0x2d934c);})['then'](function(_0x4c58d7){_0x24caa2[_0xf540('0x48')]=_0x4c58d7;return _0x24caa2;})[_0xf540('0x28')](respondWithFilteredResult(_0x4095cd,_0x2d934c))[_0xf540('0x49')](handleError(_0x4095cd,null));};exports['show']=function(_0x4d1daa,_0x16f7c9){var _0x2d3bd5={'raw':!![],'where':{'id':_0x4d1daa[_0xf540('0x4a')]['id']}},_0x414832={};_0x414832['model']=_[_0xf540('0x4b')](db[_0xf540('0x44')]['rawAttributes']);_0x414832['query']=_[_0xf540('0x4b')](_0x4d1daa[_0xf540('0x34')]);_0x414832[_0xf540('0x35')]=_['intersection'](_0x414832[_0xf540('0x37')],_0x414832['query']);_0x2d3bd5[_0xf540('0x39')]=_[_0xf540('0x36')](_0x414832[_0xf540('0x37')],qs[_0xf540('0x38')](_0x4d1daa[_0xf540('0x34')][_0xf540('0x38')]));_0x2d3bd5[_0xf540('0x39')]=_0x2d3bd5['attributes'][_0xf540('0x4c')]?_0x2d3bd5[_0xf540('0x39')]:_0x414832[_0xf540('0x37')];if(_0x4d1daa[_0xf540('0x34')][_0xf540('0x45')]){_0x2d3bd5[_0xf540('0x46')]=[{'all':!![]}];}_0x2d3bd5=_[_0xf540('0x42')]({},_0x2d3bd5,_0x4d1daa[_0xf540('0x43')]);return db[_0xf540('0x44')][_0xf540('0x4d')](_0x2d3bd5)['then'](handleEntityNotFound(_0x16f7c9,null))[_0xf540('0x28')](respondWithResult(_0x16f7c9,null))[_0xf540('0x49')](handleError(_0x16f7c9,null));};exports[_0xf540('0x4e')]=function(_0x508b2d,_0x3df8a6){return db[_0xf540('0x44')]['create'](_0x508b2d[_0xf540('0x4f')],{})[_0xf540('0x28')](function(_0x22127f){var _0xa169ce=_0x508b2d[_0xf540('0x50')][_0xf540('0x29')]({'plain':!![]});if(!_0xa169ce)throw new Error(_0xf540('0x51'));if(_0xa169ce[_0xf540('0x52')]==='user'){var _0x4df2f9=_0x22127f[_0xf540('0x29')]({'plain':!![]});var _0x491496=_0xf540('0x2a');return db[_0xf540('0x53')][_0xf540('0x4d')]({'where':{'name':_0x491496,'userProfileId':_0xa169ce[_0xf540('0x54')]},'raw':!![]})[_0xf540('0x28')](function(_0x1587ff){if(_0x1587ff&&_0x1587ff[_0xf540('0x55')]===0x0){return db[_0xf540('0x2b')][_0xf540('0x4e')]({'name':_0x4df2f9['name'],'resourceId':_0x4df2f9['id'],'type':_0x1587ff[_0xf540('0x2d')],'sectionId':_0x1587ff['id']},{})['then'](function(){return _0x22127f;});}else{return _0x22127f;}})[_0xf540('0x49')](function(_0x4f43b9){logger[_0xf540('0x2c')](_0xf540('0x56'),_0x4f43b9);throw _0x4f43b9;});}return _0x22127f;})[_0xf540('0x28')](respondWithResult(_0x3df8a6,0xc9))[_0xf540('0x49')](handleError(_0x3df8a6,null));};exports[_0xf540('0x26')]=function(_0x1d8c10,_0x40e8ec){if(_0x1d8c10[_0xf540('0x4f')]['id']){delete _0x1d8c10[_0xf540('0x4f')]['id'];}return db[_0xf540('0x44')][_0xf540('0x4d')]({'where':{'id':_0x1d8c10['params']['id']}})[_0xf540('0x28')](handleEntityNotFound(_0x40e8ec,null))[_0xf540('0x28')](saveUpdates(_0x1d8c10[_0xf540('0x4f')],null))[_0xf540('0x28')](respondWithResult(_0x40e8ec,null))[_0xf540('0x49')](handleError(_0x40e8ec,null));};exports['destroy']=function(_0x103469,_0x45ba65){return db[_0xf540('0x44')]['find']({'where':{'id':_0x103469[_0xf540('0x4a')]['id']}})['then'](handleEntityNotFound(_0x45ba65,null))['then'](removeEntity(_0x45ba65,null))[_0xf540('0x49')](handleError(_0x45ba65,null));}; \ No newline at end of file +var _0xdd6a=['sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','zip-dir','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd6a,0xc1));var _0xadd6=function(_0x395928,_0x51afb0){_0x395928=_0x395928-0x0;var _0x4efda4=_0xdd6a[_0x395928];return _0x4efda4;};'use strict';var emlformat=require(_0xadd6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xadd6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xadd6('0x2'));var util=require(_0xadd6('0x3'));var path=require(_0xadd6('0x4'));var sox=require(_0xadd6('0x5'));var csv=require(_0xadd6('0x6'));var ejs=require(_0xadd6('0x7'));var fs=require('fs');var fs_extra=require(_0xadd6('0x8'));var _=require(_0xadd6('0x9'));var squel=require(_0xadd6('0xa'));var crypto=require('crypto');var jsforce=require(_0xadd6('0xb'));var deskjs=require(_0xadd6('0xc'));var toCsv=require(_0xadd6('0x6'));var querystring=require(_0xadd6('0xd'));var Papa=require(_0xadd6('0xe'));var Redis=require(_0xadd6('0xf'));var authService=require(_0xadd6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xadd6('0x11'));var hardwareService=require(_0xadd6('0x12'));var logger=require(_0xadd6('0x13'))(_0xadd6('0x14'));var utils=require(_0xadd6('0x15'));var config=require(_0xadd6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xadd6('0x17'))['db'];function respondWithStatusCode(_0x14b9ff,_0x44149e){_0x44149e=_0x44149e||0xcc;return function(_0x4ed324){if(_0x4ed324){return _0x14b9ff[_0xadd6('0x18')](_0x44149e);}return _0x14b9ff[_0xadd6('0x19')](_0x44149e)[_0xadd6('0x1a')]();};}function respondWithResult(_0x522bcf,_0x1fea8d){_0x1fea8d=_0x1fea8d||0xc8;return function(_0x5a9ae7){if(_0x5a9ae7){return _0x522bcf[_0xadd6('0x19')](_0x1fea8d)[_0xadd6('0x1b')](_0x5a9ae7);}};}function respondWithFilteredResult(_0x2d502b,_0x2aa453){return function(_0xa87381){if(_0xa87381){var _0x278bd8=typeof _0x2aa453[_0xadd6('0x1c')]===_0xadd6('0x1d')&&typeof _0x2aa453[_0xadd6('0x1e')]==='undefined';var _0x1c99a4=_0xa87381[_0xadd6('0x1f')];var _0x544d0e=_0x278bd8?0x0:_0x2aa453[_0xadd6('0x1c')];var _0x54e732=_0x278bd8?_0xa87381['count']:_0x2aa453[_0xadd6('0x1c')]+_0x2aa453[_0xadd6('0x1e')];var _0x49ae1d;if(_0x54e732>=_0x1c99a4){_0x54e732=_0x1c99a4;_0x49ae1d=0xc8;}else{_0x49ae1d=0xce;}_0x2d502b[_0xadd6('0x19')](_0x49ae1d);return _0x2d502b['set'](_0xadd6('0x20'),_0x544d0e+'-'+_0x54e732+'/'+_0x1c99a4)[_0xadd6('0x1b')](_0xa87381);}return null;};}function patchUpdates(_0x3c1798){return function(_0x464ec2){try{jsonpatch[_0xadd6('0x21')](_0x464ec2,_0x3c1798,!![]);}catch(_0x1cde67){return BPromise[_0xadd6('0x22')](_0x1cde67);}return _0x464ec2[_0xadd6('0x23')]();};}function saveUpdates(_0x4da3be,_0x5cf829){return function(_0x2e508d){if(_0x2e508d){return _0x2e508d[_0xadd6('0x24')](_0x4da3be)[_0xadd6('0x25')](function(_0x667269){return _0x667269;});}return null;};}function removeEntity(_0x1f6d53,_0x27ee2c){return function(_0x36cb4d){if(_0x36cb4d){return _0x36cb4d[_0xadd6('0x26')]()[_0xadd6('0x25')](function(){var _0x82d7ef=_0x36cb4d[_0xadd6('0x27')]({'plain':!![]});var _0x2e164a=_0xadd6('0x28');return db[_0xadd6('0x29')]['destroy']({'where':{'type':_0x2e164a,'resourceId':_0x82d7ef['id']}})['then'](function(){return _0x36cb4d;});})[_0xadd6('0x25')](function(){_0x1f6d53[_0xadd6('0x19')](0xcc)[_0xadd6('0x1a')]();});}};}function handleEntityNotFound(_0x3056d6,_0x1e8780){return function(_0x107ce3){if(!_0x107ce3){_0x3056d6[_0xadd6('0x18')](0x194);}return _0x107ce3;};}function handleError(_0x1021be,_0x78d03a){_0x78d03a=_0x78d03a||0x1f4;return function(_0x4d016c){logger['error'](_0x4d016c[_0xadd6('0x2a')]);if(_0x4d016c[_0xadd6('0x2b')]){delete _0x4d016c[_0xadd6('0x2b')];}_0x1021be[_0xadd6('0x19')](_0x78d03a)[_0xadd6('0x2c')](_0x4d016c);};}exports[_0xadd6('0x2d')]=function(_0xdea0b2,_0x45b6e4){var _0x424f93={},_0x4d3e3e={},_0x6bd5e8={'count':0x0,'rows':[]};var _0x36191e=_[_0xadd6('0x2e')](db[_0xadd6('0x2f')][_0xadd6('0x30')],function(_0x40c7b9){return{'name':_0x40c7b9[_0xadd6('0x31')],'type':_0x40c7b9[_0xadd6('0x32')]['key']};});_0x4d3e3e['model']=_[_0xadd6('0x2e')](_0x36191e,'name');_0x4d3e3e[_0xadd6('0x33')]=_[_0xadd6('0x34')](_0xdea0b2[_0xadd6('0x33')]);_0x4d3e3e[_0xadd6('0x35')]=_[_0xadd6('0x36')](_0x4d3e3e[_0xadd6('0x37')],_0x4d3e3e['query']);_0x424f93[_0xadd6('0x38')]=_[_0xadd6('0x36')](_0x4d3e3e[_0xadd6('0x37')],qs['fields'](_0xdea0b2[_0xadd6('0x33')][_0xadd6('0x39')]));_0x424f93['attributes']=_0x424f93[_0xadd6('0x38')][_0xadd6('0x3a')]?_0x424f93[_0xadd6('0x38')]:_0x4d3e3e['model'];if(!_0xdea0b2[_0xadd6('0x33')][_0xadd6('0x3b')](_0xadd6('0x3c'))){_0x424f93[_0xadd6('0x1e')]=qs['limit'](_0xdea0b2[_0xadd6('0x33')][_0xadd6('0x1e')]);_0x424f93[_0xadd6('0x1c')]=qs['offset'](_0xdea0b2[_0xadd6('0x33')]['offset']);}_0x424f93[_0xadd6('0x3d')]=qs[_0xadd6('0x3e')](_0xdea0b2[_0xadd6('0x33')][_0xadd6('0x3e')]);_0x424f93[_0xadd6('0x3f')]=qs[_0xadd6('0x35')](_[_0xadd6('0x40')](_0xdea0b2[_0xadd6('0x33')],_0x4d3e3e[_0xadd6('0x35')]),_0x36191e);if(_0xdea0b2[_0xadd6('0x33')]['filter']){_0x424f93[_0xadd6('0x3f')]=_[_0xadd6('0x41')](_0x424f93['where'],{'$or':_['map'](_0x36191e,function(_0x4fdb69){if(_0x4fdb69['type']!==_0xadd6('0x42')){var _0x36df35={};_0x36df35[_0x4fdb69[_0xadd6('0x2b')]]={'$like':'%'+_0xdea0b2[_0xadd6('0x33')][_0xadd6('0x43')]+'%'};return _0x36df35;}})});}_0x424f93=_[_0xadd6('0x41')]({},_0x424f93,_0xdea0b2[_0xadd6('0x44')]);var _0x55c1c9={'where':_0x424f93[_0xadd6('0x3f')]};return db['Pause'][_0xadd6('0x1f')](_0x55c1c9)['then'](function(_0x1b85ea){_0x6bd5e8[_0xadd6('0x1f')]=_0x1b85ea;if(_0xdea0b2[_0xadd6('0x33')]['includeAll']){_0x424f93[_0xadd6('0x45')]=[{'all':!![]}];}return db[_0xadd6('0x2f')][_0xadd6('0x46')](_0x424f93);})[_0xadd6('0x25')](function(_0x286229){_0x6bd5e8[_0xadd6('0x47')]=_0x286229;return _0x6bd5e8;})[_0xadd6('0x25')](respondWithFilteredResult(_0x45b6e4,_0x424f93))[_0xadd6('0x48')](handleError(_0x45b6e4,null));};exports[_0xadd6('0x49')]=function(_0xbb0311,_0x66ab70){var _0xb4c555={'raw':!![],'where':{'id':_0xbb0311[_0xadd6('0x4a')]['id']}},_0x4e7fb2={};_0x4e7fb2[_0xadd6('0x37')]=_[_0xadd6('0x34')](db[_0xadd6('0x2f')][_0xadd6('0x30')]);_0x4e7fb2[_0xadd6('0x33')]=_[_0xadd6('0x34')](_0xbb0311[_0xadd6('0x33')]);_0x4e7fb2[_0xadd6('0x35')]=_['intersection'](_0x4e7fb2[_0xadd6('0x37')],_0x4e7fb2[_0xadd6('0x33')]);_0xb4c555['attributes']=_['intersection'](_0x4e7fb2['model'],qs[_0xadd6('0x39')](_0xbb0311[_0xadd6('0x33')][_0xadd6('0x39')]));_0xb4c555[_0xadd6('0x38')]=_0xb4c555['attributes'][_0xadd6('0x3a')]?_0xb4c555[_0xadd6('0x38')]:_0x4e7fb2[_0xadd6('0x37')];if(_0xbb0311['query'][_0xadd6('0x4b')]){_0xb4c555[_0xadd6('0x45')]=[{'all':!![]}];}_0xb4c555=_[_0xadd6('0x41')]({},_0xb4c555,_0xbb0311[_0xadd6('0x44')]);return db[_0xadd6('0x2f')]['find'](_0xb4c555)[_0xadd6('0x25')](handleEntityNotFound(_0x66ab70,null))[_0xadd6('0x25')](respondWithResult(_0x66ab70,null))[_0xadd6('0x48')](handleError(_0x66ab70,null));};exports[_0xadd6('0x4c')]=function(_0x16433b,_0x4342f2){return db[_0xadd6('0x2f')][_0xadd6('0x4c')](_0x16433b[_0xadd6('0x4d')],{})[_0xadd6('0x25')](function(_0xebb9e9){var _0x4b27b8=_0x16433b[_0xadd6('0x4e')]['get']({'plain':!![]});if(!_0x4b27b8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b27b8[_0xadd6('0x4f')]===_0xadd6('0x4e')){var _0x45e6e1=_0xebb9e9[_0xadd6('0x27')]({'plain':!![]});var _0x5965a9='Pauses';return db[_0xadd6('0x50')]['find']({'where':{'name':_0x5965a9,'userProfileId':_0x4b27b8[_0xadd6('0x51')]},'raw':!![]})[_0xadd6('0x25')](function(_0x182f4c){if(_0x182f4c&&_0x182f4c[_0xadd6('0x52')]===0x0){return db[_0xadd6('0x29')]['create']({'name':_0x45e6e1[_0xadd6('0x2b')],'resourceId':_0x45e6e1['id'],'type':_0x182f4c[_0xadd6('0x2b')],'sectionId':_0x182f4c['id']},{})['then'](function(){return _0xebb9e9;});}else{return _0xebb9e9;}})[_0xadd6('0x48')](function(_0xea31e9){logger['error'](_0xadd6('0x53'),_0xea31e9);throw _0xea31e9;});}return _0xebb9e9;})[_0xadd6('0x25')](respondWithResult(_0x4342f2,0xc9))['catch'](handleError(_0x4342f2,null));};exports[_0xadd6('0x24')]=function(_0x1b4934,_0x115762){if(_0x1b4934[_0xadd6('0x4d')]['id']){delete _0x1b4934[_0xadd6('0x4d')]['id'];}return db[_0xadd6('0x2f')][_0xadd6('0x54')]({'where':{'id':_0x1b4934[_0xadd6('0x4a')]['id']}})[_0xadd6('0x25')](handleEntityNotFound(_0x115762,null))['then'](saveUpdates(_0x1b4934[_0xadd6('0x4d')],null))[_0xadd6('0x25')](respondWithResult(_0x115762,null))[_0xadd6('0x48')](handleError(_0x115762,null));};exports['destroy']=function(_0x2dd4e5,_0x2ac03b){return db[_0xadd6('0x2f')][_0xadd6('0x54')]({'where':{'id':_0x2dd4e5[_0xadd6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2ac03b,null))['then'](removeEntity(_0x2ac03b,null))[_0xadd6('0x48')](handleError(_0x2ac03b,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 9fcf0df..9f4b534 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 _0xc4aa=['bluebird','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x29e35c,_0x11530b){var _0x3c8bb8=function(_0x3226a6){while(--_0x3226a6){_0x29e35c['push'](_0x29e35c['shift']());}};_0x3c8bb8(++_0x11530b);}(_0x53ec,0x192));var _0xc53e=function(_0x12e31d,_0x4b76fb){_0x12e31d=_0x12e31d-0x0;var _0x506d58=_0x53ec[_0x12e31d];return _0x506d58;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index d8264df..8c810b5 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x44e291,_0x325e22){var _0x28057d=function(_0x5317bb){while(--_0x5317bb){_0x44e291['push'](_0x44e291['shift']());}};_0x28057d(++_0x325e22);}(_0xb10b,0x12a));var _0xbb10=function(_0x4bfb8b,_0x10b39f){_0x4bfb8b=_0x4bfb8b-0x0;var _0x48f13c=_0xb10b[_0x4bfb8b];return _0x48f13c;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x249072,_0x4de8e6){var _0x11344f=function(_0x5e27b0){while(--_0x5e27b0){_0x249072['push'](_0x249072['shift']());}};_0x11344f(++_0x4de8e6);}(_0x7a54,0x106));var _0x47a5=function(_0x4dd759,_0x1410f8){_0x4dd759=_0x4dd759-0x0;var _0x323743=_0x7a54[_0x4dd759];return _0x323743;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index c789ee6..70ab85f 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 _0x54ef=['show','/:id/download','download','diskStorage','join','root','originalname','replace','format','basename','extname','post','upload','webhookPost','put','/:id','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','index','get','/webhook','isAuthenticated'];(function(_0x2b9e8a,_0x7b21d4){var _0x520e67=function(_0x22bce8){while(--_0x22bce8){_0x2b9e8a['push'](_0x2b9e8a['shift']());}};_0x520e67(++_0x7b21d4);}(_0x54ef,0x112));var _0xf54e=function(_0x16d449,_0x12ac6a){_0x16d449=_0x16d449-0x0;var _0x23220b=_0x54ef[_0x16d449];return _0x23220b;};'use strict';var multer=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var path=require(_0xf54e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf54e('0x3'));var router=express[_0xf54e('0x4')]();var fs_extra=require(_0xf54e('0x5'));var auth=require(_0xf54e('0x6'));var interaction=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var controller=require(_0xf54e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf54e('0xa')]);router[_0xf54e('0xb')](_0xf54e('0xc'),controller['webhookGet']);router[_0xf54e('0xb')]('/:id',auth[_0xf54e('0xd')](),controller[_0xf54e('0xe')]);router['get'](_0xf54e('0xf'),auth[_0xf54e('0xd')](),controller[_0xf54e('0x10')]);var upload=multer({'storage':multer[_0xf54e('0x11')]({'destination':function(_0x5f232a,_0x558502,_0xc939ab){_0xc939ab(null,path[_0xf54e('0x12')](config[_0xf54e('0x13')],'server/files/plugins'));},'filename':function(_0x358c88,_0x4b0ee1,_0x4bd828){_0x4b0ee1[_0xf54e('0x14')]=_0x4b0ee1[_0xf54e('0x14')][_0xf54e('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4bd828(null,util[_0xf54e('0x16')]('%s-%s%s',path[_0xf54e('0x17')](_0x4b0ee1[_0xf54e('0x14')],path[_0xf54e('0x18')](_0x4b0ee1[_0xf54e('0x14')])),Date['now'](),path[_0xf54e('0x18')](_0x4b0ee1[_0xf54e('0x14')])));}})});router[_0xf54e('0x19')]('/',upload['single']('file'),controller[_0xf54e('0x1a')]);router[_0xf54e('0x19')](_0xf54e('0xc'),controller[_0xf54e('0x1b')]);router[_0xf54e('0x1c')](_0xf54e('0x1d'),auth[_0xf54e('0xd')](),controller[_0xf54e('0x1e')]);router[_0xf54e('0x1f')](_0xf54e('0x1d'),auth[_0xf54e('0xd')](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0xe5b3=['now','file','upload','/webhook','webhookPost','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','webhookGet','/:id','isAuthenticated','/:id/download','download','diskStorage','root','server/files/plugins','originalname','format','extname'];(function(_0x41db32,_0x3efd91){var _0x3334d0=function(_0x39ff01){while(--_0x39ff01){_0x41db32['push'](_0x41db32['shift']());}};_0x3334d0(++_0x3efd91);}(_0xe5b3,0x133));var _0x3e5b=function(_0xacf63d,_0x39a774){_0xacf63d=_0xacf63d-0x0;var _0x1e4b61=_0xe5b3[_0xacf63d];return _0x1e4b61;};'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')]('/webhook',controller[_0x3e5b('0xc')]);router[_0x3e5b('0xa')](_0x3e5b('0xd'),auth[_0x3e5b('0xe')](),controller['show']);router['get'](_0x3e5b('0xf'),auth[_0x3e5b('0xe')](),controller[_0x3e5b('0x10')]);var upload=multer({'storage':multer[_0x3e5b('0x11')]({'destination':function(_0xeeaabc,_0x522e9e,_0x3be027){_0x3be027(null,path['join'](config[_0x3e5b('0x12')],_0x3e5b('0x13')));},'filename':function(_0x4d69dd,_0x374068,_0x20b97b){_0x374068[_0x3e5b('0x14')]=_0x374068[_0x3e5b('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x20b97b(null,util[_0x3e5b('0x15')]('%s-%s%s',path['basename'](_0x374068['originalname'],path[_0x3e5b('0x16')](_0x374068[_0x3e5b('0x14')])),Date[_0x3e5b('0x17')](),path['extname'](_0x374068[_0x3e5b('0x14')])));}})});router['post']('/',upload['single'](_0x3e5b('0x18')),controller[_0x3e5b('0x19')]);router['post'](_0x3e5b('0x1a'),controller[_0x3e5b('0x1b')]);router['put'](_0x3e5b('0xd'),auth[_0x3e5b('0xe')](),controller['update']);router['delete'](_0x3e5b('0xd'),auth[_0x3e5b('0xe')](),controller[_0x3e5b('0x1c')]);module[_0x3e5b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index e6d7e63..d0d5405 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 _0x2d42=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','TEXT'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x2d42,0xea));var _0x22d4=function(_0x1ae4f1,_0x4521d1){_0x1ae4f1=_0x1ae4f1-0x0;var _0xcdcd9a=_0x2d42[_0x1ae4f1];return _0xcdcd9a;};'use strict';var Sequelize=require(_0x22d4('0x0'));module[_0x22d4('0x1')]={'name':{'type':Sequelize[_0x22d4('0x2')]},'type':{'type':Sequelize[_0x22d4('0x3')](_0x22d4('0x4'),'script')},'description':{'type':Sequelize[_0x22d4('0x5')]},'version':{'type':Sequelize[_0x22d4('0x5')]},'path':{'type':Sequelize[_0x22d4('0x2')],'comment':_0x22d4('0x6')},'active':{'type':Sequelize[_0x22d4('0x7')],'defaultValue':0x0,'comment':_0x22d4('0x8')},'sidebar':{'type':Sequelize['ENUM']('adminOnly','agentOnly',_0x22d4('0x9'),_0x22d4('0xa')),'defaultValue':_0x22d4('0x9'),'comment':_0x22d4('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x22d4('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xabf3=['agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x304b67,_0x31cb39){var _0x493afb=function(_0x21dce3){while(--_0x21dce3){_0x304b67['push'](_0x304b67['shift']());}};_0x493afb(++_0x31cb39);}(_0xabf3,0xc4));var _0x3abf=function(_0x5da3eb,_0x10c6f0){_0x5da3eb=_0x5da3eb-0x0;var _0x35242b=_0xabf3[_0x5da3eb];return _0x35242b;};'use strict';var Sequelize=require('sequelize');module[_0x3abf('0x0')]={'name':{'type':Sequelize[_0x3abf('0x1')]},'type':{'type':Sequelize[_0x3abf('0x2')](_0x3abf('0x3'),_0x3abf('0x4'))},'description':{'type':Sequelize[_0x3abf('0x5')]},'version':{'type':Sequelize[_0x3abf('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0x3abf('0x6')},'active':{'type':Sequelize[_0x3abf('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x3abf('0x2')]('adminOnly',_0x3abf('0x8'),_0x3abf('0x9'),_0x3abf('0xa')),'defaultValue':_0x3abf('0x9'),'comment':_0x3abf('0xb')},'icon':{'type':Sequelize[_0x3abf('0x1')]},'adminUrl':{'type':Sequelize[_0x3abf('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x3abf('0x1')]},'scriptPath':{'type':Sequelize[_0x3abf('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 9545da7..571d30b 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 _0x9f6a=['agent','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','body','dirname','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','encoding','method','headers','content-length','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','http://localhost:','%s%s','content-type','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','UserProfileResource','destroy','then','error','stack','name','send','index','Plugin','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','show','params','catch','download','find','join','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','root','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','Temporary\x20file\x20removed','upload','extname','file','filename','info','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','admin'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9f6a,0xda));var _0xa9f6=function(_0x55b460,_0x497077){_0x55b460=_0x55b460-0x0;var _0x3ac537=_0x9f6a[_0x55b460];return _0x3ac537;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa9f6('0x0'));var zipdir=require(_0xa9f6('0x1'));var jsonpatch=require(_0xa9f6('0x2'));var rp=require(_0xa9f6('0x3'));var moment=require(_0xa9f6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa9f6('0x5'));var util=require(_0xa9f6('0x6'));var path=require(_0xa9f6('0x7'));var sox=require(_0xa9f6('0x8'));var csv=require(_0xa9f6('0x9'));var ejs=require(_0xa9f6('0xa'));var fs=require('fs');var fs_extra=require(_0xa9f6('0xb'));var _=require(_0xa9f6('0xc'));var squel=require(_0xa9f6('0xd'));var crypto=require('crypto');var jsforce=require(_0xa9f6('0xe'));var deskjs=require(_0xa9f6('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0xa9f6('0x0'));var archiver=require(_0xa9f6('0x10'));var Redis=require(_0xa9f6('0x11'));var authService=require(_0xa9f6('0x12'));var qs=require(_0xa9f6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9f6('0x14'));var logger=require(_0xa9f6('0x15'))(_0xa9f6('0x16'));var utils=require(_0xa9f6('0x17'));var config=require(_0xa9f6('0x18'));var licenseUtil=require(_0xa9f6('0x19'));var db=require(_0xa9f6('0x1a'))['db'];config[_0xa9f6('0x1b')]=_['defaults'](config[_0xa9f6('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xa9f6('0x1c'))(new Redis(config[_0xa9f6('0x1b')]));require(_0xa9f6('0x1d'))[_0xa9f6('0x1e')](socket);function respondWithStatusCode(_0x333c35,_0x21f57a){_0x21f57a=_0x21f57a||0xcc;return function(_0x4ea33d){if(_0x4ea33d){return _0x333c35[_0xa9f6('0x1f')](_0x21f57a);}return _0x333c35[_0xa9f6('0x20')](_0x21f57a)[_0xa9f6('0x21')]();};}function respondWithResult(_0x128f8c,_0x4eb133){_0x4eb133=_0x4eb133||0xc8;return function(_0x476df2){if(_0x476df2){return _0x128f8c[_0xa9f6('0x20')](_0x4eb133)['json'](_0x476df2);}};}function respondWithFilteredResult(_0x16d570,_0xb2acf4){return function(_0xac0fba){if(_0xac0fba){var _0xf918a=typeof _0xb2acf4[_0xa9f6('0x22')]==='undefined'&&typeof _0xb2acf4['limit']===_0xa9f6('0x23');var _0x44420e=_0xac0fba['count'];var _0x2bbd5e=_0xf918a?0x0:_0xb2acf4[_0xa9f6('0x22')];var _0x6c9dae=_0xf918a?_0xac0fba['count']:_0xb2acf4['offset']+_0xb2acf4[_0xa9f6('0x24')];var _0x71231d;if(_0x6c9dae>=_0x44420e){_0x6c9dae=_0x44420e;_0x71231d=0xc8;}else{_0x71231d=0xce;}_0x16d570[_0xa9f6('0x20')](_0x71231d);return _0x16d570[_0xa9f6('0x25')](_0xa9f6('0x26'),_0x2bbd5e+'-'+_0x6c9dae+'/'+_0x44420e)[_0xa9f6('0x27')](_0xac0fba);}return null;};}function patchUpdates(_0x3f3e2c){return function(_0x38d30e){try{jsonpatch[_0xa9f6('0x28')](_0x38d30e,_0x3f3e2c,!![]);}catch(_0x17f86e){return BPromise[_0xa9f6('0x29')](_0x17f86e);}return _0x38d30e[_0xa9f6('0x2a')]();};}function saveUpdates(_0x2d867e,_0x1446bf){return function(_0x2b4f33){if(_0x2b4f33){return _0x2b4f33['update'](_0x2d867e)['then'](function(_0x3dee88){return _0x3dee88;});}return null;};}function removeEntity(_0x2ea3d9,_0xb9fac9){return function(_0x15f3c9){if(_0x15f3c9){return _0x15f3c9['destroy']()['then'](function(){var _0x3d1d9e=_0x15f3c9['get']({'plain':!![]});var _0x5b821f='Plugins';return db[_0xa9f6('0x2b')][_0xa9f6('0x2c')]({'where':{'type':_0x5b821f,'resourceId':_0x3d1d9e['id']}})[_0xa9f6('0x2d')](function(){return _0x15f3c9;});})['then'](function(){_0x2ea3d9[_0xa9f6('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3869b8,_0x4c25e0){return function(_0xc8fb20){if(!_0xc8fb20){_0x3869b8['sendStatus'](0x194);}return _0xc8fb20;};}function handleError(_0x24a906,_0xc1aa68){_0xc1aa68=_0xc1aa68||0x1f4;return function(_0x4d548e){logger[_0xa9f6('0x2e')](_0x4d548e[_0xa9f6('0x2f')]);if(_0x4d548e[_0xa9f6('0x30')]){delete _0x4d548e[_0xa9f6('0x30')];}_0x24a906[_0xa9f6('0x20')](_0xc1aa68)[_0xa9f6('0x31')](_0x4d548e);};}exports[_0xa9f6('0x32')]=function(_0x5c429b,_0x3fd1df){var _0x406128={},_0x411588={},_0x3f8872={'count':0x0,'rows':[]};var _0x13eca4=_['map'](db[_0xa9f6('0x33')][_0xa9f6('0x34')],function(_0x38452c){return{'name':_0x38452c['fieldName'],'type':_0x38452c[_0xa9f6('0x35')][_0xa9f6('0x36')]};});_0x411588[_0xa9f6('0x37')]=_[_0xa9f6('0x38')](_0x13eca4,_0xa9f6('0x30'));_0x411588[_0xa9f6('0x39')]=_[_0xa9f6('0x3a')](_0x5c429b[_0xa9f6('0x39')]);_0x411588[_0xa9f6('0x3b')]=_[_0xa9f6('0x3c')](_0x411588['model'],_0x411588[_0xa9f6('0x39')]);_0x406128[_0xa9f6('0x3d')]=_[_0xa9f6('0x3c')](_0x411588[_0xa9f6('0x37')],qs[_0xa9f6('0x3e')](_0x5c429b[_0xa9f6('0x39')][_0xa9f6('0x3e')]));_0x406128[_0xa9f6('0x3d')]=_0x406128[_0xa9f6('0x3d')][_0xa9f6('0x3f')]?_0x406128[_0xa9f6('0x3d')]:_0x411588[_0xa9f6('0x37')];if(!_0x5c429b[_0xa9f6('0x39')][_0xa9f6('0x40')](_0xa9f6('0x41'))){_0x406128[_0xa9f6('0x24')]=qs[_0xa9f6('0x24')](_0x5c429b['query'][_0xa9f6('0x24')]);_0x406128[_0xa9f6('0x22')]=qs[_0xa9f6('0x22')](_0x5c429b[_0xa9f6('0x39')][_0xa9f6('0x22')]);}_0x406128[_0xa9f6('0x42')]=qs['sort'](_0x5c429b['query'][_0xa9f6('0x43')]);_0x406128[_0xa9f6('0x44')]=qs[_0xa9f6('0x3b')](_[_0xa9f6('0x45')](_0x5c429b[_0xa9f6('0x39')],_0x411588[_0xa9f6('0x3b')]),_0x13eca4);if(_0x5c429b[_0xa9f6('0x39')][_0xa9f6('0x46')]){_0x406128[_0xa9f6('0x44')]=_[_0xa9f6('0x47')](_0x406128[_0xa9f6('0x44')],{'$or':_[_0xa9f6('0x38')](_0x13eca4,function(_0x41c154){if(_0x41c154[_0xa9f6('0x35')]!=='VIRTUAL'){var _0x56be17={};_0x56be17[_0x41c154[_0xa9f6('0x30')]]={'$like':'%'+_0x5c429b[_0xa9f6('0x39')][_0xa9f6('0x46')]+'%'};return _0x56be17;}})});}_0x406128=_[_0xa9f6('0x47')]({},_0x406128,_0x5c429b[_0xa9f6('0x48')]);var _0x4dcd4f={'where':_0x406128[_0xa9f6('0x44')]};return db[_0xa9f6('0x33')][_0xa9f6('0x49')](_0x4dcd4f)['then'](function(_0x21328b){_0x3f8872[_0xa9f6('0x49')]=_0x21328b;if(_0x5c429b[_0xa9f6('0x39')][_0xa9f6('0x4a')]){_0x406128[_0xa9f6('0x4b')]=[{'all':!![]}];}return db[_0xa9f6('0x33')][_0xa9f6('0x4c')](_0x406128);})[_0xa9f6('0x2d')](function(_0x1fe76b){_0x3f8872[_0xa9f6('0x4d')]=_0x1fe76b;return _0x3f8872;})[_0xa9f6('0x2d')](respondWithFilteredResult(_0x3fd1df,_0x406128))['catch'](handleError(_0x3fd1df,null));};exports[_0xa9f6('0x4e')]=function(_0x4ee226,_0x50e5d3){var _0x1d3519={'raw':!![],'where':{'id':_0x4ee226[_0xa9f6('0x4f')]['id']}},_0x1ead70={};_0x1ead70[_0xa9f6('0x37')]=_[_0xa9f6('0x3a')](db['Plugin'][_0xa9f6('0x34')]);_0x1ead70[_0xa9f6('0x39')]=_[_0xa9f6('0x3a')](_0x4ee226[_0xa9f6('0x39')]);_0x1ead70[_0xa9f6('0x3b')]=_[_0xa9f6('0x3c')](_0x1ead70['model'],_0x1ead70[_0xa9f6('0x39')]);_0x1d3519['attributes']=_['intersection'](_0x1ead70[_0xa9f6('0x37')],qs[_0xa9f6('0x3e')](_0x4ee226[_0xa9f6('0x39')]['fields']));_0x1d3519['attributes']=_0x1d3519[_0xa9f6('0x3d')][_0xa9f6('0x3f')]?_0x1d3519[_0xa9f6('0x3d')]:_0x1ead70[_0xa9f6('0x37')];if(_0x4ee226[_0xa9f6('0x39')][_0xa9f6('0x4a')]){_0x1d3519[_0xa9f6('0x4b')]=[{'all':!![]}];}_0x1d3519=_[_0xa9f6('0x47')]({},_0x1d3519,_0x4ee226[_0xa9f6('0x48')]);return db[_0xa9f6('0x33')]['find'](_0x1d3519)[_0xa9f6('0x2d')](handleEntityNotFound(_0x50e5d3,null))['then'](respondWithResult(_0x50e5d3,null))[_0xa9f6('0x50')](handleError(_0x50e5d3,null));};exports[_0xa9f6('0x51')]=function(_0x3ed6af,_0x45ac2c,_0x5449cc){return db[_0xa9f6('0x33')][_0xa9f6('0x52')]({'where':{'id':_0x3ed6af[_0xa9f6('0x4f')]['id']},'attributes':['name',_0xa9f6('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x45ac2c,null))[_0xa9f6('0x2d')](function(_0x524890){if(_0x524890){var _0x6fb08f=path[_0xa9f6('0x53')](config['root'],_0xa9f6('0x54'),util['format'](_0xa9f6('0x55'),path[_0xa9f6('0x56')](_0x524890[_0xa9f6('0x7')])));var _0x3a7c76=fs[_0xa9f6('0x57')](_0x6fb08f);var _0x1c0685=archiver(_0xa9f6('0x58'),{'zlib':{'level':0x9}});_0x1c0685['on'](_0xa9f6('0x59'),function(_0x1efad7){if(_0x1efad7[_0xa9f6('0x5a')]===_0xa9f6('0x5b')){logger['error'](_0x1efad7);}else{throw new db['Sequelize'][(_0xa9f6('0x5c'))](_0xa9f6('0x5d'));}});_0x1c0685['on'](_0xa9f6('0x2e'),function(_0x298935){throw new db[(_0xa9f6('0x5e'))]['Error'](_0xa9f6('0x5d'));});_0x1c0685[_0xa9f6('0x5f')](_0x3a7c76);_0x1c0685[_0xa9f6('0x60')](_0xa9f6('0x61'),{'cwd':path[_0xa9f6('0x53')](config[_0xa9f6('0x62')],'server/files/plugins',path['dirname'](_0x524890['path'])),'ignore':[path[_0xa9f6('0x53')](path[_0xa9f6('0x56')](_0x524890[_0xa9f6('0x7')]),_0xa9f6('0x63')),path[_0xa9f6('0x53')](path['basename'](_0x524890[_0xa9f6('0x7')]),_0xa9f6('0x64'))],'nodir':!![]})[_0xa9f6('0x65')]();_0x3a7c76['on'](_0xa9f6('0x66'),function(){if(!fs[_0xa9f6('0x67')](_0x6fb08f)){throw new db[(_0xa9f6('0x5e'))][(_0xa9f6('0x5c'))](_0xa9f6('0x68'));}return _0x45ac2c[_0xa9f6('0x51')](_0x6fb08f,util[_0xa9f6('0x69')](_0xa9f6('0x55'),path[_0xa9f6('0x56')](_0x524890['path'])),function(_0x3bad55){if(_0x3bad55){throw new db[(_0xa9f6('0x5e'))][(_0xa9f6('0x5c'))](_0xa9f6('0x6a'));}fs['unlinkSync'](_0x6fb08f);logger['info'](_0xa9f6('0x6b'));logger['info'](_0xa9f6('0x6c'));});});}return null;})[_0xa9f6('0x50')](handleError(_0x45ac2c,null));};exports[_0xa9f6('0x6d')]=function(_0x4f1714,_0x2cfbb6,_0x41c6e9){var _0x3dcb1e=path[_0xa9f6('0x56')](_0x4f1714['file']['filename'],path[_0xa9f6('0x6e')](_0x4f1714[_0xa9f6('0x6f')][_0xa9f6('0x70')]));var _0x21141a=path['join'](config[_0xa9f6('0x62')],_0xa9f6('0x54'),_0x4f1714['file']['filename']);var _0x3eaf75=path[_0xa9f6('0x53')](config[_0xa9f6('0x62')],_0xa9f6('0x54'),_0x3dcb1e);logger[_0xa9f6('0x71')](_0xa9f6('0x72'),_0x21141a);logger[_0xa9f6('0x71')](_0xa9f6('0x73'),_0x3eaf75);try{fs[_0xa9f6('0x74')](_0x21141a,parseInt('0777',0x8));extract(_0x21141a,{'dir':_0x3eaf75},function(_0x5823c9){if(_0x5823c9){logger[_0xa9f6('0x2e')](_0x5823c9);handleError(_0x5823c9,!![]);};var _0xcba70e=fs[_0xa9f6('0x75')](_0x3eaf75);if(_0xcba70e['length']>0x1){removeReferences(_0x21141a,_0x3eaf75);logger[_0xa9f6('0x2e')](_0xa9f6('0x76'));return _0x41c6e9(new Error(_0xa9f6('0x76')));}var _0x2bbbdf=fs['lstatSync'](path[_0xa9f6('0x53')](_0x3eaf75,_0xcba70e[0x0]));if(_0x2bbbdf['isFile']()){removeReferences(_0x21141a,_0x3eaf75);logger[_0xa9f6('0x2e')](_0xa9f6('0x76'));return _0x41c6e9(new Error('Invalid\x20plugin\x20structure'));}if(_0x2bbbdf[_0xa9f6('0x77')]()){var _0x31dc83=fs['readdirSync'](path[_0xa9f6('0x53')](_0x3eaf75,_0xcba70e[0x0]));if(_0x31dc83[_0xa9f6('0x3f')]===0x0){removeReferences(_0x21141a,_0x3eaf75);logger[_0xa9f6('0x2e')](_0xa9f6('0x76'));return _0x41c6e9(new Error('Invalid\x20plugin\x20structure'));}var _0x1772b5=_0x31dc83['some'](function(_0x3aab15){return _0x3aab15===_0xa9f6('0x78');});if(!_0x1772b5){return _0x41c6e9(new Error(_0xa9f6('0x79')));}var _0x1e6024=fs[_0xa9f6('0x7a')](path[_0xa9f6('0x53')](_0x3eaf75,_0xcba70e[0x0],_0xa9f6('0x78')));var _0x48e0fa=JSON[_0xa9f6('0x7b')](_0x1e6024);if('undefined'==typeof _0x48e0fa[_0xa9f6('0x30')]){return _0x41c6e9(new Error(_0xa9f6('0x7c')));}if(_0xa9f6('0x23')==typeof _0x48e0fa[_0xa9f6('0x35')]){return _0x41c6e9(new Error(_0xa9f6('0x7d')));}if(_0xa9f6('0x23')==typeof _0x48e0fa[_0xa9f6('0x7e')]){return _0x41c6e9(new Error(_0xa9f6('0x7f')));}if(_0xa9f6('0x23')==typeof _0x48e0fa[_0xa9f6('0x80')]){return _0x41c6e9(new Error(_0xa9f6('0x81')));}if(_0x48e0fa[_0xa9f6('0x35')]==='html'){if('undefined'==typeof _0x48e0fa[_0xa9f6('0x80')][_0xa9f6('0x82')]){return _0x41c6e9(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xa9f6('0x23')==typeof _0x48e0fa[_0xa9f6('0x80')][_0xa9f6('0x82')][_0xa9f6('0x83')]&&'undefined'==typeof _0x48e0fa[_0xa9f6('0x80')]['views'][_0xa9f6('0x84')]){return _0x41c6e9(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x48e0fa[_0xa9f6('0x35')]==='script'){if(_0xa9f6('0x23')==typeof _0x48e0fa[_0xa9f6('0x80')][_0xa9f6('0x85')]){return _0x41c6e9(new Error(_0xa9f6('0x86')));}if(_0xa9f6('0x23')==typeof _0x48e0fa[_0xa9f6('0x80')][_0xa9f6('0x87')]){return _0x41c6e9(new Error(_0xa9f6('0x88')));}}else{return _0x41c6e9(new Error(_0xa9f6('0x89')));}var _0x9e2232=_0x48e0fa['name'];var _0x5a547a=_0x48e0fa[_0xa9f6('0x8a')];var _0x5ad214=_0x48e0fa[_0xa9f6('0x35')];var _0x42f0b7=_0x48e0fa[_0xa9f6('0x8b')]?_0x48e0fa['sidebar']:'always';var _0x3fb419=_0x48e0fa[_0xa9f6('0x8c')]?_0x48e0fa[_0xa9f6('0x8c')]:'icon-apps';var _0x32d362='';var _0x16619f='';var _0x12b53f='';var _0x46db7f='';var _0x25fe9f=_0x48e0fa['version'];if(_0x5ad214===_0xa9f6('0x8d')){if('undefined'!=typeof _0x48e0fa[_0xa9f6('0x80')][_0xa9f6('0x82')]['admin']){var _0x232149=_0x48e0fa['parameters'][_0xa9f6('0x82')][_0xa9f6('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xa9f6('0x8e')](_0x232149)){_0x32d362=path['join'](_0xa9f6('0x8f'),_0x3dcb1e,_0xcba70e[0x0],_0x232149);}else{_0x32d362=_0x232149;}}else{logger[_0xa9f6('0x71')](_0xa9f6('0x90'));}if(_0xa9f6('0x23')!=typeof _0x48e0fa[_0xa9f6('0x80')][_0xa9f6('0x82')][_0xa9f6('0x84')]){var _0x5dc9cb=_0x48e0fa[_0xa9f6('0x80')]['views'][_0xa9f6('0x84')];if(!/^(f|ht)tps?:\/\//i[_0xa9f6('0x8e')](_0x5dc9cb)){_0x16619f=path[_0xa9f6('0x53')]('plugins',_0x3dcb1e,_0xcba70e[0x0],_0x5dc9cb);}else{_0x16619f=_0x5dc9cb;}}else{logger[_0xa9f6('0x71')](_0xa9f6('0x91'));}}else if(_0x5ad214==='script'){_0x12b53f=_0x48e0fa[_0xa9f6('0x80')][_0xa9f6('0x85')];_0x46db7f=_0x48e0fa['parameters'][_0xa9f6('0x87')];if(_0xa9f6('0x23')!=typeof _0x48e0fa[_0xa9f6('0x80')]['views']){if(_0xa9f6('0x23')!=typeof _0x48e0fa[_0xa9f6('0x80')]['views'][_0xa9f6('0x83')]){var _0x232149=_0x48e0fa['parameters']['views'][_0xa9f6('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xa9f6('0x8e')](_0x232149)){_0x32d362=path[_0xa9f6('0x53')]('plugins',_0x3dcb1e,_0xcba70e[0x0],_0x232149);}else{_0x32d362=_0x232149;}}if(_0xa9f6('0x23')!=typeof _0x48e0fa['parameters'][_0xa9f6('0x82')][_0xa9f6('0x84')]){var _0x5dc9cb=_0x48e0fa[_0xa9f6('0x80')][_0xa9f6('0x82')][_0xa9f6('0x84')];if(!/^(f|ht)tps?:\/\//i['test'](_0x5dc9cb)){_0x16619f=path[_0xa9f6('0x53')]('plugins',_0x3dcb1e,_0xcba70e[0x0],_0x5dc9cb);}else{_0x16619f=_0x5dc9cb;}}}}var _0x669096={'name':_0x9e2232,'description':_0x5a547a,'path':path[_0xa9f6('0x53')](_0x3dcb1e,_0xcba70e[0x0]),'type':_0x5ad214,'sidebar':_0x42f0b7,'icon':_0x3fb419,'adminUrl':_0x32d362,'agentUrl':_0x16619f,'scriptName':_0x12b53f,'scriptPath':_0x46db7f,'version':_0x25fe9f};removeReferences(_0x21141a,null);return db['Plugin'][_0xa9f6('0x92')](_0x669096)[_0xa9f6('0x2d')](function(_0x42ff53){var _0x2d0ec3={'role':_0x4f1714['body'][_0xa9f6('0x93')],'userProfileId':_0x4f1714['body'][_0xa9f6('0x94')]};if(!_0x2d0ec3)throw new Error(_0xa9f6('0x95'));if(_0x2d0ec3[_0xa9f6('0x93')]==='user'){var _0x23ea49=_0x42ff53['get']({'plain':!![]});return db[_0xa9f6('0x96')][_0xa9f6('0x52')]({'where':{'name':_0xa9f6('0x97'),'userProfileId':_0x2d0ec3[_0xa9f6('0x94')]},'raw':!![]})[_0xa9f6('0x2d')](function(_0x1e7686){if(_0x1e7686&&_0x1e7686[_0xa9f6('0x98')]===0x0){return db[_0xa9f6('0x2b')][_0xa9f6('0x92')]({'name':_0x23ea49[_0xa9f6('0x30')],'resourceId':_0x23ea49['id'],'type':_0x1e7686[_0xa9f6('0x30')],'sectionId':_0x1e7686['id']},{})[_0xa9f6('0x2d')](function(){return _0x42ff53;});}else{return _0x42ff53;}})[_0xa9f6('0x50')](function(_0x1fff3e){logger['error'](_0xa9f6('0x99'),_0x1fff3e);throw _0x1fff3e;});}return _0x42ff53;})[_0xa9f6('0x2d')](respondWithResult(_0x2cfbb6,null))[_0xa9f6('0x50')](handleError(_0x2cfbb6,null));}});}catch(_0x22a3a2){_0x2cfbb6[_0xa9f6('0x20')](0x1f4)[_0xa9f6('0x31')](_0x22a3a2);}};function removeReferences(_0x1a8c92,_0x41c11a){try{if(_0x1a8c92){fs[_0xa9f6('0x9a')](_0x1a8c92);logger[_0xa9f6('0x71')](_0xa9f6('0x9b'));}if(_0x41c11a){rimraf(_0x41c11a,function(){});logger[_0xa9f6('0x71')](_0xa9f6('0x9c'));}}catch(_0x2ab0e6){logger[_0xa9f6('0x2e')](_0x2ab0e6);}}exports[_0xa9f6('0x9d')]=function(_0x5f3a3c,_0x3dc4e0,_0x5a616b){return db[_0xa9f6('0x33')][_0xa9f6('0x52')]({'where':{'id':_0x5f3a3c['params']['id']}})[_0xa9f6('0x2d')](handleEntityNotFound(_0x3dc4e0,null))[_0xa9f6('0x2d')](saveUpdates(_0x5f3a3c[_0xa9f6('0x9e')],null))[_0xa9f6('0x2d')](respondWithResult(_0x3dc4e0,null))[_0xa9f6('0x50')](handleError(_0x3dc4e0,null));};exports['delete']=function(_0x11e918,_0x2c22f5,_0x2350a9){return db[_0xa9f6('0x33')][_0xa9f6('0x52')]({'where':{'id':_0x11e918[_0xa9f6('0x4f')]['id']}})[_0xa9f6('0x2d')](function(_0x44f50d){if(_0x44f50d){return _0x44f50d['destroy']();}})[_0xa9f6('0x2d')](function(_0x2b07fd){rimraf(path[_0xa9f6('0x53')](config[_0xa9f6('0x62')],_0xa9f6('0x54'),path[_0xa9f6('0x9f')](_0x2b07fd[_0xa9f6('0x7')])),function(){});return _0x2b07fd;})['then'](handleEntityNotFound(_0x2c22f5,null))['then'](respondWithStatusCode(_0x2c22f5,null))[_0xa9f6('0x50')](handleError(_0x2c22f5,null));};exports['webhookGet']=function(_0x324e8b,_0x45a7a4,_0x2dd754){return BPromise[_0xa9f6('0xa0')]()[_0xa9f6('0x2d')](function(){if(!_0x324e8b[_0xa9f6('0x39')][_0xa9f6('0x7')]){throw new Error(_0xa9f6('0xa1'));}if(!_0x324e8b[_0xa9f6('0x39')][_0xa9f6('0xa2')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0xdb4e5c=_0x324e8b[_0xa9f6('0x39')]['hostname']?_0x324e8b[_0xa9f6('0x39')][_0xa9f6('0xa3')]+':'+_0x324e8b[_0xa9f6('0x39')][_0xa9f6('0xa2')]:'http://localhost:'+_0x324e8b['query']['port'];var _0x2f97a9=_0x324e8b[_0xa9f6('0x39')]['json']?_0x324e8b[_0xa9f6('0x39')][_0xa9f6('0x27')]:!![];var _0x4df9f4=_0x324e8b[_0xa9f6('0x39')][_0xa9f6('0xa4')]?_0x324e8b[_0xa9f6('0x39')][_0xa9f6('0xa4')]:null;var _0x8f1d51={'method':_0x324e8b[_0xa9f6('0xa5')],'uri':util[_0xa9f6('0x69')]('%s%s',_0xdb4e5c,_0x324e8b['query'][_0xa9f6('0x7')]),'json':_0x2f97a9,'resolveWithFullResponse':!![],'encoding':_0x4df9f4,'qs':_0x324e8b[_0xa9f6('0x39')]};if(_0x324e8b[_0xa9f6('0xa6')]){_0x8f1d51[_0xa9f6('0xa6')]=_0x324e8b[_0xa9f6('0xa6')];if(_0x8f1d51['headers'][_0xa9f6('0xa7')]){delete _0x8f1d51[_0xa9f6('0xa6')][_0xa9f6('0xa7')];}}if(_0x8f1d51['headers']['content-type']){delete _0x8f1d51['headers']['content-type'];}return rp(_0x8f1d51);})[_0xa9f6('0x2d')](function(_0xba7be5){if(_0xba7be5){_0x45a7a4['set'](_0xba7be5[_0xa9f6('0xa6')]);logger[_0xa9f6('0x71')](_0xba7be5[_0xa9f6('0x9e')]);if(_[_0xa9f6('0xa8')](_0x324e8b[_0xa9f6('0x39')][_0xa9f6('0x7')],_0xa9f6('0x51'))&&_0xba7be5[_0xa9f6('0xa9')]==0x1f4){return _0x45a7a4[_0xa9f6('0x1f')](_0xba7be5[_0xa9f6('0xa9')]);}else{return _0x45a7a4[_0xa9f6('0x20')](_0xba7be5[_0xa9f6('0xa9')])[_0xa9f6('0x31')](_0xba7be5['body']);}}else{return _0x45a7a4[_0xa9f6('0x1f')](0xc8);}})['catch'](handleError(_0x45a7a4,null));};exports[_0xa9f6('0xaa')]=function(_0x5a68dc,_0x205822,_0x4a8026){return BPromise[_0xa9f6('0xa0')]()[_0xa9f6('0x2d')](function(){if(!_0x5a68dc[_0xa9f6('0x39')][_0xa9f6('0x7')]){throw new Error(_0xa9f6('0xa1'));}if(!_0x5a68dc['query'][_0xa9f6('0xa2')]){throw new Error(_0xa9f6('0xab'));}var _0x19bea2=_0x5a68dc[_0xa9f6('0x39')][_0xa9f6('0xa3')]?_0x5a68dc[_0xa9f6('0x39')][_0xa9f6('0xa3')]+':'+_0x5a68dc[_0xa9f6('0x39')][_0xa9f6('0xa2')]:_0xa9f6('0xac')+_0x5a68dc[_0xa9f6('0x39')][_0xa9f6('0xa2')];var _0x272319=_0x5a68dc[_0xa9f6('0x39')][_0xa9f6('0x27')]?_0x5a68dc[_0xa9f6('0x39')]['json']:!![];var _0x25080f=_0x5a68dc['query'][_0xa9f6('0xa4')]?_0x5a68dc[_0xa9f6('0x39')][_0xa9f6('0xa4')]:null;var _0x51a5fa={'method':_0x5a68dc[_0xa9f6('0xa5')],'uri':util['format'](_0xa9f6('0xad'),_0x19bea2,_0x5a68dc[_0xa9f6('0x39')][_0xa9f6('0x7')]),'json':_0x272319,'resolveWithFullResponse':!![],'encoding':_0x25080f,'body':_0x5a68dc['body']};if(_0x5a68dc['headers']){_0x51a5fa['headers']=_0x5a68dc[_0xa9f6('0xa6')];if(_0x51a5fa[_0xa9f6('0xa6')]['content-length']){delete _0x51a5fa[_0xa9f6('0xa6')][_0xa9f6('0xa7')];}}if(_0x51a5fa[_0xa9f6('0xa6')][_0xa9f6('0xae')]){delete _0x51a5fa[_0xa9f6('0xa6')]['content-type'];}return rp(_0x51a5fa);})[_0xa9f6('0x2d')](function(_0x25dee5){if(_0x25dee5){_0x205822['set'](_0x25dee5[_0xa9f6('0xa6')]);logger[_0xa9f6('0x71')](_0x25dee5['body']);return _0x205822[_0xa9f6('0x20')](_0x25dee5[_0xa9f6('0xa9')])[_0xa9f6('0x31')](_0x25dee5[_0xa9f6('0x9e')]);}else{return _0x205822[_0xa9f6('0x1f')](0xc8);}})[_0xa9f6('0x50')](handleError(_0x205822,null));}; \ No newline at end of file +var _0xcf80=['0777','readdirSync','Invalid\x20plugin\x20structure','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','icon','icon-apps','html','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','webhookGet','resolve','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','method','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','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','socket.io-emitter','./plugin.socket','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','rawAttributes','length','include','Plugin','find','download','params','server/files/plugins','format','basename','createWriteStream','zip','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','root','dirname','join','node_modules/**/*','finalize','close','existsSync','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync'];(function(_0x127518,_0x90fc85){var _0x2b03db=function(_0x42c71b){while(--_0x42c71b){_0x127518['push'](_0x127518['shift']());}};_0x2b03db(++_0x90fc85);}(_0xcf80,0x19b));var _0x0cf8=function(_0x4b4111,_0x16c500){_0x4b4111=_0x4b4111-0x0;var _0x5b5b34=_0xcf80[_0x4b4111];return _0x5b5b34;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0cf8('0x0'));var zipdir=require(_0x0cf8('0x1'));var jsonpatch=require(_0x0cf8('0x2'));var rp=require(_0x0cf8('0x3'));var moment=require(_0x0cf8('0x4'));var BPromise=require(_0x0cf8('0x5'));var Mustache=require(_0x0cf8('0x6'));var util=require(_0x0cf8('0x7'));var path=require(_0x0cf8('0x8'));var sox=require(_0x0cf8('0x9'));var csv=require(_0x0cf8('0xa'));var ejs=require(_0x0cf8('0xb'));var fs=require('fs');var fs_extra=require(_0x0cf8('0xc'));var _=require(_0x0cf8('0xd'));var squel=require(_0x0cf8('0xe'));var crypto=require(_0x0cf8('0xf'));var jsforce=require(_0x0cf8('0x10'));var deskjs=require(_0x0cf8('0x11'));var toCsv=require('to-csv');var querystring=require(_0x0cf8('0x12'));var Papa=require(_0x0cf8('0x13'));var extract=require(_0x0cf8('0x14'));var rimraf=require('rimraf');var archiver=require('archiver');var Redis=require(_0x0cf8('0x15'));var authService=require(_0x0cf8('0x16'));var qs=require(_0x0cf8('0x17'));var as=require(_0x0cf8('0x18'));var hardwareService=require(_0x0cf8('0x19'));var logger=require(_0x0cf8('0x1a'))(_0x0cf8('0x1b'));var utils=require(_0x0cf8('0x1c'));var config=require(_0x0cf8('0x1d'));var licenseUtil=require('../../config/license/util');var db=require(_0x0cf8('0x1e'))['db'];config['redis']=_[_0x0cf8('0x1f')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0cf8('0x20'))(new Redis(config['redis']));require(_0x0cf8('0x21'))['register'](socket);function respondWithStatusCode(_0x436d0f,_0x4f40ef){_0x4f40ef=_0x4f40ef||0xcc;return function(_0x2951cf){if(_0x2951cf){return _0x436d0f[_0x0cf8('0x22')](_0x4f40ef);}return _0x436d0f['status'](_0x4f40ef)['end']();};}function respondWithResult(_0x16fddb,_0x3692a8){_0x3692a8=_0x3692a8||0xc8;return function(_0x39f95d){if(_0x39f95d){return _0x16fddb[_0x0cf8('0x23')](_0x3692a8)[_0x0cf8('0x24')](_0x39f95d);}};}function respondWithFilteredResult(_0x98c6ad,_0x46186d){return function(_0x378dc4){if(_0x378dc4){var _0x59cd51=typeof _0x46186d[_0x0cf8('0x25')]===_0x0cf8('0x26')&&typeof _0x46186d[_0x0cf8('0x27')]===_0x0cf8('0x26');var _0x11a85d=_0x378dc4[_0x0cf8('0x28')];var _0x34c834=_0x59cd51?0x0:_0x46186d[_0x0cf8('0x25')];var _0x5a271d=_0x59cd51?_0x378dc4['count']:_0x46186d[_0x0cf8('0x25')]+_0x46186d[_0x0cf8('0x27')];var _0x2f713a;if(_0x5a271d>=_0x11a85d){_0x5a271d=_0x11a85d;_0x2f713a=0xc8;}else{_0x2f713a=0xce;}_0x98c6ad[_0x0cf8('0x23')](_0x2f713a);return _0x98c6ad['set']('Content-Range',_0x34c834+'-'+_0x5a271d+'/'+_0x11a85d)[_0x0cf8('0x24')](_0x378dc4);}return null;};}function patchUpdates(_0x519809){return function(_0xf922ec){try{jsonpatch[_0x0cf8('0x29')](_0xf922ec,_0x519809,!![]);}catch(_0xac1411){return BPromise[_0x0cf8('0x2a')](_0xac1411);}return _0xf922ec[_0x0cf8('0x2b')]();};}function saveUpdates(_0x3088bd,_0x1c8b5e){return function(_0x5ea097){if(_0x5ea097){return _0x5ea097['update'](_0x3088bd)[_0x0cf8('0x2c')](function(_0x3652ad){return _0x3652ad;});}return null;};}function removeEntity(_0x53e39f,_0x461f84){return function(_0xdb70d1){if(_0xdb70d1){return _0xdb70d1[_0x0cf8('0x2d')]()[_0x0cf8('0x2c')](function(){var _0xf02716=_0xdb70d1[_0x0cf8('0x2e')]({'plain':!![]});var _0x573865=_0x0cf8('0x2f');return db[_0x0cf8('0x30')]['destroy']({'where':{'type':_0x573865,'resourceId':_0xf02716['id']}})[_0x0cf8('0x2c')](function(){return _0xdb70d1;});})[_0x0cf8('0x2c')](function(){_0x53e39f[_0x0cf8('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0xec7c3f,_0x4a5dac){return function(_0x51dbd8){if(!_0x51dbd8){_0xec7c3f[_0x0cf8('0x22')](0x194);}return _0x51dbd8;};}function handleError(_0x2f6ce4,_0x1d59c8){_0x1d59c8=_0x1d59c8||0x1f4;return function(_0x6a0f20){logger[_0x0cf8('0x31')](_0x6a0f20[_0x0cf8('0x32')]);if(_0x6a0f20[_0x0cf8('0x33')]){delete _0x6a0f20[_0x0cf8('0x33')];}_0x2f6ce4[_0x0cf8('0x23')](_0x1d59c8)[_0x0cf8('0x34')](_0x6a0f20);};}exports[_0x0cf8('0x35')]=function(_0x525fd6,_0x23ec37){var _0x53110e={},_0x2b5ba9={},_0x5149d5={'count':0x0,'rows':[]};var _0x4ab3b1=_[_0x0cf8('0x36')](db['Plugin']['rawAttributes'],function(_0x5b65d6){return{'name':_0x5b65d6[_0x0cf8('0x37')],'type':_0x5b65d6[_0x0cf8('0x38')][_0x0cf8('0x39')]};});_0x2b5ba9[_0x0cf8('0x3a')]=_[_0x0cf8('0x36')](_0x4ab3b1,'name');_0x2b5ba9[_0x0cf8('0x3b')]=_['keys'](_0x525fd6[_0x0cf8('0x3b')]);_0x2b5ba9[_0x0cf8('0x3c')]=_[_0x0cf8('0x3d')](_0x2b5ba9[_0x0cf8('0x3a')],_0x2b5ba9[_0x0cf8('0x3b')]);_0x53110e['attributes']=_[_0x0cf8('0x3d')](_0x2b5ba9[_0x0cf8('0x3a')],qs['fields'](_0x525fd6[_0x0cf8('0x3b')][_0x0cf8('0x3e')]));_0x53110e['attributes']=_0x53110e[_0x0cf8('0x3f')]['length']?_0x53110e[_0x0cf8('0x3f')]:_0x2b5ba9[_0x0cf8('0x3a')];if(!_0x525fd6['query'][_0x0cf8('0x40')]('nolimit')){_0x53110e['limit']=qs[_0x0cf8('0x27')](_0x525fd6[_0x0cf8('0x3b')][_0x0cf8('0x27')]);_0x53110e[_0x0cf8('0x25')]=qs[_0x0cf8('0x25')](_0x525fd6[_0x0cf8('0x3b')][_0x0cf8('0x25')]);}_0x53110e['order']=qs[_0x0cf8('0x41')](_0x525fd6[_0x0cf8('0x3b')]['sort']);_0x53110e['where']=qs['filters'](_[_0x0cf8('0x42')](_0x525fd6[_0x0cf8('0x3b')],_0x2b5ba9[_0x0cf8('0x3c')]),_0x4ab3b1);if(_0x525fd6[_0x0cf8('0x3b')][_0x0cf8('0x43')]){_0x53110e[_0x0cf8('0x44')]=_[_0x0cf8('0x45')](_0x53110e['where'],{'$or':_['map'](_0x4ab3b1,function(_0x569c87){if(_0x569c87[_0x0cf8('0x38')]!==_0x0cf8('0x46')){var _0x259fe4={};_0x259fe4[_0x569c87['name']]={'$like':'%'+_0x525fd6[_0x0cf8('0x3b')][_0x0cf8('0x43')]+'%'};return _0x259fe4;}})});}_0x53110e=_[_0x0cf8('0x45')]({},_0x53110e,_0x525fd6[_0x0cf8('0x47')]);var _0x13e3e1={'where':_0x53110e[_0x0cf8('0x44')]};return db['Plugin'][_0x0cf8('0x28')](_0x13e3e1)[_0x0cf8('0x2c')](function(_0x5860d7){_0x5149d5['count']=_0x5860d7;if(_0x525fd6[_0x0cf8('0x3b')][_0x0cf8('0x48')]){_0x53110e['include']=[{'all':!![]}];}return db['Plugin'][_0x0cf8('0x49')](_0x53110e);})[_0x0cf8('0x2c')](function(_0x5c4168){_0x5149d5[_0x0cf8('0x4a')]=_0x5c4168;return _0x5149d5;})[_0x0cf8('0x2c')](respondWithFilteredResult(_0x23ec37,_0x53110e))[_0x0cf8('0x4b')](handleError(_0x23ec37,null));};exports['show']=function(_0x521504,_0x5e000f){var _0x2cc6c5={'raw':!![],'where':{'id':_0x521504['params']['id']}},_0x414ba5={};_0x414ba5['model']=_['keys'](db['Plugin'][_0x0cf8('0x4c')]);_0x414ba5[_0x0cf8('0x3b')]=_['keys'](_0x521504[_0x0cf8('0x3b')]);_0x414ba5[_0x0cf8('0x3c')]=_[_0x0cf8('0x3d')](_0x414ba5[_0x0cf8('0x3a')],_0x414ba5['query']);_0x2cc6c5['attributes']=_[_0x0cf8('0x3d')](_0x414ba5[_0x0cf8('0x3a')],qs[_0x0cf8('0x3e')](_0x521504[_0x0cf8('0x3b')]['fields']));_0x2cc6c5['attributes']=_0x2cc6c5['attributes'][_0x0cf8('0x4d')]?_0x2cc6c5[_0x0cf8('0x3f')]:_0x414ba5[_0x0cf8('0x3a')];if(_0x521504[_0x0cf8('0x3b')][_0x0cf8('0x48')]){_0x2cc6c5[_0x0cf8('0x4e')]=[{'all':!![]}];}_0x2cc6c5=_['merge']({},_0x2cc6c5,_0x521504[_0x0cf8('0x47')]);return db[_0x0cf8('0x4f')][_0x0cf8('0x50')](_0x2cc6c5)[_0x0cf8('0x2c')](handleEntityNotFound(_0x5e000f,null))[_0x0cf8('0x2c')](respondWithResult(_0x5e000f,null))[_0x0cf8('0x4b')](handleError(_0x5e000f,null));};exports[_0x0cf8('0x51')]=function(_0x149a70,_0x55fe72,_0x5dddcd){return db['Plugin']['find']({'where':{'id':_0x149a70[_0x0cf8('0x52')]['id']},'attributes':['name',_0x0cf8('0x8')],'raw':!![]})[_0x0cf8('0x2c')](handleEntityNotFound(_0x55fe72,null))[_0x0cf8('0x2c')](function(_0x4621c3){if(_0x4621c3){var _0x214ee4=path['join'](config['root'],_0x0cf8('0x53'),util[_0x0cf8('0x54')]('%s.zip',path[_0x0cf8('0x55')](_0x4621c3[_0x0cf8('0x8')])));var _0x361337=fs[_0x0cf8('0x56')](_0x214ee4);var _0x2d9ed2=archiver(_0x0cf8('0x57'),{'zlib':{'level':0x9}});_0x2d9ed2['on']('warning',function(_0x4b9085){if(_0x4b9085['code']===_0x0cf8('0x58')){logger[_0x0cf8('0x31')](_0x4b9085);}else{throw new db[(_0x0cf8('0x59'))][(_0x0cf8('0x5a'))](_0x0cf8('0x5b'));}});_0x2d9ed2['on'](_0x0cf8('0x31'),function(_0x3ae1d4){throw new db[(_0x0cf8('0x59'))][(_0x0cf8('0x5a'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x2d9ed2['pipe'](_0x361337);_0x2d9ed2[_0x0cf8('0x5c')](_0x0cf8('0x5d'),{'cwd':path['join'](config[_0x0cf8('0x5e')],_0x0cf8('0x53'),path[_0x0cf8('0x5f')](_0x4621c3[_0x0cf8('0x8')])),'ignore':[path[_0x0cf8('0x60')](path['basename'](_0x4621c3[_0x0cf8('0x8')]),_0x0cf8('0x61')),path[_0x0cf8('0x60')](path[_0x0cf8('0x55')](_0x4621c3['path']),'attachments/**/*')],'nodir':!![]})[_0x0cf8('0x62')]();_0x361337['on'](_0x0cf8('0x63'),function(){if(!fs[_0x0cf8('0x64')](_0x214ee4)){throw new db[(_0x0cf8('0x59'))][(_0x0cf8('0x5a'))]('Plugin\x20not\x20found');}return _0x55fe72['download'](_0x214ee4,util[_0x0cf8('0x54')](_0x0cf8('0x65'),path[_0x0cf8('0x55')](_0x4621c3[_0x0cf8('0x8')])),function(_0x21c250){if(_0x21c250){throw new db[(_0x0cf8('0x59'))][(_0x0cf8('0x5a'))](_0x0cf8('0x66'));}fs[_0x0cf8('0x67')](_0x214ee4);logger[_0x0cf8('0x68')](_0x0cf8('0x69'));logger[_0x0cf8('0x68')](_0x0cf8('0x6a'));});});}return null;})['catch'](handleError(_0x55fe72,null));};exports[_0x0cf8('0x6b')]=function(_0x30ef02,_0x13d786,_0x10138c){var _0x388e64=path[_0x0cf8('0x55')](_0x30ef02[_0x0cf8('0x6c')]['filename'],path[_0x0cf8('0x6d')](_0x30ef02[_0x0cf8('0x6c')][_0x0cf8('0x6e')]));var _0xa6381d=path[_0x0cf8('0x60')](config[_0x0cf8('0x5e')],_0x0cf8('0x53'),_0x30ef02[_0x0cf8('0x6c')][_0x0cf8('0x6e')]);var _0x3998ca=path[_0x0cf8('0x60')](config[_0x0cf8('0x5e')],_0x0cf8('0x53'),_0x388e64);logger[_0x0cf8('0x68')](_0x0cf8('0x6f'),_0xa6381d);logger[_0x0cf8('0x68')](_0x0cf8('0x70'),_0x3998ca);try{fs[_0x0cf8('0x71')](_0xa6381d,parseInt(_0x0cf8('0x72'),0x8));extract(_0xa6381d,{'dir':_0x3998ca},function(_0x45384a){if(_0x45384a){logger[_0x0cf8('0x31')](_0x45384a);handleError(_0x45384a,!![]);};var _0x564acb=fs[_0x0cf8('0x73')](_0x3998ca);if(_0x564acb[_0x0cf8('0x4d')]>0x1){removeReferences(_0xa6381d,_0x3998ca);logger['error']('Invalid\x20plugin\x20structure');return _0x10138c(new Error(_0x0cf8('0x74')));}var _0x5d9822=fs['lstatSync'](path['join'](_0x3998ca,_0x564acb[0x0]));if(_0x5d9822['isFile']()){removeReferences(_0xa6381d,_0x3998ca);logger[_0x0cf8('0x31')]('Invalid\x20plugin\x20structure');return _0x10138c(new Error('Invalid\x20plugin\x20structure'));}if(_0x5d9822[_0x0cf8('0x75')]()){var _0xc7e289=fs[_0x0cf8('0x73')](path[_0x0cf8('0x60')](_0x3998ca,_0x564acb[0x0]));if(_0xc7e289[_0x0cf8('0x4d')]===0x0){removeReferences(_0xa6381d,_0x3998ca);logger[_0x0cf8('0x31')]('Invalid\x20plugin\x20structure');return _0x10138c(new Error(_0x0cf8('0x74')));}var _0x32fbe4=_0xc7e289[_0x0cf8('0x76')](function(_0x2893e4){return _0x2893e4==='manifest.json';});if(!_0x32fbe4){return _0x10138c(new Error(_0x0cf8('0x77')));}var _0x414d29=fs[_0x0cf8('0x78')](path[_0x0cf8('0x60')](_0x3998ca,_0x564acb[0x0],_0x0cf8('0x79')));var _0x5a0f86=JSON[_0x0cf8('0x7a')](_0x414d29);if(_0x0cf8('0x26')==typeof _0x5a0f86[_0x0cf8('0x33')]){return _0x10138c(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x5a0f86[_0x0cf8('0x38')]){return _0x10138c(new Error(_0x0cf8('0x7b')));}if(_0x0cf8('0x26')==typeof _0x5a0f86[_0x0cf8('0x7c')]){return _0x10138c(new Error(_0x0cf8('0x7d')));}if('undefined'==typeof _0x5a0f86[_0x0cf8('0x7e')]){return _0x10138c(new Error(_0x0cf8('0x7f')));}if(_0x5a0f86[_0x0cf8('0x38')]==='html'){if(_0x0cf8('0x26')==typeof _0x5a0f86['parameters'][_0x0cf8('0x80')]){return _0x10138c(new Error(_0x0cf8('0x81')));}if(_0x0cf8('0x26')==typeof _0x5a0f86['parameters']['views']['admin']&&_0x0cf8('0x26')==typeof _0x5a0f86[_0x0cf8('0x7e')][_0x0cf8('0x80')][_0x0cf8('0x82')]){return _0x10138c(new Error(_0x0cf8('0x83')));}}else if(_0x5a0f86['type']===_0x0cf8('0x84')){if(_0x0cf8('0x26')==typeof _0x5a0f86[_0x0cf8('0x7e')][_0x0cf8('0x85')]){return _0x10138c(new Error(_0x0cf8('0x86')));}if(_0x0cf8('0x26')==typeof _0x5a0f86[_0x0cf8('0x7e')][_0x0cf8('0x87')]){return _0x10138c(new Error(_0x0cf8('0x88')));}}else{return _0x10138c(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x1b464e=_0x5a0f86[_0x0cf8('0x33')];var _0x256df9=_0x5a0f86[_0x0cf8('0x89')];var _0x159358=_0x5a0f86[_0x0cf8('0x38')];var _0x3a6b92=_0x5a0f86[_0x0cf8('0x8a')]?_0x5a0f86[_0x0cf8('0x8a')]:'always';var _0x445e68=_0x5a0f86['icon']?_0x5a0f86[_0x0cf8('0x8b')]:_0x0cf8('0x8c');var _0x2095c9='';var _0x4814d0='';var _0x3ec7b9='';var _0x2085e2='';var _0x5770d9=_0x5a0f86[_0x0cf8('0x7c')];if(_0x159358===_0x0cf8('0x8d')){if(_0x0cf8('0x26')!=typeof _0x5a0f86[_0x0cf8('0x7e')][_0x0cf8('0x80')][_0x0cf8('0x8e')]){var _0x4eb10d=_0x5a0f86[_0x0cf8('0x7e')][_0x0cf8('0x80')][_0x0cf8('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0x0cf8('0x8f')](_0x4eb10d)){_0x2095c9=path[_0x0cf8('0x60')](_0x0cf8('0x90'),_0x388e64,_0x564acb[0x0],_0x4eb10d);}else{_0x2095c9=_0x4eb10d;}}else{logger['info'](_0x0cf8('0x91'));}if(_0x0cf8('0x26')!=typeof _0x5a0f86['parameters'][_0x0cf8('0x80')]['agent']){var _0x36f0d2=_0x5a0f86[_0x0cf8('0x7e')][_0x0cf8('0x80')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x36f0d2)){_0x4814d0=path['join'](_0x0cf8('0x90'),_0x388e64,_0x564acb[0x0],_0x36f0d2);}else{_0x4814d0=_0x36f0d2;}}else{logger[_0x0cf8('0x68')](_0x0cf8('0x92'));}}else if(_0x159358===_0x0cf8('0x84')){_0x3ec7b9=_0x5a0f86[_0x0cf8('0x7e')][_0x0cf8('0x85')];_0x2085e2=_0x5a0f86[_0x0cf8('0x7e')][_0x0cf8('0x87')];if(_0x0cf8('0x26')!=typeof _0x5a0f86['parameters']['views']){if('undefined'!=typeof _0x5a0f86[_0x0cf8('0x7e')]['views']['admin']){var _0x4eb10d=_0x5a0f86[_0x0cf8('0x7e')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x0cf8('0x8f')](_0x4eb10d)){_0x2095c9=path[_0x0cf8('0x60')](_0x0cf8('0x90'),_0x388e64,_0x564acb[0x0],_0x4eb10d);}else{_0x2095c9=_0x4eb10d;}}if(_0x0cf8('0x26')!=typeof _0x5a0f86['parameters'][_0x0cf8('0x80')][_0x0cf8('0x82')]){var _0x36f0d2=_0x5a0f86['parameters']['views']['agent'];if(!/^(f|ht)tps?:\/\//i[_0x0cf8('0x8f')](_0x36f0d2)){_0x4814d0=path[_0x0cf8('0x60')]('plugins',_0x388e64,_0x564acb[0x0],_0x36f0d2);}else{_0x4814d0=_0x36f0d2;}}}}var _0x9d8e38={'name':_0x1b464e,'description':_0x256df9,'path':path[_0x0cf8('0x60')](_0x388e64,_0x564acb[0x0]),'type':_0x159358,'sidebar':_0x3a6b92,'icon':_0x445e68,'adminUrl':_0x2095c9,'agentUrl':_0x4814d0,'scriptName':_0x3ec7b9,'scriptPath':_0x2085e2,'version':_0x5770d9};removeReferences(_0xa6381d,null);return db[_0x0cf8('0x4f')][_0x0cf8('0x93')](_0x9d8e38)[_0x0cf8('0x2c')](function(_0x2fd8a8){var _0x227a65={'role':_0x30ef02[_0x0cf8('0x94')][_0x0cf8('0x95')],'userProfileId':_0x30ef02['body']['userProfileId']};if(!_0x227a65)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x227a65[_0x0cf8('0x95')]===_0x0cf8('0x96')){var _0xbb9ce9=_0x2fd8a8[_0x0cf8('0x2e')]({'plain':!![]});return db[_0x0cf8('0x97')][_0x0cf8('0x50')]({'where':{'name':_0x0cf8('0x2f'),'userProfileId':_0x227a65[_0x0cf8('0x98')]},'raw':!![]})[_0x0cf8('0x2c')](function(_0x3d11a7){if(_0x3d11a7&&_0x3d11a7[_0x0cf8('0x99')]===0x0){return db[_0x0cf8('0x30')]['create']({'name':_0xbb9ce9[_0x0cf8('0x33')],'resourceId':_0xbb9ce9['id'],'type':_0x3d11a7[_0x0cf8('0x33')],'sectionId':_0x3d11a7['id']},{})[_0x0cf8('0x2c')](function(){return _0x2fd8a8;});}else{return _0x2fd8a8;}})[_0x0cf8('0x4b')](function(_0x8e32d0){logger[_0x0cf8('0x31')](_0x0cf8('0x9a'),_0x8e32d0);throw _0x8e32d0;});}return _0x2fd8a8;})[_0x0cf8('0x2c')](respondWithResult(_0x13d786,null))[_0x0cf8('0x4b')](handleError(_0x13d786,null));}});}catch(_0x49bcdc){_0x13d786[_0x0cf8('0x23')](0x1f4)[_0x0cf8('0x34')](_0x49bcdc);}};function removeReferences(_0x409ae4,_0x382ad8){try{if(_0x409ae4){fs['unlinkSync'](_0x409ae4);logger['info'](_0x0cf8('0x9b'));}if(_0x382ad8){rimraf(_0x382ad8,function(){});logger[_0x0cf8('0x68')](_0x0cf8('0x9c'));}}catch(_0x5d4f8d){logger['error'](_0x5d4f8d);}}exports[_0x0cf8('0x9d')]=function(_0x19275e,_0x1a89bf,_0x1e71fa){return db[_0x0cf8('0x4f')][_0x0cf8('0x50')]({'where':{'id':_0x19275e['params']['id']}})[_0x0cf8('0x2c')](handleEntityNotFound(_0x1a89bf,null))[_0x0cf8('0x2c')](saveUpdates(_0x19275e['body'],null))[_0x0cf8('0x2c')](respondWithResult(_0x1a89bf,null))[_0x0cf8('0x4b')](handleError(_0x1a89bf,null));};exports[_0x0cf8('0x9e')]=function(_0x2bd250,_0x911d9c,_0x796958){return db[_0x0cf8('0x4f')]['find']({'where':{'id':_0x2bd250[_0x0cf8('0x52')]['id']}})['then'](function(_0x4b5fbe){if(_0x4b5fbe){return _0x4b5fbe[_0x0cf8('0x2d')]();}})[_0x0cf8('0x2c')](function(_0x2a0c27){rimraf(path['join'](config['root'],_0x0cf8('0x53'),path[_0x0cf8('0x5f')](_0x2a0c27[_0x0cf8('0x8')])),function(){});return _0x2a0c27;})[_0x0cf8('0x2c')](handleEntityNotFound(_0x911d9c,null))[_0x0cf8('0x2c')](respondWithStatusCode(_0x911d9c,null))['catch'](handleError(_0x911d9c,null));};exports[_0x0cf8('0x9f')]=function(_0x58cf94,_0x3bc75f,_0x11f553){return BPromise[_0x0cf8('0xa0')]()[_0x0cf8('0x2c')](function(){if(!_0x58cf94[_0x0cf8('0x3b')][_0x0cf8('0x8')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x58cf94['query']['port']){throw new Error(_0x0cf8('0xa1'));}var _0x28ac9a=_0x58cf94[_0x0cf8('0x3b')]['hostname']?_0x58cf94[_0x0cf8('0x3b')][_0x0cf8('0xa2')]+':'+_0x58cf94['query'][_0x0cf8('0xa3')]:_0x0cf8('0xa4')+_0x58cf94[_0x0cf8('0x3b')][_0x0cf8('0xa3')];var _0x3f7369=_0x58cf94[_0x0cf8('0x3b')][_0x0cf8('0x24')]?_0x58cf94[_0x0cf8('0x3b')]['json']:!![];var _0x85b2b4=_0x58cf94[_0x0cf8('0x3b')][_0x0cf8('0xa5')]?_0x58cf94[_0x0cf8('0x3b')][_0x0cf8('0xa5')]:null;var _0x388b2b={'method':_0x58cf94['method'],'uri':util[_0x0cf8('0x54')]('%s%s',_0x28ac9a,_0x58cf94[_0x0cf8('0x3b')]['path']),'json':_0x3f7369,'resolveWithFullResponse':!![],'encoding':_0x85b2b4,'qs':_0x58cf94['query']};if(_0x58cf94['headers']){_0x388b2b[_0x0cf8('0xa6')]=_0x58cf94[_0x0cf8('0xa6')];if(_0x388b2b[_0x0cf8('0xa6')][_0x0cf8('0xa7')]){delete _0x388b2b[_0x0cf8('0xa6')]['content-length'];}}if(_0x388b2b[_0x0cf8('0xa6')]['content-type']){delete _0x388b2b[_0x0cf8('0xa6')][_0x0cf8('0xa8')];}return rp(_0x388b2b);})[_0x0cf8('0x2c')](function(_0x185968){if(_0x185968){_0x3bc75f[_0x0cf8('0xa9')](_0x185968[_0x0cf8('0xa6')]);logger[_0x0cf8('0x68')](_0x185968['body']);if(_[_0x0cf8('0xaa')](_0x58cf94[_0x0cf8('0x3b')]['path'],'download')&&_0x185968[_0x0cf8('0xab')]==0x1f4){return _0x3bc75f[_0x0cf8('0x22')](_0x185968[_0x0cf8('0xab')]);}else{return _0x3bc75f['status'](_0x185968[_0x0cf8('0xab')])[_0x0cf8('0x34')](_0x185968[_0x0cf8('0x94')]);}}else{return _0x3bc75f[_0x0cf8('0x22')](0xc8);}})['catch'](handleError(_0x3bc75f,null));};exports[_0x0cf8('0xac')]=function(_0x3f483c,_0x4e294c,_0x2796ce){return BPromise['resolve']()['then'](function(){if(!_0x3f483c[_0x0cf8('0x3b')][_0x0cf8('0x8')]){throw new Error(_0x0cf8('0xad'));}if(!_0x3f483c['query']['port']){throw new Error(_0x0cf8('0xa1'));}var _0x137f9f=_0x3f483c[_0x0cf8('0x3b')]['hostname']?_0x3f483c[_0x0cf8('0x3b')][_0x0cf8('0xa2')]+':'+_0x3f483c[_0x0cf8('0x3b')][_0x0cf8('0xa3')]:_0x0cf8('0xa4')+_0x3f483c[_0x0cf8('0x3b')][_0x0cf8('0xa3')];var _0x13b051=_0x3f483c[_0x0cf8('0x3b')]['json']?_0x3f483c[_0x0cf8('0x3b')][_0x0cf8('0x24')]:!![];var _0x254221=_0x3f483c[_0x0cf8('0x3b')][_0x0cf8('0xa5')]?_0x3f483c[_0x0cf8('0x3b')]['encoding']:null;var _0x1c5e6d={'method':_0x3f483c[_0x0cf8('0xae')],'uri':util[_0x0cf8('0x54')]('%s%s',_0x137f9f,_0x3f483c[_0x0cf8('0x3b')]['path']),'json':_0x13b051,'resolveWithFullResponse':!![],'encoding':_0x254221,'body':_0x3f483c[_0x0cf8('0x94')]};if(_0x3f483c[_0x0cf8('0xa6')]){_0x1c5e6d[_0x0cf8('0xa6')]=_0x3f483c[_0x0cf8('0xa6')];if(_0x1c5e6d[_0x0cf8('0xa6')][_0x0cf8('0xa7')]){delete _0x1c5e6d[_0x0cf8('0xa6')]['content-length'];}}if(_0x1c5e6d[_0x0cf8('0xa6')][_0x0cf8('0xa8')]){delete _0x1c5e6d[_0x0cf8('0xa6')]['content-type'];}return rp(_0x1c5e6d);})[_0x0cf8('0x2c')](function(_0x5bb0bf){if(_0x5bb0bf){_0x4e294c[_0x0cf8('0xa9')](_0x5bb0bf[_0x0cf8('0xa6')]);logger[_0x0cf8('0x68')](_0x5bb0bf[_0x0cf8('0x94')]);return _0x4e294c[_0x0cf8('0x23')](_0x5bb0bf['statusCode'])[_0x0cf8('0x34')](_0x5bb0bf[_0x0cf8('0x94')]);}else{return _0x4e294c['sendStatus'](0xc8);}})['catch'](handleError(_0x4e294c,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 152bdfc..ada9731 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 _0xb7b6=['../../mysqldb','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x3648e8,_0x3f2875){var _0x5aa7c4=function(_0x1213a8){while(--_0x1213a8){_0x3648e8['push'](_0x3648e8['shift']());}};_0x5aa7c4(++_0x3f2875);}(_0xb7b6,0x15f));var _0x6b7b=function(_0x37d4f1,_0x31f923){_0x37d4f1=_0x37d4f1-0x0;var _0x51991f=_0xb7b6[_0x37d4f1];return _0x51991f;};'use strict';var EventEmitter=require(_0x6b7b('0x0'));var Plugin=require(_0x6b7b('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6b7b('0x2'),'afterUpdate':_0x6b7b('0x3'),'afterDestroy':'remove'};function emitEvent(_0xe3c323){return function(_0x2f4878,_0x50a8d6,_0x56e6df){PluginEvents[_0x6b7b('0x4')](_0xe3c323+':'+_0x2f4878['id'],_0x2f4878);PluginEvents[_0x6b7b('0x4')](_0xe3c323,_0x2f4878);_0x56e6df(null);};}for(var e in events){if(events[_0x6b7b('0x5')](e)){var event=events[e];Plugin[_0x6b7b('0x6')](e,emitEvent(event));}}module[_0x6b7b('0x7')]=PluginEvents; \ No newline at end of file +var _0xeecc=['events','../../mysqldb','Plugin','setMaxListeners','update','emit','hook'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0xeecc,0x12d));var _0xceec=function(_0x4c5613,_0x2a18f2){_0x4c5613=_0x4c5613-0x0;var _0x2689da=_0xeecc[_0x4c5613];return _0x2689da;};'use strict';var EventEmitter=require(_0xceec('0x0'));var Plugin=require(_0xceec('0x1'))['db'][_0xceec('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xceec('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xceec('0x4'),'afterDestroy':'remove'};function emitEvent(_0x59c654){return function(_0x588f01,_0x15c89e,_0x17346b){PluginEvents[_0xceec('0x5')](_0x59c654+':'+_0x588f01['id'],_0x588f01);PluginEvents[_0xceec('0x5')](_0x59c654,_0x588f01);_0x17346b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0xceec('0x6')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 3fd8870..d8a6020 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 _0xa889=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','plugins'];(function(_0x3bb45b,_0x2dcc0b){var _0x513162=function(_0x46f44b){while(--_0x46f44b){_0x3bb45b['push'](_0x3bb45b['shift']());}};_0x513162(++_0x2dcc0b);}(_0xa889,0x108));var _0x9a88=function(_0x23bfa3,_0x2aee11){_0x23bfa3=_0x23bfa3-0x0;var _0xc03c1f=_0xa889[_0x23bfa3];return _0xc03c1f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9a88('0x0'))(_0x9a88('0x1'));var moment=require(_0x9a88('0x2'));var BPromise=require(_0x9a88('0x3'));var rp=require(_0x9a88('0x4'));var fs=require('fs');var path=require(_0x9a88('0x5'));var rimraf=require(_0x9a88('0x6'));var config=require(_0x9a88('0x7'));var attributes=require(_0x9a88('0x8'));module[_0x9a88('0x9')]=function(_0x4f535e,_0x1b8d3c){return _0x4f535e[_0x9a88('0xa')]('Plugin',attributes,{'tableName':_0x9a88('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee5e=['../../config/logger','moment','rimraf','exports','define','Plugin','plugins'];(function(_0xfeecfe,_0x38239d){var _0x21e1d9=function(_0xe39d57){while(--_0xe39d57){_0xfeecfe['push'](_0xfeecfe['shift']());}};_0x21e1d9(++_0x38239d);}(_0xee5e,0x181));var _0xeee5=function(_0x2b60b1,_0x5581c0){_0x2b60b1=_0x2b60b1-0x0;var _0x4b1bcd=_0xee5e[_0x2b60b1];return _0x4b1bcd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeee5('0x0'))('api');var moment=require(_0xeee5('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xeee5('0x2'));var config=require('../../config/environment');var attributes=require('./plugin.attributes');module[_0xeee5('0x3')]=function(_0x2efe34,_0x333e59){return _0x2efe34[_0xeee5('0x4')](_0xeee5('0x5'),attributes,{'tableName':_0xeee5('0x6'),'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 c25b37f..93102d2 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 _0xe073=['http','redis','defaults','socket.io-emitter','register','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','options','then','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x391b18,_0x556472){var _0x1c21c3=function(_0x4af880){while(--_0x4af880){_0x391b18['push'](_0x391b18['shift']());}};_0x1c21c3(++_0x556472);}(_0xe073,0x1b6));var _0x3e07=function(_0x373202,_0x1a1fd4){_0x373202=_0x373202-0x0;var _0x5e90ab=_0xe073[_0x373202];return _0x5e90ab;};'use strict';var _=require(_0x3e07('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3e07('0x1'));var rs=require(_0x3e07('0x2'));var fs=require('fs');var Redis=require(_0x3e07('0x3'));var db=require(_0x3e07('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e07('0x5'))(_0x3e07('0x6'));var config=require(_0x3e07('0x7'));var jayson=require(_0x3e07('0x8'));var client=jayson[_0x3e07('0x9')][_0x3e07('0xa')]({'port':0x232a});config[_0x3e07('0xb')]=_[_0x3e07('0xc')](config[_0x3e07('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3e07('0xd'))(new Redis(config[_0x3e07('0xb')]));require('./plugin.socket')[_0x3e07('0xe')](socket);function respondWithRpcPromise(_0x225827,_0x4b0c44,_0x23dc74){return new BPromise(function(_0x115274,_0x5ea01b){return client[_0x3e07('0xf')](_0x225827,_0x23dc74)['then'](function(_0x22545){logger[_0x3e07('0x10')](_0x3e07('0x11'),_0x4b0c44,_0x3e07('0x12'));logger[_0x3e07('0x13')](_0x3e07('0x14'),_0x4b0c44,_0x3e07('0x12'),JSON[_0x3e07('0x15')](_0x22545));if(_0x22545[_0x3e07('0x16')]){if(_0x22545[_0x3e07('0x16')][_0x3e07('0x17')]===0x1f4){logger[_0x3e07('0x16')](_0x3e07('0x11'),_0x4b0c44,_0x22545[_0x3e07('0x16')][_0x3e07('0x18')]);return _0x5ea01b(_0x22545['error']['message']);}logger[_0x3e07('0x16')](_0x3e07('0x11'),_0x4b0c44,_0x22545[_0x3e07('0x16')][_0x3e07('0x18')]);return _0x115274(_0x22545['error']['message']);}else{logger['info'](_0x3e07('0x11'),_0x4b0c44,_0x3e07('0x12'));_0x115274(_0x22545[_0x3e07('0x19')][_0x3e07('0x18')]);}})[_0x3e07('0x1a')](function(_0x440d18){logger[_0x3e07('0x16')](_0x3e07('0x11'),_0x4b0c44,_0x440d18);_0x5ea01b(_0x440d18);});});}exports[_0x3e07('0x1b')]=function(_0x40cb06){var _0x6efdfb=this;return new Promise(function(_0x5870c3,_0x50e858){return db[_0x3e07('0x1c')][_0x3e07('0x1d')](_0x40cb06['body'],{'raw':_0x40cb06['options']?_0x40cb06[_0x3e07('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x3e07('0x1f')](function(_0x107a63){logger['info'](_0x3e07('0x1b'),_0x40cb06);logger[_0x3e07('0x13')](_0x3e07('0x1b'),_0x40cb06,JSON['stringify'](_0x107a63));_0x5870c3(_0x107a63);})[_0x3e07('0x1a')](function(_0x3f7e1b){logger[_0x3e07('0x16')](_0x3e07('0x1b'),_0x3f7e1b[_0x3e07('0x18')],_0x40cb06);_0x50e858(_0x6efdfb['error'](0x1f4,_0x3f7e1b[_0x3e07('0x18')]));});});}; \ No newline at end of file +var _0x0082=['Plugin,\x20%s,\x20%s','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','defaults','redis','register','then','info','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x49226a,_0x33b04d){var _0x3eaa79=function(_0x1d83cb){while(--_0x1d83cb){_0x49226a['push'](_0x49226a['shift']());}};_0x3eaa79(++_0x33b04d);}(_0x0082,0x1bd));var _0x2008=function(_0x5e2cb4,_0x592c64){_0x5e2cb4=_0x5e2cb4-0x0;var _0x282902=_0x0082[_0x5e2cb4];return _0x282902;};'use strict';var _=require(_0x2008('0x0'));var util=require(_0x2008('0x1'));var moment=require(_0x2008('0x2'));var BPromise=require(_0x2008('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2008('0x4'));var db=require(_0x2008('0x5'))['db'];var utils=require(_0x2008('0x6'));var logger=require(_0x2008('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2008('0x8')][_0x2008('0x9')]({'port':0x232a});config['redis']=_[_0x2008('0xa')](config[_0x2008('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2008('0xb')]));require('./plugin.socket')[_0x2008('0xc')](socket);function respondWithRpcPromise(_0x5386ba,_0x3fc79d,_0x5aee31){return new BPromise(function(_0x22b017,_0x17748f){return client['request'](_0x5386ba,_0x5aee31)[_0x2008('0xd')](function(_0x3598d3){logger[_0x2008('0xe')]('Plugin,\x20%s,\x20%s',_0x3fc79d,_0x2008('0xf'));logger['debug'](_0x2008('0x10'),_0x3fc79d,_0x2008('0xf'),JSON[_0x2008('0x11')](_0x3598d3));if(_0x3598d3[_0x2008('0x12')]){if(_0x3598d3['error'][_0x2008('0x13')]===0x1f4){logger[_0x2008('0x12')](_0x2008('0x14'),_0x3fc79d,_0x3598d3['error'][_0x2008('0x15')]);return _0x17748f(_0x3598d3[_0x2008('0x12')][_0x2008('0x15')]);}logger[_0x2008('0x12')](_0x2008('0x14'),_0x3fc79d,_0x3598d3[_0x2008('0x12')][_0x2008('0x15')]);return _0x22b017(_0x3598d3[_0x2008('0x12')][_0x2008('0x15')]);}else{logger[_0x2008('0xe')](_0x2008('0x14'),_0x3fc79d,'request\x20sent');_0x22b017(_0x3598d3[_0x2008('0x16')]['message']);}})[_0x2008('0x17')](function(_0x258e26){logger[_0x2008('0x12')](_0x2008('0x14'),_0x3fc79d,_0x258e26);_0x17748f(_0x258e26);});});}exports[_0x2008('0x18')]=function(_0xf23d9c){var _0x131d64=this;return new Promise(function(_0x6bfe72,_0x823303){return db[_0x2008('0x19')][_0x2008('0x1a')](_0xf23d9c[_0x2008('0x1b')],{'raw':_0xf23d9c[_0x2008('0x1c')]?_0xf23d9c[_0x2008('0x1c')][_0x2008('0x1d')]===undefined?!![]:![]:!![]})[_0x2008('0xd')](function(_0x551cff){logger[_0x2008('0xe')](_0x2008('0x18'),_0xf23d9c);logger[_0x2008('0x1e')](_0x2008('0x18'),_0xf23d9c,JSON[_0x2008('0x11')](_0x551cff));_0x6bfe72(_0x551cff);})['catch'](function(_0x52c145){logger[_0x2008('0x12')](_0x2008('0x18'),_0x52c145[_0x2008('0x15')],_0xf23d9c);_0x823303(_0x131d64[_0x2008('0x12')](0x1f4,_0x52c145[_0x2008('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 01949cb..08ee163 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 _0xff43=['save','remove','update','removeListener','length','plugin:','./plugin.events'];(function(_0x366482,_0x16989e){var _0x188cf5=function(_0x3ee862){while(--_0x3ee862){_0x366482['push'](_0x366482['shift']());}};_0x188cf5(++_0x16989e);}(_0xff43,0x133));var _0x3ff4=function(_0x3d42ca,_0x5a503c){_0x3d42ca=_0x3d42ca-0x0;var _0x525198=_0xff43[_0x3d42ca];return _0x525198;};'use strict';var PluginEvents=require(_0x3ff4('0x0'));var events=[_0x3ff4('0x1'),_0x3ff4('0x2'),_0x3ff4('0x3')];function createListener(_0x1f6592,_0x15daa8){return function(_0x470616){_0x15daa8['emit'](_0x1f6592,_0x470616);};}function removeListener(_0x4a791f,_0x2e49a0){return function(){PluginEvents[_0x3ff4('0x4')](_0x4a791f,_0x2e49a0);};}exports['register']=function(_0x4c1056){for(var _0x3513a1=0x0,_0x1e7633=events[_0x3ff4('0x5')];_0x3513a1<_0x1e7633;_0x3513a1++){var _0x532372=events[_0x3513a1];var _0x4da628=createListener(_0x3ff4('0x6')+_0x532372,_0x4c1056);PluginEvents['on'](_0x532372,_0x4da628);}}; \ No newline at end of file +var _0x715e=['removeListener','register','length','plugin:','./plugin.events','save','remove','update','emit'];(function(_0x3020b9,_0x29ebc0){var _0x5de536=function(_0x3de85e){while(--_0x3de85e){_0x3020b9['push'](_0x3020b9['shift']());}};_0x5de536(++_0x29ebc0);}(_0x715e,0xdc));var _0xe715=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x715e[_0x56fe98];return _0x212f4f;};'use strict';var PluginEvents=require(_0xe715('0x0'));var events=[_0xe715('0x1'),_0xe715('0x2'),_0xe715('0x3')];function createListener(_0x5221f4,_0x54d6cf){return function(_0x3b2acb){_0x54d6cf[_0xe715('0x4')](_0x5221f4,_0x3b2acb);};}function removeListener(_0x4f03ff,_0x36701e){return function(){PluginEvents[_0xe715('0x5')](_0x4f03ff,_0x36701e);};}exports[_0xe715('0x6')]=function(_0x5b9f72){for(var _0x47b53e=0x0,_0x1c90f1=events[_0xe715('0x7')];_0x47b53e<_0x1c90f1;_0x47b53e++){var _0x1c98ad=events[_0x47b53e];var _0x148709=createListener(_0xe715('0x8')+_0x1c98ad,_0x5b9f72);PluginEvents['on'](_0x1c98ad,_0x148709);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index e201caf..6902d0f 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(_0x229e90,_0x3b05ef){var _0x3b405f=function(_0x498a41){while(--_0x498a41){_0x229e90['push'](_0x229e90['shift']());}};_0x3b405f(++_0x3b05ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x5552e8,_0x3c1766){var _0x44de42=function(_0x3a23d1){while(--_0x3a23d1){_0x5552e8['push'](_0x5552e8['shift']());}};_0x44de42(++_0x3c1766);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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 7637848..02abade 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 _0x7af2=['sendStatus','json','error','stack','name','status','info','index','list','then','reject','express','motion2','length','catch','show','describe','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','params','send','destroy','Unknown\x20id','../../config/pm2','../../config/logger','api','path','exec','bluebird'];(function(_0x56fafe,_0x1e0b2d){var _0x236389=function(_0x2c5066){while(--_0x2c5066){_0x56fafe['push'](_0x56fafe['shift']());}};_0x236389(++_0x1e0b2d);}(_0x7af2,0x119));var _0x27af=function(_0x448eed,_0x359d8d){_0x448eed=_0x448eed-0x0;var _0x29dc02=_0x7af2[_0x448eed];return _0x29dc02;};'use strict';var _=require('lodash');var pm2=require(_0x27af('0x0'));var logger=require(_0x27af('0x1'))(_0x27af('0x2'));var path=require(_0x27af('0x3'));var exec=require('child_process')[_0x27af('0x4')];var BPromise=require(_0x27af('0x5'));function handleEntityNotFound(_0x709cb6,_0x2a542f){return function(_0x22ae46){if(!_0x22ae46){_0x709cb6[_0x27af('0x6')](0x194);;}return _0x22ae46;};}function respondWithResult(_0x350532,_0x184630){_0x184630=_0x184630||0xc8;return function(_0x2193c6){if(_0x2193c6){return _0x350532['status'](_0x184630)[_0x27af('0x7')](_0x2193c6);}return null;};}function handleError(_0x366868,_0x389e97){_0x389e97=_0x389e97||0x1f4;return function(_0x583db8){logger[_0x27af('0x8')](_0x583db8[_0x27af('0x9')]);if(_0x583db8[_0x27af('0xa')]){delete _0x583db8['name'];}_0x366868[_0x27af('0xb')](_0x389e97)['send'](_0x583db8);};}function execChildProcess(){return new BPromise(function(_0x4d4729,_0x3e4b33){exec('npm\x20install',function(_0x50fe01,_0x184e25,_0x59c073){logger[_0x27af('0xc')](_0x184e25);logger['info'](_0x59c073);if(_0x50fe01){logger[_0x27af('0x8')](_0x50fe01);return _0x3e4b33(_0x50fe01);}return _0x4d4729(_0x184e25);});});}exports[_0x27af('0xd')]=function(_0x1fd964,_0x23f9ec){return pm2[_0x27af('0xe')]()[_0x27af('0xf')](function(_0x234825){if(_0x234825){var _0x3da435=_[_0x27af('0x10')](_0x234825,function(_0x4724e0){return _0x4724e0[_0x27af('0xa')]===_0x27af('0x11')||_0x4724e0[_0x27af('0xa')]===_0x27af('0x12');});return{'rows':_0x3da435,'count':_0x3da435[_0x27af('0x13')]};}return null;})[_0x27af('0xf')](respondWithResult(_0x23f9ec,null))[_0x27af('0x14')](handleError(_0x23f9ec,null));};exports[_0x27af('0x15')]=function(_0x58583a,_0x315661){return pm2[_0x27af('0x16')](_0x58583a['params']['id'])['then'](respondWithResult(_0x315661,null))[_0x27af('0xf')](handleEntityNotFound(_0x315661,null))[_0x27af('0x14')](handleError(_0x315661,null));};exports[_0x27af('0x17')]=function(_0x31573a,_0xec699a){if(_0x31573a['body'][_0x27af('0xa')]&&_0x31573a[_0x27af('0x18')][_0x27af('0x19')]){var _0x5e7c19=path[_0x27af('0x1a')](__dirname,_0x27af('0x1b'),_0x31573a[_0x27af('0x18')]['script']);var _0x2dce2b=process[_0x27af('0x1c')]();process[_0x27af('0x1d')](path[_0x27af('0x1e')](_0x5e7c19));return execChildProcess()[_0x27af('0xf')](function(_0x396156){process[_0x27af('0x1d')](_0x2dce2b);return pm2[_0x27af('0x1f')]({'name':_0x31573a[_0x27af('0x18')]['name'],'script':_0x5e7c19});})['then'](function(_0x4b8fe6){pm2[_0x27af('0x20')]();return _0x4b8fe6[0x0];})['then'](respondWithResult(_0xec699a,0xc9))[_0x27af('0x14')](handleError(_0xec699a,null));}else{return _0xec699a[_0x27af('0xb')](0x1f4)['send']({'message':_0x27af('0x21')});}};exports[_0x27af('0x22')]=function(_0x463e36,_0x424490){if(_0x463e36[_0x27af('0x18')]['id']){delete _0x463e36[_0x27af('0x18')]['id'];}var _0x775d4e={'online':'restart','stopped':_0x27af('0x23')};if(_0x775d4e[_0x27af('0x24')](_0x463e36[_0x27af('0x18')][_0x27af('0xb')])){return pm2[_0x775d4e[_0x463e36[_0x27af('0x18')][_0x27af('0xb')]]](_0x463e36[_0x27af('0x25')]['id'])[_0x27af('0xf')](respondWithResult(_0x424490,0xc8))[_0x27af('0x14')](handleError(_0x424490,null));}else{return _0x424490[_0x27af('0xb')](0x1f4)[_0x27af('0x26')]({'message':'Unknown\x20status'});}};exports[_0x27af('0x27')]=function(_0x14b2e7,_0x3800a1){if(_0x14b2e7[_0x27af('0x18')]['id']){delete _0x14b2e7[_0x27af('0x18')]['id'];}if(_0x14b2e7[_0x27af('0x25')]['id']){return pm2['delete'](_0x14b2e7['params']['id'])[_0x27af('0xf')](function(_0x37cb41){pm2['dump']();return _0x37cb41[0x0];})[_0x27af('0xf')](respondWithResult(_0x3800a1,null))[_0x27af('0x14')](handleError(_0x3800a1,null));}else{return _0x3800a1[_0x27af('0xb')](0x1f4)[_0x27af('0x26')]({'message':_0x27af('0x28')});}}; \ No newline at end of file +var _0x4e81=['npm\x20install','info','index','then','express','length','catch','show','describe','params','create','body','script','join','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','exec','bluebird','sendStatus','status','json','error','stack','name','send'];(function(_0x97e3f2,_0x14d5b3){var _0x469d99=function(_0x1186b3){while(--_0x1186b3){_0x97e3f2['push'](_0x97e3f2['shift']());}};_0x469d99(++_0x14d5b3);}(_0x4e81,0x1bc));var _0x14e8=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0x4e81[_0x280f4a];return _0x1bb157;};'use strict';var _=require(_0x14e8('0x0'));var pm2=require(_0x14e8('0x1'));var logger=require(_0x14e8('0x2'))('api');var path=require('path');var exec=require('child_process')[_0x14e8('0x3')];var BPromise=require(_0x14e8('0x4'));function handleEntityNotFound(_0x224121,_0x436444){return function(_0x325325){if(!_0x325325){_0x224121[_0x14e8('0x5')](0x194);;}return _0x325325;};}function respondWithResult(_0x56a266,_0x57c79b){_0x57c79b=_0x57c79b||0xc8;return function(_0x3e73d2){if(_0x3e73d2){return _0x56a266[_0x14e8('0x6')](_0x57c79b)[_0x14e8('0x7')](_0x3e73d2);}return null;};}function handleError(_0x3c1b93,_0x11ec3b){_0x11ec3b=_0x11ec3b||0x1f4;return function(_0x20f053){logger[_0x14e8('0x8')](_0x20f053[_0x14e8('0x9')]);if(_0x20f053[_0x14e8('0xa')]){delete _0x20f053['name'];}_0x3c1b93[_0x14e8('0x6')](_0x11ec3b)[_0x14e8('0xb')](_0x20f053);};}function execChildProcess(){return new BPromise(function(_0x43bfcd,_0x2906b3){exec(_0x14e8('0xc'),function(_0x3ce648,_0x3bed91,_0x30df66){logger['info'](_0x3bed91);logger[_0x14e8('0xd')](_0x30df66);if(_0x3ce648){logger['error'](_0x3ce648);return _0x2906b3(_0x3ce648);}return _0x43bfcd(_0x3bed91);});});}exports[_0x14e8('0xe')]=function(_0x341d40,_0x32a01d){return pm2['list']()[_0x14e8('0xf')](function(_0x4e1064){if(_0x4e1064){var _0x458e4a=_['reject'](_0x4e1064,function(_0x347216){return _0x347216[_0x14e8('0xa')]===_0x14e8('0x10')||_0x347216[_0x14e8('0xa')]==='motion2';});return{'rows':_0x458e4a,'count':_0x458e4a[_0x14e8('0x11')]};}return null;})[_0x14e8('0xf')](respondWithResult(_0x32a01d,null))[_0x14e8('0x12')](handleError(_0x32a01d,null));};exports[_0x14e8('0x13')]=function(_0xd4d6b2,_0x1f1a0d){return pm2[_0x14e8('0x14')](_0xd4d6b2[_0x14e8('0x15')]['id'])['then'](respondWithResult(_0x1f1a0d,null))[_0x14e8('0xf')](handleEntityNotFound(_0x1f1a0d,null))[_0x14e8('0x12')](handleError(_0x1f1a0d,null));};exports[_0x14e8('0x16')]=function(_0x7b10f2,_0x246c5d){if(_0x7b10f2['body'][_0x14e8('0xa')]&&_0x7b10f2[_0x14e8('0x17')][_0x14e8('0x18')]){var _0x48e30a=path[_0x14e8('0x19')](__dirname,'../../files/plugins',_0x7b10f2[_0x14e8('0x17')][_0x14e8('0x18')]);var _0x3e8d5c=process[_0x14e8('0x1a')]();process[_0x14e8('0x1b')](path['dirname'](_0x48e30a));return execChildProcess()[_0x14e8('0xf')](function(_0x5b11f9){process[_0x14e8('0x1b')](_0x3e8d5c);return pm2[_0x14e8('0x1c')]({'name':_0x7b10f2['body']['name'],'script':_0x48e30a});})['then'](function(_0x4a758c){pm2[_0x14e8('0x1d')]();return _0x4a758c[0x0];})[_0x14e8('0xf')](respondWithResult(_0x246c5d,0xc9))[_0x14e8('0x12')](handleError(_0x246c5d,null));}else{return _0x246c5d[_0x14e8('0x6')](0x1f4)['send']({'message':_0x14e8('0x1e')});}};exports[_0x14e8('0x1f')]=function(_0x3c09cb,_0x2f5818){if(_0x3c09cb[_0x14e8('0x17')]['id']){delete _0x3c09cb[_0x14e8('0x17')]['id'];}var _0x2813ae={'online':'restart','stopped':_0x14e8('0x20')};if(_0x2813ae[_0x14e8('0x21')](_0x3c09cb[_0x14e8('0x17')]['status'])){return pm2[_0x2813ae[_0x3c09cb['body']['status']]](_0x3c09cb[_0x14e8('0x15')]['id'])[_0x14e8('0xf')](respondWithResult(_0x2f5818,0xc8))['catch'](handleError(_0x2f5818,null));}else{return _0x2f5818[_0x14e8('0x6')](0x1f4)[_0x14e8('0xb')]({'message':_0x14e8('0x22')});}};exports[_0x14e8('0x23')]=function(_0x5c2635,_0x1f1259){if(_0x5c2635[_0x14e8('0x17')]['id']){delete _0x5c2635[_0x14e8('0x17')]['id'];}if(_0x5c2635[_0x14e8('0x15')]['id']){return pm2[_0x14e8('0x24')](_0x5c2635['params']['id'])[_0x14e8('0xf')](function(_0x29ee7a){pm2[_0x14e8('0x1d')]();return _0x29ee7a[0x0];})[_0x14e8('0xf')](respondWithResult(_0x1f1259,null))['catch'](handleError(_0x1f1259,null));}else{return _0x1f1259[_0x14e8('0x6')](0x1f4)['send']({'message':_0x14e8('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index f4979de..4c3ebb9 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 _0x8143=['isAuthenticated','getAgents','/queues','getQueues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents'];(function(_0x3bf105,_0x788b47){var _0xebc321=function(_0x3b4c34){while(--_0x3b4c34){_0x3bf105['push'](_0x3bf105['shift']());}};_0xebc321(++_0x788b47);}(_0x8143,0x186));var _0x3814=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8143[_0x321bb2];return _0x9c12ed;};'use strict';var express=require(_0x3814('0x0'));var router=express[_0x3814('0x1')]();var auth=require(_0x3814('0x2'));var controller=require(_0x3814('0x3'));router[_0x3814('0x4')](_0x3814('0x5'),auth[_0x3814('0x6')](),controller[_0x3814('0x7')]);router[_0x3814('0x4')](_0x3814('0x8'),auth[_0x3814('0x6')](),controller[_0x3814('0x9')]);module[_0x3814('0xa')]=router; \ No newline at end of file +var _0xe2f8=['/agents','isAuthenticated','getAgents','getQueues','exports','Router','../../components/auth/service','./realtime.controller','get'];(function(_0x23f8b4,_0x9f875e){var _0x1d7724=function(_0x4489b0){while(--_0x4489b0){_0x23f8b4['push'](_0x23f8b4['shift']());}};_0x1d7724(++_0x9f875e);}(_0xe2f8,0x7a));var _0x8e2f=function(_0x103ac7,_0x2ede54){_0x103ac7=_0x103ac7-0x0;var _0x252c97=_0xe2f8[_0x103ac7];return _0x252c97;};'use strict';var express=require('express');var router=express[_0x8e2f('0x0')]();var auth=require(_0x8e2f('0x1'));var controller=require(_0x8e2f('0x2'));router[_0x8e2f('0x3')](_0x8e2f('0x4'),auth[_0x8e2f('0x5')](),controller[_0x8e2f('0x6')]);router['get']('/queues',auth[_0x8e2f('0x5')](),controller[_0x8e2f('0x7')]);module[_0x8e2f('0x8')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index f24e78d..02ab93c 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 _0x1e02=['rawAttributes','QueueCampaigns','getResources','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','json','error','name','send','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','waiting','talking','voice','outbound','push','pTalking','originated','message','Trunk','startPredictive','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','get','paused','loggedInDb','find','pick','filter','queue','length','busy','some','connectedlinenum','toString','getMembers','UserId','accountcode','online','agents','startCase','Queue','Pause','findAll','idle','unknown','unavailable','ringing','isNil','faxPause','smsPause','voicePause','whatsappPause','every','voiceStatus','pause','chatStatus','openchannelStatus','smsStatus','whatsappStatus','mail','chat','includes','toLowerCase','Invalid\x20channel','isArray','findOne','all','flatten','uniq','value','split','fields','order','ASC','globalStatus','pauseType','DESC','getAgents','userpic','lastLoginAt','lastPauseAt','address','chatPause','openchannelPause','mailPause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','mailStatus','faxStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','resolve','query','channel','sort','join','globalQueueFilter','map','User','fieldName','type','key','role','agent','getOptions','where','isEmpty','user','userProfileId','nolimit','UserProfile','findAndCountAll','rows','omit','globalStatusFilter','pauseTypeFilter','getQueues'];(function(_0x181246,_0x3d9d0f){var _0xc83dd0=function(_0x329f33){while(--_0x329f33){_0x181246['push'](_0x181246['shift']());}};_0xc83dd0(++_0x3d9d0f);}(_0x1e02,0xab));var _0x21e0=function(_0x486725,_0x593d67){_0x486725=_0x486725-0x0;var _0x558836=_0x1e02[_0x486725];return _0x558836;};'use strict';var util=require(_0x21e0('0x0'));var _=require(_0x21e0('0x1'));var jayson=require(_0x21e0('0x2'));var qs=require(_0x21e0('0x3'));var logger=require(_0x21e0('0x4'))(_0x21e0('0x5'));var db=require(_0x21e0('0x6'))['db'];var amiClient=jayson[_0x21e0('0x7')]['http']({'port':0x232a});var routingClient=jayson[_0x21e0('0x7')][_0x21e0('0x8')]({'port':0x232c});function respondWithFilteredResult(_0x54ccc3,_0x2f85fc){return function(_0x528dfa){if(_0x528dfa){var _0x446c1b=typeof _0x2f85fc[_0x21e0('0x9')]===_0x21e0('0xa')&&typeof _0x2f85fc[_0x21e0('0xb')]==='undefined';var _0x33b464=_0x528dfa['count'];var _0xc1dec4=_0x446c1b?0x0:_0x2f85fc[_0x21e0('0x9')];var _0x504c9a=_0x446c1b?_0x528dfa[_0x21e0('0xc')]:_0x2f85fc[_0x21e0('0x9')]+_0x2f85fc[_0x21e0('0xb')];var _0x46a747;if(_0x504c9a>=_0x33b464){_0x504c9a=_0x33b464;_0x46a747=0xc8;}else{_0x46a747=0xce;}_0x54ccc3[_0x21e0('0xd')](_0x46a747);return _0x54ccc3[_0x21e0('0xe')](_0x21e0('0xf'),_0xc1dec4+'-'+_0x504c9a+'/'+_0x33b464)[_0x21e0('0x10')](_0x528dfa);}return null;};}function handleError(_0x473a0e,_0x4b2eb2){_0x4b2eb2=_0x4b2eb2||0x1f4;return function(_0x4d59ca){logger[_0x21e0('0x11')](_0x4d59ca['stack']);if(_0x4d59ca['name']){delete _0x4d59ca[_0x21e0('0x12')];}_0x473a0e['status'](_0x4b2eb2)[_0x21e0('0x13')](_0x4d59ca);};}function getRealtimeAgents(){return new Promise(function(_0x1634ce,_0x292fee){return amiClient[_0x21e0('0x14')](_0x21e0('0x15'),{})[_0x21e0('0x16')](function(_0x1b372f){if(_0x1b372f[_0x21e0('0x11')])throw new Error(_0x21e0('0x17'));var _0x413c2d=_0x1b372f[_0x21e0('0x18')];return routingClient[_0x21e0('0x14')]('Agents',{})[_0x21e0('0x16')](function(_0x2d7a8b){if(_0x2d7a8b['error'])throw new Error(_0x21e0('0x19'));var _0x51bd8a=_0x2d7a8b[_0x21e0('0x18')];return _0x1634ce(_[_0x21e0('0x1a')]({},_0x413c2d,_0x51bd8a));});})[_0x21e0('0x1b')](function(_0x4e8a87){_0x292fee(_0x4e8a87);});});}function getRealtimeQueues(_0x157704,_0x2e73f2){return new Promise(function(_0x272703,_0x3a559b){var _0x535872=_0x2e73f2==='voice'?amiClient:routingClient;return _0x535872[_0x21e0('0x14')](_['startCase'](_0x2e73f2)+_0x21e0('0x1c'),_0x157704)['then'](function(_0x48d61c){if(_0x48d61c[_0x21e0('0x11')])throw new Error(util[_0x21e0('0x1d')](_0x21e0('0x1e'),_0x2e73f2));return _0x272703(_0x48d61c[_0x21e0('0x18')]);})[_0x21e0('0x1b')](function(_0x27759c){_0x3a559b(_0x27759c);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x1c6cac,_0x3b507e){return amiClient['request'](_0x21e0('0x1f'),{})[_0x21e0('0x16')](function(_0x26fbd3){if(_0x26fbd3['error'])throw new Error(_0x21e0('0x20'));return _0x1c6cac(_0x26fbd3[_0x21e0('0x18')]);})[_0x21e0('0x1b')](function(_0x494ac7){_0x3b507e(_0x494ac7);});});}function initializeQueues(_0xf43f0b,_0x353f8d,_0x268098,_0x3f5994){var _0x2a6c79=[_0x21e0('0x21'),'available',_0x21e0('0x22'),_0x21e0('0x23'),'paused'];if(_0x268098===_0x21e0('0x24')&&_0x3f5994===_0x21e0('0x25')){_0x2a6c79[_0x21e0('0x26')](_0x21e0('0x27'),_0x21e0('0x28'),_0x21e0('0x29'),'dialActive','dialMethod',_0x21e0('0x2a'),_0x21e0('0x2b'),_0x21e0('0x2c'),'erlangCalls',_0x21e0('0x2d'),_0x21e0('0x2e'),_0x21e0('0x2f'),_0x21e0('0x30'),_0x21e0('0x31'),'dialPredictiveIntervalMinThreshold',_0x21e0('0x32'),_0x21e0('0x33'),_0x21e0('0x34'),_0x21e0('0x35'),_0x21e0('0x36'),_0x21e0('0x37'),_0x21e0('0x38'));}return _0xf43f0b['map'](function(_0x386ea6){var _0xc29cf0=_0x386ea6[_0x21e0('0x39')]({'plain':!![]});_0xc29cf0['agents']=[];_0xc29cf0[_0x21e0('0x3a')]=0x0;_0xc29cf0[_0x21e0('0x3b')]=0x0;_0xc29cf0[_0x21e0('0x21')]=0x0;_0xc29cf0['available']=0x0;_0xc29cf0[_0x21e0('0x22')]=0x0;if(_0x268098==='voice'){_0xc29cf0[_0x21e0('0x23')]=0x0;_0xc29cf0['busy']=0x0;if(_0x3f5994===_0x21e0('0x25')){_0xc29cf0['pTalking']=0x0;_0xc29cf0[_0x21e0('0x28')]=0x0;}}var _0x444450=_[_0x21e0('0x3c')](_0x353f8d,['id',_0xc29cf0['id']]);if(_0x444450)_[_0x21e0('0x1a')](_0xc29cf0,_[_0x21e0('0x3d')](_0x444450,_0x2a6c79));return _0xc29cf0;});}function updateAgentVoiceStatus(_0x22c01f,_0xe8d4e3,_0x207ecd){var _0x2f466a=_[_0x21e0('0x3e')](_0x207ecd,[_0x21e0('0x3f'),_0xe8d4e3[_0x21e0('0x12')]]);if(_0x2f466a[_0x21e0('0x40')]===0x0)return _0x22c01f[_0x21e0('0x41')]=!![];if(_[_0x21e0('0x42')](_0x2f466a,[_0x21e0('0x43'),_0x22c01f['internal'][_0x21e0('0x44')]()]))return _0x22c01f['talking']=!![];if(!_0x22c01f[_0x21e0('0x23')])return _0x22c01f['busy']=!![];}function getVoiceQueueAgents(_0x594817,_0x484cab,_0x5caaed,_0x1a9a7a){var _0x3470d9=_[_0x21e0('0x3c')](_0x484cab,['id',_0x594817['id']]);if(!_0x3470d9)return _0x594817;return _0x3470d9[_0x21e0('0x45')]({'raw':!![]})['then'](function(_0x2bd47b){for(var _0xa1cb26=0x0;_0xa1cb26<_0x2bd47b[_0x21e0('0x40')];_0xa1cb26++){var _0x3dcf72=_['find'](_0x5caaed,['id',_0x2bd47b[_0xa1cb26][_0x21e0('0x46')]]);if(!_0x3dcf72){_0x3dcf72={'id':_0x2bd47b[_0xa1cb26]['UserId'],'name':_0x2bd47b[_0xa1cb26][_0x21e0('0x46')],'accountcode':'','online':![]};}var _0x5894d1={'id':_0x3dcf72['id'],'name':_0x3dcf72['name'],'internal':_0x3dcf72[_0x21e0('0x47')],'online':Boolean(_0x3dcf72[_0x21e0('0x48')]),'paused':Boolean(_0x2bd47b[_0xa1cb26][_0x21e0('0x3a')])};if(_0x3dcf72['voiceStatus']===_0x21e0('0x23'))updateAgentVoiceStatus(_0x5894d1,_0x594817,_0x1a9a7a);if(_0x5894d1['online'])_0x594817[_0x21e0('0x3b')]++;if(_0x5894d1['busy'])_0x594817[_0x21e0('0x41')]++;if(_0x5894d1[_0x21e0('0x3a')]&&!_0x5894d1[_0x21e0('0x41')]&&!_0x5894d1[_0x21e0('0x23')])_0x594817[_0x21e0('0x3a')]++;_0x594817[_0x21e0('0x49')][_0x21e0('0x26')](_0x5894d1);}return _0x594817;});}function getQueueAgents(_0x29a5a9,_0x4e44ad,_0x48566d){var _0x2784e1='User'+_[_0x21e0('0x4a')](_0x48566d)+_0x21e0('0x4b');var _0xcdd391=_0x48566d+_0x21e0('0x4c');return db[_0x2784e1][_0x21e0('0x4d')]({'where':{[_[_0x21e0('0x4a')](_0x48566d)+'QueueId']:_0x29a5a9['id']},'raw':!![]})[_0x21e0('0x16')](function(_0x4d4343){for(var _0x1b24d1=0x0;_0x1b24d1<_0x4d4343['length'];_0x1b24d1++){var _0x5d90a3=_[_0x21e0('0x3c')](_0x4e44ad,['id',_0x4d4343[_0x1b24d1][_0x21e0('0x46')]]);if(!_0x5d90a3){_0x5d90a3={'id':_0x4d4343[_0x1b24d1][_0x21e0('0x46')],'name':_0x4d4343[_0x1b24d1][_0x21e0('0x46')],'online':![],['pauseField']:![]};}var _0x93d1f2={'id':_0x5d90a3['id'],'name':_0x5d90a3[_0x21e0('0x12')],'online':Boolean(_0x5d90a3[_0x21e0('0x48')]),'paused':Boolean(_0x5d90a3[_0xcdd391])};if(_0x93d1f2[_0x21e0('0x48')])_0x29a5a9['loggedInDb']++;_0x29a5a9[_0x21e0('0x49')][_0x21e0('0x26')](_0x93d1f2);}return _0x29a5a9;});}function isIdle(_0x50d69b){return _0x50d69b===_0x21e0('0x4e')||_0x50d69b===_0x21e0('0x4f')||_0x50d69b===_0x21e0('0x50')||_0x50d69b===_0x21e0('0x51')||_[_0x21e0('0x52')](_0x50d69b);}function isAgentPaused(_0x317338,_0x49fb85){var _0x1ae7a7=[_0x317338['chatPause'],_0x317338[_0x21e0('0x53')],_0x317338['mailPause'],_0x317338['openchannelPause'],_0x317338[_0x21e0('0x54')],_0x317338[_0x21e0('0x55')],_0x317338[_0x21e0('0x56')]];if(!_0x49fb85)return _[_0x21e0('0x57')](_0x1ae7a7);var _0x3eb79f=_[_0x21e0('0x3e')](_0x1ae7a7);return _0x3eb79f[_0x21e0('0x40')]>0x0&&_0x3eb79f['length']<_0x1ae7a7[_0x21e0('0x40')]?!![]:![];}function isAgentIdle(_0x4f2e66){if(_0x4f2e66[_0x21e0('0x58')]!==_0x21e0('0x4e')&&_0x4f2e66[_0x21e0('0x55')]){_0x4f2e66['voiceStatus']=_0x21e0('0x59');return![];}return _['every']([_0x4f2e66[_0x21e0('0x5a')],_0x4f2e66['faxStatus'],_0x4f2e66['mailStatus'],_0x4f2e66[_0x21e0('0x5b')],_0x4f2e66[_0x21e0('0x5c')],_0x4f2e66[_0x21e0('0x58')],_0x4f2e66[_0x21e0('0x5d')]],isIdle);}function getAgentStatus(_0x342fec){var _0x5c9f91=_0x21e0('0x4f');if(isAgentPaused(_0x342fec))_0x5c9f91=_0x21e0('0x59');else if(isAgentPaused(_0x342fec,!![]))_0x5c9f91='*pause';else if(isAgentIdle(_0x342fec))_0x5c9f91=_0x21e0('0x4e');else _0x5c9f91=_0x21e0('0x41');return _0x5c9f91;}function validateChannel(_0x5aab47){var _0x1e5b44=[_0x21e0('0x5e'),_0x21e0('0x5f'),'sms','openchannel','fax','whatsapp',_0x21e0('0x24')];if(!_[_0x21e0('0x60')](_0x1e5b44,_0x5aab47[_0x21e0('0x61')]()))throw new Error(_0x21e0('0x62'));return _0x5aab47[_0x21e0('0x61')]();}function getFilteredAgentIds(_0x45cad2,_0x5ecc03){var _0x44d280=_[_0x21e0('0x63')](_0x45cad2)?_0x45cad2:[_0x45cad2];var _0xa1d311=_['map'](_0x44d280,function(_0x20282f){return db[_0x5ecc03][_0x21e0('0x64')]({'where':{'name':_0x20282f}})[_0x21e0('0x16')](function(_0x3fc4ae){if(!_0x3fc4ae)return[];return _0x3fc4ae['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x21e0('0x65')](_0xa1d311)['then'](function(_0x22cfcb){var _0x539c21=_(_0x22cfcb)[_0x21e0('0x66')]()['map']('id')[_0x21e0('0x67')]()[_0x21e0('0x68')]();return _0x539c21;});}function getUpdatedSortOptions(_0x788158){var _0x4574f4={'fields':[],'order':null};var _0x4b0075=_0x788158[_0x21e0('0x69')](',');_0x4574f4[_0x21e0('0x6a')]=_['filter'](_0x4b0075,function(_0x2791af){if(!_0x2791af[_0x21e0('0x60')]('globalStatus'))return!![];_0x4574f4[_0x21e0('0x6b')]=_['startsWith'](_0x2791af,'-')?'DESC':_0x21e0('0x6c');return![];});return _0x4574f4;}function orderAgentsByStatus(_0x3d0b11,_0x3b3aef){return _0x3d0b11['sort'](function(_0x1b009a,_0xc0b0d4){if(_0x1b009a[_0x21e0('0x6d')]===_0xc0b0d4[_0x21e0('0x6d')]&&_0x1b009a[_0x21e0('0x6d')]===_0x21e0('0x59')){if(_0x3b3aef==='DESC')return(_0x1b009a[_0x21e0('0x6e')]||'')<(_0xc0b0d4[_0x21e0('0x6e')]||'')?0x1:-0x1;return _0x1b009a['pauseType']<_0xc0b0d4[_0x21e0('0x6e')]?-0x1:0x1;}else{if(_0x3b3aef===_0x21e0('0x6f'))return _0x1b009a[_0x21e0('0x6d')]<_0xc0b0d4[_0x21e0('0x6d')]?0x1:-0x1;return _0x1b009a[_0x21e0('0x6d')]<_0xc0b0d4['globalStatus']?-0x1:0x1;}});}exports[_0x21e0('0x70')]=function(_0x404b80,_0x542af9){var _0xe51d85={'count':0x0,'rows':[]},_0x4a6778={},_0xf50e60,_0x15cc57,_0x2be035,_0x570427,_0x1768a8=[_0x21e0('0x71'),_0x21e0('0x48'),_0x21e0('0x72'),_0x21e0('0x73'),'pauseType',_0x21e0('0x73'),'internal',_0x21e0('0x74'),_0x21e0('0x75'),_0x21e0('0x76'),_0x21e0('0x77'),_0x21e0('0x54'),'whatsappPause',_0x21e0('0x53'),_0x21e0('0x55'),_0x21e0('0x78'),'openchannelCapacity',_0x21e0('0x79'),_0x21e0('0x7a'),_0x21e0('0x7b'),'faxCapacity','chatCurrentCapacity',_0x21e0('0x7c'),_0x21e0('0x7d'),_0x21e0('0x7e'),'whatsappCurrentCapacity',_0x21e0('0x7f'),_0x21e0('0x5a'),_0x21e0('0x5b'),_0x21e0('0x80'),_0x21e0('0x5c'),_0x21e0('0x5d'),_0x21e0('0x81'),_0x21e0('0x58'),_0x21e0('0x82'),'openchannelStatusTime',_0x21e0('0x83'),_0x21e0('0x84'),_0x21e0('0x85'),_0x21e0('0x86'),'voiceStatusTime',_0x21e0('0x3f'),'destconnectedlinenum',_0x21e0('0x87'),_0x21e0('0x88'),_0x21e0('0x89'),_0x21e0('0x8a')],_0x546cd5=['chatPause',_0x21e0('0x76'),_0x21e0('0x77'),_0x21e0('0x54'),_0x21e0('0x56'),_0x21e0('0x53'),_0x21e0('0x55'),'online'];Promise[_0x21e0('0x8b')]()[_0x21e0('0x16')](function(){if(_0x404b80[_0x21e0('0x8c')]['channel'])_0xf50e60=validateChannel(_0x404b80[_0x21e0('0x8c')][_0x21e0('0x8d')]);if(!_0x404b80[_0x21e0('0x8c')]['sort']||!_0x404b80[_0x21e0('0x8c')][_0x21e0('0x8e')][_0x21e0('0x60')](_0x21e0('0x6d')))return;var _0x33e53b=getUpdatedSortOptions(_0x404b80['query'][_0x21e0('0x8e')]);_0x404b80[_0x21e0('0x8c')][_0x21e0('0x8e')]=_0x33e53b[_0x21e0('0x6a')][_0x21e0('0x8f')](',');_0x15cc57=_0x33e53b['order'];})[_0x21e0('0x16')](function(){if(!_0x404b80[_0x21e0('0x8c')][_0x21e0('0x90')])return[];var _0x58076e=_[_0x21e0('0x4a')](_0xf50e60)+_0x21e0('0x4b');return getFilteredAgentIds(_0x404b80[_0x21e0('0x8c')][_0x21e0('0x90')],_0x58076e);})[_0x21e0('0x16')](function(_0x16be18){var _0x5c1fe6=_[_0x21e0('0x91')](db[_0x21e0('0x92')]['rawAttributes'],function(_0x32c146){return{'name':_0x32c146[_0x21e0('0x93')],'type':_0x32c146[_0x21e0('0x94')][_0x21e0('0x95')]};});_0x404b80[_0x21e0('0x8c')][_0x21e0('0x96')]=_0x21e0('0x97');_0x404b80[_0x21e0('0x8c')][_0x21e0('0x48')]=!![];_0x4a6778=qs[_0x21e0('0x98')](_0x5c1fe6,_0x404b80);_0x4a6778['raw']=!![];if(!_['isEmpty'](_0x16be18)){_0x4a6778[_0x21e0('0x99')]=_['merge'](_0x4a6778['where'],{'$and':[{'id':{'$in':_0x16be18}}]});}else if(!_[_0x21e0('0x9a')](_0x404b80[_0x21e0('0x8c')][_0x21e0('0x90')])){return _0xe51d85;}if(_0x404b80['user'][_0x21e0('0x96')]===_0x21e0('0x9b')){var _0x22c78e={'params':{'id':_0x404b80[_0x21e0('0x9b')][_0x21e0('0x9c')]},'query':{'section':_0x21e0('0x15'),'role':_0x21e0('0x97'),'online':!![],'nolimit':_0x404b80[_0x21e0('0x8c')][_0x21e0('0x9d')],'sort':_0x404b80['query'][_0x21e0('0x8e')],'filter':_0x404b80['query'][_0x21e0('0x3e')],'raw':!![],'ids':_0x16be18}};return db[_0x21e0('0x9e')]['getResources'](_0x22c78e);}return db[_0x21e0('0x92')][_0x21e0('0x9f')](_0x4a6778);})[_0x21e0('0x16')](function(_0x3bfce0){_0xe51d85[_0x21e0('0xc')]=_0x3bfce0[_0x21e0('0xc')];_0x2be035=_0x3bfce0[_0x21e0('0xa0')];return getRealtimeAgents();})[_0x21e0('0x16')](function(_0x130164){_0x570427=_0x130164[_0x21e0('0xa0')];return _0x2be035[_0x21e0('0x91')](function(_0x3d34f0){var _0x30cf6b=_[_0x21e0('0x3c')](_0x570427,['id',_0x3d34f0['id']]);if(_0x30cf6b)_['merge'](_0x3d34f0,_[_0x21e0('0x3d')](_[_0x21e0('0xa1')](_0x30cf6b,_0x546cd5),_0x1768a8));_0x3d34f0['globalStatus']=getAgentStatus(_0x3d34f0);return _0x3d34f0;});})[_0x21e0('0x16')](function(_0xbd6602){var _0x35307d;if(_0x404b80[_0x21e0('0x8c')]['globalStatusFilter']){_0x35307d=_[_0x21e0('0x3e')](_0xbd6602,[_0x21e0('0x6d'),_0x404b80[_0x21e0('0x8c')][_0x21e0('0xa2')]]);if(_0x404b80['query'][_0x21e0('0xa3')]){_0x35307d=_[_0x21e0('0x3e')](_0x35307d,[_0x21e0('0x6e'),_0x404b80['query']['pauseTypeFilter']]);}}if(_0x35307d)_0xbd6602=_0x35307d;if(!_0x15cc57)return _0xbd6602;return orderAgentsByStatus(_0xbd6602,_0x15cc57);})['then'](function(_0x16d19d){_0xe51d85[_0x21e0('0xa0')]=_0x16d19d;return _0xe51d85;})['then'](respondWithFilteredResult(_0x542af9,_0x4a6778))[_0x21e0('0x1b')](handleError(_0x542af9,null));};exports[_0x21e0('0xa4')]=function(_0x12caf6,_0x409241){var _0x40d780={'count':0x0,'rows':[]},_0x3a1849={},_0x56adb5,_0x55f0e0,_0x11aefc,_0xd29c7a,_0x3d5f8d;Promise['resolve']()[_0x21e0('0x16')](function(){if(_0x12caf6[_0x21e0('0x8c')][_0x21e0('0x8d')])_0x56adb5=validateChannel(_0x12caf6['query'][_0x21e0('0x8d')]);var _0x51c5a2=_[_0x21e0('0x4a')](_0x56adb5)+'Queue';var _0x5bc101=_[_0x21e0('0x91')](db[_0x51c5a2][_0x21e0('0xa5')],function(_0x82af63){return{'name':_0x82af63[_0x21e0('0x93')],'type':_0x82af63[_0x21e0('0x94')][_0x21e0('0x95')]};});_0x3a1849=qs[_0x21e0('0x98')](_0x5bc101,_0x12caf6);if(_0x12caf6[_0x21e0('0x9b')]['role']==='user'){var _0x826d29={'params':{'id':_0x12caf6[_0x21e0('0x9b')][_0x21e0('0x9c')]},'query':{'section':_0x56adb5==='voice'&&_0x12caf6['query'][_0x21e0('0x94')]===_0x21e0('0x25')?_0x21e0('0xa6'):_['startCase'](_0x56adb5)+_0x21e0('0x1c'),'type':_0x12caf6[_0x21e0('0x8c')][_0x21e0('0x94')],'nolimit':!![],'sort':_0x21e0('0x12'),'filter':_0x12caf6[_0x21e0('0x8c')][_0x21e0('0x3e')]}};return db['UserProfile'][_0x21e0('0xa7')](_0x826d29);}return db[_0x51c5a2][_0x21e0('0x9f')](_0x3a1849);})[_0x21e0('0x16')](function(_0x36a5d2){_0x40d780[_0x21e0('0xc')]=_0x36a5d2['count'];_0x55f0e0=_0x36a5d2['rows'];return getRealtimeQueues(_0x12caf6,_0x56adb5);})[_0x21e0('0x16')](function(_0x246e74){_0xd29c7a=_0x246e74[_0x21e0('0xa0')];return getRealtimeAgents();})[_0x21e0('0x16')](function(_0x538362){_0x11aefc=_0x538362[_0x21e0('0xa0')];if(_0x56adb5!=_0x21e0('0x24'))return;return getRealtimeVoiceQueueChannels();})[_0x21e0('0x16')](function(_0xd60ed7){_0x3d5f8d=_0xd60ed7?_0xd60ed7[_0x21e0('0xa0')]:[];return initializeQueues(_0x55f0e0,_0xd29c7a,_0x56adb5,_0x12caf6[_0x21e0('0x8c')]['type']);})['then'](function(_0x36e149){var _0x44ce25=_0x36e149[_0x21e0('0x91')](function(_0x5ee4f2){if(_0x56adb5==='voice')return getVoiceQueueAgents(_0x5ee4f2,_0x55f0e0,_0x11aefc,_0x3d5f8d);else return getQueueAgents(_0x5ee4f2,_0x11aefc,_0x56adb5);});return Promise['all'](_0x44ce25);})['then'](function(_0x3f09a4){_0x40d780['rows']=_0x3f09a4;return _0x40d780;})[_0x21e0('0x16')](respondWithFilteredResult(_0x409241,_0x3a1849))[_0x21e0('0x1b')](handleError(_0x409241,null));}; \ No newline at end of file +var _0x25ad=['whatsappCapacity','faxCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','whatsappPause','resolve','query','join','globalQueueFilter','fieldName','key','role','agent','getOptions','raw','isEmpty','where','user','userProfileId','nolimit','UserProfile','getResources','rows','omit','globalStatusFilter','pauseTypeFilter','getQueues','channel','type','QueueCampaigns','findAndCountAll','lodash','jayson/promise','../../components/parsers/qs','api','../../mysqldb','client','http','offset','undefined','limit','count','status','set','Content-Range','error','stack','name','send','request','Agents','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','voice','startCase','Queues','format','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','talking','paused','outbound','push','pTalking','originated','message','dialActive','Trunk','startProgressive','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','loggedInDb','find','pick','filter','length','connectedlinenum','internal','toString','busy','getMembers','then','UserId','accountcode','voiceStatus','online','User','Queue','Pause','agents','idle','unknown','unavailable','isNil','chatPause','mailPause','openchannelPause','smsPause','voicePause','every','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','pause','*pause','mail','chat','sms','openchannel','fax','whatsapp','includes','toLowerCase','Invalid\x20channel','map','findOne','all','flatten','value','split','globalStatus','order','DESC','sort','pauseType','lastLoginAt','lastPauseAt','address','faxPause','mailCapacity','smsCapacity'];(function(_0x4a16fd,_0x2cd4dc){var _0x5689bb=function(_0x329a77){while(--_0x329a77){_0x4a16fd['push'](_0x4a16fd['shift']());}};_0x5689bb(++_0x2cd4dc);}(_0x25ad,0x168));var _0xd25a=function(_0xd9ce1,_0x517167){_0xd9ce1=_0xd9ce1-0x0;var _0x54be53=_0x25ad[_0xd9ce1];return _0x54be53;};'use strict';var util=require('util');var _=require(_0xd25a('0x0'));var jayson=require(_0xd25a('0x1'));var qs=require(_0xd25a('0x2'));var logger=require('../../config/logger')(_0xd25a('0x3'));var db=require(_0xd25a('0x4'))['db'];var amiClient=jayson[_0xd25a('0x5')][_0xd25a('0x6')]({'port':0x232a});var routingClient=jayson[_0xd25a('0x5')][_0xd25a('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x57f6ab,_0x4843a8){return function(_0x287e2b){if(_0x287e2b){var _0x3f4286=typeof _0x4843a8[_0xd25a('0x7')]===_0xd25a('0x8')&&typeof _0x4843a8[_0xd25a('0x9')]===_0xd25a('0x8');var _0x5305ef=_0x287e2b[_0xd25a('0xa')];var _0x14f6ec=_0x3f4286?0x0:_0x4843a8[_0xd25a('0x7')];var _0x59c641=_0x3f4286?_0x287e2b['count']:_0x4843a8[_0xd25a('0x7')]+_0x4843a8[_0xd25a('0x9')];var _0x3de180;if(_0x59c641>=_0x5305ef){_0x59c641=_0x5305ef;_0x3de180=0xc8;}else{_0x3de180=0xce;}_0x57f6ab[_0xd25a('0xb')](_0x3de180);return _0x57f6ab[_0xd25a('0xc')](_0xd25a('0xd'),_0x14f6ec+'-'+_0x59c641+'/'+_0x5305ef)['json'](_0x287e2b);}return null;};}function handleError(_0x4e11b8,_0xa4ec6c){_0xa4ec6c=_0xa4ec6c||0x1f4;return function(_0x41b0c5){logger[_0xd25a('0xe')](_0x41b0c5[_0xd25a('0xf')]);if(_0x41b0c5[_0xd25a('0x10')]){delete _0x41b0c5[_0xd25a('0x10')];}_0x4e11b8['status'](_0xa4ec6c)[_0xd25a('0x11')](_0x41b0c5);};}function getRealtimeAgents(){return new Promise(function(_0x1a3567,_0x5e16b0){return amiClient[_0xd25a('0x12')](_0xd25a('0x13'),{})['then'](function(_0x522b38){if(_0x522b38[_0xd25a('0xe')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0x5b78b9=_0x522b38[_0xd25a('0x14')];return routingClient[_0xd25a('0x12')](_0xd25a('0x13'),{})['then'](function(_0x57273b){if(_0x57273b[_0xd25a('0xe')])throw new Error(_0xd25a('0x15'));var _0x1a3844=_0x57273b[_0xd25a('0x14')];return _0x1a3567(_[_0xd25a('0x16')]({},_0x5b78b9,_0x1a3844));});})[_0xd25a('0x17')](function(_0x351782){_0x5e16b0(_0x351782);});});}function getRealtimeQueues(_0x3da464,_0x395958){return new Promise(function(_0x11b8d2,_0x35fe86){var _0x163f36=_0x395958===_0xd25a('0x18')?amiClient:routingClient;return _0x163f36[_0xd25a('0x12')](_[_0xd25a('0x19')](_0x395958)+_0xd25a('0x1a'),_0x3da464)['then'](function(_0x2643f4){if(_0x2643f4['error'])throw new Error(util[_0xd25a('0x1b')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x395958));return _0x11b8d2(_0x2643f4[_0xd25a('0x14')]);})[_0xd25a('0x17')](function(_0x56958b){_0x35fe86(_0x56958b);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x1c4ef0,_0x6a9e80){return amiClient[_0xd25a('0x12')](_0xd25a('0x1c'),{})['then'](function(_0x46f1bd){if(_0x46f1bd[_0xd25a('0xe')])throw new Error(_0xd25a('0x1d'));return _0x1c4ef0(_0x46f1bd[_0xd25a('0x14')]);})['catch'](function(_0x4fb5ee){_0x6a9e80(_0x4fb5ee);});});}function initializeQueues(_0x3b95bb,_0x5b2c25,_0x5ae7a5,_0x4e7761){var _0x480a7f=[_0xd25a('0x1e'),_0xd25a('0x1f'),_0xd25a('0x20'),_0xd25a('0x21'),_0xd25a('0x22')];if(_0x5ae7a5===_0xd25a('0x18')&&_0x4e7761===_0xd25a('0x23')){_0x480a7f[_0xd25a('0x24')](_0xd25a('0x25'),_0xd25a('0x26'),_0xd25a('0x27'),_0xd25a('0x28'),'dialMethod',_0xd25a('0x29'),'startPredictive',_0xd25a('0x2a'),'erlangCalls',_0xd25a('0x2b'),_0xd25a('0x2c'),'erlangBusyFactor',_0xd25a('0x2d'),_0xd25a('0x2e'),_0xd25a('0x2f'),_0xd25a('0x30'),'predictiveIntervalTotalCalls',_0xd25a('0x31'),_0xd25a('0x32'),_0xd25a('0x33'),_0xd25a('0x34'),_0xd25a('0x35'));}return _0x3b95bb['map'](function(_0x480881){var _0x1d5710=_0x480881['get']({'plain':!![]});_0x1d5710['agents']=[];_0x1d5710[_0xd25a('0x22')]=0x0;_0x1d5710[_0xd25a('0x36')]=0x0;_0x1d5710['loggedIn']=0x0;_0x1d5710[_0xd25a('0x1f')]=0x0;_0x1d5710[_0xd25a('0x20')]=0x0;if(_0x5ae7a5===_0xd25a('0x18')){_0x1d5710[_0xd25a('0x21')]=0x0;_0x1d5710['busy']=0x0;if(_0x4e7761===_0xd25a('0x23')){_0x1d5710[_0xd25a('0x25')]=0x0;_0x1d5710[_0xd25a('0x26')]=0x0;}}var _0x59477d=_[_0xd25a('0x37')](_0x5b2c25,['id',_0x1d5710['id']]);if(_0x59477d)_[_0xd25a('0x16')](_0x1d5710,_[_0xd25a('0x38')](_0x59477d,_0x480a7f));return _0x1d5710;});}function updateAgentVoiceStatus(_0x3e6031,_0x2a3f61,_0xf6c939){var _0x5d4165=_[_0xd25a('0x39')](_0xf6c939,['queue',_0x2a3f61[_0xd25a('0x10')]]);if(_0x5d4165[_0xd25a('0x3a')]===0x0)return _0x3e6031['busy']=!![];if(_['some'](_0x5d4165,[_0xd25a('0x3b'),_0x3e6031[_0xd25a('0x3c')][_0xd25a('0x3d')]()]))return _0x3e6031['talking']=!![];if(!_0x3e6031[_0xd25a('0x21')])return _0x3e6031[_0xd25a('0x3e')]=!![];}function getVoiceQueueAgents(_0x8460f6,_0x592dfe,_0x23ec9a,_0x71046b){var _0x4e0058=_[_0xd25a('0x37')](_0x592dfe,['id',_0x8460f6['id']]);if(!_0x4e0058)return _0x8460f6;return _0x4e0058[_0xd25a('0x3f')]({'raw':!![]})[_0xd25a('0x40')](function(_0x4e53e1){for(var _0x16997b=0x0;_0x16997b<_0x4e53e1[_0xd25a('0x3a')];_0x16997b++){var _0x222570=_[_0xd25a('0x37')](_0x23ec9a,['id',_0x4e53e1[_0x16997b]['UserId']]);if(!_0x222570){_0x222570={'id':_0x4e53e1[_0x16997b][_0xd25a('0x41')],'name':_0x4e53e1[_0x16997b][_0xd25a('0x41')],'accountcode':'','online':![]};}var _0x5f4418={'id':_0x222570['id'],'name':_0x222570[_0xd25a('0x10')],'internal':_0x222570[_0xd25a('0x42')],'online':Boolean(_0x222570['online']),'paused':Boolean(_0x4e53e1[_0x16997b]['paused'])};if(_0x222570[_0xd25a('0x43')]===_0xd25a('0x21'))updateAgentVoiceStatus(_0x5f4418,_0x8460f6,_0x71046b);if(_0x5f4418[_0xd25a('0x44')])_0x8460f6[_0xd25a('0x36')]++;if(_0x5f4418['busy'])_0x8460f6[_0xd25a('0x3e')]++;if(_0x5f4418[_0xd25a('0x22')]&&!_0x5f4418[_0xd25a('0x3e')]&&!_0x5f4418[_0xd25a('0x21')])_0x8460f6['paused']++;_0x8460f6['agents'][_0xd25a('0x24')](_0x5f4418);}return _0x8460f6;});}function getQueueAgents(_0x445533,_0x113686,_0x1c68b2){var _0x201873=_0xd25a('0x45')+_[_0xd25a('0x19')](_0x1c68b2)+_0xd25a('0x46');var _0x508470=_0x1c68b2+_0xd25a('0x47');return db[_0x201873]['findAll']({'where':{[_[_0xd25a('0x19')](_0x1c68b2)+'QueueId']:_0x445533['id']},'raw':!![]})['then'](function(_0x4608a2){for(var _0x3cda24=0x0;_0x3cda24<_0x4608a2[_0xd25a('0x3a')];_0x3cda24++){var _0x56b5a9=_[_0xd25a('0x37')](_0x113686,['id',_0x4608a2[_0x3cda24][_0xd25a('0x41')]]);if(!_0x56b5a9){_0x56b5a9={'id':_0x4608a2[_0x3cda24][_0xd25a('0x41')],'name':_0x4608a2[_0x3cda24][_0xd25a('0x41')],'online':![],['pauseField']:![]};}var _0x30a16e={'id':_0x56b5a9['id'],'name':_0x56b5a9[_0xd25a('0x10')],'online':Boolean(_0x56b5a9[_0xd25a('0x44')]),'paused':Boolean(_0x56b5a9[_0x508470])};if(_0x30a16e[_0xd25a('0x44')])_0x445533[_0xd25a('0x36')]++;_0x445533[_0xd25a('0x48')][_0xd25a('0x24')](_0x30a16e);}return _0x445533;});}function isIdle(_0x38e34b){return _0x38e34b===_0xd25a('0x49')||_0x38e34b===_0xd25a('0x4a')||_0x38e34b===_0xd25a('0x4b')||_0x38e34b==='ringing'||_[_0xd25a('0x4c')](_0x38e34b);}function isAgentPaused(_0x1c323c,_0x47fc5f){var _0x423672=[_0x1c323c[_0xd25a('0x4d')],_0x1c323c['faxPause'],_0x1c323c[_0xd25a('0x4e')],_0x1c323c[_0xd25a('0x4f')],_0x1c323c[_0xd25a('0x50')],_0x1c323c[_0xd25a('0x51')],_0x1c323c['whatsappPause']];if(!_0x47fc5f)return _[_0xd25a('0x52')](_0x423672);var _0x2b5ffa=_['filter'](_0x423672);return _0x2b5ffa[_0xd25a('0x3a')]>0x0&&_0x2b5ffa[_0xd25a('0x3a')]<_0x423672['length']?!![]:![];}function isAgentIdle(_0x1ba971){if(_0x1ba971['voiceStatus']!==_0xd25a('0x49')&&_0x1ba971[_0xd25a('0x51')]){_0x1ba971[_0xd25a('0x43')]='pause';return![];}return _[_0xd25a('0x52')]([_0x1ba971[_0xd25a('0x53')],_0x1ba971[_0xd25a('0x54')],_0x1ba971[_0xd25a('0x55')],_0x1ba971[_0xd25a('0x56')],_0x1ba971[_0xd25a('0x57')],_0x1ba971[_0xd25a('0x43')],_0x1ba971[_0xd25a('0x58')]],isIdle);}function getAgentStatus(_0x18be83){var _0x5de1f7='unknown';if(isAgentPaused(_0x18be83))_0x5de1f7=_0xd25a('0x59');else if(isAgentPaused(_0x18be83,!![]))_0x5de1f7=_0xd25a('0x5a');else if(isAgentIdle(_0x18be83))_0x5de1f7='idle';else _0x5de1f7=_0xd25a('0x3e');return _0x5de1f7;}function validateChannel(_0x173594){var _0x30c923=[_0xd25a('0x5b'),_0xd25a('0x5c'),_0xd25a('0x5d'),_0xd25a('0x5e'),_0xd25a('0x5f'),_0xd25a('0x60'),_0xd25a('0x18')];if(!_[_0xd25a('0x61')](_0x30c923,_0x173594[_0xd25a('0x62')]()))throw new Error(_0xd25a('0x63'));return _0x173594[_0xd25a('0x62')]();}function getFilteredAgentIds(_0x107451,_0x58efe3){var _0x49e5bd=_['isArray'](_0x107451)?_0x107451:[_0x107451];var _0x4a5c4e=_[_0xd25a('0x64')](_0x49e5bd,function(_0x7f9ec7){return db[_0x58efe3][_0xd25a('0x65')]({'where':{'name':_0x7f9ec7}})[_0xd25a('0x40')](function(_0x567239){if(!_0x567239)return[];return _0x567239['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0xd25a('0x66')](_0x4a5c4e)[_0xd25a('0x40')](function(_0x472867){var _0x4526ac=_(_0x472867)[_0xd25a('0x67')]()['map']('id')['uniq']()[_0xd25a('0x68')]();return _0x4526ac;});}function getUpdatedSortOptions(_0x59b103){var _0x23c1e8={'fields':[],'order':null};var _0x42772e=_0x59b103[_0xd25a('0x69')](',');_0x23c1e8['fields']=_['filter'](_0x42772e,function(_0x4da35f){if(!_0x4da35f[_0xd25a('0x61')](_0xd25a('0x6a')))return!![];_0x23c1e8[_0xd25a('0x6b')]=_['startsWith'](_0x4da35f,'-')?_0xd25a('0x6c'):'ASC';return![];});return _0x23c1e8;}function orderAgentsByStatus(_0x29941d,_0x40f8b1){return _0x29941d[_0xd25a('0x6d')](function(_0x2b537e,_0x3c9b26){if(_0x2b537e['globalStatus']===_0x3c9b26[_0xd25a('0x6a')]&&_0x2b537e['globalStatus']===_0xd25a('0x59')){if(_0x40f8b1===_0xd25a('0x6c'))return(_0x2b537e[_0xd25a('0x6e')]||'')<(_0x3c9b26[_0xd25a('0x6e')]||'')?0x1:-0x1;return _0x2b537e[_0xd25a('0x6e')]<_0x3c9b26[_0xd25a('0x6e')]?-0x1:0x1;}else{if(_0x40f8b1===_0xd25a('0x6c'))return _0x2b537e[_0xd25a('0x6a')]<_0x3c9b26[_0xd25a('0x6a')]?0x1:-0x1;return _0x2b537e[_0xd25a('0x6a')]<_0x3c9b26[_0xd25a('0x6a')]?-0x1:0x1;}});}exports['getAgents']=function(_0x3b6179,_0x11f626){var _0x5cfff8={'count':0x0,'rows':[]},_0x322980={},_0xff2c29,_0x37428a,_0x1cbc94,_0x3887d3,_0x5bbd26=['userpic',_0xd25a('0x44'),_0xd25a('0x6f'),_0xd25a('0x70'),_0xd25a('0x6e'),_0xd25a('0x70'),_0xd25a('0x3c'),_0xd25a('0x71'),_0xd25a('0x4d'),_0xd25a('0x4f'),_0xd25a('0x4e'),'smsPause','whatsappPause',_0xd25a('0x72'),_0xd25a('0x51'),'chatCapacity','openchannelCapacity',_0xd25a('0x73'),_0xd25a('0x74'),_0xd25a('0x75'),_0xd25a('0x76'),'chatCurrentCapacity',_0xd25a('0x77'),'mailCurrentCapacity',_0xd25a('0x78'),_0xd25a('0x79'),'faxCurrentCapacity',_0xd25a('0x53'),_0xd25a('0x56'),_0xd25a('0x55'),_0xd25a('0x57'),_0xd25a('0x58'),_0xd25a('0x54'),_0xd25a('0x43'),_0xd25a('0x7a'),_0xd25a('0x7b'),_0xd25a('0x7c'),_0xd25a('0x7d'),_0xd25a('0x7e'),'faxStatusTime','voiceStatusTime','queue',_0xd25a('0x7f'),_0xd25a('0x80'),_0xd25a('0x81'),_0xd25a('0x82'),_0xd25a('0x83')],_0x1b0595=[_0xd25a('0x4d'),_0xd25a('0x4f'),_0xd25a('0x4e'),'smsPause',_0xd25a('0x84'),_0xd25a('0x72'),_0xd25a('0x51'),'online'];Promise[_0xd25a('0x85')]()[_0xd25a('0x40')](function(){if(_0x3b6179[_0xd25a('0x86')]['channel'])_0xff2c29=validateChannel(_0x3b6179[_0xd25a('0x86')]['channel']);if(!_0x3b6179['query'][_0xd25a('0x6d')]||!_0x3b6179[_0xd25a('0x86')][_0xd25a('0x6d')][_0xd25a('0x61')](_0xd25a('0x6a')))return;var _0x5b9162=getUpdatedSortOptions(_0x3b6179[_0xd25a('0x86')][_0xd25a('0x6d')]);_0x3b6179['query'][_0xd25a('0x6d')]=_0x5b9162['fields'][_0xd25a('0x87')](',');_0x37428a=_0x5b9162[_0xd25a('0x6b')];})[_0xd25a('0x40')](function(){if(!_0x3b6179[_0xd25a('0x86')][_0xd25a('0x88')])return[];var _0x1a28cf=_['startCase'](_0xff2c29)+_0xd25a('0x46');return getFilteredAgentIds(_0x3b6179[_0xd25a('0x86')]['globalQueueFilter'],_0x1a28cf);})['then'](function(_0x44cdb9){var _0x25bd79=_[_0xd25a('0x64')](db[_0xd25a('0x45')]['rawAttributes'],function(_0x5c25cc){return{'name':_0x5c25cc[_0xd25a('0x89')],'type':_0x5c25cc['type'][_0xd25a('0x8a')]};});_0x3b6179[_0xd25a('0x86')][_0xd25a('0x8b')]=_0xd25a('0x8c');_0x3b6179[_0xd25a('0x86')][_0xd25a('0x44')]=!![];_0x322980=qs[_0xd25a('0x8d')](_0x25bd79,_0x3b6179);_0x322980[_0xd25a('0x8e')]=!![];if(!_[_0xd25a('0x8f')](_0x44cdb9)){_0x322980['where']=_[_0xd25a('0x16')](_0x322980[_0xd25a('0x90')],{'$and':[{'id':{'$in':_0x44cdb9}}]});}else if(!_[_0xd25a('0x8f')](_0x3b6179[_0xd25a('0x86')]['globalQueueFilter'])){return _0x5cfff8;}if(_0x3b6179[_0xd25a('0x91')][_0xd25a('0x8b')]===_0xd25a('0x91')){var _0x59f09b={'params':{'id':_0x3b6179[_0xd25a('0x91')][_0xd25a('0x92')]},'query':{'section':_0xd25a('0x13'),'role':_0xd25a('0x8c'),'online':!![],'nolimit':_0x3b6179[_0xd25a('0x86')][_0xd25a('0x93')],'sort':_0x3b6179[_0xd25a('0x86')][_0xd25a('0x6d')],'filter':_0x3b6179[_0xd25a('0x86')][_0xd25a('0x39')],'raw':!![],'ids':_0x44cdb9}};return db[_0xd25a('0x94')][_0xd25a('0x95')](_0x59f09b);}return db[_0xd25a('0x45')]['findAndCountAll'](_0x322980);})[_0xd25a('0x40')](function(_0x48cae6){_0x5cfff8[_0xd25a('0xa')]=_0x48cae6['count'];_0x1cbc94=_0x48cae6[_0xd25a('0x96')];return getRealtimeAgents();})[_0xd25a('0x40')](function(_0x527af0){_0x3887d3=_0x527af0['rows'];return _0x1cbc94['map'](function(_0x176040){var _0x4242dd=_[_0xd25a('0x37')](_0x3887d3,['id',_0x176040['id']]);if(_0x4242dd)_['merge'](_0x176040,_[_0xd25a('0x38')](_[_0xd25a('0x97')](_0x4242dd,_0x1b0595),_0x5bbd26));_0x176040['globalStatus']=getAgentStatus(_0x176040);return _0x176040;});})[_0xd25a('0x40')](function(_0x5ca6b4){var _0x1d262a;if(_0x3b6179['query']['globalStatusFilter']){_0x1d262a=_[_0xd25a('0x39')](_0x5ca6b4,[_0xd25a('0x6a'),_0x3b6179[_0xd25a('0x86')][_0xd25a('0x98')]]);if(_0x3b6179['query'][_0xd25a('0x99')]){_0x1d262a=_[_0xd25a('0x39')](_0x1d262a,[_0xd25a('0x6e'),_0x3b6179[_0xd25a('0x86')][_0xd25a('0x99')]]);}}if(_0x1d262a)_0x5ca6b4=_0x1d262a;if(!_0x37428a)return _0x5ca6b4;return orderAgentsByStatus(_0x5ca6b4,_0x37428a);})['then'](function(_0x5a97a2){_0x5cfff8[_0xd25a('0x96')]=_0x5a97a2;return _0x5cfff8;})[_0xd25a('0x40')](respondWithFilteredResult(_0x11f626,_0x322980))[_0xd25a('0x17')](handleError(_0x11f626,null));};exports[_0xd25a('0x9a')]=function(_0x1ebff0,_0x1841d8){var _0x5e460e={'count':0x0,'rows':[]},_0x5d44fe={},_0x3a3c99,_0x38e955,_0x2d85dd,_0x570136,_0x9f048c;Promise['resolve']()[_0xd25a('0x40')](function(){if(_0x1ebff0[_0xd25a('0x86')][_0xd25a('0x9b')])_0x3a3c99=validateChannel(_0x1ebff0[_0xd25a('0x86')][_0xd25a('0x9b')]);var _0x34539c=_[_0xd25a('0x19')](_0x3a3c99)+_0xd25a('0x46');var _0x41dbba=_['map'](db[_0x34539c]['rawAttributes'],function(_0x105f71){return{'name':_0x105f71[_0xd25a('0x89')],'type':_0x105f71[_0xd25a('0x9c')]['key']};});_0x5d44fe=qs['getOptions'](_0x41dbba,_0x1ebff0);if(_0x1ebff0['user']['role']===_0xd25a('0x91')){var _0x2e4644={'params':{'id':_0x1ebff0[_0xd25a('0x91')]['userProfileId']},'query':{'section':_0x3a3c99===_0xd25a('0x18')&&_0x1ebff0['query'][_0xd25a('0x9c')]==='outbound'?_0xd25a('0x9d'):_[_0xd25a('0x19')](_0x3a3c99)+_0xd25a('0x1a'),'type':_0x1ebff0[_0xd25a('0x86')][_0xd25a('0x9c')],'nolimit':!![],'sort':_0xd25a('0x10'),'filter':_0x1ebff0['query'][_0xd25a('0x39')]}};return db[_0xd25a('0x94')]['getResources'](_0x2e4644);}return db[_0x34539c][_0xd25a('0x9e')](_0x5d44fe);})[_0xd25a('0x40')](function(_0x35596b){_0x5e460e[_0xd25a('0xa')]=_0x35596b[_0xd25a('0xa')];_0x38e955=_0x35596b[_0xd25a('0x96')];return getRealtimeQueues(_0x1ebff0,_0x3a3c99);})[_0xd25a('0x40')](function(_0x179484){_0x570136=_0x179484[_0xd25a('0x96')];return getRealtimeAgents();})[_0xd25a('0x40')](function(_0x5265f9){_0x2d85dd=_0x5265f9[_0xd25a('0x96')];if(_0x3a3c99!=_0xd25a('0x18'))return;return getRealtimeVoiceQueueChannels();})[_0xd25a('0x40')](function(_0x20e66b){_0x9f048c=_0x20e66b?_0x20e66b[_0xd25a('0x96')]:[];return initializeQueues(_0x38e955,_0x570136,_0x3a3c99,_0x1ebff0[_0xd25a('0x86')][_0xd25a('0x9c')]);})[_0xd25a('0x40')](function(_0x3e039a){var _0x9e380a=_0x3e039a[_0xd25a('0x64')](function(_0x229980){if(_0x3a3c99===_0xd25a('0x18'))return getVoiceQueueAgents(_0x229980,_0x38e955,_0x2d85dd,_0x9f048c);else return getQueueAgents(_0x229980,_0x2d85dd,_0x3a3c99);});return Promise[_0xd25a('0x66')](_0x9e380a);})['then'](function(_0x982631){_0x5e460e['rows']=_0x982631;return _0x5e460e;})['then'](respondWithFilteredResult(_0x1841d8,_0x5d44fe))['catch'](handleError(_0x1841d8,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index be99a3a..e03e2f8 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5ede0d,_0x2c7ecd){var _0x1fd027=function(_0x107a44){while(--_0x107a44){_0x5ede0d['push'](_0x5ede0d['shift']());}};_0x1fd027(++_0x2c7ecd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xcf4569,_0x1ce755){_0xcf4569=_0xcf4569-0x0;var _0x7fef=_0xcb91[_0xcf4569];return _0x7fef;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3d732a,_0x3d5f64){var _0x2ec998=function(_0x371aa9){while(--_0x371aa9){_0x3d732a['push'](_0x3d732a['shift']());}};_0x2ec998(++_0x3d5f64);}(_0x70e0,0x17b));var _0x070e=function(_0x2ac7af,_0x2084a8){_0x2ac7af=_0x2ac7af-0x0;var _0x2b98fa=_0x70e0[_0x2ac7af];return _0x2b98fa;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 890223d..a122a6c 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 _0xa0a1=['INTEGER','STRING','DATE','sequelize'];(function(_0x5ea451,_0x133637){var _0x37a06a=function(_0x6fb5bf){while(--_0x6fb5bf){_0x5ea451['push'](_0x5ea451['shift']());}};_0x37a06a(++_0x133637);}(_0xa0a1,0x15b));var _0x1a0a=function(_0x8f20f9,_0x23b1f7){_0x8f20f9=_0x8f20f9-0x0;var _0x3052db=_0xa0a1[_0x8f20f9];return _0x3052db;};'use strict';var Sequelize=require(_0x1a0a('0x0'));module['exports']={'state':{'type':Sequelize[_0x1a0a('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x1a0a('0x2')]},'scheduledat':{'type':Sequelize[_0x1a0a('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x1a0a('0x3')]},'ringtime':{'type':Sequelize[_0x1a0a('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x1a0a('0x2')]},'membername':{'type':Sequelize[_0x1a0a('0x2')]}}; \ No newline at end of file +var _0xc03e=['DATE','INTEGER','sequelize','STRING'];(function(_0x2e6fd6,_0x12be71){var _0x434981=function(_0x8c62cf){while(--_0x8c62cf){_0x2e6fd6['push'](_0x2e6fd6['shift']());}};_0x434981(++_0x12be71);}(_0xc03e,0x15a));var _0xec03=function(_0x8d8917,_0x504e20){_0x8d8917=_0x8d8917-0x0;var _0x55bd93=_0xc03e[_0x8d8917];return _0x55bd93;};'use strict';var Sequelize=require(_0xec03('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xec03('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xec03('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xec03('0x2')]},'ringtime':{'type':Sequelize[_0xec03('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xec03('0x1')]},'campaigntype':{'type':Sequelize[_0xec03('0x1')]},'membername':{'type':Sequelize[_0xec03('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index bc68d8b..a485991 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 _0x1b2f=['bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','api'];(function(_0x15de48,_0x526d68){var _0xf1d056=function(_0x269f38){while(--_0x269f38){_0x15de48['push'](_0x15de48['shift']());}};_0xf1d056(++_0x526d68);}(_0x1b2f,0x19d));var _0xf1b2=function(_0x4c23fa,_0x28b4ff){_0x4c23fa=_0x4c23fa-0x0;var _0x4227b4=_0x1b2f[_0x4c23fa];return _0x4227b4;};'use strict';var _=require(_0xf1b2('0x0'));var util=require(_0xf1b2('0x1'));var logger=require('../../config/logger')(_0xf1b2('0x2'));var moment=require('moment');var BPromise=require(_0xf1b2('0x3'));var rp=require(_0xf1b2('0x4'));var fs=require('fs');var path=require(_0xf1b2('0x5'));var rimraf=require(_0xf1b2('0x6'));var config=require(_0xf1b2('0x7'));var attributes=require(_0xf1b2('0x8'));module[_0xf1b2('0x9')]=function(_0x4a98a5,_0x1ff388){return _0x4a98a5[_0xf1b2('0xa')](_0xf1b2('0xb'),attributes,{'tableName':_0xf1b2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x341c=['exports','define','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x439f48,_0x457357){var _0x10679f=function(_0x19f3a6){while(--_0x19f3a6){_0x439f48['push'](_0x439f48['shift']());}};_0x10679f(++_0x457357);}(_0x341c,0x12f));var _0xc341=function(_0x5b2096,_0x213141){_0x5b2096=_0x5b2096-0x0;var _0x198357=_0x341c[_0x5b2096];return _0x198357;};'use strict';var _=require(_0xc341('0x0'));var util=require(_0xc341('0x1'));var logger=require(_0xc341('0x2'))(_0xc341('0x3'));var moment=require(_0xc341('0x4'));var BPromise=require(_0xc341('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc341('0x6'));var config=require(_0xc341('0x7'));var attributes=require(_0xc341('0x8'));module[_0xc341('0x9')]=function(_0x3ec203,_0x5b5912){return _0x3ec203[_0xc341('0xa')]('ReportAgentPreview',attributes,{'tableName':_0xc341('0xb'),'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 42c2297..9a375b3 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 _0xeeba=['request','info','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','then','debug','lodash','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0xeeba,0x18c));var _0xaeeb=function(_0x10d4ed,_0x473d69){_0x10d4ed=_0x10d4ed-0x0;var _0x3ff18b=_0xeeba[_0x10d4ed];return _0x3ff18b;};'use strict';var _=require(_0xaeeb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaeeb('0x1'));var rs=require(_0xaeeb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaeeb('0x3'))(_0xaeeb('0x4'));var config=require(_0xaeeb('0x5'));var jayson=require(_0xaeeb('0x6'));var client=jayson[_0xaeeb('0x7')][_0xaeeb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x19c573,_0x396430,_0x2e3c0a){return new BPromise(function(_0x4c22c9,_0x4fd6a2){return client[_0xaeeb('0x9')](_0x19c573,_0x2e3c0a)['then'](function(_0x177084){logger[_0xaeeb('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x396430,_0xaeeb('0xb'));logger['debug'](_0xaeeb('0xc'),_0x396430,_0xaeeb('0xb'),JSON[_0xaeeb('0xd')](_0x177084));if(_0x177084['error']){if(_0x177084[_0xaeeb('0xe')][_0xaeeb('0xf')]===0x1f4){logger['error'](_0xaeeb('0x10'),_0x396430,_0x177084[_0xaeeb('0xe')]['message']);return _0x4fd6a2(_0x177084[_0xaeeb('0xe')]['message']);}logger['error'](_0xaeeb('0x10'),_0x396430,_0x177084[_0xaeeb('0xe')][_0xaeeb('0x11')]);return _0x4c22c9(_0x177084[_0xaeeb('0xe')][_0xaeeb('0x11')]);}else{logger[_0xaeeb('0xa')](_0xaeeb('0x10'),_0x396430,_0xaeeb('0xb'));_0x4c22c9(_0x177084[_0xaeeb('0x12')][_0xaeeb('0x11')]);}})[_0xaeeb('0x13')](function(_0x2733af){logger['error'](_0xaeeb('0x10'),_0x396430,_0x2733af);_0x4fd6a2(_0x2733af);});});}exports[_0xaeeb('0x14')]=function(_0x5d5daf){var _0x1f09c4=this;return new Promise(function(_0x4c8a40,_0x46773c){return db[_0xaeeb('0x15')][_0xaeeb('0x16')](_0x5d5daf[_0xaeeb('0x17')],{'raw':_0x5d5daf[_0xaeeb('0x18')]?_0x5d5daf['options']['raw']===undefined?!![]:![]:!![]})[_0xaeeb('0x19')](function(_0x5cce38){logger[_0xaeeb('0xa')](_0xaeeb('0x14'),_0x5d5daf);logger[_0xaeeb('0x1a')](_0xaeeb('0x14'),_0x5d5daf,JSON[_0xaeeb('0xd')](_0x5cce38));_0x4c8a40(_0x5cce38);})[_0xaeeb('0x13')](function(_0x17ad7d){logger[_0xaeeb('0xe')](_0xaeeb('0x14'),_0x17ad7d[_0xaeeb('0x11')],_0x5d5daf);_0x46773c(_0x1f09c4[_0xaeeb('0xe')](0x1f4,_0x17ad7d['message']));});});}; \ No newline at end of file +var _0x2234=['catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','result','message'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2234,0x16e));var _0x4223=function(_0x28cbc0,_0x203516){_0x28cbc0=_0x28cbc0-0x0;var _0x4b3cf5=_0x2234[_0x28cbc0];return _0x4b3cf5;};'use strict';var _=require(_0x4223('0x0'));var util=require(_0x4223('0x1'));var moment=require(_0x4223('0x2'));var BPromise=require(_0x4223('0x3'));var rs=require(_0x4223('0x4'));var fs=require('fs');var Redis=require(_0x4223('0x5'));var db=require(_0x4223('0x6'))['db'];var utils=require(_0x4223('0x7'));var logger=require(_0x4223('0x8'))(_0x4223('0x9'));var config=require('../../config/environment');var jayson=require(_0x4223('0xa'));var client=jayson['client'][_0x4223('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f1a2,_0x8ea996,_0x4e8325){return new BPromise(function(_0x5ec1b3,_0x55e81d){return client[_0x4223('0xc')](_0x4f1a2,_0x4e8325)[_0x4223('0xd')](function(_0xa8f28b){logger[_0x4223('0xe')](_0x4223('0xf'),_0x8ea996,'request\x20sent');logger[_0x4223('0x10')](_0x4223('0x11'),_0x8ea996,_0x4223('0x12'),JSON[_0x4223('0x13')](_0xa8f28b));if(_0xa8f28b[_0x4223('0x14')]){if(_0xa8f28b[_0x4223('0x14')][_0x4223('0x15')]===0x1f4){logger[_0x4223('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x8ea996,_0xa8f28b[_0x4223('0x14')]['message']);return _0x55e81d(_0xa8f28b[_0x4223('0x14')]['message']);}logger[_0x4223('0x14')](_0x4223('0xf'),_0x8ea996,_0xa8f28b[_0x4223('0x14')]['message']);return _0x5ec1b3(_0xa8f28b['error']['message']);}else{logger[_0x4223('0xe')](_0x4223('0xf'),_0x8ea996,_0x4223('0x12'));_0x5ec1b3(_0xa8f28b[_0x4223('0x16')][_0x4223('0x17')]);}})[_0x4223('0x18')](function(_0x28219c){logger[_0x4223('0x14')](_0x4223('0xf'),_0x8ea996,_0x28219c);_0x55e81d(_0x28219c);});});}exports[_0x4223('0x19')]=function(_0x39ba27){var _0x42116c=this;return new Promise(function(_0xe9f6f8,_0x1f00df){return db[_0x4223('0x1a')]['create'](_0x39ba27[_0x4223('0x1b')],{'raw':_0x39ba27['options']?_0x39ba27[_0x4223('0x1c')][_0x4223('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x3dd65){logger[_0x4223('0xe')](_0x4223('0x19'),_0x39ba27);logger[_0x4223('0x10')]('CreateReportAgentPreview',_0x39ba27,JSON[_0x4223('0x13')](_0x3dd65));_0xe9f6f8(_0x3dd65);})[_0x4223('0x18')](function(_0x4e62de){logger['error'](_0x4223('0x19'),_0x4e62de[_0x4223('0x17')],_0x39ba27);_0x1f00df(_0x42116c[_0x4223('0x14')](0x1f4,_0x4e62de[_0x4223('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index bd5a6d6..252cf77 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 _0xe45c=['/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','/campaigns','/fax/accounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions'];(function(_0x59e444,_0x2ff6cd){var _0x4924fb=function(_0x1e97f8){while(--_0x1e97f8){_0x59e444['push'](_0x59e444['shift']());}};_0x4924fb(++_0x2ff6cd);}(_0xe45c,0x6d));var _0xce45=function(_0x132468,_0x129f26){_0x132468=_0x132468-0x0;var _0x20cc95=_0xe45c[_0x132468];return _0x20cc95;};'use strict';var multer=require(_0xce45('0x0'));var util=require(_0xce45('0x1'));var path=require('path');var express=require(_0xce45('0x2'));var router=express[_0xce45('0x3')]();var auth=require(_0xce45('0x4'));var controller=require(_0xce45('0x5'));router[_0xce45('0x6')](_0xce45('0x7'),auth[_0xce45('0x8')](),controller[_0xce45('0x9')]);router[_0xce45('0x6')](_0xce45('0xa'),auth['isAuthenticated'](),controller[_0xce45('0xb')]);router[_0xce45('0x6')](_0xce45('0xc'),auth[_0xce45('0x8')](),controller[_0xce45('0xd')]);router[_0xce45('0x6')](_0xce45('0xe'),auth[_0xce45('0x8')](),controller[_0xce45('0xf')]);router['get'](_0xce45('0x10'),auth['isAuthenticated'](),controller[_0xce45('0x11')]);router['get'](_0xce45('0x12'),auth[_0xce45('0x8')](),controller[_0xce45('0x13')]);router[_0xce45('0x6')]('/mail/accounts',auth[_0xce45('0x8')](),controller[_0xce45('0x14')]);router[_0xce45('0x6')]('/openchannel/queues',auth[_0xce45('0x8')](),controller['openchannelQueues']);router['get'](_0xce45('0x15'),auth[_0xce45('0x8')](),controller[_0xce45('0x16')]);router[_0xce45('0x6')](_0xce45('0x17'),auth[_0xce45('0x8')](),controller['whatsappQueues']);router[_0xce45('0x6')](_0xce45('0x18'),auth[_0xce45('0x8')](),controller[_0xce45('0x19')]);router['get'](_0xce45('0x1a'),auth['isAuthenticated'](),controller[_0xce45('0x1b')]);router[_0xce45('0x6')](_0xce45('0x1c'),auth['isAuthenticated'](),controller[_0xce45('0x1d')]);router[_0xce45('0x6')](_0xce45('0x1e'),auth[_0xce45('0x8')](),controller['voiceQueuesChannel']);router[_0xce45('0x6')](_0xce45('0x1f'),auth[_0xce45('0x8')](),controller['voiceQueuesChannelHangup']);router[_0xce45('0x6')](_0xce45('0x20'),auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router['get']('/voice/queues/:id',auth[_0xce45('0x8')](),controller[_0xce45('0x21')]);router[_0xce45('0x22')](_0xce45('0x23'),auth[_0xce45('0x8')](),controller[_0xce45('0x24')]);router[_0xce45('0x6')](_0xce45('0x25'),auth['isAuthenticated'](),controller[_0xce45('0x26')]);router[_0xce45('0x6')](_0xce45('0x27'),auth[_0xce45('0x8')](),controller[_0xce45('0x28')]);router['get'](_0xce45('0x29'),auth[_0xce45('0x8')](),controller['agents']);router[_0xce45('0x22')](_0xce45('0x2a'),auth[_0xce45('0x8')](),controller[_0xce45('0x2b')]);router[_0xce45('0x6')](_0xce45('0x2c'),auth[_0xce45('0x8')](),controller[_0xce45('0x2d')]);router[_0xce45('0x6')](_0xce45('0x2e'),auth['isAuthenticated'](),controller['trunks']);router[_0xce45('0x6')](_0xce45('0x2f'),auth['isAuthenticated'](),controller['campaigns']);router[_0xce45('0x6')](_0xce45('0x30'),auth[_0xce45('0x8')](),controller['faxAccounts']);router[_0xce45('0x6')]('/chat/queues/waitinginteractions',auth[_0xce45('0x8')](),controller[_0xce45('0x31')]);router[_0xce45('0x6')](_0xce45('0x32'),auth[_0xce45('0x8')](),controller[_0xce45('0x33')]);router[_0xce45('0x6')](_0xce45('0x34'),auth['isAuthenticated'](),controller[_0xce45('0x35')]);router[_0xce45('0x6')](_0xce45('0x36'),auth[_0xce45('0x8')](),controller['openchannelQueuesIdWaitingInteractions']);router['get'](_0xce45('0x37'),auth[_0xce45('0x8')](),controller[_0xce45('0x38')]);router['get'](_0xce45('0x39'),auth[_0xce45('0x8')](),controller['whatsappQueuesWaitingInteractions']);router['get'](_0xce45('0x3a'),auth[_0xce45('0x8')](),controller[_0xce45('0x3b')]);router[_0xce45('0x3c')](_0xce45('0x3d'),auth['isAuthenticated'](),controller[_0xce45('0x3e')](_0xce45('0x3f')));router['get'](_0xce45('0x40'),auth[_0xce45('0x8')](),controller[_0xce45('0x41')]);router[_0xce45('0x3c')](_0xce45('0x42'),auth[_0xce45('0x8')](),controller[_0xce45('0x3e')](_0xce45('0x43')));router[_0xce45('0x6')](_0xce45('0x44'),auth[_0xce45('0x8')](),controller[_0xce45('0x45')]);router[_0xce45('0x3c')](_0xce45('0x46'),auth['isAuthenticated'](),controller['queueNotify']('fax'));router[_0xce45('0x6')](_0xce45('0x47'),auth[_0xce45('0x8')](),controller['showFaxQueues']);router[_0xce45('0x3c')](_0xce45('0x48'),auth[_0xce45('0x8')](),controller[_0xce45('0x3e')](_0xce45('0x49')));router[_0xce45('0x6')](_0xce45('0x4a'),auth[_0xce45('0x8')](),controller[_0xce45('0x4b')]);router[_0xce45('0x3c')](_0xce45('0x4c'),auth[_0xce45('0x8')](),controller[_0xce45('0x3e')]('sms'));router[_0xce45('0x3c')](_0xce45('0x4d'),auth[_0xce45('0x8')](),controller[_0xce45('0x3e')](_0xce45('0x4e')));router[_0xce45('0x6')](_0xce45('0x4f'),auth['isAuthenticated'](),controller[_0xce45('0x50')]);router[_0xce45('0x6')]('/whatsapp/queues/:id',auth[_0xce45('0x8')](),controller[_0xce45('0x51')]);router['post']('/agents/:id/notify',auth['isAuthenticated'](),controller['agentNotify']);module[_0xce45('0x52')]=router; \ No newline at end of file +var _0x3337=['mailQueues','/mail/accounts','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','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','showVoiceQueues','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','outboundChannels','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','post','/fax/queues/:id/notify','fax','/fax/queues/:id','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','util','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceQueues','/chat/queues','/mail/queues'];(function(_0x4a1eb5,_0x2d534a){var _0x3a23e8=function(_0x41089f){while(--_0x41089f){_0x4a1eb5['push'](_0x4a1eb5['shift']());}};_0x3a23e8(++_0x2d534a);}(_0x3337,0xe8));var _0x7333=function(_0x25d5e9,_0x340fda){_0x25d5e9=_0x25d5e9-0x0;var _0xa351e2=_0x3337[_0x25d5e9];return _0xa351e2;};'use strict';var multer=require('multer');var util=require(_0x7333('0x0'));var path=require(_0x7333('0x1'));var express=require(_0x7333('0x2'));var router=express[_0x7333('0x3')]();var auth=require(_0x7333('0x4'));var controller=require(_0x7333('0x5'));router[_0x7333('0x6')]('/voice/channels',auth[_0x7333('0x7')](),controller['voiceChannels']);router[_0x7333('0x6')](_0x7333('0x8'),auth[_0x7333('0x7')](),controller[_0x7333('0x9')]);router[_0x7333('0x6')](_0x7333('0xa'),auth[_0x7333('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0x7333('0x6')]('/voice/queues',auth[_0x7333('0x7')](),controller[_0x7333('0xb')]);router['get'](_0x7333('0xc'),auth['isAuthenticated'](),controller['chatQueues']);router['get'](_0x7333('0xd'),auth['isAuthenticated'](),controller[_0x7333('0xe')]);router[_0x7333('0x6')](_0x7333('0xf'),auth[_0x7333('0x7')](),controller[_0x7333('0x10')]);router[_0x7333('0x6')](_0x7333('0x11'),auth[_0x7333('0x7')](),controller[_0x7333('0x12')]);router[_0x7333('0x6')](_0x7333('0x13'),auth[_0x7333('0x7')](),controller[_0x7333('0x14')]);router['get'](_0x7333('0x15'),auth[_0x7333('0x7')](),controller[_0x7333('0x16')]);router[_0x7333('0x6')](_0x7333('0x17'),auth[_0x7333('0x7')](),controller['faxQueues']);router[_0x7333('0x6')](_0x7333('0x18'),auth[_0x7333('0x7')](),controller[_0x7333('0x19')]);router[_0x7333('0x6')](_0x7333('0x1a'),auth[_0x7333('0x7')](),controller[_0x7333('0x1b')]);router[_0x7333('0x6')](_0x7333('0x1c'),auth[_0x7333('0x7')](),controller[_0x7333('0x1d')]);router[_0x7333('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x7333('0x7')](),controller[_0x7333('0x1e')]);router[_0x7333('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth['isAuthenticated'](),controller[_0x7333('0x1f')]);router[_0x7333('0x6')]('/voice/queues/:id',auth[_0x7333('0x7')](),controller[_0x7333('0x20')]);router['put'](_0x7333('0x21'),auth[_0x7333('0x7')](),controller[_0x7333('0x22')]);router[_0x7333('0x6')](_0x7333('0x23'),auth['isAuthenticated'](),controller[_0x7333('0x24')]);router[_0x7333('0x6')]('/outbound/channels',auth[_0x7333('0x7')](),controller[_0x7333('0x25')]);router['get']('/agents',auth['isAuthenticated'](),controller[_0x7333('0x26')]);router[_0x7333('0x27')](_0x7333('0x28'),auth[_0x7333('0x7')](),controller[_0x7333('0x29')]);router[_0x7333('0x6')](_0x7333('0x2a'),auth[_0x7333('0x7')](),controller[_0x7333('0x2b')]);router[_0x7333('0x6')](_0x7333('0x2c'),auth[_0x7333('0x7')](),controller[_0x7333('0x2d')]);router[_0x7333('0x6')](_0x7333('0x2e'),auth[_0x7333('0x7')](),controller['campaigns']);router['get'](_0x7333('0x2f'),auth[_0x7333('0x7')](),controller[_0x7333('0x30')]);router[_0x7333('0x6')](_0x7333('0x31'),auth[_0x7333('0x7')](),controller[_0x7333('0x32')]);router[_0x7333('0x6')](_0x7333('0x33'),auth[_0x7333('0x7')](),controller[_0x7333('0x34')]);router['get'](_0x7333('0x35'),auth[_0x7333('0x7')](),controller['openchannelQueuesWaitingInteractions']);router[_0x7333('0x6')](_0x7333('0x36'),auth[_0x7333('0x7')](),controller[_0x7333('0x37')]);router['get']('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x7333('0x38')]);router[_0x7333('0x6')](_0x7333('0x39'),auth[_0x7333('0x7')](),controller['whatsappQueuesWaitingInteractions']);router[_0x7333('0x6')]('/fax/queues/waitinginteractions',auth[_0x7333('0x7')](),controller['faxQueuesWaitingInteractions']);router['post'](_0x7333('0x3a'),auth[_0x7333('0x7')](),controller[_0x7333('0x3b')](_0x7333('0x3c')));router['get'](_0x7333('0x3d'),auth[_0x7333('0x7')](),controller[_0x7333('0x3e')]);router['post'](_0x7333('0x3f'),auth['isAuthenticated'](),controller[_0x7333('0x3b')](_0x7333('0x40')));router[_0x7333('0x6')](_0x7333('0x41'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0x7333('0x42')](_0x7333('0x43'),auth[_0x7333('0x7')](),controller[_0x7333('0x3b')](_0x7333('0x44')));router[_0x7333('0x6')](_0x7333('0x45'),auth[_0x7333('0x7')](),controller['showFaxQueues']);router[_0x7333('0x42')]('/openchannel/queues/:id/notify',auth[_0x7333('0x7')](),controller[_0x7333('0x3b')](_0x7333('0x46')));router[_0x7333('0x6')]('/openchannel/queues/:id',auth[_0x7333('0x7')](),controller[_0x7333('0x47')]);router[_0x7333('0x42')](_0x7333('0x48'),auth[_0x7333('0x7')](),controller[_0x7333('0x3b')](_0x7333('0x49')));router[_0x7333('0x42')](_0x7333('0x4a'),auth[_0x7333('0x7')](),controller[_0x7333('0x3b')](_0x7333('0x4b')));router[_0x7333('0x6')](_0x7333('0x4c'),auth[_0x7333('0x7')](),controller[_0x7333('0x4d')]);router[_0x7333('0x6')](_0x7333('0x4e'),auth[_0x7333('0x7')](),controller[_0x7333('0x4f')]);router[_0x7333('0x42')](_0x7333('0x50'),auth[_0x7333('0x7')](),controller[_0x7333('0x51')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 7e216ef..e9b09e7 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 _0x425d=['http','request','then','error','code','message','result','catch','status','sendStatus','stack','name','isNil','rows','find','query','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','length','format','updateAttributes','findOrCreate','INTERACTION','interface','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','Telephones','trunks','campaigns','Campaigns','ChatQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','TransferReport','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','update','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client'];(function(_0xef8861,_0x103cdc){var _0x23910d=function(_0x5a0459){while(--_0x5a0459){_0xef8861['push'](_0xef8861['shift']());}};_0x23910d(++_0x103cdc);}(_0x425d,0x1e0));var _0xd425=function(_0x500d82,_0x1d3db0){_0x500d82=_0x500d82-0x0;var _0x371a97=_0x425d[_0x500d82];return _0x371a97;};'use strict';var BPromise=require(_0xd425('0x0'));var moment=require('moment');var _=require(_0xd425('0x1'));var util=require(_0xd425('0x2'));var db=require(_0xd425('0x3'))['db'];var logger=require(_0xd425('0x4'))(_0xd425('0x5'));var jayson=require(_0xd425('0x6'));var amiClient=jayson[_0xd425('0x7')]['http']({'port':0x232a});var mailClient=jayson[_0xd425('0x7')][_0xd425('0x8')]({'port':0x232b});var routingClient=jayson[_0xd425('0x7')][_0xd425('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x1d97d9,_0x1d2ed0,_0x50b061){return new BPromise(function(_0xb6ba8e,_0x374c3d){var _0x262b02=_0x50b061?_0x50b061:amiClient;return _0x262b02[_0xd425('0x9')](_0x1d97d9,_0x1d2ed0)[_0xd425('0xa')](function(_0x2beb20){if(_0x2beb20[_0xd425('0xb')]){if(_0x2beb20[_0xd425('0xb')][_0xd425('0xc')]===0x1f4){return _0x374c3d(_0x2beb20[_0xd425('0xb')][_0xd425('0xd')]);}return _0xb6ba8e(_0x2beb20[_0xd425('0xb')][_0xd425('0xd')]);}else{_0xb6ba8e(_0x2beb20[_0xd425('0xe')]);}})[_0xd425('0xf')](function(_0x2385a5){_0x374c3d(_0x2385a5);});});}function respondWithResult(_0x9bb611,_0x3cacf7){_0x3cacf7=_0x3cacf7||0xc8;return function(_0x3b5de8){if(_0x3b5de8){return _0x9bb611[_0xd425('0x10')](_0x3cacf7)['json'](_0x3b5de8);}return _0x9bb611[_0xd425('0x11')](0x194);};}function handleError(_0x17a498,_0x336dc3){_0x336dc3=_0x336dc3||0x1f4;return function(_0x5d3d60){logger[_0xd425('0xb')](_0x5d3d60[_0xd425('0x12')]);if(_0x5d3d60[_0xd425('0x13')]){delete _0x5d3d60[_0xd425('0x13')];}_0x17a498[_0xd425('0x10')](_0x336dc3)['send'](_0x5d3d60);};}function findById(_0x278626){return function(_0x471267){if(!_[_0xd425('0x14')](_0x278626)&&!_[_0xd425('0x14')](_0x471267)&&!_['isNil'](_0x471267[_0xd425('0x15')])){return _[_0xd425('0x16')](_0x471267[_0xd425('0x15')],function(_0x1155bc){return _0x1155bc['id']==_0x278626;});}return null;};}exports['voiceChannels']=function(_0x58a0c1,_0x5debc3){return respondWithRpcPromise('VoiceChannels',_0x58a0c1[_0xd425('0x17')])[_0xd425('0xa')](respondWithResult(_0x5debc3,null))[_0xd425('0xf')](handleError(_0x5debc3,null));};exports['voiceChannelMixMonitor']=function(_0x355af0,_0x7e982e){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xd425('0x18')](_0x355af0[_0xd425('0x17')],_0x355af0[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x7e982e,null))[_0xd425('0xf')](handleError(_0x7e982e,null));};exports[_0xd425('0x1a')]=function(_0x2480a0,_0x3500bb){return respondWithRpcPromise(_0xd425('0x1b'),_[_0xd425('0x18')](_0x2480a0[_0xd425('0x17')],_0x2480a0[_0xd425('0x19')]))['then'](respondWithResult(_0x3500bb,null))[_0xd425('0xf')](handleError(_0x3500bb,null));};exports[_0xd425('0x1c')]=function(_0x398985,_0x1908a5){return respondWithRpcPromise(_0xd425('0x1d'),_0x398985[_0xd425('0x17')])[_0xd425('0xa')](respondWithResult(_0x1908a5,null))['catch'](handleError(_0x1908a5,null));};exports[_0xd425('0x1e')]=function(_0x177de2,_0x1d8861){return respondWithRpcPromise('VoiceQueues',_0x177de2[_0xd425('0x17')])[_0xd425('0xa')](findById(_0x177de2[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x1d8861,null))[_0xd425('0xf')](handleError(_0x1d8861,null));};exports[_0xd425('0x1f')]=function(_0x2fd17a,_0x37b63c){return respondWithRpcPromise(_0xd425('0x20'),_[_0xd425('0x18')](_0x2fd17a['body'],_0x2fd17a[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x37b63c,null))[_0xd425('0xf')](handleError(_0x37b63c,null));};exports[_0xd425('0x21')]=function(_0x3275b1,_0x1abf33){return respondWithRpcPromise(_0xd425('0x22'),_[_0xd425('0x18')](_0x3275b1[_0xd425('0x17')],_0x3275b1[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x1abf33,null))['catch'](handleError(_0x1abf33,null));};exports[_0xd425('0x23')]=function(_0x2a2a9b,_0x3120a4){return respondWithRpcPromise(_0xd425('0x24'),_0x2a2a9b[_0xd425('0x17')])['then'](respondWithResult(_0x3120a4,null))[_0xd425('0xf')](handleError(_0x3120a4,null));};exports[_0xd425('0x25')]=function(_0x4cfcd1,_0x574962){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xd425('0x18')](_0x4cfcd1[_0xd425('0x17')],_0x4cfcd1[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x574962,null))['catch'](handleError(_0x574962,null));};exports[_0xd425('0x26')]=function(_0x1d4414,_0x30a9dc){return respondWithRpcPromise(_0xd425('0x27'),_[_0xd425('0x18')](_0x1d4414[_0xd425('0x17')],_0x1d4414[_0xd425('0x19')]))['then'](respondWithResult(_0x30a9dc,null))[_0xd425('0xf')](handleError(_0x30a9dc,null));};exports['voiceQueuesChannelRedirect']=function(_0x22df81,_0x29cca9){return respondWithRpcPromise(_0xd425('0x28'),_['merge'](_0x22df81[_0xd425('0x17')],_0x22df81[_0xd425('0x19')]))[_0xd425('0xa')](respondWithResult(_0x29cca9,null))[_0xd425('0xf')](handleError(_0x29cca9,null));};exports['outbound']=function(_0x1d38fa,_0x3cf540){return respondWithRpcPromise('Outbound',_0x1d38fa['query'])['then'](respondWithResult(_0x3cf540,null))[_0xd425('0xf')](handleError(_0x3cf540,null));};exports[_0xd425('0x29')]=function(_0x1f30c1,_0x588688){return respondWithRpcPromise('OutboundChannels',_0x1f30c1['query'])[_0xd425('0xa')](respondWithResult(_0x588688,null))[_0xd425('0xf')](handleError(_0x588688,null));};exports[_0xd425('0x2a')]=function(_0x1d5017,_0xa9fd7c){var _0x14f3be;return respondWithRpcPromise(_0xd425('0x2b'),_0x1d5017['query'])[_0xd425('0xa')](function(_0x3c88a8){_0x14f3be=_0x3c88a8;return respondWithRpcPromise(_0xd425('0x2b'),_0x1d5017['query'],routingClient);})[_0xd425('0xa')](function(_0x2dffc7){return _[_0xd425('0x18')]({},_0x2dffc7,_0x14f3be);})['then'](respondWithResult(_0xa9fd7c,null))[_0xd425('0xf')](handleError(_0xa9fd7c,null));};exports[_0xd425('0x2c')]=function(_0x1c5ba6,_0x2d7a2f){if(_0x1c5ba6['body']&&_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')]&&_0x1c5ba6[_0xd425('0x2f')]&&_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x13')]){for(var _0x2f6bf7 in _0x1c5ba6[_0xd425('0x2d')]['interaction']){if(_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')]['hasOwnProperty'](_0x2f6bf7)){db[_0xd425('0x30')]['findAll']({'where':{'channel':_0x2f6bf7,'membername':_0x1c5ba6['user'][_0xd425('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1c5ba6[_0xd425('0x2d')]['interaction'][_0x2f6bf7]&&_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')][_0x2f6bf7][_0xd425('0x31')]?{'$notIn':_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')][_0x2f6bf7]}:{'$ne':null}}})['then'](function(_0x2e4b21){var _0x5f3cfd=moment()[_0xd425('0x32')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x78ed9b=0x0,_0x16f61c=_0x2e4b21[_0xd425('0x31')];_0x78ed9b<_0x16f61c;_0x78ed9b+=0x1){_0x2e4b21[_0x78ed9b][_0xd425('0x33')]({'exitAt':_0x5f3cfd});}});for(var _0x624543=0x0;_0x624543<_0x1c5ba6['body'][_0xd425('0x2e')][_0x2f6bf7][_0xd425('0x31')];_0x624543+=0x1){db[_0xd425('0x30')][_0xd425('0x34')]({'where':{'channel':_0x2f6bf7,'membername':_0x1c5ba6[_0xd425('0x2f')]['name'],'type':_0xd425('0x35'),'uniqueid':_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x2e')][_0x2f6bf7][_0x624543],'exitAt':null},'defaults':{'channel':_0x2f6bf7,'membername':_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x13')],'interface':_[_0xd425('0x14')](_0x1c5ba6['user'][_0xd425('0x36')])?util[_0xd425('0x32')]('SIP/%s',_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x13')]):_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x36')],'type':'INTERACTION','enterAt':moment()[_0xd425('0x32')](_0xd425('0x37')),'role':_0xd425('0x38'),'internal':_0x1c5ba6[_0xd425('0x2f')][_0xd425('0x39')],'uniqueid':_0x1c5ba6['body']['interaction'][_0x2f6bf7][_0x624543]}});}}}}return respondWithRpcPromise(_0xd425('0x3a'),{'id':_0x1c5ba6['params']['id'],'capacity':_0x1c5ba6[_0xd425('0x2d')][_0xd425('0x3b')]},routingClient)['then'](respondWithResult(_0x2d7a2f,null))[_0xd425('0xf')](handleError(_0x2d7a2f,null));};exports['telephones']=function(_0x48d5b8,_0x39f588){return respondWithRpcPromise(_0xd425('0x3c'),_0x48d5b8[_0xd425('0x17')])[_0xd425('0xa')](respondWithResult(_0x39f588,null))[_0xd425('0xf')](handleError(_0x39f588,null));};exports[_0xd425('0x3d')]=function(_0xeb3586,_0x4118fe){return respondWithRpcPromise('Trunks',_0xeb3586[_0xd425('0x17')])[_0xd425('0xa')](respondWithResult(_0x4118fe,null))[_0xd425('0xf')](handleError(_0x4118fe,null));};exports[_0xd425('0x3e')]=function(_0x7b1080,_0x1c80c2){return respondWithRpcPromise(_0xd425('0x3f'),_0x7b1080[_0xd425('0x17')])['then'](respondWithResult(_0x1c80c2,null))['catch'](handleError(_0x1c80c2,null));};exports['chatQueues']=function(_0x145e76,_0x2c5d01){return respondWithRpcPromise(_0xd425('0x40'),_0x145e76[_0xd425('0x17')],routingClient)['then'](respondWithResult(_0x2c5d01,null))['catch'](handleError(_0x2c5d01,null));};exports['showChatQueues']=function(_0x5e1294,_0x254b8b){return respondWithRpcPromise(_0xd425('0x40'),_0x5e1294['query'],routingClient)[_0xd425('0xa')](findById(_0x5e1294[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x254b8b,null))['catch'](handleError(_0x254b8b,null));};exports['mailQueues']=function(_0x599cb5,_0x49d75e){return respondWithRpcPromise('MailQueues',_0x599cb5['query'],routingClient)[_0xd425('0xa')](respondWithResult(_0x49d75e,null))[_0xd425('0xf')](handleError(_0x49d75e,null));};exports[_0xd425('0x41')]=function(_0x5b2323,_0x3395d8){return respondWithRpcPromise('MailQueues',_0x5b2323[_0xd425('0x17')],routingClient)[_0xd425('0xa')](findById(_0x5b2323[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x3395d8,null))[_0xd425('0xf')](handleError(_0x3395d8,null));};exports[_0xd425('0x42')]=function(_0xa21f7c,_0x3ca6a6){return respondWithRpcPromise(_0xd425('0x43'),_0xa21f7c['query'],mailClient)[_0xd425('0xa')](respondWithResult(_0x3ca6a6,null))[_0xd425('0xf')](handleError(_0x3ca6a6,null));};exports[_0xd425('0x44')]=function(_0xf22906,_0x5c4df8){return respondWithRpcPromise('OpenchannelQueues',_0xf22906[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x5c4df8,null))[_0xd425('0xf')](handleError(_0x5c4df8,null));};exports[_0xd425('0x45')]=function(_0x464ed1,_0x2e0f00){return respondWithRpcPromise(_0xd425('0x46'),_0x464ed1[_0xd425('0x17')],routingClient)[_0xd425('0xa')](findById(_0x464ed1[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x2e0f00,null))[_0xd425('0xf')](handleError(_0x2e0f00,null));};exports[_0xd425('0x47')]=function(_0x28979e,_0x5e72db){return respondWithRpcPromise(_0xd425('0x48'),_0x28979e[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x5e72db,null))['catch'](handleError(_0x5e72db,null));};exports['showSmsQueues']=function(_0x5ade1a,_0x403cb3){return respondWithRpcPromise(_0xd425('0x48'),_0x5ade1a[_0xd425('0x17')],routingClient)['then'](findById(_0x5ade1a[_0xd425('0x19')]['id']))['then'](respondWithResult(_0x403cb3,null))[_0xd425('0xf')](handleError(_0x403cb3,null));};exports[_0xd425('0x49')]=function(_0x21d26e,_0x5113fc){return respondWithRpcPromise(_0xd425('0x4a'),_0x21d26e[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x5113fc,null))[_0xd425('0xf')](handleError(_0x5113fc,null));};exports[_0xd425('0x4b')]=function(_0x43b1a9,_0x38a762){return respondWithRpcPromise(_0xd425('0x4a'),_0x43b1a9[_0xd425('0x17')],routingClient)[_0xd425('0xa')](findById(_0x43b1a9[_0xd425('0x19')]['id']))[_0xd425('0xa')](respondWithResult(_0x38a762,null))[_0xd425('0xf')](handleError(_0x38a762,null));};exports[_0xd425('0x4c')]=function(_0x445f98,_0x443126){return respondWithRpcPromise(_0xd425('0x4d'),_0x445f98[_0xd425('0x17')],routingClient)['then'](respondWithResult(_0x443126,null))['catch'](handleError(_0x443126,null));};exports[_0xd425('0x4e')]=function(_0x5c333a,_0x135048){return respondWithRpcPromise(_0xd425('0x4d'),_0x5c333a[_0xd425('0x17')],routingClient)[_0xd425('0xa')](findById(_0x5c333a['params']['id']))[_0xd425('0xa')](respondWithResult(_0x135048,null))[_0xd425('0xf')](handleError(_0x135048,null));};exports[_0xd425('0x4f')]=function(_0x689332,_0x2536bd){return respondWithRpcPromise(_0xd425('0x50'),_0x689332['query'])['then'](respondWithResult(_0x2536bd,null))[_0xd425('0xf')](handleError(_0x2536bd,null));};exports[_0xd425('0x51')]=function(_0x5e76f5,_0x174081){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5e76f5[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x174081,null))[_0xd425('0xf')](handleError(_0x174081,null));};exports[_0xd425('0x52')]=function(_0x376134,_0x2514fa){return respondWithRpcPromise(_0xd425('0x53'),_0x376134['query'],routingClient)[_0xd425('0xa')](respondWithResult(_0x2514fa,null))[_0xd425('0xf')](handleError(_0x2514fa,null));};exports[_0xd425('0x54')]=function(_0x233efa,_0xfcba08){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x233efa[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0xfcba08,null))['catch'](handleError(_0xfcba08,null));};exports[_0xd425('0x55')]=function(_0x4599b0,_0x48bed3){return respondWithRpcPromise(_0xd425('0x56'),_0x4599b0[_0xd425('0x17')],routingClient)[_0xd425('0xa')](function(_0xd923bb){if(_0x4599b0[_0xd425('0x17')]['type']!==undefined){var _0x454cce=_(_0xd923bb['rows'])[_0xd425('0x57')]([_0x4599b0[_0xd425('0x17')]['type'],_0x4599b0[_0xd425('0x19')]['id']])[_0xd425('0x58')](_0xd425('0x59'))[_0xd425('0x5a')]()['value']();return _0xd923bb['rows'][_0xd425('0x57')](function(_0x2312c1){return _0x454cce[_0xd425('0x5b')](_0x2312c1['queue_id'])>-0x1;});}else{return _0xd923bb[_0xd425('0x15')][_0xd425('0x57')](function(_0x5b932c){return _0x5b932c[_0xd425('0x59')]===parseInt(_0x4599b0['params']['id']);});}})[_0xd425('0xa')](respondWithResult(_0x48bed3,null))[_0xd425('0xf')](handleError(_0x48bed3,null));};exports[_0xd425('0x5c')]=function(_0x2493e7,_0x5750dc){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2493e7[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x5750dc,null))['catch'](handleError(_0x5750dc,null));};exports[_0xd425('0x5d')]=function(_0x389099,_0x51c9ad){return respondWithRpcPromise(_0xd425('0x5e'),_0x389099[_0xd425('0x17')],routingClient)[_0xd425('0xa')](respondWithResult(_0x51c9ad,null))[_0xd425('0xf')](handleError(_0x51c9ad,null));};exports[_0xd425('0x5f')]=function(_0xf251e6,_0x302066){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0xf251e6['query'],routingClient)[_0xd425('0xa')](respondWithResult(_0x302066,null))['catch'](handleError(_0x302066,null));};exports[_0xd425('0x60')]=function(_0x236030){return function(_0x58cad5,_0x244789){var _0x1c1c77,_0x5dac05;var _0x592c40=_[_0xd425('0x61')](_0x236030);var _0x242ed8=_0x236030===_0xd425('0x62')?_0xd425('0x63'):_0xd425('0x64');return db[_0x592c40+_0xd425('0x65')][_0xd425('0x66')]({'raw':!![],'where':{'id':_0x58cad5[_0xd425('0x19')]['id']}})['then'](function(_0x2cff42){if(_[_0xd425('0x14')](_0x2cff42)){throw new Error(_0x592c40+'\x20Queue\x20not\x20found');}_0x1c1c77=_0x2cff42;return db[_0x592c40+_0xd425('0x67')][_0xd425('0x66')]({'where':{'id':_0x58cad5[_0xd425('0x2d')][_0xd425('0x68')]},'include':[{'model':db[_0x592c40+_0xd425('0x69')],'as':_0xd425('0x69')},{'model':db[_0x592c40+_0x242ed8],'as':_0xd425('0x64')}]});})[_0xd425('0xa')](function(_0x334062){if(_[_0xd425('0x14')](_0x334062)){throw new Error(_0x592c40+_0xd425('0x6a'));}_0x5dac05=_0x334062;return _0x334062['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xd425('0xa')](function(){var _0x498e81={'uniqueid':_0x236030+'.'+_0x5dac05['id']+'.'+_0x5dac05['Interaction']['id'],'FromUserId':_0x58cad5[_0xd425('0x2f')]['id'],'type':'queue'};_0x498e81[_0x592c40+_0xd425('0x6b')]=_0x5dac05['id'];_0x498e81[_0x592c40+_0xd425('0x6c')]=_0x5dac05[_0xd425('0x69')]['id'];_0x498e81[_0xd425('0x6d')+_0x592c40+_0x242ed8+'Id']=_0x5dac05[_0xd425('0x64')]['id'];_0x498e81['To'+_0x592c40+_0xd425('0x6e')]=_0x1c1c77['id'];return db[_0x592c40+_0xd425('0x6f')]['create'](_0x498e81);})[_0xd425('0xa')](function(){return respondWithRpcPromise(_0xd425('0x70'),{'channel':_0x236030,'interaction':_0x5dac05[_0xd425('0x69')],'message':_0x5dac05,'account':_0x5dac05[_0xd425('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd425('0x71'),'appdata':_0x1c1c77['name']+','+(_0x5dac05[_0xd425('0x64')][_0xd425('0x72')]||0x12c),'interval':_0xd425('0x73')}]},routingClient);})[_0xd425('0xa')](respondWithResult(_0x244789,null))[_0xd425('0xf')](handleError(_0x244789,null));};};exports[_0xd425('0x74')]=function(_0x409612,_0x4147eb){var _0x433e5d,_0x334226;if(_[_0xd425('0x14')](_0x409612[_0xd425('0x2d')]['channel'])){throw new Error(_0xd425('0x75'));}var _0x5d8a47=_0x409612[_0xd425('0x2d')][_0xd425('0x76')];var _0x1c03d6=_[_0xd425('0x61')](_0x5d8a47);var _0xf06395=_0x5d8a47==='chat'?_0xd425('0x63'):_0xd425('0x64');return db[_0xd425('0x77')][_0xd425('0x66')]({'raw':!![],'where':{'id':_0x409612[_0xd425('0x19')]['id'],'role':_0xd425('0x38')}})[_0xd425('0xa')](function(_0x568a83){if(_[_0xd425('0x14')](_0x568a83)){throw new Error('Agent\x20not\x20found');}_0x433e5d=_0x568a83;return db[_0x1c03d6+_0xd425('0x67')][_0xd425('0x66')]({'where':{'id':_0x409612['body'][_0xd425('0x68')]},'include':[{'model':db[_0x1c03d6+_0xd425('0x69')],'as':'Interaction'},{'model':db[_0x1c03d6+_0xf06395],'as':_0xd425('0x64')}]});})[_0xd425('0xa')](function(_0xca2955){if(_[_0xd425('0x14')](_0xca2955)){throw new Error(_0x1c03d6+_0xd425('0x6a'));}_0x334226=_0xca2955;return _0xca2955[_0xd425('0x78')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3f1a48={'uniqueid':_0x5d8a47+'.'+_0x334226['id']+'.'+_0x334226['Interaction']['id'],'FromUserId':_0x409612[_0xd425('0x2f')]['id'],'type':'queue','ToUserId':_0x433e5d['id']};_0x3f1a48[_0x1c03d6+_0xd425('0x6b')]=_0x334226['id'];_0x3f1a48[_0x1c03d6+_0xd425('0x6c')]=_0x334226[_0xd425('0x69')]['id'];_0x3f1a48[_0xd425('0x6d')+_0x1c03d6+_0xf06395+'Id']=_0x334226['Account']['id'];return db[_0x1c03d6+'TransferReport']['create'](_0x3f1a48);})['then'](function(){return respondWithRpcPromise(_0xd425('0x70'),{'channel':_0x5d8a47,'interaction':_0x334226['Interaction'],'message':_0x334226,'account':_0x334226[_0xd425('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xd425('0x38'),'appdata':_0x433e5d[_0xd425('0x13')]+','+(_0x334226[_0xd425('0x64')][_0xd425('0x79')]||0x12c),'interval':_0xd425('0x73')}]},routingClient);})['then'](respondWithResult(_0x4147eb,null))[_0xd425('0xf')](handleError(_0x4147eb,null));}; \ No newline at end of file +var _0x7da7=['value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Queue','findOne','isNil','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','From','QueueId','TransferReport','create','Start','Account','queue','agentNotify','channel','User','Agent\x20not\x20found','InteractionId','bluebird','moment','lodash','../../config/logger','api','client','http','request','error','message','catch','status','json','name','send','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','VoiceChannelStopMixMonitor','params','then','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agentCapacity','interaction','user','hasOwnProperty','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','MemberReport','findOrCreate','SIP/%s','INTERACTION','agent','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','showWhatsappQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0x7da7,0x10d));var _0x77da=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x7da7[_0x40220a];return _0x3903cc;};'use strict';var BPromise=require(_0x77da('0x0'));var moment=require(_0x77da('0x1'));var _=require(_0x77da('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x77da('0x3'))(_0x77da('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x77da('0x5')][_0x77da('0x6')]({'port':0x232a});var mailClient=jayson['client'][_0x77da('0x6')]({'port':0x232b});var routingClient=jayson[_0x77da('0x5')]['http']({'port':0x232c});function respondWithRpcPromise(_0x30afe0,_0x47cf1d,_0x1191de){return new BPromise(function(_0x13992e,_0x37c5ab){var _0x910e5b=_0x1191de?_0x1191de:amiClient;return _0x910e5b[_0x77da('0x7')](_0x30afe0,_0x47cf1d)['then'](function(_0x40c86e){if(_0x40c86e[_0x77da('0x8')]){if(_0x40c86e[_0x77da('0x8')]['code']===0x1f4){return _0x37c5ab(_0x40c86e[_0x77da('0x8')][_0x77da('0x9')]);}return _0x13992e(_0x40c86e[_0x77da('0x8')][_0x77da('0x9')]);}else{_0x13992e(_0x40c86e['result']);}})[_0x77da('0xa')](function(_0x3bcea0){_0x37c5ab(_0x3bcea0);});});}function respondWithResult(_0x2acc65,_0x5d6e2f){_0x5d6e2f=_0x5d6e2f||0xc8;return function(_0x4a7748){if(_0x4a7748){return _0x2acc65[_0x77da('0xb')](_0x5d6e2f)[_0x77da('0xc')](_0x4a7748);}return _0x2acc65['sendStatus'](0x194);};}function handleError(_0x3b0ff2,_0x369df0){_0x369df0=_0x369df0||0x1f4;return function(_0x355719){logger[_0x77da('0x8')](_0x355719['stack']);if(_0x355719[_0x77da('0xd')]){delete _0x355719['name'];}_0x3b0ff2[_0x77da('0xb')](_0x369df0)[_0x77da('0xe')](_0x355719);};}function findById(_0x1b0e17){return function(_0x4500c4){if(!_['isNil'](_0x1b0e17)&&!_['isNil'](_0x4500c4)&&!_['isNil'](_0x4500c4['rows'])){return _[_0x77da('0xf')](_0x4500c4[_0x77da('0x10')],function(_0x289887){return _0x289887['id']==_0x1b0e17;});}return null;};}exports[_0x77da('0x11')]=function(_0x19a00c,_0x12d2b1){return respondWithRpcPromise(_0x77da('0x12'),_0x19a00c[_0x77da('0x13')])['then'](respondWithResult(_0x12d2b1,null))['catch'](handleError(_0x12d2b1,null));};exports[_0x77da('0x14')]=function(_0x4d1512,_0x507979){return respondWithRpcPromise(_0x77da('0x15'),_[_0x77da('0x16')](_0x4d1512[_0x77da('0x13')],_0x4d1512['params']))['then'](respondWithResult(_0x507979,null))[_0x77da('0xa')](handleError(_0x507979,null));};exports['voiceChannelStopMixMonitor']=function(_0x175ac4,_0x1c27aa){return respondWithRpcPromise(_0x77da('0x17'),_[_0x77da('0x16')](_0x175ac4[_0x77da('0x13')],_0x175ac4[_0x77da('0x18')]))[_0x77da('0x19')](respondWithResult(_0x1c27aa,null))['catch'](handleError(_0x1c27aa,null));};exports['voiceQueues']=function(_0xfd160,_0x2d009f){return respondWithRpcPromise(_0x77da('0x1a'),_0xfd160[_0x77da('0x13')])['then'](respondWithResult(_0x2d009f,null))[_0x77da('0xa')](handleError(_0x2d009f,null));};exports[_0x77da('0x1b')]=function(_0x470c9f,_0x36115b){return respondWithRpcPromise(_0x77da('0x1a'),_0x470c9f['query'])[_0x77da('0x19')](findById(_0x470c9f[_0x77da('0x18')]['id']))[_0x77da('0x19')](respondWithResult(_0x36115b,null))[_0x77da('0xa')](handleError(_0x36115b,null));};exports['updateVoiceQueue']=function(_0x5b4638,_0x4d395a){return respondWithRpcPromise(_0x77da('0x1c'),_[_0x77da('0x16')](_0x5b4638[_0x77da('0x1d')],_0x5b4638[_0x77da('0x18')]))[_0x77da('0x19')](respondWithResult(_0x4d395a,null))['catch'](handleError(_0x4d395a,null));};exports[_0x77da('0x1e')]=function(_0x26f5a0,_0x356bfb){return respondWithRpcPromise(_0x77da('0x1f'),_[_0x77da('0x16')](_0x26f5a0[_0x77da('0x13')],_0x26f5a0['params']))[_0x77da('0x19')](respondWithResult(_0x356bfb,null))[_0x77da('0xa')](handleError(_0x356bfb,null));};exports[_0x77da('0x20')]=function(_0x38643a,_0x3c3c64){return respondWithRpcPromise(_0x77da('0x21'),_0x38643a[_0x77da('0x13')])[_0x77da('0x19')](respondWithResult(_0x3c3c64,null))['catch'](handleError(_0x3c3c64,null));};exports['voiceQueuesChannel']=function(_0x1366b4,_0x8e6181){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x77da('0x16')](_0x1366b4[_0x77da('0x13')],_0x1366b4[_0x77da('0x18')]))[_0x77da('0x19')](respondWithResult(_0x8e6181,null))[_0x77da('0xa')](handleError(_0x8e6181,null));};exports[_0x77da('0x22')]=function(_0x20d1cc,_0x5c4a03){return respondWithRpcPromise(_0x77da('0x23'),_['merge'](_0x20d1cc['query'],_0x20d1cc['params']))[_0x77da('0x19')](respondWithResult(_0x5c4a03,null))['catch'](handleError(_0x5c4a03,null));};exports[_0x77da('0x24')]=function(_0xdac1a4,_0xce9df2){return respondWithRpcPromise(_0x77da('0x25'),_[_0x77da('0x16')](_0xdac1a4[_0x77da('0x13')],_0xdac1a4[_0x77da('0x18')]))['then'](respondWithResult(_0xce9df2,null))[_0x77da('0xa')](handleError(_0xce9df2,null));};exports[_0x77da('0x26')]=function(_0x1ca53a,_0x32785f){return respondWithRpcPromise(_0x77da('0x27'),_0x1ca53a[_0x77da('0x13')])['then'](respondWithResult(_0x32785f,null))[_0x77da('0xa')](handleError(_0x32785f,null));};exports[_0x77da('0x28')]=function(_0x2cd190,_0x4d04cd){return respondWithRpcPromise(_0x77da('0x29'),_0x2cd190['query'])['then'](respondWithResult(_0x4d04cd,null))['catch'](handleError(_0x4d04cd,null));};exports['agents']=function(_0x19f9f7,_0x1adba5){var _0xebdea1;return respondWithRpcPromise('Agents',_0x19f9f7[_0x77da('0x13')])['then'](function(_0xf79c20){_0xebdea1=_0xf79c20;return respondWithRpcPromise('Agents',_0x19f9f7[_0x77da('0x13')],routingClient);})[_0x77da('0x19')](function(_0x290667){return _[_0x77da('0x16')]({},_0x290667,_0xebdea1);})[_0x77da('0x19')](respondWithResult(_0x1adba5,null))['catch'](handleError(_0x1adba5,null));};exports[_0x77da('0x2a')]=function(_0x1f48bd,_0x44717a){if(_0x1f48bd[_0x77da('0x1d')]&&_0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')]&&_0x1f48bd['user']&&_0x1f48bd[_0x77da('0x2c')][_0x77da('0xd')]){for(var _0x21de41 in _0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')]){if(_0x1f48bd[_0x77da('0x1d')]['interaction'][_0x77da('0x2d')](_0x21de41)){db['MemberReport'][_0x77da('0x2e')]({'where':{'channel':_0x21de41,'membername':_0x1f48bd[_0x77da('0x2c')][_0x77da('0xd')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')][_0x21de41]&&_0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')][_0x21de41][_0x77da('0x2f')]?{'$notIn':_0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')][_0x21de41]}:{'$ne':null}}})[_0x77da('0x19')](function(_0x1bb77c){var _0x5964da=moment()[_0x77da('0x30')](_0x77da('0x31'));for(var _0x46f289=0x0,_0x287cf0=_0x1bb77c[_0x77da('0x2f')];_0x46f289<_0x287cf0;_0x46f289+=0x1){_0x1bb77c[_0x46f289][_0x77da('0x32')]({'exitAt':_0x5964da});}});for(var _0x558023=0x0;_0x558023<_0x1f48bd['body'][_0x77da('0x2b')][_0x21de41][_0x77da('0x2f')];_0x558023+=0x1){db[_0x77da('0x33')][_0x77da('0x34')]({'where':{'channel':_0x21de41,'membername':_0x1f48bd[_0x77da('0x2c')][_0x77da('0xd')],'type':'INTERACTION','uniqueid':_0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')][_0x21de41][_0x558023],'exitAt':null},'defaults':{'channel':_0x21de41,'membername':_0x1f48bd[_0x77da('0x2c')][_0x77da('0xd')],'interface':_['isNil'](_0x1f48bd[_0x77da('0x2c')]['interface'])?util['format'](_0x77da('0x35'),_0x1f48bd[_0x77da('0x2c')][_0x77da('0xd')]):_0x1f48bd[_0x77da('0x2c')]['interface'],'type':_0x77da('0x36'),'enterAt':moment()[_0x77da('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x77da('0x37'),'internal':_0x1f48bd[_0x77da('0x2c')]['internal'],'uniqueid':_0x1f48bd[_0x77da('0x1d')][_0x77da('0x2b')][_0x21de41][_0x558023]}});}}}}return respondWithRpcPromise(_0x77da('0x38'),{'id':_0x1f48bd[_0x77da('0x18')]['id'],'capacity':_0x1f48bd[_0x77da('0x1d')][_0x77da('0x39')]},routingClient)[_0x77da('0x19')](respondWithResult(_0x44717a,null))[_0x77da('0xa')](handleError(_0x44717a,null));};exports[_0x77da('0x3a')]=function(_0x3a34a8,_0x52aa0a){return respondWithRpcPromise(_0x77da('0x3b'),_0x3a34a8['query'])[_0x77da('0x19')](respondWithResult(_0x52aa0a,null))[_0x77da('0xa')](handleError(_0x52aa0a,null));};exports[_0x77da('0x3c')]=function(_0x2eca67,_0x374179){return respondWithRpcPromise(_0x77da('0x3d'),_0x2eca67[_0x77da('0x13')])['then'](respondWithResult(_0x374179,null))[_0x77da('0xa')](handleError(_0x374179,null));};exports[_0x77da('0x3e')]=function(_0x1a7115,_0x353be9){return respondWithRpcPromise('Campaigns',_0x1a7115[_0x77da('0x13')])[_0x77da('0x19')](respondWithResult(_0x353be9,null))[_0x77da('0xa')](handleError(_0x353be9,null));};exports['chatQueues']=function(_0x5a7ba7,_0x332763){return respondWithRpcPromise(_0x77da('0x3f'),_0x5a7ba7[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x332763,null))[_0x77da('0xa')](handleError(_0x332763,null));};exports['showChatQueues']=function(_0x50437b,_0x365e91){return respondWithRpcPromise(_0x77da('0x3f'),_0x50437b['query'],routingClient)[_0x77da('0x19')](findById(_0x50437b[_0x77da('0x18')]['id']))[_0x77da('0x19')](respondWithResult(_0x365e91,null))['catch'](handleError(_0x365e91,null));};exports[_0x77da('0x40')]=function(_0x111260,_0x5a5309){return respondWithRpcPromise(_0x77da('0x41'),_0x111260[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x5a5309,null))[_0x77da('0xa')](handleError(_0x5a5309,null));};exports[_0x77da('0x42')]=function(_0x99ac27,_0x1dc4ab){return respondWithRpcPromise(_0x77da('0x41'),_0x99ac27[_0x77da('0x13')],routingClient)['then'](findById(_0x99ac27[_0x77da('0x18')]['id']))[_0x77da('0x19')](respondWithResult(_0x1dc4ab,null))[_0x77da('0xa')](handleError(_0x1dc4ab,null));};exports[_0x77da('0x43')]=function(_0x329c6b,_0x3a0160){return respondWithRpcPromise('MailAccounts',_0x329c6b[_0x77da('0x13')],mailClient)[_0x77da('0x19')](respondWithResult(_0x3a0160,null))[_0x77da('0xa')](handleError(_0x3a0160,null));};exports['openchannelQueues']=function(_0x3e5dd9,_0x2f7cd8){return respondWithRpcPromise(_0x77da('0x44'),_0x3e5dd9[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x2f7cd8,null))[_0x77da('0xa')](handleError(_0x2f7cd8,null));};exports[_0x77da('0x45')]=function(_0x53a9ee,_0x100094){return respondWithRpcPromise('OpenchannelQueues',_0x53a9ee[_0x77da('0x13')],routingClient)[_0x77da('0x19')](findById(_0x53a9ee[_0x77da('0x18')]['id']))['then'](respondWithResult(_0x100094,null))[_0x77da('0xa')](handleError(_0x100094,null));};exports[_0x77da('0x46')]=function(_0x282481,_0x30ea29){return respondWithRpcPromise('SmsQueues',_0x282481['query'],routingClient)['then'](respondWithResult(_0x30ea29,null))[_0x77da('0xa')](handleError(_0x30ea29,null));};exports[_0x77da('0x47')]=function(_0x2c4d7c,_0x2c7c8e){return respondWithRpcPromise(_0x77da('0x48'),_0x2c4d7c[_0x77da('0x13')],routingClient)[_0x77da('0x19')](findById(_0x2c4d7c[_0x77da('0x18')]['id']))[_0x77da('0x19')](respondWithResult(_0x2c7c8e,null))[_0x77da('0xa')](handleError(_0x2c7c8e,null));};exports['whatsappQueues']=function(_0x3028ca,_0x6dd79f){return respondWithRpcPromise('WhatsappQueues',_0x3028ca['query'],routingClient)[_0x77da('0x19')](respondWithResult(_0x6dd79f,null))['catch'](handleError(_0x6dd79f,null));};exports[_0x77da('0x49')]=function(_0x1adab0,_0x1ff554){return respondWithRpcPromise('WhatsappQueues',_0x1adab0[_0x77da('0x13')],routingClient)[_0x77da('0x19')](findById(_0x1adab0[_0x77da('0x18')]['id']))[_0x77da('0x19')](respondWithResult(_0x1ff554,null))[_0x77da('0xa')](handleError(_0x1ff554,null));};exports['faxQueues']=function(_0x1f4c49,_0x20a636){return respondWithRpcPromise('FaxQueues',_0x1f4c49[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x20a636,null))[_0x77da('0xa')](handleError(_0x20a636,null));};exports[_0x77da('0x4a')]=function(_0x14496e,_0xdf9393){return respondWithRpcPromise(_0x77da('0x4b'),_0x14496e['query'],routingClient)[_0x77da('0x19')](findById(_0x14496e['params']['id']))[_0x77da('0x19')](respondWithResult(_0xdf9393,null))[_0x77da('0xa')](handleError(_0xdf9393,null));};exports[_0x77da('0x4c')]=function(_0x19b514,_0x470619){return respondWithRpcPromise(_0x77da('0x4d'),_0x19b514[_0x77da('0x13')])[_0x77da('0x19')](respondWithResult(_0x470619,null))[_0x77da('0xa')](handleError(_0x470619,null));};exports[_0x77da('0x4e')]=function(_0x3c9ca7,_0x19065e){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x3c9ca7[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x19065e,null))[_0x77da('0xa')](handleError(_0x19065e,null));};exports[_0x77da('0x4f')]=function(_0x57b710,_0x293b5c){return respondWithRpcPromise(_0x77da('0x50'),_0x57b710[_0x77da('0x13')],routingClient)['then'](respondWithResult(_0x293b5c,null))[_0x77da('0xa')](handleError(_0x293b5c,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x579314,_0x2a4f85){return respondWithRpcPromise(_0x77da('0x51'),_0x579314[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x2a4f85,null))[_0x77da('0xa')](handleError(_0x2a4f85,null));};exports[_0x77da('0x52')]=function(_0x14dec8,_0xf95d48){return respondWithRpcPromise(_0x77da('0x51'),_0x14dec8['query'],routingClient)[_0x77da('0x19')](function(_0xfcf09c){if(_0x14dec8[_0x77da('0x13')][_0x77da('0x53')]!==undefined){var _0x17175=_(_0xfcf09c['rows'])[_0x77da('0x54')]([_0x14dec8[_0x77da('0x13')][_0x77da('0x53')],_0x14dec8[_0x77da('0x18')]['id']])[_0x77da('0x55')](_0x77da('0x56'))[_0x77da('0x57')]()[_0x77da('0x58')]();return _0xfcf09c[_0x77da('0x10')][_0x77da('0x54')](function(_0x4df868){return _0x17175['indexOf'](_0x4df868['queue_id'])>-0x1;});}else{return _0xfcf09c[_0x77da('0x10')][_0x77da('0x54')](function(_0x41fb81){return _0x41fb81['queue_id']===parseInt(_0x14dec8['params']['id']);});}})[_0x77da('0x19')](respondWithResult(_0xf95d48,null))[_0x77da('0xa')](handleError(_0xf95d48,null));};exports[_0x77da('0x59')]=function(_0x3a42e5,_0x1a92fd){return respondWithRpcPromise(_0x77da('0x5a'),_0x3a42e5[_0x77da('0x13')],routingClient)[_0x77da('0x19')](respondWithResult(_0x1a92fd,null))[_0x77da('0xa')](handleError(_0x1a92fd,null));};exports[_0x77da('0x5b')]=function(_0x27a462,_0x4cbd40){return respondWithRpcPromise(_0x77da('0x5c'),_0x27a462['query'],routingClient)['then'](respondWithResult(_0x4cbd40,null))[_0x77da('0xa')](handleError(_0x4cbd40,null));};exports['faxQueuesWaitingInteractions']=function(_0x4f9121,_0x22de60){return respondWithRpcPromise(_0x77da('0x5d'),_0x4f9121[_0x77da('0x13')],routingClient)['then'](respondWithResult(_0x22de60,null))['catch'](handleError(_0x22de60,null));};exports[_0x77da('0x5e')]=function(_0x4f1ae0){return function(_0x278f20,_0x1b85aa){var _0x554c44,_0x31834a;var _0x505520=_[_0x77da('0x5f')](_0x4f1ae0);var _0x45b0a5=_0x4f1ae0===_0x77da('0x60')?_0x77da('0x61'):'Account';return db[_0x505520+_0x77da('0x62')][_0x77da('0x63')]({'raw':!![],'where':{'id':_0x278f20[_0x77da('0x18')]['id']}})[_0x77da('0x19')](function(_0x3fd7c8){if(_[_0x77da('0x64')](_0x3fd7c8)){throw new Error(_0x505520+_0x77da('0x65'));}_0x554c44=_0x3fd7c8;return db[_0x505520+'Message']['findOne']({'where':{'id':_0x278f20[_0x77da('0x1d')][_0x77da('0x66')]},'include':[{'model':db[_0x505520+_0x77da('0x67')],'as':'Interaction'},{'model':db[_0x505520+_0x45b0a5],'as':'Account'}]});})['then'](function(_0x5aaafb){if(_[_0x77da('0x64')](_0x5aaafb)){throw new Error(_0x505520+_0x77da('0x68'));}_0x31834a=_0x5aaafb;return _0x5aaafb[_0x77da('0x69')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x1636d6={'uniqueid':_0x4f1ae0+'.'+_0x31834a['id']+'.'+_0x31834a['Interaction']['id'],'FromUserId':_0x278f20[_0x77da('0x2c')]['id'],'type':'queue'};_0x1636d6[_0x505520+_0x77da('0x6a')]=_0x31834a['id'];_0x1636d6[_0x505520+'InteractionId']=_0x31834a[_0x77da('0x67')]['id'];_0x1636d6[_0x77da('0x6b')+_0x505520+_0x45b0a5+'Id']=_0x31834a['Account']['id'];_0x1636d6['To'+_0x505520+_0x77da('0x6c')]=_0x554c44['id'];return db[_0x505520+_0x77da('0x6d')][_0x77da('0x6e')](_0x1636d6);})[_0x77da('0x19')](function(){return respondWithRpcPromise(_0x77da('0x6f'),{'channel':_0x4f1ae0,'interaction':_0x31834a[_0x77da('0x67')],'message':_0x31834a,'account':_0x31834a[_0x77da('0x70')],'applications':[{'id':0x0,'priority':0x1,'app':_0x77da('0x71'),'appdata':_0x554c44[_0x77da('0xd')]+','+(_0x31834a['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x77da('0x19')](respondWithResult(_0x1b85aa,null))[_0x77da('0xa')](handleError(_0x1b85aa,null));};};exports[_0x77da('0x72')]=function(_0x56efcf,_0x186d22){var _0x52638b,_0x5e93b1;if(_[_0x77da('0x64')](_0x56efcf[_0x77da('0x1d')]['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x3c0cde=_0x56efcf[_0x77da('0x1d')][_0x77da('0x73')];var _0x5d9750=_[_0x77da('0x5f')](_0x3c0cde);var _0x5384d2=_0x3c0cde===_0x77da('0x60')?_0x77da('0x61'):_0x77da('0x70');return db[_0x77da('0x74')][_0x77da('0x63')]({'raw':!![],'where':{'id':_0x56efcf[_0x77da('0x18')]['id'],'role':'agent'}})[_0x77da('0x19')](function(_0x2410ae){if(_[_0x77da('0x64')](_0x2410ae)){throw new Error(_0x77da('0x75'));}_0x52638b=_0x2410ae;return db[_0x5d9750+'Message'][_0x77da('0x63')]({'where':{'id':_0x56efcf['body'][_0x77da('0x66')]},'include':[{'model':db[_0x5d9750+_0x77da('0x67')],'as':_0x77da('0x67')},{'model':db[_0x5d9750+_0x5384d2],'as':_0x77da('0x70')}]});})[_0x77da('0x19')](function(_0x2c3bcc){if(_[_0x77da('0x64')](_0x2c3bcc)){throw new Error(_0x5d9750+_0x77da('0x68'));}_0x5e93b1=_0x2c3bcc;return _0x2c3bcc['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x77da('0x19')](function(){var _0x3132f0={'uniqueid':_0x3c0cde+'.'+_0x5e93b1['id']+'.'+_0x5e93b1[_0x77da('0x67')]['id'],'FromUserId':_0x56efcf[_0x77da('0x2c')]['id'],'type':_0x77da('0x71'),'ToUserId':_0x52638b['id']};_0x3132f0[_0x5d9750+_0x77da('0x6a')]=_0x5e93b1['id'];_0x3132f0[_0x5d9750+_0x77da('0x76')]=_0x5e93b1[_0x77da('0x67')]['id'];_0x3132f0['From'+_0x5d9750+_0x5384d2+'Id']=_0x5e93b1['Account']['id'];return db[_0x5d9750+_0x77da('0x6d')][_0x77da('0x6e')](_0x3132f0);})[_0x77da('0x19')](function(){return respondWithRpcPromise('Start',{'channel':_0x3c0cde,'interaction':_0x5e93b1[_0x77da('0x67')],'message':_0x5e93b1,'account':_0x5e93b1['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x77da('0x37'),'appdata':_0x52638b[_0x77da('0xd')]+','+(_0x5e93b1[_0x77da('0x70')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x77da('0x19')](respondWithResult(_0x186d22,null))['catch'](handleError(_0x186d22,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index ac8baf0..20ed52f 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 _0xafa8=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/run','run','create','put','update','delete','destroy','exports','multer'];(function(_0x3e3971,_0x2d0725){var _0xff686f=function(_0x56017a){while(--_0x56017a){_0x3e3971['push'](_0x3e3971['shift']());}};_0xff686f(++_0x2d0725);}(_0xafa8,0xc5));var _0x8afa=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0xafa8[_0x34325b];return _0x3da348;};'use strict';var multer=require(_0x8afa('0x0'));var util=require(_0x8afa('0x1'));var path=require('path');var timeout=require(_0x8afa('0x2'));var express=require(_0x8afa('0x3'));var router=express[_0x8afa('0x4')]();var fs_extra=require(_0x8afa('0x5'));var auth=require(_0x8afa('0x6'));var interaction=require(_0x8afa('0x7'));var config=require(_0x8afa('0x8'));var controller=require('./schedule.controller');router[_0x8afa('0x9')]('/',auth[_0x8afa('0xa')](),controller[_0x8afa('0xb')]);router[_0x8afa('0x9')](_0x8afa('0xc'),auth['isAuthenticated'](),controller[_0x8afa('0xd')]);router[_0x8afa('0x9')](_0x8afa('0xe'),auth[_0x8afa('0xa')](),controller[_0x8afa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8afa('0x10')]);router[_0x8afa('0x11')](_0x8afa('0xc'),auth[_0x8afa('0xa')](),controller[_0x8afa('0x12')]);router[_0x8afa('0x13')](_0x8afa('0xc'),auth[_0x8afa('0xa')](),controller[_0x8afa('0x14')]);module[_0x8afa('0x15')]=router; \ No newline at end of file +var _0xd866=['fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','post','create','put','delete','multer','path','connect-timeout','express','Router'];(function(_0x549b66,_0x207c94){var _0x1eecff=function(_0x233276){while(--_0x233276){_0x549b66['push'](_0x549b66['shift']());}};_0x1eecff(++_0x207c94);}(_0xd866,0x19f));var _0x6d86=function(_0x52c856,_0x47fd69){_0x52c856=_0x52c856-0x0;var _0x41f172=_0xd866[_0x52c856];return _0x41f172;};'use strict';var multer=require(_0x6d86('0x0'));var util=require('util');var path=require(_0x6d86('0x1'));var timeout=require(_0x6d86('0x2'));var express=require(_0x6d86('0x3'));var router=express[_0x6d86('0x4')]();var fs_extra=require(_0x6d86('0x5'));var auth=require(_0x6d86('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6d86('0x7'));var controller=require(_0x6d86('0x8'));router[_0x6d86('0x9')]('/',auth[_0x6d86('0xa')](),controller[_0x6d86('0xb')]);router[_0x6d86('0x9')](_0x6d86('0xc'),auth[_0x6d86('0xa')](),controller[_0x6d86('0xd')]);router[_0x6d86('0x9')](_0x6d86('0xe'),auth[_0x6d86('0xa')](),controller[_0x6d86('0xf')]);router[_0x6d86('0x10')]('/',auth[_0x6d86('0xa')](),controller[_0x6d86('0x11')]);router[_0x6d86('0x12')](_0x6d86('0xc'),auth[_0x6d86('0xa')](),controller['update']);router[_0x6d86('0x13')](_0x6d86('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 32defcd..d76aec3 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 _0x28c1=['DATE','INTEGER','ENUM','years','quarters','hours','minutes','days','pdf','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*'];(function(_0x23454f,_0x3de1fc){var _0xef0b88=function(_0xadd1da){while(--_0xadd1da){_0x23454f['push'](_0x23454f['shift']());}};_0xef0b88(++_0x3de1fc);}(_0x28c1,0x72));var _0x128c=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x28c1[_0x1beef3];return _0x5af964;};'use strict';var Sequelize=require(_0x128c('0x0'));module[_0x128c('0x1')]={'name':{'type':Sequelize[_0x128c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x128c('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x128c('0x2')],'allowNull':![],'defaultValue':_0x128c('0x4')},'startAt':{'type':Sequelize[_0x128c('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x128c('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x128c('0x7')](_0x128c('0x8'),_0x128c('0x9'),'months','weeks','days',_0x128c('0xa'),_0x128c('0xb')),'allowNull':![],'defaultValue':_0x128c('0xc')},'output':{'type':Sequelize[_0x128c('0x7')]('csv',_0x128c('0xd'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x128c('0x7')](_0x128c('0xe'),_0x128c('0xf')),'allowNull':![],'defaultValue':_0x128c('0xe')},'sendMail':{'type':Sequelize[_0x128c('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x128c('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x128c('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xdae5=['xlsx','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','weeks','minutes','days','ENUM','csv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdae5,0x135));var _0x5dae=function(_0x625a27,_0x2c6b0d){_0x625a27=_0x625a27-0x0;var _0x42874a=_0xdae5[_0x625a27];return _0x42874a;};'use strict';var Sequelize=require(_0x5dae('0x0'));module[_0x5dae('0x1')]={'name':{'type':Sequelize[_0x5dae('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5dae('0x2')]},'active':{'type':Sequelize[_0x5dae('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x5dae('0x2')],'allowNull':![],'defaultValue':_0x5dae('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x5dae('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x5dae('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x5dae('0x7'),_0x5dae('0x8'),'months',_0x5dae('0x9'),'days','hours',_0x5dae('0xa')),'allowNull':![],'defaultValue':_0x5dae('0xb')},'output':{'type':Sequelize[_0x5dae('0xc')](_0x5dae('0xd'),'pdf',_0x5dae('0xe')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x5dae('0xc')](_0x5dae('0xf'),'default'),'allowNull':![],'defaultValue':_0x5dae('0xf')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x5dae('0x10')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 3d4e9c3..aab66bc 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 _0xe1a6=['limit','count','set','apply','reject','update','then','destroy','get','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','where','merge','filter','options','Schedule','includeAll','include','findAll','catch','show','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined'];(function(_0x958172,_0x550af7){var _0x5522c3=function(_0x807cfc){while(--_0x807cfc){_0x958172['push'](_0x958172['shift']());}};_0x5522c3(++_0x550af7);}(_0xe1a6,0x1d2));var _0x6e1a=function(_0x54c6bf,_0x553245){_0x54c6bf=_0x54c6bf-0x0;var _0x5d3efe=_0xe1a6[_0x54c6bf];return _0x5d3efe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6e1a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e1a('0x1'));var rp=require(_0x6e1a('0x2'));var moment=require(_0x6e1a('0x3'));var BPromise=require(_0x6e1a('0x4'));var Mustache=require(_0x6e1a('0x5'));var util=require('util');var path=require(_0x6e1a('0x6'));var sox=require(_0x6e1a('0x7'));var csv=require(_0x6e1a('0x8'));var ejs=require(_0x6e1a('0x9'));var fs=require('fs');var fs_extra=require(_0x6e1a('0xa'));var _=require(_0x6e1a('0xb'));var squel=require('squel');var crypto=require(_0x6e1a('0xc'));var jsforce=require(_0x6e1a('0xd'));var deskjs=require(_0x6e1a('0xe'));var toCsv=require(_0x6e1a('0x8'));var querystring=require('querystring');var Papa=require(_0x6e1a('0xf'));var Redis=require(_0x6e1a('0x10'));var authService=require(_0x6e1a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6e1a('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6e1a('0x13'));var db=require(_0x6e1a('0x14'))['db'];function respondWithStatusCode(_0x4341ac,_0x597edb){_0x597edb=_0x597edb||0xcc;return function(_0x62b088){if(_0x62b088){return _0x4341ac[_0x6e1a('0x15')](_0x597edb);}return _0x4341ac['status'](_0x597edb)[_0x6e1a('0x16')]();};}function respondWithResult(_0x2e62c0,_0x56ee4a){_0x56ee4a=_0x56ee4a||0xc8;return function(_0x270f88){if(_0x270f88){return _0x2e62c0[_0x6e1a('0x17')](_0x56ee4a)[_0x6e1a('0x18')](_0x270f88);}};}function respondWithFilteredResult(_0x75f885,_0x385d87){return function(_0x2c3da9){if(_0x2c3da9){var _0x297fd8=typeof _0x385d87['offset']===_0x6e1a('0x19')&&typeof _0x385d87[_0x6e1a('0x1a')]===_0x6e1a('0x19');var _0xa16487=_0x2c3da9[_0x6e1a('0x1b')];var _0x57d9f0=_0x297fd8?0x0:_0x385d87['offset'];var _0x2e8304=_0x297fd8?_0x2c3da9[_0x6e1a('0x1b')]:_0x385d87['offset']+_0x385d87[_0x6e1a('0x1a')];var _0x3ac006;if(_0x2e8304>=_0xa16487){_0x2e8304=_0xa16487;_0x3ac006=0xc8;}else{_0x3ac006=0xce;}_0x75f885[_0x6e1a('0x17')](_0x3ac006);return _0x75f885[_0x6e1a('0x1c')]('Content-Range',_0x57d9f0+'-'+_0x2e8304+'/'+_0xa16487)['json'](_0x2c3da9);}return null;};}function patchUpdates(_0x1c9271){return function(_0x4ed4e3){try{jsonpatch[_0x6e1a('0x1d')](_0x4ed4e3,_0x1c9271,!![]);}catch(_0x275490){return BPromise[_0x6e1a('0x1e')](_0x275490);}return _0x4ed4e3['save']();};}function saveUpdates(_0x219da0,_0x596b6e){return function(_0x13285){if(_0x13285){return _0x13285[_0x6e1a('0x1f')](_0x219da0)[_0x6e1a('0x20')](function(_0x1a0d94){return _0x1a0d94;});}return null;};}function removeEntity(_0x1ec558,_0x47500f){return function(_0x23905f){if(_0x23905f){return _0x23905f[_0x6e1a('0x21')]()[_0x6e1a('0x20')](function(){var _0x7f56f2=_0x23905f[_0x6e1a('0x22')]({'plain':!![]});var _0x42f06d='Scheduler';return db['UserProfileResource']['destroy']({'where':{'type':_0x42f06d,'resourceId':_0x7f56f2['id']}})[_0x6e1a('0x20')](function(){return _0x23905f;});})[_0x6e1a('0x20')](function(){_0x1ec558['status'](0xcc)[_0x6e1a('0x16')]();});}};}function handleEntityNotFound(_0x4c3005,_0x33794f){return function(_0x3a4a19){if(!_0x3a4a19){_0x4c3005[_0x6e1a('0x15')](0x194);}return _0x3a4a19;};}function handleError(_0x4dc4db,_0x4cf1af){_0x4cf1af=_0x4cf1af||0x1f4;return function(_0x65b35d){logger[_0x6e1a('0x23')](_0x65b35d[_0x6e1a('0x24')]);if(_0x65b35d[_0x6e1a('0x25')]){delete _0x65b35d[_0x6e1a('0x25')];}_0x4dc4db[_0x6e1a('0x17')](_0x4cf1af)['send'](_0x65b35d);};}exports[_0x6e1a('0x26')]=function(_0x2c90e5,_0x356037){var _0xa6ad0={},_0x1f74b5={},_0x22e7bc={'count':0x0,'rows':[]};var _0x3da138=_[_0x6e1a('0x27')](db['Schedule'][_0x6e1a('0x28')],function(_0x2452a4){return{'name':_0x2452a4[_0x6e1a('0x29')],'type':_0x2452a4[_0x6e1a('0x2a')][_0x6e1a('0x2b')]};});_0x1f74b5[_0x6e1a('0x2c')]=_['map'](_0x3da138,_0x6e1a('0x25'));_0x1f74b5[_0x6e1a('0x2d')]=_[_0x6e1a('0x2e')](_0x2c90e5[_0x6e1a('0x2d')]);_0x1f74b5[_0x6e1a('0x2f')]=_[_0x6e1a('0x30')](_0x1f74b5['model'],_0x1f74b5[_0x6e1a('0x2d')]);_0xa6ad0[_0x6e1a('0x31')]=_[_0x6e1a('0x30')](_0x1f74b5[_0x6e1a('0x2c')],qs[_0x6e1a('0x32')](_0x2c90e5['query'][_0x6e1a('0x32')]));_0xa6ad0[_0x6e1a('0x31')]=_0xa6ad0[_0x6e1a('0x31')][_0x6e1a('0x33')]?_0xa6ad0[_0x6e1a('0x31')]:_0x1f74b5[_0x6e1a('0x2c')];if(!_0x2c90e5[_0x6e1a('0x2d')][_0x6e1a('0x34')](_0x6e1a('0x35'))){_0xa6ad0['limit']=qs[_0x6e1a('0x1a')](_0x2c90e5[_0x6e1a('0x2d')]['limit']);_0xa6ad0[_0x6e1a('0x36')]=qs[_0x6e1a('0x36')](_0x2c90e5[_0x6e1a('0x2d')][_0x6e1a('0x36')]);}_0xa6ad0[_0x6e1a('0x37')]=qs[_0x6e1a('0x38')](_0x2c90e5[_0x6e1a('0x2d')][_0x6e1a('0x38')]);_0xa6ad0['where']=qs[_0x6e1a('0x2f')](_[_0x6e1a('0x39')](_0x2c90e5[_0x6e1a('0x2d')],_0x1f74b5['filters']),_0x3da138);if(_0x2c90e5[_0x6e1a('0x2d')]['filter']){_0xa6ad0[_0x6e1a('0x3a')]=_[_0x6e1a('0x3b')](_0xa6ad0[_0x6e1a('0x3a')],{'$or':_['map'](_0x3da138,function(_0x1604a0){if(_0x1604a0[_0x6e1a('0x2a')]!=='VIRTUAL'){var _0x28fccb={};_0x28fccb[_0x1604a0[_0x6e1a('0x25')]]={'$like':'%'+_0x2c90e5[_0x6e1a('0x2d')][_0x6e1a('0x3c')]+'%'};return _0x28fccb;}})});}_0xa6ad0=_[_0x6e1a('0x3b')]({},_0xa6ad0,_0x2c90e5[_0x6e1a('0x3d')]);var _0x29627e={'where':_0xa6ad0[_0x6e1a('0x3a')]};return db[_0x6e1a('0x3e')][_0x6e1a('0x1b')](_0x29627e)['then'](function(_0x3d1bcc){_0x22e7bc['count']=_0x3d1bcc;if(_0x2c90e5['query'][_0x6e1a('0x3f')]){_0xa6ad0[_0x6e1a('0x40')]=[{'all':!![]}];}return db[_0x6e1a('0x3e')][_0x6e1a('0x41')](_0xa6ad0);})[_0x6e1a('0x20')](function(_0x1ed9f7){_0x22e7bc['rows']=_0x1ed9f7;return _0x22e7bc;})['then'](respondWithFilteredResult(_0x356037,_0xa6ad0))[_0x6e1a('0x42')](handleError(_0x356037,null));};exports[_0x6e1a('0x43')]=function(_0x17a290,_0x17b819){var _0x5f1c04={'raw':![],'where':{'id':_0x17a290['params']['id']}},_0x1c49fa={};_0x1c49fa[_0x6e1a('0x2c')]=_[_0x6e1a('0x2e')](db[_0x6e1a('0x3e')][_0x6e1a('0x28')]);_0x1c49fa['query']=_['keys'](_0x17a290['query']);_0x1c49fa[_0x6e1a('0x2f')]=_[_0x6e1a('0x30')](_0x1c49fa[_0x6e1a('0x2c')],_0x1c49fa['query']);_0x5f1c04['attributes']=_[_0x6e1a('0x30')](_0x1c49fa[_0x6e1a('0x2c')],qs[_0x6e1a('0x32')](_0x17a290[_0x6e1a('0x2d')][_0x6e1a('0x32')]));_0x5f1c04[_0x6e1a('0x31')]=_0x5f1c04[_0x6e1a('0x31')]['length']?_0x5f1c04[_0x6e1a('0x31')]:_0x1c49fa[_0x6e1a('0x2c')];if(_0x17a290[_0x6e1a('0x2d')][_0x6e1a('0x3f')]){_0x5f1c04['include']=[{'all':!![]}];}_0x5f1c04=_[_0x6e1a('0x3b')]({},_0x5f1c04,_0x17a290[_0x6e1a('0x3d')]);return db['Schedule'][_0x6e1a('0x44')](_0x5f1c04)[_0x6e1a('0x20')](handleEntityNotFound(_0x17b819,null))['then'](respondWithResult(_0x17b819,null))[_0x6e1a('0x42')](handleError(_0x17b819,null));};exports['create']=function(_0x58210d,_0x8c1df){return db['Schedule']['create'](_0x58210d[_0x6e1a('0x45')],{})['then'](function(_0x5e372b){var _0x556e8d=_0x58210d[_0x6e1a('0x46')][_0x6e1a('0x22')]({'plain':!![]});if(!_0x556e8d)throw new Error(_0x6e1a('0x47'));if(_0x556e8d[_0x6e1a('0x48')]===_0x6e1a('0x46')){var _0x4782f9=_0x5e372b[_0x6e1a('0x22')]({'plain':!![]});var _0x5ef864='Scheduler';return db[_0x6e1a('0x49')]['find']({'where':{'name':_0x5ef864,'userProfileId':_0x556e8d[_0x6e1a('0x4a')]},'raw':!![]})[_0x6e1a('0x20')](function(_0x57fedb){if(_0x57fedb&&_0x57fedb[_0x6e1a('0x4b')]===0x0){return db[_0x6e1a('0x4c')][_0x6e1a('0x4d')]({'name':_0x4782f9[_0x6e1a('0x25')],'resourceId':_0x4782f9['id'],'type':_0x57fedb['name'],'sectionId':_0x57fedb['id']},{})[_0x6e1a('0x20')](function(){return _0x5e372b;});}else{return _0x5e372b;}})[_0x6e1a('0x42')](function(_0x4ebaca){logger[_0x6e1a('0x23')](_0x6e1a('0x4e'),_0x4ebaca);throw _0x4ebaca;});}return _0x5e372b;})[_0x6e1a('0x20')](respondWithResult(_0x8c1df,0xc9))[_0x6e1a('0x42')](handleError(_0x8c1df,null));};exports[_0x6e1a('0x1f')]=function(_0x1d4e86,_0x1a18bd){if(_0x1d4e86['body']['id']){delete _0x1d4e86['body']['id'];}return db[_0x6e1a('0x3e')]['find']({'where':{'id':_0x1d4e86[_0x6e1a('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1a18bd,null))[_0x6e1a('0x20')](saveUpdates(_0x1d4e86[_0x6e1a('0x45')],null))[_0x6e1a('0x20')](respondWithResult(_0x1a18bd,null))['catch'](handleError(_0x1a18bd,null));};exports[_0x6e1a('0x21')]=function(_0x3f93fc,_0x120242){return db[_0x6e1a('0x3e')][_0x6e1a('0x44')]({'where':{'id':_0x3f93fc[_0x6e1a('0x4f')]['id']}})[_0x6e1a('0x20')](handleEntityNotFound(_0x120242,null))['then'](removeEntity(_0x120242,null))[_0x6e1a('0x42')](handleError(_0x120242,null));};exports[_0x6e1a('0x50')]=function(_0x9a0b0e,_0x259aa8,_0x5ed40d){var _0x28ef34=require(_0x6e1a('0x51'));return db['Schedule'][_0x6e1a('0x44')]({'where':{'id':_0x9a0b0e[_0x6e1a('0x4f')]['id']},'raw':!![]})[_0x6e1a('0x20')](handleEntityNotFound(_0x259aa8,null))['then'](function(){_0x28ef34[_0x6e1a('0x50')](_0x9a0b0e[_0x6e1a('0x4f')]['id']);})['then'](respondWithStatusCode(_0x259aa8,null))[_0x6e1a('0x42')](handleError(_0x259aa8,null));}; \ No newline at end of file +var _0xf893=['end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','get','Scheduler','stack','name','send','map','Schedule','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0xf74fc1,_0x3b7c51){var _0x94a8a9=function(_0x424790){while(--_0x424790){_0xf74fc1['push'](_0xf74fc1['shift']());}};_0x94a8a9(++_0x3b7c51);}(_0xf893,0x17e));var _0x3f89=function(_0x1db5ab,_0xca7451){_0x1db5ab=_0x1db5ab-0x0;var _0x12dbad=_0xf893[_0x1db5ab];return _0x12dbad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f89('0x0'));var zipdir=require(_0x3f89('0x1'));var jsonpatch=require(_0x3f89('0x2'));var rp=require('request-promise');var moment=require(_0x3f89('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3f89('0x4'));var path=require(_0x3f89('0x5'));var sox=require(_0x3f89('0x6'));var csv=require(_0x3f89('0x7'));var ejs=require(_0x3f89('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3f89('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3f89('0xa'));var toCsv=require(_0x3f89('0x7'));var querystring=require('querystring');var Papa=require(_0x3f89('0xb'));var Redis=require(_0x3f89('0xc'));var authService=require(_0x3f89('0xd'));var qs=require(_0x3f89('0xe'));var as=require(_0x3f89('0xf'));var hardwareService=require(_0x3f89('0x10'));var logger=require(_0x3f89('0x11'))('api');var utils=require(_0x3f89('0x12'));var config=require(_0x3f89('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f89('0x14'))['db'];function respondWithStatusCode(_0x152745,_0x7526e2){_0x7526e2=_0x7526e2||0xcc;return function(_0x37a319){if(_0x37a319){return _0x152745[_0x3f89('0x15')](_0x7526e2);}return _0x152745[_0x3f89('0x16')](_0x7526e2)[_0x3f89('0x17')]();};}function respondWithResult(_0x2d466a,_0x364a51){_0x364a51=_0x364a51||0xc8;return function(_0x4e269f){if(_0x4e269f){return _0x2d466a[_0x3f89('0x16')](_0x364a51)[_0x3f89('0x18')](_0x4e269f);}};}function respondWithFilteredResult(_0x1f3e93,_0x1b5b44){return function(_0x5b21d6){if(_0x5b21d6){var _0x50def9=typeof _0x1b5b44['offset']===_0x3f89('0x19')&&typeof _0x1b5b44[_0x3f89('0x1a')]===_0x3f89('0x19');var _0x771f73=_0x5b21d6['count'];var _0x5e3804=_0x50def9?0x0:_0x1b5b44[_0x3f89('0x1b')];var _0x216caa=_0x50def9?_0x5b21d6[_0x3f89('0x1c')]:_0x1b5b44['offset']+_0x1b5b44[_0x3f89('0x1a')];var _0x4a0c4f;if(_0x216caa>=_0x771f73){_0x216caa=_0x771f73;_0x4a0c4f=0xc8;}else{_0x4a0c4f=0xce;}_0x1f3e93[_0x3f89('0x16')](_0x4a0c4f);return _0x1f3e93[_0x3f89('0x1d')](_0x3f89('0x1e'),_0x5e3804+'-'+_0x216caa+'/'+_0x771f73)[_0x3f89('0x18')](_0x5b21d6);}return null;};}function patchUpdates(_0x445e43){return function(_0x19c2d1){try{jsonpatch[_0x3f89('0x1f')](_0x19c2d1,_0x445e43,!![]);}catch(_0x1a83a5){return BPromise[_0x3f89('0x20')](_0x1a83a5);}return _0x19c2d1['save']();};}function saveUpdates(_0x5db391,_0x1ca650){return function(_0x31c28e){if(_0x31c28e){return _0x31c28e[_0x3f89('0x21')](_0x5db391)[_0x3f89('0x22')](function(_0xe4ab90){return _0xe4ab90;});}return null;};}function removeEntity(_0x45bd8a,_0x2c2df3){return function(_0x1bb372){if(_0x1bb372){return _0x1bb372[_0x3f89('0x23')]()[_0x3f89('0x22')](function(){var _0x5b2640=_0x1bb372[_0x3f89('0x24')]({'plain':!![]});var _0x36de10=_0x3f89('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x36de10,'resourceId':_0x5b2640['id']}})[_0x3f89('0x22')](function(){return _0x1bb372;});})['then'](function(){_0x45bd8a['status'](0xcc)[_0x3f89('0x17')]();});}};}function handleEntityNotFound(_0x138d96,_0x208e2f){return function(_0x493843){if(!_0x493843){_0x138d96[_0x3f89('0x15')](0x194);}return _0x493843;};}function handleError(_0x4d786e,_0x350e2b){_0x350e2b=_0x350e2b||0x1f4;return function(_0x150b27){logger['error'](_0x150b27[_0x3f89('0x26')]);if(_0x150b27[_0x3f89('0x27')]){delete _0x150b27[_0x3f89('0x27')];}_0x4d786e[_0x3f89('0x16')](_0x350e2b)[_0x3f89('0x28')](_0x150b27);};}exports['index']=function(_0x3aeaa6,_0x3d32c3){var _0x1b4571={},_0x5ccc90={},_0x39628d={'count':0x0,'rows':[]};var _0x23ffdb=_[_0x3f89('0x29')](db[_0x3f89('0x2a')][_0x3f89('0x2b')],function(_0x5b3887){return{'name':_0x5b3887[_0x3f89('0x2c')],'type':_0x5b3887[_0x3f89('0x2d')][_0x3f89('0x2e')]};});_0x5ccc90[_0x3f89('0x2f')]=_['map'](_0x23ffdb,_0x3f89('0x27'));_0x5ccc90[_0x3f89('0x30')]=_[_0x3f89('0x31')](_0x3aeaa6[_0x3f89('0x30')]);_0x5ccc90[_0x3f89('0x32')]=_[_0x3f89('0x33')](_0x5ccc90['model'],_0x5ccc90[_0x3f89('0x30')]);_0x1b4571[_0x3f89('0x34')]=_[_0x3f89('0x33')](_0x5ccc90[_0x3f89('0x2f')],qs['fields'](_0x3aeaa6['query']['fields']));_0x1b4571['attributes']=_0x1b4571[_0x3f89('0x34')][_0x3f89('0x35')]?_0x1b4571['attributes']:_0x5ccc90[_0x3f89('0x2f')];if(!_0x3aeaa6[_0x3f89('0x30')][_0x3f89('0x36')]('nolimit')){_0x1b4571[_0x3f89('0x1a')]=qs[_0x3f89('0x1a')](_0x3aeaa6[_0x3f89('0x30')][_0x3f89('0x1a')]);_0x1b4571['offset']=qs[_0x3f89('0x1b')](_0x3aeaa6['query'][_0x3f89('0x1b')]);}_0x1b4571[_0x3f89('0x37')]=qs[_0x3f89('0x38')](_0x3aeaa6[_0x3f89('0x30')][_0x3f89('0x38')]);_0x1b4571[_0x3f89('0x39')]=qs[_0x3f89('0x32')](_[_0x3f89('0x3a')](_0x3aeaa6[_0x3f89('0x30')],_0x5ccc90[_0x3f89('0x32')]),_0x23ffdb);if(_0x3aeaa6[_0x3f89('0x30')][_0x3f89('0x3b')]){_0x1b4571['where']=_['merge'](_0x1b4571[_0x3f89('0x39')],{'$or':_[_0x3f89('0x29')](_0x23ffdb,function(_0x4e795a){if(_0x4e795a[_0x3f89('0x2d')]!=='VIRTUAL'){var _0x323224={};_0x323224[_0x4e795a[_0x3f89('0x27')]]={'$like':'%'+_0x3aeaa6['query'][_0x3f89('0x3b')]+'%'};return _0x323224;}})});}_0x1b4571=_[_0x3f89('0x3c')]({},_0x1b4571,_0x3aeaa6[_0x3f89('0x3d')]);var _0x3f1f09={'where':_0x1b4571[_0x3f89('0x39')]};return db['Schedule'][_0x3f89('0x1c')](_0x3f1f09)[_0x3f89('0x22')](function(_0x580c5e){_0x39628d['count']=_0x580c5e;if(_0x3aeaa6[_0x3f89('0x30')][_0x3f89('0x3e')]){_0x1b4571[_0x3f89('0x3f')]=[{'all':!![]}];}return db[_0x3f89('0x2a')][_0x3f89('0x40')](_0x1b4571);})[_0x3f89('0x22')](function(_0x2d7fc0){_0x39628d[_0x3f89('0x41')]=_0x2d7fc0;return _0x39628d;})['then'](respondWithFilteredResult(_0x3d32c3,_0x1b4571))[_0x3f89('0x42')](handleError(_0x3d32c3,null));};exports['show']=function(_0x3cecc7,_0x566e18){var _0x4e8810={'raw':![],'where':{'id':_0x3cecc7[_0x3f89('0x43')]['id']}},_0x1f41f6={};_0x1f41f6['model']=_[_0x3f89('0x31')](db[_0x3f89('0x2a')][_0x3f89('0x2b')]);_0x1f41f6[_0x3f89('0x30')]=_[_0x3f89('0x31')](_0x3cecc7['query']);_0x1f41f6[_0x3f89('0x32')]=_[_0x3f89('0x33')](_0x1f41f6[_0x3f89('0x2f')],_0x1f41f6[_0x3f89('0x30')]);_0x4e8810[_0x3f89('0x34')]=_[_0x3f89('0x33')](_0x1f41f6['model'],qs['fields'](_0x3cecc7['query'][_0x3f89('0x44')]));_0x4e8810[_0x3f89('0x34')]=_0x4e8810[_0x3f89('0x34')][_0x3f89('0x35')]?_0x4e8810[_0x3f89('0x34')]:_0x1f41f6[_0x3f89('0x2f')];if(_0x3cecc7[_0x3f89('0x30')][_0x3f89('0x3e')]){_0x4e8810[_0x3f89('0x3f')]=[{'all':!![]}];}_0x4e8810=_['merge']({},_0x4e8810,_0x3cecc7['options']);return db[_0x3f89('0x2a')][_0x3f89('0x45')](_0x4e8810)[_0x3f89('0x22')](handleEntityNotFound(_0x566e18,null))[_0x3f89('0x22')](respondWithResult(_0x566e18,null))['catch'](handleError(_0x566e18,null));};exports['create']=function(_0x226370,_0x37d64e){return db[_0x3f89('0x2a')][_0x3f89('0x46')](_0x226370[_0x3f89('0x47')],{})[_0x3f89('0x22')](function(_0x12b496){var _0xce1609=_0x226370['user'][_0x3f89('0x24')]({'plain':!![]});if(!_0xce1609)throw new Error(_0x3f89('0x48'));if(_0xce1609[_0x3f89('0x49')]===_0x3f89('0x4a')){var _0x32b4d6=_0x12b496[_0x3f89('0x24')]({'plain':!![]});var _0x3124da='Scheduler';return db[_0x3f89('0x4b')]['find']({'where':{'name':_0x3124da,'userProfileId':_0xce1609[_0x3f89('0x4c')]},'raw':!![]})[_0x3f89('0x22')](function(_0x4f6c58){if(_0x4f6c58&&_0x4f6c58[_0x3f89('0x4d')]===0x0){return db[_0x3f89('0x4e')]['create']({'name':_0x32b4d6[_0x3f89('0x27')],'resourceId':_0x32b4d6['id'],'type':_0x4f6c58[_0x3f89('0x27')],'sectionId':_0x4f6c58['id']},{})[_0x3f89('0x22')](function(){return _0x12b496;});}else{return _0x12b496;}})['catch'](function(_0x19bd64){logger['error'](_0x3f89('0x4f'),_0x19bd64);throw _0x19bd64;});}return _0x12b496;})[_0x3f89('0x22')](respondWithResult(_0x37d64e,0xc9))['catch'](handleError(_0x37d64e,null));};exports['update']=function(_0x3bf8de,_0x496018){if(_0x3bf8de[_0x3f89('0x47')]['id']){delete _0x3bf8de[_0x3f89('0x47')]['id'];}return db[_0x3f89('0x2a')][_0x3f89('0x45')]({'where':{'id':_0x3bf8de[_0x3f89('0x43')]['id']}})['then'](handleEntityNotFound(_0x496018,null))[_0x3f89('0x22')](saveUpdates(_0x3bf8de[_0x3f89('0x47')],null))[_0x3f89('0x22')](respondWithResult(_0x496018,null))[_0x3f89('0x42')](handleError(_0x496018,null));};exports[_0x3f89('0x23')]=function(_0x867193,_0xa07c62){return db[_0x3f89('0x2a')][_0x3f89('0x45')]({'where':{'id':_0x867193[_0x3f89('0x43')]['id']}})[_0x3f89('0x22')](handleEntityNotFound(_0xa07c62,null))[_0x3f89('0x22')](removeEntity(_0xa07c62,null))[_0x3f89('0x42')](handleError(_0xa07c62,null));};exports[_0x3f89('0x50')]=function(_0x258214,_0x4e63ab,_0x5522ab){var _0x43547e=require('../../config/schedule');return db['Schedule'][_0x3f89('0x45')]({'where':{'id':_0x258214[_0x3f89('0x43')]['id']},'raw':!![]})[_0x3f89('0x22')](handleEntityNotFound(_0x4e63ab,null))[_0x3f89('0x22')](function(){_0x43547e[_0x3f89('0x50')](_0x258214[_0x3f89('0x43')]['id']);})[_0x3f89('0x22')](respondWithStatusCode(_0x4e63ab,null))[_0x3f89('0x42')](handleError(_0x4e63ab,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 4b6c6e2..1699ca6 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 _0x511f=['exports','define','Schedule','tools_schedules','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x300c68,_0xba84a8){var _0x3ad115=function(_0x29c060){while(--_0x29c060){_0x300c68['push'](_0x300c68['shift']());}};_0x3ad115(++_0xba84a8);}(_0x511f,0x1a6));var _0xf511=function(_0x3bac17,_0x59fd74){_0x3bac17=_0x3bac17-0x0;var _0x258e65=_0x511f[_0x3bac17];return _0x258e65;};'use strict';var _=require('lodash');var util=require(_0xf511('0x0'));var logger=require(_0xf511('0x1'))(_0xf511('0x2'));var moment=require(_0xf511('0x3'));var BPromise=require(_0xf511('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf511('0x5'));var config=require(_0xf511('0x6'));var attributes=require('./schedule.attributes');module[_0xf511('0x7')]=function(_0x33fa92,_0x340b8a){return _0x33fa92[_0xf511('0x8')](_0xf511('0x9'),attributes,{'tableName':_0xf511('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe752=['exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xe752,0xba));var _0x2e75=function(_0x4d42eb,_0x1b7ed4){_0x4d42eb=_0x4d42eb-0x0;var _0xd477da=_0xe752[_0x4d42eb];return _0xd477da;};'use strict';var _=require(_0x2e75('0x0'));var util=require(_0x2e75('0x1'));var logger=require(_0x2e75('0x2'))(_0x2e75('0x3'));var moment=require(_0x2e75('0x4'));var BPromise=require(_0x2e75('0x5'));var rp=require(_0x2e75('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e75('0x7'));var config=require(_0x2e75('0x8'));var attributes=require('./schedule.attributes');module[_0x2e75('0x9')]=function(_0xf2908a,_0xfcd541){return _0xf2908a[_0x2e75('0xa')](_0x2e75('0xb'),attributes,{'tableName':_0x2e75('0xc'),'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 9a61ff8..9a2078a 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 _0x087d=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','error','code','result','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1f723d,_0x234fd6){var _0x17cd8c=function(_0x4c00f0){while(--_0x4c00f0){_0x1f723d['push'](_0x1f723d['shift']());}};_0x17cd8c(++_0x234fd6);}(_0x087d,0xf6));var _0xd087=function(_0x134b75,_0x5c2215){_0x134b75=_0x134b75-0x0;var _0x6cabf=_0x087d[_0x134b75];return _0x6cabf;};'use strict';var _=require(_0xd087('0x0'));var util=require(_0xd087('0x1'));var moment=require(_0xd087('0x2'));var BPromise=require(_0xd087('0x3'));var rs=require(_0xd087('0x4'));var fs=require('fs');var Redis=require(_0xd087('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd087('0x6'))(_0xd087('0x7'));var config=require(_0xd087('0x8'));var jayson=require(_0xd087('0x9'));var client=jayson['client'][_0xd087('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46109c,_0x11b7de,_0x1b676d){return new BPromise(function(_0x1d7c91,_0x596477){return client['request'](_0x46109c,_0x1b676d)[_0xd087('0xb')](function(_0x511fd0){logger[_0xd087('0xc')](_0xd087('0xd'),_0x11b7de,_0xd087('0xe'));logger[_0xd087('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x11b7de,_0xd087('0xe'),JSON['stringify'](_0x511fd0));if(_0x511fd0[_0xd087('0x10')]){if(_0x511fd0[_0xd087('0x10')][_0xd087('0x11')]===0x1f4){logger[_0xd087('0x10')]('Schedule,\x20%s,\x20%s',_0x11b7de,_0x511fd0['error']['message']);return _0x596477(_0x511fd0[_0xd087('0x10')]['message']);}logger[_0xd087('0x10')](_0xd087('0xd'),_0x11b7de,_0x511fd0[_0xd087('0x10')]['message']);return _0x1d7c91(_0x511fd0[_0xd087('0x10')]['message']);}else{logger['info'](_0xd087('0xd'),_0x11b7de,_0xd087('0xe'));_0x1d7c91(_0x511fd0[_0xd087('0x12')][_0xd087('0x13')]);}})[_0xd087('0x14')](function(_0xf34643){logger['error'](_0xd087('0xd'),_0x11b7de,_0xf34643);_0x596477(_0xf34643);});});} \ No newline at end of file +var _0xbaf6=['jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xbaf6,0x6b));var _0x6baf=function(_0x26d016,_0x14d83d){_0x26d016=_0x26d016-0x0;var _0x14bdbb=_0xbaf6[_0x26d016];return _0x14bdbb;};'use strict';var _=require(_0x6baf('0x0'));var util=require(_0x6baf('0x1'));var moment=require(_0x6baf('0x2'));var BPromise=require(_0x6baf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6baf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6baf('0x5'));var logger=require(_0x6baf('0x6'))(_0x6baf('0x7'));var config=require('../../config/environment');var jayson=require(_0x6baf('0x8'));var client=jayson[_0x6baf('0x9')][_0x6baf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4415a7,_0x3f9782,_0x2cfad1){return new BPromise(function(_0x43a61a,_0x1c2cb3){return client[_0x6baf('0xb')](_0x4415a7,_0x2cfad1)[_0x6baf('0xc')](function(_0x275ac9){logger[_0x6baf('0xd')](_0x6baf('0xe'),_0x3f9782,_0x6baf('0xf'));logger[_0x6baf('0x10')](_0x6baf('0x11'),_0x3f9782,'request\x20sent',JSON[_0x6baf('0x12')](_0x275ac9));if(_0x275ac9[_0x6baf('0x13')]){if(_0x275ac9[_0x6baf('0x13')][_0x6baf('0x14')]===0x1f4){logger[_0x6baf('0x13')]('Schedule,\x20%s,\x20%s',_0x3f9782,_0x275ac9[_0x6baf('0x13')]['message']);return _0x1c2cb3(_0x275ac9['error']['message']);}logger[_0x6baf('0x13')]('Schedule,\x20%s,\x20%s',_0x3f9782,_0x275ac9[_0x6baf('0x13')][_0x6baf('0x15')]);return _0x43a61a(_0x275ac9[_0x6baf('0x13')][_0x6baf('0x15')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x3f9782,_0x6baf('0xf'));_0x43a61a(_0x275ac9[_0x6baf('0x16')]['message']);}})['catch'](function(_0x4079d5){logger['error']('Schedule,\x20%s,\x20%s',_0x3f9782,_0x4079d5);_0x1c2cb3(_0x4079d5);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index d3311c7..858c947 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 _0x0917=['/describe','describe','/:id','download','post','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','isAuthenticated','index','get'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0917,0x105));var _0x7091=function(_0x54da5b,_0x12fd71){_0x54da5b=_0x54da5b-0x0;var _0x285d3b=_0x0917[_0x54da5b];return _0x285d3b;};'use strict';var multer=require(_0x7091('0x0'));var util=require(_0x7091('0x1'));var path=require(_0x7091('0x2'));var timeout=require(_0x7091('0x3'));var express=require(_0x7091('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7091('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./screenRecording.controller');router['get']('/',auth[_0x7091('0x6')](),controller[_0x7091('0x7')]);router[_0x7091('0x8')](_0x7091('0x9'),auth['isAuthenticated'](),controller[_0x7091('0xa')]);router['get'](_0x7091('0xb'),auth[_0x7091('0x6')](),controller['show']);router[_0x7091('0x8')]('/:id/download',auth[_0x7091('0x6')](),controller[_0x7091('0xc')]);router[_0x7091('0xd')]('/',auth[_0x7091('0x6')](),controller['create']);router['put'](_0x7091('0xb'),auth[_0x7091('0x6')](),controller['update']);router['delete']('/:id',auth[_0x7091('0x6')](),controller[_0x7091('0xe')]);module['exports']=router; \ No newline at end of file +var _0xedd0=['download','post','create','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','/:id','show','/:id/download'];(function(_0x58e00d,_0xa819cb){var _0x39fa3b=function(_0x507b38){while(--_0x507b38){_0x58e00d['push'](_0x58e00d['shift']());}};_0x39fa3b(++_0xa819cb);}(_0xedd0,0x110));var _0x0edd=function(_0x4c05cc,_0x4432e2){_0x4c05cc=_0x4c05cc-0x0;var _0x5a2254=_0xedd0[_0x4c05cc];return _0x5a2254;};'use strict';var multer=require('multer');var util=require(_0x0edd('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0edd('0x1'));var router=express[_0x0edd('0x2')]();var fs_extra=require(_0x0edd('0x3'));var auth=require(_0x0edd('0x4'));var interaction=require(_0x0edd('0x5'));var config=require(_0x0edd('0x6'));var controller=require('./screenRecording.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0edd('0x7')]);router[_0x0edd('0x8')](_0x0edd('0x9'),auth[_0x0edd('0xa')](),controller['describe']);router[_0x0edd('0x8')](_0x0edd('0xb'),auth[_0x0edd('0xa')](),controller[_0x0edd('0xc')]);router[_0x0edd('0x8')](_0x0edd('0xd'),auth['isAuthenticated'](),controller[_0x0edd('0xe')]);router[_0x0edd('0xf')]('/',auth[_0x0edd('0xa')](),controller[_0x0edd('0x10')]);router[_0x0edd('0x11')](_0x0edd('0xb'),auth[_0x0edd('0xa')](),controller[_0x0edd('0x12')]);router[_0x0edd('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x0edd('0x14')]);module[_0x0edd('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 1177a9a..c8dd184 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 _0x8a87=['../../config/environment','VIRTUAL','getDataValue','value','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','DATE','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','updatedAt','sequelize'];(function(_0x491a7c,_0xa7430f){var _0x1d5c46=function(_0x5112b3){while(--_0x5112b3){_0x491a7c['push'](_0x491a7c['shift']());}};_0x1d5c46(++_0xa7430f);}(_0x8a87,0x6b));var _0x78a8=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x8a87[_0x12bcf7];return _0x2825a;};'use strict';var Sequelize=require(_0x78a8('0x0'));var moment=require('moment');var path=require('path');var config=require(_0x78a8('0x1'));module['exports']={'format':{'type':Sequelize[_0x78a8('0x2')],'get':function(){return this[_0x78a8('0x3')](_0x78a8('0x4'))?path['extname'](this[_0x78a8('0x3')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x78a8('0x5')]},'value':{'type':Sequelize[_0x78a8('0x5')],'set':function(_0x285f95){var _0x1d8888=_0x285f95[_0x78a8('0x6')](/\\/g,'/');this['setDataValue'](_0x78a8('0x4'),_0x1d8888);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x78a8('0x7')],'set':function(_0x48c013){this[_0x78a8('0x8')](_0x78a8('0x9'),moment()[_0x78a8('0xa')](_0x48c013,'ms'));this[_0x78a8('0x8')](_0x78a8('0xb'),moment());this['setDataValue']('duration',_0x48c013);}},'startedAt':{'type':Sequelize[_0x78a8('0xc')],'get':function(){return moment(this[_0x78a8('0x3')](_0x78a8('0x9')))['format'](_0x78a8('0xd'))[_0x78a8('0xe')]();}},'closedAt':{'type':Sequelize[_0x78a8('0xc')],'get':function(){return moment(this[_0x78a8('0x3')]('closedAt'))[_0x78a8('0xf')](_0x78a8('0xd'))[_0x78a8('0xe')]();}},'createdAt':{'type':Sequelize[_0x78a8('0xc')],'get':function(){return moment(this[_0x78a8('0x3')](_0x78a8('0x10')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0x78a8('0xc')],'get':function(){return moment(this[_0x78a8('0x3')](_0x78a8('0x11')))[_0x78a8('0xf')](_0x78a8('0xd'))['toString']();}}}; \ No newline at end of file +var _0xe8e8=['sequelize','moment','exports','VIRTUAL','extname','value','STRING','setDataValue','INTEGER','startedAt','closedAt','duration','getDataValue','format','MM-DD-YYYY\x20HH:mm','toString','DATE','updatedAt'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xe8e8,0xc6));var _0x8e8e=function(_0x35fc07,_0x355908){_0x35fc07=_0x35fc07-0x0;var _0xf0f24=_0xe8e8[_0x35fc07];return _0xf0f24;};'use strict';var Sequelize=require(_0x8e8e('0x0'));var moment=require(_0x8e8e('0x1'));var path=require('path');var config=require('../../config/environment');module[_0x8e8e('0x2')]={'format':{'type':Sequelize[_0x8e8e('0x3')],'get':function(){return this['getDataValue']('value')?path[_0x8e8e('0x4')](this['getDataValue'](_0x8e8e('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x8e8e('0x6')]},'channel':{'type':Sequelize[_0x8e8e('0x6')]},'value':{'type':Sequelize[_0x8e8e('0x6')],'set':function(_0x559147){var _0x2d5ad4=_0x559147['replace'](/\\/g,'/');this[_0x8e8e('0x7')](_0x8e8e('0x5'),_0x2d5ad4);}},'rating':{'type':Sequelize[_0x8e8e('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x8e8e('0x8')],'set':function(_0x40be2d){this[_0x8e8e('0x7')](_0x8e8e('0x9'),moment()['subtract'](_0x40be2d,'ms'));this[_0x8e8e('0x7')](_0x8e8e('0xa'),moment());this[_0x8e8e('0x7')](_0x8e8e('0xb'),_0x40be2d);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8e8e('0xc')](_0x8e8e('0x9')))[_0x8e8e('0xd')](_0x8e8e('0xe'))[_0x8e8e('0xf')]();}},'closedAt':{'type':Sequelize[_0x8e8e('0x10')],'get':function(){return moment(this[_0x8e8e('0xc')](_0x8e8e('0xa')))[_0x8e8e('0xd')](_0x8e8e('0xe'))['toString']();}},'createdAt':{'type':Sequelize[_0x8e8e('0x10')],'get':function(){return moment(this[_0x8e8e('0xc')]('createdAt'))[_0x8e8e('0xd')](_0x8e8e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x8e8e('0x10')],'get':function(){return moment(this[_0x8e8e('0xc')](_0x8e8e('0x11')))[_0x8e8e('0xd')](_0x8e8e('0xe'))[_0x8e8e('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 3eb49fa..4d22577 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 _0x9c5a=['ScreenRecording','includeAll','findAll','rows','catch','params','include','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','decryptFile','recording','existsSync','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','stack','name','send','map','rawAttributes','fieldName','key','model','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x5ac03e,_0x37bcd8){_0x5ac03e=_0x5ac03e-0x0;var _0x417ef9=_0x9c5a[_0x5ac03e];return _0x417ef9;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)[_0xa9c5('0x18')]();});}};}function handleEntityNotFound(_0x32fc7d,_0x4cbba1){return function(_0x40f08b){if(!_0x40f08b){_0x32fc7d[_0xa9c5('0x17')](0x194);}return _0x40f08b;};}function handleError(_0x51b64a,_0x4e8a7f){_0x4e8a7f=_0x4e8a7f||0x1f4;return function(_0x242771){logger['error'](_0x242771[_0xa9c5('0x25')]);if(_0x242771[_0xa9c5('0x26')]){delete _0x242771['name'];}_0x51b64a[_0xa9c5('0x19')](_0x4e8a7f)[_0xa9c5('0x27')](_0x242771);};}exports['index']=function(_0x413edf,_0x32baf9){var _0x198cdf={},_0x185eb8={},_0x325c65={'count':0x0,'rows':[]};var _0x4f6e70=_[_0xa9c5('0x28')](db['ScreenRecording'][_0xa9c5('0x29')],function(_0x1ef388){return{'name':_0x1ef388[_0xa9c5('0x2a')],'type':_0x1ef388['type'][_0xa9c5('0x2b')]};});_0x185eb8[_0xa9c5('0x2c')]=_['differenceBy'](_[_0xa9c5('0x28')](_0x4f6e70,_0xa9c5('0x26')),[_0xa9c5('0x2d')]);_0x185eb8[_0xa9c5('0x2e')]=_[_0xa9c5('0x2f')](_0x413edf[_0xa9c5('0x2e')]);_0x185eb8[_0xa9c5('0x30')]=_['intersection'](_0x185eb8[_0xa9c5('0x2c')],_0x185eb8[_0xa9c5('0x2e')]);_0x198cdf[_0xa9c5('0x31')]=_[_0xa9c5('0x32')](_0x185eb8[_0xa9c5('0x2c')],qs[_0xa9c5('0x33')](_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x33')]));_0x198cdf['attributes']=_0x198cdf['attributes'][_0xa9c5('0x34')]?_0x198cdf[_0xa9c5('0x31')]:_0x185eb8[_0xa9c5('0x2c')];if(!_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x35')](_0xa9c5('0x36'))){_0x198cdf['limit']=qs['limit'](_0x413edf['query'][_0xa9c5('0x1c')]);_0x198cdf[_0xa9c5('0x1e')]=qs['offset'](_0x413edf[_0xa9c5('0x2e')]['offset']);}_0x198cdf[_0xa9c5('0x37')]=qs[_0xa9c5('0x38')](_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x38')]);_0x198cdf['where']=qs[_0xa9c5('0x30')](_[_0xa9c5('0x39')](_0x413edf[_0xa9c5('0x2e')],_0x185eb8[_0xa9c5('0x30')]),_0x4f6e70);if(_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x3a')]){_0x198cdf[_0xa9c5('0x3b')]=_[_0xa9c5('0x3c')](_0x198cdf['where'],{'$or':_[_0xa9c5('0x28')](_0x4f6e70,function(_0x46e5d2){if(_0x46e5d2[_0xa9c5('0x3d')]!==_0xa9c5('0x3e')){var _0x1132e0={};_0x1132e0[_0x46e5d2[_0xa9c5('0x26')]]={'$like':'%'+_0x413edf['query'][_0xa9c5('0x3a')]+'%'};return _0x1132e0;}})});}_0x198cdf=_['merge']({},_0x198cdf,_0x413edf[_0xa9c5('0x3f')]);var _0x5c89e7={'where':_0x198cdf[_0xa9c5('0x3b')]};return db[_0xa9c5('0x40')][_0xa9c5('0x1d')](_0x5c89e7)['then'](function(_0x12e19c){_0x325c65[_0xa9c5('0x1d')]=_0x12e19c;if(_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x41')]){_0x198cdf['include']=[{'all':!![]}];}return db[_0xa9c5('0x40')][_0xa9c5('0x42')](_0x198cdf);})[_0xa9c5('0x24')](function(_0x45668e){_0x325c65[_0xa9c5('0x43')]=_0x45668e;return _0x325c65;})['then'](respondWithFilteredResult(_0x32baf9,_0x198cdf))[_0xa9c5('0x44')](handleError(_0x32baf9,null));};exports['show']=function(_0x1de605,_0x397614){var _0x2998ad={'raw':![],'where':{'id':_0x1de605[_0xa9c5('0x45')]['id']}},_0xc8fca4={};_0xc8fca4[_0xa9c5('0x2c')]=_[_0xa9c5('0x2f')](db[_0xa9c5('0x40')][_0xa9c5('0x29')]);_0xc8fca4[_0xa9c5('0x2e')]=_['keys'](_0x1de605[_0xa9c5('0x2e')]);_0xc8fca4[_0xa9c5('0x30')]=_[_0xa9c5('0x32')](_0xc8fca4[_0xa9c5('0x2c')],_0xc8fca4[_0xa9c5('0x2e')]);_0x2998ad[_0xa9c5('0x31')]=_['intersection'](_0xc8fca4[_0xa9c5('0x2c')],qs[_0xa9c5('0x33')](_0x1de605['query']['fields']));_0x2998ad['attributes']=_0x2998ad['attributes']['length']?_0x2998ad[_0xa9c5('0x31')]:_0xc8fca4[_0xa9c5('0x2c')];if(_0x1de605[_0xa9c5('0x2e')][_0xa9c5('0x41')]){_0x2998ad[_0xa9c5('0x46')]=[{'all':!![]}];}_0x2998ad=_[_0xa9c5('0x3c')]({},_0x2998ad,_0x1de605[_0xa9c5('0x3f')]);return db[_0xa9c5('0x40')][_0xa9c5('0x47')](_0x2998ad)[_0xa9c5('0x24')](handleEntityNotFound(_0x397614,null))[_0xa9c5('0x24')](respondWithResult(_0x397614,null))[_0xa9c5('0x44')](handleError(_0x397614,null));};exports[_0xa9c5('0x48')]=function(_0x4bf8b4,_0x1108f0){return db['ScreenRecording'][_0xa9c5('0x48')](_0x4bf8b4[_0xa9c5('0x49')],{})['then'](respondWithResult(_0x1108f0,0xc9))['catch'](handleError(_0x1108f0,null));};exports[_0xa9c5('0x23')]=function(_0x32e64a,_0xeb0720){if(_0x32e64a['body']['id']){delete _0x32e64a['body']['id'];}delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4a')];delete _0x32e64a['body'][_0xa9c5('0x4b')];delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4c')];delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4d')];return db[_0xa9c5('0x40')]['find']({'where':{'id':_0x32e64a['params']['id']}})['then'](handleEntityNotFound(_0xeb0720,null))[_0xa9c5('0x24')](saveUpdates(_0x32e64a[_0xa9c5('0x49')],null))[_0xa9c5('0x24')](respondWithResult(_0xeb0720,null))[_0xa9c5('0x44')](handleError(_0xeb0720,null));};exports[_0xa9c5('0x4e')]=function(_0x15d044,_0x56bc1d){return db[_0xa9c5('0x40')][_0xa9c5('0x4e')]()[_0xa9c5('0x24')](respondWithResult(_0x56bc1d,null))[_0xa9c5('0x44')](handleError(_0x56bc1d,null));};exports[_0xa9c5('0x4f')]=function(_0x242e8a,_0x547654,_0x4fcc44){var _0x10ff6b=require('../../components/encryptor');var _0x1b158f=![];var _0x5ea9b0={};if(_0x242e8a[_0xa9c5('0x2e')][_0xa9c5('0x3d')]&&_0x242e8a[_0xa9c5('0x2e')]['type']===_0xa9c5('0x50')){_0x5ea9b0[_0xa9c5('0x50')]=_0x242e8a[_0xa9c5('0x45')]['id'];}else{_0x5ea9b0['id']=_0x242e8a[_0xa9c5('0x45')]['id'];}return db['ScreenRecording']['find']({'where':_0x5ea9b0,'attributes':['id',_0xa9c5('0x4d')],'raw':!![]})[_0xa9c5('0x24')](handleEntityNotFound(_0x547654,null))[_0xa9c5('0x24')](function(_0x5b4323){if(_0x5b4323){var _0x31e12e=path[_0xa9c5('0x51')](config[_0xa9c5('0x52')],_0xa9c5('0x53'),_0x5b4323[_0xa9c5('0x4d')]);var _0x29b198=util[_0xa9c5('0x2d')](_0xa9c5('0x54'),_0x31e12e);if(fs['existsSync'](_0x29b198)){_0x1b158f=!![];return _0x10ff6b[_0xa9c5('0x55')](_0x29b198,_0x31e12e,config['secrets'][_0xa9c5('0x56')])[_0xa9c5('0x24')](function(){return _0x5b4323;});}return _0x5b4323;}})[_0xa9c5('0x24')](function(_0x4dfe3a){if(_0x4dfe3a){var _0x4d475a=path[_0xa9c5('0x51')](config['root'],_0xa9c5('0x53'),_0x4dfe3a[_0xa9c5('0x4d')]);if(!fs[_0xa9c5('0x57')](_0x4d475a)){throw new db[(_0xa9c5('0x58'))]['ValidationError'](_0xa9c5('0x59'));}if(_0x4dfe3a[_0xa9c5('0x5a')]){return _0x547654[_0xa9c5('0x4f')](_0x4d475a,_0x4dfe3a[_0xa9c5('0x5a')]+path['extname'](_0x4d475a),function(){if(_0x1b158f){fs['unlink'](_0x4d475a);}});}else{return _0x547654[_0xa9c5('0x4f')](_0x4d475a,function(_0x3deb64){if(_0x1b158f){fs[_0xa9c5('0x5b')](_0x4d475a);}});}}})[_0xa9c5('0x44')](function(_0x279a26){if(_0x279a26[_0xa9c5('0x5c')]==='ScreenRecording\x20not\x20found'){_0x547654[_0xa9c5('0x19')](0x194)[_0xa9c5('0x27')](_0xa9c5('0x5d'));}else{return handleError(_0x547654,null);}});};exports[_0xa9c5('0x5e')]=function(_0x2b8575,_0x372ab9){return db[_0xa9c5('0x40')][_0xa9c5('0x47')]({'where':{'id':_0x2b8575[_0xa9c5('0x45')]['id']}})[_0xa9c5('0x24')](function(_0x50d438){if(_['isNil'](_0x50d438)){throw new ReferenceError(_0xa9c5('0x5f'));}return _0x50d438;})[_0xa9c5('0x24')](function(_0x3322cc){var _0x47afaa=path['join'](config[_0xa9c5('0x52')],'server/files/screen_recordings',_0x3322cc[_0xa9c5('0x4d')]);logger[_0xa9c5('0x60')](_0xa9c5('0x61'),_0x47afaa);if(!_[_0xa9c5('0x62')](_0x3322cc[_0xa9c5('0x4d')])&&fs[_0xa9c5('0x57')](_0x47afaa)){logger[_0xa9c5('0x60')](_0xa9c5('0x63')+_0x47afaa+_0xa9c5('0x64'));fs[_0xa9c5('0x65')](_0x47afaa);}_0x47afaa=_0x47afaa+_0xa9c5('0x66');if(!_[_0xa9c5('0x62')](_0x3322cc['value'])&&fs[_0xa9c5('0x57')](_0x47afaa)){logger[_0xa9c5('0x60')](_0xa9c5('0x63')+_0x47afaa+_0xa9c5('0x64'));fs[_0xa9c5('0x65')](_0x47afaa);}return _0x3322cc;})[_0xa9c5('0x24')](function(_0x28ba54){if(!_0x28ba54)throw new InternalError();return _0x28ba54['destroy']();})['then'](function(){_0x372ab9[_0xa9c5('0x19')](0xcc)['end']();})[_0xa9c5('0x44')](handleError(_0x372ab9,null));}; \ No newline at end of file +var _0xe5b3=['info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','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','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','keys','intersection','attributes','fields','query','length','nolimit','order','where','filters','filter','merge','options','include','findAll','rows','catch','show','create','body','duration','createdAt','closedAt','value','find','params','describe','download','uniqueid','join','%s.cypher','existsSync','root','server/files/screen_recordings','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','send','Not\x20found','destroy','Entity\x20not\x20found'];(function(_0xe5fe5e,_0x167a73){var _0x1e73f2=function(_0x29ffe8){while(--_0x29ffe8){_0xe5fe5e['push'](_0xe5fe5e['shift']());}};_0x1e73f2(++_0x167a73);}(_0xe5b3,0x133));var _0x3e5b=function(_0x1c47ef,_0x3f4b40){_0x1c47ef=_0x1c47ef-0x0;var _0x9689a0=_0xe5b3[_0x1c47ef];return _0x9689a0;};'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'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41b684,_0x2f6368){return function(_0x42d7e9){if(!_0x42d7e9){_0x41b684[_0x3e5b('0x19')](0x194);}return _0x42d7e9;};}function handleError(_0x3bb749,_0x26c7f2){_0x26c7f2=_0x26c7f2||0x1f4;return function(_0x160e87){logger[_0x3e5b('0x28')](_0x160e87['stack']);if(_0x160e87[_0x3e5b('0x29')]){delete _0x160e87['name'];}_0x3bb749[_0x3e5b('0x1b')](_0x26c7f2)['send'](_0x160e87);};}exports[_0x3e5b('0x2a')]=function(_0x1f6473,_0x1296ec){var _0x475b39={},_0x10d2ed={},_0x3cfaf6={'count':0x0,'rows':[]};var _0x307091=_[_0x3e5b('0x2b')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')],function(_0x1e1565){return{'name':_0x1e1565['fieldName'],'type':_0x1e1565[_0x3e5b('0x2e')][_0x3e5b('0x2f')]};});_0x10d2ed[_0x3e5b('0x30')]=_[_0x3e5b('0x31')](_[_0x3e5b('0x2b')](_0x307091,_0x3e5b('0x29')),[_0x3e5b('0x32')]);_0x10d2ed['query']=_[_0x3e5b('0x33')](_0x1f6473['query']);_0x10d2ed['filters']=_[_0x3e5b('0x34')](_0x10d2ed[_0x3e5b('0x30')],_0x10d2ed['query']);_0x475b39[_0x3e5b('0x35')]=_[_0x3e5b('0x34')](_0x10d2ed[_0x3e5b('0x30')],qs[_0x3e5b('0x36')](_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x36')]));_0x475b39[_0x3e5b('0x35')]=_0x475b39[_0x3e5b('0x35')][_0x3e5b('0x38')]?_0x475b39[_0x3e5b('0x35')]:_0x10d2ed[_0x3e5b('0x30')];if(!_0x1f6473[_0x3e5b('0x37')]['hasOwnProperty'](_0x3e5b('0x39'))){_0x475b39[_0x3e5b('0x1e')]=qs['limit'](_0x1f6473['query'][_0x3e5b('0x1e')]);_0x475b39['offset']=qs[_0x3e5b('0x20')](_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x20')]);}_0x475b39[_0x3e5b('0x3a')]=qs['sort'](_0x1f6473[_0x3e5b('0x37')]['sort']);_0x475b39[_0x3e5b('0x3b')]=qs['filters'](_['pick'](_0x1f6473['query'],_0x10d2ed[_0x3e5b('0x3c')]),_0x307091);if(_0x1f6473[_0x3e5b('0x37')][_0x3e5b('0x3d')]){_0x475b39[_0x3e5b('0x3b')]=_[_0x3e5b('0x3e')](_0x475b39[_0x3e5b('0x3b')],{'$or':_['map'](_0x307091,function(_0x5d0c59){if(_0x5d0c59['type']!=='VIRTUAL'){var _0x5f0271={};_0x5f0271[_0x5d0c59['name']]={'$like':'%'+_0x1f6473['query'][_0x3e5b('0x3d')]+'%'};return _0x5f0271;}})});}_0x475b39=_[_0x3e5b('0x3e')]({},_0x475b39,_0x1f6473[_0x3e5b('0x3f')]);var _0x1aafd5={'where':_0x475b39[_0x3e5b('0x3b')]};return db[_0x3e5b('0x2c')][_0x3e5b('0x1f')](_0x1aafd5)[_0x3e5b('0x27')](function(_0x222d0f){_0x3cfaf6[_0x3e5b('0x1f')]=_0x222d0f;if(_0x1f6473[_0x3e5b('0x37')]['includeAll']){_0x475b39[_0x3e5b('0x40')]=[{'all':!![]}];}return db[_0x3e5b('0x2c')][_0x3e5b('0x41')](_0x475b39);})[_0x3e5b('0x27')](function(_0xa262e0){_0x3cfaf6[_0x3e5b('0x42')]=_0xa262e0;return _0x3cfaf6;})[_0x3e5b('0x27')](respondWithFilteredResult(_0x1296ec,_0x475b39))[_0x3e5b('0x43')](handleError(_0x1296ec,null));};exports[_0x3e5b('0x44')]=function(_0x39da3f,_0x13c8d5){var _0x559056={'raw':![],'where':{'id':_0x39da3f['params']['id']}},_0x598ab4={};_0x598ab4['model']=_[_0x3e5b('0x33')](db[_0x3e5b('0x2c')][_0x3e5b('0x2d')]);_0x598ab4[_0x3e5b('0x37')]=_[_0x3e5b('0x33')](_0x39da3f[_0x3e5b('0x37')]);_0x598ab4[_0x3e5b('0x3c')]=_[_0x3e5b('0x34')](_0x598ab4[_0x3e5b('0x30')],_0x598ab4[_0x3e5b('0x37')]);_0x559056['attributes']=_[_0x3e5b('0x34')](_0x598ab4[_0x3e5b('0x30')],qs[_0x3e5b('0x36')](_0x39da3f[_0x3e5b('0x37')][_0x3e5b('0x36')]));_0x559056['attributes']=_0x559056['attributes']['length']?_0x559056[_0x3e5b('0x35')]:_0x598ab4[_0x3e5b('0x30')];if(_0x39da3f[_0x3e5b('0x37')]['includeAll']){_0x559056['include']=[{'all':!![]}];}_0x559056=_[_0x3e5b('0x3e')]({},_0x559056,_0x39da3f[_0x3e5b('0x3f')]);return db[_0x3e5b('0x2c')]['find'](_0x559056)['then'](handleEntityNotFound(_0x13c8d5,null))[_0x3e5b('0x27')](respondWithResult(_0x13c8d5,null))['catch'](handleError(_0x13c8d5,null));};exports[_0x3e5b('0x45')]=function(_0x3379a1,_0x3f5835){return db[_0x3e5b('0x2c')][_0x3e5b('0x45')](_0x3379a1[_0x3e5b('0x46')],{})[_0x3e5b('0x27')](respondWithResult(_0x3f5835,0xc9))[_0x3e5b('0x43')](handleError(_0x3f5835,null));};exports[_0x3e5b('0x26')]=function(_0x4a2ae1,_0x223185){if(_0x4a2ae1['body']['id']){delete _0x4a2ae1[_0x3e5b('0x46')]['id'];}delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x47')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x48')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x49')];delete _0x4a2ae1[_0x3e5b('0x46')][_0x3e5b('0x4a')];return db[_0x3e5b('0x2c')][_0x3e5b('0x4b')]({'where':{'id':_0x4a2ae1[_0x3e5b('0x4c')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x223185,null))['then'](saveUpdates(_0x4a2ae1[_0x3e5b('0x46')],null))[_0x3e5b('0x27')](respondWithResult(_0x223185,null))[_0x3e5b('0x43')](handleError(_0x223185,null));};exports[_0x3e5b('0x4d')]=function(_0x16c9f9,_0x2cecd3){return db['ScreenRecording'][_0x3e5b('0x4d')]()[_0x3e5b('0x27')](respondWithResult(_0x2cecd3,null))[_0x3e5b('0x43')](handleError(_0x2cecd3,null));};exports[_0x3e5b('0x4e')]=function(_0x3f8646,_0x449d0f,_0x216600){var _0x437430=require('../../components/encryptor');var _0x1e6403=![];var _0x5e702f={};if(_0x3f8646['query'][_0x3e5b('0x2e')]&&_0x3f8646['query'][_0x3e5b('0x2e')]===_0x3e5b('0x4f')){_0x5e702f[_0x3e5b('0x4f')]=_0x3f8646[_0x3e5b('0x4c')]['id'];}else{_0x5e702f['id']=_0x3f8646['params']['id'];}return db['ScreenRecording']['find']({'where':_0x5e702f,'attributes':['id','value'],'raw':!![]})[_0x3e5b('0x27')](handleEntityNotFound(_0x449d0f,null))[_0x3e5b('0x27')](function(_0x1ea02a){if(_0x1ea02a){var _0x4149c8=path[_0x3e5b('0x50')](config['root'],'server/files/screen_recordings',_0x1ea02a[_0x3e5b('0x4a')]);var _0x1b0b32=util[_0x3e5b('0x32')](_0x3e5b('0x51'),_0x4149c8);if(fs[_0x3e5b('0x52')](_0x1b0b32)){_0x1e6403=!![];return _0x437430['decryptFile'](_0x1b0b32,_0x4149c8,config['secrets']['recording'])['then'](function(){return _0x1ea02a;});}return _0x1ea02a;}})[_0x3e5b('0x27')](function(_0x3e3115){if(_0x3e3115){var _0x3088d4=path[_0x3e5b('0x50')](config[_0x3e5b('0x53')],_0x3e5b('0x54'),_0x3e3115[_0x3e5b('0x4a')]);if(!fs[_0x3e5b('0x52')](_0x3088d4)){throw new db['Sequelize'][(_0x3e5b('0x55'))](_0x3e5b('0x56'));}if(_0x3e3115[_0x3e5b('0x57')]){return _0x449d0f[_0x3e5b('0x4e')](_0x3088d4,_0x3e3115[_0x3e5b('0x57')]+path['extname'](_0x3088d4),function(){if(_0x1e6403){fs[_0x3e5b('0x58')](_0x3088d4);}});}else{return _0x449d0f['download'](_0x3088d4,function(_0x45ca16){if(_0x1e6403){fs[_0x3e5b('0x58')](_0x3088d4);}});}}})['catch'](function(_0x4a7d8e){if(_0x4a7d8e['message']===_0x3e5b('0x56')){_0x449d0f['status'](0x194)[_0x3e5b('0x59')](_0x3e5b('0x5a'));}else{return handleError(_0x449d0f,null);}});};exports[_0x3e5b('0x5b')]=function(_0x40197c,_0x14f187){return db['ScreenRecording']['find']({'where':{'id':_0x40197c[_0x3e5b('0x4c')]['id']}})[_0x3e5b('0x27')](function(_0x3f7f71){if(_['isNil'](_0x3f7f71)){throw new ReferenceError(_0x3e5b('0x5c'));}return _0x3f7f71;})[_0x3e5b('0x27')](function(_0x32a42f){var _0x1c9526=path[_0x3e5b('0x50')](config[_0x3e5b('0x53')],_0x3e5b('0x54'),_0x32a42f[_0x3e5b('0x4a')]);logger[_0x3e5b('0x5d')](_0x3e5b('0x5e'),_0x1c9526);if(!_[_0x3e5b('0x5f')](_0x32a42f[_0x3e5b('0x4a')])&&fs[_0x3e5b('0x52')](_0x1c9526)){logger[_0x3e5b('0x5d')](_0x3e5b('0x60')+_0x1c9526+_0x3e5b('0x61'));fs[_0x3e5b('0x62')](_0x1c9526);}_0x1c9526=_0x1c9526+_0x3e5b('0x63');if(!_['isNil'](_0x32a42f[_0x3e5b('0x4a')])&&fs[_0x3e5b('0x52')](_0x1c9526)){logger['info'](_0x3e5b('0x60')+_0x1c9526+_0x3e5b('0x61'));fs['unlinkSync'](_0x1c9526);}return _0x32a42f;})['then'](function(_0x4f67d1){if(!_0x4f67d1)throw new InternalError();return _0x4f67d1[_0x3e5b('0x5b')]();})[_0x3e5b('0x27')](function(){_0x14f187['status'](0xcc)[_0x3e5b('0x1a')]();})[_0x3e5b('0x43')](handleError(_0x14f187,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 20b58d9..fef85bb 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 _0x8fc5=['moment','request-promise','./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','util','api'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x8fc5,0x75));var _0x58fc=function(_0x5b47e4,_0x18ca16){_0x5b47e4=_0x5b47e4-0x0;var _0xce2b11=_0x8fc5[_0x5b47e4];return _0xce2b11;};'use strict';var _=require(_0x58fc('0x0'));var util=require(_0x58fc('0x1'));var logger=require('../../config/logger')(_0x58fc('0x2'));var moment=require(_0x58fc('0x3'));var BPromise=require('bluebird');var rp=require(_0x58fc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x58fc('0x5'));module[_0x58fc('0x6')]=function(_0x1c92fd,_0x1b11c2){return _0x1c92fd[_0x58fc('0x7')]('ScreenRecording',attributes,{'tableName':_0x58fc('0x8'),'paranoid':![],'indexes':[{'name':_0x58fc('0x9'),'fields':[_0x58fc('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x080f=['ScreenRecording','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports'];(function(_0x480614,_0x56ed6e){var _0x27a440=function(_0x1bea65){while(--_0x1bea65){_0x480614['push'](_0x480614['shift']());}};_0x27a440(++_0x56ed6e);}(_0x080f,0xe2));var _0xf080=function(_0x23e3d1,_0x12cb6c){_0x23e3d1=_0x23e3d1-0x0;var _0x8df3e5=_0x080f[_0x23e3d1];return _0x8df3e5;};'use strict';var _=require(_0xf080('0x0'));var util=require(_0xf080('0x1'));var logger=require(_0xf080('0x2'))(_0xf080('0x3'));var moment=require(_0xf080('0x4'));var BPromise=require(_0xf080('0x5'));var rp=require(_0xf080('0x6'));var fs=require('fs');var path=require(_0xf080('0x7'));var rimraf=require(_0xf080('0x8'));var config=require(_0xf080('0x9'));var attributes=require(_0xf080('0xa'));module[_0xf080('0xb')]=function(_0xbf2d81,_0x1adb77){return _0xbf2d81['define'](_0xf080('0xc'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xf080('0xd'),'fields':[_0xf080('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 85e6a4b..9ee8f53 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 _0x7f1a=['error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x118610,_0x381528){var _0x537488=function(_0x5968f4){while(--_0x5968f4){_0x118610['push'](_0x118610['shift']());}};_0x537488(++_0x381528);}(_0x7f1a,0xb4));var _0xa7f1=function(_0x4c4083,_0x6c493b){_0x4c4083=_0x4c4083-0x0;var _0x4a6ef6=_0x7f1a[_0x4c4083];return _0x4a6ef6;};'use strict';var _=require(_0xa7f1('0x0'));var util=require(_0xa7f1('0x1'));var moment=require(_0xa7f1('0x2'));var BPromise=require(_0xa7f1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7f1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa7f1('0x5'));var logger=require(_0xa7f1('0x6'))(_0xa7f1('0x7'));var config=require('../../config/environment');var jayson=require(_0xa7f1('0x8'));var client=jayson[_0xa7f1('0x9')][_0xa7f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ec0dd,_0x5cc8ad,_0x2c5158){return new BPromise(function(_0x2db220,_0x2c4684){return client[_0xa7f1('0xb')](_0x4ec0dd,_0x2c5158)['then'](function(_0x2fabb3){logger[_0xa7f1('0xc')](_0xa7f1('0xd'),_0x5cc8ad,_0xa7f1('0xe'));logger[_0xa7f1('0xf')](_0xa7f1('0x10'),_0x5cc8ad,_0xa7f1('0xe'),JSON[_0xa7f1('0x11')](_0x2fabb3));if(_0x2fabb3[_0xa7f1('0x12')]){if(_0x2fabb3[_0xa7f1('0x12')][_0xa7f1('0x13')]===0x1f4){logger['error'](_0xa7f1('0xd'),_0x5cc8ad,_0x2fabb3[_0xa7f1('0x12')][_0xa7f1('0x14')]);return _0x2c4684(_0x2fabb3[_0xa7f1('0x12')]['message']);}logger[_0xa7f1('0x12')](_0xa7f1('0xd'),_0x5cc8ad,_0x2fabb3[_0xa7f1('0x12')]['message']);return _0x2db220(_0x2fabb3[_0xa7f1('0x12')]['message']);}else{logger[_0xa7f1('0xc')]('ScreenRecording,\x20%s,\x20%s',_0x5cc8ad,_0xa7f1('0xe'));_0x2db220(_0x2fabb3['result'][_0xa7f1('0x14')]);}})[_0xa7f1('0x15')](function(_0x3057ea){logger['error'](_0xa7f1('0xd'),_0x5cc8ad,_0x3057ea);_0x2c4684(_0x3057ea);});});} \ No newline at end of file +var _0xa669=['stringify','error','message','info','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s'];(function(_0x51720d,_0xf340f9){var _0x248dd6=function(_0x5b14ad){while(--_0x5b14ad){_0x51720d['push'](_0x51720d['shift']());}};_0x248dd6(++_0xf340f9);}(_0xa669,0x91));var _0x9a66=function(_0x5cfd1d,_0x2cde90){_0x5cfd1d=_0x5cfd1d-0x0;var _0x4b7891=_0xa669[_0x5cfd1d];return _0x4b7891;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9a66('0x0'));var BPromise=require(_0x9a66('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9a66('0x2'));var db=require(_0x9a66('0x3'))['db'];var utils=require(_0x9a66('0x4'));var logger=require(_0x9a66('0x5'))('rpc');var config=require(_0x9a66('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9a66('0x7')][_0x9a66('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x308651,_0x56bcb9,_0x592420){return new BPromise(function(_0x21d6c7,_0x379499){return client[_0x9a66('0x9')](_0x308651,_0x592420)[_0x9a66('0xa')](function(_0x5caace){logger['info'](_0x9a66('0xb'),_0x56bcb9,_0x9a66('0xc'));logger[_0x9a66('0xd')](_0x9a66('0xe'),_0x56bcb9,_0x9a66('0xc'),JSON[_0x9a66('0xf')](_0x5caace));if(_0x5caace[_0x9a66('0x10')]){if(_0x5caace[_0x9a66('0x10')]['code']===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x56bcb9,_0x5caace[_0x9a66('0x10')][_0x9a66('0x11')]);return _0x379499(_0x5caace[_0x9a66('0x10')]['message']);}logger['error'](_0x9a66('0xb'),_0x56bcb9,_0x5caace['error'][_0x9a66('0x11')]);return _0x21d6c7(_0x5caace['error']['message']);}else{logger[_0x9a66('0x12')](_0x9a66('0xb'),_0x56bcb9,_0x9a66('0xc'));_0x21d6c7(_0x5caace[_0x9a66('0x13')][_0x9a66('0x11')]);}})['catch'](function(_0x23467a){logger[_0x9a66('0x10')](_0x9a66('0xb'),_0x56bcb9,_0x23467a);_0x379499(_0x23467a);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index c783bd4..a5076cf 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 _0xe7d7=['/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','format','extname','originalname','post','single','file','addLogo','root','%s%s','logologin','addLogoLogin','preferred','favicon','addFavicon','put','/:id','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now'];(function(_0x263b1f,_0x3f2376){var _0x4aa612=function(_0x3cae79){while(--_0x3cae79){_0x263b1f['push'](_0x263b1f['shift']());}};_0x4aa612(++_0x3f2376);}(_0xe7d7,0x1ab));var _0x7e7d=function(_0x11268b,_0x57b263){_0x11268b=_0x11268b-0x0;var _0x8ad879=_0xe7d7[_0x11268b];return _0x8ad879;};'use strict';var multer=require(_0x7e7d('0x0'));var util=require(_0x7e7d('0x1'));var path=require('path');var timeout=require(_0x7e7d('0x2'));var express=require(_0x7e7d('0x3'));var router=express[_0x7e7d('0x4')]();var fs_extra=require(_0x7e7d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7e7d('0x6'));var config=require(_0x7e7d('0x7'));var controller=require(_0x7e7d('0x8'));router[_0x7e7d('0x9')]('/',auth[_0x7e7d('0xa')](),controller[_0x7e7d('0xb')]);router[_0x7e7d('0x9')](_0x7e7d('0xc'),controller['getDate']);router[_0x7e7d('0x9')]('/:id',controller['show']);router[_0x7e7d('0x9')](_0x7e7d('0xd'),controller[_0x7e7d('0xe')]);router[_0x7e7d('0x9')](_0x7e7d('0xf'),controller['getLogoLogin']);router['get'](_0x7e7d('0x10'),controller['gdpr']);router['get']('/:id/preferred',controller[_0x7e7d('0x11')]);router['get'](_0x7e7d('0x12'),controller[_0x7e7d('0x13')]);var upload=multer({'storage':multer[_0x7e7d('0x14')]({'destination':function(_0x32931b,_0x530fac,_0x30a664){_0x30a664(null,path[_0x7e7d('0x15')](config['root'],_0x7e7d('0x16')));},'filename':function(_0x498d17,_0x32a187,_0x23faa4){_0x23faa4(null,util[_0x7e7d('0x17')]('%s%s','logo',path[_0x7e7d('0x18')](_0x32a187[_0x7e7d('0x19')])));}})});router[_0x7e7d('0x1a')](_0x7e7d('0xd'),upload[_0x7e7d('0x1b')](_0x7e7d('0x1c')),controller[_0x7e7d('0x1d')]);var upload=multer({'storage':multer[_0x7e7d('0x14')]({'destination':function(_0x3a71ce,_0x3c221b,_0x5cf90b){_0x5cf90b(null,path[_0x7e7d('0x15')](config[_0x7e7d('0x1e')],'server/files/images/logos/'));},'filename':function(_0x2f986a,_0xe0c3e0,_0x347a2b){_0x347a2b(null,util[_0x7e7d('0x17')](_0x7e7d('0x1f'),_0x7e7d('0x20'),path[_0x7e7d('0x18')](_0xe0c3e0['originalname'])));}})});router[_0x7e7d('0x1a')](_0x7e7d('0xf'),upload[_0x7e7d('0x1b')](_0x7e7d('0x1c')),controller[_0x7e7d('0x21')]);var upload=multer({'storage':multer[_0x7e7d('0x14')]({'destination':function(_0x15773e,_0x366795,_0x31329){_0x31329(null,path[_0x7e7d('0x15')](config[_0x7e7d('0x1e')],_0x7e7d('0x16')));},'filename':function(_0x443f24,_0xc67ffb,_0xb3ca2b){_0xb3ca2b(null,util['format'](_0x7e7d('0x1f'),_0x7e7d('0x22'),path['extname'](_0xc67ffb[_0x7e7d('0x19')])));}})});router[_0x7e7d('0x1a')]('/:id/preferred',upload[_0x7e7d('0x1b')](_0x7e7d('0x1c')),controller['addPreferred']);var upload=multer({'storage':multer[_0x7e7d('0x14')]({'destination':function(_0x11d4f6,_0x3b1f62,_0x40febd){_0x40febd(null,path[_0x7e7d('0x15')](config['root'],_0x7e7d('0x16')));},'filename':function(_0x4645aa,_0x22cb81,_0x61d113){_0x61d113(null,util[_0x7e7d('0x17')](_0x7e7d('0x1f'),_0x7e7d('0x23'),path[_0x7e7d('0x18')](_0x22cb81['originalname'])));}})});router[_0x7e7d('0x1a')](_0x7e7d('0x12'),upload['single'](_0x7e7d('0x1c')),controller[_0x7e7d('0x24')]);router[_0x7e7d('0x25')](_0x7e7d('0x26'),auth[_0x7e7d('0xa')](),controller['update']);module[_0x7e7d('0x27')]=router; \ No newline at end of file +var _0x1be1=['format','%s%s','originalname','post','/:id/logo','single','file','addLogo','join','root','server/files/images/logos/','extname','addLogoLogin','preferred','favicon','put','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage'];(function(_0x2438b6,_0x842fd7){var _0x30bc8d=function(_0x522ac5){while(--_0x522ac5){_0x2438b6['push'](_0x2438b6['shift']());}};_0x30bc8d(++_0x842fd7);}(_0x1be1,0x1e5));var _0x11be=function(_0x13ba5c,_0x2e310b){_0x13ba5c=_0x13ba5c-0x0;var _0x3526c3=_0x1be1[_0x13ba5c];return _0x3526c3;};'use strict';var multer=require('multer');var util=require(_0x11be('0x0'));var path=require(_0x11be('0x1'));var timeout=require('connect-timeout');var express=require(_0x11be('0x2'));var router=express['Router']();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require(_0x11be('0x6'));var controller=require('./setting.controller');router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),controller[_0x11be('0xb')]);router['get'](_0x11be('0xc'),controller[_0x11be('0xd')]);router[_0x11be('0x7')]('/:id/logo',controller['getLogo']);router[_0x11be('0x7')](_0x11be('0xe'),controller[_0x11be('0xf')]);router[_0x11be('0x7')](_0x11be('0x10'),controller[_0x11be('0x11')]);router['get']('/:id/preferred',controller[_0x11be('0x12')]);router[_0x11be('0x7')](_0x11be('0x13'),controller[_0x11be('0x14')]);var upload=multer({'storage':multer[_0x11be('0x15')]({'destination':function(_0x1dd198,_0x113f2b,_0x4bef1a){_0x4bef1a(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x37d457,_0x10944a,_0x1891bb){_0x1891bb(null,util[_0x11be('0x16')](_0x11be('0x17'),'logo',path['extname'](_0x10944a[_0x11be('0x18')])));}})});router[_0x11be('0x19')](_0x11be('0x1a'),upload[_0x11be('0x1b')](_0x11be('0x1c')),controller[_0x11be('0x1d')]);var upload=multer({'storage':multer[_0x11be('0x15')]({'destination':function(_0x52012d,_0x4a5898,_0x25372c){_0x25372c(null,path[_0x11be('0x1e')](config[_0x11be('0x1f')],_0x11be('0x20')));},'filename':function(_0xf69722,_0x217ee7,_0x191049){_0x191049(null,util['format'](_0x11be('0x17'),'logologin',path[_0x11be('0x21')](_0x217ee7['originalname'])));}})});router[_0x11be('0x19')](_0x11be('0xe'),upload['single']('file'),controller[_0x11be('0x22')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4fbae2,_0x3b465f,_0x1e1b34){_0x1e1b34(null,path[_0x11be('0x1e')](config['root'],_0x11be('0x20')));},'filename':function(_0x4ff28d,_0x2329ab,_0x1ad5fb){_0x1ad5fb(null,util[_0x11be('0x16')]('%s%s',_0x11be('0x23'),path[_0x11be('0x21')](_0x2329ab[_0x11be('0x18')])));}})});router['post']('/:id/preferred',upload[_0x11be('0x1b')](_0x11be('0x1c')),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x280741,_0x5ddc53,_0x385294){_0x385294(null,path[_0x11be('0x1e')](config[_0x11be('0x1f')],_0x11be('0x20')));},'filename':function(_0x5a8673,_0x5b96f9,_0x24ee0a){_0x24ee0a(null,util[_0x11be('0x16')](_0x11be('0x17'),_0x11be('0x24'),path[_0x11be('0x21')](_0x5b96f9[_0x11be('0x18')])));}})});router[_0x11be('0x19')](_0x11be('0x13'),upload[_0x11be('0x1b')](_0x11be('0x1c')),controller['addFavicon']);router[_0x11be('0x25')]('/:id',auth[_0x11be('0x8')](),controller['update']);module[_0x11be('0x26')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 237bfbe..e6f30f1 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 _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x403f7f,_0x227468){var _0x1d06b4=function(_0x4fdffc){while(--_0x4fdffc){_0x403f7f['push'](_0x403f7f['shift']());}};_0x1d06b4(++_0x227468);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x5d1f5f,_0x3ec830){var _0x3b5c2a=function(_0x46960c){while(--_0x46960c){_0x5d1f5f['push'](_0x5d1f5f['shift']());}};_0x3b5c2a(++_0x3ec830);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 4081857..0cfd2ef 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 _0x9193=['addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','Setting','include','rows','show','body','find','addLogo','file','filename','logo','params','loginLogo','../../config/license/util','getLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','getLicense','default_loginLogo.svg','custom','gdpr','securePassword','default_preferred.png'];(function(_0x19ee95,_0x336eb6){var _0x5782fc=function(_0x121c17){while(--_0x121c17){_0x19ee95['push'](_0x19ee95['shift']());}};_0x5782fc(++_0x336eb6);}(_0x9193,0x1dc));var _0x3919=function(_0x4843f9,_0x4af459){_0x4843f9=_0x4843f9-0x0;var _0x193c6a=_0x9193[_0x4843f9];return _0x193c6a;};'use strict';var emlformat=require(_0x3919('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3919('0x1'));var jsonpatch=require(_0x3919('0x2'));var rp=require(_0x3919('0x3'));var moment=require(_0x3919('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3919('0x5'));var util=require(_0x3919('0x6'));var path=require(_0x3919('0x7'));var sox=require('sox');var csv=require(_0x3919('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3919('0x9'));var _=require('lodash');var squel=require(_0x3919('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3919('0xb'));var toCsv=require(_0x3919('0x8'));var querystring=require(_0x3919('0xc'));var Papa=require(_0x3919('0xd'));var Redis=require('ioredis');var authService=require(_0x3919('0xe'));var qs=require(_0x3919('0xf'));var as=require(_0x3919('0x10'));var hardwareService=require(_0x3919('0x11'));var logger=require(_0x3919('0x12'))(_0x3919('0x13'));var utils=require(_0x3919('0x14'));var config=require(_0x3919('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x3919('0x16'));var client=jayson[_0x3919('0x17')][_0x3919('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x50d7be,_0x30b453,_0x30a26f,_0x13b6eb){return new BPromise(function(_0xe2f6ae,_0x4c940f){var _0x24dff8=_0x13b6eb||client;return _0x24dff8['request'](_0x50d7be,_0x30a26f)['then'](function(_0x4f0313){logger[_0x3919('0x19')](_0x3919('0x1a'),_0x30b453,'request\x20sent');logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x30b453,_0x3919('0x1b'),JSON[_0x3919('0x1c')](_0x4f0313));if(_0x4f0313['error']){if(_0x4f0313['error']['code']===0x1f4){logger[_0x3919('0x1d')]('Setting,\x20%s,\x20%s',_0x30b453,_0x4f0313[_0x3919('0x1d')][_0x3919('0x1e')]);return _0x4c940f(_0x4f0313[_0x3919('0x1d')]['message']);}logger[_0x3919('0x1d')](_0x3919('0x1a'),_0x30b453,_0x4f0313[_0x3919('0x1d')][_0x3919('0x1e')]);return _0xe2f6ae(_0x4f0313[_0x3919('0x1d')]['message']);}else{logger[_0x3919('0x19')](_0x3919('0x1a'),_0x30b453,_0x3919('0x1b'));_0xe2f6ae(_0x4f0313[_0x3919('0x1f')][_0x3919('0x1e')]);}})[_0x3919('0x20')](function(_0x37ccbc){logger[_0x3919('0x1d')](_0x3919('0x1a'),_0x30b453,_0x37ccbc);_0x4c940f(_0x37ccbc);});});}function respondWithStatusCode(_0x45f5f7,_0x1831d4){_0x1831d4=_0x1831d4||0xcc;return function(_0x54ce05){if(_0x54ce05){return _0x45f5f7[_0x3919('0x21')](_0x1831d4);}return _0x45f5f7[_0x3919('0x22')](_0x1831d4)['end']();};}function respondWithResult(_0x1e1c35,_0x41e27f){_0x41e27f=_0x41e27f||0xc8;return function(_0x20022b){if(_0x20022b){return _0x1e1c35[_0x3919('0x22')](_0x41e27f)[_0x3919('0x23')](_0x20022b);}};}function respondWithFilteredResult(_0x587ba9,_0x2f1521){return function(_0x953e20){if(_0x953e20){var _0x2f3028=typeof _0x2f1521[_0x3919('0x24')]===_0x3919('0x25')&&typeof _0x2f1521['limit']===_0x3919('0x25');var _0x447ac8=_0x953e20[_0x3919('0x26')];var _0x1874fa=_0x2f3028?0x0:_0x2f1521['offset'];var _0x22dce3=_0x2f3028?_0x953e20[_0x3919('0x26')]:_0x2f1521[_0x3919('0x24')]+_0x2f1521['limit'];var _0x73c5cb;if(_0x22dce3>=_0x447ac8){_0x22dce3=_0x447ac8;_0x73c5cb=0xc8;}else{_0x73c5cb=0xce;}_0x587ba9['status'](_0x73c5cb);return _0x587ba9[_0x3919('0x27')](_0x3919('0x28'),_0x1874fa+'-'+_0x22dce3+'/'+_0x447ac8)[_0x3919('0x23')](_0x953e20);}return null;};}function patchUpdates(_0x31e2e3){return function(_0x18567c){try{jsonpatch[_0x3919('0x29')](_0x18567c,_0x31e2e3,!![]);}catch(_0x1770de){return BPromise[_0x3919('0x2a')](_0x1770de);}return _0x18567c[_0x3919('0x2b')]();};}function saveUpdates(_0x4c27fc,_0x34e7f8){return function(_0x320e7a){if(_0x320e7a){return _0x320e7a[_0x3919('0x2c')](_0x4c27fc)[_0x3919('0x2d')](function(_0xde3791){return _0xde3791;});}return null;};}function removeEntity(_0x4978dd,_0x465583){return function(_0x2032c4){if(_0x2032c4){return _0x2032c4[_0x3919('0x2e')]()[_0x3919('0x2d')](function(){_0x4978dd[_0x3919('0x22')](0xcc)[_0x3919('0x2f')]();});}};}function handleEntityNotFound(_0x331fd0,_0x5b5d46){return function(_0x399101){if(!_0x399101){_0x331fd0[_0x3919('0x21')](0x194);}return _0x399101;};}function handleError(_0x578c3e,_0x92eec5){_0x92eec5=_0x92eec5||0x1f4;return function(_0x3f05fa){logger['error'](_0x3f05fa[_0x3919('0x30')]);if(_0x3f05fa[_0x3919('0x31')]){delete _0x3f05fa[_0x3919('0x31')];}_0x578c3e[_0x3919('0x22')](_0x92eec5)[_0x3919('0x32')](_0x3f05fa);};}exports['index']=function(_0x541fb0,_0x4e8b01){var _0x4dd821={},_0x2d4dc9={},_0x64b208={'count':0x0,'rows':[]};var _0x56f2ea=_[_0x3919('0x33')](db['Setting'][_0x3919('0x34')],function(_0x19d874){return{'name':_0x19d874[_0x3919('0x35')],'type':_0x19d874['type'][_0x3919('0x36')]};});_0x2d4dc9[_0x3919('0x37')]=_[_0x3919('0x33')](_0x56f2ea,'name');_0x2d4dc9[_0x3919('0x38')]=_[_0x3919('0x39')](_0x541fb0[_0x3919('0x38')]);_0x2d4dc9[_0x3919('0x3a')]=_['intersection'](_0x2d4dc9['model'],_0x2d4dc9[_0x3919('0x38')]);_0x4dd821[_0x3919('0x3b')]=_[_0x3919('0x3c')](_0x2d4dc9[_0x3919('0x37')],qs[_0x3919('0x3d')](_0x541fb0['query'][_0x3919('0x3d')]));_0x4dd821['attributes']=_0x4dd821['attributes'][_0x3919('0x3e')]?_0x4dd821['attributes']:_0x2d4dc9['model'];if(!_0x541fb0['query'][_0x3919('0x3f')]('nolimit')){_0x4dd821[_0x3919('0x40')]=qs[_0x3919('0x40')](_0x541fb0[_0x3919('0x38')][_0x3919('0x40')]);_0x4dd821[_0x3919('0x24')]=qs[_0x3919('0x24')](_0x541fb0[_0x3919('0x38')][_0x3919('0x24')]);}_0x4dd821['order']=qs[_0x3919('0x41')](_0x541fb0[_0x3919('0x38')]['sort']);_0x4dd821[_0x3919('0x42')]=qs[_0x3919('0x3a')](_[_0x3919('0x43')](_0x541fb0[_0x3919('0x38')],_0x2d4dc9[_0x3919('0x3a')]),_0x56f2ea);if(_0x541fb0['query'][_0x3919('0x44')]){_0x4dd821[_0x3919('0x42')]=_[_0x3919('0x45')](_0x4dd821[_0x3919('0x42')],{'$or':_['map'](_0x56f2ea,function(_0x4d6f08){if(_0x4d6f08['type']!=='VIRTUAL'){var _0xad101f={};_0xad101f[_0x4d6f08[_0x3919('0x31')]]={'$like':'%'+_0x541fb0[_0x3919('0x38')][_0x3919('0x44')]+'%'};return _0xad101f;}})});}_0x4dd821=_['merge']({},_0x4dd821,_0x541fb0['options']);var _0x2fa48a={'where':_0x4dd821['where']};return db[_0x3919('0x46')]['count'](_0x2fa48a)[_0x3919('0x2d')](function(_0x3c8ecb){_0x64b208[_0x3919('0x26')]=_0x3c8ecb;if(_0x541fb0[_0x3919('0x38')]['includeAll']){_0x4dd821[_0x3919('0x47')]=[{'all':!![]}];}return db[_0x3919('0x46')]['findAll'](_0x4dd821);})[_0x3919('0x2d')](function(_0x13fbcf){_0x64b208[_0x3919('0x48')]=_0x13fbcf;return _0x64b208;})['then'](respondWithFilteredResult(_0x4e8b01,_0x4dd821))[_0x3919('0x20')](handleError(_0x4e8b01,null));};exports[_0x3919('0x49')]=function(_0x1dbd17,_0x1db2ce){var _0x4c1608={'raw':![],'where':{'id':_0x1dbd17['params']['id']}},_0x2c6ad3={};_0x2c6ad3[_0x3919('0x37')]=_[_0x3919('0x39')](db['Setting'][_0x3919('0x34')]);_0x2c6ad3[_0x3919('0x38')]=_[_0x3919('0x39')](_0x1dbd17[_0x3919('0x38')]);_0x2c6ad3['filters']=_[_0x3919('0x3c')](_0x2c6ad3[_0x3919('0x37')],_0x2c6ad3['query']);_0x4c1608['attributes']=_[_0x3919('0x3c')](_0x2c6ad3['model'],qs[_0x3919('0x3d')](_0x1dbd17['query'][_0x3919('0x3d')]));_0x4c1608['attributes']=_0x4c1608[_0x3919('0x3b')][_0x3919('0x3e')]?_0x4c1608['attributes']:_0x2c6ad3[_0x3919('0x37')];if(_0x1dbd17[_0x3919('0x38')]['includeAll']){_0x4c1608['include']=[{'all':!![]}];}_0x4c1608=_[_0x3919('0x45')]({},_0x4c1608,_0x1dbd17['options']);return db[_0x3919('0x46')]['find'](_0x4c1608)['then'](handleEntityNotFound(_0x1db2ce,null))['then'](respondWithResult(_0x1db2ce,null))[_0x3919('0x20')](handleError(_0x1db2ce,null));};exports[_0x3919('0x2c')]=function(_0x14880c,_0x4807cb){if(_0x14880c[_0x3919('0x4a')]['id']){delete _0x14880c[_0x3919('0x4a')]['id'];}return db[_0x3919('0x46')][_0x3919('0x4b')]({'where':{'id':_0x14880c['params']['id']}})[_0x3919('0x2d')](handleEntityNotFound(_0x4807cb,null))[_0x3919('0x2d')](saveUpdates(_0x14880c['body'],null))[_0x3919('0x2d')](respondWithResult(_0x4807cb,null))[_0x3919('0x20')](handleError(_0x4807cb,null));};exports[_0x3919('0x4c')]=function(_0x450bbc,_0xae8567,_0xc4b235){if(_0x450bbc['file']&&_0x450bbc[_0x3919('0x4d')][_0x3919('0x4e')]){_0x450bbc[_0x3919('0x4a')][_0x3919('0x4f')]=_0x450bbc[_0x3919('0x4d')][_0x3919('0x4e')];}return db[_0x3919('0x46')]['find']({'where':{'id':_0x450bbc[_0x3919('0x50')]['id']}})[_0x3919('0x2d')](handleEntityNotFound(_0xae8567,null))[_0x3919('0x2d')](saveUpdates(_0x450bbc['body'],null))[_0x3919('0x2d')](respondWithResult(_0xae8567,null))[_0x3919('0x20')](handleError(_0xae8567,null));};exports['addLogoLogin']=function(_0x18ba10,_0x3160fc,_0x31b017){if(_0x18ba10[_0x3919('0x4d')]&&_0x18ba10[_0x3919('0x4d')][_0x3919('0x4e')]){_0x18ba10['body'][_0x3919('0x51')]=_0x18ba10[_0x3919('0x4d')][_0x3919('0x4e')];}return db[_0x3919('0x46')][_0x3919('0x4b')]({'where':{'id':_0x18ba10[_0x3919('0x50')]['id']}})[_0x3919('0x2d')](handleEntityNotFound(_0x3160fc,null))[_0x3919('0x2d')](saveUpdates(_0x18ba10['body'],null))['then'](respondWithResult(_0x3160fc,null))[_0x3919('0x20')](handleError(_0x3160fc,null));};var utilLicense=require(_0x3919('0x52'));exports[_0x3919('0x53')]=function(_0x37a24c,_0x2ca899,_0x13f26c){var _0x53204a=_0x3919('0x54');var _0xc2d17f={'custom':![]};return utilLicense['getLicense']()[_0x3919('0x2d')](function(_0x3f2cbc){if(_0x3f2cbc){_0xc2d17f=_0x3f2cbc;}return db[_0x3919('0x46')][_0x3919('0x4b')]({'where':{'id':_0x37a24c[_0x3919('0x50')]['id']},'attributes':[_0x3919('0x4f'),_0x3919('0x51'),_0x3919('0x55'),_0x3919('0x56'),_0x3919('0x57'),_0x3919('0x58'),_0x3919('0x59'),_0x3919('0x5a')],'raw':!![]});})[_0x3919('0x2d')](handleEntityNotFound(_0x2ca899,null))[_0x3919('0x2d')](function(_0x30c67d){if(_0x30c67d){var _0x5ba8c0=_0x30c67d[_0x3919('0x4f')]&&fs[_0x3919('0x5b')](path[_0x3919('0x5c')](config['root'],_0x53204a,_[_0x3919('0x5d')](_0x30c67d[_0x3919('0x4f')])))?path[_0x3919('0x5c')](config[_0x3919('0x5e')],_0x53204a,_['toLower'](_0x30c67d[_0x3919('0x4f')])):path[_0x3919('0x5c')](config[_0x3919('0x5e')],_0x53204a,_[_0x3919('0x5d')](_0x3919('0x5f')));var _0x22255e=_0x3919('0x60')+_[_0x3919('0x61')]('logo');if(_0x30c67d[_0x22255e]||!_0xc2d17f['custom']){_0x5ba8c0=path[_0x3919('0x5c')](config[_0x3919('0x5e')],_0x53204a,_[_0x3919('0x5d')]('default_logo.svg'));}if(!fs[_0x3919('0x5b')](_0x5ba8c0)){throw new db[(_0x3919('0x62'))][(_0x3919('0x63'))](_[_0x3919('0x61')]('logo')+_0x3919('0x64'));}return _0x2ca899[_0x3919('0x65')](_0x5ba8c0);}})[_0x3919('0x20')](handleError(_0x2ca899,null));};var utilLicense=require(_0x3919('0x52'));exports[_0x3919('0x66')]=function(_0x4ffed6,_0x4e10d3,_0x233560){var _0x53581a=_0x3919('0x54');var _0x5bfc91={'custom':![]};return utilLicense[_0x3919('0x67')]()['then'](function(_0x284487){if(_0x284487){_0x5bfc91=_0x284487;}return db[_0x3919('0x46')][_0x3919('0x4b')]({'where':{'id':_0x4ffed6[_0x3919('0x50')]['id']},'attributes':[_0x3919('0x4f'),_0x3919('0x51'),_0x3919('0x55'),_0x3919('0x56'),_0x3919('0x57'),_0x3919('0x58'),_0x3919('0x59'),_0x3919('0x5a')],'raw':!![]});})['then'](handleEntityNotFound(_0x4e10d3,null))[_0x3919('0x2d')](function(_0x50fb7f){if(_0x50fb7f){var _0x6d5746=_0x50fb7f[_0x3919('0x51')]&&fs[_0x3919('0x5b')](path[_0x3919('0x5c')](config['root'],_0x53581a,_[_0x3919('0x5d')](_0x50fb7f[_0x3919('0x51')])))?path[_0x3919('0x5c')](config[_0x3919('0x5e')],_0x53581a,_[_0x3919('0x5d')](_0x50fb7f[_0x3919('0x51')])):path[_0x3919('0x5c')](config[_0x3919('0x5e')],_0x53581a,_[_0x3919('0x5d')](_0x3919('0x68')));var _0x186231=_0x3919('0x60')+_[_0x3919('0x61')](_0x3919('0x51'));if(_0x50fb7f[_0x186231]||!_0x5bfc91[_0x3919('0x69')]){_0x6d5746=path[_0x3919('0x5c')](config[_0x3919('0x5e')],_0x53581a,_[_0x3919('0x5d')](_0x3919('0x68')));}if(!fs['existsSync'](_0x6d5746)){throw new db[(_0x3919('0x62'))][(_0x3919('0x63'))](_[_0x3919('0x61')](_0x3919('0x51'))+_0x3919('0x64'));}return _0x4e10d3[_0x3919('0x65')](_0x6d5746);}})[_0x3919('0x20')](handleError(_0x4e10d3,null));};exports[_0x3919('0x6a')]=function(_0x2d7c8c,_0x2ab4c6){return db[_0x3919('0x46')][_0x3919('0x4b')]({'where':{'id':_0x2d7c8c[_0x3919('0x50')]['id']},'attributes':[_0x3919('0x6b')]})[_0x3919('0x2d')](respondWithResult(_0x2ab4c6,null))[_0x3919('0x20')](handleError(_0x2ab4c6,null));};exports['addPreferred']=function(_0x2ea24a,_0x3415e4,_0x14f54a){if(_0x2ea24a['file']&&_0x2ea24a[_0x3919('0x4d')][_0x3919('0x4e')]){_0x2ea24a[_0x3919('0x4a')][_0x3919('0x55')]=_0x2ea24a['file']['filename'];}return db[_0x3919('0x46')][_0x3919('0x4b')]({'where':{'id':_0x2ea24a[_0x3919('0x50')]['id']}})[_0x3919('0x2d')](handleEntityNotFound(_0x3415e4,null))['then'](saveUpdates(_0x2ea24a[_0x3919('0x4a')],null))[_0x3919('0x2d')](respondWithResult(_0x3415e4,null))['catch'](handleError(_0x3415e4,null));};var utilLicense=require(_0x3919('0x52'));exports['getPreferred']=function(_0x8ca4b7,_0x103672,_0x53cd50){var _0x40c845='server/files/images/logos';var _0x3e387b={'custom':![]};return utilLicense['getLicense']()[_0x3919('0x2d')](function(_0x3c0345){if(_0x3c0345){_0x3e387b=_0x3c0345;}return db[_0x3919('0x46')][_0x3919('0x4b')]({'where':{'id':_0x8ca4b7[_0x3919('0x50')]['id']},'attributes':[_0x3919('0x4f'),_0x3919('0x51'),_0x3919('0x55'),'favicon',_0x3919('0x57'),_0x3919('0x58'),_0x3919('0x59'),_0x3919('0x5a')],'raw':!![]});})[_0x3919('0x2d')](handleEntityNotFound(_0x103672,null))['then'](function(_0x51adca){if(_0x51adca){var _0x4e6c52=_0x51adca[_0x3919('0x55')]&&fs[_0x3919('0x5b')](path[_0x3919('0x5c')](config[_0x3919('0x5e')],_0x40c845,_[_0x3919('0x5d')](_0x51adca['preferred'])))?path[_0x3919('0x5c')](config[_0x3919('0x5e')],_0x40c845,_[_0x3919('0x5d')](_0x51adca[_0x3919('0x55')])):path[_0x3919('0x5c')](config['root'],_0x40c845,_[_0x3919('0x5d')](_0x3919('0x6c')));var _0x41dba9='default'+_[_0x3919('0x61')](_0x3919('0x55'));if(_0x51adca[_0x41dba9]||!_0x3e387b[_0x3919('0x69')]||!_0x3e387b[_0x3919('0x55')]){_0x4e6c52=path[_0x3919('0x5c')](config[_0x3919('0x5e')],_0x40c845,_['toLower'](_0x3919('0x6c')));}if(!fs['existsSync'](_0x4e6c52)){throw new db[(_0x3919('0x62'))][(_0x3919('0x63'))](_['upperFirst']('preferred')+_0x3919('0x64'));}return _0x103672['download'](_0x4e6c52);}})[_0x3919('0x20')](handleError(_0x103672,null));};exports[_0x3919('0x6d')]=function(_0x599bc1,_0x1621b9,_0x51f702){if(_0x599bc1['file']&&_0x599bc1[_0x3919('0x4d')]['filename']){_0x599bc1[_0x3919('0x4a')][_0x3919('0x56')]=_0x599bc1[_0x3919('0x4d')][_0x3919('0x4e')];}return db[_0x3919('0x46')][_0x3919('0x4b')]({'where':{'id':_0x599bc1[_0x3919('0x50')]['id']}})[_0x3919('0x2d')](handleEntityNotFound(_0x1621b9,null))[_0x3919('0x2d')](saveUpdates(_0x599bc1[_0x3919('0x4a')],null))[_0x3919('0x2d')](respondWithResult(_0x1621b9,null))[_0x3919('0x20')](handleError(_0x1621b9,null));};var utilLicense=require('../../config/license/util');exports[_0x3919('0x6e')]=function(_0x33df31,_0x869355,_0x1e9a95){var _0x562593=_0x3919('0x54');var _0x2bc44a={'custom':![]};return utilLicense[_0x3919('0x67')]()[_0x3919('0x2d')](function(_0x408ddd){if(_0x408ddd){_0x2bc44a=_0x408ddd;}return db['Setting'][_0x3919('0x4b')]({'where':{'id':_0x33df31['params']['id']},'attributes':[_0x3919('0x4f'),_0x3919('0x51'),'preferred',_0x3919('0x56'),_0x3919('0x57'),_0x3919('0x58'),_0x3919('0x59'),'defaultFavicon'],'raw':!![]});})[_0x3919('0x2d')](handleEntityNotFound(_0x869355,null))[_0x3919('0x2d')](function(_0x30ec9f){if(_0x30ec9f){var _0x142244=_0x30ec9f[_0x3919('0x56')]&&fs['existsSync'](path['join'](config[_0x3919('0x5e')],_0x562593,_[_0x3919('0x5d')](_0x30ec9f[_0x3919('0x56')])))?path[_0x3919('0x5c')](config[_0x3919('0x5e')],_0x562593,_[_0x3919('0x5d')](_0x30ec9f['favicon'])):path[_0x3919('0x5c')](config['root'],_0x562593,_[_0x3919('0x5d')]('default_favicon.ico'));var _0x8d8d55=_0x3919('0x60')+_[_0x3919('0x61')](_0x3919('0x56'));if(_0x30ec9f[_0x8d8d55]||!_0x2bc44a['custom']){_0x142244=path['join'](config[_0x3919('0x5e')],_0x562593,_[_0x3919('0x5d')](_0x3919('0x6f')));}if(!fs[_0x3919('0x5b')](_0x142244)){throw new db[(_0x3919('0x62'))][(_0x3919('0x63'))](_[_0x3919('0x61')](_0x3919('0x56'))+'\x20not\x20found');}return _0x869355['download'](_0x142244);}})[_0x3919('0x20')](handleError(_0x869355,null));};exports[_0x3919('0x70')]=function(_0x4703e9,_0x2e1078){var _0x2be837={'offset':moment()[_0x3919('0x71')]()};_0x2be837[_0x3919('0x72')]=moment()[_0x3919('0x71')](_0x2be837[_0x3919('0x24')])[_0x3919('0x73')](_0x3919('0x74'));return _0x2e1078['status'](0xc8)[_0x3919('0x32')](_0x2be837);}; \ No newline at end of file +var _0x089f=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','stack','name','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','order','where','pick','filter','VIRTUAL','options','Setting','includeAll','findAll','rows','params','length','include','merge','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','custom','Sequelize','ValidationError','download','getLogoLogin','default_loginLogo.svg','\x20not\x20found','gdpr','addPreferred','getPreferred','default','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','client','http','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','result','catch'];(function(_0x10760b,_0xd1e6b6){var _0x30870b=function(_0x5d7ebd){while(--_0x5d7ebd){_0x10760b['push'](_0x10760b['shift']());}};_0x30870b(++_0xd1e6b6);}(_0x089f,0x1c7));var _0xf089=function(_0x251ac5,_0x47a652){_0x251ac5=_0x251ac5-0x0;var _0x8f799a=_0x089f[_0x251ac5];return _0x8f799a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf089('0x0'));var zipdir=require(_0xf089('0x1'));var jsonpatch=require(_0xf089('0x2'));var rp=require(_0xf089('0x3'));var moment=require(_0xf089('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf089('0x5'));var util=require(_0xf089('0x6'));var path=require(_0xf089('0x7'));var sox=require('sox');var csv=require(_0xf089('0x8'));var ejs=require(_0xf089('0x9'));var fs=require('fs');var fs_extra=require(_0xf089('0xa'));var _=require('lodash');var squel=require(_0xf089('0xb'));var crypto=require(_0xf089('0xc'));var jsforce=require(_0xf089('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf089('0x8'));var querystring=require(_0xf089('0xe'));var Papa=require(_0xf089('0xf'));var Redis=require(_0xf089('0x10'));var authService=require(_0xf089('0x11'));var qs=require(_0xf089('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf089('0x13'));var logger=require(_0xf089('0x14'))(_0xf089('0x15'));var utils=require('../../config/utils');var config=require(_0xf089('0x16'));var licenseUtil=require(_0xf089('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xf089('0x18')][_0xf089('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x4ca74e,_0x3e2d3b,_0x470ba9,_0x72b34f){return new BPromise(function(_0x337673,_0x58b0db){var _0x329719=_0x72b34f||client;return _0x329719['request'](_0x4ca74e,_0x470ba9)[_0xf089('0x1a')](function(_0x528cf9){logger[_0xf089('0x1b')]('Setting,\x20%s,\x20%s',_0x3e2d3b,_0xf089('0x1c'));logger[_0xf089('0x1d')](_0xf089('0x1e'),_0x3e2d3b,_0xf089('0x1c'),JSON[_0xf089('0x1f')](_0x528cf9));if(_0x528cf9['error']){if(_0x528cf9[_0xf089('0x20')]['code']===0x1f4){logger[_0xf089('0x20')](_0xf089('0x21'),_0x3e2d3b,_0x528cf9['error'][_0xf089('0x22')]);return _0x58b0db(_0x528cf9[_0xf089('0x20')]['message']);}logger[_0xf089('0x20')](_0xf089('0x21'),_0x3e2d3b,_0x528cf9[_0xf089('0x20')][_0xf089('0x22')]);return _0x337673(_0x528cf9[_0xf089('0x20')][_0xf089('0x22')]);}else{logger[_0xf089('0x1b')](_0xf089('0x21'),_0x3e2d3b,_0xf089('0x1c'));_0x337673(_0x528cf9[_0xf089('0x23')]['message']);}})[_0xf089('0x24')](function(_0x31050f){logger[_0xf089('0x20')](_0xf089('0x21'),_0x3e2d3b,_0x31050f);_0x58b0db(_0x31050f);});});}function respondWithStatusCode(_0x599b04,_0x19e801){_0x19e801=_0x19e801||0xcc;return function(_0x249b88){if(_0x249b88){return _0x599b04[_0xf089('0x25')](_0x19e801);}return _0x599b04[_0xf089('0x26')](_0x19e801)[_0xf089('0x27')]();};}function respondWithResult(_0x49e00e,_0x3ec39b){_0x3ec39b=_0x3ec39b||0xc8;return function(_0x598a4e){if(_0x598a4e){return _0x49e00e[_0xf089('0x26')](_0x3ec39b)[_0xf089('0x28')](_0x598a4e);}};}function respondWithFilteredResult(_0x5ad3d4,_0x3ef0bc){return function(_0x5e72c9){if(_0x5e72c9){var _0x52ea47=typeof _0x3ef0bc[_0xf089('0x29')]===_0xf089('0x2a')&&typeof _0x3ef0bc[_0xf089('0x2b')]===_0xf089('0x2a');var _0x14aa96=_0x5e72c9['count'];var _0x210147=_0x52ea47?0x0:_0x3ef0bc['offset'];var _0x83d36=_0x52ea47?_0x5e72c9[_0xf089('0x2c')]:_0x3ef0bc[_0xf089('0x29')]+_0x3ef0bc[_0xf089('0x2b')];var _0x32f869;if(_0x83d36>=_0x14aa96){_0x83d36=_0x14aa96;_0x32f869=0xc8;}else{_0x32f869=0xce;}_0x5ad3d4[_0xf089('0x26')](_0x32f869);return _0x5ad3d4[_0xf089('0x2d')](_0xf089('0x2e'),_0x210147+'-'+_0x83d36+'/'+_0x14aa96)[_0xf089('0x28')](_0x5e72c9);}return null;};}function patchUpdates(_0x2df2bb){return function(_0x3f82b8){try{jsonpatch[_0xf089('0x2f')](_0x3f82b8,_0x2df2bb,!![]);}catch(_0x5b85a4){return BPromise['reject'](_0x5b85a4);}return _0x3f82b8[_0xf089('0x30')]();};}function saveUpdates(_0x41741b,_0x3fcd88){return function(_0x26ec9c){if(_0x26ec9c){return _0x26ec9c[_0xf089('0x31')](_0x41741b)['then'](function(_0x5cc632){return _0x5cc632;});}return null;};}function removeEntity(_0x355148,_0x1fbfc3){return function(_0x3d8287){if(_0x3d8287){return _0x3d8287[_0xf089('0x32')]()[_0xf089('0x1a')](function(){_0x355148[_0xf089('0x26')](0xcc)[_0xf089('0x27')]();});}};}function handleEntityNotFound(_0x29bd70,_0x41d699){return function(_0x488746){if(!_0x488746){_0x29bd70[_0xf089('0x25')](0x194);}return _0x488746;};}function handleError(_0x5becf3,_0x12e975){_0x12e975=_0x12e975||0x1f4;return function(_0x2646bf){logger['error'](_0x2646bf[_0xf089('0x33')]);if(_0x2646bf[_0xf089('0x34')]){delete _0x2646bf[_0xf089('0x34')];}_0x5becf3[_0xf089('0x26')](_0x12e975)['send'](_0x2646bf);};}exports[_0xf089('0x35')]=function(_0x4d8b0c,_0x3332f8){var _0x5ac407={},_0x5b51ba={},_0x4ef6c1={'count':0x0,'rows':[]};var _0x3bbcb3=_[_0xf089('0x36')](db['Setting']['rawAttributes'],function(_0x4f2f6f){return{'name':_0x4f2f6f[_0xf089('0x37')],'type':_0x4f2f6f[_0xf089('0x38')][_0xf089('0x39')]};});_0x5b51ba[_0xf089('0x3a')]=_['map'](_0x3bbcb3,_0xf089('0x34'));_0x5b51ba[_0xf089('0x3b')]=_[_0xf089('0x3c')](_0x4d8b0c['query']);_0x5b51ba[_0xf089('0x3d')]=_['intersection'](_0x5b51ba[_0xf089('0x3a')],_0x5b51ba[_0xf089('0x3b')]);_0x5ac407[_0xf089('0x3e')]=_[_0xf089('0x3f')](_0x5b51ba[_0xf089('0x3a')],qs[_0xf089('0x40')](_0x4d8b0c[_0xf089('0x3b')][_0xf089('0x40')]));_0x5ac407[_0xf089('0x3e')]=_0x5ac407[_0xf089('0x3e')]['length']?_0x5ac407[_0xf089('0x3e')]:_0x5b51ba[_0xf089('0x3a')];if(!_0x4d8b0c[_0xf089('0x3b')]['hasOwnProperty']('nolimit')){_0x5ac407[_0xf089('0x2b')]=qs[_0xf089('0x2b')](_0x4d8b0c[_0xf089('0x3b')]['limit']);_0x5ac407[_0xf089('0x29')]=qs[_0xf089('0x29')](_0x4d8b0c['query'][_0xf089('0x29')]);}_0x5ac407[_0xf089('0x41')]=qs['sort'](_0x4d8b0c[_0xf089('0x3b')]['sort']);_0x5ac407[_0xf089('0x42')]=qs[_0xf089('0x3d')](_[_0xf089('0x43')](_0x4d8b0c[_0xf089('0x3b')],_0x5b51ba[_0xf089('0x3d')]),_0x3bbcb3);if(_0x4d8b0c['query'][_0xf089('0x44')]){_0x5ac407[_0xf089('0x42')]=_['merge'](_0x5ac407[_0xf089('0x42')],{'$or':_[_0xf089('0x36')](_0x3bbcb3,function(_0x4f1f7){if(_0x4f1f7[_0xf089('0x38')]!==_0xf089('0x45')){var _0x1ae115={};_0x1ae115[_0x4f1f7[_0xf089('0x34')]]={'$like':'%'+_0x4d8b0c['query']['filter']+'%'};return _0x1ae115;}})});}_0x5ac407=_['merge']({},_0x5ac407,_0x4d8b0c[_0xf089('0x46')]);var _0x1567e8={'where':_0x5ac407[_0xf089('0x42')]};return db[_0xf089('0x47')]['count'](_0x1567e8)[_0xf089('0x1a')](function(_0x5e7d40){_0x4ef6c1[_0xf089('0x2c')]=_0x5e7d40;if(_0x4d8b0c[_0xf089('0x3b')][_0xf089('0x48')]){_0x5ac407['include']=[{'all':!![]}];}return db[_0xf089('0x47')][_0xf089('0x49')](_0x5ac407);})['then'](function(_0x341de8){_0x4ef6c1[_0xf089('0x4a')]=_0x341de8;return _0x4ef6c1;})[_0xf089('0x1a')](respondWithFilteredResult(_0x3332f8,_0x5ac407))[_0xf089('0x24')](handleError(_0x3332f8,null));};exports['show']=function(_0x2d15fe,_0x57111b){var _0x5bfe05={'raw':![],'where':{'id':_0x2d15fe[_0xf089('0x4b')]['id']}},_0x2c064d={};_0x2c064d['model']=_[_0xf089('0x3c')](db['Setting']['rawAttributes']);_0x2c064d['query']=_['keys'](_0x2d15fe[_0xf089('0x3b')]);_0x2c064d[_0xf089('0x3d')]=_['intersection'](_0x2c064d[_0xf089('0x3a')],_0x2c064d[_0xf089('0x3b')]);_0x5bfe05[_0xf089('0x3e')]=_[_0xf089('0x3f')](_0x2c064d[_0xf089('0x3a')],qs[_0xf089('0x40')](_0x2d15fe[_0xf089('0x3b')]['fields']));_0x5bfe05[_0xf089('0x3e')]=_0x5bfe05[_0xf089('0x3e')][_0xf089('0x4c')]?_0x5bfe05[_0xf089('0x3e')]:_0x2c064d['model'];if(_0x2d15fe[_0xf089('0x3b')][_0xf089('0x48')]){_0x5bfe05[_0xf089('0x4d')]=[{'all':!![]}];}_0x5bfe05=_[_0xf089('0x4e')]({},_0x5bfe05,_0x2d15fe[_0xf089('0x46')]);return db[_0xf089('0x47')][_0xf089('0x4f')](_0x5bfe05)['then'](handleEntityNotFound(_0x57111b,null))['then'](respondWithResult(_0x57111b,null))['catch'](handleError(_0x57111b,null));};exports[_0xf089('0x31')]=function(_0x3614c6,_0x5b89bb){if(_0x3614c6['body']['id']){delete _0x3614c6[_0xf089('0x50')]['id'];}return db[_0xf089('0x47')][_0xf089('0x4f')]({'where':{'id':_0x3614c6[_0xf089('0x4b')]['id']}})[_0xf089('0x1a')](handleEntityNotFound(_0x5b89bb,null))[_0xf089('0x1a')](saveUpdates(_0x3614c6[_0xf089('0x50')],null))['then'](respondWithResult(_0x5b89bb,null))['catch'](handleError(_0x5b89bb,null));};exports[_0xf089('0x51')]=function(_0x2f0ab7,_0x411820,_0x4ff11e){if(_0x2f0ab7[_0xf089('0x52')]&&_0x2f0ab7[_0xf089('0x52')][_0xf089('0x53')]){_0x2f0ab7[_0xf089('0x50')][_0xf089('0x54')]=_0x2f0ab7['file']['filename'];}return db[_0xf089('0x47')][_0xf089('0x4f')]({'where':{'id':_0x2f0ab7[_0xf089('0x4b')]['id']}})['then'](handleEntityNotFound(_0x411820,null))['then'](saveUpdates(_0x2f0ab7[_0xf089('0x50')],null))['then'](respondWithResult(_0x411820,null))[_0xf089('0x24')](handleError(_0x411820,null));};exports[_0xf089('0x55')]=function(_0x571bf7,_0x500e0c,_0x8dff33){if(_0x571bf7['file']&&_0x571bf7[_0xf089('0x52')][_0xf089('0x53')]){_0x571bf7[_0xf089('0x50')][_0xf089('0x56')]=_0x571bf7['file']['filename'];}return db[_0xf089('0x47')]['find']({'where':{'id':_0x571bf7[_0xf089('0x4b')]['id']}})['then'](handleEntityNotFound(_0x500e0c,null))['then'](saveUpdates(_0x571bf7[_0xf089('0x50')],null))[_0xf089('0x1a')](respondWithResult(_0x500e0c,null))['catch'](handleError(_0x500e0c,null));};var utilLicense=require('../../config/license/util');exports[_0xf089('0x57')]=function(_0x50e598,_0x3197e3,_0x145cab){var _0x8a874=_0xf089('0x58');var _0x31b1e5={'custom':![]};return utilLicense[_0xf089('0x59')]()['then'](function(_0x2bf50f){if(_0x2bf50f){_0x31b1e5=_0x2bf50f;}return db[_0xf089('0x47')]['find']({'where':{'id':_0x50e598[_0xf089('0x4b')]['id']},'attributes':[_0xf089('0x54'),_0xf089('0x56'),_0xf089('0x5a'),_0xf089('0x5b'),_0xf089('0x5c'),_0xf089('0x5d'),_0xf089('0x5e'),_0xf089('0x5f')],'raw':!![]});})[_0xf089('0x1a')](handleEntityNotFound(_0x3197e3,null))[_0xf089('0x1a')](function(_0x26c013){if(_0x26c013){var _0x2adbe0=_0x26c013[_0xf089('0x54')]&&fs[_0xf089('0x60')](path[_0xf089('0x61')](config['root'],_0x8a874,_['toLower'](_0x26c013[_0xf089('0x54')])))?path[_0xf089('0x61')](config[_0xf089('0x62')],_0x8a874,_[_0xf089('0x63')](_0x26c013[_0xf089('0x54')])):path[_0xf089('0x61')](config['root'],_0x8a874,_[_0xf089('0x63')](_0xf089('0x64')));var _0x312b15='default'+_[_0xf089('0x65')](_0xf089('0x54'));if(_0x26c013[_0x312b15]||!_0x31b1e5[_0xf089('0x66')]){_0x2adbe0=path[_0xf089('0x61')](config['root'],_0x8a874,_[_0xf089('0x63')](_0xf089('0x64')));}if(!fs[_0xf089('0x60')](_0x2adbe0)){throw new db[(_0xf089('0x67'))][(_0xf089('0x68'))](_[_0xf089('0x65')]('logo')+'\x20not\x20found');}return _0x3197e3[_0xf089('0x69')](_0x2adbe0);}})[_0xf089('0x24')](handleError(_0x3197e3,null));};var utilLicense=require(_0xf089('0x17'));exports[_0xf089('0x6a')]=function(_0x56e22e,_0x30a01b,_0x5b1713){var _0x1e62d2=_0xf089('0x58');var _0x19d213={'custom':![]};return utilLicense[_0xf089('0x59')]()[_0xf089('0x1a')](function(_0x4f14f3){if(_0x4f14f3){_0x19d213=_0x4f14f3;}return db[_0xf089('0x47')]['find']({'where':{'id':_0x56e22e[_0xf089('0x4b')]['id']},'attributes':[_0xf089('0x54'),_0xf089('0x56'),'preferred',_0xf089('0x5b'),'defaultLogo',_0xf089('0x5d'),_0xf089('0x5e'),_0xf089('0x5f')],'raw':!![]});})[_0xf089('0x1a')](handleEntityNotFound(_0x30a01b,null))['then'](function(_0x1fe29b){if(_0x1fe29b){var _0x268635=_0x1fe29b['loginLogo']&&fs['existsSync'](path[_0xf089('0x61')](config[_0xf089('0x62')],_0x1e62d2,_['toLower'](_0x1fe29b[_0xf089('0x56')])))?path['join'](config['root'],_0x1e62d2,_[_0xf089('0x63')](_0x1fe29b[_0xf089('0x56')])):path[_0xf089('0x61')](config[_0xf089('0x62')],_0x1e62d2,_[_0xf089('0x63')](_0xf089('0x6b')));var _0x4e6e25='default'+_[_0xf089('0x65')]('loginLogo');if(_0x1fe29b[_0x4e6e25]||!_0x19d213[_0xf089('0x66')]){_0x268635=path['join'](config['root'],_0x1e62d2,_['toLower'](_0xf089('0x6b')));}if(!fs[_0xf089('0x60')](_0x268635)){throw new db['Sequelize'][(_0xf089('0x68'))](_['upperFirst'](_0xf089('0x56'))+_0xf089('0x6c'));}return _0x30a01b[_0xf089('0x69')](_0x268635);}})[_0xf089('0x24')](handleError(_0x30a01b,null));};exports[_0xf089('0x6d')]=function(_0x138d6b,_0x4bec3a){return db[_0xf089('0x47')][_0xf089('0x4f')]({'where':{'id':_0x138d6b[_0xf089('0x4b')]['id']},'attributes':['securePassword']})[_0xf089('0x1a')](respondWithResult(_0x4bec3a,null))['catch'](handleError(_0x4bec3a,null));};exports[_0xf089('0x6e')]=function(_0x4cd3c7,_0x21a44c,_0x46b771){if(_0x4cd3c7[_0xf089('0x52')]&&_0x4cd3c7[_0xf089('0x52')][_0xf089('0x53')]){_0x4cd3c7[_0xf089('0x50')][_0xf089('0x5a')]=_0x4cd3c7['file']['filename'];}return db[_0xf089('0x47')][_0xf089('0x4f')]({'where':{'id':_0x4cd3c7[_0xf089('0x4b')]['id']}})[_0xf089('0x1a')](handleEntityNotFound(_0x21a44c,null))[_0xf089('0x1a')](saveUpdates(_0x4cd3c7[_0xf089('0x50')],null))[_0xf089('0x1a')](respondWithResult(_0x21a44c,null))[_0xf089('0x24')](handleError(_0x21a44c,null));};var utilLicense=require(_0xf089('0x17'));exports[_0xf089('0x6f')]=function(_0x2b2a92,_0x7b1ea7,_0x6be0b7){var _0x3c271d=_0xf089('0x58');var _0x265522={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x1a3c74){if(_0x1a3c74){_0x265522=_0x1a3c74;}return db[_0xf089('0x47')][_0xf089('0x4f')]({'where':{'id':_0x2b2a92[_0xf089('0x4b')]['id']},'attributes':[_0xf089('0x54'),'loginLogo',_0xf089('0x5a'),_0xf089('0x5b'),_0xf089('0x5c'),_0xf089('0x5d'),_0xf089('0x5e'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x7b1ea7,null))[_0xf089('0x1a')](function(_0x532a63){if(_0x532a63){var _0x4c4e28=_0x532a63[_0xf089('0x5a')]&&fs[_0xf089('0x60')](path[_0xf089('0x61')](config[_0xf089('0x62')],_0x3c271d,_[_0xf089('0x63')](_0x532a63[_0xf089('0x5a')])))?path[_0xf089('0x61')](config[_0xf089('0x62')],_0x3c271d,_[_0xf089('0x63')](_0x532a63[_0xf089('0x5a')])):path[_0xf089('0x61')](config[_0xf089('0x62')],_0x3c271d,_[_0xf089('0x63')]('default_preferred.png'));var _0x11251a=_0xf089('0x70')+_[_0xf089('0x65')](_0xf089('0x5a'));if(_0x532a63[_0x11251a]||!_0x265522[_0xf089('0x66')]||!_0x265522['preferred']){_0x4c4e28=path[_0xf089('0x61')](config[_0xf089('0x62')],_0x3c271d,_[_0xf089('0x63')](_0xf089('0x71')));}if(!fs[_0xf089('0x60')](_0x4c4e28)){throw new db[(_0xf089('0x67'))][(_0xf089('0x68'))](_[_0xf089('0x65')](_0xf089('0x5a'))+_0xf089('0x6c'));}return _0x7b1ea7[_0xf089('0x69')](_0x4c4e28);}})['catch'](handleError(_0x7b1ea7,null));};exports[_0xf089('0x72')]=function(_0x463421,_0x3f4878,_0x39196a){if(_0x463421['file']&&_0x463421[_0xf089('0x52')][_0xf089('0x53')]){_0x463421['body'][_0xf089('0x5b')]=_0x463421['file'][_0xf089('0x53')];}return db[_0xf089('0x47')][_0xf089('0x4f')]({'where':{'id':_0x463421[_0xf089('0x4b')]['id']}})[_0xf089('0x1a')](handleEntityNotFound(_0x3f4878,null))[_0xf089('0x1a')](saveUpdates(_0x463421['body'],null))[_0xf089('0x1a')](respondWithResult(_0x3f4878,null))[_0xf089('0x24')](handleError(_0x3f4878,null));};var utilLicense=require(_0xf089('0x17'));exports[_0xf089('0x73')]=function(_0x1240ea,_0x1cc1a0,_0x5e5a10){var _0xa3d2b2=_0xf089('0x58');var _0x4e6d38={'custom':![]};return utilLicense[_0xf089('0x59')]()['then'](function(_0x262be0){if(_0x262be0){_0x4e6d38=_0x262be0;}return db['Setting'][_0xf089('0x4f')]({'where':{'id':_0x1240ea[_0xf089('0x4b')]['id']},'attributes':[_0xf089('0x54'),_0xf089('0x56'),'preferred',_0xf089('0x5b'),'defaultLogo',_0xf089('0x5d'),_0xf089('0x5e'),_0xf089('0x5f')],'raw':!![]});})[_0xf089('0x1a')](handleEntityNotFound(_0x1cc1a0,null))['then'](function(_0x27fcd4){if(_0x27fcd4){var _0x2c817d=_0x27fcd4[_0xf089('0x5b')]&&fs[_0xf089('0x60')](path[_0xf089('0x61')](config[_0xf089('0x62')],_0xa3d2b2,_['toLower'](_0x27fcd4[_0xf089('0x5b')])))?path[_0xf089('0x61')](config[_0xf089('0x62')],_0xa3d2b2,_[_0xf089('0x63')](_0x27fcd4[_0xf089('0x5b')])):path['join'](config[_0xf089('0x62')],_0xa3d2b2,_['toLower'](_0xf089('0x74')));var _0x3b0625=_0xf089('0x70')+_[_0xf089('0x65')](_0xf089('0x5b'));if(_0x27fcd4[_0x3b0625]||!_0x4e6d38['custom']){_0x2c817d=path[_0xf089('0x61')](config[_0xf089('0x62')],_0xa3d2b2,_['toLower'](_0xf089('0x74')));}if(!fs[_0xf089('0x60')](_0x2c817d)){throw new db[(_0xf089('0x67'))][(_0xf089('0x68'))](_['upperFirst'](_0xf089('0x5b'))+_0xf089('0x6c'));}return _0x1cc1a0[_0xf089('0x69')](_0x2c817d);}})[_0xf089('0x24')](handleError(_0x1cc1a0,null));};exports[_0xf089('0x75')]=function(_0x177ea6,_0x168e9b){var _0x4336f1={'offset':moment()['utcOffset']()};_0x4336f1[_0xf089('0x76')]=moment()[_0xf089('0x77')](_0x4336f1[_0xf089('0x29')])[_0xf089('0x78')](_0xf089('0x79'));return _0x168e9b['status'](0xc8)[_0xf089('0x7a')](_0x4336f1);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index a2980df..8cb1a45 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x11d95f,_0x34f442){var _0x2b1a14=function(_0x3a4fa5){while(--_0x3a4fa5){_0x11d95f['push'](_0x11d95f['shift']());}};_0x2b1a14(++_0x34f442);}(_0x008c,0x188));var _0xc008=function(_0x58ae9f,_0xcaa7d7){_0x58ae9f=_0x58ae9f-0x0;var _0x4c966d=_0x008c[_0x58ae9f];return _0x4c966d;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x1cea08,_0x3c038a){var _0x1b17e0=function(_0x5b3128){while(--_0x5b3128){_0x1cea08['push'](_0x1cea08['shift']());}};_0x1b17e0(++_0x3c038a);}(_0xedd9,0xfc));var _0x9edd=function(_0x4388a4,_0x26711a){_0x4388a4=_0x4388a4-0x0;var _0x1dc511=_0xedd9[_0x4388a4];return _0x1dc511;};'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 0157d9a..8e665e4 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 _0x9fb6=['include','map','model','stringify','lodash','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','request','then','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','ShowSetting','Setting','options','raw','attributes'];(function(_0x10e983,_0x2f4eda){var _0x324138=function(_0x17a377){while(--_0x17a377){_0x10e983['push'](_0x10e983['shift']());}};_0x324138(++_0x2f4eda);}(_0x9fb6,0x1ea));var _0x69fb=function(_0x4ac966,_0x4659ca){_0x4ac966=_0x4ac966-0x0;var _0x378d0a=_0x9fb6[_0x4ac966];return _0x378d0a;};'use strict';var _=require(_0x69fb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x69fb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x69fb('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x69fb('0x3'))(_0x69fb('0x4'));var config=require('../../config/environment');var jayson=require(_0x69fb('0x5'));var client=jayson[_0x69fb('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26abf7,_0x27eeb3,_0x365aaa){return new BPromise(function(_0x2543aa,_0xdeb29c){return client[_0x69fb('0x7')](_0x26abf7,_0x365aaa)[_0x69fb('0x8')](function(_0x43dd88){logger['info'](_0x69fb('0x9'),_0x27eeb3,'request\x20sent');logger[_0x69fb('0xa')](_0x69fb('0xb'),_0x27eeb3,_0x69fb('0xc'),JSON['stringify'](_0x43dd88));if(_0x43dd88[_0x69fb('0xd')]){if(_0x43dd88[_0x69fb('0xd')][_0x69fb('0xe')]===0x1f4){logger[_0x69fb('0xd')](_0x69fb('0x9'),_0x27eeb3,_0x43dd88[_0x69fb('0xd')][_0x69fb('0xf')]);return _0xdeb29c(_0x43dd88[_0x69fb('0xd')][_0x69fb('0xf')]);}logger[_0x69fb('0xd')](_0x69fb('0x9'),_0x27eeb3,_0x43dd88[_0x69fb('0xd')][_0x69fb('0xf')]);return _0x2543aa(_0x43dd88[_0x69fb('0xd')][_0x69fb('0xf')]);}else{logger[_0x69fb('0x10')](_0x69fb('0x9'),_0x27eeb3,_0x69fb('0xc'));_0x2543aa(_0x43dd88[_0x69fb('0x11')]['message']);}})['catch'](function(_0x44c5ad){logger[_0x69fb('0xd')](_0x69fb('0x9'),_0x27eeb3,_0x44c5ad);_0xdeb29c(_0x44c5ad);});});}exports[_0x69fb('0x12')]=function(_0xc9afd9){var _0x419107=this;return new Promise(function(_0x14261f,_0x1a3aff){return db[_0x69fb('0x13')]['find']({'raw':_0xc9afd9['options']?_0xc9afd9[_0x69fb('0x14')][_0x69fb('0x15')]===undefined?!![]:![]:!![],'where':_0xc9afd9[_0x69fb('0x14')]?_0xc9afd9[_0x69fb('0x14')]['where']||null:null,'attributes':_0xc9afd9[_0x69fb('0x14')]?_0xc9afd9[_0x69fb('0x14')][_0x69fb('0x16')]||null:null,'include':_0xc9afd9[_0x69fb('0x14')]?_0xc9afd9[_0x69fb('0x14')][_0x69fb('0x17')]?_[_0x69fb('0x18')](_0xc9afd9['options']['include'],function(_0x38b27e){return{'model':db[_0x38b27e[_0x69fb('0x19')]],'as':_0x38b27e['as'],'attributes':_0x38b27e[_0x69fb('0x16')],'include':_0x38b27e[_0x69fb('0x17')]?_[_0x69fb('0x18')](_0x38b27e[_0x69fb('0x17')],function(_0x5abd2d){return{'model':db[_0x5abd2d[_0x69fb('0x19')]],'as':_0x5abd2d['as'],'attributes':_0x5abd2d[_0x69fb('0x16')],'include':_0x5abd2d[_0x69fb('0x17')]?_['map'](_0x5abd2d[_0x69fb('0x17')],function(_0x4ea9bb){return{'model':db[_0x4ea9bb['model']],'as':_0x4ea9bb['as'],'attributes':_0x4ea9bb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f4611){logger['info'](_0x69fb('0x12'),_0xc9afd9);logger[_0x69fb('0xa')]('ShowSetting',_0xc9afd9,JSON[_0x69fb('0x1a')](_0x3f4611));_0x14261f(_0x3f4611);})['catch'](function(_0x30cf87){logger[_0x69fb('0xd')]('ShowSetting',_0x30cf87[_0x69fb('0xf')],_0xc9afd9);_0x1a3aff(_0x419107[_0x69fb('0xd')](0x1f4,_0x30cf87[_0x69fb('0xf')]));});});}; \ No newline at end of file +var _0xa10a=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','Setting','find','options','raw','where','include','model','attributes','map','ShowSetting','lodash','util'];(function(_0x4e9ca2,_0x32b350){var _0x5d39ac=function(_0x32d502){while(--_0x32d502){_0x4e9ca2['push'](_0x4e9ca2['shift']());}};_0x5d39ac(++_0x32b350);}(_0xa10a,0x1cc));var _0xaa10=function(_0x3bfe65,_0x5e8d93){_0x3bfe65=_0x3bfe65-0x0;var _0x36354d=_0xa10a[_0x3bfe65];return _0x36354d;};'use strict';var _=require(_0xaa10('0x0'));var util=require(_0xaa10('0x1'));var moment=require(_0xaa10('0x2'));var BPromise=require(_0xaa10('0x3'));var rs=require(_0xaa10('0x4'));var fs=require('fs');var Redis=require(_0xaa10('0x5'));var db=require(_0xaa10('0x6'))['db'];var utils=require(_0xaa10('0x7'));var logger=require(_0xaa10('0x8'))(_0xaa10('0x9'));var config=require('../../config/environment');var jayson=require(_0xaa10('0xa'));var client=jayson['client'][_0xaa10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x208a6a,_0x391b7a,_0x42f969){return new BPromise(function(_0x59ad70,_0x4c7788){return client[_0xaa10('0xc')](_0x208a6a,_0x42f969)['then'](function(_0x244edc){logger['info'](_0xaa10('0xd'),_0x391b7a,_0xaa10('0xe'));logger[_0xaa10('0xf')]('Setting,\x20%s,\x20%s,\x20%s',_0x391b7a,_0xaa10('0xe'),JSON[_0xaa10('0x10')](_0x244edc));if(_0x244edc[_0xaa10('0x11')]){if(_0x244edc['error'][_0xaa10('0x12')]===0x1f4){logger['error'](_0xaa10('0xd'),_0x391b7a,_0x244edc['error'][_0xaa10('0x13')]);return _0x4c7788(_0x244edc[_0xaa10('0x11')][_0xaa10('0x13')]);}logger[_0xaa10('0x11')](_0xaa10('0xd'),_0x391b7a,_0x244edc[_0xaa10('0x11')][_0xaa10('0x13')]);return _0x59ad70(_0x244edc['error'][_0xaa10('0x13')]);}else{logger[_0xaa10('0x14')]('Setting,\x20%s,\x20%s',_0x391b7a,_0xaa10('0xe'));_0x59ad70(_0x244edc[_0xaa10('0x15')]['message']);}})[_0xaa10('0x16')](function(_0x426bd8){logger[_0xaa10('0x11')](_0xaa10('0xd'),_0x391b7a,_0x426bd8);_0x4c7788(_0x426bd8);});});}exports['ShowSetting']=function(_0x21c39b){var _0x3b4d25=this;return new Promise(function(_0x431cdd,_0x45037c){return db[_0xaa10('0x17')][_0xaa10('0x18')]({'raw':_0x21c39b[_0xaa10('0x19')]?_0x21c39b[_0xaa10('0x19')][_0xaa10('0x1a')]===undefined?!![]:![]:!![],'where':_0x21c39b[_0xaa10('0x19')]?_0x21c39b['options'][_0xaa10('0x1b')]||null:null,'attributes':_0x21c39b[_0xaa10('0x19')]?_0x21c39b[_0xaa10('0x19')]['attributes']||null:null,'include':_0x21c39b[_0xaa10('0x19')]?_0x21c39b[_0xaa10('0x19')][_0xaa10('0x1c')]?_['map'](_0x21c39b[_0xaa10('0x19')][_0xaa10('0x1c')],function(_0x55f729){return{'model':db[_0x55f729[_0xaa10('0x1d')]],'as':_0x55f729['as'],'attributes':_0x55f729[_0xaa10('0x1e')],'include':_0x55f729[_0xaa10('0x1c')]?_[_0xaa10('0x1f')](_0x55f729['include'],function(_0x312594){return{'model':db[_0x312594[_0xaa10('0x1d')]],'as':_0x312594['as'],'attributes':_0x312594[_0xaa10('0x1e')],'include':_0x312594['include']?_[_0xaa10('0x1f')](_0x312594['include'],function(_0x5e0866){return{'model':db[_0x5e0866[_0xaa10('0x1d')]],'as':_0x5e0866['as'],'attributes':_0x5e0866[_0xaa10('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x560ebe){logger[_0xaa10('0x14')](_0xaa10('0x20'),_0x21c39b);logger['debug'](_0xaa10('0x20'),_0x21c39b,JSON[_0xaa10('0x10')](_0x560ebe));_0x431cdd(_0x560ebe);})['catch'](function(_0x18b2e9){logger[_0xaa10('0x11')](_0xaa10('0x20'),_0x18b2e9['message'],_0x21c39b);_0x45037c(_0x3b4d25['error'](0x1f4,_0x18b2e9[_0xaa10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 2eaa24f..21df713 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 _0x8ef6=['addApplications','/:id/send','send','status','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','addAnswer','notify'];(function(_0x318b89,_0xcfc99e){var _0x5a2878=function(_0x14a884){while(--_0x14a884){_0x318b89['push'](_0x318b89['shift']());}};_0x5a2878(++_0xcfc99e);}(_0x8ef6,0xf2));var _0x68ef=function(_0x40b1a1,_0x9eb317){_0x40b1a1=_0x40b1a1-0x0;var _0x201920=_0x8ef6[_0x40b1a1];return _0x201920;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xa')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0xa')](_0x68ef('0x11'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);router['get'](_0x68ef('0x13'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x14')]);router[_0x68ef('0xa')](_0x68ef('0x15'),auth[_0x68ef('0xc')](),controller['getInteractions']);router[_0x68ef('0xa')](_0x68ef('0x16'),controller[_0x68ef('0x17')]);router['get'](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x19')]);router['post']('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1a')]);router[_0x68ef('0x1b')](_0x68ef('0xf'),auth['isAuthenticated'](),controller[_0x68ef('0x1c')]);router['post']('/:id/canned_answers',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1d')]);router['post']('/:id/notify',controller[_0x68ef('0x1e')]);router[_0x68ef('0x1b')](_0x68ef('0x13'),auth['isAuthenticated'](),controller[_0x68ef('0x1f')]);router[_0x68ef('0x1b')](_0x68ef('0x20'),auth['isAuthenticated'](),controller[_0x68ef('0x21')]);router[_0x68ef('0x1b')]('/:id/status',controller[_0x68ef('0x22')]);router[_0x68ef('0x1b')](_0x68ef('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x23')]);router[_0x68ef('0x24')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x25')]);router[_0x68ef('0x24')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller['removeDispositions']);router[_0x68ef('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x68ef('0x24')](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x26')]);module['exports']=router; \ No newline at end of file +var _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','/:id/applications','addApplications','/:id/send','send','/:id/users','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf494,0x1c6));var _0x4f49=function(_0x25c8d6,_0x43c68c){_0x25c8d6=_0x25c8d6-0x0;var _0x410921=_0xf494[_0x25c8d6];return _0x410921;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')]('/',auth[_0x4f49('0xb')](),controller[_0x4f49('0xc')]);router[_0x4f49('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x4f49('0xd')]);router[_0x4f49('0xa')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0xf')]);router[_0x4f49('0xa')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['getDispositions']);router[_0x4f49('0xa')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x12')]);router['get']('/:id/applications',auth[_0x4f49('0xb')](),controller[_0x4f49('0x13')]);router['get'](_0x4f49('0x14'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x15')]);router[_0x4f49('0xa')](_0x4f49('0x16'),controller[_0x4f49('0x17')]);router[_0x4f49('0xa')]('/:id/users',auth[_0x4f49('0xb')](),controller[_0x4f49('0x18')]);router[_0x4f49('0x19')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4f49('0x19')](_0x4f49('0x10'),auth[_0x4f49('0xb')](),controller['addDisposition']);router[_0x4f49('0x19')](_0x4f49('0x11'),auth[_0x4f49('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller['notify']);router[_0x4f49('0x19')](_0x4f49('0x1a'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1b')]);router['post'](_0x4f49('0x1c'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x1d')]);router[_0x4f49('0x19')](_0x4f49('0x16'),controller['status']);router[_0x4f49('0x19')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller['addAgents']);router[_0x4f49('0x1f')](_0x4f49('0xe'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x20')]);router[_0x4f49('0x21')](_0x4f49('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x4f49('0x21')](_0x4f49('0x10'),auth['isAuthenticated'](),controller[_0x4f49('0x22')]);router[_0x4f49('0x21')](_0x4f49('0x11'),auth['isAuthenticated'](),controller[_0x4f49('0x23')]);router[_0x4f49('0x21')](_0x4f49('0x1e'),auth[_0x4f49('0xb')](),controller[_0x4f49('0x24')]);module[_0x4f49('0x25')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 043208b..9a2e564 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 _0xb719=['connectel','plivo','clickatell','bandwidth','csc','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','exports','STRING','name','generate','ENUM','twilio'];(function(_0x2a7846,_0x2d03b6){var _0xbb6609=function(_0x1e3320){while(--_0x1e3320){_0x2a7846['push'](_0x2a7846['shift']());}};_0xbb6609(++_0x2d03b6);}(_0xb719,0x78));var _0x9b71=function(_0x36d203,_0x3653f3){_0x36d203=_0x36d203-0x0;var _0x2f9e62=_0xb719[_0x36d203];return _0x2f9e62;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x9b71('0x0')]={'name':{'type':Sequelize[_0x9b71('0x1')],'unique':_0x9b71('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x9b71('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x9b71('0x1')],'defaultValue':function(){return rs[_0x9b71('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9b71('0x4')](_0x9b71('0x5'),'skebby',_0x9b71('0x6'),'clicksend',_0x9b71('0x7'),_0x9b71('0x8'),_0x9b71('0x9'),_0x9b71('0xa'),'infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x9b71('0x1')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x9b71('0x1')]},'smsMethod':{'type':Sequelize[_0x9b71('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x9b71('0x1')]},'password':{'type':Sequelize[_0x9b71('0x1')]},'apiKey':{'type':Sequelize[_0x9b71('0x1')]},'applicationId':{'type':Sequelize[_0x9b71('0x1')]},'accountId':{'type':Sequelize[_0x9b71('0x1')]},'senderString':{'type':Sequelize[_0x9b71('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x9b71('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9b71('0xb');}},'notificationSound':{'type':Sequelize[_0x9b71('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9b71('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9b71('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9b71('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9b71('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9b71('0xd')],'comment':_0x9b71('0xe')},'mandatoryDisposition':{'type':Sequelize[_0x9b71('0xc')],'defaultValue':![],'comment':_0x9b71('0xf'),'set':function(_0x383dd9){if(!_0x383dd9)this[_0x9b71('0x10')](_0x9b71('0x11'),null);this[_0x9b71('0x10')]('mandatoryDisposition',_0x383dd9);}}}; \ No newline at end of file +var _0x8e04=['csc','infobip','intelepeer','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','randomstring','exports','STRING','generate','ENUM','skebby','connectel','clicksend','plivo','clickatell','bandwidth'];(function(_0x43d214,_0x129225){var _0x48798e=function(_0x4ac6a8){while(--_0x4ac6a8){_0x43d214['push'](_0x43d214['shift']());}};_0x48798e(++_0x129225);}(_0x8e04,0xd9));var _0x48e0=function(_0x616fb8,_0x177e11){_0x616fb8=_0x616fb8-0x0;var _0x739e20=_0x8e04[_0x616fb8];return _0x739e20;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x48e0('0x0'));module[_0x48e0('0x1')]={'name':{'type':Sequelize[_0x48e0('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x48e0('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x48e0('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x48e0('0x2')],'defaultValue':function(){return rs[_0x48e0('0x3')]();}},'phone':{'type':Sequelize[_0x48e0('0x2')]},'type':{'type':Sequelize[_0x48e0('0x4')]('twilio',_0x48e0('0x5'),_0x48e0('0x6'),_0x48e0('0x7'),_0x48e0('0x8'),_0x48e0('0x9'),_0x48e0('0xa'),_0x48e0('0xb'),_0x48e0('0xc'),_0x48e0('0xd'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x48e0('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x48e0('0x2')]},'accountId':{'type':Sequelize[_0x48e0('0x2')]},'senderString':{'type':Sequelize[_0x48e0('0x2')]},'deliveryReport':{'type':Sequelize[_0x48e0('0xe')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x48e0('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x48e0('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x48e0('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x48e0('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x48e0('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x48e0('0xf')],'comment':_0x48e0('0x10')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x48e0('0x11'),'set':function(_0x25462e){if(!_0x25462e)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x48e0('0x12'),_0x25462e);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index eb978cf..502f5e1 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 _0x3c5a=['Disposition','getDispositions','removeDispositions','addAnswer','SmsAccountId','CannedAnswer','getAnswers','findOne','removeAnswers','ids','Applications','applications','orderBy','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','createdAt','CompanyId','mobile','twilio','Body','messageId','MessageSid','skebby','from','sender','clicksend','message_id','plivo','From','Text','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','text','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','omit','contact','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','agent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','Content-Type','\x0a','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','DELIVERED','groupName','bandwidth','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','addAgents','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','destroy','get','SmsAccounts','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','name','filter','merge','includeAll','findAll','rows','params','filters','fields','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition'];(function(_0xeb80e,_0x337608){var _0x68e9d7=function(_0x50c896){while(--_0x50c896){_0xeb80e['push'](_0xeb80e['shift']());}};_0x68e9d7(++_0x337608);}(_0x3c5a,0x82));var _0xa3c5=function(_0xa3fadc,_0xd1e16){_0xa3fadc=_0xa3fadc-0x0;var _0x23ecb8=_0x3c5a[_0xa3fadc];return _0x23ecb8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa3c5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa3c5('0x1'));var rp=require(_0xa3c5('0x2'));var moment=require('moment');var BPromise=require(_0xa3c5('0x3'));var Mustache=require(_0xa3c5('0x4'));var util=require(_0xa3c5('0x5'));var path=require(_0xa3c5('0x6'));var sox=require(_0xa3c5('0x7'));var csv=require(_0xa3c5('0x8'));var ejs=require(_0xa3c5('0x9'));var fs=require('fs');var fs_extra=require(_0xa3c5('0xa'));var _=require(_0xa3c5('0xb'));var squel=require(_0xa3c5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa3c5('0xd'));var toCsv=require(_0xa3c5('0x8'));var querystring=require(_0xa3c5('0xe'));var Papa=require(_0xa3c5('0xf'));var Redis=require(_0xa3c5('0x10'));var authService=require(_0xa3c5('0x11'));var qs=require(_0xa3c5('0x12'));var as=require(_0xa3c5('0x13'));var hardwareService=require(_0xa3c5('0x14'));var logger=require('../../config/logger')(_0xa3c5('0x15'));var utils=require(_0xa3c5('0x16'));var config=require(_0xa3c5('0x17'));var licenseUtil=require(_0xa3c5('0x18'));var db=require('../../mysqldb')['db'];config[_0xa3c5('0x19')]=_[_0xa3c5('0x1a')](config[_0xa3c5('0x19')],{'host':_0xa3c5('0x1b'),'port':0x18eb});var socket=require(_0xa3c5('0x1c'))(new Redis(config[_0xa3c5('0x19')]));require(_0xa3c5('0x1d'))[_0xa3c5('0x1e')](socket);var jayson=require(_0xa3c5('0x1f'));var client=jayson[_0xa3c5('0x20')][_0xa3c5('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x590c66,_0x503ba9,_0x5374cd,_0x461648){return new BPromise(function(_0xfbb44f,_0x40135d){var _0x344d84=_0x461648||client;return _0x344d84[_0xa3c5('0x22')](_0x590c66,_0x5374cd)[_0xa3c5('0x23')](function(_0x15cb1b){logger[_0xa3c5('0x24')](_0xa3c5('0x25'),_0x503ba9,_0xa3c5('0x26'));logger[_0xa3c5('0x27')](_0xa3c5('0x28'),_0x503ba9,_0xa3c5('0x26'),JSON[_0xa3c5('0x29')](_0x15cb1b));if(_0x15cb1b['error']){if(_0x15cb1b['error'][_0xa3c5('0x2a')]===0x1f4){logger['error'](_0xa3c5('0x25'),_0x503ba9,_0x15cb1b[_0xa3c5('0x2b')][_0xa3c5('0x2c')]);return _0x40135d(_0x15cb1b[_0xa3c5('0x2b')][_0xa3c5('0x2c')]);}logger['error'](_0xa3c5('0x25'),_0x503ba9,_0x15cb1b[_0xa3c5('0x2b')][_0xa3c5('0x2c')]);return _0xfbb44f(_0x15cb1b['error']['message']);}else{logger['info'](_0xa3c5('0x25'),_0x503ba9,'request\x20sent');_0xfbb44f(_0x15cb1b[_0xa3c5('0x2d')][_0xa3c5('0x2c')]);}})[_0xa3c5('0x2e')](function(_0x229c06){logger[_0xa3c5('0x2b')]('SmsAccount,\x20%s,\x20%s',_0x503ba9,_0x229c06);_0x40135d(_0x229c06);});});}function respondWithStatusCode(_0x135ae5,_0x473533){_0x473533=_0x473533||0xcc;return function(_0x433c41){if(_0x433c41){return _0x135ae5[_0xa3c5('0x2f')](_0x473533);}return _0x135ae5[_0xa3c5('0x30')](_0x473533)[_0xa3c5('0x31')]();};}function respondWithResult(_0x39b9a3,_0x3e7839){_0x3e7839=_0x3e7839||0xc8;return function(_0x1f8e70){if(_0x1f8e70){return _0x39b9a3['status'](_0x3e7839)['json'](_0x1f8e70);}};}function respondWithFilteredResult(_0x155cae,_0x206f63){return function(_0x109575){if(_0x109575){var _0x5c4be2=typeof _0x206f63[_0xa3c5('0x32')]==='undefined'&&typeof _0x206f63[_0xa3c5('0x33')]===_0xa3c5('0x34');var _0x389080=_0x109575[_0xa3c5('0x35')];var _0x1fd457=_0x5c4be2?0x0:_0x206f63[_0xa3c5('0x32')];var _0x19cc40=_0x5c4be2?_0x109575[_0xa3c5('0x35')]:_0x206f63[_0xa3c5('0x32')]+_0x206f63[_0xa3c5('0x33')];var _0x540c85;if(_0x19cc40>=_0x389080){_0x19cc40=_0x389080;_0x540c85=0xc8;}else{_0x540c85=0xce;}_0x155cae[_0xa3c5('0x30')](_0x540c85);return _0x155cae[_0xa3c5('0x36')](_0xa3c5('0x37'),_0x1fd457+'-'+_0x19cc40+'/'+_0x389080)[_0xa3c5('0x38')](_0x109575);}return null;};}function patchUpdates(_0x3787bd){return function(_0xa78060){try{jsonpatch[_0xa3c5('0x39')](_0xa78060,_0x3787bd,!![]);}catch(_0x1849c7){return BPromise['reject'](_0x1849c7);}return _0xa78060[_0xa3c5('0x3a')]();};}function saveUpdates(_0x540fb3,_0x4d2cb6){return function(_0x113def){if(_0x113def){return _0x113def[_0xa3c5('0x3b')](_0x540fb3)[_0xa3c5('0x23')](function(_0x4ee745){return _0x4ee745;});}return null;};}function removeEntity(_0x1b1188,_0x28790f){return function(_0x104e4a){if(_0x104e4a){return _0x104e4a[_0xa3c5('0x3c')]()['then'](function(){var _0x50cd47=_0x104e4a[_0xa3c5('0x3d')]({'plain':!![]});var _0x9db903=_0xa3c5('0x3e');return db['UserProfileResource'][_0xa3c5('0x3c')]({'where':{'type':_0x9db903,'resourceId':_0x50cd47['id']}})[_0xa3c5('0x23')](function(){return _0x104e4a;});})[_0xa3c5('0x23')](function(){_0x1b1188['status'](0xcc)[_0xa3c5('0x31')]();});}};}function handleEntityNotFound(_0x4abc8a,_0x23bcf5){return function(_0x530b9a){if(!_0x530b9a){_0x4abc8a[_0xa3c5('0x2f')](0x194);}return _0x530b9a;};}function handleError(_0x1bbace,_0x60b996){_0x60b996=_0x60b996||0x1f4;return function(_0x149cce){logger['error'](_0x149cce['stack']);if(_0x149cce['name']){delete _0x149cce['name'];}_0x1bbace[_0xa3c5('0x30')](_0x60b996)[_0xa3c5('0x3f')](_0x149cce);};}exports[_0xa3c5('0x40')]=function(_0x3c8c44,_0x146f15){var _0x11316a={'include':[{'model':db[_0xa3c5('0x41')],'as':_0xa3c5('0x42')}]},_0x4a14f1={},_0x457d32={'count':0x0,'rows':[]};var _0x1e1a53=_[_0xa3c5('0x43')](db[_0xa3c5('0x44')][_0xa3c5('0x45')],function(_0x3f0fc2){return{'name':_0x3f0fc2[_0xa3c5('0x46')],'type':_0x3f0fc2[_0xa3c5('0x47')][_0xa3c5('0x48')]};});_0x4a14f1[_0xa3c5('0x49')]=_[_0xa3c5('0x43')](_0x1e1a53,'name');_0x4a14f1[_0xa3c5('0x4a')]=_[_0xa3c5('0x4b')](_0x3c8c44[_0xa3c5('0x4a')]);_0x4a14f1['filters']=_['intersection'](_0x4a14f1[_0xa3c5('0x49')],_0x4a14f1[_0xa3c5('0x4a')]);_0x11316a[_0xa3c5('0x4c')]=_[_0xa3c5('0x4d')](_0x4a14f1[_0xa3c5('0x49')],qs['fields'](_0x3c8c44['query']['fields']));_0x11316a[_0xa3c5('0x4c')]=_0x11316a[_0xa3c5('0x4c')][_0xa3c5('0x4e')]?_0x11316a[_0xa3c5('0x4c')]:_0x4a14f1['model'];if(!_0x3c8c44[_0xa3c5('0x4a')][_0xa3c5('0x4f')](_0xa3c5('0x50'))){_0x11316a[_0xa3c5('0x33')]=qs[_0xa3c5('0x33')](_0x3c8c44[_0xa3c5('0x4a')][_0xa3c5('0x33')]);_0x11316a['offset']=qs['offset'](_0x3c8c44['query'][_0xa3c5('0x32')]);}_0x11316a[_0xa3c5('0x51')]=qs[_0xa3c5('0x52')](_0x3c8c44[_0xa3c5('0x4a')]['sort']);_0x11316a[_0xa3c5('0x53')]=qs['filters'](_[_0xa3c5('0x54')](_0x3c8c44['query'],_0x4a14f1['filters']),_0x1e1a53);if(_0x3c8c44[_0xa3c5('0x4a')]['filter']){_0x11316a[_0xa3c5('0x53')]=_['merge'](_0x11316a[_0xa3c5('0x53')],{'$or':_['map'](_0x1e1a53,function(_0x1e35aa){if(_0x1e35aa[_0xa3c5('0x47')]!==_0xa3c5('0x55')){var _0x34a5c5={};_0x34a5c5[_0x1e35aa[_0xa3c5('0x56')]]={'$like':'%'+_0x3c8c44[_0xa3c5('0x4a')][_0xa3c5('0x57')]+'%'};return _0x34a5c5;}})});}_0x11316a=_[_0xa3c5('0x58')]({},_0x11316a,_0x3c8c44['options']);var _0x4a4481={'where':_0x11316a[_0xa3c5('0x53')]};return db[_0xa3c5('0x44')]['count'](_0x4a4481)['then'](function(_0x21d8c4){_0x457d32[_0xa3c5('0x35')]=_0x21d8c4;if(_0x3c8c44['query'][_0xa3c5('0x59')]){_0x11316a['include']=[{'all':!![]}];}return db[_0xa3c5('0x44')][_0xa3c5('0x5a')](_0x11316a);})[_0xa3c5('0x23')](function(_0x167ede){_0x457d32[_0xa3c5('0x5b')]=_0x167ede;return _0x457d32;})[_0xa3c5('0x23')](respondWithFilteredResult(_0x146f15,_0x11316a))[_0xa3c5('0x2e')](handleError(_0x146f15,null));};exports['show']=function(_0x106189,_0x546e4c){var _0x22578f={'raw':![],'where':{'id':_0x106189[_0xa3c5('0x5c')]['id']},'include':[{'model':db[_0xa3c5('0x41')],'as':_0xa3c5('0x42')}]},_0x1c2ac6={};_0x1c2ac6['model']=_[_0xa3c5('0x4b')](db[_0xa3c5('0x44')][_0xa3c5('0x45')]);_0x1c2ac6['query']=_[_0xa3c5('0x4b')](_0x106189[_0xa3c5('0x4a')]);_0x1c2ac6[_0xa3c5('0x5d')]=_[_0xa3c5('0x4d')](_0x1c2ac6[_0xa3c5('0x49')],_0x1c2ac6['query']);_0x22578f[_0xa3c5('0x4c')]=_[_0xa3c5('0x4d')](_0x1c2ac6[_0xa3c5('0x49')],qs[_0xa3c5('0x5e')](_0x106189[_0xa3c5('0x4a')][_0xa3c5('0x5e')]));_0x22578f['attributes']=_0x22578f[_0xa3c5('0x4c')][_0xa3c5('0x4e')]?_0x22578f[_0xa3c5('0x4c')]:_0x1c2ac6['model'];if(_0x106189[_0xa3c5('0x4a')]['includeAll']){_0x22578f[_0xa3c5('0x5f')]=[{'all':!![]}];}_0x22578f=_[_0xa3c5('0x58')]({},_0x22578f,_0x106189[_0xa3c5('0x60')]);return db['SmsAccount']['find'](_0x22578f)[_0xa3c5('0x23')](handleEntityNotFound(_0x546e4c,null))[_0xa3c5('0x23')](respondWithResult(_0x546e4c,null))['catch'](handleError(_0x546e4c,null));};exports[_0xa3c5('0x61')]=function(_0xdcafaf,_0x270315){return db['SmsAccount']['create'](_0xdcafaf[_0xa3c5('0x62')],{})[_0xa3c5('0x23')](function(_0x1e562f){var _0x1efe47=_0xdcafaf[_0xa3c5('0x63')][_0xa3c5('0x3d')]({'plain':!![]});if(!_0x1efe47)throw new Error(_0xa3c5('0x64'));if(_0x1efe47[_0xa3c5('0x65')]===_0xa3c5('0x63')){var _0x544e87=_0x1e562f[_0xa3c5('0x3d')]({'plain':!![]});var _0x10afd3=_0xa3c5('0x3e');return db[_0xa3c5('0x66')]['find']({'where':{'name':_0x10afd3,'userProfileId':_0x1efe47['userProfileId']},'raw':!![]})[_0xa3c5('0x23')](function(_0x545ed3){if(_0x545ed3&&_0x545ed3[_0xa3c5('0x67')]===0x0){return db['UserProfileResource'][_0xa3c5('0x61')]({'name':_0x544e87[_0xa3c5('0x56')],'resourceId':_0x544e87['id'],'type':_0x545ed3['name'],'sectionId':_0x545ed3['id']},{})[_0xa3c5('0x23')](function(){return _0x1e562f;});}else{return _0x1e562f;}})[_0xa3c5('0x2e')](function(_0x110c0c){logger[_0xa3c5('0x2b')](_0xa3c5('0x68'),_0x110c0c);throw _0x110c0c;});}return _0x1e562f;})[_0xa3c5('0x23')](respondWithResult(_0x270315,0xc9))[_0xa3c5('0x2e')](handleError(_0x270315,null));};exports[_0xa3c5('0x3b')]=function(_0x2c86d7,_0x3527ff){if(_0x2c86d7[_0xa3c5('0x62')]['id']){delete _0x2c86d7[_0xa3c5('0x62')]['id'];}return db[_0xa3c5('0x44')]['find']({'where':{'id':_0x2c86d7[_0xa3c5('0x5c')]['id']},'include':[{'model':db[_0xa3c5('0x41')],'as':_0xa3c5('0x42')}]})['then'](handleEntityNotFound(_0x3527ff,null))['then'](saveUpdates(_0x2c86d7[_0xa3c5('0x62')],null))[_0xa3c5('0x23')](respondWithResult(_0x3527ff,null))[_0xa3c5('0x2e')](handleError(_0x3527ff,null));};exports[_0xa3c5('0x3c')]=function(_0x4b9e56,_0x438e68){return db[_0xa3c5('0x44')][_0xa3c5('0x69')]({'where':{'id':_0x4b9e56[_0xa3c5('0x5c')]['id']}})[_0xa3c5('0x23')](handleEntityNotFound(_0x438e68,null))[_0xa3c5('0x23')](removeEntity(_0x438e68,null))[_0xa3c5('0x2e')](handleError(_0x438e68,null));};exports['describe']=function(_0x485c31,_0x2eba81){return db[_0xa3c5('0x44')][_0xa3c5('0x6a')]()[_0xa3c5('0x23')](respondWithResult(_0x2eba81,null))['catch'](handleError(_0x2eba81,null));};exports[_0xa3c5('0x6b')]=function(_0x299c0a,_0xe061bf,_0x477fef){if(_0x299c0a[_0xa3c5('0x62')]['id']){delete _0x299c0a[_0xa3c5('0x62')]['id'];}return db[_0xa3c5('0x44')][_0xa3c5('0x69')]({'where':{'id':_0x299c0a[_0xa3c5('0x5c')]['id']}})['then'](handleEntityNotFound(_0xe061bf,null))['then'](function(_0x2b85af){if(_0x2b85af){_0x299c0a[_0xa3c5('0x62')]['SmsAccountId']=_0x2b85af['id'];return db[_0xa3c5('0x6c')][_0xa3c5('0x61')](_0x299c0a[_0xa3c5('0x62')]);}})[_0xa3c5('0x23')](respondWithResult(_0xe061bf,null))[_0xa3c5('0x2e')](handleError(_0xe061bf,null));};exports[_0xa3c5('0x6d')]=function(_0x13a510,_0x5559af,_0x202c95){var _0x2c46c6={'raw':![],'where':{}};var _0x1db98e={};var _0x6b911f={'count':0x0,'rows':[]};return db[_0xa3c5('0x44')]['findOne']({'where':{'id':_0x13a510['params']['id']}})[_0xa3c5('0x23')](handleEntityNotFound(_0x5559af,null))[_0xa3c5('0x23')](function(_0x3df165){if(_0x3df165){_0x1db98e[_0xa3c5('0x49')]=_[_0xa3c5('0x4b')](db[_0xa3c5('0x6c')][_0xa3c5('0x45')]);_0x1db98e[_0xa3c5('0x4a')]=_[_0xa3c5('0x4b')](_0x13a510[_0xa3c5('0x4a')]);_0x1db98e['filters']=_[_0xa3c5('0x4d')](_0x1db98e[_0xa3c5('0x49')],_0x1db98e['query']);_0x2c46c6[_0xa3c5('0x4c')]=_['intersection'](_0x1db98e['model'],qs['fields'](_0x13a510[_0xa3c5('0x4a')][_0xa3c5('0x5e')]));_0x2c46c6[_0xa3c5('0x4c')]=_0x2c46c6['attributes'][_0xa3c5('0x4e')]?_0x2c46c6[_0xa3c5('0x4c')]:_0x1db98e[_0xa3c5('0x49')];if(!_0x13a510[_0xa3c5('0x4a')]['hasOwnProperty'](_0xa3c5('0x50'))){_0x2c46c6[_0xa3c5('0x33')]=qs[_0xa3c5('0x33')](_0x13a510['query'][_0xa3c5('0x33')]);_0x2c46c6['offset']=qs[_0xa3c5('0x32')](_0x13a510['query']['offset']);}_0x2c46c6[_0xa3c5('0x51')]=qs[_0xa3c5('0x52')](_0x13a510[_0xa3c5('0x4a')]['sort']);_0x2c46c6[_0xa3c5('0x53')]=qs['filters'](_[_0xa3c5('0x54')](_0x13a510[_0xa3c5('0x4a')],_0x1db98e[_0xa3c5('0x5d')]));_0x2c46c6[_0xa3c5('0x53')]['SmsAccountId']=_0x3df165['id'];if(_0x13a510['query']['filter']){_0x2c46c6['where']=_[_0xa3c5('0x58')](_0x2c46c6['where'],{'$or':_['map'](_0x2c46c6[_0xa3c5('0x4c')],function(_0x34bd9a){var _0x1efe1d={};_0x1efe1d[_0x34bd9a]={'$like':'%'+_0x13a510['query'][_0xa3c5('0x57')]+'%'};return _0x1efe1d;})});}_0x2c46c6=_[_0xa3c5('0x58')]({},_0x2c46c6,_0x13a510['options']);return db[_0xa3c5('0x6c')][_0xa3c5('0x35')]({'where':_0x2c46c6[_0xa3c5('0x53')]})['then'](function(_0x1e8f39){_0x6b911f[_0xa3c5('0x35')]=_0x1e8f39;if(_0x13a510[_0xa3c5('0x4a')][_0xa3c5('0x59')]){_0x2c46c6[_0xa3c5('0x5f')]=[{'all':!![]}];}return db['Disposition'][_0xa3c5('0x5a')](_0x2c46c6);})['then'](function(_0x4b6e28){_0x6b911f['rows']=_0x4b6e28;return _0x6b911f;});}})[_0xa3c5('0x23')](respondWithFilteredResult(_0x5559af,_0x2c46c6))[_0xa3c5('0x2e')](handleError(_0x5559af,null));};exports[_0xa3c5('0x6e')]=function(_0x459f73,_0x446063,_0x3ae462){return db[_0xa3c5('0x44')][_0xa3c5('0x69')]({'where':{'id':_0x459f73[_0xa3c5('0x5c')]['id']}})[_0xa3c5('0x23')](handleEntityNotFound(_0x446063,null))[_0xa3c5('0x23')](function(_0x371d05){if(_0x371d05){return _0x371d05[_0xa3c5('0x6e')](_0x459f73['query']['ids']);}})[_0xa3c5('0x23')](respondWithStatusCode(_0x446063,null))['catch'](handleError(_0x446063,null));};exports[_0xa3c5('0x6f')]=function(_0x2af198,_0x5ac4f0,_0x1e9180){if(_0x2af198[_0xa3c5('0x62')]['id']){delete _0x2af198[_0xa3c5('0x62')]['id'];}return db[_0xa3c5('0x44')]['find']({'where':{'id':_0x2af198['params']['id']}})[_0xa3c5('0x23')](handleEntityNotFound(_0x5ac4f0,null))[_0xa3c5('0x23')](function(_0x40605c){if(_0x40605c){_0x2af198[_0xa3c5('0x62')][_0xa3c5('0x70')]=_0x40605c['id'];return db[_0xa3c5('0x71')][_0xa3c5('0x61')](_0x2af198[_0xa3c5('0x62')]);}})[_0xa3c5('0x23')](respondWithResult(_0x5ac4f0,null))['catch'](handleError(_0x5ac4f0,null));};exports[_0xa3c5('0x72')]=function(_0x24a12d,_0x48842b,_0x56d9b9){var _0x3eece9={'raw':![],'where':{}};var _0x27bb3e={};var _0x30305d={'count':0x0,'rows':[]};return db[_0xa3c5('0x44')][_0xa3c5('0x73')]({'where':{'id':_0x24a12d[_0xa3c5('0x5c')]['id']}})[_0xa3c5('0x23')](handleEntityNotFound(_0x48842b,null))[_0xa3c5('0x23')](function(_0x4a21bb){if(_0x4a21bb){_0x27bb3e[_0xa3c5('0x49')]=_[_0xa3c5('0x4b')](db[_0xa3c5('0x71')][_0xa3c5('0x45')]);_0x27bb3e['query']=_[_0xa3c5('0x4b')](_0x24a12d[_0xa3c5('0x4a')]);_0x27bb3e[_0xa3c5('0x5d')]=_['intersection'](_0x27bb3e[_0xa3c5('0x49')],_0x27bb3e[_0xa3c5('0x4a')]);_0x3eece9[_0xa3c5('0x4c')]=_['intersection'](_0x27bb3e[_0xa3c5('0x49')],qs[_0xa3c5('0x5e')](_0x24a12d[_0xa3c5('0x4a')]['fields']));_0x3eece9[_0xa3c5('0x4c')]=_0x3eece9[_0xa3c5('0x4c')][_0xa3c5('0x4e')]?_0x3eece9[_0xa3c5('0x4c')]:_0x27bb3e['model'];if(!_0x24a12d[_0xa3c5('0x4a')][_0xa3c5('0x4f')](_0xa3c5('0x50'))){_0x3eece9[_0xa3c5('0x33')]=qs[_0xa3c5('0x33')](_0x24a12d['query'][_0xa3c5('0x33')]);_0x3eece9[_0xa3c5('0x32')]=qs['offset'](_0x24a12d[_0xa3c5('0x4a')][_0xa3c5('0x32')]);}_0x3eece9['order']=qs[_0xa3c5('0x52')](_0x24a12d[_0xa3c5('0x4a')][_0xa3c5('0x52')]);_0x3eece9[_0xa3c5('0x53')]=qs[_0xa3c5('0x5d')](_[_0xa3c5('0x54')](_0x24a12d['query'],_0x27bb3e['filters']));_0x3eece9[_0xa3c5('0x53')][_0xa3c5('0x70')]=_0x4a21bb['id'];if(_0x24a12d['query'][_0xa3c5('0x57')]){_0x3eece9[_0xa3c5('0x53')]=_[_0xa3c5('0x58')](_0x3eece9[_0xa3c5('0x53')],{'$or':_['map'](_0x3eece9[_0xa3c5('0x4c')],function(_0x3fb9e){var _0x1e01de={};_0x1e01de[_0x3fb9e]={'$like':'%'+_0x24a12d[_0xa3c5('0x4a')][_0xa3c5('0x57')]+'%'};return _0x1e01de;})});}_0x3eece9=_[_0xa3c5('0x58')]({},_0x3eece9,_0x24a12d['options']);return db['CannedAnswer']['count']({'where':_0x3eece9[_0xa3c5('0x53')]})['then'](function(_0x2fdf31){_0x30305d[_0xa3c5('0x35')]=_0x2fdf31;if(_0x24a12d[_0xa3c5('0x4a')]['includeAll']){_0x3eece9[_0xa3c5('0x5f')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3eece9);})[_0xa3c5('0x23')](function(_0x3a8a2d){_0x30305d[_0xa3c5('0x5b')]=_0x3a8a2d;return _0x30305d;});}})['then'](respondWithFilteredResult(_0x48842b,_0x3eece9))[_0xa3c5('0x2e')](handleError(_0x48842b,null));};exports[_0xa3c5('0x74')]=function(_0x27f776,_0x10666a,_0x432010){return db[_0xa3c5('0x44')]['find']({'where':{'id':_0x27f776['params']['id']}})[_0xa3c5('0x23')](handleEntityNotFound(_0x10666a,null))[_0xa3c5('0x23')](function(_0x46ce91){if(_0x46ce91){return _0x46ce91[_0xa3c5('0x74')](_0x27f776[_0xa3c5('0x4a')][_0xa3c5('0x75')]);}})['then'](respondWithStatusCode(_0x10666a,null))[_0xa3c5('0x2e')](handleError(_0x10666a,null));};exports['notify']=function(_0x3dcff6,_0x95da76,_0x1926f9){var _0x28f90d={'channel':'sms'};var _0x5769d6=[];var _0xd42954=[];var _0xa9de9f={};return db['SmsAccount'][_0xa3c5('0x69')]({'where':{'id':_0x3dcff6[_0xa3c5('0x5c')]['id']},'include':[{'model':db['SmsApplication'],'as':_0xa3c5('0x76')}]})['then'](handleEntityNotFound(_0x95da76,null))['then'](function(_0x17df84){_0x28f90d['account']=_0x17df84;_0x28f90d[_0xa3c5('0x77')]=_[_0xa3c5('0x78')](_0x17df84[_0xa3c5('0x76')],['priority'],[_0xa3c5('0x79')]);if(_0x28f90d['account'][_0xa3c5('0x76')]){delete _0x28f90d[_0xa3c5('0x7a')][_0xa3c5('0x76')];}return db[_0xa3c5('0x7b')]['describe']();})['then'](function(_0x4c5047){if(!_0x4c5047){throw new db[(_0xa3c5('0x7c'))][(_0xa3c5('0x7d'))](_0xa3c5('0x7e'));}_0x5769d6=_['difference'](_[_0xa3c5('0x4b')](_0x4c5047),['createdAt',_0xa3c5('0x7f')]);_0xd42954=_['difference'](_[_0xa3c5('0x4b')](_0x4c5047),[_0xa3c5('0x80'),_0xa3c5('0x7f'),_0xa3c5('0x81'),'ListId']);_0x28f90d[_0xa3c5('0x62')]={'mapKey':_0xa3c5('0x82')};if(_0x28f90d[_0xa3c5('0x7a')][_0xa3c5('0x47')]){switch(_0x28f90d[_0xa3c5('0x7a')][_0xa3c5('0x47')]){case _0xa3c5('0x83'):_0x28f90d['body']['from']=_0x3dcff6[_0xa3c5('0x62')]['From'];_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x62')]=_0x3dcff6[_0xa3c5('0x62')][_0xa3c5('0x84')];_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x85')]=_0x3dcff6[_0xa3c5('0x62')][_0xa3c5('0x86')];break;case _0xa3c5('0x87'):_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x88')]='+'+_0x3dcff6[_0xa3c5('0x62')][_0xa3c5('0x89')];_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x62')]=_0x3dcff6[_0xa3c5('0x62')]['text'];break;case'connectel':_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x88')]=_0x3dcff6[_0xa3c5('0x62')]['from'];_0x28f90d['body'][_0xa3c5('0x62')]=_0x3dcff6[_0xa3c5('0x62')]['message'];break;case _0xa3c5('0x8a'):_0x28f90d[_0xa3c5('0x62')]['from']=_0x3dcff6[_0xa3c5('0x62')][_0xa3c5('0x88')];_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x62')]=_0x3dcff6[_0xa3c5('0x62')][_0xa3c5('0x62')];_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x85')]=_0x3dcff6[_0xa3c5('0x62')][_0xa3c5('0x8b')];break;case _0xa3c5('0x8c'):_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x88')]=_0x3dcff6[_0xa3c5('0x62')][_0xa3c5('0x8d')];_0x28f90d[_0xa3c5('0x62')]['body']=_0x3dcff6['body'][_0xa3c5('0x8e')];_0x28f90d['body'][_0xa3c5('0x85')]=_0x3dcff6[_0xa3c5('0x62')][_0xa3c5('0x8f')];break;case _0xa3c5('0x90'):_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x88')]='+'+_0x3dcff6[_0xa3c5('0x62')][_0xa3c5('0x91')][0x0][_0xa3c5('0x88')];_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x62')]=_0x3dcff6[_0xa3c5('0x62')]['results'][0x0]['text'];_0x28f90d[_0xa3c5('0x62')]['messageId']=_0x3dcff6[_0xa3c5('0x62')][_0xa3c5('0x91')][0x0][_0xa3c5('0x85')];break;case _0xa3c5('0x92'):_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x88')]=_0x3dcff6[_0xa3c5('0x62')][_0xa3c5('0x93')];_0x28f90d['body'][_0xa3c5('0x62')]=_0x3dcff6[_0xa3c5('0x62')]['segmentedMessage']['message'];break;case _0xa3c5('0x94'):_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x88')]=_0x3dcff6['body'][_0xa3c5('0x95')];_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x62')]=_0x3dcff6[_0xa3c5('0x62')][_0xa3c5('0x96')];_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x85')]=_0x3dcff6[_0xa3c5('0x62')][_0xa3c5('0x97')];break;case'bandwidth':_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x85')]=_0x3dcff6[_0xa3c5('0x62')][0x0][_0xa3c5('0x2c')]['id'];_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x88')]=_0x3dcff6[_0xa3c5('0x62')][0x0][_0xa3c5('0x2c')][_0xa3c5('0x88')];_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x62')]=_0x3dcff6[_0xa3c5('0x62')][0x0]['message'][_0xa3c5('0x96')];break;case _0xa3c5('0x98'):_0x28f90d['body']['from']=_0x3dcff6['body'][_0xa3c5('0x88')];_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x62')]=_0x3dcff6['body'][_0xa3c5('0x2c')];_0x28f90d['body'][_0xa3c5('0x85')]=_0x3dcff6[_0xa3c5('0x62')][_0xa3c5('0x99')];break;}}if(_0x28f90d['body']['id']){delete _0x28f90d[_0xa3c5('0x62')]['id'];}if(_[_0xa3c5('0x9a')](_0x28f90d['body'][_0xa3c5('0x88')])){throw new db['Sequelize']['ValidationError'](_0xa3c5('0x9b'));}if(_[_0xa3c5('0x9a')](_0x28f90d['body']['body'])||_0x28f90d[_0xa3c5('0x62')]['body']===''){throw new db[(_0xa3c5('0x7c'))][(_0xa3c5('0x7d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x28f90d['body'][_0xa3c5('0x9c')])){throw new db['Sequelize']['ValidationError'](_0xa3c5('0x9d')+_0xd42954);}if(!_[_0xa3c5('0x9e')](_0xd42954,_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x9c')])){throw new db[(_0xa3c5('0x7c'))][(_0xa3c5('0x7d'))](_0xa3c5('0x9f')+_0xd42954);}_0xa9de9f[_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x9c')]]=_0x28f90d['body'][_0xa3c5('0x88')];return db[_0xa3c5('0xa0')][_0xa3c5('0x69')]({'where':{'id':_0x28f90d[_0xa3c5('0x7a')][_0xa3c5('0xa1')]},'include':[{'model':db[_0xa3c5('0x7b')],'as':_0xa3c5('0xa2'),'where':_0xa9de9f,'limit':0x1,'order':[[_0xa3c5('0x7f'),_0xa3c5('0xa3')]]}]});})[_0xa3c5('0x23')](handleEntityNotFound(_0x95da76,null))[_0xa3c5('0x23')](function(_0x4851a5){if(_0x4851a5){_0x28f90d['list']=_[_0xa3c5('0xa4')](_0x4851a5,[_0xa3c5('0xa2')]);if(_0x4851a5['Contacts'][_0xa3c5('0x4e')]){return _0x4851a5[_0xa3c5('0xa2')][0x0];}var _0x31c373=_[_0xa3c5('0x1a')](_0x28f90d[_0xa3c5('0x62')],{'firstName':_0x28f90d['body'][_0xa3c5('0x88')],'ListId':_0x4851a5['id']});_0x31c373[_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x9c')]]=_0x28f90d[_0xa3c5('0x62')]['from'];return db[_0xa3c5('0x7b')]['create'](_0x31c373,{'fields':_0x5769d6,'raw':!![]});}})['then'](handleEntityNotFound(_0x95da76,null))[_0xa3c5('0x23')](function(_0x42180a){if(_0x42180a){_0x28f90d[_0xa3c5('0xa5')]=_0x42180a;var _0x468ce0={'ContactId':_0x42180a['id'],'phone':_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x88')],'SmsAccountId':_0x3dcff6['params']['id']};var _0x2f3f52={'ContactId':_0x42180a['id'],'SmsAccountId':_0x3dcff6[_0xa3c5('0x5c')]['id'],'closed':![]};return db[_0xa3c5('0xa6')][_0xa3c5('0x69')]({'where':_0x2f3f52})[_0xa3c5('0x23')](function(_0xfeeae1){if(_0xfeeae1){return[_0xfeeae1,![]];}return db[_0xa3c5('0xa6')]['create'](_0x468ce0)[_0xa3c5('0x23')](function(_0x1a6bfe){return[_0x1a6bfe,!![]];});});}})['spread'](function(_0x14bf57,_0x2bd47d){_0x28f90d[_0xa3c5('0xa7')]=_0x14bf57[_0xa3c5('0x3d')]({'plain':!![]});_0x28f90d[_0xa3c5('0xa7')][_0xa3c5('0xa8')]=![];if(_0x2bd47d){if(_0x28f90d['account'][_0xa3c5('0xa9')]){_0x28f90d[_0xa3c5('0x77')][_0xa3c5('0xaa')]({'id':0x0,'priority':_0x28f90d[_0xa3c5('0x77')]['length']+0x1,'app':_0xa3c5('0xab'),'appdata':_0xa3c5('0xac'),'interval':'*,*,*,*'});}_0x28f90d[_0xa3c5('0xa7')][_0xa3c5('0xa8')]=!![];}return db[_0xa3c5('0xad')]['create']({'phone':_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x88')],'messageId':_0x28f90d[_0xa3c5('0x62')][_0xa3c5('0x85')],'body':_0x28f90d['body'][_0xa3c5('0x62')],'SmsAccountId':_0x3dcff6[_0xa3c5('0x5c')]['id'],'SmsInteractionId':_0x14bf57['id'],'direction':'in','ContactId':_0x14bf57[_0xa3c5('0xae')],'AttachmentId':_0x28f90d['body'][_0xa3c5('0xaf')]});})[_0xa3c5('0x23')](function(_0x54b8d7){_0x28f90d['message']=_0x54b8d7;if(_0x28f90d['interaction'][_0xa3c5('0xb0')]){return db['User']['find']({'attributes':['id',_0xa3c5('0x56')],'where':{'id':_0x28f90d['interaction']['UserId']}})[_0xa3c5('0x23')](function(_0x1bb91a){if(_0x1bb91a){_0x28f90d['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xa3c5('0xb1'),'appdata':_0x1bb91a['name']+','+(_0x28f90d[_0xa3c5('0x7a')]['waitForTheAssignedAgent']||0xa),'interval':_0xa3c5('0xb2')});}return respondWithRpcPromise(_0xa3c5('0xb3'),_0xa3c5('0xb4'),_0x28f90d);});}return respondWithRpcPromise(_0xa3c5('0xb3'),_0xa3c5('0xb4'),_0x28f90d);})[_0xa3c5('0x23')](function(_0x3b41b2){if(_0x3b41b2){var _0x2d1177=0xc8;var _0xa5e02f=_0xa3c5('0xb5');logger[_0xa3c5('0x24')](_0xa3c5('0x28'),_0xa5e02f,_0x2d1177,_0xa3c5('0xb6'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xa5e02f,_0x2d1177,_0xa3c5('0xb6'),JSON[_0xa3c5('0x29')](_0x3b41b2));if(_0x28f90d[_0xa3c5('0x7a')][_0xa3c5('0x47')]===_0xa3c5('0x83')){return _0x95da76[_0xa3c5('0x30')](_0x2d1177)[_0xa3c5('0x36')](_0xa3c5('0xb7'),'text/xml')[_0xa3c5('0x3f')](_0xa3c5('0xb8'));}else{return _0x95da76['status'](_0x2d1177)[_0xa3c5('0x38')](_0x3b41b2);}}})['catch'](handleError(_0x95da76,null));};exports[_0xa3c5('0xb9')]=function(_0x3b24fe,_0x65c96f){var _0x5241bd=_0x3b24fe[_0xa3c5('0x5c')]['id'];var _0x1715ed=_0x3b24fe[_0xa3c5('0x62')];var _0x36500a=0xc8;var _0x35631a=null;return db[_0xa3c5('0xba')][_0xa3c5('0xbb')]({'isolationLevel':db[_0xa3c5('0xba')][_0xa3c5('0xbc')]['ISOLATION_LEVELS'][_0xa3c5('0xbd')]},function(_0x250de4){return db['SmsAccount'][_0xa3c5('0x73')]({'where':{'id':_0x5241bd},'transaction':_0x250de4})[_0xa3c5('0x23')](function(_0x1c0011){if(_0x1c0011){return db[_0xa3c5('0xbe')][_0xa3c5('0x3c')]({'where':{'SmsAccountId':_0x5241bd},'transaction':_0x250de4})[_0xa3c5('0x23')](function(){var _0x21cbba=_[_0xa3c5('0x43')](_0x1715ed,function(_0x119b70){_0x119b70[_0xa3c5('0x70')]=_0x5241bd;return _0x119b70;});return db['SmsApplication'][_0xa3c5('0xbf')](_0x21cbba,{'transaction':_0x250de4});});}else{_0x36500a=0x194;_0x35631a=[];}});})['then'](function(){if(_0x36500a!==0x194){return db[_0xa3c5('0xbe')][_0xa3c5('0xc0')]({'where':{'SmsAccountId':_0x5241bd},'order':_0xa3c5('0xc1')})[_0xa3c5('0x23')](function(_0x3197fe){_0x35631a=_0x3197fe;});}})[_0xa3c5('0x2e')](function(_0x1b0698){_0x36500a=0x1f4;logger[_0xa3c5('0x2b')](_0x1b0698['stack']);if(_0x1b0698['name']){delete _0x1b0698['name'];}_0x35631a=_0x1b0698;})[_0xa3c5('0xc2')](function(){if(_0x35631a===null){_0x65c96f[_0xa3c5('0x2f')](_0x36500a);}else{if(_0x36500a===0x1f4){_0x65c96f[_0xa3c5('0x30')](_0x36500a)[_0xa3c5('0x3f')](_0x35631a);}else{_0x65c96f[_0xa3c5('0x30')](_0x36500a)[_0xa3c5('0x38')](_0x35631a);}}});};exports[_0xa3c5('0xc3')]=function(_0x294847,_0x3c5c3f,_0x569150){var _0x5fde47={};var _0x20cf49={};var _0x69348c;var _0x5a7d34;return db[_0xa3c5('0x44')]['findOne']({'where':{'id':_0x294847[_0xa3c5('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3c5c3f,null))[_0xa3c5('0x23')](function(_0x1e2729){if(_0x1e2729){_0x69348c=_0x1e2729;_0x20cf49[_0xa3c5('0x49')]=_[_0xa3c5('0x4b')](db[_0xa3c5('0xbe')][_0xa3c5('0x45')]);_0x20cf49[_0xa3c5('0x4a')]=_[_0xa3c5('0x4b')](_0x294847[_0xa3c5('0x4a')]);_0x20cf49[_0xa3c5('0x5d')]=_[_0xa3c5('0x4d')](_0x20cf49[_0xa3c5('0x49')],_0x20cf49[_0xa3c5('0x4a')]);_0x5fde47[_0xa3c5('0x4c')]=_['intersection'](_0x20cf49[_0xa3c5('0x49')],qs[_0xa3c5('0x5e')](_0x294847['query'][_0xa3c5('0x5e')]));_0x5fde47[_0xa3c5('0x4c')]=_0x5fde47['attributes']['length']?_0x5fde47[_0xa3c5('0x4c')]:_0x20cf49[_0xa3c5('0x49')];_0x5fde47[_0xa3c5('0x51')]=qs[_0xa3c5('0x52')](_0x294847[_0xa3c5('0x4a')][_0xa3c5('0x52')]);_0x5fde47[_0xa3c5('0x53')]=qs[_0xa3c5('0x5d')](_[_0xa3c5('0x54')](_0x294847[_0xa3c5('0x4a')],_0x20cf49[_0xa3c5('0x5d')]));if(_0x294847[_0xa3c5('0x4a')]['filter']){_0x5fde47[_0xa3c5('0x53')]=_[_0xa3c5('0x58')](_0x5fde47[_0xa3c5('0x53')],{'$or':_[_0xa3c5('0x43')](_0x5fde47[_0xa3c5('0x4c')],function(_0x51ebde){var _0x2df31e={};_0x2df31e[_0x51ebde]={'$like':'%'+_0x294847['query'][_0xa3c5('0x57')]+'%'};return _0x2df31e;})});}_0x5fde47=_[_0xa3c5('0x58')]({},_0x5fde47,_0x294847[_0xa3c5('0x60')]);return _0x69348c[_0xa3c5('0xc3')](_0x5fde47);}})['then'](function(_0x22e409){if(_0x22e409){_0x5a7d34=_0x22e409[_0xa3c5('0x4e')];if(!_0x294847[_0xa3c5('0x4a')][_0xa3c5('0x4f')](_0xa3c5('0x50'))){_0x5fde47['limit']=qs[_0xa3c5('0x33')](_0x294847[_0xa3c5('0x4a')][_0xa3c5('0x33')]);_0x5fde47['offset']=qs[_0xa3c5('0x32')](_0x294847['query'][_0xa3c5('0x32')]);}return _0x69348c[_0xa3c5('0xc3')](_0x5fde47);}})[_0xa3c5('0x23')](function(_0x3de166){if(_0x3de166){return _0x3de166?{'count':_0x5a7d34,'rows':_0x3de166}:null;}})[_0xa3c5('0x23')](respondWithResult(_0x3c5c3f,null))['catch'](handleError(_0x3c5c3f,null));};exports[_0xa3c5('0xc4')]=function(_0x45fb51,_0x17e7a4,_0xf04718){var _0x1018bf={'raw':![],'where':{}};var _0x55b4ac={};var _0x28a864={'count':0x0,'rows':[]};return db[_0xa3c5('0x44')]['findOne']({'where':{'id':_0x45fb51[_0xa3c5('0x5c')]['id']}})[_0xa3c5('0x23')](handleEntityNotFound(_0x17e7a4,null))['then'](function(_0x3b06b){if(_0x3b06b){_0x55b4ac['model']=_[_0xa3c5('0x4b')](db['SmsInteraction'][_0xa3c5('0x45')]);_0x55b4ac[_0xa3c5('0x4a')]=_[_0xa3c5('0x4b')](_0x45fb51[_0xa3c5('0x4a')]);_0x55b4ac['filters']=_[_0xa3c5('0x4d')](_0x55b4ac['model'],_0x55b4ac[_0xa3c5('0x4a')]);_0x1018bf[_0xa3c5('0x4c')]=_['intersection'](_0x55b4ac[_0xa3c5('0x49')],qs[_0xa3c5('0x5e')](_0x45fb51[_0xa3c5('0x4a')]['fields']));_0x1018bf['attributes']=_0x1018bf[_0xa3c5('0x4c')][_0xa3c5('0x4e')]?_0x1018bf[_0xa3c5('0x4c')]:_0x55b4ac['model'];if(!_0x45fb51[_0xa3c5('0x4a')][_0xa3c5('0x4f')]('nolimit')){_0x1018bf[_0xa3c5('0x33')]=qs[_0xa3c5('0x33')](_0x45fb51[_0xa3c5('0x4a')][_0xa3c5('0x33')]);_0x1018bf[_0xa3c5('0x32')]=qs['offset'](_0x45fb51[_0xa3c5('0x4a')][_0xa3c5('0x32')]);}_0x1018bf[_0xa3c5('0x51')]=qs[_0xa3c5('0x52')](_0x45fb51['query']['sort']);_0x1018bf[_0xa3c5('0x53')]=qs[_0xa3c5('0x5d')](_[_0xa3c5('0x54')](_0x45fb51[_0xa3c5('0x4a')],_0x55b4ac[_0xa3c5('0x5d')]));_0x1018bf[_0xa3c5('0x53')][_0xa3c5('0x70')]=_0x3b06b['id'];if(_0x45fb51[_0xa3c5('0x4a')][_0xa3c5('0x57')]){_0x1018bf[_0xa3c5('0x53')]=_[_0xa3c5('0x58')](_0x1018bf['where'],{'$or':_[_0xa3c5('0x43')](_0x1018bf[_0xa3c5('0x4c')],function(_0x5c996a){var _0x5902fd={};_0x5902fd[_0x5c996a]={'$like':'%'+_0x45fb51['query'][_0xa3c5('0x57')]+'%'};return _0x5902fd;})});}_0x1018bf=_[_0xa3c5('0x58')]({},_0x1018bf,_0x45fb51[_0xa3c5('0x60')]);return db['SmsInteraction'][_0xa3c5('0x35')]({'where':_0x1018bf[_0xa3c5('0x53')]})[_0xa3c5('0x23')](function(_0x3b92d4){_0x28a864[_0xa3c5('0x35')]=_0x3b92d4;if(_0x45fb51[_0xa3c5('0x4a')][_0xa3c5('0x59')]){_0x1018bf['include']=[{'model':db[_0xa3c5('0x7b')],'as':_0xa3c5('0xc5'),'required':![]},{'model':db[_0xa3c5('0xc6')],'as':_0xa3c5('0xc7'),'attributes':[_0xa3c5('0x56'),_0xa3c5('0xc8'),_0xa3c5('0xc9')],'required':![]},{'model':db[_0xa3c5('0xca')],'as':_0xa3c5('0xcb'),'attributes':['id','name',_0xa3c5('0xcc')],'where':_0x45fb51['query']['tag']?{'id':_0x45fb51[_0xa3c5('0x4a')][_0xa3c5('0xcd')]}:undefined,'required':_0x45fb51[_0xa3c5('0x4a')][_0xa3c5('0xcd')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x1018bf);})[_0xa3c5('0x23')](function(_0x224eb5){_0x28a864[_0xa3c5('0x5b')]=_0x224eb5;return _0x28a864;});}})['then'](respondWithFilteredResult(_0x17e7a4,_0x1018bf))[_0xa3c5('0x2e')](handleError(_0x17e7a4,null));};exports[_0xa3c5('0x3f')]=function(_0x3266df,_0xb933f1,_0xf24248){var _0x318d7c,_0x289b4b,_0x218fc5;if(_[_0xa3c5('0x9a')](_0x3266df[_0xa3c5('0x62')][_0xa3c5('0x62')])||_0x3266df[_0xa3c5('0x62')]['body']===''){throw new db[(_0xa3c5('0x7c'))][(_0xa3c5('0x7d'))](_0xa3c5('0xce'));}if(_[_0xa3c5('0x9a')](_0x3266df['body']['to'])){throw new db[(_0xa3c5('0x7c'))][(_0xa3c5('0x7d'))](_0xa3c5('0xcf'));}_0x318d7c=_0x3266df[_0xa3c5('0x62')]['to'];return db[_0xa3c5('0x44')][_0xa3c5('0x69')]({'where':{'id':_0x3266df[_0xa3c5('0x5c')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xa3c5('0x7b')],'as':_0xa3c5('0xa2'),'where':{'mobile':_0x318d7c},'limit':0x1,'order':[[_0xa3c5('0x7f'),'DESC']]}]}]})[_0xa3c5('0x23')](handleEntityNotFound(_0xb933f1,null))['then'](function(_0x24679e){if(_0x24679e&&_0x24679e[_0xa3c5('0xd0')]){_0x289b4b=_0x24679e['get']({'plain':!![]});if(_0x289b4b[_0xa3c5('0xd0')]&&_0x289b4b[_0xa3c5('0xd0')][_0xa3c5('0xa2')][_0xa3c5('0x4e')]){return _0x289b4b['List'][_0xa3c5('0xa2')][0x0];}return db['CmContact'][_0xa3c5('0x61')](_['defaults'](_0x3266df[_0xa3c5('0x62')],{'firstName':_0x318d7c,'mobile':_0x318d7c,'phone':_0x318d7c,'ListId':_0x289b4b[_0xa3c5('0xa1')]}));}})[_0xa3c5('0x23')](handleEntityNotFound(_0xb933f1,null))[_0xa3c5('0x23')](function(_0x111cd7){if(_0x111cd7){_0x218fc5=_0x111cd7;return db[_0xa3c5('0xa6')][_0xa3c5('0x69')]({'where':{'ContactId':_0x218fc5['id'],'closed':![],'SmsAccountId':_0x289b4b['id']}})[_0xa3c5('0x23')](function(_0x2c10bb){if(_0x2c10bb){return[_0x2c10bb,![]];}return db[_0xa3c5('0xa6')]['create']({'UserId':_0x3266df[_0xa3c5('0x63')]['id'],'ContactId':_0x218fc5['id'],'SmsAccountId':_0x289b4b['id'],'phone':_0x318d7c,'firstMsgDirection':_0xa3c5('0xd1'),'Messages':[_[_0xa3c5('0x58')](_0x3266df['body'],{'read':![],'body':_0x3266df[_0xa3c5('0x62')]['body'],'phone':_0x318d7c,'SmsAccountId':_0x289b4b['id'],'UserId':_0x3266df['user']['id'],'ContactId':_0x218fc5['id']})]},{'include':[{'model':db[_0xa3c5('0xad')],'as':_0xa3c5('0xd2')}]})[_0xa3c5('0x23')](function(_0x1c1a35){return[_0x1c1a35,!![]];});});}})[_0xa3c5('0xd3')](function(_0x1abb92,_0x4fe0a4){if(_0x4fe0a4){return _0x1abb92;}return db[_0xa3c5('0xad')][_0xa3c5('0x61')](_[_0xa3c5('0x58')](_0x3266df[_0xa3c5('0x62')],{'read':![],'body':_0x3266df['body'][_0xa3c5('0x62')],'phone':_0x318d7c,'SmsAccountId':_0x289b4b['id'],'SmsInteractionId':_0x1abb92['id'],'UserId':_0x3266df[_0xa3c5('0x63')]['id'],'ContactId':_0x218fc5['id']}))[_0xa3c5('0x23')](function(_0x556638){_0x1abb92[_0xa3c5('0xd4')]['Messages']=[];_0x1abb92[_0xa3c5('0xd4')][_0xa3c5('0xd2')]['push'](_0x556638[_0xa3c5('0xd4')]);return _0x1abb92;});})['then'](respondWithResult(_0xb933f1,null))['catch'](handleError(_0xb933f1,null));};exports[_0xa3c5('0x30')]=function(_0x8b11c4,_0x2643ba,_0x2ee271){if(_0x8b11c4[_0xa3c5('0x62')]['id']){delete _0x8b11c4[_0xa3c5('0x62')]['id'];}var _0x4e36eb,_0x2d714b,_0xed1d00;return db[_0xa3c5('0x44')]['find']({'where':{'id':_0x8b11c4['params']['id']}})[_0xa3c5('0x23')](handleEntityNotFound(_0x2643ba,null))[_0xa3c5('0x23')](function(_0x1edf73){if(_0x1edf73){_0xed1d00=_0x1edf73;logger['debug'](_0xa3c5('0x28'),_0xa3c5('0x30'),_0xa3c5('0xd5'),_0x1edf73[_0xa3c5('0x47')],util[_0xa3c5('0xd6')](_0x8b11c4[_0xa3c5('0x62')],{'showHidden':![],'depth':null}));switch(_0x1edf73[_0xa3c5('0x47')]){case _0xa3c5('0x87'):if(_0x8b11c4[_0xa3c5('0x62')]['skebby_dispatch_id']&&_0x8b11c4['body'][_0xa3c5('0x30')]){_0x2d714b=_0x8b11c4['body'][_0xa3c5('0x30')];return db['SmsMessage'][_0xa3c5('0x69')]({'where':{'messageId':_0x8b11c4[_0xa3c5('0x62')][_0xa3c5('0xd7')]}});}break;case _0xa3c5('0xd8'):if(_0x8b11c4['body'][_0xa3c5('0xd9')]&&_0x8b11c4[_0xa3c5('0x62')]['statusInt']){_0x2d714b=_0x8b11c4[_0xa3c5('0x62')][_0xa3c5('0xda')];return db[_0xa3c5('0xad')][_0xa3c5('0x69')]({'where':{'messageId':_0x8b11c4[_0xa3c5('0x62')][_0xa3c5('0xd9')]}});}break;case _0xa3c5('0x8a'):if(_0x8b11c4[_0xa3c5('0x62')][_0xa3c5('0x8b')]&&_0x8b11c4['body'][_0xa3c5('0xdb')]){_0x2d714b=_0x8b11c4[_0xa3c5('0x62')][_0xa3c5('0xdb')];return db[_0xa3c5('0xad')][_0xa3c5('0x69')]({'where':{'messageId':_0x8b11c4[_0xa3c5('0x62')][_0xa3c5('0x8b')]}});}break;case _0xa3c5('0x90'):var _0x596373=_0x8b11c4[_0xa3c5('0x62')][_0xa3c5('0x91')][0x0];if(_0x596373['messageId']&&_0x596373['status']['groupName']===_0xa3c5('0xdc')){_0x2d714b=_0x596373[_0xa3c5('0x30')][_0xa3c5('0xdd')];return db[_0xa3c5('0xad')][_0xa3c5('0x69')]({'where':{'messageId':_0x596373[_0xa3c5('0x85')]}});}break;case _0xa3c5('0x94'):if(_0x8b11c4[_0xa3c5('0x62')][_0xa3c5('0x85')]&&_0x8b11c4['body'][_0xa3c5('0x30')]){_0x2d714b=_0x8b11c4[_0xa3c5('0x62')][_0xa3c5('0x30')];return db['SmsMessage'][_0xa3c5('0x69')]({'where':{'messageId':_0x8b11c4[_0xa3c5('0x62')][_0xa3c5('0x85')]}});}break;case _0xa3c5('0xde'):if(_0x8b11c4[_0xa3c5('0x62')][0x0][_0xa3c5('0x2c')]['id']){_0x2d714b=_0x8b11c4['body'][0x0][_0xa3c5('0x47')];return db[_0xa3c5('0xad')][_0xa3c5('0x69')]({'where':{'messageId':_0x8b11c4[_0xa3c5('0x62')][0x0]['message']['id']}});}break;case _0xa3c5('0x98'):if(_0x8b11c4[_0xa3c5('0x62')][_0xa3c5('0xdf')]&&_0x8b11c4[_0xa3c5('0x62')][_0xa3c5('0x30')]){_0x2d714b=_0x8b11c4[_0xa3c5('0x62')]['status'];return db[_0xa3c5('0xad')][_0xa3c5('0x69')]({'where':{'messageId':_0x8b11c4['body'][_0xa3c5('0xdf')]}});}break;}}})[_0xa3c5('0x23')](handleEntityNotFound(_0x2643ba,null))[_0xa3c5('0x23')](function(_0x56212f){if(_0x56212f){_0x4e36eb=_0x56212f;switch(_0xed1d00[_0xa3c5('0x47')]){case'skebby':if(_0x2d714b===_0xa3c5('0xdc')){return _0x4e36eb[_0xa3c5('0x3b')]({'read':!![]});}else{logger['error'](_0xa3c5('0x28'),_0xa3c5('0x30'),_0xa3c5('0x87'),util[_0xa3c5('0xd6')](_0x8b11c4[_0xa3c5('0x62')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x2d714b==='1'){return _0x4e36eb[_0xa3c5('0x3b')]({'read':!![]});}else{logger[_0xa3c5('0x2b')](_0xa3c5('0x28'),_0xa3c5('0x30'),_0xa3c5('0x87'),util[_0xa3c5('0xd6')](_0x8b11c4[_0xa3c5('0x62')],{'showHidden':![],'depth':null}));}break;case _0xa3c5('0x8a'):if(!_0x8b11c4['body'][_0xa3c5('0xe0')]&&_0x2d714b>=0xc8&&_0x2d714b<=0xce){return _0x4e36eb[_0xa3c5('0x3b')]({'read':!![]});}else{logger['error'](_0xa3c5('0x28'),'status',_0xa3c5('0x8a'),util[_0xa3c5('0xd6')](_0x8b11c4[_0xa3c5('0x62')],{'showHidden':![],'depth':null}));}break;case _0xa3c5('0x90'):var _0x14f51d=_0x8b11c4[_0xa3c5('0x62')]['results'][0x0];if(_0x14f51d[_0xa3c5('0x30')][_0xa3c5('0xdd')]===_0xa3c5('0xdc')){return _0x4e36eb[_0xa3c5('0x3b')]({'read':!![]});}else{logger['error'](_0xa3c5('0x28'),'status',_0xa3c5('0x90'),util[_0xa3c5('0xd6')](_0x8b11c4[_0xa3c5('0x62')],{'showHidden':![],'depth':null}));}break;case _0xa3c5('0x94'):if(_0x2d714b==_0xa3c5('0xe1')||_0x2d714b==_0xa3c5('0xe2')){return _0x4e36eb['update']({'read':!![]});}else{logger[_0xa3c5('0x2b')](_0xa3c5('0x28'),_0xa3c5('0x30'),_0xa3c5('0x94'),util[_0xa3c5('0xd6')](_0x8b11c4[_0xa3c5('0x62')],{'showHidden':![],'depth':null}));}break;case _0xa3c5('0xde'):if(_0x2d714b==_0xa3c5('0xe3')){return _0x4e36eb['update']({'read':!![]});}else{logger[_0xa3c5('0x2b')](_0xa3c5('0x28'),'status',_0xa3c5('0xde'),util[_0xa3c5('0xd6')](_0x8b11c4[_0xa3c5('0x62')],{'showHidden':![],'depth':null}));}break;case _0xa3c5('0x98'):if(_0x2d714b===_0xa3c5('0xe4')||_0x2d714b===_0xa3c5('0xe5')){return _0x4e36eb[_0xa3c5('0x3b')]({'read':!![]});}else{logger['error'](_0xa3c5('0x28'),_0xa3c5('0x30'),_0xa3c5('0x98'),util[_0xa3c5('0xd6')](_0x8b11c4[_0xa3c5('0x62')],{'showHidden':![],'depth':null}));}break;}return _0x4e36eb;}})['then'](respondWithResult(_0x2643ba,null))['catch'](handleError(_0x2643ba,null));};exports[_0xa3c5('0xe6')]=function(_0x1f27cb,_0x23e82c,_0x3dbadb){var _0x4f5d91,_0x115806,_0x33e43b;return db[_0xa3c5('0x44')][_0xa3c5('0x69')]({'where':{'id':_0x1f27cb[_0xa3c5('0x5c')]['id']}})['then'](handleEntityNotFound(_0x23e82c,null))[_0xa3c5('0x23')](function(_0x30dac8){if(_0x30dac8){_0x33e43b=_0x30dac8;logger[_0xa3c5('0x27')](_0xa3c5('0x28'),_0xa3c5('0x30'),'received\x20delivery\x20report\x20from',_0x30dac8[_0xa3c5('0x47')],util[_0xa3c5('0xd6')](_0x1f27cb[_0xa3c5('0x4a')],{'showHidden':![],'depth':null}));switch(_0x30dac8['type']){case _0xa3c5('0x92'):if(_0x1f27cb[_0xa3c5('0x4a')]['message-id']&&_0x1f27cb[_0xa3c5('0x4a')]['state']){_0x115806=_0x1f27cb['query']['state'];return db[_0xa3c5('0xad')][_0xa3c5('0x69')]({'where':{'messageId':_0x1f27cb['query'][_0xa3c5('0xe7')]}});}break;}}})[_0xa3c5('0x23')](handleEntityNotFound(_0x23e82c,null))[_0xa3c5('0x23')](function(_0x4989ec){if(_0x4989ec){_0x4f5d91=_0x4989ec;switch(_0x33e43b[_0xa3c5('0x47')]){case _0xa3c5('0x92'):if(_0x115806==='2'||_0x115806==='6'){return _0x4f5d91['update']({'read':!![]});}else{logger[_0xa3c5('0x2b')](_0xa3c5('0x28'),'status',_0xa3c5('0x92'),util[_0xa3c5('0xd6')](_0x1f27cb['query'],{'showHidden':![],'depth':null}));};break;}return _0x4f5d91;}})[_0xa3c5('0x23')](respondWithResult(_0x23e82c,null))['catch'](handleError(_0x23e82c,null));};exports[_0xa3c5('0xe8')]=function(_0x148595,_0x550775,_0xf43b22){return db[_0xa3c5('0x44')]['find']({'where':{'id':_0x148595[_0xa3c5('0x5c')]['id']}})['then'](handleEntityNotFound(_0x550775,null))[_0xa3c5('0x23')](function(_0x281268){if(_0x281268){return _0x281268[_0xa3c5('0xe8')](_0x148595[_0xa3c5('0x62')][_0xa3c5('0x75')],_[_0xa3c5('0xa4')](_0x148595[_0xa3c5('0x62')],['ids','id'])||{})[_0xa3c5('0xd3')](function(_0x1c888c){for(var _0x1f1122=0x0;_0x1f1122<_0x148595['body']['ids'][_0xa3c5('0x4e')];_0x1f1122+=0x1){socket['emit'](_0xa3c5('0xe9'),{'UserId':Number(_0x148595['body']['ids'][_0x1f1122]),'SmsAccountId':Number(_0x148595['params']['id'])});}return _0x1c888c;});}})[_0xa3c5('0x23')](respondWithResult(_0x550775,null))[_0xa3c5('0x2e')](handleError(_0x550775,null));};exports[_0xa3c5('0xea')]=function(_0xa65c86,_0x23a031,_0x495f20){return db[_0xa3c5('0x44')]['find']({'where':{'id':_0xa65c86[_0xa3c5('0x5c')]['id']}})[_0xa3c5('0x23')](handleEntityNotFound(_0x23a031,null))[_0xa3c5('0x23')](function(_0x373c2c){if(_0x373c2c){return _0x373c2c['removeAgents'](_0xa65c86['query'][_0xa3c5('0x75')])[_0xa3c5('0x23')](function(){if(_[_0xa3c5('0xeb')](_0xa65c86[_0xa3c5('0x4a')]['ids'])){for(var _0x54ec52=0x0;_0x54ec52<_0xa65c86[_0xa3c5('0x4a')][_0xa3c5('0x75')]['length'];_0x54ec52+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0xa65c86[_0xa3c5('0x4a')][_0xa3c5('0x75')][_0x54ec52]),'SmsAccountId':Number(_0xa65c86[_0xa3c5('0x5c')]['id'])});}}else{socket['emit'](_0xa3c5('0xec'),{'UserId':Number(_0xa65c86[_0xa3c5('0x4a')][_0xa3c5('0x75')]),'SmsAccountId':Number(_0xa65c86[_0xa3c5('0x5c')]['id'])});}});}})[_0xa3c5('0x23')](respondWithStatusCode(_0x23a031,null))[_0xa3c5('0x2e')](handleError(_0x23a031,null));};exports['getAgents']=function(_0x49e7af,_0x1202e2,_0x1b0f86){var _0x4299f1={};var _0x16a3dc={};var _0x4c165f;var _0x41c0bc;return db[_0xa3c5('0x44')][_0xa3c5('0x73')]({'where':{'id':_0x49e7af[_0xa3c5('0x5c')]['id']}})[_0xa3c5('0x23')](handleEntityNotFound(_0x1202e2,null))[_0xa3c5('0x23')](function(_0x503723){if(_0x503723){_0x4c165f=_0x503723;_0x16a3dc['model']=_[_0xa3c5('0x4b')](db['User'][_0xa3c5('0x45')]);_0x16a3dc[_0xa3c5('0x4a')]=_['keys'](_0x49e7af['query']);_0x16a3dc['filters']=_[_0xa3c5('0x4d')](_0x16a3dc[_0xa3c5('0x49')],_0x16a3dc[_0xa3c5('0x4a')]);_0x4299f1[_0xa3c5('0x4c')]=_[_0xa3c5('0x4d')](_0x16a3dc['model'],qs[_0xa3c5('0x5e')](_0x49e7af[_0xa3c5('0x4a')]['fields']));_0x4299f1[_0xa3c5('0x4c')]=_0x4299f1['attributes'][_0xa3c5('0x4e')]?_0x4299f1[_0xa3c5('0x4c')]:_0x16a3dc[_0xa3c5('0x49')];_0x4299f1[_0xa3c5('0x51')]=qs[_0xa3c5('0x52')](_0x49e7af[_0xa3c5('0x4a')]['sort']);_0x4299f1[_0xa3c5('0x53')]=qs[_0xa3c5('0x5d')](_['pick'](_0x49e7af[_0xa3c5('0x4a')],_0x16a3dc[_0xa3c5('0x5d')]));if(_0x49e7af[_0xa3c5('0x4a')]['filter']){_0x4299f1[_0xa3c5('0x53')]=_[_0xa3c5('0x58')](_0x4299f1[_0xa3c5('0x53')],{'$or':_[_0xa3c5('0x43')](_0x4299f1[_0xa3c5('0x4c')],function(_0x3ce436){var _0x19476f={};_0x19476f[_0x3ce436]={'$like':'%'+_0x49e7af['query'][_0xa3c5('0x57')]+'%'};return _0x19476f;})});}_0x4299f1=_['merge']({},_0x4299f1,_0x49e7af['options']);return _0x4c165f[_0xa3c5('0xed')](_0x4299f1);}})['then'](function(_0x2948d5){if(_0x2948d5){_0x41c0bc=_0x2948d5[_0xa3c5('0x4e')];if(!_0x49e7af[_0xa3c5('0x4a')]['hasOwnProperty'](_0xa3c5('0x50'))){_0x4299f1[_0xa3c5('0x33')]=qs[_0xa3c5('0x33')](_0x49e7af[_0xa3c5('0x4a')][_0xa3c5('0x33')]);_0x4299f1['offset']=qs[_0xa3c5('0x32')](_0x49e7af[_0xa3c5('0x4a')]['offset']);}return _0x4c165f[_0xa3c5('0xed')](_0x4299f1);}})[_0xa3c5('0x23')](function(_0x56f498){if(_0x56f498){return _0x56f498?{'count':_0x41c0bc,'rows':_0x56f498}:null;}})[_0xa3c5('0x23')](respondWithResult(_0x1202e2,null))['catch'](handleError(_0x1202e2,null));}; \ No newline at end of file +var _0xcff8=['CannedAnswer','findAll','removeAnswers','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','CompanyId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','text','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','updatedAt','DESC','list','omit','defaults','contact','SmsInteraction','spread','interaction','autoclose','push','unmanaged','created','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','receiveMessage','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','set','Content-Type','text/xml','send','addApplications','sequelize','transaction','ISOLATION_LEVELS','finally','getApplications','pick','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','get','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','clicksend','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','SmsAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','SmsAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','includeAll','rows','show','params','Pause','include','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','hasOwnProperty','order','SmsAccountId','removeDispositions','ids','addAnswer'];(function(_0x274a03,_0xa661ae){var _0x53b6dc=function(_0x29a5df){while(--_0x29a5df){_0x274a03['push'](_0x274a03['shift']());}};_0x53b6dc(++_0xa661ae);}(_0xcff8,0x164));var _0x8cff=function(_0x2c78cb,_0xbdb37e){_0x2c78cb=_0x2c78cb-0x0;var _0x3a8d56=_0xcff8[_0x2c78cb];return _0x3a8d56;};'use strict';var emlformat=require(_0x8cff('0x0'));var rimraf=require(_0x8cff('0x1'));var zipdir=require(_0x8cff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8cff('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8cff('0x4'));var util=require(_0x8cff('0x5'));var path=require(_0x8cff('0x6'));var sox=require(_0x8cff('0x7'));var csv=require(_0x8cff('0x8'));var ejs=require(_0x8cff('0x9'));var fs=require('fs');var fs_extra=require(_0x8cff('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8cff('0xb'));var jsforce=require(_0x8cff('0xc'));var deskjs=require(_0x8cff('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8cff('0xe'));var Papa=require(_0x8cff('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8cff('0x10'));var as=require(_0x8cff('0x11'));var hardwareService=require(_0x8cff('0x12'));var logger=require(_0x8cff('0x13'))(_0x8cff('0x14'));var utils=require(_0x8cff('0x15'));var config=require(_0x8cff('0x16'));var licenseUtil=require(_0x8cff('0x17'));var db=require(_0x8cff('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x8cff('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8cff('0x1a'))[_0x8cff('0x1b')](socket);var jayson=require(_0x8cff('0x1c'));var client=jayson[_0x8cff('0x1d')][_0x8cff('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x24f63b,_0x86c84a,_0x15b557,_0x49046f){return new BPromise(function(_0x4c1363,_0x1a7a91){var _0x462c27=_0x49046f||client;return _0x462c27[_0x8cff('0x1f')](_0x24f63b,_0x15b557)[_0x8cff('0x20')](function(_0x4fc688){logger[_0x8cff('0x21')](_0x8cff('0x22'),_0x86c84a,'request\x20sent');logger['debug'](_0x8cff('0x23'),_0x86c84a,_0x8cff('0x24'),JSON[_0x8cff('0x25')](_0x4fc688));if(_0x4fc688[_0x8cff('0x26')]){if(_0x4fc688[_0x8cff('0x26')]['code']===0x1f4){logger['error'](_0x8cff('0x22'),_0x86c84a,_0x4fc688['error']['message']);return _0x1a7a91(_0x4fc688[_0x8cff('0x26')][_0x8cff('0x27')]);}logger['error'](_0x8cff('0x22'),_0x86c84a,_0x4fc688[_0x8cff('0x26')][_0x8cff('0x27')]);return _0x4c1363(_0x4fc688[_0x8cff('0x26')][_0x8cff('0x27')]);}else{logger['info'](_0x8cff('0x22'),_0x86c84a,_0x8cff('0x24'));_0x4c1363(_0x4fc688[_0x8cff('0x28')][_0x8cff('0x27')]);}})['catch'](function(_0x5d8f8d){logger[_0x8cff('0x26')]('SmsAccount,\x20%s,\x20%s',_0x86c84a,_0x5d8f8d);_0x1a7a91(_0x5d8f8d);});});}function respondWithStatusCode(_0x591408,_0x1604f6){_0x1604f6=_0x1604f6||0xcc;return function(_0x469008){if(_0x469008){return _0x591408[_0x8cff('0x29')](_0x1604f6);}return _0x591408[_0x8cff('0x2a')](_0x1604f6)['end']();};}function respondWithResult(_0x1ed889,_0x3091aa){_0x3091aa=_0x3091aa||0xc8;return function(_0x26598c){if(_0x26598c){return _0x1ed889[_0x8cff('0x2a')](_0x3091aa)[_0x8cff('0x2b')](_0x26598c);}};}function respondWithFilteredResult(_0x3ebe61,_0x488eb8){return function(_0x3a155c){if(_0x3a155c){var _0x11c97f=typeof _0x488eb8[_0x8cff('0x2c')]===_0x8cff('0x2d')&&typeof _0x488eb8[_0x8cff('0x2e')]===_0x8cff('0x2d');var _0x1ca2a4=_0x3a155c[_0x8cff('0x2f')];var _0x33e6c=_0x11c97f?0x0:_0x488eb8[_0x8cff('0x2c')];var _0x5f164c=_0x11c97f?_0x3a155c[_0x8cff('0x2f')]:_0x488eb8[_0x8cff('0x2c')]+_0x488eb8[_0x8cff('0x2e')];var _0x8c2cc2;if(_0x5f164c>=_0x1ca2a4){_0x5f164c=_0x1ca2a4;_0x8c2cc2=0xc8;}else{_0x8c2cc2=0xce;}_0x3ebe61['status'](_0x8c2cc2);return _0x3ebe61['set'](_0x8cff('0x30'),_0x33e6c+'-'+_0x5f164c+'/'+_0x1ca2a4)[_0x8cff('0x2b')](_0x3a155c);}return null;};}function patchUpdates(_0x41d46f){return function(_0x405432){try{jsonpatch[_0x8cff('0x31')](_0x405432,_0x41d46f,!![]);}catch(_0x2a0386){return BPromise['reject'](_0x2a0386);}return _0x405432[_0x8cff('0x32')]();};}function saveUpdates(_0x3aa8ca,_0x1c0f43){return function(_0x2e2739){if(_0x2e2739){return _0x2e2739[_0x8cff('0x33')](_0x3aa8ca)[_0x8cff('0x20')](function(_0x42d26a){return _0x42d26a;});}return null;};}function removeEntity(_0x973360,_0x39a2f0){return function(_0x5d4f10){if(_0x5d4f10){return _0x5d4f10[_0x8cff('0x34')]()[_0x8cff('0x20')](function(){var _0x5de90f=_0x5d4f10['get']({'plain':!![]});var _0xef18c5=_0x8cff('0x35');return db[_0x8cff('0x36')][_0x8cff('0x34')]({'where':{'type':_0xef18c5,'resourceId':_0x5de90f['id']}})[_0x8cff('0x20')](function(){return _0x5d4f10;});})[_0x8cff('0x20')](function(){_0x973360[_0x8cff('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ad64f,_0x59f6a5){return function(_0xc57e49){if(!_0xc57e49){_0x4ad64f[_0x8cff('0x29')](0x194);}return _0xc57e49;};}function handleError(_0x9e0a20,_0x3285fd){_0x3285fd=_0x3285fd||0x1f4;return function(_0x3f2a27){logger[_0x8cff('0x26')](_0x3f2a27[_0x8cff('0x37')]);if(_0x3f2a27['name']){delete _0x3f2a27[_0x8cff('0x38')];}_0x9e0a20[_0x8cff('0x2a')](_0x3285fd)['send'](_0x3f2a27);};}exports[_0x8cff('0x39')]=function(_0x43efec,_0x45c134){var _0x22c82f={'include':[{'model':db['Pause'],'as':_0x8cff('0x3a')}]},_0x5aba14={},_0xdc7748={'count':0x0,'rows':[]};var _0x3a8f0d=_['map'](db[_0x8cff('0x3b')][_0x8cff('0x3c')],function(_0x5e4eff){return{'name':_0x5e4eff[_0x8cff('0x3d')],'type':_0x5e4eff[_0x8cff('0x3e')][_0x8cff('0x3f')]};});_0x5aba14[_0x8cff('0x40')]=_[_0x8cff('0x41')](_0x3a8f0d,'name');_0x5aba14[_0x8cff('0x42')]=_[_0x8cff('0x43')](_0x43efec[_0x8cff('0x42')]);_0x5aba14[_0x8cff('0x44')]=_[_0x8cff('0x45')](_0x5aba14[_0x8cff('0x40')],_0x5aba14['query']);_0x22c82f['attributes']=_[_0x8cff('0x45')](_0x5aba14[_0x8cff('0x40')],qs[_0x8cff('0x46')](_0x43efec['query'][_0x8cff('0x46')]));_0x22c82f[_0x8cff('0x47')]=_0x22c82f[_0x8cff('0x47')][_0x8cff('0x48')]?_0x22c82f['attributes']:_0x5aba14[_0x8cff('0x40')];if(!_0x43efec[_0x8cff('0x42')]['hasOwnProperty'](_0x8cff('0x49'))){_0x22c82f[_0x8cff('0x2e')]=qs[_0x8cff('0x2e')](_0x43efec[_0x8cff('0x42')][_0x8cff('0x2e')]);_0x22c82f[_0x8cff('0x2c')]=qs[_0x8cff('0x2c')](_0x43efec[_0x8cff('0x42')][_0x8cff('0x2c')]);}_0x22c82f['order']=qs['sort'](_0x43efec['query'][_0x8cff('0x4a')]);_0x22c82f[_0x8cff('0x4b')]=qs[_0x8cff('0x44')](_['pick'](_0x43efec[_0x8cff('0x42')],_0x5aba14[_0x8cff('0x44')]),_0x3a8f0d);if(_0x43efec[_0x8cff('0x42')][_0x8cff('0x4c')]){_0x22c82f[_0x8cff('0x4b')]=_[_0x8cff('0x4d')](_0x22c82f[_0x8cff('0x4b')],{'$or':_['map'](_0x3a8f0d,function(_0x2da1ad){if(_0x2da1ad[_0x8cff('0x3e')]!=='VIRTUAL'){var _0x811ff1={};_0x811ff1[_0x2da1ad[_0x8cff('0x38')]]={'$like':'%'+_0x43efec[_0x8cff('0x42')][_0x8cff('0x4c')]+'%'};return _0x811ff1;}})});}_0x22c82f=_[_0x8cff('0x4d')]({},_0x22c82f,_0x43efec['options']);var _0x54c729={'where':_0x22c82f[_0x8cff('0x4b')]};return db[_0x8cff('0x3b')][_0x8cff('0x2f')](_0x54c729)[_0x8cff('0x20')](function(_0x4d3f4f){_0xdc7748[_0x8cff('0x2f')]=_0x4d3f4f;if(_0x43efec[_0x8cff('0x42')][_0x8cff('0x4e')]){_0x22c82f['include']=[{'all':!![]}];}return db[_0x8cff('0x3b')]['findAll'](_0x22c82f);})[_0x8cff('0x20')](function(_0x51c521){_0xdc7748[_0x8cff('0x4f')]=_0x51c521;return _0xdc7748;})['then'](respondWithFilteredResult(_0x45c134,_0x22c82f))['catch'](handleError(_0x45c134,null));};exports[_0x8cff('0x50')]=function(_0x4f1ede,_0x95de77){var _0x27e4a5={'raw':![],'where':{'id':_0x4f1ede[_0x8cff('0x51')]['id']},'include':[{'model':db[_0x8cff('0x52')],'as':_0x8cff('0x3a')}]},_0x4c3790={};_0x4c3790[_0x8cff('0x40')]=_[_0x8cff('0x43')](db[_0x8cff('0x3b')][_0x8cff('0x3c')]);_0x4c3790[_0x8cff('0x42')]=_['keys'](_0x4f1ede[_0x8cff('0x42')]);_0x4c3790[_0x8cff('0x44')]=_[_0x8cff('0x45')](_0x4c3790[_0x8cff('0x40')],_0x4c3790['query']);_0x27e4a5[_0x8cff('0x47')]=_['intersection'](_0x4c3790[_0x8cff('0x40')],qs[_0x8cff('0x46')](_0x4f1ede['query']['fields']));_0x27e4a5['attributes']=_0x27e4a5[_0x8cff('0x47')]['length']?_0x27e4a5['attributes']:_0x4c3790[_0x8cff('0x40')];if(_0x4f1ede[_0x8cff('0x42')][_0x8cff('0x4e')]){_0x27e4a5[_0x8cff('0x53')]=[{'all':!![]}];}_0x27e4a5=_[_0x8cff('0x4d')]({},_0x27e4a5,_0x4f1ede[_0x8cff('0x54')]);return db[_0x8cff('0x3b')][_0x8cff('0x55')](_0x27e4a5)[_0x8cff('0x20')](handleEntityNotFound(_0x95de77,null))[_0x8cff('0x20')](respondWithResult(_0x95de77,null))[_0x8cff('0x56')](handleError(_0x95de77,null));};exports[_0x8cff('0x57')]=function(_0x3ea25c,_0x41c381){return db['SmsAccount'][_0x8cff('0x57')](_0x3ea25c[_0x8cff('0x58')],{})[_0x8cff('0x20')](function(_0x2c8bd6){var _0x185d7f=_0x3ea25c[_0x8cff('0x59')]['get']({'plain':!![]});if(!_0x185d7f)throw new Error(_0x8cff('0x5a'));if(_0x185d7f[_0x8cff('0x5b')]===_0x8cff('0x59')){var _0x3acc76=_0x2c8bd6['get']({'plain':!![]});var _0x4d32da=_0x8cff('0x35');return db[_0x8cff('0x5c')]['find']({'where':{'name':_0x4d32da,'userProfileId':_0x185d7f[_0x8cff('0x5d')]},'raw':!![]})[_0x8cff('0x20')](function(_0x233aaa){if(_0x233aaa&&_0x233aaa[_0x8cff('0x5e')]===0x0){return db['UserProfileResource'][_0x8cff('0x57')]({'name':_0x3acc76[_0x8cff('0x38')],'resourceId':_0x3acc76['id'],'type':_0x233aaa['name'],'sectionId':_0x233aaa['id']},{})[_0x8cff('0x20')](function(){return _0x2c8bd6;});}else{return _0x2c8bd6;}})[_0x8cff('0x56')](function(_0x4e606e){logger[_0x8cff('0x26')](_0x8cff('0x5f'),_0x4e606e);throw _0x4e606e;});}return _0x2c8bd6;})[_0x8cff('0x20')](respondWithResult(_0x41c381,0xc9))[_0x8cff('0x56')](handleError(_0x41c381,null));};exports[_0x8cff('0x33')]=function(_0x2ffaf5,_0x2b2712){if(_0x2ffaf5[_0x8cff('0x58')]['id']){delete _0x2ffaf5[_0x8cff('0x58')]['id'];}return db['SmsAccount'][_0x8cff('0x55')]({'where':{'id':_0x2ffaf5[_0x8cff('0x51')]['id']},'include':[{'model':db[_0x8cff('0x52')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2b2712,null))[_0x8cff('0x20')](saveUpdates(_0x2ffaf5[_0x8cff('0x58')],null))[_0x8cff('0x20')](respondWithResult(_0x2b2712,null))[_0x8cff('0x56')](handleError(_0x2b2712,null));};exports[_0x8cff('0x34')]=function(_0x265fe6,_0x143e14){return db[_0x8cff('0x3b')][_0x8cff('0x55')]({'where':{'id':_0x265fe6[_0x8cff('0x51')]['id']}})[_0x8cff('0x20')](handleEntityNotFound(_0x143e14,null))[_0x8cff('0x20')](removeEntity(_0x143e14,null))['catch'](handleError(_0x143e14,null));};exports['describe']=function(_0x5cef14,_0x9d5594){return db[_0x8cff('0x3b')][_0x8cff('0x60')]()[_0x8cff('0x20')](respondWithResult(_0x9d5594,null))['catch'](handleError(_0x9d5594,null));};exports['addDisposition']=function(_0x5cffb5,_0x3ae7b1,_0x37b752){if(_0x5cffb5[_0x8cff('0x58')]['id']){delete _0x5cffb5[_0x8cff('0x58')]['id'];}return db['SmsAccount'][_0x8cff('0x55')]({'where':{'id':_0x5cffb5[_0x8cff('0x51')]['id']}})[_0x8cff('0x20')](handleEntityNotFound(_0x3ae7b1,null))[_0x8cff('0x20')](function(_0x55e630){if(_0x55e630){_0x5cffb5['body']['SmsAccountId']=_0x55e630['id'];return db[_0x8cff('0x61')][_0x8cff('0x57')](_0x5cffb5[_0x8cff('0x58')]);}})[_0x8cff('0x20')](respondWithResult(_0x3ae7b1,null))['catch'](handleError(_0x3ae7b1,null));};exports[_0x8cff('0x62')]=function(_0x5bc676,_0x53eace,_0xc05705){var _0x2d1899={'raw':![],'where':{}};var _0x87bf94={};var _0x114de6={'count':0x0,'rows':[]};return db[_0x8cff('0x3b')][_0x8cff('0x63')]({'where':{'id':_0x5bc676[_0x8cff('0x51')]['id']}})[_0x8cff('0x20')](handleEntityNotFound(_0x53eace,null))[_0x8cff('0x20')](function(_0x5b8863){if(_0x5b8863){_0x87bf94['model']=_[_0x8cff('0x43')](db[_0x8cff('0x61')][_0x8cff('0x3c')]);_0x87bf94['query']=_[_0x8cff('0x43')](_0x5bc676[_0x8cff('0x42')]);_0x87bf94[_0x8cff('0x44')]=_[_0x8cff('0x45')](_0x87bf94['model'],_0x87bf94[_0x8cff('0x42')]);_0x2d1899['attributes']=_[_0x8cff('0x45')](_0x87bf94[_0x8cff('0x40')],qs[_0x8cff('0x46')](_0x5bc676[_0x8cff('0x42')][_0x8cff('0x46')]));_0x2d1899[_0x8cff('0x47')]=_0x2d1899[_0x8cff('0x47')][_0x8cff('0x48')]?_0x2d1899[_0x8cff('0x47')]:_0x87bf94[_0x8cff('0x40')];if(!_0x5bc676[_0x8cff('0x42')][_0x8cff('0x64')](_0x8cff('0x49'))){_0x2d1899[_0x8cff('0x2e')]=qs['limit'](_0x5bc676[_0x8cff('0x42')][_0x8cff('0x2e')]);_0x2d1899[_0x8cff('0x2c')]=qs[_0x8cff('0x2c')](_0x5bc676['query'][_0x8cff('0x2c')]);}_0x2d1899[_0x8cff('0x65')]=qs['sort'](_0x5bc676[_0x8cff('0x42')][_0x8cff('0x4a')]);_0x2d1899['where']=qs[_0x8cff('0x44')](_['pick'](_0x5bc676[_0x8cff('0x42')],_0x87bf94[_0x8cff('0x44')]));_0x2d1899[_0x8cff('0x4b')][_0x8cff('0x66')]=_0x5b8863['id'];if(_0x5bc676[_0x8cff('0x42')][_0x8cff('0x4c')]){_0x2d1899['where']=_['merge'](_0x2d1899[_0x8cff('0x4b')],{'$or':_[_0x8cff('0x41')](_0x2d1899['attributes'],function(_0x7479b0){var _0x2fa249={};_0x2fa249[_0x7479b0]={'$like':'%'+_0x5bc676['query']['filter']+'%'};return _0x2fa249;})});}_0x2d1899=_['merge']({},_0x2d1899,_0x5bc676['options']);return db['Disposition'][_0x8cff('0x2f')]({'where':_0x2d1899[_0x8cff('0x4b')]})['then'](function(_0x69834){_0x114de6[_0x8cff('0x2f')]=_0x69834;if(_0x5bc676[_0x8cff('0x42')][_0x8cff('0x4e')]){_0x2d1899[_0x8cff('0x53')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2d1899);})[_0x8cff('0x20')](function(_0x5b040b){_0x114de6[_0x8cff('0x4f')]=_0x5b040b;return _0x114de6;});}})[_0x8cff('0x20')](respondWithFilteredResult(_0x53eace,_0x2d1899))[_0x8cff('0x56')](handleError(_0x53eace,null));};exports[_0x8cff('0x67')]=function(_0x1a6d6a,_0x285b30,_0x19f262){return db['SmsAccount'][_0x8cff('0x55')]({'where':{'id':_0x1a6d6a['params']['id']}})[_0x8cff('0x20')](handleEntityNotFound(_0x285b30,null))[_0x8cff('0x20')](function(_0x53fee5){if(_0x53fee5){return _0x53fee5[_0x8cff('0x67')](_0x1a6d6a['query'][_0x8cff('0x68')]);}})['then'](respondWithStatusCode(_0x285b30,null))['catch'](handleError(_0x285b30,null));};exports[_0x8cff('0x69')]=function(_0x2fe977,_0xbc4378,_0xe4f74b){if(_0x2fe977['body']['id']){delete _0x2fe977[_0x8cff('0x58')]['id'];}return db[_0x8cff('0x3b')][_0x8cff('0x55')]({'where':{'id':_0x2fe977[_0x8cff('0x51')]['id']}})[_0x8cff('0x20')](handleEntityNotFound(_0xbc4378,null))[_0x8cff('0x20')](function(_0x257510){if(_0x257510){_0x2fe977['body'][_0x8cff('0x66')]=_0x257510['id'];return db[_0x8cff('0x6a')][_0x8cff('0x57')](_0x2fe977[_0x8cff('0x58')]);}})[_0x8cff('0x20')](respondWithResult(_0xbc4378,null))[_0x8cff('0x56')](handleError(_0xbc4378,null));};exports['getAnswers']=function(_0x47402d,_0x173933,_0x23f8d3){var _0x3e1534={'raw':![],'where':{}};var _0x27c94a={};var _0x2a23ab={'count':0x0,'rows':[]};return db[_0x8cff('0x3b')][_0x8cff('0x63')]({'where':{'id':_0x47402d['params']['id']}})[_0x8cff('0x20')](handleEntityNotFound(_0x173933,null))[_0x8cff('0x20')](function(_0x461a2c){if(_0x461a2c){_0x27c94a[_0x8cff('0x40')]=_[_0x8cff('0x43')](db[_0x8cff('0x6a')][_0x8cff('0x3c')]);_0x27c94a[_0x8cff('0x42')]=_[_0x8cff('0x43')](_0x47402d[_0x8cff('0x42')]);_0x27c94a[_0x8cff('0x44')]=_['intersection'](_0x27c94a['model'],_0x27c94a[_0x8cff('0x42')]);_0x3e1534['attributes']=_[_0x8cff('0x45')](_0x27c94a[_0x8cff('0x40')],qs[_0x8cff('0x46')](_0x47402d[_0x8cff('0x42')][_0x8cff('0x46')]));_0x3e1534['attributes']=_0x3e1534[_0x8cff('0x47')][_0x8cff('0x48')]?_0x3e1534['attributes']:_0x27c94a[_0x8cff('0x40')];if(!_0x47402d[_0x8cff('0x42')]['hasOwnProperty'](_0x8cff('0x49'))){_0x3e1534[_0x8cff('0x2e')]=qs[_0x8cff('0x2e')](_0x47402d[_0x8cff('0x42')][_0x8cff('0x2e')]);_0x3e1534[_0x8cff('0x2c')]=qs[_0x8cff('0x2c')](_0x47402d[_0x8cff('0x42')]['offset']);}_0x3e1534[_0x8cff('0x65')]=qs[_0x8cff('0x4a')](_0x47402d['query'][_0x8cff('0x4a')]);_0x3e1534[_0x8cff('0x4b')]=qs['filters'](_['pick'](_0x47402d[_0x8cff('0x42')],_0x27c94a[_0x8cff('0x44')]));_0x3e1534['where'][_0x8cff('0x66')]=_0x461a2c['id'];if(_0x47402d[_0x8cff('0x42')][_0x8cff('0x4c')]){_0x3e1534[_0x8cff('0x4b')]=_['merge'](_0x3e1534['where'],{'$or':_[_0x8cff('0x41')](_0x3e1534[_0x8cff('0x47')],function(_0x1dcb95){var _0x1fce37={};_0x1fce37[_0x1dcb95]={'$like':'%'+_0x47402d[_0x8cff('0x42')][_0x8cff('0x4c')]+'%'};return _0x1fce37;})});}_0x3e1534=_[_0x8cff('0x4d')]({},_0x3e1534,_0x47402d[_0x8cff('0x54')]);return db['CannedAnswer']['count']({'where':_0x3e1534['where']})[_0x8cff('0x20')](function(_0x4ca64f){_0x2a23ab[_0x8cff('0x2f')]=_0x4ca64f;if(_0x47402d[_0x8cff('0x42')]['includeAll']){_0x3e1534['include']=[{'all':!![]}];}return db[_0x8cff('0x6a')][_0x8cff('0x6b')](_0x3e1534);})[_0x8cff('0x20')](function(_0x42c433){_0x2a23ab['rows']=_0x42c433;return _0x2a23ab;});}})[_0x8cff('0x20')](respondWithFilteredResult(_0x173933,_0x3e1534))[_0x8cff('0x56')](handleError(_0x173933,null));};exports[_0x8cff('0x6c')]=function(_0x2b740d,_0x585403,_0x34cf7f){return db[_0x8cff('0x3b')]['find']({'where':{'id':_0x2b740d[_0x8cff('0x51')]['id']}})[_0x8cff('0x20')](handleEntityNotFound(_0x585403,null))['then'](function(_0x20a7e5){if(_0x20a7e5){return _0x20a7e5[_0x8cff('0x6c')](_0x2b740d['query'][_0x8cff('0x68')]);}})['then'](respondWithStatusCode(_0x585403,null))['catch'](handleError(_0x585403,null));};exports['notify']=function(_0x235da0,_0x5dd22d,_0x50ddb6){var _0x50d495={'channel':'sms'};var _0x3a77aa=[];var _0x4f6a41=[];var _0x4c3197={};return db['SmsAccount'][_0x8cff('0x55')]({'where':{'id':_0x235da0['params']['id']},'include':[{'model':db[_0x8cff('0x6d')],'as':_0x8cff('0x6e')}]})[_0x8cff('0x20')](handleEntityNotFound(_0x5dd22d,null))[_0x8cff('0x20')](function(_0x3fda02){_0x50d495[_0x8cff('0x6f')]=_0x3fda02;_0x50d495[_0x8cff('0x70')]=_[_0x8cff('0x71')](_0x3fda02['Applications'],[_0x8cff('0x72')],[_0x8cff('0x73')]);if(_0x50d495[_0x8cff('0x6f')]['Applications']){delete _0x50d495[_0x8cff('0x6f')][_0x8cff('0x6e')];}return db[_0x8cff('0x74')][_0x8cff('0x60')]();})[_0x8cff('0x20')](function(_0x346713){if(!_0x346713){throw new db[(_0x8cff('0x75'))][(_0x8cff('0x76'))](_0x8cff('0x77'));}_0x3a77aa=_[_0x8cff('0x78')](_[_0x8cff('0x43')](_0x346713),['createdAt','updatedAt']);_0x4f6a41=_[_0x8cff('0x78')](_[_0x8cff('0x43')](_0x346713),['createdAt','updatedAt',_0x8cff('0x79'),'ListId']);_0x50d495[_0x8cff('0x58')]={'mapKey':_0x8cff('0x7a')};if(_0x50d495[_0x8cff('0x6f')][_0x8cff('0x3e')]){switch(_0x50d495['account']['type']){case _0x8cff('0x7b'):_0x50d495[_0x8cff('0x58')][_0x8cff('0x7c')]=_0x235da0[_0x8cff('0x58')][_0x8cff('0x7d')];_0x50d495[_0x8cff('0x58')][_0x8cff('0x58')]=_0x235da0[_0x8cff('0x58')][_0x8cff('0x7e')];_0x50d495[_0x8cff('0x58')][_0x8cff('0x7f')]=_0x235da0[_0x8cff('0x58')][_0x8cff('0x80')];break;case _0x8cff('0x81'):_0x50d495[_0x8cff('0x58')][_0x8cff('0x7c')]='+'+_0x235da0['body']['sender'];_0x50d495[_0x8cff('0x58')][_0x8cff('0x58')]=_0x235da0[_0x8cff('0x58')][_0x8cff('0x82')];break;case _0x8cff('0x83'):_0x50d495[_0x8cff('0x58')]['from']=_0x235da0[_0x8cff('0x58')][_0x8cff('0x7c')];_0x50d495[_0x8cff('0x58')][_0x8cff('0x58')]=_0x235da0[_0x8cff('0x58')][_0x8cff('0x27')];break;case'clicksend':_0x50d495[_0x8cff('0x58')][_0x8cff('0x7c')]=_0x235da0[_0x8cff('0x58')][_0x8cff('0x7c')];_0x50d495['body']['body']=_0x235da0[_0x8cff('0x58')]['body'];_0x50d495[_0x8cff('0x58')][_0x8cff('0x7f')]=_0x235da0[_0x8cff('0x58')][_0x8cff('0x84')];break;case _0x8cff('0x85'):_0x50d495['body'][_0x8cff('0x7c')]=_0x235da0['body']['From'];_0x50d495[_0x8cff('0x58')]['body']=_0x235da0[_0x8cff('0x58')][_0x8cff('0x86')];_0x50d495[_0x8cff('0x58')][_0x8cff('0x7f')]=_0x235da0['body'][_0x8cff('0x87')];break;case _0x8cff('0x88'):_0x50d495[_0x8cff('0x58')]['from']='+'+_0x235da0[_0x8cff('0x58')][_0x8cff('0x89')][0x0]['from'];_0x50d495[_0x8cff('0x58')]['body']=_0x235da0[_0x8cff('0x58')]['results'][0x0][_0x8cff('0x82')];_0x50d495[_0x8cff('0x58')][_0x8cff('0x7f')]=_0x235da0['body']['results'][0x0]['messageId'];break;case _0x8cff('0x8a'):_0x50d495[_0x8cff('0x58')][_0x8cff('0x7c')]=_0x235da0[_0x8cff('0x58')][_0x8cff('0x8b')];_0x50d495[_0x8cff('0x58')][_0x8cff('0x58')]=_0x235da0[_0x8cff('0x58')][_0x8cff('0x8c')][_0x8cff('0x27')];break;case _0x8cff('0x8d'):_0x50d495['body'][_0x8cff('0x7c')]=_0x235da0['body'][_0x8cff('0x8e')];_0x50d495[_0x8cff('0x58')]['body']=_0x235da0['body']['text'];_0x50d495[_0x8cff('0x58')][_0x8cff('0x7f')]=_0x235da0[_0x8cff('0x58')][_0x8cff('0x8f')];break;case _0x8cff('0x90'):_0x50d495[_0x8cff('0x58')][_0x8cff('0x7f')]=_0x235da0[_0x8cff('0x58')][0x0][_0x8cff('0x27')]['id'];_0x50d495[_0x8cff('0x58')]['from']=_0x235da0[_0x8cff('0x58')][0x0][_0x8cff('0x27')][_0x8cff('0x7c')];_0x50d495[_0x8cff('0x58')][_0x8cff('0x58')]=_0x235da0['body'][0x0][_0x8cff('0x27')][_0x8cff('0x82')];break;case _0x8cff('0x91'):_0x50d495[_0x8cff('0x58')][_0x8cff('0x7c')]=_0x235da0[_0x8cff('0x58')][_0x8cff('0x7c')];_0x50d495[_0x8cff('0x58')][_0x8cff('0x58')]=_0x235da0[_0x8cff('0x58')][_0x8cff('0x27')];_0x50d495[_0x8cff('0x58')][_0x8cff('0x7f')]=_0x235da0[_0x8cff('0x58')][_0x8cff('0x92')];break;}}if(_0x50d495['body']['id']){delete _0x50d495[_0x8cff('0x58')]['id'];}if(_[_0x8cff('0x93')](_0x50d495['body'][_0x8cff('0x7c')])){throw new db['Sequelize'][(_0x8cff('0x76'))](_0x8cff('0x94'));}if(_[_0x8cff('0x93')](_0x50d495[_0x8cff('0x58')][_0x8cff('0x58')])||_0x50d495[_0x8cff('0x58')]['body']===''){throw new db[(_0x8cff('0x75'))]['ValidationError'](_0x8cff('0x95'));}if(_[_0x8cff('0x93')](_0x50d495[_0x8cff('0x58')][_0x8cff('0x96')])){throw new db[(_0x8cff('0x75'))][(_0x8cff('0x76'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4f6a41);}if(!_[_0x8cff('0x97')](_0x4f6a41,_0x50d495['body'][_0x8cff('0x96')])){throw new db[(_0x8cff('0x75'))]['ValidationError'](_0x8cff('0x98')+_0x4f6a41);}_0x4c3197[_0x50d495['body']['mapKey']]=_0x50d495['body'][_0x8cff('0x7c')];return db[_0x8cff('0x99')][_0x8cff('0x55')]({'where':{'id':_0x50d495[_0x8cff('0x6f')][_0x8cff('0x9a')]},'include':[{'model':db[_0x8cff('0x74')],'as':_0x8cff('0x9b'),'where':_0x4c3197,'limit':0x1,'order':[[_0x8cff('0x9c'),_0x8cff('0x9d')]]}]});})[_0x8cff('0x20')](handleEntityNotFound(_0x5dd22d,null))['then'](function(_0x3f47f2){if(_0x3f47f2){_0x50d495[_0x8cff('0x9e')]=_[_0x8cff('0x9f')](_0x3f47f2,[_0x8cff('0x9b')]);if(_0x3f47f2[_0x8cff('0x9b')][_0x8cff('0x48')]){return _0x3f47f2[_0x8cff('0x9b')][0x0];}var _0x3c9899=_[_0x8cff('0xa0')](_0x50d495[_0x8cff('0x58')],{'firstName':_0x50d495[_0x8cff('0x58')][_0x8cff('0x7c')],'ListId':_0x3f47f2['id']});_0x3c9899[_0x50d495[_0x8cff('0x58')][_0x8cff('0x96')]]=_0x50d495[_0x8cff('0x58')][_0x8cff('0x7c')];return db[_0x8cff('0x74')]['create'](_0x3c9899,{'fields':_0x3a77aa,'raw':!![]});}})['then'](handleEntityNotFound(_0x5dd22d,null))['then'](function(_0x4a7453){if(_0x4a7453){_0x50d495[_0x8cff('0xa1')]=_0x4a7453;var _0x1b00b3={'ContactId':_0x4a7453['id'],'phone':_0x50d495[_0x8cff('0x58')][_0x8cff('0x7c')],'SmsAccountId':_0x235da0[_0x8cff('0x51')]['id']};var _0x4c52c0={'ContactId':_0x4a7453['id'],'SmsAccountId':_0x235da0[_0x8cff('0x51')]['id'],'closed':![]};return db[_0x8cff('0xa2')][_0x8cff('0x55')]({'where':_0x4c52c0})[_0x8cff('0x20')](function(_0x1054e3){if(_0x1054e3){return[_0x1054e3,![]];}return db['SmsInteraction'][_0x8cff('0x57')](_0x1b00b3)[_0x8cff('0x20')](function(_0x4c79cc){return[_0x4c79cc,!![]];});});}})[_0x8cff('0xa3')](function(_0x56fc6f,_0x54f8a2){_0x50d495[_0x8cff('0xa4')]=_0x56fc6f['get']({'plain':!![]});_0x50d495['interaction']['created']=![];if(_0x54f8a2){if(_0x50d495[_0x8cff('0x6f')][_0x8cff('0xa5')]){_0x50d495[_0x8cff('0x70')][_0x8cff('0xa6')]({'id':0x0,'priority':_0x50d495[_0x8cff('0x70')]['length']+0x1,'app':'close','appdata':_0x8cff('0xa7'),'interval':'*,*,*,*'});}_0x50d495[_0x8cff('0xa4')][_0x8cff('0xa8')]=!![];}return db['SmsMessage'][_0x8cff('0x57')]({'phone':_0x50d495[_0x8cff('0x58')]['from'],'messageId':_0x50d495['body']['messageId'],'body':_0x50d495[_0x8cff('0x58')]['body'],'SmsAccountId':_0x235da0[_0x8cff('0x51')]['id'],'SmsInteractionId':_0x56fc6f['id'],'direction':'in','ContactId':_0x56fc6f['ContactId'],'AttachmentId':_0x50d495[_0x8cff('0x58')][_0x8cff('0xa9')]});})['then'](function(_0x2b393f){_0x50d495[_0x8cff('0x27')]=_0x2b393f;if(_0x50d495[_0x8cff('0xa4')][_0x8cff('0xaa')]){return db[_0x8cff('0xab')][_0x8cff('0x55')]({'attributes':['id','name'],'where':{'id':_0x50d495[_0x8cff('0xa4')][_0x8cff('0xaa')]}})[_0x8cff('0x20')](function(_0xbe0763){if(_0xbe0763){_0x50d495[_0x8cff('0x70')][_0x8cff('0xac')]({'id':0x0,'priority':0x0,'app':_0x8cff('0xad'),'appdata':_0xbe0763[_0x8cff('0x38')]+','+(_0x50d495[_0x8cff('0x6f')][_0x8cff('0xae')]||0xa),'interval':_0x8cff('0xaf')});}return respondWithRpcPromise('Start',_0x8cff('0xb0'),_0x50d495);});}return respondWithRpcPromise(_0x8cff('0xb1'),_0x8cff('0xb0'),_0x50d495);})[_0x8cff('0x20')](function(_0x1f375f){if(_0x1f375f){var _0x580cd4=0xc8;var _0x46e560=_0x8cff('0xb2');logger[_0x8cff('0x21')](_0x8cff('0x23'),_0x46e560,_0x580cd4,'entity\x20found');logger[_0x8cff('0xb3')](_0x8cff('0xb4'),_0x46e560,_0x580cd4,_0x8cff('0xb5'),JSON['stringify'](_0x1f375f));if(_0x50d495['account'][_0x8cff('0x3e')]===_0x8cff('0x7b')){return _0x5dd22d[_0x8cff('0x2a')](_0x580cd4)[_0x8cff('0xb6')](_0x8cff('0xb7'),_0x8cff('0xb8'))[_0x8cff('0xb9')]('\x0a');}else{return _0x5dd22d[_0x8cff('0x2a')](_0x580cd4)[_0x8cff('0x2b')](_0x1f375f);}}})[_0x8cff('0x56')](handleError(_0x5dd22d,null));};exports[_0x8cff('0xba')]=function(_0x266e88,_0x47b591){var _0x3854da=_0x266e88[_0x8cff('0x51')]['id'];var _0x61b05=_0x266e88[_0x8cff('0x58')];var _0x1f4d38=0xc8;var _0x3fb598=null;return db[_0x8cff('0xbb')][_0x8cff('0xbc')]({'isolationLevel':db[_0x8cff('0xbb')]['Transaction'][_0x8cff('0xbd')]['READ_COMMITTED']},function(_0x575642){return db[_0x8cff('0x3b')][_0x8cff('0x63')]({'where':{'id':_0x3854da},'transaction':_0x575642})['then'](function(_0x5a3f37){if(_0x5a3f37){return db[_0x8cff('0x6d')][_0x8cff('0x34')]({'where':{'SmsAccountId':_0x3854da},'transaction':_0x575642})[_0x8cff('0x20')](function(){var _0x3607f7=_[_0x8cff('0x41')](_0x61b05,function(_0x32d6fd){_0x32d6fd[_0x8cff('0x66')]=_0x3854da;return _0x32d6fd;});return db['SmsApplication']['bulkCreate'](_0x3607f7,{'transaction':_0x575642});});}else{_0x1f4d38=0x194;_0x3fb598=[];}});})[_0x8cff('0x20')](function(){if(_0x1f4d38!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x3854da},'order':_0x8cff('0x72')})['then'](function(_0x5b17a8){_0x3fb598=_0x5b17a8;});}})[_0x8cff('0x56')](function(_0x85713a){_0x1f4d38=0x1f4;logger[_0x8cff('0x26')](_0x85713a[_0x8cff('0x37')]);if(_0x85713a[_0x8cff('0x38')]){delete _0x85713a[_0x8cff('0x38')];}_0x3fb598=_0x85713a;})[_0x8cff('0xbe')](function(){if(_0x3fb598===null){_0x47b591[_0x8cff('0x29')](_0x1f4d38);}else{if(_0x1f4d38===0x1f4){_0x47b591[_0x8cff('0x2a')](_0x1f4d38)[_0x8cff('0xb9')](_0x3fb598);}else{_0x47b591[_0x8cff('0x2a')](_0x1f4d38)['json'](_0x3fb598);}}});};exports[_0x8cff('0xbf')]=function(_0x288745,_0x588c5a,_0xa333ac){var _0x2f54af={};var _0x4d0151={};var _0x272c6a;var _0x1ded2e;return db['SmsAccount'][_0x8cff('0x63')]({'where':{'id':_0x288745[_0x8cff('0x51')]['id']}})['then'](handleEntityNotFound(_0x588c5a,null))[_0x8cff('0x20')](function(_0x516710){if(_0x516710){_0x272c6a=_0x516710;_0x4d0151[_0x8cff('0x40')]=_[_0x8cff('0x43')](db[_0x8cff('0x6d')][_0x8cff('0x3c')]);_0x4d0151[_0x8cff('0x42')]=_[_0x8cff('0x43')](_0x288745[_0x8cff('0x42')]);_0x4d0151[_0x8cff('0x44')]=_['intersection'](_0x4d0151[_0x8cff('0x40')],_0x4d0151[_0x8cff('0x42')]);_0x2f54af[_0x8cff('0x47')]=_[_0x8cff('0x45')](_0x4d0151[_0x8cff('0x40')],qs['fields'](_0x288745[_0x8cff('0x42')][_0x8cff('0x46')]));_0x2f54af[_0x8cff('0x47')]=_0x2f54af[_0x8cff('0x47')][_0x8cff('0x48')]?_0x2f54af[_0x8cff('0x47')]:_0x4d0151[_0x8cff('0x40')];_0x2f54af['order']=qs['sort'](_0x288745[_0x8cff('0x42')][_0x8cff('0x4a')]);_0x2f54af[_0x8cff('0x4b')]=qs['filters'](_[_0x8cff('0xc0')](_0x288745['query'],_0x4d0151[_0x8cff('0x44')]));if(_0x288745['query'][_0x8cff('0x4c')]){_0x2f54af['where']=_[_0x8cff('0x4d')](_0x2f54af[_0x8cff('0x4b')],{'$or':_[_0x8cff('0x41')](_0x2f54af[_0x8cff('0x47')],function(_0x102d42){var _0x9bf876={};_0x9bf876[_0x102d42]={'$like':'%'+_0x288745[_0x8cff('0x42')]['filter']+'%'};return _0x9bf876;})});}_0x2f54af=_[_0x8cff('0x4d')]({},_0x2f54af,_0x288745[_0x8cff('0x54')]);return _0x272c6a[_0x8cff('0xbf')](_0x2f54af);}})[_0x8cff('0x20')](function(_0x265892){if(_0x265892){_0x1ded2e=_0x265892['length'];if(!_0x288745[_0x8cff('0x42')][_0x8cff('0x64')](_0x8cff('0x49'))){_0x2f54af[_0x8cff('0x2e')]=qs['limit'](_0x288745['query'][_0x8cff('0x2e')]);_0x2f54af[_0x8cff('0x2c')]=qs[_0x8cff('0x2c')](_0x288745[_0x8cff('0x42')][_0x8cff('0x2c')]);}return _0x272c6a['getApplications'](_0x2f54af);}})[_0x8cff('0x20')](function(_0x55f2a0){if(_0x55f2a0){return _0x55f2a0?{'count':_0x1ded2e,'rows':_0x55f2a0}:null;}})[_0x8cff('0x20')](respondWithResult(_0x588c5a,null))[_0x8cff('0x56')](handleError(_0x588c5a,null));};exports[_0x8cff('0xc1')]=function(_0x237365,_0x58dd68,_0x328700){var _0x4b7ec9={'raw':![],'where':{}};var _0x42da9f={};var _0x4d8b9f={'count':0x0,'rows':[]};return db[_0x8cff('0x3b')][_0x8cff('0x63')]({'where':{'id':_0x237365['params']['id']}})[_0x8cff('0x20')](handleEntityNotFound(_0x58dd68,null))['then'](function(_0x102e09){if(_0x102e09){_0x42da9f[_0x8cff('0x40')]=_[_0x8cff('0x43')](db[_0x8cff('0xa2')][_0x8cff('0x3c')]);_0x42da9f[_0x8cff('0x42')]=_['keys'](_0x237365[_0x8cff('0x42')]);_0x42da9f['filters']=_[_0x8cff('0x45')](_0x42da9f[_0x8cff('0x40')],_0x42da9f[_0x8cff('0x42')]);_0x4b7ec9[_0x8cff('0x47')]=_['intersection'](_0x42da9f[_0x8cff('0x40')],qs['fields'](_0x237365[_0x8cff('0x42')]['fields']));_0x4b7ec9[_0x8cff('0x47')]=_0x4b7ec9['attributes']['length']?_0x4b7ec9[_0x8cff('0x47')]:_0x42da9f['model'];if(!_0x237365['query'][_0x8cff('0x64')](_0x8cff('0x49'))){_0x4b7ec9['limit']=qs[_0x8cff('0x2e')](_0x237365[_0x8cff('0x42')][_0x8cff('0x2e')]);_0x4b7ec9[_0x8cff('0x2c')]=qs['offset'](_0x237365[_0x8cff('0x42')]['offset']);}_0x4b7ec9[_0x8cff('0x65')]=qs[_0x8cff('0x4a')](_0x237365[_0x8cff('0x42')][_0x8cff('0x4a')]);_0x4b7ec9[_0x8cff('0x4b')]=qs[_0x8cff('0x44')](_['pick'](_0x237365[_0x8cff('0x42')],_0x42da9f['filters']));_0x4b7ec9['where'][_0x8cff('0x66')]=_0x102e09['id'];if(_0x237365['query'][_0x8cff('0x4c')]){_0x4b7ec9['where']=_['merge'](_0x4b7ec9[_0x8cff('0x4b')],{'$or':_[_0x8cff('0x41')](_0x4b7ec9[_0x8cff('0x47')],function(_0xc3c2be){var _0x303c25={};_0x303c25[_0xc3c2be]={'$like':'%'+_0x237365[_0x8cff('0x42')][_0x8cff('0x4c')]+'%'};return _0x303c25;})});}_0x4b7ec9=_[_0x8cff('0x4d')]({},_0x4b7ec9,_0x237365[_0x8cff('0x54')]);return db[_0x8cff('0xa2')]['count']({'where':_0x4b7ec9[_0x8cff('0x4b')]})['then'](function(_0x3843a7){_0x4d8b9f[_0x8cff('0x2f')]=_0x3843a7;if(_0x237365[_0x8cff('0x42')][_0x8cff('0x4e')]){_0x4b7ec9[_0x8cff('0x53')]=[{'model':db[_0x8cff('0x74')],'as':_0x8cff('0xc2'),'required':![]},{'model':db[_0x8cff('0xab')],'as':_0x8cff('0xc3'),'attributes':[_0x8cff('0x38'),_0x8cff('0xc4'),_0x8cff('0xc5')],'required':![]},{'model':db[_0x8cff('0xc6')],'as':_0x8cff('0xc7'),'attributes':['id','name',_0x8cff('0xc8')],'where':_0x237365[_0x8cff('0x42')]['tag']?{'id':_0x237365[_0x8cff('0x42')][_0x8cff('0xc9')]}:undefined,'required':_0x237365[_0x8cff('0x42')][_0x8cff('0xc9')]?!![]:![]}];}return db[_0x8cff('0xa2')][_0x8cff('0x6b')](_0x4b7ec9);})['then'](function(_0x5eeee8){_0x4d8b9f[_0x8cff('0x4f')]=_0x5eeee8;return _0x4d8b9f;});}})[_0x8cff('0x20')](respondWithFilteredResult(_0x58dd68,_0x4b7ec9))[_0x8cff('0x56')](handleError(_0x58dd68,null));};exports[_0x8cff('0xb9')]=function(_0x356c0a,_0x1aa2ed,_0x5a4160){var _0x56262a,_0x56a55e,_0x41ce14;if(_[_0x8cff('0x93')](_0x356c0a[_0x8cff('0x58')]['body'])||_0x356c0a[_0x8cff('0x58')]['body']===''){throw new db[(_0x8cff('0x75'))]['ValidationError'](_0x8cff('0x95'));}if(_[_0x8cff('0x93')](_0x356c0a[_0x8cff('0x58')]['to'])){throw new db[(_0x8cff('0x75'))]['ValidationError'](_0x8cff('0xca'));}_0x56262a=_0x356c0a[_0x8cff('0x58')]['to'];return db[_0x8cff('0x3b')]['find']({'where':{'id':_0x356c0a[_0x8cff('0x51')]['id']},'include':[{'model':db[_0x8cff('0x99')],'as':_0x8cff('0xcb'),'include':[{'model':db[_0x8cff('0x74')],'as':_0x8cff('0x9b'),'where':{'mobile':_0x56262a},'limit':0x1,'order':[[_0x8cff('0x9c'),_0x8cff('0x9d')]]}]}]})[_0x8cff('0x20')](handleEntityNotFound(_0x1aa2ed,null))[_0x8cff('0x20')](function(_0x542e9f){if(_0x542e9f&&_0x542e9f[_0x8cff('0xcb')]){_0x56a55e=_0x542e9f[_0x8cff('0xcc')]({'plain':!![]});if(_0x56a55e['List']&&_0x56a55e[_0x8cff('0xcb')][_0x8cff('0x9b')][_0x8cff('0x48')]){return _0x56a55e[_0x8cff('0xcb')][_0x8cff('0x9b')][0x0];}return db['CmContact']['create'](_[_0x8cff('0xa0')](_0x356c0a[_0x8cff('0x58')],{'firstName':_0x56262a,'mobile':_0x56262a,'phone':_0x56262a,'ListId':_0x56a55e[_0x8cff('0x9a')]}));}})[_0x8cff('0x20')](handleEntityNotFound(_0x1aa2ed,null))[_0x8cff('0x20')](function(_0x3eeae2){if(_0x3eeae2){_0x41ce14=_0x3eeae2;return db[_0x8cff('0xa2')][_0x8cff('0x55')]({'where':{'ContactId':_0x41ce14['id'],'closed':![],'SmsAccountId':_0x56a55e['id']}})['then'](function(_0x4d1132){if(_0x4d1132){return[_0x4d1132,![]];}return db[_0x8cff('0xa2')][_0x8cff('0x57')]({'UserId':_0x356c0a[_0x8cff('0x59')]['id'],'ContactId':_0x41ce14['id'],'SmsAccountId':_0x56a55e['id'],'phone':_0x56262a,'firstMsgDirection':_0x8cff('0xcd'),'Messages':[_[_0x8cff('0x4d')](_0x356c0a['body'],{'read':![],'body':_0x356c0a[_0x8cff('0x58')][_0x8cff('0x58')],'phone':_0x56262a,'SmsAccountId':_0x56a55e['id'],'UserId':_0x356c0a[_0x8cff('0x59')]['id'],'ContactId':_0x41ce14['id']})]},{'include':[{'model':db[_0x8cff('0xce')],'as':_0x8cff('0xcf')}]})[_0x8cff('0x20')](function(_0x57cb39){return[_0x57cb39,!![]];});});}})[_0x8cff('0xa3')](function(_0x568cea,_0x207a94){if(_0x207a94){return _0x568cea;}return db[_0x8cff('0xce')]['create'](_[_0x8cff('0x4d')](_0x356c0a[_0x8cff('0x58')],{'read':![],'body':_0x356c0a['body'][_0x8cff('0x58')],'phone':_0x56262a,'SmsAccountId':_0x56a55e['id'],'SmsInteractionId':_0x568cea['id'],'UserId':_0x356c0a[_0x8cff('0x59')]['id'],'ContactId':_0x41ce14['id']}))[_0x8cff('0x20')](function(_0xb5d281){_0x568cea[_0x8cff('0xd0')][_0x8cff('0xcf')]=[];_0x568cea[_0x8cff('0xd0')][_0x8cff('0xcf')][_0x8cff('0xa6')](_0xb5d281[_0x8cff('0xd0')]);return _0x568cea;});})['then'](respondWithResult(_0x1aa2ed,null))['catch'](handleError(_0x1aa2ed,null));};exports['status']=function(_0x38cd8c,_0x553b2c,_0x150f21){if(_0x38cd8c[_0x8cff('0x58')]['id']){delete _0x38cd8c[_0x8cff('0x58')]['id'];}var _0x58e4f1,_0xb0e282,_0x50d446;return db['SmsAccount']['find']({'where':{'id':_0x38cd8c[_0x8cff('0x51')]['id']}})[_0x8cff('0x20')](handleEntityNotFound(_0x553b2c,null))[_0x8cff('0x20')](function(_0xc8a427){if(_0xc8a427){_0x50d446=_0xc8a427;logger['debug'](_0x8cff('0x23'),_0x8cff('0x2a'),_0x8cff('0xd1'),_0xc8a427[_0x8cff('0x3e')],util[_0x8cff('0xd2')](_0x38cd8c['body'],{'showHidden':![],'depth':null}));switch(_0xc8a427[_0x8cff('0x3e')]){case _0x8cff('0x81'):if(_0x38cd8c[_0x8cff('0x58')][_0x8cff('0xd3')]&&_0x38cd8c[_0x8cff('0x58')][_0x8cff('0x2a')]){_0xb0e282=_0x38cd8c[_0x8cff('0x58')][_0x8cff('0x2a')];return db['SmsMessage'][_0x8cff('0x55')]({'where':{'messageId':_0x38cd8c[_0x8cff('0x58')][_0x8cff('0xd3')]}});}break;case _0x8cff('0x83'):if(_0x38cd8c[_0x8cff('0x58')][_0x8cff('0xd4')]&&_0x38cd8c[_0x8cff('0x58')]['statusInt']){_0xb0e282=_0x38cd8c[_0x8cff('0x58')]['statusInt'];return db['SmsMessage'][_0x8cff('0x55')]({'where':{'messageId':_0x38cd8c[_0x8cff('0x58')]['requestid']}});}break;case _0x8cff('0xd5'):if(_0x38cd8c[_0x8cff('0x58')][_0x8cff('0x84')]&&_0x38cd8c[_0x8cff('0x58')][_0x8cff('0xd6')]){_0xb0e282=_0x38cd8c[_0x8cff('0x58')][_0x8cff('0xd6')];return db['SmsMessage']['find']({'where':{'messageId':_0x38cd8c[_0x8cff('0x58')]['message_id']}});}break;case'infobip':var _0x84bee2=_0x38cd8c[_0x8cff('0x58')][_0x8cff('0x89')][0x0];if(_0x84bee2[_0x8cff('0x7f')]&&_0x84bee2[_0x8cff('0x2a')][_0x8cff('0xd7')]===_0x8cff('0xd8')){_0xb0e282=_0x84bee2[_0x8cff('0x2a')]['groupName'];return db[_0x8cff('0xce')][_0x8cff('0x55')]({'where':{'messageId':_0x84bee2[_0x8cff('0x7f')]}});}break;case _0x8cff('0x8d'):if(_0x38cd8c[_0x8cff('0x58')][_0x8cff('0x7f')]&&_0x38cd8c['body'][_0x8cff('0x2a')]){_0xb0e282=_0x38cd8c[_0x8cff('0x58')][_0x8cff('0x2a')];return db[_0x8cff('0xce')][_0x8cff('0x55')]({'where':{'messageId':_0x38cd8c['body']['messageId']}});}break;case _0x8cff('0x90'):if(_0x38cd8c[_0x8cff('0x58')][0x0][_0x8cff('0x27')]['id']){_0xb0e282=_0x38cd8c[_0x8cff('0x58')][0x0]['type'];return db[_0x8cff('0xce')]['find']({'where':{'messageId':_0x38cd8c[_0x8cff('0x58')][0x0]['message']['id']}});}break;case _0x8cff('0x91'):if(_0x38cd8c['body'][_0x8cff('0xd9')]&&_0x38cd8c[_0x8cff('0x58')][_0x8cff('0x2a')]){_0xb0e282=_0x38cd8c[_0x8cff('0x58')][_0x8cff('0x2a')];return db[_0x8cff('0xce')]['find']({'where':{'messageId':_0x38cd8c[_0x8cff('0x58')][_0x8cff('0xd9')]}});}break;}}})[_0x8cff('0x20')](handleEntityNotFound(_0x553b2c,null))[_0x8cff('0x20')](function(_0x4c7fdb){if(_0x4c7fdb){_0x58e4f1=_0x4c7fdb;switch(_0x50d446['type']){case _0x8cff('0x81'):if(_0xb0e282===_0x8cff('0xd8')){return _0x58e4f1[_0x8cff('0x33')]({'read':!![]});}else{logger[_0x8cff('0x26')](_0x8cff('0x23'),_0x8cff('0x2a'),_0x8cff('0x81'),util[_0x8cff('0xd2')](_0x38cd8c[_0x8cff('0x58')],{'showHidden':![],'depth':null}));}break;case _0x8cff('0x83'):if(_0xb0e282==='1'){return _0x58e4f1[_0x8cff('0x33')]({'read':!![]});}else{logger[_0x8cff('0x26')](_0x8cff('0x23'),_0x8cff('0x2a'),_0x8cff('0x81'),util[_0x8cff('0xd2')](_0x38cd8c[_0x8cff('0x58')],{'showHidden':![],'depth':null}));}break;case _0x8cff('0xd5'):if(!_0x38cd8c[_0x8cff('0x58')][_0x8cff('0xda')]&&_0xb0e282>=0xc8&&_0xb0e282<=0xce){return _0x58e4f1['update']({'read':!![]});}else{logger['error'](_0x8cff('0x23'),'status','clicksend',util[_0x8cff('0xd2')](_0x38cd8c[_0x8cff('0x58')],{'showHidden':![],'depth':null}));}break;case _0x8cff('0x88'):var _0x1a67ac=_0x38cd8c[_0x8cff('0x58')][_0x8cff('0x89')][0x0];if(_0x1a67ac[_0x8cff('0x2a')][_0x8cff('0xd7')]===_0x8cff('0xd8')){return _0x58e4f1[_0x8cff('0x33')]({'read':!![]});}else{logger[_0x8cff('0x26')](_0x8cff('0x23'),_0x8cff('0x2a'),_0x8cff('0x88'),util['inspect'](_0x38cd8c[_0x8cff('0x58')],{'showHidden':![],'depth':null}));}break;case _0x8cff('0x8d'):if(_0xb0e282==_0x8cff('0xdb')||_0xb0e282==_0x8cff('0xdc')){return _0x58e4f1[_0x8cff('0x33')]({'read':!![]});}else{logger[_0x8cff('0x26')](_0x8cff('0x23'),_0x8cff('0x2a'),'clickatell',util[_0x8cff('0xd2')](_0x38cd8c['body'],{'showHidden':![],'depth':null}));}break;case _0x8cff('0x90'):if(_0xb0e282==_0x8cff('0xdd')){return _0x58e4f1[_0x8cff('0x33')]({'read':!![]});}else{logger[_0x8cff('0x26')](_0x8cff('0x23'),_0x8cff('0x2a'),_0x8cff('0x90'),util[_0x8cff('0xd2')](_0x38cd8c[_0x8cff('0x58')],{'showHidden':![],'depth':null}));}break;case _0x8cff('0x91'):if(_0xb0e282==='DELIVRD'||_0xb0e282==='ACCEPTD'){return _0x58e4f1[_0x8cff('0x33')]({'read':!![]});}else{logger[_0x8cff('0x26')](_0x8cff('0x23'),_0x8cff('0x2a'),_0x8cff('0x91'),util[_0x8cff('0xd2')](_0x38cd8c[_0x8cff('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x58e4f1;}})['then'](respondWithResult(_0x553b2c,null))[_0x8cff('0x56')](handleError(_0x553b2c,null));};exports[_0x8cff('0xde')]=function(_0xe3ede2,_0xab895,_0x40348f){var _0xc584fb,_0x3e31d6,_0x2ce145;return db[_0x8cff('0x3b')][_0x8cff('0x55')]({'where':{'id':_0xe3ede2[_0x8cff('0x51')]['id']}})[_0x8cff('0x20')](handleEntityNotFound(_0xab895,null))[_0x8cff('0x20')](function(_0x6b7970){if(_0x6b7970){_0x2ce145=_0x6b7970;logger[_0x8cff('0xb3')](_0x8cff('0x23'),_0x8cff('0x2a'),_0x8cff('0xd1'),_0x6b7970['type'],util[_0x8cff('0xd2')](_0xe3ede2[_0x8cff('0x42')],{'showHidden':![],'depth':null}));switch(_0x6b7970['type']){case _0x8cff('0x8a'):if(_0xe3ede2[_0x8cff('0x42')][_0x8cff('0xdf')]&&_0xe3ede2[_0x8cff('0x42')][_0x8cff('0xe0')]){_0x3e31d6=_0xe3ede2['query']['state'];return db[_0x8cff('0xce')][_0x8cff('0x55')]({'where':{'messageId':_0xe3ede2['query'][_0x8cff('0xdf')]}});}break;}}})[_0x8cff('0x20')](handleEntityNotFound(_0xab895,null))['then'](function(_0x25b397){if(_0x25b397){_0xc584fb=_0x25b397;switch(_0x2ce145['type']){case _0x8cff('0x8a'):if(_0x3e31d6==='2'||_0x3e31d6==='6'){return _0xc584fb[_0x8cff('0x33')]({'read':!![]});}else{logger[_0x8cff('0x26')](_0x8cff('0x23'),_0x8cff('0x2a'),'csc',util[_0x8cff('0xd2')](_0xe3ede2[_0x8cff('0x42')],{'showHidden':![],'depth':null}));};break;}return _0xc584fb;}})[_0x8cff('0x20')](respondWithResult(_0xab895,null))['catch'](handleError(_0xab895,null));};exports[_0x8cff('0xe1')]=function(_0x379858,_0x52d6b3,_0x397102){return db[_0x8cff('0x3b')][_0x8cff('0x55')]({'where':{'id':_0x379858[_0x8cff('0x51')]['id']}})[_0x8cff('0x20')](handleEntityNotFound(_0x52d6b3,null))[_0x8cff('0x20')](function(_0x341079){if(_0x341079){return _0x341079[_0x8cff('0xe1')](_0x379858[_0x8cff('0x58')][_0x8cff('0x68')],_['omit'](_0x379858[_0x8cff('0x58')],[_0x8cff('0x68'),'id'])||{})[_0x8cff('0xa3')](function(_0x3c67cd){for(var _0x21d8d3=0x0;_0x21d8d3<_0x379858['body']['ids']['length'];_0x21d8d3+=0x1){socket[_0x8cff('0xe2')](_0x8cff('0xe3'),{'UserId':Number(_0x379858[_0x8cff('0x58')][_0x8cff('0x68')][_0x21d8d3]),'SmsAccountId':Number(_0x379858[_0x8cff('0x51')]['id'])});}return _0x3c67cd;});}})[_0x8cff('0x20')](respondWithResult(_0x52d6b3,null))[_0x8cff('0x56')](handleError(_0x52d6b3,null));};exports[_0x8cff('0xe4')]=function(_0x2259d3,_0x18b146,_0x530db5){return db[_0x8cff('0x3b')][_0x8cff('0x55')]({'where':{'id':_0x2259d3[_0x8cff('0x51')]['id']}})['then'](handleEntityNotFound(_0x18b146,null))[_0x8cff('0x20')](function(_0x508cab){if(_0x508cab){return _0x508cab[_0x8cff('0xe4')](_0x2259d3[_0x8cff('0x42')]['ids'])[_0x8cff('0x20')](function(){if(_['isArray'](_0x2259d3[_0x8cff('0x42')][_0x8cff('0x68')])){for(var _0x5f0da4=0x0;_0x5f0da4<_0x2259d3[_0x8cff('0x42')]['ids'][_0x8cff('0x48')];_0x5f0da4+=0x1){socket[_0x8cff('0xe2')]('userSmsAccount:remove',{'UserId':Number(_0x2259d3[_0x8cff('0x42')][_0x8cff('0x68')][_0x5f0da4]),'SmsAccountId':Number(_0x2259d3[_0x8cff('0x51')]['id'])});}}else{socket[_0x8cff('0xe2')](_0x8cff('0xe5'),{'UserId':Number(_0x2259d3['query'][_0x8cff('0x68')]),'SmsAccountId':Number(_0x2259d3['params']['id'])});}});}})[_0x8cff('0x20')](respondWithStatusCode(_0x18b146,null))[_0x8cff('0x56')](handleError(_0x18b146,null));};exports[_0x8cff('0xe6')]=function(_0x2d8fb1,_0x57dced,_0x20bcca){var _0x47668d={};var _0x3adbb3={};var _0x155d69;var _0x11a560;return db[_0x8cff('0x3b')][_0x8cff('0x63')]({'where':{'id':_0x2d8fb1['params']['id']}})['then'](handleEntityNotFound(_0x57dced,null))[_0x8cff('0x20')](function(_0x6cdb5e){if(_0x6cdb5e){_0x155d69=_0x6cdb5e;_0x3adbb3['model']=_[_0x8cff('0x43')](db[_0x8cff('0xab')][_0x8cff('0x3c')]);_0x3adbb3['query']=_['keys'](_0x2d8fb1[_0x8cff('0x42')]);_0x3adbb3['filters']=_[_0x8cff('0x45')](_0x3adbb3[_0x8cff('0x40')],_0x3adbb3[_0x8cff('0x42')]);_0x47668d['attributes']=_[_0x8cff('0x45')](_0x3adbb3['model'],qs[_0x8cff('0x46')](_0x2d8fb1['query'][_0x8cff('0x46')]));_0x47668d['attributes']=_0x47668d[_0x8cff('0x47')][_0x8cff('0x48')]?_0x47668d[_0x8cff('0x47')]:_0x3adbb3['model'];_0x47668d[_0x8cff('0x65')]=qs[_0x8cff('0x4a')](_0x2d8fb1[_0x8cff('0x42')]['sort']);_0x47668d[_0x8cff('0x4b')]=qs[_0x8cff('0x44')](_[_0x8cff('0xc0')](_0x2d8fb1[_0x8cff('0x42')],_0x3adbb3[_0x8cff('0x44')]));if(_0x2d8fb1[_0x8cff('0x42')][_0x8cff('0x4c')]){_0x47668d['where']=_[_0x8cff('0x4d')](_0x47668d[_0x8cff('0x4b')],{'$or':_[_0x8cff('0x41')](_0x47668d[_0x8cff('0x47')],function(_0x10da0a){var _0x3c538d={};_0x3c538d[_0x10da0a]={'$like':'%'+_0x2d8fb1[_0x8cff('0x42')][_0x8cff('0x4c')]+'%'};return _0x3c538d;})});}_0x47668d=_['merge']({},_0x47668d,_0x2d8fb1[_0x8cff('0x54')]);return _0x155d69[_0x8cff('0xe6')](_0x47668d);}})[_0x8cff('0x20')](function(_0x1cb552){if(_0x1cb552){_0x11a560=_0x1cb552[_0x8cff('0x48')];if(!_0x2d8fb1[_0x8cff('0x42')][_0x8cff('0x64')](_0x8cff('0x49'))){_0x47668d[_0x8cff('0x2e')]=qs[_0x8cff('0x2e')](_0x2d8fb1['query'][_0x8cff('0x2e')]);_0x47668d[_0x8cff('0x2c')]=qs[_0x8cff('0x2c')](_0x2d8fb1[_0x8cff('0x42')]['offset']);}return _0x155d69[_0x8cff('0xe6')](_0x47668d);}})[_0x8cff('0x20')](function(_0x3d224a){if(_0x3d224a){return _0x3d224a?{'count':_0x11a560,'rows':_0x3d224a}:null;}})[_0x8cff('0x20')](respondWithResult(_0x57dced,null))[_0x8cff('0x56')](handleError(_0x57dced,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 127174e..3f4394c 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 _0x5062=['SmsAccount','setMaxListeners','save','update','remove','emit','../../mysqldb'];(function(_0x3f2d7a,_0x539136){var _0x5ad277=function(_0x39810a){while(--_0x39810a){_0x3f2d7a['push'](_0x3f2d7a['shift']());}};_0x5ad277(++_0x539136);}(_0x5062,0xb5));var _0x2506=function(_0x14c209,_0x4075bf){_0x14c209=_0x14c209-0x0;var _0xfa3525=_0x5062[_0x14c209];return _0xfa3525;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x2506('0x0'))['db'][_0x2506('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x2506('0x2')](0x0);var events={'afterCreate':_0x2506('0x3'),'afterUpdate':_0x2506('0x4'),'afterDestroy':_0x2506('0x5')};function emitEvent(_0x107169){return function(_0x47fa5c,_0x36e731,_0x24f00e){SmsAccountEvents[_0x2506('0x6')](_0x107169+':'+_0x47fa5c['id'],_0x47fa5c);SmsAccountEvents[_0x2506('0x6')](_0x107169,_0x47fa5c);_0x24f00e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x7553=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount'];(function(_0x33f39a,_0x2f027f){var _0x4a74f5=function(_0x136ffb){while(--_0x136ffb){_0x33f39a['push'](_0x33f39a['shift']());}};_0x4a74f5(++_0x2f027f);}(_0x7553,0x1d6));var _0x3755=function(_0x34e46d,_0x5df86a){_0x34e46d=_0x34e46d-0x0;var _0x1cc6aa=_0x7553[_0x34e46d];return _0x1cc6aa;};'use strict';var EventEmitter=require(_0x3755('0x0'));var SmsAccount=require(_0x3755('0x1'))['db'][_0x3755('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x3755('0x3')](0x0);var events={'afterCreate':_0x3755('0x4'),'afterUpdate':_0x3755('0x5'),'afterDestroy':_0x3755('0x6')};function emitEvent(_0x4fe6f0){return function(_0x2d99da,_0x545735,_0x201a86){SmsAccountEvents[_0x3755('0x7')](_0x4fe6f0+':'+_0x2d99da['id'],_0x2d99da);SmsAccountEvents[_0x3755('0x7')](_0x4fe6f0,_0x2d99da);_0x201a86(null);};}for(var e in events){if(events[_0x3755('0x8')](e)){var event=events[e];SmsAccount[_0x3755('0x9')](e,emitEvent(event));}}module[_0x3755('0xa')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 2fc9b6e..665726c 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 _0xec71=['SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./smsAccount.attributes','define'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0xec71,0x1ee));var _0x1ec7=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0xec71[_0x10f68e];return _0x4c8372;};'use strict';var _=require(_0x1ec7('0x0'));var util=require(_0x1ec7('0x1'));var logger=require(_0x1ec7('0x2'))(_0x1ec7('0x3'));var moment=require(_0x1ec7('0x4'));var BPromise=require(_0x1ec7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1ec7('0x6'));var config=require(_0x1ec7('0x7'));var attributes=require(_0x1ec7('0x8'));module['exports']=function(_0x166354,_0x4941f1){return _0x166354[_0x1ec7('0x9')](_0x1ec7('0xa'),attributes,{'tableName':_0x1ec7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x894a=['define','SmsAccount','sms_accounts','util','../../config/logger','api','moment','request-promise','rimraf','./smsAccount.attributes','exports'];(function(_0x5d7d6d,_0x39cb16){var _0x5bf71f=function(_0x15374c){while(--_0x15374c){_0x5d7d6d['push'](_0x5d7d6d['shift']());}};_0x5bf71f(++_0x39cb16);}(_0x894a,0x116));var _0xa894=function(_0x1a4dbd,_0xcf014b){_0x1a4dbd=_0x1a4dbd-0x0;var _0x5c1f1e=_0x894a[_0x1a4dbd];return _0x5c1f1e;};'use strict';var _=require('lodash');var util=require(_0xa894('0x0'));var logger=require(_0xa894('0x1'))(_0xa894('0x2'));var moment=require(_0xa894('0x3'));var BPromise=require('bluebird');var rp=require(_0xa894('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa894('0x5'));var config=require('../../config/environment');var attributes=require(_0xa894('0x6'));module[_0xa894('0x7')]=function(_0x4a85aa,_0x5070a2){return _0x4a85aa[_0xa894('0x8')](_0xa894('0x9'),attributes,{'tableName':_0xa894('0xa'),'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 76b68e9..f1a1f3c 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 _0xa5e7=['attributes','then','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','ShowSmsAccount','SmsAccount','options','where','include','map','model'];(function(_0x4f4241,_0x4fafab){var _0x4f0d5e=function(_0x5e7e72){while(--_0x5e7e72){_0x4f4241['push'](_0x4f4241['shift']());}};_0x4f0d5e(++_0x4fafab);}(_0xa5e7,0x13d));var _0x7a5e=function(_0xaf0a8e,_0x4b5d45){_0xaf0a8e=_0xaf0a8e-0x0;var _0x3befbc=_0xa5e7[_0xaf0a8e];return _0x3befbc;};'use strict';var _=require('lodash');var util=require(_0x7a5e('0x0'));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('../../mysqldb')['db'];var utils=require(_0x7a5e('0x5'));var logger=require('../../config/logger')(_0x7a5e('0x6'));var config=require(_0x7a5e('0x7'));var jayson=require(_0x7a5e('0x8'));var client=jayson[_0x7a5e('0x9')]['http']({'port':0x232a});config[_0x7a5e('0xa')]=_['defaults'](config[_0x7a5e('0xa')],{'host':_0x7a5e('0xb'),'port':0x18eb});var socket=require(_0x7a5e('0xc'))(new Redis(config[_0x7a5e('0xa')]));require(_0x7a5e('0xd'))[_0x7a5e('0xe')](socket);function respondWithRpcPromise(_0x337c1b,_0x2946b5,_0xd1c62f){return new BPromise(function(_0xe42f93,_0x132ab2){return client[_0x7a5e('0xf')](_0x337c1b,_0xd1c62f)['then'](function(_0x221ebd){logger['info'](_0x7a5e('0x10'),_0x2946b5,_0x7a5e('0x11'));logger[_0x7a5e('0x12')](_0x7a5e('0x13'),_0x2946b5,_0x7a5e('0x11'),JSON[_0x7a5e('0x14')](_0x221ebd));if(_0x221ebd[_0x7a5e('0x15')]){if(_0x221ebd[_0x7a5e('0x15')][_0x7a5e('0x16')]===0x1f4){logger[_0x7a5e('0x15')]('SmsAccount,\x20%s,\x20%s',_0x2946b5,_0x221ebd[_0x7a5e('0x15')][_0x7a5e('0x17')]);return _0x132ab2(_0x221ebd[_0x7a5e('0x15')][_0x7a5e('0x17')]);}logger[_0x7a5e('0x15')](_0x7a5e('0x10'),_0x2946b5,_0x221ebd[_0x7a5e('0x15')][_0x7a5e('0x17')]);return _0xe42f93(_0x221ebd[_0x7a5e('0x15')]['message']);}else{logger[_0x7a5e('0x18')](_0x7a5e('0x10'),_0x2946b5,_0x7a5e('0x11'));_0xe42f93(_0x221ebd['result']['message']);}})[_0x7a5e('0x19')](function(_0x573051){logger['error'](_0x7a5e('0x10'),_0x2946b5,_0x573051);_0x132ab2(_0x573051);});});}exports[_0x7a5e('0x1a')]=function(_0x465588){var _0x4db3d9=this;return new Promise(function(_0x56cf24,_0x5d5369){return db[_0x7a5e('0x1b')]['find']({'raw':_0x465588[_0x7a5e('0x1c')]?_0x465588[_0x7a5e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x465588[_0x7a5e('0x1c')]?_0x465588[_0x7a5e('0x1c')][_0x7a5e('0x1d')]||null:null,'attributes':_0x465588['options']?_0x465588[_0x7a5e('0x1c')]['attributes']||null:null,'include':_0x465588[_0x7a5e('0x1c')]?_0x465588[_0x7a5e('0x1c')][_0x7a5e('0x1e')]?_[_0x7a5e('0x1f')](_0x465588[_0x7a5e('0x1c')]['include'],function(_0x11c52e){return{'model':db[_0x11c52e[_0x7a5e('0x20')]],'as':_0x11c52e['as'],'attributes':_0x11c52e[_0x7a5e('0x21')],'include':_0x11c52e[_0x7a5e('0x1e')]?_[_0x7a5e('0x1f')](_0x11c52e[_0x7a5e('0x1e')],function(_0x5475d2){return{'model':db[_0x5475d2[_0x7a5e('0x20')]],'as':_0x5475d2['as'],'attributes':_0x5475d2[_0x7a5e('0x21')],'include':_0x5475d2[_0x7a5e('0x1e')]?_[_0x7a5e('0x1f')](_0x5475d2['include'],function(_0x308964){return{'model':db[_0x308964[_0x7a5e('0x20')]],'as':_0x308964['as'],'attributes':_0x308964[_0x7a5e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7a5e('0x22')](function(_0x4941bf){logger[_0x7a5e('0x18')](_0x7a5e('0x1a'),_0x465588);logger[_0x7a5e('0x12')](_0x7a5e('0x1a'),_0x465588,JSON[_0x7a5e('0x14')](_0x4941bf));_0x56cf24(_0x4941bf);})['catch'](function(_0x11a949){logger[_0x7a5e('0x15')]('ShowSmsAccount',_0x11a949[_0x7a5e('0x17')],_0x465588);_0x5d5369(_0x4db3d9['error'](0x1f4,_0x11a949[_0x7a5e('0x17')]));});});}; \ No newline at end of file +var _0x600c=['redis','request','then','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','info','result','options','where','include','map','model','attributes','ShowSmsAccount','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0x600c,0x12d));var _0xc600=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x600c[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0xc600('0x0'));var util=require(_0xc600('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc600('0x2'));var db=require(_0xc600('0x3'))['db'];var utils=require(_0xc600('0x4'));var logger=require(_0xc600('0x5'))(_0xc600('0x6'));var config=require(_0xc600('0x7'));var jayson=require(_0xc600('0x8'));var client=jayson[_0xc600('0x9')][_0xc600('0xa')]({'port':0x232a});config['redis']=_[_0xc600('0xb')](config['redis'],{'host':_0xc600('0xc'),'port':0x18eb});var socket=require(_0xc600('0xd'))(new Redis(config[_0xc600('0xe')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x113f29,_0x358f5f,_0x3e5cd3){return new BPromise(function(_0x3997cf,_0x34a1f6){return client[_0xc600('0xf')](_0x113f29,_0x3e5cd3)[_0xc600('0x10')](function(_0x2f9808){logger['info']('SmsAccount,\x20%s,\x20%s',_0x358f5f,'request\x20sent');logger[_0xc600('0x11')](_0xc600('0x12'),_0x358f5f,_0xc600('0x13'),JSON[_0xc600('0x14')](_0x2f9808));if(_0x2f9808[_0xc600('0x15')]){if(_0x2f9808[_0xc600('0x15')][_0xc600('0x16')]===0x1f4){logger[_0xc600('0x15')]('SmsAccount,\x20%s,\x20%s',_0x358f5f,_0x2f9808[_0xc600('0x15')][_0xc600('0x17')]);return _0x34a1f6(_0x2f9808[_0xc600('0x15')][_0xc600('0x17')]);}logger[_0xc600('0x15')](_0xc600('0x18'),_0x358f5f,_0x2f9808[_0xc600('0x15')][_0xc600('0x17')]);return _0x3997cf(_0x2f9808[_0xc600('0x15')][_0xc600('0x17')]);}else{logger[_0xc600('0x19')](_0xc600('0x18'),_0x358f5f,'request\x20sent');_0x3997cf(_0x2f9808[_0xc600('0x1a')][_0xc600('0x17')]);}})['catch'](function(_0x3d2278){logger[_0xc600('0x15')](_0xc600('0x18'),_0x358f5f,_0x3d2278);_0x34a1f6(_0x3d2278);});});}exports['ShowSmsAccount']=function(_0x4ff934){var _0x232896=this;return new Promise(function(_0x2892bb,_0xfb0636){return db['SmsAccount']['find']({'raw':_0x4ff934['options']?_0x4ff934['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ff934[_0xc600('0x1b')]?_0x4ff934[_0xc600('0x1b')][_0xc600('0x1c')]||null:null,'attributes':_0x4ff934[_0xc600('0x1b')]?_0x4ff934['options']['attributes']||null:null,'include':_0x4ff934[_0xc600('0x1b')]?_0x4ff934['options'][_0xc600('0x1d')]?_[_0xc600('0x1e')](_0x4ff934['options'][_0xc600('0x1d')],function(_0x8c9c0a){return{'model':db[_0x8c9c0a[_0xc600('0x1f')]],'as':_0x8c9c0a['as'],'attributes':_0x8c9c0a[_0xc600('0x20')],'include':_0x8c9c0a[_0xc600('0x1d')]?_[_0xc600('0x1e')](_0x8c9c0a[_0xc600('0x1d')],function(_0x46f5a2){return{'model':db[_0x46f5a2[_0xc600('0x1f')]],'as':_0x46f5a2['as'],'attributes':_0x46f5a2[_0xc600('0x20')],'include':_0x46f5a2[_0xc600('0x1d')]?_[_0xc600('0x1e')](_0x46f5a2[_0xc600('0x1d')],function(_0x2250f9){return{'model':db[_0x2250f9[_0xc600('0x1f')]],'as':_0x2250f9['as'],'attributes':_0x2250f9[_0xc600('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a7095){logger[_0xc600('0x19')]('ShowSmsAccount',_0x4ff934);logger['debug'](_0xc600('0x21'),_0x4ff934,JSON[_0xc600('0x14')](_0x4a7095));_0x2892bb(_0x4a7095);})[_0xc600('0x22')](function(_0x8771ce){logger['error'](_0xc600('0x21'),_0x8771ce[_0xc600('0x17')],_0x4ff934);_0xfb0636(_0x232896['error'](0x1f4,_0x8771ce['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index e37999e..8694fa7 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(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 b70b11d..fc94182 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 _0xe14b=['/:id','create','put','exports','multer','util','express','Router','../../components/auth/service','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x321321,_0x388868){var _0x20b6f8=function(_0x491f9f){while(--_0x491f9f){_0x321321['push'](_0x321321['shift']());}};_0x20b6f8(++_0x388868);}(_0xe14b,0x93));var _0xbe14=function(_0x160a2a,_0x217081){_0x160a2a=_0x160a2a-0x0;var _0x1cd990=_0xe14b[_0x160a2a];return _0x1cd990;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router['delete'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['destroy']);module[_0xbe14('0xc')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x19737b,_0x212909){var _0x16329e=function(_0x51e1f9){while(--_0x51e1f9){_0x19737b['push'](_0x19737b['shift']());}};_0x16329e(++_0x212909);}(_0x3e74,0x175));var _0x43e7=function(_0x45878f,_0x4e9227){_0x45878f=_0x45878f-0x0;var _0x1e0ed6=_0x3e74[_0x45878f];return _0x1e0ed6;};'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('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('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 1688a16..78661fc 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 _0x1d4f=['sequelize','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x1644f2,_0x2884e8){var _0x1fcb31=function(_0x41773c){while(--_0x41773c){_0x1644f2['push'](_0x1644f2['shift']());}};_0x1fcb31(++_0x2884e8);}(_0x1d4f,0xc0));var _0xf1d4=function(_0x4f61ea,_0x51e995){_0x4f61ea=_0x4f61ea-0x0;var _0x17e938=_0x1d4f[_0x4f61ea];return _0x17e938;};'use strict';var Sequelize=require(_0xf1d4('0x0'));module['exports']={'priority':{'type':Sequelize[_0xf1d4('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf1d4('0x2')],'allowNull':![],'defaultValue':_0xf1d4('0x3')},'appdata':{'type':Sequelize[_0xf1d4('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf1d4('0x5')}}; \ No newline at end of file +var _0xc8cc=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc8cc,0x15e));var _0xcc8c=function(_0x2c935f,_0x1db2f2){_0x2c935f=_0x2c935f-0x0;var _0x5ca925=_0xc8cc[_0x2c935f];return _0x5ca925;};'use strict';var Sequelize=require(_0xcc8c('0x0'));module[_0xcc8c('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xcc8c('0x2')],'allowNull':![],'defaultValue':_0xcc8c('0x3')},'appdata':{'type':Sequelize[_0xcc8c('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xcc8c('0x2')],'defaultValue':_0xcc8c('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 154ad4c..62a6259 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 _0xfe4a=['fields','length','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','update','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','then','destroy','end','error','stack','name','send','index','map','SmsApplication','rawAttributes','type','key','query','keys','filters','intersection','model','attributes'];(function(_0x2eb678,_0xe684b8){var _0x56ef18=function(_0x6dcb4e){while(--_0x6dcb4e){_0x2eb678['push'](_0x2eb678['shift']());}};_0x56ef18(++_0xe684b8);}(_0xfe4a,0xae));var _0xafe4=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xfe4a[_0x2a6809];return _0x11c371;};'use strict';var emlformat=require(_0xafe4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xafe4('0x1'));var rp=require(_0xafe4('0x2'));var moment=require(_0xafe4('0x3'));var BPromise=require(_0xafe4('0x4'));var Mustache=require(_0xafe4('0x5'));var util=require('util');var path=require(_0xafe4('0x6'));var sox=require('sox');var csv=require(_0xafe4('0x7'));var ejs=require(_0xafe4('0x8'));var fs=require('fs');var fs_extra=require(_0xafe4('0x9'));var _=require(_0xafe4('0xa'));var squel=require(_0xafe4('0xb'));var crypto=require(_0xafe4('0xc'));var jsforce=require(_0xafe4('0xd'));var deskjs=require(_0xafe4('0xe'));var toCsv=require(_0xafe4('0x7'));var querystring=require(_0xafe4('0xf'));var Papa=require(_0xafe4('0x10'));var Redis=require(_0xafe4('0x11'));var authService=require(_0xafe4('0x12'));var qs=require(_0xafe4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xafe4('0x14'));var logger=require(_0xafe4('0x15'))(_0xafe4('0x16'));var utils=require(_0xafe4('0x17'));var config=require(_0xafe4('0x18'));var licenseUtil=require(_0xafe4('0x19'));var db=require(_0xafe4('0x1a'))['db'];function respondWithStatusCode(_0x3f1b8e,_0x4e0711){_0x4e0711=_0x4e0711||0xcc;return function(_0x29565a){if(_0x29565a){return _0x3f1b8e[_0xafe4('0x1b')](_0x4e0711);}return _0x3f1b8e[_0xafe4('0x1c')](_0x4e0711)['end']();};}function respondWithResult(_0x5f3bea,_0x25c3b2){_0x25c3b2=_0x25c3b2||0xc8;return function(_0x65debd){if(_0x65debd){return _0x5f3bea[_0xafe4('0x1c')](_0x25c3b2)['json'](_0x65debd);}};}function respondWithFilteredResult(_0x23e089,_0x4bd0a7){return function(_0x1dae6f){if(_0x1dae6f){var _0x479b26=typeof _0x4bd0a7[_0xafe4('0x1d')]==='undefined'&&typeof _0x4bd0a7[_0xafe4('0x1e')]===_0xafe4('0x1f');var _0x5534a0=_0x1dae6f['count'];var _0x4c0385=_0x479b26?0x0:_0x4bd0a7[_0xafe4('0x1d')];var _0x12d56a=_0x479b26?_0x1dae6f[_0xafe4('0x20')]:_0x4bd0a7[_0xafe4('0x1d')]+_0x4bd0a7[_0xafe4('0x1e')];var _0x53ec53;if(_0x12d56a>=_0x5534a0){_0x12d56a=_0x5534a0;_0x53ec53=0xc8;}else{_0x53ec53=0xce;}_0x23e089['status'](_0x53ec53);return _0x23e089[_0xafe4('0x21')](_0xafe4('0x22'),_0x4c0385+'-'+_0x12d56a+'/'+_0x5534a0)[_0xafe4('0x23')](_0x1dae6f);}return null;};}function patchUpdates(_0xddac5c){return function(_0x15c526){try{jsonpatch[_0xafe4('0x24')](_0x15c526,_0xddac5c,!![]);}catch(_0x670d68){return BPromise[_0xafe4('0x25')](_0x670d68);}return _0x15c526['save']();};}function saveUpdates(_0x5cfa2a,_0x914583){return function(_0x3da4a4){if(_0x3da4a4){return _0x3da4a4['update'](_0x5cfa2a)[_0xafe4('0x26')](function(_0x1d5050){return _0x1d5050;});}return null;};}function removeEntity(_0x4f678f,_0x1bf2f3){return function(_0x286871){if(_0x286871){return _0x286871[_0xafe4('0x27')]()[_0xafe4('0x26')](function(){_0x4f678f[_0xafe4('0x1c')](0xcc)[_0xafe4('0x28')]();});}};}function handleEntityNotFound(_0x5a6bc0,_0x33828a){return function(_0x2b7daf){if(!_0x2b7daf){_0x5a6bc0[_0xafe4('0x1b')](0x194);}return _0x2b7daf;};}function handleError(_0x55c778,_0x8e21b5){_0x8e21b5=_0x8e21b5||0x1f4;return function(_0x231d38){logger[_0xafe4('0x29')](_0x231d38[_0xafe4('0x2a')]);if(_0x231d38[_0xafe4('0x2b')]){delete _0x231d38['name'];}_0x55c778['status'](_0x8e21b5)[_0xafe4('0x2c')](_0x231d38);};}exports[_0xafe4('0x2d')]=function(_0xf7f857,_0x2c7845){var _0x4d303d={},_0x562a2f={},_0x5b2647={'count':0x0,'rows':[]};var _0x5088a6=_[_0xafe4('0x2e')](db[_0xafe4('0x2f')][_0xafe4('0x30')],function(_0x34c0ee){return{'name':_0x34c0ee['fieldName'],'type':_0x34c0ee[_0xafe4('0x31')][_0xafe4('0x32')]};});_0x562a2f['model']=_['map'](_0x5088a6,_0xafe4('0x2b'));_0x562a2f[_0xafe4('0x33')]=_[_0xafe4('0x34')](_0xf7f857[_0xafe4('0x33')]);_0x562a2f[_0xafe4('0x35')]=_[_0xafe4('0x36')](_0x562a2f[_0xafe4('0x37')],_0x562a2f[_0xafe4('0x33')]);_0x4d303d[_0xafe4('0x38')]=_[_0xafe4('0x36')](_0x562a2f[_0xafe4('0x37')],qs[_0xafe4('0x39')](_0xf7f857[_0xafe4('0x33')][_0xafe4('0x39')]));_0x4d303d[_0xafe4('0x38')]=_0x4d303d[_0xafe4('0x38')][_0xafe4('0x3a')]?_0x4d303d[_0xafe4('0x38')]:_0x562a2f[_0xafe4('0x37')];if(!_0xf7f857[_0xafe4('0x33')]['hasOwnProperty']('nolimit')){_0x4d303d['limit']=qs['limit'](_0xf7f857[_0xafe4('0x33')][_0xafe4('0x1e')]);_0x4d303d['offset']=qs[_0xafe4('0x1d')](_0xf7f857[_0xafe4('0x33')]['offset']);}_0x4d303d[_0xafe4('0x3b')]=qs[_0xafe4('0x3c')](_0xf7f857[_0xafe4('0x33')][_0xafe4('0x3c')]);_0x4d303d['where']=qs[_0xafe4('0x35')](_[_0xafe4('0x3d')](_0xf7f857[_0xafe4('0x33')],_0x562a2f[_0xafe4('0x35')]),_0x5088a6);if(_0xf7f857[_0xafe4('0x33')]['filter']){_0x4d303d[_0xafe4('0x3e')]=_[_0xafe4('0x3f')](_0x4d303d[_0xafe4('0x3e')],{'$or':_[_0xafe4('0x2e')](_0x5088a6,function(_0x5b344c){if(_0x5b344c[_0xafe4('0x31')]!==_0xafe4('0x40')){var _0x27df8c={};_0x27df8c[_0x5b344c[_0xafe4('0x2b')]]={'$like':'%'+_0xf7f857[_0xafe4('0x33')][_0xafe4('0x41')]+'%'};return _0x27df8c;}})});}_0x4d303d=_[_0xafe4('0x3f')]({},_0x4d303d,_0xf7f857[_0xafe4('0x42')]);var _0x41d9dd={'where':_0x4d303d[_0xafe4('0x3e')]};return db[_0xafe4('0x2f')]['count'](_0x41d9dd)[_0xafe4('0x26')](function(_0x5f31cc){_0x5b2647['count']=_0x5f31cc;if(_0xf7f857[_0xafe4('0x33')][_0xafe4('0x43')]){_0x4d303d[_0xafe4('0x44')]=[{'all':!![]}];}return db['SmsApplication'][_0xafe4('0x45')](_0x4d303d);})[_0xafe4('0x26')](function(_0xf8790e){_0x5b2647['rows']=_0xf8790e;return _0x5b2647;})['then'](respondWithFilteredResult(_0x2c7845,_0x4d303d))[_0xafe4('0x46')](handleError(_0x2c7845,null));};exports[_0xafe4('0x47')]=function(_0x2128c0,_0x428d57){var _0x3516c6={'raw':!![],'where':{'id':_0x2128c0[_0xafe4('0x48')]['id']}},_0x5f36c7={};_0x5f36c7[_0xafe4('0x37')]=_[_0xafe4('0x34')](db[_0xafe4('0x2f')]['rawAttributes']);_0x5f36c7[_0xafe4('0x33')]=_[_0xafe4('0x34')](_0x2128c0[_0xafe4('0x33')]);_0x5f36c7[_0xafe4('0x35')]=_[_0xafe4('0x36')](_0x5f36c7['model'],_0x5f36c7['query']);_0x3516c6[_0xafe4('0x38')]=_[_0xafe4('0x36')](_0x5f36c7['model'],qs[_0xafe4('0x39')](_0x2128c0['query'][_0xafe4('0x39')]));_0x3516c6[_0xafe4('0x38')]=_0x3516c6[_0xafe4('0x38')]['length']?_0x3516c6[_0xafe4('0x38')]:_0x5f36c7['model'];if(_0x2128c0['query'][_0xafe4('0x43')]){_0x3516c6[_0xafe4('0x44')]=[{'all':!![]}];}_0x3516c6=_[_0xafe4('0x3f')]({},_0x3516c6,_0x2128c0[_0xafe4('0x42')]);return db['SmsApplication'][_0xafe4('0x49')](_0x3516c6)[_0xafe4('0x26')](handleEntityNotFound(_0x428d57,null))[_0xafe4('0x26')](respondWithResult(_0x428d57,null))[_0xafe4('0x46')](handleError(_0x428d57,null));};exports[_0xafe4('0x4a')]=function(_0x5a858f,_0x6b4cd0){return db[_0xafe4('0x2f')][_0xafe4('0x4a')](_0x5a858f[_0xafe4('0x4b')],{})[_0xafe4('0x26')](respondWithResult(_0x6b4cd0,0xc9))['catch'](handleError(_0x6b4cd0,null));};exports[_0xafe4('0x4c')]=function(_0xb210c8,_0x519df0){if(_0xb210c8[_0xafe4('0x4b')]['id']){delete _0xb210c8[_0xafe4('0x4b')]['id'];}return db['SmsApplication'][_0xafe4('0x49')]({'where':{'id':_0xb210c8[_0xafe4('0x48')]['id']}})[_0xafe4('0x26')](handleEntityNotFound(_0x519df0,null))[_0xafe4('0x26')](saveUpdates(_0xb210c8[_0xafe4('0x4b')],null))[_0xafe4('0x26')](respondWithResult(_0x519df0,null))[_0xafe4('0x46')](handleError(_0x519df0,null));};exports['destroy']=function(_0x50bfd5,_0x1ca9c9){return db[_0xafe4('0x2f')][_0xafe4('0x49')]({'where':{'id':_0x50bfd5[_0xafe4('0x48')]['id']}})[_0xafe4('0x26')](handleEntityNotFound(_0x1ca9c9,null))[_0xafe4('0x26')](removeEntity(_0x1ca9c9,null))[_0xafe4('0x46')](handleError(_0x1ca9c9,null));}; \ No newline at end of file +var _0xb1df=['querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','count','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','SmsApplication','include','findAll','catch','show','rawAttributes','find','create','body','update','params','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x1f59ff,_0x18ce37){var _0x3d5726=function(_0x1d7a89){while(--_0x1d7a89){_0x1f59ff['push'](_0x1f59ff['shift']());}};_0x3d5726(++_0x18ce37);}(_0xb1df,0x1d0));var _0xfb1d=function(_0x1d1ffe,_0x4e0783){_0x1d1ffe=_0x1d1ffe-0x0;var _0x48db66=_0xb1df[_0x1d1ffe];return _0x48db66;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfb1d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb1d('0x1'));var rp=require(_0xfb1d('0x2'));var moment=require(_0xfb1d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfb1d('0x4'));var path=require(_0xfb1d('0x5'));var sox=require('sox');var csv=require(_0xfb1d('0x6'));var ejs=require(_0xfb1d('0x7'));var fs=require('fs');var fs_extra=require(_0xfb1d('0x8'));var _=require('lodash');var squel=require(_0xfb1d('0x9'));var crypto=require(_0xfb1d('0xa'));var jsforce=require(_0xfb1d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfb1d('0x6'));var querystring=require(_0xfb1d('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfb1d('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xfb1d('0xe'));var hardwareService=require(_0xfb1d('0xf'));var logger=require(_0xfb1d('0x10'))('api');var utils=require(_0xfb1d('0x11'));var config=require(_0xfb1d('0x12'));var licenseUtil=require(_0xfb1d('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d798d,_0x5c0fc3){_0x5c0fc3=_0x5c0fc3||0xcc;return function(_0x29be0f){if(_0x29be0f){return _0x1d798d[_0xfb1d('0x14')](_0x5c0fc3);}return _0x1d798d['status'](_0x5c0fc3)[_0xfb1d('0x15')]();};}function respondWithResult(_0x43406d,_0x4da682){_0x4da682=_0x4da682||0xc8;return function(_0x33399d){if(_0x33399d){return _0x43406d[_0xfb1d('0x16')](_0x4da682)[_0xfb1d('0x17')](_0x33399d);}};}function respondWithFilteredResult(_0x27ec24,_0x39d6da){return function(_0x3cfc7a){if(_0x3cfc7a){var _0x445654=typeof _0x39d6da[_0xfb1d('0x18')]==='undefined'&&typeof _0x39d6da['limit']==='undefined';var _0x1c3801=_0x3cfc7a['count'];var _0x2594dd=_0x445654?0x0:_0x39d6da[_0xfb1d('0x18')];var _0x26f86b=_0x445654?_0x3cfc7a[_0xfb1d('0x19')]:_0x39d6da[_0xfb1d('0x18')]+_0x39d6da[_0xfb1d('0x1a')];var _0x40526e;if(_0x26f86b>=_0x1c3801){_0x26f86b=_0x1c3801;_0x40526e=0xc8;}else{_0x40526e=0xce;}_0x27ec24[_0xfb1d('0x16')](_0x40526e);return _0x27ec24[_0xfb1d('0x1b')](_0xfb1d('0x1c'),_0x2594dd+'-'+_0x26f86b+'/'+_0x1c3801)[_0xfb1d('0x17')](_0x3cfc7a);}return null;};}function patchUpdates(_0x388bb4){return function(_0x5b3147){try{jsonpatch[_0xfb1d('0x1d')](_0x5b3147,_0x388bb4,!![]);}catch(_0x3d4bbc){return BPromise[_0xfb1d('0x1e')](_0x3d4bbc);}return _0x5b3147['save']();};}function saveUpdates(_0x5e70b5,_0xdc027d){return function(_0x56f550){if(_0x56f550){return _0x56f550['update'](_0x5e70b5)[_0xfb1d('0x1f')](function(_0x12a77f){return _0x12a77f;});}return null;};}function removeEntity(_0x19e1be,_0x2e25d0){return function(_0x39e914){if(_0x39e914){return _0x39e914[_0xfb1d('0x20')]()[_0xfb1d('0x1f')](function(){_0x19e1be[_0xfb1d('0x16')](0xcc)[_0xfb1d('0x15')]();});}};}function handleEntityNotFound(_0x2bcd9c,_0x64b6bd){return function(_0x32b9b4){if(!_0x32b9b4){_0x2bcd9c[_0xfb1d('0x14')](0x194);}return _0x32b9b4;};}function handleError(_0x50da22,_0x3a1787){_0x3a1787=_0x3a1787||0x1f4;return function(_0x2e6917){logger[_0xfb1d('0x21')](_0x2e6917[_0xfb1d('0x22')]);if(_0x2e6917[_0xfb1d('0x23')]){delete _0x2e6917[_0xfb1d('0x23')];}_0x50da22[_0xfb1d('0x16')](_0x3a1787)[_0xfb1d('0x24')](_0x2e6917);};}exports[_0xfb1d('0x25')]=function(_0x126a12,_0x3301aa){var _0x29ef8d={},_0x2d0910={},_0x52cd53={'count':0x0,'rows':[]};var _0x470ce5=_['map'](db['SmsApplication']['rawAttributes'],function(_0x48ab6a){return{'name':_0x48ab6a[_0xfb1d('0x26')],'type':_0x48ab6a[_0xfb1d('0x27')][_0xfb1d('0x28')]};});_0x2d0910[_0xfb1d('0x29')]=_[_0xfb1d('0x2a')](_0x470ce5,_0xfb1d('0x23'));_0x2d0910[_0xfb1d('0x2b')]=_[_0xfb1d('0x2c')](_0x126a12[_0xfb1d('0x2b')]);_0x2d0910['filters']=_['intersection'](_0x2d0910[_0xfb1d('0x29')],_0x2d0910[_0xfb1d('0x2b')]);_0x29ef8d[_0xfb1d('0x2d')]=_[_0xfb1d('0x2e')](_0x2d0910[_0xfb1d('0x29')],qs[_0xfb1d('0x2f')](_0x126a12[_0xfb1d('0x2b')][_0xfb1d('0x2f')]));_0x29ef8d['attributes']=_0x29ef8d[_0xfb1d('0x2d')][_0xfb1d('0x30')]?_0x29ef8d[_0xfb1d('0x2d')]:_0x2d0910[_0xfb1d('0x29')];if(!_0x126a12[_0xfb1d('0x2b')]['hasOwnProperty'](_0xfb1d('0x31'))){_0x29ef8d[_0xfb1d('0x1a')]=qs[_0xfb1d('0x1a')](_0x126a12['query']['limit']);_0x29ef8d['offset']=qs[_0xfb1d('0x18')](_0x126a12[_0xfb1d('0x2b')][_0xfb1d('0x18')]);}_0x29ef8d['order']=qs[_0xfb1d('0x32')](_0x126a12[_0xfb1d('0x2b')]['sort']);_0x29ef8d[_0xfb1d('0x33')]=qs[_0xfb1d('0x34')](_[_0xfb1d('0x35')](_0x126a12[_0xfb1d('0x2b')],_0x2d0910[_0xfb1d('0x34')]),_0x470ce5);if(_0x126a12[_0xfb1d('0x2b')][_0xfb1d('0x36')]){_0x29ef8d['where']=_['merge'](_0x29ef8d[_0xfb1d('0x33')],{'$or':_['map'](_0x470ce5,function(_0x238231){if(_0x238231['type']!==_0xfb1d('0x37')){var _0x2d293f={};_0x2d293f[_0x238231['name']]={'$like':'%'+_0x126a12[_0xfb1d('0x2b')][_0xfb1d('0x36')]+'%'};return _0x2d293f;}})});}_0x29ef8d=_[_0xfb1d('0x38')]({},_0x29ef8d,_0x126a12['options']);var _0x1bf0b0={'where':_0x29ef8d['where']};return db[_0xfb1d('0x39')][_0xfb1d('0x19')](_0x1bf0b0)['then'](function(_0x4e179f){_0x52cd53[_0xfb1d('0x19')]=_0x4e179f;if(_0x126a12[_0xfb1d('0x2b')]['includeAll']){_0x29ef8d[_0xfb1d('0x3a')]=[{'all':!![]}];}return db[_0xfb1d('0x39')][_0xfb1d('0x3b')](_0x29ef8d);})['then'](function(_0x3359c1){_0x52cd53['rows']=_0x3359c1;return _0x52cd53;})[_0xfb1d('0x1f')](respondWithFilteredResult(_0x3301aa,_0x29ef8d))[_0xfb1d('0x3c')](handleError(_0x3301aa,null));};exports[_0xfb1d('0x3d')]=function(_0x50321b,_0x2d1253){var _0x30b4d3={'raw':!![],'where':{'id':_0x50321b['params']['id']}},_0x21dc44={};_0x21dc44[_0xfb1d('0x29')]=_['keys'](db[_0xfb1d('0x39')][_0xfb1d('0x3e')]);_0x21dc44['query']=_[_0xfb1d('0x2c')](_0x50321b[_0xfb1d('0x2b')]);_0x21dc44[_0xfb1d('0x34')]=_[_0xfb1d('0x2e')](_0x21dc44['model'],_0x21dc44[_0xfb1d('0x2b')]);_0x30b4d3['attributes']=_['intersection'](_0x21dc44['model'],qs[_0xfb1d('0x2f')](_0x50321b['query'][_0xfb1d('0x2f')]));_0x30b4d3['attributes']=_0x30b4d3[_0xfb1d('0x2d')][_0xfb1d('0x30')]?_0x30b4d3[_0xfb1d('0x2d')]:_0x21dc44['model'];if(_0x50321b['query']['includeAll']){_0x30b4d3['include']=[{'all':!![]}];}_0x30b4d3=_[_0xfb1d('0x38')]({},_0x30b4d3,_0x50321b['options']);return db[_0xfb1d('0x39')][_0xfb1d('0x3f')](_0x30b4d3)[_0xfb1d('0x1f')](handleEntityNotFound(_0x2d1253,null))['then'](respondWithResult(_0x2d1253,null))[_0xfb1d('0x3c')](handleError(_0x2d1253,null));};exports[_0xfb1d('0x40')]=function(_0x4a7546,_0x52322a){return db[_0xfb1d('0x39')][_0xfb1d('0x40')](_0x4a7546[_0xfb1d('0x41')],{})[_0xfb1d('0x1f')](respondWithResult(_0x52322a,0xc9))[_0xfb1d('0x3c')](handleError(_0x52322a,null));};exports[_0xfb1d('0x42')]=function(_0x38b3db,_0x36e680){if(_0x38b3db[_0xfb1d('0x41')]['id']){delete _0x38b3db[_0xfb1d('0x41')]['id'];}return db[_0xfb1d('0x39')][_0xfb1d('0x3f')]({'where':{'id':_0x38b3db[_0xfb1d('0x43')]['id']}})[_0xfb1d('0x1f')](handleEntityNotFound(_0x36e680,null))['then'](saveUpdates(_0x38b3db[_0xfb1d('0x41')],null))[_0xfb1d('0x1f')](respondWithResult(_0x36e680,null))['catch'](handleError(_0x36e680,null));};exports[_0xfb1d('0x20')]=function(_0x4f57e0,_0x103808){return db[_0xfb1d('0x39')][_0xfb1d('0x3f')]({'where':{'id':_0x4f57e0[_0xfb1d('0x43')]['id']}})[_0xfb1d('0x1f')](handleEntityNotFound(_0x103808,null))['then'](removeEntity(_0x103808,null))[_0xfb1d('0x3c')](handleError(_0x103808,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 424ba22..5324750 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 _0x27c5=['define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes'];(function(_0x20bb79,_0x377d86){var _0x3c65a9=function(_0x36c3d2){while(--_0x36c3d2){_0x20bb79['push'](_0x20bb79['shift']());}};_0x3c65a9(++_0x377d86);}(_0x27c5,0xa0));var _0x527c=function(_0x26e312,_0x4c0fed){_0x26e312=_0x26e312-0x0;var _0x3d73ce=_0x27c5[_0x26e312];return _0x3d73ce;};'use strict';var _=require(_0x527c('0x0'));var util=require('util');var logger=require(_0x527c('0x1'))(_0x527c('0x2'));var moment=require('moment');var BPromise=require(_0x527c('0x3'));var rp=require(_0x527c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x527c('0x5'));var config=require(_0x527c('0x6'));var attributes=require(_0x527c('0x7'));module['exports']=function(_0x5d1d1c,_0x5e1fd2){return _0x5d1d1c[_0x527c('0x8')](_0x527c('0x9'),attributes,{'tableName':_0x527c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x527c('0xb')});}; \ No newline at end of file +var _0x579f=['SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define'];(function(_0x3071ab,_0x574a59){var _0x2f458c=function(_0x1eb9c7){while(--_0x1eb9c7){_0x3071ab['push'](_0x3071ab['shift']());}};_0x2f458c(++_0x574a59);}(_0x579f,0x14d));var _0xf579=function(_0x351a22,_0x233ac0){_0x351a22=_0x351a22-0x0;var _0x1a873d=_0x579f[_0x351a22];return _0x1a873d;};'use strict';var _=require(_0xf579('0x0'));var util=require(_0xf579('0x1'));var logger=require('../../config/logger')(_0xf579('0x2'));var moment=require(_0xf579('0x3'));var BPromise=require(_0xf579('0x4'));var rp=require(_0xf579('0x5'));var fs=require('fs');var path=require(_0xf579('0x6'));var rimraf=require(_0xf579('0x7'));var config=require(_0xf579('0x8'));var attributes=require(_0xf579('0x9'));module[_0xf579('0xa')]=function(_0x203fc1,_0x279b3b){return _0x203fc1[_0xf579('0xb')](_0xf579('0xc'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf579('0xd'),'collate':_0xf579('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index ebbf618..cddbab0 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 _0x01d3=['request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','SmsApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x4f75b5,_0x4db76d){var _0x5c263b=function(_0x31e622){while(--_0x31e622){_0x4f75b5['push'](_0x4f75b5['shift']());}};_0x5c263b(++_0x4db76d);}(_0x01d3,0xa2));var _0x301d=function(_0xa59fa5,_0x421eb9){_0xa59fa5=_0xa59fa5-0x0;var _0x2ecef2=_0x01d3[_0xa59fa5];return _0x2ecef2;};'use strict';var _=require(_0x301d('0x0'));var util=require(_0x301d('0x1'));var moment=require(_0x301d('0x2'));var BPromise=require(_0x301d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x301d('0x4'));var db=require(_0x301d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x301d('0x6'))(_0x301d('0x7'));var config=require(_0x301d('0x8'));var jayson=require(_0x301d('0x9'));var client=jayson['client'][_0x301d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d8fc2,_0xe2b2d8,_0x3bbbde){return new BPromise(function(_0x35e760,_0x3ba019){return client[_0x301d('0xb')](_0x2d8fc2,_0x3bbbde)[_0x301d('0xc')](function(_0x35ae14){logger[_0x301d('0xd')]('SmsApplication,\x20%s,\x20%s',_0xe2b2d8,_0x301d('0xe'));logger[_0x301d('0xf')](_0x301d('0x10'),_0xe2b2d8,'request\x20sent',JSON[_0x301d('0x11')](_0x35ae14));if(_0x35ae14[_0x301d('0x12')]){if(_0x35ae14['error']['code']===0x1f4){logger['error'](_0x301d('0x13'),_0xe2b2d8,_0x35ae14[_0x301d('0x12')][_0x301d('0x14')]);return _0x3ba019(_0x35ae14[_0x301d('0x12')][_0x301d('0x14')]);}logger[_0x301d('0x12')](_0x301d('0x13'),_0xe2b2d8,_0x35ae14['error']['message']);return _0x35e760(_0x35ae14[_0x301d('0x12')][_0x301d('0x14')]);}else{logger[_0x301d('0xd')]('SmsApplication,\x20%s,\x20%s',_0xe2b2d8,'request\x20sent');_0x35e760(_0x35ae14['result']['message']);}})[_0x301d('0x15')](function(_0x3deffb){logger[_0x301d('0x12')](_0x301d('0x13'),_0xe2b2d8,_0x3deffb);_0x3ba019(_0x3deffb);});});} \ No newline at end of file +var _0x56b9=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3c7f1d,_0x44b37b){var _0xd7ab0c=function(_0x1dd6b2){while(--_0x1dd6b2){_0x3c7f1d['push'](_0x3c7f1d['shift']());}};_0xd7ab0c(++_0x44b37b);}(_0x56b9,0x196));var _0x956b=function(_0x238fae,_0x5608f7){_0x238fae=_0x238fae-0x0;var _0x5f3211=_0x56b9[_0x238fae];return _0x5f3211;};'use strict';var _=require(_0x956b('0x0'));var util=require(_0x956b('0x1'));var moment=require(_0x956b('0x2'));var BPromise=require(_0x956b('0x3'));var rs=require(_0x956b('0x4'));var fs=require('fs');var Redis=require(_0x956b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x956b('0x6'));var logger=require('../../config/logger')(_0x956b('0x7'));var config=require(_0x956b('0x8'));var jayson=require(_0x956b('0x9'));var client=jayson['client'][_0x956b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d40b0,_0x322012,_0x2683d8){return new BPromise(function(_0x222eae,_0x299c94){return client[_0x956b('0xb')](_0x3d40b0,_0x2683d8)[_0x956b('0xc')](function(_0x5e0388){logger[_0x956b('0xd')](_0x956b('0xe'),_0x322012,'request\x20sent');logger[_0x956b('0xf')](_0x956b('0x10'),_0x322012,_0x956b('0x11'),JSON[_0x956b('0x12')](_0x5e0388));if(_0x5e0388[_0x956b('0x13')]){if(_0x5e0388['error'][_0x956b('0x14')]===0x1f4){logger[_0x956b('0x13')](_0x956b('0xe'),_0x322012,_0x5e0388[_0x956b('0x13')][_0x956b('0x15')]);return _0x299c94(_0x5e0388[_0x956b('0x13')][_0x956b('0x15')]);}logger[_0x956b('0x13')](_0x956b('0xe'),_0x322012,_0x5e0388[_0x956b('0x13')][_0x956b('0x15')]);return _0x222eae(_0x5e0388['error'][_0x956b('0x15')]);}else{logger[_0x956b('0xd')](_0x956b('0xe'),_0x322012,'request\x20sent');_0x222eae(_0x5e0388[_0x956b('0x16')][_0x956b('0x15')]);}})[_0x956b('0x17')](function(_0x3cc1b7){logger[_0x956b('0x13')](_0x956b('0xe'),_0x322012,_0x3cc1b7);_0x299c94(_0x3cc1b7);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index aa207ad..ed2a5f2 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 _0xea28=['put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','create','post','tracked','sms','smsinteraction:addtags','addTags'];(function(_0x329f20,_0x31c2e5){var _0x45f285=function(_0x46a695){while(--_0x46a695){_0x329f20['push'](_0x329f20['shift']());}};_0x45f285(++_0x31c2e5);}(_0xea28,0x13a));var _0x8ea2=function(_0x159c4a,_0x2c11a5){_0x159c4a=_0x159c4a-0x0;var _0x5309e3=_0xea28[_0x159c4a];return _0x5309e3;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getMessages']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['post']('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x14')]);router[_0x8ea2('0x15')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['addMessage']);router[_0x8ea2('0x15')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x18')),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1b')),controller[_0x8ea2('0x1c')]);router[_0x8ea2('0x1d')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1e')),controller[_0x8ea2('0x1f')]);router[_0x8ea2('0x1d')](_0x8ea2('0x20'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x21')]);module['exports']=router; \ No newline at end of file +var _0x955f=['fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express'];(function(_0x4d2a1a,_0xd32232){var _0x11b4fd=function(_0x1a636a){while(--_0x1a636a){_0x4d2a1a['push'](_0x4d2a1a['shift']());}};_0x11b4fd(++_0xd32232);}(_0x955f,0x1eb));var _0xf955=function(_0x306f1c,_0x4ddb51){_0x306f1c=_0x306f1c-0x0;var _0x16b5eb=_0x955f[_0x306f1c];return _0x16b5eb;};'use strict';var multer=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var path=require(_0xf955('0x2'));var timeout=require(_0xf955('0x3'));var express=require(_0xf955('0x4'));var router=express['Router']();var fs_extra=require(_0xf955('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf955('0x6'));var controller=require('./smsInteraction.controller');router[_0xf955('0x7')]('/',auth[_0xf955('0x8')](),controller[_0xf955('0x9')]);router['get'](_0xf955('0xa'),auth[_0xf955('0x8')](),controller['describe']);router[_0xf955('0x7')](_0xf955('0xb'),auth[_0xf955('0x8')](),controller[_0xf955('0xc')]);router[_0xf955('0x7')](_0xf955('0xd'),auth[_0xf955('0x8')](),controller['getMessages']);router[_0xf955('0x7')]('/:id/download',auth[_0xf955('0x8')](),controller[_0xf955('0xe')]);router[_0xf955('0xf')]('/',auth['isAuthenticated'](),controller[_0xf955('0x10')]);router['post'](_0xf955('0xd'),auth['isAuthenticated'](),controller[_0xf955('0x11')]);router[_0xf955('0xf')](_0xf955('0x12'),auth[_0xf955('0x8')](),interaction[_0xf955('0x13')](_0xf955('0x14'),_0xf955('0x15')),controller[_0xf955('0x16')]);router[_0xf955('0x17')](_0xf955('0xb'),auth['isAuthenticated'](),interaction[_0xf955('0x13')]('sms',_0xf955('0x18')),controller[_0xf955('0x19')]);router[_0xf955('0x1a')](_0xf955('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0xf955('0x14'),_0xf955('0x1b')),controller[_0xf955('0x1c')]);router['delete'](_0xf955('0x12'),auth[_0xf955('0x8')](),controller[_0xf955('0x1d')]);module[_0xf955('0x1e')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 1f63f43..f8d9496 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 _0xf52f=['ENUM','out','BOOLEAN','sequelize','moment','exports','DATE','STRING'];(function(_0x2757fc,_0xfbd23){var _0x58efc4=function(_0x3a9f1e){while(--_0x3a9f1e){_0x2757fc['push'](_0x2757fc['shift']());}};_0x58efc4(++_0xfbd23);}(_0xf52f,0x113));var _0xff52=function(_0xd5dd0,_0x1216b2){_0xd5dd0=_0xd5dd0-0x0;var _0xfc087b=_0xf52f[_0xd5dd0];return _0xfc087b;};'use strict';var Sequelize=require(_0xff52('0x0'));var moment=require(_0xff52('0x1'));module[_0xff52('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xff52('0x3')]},'disposition':{'type':Sequelize[_0xff52('0x4')]},'secondDisposition':{'type':Sequelize[_0xff52('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xff52('0x4')]},'phone':{'type':Sequelize[_0xff52('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xff52('0x5')]('in',_0xff52('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xff52('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xff52('0x5')]('in',_0xff52('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xff52('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xac4f=['ENUM','out','BOOLEAN','sequelize','exports','DATE','STRING'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xac4f,0x122));var _0xfac4=function(_0x310990,_0x245984){_0x310990=_0x310990-0x0;var _0x648534=_0xac4f[_0x310990];return _0x648534;};'use strict';var Sequelize=require(_0xfac4('0x0'));var moment=require('moment');module[_0xfac4('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfac4('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xfac4('0x3')]},'note':{'type':Sequelize[_0xfac4('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xfac4('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xfac4('0x4')]('in',_0xfac4('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfac4('0x4')]('in',_0xfac4('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfac4('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 7d5f90f..6928c41 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 _0x2794=['SmsMessage','pick','SmsInteractionId','filter','merge','options','findAll','setTags','emit','smsInteractionTags:save','removeTags','download','unix','join','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','fullname','firstName','lastName','Messages','direction','secret','SmsAccount','get','mkdirSync','Sms','Account','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','out','renderFile','downloadInteraction.ejs','.pdf','createPdfFromHTML','unlinkSync','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','end','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','Users','Tags','TagIds','split','forEach','waiting','talking','answered','total','closed','UserId','map','SmsInteraction','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','field','color','tools_tags','select','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','users','from','sms_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','type','body','some','compact','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','tag','isArray','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','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','i.SmsAccountId\x20IS\x20NULL','role','sequelize','toString','count','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.lastName','Contact.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','all','rows','catch','show','includeAll','include','create','params','addMessage','omit','ids','getMessages','findOne'];(function(_0x45804b,_0x38905e){var _0x538282=function(_0xdfa594){while(--_0xdfa594){_0x45804b['push'](_0x45804b['shift']());}};_0x538282(++_0x38905e);}(_0x2794,0x111));var _0x4279=function(_0x55be16,_0x108bf4){_0x55be16=_0x55be16-0x0;var _0x2e96c6=_0x2794[_0x55be16];return _0x2e96c6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4279('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4279('0x1'));var rp=require(_0x4279('0x2'));var moment=require('moment');var BPromise=require(_0x4279('0x3'));var Mustache=require(_0x4279('0x4'));var util=require(_0x4279('0x5'));var path=require(_0x4279('0x6'));var sox=require(_0x4279('0x7'));var csv=require(_0x4279('0x8'));var ejs=require(_0x4279('0x9'));var fs=require('fs');var fs_extra=require(_0x4279('0xa'));var _=require(_0x4279('0xb'));var squel=require(_0x4279('0xc'));var crypto=require(_0x4279('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4279('0xe'));var toCsv=require(_0x4279('0x8'));var querystring=require(_0x4279('0xf'));var Papa=require(_0x4279('0x10'));var Redis=require(_0x4279('0x11'));var authService=require(_0x4279('0x12'));var qs=require(_0x4279('0x13'));var as=require(_0x4279('0x14'));var pdf=require(_0x4279('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4279('0x16'));var config=require(_0x4279('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x4279('0x18')](config[_0x4279('0x19')],{'host':_0x4279('0x1a'),'port':0x18eb});var socket=require(_0x4279('0x1b'))(new Redis(config['redis']));require(_0x4279('0x1c'))['register'](socket);function respondWithStatusCode(_0x246689,_0x373dd0){_0x373dd0=_0x373dd0||0xcc;return function(_0x59f1b2){if(_0x59f1b2){return _0x246689['sendStatus'](_0x373dd0);}return _0x246689['status'](_0x373dd0)[_0x4279('0x1d')]();};}function respondWithResult(_0x3d5995,_0x341e2b){_0x341e2b=_0x341e2b||0xc8;return function(_0x2a30d1){if(_0x2a30d1){return _0x3d5995[_0x4279('0x1e')](_0x341e2b)['json'](_0x2a30d1);}};}function respondWithFilteredResult(_0x2edd8b,_0x294d8c){return function(_0x6827a4){if(_0x6827a4){var _0x129472=typeof _0x294d8c[_0x4279('0x1f')]===_0x4279('0x20')&&typeof _0x294d8c[_0x4279('0x21')]===_0x4279('0x20');var _0x3d2f33=_0x6827a4['count'];var _0x33f1ed=_0x129472?0x0:_0x294d8c['offset'];var _0x1fe618=_0x129472?_0x6827a4['count']:_0x294d8c['offset']+_0x294d8c['limit'];var _0x305b85;if(_0x1fe618>=_0x3d2f33){_0x1fe618=_0x3d2f33;_0x305b85=0xc8;}else{_0x305b85=0xce;}_0x2edd8b[_0x4279('0x1e')](_0x305b85);return _0x2edd8b[_0x4279('0x22')](_0x4279('0x23'),_0x33f1ed+'-'+_0x1fe618+'/'+_0x3d2f33)[_0x4279('0x24')](_0x6827a4);}return null;};}function patchUpdates(_0x1c728f){return function(_0x222fac){try{jsonpatch[_0x4279('0x25')](_0x222fac,_0x1c728f,!![]);}catch(_0x4179e9){return BPromise[_0x4279('0x26')](_0x4179e9);}return _0x222fac[_0x4279('0x27')]();};}function saveUpdates(_0xdfe498,_0x1c4246){return function(_0x3df160){if(_0x3df160){return _0x3df160[_0x4279('0x28')](_0xdfe498)['then'](function(_0x46b16b){return _0x46b16b;});}return null;};}function removeEntity(_0x208822,_0x8e8823){return function(_0x2b71ee){if(_0x2b71ee){return _0x2b71ee[_0x4279('0x29')]()[_0x4279('0x2a')](function(){_0x208822[_0x4279('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xff9e8b,_0x5aaf46){return function(_0x3ddffb){if(!_0x3ddffb){_0xff9e8b[_0x4279('0x2b')](0x194);}return _0x3ddffb;};}function handleError(_0x18c45e,_0x1908d8){_0x1908d8=_0x1908d8||0x1f4;return function(_0xf2c349){logger[_0x4279('0x2c')](_0xf2c349[_0x4279('0x2d')]);if(_0xf2c349[_0x4279('0x2e')]){delete _0xf2c349[_0x4279('0x2e')];}_0x18c45e['status'](_0x1908d8)['send'](_0xf2c349);};}function getInteractionUsers(_0x247872,_0x2de646){return new BPromise(function(_0xfe1278,_0x12e296){try{if(_0x2de646[_0x247872['id']]){_0x247872[_0x4279('0x2f')]=_['map'](_0x2de646[_0x247872['id']],function(_0xbfd11d){return{'id':_0xbfd11d['id'],'fullname':_0xbfd11d['fullname']};});}}catch(_0x826859){_0x12e296(_0x826859);}_0xfe1278(_0x247872);});}function getInteractionTags(_0x1b33e8,_0x38dd9d){return new BPromise(function(_0x49360d,_0x416535){try{if(_0x1b33e8['TagIds']){_0x1b33e8[_0x4279('0x30')]=[];_0x1b33e8[_0x4279('0x31')][_0x4279('0x32')](',')[_0x4279('0x33')](function(_0x2f934b){_0x1b33e8[_0x4279('0x30')]['push'](_0x38dd9d[_0x2f934b]);});}delete _0x1b33e8[_0x4279('0x31')];}catch(_0x52e56a){_0x416535(_0x52e56a);}_0x49360d(_0x1b33e8);});}function updateSmsInteraction(_0x515c0e,_0x4ba0cd,_0x240b8e){return new BPromise(function(_0x3ad981,_0x2f65b6){return getInteractionUsers(_0x515c0e,_0x240b8e)[_0x4279('0x2a')](function(_0x52ee59){return getInteractionTags(_0x52ee59,_0x4ba0cd);})[_0x4279('0x2a')](function(_0x21fdce){return getStateInteraction(_0x21fdce);})[_0x4279('0x2a')](function(_0x309409){_0x3ad981(_0x309409);})['catch'](function(_0xb97ffc){_0x2f65b6(_0xb97ffc);});});}function getStateInteraction(_0x1ee258){return new BPromise(function(_0x4c974a){_0x1ee258[_0x4279('0x34')]=0x0;_0x1ee258[_0x4279('0x35')]=0x0;_0x1ee258[_0x4279('0x36')]=0x0;_0x1ee258['unmanaged']=0x0;_0x1ee258[_0x4279('0x37')]=0x0;if(!_0x1ee258[_0x4279('0x38')]&&!_0x1ee258['UserId']){_0x1ee258[_0x4279('0x34')]+=0x1;}if(!_0x1ee258[_0x4279('0x38')]&&_0x1ee258[_0x4279('0x39')]){_0x1ee258['talking']+=0x1;if(_0x1ee258[_0x4279('0x34')]){_0x1ee258['waiting']-=0x1;}}if(_0x1ee258[_0x4279('0x38')]&&_0x1ee258[_0x4279('0x39')]){_0x1ee258[_0x4279('0x36')]+=0x1;if(_0x1ee258['talking']){_0x1ee258[_0x4279('0x35')]-=0x1;}}if(_0x1ee258[_0x4279('0x38')]&&!_0x1ee258['UserId']){_0x1ee258['unmanaged']+=0x1;if(_0x1ee258[_0x4279('0x34')]){_0x1ee258['waiting']-=0x1;}}_0x1ee258['total']+=0x1;_0x4c974a(_0x1ee258);});}exports['index']=function(_0x214a58,_0x2ffec0){var _0x480193={},_0x135a34={},_0x2e2e82={'count':0x0,'rows':[]};var _0x57b744=_[_0x4279('0x3a')](db[_0x4279('0x3b')][_0x4279('0x3c')],function(_0x2724c3){return{'name':_0x2724c3[_0x4279('0x3d')],'type':_0x2724c3['type']['key']};});_0x135a34[_0x4279('0x3e')]=_['map'](_0x57b744,_0x4279('0x2e'));_0x135a34[_0x4279('0x3f')]=_[_0x4279('0x40')](_0x214a58['query']);_0x135a34[_0x4279('0x41')]=_[_0x4279('0x42')](_0x135a34[_0x4279('0x3e')],_0x135a34[_0x4279('0x3f')]);_0x480193[_0x4279('0x43')]=_[_0x4279('0x42')](_0x135a34['model'],qs[_0x4279('0x44')](_0x214a58[_0x4279('0x3f')][_0x4279('0x44')]));_0x480193[_0x4279('0x43')]=_0x480193[_0x4279('0x43')][_0x4279('0x45')]?_0x480193[_0x4279('0x43')]:_0x135a34[_0x4279('0x3e')];if(!_0x214a58['query']['hasOwnProperty'](_0x4279('0x46'))){_0x480193[_0x4279('0x21')]=qs[_0x4279('0x21')](_0x214a58['query'][_0x4279('0x21')]);_0x480193[_0x4279('0x1f')]=qs[_0x4279('0x1f')](_0x214a58[_0x4279('0x3f')][_0x4279('0x1f')]);}_0x480193[_0x4279('0x47')]=qs[_0x4279('0x48')](_0x214a58[_0x4279('0x3f')][_0x4279('0x48')]);_0x480193[_0x4279('0x49')]=qs[_0x4279('0x41')](_['pick'](_0x214a58[_0x4279('0x3f')],_0x135a34[_0x4279('0x41')]),_0x57b744);var _0x55bf9a=[];var _0x470042=squel['select']()[_0x4279('0x4a')]('id')[_0x4279('0x4a')](_0x4279('0x2e'))['field'](_0x4279('0x4b'))['from'](_0x4279('0x4c'));var _0x462e42=squel[_0x4279('0x4d')]()[_0x4279('0x4a')](_0x4279('0x4e'))['field'](_0x4279('0x4f'))['field'](_0x4279('0x50'))['from'](_0x4279('0x51'),'ui')['left_join'](_0x4279('0x52'),'u','u.id\x20=\x20ui.UserId');var _0x42a4b3=squel[_0x4279('0x4d')]()[_0x4279('0x53')](_0x4279('0x54'),'i')[_0x4279('0x55')](_0x4279('0x56'),'c',_0x4279('0x57'))[_0x4279('0x55')](_0x4279('0x52'),'o','o.id\x20=\x20i.UserId')[_0x4279('0x55')]('sms_accounts','a',_0x4279('0x58'))[_0x4279('0x55')](_0x4279('0x59'),'me',_0x4279('0x5a'))[_0x4279('0x55')]('sms_interaction_has_tags','it',_0x4279('0x5b'))['left_join'](_0x4279('0x4c'),'t','t.id\x20=\x20it.TagId');var _0x36294c=squel[_0x4279('0x5c')]();var _0x51fc77=[];var _0x18f63f=squel[_0x4279('0x5c')]();var _0x5c5cc8;if(_0x214a58['query']['search']){_0x5c5cc8=as[_0x4279('0x5d')](_0x214a58['query']['search']);var _0x280898=_0x5c5cc8[_0x4279('0x5e')];for(var _0x410924=0x0;_0x410924<_0x5c5cc8[_0x4279('0x5f')]['length'];_0x410924++){var _0x5f5878=_0x5c5cc8['conditions'][_0x410924];var _0x519e2d='i';var _0x4d5f0c=_[_0x4279('0x60')](_0x57b744,['name',_0x5f5878[_0x4279('0x4a')]]);if(!_0x4d5f0c){switch(_0x5f5878[_0x4279('0x4a')]){case _0x4279('0x61'):if(_0x5f5878['value']==0x1){_0x42a4b3[_0x4279('0x62')]('`'+_0x5f5878[_0x4279('0x4a')]+'`\x20=\x200');}else{_0x42a4b3['having']('`'+_0x5f5878[_0x4279('0x4a')]+_0x4279('0x63'));}break;case _0x4279('0x64'):if(_0x5f5878[_0x4279('0x65')]===_0x4279('0x66')){if(_0x5f5878[_0x4279('0x67')][_0x4279('0x32')]('\x20')[_0x4279('0x45')]>0x1){_0x36294c[_0x280898](_0x4279('0x68'),qs[_0x4279('0x69')](_0x5f5878[_0x4279('0x67')]),null);}else{var _0x2ddae2='%'+_0x5f5878[_0x4279('0x67')]+'%';_0x36294c[_0x280898](_0x4279('0x6a'),_0x2ddae2,_0x2ddae2,_0x2ddae2);}}else{_0x4d5f0c=_[_0x4279('0x60')](_0x57b744,[_0x4279('0x2e'),_0x4279('0x6b')]);_0x5f5878[_0x4279('0x4a')]=_0x4279('0x6b');_0x1a2437=as[_0x4279('0x6c')](_0x519e2d,_0x4d5f0c['type'],_0x5f5878);_0x36294c[_0x280898](_0x1a2437[_0x4279('0x6d')],_0x1a2437[_0x4279('0x67')][_0x4279('0x6e')],_0x1a2437[_0x4279('0x67')][_0x4279('0x1d')]);}break;case _0x4279('0x6f'):var _0x292d5b=_0x5f5878['value'][_0x4279('0x32')](',')[_0x4279('0x3a')](function(_0x116fd7){return Number(_0x116fd7);});_0x292d5b[_0x4279('0x33')](function(_0x3a20f2){_0x18f63f['or'](_0x4279('0x70'),'%,'+_0x3a20f2+',%');});_0x51fc77=_[_0x4279('0x71')](_0x51fc77,_0x292d5b);break;case _0x4279('0x72'):if(_0x5f5878[_0x4279('0x65')]===_0x4279('0x66')){_0x36294c[_0x280898](_0x4279('0x73'),'%'+_0x5f5878[_0x4279('0x67')]+'%',null);}else{_0x4d5f0c=_[_0x4279('0x60')](_0x57b744,[_0x4279('0x2e'),_0x4279('0x39')]);_0x5f5878[_0x4279('0x4a')]=_0x4279('0x39');_0x1a2437=as[_0x4279('0x6c')](_0x519e2d,_0x4d5f0c[_0x4279('0x74')],_0x5f5878);_0x36294c[_0x280898](_0x1a2437[_0x4279('0x6d')],_0x1a2437[_0x4279('0x67')]['start'],_0x1a2437[_0x4279('0x67')]['end']);}break;case _0x4279('0x75'):_0x1a2437=as['buildExpression']('me',null,_0x5f5878);_0x36294c[_0x280898](_0x1a2437[_0x4279('0x6d')],_0x1a2437[_0x4279('0x67')]['start'],_0x1a2437[_0x4279('0x67')]['end']);break;}}else{var _0x1a2437=as['buildExpression'](_0x519e2d,_0x4d5f0c[_0x4279('0x74')],_0x5f5878);_0x36294c[_0x280898](_0x1a2437[_0x4279('0x6d')],_0x1a2437[_0x4279('0x67')][_0x4279('0x6e')],_0x1a2437[_0x4279('0x67')][_0x4279('0x1d')]);}}}else{var _0x448922=_(_0x214a58[_0x4279('0x3f')])[_0x4279('0x40')]()[_0x4279('0x3a')](function(_0x134c2d){return _[_0x4279('0x76')](_0x57b744,[_0x4279('0x2e'),_0x134c2d])?_0x134c2d:undefined;})[_0x4279('0x77')]()[_0x4279('0x67')]();if(!_['isEmpty'](_0x448922)){_0x448922[_0x4279('0x33')](function(_0x104de8){if(_0x104de8===_0x4279('0x78')){_0x42a4b3[_0x4279('0x49')](_0x4279('0x79'),[][_0x4279('0x7a')](_0x214a58['query'][_0x104de8]));}else if(_0x104de8===_0x4279('0x7b')){var _0x4ed7d=JSON[_0x4279('0x7c')](_0x214a58[_0x4279('0x3f')][_0x104de8])[_0x4279('0x7d')];var _0x4173f8=JSON[_0x4279('0x7c')](_0x214a58[_0x4279('0x3f')][_0x104de8])[_0x4279('0x7e')];_0x42a4b3['where'](_0x4279('0x7f'),_0x4ed7d,_0x4173f8);}else{if(_0x214a58[_0x4279('0x3f')][_0x104de8]==='null'){_0x42a4b3['where']('i.'+_0x104de8+_0x4279('0x80'));}else{_0x42a4b3[_0x4279('0x49')]('i.'+_0x104de8+_0x4279('0x81'),_0x214a58[_0x4279('0x3f')][_0x104de8]);}}});}if(_0x214a58[_0x4279('0x3f')][_0x4279('0x82')]){if(_0x214a58[_0x4279('0x3f')][_0x4279('0x82')]==0x1){_0x42a4b3[_0x4279('0x62')](_0x4279('0x83'));}else{_0x42a4b3[_0x4279('0x62')](_0x4279('0x84'));}}if(_0x214a58[_0x4279('0x3f')][_0x4279('0x85')]){_0x51fc77=_[_0x4279('0x86')](_0x214a58[_0x4279('0x3f')]['tag'])?_0x214a58[_0x4279('0x3f')][_0x4279('0x85')]:new Array(_0x214a58[_0x4279('0x3f')][_0x4279('0x85')]);_0x51fc77[_0x4279('0x33')](function(_0x1bccb4){_0x18f63f['or'](_0x4279('0x70'),'%,'+_0x1bccb4+',%');});}if(_0x214a58[_0x4279('0x3f')]['filter']){var _0x284fb1=_0x214a58[_0x4279('0x3f')]['filter']['replace']('\x5c','\x5c\x5c')[_0x4279('0x87')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x284fb1)){_0x36294c['or'](_0x4279('0x88'),_0x284fb1+'%')['or'](_0x4279('0x89'),_0x284fb1+'%');}else{_0x36294c['or'](_0x4279('0x8a'),qs['getFullTextValue'](_0x284fb1))['or'](_0x4279('0x8b'),_0x284fb1+'%');}}}_0x42a4b3[_0x4279('0x49')](_0x36294c);_0x42a4b3[_0x4279('0x8c')](_0x4279('0x8d'));var _0x23ac1c={'type':db[_0x4279('0x8e')][_0x4279('0x8f')]['SELECT'],'raw':!![]};var _0x47c74c=_0x42a4b3['clone']();_0x47c74c[_0x4279('0x4a')](_0x4279('0x8d'));_0x47c74c['field'](_0x4279('0x90'),'unreadMessages');if(_0x480193[_0x4279('0x47')]){_0x480193['order'][_0x4279('0x33')](function(_0xed15b3){var _0x55683f=_0xed15b3[0x0]===_0x4279('0x91')?_0xed15b3[0x0]:'i.'+_0xed15b3[0x0];_0x42a4b3['order'](_0x55683f,_0xed15b3[0x1]===_0x4279('0x92')?![]:!![]);});}if(!_[_0x4279('0x93')](_0x51fc77)){_0x42a4b3['having'](_0x18f63f);_0x47c74c[_0x4279('0x49')](_0x4279('0x94'),_0x51fc77);}BPromise[_0x4279('0x95')]()[_0x4279('0x2a')](function(){if(!_0x5c5cc8){if(_0x214a58[_0x4279('0x3f')]['SmsAccountId'])return;_0x47c74c[_0x4279('0x49')](_0x4279('0x96'));_0x42a4b3[_0x4279('0x49')](_0x4279('0x96'));return;}if(_0x214a58[_0x4279('0x97')]['role']!==_0x4279('0x98'))return;return _0x214a58[_0x4279('0x97')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x4279('0x2a')](function(_0x46f273){if(_[_0x4279('0x93')](_0x46f273)){_0x47c74c[_0x4279('0x49')](_0x4279('0x99'));_0x42a4b3['where'](_0x4279('0x99'));}else{_0x47c74c['where']('i.SmsAccountId\x20IN\x20?',_[_0x4279('0x3a')](_0x46f273,'id'));_0x42a4b3[_0x4279('0x49')](_0x4279('0x79'),_[_0x4279('0x3a')](_0x46f273,'id'));}});})[_0x4279('0x2a')](function(){if(_0x214a58['user'][_0x4279('0x9a')]==='agent'&&!_0x5c5cc8&&!_0x214a58[_0x4279('0x3f')][_0x4279('0x78')])return[];return db[_0x4279('0x9b')]['query'](_0x47c74c[_0x4279('0x9c')](),_0x23ac1c);})[_0x4279('0x2a')](function(_0x5b7673){_0x2e2e82[_0x4279('0x9d')]=_0x5b7673[_0x4279('0x45')];if(_0x2e2e82[_0x4279('0x9d')]===0x0)return[];return db['sequelize'][_0x4279('0x3f')](_0x470042[_0x4279('0x9c')](),_0x23ac1c)[_0x4279('0x2a')](function(_0x233b84){_0x55bf9a=_[_0x4279('0x9e')](_0x233b84,'id');_0x23ac1c=_['merge'](_0x23ac1c,{'model':db[_0x4279('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x214a58[_0x4279('0x3f')][_0x4279('0x44')]){_0x480193['attributes'][_0x4279('0x33')](function(_0x498f0c){_0x42a4b3[_0x4279('0x4a')]('i.'+_0x498f0c);});}else{_0x42a4b3['field'](_0x4279('0x90'),'unreadMessages');_0x42a4b3['field'](_0x4279('0x9f'),'Account.key');_0x42a4b3['field'](_0x4279('0xa0'),_0x4279('0xa1'));_0x42a4b3[_0x4279('0x4a')](_0x4279('0xa2'),_0x4279('0x91'));_0x42a4b3['field']('i.*');_0x42a4b3[_0x4279('0x4a')]('c.firstName','Contact.firstName');_0x42a4b3[_0x4279('0x4a')](_0x4279('0xa3'),_0x4279('0xa4'));_0x42a4b3['field'](_0x4279('0xa5'),'Contact.email');_0x42a4b3[_0x4279('0x4a')]('c.phone',_0x4279('0xa6'));_0x42a4b3['field'](_0x4279('0xa7'),_0x4279('0xa8'));_0x42a4b3[_0x4279('0x4a')]('c.fax',_0x4279('0xa9'));_0x42a4b3[_0x4279('0x4a')](_0x4279('0xaa'),'Owner.fullname');_0x42a4b3[_0x4279('0x4a')](_0x4279('0xab'),_0x4279('0xac'));_0x42a4b3[_0x4279('0x4a')](_0x4279('0xad'),'TagIds');}if(_0x480193[_0x4279('0x21')])_0x42a4b3[_0x4279('0x21')](_0x480193[_0x4279('0x21')]);if(_0x480193[_0x4279('0x1f')])_0x42a4b3[_0x4279('0x1f')](_0x480193[_0x4279('0x1f')]);return db[_0x4279('0x9b')][_0x4279('0x3f')](_0x42a4b3[_0x4279('0x9c')](),_0x23ac1c);})['then'](function(_0x5ef018){if(_0x5ef018['length']>0x0)_0x462e42['where'](_0x4279('0xae'),_['map'](_0x5ef018,'id'));return db[_0x4279('0x9b')][_0x4279('0x3f')](_0x462e42[_0x4279('0x9c')](),_0x23ac1c)[_0x4279('0x2a')](function(_0x392779){var _0x19293b=_[_0x4279('0xaf')](_0x392779,'SmsInteractionId');var _0x4a1eef=[];_0x5ef018['forEach'](function(_0x30e984){_0x4a1eef['push'](updateSmsInteraction(_0x30e984,_0x55bf9a,_0x19293b));});return BPromise[_0x4279('0xb0')](_0x4a1eef);});});})[_0x4279('0x2a')](function(_0x14e87d){_0x2e2e82[_0x4279('0xb1')]=_0x14e87d;return _0x2e2e82;})['then'](respondWithFilteredResult(_0x2ffec0,_0x480193))[_0x4279('0xb2')](handleError(_0x2ffec0,null));};exports[_0x4279('0xb3')]=function(_0xa3f165,_0x1bb5f0){var _0x35ae78={'raw':![],'where':{'id':_0xa3f165['params']['id']}},_0x15067d={};_0x15067d[_0x4279('0x3e')]=_[_0x4279('0x40')](db[_0x4279('0x3b')][_0x4279('0x3c')]);_0x15067d[_0x4279('0x3f')]=_['keys'](_0xa3f165[_0x4279('0x3f')]);_0x15067d[_0x4279('0x41')]=_[_0x4279('0x42')](_0x15067d['model'],_0x15067d[_0x4279('0x3f')]);_0x35ae78['attributes']=_['intersection'](_0x15067d['model'],qs['fields'](_0xa3f165[_0x4279('0x3f')][_0x4279('0x44')]));_0x35ae78['attributes']=_0x35ae78[_0x4279('0x43')][_0x4279('0x45')]?_0x35ae78[_0x4279('0x43')]:_0x15067d[_0x4279('0x3e')];if(_0xa3f165[_0x4279('0x3f')][_0x4279('0xb4')]){_0x35ae78[_0x4279('0xb5')]=[{'all':!![]}];}_0x35ae78=_['merge']({},_0x35ae78,_0xa3f165['options']);return db[_0x4279('0x3b')]['find'](_0x35ae78)[_0x4279('0x2a')](handleEntityNotFound(_0x1bb5f0,null))[_0x4279('0x2a')](respondWithResult(_0x1bb5f0,null))[_0x4279('0xb2')](handleError(_0x1bb5f0,null));};exports[_0x4279('0xb6')]=function(_0x1882c8,_0x59ff90){return db[_0x4279('0x3b')][_0x4279('0xb6')](_0x1882c8[_0x4279('0x75')],{})['then'](respondWithResult(_0x59ff90,0xc9))['catch'](handleError(_0x59ff90,null));};exports['update']=function(_0x1bf7e7,_0x1d102b){if(_0x1bf7e7[_0x4279('0x75')]['id']){delete _0x1bf7e7[_0x4279('0x75')]['id'];}return db[_0x4279('0x3b')][_0x4279('0x60')]({'where':{'id':_0x1bf7e7[_0x4279('0xb7')]['id']}})['then'](handleEntityNotFound(_0x1d102b,null))['then'](saveUpdates(_0x1bf7e7[_0x4279('0x75')],null))[_0x4279('0x2a')](respondWithResult(_0x1d102b,null))[_0x4279('0xb2')](handleError(_0x1d102b,null));};exports[_0x4279('0x29')]=function(_0x4a5702,_0x28da62){return db[_0x4279('0x3b')][_0x4279('0x60')]({'where':{'id':_0x4a5702[_0x4279('0xb7')]['id']}})[_0x4279('0x2a')](handleEntityNotFound(_0x28da62,null))[_0x4279('0x2a')](removeEntity(_0x28da62,null))[_0x4279('0xb2')](handleError(_0x28da62,null));};exports['describe']=function(_0xe827cb,_0x3d3efe){return db[_0x4279('0x3b')]['describe']()[_0x4279('0x2a')](respondWithResult(_0x3d3efe,null))['catch'](handleError(_0x3d3efe,null));};exports[_0x4279('0xb8')]=function(_0x2fa702,_0x5191d7,_0x4becae){return db['SmsMessage'][_0x4279('0x60')]({'where':{'id':_0x2fa702[_0x4279('0xb7')]['id']}})[_0x4279('0x2a')](handleEntityNotFound(_0x5191d7,null))[_0x4279('0x2a')](function(_0x3d63a8){if(_0x3d63a8){return _0x3d63a8[_0x4279('0xb8')](_0x2fa702[_0x4279('0x75')]['ids'],_[_0x4279('0xb9')](_0x2fa702['body'],[_0x4279('0xba'),'id'])||{});}})[_0x4279('0x2a')](respondWithResult(_0x5191d7,null))[_0x4279('0xb2')](handleError(_0x5191d7,null));};exports[_0x4279('0xbb')]=function(_0x3f4d57,_0x46befa,_0x1534d4){var _0x2b7c3d={'raw':![],'where':{}};var _0x17792a={};var _0x350fd9={'count':0x0,'rows':[]};return db[_0x4279('0x3b')][_0x4279('0xbc')]({'where':{'id':_0x3f4d57[_0x4279('0xb7')]['id']}})[_0x4279('0x2a')](handleEntityNotFound(_0x46befa,null))[_0x4279('0x2a')](function(_0x5ccf5c){if(_0x5ccf5c){_0x17792a[_0x4279('0x3e')]=_['keys'](db[_0x4279('0xbd')][_0x4279('0x3c')]);_0x17792a[_0x4279('0x3f')]=_[_0x4279('0x40')](_0x3f4d57['query']);_0x17792a['filters']=_[_0x4279('0x42')](_0x17792a['model'],_0x17792a[_0x4279('0x3f')]);_0x2b7c3d[_0x4279('0x43')]=_[_0x4279('0x42')](_0x17792a[_0x4279('0x3e')],qs['fields'](_0x3f4d57['query'][_0x4279('0x44')]));_0x2b7c3d[_0x4279('0x43')]=_0x2b7c3d[_0x4279('0x43')][_0x4279('0x45')]?_0x2b7c3d['attributes']:_0x17792a[_0x4279('0x3e')];if(!_0x3f4d57[_0x4279('0x3f')]['hasOwnProperty'](_0x4279('0x46'))){_0x2b7c3d[_0x4279('0x21')]=qs['limit'](_0x3f4d57[_0x4279('0x3f')][_0x4279('0x21')]);_0x2b7c3d['offset']=qs[_0x4279('0x1f')](_0x3f4d57[_0x4279('0x3f')][_0x4279('0x1f')]);}_0x2b7c3d[_0x4279('0x47')]=qs['sort'](_0x3f4d57[_0x4279('0x3f')][_0x4279('0x48')]);_0x2b7c3d[_0x4279('0x49')]=qs[_0x4279('0x41')](_[_0x4279('0xbe')](_0x3f4d57[_0x4279('0x3f')],_0x17792a[_0x4279('0x41')]));_0x2b7c3d[_0x4279('0x49')][_0x4279('0xbf')]=_0x5ccf5c['id'];if(_0x3f4d57[_0x4279('0x3f')][_0x4279('0xc0')]){_0x2b7c3d['where']=_['merge'](_0x2b7c3d[_0x4279('0x49')],{'$or':_['map'](_0x2b7c3d[_0x4279('0x43')],function(_0x341dce){var _0x2f9a7f={};_0x2f9a7f[_0x341dce]={'$like':'%'+_0x3f4d57[_0x4279('0x3f')][_0x4279('0xc0')]+'%'};return _0x2f9a7f;})});}if(_0x3f4d57['query'][_0x4279('0x7d')]){var _0x10e3cb=_0x3f4d57[_0x4279('0x3f')][_0x4279('0x7d')][_0x4279('0x32')](',');var _0x4bd4ad={};_0x4bd4ad[_0x10e3cb[0x0]]={'$gte':moment(_0x10e3cb[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2b7c3d['where']=_[_0x4279('0xc1')](_0x2b7c3d[_0x4279('0x49')],_0x4bd4ad);}_0x2b7c3d=_[_0x4279('0xc1')]({},_0x2b7c3d,_0x3f4d57[_0x4279('0xc2')]);return db[_0x4279('0xbd')][_0x4279('0x9d')]({'where':_0x2b7c3d[_0x4279('0x49')]})[_0x4279('0x2a')](function(_0x5775b0){_0x350fd9[_0x4279('0x9d')]=_0x5775b0;if(_0x3f4d57[_0x4279('0x3f')]['includeAll']){_0x2b7c3d[_0x4279('0xb5')]=[{'all':!![]}];}return db[_0x4279('0xbd')][_0x4279('0xc3')](_0x2b7c3d);})[_0x4279('0x2a')](function(_0x313c6c){_0x350fd9[_0x4279('0xb1')]=_0x313c6c;return _0x350fd9;});}})[_0x4279('0x2a')](respondWithFilteredResult(_0x46befa,_0x2b7c3d))[_0x4279('0xb2')](handleError(_0x46befa,null));};exports['addTags']=function(_0x24cec0,_0x53f98a,_0x12f5b9){return db[_0x4279('0x3b')][_0x4279('0x60')]({'where':{'id':_0x24cec0[_0x4279('0xb7')]['id']}})[_0x4279('0x2a')](handleEntityNotFound(_0x53f98a,null))[_0x4279('0x2a')](function(_0x504135){if(_0x504135){return _0x504135[_0x4279('0xc4')](_0x24cec0[_0x4279('0x75')][_0x4279('0xba')],_[_0x4279('0xb9')](_0x24cec0[_0x4279('0x75')],[_0x4279('0xba'),'id'])||{})['spread'](function(){return db[_0x4279('0x6f')][_0x4279('0xc3')]({'attributes':['id',_0x4279('0x2e'),_0x4279('0x4b')],'where':{'id':_0x24cec0[_0x4279('0x75')][_0x4279('0xba')]}});})[_0x4279('0x2a')](function(_0x177772){socket[_0x4279('0xc5')](_0x4279('0xc6'),{'id':Number(_0x24cec0[_0x4279('0xb7')]['id']),'tags':_0x177772||[]});return{'id':Number(_0x24cec0[_0x4279('0xb7')]['id']),'tags':_0x177772||[]};});}})['then'](respondWithResult(_0x53f98a,null))[_0x4279('0xb2')](handleError(_0x53f98a,null));};exports[_0x4279('0xc7')]=function(_0x6892ab,_0x3d259b,_0x275575){return db['SmsInteraction'][_0x4279('0x60')]({'where':{'id':_0x6892ab[_0x4279('0xb7')]['id']}})[_0x4279('0x2a')](handleEntityNotFound(_0x3d259b,null))[_0x4279('0x2a')](function(_0x42bd59){if(_0x42bd59){return _0x42bd59[_0x4279('0xc7')](_0x6892ab[_0x4279('0x3f')][_0x4279('0xba')]);}})[_0x4279('0x2a')](respondWithStatusCode(_0x3d259b,null))[_0x4279('0xb2')](handleError(_0x3d259b,null));};exports[_0x4279('0xc8')]=function(_0x2a2ffd,_0x3f1eaa){var _0x255bd8=moment()[_0x4279('0xc9')]()[_0x4279('0x9c')]();var _0xf11c=path[_0x4279('0xca')](config['root'],_0x4279('0xcb'),_0x4279('0xcc'),_0x4279('0xcd'));var _0x38a120=path[_0x4279('0xca')](config['root'],_0x4279('0xcb'),_0x4279('0xcc'),_0x4279('0xce'));var _0x5e498a=path[_0x4279('0xca')](_0xf11c,_0x255bd8);var _0x5e1cd3=util[_0x4279('0xcf')](_0x4279('0xd0'),_0x2a2ffd['params']['id'],_0x255bd8);var _0x1e14d0=path['join'](_0xf11c,_0x5e1cd3);var _0x22c70a=[];_0x22c70a[_0x4279('0xd1')]({'model':db['User'],'as':_0x4279('0x72'),'attributes':['id',_0x4279('0xd2')],'raw':!![]});_0x22c70a[_0x4279('0xd1')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x4279('0xd3'),_0x4279('0xd4')],'raw':!![]});var _0x314eb1=[{'model':db[_0x4279('0xbd')],'as':_0x4279('0xd5'),'attributes':['id',_0x4279('0x75'),_0x4279('0x7b'),_0x4279('0xd6'),_0x4279('0xd7'),'read'],'include':_0x22c70a}];_0x314eb1[_0x4279('0xd1')]({'model':db[_0x4279('0xd8')],'as':'Account','attributes':['id','name']});_0x314eb1['push']({'model':db[_0x4279('0x72')],'as':'Owner','attributes':['id',_0x4279('0xd2')]});return db['SmsInteraction'][_0x4279('0x60')]({'where':{'id':_0x2a2ffd[_0x4279('0xb7')]['id']},'include':_0x314eb1})['then'](handleEntityNotFound(_0x3f1eaa,null))[_0x4279('0x2a')](function(_0x3771cf){if(_0x3771cf){var _0x48ada7=_0x3771cf[_0x4279('0xd9')]({'plain':!![]});fs[_0x4279('0xda')](_0x5e498a);var _0x2b7051={'channel':_0x4279('0xdb'),'account':_0x48ada7[_0x4279('0xdc')][_0x4279('0x2e')],'agent':_0x48ada7[_0x4279('0xdd')]?_0x48ada7[_0x4279('0xdd')][_0x4279('0xd2')]:_0x4279('0xde'),'createdAt':moment(_0x48ada7[_0x4279('0x7b')])[_0x4279('0xcf')](_0x4279('0xdf'))[_0x4279('0x9c')](),'closedAt':_0x48ada7['closed']?moment(_0x48ada7[_0x4279('0xe0')])[_0x4279('0xcf')](_0x4279('0xdf'))[_0x4279('0x9c')]():'','disposition':_0x48ada7['disposition'],'messages':_(_0x48ada7[_0x4279('0xd5')])[_0x4279('0xc0')]({'secret':![]})[_0x4279('0x3a')](function(_0x53121d){return{'date':moment(_0x53121d[_0x4279('0x7b')])[_0x4279('0xcf')](_0x4279('0xdf'))[_0x4279('0x9c')](),'sender':_0x53121d[_0x4279('0xd6')]===_0x4279('0xe1')?_0x53121d['User']?_0x53121d[_0x4279('0x72')]['fullname']:'System':_0x53121d['Contact'][_0x4279('0xd3')]+(_0x53121d['Contact'][_0x4279('0xd4')]?'\x20'+_0x53121d[_0x4279('0x64')]['lastName']:''),'body':_0x53121d[_0x4279('0x75')],'direction':_0x53121d['direction']==='out'?'A':'C','secret':_0x53121d['secret'],'read':_0x53121d['read']};})[_0x4279('0x67')]()};return ejs[_0x4279('0xe2')](path[_0x4279('0xca')](config['root'],_0x4279('0xcb'),'views',_0x4279('0xe3')),{'interaction':_0x2b7051})[_0x4279('0x2a')](function(_0x254c08){var _0x30d3f0=path[_0x4279('0xca')](_0x5e498a,'transcript-'+_0x48ada7['id']+'-'+_0x255bd8+_0x4279('0xe4'));var _0x3e3112={'path':_0x30d3f0,'channel':_0x4279('0xdb'),'interactionId':_0x48ada7['id']};return pdf[_0x4279('0xe5')](_0x254c08,_0x3e3112);})[_0x4279('0x2a')](function(){return new BPromise(function(_0x52b43e,_0x9e8365){zipdir(_0x5e498a,{'saveTo':_0x1e14d0},function(_0x1ca019,_0x48796e){if(_0x1ca019)return _0x9e8365(_0x1ca019);return _0x52b43e(_0x48796e);});})[_0x4279('0x2a')](function(){return new BPromise(function(_0xae5b14,_0x4e2fb6){rimraf(_0x5e498a,function(_0xdb29bc){if(_0xdb29bc)_0x4e2fb6(_0xdb29bc);return _0xae5b14();});});})['then'](function(){return _0x3f1eaa['download'](_0x1e14d0,_0x5e1cd3,function(_0x51fbd5){if(_0x51fbd5){console['log']('err',_0x51fbd5);}else{fs[_0x4279('0xe6')](_0x1e14d0);}});});});}else{return _0x3f1eaa[_0x4279('0x2b')](0xc8);}})[_0x4279('0xb2')](handleError(_0x3f1eaa,null));}; \ No newline at end of file +var _0x340a=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','error','name','send','map','fullname','Tags','TagIds','split','forEach','push','catch','waiting','talking','total','UserId','closed','answered','unmanaged','index','SmsInteraction','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','select','field','from','tools_tags','u.id','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','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)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','find','start','body','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','parse','$gte','$lte','where','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','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','describe','SmsMessage','omit','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','addTags','spread','color','emit','removeTags','download','unix','root','server','files','join','format','CmContact','firstName','lastName','createdAt','direction','secret','Account','Owner','get','mkdirSync','closedAt','disposition','out','renderFile','downloadInteraction.ejs','Sms','log','err','unlinkSync','eml-format'];(function(_0x1cfced,_0x939c83){var _0x4d671a=function(_0x46aedc){while(--_0x46aedc){_0x1cfced['push'](_0x1cfced['shift']());}};_0x4d671a(++_0x939c83);}(_0x340a,0x1c9));var _0xa340=function(_0x54b22c,_0x14f307){_0x54b22c=_0x54b22c-0x0;var _0x4948b4=_0x340a[_0x54b22c];return _0x4948b4;};'use strict';var emlformat=require(_0xa340('0x0'));var rimraf=require(_0xa340('0x1'));var zipdir=require(_0xa340('0x2'));var jsonpatch=require(_0xa340('0x3'));var rp=require(_0xa340('0x4'));var moment=require(_0xa340('0x5'));var BPromise=require(_0xa340('0x6'));var Mustache=require(_0xa340('0x7'));var util=require(_0xa340('0x8'));var path=require(_0xa340('0x9'));var sox=require(_0xa340('0xa'));var csv=require(_0xa340('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa340('0xc'));var crypto=require(_0xa340('0xd'));var jsforce=require(_0xa340('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa340('0xb'));var querystring=require(_0xa340('0xf'));var Papa=require(_0xa340('0x10'));var Redis=require(_0xa340('0x11'));var authService=require(_0xa340('0x12'));var qs=require(_0xa340('0x13'));var as=require(_0xa340('0x14'));var pdf=require(_0xa340('0x15'));var hardwareService=require(_0xa340('0x16'));var logger=require(_0xa340('0x17'))('api');var utils=require(_0xa340('0x18'));var config=require(_0xa340('0x19'));var licenseUtil=require(_0xa340('0x1a'));var db=require('../../mysqldb')['db'];config[_0xa340('0x1b')]=_['defaults'](config['redis'],{'host':_0xa340('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')[_0xa340('0x1d')](socket);function respondWithStatusCode(_0x7f22cb,_0x45bca8){_0x45bca8=_0x45bca8||0xcc;return function(_0x2ff6aa){if(_0x2ff6aa){return _0x7f22cb[_0xa340('0x1e')](_0x45bca8);}return _0x7f22cb[_0xa340('0x1f')](_0x45bca8)[_0xa340('0x20')]();};}function respondWithResult(_0x2d2724,_0x3c3499){_0x3c3499=_0x3c3499||0xc8;return function(_0x516af8){if(_0x516af8){return _0x2d2724[_0xa340('0x1f')](_0x3c3499)[_0xa340('0x21')](_0x516af8);}};}function respondWithFilteredResult(_0x3fe809,_0x5e6a50){return function(_0x3405ae){if(_0x3405ae){var _0x4f5502=typeof _0x5e6a50[_0xa340('0x22')]===_0xa340('0x23')&&typeof _0x5e6a50[_0xa340('0x24')]==='undefined';var _0x115850=_0x3405ae[_0xa340('0x25')];var _0x1db954=_0x4f5502?0x0:_0x5e6a50['offset'];var _0x527318=_0x4f5502?_0x3405ae[_0xa340('0x25')]:_0x5e6a50[_0xa340('0x22')]+_0x5e6a50['limit'];var _0x366c9e;if(_0x527318>=_0x115850){_0x527318=_0x115850;_0x366c9e=0xc8;}else{_0x366c9e=0xce;}_0x3fe809[_0xa340('0x1f')](_0x366c9e);return _0x3fe809[_0xa340('0x26')]('Content-Range',_0x1db954+'-'+_0x527318+'/'+_0x115850)[_0xa340('0x21')](_0x3405ae);}return null;};}function patchUpdates(_0x41f210){return function(_0x1ee8ab){try{jsonpatch['apply'](_0x1ee8ab,_0x41f210,!![]);}catch(_0x54dcca){return BPromise[_0xa340('0x27')](_0x54dcca);}return _0x1ee8ab[_0xa340('0x28')]();};}function saveUpdates(_0x38841f,_0x7658f){return function(_0x2eb33f){if(_0x2eb33f){return _0x2eb33f[_0xa340('0x29')](_0x38841f)['then'](function(_0x1e30f3){return _0x1e30f3;});}return null;};}function removeEntity(_0x44d3f0,_0x2c08d3){return function(_0xcb9784){if(_0xcb9784){return _0xcb9784['destroy']()[_0xa340('0x2a')](function(){_0x44d3f0[_0xa340('0x1f')](0xcc)[_0xa340('0x20')]();});}};}function handleEntityNotFound(_0x1039f3,_0x15ac74){return function(_0x3b01b5){if(!_0x3b01b5){_0x1039f3[_0xa340('0x1e')](0x194);}return _0x3b01b5;};}function handleError(_0x47e3f2,_0x1795e5){_0x1795e5=_0x1795e5||0x1f4;return function(_0x5a4a3c){logger[_0xa340('0x2b')](_0x5a4a3c['stack']);if(_0x5a4a3c[_0xa340('0x2c')]){delete _0x5a4a3c['name'];}_0x47e3f2['status'](_0x1795e5)[_0xa340('0x2d')](_0x5a4a3c);};}function getInteractionUsers(_0x54943e,_0x41fb76){return new BPromise(function(_0x4efe74,_0x2397c1){try{if(_0x41fb76[_0x54943e['id']]){_0x54943e['Users']=_[_0xa340('0x2e')](_0x41fb76[_0x54943e['id']],function(_0x138ec5){return{'id':_0x138ec5['id'],'fullname':_0x138ec5[_0xa340('0x2f')]};});}}catch(_0x4ae72e){_0x2397c1(_0x4ae72e);}_0x4efe74(_0x54943e);});}function getInteractionTags(_0x30dfea,_0x596d0d){return new BPromise(function(_0x320801,_0x328aab){try{if(_0x30dfea['TagIds']){_0x30dfea[_0xa340('0x30')]=[];_0x30dfea[_0xa340('0x31')][_0xa340('0x32')](',')[_0xa340('0x33')](function(_0x110425){_0x30dfea[_0xa340('0x30')][_0xa340('0x34')](_0x596d0d[_0x110425]);});}delete _0x30dfea[_0xa340('0x31')];}catch(_0x1fa95c){_0x328aab(_0x1fa95c);}_0x320801(_0x30dfea);});}function updateSmsInteraction(_0x443c56,_0x31629d,_0x30632f){return new BPromise(function(_0x3e779b,_0xc4a3b9){return getInteractionUsers(_0x443c56,_0x30632f)[_0xa340('0x2a')](function(_0x5f5361){return getInteractionTags(_0x5f5361,_0x31629d);})[_0xa340('0x2a')](function(_0x504c5e){return getStateInteraction(_0x504c5e);})[_0xa340('0x2a')](function(_0x5c50e8){_0x3e779b(_0x5c50e8);})[_0xa340('0x35')](function(_0x221221){_0xc4a3b9(_0x221221);});});}function getStateInteraction(_0x543eaf){return new BPromise(function(_0x3cd8e9){_0x543eaf[_0xa340('0x36')]=0x0;_0x543eaf[_0xa340('0x37')]=0x0;_0x543eaf['answered']=0x0;_0x543eaf['unmanaged']=0x0;_0x543eaf[_0xa340('0x38')]=0x0;if(!_0x543eaf['closed']&&!_0x543eaf[_0xa340('0x39')]){_0x543eaf[_0xa340('0x36')]+=0x1;}if(!_0x543eaf[_0xa340('0x3a')]&&_0x543eaf[_0xa340('0x39')]){_0x543eaf[_0xa340('0x37')]+=0x1;if(_0x543eaf[_0xa340('0x36')]){_0x543eaf[_0xa340('0x36')]-=0x1;}}if(_0x543eaf[_0xa340('0x3a')]&&_0x543eaf['UserId']){_0x543eaf[_0xa340('0x3b')]+=0x1;if(_0x543eaf[_0xa340('0x37')]){_0x543eaf[_0xa340('0x37')]-=0x1;}}if(_0x543eaf[_0xa340('0x3a')]&&!_0x543eaf[_0xa340('0x39')]){_0x543eaf[_0xa340('0x3c')]+=0x1;if(_0x543eaf[_0xa340('0x36')]){_0x543eaf[_0xa340('0x36')]-=0x1;}}_0x543eaf[_0xa340('0x38')]+=0x1;_0x3cd8e9(_0x543eaf);});}exports[_0xa340('0x3d')]=function(_0x938c36,_0x5c5863){var _0xcf516d={},_0x4330db={},_0x14f75e={'count':0x0,'rows':[]};var _0xb905d7=_[_0xa340('0x2e')](db[_0xa340('0x3e')][_0xa340('0x3f')],function(_0x223b1d){return{'name':_0x223b1d[_0xa340('0x40')],'type':_0x223b1d['type']['key']};});_0x4330db[_0xa340('0x41')]=_[_0xa340('0x2e')](_0xb905d7,_0xa340('0x2c'));_0x4330db[_0xa340('0x42')]=_[_0xa340('0x43')](_0x938c36[_0xa340('0x42')]);_0x4330db[_0xa340('0x44')]=_[_0xa340('0x45')](_0x4330db[_0xa340('0x41')],_0x4330db['query']);_0xcf516d[_0xa340('0x46')]=_[_0xa340('0x45')](_0x4330db[_0xa340('0x41')],qs[_0xa340('0x47')](_0x938c36[_0xa340('0x42')][_0xa340('0x47')]));_0xcf516d[_0xa340('0x46')]=_0xcf516d['attributes'][_0xa340('0x48')]?_0xcf516d[_0xa340('0x46')]:_0x4330db['model'];if(!_0x938c36[_0xa340('0x42')][_0xa340('0x49')](_0xa340('0x4a'))){_0xcf516d[_0xa340('0x24')]=qs[_0xa340('0x24')](_0x938c36[_0xa340('0x42')][_0xa340('0x24')]);_0xcf516d[_0xa340('0x22')]=qs['offset'](_0x938c36[_0xa340('0x42')][_0xa340('0x22')]);}_0xcf516d['order']=qs[_0xa340('0x4b')](_0x938c36[_0xa340('0x42')][_0xa340('0x4b')]);_0xcf516d['where']=qs['filters'](_[_0xa340('0x4c')](_0x938c36[_0xa340('0x42')],_0x4330db['filters']),_0xb905d7);var _0x112b62=[];var _0x58fb41=squel[_0xa340('0x4d')]()[_0xa340('0x4e')]('id')[_0xa340('0x4e')]('name')[_0xa340('0x4e')]('color')[_0xa340('0x4f')](_0xa340('0x50'));var _0x34cfa5=squel['select']()['field'](_0xa340('0x51'))[_0xa340('0x4e')]('u.fullname')['field'](_0xa340('0x52'))['from'](_0xa340('0x53'),'ui')[_0xa340('0x54')](_0xa340('0x55'),'u',_0xa340('0x56'));var _0x10c6b4=squel['select']()['from'](_0xa340('0x57'),'i')[_0xa340('0x54')](_0xa340('0x58'),'c',_0xa340('0x59'))[_0xa340('0x54')](_0xa340('0x55'),'o',_0xa340('0x5a'))[_0xa340('0x54')]('sms_accounts','a',_0xa340('0x5b'))[_0xa340('0x54')](_0xa340('0x5c'),'me',_0xa340('0x5d'))[_0xa340('0x54')]('sms_interaction_has_tags','it',_0xa340('0x5e'))[_0xa340('0x54')](_0xa340('0x50'),'t',_0xa340('0x5f'));var _0x5413cc=squel[_0xa340('0x60')]();var _0x572d58=[];var _0xdbd38=squel[_0xa340('0x60')]();var _0x5f2954;if(_0x938c36[_0xa340('0x42')]['search']){_0x5f2954=as[_0xa340('0x61')](_0x938c36[_0xa340('0x42')][_0xa340('0x62')]);var _0x2f01a0=_0x5f2954[_0xa340('0x63')];for(var _0x335f04=0x0;_0x335f04<_0x5f2954[_0xa340('0x64')][_0xa340('0x48')];_0x335f04++){var _0x175134=_0x5f2954[_0xa340('0x64')][_0x335f04];var _0x3ea7f6='i';var _0x49964a=_['find'](_0xb905d7,[_0xa340('0x2c'),_0x175134[_0xa340('0x4e')]]);if(!_0x49964a){switch(_0x175134[_0xa340('0x4e')]){case _0xa340('0x65'):if(_0x175134[_0xa340('0x66')]==0x1){_0x10c6b4[_0xa340('0x67')]('`'+_0x175134[_0xa340('0x4e')]+_0xa340('0x68'));}else{_0x10c6b4['having']('`'+_0x175134[_0xa340('0x4e')]+_0xa340('0x69'));}break;case _0xa340('0x6a'):if(_0x175134[_0xa340('0x6b')]===_0xa340('0x6c')){if(_0x175134[_0xa340('0x66')][_0xa340('0x32')]('\x20')[_0xa340('0x48')]>0x1){_0x5413cc[_0x2f01a0](_0xa340('0x6d'),qs['getFullTextValue'](_0x175134['value']),null);}else{var _0x499b12='%'+_0x175134['value']+'%';_0x5413cc[_0x2f01a0](_0xa340('0x6e'),_0x499b12,_0x499b12,_0x499b12);}}else{_0x49964a=_['find'](_0xb905d7,[_0xa340('0x2c'),_0xa340('0x6f')]);_0x175134[_0xa340('0x4e')]=_0xa340('0x6f');_0x307265=as[_0xa340('0x70')](_0x3ea7f6,_0x49964a[_0xa340('0x71')],_0x175134);_0x5413cc[_0x2f01a0](_0x307265[_0xa340('0x72')],_0x307265[_0xa340('0x66')]['start'],_0x307265[_0xa340('0x66')][_0xa340('0x20')]);}break;case _0xa340('0x73'):var _0x1fe18e=_0x175134[_0xa340('0x66')]['split'](',')['map'](function(_0x2476bb){return Number(_0x2476bb);});_0x1fe18e[_0xa340('0x33')](function(_0x2ba5eb){_0xdbd38['or'](_0xa340('0x74'),'%,'+_0x2ba5eb+',%');});_0x572d58=_['union'](_0x572d58,_0x1fe18e);break;case _0xa340('0x75'):if(_0x175134[_0xa340('0x6b')]===_0xa340('0x6c')){_0x5413cc[_0x2f01a0]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x175134[_0xa340('0x66')]+'%',null);}else{_0x49964a=_[_0xa340('0x76')](_0xb905d7,[_0xa340('0x2c'),'UserId']);_0x175134[_0xa340('0x4e')]=_0xa340('0x39');_0x307265=as['buildExpression'](_0x3ea7f6,_0x49964a[_0xa340('0x71')],_0x175134);_0x5413cc[_0x2f01a0](_0x307265['text'],_0x307265[_0xa340('0x66')][_0xa340('0x77')],_0x307265[_0xa340('0x66')][_0xa340('0x20')]);}break;case _0xa340('0x78'):_0x307265=as['buildExpression']('me',null,_0x175134);_0x5413cc[_0x2f01a0](_0x307265[_0xa340('0x72')],_0x307265[_0xa340('0x66')][_0xa340('0x77')],_0x307265[_0xa340('0x66')][_0xa340('0x20')]);break;}}else{var _0x307265=as[_0xa340('0x70')](_0x3ea7f6,_0x49964a[_0xa340('0x71')],_0x175134);_0x5413cc[_0x2f01a0](_0x307265['text'],_0x307265[_0xa340('0x66')][_0xa340('0x77')],_0x307265['value'][_0xa340('0x20')]);}}}else{var _0xa02c3a=_(_0x938c36['query'])['keys']()['map'](function(_0x7a2d97){return _[_0xa340('0x79')](_0xb905d7,[_0xa340('0x2c'),_0x7a2d97])?_0x7a2d97:undefined;})[_0xa340('0x7a')]()[_0xa340('0x66')]();if(!_[_0xa340('0x7b')](_0xa02c3a)){_0xa02c3a[_0xa340('0x33')](function(_0x5041ad){if(_0x5041ad===_0xa340('0x7c')){_0x10c6b4['where'](_0xa340('0x7d'),[]['concat'](_0x938c36[_0xa340('0x42')][_0x5041ad]));}else if(_0x5041ad==='createdAt'){var _0x2204c6=JSON[_0xa340('0x7e')](_0x938c36[_0xa340('0x42')][_0x5041ad])[_0xa340('0x7f')];var _0x5784a7=JSON[_0xa340('0x7e')](_0x938c36[_0xa340('0x42')][_0x5041ad])[_0xa340('0x80')];_0x10c6b4[_0xa340('0x81')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2204c6,_0x5784a7);}else{if(_0x938c36['query'][_0x5041ad]===_0xa340('0x82')){_0x10c6b4[_0xa340('0x81')]('i.'+_0x5041ad+_0xa340('0x83'));}else{_0x10c6b4[_0xa340('0x81')]('i.'+_0x5041ad+_0xa340('0x84'),_0x938c36['query'][_0x5041ad]);}}});}if(_0x938c36[_0xa340('0x42')][_0xa340('0x85')]){if(_0x938c36[_0xa340('0x42')][_0xa340('0x85')]==0x1){_0x10c6b4[_0xa340('0x67')]('`unreadMessages`\x20=\x200');}else{_0x10c6b4[_0xa340('0x67')](_0xa340('0x86'));}}if(_0x938c36[_0xa340('0x42')][_0xa340('0x87')]){_0x572d58=_[_0xa340('0x88')](_0x938c36[_0xa340('0x42')][_0xa340('0x87')])?_0x938c36[_0xa340('0x42')][_0xa340('0x87')]:new Array(_0x938c36[_0xa340('0x42')]['tag']);_0x572d58[_0xa340('0x33')](function(_0x242923){_0xdbd38['or'](_0xa340('0x74'),'%,'+_0x242923+',%');});}if(_0x938c36[_0xa340('0x42')][_0xa340('0x89')]){var _0x4573ce=_0x938c36[_0xa340('0x42')][_0xa340('0x89')][_0xa340('0x8a')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4573ce)){_0x5413cc['or'](_0xa340('0x8b'),_0x4573ce+'%')['or'](_0xa340('0x8c'),_0x4573ce+'%');}else{_0x5413cc['or'](_0xa340('0x8d'),qs[_0xa340('0x8e')](_0x4573ce))['or'](_0xa340('0x8f'),_0x4573ce+'%');}}}_0x10c6b4[_0xa340('0x81')](_0x5413cc);_0x10c6b4['group']('i.id');var _0x642e6d={'type':db[_0xa340('0x90')][_0xa340('0x91')][_0xa340('0x92')],'raw':!![]};var _0x23675f=_0x10c6b4[_0xa340('0x93')]();_0x23675f['field'](_0xa340('0x94'));_0x23675f['field'](_0xa340('0x95'),_0xa340('0x65'));if(_0xcf516d[_0xa340('0x96')]){_0xcf516d[_0xa340('0x96')][_0xa340('0x33')](function(_0x11e48a){var _0x2d88ae=_0x11e48a[0x0]===_0xa340('0x97')?_0x11e48a[0x0]:'i.'+_0x11e48a[0x0];_0x10c6b4[_0xa340('0x96')](_0x2d88ae,_0x11e48a[0x1]===_0xa340('0x98')?![]:!![]);});}if(!_[_0xa340('0x7b')](_0x572d58)){_0x10c6b4[_0xa340('0x67')](_0xdbd38);_0x23675f[_0xa340('0x81')](_0xa340('0x99'),_0x572d58);}BPromise['resolve']()[_0xa340('0x2a')](function(){if(!_0x5f2954){if(_0x938c36[_0xa340('0x42')][_0xa340('0x7c')])return;_0x23675f['where'](_0xa340('0x9a'));_0x10c6b4[_0xa340('0x81')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x938c36[_0xa340('0x9b')][_0xa340('0x9c')]!==_0xa340('0x9d'))return;return _0x938c36[_0xa340('0x9b')][_0xa340('0x9e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x143f25){if(_[_0xa340('0x7b')](_0x143f25)){_0x23675f[_0xa340('0x81')]('i.SmsAccountId\x20IS\x20NULL');_0x10c6b4['where'](_0xa340('0x9f'));}else{_0x23675f[_0xa340('0x81')]('i.SmsAccountId\x20IN\x20?',_[_0xa340('0x2e')](_0x143f25,'id'));_0x10c6b4[_0xa340('0x81')]('i.SmsAccountId\x20IN\x20?',_[_0xa340('0x2e')](_0x143f25,'id'));}});})['then'](function(){if(_0x938c36[_0xa340('0x9b')][_0xa340('0x9c')]===_0xa340('0x9d')&&!_0x5f2954&&!_0x938c36[_0xa340('0x42')][_0xa340('0x7c')])return[];return db[_0xa340('0xa0')]['query'](_0x23675f[_0xa340('0xa1')](),_0x642e6d);})['then'](function(_0xbdc699){_0x14f75e[_0xa340('0x25')]=_0xbdc699['length'];if(_0x14f75e[_0xa340('0x25')]===0x0)return[];return db[_0xa340('0xa0')][_0xa340('0x42')](_0x58fb41['toString'](),_0x642e6d)[_0xa340('0x2a')](function(_0x1f536a){_0x112b62=_[_0xa340('0xa2')](_0x1f536a,'id');_0x642e6d=_[_0xa340('0xa3')](_0x642e6d,{'model':db[_0xa340('0x3e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x938c36[_0xa340('0x42')][_0xa340('0x47')]){_0xcf516d[_0xa340('0x46')][_0xa340('0x33')](function(_0x5c3349){_0x10c6b4['field']('i.'+_0x5c3349);});}else{_0x10c6b4['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa340('0x65'));_0x10c6b4['field'](_0xa340('0xa4'),_0xa340('0xa5'));_0x10c6b4[_0xa340('0x4e')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x10c6b4[_0xa340('0x4e')](_0xa340('0xa6'),'contactName');_0x10c6b4[_0xa340('0x4e')](_0xa340('0xa7'));_0x10c6b4['field'](_0xa340('0xa8'),_0xa340('0xa9'));_0x10c6b4[_0xa340('0x4e')]('c.lastName','Contact.lastName');_0x10c6b4[_0xa340('0x4e')](_0xa340('0xaa'),_0xa340('0xab'));_0x10c6b4[_0xa340('0x4e')](_0xa340('0xac'),_0xa340('0xad'));_0x10c6b4[_0xa340('0x4e')](_0xa340('0xae'),_0xa340('0xaf'));_0x10c6b4[_0xa340('0x4e')](_0xa340('0xb0'),_0xa340('0xb1'));_0x10c6b4['field'](_0xa340('0xb2'),'Owner.fullname');_0x10c6b4[_0xa340('0x4e')]('o.internal','Owner.internal');_0x10c6b4[_0xa340('0x4e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xa340('0x31'));}if(_0xcf516d['limit'])_0x10c6b4[_0xa340('0x24')](_0xcf516d[_0xa340('0x24')]);if(_0xcf516d[_0xa340('0x22')])_0x10c6b4['offset'](_0xcf516d[_0xa340('0x22')]);return db[_0xa340('0xa0')][_0xa340('0x42')](_0x10c6b4[_0xa340('0xa1')](),_0x642e6d);})[_0xa340('0x2a')](function(_0x44476c){if(_0x44476c['length']>0x0)_0x34cfa5[_0xa340('0x81')](_0xa340('0xb3'),_[_0xa340('0x2e')](_0x44476c,'id'));return db['sequelize'][_0xa340('0x42')](_0x34cfa5[_0xa340('0xa1')](),_0x642e6d)[_0xa340('0x2a')](function(_0x1c8761){var _0x1fa2df=_[_0xa340('0xb4')](_0x1c8761,_0xa340('0xb5'));var _0x43ae71=[];_0x44476c[_0xa340('0x33')](function(_0x6501af){_0x43ae71[_0xa340('0x34')](updateSmsInteraction(_0x6501af,_0x112b62,_0x1fa2df));});return BPromise[_0xa340('0xb6')](_0x43ae71);});});})['then'](function(_0x2bba76){_0x14f75e[_0xa340('0xb7')]=_0x2bba76;return _0x14f75e;})[_0xa340('0x2a')](respondWithFilteredResult(_0x5c5863,_0xcf516d))[_0xa340('0x35')](handleError(_0x5c5863,null));};exports[_0xa340('0xb8')]=function(_0x581833,_0x4f32c8){var _0xf0080e={'raw':![],'where':{'id':_0x581833[_0xa340('0xb9')]['id']}},_0x198395={};_0x198395[_0xa340('0x41')]=_[_0xa340('0x43')](db[_0xa340('0x3e')]['rawAttributes']);_0x198395[_0xa340('0x42')]=_[_0xa340('0x43')](_0x581833[_0xa340('0x42')]);_0x198395[_0xa340('0x44')]=_['intersection'](_0x198395[_0xa340('0x41')],_0x198395['query']);_0xf0080e[_0xa340('0x46')]=_[_0xa340('0x45')](_0x198395[_0xa340('0x41')],qs[_0xa340('0x47')](_0x581833[_0xa340('0x42')][_0xa340('0x47')]));_0xf0080e['attributes']=_0xf0080e[_0xa340('0x46')][_0xa340('0x48')]?_0xf0080e[_0xa340('0x46')]:_0x198395[_0xa340('0x41')];if(_0x581833['query'][_0xa340('0xba')]){_0xf0080e['include']=[{'all':!![]}];}_0xf0080e=_[_0xa340('0xa3')]({},_0xf0080e,_0x581833['options']);return db['SmsInteraction'][_0xa340('0x76')](_0xf0080e)[_0xa340('0x2a')](handleEntityNotFound(_0x4f32c8,null))['then'](respondWithResult(_0x4f32c8,null))[_0xa340('0x35')](handleError(_0x4f32c8,null));};exports[_0xa340('0xbb')]=function(_0x2a545c,_0x4996f5){return db[_0xa340('0x3e')][_0xa340('0xbb')](_0x2a545c[_0xa340('0x78')],{})[_0xa340('0x2a')](respondWithResult(_0x4996f5,0xc9))[_0xa340('0x35')](handleError(_0x4996f5,null));};exports[_0xa340('0x29')]=function(_0x35919f,_0x16d4ee){if(_0x35919f[_0xa340('0x78')]['id']){delete _0x35919f[_0xa340('0x78')]['id'];}return db[_0xa340('0x3e')][_0xa340('0x76')]({'where':{'id':_0x35919f[_0xa340('0xb9')]['id']}})[_0xa340('0x2a')](handleEntityNotFound(_0x16d4ee,null))[_0xa340('0x2a')](saveUpdates(_0x35919f['body'],null))[_0xa340('0x2a')](respondWithResult(_0x16d4ee,null))[_0xa340('0x35')](handleError(_0x16d4ee,null));};exports['destroy']=function(_0x3a4493,_0x4f2f92){return db['SmsInteraction']['find']({'where':{'id':_0x3a4493[_0xa340('0xb9')]['id']}})['then'](handleEntityNotFound(_0x4f2f92,null))[_0xa340('0x2a')](removeEntity(_0x4f2f92,null))[_0xa340('0x35')](handleError(_0x4f2f92,null));};exports[_0xa340('0xbc')]=function(_0x4eb211,_0x2b3eb3){return db[_0xa340('0x3e')][_0xa340('0xbc')]()[_0xa340('0x2a')](respondWithResult(_0x2b3eb3,null))['catch'](handleError(_0x2b3eb3,null));};exports['addMessage']=function(_0x42650e,_0x2670eb,_0x579be2){return db[_0xa340('0xbd')][_0xa340('0x76')]({'where':{'id':_0x42650e[_0xa340('0xb9')]['id']}})[_0xa340('0x2a')](handleEntityNotFound(_0x2670eb,null))[_0xa340('0x2a')](function(_0x1e4704){if(_0x1e4704){return _0x1e4704['addMessage'](_0x42650e[_0xa340('0x78')]['ids'],_[_0xa340('0xbe')](_0x42650e[_0xa340('0x78')],[_0xa340('0xbf'),'id'])||{});}})[_0xa340('0x2a')](respondWithResult(_0x2670eb,null))['catch'](handleError(_0x2670eb,null));};exports[_0xa340('0xc0')]=function(_0x50f24d,_0x3c13c4,_0x40f2c1){var _0x18bd07={'raw':![],'where':{}};var _0x15c7de={};var _0x243ed9={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xa340('0xc1')]({'where':{'id':_0x50f24d[_0xa340('0xb9')]['id']}})['then'](handleEntityNotFound(_0x3c13c4,null))[_0xa340('0x2a')](function(_0x3208d4){if(_0x3208d4){_0x15c7de[_0xa340('0x41')]=_['keys'](db[_0xa340('0xbd')][_0xa340('0x3f')]);_0x15c7de[_0xa340('0x42')]=_[_0xa340('0x43')](_0x50f24d['query']);_0x15c7de[_0xa340('0x44')]=_['intersection'](_0x15c7de[_0xa340('0x41')],_0x15c7de[_0xa340('0x42')]);_0x18bd07['attributes']=_[_0xa340('0x45')](_0x15c7de[_0xa340('0x41')],qs['fields'](_0x50f24d[_0xa340('0x42')][_0xa340('0x47')]));_0x18bd07['attributes']=_0x18bd07[_0xa340('0x46')][_0xa340('0x48')]?_0x18bd07[_0xa340('0x46')]:_0x15c7de[_0xa340('0x41')];if(!_0x50f24d[_0xa340('0x42')][_0xa340('0x49')](_0xa340('0x4a'))){_0x18bd07[_0xa340('0x24')]=qs['limit'](_0x50f24d[_0xa340('0x42')][_0xa340('0x24')]);_0x18bd07[_0xa340('0x22')]=qs[_0xa340('0x22')](_0x50f24d[_0xa340('0x42')][_0xa340('0x22')]);}_0x18bd07[_0xa340('0x96')]=qs[_0xa340('0x4b')](_0x50f24d[_0xa340('0x42')][_0xa340('0x4b')]);_0x18bd07[_0xa340('0x81')]=qs[_0xa340('0x44')](_['pick'](_0x50f24d[_0xa340('0x42')],_0x15c7de[_0xa340('0x44')]));_0x18bd07[_0xa340('0x81')][_0xa340('0xb5')]=_0x3208d4['id'];if(_0x50f24d[_0xa340('0x42')]['filter']){_0x18bd07[_0xa340('0x81')]=_['merge'](_0x18bd07[_0xa340('0x81')],{'$or':_[_0xa340('0x2e')](_0x18bd07[_0xa340('0x46')],function(_0x47d3af){var _0x5b08c2={};_0x5b08c2[_0x47d3af]={'$like':'%'+_0x50f24d[_0xa340('0x42')][_0xa340('0x89')]+'%'};return _0x5b08c2;})});}if(_0x50f24d[_0xa340('0x42')][_0xa340('0x7f')]){var _0x41ac74=_0x50f24d[_0xa340('0x42')][_0xa340('0x7f')][_0xa340('0x32')](',');var _0x157c09={};_0x157c09[_0x41ac74[0x0]]={'$gte':moment(_0x41ac74[0x1])['format'](_0xa340('0xc2'))};_0x18bd07[_0xa340('0x81')]=_[_0xa340('0xa3')](_0x18bd07[_0xa340('0x81')],_0x157c09);}_0x18bd07=_['merge']({},_0x18bd07,_0x50f24d[_0xa340('0xc3')]);return db[_0xa340('0xbd')][_0xa340('0x25')]({'where':_0x18bd07[_0xa340('0x81')]})[_0xa340('0x2a')](function(_0x40dbae){_0x243ed9[_0xa340('0x25')]=_0x40dbae;if(_0x50f24d[_0xa340('0x42')][_0xa340('0xba')]){_0x18bd07[_0xa340('0xc4')]=[{'all':!![]}];}return db['SmsMessage'][_0xa340('0xc5')](_0x18bd07);})[_0xa340('0x2a')](function(_0x3c97ff){_0x243ed9['rows']=_0x3c97ff;return _0x243ed9;});}})['then'](respondWithFilteredResult(_0x3c13c4,_0x18bd07))['catch'](handleError(_0x3c13c4,null));};exports[_0xa340('0xc6')]=function(_0x3df716,_0x5edec4,_0x1aca08){return db[_0xa340('0x3e')]['find']({'where':{'id':_0x3df716['params']['id']}})['then'](handleEntityNotFound(_0x5edec4,null))[_0xa340('0x2a')](function(_0x45e282){if(_0x45e282){return _0x45e282['setTags'](_0x3df716[_0xa340('0x78')]['ids'],_[_0xa340('0xbe')](_0x3df716[_0xa340('0x78')],[_0xa340('0xbf'),'id'])||{})[_0xa340('0xc7')](function(){return db['Tag'][_0xa340('0xc5')]({'attributes':['id',_0xa340('0x2c'),_0xa340('0xc8')],'where':{'id':_0x3df716[_0xa340('0x78')][_0xa340('0xbf')]}});})[_0xa340('0x2a')](function(_0x4e4a47){socket[_0xa340('0xc9')]('smsInteractionTags:save',{'id':Number(_0x3df716[_0xa340('0xb9')]['id']),'tags':_0x4e4a47||[]});return{'id':Number(_0x3df716[_0xa340('0xb9')]['id']),'tags':_0x4e4a47||[]};});}})[_0xa340('0x2a')](respondWithResult(_0x5edec4,null))[_0xa340('0x35')](handleError(_0x5edec4,null));};exports[_0xa340('0xca')]=function(_0x2e243e,_0xc9e40c,_0x3c4f2e){return db[_0xa340('0x3e')]['find']({'where':{'id':_0x2e243e['params']['id']}})[_0xa340('0x2a')](handleEntityNotFound(_0xc9e40c,null))['then'](function(_0x307af0){if(_0x307af0){return _0x307af0[_0xa340('0xca')](_0x2e243e[_0xa340('0x42')][_0xa340('0xbf')]);}})[_0xa340('0x2a')](respondWithStatusCode(_0xc9e40c,null))[_0xa340('0x35')](handleError(_0xc9e40c,null));};exports[_0xa340('0xcb')]=function(_0x365563,_0x1bc627){var _0x25a4e4=moment()[_0xa340('0xcc')]()[_0xa340('0xa1')]();var _0x28981e=path['join'](config[_0xa340('0xcd')],_0xa340('0xce'),_0xa340('0xcf'),'tmp');var _0x2ee8d1=path[_0xa340('0xd0')](config[_0xa340('0xcd')],_0xa340('0xce'),'files','attachments');var _0xb71f8d=path[_0xa340('0xd0')](_0x28981e,_0x25a4e4);var _0x13e38a=util[_0xa340('0xd1')]('transcript-%d-%s.zip',_0x365563[_0xa340('0xb9')]['id'],_0x25a4e4);var _0x544f50=path[_0xa340('0xd0')](_0x28981e,_0x13e38a);var _0x304190=[];_0x304190[_0xa340('0x34')]({'model':db[_0xa340('0x75')],'as':'User','attributes':['id',_0xa340('0x2f')],'raw':!![]});_0x304190[_0xa340('0x34')]({'model':db[_0xa340('0xd2')],'as':_0xa340('0x6a'),'attributes':['id',_0xa340('0xd3'),_0xa340('0xd4')],'raw':!![]});var _0x3217fb=[{'model':db[_0xa340('0xbd')],'as':'Messages','attributes':['id','body',_0xa340('0xd5'),_0xa340('0xd6'),_0xa340('0xd7'),_0xa340('0x85')],'include':_0x304190}];_0x3217fb[_0xa340('0x34')]({'model':db['SmsAccount'],'as':_0xa340('0xd8'),'attributes':['id',_0xa340('0x2c')]});_0x3217fb[_0xa340('0x34')]({'model':db[_0xa340('0x75')],'as':_0xa340('0xd9'),'attributes':['id',_0xa340('0x2f')]});return db[_0xa340('0x3e')][_0xa340('0x76')]({'where':{'id':_0x365563[_0xa340('0xb9')]['id']},'include':_0x3217fb})[_0xa340('0x2a')](handleEntityNotFound(_0x1bc627,null))['then'](function(_0x9e8a1c){if(_0x9e8a1c){var _0x5ae701=_0x9e8a1c[_0xa340('0xda')]({'plain':!![]});fs[_0xa340('0xdb')](_0xb71f8d);var _0x9b4f84={'channel':'Sms','account':_0x5ae701['Account']['name'],'agent':_0x5ae701[_0xa340('0xd9')]?_0x5ae701[_0xa340('0xd9')]['fullname']:'N.A.','createdAt':moment(_0x5ae701[_0xa340('0xd5')])['format'](_0xa340('0xc2'))[_0xa340('0xa1')](),'closedAt':_0x5ae701[_0xa340('0x3a')]?moment(_0x5ae701[_0xa340('0xdc')])[_0xa340('0xd1')](_0xa340('0xc2'))['toString']():'','disposition':_0x5ae701[_0xa340('0xdd')],'messages':_(_0x5ae701['Messages'])[_0xa340('0x89')]({'secret':![]})[_0xa340('0x2e')](function(_0x447181){return{'date':moment(_0x447181[_0xa340('0xd5')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xa340('0xa1')](),'sender':_0x447181[_0xa340('0xd6')]==='out'?_0x447181[_0xa340('0x75')]?_0x447181['User'][_0xa340('0x2f')]:'System':_0x447181[_0xa340('0x6a')]['firstName']+(_0x447181[_0xa340('0x6a')][_0xa340('0xd4')]?'\x20'+_0x447181['Contact'][_0xa340('0xd4')]:''),'body':_0x447181[_0xa340('0x78')],'direction':_0x447181[_0xa340('0xd6')]===_0xa340('0xde')?'A':'C','secret':_0x447181[_0xa340('0xd7')],'read':_0x447181[_0xa340('0x85')]};})['value']()};return ejs[_0xa340('0xdf')](path[_0xa340('0xd0')](config[_0xa340('0xcd')],_0xa340('0xce'),'views',_0xa340('0xe0')),{'interaction':_0x9b4f84})['then'](function(_0x4a2eca){var _0x223f7b=path[_0xa340('0xd0')](_0xb71f8d,'transcript-'+_0x5ae701['id']+'-'+_0x25a4e4+'.pdf');var _0x456614={'path':_0x223f7b,'channel':_0xa340('0xe1'),'interactionId':_0x5ae701['id']};return pdf['createPdfFromHTML'](_0x4a2eca,_0x456614);})['then'](function(){return new BPromise(function(_0x4f371e,_0x3a1d12){zipdir(_0xb71f8d,{'saveTo':_0x544f50},function(_0x478373,_0x1b302f){if(_0x478373)return _0x3a1d12(_0x478373);return _0x4f371e(_0x1b302f);});})[_0xa340('0x2a')](function(){return new BPromise(function(_0x28e044,_0x27ea6a){rimraf(_0xb71f8d,function(_0x25b9ad){if(_0x25b9ad)_0x27ea6a(_0x25b9ad);return _0x28e044();});});})[_0xa340('0x2a')](function(){return _0x1bc627[_0xa340('0xcb')](_0x544f50,_0x13e38a,function(_0x29db46){if(_0x29db46){console[_0xa340('0xe2')](_0xa340('0xe3'),_0x29db46);}else{fs[_0xa340('0xe4')](_0x544f50);}});});});}else{return _0x1bc627[_0xa340('0x1e')](0xc8);}})[_0xa340('0x35')](handleError(_0x1bc627,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 7547ecb..d19bd90 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 _0xaebd=['SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','remove','then','map','findAll','unreadMessages','emit','catch','hasOwnProperty','events'];(function(_0x4113a2,_0x5b5950){var _0xcc3792=function(_0x530c58){while(--_0x530c58){_0x4113a2['push'](_0x4113a2['shift']());}};_0xcc3792(++_0x5b5950);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x1c0bf6,_0x151b4b){_0x1c0bf6=_0x1c0bf6-0x0;var _0x335796=_0xaebd[_0x1c0bf6];return _0x335796;};'use strict';var EventEmitter=require(_0xdaeb('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xdaeb('0x1')];var SmsMessage=require(_0xdaeb('0x2'))['db'][_0xdaeb('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xdaeb('0x4')](0x0);var events={'afterCreate':_0xdaeb('0x5'),'afterUpdate':'update','afterDestroy':_0xdaeb('0x6')};function emitEvent(_0x1c617a){return function(_0x1a99be,_0x1141fe,_0xee94f9){_0x1a99be['getUsers']({'attributes':['id'],'raw':!![]})[_0xdaeb('0x7')](function(_0x3f7ba1){_0x1a99be['setDataValue']('Users',_0x3f7ba1[_0xdaeb('0x8')](function(_0x11b164){return{'id':_0x11b164['id']};}));return SmsMessage[_0xdaeb('0x9')]({'where':{'SmsInteractionId':_0x1a99be['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xbb4b72){_0x1a99be['setDataValue'](_0xdaeb('0xa'),_0xbb4b72['length']);SmsInteractionEvents[_0xdaeb('0xb')](_0x1c617a+':'+_0x1a99be['id'],_0x1a99be);SmsInteractionEvents['emit'](_0x1c617a,_0x1a99be);_0xee94f9(null);})[_0xdaeb('0xc')](_0xee94f9(null));};}for(var e in events){if(events[_0xdaeb('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x1893=['SmsInteraction','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0xf1440c,_0x2b1b87){var _0x40bee8=function(_0x259332){while(--_0x259332){_0xf1440c['push'](_0xf1440c['shift']());}};_0x40bee8(++_0x2b1b87);}(_0x1893,0xa2));var _0x3189=function(_0x5b22e5,_0x50a727){_0x5b22e5=_0x5b22e5-0x0;var _0x50aa89=_0x1893[_0x5b22e5];return _0x50aa89;};'use strict';var EventEmitter=require('events');var SmsInteraction=require('../../mysqldb')['db'][_0x3189('0x0')];var SmsMessage=require(_0x3189('0x1'))['db'][_0x3189('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x3189('0x3')](0x0);var events={'afterCreate':_0x3189('0x4'),'afterUpdate':_0x3189('0x5'),'afterDestroy':_0x3189('0x6')};function emitEvent(_0x5371db){return function(_0x27445,_0x4faebf,_0x2333e6){_0x27445[_0x3189('0x7')]({'attributes':['id'],'raw':!![]})[_0x3189('0x8')](function(_0x118970){_0x27445[_0x3189('0x9')](_0x3189('0xa'),_0x118970['map'](function(_0x1d5f6a){return{'id':_0x1d5f6a['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x27445['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3189('0x8')](function(_0x4ac683){_0x27445[_0x3189('0x9')](_0x3189('0xb'),_0x4ac683[_0x3189('0xc')]);SmsInteractionEvents[_0x3189('0xd')](_0x5371db+':'+_0x27445['id'],_0x27445);SmsInteractionEvents['emit'](_0x5371db,_0x27445);_0x2333e6(null);})[_0x3189('0xe')](_0x2333e6(null));};}for(var e in events){if(events[_0x3189('0xf')](e)){var event=events[e];SmsInteraction[_0x3189('0x10')](e,emitEvent(event));}}module[_0x3189('0x11')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index fc56cf1..242af1f 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 _0x31ec=['SmsInteraction','sms_interactions','changed','closed','format','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x5e2751,_0x518a55){var _0x139a39=function(_0x4802db){while(--_0x4802db){_0x5e2751['push'](_0x5e2751['shift']());}};_0x139a39(++_0x518a55);}(_0x31ec,0x155));var _0xc31e=function(_0x2841bf,_0x1ddb24){_0x2841bf=_0x2841bf-0x0;var _0xaec9f5=_0x31ec[_0x2841bf];return _0xaec9f5;};'use strict';var _=require(_0xc31e('0x0'));var util=require(_0xc31e('0x1'));var logger=require(_0xc31e('0x2'))(_0xc31e('0x3'));var moment=require(_0xc31e('0x4'));var BPromise=require(_0xc31e('0x5'));var rp=require(_0xc31e('0x6'));var fs=require('fs');var path=require(_0xc31e('0x7'));var rimraf=require(_0xc31e('0x8'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0xc31e('0x9')]=function(_0x2ffb4a,_0xdeda33){return _0x2ffb4a[_0xc31e('0xa')](_0xc31e('0xb'),attributes,{'tableName':_0xc31e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4011a8,_0x16347a,_0x4bb92e){if(_0x4011a8[_0xc31e('0xd')](_0xc31e('0xe'))){_0x4011a8['closedAt']=moment()[_0xc31e('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4bb92e(null,_0x4011a8);}}});}; \ No newline at end of file +var _0xd17b=['request-promise','rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','moment'];(function(_0x395c20,_0x1bf1a5){var _0x46d28b=function(_0x5aaada){while(--_0x5aaada){_0x395c20['push'](_0x395c20['shift']());}};_0x46d28b(++_0x1bf1a5);}(_0xd17b,0x112));var _0xbd17=function(_0x2feb53,_0x264ef7){_0x2feb53=_0x2feb53-0x0;var _0x5700ee=_0xd17b[_0x2feb53];return _0x5700ee;};'use strict';var _=require('lodash');var util=require(_0xbd17('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xbd17('0x1'));var BPromise=require('bluebird');var rp=require(_0xbd17('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd17('0x3'));var config=require('../../config/environment');var attributes=require(_0xbd17('0x4'));module[_0xbd17('0x5')]=function(_0x2b49b3,_0x3222dc){return _0x2b49b3[_0xbd17('0x6')](_0xbd17('0x7'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x488d83,_0x3acf6c,_0x288e82){if(_0x488d83[_0xbd17('0x8')]('closed')){_0x488d83[_0xbd17('0x9')]=moment()[_0xbd17('0xa')](_0xbd17('0xb'));}_0x288e82(null,_0x488d83);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 4b8595e..66ff643 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 _0x2a88=['AddTagsToSmsInteraction','find','omit','spread','AddTags','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsInteraction.socket','register','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','limit'];(function(_0x34f6a1,_0x2c3727){var _0x618728=function(_0xa57e36){while(--_0xa57e36){_0x34f6a1['push'](_0x34f6a1['shift']());}};_0x618728(++_0x2c3727);}(_0x2a88,0x18c));var _0x82a8=function(_0x25ece8,_0x176436){_0x25ece8=_0x25ece8-0x0;var _0x1ec97c=_0x2a88[_0x25ece8];return _0x1ec97c;};'use strict';var _=require(_0x82a8('0x0'));var util=require(_0x82a8('0x1'));var moment=require(_0x82a8('0x2'));var BPromise=require(_0x82a8('0x3'));var rs=require(_0x82a8('0x4'));var fs=require('fs');var Redis=require(_0x82a8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x82a8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x82a8('0x7'));var jayson=require(_0x82a8('0x8'));var client=jayson[_0x82a8('0x9')][_0x82a8('0xa')]({'port':0x232a});config[_0x82a8('0xb')]=_[_0x82a8('0xc')](config['redis'],{'host':_0x82a8('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x82a8('0xe'))[_0x82a8('0xf')](socket);function respondWithRpcPromise(_0x55e692,_0x5ca34e,_0x26f6e8){return new BPromise(function(_0x42735f,_0x4e54d1){return client['request'](_0x55e692,_0x26f6e8)[_0x82a8('0x10')](function(_0x295e07){logger['info'](_0x82a8('0x11'),_0x5ca34e,_0x82a8('0x12'));logger['debug'](_0x82a8('0x13'),_0x5ca34e,_0x82a8('0x12'),JSON[_0x82a8('0x14')](_0x295e07));if(_0x295e07[_0x82a8('0x15')]){if(_0x295e07[_0x82a8('0x15')]['code']===0x1f4){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x5ca34e,_0x295e07[_0x82a8('0x15')]['message']);return _0x4e54d1(_0x295e07['error'][_0x82a8('0x16')]);}logger['error'](_0x82a8('0x11'),_0x5ca34e,_0x295e07[_0x82a8('0x15')][_0x82a8('0x16')]);return _0x42735f(_0x295e07[_0x82a8('0x15')][_0x82a8('0x16')]);}else{logger[_0x82a8('0x17')](_0x82a8('0x11'),_0x5ca34e,_0x82a8('0x12'));_0x42735f(_0x295e07[_0x82a8('0x18')][_0x82a8('0x16')]);}})[_0x82a8('0x19')](function(_0x6e2bb0){logger['error'](_0x82a8('0x11'),_0x5ca34e,_0x6e2bb0);_0x4e54d1(_0x6e2bb0);});});}exports[_0x82a8('0x1a')]=function(_0x299b61){var _0x13de47=this;return new Promise(function(_0x3bd3dd,_0x36071f){return db[_0x82a8('0x1b')][_0x82a8('0x1c')](_0x299b61[_0x82a8('0x1d')],{'raw':_0x299b61[_0x82a8('0x1e')]?_0x299b61[_0x82a8('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x299b61[_0x82a8('0x1e')]?_0x299b61[_0x82a8('0x1e')][_0x82a8('0x1f')]||null:null,'attributes':_0x299b61[_0x82a8('0x1e')]?_0x299b61['options']['attributes']||null:null,'limit':_0x299b61[_0x82a8('0x1e')]?_0x299b61['options'][_0x82a8('0x20')]||null:null})[_0x82a8('0x10')](function(_0x1f1a9e){logger[_0x82a8('0x17')](_0x82a8('0x1a'),_0x299b61);logger['debug'](_0x82a8('0x1a'),_0x299b61,JSON[_0x82a8('0x14')](_0x1f1a9e));_0x3bd3dd(_0x1f1a9e);})[_0x82a8('0x19')](function(_0x33ee57){logger[_0x82a8('0x15')](_0x82a8('0x1a'),_0x33ee57[_0x82a8('0x16')],_0x299b61);_0x36071f(_0x13de47[_0x82a8('0x15')](0x1f4,_0x33ee57[_0x82a8('0x16')]));});});};exports[_0x82a8('0x21')]=function(_0x591585){return new Promise(function(_0x5a1064,_0x139a48){return db[_0x82a8('0x1b')][_0x82a8('0x22')]({'where':_0x591585[_0x82a8('0x1e')]?_0x591585[_0x82a8('0x1e')][_0x82a8('0x1f')]||null:null})[_0x82a8('0x10')](function(_0x154d49){if(_0x154d49){return _0x154d49['addTags'](_0x591585[_0x82a8('0x1d')]['ids'],_[_0x82a8('0x23')](_0x591585[_0x82a8('0x1d')],['ids','id'])||{});}})[_0x82a8('0x24')](function(_0x2a3aaf){logger[_0x82a8('0x17')](_0x82a8('0x25'),_0x591585);logger[_0x82a8('0x26')]('AddTags',_0x591585,JSON[_0x82a8('0x14')](_0x2a3aaf));_0x5a1064(_0x2a3aaf);})[_0x82a8('0x19')](function(_0x4d9356){logger[_0x82a8('0x15')](_0x82a8('0x25'),_0x4d9356[_0x82a8('0x16')],_0x591585);_0x139a48(_this['error'](0x1f4,_0x4d9356['message']));});});}; \ No newline at end of file +var _0xce5c=['info','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','then','stringify','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x1c8fdc,_0x4210b1){var _0x39e241=function(_0x1c1faf){while(--_0x1c1faf){_0x1c8fdc['push'](_0x1c8fdc['shift']());}};_0x39e241(++_0x4210b1);}(_0xce5c,0x88));var _0xcce5=function(_0x2bfe52,_0x43946e){_0x2bfe52=_0x2bfe52-0x0;var _0x1cf649=_0xce5c[_0x2bfe52];return _0x1cf649;};'use strict';var _=require(_0xcce5('0x0'));var util=require(_0xcce5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcce5('0x2'));var fs=require('fs');var Redis=require(_0xcce5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcce5('0x4'));var logger=require('../../config/logger')(_0xcce5('0x5'));var config=require(_0xcce5('0x6'));var jayson=require(_0xcce5('0x7'));var client=jayson[_0xcce5('0x8')][_0xcce5('0x9')]({'port':0x232a});config[_0xcce5('0xa')]=_[_0xcce5('0xb')](config[_0xcce5('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xcce5('0xc'))(new Redis(config[_0xcce5('0xa')]));require('./smsInteraction.socket')[_0xcce5('0xd')](socket);function respondWithRpcPromise(_0x397023,_0x175de3,_0x5c2fa4){return new BPromise(function(_0x489f94,_0x59cb9b){return client['request'](_0x397023,_0x5c2fa4)['then'](function(_0x20898d){logger['info'](_0xcce5('0xe'),_0x175de3,'request\x20sent');logger[_0xcce5('0xf')](_0xcce5('0x10'),_0x175de3,_0xcce5('0x11'),JSON['stringify'](_0x20898d));if(_0x20898d[_0xcce5('0x12')]){if(_0x20898d[_0xcce5('0x12')]['code']===0x1f4){logger[_0xcce5('0x12')](_0xcce5('0xe'),_0x175de3,_0x20898d[_0xcce5('0x12')][_0xcce5('0x13')]);return _0x59cb9b(_0x20898d[_0xcce5('0x12')][_0xcce5('0x13')]);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x175de3,_0x20898d[_0xcce5('0x12')]['message']);return _0x489f94(_0x20898d[_0xcce5('0x12')]['message']);}else{logger[_0xcce5('0x14')](_0xcce5('0xe'),_0x175de3,_0xcce5('0x11'));_0x489f94(_0x20898d[_0xcce5('0x15')][_0xcce5('0x13')]);}})[_0xcce5('0x16')](function(_0x106568){logger[_0xcce5('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x175de3,_0x106568);_0x59cb9b(_0x106568);});});}exports[_0xcce5('0x17')]=function(_0x2d3aad){var _0x6d4d23=this;return new Promise(function(_0x2804b7,_0x580686){return db[_0xcce5('0x18')][_0xcce5('0x19')](_0x2d3aad[_0xcce5('0x1a')],{'raw':_0x2d3aad['options']?_0x2d3aad[_0xcce5('0x1b')][_0xcce5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d3aad['options']?_0x2d3aad['options'][_0xcce5('0x1d')]||null:null,'attributes':_0x2d3aad[_0xcce5('0x1b')]?_0x2d3aad['options']['attributes']||null:null,'limit':_0x2d3aad[_0xcce5('0x1b')]?_0x2d3aad[_0xcce5('0x1b')]['limit']||null:null})[_0xcce5('0x1e')](function(_0x113613){logger[_0xcce5('0x14')](_0xcce5('0x17'),_0x2d3aad);logger[_0xcce5('0xf')]('UpdateSmsInteraction',_0x2d3aad,JSON[_0xcce5('0x1f')](_0x113613));_0x2804b7(_0x113613);})[_0xcce5('0x16')](function(_0x4113e8){logger['error'](_0xcce5('0x17'),_0x4113e8['message'],_0x2d3aad);_0x580686(_0x6d4d23[_0xcce5('0x12')](0x1f4,_0x4113e8[_0xcce5('0x13')]));});});};exports[_0xcce5('0x20')]=function(_0xd74e30){return new Promise(function(_0x5c8815,_0x3330e4){return db[_0xcce5('0x18')][_0xcce5('0x21')]({'where':_0xd74e30[_0xcce5('0x1b')]?_0xd74e30[_0xcce5('0x1b')][_0xcce5('0x1d')]||null:null})[_0xcce5('0x1e')](function(_0xb29007){if(_0xb29007){return _0xb29007[_0xcce5('0x22')](_0xd74e30[_0xcce5('0x1a')][_0xcce5('0x23')],_[_0xcce5('0x24')](_0xd74e30['body'],[_0xcce5('0x23'),'id'])||{});}})[_0xcce5('0x25')](function(_0x1c19ba){logger[_0xcce5('0x14')](_0xcce5('0x26'),_0xd74e30);logger[_0xcce5('0xf')](_0xcce5('0x26'),_0xd74e30,JSON['stringify'](_0x1c19ba));_0x5c8815(_0x1c19ba);})[_0xcce5('0x16')](function(_0x518fd8){logger[_0xcce5('0x12')](_0xcce5('0x26'),_0x518fd8[_0xcce5('0x13')],_0xd74e30);_0x3330e4(_this[_0xcce5('0x12')](0x1f4,_0x518fd8[_0xcce5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index b584d6f..6bdaa21 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 _0xae22=['save','remove','update','emit','removeListener','register','smsInteraction:'];(function(_0x2c0204,_0x4dcb2e){var _0x4f796a=function(_0x10cc1f){while(--_0x10cc1f){_0x2c0204['push'](_0x2c0204['shift']());}};_0x4f796a(++_0x4dcb2e);}(_0xae22,0x11f));var _0x2ae2=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xae22[_0x4cf98e];return _0x1623ac;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x2ae2('0x0'),_0x2ae2('0x1'),_0x2ae2('0x2')];function createListener(_0xcf1096,_0x49a5a4){return function(_0x452a3b){_0x49a5a4[_0x2ae2('0x3')](_0xcf1096,_0x452a3b);};}function removeListener(_0x3aa935,_0x5151c8){return function(){SmsInteractionEvents[_0x2ae2('0x4')](_0x3aa935,_0x5151c8);};}exports[_0x2ae2('0x5')]=function(_0x229d0f){for(var _0x3e39a1=0x0,_0x1aebef=events['length'];_0x3e39a1<_0x1aebef;_0x3e39a1++){var _0x202b18=events[_0x3e39a1];var _0x2ab486=createListener(_0x2ae2('0x6')+_0x202b18,_0x229d0f);SmsInteractionEvents['on'](_0x202b18,_0x2ab486);}}; \ No newline at end of file +var _0x1fae=['smsInteraction:','./smsInteraction.events','save','remove','update','emit','removeListener','length'];(function(_0x26e727,_0x3e65be){var _0x563800=function(_0xbcf999){while(--_0xbcf999){_0x26e727['push'](_0x26e727['shift']());}};_0x563800(++_0x3e65be);}(_0x1fae,0x81));var _0xe1fa=function(_0x24e8ad,_0x5d151b){_0x24e8ad=_0x24e8ad-0x0;var _0x3b24ff=_0x1fae[_0x24e8ad];return _0x3b24ff;};'use strict';var SmsInteractionEvents=require(_0xe1fa('0x0'));var events=[_0xe1fa('0x1'),_0xe1fa('0x2'),_0xe1fa('0x3')];function createListener(_0x54bc7c,_0x10411e){return function(_0x13faef){_0x10411e[_0xe1fa('0x4')](_0x54bc7c,_0x13faef);};}function removeListener(_0x56bc1f,_0x65486b){return function(){SmsInteractionEvents[_0xe1fa('0x5')](_0x56bc1f,_0x65486b);};}exports['register']=function(_0x57b279){for(var _0x2adcc4=0x0,_0x14fa6a=events[_0xe1fa('0x6')];_0x2adcc4<_0x14fa6a;_0x2adcc4++){var _0x2f7433=events[_0x2adcc4];var _0x4a7d71=createListener(_0xe1fa('0x7')+_0x2f7433,_0x57b279);SmsInteractionEvents['on'](_0x2f7433,_0x4a7d71);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 1d9a84f..d3ea227 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 _0x7317=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util'];(function(_0xebf32e,_0x1a9143){var _0x110adb=function(_0x3806a5){while(--_0x3806a5){_0xebf32e['push'](_0xebf32e['shift']());}};_0x110adb(++_0x1a9143);}(_0x7317,0xac));var _0x7731=function(_0x3250c0,_0x5b56fe){_0x3250c0=_0x3250c0-0x0;var _0x93f1d6=_0x7317[_0x3250c0];return _0x93f1d6;};'use strict';var multer=require(_0x7731('0x0'));var util=require(_0x7731('0x1'));var path=require(_0x7731('0x2'));var timeout=require('connect-timeout');var express=require(_0x7731('0x3'));var router=express[_0x7731('0x4')]();var fs_extra=require(_0x7731('0x5'));var auth=require(_0x7731('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7731('0x7'));var controller=require(_0x7731('0x8'));router[_0x7731('0x9')]('/',auth[_0x7731('0xa')](),controller['index']);router[_0x7731('0x9')](_0x7731('0xb'),auth[_0x7731('0xa')](),controller[_0x7731('0xc')]);router[_0x7731('0x9')](_0x7731('0xd'),auth[_0x7731('0xa')](),controller[_0x7731('0xe')]);router[_0x7731('0xf')]('/',auth[_0x7731('0xa')](),interaction[_0x7731('0x10')](_0x7731('0x11'),_0x7731('0x12')),controller[_0x7731('0x13')]);router['post'](_0x7731('0x14'),controller[_0x7731('0x15')]);router[_0x7731('0x16')]('/:id',auth[_0x7731('0xa')](),controller['update']);router[_0x7731('0x16')](_0x7731('0x17'),auth[_0x7731('0xa')](),controller['accept']);router[_0x7731('0x16')](_0x7731('0x18'),auth[_0x7731('0xa')](),controller[_0x7731('0x19')]);router[_0x7731('0x1a')](_0x7731('0xd'),auth[_0x7731('0xa')](),controller[_0x7731('0x1b')]);module[_0x7731('0x1c')]=router; \ No newline at end of file +var _0xcf8c=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','smsmessage:create','create','status','put','/:id/reject','delete'];(function(_0x51461b,_0x32ad42){var _0x1a66c4=function(_0x291777){while(--_0x291777){_0x51461b['push'](_0x51461b['shift']());}};_0x1a66c4(++_0x32ad42);}(_0xcf8c,0x122));var _0xccf8=function(_0x52d15f,_0x3a99e5){_0x52d15f=_0x52d15f-0x0;var _0x17c94f=_0xcf8c[_0x52d15f];return _0x17c94f;};'use strict';var multer=require(_0xccf8('0x0'));var util=require(_0xccf8('0x1'));var path=require(_0xccf8('0x2'));var timeout=require(_0xccf8('0x3'));var express=require('express');var router=express[_0xccf8('0x4')]();var fs_extra=require(_0xccf8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xccf8('0x6'));var config=require(_0xccf8('0x7'));var controller=require(_0xccf8('0x8'));router[_0xccf8('0x9')]('/',auth[_0xccf8('0xa')](),controller['index']);router[_0xccf8('0x9')](_0xccf8('0xb'),auth[_0xccf8('0xa')](),controller[_0xccf8('0xc')]);router[_0xccf8('0x9')](_0xccf8('0xd'),auth[_0xccf8('0xa')](),controller[_0xccf8('0xe')]);router[_0xccf8('0xf')]('/',auth[_0xccf8('0xa')](),interaction['tracked']('sms',_0xccf8('0x10')),controller[_0xccf8('0x11')]);router[_0xccf8('0xf')]('/:id/status',controller[_0xccf8('0x12')]);router[_0xccf8('0x13')](_0xccf8('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xccf8('0x13')]('/:id/accept',auth[_0xccf8('0xa')](),controller['accept']);router[_0xccf8('0x13')](_0xccf8('0x14'),auth['isAuthenticated'](),controller['reject']);router[_0xccf8('0x15')](_0xccf8('0xd'),auth[_0xccf8('0xa')](),controller[_0xccf8('0x16')]);module[_0xccf8('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index f02ec7c..bb6051d 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 _0x681d=['BOOLEAN','out','DATE','STRING','exports','TEXT','medium'];(function(_0x24820e,_0x3c54cd){var _0xb50ede=function(_0x5add2c){while(--_0x5add2c){_0x24820e['push'](_0x24820e['shift']());}};_0xb50ede(++_0x3c54cd);}(_0x681d,0xf9));var _0xd681=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x681d[_0x2dea24];return _0x309d58;};'use strict';var Sequelize=require('sequelize');module[_0xd681('0x0')]={'body':{'type':Sequelize[_0xd681('0x1')](_0xd681('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xd681('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd681('0x4')),'defaultValue':_0xd681('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xd681('0x5')]},'secret':{'type':Sequelize[_0xd681('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd681('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1d6f=['BOOLEAN','out','STRING','TEXT','sequelize'];(function(_0x9e8285,_0x9ac973){var _0xf8a837=function(_0x1d7276){while(--_0x1d7276){_0x9e8285['push'](_0x9e8285['shift']());}};_0xf8a837(++_0x9ac973);}(_0x1d6f,0x171));var _0xf1d6=function(_0x77d589,_0x3e609a){_0x77d589=_0x77d589-0x0;var _0x301618=_0x1d6f[_0x77d589];return _0x301618;};'use strict';var Sequelize=require(_0xf1d6('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf1d6('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf1d6('0x2')),'defaultValue':_0xf1d6('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf1d6('0x3')](0xbe)},'phone':{'type':Sequelize[_0xf1d6('0x3')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xf1d6('0x1')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf1d6('0x3')]},'providerResponse':{'type':Sequelize[_0xf1d6('0x4')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 671d879..749f6eb 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 _0x5abf=['then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','SmsMessage,\x20%s,\x20%s','message','error','catch','sendStatus','status','undefined','limit','count','offset','set','Content-Range','save','update','destroy','end','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','SmsMessage','includeAll','include','findAll','rows','show','params','keys','find','create','describe','sms-interactions','sms','body','read','readAt','UserId','agent','get','isNil','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','channel','event','EventManager','reject','RejectMessage','rejectMessage','email','interface','SIP/%s','motionChannel','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','./smsMessage.socket','register','jayson/promise','client','http','request'];(function(_0x13d2a5,_0x5016a4){var _0x437a87=function(_0x54854d){while(--_0x54854d){_0x13d2a5['push'](_0x13d2a5['shift']());}};_0x437a87(++_0x5016a4);}(_0x5abf,0x72));var _0xf5ab=function(_0x5341ff,_0x1de6df){_0x5341ff=_0x5341ff-0x0;var _0x53be58=_0x5abf[_0x5341ff];return _0x53be58;};'use strict';var emlformat=require(_0xf5ab('0x0'));var rimraf=require(_0xf5ab('0x1'));var zipdir=require(_0xf5ab('0x2'));var jsonpatch=require(_0xf5ab('0x3'));var rp=require(_0xf5ab('0x4'));var moment=require(_0xf5ab('0x5'));var BPromise=require(_0xf5ab('0x6'));var Mustache=require('mustache');var util=require(_0xf5ab('0x7'));var path=require(_0xf5ab('0x8'));var sox=require(_0xf5ab('0x9'));var csv=require(_0xf5ab('0xa'));var ejs=require(_0xf5ab('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf5ab('0xc'));var squel=require(_0xf5ab('0xd'));var crypto=require(_0xf5ab('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf5ab('0xf'));var toCsv=require(_0xf5ab('0xa'));var querystring=require('querystring');var Papa=require(_0xf5ab('0x10'));var Redis=require('ioredis');var authService=require(_0xf5ab('0x11'));var qs=require(_0xf5ab('0x12'));var as=require(_0xf5ab('0x13'));var hardwareService=require(_0xf5ab('0x14'));var logger=require(_0xf5ab('0x15'))(_0xf5ab('0x16'));var utils=require(_0xf5ab('0x17'));var config=require(_0xf5ab('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xf5ab('0x19')]=_[_0xf5ab('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf5ab('0x19')]));require(_0xf5ab('0x1b'))[_0xf5ab('0x1c')](socket);var jayson=require(_0xf5ab('0x1d'));var client=jayson[_0xf5ab('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xf5ab('0x1e')][_0xf5ab('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x50e8fa,_0x19a1ff,_0x1db38a,_0x20bbd3){return new BPromise(function(_0x2bd5ec,_0x226f39){var _0x65166f=_0x20bbd3||client;return _0x65166f[_0xf5ab('0x20')](_0x50e8fa,_0x1db38a)[_0xf5ab('0x21')](function(_0x390059){logger[_0xf5ab('0x22')]('SmsMessage,\x20%s,\x20%s',_0x19a1ff,_0xf5ab('0x23'));logger[_0xf5ab('0x24')](_0xf5ab('0x25'),_0x19a1ff,_0xf5ab('0x23'),JSON[_0xf5ab('0x26')](_0x390059));if(_0x390059['error']){if(_0x390059['error'][_0xf5ab('0x27')]===0x1f4){logger['error'](_0xf5ab('0x28'),_0x19a1ff,_0x390059['error'][_0xf5ab('0x29')]);return _0x226f39(_0x390059[_0xf5ab('0x2a')][_0xf5ab('0x29')]);}logger[_0xf5ab('0x2a')](_0xf5ab('0x28'),_0x19a1ff,_0x390059['error']['message']);return _0x2bd5ec(_0x390059[_0xf5ab('0x2a')][_0xf5ab('0x29')]);}else{logger[_0xf5ab('0x22')](_0xf5ab('0x28'),_0x19a1ff,_0xf5ab('0x23'));_0x2bd5ec(_0x390059['result']['message']);}})[_0xf5ab('0x2b')](function(_0x2dd9ba){logger[_0xf5ab('0x2a')](_0xf5ab('0x28'),_0x19a1ff,_0x2dd9ba);_0x226f39(_0x2dd9ba);});});}function respondWithStatusCode(_0x1436d6,_0x580d91){_0x580d91=_0x580d91||0xcc;return function(_0x45cd81){if(_0x45cd81){return _0x1436d6[_0xf5ab('0x2c')](_0x580d91);}return _0x1436d6['status'](_0x580d91)['end']();};}function respondWithResult(_0x1bc6e5,_0xd0526e){_0xd0526e=_0xd0526e||0xc8;return function(_0x1703f4){if(_0x1703f4){return _0x1bc6e5[_0xf5ab('0x2d')](_0xd0526e)['json'](_0x1703f4);}};}function respondWithFilteredResult(_0x114a4d,_0x4fd271){return function(_0x5518a1){if(_0x5518a1){var _0x41d4f6=typeof _0x4fd271['offset']===_0xf5ab('0x2e')&&typeof _0x4fd271[_0xf5ab('0x2f')]===_0xf5ab('0x2e');var _0x3406a7=_0x5518a1[_0xf5ab('0x30')];var _0x202a5d=_0x41d4f6?0x0:_0x4fd271[_0xf5ab('0x31')];var _0xa30edd=_0x41d4f6?_0x5518a1[_0xf5ab('0x30')]:_0x4fd271[_0xf5ab('0x31')]+_0x4fd271[_0xf5ab('0x2f')];var _0x33d778;if(_0xa30edd>=_0x3406a7){_0xa30edd=_0x3406a7;_0x33d778=0xc8;}else{_0x33d778=0xce;}_0x114a4d[_0xf5ab('0x2d')](_0x33d778);return _0x114a4d[_0xf5ab('0x32')](_0xf5ab('0x33'),_0x202a5d+'-'+_0xa30edd+'/'+_0x3406a7)['json'](_0x5518a1);}return null;};}function patchUpdates(_0xecdc76){return function(_0x2ea9c3){try{jsonpatch['apply'](_0x2ea9c3,_0xecdc76,!![]);}catch(_0x35362e){return BPromise['reject'](_0x35362e);}return _0x2ea9c3[_0xf5ab('0x34')]();};}function saveUpdates(_0x2e0afc,_0x23914d){return function(_0x37684c){if(_0x37684c){return _0x37684c[_0xf5ab('0x35')](_0x2e0afc)[_0xf5ab('0x21')](function(_0xbc5357){return _0xbc5357;});}return null;};}function removeEntity(_0x3488d8,_0x2ed05f){return function(_0x429c0a){if(_0x429c0a){return _0x429c0a[_0xf5ab('0x36')]()[_0xf5ab('0x21')](function(){_0x3488d8[_0xf5ab('0x2d')](0xcc)[_0xf5ab('0x37')]();});}};}function handleEntityNotFound(_0x1cdedc,_0x290278){return function(_0xbfe28d){if(!_0xbfe28d){_0x1cdedc[_0xf5ab('0x2c')](0x194);}return _0xbfe28d;};}function handleError(_0x233a31,_0x27f523){_0x27f523=_0x27f523||0x1f4;return function(_0x2df5dd){logger[_0xf5ab('0x2a')](_0x2df5dd[_0xf5ab('0x38')]);if(_0x2df5dd[_0xf5ab('0x39')]){delete _0x2df5dd[_0xf5ab('0x39')];}_0x233a31[_0xf5ab('0x2d')](_0x27f523)['send'](_0x2df5dd);};}exports[_0xf5ab('0x3a')]=function(_0x45427a,_0x49f704){var _0xb30095={},_0x362543={},_0x1d52b6={'count':0x0,'rows':[]};var _0x300fa2=_[_0xf5ab('0x3b')](db['SmsMessage'][_0xf5ab('0x3c')],function(_0x820d50){return{'name':_0x820d50[_0xf5ab('0x3d')],'type':_0x820d50[_0xf5ab('0x3e')][_0xf5ab('0x3f')]};});_0x362543[_0xf5ab('0x40')]=_[_0xf5ab('0x3b')](_0x300fa2,_0xf5ab('0x39'));_0x362543[_0xf5ab('0x41')]=_['keys'](_0x45427a[_0xf5ab('0x41')]);_0x362543[_0xf5ab('0x42')]=_['intersection'](_0x362543['model'],_0x362543[_0xf5ab('0x41')]);_0xb30095[_0xf5ab('0x43')]=_[_0xf5ab('0x44')](_0x362543[_0xf5ab('0x40')],qs[_0xf5ab('0x45')](_0x45427a[_0xf5ab('0x41')][_0xf5ab('0x45')]));_0xb30095[_0xf5ab('0x43')]=_0xb30095[_0xf5ab('0x43')][_0xf5ab('0x46')]?_0xb30095[_0xf5ab('0x43')]:_0x362543[_0xf5ab('0x40')];if(!_0x45427a['query'][_0xf5ab('0x47')]('nolimit')){_0xb30095[_0xf5ab('0x2f')]=qs[_0xf5ab('0x2f')](_0x45427a[_0xf5ab('0x41')][_0xf5ab('0x2f')]);_0xb30095[_0xf5ab('0x31')]=qs['offset'](_0x45427a[_0xf5ab('0x41')][_0xf5ab('0x31')]);}_0xb30095[_0xf5ab('0x48')]=qs[_0xf5ab('0x49')](_0x45427a[_0xf5ab('0x41')]['sort']);_0xb30095[_0xf5ab('0x4a')]=qs[_0xf5ab('0x42')](_[_0xf5ab('0x4b')](_0x45427a[_0xf5ab('0x41')],_0x362543[_0xf5ab('0x42')]),_0x300fa2);if(_0x45427a[_0xf5ab('0x41')]['filter']){_0xb30095[_0xf5ab('0x4a')]=_[_0xf5ab('0x4c')](_0xb30095[_0xf5ab('0x4a')],{'$or':_[_0xf5ab('0x3b')](_0x300fa2,function(_0x38345d){if(_0x38345d[_0xf5ab('0x3e')]!==_0xf5ab('0x4d')){var _0x263a41={};_0x263a41[_0x38345d[_0xf5ab('0x39')]]={'$like':'%'+_0x45427a[_0xf5ab('0x41')][_0xf5ab('0x4e')]+'%'};return _0x263a41;}})});}_0xb30095=_[_0xf5ab('0x4c')]({},_0xb30095,_0x45427a[_0xf5ab('0x4f')]);var _0x2e1251={'where':_0xb30095[_0xf5ab('0x4a')]};return db[_0xf5ab('0x50')]['count'](_0x2e1251)['then'](function(_0x503b83){_0x1d52b6[_0xf5ab('0x30')]=_0x503b83;if(_0x45427a['query'][_0xf5ab('0x51')]){_0xb30095[_0xf5ab('0x52')]=[{'all':!![]}];}return db[_0xf5ab('0x50')][_0xf5ab('0x53')](_0xb30095);})[_0xf5ab('0x21')](function(_0x3ba6d3){_0x1d52b6[_0xf5ab('0x54')]=_0x3ba6d3;return _0x1d52b6;})[_0xf5ab('0x21')](respondWithFilteredResult(_0x49f704,_0xb30095))['catch'](handleError(_0x49f704,null));};exports[_0xf5ab('0x55')]=function(_0x59e3c6,_0x4a70d9){var _0x55c2b0={'raw':!![],'where':{'id':_0x59e3c6[_0xf5ab('0x56')]['id']}},_0x5a5063={};_0x5a5063['model']=_['keys'](db[_0xf5ab('0x50')][_0xf5ab('0x3c')]);_0x5a5063[_0xf5ab('0x41')]=_[_0xf5ab('0x57')](_0x59e3c6[_0xf5ab('0x41')]);_0x5a5063['filters']=_[_0xf5ab('0x44')](_0x5a5063[_0xf5ab('0x40')],_0x5a5063[_0xf5ab('0x41')]);_0x55c2b0[_0xf5ab('0x43')]=_[_0xf5ab('0x44')](_0x5a5063[_0xf5ab('0x40')],qs[_0xf5ab('0x45')](_0x59e3c6[_0xf5ab('0x41')][_0xf5ab('0x45')]));_0x55c2b0[_0xf5ab('0x43')]=_0x55c2b0['attributes'][_0xf5ab('0x46')]?_0x55c2b0[_0xf5ab('0x43')]:_0x5a5063[_0xf5ab('0x40')];if(_0x59e3c6['query'][_0xf5ab('0x51')]){_0x55c2b0[_0xf5ab('0x52')]=[{'all':!![]}];}_0x55c2b0=_[_0xf5ab('0x4c')]({},_0x55c2b0,_0x59e3c6[_0xf5ab('0x4f')]);return db[_0xf5ab('0x50')][_0xf5ab('0x58')](_0x55c2b0)[_0xf5ab('0x21')](handleEntityNotFound(_0x4a70d9,null))[_0xf5ab('0x21')](respondWithResult(_0x4a70d9,null))[_0xf5ab('0x2b')](handleError(_0x4a70d9,null));};exports[_0xf5ab('0x59')]=function(_0x2fc9d6,_0x513894){return db[_0xf5ab('0x50')][_0xf5ab('0x59')](_0x2fc9d6['body'],{})['then'](respondWithResult(_0x513894,0xc9))[_0xf5ab('0x2b')](handleError(_0x513894,null));};exports[_0xf5ab('0x35')]=function(_0x313a04,_0xad00a){if(_0x313a04['body']['id']){delete _0x313a04['body']['id'];}return db[_0xf5ab('0x50')][_0xf5ab('0x58')]({'where':{'id':_0x313a04[_0xf5ab('0x56')]['id']}})[_0xf5ab('0x21')](handleEntityNotFound(_0xad00a,null))[_0xf5ab('0x21')](saveUpdates(_0x313a04['body'],null))[_0xf5ab('0x21')](respondWithResult(_0xad00a,null))[_0xf5ab('0x2b')](handleError(_0xad00a,null));};exports[_0xf5ab('0x36')]=function(_0xba4d,_0x5f96ba){return db[_0xf5ab('0x50')][_0xf5ab('0x58')]({'where':{'id':_0xba4d[_0xf5ab('0x56')]['id']}})[_0xf5ab('0x21')](handleEntityNotFound(_0x5f96ba,null))[_0xf5ab('0x21')](removeEntity(_0x5f96ba,null))[_0xf5ab('0x2b')](handleError(_0x5f96ba,null));};exports[_0xf5ab('0x5a')]=function(_0x3433eb,_0x452edf){return db[_0xf5ab('0x50')][_0xf5ab('0x5a')]()[_0xf5ab('0x21')](respondWithResult(_0x452edf,null))[_0xf5ab('0x2b')](handleError(_0x452edf,null));};var interaction_log=require('../../config/logger')(_0xf5ab('0x5b'));exports['accept']=function(_0x472a29,_0x5419fc,_0x417409){var _0x52a681={'agent':{},'channel':_0xf5ab('0x5c')};if(_0x472a29['body']['id']){delete _0x472a29[_0xf5ab('0x5d')]['id'];}_0x472a29[_0xf5ab('0x5d')][_0xf5ab('0x5e')]=!![];_0x472a29[_0xf5ab('0x5d')][_0xf5ab('0x5f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x472a29[_0xf5ab('0x5d')][_0xf5ab('0x60')]=_0x472a29['body'][_0xf5ab('0x60')]||_0x472a29['user']['id'];_0x52a681[_0xf5ab('0x61')]['id']=_0x472a29[_0xf5ab('0x5d')][_0xf5ab('0x60')];return db[_0xf5ab('0x50')][_0xf5ab('0x58')]({'where':{'id':_0x472a29['params']['id'],'UserId':null}})[_0xf5ab('0x21')](handleEntityNotFound(_0x5419fc,null))[_0xf5ab('0x21')](saveUpdates(_0x472a29['body'],null))[_0xf5ab('0x21')](function(_0x26a6cd){if(_0x26a6cd){_0x52a681[_0xf5ab('0x29')]=_0x26a6cd[_0xf5ab('0x62')]({'plain':!![]});return db['SmsInteraction'][_0xf5ab('0x58')]({'where':{'id':_0x26a6cd['SmsInteractionId']}});}return null;})[_0xf5ab('0x21')](handleEntityNotFound(_0x5419fc,null))[_0xf5ab('0x21')](function(_0x1c5830){if(_0x1c5830){return _0x1c5830[_0xf5ab('0x35')]({'UserId':_0x472a29[_0xf5ab('0x5d')]['UserId'],'read1stAt':_[_0xf5ab('0x63')](_0x1c5830['read1stAt'])?moment()[_0xf5ab('0x64')](_0xf5ab('0x65')):undefined});}return null;})['then'](function(_0x596ebb){if(_0x596ebb){_0x52a681[_0xf5ab('0x66')]=_0x596ebb[_0xf5ab('0x62')]({'plain':!![]});interaction_log[_0xf5ab('0x22')](_0xf5ab('0x67'),_0x472a29[_0xf5ab('0x68')]['id'],_0x472a29['user'][_0xf5ab('0x39')],_0x472a29['user']['role'],_0x52a681[_0xf5ab('0x66')]['id'],_0x472a29[_0xf5ab('0x5d')]?JSON[_0xf5ab('0x26')](_0x472a29[_0xf5ab('0x5d')]):_0xf5ab('0x69'));return respondWithRpcPromise(_0xf5ab('0x6a'),'acceptMessage',_0x52a681);}return null;})[_0xf5ab('0x21')](function(_0x3e3c21){var _0x5e370b=_0xf5ab('0x6b')+_0x3e3c21['message'][_0xf5ab('0x6c')];return db[_0xf5ab('0x6d')]['query'](_0x5e370b,{'type':db[_0xf5ab('0x6e')][_0xf5ab('0x6f')][_0xf5ab('0x70')],'raw':!![]})['then'](function(_0x1215ca){return _0x1215ca;});})['then'](function(_0x2d36e9){if(_0x2d36e9){_0x52a681['message'][_0xf5ab('0x71')]=_0x2d36e9[0x0];if(!_0x472a29['body'][_0xf5ab('0x60')])return;return db[_0xf5ab('0x72')][_0xf5ab('0x58')]({'where':{'id':_0x472a29[_0xf5ab('0x5d')][_0xf5ab('0x60')],'role':_0xf5ab('0x61')},'attributes':['id',_0xf5ab('0x39'),_0xf5ab('0x73'),'email',_0xf5ab('0x74')],'raw':!![]});}return null;})[_0xf5ab('0x21')](function(_0x370ba5){if(!_0x370ba5)return null;_0x52a681[_0xf5ab('0x29')]['agent']=_0x370ba5;return _0x52a681;})[_0xf5ab('0x21')](function(_0xea2f9b){if(_0xea2f9b){if(_0x472a29[_0xf5ab('0x5d')][_0xf5ab('0x75')]){_0x52a681[_0xf5ab('0x29')]['interface']=util[_0xf5ab('0x64')]('SIP/%s',_0x472a29[_0xf5ab('0x68')]['name']);_0x52a681[_0xf5ab('0x29')][_0xf5ab('0x76')]=_0x52a681['channel'];_0x52a681[_0xf5ab('0x29')]['motionChannel']=_0x52a681['channel'];_0x52a681[_0xf5ab('0x29')][_0xf5ab('0x77')]='accept';return respondWithRpcPromise(_0xf5ab('0x78'),_0xf5ab('0x78'),{'event':'acceptmessage','message':_0x52a681['message']},client9002)[_0xf5ab('0x21')](function(){return _0x52a681;});}return _0x52a681;}return null;})[_0xf5ab('0x21')](respondWithResult(_0x5419fc,null))[_0xf5ab('0x2b')](handleError(_0x5419fc,null));};var interaction_log=require(_0xf5ab('0x15'))(_0xf5ab('0x5b'));exports[_0xf5ab('0x79')]=function(_0x76bb32,_0x3eb545,_0x595f1d){var _0xf6680b={'agent':{},'channel':_0xf5ab('0x5c')};if(_0x76bb32[_0xf5ab('0x5d')]['id']){delete _0x76bb32[_0xf5ab('0x5d')]['id'];}_0x76bb32[_0xf5ab('0x5d')][_0xf5ab('0x60')]=_0x76bb32['body']['UserId']||_0x76bb32[_0xf5ab('0x68')]['id'];_0xf6680b['agent']['id']=_0x76bb32['body']['UserId'];return db[_0xf5ab('0x50')]['find']({'where':{'id':_0x76bb32['params']['id'],'UserId':null}})[_0xf5ab('0x21')](handleEntityNotFound(_0x3eb545,null))['then'](function(_0x538ab4){if(_0x538ab4){_0xf6680b['message']=_0x538ab4[_0xf5ab('0x62')]({'plain':!![]});return db['SmsInteraction'][_0xf5ab('0x58')]({'where':{'id':_0x538ab4['SmsInteractionId']}});}return null;})[_0xf5ab('0x21')](handleEntityNotFound(_0x3eb545,null))[_0xf5ab('0x21')](function(_0x903f91){if(_0x903f91){_0xf6680b['interaction']=_0x903f91['get']({'plain':!![]});interaction_log[_0xf5ab('0x22')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x76bb32[_0xf5ab('0x68')]['id'],_0x76bb32[_0xf5ab('0x68')][_0xf5ab('0x39')],_0x76bb32['user']['role'],_0xf6680b[_0xf5ab('0x66')]['id'],_0x76bb32['body']?JSON[_0xf5ab('0x26')](_0x76bb32['body']):_0xf5ab('0x69'));return respondWithRpcPromise(_0xf5ab('0x7a'),_0xf5ab('0x7b'),_0xf6680b);}return null;})[_0xf5ab('0x21')](function(_0x2a7ea8){var _0x234b0d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2a7ea8['message']['ContactId'];return db['sequelize'][_0xf5ab('0x41')](_0x234b0d,{'type':db[_0xf5ab('0x6e')][_0xf5ab('0x6f')][_0xf5ab('0x70')],'raw':!![]})[_0xf5ab('0x21')](function(_0x39e4b2){return _0x39e4b2;});})[_0xf5ab('0x21')](function(_0x47e4fc){if(_0x47e4fc){_0xf6680b['message'][_0xf5ab('0x71')]=_0x47e4fc[0x0];if(!_0x76bb32[_0xf5ab('0x5d')]['UserId'])return;return db['User'][_0xf5ab('0x58')]({'where':{'id':_0x76bb32['body'][_0xf5ab('0x60')],'role':_0xf5ab('0x61')},'attributes':['id',_0xf5ab('0x39'),_0xf5ab('0x73'),_0xf5ab('0x7c'),_0xf5ab('0x74')],'raw':!![]});}return null;})['then'](function(_0x3117d5){if(!_0x3117d5)return null;_0xf6680b[_0xf5ab('0x29')]['agent']=_0x3117d5;return _0xf6680b;})[_0xf5ab('0x21')](function(_0x41f9cb){if(_0x41f9cb){_0x41f9cb['message'][_0xf5ab('0x7d')]=util['format'](_0xf5ab('0x7e'),_0x76bb32[_0xf5ab('0x68')][_0xf5ab('0x39')]);_0x41f9cb[_0xf5ab('0x29')][_0xf5ab('0x76')]=_0xf6680b[_0xf5ab('0x76')];_0x41f9cb['message'][_0xf5ab('0x7f')]=_0xf6680b['channel'];_0x41f9cb[_0xf5ab('0x29')]['event']=_0xf5ab('0x79');respondWithRpcPromise('EventManager',_0xf5ab('0x78'),{'event':_0xf5ab('0x80'),'message':_0x41f9cb[_0xf5ab('0x29')]},client9002);return _0xf6680b;}return null;})[_0xf5ab('0x21')](respondWithResult(_0x3eb545,null))[_0xf5ab('0x2b')](handleError(_0x3eb545,null));};exports[_0xf5ab('0x2d')]=function(_0x1e6c8b,_0x323a81,_0x280615){if(_0x1e6c8b[_0xf5ab('0x5d')]['id']){delete _0x1e6c8b[_0xf5ab('0x5d')]['id'];}var _0x344c61;return db[_0xf5ab('0x50')]['find']({'where':{'id':_0x1e6c8b[_0xf5ab('0x56')]['id']}})[_0xf5ab('0x21')](handleEntityNotFound(_0x323a81,null))[_0xf5ab('0x21')](function(_0x24c4a0){if(_0x24c4a0){_0x344c61=_0x24c4a0;return db[_0xf5ab('0x81')][_0xf5ab('0x58')]({'where':{'id':_0x24c4a0[_0xf5ab('0x82')]}});}})[_0xf5ab('0x21')](handleEntityNotFound(_0x323a81,null))[_0xf5ab('0x21')](function(_0x105369){if(_0x105369){logger['debug'](_0xf5ab('0x25'),_0xf5ab('0x2d'),_0xf5ab('0x83'),_0x105369[_0xf5ab('0x3e')],util[_0xf5ab('0x84')](_0x1e6c8b['body'],{'showHidden':![],'depth':null}));switch(_0x105369['type']){case _0xf5ab('0x85'):if(_0x1e6c8b['body'][_0xf5ab('0x86')]&&_0x1e6c8b[_0xf5ab('0x5d')]['MessageSid']===_0x344c61[_0xf5ab('0x87')]){return _0x344c61[_0xf5ab('0x35')]({'read':!![]});}else{logger['error'](_0xf5ab('0x88'),'status',_0xf5ab('0x85'),util[_0xf5ab('0x84')](_0x1e6c8b['body'],{'showHidden':![],'depth':null}));}break;case _0xf5ab('0x89'):if(_0x1e6c8b['body'][_0xf5ab('0x8a')]&&_0x1e6c8b[_0xf5ab('0x5d')][_0xf5ab('0x8a')]===_0x344c61['messageId']&&_[_0xf5ab('0x8b')]([_0xf5ab('0x8c'),_0xf5ab('0x8d')],_0x1e6c8b[_0xf5ab('0x5d')][_0xf5ab('0x8e')])>=0x0){return _0x344c61[_0xf5ab('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf5ab('0x2d'),'plivio',util['inspect'](_0x1e6c8b[_0xf5ab('0x5d')],{'showHidden':![],'depth':null}));}break;case _0xf5ab('0x8f'):var _0x9491a6=_0x1e6c8b[_0xf5ab('0x5d')][_0xf5ab('0x90')][0x0];if(_0x9491a6[_0xf5ab('0x2d')][_0xf5ab('0x91')]===_0xf5ab('0x92')){return _0x344c61[_0xf5ab('0x35')]({'read':!![]});}else{logger[_0xf5ab('0x2a')](_0xf5ab('0x88'),'status',_0xf5ab('0x8f'),util[_0xf5ab('0x84')](_0x1e6c8b[_0xf5ab('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x344c61;}})[_0xf5ab('0x21')](respondWithResult(_0x323a81,null))[_0xf5ab('0x2b')](handleError(_0x323a81,null));}; \ No newline at end of file +var _0xe1d1=['results','groupName','infobip','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','then','stack','name','index','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','SmsMessage','findAll','rows','show','options','find','create','body','update','params','destroy','describe','sms-interactions','accept','sms','read','readAt','format','UserId','get','SmsInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','info','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','email','interface','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','Status','plivio'];(function(_0x189d3c,_0x5efebf){var _0x485959=function(_0x1161da){while(--_0x1161da){_0x189d3c['push'](_0x189d3c['shift']());}};_0x485959(++_0x5efebf);}(_0xe1d1,0x131));var _0x1e1d=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xe1d1[_0x3070dc];return _0x431489;};'use strict';var emlformat=require(_0x1e1d('0x0'));var rimraf=require(_0x1e1d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e1d('0x2'));var rp=require(_0x1e1d('0x3'));var moment=require(_0x1e1d('0x4'));var BPromise=require(_0x1e1d('0x5'));var Mustache=require('mustache');var util=require(_0x1e1d('0x6'));var path=require(_0x1e1d('0x7'));var sox=require(_0x1e1d('0x8'));var csv=require(_0x1e1d('0x9'));var ejs=require(_0x1e1d('0xa'));var fs=require('fs');var fs_extra=require(_0x1e1d('0xb'));var _=require('lodash');var squel=require(_0x1e1d('0xc'));var crypto=require(_0x1e1d('0xd'));var jsforce=require(_0x1e1d('0xe'));var deskjs=require(_0x1e1d('0xf'));var toCsv=require(_0x1e1d('0x9'));var querystring=require(_0x1e1d('0x10'));var Papa=require('papaparse');var Redis=require(_0x1e1d('0x11'));var authService=require(_0x1e1d('0x12'));var qs=require(_0x1e1d('0x13'));var as=require(_0x1e1d('0x14'));var hardwareService=require(_0x1e1d('0x15'));var logger=require(_0x1e1d('0x16'))(_0x1e1d('0x17'));var utils=require('../../config/utils');var config=require(_0x1e1d('0x18'));var licenseUtil=require(_0x1e1d('0x19'));var db=require(_0x1e1d('0x1a'))['db'];config[_0x1e1d('0x1b')]=_[_0x1e1d('0x1c')](config['redis'],{'host':_0x1e1d('0x1d'),'port':0x18eb});var socket=require(_0x1e1d('0x1e'))(new Redis(config[_0x1e1d('0x1b')]));require('./smsMessage.socket')[_0x1e1d('0x1f')](socket);var jayson=require(_0x1e1d('0x20'));var client=jayson[_0x1e1d('0x21')][_0x1e1d('0x22')]({'port':0x232c});var client9002=jayson[_0x1e1d('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16cdf5,_0x466bdb,_0x2bc2cf,_0x274b76){return new BPromise(function(_0x2139f2,_0x34f061){var _0x423ca3=_0x274b76||client;return _0x423ca3[_0x1e1d('0x23')](_0x16cdf5,_0x2bc2cf)['then'](function(_0x46f6e6){logger['info'](_0x1e1d('0x24'),_0x466bdb,'request\x20sent');logger[_0x1e1d('0x25')](_0x1e1d('0x26'),_0x466bdb,_0x1e1d('0x27'),JSON[_0x1e1d('0x28')](_0x46f6e6));if(_0x46f6e6[_0x1e1d('0x29')]){if(_0x46f6e6['error'][_0x1e1d('0x2a')]===0x1f4){logger[_0x1e1d('0x29')](_0x1e1d('0x24'),_0x466bdb,_0x46f6e6['error']['message']);return _0x34f061(_0x46f6e6[_0x1e1d('0x29')][_0x1e1d('0x2b')]);}logger['error'](_0x1e1d('0x24'),_0x466bdb,_0x46f6e6[_0x1e1d('0x29')][_0x1e1d('0x2b')]);return _0x2139f2(_0x46f6e6[_0x1e1d('0x29')][_0x1e1d('0x2b')]);}else{logger['info'](_0x1e1d('0x24'),_0x466bdb,'request\x20sent');_0x2139f2(_0x46f6e6['result'][_0x1e1d('0x2b')]);}})[_0x1e1d('0x2c')](function(_0x513371){logger['error'](_0x1e1d('0x24'),_0x466bdb,_0x513371);_0x34f061(_0x513371);});});}function respondWithStatusCode(_0x12f7b2,_0x5a62d2){_0x5a62d2=_0x5a62d2||0xcc;return function(_0x17e167){if(_0x17e167){return _0x12f7b2[_0x1e1d('0x2d')](_0x5a62d2);}return _0x12f7b2[_0x1e1d('0x2e')](_0x5a62d2)[_0x1e1d('0x2f')]();};}function respondWithResult(_0x82ee43,_0x15f703){_0x15f703=_0x15f703||0xc8;return function(_0x3c1181){if(_0x3c1181){return _0x82ee43['status'](_0x15f703)[_0x1e1d('0x30')](_0x3c1181);}};}function respondWithFilteredResult(_0x136dc1,_0x3f93b8){return function(_0xb1388b){if(_0xb1388b){var _0x5f2fc1=typeof _0x3f93b8['offset']===_0x1e1d('0x31')&&typeof _0x3f93b8[_0x1e1d('0x32')]===_0x1e1d('0x31');var _0x57cd79=_0xb1388b[_0x1e1d('0x33')];var _0x5959d7=_0x5f2fc1?0x0:_0x3f93b8[_0x1e1d('0x34')];var _0x45a41f=_0x5f2fc1?_0xb1388b[_0x1e1d('0x33')]:_0x3f93b8[_0x1e1d('0x34')]+_0x3f93b8[_0x1e1d('0x32')];var _0xa01d10;if(_0x45a41f>=_0x57cd79){_0x45a41f=_0x57cd79;_0xa01d10=0xc8;}else{_0xa01d10=0xce;}_0x136dc1[_0x1e1d('0x2e')](_0xa01d10);return _0x136dc1['set']('Content-Range',_0x5959d7+'-'+_0x45a41f+'/'+_0x57cd79)[_0x1e1d('0x30')](_0xb1388b);}return null;};}function patchUpdates(_0x5be62d){return function(_0x5edc5b){try{jsonpatch[_0x1e1d('0x35')](_0x5edc5b,_0x5be62d,!![]);}catch(_0x42ef46){return BPromise[_0x1e1d('0x36')](_0x42ef46);}return _0x5edc5b['save']();};}function saveUpdates(_0x46c51c,_0x3eae1a){return function(_0x315012){if(_0x315012){return _0x315012['update'](_0x46c51c)['then'](function(_0x1db528){return _0x1db528;});}return null;};}function removeEntity(_0x353037,_0x1a60f9){return function(_0x49522b){if(_0x49522b){return _0x49522b['destroy']()[_0x1e1d('0x37')](function(){_0x353037[_0x1e1d('0x2e')](0xcc)[_0x1e1d('0x2f')]();});}};}function handleEntityNotFound(_0x172539,_0x4b2efa){return function(_0x13c72c){if(!_0x13c72c){_0x172539['sendStatus'](0x194);}return _0x13c72c;};}function handleError(_0x2fa92e,_0x4db418){_0x4db418=_0x4db418||0x1f4;return function(_0x25c7b6){logger[_0x1e1d('0x29')](_0x25c7b6[_0x1e1d('0x38')]);if(_0x25c7b6[_0x1e1d('0x39')]){delete _0x25c7b6['name'];}_0x2fa92e[_0x1e1d('0x2e')](_0x4db418)['send'](_0x25c7b6);};}exports[_0x1e1d('0x3a')]=function(_0x4f0820,_0x3917b2){var _0x2cd83d={},_0xbf821a={},_0x94097a={'count':0x0,'rows':[]};var _0x51d998=_['map'](db['SmsMessage'][_0x1e1d('0x3b')],function(_0x25394b){return{'name':_0x25394b['fieldName'],'type':_0x25394b[_0x1e1d('0x3c')][_0x1e1d('0x3d')]};});_0xbf821a[_0x1e1d('0x3e')]=_[_0x1e1d('0x3f')](_0x51d998,'name');_0xbf821a[_0x1e1d('0x40')]=_[_0x1e1d('0x41')](_0x4f0820[_0x1e1d('0x40')]);_0xbf821a['filters']=_[_0x1e1d('0x42')](_0xbf821a['model'],_0xbf821a[_0x1e1d('0x40')]);_0x2cd83d[_0x1e1d('0x43')]=_['intersection'](_0xbf821a[_0x1e1d('0x3e')],qs[_0x1e1d('0x44')](_0x4f0820[_0x1e1d('0x40')][_0x1e1d('0x44')]));_0x2cd83d[_0x1e1d('0x43')]=_0x2cd83d['attributes'][_0x1e1d('0x45')]?_0x2cd83d['attributes']:_0xbf821a[_0x1e1d('0x3e')];if(!_0x4f0820[_0x1e1d('0x40')][_0x1e1d('0x46')](_0x1e1d('0x47'))){_0x2cd83d['limit']=qs['limit'](_0x4f0820[_0x1e1d('0x40')][_0x1e1d('0x32')]);_0x2cd83d[_0x1e1d('0x34')]=qs[_0x1e1d('0x34')](_0x4f0820[_0x1e1d('0x40')]['offset']);}_0x2cd83d[_0x1e1d('0x48')]=qs['sort'](_0x4f0820[_0x1e1d('0x40')][_0x1e1d('0x49')]);_0x2cd83d[_0x1e1d('0x4a')]=qs[_0x1e1d('0x4b')](_[_0x1e1d('0x4c')](_0x4f0820[_0x1e1d('0x40')],_0xbf821a[_0x1e1d('0x4b')]),_0x51d998);if(_0x4f0820[_0x1e1d('0x40')][_0x1e1d('0x4d')]){_0x2cd83d[_0x1e1d('0x4a')]=_[_0x1e1d('0x4e')](_0x2cd83d[_0x1e1d('0x4a')],{'$or':_[_0x1e1d('0x3f')](_0x51d998,function(_0x929180){if(_0x929180[_0x1e1d('0x3c')]!=='VIRTUAL'){var _0x4dec10={};_0x4dec10[_0x929180['name']]={'$like':'%'+_0x4f0820[_0x1e1d('0x40')][_0x1e1d('0x4d')]+'%'};return _0x4dec10;}})});}_0x2cd83d=_[_0x1e1d('0x4e')]({},_0x2cd83d,_0x4f0820['options']);var _0x547948={'where':_0x2cd83d[_0x1e1d('0x4a')]};return db['SmsMessage'][_0x1e1d('0x33')](_0x547948)[_0x1e1d('0x37')](function(_0x220789){_0x94097a['count']=_0x220789;if(_0x4f0820[_0x1e1d('0x40')][_0x1e1d('0x4f')]){_0x2cd83d[_0x1e1d('0x50')]=[{'all':!![]}];}return db[_0x1e1d('0x51')][_0x1e1d('0x52')](_0x2cd83d);})[_0x1e1d('0x37')](function(_0x189f9b){_0x94097a[_0x1e1d('0x53')]=_0x189f9b;return _0x94097a;})[_0x1e1d('0x37')](respondWithFilteredResult(_0x3917b2,_0x2cd83d))[_0x1e1d('0x2c')](handleError(_0x3917b2,null));};exports[_0x1e1d('0x54')]=function(_0x146650,_0x126923){var _0x5b87bb={'raw':!![],'where':{'id':_0x146650['params']['id']}},_0x957dcb={};_0x957dcb['model']=_[_0x1e1d('0x41')](db[_0x1e1d('0x51')][_0x1e1d('0x3b')]);_0x957dcb[_0x1e1d('0x40')]=_[_0x1e1d('0x41')](_0x146650['query']);_0x957dcb[_0x1e1d('0x4b')]=_[_0x1e1d('0x42')](_0x957dcb[_0x1e1d('0x3e')],_0x957dcb[_0x1e1d('0x40')]);_0x5b87bb[_0x1e1d('0x43')]=_[_0x1e1d('0x42')](_0x957dcb[_0x1e1d('0x3e')],qs[_0x1e1d('0x44')](_0x146650[_0x1e1d('0x40')]['fields']));_0x5b87bb[_0x1e1d('0x43')]=_0x5b87bb[_0x1e1d('0x43')][_0x1e1d('0x45')]?_0x5b87bb[_0x1e1d('0x43')]:_0x957dcb['model'];if(_0x146650[_0x1e1d('0x40')]['includeAll']){_0x5b87bb[_0x1e1d('0x50')]=[{'all':!![]}];}_0x5b87bb=_['merge']({},_0x5b87bb,_0x146650[_0x1e1d('0x55')]);return db['SmsMessage'][_0x1e1d('0x56')](_0x5b87bb)[_0x1e1d('0x37')](handleEntityNotFound(_0x126923,null))[_0x1e1d('0x37')](respondWithResult(_0x126923,null))[_0x1e1d('0x2c')](handleError(_0x126923,null));};exports[_0x1e1d('0x57')]=function(_0x42d312,_0x162039){return db['SmsMessage'][_0x1e1d('0x57')](_0x42d312[_0x1e1d('0x58')],{})[_0x1e1d('0x37')](respondWithResult(_0x162039,0xc9))['catch'](handleError(_0x162039,null));};exports[_0x1e1d('0x59')]=function(_0x2cfca6,_0xd85899){if(_0x2cfca6[_0x1e1d('0x58')]['id']){delete _0x2cfca6[_0x1e1d('0x58')]['id'];}return db[_0x1e1d('0x51')][_0x1e1d('0x56')]({'where':{'id':_0x2cfca6[_0x1e1d('0x5a')]['id']}})['then'](handleEntityNotFound(_0xd85899,null))[_0x1e1d('0x37')](saveUpdates(_0x2cfca6[_0x1e1d('0x58')],null))[_0x1e1d('0x37')](respondWithResult(_0xd85899,null))[_0x1e1d('0x2c')](handleError(_0xd85899,null));};exports[_0x1e1d('0x5b')]=function(_0x43070b,_0x4cb700){return db[_0x1e1d('0x51')][_0x1e1d('0x56')]({'where':{'id':_0x43070b['params']['id']}})[_0x1e1d('0x37')](handleEntityNotFound(_0x4cb700,null))['then'](removeEntity(_0x4cb700,null))[_0x1e1d('0x2c')](handleError(_0x4cb700,null));};exports['describe']=function(_0x5c297d,_0x250cb9){return db['SmsMessage'][_0x1e1d('0x5c')]()[_0x1e1d('0x37')](respondWithResult(_0x250cb9,null))[_0x1e1d('0x2c')](handleError(_0x250cb9,null));};var interaction_log=require('../../config/logger')(_0x1e1d('0x5d'));exports[_0x1e1d('0x5e')]=function(_0x4ef5c8,_0x5b80f0,_0x2ed769){var _0x135519={'agent':{},'channel':_0x1e1d('0x5f')};if(_0x4ef5c8[_0x1e1d('0x58')]['id']){delete _0x4ef5c8[_0x1e1d('0x58')]['id'];}_0x4ef5c8['body'][_0x1e1d('0x60')]=!![];_0x4ef5c8['body'][_0x1e1d('0x61')]=moment()[_0x1e1d('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ef5c8['body'][_0x1e1d('0x63')]=_0x4ef5c8['body'][_0x1e1d('0x63')]||_0x4ef5c8['user']['id'];_0x135519['agent']['id']=_0x4ef5c8[_0x1e1d('0x58')][_0x1e1d('0x63')];return db[_0x1e1d('0x51')][_0x1e1d('0x56')]({'where':{'id':_0x4ef5c8[_0x1e1d('0x5a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5b80f0,null))[_0x1e1d('0x37')](saveUpdates(_0x4ef5c8[_0x1e1d('0x58')],null))['then'](function(_0xc53ad9){if(_0xc53ad9){_0x135519['message']=_0xc53ad9[_0x1e1d('0x64')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0xc53ad9[_0x1e1d('0x65')]}});}return null;})[_0x1e1d('0x37')](handleEntityNotFound(_0x5b80f0,null))[_0x1e1d('0x37')](function(_0x469fd7){if(_0x469fd7){return _0x469fd7['update']({'UserId':_0x4ef5c8[_0x1e1d('0x58')][_0x1e1d('0x63')],'read1stAt':_[_0x1e1d('0x66')](_0x469fd7[_0x1e1d('0x67')])?moment()[_0x1e1d('0x62')](_0x1e1d('0x68')):undefined});}return null;})[_0x1e1d('0x37')](function(_0x4b4d48){if(_0x4b4d48){_0x135519[_0x1e1d('0x69')]=_0x4b4d48[_0x1e1d('0x64')]({'plain':!![]});interaction_log[_0x1e1d('0x6a')](_0x1e1d('0x6b'),_0x4ef5c8[_0x1e1d('0x6c')]['id'],_0x4ef5c8[_0x1e1d('0x6c')]['name'],_0x4ef5c8[_0x1e1d('0x6c')]['role'],_0x135519[_0x1e1d('0x69')]['id'],_0x4ef5c8[_0x1e1d('0x58')]?JSON['stringify'](_0x4ef5c8[_0x1e1d('0x58')]):_0x1e1d('0x6d'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x135519);}return null;})[_0x1e1d('0x37')](function(_0x1d181b){var _0x3c2889=_0x1e1d('0x6e')+_0x1d181b[_0x1e1d('0x2b')][_0x1e1d('0x6f')];return db[_0x1e1d('0x70')][_0x1e1d('0x40')](_0x3c2889,{'type':db[_0x1e1d('0x71')][_0x1e1d('0x72')][_0x1e1d('0x73')],'raw':!![]})[_0x1e1d('0x37')](function(_0x588331){return _0x588331;});})[_0x1e1d('0x37')](function(_0x47545b){if(_0x47545b){_0x135519[_0x1e1d('0x2b')][_0x1e1d('0x74')]=_0x47545b[0x0];if(!_0x4ef5c8[_0x1e1d('0x58')][_0x1e1d('0x63')])return;return db[_0x1e1d('0x75')][_0x1e1d('0x56')]({'where':{'id':_0x4ef5c8['body']['UserId'],'role':_0x1e1d('0x76')},'attributes':['id',_0x1e1d('0x39'),_0x1e1d('0x77'),'email',_0x1e1d('0x78')],'raw':!![]});}return null;})['then'](function(_0x495cf0){if(!_0x495cf0)return null;_0x135519[_0x1e1d('0x2b')][_0x1e1d('0x76')]=_0x495cf0;return _0x135519;})['then'](function(_0x5b5abc){if(_0x5b5abc){if(_0x4ef5c8[_0x1e1d('0x58')][_0x1e1d('0x79')]){_0x135519['message']['interface']=util[_0x1e1d('0x62')](_0x1e1d('0x7a'),_0x4ef5c8[_0x1e1d('0x6c')]['name']);_0x135519[_0x1e1d('0x2b')][_0x1e1d('0x7b')]=_0x135519[_0x1e1d('0x7b')];_0x135519[_0x1e1d('0x2b')][_0x1e1d('0x7c')]=_0x135519['channel'];_0x135519['message'][_0x1e1d('0x7d')]=_0x1e1d('0x5e');return respondWithRpcPromise(_0x1e1d('0x7e'),_0x1e1d('0x7e'),{'event':_0x1e1d('0x7f'),'message':_0x135519[_0x1e1d('0x2b')]},client9002)[_0x1e1d('0x37')](function(){return _0x135519;});}return _0x135519;}return null;})['then'](respondWithResult(_0x5b80f0,null))[_0x1e1d('0x2c')](handleError(_0x5b80f0,null));};var interaction_log=require(_0x1e1d('0x16'))(_0x1e1d('0x5d'));exports[_0x1e1d('0x36')]=function(_0xfa2e70,_0x56cb2b,_0x3a5f68){var _0x274f3b={'agent':{},'channel':_0x1e1d('0x5f')};if(_0xfa2e70[_0x1e1d('0x58')]['id']){delete _0xfa2e70[_0x1e1d('0x58')]['id'];}_0xfa2e70[_0x1e1d('0x58')][_0x1e1d('0x63')]=_0xfa2e70[_0x1e1d('0x58')][_0x1e1d('0x63')]||_0xfa2e70[_0x1e1d('0x6c')]['id'];_0x274f3b['agent']['id']=_0xfa2e70[_0x1e1d('0x58')][_0x1e1d('0x63')];return db[_0x1e1d('0x51')][_0x1e1d('0x56')]({'where':{'id':_0xfa2e70['params']['id'],'UserId':null}})[_0x1e1d('0x37')](handleEntityNotFound(_0x56cb2b,null))['then'](function(_0xbfcedd){if(_0xbfcedd){_0x274f3b['message']=_0xbfcedd[_0x1e1d('0x64')]({'plain':!![]});return db[_0x1e1d('0x80')]['find']({'where':{'id':_0xbfcedd['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x56cb2b,null))[_0x1e1d('0x37')](function(_0x3a95b8){if(_0x3a95b8){_0x274f3b[_0x1e1d('0x69')]=_0x3a95b8['get']({'plain':!![]});interaction_log[_0x1e1d('0x6a')](_0x1e1d('0x81'),_0xfa2e70['user']['id'],_0xfa2e70['user'][_0x1e1d('0x39')],_0xfa2e70[_0x1e1d('0x6c')][_0x1e1d('0x82')],_0x274f3b[_0x1e1d('0x69')]['id'],_0xfa2e70[_0x1e1d('0x58')]?JSON[_0x1e1d('0x28')](_0xfa2e70['body']):_0x1e1d('0x6d'));return respondWithRpcPromise('RejectMessage',_0x1e1d('0x83'),_0x274f3b);}return null;})[_0x1e1d('0x37')](function(_0x523d41){var _0x1b877c=_0x1e1d('0x6e')+_0x523d41[_0x1e1d('0x2b')][_0x1e1d('0x6f')];return db[_0x1e1d('0x70')][_0x1e1d('0x40')](_0x1b877c,{'type':db[_0x1e1d('0x71')]['QueryTypes'][_0x1e1d('0x73')],'raw':!![]})[_0x1e1d('0x37')](function(_0x5a082c){return _0x5a082c;});})[_0x1e1d('0x37')](function(_0x5e1ada){if(_0x5e1ada){_0x274f3b['message']['contact']=_0x5e1ada[0x0];if(!_0xfa2e70['body']['UserId'])return;return db[_0x1e1d('0x75')][_0x1e1d('0x56')]({'where':{'id':_0xfa2e70[_0x1e1d('0x58')][_0x1e1d('0x63')],'role':_0x1e1d('0x76')},'attributes':['id',_0x1e1d('0x39'),'fullname',_0x1e1d('0x84'),_0x1e1d('0x78')],'raw':!![]});}return null;})[_0x1e1d('0x37')](function(_0x5362cb){if(!_0x5362cb)return null;_0x274f3b[_0x1e1d('0x2b')]['agent']=_0x5362cb;return _0x274f3b;})[_0x1e1d('0x37')](function(_0x53fba1){if(_0x53fba1){_0x53fba1['message'][_0x1e1d('0x85')]=util[_0x1e1d('0x62')](_0x1e1d('0x7a'),_0xfa2e70[_0x1e1d('0x6c')][_0x1e1d('0x39')]);_0x53fba1['message'][_0x1e1d('0x7b')]=_0x274f3b[_0x1e1d('0x7b')];_0x53fba1[_0x1e1d('0x2b')][_0x1e1d('0x7c')]=_0x274f3b[_0x1e1d('0x7b')];_0x53fba1['message'][_0x1e1d('0x7d')]=_0x1e1d('0x36');respondWithRpcPromise(_0x1e1d('0x7e'),_0x1e1d('0x7e'),{'event':_0x1e1d('0x86'),'message':_0x53fba1['message']},client9002);return _0x274f3b;}return null;})['then'](respondWithResult(_0x56cb2b,null))[_0x1e1d('0x2c')](handleError(_0x56cb2b,null));};exports[_0x1e1d('0x2e')]=function(_0x1c9448,_0x36e65b,_0x220709){if(_0x1c9448[_0x1e1d('0x58')]['id']){delete _0x1c9448[_0x1e1d('0x58')]['id'];}var _0x46c567;return db[_0x1e1d('0x51')][_0x1e1d('0x56')]({'where':{'id':_0x1c9448[_0x1e1d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x36e65b,null))['then'](function(_0x3befdd){if(_0x3befdd){_0x46c567=_0x3befdd;return db[_0x1e1d('0x87')][_0x1e1d('0x56')]({'where':{'id':_0x3befdd[_0x1e1d('0x88')]}});}})['then'](handleEntityNotFound(_0x36e65b,null))[_0x1e1d('0x37')](function(_0x2f7e80){if(_0x2f7e80){logger['debug'](_0x1e1d('0x26'),_0x1e1d('0x2e'),_0x1e1d('0x89'),_0x2f7e80[_0x1e1d('0x3c')],util[_0x1e1d('0x8a')](_0x1c9448[_0x1e1d('0x58')],{'showHidden':![],'depth':null}));switch(_0x2f7e80['type']){case'twilio':if(_0x1c9448[_0x1e1d('0x58')]['MessageSid']&&_0x1c9448[_0x1e1d('0x58')][_0x1e1d('0x8b')]===_0x46c567[_0x1e1d('0x8c')]){return _0x46c567[_0x1e1d('0x59')]({'read':!![]});}else{logger[_0x1e1d('0x29')](_0x1e1d('0x8d'),_0x1e1d('0x2e'),'twilio',util[_0x1e1d('0x8a')](_0x1c9448['body'],{'showHidden':![],'depth':null}));}break;case _0x1e1d('0x8e'):if(_0x1c9448['body'][_0x1e1d('0x8f')]&&_0x1c9448['body'][_0x1e1d('0x8f')]===_0x46c567[_0x1e1d('0x8c')]&&_[_0x1e1d('0x90')]([_0x1e1d('0x91'),'delivered'],_0x1c9448[_0x1e1d('0x58')][_0x1e1d('0x92')])>=0x0){return _0x46c567[_0x1e1d('0x59')]({'read':!![]});}else{logger[_0x1e1d('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x1e1d('0x93'),util['inspect'](_0x1c9448['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1797ef=_0x1c9448[_0x1e1d('0x58')][_0x1e1d('0x94')][0x0];if(_0x1797ef[_0x1e1d('0x2e')][_0x1e1d('0x95')]==='DELIVERED'){return _0x46c567[_0x1e1d('0x59')]({'read':!![]});}else{logger[_0x1e1d('0x29')](_0x1e1d('0x8d'),'status',_0x1e1d('0x96'),util['inspect'](_0x1c9448[_0x1e1d('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x46c567;}})[_0x1e1d('0x37')](respondWithResult(_0x36e65b,null))['catch'](handleError(_0x36e65b,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index c06aa75..a9b5ede 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 _0x5603=['exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','remove','hasOwnProperty','hook'];(function(_0x50a8b5,_0x396584){var _0x2628da=function(_0x4dbb58){while(--_0x4dbb58){_0x50a8b5['push'](_0x50a8b5['shift']());}};_0x2628da(++_0x396584);}(_0x5603,0x1d5));var _0x3560=function(_0x380768,_0x457947){_0x380768=_0x380768-0x0;var _0x15ff00=_0x5603[_0x380768];return _0x15ff00;};'use strict';var EventEmitter=require(_0x3560('0x0'));var SmsMessage=require(_0x3560('0x1'))['db'][_0x3560('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x3560('0x3')](0x0);var events={'afterCreate':_0x3560('0x4'),'afterUpdate':'update','afterDestroy':_0x3560('0x5')};function emitEvent(_0xd5374c){return function(_0x510af3,_0x13ae50,_0x1c0b36){SmsMessageEvents['emit'](_0xd5374c+':'+_0x510af3['id'],_0x510af3);SmsMessageEvents['emit'](_0xd5374c,_0x510af3);_0x1c0b36(null);};}for(var e in events){if(events[_0x3560('0x6')](e)){var event=events[e];SmsMessage[_0x3560('0x7')](e,emitEvent(event));}}module[_0x3560('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x7b0e=['emit','hasOwnProperty','events','SmsMessage','setMaxListeners'];(function(_0x59e1a9,_0x9945c4){var _0x48d9ad=function(_0x45f462){while(--_0x45f462){_0x59e1a9['push'](_0x59e1a9['shift']());}};_0x48d9ad(++_0x9945c4);}(_0x7b0e,0xd9));var _0xe7b0=function(_0x4af82a,_0x324b56){_0x4af82a=_0x4af82a-0x0;var _0x31a7f6=_0x7b0e[_0x4af82a];return _0x31a7f6;};'use strict';var EventEmitter=require(_0xe7b0('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xe7b0('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xe7b0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x427d2c){return function(_0x4df8b6,_0x22c22a,_0x3191eb){SmsMessageEvents[_0xe7b0('0x3')](_0x427d2c+':'+_0x4df8b6['id'],_0x4df8b6);SmsMessageEvents['emit'](_0x427d2c,_0x4df8b6);_0x3191eb(null);};}for(var e in events){if(events[_0xe7b0('0x4')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 1576bfe..7d08247 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 _0x9362=['/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','Missing\x20parameters:\x20username,\x20password','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','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','messageId','fti_sms_messages','body','FULLTEXT','models','get','toLowerCase','direction','secret','isNil','UserId','SmsInteractionId','findOne','then','update','createdAt','catch','error','out','SmsAccount','find','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','remote','/api/sms/messages/','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','split','sms','POST','session_key','total_sent','internal_order_id','read','senderString','deliveryReport','connectel','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','http_code','data','queued_count','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','base64','message_uuid','infobip','baseUrl','token','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','apiKey','sender','timestamp','keys','sort','length','hex','signature='];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9362,0x185));var _0x2936=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9362[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2936('0x0'));var util=require(_0x2936('0x1'));var logger=require(_0x2936('0x2'))(_0x2936('0x3'));var moment=require(_0x2936('0x4'));var BPromise=require(_0x2936('0x5'));var rp=require(_0x2936('0x6'));var fs=require('fs');var path=require(_0x2936('0x7'));var rimraf=require(_0x2936('0x8'));var config=require(_0x2936('0x9'));var attributes=require('./smsMessage.attributes');module[_0x2936('0xa')]=function(_0x4e4c97,_0x3511d4){return _0x4e4c97[_0x2936('0xb')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x2936('0xc')]},{'name':_0x2936('0xd'),'fields':[_0x2936('0xe')],'type':_0x2936('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1135f3,_0x5a0205,_0x10692f){var _0x38d2f6=_0x4e4c97[_0x2936('0x10')];var _0x20fbdc=_0x1135f3[_0x2936('0x11')]({'plain':!![]});if(_0x20fbdc['direction'][_0x2936('0x12')]()==='in'||_0x20fbdc[_0x2936('0x13')][_0x2936('0x12')]()==='out'&&!_0x20fbdc[_0x2936('0x14')]&&!_[_0x2936('0x15')](_0x20fbdc[_0x2936('0x16')])&&!_[_0x2936('0x15')](_0x20fbdc[_0x2936('0x17')])){_0x38d2f6['SmsInteraction'][_0x2936('0x18')]({'where':{'id':_0x20fbdc[_0x2936('0x17')]}})[_0x2936('0x19')](function(_0x3101ed){if(_0x3101ed){_0x3101ed[_0x2936('0x1a')]({'lastMsgAt':_0x20fbdc[_0x2936('0x1b')],'lastMsgDirection':_0x20fbdc[_0x2936('0x13')][_0x2936('0x12')]()});}})[_0x2936('0x1c')](function(_0x9db5db){console[_0x2936('0x1d')](_0x9db5db);});}if(_0x20fbdc['direction']===_0x2936('0x1e')&&!_0x20fbdc['secret']){var _0x23aa57;_0x38d2f6[_0x2936('0x1f')][_0x2936('0x20')]({'where':{'id':_0x20fbdc[_0x2936('0x21')]},'raw':!![]})[_0x2936('0x19')](function(_0x32c84d){_0x23aa57=_0x32c84d;if(_0x23aa57&&_0x23aa57[_0x2936('0x22')]){switch(_0x23aa57[_0x2936('0x22')]){case _0x2936('0x23'):var _0xeb49e7=require(_0x2936('0x23'));if(_0x23aa57['accountSid']&&_0x23aa57[_0x2936('0x24')]&&_0x23aa57[_0x2936('0x25')]){var _0x5234e3=new _0xeb49e7(_0x23aa57[_0x2936('0x26')],_0x23aa57['authToken']);_0x5234e3[_0x2936('0x27')]['create']({'body':_0x20fbdc[_0x2936('0xe')],'to':_0x20fbdc[_0x2936('0x25')],'from':_0x23aa57[_0x2936('0x25')],'statusCallback':_0x23aa57[_0x2936('0x28')]+_0x2936('0x29')+_0x20fbdc['id']+_0x2936('0x2a')+_0x23aa57['token']})[_0x2936('0x19')](function(_0x2653c5){if(_0x2653c5[_0x2936('0x2b')]){return _0x1135f3[_0x2936('0x1a')]({'messageId':_0x2653c5['sid']});}})[_0x2936('0x1c')](function(_0x592991){logger[_0x2936('0x1d')](_0x2936('0x2c'),_0x2936('0x2d'),_0x2936('0x23'),util[_0x2936('0x2e')](_0x592991,{'showHidden':![],'depth':null}));});}else{logger[_0x2936('0x1d')](_0x2936('0x2c'),'afterCreate',_0x2936('0x23'),_0x2936('0x2f'));}break;case _0x2936('0x30'):var _0x3baefb=_0x2936('0x31');if(_0x23aa57[_0x2936('0x32')]&&_0x23aa57[_0x2936('0x33')]){var _0x171642={'recipient':[_0x20fbdc[_0x2936('0x25')]],'message':_0x20fbdc[_0x2936('0xe')],'message_type':_0x23aa57[_0x2936('0x34')]};if(_0x23aa57['smsMethod']&&_0x23aa57[_0x2936('0x34')]!=='SI'){_0x171642['sender']=_0x23aa57[_0x2936('0x25')];}var _0x56b809={'url':_0x3baefb+_0x2936('0x35')+_0x23aa57[_0x2936('0x32')]+_0x2936('0x36')+_0x23aa57['password'],'method':_0x2936('0x37')};rp(_0x56b809)[_0x2936('0x19')](function(_0x14adbb){var _0x287f0e=_0x14adbb[_0x2936('0x38')](';');var _0x373d92={'user_key':_0x287f0e[0x0],'session_key':_0x287f0e[0x1]};_0x56b809={'url':_0x3baefb+_0x2936('0x39'),'method':_0x2936('0x3a'),'headers':{'user_key':_0x373d92['user_key'],'Session_key':_0x373d92[_0x2936('0x3b')]},'json':!![],'body':_0x171642};return rp(_0x56b809);})[_0x2936('0x19')](function(_0x459ace){if(_0x459ace[_0x2936('0x3c')]>=0x1){var _0x3c5fa8={'messageId':_0x459ace[_0x2936('0x3d')]};if(_0x23aa57[_0x2936('0x34')]!=='GP'||!_0x23aa57['deliveryReport']){_0x3c5fa8[_0x2936('0x3e')]=!![];}return _0x1135f3[_0x2936('0x1a')](_0x3c5fa8);}else{return logger[_0x2936('0x1d')](_0x2936('0x2c'),_0x2936('0x2d'),_0x2936('0x30'),util[_0x2936('0x2e')](_0x459ace,{'showHidden':![],'depth':null}));}})[_0x2936('0x1c')](function(_0x3964bf){return logger[_0x2936('0x1d')](_0x2936('0x2c'),'afterCreate',_0x2936('0x30'),util[_0x2936('0x2e')](_0x3964bf,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2936('0x2d'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x23aa57['authToken']){var _0x3f38bb={'recipient':_0x20fbdc['phone'],'message':_0x20fbdc[_0x2936('0xe')],'sender':_0x23aa57[_0x2936('0x3f')]||_0x23aa57['phone'],'authorization':_0x23aa57[_0x2936('0x24')]};var _0x5a0205={'method':_0x2936('0x3a'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x3f38bb,'json':!![]};rp(_0x5a0205)[_0x2936('0x19')](function(_0x41f072){var _0x40e9fe={'messageId':_0x41f072['requestid']};if(!_0x23aa57[_0x2936('0x40')]){_0x40e9fe[_0x2936('0x3e')]=!![];}return _0x1135f3[_0x2936('0x1a')](_0x40e9fe);})[_0x2936('0x1c')](function(_0x5ee02e){logger[_0x2936('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2936('0x2d'),'connectel',util['inspect'](_0x5ee02e,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2936('0x2c'),_0x2936('0x2d'),_0x2936('0x41'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x23aa57[_0x2936('0x32')]&&_0x23aa57[_0x2936('0x33')]){var _0x3f38bb={'messages':[{'source':_0x2936('0x42'),'to':_0x20fbdc[_0x2936('0x25')],'body':_0x20fbdc[_0x2936('0xe')],'from':_0x23aa57['senderString']||_0x23aa57['phone']}]};var _0x34db02=util[_0x2936('0x43')](_0x2936('0x44'),_0x23aa57[_0x2936('0x32')],_0x23aa57['password']);var _0x5a0205={'method':_0x2936('0x3a'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x3f38bb,'headers':{'Authorization':util['format'](_0x2936('0x45'),new Buffer(_0x34db02)['toString']('base64'))},'json':!![]};rp(_0x5a0205)['then'](function(_0x464bd3){if(_0x464bd3[_0x2936('0x46')]>=0xc8&&_0x464bd3['http_code']<=0xce){if(_0x464bd3[_0x2936('0x47')]&&_0x464bd3[_0x2936('0x47')][_0x2936('0x48')]>0x0){var _0x1250cc=_['head'](_0x464bd3['data'][_0x2936('0x27')]);var _0xa531d7={'messageId':_0x1250cc[_0x2936('0x49')]};if(!_0x23aa57[_0x2936('0x40')]){_0xa531d7[_0x2936('0x3e')]=!![];}return _0x1135f3[_0x2936('0x1a')](_0xa531d7);}else{logger[_0x2936('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2936('0x2d'),_0x2936('0x4a'),util['inspect'](_0x464bd3,{'showHidden':![],'depth':null}));}}else{logger[_0x2936('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2936('0x2d'),_0x2936('0x4a'),util[_0x2936('0x2e')](_0x464bd3,{'showHidden':![],'depth':null}));}})[_0x2936('0x1c')](function(_0xb46802){logger[_0x2936('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2936('0x4a'),util['inspect'](_0xb46802,{'showHidden':![],'depth':null}));});}else{logger[_0x2936('0x1d')](_0x2936('0x2c'),'afterCreate','clickSend','Missing\x20parameters:\x20username,\x20password');}break;case _0x2936('0x4b'):if(_0x23aa57[_0x2936('0x4c')]&&_0x23aa57['authToken']){var _0x3f38bb={'dst':_0x20fbdc['phone'],'text':_0x20fbdc[_0x2936('0xe')],'src':_0x23aa57[_0x2936('0x3f')]||_0x23aa57['phone'],'url':_0x23aa57[_0x2936('0x28')]+_0x2936('0x29')+_0x20fbdc['id']+_0x2936('0x2a')+_0x23aa57['token']};var _0x34db02=util[_0x2936('0x43')](_0x2936('0x44'),_0x23aa57[_0x2936('0x4c')],_0x23aa57['authToken']);var _0x5a0205={'method':_0x2936('0x3a'),'uri':util['format'](_0x2936('0x4d'),_0x23aa57[_0x2936('0x4c')]),'body':_0x3f38bb,'headers':{'Authorization':util[_0x2936('0x43')](_0x2936('0x45'),new Buffer(_0x34db02)[_0x2936('0x4e')](_0x2936('0x4f')))},'json':!![]};rp(_0x5a0205)[_0x2936('0x19')](function(_0x1801c3){var _0x149cd9={'messageId':_0x1801c3[_0x2936('0x50')][0x0]};return _0x1135f3[_0x2936('0x1a')](_0x149cd9);})['catch'](function(_0x4b292c){logger['error'](_0x2936('0x2c'),_0x2936('0x2d'),'plivo',util[_0x2936('0x2e')](_0x4b292c,{'showHidden':![],'depth':null}));});}else{logger[_0x2936('0x1d')](_0x2936('0x2c'),_0x2936('0x2d'),_0x2936('0x4b'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x2936('0x51'):if(_0x23aa57[_0x2936('0x32')]&&_0x23aa57[_0x2936('0x33')]){if(_0x23aa57[_0x2936('0x52')]){var _0x1d53f6={'method':_0x2936('0x3a'),'uri':_0x23aa57['baseUrl']+'/auth/1/session','body':{'username':_0x23aa57[_0x2936('0x32')],'password':_0x23aa57['password']},'json':!![]};return rp(_0x1d53f6)[_0x2936('0x19')](function(_0x1fc0ab){var _0x44fd55={'method':_0x2936('0x3a'),'uri':_0x23aa57[_0x2936('0x52')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x23aa57[_0x2936('0x25')],'destinations':[{'to':_0x20fbdc[_0x2936('0x25')]}],'text':_0x20fbdc[_0x2936('0xe')],'notifyUrl':_0x23aa57[_0x2936('0x28')]+_0x2936('0x29')+_0x20fbdc['id']+_0x2936('0x2a')+_0x23aa57[_0x2936('0x53')],'notifyContentType':_0x2936('0x54'),'callbackData':_0x23aa57[_0x2936('0x25')]+';'+_0x20fbdc[_0x2936('0xe')]}]},'headers':{'Authorization':_0x2936('0x55')+_0x1fc0ab['token']},'json':!![]};return rp(_0x44fd55)[_0x2936('0x19')](function(_0x4a0845){if(_0x4a0845[_0x2936('0x27')]){var _0x5037df={'messageId':_0x4a0845[_0x2936('0x27')][0x0]['messageId']};if(!_0x23aa57[_0x2936('0x40')]){_0x5037df[_0x2936('0x3e')]=!![];}return _0x1135f3[_0x2936('0x1a')](_0x5037df);}else{return logger[_0x2936('0x1d')](_0x2936('0x2c'),'afterCreate',_0x2936('0x51'),util[_0x2936('0x2e')](_0x4a0845,{'showHidden':![],'depth':null}));}});})[_0x2936('0x1c')](function(_0x152107){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2936('0x2d'),'infobip',util[_0x2936('0x2e')](_0x152107,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2936('0x2d'),_0x2936('0x51'),_0x2936('0x56'));}}else{logger['error'](_0x2936('0x2c'),'afterCreate',_0x2936('0x51'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x2be41e=require('crypto');if(_0x23aa57[_0x2936('0x57')]){var _0x19c0b5={};_0x19c0b5['login']=_0x23aa57[_0x2936('0x32')];_0x19c0b5[_0x2936('0x25')]=_0x20fbdc[_0x2936('0x25')];_0x19c0b5[_0x2936('0x58')]=_0x23aa57[_0x2936('0x25')];_0x19c0b5['text']=_0x20fbdc[_0x2936('0xe')];_0x19c0b5[_0x2936('0x59')]=+new Date();var _0x1b98f5='';var _0x596899='';var _0x51216c=Object[_0x2936('0x5a')](_0x19c0b5);_0x51216c[_0x2936('0x5b')]();for(var _0x55c95e=0x0;_0x55c95e<_0x51216c[_0x2936('0x5c')];_0x55c95e++){if(_0x1b98f5!=''){_0x1b98f5+='&';}_0x1b98f5+=_0x51216c[_0x55c95e]+'='+encodeURIComponent(_0x19c0b5[_0x51216c[_0x55c95e]]);_0x596899+=_0x19c0b5[_0x51216c[_0x55c95e]];}_0x596899+=_0x23aa57[_0x2936('0x57')];_0x596899=_0x2be41e['createHash']('md5')[_0x2936('0x1a')](_0x596899)['digest'](_0x2936('0x5d'));if(_0x1b98f5!==''){_0x1b98f5+='&';}_0x1b98f5+=_0x2936('0x5e')+_0x596899;var _0x56b809={'method':_0x2936('0x37'),'uri':_0x23aa57[_0x2936('0x52')]+_0x2936('0x5f')+_0x1b98f5,'json':!![]};return rp(_0x56b809)['then'](function(_0x167dc2){var _0x471f2a=Object[_0x2936('0x5a')](_0x167dc2);if(_0x167dc2[_0x471f2a[0x0]]['error']&&parseInt(_0x167dc2[_0x471f2a[0x0]][_0x2936('0x1d')])===0x0){var _0x40b0d3={'messageId':_0x167dc2[_0x471f2a[0x0]][_0x2936('0x60')]};if(!_0x23aa57['deliveryReport']){_0x40b0d3[_0x2936('0x3e')]=!![];}return _0x1135f3[_0x2936('0x1a')](_0x40b0d3);}else{return logger[_0x2936('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2936('0x61'),util[_0x2936('0x2e')](_0x167dc2[_0x2936('0x1d')],{'showHidden':![],'depth':null}));}})[_0x2936('0x1c')](function(_0x5b4754){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2936('0x2d'),_0x2936('0x61'),util[_0x2936('0x2e')](_0x5b4754,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2936('0x2c'),'afterCreate',_0x2936('0x61'),_0x2936('0x62'));}break;case'clickatell':if(_0x23aa57['apiKey']){var _0x1cb302={'method':_0x2936('0x3a'),'uri':_0x2936('0x63'),'headers':{'Authorization':_0x23aa57[_0x2936('0x57')]},'body':{'content':_0x20fbdc[_0x2936('0xe')],'to':[_0x20fbdc[_0x2936('0x25')]],'from':_0x23aa57[_0x2936('0x25')],'binary':![],'clientMessageId':'uuid','charset':_0x2936('0x64')},'json':!![]};rp(_0x1cb302)['then'](function(_0xcd3f3e){if(!_0xcd3f3e[_0x2936('0x1d')]){var _0x4f8634={'messageId':_0xcd3f3e['messages'][0x0][_0x2936('0x65')]};if(!_0x23aa57[_0x2936('0x40')]){_0x4f8634[_0x2936('0x3e')]=!![];}return _0x1135f3[_0x2936('0x1a')](_0x4f8634);}else{return logger[_0x2936('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2936('0x66'),util[_0x2936('0x2e')](_0xcd3f3e[_0x2936('0x1d')],{'showHidden':![],'depth':null}));}})[_0x2936('0x1c')](function(_0x115e01){return logger[_0x2936('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2936('0x2d'),_0x2936('0x66'),util[_0x2936('0x2e')](_0x115e01,{'showHidden':![],'depth':null}));});}else{logger[_0x2936('0x1d')](_0x2936('0x2c'),_0x2936('0x2d'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case _0x2936('0x67'):if(_0x23aa57[_0x2936('0x32')]&&_0x23aa57[_0x2936('0x33')]){var _0x34db02=util[_0x2936('0x43')](_0x2936('0x44'),_0x23aa57['username'],_0x23aa57[_0x2936('0x33')]);var _0x5a0205={'method':'POST','uri':_0x2936('0x68')+_0x23aa57[_0x2936('0x69')]+_0x2936('0x6a'),'body':{'to':[_0x20fbdc['phone']],'text':_0x20fbdc[_0x2936('0xe')],'from':_0x23aa57[_0x2936('0x25')],'applicationId':_0x23aa57[_0x2936('0x6b')]},'headers':{'Authorization':util[_0x2936('0x43')](_0x2936('0x45'),new Buffer(_0x34db02)[_0x2936('0x4e')](_0x2936('0x4f')))},'json':!![]};rp(_0x5a0205)['then'](function(_0x215b3b){if(_0x215b3b['id']){var _0x2307da={'messageId':_0x215b3b['id']};return _0x1135f3[_0x2936('0x1a')](_0x2307da);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2936('0x2d'),_0x2936('0x67'),util['inspect'](_0x215b3b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2f7a39){logger[_0x2936('0x1d')](_0x2936('0x2c'),_0x2936('0x2d'),_0x2936('0x67'),util[_0x2936('0x2e')](_0x2f7a39,{'showHidden':![],'depth':null}));});}else{logger[_0x2936('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2936('0x2d'),_0x2936('0x67'),_0x2936('0x6c'));}break;case'intelepeer':if(_0x23aa57['apiKey']){var _0x29a4e0={};var _0x56b809={'method':_0x2936('0x3a'),'uri':_0x2936('0x6d'),'headers':{'Authorization':_0x2936('0x6e')+_0x23aa57[_0x2936('0x57')],'Content-Type':_0x2936('0x54')},'body':{'from':_0x23aa57[_0x2936('0x25')],'to':_0x20fbdc['phone'],'text':_0x20fbdc['body']},'json':!![]};return rp(_0x56b809)[_0x2936('0x19')](function(_0x3e073d){if(_0x3e073d[_0x2936('0x6f')]==0xca){_0x29a4e0[_0x2936('0x70')]=_0x3e073d;var _0x120e28={'method':'POST','uri':_0x2936('0x71'),'headers':{'Authorization':_0x2936('0x6e')+_0x23aa57[_0x2936('0x57')],'Content-Type':_0x2936('0x54')},'body':{'refid':_0x29a4e0['message'][_0x2936('0x72')]},'json':!![]};return rp(_0x120e28)[_0x2936('0x19')](function(_0x2acda3){_0x29a4e0[_0x2936('0x73')]=_0x2acda3;var _0x2afac6={'messageId':_0x29a4e0[_0x2936('0x70')][_0x2936('0x72')],'read':!![]};return _0x1135f3[_0x2936('0x1a')](_0x2afac6);});}else{return logger[_0x2936('0x1d')](_0x2936('0x2c'),_0x2936('0x2d'),_0x2936('0x74'),util[_0x2936('0x2e')](_0x3e073d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x243b0a){return logger[_0x2936('0x1d')](_0x2936('0x2c'),_0x2936('0x2d'),_0x2936('0x74'),util[_0x2936('0x2e')](_0x243b0a,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x2936('0x2c'),_0x2936('0x2d'),'intelepeer',_0x2936('0x75'));}break;}}})[_0x2936('0x76')](function(){_0x10692f();});}else{_0x10692f();}}},'charset':_0x2936('0x77'),'collate':_0x2936('0x78')});}; \ No newline at end of file +var _0x46c9=['csc','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','md5','digest','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','%s:%s','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','./smsMessage.attributes','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','isNil','update','createdAt','catch','error','out','SmsAccount','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','sms','user_key','total_sent','internal_order_id','deliveryReport','skebby','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','xCALLY\x20Motion','format','https://rest.clicksend.com/v3/sms/send','base64','http_code','data','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','POST','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url'];(function(_0x1f816b,_0x3d28d7){var _0x5756df=function(_0x178df3){while(--_0x178df3){_0x1f816b['push'](_0x1f816b['shift']());}};_0x5756df(++_0x3d28d7);}(_0x46c9,0x9e));var _0x946c=function(_0x277af0,_0x1f0361){_0x277af0=_0x277af0-0x0;var _0x43bd7c=_0x46c9[_0x277af0];return _0x43bd7c;};'use strict';var _=require(_0x946c('0x0'));var util=require(_0x946c('0x1'));var logger=require(_0x946c('0x2'))(_0x946c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x946c('0x4'));var fs=require('fs');var path=require(_0x946c('0x5'));var rimraf=require(_0x946c('0x6'));var config=require('../../config/environment');var attributes=require(_0x946c('0x7'));module['exports']=function(_0x16f387,_0x21d4cd){return _0x16f387[_0x946c('0x8')](_0x946c('0x9'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x946c('0xa')]},{'name':_0x946c('0xb'),'fields':[_0x946c('0xc')],'type':_0x946c('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x55000c,_0x39950c,_0x1abf95){var _0x41221e=_0x16f387[_0x946c('0xe')];var _0xa467fc=_0x55000c[_0x946c('0xf')]({'plain':!![]});if(_0xa467fc[_0x946c('0x10')][_0x946c('0x11')]()==='in'||_0xa467fc[_0x946c('0x10')][_0x946c('0x11')]()==='out'&&!_0xa467fc[_0x946c('0x12')]&&!_['isNil'](_0xa467fc[_0x946c('0x13')])&&!_[_0x946c('0x14')](_0xa467fc['SmsInteractionId'])){_0x41221e['SmsInteraction']['findOne']({'where':{'id':_0xa467fc['SmsInteractionId']}})['then'](function(_0x2597b2){if(_0x2597b2){_0x2597b2[_0x946c('0x15')]({'lastMsgAt':_0xa467fc[_0x946c('0x16')],'lastMsgDirection':_0xa467fc['direction'][_0x946c('0x11')]()});}})[_0x946c('0x17')](function(_0x556e9b){console[_0x946c('0x18')](_0x556e9b);});}if(_0xa467fc[_0x946c('0x10')]===_0x946c('0x19')&&!_0xa467fc['secret']){var _0x238d92;_0x41221e[_0x946c('0x1a')]['find']({'where':{'id':_0xa467fc[_0x946c('0x1b')]},'raw':!![]})[_0x946c('0x1c')](function(_0x3a4b94){_0x238d92=_0x3a4b94;if(_0x238d92&&_0x238d92[_0x946c('0x1d')]){switch(_0x238d92[_0x946c('0x1d')]){case'twilio':var _0x13f13d=require(_0x946c('0x1e'));if(_0x238d92[_0x946c('0x1f')]&&_0x238d92[_0x946c('0x20')]&&_0x238d92[_0x946c('0x21')]){var _0x8b79c1=new _0x13f13d(_0x238d92[_0x946c('0x1f')],_0x238d92[_0x946c('0x20')]);_0x8b79c1[_0x946c('0x22')]['create']({'body':_0xa467fc[_0x946c('0xc')],'to':_0xa467fc[_0x946c('0x21')],'from':_0x238d92[_0x946c('0x21')],'statusCallback':_0x238d92[_0x946c('0x23')]+_0x946c('0x24')+_0xa467fc['id']+_0x946c('0x25')+_0x238d92[_0x946c('0x26')]})['then'](function(_0x345594){if(_0x345594[_0x946c('0x27')]){return _0x55000c[_0x946c('0x15')]({'messageId':_0x345594[_0x946c('0x27')]});}})[_0x946c('0x17')](function(_0x4a5993){logger['error'](_0x946c('0x28'),_0x946c('0x29'),'twilio',util[_0x946c('0x2a')](_0x4a5993,{'showHidden':![],'depth':null}));});}else{logger[_0x946c('0x18')](_0x946c('0x28'),_0x946c('0x29'),_0x946c('0x1e'),_0x946c('0x2b'));}break;case'skebby':var _0x5dd8e5=_0x946c('0x2c');if(_0x238d92[_0x946c('0x2d')]&&_0x238d92[_0x946c('0x2e')]){var _0x4c4e68={'recipient':[_0xa467fc[_0x946c('0x21')]],'message':_0xa467fc[_0x946c('0xc')],'message_type':_0x238d92[_0x946c('0x2f')]};if(_0x238d92[_0x946c('0x2f')]&&_0x238d92[_0x946c('0x2f')]!=='SI'){_0x4c4e68[_0x946c('0x30')]=_0x238d92[_0x946c('0x21')];}var _0x364781={'url':_0x5dd8e5+_0x946c('0x31')+_0x238d92[_0x946c('0x2d')]+_0x946c('0x32')+_0x238d92[_0x946c('0x2e')],'method':_0x946c('0x33')};rp(_0x364781)[_0x946c('0x1c')](function(_0x3c1c71){var _0x42fd2d=_0x3c1c71['split'](';');var _0x35ae4b={'user_key':_0x42fd2d[0x0],'session_key':_0x42fd2d[0x1]};_0x364781={'url':_0x5dd8e5+_0x946c('0x34'),'method':'POST','headers':{'user_key':_0x35ae4b[_0x946c('0x35')],'Session_key':_0x35ae4b['session_key']},'json':!![],'body':_0x4c4e68};return rp(_0x364781);})[_0x946c('0x1c')](function(_0x3caab6){if(_0x3caab6[_0x946c('0x36')]>=0x1){var _0x337a23={'messageId':_0x3caab6[_0x946c('0x37')]};if(_0x238d92[_0x946c('0x2f')]!=='GP'||!_0x238d92[_0x946c('0x38')]){_0x337a23['read']=!![];}return _0x55000c[_0x946c('0x15')](_0x337a23);}else{return logger['error'](_0x946c('0x28'),_0x946c('0x29'),_0x946c('0x39'),util['inspect'](_0x3caab6,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3d5e34){return logger[_0x946c('0x18')](_0x946c('0x28'),'afterCreate',_0x946c('0x39'),util['inspect'](_0x3d5e34,{'showHidden':![],'depth':null}));});}else{logger[_0x946c('0x18')](_0x946c('0x28'),_0x946c('0x29'),_0x946c('0x39'),_0x946c('0x3a'));}break;case'connectel':if(_0x238d92[_0x946c('0x20')]){var _0x3a9ebe={'recipient':_0xa467fc[_0x946c('0x21')],'message':_0xa467fc[_0x946c('0xc')],'sender':_0x238d92[_0x946c('0x3b')]||_0x238d92[_0x946c('0x21')],'authorization':_0x238d92[_0x946c('0x20')]};var _0x39950c={'method':'POST','uri':_0x946c('0x3c'),'body':_0x3a9ebe,'json':!![]};rp(_0x39950c)[_0x946c('0x1c')](function(_0x14d1f0){var _0x1f4e1f={'messageId':_0x14d1f0[_0x946c('0x3d')]};if(!_0x238d92[_0x946c('0x38')]){_0x1f4e1f[_0x946c('0x3e')]=!![];}return _0x55000c[_0x946c('0x15')](_0x1f4e1f);})[_0x946c('0x17')](function(_0x4a8957){logger['error'](_0x946c('0x28'),'afterCreate','connectel',util[_0x946c('0x2a')](_0x4a8957,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x946c('0x28'),_0x946c('0x29'),'connectel','Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x238d92['username']&&_0x238d92[_0x946c('0x2e')]){var _0x3a9ebe={'messages':[{'source':_0x946c('0x3f'),'to':_0xa467fc[_0x946c('0x21')],'body':_0xa467fc[_0x946c('0xc')],'from':_0x238d92[_0x946c('0x3b')]||_0x238d92[_0x946c('0x21')]}]};var _0x6ee4e7=util[_0x946c('0x40')]('%s:%s',_0x238d92['username'],_0x238d92[_0x946c('0x2e')]);var _0x39950c={'method':'POST','uri':_0x946c('0x41'),'body':_0x3a9ebe,'headers':{'Authorization':util[_0x946c('0x40')]('Basic\x20%s',new Buffer(_0x6ee4e7)['toString'](_0x946c('0x42')))},'json':!![]};rp(_0x39950c)[_0x946c('0x1c')](function(_0x1fcebd){if(_0x1fcebd[_0x946c('0x43')]>=0xc8&&_0x1fcebd[_0x946c('0x43')]<=0xce){if(_0x1fcebd[_0x946c('0x44')]&&_0x1fcebd[_0x946c('0x44')]['queued_count']>0x0){var _0x34540e=_['head'](_0x1fcebd[_0x946c('0x44')][_0x946c('0x22')]);var _0x478438={'messageId':_0x34540e[_0x946c('0x45')]};if(!_0x238d92[_0x946c('0x38')]){_0x478438[_0x946c('0x3e')]=!![];}return _0x55000c[_0x946c('0x15')](_0x478438);}else{logger[_0x946c('0x18')](_0x946c('0x28'),_0x946c('0x29'),'clickSend',util['inspect'](_0x1fcebd,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x946c('0x28'),_0x946c('0x29'),'clickSend',util[_0x946c('0x2a')](_0x1fcebd,{'showHidden':![],'depth':null}));}})[_0x946c('0x17')](function(_0x4621fd){logger['error'](_0x946c('0x28'),_0x946c('0x29'),_0x946c('0x46'),util['inspect'](_0x4621fd,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x946c('0x28'),_0x946c('0x29'),_0x946c('0x46'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x946c('0x47'):if(_0x238d92[_0x946c('0x48')]&&_0x238d92[_0x946c('0x20')]){var _0x3a9ebe={'dst':_0xa467fc[_0x946c('0x21')],'text':_0xa467fc['body'],'src':_0x238d92[_0x946c('0x3b')]||_0x238d92['phone'],'url':_0x238d92['remote']+_0x946c('0x24')+_0xa467fc['id']+_0x946c('0x25')+_0x238d92[_0x946c('0x26')]};var _0x6ee4e7=util[_0x946c('0x40')]('%s:%s',_0x238d92[_0x946c('0x48')],_0x238d92[_0x946c('0x20')]);var _0x39950c={'method':'POST','uri':util[_0x946c('0x40')](_0x946c('0x49'),_0x238d92[_0x946c('0x48')]),'body':_0x3a9ebe,'headers':{'Authorization':util[_0x946c('0x40')](_0x946c('0x4a'),new Buffer(_0x6ee4e7)[_0x946c('0x4b')]('base64'))},'json':!![]};rp(_0x39950c)[_0x946c('0x1c')](function(_0x3acfb9){var _0x301922={'messageId':_0x3acfb9[_0x946c('0x4c')][0x0]};return _0x55000c[_0x946c('0x15')](_0x301922);})[_0x946c('0x17')](function(_0x46ca97){logger[_0x946c('0x18')](_0x946c('0x28'),_0x946c('0x29'),_0x946c('0x47'),util[_0x946c('0x2a')](_0x46ca97,{'showHidden':![],'depth':null}));});}else{logger[_0x946c('0x18')](_0x946c('0x28'),_0x946c('0x29'),_0x946c('0x47'),_0x946c('0x4d'));}break;case _0x946c('0x4e'):if(_0x238d92[_0x946c('0x2d')]&&_0x238d92[_0x946c('0x2e')]){if(_0x238d92['baseUrl']){var _0xb5e3ff={'method':_0x946c('0x4f'),'uri':_0x238d92[_0x946c('0x50')]+_0x946c('0x51'),'body':{'username':_0x238d92['username'],'password':_0x238d92[_0x946c('0x2e')]},'json':!![]};return rp(_0xb5e3ff)['then'](function(_0x3f3688){var _0x428a4d={'method':_0x946c('0x4f'),'uri':_0x238d92[_0x946c('0x50')]+_0x946c('0x52'),'body':{'messages':[{'from':_0x238d92['phone'],'destinations':[{'to':_0xa467fc[_0x946c('0x21')]}],'text':_0xa467fc[_0x946c('0xc')],'notifyUrl':_0x238d92[_0x946c('0x23')]+_0x946c('0x24')+_0xa467fc['id']+'/status?token='+_0x238d92['token'],'notifyContentType':_0x946c('0x53'),'callbackData':_0x238d92[_0x946c('0x21')]+';'+_0xa467fc[_0x946c('0xc')]}]},'headers':{'Authorization':_0x946c('0x54')+_0x3f3688[_0x946c('0x26')]},'json':!![]};return rp(_0x428a4d)['then'](function(_0x105701){if(_0x105701['messages']){var _0x2280ba={'messageId':_0x105701[_0x946c('0x22')][0x0]['messageId']};if(!_0x238d92[_0x946c('0x38')]){_0x2280ba[_0x946c('0x3e')]=!![];}return _0x55000c[_0x946c('0x15')](_0x2280ba);}else{return logger[_0x946c('0x18')](_0x946c('0x28'),_0x946c('0x29'),_0x946c('0x4e'),util['inspect'](_0x105701,{'showHidden':![],'depth':null}));}});})[_0x946c('0x17')](function(_0x55d4f1){return logger['error'](_0x946c('0x28'),_0x946c('0x29'),_0x946c('0x4e'),util[_0x946c('0x2a')](_0x55d4f1,{'showHidden':![],'depth':null}));});}else{logger[_0x946c('0x18')](_0x946c('0x28'),_0x946c('0x29'),_0x946c('0x4e'),_0x946c('0x55'));}}else{logger[_0x946c('0x18')](_0x946c('0x28'),_0x946c('0x29'),_0x946c('0x4e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x946c('0x56'):var _0x5c8223=require(_0x946c('0x57'));if(_0x238d92[_0x946c('0x58')]){var _0x56d14b={};_0x56d14b[_0x946c('0x59')]=_0x238d92[_0x946c('0x2d')];_0x56d14b[_0x946c('0x21')]=_0xa467fc[_0x946c('0x21')];_0x56d14b[_0x946c('0x30')]=_0x238d92[_0x946c('0x21')];_0x56d14b[_0x946c('0x5a')]=_0xa467fc[_0x946c('0xc')];_0x56d14b[_0x946c('0x5b')]=+new Date();var _0xca46d9='';var _0x20fbe6='';var _0x414e71=Object[_0x946c('0x5c')](_0x56d14b);_0x414e71[_0x946c('0x5d')]();for(var _0x363a99=0x0;_0x363a99<_0x414e71[_0x946c('0x5e')];_0x363a99++){if(_0xca46d9!=''){_0xca46d9+='&';}_0xca46d9+=_0x414e71[_0x363a99]+'='+encodeURIComponent(_0x56d14b[_0x414e71[_0x363a99]]);_0x20fbe6+=_0x56d14b[_0x414e71[_0x363a99]];}_0x20fbe6+=_0x238d92[_0x946c('0x58')];_0x20fbe6=_0x5c8223[_0x946c('0x5f')](_0x946c('0x60'))[_0x946c('0x15')](_0x20fbe6)[_0x946c('0x61')](_0x946c('0x62'));if(_0xca46d9!==''){_0xca46d9+='&';}_0xca46d9+='signature='+_0x20fbe6;var _0x364781={'method':_0x946c('0x33'),'uri':_0x238d92[_0x946c('0x50')]+_0x946c('0x63')+_0xca46d9,'json':!![]};return rp(_0x364781)[_0x946c('0x1c')](function(_0x168b46){var _0x5b09f6=Object[_0x946c('0x5c')](_0x168b46);if(_0x168b46[_0x5b09f6[0x0]][_0x946c('0x18')]&&parseInt(_0x168b46[_0x5b09f6[0x0]][_0x946c('0x18')])===0x0){var _0x17d60e={'messageId':_0x168b46[_0x5b09f6[0x0]][_0x946c('0x64')]};if(!_0x238d92[_0x946c('0x38')]){_0x17d60e['read']=!![];}return _0x55000c['update'](_0x17d60e);}else{return logger[_0x946c('0x18')](_0x946c('0x28'),_0x946c('0x29'),'csc',util[_0x946c('0x2a')](_0x168b46['error'],{'showHidden':![],'depth':null}));}})[_0x946c('0x17')](function(_0x4e3f84){return logger[_0x946c('0x18')](_0x946c('0x28'),_0x946c('0x29'),_0x946c('0x56'),util[_0x946c('0x2a')](_0x4e3f84,{'showHidden':![],'depth':null}));});}else{logger[_0x946c('0x18')](_0x946c('0x28'),_0x946c('0x29'),_0x946c('0x56'),_0x946c('0x65'));}break;case _0x946c('0x66'):if(_0x238d92['apiKey']){var _0x4148d7={'method':_0x946c('0x4f'),'uri':_0x946c('0x67'),'headers':{'Authorization':_0x238d92[_0x946c('0x58')]},'body':{'content':_0xa467fc['body'],'to':[_0xa467fc[_0x946c('0x21')]],'from':_0x238d92[_0x946c('0x21')],'binary':![],'clientMessageId':_0x946c('0x68'),'charset':'UTF-8'},'json':!![]};rp(_0x4148d7)[_0x946c('0x1c')](function(_0x31b237){if(!_0x31b237[_0x946c('0x18')]){var _0x1ee30e={'messageId':_0x31b237[_0x946c('0x22')][0x0][_0x946c('0x69')]};if(!_0x238d92[_0x946c('0x38')]){_0x1ee30e['read']=!![];}return _0x55000c[_0x946c('0x15')](_0x1ee30e);}else{return logger[_0x946c('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x946c('0x29'),_0x946c('0x66'),util['inspect'](_0x31b237[_0x946c('0x18')],{'showHidden':![],'depth':null}));}})[_0x946c('0x17')](function(_0x33b17d){return logger[_0x946c('0x18')](_0x946c('0x28'),_0x946c('0x29'),_0x946c('0x66'),util[_0x946c('0x2a')](_0x33b17d,{'showHidden':![],'depth':null}));});}else{logger[_0x946c('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x946c('0x29'),_0x946c('0x66'),_0x946c('0x65'));}break;case _0x946c('0x6a'):if(_0x238d92[_0x946c('0x2d')]&&_0x238d92['password']){var _0x6ee4e7=util['format'](_0x946c('0x6b'),_0x238d92[_0x946c('0x2d')],_0x238d92[_0x946c('0x2e')]);var _0x39950c={'method':_0x946c('0x4f'),'uri':_0x946c('0x6c')+_0x238d92[_0x946c('0x6d')]+_0x946c('0x6e'),'body':{'to':[_0xa467fc[_0x946c('0x21')]],'text':_0xa467fc['body'],'from':_0x238d92[_0x946c('0x21')],'applicationId':_0x238d92['applicationId']},'headers':{'Authorization':util['format'](_0x946c('0x4a'),new Buffer(_0x6ee4e7)['toString']('base64'))},'json':!![]};rp(_0x39950c)['then'](function(_0x373788){if(_0x373788['id']){var _0x2c9e3a={'messageId':_0x373788['id']};return _0x55000c[_0x946c('0x15')](_0x2c9e3a);}else{logger[_0x946c('0x18')](_0x946c('0x28'),'afterCreate',_0x946c('0x6a'),util['inspect'](_0x373788,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1f086a){logger[_0x946c('0x18')](_0x946c('0x28'),'afterCreate',_0x946c('0x6a'),util['inspect'](_0x1f086a,{'showHidden':![],'depth':null}));});}else{logger[_0x946c('0x18')](_0x946c('0x28'),_0x946c('0x29'),_0x946c('0x6a'),'Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x238d92[_0x946c('0x58')]){var _0x11d2bd={};var _0x364781={'method':_0x946c('0x4f'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x946c('0x6f')+_0x238d92[_0x946c('0x58')],'Content-Type':_0x946c('0x53')},'body':{'from':_0x238d92[_0x946c('0x21')],'to':_0xa467fc[_0x946c('0x21')],'text':_0xa467fc[_0x946c('0xc')]},'json':!![]};return rp(_0x364781)[_0x946c('0x1c')](function(_0x545d36){if(_0x545d36[_0x946c('0x70')]==0xca){_0x11d2bd[_0x946c('0x71')]=_0x545d36;var _0x3ecac0={'method':_0x946c('0x4f'),'uri':_0x946c('0x72'),'headers':{'Authorization':_0x946c('0x6f')+_0x238d92[_0x946c('0x58')],'Content-Type':_0x946c('0x53')},'body':{'refid':_0x11d2bd['message'][_0x946c('0x73')]},'json':!![]};return rp(_0x3ecac0)[_0x946c('0x1c')](function(_0x53cdf5){_0x11d2bd[_0x946c('0x74')]=_0x53cdf5;var _0x3e2f7e={'messageId':_0x11d2bd[_0x946c('0x71')][_0x946c('0x73')],'read':!![]};return _0x55000c[_0x946c('0x15')](_0x3e2f7e);});}else{return logger[_0x946c('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x946c('0x75'),util[_0x946c('0x2a')](_0x545d36,{'showHidden':![],'depth':null}));}})[_0x946c('0x17')](function(_0x3248f1){return logger[_0x946c('0x18')](_0x946c('0x28'),_0x946c('0x29'),'intelepeer',util[_0x946c('0x2a')](_0x3248f1,{'showHidden':![],'depth':null}));});}else{return logger[_0x946c('0x18')](_0x946c('0x28'),_0x946c('0x29'),_0x946c('0x75'),_0x946c('0x76'));}break;}}})[_0x946c('0x77')](function(){_0x1abf95();});}else{_0x1abf95();}}},'charset':_0x946c('0x78'),'collate':_0x946c('0x79')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 7a2621b..15d0e2b 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 _0x05a4=['request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','CreateSmsMessage','SmsMessage','body','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket'];(function(_0x2e179c,_0xa1ea49){var _0x314ac6=function(_0x5a40de){while(--_0x5a40de){_0x2e179c['push'](_0x2e179c['shift']());}};_0x314ac6(++_0xa1ea49);}(_0x05a4,0x1b3));var _0x405a=function(_0x1f2ed1,_0x2a01ab){_0x1f2ed1=_0x1f2ed1-0x0;var _0x259bd4=_0x05a4[_0x1f2ed1];return _0x259bd4;};'use strict';var _=require(_0x405a('0x0'));var util=require(_0x405a('0x1'));var moment=require('moment');var BPromise=require(_0x405a('0x2'));var rs=require(_0x405a('0x3'));var fs=require('fs');var Redis=require(_0x405a('0x4'));var db=require(_0x405a('0x5'))['db'];var utils=require(_0x405a('0x6'));var logger=require('../../config/logger')(_0x405a('0x7'));var config=require(_0x405a('0x8'));var jayson=require(_0x405a('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x405a('0xa')]=_[_0x405a('0xb')](config['redis'],{'host':_0x405a('0xc'),'port':0x18eb});var socket=require(_0x405a('0xd'))(new Redis(config[_0x405a('0xa')]));require(_0x405a('0xe'))['register'](socket);function respondWithRpcPromise(_0x1bb7b2,_0x464a7f,_0x4f2193){return new BPromise(function(_0x3373bd,_0x50eeff){return client[_0x405a('0xf')](_0x1bb7b2,_0x4f2193)[_0x405a('0x10')](function(_0x2eed8e){logger[_0x405a('0x11')]('SmsMessage,\x20%s,\x20%s',_0x464a7f,_0x405a('0x12'));logger[_0x405a('0x13')](_0x405a('0x14'),_0x464a7f,'request\x20sent',JSON[_0x405a('0x15')](_0x2eed8e));if(_0x2eed8e[_0x405a('0x16')]){if(_0x2eed8e[_0x405a('0x16')][_0x405a('0x17')]===0x1f4){logger['error'](_0x405a('0x18'),_0x464a7f,_0x2eed8e[_0x405a('0x16')]['message']);return _0x50eeff(_0x2eed8e[_0x405a('0x16')][_0x405a('0x19')]);}logger[_0x405a('0x16')](_0x405a('0x18'),_0x464a7f,_0x2eed8e['error'][_0x405a('0x19')]);return _0x3373bd(_0x2eed8e['error'][_0x405a('0x19')]);}else{logger['info'](_0x405a('0x18'),_0x464a7f,_0x405a('0x12'));_0x3373bd(_0x2eed8e['result'][_0x405a('0x19')]);}})[_0x405a('0x1a')](function(_0x1ba833){logger[_0x405a('0x16')](_0x405a('0x18'),_0x464a7f,_0x1ba833);_0x50eeff(_0x1ba833);});});}exports[_0x405a('0x1b')]=function(_0x15feaa){var _0x3ef973=this;return new Promise(function(_0xab3d54,_0x334f89){return db[_0x405a('0x1c')]['create'](_0x15feaa[_0x405a('0x1d')],{'raw':_0x15feaa['options']?_0x15feaa['options']['raw']===undefined?!![]:![]:!![]})[_0x405a('0x10')](function(_0x3f4253){logger['info']('CreateSmsMessage',_0x15feaa);logger[_0x405a('0x13')](_0x405a('0x1b'),_0x15feaa,JSON[_0x405a('0x15')](_0x3f4253));_0xab3d54(_0x3f4253);})['catch'](function(_0x28a878){logger[_0x405a('0x16')](_0x405a('0x1b'),_0x28a878[_0x405a('0x19')],_0x15feaa);_0x334f89(_0x3ef973[_0x405a('0x16')](0x1f4,_0x28a878[_0x405a('0x19')]));});});}; \ No newline at end of file +var _0x1db2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./smsMessage.socket','request','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','SmsMessage','body','options','raw','then','CreateSmsMessage','debug','catch','lodash'];(function(_0x4ae260,_0x53f335){var _0xcdb0fb=function(_0x4179e9){while(--_0x4179e9){_0x4ae260['push'](_0x4ae260['shift']());}};_0xcdb0fb(++_0x53f335);}(_0x1db2,0x65));var _0x21db=function(_0x2e7c59,_0x149458){_0x2e7c59=_0x2e7c59-0x0;var _0x18c99d=_0x1db2[_0x2e7c59];return _0x18c99d;};'use strict';var _=require(_0x21db('0x0'));var util=require('util');var moment=require(_0x21db('0x1'));var BPromise=require(_0x21db('0x2'));var rs=require(_0x21db('0x3'));var fs=require('fs');var Redis=require(_0x21db('0x4'));var db=require(_0x21db('0x5'))['db'];var utils=require(_0x21db('0x6'));var logger=require(_0x21db('0x7'))('rpc');var config=require(_0x21db('0x8'));var jayson=require(_0x21db('0x9'));var client=jayson[_0x21db('0xa')][_0x21db('0xb')]({'port':0x232a});config['redis']=_[_0x21db('0xc')](config[_0x21db('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x21db('0xe'))(new Redis(config['redis']));require(_0x21db('0xf'))['register'](socket);function respondWithRpcPromise(_0xc688a9,_0x22dd90,_0x52572d){return new BPromise(function(_0xe1b298,_0x3b2895){return client[_0x21db('0x10')](_0xc688a9,_0x52572d)['then'](function(_0x129bb9){logger['info'](_0x21db('0x11'),_0x22dd90,_0x21db('0x12'));logger['debug'](_0x21db('0x13'),_0x22dd90,_0x21db('0x12'),JSON[_0x21db('0x14')](_0x129bb9));if(_0x129bb9['error']){if(_0x129bb9['error'][_0x21db('0x15')]===0x1f4){logger[_0x21db('0x16')](_0x21db('0x11'),_0x22dd90,_0x129bb9['error'][_0x21db('0x17')]);return _0x3b2895(_0x129bb9[_0x21db('0x16')]['message']);}logger[_0x21db('0x16')](_0x21db('0x11'),_0x22dd90,_0x129bb9[_0x21db('0x16')][_0x21db('0x17')]);return _0xe1b298(_0x129bb9[_0x21db('0x16')][_0x21db('0x17')]);}else{logger[_0x21db('0x18')]('SmsMessage,\x20%s,\x20%s',_0x22dd90,_0x21db('0x12'));_0xe1b298(_0x129bb9[_0x21db('0x19')][_0x21db('0x17')]);}})['catch'](function(_0x3fce5e){logger[_0x21db('0x16')](_0x21db('0x11'),_0x22dd90,_0x3fce5e);_0x3b2895(_0x3fce5e);});});}exports['CreateSmsMessage']=function(_0x570463){var _0x1fa9da=this;return new Promise(function(_0x40cf0e,_0x201a8b){return db[_0x21db('0x1a')]['create'](_0x570463[_0x21db('0x1b')],{'raw':_0x570463[_0x21db('0x1c')]?_0x570463['options'][_0x21db('0x1d')]===undefined?!![]:![]:!![]})[_0x21db('0x1e')](function(_0x5b1e0c){logger['info'](_0x21db('0x1f'),_0x570463);logger[_0x21db('0x20')](_0x21db('0x1f'),_0x570463,JSON['stringify'](_0x5b1e0c));_0x40cf0e(_0x5b1e0c);})[_0x21db('0x21')](function(_0x15925a){logger[_0x21db('0x16')](_0x21db('0x1f'),_0x15925a['message'],_0x570463);_0x201a8b(_0x1fa9da[_0x21db('0x16')](0x1f4,_0x15925a[_0x21db('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 6efb650..42f1349 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 _0x48ce=['length','smsMessage:','./smsMessage.events','remove','update','emit','removeListener'];(function(_0x51e181,_0x212a94){var _0x290647=function(_0x12c4d6){while(--_0x12c4d6){_0x51e181['push'](_0x51e181['shift']());}};_0x290647(++_0x212a94);}(_0x48ce,0x80));var _0xe48c=function(_0x576d3d,_0x564f4d){_0x576d3d=_0x576d3d-0x0;var _0x577bd3=_0x48ce[_0x576d3d];return _0x577bd3;};'use strict';var SmsMessageEvents=require(_0xe48c('0x0'));var events=['save',_0xe48c('0x1'),_0xe48c('0x2')];function createListener(_0x3b774d,_0xb5b6b7){return function(_0x2adf18){_0xb5b6b7[_0xe48c('0x3')](_0x3b774d,_0x2adf18);};}function removeListener(_0x462888,_0x3e17a1){return function(){SmsMessageEvents[_0xe48c('0x4')](_0x462888,_0x3e17a1);};}exports['register']=function(_0xf2e52c){for(var _0x5e17dc=0x0,_0x2e36bc=events[_0xe48c('0x5')];_0x5e17dc<_0x2e36bc;_0x5e17dc++){var _0x14885b=events[_0x5e17dc];var _0x475a08=createListener(_0xe48c('0x6')+_0x14885b,_0xf2e52c);SmsMessageEvents['on'](_0x14885b,_0x475a08);}}; \ No newline at end of file +var _0xbbc8=['length','./smsMessage.events','save','remove','update','emit','register'];(function(_0x436f37,_0x29e11b){var _0x35c2c5=function(_0x1bd10e){while(--_0x1bd10e){_0x436f37['push'](_0x436f37['shift']());}};_0x35c2c5(++_0x29e11b);}(_0xbbc8,0x1e4));var _0x8bbc=function(_0x2dce99,_0x304373){_0x2dce99=_0x2dce99-0x0;var _0x4ba484=_0xbbc8[_0x2dce99];return _0x4ba484;};'use strict';var SmsMessageEvents=require(_0x8bbc('0x0'));var events=[_0x8bbc('0x1'),_0x8bbc('0x2'),_0x8bbc('0x3')];function createListener(_0x3a171b,_0x32181d){return function(_0x142784){_0x32181d[_0x8bbc('0x4')](_0x3a171b,_0x142784);};}function removeListener(_0x3cb736,_0x2f6aa7){return function(){SmsMessageEvents['removeListener'](_0x3cb736,_0x2f6aa7);};}exports[_0x8bbc('0x5')]=function(_0x38c8fd){for(var _0x5227b4=0x0,_0x380ff4=events[_0x8bbc('0x6')];_0x5227b4<_0x380ff4;_0x5227b4++){var _0x51631e=events[_0x5227b4];var _0x404a1b=createListener('smsMessage:'+_0x51631e,_0x38c8fd);SmsMessageEvents['on'](_0x51631e,_0x404a1b);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index cfe50f5..cf55570 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 _0x8ccf=['post','addTeams','/:id/users','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show','getMembers','/:id/teams','getTeams'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8ccf,0xeb));var _0xf8cc=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x8ccf[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require(_0xf8cc('0x0'));var path=require(_0xf8cc('0x1'));var timeout=require(_0xf8cc('0x2'));var express=require(_0xf8cc('0x3'));var router=express['Router']();var fs_extra=require(_0xf8cc('0x4'));var auth=require(_0xf8cc('0x5'));var interaction=require(_0xf8cc('0x6'));var config=require('../../config/environment');var controller=require(_0xf8cc('0x7'));router[_0xf8cc('0x8')]('/',auth[_0xf8cc('0x9')](),controller[_0xf8cc('0xa')]);router['get'](_0xf8cc('0xb'),auth[_0xf8cc('0x9')](),controller[_0xf8cc('0xc')]);router[_0xf8cc('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf8cc('0xd')]);router[_0xf8cc('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0xf8cc('0xe')]);router[_0xf8cc('0x8')](_0xf8cc('0xf'),auth[_0xf8cc('0x9')](),controller[_0xf8cc('0x10')]);router[_0xf8cc('0x8')]('/:id/users',auth[_0xf8cc('0x9')](),controller['getAgents']);router[_0xf8cc('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf8cc('0x11')](_0xf8cc('0xf'),auth[_0xf8cc('0x9')](),controller[_0xf8cc('0x12')]);router['post'](_0xf8cc('0x13'),auth[_0xf8cc('0x9')](),controller['addAgents']);router[_0xf8cc('0x14')](_0xf8cc('0x15'),auth[_0xf8cc('0x9')](),controller[_0xf8cc('0x16')]);router[_0xf8cc('0x17')]('/:id',auth[_0xf8cc('0x9')](),controller[_0xf8cc('0x18')]);router[_0xf8cc('0x17')](_0xf8cc('0xf'),auth[_0xf8cc('0x9')](),controller[_0xf8cc('0x19')]);router[_0xf8cc('0x17')]('/:id/users',auth[_0xf8cc('0x9')](),controller[_0xf8cc('0x1a')]);module[_0xf8cc('0x1b')]=router; \ No newline at end of file +var _0x2da2=['getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','update','destroy','delete','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams'];(function(_0x2e933d,_0x1d5419){var _0x4928fc=function(_0x16ed5f){while(--_0x16ed5f){_0x2e933d['push'](_0x2e933d['shift']());}};_0x4928fc(++_0x1d5419);}(_0x2da2,0x175));var _0x22da=function(_0x3b489c,_0x553a21){_0x3b489c=_0x3b489c-0x0;var _0x3ede3c=_0x2da2[_0x3b489c];return _0x3ede3c;};'use strict';var multer=require(_0x22da('0x0'));var util=require(_0x22da('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x22da('0x2'));var router=express[_0x22da('0x3')]();var fs_extra=require(_0x22da('0x4'));var auth=require(_0x22da('0x5'));var interaction=require(_0x22da('0x6'));var config=require('../../config/environment');var controller=require(_0x22da('0x7'));router[_0x22da('0x8')]('/',auth[_0x22da('0x9')](),controller[_0x22da('0xa')]);router[_0x22da('0x8')]('/describe',auth[_0x22da('0x9')](),controller[_0x22da('0xb')]);router['get'](_0x22da('0xc'),auth[_0x22da('0x9')](),controller[_0x22da('0xd')]);router[_0x22da('0x8')](_0x22da('0xe'),auth['isAuthenticated'](),controller[_0x22da('0xf')]);router[_0x22da('0x8')](_0x22da('0x10'),auth['isAuthenticated'](),controller[_0x22da('0x11')]);router['get']('/:id/users',auth[_0x22da('0x9')](),controller[_0x22da('0x12')]);router[_0x22da('0x13')]('/',auth[_0x22da('0x9')](),controller[_0x22da('0x14')]);router[_0x22da('0x13')]('/:id/teams',auth[_0x22da('0x9')](),controller[_0x22da('0x15')]);router[_0x22da('0x13')](_0x22da('0x16'),auth[_0x22da('0x9')](),controller[_0x22da('0x17')]);router[_0x22da('0x18')](_0x22da('0xc'),auth['isAuthenticated'](),controller[_0x22da('0x19')]);router['delete'](_0x22da('0xc'),auth['isAuthenticated'](),controller[_0x22da('0x1a')]);router[_0x22da('0x1b')]('/:id/teams',auth[_0x22da('0x9')](),controller['removeTeams']);router[_0x22da('0x1b')](_0x22da('0x16'),auth[_0x22da('0x9')](),controller[_0x22da('0x1c')]);module[_0x22da('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 22a0495..dbe8b5c 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 _0xfbb3=['exports','STRING','INTEGER','beepall','roundrobin','sequelize'];(function(_0x3c2d73,_0x577711){var _0x106ef0=function(_0x4d8298){while(--_0x4d8298){_0x3c2d73['push'](_0x3c2d73['shift']());}};_0x106ef0(++_0x577711);}(_0xfbb3,0x11f));var _0x3fbb=function(_0x400580,_0x443aae){_0x400580=_0x400580-0x0;var _0x2dbc21=_0xfbb3[_0x400580];return _0x2dbc21;};'use strict';var Sequelize=require(_0x3fbb('0x0'));module[_0x3fbb('0x1')]={'name':{'type':Sequelize[_0x3fbb('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3fbb('0x2')]},'timeout':{'type':Sequelize[_0x3fbb('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x3fbb('0x4'),_0x3fbb('0x5'))}}; \ No newline at end of file +var _0x140d=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0x140d,0x149));var _0xd140=function(_0x3058ea,_0x3da2af){_0x3058ea=_0x3058ea-0x0;var _0x3365be=_0x140d[_0x3058ea];return _0x3365be;};'use strict';var Sequelize=require(_0xd140('0x0'));module[_0xd140('0x1')]={'name':{'type':Sequelize[_0xd140('0x2')],'unique':_0xd140('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd140('0x2')]},'timeout':{'type':Sequelize[_0xd140('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd140('0x5')](_0xd140('0x6'),_0xd140('0x7'),_0xd140('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index cf28a07..362907d 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 _0xe8f9=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','SmsQueues','destroy','error','stack','send','index','map','rawAttributes','fieldName','key','model','name','keys','query','filters','attributes','intersection','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SmsQueue','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserSmsQueue','hasOwnProperty','SmsQueueId','User','findAndCountAll','UserId','smsPause','updatedAt','format','SIP','createdAt','getTeams','findOne','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','forEach','userSmsQueue:save','removeTeams','select','tq.TeamId','join','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','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','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','register','sendStatus'];(function(_0x3f4864,_0x570dc5){var _0x10935d=function(_0x4ed376){while(--_0x4ed376){_0x3f4864['push'](_0x3f4864['shift']());}};_0x10935d(++_0x570dc5);}(_0xe8f9,0x103));var _0x9e8f=function(_0x3b5d54,_0xf4c50b){_0x3b5d54=_0x3b5d54-0x0;var _0x1be73e=_0xe8f9[_0x3b5d54];return _0x1be73e;};'use strict';var emlformat=require(_0x9e8f('0x0'));var rimraf=require(_0x9e8f('0x1'));var zipdir=require(_0x9e8f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9e8f('0x3'));var moment=require(_0x9e8f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9e8f('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9e8f('0x6'));var ejs=require(_0x9e8f('0x7'));var fs=require('fs');var fs_extra=require(_0x9e8f('0x8'));var _=require(_0x9e8f('0x9'));var squel=require(_0x9e8f('0xa'));var crypto=require(_0x9e8f('0xb'));var jsforce=require(_0x9e8f('0xc'));var deskjs=require(_0x9e8f('0xd'));var toCsv=require(_0x9e8f('0x6'));var querystring=require(_0x9e8f('0xe'));var Papa=require('papaparse');var Redis=require(_0x9e8f('0xf'));var authService=require(_0x9e8f('0x10'));var qs=require(_0x9e8f('0x11'));var as=require(_0x9e8f('0x12'));var hardwareService=require(_0x9e8f('0x13'));var logger=require(_0x9e8f('0x14'))(_0x9e8f('0x15'));var utils=require(_0x9e8f('0x16'));var config=require(_0x9e8f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9e8f('0x18'))['db'];config[_0x9e8f('0x19')]=_[_0x9e8f('0x1a')](config[_0x9e8f('0x19')],{'host':_0x9e8f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9e8f('0x19')]));require(_0x9e8f('0x1c'))[_0x9e8f('0x1d')](socket);function respondWithStatusCode(_0x131911,_0x41219e){_0x41219e=_0x41219e||0xcc;return function(_0x46d246){if(_0x46d246){return _0x131911[_0x9e8f('0x1e')](_0x41219e);}return _0x131911[_0x9e8f('0x1f')](_0x41219e)[_0x9e8f('0x20')]();};}function respondWithResult(_0x2ac232,_0x29d54d){_0x29d54d=_0x29d54d||0xc8;return function(_0x5c83d0){if(_0x5c83d0){return _0x2ac232['status'](_0x29d54d)[_0x9e8f('0x21')](_0x5c83d0);}};}function respondWithFilteredResult(_0x427340,_0x3f310b){return function(_0x39a530){if(_0x39a530){var _0x57faa5=typeof _0x3f310b[_0x9e8f('0x22')]===_0x9e8f('0x23')&&typeof _0x3f310b[_0x9e8f('0x24')]==='undefined';var _0x1d2459=_0x39a530['count'];var _0x4cef96=_0x57faa5?0x0:_0x3f310b[_0x9e8f('0x22')];var _0x120448=_0x57faa5?_0x39a530[_0x9e8f('0x25')]:_0x3f310b[_0x9e8f('0x22')]+_0x3f310b[_0x9e8f('0x24')];var _0x4e5881;if(_0x120448>=_0x1d2459){_0x120448=_0x1d2459;_0x4e5881=0xc8;}else{_0x4e5881=0xce;}_0x427340['status'](_0x4e5881);return _0x427340[_0x9e8f('0x26')](_0x9e8f('0x27'),_0x4cef96+'-'+_0x120448+'/'+_0x1d2459)['json'](_0x39a530);}return null;};}function patchUpdates(_0x290530){return function(_0x1467c6){try{jsonpatch[_0x9e8f('0x28')](_0x1467c6,_0x290530,!![]);}catch(_0x4c32db){return BPromise['reject'](_0x4c32db);}return _0x1467c6[_0x9e8f('0x29')]();};}function saveUpdates(_0x381a77,_0x5d5e21){return function(_0x359dbf){if(_0x359dbf){return _0x359dbf[_0x9e8f('0x2a')](_0x381a77)[_0x9e8f('0x2b')](function(_0xbdc21f){return _0xbdc21f;});}return null;};}function removeEntity(_0x143627,_0x868dcd){return function(_0x4619a8){if(_0x4619a8){return _0x4619a8['destroy']()['then'](function(){var _0x270b29=_0x4619a8[_0x9e8f('0x2c')]({'plain':!![]});var _0x3cd0ac=_0x9e8f('0x2d');return db['UserProfileResource'][_0x9e8f('0x2e')]({'where':{'type':_0x3cd0ac,'resourceId':_0x270b29['id']}})[_0x9e8f('0x2b')](function(){return _0x4619a8;});})['then'](function(){_0x143627[_0x9e8f('0x1f')](0xcc)[_0x9e8f('0x20')]();});}};}function handleEntityNotFound(_0x5c4507,_0x3a4768){return function(_0xd373d9){if(!_0xd373d9){_0x5c4507['sendStatus'](0x194);}return _0xd373d9;};}function handleError(_0x1ac139,_0x2ef240){_0x2ef240=_0x2ef240||0x1f4;return function(_0x12da54){logger[_0x9e8f('0x2f')](_0x12da54[_0x9e8f('0x30')]);if(_0x12da54['name']){delete _0x12da54['name'];}_0x1ac139[_0x9e8f('0x1f')](_0x2ef240)[_0x9e8f('0x31')](_0x12da54);};}exports[_0x9e8f('0x32')]=function(_0xf4da79,_0x9d3bf5){var _0x162ebd={},_0x6154ce={},_0x4cdb70={'count':0x0,'rows':[]};var _0x2398d0=_[_0x9e8f('0x33')](db['SmsQueue'][_0x9e8f('0x34')],function(_0x6dab6b){return{'name':_0x6dab6b[_0x9e8f('0x35')],'type':_0x6dab6b['type'][_0x9e8f('0x36')]};});_0x6154ce[_0x9e8f('0x37')]=_[_0x9e8f('0x33')](_0x2398d0,_0x9e8f('0x38'));_0x6154ce['query']=_[_0x9e8f('0x39')](_0xf4da79[_0x9e8f('0x3a')]);_0x6154ce[_0x9e8f('0x3b')]=_['intersection'](_0x6154ce[_0x9e8f('0x37')],_0x6154ce[_0x9e8f('0x3a')]);_0x162ebd[_0x9e8f('0x3c')]=_[_0x9e8f('0x3d')](_0x6154ce[_0x9e8f('0x37')],qs['fields'](_0xf4da79[_0x9e8f('0x3a')]['fields']));_0x162ebd[_0x9e8f('0x3c')]=_0x162ebd['attributes'][_0x9e8f('0x3e')]?_0x162ebd[_0x9e8f('0x3c')]:_0x6154ce[_0x9e8f('0x37')];if(!_0xf4da79[_0x9e8f('0x3a')]['hasOwnProperty'](_0x9e8f('0x3f'))){_0x162ebd[_0x9e8f('0x24')]=qs[_0x9e8f('0x24')](_0xf4da79[_0x9e8f('0x3a')][_0x9e8f('0x24')]);_0x162ebd[_0x9e8f('0x22')]=qs[_0x9e8f('0x22')](_0xf4da79[_0x9e8f('0x3a')][_0x9e8f('0x22')]);}_0x162ebd[_0x9e8f('0x40')]=qs[_0x9e8f('0x41')](_0xf4da79[_0x9e8f('0x3a')][_0x9e8f('0x41')]);_0x162ebd[_0x9e8f('0x42')]=qs[_0x9e8f('0x3b')](_[_0x9e8f('0x43')](_0xf4da79['query'],_0x6154ce[_0x9e8f('0x3b')]),_0x2398d0);if(_0xf4da79[_0x9e8f('0x3a')][_0x9e8f('0x44')]){_0x162ebd[_0x9e8f('0x42')]=_[_0x9e8f('0x45')](_0x162ebd[_0x9e8f('0x42')],{'$or':_[_0x9e8f('0x33')](_0x2398d0,function(_0x469f2a){if(_0x469f2a[_0x9e8f('0x46')]!==_0x9e8f('0x47')){var _0x5cfccd={};_0x5cfccd[_0x469f2a[_0x9e8f('0x38')]]={'$like':'%'+_0xf4da79[_0x9e8f('0x3a')][_0x9e8f('0x44')]+'%'};return _0x5cfccd;}})});}_0x162ebd=_['merge']({},_0x162ebd,_0xf4da79[_0x9e8f('0x48')]);var _0x36dd13={'where':_0x162ebd[_0x9e8f('0x42')]};return db[_0x9e8f('0x49')][_0x9e8f('0x25')](_0x36dd13)[_0x9e8f('0x2b')](function(_0x5a1e9b){_0x4cdb70[_0x9e8f('0x25')]=_0x5a1e9b;if(_0xf4da79[_0x9e8f('0x3a')][_0x9e8f('0x4a')]){_0x162ebd[_0x9e8f('0x4b')]=[{'all':!![]}];}return db['SmsQueue'][_0x9e8f('0x4c')](_0x162ebd);})[_0x9e8f('0x2b')](function(_0x2e8ccf){_0x4cdb70[_0x9e8f('0x4d')]=_0x2e8ccf;return _0x4cdb70;})[_0x9e8f('0x2b')](respondWithFilteredResult(_0x9d3bf5,_0x162ebd))[_0x9e8f('0x4e')](handleError(_0x9d3bf5,null));};exports[_0x9e8f('0x4f')]=function(_0x10db87,_0x3d685f){var _0x205e4f={'raw':!![],'where':{'id':_0x10db87[_0x9e8f('0x50')]['id']}},_0x5b5ddc={};_0x5b5ddc[_0x9e8f('0x37')]=_['keys'](db['SmsQueue'][_0x9e8f('0x34')]);_0x5b5ddc[_0x9e8f('0x3a')]=_[_0x9e8f('0x39')](_0x10db87[_0x9e8f('0x3a')]);_0x5b5ddc[_0x9e8f('0x3b')]=_[_0x9e8f('0x3d')](_0x5b5ddc['model'],_0x5b5ddc['query']);_0x205e4f[_0x9e8f('0x3c')]=_['intersection'](_0x5b5ddc[_0x9e8f('0x37')],qs['fields'](_0x10db87[_0x9e8f('0x3a')][_0x9e8f('0x51')]));_0x205e4f[_0x9e8f('0x3c')]=_0x205e4f[_0x9e8f('0x3c')][_0x9e8f('0x3e')]?_0x205e4f['attributes']:_0x5b5ddc['model'];if(_0x10db87[_0x9e8f('0x3a')][_0x9e8f('0x4a')]){_0x205e4f[_0x9e8f('0x4b')]=[{'all':!![]}];}_0x205e4f=_[_0x9e8f('0x45')]({},_0x205e4f,_0x10db87[_0x9e8f('0x48')]);return db['SmsQueue'][_0x9e8f('0x52')](_0x205e4f)[_0x9e8f('0x2b')](handleEntityNotFound(_0x3d685f,null))['then'](respondWithResult(_0x3d685f,null))[_0x9e8f('0x4e')](handleError(_0x3d685f,null));};exports[_0x9e8f('0x53')]=function(_0x5705f0,_0x52f487){return db[_0x9e8f('0x49')][_0x9e8f('0x53')](_0x5705f0[_0x9e8f('0x54')],{})[_0x9e8f('0x2b')](function(_0x11ea81){var _0x3ac245=_0x5705f0['user'][_0x9e8f('0x2c')]({'plain':!![]});if(!_0x3ac245)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ac245[_0x9e8f('0x55')]===_0x9e8f('0x56')){var _0x14aadd=_0x11ea81[_0x9e8f('0x2c')]({'plain':!![]});var _0x220274='SmsQueues';return db[_0x9e8f('0x57')]['find']({'where':{'name':_0x220274,'userProfileId':_0x3ac245['userProfileId']},'raw':!![]})['then'](function(_0x5879d1){if(_0x5879d1&&_0x5879d1[_0x9e8f('0x58')]===0x0){return db[_0x9e8f('0x59')][_0x9e8f('0x53')]({'name':_0x14aadd['name'],'resourceId':_0x14aadd['id'],'type':_0x5879d1[_0x9e8f('0x38')],'sectionId':_0x5879d1['id']},{})['then'](function(){return _0x11ea81;});}else{return _0x11ea81;}})[_0x9e8f('0x4e')](function(_0x5c6f3c){logger[_0x9e8f('0x2f')](_0x9e8f('0x5a'),_0x5c6f3c);throw _0x5c6f3c;});}return _0x11ea81;})['then'](respondWithResult(_0x52f487,0xc9))['catch'](handleError(_0x52f487,null));};exports['update']=function(_0x541e4b,_0x56dd04){if(_0x541e4b[_0x9e8f('0x54')]['id']){delete _0x541e4b['body']['id'];}return db['SmsQueue'][_0x9e8f('0x52')]({'where':{'id':_0x541e4b[_0x9e8f('0x50')]['id']}})[_0x9e8f('0x2b')](handleEntityNotFound(_0x56dd04,null))['then'](saveUpdates(_0x541e4b[_0x9e8f('0x54')],null))[_0x9e8f('0x2b')](respondWithResult(_0x56dd04,null))[_0x9e8f('0x4e')](handleError(_0x56dd04,null));};exports['destroy']=function(_0x3d54e4,_0x3feb37){return db[_0x9e8f('0x49')][_0x9e8f('0x52')]({'where':{'id':_0x3d54e4[_0x9e8f('0x50')]['id']}})[_0x9e8f('0x2b')](handleEntityNotFound(_0x3feb37,null))['then'](removeEntity(_0x3feb37,null))[_0x9e8f('0x4e')](handleError(_0x3feb37,null));};exports[_0x9e8f('0x5b')]=function(_0x282384,_0x2e37da){return db[_0x9e8f('0x49')]['describe']()[_0x9e8f('0x2b')](respondWithResult(_0x2e37da,null))[_0x9e8f('0x4e')](handleError(_0x2e37da,null));};exports[_0x9e8f('0x5c')]=function(_0x1ae381,_0x166ac5,_0x5a29c8){var _0x2bd966={'raw':!![],'where':{}},_0x35202f={},_0x244c7f;return db[_0x9e8f('0x49')]['findOne']({'where':{'id':_0x1ae381['params']['id']}})['then'](handleEntityNotFound(_0x166ac5,null))[_0x9e8f('0x2b')](function(_0x1b2c4c){if(_0x1b2c4c){_0x244c7f=_0x1b2c4c[_0x9e8f('0x2c')]({'plain':!![]});_0x35202f[_0x9e8f('0x37')]=_['keys'](db[_0x9e8f('0x5d')][_0x9e8f('0x34')]);_0x35202f[_0x9e8f('0x3a')]=_['keys'](_0x1ae381['query']);_0x35202f[_0x9e8f('0x3b')]=_['intersection'](_0x35202f[_0x9e8f('0x37')],_0x35202f[_0x9e8f('0x3a')]);_0x2bd966[_0x9e8f('0x3c')]=_[_0x9e8f('0x3d')](_0x35202f[_0x9e8f('0x37')],qs[_0x9e8f('0x51')](_0x1ae381[_0x9e8f('0x3a')][_0x9e8f('0x51')]));_0x2bd966[_0x9e8f('0x3c')]=_0x2bd966[_0x9e8f('0x3c')]['length']?_0x2bd966[_0x9e8f('0x3c')]:_0x35202f['model'];if(!_0x1ae381[_0x9e8f('0x3a')][_0x9e8f('0x5e')](_0x9e8f('0x3f'))){_0x2bd966[_0x9e8f('0x24')]=qs[_0x9e8f('0x24')](_0x1ae381[_0x9e8f('0x3a')]['limit']);_0x2bd966[_0x9e8f('0x22')]=qs[_0x9e8f('0x22')](_0x1ae381[_0x9e8f('0x3a')][_0x9e8f('0x22')]);}_0x2bd966[_0x9e8f('0x40')]=qs[_0x9e8f('0x41')](_0x1ae381[_0x9e8f('0x3a')]['sort']);_0x2bd966[_0x9e8f('0x42')]=qs['filters'](_['pick'](_0x1ae381[_0x9e8f('0x3a')],_0x35202f[_0x9e8f('0x3b')]));_0x2bd966[_0x9e8f('0x42')][_0x9e8f('0x5f')]=_0x1b2c4c['id'];if(_0x1ae381['query'][_0x9e8f('0x44')]){_0x2bd966[_0x9e8f('0x42')]=_[_0x9e8f('0x45')](_0x2bd966['where'],{'$or':_[_0x9e8f('0x33')](_0x2bd966[_0x9e8f('0x3c')],function(_0x2a1164){var _0xd64ad5={};_0xd64ad5[_0x2a1164]={'$like':'%'+_0x1ae381[_0x9e8f('0x3a')][_0x9e8f('0x44')]+'%'};return _0xd64ad5;})});}_0x2bd966=_['merge']({},_0x2bd966,_0x1ae381[_0x9e8f('0x48')]);return db[_0x9e8f('0x5d')][_0x9e8f('0x4c')](_0x2bd966);}})['then'](function(_0x57456a){if(_0x57456a){return db[_0x9e8f('0x60')][_0x9e8f('0x61')]({'where':{'id':_['map'](_0x57456a,_0x9e8f('0x62')),'role':'agent'},'attributes':['id',_0x9e8f('0x38'),_0x9e8f('0x63'),_0x9e8f('0x64'),'createdAt']});}})[_0x9e8f('0x2b')](function(_0x449fbc){if(_0x449fbc){return{'count':_0x449fbc[_0x9e8f('0x25')],'rows':_[_0x9e8f('0x33')](_0x449fbc[_0x9e8f('0x4d')],function(_0x1206c0){return{'membername':_0x1206c0[_0x9e8f('0x38')],'UserId':_0x1206c0['id'],'queue_name':_0x244c7f[_0x9e8f('0x38')],'SmsQueueId':_0x244c7f['id'],'interface':util[_0x9e8f('0x65')]('%s/%s',_0x9e8f('0x66'),_0x1206c0[_0x9e8f('0x38')]),'penalty':0x0,'paused':_0x1206c0[_0x9e8f('0x63')],'createdAt':_0x1206c0[_0x9e8f('0x67')],'updatedAt':_0x1206c0[_0x9e8f('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9e8f('0x2b')](respondWithFilteredResult(_0x166ac5,_0x2bd966))[_0x9e8f('0x4e')](handleError(_0x166ac5,null));};exports[_0x9e8f('0x68')]=function(_0x430a83,_0xc4d39f,_0x20b0c9){var _0x1f120e={};var _0x347152={};var _0x588b59;var _0x481bdf;return db[_0x9e8f('0x49')][_0x9e8f('0x69')]({'where':{'id':_0x430a83[_0x9e8f('0x50')]['id']}})[_0x9e8f('0x2b')](handleEntityNotFound(_0xc4d39f,null))[_0x9e8f('0x2b')](function(_0x5aed7b){if(_0x5aed7b){_0x588b59=_0x5aed7b;_0x347152['model']=_[_0x9e8f('0x39')](db['Team'][_0x9e8f('0x34')]);_0x347152[_0x9e8f('0x3a')]=_[_0x9e8f('0x39')](_0x430a83[_0x9e8f('0x3a')]);_0x347152[_0x9e8f('0x3b')]=_[_0x9e8f('0x3d')](_0x347152[_0x9e8f('0x37')],_0x347152[_0x9e8f('0x3a')]);_0x1f120e[_0x9e8f('0x3c')]=_['intersection'](_0x347152[_0x9e8f('0x37')],qs[_0x9e8f('0x51')](_0x430a83[_0x9e8f('0x3a')][_0x9e8f('0x51')]));_0x1f120e[_0x9e8f('0x3c')]=_0x1f120e[_0x9e8f('0x3c')]['length']?_0x1f120e[_0x9e8f('0x3c')]:_0x347152['model'];_0x1f120e[_0x9e8f('0x40')]=qs[_0x9e8f('0x41')](_0x430a83['query'][_0x9e8f('0x41')]);_0x1f120e[_0x9e8f('0x42')]=qs[_0x9e8f('0x3b')](_[_0x9e8f('0x43')](_0x430a83[_0x9e8f('0x3a')],_0x347152[_0x9e8f('0x3b')]));if(_0x430a83[_0x9e8f('0x3a')][_0x9e8f('0x44')]){_0x1f120e[_0x9e8f('0x42')]=_[_0x9e8f('0x45')](_0x1f120e['where'],{'$or':_['map'](_0x1f120e[_0x9e8f('0x3c')],function(_0x550c56){var _0x5f4e63={};_0x5f4e63[_0x550c56]={'$like':'%'+_0x430a83[_0x9e8f('0x3a')][_0x9e8f('0x44')]+'%'};return _0x5f4e63;})});}_0x1f120e=_[_0x9e8f('0x45')]({},_0x1f120e,_0x430a83[_0x9e8f('0x48')]);return _0x588b59[_0x9e8f('0x68')](_0x1f120e);}})[_0x9e8f('0x2b')](function(_0xccab0f){if(_0xccab0f){_0x481bdf=_0xccab0f[_0x9e8f('0x3e')];if(!_0x430a83[_0x9e8f('0x3a')][_0x9e8f('0x5e')](_0x9e8f('0x3f'))){_0x1f120e[_0x9e8f('0x24')]=qs[_0x9e8f('0x24')](_0x430a83[_0x9e8f('0x3a')]['limit']);_0x1f120e[_0x9e8f('0x22')]=qs[_0x9e8f('0x22')](_0x430a83[_0x9e8f('0x3a')][_0x9e8f('0x22')]);}return _0x588b59[_0x9e8f('0x68')](_0x1f120e);}})[_0x9e8f('0x2b')](function(_0x3bfc76){if(_0x3bfc76){return _0x3bfc76?{'count':_0x481bdf,'rows':_0x3bfc76}:null;}})[_0x9e8f('0x2b')](respondWithResult(_0xc4d39f,null))[_0x9e8f('0x4e')](handleError(_0xc4d39f,null));};exports[_0x9e8f('0x6a')]=function(_0x3c036f,_0x3bd1f4,_0x106fa8){var _0x297e72=_0x3c036f[_0x9e8f('0x54')][_0x9e8f('0x6b')];return db['Team'][_0x9e8f('0x4c')]({'where':{'id':_0x297e72},'attributes':['id'],'include':[{'model':db[_0x9e8f('0x60')],'as':_0x9e8f('0x6c'),'attributes':['id',_0x9e8f('0x38'),_0x9e8f('0x6d'),_0x9e8f('0x6e'),_0x9e8f('0x6f')],'raw':!![]}]})['then'](function(_0x4162e3){if(_0x4162e3){var _0x1d437b=_[_0x9e8f('0x70')](_0x4162e3,function(_0x5c2356){var _0x3cb1f3=_0x5c2356[_0x9e8f('0x2c')]({'plain':!![]});return _0x3cb1f3[_0x9e8f('0x6c')];});return db[_0x9e8f('0x49')][_0x9e8f('0x52')]({'where':{'id':_0x3c036f[_0x9e8f('0x50')]['id']}})[_0x9e8f('0x2b')](function(_0x302fb4){return db[_0x9e8f('0x71')]['transaction'](function(_0x4c1f36){return _0x302fb4[_0x9e8f('0x6a')](_0x297e72,{'transaction':_0x4c1f36})[_0x9e8f('0x2b')](function(){return BPromise['each'](_0x1d437b,function(_0x40efd4){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x40efd4['id'],'SmsQueueId':_0x3c036f[_0x9e8f('0x50')]['id']},'transaction':_0x4c1f36});});})[_0x9e8f('0x2b')](function(){_0x1d437b[_0x9e8f('0x72')](function(_0x329fff){socket['emit'](_0x9e8f('0x73'),{'UserId':_0x329fff['id'],'SmsQueueId':_0x302fb4['id']});});});});});}})[_0x9e8f('0x2b')](respondWithStatusCode(_0x3bd1f4,null))[_0x9e8f('0x4e')](handleError(_0x3bd1f4,null));};exports[_0x9e8f('0x74')]=function(_0x12bee1,_0x3a4659,_0x326459){return db['Team'][_0x9e8f('0x4c')]({'where':{'id':_0x12bee1[_0x9e8f('0x3a')][_0x9e8f('0x6b')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x9e8f('0x2b')](handleEntityNotFound(_0x3a4659,null))[_0x9e8f('0x2b')](function(_0x137127){var _0x137cc2=_[_0x9e8f('0x33')](_0x137127,'id');var _0x102638=[];var _0x4da044=[];var _0x1e4698=squel[_0x9e8f('0x75')]();_0x1e4698['field'](_0x9e8f('0x76'))['from']('team_has_sms_queues','tq')[_0x9e8f('0x77')](_0x9e8f('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9e8f('0x42')](_0x9e8f('0x79'),_0x12bee1[_0x9e8f('0x50')]['id']);for(var _0x4e5190=0x0;_0x4e5190<_0x137127[_0x9e8f('0x3e')];_0x4e5190+=0x1){let _0x8f0574=_0x137127[_0x4e5190];for(var _0x3e43d2=0x0;_0x3e43d2<_0x8f0574[_0x9e8f('0x6c')][_0x9e8f('0x3e')];_0x3e43d2+=0x1){let _0x44e5b6=_0x8f0574['Agents'][_0x3e43d2];var _0x1c38ed=_0x1e4698[_0x9e8f('0x7a')]();_0x1c38ed[_0x9e8f('0x42')](_0x9e8f('0x7b'),_0x44e5b6['id']);_0x4da044[_0x9e8f('0x7c')](db[_0x9e8f('0x71')]['query'](_0x1c38ed[_0x9e8f('0x7d')](),{'type':db[_0x9e8f('0x71')][_0x9e8f('0x7e')][_0x9e8f('0x7f')]})[_0x9e8f('0x2b')](function(_0x29386d){if(_0x29386d[_0x9e8f('0x3e')]===0x1){return _0x44e5b6['id'];}else{var _0x52c52a=_[_0x9e8f('0x80')](_[_0x9e8f('0x33')](_0x29386d,_0x9e8f('0x81')),function(_0x24064e){return _[_0x9e8f('0x82')](_0x137cc2,_0x24064e);});if(_0x52c52a){return _0x44e5b6['id'];}}}));}}return BPromise[_0x9e8f('0x83')](_0x4da044)['then'](function(_0x409111){_0x102638=_(_0x102638)[_0x9e8f('0x84')](_0x409111)[_0x9e8f('0x85')]()[_0x9e8f('0x86')]();return db[_0x9e8f('0x49')][_0x9e8f('0x52')]({'where':{'id':_0x12bee1[_0x9e8f('0x50')]['id']}})[_0x9e8f('0x2b')](function(_0x1a9ec5){return db['sequelize'][_0x9e8f('0x87')](function(_0x5b507b){return _0x1a9ec5[_0x9e8f('0x74')](_0x12bee1['query']['ids'],{'transaction':_0x5b507b})['then'](function(){if(!_[_0x9e8f('0x88')](_0x102638)){return _0x1a9ec5[_0x9e8f('0x89')](_0x102638,{'transaction':_0x5b507b});}})[_0x9e8f('0x2b')](function(){_0x102638[_0x9e8f('0x72')](function(_0x309aa7){socket['emit'](_0x9e8f('0x8a'),{'UserId':_0x309aa7,'SmsQueueId':_0x1a9ec5['id']});});});});});});})[_0x9e8f('0x2b')](respondWithStatusCode(_0x3a4659,null))[_0x9e8f('0x4e')](handleError(_0x3a4659,null));};exports[_0x9e8f('0x8b')]=function(_0x39fe0b,_0x43be16,_0x522a89){return db[_0x9e8f('0x49')]['find']({'where':{'id':_0x39fe0b[_0x9e8f('0x50')]['id']}})[_0x9e8f('0x2b')](handleEntityNotFound(_0x43be16,null))[_0x9e8f('0x2b')](function(_0x1e3434){if(_0x1e3434){return _0x1e3434[_0x9e8f('0x8b')](_0x39fe0b[_0x9e8f('0x54')][_0x9e8f('0x6b')],_[_0x9e8f('0x8c')](_0x39fe0b[_0x9e8f('0x54')],[_0x9e8f('0x6b'),'id'])||{})[_0x9e8f('0x8d')](function(_0x1fe2ce){for(var _0x1f6c47=0x0;_0x1f6c47<_0x39fe0b[_0x9e8f('0x54')][_0x9e8f('0x6b')][_0x9e8f('0x3e')];_0x1f6c47+=0x1){socket[_0x9e8f('0x8e')](_0x9e8f('0x73'),{'UserId':Number(_0x39fe0b[_0x9e8f('0x54')][_0x9e8f('0x6b')][_0x1f6c47]),'SmsQueueId':Number(_0x39fe0b[_0x9e8f('0x50')]['id'])});}return _0x1fe2ce;});}})['then'](respondWithResult(_0x43be16,null))[_0x9e8f('0x4e')](handleError(_0x43be16,null));};exports[_0x9e8f('0x89')]=function(_0xc3e350,_0x37ceb1,_0x6d42bb){return db[_0x9e8f('0x49')][_0x9e8f('0x52')]({'where':{'id':_0xc3e350[_0x9e8f('0x50')]['id']}})[_0x9e8f('0x2b')](handleEntityNotFound(_0x37ceb1,null))[_0x9e8f('0x2b')](function(_0x33b95c){if(_0x33b95c){return _0x33b95c[_0x9e8f('0x89')](_0xc3e350['query'][_0x9e8f('0x6b')])[_0x9e8f('0x2b')](function(){if(_[_0x9e8f('0x8f')](_0xc3e350[_0x9e8f('0x3a')][_0x9e8f('0x6b')])){for(var _0x19c084=0x0;_0x19c084<_0xc3e350[_0x9e8f('0x3a')]['ids']['length'];_0x19c084+=0x1){socket['emit'](_0x9e8f('0x8a'),{'UserId':Number(_0xc3e350[_0x9e8f('0x3a')][_0x9e8f('0x6b')][_0x19c084]),'SmsQueueId':Number(_0xc3e350['params']['id'])});}}else{socket[_0x9e8f('0x8e')]('userSmsQueue:remove',{'UserId':Number(_0xc3e350['query'][_0x9e8f('0x6b')]),'SmsQueueId':Number(_0xc3e350[_0x9e8f('0x50')]['id'])});}});}})[_0x9e8f('0x2b')](respondWithStatusCode(_0x37ceb1,null))[_0x9e8f('0x4e')](handleError(_0x37ceb1,null));};exports['getAgents']=function(_0x5880b7,_0x476a79,_0x4e90f9){var _0x7aac16={};var _0x1c4a1d={};var _0x3a6d05;var _0x63c627;return db[_0x9e8f('0x49')][_0x9e8f('0x69')]({'where':{'id':_0x5880b7[_0x9e8f('0x50')]['id']}})['then'](handleEntityNotFound(_0x476a79,null))[_0x9e8f('0x2b')](function(_0x278f62){if(_0x278f62){_0x3a6d05=_0x278f62;_0x1c4a1d[_0x9e8f('0x37')]=_['keys'](db[_0x9e8f('0x60')][_0x9e8f('0x34')]);_0x1c4a1d[_0x9e8f('0x3a')]=_[_0x9e8f('0x39')](_0x5880b7[_0x9e8f('0x3a')]);_0x1c4a1d[_0x9e8f('0x3b')]=_['intersection'](_0x1c4a1d[_0x9e8f('0x37')],_0x1c4a1d['query']);_0x7aac16[_0x9e8f('0x3c')]=_[_0x9e8f('0x3d')](_0x1c4a1d[_0x9e8f('0x37')],qs[_0x9e8f('0x51')](_0x5880b7[_0x9e8f('0x3a')]['fields']));_0x7aac16[_0x9e8f('0x3c')]=_0x7aac16[_0x9e8f('0x3c')][_0x9e8f('0x3e')]?_0x7aac16[_0x9e8f('0x3c')]:_0x1c4a1d[_0x9e8f('0x37')];_0x7aac16['order']=qs[_0x9e8f('0x41')](_0x5880b7[_0x9e8f('0x3a')][_0x9e8f('0x41')]);_0x7aac16[_0x9e8f('0x42')]=qs[_0x9e8f('0x3b')](_[_0x9e8f('0x43')](_0x5880b7[_0x9e8f('0x3a')],_0x1c4a1d[_0x9e8f('0x3b')]));if(_0x5880b7[_0x9e8f('0x3a')]['filter']){_0x7aac16[_0x9e8f('0x42')]=_[_0x9e8f('0x45')](_0x7aac16[_0x9e8f('0x42')],{'$or':_[_0x9e8f('0x33')](_0x7aac16[_0x9e8f('0x3c')],function(_0x34828a){var _0x3ad348={};_0x3ad348[_0x34828a]={'$like':'%'+_0x5880b7[_0x9e8f('0x3a')][_0x9e8f('0x44')]+'%'};return _0x3ad348;})});}_0x7aac16=_[_0x9e8f('0x45')]({},_0x7aac16,_0x5880b7['options']);return _0x3a6d05[_0x9e8f('0x90')](_0x7aac16);}})[_0x9e8f('0x2b')](function(_0x9a4799){if(_0x9a4799){_0x63c627=_0x9a4799[_0x9e8f('0x3e')];if(!_0x5880b7[_0x9e8f('0x3a')][_0x9e8f('0x5e')](_0x9e8f('0x3f'))){_0x7aac16[_0x9e8f('0x24')]=qs[_0x9e8f('0x24')](_0x5880b7[_0x9e8f('0x3a')][_0x9e8f('0x24')]);_0x7aac16[_0x9e8f('0x22')]=qs['offset'](_0x5880b7[_0x9e8f('0x3a')][_0x9e8f('0x22')]);}return _0x3a6d05['getAgents'](_0x7aac16);}})[_0x9e8f('0x2b')](function(_0x3ecb54){if(_0x3ecb54){return _0x3ecb54?{'count':_0x63c627,'rows':_0x3ecb54}:null;}})[_0x9e8f('0x2b')](respondWithResult(_0x476a79,null))['catch'](handleError(_0x476a79,null));}; \ No newline at end of file +var _0x5fc8=['params','ids','User','Agents','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','Team','select','field','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','push','every','TeamId','includes','all','union','value','isEmpty','userSmsQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include','findAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','describe','getMembers','nolimit','options','UserSmsQueue','findAndCountAll','agent','updatedAt','createdAt','rows','format','SIP','smsPause','getTeams'];(function(_0x23df71,_0x1b84f4){var _0x11f3e8=function(_0x11914e){while(--_0x11914e){_0x23df71['push'](_0x23df71['shift']());}};_0x11f3e8(++_0x1b84f4);}(_0x5fc8,0xae));var _0x85fc=function(_0x18fe12,_0x127cb3){_0x18fe12=_0x18fe12-0x0;var _0x5b01b1=_0x5fc8[_0x18fe12];return _0x5b01b1;};'use strict';var emlformat=require(_0x85fc('0x0'));var rimraf=require(_0x85fc('0x1'));var zipdir=require(_0x85fc('0x2'));var jsonpatch=require(_0x85fc('0x3'));var rp=require(_0x85fc('0x4'));var moment=require(_0x85fc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x85fc('0x6'));var util=require(_0x85fc('0x7'));var path=require(_0x85fc('0x8'));var sox=require(_0x85fc('0x9'));var csv=require(_0x85fc('0xa'));var ejs=require(_0x85fc('0xb'));var fs=require('fs');var fs_extra=require(_0x85fc('0xc'));var _=require(_0x85fc('0xd'));var squel=require('squel');var crypto=require(_0x85fc('0xe'));var jsforce=require(_0x85fc('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x85fc('0xa'));var querystring=require(_0x85fc('0x10'));var Papa=require(_0x85fc('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x85fc('0x12'));var as=require(_0x85fc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x85fc('0x14'))(_0x85fc('0x15'));var utils=require(_0x85fc('0x16'));var config=require(_0x85fc('0x17'));var licenseUtil=require(_0x85fc('0x18'));var db=require(_0x85fc('0x19'))['db'];config[_0x85fc('0x1a')]=_[_0x85fc('0x1b')](config['redis'],{'host':_0x85fc('0x1c'),'port':0x18eb});var socket=require(_0x85fc('0x1d'))(new Redis(config[_0x85fc('0x1a')]));require('./smsQueue.socket')[_0x85fc('0x1e')](socket);function respondWithStatusCode(_0xeff8ca,_0x41bc44){_0x41bc44=_0x41bc44||0xcc;return function(_0x31a2c1){if(_0x31a2c1){return _0xeff8ca['sendStatus'](_0x41bc44);}return _0xeff8ca[_0x85fc('0x1f')](_0x41bc44)[_0x85fc('0x20')]();};}function respondWithResult(_0x764425,_0x50bc64){_0x50bc64=_0x50bc64||0xc8;return function(_0x2160c6){if(_0x2160c6){return _0x764425[_0x85fc('0x1f')](_0x50bc64)['json'](_0x2160c6);}};}function respondWithFilteredResult(_0x2a42b7,_0xf014c3){return function(_0x3b84c6){if(_0x3b84c6){var _0x4933b5=typeof _0xf014c3[_0x85fc('0x21')]==='undefined'&&typeof _0xf014c3[_0x85fc('0x22')]===_0x85fc('0x23');var _0xb19f57=_0x3b84c6[_0x85fc('0x24')];var _0x45d60a=_0x4933b5?0x0:_0xf014c3[_0x85fc('0x21')];var _0xb83a3b=_0x4933b5?_0x3b84c6[_0x85fc('0x24')]:_0xf014c3[_0x85fc('0x21')]+_0xf014c3[_0x85fc('0x22')];var _0x23a3f8;if(_0xb83a3b>=_0xb19f57){_0xb83a3b=_0xb19f57;_0x23a3f8=0xc8;}else{_0x23a3f8=0xce;}_0x2a42b7[_0x85fc('0x1f')](_0x23a3f8);return _0x2a42b7[_0x85fc('0x25')](_0x85fc('0x26'),_0x45d60a+'-'+_0xb83a3b+'/'+_0xb19f57)['json'](_0x3b84c6);}return null;};}function patchUpdates(_0x11963a){return function(_0xc2aa51){try{jsonpatch['apply'](_0xc2aa51,_0x11963a,!![]);}catch(_0x2fe925){return BPromise[_0x85fc('0x27')](_0x2fe925);}return _0xc2aa51['save']();};}function saveUpdates(_0x29d093,_0xbb0d81){return function(_0x3343f1){if(_0x3343f1){return _0x3343f1[_0x85fc('0x28')](_0x29d093)[_0x85fc('0x29')](function(_0x1733be){return _0x1733be;});}return null;};}function removeEntity(_0x4dd932,_0x4badef){return function(_0x4cdfa5){if(_0x4cdfa5){return _0x4cdfa5[_0x85fc('0x2a')]()[_0x85fc('0x29')](function(){var _0x22967e=_0x4cdfa5[_0x85fc('0x2b')]({'plain':!![]});var _0x47cc13=_0x85fc('0x2c');return db[_0x85fc('0x2d')][_0x85fc('0x2a')]({'where':{'type':_0x47cc13,'resourceId':_0x22967e['id']}})[_0x85fc('0x29')](function(){return _0x4cdfa5;});})[_0x85fc('0x29')](function(){_0x4dd932[_0x85fc('0x1f')](0xcc)[_0x85fc('0x20')]();});}};}function handleEntityNotFound(_0x3da66b,_0x32abcb){return function(_0x34cdcd){if(!_0x34cdcd){_0x3da66b['sendStatus'](0x194);}return _0x34cdcd;};}function handleError(_0x261116,_0xb87e67){_0xb87e67=_0xb87e67||0x1f4;return function(_0x3d8593){logger[_0x85fc('0x2e')](_0x3d8593[_0x85fc('0x2f')]);if(_0x3d8593[_0x85fc('0x30')]){delete _0x3d8593['name'];}_0x261116[_0x85fc('0x1f')](_0xb87e67)[_0x85fc('0x31')](_0x3d8593);};}exports[_0x85fc('0x32')]=function(_0x28dc54,_0x5e75b2){var _0x1fc478={},_0x1d5126={},_0x3633b0={'count':0x0,'rows':[]};var _0x51bff6=_['map'](db[_0x85fc('0x33')][_0x85fc('0x34')],function(_0x6f0e0){return{'name':_0x6f0e0[_0x85fc('0x35')],'type':_0x6f0e0[_0x85fc('0x36')][_0x85fc('0x37')]};});_0x1d5126[_0x85fc('0x38')]=_[_0x85fc('0x39')](_0x51bff6,_0x85fc('0x30'));_0x1d5126[_0x85fc('0x3a')]=_[_0x85fc('0x3b')](_0x28dc54[_0x85fc('0x3a')]);_0x1d5126[_0x85fc('0x3c')]=_[_0x85fc('0x3d')](_0x1d5126[_0x85fc('0x38')],_0x1d5126[_0x85fc('0x3a')]);_0x1fc478[_0x85fc('0x3e')]=_[_0x85fc('0x3d')](_0x1d5126[_0x85fc('0x38')],qs['fields'](_0x28dc54[_0x85fc('0x3a')][_0x85fc('0x3f')]));_0x1fc478['attributes']=_0x1fc478[_0x85fc('0x3e')][_0x85fc('0x40')]?_0x1fc478[_0x85fc('0x3e')]:_0x1d5126[_0x85fc('0x38')];if(!_0x28dc54[_0x85fc('0x3a')][_0x85fc('0x41')]('nolimit')){_0x1fc478['limit']=qs[_0x85fc('0x22')](_0x28dc54[_0x85fc('0x3a')][_0x85fc('0x22')]);_0x1fc478['offset']=qs[_0x85fc('0x21')](_0x28dc54[_0x85fc('0x3a')][_0x85fc('0x21')]);}_0x1fc478[_0x85fc('0x42')]=qs['sort'](_0x28dc54[_0x85fc('0x3a')][_0x85fc('0x43')]);_0x1fc478['where']=qs['filters'](_[_0x85fc('0x44')](_0x28dc54[_0x85fc('0x3a')],_0x1d5126[_0x85fc('0x3c')]),_0x51bff6);if(_0x28dc54['query'][_0x85fc('0x45')]){_0x1fc478['where']=_[_0x85fc('0x46')](_0x1fc478[_0x85fc('0x47')],{'$or':_[_0x85fc('0x39')](_0x51bff6,function(_0x226fad){if(_0x226fad[_0x85fc('0x36')]!==_0x85fc('0x48')){var _0x134e41={};_0x134e41[_0x226fad['name']]={'$like':'%'+_0x28dc54['query'][_0x85fc('0x45')]+'%'};return _0x134e41;}})});}_0x1fc478=_[_0x85fc('0x46')]({},_0x1fc478,_0x28dc54['options']);var _0x571da7={'where':_0x1fc478[_0x85fc('0x47')]};return db[_0x85fc('0x33')][_0x85fc('0x24')](_0x571da7)[_0x85fc('0x29')](function(_0x3f3a22){_0x3633b0[_0x85fc('0x24')]=_0x3f3a22;if(_0x28dc54[_0x85fc('0x3a')][_0x85fc('0x49')]){_0x1fc478[_0x85fc('0x4a')]=[{'all':!![]}];}return db['SmsQueue'][_0x85fc('0x4b')](_0x1fc478);})[_0x85fc('0x29')](function(_0x48b12b){_0x3633b0['rows']=_0x48b12b;return _0x3633b0;})[_0x85fc('0x29')](respondWithFilteredResult(_0x5e75b2,_0x1fc478))['catch'](handleError(_0x5e75b2,null));};exports['show']=function(_0x37c389,_0x394422){var _0x456d5a={'raw':!![],'where':{'id':_0x37c389['params']['id']}},_0x2a4992={};_0x2a4992[_0x85fc('0x38')]=_[_0x85fc('0x3b')](db['SmsQueue']['rawAttributes']);_0x2a4992[_0x85fc('0x3a')]=_[_0x85fc('0x3b')](_0x37c389[_0x85fc('0x3a')]);_0x2a4992['filters']=_['intersection'](_0x2a4992['model'],_0x2a4992[_0x85fc('0x3a')]);_0x456d5a[_0x85fc('0x3e')]=_['intersection'](_0x2a4992[_0x85fc('0x38')],qs[_0x85fc('0x3f')](_0x37c389[_0x85fc('0x3a')][_0x85fc('0x3f')]));_0x456d5a[_0x85fc('0x3e')]=_0x456d5a[_0x85fc('0x3e')][_0x85fc('0x40')]?_0x456d5a['attributes']:_0x2a4992[_0x85fc('0x38')];if(_0x37c389[_0x85fc('0x3a')][_0x85fc('0x49')]){_0x456d5a[_0x85fc('0x4a')]=[{'all':!![]}];}_0x456d5a=_[_0x85fc('0x46')]({},_0x456d5a,_0x37c389['options']);return db[_0x85fc('0x33')][_0x85fc('0x4c')](_0x456d5a)[_0x85fc('0x29')](handleEntityNotFound(_0x394422,null))[_0x85fc('0x29')](respondWithResult(_0x394422,null))[_0x85fc('0x4d')](handleError(_0x394422,null));};exports[_0x85fc('0x4e')]=function(_0x4deac9,_0x2bdf8c){return db['SmsQueue'][_0x85fc('0x4e')](_0x4deac9[_0x85fc('0x4f')],{})[_0x85fc('0x29')](function(_0x21616f){var _0x16172b=_0x4deac9[_0x85fc('0x50')][_0x85fc('0x2b')]({'plain':!![]});if(!_0x16172b)throw new Error(_0x85fc('0x51'));if(_0x16172b[_0x85fc('0x52')]===_0x85fc('0x50')){var _0x4bb66e=_0x21616f['get']({'plain':!![]});var _0x5e5ce8='SmsQueues';return db[_0x85fc('0x53')][_0x85fc('0x4c')]({'where':{'name':_0x5e5ce8,'userProfileId':_0x16172b['userProfileId']},'raw':!![]})[_0x85fc('0x29')](function(_0x2496f3){if(_0x2496f3&&_0x2496f3['autoAssociation']===0x0){return db[_0x85fc('0x2d')]['create']({'name':_0x4bb66e[_0x85fc('0x30')],'resourceId':_0x4bb66e['id'],'type':_0x2496f3[_0x85fc('0x30')],'sectionId':_0x2496f3['id']},{})[_0x85fc('0x29')](function(){return _0x21616f;});}else{return _0x21616f;}})[_0x85fc('0x4d')](function(_0x53f391){logger[_0x85fc('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f391);throw _0x53f391;});}return _0x21616f;})[_0x85fc('0x29')](respondWithResult(_0x2bdf8c,0xc9))[_0x85fc('0x4d')](handleError(_0x2bdf8c,null));};exports[_0x85fc('0x28')]=function(_0x4d869a,_0xe5d0a3){if(_0x4d869a['body']['id']){delete _0x4d869a[_0x85fc('0x4f')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x4d869a['params']['id']}})[_0x85fc('0x29')](handleEntityNotFound(_0xe5d0a3,null))[_0x85fc('0x29')](saveUpdates(_0x4d869a[_0x85fc('0x4f')],null))['then'](respondWithResult(_0xe5d0a3,null))['catch'](handleError(_0xe5d0a3,null));};exports[_0x85fc('0x2a')]=function(_0x2633e4,_0x564709){return db[_0x85fc('0x33')][_0x85fc('0x4c')]({'where':{'id':_0x2633e4['params']['id']}})[_0x85fc('0x29')](handleEntityNotFound(_0x564709,null))[_0x85fc('0x29')](removeEntity(_0x564709,null))[_0x85fc('0x4d')](handleError(_0x564709,null));};exports[_0x85fc('0x54')]=function(_0x4b3a78,_0x58ca8c){return db['SmsQueue'][_0x85fc('0x54')]()['then'](respondWithResult(_0x58ca8c,null))[_0x85fc('0x4d')](handleError(_0x58ca8c,null));};exports[_0x85fc('0x55')]=function(_0x5630c4,_0x8481d1,_0x20ab31){var _0x4ea95b={'raw':!![],'where':{}},_0x2e8fb0={},_0x529d3b;return db[_0x85fc('0x33')]['findOne']({'where':{'id':_0x5630c4['params']['id']}})[_0x85fc('0x29')](handleEntityNotFound(_0x8481d1,null))[_0x85fc('0x29')](function(_0x37cc23){if(_0x37cc23){_0x529d3b=_0x37cc23[_0x85fc('0x2b')]({'plain':!![]});_0x2e8fb0[_0x85fc('0x38')]=_['keys'](db['UserSmsQueue'][_0x85fc('0x34')]);_0x2e8fb0['query']=_['keys'](_0x5630c4[_0x85fc('0x3a')]);_0x2e8fb0[_0x85fc('0x3c')]=_[_0x85fc('0x3d')](_0x2e8fb0[_0x85fc('0x38')],_0x2e8fb0[_0x85fc('0x3a')]);_0x4ea95b[_0x85fc('0x3e')]=_[_0x85fc('0x3d')](_0x2e8fb0['model'],qs['fields'](_0x5630c4[_0x85fc('0x3a')][_0x85fc('0x3f')]));_0x4ea95b[_0x85fc('0x3e')]=_0x4ea95b[_0x85fc('0x3e')]['length']?_0x4ea95b[_0x85fc('0x3e')]:_0x2e8fb0['model'];if(!_0x5630c4[_0x85fc('0x3a')][_0x85fc('0x41')](_0x85fc('0x56'))){_0x4ea95b[_0x85fc('0x22')]=qs[_0x85fc('0x22')](_0x5630c4['query']['limit']);_0x4ea95b[_0x85fc('0x21')]=qs['offset'](_0x5630c4['query'][_0x85fc('0x21')]);}_0x4ea95b[_0x85fc('0x42')]=qs[_0x85fc('0x43')](_0x5630c4['query'][_0x85fc('0x43')]);_0x4ea95b[_0x85fc('0x47')]=qs[_0x85fc('0x3c')](_[_0x85fc('0x44')](_0x5630c4[_0x85fc('0x3a')],_0x2e8fb0['filters']));_0x4ea95b['where']['SmsQueueId']=_0x37cc23['id'];if(_0x5630c4[_0x85fc('0x3a')]['filter']){_0x4ea95b[_0x85fc('0x47')]=_['merge'](_0x4ea95b[_0x85fc('0x47')],{'$or':_['map'](_0x4ea95b[_0x85fc('0x3e')],function(_0x5542f7){var _0x25b423={};_0x25b423[_0x5542f7]={'$like':'%'+_0x5630c4[_0x85fc('0x3a')][_0x85fc('0x45')]+'%'};return _0x25b423;})});}_0x4ea95b=_[_0x85fc('0x46')]({},_0x4ea95b,_0x5630c4[_0x85fc('0x57')]);return db[_0x85fc('0x58')][_0x85fc('0x4b')](_0x4ea95b);}})['then'](function(_0xd0d98b){if(_0xd0d98b){return db['User'][_0x85fc('0x59')]({'where':{'id':_[_0x85fc('0x39')](_0xd0d98b,'UserId'),'role':_0x85fc('0x5a')},'attributes':['id',_0x85fc('0x30'),'smsPause',_0x85fc('0x5b'),_0x85fc('0x5c')]});}})[_0x85fc('0x29')](function(_0x206a46){if(_0x206a46){return{'count':_0x206a46[_0x85fc('0x24')],'rows':_[_0x85fc('0x39')](_0x206a46[_0x85fc('0x5d')],function(_0x817524){return{'membername':_0x817524[_0x85fc('0x30')],'UserId':_0x817524['id'],'queue_name':_0x529d3b['name'],'SmsQueueId':_0x529d3b['id'],'interface':util[_0x85fc('0x5e')]('%s/%s',_0x85fc('0x5f'),_0x817524[_0x85fc('0x30')]),'penalty':0x0,'paused':_0x817524[_0x85fc('0x60')],'createdAt':_0x817524[_0x85fc('0x5c')],'updatedAt':_0x817524[_0x85fc('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x85fc('0x29')](respondWithFilteredResult(_0x8481d1,_0x4ea95b))[_0x85fc('0x4d')](handleError(_0x8481d1,null));};exports[_0x85fc('0x61')]=function(_0x3d821d,_0x423864,_0x3c9a8d){var _0x1c89d5={};var _0x5e8da6={};var _0x5bd1e4;var _0x39deb7;return db['SmsQueue']['findOne']({'where':{'id':_0x3d821d[_0x85fc('0x62')]['id']}})[_0x85fc('0x29')](handleEntityNotFound(_0x423864,null))[_0x85fc('0x29')](function(_0x3966e5){if(_0x3966e5){_0x5bd1e4=_0x3966e5;_0x5e8da6[_0x85fc('0x38')]=_[_0x85fc('0x3b')](db['Team'][_0x85fc('0x34')]);_0x5e8da6['query']=_[_0x85fc('0x3b')](_0x3d821d[_0x85fc('0x3a')]);_0x5e8da6[_0x85fc('0x3c')]=_[_0x85fc('0x3d')](_0x5e8da6[_0x85fc('0x38')],_0x5e8da6[_0x85fc('0x3a')]);_0x1c89d5[_0x85fc('0x3e')]=_[_0x85fc('0x3d')](_0x5e8da6[_0x85fc('0x38')],qs[_0x85fc('0x3f')](_0x3d821d[_0x85fc('0x3a')][_0x85fc('0x3f')]));_0x1c89d5[_0x85fc('0x3e')]=_0x1c89d5[_0x85fc('0x3e')]['length']?_0x1c89d5['attributes']:_0x5e8da6[_0x85fc('0x38')];_0x1c89d5[_0x85fc('0x42')]=qs[_0x85fc('0x43')](_0x3d821d['query'][_0x85fc('0x43')]);_0x1c89d5[_0x85fc('0x47')]=qs['filters'](_[_0x85fc('0x44')](_0x3d821d[_0x85fc('0x3a')],_0x5e8da6[_0x85fc('0x3c')]));if(_0x3d821d[_0x85fc('0x3a')][_0x85fc('0x45')]){_0x1c89d5[_0x85fc('0x47')]=_[_0x85fc('0x46')](_0x1c89d5[_0x85fc('0x47')],{'$or':_[_0x85fc('0x39')](_0x1c89d5['attributes'],function(_0x5b5fa4){var _0x19871f={};_0x19871f[_0x5b5fa4]={'$like':'%'+_0x3d821d[_0x85fc('0x3a')][_0x85fc('0x45')]+'%'};return _0x19871f;})});}_0x1c89d5=_[_0x85fc('0x46')]({},_0x1c89d5,_0x3d821d[_0x85fc('0x57')]);return _0x5bd1e4[_0x85fc('0x61')](_0x1c89d5);}})[_0x85fc('0x29')](function(_0x115132){if(_0x115132){_0x39deb7=_0x115132[_0x85fc('0x40')];if(!_0x3d821d[_0x85fc('0x3a')]['hasOwnProperty']('nolimit')){_0x1c89d5[_0x85fc('0x22')]=qs[_0x85fc('0x22')](_0x3d821d[_0x85fc('0x3a')][_0x85fc('0x22')]);_0x1c89d5[_0x85fc('0x21')]=qs[_0x85fc('0x21')](_0x3d821d[_0x85fc('0x3a')][_0x85fc('0x21')]);}return _0x5bd1e4[_0x85fc('0x61')](_0x1c89d5);}})[_0x85fc('0x29')](function(_0x35fcfe){if(_0x35fcfe){return _0x35fcfe?{'count':_0x39deb7,'rows':_0x35fcfe}:null;}})['then'](respondWithResult(_0x423864,null))['catch'](handleError(_0x423864,null));};exports['addTeams']=function(_0x3b86b6,_0x141114,_0xbb6024){var _0x3be255=_0x3b86b6['body'][_0x85fc('0x63')];return db['Team'][_0x85fc('0x4b')]({'where':{'id':_0x3be255},'attributes':['id'],'include':[{'model':db[_0x85fc('0x64')],'as':_0x85fc('0x65'),'attributes':['id','name','online',_0x85fc('0x66'),_0x85fc('0x67')],'raw':!![]}]})[_0x85fc('0x29')](function(_0x4cd424){if(_0x4cd424){var _0x42e0c1=_[_0x85fc('0x68')](_0x4cd424,function(_0x1d4cac){var _0x18b0e5=_0x1d4cac['get']({'plain':!![]});return _0x18b0e5[_0x85fc('0x65')];});return db[_0x85fc('0x33')][_0x85fc('0x4c')]({'where':{'id':_0x3b86b6['params']['id']}})[_0x85fc('0x29')](function(_0x46a80f){return db[_0x85fc('0x69')][_0x85fc('0x6a')](function(_0x2e9709){return _0x46a80f[_0x85fc('0x6b')](_0x3be255,{'transaction':_0x2e9709})[_0x85fc('0x29')](function(){return BPromise['each'](_0x42e0c1,function(_0x31e465){return db[_0x85fc('0x58')][_0x85fc('0x6c')]({'where':{'UserId':_0x31e465['id'],'SmsQueueId':_0x3b86b6['params']['id']},'transaction':_0x2e9709});});})[_0x85fc('0x29')](function(){_0x42e0c1[_0x85fc('0x6d')](function(_0x526157){socket[_0x85fc('0x6e')](_0x85fc('0x6f'),{'UserId':_0x526157['id'],'SmsQueueId':_0x46a80f['id']});});});});});}})[_0x85fc('0x29')](respondWithStatusCode(_0x141114,null))[_0x85fc('0x4d')](handleError(_0x141114,null));};exports[_0x85fc('0x70')]=function(_0xedc00e,_0x3877f9,_0x475147){return db[_0x85fc('0x71')][_0x85fc('0x4b')]({'where':{'id':_0xedc00e[_0x85fc('0x3a')][_0x85fc('0x63')]},'attributes':['id'],'include':[{'model':db[_0x85fc('0x64')],'as':_0x85fc('0x65'),'attributes':['id'],'raw':!![]}]})[_0x85fc('0x29')](handleEntityNotFound(_0x3877f9,null))['then'](function(_0x5d15db){var _0x1dea8a=_[_0x85fc('0x39')](_0x5d15db,'id');var _0x1321ff=[];var _0x1ba967=[];var _0x26a1c3=squel[_0x85fc('0x72')]();_0x26a1c3[_0x85fc('0x73')]('tq.TeamId')[_0x85fc('0x74')](_0x85fc('0x75'),'tq')['join'](_0x85fc('0x76'),'ut',_0x85fc('0x77'))[_0x85fc('0x47')](_0x85fc('0x78'),_0xedc00e[_0x85fc('0x62')]['id']);for(var _0x285887=0x0;_0x285887<_0x5d15db[_0x85fc('0x40')];_0x285887+=0x1){let _0x136670=_0x5d15db[_0x285887];for(var _0x104a98=0x0;_0x104a98<_0x136670[_0x85fc('0x65')][_0x85fc('0x40')];_0x104a98+=0x1){let _0x273d3b=_0x136670['Agents'][_0x104a98];var _0x578666=_0x26a1c3['clone']();_0x578666[_0x85fc('0x47')]('ut.UserId\x20=\x20?',_0x273d3b['id']);_0x1ba967[_0x85fc('0x79')](db[_0x85fc('0x69')][_0x85fc('0x3a')](_0x578666['toString'](),{'type':db[_0x85fc('0x69')]['QueryTypes']['SELECT']})[_0x85fc('0x29')](function(_0x1e3592){if(_0x1e3592[_0x85fc('0x40')]===0x1){return _0x273d3b['id'];}else{var _0x39d84f=_[_0x85fc('0x7a')](_[_0x85fc('0x39')](_0x1e3592,_0x85fc('0x7b')),function(_0x4d547b){return _[_0x85fc('0x7c')](_0x1dea8a,_0x4d547b);});if(_0x39d84f){return _0x273d3b['id'];}}}));}}return BPromise[_0x85fc('0x7d')](_0x1ba967)['then'](function(_0x2cb8a0){_0x1321ff=_(_0x1321ff)[_0x85fc('0x7e')](_0x2cb8a0)['compact']()[_0x85fc('0x7f')]();return db[_0x85fc('0x33')][_0x85fc('0x4c')]({'where':{'id':_0xedc00e[_0x85fc('0x62')]['id']}})['then'](function(_0x1b4abb){return db['sequelize'][_0x85fc('0x6a')](function(_0x54d84b){return _0x1b4abb[_0x85fc('0x70')](_0xedc00e[_0x85fc('0x3a')]['ids'],{'transaction':_0x54d84b})[_0x85fc('0x29')](function(){if(!_[_0x85fc('0x80')](_0x1321ff)){return _0x1b4abb['removeAgents'](_0x1321ff,{'transaction':_0x54d84b});}})['then'](function(){_0x1321ff[_0x85fc('0x6d')](function(_0x546b1b){socket[_0x85fc('0x6e')](_0x85fc('0x81'),{'UserId':_0x546b1b,'SmsQueueId':_0x1b4abb['id']});});});});});});})[_0x85fc('0x29')](respondWithStatusCode(_0x3877f9,null))[_0x85fc('0x4d')](handleError(_0x3877f9,null));};exports[_0x85fc('0x82')]=function(_0xe3817c,_0x15dd3b,_0x313858){return db[_0x85fc('0x33')][_0x85fc('0x4c')]({'where':{'id':_0xe3817c[_0x85fc('0x62')]['id']}})['then'](handleEntityNotFound(_0x15dd3b,null))[_0x85fc('0x29')](function(_0x491bff){if(_0x491bff){return _0x491bff[_0x85fc('0x82')](_0xe3817c['body'][_0x85fc('0x63')],_['omit'](_0xe3817c[_0x85fc('0x4f')],[_0x85fc('0x63'),'id'])||{})[_0x85fc('0x83')](function(_0x296226){for(var _0x3c4184=0x0;_0x3c4184<_0xe3817c[_0x85fc('0x4f')]['ids'][_0x85fc('0x40')];_0x3c4184+=0x1){socket[_0x85fc('0x6e')](_0x85fc('0x6f'),{'UserId':Number(_0xe3817c[_0x85fc('0x4f')][_0x85fc('0x63')][_0x3c4184]),'SmsQueueId':Number(_0xe3817c[_0x85fc('0x62')]['id'])});}return _0x296226;});}})['then'](respondWithResult(_0x15dd3b,null))[_0x85fc('0x4d')](handleError(_0x15dd3b,null));};exports[_0x85fc('0x84')]=function(_0xa0438e,_0x346540,_0x58efb8){return db[_0x85fc('0x33')][_0x85fc('0x4c')]({'where':{'id':_0xa0438e['params']['id']}})['then'](handleEntityNotFound(_0x346540,null))[_0x85fc('0x29')](function(_0x50651a){if(_0x50651a){return _0x50651a['removeAgents'](_0xa0438e[_0x85fc('0x3a')]['ids'])[_0x85fc('0x29')](function(){if(_[_0x85fc('0x85')](_0xa0438e[_0x85fc('0x3a')][_0x85fc('0x63')])){for(var _0x47a0cc=0x0;_0x47a0cc<_0xa0438e['query'][_0x85fc('0x63')][_0x85fc('0x40')];_0x47a0cc+=0x1){socket[_0x85fc('0x6e')](_0x85fc('0x81'),{'UserId':Number(_0xa0438e[_0x85fc('0x3a')][_0x85fc('0x63')][_0x47a0cc]),'SmsQueueId':Number(_0xa0438e[_0x85fc('0x62')]['id'])});}}else{socket[_0x85fc('0x6e')](_0x85fc('0x81'),{'UserId':Number(_0xa0438e[_0x85fc('0x3a')][_0x85fc('0x63')]),'SmsQueueId':Number(_0xa0438e[_0x85fc('0x62')]['id'])});}});}})[_0x85fc('0x29')](respondWithStatusCode(_0x346540,null))['catch'](handleError(_0x346540,null));};exports[_0x85fc('0x86')]=function(_0xb460b4,_0x1c7ab7,_0x331067){var _0x488ef9={};var _0x5b1291={};var _0x374738;var _0x251ca6;return db['SmsQueue'][_0x85fc('0x87')]({'where':{'id':_0xb460b4[_0x85fc('0x62')]['id']}})[_0x85fc('0x29')](handleEntityNotFound(_0x1c7ab7,null))['then'](function(_0x4798d7){if(_0x4798d7){_0x374738=_0x4798d7;_0x5b1291[_0x85fc('0x38')]=_[_0x85fc('0x3b')](db['User']['rawAttributes']);_0x5b1291[_0x85fc('0x3a')]=_[_0x85fc('0x3b')](_0xb460b4[_0x85fc('0x3a')]);_0x5b1291[_0x85fc('0x3c')]=_[_0x85fc('0x3d')](_0x5b1291[_0x85fc('0x38')],_0x5b1291[_0x85fc('0x3a')]);_0x488ef9[_0x85fc('0x3e')]=_[_0x85fc('0x3d')](_0x5b1291[_0x85fc('0x38')],qs[_0x85fc('0x3f')](_0xb460b4[_0x85fc('0x3a')][_0x85fc('0x3f')]));_0x488ef9['attributes']=_0x488ef9[_0x85fc('0x3e')]['length']?_0x488ef9[_0x85fc('0x3e')]:_0x5b1291[_0x85fc('0x38')];_0x488ef9[_0x85fc('0x42')]=qs[_0x85fc('0x43')](_0xb460b4[_0x85fc('0x3a')][_0x85fc('0x43')]);_0x488ef9[_0x85fc('0x47')]=qs['filters'](_[_0x85fc('0x44')](_0xb460b4[_0x85fc('0x3a')],_0x5b1291[_0x85fc('0x3c')]));if(_0xb460b4['query'][_0x85fc('0x45')]){_0x488ef9[_0x85fc('0x47')]=_[_0x85fc('0x46')](_0x488ef9[_0x85fc('0x47')],{'$or':_[_0x85fc('0x39')](_0x488ef9[_0x85fc('0x3e')],function(_0x38982b){var _0x4dc20b={};_0x4dc20b[_0x38982b]={'$like':'%'+_0xb460b4[_0x85fc('0x3a')][_0x85fc('0x45')]+'%'};return _0x4dc20b;})});}_0x488ef9=_['merge']({},_0x488ef9,_0xb460b4[_0x85fc('0x57')]);return _0x374738['getAgents'](_0x488ef9);}})['then'](function(_0x195d58){if(_0x195d58){_0x251ca6=_0x195d58['length'];if(!_0xb460b4[_0x85fc('0x3a')][_0x85fc('0x41')](_0x85fc('0x56'))){_0x488ef9[_0x85fc('0x22')]=qs[_0x85fc('0x22')](_0xb460b4[_0x85fc('0x3a')]['limit']);_0x488ef9[_0x85fc('0x21')]=qs[_0x85fc('0x21')](_0xb460b4[_0x85fc('0x3a')][_0x85fc('0x21')]);}return _0x374738['getAgents'](_0x488ef9);}})[_0x85fc('0x29')](function(_0x1e5cf3){if(_0x1e5cf3){return _0x1e5cf3?{'count':_0x251ca6,'rows':_0x1e5cf3}:null;}})[_0x85fc('0x29')](respondWithResult(_0x1c7ab7,null))[_0x85fc('0x4d')](handleError(_0x1c7ab7,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 3218e33..1f8160c 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 _0x2d8b=['SmsQueue','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x5a043,_0x3886d8){var _0x554574=function(_0x449392){while(--_0x449392){_0x5a043['push'](_0x5a043['shift']());}};_0x554574(++_0x3886d8);}(_0x2d8b,0xf2));var _0xb2d8=function(_0x356e82,_0x51ca50){_0x356e82=_0x356e82-0x0;var _0x489d4e=_0x2d8b[_0x356e82];return _0x489d4e;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xb2d8('0x0'))['db'][_0xb2d8('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb2d8('0x2'),'afterUpdate':_0xb2d8('0x3'),'afterDestroy':_0xb2d8('0x4')};function emitEvent(_0x4f3c11){return function(_0x4ce932,_0x387bed,_0x3744f8){SmsQueueEvents[_0xb2d8('0x5')](_0x4f3c11+':'+_0x4ce932['id'],_0x4ce932);SmsQueueEvents['emit'](_0x4f3c11,_0x4ce932);_0x3744f8(null);};}for(var e in events){if(events[_0xb2d8('0x6')](e)){var event=events[e];SmsQueue[_0xb2d8('0x7')](e,emitEvent(event));}}module[_0xb2d8('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0xc256=['hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','update','remove','emit'];(function(_0x866bac,_0x342e1e){var _0x53c96a=function(_0x4542fb){while(--_0x4542fb){_0x866bac['push'](_0x866bac['shift']());}};_0x53c96a(++_0x342e1e);}(_0xc256,0xe3));var _0x6c25=function(_0x111ee6,_0xd8a3ea){_0x111ee6=_0x111ee6-0x0;var _0x8bbb51=_0xc256[_0x111ee6];return _0x8bbb51;};'use strict';var EventEmitter=require(_0x6c25('0x0'));var SmsQueue=require(_0x6c25('0x1'))['db'][_0x6c25('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x6c25('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6c25('0x4'),'afterDestroy':_0x6c25('0x5')};function emitEvent(_0x1209b6){return function(_0x34439a,_0x2721c0,_0x3f7c3a){SmsQueueEvents['emit'](_0x1209b6+':'+_0x34439a['id'],_0x34439a);SmsQueueEvents[_0x6c25('0x6')](_0x1209b6,_0x34439a);_0x3f7c3a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x6c25('0x7')](e,emitEvent(event));}}module[_0x6c25('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index b714377..122fb46 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 _0x8286=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','SmsQueue','sms_queues','lodash','util'];(function(_0x26cdf0,_0x27ccdf){var _0x2bffd7=function(_0x26ace){while(--_0x26ace){_0x26cdf0['push'](_0x26cdf0['shift']());}};_0x2bffd7(++_0x27ccdf);}(_0x8286,0x66));var _0x6828=function(_0x4c63e5,_0xc6d18a){_0x4c63e5=_0x4c63e5-0x0;var _0x12de07=_0x8286[_0x4c63e5];return _0x12de07;};'use strict';var _=require(_0x6828('0x0'));var util=require(_0x6828('0x1'));var logger=require(_0x6828('0x2'))(_0x6828('0x3'));var moment=require(_0x6828('0x4'));var BPromise=require(_0x6828('0x5'));var rp=require(_0x6828('0x6'));var fs=require('fs');var path=require(_0x6828('0x7'));var rimraf=require(_0x6828('0x8'));var config=require(_0x6828('0x9'));var attributes=require(_0x6828('0xa'));module['exports']=function(_0x31c3d0,_0xe4b9bb){return _0x31c3d0['define'](_0x6828('0xb'),attributes,{'tableName':_0x6828('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1ba=['define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xc1ba,0x1df));var _0xac1b=function(_0x52a713,_0x3a5045){_0x52a713=_0x52a713-0x0;var _0x4cb591=_0xc1ba[_0x52a713];return _0x4cb591;};'use strict';var _=require(_0xac1b('0x0'));var util=require(_0xac1b('0x1'));var logger=require(_0xac1b('0x2'))(_0xac1b('0x3'));var moment=require(_0xac1b('0x4'));var BPromise=require(_0xac1b('0x5'));var rp=require(_0xac1b('0x6'));var fs=require('fs');var path=require(_0xac1b('0x7'));var rimraf=require(_0xac1b('0x8'));var config=require(_0xac1b('0x9'));var attributes=require(_0xac1b('0xa'));module['exports']=function(_0x54d9c5,_0x1b8cbe){return _0x54d9c5[_0xac1b('0xb')](_0xac1b('0xc'),attributes,{'tableName':_0xac1b('0xd'),'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 b979dde..b42e2f7 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 _0xdb4c=['SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','find','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./smsQueue.socket','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xdb4c,0x12c));var _0xcdb4=function(_0x68729f,_0x271a8c){_0x68729f=_0x68729f-0x0;var _0x41240e=_0xdb4c[_0x68729f];return _0x41240e;};'use strict';var _=require(_0xcdb4('0x0'));var util=require('util');var moment=require(_0xcdb4('0x1'));var BPromise=require(_0xcdb4('0x2'));var rs=require(_0xcdb4('0x3'));var fs=require('fs');var Redis=require(_0xcdb4('0x4'));var db=require(_0xcdb4('0x5'))['db'];var utils=require(_0xcdb4('0x6'));var logger=require(_0xcdb4('0x7'))(_0xcdb4('0x8'));var config=require('../../config/environment');var jayson=require(_0xcdb4('0x9'));var client=jayson[_0xcdb4('0xa')][_0xcdb4('0xb')]({'port':0x232a});config[_0xcdb4('0xc')]=_[_0xcdb4('0xd')](config[_0xcdb4('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcdb4('0xc')]));require(_0xcdb4('0xe'))['register'](socket);function respondWithRpcPromise(_0x5d7a5d,_0x4644ef,_0x5d4845){return new BPromise(function(_0x12f7cc,_0x4c8b57){return client[_0xcdb4('0xf')](_0x5d7a5d,_0x5d4845)[_0xcdb4('0x10')](function(_0x177ad7){logger['info'](_0xcdb4('0x11'),_0x4644ef,_0xcdb4('0x12'));logger[_0xcdb4('0x13')](_0xcdb4('0x14'),_0x4644ef,'request\x20sent',JSON[_0xcdb4('0x15')](_0x177ad7));if(_0x177ad7[_0xcdb4('0x16')]){if(_0x177ad7[_0xcdb4('0x16')][_0xcdb4('0x17')]===0x1f4){logger[_0xcdb4('0x16')](_0xcdb4('0x11'),_0x4644ef,_0x177ad7[_0xcdb4('0x16')][_0xcdb4('0x18')]);return _0x4c8b57(_0x177ad7[_0xcdb4('0x16')][_0xcdb4('0x18')]);}logger['error']('SmsQueue,\x20%s,\x20%s',_0x4644ef,_0x177ad7['error'][_0xcdb4('0x18')]);return _0x12f7cc(_0x177ad7['error']['message']);}else{logger[_0xcdb4('0x19')]('SmsQueue,\x20%s,\x20%s',_0x4644ef,_0xcdb4('0x12'));_0x12f7cc(_0x177ad7[_0xcdb4('0x1a')]['message']);}})['catch'](function(_0x46f1d6){logger['error']('SmsQueue,\x20%s,\x20%s',_0x4644ef,_0x46f1d6);_0x4c8b57(_0x46f1d6);});});}exports[_0xcdb4('0x1b')]=function(_0x36a349){var _0x1f539e=this;return new Promise(function(_0x22e058,_0x458f4c){return db[_0xcdb4('0x1c')]['findAll']({'raw':_0x36a349[_0xcdb4('0x1d')]?_0x36a349['options'][_0xcdb4('0x1e')]===undefined?!![]:![]:!![],'where':_0x36a349['options']?_0x36a349[_0xcdb4('0x1d')][_0xcdb4('0x1f')]||null:null,'attributes':_0x36a349[_0xcdb4('0x1d')]?_0x36a349[_0xcdb4('0x1d')][_0xcdb4('0x20')]||null:null,'limit':_0x36a349[_0xcdb4('0x1d')]?_0x36a349[_0xcdb4('0x1d')][_0xcdb4('0x21')]||null:null,'include':_0x36a349[_0xcdb4('0x1d')]?_0x36a349[_0xcdb4('0x1d')][_0xcdb4('0x22')]?_[_0xcdb4('0x23')](_0x36a349[_0xcdb4('0x1d')][_0xcdb4('0x22')],function(_0x4f8775){return{'model':db[_0x4f8775['model']],'as':_0x4f8775['as'],'attributes':_0x4f8775[_0xcdb4('0x20')],'include':_0x4f8775[_0xcdb4('0x22')]?_['map'](_0x4f8775[_0xcdb4('0x22')],function(_0x11007a){return{'model':db[_0x11007a[_0xcdb4('0x24')]],'as':_0x11007a['as'],'attributes':_0x11007a[_0xcdb4('0x20')],'include':_0x11007a[_0xcdb4('0x22')]?_[_0xcdb4('0x23')](_0x11007a[_0xcdb4('0x22')],function(_0x30d3d6){return{'model':db[_0x30d3d6['model']],'as':_0x30d3d6['as'],'attributes':_0x30d3d6['attributes']};}):[]};}):[]};}):[]:[]})[_0xcdb4('0x10')](function(_0x3e68c4){logger[_0xcdb4('0x19')]('GetSmsQueue',_0x36a349);logger[_0xcdb4('0x13')](_0xcdb4('0x1b'),_0x36a349,JSON[_0xcdb4('0x15')](_0x3e68c4));_0x22e058(_0x3e68c4);})['catch'](function(_0x2216fc){logger[_0xcdb4('0x16')](_0xcdb4('0x1b'),_0x2216fc[_0xcdb4('0x18')],_0x36a349);_0x458f4c(_0x1f539e[_0xcdb4('0x16')](0x1f4,_0x2216fc['message']));});});};exports[_0xcdb4('0x25')]=function(_0x292725){var _0x501275=this;return new Promise(function(_0x59263f,_0x3dce3b){return db[_0xcdb4('0x1c')][_0xcdb4('0x26')]({'raw':_0x292725[_0xcdb4('0x1d')]?_0x292725['options'][_0xcdb4('0x1e')]===undefined?!![]:![]:!![],'where':_0x292725[_0xcdb4('0x1d')]?_0x292725[_0xcdb4('0x1d')][_0xcdb4('0x1f')]||null:null,'attributes':_0x292725[_0xcdb4('0x1d')]?_0x292725['options']['attributes']||null:null,'include':_0x292725[_0xcdb4('0x1d')]?_0x292725[_0xcdb4('0x1d')][_0xcdb4('0x22')]?_[_0xcdb4('0x23')](_0x292725['options'][_0xcdb4('0x22')],function(_0x35e6e2){return{'model':db[_0x35e6e2[_0xcdb4('0x24')]],'as':_0x35e6e2['as'],'attributes':_0x35e6e2[_0xcdb4('0x20')],'include':_0x35e6e2[_0xcdb4('0x22')]?_[_0xcdb4('0x23')](_0x35e6e2['include'],function(_0x367edf){return{'model':db[_0x367edf[_0xcdb4('0x24')]],'as':_0x367edf['as'],'attributes':_0x367edf[_0xcdb4('0x20')],'include':_0x367edf[_0xcdb4('0x22')]?_[_0xcdb4('0x23')](_0x367edf[_0xcdb4('0x22')],function(_0x502fbf){return{'model':db[_0x502fbf[_0xcdb4('0x24')]],'as':_0x502fbf['as'],'attributes':_0x502fbf[_0xcdb4('0x20')]};}):[]};}):[]};}):[]:[]})[_0xcdb4('0x10')](function(_0x52ac90){logger[_0xcdb4('0x19')](_0xcdb4('0x25'),_0x292725);logger[_0xcdb4('0x13')](_0xcdb4('0x25'),_0x292725,JSON[_0xcdb4('0x15')](_0x52ac90));_0x59263f(_0x52ac90);})[_0xcdb4('0x27')](function(_0x4faa9b){logger[_0xcdb4('0x16')]('ShowSmsQueue',_0x4faa9b[_0xcdb4('0x18')],_0x292725);_0x3dce3b(_0x501275[_0xcdb4('0x16')](0x1f4,_0x4faa9b['message']));});});}; \ No newline at end of file +var _0xb8f0=['ShowSmsQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','redis','register','info','SmsQueue,\x20%s,\x20%s','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','SmsQueue','findAll','options','raw','where','attributes','include','map','model','then','GetSmsQueue','debug','catch'];(function(_0x42b2a9,_0x56c32a){var _0x181e01=function(_0x2ccf5d){while(--_0x2ccf5d){_0x42b2a9['push'](_0x42b2a9['shift']());}};_0x181e01(++_0x56c32a);}(_0xb8f0,0x112));var _0x0b8f=function(_0x4b46ae,_0x2bfab2){_0x4b46ae=_0x4b46ae-0x0;var _0x120968=_0xb8f0[_0x4b46ae];return _0x120968;};'use strict';var _=require(_0x0b8f('0x0'));var util=require('util');var moment=require(_0x0b8f('0x1'));var BPromise=require(_0x0b8f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b8f('0x3'));var db=require(_0x0b8f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b8f('0x5'))(_0x0b8f('0x6'));var config=require('../../config/environment');var jayson=require(_0x0b8f('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x0b8f('0x8')]=_['defaults'](config[_0x0b8f('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsQueue.socket')[_0x0b8f('0x9')](socket);function respondWithRpcPromise(_0x396954,_0xd276b0,_0x2075c5){return new BPromise(function(_0x2063f4,_0x16b0d8){return client['request'](_0x396954,_0x2075c5)['then'](function(_0x151c13){logger[_0x0b8f('0xa')](_0x0b8f('0xb'),_0xd276b0,'request\x20sent');logger['debug'](_0x0b8f('0xc'),_0xd276b0,_0x0b8f('0xd'),JSON[_0x0b8f('0xe')](_0x151c13));if(_0x151c13[_0x0b8f('0xf')]){if(_0x151c13[_0x0b8f('0xf')][_0x0b8f('0x10')]===0x1f4){logger[_0x0b8f('0xf')]('SmsQueue,\x20%s,\x20%s',_0xd276b0,_0x151c13[_0x0b8f('0xf')][_0x0b8f('0x11')]);return _0x16b0d8(_0x151c13[_0x0b8f('0xf')][_0x0b8f('0x11')]);}logger['error'](_0x0b8f('0xb'),_0xd276b0,_0x151c13['error'][_0x0b8f('0x11')]);return _0x2063f4(_0x151c13[_0x0b8f('0xf')][_0x0b8f('0x11')]);}else{logger[_0x0b8f('0xa')](_0x0b8f('0xb'),_0xd276b0,_0x0b8f('0xd'));_0x2063f4(_0x151c13[_0x0b8f('0x12')][_0x0b8f('0x11')]);}})['catch'](function(_0x41fb9b){logger[_0x0b8f('0xf')](_0x0b8f('0xb'),_0xd276b0,_0x41fb9b);_0x16b0d8(_0x41fb9b);});});}exports['GetSmsQueue']=function(_0xd671cf){var _0x3c49a6=this;return new Promise(function(_0x308592,_0x1dfe16){return db[_0x0b8f('0x13')][_0x0b8f('0x14')]({'raw':_0xd671cf[_0x0b8f('0x15')]?_0xd671cf[_0x0b8f('0x15')][_0x0b8f('0x16')]===undefined?!![]:![]:!![],'where':_0xd671cf[_0x0b8f('0x15')]?_0xd671cf[_0x0b8f('0x15')][_0x0b8f('0x17')]||null:null,'attributes':_0xd671cf[_0x0b8f('0x15')]?_0xd671cf[_0x0b8f('0x15')][_0x0b8f('0x18')]||null:null,'limit':_0xd671cf[_0x0b8f('0x15')]?_0xd671cf[_0x0b8f('0x15')]['limit']||null:null,'include':_0xd671cf['options']?_0xd671cf['options'][_0x0b8f('0x19')]?_[_0x0b8f('0x1a')](_0xd671cf[_0x0b8f('0x15')][_0x0b8f('0x19')],function(_0x1041b1){return{'model':db[_0x1041b1[_0x0b8f('0x1b')]],'as':_0x1041b1['as'],'attributes':_0x1041b1[_0x0b8f('0x18')],'include':_0x1041b1['include']?_[_0x0b8f('0x1a')](_0x1041b1['include'],function(_0x388178){return{'model':db[_0x388178[_0x0b8f('0x1b')]],'as':_0x388178['as'],'attributes':_0x388178['attributes'],'include':_0x388178[_0x0b8f('0x19')]?_[_0x0b8f('0x1a')](_0x388178[_0x0b8f('0x19')],function(_0x3609d5){return{'model':db[_0x3609d5[_0x0b8f('0x1b')]],'as':_0x3609d5['as'],'attributes':_0x3609d5[_0x0b8f('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0b8f('0x1c')](function(_0x2822a1){logger[_0x0b8f('0xa')](_0x0b8f('0x1d'),_0xd671cf);logger[_0x0b8f('0x1e')](_0x0b8f('0x1d'),_0xd671cf,JSON[_0x0b8f('0xe')](_0x2822a1));_0x308592(_0x2822a1);})[_0x0b8f('0x1f')](function(_0x9c5879){logger[_0x0b8f('0xf')](_0x0b8f('0x1d'),_0x9c5879['message'],_0xd671cf);_0x1dfe16(_0x3c49a6[_0x0b8f('0xf')](0x1f4,_0x9c5879[_0x0b8f('0x11')]));});});};exports[_0x0b8f('0x20')]=function(_0x1727cd){var _0x252bb7=this;return new Promise(function(_0x1dc576,_0x5c377e){return db[_0x0b8f('0x13')][_0x0b8f('0x21')]({'raw':_0x1727cd[_0x0b8f('0x15')]?_0x1727cd[_0x0b8f('0x15')][_0x0b8f('0x16')]===undefined?!![]:![]:!![],'where':_0x1727cd[_0x0b8f('0x15')]?_0x1727cd[_0x0b8f('0x15')][_0x0b8f('0x17')]||null:null,'attributes':_0x1727cd[_0x0b8f('0x15')]?_0x1727cd[_0x0b8f('0x15')][_0x0b8f('0x18')]||null:null,'include':_0x1727cd['options']?_0x1727cd['options'][_0x0b8f('0x19')]?_[_0x0b8f('0x1a')](_0x1727cd['options']['include'],function(_0x2d278){return{'model':db[_0x2d278['model']],'as':_0x2d278['as'],'attributes':_0x2d278['attributes'],'include':_0x2d278['include']?_[_0x0b8f('0x1a')](_0x2d278[_0x0b8f('0x19')],function(_0x1ebd2a){return{'model':db[_0x1ebd2a[_0x0b8f('0x1b')]],'as':_0x1ebd2a['as'],'attributes':_0x1ebd2a['attributes'],'include':_0x1ebd2a[_0x0b8f('0x19')]?_[_0x0b8f('0x1a')](_0x1ebd2a['include'],function(_0x4bfece){return{'model':db[_0x4bfece[_0x0b8f('0x1b')]],'as':_0x4bfece['as'],'attributes':_0x4bfece[_0x0b8f('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0b8f('0x1c')](function(_0x37c10b){logger[_0x0b8f('0xa')]('ShowSmsQueue',_0x1727cd);logger[_0x0b8f('0x1e')](_0x0b8f('0x20'),_0x1727cd,JSON[_0x0b8f('0xe')](_0x37c10b));_0x1dc576(_0x37c10b);})[_0x0b8f('0x1f')](function(_0x56d576){logger[_0x0b8f('0xf')](_0x0b8f('0x20'),_0x56d576['message'],_0x1727cd);_0x5c377e(_0x252bb7[_0x0b8f('0xf')](0x1f4,_0x56d576[_0x0b8f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 77439fd..4d39403 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 _0x1422=['update','emit','register','./smsQueue.events','save','remove'];(function(_0x574d75,_0x1cb2f4){var _0x42b7c0=function(_0x18462c){while(--_0x18462c){_0x574d75['push'](_0x574d75['shift']());}};_0x42b7c0(++_0x1cb2f4);}(_0x1422,0xc3));var _0x2142=function(_0x368fc3,_0x2b7c2c){_0x368fc3=_0x368fc3-0x0;var _0x1fa4b2=_0x1422[_0x368fc3];return _0x1fa4b2;};'use strict';var SmsQueueEvents=require(_0x2142('0x0'));var events=[_0x2142('0x1'),_0x2142('0x2'),_0x2142('0x3')];function createListener(_0x5e35f3,_0x3d29c5){return function(_0x13ad31){_0x3d29c5[_0x2142('0x4')](_0x5e35f3,_0x13ad31);};}function removeListener(_0x3cf886,_0xa73694){return function(){SmsQueueEvents['removeListener'](_0x3cf886,_0xa73694);};}exports[_0x2142('0x5')]=function(_0x2b427d){for(var _0x3e8018=0x0,_0x2c73fe=events['length'];_0x3e8018<_0x2c73fe;_0x3e8018++){var _0x7ea95e=events[_0x3e8018];var _0x18359d=createListener('smsQueue:'+_0x7ea95e,_0x2b427d);SmsQueueEvents['on'](_0x7ea95e,_0x18359d);}}; \ No newline at end of file +var _0xd2b1=['emit','removeListener','register','length','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd2b1,0x1eb));var _0x1d2b=function(_0x4cefad,_0x451fac){_0x4cefad=_0x4cefad-0x0;var _0x9f8b25=_0xd2b1[_0x4cefad];return _0x9f8b25;};'use strict';var SmsQueueEvents=require(_0x1d2b('0x0'));var events=[_0x1d2b('0x1'),_0x1d2b('0x2'),_0x1d2b('0x3')];function createListener(_0x52835e,_0x32f7a6){return function(_0x18c395){_0x32f7a6[_0x1d2b('0x4')](_0x52835e,_0x18c395);};}function removeListener(_0x8b617a,_0x21f34f){return function(){SmsQueueEvents[_0x1d2b('0x5')](_0x8b617a,_0x21f34f);};}exports[_0x1d2b('0x6')]=function(_0x2acd59){for(var _0x40241e=0x0,_0xa23d79=events[_0x1d2b('0x7')];_0x40241e<_0xa23d79;_0x40241e++){var _0x50ca59=events[_0x40241e];var _0x26258a=createListener(_0x1d2b('0x8')+_0x50ca59,_0x2acd59);SmsQueueEvents['on'](_0x50ca59,_0x26258a);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 5f758d8..4708e00 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 _0x4677=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','describe','show','put','/:id','delete','destroy','multer'];(function(_0x4ec362,_0x18c1f0){var _0x245d0c=function(_0x23749f){while(--_0x23749f){_0x4ec362['push'](_0x4ec362['shift']());}};_0x245d0c(++_0x18c1f0);}(_0x4677,0x155));var _0x7467=function(_0x207b50,_0x452597){_0x207b50=_0x207b50-0x0;var _0x1bdc19=_0x4677[_0x207b50];return _0x1bdc19;};'use strict';var multer=require(_0x7467('0x0'));var util=require('util');var path=require(_0x7467('0x1'));var timeout=require(_0x7467('0x2'));var express=require(_0x7467('0x3'));var router=express['Router']();var fs_extra=require(_0x7467('0x4'));var auth=require(_0x7467('0x5'));var interaction=require(_0x7467('0x6'));var config=require(_0x7467('0x7'));var controller=require(_0x7467('0x8'));router[_0x7467('0x9')]('/',auth[_0x7467('0xa')](),controller[_0x7467('0xb')]);router[_0x7467('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x7467('0xc')]);router[_0x7467('0x9')]('/:id',auth[_0x7467('0xa')](),controller[_0x7467('0xd')]);router['post']('/',auth[_0x7467('0xa')](),controller['create']);router[_0x7467('0xe')](_0x7467('0xf'),auth[_0x7467('0xa')](),controller['update']);router[_0x7467('0x10')](_0x7467('0xf'),auth[_0x7467('0xa')](),controller[_0x7467('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe581=['delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','/:id','post','create','put','update'];(function(_0x4a8072,_0x435bab){var _0x11a4fe=function(_0x24b69a){while(--_0x24b69a){_0x4a8072['push'](_0x4a8072['shift']());}};_0x11a4fe(++_0x435bab);}(_0xe581,0x80));var _0x1e58=function(_0x5dfcec,_0x7862b7){_0x5dfcec=_0x5dfcec-0x0;var _0x56b492=_0xe581[_0x5dfcec];return _0x56b492;};'use strict';var multer=require(_0x1e58('0x0'));var util=require(_0x1e58('0x1'));var path=require('path');var timeout=require(_0x1e58('0x2'));var express=require(_0x1e58('0x3'));var router=express[_0x1e58('0x4')]();var fs_extra=require(_0x1e58('0x5'));var auth=require(_0x1e58('0x6'));var interaction=require(_0x1e58('0x7'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1e58('0x8')](_0x1e58('0x9'),auth[_0x1e58('0xa')](),controller['describe']);router[_0x1e58('0x8')](_0x1e58('0xb'),auth[_0x1e58('0xa')](),controller['show']);router[_0x1e58('0xc')]('/',auth[_0x1e58('0xa')](),controller[_0x1e58('0xd')]);router[_0x1e58('0xe')]('/:id',auth[_0x1e58('0xa')](),controller[_0x1e58('0xf')]);router[_0x1e58('0x10')](_0x1e58('0xb'),auth[_0x1e58('0xa')](),controller[_0x1e58('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index cfad448..d186ab9 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 _0xae14=['STRING','DATE','moment','exports'];(function(_0x10151c,_0x52c188){var _0x554712=function(_0x59c46d){while(--_0x59c46d){_0x10151c['push'](_0x10151c['shift']());}};_0x554712(++_0x52c188);}(_0xae14,0xd6));var _0x4ae1=function(_0x587a1e,_0x2efd41){_0x587a1e=_0x587a1e-0x0;var _0x60b3e3=_0xae14[_0x587a1e];return _0x60b3e3;};'use strict';var moment=require(_0x4ae1('0x0'));var Sequelize=require('sequelize');module[_0x4ae1('0x1')]={'uniqueid':{'type':Sequelize[_0x4ae1('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x4ae1('0x2')]},'joinAt':{'type':Sequelize[_0x4ae1('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x4ae1('0x3')]},'exitAt':{'type':Sequelize[_0x4ae1('0x3')]},'reason':{'type':Sequelize[_0x4ae1('0x2')]}}; \ No newline at end of file +var _0xb1ed=['STRING','exports','DATE'];(function(_0x464f71,_0x1c4e75){var _0x316910=function(_0x5d1dba){while(--_0x5d1dba){_0x464f71['push'](_0x464f71['shift']());}};_0x316910(++_0x1c4e75);}(_0xb1ed,0x8b));var _0xdb1e=function(_0x4db7c1,_0x40baeb){_0x4db7c1=_0x4db7c1-0x0;var _0x41fa35=_0xb1ed[_0x4db7c1];return _0x41fa35;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xdb1e('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xdb1e('0x1')]},'leaveAt':{'type':Sequelize[_0xdb1e('0x1')]},'acceptAt':{'type':Sequelize[_0xdb1e('0x1')]},'exitAt':{'type':Sequelize[_0xdb1e('0x1')]},'reason':{'type':Sequelize[_0xdb1e('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index c5e425d..f1707f5 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 _0x77f1=['update','then','destroy','error','stack','name','send','index','map','SmsQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x77f1,0x149));var _0x177f=function(_0x470006,_0x53bd95){_0x470006=_0x470006-0x0;var _0x5f1abe=_0x77f1[_0x470006];return _0x5f1abe;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x177f('0x0'));var jsonpatch=require(_0x177f('0x1'));var rp=require(_0x177f('0x2'));var moment=require(_0x177f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x177f('0x4'));var path=require('path');var sox=require(_0x177f('0x5'));var csv=require(_0x177f('0x6'));var ejs=require(_0x177f('0x7'));var fs=require('fs');var fs_extra=require(_0x177f('0x8'));var _=require('lodash');var squel=require(_0x177f('0x9'));var crypto=require(_0x177f('0xa'));var jsforce=require(_0x177f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x177f('0x6'));var querystring=require('querystring');var Papa=require(_0x177f('0xc'));var Redis=require(_0x177f('0xd'));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(_0x177f('0xe'))(_0x177f('0xf'));var utils=require(_0x177f('0x10'));var config=require(_0x177f('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x177f('0x12'))['db'];function respondWithStatusCode(_0x198873,_0x1310b8){_0x1310b8=_0x1310b8||0xcc;return function(_0x44b81){if(_0x44b81){return _0x198873[_0x177f('0x13')](_0x1310b8);}return _0x198873[_0x177f('0x14')](_0x1310b8)[_0x177f('0x15')]();};}function respondWithResult(_0x424117,_0x104a26){_0x104a26=_0x104a26||0xc8;return function(_0x3c9c14){if(_0x3c9c14){return _0x424117[_0x177f('0x14')](_0x104a26)['json'](_0x3c9c14);}};}function respondWithFilteredResult(_0x114d2c,_0x29f43b){return function(_0x28a0af){if(_0x28a0af){var _0x4d5e1f=typeof _0x29f43b[_0x177f('0x16')]==='undefined'&&typeof _0x29f43b[_0x177f('0x17')]===_0x177f('0x18');var _0x163c8b=_0x28a0af[_0x177f('0x19')];var _0x34dd60=_0x4d5e1f?0x0:_0x29f43b[_0x177f('0x16')];var _0x355cf2=_0x4d5e1f?_0x28a0af[_0x177f('0x19')]:_0x29f43b[_0x177f('0x16')]+_0x29f43b[_0x177f('0x17')];var _0x18b62f;if(_0x355cf2>=_0x163c8b){_0x355cf2=_0x163c8b;_0x18b62f=0xc8;}else{_0x18b62f=0xce;}_0x114d2c[_0x177f('0x14')](_0x18b62f);return _0x114d2c['set'](_0x177f('0x1a'),_0x34dd60+'-'+_0x355cf2+'/'+_0x163c8b)[_0x177f('0x1b')](_0x28a0af);}return null;};}function patchUpdates(_0x3489f2){return function(_0x5decc2){try{jsonpatch[_0x177f('0x1c')](_0x5decc2,_0x3489f2,!![]);}catch(_0x3632e7){return BPromise[_0x177f('0x1d')](_0x3632e7);}return _0x5decc2[_0x177f('0x1e')]();};}function saveUpdates(_0x1d0281,_0x46c42c){return function(_0x2c8750){if(_0x2c8750){return _0x2c8750[_0x177f('0x1f')](_0x1d0281)[_0x177f('0x20')](function(_0x7ae48){return _0x7ae48;});}return null;};}function removeEntity(_0x152b8e,_0xe81258){return function(_0x2a16a5){if(_0x2a16a5){return _0x2a16a5[_0x177f('0x21')]()['then'](function(){_0x152b8e[_0x177f('0x14')](0xcc)[_0x177f('0x15')]();});}};}function handleEntityNotFound(_0x56c328,_0x2003fa){return function(_0x3fd1f4){if(!_0x3fd1f4){_0x56c328['sendStatus'](0x194);}return _0x3fd1f4;};}function handleError(_0x30f77a,_0x4b161f){_0x4b161f=_0x4b161f||0x1f4;return function(_0x7ee205){logger[_0x177f('0x22')](_0x7ee205[_0x177f('0x23')]);if(_0x7ee205[_0x177f('0x24')]){delete _0x7ee205[_0x177f('0x24')];}_0x30f77a[_0x177f('0x14')](_0x4b161f)[_0x177f('0x25')](_0x7ee205);};}exports[_0x177f('0x26')]=function(_0x38df50,_0x2ca363){var _0x3c6bcf={},_0x1c8bec={},_0x3b2706={'count':0x0,'rows':[]};var _0x3ab112=_[_0x177f('0x27')](db[_0x177f('0x28')]['rawAttributes'],function(_0x11c804){return{'name':_0x11c804[_0x177f('0x29')],'type':_0x11c804[_0x177f('0x2a')][_0x177f('0x2b')]};});_0x1c8bec[_0x177f('0x2c')]=_[_0x177f('0x27')](_0x3ab112,_0x177f('0x24'));_0x1c8bec[_0x177f('0x2d')]=_[_0x177f('0x2e')](_0x38df50['query']);_0x1c8bec[_0x177f('0x2f')]=_[_0x177f('0x30')](_0x1c8bec[_0x177f('0x2c')],_0x1c8bec[_0x177f('0x2d')]);_0x3c6bcf[_0x177f('0x31')]=_[_0x177f('0x30')](_0x1c8bec['model'],qs[_0x177f('0x32')](_0x38df50[_0x177f('0x2d')][_0x177f('0x32')]));_0x3c6bcf[_0x177f('0x31')]=_0x3c6bcf[_0x177f('0x31')]['length']?_0x3c6bcf[_0x177f('0x31')]:_0x1c8bec[_0x177f('0x2c')];if(!_0x38df50[_0x177f('0x2d')][_0x177f('0x33')](_0x177f('0x34'))){_0x3c6bcf[_0x177f('0x17')]=qs[_0x177f('0x17')](_0x38df50[_0x177f('0x2d')][_0x177f('0x17')]);_0x3c6bcf[_0x177f('0x16')]=qs[_0x177f('0x16')](_0x38df50[_0x177f('0x2d')][_0x177f('0x16')]);}_0x3c6bcf[_0x177f('0x35')]=qs[_0x177f('0x36')](_0x38df50[_0x177f('0x2d')][_0x177f('0x36')]);_0x3c6bcf['where']=qs['filters'](_['pick'](_0x38df50[_0x177f('0x2d')],_0x1c8bec[_0x177f('0x2f')]),_0x3ab112);if(_0x38df50[_0x177f('0x2d')][_0x177f('0x37')]){_0x3c6bcf['where']=_[_0x177f('0x38')](_0x3c6bcf['where'],{'$or':_[_0x177f('0x27')](_0x3ab112,function(_0x243aef){if(_0x243aef[_0x177f('0x2a')]!==_0x177f('0x39')){var _0x44e5e3={};_0x44e5e3[_0x243aef[_0x177f('0x24')]]={'$like':'%'+_0x38df50[_0x177f('0x2d')][_0x177f('0x37')]+'%'};return _0x44e5e3;}})});}_0x3c6bcf=_['merge']({},_0x3c6bcf,_0x38df50[_0x177f('0x3a')]);var _0xf3b9be={'where':_0x3c6bcf[_0x177f('0x3b')]};return db['SmsQueueReport'][_0x177f('0x19')](_0xf3b9be)[_0x177f('0x20')](function(_0x826651){_0x3b2706[_0x177f('0x19')]=_0x826651;if(_0x38df50[_0x177f('0x2d')][_0x177f('0x3c')]){_0x3c6bcf[_0x177f('0x3d')]=[{'all':!![]}];}return db[_0x177f('0x28')][_0x177f('0x3e')](_0x3c6bcf);})[_0x177f('0x20')](function(_0x42382e){_0x3b2706[_0x177f('0x3f')]=_0x42382e;return _0x3b2706;})['then'](respondWithFilteredResult(_0x2ca363,_0x3c6bcf))[_0x177f('0x40')](handleError(_0x2ca363,null));};exports[_0x177f('0x41')]=function(_0x40a105,_0x3d1e21){var _0x3aa2b8={'raw':!![],'where':{'id':_0x40a105[_0x177f('0x42')]['id']}},_0xe136ec={};_0xe136ec[_0x177f('0x2c')]=_[_0x177f('0x2e')](db[_0x177f('0x28')][_0x177f('0x43')]);_0xe136ec[_0x177f('0x2d')]=_[_0x177f('0x2e')](_0x40a105[_0x177f('0x2d')]);_0xe136ec['filters']=_['intersection'](_0xe136ec[_0x177f('0x2c')],_0xe136ec[_0x177f('0x2d')]);_0x3aa2b8[_0x177f('0x31')]=_[_0x177f('0x30')](_0xe136ec[_0x177f('0x2c')],qs['fields'](_0x40a105[_0x177f('0x2d')]['fields']));_0x3aa2b8['attributes']=_0x3aa2b8[_0x177f('0x31')]['length']?_0x3aa2b8[_0x177f('0x31')]:_0xe136ec[_0x177f('0x2c')];if(_0x40a105[_0x177f('0x2d')]['includeAll']){_0x3aa2b8[_0x177f('0x3d')]=[{'all':!![]}];}_0x3aa2b8=_[_0x177f('0x38')]({},_0x3aa2b8,_0x40a105[_0x177f('0x3a')]);return db['SmsQueueReport']['find'](_0x3aa2b8)[_0x177f('0x20')](handleEntityNotFound(_0x3d1e21,null))[_0x177f('0x20')](respondWithResult(_0x3d1e21,null))[_0x177f('0x40')](handleError(_0x3d1e21,null));};exports[_0x177f('0x44')]=function(_0x285b00,_0x38bbc1){return db[_0x177f('0x28')][_0x177f('0x44')](_0x285b00['body'],{})[_0x177f('0x20')](respondWithResult(_0x38bbc1,0xc9))['catch'](handleError(_0x38bbc1,null));};exports['update']=function(_0x3b7b35,_0x3f9d45){if(_0x3b7b35[_0x177f('0x45')]['id']){delete _0x3b7b35['body']['id'];}return db[_0x177f('0x28')]['find']({'where':{'id':_0x3b7b35[_0x177f('0x42')]['id']}})['then'](handleEntityNotFound(_0x3f9d45,null))['then'](saveUpdates(_0x3b7b35[_0x177f('0x45')],null))[_0x177f('0x20')](respondWithResult(_0x3f9d45,null))[_0x177f('0x40')](handleError(_0x3f9d45,null));};exports['destroy']=function(_0x3606e3,_0xd3eaec){return db[_0x177f('0x28')][_0x177f('0x46')]({'where':{'id':_0x3606e3[_0x177f('0x42')]['id']}})[_0x177f('0x20')](handleEntityNotFound(_0xd3eaec,null))['then'](removeEntity(_0xd3eaec,null))['catch'](handleError(_0xd3eaec,null));};exports['describe']=function(_0xcea518,_0xb26c6b){return db[_0x177f('0x28')][_0x177f('0x47')]()[_0x177f('0x20')](respondWithResult(_0xb26c6b,null))['catch'](handleError(_0xb26c6b,null));}; \ No newline at end of file +var _0x54cf=['send','SmsQueueReport','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','show','params','rawAttributes','options','find','create','body','catch','update','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','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','stack','name'];(function(_0x4d6523,_0x575020){var _0x540afe=function(_0xcdd61d){while(--_0xcdd61d){_0x4d6523['push'](_0x4d6523['shift']());}};_0x540afe(++_0x575020);}(_0x54cf,0x198));var _0xf54c=function(_0x391a41,_0x343c7f){_0x391a41=_0x391a41-0x0;var _0x99e12=_0x54cf[_0x391a41];return _0x99e12;};'use strict';var emlformat=require(_0xf54c('0x0'));var rimraf=require(_0xf54c('0x1'));var zipdir=require(_0xf54c('0x2'));var jsonpatch=require(_0xf54c('0x3'));var rp=require(_0xf54c('0x4'));var moment=require(_0xf54c('0x5'));var BPromise=require(_0xf54c('0x6'));var Mustache=require(_0xf54c('0x7'));var util=require(_0xf54c('0x8'));var path=require(_0xf54c('0x9'));var sox=require(_0xf54c('0xa'));var csv=require(_0xf54c('0xb'));var ejs=require(_0xf54c('0xc'));var fs=require('fs');var fs_extra=require(_0xf54c('0xd'));var _=require(_0xf54c('0xe'));var squel=require(_0xf54c('0xf'));var crypto=require(_0xf54c('0x10'));var jsforce=require('jsforce');var deskjs=require(_0xf54c('0x11'));var toCsv=require(_0xf54c('0xb'));var querystring=require(_0xf54c('0x12'));var Papa=require(_0xf54c('0x13'));var Redis=require('ioredis');var authService=require(_0xf54c('0x14'));var qs=require(_0xf54c('0x15'));var as=require(_0xf54c('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54c('0x17'))(_0xf54c('0x18'));var utils=require(_0xf54c('0x19'));var config=require(_0xf54c('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29be91,_0xbf47d9){_0xbf47d9=_0xbf47d9||0xcc;return function(_0x12f7c4){if(_0x12f7c4){return _0x29be91[_0xf54c('0x1b')](_0xbf47d9);}return _0x29be91[_0xf54c('0x1c')](_0xbf47d9)[_0xf54c('0x1d')]();};}function respondWithResult(_0x1e3ac1,_0x151f93){_0x151f93=_0x151f93||0xc8;return function(_0x57b767){if(_0x57b767){return _0x1e3ac1['status'](_0x151f93)[_0xf54c('0x1e')](_0x57b767);}};}function respondWithFilteredResult(_0x294947,_0x5ad318){return function(_0x32efbb){if(_0x32efbb){var _0x10323c=typeof _0x5ad318[_0xf54c('0x1f')]===_0xf54c('0x20')&&typeof _0x5ad318[_0xf54c('0x21')]===_0xf54c('0x20');var _0x48010d=_0x32efbb['count'];var _0x4c12b4=_0x10323c?0x0:_0x5ad318[_0xf54c('0x1f')];var _0x3f0941=_0x10323c?_0x32efbb[_0xf54c('0x22')]:_0x5ad318[_0xf54c('0x1f')]+_0x5ad318['limit'];var _0x590825;if(_0x3f0941>=_0x48010d){_0x3f0941=_0x48010d;_0x590825=0xc8;}else{_0x590825=0xce;}_0x294947[_0xf54c('0x1c')](_0x590825);return _0x294947[_0xf54c('0x23')](_0xf54c('0x24'),_0x4c12b4+'-'+_0x3f0941+'/'+_0x48010d)[_0xf54c('0x1e')](_0x32efbb);}return null;};}function patchUpdates(_0x12e552){return function(_0x37b184){try{jsonpatch['apply'](_0x37b184,_0x12e552,!![]);}catch(_0x5425fb){return BPromise[_0xf54c('0x25')](_0x5425fb);}return _0x37b184['save']();};}function saveUpdates(_0x4fd8ce,_0x3534d1){return function(_0x300bdf){if(_0x300bdf){return _0x300bdf['update'](_0x4fd8ce)[_0xf54c('0x26')](function(_0x5035c3){return _0x5035c3;});}return null;};}function removeEntity(_0x444b07,_0x18a05e){return function(_0x1ec16f){if(_0x1ec16f){return _0x1ec16f[_0xf54c('0x27')]()[_0xf54c('0x26')](function(){_0x444b07[_0xf54c('0x1c')](0xcc)[_0xf54c('0x1d')]();});}};}function handleEntityNotFound(_0x1e4425,_0x32b2a1){return function(_0x534e28){if(!_0x534e28){_0x1e4425['sendStatus'](0x194);}return _0x534e28;};}function handleError(_0x13351e,_0x5c80a3){_0x5c80a3=_0x5c80a3||0x1f4;return function(_0x142433){logger['error'](_0x142433[_0xf54c('0x28')]);if(_0x142433[_0xf54c('0x29')]){delete _0x142433[_0xf54c('0x29')];}_0x13351e[_0xf54c('0x1c')](_0x5c80a3)[_0xf54c('0x2a')](_0x142433);};}exports['index']=function(_0x5557ac,_0xc06b7f){var _0x445347={},_0x14b61a={},_0x3729b3={'count':0x0,'rows':[]};var _0x2a3a44=_['map'](db[_0xf54c('0x2b')]['rawAttributes'],function(_0x5e54a5){return{'name':_0x5e54a5['fieldName'],'type':_0x5e54a5['type'][_0xf54c('0x2c')]};});_0x14b61a[_0xf54c('0x2d')]=_[_0xf54c('0x2e')](_0x2a3a44,_0xf54c('0x29'));_0x14b61a[_0xf54c('0x2f')]=_[_0xf54c('0x30')](_0x5557ac[_0xf54c('0x2f')]);_0x14b61a[_0xf54c('0x31')]=_[_0xf54c('0x32')](_0x14b61a[_0xf54c('0x2d')],_0x14b61a['query']);_0x445347['attributes']=_['intersection'](_0x14b61a[_0xf54c('0x2d')],qs[_0xf54c('0x33')](_0x5557ac[_0xf54c('0x2f')][_0xf54c('0x33')]));_0x445347[_0xf54c('0x34')]=_0x445347[_0xf54c('0x34')][_0xf54c('0x35')]?_0x445347['attributes']:_0x14b61a[_0xf54c('0x2d')];if(!_0x5557ac[_0xf54c('0x2f')][_0xf54c('0x36')](_0xf54c('0x37'))){_0x445347[_0xf54c('0x21')]=qs[_0xf54c('0x21')](_0x5557ac[_0xf54c('0x2f')][_0xf54c('0x21')]);_0x445347['offset']=qs[_0xf54c('0x1f')](_0x5557ac[_0xf54c('0x2f')]['offset']);}_0x445347[_0xf54c('0x38')]=qs[_0xf54c('0x39')](_0x5557ac[_0xf54c('0x2f')][_0xf54c('0x39')]);_0x445347[_0xf54c('0x3a')]=qs[_0xf54c('0x31')](_[_0xf54c('0x3b')](_0x5557ac[_0xf54c('0x2f')],_0x14b61a[_0xf54c('0x31')]),_0x2a3a44);if(_0x5557ac[_0xf54c('0x2f')][_0xf54c('0x3c')]){_0x445347[_0xf54c('0x3a')]=_[_0xf54c('0x3d')](_0x445347[_0xf54c('0x3a')],{'$or':_[_0xf54c('0x2e')](_0x2a3a44,function(_0x40ca0e){if(_0x40ca0e[_0xf54c('0x3e')]!=='VIRTUAL'){var _0x42528b={};_0x42528b[_0x40ca0e[_0xf54c('0x29')]]={'$like':'%'+_0x5557ac['query'][_0xf54c('0x3c')]+'%'};return _0x42528b;}})});}_0x445347=_[_0xf54c('0x3d')]({},_0x445347,_0x5557ac['options']);var _0x189a71={'where':_0x445347[_0xf54c('0x3a')]};return db[_0xf54c('0x2b')]['count'](_0x189a71)[_0xf54c('0x26')](function(_0x7a93e0){_0x3729b3[_0xf54c('0x22')]=_0x7a93e0;if(_0x5557ac[_0xf54c('0x2f')][_0xf54c('0x3f')]){_0x445347[_0xf54c('0x40')]=[{'all':!![]}];}return db[_0xf54c('0x2b')]['findAll'](_0x445347);})[_0xf54c('0x26')](function(_0x5d20c4){_0x3729b3['rows']=_0x5d20c4;return _0x3729b3;})[_0xf54c('0x26')](respondWithFilteredResult(_0xc06b7f,_0x445347))['catch'](handleError(_0xc06b7f,null));};exports[_0xf54c('0x41')]=function(_0x133ce9,_0x217706){var _0x4f3971={'raw':!![],'where':{'id':_0x133ce9[_0xf54c('0x42')]['id']}},_0x1056cb={};_0x1056cb['model']=_[_0xf54c('0x30')](db['SmsQueueReport'][_0xf54c('0x43')]);_0x1056cb['query']=_[_0xf54c('0x30')](_0x133ce9['query']);_0x1056cb['filters']=_[_0xf54c('0x32')](_0x1056cb[_0xf54c('0x2d')],_0x1056cb[_0xf54c('0x2f')]);_0x4f3971[_0xf54c('0x34')]=_[_0xf54c('0x32')](_0x1056cb[_0xf54c('0x2d')],qs['fields'](_0x133ce9[_0xf54c('0x2f')][_0xf54c('0x33')]));_0x4f3971['attributes']=_0x4f3971[_0xf54c('0x34')][_0xf54c('0x35')]?_0x4f3971['attributes']:_0x1056cb[_0xf54c('0x2d')];if(_0x133ce9[_0xf54c('0x2f')][_0xf54c('0x3f')]){_0x4f3971[_0xf54c('0x40')]=[{'all':!![]}];}_0x4f3971=_[_0xf54c('0x3d')]({},_0x4f3971,_0x133ce9[_0xf54c('0x44')]);return db[_0xf54c('0x2b')][_0xf54c('0x45')](_0x4f3971)[_0xf54c('0x26')](handleEntityNotFound(_0x217706,null))[_0xf54c('0x26')](respondWithResult(_0x217706,null))['catch'](handleError(_0x217706,null));};exports[_0xf54c('0x46')]=function(_0x122abc,_0x48f884){return db[_0xf54c('0x2b')]['create'](_0x122abc[_0xf54c('0x47')],{})[_0xf54c('0x26')](respondWithResult(_0x48f884,0xc9))[_0xf54c('0x48')](handleError(_0x48f884,null));};exports[_0xf54c('0x49')]=function(_0x4c0e48,_0x4cb66a){if(_0x4c0e48[_0xf54c('0x47')]['id']){delete _0x4c0e48['body']['id'];}return db[_0xf54c('0x2b')][_0xf54c('0x45')]({'where':{'id':_0x4c0e48[_0xf54c('0x42')]['id']}})['then'](handleEntityNotFound(_0x4cb66a,null))[_0xf54c('0x26')](saveUpdates(_0x4c0e48[_0xf54c('0x47')],null))['then'](respondWithResult(_0x4cb66a,null))[_0xf54c('0x48')](handleError(_0x4cb66a,null));};exports[_0xf54c('0x27')]=function(_0x5bc4d1,_0x3feeee){return db[_0xf54c('0x2b')][_0xf54c('0x45')]({'where':{'id':_0x5bc4d1['params']['id']}})['then'](handleEntityNotFound(_0x3feeee,null))['then'](removeEntity(_0x3feeee,null))[_0xf54c('0x48')](handleError(_0x3feeee,null));};exports[_0xf54c('0x4a')]=function(_0x32384a,_0x41929f){return db[_0xf54c('0x2b')][_0xf54c('0x4a')]()['then'](respondWithResult(_0x41929f,null))[_0xf54c('0x48')](handleError(_0x41929f,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index cb0f2fa..1cc06e8 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(_0x132ae3,_0x3ac085){var _0x2430a1=function(_0x6f9a8e){while(--_0x6f9a8e){_0x132ae3['push'](_0x132ae3['shift']());}};_0x2430a1(++_0x3ac085);}(_0xb7e7,0x121));var _0x7b7e=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0xb7e7[_0x513aa5];return _0x1a1a7c;};'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 _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x19d202,_0x2e4b44){var _0xdd742e=function(_0x3ad6e1){while(--_0x3ad6e1){_0x19d202['push'](_0x19d202['shift']());}};_0xdd742e(++_0x2e4b44);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 384f03c..427b7ba 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 _0x1210=['where','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','SmsQueueReport','create','options','raw','CreateSmsQueueReport','stringify','UpdateSmsQueueReport','update','body'];(function(_0x49052b,_0x1612f7){var _0x2f40cf=function(_0x3357a2){while(--_0x3357a2){_0x49052b['push'](_0x49052b['shift']());}};_0x2f40cf(++_0x1612f7);}(_0x1210,0x1c2));var _0x0121=function(_0x3f288d,_0x3c7a97){_0x3f288d=_0x3f288d-0x0;var _0x5e8468=_0x1210[_0x3f288d];return _0x5e8468;};'use strict';var _=require(_0x0121('0x0'));var util=require(_0x0121('0x1'));var moment=require(_0x0121('0x2'));var BPromise=require(_0x0121('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0121('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0121('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0121('0x6'));var jayson=require(_0x0121('0x7'));var client=jayson[_0x0121('0x8')][_0x0121('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x314482,_0x5127e3,_0x40dd19){return new BPromise(function(_0x8a8869,_0x48946f){return client[_0x0121('0xa')](_0x314482,_0x40dd19)[_0x0121('0xb')](function(_0x33bd62){logger[_0x0121('0xc')](_0x0121('0xd'),_0x5127e3,'request\x20sent');logger[_0x0121('0xe')](_0x0121('0xf'),_0x5127e3,_0x0121('0x10'),JSON['stringify'](_0x33bd62));if(_0x33bd62[_0x0121('0x11')]){if(_0x33bd62[_0x0121('0x11')]['code']===0x1f4){logger[_0x0121('0x11')](_0x0121('0xd'),_0x5127e3,_0x33bd62['error'][_0x0121('0x12')]);return _0x48946f(_0x33bd62['error'][_0x0121('0x12')]);}logger[_0x0121('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x5127e3,_0x33bd62[_0x0121('0x11')][_0x0121('0x12')]);return _0x8a8869(_0x33bd62[_0x0121('0x11')][_0x0121('0x12')]);}else{logger[_0x0121('0xc')](_0x0121('0xd'),_0x5127e3,_0x0121('0x10'));_0x8a8869(_0x33bd62[_0x0121('0x13')][_0x0121('0x12')]);}})[_0x0121('0x14')](function(_0x3da82a){logger[_0x0121('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x5127e3,_0x3da82a);_0x48946f(_0x3da82a);});});}exports['CreateSmsQueueReport']=function(_0x5f4d77){var _0x3c0643=this;return new Promise(function(_0x3fbe93,_0x4fadb3){return db[_0x0121('0x15')][_0x0121('0x16')](_0x5f4d77['body'],{'raw':_0x5f4d77[_0x0121('0x17')]?_0x5f4d77['options'][_0x0121('0x18')]===undefined?!![]:![]:!![]})[_0x0121('0xb')](function(_0x271897){logger['info'](_0x0121('0x19'),_0x5f4d77);logger[_0x0121('0xe')](_0x0121('0x19'),_0x5f4d77,JSON[_0x0121('0x1a')](_0x271897));_0x3fbe93(_0x271897);})[_0x0121('0x14')](function(_0x1f2124){logger['error'](_0x0121('0x19'),_0x1f2124[_0x0121('0x12')],_0x5f4d77);_0x4fadb3(_0x3c0643[_0x0121('0x11')](0x1f4,_0x1f2124['message']));});});};exports[_0x0121('0x1b')]=function(_0x531f8b){var _0x46d26c=this;return new Promise(function(_0x36f508,_0x5f25d0){return db[_0x0121('0x15')][_0x0121('0x1c')](_0x531f8b[_0x0121('0x1d')],{'raw':_0x531f8b[_0x0121('0x17')]?_0x531f8b[_0x0121('0x17')][_0x0121('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x531f8b['options']?_0x531f8b['options'][_0x0121('0x1e')]||null:null,'attributes':_0x531f8b[_0x0121('0x17')]?_0x531f8b[_0x0121('0x17')]['attributes']||null:null,'limit':_0x531f8b['options']?_0x531f8b[_0x0121('0x17')][_0x0121('0x1f')]||null:null})[_0x0121('0xb')](function(_0x493303){logger['info'](_0x0121('0x1b'),_0x531f8b);logger[_0x0121('0xe')](_0x0121('0x1b'),_0x531f8b,JSON[_0x0121('0x1a')](_0x493303));_0x36f508(_0x493303);})[_0x0121('0x14')](function(_0x1c7a02){logger[_0x0121('0x11')](_0x0121('0x1b'),_0x1c7a02[_0x0121('0x12')],_0x531f8b);_0x5f25d0(_0x46d26c['error'](0x1f4,_0x1c7a02[_0x0121('0x12')]));});});}; \ No newline at end of file +var _0xe477=['catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','debug','UpdateSmsQueueReport','update','body','where','attributes','limit','then','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','info','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','request\x20sent'];(function(_0x29e78e,_0x55f47c){var _0x3faf0e=function(_0x2d8fd6){while(--_0x2d8fd6){_0x29e78e['push'](_0x29e78e['shift']());}};_0x3faf0e(++_0x55f47c);}(_0xe477,0xc8));var _0x7e47=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0xe477[_0x4709c8];return _0x478cdd;};'use strict';var _=require(_0x7e47('0x0'));var util=require(_0x7e47('0x1'));var moment=require(_0x7e47('0x2'));var BPromise=require('bluebird');var rs=require(_0x7e47('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7e47('0x4'));var logger=require(_0x7e47('0x5'))('rpc');var config=require(_0x7e47('0x6'));var jayson=require(_0x7e47('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53bc39,_0x248106,_0x416b56){return new BPromise(function(_0x24c459,_0x1c3e10){return client[_0x7e47('0x8')](_0x53bc39,_0x416b56)['then'](function(_0x5257e7){logger[_0x7e47('0x9')]('SmsQueueReport,\x20%s,\x20%s',_0x248106,'request\x20sent');logger['debug'](_0x7e47('0xa'),_0x248106,'request\x20sent',JSON[_0x7e47('0xb')](_0x5257e7));if(_0x5257e7[_0x7e47('0xc')]){if(_0x5257e7[_0x7e47('0xc')][_0x7e47('0xd')]===0x1f4){logger[_0x7e47('0xc')](_0x7e47('0xe'),_0x248106,_0x5257e7[_0x7e47('0xc')][_0x7e47('0xf')]);return _0x1c3e10(_0x5257e7[_0x7e47('0xc')][_0x7e47('0xf')]);}logger[_0x7e47('0xc')](_0x7e47('0xe'),_0x248106,_0x5257e7[_0x7e47('0xc')]['message']);return _0x24c459(_0x5257e7[_0x7e47('0xc')][_0x7e47('0xf')]);}else{logger[_0x7e47('0x9')]('SmsQueueReport,\x20%s,\x20%s',_0x248106,_0x7e47('0x10'));_0x24c459(_0x5257e7['result'][_0x7e47('0xf')]);}})[_0x7e47('0x11')](function(_0x14211e){logger[_0x7e47('0xc')](_0x7e47('0xe'),_0x248106,_0x14211e);_0x1c3e10(_0x14211e);});});}exports[_0x7e47('0x12')]=function(_0x209d04){var _0x2b52b8=this;return new Promise(function(_0x300347,_0x34669e){return db[_0x7e47('0x13')][_0x7e47('0x14')](_0x209d04['body'],{'raw':_0x209d04[_0x7e47('0x15')]?_0x209d04[_0x7e47('0x15')][_0x7e47('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x4fff55){logger['info'](_0x7e47('0x12'),_0x209d04);logger[_0x7e47('0x17')](_0x7e47('0x12'),_0x209d04,JSON[_0x7e47('0xb')](_0x4fff55));_0x300347(_0x4fff55);})[_0x7e47('0x11')](function(_0x187b66){logger[_0x7e47('0xc')](_0x7e47('0x12'),_0x187b66[_0x7e47('0xf')],_0x209d04);_0x34669e(_0x2b52b8[_0x7e47('0xc')](0x1f4,_0x187b66['message']));});});};exports[_0x7e47('0x18')]=function(_0x14103f){var _0x5798b0=this;return new Promise(function(_0x3d3bf4,_0x49b021){return db[_0x7e47('0x13')][_0x7e47('0x19')](_0x14103f[_0x7e47('0x1a')],{'raw':_0x14103f['options']?_0x14103f['options'][_0x7e47('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14103f[_0x7e47('0x15')]?_0x14103f[_0x7e47('0x15')][_0x7e47('0x1b')]||null:null,'attributes':_0x14103f[_0x7e47('0x15')]?_0x14103f[_0x7e47('0x15')][_0x7e47('0x1c')]||null:null,'limit':_0x14103f[_0x7e47('0x15')]?_0x14103f['options'][_0x7e47('0x1d')]||null:null})[_0x7e47('0x1e')](function(_0x42bf30){logger[_0x7e47('0x9')]('UpdateSmsQueueReport',_0x14103f);logger[_0x7e47('0x17')]('UpdateSmsQueueReport',_0x14103f,JSON[_0x7e47('0xb')](_0x42bf30));_0x3d3bf4(_0x42bf30);})[_0x7e47('0x11')](function(_0x4cf2a0){logger['error'](_0x7e47('0x18'),_0x4cf2a0['message'],_0x14103f);_0x49b021(_0x5798b0[_0x7e47('0xc')](0x1f4,_0x4cf2a0[_0x7e47('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 4b38375..099f736 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 _0xe181=['/describe','isAuthenticated','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','index','get'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe181,0x68));var _0x1e18=function(_0x3e3936,_0x24c3a6){_0x3e3936=_0x3e3936-0x0;var _0x10be4e=_0xe181[_0x3e3936];return _0x10be4e;};'use strict';var multer=require(_0x1e18('0x0'));var util=require('util');var path=require(_0x1e18('0x1'));var timeout=require(_0x1e18('0x2'));var express=require(_0x1e18('0x3'));var router=express[_0x1e18('0x4')]();var fs_extra=require(_0x1e18('0x5'));var auth=require(_0x1e18('0x6'));var interaction=require(_0x1e18('0x7'));var config=require('../../config/environment');var controller=require(_0x1e18('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1e18('0x9')]);router[_0x1e18('0xa')](_0x1e18('0xb'),auth[_0x1e18('0xc')](),controller[_0x1e18('0xd')]);router[_0x1e18('0xa')]('/:id',auth[_0x1e18('0xc')](),controller[_0x1e18('0xe')]);router[_0x1e18('0xf')]('/',auth[_0x1e18('0xc')](),controller[_0x1e18('0x10')]);router[_0x1e18('0x11')]('/:id',auth[_0x1e18('0xc')](),controller[_0x1e18('0x12')]);router[_0x1e18('0x13')](_0x1e18('0x14'),auth[_0x1e18('0xc')](),controller[_0x1e18('0x15')]);module[_0x1e18('0x16')]=router; \ No newline at end of file +var _0x0fda=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x2a61c8,_0x4f1e1b){var _0x17fb2a=function(_0x959075){while(--_0x959075){_0x2a61c8['push'](_0x2a61c8['shift']());}};_0x17fb2a(++_0x4f1e1b);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x546aeb,_0x1da034){_0x546aeb=_0x546aeb-0x0;var _0x24da94=_0x0fda[_0x546aeb];return _0x24da94;};'use strict';var multer=require(_0xa0fd('0x0'));var util=require('util');var path=require(_0xa0fd('0x1'));var timeout=require(_0xa0fd('0x2'));var express=require(_0xa0fd('0x3'));var router=express[_0xa0fd('0x4')]();var fs_extra=require(_0xa0fd('0x5'));var auth=require(_0xa0fd('0x6'));var interaction=require(_0xa0fd('0x7'));var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router[_0xa0fd('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa0fd('0x8')](_0xa0fd('0x9'),auth[_0xa0fd('0xa')](),controller[_0xa0fd('0xb')]);router['get'](_0xa0fd('0xc'),auth[_0xa0fd('0xa')](),controller[_0xa0fd('0xd')]);router[_0xa0fd('0xe')]('/',auth['isAuthenticated'](),controller[_0xa0fd('0xf')]);router[_0xa0fd('0x10')](_0xa0fd('0xc'),auth['isAuthenticated'](),controller[_0xa0fd('0x11')]);router[_0xa0fd('0x12')](_0xa0fd('0xc'),auth[_0xa0fd('0xa')](),controller[_0xa0fd('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 1b28d3a..8e22451 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x7891e3,_0x307220){var _0x101f6e=function(_0x50547f){while(--_0x50547f){_0x7891e3['push'](_0x7891e3['shift']());}};_0x101f6e(++_0x307220);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0xb19de0,_0x28572e){var _0x4d39ec=function(_0x15114d){while(--_0x15114d){_0xb19de0['push'](_0xb19de0['shift']());}};_0x4d39ec(++_0x28572e);}(_0x34e8,0x12c));var _0x834e=function(_0x498cf5,_0x124298){_0x498cf5=_0x498cf5-0x0;var _0x2ed1e1=_0x34e8[_0x498cf5];return _0x2ed1e1;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 1cb05b9..6b081d2 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 _0x2ace=['destroy','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','save','update','then','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body'];(function(_0x20c564,_0x424493){var _0x3e1714=function(_0x5b6225){while(--_0x5b6225){_0x20c564['push'](_0x20c564['shift']());}};_0x3e1714(++_0x424493);}(_0x2ace,0x17e));var _0xe2ac=function(_0x4e2861,_0x199be0){_0x4e2861=_0x4e2861-0x0;var _0x2265e3=_0x2ace[_0x4e2861];return _0x2265e3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe2ac('0x0'));var zipdir=require(_0xe2ac('0x1'));var jsonpatch=require(_0xe2ac('0x2'));var rp=require('request-promise');var moment=require(_0xe2ac('0x3'));var BPromise=require(_0xe2ac('0x4'));var Mustache=require('mustache');var util=require(_0xe2ac('0x5'));var path=require(_0xe2ac('0x6'));var sox=require(_0xe2ac('0x7'));var csv=require(_0xe2ac('0x8'));var ejs=require(_0xe2ac('0x9'));var fs=require('fs');var fs_extra=require(_0xe2ac('0xa'));var _=require(_0xe2ac('0xb'));var squel=require(_0xe2ac('0xc'));var crypto=require(_0xe2ac('0xd'));var jsforce=require(_0xe2ac('0xe'));var deskjs=require(_0xe2ac('0xf'));var toCsv=require(_0xe2ac('0x8'));var querystring=require(_0xe2ac('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe2ac('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe2ac('0x12'));var hardwareService=require(_0xe2ac('0x13'));var logger=require('../../config/logger')(_0xe2ac('0x14'));var utils=require(_0xe2ac('0x15'));var config=require(_0xe2ac('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe2ac('0x17'))['db'];function respondWithStatusCode(_0x41e1b0,_0x199773){_0x199773=_0x199773||0xcc;return function(_0x109a2d){if(_0x109a2d){return _0x41e1b0[_0xe2ac('0x18')](_0x199773);}return _0x41e1b0['status'](_0x199773)[_0xe2ac('0x19')]();};}function respondWithResult(_0x5c3425,_0x4404d7){_0x4404d7=_0x4404d7||0xc8;return function(_0x14af57){if(_0x14af57){return _0x5c3425[_0xe2ac('0x1a')](_0x4404d7)[_0xe2ac('0x1b')](_0x14af57);}};}function respondWithFilteredResult(_0x3bec11,_0xbddfba){return function(_0x445bca){if(_0x445bca){var _0x2f3caf=typeof _0xbddfba[_0xe2ac('0x1c')]==='undefined'&&typeof _0xbddfba[_0xe2ac('0x1d')]===_0xe2ac('0x1e');var _0x5d62b7=_0x445bca[_0xe2ac('0x1f')];var _0x3c8999=_0x2f3caf?0x0:_0xbddfba[_0xe2ac('0x1c')];var _0x2f5d32=_0x2f3caf?_0x445bca['count']:_0xbddfba['offset']+_0xbddfba['limit'];var _0x19784b;if(_0x2f5d32>=_0x5d62b7){_0x2f5d32=_0x5d62b7;_0x19784b=0xc8;}else{_0x19784b=0xce;}_0x3bec11[_0xe2ac('0x1a')](_0x19784b);return _0x3bec11[_0xe2ac('0x20')](_0xe2ac('0x21'),_0x3c8999+'-'+_0x2f5d32+'/'+_0x5d62b7)[_0xe2ac('0x1b')](_0x445bca);}return null;};}function patchUpdates(_0x279a90){return function(_0x54993e){try{jsonpatch['apply'](_0x54993e,_0x279a90,!![]);}catch(_0x3cfc45){return BPromise['reject'](_0x3cfc45);}return _0x54993e[_0xe2ac('0x22')]();};}function saveUpdates(_0x16dacc,_0x2083b3){return function(_0xe0a431){if(_0xe0a431){return _0xe0a431[_0xe2ac('0x23')](_0x16dacc)[_0xe2ac('0x24')](function(_0x504ffd){return _0x504ffd;});}return null;};}function removeEntity(_0x20a59e,_0xbf5817){return function(_0x4e7597){if(_0x4e7597){return _0x4e7597['destroy']()[_0xe2ac('0x24')](function(){_0x20a59e['status'](0xcc)[_0xe2ac('0x19')]();});}};}function handleEntityNotFound(_0x3310c1,_0x55711b){return function(_0x192649){if(!_0x192649){_0x3310c1['sendStatus'](0x194);}return _0x192649;};}function handleError(_0x20dc3f,_0xffd8c7){_0xffd8c7=_0xffd8c7||0x1f4;return function(_0x1000e6){logger['error'](_0x1000e6[_0xe2ac('0x25')]);if(_0x1000e6[_0xe2ac('0x26')]){delete _0x1000e6['name'];}_0x20dc3f['status'](_0xffd8c7)[_0xe2ac('0x27')](_0x1000e6);};}exports[_0xe2ac('0x28')]=function(_0x2b50aa,_0x23bef4){var _0x486ee3={},_0x2ccd98={},_0x5f32e8={'count':0x0,'rows':[]};var _0x6e1713=_[_0xe2ac('0x29')](db[_0xe2ac('0x2a')][_0xe2ac('0x2b')],function(_0x28c1a0){return{'name':_0x28c1a0[_0xe2ac('0x2c')],'type':_0x28c1a0['type'][_0xe2ac('0x2d')]};});_0x2ccd98['model']=_['map'](_0x6e1713,'name');_0x2ccd98[_0xe2ac('0x2e')]=_[_0xe2ac('0x2f')](_0x2b50aa['query']);_0x2ccd98[_0xe2ac('0x30')]=_[_0xe2ac('0x31')](_0x2ccd98['model'],_0x2ccd98[_0xe2ac('0x2e')]);_0x486ee3[_0xe2ac('0x32')]=_['intersection'](_0x2ccd98['model'],qs[_0xe2ac('0x33')](_0x2b50aa['query'][_0xe2ac('0x33')]));_0x486ee3[_0xe2ac('0x32')]=_0x486ee3[_0xe2ac('0x32')][_0xe2ac('0x34')]?_0x486ee3[_0xe2ac('0x32')]:_0x2ccd98[_0xe2ac('0x35')];if(!_0x2b50aa[_0xe2ac('0x2e')][_0xe2ac('0x36')](_0xe2ac('0x37'))){_0x486ee3['limit']=qs[_0xe2ac('0x1d')](_0x2b50aa[_0xe2ac('0x2e')][_0xe2ac('0x1d')]);_0x486ee3[_0xe2ac('0x1c')]=qs[_0xe2ac('0x1c')](_0x2b50aa[_0xe2ac('0x2e')]['offset']);}_0x486ee3[_0xe2ac('0x38')]=qs['sort'](_0x2b50aa[_0xe2ac('0x2e')][_0xe2ac('0x39')]);_0x486ee3[_0xe2ac('0x3a')]=qs[_0xe2ac('0x30')](_['pick'](_0x2b50aa[_0xe2ac('0x2e')],_0x2ccd98['filters']),_0x6e1713);if(_0x2b50aa['query']['filter']){_0x486ee3['where']=_[_0xe2ac('0x3b')](_0x486ee3[_0xe2ac('0x3a')],{'$or':_['map'](_0x6e1713,function(_0xc26da1){if(_0xc26da1[_0xe2ac('0x3c')]!==_0xe2ac('0x3d')){var _0x1fbbb={};_0x1fbbb[_0xc26da1[_0xe2ac('0x26')]]={'$like':'%'+_0x2b50aa[_0xe2ac('0x2e')][_0xe2ac('0x3e')]+'%'};return _0x1fbbb;}})});}_0x486ee3=_['merge']({},_0x486ee3,_0x2b50aa[_0xe2ac('0x3f')]);var _0x5bd0da={'where':_0x486ee3['where']};return db[_0xe2ac('0x2a')][_0xe2ac('0x1f')](_0x5bd0da)[_0xe2ac('0x24')](function(_0x1b9a21){_0x5f32e8[_0xe2ac('0x1f')]=_0x1b9a21;if(_0x2b50aa[_0xe2ac('0x2e')][_0xe2ac('0x40')]){_0x486ee3[_0xe2ac('0x41')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xe2ac('0x42')](_0x486ee3);})[_0xe2ac('0x24')](function(_0x434e7c){_0x5f32e8[_0xe2ac('0x43')]=_0x434e7c;return _0x5f32e8;})[_0xe2ac('0x24')](respondWithFilteredResult(_0x23bef4,_0x486ee3))['catch'](handleError(_0x23bef4,null));};exports[_0xe2ac('0x44')]=function(_0x14e96b,_0x483c4f){var _0x510c38={'raw':!![],'where':{'id':_0x14e96b[_0xe2ac('0x45')]['id']}},_0x3f95fd={};_0x3f95fd[_0xe2ac('0x35')]=_[_0xe2ac('0x2f')](db[_0xe2ac('0x2a')]['rawAttributes']);_0x3f95fd[_0xe2ac('0x2e')]=_['keys'](_0x14e96b[_0xe2ac('0x2e')]);_0x3f95fd[_0xe2ac('0x30')]=_[_0xe2ac('0x31')](_0x3f95fd['model'],_0x3f95fd[_0xe2ac('0x2e')]);_0x510c38[_0xe2ac('0x32')]=_[_0xe2ac('0x31')](_0x3f95fd[_0xe2ac('0x35')],qs[_0xe2ac('0x33')](_0x14e96b[_0xe2ac('0x2e')][_0xe2ac('0x33')]));_0x510c38[_0xe2ac('0x32')]=_0x510c38['attributes'][_0xe2ac('0x34')]?_0x510c38['attributes']:_0x3f95fd['model'];if(_0x14e96b[_0xe2ac('0x2e')][_0xe2ac('0x40')]){_0x510c38[_0xe2ac('0x41')]=[{'all':!![]}];}_0x510c38=_[_0xe2ac('0x3b')]({},_0x510c38,_0x14e96b[_0xe2ac('0x3f')]);return db[_0xe2ac('0x2a')][_0xe2ac('0x46')](_0x510c38)[_0xe2ac('0x24')](handleEntityNotFound(_0x483c4f,null))['then'](respondWithResult(_0x483c4f,null))[_0xe2ac('0x47')](handleError(_0x483c4f,null));};exports['create']=function(_0x2f04cc,_0x41af34){return db[_0xe2ac('0x2a')][_0xe2ac('0x48')](_0x2f04cc[_0xe2ac('0x49')],{})[_0xe2ac('0x24')](respondWithResult(_0x41af34,0xc9))['catch'](handleError(_0x41af34,null));};exports['update']=function(_0x55916d,_0xd054e0){if(_0x55916d[_0xe2ac('0x49')]['id']){delete _0x55916d[_0xe2ac('0x49')]['id'];}return db[_0xe2ac('0x2a')][_0xe2ac('0x46')]({'where':{'id':_0x55916d['params']['id']}})['then'](handleEntityNotFound(_0xd054e0,null))[_0xe2ac('0x24')](saveUpdates(_0x55916d['body'],null))['then'](respondWithResult(_0xd054e0,null))[_0xe2ac('0x47')](handleError(_0xd054e0,null));};exports[_0xe2ac('0x4a')]=function(_0x2ad3ff,_0x1df6e1){return db[_0xe2ac('0x2a')][_0xe2ac('0x46')]({'where':{'id':_0x2ad3ff[_0xe2ac('0x45')]['id']}})[_0xe2ac('0x24')](handleEntityNotFound(_0x1df6e1,null))[_0xe2ac('0x24')](removeEntity(_0x1df6e1,null))[_0xe2ac('0x47')](handleError(_0x1df6e1,null));};exports['describe']=function(_0x1e62f1,_0x1a407f){return db['SmsTransferReport'][_0xe2ac('0x4b')]()[_0xe2ac('0x24')](respondWithResult(_0x1a407f,null))['catch'](handleError(_0x1a407f,null));}; \ No newline at end of file +var _0xeafc=['apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','SmsTransferReport','includeAll','include','rows','catch','show','keys','options','create','body','params','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xeafc,0x1eb));var _0xceaf=function(_0x1828c3,_0x36d621){_0x1828c3=_0x1828c3-0x0;var _0x2bb9a6=_0xeafc[_0x1828c3];return _0x2bb9a6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xceaf('0x0'));var zipdir=require(_0xceaf('0x1'));var jsonpatch=require(_0xceaf('0x2'));var rp=require(_0xceaf('0x3'));var moment=require('moment');var BPromise=require(_0xceaf('0x4'));var Mustache=require(_0xceaf('0x5'));var util=require(_0xceaf('0x6'));var path=require(_0xceaf('0x7'));var sox=require(_0xceaf('0x8'));var csv=require(_0xceaf('0x9'));var ejs=require(_0xceaf('0xa'));var fs=require('fs');var fs_extra=require(_0xceaf('0xb'));var _=require(_0xceaf('0xc'));var squel=require(_0xceaf('0xd'));var crypto=require(_0xceaf('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xceaf('0x9'));var querystring=require('querystring');var Papa=require(_0xceaf('0xf'));var Redis=require('ioredis');var authService=require(_0xceaf('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xceaf('0x11'));var hardwareService=require(_0xceaf('0x12'));var logger=require(_0xceaf('0x13'))(_0xceaf('0x14'));var utils=require(_0xceaf('0x15'));var config=require(_0xceaf('0x16'));var licenseUtil=require(_0xceaf('0x17'));var db=require(_0xceaf('0x18'))['db'];function respondWithStatusCode(_0x25aca6,_0xf66a08){_0xf66a08=_0xf66a08||0xcc;return function(_0x3067d5){if(_0x3067d5){return _0x25aca6[_0xceaf('0x19')](_0xf66a08);}return _0x25aca6[_0xceaf('0x1a')](_0xf66a08)[_0xceaf('0x1b')]();};}function respondWithResult(_0x2a0d95,_0x2e45aa){_0x2e45aa=_0x2e45aa||0xc8;return function(_0x487658){if(_0x487658){return _0x2a0d95['status'](_0x2e45aa)[_0xceaf('0x1c')](_0x487658);}};}function respondWithFilteredResult(_0x56b94b,_0x233737){return function(_0x1d31fe){if(_0x1d31fe){var _0x2341bd=typeof _0x233737['offset']==='undefined'&&typeof _0x233737[_0xceaf('0x1d')]===_0xceaf('0x1e');var _0x40e939=_0x1d31fe[_0xceaf('0x1f')];var _0x273c62=_0x2341bd?0x0:_0x233737[_0xceaf('0x20')];var _0x407339=_0x2341bd?_0x1d31fe[_0xceaf('0x1f')]:_0x233737[_0xceaf('0x20')]+_0x233737[_0xceaf('0x1d')];var _0x3e2b8d;if(_0x407339>=_0x40e939){_0x407339=_0x40e939;_0x3e2b8d=0xc8;}else{_0x3e2b8d=0xce;}_0x56b94b['status'](_0x3e2b8d);return _0x56b94b['set'](_0xceaf('0x21'),_0x273c62+'-'+_0x407339+'/'+_0x40e939)[_0xceaf('0x1c')](_0x1d31fe);}return null;};}function patchUpdates(_0x7456a2){return function(_0x432bb9){try{jsonpatch[_0xceaf('0x22')](_0x432bb9,_0x7456a2,!![]);}catch(_0x4570ca){return BPromise[_0xceaf('0x23')](_0x4570ca);}return _0x432bb9[_0xceaf('0x24')]();};}function saveUpdates(_0x300265,_0x1b5752){return function(_0x6ea40c){if(_0x6ea40c){return _0x6ea40c[_0xceaf('0x25')](_0x300265)[_0xceaf('0x26')](function(_0x4422fb){return _0x4422fb;});}return null;};}function removeEntity(_0x4f3617,_0x3dd461){return function(_0xe41d1f){if(_0xe41d1f){return _0xe41d1f[_0xceaf('0x27')]()[_0xceaf('0x26')](function(){_0x4f3617[_0xceaf('0x1a')](0xcc)[_0xceaf('0x1b')]();});}};}function handleEntityNotFound(_0x6b3843,_0x1564a1){return function(_0x2573db){if(!_0x2573db){_0x6b3843[_0xceaf('0x19')](0x194);}return _0x2573db;};}function handleError(_0x56650f,_0x1645dd){_0x1645dd=_0x1645dd||0x1f4;return function(_0x3bf819){logger[_0xceaf('0x28')](_0x3bf819[_0xceaf('0x29')]);if(_0x3bf819[_0xceaf('0x2a')]){delete _0x3bf819[_0xceaf('0x2a')];}_0x56650f['status'](_0x1645dd)[_0xceaf('0x2b')](_0x3bf819);};}exports['index']=function(_0x1426c3,_0x2e710b){var _0x2e8199={},_0x32374e={},_0x2322a9={'count':0x0,'rows':[]};var _0x1ab2c7=_[_0xceaf('0x2c')](db['SmsTransferReport'][_0xceaf('0x2d')],function(_0x509785){return{'name':_0x509785[_0xceaf('0x2e')],'type':_0x509785[_0xceaf('0x2f')][_0xceaf('0x30')]};});_0x32374e[_0xceaf('0x31')]=_[_0xceaf('0x2c')](_0x1ab2c7,_0xceaf('0x2a'));_0x32374e[_0xceaf('0x32')]=_['keys'](_0x1426c3['query']);_0x32374e[_0xceaf('0x33')]=_[_0xceaf('0x34')](_0x32374e['model'],_0x32374e[_0xceaf('0x32')]);_0x2e8199[_0xceaf('0x35')]=_[_0xceaf('0x34')](_0x32374e[_0xceaf('0x31')],qs[_0xceaf('0x36')](_0x1426c3[_0xceaf('0x32')][_0xceaf('0x36')]));_0x2e8199[_0xceaf('0x35')]=_0x2e8199[_0xceaf('0x35')][_0xceaf('0x37')]?_0x2e8199[_0xceaf('0x35')]:_0x32374e['model'];if(!_0x1426c3[_0xceaf('0x32')]['hasOwnProperty']('nolimit')){_0x2e8199[_0xceaf('0x1d')]=qs[_0xceaf('0x1d')](_0x1426c3[_0xceaf('0x32')][_0xceaf('0x1d')]);_0x2e8199[_0xceaf('0x20')]=qs[_0xceaf('0x20')](_0x1426c3[_0xceaf('0x32')][_0xceaf('0x20')]);}_0x2e8199[_0xceaf('0x38')]=qs[_0xceaf('0x39')](_0x1426c3[_0xceaf('0x32')][_0xceaf('0x39')]);_0x2e8199['where']=qs[_0xceaf('0x33')](_['pick'](_0x1426c3[_0xceaf('0x32')],_0x32374e[_0xceaf('0x33')]),_0x1ab2c7);if(_0x1426c3[_0xceaf('0x32')][_0xceaf('0x3a')]){_0x2e8199[_0xceaf('0x3b')]=_[_0xceaf('0x3c')](_0x2e8199[_0xceaf('0x3b')],{'$or':_[_0xceaf('0x2c')](_0x1ab2c7,function(_0x21fe6a){if(_0x21fe6a['type']!==_0xceaf('0x3d')){var _0xa0f07d={};_0xa0f07d[_0x21fe6a[_0xceaf('0x2a')]]={'$like':'%'+_0x1426c3['query'][_0xceaf('0x3a')]+'%'};return _0xa0f07d;}})});}_0x2e8199=_[_0xceaf('0x3c')]({},_0x2e8199,_0x1426c3['options']);var _0xbd15db={'where':_0x2e8199['where']};return db[_0xceaf('0x3e')][_0xceaf('0x1f')](_0xbd15db)[_0xceaf('0x26')](function(_0x14a83a){_0x2322a9[_0xceaf('0x1f')]=_0x14a83a;if(_0x1426c3[_0xceaf('0x32')][_0xceaf('0x3f')]){_0x2e8199[_0xceaf('0x40')]=[{'all':!![]}];}return db[_0xceaf('0x3e')]['findAll'](_0x2e8199);})[_0xceaf('0x26')](function(_0x2c92d6){_0x2322a9[_0xceaf('0x41')]=_0x2c92d6;return _0x2322a9;})[_0xceaf('0x26')](respondWithFilteredResult(_0x2e710b,_0x2e8199))[_0xceaf('0x42')](handleError(_0x2e710b,null));};exports[_0xceaf('0x43')]=function(_0xf0bb73,_0x5ad11e){var _0x380d1e={'raw':!![],'where':{'id':_0xf0bb73['params']['id']}},_0x377435={};_0x377435[_0xceaf('0x31')]=_[_0xceaf('0x44')](db[_0xceaf('0x3e')][_0xceaf('0x2d')]);_0x377435[_0xceaf('0x32')]=_[_0xceaf('0x44')](_0xf0bb73[_0xceaf('0x32')]);_0x377435[_0xceaf('0x33')]=_[_0xceaf('0x34')](_0x377435[_0xceaf('0x31')],_0x377435[_0xceaf('0x32')]);_0x380d1e[_0xceaf('0x35')]=_[_0xceaf('0x34')](_0x377435[_0xceaf('0x31')],qs[_0xceaf('0x36')](_0xf0bb73[_0xceaf('0x32')]['fields']));_0x380d1e[_0xceaf('0x35')]=_0x380d1e[_0xceaf('0x35')][_0xceaf('0x37')]?_0x380d1e[_0xceaf('0x35')]:_0x377435[_0xceaf('0x31')];if(_0xf0bb73[_0xceaf('0x32')][_0xceaf('0x3f')]){_0x380d1e[_0xceaf('0x40')]=[{'all':!![]}];}_0x380d1e=_[_0xceaf('0x3c')]({},_0x380d1e,_0xf0bb73[_0xceaf('0x45')]);return db['SmsTransferReport']['find'](_0x380d1e)[_0xceaf('0x26')](handleEntityNotFound(_0x5ad11e,null))[_0xceaf('0x26')](respondWithResult(_0x5ad11e,null))[_0xceaf('0x42')](handleError(_0x5ad11e,null));};exports[_0xceaf('0x46')]=function(_0x22771f,_0x51d624){return db['SmsTransferReport']['create'](_0x22771f[_0xceaf('0x47')],{})[_0xceaf('0x26')](respondWithResult(_0x51d624,0xc9))[_0xceaf('0x42')](handleError(_0x51d624,null));};exports[_0xceaf('0x25')]=function(_0x17fbd5,_0x2f8818){if(_0x17fbd5[_0xceaf('0x47')]['id']){delete _0x17fbd5[_0xceaf('0x47')]['id'];}return db[_0xceaf('0x3e')]['find']({'where':{'id':_0x17fbd5[_0xceaf('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f8818,null))[_0xceaf('0x26')](saveUpdates(_0x17fbd5[_0xceaf('0x47')],null))['then'](respondWithResult(_0x2f8818,null))[_0xceaf('0x42')](handleError(_0x2f8818,null));};exports['destroy']=function(_0x43190b,_0x3b690a){return db[_0xceaf('0x3e')][_0xceaf('0x49')]({'where':{'id':_0x43190b['params']['id']}})[_0xceaf('0x26')](handleEntityNotFound(_0x3b690a,null))['then'](removeEntity(_0x3b690a,null))[_0xceaf('0x42')](handleError(_0x3b690a,null));};exports[_0xceaf('0x4a')]=function(_0x4e0b29,_0x2176d6){return db[_0xceaf('0x3e')][_0xceaf('0x4a')]()[_0xceaf('0x26')](respondWithResult(_0x2176d6,null))['catch'](handleError(_0x2176d6,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 3148584..25509a4 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 _0x208b=['./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b6798,_0xda97ec){var _0x3d4555=function(_0x3a9682){while(--_0x3a9682){_0x2b6798['push'](_0x2b6798['shift']());}};_0x3d4555(++_0xda97ec);}(_0x208b,0x114));var _0xb208=function(_0xd48432,_0x34daf6){_0xd48432=_0xd48432-0x0;var _0x292600=_0x208b[_0xd48432];return _0x292600;};'use strict';var _=require(_0xb208('0x0'));var util=require(_0xb208('0x1'));var logger=require(_0xb208('0x2'))(_0xb208('0x3'));var moment=require('moment');var BPromise=require(_0xb208('0x4'));var rp=require(_0xb208('0x5'));var fs=require('fs');var path=require(_0xb208('0x6'));var rimraf=require(_0xb208('0x7'));var config=require(_0xb208('0x8'));var attributes=require(_0xb208('0x9'));module[_0xb208('0xa')]=function(_0x2213c4,_0x46411a){return _0x2213c4[_0xb208('0xb')](_0xb208('0xc'),attributes,{'tableName':_0xb208('0xd'),'paranoid':![],'indexes':[{'name':_0xb208('0xe'),'fields':[_0xb208('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4ff6=['SmsTransferReport','report_sms_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define'];(function(_0x52463d,_0x4b68d0){var _0x551795=function(_0xbb71cb){while(--_0xbb71cb){_0x52463d['push'](_0x52463d['shift']());}};_0x551795(++_0x4b68d0);}(_0x4ff6,0xd5));var _0x64ff=function(_0x2b9942,_0xeff205){_0x2b9942=_0x2b9942-0x0;var _0x4ec718=_0x4ff6[_0x2b9942];return _0x4ec718;};'use strict';var _=require('lodash');var util=require(_0x64ff('0x0'));var logger=require(_0x64ff('0x1'))(_0x64ff('0x2'));var moment=require(_0x64ff('0x3'));var BPromise=require(_0x64ff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x64ff('0x5'));var rimraf=require(_0x64ff('0x6'));var config=require(_0x64ff('0x7'));var attributes=require(_0x64ff('0x8'));module[_0x64ff('0x9')]=function(_0x34dacd,_0x37ad86){return _0x34dacd[_0x64ff('0xa')](_0x64ff('0xb'),attributes,{'tableName':_0x64ff('0xc'),'paranoid':![],'indexes':[{'name':_0x64ff('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 41a0a91..1b59130 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 _0xae1c=['message','info','result','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xae1c,0xff));var _0xcae1=function(_0x2187ea,_0x37fd5d){_0x2187ea=_0x2187ea-0x0;var _0x41bc5d=_0xae1c[_0x2187ea];return _0x41bc5d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcae1('0x0'));var fs=require('fs');var Redis=require(_0xcae1('0x1'));var db=require(_0xcae1('0x2'))['db'];var utils=require(_0xcae1('0x3'));var logger=require(_0xcae1('0x4'))(_0xcae1('0x5'));var config=require(_0xcae1('0x6'));var jayson=require(_0xcae1('0x7'));var client=jayson[_0xcae1('0x8')][_0xcae1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c35c7,_0x38099e,_0x7a27b8){return new BPromise(function(_0x50d451,_0x4e419d){return client[_0xcae1('0xa')](_0x3c35c7,_0x7a27b8)[_0xcae1('0xb')](function(_0x3284aa){logger['info'](_0xcae1('0xc'),_0x38099e,_0xcae1('0xd'));logger[_0xcae1('0xe')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x38099e,_0xcae1('0xd'),JSON[_0xcae1('0xf')](_0x3284aa));if(_0x3284aa['error']){if(_0x3284aa['error'][_0xcae1('0x10')]===0x1f4){logger[_0xcae1('0x11')](_0xcae1('0xc'),_0x38099e,_0x3284aa[_0xcae1('0x11')][_0xcae1('0x12')]);return _0x4e419d(_0x3284aa[_0xcae1('0x11')][_0xcae1('0x12')]);}logger[_0xcae1('0x11')](_0xcae1('0xc'),_0x38099e,_0x3284aa[_0xcae1('0x11')][_0xcae1('0x12')]);return _0x50d451(_0x3284aa[_0xcae1('0x11')][_0xcae1('0x12')]);}else{logger[_0xcae1('0x13')](_0xcae1('0xc'),_0x38099e,'request\x20sent');_0x50d451(_0x3284aa[_0xcae1('0x14')][_0xcae1('0x12')]);}})['catch'](function(_0x4a7ef7){logger[_0xcae1('0x11')](_0xcae1('0xc'),_0x38099e,_0x4a7ef7);_0x4e419d(_0x4a7ef7);});});} \ No newline at end of file +var _0x5900=['then','info','request\x20sent','debug','stringify','code','SmsTransferReport,\x20%s,\x20%s','error','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x419b2b,_0x485781){var _0x4ff4f1=function(_0x114c28){while(--_0x114c28){_0x419b2b['push'](_0x419b2b['shift']());}};_0x4ff4f1(++_0x485781);}(_0x5900,0xd2));var _0x0590=function(_0x21d242,_0x21e56c){_0x21d242=_0x21d242-0x0;var _0x1e89a6=_0x5900[_0x21d242];return _0x1e89a6;};'use strict';var _=require('lodash');var util=require(_0x0590('0x0'));var moment=require(_0x0590('0x1'));var BPromise=require('bluebird');var rs=require(_0x0590('0x2'));var fs=require('fs');var Redis=require(_0x0590('0x3'));var db=require(_0x0590('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0590('0x5'))(_0x0590('0x6'));var config=require('../../config/environment');var jayson=require(_0x0590('0x7'));var client=jayson[_0x0590('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x469e15,_0x2d5b51,_0x149322){return new BPromise(function(_0x43fe9e,_0x1eab42){return client[_0x0590('0x9')](_0x469e15,_0x149322)[_0x0590('0xa')](function(_0x1443ab){logger[_0x0590('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x2d5b51,_0x0590('0xc'));logger[_0x0590('0xd')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x2d5b51,_0x0590('0xc'),JSON[_0x0590('0xe')](_0x1443ab));if(_0x1443ab['error']){if(_0x1443ab['error'][_0x0590('0xf')]===0x1f4){logger['error'](_0x0590('0x10'),_0x2d5b51,_0x1443ab[_0x0590('0x11')][_0x0590('0x12')]);return _0x1eab42(_0x1443ab[_0x0590('0x11')][_0x0590('0x12')]);}logger['error'](_0x0590('0x10'),_0x2d5b51,_0x1443ab[_0x0590('0x11')]['message']);return _0x43fe9e(_0x1443ab[_0x0590('0x11')][_0x0590('0x12')]);}else{logger[_0x0590('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x2d5b51,_0x0590('0xc'));_0x43fe9e(_0x1443ab['result'][_0x0590('0x12')]);}})[_0x0590('0x13')](function(_0x251a20){logger[_0x0590('0x11')](_0x0590('0x10'),_0x2d5b51,_0x251a20);_0x1eab42(_0x251a20);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index cff9b0f..94eb0c6 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 _0xa771=['server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','now','post','single','file','create','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/download','download','diskStorage','join','root'];(function(_0x3bfd6e,_0x2590bb){var _0x50c3fd=function(_0x3f52ee){while(--_0x3f52ee){_0x3bfd6e['push'](_0x3bfd6e['shift']());}};_0x50c3fd(++_0x2590bb);}(_0xa771,0x66));var _0x1a77=function(_0x36e7df,_0x2d3952){_0x36e7df=_0x36e7df-0x0;var _0x3fed71=_0xa771[_0x36e7df];return _0x3fed71;};'use strict';var multer=require(_0x1a77('0x0'));var util=require('util');var path=require(_0x1a77('0x1'));var timeout=require(_0x1a77('0x2'));var express=require(_0x1a77('0x3'));var router=express[_0x1a77('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1a77('0x5'));var interaction=require(_0x1a77('0x6'));var config=require(_0x1a77('0x7'));var controller=require('./sound.controller');router['get']('/',auth[_0x1a77('0x8')](),controller[_0x1a77('0x9')]);router[_0x1a77('0xa')](_0x1a77('0xb'),auth['isAuthenticated'](),controller[_0x1a77('0xc')]);router[_0x1a77('0xa')](_0x1a77('0xd'),auth[_0x1a77('0x8')](),controller[_0x1a77('0xe')]);var upload=multer({'storage':multer[_0x1a77('0xf')]({'destination':function(_0xabcd25,_0x24be24,_0x2475fc){_0x2475fc(null,path[_0x1a77('0x10')](config[_0x1a77('0x11')],_0x1a77('0x12')));},'filename':function(_0x2cbbb5,_0x52fae4,_0x22f33f){_0x52fae4[_0x1a77('0x13')]=_0x52fae4[_0x1a77('0x13')][_0x1a77('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x22f33f(null,util['format'](_0x1a77('0x15'),path[_0x1a77('0x16')](_0x52fae4['originalname'],path[_0x1a77('0x17')](_0x52fae4[_0x1a77('0x13')])),Date[_0x1a77('0x18')](),path[_0x1a77('0x17')](_0x52fae4[_0x1a77('0x13')])));}})});router[_0x1a77('0x19')]('/',upload[_0x1a77('0x1a')](_0x1a77('0x1b')),controller[_0x1a77('0x1c')]);router['put'](_0x1a77('0xb'),auth[_0x1a77('0x8')](),controller['update']);router[_0x1a77('0x1d')](_0x1a77('0xb'),auth[_0x1a77('0x8')](),controller[_0x1a77('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xc9d7=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','file','put','/:id','delete','exports','multer','util','path'];(function(_0x521f8f,_0x3b15e7){var _0x5cc64b=function(_0x308869){while(--_0x308869){_0x521f8f['push'](_0x521f8f['shift']());}};_0x5cc64b(++_0x3b15e7);}(_0xc9d7,0x79));var _0x7c9d=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0xc9d7[_0x382a62];return _0x490a25;};'use strict';var multer=require(_0x7c9d('0x0'));var util=require(_0x7c9d('0x1'));var path=require(_0x7c9d('0x2'));var timeout=require(_0x7c9d('0x3'));var express=require(_0x7c9d('0x4'));var router=express[_0x7c9d('0x5')]();var fs_extra=require(_0x7c9d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7c9d('0x7'));var config=require(_0x7c9d('0x8'));var controller=require(_0x7c9d('0x9'));router[_0x7c9d('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7c9d('0xa')]('/:id',auth[_0x7c9d('0xb')](),controller[_0x7c9d('0xc')]);router[_0x7c9d('0xa')](_0x7c9d('0xd'),auth['isAuthenticated'](),controller[_0x7c9d('0xe')]);var upload=multer({'storage':multer[_0x7c9d('0xf')]({'destination':function(_0x19a788,_0x1a6ff2,_0x5b644b){_0x5b644b(null,path[_0x7c9d('0x10')](config['root'],_0x7c9d('0x11')));},'filename':function(_0x1d0973,_0x1f7ee0,_0x31d575){_0x1f7ee0[_0x7c9d('0x12')]=_0x1f7ee0[_0x7c9d('0x12')][_0x7c9d('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x31d575(null,util[_0x7c9d('0x14')](_0x7c9d('0x15'),path[_0x7c9d('0x16')](_0x1f7ee0[_0x7c9d('0x12')],path[_0x7c9d('0x17')](_0x1f7ee0['originalname'])),Date[_0x7c9d('0x18')](),path[_0x7c9d('0x17')](_0x1f7ee0['originalname'])));}})});router[_0x7c9d('0x19')]('/',upload['single'](_0x7c9d('0x1a')),controller['create']);router[_0x7c9d('0x1b')](_0x7c9d('0x1c'),auth[_0x7c9d('0xb')](),controller['update']);router[_0x7c9d('0x1d')](_0x7c9d('0x1c'),auth['isAuthenticated'](),controller['delete']);module[_0x7c9d('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index d5d9a23..97d3c5d 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 _0x7297=['INTEGER','sequelize','exports','name','STRING','FLOAT','BIGINT'];(function(_0x1790a3,_0x15a5c4){var _0x577ed6=function(_0x59268a){while(--_0x59268a){_0x1790a3['push'](_0x1790a3['shift']());}};_0x577ed6(++_0x15a5c4);}(_0x7297,0x1ac));var _0x7729=function(_0x1a02c1,_0x39624d){_0x1a02c1=_0x1a02c1-0x0;var _0x58979e=_0x7297[_0x1a02c1];return _0x58979e;};'use strict';var Sequelize=require(_0x7729('0x0'));module[_0x7729('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7729('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x7729('0x3')]},'display_name':{'type':Sequelize[_0x7729('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0x7729('0x3')]},'original_format':{'type':Sequelize[_0x7729('0x3')]},'original_duration':{'type':Sequelize[_0x7729('0x4')]},'original_sampleCount':{'type':Sequelize[_0x7729('0x5')]},'original_channelCount':{'type':Sequelize[_0x7729('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x7729('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x7729('0x5')]},'converted_channelCount':{'type':Sequelize[_0x7729('0x6')]},'converted_bitRate':{'type':Sequelize[_0x7729('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x7729('0x6')]}}; \ No newline at end of file +var _0x9382=['name','FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x9382,0x12a));var _0x2938=function(_0x144646,_0x558322){_0x144646=_0x144646-0x0;var _0x57c781=_0x9382[_0x144646];return _0x57c781;};'use strict';var Sequelize=require(_0x2938('0x0'));module[_0x2938('0x1')]={'name':{'type':Sequelize[_0x2938('0x2')],'unique':_0x2938('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x2938('0x2')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x2938('0x2')]},'original_duration':{'type':Sequelize[_0x2938('0x4')]},'original_sampleCount':{'type':Sequelize[_0x2938('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x2938('0x5')]},'original_sampleRate':{'type':Sequelize[_0x2938('0x6')]},'converted_format':{'type':Sequelize[_0x2938('0x2')]},'converted_duration':{'type':Sequelize[_0x2938('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x2938('0x5')]},'converted_channelCount':{'type':Sequelize[_0x2938('0x6')]},'converted_bitRate':{'type':Sequelize[_0x2938('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x2938('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 8e6ee2e..ab9da80 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 _0xfcb9=['save','then','destroy','get','Sounds','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','Sound','find','download','converted_format','existsSync','join','root','server/files/sounds/converted','save_name','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','format','catch','create','basename','file','filename','extname','originalname','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','chmodSync','0777','transcode','error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','bitRate','converted_sampleRate','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','UserProfileResource','start','pick','description','delete','original_format','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','set','Content-Range','apply','reject'];(function(_0x36f15a,_0x492925){var _0x526d57=function(_0x9ad648){while(--_0x9ad648){_0x36f15a['push'](_0x36f15a['shift']());}};_0x526d57(++_0x492925);}(_0xfcb9,0x14c));var _0x9fcb=function(_0x562a76,_0x92797d){_0x562a76=_0x562a76-0x0;var _0x281e3e=_0xfcb9[_0x562a76];return _0x281e3e;};'use strict';var emlformat=require(_0x9fcb('0x0'));var rimraf=require(_0x9fcb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9fcb('0x2'));var rp=require(_0x9fcb('0x3'));var moment=require(_0x9fcb('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9fcb('0x5'));var sox=require(_0x9fcb('0x6'));var csv=require(_0x9fcb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9fcb('0x8'));var _=require(_0x9fcb('0x9'));var squel=require(_0x9fcb('0xa'));var crypto=require(_0x9fcb('0xb'));var jsforce=require(_0x9fcb('0xc'));var deskjs=require(_0x9fcb('0xd'));var toCsv=require(_0x9fcb('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9fcb('0xe'));var authService=require(_0x9fcb('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9fcb('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x9fcb('0x11'));var config=require(_0x9fcb('0x12'));var licenseUtil=require(_0x9fcb('0x13'));var db=require(_0x9fcb('0x14'))['db'];function respondWithStatusCode(_0x55e039,_0x13affa){_0x13affa=_0x13affa||0xcc;return function(_0x266268){if(_0x266268){return _0x55e039[_0x9fcb('0x15')](_0x13affa);}return _0x55e039[_0x9fcb('0x16')](_0x13affa)[_0x9fcb('0x17')]();};}function respondWithResult(_0x91a620,_0x5ae55d){_0x5ae55d=_0x5ae55d||0xc8;return function(_0x167362){if(_0x167362){return _0x91a620[_0x9fcb('0x16')](_0x5ae55d)[_0x9fcb('0x18')](_0x167362);}};}function respondWithFilteredResult(_0x3c3724,_0x32cc3c){return function(_0x9226fc){if(_0x9226fc){var _0x4a096b=typeof _0x32cc3c[_0x9fcb('0x19')]==='undefined'&&typeof _0x32cc3c['limit']==='undefined';var _0x2e3b38=_0x9226fc[_0x9fcb('0x1a')];var _0x32c88a=_0x4a096b?0x0:_0x32cc3c['offset'];var _0x3c4b46=_0x4a096b?_0x9226fc[_0x9fcb('0x1a')]:_0x32cc3c[_0x9fcb('0x19')]+_0x32cc3c['limit'];var _0x1bba35;if(_0x3c4b46>=_0x2e3b38){_0x3c4b46=_0x2e3b38;_0x1bba35=0xc8;}else{_0x1bba35=0xce;}_0x3c3724[_0x9fcb('0x16')](_0x1bba35);return _0x3c3724[_0x9fcb('0x1b')](_0x9fcb('0x1c'),_0x32c88a+'-'+_0x3c4b46+'/'+_0x2e3b38)['json'](_0x9226fc);}return null;};}function patchUpdates(_0x16c37b){return function(_0x9bc99e){try{jsonpatch[_0x9fcb('0x1d')](_0x9bc99e,_0x16c37b,!![]);}catch(_0x439e10){return BPromise[_0x9fcb('0x1e')](_0x439e10);}return _0x9bc99e[_0x9fcb('0x1f')]();};}function saveUpdates(_0x264f0f,_0xa3d186){return function(_0x1b1059){if(_0x1b1059){return _0x1b1059['update'](_0x264f0f)[_0x9fcb('0x20')](function(_0x441031){return _0x441031;});}return null;};}function removeEntity(_0x2fa031,_0x53bec8){return function(_0x1eaa2e){if(_0x1eaa2e){return _0x1eaa2e[_0x9fcb('0x21')]()['then'](function(){var _0x55a123=_0x1eaa2e[_0x9fcb('0x22')]({'plain':!![]});var _0x48b523=_0x9fcb('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x48b523,'resourceId':_0x55a123['id']}})['then'](function(){return _0x1eaa2e;});})[_0x9fcb('0x20')](function(){_0x2fa031[_0x9fcb('0x16')](0xcc)[_0x9fcb('0x17')]();});}};}function handleEntityNotFound(_0x757b46,_0x182982){return function(_0x104607){if(!_0x104607){_0x757b46[_0x9fcb('0x15')](0x194);}return _0x104607;};}function handleError(_0x195578,_0xa165e8){_0xa165e8=_0xa165e8||0x1f4;return function(_0x54133e){logger['error'](_0x54133e[_0x9fcb('0x24')]);if(_0x54133e[_0x9fcb('0x25')]){delete _0x54133e[_0x9fcb('0x25')];}_0x195578[_0x9fcb('0x16')](_0xa165e8)[_0x9fcb('0x26')](_0x54133e);};}exports[_0x9fcb('0x27')]=function(_0x29839,_0x30d105){var _0x4ecbf4={},_0x1acb2d={},_0x4fffd1={'count':0x0,'rows':[]};var _0x5809a7=_[_0x9fcb('0x28')](db['Sound'][_0x9fcb('0x29')],function(_0x8fca02){return{'name':_0x8fca02['fieldName'],'type':_0x8fca02[_0x9fcb('0x2a')][_0x9fcb('0x2b')]};});_0x1acb2d[_0x9fcb('0x2c')]=_['map'](_0x5809a7,_0x9fcb('0x25'));_0x1acb2d[_0x9fcb('0x2d')]=_[_0x9fcb('0x2e')](_0x29839[_0x9fcb('0x2d')]);_0x1acb2d[_0x9fcb('0x2f')]=_[_0x9fcb('0x30')](_0x1acb2d[_0x9fcb('0x2c')],_0x1acb2d[_0x9fcb('0x2d')]);_0x4ecbf4[_0x9fcb('0x31')]=_[_0x9fcb('0x30')](_0x1acb2d[_0x9fcb('0x2c')],qs['fields'](_0x29839[_0x9fcb('0x2d')][_0x9fcb('0x32')]));_0x4ecbf4[_0x9fcb('0x31')]=_0x4ecbf4[_0x9fcb('0x31')][_0x9fcb('0x33')]?_0x4ecbf4['attributes']:_0x1acb2d[_0x9fcb('0x2c')];if(!_0x29839[_0x9fcb('0x2d')][_0x9fcb('0x34')]('nolimit')){_0x4ecbf4['limit']=qs[_0x9fcb('0x35')](_0x29839[_0x9fcb('0x2d')]['limit']);_0x4ecbf4[_0x9fcb('0x19')]=qs[_0x9fcb('0x19')](_0x29839[_0x9fcb('0x2d')]['offset']);}_0x4ecbf4[_0x9fcb('0x36')]=qs['sort'](_0x29839[_0x9fcb('0x2d')][_0x9fcb('0x37')]);_0x4ecbf4['where']=qs['filters'](_['pick'](_0x29839[_0x9fcb('0x2d')],_0x1acb2d[_0x9fcb('0x2f')]),_0x5809a7);if(_0x29839[_0x9fcb('0x2d')]['filter']){_0x4ecbf4[_0x9fcb('0x38')]=_['merge'](_0x4ecbf4[_0x9fcb('0x38')],{'$or':_[_0x9fcb('0x28')](_0x5809a7,function(_0x3a53bf){if(_0x3a53bf['type']!==_0x9fcb('0x39')){var _0x20d5b4={};_0x20d5b4[_0x3a53bf['name']]={'$like':'%'+_0x29839[_0x9fcb('0x2d')]['filter']+'%'};return _0x20d5b4;}})});}_0x4ecbf4=_[_0x9fcb('0x3a')]({},_0x4ecbf4,_0x29839[_0x9fcb('0x3b')]);var _0x310e5f={'where':_0x4ecbf4[_0x9fcb('0x38')]};return db['Sound'][_0x9fcb('0x1a')](_0x310e5f)['then'](function(_0x5ec78f){_0x4fffd1['count']=_0x5ec78f;if(_0x29839[_0x9fcb('0x2d')][_0x9fcb('0x3c')]){_0x4ecbf4[_0x9fcb('0x3d')]=[{'all':!![]}];}return db['Sound'][_0x9fcb('0x3e')](_0x4ecbf4);})['then'](function(_0x3e6668){_0x4fffd1[_0x9fcb('0x3f')]=_0x3e6668;return _0x4fffd1;})[_0x9fcb('0x20')](respondWithFilteredResult(_0x30d105,_0x4ecbf4))['catch'](handleError(_0x30d105,null));};exports['show']=function(_0x188118,_0x2b78f3){var _0x17c31e={'raw':!![],'where':{'id':_0x188118[_0x9fcb('0x40')]['id']}},_0x345241={};_0x345241[_0x9fcb('0x2c')]=_[_0x9fcb('0x2e')](db[_0x9fcb('0x41')][_0x9fcb('0x29')]);_0x345241[_0x9fcb('0x2d')]=_[_0x9fcb('0x2e')](_0x188118['query']);_0x345241['filters']=_['intersection'](_0x345241[_0x9fcb('0x2c')],_0x345241[_0x9fcb('0x2d')]);_0x17c31e[_0x9fcb('0x31')]=_[_0x9fcb('0x30')](_0x345241[_0x9fcb('0x2c')],qs['fields'](_0x188118[_0x9fcb('0x2d')]['fields']));_0x17c31e[_0x9fcb('0x31')]=_0x17c31e[_0x9fcb('0x31')][_0x9fcb('0x33')]?_0x17c31e[_0x9fcb('0x31')]:_0x345241[_0x9fcb('0x2c')];if(_0x188118[_0x9fcb('0x2d')][_0x9fcb('0x3c')]){_0x17c31e['include']=[{'all':!![]}];}_0x17c31e=_[_0x9fcb('0x3a')]({},_0x17c31e,_0x188118[_0x9fcb('0x3b')]);return db[_0x9fcb('0x41')][_0x9fcb('0x42')](_0x17c31e)['then'](handleEntityNotFound(_0x2b78f3,null))[_0x9fcb('0x20')](respondWithResult(_0x2b78f3,null))['catch'](handleError(_0x2b78f3,null));};exports[_0x9fcb('0x43')]=function(_0x42e1a0,_0x2978fd,_0x1e208a){return db[_0x9fcb('0x41')][_0x9fcb('0x42')]({'where':{'id':_0x42e1a0['params']['id']},'attributes':['name','save_name',_0x9fcb('0x44')],'raw':!![]})[_0x9fcb('0x20')](handleEntityNotFound(_0x2978fd,null))[_0x9fcb('0x20')](function(_0x15bacc){if(_0x15bacc){if(!fs[_0x9fcb('0x45')](path[_0x9fcb('0x46')](config[_0x9fcb('0x47')],_0x9fcb('0x48'),_0x15bacc[_0x9fcb('0x49')]+'.'+_0x15bacc[_0x9fcb('0x44')]))){throw new db[(_0x9fcb('0x4a'))][(_0x9fcb('0x4b'))](_0x9fcb('0x4c'));}return _0x2978fd[_0x9fcb('0x43')](path[_0x9fcb('0x46')](config[_0x9fcb('0x47')],_0x9fcb('0x48'),util['format'](_0x9fcb('0x4d'),_0x15bacc[_0x9fcb('0x49')],_0x15bacc[_0x9fcb('0x44')])),util[_0x9fcb('0x4e')](_0x9fcb('0x4d'),_0x15bacc[_0x9fcb('0x25')],_0x15bacc[_0x9fcb('0x44')]));}return null;})[_0x9fcb('0x4f')](handleError(_0x2978fd,null));};exports[_0x9fcb('0x50')]=function(_0xe199e,_0x4dbd54,_0x58787a){var _0x4c3018={'name':path[_0x9fcb('0x51')](_0xe199e[_0x9fcb('0x52')]['originalname'],path['extname'](_0xe199e['file']['originalname'])),'save_name':path[_0x9fcb('0x51')](_0xe199e[_0x9fcb('0x52')][_0x9fcb('0x53')],path[_0x9fcb('0x54')](_0xe199e[_0x9fcb('0x52')][_0x9fcb('0x53')])),'original_format':path[_0x9fcb('0x54')](_0xe199e[_0x9fcb('0x52')][_0x9fcb('0x55')])['substring'](0x1),'converted_format':_0x9fcb('0x56')};var _0x116537=path[_0x9fcb('0x46')](config[_0x9fcb('0x47')],_0x9fcb('0x57'),_0xe199e[_0x9fcb('0x52')][_0x9fcb('0x53')]);var _0x946ea9=path['join'](config[_0x9fcb('0x47')],'server/files/sounds/converted',util[_0x9fcb('0x4e')](_0x9fcb('0x4d'),path['basename'](_0xe199e['file'][_0x9fcb('0x53')],path['extname'](_0xe199e[_0x9fcb('0x52')]['filename'])),_0x4c3018[_0x9fcb('0x44')]));logger['info'](_0x9fcb('0x58'),_0x116537);logger[_0x9fcb('0x59')]('Sound\x20upload\x20destination:\x20%s',_0x946ea9);try{fs[_0x9fcb('0x5a')](_0x116537,parseInt(_0x9fcb('0x5b'),0x8));var _0x55e099=sox[_0x9fcb('0x5c')](_0x116537,_0x946ea9,{'sampleRate':0x1f40,'format':_0x9fcb('0x56'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x55e099['on'](_0x9fcb('0x5d'),function(_0x4e27a7){fs[_0x9fcb('0x5e')](_0x116537);_0x4dbd54[_0x9fcb('0x16')](0x1f4)[_0x9fcb('0x26')](_0x4e27a7);});_0x55e099['on'](_0x9fcb('0x5f'),function(_0xd7cf25){_0x4c3018[_0x9fcb('0x60')]=isNaN(_0xd7cf25[_0x9fcb('0x61')])?null:_0xd7cf25[_0x9fcb('0x61')]*0x3e8;_0x4c3018[_0x9fcb('0x62')]=isNaN(_0xd7cf25['sampleCount'])?null:_0xd7cf25[_0x9fcb('0x63')];_0x4c3018[_0x9fcb('0x64')]=isNaN(_0xd7cf25['channelCount'])?null:_0xd7cf25[_0x9fcb('0x65')];_0x4c3018[_0x9fcb('0x66')]=isNaN(_0xd7cf25['bitRate'])?null:_0xd7cf25['bitRate'];_0x4c3018[_0x9fcb('0x67')]=isNaN(_0xd7cf25[_0x9fcb('0x68')])?null:_0xd7cf25[_0x9fcb('0x68')];});_0x55e099['on']('dest',function(_0x398abf){_0x4c3018[_0x9fcb('0x69')]=isNaN(_0x398abf['duration'])?null:_0x398abf[_0x9fcb('0x61')]*0x3e8;_0x4c3018[_0x9fcb('0x6a')]=isNaN(_0x398abf[_0x9fcb('0x63')])?null:_0x398abf[_0x9fcb('0x63')];_0x4c3018['converted_channelCount']=isNaN(_0x398abf[_0x9fcb('0x65')])?null:_0x398abf[_0x9fcb('0x65')];_0x4c3018['converted_bitRate']=isNaN(_0x398abf[_0x9fcb('0x6b')])?null:_0x398abf[_0x9fcb('0x6b')];_0x4c3018[_0x9fcb('0x6c')]=isNaN(_0x398abf[_0x9fcb('0x68')])?null:_0x398abf[_0x9fcb('0x68')];});_0x55e099['on'](_0x9fcb('0x17'),function(){fs[_0x9fcb('0x5a')](_0x946ea9,parseInt(_0x9fcb('0x5b'),0x8));return db[_0x9fcb('0x41')][_0x9fcb('0x50')](_0x4c3018)[_0x9fcb('0x20')](function(_0x10fefb){var _0x5f1242={'role':_0xe199e[_0x9fcb('0x6d')]['role'],'userProfileId':_0xe199e[_0x9fcb('0x6d')][_0x9fcb('0x6e')]};if(!_0x5f1242)throw new Error(_0x9fcb('0x6f'));if(_0x5f1242[_0x9fcb('0x70')]===_0x9fcb('0x71')){var _0x221770=_0x10fefb[_0x9fcb('0x22')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x9fcb('0x23'),'userProfileId':_0x5f1242[_0x9fcb('0x6e')]},'raw':!![]})[_0x9fcb('0x20')](function(_0x5b891e){if(_0x5b891e&&_0x5b891e[_0x9fcb('0x72')]===0x0){return db[_0x9fcb('0x73')]['create']({'name':_0x221770[_0x9fcb('0x25')],'resourceId':_0x221770['id'],'type':_0x5b891e['name'],'sectionId':_0x5b891e['id']},{})[_0x9fcb('0x20')](function(){return _0x10fefb;});}else{return _0x10fefb;}})['catch'](function(_0x5138d1){logger[_0x9fcb('0x5d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5138d1);throw _0x5138d1;});}return _0x10fefb;})[_0x9fcb('0x20')](respondWithResult(_0x4dbd54,null))[_0x9fcb('0x4f')](handleError(_0x4dbd54,null));});_0x55e099[_0x9fcb('0x74')]();}catch(_0x59fae2){_0x4dbd54[_0x9fcb('0x16')](0x1f4)[_0x9fcb('0x26')](_0x59fae2);}};exports['update']=function(_0x196cea,_0x5a645b,_0x1f4ee0){return db[_0x9fcb('0x41')]['find']({'where':{'id':_0x196cea['params']['id']}})[_0x9fcb('0x20')](handleEntityNotFound(_0x5a645b,null))['then'](saveUpdates(_[_0x9fcb('0x75')](_0x196cea['body'],[_0x9fcb('0x25'),_0x9fcb('0x76')]),null))['then'](respondWithResult(_0x5a645b,null))[_0x9fcb('0x4f')](handleError(_0x5a645b,null));};exports[_0x9fcb('0x77')]=function(_0x2d95d3,_0x2a9aa5,_0x1e7dcc){return db[_0x9fcb('0x41')][_0x9fcb('0x42')]({'where':{'id':_0x2d95d3['params']['id']}})['then'](function(_0x38b374){if(_0x38b374){return _0x38b374['destroy']();}})[_0x9fcb('0x20')](function(_0x2c0e9e){var _0x5c75f3=path[_0x9fcb('0x46')](config[_0x9fcb('0x47')],_0x9fcb('0x57'),util['format'](_0x9fcb('0x4d'),_0x2c0e9e['save_name'],_0x2c0e9e[_0x9fcb('0x78')]));var _0x51508f=path[_0x9fcb('0x46')](config['root'],_0x9fcb('0x48'),util[_0x9fcb('0x4e')](_0x9fcb('0x4d'),_0x2c0e9e[_0x9fcb('0x49')],_0x2c0e9e[_0x9fcb('0x44')]));fs['unlinkSync'](_0x5c75f3);fs[_0x9fcb('0x5e')](_0x51508f);return _0x2c0e9e;})['then'](function(_0x402629){if(_0x402629){return _0x2a9aa5['status'](0xcc)['end']();}})[_0x9fcb('0x20')](handleEntityNotFound(_0x2a9aa5,null))[_0x9fcb('0x4f')](handleError(_0x2a9aa5,null));}; \ No newline at end of file +var _0x801a=['Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_channelCount','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Sounds','stack','name','send','index','map','Sound','rawAttributes','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','Sequelize','Sound\x20not\x20found','download','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info'];(function(_0x2014d0,_0x42bb9d){var _0xa02e35=function(_0x1d8dec){while(--_0x1d8dec){_0x2014d0['push'](_0x2014d0['shift']());}};_0xa02e35(++_0x42bb9d);}(_0x801a,0x117));var _0xa801=function(_0x39697c,_0x355bfb){_0x39697c=_0x39697c-0x0;var _0x2bbc3d=_0x801a[_0x39697c];return _0x2bbc3d;};'use strict';var emlformat=require(_0xa801('0x0'));var rimraf=require(_0xa801('0x1'));var zipdir=require(_0xa801('0x2'));var jsonpatch=require(_0xa801('0x3'));var rp=require('request-promise');var moment=require(_0xa801('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa801('0x5'));var util=require('util');var path=require(_0xa801('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa801('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa801('0x8'));var squel=require(_0xa801('0x9'));var crypto=require(_0xa801('0xa'));var jsforce=require(_0xa801('0xb'));var deskjs=require(_0xa801('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa801('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa801('0xe'));var qs=require(_0xa801('0xf'));var as=require(_0xa801('0x10'));var hardwareService=require(_0xa801('0x11'));var logger=require('../../config/logger')(_0xa801('0x12'));var utils=require(_0xa801('0x13'));var config=require(_0xa801('0x14'));var licenseUtil=require(_0xa801('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29e87c,_0x1f74c6){_0x1f74c6=_0x1f74c6||0xcc;return function(_0x3a4f16){if(_0x3a4f16){return _0x29e87c[_0xa801('0x16')](_0x1f74c6);}return _0x29e87c[_0xa801('0x17')](_0x1f74c6)[_0xa801('0x18')]();};}function respondWithResult(_0x1e3a7e,_0x4a8997){_0x4a8997=_0x4a8997||0xc8;return function(_0x319fe4){if(_0x319fe4){return _0x1e3a7e[_0xa801('0x17')](_0x4a8997)[_0xa801('0x19')](_0x319fe4);}};}function respondWithFilteredResult(_0x422b7d,_0x4959e9){return function(_0xfefb16){if(_0xfefb16){var _0x5b2c20=typeof _0x4959e9['offset']==='undefined'&&typeof _0x4959e9[_0xa801('0x1a')]===_0xa801('0x1b');var _0x57898b=_0xfefb16['count'];var _0x287c25=_0x5b2c20?0x0:_0x4959e9['offset'];var _0x592138=_0x5b2c20?_0xfefb16[_0xa801('0x1c')]:_0x4959e9[_0xa801('0x1d')]+_0x4959e9['limit'];var _0x2d02de;if(_0x592138>=_0x57898b){_0x592138=_0x57898b;_0x2d02de=0xc8;}else{_0x2d02de=0xce;}_0x422b7d[_0xa801('0x17')](_0x2d02de);return _0x422b7d[_0xa801('0x1e')](_0xa801('0x1f'),_0x287c25+'-'+_0x592138+'/'+_0x57898b)['json'](_0xfefb16);}return null;};}function patchUpdates(_0x286e6a){return function(_0x91a843){try{jsonpatch[_0xa801('0x20')](_0x91a843,_0x286e6a,!![]);}catch(_0x599b93){return BPromise[_0xa801('0x21')](_0x599b93);}return _0x91a843[_0xa801('0x22')]();};}function saveUpdates(_0x4fe9a4,_0xabfe50){return function(_0x402133){if(_0x402133){return _0x402133[_0xa801('0x23')](_0x4fe9a4)[_0xa801('0x24')](function(_0x5343a7){return _0x5343a7;});}return null;};}function removeEntity(_0x2d55ed,_0x38241d){return function(_0x3f5173){if(_0x3f5173){return _0x3f5173[_0xa801('0x25')]()['then'](function(){var _0x287b19=_0x3f5173[_0xa801('0x26')]({'plain':!![]});var _0x4b448a=_0xa801('0x27');return db['UserProfileResource'][_0xa801('0x25')]({'where':{'type':_0x4b448a,'resourceId':_0x287b19['id']}})[_0xa801('0x24')](function(){return _0x3f5173;});})['then'](function(){_0x2d55ed[_0xa801('0x17')](0xcc)[_0xa801('0x18')]();});}};}function handleEntityNotFound(_0x472708,_0x4e2c47){return function(_0x11d83b){if(!_0x11d83b){_0x472708[_0xa801('0x16')](0x194);}return _0x11d83b;};}function handleError(_0x2c880e,_0x27f291){_0x27f291=_0x27f291||0x1f4;return function(_0x1ae70f){logger['error'](_0x1ae70f[_0xa801('0x28')]);if(_0x1ae70f[_0xa801('0x29')]){delete _0x1ae70f[_0xa801('0x29')];}_0x2c880e[_0xa801('0x17')](_0x27f291)[_0xa801('0x2a')](_0x1ae70f);};}exports[_0xa801('0x2b')]=function(_0x49877a,_0x2540e1){var _0x1590b8={},_0x281f0b={},_0x5c4179={'count':0x0,'rows':[]};var _0xf39afa=_[_0xa801('0x2c')](db[_0xa801('0x2d')][_0xa801('0x2e')],function(_0x2439e2){return{'name':_0x2439e2['fieldName'],'type':_0x2439e2[_0xa801('0x2f')][_0xa801('0x30')]};});_0x281f0b['model']=_[_0xa801('0x2c')](_0xf39afa,'name');_0x281f0b[_0xa801('0x31')]=_['keys'](_0x49877a[_0xa801('0x31')]);_0x281f0b['filters']=_[_0xa801('0x32')](_0x281f0b[_0xa801('0x33')],_0x281f0b[_0xa801('0x31')]);_0x1590b8['attributes']=_[_0xa801('0x32')](_0x281f0b[_0xa801('0x33')],qs[_0xa801('0x34')](_0x49877a['query'][_0xa801('0x34')]));_0x1590b8['attributes']=_0x1590b8[_0xa801('0x35')][_0xa801('0x36')]?_0x1590b8[_0xa801('0x35')]:_0x281f0b['model'];if(!_0x49877a[_0xa801('0x31')][_0xa801('0x37')](_0xa801('0x38'))){_0x1590b8[_0xa801('0x1a')]=qs['limit'](_0x49877a[_0xa801('0x31')][_0xa801('0x1a')]);_0x1590b8[_0xa801('0x1d')]=qs[_0xa801('0x1d')](_0x49877a['query']['offset']);}_0x1590b8[_0xa801('0x39')]=qs['sort'](_0x49877a['query'][_0xa801('0x3a')]);_0x1590b8['where']=qs[_0xa801('0x3b')](_[_0xa801('0x3c')](_0x49877a['query'],_0x281f0b[_0xa801('0x3b')]),_0xf39afa);if(_0x49877a[_0xa801('0x31')][_0xa801('0x3d')]){_0x1590b8[_0xa801('0x3e')]=_[_0xa801('0x3f')](_0x1590b8['where'],{'$or':_[_0xa801('0x2c')](_0xf39afa,function(_0x44362c){if(_0x44362c['type']!==_0xa801('0x40')){var _0x14f7a0={};_0x14f7a0[_0x44362c[_0xa801('0x29')]]={'$like':'%'+_0x49877a[_0xa801('0x31')][_0xa801('0x3d')]+'%'};return _0x14f7a0;}})});}_0x1590b8=_['merge']({},_0x1590b8,_0x49877a['options']);var _0x99ff7={'where':_0x1590b8[_0xa801('0x3e')]};return db[_0xa801('0x2d')][_0xa801('0x1c')](_0x99ff7)['then'](function(_0x19f6d7){_0x5c4179[_0xa801('0x1c')]=_0x19f6d7;if(_0x49877a[_0xa801('0x31')][_0xa801('0x41')]){_0x1590b8[_0xa801('0x42')]=[{'all':!![]}];}return db[_0xa801('0x2d')][_0xa801('0x43')](_0x1590b8);})[_0xa801('0x24')](function(_0x224082){_0x5c4179[_0xa801('0x44')]=_0x224082;return _0x5c4179;})[_0xa801('0x24')](respondWithFilteredResult(_0x2540e1,_0x1590b8))[_0xa801('0x45')](handleError(_0x2540e1,null));};exports[_0xa801('0x46')]=function(_0x35a069,_0x994453){var _0x20d337={'raw':!![],'where':{'id':_0x35a069[_0xa801('0x47')]['id']}},_0x1133a6={};_0x1133a6[_0xa801('0x33')]=_[_0xa801('0x48')](db[_0xa801('0x2d')][_0xa801('0x2e')]);_0x1133a6['query']=_[_0xa801('0x48')](_0x35a069[_0xa801('0x31')]);_0x1133a6[_0xa801('0x3b')]=_[_0xa801('0x32')](_0x1133a6[_0xa801('0x33')],_0x1133a6[_0xa801('0x31')]);_0x20d337[_0xa801('0x35')]=_[_0xa801('0x32')](_0x1133a6[_0xa801('0x33')],qs['fields'](_0x35a069['query'][_0xa801('0x34')]));_0x20d337[_0xa801('0x35')]=_0x20d337[_0xa801('0x35')]['length']?_0x20d337[_0xa801('0x35')]:_0x1133a6['model'];if(_0x35a069[_0xa801('0x31')][_0xa801('0x41')]){_0x20d337['include']=[{'all':!![]}];}_0x20d337=_['merge']({},_0x20d337,_0x35a069[_0xa801('0x49')]);return db[_0xa801('0x2d')][_0xa801('0x4a')](_0x20d337)[_0xa801('0x24')](handleEntityNotFound(_0x994453,null))[_0xa801('0x24')](respondWithResult(_0x994453,null))[_0xa801('0x45')](handleError(_0x994453,null));};exports['download']=function(_0x9239d9,_0x14ca78,_0x2655ab){return db[_0xa801('0x2d')][_0xa801('0x4a')]({'where':{'id':_0x9239d9[_0xa801('0x47')]['id']},'attributes':['name',_0xa801('0x4b'),'converted_format'],'raw':!![]})[_0xa801('0x24')](handleEntityNotFound(_0x14ca78,null))['then'](function(_0x425a68){if(_0x425a68){if(!fs[_0xa801('0x4c')](path[_0xa801('0x4d')](config[_0xa801('0x4e')],_0xa801('0x4f'),_0x425a68[_0xa801('0x4b')]+'.'+_0x425a68[_0xa801('0x50')]))){throw new db[(_0xa801('0x51'))]['ValidationError'](_0xa801('0x52'));}return _0x14ca78[_0xa801('0x53')](path[_0xa801('0x4d')](config[_0xa801('0x4e')],_0xa801('0x4f'),util[_0xa801('0x54')](_0xa801('0x55'),_0x425a68[_0xa801('0x4b')],_0x425a68['converted_format'])),util[_0xa801('0x54')](_0xa801('0x55'),_0x425a68[_0xa801('0x29')],_0x425a68[_0xa801('0x50')]));}return null;})[_0xa801('0x45')](handleError(_0x14ca78,null));};exports[_0xa801('0x56')]=function(_0x2a84ea,_0x285284,_0x22d573){var _0x41ad5d={'name':path[_0xa801('0x57')](_0x2a84ea[_0xa801('0x58')][_0xa801('0x59')],path[_0xa801('0x5a')](_0x2a84ea[_0xa801('0x58')][_0xa801('0x59')])),'save_name':path['basename'](_0x2a84ea['file'][_0xa801('0x5b')],path['extname'](_0x2a84ea[_0xa801('0x58')][_0xa801('0x5b')])),'original_format':path['extname'](_0x2a84ea[_0xa801('0x58')]['originalname'])[_0xa801('0x5c')](0x1),'converted_format':_0xa801('0x5d')};var _0x3584ad=path[_0xa801('0x4d')](config[_0xa801('0x4e')],_0xa801('0x5e'),_0x2a84ea['file'][_0xa801('0x5b')]);var _0xed62f5=path[_0xa801('0x4d')](config[_0xa801('0x4e')],'server/files/sounds/converted',util[_0xa801('0x54')]('%s.%s',path[_0xa801('0x57')](_0x2a84ea[_0xa801('0x58')][_0xa801('0x5b')],path[_0xa801('0x5a')](_0x2a84ea[_0xa801('0x58')][_0xa801('0x5b')])),_0x41ad5d[_0xa801('0x50')]));logger[_0xa801('0x5f')](_0xa801('0x60'),_0x3584ad);logger['info'](_0xa801('0x61'),_0xed62f5);try{fs[_0xa801('0x62')](_0x3584ad,parseInt(_0xa801('0x63'),0x8));var _0x5a6966=sox[_0xa801('0x64')](_0x3584ad,_0xed62f5,{'sampleRate':0x1f40,'format':_0xa801('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5a6966['on']('error',function(_0x5ddb50){fs[_0xa801('0x65')](_0x3584ad);_0x285284[_0xa801('0x17')](0x1f4)[_0xa801('0x2a')](_0x5ddb50);});_0x5a6966['on']('src',function(_0x13e8b9){_0x41ad5d[_0xa801('0x66')]=isNaN(_0x13e8b9[_0xa801('0x67')])?null:_0x13e8b9[_0xa801('0x67')]*0x3e8;_0x41ad5d[_0xa801('0x68')]=isNaN(_0x13e8b9[_0xa801('0x69')])?null:_0x13e8b9[_0xa801('0x69')];_0x41ad5d['original_channelCount']=isNaN(_0x13e8b9[_0xa801('0x6a')])?null:_0x13e8b9[_0xa801('0x6a')];_0x41ad5d[_0xa801('0x6b')]=isNaN(_0x13e8b9[_0xa801('0x6c')])?null:_0x13e8b9['bitRate'];_0x41ad5d[_0xa801('0x6d')]=isNaN(_0x13e8b9['sampleRate'])?null:_0x13e8b9[_0xa801('0x6e')];});_0x5a6966['on'](_0xa801('0x6f'),function(_0x69a430){_0x41ad5d['converted_duration']=isNaN(_0x69a430[_0xa801('0x67')])?null:_0x69a430[_0xa801('0x67')]*0x3e8;_0x41ad5d['converted_sampleCount']=isNaN(_0x69a430['sampleCount'])?null:_0x69a430[_0xa801('0x69')];_0x41ad5d[_0xa801('0x70')]=isNaN(_0x69a430[_0xa801('0x6a')])?null:_0x69a430[_0xa801('0x6a')];_0x41ad5d['converted_bitRate']=isNaN(_0x69a430[_0xa801('0x6c')])?null:_0x69a430[_0xa801('0x6c')];_0x41ad5d[_0xa801('0x71')]=isNaN(_0x69a430[_0xa801('0x6e')])?null:_0x69a430['sampleRate'];});_0x5a6966['on'](_0xa801('0x18'),function(){fs[_0xa801('0x62')](_0xed62f5,parseInt(_0xa801('0x63'),0x8));return db[_0xa801('0x2d')][_0xa801('0x56')](_0x41ad5d)['then'](function(_0x34b93a){var _0x305244={'role':_0x2a84ea[_0xa801('0x72')][_0xa801('0x73')],'userProfileId':_0x2a84ea[_0xa801('0x72')][_0xa801('0x74')]};if(!_0x305244)throw new Error(_0xa801('0x75'));if(_0x305244['role']===_0xa801('0x76')){var _0x3cc123=_0x34b93a[_0xa801('0x26')]({'plain':!![]});return db['UserProfileSection'][_0xa801('0x4a')]({'where':{'name':_0xa801('0x27'),'userProfileId':_0x305244[_0xa801('0x74')]},'raw':!![]})[_0xa801('0x24')](function(_0x36d20e){if(_0x36d20e&&_0x36d20e['autoAssociation']===0x0){return db[_0xa801('0x77')][_0xa801('0x56')]({'name':_0x3cc123[_0xa801('0x29')],'resourceId':_0x3cc123['id'],'type':_0x36d20e[_0xa801('0x29')],'sectionId':_0x36d20e['id']},{})['then'](function(){return _0x34b93a;});}else{return _0x34b93a;}})['catch'](function(_0x57232c){logger[_0xa801('0x78')](_0xa801('0x79'),_0x57232c);throw _0x57232c;});}return _0x34b93a;})['then'](respondWithResult(_0x285284,null))[_0xa801('0x45')](handleError(_0x285284,null));});_0x5a6966[_0xa801('0x7a')]();}catch(_0x35ce85){_0x285284['status'](0x1f4)[_0xa801('0x2a')](_0x35ce85);}};exports['update']=function(_0x479b21,_0x5bf7cf,_0x4001a1){return db[_0xa801('0x2d')]['find']({'where':{'id':_0x479b21['params']['id']}})[_0xa801('0x24')](handleEntityNotFound(_0x5bf7cf,null))[_0xa801('0x24')](saveUpdates(_['pick'](_0x479b21[_0xa801('0x72')],[_0xa801('0x29'),_0xa801('0x7b')]),null))[_0xa801('0x24')](respondWithResult(_0x5bf7cf,null))[_0xa801('0x45')](handleError(_0x5bf7cf,null));};exports[_0xa801('0x7c')]=function(_0x4bcae5,_0x50b43d,_0x1dc1ad){return db[_0xa801('0x2d')][_0xa801('0x4a')]({'where':{'id':_0x4bcae5['params']['id']}})['then'](function(_0x584253){if(_0x584253){return _0x584253['destroy']();}})[_0xa801('0x24')](function(_0x5ef59e){var _0x407694=path[_0xa801('0x4d')](config[_0xa801('0x4e')],'server/files/sounds/original',util[_0xa801('0x54')](_0xa801('0x55'),_0x5ef59e[_0xa801('0x4b')],_0x5ef59e['original_format']));var _0x116405=path['join'](config[_0xa801('0x4e')],_0xa801('0x4f'),util[_0xa801('0x54')]('%s.%s',_0x5ef59e['save_name'],_0x5ef59e[_0xa801('0x50')]));fs[_0xa801('0x65')](_0x407694);fs[_0xa801('0x65')](_0x116405);return _0x5ef59e;})[_0xa801('0x24')](function(_0x20c8ce){if(_0x20c8ce){return _0x50b43d[_0xa801('0x17')](0xcc)['end']();}})[_0xa801('0x24')](handleEntityNotFound(_0x50b43d,null))[_0xa801('0x45')](handleError(_0x50b43d,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 651caff..aa54cc6 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 _0x6099=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','tools_sounds','lodash','util','../../config/logger'];(function(_0xb6c490,_0x23b361){var _0x3be82d=function(_0x28bcf2){while(--_0x28bcf2){_0xb6c490['push'](_0xb6c490['shift']());}};_0x3be82d(++_0x23b361);}(_0x6099,0x1b7));var _0x9609=function(_0x47e9b5,_0x4b2f1a){_0x47e9b5=_0x47e9b5-0x0;var _0x3f4c75=_0x6099[_0x47e9b5];return _0x3f4c75;};'use strict';var _=require(_0x9609('0x0'));var util=require(_0x9609('0x1'));var logger=require(_0x9609('0x2'))(_0x9609('0x3'));var moment=require(_0x9609('0x4'));var BPromise=require(_0x9609('0x5'));var rp=require(_0x9609('0x6'));var fs=require('fs');var path=require(_0x9609('0x7'));var rimraf=require(_0x9609('0x8'));var config=require(_0x9609('0x9'));var attributes=require(_0x9609('0xa'));module[_0x9609('0xb')]=function(_0x26aef3,_0x3ddd01){return _0x26aef3['define']('Sound',attributes,{'tableName':_0x9609('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d8b=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Sound','tools_sounds','lodash'];(function(_0x51fd25,_0x2fcbb){var _0x4529ae=function(_0x17ed81){while(--_0x17ed81){_0x51fd25['push'](_0x51fd25['shift']());}};_0x4529ae(++_0x2fcbb);}(_0x8d8b,0xa7));var _0xb8d8=function(_0xb31f13,_0x5beeb0){_0xb31f13=_0xb31f13-0x0;var _0x1b601c=_0x8d8b[_0xb31f13];return _0x1b601c;};'use strict';var _=require(_0xb8d8('0x0'));var util=require(_0xb8d8('0x1'));var logger=require(_0xb8d8('0x2'))(_0xb8d8('0x3'));var moment=require(_0xb8d8('0x4'));var BPromise=require(_0xb8d8('0x5'));var rp=require(_0xb8d8('0x6'));var fs=require('fs');var path=require(_0xb8d8('0x7'));var rimraf=require(_0xb8d8('0x8'));var config=require(_0xb8d8('0x9'));var attributes=require('./sound.attributes');module[_0xb8d8('0xa')]=function(_0x3ce470,_0x32e727){return _0x3ce470[_0xb8d8('0xb')](_0xb8d8('0xc'),attributes,{'tableName':_0xb8d8('0xd'),'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 d7addef..fc92a98 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 _0xc1c8=['ShowSound','Sound','find','options','raw','where','include','map','model','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xc1c8,0x1ca));var _0x8c1c=function(_0x179565,_0xe7911f){_0x179565=_0x179565-0x0;var _0x545512=_0xc1c8[_0x179565];return _0x545512;};'use strict';var _=require(_0x8c1c('0x0'));var util=require('util');var moment=require(_0x8c1c('0x1'));var BPromise=require(_0x8c1c('0x2'));var rs=require(_0x8c1c('0x3'));var fs=require('fs');var Redis=require(_0x8c1c('0x4'));var db=require(_0x8c1c('0x5'))['db'];var utils=require(_0x8c1c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8c1c('0x7'));var jayson=require(_0x8c1c('0x8'));var client=jayson[_0x8c1c('0x9')][_0x8c1c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a3c2f,_0x50147d,_0x5a6e92){return new BPromise(function(_0x1eb9a4,_0x3cfad4){return client[_0x8c1c('0xb')](_0x1a3c2f,_0x5a6e92)[_0x8c1c('0xc')](function(_0x2fdf83){logger[_0x8c1c('0xd')](_0x8c1c('0xe'),_0x50147d,'request\x20sent');logger[_0x8c1c('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x50147d,_0x8c1c('0x10'),JSON[_0x8c1c('0x11')](_0x2fdf83));if(_0x2fdf83[_0x8c1c('0x12')]){if(_0x2fdf83[_0x8c1c('0x12')]['code']===0x1f4){logger[_0x8c1c('0x12')](_0x8c1c('0xe'),_0x50147d,_0x2fdf83[_0x8c1c('0x12')][_0x8c1c('0x13')]);return _0x3cfad4(_0x2fdf83[_0x8c1c('0x12')][_0x8c1c('0x13')]);}logger[_0x8c1c('0x12')](_0x8c1c('0xe'),_0x50147d,_0x2fdf83[_0x8c1c('0x12')][_0x8c1c('0x13')]);return _0x1eb9a4(_0x2fdf83[_0x8c1c('0x12')][_0x8c1c('0x13')]);}else{logger[_0x8c1c('0xd')](_0x8c1c('0xe'),_0x50147d,_0x8c1c('0x10'));_0x1eb9a4(_0x2fdf83[_0x8c1c('0x14')]['message']);}})[_0x8c1c('0x15')](function(_0x57c4e5){logger[_0x8c1c('0x12')](_0x8c1c('0xe'),_0x50147d,_0x57c4e5);_0x3cfad4(_0x57c4e5);});});}exports[_0x8c1c('0x16')]=function(_0x2b5776){var _0x5a1290=this;return new Promise(function(_0x533d72,_0x367d4c){return db[_0x8c1c('0x17')][_0x8c1c('0x18')]({'raw':_0x2b5776[_0x8c1c('0x19')]?_0x2b5776[_0x8c1c('0x19')][_0x8c1c('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b5776['options']?_0x2b5776[_0x8c1c('0x19')][_0x8c1c('0x1b')]||null:null,'attributes':_0x2b5776[_0x8c1c('0x19')]?_0x2b5776['options']['attributes']||null:null,'include':_0x2b5776['options']?_0x2b5776[_0x8c1c('0x19')][_0x8c1c('0x1c')]?_[_0x8c1c('0x1d')](_0x2b5776[_0x8c1c('0x19')][_0x8c1c('0x1c')],function(_0x3552b9){return{'model':db[_0x3552b9[_0x8c1c('0x1e')]],'as':_0x3552b9['as'],'attributes':_0x3552b9['attributes'],'include':_0x3552b9[_0x8c1c('0x1c')]?_[_0x8c1c('0x1d')](_0x3552b9[_0x8c1c('0x1c')],function(_0x22c374){return{'model':db[_0x22c374[_0x8c1c('0x1e')]],'as':_0x22c374['as'],'attributes':_0x22c374[_0x8c1c('0x1f')],'include':_0x22c374['include']?_[_0x8c1c('0x1d')](_0x22c374[_0x8c1c('0x1c')],function(_0x3e5c9a){return{'model':db[_0x3e5c9a[_0x8c1c('0x1e')]],'as':_0x3e5c9a['as'],'attributes':_0x3e5c9a['attributes']};}):[]};}):[]};}):[]:[]})[_0x8c1c('0xc')](function(_0x217fe4){logger[_0x8c1c('0xd')]('ShowSound',_0x2b5776);logger[_0x8c1c('0xf')]('ShowSound',_0x2b5776,JSON[_0x8c1c('0x11')](_0x217fe4));_0x533d72(_0x217fe4);})[_0x8c1c('0x15')](function(_0x244b1e){logger[_0x8c1c('0x12')]('ShowSound',_0x244b1e['message'],_0x2b5776);_0x367d4c(_0x5a1290[_0x8c1c('0x12')](0x1f4,_0x244b1e['message']));});});}; \ No newline at end of file +var _0x3257=['client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSound','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x46eec6,_0x595bab){var _0x4cf7b0=function(_0xbb89d6){while(--_0xbb89d6){_0x46eec6['push'](_0x46eec6['shift']());}};_0x4cf7b0(++_0x595bab);}(_0x3257,0x11f));var _0x7325=function(_0x493ff4,_0x1b776a){_0x493ff4=_0x493ff4-0x0;var _0x150468=_0x3257[_0x493ff4];return _0x150468;};'use strict';var _=require(_0x7325('0x0'));var util=require(_0x7325('0x1'));var moment=require(_0x7325('0x2'));var BPromise=require(_0x7325('0x3'));var rs=require(_0x7325('0x4'));var fs=require('fs');var Redis=require(_0x7325('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7325('0x6'));var logger=require(_0x7325('0x7'))(_0x7325('0x8'));var config=require(_0x7325('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7325('0xa')][_0x7325('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5edc29,_0x370d51,_0x17fc19){return new BPromise(function(_0xd1e97d,_0x2c7cc1){return client[_0x7325('0xc')](_0x5edc29,_0x17fc19)[_0x7325('0xd')](function(_0x3c6685){logger[_0x7325('0xe')](_0x7325('0xf'),_0x370d51,_0x7325('0x10'));logger[_0x7325('0x11')]('Sound,\x20%s,\x20%s,\x20%s',_0x370d51,'request\x20sent',JSON[_0x7325('0x12')](_0x3c6685));if(_0x3c6685[_0x7325('0x13')]){if(_0x3c6685[_0x7325('0x13')][_0x7325('0x14')]===0x1f4){logger[_0x7325('0x13')]('Sound,\x20%s,\x20%s',_0x370d51,_0x3c6685[_0x7325('0x13')][_0x7325('0x15')]);return _0x2c7cc1(_0x3c6685['error']['message']);}logger[_0x7325('0x13')]('Sound,\x20%s,\x20%s',_0x370d51,_0x3c6685['error']['message']);return _0xd1e97d(_0x3c6685[_0x7325('0x13')][_0x7325('0x15')]);}else{logger[_0x7325('0xe')]('Sound,\x20%s,\x20%s',_0x370d51,_0x7325('0x10'));_0xd1e97d(_0x3c6685[_0x7325('0x16')]['message']);}})[_0x7325('0x17')](function(_0x484099){logger[_0x7325('0x13')]('Sound,\x20%s,\x20%s',_0x370d51,_0x484099);_0x2c7cc1(_0x484099);});});}exports[_0x7325('0x18')]=function(_0x211feb){var _0x11bebf=this;return new Promise(function(_0x2b6462,_0x38402e){return db['Sound'][_0x7325('0x19')]({'raw':_0x211feb[_0x7325('0x1a')]?_0x211feb[_0x7325('0x1a')][_0x7325('0x1b')]===undefined?!![]:![]:!![],'where':_0x211feb[_0x7325('0x1a')]?_0x211feb[_0x7325('0x1a')][_0x7325('0x1c')]||null:null,'attributes':_0x211feb[_0x7325('0x1a')]?_0x211feb[_0x7325('0x1a')][_0x7325('0x1d')]||null:null,'include':_0x211feb['options']?_0x211feb['options'][_0x7325('0x1e')]?_[_0x7325('0x1f')](_0x211feb['options'][_0x7325('0x1e')],function(_0x560bbb){return{'model':db[_0x560bbb[_0x7325('0x20')]],'as':_0x560bbb['as'],'attributes':_0x560bbb[_0x7325('0x1d')],'include':_0x560bbb['include']?_[_0x7325('0x1f')](_0x560bbb[_0x7325('0x1e')],function(_0x2a9fff){return{'model':db[_0x2a9fff['model']],'as':_0x2a9fff['as'],'attributes':_0x2a9fff[_0x7325('0x1d')],'include':_0x2a9fff[_0x7325('0x1e')]?_[_0x7325('0x1f')](_0x2a9fff[_0x7325('0x1e')],function(_0x22ffc5){return{'model':db[_0x22ffc5[_0x7325('0x20')]],'as':_0x22ffc5['as'],'attributes':_0x22ffc5['attributes']};}):[]};}):[]};}):[]:[]})[_0x7325('0xd')](function(_0x56ad44){logger[_0x7325('0xe')]('ShowSound',_0x211feb);logger[_0x7325('0x11')](_0x7325('0x18'),_0x211feb,JSON[_0x7325('0x12')](_0x56ad44));_0x2b6462(_0x56ad44);})['catch'](function(_0x1afd7d){logger[_0x7325('0x13')](_0x7325('0x18'),_0x1afd7d[_0x7325('0x15')],_0x211feb);_0x38402e(_0x11bebf[_0x7325('0x13')](0x1f4,_0x1afd7d[_0x7325('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index a1fc52d..a86241f 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 _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x1e1299,_0x4fbdf0){var _0x3cfaf9=function(_0x256a66){while(--_0x256a66){_0x1e1299['push'](_0x1e1299['shift']());}};_0x3cfaf9(++_0x4fbdf0);}(_0x2032,0xd9));var _0x2203=function(_0x2d8c3a,_0x1ba17e){_0x2d8c3a=_0x2d8c3a-0x0;var _0x474b87=_0x2032[_0x2d8c3a];return _0x474b87;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file +var _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x15682e,_0x45dcb6){var _0x199dc9=function(_0x2840e8){while(--_0x2840e8){_0x15682e['push'](_0x15682e['shift']());}};_0x199dc9(++_0x45dcb6);}(_0x2032,0xd9));var _0x2203=function(_0x4d6529,_0x5bd3bb){_0x4d6529=_0x4d6529-0x0;var _0x1594d9=_0x2032[_0x4d6529];return _0x1594d9;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 91176f0..d494f6e 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 _0x7d5a=['out','sequelize','exports','STRING','TEXT','medium','ENUM'];(function(_0x2455b0,_0x1dcc31){var _0x4f7718=function(_0x2c49c1){while(--_0x2c49c1){_0x2455b0['push'](_0x2455b0['shift']());}};_0x4f7718(++_0x1dcc31);}(_0x7d5a,0x17b));var _0xa7d5=function(_0x3ba1b2,_0x16e049){_0x3ba1b2=_0x3ba1b2-0x0;var _0x10ca49=_0x7d5a[_0x3ba1b2];return _0x10ca49;};'use strict';var Sequelize=require(_0xa7d5('0x0'));module[_0xa7d5('0x1')]={'uniqueid':{'type':Sequelize[_0xa7d5('0x2')]},'body':{'type':Sequelize[_0xa7d5('0x3')](_0xa7d5('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xa7d5('0x5')]('in',_0xa7d5('0x6')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xa7d5('0x3')]}}; \ No newline at end of file +var _0x6efc=['TEXT','out','exports','STRING'];(function(_0x1e06f1,_0x59d7e1){var _0x34f77e=function(_0x4f9f26){while(--_0x4f9f26){_0x1e06f1['push'](_0x1e06f1['shift']());}};_0x34f77e(++_0x59d7e1);}(_0x6efc,0xbe));var _0xc6ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6efc[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xc6ef('0x0')]={'uniqueid':{'type':Sequelize[_0xc6ef('0x1')]},'body':{'type':Sequelize[_0xc6ef('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc6ef('0x3')),'defaultValue':_0xc6ef('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0xc6ef('0x1')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 86de74d..7435f0a 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 _0x52e1=['zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','SquareMessage','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','length','find','create','body','eml-format','rimraf'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x52e1,0x175));var _0x152e=function(_0x5646b0,_0x453a95){_0x5646b0=_0x5646b0-0x0;var _0x295c45=_0x52e1[_0x5646b0];return _0x295c45;};'use strict';var emlformat=require(_0x152e('0x0'));var rimraf=require(_0x152e('0x1'));var zipdir=require(_0x152e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x152e('0x3'));var moment=require('moment');var BPromise=require(_0x152e('0x4'));var Mustache=require(_0x152e('0x5'));var util=require(_0x152e('0x6'));var path=require('path');var sox=require(_0x152e('0x7'));var csv=require(_0x152e('0x8'));var ejs=require(_0x152e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x152e('0xa'));var crypto=require(_0x152e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x152e('0xc'));var toCsv=require(_0x152e('0x8'));var querystring=require(_0x152e('0xd'));var Papa=require(_0x152e('0xe'));var Redis=require(_0x152e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x152e('0x10'));var as=require(_0x152e('0x11'));var hardwareService=require(_0x152e('0x12'));var logger=require(_0x152e('0x13'))(_0x152e('0x14'));var utils=require(_0x152e('0x15'));var config=require(_0x152e('0x16'));var licenseUtil=require(_0x152e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e2cb3,_0x5240d8){_0x5240d8=_0x5240d8||0xcc;return function(_0x4cd70c){if(_0x4cd70c){return _0x5e2cb3[_0x152e('0x18')](_0x5240d8);}return _0x5e2cb3[_0x152e('0x19')](_0x5240d8)[_0x152e('0x1a')]();};}function respondWithResult(_0x41cc1b,_0x5873f2){_0x5873f2=_0x5873f2||0xc8;return function(_0x18b31b){if(_0x18b31b){return _0x41cc1b['status'](_0x5873f2)[_0x152e('0x1b')](_0x18b31b);}};}function respondWithFilteredResult(_0x2bbc8b,_0x232f3b){return function(_0x1fba9e){if(_0x1fba9e){var _0x42efe9=typeof _0x232f3b[_0x152e('0x1c')]==='undefined'&&typeof _0x232f3b[_0x152e('0x1d')]===_0x152e('0x1e');var _0x3b1dbc=_0x1fba9e[_0x152e('0x1f')];var _0x3c9994=_0x42efe9?0x0:_0x232f3b['offset'];var _0x1848f3=_0x42efe9?_0x1fba9e['count']:_0x232f3b[_0x152e('0x1c')]+_0x232f3b[_0x152e('0x1d')];var _0x30ecb5;if(_0x1848f3>=_0x3b1dbc){_0x1848f3=_0x3b1dbc;_0x30ecb5=0xc8;}else{_0x30ecb5=0xce;}_0x2bbc8b[_0x152e('0x19')](_0x30ecb5);return _0x2bbc8b[_0x152e('0x20')](_0x152e('0x21'),_0x3c9994+'-'+_0x1848f3+'/'+_0x3b1dbc)[_0x152e('0x1b')](_0x1fba9e);}return null;};}function patchUpdates(_0x4e924c){return function(_0x185bdf){try{jsonpatch[_0x152e('0x22')](_0x185bdf,_0x4e924c,!![]);}catch(_0x15ff9a){return BPromise[_0x152e('0x23')](_0x15ff9a);}return _0x185bdf[_0x152e('0x24')]();};}function saveUpdates(_0x105ab6,_0x28d248){return function(_0x309723){if(_0x309723){return _0x309723[_0x152e('0x25')](_0x105ab6)[_0x152e('0x26')](function(_0x31cd6c){return _0x31cd6c;});}return null;};}function removeEntity(_0x2cc00e,_0x2bf968){return function(_0x28b226){if(_0x28b226){return _0x28b226[_0x152e('0x27')]()['then'](function(){_0x2cc00e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x452229,_0x1c3b8d){return function(_0x3f4242){if(!_0x3f4242){_0x452229[_0x152e('0x18')](0x194);}return _0x3f4242;};}function handleError(_0x33cfa1,_0x1ca03e){_0x1ca03e=_0x1ca03e||0x1f4;return function(_0x2622e4){logger['error'](_0x2622e4[_0x152e('0x28')]);if(_0x2622e4[_0x152e('0x29')]){delete _0x2622e4[_0x152e('0x29')];}_0x33cfa1[_0x152e('0x19')](_0x1ca03e)['send'](_0x2622e4);};}exports['index']=function(_0x14ebcc,_0x3c16f3){var _0xb64595={},_0x515166={},_0x3d9d64={'count':0x0,'rows':[]};var _0x463103=_['map'](db[_0x152e('0x2a')][_0x152e('0x2b')],function(_0x4e269f){return{'name':_0x4e269f[_0x152e('0x2c')],'type':_0x4e269f[_0x152e('0x2d')][_0x152e('0x2e')]};});_0x515166['model']=_['map'](_0x463103,'name');_0x515166['query']=_[_0x152e('0x2f')](_0x14ebcc[_0x152e('0x30')]);_0x515166[_0x152e('0x31')]=_[_0x152e('0x32')](_0x515166[_0x152e('0x33')],_0x515166[_0x152e('0x30')]);_0xb64595[_0x152e('0x34')]=_[_0x152e('0x32')](_0x515166[_0x152e('0x33')],qs[_0x152e('0x35')](_0x14ebcc['query'][_0x152e('0x35')]));_0xb64595['attributes']=_0xb64595[_0x152e('0x34')]['length']?_0xb64595[_0x152e('0x34')]:_0x515166[_0x152e('0x33')];if(!_0x14ebcc[_0x152e('0x30')][_0x152e('0x36')](_0x152e('0x37'))){_0xb64595['limit']=qs[_0x152e('0x1d')](_0x14ebcc[_0x152e('0x30')]['limit']);_0xb64595['offset']=qs[_0x152e('0x1c')](_0x14ebcc[_0x152e('0x30')][_0x152e('0x1c')]);}_0xb64595[_0x152e('0x38')]=qs[_0x152e('0x39')](_0x14ebcc[_0x152e('0x30')][_0x152e('0x39')]);_0xb64595['where']=qs[_0x152e('0x31')](_[_0x152e('0x3a')](_0x14ebcc[_0x152e('0x30')],_0x515166['filters']),_0x463103);if(_0x14ebcc[_0x152e('0x30')]['filter']){_0xb64595[_0x152e('0x3b')]=_[_0x152e('0x3c')](_0xb64595[_0x152e('0x3b')],{'$or':_[_0x152e('0x3d')](_0x463103,function(_0x38ef5f){if(_0x38ef5f[_0x152e('0x2d')]!==_0x152e('0x3e')){var _0x344d8c={};_0x344d8c[_0x38ef5f[_0x152e('0x29')]]={'$like':'%'+_0x14ebcc[_0x152e('0x30')][_0x152e('0x3f')]+'%'};return _0x344d8c;}})});}_0xb64595=_[_0x152e('0x3c')]({},_0xb64595,_0x14ebcc[_0x152e('0x40')]);var _0x27b074={'where':_0xb64595[_0x152e('0x3b')]};return db['SquareMessage'][_0x152e('0x1f')](_0x27b074)['then'](function(_0x2390de){_0x3d9d64[_0x152e('0x1f')]=_0x2390de;if(_0x14ebcc['query'][_0x152e('0x41')]){_0xb64595[_0x152e('0x42')]=[{'all':!![]}];}return db[_0x152e('0x2a')][_0x152e('0x43')](_0xb64595);})[_0x152e('0x26')](function(_0x1f32d7){_0x3d9d64['rows']=_0x1f32d7;return _0x3d9d64;})[_0x152e('0x26')](respondWithFilteredResult(_0x3c16f3,_0xb64595))[_0x152e('0x44')](handleError(_0x3c16f3,null));};exports[_0x152e('0x45')]=function(_0x4016ff,_0x1b8d8d){var _0x3c46bb={'raw':!![],'where':{'id':_0x4016ff[_0x152e('0x46')]['id']}},_0x3ee817={};_0x3ee817[_0x152e('0x33')]=_[_0x152e('0x2f')](db[_0x152e('0x2a')]['rawAttributes']);_0x3ee817['query']=_[_0x152e('0x2f')](_0x4016ff[_0x152e('0x30')]);_0x3ee817[_0x152e('0x31')]=_[_0x152e('0x32')](_0x3ee817['model'],_0x3ee817['query']);_0x3c46bb[_0x152e('0x34')]=_['intersection'](_0x3ee817[_0x152e('0x33')],qs[_0x152e('0x35')](_0x4016ff[_0x152e('0x30')][_0x152e('0x35')]));_0x3c46bb['attributes']=_0x3c46bb[_0x152e('0x34')][_0x152e('0x47')]?_0x3c46bb[_0x152e('0x34')]:_0x3ee817[_0x152e('0x33')];if(_0x4016ff[_0x152e('0x30')][_0x152e('0x41')]){_0x3c46bb['include']=[{'all':!![]}];}_0x3c46bb=_[_0x152e('0x3c')]({},_0x3c46bb,_0x4016ff[_0x152e('0x40')]);return db[_0x152e('0x2a')][_0x152e('0x48')](_0x3c46bb)[_0x152e('0x26')](handleEntityNotFound(_0x1b8d8d,null))[_0x152e('0x26')](respondWithResult(_0x1b8d8d,null))[_0x152e('0x44')](handleError(_0x1b8d8d,null));};exports[_0x152e('0x49')]=function(_0x2c1432,_0x4da9e0){return db[_0x152e('0x2a')][_0x152e('0x49')](_0x2c1432['body'],{})[_0x152e('0x26')](respondWithResult(_0x4da9e0,0xc9))[_0x152e('0x44')](handleError(_0x4da9e0,null));};exports['update']=function(_0x591c9b,_0x3f350d){if(_0x591c9b['body']['id']){delete _0x591c9b['body']['id'];}return db[_0x152e('0x2a')][_0x152e('0x48')]({'where':{'id':_0x591c9b[_0x152e('0x46')]['id']}})[_0x152e('0x26')](handleEntityNotFound(_0x3f350d,null))[_0x152e('0x26')](saveUpdates(_0x591c9b[_0x152e('0x4a')],null))[_0x152e('0x26')](respondWithResult(_0x3f350d,null))[_0x152e('0x44')](handleError(_0x3f350d,null));};exports['destroy']=function(_0x351460,_0x1b1c67){return db[_0x152e('0x2a')][_0x152e('0x48')]({'where':{'id':_0x351460[_0x152e('0x46')]['id']}})[_0x152e('0x26')](handleEntityNotFound(_0x1b1c67,null))[_0x152e('0x26')](removeEntity(_0x1b1c67,null))[_0x152e('0x44')](handleError(_0x1b1c67,null));}; \ No newline at end of file +var _0xcefb=['query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','SquareMessage','rawAttributes','type','key','model'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcefb,0x1cb));var _0xbcef=function(_0x2e92c2,_0x381855){_0x2e92c2=_0x2e92c2-0x0;var _0x37105f=_0xcefb[_0x2e92c2];return _0x37105f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbcef('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbcef('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbcef('0x2'));var Mustache=require(_0xbcef('0x3'));var util=require(_0xbcef('0x4'));var path=require(_0xbcef('0x5'));var sox=require(_0xbcef('0x6'));var csv=require('to-csv');var ejs=require(_0xbcef('0x7'));var fs=require('fs');var fs_extra=require(_0xbcef('0x8'));var _=require('lodash');var squel=require(_0xbcef('0x9'));var crypto=require('crypto');var jsforce=require(_0xbcef('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbcef('0xb'));var Papa=require('papaparse');var Redis=require(_0xbcef('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xbcef('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbcef('0xe'))(_0xbcef('0xf'));var utils=require(_0xbcef('0x10'));var config=require(_0xbcef('0x11'));var licenseUtil=require(_0xbcef('0x12'));var db=require(_0xbcef('0x13'))['db'];function respondWithStatusCode(_0xd10324,_0x193bf2){_0x193bf2=_0x193bf2||0xcc;return function(_0xebb4d2){if(_0xebb4d2){return _0xd10324['sendStatus'](_0x193bf2);}return _0xd10324[_0xbcef('0x14')](_0x193bf2)[_0xbcef('0x15')]();};}function respondWithResult(_0x54f06d,_0x4183e0){_0x4183e0=_0x4183e0||0xc8;return function(_0xeb57ca){if(_0xeb57ca){return _0x54f06d[_0xbcef('0x14')](_0x4183e0)[_0xbcef('0x16')](_0xeb57ca);}};}function respondWithFilteredResult(_0x20d5f7,_0x52afa9){return function(_0x252a00){if(_0x252a00){var _0x5e1af9=typeof _0x52afa9[_0xbcef('0x17')]===_0xbcef('0x18')&&typeof _0x52afa9['limit']===_0xbcef('0x18');var _0x4c9a24=_0x252a00[_0xbcef('0x19')];var _0x52f856=_0x5e1af9?0x0:_0x52afa9[_0xbcef('0x17')];var _0x5ea0e1=_0x5e1af9?_0x252a00['count']:_0x52afa9[_0xbcef('0x17')]+_0x52afa9[_0xbcef('0x1a')];var _0x57e078;if(_0x5ea0e1>=_0x4c9a24){_0x5ea0e1=_0x4c9a24;_0x57e078=0xc8;}else{_0x57e078=0xce;}_0x20d5f7[_0xbcef('0x14')](_0x57e078);return _0x20d5f7[_0xbcef('0x1b')]('Content-Range',_0x52f856+'-'+_0x5ea0e1+'/'+_0x4c9a24)[_0xbcef('0x16')](_0x252a00);}return null;};}function patchUpdates(_0x1b1238){return function(_0x32c2b1){try{jsonpatch[_0xbcef('0x1c')](_0x32c2b1,_0x1b1238,!![]);}catch(_0xf59172){return BPromise[_0xbcef('0x1d')](_0xf59172);}return _0x32c2b1[_0xbcef('0x1e')]();};}function saveUpdates(_0x4690d7,_0x59cc37){return function(_0x1c3d28){if(_0x1c3d28){return _0x1c3d28[_0xbcef('0x1f')](_0x4690d7)['then'](function(_0x4e4ac6){return _0x4e4ac6;});}return null;};}function removeEntity(_0x487fd2,_0x193956){return function(_0x547e9c){if(_0x547e9c){return _0x547e9c[_0xbcef('0x20')]()[_0xbcef('0x21')](function(){_0x487fd2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc76a7b,_0x445ba1){return function(_0x3fb166){if(!_0x3fb166){_0xc76a7b[_0xbcef('0x22')](0x194);}return _0x3fb166;};}function handleError(_0x4aa557,_0x328ccf){_0x328ccf=_0x328ccf||0x1f4;return function(_0x2feb7f){logger['error'](_0x2feb7f[_0xbcef('0x23')]);if(_0x2feb7f[_0xbcef('0x24')]){delete _0x2feb7f['name'];}_0x4aa557['status'](_0x328ccf)[_0xbcef('0x25')](_0x2feb7f);};}exports[_0xbcef('0x26')]=function(_0x3800fc,_0x1bac61){var _0xdf6a9={},_0x2ee8c8={},_0xb0db40={'count':0x0,'rows':[]};var _0x11d09a=_[_0xbcef('0x27')](db[_0xbcef('0x28')][_0xbcef('0x29')],function(_0x470c7f){return{'name':_0x470c7f['fieldName'],'type':_0x470c7f[_0xbcef('0x2a')][_0xbcef('0x2b')]};});_0x2ee8c8[_0xbcef('0x2c')]=_[_0xbcef('0x27')](_0x11d09a,_0xbcef('0x24'));_0x2ee8c8[_0xbcef('0x2d')]=_[_0xbcef('0x2e')](_0x3800fc[_0xbcef('0x2d')]);_0x2ee8c8[_0xbcef('0x2f')]=_[_0xbcef('0x30')](_0x2ee8c8[_0xbcef('0x2c')],_0x2ee8c8[_0xbcef('0x2d')]);_0xdf6a9['attributes']=_[_0xbcef('0x30')](_0x2ee8c8[_0xbcef('0x2c')],qs[_0xbcef('0x31')](_0x3800fc['query'][_0xbcef('0x31')]));_0xdf6a9[_0xbcef('0x32')]=_0xdf6a9[_0xbcef('0x32')][_0xbcef('0x33')]?_0xdf6a9[_0xbcef('0x32')]:_0x2ee8c8[_0xbcef('0x2c')];if(!_0x3800fc[_0xbcef('0x2d')][_0xbcef('0x34')](_0xbcef('0x35'))){_0xdf6a9[_0xbcef('0x1a')]=qs[_0xbcef('0x1a')](_0x3800fc['query'][_0xbcef('0x1a')]);_0xdf6a9[_0xbcef('0x17')]=qs[_0xbcef('0x17')](_0x3800fc['query'][_0xbcef('0x17')]);}_0xdf6a9[_0xbcef('0x36')]=qs[_0xbcef('0x37')](_0x3800fc['query'][_0xbcef('0x37')]);_0xdf6a9[_0xbcef('0x38')]=qs['filters'](_[_0xbcef('0x39')](_0x3800fc[_0xbcef('0x2d')],_0x2ee8c8[_0xbcef('0x2f')]),_0x11d09a);if(_0x3800fc['query'][_0xbcef('0x3a')]){_0xdf6a9[_0xbcef('0x38')]=_['merge'](_0xdf6a9['where'],{'$or':_[_0xbcef('0x27')](_0x11d09a,function(_0x5b1491){if(_0x5b1491[_0xbcef('0x2a')]!==_0xbcef('0x3b')){var _0x27314b={};_0x27314b[_0x5b1491[_0xbcef('0x24')]]={'$like':'%'+_0x3800fc[_0xbcef('0x2d')][_0xbcef('0x3a')]+'%'};return _0x27314b;}})});}_0xdf6a9=_[_0xbcef('0x3c')]({},_0xdf6a9,_0x3800fc[_0xbcef('0x3d')]);var _0x49911e={'where':_0xdf6a9[_0xbcef('0x38')]};return db['SquareMessage'][_0xbcef('0x19')](_0x49911e)[_0xbcef('0x21')](function(_0x48d302){_0xb0db40['count']=_0x48d302;if(_0x3800fc[_0xbcef('0x2d')][_0xbcef('0x3e')]){_0xdf6a9['include']=[{'all':!![]}];}return db['SquareMessage'][_0xbcef('0x3f')](_0xdf6a9);})[_0xbcef('0x21')](function(_0xb34091){_0xb0db40[_0xbcef('0x40')]=_0xb34091;return _0xb0db40;})[_0xbcef('0x21')](respondWithFilteredResult(_0x1bac61,_0xdf6a9))[_0xbcef('0x41')](handleError(_0x1bac61,null));};exports[_0xbcef('0x42')]=function(_0x36d3ed,_0x5efd2a){var _0x23cb78={'raw':!![],'where':{'id':_0x36d3ed[_0xbcef('0x43')]['id']}},_0x3004b2={};_0x3004b2[_0xbcef('0x2c')]=_[_0xbcef('0x2e')](db[_0xbcef('0x28')]['rawAttributes']);_0x3004b2['query']=_[_0xbcef('0x2e')](_0x36d3ed[_0xbcef('0x2d')]);_0x3004b2[_0xbcef('0x2f')]=_[_0xbcef('0x30')](_0x3004b2['model'],_0x3004b2[_0xbcef('0x2d')]);_0x23cb78[_0xbcef('0x32')]=_[_0xbcef('0x30')](_0x3004b2['model'],qs[_0xbcef('0x31')](_0x36d3ed[_0xbcef('0x2d')][_0xbcef('0x31')]));_0x23cb78[_0xbcef('0x32')]=_0x23cb78[_0xbcef('0x32')][_0xbcef('0x33')]?_0x23cb78[_0xbcef('0x32')]:_0x3004b2[_0xbcef('0x2c')];if(_0x36d3ed['query'][_0xbcef('0x3e')]){_0x23cb78[_0xbcef('0x44')]=[{'all':!![]}];}_0x23cb78=_[_0xbcef('0x3c')]({},_0x23cb78,_0x36d3ed[_0xbcef('0x3d')]);return db['SquareMessage']['find'](_0x23cb78)[_0xbcef('0x21')](handleEntityNotFound(_0x5efd2a,null))[_0xbcef('0x21')](respondWithResult(_0x5efd2a,null))[_0xbcef('0x41')](handleError(_0x5efd2a,null));};exports[_0xbcef('0x45')]=function(_0x1ab3cd,_0x1bbd0b){return db['SquareMessage'][_0xbcef('0x45')](_0x1ab3cd[_0xbcef('0x46')],{})[_0xbcef('0x21')](respondWithResult(_0x1bbd0b,0xc9))[_0xbcef('0x41')](handleError(_0x1bbd0b,null));};exports[_0xbcef('0x1f')]=function(_0xef2480,_0x3ac774){if(_0xef2480[_0xbcef('0x46')]['id']){delete _0xef2480[_0xbcef('0x46')]['id'];}return db['SquareMessage'][_0xbcef('0x47')]({'where':{'id':_0xef2480[_0xbcef('0x43')]['id']}})[_0xbcef('0x21')](handleEntityNotFound(_0x3ac774,null))[_0xbcef('0x21')](saveUpdates(_0xef2480[_0xbcef('0x46')],null))[_0xbcef('0x21')](respondWithResult(_0x3ac774,null))[_0xbcef('0x41')](handleError(_0x3ac774,null));};exports['destroy']=function(_0x4a188b,_0x2de9a4){return db[_0xbcef('0x28')][_0xbcef('0x47')]({'where':{'id':_0x4a188b['params']['id']}})[_0xbcef('0x21')](handleEntityNotFound(_0x2de9a4,null))[_0xbcef('0x21')](removeEntity(_0x2de9a4,null))[_0xbcef('0x41')](handleError(_0x2de9a4,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index ed829be..6bdcbd5 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 _0xf731=['bluebird','request-promise','path','rimraf','./squareMessage.attributes','exports','define','square_messages','util','../../config/logger','api','moment'];(function(_0x41d28b,_0x82a75a){var _0x1c4ed8=function(_0x4027d4){while(--_0x4027d4){_0x41d28b['push'](_0x41d28b['shift']());}};_0x1c4ed8(++_0x82a75a);}(_0xf731,0x110));var _0x1f73=function(_0x1d38a4,_0x2c4098){_0x1d38a4=_0x1d38a4-0x0;var _0x48adf2=_0xf731[_0x1d38a4];return _0x48adf2;};'use strict';var _=require('lodash');var util=require(_0x1f73('0x0'));var logger=require(_0x1f73('0x1'))(_0x1f73('0x2'));var moment=require(_0x1f73('0x3'));var BPromise=require(_0x1f73('0x4'));var rp=require(_0x1f73('0x5'));var fs=require('fs');var path=require(_0x1f73('0x6'));var rimraf=require(_0x1f73('0x7'));var config=require('../../config/environment');var attributes=require(_0x1f73('0x8'));module[_0x1f73('0x9')]=function(_0x34efe8,_0x2fd391){return _0x34efe8[_0x1f73('0xa')]('SquareMessage',attributes,{'tableName':_0x1f73('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8abe=['./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x77e042,_0x51ad9b){var _0x390980=function(_0x37b5c0){while(--_0x37b5c0){_0x77e042['push'](_0x77e042['shift']());}};_0x390980(++_0x51ad9b);}(_0x8abe,0x8c));var _0xe8ab=function(_0x1699e9,_0x1f2652){_0x1699e9=_0x1699e9-0x0;var _0x14b104=_0x8abe[_0x1699e9];return _0x14b104;};'use strict';var _=require(_0xe8ab('0x0'));var util=require(_0xe8ab('0x1'));var logger=require(_0xe8ab('0x2'))(_0xe8ab('0x3'));var moment=require(_0xe8ab('0x4'));var BPromise=require(_0xe8ab('0x5'));var rp=require(_0xe8ab('0x6'));var fs=require('fs');var path=require(_0xe8ab('0x7'));var rimraf=require(_0xe8ab('0x8'));var config=require(_0xe8ab('0x9'));var attributes=require(_0xe8ab('0xa'));module[_0xe8ab('0xb')]=function(_0x129f08,_0x403ce4){return _0x129f08[_0xe8ab('0xc')](_0xe8ab('0xd'),attributes,{'tableName':_0xe8ab('0xe'),'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 5de0eef..2f5cc28 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 _0x0b60=['options','raw','then','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body'];(function(_0x3c6090,_0x3b9c4d){var _0x453a5c=function(_0xf63e8a){while(--_0xf63e8a){_0x3c6090['push'](_0x3c6090['shift']());}};_0x453a5c(++_0x3b9c4d);}(_0x0b60,0x8a));var _0x00b6=function(_0x2493a8,_0x5a240d){_0x2493a8=_0x2493a8-0x0;var _0x2b06c9=_0x0b60[_0x2493a8];return _0x2b06c9;};'use strict';var _=require(_0x00b6('0x0'));var util=require('util');var moment=require(_0x00b6('0x1'));var BPromise=require('bluebird');var rs=require(_0x00b6('0x2'));var fs=require('fs');var Redis=require(_0x00b6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x00b6('0x4'));var logger=require(_0x00b6('0x5'))(_0x00b6('0x6'));var config=require(_0x00b6('0x7'));var jayson=require(_0x00b6('0x8'));var client=jayson['client'][_0x00b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1195f6,_0x1ecfaa,_0x9aa357){return new BPromise(function(_0x4fc6b6,_0x438251){return client['request'](_0x1195f6,_0x9aa357)['then'](function(_0x2eef2d){logger[_0x00b6('0xa')](_0x00b6('0xb'),_0x1ecfaa,_0x00b6('0xc'));logger['debug'](_0x00b6('0xd'),_0x1ecfaa,_0x00b6('0xc'),JSON[_0x00b6('0xe')](_0x2eef2d));if(_0x2eef2d[_0x00b6('0xf')]){if(_0x2eef2d[_0x00b6('0xf')][_0x00b6('0x10')]===0x1f4){logger[_0x00b6('0xf')](_0x00b6('0xb'),_0x1ecfaa,_0x2eef2d[_0x00b6('0xf')]['message']);return _0x438251(_0x2eef2d[_0x00b6('0xf')]['message']);}logger[_0x00b6('0xf')](_0x00b6('0xb'),_0x1ecfaa,_0x2eef2d['error'][_0x00b6('0x11')]);return _0x4fc6b6(_0x2eef2d[_0x00b6('0xf')]['message']);}else{logger[_0x00b6('0xa')](_0x00b6('0xb'),_0x1ecfaa,_0x00b6('0xc'));_0x4fc6b6(_0x2eef2d[_0x00b6('0x12')]['message']);}})[_0x00b6('0x13')](function(_0x546267){logger[_0x00b6('0xf')]('SquareMessage,\x20%s,\x20%s',_0x1ecfaa,_0x546267);_0x438251(_0x546267);});});}exports[_0x00b6('0x14')]=function(_0x2fc17c){var _0x180a74=this;return new Promise(function(_0x485f43,_0x71126d){return db[_0x00b6('0x15')][_0x00b6('0x16')](_0x2fc17c[_0x00b6('0x17')],{'raw':_0x2fc17c[_0x00b6('0x18')]?_0x2fc17c[_0x00b6('0x18')][_0x00b6('0x19')]===undefined?!![]:![]:!![]})[_0x00b6('0x1a')](function(_0x1579f8){logger['info'](_0x00b6('0x14'),_0x2fc17c);logger['debug']('CreateSquareMessage',_0x2fc17c,JSON[_0x00b6('0xe')](_0x1579f8));_0x485f43(_0x1579f8);})['catch'](function(_0x2211fb){logger[_0x00b6('0xf')](_0x00b6('0x14'),_0x2211fb['message'],_0x2fc17c);_0x71126d(_0x180a74[_0x00b6('0xf')](0x1f4,_0x2211fb['message']));});});}; \ No newline at end of file +var _0x6dc9=['body','options','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','SquareMessage,\x20%s,\x20%s','message','catch','CreateSquareMessage','SquareMessage'];(function(_0x514c15,_0x486901){var _0x16283e=function(_0x53b7d0){while(--_0x53b7d0){_0x514c15['push'](_0x514c15['shift']());}};_0x16283e(++_0x486901);}(_0x6dc9,0xb8));var _0x96dc=function(_0x10594a,_0x1c28c3){_0x10594a=_0x10594a-0x0;var _0x31fc67=_0x6dc9[_0x10594a];return _0x31fc67;};'use strict';var _=require(_0x96dc('0x0'));var util=require(_0x96dc('0x1'));var moment=require('moment');var BPromise=require(_0x96dc('0x2'));var rs=require(_0x96dc('0x3'));var fs=require('fs');var Redis=require(_0x96dc('0x4'));var db=require(_0x96dc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x96dc('0x6'))(_0x96dc('0x7'));var config=require(_0x96dc('0x8'));var jayson=require(_0x96dc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a0ee1,_0x538198,_0x1f6a4f){return new BPromise(function(_0x25dd2f,_0x5e8efb){return client[_0x96dc('0xa')](_0x4a0ee1,_0x1f6a4f)[_0x96dc('0xb')](function(_0x80828c){logger[_0x96dc('0xc')]('SquareMessage,\x20%s,\x20%s',_0x538198,_0x96dc('0xd'));logger[_0x96dc('0xe')](_0x96dc('0xf'),_0x538198,_0x96dc('0xd'),JSON[_0x96dc('0x10')](_0x80828c));if(_0x80828c['error']){if(_0x80828c['error'][_0x96dc('0x11')]===0x1f4){logger[_0x96dc('0x12')](_0x96dc('0x13'),_0x538198,_0x80828c[_0x96dc('0x12')][_0x96dc('0x14')]);return _0x5e8efb(_0x80828c[_0x96dc('0x12')][_0x96dc('0x14')]);}logger[_0x96dc('0x12')](_0x96dc('0x13'),_0x538198,_0x80828c[_0x96dc('0x12')]['message']);return _0x25dd2f(_0x80828c[_0x96dc('0x12')][_0x96dc('0x14')]);}else{logger[_0x96dc('0xc')]('SquareMessage,\x20%s,\x20%s',_0x538198,'request\x20sent');_0x25dd2f(_0x80828c['result'][_0x96dc('0x14')]);}})[_0x96dc('0x15')](function(_0x21e610){logger[_0x96dc('0x12')](_0x96dc('0x13'),_0x538198,_0x21e610);_0x5e8efb(_0x21e610);});});}exports[_0x96dc('0x16')]=function(_0x3c7e3c){var _0x1fb0d5=this;return new Promise(function(_0x5c1625,_0x43558a){return db[_0x96dc('0x17')]['create'](_0x3c7e3c[_0x96dc('0x18')],{'raw':_0x3c7e3c[_0x96dc('0x19')]?_0x3c7e3c[_0x96dc('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5d0976){logger[_0x96dc('0xc')](_0x96dc('0x16'),_0x3c7e3c);logger['debug'](_0x96dc('0x16'),_0x3c7e3c,JSON[_0x96dc('0x10')](_0x5d0976));_0x5c1625(_0x5d0976);})[_0x96dc('0x15')](function(_0x34f646){logger[_0x96dc('0x12')](_0x96dc('0x16'),_0x34f646[_0x96dc('0x14')],_0x3c7e3c);_0x43558a(_0x1fb0d5[_0x96dc('0x12')](0x1f4,_0x34f646[_0x96dc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index c81b4cc..414de02 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 _0xeb8e=['express','fs-extra','../../components/auth/service','../../config/environment','get','/:id','show','/:id/test','isAuthenticated','15s','test','post','create','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x2c1aa8,_0x3e0609){var _0x4019f5=function(_0x916eac){while(--_0x916eac){_0x2c1aa8['push'](_0x2c1aa8['shift']());}};_0x4019f5(++_0x3e0609);}(_0xeb8e,0x13c));var _0xeeb8=function(_0x4da2d5,_0x5d9134){_0x4da2d5=_0x4da2d5-0x0;var _0x271b84=_0xeb8e[_0x4da2d5];return _0x271b84;};'use strict';var multer=require(_0xeeb8('0x0'));var util=require(_0xeeb8('0x1'));var path=require(_0xeeb8('0x2'));var timeout=require(_0xeeb8('0x3'));var express=require(_0xeeb8('0x4'));var router=express['Router']();var fs_extra=require(_0xeeb8('0x5'));var auth=require(_0xeeb8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xeeb8('0x7'));var controller=require('./squareOdbc.controller');router[_0xeeb8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xeeb8('0x8')](_0xeeb8('0x9'),auth['isAuthenticated'](),controller[_0xeeb8('0xa')]);router[_0xeeb8('0x8')](_0xeeb8('0xb'),auth[_0xeeb8('0xc')](),timeout(_0xeeb8('0xd')),controller[_0xeeb8('0xe')]);router[_0xeeb8('0xf')]('/',auth[_0xeeb8('0xc')](),controller[_0xeeb8('0x10')]);router['put']('/:id',auth[_0xeeb8('0xc')](),controller[_0xeeb8('0x11')]);router[_0xeeb8('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xeeb8('0x13')]);module['exports']=router; \ No newline at end of file +var _0x5228=['show','/:id/test','15s','test','post','create','update','delete','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','/:id','isAuthenticated'];(function(_0x4b91c4,_0x23f35f){var _0x25cb80=function(_0x48e283){while(--_0x48e283){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x25cb80(++_0x23f35f);}(_0x5228,0x1e8));var _0x8522=function(_0xe62b7d,_0xa73624){_0xe62b7d=_0xe62b7d-0x0;var _0x237c1e=_0x5228[_0xe62b7d];return _0x237c1e;};'use strict';var multer=require('multer');var util=require(_0x8522('0x0'));var path=require(_0x8522('0x1'));var timeout=require(_0x8522('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8522('0x3'));var auth=require(_0x8522('0x4'));var interaction=require(_0x8522('0x5'));var config=require(_0x8522('0x6'));var controller=require(_0x8522('0x7'));router[_0x8522('0x8')]('/',auth['isAuthenticated'](),controller[_0x8522('0x9')]);router[_0x8522('0x8')](_0x8522('0xa'),auth[_0x8522('0xb')](),controller[_0x8522('0xc')]);router[_0x8522('0x8')](_0x8522('0xd'),auth[_0x8522('0xb')](),timeout(_0x8522('0xe')),controller[_0x8522('0xf')]);router[_0x8522('0x10')]('/',auth[_0x8522('0xb')](),controller[_0x8522('0x11')]);router['put'](_0x8522('0xa'),auth[_0x8522('0xb')](),controller[_0x8522('0x12')]);router[_0x8522('0x13')](_0x8522('0xa'),auth[_0x8522('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 1bb457c..517f53b 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 _0x7574=['exports','STRING','name','sequelize'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x7574,0xe3));var _0x4757=function(_0x365412,_0x33857d){_0x365412=_0x365412-0x0;var _0x22d884=_0x7574[_0x365412];return _0x22d884;};'use strict';var Sequelize=require(_0x4757('0x0'));module[_0x4757('0x1')]={'name':{'type':Sequelize[_0x4757('0x2')],'unique':_0x4757('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x4757('0x2')]},'description':{'type':Sequelize[_0x4757('0x2')]}}; \ No newline at end of file +var _0x3487=['sequelize','exports','STRING'];(function(_0x8ebd1d,_0x36838e){var _0xa907fb=function(_0x533fbd){while(--_0x533fbd){_0x8ebd1d['push'](_0x8ebd1d['shift']());}};_0xa907fb(++_0x36838e);}(_0x3487,0xd8));var _0x7348=function(_0x1faaa1,_0x1568dd){_0x1faaa1=_0x1faaa1-0x0;var _0x994ec=_0x3487[_0x1faaa1];return _0x994ec;};'use strict';var Sequelize=require(_0x7348('0x0'));module[_0x7348('0x1')]={'name':{'type':Sequelize[_0x7348('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x7348('0x2')]},'description':{'type':Sequelize[_0x7348('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index db3ca3e..50d8eb3 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 _0x0a73=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','dsn','odbc','openSync','closeSync','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','get','ODBC','UserProfileResource','destroy','error','stack','send','map','SquareOdbc','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','name','merge','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection'];(function(_0x18f0e6,_0x1a6ffe){var _0x343865=function(_0x1b89d6){while(--_0x1b89d6){_0x18f0e6['push'](_0x18f0e6['shift']());}};_0x343865(++_0x1a6ffe);}(_0x0a73,0x114));var _0x30a7=function(_0x109371,_0x441c8e){_0x109371=_0x109371-0x0;var _0x4fd858=_0x0a73[_0x109371];return _0x4fd858;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x30a7('0x0'));var zipdir=require(_0x30a7('0x1'));var jsonpatch=require(_0x30a7('0x2'));var rp=require('request-promise');var moment=require(_0x30a7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x30a7('0x4'));var path=require(_0x30a7('0x5'));var sox=require(_0x30a7('0x6'));var csv=require(_0x30a7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x30a7('0x8'));var squel=require('squel');var crypto=require(_0x30a7('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x30a7('0xa'));var toCsv=require(_0x30a7('0x7'));var querystring=require(_0x30a7('0xb'));var Papa=require(_0x30a7('0xc'));var Redis=require(_0x30a7('0xd'));var authService=require(_0x30a7('0xe'));var qs=require(_0x30a7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x30a7('0x10'));var logger=require(_0x30a7('0x11'))(_0x30a7('0x12'));var utils=require(_0x30a7('0x13'));var config=require(_0x30a7('0x14'));var licenseUtil=require(_0x30a7('0x15'));var db=require(_0x30a7('0x16'))['db'];function respondWithStatusCode(_0x16d7df,_0xc0e349){_0xc0e349=_0xc0e349||0xcc;return function(_0x7dc647){if(_0x7dc647){return _0x16d7df[_0x30a7('0x17')](_0xc0e349);}return _0x16d7df[_0x30a7('0x18')](_0xc0e349)[_0x30a7('0x19')]();};}function respondWithResult(_0x548ab8,_0x46bd3a){_0x46bd3a=_0x46bd3a||0xc8;return function(_0x2f107a){if(_0x2f107a){return _0x548ab8[_0x30a7('0x18')](_0x46bd3a)[_0x30a7('0x1a')](_0x2f107a);}};}function respondWithFilteredResult(_0x8a874,_0x8d9236){return function(_0x3f404d){if(_0x3f404d){var _0x5e1919=typeof _0x8d9236[_0x30a7('0x1b')]===_0x30a7('0x1c')&&typeof _0x8d9236['limit']===_0x30a7('0x1c');var _0x1d9cbb=_0x3f404d[_0x30a7('0x1d')];var _0x444aae=_0x5e1919?0x0:_0x8d9236['offset'];var _0x26ef89=_0x5e1919?_0x3f404d[_0x30a7('0x1d')]:_0x8d9236[_0x30a7('0x1b')]+_0x8d9236[_0x30a7('0x1e')];var _0x3793cf;if(_0x26ef89>=_0x1d9cbb){_0x26ef89=_0x1d9cbb;_0x3793cf=0xc8;}else{_0x3793cf=0xce;}_0x8a874[_0x30a7('0x18')](_0x3793cf);return _0x8a874[_0x30a7('0x1f')](_0x30a7('0x20'),_0x444aae+'-'+_0x26ef89+'/'+_0x1d9cbb)[_0x30a7('0x1a')](_0x3f404d);}return null;};}function patchUpdates(_0x2d2b8d){return function(_0x55034f){try{jsonpatch[_0x30a7('0x21')](_0x55034f,_0x2d2b8d,!![]);}catch(_0x18c6ad){return BPromise[_0x30a7('0x22')](_0x18c6ad);}return _0x55034f[_0x30a7('0x23')]();};}function saveUpdates(_0x4999b6,_0x40c643){return function(_0x2d1aef){if(_0x2d1aef){return _0x2d1aef['update'](_0x4999b6)[_0x30a7('0x24')](function(_0x2986fc){return _0x2986fc;});}return null;};}function removeEntity(_0xa2e3de,_0x33677){return function(_0x47a056){if(_0x47a056){return _0x47a056['destroy']()[_0x30a7('0x24')](function(){var _0x5b1fa3=_0x47a056[_0x30a7('0x25')]({'plain':!![]});var _0x1eb83c=_0x30a7('0x26');return db[_0x30a7('0x27')][_0x30a7('0x28')]({'where':{'type':_0x1eb83c,'resourceId':_0x5b1fa3['id']}})['then'](function(){return _0x47a056;});})['then'](function(){_0xa2e3de[_0x30a7('0x18')](0xcc)[_0x30a7('0x19')]();});}};}function handleEntityNotFound(_0x2a302f,_0x1c3049){return function(_0x1559ce){if(!_0x1559ce){_0x2a302f[_0x30a7('0x17')](0x194);}return _0x1559ce;};}function handleError(_0x4bf4d2,_0x32baef){_0x32baef=_0x32baef||0x1f4;return function(_0xfa995){logger[_0x30a7('0x29')](_0xfa995[_0x30a7('0x2a')]);if(_0xfa995['name']){delete _0xfa995['name'];}_0x4bf4d2[_0x30a7('0x18')](_0x32baef)[_0x30a7('0x2b')](_0xfa995);};}exports['index']=function(_0x52c40b,_0x3cf95a){var _0x14b12c={},_0x2ad2de={},_0x24acfa={'count':0x0,'rows':[]};var _0x26235a=_[_0x30a7('0x2c')](db[_0x30a7('0x2d')][_0x30a7('0x2e')],function(_0x522949){return{'name':_0x522949[_0x30a7('0x2f')],'type':_0x522949[_0x30a7('0x30')][_0x30a7('0x31')]};});_0x2ad2de['model']=_[_0x30a7('0x2c')](_0x26235a,'name');_0x2ad2de['query']=_['keys'](_0x52c40b[_0x30a7('0x32')]);_0x2ad2de['filters']=_[_0x30a7('0x33')](_0x2ad2de[_0x30a7('0x34')],_0x2ad2de[_0x30a7('0x32')]);_0x14b12c[_0x30a7('0x35')]=_[_0x30a7('0x33')](_0x2ad2de[_0x30a7('0x34')],qs[_0x30a7('0x36')](_0x52c40b['query']['fields']));_0x14b12c[_0x30a7('0x35')]=_0x14b12c['attributes']['length']?_0x14b12c[_0x30a7('0x35')]:_0x2ad2de[_0x30a7('0x34')];if(!_0x52c40b[_0x30a7('0x32')][_0x30a7('0x37')](_0x30a7('0x38'))){_0x14b12c[_0x30a7('0x1e')]=qs['limit'](_0x52c40b[_0x30a7('0x32')][_0x30a7('0x1e')]);_0x14b12c[_0x30a7('0x1b')]=qs[_0x30a7('0x1b')](_0x52c40b[_0x30a7('0x32')]['offset']);}_0x14b12c['order']=qs[_0x30a7('0x39')](_0x52c40b[_0x30a7('0x32')][_0x30a7('0x39')]);_0x14b12c[_0x30a7('0x3a')]=qs[_0x30a7('0x3b')](_[_0x30a7('0x3c')](_0x52c40b[_0x30a7('0x32')],_0x2ad2de['filters']),_0x26235a);if(_0x52c40b['query'][_0x30a7('0x3d')]){_0x14b12c[_0x30a7('0x3a')]=_['merge'](_0x14b12c[_0x30a7('0x3a')],{'$or':_[_0x30a7('0x2c')](_0x26235a,function(_0x3d4d1c){if(_0x3d4d1c[_0x30a7('0x30')]!==_0x30a7('0x3e')){var _0x13aa45={};_0x13aa45[_0x3d4d1c[_0x30a7('0x3f')]]={'$like':'%'+_0x52c40b[_0x30a7('0x32')][_0x30a7('0x3d')]+'%'};return _0x13aa45;}})});}_0x14b12c=_[_0x30a7('0x40')]({},_0x14b12c,_0x52c40b[_0x30a7('0x41')]);var _0x160373={'where':_0x14b12c[_0x30a7('0x3a')]};return db[_0x30a7('0x2d')][_0x30a7('0x1d')](_0x160373)['then'](function(_0x340fdc){_0x24acfa[_0x30a7('0x1d')]=_0x340fdc;if(_0x52c40b[_0x30a7('0x32')][_0x30a7('0x42')]){_0x14b12c[_0x30a7('0x43')]=[{'all':!![]}];}return db[_0x30a7('0x2d')][_0x30a7('0x44')](_0x14b12c);})[_0x30a7('0x24')](function(_0xd760ff){_0x24acfa[_0x30a7('0x45')]=_0xd760ff;return _0x24acfa;})[_0x30a7('0x24')](respondWithFilteredResult(_0x3cf95a,_0x14b12c))[_0x30a7('0x46')](handleError(_0x3cf95a,null));};exports[_0x30a7('0x47')]=function(_0x4a3c7b,_0x245a33){var _0x1f76d9={'raw':!![],'where':{'id':_0x4a3c7b['params']['id']}},_0x27f324={};_0x27f324[_0x30a7('0x34')]=_[_0x30a7('0x48')](db['SquareOdbc'][_0x30a7('0x2e')]);_0x27f324['query']=_[_0x30a7('0x48')](_0x4a3c7b['query']);_0x27f324[_0x30a7('0x3b')]=_[_0x30a7('0x33')](_0x27f324['model'],_0x27f324[_0x30a7('0x32')]);_0x1f76d9[_0x30a7('0x35')]=_[_0x30a7('0x33')](_0x27f324[_0x30a7('0x34')],qs[_0x30a7('0x36')](_0x4a3c7b[_0x30a7('0x32')]['fields']));_0x1f76d9['attributes']=_0x1f76d9[_0x30a7('0x35')][_0x30a7('0x49')]?_0x1f76d9['attributes']:_0x27f324[_0x30a7('0x34')];if(_0x4a3c7b[_0x30a7('0x32')][_0x30a7('0x42')]){_0x1f76d9[_0x30a7('0x43')]=[{'all':!![]}];}_0x1f76d9=_[_0x30a7('0x40')]({},_0x1f76d9,_0x4a3c7b[_0x30a7('0x41')]);return db[_0x30a7('0x2d')][_0x30a7('0x4a')](_0x1f76d9)[_0x30a7('0x24')](handleEntityNotFound(_0x245a33,null))[_0x30a7('0x24')](respondWithResult(_0x245a33,null))[_0x30a7('0x46')](handleError(_0x245a33,null));};exports[_0x30a7('0x4b')]=function(_0x37be7a,_0x3aed6f){return db[_0x30a7('0x2d')][_0x30a7('0x4b')](_0x37be7a[_0x30a7('0x4c')],{})[_0x30a7('0x24')](function(_0x67bfe1){var _0x430d43=_0x37be7a[_0x30a7('0x4d')][_0x30a7('0x25')]({'plain':!![]});if(!_0x430d43)throw new Error(_0x30a7('0x4e'));if(_0x430d43['role']===_0x30a7('0x4d')){var _0x574ef7=_0x67bfe1['get']({'plain':!![]});var _0x57d35a=_0x30a7('0x26');return db[_0x30a7('0x4f')][_0x30a7('0x4a')]({'where':{'name':_0x57d35a,'userProfileId':_0x430d43[_0x30a7('0x50')]},'raw':!![]})[_0x30a7('0x24')](function(_0x1c2e9f){if(_0x1c2e9f&&_0x1c2e9f[_0x30a7('0x51')]===0x0){return db[_0x30a7('0x27')][_0x30a7('0x4b')]({'name':_0x574ef7[_0x30a7('0x3f')],'resourceId':_0x574ef7['id'],'type':_0x1c2e9f['name'],'sectionId':_0x1c2e9f['id']},{})[_0x30a7('0x24')](function(){return _0x67bfe1;});}else{return _0x67bfe1;}})[_0x30a7('0x46')](function(_0x336504){logger['error'](_0x30a7('0x52'),_0x336504);throw _0x336504;});}return _0x67bfe1;})[_0x30a7('0x24')](respondWithResult(_0x3aed6f,0xc9))[_0x30a7('0x46')](handleError(_0x3aed6f,null));};exports[_0x30a7('0x53')]=function(_0x182c01,_0x1d1ff6){if(_0x182c01[_0x30a7('0x4c')]['id']){delete _0x182c01[_0x30a7('0x4c')]['id'];}return db[_0x30a7('0x2d')]['find']({'where':{'id':_0x182c01[_0x30a7('0x54')]['id']}})[_0x30a7('0x24')](handleEntityNotFound(_0x1d1ff6,null))[_0x30a7('0x24')](saveUpdates(_0x182c01[_0x30a7('0x4c')],null))['then'](respondWithResult(_0x1d1ff6,null))['catch'](handleError(_0x1d1ff6,null));};exports[_0x30a7('0x28')]=function(_0x45c39b,_0x537224){return db[_0x30a7('0x2d')][_0x30a7('0x4a')]({'where':{'id':_0x45c39b[_0x30a7('0x54')]['id']}})['then'](handleEntityNotFound(_0x537224,null))[_0x30a7('0x24')](removeEntity(_0x537224,null))[_0x30a7('0x46')](handleError(_0x537224,null));};exports['test']=function(_0x3e43ad,_0x5a75cc,_0x28d472){var _0x371cfc;return db['SquareOdbc'][_0x30a7('0x4a')]({'where':{'id':_0x3e43ad['params']['id']},'attributes':['id',_0x30a7('0x55')]})[_0x30a7('0x24')](handleEntityNotFound(_0x5a75cc,null))['then'](function(_0x30eed9){if(_0x30eed9){var _0x55ff5d=require(_0x30a7('0x56'))();_0x55ff5d[_0x30a7('0x57')](_0x30eed9[_0x30a7('0x55')]);_0x55ff5d[_0x30a7('0x58')]();return _0x30eed9;}})[_0x30a7('0x24')](respondWithResult(_0x5a75cc,null))[_0x30a7('0x46')](handleError(_0x5a75cc,null));}; \ No newline at end of file +var _0x830f=['query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','openSync','closeSync','eml-format','fast-json-patch','moment','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','ODBC','UserProfileResource','sendStatus','error','stack','name','send','index','map','SquareOdbc','rawAttributes','type','key','model'];(function(_0x1c34e7,_0x33f9a8){var _0x378cb1=function(_0x10b5e3){while(--_0x10b5e3){_0x1c34e7['push'](_0x1c34e7['shift']());}};_0x378cb1(++_0x33f9a8);}(_0x830f,0x180));var _0xf830=function(_0x294b82,_0x3973c6){_0x294b82=_0x294b82-0x0;var _0x4b2e23=_0x830f[_0x294b82];return _0x4b2e23;};'use strict';var emlformat=require(_0xf830('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf830('0x1'));var rp=require('request-promise');var moment=require(_0xf830('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf830('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf830('0x4'));var fs=require('fs');var fs_extra=require(_0xf830('0x5'));var _=require(_0xf830('0x6'));var squel=require(_0xf830('0x7'));var crypto=require(_0xf830('0x8'));var jsforce=require(_0xf830('0x9'));var deskjs=require(_0xf830('0xa'));var toCsv=require(_0xf830('0xb'));var querystring=require(_0xf830('0xc'));var Papa=require('papaparse');var Redis=require(_0xf830('0xd'));var authService=require(_0xf830('0xe'));var qs=require(_0xf830('0xf'));var as=require(_0xf830('0x10'));var hardwareService=require(_0xf830('0x11'));var logger=require(_0xf830('0x12'))(_0xf830('0x13'));var utils=require('../../config/utils');var config=require(_0xf830('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf830('0x15'))['db'];function respondWithStatusCode(_0x9bf1c0,_0x50b690){_0x50b690=_0x50b690||0xcc;return function(_0x5db211){if(_0x5db211){return _0x9bf1c0['sendStatus'](_0x50b690);}return _0x9bf1c0[_0xf830('0x16')](_0x50b690)[_0xf830('0x17')]();};}function respondWithResult(_0x156e48,_0x352337){_0x352337=_0x352337||0xc8;return function(_0x282098){if(_0x282098){return _0x156e48[_0xf830('0x16')](_0x352337)[_0xf830('0x18')](_0x282098);}};}function respondWithFilteredResult(_0x1f8f92,_0x486cc3){return function(_0x1857c6){if(_0x1857c6){var _0x28bed9=typeof _0x486cc3[_0xf830('0x19')]===_0xf830('0x1a')&&typeof _0x486cc3[_0xf830('0x1b')]===_0xf830('0x1a');var _0x3168da=_0x1857c6[_0xf830('0x1c')];var _0x53172b=_0x28bed9?0x0:_0x486cc3['offset'];var _0x229ae8=_0x28bed9?_0x1857c6['count']:_0x486cc3[_0xf830('0x19')]+_0x486cc3['limit'];var _0x15202a;if(_0x229ae8>=_0x3168da){_0x229ae8=_0x3168da;_0x15202a=0xc8;}else{_0x15202a=0xce;}_0x1f8f92[_0xf830('0x16')](_0x15202a);return _0x1f8f92[_0xf830('0x1d')](_0xf830('0x1e'),_0x53172b+'-'+_0x229ae8+'/'+_0x3168da)['json'](_0x1857c6);}return null;};}function patchUpdates(_0x2fd676){return function(_0xbbb050){try{jsonpatch['apply'](_0xbbb050,_0x2fd676,!![]);}catch(_0xbcf970){return BPromise[_0xf830('0x1f')](_0xbcf970);}return _0xbbb050[_0xf830('0x20')]();};}function saveUpdates(_0x25ebdc,_0xa78209){return function(_0x148d54){if(_0x148d54){return _0x148d54[_0xf830('0x21')](_0x25ebdc)[_0xf830('0x22')](function(_0x1c70ad){return _0x1c70ad;});}return null;};}function removeEntity(_0x43c458,_0x1ae746){return function(_0x53a8b4){if(_0x53a8b4){return _0x53a8b4[_0xf830('0x23')]()[_0xf830('0x22')](function(){var _0x52da07=_0x53a8b4[_0xf830('0x24')]({'plain':!![]});var _0x123aa5=_0xf830('0x25');return db[_0xf830('0x26')][_0xf830('0x23')]({'where':{'type':_0x123aa5,'resourceId':_0x52da07['id']}})[_0xf830('0x22')](function(){return _0x53a8b4;});})['then'](function(){_0x43c458[_0xf830('0x16')](0xcc)[_0xf830('0x17')]();});}};}function handleEntityNotFound(_0xcc69e7,_0x28b9c5){return function(_0x205ddd){if(!_0x205ddd){_0xcc69e7[_0xf830('0x27')](0x194);}return _0x205ddd;};}function handleError(_0xfe3ac0,_0x3d9227){_0x3d9227=_0x3d9227||0x1f4;return function(_0x117f45){logger[_0xf830('0x28')](_0x117f45[_0xf830('0x29')]);if(_0x117f45['name']){delete _0x117f45[_0xf830('0x2a')];}_0xfe3ac0[_0xf830('0x16')](_0x3d9227)[_0xf830('0x2b')](_0x117f45);};}exports[_0xf830('0x2c')]=function(_0x1be129,_0x70653d){var _0x846929={},_0x88466b={},_0x475cc9={'count':0x0,'rows':[]};var _0x30ed32=_[_0xf830('0x2d')](db[_0xf830('0x2e')][_0xf830('0x2f')],function(_0x246dbc){return{'name':_0x246dbc['fieldName'],'type':_0x246dbc[_0xf830('0x30')][_0xf830('0x31')]};});_0x88466b[_0xf830('0x32')]=_[_0xf830('0x2d')](_0x30ed32,_0xf830('0x2a'));_0x88466b[_0xf830('0x33')]=_[_0xf830('0x34')](_0x1be129['query']);_0x88466b[_0xf830('0x35')]=_['intersection'](_0x88466b['model'],_0x88466b[_0xf830('0x33')]);_0x846929[_0xf830('0x36')]=_[_0xf830('0x37')](_0x88466b[_0xf830('0x32')],qs[_0xf830('0x38')](_0x1be129['query'][_0xf830('0x38')]));_0x846929[_0xf830('0x36')]=_0x846929[_0xf830('0x36')][_0xf830('0x39')]?_0x846929['attributes']:_0x88466b[_0xf830('0x32')];if(!_0x1be129[_0xf830('0x33')][_0xf830('0x3a')](_0xf830('0x3b'))){_0x846929[_0xf830('0x1b')]=qs[_0xf830('0x1b')](_0x1be129['query'][_0xf830('0x1b')]);_0x846929[_0xf830('0x19')]=qs[_0xf830('0x19')](_0x1be129[_0xf830('0x33')][_0xf830('0x19')]);}_0x846929['order']=qs['sort'](_0x1be129['query'][_0xf830('0x3c')]);_0x846929['where']=qs[_0xf830('0x35')](_[_0xf830('0x3d')](_0x1be129[_0xf830('0x33')],_0x88466b[_0xf830('0x35')]),_0x30ed32);if(_0x1be129[_0xf830('0x33')][_0xf830('0x3e')]){_0x846929[_0xf830('0x3f')]=_[_0xf830('0x40')](_0x846929['where'],{'$or':_[_0xf830('0x2d')](_0x30ed32,function(_0x184f29){if(_0x184f29[_0xf830('0x30')]!=='VIRTUAL'){var _0x103195={};_0x103195[_0x184f29[_0xf830('0x2a')]]={'$like':'%'+_0x1be129[_0xf830('0x33')]['filter']+'%'};return _0x103195;}})});}_0x846929=_[_0xf830('0x40')]({},_0x846929,_0x1be129[_0xf830('0x41')]);var _0x1e2392={'where':_0x846929[_0xf830('0x3f')]};return db['SquareOdbc'][_0xf830('0x1c')](_0x1e2392)['then'](function(_0x1958ce){_0x475cc9['count']=_0x1958ce;if(_0x1be129[_0xf830('0x33')][_0xf830('0x42')]){_0x846929[_0xf830('0x43')]=[{'all':!![]}];}return db[_0xf830('0x2e')][_0xf830('0x44')](_0x846929);})[_0xf830('0x22')](function(_0x1e8815){_0x475cc9[_0xf830('0x45')]=_0x1e8815;return _0x475cc9;})[_0xf830('0x22')](respondWithFilteredResult(_0x70653d,_0x846929))[_0xf830('0x46')](handleError(_0x70653d,null));};exports[_0xf830('0x47')]=function(_0x56b104,_0x3b3e72){var _0x3e7594={'raw':!![],'where':{'id':_0x56b104[_0xf830('0x48')]['id']}},_0x1f065c={};_0x1f065c[_0xf830('0x32')]=_[_0xf830('0x34')](db['SquareOdbc'][_0xf830('0x2f')]);_0x1f065c[_0xf830('0x33')]=_['keys'](_0x56b104['query']);_0x1f065c['filters']=_[_0xf830('0x37')](_0x1f065c['model'],_0x1f065c[_0xf830('0x33')]);_0x3e7594[_0xf830('0x36')]=_['intersection'](_0x1f065c['model'],qs['fields'](_0x56b104[_0xf830('0x33')]['fields']));_0x3e7594[_0xf830('0x36')]=_0x3e7594[_0xf830('0x36')][_0xf830('0x39')]?_0x3e7594[_0xf830('0x36')]:_0x1f065c['model'];if(_0x56b104['query'][_0xf830('0x42')]){_0x3e7594[_0xf830('0x43')]=[{'all':!![]}];}_0x3e7594=_['merge']({},_0x3e7594,_0x56b104[_0xf830('0x41')]);return db[_0xf830('0x2e')]['find'](_0x3e7594)[_0xf830('0x22')](handleEntityNotFound(_0x3b3e72,null))[_0xf830('0x22')](respondWithResult(_0x3b3e72,null))['catch'](handleError(_0x3b3e72,null));};exports[_0xf830('0x49')]=function(_0x9ee92,_0x5abdea){return db[_0xf830('0x2e')]['create'](_0x9ee92[_0xf830('0x4a')],{})[_0xf830('0x22')](function(_0x4045b2){var _0x27a21f=_0x9ee92['user'][_0xf830('0x24')]({'plain':!![]});if(!_0x27a21f)throw new Error(_0xf830('0x4b'));if(_0x27a21f[_0xf830('0x4c')]===_0xf830('0x4d')){var _0xad1a19=_0x4045b2[_0xf830('0x24')]({'plain':!![]});var _0x49a94a=_0xf830('0x25');return db[_0xf830('0x4e')][_0xf830('0x4f')]({'where':{'name':_0x49a94a,'userProfileId':_0x27a21f[_0xf830('0x50')]},'raw':!![]})[_0xf830('0x22')](function(_0x4151eb){if(_0x4151eb&&_0x4151eb[_0xf830('0x51')]===0x0){return db[_0xf830('0x26')]['create']({'name':_0xad1a19[_0xf830('0x2a')],'resourceId':_0xad1a19['id'],'type':_0x4151eb[_0xf830('0x2a')],'sectionId':_0x4151eb['id']},{})[_0xf830('0x22')](function(){return _0x4045b2;});}else{return _0x4045b2;}})[_0xf830('0x46')](function(_0x4c879a){logger[_0xf830('0x28')](_0xf830('0x52'),_0x4c879a);throw _0x4c879a;});}return _0x4045b2;})[_0xf830('0x22')](respondWithResult(_0x5abdea,0xc9))[_0xf830('0x46')](handleError(_0x5abdea,null));};exports['update']=function(_0x147981,_0x1df7ba){if(_0x147981[_0xf830('0x4a')]['id']){delete _0x147981['body']['id'];}return db[_0xf830('0x2e')]['find']({'where':{'id':_0x147981[_0xf830('0x48')]['id']}})[_0xf830('0x22')](handleEntityNotFound(_0x1df7ba,null))['then'](saveUpdates(_0x147981[_0xf830('0x4a')],null))[_0xf830('0x22')](respondWithResult(_0x1df7ba,null))['catch'](handleError(_0x1df7ba,null));};exports[_0xf830('0x23')]=function(_0x25f04c,_0xd0d4e9){return db[_0xf830('0x2e')]['find']({'where':{'id':_0x25f04c['params']['id']}})[_0xf830('0x22')](handleEntityNotFound(_0xd0d4e9,null))[_0xf830('0x22')](removeEntity(_0xd0d4e9,null))['catch'](handleError(_0xd0d4e9,null));};exports[_0xf830('0x53')]=function(_0x5ca0cd,_0x10fb32,_0x34e4fc){var _0x54e45e;return db[_0xf830('0x2e')][_0xf830('0x4f')]({'where':{'id':_0x5ca0cd[_0xf830('0x48')]['id']},'attributes':['id',_0xf830('0x54')]})['then'](handleEntityNotFound(_0x10fb32,null))[_0xf830('0x22')](function(_0x4e408a){if(_0x4e408a){var _0x35a815=require('odbc')();_0x35a815[_0xf830('0x55')](_0x4e408a[_0xf830('0x54')]);_0x35a815[_0xf830('0x56')]();return _0x4e408a;}})[_0xf830('0x22')](respondWithResult(_0x10fb32,null))[_0xf830('0x46')](handleError(_0x10fb32,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 43d7193..16706e3 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 _0xba35=['../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0xba35,0x191));var _0x5ba3=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xba35[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require(_0x5ba3('0x0'));var logger=require(_0x5ba3('0x1'))('api');var moment=require(_0x5ba3('0x2'));var BPromise=require(_0x5ba3('0x3'));var rp=require(_0x5ba3('0x4'));var fs=require('fs');var path=require(_0x5ba3('0x5'));var rimraf=require(_0x5ba3('0x6'));var config=require(_0x5ba3('0x7'));var attributes=require(_0x5ba3('0x8'));module[_0x5ba3('0x9')]=function(_0xab4eeb,_0x4378e0){return _0xab4eeb[_0x5ba3('0xa')](_0x5ba3('0xb'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1341=['path','define','SquareOdbc','square_odbc','util','../../config/logger','api','bluebird','request-promise'];(function(_0x208f77,_0x4ae8a3){var _0x4f9f18=function(_0x2ea4ca){while(--_0x2ea4ca){_0x208f77['push'](_0x208f77['shift']());}};_0x4f9f18(++_0x4ae8a3);}(_0x1341,0x1cf));var _0x1134=function(_0x58e681,_0xa5c6e5){_0x58e681=_0x58e681-0x0;var _0x3e519b=_0x1341[_0x58e681];return _0x3e519b;};'use strict';var _=require('lodash');var util=require(_0x1134('0x0'));var logger=require(_0x1134('0x1'))(_0x1134('0x2'));var moment=require('moment');var BPromise=require(_0x1134('0x3'));var rp=require(_0x1134('0x4'));var fs=require('fs');var path=require(_0x1134('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module['exports']=function(_0x24c3a9,_0x5626a0){return _0x24c3a9[_0x1134('0x6')](_0x1134('0x7'),attributes,{'tableName':_0x1134('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 3448220..dbc0fa4 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 _0xa712=['raw','attributes','include','map','model','ShowSquareOdbc','debug','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options'];(function(_0x1fe53d,_0x12c535){var _0x214bf9=function(_0x5943dd){while(--_0x5943dd){_0x1fe53d['push'](_0x1fe53d['shift']());}};_0x214bf9(++_0x12c535);}(_0xa712,0xd9));var _0x2a71=function(_0x11155f,_0x57b687){_0x11155f=_0x11155f-0x0;var _0xd07e48=_0xa712[_0x11155f];return _0xd07e48;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2a71('0x0'));var BPromise=require('bluebird');var rs=require(_0x2a71('0x1'));var fs=require('fs');var Redis=require(_0x2a71('0x2'));var db=require(_0x2a71('0x3'))['db'];var utils=require(_0x2a71('0x4'));var logger=require(_0x2a71('0x5'))(_0x2a71('0x6'));var config=require(_0x2a71('0x7'));var jayson=require(_0x2a71('0x8'));var client=jayson[_0x2a71('0x9')][_0x2a71('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5eb979,_0x195efb,_0x675d8f){return new BPromise(function(_0x20862c,_0x51247e){return client['request'](_0x5eb979,_0x675d8f)[_0x2a71('0xb')](function(_0x1ea35b){logger[_0x2a71('0xc')](_0x2a71('0xd'),_0x195efb,_0x2a71('0xe'));logger['debug'](_0x2a71('0xf'),_0x195efb,_0x2a71('0xe'),JSON[_0x2a71('0x10')](_0x1ea35b));if(_0x1ea35b[_0x2a71('0x11')]){if(_0x1ea35b[_0x2a71('0x11')][_0x2a71('0x12')]===0x1f4){logger[_0x2a71('0x11')](_0x2a71('0xd'),_0x195efb,_0x1ea35b[_0x2a71('0x11')][_0x2a71('0x13')]);return _0x51247e(_0x1ea35b[_0x2a71('0x11')][_0x2a71('0x13')]);}logger['error'](_0x2a71('0xd'),_0x195efb,_0x1ea35b['error'][_0x2a71('0x13')]);return _0x20862c(_0x1ea35b[_0x2a71('0x11')]['message']);}else{logger[_0x2a71('0xc')](_0x2a71('0xd'),_0x195efb,_0x2a71('0xe'));_0x20862c(_0x1ea35b[_0x2a71('0x14')]['message']);}})[_0x2a71('0x15')](function(_0x198d07){logger[_0x2a71('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x195efb,_0x198d07);_0x51247e(_0x198d07);});});}exports['ShowSquareOdbc']=function(_0x2ae5b2){var _0xbc9a6d=this;return new Promise(function(_0x4f793f,_0x42dda0){return db['SquareOdbc']['find']({'raw':_0x2ae5b2[_0x2a71('0x16')]?_0x2ae5b2[_0x2a71('0x16')][_0x2a71('0x17')]===undefined?!![]:![]:!![],'where':_0x2ae5b2[_0x2a71('0x16')]?_0x2ae5b2[_0x2a71('0x16')]['where']||null:null,'attributes':_0x2ae5b2[_0x2a71('0x16')]?_0x2ae5b2[_0x2a71('0x16')][_0x2a71('0x18')]||null:null,'include':_0x2ae5b2[_0x2a71('0x16')]?_0x2ae5b2[_0x2a71('0x16')][_0x2a71('0x19')]?_[_0x2a71('0x1a')](_0x2ae5b2[_0x2a71('0x16')][_0x2a71('0x19')],function(_0x1c6eff){return{'model':db[_0x1c6eff[_0x2a71('0x1b')]],'as':_0x1c6eff['as'],'attributes':_0x1c6eff[_0x2a71('0x18')],'include':_0x1c6eff[_0x2a71('0x19')]?_[_0x2a71('0x1a')](_0x1c6eff[_0x2a71('0x19')],function(_0x56e940){return{'model':db[_0x56e940[_0x2a71('0x1b')]],'as':_0x56e940['as'],'attributes':_0x56e940['attributes'],'include':_0x56e940[_0x2a71('0x19')]?_['map'](_0x56e940[_0x2a71('0x19')],function(_0x4981a2){return{'model':db[_0x4981a2[_0x2a71('0x1b')]],'as':_0x4981a2['as'],'attributes':_0x4981a2[_0x2a71('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2a71('0xb')](function(_0x3d4378){logger['info'](_0x2a71('0x1c'),_0x2ae5b2);logger[_0x2a71('0x1d')](_0x2a71('0x1c'),_0x2ae5b2,JSON['stringify'](_0x3d4378));_0x4f793f(_0x3d4378);})[_0x2a71('0x15')](function(_0x134d2f){logger[_0x2a71('0x11')](_0x2a71('0x1c'),_0x134d2f[_0x2a71('0x13')],_0x2ae5b2);_0x42dda0(_0xbc9a6d[_0x2a71('0x11')](0x1f4,_0x134d2f[_0x2a71('0x13')]));});});}; \ No newline at end of file +var _0x3bc6=['catch','ShowSquareOdbc','find','raw','options','where','include','map','model','attributes','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result'];(function(_0x1233e0,_0x2c1b12){var _0x7a53f6=function(_0x100d38){while(--_0x100d38){_0x1233e0['push'](_0x1233e0['shift']());}};_0x7a53f6(++_0x2c1b12);}(_0x3bc6,0x65));var _0x63bc=function(_0x55a9f5,_0x5f3c5b){_0x55a9f5=_0x55a9f5-0x0;var _0x20efb8=_0x3bc6[_0x55a9f5];return _0x20efb8;};'use strict';var _=require(_0x63bc('0x0'));var util=require(_0x63bc('0x1'));var moment=require('moment');var BPromise=require(_0x63bc('0x2'));var rs=require(_0x63bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x63bc('0x4'))['db'];var utils=require(_0x63bc('0x5'));var logger=require('../../config/logger')(_0x63bc('0x6'));var config=require(_0x63bc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x63bc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19d159,_0xeb383,_0x36e9d6){return new BPromise(function(_0x1f8e60,_0x3bdec9){return client[_0x63bc('0x9')](_0x19d159,_0x36e9d6)[_0x63bc('0xa')](function(_0x36f7e0){logger[_0x63bc('0xb')](_0x63bc('0xc'),_0xeb383,'request\x20sent');logger[_0x63bc('0xd')](_0x63bc('0xe'),_0xeb383,_0x63bc('0xf'),JSON['stringify'](_0x36f7e0));if(_0x36f7e0['error']){if(_0x36f7e0[_0x63bc('0x10')]['code']===0x1f4){logger[_0x63bc('0x10')]('SquareOdbc,\x20%s,\x20%s',_0xeb383,_0x36f7e0[_0x63bc('0x10')][_0x63bc('0x11')]);return _0x3bdec9(_0x36f7e0[_0x63bc('0x10')]['message']);}logger[_0x63bc('0x10')](_0x63bc('0xc'),_0xeb383,_0x36f7e0[_0x63bc('0x10')][_0x63bc('0x11')]);return _0x1f8e60(_0x36f7e0[_0x63bc('0x10')][_0x63bc('0x11')]);}else{logger[_0x63bc('0xb')](_0x63bc('0xc'),_0xeb383,_0x63bc('0xf'));_0x1f8e60(_0x36f7e0[_0x63bc('0x12')][_0x63bc('0x11')]);}})[_0x63bc('0x13')](function(_0xa0bad6){logger[_0x63bc('0x10')]('SquareOdbc,\x20%s,\x20%s',_0xeb383,_0xa0bad6);_0x3bdec9(_0xa0bad6);});});}exports[_0x63bc('0x14')]=function(_0x49fba0){var _0x47d13f=this;return new Promise(function(_0xae8f6f,_0x163389){return db['SquareOdbc'][_0x63bc('0x15')]({'raw':_0x49fba0['options']?_0x49fba0['options'][_0x63bc('0x16')]===undefined?!![]:![]:!![],'where':_0x49fba0[_0x63bc('0x17')]?_0x49fba0['options'][_0x63bc('0x18')]||null:null,'attributes':_0x49fba0[_0x63bc('0x17')]?_0x49fba0[_0x63bc('0x17')]['attributes']||null:null,'include':_0x49fba0[_0x63bc('0x17')]?_0x49fba0[_0x63bc('0x17')][_0x63bc('0x19')]?_[_0x63bc('0x1a')](_0x49fba0[_0x63bc('0x17')]['include'],function(_0x512b4c){return{'model':db[_0x512b4c[_0x63bc('0x1b')]],'as':_0x512b4c['as'],'attributes':_0x512b4c[_0x63bc('0x1c')],'include':_0x512b4c['include']?_[_0x63bc('0x1a')](_0x512b4c[_0x63bc('0x19')],function(_0x3d40f7){return{'model':db[_0x3d40f7[_0x63bc('0x1b')]],'as':_0x3d40f7['as'],'attributes':_0x3d40f7[_0x63bc('0x1c')],'include':_0x3d40f7['include']?_[_0x63bc('0x1a')](_0x3d40f7[_0x63bc('0x19')],function(_0x3b23d2){return{'model':db[_0x3b23d2[_0x63bc('0x1b')]],'as':_0x3b23d2['as'],'attributes':_0x3b23d2[_0x63bc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x63bc('0xa')](function(_0x281ef0){logger['info'](_0x63bc('0x14'),_0x49fba0);logger[_0x63bc('0xd')](_0x63bc('0x14'),_0x49fba0,JSON[_0x63bc('0x1d')](_0x281ef0));_0xae8f6f(_0x281ef0);})[_0x63bc('0x13')](function(_0x513794){logger[_0x63bc('0x10')]('ShowSquareOdbc',_0x513794[_0x63bc('0x11')],_0x49fba0);_0x163389(_0x47d13f[_0x63bc('0x10')](0x1f4,_0x513794[_0x63bc('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index cf43ba8..28bb0f3 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 _0xb16f=['/:id','show','/:id/users','getUsers','post','create','addUsers','put','update','delete','destroy','removeUsers','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./squareProject.controller','isAuthenticated','index','get'];(function(_0x394b23,_0x36d244){var _0xccfc8b=function(_0x2609f6){while(--_0x2609f6){_0x394b23['push'](_0x394b23['shift']());}};_0xccfc8b(++_0x36d244);}(_0xb16f,0x1c4));var _0xfb16=function(_0x5d9ceb,_0x1a49f5){_0x5d9ceb=_0x5d9ceb-0x0;var _0x33ce82=_0xb16f[_0x5d9ceb];return _0x33ce82;};'use strict';var multer=require('multer');var util=require(_0xfb16('0x0'));var path=require(_0xfb16('0x1'));var timeout=require(_0xfb16('0x2'));var express=require('express');var router=express[_0xfb16('0x3')]();var fs_extra=require(_0xfb16('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfb16('0x5'));var config=require('../../config/environment');var controller=require(_0xfb16('0x6'));router['get']('/',auth[_0xfb16('0x7')](),controller[_0xfb16('0x8')]);router[_0xfb16('0x9')](_0xfb16('0xa'),auth['isAuthenticated'](),controller[_0xfb16('0xb')]);router[_0xfb16('0x9')](_0xfb16('0xc'),auth['isAuthenticated'](),controller[_0xfb16('0xd')]);router[_0xfb16('0xe')]('/',auth[_0xfb16('0x7')](),controller[_0xfb16('0xf')]);router[_0xfb16('0xe')](_0xfb16('0xc'),auth[_0xfb16('0x7')](),controller[_0xfb16('0x10')]);router[_0xfb16('0x11')](_0xfb16('0xa'),auth[_0xfb16('0x7')](),controller[_0xfb16('0x12')]);router[_0xfb16('0x13')](_0xfb16('0xa'),auth[_0xfb16('0x7')](),controller[_0xfb16('0x14')]);router['delete'](_0xfb16('0xc'),auth['isAuthenticated'](),controller[_0xfb16('0x15')]);module['exports']=router; \ No newline at end of file +var _0xc222=['show','/:id/users','getUsers','post','create','addUsers','/:id','update','delete','destroy','removeUsers','exports','multer','util','connect-timeout','Router','../../config/environment','./squareProject.controller','get','isAuthenticated','index'];(function(_0x53b0f8,_0x459130){var _0x133415=function(_0x37a4a5){while(--_0x37a4a5){_0x53b0f8['push'](_0x53b0f8['shift']());}};_0x133415(++_0x459130);}(_0xc222,0x75));var _0x2c22=function(_0x32c3dd,_0x31ab43){_0x32c3dd=_0x32c3dd-0x0;var _0x58bd34=_0xc222[_0x32c3dd];return _0x58bd34;};'use strict';var multer=require(_0x2c22('0x0'));var util=require(_0x2c22('0x1'));var path=require('path');var timeout=require(_0x2c22('0x2'));var express=require('express');var router=express[_0x2c22('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2c22('0x4'));var controller=require(_0x2c22('0x5'));router[_0x2c22('0x6')]('/',auth[_0x2c22('0x7')](),controller[_0x2c22('0x8')]);router[_0x2c22('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x2c22('0x9')]);router['get'](_0x2c22('0xa'),auth[_0x2c22('0x7')](),controller[_0x2c22('0xb')]);router[_0x2c22('0xc')]('/',auth['isAuthenticated'](),controller[_0x2c22('0xd')]);router[_0x2c22('0xc')]('/:id/users',auth['isAuthenticated'](),controller[_0x2c22('0xe')]);router['put'](_0x2c22('0xf'),auth[_0x2c22('0x7')](),controller[_0x2c22('0x10')]);router[_0x2c22('0x11')](_0x2c22('0xf'),auth[_0x2c22('0x7')](),controller[_0x2c22('0x12')]);router[_0x2c22('0x11')](_0x2c22('0xa'),auth[_0x2c22('0x7')](),controller[_0x2c22('0x13')]);module[_0x2c22('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 3f5bcb0..f0edaf8 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 _0x8ab2=['TEXT','getDataValue','preproduction','toString','utf8','BLOB','production','DATE','STRING'];(function(_0x4ccd75,_0x228c4b){var _0x558e01=function(_0x1e5cd5){while(--_0x1e5cd5){_0x4ccd75['push'](_0x4ccd75['shift']());}};_0x558e01(++_0x228c4b);}(_0x8ab2,0x167));var _0x28ab=function(_0x5e529d,_0x2a5209){_0x5e529d=_0x5e529d-0x0;var _0x5dc96a=_0x8ab2[_0x5e529d];return _0x5dc96a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x28ab('0x0')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x28ab('0x0')]},'notes':{'type':Sequelize[_0x28ab('0x1')]},'preproduction':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x28ab('0x2')](_0x28ab('0x3'))){return this[_0x28ab('0x2')](_0x28ab('0x3'))[_0x28ab('0x4')](_0x28ab('0x5'));}}},'production':{'type':Sequelize[_0x28ab('0x6')]('long'),'get':function(){if(this[_0x28ab('0x2')](_0x28ab('0x7'))){return this[_0x28ab('0x2')]('production')[_0x28ab('0x4')](_0x28ab('0x5'));}}},'savedAt':{'type':Sequelize[_0x28ab('0x8')]},'publishedAt':{'type':Sequelize[_0x28ab('0x8')]}}; \ No newline at end of file +var _0x0b68=['BLOB','long','preproduction','getDataValue','utf8','production','toString','DATE','sequelize','exports','STRING'];(function(_0x4e7551,_0x398ee5){var _0x2c2ae8=function(_0x31f000){while(--_0x31f000){_0x4e7551['push'](_0x4e7551['shift']());}};_0x2c2ae8(++_0x398ee5);}(_0x0b68,0xa2));var _0x80b6=function(_0x2528af,_0x14f291){_0x2528af=_0x2528af-0x0;var _0x208b83=_0x0b68[_0x2528af];return _0x208b83;};'use strict';var Sequelize=require(_0x80b6('0x0'));module[_0x80b6('0x1')]={'name':{'type':Sequelize[_0x80b6('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x80b6('0x3')](_0x80b6('0x4')),'get':function(){if(this['getDataValue'](_0x80b6('0x5'))){return this[_0x80b6('0x6')](_0x80b6('0x5'))['toString'](_0x80b6('0x7'));}}},'production':{'type':Sequelize[_0x80b6('0x3')]('long'),'get':function(){if(this[_0x80b6('0x6')](_0x80b6('0x8'))){return this[_0x80b6('0x6')](_0x80b6('0x8'))[_0x80b6('0x9')](_0x80b6('0x7'));}}},'savedAt':{'type':Sequelize[_0x80b6('0xa')]},'publishedAt':{'type':Sequelize[_0x80b6('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index adc4acd..1c70ec8 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 _0x7880=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','destroy','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','emit','getUsers','findOne','order','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','get','SquareProjects','UserProfileResource','publish','agi','stringify','sendStatus','stack','name','index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','options','includeAll','include','catch','show','params','merge','find'];(function(_0x5daeb2,_0x4b007c){var _0x2dbb9f=function(_0x3b29e3){while(--_0x3b29e3){_0x5daeb2['push'](_0x5daeb2['shift']());}};_0x2dbb9f(++_0x4b007c);}(_0x7880,0x1f4));var _0x0788=function(_0x3074f3,_0x4f2c03){_0x3074f3=_0x3074f3-0x0;var _0x53f112=_0x7880[_0x3074f3];return _0x53f112;};'use strict';var _=require('lodash');var Redis=require(_0x0788('0x0'));var qs=require(_0x0788('0x1'));var logger=require(_0x0788('0x2'))(_0x0788('0x3'));var config=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];config['redis']=_[_0x0788('0x6')](config[_0x0788('0x7')],{'host':_0x0788('0x8'),'port':0x18eb});var socket=require(_0x0788('0x9'))(new Redis(config[_0x0788('0x7')]));require(_0x0788('0xa'))[_0x0788('0xb')](socket);function respondWithStatusCode(_0x44bbb5,_0x3c29f3){_0x3c29f3=_0x3c29f3||0xcc;return function(_0x422f8b){if(_0x422f8b){return _0x44bbb5['sendStatus'](_0x3c29f3);}return _0x44bbb5[_0x0788('0xc')](_0x3c29f3)['end']();};}function respondWithResult(_0xabaf81,_0x53b2f2){_0x53b2f2=_0x53b2f2||0xc8;return function(_0x433c26){if(_0x433c26){return _0xabaf81[_0x0788('0xc')](_0x53b2f2)[_0x0788('0xd')](_0x433c26);}};}function respondWithFilteredResult(_0xee8670,_0x469ebe){return function(_0x5d747c){if(_0x5d747c){var _0x1920b3=typeof _0x469ebe[_0x0788('0xe')]===_0x0788('0xf')&&typeof _0x469ebe[_0x0788('0x10')]===_0x0788('0xf');var _0xce4342=_0x5d747c[_0x0788('0x11')];var _0x47a244=_0x1920b3?0x0:_0x469ebe[_0x0788('0xe')];var _0x7e3407=_0x1920b3?_0x5d747c[_0x0788('0x11')]:_0x469ebe[_0x0788('0xe')]+_0x469ebe['limit'];var _0x43ca01;if(_0x7e3407>=_0xce4342){_0x7e3407=_0xce4342;_0x43ca01=0xc8;}else{_0x43ca01=0xce;}_0xee8670['status'](_0x43ca01);return _0xee8670[_0x0788('0x12')](_0x0788('0x13'),_0x47a244+'-'+_0x7e3407+'/'+_0xce4342)[_0x0788('0xd')](_0x5d747c);}return null;};}function saveUpdates(_0xb406fb){return function(_0x2ddd1a){if(_0x2ddd1a){return _0x2ddd1a[_0x0788('0x14')](_0xb406fb)['then'](function(_0x573822){return _0x573822;});}return null;};}function removeEntity(_0x17d805){return function(_0x461d9d){if(_0x461d9d){return _0x461d9d['destroy']()[_0x0788('0x15')](function(){var _0x415f19=_0x461d9d[_0x0788('0x16')]({'plain':!![]});var _0x52c339=_0x0788('0x17');return db[_0x0788('0x18')]['destroy']({'where':{'type':_0x52c339,'resourceId':_0x415f19['id']}})[_0x0788('0x15')](function(){return _0x461d9d;});})['then'](function(){var _0x7d0869=new Redis(config['redis']);_0x7d0869[_0x0788('0x19')](_0x0788('0x1a'),JSON[_0x0788('0x1b')]({'id':_0x461d9d['id'],'deleted':!![]}));})[_0x0788('0x15')](function(){_0x17d805[_0x0788('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48ec43){return function(_0x2270d4){if(!_0x2270d4){_0x48ec43[_0x0788('0x1c')](0x194);}return _0x2270d4;};}function handleError(_0x645320,_0x7a99a1){_0x7a99a1=_0x7a99a1||0x1f4;return function(_0x5ba1da){logger['error'](_0x5ba1da[_0x0788('0x1d')]);if(_0x5ba1da[_0x0788('0x1e')]){delete _0x5ba1da[_0x0788('0x1e')];}_0x645320['status'](_0x7a99a1)['send'](_0x5ba1da);};}exports[_0x0788('0x1f')]=function(_0xa1f7dc,_0x5f2dda){var _0x48816a={},_0x5a54a5={},_0x44798c={'count':0x0,'rows':[]};var _0x57fda1=_[_0x0788('0x20')](db[_0x0788('0x21')][_0x0788('0x22')],function(_0x18fc0e){return{'name':_0x18fc0e[_0x0788('0x23')],'type':_0x18fc0e[_0x0788('0x24')][_0x0788('0x25')]};});_0x5a54a5[_0x0788('0x26')]=_['map'](_0x57fda1,'name');_0x5a54a5[_0x0788('0x27')]=_[_0x0788('0x28')](_0xa1f7dc['query']);_0x5a54a5['filters']=_[_0x0788('0x29')](_0x5a54a5[_0x0788('0x26')],_0x5a54a5[_0x0788('0x27')]);_0x48816a[_0x0788('0x2a')]=_[_0x0788('0x29')](_0x5a54a5[_0x0788('0x26')],qs[_0x0788('0x2b')](_0xa1f7dc[_0x0788('0x27')][_0x0788('0x2b')]));_0x48816a[_0x0788('0x2a')]=_0x48816a['attributes'][_0x0788('0x2c')]?_0x48816a[_0x0788('0x2a')]:_0x5a54a5[_0x0788('0x26')];if(!_0xa1f7dc[_0x0788('0x27')][_0x0788('0x2d')](_0x0788('0x2e'))){_0x48816a[_0x0788('0x10')]=qs[_0x0788('0x10')](_0xa1f7dc[_0x0788('0x27')][_0x0788('0x10')]);_0x48816a['offset']=qs['offset'](_0xa1f7dc['query']['offset']);}_0x48816a['order']=qs['sort'](_0xa1f7dc[_0x0788('0x27')][_0x0788('0x2f')]);_0x48816a[_0x0788('0x30')]=qs['filters'](_[_0x0788('0x31')](_0xa1f7dc[_0x0788('0x27')],_0x5a54a5[_0x0788('0x32')]),_0x57fda1);if(_0xa1f7dc[_0x0788('0x27')]['filter']){_0x48816a[_0x0788('0x30')]=_['merge'](_0x48816a[_0x0788('0x30')],{'$or':_['map'](_0x57fda1,function(_0x9d1edb){if(_0x9d1edb[_0x0788('0x24')]!=='VIRTUAL'){var _0x16f053={};_0x16f053[_0x9d1edb[_0x0788('0x1e')]]={'$like':'%'+_0xa1f7dc['query'][_0x0788('0x33')]+'%'};return _0x16f053;}})});}_0x48816a=_['merge']({},_0x48816a,_0xa1f7dc[_0x0788('0x34')]);var _0x5576c4={'where':_0x48816a[_0x0788('0x30')]};return db['SquareProject'][_0x0788('0x11')](_0x5576c4)['then'](function(_0x5dc77e){_0x44798c[_0x0788('0x11')]=_0x5dc77e;if(_0xa1f7dc[_0x0788('0x27')][_0x0788('0x35')]){_0x48816a[_0x0788('0x36')]=[{'all':!![]}];}return db[_0x0788('0x21')]['findAll'](_0x48816a);})['then'](function(_0x530d83){_0x44798c['rows']=_0x530d83;return _0x44798c;})[_0x0788('0x15')](respondWithFilteredResult(_0x5f2dda,_0x48816a))[_0x0788('0x37')](handleError(_0x5f2dda,null));};exports[_0x0788('0x38')]=function(_0x358a22,_0x362c49){var _0x5993ad={'raw':![],'where':{'id':_0x358a22[_0x0788('0x39')]['id']}},_0x4c7833={};_0x4c7833[_0x0788('0x26')]=_[_0x0788('0x28')](db[_0x0788('0x21')][_0x0788('0x22')]);_0x4c7833[_0x0788('0x27')]=_[_0x0788('0x28')](_0x358a22[_0x0788('0x27')]);_0x4c7833[_0x0788('0x32')]=_['intersection'](_0x4c7833['model'],_0x4c7833[_0x0788('0x27')]);_0x5993ad[_0x0788('0x2a')]=_[_0x0788('0x29')](_0x4c7833['model'],qs['fields'](_0x358a22['query'][_0x0788('0x2b')]));_0x5993ad[_0x0788('0x2a')]=_0x5993ad[_0x0788('0x2a')][_0x0788('0x2c')]?_0x5993ad[_0x0788('0x2a')]:_0x4c7833[_0x0788('0x26')];if(_0x358a22[_0x0788('0x27')][_0x0788('0x35')]){_0x5993ad['include']=[{'all':!![]}];}_0x5993ad=_[_0x0788('0x3a')]({},_0x5993ad,_0x358a22[_0x0788('0x34')]);return db[_0x0788('0x21')][_0x0788('0x3b')](_0x5993ad)['then'](handleEntityNotFound(_0x362c49,null))[_0x0788('0x15')](respondWithResult(_0x362c49,null))[_0x0788('0x37')](handleError(_0x362c49,null));};exports['create']=function(_0x5b5481,_0x524b43){return db[_0x0788('0x21')]['create'](_0x5b5481[_0x0788('0x3c')],{})[_0x0788('0x15')](function(_0x127ab4){var _0x329508=_0x5b5481[_0x0788('0x3d')][_0x0788('0x16')]({'plain':!![]});if(!_0x329508)throw new Error(_0x0788('0x3e'));if(_0x329508[_0x0788('0x3f')]==='user'){var _0x4c6366=_0x127ab4[_0x0788('0x16')]({'plain':!![]});var _0xe7dfdc=_0x0788('0x17');return db['UserProfileSection'][_0x0788('0x3b')]({'where':{'name':_0xe7dfdc,'userProfileId':_0x329508[_0x0788('0x40')]},'raw':!![]})[_0x0788('0x15')](function(_0x4563cd){if(_0x4563cd&&_0x4563cd[_0x0788('0x41')]===0x0){return db['UserProfileResource']['create']({'name':_0x4c6366[_0x0788('0x1e')],'resourceId':_0x4c6366['id'],'type':_0x4563cd[_0x0788('0x1e')],'sectionId':_0x4563cd['id']},{})['then'](function(){return _0x127ab4;});}else{return _0x127ab4;}})[_0x0788('0x37')](function(_0x4a6cde){logger[_0x0788('0x42')](_0x0788('0x43'),_0x4a6cde);throw _0x4a6cde;});}return _0x127ab4;})[_0x0788('0x15')](respondWithResult(_0x524b43,0xc9))[_0x0788('0x37')](handleError(_0x524b43,null));};exports[_0x0788('0x14')]=function(_0x379928,_0x1722d4){if(_0x379928[_0x0788('0x3c')]['id']){delete _0x379928['body']['id'];}return db[_0x0788('0x21')][_0x0788('0x3b')]({'where':{'id':_0x379928[_0x0788('0x39')]['id']}})['then'](handleEntityNotFound(_0x1722d4,null))[_0x0788('0x15')](saveUpdates(_0x379928[_0x0788('0x3c')],null))['then'](function(_0x18e55e){if(!_0x18e55e)return;var _0x41110d=_0x18e55e[_0x0788('0x16')]({'plain':!![]});return _0x41110d;})[_0x0788('0x15')](function(_0x137e24){var _0x347cc8=new Redis(config['redis']);_0x347cc8['publish'](_0x0788('0x1a'),JSON[_0x0788('0x1b')](_['pick'](_0x137e24,['id',_0x0788('0x1e'),_0x0788('0x44')])));return _0x137e24;})[_0x0788('0x15')](respondWithResult(_0x1722d4,null))[_0x0788('0x37')](handleError(_0x1722d4,null));};exports[_0x0788('0x45')]=function(_0x226517,_0x112870){return db[_0x0788('0x21')][_0x0788('0x3b')]({'where':{'id':_0x226517[_0x0788('0x39')]['id']}})[_0x0788('0x15')](handleEntityNotFound(_0x112870,null))[_0x0788('0x15')](removeEntity(_0x112870,null))['catch'](handleError(_0x112870,null));};exports[_0x0788('0x46')]=function(_0x223036,_0x301a5b){return db['SquareProject'][_0x0788('0x3b')]({'where':{'id':_0x223036[_0x0788('0x39')]['id']}})['then'](handleEntityNotFound(_0x301a5b,null))['then'](function(_0x2f997e){if(_0x2f997e){return _0x2f997e[_0x0788('0x46')](_0x223036[_0x0788('0x3c')][_0x0788('0x47')],_[_0x0788('0x48')](_0x223036[_0x0788('0x3c')],['ids','id'])||{});}})[_0x0788('0x15')](respondWithResult(_0x301a5b,null))[_0x0788('0x37')](handleError(_0x301a5b,null));};exports[_0x0788('0x49')]=function(_0x47be71,_0x533f71){return db[_0x0788('0x21')]['find']({'where':{'id':_0x47be71[_0x0788('0x39')]['id']}})[_0x0788('0x15')](handleEntityNotFound(_0x533f71,null))[_0x0788('0x15')](function(_0x13a021){if(_0x13a021){return _0x13a021[_0x0788('0x49')](_0x47be71[_0x0788('0x27')][_0x0788('0x47')])[_0x0788('0x15')](function(){if(_[_0x0788('0x4a')](_0x47be71[_0x0788('0x27')]['ids'])){for(var _0xe1a934=0x0;_0xe1a934<_0x47be71[_0x0788('0x27')][_0x0788('0x47')][_0x0788('0x2c')];_0xe1a934+=0x1){socket['emit'](_0x0788('0x4b'),{'UserId':Number(_0x47be71[_0x0788('0x27')][_0x0788('0x47')][_0xe1a934]),'SquareProjectId':Number(_0x47be71[_0x0788('0x39')]['id'])});}}else{socket[_0x0788('0x4c')]('userSquareProject:remove',{'UserId':Number(_0x47be71[_0x0788('0x27')]['ids']),'SquareProjectId':Number(_0x47be71[_0x0788('0x39')]['id'])});}});}})[_0x0788('0x15')](respondWithStatusCode(_0x533f71,null))[_0x0788('0x37')](handleError(_0x533f71,null));};exports[_0x0788('0x4d')]=function(_0x3baf23,_0x348cbf){var _0xdc7103={};var _0x150403={};var _0x17266c;var _0x4ac573;return db[_0x0788('0x21')][_0x0788('0x4e')]({'where':{'id':_0x3baf23[_0x0788('0x39')]['id']}})['then'](handleEntityNotFound(_0x348cbf,null))['then'](function(_0x6d255b){if(_0x6d255b){_0x17266c=_0x6d255b;_0x150403[_0x0788('0x26')]=_[_0x0788('0x28')](db['User'][_0x0788('0x22')]);_0x150403[_0x0788('0x27')]=_[_0x0788('0x28')](_0x3baf23[_0x0788('0x27')]);_0x150403['filters']=_['intersection'](_0x150403['model'],_0x150403[_0x0788('0x27')]);_0xdc7103[_0x0788('0x2a')]=_[_0x0788('0x29')](_0x150403['model'],qs['fields'](_0x3baf23[_0x0788('0x27')]['fields']));_0xdc7103[_0x0788('0x2a')]=_0xdc7103[_0x0788('0x2a')][_0x0788('0x2c')]?_0xdc7103[_0x0788('0x2a')]:_0x150403[_0x0788('0x26')];_0xdc7103[_0x0788('0x4f')]=qs[_0x0788('0x2f')](_0x3baf23[_0x0788('0x27')][_0x0788('0x2f')]);_0xdc7103[_0x0788('0x30')]=qs['filters'](_[_0x0788('0x31')](_0x3baf23[_0x0788('0x27')],_0x150403['filters']));if(_0x3baf23['query'][_0x0788('0x33')]){_0xdc7103[_0x0788('0x30')]=_[_0x0788('0x3a')](_0xdc7103[_0x0788('0x30')],{'$or':_[_0x0788('0x20')](_0xdc7103[_0x0788('0x2a')],function(_0x489277){var _0x384401={};_0x384401[_0x489277]={'$like':'%'+_0x3baf23[_0x0788('0x27')][_0x0788('0x33')]+'%'};return _0x384401;})});}_0xdc7103=_[_0x0788('0x3a')]({},_0xdc7103,_0x3baf23['options']);return _0x17266c[_0x0788('0x4d')](_0xdc7103);}})[_0x0788('0x15')](function(_0x3f3616){if(_0x3f3616){_0x4ac573=_0x3f3616[_0x0788('0x2c')];if(!_0x3baf23['query']['hasOwnProperty'](_0x0788('0x2e'))){_0xdc7103[_0x0788('0x10')]=qs[_0x0788('0x10')](_0x3baf23[_0x0788('0x27')][_0x0788('0x10')]);_0xdc7103[_0x0788('0xe')]=qs[_0x0788('0xe')](_0x3baf23[_0x0788('0x27')][_0x0788('0xe')]);}return _0x17266c['getUsers'](_0xdc7103);}})[_0x0788('0x15')](function(_0x334408){if(_0x334408){return _0x334408?{'count':_0x4ac573,'rows':_0x334408}:null;}})[_0x0788('0x15')](respondWithResult(_0x348cbf,null))['catch'](handleError(_0x348cbf,null));}; \ No newline at end of file +var _0x90b1=['rawAttributes','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','SquareProject','includeAll','include','rows','show','keys','intersection','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','agi','pick','production','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','./squareProject.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','SquareProjects','UserProfileResource','publish','stringify','end','error','stack','name','index','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x90b1,0x1bb));var _0x190b=function(_0x8299df,_0x2887e1){_0x8299df=_0x8299df-0x0;var _0x4a707f=_0x90b1[_0x8299df];return _0x4a707f;};'use strict';var _=require(_0x190b('0x0'));var Redis=require(_0x190b('0x1'));var qs=require(_0x190b('0x2'));var logger=require('../../config/logger')('api');var config=require(_0x190b('0x3'));var db=require(_0x190b('0x4'))['db'];config[_0x190b('0x5')]=_[_0x190b('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x190b('0x7'))[_0x190b('0x8')](socket);function respondWithStatusCode(_0x3b57f7,_0x626aa1){_0x626aa1=_0x626aa1||0xcc;return function(_0x311161){if(_0x311161){return _0x3b57f7[_0x190b('0x9')](_0x626aa1);}return _0x3b57f7[_0x190b('0xa')](_0x626aa1)['end']();};}function respondWithResult(_0x14b93d,_0x186101){_0x186101=_0x186101||0xc8;return function(_0x163966){if(_0x163966){return _0x14b93d[_0x190b('0xa')](_0x186101)[_0x190b('0xb')](_0x163966);}};}function respondWithFilteredResult(_0x409aa3,_0x3e99a3){return function(_0x1da225){if(_0x1da225){var _0x5d6497=typeof _0x3e99a3[_0x190b('0xc')]===_0x190b('0xd')&&typeof _0x3e99a3['limit']===_0x190b('0xd');var _0x596c48=_0x1da225[_0x190b('0xe')];var _0x40763c=_0x5d6497?0x0:_0x3e99a3[_0x190b('0xc')];var _0x1e1fd5=_0x5d6497?_0x1da225[_0x190b('0xe')]:_0x3e99a3[_0x190b('0xc')]+_0x3e99a3[_0x190b('0xf')];var _0x441e58;if(_0x1e1fd5>=_0x596c48){_0x1e1fd5=_0x596c48;_0x441e58=0xc8;}else{_0x441e58=0xce;}_0x409aa3[_0x190b('0xa')](_0x441e58);return _0x409aa3[_0x190b('0x10')](_0x190b('0x11'),_0x40763c+'-'+_0x1e1fd5+'/'+_0x596c48)[_0x190b('0xb')](_0x1da225);}return null;};}function saveUpdates(_0x3fbfc3){return function(_0x121867){if(_0x121867){return _0x121867[_0x190b('0x12')](_0x3fbfc3)['then'](function(_0x428fec){return _0x428fec;});}return null;};}function removeEntity(_0x5efbed){return function(_0x2a9323){if(_0x2a9323){return _0x2a9323[_0x190b('0x13')]()[_0x190b('0x14')](function(){var _0x16c009=_0x2a9323['get']({'plain':!![]});var _0x298343=_0x190b('0x15');return db[_0x190b('0x16')][_0x190b('0x13')]({'where':{'type':_0x298343,'resourceId':_0x16c009['id']}})[_0x190b('0x14')](function(){return _0x2a9323;});})[_0x190b('0x14')](function(){var _0x47d704=new Redis(config[_0x190b('0x5')]);_0x47d704[_0x190b('0x17')]('agi',JSON[_0x190b('0x18')]({'id':_0x2a9323['id'],'deleted':!![]}));})['then'](function(){_0x5efbed['status'](0xcc)[_0x190b('0x19')]();});}};}function handleEntityNotFound(_0x42e7f2){return function(_0x332006){if(!_0x332006){_0x42e7f2['sendStatus'](0x194);}return _0x332006;};}function handleError(_0x37465e,_0x2e633e){_0x2e633e=_0x2e633e||0x1f4;return function(_0x16e989){logger[_0x190b('0x1a')](_0x16e989[_0x190b('0x1b')]);if(_0x16e989[_0x190b('0x1c')]){delete _0x16e989[_0x190b('0x1c')];}_0x37465e['status'](_0x2e633e)['send'](_0x16e989);};}exports[_0x190b('0x1d')]=function(_0x1a5f86,_0x50605b){var _0x526822={},_0x3260d5={},_0x4e2a93={'count':0x0,'rows':[]};var _0x328e5e=_[_0x190b('0x1e')](db['SquareProject'][_0x190b('0x1f')],function(_0x1deea6){return{'name':_0x1deea6['fieldName'],'type':_0x1deea6[_0x190b('0x20')][_0x190b('0x21')]};});_0x3260d5[_0x190b('0x22')]=_['map'](_0x328e5e,'name');_0x3260d5[_0x190b('0x23')]=_['keys'](_0x1a5f86[_0x190b('0x23')]);_0x3260d5[_0x190b('0x24')]=_['intersection'](_0x3260d5[_0x190b('0x22')],_0x3260d5['query']);_0x526822[_0x190b('0x25')]=_['intersection'](_0x3260d5[_0x190b('0x22')],qs['fields'](_0x1a5f86[_0x190b('0x23')][_0x190b('0x26')]));_0x526822['attributes']=_0x526822[_0x190b('0x25')][_0x190b('0x27')]?_0x526822[_0x190b('0x25')]:_0x3260d5[_0x190b('0x22')];if(!_0x1a5f86[_0x190b('0x23')][_0x190b('0x28')](_0x190b('0x29'))){_0x526822[_0x190b('0xf')]=qs['limit'](_0x1a5f86['query'][_0x190b('0xf')]);_0x526822[_0x190b('0xc')]=qs['offset'](_0x1a5f86[_0x190b('0x23')][_0x190b('0xc')]);}_0x526822[_0x190b('0x2a')]=qs[_0x190b('0x2b')](_0x1a5f86[_0x190b('0x23')][_0x190b('0x2b')]);_0x526822[_0x190b('0x2c')]=qs['filters'](_['pick'](_0x1a5f86[_0x190b('0x23')],_0x3260d5[_0x190b('0x24')]),_0x328e5e);if(_0x1a5f86[_0x190b('0x23')]['filter']){_0x526822[_0x190b('0x2c')]=_[_0x190b('0x2d')](_0x526822[_0x190b('0x2c')],{'$or':_['map'](_0x328e5e,function(_0x2a8260){if(_0x2a8260['type']!=='VIRTUAL'){var _0x1368b2={};_0x1368b2[_0x2a8260[_0x190b('0x1c')]]={'$like':'%'+_0x1a5f86['query'][_0x190b('0x2e')]+'%'};return _0x1368b2;}})});}_0x526822=_[_0x190b('0x2d')]({},_0x526822,_0x1a5f86[_0x190b('0x2f')]);var _0x5a9cba={'where':_0x526822[_0x190b('0x2c')]};return db[_0x190b('0x30')]['count'](_0x5a9cba)['then'](function(_0x2b9de5){_0x4e2a93['count']=_0x2b9de5;if(_0x1a5f86[_0x190b('0x23')][_0x190b('0x31')]){_0x526822[_0x190b('0x32')]=[{'all':!![]}];}return db[_0x190b('0x30')]['findAll'](_0x526822);})[_0x190b('0x14')](function(_0x5f118c){_0x4e2a93[_0x190b('0x33')]=_0x5f118c;return _0x4e2a93;})[_0x190b('0x14')](respondWithFilteredResult(_0x50605b,_0x526822))['catch'](handleError(_0x50605b,null));};exports[_0x190b('0x34')]=function(_0x2a75d2,_0x45b296){var _0x5d9548={'raw':![],'where':{'id':_0x2a75d2['params']['id']}},_0x2c7c0e={};_0x2c7c0e['model']=_['keys'](db[_0x190b('0x30')][_0x190b('0x1f')]);_0x2c7c0e[_0x190b('0x23')]=_[_0x190b('0x35')](_0x2a75d2['query']);_0x2c7c0e['filters']=_[_0x190b('0x36')](_0x2c7c0e['model'],_0x2c7c0e[_0x190b('0x23')]);_0x5d9548[_0x190b('0x25')]=_['intersection'](_0x2c7c0e[_0x190b('0x22')],qs[_0x190b('0x26')](_0x2a75d2[_0x190b('0x23')]['fields']));_0x5d9548[_0x190b('0x25')]=_0x5d9548[_0x190b('0x25')]['length']?_0x5d9548[_0x190b('0x25')]:_0x2c7c0e['model'];if(_0x2a75d2[_0x190b('0x23')][_0x190b('0x31')]){_0x5d9548[_0x190b('0x32')]=[{'all':!![]}];}_0x5d9548=_['merge']({},_0x5d9548,_0x2a75d2[_0x190b('0x2f')]);return db['SquareProject'][_0x190b('0x37')](_0x5d9548)[_0x190b('0x14')](handleEntityNotFound(_0x45b296,null))[_0x190b('0x14')](respondWithResult(_0x45b296,null))[_0x190b('0x38')](handleError(_0x45b296,null));};exports[_0x190b('0x39')]=function(_0xe736d9,_0x10bb82){return db['SquareProject'][_0x190b('0x39')](_0xe736d9[_0x190b('0x3a')],{})[_0x190b('0x14')](function(_0x4b7f35){var _0x1b71d5=_0xe736d9[_0x190b('0x3b')][_0x190b('0x3c')]({'plain':!![]});if(!_0x1b71d5)throw new Error(_0x190b('0x3d'));if(_0x1b71d5[_0x190b('0x3e')]==='user'){var _0x1f2262=_0x4b7f35[_0x190b('0x3c')]({'plain':!![]});var _0x1e8dc8='SquareProjects';return db[_0x190b('0x3f')][_0x190b('0x37')]({'where':{'name':_0x1e8dc8,'userProfileId':_0x1b71d5[_0x190b('0x40')]},'raw':!![]})['then'](function(_0x4cb561){if(_0x4cb561&&_0x4cb561[_0x190b('0x41')]===0x0){return db[_0x190b('0x16')][_0x190b('0x39')]({'name':_0x1f2262[_0x190b('0x1c')],'resourceId':_0x1f2262['id'],'type':_0x4cb561[_0x190b('0x1c')],'sectionId':_0x4cb561['id']},{})[_0x190b('0x14')](function(){return _0x4b7f35;});}else{return _0x4b7f35;}})['catch'](function(_0x8c0c1d){logger[_0x190b('0x1a')](_0x190b('0x42'),_0x8c0c1d);throw _0x8c0c1d;});}return _0x4b7f35;})['then'](respondWithResult(_0x10bb82,0xc9))[_0x190b('0x38')](handleError(_0x10bb82,null));};exports[_0x190b('0x12')]=function(_0x215ab6,_0x503700){if(_0x215ab6[_0x190b('0x3a')]['id']){delete _0x215ab6[_0x190b('0x3a')]['id'];}return db[_0x190b('0x30')][_0x190b('0x37')]({'where':{'id':_0x215ab6[_0x190b('0x43')]['id']}})[_0x190b('0x14')](handleEntityNotFound(_0x503700,null))[_0x190b('0x14')](saveUpdates(_0x215ab6[_0x190b('0x3a')],null))[_0x190b('0x14')](function(_0x1f7ec2){if(!_0x1f7ec2)return;var _0x279fd9=_0x1f7ec2['get']({'plain':!![]});return _0x279fd9;})[_0x190b('0x14')](function(_0x5d2a4f){var _0x1141c6=new Redis(config[_0x190b('0x5')]);_0x1141c6['publish'](_0x190b('0x44'),JSON[_0x190b('0x18')](_[_0x190b('0x45')](_0x5d2a4f,['id',_0x190b('0x1c'),_0x190b('0x46')])));return _0x5d2a4f;})[_0x190b('0x14')](respondWithResult(_0x503700,null))[_0x190b('0x38')](handleError(_0x503700,null));};exports[_0x190b('0x13')]=function(_0x50ac22,_0x2f034e){return db[_0x190b('0x30')][_0x190b('0x37')]({'where':{'id':_0x50ac22['params']['id']}})[_0x190b('0x14')](handleEntityNotFound(_0x2f034e,null))['then'](removeEntity(_0x2f034e,null))['catch'](handleError(_0x2f034e,null));};exports[_0x190b('0x47')]=function(_0x4008c4,_0x158c54){return db[_0x190b('0x30')][_0x190b('0x37')]({'where':{'id':_0x4008c4[_0x190b('0x43')]['id']}})[_0x190b('0x14')](handleEntityNotFound(_0x158c54,null))[_0x190b('0x14')](function(_0x3e9851){if(_0x3e9851){return _0x3e9851[_0x190b('0x47')](_0x4008c4[_0x190b('0x3a')][_0x190b('0x48')],_[_0x190b('0x49')](_0x4008c4[_0x190b('0x3a')],['ids','id'])||{});}})[_0x190b('0x14')](respondWithResult(_0x158c54,null))[_0x190b('0x38')](handleError(_0x158c54,null));};exports[_0x190b('0x4a')]=function(_0x219aa8,_0x53d740){return db['SquareProject'][_0x190b('0x37')]({'where':{'id':_0x219aa8[_0x190b('0x43')]['id']}})['then'](handleEntityNotFound(_0x53d740,null))[_0x190b('0x14')](function(_0x53cb6f){if(_0x53cb6f){return _0x53cb6f[_0x190b('0x4a')](_0x219aa8[_0x190b('0x23')][_0x190b('0x48')])['then'](function(){if(_[_0x190b('0x4b')](_0x219aa8[_0x190b('0x23')][_0x190b('0x48')])){for(var _0x405e04=0x0;_0x405e04<_0x219aa8[_0x190b('0x23')][_0x190b('0x48')][_0x190b('0x27')];_0x405e04+=0x1){socket[_0x190b('0x4c')](_0x190b('0x4d'),{'UserId':Number(_0x219aa8['query']['ids'][_0x405e04]),'SquareProjectId':Number(_0x219aa8[_0x190b('0x43')]['id'])});}}else{socket[_0x190b('0x4c')](_0x190b('0x4d'),{'UserId':Number(_0x219aa8[_0x190b('0x23')]['ids']),'SquareProjectId':Number(_0x219aa8[_0x190b('0x43')]['id'])});}});}})[_0x190b('0x14')](respondWithStatusCode(_0x53d740,null))['catch'](handleError(_0x53d740,null));};exports[_0x190b('0x4e')]=function(_0x3d5d38,_0xf3af5b){var _0x227fa5={};var _0x42f0a1={};var _0x6eeb1e;var _0x8f95e9;return db[_0x190b('0x30')]['findOne']({'where':{'id':_0x3d5d38[_0x190b('0x43')]['id']}})['then'](handleEntityNotFound(_0xf3af5b,null))['then'](function(_0x2f00fc){if(_0x2f00fc){_0x6eeb1e=_0x2f00fc;_0x42f0a1[_0x190b('0x22')]=_[_0x190b('0x35')](db['User']['rawAttributes']);_0x42f0a1[_0x190b('0x23')]=_[_0x190b('0x35')](_0x3d5d38[_0x190b('0x23')]);_0x42f0a1[_0x190b('0x24')]=_[_0x190b('0x36')](_0x42f0a1[_0x190b('0x22')],_0x42f0a1[_0x190b('0x23')]);_0x227fa5[_0x190b('0x25')]=_['intersection'](_0x42f0a1[_0x190b('0x22')],qs[_0x190b('0x26')](_0x3d5d38[_0x190b('0x23')][_0x190b('0x26')]));_0x227fa5[_0x190b('0x25')]=_0x227fa5['attributes'][_0x190b('0x27')]?_0x227fa5[_0x190b('0x25')]:_0x42f0a1[_0x190b('0x22')];_0x227fa5['order']=qs[_0x190b('0x2b')](_0x3d5d38[_0x190b('0x23')][_0x190b('0x2b')]);_0x227fa5[_0x190b('0x2c')]=qs['filters'](_[_0x190b('0x45')](_0x3d5d38[_0x190b('0x23')],_0x42f0a1[_0x190b('0x24')]));if(_0x3d5d38[_0x190b('0x23')]['filter']){_0x227fa5[_0x190b('0x2c')]=_['merge'](_0x227fa5[_0x190b('0x2c')],{'$or':_[_0x190b('0x1e')](_0x227fa5[_0x190b('0x25')],function(_0x1ac2ef){var _0x52ba56={};_0x52ba56[_0x1ac2ef]={'$like':'%'+_0x3d5d38[_0x190b('0x23')]['filter']+'%'};return _0x52ba56;})});}_0x227fa5=_[_0x190b('0x2d')]({},_0x227fa5,_0x3d5d38['options']);return _0x6eeb1e['getUsers'](_0x227fa5);}})[_0x190b('0x14')](function(_0x58bf93){if(_0x58bf93){_0x8f95e9=_0x58bf93[_0x190b('0x27')];if(!_0x3d5d38[_0x190b('0x23')][_0x190b('0x28')](_0x190b('0x29'))){_0x227fa5[_0x190b('0xf')]=qs['limit'](_0x3d5d38[_0x190b('0x23')][_0x190b('0xf')]);_0x227fa5[_0x190b('0xc')]=qs['offset'](_0x3d5d38[_0x190b('0x23')][_0x190b('0xc')]);}return _0x6eeb1e['getUsers'](_0x227fa5);}})[_0x190b('0x14')](function(_0x164820){if(_0x164820){return _0x164820?{'count':_0x8f95e9,'rows':_0x164820}:null;}})[_0x190b('0x14')](respondWithResult(_0xf3af5b,null))['catch'](handleError(_0xf3af5b,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 580bfb1..3c48063 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 _0xc9bc=['remove','emit','hasOwnProperty','hook','events','SquareProject','setMaxListeners','save','update'];(function(_0x321b68,_0x4ee0e7){var _0x23693e=function(_0x4f81c6){while(--_0x4f81c6){_0x321b68['push'](_0x321b68['shift']());}};_0x23693e(++_0x4ee0e7);}(_0xc9bc,0x16c));var _0xcc9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc9bc[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xcc9b('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xcc9b('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xcc9b('0x2')](0x0);var events={'afterCreate':_0xcc9b('0x3'),'afterUpdate':_0xcc9b('0x4'),'afterDestroy':_0xcc9b('0x5')};function emitEvent(_0x33a023){return function(_0x2cae56,_0x4cbeef,_0x2e0d87){SquareProjectEvents['emit'](_0x33a023+':'+_0x2cae56['id'],_0x2cae56);SquareProjectEvents[_0xcc9b('0x6')](_0x33a023,_0x2cae56);_0x2e0d87(null);};}for(var e in events){if(events[_0xcc9b('0x7')](e)){var event=events[e];SquareProject[_0xcc9b('0x8')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0xcdc3=['exports','events','../../mysqldb','SquareProject','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1ebe2f,_0x523227){var _0xdeb06f=function(_0x2a6051){while(--_0x2a6051){_0x1ebe2f['push'](_0x1ebe2f['shift']());}};_0xdeb06f(++_0x523227);}(_0xcdc3,0x191));var _0x3cdc=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xcdc3[_0x36ed48];return _0x51c63a;};'use strict';var EventEmitter=require(_0x3cdc('0x0'));var SquareProject=require(_0x3cdc('0x1'))['db'][_0x3cdc('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3cdc('0x3'),'afterUpdate':_0x3cdc('0x4'),'afterDestroy':_0x3cdc('0x5')};function emitEvent(_0x2bb6d5){return function(_0x2aab36,_0x2ab929,_0xee29ab){SquareProjectEvents['emit'](_0x2bb6d5+':'+_0x2aab36['id'],_0x2aab36);SquareProjectEvents[_0x3cdc('0x6')](_0x2bb6d5,_0x2aab36);_0xee29ab(null);};}for(var e in events){if(events[_0x3cdc('0x7')](e)){var event=events[e];SquareProject[_0x3cdc('0x8')](e,emitEvent(event));}}module[_0x3cdc('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 6b487f7..38714ea 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 _0x397c=['util','moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt'];(function(_0x4b13f4,_0x2657ff){var _0x4032a2=function(_0x5ddc12){while(--_0x5ddc12){_0x4b13f4['push'](_0x4b13f4['shift']());}};_0x4032a2(++_0x2657ff);}(_0x397c,0x66));var _0xc397=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x397c[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var util=require(_0xc397('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc397('0x1'));var BPromise=require(_0xc397('0x2'));var rp=require(_0xc397('0x3'));var fs=require('fs');var path=require(_0xc397('0x4'));var rimraf=require('rimraf');var config=require(_0xc397('0x5'));var attributes=require(_0xc397('0x6'));module[_0xc397('0x7')]=function(_0xb42bab,_0x3ceaed){return _0xb42bab[_0xc397('0x8')](_0xc397('0x9'),attributes,{'tableName':_0xc397('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e98cd,_0x184482,_0x27cc55){if(_0x4e98cd[_0xc397('0xb')](_0xc397('0xc'))){_0x4e98cd[_0xc397('0xd')]=moment()[_0xc397('0xe')](_0xc397('0xf'));}if(_0x4e98cd['changed']('production')){_0x4e98cd[_0xc397('0x10')]=moment()[_0xc397('0xe')](_0xc397('0xf'));}_0x27cc55(null,_0x4e98cd);}}});}; \ No newline at end of file +var _0x3c12=['moment','bluebird','path','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','publishedAt','lodash','util','../../config/logger','api'];(function(_0x38f1c1,_0x423c00){var _0x17d7ce=function(_0x336e50){while(--_0x336e50){_0x38f1c1['push'](_0x38f1c1['shift']());}};_0x17d7ce(++_0x423c00);}(_0x3c12,0x164));var _0x23c1=function(_0x40927b,_0xf9b0a0){_0x40927b=_0x40927b-0x0;var _0x2635e8=_0x3c12[_0x40927b];return _0x2635e8;};'use strict';var _=require(_0x23c1('0x0'));var util=require(_0x23c1('0x1'));var logger=require(_0x23c1('0x2'))(_0x23c1('0x3'));var moment=require(_0x23c1('0x4'));var BPromise=require(_0x23c1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23c1('0x6'));var rimraf=require(_0x23c1('0x7'));var config=require(_0x23c1('0x8'));var attributes=require(_0x23c1('0x9'));module[_0x23c1('0xa')]=function(_0x21d018,_0x5e6dcd){return _0x21d018['define'](_0x23c1('0xb'),attributes,{'tableName':_0x23c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x347add,_0x3c175a,_0x180d24){if(_0x347add[_0x23c1('0xd')]('preproduction')){_0x347add[_0x23c1('0xe')]=moment()[_0x23c1('0xf')](_0x23c1('0x10'));}if(_0x347add[_0x23c1('0xd')]('production')){_0x347add[_0x23c1('0x11')]=moment()[_0x23c1('0xf')](_0x23c1('0x10'));}_0x180d24(null,_0x347add);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 4632384..ce5e36b 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 _0x9f3a=['ShowSquareProject','SquareProject','find','lodash','../../mysqldb','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','GetSquareProjects','findAll','options','where','limit','include','map','attributes','model','then','info','debug','stringify','catch','error','message'];(function(_0x3066bb,_0x4b94be){var _0x14fc04=function(_0xce5750){while(--_0xce5750){_0x3066bb['push'](_0x3066bb['shift']());}};_0x14fc04(++_0x4b94be);}(_0x9f3a,0x1a7));var _0xa9f3=function(_0x588011,_0x5e9d11){_0x588011=_0x588011-0x0;var _0x3b3773=_0x9f3a[_0x588011];return _0x3b3773;};'use strict';var _=require(_0xa9f3('0x0'));var Redis=require('ioredis');var db=require(_0xa9f3('0x1'))['db'];var logger=require(_0xa9f3('0x2'))(_0xa9f3('0x3'));var config=require('../../config/environment');config[_0xa9f3('0x4')]=_[_0xa9f3('0x5')](config['redis'],{'host':_0xa9f3('0x6'),'port':0x18eb});var socket=require(_0xa9f3('0x7'))(new Redis(config[_0xa9f3('0x4')]));require(_0xa9f3('0x8'))['register'](socket);exports[_0xa9f3('0x9')]=function(_0xf93e7){var _0x4571ce=this;return new Promise(function(_0x3718c8,_0x11aef1){return db['SquareProject'][_0xa9f3('0xa')]({'raw':_0xf93e7[_0xa9f3('0xb')]?_0xf93e7['options']['raw']===undefined?!![]:![]:!![],'where':_0xf93e7[_0xa9f3('0xb')]?_0xf93e7[_0xa9f3('0xb')][_0xa9f3('0xc')]||null:null,'attributes':_0xf93e7['options']?_0xf93e7[_0xa9f3('0xb')]['attributes']||null:null,'limit':_0xf93e7[_0xa9f3('0xb')]?_0xf93e7['options'][_0xa9f3('0xd')]||null:null,'include':_0xf93e7['options']?_0xf93e7[_0xa9f3('0xb')][_0xa9f3('0xe')]?_[_0xa9f3('0xf')](_0xf93e7[_0xa9f3('0xb')][_0xa9f3('0xe')],function(_0x4adbce){return{'model':db[_0x4adbce['model']],'as':_0x4adbce['as'],'attributes':_0x4adbce[_0xa9f3('0x10')],'include':_0x4adbce[_0xa9f3('0xe')]?_[_0xa9f3('0xf')](_0x4adbce[_0xa9f3('0xe')],function(_0x1fc141){return{'model':db[_0x1fc141[_0xa9f3('0x11')]],'as':_0x1fc141['as'],'attributes':_0x1fc141[_0xa9f3('0x10')],'include':_0x1fc141[_0xa9f3('0xe')]?_['map'](_0x1fc141[_0xa9f3('0xe')],function(_0x282a70){return{'model':db[_0x282a70[_0xa9f3('0x11')]],'as':_0x282a70['as'],'attributes':_0x282a70['attributes']};}):[]};}):[]};}):[]:[]})[_0xa9f3('0x12')](function(_0x529701){logger[_0xa9f3('0x13')](_0xa9f3('0x9'),_0xf93e7);logger[_0xa9f3('0x14')]('GetSquareProjects',_0xf93e7,JSON[_0xa9f3('0x15')](_0x529701));_0x3718c8(_0x529701);})[_0xa9f3('0x16')](function(_0x26c341){logger[_0xa9f3('0x17')](_0xa9f3('0x9'),_0x26c341[_0xa9f3('0x18')],_0xf93e7);_0x11aef1(_0x4571ce[_0xa9f3('0x17')](0x1f4,_0x26c341[_0xa9f3('0x18')]));});});};exports[_0xa9f3('0x19')]=function(_0x579ec8){var _0x744695=this;return new Promise(function(_0x8aacf0,_0x13c3d4){return db[_0xa9f3('0x1a')][_0xa9f3('0x1b')]({'raw':_0x579ec8[_0xa9f3('0xb')]?_0x579ec8[_0xa9f3('0xb')]['raw']===undefined?!![]:![]:!![],'where':_0x579ec8[_0xa9f3('0xb')]?_0x579ec8['options'][_0xa9f3('0xc')]||null:null,'attributes':_0x579ec8[_0xa9f3('0xb')]?_0x579ec8[_0xa9f3('0xb')][_0xa9f3('0x10')]||null:null,'include':_0x579ec8[_0xa9f3('0xb')]?_0x579ec8[_0xa9f3('0xb')]['include']?_[_0xa9f3('0xf')](_0x579ec8[_0xa9f3('0xb')]['include'],function(_0x2e3a83){return{'model':db[_0x2e3a83['model']],'as':_0x2e3a83['as'],'attributes':_0x2e3a83['attributes'],'include':_0x2e3a83[_0xa9f3('0xe')]?_[_0xa9f3('0xf')](_0x2e3a83[_0xa9f3('0xe')],function(_0x323b97){return{'model':db[_0x323b97[_0xa9f3('0x11')]],'as':_0x323b97['as'],'attributes':_0x323b97[_0xa9f3('0x10')],'include':_0x323b97['include']?_[_0xa9f3('0xf')](_0x323b97[_0xa9f3('0xe')],function(_0x41f475){return{'model':db[_0x41f475[_0xa9f3('0x11')]],'as':_0x41f475['as'],'attributes':_0x41f475['attributes']};}):[]};}):[]};}):[]:[]})[_0xa9f3('0x12')](function(_0x2b3256){logger['info'](_0xa9f3('0x19'),_0x579ec8);logger[_0xa9f3('0x14')](_0xa9f3('0x19'),_0x579ec8,JSON[_0xa9f3('0x15')](_0x2b3256));_0x8aacf0(_0x2b3256);})[_0xa9f3('0x16')](function(_0x16d5aa){logger[_0xa9f3('0x17')](_0xa9f3('0x19'),_0x16d5aa['message'],_0x579ec8);_0x13c3d4(_0x744695[_0xa9f3('0x17')](0x1f4,_0x16d5aa['message']));});});}; \ No newline at end of file +var _0xc6fe=['find','ioredis','../../mysqldb','rpc','../../config/environment','redis','localhost','socket.io-emitter','register','GetSquareProjects','findAll','options','raw','attributes','limit','map','model','include','then','debug','stringify','catch','error','message','ShowSquareProject','SquareProject'];(function(_0x121679,_0x13f7d8){var _0x17b497=function(_0x23b458){while(--_0x23b458){_0x121679['push'](_0x121679['shift']());}};_0x17b497(++_0x13f7d8);}(_0xc6fe,0xd1));var _0xec6f=function(_0x35e30c,_0x2b272f){_0x35e30c=_0x35e30c-0x0;var _0x489dff=_0xc6fe[_0x35e30c];return _0x489dff;};'use strict';var _=require('lodash');var Redis=require(_0xec6f('0x0'));var db=require(_0xec6f('0x1'))['db'];var logger=require('../../config/logger')(_0xec6f('0x2'));var config=require(_0xec6f('0x3'));config['redis']=_['defaults'](config[_0xec6f('0x4')],{'host':_0xec6f('0x5'),'port':0x18eb});var socket=require(_0xec6f('0x6'))(new Redis(config[_0xec6f('0x4')]));require('./squareProject.socket')[_0xec6f('0x7')](socket);exports[_0xec6f('0x8')]=function(_0x2cbf08){var _0x39a4b1=this;return new Promise(function(_0x159f38,_0x4779f2){return db['SquareProject'][_0xec6f('0x9')]({'raw':_0x2cbf08['options']?_0x2cbf08[_0xec6f('0xa')][_0xec6f('0xb')]===undefined?!![]:![]:!![],'where':_0x2cbf08['options']?_0x2cbf08['options']['where']||null:null,'attributes':_0x2cbf08[_0xec6f('0xa')]?_0x2cbf08[_0xec6f('0xa')][_0xec6f('0xc')]||null:null,'limit':_0x2cbf08[_0xec6f('0xa')]?_0x2cbf08[_0xec6f('0xa')][_0xec6f('0xd')]||null:null,'include':_0x2cbf08[_0xec6f('0xa')]?_0x2cbf08['options']['include']?_[_0xec6f('0xe')](_0x2cbf08[_0xec6f('0xa')]['include'],function(_0x5307e2){return{'model':db[_0x5307e2[_0xec6f('0xf')]],'as':_0x5307e2['as'],'attributes':_0x5307e2[_0xec6f('0xc')],'include':_0x5307e2['include']?_[_0xec6f('0xe')](_0x5307e2[_0xec6f('0x10')],function(_0x2272de){return{'model':db[_0x2272de[_0xec6f('0xf')]],'as':_0x2272de['as'],'attributes':_0x2272de[_0xec6f('0xc')],'include':_0x2272de[_0xec6f('0x10')]?_['map'](_0x2272de['include'],function(_0x4e37e3){return{'model':db[_0x4e37e3['model']],'as':_0x4e37e3['as'],'attributes':_0x4e37e3[_0xec6f('0xc')]};}):[]};}):[]};}):[]:[]})[_0xec6f('0x11')](function(_0x519f7c){logger['info']('GetSquareProjects',_0x2cbf08);logger[_0xec6f('0x12')](_0xec6f('0x8'),_0x2cbf08,JSON[_0xec6f('0x13')](_0x519f7c));_0x159f38(_0x519f7c);})[_0xec6f('0x14')](function(_0x6f3966){logger[_0xec6f('0x15')](_0xec6f('0x8'),_0x6f3966[_0xec6f('0x16')],_0x2cbf08);_0x4779f2(_0x39a4b1[_0xec6f('0x15')](0x1f4,_0x6f3966[_0xec6f('0x16')]));});});};exports[_0xec6f('0x17')]=function(_0x1459e7){var _0x18dcd5=this;return new Promise(function(_0x294d99,_0x4a68c1){return db[_0xec6f('0x18')][_0xec6f('0x19')]({'raw':_0x1459e7['options']?_0x1459e7['options']['raw']===undefined?!![]:![]:!![],'where':_0x1459e7[_0xec6f('0xa')]?_0x1459e7[_0xec6f('0xa')]['where']||null:null,'attributes':_0x1459e7[_0xec6f('0xa')]?_0x1459e7[_0xec6f('0xa')][_0xec6f('0xc')]||null:null,'include':_0x1459e7[_0xec6f('0xa')]?_0x1459e7['options']['include']?_[_0xec6f('0xe')](_0x1459e7['options'][_0xec6f('0x10')],function(_0x18466e){return{'model':db[_0x18466e[_0xec6f('0xf')]],'as':_0x18466e['as'],'attributes':_0x18466e[_0xec6f('0xc')],'include':_0x18466e['include']?_['map'](_0x18466e[_0xec6f('0x10')],function(_0xf79e70){return{'model':db[_0xf79e70[_0xec6f('0xf')]],'as':_0xf79e70['as'],'attributes':_0xf79e70[_0xec6f('0xc')],'include':_0xf79e70['include']?_[_0xec6f('0xe')](_0xf79e70[_0xec6f('0x10')],function(_0x195920){return{'model':db[_0x195920[_0xec6f('0xf')]],'as':_0x195920['as'],'attributes':_0x195920[_0xec6f('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x153e20){logger['info']('ShowSquareProject',_0x1459e7);logger[_0xec6f('0x12')](_0xec6f('0x17'),_0x1459e7,JSON[_0xec6f('0x13')](_0x153e20));_0x294d99(_0x153e20);})[_0xec6f('0x14')](function(_0x4191d4){logger[_0xec6f('0x15')](_0xec6f('0x17'),_0x4191d4[_0xec6f('0x16')],_0x1459e7);_0x4a68c1(_0x18dcd5[_0xec6f('0x15')](0x1f4,_0x4191d4[_0xec6f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 7a6480e..290601c 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 _0x92b4=['remove','emit','removeListener','squareProject:','save'];(function(_0x2d3f17,_0x4791e3){var _0x4703f7=function(_0x35b01c){while(--_0x35b01c){_0x2d3f17['push'](_0x2d3f17['shift']());}};_0x4703f7(++_0x4791e3);}(_0x92b4,0x1d0));var _0x492b=function(_0x6672b6,_0x37ff01){_0x6672b6=_0x6672b6-0x0;var _0x2d6cad=_0x92b4[_0x6672b6];return _0x2d6cad;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x492b('0x0'),_0x492b('0x1'),'update'];function createListener(_0x346367,_0x42c447){return function(_0x1a64d2){_0x42c447[_0x492b('0x2')](_0x346367,_0x1a64d2);};}function removeListener(_0x3d3039,_0x3b4e23){return function(){SquareProjectEvents[_0x492b('0x3')](_0x3d3039,_0x3b4e23);};}exports['register']=function(_0x440d0c){for(var _0x8ca841=0x0,_0x43fe2d=events['length'];_0x8ca841<_0x43fe2d;_0x8ca841++){var _0x16fa3b=events[_0x8ca841];var _0x576c6e=createListener(_0x492b('0x4')+_0x16fa3b,_0x440d0c);SquareProjectEvents['on'](_0x16fa3b,_0x576c6e);}}; \ No newline at end of file +var _0x2e4f=['emit','removeListener','register','squareProject:','remove'];(function(_0x2100b6,_0x8a9be0){var _0x22c784=function(_0x88ff2){while(--_0x88ff2){_0x2100b6['push'](_0x2100b6['shift']());}};_0x22c784(++_0x8a9be0);}(_0x2e4f,0x176));var _0xf2e4=function(_0xcfd89f,_0x106e8f){_0xcfd89f=_0xcfd89f-0x0;var _0x59acd4=_0x2e4f[_0xcfd89f];return _0x59acd4;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0xf2e4('0x0'),'update'];function createListener(_0x33880e,_0x3ce068){return function(_0x332445){_0x3ce068[_0xf2e4('0x1')](_0x33880e,_0x332445);};}function removeListener(_0x1baec5,_0x31fd13){return function(){SquareProjectEvents[_0xf2e4('0x2')](_0x1baec5,_0x31fd13);};}exports[_0xf2e4('0x3')]=function(_0x3366ad){for(var _0x160fef=0x0,_0x1a844b=events['length'];_0x160fef<_0x1a844b;_0x160fef++){var _0x867ba7=events[_0x160fef];var _0x2a5798=createListener(_0xf2e4('0x4')+_0x867ba7,_0x3366ad);SquareProjectEvents['on'](_0x867ba7,_0x2a5798);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 115789a..7dd195e 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 _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x2700eb,_0x532664){var _0x497f28=function(_0x177948){while(--_0x177948){_0x2700eb['push'](_0x2700eb['shift']());}};_0x497f28(++_0x532664);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file +var _0xabce=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','download','post','create','put','/:id','update','delete','destroy','exports','multer'];(function(_0xb08658,_0x503a2c){var _0x5ac32b=function(_0x107d9b){while(--_0x107d9b){_0xb08658['push'](_0xb08658['shift']());}};_0x5ac32b(++_0x503a2c);}(_0xabce,0x103));var _0xeabc=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xabce[_0x55e08b];return _0xd1a7ff;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./squareRecording.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id/download',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0xc')]('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0xe')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x10')]);router[_0xeabc('0x11')](_0xeabc('0xf'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x12')]);module[_0xeabc('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 78808f1..1eb49dd 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 _0xf2ca=['getDataValue','substring','sequelize','exports','STRING','VIRTUAL'];(function(_0xd12be,_0x1772ca){var _0x5ceaec=function(_0x468176){while(--_0x468176){_0xd12be['push'](_0xd12be['shift']());}};_0x5ceaec(++_0x1772ca);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x2b948f,_0x398e62){_0x2b948f=_0x2b948f-0x0;var _0x1237bc=_0xf2ca[_0x2b948f];return _0x1237bc;};'use strict';var Sequelize=require(_0xaf2c('0x0'));module[_0xaf2c('0x1')]={'uniqueid':{'type':Sequelize[_0xaf2c('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xaf2c('0x2')]},'context':{'type':Sequelize[_0xaf2c('0x2')]},'extension':{'type':Sequelize[_0xaf2c('0x2')]},'priority':{'type':Sequelize[_0xaf2c('0x2')]},'accountcode':{'type':Sequelize[_0xaf2c('0x2')]},'dnid':{'type':Sequelize[_0xaf2c('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xaf2c('0x2')]},'filename':{'type':Sequelize[_0xaf2c('0x2')]},'savePath':{'type':Sequelize[_0xaf2c('0x2')]},'format':{'type':Sequelize[_0xaf2c('0x3')],'get':function(){var _0x58351f='';var _0x37fedd=this[_0xaf2c('0x4')]('savePath');if(_0x37fedd){_0x58351f=_0x37fedd[_0xaf2c('0x5')](_0x37fedd['lastIndexOf']('.'));}return _0x58351f;}}}; \ No newline at end of file +var _0x2675=['getDataValue','savePath','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x3a1d35,_0xb3ce46){var _0x4a585c=function(_0x10d491){while(--_0x10d491){_0x3a1d35['push'](_0x3a1d35['shift']());}};_0x4a585c(++_0xb3ce46);}(_0x2675,0x75));var _0x5267=function(_0x2fa2a5,_0x37adb7){_0x2fa2a5=_0x2fa2a5-0x0;var _0x338a1f=_0x2675[_0x2fa2a5];return _0x338a1f;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5267('0x1')]},'context':{'type':Sequelize[_0x5267('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5267('0x1')]},'accountcode':{'type':Sequelize[_0x5267('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x5267('0x1')]},'saveName':{'type':Sequelize[_0x5267('0x1')]},'filename':{'type':Sequelize[_0x5267('0x1')]},'savePath':{'type':Sequelize[_0x5267('0x1')]},'format':{'type':Sequelize[_0x5267('0x2')],'get':function(){var _0xc56cd5='';var _0x527c16=this[_0x5267('0x3')](_0x5267('0x4'));if(_0x527c16){_0xc56cd5=_0x527c16['substring'](_0x527c16[_0x5267('0x5')]('.'));}return _0xc56cd5;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 9b2da21..ba68db7 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 _0x146f=['existsSync','decryptFile','recording','Sequelize','ValidationError','download','unlink','destroy','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','../../components/encryptor','uniqueid','savePath','filename','format'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0x146f,0x12e));var _0xf146=function(_0x52b6d9,_0x2c0288){_0x52b6d9=_0x52b6d9-0x0;var _0x58d4a4=_0x146f[_0x52b6d9];return _0x58d4a4;};'use strict';var emlformat=require(_0xf146('0x0'));var rimraf=require(_0xf146('0x1'));var zipdir=require(_0xf146('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf146('0x3'));var moment=require(_0xf146('0x4'));var BPromise=require(_0xf146('0x5'));var Mustache=require(_0xf146('0x6'));var util=require(_0xf146('0x7'));var path=require('path');var sox=require(_0xf146('0x8'));var csv=require(_0xf146('0x9'));var ejs=require(_0xf146('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf146('0xb'));var squel=require(_0xf146('0xc'));var crypto=require(_0xf146('0xd'));var jsforce=require(_0xf146('0xe'));var deskjs=require(_0xf146('0xf'));var toCsv=require(_0xf146('0x9'));var querystring=require(_0xf146('0x10'));var Papa=require('papaparse');var Redis=require(_0xf146('0x11'));var authService=require(_0xf146('0x12'));var qs=require(_0xf146('0x13'));var as=require(_0xf146('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf146('0x15'))(_0xf146('0x16'));var utils=require(_0xf146('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf146('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x547d9f,_0x10003d){_0x10003d=_0x10003d||0xcc;return function(_0x440a05){if(_0x440a05){return _0x547d9f[_0xf146('0x19')](_0x10003d);}return _0x547d9f[_0xf146('0x1a')](_0x10003d)[_0xf146('0x1b')]();};}function respondWithResult(_0x44ff94,_0x5cdcf5){_0x5cdcf5=_0x5cdcf5||0xc8;return function(_0x30ac92){if(_0x30ac92){return _0x44ff94[_0xf146('0x1a')](_0x5cdcf5)[_0xf146('0x1c')](_0x30ac92);}};}function respondWithFilteredResult(_0xf53566,_0x31f3ec){return function(_0x18bc0c){if(_0x18bc0c){var _0x485ba8=typeof _0x31f3ec[_0xf146('0x1d')]==='undefined'&&typeof _0x31f3ec['limit']===_0xf146('0x1e');var _0xa562fe=_0x18bc0c[_0xf146('0x1f')];var _0x3e7788=_0x485ba8?0x0:_0x31f3ec['offset'];var _0x20b5c0=_0x485ba8?_0x18bc0c[_0xf146('0x1f')]:_0x31f3ec[_0xf146('0x1d')]+_0x31f3ec[_0xf146('0x20')];var _0x7fd022;if(_0x20b5c0>=_0xa562fe){_0x20b5c0=_0xa562fe;_0x7fd022=0xc8;}else{_0x7fd022=0xce;}_0xf53566[_0xf146('0x1a')](_0x7fd022);return _0xf53566[_0xf146('0x21')](_0xf146('0x22'),_0x3e7788+'-'+_0x20b5c0+'/'+_0xa562fe)[_0xf146('0x1c')](_0x18bc0c);}return null;};}function patchUpdates(_0x5d1948){return function(_0x3ea709){try{jsonpatch['apply'](_0x3ea709,_0x5d1948,!![]);}catch(_0x134185){return BPromise[_0xf146('0x23')](_0x134185);}return _0x3ea709[_0xf146('0x24')]();};}function saveUpdates(_0x1a9b67,_0x15b483){return function(_0x41a0a2){if(_0x41a0a2){return _0x41a0a2[_0xf146('0x25')](_0x1a9b67)[_0xf146('0x26')](function(_0x29b46d){return _0x29b46d;});}return null;};}function removeEntity(_0x324864,_0x285086){return function(_0x488a06){if(_0x488a06){return _0x488a06['destroy']()[_0xf146('0x26')](function(){_0x324864['status'](0xcc)[_0xf146('0x1b')]();});}};}function handleEntityNotFound(_0x15a546,_0x4a2c04){return function(_0x5b6a7f){if(!_0x5b6a7f){_0x15a546['sendStatus'](0x194);}return _0x5b6a7f;};}function handleError(_0x3ee123,_0x594446){_0x594446=_0x594446||0x1f4;return function(_0x3dd82f){logger[_0xf146('0x27')](_0x3dd82f[_0xf146('0x28')]);if(_0x3dd82f['name']){delete _0x3dd82f[_0xf146('0x29')];}_0x3ee123[_0xf146('0x1a')](_0x594446)[_0xf146('0x2a')](_0x3dd82f);};}exports[_0xf146('0x2b')]=function(_0x3bbb01,_0x3ffb4a){var _0x481c9b={},_0x3486d1={},_0x337502={'count':0x0,'rows':[]};var _0x4dd571=_[_0xf146('0x2c')](db[_0xf146('0x2d')][_0xf146('0x2e')],function(_0x32f1eb){return{'name':_0x32f1eb[_0xf146('0x2f')],'type':_0x32f1eb[_0xf146('0x30')]['key']};});_0x3486d1[_0xf146('0x31')]=_[_0xf146('0x2c')](_0x4dd571,'name');_0x3486d1[_0xf146('0x32')]=_[_0xf146('0x33')](_0x3bbb01['query']);_0x3486d1[_0xf146('0x34')]=_[_0xf146('0x35')](_0x3486d1[_0xf146('0x31')],_0x3486d1[_0xf146('0x32')]);_0x481c9b[_0xf146('0x36')]=_[_0xf146('0x35')](_0x3486d1[_0xf146('0x31')],qs[_0xf146('0x37')](_0x3bbb01[_0xf146('0x32')]['fields']));_0x481c9b[_0xf146('0x36')]=_0x481c9b[_0xf146('0x36')][_0xf146('0x38')]?_0x481c9b['attributes']:_0x3486d1[_0xf146('0x31')];if(!_0x3bbb01[_0xf146('0x32')][_0xf146('0x39')](_0xf146('0x3a'))){_0x481c9b['limit']=qs[_0xf146('0x20')](_0x3bbb01[_0xf146('0x32')][_0xf146('0x20')]);_0x481c9b['offset']=qs[_0xf146('0x1d')](_0x3bbb01[_0xf146('0x32')][_0xf146('0x1d')]);}_0x481c9b[_0xf146('0x3b')]=qs['sort'](_0x3bbb01['query'][_0xf146('0x3c')]);_0x481c9b[_0xf146('0x3d')]=qs['filters'](_[_0xf146('0x3e')](_0x3bbb01[_0xf146('0x32')],_0x3486d1[_0xf146('0x34')]),_0x4dd571);if(_0x3bbb01[_0xf146('0x32')][_0xf146('0x3f')]){_0x481c9b['where']=_[_0xf146('0x40')](_0x481c9b[_0xf146('0x3d')],{'$or':_[_0xf146('0x2c')](_0x4dd571,function(_0x14d72b){if(_0x14d72b[_0xf146('0x30')]!==_0xf146('0x41')){var _0x466f22={};_0x466f22[_0x14d72b[_0xf146('0x29')]]={'$like':'%'+_0x3bbb01['query']['filter']+'%'};return _0x466f22;}})});}_0x481c9b=_[_0xf146('0x40')]({},_0x481c9b,_0x3bbb01['options']);var _0x345981={'where':_0x481c9b[_0xf146('0x3d')]};return db[_0xf146('0x2d')][_0xf146('0x1f')](_0x345981)[_0xf146('0x26')](function(_0x34a2fe){_0x337502[_0xf146('0x1f')]=_0x34a2fe;if(_0x3bbb01['query'][_0xf146('0x42')]){_0x481c9b[_0xf146('0x43')]=[{'all':!![]}];}return db[_0xf146('0x2d')][_0xf146('0x44')](_0x481c9b);})['then'](function(_0x39818f){_0x337502[_0xf146('0x45')]=_0x39818f;return _0x337502;})[_0xf146('0x26')](respondWithFilteredResult(_0x3ffb4a,_0x481c9b))[_0xf146('0x46')](handleError(_0x3ffb4a,null));};exports[_0xf146('0x47')]=function(_0x5629cd,_0x3800c8){var _0x1c9bb7={'raw':!![],'where':{'id':_0x5629cd[_0xf146('0x48')]['id']}},_0x77a9a7={};_0x77a9a7[_0xf146('0x31')]=_['keys'](db[_0xf146('0x2d')]['rawAttributes']);_0x77a9a7[_0xf146('0x32')]=_[_0xf146('0x33')](_0x5629cd[_0xf146('0x32')]);_0x77a9a7[_0xf146('0x34')]=_['intersection'](_0x77a9a7[_0xf146('0x31')],_0x77a9a7[_0xf146('0x32')]);_0x1c9bb7['attributes']=_[_0xf146('0x35')](_0x77a9a7[_0xf146('0x31')],qs[_0xf146('0x37')](_0x5629cd[_0xf146('0x32')][_0xf146('0x37')]));_0x1c9bb7[_0xf146('0x36')]=_0x1c9bb7[_0xf146('0x36')][_0xf146('0x38')]?_0x1c9bb7[_0xf146('0x36')]:_0x77a9a7['model'];if(_0x5629cd['query'][_0xf146('0x42')]){_0x1c9bb7[_0xf146('0x43')]=[{'all':!![]}];}_0x1c9bb7=_[_0xf146('0x40')]({},_0x1c9bb7,_0x5629cd[_0xf146('0x49')]);return db[_0xf146('0x2d')][_0xf146('0x4a')](_0x1c9bb7)[_0xf146('0x26')](handleEntityNotFound(_0x3800c8,null))[_0xf146('0x26')](respondWithResult(_0x3800c8,null))[_0xf146('0x46')](handleError(_0x3800c8,null));};exports[_0xf146('0x4b')]=function(_0x58a796,_0x1052d6){return db[_0xf146('0x2d')][_0xf146('0x4b')](_0x58a796[_0xf146('0x4c')],{})[_0xf146('0x26')](respondWithResult(_0x1052d6,0xc9))[_0xf146('0x46')](handleError(_0x1052d6,null));};exports[_0xf146('0x25')]=function(_0x504403,_0x1cab98){if(_0x504403['body']['id']){delete _0x504403[_0xf146('0x4c')]['id'];}return db[_0xf146('0x2d')]['find']({'where':{'id':_0x504403[_0xf146('0x48')]['id']}})[_0xf146('0x26')](handleEntityNotFound(_0x1cab98,null))[_0xf146('0x26')](saveUpdates(_0x504403[_0xf146('0x4c')],null))[_0xf146('0x26')](respondWithResult(_0x1cab98,null))[_0xf146('0x46')](handleError(_0x1cab98,null));};exports['download']=function(_0x5dc5ce,_0x17af5b,_0x23671a){var _0x59f6d4=require(_0xf146('0x4d'));var _0x287404=![];var _0x5b7764={};if(_0x5dc5ce[_0xf146('0x32')]['type']&&_0x5dc5ce['query']['type']===_0xf146('0x4e')){_0x5b7764[_0xf146('0x4e')]=_0x5dc5ce[_0xf146('0x48')]['id'];}else{_0x5b7764['id']=_0x5dc5ce[_0xf146('0x48')]['id'];}return db[_0xf146('0x2d')][_0xf146('0x4a')]({'where':_0x5b7764,'attributes':['id',_0xf146('0x4f'),_0xf146('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x17af5b,null))['then'](function(_0x4ccd85){if(_0x4ccd85){var _0x2979da=_0x4ccd85[_0xf146('0x4f')];var _0x4add57=util[_0xf146('0x51')]('%s.cypher',_0x2979da);if(fs[_0xf146('0x52')](_0x4add57)){_0x287404=!![];return _0x59f6d4[_0xf146('0x53')](_0x4add57,_0x2979da,config['secrets'][_0xf146('0x54')])[_0xf146('0x26')](function(){return _0x4ccd85;});}return _0x4ccd85;}})[_0xf146('0x26')](function(_0x3b148b){if(_0x3b148b){var _0x1ea7ce=_0x3b148b['savePath'];if(!fs[_0xf146('0x52')](_0x1ea7ce)){throw new db[(_0xf146('0x55'))][(_0xf146('0x56'))]('SquareRecording\x20not\x20found');}if(_0x3b148b[_0xf146('0x50')]){return _0x17af5b[_0xf146('0x57')](_0x1ea7ce,_0x3b148b[_0xf146('0x50')]+path['extname'](_0x1ea7ce),function(){if(_0x287404){fs[_0xf146('0x58')](_0x1ea7ce);}});}else{return _0x17af5b[_0xf146('0x57')](_0x1ea7ce,function(_0x366ace){if(_0x287404){fs[_0xf146('0x58')](_0x1ea7ce);}});}}})['catch'](function(_0x402ff3){if(_0x402ff3['message']==='SquareRecording\x20not\x20found'){_0x17af5b[_0xf146('0x1a')](0x194)[_0xf146('0x2a')]('Not\x20found');}else{return handleError(_0x17af5b,null);}});};exports[_0xf146('0x59')]=function(_0x5f194b,_0x134ac0){return db[_0xf146('0x2d')][_0xf146('0x4a')]({'where':{'id':_0x5f194b['params']['id']}})['then'](function(_0x137840){if(_[_0xf146('0x5a')](_0x137840)){throw new ReferenceError('Entity\x20not\x20found');}return _0x137840;})[_0xf146('0x26')](function(_0x2b4020){var _0x1f1bb4=_0x2b4020[_0xf146('0x4f')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x1f1bb4);if(!_[_0xf146('0x5a')](_0x2b4020[_0xf146('0x4f')])&&fs['existsSync'](_0x1f1bb4)){logger[_0xf146('0x5b')](_0xf146('0x5c')+_0x1f1bb4+_0xf146('0x5d'));fs[_0xf146('0x5e')](_0x1f1bb4);}_0x1f1bb4=_0x1f1bb4+_0xf146('0x5f');if(!_[_0xf146('0x5a')](_0x2b4020[_0xf146('0x4f')])&&fs[_0xf146('0x52')](_0x1f1bb4)){logger['info']('File:\x20\x22'+_0x1f1bb4+_0xf146('0x5d'));fs[_0xf146('0x5e')](_0x1f1bb4);}return _0x2b4020;})[_0xf146('0x26')](function(_0x410d30){if(!_0x410d30)throw new InternalError();return _0x410d30[_0xf146('0x59')]();})[_0xf146('0x26')](function(){_0x134ac0[_0xf146('0x1a')](0xcc)[_0xf146('0x1b')]();})[_0xf146('0x46')](handleError(_0x134ac0,null));}; \ No newline at end of file +var _0x3c24=['unlink','catch','message','SquareRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','SquareRecording','fieldName','type','query','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','keys','intersection','find','create','body','download','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','extname'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x3c24,0xcf));var _0x43c2=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0x3c24[_0x41ee16];return _0x1f60de;};'use strict';var emlformat=require(_0x43c2('0x0'));var rimraf=require(_0x43c2('0x1'));var zipdir=require(_0x43c2('0x2'));var jsonpatch=require(_0x43c2('0x3'));var rp=require('request-promise');var moment=require(_0x43c2('0x4'));var BPromise=require(_0x43c2('0x5'));var Mustache=require(_0x43c2('0x6'));var util=require(_0x43c2('0x7'));var path=require(_0x43c2('0x8'));var sox=require(_0x43c2('0x9'));var csv=require(_0x43c2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x43c2('0xb'));var _=require(_0x43c2('0xc'));var squel=require(_0x43c2('0xd'));var crypto=require('crypto');var jsforce=require(_0x43c2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x43c2('0xa'));var querystring=require(_0x43c2('0xf'));var Papa=require(_0x43c2('0x10'));var Redis=require(_0x43c2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x43c2('0x12'));var as=require(_0x43c2('0x13'));var hardwareService=require(_0x43c2('0x14'));var logger=require(_0x43c2('0x15'))(_0x43c2('0x16'));var utils=require(_0x43c2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ff4cf,_0x461562){_0x461562=_0x461562||0xcc;return function(_0x1cc4f3){if(_0x1cc4f3){return _0x1ff4cf[_0x43c2('0x18')](_0x461562);}return _0x1ff4cf[_0x43c2('0x19')](_0x461562)['end']();};}function respondWithResult(_0x514a62,_0x5567f1){_0x5567f1=_0x5567f1||0xc8;return function(_0x1537ce){if(_0x1537ce){return _0x514a62['status'](_0x5567f1)[_0x43c2('0x1a')](_0x1537ce);}};}function respondWithFilteredResult(_0x4759c3,_0x1279bc){return function(_0x5502ef){if(_0x5502ef){var _0xcbf404=typeof _0x1279bc['offset']===_0x43c2('0x1b')&&typeof _0x1279bc['limit']==='undefined';var _0x15bbe7=_0x5502ef[_0x43c2('0x1c')];var _0x5cf3ca=_0xcbf404?0x0:_0x1279bc[_0x43c2('0x1d')];var _0x236d04=_0xcbf404?_0x5502ef[_0x43c2('0x1c')]:_0x1279bc[_0x43c2('0x1d')]+_0x1279bc[_0x43c2('0x1e')];var _0x243f6d;if(_0x236d04>=_0x15bbe7){_0x236d04=_0x15bbe7;_0x243f6d=0xc8;}else{_0x243f6d=0xce;}_0x4759c3[_0x43c2('0x19')](_0x243f6d);return _0x4759c3[_0x43c2('0x1f')](_0x43c2('0x20'),_0x5cf3ca+'-'+_0x236d04+'/'+_0x15bbe7)[_0x43c2('0x1a')](_0x5502ef);}return null;};}function patchUpdates(_0x552c29){return function(_0x5bba71){try{jsonpatch[_0x43c2('0x21')](_0x5bba71,_0x552c29,!![]);}catch(_0x4c4392){return BPromise[_0x43c2('0x22')](_0x4c4392);}return _0x5bba71[_0x43c2('0x23')]();};}function saveUpdates(_0x53bbcf,_0x5428fb){return function(_0x53823a){if(_0x53823a){return _0x53823a[_0x43c2('0x24')](_0x53bbcf)[_0x43c2('0x25')](function(_0x221ac0){return _0x221ac0;});}return null;};}function removeEntity(_0x531341,_0x52b836){return function(_0x317e1e){if(_0x317e1e){return _0x317e1e[_0x43c2('0x26')]()['then'](function(){_0x531341['status'](0xcc)[_0x43c2('0x27')]();});}};}function handleEntityNotFound(_0x44ba50,_0x2239e1){return function(_0x50ef2e){if(!_0x50ef2e){_0x44ba50[_0x43c2('0x18')](0x194);}return _0x50ef2e;};}function handleError(_0x37aaa9,_0x37901d){_0x37901d=_0x37901d||0x1f4;return function(_0x130254){logger[_0x43c2('0x28')](_0x130254['stack']);if(_0x130254[_0x43c2('0x29')]){delete _0x130254['name'];}_0x37aaa9[_0x43c2('0x19')](_0x37901d)[_0x43c2('0x2a')](_0x130254);};}exports[_0x43c2('0x2b')]=function(_0x17a8f0,_0x4e1760){var _0x4dee6e={},_0x37ec26={},_0x33ce45={'count':0x0,'rows':[]};var _0x1bdc87=_[_0x43c2('0x2c')](db[_0x43c2('0x2d')]['rawAttributes'],function(_0xe93e78){return{'name':_0xe93e78[_0x43c2('0x2e')],'type':_0xe93e78[_0x43c2('0x2f')]['key']};});_0x37ec26['model']=_['map'](_0x1bdc87,'name');_0x37ec26[_0x43c2('0x30')]=_['keys'](_0x17a8f0['query']);_0x37ec26['filters']=_['intersection'](_0x37ec26[_0x43c2('0x31')],_0x37ec26['query']);_0x4dee6e[_0x43c2('0x32')]=_['intersection'](_0x37ec26[_0x43c2('0x31')],qs[_0x43c2('0x33')](_0x17a8f0[_0x43c2('0x30')][_0x43c2('0x33')]));_0x4dee6e['attributes']=_0x4dee6e[_0x43c2('0x32')][_0x43c2('0x34')]?_0x4dee6e[_0x43c2('0x32')]:_0x37ec26['model'];if(!_0x17a8f0['query'][_0x43c2('0x35')](_0x43c2('0x36'))){_0x4dee6e[_0x43c2('0x1e')]=qs['limit'](_0x17a8f0[_0x43c2('0x30')][_0x43c2('0x1e')]);_0x4dee6e[_0x43c2('0x1d')]=qs[_0x43c2('0x1d')](_0x17a8f0['query'][_0x43c2('0x1d')]);}_0x4dee6e['order']=qs[_0x43c2('0x37')](_0x17a8f0[_0x43c2('0x30')][_0x43c2('0x37')]);_0x4dee6e[_0x43c2('0x38')]=qs[_0x43c2('0x39')](_[_0x43c2('0x3a')](_0x17a8f0[_0x43c2('0x30')],_0x37ec26[_0x43c2('0x39')]),_0x1bdc87);if(_0x17a8f0[_0x43c2('0x30')][_0x43c2('0x3b')]){_0x4dee6e[_0x43c2('0x38')]=_[_0x43c2('0x3c')](_0x4dee6e[_0x43c2('0x38')],{'$or':_['map'](_0x1bdc87,function(_0x254dea){if(_0x254dea[_0x43c2('0x2f')]!==_0x43c2('0x3d')){var _0x552c99={};_0x552c99[_0x254dea[_0x43c2('0x29')]]={'$like':'%'+_0x17a8f0[_0x43c2('0x30')][_0x43c2('0x3b')]+'%'};return _0x552c99;}})});}_0x4dee6e=_[_0x43c2('0x3c')]({},_0x4dee6e,_0x17a8f0['options']);var _0x56333e={'where':_0x4dee6e[_0x43c2('0x38')]};return db[_0x43c2('0x2d')]['count'](_0x56333e)[_0x43c2('0x25')](function(_0x43c2bc){_0x33ce45[_0x43c2('0x1c')]=_0x43c2bc;if(_0x17a8f0[_0x43c2('0x30')][_0x43c2('0x3e')]){_0x4dee6e[_0x43c2('0x3f')]=[{'all':!![]}];}return db[_0x43c2('0x2d')][_0x43c2('0x40')](_0x4dee6e);})['then'](function(_0x46cf46){_0x33ce45[_0x43c2('0x41')]=_0x46cf46;return _0x33ce45;})[_0x43c2('0x25')](respondWithFilteredResult(_0x4e1760,_0x4dee6e))['catch'](handleError(_0x4e1760,null));};exports['show']=function(_0x1ed50c,_0x2844ee){var _0x56cbf0={'raw':!![],'where':{'id':_0x1ed50c[_0x43c2('0x42')]['id']}},_0x214391={};_0x214391[_0x43c2('0x31')]=_[_0x43c2('0x43')](db[_0x43c2('0x2d')]['rawAttributes']);_0x214391[_0x43c2('0x30')]=_[_0x43c2('0x43')](_0x1ed50c['query']);_0x214391[_0x43c2('0x39')]=_[_0x43c2('0x44')](_0x214391['model'],_0x214391[_0x43c2('0x30')]);_0x56cbf0[_0x43c2('0x32')]=_['intersection'](_0x214391[_0x43c2('0x31')],qs[_0x43c2('0x33')](_0x1ed50c[_0x43c2('0x30')][_0x43c2('0x33')]));_0x56cbf0[_0x43c2('0x32')]=_0x56cbf0[_0x43c2('0x32')]['length']?_0x56cbf0[_0x43c2('0x32')]:_0x214391[_0x43c2('0x31')];if(_0x1ed50c[_0x43c2('0x30')][_0x43c2('0x3e')]){_0x56cbf0[_0x43c2('0x3f')]=[{'all':!![]}];}_0x56cbf0=_[_0x43c2('0x3c')]({},_0x56cbf0,_0x1ed50c['options']);return db[_0x43c2('0x2d')][_0x43c2('0x45')](_0x56cbf0)[_0x43c2('0x25')](handleEntityNotFound(_0x2844ee,null))['then'](respondWithResult(_0x2844ee,null))['catch'](handleError(_0x2844ee,null));};exports[_0x43c2('0x46')]=function(_0x979127,_0x2a3b3e){return db[_0x43c2('0x2d')][_0x43c2('0x46')](_0x979127[_0x43c2('0x47')],{})[_0x43c2('0x25')](respondWithResult(_0x2a3b3e,0xc9))['catch'](handleError(_0x2a3b3e,null));};exports[_0x43c2('0x24')]=function(_0x5e4fc2,_0x74afdd){if(_0x5e4fc2[_0x43c2('0x47')]['id']){delete _0x5e4fc2[_0x43c2('0x47')]['id'];}return db[_0x43c2('0x2d')][_0x43c2('0x45')]({'where':{'id':_0x5e4fc2[_0x43c2('0x42')]['id']}})[_0x43c2('0x25')](handleEntityNotFound(_0x74afdd,null))[_0x43c2('0x25')](saveUpdates(_0x5e4fc2[_0x43c2('0x47')],null))['then'](respondWithResult(_0x74afdd,null))['catch'](handleError(_0x74afdd,null));};exports[_0x43c2('0x48')]=function(_0x20a72a,_0x53398c,_0x130418){var _0x5a71c5=require('../../components/encryptor');var _0x4a5e17=![];var _0x5c13c3={};if(_0x20a72a['query']['type']&&_0x20a72a['query'][_0x43c2('0x2f')]===_0x43c2('0x49')){_0x5c13c3[_0x43c2('0x49')]=_0x20a72a[_0x43c2('0x42')]['id'];}else{_0x5c13c3['id']=_0x20a72a['params']['id'];}return db['SquareRecording'][_0x43c2('0x45')]({'where':_0x5c13c3,'attributes':['id',_0x43c2('0x4a'),_0x43c2('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x53398c,null))[_0x43c2('0x25')](function(_0x283f8f){if(_0x283f8f){var _0x387710=_0x283f8f['savePath'];var _0x534789=util[_0x43c2('0x4c')](_0x43c2('0x4d'),_0x387710);if(fs[_0x43c2('0x4e')](_0x534789)){_0x4a5e17=!![];return _0x5a71c5[_0x43c2('0x4f')](_0x534789,_0x387710,config[_0x43c2('0x50')]['recording'])[_0x43c2('0x25')](function(){return _0x283f8f;});}return _0x283f8f;}})[_0x43c2('0x25')](function(_0x193453){if(_0x193453){var _0x498ddb=_0x193453[_0x43c2('0x4a')];if(!fs['existsSync'](_0x498ddb)){throw new db[(_0x43c2('0x51'))][(_0x43c2('0x52'))]('SquareRecording\x20not\x20found');}if(_0x193453['filename']){return _0x53398c[_0x43c2('0x48')](_0x498ddb,_0x193453[_0x43c2('0x4b')]+path[_0x43c2('0x53')](_0x498ddb),function(){if(_0x4a5e17){fs[_0x43c2('0x54')](_0x498ddb);}});}else{return _0x53398c[_0x43c2('0x48')](_0x498ddb,function(_0x51ce9b){if(_0x4a5e17){fs[_0x43c2('0x54')](_0x498ddb);}});}}})[_0x43c2('0x55')](function(_0x132d58){if(_0x132d58[_0x43c2('0x56')]===_0x43c2('0x57')){_0x53398c[_0x43c2('0x19')](0x194)['send'](_0x43c2('0x58'));}else{return handleError(_0x53398c,null);}});};exports[_0x43c2('0x26')]=function(_0x4c151e,_0x195647){return db[_0x43c2('0x2d')][_0x43c2('0x45')]({'where':{'id':_0x4c151e[_0x43c2('0x42')]['id']}})[_0x43c2('0x25')](function(_0x125b16){if(_[_0x43c2('0x59')](_0x125b16)){throw new ReferenceError(_0x43c2('0x5a'));}return _0x125b16;})[_0x43c2('0x25')](function(_0x7d4fee){var _0x1317c2=_0x7d4fee[_0x43c2('0x4a')];logger[_0x43c2('0x5b')](_0x43c2('0x5c'),_0x1317c2);if(!_['isNil'](_0x7d4fee[_0x43c2('0x4a')])&&fs[_0x43c2('0x4e')](_0x1317c2)){logger[_0x43c2('0x5b')]('File:\x20\x22'+_0x1317c2+_0x43c2('0x5d'));fs[_0x43c2('0x5e')](_0x1317c2);}_0x1317c2=_0x1317c2+_0x43c2('0x5f');if(!_[_0x43c2('0x59')](_0x7d4fee[_0x43c2('0x4a')])&&fs['existsSync'](_0x1317c2)){logger[_0x43c2('0x5b')](_0x43c2('0x60')+_0x1317c2+_0x43c2('0x5d'));fs[_0x43c2('0x5e')](_0x1317c2);}return _0x7d4fee;})[_0x43c2('0x25')](function(_0x5e1adb){if(!_0x5e1adb)throw new InternalError();return _0x5e1adb[_0x43c2('0x26')]();})[_0x43c2('0x25')](function(){_0x195647[_0x43c2('0x19')](0xcc)[_0x43c2('0x27')]();})[_0x43c2('0x55')](handleError(_0x195647,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 890b7f6..5b9fff0 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 _0x6337=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SquareRecording','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6337,0x18a));var _0x7633=function(_0x22674c,_0x108706){_0x22674c=_0x22674c-0x0;var _0xeeda8b=_0x6337[_0x22674c];return _0xeeda8b;};'use strict';var _=require('lodash');var util=require(_0x7633('0x0'));var logger=require(_0x7633('0x1'))(_0x7633('0x2'));var moment=require(_0x7633('0x3'));var BPromise=require(_0x7633('0x4'));var rp=require(_0x7633('0x5'));var fs=require('fs');var path=require(_0x7633('0x6'));var rimraf=require(_0x7633('0x7'));var config=require(_0x7633('0x8'));var attributes=require('./squareRecording.attributes');module[_0x7633('0x9')]=function(_0x27e596,_0x470054){return _0x27e596['define'](_0x7633('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3f9=['SquareRecording','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define'];(function(_0xd504ce,_0x469f74){var _0x242764=function(_0x5c6bd4){while(--_0x5c6bd4){_0xd504ce['push'](_0xd504ce['shift']());}};_0x242764(++_0x469f74);}(_0xb3f9,0x7a));var _0x9b3f=function(_0x19ce19,_0x2ddc3b){_0x19ce19=_0x19ce19-0x0;var _0x5d2ec7=_0xb3f9[_0x19ce19];return _0x5d2ec7;};'use strict';var _=require(_0x9b3f('0x0'));var util=require(_0x9b3f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9b3f('0x2'));var BPromise=require('bluebird');var rp=require(_0x9b3f('0x3'));var fs=require('fs');var path=require(_0x9b3f('0x4'));var rimraf=require(_0x9b3f('0x5'));var config=require(_0x9b3f('0x6'));var attributes=require(_0x9b3f('0x7'));module[_0x9b3f('0x8')]=function(_0x47dc65,_0x52889d){return _0x47dc65[_0x9b3f('0x9')](_0x9b3f('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index d86e038..9d00866 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 _0x1aea=['raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','CreateSquareRecording','SquareRecording','create','body','options'];(function(_0x268181,_0x596b15){var _0x5cdac7=function(_0x51cdeb){while(--_0x51cdeb){_0x268181['push'](_0x268181['shift']());}};_0x5cdac7(++_0x596b15);}(_0x1aea,0x152));var _0xa1ae=function(_0x3fb5eb,_0x5947a6){_0x3fb5eb=_0x3fb5eb-0x0;var _0x481291=_0x1aea[_0x3fb5eb];return _0x481291;};'use strict';var _=require(_0xa1ae('0x0'));var util=require(_0xa1ae('0x1'));var moment=require(_0xa1ae('0x2'));var BPromise=require(_0xa1ae('0x3'));var rs=require(_0xa1ae('0x4'));var fs=require('fs');var Redis=require(_0xa1ae('0x5'));var db=require(_0xa1ae('0x6'))['db'];var utils=require(_0xa1ae('0x7'));var logger=require('../../config/logger')(_0xa1ae('0x8'));var config=require(_0xa1ae('0x9'));var jayson=require(_0xa1ae('0xa'));var client=jayson[_0xa1ae('0xb')][_0xa1ae('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x160dc3,_0x429e7e,_0x455ffa){return new BPromise(function(_0x5eb1fe,_0x31caf9){return client['request'](_0x160dc3,_0x455ffa)[_0xa1ae('0xd')](function(_0x463b8a){logger[_0xa1ae('0xe')](_0xa1ae('0xf'),_0x429e7e,_0xa1ae('0x10'));logger[_0xa1ae('0x11')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x429e7e,'request\x20sent',JSON['stringify'](_0x463b8a));if(_0x463b8a[_0xa1ae('0x12')]){if(_0x463b8a[_0xa1ae('0x12')]['code']===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x429e7e,_0x463b8a[_0xa1ae('0x12')]['message']);return _0x31caf9(_0x463b8a['error'][_0xa1ae('0x13')]);}logger[_0xa1ae('0x12')](_0xa1ae('0xf'),_0x429e7e,_0x463b8a[_0xa1ae('0x12')][_0xa1ae('0x13')]);return _0x5eb1fe(_0x463b8a[_0xa1ae('0x12')][_0xa1ae('0x13')]);}else{logger['info']('SquareRecording,\x20%s,\x20%s',_0x429e7e,_0xa1ae('0x10'));_0x5eb1fe(_0x463b8a['result'][_0xa1ae('0x13')]);}})[_0xa1ae('0x14')](function(_0x43f06b){logger[_0xa1ae('0x12')]('SquareRecording,\x20%s,\x20%s',_0x429e7e,_0x43f06b);_0x31caf9(_0x43f06b);});});}exports[_0xa1ae('0x15')]=function(_0x52e4a8){var _0x13342a=this;return new Promise(function(_0x1dc4e8,_0x105e26){return db[_0xa1ae('0x16')][_0xa1ae('0x17')](_0x52e4a8[_0xa1ae('0x18')],{'raw':_0x52e4a8[_0xa1ae('0x19')]?_0x52e4a8[_0xa1ae('0x19')][_0xa1ae('0x1a')]===undefined?!![]:![]:!![]})[_0xa1ae('0xd')](function(_0x3ce2ea){logger[_0xa1ae('0xe')](_0xa1ae('0x15'),_0x52e4a8);logger[_0xa1ae('0x11')](_0xa1ae('0x15'),_0x52e4a8,JSON[_0xa1ae('0x1b')](_0x3ce2ea));_0x1dc4e8(_0x3ce2ea);})[_0xa1ae('0x14')](function(_0xf64bfc){logger[_0xa1ae('0x12')](_0xa1ae('0x15'),_0xf64bfc[_0xa1ae('0x13')],_0x52e4a8);_0x105e26(_0x13342a['error'](0x1f4,_0xf64bfc['message']));});});}; \ No newline at end of file +var _0x0bcc=['catch','CreateSquareRecording','SquareRecording','create','options','raw','then','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x59c855,_0x3c04fd){var _0x329f94=function(_0x3f6e10){while(--_0x3f6e10){_0x59c855['push'](_0x59c855['shift']());}};_0x329f94(++_0x3c04fd);}(_0x0bcc,0x1cf));var _0xc0bc=function(_0x19fc46,_0x5993f8){_0x19fc46=_0x19fc46-0x0;var _0x25aa8c=_0x0bcc[_0x19fc46];return _0x25aa8c;};'use strict';var _=require('lodash');var util=require(_0xc0bc('0x0'));var moment=require('moment');var BPromise=require(_0xc0bc('0x1'));var rs=require(_0xc0bc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc0bc('0x3'))['db'];var utils=require(_0xc0bc('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xc0bc('0x5'));var jayson=require(_0xc0bc('0x6'));var client=jayson[_0xc0bc('0x7')][_0xc0bc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xac55f6,_0x565259,_0x5aeb12){return new BPromise(function(_0x5a4578,_0x3d418c){return client['request'](_0xac55f6,_0x5aeb12)['then'](function(_0x11abd7){logger[_0xc0bc('0x9')](_0xc0bc('0xa'),_0x565259,_0xc0bc('0xb'));logger[_0xc0bc('0xc')](_0xc0bc('0xd'),_0x565259,_0xc0bc('0xb'),JSON['stringify'](_0x11abd7));if(_0x11abd7[_0xc0bc('0xe')]){if(_0x11abd7[_0xc0bc('0xe')]['code']===0x1f4){logger[_0xc0bc('0xe')](_0xc0bc('0xa'),_0x565259,_0x11abd7[_0xc0bc('0xe')]['message']);return _0x3d418c(_0x11abd7[_0xc0bc('0xe')][_0xc0bc('0xf')]);}logger[_0xc0bc('0xe')]('SquareRecording,\x20%s,\x20%s',_0x565259,_0x11abd7[_0xc0bc('0xe')][_0xc0bc('0xf')]);return _0x5a4578(_0x11abd7[_0xc0bc('0xe')][_0xc0bc('0xf')]);}else{logger[_0xc0bc('0x9')]('SquareRecording,\x20%s,\x20%s',_0x565259,_0xc0bc('0xb'));_0x5a4578(_0x11abd7[_0xc0bc('0x10')][_0xc0bc('0xf')]);}})[_0xc0bc('0x11')](function(_0x27d88f){logger[_0xc0bc('0xe')](_0xc0bc('0xa'),_0x565259,_0x27d88f);_0x3d418c(_0x27d88f);});});}exports[_0xc0bc('0x12')]=function(_0x34dc4f){var _0x3fb0e7=this;return new Promise(function(_0x2231d1,_0x93c471){return db[_0xc0bc('0x13')][_0xc0bc('0x14')](_0x34dc4f['body'],{'raw':_0x34dc4f[_0xc0bc('0x15')]?_0x34dc4f[_0xc0bc('0x15')][_0xc0bc('0x16')]===undefined?!![]:![]:!![]})[_0xc0bc('0x17')](function(_0x302057){logger[_0xc0bc('0x9')]('CreateSquareRecording',_0x34dc4f);logger[_0xc0bc('0xc')](_0xc0bc('0x12'),_0x34dc4f,JSON['stringify'](_0x302057));_0x2231d1(_0x302057);})['catch'](function(_0x519295){logger[_0xc0bc('0xe')](_0xc0bc('0x12'),_0x519295[_0xc0bc('0xf')],_0x34dc4f);_0x93c471(_0x3fb0e7[_0xc0bc('0xe')](0x1f4,_0x519295[_0xc0bc('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 0cfa5de..4fdf5b6 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x2096db,_0x47eb15){var _0x346631=function(_0x295e78){while(--_0x295e78){_0x2096db['push'](_0x2096db['shift']());}};_0x346631(++_0x47eb15);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _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(_0x1518b3,_0x1aaea0){var _0x5f36bd=function(_0x592f0f){while(--_0x592f0f){_0x1518b3['push'](_0x1518b3['shift']());}};_0x5f36bd(++_0x1aaea0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 0743225..f1c3bd8 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 _0xd775=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x41d271,_0x530f74){var _0x1924d1=function(_0x7e4c92){while(--_0x7e4c92){_0x41d271['push'](_0x41d271['shift']());}};_0x1924d1(++_0x530f74);}(_0xd775,0xa2));var _0x5d77=function(_0x23b16d,_0x189ba0){_0x23b16d=_0x23b16d-0x0;var _0x454ca8=_0xd775[_0x23b16d];return _0x454ca8;};'use strict';var Sequelize=require(_0x5d77('0x0'));module['exports']={'network':{'type':Sequelize[_0x5d77('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x5d77('0x1')]},'channel':{'type':Sequelize[_0x5d77('0x1')]},'language':{'type':Sequelize[_0x5d77('0x1')]},'type':{'type':Sequelize[_0x5d77('0x1')]},'uniqueid':{'type':Sequelize[_0x5d77('0x1')]},'version':{'type':Sequelize[_0x5d77('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5d77('0x1')]},'callingpres':{'type':Sequelize[_0x5d77('0x1')]},'callingani2':{'type':Sequelize[_0x5d77('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x5d77('0x1')]},'dnid':{'type':Sequelize[_0x5d77('0x1')]},'rdnis':{'type':Sequelize[_0x5d77('0x1')]},'context':{'type':Sequelize[_0x5d77('0x1')]},'extension':{'type':Sequelize[_0x5d77('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x5d77('0x1')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x5d77('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5d77('0x2')]},'bot':{'type':Sequelize[_0x5d77('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xb96f=['DATE','BOOLEAN','STRING'];(function(_0x40062d,_0x5e56ab){var _0x5bf403=function(_0xf70efe){while(--_0xf70efe){_0x40062d['push'](_0x40062d['shift']());}};_0x5bf403(++_0x5e56ab);}(_0xb96f,0x14c));var _0xfb96=function(_0x3bb0ba,_0x4f4514){_0x3bb0ba=_0x3bb0ba-0x0;var _0x5ecda8=_0xb96f[_0x3bb0ba];return _0x5ecda8;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize[_0xfb96('0x0')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xfb96('0x0')]},'channel':{'type':Sequelize[_0xfb96('0x0')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xfb96('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xfb96('0x0')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfb96('0x0')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xfb96('0x0')]},'callington':{'type':Sequelize[_0xfb96('0x0')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xfb96('0x0')]},'rdnis':{'type':Sequelize[_0xfb96('0x0')]},'context':{'type':Sequelize[_0xfb96('0x0')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xfb96('0x0')]},'enhanced':{'type':Sequelize[_0xfb96('0x0')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfb96('0x1')]},'leaveAt':{'type':Sequelize[_0xfb96('0x1')]},'bot':{'type':Sequelize[_0xfb96('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 6017a10..36bf332 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 _0xf4f2=['util','path','sox','to-csv','fs-extra','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','json','offset','limit','undefined','count','set','apply','reject','save','update','then','error','stack','name','send','rawAttributes','fieldName','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SquareReport','includeAll','include','rows','catch','show','params','find','create','body','destroy','describe','fast-json-patch','request-promise','moment','bluebird'];(function(_0x57d9e4,_0x268f25){var _0x220670=function(_0x3175bf){while(--_0x3175bf){_0x57d9e4['push'](_0x57d9e4['shift']());}};_0x220670(++_0x268f25);}(_0xf4f2,0x1ca));var _0x2f4f=function(_0x202670,_0xc082c7){_0x202670=_0x202670-0x0;var _0x36a656=_0xf4f2[_0x202670];return _0x36a656;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2f4f('0x0'));var rp=require(_0x2f4f('0x1'));var moment=require(_0x2f4f('0x2'));var BPromise=require(_0x2f4f('0x3'));var Mustache=require('mustache');var util=require(_0x2f4f('0x4'));var path=require(_0x2f4f('0x5'));var sox=require(_0x2f4f('0x6'));var csv=require(_0x2f4f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f4f('0x8'));var _=require(_0x2f4f('0x9'));var squel=require(_0x2f4f('0xa'));var crypto=require(_0x2f4f('0xb'));var jsforce=require(_0x2f4f('0xc'));var deskjs=require(_0x2f4f('0xd'));var toCsv=require(_0x2f4f('0x7'));var querystring=require(_0x2f4f('0xe'));var Papa=require('papaparse');var Redis=require(_0x2f4f('0xf'));var authService=require(_0x2f4f('0x10'));var qs=require(_0x2f4f('0x11'));var as=require(_0x2f4f('0x12'));var hardwareService=require(_0x2f4f('0x13'));var logger=require(_0x2f4f('0x14'))('api');var utils=require(_0x2f4f('0x15'));var config=require(_0x2f4f('0x16'));var licenseUtil=require(_0x2f4f('0x17'));var db=require(_0x2f4f('0x18'))['db'];function respondWithStatusCode(_0x3372a4,_0x2898b1){_0x2898b1=_0x2898b1||0xcc;return function(_0x1f9fec){if(_0x1f9fec){return _0x3372a4[_0x2f4f('0x19')](_0x2898b1);}return _0x3372a4[_0x2f4f('0x1a')](_0x2898b1)[_0x2f4f('0x1b')]();};}function respondWithResult(_0x3e8305,_0x16d4fa){_0x16d4fa=_0x16d4fa||0xc8;return function(_0x74cf0b){if(_0x74cf0b){return _0x3e8305[_0x2f4f('0x1a')](_0x16d4fa)[_0x2f4f('0x1c')](_0x74cf0b);}};}function respondWithFilteredResult(_0xba8e84,_0x353683){return function(_0x5e6c57){if(_0x5e6c57){var _0x580b05=typeof _0x353683[_0x2f4f('0x1d')]==='undefined'&&typeof _0x353683[_0x2f4f('0x1e')]===_0x2f4f('0x1f');var _0xedfbdb=_0x5e6c57[_0x2f4f('0x20')];var _0x68f8a7=_0x580b05?0x0:_0x353683[_0x2f4f('0x1d')];var _0x3c0223=_0x580b05?_0x5e6c57['count']:_0x353683['offset']+_0x353683[_0x2f4f('0x1e')];var _0x45f3c6;if(_0x3c0223>=_0xedfbdb){_0x3c0223=_0xedfbdb;_0x45f3c6=0xc8;}else{_0x45f3c6=0xce;}_0xba8e84['status'](_0x45f3c6);return _0xba8e84[_0x2f4f('0x21')]('Content-Range',_0x68f8a7+'-'+_0x3c0223+'/'+_0xedfbdb)[_0x2f4f('0x1c')](_0x5e6c57);}return null;};}function patchUpdates(_0x9ae2ad){return function(_0x33e855){try{jsonpatch[_0x2f4f('0x22')](_0x33e855,_0x9ae2ad,!![]);}catch(_0x12d9f0){return BPromise[_0x2f4f('0x23')](_0x12d9f0);}return _0x33e855[_0x2f4f('0x24')]();};}function saveUpdates(_0x54e376,_0x4680f0){return function(_0x19a65e){if(_0x19a65e){return _0x19a65e[_0x2f4f('0x25')](_0x54e376)[_0x2f4f('0x26')](function(_0x35d2da){return _0x35d2da;});}return null;};}function removeEntity(_0x318266,_0x12d2ac){return function(_0x1f7f01){if(_0x1f7f01){return _0x1f7f01['destroy']()[_0x2f4f('0x26')](function(){_0x318266[_0x2f4f('0x1a')](0xcc)[_0x2f4f('0x1b')]();});}};}function handleEntityNotFound(_0x1bcb4d,_0x12852f){return function(_0x39a14f){if(!_0x39a14f){_0x1bcb4d[_0x2f4f('0x19')](0x194);}return _0x39a14f;};}function handleError(_0x3b95bd,_0x2d8ddb){_0x2d8ddb=_0x2d8ddb||0x1f4;return function(_0xe23025){logger[_0x2f4f('0x27')](_0xe23025[_0x2f4f('0x28')]);if(_0xe23025['name']){delete _0xe23025[_0x2f4f('0x29')];}_0x3b95bd[_0x2f4f('0x1a')](_0x2d8ddb)[_0x2f4f('0x2a')](_0xe23025);};}exports['index']=function(_0x35b314,_0x53c6a9){var _0x48dac4={},_0x1703c0={},_0x1c5ded={'count':0x0,'rows':[]};var _0x40962=_['map'](db['SquareReport'][_0x2f4f('0x2b')],function(_0x1c7e4d){return{'name':_0x1c7e4d[_0x2f4f('0x2c')],'type':_0x1c7e4d['type'][_0x2f4f('0x2d')]};});_0x1703c0['model']=_[_0x2f4f('0x2e')](_0x40962,_0x2f4f('0x29'));_0x1703c0[_0x2f4f('0x2f')]=_[_0x2f4f('0x30')](_0x35b314[_0x2f4f('0x2f')]);_0x1703c0[_0x2f4f('0x31')]=_[_0x2f4f('0x32')](_0x1703c0['model'],_0x1703c0['query']);_0x48dac4[_0x2f4f('0x33')]=_[_0x2f4f('0x32')](_0x1703c0[_0x2f4f('0x34')],qs[_0x2f4f('0x35')](_0x35b314['query']['fields']));_0x48dac4['attributes']=_0x48dac4[_0x2f4f('0x33')][_0x2f4f('0x36')]?_0x48dac4['attributes']:_0x1703c0[_0x2f4f('0x34')];if(!_0x35b314[_0x2f4f('0x2f')][_0x2f4f('0x37')]('nolimit')){_0x48dac4['limit']=qs[_0x2f4f('0x1e')](_0x35b314['query'][_0x2f4f('0x1e')]);_0x48dac4[_0x2f4f('0x1d')]=qs['offset'](_0x35b314[_0x2f4f('0x2f')][_0x2f4f('0x1d')]);}_0x48dac4[_0x2f4f('0x38')]=qs[_0x2f4f('0x39')](_0x35b314[_0x2f4f('0x2f')][_0x2f4f('0x39')]);_0x48dac4[_0x2f4f('0x3a')]=qs[_0x2f4f('0x31')](_[_0x2f4f('0x3b')](_0x35b314[_0x2f4f('0x2f')],_0x1703c0[_0x2f4f('0x31')]),_0x40962);if(_0x35b314[_0x2f4f('0x2f')][_0x2f4f('0x3c')]){_0x48dac4[_0x2f4f('0x3a')]=_[_0x2f4f('0x3d')](_0x48dac4[_0x2f4f('0x3a')],{'$or':_[_0x2f4f('0x2e')](_0x40962,function(_0x2d3106){if(_0x2d3106[_0x2f4f('0x3e')]!==_0x2f4f('0x3f')){var _0x3b7ef6={};_0x3b7ef6[_0x2d3106[_0x2f4f('0x29')]]={'$like':'%'+_0x35b314[_0x2f4f('0x2f')][_0x2f4f('0x3c')]+'%'};return _0x3b7ef6;}})});}_0x48dac4=_[_0x2f4f('0x3d')]({},_0x48dac4,_0x35b314[_0x2f4f('0x40')]);var _0x58672e={'where':_0x48dac4[_0x2f4f('0x3a')]};return db[_0x2f4f('0x41')][_0x2f4f('0x20')](_0x58672e)['then'](function(_0x16379d){_0x1c5ded[_0x2f4f('0x20')]=_0x16379d;if(_0x35b314[_0x2f4f('0x2f')][_0x2f4f('0x42')]){_0x48dac4[_0x2f4f('0x43')]=[{'all':!![]}];}return db[_0x2f4f('0x41')]['findAll'](_0x48dac4);})['then'](function(_0xfea6e0){_0x1c5ded[_0x2f4f('0x44')]=_0xfea6e0;return _0x1c5ded;})[_0x2f4f('0x26')](respondWithFilteredResult(_0x53c6a9,_0x48dac4))[_0x2f4f('0x45')](handleError(_0x53c6a9,null));};exports[_0x2f4f('0x46')]=function(_0x1d4af0,_0x28728b){var _0x1450f6={'raw':!![],'where':{'id':_0x1d4af0[_0x2f4f('0x47')]['id']}},_0x4d0324={};_0x4d0324[_0x2f4f('0x34')]=_[_0x2f4f('0x30')](db[_0x2f4f('0x41')][_0x2f4f('0x2b')]);_0x4d0324[_0x2f4f('0x2f')]=_[_0x2f4f('0x30')](_0x1d4af0[_0x2f4f('0x2f')]);_0x4d0324['filters']=_[_0x2f4f('0x32')](_0x4d0324[_0x2f4f('0x34')],_0x4d0324['query']);_0x1450f6['attributes']=_[_0x2f4f('0x32')](_0x4d0324[_0x2f4f('0x34')],qs[_0x2f4f('0x35')](_0x1d4af0[_0x2f4f('0x2f')][_0x2f4f('0x35')]));_0x1450f6['attributes']=_0x1450f6[_0x2f4f('0x33')][_0x2f4f('0x36')]?_0x1450f6['attributes']:_0x4d0324[_0x2f4f('0x34')];if(_0x1d4af0['query']['includeAll']){_0x1450f6[_0x2f4f('0x43')]=[{'all':!![]}];}_0x1450f6=_['merge']({},_0x1450f6,_0x1d4af0[_0x2f4f('0x40')]);return db[_0x2f4f('0x41')][_0x2f4f('0x48')](_0x1450f6)[_0x2f4f('0x26')](handleEntityNotFound(_0x28728b,null))[_0x2f4f('0x26')](respondWithResult(_0x28728b,null))['catch'](handleError(_0x28728b,null));};exports['create']=function(_0x84293d,_0x29a067){return db[_0x2f4f('0x41')][_0x2f4f('0x49')](_0x84293d['body'],{})[_0x2f4f('0x26')](respondWithResult(_0x29a067,0xc9))[_0x2f4f('0x45')](handleError(_0x29a067,null));};exports[_0x2f4f('0x25')]=function(_0x2ee649,_0x47bcbc){if(_0x2ee649[_0x2f4f('0x4a')]['id']){delete _0x2ee649[_0x2f4f('0x4a')]['id'];}return db[_0x2f4f('0x41')][_0x2f4f('0x48')]({'where':{'id':_0x2ee649[_0x2f4f('0x47')]['id']}})[_0x2f4f('0x26')](handleEntityNotFound(_0x47bcbc,null))['then'](saveUpdates(_0x2ee649[_0x2f4f('0x4a')],null))['then'](respondWithResult(_0x47bcbc,null))['catch'](handleError(_0x47bcbc,null));};exports[_0x2f4f('0x4b')]=function(_0x53f6e6,_0x232605){return db['SquareReport'][_0x2f4f('0x48')]({'where':{'id':_0x53f6e6[_0x2f4f('0x47')]['id']}})[_0x2f4f('0x26')](handleEntityNotFound(_0x232605,null))[_0x2f4f('0x26')](removeEntity(_0x232605,null))['catch'](handleError(_0x232605,null));};exports['describe']=function(_0x3c0b51,_0x57a40f){return db[_0x2f4f('0x41')][_0x2f4f('0x4c')]()[_0x2f4f('0x26')](respondWithResult(_0x57a40f,null))[_0x2f4f('0x45')](handleError(_0x57a40f,null));}; \ No newline at end of file +var _0x258b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','map','SquareReport','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','rawAttributes','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x258b,0x82));var _0xb258=function(_0x59ecbc,_0x11114e){_0x59ecbc=_0x59ecbc-0x0;var _0x20d0d4=_0x258b[_0x59ecbc];return _0x20d0d4;};'use strict';var emlformat=require(_0xb258('0x0'));var rimraf=require(_0xb258('0x1'));var zipdir=require(_0xb258('0x2'));var jsonpatch=require(_0xb258('0x3'));var rp=require(_0xb258('0x4'));var moment=require(_0xb258('0x5'));var BPromise=require(_0xb258('0x6'));var Mustache=require(_0xb258('0x7'));var util=require('util');var path=require(_0xb258('0x8'));var sox=require(_0xb258('0x9'));var csv=require(_0xb258('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb258('0xb'));var _=require(_0xb258('0xc'));var squel=require(_0xb258('0xd'));var crypto=require(_0xb258('0xe'));var jsforce=require(_0xb258('0xf'));var deskjs=require(_0xb258('0x10'));var toCsv=require(_0xb258('0xa'));var querystring=require(_0xb258('0x11'));var Papa=require(_0xb258('0x12'));var Redis=require(_0xb258('0x13'));var authService=require(_0xb258('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb258('0x15'));var hardwareService=require(_0xb258('0x16'));var logger=require(_0xb258('0x17'))(_0xb258('0x18'));var utils=require(_0xb258('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xb258('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32ff3e,_0x589641){_0x589641=_0x589641||0xcc;return function(_0x4e64a4){if(_0x4e64a4){return _0x32ff3e['sendStatus'](_0x589641);}return _0x32ff3e[_0xb258('0x1b')](_0x589641)[_0xb258('0x1c')]();};}function respondWithResult(_0x35f42e,_0x1f5f70){_0x1f5f70=_0x1f5f70||0xc8;return function(_0x4f1a96){if(_0x4f1a96){return _0x35f42e[_0xb258('0x1b')](_0x1f5f70)[_0xb258('0x1d')](_0x4f1a96);}};}function respondWithFilteredResult(_0x363690,_0x5547a1){return function(_0x3e01c2){if(_0x3e01c2){var _0x6609be=typeof _0x5547a1[_0xb258('0x1e')]===_0xb258('0x1f')&&typeof _0x5547a1[_0xb258('0x20')]===_0xb258('0x1f');var _0x268d39=_0x3e01c2[_0xb258('0x21')];var _0x24fab9=_0x6609be?0x0:_0x5547a1[_0xb258('0x1e')];var _0x461cff=_0x6609be?_0x3e01c2[_0xb258('0x21')]:_0x5547a1['offset']+_0x5547a1[_0xb258('0x20')];var _0x48d5a0;if(_0x461cff>=_0x268d39){_0x461cff=_0x268d39;_0x48d5a0=0xc8;}else{_0x48d5a0=0xce;}_0x363690[_0xb258('0x1b')](_0x48d5a0);return _0x363690[_0xb258('0x22')](_0xb258('0x23'),_0x24fab9+'-'+_0x461cff+'/'+_0x268d39)[_0xb258('0x1d')](_0x3e01c2);}return null;};}function patchUpdates(_0x1efeeb){return function(_0x55f8d3){try{jsonpatch[_0xb258('0x24')](_0x55f8d3,_0x1efeeb,!![]);}catch(_0xa12f1f){return BPromise[_0xb258('0x25')](_0xa12f1f);}return _0x55f8d3[_0xb258('0x26')]();};}function saveUpdates(_0x2487e9,_0x1e9324){return function(_0x41fb19){if(_0x41fb19){return _0x41fb19['update'](_0x2487e9)[_0xb258('0x27')](function(_0x2f2bb7){return _0x2f2bb7;});}return null;};}function removeEntity(_0x2d5159,_0x43408e){return function(_0x1caa54){if(_0x1caa54){return _0x1caa54[_0xb258('0x28')]()[_0xb258('0x27')](function(){_0x2d5159[_0xb258('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x221764,_0x2880b1){return function(_0x35e7c0){if(!_0x35e7c0){_0x221764[_0xb258('0x29')](0x194);}return _0x35e7c0;};}function handleError(_0x31c299,_0x3e9aac){_0x3e9aac=_0x3e9aac||0x1f4;return function(_0x12091c){logger['error'](_0x12091c[_0xb258('0x2a')]);if(_0x12091c[_0xb258('0x2b')]){delete _0x12091c[_0xb258('0x2b')];}_0x31c299[_0xb258('0x1b')](_0x3e9aac)['send'](_0x12091c);};}exports['index']=function(_0x25969e,_0x3ff4f1){var _0xfd5293={},_0x3ddebd={},_0x28f25b={'count':0x0,'rows':[]};var _0x431b0c=_[_0xb258('0x2c')](db[_0xb258('0x2d')]['rawAttributes'],function(_0x21bdba){return{'name':_0x21bdba['fieldName'],'type':_0x21bdba[_0xb258('0x2e')][_0xb258('0x2f')]};});_0x3ddebd[_0xb258('0x30')]=_[_0xb258('0x2c')](_0x431b0c,_0xb258('0x2b'));_0x3ddebd[_0xb258('0x31')]=_[_0xb258('0x32')](_0x25969e[_0xb258('0x31')]);_0x3ddebd[_0xb258('0x33')]=_[_0xb258('0x34')](_0x3ddebd[_0xb258('0x30')],_0x3ddebd[_0xb258('0x31')]);_0xfd5293[_0xb258('0x35')]=_[_0xb258('0x34')](_0x3ddebd[_0xb258('0x30')],qs[_0xb258('0x36')](_0x25969e['query'][_0xb258('0x36')]));_0xfd5293[_0xb258('0x35')]=_0xfd5293[_0xb258('0x35')]['length']?_0xfd5293[_0xb258('0x35')]:_0x3ddebd[_0xb258('0x30')];if(!_0x25969e[_0xb258('0x31')]['hasOwnProperty'](_0xb258('0x37'))){_0xfd5293[_0xb258('0x20')]=qs[_0xb258('0x20')](_0x25969e[_0xb258('0x31')][_0xb258('0x20')]);_0xfd5293['offset']=qs[_0xb258('0x1e')](_0x25969e[_0xb258('0x31')][_0xb258('0x1e')]);}_0xfd5293[_0xb258('0x38')]=qs[_0xb258('0x39')](_0x25969e['query'][_0xb258('0x39')]);_0xfd5293[_0xb258('0x3a')]=qs['filters'](_[_0xb258('0x3b')](_0x25969e[_0xb258('0x31')],_0x3ddebd[_0xb258('0x33')]),_0x431b0c);if(_0x25969e['query'][_0xb258('0x3c')]){_0xfd5293['where']=_[_0xb258('0x3d')](_0xfd5293[_0xb258('0x3a')],{'$or':_[_0xb258('0x2c')](_0x431b0c,function(_0x2b8925){if(_0x2b8925[_0xb258('0x2e')]!==_0xb258('0x3e')){var _0x541f77={};_0x541f77[_0x2b8925[_0xb258('0x2b')]]={'$like':'%'+_0x25969e[_0xb258('0x31')][_0xb258('0x3c')]+'%'};return _0x541f77;}})});}_0xfd5293=_[_0xb258('0x3d')]({},_0xfd5293,_0x25969e[_0xb258('0x3f')]);var _0x181cd6={'where':_0xfd5293[_0xb258('0x3a')]};return db['SquareReport']['count'](_0x181cd6)[_0xb258('0x27')](function(_0x4a8773){_0x28f25b['count']=_0x4a8773;if(_0x25969e[_0xb258('0x31')][_0xb258('0x40')]){_0xfd5293['include']=[{'all':!![]}];}return db[_0xb258('0x2d')]['findAll'](_0xfd5293);})['then'](function(_0x1cbed3){_0x28f25b[_0xb258('0x41')]=_0x1cbed3;return _0x28f25b;})[_0xb258('0x27')](respondWithFilteredResult(_0x3ff4f1,_0xfd5293))[_0xb258('0x42')](handleError(_0x3ff4f1,null));};exports['show']=function(_0x75c2c5,_0x4b1e2f){var _0x4f8497={'raw':!![],'where':{'id':_0x75c2c5[_0xb258('0x43')]['id']}},_0x7d0e14={};_0x7d0e14[_0xb258('0x30')]=_[_0xb258('0x32')](db[_0xb258('0x2d')][_0xb258('0x44')]);_0x7d0e14['query']=_[_0xb258('0x32')](_0x75c2c5[_0xb258('0x31')]);_0x7d0e14['filters']=_[_0xb258('0x34')](_0x7d0e14['model'],_0x7d0e14['query']);_0x4f8497['attributes']=_[_0xb258('0x34')](_0x7d0e14[_0xb258('0x30')],qs['fields'](_0x75c2c5[_0xb258('0x31')][_0xb258('0x36')]));_0x4f8497[_0xb258('0x35')]=_0x4f8497[_0xb258('0x35')]['length']?_0x4f8497['attributes']:_0x7d0e14[_0xb258('0x30')];if(_0x75c2c5[_0xb258('0x31')][_0xb258('0x40')]){_0x4f8497[_0xb258('0x45')]=[{'all':!![]}];}_0x4f8497=_[_0xb258('0x3d')]({},_0x4f8497,_0x75c2c5[_0xb258('0x3f')]);return db[_0xb258('0x2d')]['find'](_0x4f8497)[_0xb258('0x27')](handleEntityNotFound(_0x4b1e2f,null))[_0xb258('0x27')](respondWithResult(_0x4b1e2f,null))[_0xb258('0x42')](handleError(_0x4b1e2f,null));};exports[_0xb258('0x46')]=function(_0x4356ec,_0x509619){return db[_0xb258('0x2d')][_0xb258('0x46')](_0x4356ec[_0xb258('0x47')],{})[_0xb258('0x27')](respondWithResult(_0x509619,0xc9))['catch'](handleError(_0x509619,null));};exports['update']=function(_0x391b0a,_0x50d300){if(_0x391b0a[_0xb258('0x47')]['id']){delete _0x391b0a[_0xb258('0x47')]['id'];}return db[_0xb258('0x2d')]['find']({'where':{'id':_0x391b0a[_0xb258('0x43')]['id']}})[_0xb258('0x27')](handleEntityNotFound(_0x50d300,null))['then'](saveUpdates(_0x391b0a[_0xb258('0x47')],null))[_0xb258('0x27')](respondWithResult(_0x50d300,null))[_0xb258('0x42')](handleError(_0x50d300,null));};exports[_0xb258('0x28')]=function(_0x1fff45,_0x5357b5){return db[_0xb258('0x2d')][_0xb258('0x48')]({'where':{'id':_0x1fff45[_0xb258('0x43')]['id']}})[_0xb258('0x27')](handleEntityNotFound(_0x5357b5,null))[_0xb258('0x27')](removeEntity(_0x5357b5,null))[_0xb258('0x42')](handleError(_0x5357b5,null));};exports[_0xb258('0x49')]=function(_0x5c7c3d,_0x498b3d){return db[_0xb258('0x2d')][_0xb258('0x49')]()[_0xb258('0x27')](respondWithResult(_0x498b3d,null))['catch'](handleError(_0x498b3d,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 86afeee..4a10158 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 _0xd363=['rimraf','exports','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd363,0x6e));var _0x3d36=function(_0x515ae8,_0x2a964f){_0x515ae8=_0x515ae8-0x0;var _0x4cf66a=_0xd363[_0x515ae8];return _0x4cf66a;};'use strict';var _=require(_0x3d36('0x0'));var util=require(_0x3d36('0x1'));var logger=require(_0x3d36('0x2'))(_0x3d36('0x3'));var moment=require(_0x3d36('0x4'));var BPromise=require(_0x3d36('0x5'));var rp=require(_0x3d36('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d36('0x7'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0x3d36('0x8')]=function(_0x2d5d08,_0x43a05f){return _0x2d5d08['define']('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x3d36('0x9'),'fields':[_0x3d36('0xa'),_0x3d36('0xb')]},{'name':_0x3d36('0xc'),'fields':[_0x3d36('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x26b4=['rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util','api','path'];(function(_0xe54f33,_0x44bc8a){var _0x48f29f=function(_0x58b5c6){while(--_0x58b5c6){_0xe54f33['push'](_0xe54f33['shift']());}};_0x48f29f(++_0x44bc8a);}(_0x26b4,0x88));var _0x426b=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x26b4[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require(_0x426b('0x0'));var util=require(_0x426b('0x1'));var logger=require('../../config/logger')(_0x426b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x426b('0x3'));var rimraf=require(_0x426b('0x4'));var config=require(_0x426b('0x5'));var attributes=require(_0x426b('0x6'));module[_0x426b('0x7')]=function(_0x4cf5e0,_0x309ca0){return _0x4cf5e0[_0x426b('0x8')](_0x426b('0x9'),attributes,{'tableName':_0x426b('0xa'),'paranoid':![],'indexes':[{'name':_0x426b('0xb'),'fields':['uniqueid',_0x426b('0xc')]},{'name':_0x426b('0xd'),'fields':[_0x426b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 9671385..3f2026f 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 _0xbf91=['options','raw','UpdateSquareReport','update','where','attributes','limit','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareReport,\x20%s,\x20%s','result','catch','CreateSquareReport','SquareReport','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbf91,0xc1));var _0x1bf9=function(_0x524a80,_0x50a874){_0x524a80=_0x524a80-0x0;var _0x129a91=_0xbf91[_0x524a80];return _0x129a91;};'use strict';var _=require(_0x1bf9('0x0'));var util=require('util');var moment=require(_0x1bf9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1bf9('0x2'));var db=require(_0x1bf9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1bf9('0x4'))(_0x1bf9('0x5'));var config=require(_0x1bf9('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1bf9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x507cfb,_0x1204e7,_0x4b74cd){return new BPromise(function(_0x35f580,_0x1360f8){return client[_0x1bf9('0x8')](_0x507cfb,_0x4b74cd)[_0x1bf9('0x9')](function(_0x5ae2d3){logger[_0x1bf9('0xa')]('SquareReport,\x20%s,\x20%s',_0x1204e7,_0x1bf9('0xb'));logger[_0x1bf9('0xc')](_0x1bf9('0xd'),_0x1204e7,_0x1bf9('0xb'),JSON[_0x1bf9('0xe')](_0x5ae2d3));if(_0x5ae2d3[_0x1bf9('0xf')]){if(_0x5ae2d3['error'][_0x1bf9('0x10')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x1204e7,_0x5ae2d3[_0x1bf9('0xf')][_0x1bf9('0x11')]);return _0x1360f8(_0x5ae2d3[_0x1bf9('0xf')][_0x1bf9('0x11')]);}logger['error'](_0x1bf9('0x12'),_0x1204e7,_0x5ae2d3[_0x1bf9('0xf')][_0x1bf9('0x11')]);return _0x35f580(_0x5ae2d3[_0x1bf9('0xf')][_0x1bf9('0x11')]);}else{logger['info'](_0x1bf9('0x12'),_0x1204e7,_0x1bf9('0xb'));_0x35f580(_0x5ae2d3[_0x1bf9('0x13')]['message']);}})[_0x1bf9('0x14')](function(_0x155bac){logger[_0x1bf9('0xf')]('SquareReport,\x20%s,\x20%s',_0x1204e7,_0x155bac);_0x1360f8(_0x155bac);});});}exports[_0x1bf9('0x15')]=function(_0x25eb37){var _0x2ee65d=this;return new Promise(function(_0x3d804f,_0x1d5304){return db[_0x1bf9('0x16')][_0x1bf9('0x17')](_0x25eb37['body'],{'raw':_0x25eb37[_0x1bf9('0x18')]?_0x25eb37[_0x1bf9('0x18')][_0x1bf9('0x19')]===undefined?!![]:![]:!![]})[_0x1bf9('0x9')](function(_0x1ef3fa){logger['info'](_0x1bf9('0x15'),_0x25eb37);logger[_0x1bf9('0xc')](_0x1bf9('0x15'),_0x25eb37,JSON[_0x1bf9('0xe')](_0x1ef3fa));_0x3d804f(_0x1ef3fa);})[_0x1bf9('0x14')](function(_0x2a6e2f){logger['error'](_0x1bf9('0x15'),_0x2a6e2f[_0x1bf9('0x11')],_0x25eb37);_0x1d5304(_0x2ee65d[_0x1bf9('0xf')](0x1f4,_0x2a6e2f['message']));});});};exports[_0x1bf9('0x1a')]=function(_0x4d7564){var _0x264a0e=this;return new Promise(function(_0xe663c0,_0x2d86a6){return db[_0x1bf9('0x16')][_0x1bf9('0x1b')](_0x4d7564['body'],{'raw':_0x4d7564[_0x1bf9('0x18')]?_0x4d7564['options'][_0x1bf9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d7564[_0x1bf9('0x18')]?_0x4d7564['options'][_0x1bf9('0x1c')]||null:null,'attributes':_0x4d7564[_0x1bf9('0x18')]?_0x4d7564['options'][_0x1bf9('0x1d')]||null:null,'limit':_0x4d7564[_0x1bf9('0x18')]?_0x4d7564[_0x1bf9('0x18')][_0x1bf9('0x1e')]||null:null})['then'](function(_0x254c2a){logger[_0x1bf9('0xa')](_0x1bf9('0x1a'),_0x4d7564);logger[_0x1bf9('0xc')](_0x1bf9('0x1a'),_0x4d7564,JSON[_0x1bf9('0xe')](_0x254c2a));_0xe663c0(_0x254c2a);})[_0x1bf9('0x14')](function(_0xfd5d2d){logger[_0x1bf9('0xf')](_0x1bf9('0x1a'),_0xfd5d2d[_0x1bf9('0x11')],_0x4d7564);_0x2d86a6(_0x264a0e['error'](0x1f4,_0xfd5d2d['message']));});});}; \ No newline at end of file +var _0x9eca=['rpc','../../config/environment','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareReport','SquareReport','body','options','raw','debug','UpdateSquareReport','where','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0x9eca,0x139));var _0xa9ec=function(_0xa78054,_0x249d2a){_0xa78054=_0xa78054-0x0;var _0x3b6bcd=_0x9eca[_0xa78054];return _0x3b6bcd;};'use strict';var _=require(_0xa9ec('0x0'));var util=require(_0xa9ec('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa9ec('0x2'));var fs=require('fs');var Redis=require(_0xa9ec('0x3'));var db=require(_0xa9ec('0x4'))['db'];var utils=require(_0xa9ec('0x5'));var logger=require('../../config/logger')(_0xa9ec('0x6'));var config=require(_0xa9ec('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa9ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a4726,_0x3df21c,_0x14a002){return new BPromise(function(_0x3f8b88,_0x61191){return client[_0xa9ec('0x9')](_0x5a4726,_0x14a002)[_0xa9ec('0xa')](function(_0x1f4d96){logger[_0xa9ec('0xb')](_0xa9ec('0xc'),_0x3df21c,_0xa9ec('0xd'));logger['debug'](_0xa9ec('0xe'),_0x3df21c,_0xa9ec('0xd'),JSON[_0xa9ec('0xf')](_0x1f4d96));if(_0x1f4d96[_0xa9ec('0x10')]){if(_0x1f4d96[_0xa9ec('0x10')]['code']===0x1f4){logger[_0xa9ec('0x10')](_0xa9ec('0xc'),_0x3df21c,_0x1f4d96['error'][_0xa9ec('0x11')]);return _0x61191(_0x1f4d96[_0xa9ec('0x10')][_0xa9ec('0x11')]);}logger[_0xa9ec('0x10')](_0xa9ec('0xc'),_0x3df21c,_0x1f4d96['error']['message']);return _0x3f8b88(_0x1f4d96[_0xa9ec('0x10')][_0xa9ec('0x11')]);}else{logger[_0xa9ec('0xb')]('SquareReport,\x20%s,\x20%s',_0x3df21c,_0xa9ec('0xd'));_0x3f8b88(_0x1f4d96[_0xa9ec('0x12')][_0xa9ec('0x11')]);}})[_0xa9ec('0x13')](function(_0x25cca8){logger[_0xa9ec('0x10')](_0xa9ec('0xc'),_0x3df21c,_0x25cca8);_0x61191(_0x25cca8);});});}exports[_0xa9ec('0x14')]=function(_0x1b3bda){var _0x339005=this;return new Promise(function(_0x1fe8b0,_0x443d00){return db[_0xa9ec('0x15')]['create'](_0x1b3bda[_0xa9ec('0x16')],{'raw':_0x1b3bda[_0xa9ec('0x17')]?_0x1b3bda['options'][_0xa9ec('0x18')]===undefined?!![]:![]:!![]})[_0xa9ec('0xa')](function(_0x347089){logger[_0xa9ec('0xb')](_0xa9ec('0x14'),_0x1b3bda);logger[_0xa9ec('0x19')]('CreateSquareReport',_0x1b3bda,JSON[_0xa9ec('0xf')](_0x347089));_0x1fe8b0(_0x347089);})[_0xa9ec('0x13')](function(_0x5d8c54){logger[_0xa9ec('0x10')]('CreateSquareReport',_0x5d8c54[_0xa9ec('0x11')],_0x1b3bda);_0x443d00(_0x339005[_0xa9ec('0x10')](0x1f4,_0x5d8c54[_0xa9ec('0x11')]));});});};exports[_0xa9ec('0x1a')]=function(_0x3a556d){var _0x408909=this;return new Promise(function(_0x4fedab,_0x5c3804){return db[_0xa9ec('0x15')]['update'](_0x3a556d[_0xa9ec('0x16')],{'raw':_0x3a556d[_0xa9ec('0x17')]?_0x3a556d[_0xa9ec('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a556d[_0xa9ec('0x17')]?_0x3a556d[_0xa9ec('0x17')][_0xa9ec('0x1b')]||null:null,'attributes':_0x3a556d['options']?_0x3a556d[_0xa9ec('0x17')]['attributes']||null:null,'limit':_0x3a556d[_0xa9ec('0x17')]?_0x3a556d[_0xa9ec('0x17')][_0xa9ec('0x1c')]||null:null})['then'](function(_0x3d0ba4){logger[_0xa9ec('0xb')](_0xa9ec('0x1a'),_0x3a556d);logger[_0xa9ec('0x19')](_0xa9ec('0x1a'),_0x3a556d,JSON['stringify'](_0x3d0ba4));_0x4fedab(_0x3d0ba4);})[_0xa9ec('0x13')](function(_0x3e672a){logger[_0xa9ec('0x10')](_0xa9ec('0x1a'),_0x3e672a[_0xa9ec('0x11')],_0x3a556d);_0x5c3804(_0x408909['error'](0x1f4,_0x3e672a['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index bf86125..b75aceb 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 _0x2047=['destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete'];(function(_0x23b85e,_0x39b209){var _0x329756=function(_0x3418e1){while(--_0x3418e1){_0x23b85e['push'](_0x23b85e['shift']());}};_0x329756(++_0x39b209);}(_0x2047,0xc0));var _0x7204=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x2047[_0x31e29a];return _0x32d892;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7204('0x0'));var timeout=require(_0x7204('0x1'));var express=require('express');var router=express[_0x7204('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x7204('0x3'));var interaction=require(_0x7204('0x4'));var config=require(_0x7204('0x5'));var controller=require('./squareReportDetail.controller');router[_0x7204('0x6')]('/',auth['isAuthenticated'](),controller[_0x7204('0x7')]);router[_0x7204('0x6')](_0x7204('0x8'),auth[_0x7204('0x9')](),controller[_0x7204('0xa')]);router[_0x7204('0x6')](_0x7204('0xb'),auth[_0x7204('0x9')](),controller[_0x7204('0xc')]);router['post']('/',auth[_0x7204('0x9')](),controller[_0x7204('0xd')]);router[_0x7204('0xe')](_0x7204('0xb'),auth[_0x7204('0x9')](),controller[_0x7204('0xf')]);router[_0x7204('0x10')](_0x7204('0xb'),auth[_0x7204('0x9')](),controller[_0x7204('0x11')]);module[_0x7204('0x12')]=router; \ No newline at end of file +var _0xab55=['get','isAuthenticated','describe','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller'];(function(_0x561e24,_0x42571e){var _0x21ca26=function(_0x2c91e7){while(--_0x2c91e7){_0x561e24['push'](_0x561e24['shift']());}};_0x21ca26(++_0x42571e);}(_0xab55,0xd3));var _0x5ab5=function(_0x2c90e2,_0x3da151){_0x2c90e2=_0x2c90e2-0x0;var _0xe2ec6c=_0xab55[_0x2c90e2];return _0xe2ec6c;};'use strict';var multer=require(_0x5ab5('0x0'));var util=require(_0x5ab5('0x1'));var path=require('path');var timeout=require(_0x5ab5('0x2'));var express=require(_0x5ab5('0x3'));var router=express[_0x5ab5('0x4')]();var fs_extra=require(_0x5ab5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5ab5('0x6'));var config=require(_0x5ab5('0x7'));var controller=require(_0x5ab5('0x8'));router[_0x5ab5('0x9')]('/',auth[_0x5ab5('0xa')](),controller['index']);router[_0x5ab5('0x9')]('/describe',auth[_0x5ab5('0xa')](),controller[_0x5ab5('0xb')]);router[_0x5ab5('0x9')]('/:id',auth[_0x5ab5('0xa')](),controller['show']);router[_0x5ab5('0xc')]('/',auth[_0x5ab5('0xa')](),controller[_0x5ab5('0xd')]);router[_0x5ab5('0xe')](_0x5ab5('0xf'),auth['isAuthenticated'](),controller[_0x5ab5('0x10')]);router[_0x5ab5('0x11')](_0x5ab5('0xf'),auth[_0x5ab5('0xa')](),controller[_0x5ab5('0x12')]);module[_0x5ab5('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 90f6b6c..b555004 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 _0xea31=['STRING','TEXT'];(function(_0x52b2b2,_0x376a30){var _0x92b5b6=function(_0x2e1079){while(--_0x2e1079){_0x52b2b2['push'](_0x52b2b2['shift']());}};_0x92b5b6(++_0x376a30);}(_0xea31,0x1c0));var _0x1ea3=function(_0x3bff3a,_0x1522c0){_0x3bff3a=_0x3bff3a-0x0;var _0x223600=_0xea31[_0x3bff3a];return _0x223600;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x1ea3('0x0')]},'node':{'type':Sequelize[_0x1ea3('0x0')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x1ea3('0x1')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3948=['STRING','sequelize'];(function(_0x2089b3,_0x31fbde){var _0x181087=function(_0x31d19b){while(--_0x31d19b){_0x2089b3['push'](_0x2089b3['shift']());}};_0x181087(++_0x31fbde);}(_0x3948,0x129));var _0x8394=function(_0x537753,_0x272c00){_0x537753=_0x537753-0x0;var _0x5e313d=_0x3948[_0x537753];return _0x5e313d;};'use strict';var Sequelize=require(_0x8394('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8394('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x8394('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x8394('0x1')]},'callerid':{'type':Sequelize[_0x8394('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 9855fc1..09e5b00 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 _0x0b7d=['pick','filter','type','VIRTUAL','options','count','include','rows','catch','show','merge','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','SquareDetailsReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where'];(function(_0x1e9d7b,_0x15dd2b){var _0x360778=function(_0x29e174){while(--_0x29e174){_0x1e9d7b['push'](_0x1e9d7b['shift']());}};_0x360778(++_0x15dd2b);}(_0x0b7d,0xa8));var _0xd0b7=function(_0x1058db,_0x7e3063){_0x1058db=_0x1058db-0x0;var _0x195b98=_0x0b7d[_0x1058db];return _0x195b98;};'use strict';var emlformat=require(_0xd0b7('0x0'));var rimraf=require(_0xd0b7('0x1'));var zipdir=require(_0xd0b7('0x2'));var jsonpatch=require(_0xd0b7('0x3'));var rp=require(_0xd0b7('0x4'));var moment=require(_0xd0b7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd0b7('0x6'));var util=require(_0xd0b7('0x7'));var path=require(_0xd0b7('0x8'));var sox=require(_0xd0b7('0x9'));var csv=require(_0xd0b7('0xa'));var ejs=require(_0xd0b7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd0b7('0xc'));var squel=require(_0xd0b7('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd0b7('0xe'));var toCsv=require(_0xd0b7('0xa'));var querystring=require(_0xd0b7('0xf'));var Papa=require(_0xd0b7('0x10'));var Redis=require(_0xd0b7('0x11'));var authService=require(_0xd0b7('0x12'));var qs=require(_0xd0b7('0x13'));var as=require(_0xd0b7('0x14'));var hardwareService=require(_0xd0b7('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xd0b7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd0b7('0x17'));var db=require(_0xd0b7('0x18'))['db'];function respondWithStatusCode(_0x57c7f6,_0x4908b2){_0x4908b2=_0x4908b2||0xcc;return function(_0x1e1951){if(_0x1e1951){return _0x57c7f6['sendStatus'](_0x4908b2);}return _0x57c7f6[_0xd0b7('0x19')](_0x4908b2)[_0xd0b7('0x1a')]();};}function respondWithResult(_0xcbd582,_0x1c7a8a){_0x1c7a8a=_0x1c7a8a||0xc8;return function(_0x317aab){if(_0x317aab){return _0xcbd582[_0xd0b7('0x19')](_0x1c7a8a)[_0xd0b7('0x1b')](_0x317aab);}};}function respondWithFilteredResult(_0x1d46ef,_0x2083be){return function(_0x1162e5){if(_0x1162e5){var _0x2ea8e1=typeof _0x2083be[_0xd0b7('0x1c')]===_0xd0b7('0x1d')&&typeof _0x2083be['limit']===_0xd0b7('0x1d');var _0x1b7a9d=_0x1162e5['count'];var _0xf7f138=_0x2ea8e1?0x0:_0x2083be[_0xd0b7('0x1c')];var _0x309667=_0x2ea8e1?_0x1162e5['count']:_0x2083be[_0xd0b7('0x1c')]+_0x2083be[_0xd0b7('0x1e')];var _0x153c4e;if(_0x309667>=_0x1b7a9d){_0x309667=_0x1b7a9d;_0x153c4e=0xc8;}else{_0x153c4e=0xce;}_0x1d46ef[_0xd0b7('0x19')](_0x153c4e);return _0x1d46ef[_0xd0b7('0x1f')](_0xd0b7('0x20'),_0xf7f138+'-'+_0x309667+'/'+_0x1b7a9d)['json'](_0x1162e5);}return null;};}function patchUpdates(_0x3a7bc4){return function(_0x49c21b){try{jsonpatch[_0xd0b7('0x21')](_0x49c21b,_0x3a7bc4,!![]);}catch(_0x354675){return BPromise[_0xd0b7('0x22')](_0x354675);}return _0x49c21b[_0xd0b7('0x23')]();};}function saveUpdates(_0x12f5a2,_0x54fe58){return function(_0x5b5f95){if(_0x5b5f95){return _0x5b5f95[_0xd0b7('0x24')](_0x12f5a2)[_0xd0b7('0x25')](function(_0x3f60f8){return _0x3f60f8;});}return null;};}function removeEntity(_0x3f9128,_0x1d27cf){return function(_0x153be6){if(_0x153be6){return _0x153be6[_0xd0b7('0x26')]()[_0xd0b7('0x25')](function(){_0x3f9128['status'](0xcc)[_0xd0b7('0x1a')]();});}};}function handleEntityNotFound(_0x4f639d,_0x307c33){return function(_0x696581){if(!_0x696581){_0x4f639d[_0xd0b7('0x27')](0x194);}return _0x696581;};}function handleError(_0x1aed22,_0x2980e9){_0x2980e9=_0x2980e9||0x1f4;return function(_0x21bc96){logger['error'](_0x21bc96[_0xd0b7('0x28')]);if(_0x21bc96[_0xd0b7('0x29')]){delete _0x21bc96[_0xd0b7('0x29')];}_0x1aed22[_0xd0b7('0x19')](_0x2980e9)['send'](_0x21bc96);};}exports[_0xd0b7('0x2a')]=function(_0x113532,_0x1d514c){var _0x11823b={},_0xc4f5ba={},_0x1b4d42={'count':0x0,'rows':[]};var _0x3e6795=_[_0xd0b7('0x2b')](db[_0xd0b7('0x2c')][_0xd0b7('0x2d')],function(_0x43661d){return{'name':_0x43661d[_0xd0b7('0x2e')],'type':_0x43661d['type'][_0xd0b7('0x2f')]};});_0xc4f5ba[_0xd0b7('0x30')]=_['map'](_0x3e6795,_0xd0b7('0x29'));_0xc4f5ba[_0xd0b7('0x31')]=_[_0xd0b7('0x32')](_0x113532[_0xd0b7('0x31')]);_0xc4f5ba[_0xd0b7('0x33')]=_[_0xd0b7('0x34')](_0xc4f5ba[_0xd0b7('0x30')],_0xc4f5ba[_0xd0b7('0x31')]);_0x11823b['attributes']=_[_0xd0b7('0x34')](_0xc4f5ba[_0xd0b7('0x30')],qs[_0xd0b7('0x35')](_0x113532['query']['fields']));_0x11823b[_0xd0b7('0x36')]=_0x11823b[_0xd0b7('0x36')][_0xd0b7('0x37')]?_0x11823b[_0xd0b7('0x36')]:_0xc4f5ba['model'];if(!_0x113532[_0xd0b7('0x31')][_0xd0b7('0x38')](_0xd0b7('0x39'))){_0x11823b[_0xd0b7('0x1e')]=qs['limit'](_0x113532[_0xd0b7('0x31')]['limit']);_0x11823b[_0xd0b7('0x1c')]=qs[_0xd0b7('0x1c')](_0x113532['query'][_0xd0b7('0x1c')]);}_0x11823b['order']=qs[_0xd0b7('0x3a')](_0x113532[_0xd0b7('0x31')][_0xd0b7('0x3a')]);_0x11823b[_0xd0b7('0x3b')]=qs[_0xd0b7('0x33')](_[_0xd0b7('0x3c')](_0x113532[_0xd0b7('0x31')],_0xc4f5ba[_0xd0b7('0x33')]),_0x3e6795);if(_0x113532['query'][_0xd0b7('0x3d')]){_0x11823b[_0xd0b7('0x3b')]=_['merge'](_0x11823b['where'],{'$or':_[_0xd0b7('0x2b')](_0x3e6795,function(_0x275de1){if(_0x275de1[_0xd0b7('0x3e')]!==_0xd0b7('0x3f')){var _0x3c0dbc={};_0x3c0dbc[_0x275de1['name']]={'$like':'%'+_0x113532[_0xd0b7('0x31')][_0xd0b7('0x3d')]+'%'};return _0x3c0dbc;}})});}_0x11823b=_['merge']({},_0x11823b,_0x113532[_0xd0b7('0x40')]);var _0x176a5e={'where':_0x11823b[_0xd0b7('0x3b')]};return db['SquareDetailsReport'][_0xd0b7('0x41')](_0x176a5e)['then'](function(_0x55c340){_0x1b4d42[_0xd0b7('0x41')]=_0x55c340;if(_0x113532[_0xd0b7('0x31')]['includeAll']){_0x11823b[_0xd0b7('0x42')]=[{'all':!![]}];}return db[_0xd0b7('0x2c')]['findAll'](_0x11823b);})[_0xd0b7('0x25')](function(_0x14c5fc){_0x1b4d42[_0xd0b7('0x43')]=_0x14c5fc;return _0x1b4d42;})[_0xd0b7('0x25')](respondWithFilteredResult(_0x1d514c,_0x11823b))[_0xd0b7('0x44')](handleError(_0x1d514c,null));};exports[_0xd0b7('0x45')]=function(_0x8cc2c,_0x3633d3){var _0x3d81f1={'raw':!![],'where':{'id':_0x8cc2c['params']['id']}},_0x2aaf8d={};_0x2aaf8d[_0xd0b7('0x30')]=_[_0xd0b7('0x32')](db[_0xd0b7('0x2c')]['rawAttributes']);_0x2aaf8d[_0xd0b7('0x31')]=_[_0xd0b7('0x32')](_0x8cc2c[_0xd0b7('0x31')]);_0x2aaf8d[_0xd0b7('0x33')]=_['intersection'](_0x2aaf8d[_0xd0b7('0x30')],_0x2aaf8d[_0xd0b7('0x31')]);_0x3d81f1['attributes']=_['intersection'](_0x2aaf8d[_0xd0b7('0x30')],qs[_0xd0b7('0x35')](_0x8cc2c[_0xd0b7('0x31')][_0xd0b7('0x35')]));_0x3d81f1[_0xd0b7('0x36')]=_0x3d81f1['attributes'][_0xd0b7('0x37')]?_0x3d81f1[_0xd0b7('0x36')]:_0x2aaf8d[_0xd0b7('0x30')];if(_0x8cc2c[_0xd0b7('0x31')]['includeAll']){_0x3d81f1[_0xd0b7('0x42')]=[{'all':!![]}];}_0x3d81f1=_[_0xd0b7('0x46')]({},_0x3d81f1,_0x8cc2c[_0xd0b7('0x40')]);return db[_0xd0b7('0x2c')]['find'](_0x3d81f1)[_0xd0b7('0x25')](handleEntityNotFound(_0x3633d3,null))['then'](respondWithResult(_0x3633d3,null))[_0xd0b7('0x44')](handleError(_0x3633d3,null));};exports[_0xd0b7('0x47')]=function(_0xc05c29,_0x12d4b0){return db[_0xd0b7('0x2c')][_0xd0b7('0x47')](_0xc05c29[_0xd0b7('0x48')],{})[_0xd0b7('0x25')](respondWithResult(_0x12d4b0,0xc9))['catch'](handleError(_0x12d4b0,null));};exports[_0xd0b7('0x24')]=function(_0x30b160,_0x4a0077){if(_0x30b160[_0xd0b7('0x48')]['id']){delete _0x30b160[_0xd0b7('0x48')]['id'];}return db['SquareDetailsReport'][_0xd0b7('0x49')]({'where':{'id':_0x30b160[_0xd0b7('0x4a')]['id']}})[_0xd0b7('0x25')](handleEntityNotFound(_0x4a0077,null))['then'](saveUpdates(_0x30b160[_0xd0b7('0x48')],null))[_0xd0b7('0x25')](respondWithResult(_0x4a0077,null))[_0xd0b7('0x44')](handleError(_0x4a0077,null));};exports[_0xd0b7('0x26')]=function(_0x37d4c8,_0x4a2d40){return db[_0xd0b7('0x2c')]['find']({'where':{'id':_0x37d4c8[_0xd0b7('0x4a')]['id']}})[_0xd0b7('0x25')](handleEntityNotFound(_0x4a2d40,null))['then'](removeEntity(_0x4a2d40,null))[_0xd0b7('0x44')](handleError(_0x4a2d40,null));};exports[_0xd0b7('0x4b')]=function(_0xa6eb04,_0x22ef95){return db[_0xd0b7('0x2c')][_0xd0b7('0x4b')]()['then'](respondWithResult(_0x22ef95,null))[_0xd0b7('0x44')](handleError(_0x22ef95,null));}; \ No newline at end of file +var _0x839d=['body','params','describe','rimraf','bluebird','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','map','SquareDetailsReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','count','include','rows','show','rawAttributes','includeAll','catch','create'];(function(_0x4fa276,_0x1e5499){var _0x1d9f01=function(_0x2edddd){while(--_0x2edddd){_0x4fa276['push'](_0x4fa276['shift']());}};_0x1d9f01(++_0x1e5499);}(_0x839d,0x1b3));var _0xd839=function(_0x325fa3,_0x279ef6){_0x325fa3=_0x325fa3-0x0;var _0x180e68=_0x839d[_0x325fa3];return _0x180e68;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd839('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd839('0x1'));var Mustache=require('mustache');var util=require(_0xd839('0x2'));var path=require(_0xd839('0x3'));var sox=require(_0xd839('0x4'));var csv=require(_0xd839('0x5'));var ejs=require(_0xd839('0x6'));var fs=require('fs');var fs_extra=require(_0xd839('0x7'));var _=require(_0xd839('0x8'));var squel=require(_0xd839('0x9'));var crypto=require('crypto');var jsforce=require(_0xd839('0xa'));var deskjs=require(_0xd839('0xb'));var toCsv=require(_0xd839('0x5'));var querystring=require('querystring');var Papa=require(_0xd839('0xc'));var Redis=require(_0xd839('0xd'));var authService=require(_0xd839('0xe'));var qs=require(_0xd839('0xf'));var as=require(_0xd839('0x10'));var hardwareService=require(_0xd839('0x11'));var logger=require(_0xd839('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd839('0x13'));var db=require(_0xd839('0x14'))['db'];function respondWithStatusCode(_0x2f32a4,_0x871ba8){_0x871ba8=_0x871ba8||0xcc;return function(_0x3ebac2){if(_0x3ebac2){return _0x2f32a4[_0xd839('0x15')](_0x871ba8);}return _0x2f32a4[_0xd839('0x16')](_0x871ba8)[_0xd839('0x17')]();};}function respondWithResult(_0x51803d,_0x4016d4){_0x4016d4=_0x4016d4||0xc8;return function(_0x3f3e05){if(_0x3f3e05){return _0x51803d['status'](_0x4016d4)[_0xd839('0x18')](_0x3f3e05);}};}function respondWithFilteredResult(_0xa05dd5,_0x2dd300){return function(_0x354315){if(_0x354315){var _0x5ae528=typeof _0x2dd300[_0xd839('0x19')]==='undefined'&&typeof _0x2dd300[_0xd839('0x1a')]===_0xd839('0x1b');var _0x196fe1=_0x354315['count'];var _0x31d0fd=_0x5ae528?0x0:_0x2dd300[_0xd839('0x19')];var _0x181551=_0x5ae528?_0x354315['count']:_0x2dd300[_0xd839('0x19')]+_0x2dd300[_0xd839('0x1a')];var _0x23d074;if(_0x181551>=_0x196fe1){_0x181551=_0x196fe1;_0x23d074=0xc8;}else{_0x23d074=0xce;}_0xa05dd5[_0xd839('0x16')](_0x23d074);return _0xa05dd5[_0xd839('0x1c')](_0xd839('0x1d'),_0x31d0fd+'-'+_0x181551+'/'+_0x196fe1)['json'](_0x354315);}return null;};}function patchUpdates(_0x544a8e){return function(_0x577c4a){try{jsonpatch[_0xd839('0x1e')](_0x577c4a,_0x544a8e,!![]);}catch(_0x281f6a){return BPromise[_0xd839('0x1f')](_0x281f6a);}return _0x577c4a['save']();};}function saveUpdates(_0x55a9f1,_0x204549){return function(_0x4c7e2f){if(_0x4c7e2f){return _0x4c7e2f[_0xd839('0x20')](_0x55a9f1)['then'](function(_0x580abf){return _0x580abf;});}return null;};}function removeEntity(_0x83659,_0x2f5d9d){return function(_0x558a5a){if(_0x558a5a){return _0x558a5a[_0xd839('0x21')]()[_0xd839('0x22')](function(){_0x83659[_0xd839('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d3b33,_0x5927b5){return function(_0x17dc78){if(!_0x17dc78){_0x5d3b33[_0xd839('0x15')](0x194);}return _0x17dc78;};}function handleError(_0x269f06,_0x40f351){_0x40f351=_0x40f351||0x1f4;return function(_0x357a60){logger[_0xd839('0x23')](_0x357a60[_0xd839('0x24')]);if(_0x357a60[_0xd839('0x25')]){delete _0x357a60[_0xd839('0x25')];}_0x269f06[_0xd839('0x16')](_0x40f351)[_0xd839('0x26')](_0x357a60);};}exports[_0xd839('0x27')]=function(_0x136b1c,_0x4f2e28){var _0x28b42f={},_0x2f2598={},_0x154a6a={'count':0x0,'rows':[]};var _0x2ae437=_[_0xd839('0x28')](db[_0xd839('0x29')]['rawAttributes'],function(_0x2c13e9){return{'name':_0x2c13e9[_0xd839('0x2a')],'type':_0x2c13e9[_0xd839('0x2b')][_0xd839('0x2c')]};});_0x2f2598[_0xd839('0x2d')]=_['map'](_0x2ae437,'name');_0x2f2598[_0xd839('0x2e')]=_[_0xd839('0x2f')](_0x136b1c[_0xd839('0x2e')]);_0x2f2598[_0xd839('0x30')]=_[_0xd839('0x31')](_0x2f2598[_0xd839('0x2d')],_0x2f2598['query']);_0x28b42f[_0xd839('0x32')]=_[_0xd839('0x31')](_0x2f2598[_0xd839('0x2d')],qs['fields'](_0x136b1c[_0xd839('0x2e')][_0xd839('0x33')]));_0x28b42f[_0xd839('0x32')]=_0x28b42f['attributes'][_0xd839('0x34')]?_0x28b42f[_0xd839('0x32')]:_0x2f2598[_0xd839('0x2d')];if(!_0x136b1c['query'][_0xd839('0x35')](_0xd839('0x36'))){_0x28b42f[_0xd839('0x1a')]=qs['limit'](_0x136b1c[_0xd839('0x2e')][_0xd839('0x1a')]);_0x28b42f['offset']=qs[_0xd839('0x19')](_0x136b1c[_0xd839('0x2e')][_0xd839('0x19')]);}_0x28b42f[_0xd839('0x37')]=qs[_0xd839('0x38')](_0x136b1c[_0xd839('0x2e')][_0xd839('0x38')]);_0x28b42f[_0xd839('0x39')]=qs['filters'](_[_0xd839('0x3a')](_0x136b1c[_0xd839('0x2e')],_0x2f2598[_0xd839('0x30')]),_0x2ae437);if(_0x136b1c[_0xd839('0x2e')][_0xd839('0x3b')]){_0x28b42f[_0xd839('0x39')]=_['merge'](_0x28b42f[_0xd839('0x39')],{'$or':_[_0xd839('0x28')](_0x2ae437,function(_0x129bda){if(_0x129bda['type']!=='VIRTUAL'){var _0x412e31={};_0x412e31[_0x129bda[_0xd839('0x25')]]={'$like':'%'+_0x136b1c['query'][_0xd839('0x3b')]+'%'};return _0x412e31;}})});}_0x28b42f=_['merge']({},_0x28b42f,_0x136b1c[_0xd839('0x3c')]);var _0x3be331={'where':_0x28b42f[_0xd839('0x39')]};return db[_0xd839('0x29')][_0xd839('0x3d')](_0x3be331)[_0xd839('0x22')](function(_0x49cca5){_0x154a6a[_0xd839('0x3d')]=_0x49cca5;if(_0x136b1c[_0xd839('0x2e')]['includeAll']){_0x28b42f[_0xd839('0x3e')]=[{'all':!![]}];}return db[_0xd839('0x29')]['findAll'](_0x28b42f);})[_0xd839('0x22')](function(_0x12b7c1){_0x154a6a[_0xd839('0x3f')]=_0x12b7c1;return _0x154a6a;})[_0xd839('0x22')](respondWithFilteredResult(_0x4f2e28,_0x28b42f))['catch'](handleError(_0x4f2e28,null));};exports[_0xd839('0x40')]=function(_0x9a374c,_0x5e0b21){var _0x100ff4={'raw':!![],'where':{'id':_0x9a374c['params']['id']}},_0x328ef8={};_0x328ef8[_0xd839('0x2d')]=_[_0xd839('0x2f')](db[_0xd839('0x29')][_0xd839('0x41')]);_0x328ef8['query']=_['keys'](_0x9a374c[_0xd839('0x2e')]);_0x328ef8[_0xd839('0x30')]=_[_0xd839('0x31')](_0x328ef8['model'],_0x328ef8[_0xd839('0x2e')]);_0x100ff4['attributes']=_['intersection'](_0x328ef8['model'],qs[_0xd839('0x33')](_0x9a374c[_0xd839('0x2e')]['fields']));_0x100ff4[_0xd839('0x32')]=_0x100ff4[_0xd839('0x32')][_0xd839('0x34')]?_0x100ff4[_0xd839('0x32')]:_0x328ef8[_0xd839('0x2d')];if(_0x9a374c[_0xd839('0x2e')][_0xd839('0x42')]){_0x100ff4[_0xd839('0x3e')]=[{'all':!![]}];}_0x100ff4=_['merge']({},_0x100ff4,_0x9a374c[_0xd839('0x3c')]);return db[_0xd839('0x29')]['find'](_0x100ff4)[_0xd839('0x22')](handleEntityNotFound(_0x5e0b21,null))[_0xd839('0x22')](respondWithResult(_0x5e0b21,null))[_0xd839('0x43')](handleError(_0x5e0b21,null));};exports[_0xd839('0x44')]=function(_0x219d2a,_0x2b453e){return db[_0xd839('0x29')][_0xd839('0x44')](_0x219d2a[_0xd839('0x45')],{})[_0xd839('0x22')](respondWithResult(_0x2b453e,0xc9))[_0xd839('0x43')](handleError(_0x2b453e,null));};exports['update']=function(_0xe36f03,_0x591fb0){if(_0xe36f03['body']['id']){delete _0xe36f03[_0xd839('0x45')]['id'];}return db[_0xd839('0x29')]['find']({'where':{'id':_0xe36f03[_0xd839('0x46')]['id']}})[_0xd839('0x22')](handleEntityNotFound(_0x591fb0,null))['then'](saveUpdates(_0xe36f03[_0xd839('0x45')],null))[_0xd839('0x22')](respondWithResult(_0x591fb0,null))[_0xd839('0x43')](handleError(_0x591fb0,null));};exports[_0xd839('0x21')]=function(_0x3c3d34,_0x4608e1){return db[_0xd839('0x29')]['find']({'where':{'id':_0x3c3d34[_0xd839('0x46')]['id']}})[_0xd839('0x22')](handleEntityNotFound(_0x4608e1,null))[_0xd839('0x22')](removeEntity(_0x4608e1,null))['catch'](handleError(_0x4608e1,null));};exports[_0xd839('0x47')]=function(_0x371fab,_0x15ddfe){return db[_0xd839('0x29')][_0xd839('0x47')]()['then'](respondWithResult(_0x15ddfe,null))[_0xd839('0x43')](handleError(_0x15ddfe,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index a53ab92..103e042 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 _0xb490=['../../config/logger','api','moment','request-promise','path','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','lodash','util'];(function(_0x43ed2c,_0x15d3a9){var _0xcb628e=function(_0x5a6690){while(--_0x5a6690){_0x43ed2c['push'](_0x43ed2c['shift']());}};_0xcb628e(++_0x15d3a9);}(_0xb490,0x15a));var _0x0b49=function(_0xcd69fd,_0xff0e3e){_0xcd69fd=_0xcd69fd-0x0;var _0x5a5bfe=_0xb490[_0xcd69fd];return _0x5a5bfe;};'use strict';var _=require(_0x0b49('0x0'));var util=require(_0x0b49('0x1'));var logger=require(_0x0b49('0x2'))(_0x0b49('0x3'));var moment=require(_0x0b49('0x4'));var BPromise=require('bluebird');var rp=require(_0x0b49('0x5'));var fs=require('fs');var path=require(_0x0b49('0x6'));var rimraf=require('rimraf');var config=require(_0x0b49('0x7'));var attributes=require(_0x0b49('0x8'));module[_0x0b49('0x9')]=function(_0x37504e,_0x53333e){return _0x37504e['define'](_0x0b49('0xa'),attributes,{'tableName':_0x0b49('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacfc=['SquareDetailsReport','report_square_details','util','api','bluebird','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define'];(function(_0x5e6808,_0x499ddd){var _0xcb3b93=function(_0xebcf3d){while(--_0xebcf3d){_0x5e6808['push'](_0x5e6808['shift']());}};_0xcb3b93(++_0x499ddd);}(_0xacfc,0xa7));var _0xcacf=function(_0x90291c,_0x58bdc2){_0x90291c=_0x90291c-0x0;var _0x4bc081=_0xacfc[_0x90291c];return _0x4bc081;};'use strict';var _=require('lodash');var util=require(_0xcacf('0x0'));var logger=require('../../config/logger')(_0xcacf('0x1'));var moment=require('moment');var BPromise=require(_0xcacf('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcacf('0x3'));var rimraf=require(_0xcacf('0x4'));var config=require(_0xcacf('0x5'));var attributes=require(_0xcacf('0x6'));module[_0xcacf('0x7')]=function(_0x5b8d18,_0x1b98b6){return _0x5b8d18[_0xcacf('0x8')](_0xcacf('0x9'),attributes,{'tableName':_0xcacf('0xa'),'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 a33827e..2afda6e 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 _0xf65d=['randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','stringify','lodash','moment','bluebird'];(function(_0x527cc3,_0x5166f9){var _0x1d95db=function(_0x255826){while(--_0x255826){_0x527cc3['push'](_0x527cc3['shift']());}};_0x1d95db(++_0x5166f9);}(_0xf65d,0x9f));var _0xdf65=function(_0x1e4e1a,_0x3bdb4a){_0x1e4e1a=_0x1e4e1a-0x0;var _0x462e08=_0xf65d[_0x1e4e1a];return _0x462e08;};'use strict';var _=require(_0xdf65('0x0'));var util=require('util');var moment=require(_0xdf65('0x1'));var BPromise=require(_0xdf65('0x2'));var rs=require(_0xdf65('0x3'));var fs=require('fs');var Redis=require(_0xdf65('0x4'));var db=require(_0xdf65('0x5'))['db'];var utils=require(_0xdf65('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xdf65('0x7'));var client=jayson['client'][_0xdf65('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33efa2,_0x4c4054,_0x40cc08){return new BPromise(function(_0x3f5cae,_0x97292b){return client[_0xdf65('0x9')](_0x33efa2,_0x40cc08)[_0xdf65('0xa')](function(_0x46a70d){logger['info'](_0xdf65('0xb'),_0x4c4054,'request\x20sent');logger[_0xdf65('0xc')](_0xdf65('0xd'),_0x4c4054,_0xdf65('0xe'),JSON['stringify'](_0x46a70d));if(_0x46a70d['error']){if(_0x46a70d[_0xdf65('0xf')][_0xdf65('0x10')]===0x1f4){logger[_0xdf65('0xf')](_0xdf65('0xb'),_0x4c4054,_0x46a70d[_0xdf65('0xf')][_0xdf65('0x11')]);return _0x97292b(_0x46a70d['error'][_0xdf65('0x11')]);}logger[_0xdf65('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x4c4054,_0x46a70d['error']['message']);return _0x3f5cae(_0x46a70d[_0xdf65('0xf')][_0xdf65('0x11')]);}else{logger[_0xdf65('0x12')](_0xdf65('0xb'),_0x4c4054,_0xdf65('0xe'));_0x3f5cae(_0x46a70d[_0xdf65('0x13')][_0xdf65('0x11')]);}})[_0xdf65('0x14')](function(_0x208b93){logger[_0xdf65('0xf')]('SquareDetailsReport,\x20%s,\x20%s',_0x4c4054,_0x208b93);_0x97292b(_0x208b93);});});}exports[_0xdf65('0x15')]=function(_0x532215){var _0x28fcd1=this;return new Promise(function(_0x3a175b,_0x2337da){return db[_0xdf65('0x16')][_0xdf65('0x17')](_0x532215[_0xdf65('0x18')],{'raw':_0x532215['options']?_0x532215[_0xdf65('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xdf65('0xa')](function(_0x299ed3){logger[_0xdf65('0x12')](_0xdf65('0x15'),_0x532215);logger[_0xdf65('0xc')]('CreateSquareDetailsReport',_0x532215,JSON[_0xdf65('0x1a')](_0x299ed3));_0x3a175b(_0x299ed3);})[_0xdf65('0x14')](function(_0x5ee78d){logger[_0xdf65('0xf')](_0xdf65('0x15'),_0x5ee78d[_0xdf65('0x11')],_0x532215);_0x2337da(_0x28fcd1[_0xdf65('0xf')](0x1f4,_0x5ee78d['message']));});});}; \ No newline at end of file +var _0x8caf=['../../config/environment','jayson/promise','client','http','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x114655,_0x4f8678){var _0x5930b6=function(_0x2eed10){while(--_0x2eed10){_0x114655['push'](_0x114655['shift']());}};_0x5930b6(++_0x4f8678);}(_0x8caf,0x1ab));var _0xf8ca=function(_0x4186fa,_0x26a01c){_0x4186fa=_0x4186fa-0x0;var _0x136990=_0x8caf[_0x4186fa];return _0x136990;};'use strict';var _=require('lodash');var util=require(_0xf8ca('0x0'));var moment=require(_0xf8ca('0x1'));var BPromise=require(_0xf8ca('0x2'));var rs=require(_0xf8ca('0x3'));var fs=require('fs');var Redis=require(_0xf8ca('0x4'));var db=require(_0xf8ca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8ca('0x6'))(_0xf8ca('0x7'));var config=require(_0xf8ca('0x8'));var jayson=require(_0xf8ca('0x9'));var client=jayson[_0xf8ca('0xa')][_0xf8ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x562eea,_0x773b9f,_0x3abd58){return new BPromise(function(_0x3a91d3,_0x31300c){return client['request'](_0x562eea,_0x3abd58)['then'](function(_0x3a9674){logger['info'](_0xf8ca('0xc'),_0x773b9f,_0xf8ca('0xd'));logger[_0xf8ca('0xe')](_0xf8ca('0xf'),_0x773b9f,'request\x20sent',JSON[_0xf8ca('0x10')](_0x3a9674));if(_0x3a9674[_0xf8ca('0x11')]){if(_0x3a9674[_0xf8ca('0x11')][_0xf8ca('0x12')]===0x1f4){logger['error'](_0xf8ca('0xc'),_0x773b9f,_0x3a9674[_0xf8ca('0x11')]['message']);return _0x31300c(_0x3a9674[_0xf8ca('0x11')][_0xf8ca('0x13')]);}logger[_0xf8ca('0x11')](_0xf8ca('0xc'),_0x773b9f,_0x3a9674[_0xf8ca('0x11')][_0xf8ca('0x13')]);return _0x3a91d3(_0x3a9674[_0xf8ca('0x11')][_0xf8ca('0x13')]);}else{logger[_0xf8ca('0x14')](_0xf8ca('0xc'),_0x773b9f,'request\x20sent');_0x3a91d3(_0x3a9674[_0xf8ca('0x15')][_0xf8ca('0x13')]);}})[_0xf8ca('0x16')](function(_0x12e8f0){logger[_0xf8ca('0x11')](_0xf8ca('0xc'),_0x773b9f,_0x12e8f0);_0x31300c(_0x12e8f0);});});}exports[_0xf8ca('0x17')]=function(_0x127119){var _0x50e805=this;return new Promise(function(_0x237f44,_0x3b5400){return db[_0xf8ca('0x18')][_0xf8ca('0x19')](_0x127119['body'],{'raw':_0x127119[_0xf8ca('0x1a')]?_0x127119[_0xf8ca('0x1a')][_0xf8ca('0x1b')]===undefined?!![]:![]:!![]})[_0xf8ca('0x1c')](function(_0x18e8da){logger[_0xf8ca('0x14')]('CreateSquareDetailsReport',_0x127119);logger[_0xf8ca('0xe')]('CreateSquareDetailsReport',_0x127119,JSON[_0xf8ca('0x10')](_0x18e8da));_0x237f44(_0x18e8da);})[_0xf8ca('0x16')](function(_0x179a48){logger[_0xf8ca('0x11')](_0xf8ca('0x17'),_0x179a48[_0xf8ca('0x13')],_0x127119);_0x3b5400(_0x50e805['error'](0x1f4,_0x179a48['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index d465282..210972c 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 _0x052f=['express','Router','../../components/auth/service','./system.controller','get','index','/process/:pid/kill','killProcess','exports'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x052f,0x117));var _0xf052=function(_0xe635b1,_0x4b9cd4){_0xe635b1=_0xe635b1-0x0;var _0xac3378=_0x052f[_0xe635b1];return _0xac3378;};'use strict';var express=require(_0xf052('0x0'));var router=express[_0xf052('0x1')]();var auth=require(_0xf052('0x2'));var controller=require(_0xf052('0x3'));router[_0xf052('0x4')]('/',auth['isAuthenticated'](),controller[_0xf052('0x5')]);router[_0xf052('0x4')](_0xf052('0x6'),auth['isAuthenticated'](),controller[_0xf052('0x7')]);module[_0xf052('0x8')]=router; \ No newline at end of file +var _0xc26c=['../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','Router'];(function(_0x5344fa,_0x9e2786){var _0x4a867b=function(_0x279109){while(--_0x279109){_0x5344fa['push'](_0x5344fa['shift']());}};_0x4a867b(++_0x9e2786);}(_0xc26c,0xd0));var _0xcc26=function(_0x39c05b,_0x16b2d8){_0x39c05b=_0x39c05b-0x0;var _0x54eb38=_0xc26c[_0x39c05b];return _0x54eb38;};'use strict';var express=require(_0xcc26('0x0'));var router=express[_0xcc26('0x1')]();var auth=require(_0xcc26('0x2'));var controller=require(_0xcc26('0x3'));router[_0xcc26('0x4')]('/',auth[_0xcc26('0x5')](),controller[_0xcc26('0x6')]);router['get'](_0xcc26('0x7'),auth[_0xcc26('0x5')](),controller[_0xcc26('0x8')]);module[_0xcc26('0x9')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 624baff..1048f57 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 _0xe66a=['killProcess','systeminformation','child_process','exec','../../config/logger','bluebird','name','status','send','index','getAllData','then','catch','json','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly'];(function(_0x1e3e1e,_0x1fe697){var _0xc9d950=function(_0x28b8cb){while(--_0x28b8cb){_0x1e3e1e['push'](_0x1e3e1e['shift']());}};_0xc9d950(++_0x1fe697);}(_0xe66a,0xd9));var _0xae66=function(_0x2a19a8,_0x4599f0){_0x2a19a8=_0x2a19a8-0x0;var _0x226dc=_0xe66a[_0x2a19a8];return _0x226dc;};'use strict';var info=require(_0xae66('0x0'));var exec=require(_0xae66('0x1'))[_0xae66('0x2')];var logger=require(_0xae66('0x3'))('api');var util=require('util');var BPromise=require(_0xae66('0x4'));var _=require('lodash');function handleError(_0x2888e6,_0x49dd6b,_0x5b05f0){_0x49dd6b=_0x49dd6b||0x1f4;return function(_0x8cce0f){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x5b05f0,_0x49dd6b,util['inspect'](_0x8cce0f,{'showHidden':![],'depth':null}));delete _0x8cce0f[_0xae66('0x5')];_0x2888e6[_0xae66('0x6')](_0x49dd6b)[_0xae66('0x7')](_0x8cce0f);};}exports[_0xae66('0x8')]=function(_0x2768de,_0x47a04c){return info[_0xae66('0x9')]()[_0xae66('0xa')](function(_0x4dadee){return _0x47a04c[_0xae66('0x6')](0xc8)['json'](_0x4dadee);})[_0xae66('0xb')](function(_0x56098f){return _0x47a04c[_0xae66('0x6')](0x1f4)[_0xae66('0xc')](_0x56098f);});};exports['killProcess']=function(_0x22873b,_0x2a2f1f){var _0x4404b9=['components/import/cm'];return new BPromise(function(_0x1ebfe7,_0x5646af){return exec(util[_0xae66('0xd')](_0xae66('0xe'),_0x22873b[_0xae66('0xf')]['pid']),function(_0x394b4b,_0x51f81d,_0x4be32e){if(_0x394b4b){return _0x5646af(_0x394b4b);}return _0x1ebfe7(_0x51f81d);});})[_0xae66('0xa')](function(_0x3ccc50){var _0x3ed5e7=![];var _0x306fe7=_0x3ccc50[_0xae66('0x10')](/\n/);for(var _0x42b6ca=0x0,_0x41fcb3=_0x4404b9[_0xae66('0x11')];_0x42b6ca<_0x41fcb3,_0x3ed5e7===![];_0x42b6ca+=0x1){if(_0x3ccc50[_0xae66('0x12')](_0x4404b9[_0x42b6ca])>=0x0){_0x3ed5e7=!![];}}if(!_0x3ed5e7){throw new Error(util[_0xae66('0xd')](_0xae66('0x13'),_0x22873b[_0xae66('0xf')][_0xae66('0x14')]));}process['kill'](_0x22873b[_0xae66('0xf')][_0xae66('0x14')],_0xae66('0x15'));return _0x2a2f1f[_0xae66('0x6')](0xc8)[_0xae66('0xc')]({'message':util['format'](_0xae66('0x16'),_0x22873b['params'][_0xae66('0x14')])});})['catch'](handleError(_0x2a2f1f,null,_0xae66('0x17')));}; \ No newline at end of file +var _0x6899=['SIGINT','json','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','api','util','bluebird','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','catch','killProcess','params','pid','then','split','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill'];(function(_0x4a9e10,_0x3b4665){var _0x5c6834=function(_0x239f7e){while(--_0x239f7e){_0x4a9e10['push'](_0x4a9e10['shift']());}};_0x5c6834(++_0x3b4665);}(_0x6899,0x1a3));var _0x9689=function(_0x13bade,_0x588f04){_0x13bade=_0x13bade-0x0;var _0x809724=_0x6899[_0x13bade];return _0x809724;};'use strict';var info=require(_0x9689('0x0'));var exec=require('child_process')[_0x9689('0x1')];var logger=require(_0x9689('0x2'))(_0x9689('0x3'));var util=require(_0x9689('0x4'));var BPromise=require(_0x9689('0x5'));var _=require('lodash');function handleError(_0x5e07b3,_0x297499,_0x5d7ea5){_0x297499=_0x297499||0x1f4;return function(_0x5c218f){logger[_0x9689('0x6')](_0x9689('0x7'),_0x5d7ea5,_0x297499,util[_0x9689('0x8')](_0x5c218f,{'showHidden':![],'depth':null}));delete _0x5c218f[_0x9689('0x9')];_0x5e07b3[_0x9689('0xa')](_0x297499)[_0x9689('0xb')](_0x5c218f);};}exports[_0x9689('0xc')]=function(_0x40b440,_0x52e7d2){return info[_0x9689('0xd')]()['then'](function(_0x3eabbe){return _0x52e7d2[_0x9689('0xa')](0xc8)['json'](_0x3eabbe);})[_0x9689('0xe')](function(_0xe510f5){return _0x52e7d2[_0x9689('0xa')](0x1f4)['json'](_0xe510f5);});};exports[_0x9689('0xf')]=function(_0x19d784,_0x5445c6){var _0x3e9523=['components/import/cm'];return new BPromise(function(_0x3d0e2e,_0x54d3e4){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x19d784[_0x9689('0x10')][_0x9689('0x11')]),function(_0x2ff230,_0x1dae79,_0x1b3268){if(_0x2ff230){return _0x54d3e4(_0x2ff230);}return _0x3d0e2e(_0x1dae79);});})[_0x9689('0x12')](function(_0x4e942e){var _0x2084e2=![];var _0x563e6b=_0x4e942e[_0x9689('0x13')](/\n/);for(var _0x298849=0x0,_0x463dec=_0x3e9523['length'];_0x298849<_0x463dec,_0x2084e2===![];_0x298849+=0x1){if(_0x4e942e['indexOf'](_0x3e9523[_0x298849])>=0x0){_0x2084e2=!![];}}if(!_0x2084e2){throw new Error(util[_0x9689('0x14')](_0x9689('0x15'),_0x19d784[_0x9689('0x10')]['pid']));}process[_0x9689('0x16')](_0x19d784['params'][_0x9689('0x11')],_0x9689('0x17'));return _0x5445c6[_0x9689('0xa')](0xc8)[_0x9689('0x18')]({'message':util[_0x9689('0x14')](_0x9689('0x19'),_0x19d784['params'][_0x9689('0x11')])});})[_0x9689('0xe')](handleError(_0x5445c6,null,_0x9689('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index aabf5ab..ca8f990 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 _0x093f=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','destroy'];(function(_0x53ddab,_0x4ada9d){var _0x5819ac=function(_0x4d5fc8){while(--_0x4d5fc8){_0x53ddab['push'](_0x53ddab['shift']());}};_0x5819ac(++_0x4ada9d);}(_0x093f,0xd2));var _0xf093=function(_0x1c1783,_0x5ba390){_0x1c1783=_0x1c1783-0x0;var _0x59399f=_0x093f[_0x1c1783];return _0x59399f;};'use strict';var multer=require(_0xf093('0x0'));var util=require(_0xf093('0x1'));var path=require(_0xf093('0x2'));var timeout=require(_0xf093('0x3'));var express=require(_0xf093('0x4'));var router=express[_0xf093('0x5')]();var fs_extra=require(_0xf093('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf093('0x7'));var config=require(_0xf093('0x8'));var controller=require('./tag.controller');router[_0xf093('0x9')]('/',auth[_0xf093('0xa')](),controller[_0xf093('0xb')]);router[_0xf093('0x9')](_0xf093('0xc'),auth[_0xf093('0xa')](),controller[_0xf093('0xd')]);router[_0xf093('0xe')]('/',auth[_0xf093('0xa')](),controller[_0xf093('0xf')]);router[_0xf093('0x10')](_0xf093('0xc'),auth[_0xf093('0xa')](),controller['update']);router['delete'](_0xf093('0xc'),auth['isAuthenticated'](),controller[_0xf093('0x11')]);module[_0xf093('0x12')]=router; \ No newline at end of file +var _0x6d00=['../../components/interaction/service','../../config/environment','./tag.controller','isAuthenticated','index','get','/:id','create','put','update','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4468e7,_0x51210f){var _0x5c3355=function(_0x50dac4){while(--_0x50dac4){_0x4468e7['push'](_0x4468e7['shift']());}};_0x5c3355(++_0x51210f);}(_0x6d00,0x11b));var _0x06d0=function(_0xe593fe,_0x587956){_0xe593fe=_0xe593fe-0x0;var _0x49fe42=_0x6d00[_0xe593fe];return _0x49fe42;};'use strict';var multer=require('multer');var util=require(_0x06d0('0x0'));var path=require(_0x06d0('0x1'));var timeout=require(_0x06d0('0x2'));var express=require('express');var router=express[_0x06d0('0x3')]();var fs_extra=require(_0x06d0('0x4'));var auth=require(_0x06d0('0x5'));var interaction=require(_0x06d0('0x6'));var config=require(_0x06d0('0x7'));var controller=require(_0x06d0('0x8'));router['get']('/',auth[_0x06d0('0x9')](),controller[_0x06d0('0xa')]);router[_0x06d0('0xb')](_0x06d0('0xc'),auth[_0x06d0('0x9')](),controller['show']);router['post']('/',auth[_0x06d0('0x9')](),controller[_0x06d0('0xd')]);router[_0x06d0('0xe')](_0x06d0('0xc'),auth[_0x06d0('0x9')](),controller[_0x06d0('0xf')]);router['delete'](_0x06d0('0xc'),auth[_0x06d0('0x9')](),controller[_0x06d0('0x10')]);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 a8ba939..6174f64 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 _0xbc4a=['sequelize','exports','STRING'];(function(_0x32daf7,_0x4e1bd0){var _0x342eaf=function(_0x459cf6){while(--_0x459cf6){_0x32daf7['push'](_0x32daf7['shift']());}};_0x342eaf(++_0x4e1bd0);}(_0xbc4a,0x1dd));var _0xabc4=function(_0xec75dc,_0x9bf2ab){_0xec75dc=_0xec75dc-0x0;var _0x115dce=_0xbc4a[_0xec75dc];return _0x115dce;};'use strict';var Sequelize=require(_0xabc4('0x0'));module[_0xabc4('0x1')]={'name':{'type':Sequelize[_0xabc4('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf12a=['name','#0091EA','sequelize','exports','STRING'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xf12a,0x8e));var _0xaf12=function(_0x58f42a,_0x582f5c){_0x58f42a=_0x58f42a-0x0;var _0x249e18=_0xf12a[_0x58f42a];return _0x249e18;};'use strict';var Sequelize=require(_0xaf12('0x0'));module[_0xaf12('0x1')]={'name':{'type':Sequelize[_0xaf12('0x2')],'unique':_0xaf12('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xaf12('0x2')],'defaultValue':_0xaf12('0x4')},'description':{'type':Sequelize[_0xaf12('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 50be156..b7145ad 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 _0x76dc=['where','pick','filter','merge','map','type','VIRTUAL','options','findAll','rows','catch','show','params','intersection','includeAll','include','find','body','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','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','json','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','name','send','Tag','fieldName','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3299d1,_0x545733){var _0x44356e=function(_0x52fd77){while(--_0x52fd77){_0x3299d1['push'](_0x3299d1['shift']());}};_0x44356e(++_0x545733);}(_0x76dc,0x1f2));var _0xc76d=function(_0x17005b,_0x3f7e46){_0x17005b=_0x17005b-0x0;var _0x2b29f2=_0x76dc[_0x17005b];return _0x2b29f2;};'use strict';var emlformat=require(_0xc76d('0x0'));var rimraf=require(_0xc76d('0x1'));var zipdir=require(_0xc76d('0x2'));var jsonpatch=require(_0xc76d('0x3'));var rp=require('request-promise');var moment=require(_0xc76d('0x4'));var BPromise=require(_0xc76d('0x5'));var Mustache=require('mustache');var util=require(_0xc76d('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc76d('0x7'));var ejs=require(_0xc76d('0x8'));var fs=require('fs');var fs_extra=require(_0xc76d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc76d('0xa'));var jsforce=require(_0xc76d('0xb'));var deskjs=require(_0xc76d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc76d('0xd'));var Redis=require(_0xc76d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xc76d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc76d('0x10'));var logger=require(_0xc76d('0x11'))(_0xc76d('0x12'));var utils=require(_0xc76d('0x13'));var config=require(_0xc76d('0x14'));var licenseUtil=require(_0xc76d('0x15'));var db=require(_0xc76d('0x16'))['db'];function respondWithStatusCode(_0x2e02e9,_0x1722b3){_0x1722b3=_0x1722b3||0xcc;return function(_0x311814){if(_0x311814){return _0x2e02e9[_0xc76d('0x17')](_0x1722b3);}return _0x2e02e9[_0xc76d('0x18')](_0x1722b3)[_0xc76d('0x19')]();};}function respondWithResult(_0x3ed1bd,_0x5cda20){_0x5cda20=_0x5cda20||0xc8;return function(_0x8696db){if(_0x8696db){return _0x3ed1bd[_0xc76d('0x18')](_0x5cda20)['json'](_0x8696db);}};}function respondWithFilteredResult(_0x4741a4,_0x2d23d2){return function(_0x47a4ee){if(_0x47a4ee){var _0x6f94e=typeof _0x2d23d2['offset']===_0xc76d('0x1a')&&typeof _0x2d23d2['limit']==='undefined';var _0x45a83e=_0x47a4ee[_0xc76d('0x1b')];var _0x339623=_0x6f94e?0x0:_0x2d23d2[_0xc76d('0x1c')];var _0xd1d16f=_0x6f94e?_0x47a4ee['count']:_0x2d23d2[_0xc76d('0x1c')]+_0x2d23d2[_0xc76d('0x1d')];var _0xa0c5b6;if(_0xd1d16f>=_0x45a83e){_0xd1d16f=_0x45a83e;_0xa0c5b6=0xc8;}else{_0xa0c5b6=0xce;}_0x4741a4[_0xc76d('0x18')](_0xa0c5b6);return _0x4741a4[_0xc76d('0x1e')]('Content-Range',_0x339623+'-'+_0xd1d16f+'/'+_0x45a83e)[_0xc76d('0x1f')](_0x47a4ee);}return null;};}function patchUpdates(_0x324db7){return function(_0x5dffde){try{jsonpatch[_0xc76d('0x20')](_0x5dffde,_0x324db7,!![]);}catch(_0x777f22){return BPromise[_0xc76d('0x21')](_0x777f22);}return _0x5dffde[_0xc76d('0x22')]();};}function saveUpdates(_0x18f546,_0x3d357b){return function(_0x42b89c){if(_0x42b89c){return _0x42b89c[_0xc76d('0x23')](_0x18f546)[_0xc76d('0x24')](function(_0x20e09c){return _0x20e09c;});}return null;};}function removeEntity(_0x15328d,_0x5de11f){return function(_0x11b42f){if(_0x11b42f){return _0x11b42f[_0xc76d('0x25')]()['then'](function(){var _0x637d68=_0x11b42f[_0xc76d('0x26')]({'plain':!![]});var _0x55ca79=_0xc76d('0x27');return db[_0xc76d('0x28')][_0xc76d('0x25')]({'where':{'type':_0x55ca79,'resourceId':_0x637d68['id']}})[_0xc76d('0x24')](function(){return _0x11b42f;});})[_0xc76d('0x24')](function(){_0x15328d[_0xc76d('0x18')](0xcc)[_0xc76d('0x19')]();});}};}function handleEntityNotFound(_0x59ebd1,_0x59dabf){return function(_0x285430){if(!_0x285430){_0x59ebd1[_0xc76d('0x17')](0x194);}return _0x285430;};}function handleError(_0x5069ea,_0x31501a){_0x31501a=_0x31501a||0x1f4;return function(_0x52a79a){logger[_0xc76d('0x29')](_0x52a79a['stack']);if(_0x52a79a[_0xc76d('0x2a')]){delete _0x52a79a['name'];}_0x5069ea[_0xc76d('0x18')](_0x31501a)[_0xc76d('0x2b')](_0x52a79a);};}exports['index']=function(_0x3d4076,_0x1c68f3){var _0x9ab96c={},_0x2cf501={},_0x4feeda={'count':0x0,'rows':[]};var _0x283e16=_['map'](db[_0xc76d('0x2c')]['rawAttributes'],function(_0x30769f){return{'name':_0x30769f[_0xc76d('0x2d')],'type':_0x30769f['type']['key']};});_0x2cf501['model']=_['map'](_0x283e16,_0xc76d('0x2a'));_0x2cf501[_0xc76d('0x2e')]=_[_0xc76d('0x2f')](_0x3d4076[_0xc76d('0x2e')]);_0x2cf501[_0xc76d('0x30')]=_['intersection'](_0x2cf501[_0xc76d('0x31')],_0x2cf501['query']);_0x9ab96c[_0xc76d('0x32')]=_['intersection'](_0x2cf501[_0xc76d('0x31')],qs[_0xc76d('0x33')](_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x33')]));_0x9ab96c[_0xc76d('0x32')]=_0x9ab96c['attributes'][_0xc76d('0x34')]?_0x9ab96c[_0xc76d('0x32')]:_0x2cf501[_0xc76d('0x31')];if(!_0x3d4076['query'][_0xc76d('0x35')](_0xc76d('0x36'))){_0x9ab96c[_0xc76d('0x1d')]=qs['limit'](_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x1d')]);_0x9ab96c[_0xc76d('0x1c')]=qs[_0xc76d('0x1c')](_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x1c')]);}_0x9ab96c['order']=qs['sort'](_0x3d4076[_0xc76d('0x2e')]['sort']);_0x9ab96c[_0xc76d('0x37')]=qs[_0xc76d('0x30')](_[_0xc76d('0x38')](_0x3d4076[_0xc76d('0x2e')],_0x2cf501['filters']),_0x283e16);if(_0x3d4076['query'][_0xc76d('0x39')]){_0x9ab96c[_0xc76d('0x37')]=_[_0xc76d('0x3a')](_0x9ab96c[_0xc76d('0x37')],{'$or':_[_0xc76d('0x3b')](_0x283e16,function(_0x58c724){if(_0x58c724[_0xc76d('0x3c')]!==_0xc76d('0x3d')){var _0x321989={};_0x321989[_0x58c724[_0xc76d('0x2a')]]={'$like':'%'+_0x3d4076[_0xc76d('0x2e')][_0xc76d('0x39')]+'%'};return _0x321989;}})});}_0x9ab96c=_[_0xc76d('0x3a')]({},_0x9ab96c,_0x3d4076[_0xc76d('0x3e')]);var _0x305f7d={'where':_0x9ab96c[_0xc76d('0x37')]};return db['Tag']['count'](_0x305f7d)[_0xc76d('0x24')](function(_0x2a0759){_0x4feeda[_0xc76d('0x1b')]=_0x2a0759;if(_0x3d4076[_0xc76d('0x2e')]['includeAll']){_0x9ab96c['include']=[{'all':!![]}];}return db[_0xc76d('0x2c')][_0xc76d('0x3f')](_0x9ab96c);})[_0xc76d('0x24')](function(_0x15eb42){_0x4feeda[_0xc76d('0x40')]=_0x15eb42;return _0x4feeda;})[_0xc76d('0x24')](respondWithFilteredResult(_0x1c68f3,_0x9ab96c))[_0xc76d('0x41')](handleError(_0x1c68f3,null));};exports[_0xc76d('0x42')]=function(_0x50e922,_0x7bf0){var _0x95193f={'raw':!![],'where':{'id':_0x50e922[_0xc76d('0x43')]['id']}},_0x1bf8a0={};_0x1bf8a0['model']=_['keys'](db['Tag']['rawAttributes']);_0x1bf8a0['query']=_['keys'](_0x50e922['query']);_0x1bf8a0[_0xc76d('0x30')]=_[_0xc76d('0x44')](_0x1bf8a0[_0xc76d('0x31')],_0x1bf8a0[_0xc76d('0x2e')]);_0x95193f[_0xc76d('0x32')]=_[_0xc76d('0x44')](_0x1bf8a0[_0xc76d('0x31')],qs[_0xc76d('0x33')](_0x50e922['query'][_0xc76d('0x33')]));_0x95193f[_0xc76d('0x32')]=_0x95193f[_0xc76d('0x32')][_0xc76d('0x34')]?_0x95193f[_0xc76d('0x32')]:_0x1bf8a0[_0xc76d('0x31')];if(_0x50e922[_0xc76d('0x2e')][_0xc76d('0x45')]){_0x95193f[_0xc76d('0x46')]=[{'all':!![]}];}_0x95193f=_['merge']({},_0x95193f,_0x50e922['options']);return db[_0xc76d('0x2c')][_0xc76d('0x47')](_0x95193f)[_0xc76d('0x24')](handleEntityNotFound(_0x7bf0,null))[_0xc76d('0x24')](respondWithResult(_0x7bf0,null))[_0xc76d('0x41')](handleError(_0x7bf0,null));};exports['create']=function(_0x25fc9d,_0x1ede13){return db['Tag']['create'](_0x25fc9d[_0xc76d('0x48')],{})[_0xc76d('0x24')](function(_0x48cad0){var _0xe44a25=_0x25fc9d[_0xc76d('0x49')][_0xc76d('0x26')]({'plain':!![]});if(!_0xe44a25)throw new Error(_0xc76d('0x4a'));if(_0xe44a25[_0xc76d('0x4b')]===_0xc76d('0x49')){var _0x25a549=_0x48cad0[_0xc76d('0x26')]({'plain':!![]});var _0x4452a8=_0xc76d('0x27');return db['UserProfileSection'][_0xc76d('0x47')]({'where':{'name':_0x4452a8,'userProfileId':_0xe44a25[_0xc76d('0x4c')]},'raw':!![]})[_0xc76d('0x24')](function(_0x55e3af){if(_0x55e3af&&_0x55e3af[_0xc76d('0x4d')]===0x0){return db[_0xc76d('0x28')]['create']({'name':_0x25a549[_0xc76d('0x2a')],'resourceId':_0x25a549['id'],'type':_0x55e3af['name'],'sectionId':_0x55e3af['id']},{})[_0xc76d('0x24')](function(){return _0x48cad0;});}else{return _0x48cad0;}})[_0xc76d('0x41')](function(_0x316978){logger[_0xc76d('0x29')](_0xc76d('0x4e'),_0x316978);throw _0x316978;});}return _0x48cad0;})['then'](respondWithResult(_0x1ede13,0xc9))['catch'](handleError(_0x1ede13,null));};exports['update']=function(_0x320483,_0x746759){if(_0x320483[_0xc76d('0x48')]['id']){delete _0x320483[_0xc76d('0x48')]['id'];}return db[_0xc76d('0x2c')][_0xc76d('0x47')]({'where':{'id':_0x320483['params']['id']}})[_0xc76d('0x24')](handleEntityNotFound(_0x746759,null))[_0xc76d('0x24')](saveUpdates(_0x320483[_0xc76d('0x48')],null))[_0xc76d('0x24')](respondWithResult(_0x746759,null))[_0xc76d('0x41')](handleError(_0x746759,null));};exports['destroy']=function(_0x275dfd,_0x463cbe){return db[_0xc76d('0x2c')][_0xc76d('0x47')]({'where':{'id':_0x275dfd[_0xc76d('0x43')]['id']}})[_0xc76d('0x24')](handleEntityNotFound(_0x463cbe,null))['then'](removeEntity(_0x463cbe,null))[_0xc76d('0x41')](handleError(_0x463cbe,null));}; \ No newline at end of file +var _0x6921=['lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','limit','apply','save','update','then','UserProfileResource','destroy','error','stack','name','map','Tag','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','get','role','Tags','UserProfileSection','userProfileId','autoAssociation','body','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra'];(function(_0x2b8722,_0x50d540){var _0x20c180=function(_0x595b40){while(--_0x595b40){_0x2b8722['push'](_0x2b8722['shift']());}};_0x20c180(++_0x50d540);}(_0x6921,0x1d1));var _0x1692=function(_0x15e7ae,_0x2653ba){_0x15e7ae=_0x15e7ae-0x0;var _0x1ec85a=_0x6921[_0x15e7ae];return _0x1ec85a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1692('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1692('0x1'));var rp=require('request-promise');var moment=require(_0x1692('0x2'));var BPromise=require(_0x1692('0x3'));var Mustache=require('mustache');var util=require(_0x1692('0x4'));var path=require('path');var sox=require(_0x1692('0x5'));var csv=require(_0x1692('0x6'));var ejs=require(_0x1692('0x7'));var fs=require('fs');var fs_extra=require(_0x1692('0x8'));var _=require(_0x1692('0x9'));var squel=require(_0x1692('0xa'));var crypto=require(_0x1692('0xb'));var jsforce=require(_0x1692('0xc'));var deskjs=require(_0x1692('0xd'));var toCsv=require(_0x1692('0x6'));var querystring=require(_0x1692('0xe'));var Papa=require('papaparse');var Redis=require(_0x1692('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1692('0x10'));var as=require(_0x1692('0x11'));var hardwareService=require(_0x1692('0x12'));var logger=require(_0x1692('0x13'))(_0x1692('0x14'));var utils=require(_0x1692('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1692('0x16'));var db=require(_0x1692('0x17'))['db'];function respondWithStatusCode(_0x1d8ae3,_0x26492b){_0x26492b=_0x26492b||0xcc;return function(_0x2c84fe){if(_0x2c84fe){return _0x1d8ae3[_0x1692('0x18')](_0x26492b);}return _0x1d8ae3['status'](_0x26492b)[_0x1692('0x19')]();};}function respondWithResult(_0xa6e81,_0xddfb0c){_0xddfb0c=_0xddfb0c||0xc8;return function(_0x1b488f){if(_0x1b488f){return _0xa6e81[_0x1692('0x1a')](_0xddfb0c)[_0x1692('0x1b')](_0x1b488f);}};}function respondWithFilteredResult(_0x5e33d8,_0x1377e3){return function(_0x57401c){if(_0x57401c){var _0x12989e=typeof _0x1377e3['offset']===_0x1692('0x1c')&&typeof _0x1377e3['limit']===_0x1692('0x1c');var _0x28db17=_0x57401c[_0x1692('0x1d')];var _0x4ea36d=_0x12989e?0x0:_0x1377e3['offset'];var _0x3c0960=_0x12989e?_0x57401c[_0x1692('0x1d')]:_0x1377e3['offset']+_0x1377e3[_0x1692('0x1e')];var _0x4e6bfc;if(_0x3c0960>=_0x28db17){_0x3c0960=_0x28db17;_0x4e6bfc=0xc8;}else{_0x4e6bfc=0xce;}_0x5e33d8[_0x1692('0x1a')](_0x4e6bfc);return _0x5e33d8['set']('Content-Range',_0x4ea36d+'-'+_0x3c0960+'/'+_0x28db17)[_0x1692('0x1b')](_0x57401c);}return null;};}function patchUpdates(_0x4e544b){return function(_0x2eb232){try{jsonpatch[_0x1692('0x1f')](_0x2eb232,_0x4e544b,!![]);}catch(_0x26571d){return BPromise['reject'](_0x26571d);}return _0x2eb232[_0x1692('0x20')]();};}function saveUpdates(_0x1d156a,_0x477e9d){return function(_0x1bc519){if(_0x1bc519){return _0x1bc519[_0x1692('0x21')](_0x1d156a)[_0x1692('0x22')](function(_0x4146af){return _0x4146af;});}return null;};}function removeEntity(_0x4e76ff,_0x35ecc8){return function(_0x312bf8){if(_0x312bf8){return _0x312bf8['destroy']()['then'](function(){var _0x53d4a1=_0x312bf8['get']({'plain':!![]});var _0x2fa81a='Tags';return db[_0x1692('0x23')][_0x1692('0x24')]({'where':{'type':_0x2fa81a,'resourceId':_0x53d4a1['id']}})[_0x1692('0x22')](function(){return _0x312bf8;});})[_0x1692('0x22')](function(){_0x4e76ff[_0x1692('0x1a')](0xcc)[_0x1692('0x19')]();});}};}function handleEntityNotFound(_0x5a355b,_0x1a6708){return function(_0x1a4e1c){if(!_0x1a4e1c){_0x5a355b[_0x1692('0x18')](0x194);}return _0x1a4e1c;};}function handleError(_0x46fec4,_0x534aba){_0x534aba=_0x534aba||0x1f4;return function(_0x5364cd){logger[_0x1692('0x25')](_0x5364cd[_0x1692('0x26')]);if(_0x5364cd[_0x1692('0x27')]){delete _0x5364cd[_0x1692('0x27')];}_0x46fec4['status'](_0x534aba)['send'](_0x5364cd);};}exports['index']=function(_0x38c5bd,_0x274dba){var _0x3d86f3={},_0x3fd03f={},_0x1442d6={'count':0x0,'rows':[]};var _0x44499f=_[_0x1692('0x28')](db[_0x1692('0x29')]['rawAttributes'],function(_0x170884){return{'name':_0x170884['fieldName'],'type':_0x170884[_0x1692('0x2a')][_0x1692('0x2b')]};});_0x3fd03f[_0x1692('0x2c')]=_[_0x1692('0x28')](_0x44499f,'name');_0x3fd03f[_0x1692('0x2d')]=_[_0x1692('0x2e')](_0x38c5bd[_0x1692('0x2d')]);_0x3fd03f[_0x1692('0x2f')]=_[_0x1692('0x30')](_0x3fd03f[_0x1692('0x2c')],_0x3fd03f['query']);_0x3d86f3[_0x1692('0x31')]=_[_0x1692('0x30')](_0x3fd03f[_0x1692('0x2c')],qs[_0x1692('0x32')](_0x38c5bd[_0x1692('0x2d')][_0x1692('0x32')]));_0x3d86f3[_0x1692('0x31')]=_0x3d86f3[_0x1692('0x31')][_0x1692('0x33')]?_0x3d86f3[_0x1692('0x31')]:_0x3fd03f[_0x1692('0x2c')];if(!_0x38c5bd[_0x1692('0x2d')][_0x1692('0x34')](_0x1692('0x35'))){_0x3d86f3['limit']=qs[_0x1692('0x1e')](_0x38c5bd[_0x1692('0x2d')][_0x1692('0x1e')]);_0x3d86f3['offset']=qs[_0x1692('0x36')](_0x38c5bd[_0x1692('0x2d')][_0x1692('0x36')]);}_0x3d86f3['order']=qs['sort'](_0x38c5bd['query'][_0x1692('0x37')]);_0x3d86f3[_0x1692('0x38')]=qs[_0x1692('0x2f')](_[_0x1692('0x39')](_0x38c5bd[_0x1692('0x2d')],_0x3fd03f[_0x1692('0x2f')]),_0x44499f);if(_0x38c5bd[_0x1692('0x2d')][_0x1692('0x3a')]){_0x3d86f3[_0x1692('0x38')]=_[_0x1692('0x3b')](_0x3d86f3[_0x1692('0x38')],{'$or':_[_0x1692('0x28')](_0x44499f,function(_0x5356fe){if(_0x5356fe[_0x1692('0x2a')]!==_0x1692('0x3c')){var _0xdb4303={};_0xdb4303[_0x5356fe['name']]={'$like':'%'+_0x38c5bd[_0x1692('0x2d')][_0x1692('0x3a')]+'%'};return _0xdb4303;}})});}_0x3d86f3=_['merge']({},_0x3d86f3,_0x38c5bd[_0x1692('0x3d')]);var _0x6c25a7={'where':_0x3d86f3[_0x1692('0x38')]};return db['Tag'][_0x1692('0x1d')](_0x6c25a7)[_0x1692('0x22')](function(_0x2f6052){_0x1442d6[_0x1692('0x1d')]=_0x2f6052;if(_0x38c5bd[_0x1692('0x2d')][_0x1692('0x3e')]){_0x3d86f3[_0x1692('0x3f')]=[{'all':!![]}];}return db[_0x1692('0x29')][_0x1692('0x40')](_0x3d86f3);})[_0x1692('0x22')](function(_0x36022e){_0x1442d6[_0x1692('0x41')]=_0x36022e;return _0x1442d6;})[_0x1692('0x22')](respondWithFilteredResult(_0x274dba,_0x3d86f3))[_0x1692('0x42')](handleError(_0x274dba,null));};exports[_0x1692('0x43')]=function(_0x17c965,_0x31d6a8){var _0x3c53f3={'raw':!![],'where':{'id':_0x17c965[_0x1692('0x44')]['id']}},_0x125396={};_0x125396[_0x1692('0x2c')]=_[_0x1692('0x2e')](db[_0x1692('0x29')]['rawAttributes']);_0x125396[_0x1692('0x2d')]=_['keys'](_0x17c965[_0x1692('0x2d')]);_0x125396[_0x1692('0x2f')]=_[_0x1692('0x30')](_0x125396[_0x1692('0x2c')],_0x125396['query']);_0x3c53f3[_0x1692('0x31')]=_[_0x1692('0x30')](_0x125396[_0x1692('0x2c')],qs[_0x1692('0x32')](_0x17c965[_0x1692('0x2d')][_0x1692('0x32')]));_0x3c53f3[_0x1692('0x31')]=_0x3c53f3[_0x1692('0x31')][_0x1692('0x33')]?_0x3c53f3[_0x1692('0x31')]:_0x125396['model'];if(_0x17c965['query'][_0x1692('0x3e')]){_0x3c53f3[_0x1692('0x3f')]=[{'all':!![]}];}_0x3c53f3=_[_0x1692('0x3b')]({},_0x3c53f3,_0x17c965[_0x1692('0x3d')]);return db[_0x1692('0x29')][_0x1692('0x45')](_0x3c53f3)['then'](handleEntityNotFound(_0x31d6a8,null))['then'](respondWithResult(_0x31d6a8,null))['catch'](handleError(_0x31d6a8,null));};exports[_0x1692('0x46')]=function(_0xffbb6,_0x38d869){return db[_0x1692('0x29')][_0x1692('0x46')](_0xffbb6['body'],{})['then'](function(_0x21a087){var _0x52cf9d=_0xffbb6[_0x1692('0x47')][_0x1692('0x48')]({'plain':!![]});if(!_0x52cf9d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52cf9d[_0x1692('0x49')]===_0x1692('0x47')){var _0x302daa=_0x21a087[_0x1692('0x48')]({'plain':!![]});var _0x275b53=_0x1692('0x4a');return db[_0x1692('0x4b')][_0x1692('0x45')]({'where':{'name':_0x275b53,'userProfileId':_0x52cf9d[_0x1692('0x4c')]},'raw':!![]})[_0x1692('0x22')](function(_0x1d1c66){if(_0x1d1c66&&_0x1d1c66[_0x1692('0x4d')]===0x0){return db['UserProfileResource'][_0x1692('0x46')]({'name':_0x302daa[_0x1692('0x27')],'resourceId':_0x302daa['id'],'type':_0x1d1c66[_0x1692('0x27')],'sectionId':_0x1d1c66['id']},{})[_0x1692('0x22')](function(){return _0x21a087;});}else{return _0x21a087;}})[_0x1692('0x42')](function(_0x3fc057){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fc057);throw _0x3fc057;});}return _0x21a087;})[_0x1692('0x22')](respondWithResult(_0x38d869,0xc9))[_0x1692('0x42')](handleError(_0x38d869,null));};exports['update']=function(_0x17bdd5,_0x18376f){if(_0x17bdd5['body']['id']){delete _0x17bdd5[_0x1692('0x4e')]['id'];}return db[_0x1692('0x29')][_0x1692('0x45')]({'where':{'id':_0x17bdd5[_0x1692('0x44')]['id']}})['then'](handleEntityNotFound(_0x18376f,null))[_0x1692('0x22')](saveUpdates(_0x17bdd5[_0x1692('0x4e')],null))[_0x1692('0x22')](respondWithResult(_0x18376f,null))[_0x1692('0x42')](handleError(_0x18376f,null));};exports[_0x1692('0x24')]=function(_0xaf8c1b,_0x4eec6a){return db[_0x1692('0x29')][_0x1692('0x45')]({'where':{'id':_0xaf8c1b['params']['id']}})[_0x1692('0x22')](handleEntityNotFound(_0x4eec6a,null))['then'](removeEntity(_0x4eec6a,null))[_0x1692('0x42')](handleError(_0x4eec6a,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index e01c6e8..56809d3 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 _0xf492=['api','request-promise','path','rimraf','../../config/environment','Tag','tools_tags','lodash','../../config/logger'];(function(_0x5155fd,_0xaa956f){var _0x1bf312=function(_0x1e8a0e){while(--_0x1e8a0e){_0x5155fd['push'](_0x5155fd['shift']());}};_0x1bf312(++_0xaa956f);}(_0xf492,0xb2));var _0x2f49=function(_0x27e0fb,_0x3a782c){_0x27e0fb=_0x27e0fb-0x0;var _0x46fd0a=_0xf492[_0x27e0fb];return _0x46fd0a;};'use strict';var _=require(_0x2f49('0x0'));var util=require('util');var logger=require(_0x2f49('0x1'))(_0x2f49('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2f49('0x3'));var fs=require('fs');var path=require(_0x2f49('0x4'));var rimraf=require(_0x2f49('0x5'));var config=require(_0x2f49('0x6'));var attributes=require('./tag.attributes');module['exports']=function(_0x59426a,_0xf74eda){return _0x59426a['define'](_0x2f49('0x7'),attributes,{'tableName':_0x2f49('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8ae=['rimraf','../../config/environment','./tag.attributes','exports','define','Tag','util','api','moment','request-promise','path'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xf8ae,0x1c9));var _0xef8a=function(_0x4c2e88,_0x5bfd5a){_0x4c2e88=_0x4c2e88-0x0;var _0x1f60a3=_0xf8ae[_0x4c2e88];return _0x1f60a3;};'use strict';var _=require('lodash');var util=require(_0xef8a('0x0'));var logger=require('../../config/logger')(_0xef8a('0x1'));var moment=require(_0xef8a('0x2'));var BPromise=require('bluebird');var rp=require(_0xef8a('0x3'));var fs=require('fs');var path=require(_0xef8a('0x4'));var rimraf=require(_0xef8a('0x5'));var config=require(_0xef8a('0x6'));var attributes=require(_0xef8a('0x7'));module[_0xef8a('0x8')]=function(_0x2a3496,_0x42ca8e){return _0x2a3496[_0xef8a('0x9')](_0xef8a('0xa'),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 42daf35..3f4eb93 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 _0xb717=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Tag,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x34dbda,_0x264a1d){var _0x5961fe=function(_0x2a0519){while(--_0x2a0519){_0x34dbda['push'](_0x34dbda['shift']());}};_0x5961fe(++_0x264a1d);}(_0xb717,0x1b4));var _0x7b71=function(_0x2c08eb,_0x5ce61d){_0x2c08eb=_0x2c08eb-0x0;var _0x315a3d=_0xb717[_0x2c08eb];return _0x315a3d;};'use strict';var _=require(_0x7b71('0x0'));var util=require('util');var moment=require(_0x7b71('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b71('0x2'));var fs=require('fs');var Redis=require(_0x7b71('0x3'));var db=require(_0x7b71('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b71('0x5'))(_0x7b71('0x6'));var config=require(_0x7b71('0x7'));var jayson=require(_0x7b71('0x8'));var client=jayson[_0x7b71('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x217efe,_0x27b060,_0xd81a5c){return new BPromise(function(_0x4238f6,_0xc46853){return client['request'](_0x217efe,_0xd81a5c)[_0x7b71('0xa')](function(_0x3e13a1){logger['info'](_0x7b71('0xb'),_0x27b060,_0x7b71('0xc'));logger[_0x7b71('0xd')]('Tag,\x20%s,\x20%s,\x20%s',_0x27b060,_0x7b71('0xc'),JSON['stringify'](_0x3e13a1));if(_0x3e13a1[_0x7b71('0xe')]){if(_0x3e13a1['error'][_0x7b71('0xf')]===0x1f4){logger[_0x7b71('0xe')](_0x7b71('0xb'),_0x27b060,_0x3e13a1[_0x7b71('0xe')][_0x7b71('0x10')]);return _0xc46853(_0x3e13a1['error'][_0x7b71('0x10')]);}logger['error'](_0x7b71('0xb'),_0x27b060,_0x3e13a1[_0x7b71('0xe')]['message']);return _0x4238f6(_0x3e13a1[_0x7b71('0xe')][_0x7b71('0x10')]);}else{logger[_0x7b71('0x11')]('Tag,\x20%s,\x20%s',_0x27b060,'request\x20sent');_0x4238f6(_0x3e13a1[_0x7b71('0x12')][_0x7b71('0x10')]);}})[_0x7b71('0x13')](function(_0x1b5d57){logger['error'](_0x7b71('0xb'),_0x27b060,_0x1b5d57);_0xc46853(_0x1b5d57);});});} \ No newline at end of file +var _0x0624=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x451687,_0x38d834){var _0x838bfd=function(_0x4a274a){while(--_0x4a274a){_0x451687['push'](_0x451687['shift']());}};_0x838bfd(++_0x38d834);}(_0x0624,0x132));var _0x4062=function(_0x580c5f,_0x3946ba){_0x580c5f=_0x580c5f-0x0;var _0x3fc052=_0x0624[_0x580c5f];return _0x3fc052;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4062('0x0'));var fs=require('fs');var Redis=require(_0x4062('0x1'));var db=require(_0x4062('0x2'))['db'];var utils=require(_0x4062('0x3'));var logger=require(_0x4062('0x4'))(_0x4062('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4062('0x6')][_0x4062('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2f4928,_0xdff88c,_0x27794b){return new BPromise(function(_0x5d19e8,_0x75ce4e){return client['request'](_0x2f4928,_0x27794b)[_0x4062('0x8')](function(_0x35663b){logger[_0x4062('0x9')](_0x4062('0xa'),_0xdff88c,_0x4062('0xb'));logger[_0x4062('0xc')](_0x4062('0xd'),_0xdff88c,'request\x20sent',JSON[_0x4062('0xe')](_0x35663b));if(_0x35663b['error']){if(_0x35663b[_0x4062('0xf')][_0x4062('0x10')]===0x1f4){logger[_0x4062('0xf')](_0x4062('0xa'),_0xdff88c,_0x35663b[_0x4062('0xf')]['message']);return _0x75ce4e(_0x35663b[_0x4062('0xf')][_0x4062('0x11')]);}logger['error'](_0x4062('0xa'),_0xdff88c,_0x35663b[_0x4062('0xf')][_0x4062('0x11')]);return _0x5d19e8(_0x35663b['error']['message']);}else{logger[_0x4062('0x9')](_0x4062('0xa'),_0xdff88c,'request\x20sent');_0x5d19e8(_0x35663b['result']['message']);}})['catch'](function(_0x437432){logger['error'](_0x4062('0xa'),_0xdff88c,_0x437432);_0x75ce4e(_0x437432);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 4b37019..73de56a 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(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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 d0a2287..1c3ce22 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 _0xe706=['STRING','sequelize','exports'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xe706,0xa3));var _0x6e70=function(_0x48863d,_0xb57402){_0x48863d=_0x48863d-0x0;var _0x16c8f1=_0xe706[_0x48863d];return _0x16c8f1;};'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 _0x757a=['exports','STRING'];(function(_0x2ead66,_0x134456){var _0x6321e4=function(_0x2eeda1){while(--_0x2eeda1){_0x2ead66['push'](_0x2ead66['shift']());}};_0x6321e4(++_0x134456);}(_0x757a,0xde));var _0xa757=function(_0x496c39,_0x35daa4){_0x496c39=_0x496c39-0x0;var _0x41f481=_0x757a[_0x496c39];return _0x41f481;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 2227302..5d0e58c 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 _0xa2f7=['socket.io-emitter','register','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','Team','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','user','get','Teams','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','transaction','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserOpenchannelQueue','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','send','getQueues','findOne','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queues','addQueues','add','ids','removeQueues','remove','isArray','Voice','Chat','Mail','Sms','Fax','Whatsapp','through','penalty','User','Queue','findOrCreate','emit','Queue:save','QueueId','online','voicePause','interface','upsert','isNil','format','all','addAgents','spread','removeAgents','Openchannel','Queue:remove','UserVoiceQueueRt','VoicePrefixId','getAgents','order','pick','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis'];(function(_0x37f161,_0x502500){var _0x1927e8=function(_0x2c5661){while(--_0x2c5661){_0x37f161['push'](_0x37f161['shift']());}};_0x1927e8(++_0x502500);}(_0xa2f7,0x117));var _0x7a2f=function(_0x13a70c,_0x4bc90f){_0x13a70c=_0x13a70c-0x0;var _0x73d5a4=_0xa2f7[_0x13a70c];return _0x73d5a4;};'use strict';var emlformat=require(_0x7a2f('0x0'));var rimraf=require(_0x7a2f('0x1'));var zipdir=require(_0x7a2f('0x2'));var jsonpatch=require(_0x7a2f('0x3'));var rp=require('request-promise');var moment=require(_0x7a2f('0x4'));var BPromise=require(_0x7a2f('0x5'));var Mustache=require(_0x7a2f('0x6'));var util=require(_0x7a2f('0x7'));var path=require(_0x7a2f('0x8'));var sox=require(_0x7a2f('0x9'));var csv=require(_0x7a2f('0xa'));var ejs=require(_0x7a2f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a2f('0xc'));var squel=require(_0x7a2f('0xd'));var crypto=require(_0x7a2f('0xe'));var jsforce=require(_0x7a2f('0xf'));var deskjs=require(_0x7a2f('0x10'));var toCsv=require(_0x7a2f('0xa'));var querystring=require(_0x7a2f('0x11'));var Papa=require('papaparse');var Redis=require(_0x7a2f('0x12'));var authService=require(_0x7a2f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7a2f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a2f('0x15'))(_0x7a2f('0x16'));var utils=require(_0x7a2f('0x17'));var config=require(_0x7a2f('0x18'));var licenseUtil=require(_0x7a2f('0x19'));var db=require(_0x7a2f('0x1a'))['db'];config['redis']=_[_0x7a2f('0x1b')](config[_0x7a2f('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x7a2f('0x1d'))(new Redis(config['redis']));require('./team.socket')[_0x7a2f('0x1e')](socket);function respondWithStatusCode(_0x52cf16,_0xa3edcc){_0xa3edcc=_0xa3edcc||0xcc;return function(_0x25a66a){if(_0x25a66a){return _0x52cf16['sendStatus'](_0xa3edcc);}return _0x52cf16[_0x7a2f('0x1f')](_0xa3edcc)['end']();};}function respondWithResult(_0x2e2b5f,_0x93bc67){_0x93bc67=_0x93bc67||0xc8;return function(_0x2bb80a){if(_0x2bb80a){return _0x2e2b5f['status'](_0x93bc67)['json'](_0x2bb80a);}};}function respondWithFilteredResult(_0x5ace97,_0x164bdd){return function(_0x90ee2){if(_0x90ee2){var _0x24b50f=typeof _0x164bdd[_0x7a2f('0x20')]===_0x7a2f('0x21')&&typeof _0x164bdd[_0x7a2f('0x22')]===_0x7a2f('0x21');var _0xab21f6=_0x90ee2[_0x7a2f('0x23')];var _0x38588f=_0x24b50f?0x0:_0x164bdd['offset'];var _0x4dabe1=_0x24b50f?_0x90ee2['count']:_0x164bdd[_0x7a2f('0x20')]+_0x164bdd[_0x7a2f('0x22')];var _0x56727b;if(_0x4dabe1>=_0xab21f6){_0x4dabe1=_0xab21f6;_0x56727b=0xc8;}else{_0x56727b=0xce;}_0x5ace97[_0x7a2f('0x1f')](_0x56727b);return _0x5ace97[_0x7a2f('0x24')](_0x7a2f('0x25'),_0x38588f+'-'+_0x4dabe1+'/'+_0xab21f6)['json'](_0x90ee2);}return null;};}function patchUpdates(_0x2ad7f0){return function(_0x3bc82b){try{jsonpatch[_0x7a2f('0x26')](_0x3bc82b,_0x2ad7f0,!![]);}catch(_0x2584c0){return BPromise[_0x7a2f('0x27')](_0x2584c0);}return _0x3bc82b['save']();};}function saveUpdates(_0x173d18,_0x1f5afb){return function(_0x27b06f){if(_0x27b06f){return _0x27b06f[_0x7a2f('0x28')](_0x173d18)[_0x7a2f('0x29')](function(_0x213070){return _0x213070;});}return null;};}function handleEntityNotFound(_0xeebf8,_0x786759){return function(_0x60fd92){if(!_0x60fd92){_0xeebf8[_0x7a2f('0x2a')](0x194);}return _0x60fd92;};}function handleError(_0x339930,_0x140260){_0x140260=_0x140260||0x1f4;return function(_0xb33611){logger['error'](_0xb33611[_0x7a2f('0x2b')]);if(_0xb33611[_0x7a2f('0x2c')]){delete _0xb33611[_0x7a2f('0x2c')];}_0x339930['status'](_0x140260)['send'](_0xb33611);};}exports[_0x7a2f('0x2d')]=function(_0x4c6afe,_0x1ed037){var _0x53b36b={},_0x3a85d2={},_0x3ce823={'count':0x0,'rows':[]};var _0x48ed1a=_[_0x7a2f('0x2e')](db['Team'][_0x7a2f('0x2f')],function(_0x34ae0d){return{'name':_0x34ae0d[_0x7a2f('0x30')],'type':_0x34ae0d[_0x7a2f('0x31')][_0x7a2f('0x32')]};});_0x3a85d2['model']=_[_0x7a2f('0x2e')](_0x48ed1a,_0x7a2f('0x2c'));_0x3a85d2['query']=_['keys'](_0x4c6afe[_0x7a2f('0x33')]);_0x3a85d2[_0x7a2f('0x34')]=_[_0x7a2f('0x35')](_0x3a85d2[_0x7a2f('0x36')],_0x3a85d2[_0x7a2f('0x33')]);_0x53b36b[_0x7a2f('0x37')]=_[_0x7a2f('0x35')](_0x3a85d2[_0x7a2f('0x36')],qs[_0x7a2f('0x38')](_0x4c6afe[_0x7a2f('0x33')][_0x7a2f('0x38')]));_0x53b36b[_0x7a2f('0x37')]=_0x53b36b[_0x7a2f('0x37')][_0x7a2f('0x39')]?_0x53b36b['attributes']:_0x3a85d2[_0x7a2f('0x36')];if(!_0x4c6afe[_0x7a2f('0x33')][_0x7a2f('0x3a')](_0x7a2f('0x3b'))){_0x53b36b[_0x7a2f('0x22')]=qs[_0x7a2f('0x22')](_0x4c6afe[_0x7a2f('0x33')][_0x7a2f('0x22')]);_0x53b36b[_0x7a2f('0x20')]=qs[_0x7a2f('0x20')](_0x4c6afe[_0x7a2f('0x33')][_0x7a2f('0x20')]);}_0x53b36b['order']=qs[_0x7a2f('0x3c')](_0x4c6afe['query'][_0x7a2f('0x3c')]);_0x53b36b[_0x7a2f('0x3d')]=qs[_0x7a2f('0x34')](_['pick'](_0x4c6afe['query'],_0x3a85d2['filters']),_0x48ed1a);if(_0x4c6afe[_0x7a2f('0x33')][_0x7a2f('0x3e')]){_0x53b36b[_0x7a2f('0x3d')]=_['merge'](_0x53b36b[_0x7a2f('0x3d')],{'$or':_[_0x7a2f('0x2e')](_0x48ed1a,function(_0x200348){if(_0x200348[_0x7a2f('0x31')]!==_0x7a2f('0x3f')){var _0x1077dc={};_0x1077dc[_0x200348[_0x7a2f('0x2c')]]={'$like':'%'+_0x4c6afe[_0x7a2f('0x33')][_0x7a2f('0x3e')]+'%'};return _0x1077dc;}})});}_0x53b36b=_[_0x7a2f('0x40')]({},_0x53b36b,_0x4c6afe[_0x7a2f('0x41')]);var _0x368ab7={'where':_0x53b36b['where']};return db[_0x7a2f('0x42')]['count'](_0x368ab7)[_0x7a2f('0x29')](function(_0x172cd4){_0x3ce823[_0x7a2f('0x23')]=_0x172cd4;if(_0x4c6afe[_0x7a2f('0x33')][_0x7a2f('0x43')]){_0x53b36b['include']=[{'all':!![]}];}return db['Team'][_0x7a2f('0x44')](_0x53b36b);})[_0x7a2f('0x29')](function(_0x33768c){_0x3ce823[_0x7a2f('0x45')]=_0x33768c;return _0x3ce823;})[_0x7a2f('0x29')](respondWithFilteredResult(_0x1ed037,_0x53b36b))['catch'](handleError(_0x1ed037,null));};exports[_0x7a2f('0x46')]=function(_0x57b128,_0x39ac47){var _0x428ae4={'raw':![],'where':{'id':_0x57b128[_0x7a2f('0x47')]['id']}},_0x22a56b={};_0x22a56b[_0x7a2f('0x36')]=_[_0x7a2f('0x48')](db[_0x7a2f('0x42')][_0x7a2f('0x2f')]);_0x22a56b[_0x7a2f('0x33')]=_['keys'](_0x57b128[_0x7a2f('0x33')]);_0x22a56b[_0x7a2f('0x34')]=_['intersection'](_0x22a56b[_0x7a2f('0x36')],_0x22a56b[_0x7a2f('0x33')]);_0x428ae4[_0x7a2f('0x37')]=_['intersection'](_0x22a56b[_0x7a2f('0x36')],qs[_0x7a2f('0x38')](_0x57b128[_0x7a2f('0x33')][_0x7a2f('0x38')]));_0x428ae4['attributes']=_0x428ae4[_0x7a2f('0x37')]['length']?_0x428ae4[_0x7a2f('0x37')]:_0x22a56b[_0x7a2f('0x36')];if(_0x57b128[_0x7a2f('0x33')][_0x7a2f('0x43')]){_0x428ae4[_0x7a2f('0x49')]=[{'all':!![]}];}_0x428ae4=_[_0x7a2f('0x40')]({},_0x428ae4,_0x57b128['options']);return db[_0x7a2f('0x42')][_0x7a2f('0x4a')](_0x428ae4)[_0x7a2f('0x29')](handleEntityNotFound(_0x39ac47,null))[_0x7a2f('0x29')](respondWithResult(_0x39ac47,null))[_0x7a2f('0x4b')](handleError(_0x39ac47,null));};exports[_0x7a2f('0x4c')]=function(_0x11c3c6,_0x435679){return db[_0x7a2f('0x42')]['create'](_0x11c3c6[_0x7a2f('0x4d')],{})[_0x7a2f('0x29')](function(_0x15f512){var _0x4bc3dd=_0x11c3c6[_0x7a2f('0x4e')][_0x7a2f('0x4f')]({'plain':!![]});if(!_0x4bc3dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4bc3dd['role']===_0x7a2f('0x4e')){var _0x10b4e5=_0x15f512['get']({'plain':!![]});var _0x506290=_0x7a2f('0x50');return db[_0x7a2f('0x51')][_0x7a2f('0x4a')]({'where':{'name':_0x506290,'userProfileId':_0x4bc3dd['userProfileId']},'raw':!![]})[_0x7a2f('0x29')](function(_0x126191){if(_0x126191&&_0x126191[_0x7a2f('0x52')]===0x0){return db['UserProfileResource'][_0x7a2f('0x4c')]({'name':_0x10b4e5[_0x7a2f('0x2c')],'resourceId':_0x10b4e5['id'],'type':_0x126191[_0x7a2f('0x2c')],'sectionId':_0x126191['id']},{})[_0x7a2f('0x29')](function(){return _0x15f512;});}else{return _0x15f512;}})[_0x7a2f('0x4b')](function(_0x9fb08c){logger[_0x7a2f('0x53')](_0x7a2f('0x54'),_0x9fb08c);throw _0x9fb08c;});}return _0x15f512;})[_0x7a2f('0x29')](respondWithResult(_0x435679,0xc9))[_0x7a2f('0x4b')](handleError(_0x435679,null));};exports[_0x7a2f('0x28')]=function(_0x13f9f4,_0x133ed8){if(_0x13f9f4[_0x7a2f('0x4d')]['id']){delete _0x13f9f4[_0x7a2f('0x4d')]['id'];}return db[_0x7a2f('0x42')][_0x7a2f('0x4a')]({'where':{'id':_0x13f9f4[_0x7a2f('0x47')]['id']}})[_0x7a2f('0x29')](handleEntityNotFound(_0x133ed8,null))[_0x7a2f('0x29')](saveUpdates(_0x13f9f4[_0x7a2f('0x4d')],null))[_0x7a2f('0x29')](respondWithResult(_0x133ed8,null))[_0x7a2f('0x4b')](handleError(_0x133ed8,null));};exports[_0x7a2f('0x55')]=function(_0x4056f9,_0x4bae14){var _0xe69e1a=_0x4056f9['params']['id'];var _0x38c761=[];return db[_0x7a2f('0x56')][_0x7a2f('0x57')](function(_0x16ebe8){var _0x221a74='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0xe69e1a;return db[_0x7a2f('0x56')]['query'](_0x221a74,{'type':db[_0x7a2f('0x58')]['QueryTypes'][_0x7a2f('0x59')],'raw':!![],'transaction':_0x16ebe8})[_0x7a2f('0x29')](function(_0x46db94){_0x38c761=_[_0x7a2f('0x2e')](_0x46db94,function(_0x4871ac){return Number(_0x4871ac[_0x7a2f('0x5a')]);});})[_0x7a2f('0x29')](function(){var _0x13796c=_0x7a2f('0x5b')+_0xe69e1a;return db[_0x7a2f('0x56')][_0x7a2f('0x33')](_0x13796c,{'type':db[_0x7a2f('0x58')][_0x7a2f('0x5c')][_0x7a2f('0x59')],'raw':!![],'transaction':_0x16ebe8});})[_0x7a2f('0x29')](function(_0xd1c4d4){var _0x55a941=_[_0x7a2f('0x2e')](_0xd1c4d4,function(_0x2a3176){return Number(_0x2a3176[_0x7a2f('0x5d')]);});return db[_0x7a2f('0x5e')][_0x7a2f('0x55')]({'where':{'UserId':{'$in':_0x38c761},'VoiceQueueId':{'$in':_0x55a941}},'transaction':_0x16ebe8});})['then'](function(){var _0x469bca=_0x7a2f('0x5f')+_0xe69e1a;return db[_0x7a2f('0x56')][_0x7a2f('0x33')](_0x469bca,{'type':db[_0x7a2f('0x58')][_0x7a2f('0x5c')][_0x7a2f('0x59')],'raw':!![],'transaction':_0x16ebe8});})['then'](function(_0x58a8a6){var _0x22725d=_[_0x7a2f('0x2e')](_0x58a8a6,function(_0x212db7){return Number(_0x212db7[_0x7a2f('0x60')]);});return db[_0x7a2f('0x61')][_0x7a2f('0x55')]({'where':{'UserId':{'$in':_0x38c761},'MailQueueId':{'$in':_0x22725d}},'transaction':_0x16ebe8});})['then'](function(){var _0x5eb4a7=_0x7a2f('0x62')+_0xe69e1a;return db[_0x7a2f('0x56')][_0x7a2f('0x33')](_0x5eb4a7,{'type':db[_0x7a2f('0x58')][_0x7a2f('0x5c')][_0x7a2f('0x59')],'raw':!![],'transaction':_0x16ebe8});})[_0x7a2f('0x29')](function(_0x44eae1){var _0x1e9c07=_[_0x7a2f('0x2e')](_0x44eae1,function(_0x3374a4){return Number(_0x3374a4[_0x7a2f('0x63')]);});return db[_0x7a2f('0x64')][_0x7a2f('0x55')]({'where':{'UserId':{'$in':_0x38c761},'SmsQueueId':{'$in':_0x1e9c07}},'transaction':_0x16ebe8});})['then'](function(){var _0xecb91c='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0xe69e1a;return db[_0x7a2f('0x56')][_0x7a2f('0x33')](_0xecb91c,{'type':db[_0x7a2f('0x58')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x16ebe8});})[_0x7a2f('0x29')](function(_0x14f86f){var _0x58cdb8=_['map'](_0x14f86f,function(_0x568eda){return Number(_0x568eda['ChatQueueId']);});return db['UserChatQueue'][_0x7a2f('0x55')]({'where':{'UserId':{'$in':_0x38c761},'ChatQueueId':{'$in':_0x58cdb8}},'transaction':_0x16ebe8});})[_0x7a2f('0x29')](function(){var _0x5d9cd7=_0x7a2f('0x65')+_0xe69e1a;return db['sequelize'][_0x7a2f('0x33')](_0x5d9cd7,{'type':db[_0x7a2f('0x58')][_0x7a2f('0x5c')][_0x7a2f('0x59')],'raw':!![],'transaction':_0x16ebe8});})[_0x7a2f('0x29')](function(_0x4a130e){var _0x27dcfe=_['map'](_0x4a130e,function(_0x3334b6){return Number(_0x3334b6[_0x7a2f('0x66')]);});return db['UserFaxQueue']['destroy']({'where':{'UserId':{'$in':_0x38c761},'FaxQueueId':{'$in':_0x27dcfe}},'transaction':_0x16ebe8});})[_0x7a2f('0x29')](function(){var _0x34ed10='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0xe69e1a;return db[_0x7a2f('0x56')][_0x7a2f('0x33')](_0x34ed10,{'type':db[_0x7a2f('0x58')][_0x7a2f('0x5c')]['SELECT'],'raw':!![],'transaction':_0x16ebe8});})[_0x7a2f('0x29')](function(_0x4cf645){var _0x4a2dfe=_[_0x7a2f('0x2e')](_0x4cf645,function(_0x2ca167){return Number(_0x2ca167['OpenchannelQueueId']);});return db[_0x7a2f('0x67')]['destroy']({'where':{'UserId':{'$in':_0x38c761},'OpenchannelQueueId':{'$in':_0x4a2dfe}},'transaction':_0x16ebe8});})['then'](function(){var _0x17b535='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0xe69e1a;return db[_0x7a2f('0x56')][_0x7a2f('0x33')](_0x17b535,{'type':db[_0x7a2f('0x58')][_0x7a2f('0x5c')][_0x7a2f('0x59')],'raw':!![],'transaction':_0x16ebe8});})['then'](function(_0x53a583){var _0x18c0bc=_['map'](_0x53a583,function(_0x3ddc0f){return Number(_0x3ddc0f[_0x7a2f('0x68')]);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x38c761},'WhatsappQueueId':{'$in':_0x18c0bc}},'transaction':_0x16ebe8});})[_0x7a2f('0x29')](function(){return db[_0x7a2f('0x69')][_0x7a2f('0x4a')]({'where':{'TeamId':_0xe69e1a}});})['then'](function(_0x229b85){if(_0x229b85===null){return;}return db[_0x7a2f('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x38c761},'VoicePrefixId':_0x229b85['VoicePrefixId']},'transaction':_0x16ebe8});})[_0x7a2f('0x29')](function(){return db['Team'][_0x7a2f('0x55')]({'where':{'id':_0xe69e1a},'cascade':!![],'transaction':_0x16ebe8});})[_0x7a2f('0x29')](function(_0x47d21b){if(_0x47d21b===0x0){_0x4bae14['sendStatus'](0x194);}else{return db['UserProfileResource'][_0x7a2f('0x55')]({'where':{'type':_0x7a2f('0x50'),'resourceId':_0xe69e1a},'cascade':!![],'transaction':_0x16ebe8})[_0x7a2f('0x29')](function(){_0x4bae14['status'](0xcc)['end']();});}})[_0x7a2f('0x4b')](function(_0x59c8db){_0x4bae14[_0x7a2f('0x1f')](0x1f4)[_0x7a2f('0x6b')](_0x59c8db);});});};exports[_0x7a2f('0x6c')]=function(_0x45e1f6,_0x4d77bd,_0x1e5612){return db[_0x7a2f('0x42')][_0x7a2f('0x6d')]({'where':{'id':_0x45e1f6[_0x7a2f('0x47')]['id']}})[_0x7a2f('0x29')](handleEntityNotFound(_0x4d77bd,null))[_0x7a2f('0x29')](function(_0x823541){if(!_0x45e1f6[_0x7a2f('0x33')]['channel']||!utils[_0x7a2f('0x6e')](_0x45e1f6['query'][_0x7a2f('0x6f')])){throw new db['Sequelize'][(_0x7a2f('0x70'))](_0x7a2f('0x71'));}var _0x4345f2={};var _0x257c3a={};_0x257c3a[_0x7a2f('0x36')]=_[_0x7a2f('0x48')](db[_[_0x7a2f('0x72')](_0x45e1f6[_0x7a2f('0x33')][_0x7a2f('0x6f')][_0x7a2f('0x73')]())+'Queue']['rawAttributes']);_0x257c3a[_0x7a2f('0x33')]=_['keys'](_0x45e1f6['query']);_0x257c3a[_0x7a2f('0x34')]=_[_0x7a2f('0x35')](_0x257c3a[_0x7a2f('0x36')],_0x257c3a[_0x7a2f('0x33')]);_0x4345f2[_0x7a2f('0x37')]=_[_0x7a2f('0x35')](_0x257c3a[_0x7a2f('0x36')],qs[_0x7a2f('0x38')](_0x45e1f6[_0x7a2f('0x33')]['fields']));_0x4345f2['attributes']=_0x4345f2[_0x7a2f('0x37')][_0x7a2f('0x39')]?_0x4345f2[_0x7a2f('0x37')]:_0x257c3a[_0x7a2f('0x36')];_0x4345f2[_0x7a2f('0x22')]=qs['limit'](_0x45e1f6['query']['limit']);_0x4345f2[_0x7a2f('0x20')]=qs[_0x7a2f('0x20')](_0x45e1f6[_0x7a2f('0x33')][_0x7a2f('0x20')]);_0x4345f2['order']=qs[_0x7a2f('0x3c')](_0x45e1f6[_0x7a2f('0x33')][_0x7a2f('0x3c')]);_0x4345f2['where']=qs[_0x7a2f('0x34')](_['pick'](_0x45e1f6[_0x7a2f('0x33')],_0x257c3a[_0x7a2f('0x34')]));_0x4345f2=_[_0x7a2f('0x40')]({},_0x4345f2,_0x45e1f6[_0x7a2f('0x41')]);return _0x823541[_0x7a2f('0x4f')+_[_0x7a2f('0x72')](_0x45e1f6[_0x7a2f('0x33')][_0x7a2f('0x6f')][_0x7a2f('0x73')]())+_0x7a2f('0x74')](_0x4345f2);})[_0x7a2f('0x29')](respondWithResult(_0x4d77bd,null))[_0x7a2f('0x4b')](handleError(_0x4d77bd,null));};exports[_0x7a2f('0x75')]=function(_0x16b447,_0x30880f,_0x30cabe){return db[_0x7a2f('0x42')][_0x7a2f('0x6d')]({'where':{'id':_0x16b447[_0x7a2f('0x47')]['id']}})[_0x7a2f('0x29')](function(_0x3239ed){if(_0x3239ed){if(!_0x16b447['body'][_0x7a2f('0x6f')]||!utils['isValidChannel'](_0x16b447[_0x7a2f('0x4d')][_0x7a2f('0x6f')])){throw new db[(_0x7a2f('0x58'))][(_0x7a2f('0x70'))]('Unknown\x20channel');}return _0x3239ed[_0x7a2f('0x76')+_[_0x7a2f('0x72')](_0x16b447[_0x7a2f('0x4d')]['channel'][_0x7a2f('0x73')]())+'Queues'](_0x16b447[_0x7a2f('0x4d')][_0x7a2f('0x77')]);}return null;})[_0x7a2f('0x29')](handleEntityNotFound(_0x30880f,null))['then'](respondWithStatusCode(_0x30880f,null))[_0x7a2f('0x4b')](handleError(_0x30880f,null));};exports[_0x7a2f('0x78')]=function(_0xb85ef2,_0x12b514,_0x314ca5){return db[_0x7a2f('0x42')]['findOne']({'where':{'id':_0xb85ef2[_0x7a2f('0x47')]['id']}})[_0x7a2f('0x29')](function(_0x552254){if(_0x552254){if(!_0xb85ef2[_0x7a2f('0x33')][_0x7a2f('0x6f')]||!utils['isValidChannel'](_0xb85ef2[_0x7a2f('0x33')][_0x7a2f('0x6f')])){throw new db[(_0x7a2f('0x58'))][(_0x7a2f('0x70'))](_0x7a2f('0x71'));}return _0x552254[_0x7a2f('0x79')+_['capitalize'](_0xb85ef2[_0x7a2f('0x33')][_0x7a2f('0x6f')][_0x7a2f('0x73')]())+_0x7a2f('0x74')](_0xb85ef2['query'][_0x7a2f('0x77')]);}return null;})[_0x7a2f('0x29')](handleEntityNotFound(_0x12b514,null))['then'](respondWithStatusCode(_0x12b514,null))[_0x7a2f('0x4b')](handleError(_0x12b514,null));};exports['addAgents']=function(_0x216826,_0x461ae8){var _0x1d6d45=_[_0x7a2f('0x7a')](_0x216826['body'][_0x7a2f('0x77')])?_0x216826[_0x7a2f('0x4d')][_0x7a2f('0x77')]:[_0x216826[_0x7a2f('0x4d')]['ids']];var _0x2d2235=_0x216826[_0x7a2f('0x47')]['id'];return db['Team']['find']({'where':{'id':_0x2d2235}})[_0x7a2f('0x29')](handleEntityNotFound(_0x461ae8,null))[_0x7a2f('0x29')](function(_0xa87584){if(_0xa87584){var _0x1f69ad=[_0x7a2f('0x7b'),_0x7a2f('0x7c'),_0x7a2f('0x7d'),_0x7a2f('0x7e'),_0x7a2f('0x7f'),'Openchannel',_0x7a2f('0x80')];return db[_0x7a2f('0x56')][_0x7a2f('0x57')](function(_0x2e382f){var _0x5d942a=_[_0x7a2f('0x2e')](_0x1f69ad,function(_0x39e6e7){var _0x2655a6={'attributes':['id',_0x7a2f('0x2c')]};if(_0x39e6e7==='Voice'){_0x2655a6[_0x7a2f('0x81')]={'attributes':['penalty']};}return _0xa87584[_0x7a2f('0x4f')+_0x39e6e7+_0x7a2f('0x74')](_0x2655a6)['then'](function(_0x588088){var _0x251109=_[_0x7a2f('0x2e')](_0x588088,function(_0x1dc4e7){var _0x37b3c9=_[_0x7a2f('0x2e')](_0x1d6d45,function(_0x325902){var _0x43e9c1={'where':{'UserId':_0x325902,[_0x39e6e7+'QueueId']:_0x1dc4e7['id']},'transaction':_0x2e382f};if(_0x39e6e7==='Voice'){_0x43e9c1[_0x7a2f('0x1b')]={'penalty':_0x1dc4e7['TeamVoiceQueue'][_0x7a2f('0x82')]};}return db[_0x7a2f('0x83')+_0x39e6e7+_0x7a2f('0x84')][_0x7a2f('0x85')](_0x43e9c1)[_0x7a2f('0x29')](function(){socket[_0x7a2f('0x86')](_0x7a2f('0x4e')+_0x39e6e7+_0x7a2f('0x87'),{'UserId':_0x325902,[_0x39e6e7+_0x7a2f('0x88')]:_0x1dc4e7['id']});if(_0x39e6e7!=='Voice'){return;}return db[_0x7a2f('0x83')][_0x7a2f('0x44')]({'where':{'id':_0x1d6d45,'online':0x1},'attributes':['id',_0x7a2f('0x2c'),_0x7a2f('0x89'),_0x7a2f('0x8a'),_0x7a2f('0x8b')],'raw':!![]})[_0x7a2f('0x29')](function(_0x298b57){var _0x44bb98=_[_0x7a2f('0x2e')](_0x298b57,function(_0x24b2f9){return db['UserVoiceQueueRt'][_0x7a2f('0x8c')]({'membername':_0x24b2f9[_0x7a2f('0x2c')],'UserId':_0x24b2f9['id'],'queue_name':_0x1dc4e7['name'],'VoiceQueueId':_0x1dc4e7['id'],'interface':_[_0x7a2f('0x8d')](_0x24b2f9[_0x7a2f('0x8b')])?util[_0x7a2f('0x8e')]('SIP/%s',_0x24b2f9[_0x7a2f('0x2c')]):_0x24b2f9[_0x7a2f('0x8b')],'paused':_0x24b2f9[_0x7a2f('0x8a')]||![],'penalty':_0x1dc4e7['TeamVoiceQueue']['penalty']},{'transaction':_0x2e382f});});return Promise[_0x7a2f('0x8f')](_0x44bb98);});});});return Promise[_0x7a2f('0x8f')](_0x37b3c9);});return Promise['all'](_0x251109);})[_0x7a2f('0x29')](function(){return db[_0x7a2f('0x69')]['findOne']({'where':{'teamId':_0x2d2235}})['then'](function(_0x559cbe){if(_0x559cbe){var _0x15d99e=_['map'](_0x1d6d45,function(_0x6c6174){db['UserVoicePrefix'][_0x7a2f('0x8c')]({'UserId':_0x6c6174,'VoicePrefixId':_0x559cbe['VoicePrefixId']});});return Promise['all'](_0x15d99e);}});});});return Promise[_0x7a2f('0x8f')](_0x5d942a)[_0x7a2f('0x29')](function(){return _0xa87584[_0x7a2f('0x90')](_0x1d6d45,{'transaction':_0x2e382f})[_0x7a2f('0x91')](function(_0x4ad48f){return _0x4ad48f;});});});}})[_0x7a2f('0x29')](respondWithResult(_0x461ae8,null))[_0x7a2f('0x4b')](handleError(_0x461ae8,null));};exports[_0x7a2f('0x92')]=function(_0x28c099,_0x4df054){var _0x333ef7=_[_0x7a2f('0x7a')](_0x28c099[_0x7a2f('0x33')][_0x7a2f('0x77')])?_0x28c099[_0x7a2f('0x33')][_0x7a2f('0x77')]:[_0x28c099[_0x7a2f('0x33')]['ids']];var _0x3394ae=_0x28c099['params']['id'];return db['Team'][_0x7a2f('0x4a')]({'where':{'id':_0x3394ae}})['then'](handleEntityNotFound(_0x4df054,null))[_0x7a2f('0x29')](function(_0x14d0a){if(_0x14d0a){var _0x525798=['Voice',_0x7a2f('0x7c'),_0x7a2f('0x7d'),'Sms',_0x7a2f('0x7f'),_0x7a2f('0x93'),_0x7a2f('0x80')];return db[_0x7a2f('0x56')]['transaction'](function(_0x2bb9e7){var _0x2413c3=_['map'](_0x525798,function(_0x11b203){var _0xd93c34={'attributes':['id',_0x7a2f('0x2c')]};return _0x14d0a[_0x7a2f('0x4f')+_0x11b203+'Queues'](_0xd93c34)[_0x7a2f('0x29')](function(_0x3c86bb){var _0x3d5b45=_[_0x7a2f('0x2e')](_0x3c86bb,function(_0x19e92a){return _0x19e92a[_0x7a2f('0x92')](_0x333ef7,{'transaction':_0x2bb9e7})[_0x7a2f('0x29')](function(){var _0x5d635f=_[_0x7a2f('0x2e')](_0x333ef7,function(_0x3bb516){socket[_0x7a2f('0x86')](_0x7a2f('0x4e')+_0x11b203+_0x7a2f('0x94'),{'UserId':Number(_0x3bb516),[_0x11b203+_0x7a2f('0x88')]:_0x19e92a['id']});if(_0x11b203!==_0x7a2f('0x7b')){return;}return db[_0x7a2f('0x95')]['destroy']({'where':{'VoiceQueueId':_0x19e92a['id'],'UserId':_0x3bb516},'transaction':_0x2bb9e7});});return Promise[_0x7a2f('0x8f')](_0x5d635f);});});return Promise[_0x7a2f('0x8f')](_0x3d5b45);});});return Promise['all'](_0x2413c3)[_0x7a2f('0x29')](function(){return _0x14d0a[_0x7a2f('0x92')](_0x333ef7,{'transaction':_0x2bb9e7});})[_0x7a2f('0x29')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x3394ae}})[_0x7a2f('0x29')](function(_0x1fea9a){if(_0x1fea9a){var _0x534a56=_['map'](_0x333ef7,function(_0x216c4e){db[_0x7a2f('0x6a')]['destroy']({'where':{'UserId':_0x216c4e,'VoicePrefixId':_0x1fea9a[_0x7a2f('0x96')]}});});return Promise[_0x7a2f('0x8f')](_0x534a56);}});});});}})['then'](respondWithStatusCode(_0x4df054,null))['catch'](handleError(_0x4df054,null));};exports[_0x7a2f('0x97')]=function(_0x44ee34,_0x71caa,_0x12c6de){var _0x3b48aa={};var _0x34463a={};var _0x16586b;var _0x496fb0;return db[_0x7a2f('0x42')][_0x7a2f('0x6d')]({'where':{'id':_0x44ee34[_0x7a2f('0x47')]['id']}})[_0x7a2f('0x29')](handleEntityNotFound(_0x71caa,null))[_0x7a2f('0x29')](function(_0x43bee3){if(_0x43bee3){_0x16586b=_0x43bee3;_0x34463a['model']=_[_0x7a2f('0x48')](db[_0x7a2f('0x83')][_0x7a2f('0x2f')]);_0x34463a[_0x7a2f('0x33')]=_['keys'](_0x44ee34['query']);_0x34463a[_0x7a2f('0x34')]=_[_0x7a2f('0x35')](_0x34463a[_0x7a2f('0x36')],_0x34463a[_0x7a2f('0x33')]);_0x3b48aa[_0x7a2f('0x37')]=_[_0x7a2f('0x35')](_0x34463a[_0x7a2f('0x36')],qs['fields'](_0x44ee34[_0x7a2f('0x33')][_0x7a2f('0x38')]));_0x3b48aa[_0x7a2f('0x37')]=_0x3b48aa[_0x7a2f('0x37')][_0x7a2f('0x39')]?_0x3b48aa['attributes']:_0x34463a[_0x7a2f('0x36')];_0x3b48aa[_0x7a2f('0x98')]=qs['sort'](_0x44ee34['query'][_0x7a2f('0x3c')]);_0x3b48aa[_0x7a2f('0x3d')]=qs[_0x7a2f('0x34')](_[_0x7a2f('0x99')](_0x44ee34['query'],_0x34463a[_0x7a2f('0x34')]));if(_0x44ee34[_0x7a2f('0x33')][_0x7a2f('0x3e')]){_0x3b48aa[_0x7a2f('0x3d')]=_[_0x7a2f('0x40')](_0x3b48aa[_0x7a2f('0x3d')],{'$or':_[_0x7a2f('0x2e')](_0x3b48aa['attributes'],function(_0x30f9d1){var _0x4c5851={};_0x4c5851[_0x30f9d1]={'$like':'%'+_0x44ee34[_0x7a2f('0x33')]['filter']+'%'};return _0x4c5851;})});}_0x3b48aa=_[_0x7a2f('0x40')]({},_0x3b48aa,_0x44ee34[_0x7a2f('0x41')]);return _0x16586b[_0x7a2f('0x97')](_0x3b48aa);}})[_0x7a2f('0x29')](function(_0xbbf36c){if(_0xbbf36c){_0x496fb0=_0xbbf36c[_0x7a2f('0x39')];if(!_0x44ee34[_0x7a2f('0x33')][_0x7a2f('0x3a')]('nolimit')){_0x3b48aa[_0x7a2f('0x22')]=qs[_0x7a2f('0x22')](_0x44ee34[_0x7a2f('0x33')][_0x7a2f('0x22')]);_0x3b48aa[_0x7a2f('0x20')]=qs['offset'](_0x44ee34['query'][_0x7a2f('0x20')]);}return _0x16586b[_0x7a2f('0x97')](_0x3b48aa);}})[_0x7a2f('0x29')](function(_0x1ec0c6){if(_0x1ec0c6){return _0x1ec0c6?{'count':_0x496fb0,'rows':_0x1ec0c6}:null;}})[_0x7a2f('0x29')](respondWithResult(_0x71caa,null))[_0x7a2f('0x4b')](handleError(_0x71caa,null));}; \ No newline at end of file +var _0x95c2=['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','redis','defaults','localhost','socket.io-emitter','./team.socket','sendStatus','status','json','offset','undefined','limit','set','apply','update','then','error','stack','name','map','Team','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','keys','rawAttributes','find','user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','sequelize','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserVoicePrefix','VoicePrefixId','Teams','end','send','getQueues','findOne','channel','isValidChannel','toLowerCase','Queue','capitalize','Queues','ValidationError','Unknown\x20channel','add','removeQueues','remove','ids','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Whatsapp','transaction','through','QueueId','penalty','User','findOrCreate','emit','Queue:save','findAll','online','voicePause','upsert','isNil','interface','format','TeamVoiceQueue','all','TeamVoicePrefix','spread','removeAgents','Openchannel','Queue:remove','getAgents','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x5d712b,_0x37b74d){var _0xf74eec=function(_0x14a796){while(--_0x14a796){_0x5d712b['push'](_0x5d712b['shift']());}};_0xf74eec(++_0x37b74d);}(_0x95c2,0x1c8));var _0x295c=function(_0x55d41,_0x47adb1){_0x55d41=_0x55d41-0x0;var _0x4f712c=_0x95c2[_0x55d41];return _0x4f712c;};'use strict';var emlformat=require(_0x295c('0x0'));var rimraf=require(_0x295c('0x1'));var zipdir=require(_0x295c('0x2'));var jsonpatch=require(_0x295c('0x3'));var rp=require(_0x295c('0x4'));var moment=require('moment');var BPromise=require(_0x295c('0x5'));var Mustache=require(_0x295c('0x6'));var util=require(_0x295c('0x7'));var path=require('path');var sox=require(_0x295c('0x8'));var csv=require(_0x295c('0x9'));var ejs=require(_0x295c('0xa'));var fs=require('fs');var fs_extra=require(_0x295c('0xb'));var _=require(_0x295c('0xc'));var squel=require(_0x295c('0xd'));var crypto=require(_0x295c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x295c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x295c('0x10'));var Papa=require(_0x295c('0x11'));var Redis=require(_0x295c('0x12'));var authService=require(_0x295c('0x13'));var qs=require(_0x295c('0x14'));var as=require(_0x295c('0x15'));var hardwareService=require(_0x295c('0x16'));var logger=require('../../config/logger')(_0x295c('0x17'));var utils=require(_0x295c('0x18'));var config=require(_0x295c('0x19'));var licenseUtil=require(_0x295c('0x1a'));var db=require(_0x295c('0x1b'))['db'];config[_0x295c('0x1c')]=_[_0x295c('0x1d')](config[_0x295c('0x1c')],{'host':_0x295c('0x1e'),'port':0x18eb});var socket=require(_0x295c('0x1f'))(new Redis(config[_0x295c('0x1c')]));require(_0x295c('0x20'))['register'](socket);function respondWithStatusCode(_0x238ba4,_0x549ae1){_0x549ae1=_0x549ae1||0xcc;return function(_0x27021c){if(_0x27021c){return _0x238ba4[_0x295c('0x21')](_0x549ae1);}return _0x238ba4[_0x295c('0x22')](_0x549ae1)['end']();};}function respondWithResult(_0x31ab51,_0x38af09){_0x38af09=_0x38af09||0xc8;return function(_0x483e08){if(_0x483e08){return _0x31ab51[_0x295c('0x22')](_0x38af09)[_0x295c('0x23')](_0x483e08);}};}function respondWithFilteredResult(_0x1535a8,_0x5bc3fc){return function(_0x1c66b3){if(_0x1c66b3){var _0x30797b=typeof _0x5bc3fc[_0x295c('0x24')]===_0x295c('0x25')&&typeof _0x5bc3fc[_0x295c('0x26')]==='undefined';var _0x205f28=_0x1c66b3['count'];var _0x3a4473=_0x30797b?0x0:_0x5bc3fc[_0x295c('0x24')];var _0x33ff12=_0x30797b?_0x1c66b3['count']:_0x5bc3fc[_0x295c('0x24')]+_0x5bc3fc['limit'];var _0x159e5e;if(_0x33ff12>=_0x205f28){_0x33ff12=_0x205f28;_0x159e5e=0xc8;}else{_0x159e5e=0xce;}_0x1535a8[_0x295c('0x22')](_0x159e5e);return _0x1535a8[_0x295c('0x27')]('Content-Range',_0x3a4473+'-'+_0x33ff12+'/'+_0x205f28)[_0x295c('0x23')](_0x1c66b3);}return null;};}function patchUpdates(_0x481b43){return function(_0x5a6f32){try{jsonpatch[_0x295c('0x28')](_0x5a6f32,_0x481b43,!![]);}catch(_0x5f4a2e){return BPromise['reject'](_0x5f4a2e);}return _0x5a6f32['save']();};}function saveUpdates(_0x1a2c4c,_0x511657){return function(_0x1df1c6){if(_0x1df1c6){return _0x1df1c6[_0x295c('0x29')](_0x1a2c4c)[_0x295c('0x2a')](function(_0x441674){return _0x441674;});}return null;};}function handleEntityNotFound(_0x566b4f,_0x2bc764){return function(_0x143295){if(!_0x143295){_0x566b4f[_0x295c('0x21')](0x194);}return _0x143295;};}function handleError(_0x8d44da,_0xe18201){_0xe18201=_0xe18201||0x1f4;return function(_0x458370){logger[_0x295c('0x2b')](_0x458370[_0x295c('0x2c')]);if(_0x458370[_0x295c('0x2d')]){delete _0x458370[_0x295c('0x2d')];}_0x8d44da['status'](_0xe18201)['send'](_0x458370);};}exports['index']=function(_0x29ac7a,_0x1c6baf){var _0x2428bf={},_0x5ebc0f={},_0x489c41={'count':0x0,'rows':[]};var _0x688163=_[_0x295c('0x2e')](db[_0x295c('0x2f')]['rawAttributes'],function(_0x1d6c1f){return{'name':_0x1d6c1f[_0x295c('0x30')],'type':_0x1d6c1f[_0x295c('0x31')][_0x295c('0x32')]};});_0x5ebc0f['model']=_[_0x295c('0x2e')](_0x688163,_0x295c('0x2d'));_0x5ebc0f['query']=_['keys'](_0x29ac7a[_0x295c('0x33')]);_0x5ebc0f['filters']=_[_0x295c('0x34')](_0x5ebc0f[_0x295c('0x35')],_0x5ebc0f['query']);_0x2428bf[_0x295c('0x36')]=_[_0x295c('0x34')](_0x5ebc0f['model'],qs[_0x295c('0x37')](_0x29ac7a[_0x295c('0x33')][_0x295c('0x37')]));_0x2428bf[_0x295c('0x36')]=_0x2428bf['attributes'][_0x295c('0x38')]?_0x2428bf[_0x295c('0x36')]:_0x5ebc0f[_0x295c('0x35')];if(!_0x29ac7a[_0x295c('0x33')][_0x295c('0x39')]('nolimit')){_0x2428bf[_0x295c('0x26')]=qs['limit'](_0x29ac7a[_0x295c('0x33')][_0x295c('0x26')]);_0x2428bf[_0x295c('0x24')]=qs[_0x295c('0x24')](_0x29ac7a[_0x295c('0x33')][_0x295c('0x24')]);}_0x2428bf[_0x295c('0x3a')]=qs[_0x295c('0x3b')](_0x29ac7a[_0x295c('0x33')]['sort']);_0x2428bf[_0x295c('0x3c')]=qs[_0x295c('0x3d')](_[_0x295c('0x3e')](_0x29ac7a['query'],_0x5ebc0f[_0x295c('0x3d')]),_0x688163);if(_0x29ac7a['query'][_0x295c('0x3f')]){_0x2428bf[_0x295c('0x3c')]=_[_0x295c('0x40')](_0x2428bf[_0x295c('0x3c')],{'$or':_[_0x295c('0x2e')](_0x688163,function(_0x287b59){if(_0x287b59[_0x295c('0x31')]!==_0x295c('0x41')){var _0x54b260={};_0x54b260[_0x287b59[_0x295c('0x2d')]]={'$like':'%'+_0x29ac7a[_0x295c('0x33')][_0x295c('0x3f')]+'%'};return _0x54b260;}})});}_0x2428bf=_[_0x295c('0x40')]({},_0x2428bf,_0x29ac7a[_0x295c('0x42')]);var _0x2b08ee={'where':_0x2428bf[_0x295c('0x3c')]};return db[_0x295c('0x2f')][_0x295c('0x43')](_0x2b08ee)[_0x295c('0x2a')](function(_0x6b56f8){_0x489c41[_0x295c('0x43')]=_0x6b56f8;if(_0x29ac7a['query'][_0x295c('0x44')]){_0x2428bf[_0x295c('0x45')]=[{'all':!![]}];}return db[_0x295c('0x2f')]['findAll'](_0x2428bf);})[_0x295c('0x2a')](function(_0x3c71d1){_0x489c41[_0x295c('0x46')]=_0x3c71d1;return _0x489c41;})['then'](respondWithFilteredResult(_0x1c6baf,_0x2428bf))[_0x295c('0x47')](handleError(_0x1c6baf,null));};exports[_0x295c('0x48')]=function(_0x353f10,_0xf3d469){var _0x376189={'raw':![],'where':{'id':_0x353f10['params']['id']}},_0x1c4175={};_0x1c4175[_0x295c('0x35')]=_[_0x295c('0x49')](db[_0x295c('0x2f')][_0x295c('0x4a')]);_0x1c4175[_0x295c('0x33')]=_[_0x295c('0x49')](_0x353f10['query']);_0x1c4175[_0x295c('0x3d')]=_[_0x295c('0x34')](_0x1c4175[_0x295c('0x35')],_0x1c4175[_0x295c('0x33')]);_0x376189[_0x295c('0x36')]=_[_0x295c('0x34')](_0x1c4175[_0x295c('0x35')],qs[_0x295c('0x37')](_0x353f10[_0x295c('0x33')][_0x295c('0x37')]));_0x376189[_0x295c('0x36')]=_0x376189[_0x295c('0x36')][_0x295c('0x38')]?_0x376189[_0x295c('0x36')]:_0x1c4175[_0x295c('0x35')];if(_0x353f10[_0x295c('0x33')][_0x295c('0x44')]){_0x376189[_0x295c('0x45')]=[{'all':!![]}];}_0x376189=_[_0x295c('0x40')]({},_0x376189,_0x353f10[_0x295c('0x42')]);return db[_0x295c('0x2f')][_0x295c('0x4b')](_0x376189)[_0x295c('0x2a')](handleEntityNotFound(_0xf3d469,null))[_0x295c('0x2a')](respondWithResult(_0xf3d469,null))[_0x295c('0x47')](handleError(_0xf3d469,null));};exports['create']=function(_0x35edf2,_0x4cc0df){return db[_0x295c('0x2f')]['create'](_0x35edf2['body'],{})[_0x295c('0x2a')](function(_0x5265ee){var _0x3363e8=_0x35edf2[_0x295c('0x4c')]['get']({'plain':!![]});if(!_0x3363e8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3363e8[_0x295c('0x4d')]==='user'){var _0x5afcbd=_0x5265ee[_0x295c('0x4e')]({'plain':!![]});var _0x26999c='Teams';return db[_0x295c('0x4f')][_0x295c('0x4b')]({'where':{'name':_0x26999c,'userProfileId':_0x3363e8[_0x295c('0x50')]},'raw':!![]})['then'](function(_0x264d09){if(_0x264d09&&_0x264d09[_0x295c('0x51')]===0x0){return db[_0x295c('0x52')]['create']({'name':_0x5afcbd['name'],'resourceId':_0x5afcbd['id'],'type':_0x264d09[_0x295c('0x2d')],'sectionId':_0x264d09['id']},{})['then'](function(){return _0x5265ee;});}else{return _0x5265ee;}})[_0x295c('0x47')](function(_0x4626e9){logger[_0x295c('0x2b')](_0x295c('0x53'),_0x4626e9);throw _0x4626e9;});}return _0x5265ee;})['then'](respondWithResult(_0x4cc0df,0xc9))[_0x295c('0x47')](handleError(_0x4cc0df,null));};exports[_0x295c('0x29')]=function(_0x5c1125,_0x44d1f5){if(_0x5c1125[_0x295c('0x54')]['id']){delete _0x5c1125['body']['id'];}return db[_0x295c('0x2f')][_0x295c('0x4b')]({'where':{'id':_0x5c1125[_0x295c('0x55')]['id']}})[_0x295c('0x2a')](handleEntityNotFound(_0x44d1f5,null))['then'](saveUpdates(_0x5c1125[_0x295c('0x54')],null))[_0x295c('0x2a')](respondWithResult(_0x44d1f5,null))[_0x295c('0x47')](handleError(_0x44d1f5,null));};exports['destroy']=function(_0x4730ac,_0x51b88e){var _0x5f41c4=_0x4730ac[_0x295c('0x55')]['id'];var _0x5b4218=[];return db[_0x295c('0x56')]['transaction'](function(_0x119ae5){var _0x195d47='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x5f41c4;return db[_0x295c('0x56')]['query'](_0x195d47,{'type':db[_0x295c('0x57')][_0x295c('0x58')][_0x295c('0x59')],'raw':!![],'transaction':_0x119ae5})[_0x295c('0x2a')](function(_0x20edab){_0x5b4218=_['map'](_0x20edab,function(_0xa79c0c){return Number(_0xa79c0c[_0x295c('0x5a')]);});})[_0x295c('0x2a')](function(){var _0x2d7822=_0x295c('0x5b')+_0x5f41c4;return db[_0x295c('0x56')][_0x295c('0x33')](_0x2d7822,{'type':db[_0x295c('0x57')]['QueryTypes'][_0x295c('0x59')],'raw':!![],'transaction':_0x119ae5});})[_0x295c('0x2a')](function(_0x4cbad0){var _0x31fef4=_['map'](_0x4cbad0,function(_0x5e024e){return Number(_0x5e024e[_0x295c('0x5c')]);});return db['UserVoiceQueue'][_0x295c('0x5d')]({'where':{'UserId':{'$in':_0x5b4218},'VoiceQueueId':{'$in':_0x31fef4}},'transaction':_0x119ae5});})[_0x295c('0x2a')](function(){var _0x12da4a=_0x295c('0x5e')+_0x5f41c4;return db[_0x295c('0x56')]['query'](_0x12da4a,{'type':db[_0x295c('0x57')][_0x295c('0x58')]['SELECT'],'raw':!![],'transaction':_0x119ae5});})['then'](function(_0x33c803){var _0x47373f=_[_0x295c('0x2e')](_0x33c803,function(_0x3b3d38){return Number(_0x3b3d38[_0x295c('0x5f')]);});return db[_0x295c('0x60')][_0x295c('0x5d')]({'where':{'UserId':{'$in':_0x5b4218},'MailQueueId':{'$in':_0x47373f}},'transaction':_0x119ae5});})['then'](function(){var _0x438b44='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5f41c4;return db[_0x295c('0x56')]['query'](_0x438b44,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x119ae5});})[_0x295c('0x2a')](function(_0x3382f4){var _0x47e1fa=_[_0x295c('0x2e')](_0x3382f4,function(_0x5104bc){return Number(_0x5104bc[_0x295c('0x61')]);});return db['UserSmsQueue'][_0x295c('0x5d')]({'where':{'UserId':{'$in':_0x5b4218},'SmsQueueId':{'$in':_0x47e1fa}},'transaction':_0x119ae5});})[_0x295c('0x2a')](function(){var _0xac7e15=_0x295c('0x62')+_0x5f41c4;return db[_0x295c('0x56')][_0x295c('0x33')](_0xac7e15,{'type':db[_0x295c('0x57')][_0x295c('0x58')]['SELECT'],'raw':!![],'transaction':_0x119ae5});})['then'](function(_0x103e84){var _0x45d53=_['map'](_0x103e84,function(_0x13a911){return Number(_0x13a911[_0x295c('0x63')]);});return db[_0x295c('0x64')]['destroy']({'where':{'UserId':{'$in':_0x5b4218},'ChatQueueId':{'$in':_0x45d53}},'transaction':_0x119ae5});})[_0x295c('0x2a')](function(){var _0x99e62a=_0x295c('0x65')+_0x5f41c4;return db[_0x295c('0x56')][_0x295c('0x33')](_0x99e62a,{'type':db[_0x295c('0x57')][_0x295c('0x58')][_0x295c('0x59')],'raw':!![],'transaction':_0x119ae5});})[_0x295c('0x2a')](function(_0x279df7){var _0x246411=_[_0x295c('0x2e')](_0x279df7,function(_0x104d01){return Number(_0x104d01['FaxQueueId']);});return db['UserFaxQueue']['destroy']({'where':{'UserId':{'$in':_0x5b4218},'FaxQueueId':{'$in':_0x246411}},'transaction':_0x119ae5});})['then'](function(){var _0x58827c=_0x295c('0x66')+_0x5f41c4;return db[_0x295c('0x56')][_0x295c('0x33')](_0x58827c,{'type':db[_0x295c('0x57')][_0x295c('0x58')][_0x295c('0x59')],'raw':!![],'transaction':_0x119ae5});})[_0x295c('0x2a')](function(_0x2c028e){var _0x293460=_[_0x295c('0x2e')](_0x2c028e,function(_0x3732d9){return Number(_0x3732d9['OpenchannelQueueId']);});return db[_0x295c('0x67')][_0x295c('0x5d')]({'where':{'UserId':{'$in':_0x5b4218},'OpenchannelQueueId':{'$in':_0x293460}},'transaction':_0x119ae5});})[_0x295c('0x2a')](function(){var _0xa59b8=_0x295c('0x68')+_0x5f41c4;return db[_0x295c('0x56')]['query'](_0xa59b8,{'type':db[_0x295c('0x57')][_0x295c('0x58')]['SELECT'],'raw':!![],'transaction':_0x119ae5});})[_0x295c('0x2a')](function(_0x1c0562){var _0x290841=_[_0x295c('0x2e')](_0x1c0562,function(_0x3dd12b){return Number(_0x3dd12b['WhatsappQueueId']);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x5b4218},'WhatsappQueueId':{'$in':_0x290841}},'transaction':_0x119ae5});})['then'](function(){return db['TeamVoicePrefix'][_0x295c('0x4b')]({'where':{'TeamId':_0x5f41c4}});})['then'](function(_0x537447){if(_0x537447===null){return;}return db[_0x295c('0x69')][_0x295c('0x5d')]({'where':{'UserId':{'$in':_0x5b4218},'VoicePrefixId':_0x537447[_0x295c('0x6a')]},'transaction':_0x119ae5});})[_0x295c('0x2a')](function(){return db['Team'][_0x295c('0x5d')]({'where':{'id':_0x5f41c4},'cascade':!![],'transaction':_0x119ae5});})[_0x295c('0x2a')](function(_0xbe4356){if(_0xbe4356===0x0){_0x51b88e['sendStatus'](0x194);}else{return db['UserProfileResource'][_0x295c('0x5d')]({'where':{'type':_0x295c('0x6b'),'resourceId':_0x5f41c4},'cascade':!![],'transaction':_0x119ae5})[_0x295c('0x2a')](function(){_0x51b88e[_0x295c('0x22')](0xcc)[_0x295c('0x6c')]();});}})[_0x295c('0x47')](function(_0x2788c8){_0x51b88e[_0x295c('0x22')](0x1f4)[_0x295c('0x6d')](_0x2788c8);});});};exports[_0x295c('0x6e')]=function(_0x3a9806,_0x2fd5d3,_0x6fcb73){return db[_0x295c('0x2f')][_0x295c('0x6f')]({'where':{'id':_0x3a9806['params']['id']}})[_0x295c('0x2a')](handleEntityNotFound(_0x2fd5d3,null))['then'](function(_0x3b8d5d){if(!_0x3a9806[_0x295c('0x33')][_0x295c('0x70')]||!utils[_0x295c('0x71')](_0x3a9806[_0x295c('0x33')][_0x295c('0x70')])){throw new db[(_0x295c('0x57'))]['ValidationError']('Unknown\x20channel');}var _0x2518a4={};var _0x2afbeb={};_0x2afbeb['model']=_[_0x295c('0x49')](db[_['capitalize'](_0x3a9806[_0x295c('0x33')][_0x295c('0x70')][_0x295c('0x72')]())+_0x295c('0x73')][_0x295c('0x4a')]);_0x2afbeb[_0x295c('0x33')]=_[_0x295c('0x49')](_0x3a9806[_0x295c('0x33')]);_0x2afbeb[_0x295c('0x3d')]=_[_0x295c('0x34')](_0x2afbeb['model'],_0x2afbeb[_0x295c('0x33')]);_0x2518a4[_0x295c('0x36')]=_[_0x295c('0x34')](_0x2afbeb[_0x295c('0x35')],qs[_0x295c('0x37')](_0x3a9806[_0x295c('0x33')]['fields']));_0x2518a4[_0x295c('0x36')]=_0x2518a4[_0x295c('0x36')][_0x295c('0x38')]?_0x2518a4[_0x295c('0x36')]:_0x2afbeb[_0x295c('0x35')];_0x2518a4[_0x295c('0x26')]=qs[_0x295c('0x26')](_0x3a9806[_0x295c('0x33')]['limit']);_0x2518a4[_0x295c('0x24')]=qs['offset'](_0x3a9806['query'][_0x295c('0x24')]);_0x2518a4[_0x295c('0x3a')]=qs['sort'](_0x3a9806[_0x295c('0x33')][_0x295c('0x3b')]);_0x2518a4[_0x295c('0x3c')]=qs[_0x295c('0x3d')](_[_0x295c('0x3e')](_0x3a9806['query'],_0x2afbeb[_0x295c('0x3d')]));_0x2518a4=_[_0x295c('0x40')]({},_0x2518a4,_0x3a9806[_0x295c('0x42')]);return _0x3b8d5d[_0x295c('0x4e')+_[_0x295c('0x74')](_0x3a9806['query'][_0x295c('0x70')][_0x295c('0x72')]())+_0x295c('0x75')](_0x2518a4);})[_0x295c('0x2a')](respondWithResult(_0x2fd5d3,null))[_0x295c('0x47')](handleError(_0x2fd5d3,null));};exports['addQueues']=function(_0x56e79c,_0x1938f6,_0x283e70){return db[_0x295c('0x2f')][_0x295c('0x6f')]({'where':{'id':_0x56e79c[_0x295c('0x55')]['id']}})['then'](function(_0x3cd988){if(_0x3cd988){if(!_0x56e79c[_0x295c('0x54')][_0x295c('0x70')]||!utils['isValidChannel'](_0x56e79c[_0x295c('0x54')]['channel'])){throw new db[(_0x295c('0x57'))][(_0x295c('0x76'))](_0x295c('0x77'));}return _0x3cd988[_0x295c('0x78')+_[_0x295c('0x74')](_0x56e79c['body']['channel'][_0x295c('0x72')]())+'Queues'](_0x56e79c['body']['ids']);}return null;})['then'](handleEntityNotFound(_0x1938f6,null))[_0x295c('0x2a')](respondWithStatusCode(_0x1938f6,null))[_0x295c('0x47')](handleError(_0x1938f6,null));};exports[_0x295c('0x79')]=function(_0x2fdc7d,_0x5d9f99,_0x353e5c){return db[_0x295c('0x2f')][_0x295c('0x6f')]({'where':{'id':_0x2fdc7d[_0x295c('0x55')]['id']}})[_0x295c('0x2a')](function(_0x244afa){if(_0x244afa){if(!_0x2fdc7d[_0x295c('0x33')][_0x295c('0x70')]||!utils[_0x295c('0x71')](_0x2fdc7d[_0x295c('0x33')][_0x295c('0x70')])){throw new db[(_0x295c('0x57'))][(_0x295c('0x76'))](_0x295c('0x77'));}return _0x244afa[_0x295c('0x7a')+_[_0x295c('0x74')](_0x2fdc7d[_0x295c('0x33')]['channel'][_0x295c('0x72')]())+_0x295c('0x75')](_0x2fdc7d[_0x295c('0x33')][_0x295c('0x7b')]);}return null;})[_0x295c('0x2a')](handleEntityNotFound(_0x5d9f99,null))['then'](respondWithStatusCode(_0x5d9f99,null))[_0x295c('0x47')](handleError(_0x5d9f99,null));};exports[_0x295c('0x7c')]=function(_0x517ce2,_0x2956be){var _0x203a99=_[_0x295c('0x7d')](_0x517ce2['body']['ids'])?_0x517ce2[_0x295c('0x54')][_0x295c('0x7b')]:[_0x517ce2[_0x295c('0x54')]['ids']];var _0x4430dc=_0x517ce2['params']['id'];return db[_0x295c('0x2f')][_0x295c('0x4b')]({'where':{'id':_0x4430dc}})[_0x295c('0x2a')](handleEntityNotFound(_0x2956be,null))[_0x295c('0x2a')](function(_0xb01b3f){if(_0xb01b3f){var _0x1fc945=[_0x295c('0x7e'),_0x295c('0x7f'),_0x295c('0x80'),_0x295c('0x81'),_0x295c('0x82'),'Openchannel',_0x295c('0x83')];return db[_0x295c('0x56')][_0x295c('0x84')](function(_0x24976c){var _0x40dc47=_[_0x295c('0x2e')](_0x1fc945,function(_0x5af639){var _0x5075b7={'attributes':['id',_0x295c('0x2d')]};if(_0x5af639===_0x295c('0x7e')){_0x5075b7[_0x295c('0x85')]={'attributes':['penalty']};}return _0xb01b3f[_0x295c('0x4e')+_0x5af639+_0x295c('0x75')](_0x5075b7)[_0x295c('0x2a')](function(_0x39665c){var _0x263d08=_['map'](_0x39665c,function(_0x97c02c){var _0x21498b=_[_0x295c('0x2e')](_0x203a99,function(_0x5793a2){var _0x267710={'where':{'UserId':_0x5793a2,[_0x5af639+_0x295c('0x86')]:_0x97c02c['id']},'transaction':_0x24976c};if(_0x5af639===_0x295c('0x7e')){_0x267710[_0x295c('0x1d')]={'penalty':_0x97c02c['TeamVoiceQueue'][_0x295c('0x87')]};}return db[_0x295c('0x88')+_0x5af639+_0x295c('0x73')][_0x295c('0x89')](_0x267710)['then'](function(){socket[_0x295c('0x8a')](_0x295c('0x4c')+_0x5af639+_0x295c('0x8b'),{'UserId':_0x5793a2,[_0x5af639+'QueueId']:_0x97c02c['id']});if(_0x5af639!==_0x295c('0x7e')){return;}return db['User'][_0x295c('0x8c')]({'where':{'id':_0x203a99,'online':0x1},'attributes':['id',_0x295c('0x2d'),_0x295c('0x8d'),_0x295c('0x8e'),'interface'],'raw':!![]})[_0x295c('0x2a')](function(_0x208390){var _0x33f944=_[_0x295c('0x2e')](_0x208390,function(_0x3ddd62){return db['UserVoiceQueueRt'][_0x295c('0x8f')]({'membername':_0x3ddd62[_0x295c('0x2d')],'UserId':_0x3ddd62['id'],'queue_name':_0x97c02c[_0x295c('0x2d')],'VoiceQueueId':_0x97c02c['id'],'interface':_[_0x295c('0x90')](_0x3ddd62[_0x295c('0x91')])?util[_0x295c('0x92')]('SIP/%s',_0x3ddd62[_0x295c('0x2d')]):_0x3ddd62[_0x295c('0x91')],'paused':_0x3ddd62[_0x295c('0x8e')]||![],'penalty':_0x97c02c[_0x295c('0x93')][_0x295c('0x87')]},{'transaction':_0x24976c});});return Promise[_0x295c('0x94')](_0x33f944);});});});return Promise[_0x295c('0x94')](_0x21498b);});return Promise['all'](_0x263d08);})[_0x295c('0x2a')](function(){return db[_0x295c('0x95')][_0x295c('0x6f')]({'where':{'teamId':_0x4430dc}})[_0x295c('0x2a')](function(_0xb8ad2c){if(_0xb8ad2c){var _0x3ce6f7=_[_0x295c('0x2e')](_0x203a99,function(_0xbd38ed){db[_0x295c('0x69')][_0x295c('0x8f')]({'UserId':_0xbd38ed,'VoicePrefixId':_0xb8ad2c[_0x295c('0x6a')]});});return Promise[_0x295c('0x94')](_0x3ce6f7);}});});});return Promise[_0x295c('0x94')](_0x40dc47)[_0x295c('0x2a')](function(){return _0xb01b3f[_0x295c('0x7c')](_0x203a99,{'transaction':_0x24976c})[_0x295c('0x96')](function(_0x169adf){return _0x169adf;});});});}})[_0x295c('0x2a')](respondWithResult(_0x2956be,null))[_0x295c('0x47')](handleError(_0x2956be,null));};exports[_0x295c('0x97')]=function(_0x6e47ff,_0x624d){var _0x53ea91=_[_0x295c('0x7d')](_0x6e47ff[_0x295c('0x33')][_0x295c('0x7b')])?_0x6e47ff[_0x295c('0x33')][_0x295c('0x7b')]:[_0x6e47ff[_0x295c('0x33')][_0x295c('0x7b')]];var _0x1c475c=_0x6e47ff[_0x295c('0x55')]['id'];return db[_0x295c('0x2f')][_0x295c('0x4b')]({'where':{'id':_0x1c475c}})[_0x295c('0x2a')](handleEntityNotFound(_0x624d,null))[_0x295c('0x2a')](function(_0x31148b){if(_0x31148b){var _0x59ec25=[_0x295c('0x7e'),_0x295c('0x7f'),_0x295c('0x80'),'Sms',_0x295c('0x82'),_0x295c('0x98'),'Whatsapp'];return db[_0x295c('0x56')][_0x295c('0x84')](function(_0x48e697){var _0x3794a4=_[_0x295c('0x2e')](_0x59ec25,function(_0x23d7bc){var _0x50d606={'attributes':['id',_0x295c('0x2d')]};return _0x31148b['get'+_0x23d7bc+_0x295c('0x75')](_0x50d606)[_0x295c('0x2a')](function(_0x28c725){var _0x18a5d0=_[_0x295c('0x2e')](_0x28c725,function(_0x31d40d){return _0x31d40d[_0x295c('0x97')](_0x53ea91,{'transaction':_0x48e697})[_0x295c('0x2a')](function(){var _0xffa52b=_[_0x295c('0x2e')](_0x53ea91,function(_0x5174fb){socket['emit'](_0x295c('0x4c')+_0x23d7bc+_0x295c('0x99'),{'UserId':Number(_0x5174fb),[_0x23d7bc+_0x295c('0x86')]:_0x31d40d['id']});if(_0x23d7bc!==_0x295c('0x7e')){return;}return db['UserVoiceQueueRt'][_0x295c('0x5d')]({'where':{'VoiceQueueId':_0x31d40d['id'],'UserId':_0x5174fb},'transaction':_0x48e697});});return Promise['all'](_0xffa52b);});});return Promise[_0x295c('0x94')](_0x18a5d0);});});return Promise[_0x295c('0x94')](_0x3794a4)[_0x295c('0x2a')](function(){return _0x31148b[_0x295c('0x97')](_0x53ea91,{'transaction':_0x48e697});})['then'](function(){return db[_0x295c('0x95')][_0x295c('0x6f')]({'where':{'teamId':_0x1c475c}})[_0x295c('0x2a')](function(_0x1d8d85){if(_0x1d8d85){var _0x1f6060=_['map'](_0x53ea91,function(_0xfd4027){db[_0x295c('0x69')][_0x295c('0x5d')]({'where':{'UserId':_0xfd4027,'VoicePrefixId':_0x1d8d85[_0x295c('0x6a')]}});});return Promise['all'](_0x1f6060);}});});});}})[_0x295c('0x2a')](respondWithStatusCode(_0x624d,null))[_0x295c('0x47')](handleError(_0x624d,null));};exports['getAgents']=function(_0x55aee4,_0x5667c9,_0x44a950){var _0x1bd98e={};var _0x2ac67f={};var _0x2be3ac;var _0xd8c721;return db[_0x295c('0x2f')][_0x295c('0x6f')]({'where':{'id':_0x55aee4['params']['id']}})[_0x295c('0x2a')](handleEntityNotFound(_0x5667c9,null))[_0x295c('0x2a')](function(_0x35d5c2){if(_0x35d5c2){_0x2be3ac=_0x35d5c2;_0x2ac67f[_0x295c('0x35')]=_[_0x295c('0x49')](db[_0x295c('0x88')]['rawAttributes']);_0x2ac67f[_0x295c('0x33')]=_['keys'](_0x55aee4[_0x295c('0x33')]);_0x2ac67f['filters']=_['intersection'](_0x2ac67f[_0x295c('0x35')],_0x2ac67f[_0x295c('0x33')]);_0x1bd98e[_0x295c('0x36')]=_[_0x295c('0x34')](_0x2ac67f['model'],qs[_0x295c('0x37')](_0x55aee4[_0x295c('0x33')]['fields']));_0x1bd98e[_0x295c('0x36')]=_0x1bd98e['attributes'][_0x295c('0x38')]?_0x1bd98e['attributes']:_0x2ac67f[_0x295c('0x35')];_0x1bd98e['order']=qs[_0x295c('0x3b')](_0x55aee4['query'][_0x295c('0x3b')]);_0x1bd98e[_0x295c('0x3c')]=qs[_0x295c('0x3d')](_['pick'](_0x55aee4['query'],_0x2ac67f[_0x295c('0x3d')]));if(_0x55aee4['query'][_0x295c('0x3f')]){_0x1bd98e[_0x295c('0x3c')]=_[_0x295c('0x40')](_0x1bd98e['where'],{'$or':_[_0x295c('0x2e')](_0x1bd98e[_0x295c('0x36')],function(_0x42b883){var _0x3e7694={};_0x3e7694[_0x42b883]={'$like':'%'+_0x55aee4[_0x295c('0x33')][_0x295c('0x3f')]+'%'};return _0x3e7694;})});}_0x1bd98e=_[_0x295c('0x40')]({},_0x1bd98e,_0x55aee4[_0x295c('0x42')]);return _0x2be3ac[_0x295c('0x9a')](_0x1bd98e);}})[_0x295c('0x2a')](function(_0x5ab414){if(_0x5ab414){_0xd8c721=_0x5ab414['length'];if(!_0x55aee4['query']['hasOwnProperty'](_0x295c('0x9b'))){_0x1bd98e['limit']=qs[_0x295c('0x26')](_0x55aee4[_0x295c('0x33')][_0x295c('0x26')]);_0x1bd98e[_0x295c('0x24')]=qs[_0x295c('0x24')](_0x55aee4['query'][_0x295c('0x24')]);}return _0x2be3ac[_0x295c('0x9a')](_0x1bd98e);}})['then'](function(_0x1e5207){if(_0x1e5207){return _0x1e5207?{'count':_0xd8c721,'rows':_0x1e5207}:null;}})[_0x295c('0x2a')](respondWithResult(_0x5667c9,null))[_0x295c('0x47')](handleError(_0x5667c9,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index d171fcf..bac0643 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 _0xbe10=['setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0xbe10,0x18e));var _0x0be1=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xbe10[_0x11005e];return _0x29338f;};'use strict';var EventEmitter=require(_0x0be1('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x0be1('0x1')](0x0);var events={'afterCreate':_0x0be1('0x2'),'afterUpdate':_0x0be1('0x3'),'afterDestroy':_0x0be1('0x4')};function emitEvent(_0x4c01ef){return function(_0x9e58c9,_0x3d61bc,_0x43fde0){TeamEvents['emit'](_0x4c01ef+':'+_0x9e58c9['id'],_0x9e58c9);TeamEvents[_0x0be1('0x5')](_0x4c01ef,_0x9e58c9);_0x43fde0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x0be1('0x6')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x175f=['../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x175f,0x1ab));var _0xf175=function(_0x5422c7,_0x3f831f){_0x5422c7=_0x5422c7-0x0;var _0x5449bd=_0x175f[_0x5422c7];return _0x5449bd;};'use strict';var EventEmitter=require('events');var Team=require(_0xf175('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xf175('0x1')](0x0);var events={'afterCreate':_0xf175('0x2'),'afterUpdate':'update','afterDestroy':_0xf175('0x3')};function emitEvent(_0x157324){return function(_0x247b31,_0x392fff,_0x2dffdf){TeamEvents[_0xf175('0x4')](_0x157324+':'+_0x247b31['id'],_0x247b31);TeamEvents[_0xf175('0x4')](_0x157324,_0x247b31);_0x2dffdf(null);};}for(var e in events){if(events[_0xf175('0x5')](e)){var event=events[e];Team[_0xf175('0x6')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 0294bc8..4e94884 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 _0x661d=['get','Queues','then','map','setDataValue','channel','exports','define','Team','teams','Chat','Fax','Mail','Voice','Whatsapp','resolve','all','catch','lodash','./team.attributes'];(function(_0x46c32d,_0x270350){var _0x1f692e=function(_0xbe85ad){while(--_0xbe85ad){_0x46c32d['push'](_0x46c32d['shift']());}};_0x1f692e(++_0x270350);}(_0x661d,0x152));var _0xd661=function(_0x545bed,_0x221e96){_0x545bed=_0x545bed-0x0;var _0x16c79c=_0x661d[_0x545bed];return _0x16c79c;};'use strict';var _=require(_0xd661('0x0'));var attributes=require(_0xd661('0x1'));function getQueuesByChannel(_0xbc5ea9,_0x7e6a3){var _0x41164e=_0xd661('0x2')+_0x7e6a3+_0xd661('0x3');return _0xbc5ea9[_0x41164e]()[_0xd661('0x4')](function(_0x3f056f){return _[_0xd661('0x5')](_0x3f056f,function(_0x176c7e){_0x176c7e[_0xd661('0x6')](_0xd661('0x7'),_0x7e6a3);return _0x176c7e;});})['catch'](function(_0x3af8a8){throw _0x3af8a8;});}module[_0xd661('0x8')]=function(_0x2dccf3){return _0x2dccf3[_0xd661('0x9')](_0xd661('0xa'),attributes,{'tableName':_0xd661('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x4c6518=this;var _0x34d410=[_0xd661('0xc'),_0xd661('0xd'),_0xd661('0xe'),'Openchannel','Sms',_0xd661('0xf'),_0xd661('0x10')];return Promise[_0xd661('0x11')]()[_0xd661('0x4')](function(){var _0x27fd28=_['map'](_0x34d410,function(_0x13117b){return getQueuesByChannel(_0x4c6518,_0x13117b);});return Promise[_0xd661('0x12')](_0x27fd28);})[_0xd661('0x13')](function(_0x324a64){throw _0x324a64;});}}});}; \ No newline at end of file +var _0x8390=['get','Queues','map','setDataValue','channel','catch','exports','define','Team','teams','Fax','Mail','Sms','Whatsapp','resolve','all','./team.attributes'];(function(_0x51dae4,_0xa7f367){var _0x27d0b0=function(_0x5575d1){while(--_0x5575d1){_0x51dae4['push'](_0x51dae4['shift']());}};_0x27d0b0(++_0xa7f367);}(_0x8390,0xba));var _0x0839=function(_0x12a554,_0x3d7ef8){_0x12a554=_0x12a554-0x0;var _0x244ba0=_0x8390[_0x12a554];return _0x244ba0;};'use strict';var _=require('lodash');var attributes=require(_0x0839('0x0'));function getQueuesByChannel(_0x3c2103,_0x2cfcdf){var _0x3edc0e=_0x0839('0x1')+_0x2cfcdf+_0x0839('0x2');return _0x3c2103[_0x3edc0e]()['then'](function(_0x43ac94){return _[_0x0839('0x3')](_0x43ac94,function(_0x540a44){_0x540a44[_0x0839('0x4')](_0x0839('0x5'),_0x2cfcdf);return _0x540a44;});})[_0x0839('0x6')](function(_0x2068d0){throw _0x2068d0;});}module[_0x0839('0x7')]=function(_0x22b61d){return _0x22b61d[_0x0839('0x8')](_0x0839('0x9'),attributes,{'tableName':_0x0839('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x2ed8d7=this;var _0x1cd47c=['Chat',_0x0839('0xb'),_0x0839('0xc'),'Openchannel',_0x0839('0xd'),'Voice',_0x0839('0xe')];return Promise[_0x0839('0xf')]()['then'](function(){var _0x2d433e=_[_0x0839('0x3')](_0x1cd47c,function(_0x49fa6f){return getQueuesByChannel(_0x2ed8d7,_0x49fa6f);});return Promise[_0x0839('0x10')](_0x2d433e);})['catch'](function(_0x54c640){throw _0x54c640;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 77224a8..2e31a1f 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 _0x955d=['info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./team.socket','register','request','then'];(function(_0x44d797,_0x276017){var _0x4005c2=function(_0x3d3b5b){while(--_0x3d3b5b){_0x44d797['push'](_0x44d797['shift']());}};_0x4005c2(++_0x276017);}(_0x955d,0x1a9));var _0xd955=function(_0x4c88a7,_0x2a0567){_0x4c88a7=_0x4c88a7-0x0;var _0x1750bd=_0x955d[_0x4c88a7];return _0x1750bd;};'use strict';var _=require(_0xd955('0x0'));var util=require(_0xd955('0x1'));var moment=require(_0xd955('0x2'));var BPromise=require('bluebird');var rs=require(_0xd955('0x3'));var fs=require('fs');var Redis=require(_0xd955('0x4'));var db=require(_0xd955('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd955('0x6'))(_0xd955('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd955('0x8')][_0xd955('0x9')]({'port':0x232a});config[_0xd955('0xa')]=_[_0xd955('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd955('0xc'))(new Redis(config['redis']));require(_0xd955('0xd'))[_0xd955('0xe')](socket);function respondWithRpcPromise(_0x20a265,_0x58ee3d,_0x5a0e20){return new BPromise(function(_0x573bc2,_0x4b6c78){return client[_0xd955('0xf')](_0x20a265,_0x5a0e20)[_0xd955('0x10')](function(_0x3ef269){logger[_0xd955('0x11')](_0xd955('0x12'),_0x58ee3d,_0xd955('0x13'));logger[_0xd955('0x14')](_0xd955('0x15'),_0x58ee3d,'request\x20sent',JSON['stringify'](_0x3ef269));if(_0x3ef269['error']){if(_0x3ef269[_0xd955('0x16')]['code']===0x1f4){logger[_0xd955('0x16')](_0xd955('0x12'),_0x58ee3d,_0x3ef269[_0xd955('0x16')][_0xd955('0x17')]);return _0x4b6c78(_0x3ef269[_0xd955('0x16')]['message']);}logger['error'](_0xd955('0x12'),_0x58ee3d,_0x3ef269['error'][_0xd955('0x17')]);return _0x573bc2(_0x3ef269[_0xd955('0x16')]['message']);}else{logger[_0xd955('0x11')](_0xd955('0x12'),_0x58ee3d,_0xd955('0x13'));_0x573bc2(_0x3ef269[_0xd955('0x18')]['message']);}})[_0xd955('0x19')](function(_0x16dc2e){logger[_0xd955('0x16')](_0xd955('0x12'),_0x58ee3d,_0x16dc2e);_0x4b6c78(_0x16dc2e);});});} \ No newline at end of file +var _0x371c=['client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x15e051,_0x1b608d){var _0x3c1a38=function(_0x31db8b){while(--_0x31db8b){_0x15e051['push'](_0x15e051['shift']());}};_0x3c1a38(++_0x1b608d);}(_0x371c,0x1dd));var _0xc371=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x371c[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xc371('0x0'));var util=require('util');var moment=require(_0xc371('0x1'));var BPromise=require(_0xc371('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc371('0x3'));var db=require(_0xc371('0x4'))['db'];var utils=require(_0xc371('0x5'));var logger=require(_0xc371('0x6'))('rpc');var config=require(_0xc371('0x7'));var jayson=require(_0xc371('0x8'));var client=jayson[_0xc371('0x9')][_0xc371('0xa')]({'port':0x232a});config[_0xc371('0xb')]=_[_0xc371('0xc')](config[_0xc371('0xb')],{'host':_0xc371('0xd'),'port':0x18eb});var socket=require(_0xc371('0xe'))(new Redis(config['redis']));require(_0xc371('0xf'))[_0xc371('0x10')](socket);function respondWithRpcPromise(_0x126984,_0x2c7f97,_0xf5c59f){return new BPromise(function(_0x532f96,_0x4eae1a){return client[_0xc371('0x11')](_0x126984,_0xf5c59f)[_0xc371('0x12')](function(_0x34a255){logger[_0xc371('0x13')](_0xc371('0x14'),_0x2c7f97,'request\x20sent');logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x2c7f97,'request\x20sent',JSON['stringify'](_0x34a255));if(_0x34a255[_0xc371('0x15')]){if(_0x34a255[_0xc371('0x15')][_0xc371('0x16')]===0x1f4){logger[_0xc371('0x15')]('Team,\x20%s,\x20%s',_0x2c7f97,_0x34a255[_0xc371('0x15')]['message']);return _0x4eae1a(_0x34a255[_0xc371('0x15')][_0xc371('0x17')]);}logger[_0xc371('0x15')](_0xc371('0x14'),_0x2c7f97,_0x34a255[_0xc371('0x15')][_0xc371('0x17')]);return _0x532f96(_0x34a255[_0xc371('0x15')][_0xc371('0x17')]);}else{logger[_0xc371('0x13')]('Team,\x20%s,\x20%s',_0x2c7f97,_0xc371('0x18'));_0x532f96(_0x34a255[_0xc371('0x19')][_0xc371('0x17')]);}})[_0xc371('0x1a')](function(_0x2deecb){logger['error']('Team,\x20%s,\x20%s',_0x2c7f97,_0x2deecb);_0x4eae1a(_0x2deecb);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 20f8932..0480bfa 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 _0x9519=['remove','removeListener','register','length','team:','./team.events','save'];(function(_0x5c87c7,_0x3e5db2){var _0x2672a9=function(_0x228e28){while(--_0x228e28){_0x5c87c7['push'](_0x5c87c7['shift']());}};_0x2672a9(++_0x3e5db2);}(_0x9519,0x147));var _0x9951=function(_0x348704,_0x5bfc0a){_0x348704=_0x348704-0x0;var _0x86bc11=_0x9519[_0x348704];return _0x86bc11;};'use strict';var TeamEvents=require(_0x9951('0x0'));var events=[_0x9951('0x1'),_0x9951('0x2'),'update'];function createListener(_0x279b99,_0x300720){return function(_0x1bd1f7){_0x300720['emit'](_0x279b99,_0x1bd1f7);};}function removeListener(_0x300f2f,_0x5d38bf){return function(){TeamEvents[_0x9951('0x3')](_0x300f2f,_0x5d38bf);};}exports[_0x9951('0x4')]=function(_0x3addcc){for(var _0x333492=0x0,_0x399a4c=events[_0x9951('0x5')];_0x333492<_0x399a4c;_0x333492++){var _0x18693d=events[_0x333492];var _0x366e14=createListener(_0x9951('0x6')+_0x18693d,_0x3addcc);TeamEvents['on'](_0x18693d,_0x366e14);}}; \ No newline at end of file +var _0x2fe3=['save','removeListener','length','./team.events'];(function(_0xfdfebc,_0x4091a7){var _0x4c043d=function(_0x594a8a){while(--_0x594a8a){_0xfdfebc['push'](_0xfdfebc['shift']());}};_0x4c043d(++_0x4091a7);}(_0x2fe3,0x87));var _0x32fe=function(_0x1d45b8,_0x5e1428){_0x1d45b8=_0x1d45b8-0x0;var _0x1671cf=_0x2fe3[_0x1d45b8];return _0x1671cf;};'use strict';var TeamEvents=require(_0x32fe('0x0'));var events=[_0x32fe('0x1'),'remove','update'];function createListener(_0x3abab5,_0x5528c3){return function(_0x2f85c0){_0x5528c3['emit'](_0x3abab5,_0x2f85c0);};}function removeListener(_0x4ddeb7,_0x2724bd){return function(){TeamEvents[_0x32fe('0x2')](_0x4ddeb7,_0x2724bd);};}exports['register']=function(_0x6605ec){for(var _0x89aed1=0x0,_0x314bc1=events[_0x32fe('0x3')];_0x89aed1<_0x314bc1;_0x89aed1++){var _0x5bfbca=events[_0x89aed1];var _0x20171a=createListener('team:'+_0x5bfbca,_0x6605ec);TeamEvents['on'](_0x5bfbca,_0x20171a);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 6a0e2a8..e1c433f 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 _0xe3c8=['INTEGER','sequelize','exports'];(function(_0x67b3d5,_0x44f9ae){var _0x44a51b=function(_0x4a9ee2){while(--_0x4a9ee2){_0x67b3d5['push'](_0x67b3d5['shift']());}};_0x44a51b(++_0x44f9ae);}(_0xe3c8,0x145));var _0x8e3c=function(_0x68198d,_0x161f85){_0x68198d=_0x68198d-0x0;var _0x5e1daa=_0xe3c8[_0x68198d];return _0x5e1daa;};'use strict';var Sequelize=require(_0x8e3c('0x0'));module[_0x8e3c('0x1')]={'TeamId':{'type':Sequelize[_0x8e3c('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x8e3c('0x2')]}}; \ No newline at end of file +var _0xe4ec=['exports','INTEGER'];(function(_0x565e4c,_0x24c0ff){var _0x5d4f7c=function(_0x486bb1){while(--_0x486bb1){_0x565e4c['push'](_0x565e4c['shift']());}};_0x5d4f7c(++_0x24c0ff);}(_0xe4ec,0x11c));var _0xce4e=function(_0x161e35,_0x55a892){_0x161e35=_0x161e35-0x0;var _0x347059=_0xe4ec[_0x161e35];return _0x347059;};'use strict';var Sequelize=require('sequelize');module[_0xce4e('0x0')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xce4e('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 4ac7564..49d178f 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 _0x0a6b=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x0a6b,0x120));var _0xb0a6=function(_0x2cca6e,_0x5c4d19){_0x2cca6e=_0x2cca6e-0x0;var _0x3ddfb5=_0x0a6b[_0x2cca6e];return _0x3ddfb5;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var logger=require(_0xb0a6('0x1'))(_0xb0a6('0x2'));var moment=require(_0xb0a6('0x3'));var BPromise=require(_0xb0a6('0x4'));var rp=require(_0xb0a6('0x5'));var fs=require('fs');var path=require(_0xb0a6('0x6'));var rimraf=require(_0xb0a6('0x7'));var config=require(_0xb0a6('0x8'));var attributes=require(_0xb0a6('0x9'));module[_0xb0a6('0xa')]=function(_0x4b47bc,_0x30b3b7){return _0x4b47bc['define'](_0xb0a6('0xb'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdfb=['TeamVoicePrefix','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x53c814,_0x488977){var _0x2e13db=function(_0x3b52a2){while(--_0x3b52a2){_0x53c814['push'](_0x53c814['shift']());}};_0x2e13db(++_0x488977);}(_0xbdfb,0x1ef));var _0xbbdf=function(_0x51e79c,_0x51485e){_0x51e79c=_0x51e79c-0x0;var _0x2467be=_0xbdfb[_0x51e79c];return _0x2467be;};'use strict';var _=require(_0xbbdf('0x0'));var util=require(_0xbbdf('0x1'));var logger=require(_0xbbdf('0x2'))(_0xbbdf('0x3'));var moment=require(_0xbbdf('0x4'));var BPromise=require(_0xbbdf('0x5'));var rp=require(_0xbbdf('0x6'));var fs=require('fs');var path=require(_0xbbdf('0x7'));var rimraf=require(_0xbbdf('0x8'));var config=require(_0xbbdf('0x9'));var attributes=require('./teamVoicePrefix.attributes');module[_0xbbdf('0xa')]=function(_0x3184ff,_0x54d048){return _0x3184ff[_0xbbdf('0xb')](_0xbbdf('0xc'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 11348cf..5419107 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3b2c21,_0x48c213){var _0x372936=function(_0x570c3c){while(--_0x570c3c){_0x3b2c21['push'](_0x3b2c21['shift']());}};_0x372936(++_0x48c213);}(_0x70e0,0x17b));var _0x070e=function(_0x299159,_0x338d80){_0x299159=_0x299159-0x0;var _0x287d7c=_0x70e0[_0x299159];return _0x287d7c;};'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(_0x1ba1e0,_0x450b33){var _0x4eda35=function(_0x5d381c){while(--_0x5d381c){_0x1ba1e0['push'](_0x1ba1e0['shift']());}};_0x4eda35(++_0x450b33);}(_0xedd9,0xfc));var _0x9edd=function(_0x17cc31,_0x33c0a5){_0x17cc31=_0x17cc31-0x0;var _0x273211=_0xedd9[_0x17cc31];return _0x273211;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 2556ecb..58f187b 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 _0xf3ff=['sequelize','INTEGER'];(function(_0x203c68,_0x7497d3){var _0x112d8f=function(_0x5e5339){while(--_0x5e5339){_0x203c68['push'](_0x203c68['shift']());}};_0x112d8f(++_0x7497d3);}(_0xf3ff,0xae));var _0xff3f=function(_0x46d062,_0x4edd5d){_0x46d062=_0x46d062-0x0;var _0x47b968=_0xf3ff[_0x46d062];return _0x47b968;};'use strict';var Sequelize=require(_0xff3f('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xff3f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x714a=['exports'];(function(_0x2a723f,_0x10426d){var _0x59414c=function(_0x5b2d10){while(--_0x5b2d10){_0x2a723f['push'](_0x2a723f['shift']());}};_0x59414c(++_0x10426d);}(_0x714a,0xd8));var _0xa714=function(_0x100d8b,_0x3a2ab4){_0x100d8b=_0x100d8b-0x0;var _0x5c612b=_0x714a[_0x100d8b];return _0x5c612b;};'use strict';var Sequelize=require('sequelize');module[_0xa714('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'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 5afe275..3a17a1f 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 _0xa4fb=['lodash','util','../../config/logger','api','request-promise','path','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues'];(function(_0xd7b6fc,_0x1c02c8){var _0x3fc920=function(_0x3b9a47){while(--_0x3b9a47){_0xd7b6fc['push'](_0xd7b6fc['shift']());}};_0x3fc920(++_0x1c02c8);}(_0xa4fb,0x150));var _0xba4f=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa4fb[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0xba4f('0x0'));var util=require(_0xba4f('0x1'));var logger=require(_0xba4f('0x2'))(_0xba4f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xba4f('0x4'));var fs=require('fs');var path=require(_0xba4f('0x5'));var rimraf=require(_0xba4f('0x6'));var config=require('../../config/environment');var attributes=require(_0xba4f('0x7'));module[_0xba4f('0x8')]=function(_0x379b0f,_0x18baa8){return _0x379b0f[_0xba4f('0x9')](_0xba4f('0xa'),attributes,{'tableName':_0xba4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34f8=['../../config/logger','api','moment','path','rimraf','./teamVoiceQueue.attributes','exports','team_has_voice_queues','lodash','util'];(function(_0x5b1130,_0x7b86db){var _0x4bb0c8=function(_0x1361ed){while(--_0x1361ed){_0x5b1130['push'](_0x5b1130['shift']());}};_0x4bb0c8(++_0x7b86db);}(_0x34f8,0x80));var _0x834f=function(_0x14b0ed,_0x4534aa){_0x14b0ed=_0x14b0ed-0x0;var _0x82083c=_0x34f8[_0x14b0ed];return _0x82083c;};'use strict';var _=require(_0x834f('0x0'));var util=require(_0x834f('0x1'));var logger=require(_0x834f('0x2'))(_0x834f('0x3'));var moment=require(_0x834f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x834f('0x5'));var rimraf=require(_0x834f('0x6'));var config=require('../../config/environment');var attributes=require(_0x834f('0x7'));module[_0x834f('0x8')]=function(_0x9e052f,_0x3498dd){return _0x9e052f['define']('TeamVoiceQueue',attributes,{'tableName':_0x834f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 9ddaf60..76f2ebb 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 _0xafe6=['result','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','code','error','message'];(function(_0x118a88,_0x166f95){var _0x5a5ae7=function(_0x180b2d){while(--_0x180b2d){_0x118a88['push'](_0x118a88['shift']());}};_0x5a5ae7(++_0x166f95);}(_0xafe6,0xac));var _0x6afe=function(_0xb464d8,_0x558a10){_0xb464d8=_0xb464d8-0x0;var _0xa202a2=_0xafe6[_0xb464d8];return _0xa202a2;};'use strict';var _=require(_0x6afe('0x0'));var util=require(_0x6afe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6afe('0x2'));var fs=require('fs');var Redis=require(_0x6afe('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6afe('0x4'))(_0x6afe('0x5'));var config=require(_0x6afe('0x6'));var jayson=require(_0x6afe('0x7'));var client=jayson[_0x6afe('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x302747,_0x2fb2c9,_0x59badb){return new BPromise(function(_0x1d3c11,_0x4c4c6f){return client[_0x6afe('0x9')](_0x302747,_0x59badb)[_0x6afe('0xa')](function(_0xd7ebad){logger[_0x6afe('0xb')](_0x6afe('0xc'),_0x2fb2c9,_0x6afe('0xd'));logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x2fb2c9,_0x6afe('0xd'),JSON[_0x6afe('0xe')](_0xd7ebad));if(_0xd7ebad['error']){if(_0xd7ebad['error'][_0x6afe('0xf')]===0x1f4){logger[_0x6afe('0x10')](_0x6afe('0xc'),_0x2fb2c9,_0xd7ebad[_0x6afe('0x10')][_0x6afe('0x11')]);return _0x4c4c6f(_0xd7ebad[_0x6afe('0x10')][_0x6afe('0x11')]);}logger['error'](_0x6afe('0xc'),_0x2fb2c9,_0xd7ebad[_0x6afe('0x10')][_0x6afe('0x11')]);return _0x1d3c11(_0xd7ebad[_0x6afe('0x10')][_0x6afe('0x11')]);}else{logger[_0x6afe('0xb')](_0x6afe('0xc'),_0x2fb2c9,'request\x20sent');_0x1d3c11(_0xd7ebad[_0x6afe('0x12')]['message']);}})['catch'](function(_0x4296c7){logger[_0x6afe('0x10')](_0x6afe('0xc'),_0x2fb2c9,_0x4296c7);_0x4c4c6f(_0x4296c7);});});} \ No newline at end of file +var _0x3c7b=['lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','client','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x412e27,_0x20a978){var _0x53da42=function(_0x43cae5){while(--_0x43cae5){_0x412e27['push'](_0x412e27['shift']());}};_0x53da42(++_0x20a978);}(_0x3c7b,0x11d));var _0xb3c7=function(_0xb3e3cf,_0x50dc84){_0xb3e3cf=_0xb3e3cf-0x0;var _0x2718ff=_0x3c7b[_0xb3e3cf];return _0x2718ff;};'use strict';var _=require(_0xb3c7('0x0'));var util=require(_0xb3c7('0x1'));var moment=require(_0xb3c7('0x2'));var BPromise=require(_0xb3c7('0x3'));var rs=require(_0xb3c7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb3c7('0x5'));var config=require(_0xb3c7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb3c7('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x255f3d,_0x3e9d10,_0x341a27){return new BPromise(function(_0x1851a5,_0x46e843){return client['request'](_0x255f3d,_0x341a27)[_0xb3c7('0x8')](function(_0x56a13b){logger[_0xb3c7('0x9')](_0xb3c7('0xa'),_0x3e9d10,_0xb3c7('0xb'));logger[_0xb3c7('0xc')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3e9d10,_0xb3c7('0xb'),JSON[_0xb3c7('0xd')](_0x56a13b));if(_0x56a13b['error']){if(_0x56a13b[_0xb3c7('0xe')][_0xb3c7('0xf')]===0x1f4){logger[_0xb3c7('0xe')](_0xb3c7('0xa'),_0x3e9d10,_0x56a13b[_0xb3c7('0xe')][_0xb3c7('0x10')]);return _0x46e843(_0x56a13b[_0xb3c7('0xe')]['message']);}logger[_0xb3c7('0xe')](_0xb3c7('0xa'),_0x3e9d10,_0x56a13b['error'][_0xb3c7('0x10')]);return _0x1851a5(_0x56a13b[_0xb3c7('0xe')][_0xb3c7('0x10')]);}else{logger[_0xb3c7('0x9')](_0xb3c7('0xa'),_0x3e9d10,_0xb3c7('0xb'));_0x1851a5(_0x56a13b[_0xb3c7('0x11')][_0xb3c7('0x10')]);}})[_0xb3c7('0x12')](function(_0x10f8d4){logger[_0xb3c7('0xe')](_0xb3c7('0xa'),_0x3e9d10,_0x10f8d4);_0x46e843(_0x10f8d4);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 42fbfac..e74c992 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 _0x84c6=['index','/:id','show','create','update','delete','destroy','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x84c6,0xe7));var _0x684c=function(_0x5984ef,_0x33c1ba){_0x5984ef=_0x5984ef-0x0;var _0x85db6a=_0x84c6[_0x5984ef];return _0x85db6a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x684c('0x0'));var timeout=require(_0x684c('0x1'));var express=require(_0x684c('0x2'));var router=express['Router']();var fs_extra=require(_0x684c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x684c('0x4'));var config=require(_0x684c('0x5'));var controller=require(_0x684c('0x6'));router[_0x684c('0x7')]('/',auth[_0x684c('0x8')](),controller[_0x684c('0x9')]);router[_0x684c('0x7')](_0x684c('0xa'),auth[_0x684c('0x8')](),controller[_0x684c('0xb')]);router['post']('/',auth[_0x684c('0x8')](),controller[_0x684c('0xc')]);router['put'](_0x684c('0xa'),auth['isAuthenticated'](),controller[_0x684c('0xd')]);router[_0x684c('0xe')](_0x684c('0xa'),auth[_0x684c('0x8')](),controller[_0x684c('0xf')]);module['exports']=router; \ No newline at end of file +var _0xdfb1=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','show','post','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x1553d5,_0x37672c){_0x1553d5=_0x1553d5-0x0;var _0x27bdc6=_0xdfb1[_0x1553d5];return _0x27bdc6;};'use strict';var multer=require(_0x1dfb('0x0'));var util=require(_0x1dfb('0x1'));var path=require(_0x1dfb('0x2'));var timeout=require(_0x1dfb('0x3'));var express=require('express');var router=express[_0x1dfb('0x4')]();var fs_extra=require(_0x1dfb('0x5'));var auth=require(_0x1dfb('0x6'));var interaction=require(_0x1dfb('0x7'));var config=require('../../config/environment');var controller=require('./template.controller');router['get']('/',auth[_0x1dfb('0x8')](),controller[_0x1dfb('0x9')]);router[_0x1dfb('0xa')]('/:id',auth[_0x1dfb('0x8')](),controller[_0x1dfb('0xb')]);router[_0x1dfb('0xc')]('/',auth[_0x1dfb('0x8')](),controller['create']);router[_0x1dfb('0xd')](_0x1dfb('0xe'),auth[_0x1dfb('0x8')](),controller['update']);router[_0x1dfb('0xf')](_0x1dfb('0xe'),auth[_0x1dfb('0x8')](),controller[_0x1dfb('0x10')]);module[_0x1dfb('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 6b46d16..8c64859 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 _0x29d9=['exports','STRING','TEXT','sequelize'];(function(_0x124f7a,_0x47f5df){var _0xd237f4=function(_0x3e9237){while(--_0x3e9237){_0x124f7a['push'](_0x124f7a['shift']());}};_0xd237f4(++_0x47f5df);}(_0x29d9,0x18f));var _0x929d=function(_0x3727a9,_0x1c2edb){_0x3727a9=_0x3727a9-0x0;var _0xa16806=_0x29d9[_0x3727a9];return _0xa16806;};'use strict';var Sequelize=require(_0x929d('0x0'));module[_0x929d('0x1')]={'name':{'type':Sequelize[_0x929d('0x2')]},'description':{'type':Sequelize[_0x929d('0x2')]},'html':{'type':Sequelize[_0x929d('0x3')]}}; \ No newline at end of file +var _0xa8a0=['sequelize','exports','STRING','TEXT'];(function(_0x4c6f60,_0x3073c8){var _0x48d664=function(_0x9249ed){while(--_0x9249ed){_0x4c6f60['push'](_0x4c6f60['shift']());}};_0x48d664(++_0x3073c8);}(_0xa8a0,0x170));var _0x0a8a=function(_0xac8245,_0x537438){_0xac8245=_0xac8245-0x0;var _0x4f1f9b=_0xa8a0[_0xac8245];return _0x4f1f9b;};'use strict';var Sequelize=require(_0x0a8a('0x0'));module[_0x0a8a('0x1')]={'name':{'type':Sequelize[_0x0a8a('0x2')]},'description':{'type':Sequelize[_0x0a8a('0x2')]},'html':{'type':Sequelize[_0x0a8a('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index fd516c7..bfae1c6 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 _0x3a30=['Template','fieldName','type','key','model','query','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','fields','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map'];(function(_0x187d88,_0xfedab5){var _0x2c3002=function(_0x575d93){while(--_0x575d93){_0x187d88['push'](_0x187d88['shift']());}};_0x2c3002(++_0xfedab5);}(_0x3a30,0xd2));var _0x03a3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3a30[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x03a3('0x0'));var rimraf=require(_0x03a3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x03a3('0x2'));var rp=require(_0x03a3('0x3'));var moment=require(_0x03a3('0x4'));var BPromise=require(_0x03a3('0x5'));var Mustache=require(_0x03a3('0x6'));var util=require(_0x03a3('0x7'));var path=require(_0x03a3('0x8'));var sox=require(_0x03a3('0x9'));var csv=require(_0x03a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x03a3('0xb'));var _=require(_0x03a3('0xc'));var squel=require(_0x03a3('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x03a3('0xe'));var toCsv=require(_0x03a3('0xa'));var querystring=require(_0x03a3('0xf'));var Papa=require(_0x03a3('0x10'));var Redis=require(_0x03a3('0x11'));var authService=require(_0x03a3('0x12'));var qs=require(_0x03a3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x03a3('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x03a3('0x15'));var licenseUtil=require(_0x03a3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a1743,_0x48b824){_0x48b824=_0x48b824||0xcc;return function(_0x160cb0){if(_0x160cb0){return _0x3a1743['sendStatus'](_0x48b824);}return _0x3a1743['status'](_0x48b824)[_0x03a3('0x17')]();};}function respondWithResult(_0x1a8c8b,_0x7b7ba){_0x7b7ba=_0x7b7ba||0xc8;return function(_0x460003){if(_0x460003){return _0x1a8c8b[_0x03a3('0x18')](_0x7b7ba)[_0x03a3('0x19')](_0x460003);}};}function respondWithFilteredResult(_0x2fb354,_0x2c217c){return function(_0x39890a){if(_0x39890a){var _0x12550d=typeof _0x2c217c[_0x03a3('0x1a')]===_0x03a3('0x1b')&&typeof _0x2c217c[_0x03a3('0x1c')]===_0x03a3('0x1b');var _0x34ff29=_0x39890a[_0x03a3('0x1d')];var _0x4e8334=_0x12550d?0x0:_0x2c217c[_0x03a3('0x1a')];var _0x5218b9=_0x12550d?_0x39890a[_0x03a3('0x1d')]:_0x2c217c['offset']+_0x2c217c[_0x03a3('0x1c')];var _0x4bcfe0;if(_0x5218b9>=_0x34ff29){_0x5218b9=_0x34ff29;_0x4bcfe0=0xc8;}else{_0x4bcfe0=0xce;}_0x2fb354[_0x03a3('0x18')](_0x4bcfe0);return _0x2fb354[_0x03a3('0x1e')](_0x03a3('0x1f'),_0x4e8334+'-'+_0x5218b9+'/'+_0x34ff29)[_0x03a3('0x19')](_0x39890a);}return null;};}function patchUpdates(_0x1c2b53){return function(_0x4e7124){try{jsonpatch['apply'](_0x4e7124,_0x1c2b53,!![]);}catch(_0x414dd0){return BPromise[_0x03a3('0x20')](_0x414dd0);}return _0x4e7124[_0x03a3('0x21')]();};}function saveUpdates(_0x44ed57,_0x25568f){return function(_0x5a8d57){if(_0x5a8d57){return _0x5a8d57[_0x03a3('0x22')](_0x44ed57)[_0x03a3('0x23')](function(_0x30e78b){return _0x30e78b;});}return null;};}function removeEntity(_0x34928b,_0x22754a){return function(_0x6f7239){if(_0x6f7239){return _0x6f7239[_0x03a3('0x24')]()[_0x03a3('0x23')](function(){var _0x3da087=_0x6f7239[_0x03a3('0x25')]({'plain':!![]});var _0x8819a8='Templates';return db[_0x03a3('0x26')][_0x03a3('0x24')]({'where':{'type':_0x8819a8,'resourceId':_0x3da087['id']}})['then'](function(){return _0x6f7239;});})[_0x03a3('0x23')](function(){_0x34928b[_0x03a3('0x18')](0xcc)[_0x03a3('0x17')]();});}};}function handleEntityNotFound(_0x5593b8,_0x384b01){return function(_0x33f075){if(!_0x33f075){_0x5593b8['sendStatus'](0x194);}return _0x33f075;};}function handleError(_0x2c7866,_0x341f9f){_0x341f9f=_0x341f9f||0x1f4;return function(_0x3393b9){logger[_0x03a3('0x27')](_0x3393b9[_0x03a3('0x28')]);if(_0x3393b9[_0x03a3('0x29')]){delete _0x3393b9[_0x03a3('0x29')];}_0x2c7866[_0x03a3('0x18')](_0x341f9f)[_0x03a3('0x2a')](_0x3393b9);};}exports[_0x03a3('0x2b')]=function(_0x9a514f,_0x2a2efc){var _0x4c9243={},_0x442244={},_0x43a45b={'count':0x0,'rows':[]};var _0x2ddf88=_[_0x03a3('0x2c')](db[_0x03a3('0x2d')]['rawAttributes'],function(_0x13b24e){return{'name':_0x13b24e[_0x03a3('0x2e')],'type':_0x13b24e[_0x03a3('0x2f')][_0x03a3('0x30')]};});_0x442244[_0x03a3('0x31')]=_['map'](_0x2ddf88,_0x03a3('0x29'));_0x442244[_0x03a3('0x32')]=_['keys'](_0x9a514f['query']);_0x442244[_0x03a3('0x33')]=_['intersection'](_0x442244['model'],_0x442244[_0x03a3('0x32')]);_0x4c9243[_0x03a3('0x34')]=_['intersection'](_0x442244[_0x03a3('0x31')],qs['fields'](_0x9a514f[_0x03a3('0x32')]['fields']));_0x4c9243[_0x03a3('0x34')]=_0x4c9243['attributes'][_0x03a3('0x35')]?_0x4c9243['attributes']:_0x442244[_0x03a3('0x31')];if(!_0x9a514f['query'][_0x03a3('0x36')](_0x03a3('0x37'))){_0x4c9243['limit']=qs[_0x03a3('0x1c')](_0x9a514f[_0x03a3('0x32')][_0x03a3('0x1c')]);_0x4c9243[_0x03a3('0x1a')]=qs[_0x03a3('0x1a')](_0x9a514f[_0x03a3('0x32')][_0x03a3('0x1a')]);}_0x4c9243[_0x03a3('0x38')]=qs['sort'](_0x9a514f[_0x03a3('0x32')][_0x03a3('0x39')]);_0x4c9243[_0x03a3('0x3a')]=qs['filters'](_[_0x03a3('0x3b')](_0x9a514f[_0x03a3('0x32')],_0x442244[_0x03a3('0x33')]),_0x2ddf88);if(_0x9a514f[_0x03a3('0x32')][_0x03a3('0x3c')]){_0x4c9243[_0x03a3('0x3a')]=_[_0x03a3('0x3d')](_0x4c9243[_0x03a3('0x3a')],{'$or':_[_0x03a3('0x2c')](_0x2ddf88,function(_0x2d04c9){if(_0x2d04c9['type']!==_0x03a3('0x3e')){var _0x14d7db={};_0x14d7db[_0x2d04c9[_0x03a3('0x29')]]={'$like':'%'+_0x9a514f[_0x03a3('0x32')][_0x03a3('0x3c')]+'%'};return _0x14d7db;}})});}_0x4c9243=_[_0x03a3('0x3d')]({},_0x4c9243,_0x9a514f['options']);var _0x42b253={'where':_0x4c9243[_0x03a3('0x3a')]};return db[_0x03a3('0x2d')][_0x03a3('0x1d')](_0x42b253)[_0x03a3('0x23')](function(_0x3fd598){_0x43a45b['count']=_0x3fd598;if(_0x9a514f['query'][_0x03a3('0x3f')]){_0x4c9243[_0x03a3('0x40')]=[{'all':!![]}];}return db['Template'][_0x03a3('0x41')](_0x4c9243);})[_0x03a3('0x23')](function(_0x3389cf){_0x43a45b[_0x03a3('0x42')]=_0x3389cf;return _0x43a45b;})[_0x03a3('0x23')](respondWithFilteredResult(_0x2a2efc,_0x4c9243))[_0x03a3('0x43')](handleError(_0x2a2efc,null));};exports[_0x03a3('0x44')]=function(_0x26a800,_0x2169e8){var _0x2545c6={'raw':!![],'where':{'id':_0x26a800[_0x03a3('0x45')]['id']}},_0x3fd77a={};_0x3fd77a[_0x03a3('0x31')]=_[_0x03a3('0x46')](db[_0x03a3('0x2d')][_0x03a3('0x47')]);_0x3fd77a['query']=_[_0x03a3('0x46')](_0x26a800['query']);_0x3fd77a['filters']=_[_0x03a3('0x48')](_0x3fd77a[_0x03a3('0x31')],_0x3fd77a[_0x03a3('0x32')]);_0x2545c6['attributes']=_[_0x03a3('0x48')](_0x3fd77a[_0x03a3('0x31')],qs[_0x03a3('0x49')](_0x26a800['query'][_0x03a3('0x49')]));_0x2545c6[_0x03a3('0x34')]=_0x2545c6[_0x03a3('0x34')]['length']?_0x2545c6['attributes']:_0x3fd77a[_0x03a3('0x31')];if(_0x26a800[_0x03a3('0x32')][_0x03a3('0x3f')]){_0x2545c6[_0x03a3('0x40')]=[{'all':!![]}];}_0x2545c6=_[_0x03a3('0x3d')]({},_0x2545c6,_0x26a800[_0x03a3('0x4a')]);return db[_0x03a3('0x2d')][_0x03a3('0x4b')](_0x2545c6)['then'](handleEntityNotFound(_0x2169e8,null))[_0x03a3('0x23')](respondWithResult(_0x2169e8,null))[_0x03a3('0x43')](handleError(_0x2169e8,null));};exports[_0x03a3('0x4c')]=function(_0x38a07b,_0x21fe0a){return db['Template'][_0x03a3('0x4c')](_0x38a07b['body'],{})[_0x03a3('0x23')](function(_0x280ff9){var _0x100867=_0x38a07b[_0x03a3('0x4d')]['get']({'plain':!![]});if(!_0x100867)throw new Error(_0x03a3('0x4e'));if(_0x100867[_0x03a3('0x4f')]==='user'){var _0x167389=_0x280ff9[_0x03a3('0x25')]({'plain':!![]});var _0x30091b=_0x03a3('0x50');return db[_0x03a3('0x51')]['find']({'where':{'name':_0x30091b,'userProfileId':_0x100867['userProfileId']},'raw':!![]})[_0x03a3('0x23')](function(_0x5ababa){if(_0x5ababa&&_0x5ababa[_0x03a3('0x52')]===0x0){return db[_0x03a3('0x26')][_0x03a3('0x4c')]({'name':_0x167389[_0x03a3('0x29')],'resourceId':_0x167389['id'],'type':_0x5ababa[_0x03a3('0x29')],'sectionId':_0x5ababa['id']},{})[_0x03a3('0x23')](function(){return _0x280ff9;});}else{return _0x280ff9;}})[_0x03a3('0x43')](function(_0x323fab){logger['error'](_0x03a3('0x53'),_0x323fab);throw _0x323fab;});}return _0x280ff9;})[_0x03a3('0x23')](respondWithResult(_0x21fe0a,0xc9))[_0x03a3('0x43')](handleError(_0x21fe0a,null));};exports[_0x03a3('0x22')]=function(_0x2d2640,_0x5531c0){if(_0x2d2640[_0x03a3('0x54')]['id']){delete _0x2d2640[_0x03a3('0x54')]['id'];}return db[_0x03a3('0x2d')]['find']({'where':{'id':_0x2d2640['params']['id']}})[_0x03a3('0x23')](handleEntityNotFound(_0x5531c0,null))[_0x03a3('0x23')](saveUpdates(_0x2d2640[_0x03a3('0x54')],null))['then'](respondWithResult(_0x5531c0,null))['catch'](handleError(_0x5531c0,null));};exports[_0x03a3('0x24')]=function(_0x32e532,_0x313082){return db[_0x03a3('0x2d')]['find']({'where':{'id':_0x32e532[_0x03a3('0x45')]['id']}})[_0x03a3('0x23')](handleEntityNotFound(_0x313082,null))[_0x03a3('0x23')](removeEntity(_0x313082,null))[_0x03a3('0x43')](handleError(_0x313082,null));}; \ No newline at end of file +var _0xacd9=['undefined','count','set','save','update','then','destroy','Templates','UserProfileResource','error','stack','name','send','map','Template','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','options','rows','catch','show','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit'];(function(_0x20f613,_0x4f4944){var _0x34ae8b=function(_0x32367f){while(--_0x32367f){_0x20f613['push'](_0x20f613['shift']());}};_0x34ae8b(++_0x4f4944);}(_0xacd9,0x81));var _0x9acd=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xacd9[_0x32d457];return _0x338386;};'use strict';var emlformat=require(_0x9acd('0x0'));var rimraf=require(_0x9acd('0x1'));var zipdir=require(_0x9acd('0x2'));var jsonpatch=require(_0x9acd('0x3'));var rp=require(_0x9acd('0x4'));var moment=require(_0x9acd('0x5'));var BPromise=require(_0x9acd('0x6'));var Mustache=require(_0x9acd('0x7'));var util=require(_0x9acd('0x8'));var path=require(_0x9acd('0x9'));var sox=require(_0x9acd('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9acd('0xb'));var _=require(_0x9acd('0xc'));var squel=require('squel');var crypto=require(_0x9acd('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9acd('0xe'));var toCsv=require(_0x9acd('0xf'));var querystring=require(_0x9acd('0x10'));var Papa=require('papaparse');var Redis=require(_0x9acd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9acd('0x12'));var as=require(_0x9acd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9acd('0x14'))(_0x9acd('0x15'));var utils=require(_0x9acd('0x16'));var config=require(_0x9acd('0x17'));var licenseUtil=require(_0x9acd('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30bcd4,_0x270a80){_0x270a80=_0x270a80||0xcc;return function(_0x353b02){if(_0x353b02){return _0x30bcd4[_0x9acd('0x19')](_0x270a80);}return _0x30bcd4['status'](_0x270a80)[_0x9acd('0x1a')]();};}function respondWithResult(_0xf81d7,_0x454974){_0x454974=_0x454974||0xc8;return function(_0x7608b6){if(_0x7608b6){return _0xf81d7[_0x9acd('0x1b')](_0x454974)[_0x9acd('0x1c')](_0x7608b6);}};}function respondWithFilteredResult(_0x5a974b,_0x13e9e7){return function(_0x1766f4){if(_0x1766f4){var _0x53c7b1=typeof _0x13e9e7[_0x9acd('0x1d')]==='undefined'&&typeof _0x13e9e7[_0x9acd('0x1e')]===_0x9acd('0x1f');var _0x1b01db=_0x1766f4[_0x9acd('0x20')];var _0x163057=_0x53c7b1?0x0:_0x13e9e7[_0x9acd('0x1d')];var _0x328b9e=_0x53c7b1?_0x1766f4['count']:_0x13e9e7[_0x9acd('0x1d')]+_0x13e9e7['limit'];var _0x2121fb;if(_0x328b9e>=_0x1b01db){_0x328b9e=_0x1b01db;_0x2121fb=0xc8;}else{_0x2121fb=0xce;}_0x5a974b['status'](_0x2121fb);return _0x5a974b[_0x9acd('0x21')]('Content-Range',_0x163057+'-'+_0x328b9e+'/'+_0x1b01db)[_0x9acd('0x1c')](_0x1766f4);}return null;};}function patchUpdates(_0x2e5ba5){return function(_0x5c26e2){try{jsonpatch['apply'](_0x5c26e2,_0x2e5ba5,!![]);}catch(_0x8dc92b){return BPromise['reject'](_0x8dc92b);}return _0x5c26e2[_0x9acd('0x22')]();};}function saveUpdates(_0x4cf3af,_0x3434c7){return function(_0x33cef2){if(_0x33cef2){return _0x33cef2[_0x9acd('0x23')](_0x4cf3af)[_0x9acd('0x24')](function(_0x15ec05){return _0x15ec05;});}return null;};}function removeEntity(_0x73bf5e,_0x4c2b26){return function(_0x4aa1b6){if(_0x4aa1b6){return _0x4aa1b6[_0x9acd('0x25')]()[_0x9acd('0x24')](function(){var _0x144617=_0x4aa1b6['get']({'plain':!![]});var _0x327568=_0x9acd('0x26');return db[_0x9acd('0x27')][_0x9acd('0x25')]({'where':{'type':_0x327568,'resourceId':_0x144617['id']}})[_0x9acd('0x24')](function(){return _0x4aa1b6;});})[_0x9acd('0x24')](function(){_0x73bf5e[_0x9acd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30ba32,_0x293c0f){return function(_0x4f104c){if(!_0x4f104c){_0x30ba32[_0x9acd('0x19')](0x194);}return _0x4f104c;};}function handleError(_0x4a6e4e,_0x5f205a){_0x5f205a=_0x5f205a||0x1f4;return function(_0x55f0a0){logger[_0x9acd('0x28')](_0x55f0a0[_0x9acd('0x29')]);if(_0x55f0a0[_0x9acd('0x2a')]){delete _0x55f0a0[_0x9acd('0x2a')];}_0x4a6e4e[_0x9acd('0x1b')](_0x5f205a)[_0x9acd('0x2b')](_0x55f0a0);};}exports['index']=function(_0x45f391,_0x41e091){var _0x4e5853={},_0x162bc0={},_0x550c18={'count':0x0,'rows':[]};var _0xd98540=_[_0x9acd('0x2c')](db[_0x9acd('0x2d')]['rawAttributes'],function(_0x338e14){return{'name':_0x338e14[_0x9acd('0x2e')],'type':_0x338e14[_0x9acd('0x2f')][_0x9acd('0x30')]};});_0x162bc0[_0x9acd('0x31')]=_[_0x9acd('0x2c')](_0xd98540,_0x9acd('0x2a'));_0x162bc0[_0x9acd('0x32')]=_[_0x9acd('0x33')](_0x45f391[_0x9acd('0x32')]);_0x162bc0[_0x9acd('0x34')]=_[_0x9acd('0x35')](_0x162bc0[_0x9acd('0x31')],_0x162bc0[_0x9acd('0x32')]);_0x4e5853[_0x9acd('0x36')]=_[_0x9acd('0x35')](_0x162bc0[_0x9acd('0x31')],qs[_0x9acd('0x37')](_0x45f391[_0x9acd('0x32')][_0x9acd('0x37')]));_0x4e5853['attributes']=_0x4e5853['attributes'][_0x9acd('0x38')]?_0x4e5853['attributes']:_0x162bc0['model'];if(!_0x45f391[_0x9acd('0x32')][_0x9acd('0x39')](_0x9acd('0x3a'))){_0x4e5853[_0x9acd('0x1e')]=qs['limit'](_0x45f391['query'][_0x9acd('0x1e')]);_0x4e5853[_0x9acd('0x1d')]=qs[_0x9acd('0x1d')](_0x45f391[_0x9acd('0x32')][_0x9acd('0x1d')]);}_0x4e5853['order']=qs[_0x9acd('0x3b')](_0x45f391[_0x9acd('0x32')][_0x9acd('0x3b')]);_0x4e5853[_0x9acd('0x3c')]=qs[_0x9acd('0x34')](_[_0x9acd('0x3d')](_0x45f391[_0x9acd('0x32')],_0x162bc0[_0x9acd('0x34')]),_0xd98540);if(_0x45f391[_0x9acd('0x32')]['filter']){_0x4e5853[_0x9acd('0x3c')]=_['merge'](_0x4e5853[_0x9acd('0x3c')],{'$or':_[_0x9acd('0x2c')](_0xd98540,function(_0x525502){if(_0x525502[_0x9acd('0x2f')]!==_0x9acd('0x3e')){var _0x14be82={};_0x14be82[_0x525502[_0x9acd('0x2a')]]={'$like':'%'+_0x45f391[_0x9acd('0x32')]['filter']+'%'};return _0x14be82;}})});}_0x4e5853=_['merge']({},_0x4e5853,_0x45f391[_0x9acd('0x3f')]);var _0x298d36={'where':_0x4e5853[_0x9acd('0x3c')]};return db[_0x9acd('0x2d')][_0x9acd('0x20')](_0x298d36)[_0x9acd('0x24')](function(_0x4a132c){_0x550c18[_0x9acd('0x20')]=_0x4a132c;if(_0x45f391['query']['includeAll']){_0x4e5853['include']=[{'all':!![]}];}return db[_0x9acd('0x2d')]['findAll'](_0x4e5853);})['then'](function(_0x4956fd){_0x550c18[_0x9acd('0x40')]=_0x4956fd;return _0x550c18;})[_0x9acd('0x24')](respondWithFilteredResult(_0x41e091,_0x4e5853))[_0x9acd('0x41')](handleError(_0x41e091,null));};exports[_0x9acd('0x42')]=function(_0x1da51f,_0x32f05f){var _0x121801={'raw':!![],'where':{'id':_0x1da51f['params']['id']}},_0x251607={};_0x251607[_0x9acd('0x31')]=_['keys'](db[_0x9acd('0x2d')][_0x9acd('0x43')]);_0x251607[_0x9acd('0x32')]=_['keys'](_0x1da51f['query']);_0x251607[_0x9acd('0x34')]=_['intersection'](_0x251607['model'],_0x251607[_0x9acd('0x32')]);_0x121801[_0x9acd('0x36')]=_['intersection'](_0x251607[_0x9acd('0x31')],qs[_0x9acd('0x37')](_0x1da51f[_0x9acd('0x32')]['fields']));_0x121801[_0x9acd('0x36')]=_0x121801[_0x9acd('0x36')][_0x9acd('0x38')]?_0x121801[_0x9acd('0x36')]:_0x251607[_0x9acd('0x31')];if(_0x1da51f['query'][_0x9acd('0x44')]){_0x121801['include']=[{'all':!![]}];}_0x121801=_['merge']({},_0x121801,_0x1da51f[_0x9acd('0x3f')]);return db[_0x9acd('0x2d')][_0x9acd('0x45')](_0x121801)[_0x9acd('0x24')](handleEntityNotFound(_0x32f05f,null))['then'](respondWithResult(_0x32f05f,null))[_0x9acd('0x41')](handleError(_0x32f05f,null));};exports[_0x9acd('0x46')]=function(_0x44beb1,_0x134fc9){return db[_0x9acd('0x2d')][_0x9acd('0x46')](_0x44beb1[_0x9acd('0x47')],{})[_0x9acd('0x24')](function(_0x54c64a){var _0x46f4e0=_0x44beb1[_0x9acd('0x48')]['get']({'plain':!![]});if(!_0x46f4e0)throw new Error(_0x9acd('0x49'));if(_0x46f4e0[_0x9acd('0x4a')]===_0x9acd('0x48')){var _0x55b596=_0x54c64a['get']({'plain':!![]});var _0xf38bc1=_0x9acd('0x26');return db[_0x9acd('0x4b')][_0x9acd('0x45')]({'where':{'name':_0xf38bc1,'userProfileId':_0x46f4e0[_0x9acd('0x4c')]},'raw':!![]})['then'](function(_0x7f192a){if(_0x7f192a&&_0x7f192a[_0x9acd('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x55b596[_0x9acd('0x2a')],'resourceId':_0x55b596['id'],'type':_0x7f192a[_0x9acd('0x2a')],'sectionId':_0x7f192a['id']},{})[_0x9acd('0x24')](function(){return _0x54c64a;});}else{return _0x54c64a;}})[_0x9acd('0x41')](function(_0x196fd4){logger[_0x9acd('0x28')](_0x9acd('0x4e'),_0x196fd4);throw _0x196fd4;});}return _0x54c64a;})[_0x9acd('0x24')](respondWithResult(_0x134fc9,0xc9))[_0x9acd('0x41')](handleError(_0x134fc9,null));};exports['update']=function(_0x5be4f5,_0x441be3){if(_0x5be4f5[_0x9acd('0x47')]['id']){delete _0x5be4f5[_0x9acd('0x47')]['id'];}return db[_0x9acd('0x2d')][_0x9acd('0x45')]({'where':{'id':_0x5be4f5[_0x9acd('0x4f')]['id']}})[_0x9acd('0x24')](handleEntityNotFound(_0x441be3,null))[_0x9acd('0x24')](saveUpdates(_0x5be4f5['body'],null))[_0x9acd('0x24')](respondWithResult(_0x441be3,null))[_0x9acd('0x41')](handleError(_0x441be3,null));};exports[_0x9acd('0x25')]=function(_0x4668aa,_0x48b906){return db[_0x9acd('0x2d')][_0x9acd('0x45')]({'where':{'id':_0x4668aa['params']['id']}})[_0x9acd('0x24')](handleEntityNotFound(_0x48b906,null))[_0x9acd('0x24')](removeEntity(_0x48b906,null))['catch'](handleError(_0x48b906,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 79cbea0..919c3b2 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 _0x58b7=['rimraf','../../config/environment','./template.attributes','exports','define','Template','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x221465,_0x1b1449){var _0x2b6078=function(_0x5348a6){while(--_0x5348a6){_0x221465['push'](_0x221465['shift']());}};_0x2b6078(++_0x1b1449);}(_0x58b7,0x199));var _0x758b=function(_0x19a282,_0x5b51d2){_0x19a282=_0x19a282-0x0;var _0x444190=_0x58b7[_0x19a282];return _0x444190;};'use strict';var _=require(_0x758b('0x0'));var util=require(_0x758b('0x1'));var logger=require(_0x758b('0x2'))(_0x758b('0x3'));var moment=require(_0x758b('0x4'));var BPromise=require('bluebird');var rp=require(_0x758b('0x5'));var fs=require('fs');var path=require(_0x758b('0x6'));var rimraf=require(_0x758b('0x7'));var config=require(_0x758b('0x8'));var attributes=require(_0x758b('0x9'));module[_0x758b('0xa')]=function(_0x333e6e,_0xc7af2){return _0x333e6e[_0x758b('0xb')](_0x758b('0xc'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe73d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Template','tools_templates'];(function(_0x2242b5,_0x52464a){var _0x4028ca=function(_0x3b8545){while(--_0x3b8545){_0x2242b5['push'](_0x2242b5['shift']());}};_0x4028ca(++_0x52464a);}(_0xe73d,0x1ba));var _0xde73=function(_0x4b8e65,_0x4cdfb1){_0x4b8e65=_0x4b8e65-0x0;var _0x7e47cf=_0xe73d[_0x4b8e65];return _0x7e47cf;};'use strict';var _=require('lodash');var util=require(_0xde73('0x0'));var logger=require(_0xde73('0x1'))(_0xde73('0x2'));var moment=require(_0xde73('0x3'));var BPromise=require(_0xde73('0x4'));var rp=require(_0xde73('0x5'));var fs=require('fs');var path=require(_0xde73('0x6'));var rimraf=require(_0xde73('0x7'));var config=require(_0xde73('0x8'));var attributes=require('./template.attributes');module[_0xde73('0x9')]=function(_0xfe8ebd,_0x5352e1){return _0xfe8ebd[_0xde73('0xa')](_0xde73('0xb'),attributes,{'tableName':_0xde73('0xc'),'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 e77b158..8ed7010 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 _0xba77=['where','limit','include','map','attributes','model','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTemplate','Template','findAll','options'];(function(_0xdf788a,_0x285778){var _0xe5ee5a=function(_0x299aef){while(--_0x299aef){_0xdf788a['push'](_0xdf788a['shift']());}};_0xe5ee5a(++_0x285778);}(_0xba77,0x171));var _0x7ba7=function(_0xf363f0,_0x3b5eeb){_0xf363f0=_0xf363f0-0x0;var _0x55a386=_0xba77[_0xf363f0];return _0x55a386;};'use strict';var _=require(_0x7ba7('0x0'));var util=require(_0x7ba7('0x1'));var moment=require('moment');var BPromise=require(_0x7ba7('0x2'));var rs=require(_0x7ba7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ba7('0x4'))['db'];var utils=require(_0x7ba7('0x5'));var logger=require('../../config/logger')(_0x7ba7('0x6'));var config=require('../../config/environment');var jayson=require(_0x7ba7('0x7'));var client=jayson[_0x7ba7('0x8')][_0x7ba7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4dc68e,_0x28e14f,_0x3d05c9){return new BPromise(function(_0xf8d053,_0x30fba5){return client[_0x7ba7('0xa')](_0x4dc68e,_0x3d05c9)[_0x7ba7('0xb')](function(_0x269d15){logger['info'](_0x7ba7('0xc'),_0x28e14f,_0x7ba7('0xd'));logger[_0x7ba7('0xe')](_0x7ba7('0xf'),_0x28e14f,_0x7ba7('0xd'),JSON[_0x7ba7('0x10')](_0x269d15));if(_0x269d15[_0x7ba7('0x11')]){if(_0x269d15[_0x7ba7('0x11')][_0x7ba7('0x12')]===0x1f4){logger[_0x7ba7('0x11')]('Template,\x20%s,\x20%s',_0x28e14f,_0x269d15[_0x7ba7('0x11')][_0x7ba7('0x13')]);return _0x30fba5(_0x269d15[_0x7ba7('0x11')]['message']);}logger['error'](_0x7ba7('0xc'),_0x28e14f,_0x269d15['error'][_0x7ba7('0x13')]);return _0xf8d053(_0x269d15[_0x7ba7('0x11')][_0x7ba7('0x13')]);}else{logger[_0x7ba7('0x14')]('Template,\x20%s,\x20%s',_0x28e14f,_0x7ba7('0xd'));_0xf8d053(_0x269d15[_0x7ba7('0x15')][_0x7ba7('0x13')]);}})[_0x7ba7('0x16')](function(_0x5d10a1){logger[_0x7ba7('0x11')]('Template,\x20%s,\x20%s',_0x28e14f,_0x5d10a1);_0x30fba5(_0x5d10a1);});});}exports[_0x7ba7('0x17')]=function(_0x5769b2){var _0x591081=this;return new Promise(function(_0x4d1630,_0xaf5181){return db[_0x7ba7('0x18')][_0x7ba7('0x19')]({'raw':_0x5769b2[_0x7ba7('0x1a')]?_0x5769b2[_0x7ba7('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5769b2[_0x7ba7('0x1a')]?_0x5769b2[_0x7ba7('0x1a')][_0x7ba7('0x1b')]||null:null,'attributes':_0x5769b2[_0x7ba7('0x1a')]?_0x5769b2['options']['attributes']||null:null,'limit':_0x5769b2[_0x7ba7('0x1a')]?_0x5769b2[_0x7ba7('0x1a')][_0x7ba7('0x1c')]||null:null,'include':_0x5769b2[_0x7ba7('0x1a')]?_0x5769b2[_0x7ba7('0x1a')][_0x7ba7('0x1d')]?_[_0x7ba7('0x1e')](_0x5769b2[_0x7ba7('0x1a')]['include'],function(_0x3a678f){return{'model':db[_0x3a678f['model']],'as':_0x3a678f['as'],'attributes':_0x3a678f[_0x7ba7('0x1f')],'include':_0x3a678f['include']?_[_0x7ba7('0x1e')](_0x3a678f[_0x7ba7('0x1d')],function(_0x1dbfbc){return{'model':db[_0x1dbfbc[_0x7ba7('0x20')]],'as':_0x1dbfbc['as'],'attributes':_0x1dbfbc[_0x7ba7('0x1f')],'include':_0x1dbfbc[_0x7ba7('0x1d')]?_[_0x7ba7('0x1e')](_0x1dbfbc['include'],function(_0x57318c){return{'model':db[_0x57318c['model']],'as':_0x57318c['as'],'attributes':_0x57318c[_0x7ba7('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7ba7('0xb')](function(_0x762f7f){logger[_0x7ba7('0x14')](_0x7ba7('0x17'),_0x5769b2);logger[_0x7ba7('0xe')]('GetTemplate',_0x5769b2,JSON[_0x7ba7('0x10')](_0x762f7f));_0x4d1630(_0x762f7f);})[_0x7ba7('0x16')](function(_0x3572e5){logger[_0x7ba7('0x11')](_0x7ba7('0x17'),_0x3572e5[_0x7ba7('0x13')],_0x5769b2);_0xaf5181(_0x591081[_0x7ba7('0x11')](0x1f4,_0x3572e5[_0x7ba7('0x13')]));});});}; \ No newline at end of file +var _0xf544=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetTemplate','options','raw','where','attributes','limit','include','map','model','lodash','moment'];(function(_0x323a8a,_0x4cf6b6){var _0x1789d7=function(_0x4953f6){while(--_0x4953f6){_0x323a8a['push'](_0x323a8a['shift']());}};_0x1789d7(++_0x4cf6b6);}(_0xf544,0x99));var _0x4f54=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xf544[_0x44946b];return _0x249bc4;};'use strict';var _=require(_0x4f54('0x0'));var util=require('util');var moment=require(_0x4f54('0x1'));var BPromise=require(_0x4f54('0x2'));var rs=require(_0x4f54('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f54('0x4'))['db'];var utils=require(_0x4f54('0x5'));var logger=require(_0x4f54('0x6'))(_0x4f54('0x7'));var config=require(_0x4f54('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4f54('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a0630,_0x2fd179,_0x128f2e){return new BPromise(function(_0x24d805,_0x3e935b){return client[_0x4f54('0xa')](_0x1a0630,_0x128f2e)[_0x4f54('0xb')](function(_0x1fd26c){logger[_0x4f54('0xc')](_0x4f54('0xd'),_0x2fd179,_0x4f54('0xe'));logger[_0x4f54('0xf')]('Template,\x20%s,\x20%s,\x20%s',_0x2fd179,_0x4f54('0xe'),JSON[_0x4f54('0x10')](_0x1fd26c));if(_0x1fd26c[_0x4f54('0x11')]){if(_0x1fd26c[_0x4f54('0x11')][_0x4f54('0x12')]===0x1f4){logger[_0x4f54('0x11')](_0x4f54('0xd'),_0x2fd179,_0x1fd26c[_0x4f54('0x11')]['message']);return _0x3e935b(_0x1fd26c['error'][_0x4f54('0x13')]);}logger[_0x4f54('0x11')](_0x4f54('0xd'),_0x2fd179,_0x1fd26c[_0x4f54('0x11')]['message']);return _0x24d805(_0x1fd26c['error'][_0x4f54('0x13')]);}else{logger[_0x4f54('0xc')]('Template,\x20%s,\x20%s',_0x2fd179,_0x4f54('0xe'));_0x24d805(_0x1fd26c[_0x4f54('0x14')][_0x4f54('0x13')]);}})[_0x4f54('0x15')](function(_0x268008){logger[_0x4f54('0x11')](_0x4f54('0xd'),_0x2fd179,_0x268008);_0x3e935b(_0x268008);});});}exports[_0x4f54('0x16')]=function(_0x8e59ea){var _0x33df70=this;return new Promise(function(_0x3046bd,_0x418620){return db['Template']['findAll']({'raw':_0x8e59ea[_0x4f54('0x17')]?_0x8e59ea['options'][_0x4f54('0x18')]===undefined?!![]:![]:!![],'where':_0x8e59ea[_0x4f54('0x17')]?_0x8e59ea[_0x4f54('0x17')][_0x4f54('0x19')]||null:null,'attributes':_0x8e59ea[_0x4f54('0x17')]?_0x8e59ea['options'][_0x4f54('0x1a')]||null:null,'limit':_0x8e59ea[_0x4f54('0x17')]?_0x8e59ea[_0x4f54('0x17')][_0x4f54('0x1b')]||null:null,'include':_0x8e59ea[_0x4f54('0x17')]?_0x8e59ea[_0x4f54('0x17')][_0x4f54('0x1c')]?_[_0x4f54('0x1d')](_0x8e59ea[_0x4f54('0x17')][_0x4f54('0x1c')],function(_0x54d200){return{'model':db[_0x54d200[_0x4f54('0x1e')]],'as':_0x54d200['as'],'attributes':_0x54d200['attributes'],'include':_0x54d200['include']?_[_0x4f54('0x1d')](_0x54d200[_0x4f54('0x1c')],function(_0x243897){return{'model':db[_0x243897['model']],'as':_0x243897['as'],'attributes':_0x243897[_0x4f54('0x1a')],'include':_0x243897['include']?_[_0x4f54('0x1d')](_0x243897[_0x4f54('0x1c')],function(_0xa26bf6){return{'model':db[_0xa26bf6['model']],'as':_0xa26bf6['as'],'attributes':_0xa26bf6[_0x4f54('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44fe2d){logger[_0x4f54('0xc')]('GetTemplate',_0x8e59ea);logger['debug']('GetTemplate',_0x8e59ea,JSON[_0x4f54('0x10')](_0x44fe2d));_0x3046bd(_0x44fe2d);})['catch'](function(_0x333379){logger[_0x4f54('0x11')](_0x4f54('0x16'),_0x333379[_0x4f54('0x13')],_0x8e59ea);_0x418620(_0x33df70['error'](0x1f4,_0x333379['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 2082ed9..56e80ed 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 _0x884b=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','create','post','addAllCondition','addAnyCondition','put','update','delete','destroy','exports'];(function(_0xb1174e,_0x1e68a7){var _0x285bac=function(_0x32c505){while(--_0x32c505){_0xb1174e['push'](_0xb1174e['shift']());}};_0x285bac(++_0x1e68a7);}(_0x884b,0x195));var _0xb884=function(_0x4fc80b,_0xfe1b3d){_0x4fc80b=_0x4fc80b-0x0;var _0x119dba=_0x884b[_0x4fc80b];return _0x119dba;};'use strict';var multer=require(_0xb884('0x0'));var util=require(_0xb884('0x1'));var path=require('path');var timeout=require(_0xb884('0x2'));var express=require(_0xb884('0x3'));var router=express[_0xb884('0x4')]();var fs_extra=require(_0xb884('0x5'));var auth=require(_0xb884('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb884('0x7'));var controller=require(_0xb884('0x8'));router[_0xb884('0x9')]('/',auth['isAuthenticated'](),controller[_0xb884('0xa')]);router[_0xb884('0x9')](_0xb884('0xb'),auth[_0xb884('0xc')](),controller['show']);router[_0xb884('0x9')](_0xb884('0xd'),auth[_0xb884('0xc')](),controller[_0xb884('0xe')]);router[_0xb884('0x9')](_0xb884('0xf'),auth['isAuthenticated'](),controller['getAnyConditions']);router[_0xb884('0x9')](_0xb884('0x10'),auth[_0xb884('0xc')](),controller[_0xb884('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb884('0x12')]);router[_0xb884('0x13')](_0xb884('0xd'),auth[_0xb884('0xc')](),controller[_0xb884('0x14')]);router[_0xb884('0x13')](_0xb884('0xf'),auth[_0xb884('0xc')](),controller[_0xb884('0x15')]);router[_0xb884('0x13')](_0xb884('0x10'),auth['isAuthenticated'](),controller['addAction']);router[_0xb884('0x16')](_0xb884('0xb'),auth[_0xb884('0xc')](),controller[_0xb884('0x17')]);router[_0xb884('0x18')](_0xb884('0xb'),auth[_0xb884('0xc')](),controller[_0xb884('0x19')]);module[_0xb884('0x1a')]=router; \ No newline at end of file +var _0x9997=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','util','path','connect-timeout','Router'];(function(_0x22ad5c,_0x3b346b){var _0x3d1500=function(_0x4b883d){while(--_0x4b883d){_0x22ad5c['push'](_0x22ad5c['shift']());}};_0x3d1500(++_0x3b346b);}(_0x9997,0xf8));var _0x7999=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0x9997[_0x1bfe2b];return _0x1477d4;};'use strict';var multer=require('multer');var util=require(_0x7999('0x0'));var path=require(_0x7999('0x1'));var timeout=require(_0x7999('0x2'));var express=require('express');var router=express[_0x7999('0x3')]();var fs_extra=require(_0x7999('0x4'));var auth=require(_0x7999('0x5'));var interaction=require(_0x7999('0x6'));var config=require(_0x7999('0x7'));var controller=require(_0x7999('0x8'));router[_0x7999('0x9')]('/',auth['isAuthenticated'](),controller[_0x7999('0xa')]);router['get'](_0x7999('0xb'),auth[_0x7999('0xc')](),controller[_0x7999('0xd')]);router[_0x7999('0x9')](_0x7999('0xe'),auth['isAuthenticated'](),controller[_0x7999('0xf')]);router[_0x7999('0x9')]('/:id/any_conditions',auth[_0x7999('0xc')](),controller[_0x7999('0x10')]);router['get'](_0x7999('0x11'),auth[_0x7999('0xc')](),controller[_0x7999('0x12')]);router[_0x7999('0x13')]('/',auth[_0x7999('0xc')](),controller[_0x7999('0x14')]);router[_0x7999('0x13')](_0x7999('0xe'),auth[_0x7999('0xc')](),controller[_0x7999('0x15')]);router[_0x7999('0x13')]('/:id/any_conditions',auth[_0x7999('0xc')](),controller[_0x7999('0x16')]);router[_0x7999('0x13')]('/:id/actions',auth[_0x7999('0xc')](),controller[_0x7999('0x17')]);router[_0x7999('0x18')](_0x7999('0xb'),auth[_0x7999('0xc')](),controller[_0x7999('0x19')]);router[_0x7999('0x1a')](_0x7999('0xb'),auth[_0x7999('0xc')](),controller[_0x7999('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 52f08b3..0ea1db9 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 _0xe9f2=['STRING','BOOLEAN','exports'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xe9f2,0xfb));var _0x2e9f=function(_0x48768c,_0x313931){_0x48768c=_0x48768c-0x0;var _0x7f0c1a=_0xe9f2[_0x48768c];return _0x7f0c1a;};'use strict';var Sequelize=require('sequelize');module[_0x2e9f('0x0')]={'name':{'type':Sequelize[_0x2e9f('0x1')]},'channel':{'type':Sequelize[_0x2e9f('0x1')]},'description':{'type':Sequelize[_0x2e9f('0x1')]},'status':{'type':Sequelize[_0x2e9f('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x82f5=['BOOLEAN','exports','STRING'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0x82f5,0x151));var _0x582f=function(_0x59574f,_0x43315f){_0x59574f=_0x59574f-0x0;var _0x46bbea=_0x82f5[_0x59574f];return _0x46bbea;};'use strict';var Sequelize=require('sequelize');module[_0x582f('0x0')]={'name':{'type':Sequelize[_0x582f('0x1')]},'channel':{'type':Sequelize[_0x582f('0x1')]},'description':{'type':Sequelize[_0x582f('0x1')]},'status':{'type':Sequelize[_0x582f('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 a504a0c..d640fd5 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 _0xfa61=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','getAnyConditions','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','Triggers','UserProfileResource','end','sendStatus','error','stack','name','index','Trigger','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','catch','show','params','rawAttributes','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId'];(function(_0x28a59c,_0x37bd9f){var _0x14cbba=function(_0x4624eb){while(--_0x4624eb){_0x28a59c['push'](_0x28a59c['shift']());}};_0x14cbba(++_0x37bd9f);}(_0xfa61,0xc9));var _0x1fa6=function(_0x16f92a,_0x447724){_0x16f92a=_0x16f92a-0x0;var _0x2907b7=_0xfa61[_0x16f92a];return _0x2907b7;};'use strict';var emlformat=require(_0x1fa6('0x0'));var rimraf=require(_0x1fa6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1fa6('0x2'));var rp=require(_0x1fa6('0x3'));var moment=require(_0x1fa6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1fa6('0x5'));var util=require(_0x1fa6('0x6'));var path=require(_0x1fa6('0x7'));var sox=require(_0x1fa6('0x8'));var csv=require(_0x1fa6('0x9'));var ejs=require(_0x1fa6('0xa'));var fs=require('fs');var fs_extra=require(_0x1fa6('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1fa6('0xc'));var deskjs=require(_0x1fa6('0xd'));var toCsv=require(_0x1fa6('0x9'));var querystring=require(_0x1fa6('0xe'));var Papa=require(_0x1fa6('0xf'));var Redis=require(_0x1fa6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1fa6('0x11'));var as=require(_0x1fa6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1fa6('0x13'));var utils=require(_0x1fa6('0x14'));var config=require(_0x1fa6('0x15'));var licenseUtil=require(_0x1fa6('0x16'));var db=require(_0x1fa6('0x17'))['db'];function respondWithStatusCode(_0x4c22ac,_0x499c34){_0x499c34=_0x499c34||0xcc;return function(_0x589bd6){if(_0x589bd6){return _0x4c22ac['sendStatus'](_0x499c34);}return _0x4c22ac[_0x1fa6('0x18')](_0x499c34)['end']();};}function respondWithResult(_0x27115b,_0x2ffdca){_0x2ffdca=_0x2ffdca||0xc8;return function(_0x3fbf0a){if(_0x3fbf0a){return _0x27115b[_0x1fa6('0x18')](_0x2ffdca)[_0x1fa6('0x19')](_0x3fbf0a);}};}function respondWithFilteredResult(_0x194654,_0x2ab673){return function(_0x1f7e4e){if(_0x1f7e4e){var _0x42a5b2=typeof _0x2ab673[_0x1fa6('0x1a')]===_0x1fa6('0x1b')&&typeof _0x2ab673[_0x1fa6('0x1c')]===_0x1fa6('0x1b');var _0x2504de=_0x1f7e4e[_0x1fa6('0x1d')];var _0x275105=_0x42a5b2?0x0:_0x2ab673[_0x1fa6('0x1a')];var _0x28bebc=_0x42a5b2?_0x1f7e4e['count']:_0x2ab673[_0x1fa6('0x1a')]+_0x2ab673[_0x1fa6('0x1c')];var _0x1c3dc7;if(_0x28bebc>=_0x2504de){_0x28bebc=_0x2504de;_0x1c3dc7=0xc8;}else{_0x1c3dc7=0xce;}_0x194654[_0x1fa6('0x18')](_0x1c3dc7);return _0x194654[_0x1fa6('0x1e')](_0x1fa6('0x1f'),_0x275105+'-'+_0x28bebc+'/'+_0x2504de)['json'](_0x1f7e4e);}return null;};}function patchUpdates(_0x3d513e){return function(_0x2b068f){try{jsonpatch[_0x1fa6('0x20')](_0x2b068f,_0x3d513e,!![]);}catch(_0xc0f97c){return BPromise[_0x1fa6('0x21')](_0xc0f97c);}return _0x2b068f['save']();};}function saveUpdates(_0x3e57e2,_0x131842){return function(_0x471980){if(_0x471980){return _0x471980[_0x1fa6('0x22')](_0x3e57e2)[_0x1fa6('0x23')](function(_0x592fd1){return _0x592fd1;});}return null;};}function removeEntity(_0x42944e,_0x144ea0){return function(_0x23c79d){if(_0x23c79d){return _0x23c79d[_0x1fa6('0x24')]()[_0x1fa6('0x23')](function(){var _0x359469=_0x23c79d['get']({'plain':!![]});var _0x396fe1=_0x1fa6('0x25');return db[_0x1fa6('0x26')][_0x1fa6('0x24')]({'where':{'type':_0x396fe1,'resourceId':_0x359469['id']}})[_0x1fa6('0x23')](function(){return _0x23c79d;});})[_0x1fa6('0x23')](function(){_0x42944e[_0x1fa6('0x18')](0xcc)[_0x1fa6('0x27')]();});}};}function handleEntityNotFound(_0x1e99c0,_0x3ab5d9){return function(_0x56d040){if(!_0x56d040){_0x1e99c0[_0x1fa6('0x28')](0x194);}return _0x56d040;};}function handleError(_0x80af03,_0x65b530){_0x65b530=_0x65b530||0x1f4;return function(_0x539464){logger[_0x1fa6('0x29')](_0x539464[_0x1fa6('0x2a')]);if(_0x539464['name']){delete _0x539464[_0x1fa6('0x2b')];}_0x80af03[_0x1fa6('0x18')](_0x65b530)['send'](_0x539464);};}exports[_0x1fa6('0x2c')]=function(_0x2113c1,_0x4989f9){var _0x5b1742={},_0x55bad0={},_0x110421={'count':0x0,'rows':[]};var _0x290328=_['map'](db[_0x1fa6('0x2d')]['rawAttributes'],function(_0x5ba162){return{'name':_0x5ba162[_0x1fa6('0x2e')],'type':_0x5ba162['type']['key']};});_0x55bad0[_0x1fa6('0x2f')]=_[_0x1fa6('0x30')](_0x290328,_0x1fa6('0x2b'));_0x55bad0[_0x1fa6('0x31')]=_[_0x1fa6('0x32')](_0x2113c1[_0x1fa6('0x31')]);_0x55bad0[_0x1fa6('0x33')]=_[_0x1fa6('0x34')](_0x55bad0[_0x1fa6('0x2f')],_0x55bad0['query']);_0x5b1742[_0x1fa6('0x35')]=_['intersection'](_0x55bad0['model'],qs[_0x1fa6('0x36')](_0x2113c1[_0x1fa6('0x31')][_0x1fa6('0x36')]));_0x5b1742[_0x1fa6('0x35')]=_0x5b1742['attributes'][_0x1fa6('0x37')]?_0x5b1742[_0x1fa6('0x35')]:_0x55bad0[_0x1fa6('0x2f')];if(!_0x2113c1[_0x1fa6('0x31')][_0x1fa6('0x38')](_0x1fa6('0x39'))){_0x5b1742['limit']=qs[_0x1fa6('0x1c')](_0x2113c1[_0x1fa6('0x31')][_0x1fa6('0x1c')]);_0x5b1742[_0x1fa6('0x1a')]=qs['offset'](_0x2113c1['query']['offset']);}_0x5b1742[_0x1fa6('0x3a')]=qs[_0x1fa6('0x3b')](_0x2113c1['query'][_0x1fa6('0x3b')]);_0x5b1742[_0x1fa6('0x3c')]=qs['filters'](_[_0x1fa6('0x3d')](_0x2113c1['query'],_0x55bad0['filters']),_0x290328);if(_0x2113c1[_0x1fa6('0x31')][_0x1fa6('0x3e')]){_0x5b1742[_0x1fa6('0x3c')]=_[_0x1fa6('0x3f')](_0x5b1742[_0x1fa6('0x3c')],{'$or':_[_0x1fa6('0x30')](_0x290328,function(_0x1f1208){if(_0x1f1208[_0x1fa6('0x40')]!=='VIRTUAL'){var _0x557186={};_0x557186[_0x1f1208[_0x1fa6('0x2b')]]={'$like':'%'+_0x2113c1[_0x1fa6('0x31')][_0x1fa6('0x3e')]+'%'};return _0x557186;}})});}_0x5b1742=_[_0x1fa6('0x3f')]({},_0x5b1742,_0x2113c1[_0x1fa6('0x41')]);var _0x439d93={'where':_0x5b1742[_0x1fa6('0x3c')]};return db['Trigger'][_0x1fa6('0x1d')](_0x439d93)[_0x1fa6('0x23')](function(_0x35bb53){_0x110421[_0x1fa6('0x1d')]=_0x35bb53;if(_0x2113c1[_0x1fa6('0x31')][_0x1fa6('0x42')]){_0x5b1742[_0x1fa6('0x43')]=[{'all':!![]}];}return db[_0x1fa6('0x2d')]['findAll'](_0x5b1742);})['then'](function(_0x267446){_0x110421[_0x1fa6('0x44')]=_0x267446;return _0x110421;})[_0x1fa6('0x23')](respondWithFilteredResult(_0x4989f9,_0x5b1742))[_0x1fa6('0x45')](handleError(_0x4989f9,null));};exports[_0x1fa6('0x46')]=function(_0x190403,_0xa5a49d){var _0x35193b={'raw':![],'where':{'id':_0x190403[_0x1fa6('0x47')]['id']}},_0x2ffa0f={};_0x2ffa0f[_0x1fa6('0x2f')]=_[_0x1fa6('0x32')](db[_0x1fa6('0x2d')][_0x1fa6('0x48')]);_0x2ffa0f[_0x1fa6('0x31')]=_['keys'](_0x190403[_0x1fa6('0x31')]);_0x2ffa0f[_0x1fa6('0x33')]=_[_0x1fa6('0x34')](_0x2ffa0f[_0x1fa6('0x2f')],_0x2ffa0f[_0x1fa6('0x31')]);_0x35193b[_0x1fa6('0x35')]=_['intersection'](_0x2ffa0f[_0x1fa6('0x2f')],qs[_0x1fa6('0x36')](_0x190403[_0x1fa6('0x31')][_0x1fa6('0x36')]));_0x35193b[_0x1fa6('0x35')]=_0x35193b[_0x1fa6('0x35')]['length']?_0x35193b['attributes']:_0x2ffa0f[_0x1fa6('0x2f')];if(_0x190403[_0x1fa6('0x31')]['includeAll']){_0x35193b[_0x1fa6('0x43')]=[{'all':!![]}];}_0x35193b=_[_0x1fa6('0x3f')]({},_0x35193b,_0x190403[_0x1fa6('0x41')]);return db['Trigger']['find'](_0x35193b)[_0x1fa6('0x23')](handleEntityNotFound(_0xa5a49d,null))[_0x1fa6('0x23')](respondWithResult(_0xa5a49d,null))['catch'](handleError(_0xa5a49d,null));};exports[_0x1fa6('0x49')]=function(_0x51228a,_0x4c0953){return db['Trigger']['create'](_0x51228a['body'],{})['then'](function(_0x2fe584){var _0x5603ae=_0x51228a[_0x1fa6('0x4a')][_0x1fa6('0x4b')]({'plain':!![]});if(!_0x5603ae)throw new Error(_0x1fa6('0x4c'));if(_0x5603ae[_0x1fa6('0x4d')]==='user'){var _0x25f261=_0x2fe584['get']({'plain':!![]});var _0x5d9d51=_0x1fa6('0x25');return db[_0x1fa6('0x4e')][_0x1fa6('0x4f')]({'where':{'name':_0x5d9d51,'userProfileId':_0x5603ae[_0x1fa6('0x50')]},'raw':!![]})[_0x1fa6('0x23')](function(_0x325e98){if(_0x325e98&&_0x325e98['autoAssociation']===0x0){return db[_0x1fa6('0x26')][_0x1fa6('0x49')]({'name':_0x25f261[_0x1fa6('0x2b')],'resourceId':_0x25f261['id'],'type':_0x325e98[_0x1fa6('0x2b')],'sectionId':_0x325e98['id']},{})[_0x1fa6('0x23')](function(){return _0x2fe584;});}else{return _0x2fe584;}})[_0x1fa6('0x45')](function(_0x37ffa7){logger[_0x1fa6('0x29')](_0x1fa6('0x51'),_0x37ffa7);throw _0x37ffa7;});}return _0x2fe584;})[_0x1fa6('0x23')](respondWithResult(_0x4c0953,0xc9))[_0x1fa6('0x45')](handleError(_0x4c0953,null));};exports[_0x1fa6('0x22')]=function(_0x53b2e8,_0x2814eb){if(_0x53b2e8[_0x1fa6('0x52')]['id']){delete _0x53b2e8['body']['id'];}return db[_0x1fa6('0x2d')][_0x1fa6('0x4f')]({'where':{'id':_0x53b2e8[_0x1fa6('0x47')]['id']}})[_0x1fa6('0x23')](handleEntityNotFound(_0x2814eb,null))[_0x1fa6('0x23')](saveUpdates(_0x53b2e8[_0x1fa6('0x52')],null))[_0x1fa6('0x23')](respondWithResult(_0x2814eb,null))[_0x1fa6('0x45')](handleError(_0x2814eb,null));};exports[_0x1fa6('0x24')]=function(_0x4cf2d6,_0x1366b4){return db[_0x1fa6('0x2d')]['find']({'where':{'id':_0x4cf2d6['params']['id']}})[_0x1fa6('0x23')](handleEntityNotFound(_0x1366b4,null))['then'](removeEntity(_0x1366b4,null))[_0x1fa6('0x45')](handleError(_0x1366b4,null));};exports[_0x1fa6('0x53')]=function(_0x257d23,_0x250679,_0x1f747f){if(_0x257d23[_0x1fa6('0x52')]['id']){delete _0x257d23[_0x1fa6('0x52')]['id'];}return db[_0x1fa6('0x2d')]['find']({'where':{'id':_0x257d23[_0x1fa6('0x47')]['id']}})['then'](handleEntityNotFound(_0x250679,null))['then'](function(_0x2b872a){if(_0x2b872a){_0x257d23[_0x1fa6('0x52')][_0x1fa6('0x54')]=_0x2b872a['id'];return db['Condition'][_0x1fa6('0x49')](_0x257d23['body']);}})[_0x1fa6('0x23')](respondWithResult(_0x250679,null))['catch'](handleError(_0x250679,null));};exports[_0x1fa6('0x55')]=function(_0x22c377,_0x1d1e28,_0xb4eab9){if(_0x22c377[_0x1fa6('0x52')]['id']){delete _0x22c377[_0x1fa6('0x52')]['id'];}return db['Trigger'][_0x1fa6('0x4f')]({'where':{'id':_0x22c377[_0x1fa6('0x47')]['id']}})[_0x1fa6('0x23')](handleEntityNotFound(_0x1d1e28,null))[_0x1fa6('0x23')](function(_0x365886){if(_0x365886){_0x22c377[_0x1fa6('0x52')][_0x1fa6('0x56')]=_0x365886['id'];return db[_0x1fa6('0x57')][_0x1fa6('0x49')](_0x22c377[_0x1fa6('0x52')]);}})[_0x1fa6('0x23')](respondWithResult(_0x1d1e28,null))[_0x1fa6('0x45')](handleError(_0x1d1e28,null));};exports[_0x1fa6('0x58')]=function(_0x21eefe,_0x40986c,_0x231f72){var _0x5e0c28={};var _0x86b7ac={};var _0x37d639;var _0x137dc2;return db['Trigger'][_0x1fa6('0x59')]({'where':{'id':_0x21eefe[_0x1fa6('0x47')]['id']}})[_0x1fa6('0x23')](handleEntityNotFound(_0x40986c,null))[_0x1fa6('0x23')](function(_0x10dbcf){if(_0x10dbcf){_0x37d639=_0x10dbcf;_0x86b7ac['model']=_[_0x1fa6('0x32')](db['Condition'][_0x1fa6('0x48')]);_0x86b7ac['query']=_['keys'](_0x21eefe['query']);_0x86b7ac[_0x1fa6('0x33')]=_[_0x1fa6('0x34')](_0x86b7ac['model'],_0x86b7ac[_0x1fa6('0x31')]);_0x5e0c28[_0x1fa6('0x35')]=_[_0x1fa6('0x34')](_0x86b7ac[_0x1fa6('0x2f')],qs[_0x1fa6('0x36')](_0x21eefe['query'][_0x1fa6('0x36')]));_0x5e0c28['attributes']=_0x5e0c28[_0x1fa6('0x35')][_0x1fa6('0x37')]?_0x5e0c28[_0x1fa6('0x35')]:_0x86b7ac[_0x1fa6('0x2f')];_0x5e0c28[_0x1fa6('0x3a')]=qs[_0x1fa6('0x3b')](_0x21eefe[_0x1fa6('0x31')]['sort']);_0x5e0c28[_0x1fa6('0x3c')]=qs['filters'](_['pick'](_0x21eefe[_0x1fa6('0x31')],_0x86b7ac[_0x1fa6('0x33')]));if(_0x21eefe[_0x1fa6('0x31')][_0x1fa6('0x3e')]){_0x5e0c28[_0x1fa6('0x3c')]=_[_0x1fa6('0x3f')](_0x5e0c28['where'],{'$or':_[_0x1fa6('0x30')](_0x5e0c28[_0x1fa6('0x35')],function(_0x5703ea){var _0x5ad8e6={};_0x5ad8e6[_0x5703ea]={'$like':'%'+_0x21eefe['query'][_0x1fa6('0x3e')]+'%'};return _0x5ad8e6;})});}_0x5e0c28=_[_0x1fa6('0x3f')]({},_0x5e0c28,_0x21eefe[_0x1fa6('0x41')]);return _0x37d639['getAllConditions'](_0x5e0c28);}})[_0x1fa6('0x23')](function(_0x4c6dcc){if(_0x4c6dcc){_0x137dc2=_0x4c6dcc[_0x1fa6('0x37')];if(!_0x21eefe[_0x1fa6('0x31')]['hasOwnProperty'](_0x1fa6('0x39'))){_0x5e0c28[_0x1fa6('0x1c')]=qs[_0x1fa6('0x1c')](_0x21eefe[_0x1fa6('0x31')]['limit']);_0x5e0c28['offset']=qs['offset'](_0x21eefe[_0x1fa6('0x31')][_0x1fa6('0x1a')]);}return _0x37d639[_0x1fa6('0x58')](_0x5e0c28);}})[_0x1fa6('0x23')](function(_0x10edf6){if(_0x10edf6){return _0x10edf6?{'count':_0x137dc2,'rows':_0x10edf6}:null;}})[_0x1fa6('0x23')](respondWithResult(_0x40986c,null))[_0x1fa6('0x45')](handleError(_0x40986c,null));};exports[_0x1fa6('0x5a')]=function(_0x1fa355,_0x52d8f9,_0xa51adb){var _0x5b0aea={};var _0x277d22={};var _0x542ae9;var _0x1efad0;return db[_0x1fa6('0x2d')][_0x1fa6('0x59')]({'where':{'id':_0x1fa355[_0x1fa6('0x47')]['id']}})[_0x1fa6('0x23')](handleEntityNotFound(_0x52d8f9,null))[_0x1fa6('0x23')](function(_0x5763c8){if(_0x5763c8){_0x542ae9=_0x5763c8;_0x277d22[_0x1fa6('0x2f')]=_[_0x1fa6('0x32')](db[_0x1fa6('0x57')][_0x1fa6('0x48')]);_0x277d22[_0x1fa6('0x31')]=_[_0x1fa6('0x32')](_0x1fa355['query']);_0x277d22['filters']=_[_0x1fa6('0x34')](_0x277d22[_0x1fa6('0x2f')],_0x277d22[_0x1fa6('0x31')]);_0x5b0aea[_0x1fa6('0x35')]=_[_0x1fa6('0x34')](_0x277d22[_0x1fa6('0x2f')],qs[_0x1fa6('0x36')](_0x1fa355[_0x1fa6('0x31')][_0x1fa6('0x36')]));_0x5b0aea[_0x1fa6('0x35')]=_0x5b0aea['attributes']['length']?_0x5b0aea[_0x1fa6('0x35')]:_0x277d22[_0x1fa6('0x2f')];_0x5b0aea[_0x1fa6('0x3a')]=qs[_0x1fa6('0x3b')](_0x1fa355[_0x1fa6('0x31')][_0x1fa6('0x3b')]);_0x5b0aea[_0x1fa6('0x3c')]=qs[_0x1fa6('0x33')](_[_0x1fa6('0x3d')](_0x1fa355[_0x1fa6('0x31')],_0x277d22[_0x1fa6('0x33')]));if(_0x1fa355[_0x1fa6('0x31')][_0x1fa6('0x3e')]){_0x5b0aea[_0x1fa6('0x3c')]=_[_0x1fa6('0x3f')](_0x5b0aea[_0x1fa6('0x3c')],{'$or':_[_0x1fa6('0x30')](_0x5b0aea[_0x1fa6('0x35')],function(_0xcc7a19){var _0x3205ef={};_0x3205ef[_0xcc7a19]={'$like':'%'+_0x1fa355[_0x1fa6('0x31')][_0x1fa6('0x3e')]+'%'};return _0x3205ef;})});}_0x5b0aea=_[_0x1fa6('0x3f')]({},_0x5b0aea,_0x1fa355['options']);return _0x542ae9[_0x1fa6('0x5a')](_0x5b0aea);}})[_0x1fa6('0x23')](function(_0x4e4aad){if(_0x4e4aad){_0x1efad0=_0x4e4aad[_0x1fa6('0x37')];if(!_0x1fa355[_0x1fa6('0x31')][_0x1fa6('0x38')](_0x1fa6('0x39'))){_0x5b0aea[_0x1fa6('0x1c')]=qs['limit'](_0x1fa355[_0x1fa6('0x31')][_0x1fa6('0x1c')]);_0x5b0aea[_0x1fa6('0x1a')]=qs['offset'](_0x1fa355[_0x1fa6('0x31')][_0x1fa6('0x1a')]);}return _0x542ae9[_0x1fa6('0x5a')](_0x5b0aea);}})[_0x1fa6('0x23')](function(_0x166bc3){if(_0x166bc3){return _0x166bc3?{'count':_0x1efad0,'rows':_0x166bc3}:null;}})['then'](respondWithResult(_0x52d8f9,null))[_0x1fa6('0x45')](handleError(_0x52d8f9,null));};exports['addAction']=function(_0x3814ac,_0x540269,_0xcaaefc){if(_0x3814ac[_0x1fa6('0x52')]['id']){delete _0x3814ac[_0x1fa6('0x52')]['id'];}return db[_0x1fa6('0x2d')][_0x1fa6('0x4f')]({'where':{'id':_0x3814ac[_0x1fa6('0x47')]['id']}})[_0x1fa6('0x23')](handleEntityNotFound(_0x540269,null))[_0x1fa6('0x23')](function(_0x503b64){if(_0x503b64){_0x3814ac[_0x1fa6('0x52')][_0x1fa6('0x5b')]=_0x503b64['id'];return db[_0x1fa6('0x5c')]['create'](_0x3814ac[_0x1fa6('0x52')]);}})[_0x1fa6('0x23')](respondWithResult(_0x540269,null))[_0x1fa6('0x45')](handleError(_0x540269,null));};exports['getActions']=function(_0xd640d5,_0x1c173e,_0x2a44c5){var _0x44d17d={};var _0x16a570={};var _0x45a12f;var _0x569715;return db[_0x1fa6('0x2d')][_0x1fa6('0x59')]({'where':{'id':_0xd640d5[_0x1fa6('0x47')]['id']}})[_0x1fa6('0x23')](handleEntityNotFound(_0x1c173e,null))[_0x1fa6('0x23')](function(_0xb14484){if(_0xb14484){_0x45a12f=_0xb14484;_0x16a570['model']=_['keys'](db[_0x1fa6('0x5c')][_0x1fa6('0x48')]);_0x16a570[_0x1fa6('0x31')]=_[_0x1fa6('0x32')](_0xd640d5['query']);_0x16a570[_0x1fa6('0x33')]=_[_0x1fa6('0x34')](_0x16a570['model'],_0x16a570['query']);_0x44d17d[_0x1fa6('0x35')]=_[_0x1fa6('0x34')](_0x16a570['model'],qs[_0x1fa6('0x36')](_0xd640d5[_0x1fa6('0x31')][_0x1fa6('0x36')]));_0x44d17d[_0x1fa6('0x35')]=_0x44d17d[_0x1fa6('0x35')]['length']?_0x44d17d[_0x1fa6('0x35')]:_0x16a570['model'];_0x44d17d[_0x1fa6('0x3a')]=qs[_0x1fa6('0x3b')](_0xd640d5[_0x1fa6('0x31')][_0x1fa6('0x3b')]);_0x44d17d['where']=qs[_0x1fa6('0x33')](_[_0x1fa6('0x3d')](_0xd640d5[_0x1fa6('0x31')],_0x16a570[_0x1fa6('0x33')]));if(_0xd640d5['query'][_0x1fa6('0x3e')]){_0x44d17d[_0x1fa6('0x3c')]=_[_0x1fa6('0x3f')](_0x44d17d['where'],{'$or':_[_0x1fa6('0x30')](_0x44d17d[_0x1fa6('0x35')],function(_0x25dd0d){var _0x4cad6e={};_0x4cad6e[_0x25dd0d]={'$like':'%'+_0xd640d5[_0x1fa6('0x31')]['filter']+'%'};return _0x4cad6e;})});}_0x44d17d=_[_0x1fa6('0x3f')]({},_0x44d17d,_0xd640d5[_0x1fa6('0x41')]);return _0x45a12f[_0x1fa6('0x5d')](_0x44d17d);}})[_0x1fa6('0x23')](function(_0x3bd5a9){if(_0x3bd5a9){_0x569715=_0x3bd5a9[_0x1fa6('0x37')];if(!_0xd640d5[_0x1fa6('0x31')][_0x1fa6('0x38')]('nolimit')){_0x44d17d[_0x1fa6('0x1c')]=qs[_0x1fa6('0x1c')](_0xd640d5['query'][_0x1fa6('0x1c')]);_0x44d17d[_0x1fa6('0x1a')]=qs[_0x1fa6('0x1a')](_0xd640d5[_0x1fa6('0x31')][_0x1fa6('0x1a')]);}return _0x45a12f[_0x1fa6('0x5d')](_0x44d17d);}})[_0x1fa6('0x23')](function(_0x55f002){if(_0x55f002){return _0x55f002?{'count':_0x569715,'rows':_0x55f002}:null;}})['then'](respondWithResult(_0x1c173e,null))[_0x1fa6('0x45')](handleError(_0x1c173e,null));}; \ No newline at end of file +var _0xf0c7=['get','Triggers','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','TriggerAnyId','getAllConditions','findOne','Condition','getAnyConditions','order','addAction','TriggerId','getActions','Action','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','UserProfileResource','end','error','stack','name','send','Trigger','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','where','filter','options','includeAll','include','findAll','catch','show','rawAttributes','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x37b7b3,_0x40324e){var _0x1eda02=function(_0x42b62a){while(--_0x42b62a){_0x37b7b3['push'](_0x37b7b3['shift']());}};_0x1eda02(++_0x40324e);}(_0xf0c7,0x69));var _0x7f0c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf0c7[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x7f0c('0x0'));var rimraf=require(_0x7f0c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f0c('0x2'));var rp=require('request-promise');var moment=require(_0x7f0c('0x3'));var BPromise=require(_0x7f0c('0x4'));var Mustache=require(_0x7f0c('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7f0c('0x6'));var fs=require('fs');var fs_extra=require(_0x7f0c('0x7'));var _=require(_0x7f0c('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7f0c('0x9'));var deskjs=require(_0x7f0c('0xa'));var toCsv=require(_0x7f0c('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7f0c('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7f0c('0xd'));var hardwareService=require(_0x7f0c('0xe'));var logger=require(_0x7f0c('0xf'))(_0x7f0c('0x10'));var utils=require(_0x7f0c('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x7f0c('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59f952,_0x532775){_0x532775=_0x532775||0xcc;return function(_0x17158d){if(_0x17158d){return _0x59f952[_0x7f0c('0x13')](_0x532775);}return _0x59f952[_0x7f0c('0x14')](_0x532775)['end']();};}function respondWithResult(_0x113475,_0x1f6341){_0x1f6341=_0x1f6341||0xc8;return function(_0x953adf){if(_0x953adf){return _0x113475[_0x7f0c('0x14')](_0x1f6341)[_0x7f0c('0x15')](_0x953adf);}};}function respondWithFilteredResult(_0x426ef5,_0x420c36){return function(_0x187f9c){if(_0x187f9c){var _0x1f6dd9=typeof _0x420c36[_0x7f0c('0x16')]===_0x7f0c('0x17')&&typeof _0x420c36[_0x7f0c('0x18')]===_0x7f0c('0x17');var _0x138d69=_0x187f9c['count'];var _0x302fda=_0x1f6dd9?0x0:_0x420c36[_0x7f0c('0x16')];var _0x1da797=_0x1f6dd9?_0x187f9c[_0x7f0c('0x19')]:_0x420c36['offset']+_0x420c36[_0x7f0c('0x18')];var _0x153f91;if(_0x1da797>=_0x138d69){_0x1da797=_0x138d69;_0x153f91=0xc8;}else{_0x153f91=0xce;}_0x426ef5[_0x7f0c('0x14')](_0x153f91);return _0x426ef5[_0x7f0c('0x1a')]('Content-Range',_0x302fda+'-'+_0x1da797+'/'+_0x138d69)[_0x7f0c('0x15')](_0x187f9c);}return null;};}function patchUpdates(_0x4f1dea){return function(_0x23cebe){try{jsonpatch[_0x7f0c('0x1b')](_0x23cebe,_0x4f1dea,!![]);}catch(_0x35966b){return BPromise[_0x7f0c('0x1c')](_0x35966b);}return _0x23cebe[_0x7f0c('0x1d')]();};}function saveUpdates(_0x27a5cf,_0x1a44a1){return function(_0x1a4c27){if(_0x1a4c27){return _0x1a4c27['update'](_0x27a5cf)[_0x7f0c('0x1e')](function(_0x59a984){return _0x59a984;});}return null;};}function removeEntity(_0x2c8ed4,_0x1f2f4a){return function(_0x49c9f1){if(_0x49c9f1){return _0x49c9f1[_0x7f0c('0x1f')]()[_0x7f0c('0x1e')](function(){var _0x39257c=_0x49c9f1['get']({'plain':!![]});var _0x20034e='Triggers';return db[_0x7f0c('0x20')][_0x7f0c('0x1f')]({'where':{'type':_0x20034e,'resourceId':_0x39257c['id']}})['then'](function(){return _0x49c9f1;});})['then'](function(){_0x2c8ed4[_0x7f0c('0x14')](0xcc)[_0x7f0c('0x21')]();});}};}function handleEntityNotFound(_0x365969,_0x11e8e4){return function(_0x5cd1eb){if(!_0x5cd1eb){_0x365969[_0x7f0c('0x13')](0x194);}return _0x5cd1eb;};}function handleError(_0x5210c6,_0x1a2104){_0x1a2104=_0x1a2104||0x1f4;return function(_0x118216){logger[_0x7f0c('0x22')](_0x118216[_0x7f0c('0x23')]);if(_0x118216[_0x7f0c('0x24')]){delete _0x118216[_0x7f0c('0x24')];}_0x5210c6[_0x7f0c('0x14')](_0x1a2104)[_0x7f0c('0x25')](_0x118216);};}exports['index']=function(_0x55b416,_0x1ce9d1){var _0x53ff81={},_0x5aee6f={},_0x2df43d={'count':0x0,'rows':[]};var _0xb0c414=_['map'](db[_0x7f0c('0x26')]['rawAttributes'],function(_0x4aa191){return{'name':_0x4aa191[_0x7f0c('0x27')],'type':_0x4aa191[_0x7f0c('0x28')][_0x7f0c('0x29')]};});_0x5aee6f['model']=_[_0x7f0c('0x2a')](_0xb0c414,'name');_0x5aee6f['query']=_['keys'](_0x55b416[_0x7f0c('0x2b')]);_0x5aee6f[_0x7f0c('0x2c')]=_[_0x7f0c('0x2d')](_0x5aee6f[_0x7f0c('0x2e')],_0x5aee6f[_0x7f0c('0x2b')]);_0x53ff81[_0x7f0c('0x2f')]=_[_0x7f0c('0x2d')](_0x5aee6f['model'],qs[_0x7f0c('0x30')](_0x55b416['query'][_0x7f0c('0x30')]));_0x53ff81[_0x7f0c('0x2f')]=_0x53ff81[_0x7f0c('0x2f')][_0x7f0c('0x31')]?_0x53ff81['attributes']:_0x5aee6f['model'];if(!_0x55b416[_0x7f0c('0x2b')][_0x7f0c('0x32')](_0x7f0c('0x33'))){_0x53ff81[_0x7f0c('0x18')]=qs[_0x7f0c('0x18')](_0x55b416[_0x7f0c('0x2b')]['limit']);_0x53ff81['offset']=qs[_0x7f0c('0x16')](_0x55b416['query'][_0x7f0c('0x16')]);}_0x53ff81['order']=qs['sort'](_0x55b416[_0x7f0c('0x2b')][_0x7f0c('0x34')]);_0x53ff81['where']=qs[_0x7f0c('0x2c')](_[_0x7f0c('0x35')](_0x55b416[_0x7f0c('0x2b')],_0x5aee6f['filters']),_0xb0c414);if(_0x55b416['query']['filter']){_0x53ff81['where']=_[_0x7f0c('0x36')](_0x53ff81[_0x7f0c('0x37')],{'$or':_[_0x7f0c('0x2a')](_0xb0c414,function(_0x396c62){if(_0x396c62[_0x7f0c('0x28')]!=='VIRTUAL'){var _0x12802d={};_0x12802d[_0x396c62[_0x7f0c('0x24')]]={'$like':'%'+_0x55b416[_0x7f0c('0x2b')][_0x7f0c('0x38')]+'%'};return _0x12802d;}})});}_0x53ff81=_[_0x7f0c('0x36')]({},_0x53ff81,_0x55b416[_0x7f0c('0x39')]);var _0x208eb4={'where':_0x53ff81['where']};return db[_0x7f0c('0x26')]['count'](_0x208eb4)[_0x7f0c('0x1e')](function(_0x42b503){_0x2df43d[_0x7f0c('0x19')]=_0x42b503;if(_0x55b416[_0x7f0c('0x2b')][_0x7f0c('0x3a')]){_0x53ff81[_0x7f0c('0x3b')]=[{'all':!![]}];}return db[_0x7f0c('0x26')][_0x7f0c('0x3c')](_0x53ff81);})[_0x7f0c('0x1e')](function(_0x3c78ce){_0x2df43d['rows']=_0x3c78ce;return _0x2df43d;})[_0x7f0c('0x1e')](respondWithFilteredResult(_0x1ce9d1,_0x53ff81))[_0x7f0c('0x3d')](handleError(_0x1ce9d1,null));};exports[_0x7f0c('0x3e')]=function(_0x3e2051,_0x1f1d0a){var _0x23427e={'raw':![],'where':{'id':_0x3e2051['params']['id']}},_0x185bf1={};_0x185bf1[_0x7f0c('0x2e')]=_['keys'](db[_0x7f0c('0x26')][_0x7f0c('0x3f')]);_0x185bf1[_0x7f0c('0x2b')]=_[_0x7f0c('0x40')](_0x3e2051[_0x7f0c('0x2b')]);_0x185bf1[_0x7f0c('0x2c')]=_['intersection'](_0x185bf1['model'],_0x185bf1[_0x7f0c('0x2b')]);_0x23427e['attributes']=_[_0x7f0c('0x2d')](_0x185bf1[_0x7f0c('0x2e')],qs['fields'](_0x3e2051[_0x7f0c('0x2b')][_0x7f0c('0x30')]));_0x23427e[_0x7f0c('0x2f')]=_0x23427e[_0x7f0c('0x2f')]['length']?_0x23427e['attributes']:_0x185bf1[_0x7f0c('0x2e')];if(_0x3e2051[_0x7f0c('0x2b')][_0x7f0c('0x3a')]){_0x23427e[_0x7f0c('0x3b')]=[{'all':!![]}];}_0x23427e=_['merge']({},_0x23427e,_0x3e2051['options']);return db[_0x7f0c('0x26')][_0x7f0c('0x41')](_0x23427e)[_0x7f0c('0x1e')](handleEntityNotFound(_0x1f1d0a,null))[_0x7f0c('0x1e')](respondWithResult(_0x1f1d0a,null))['catch'](handleError(_0x1f1d0a,null));};exports[_0x7f0c('0x42')]=function(_0xc60a26,_0x1f8d66){return db[_0x7f0c('0x26')][_0x7f0c('0x42')](_0xc60a26[_0x7f0c('0x43')],{})[_0x7f0c('0x1e')](function(_0x416aa6){var _0x2c06e9=_0xc60a26[_0x7f0c('0x44')]['get']({'plain':!![]});if(!_0x2c06e9)throw new Error(_0x7f0c('0x45'));if(_0x2c06e9[_0x7f0c('0x46')]==='user'){var _0x1a3d1e=_0x416aa6[_0x7f0c('0x47')]({'plain':!![]});var _0x573628=_0x7f0c('0x48');return db[_0x7f0c('0x49')][_0x7f0c('0x41')]({'where':{'name':_0x573628,'userProfileId':_0x2c06e9[_0x7f0c('0x4a')]},'raw':!![]})['then'](function(_0x3209ec){if(_0x3209ec&&_0x3209ec['autoAssociation']===0x0){return db[_0x7f0c('0x20')][_0x7f0c('0x42')]({'name':_0x1a3d1e['name'],'resourceId':_0x1a3d1e['id'],'type':_0x3209ec['name'],'sectionId':_0x3209ec['id']},{})[_0x7f0c('0x1e')](function(){return _0x416aa6;});}else{return _0x416aa6;}})[_0x7f0c('0x3d')](function(_0x2d8c17){logger['error'](_0x7f0c('0x4b'),_0x2d8c17);throw _0x2d8c17;});}return _0x416aa6;})[_0x7f0c('0x1e')](respondWithResult(_0x1f8d66,0xc9))[_0x7f0c('0x3d')](handleError(_0x1f8d66,null));};exports[_0x7f0c('0x4c')]=function(_0x125bdb,_0x550ffc){if(_0x125bdb['body']['id']){delete _0x125bdb[_0x7f0c('0x43')]['id'];}return db[_0x7f0c('0x26')][_0x7f0c('0x41')]({'where':{'id':_0x125bdb['params']['id']}})['then'](handleEntityNotFound(_0x550ffc,null))[_0x7f0c('0x1e')](saveUpdates(_0x125bdb[_0x7f0c('0x43')],null))[_0x7f0c('0x1e')](respondWithResult(_0x550ffc,null))[_0x7f0c('0x3d')](handleError(_0x550ffc,null));};exports[_0x7f0c('0x1f')]=function(_0xe1681d,_0x44368a){return db[_0x7f0c('0x26')][_0x7f0c('0x41')]({'where':{'id':_0xe1681d[_0x7f0c('0x4d')]['id']}})[_0x7f0c('0x1e')](handleEntityNotFound(_0x44368a,null))[_0x7f0c('0x1e')](removeEntity(_0x44368a,null))[_0x7f0c('0x3d')](handleError(_0x44368a,null));};exports['addAllCondition']=function(_0x1d1b30,_0x28f22b,_0xa3195){if(_0x1d1b30[_0x7f0c('0x43')]['id']){delete _0x1d1b30[_0x7f0c('0x43')]['id'];}return db[_0x7f0c('0x26')][_0x7f0c('0x41')]({'where':{'id':_0x1d1b30[_0x7f0c('0x4d')]['id']}})[_0x7f0c('0x1e')](handleEntityNotFound(_0x28f22b,null))['then'](function(_0x13afbf){if(_0x13afbf){_0x1d1b30[_0x7f0c('0x43')]['TriggerAllId']=_0x13afbf['id'];return db['Condition'][_0x7f0c('0x42')](_0x1d1b30['body']);}})['then'](respondWithResult(_0x28f22b,null))[_0x7f0c('0x3d')](handleError(_0x28f22b,null));};exports['addAnyCondition']=function(_0x49853f,_0x2ace13,_0x1615ee){if(_0x49853f[_0x7f0c('0x43')]['id']){delete _0x49853f[_0x7f0c('0x43')]['id'];}return db[_0x7f0c('0x26')][_0x7f0c('0x41')]({'where':{'id':_0x49853f[_0x7f0c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2ace13,null))[_0x7f0c('0x1e')](function(_0x2843f6){if(_0x2843f6){_0x49853f[_0x7f0c('0x43')][_0x7f0c('0x4e')]=_0x2843f6['id'];return db['Condition'][_0x7f0c('0x42')](_0x49853f['body']);}})['then'](respondWithResult(_0x2ace13,null))[_0x7f0c('0x3d')](handleError(_0x2ace13,null));};exports[_0x7f0c('0x4f')]=function(_0x128bc1,_0x16c311,_0xfc2003){var _0x16e4b0={};var _0x2c56ac={};var _0x2c727b;var _0x330c11;return db[_0x7f0c('0x26')][_0x7f0c('0x50')]({'where':{'id':_0x128bc1['params']['id']}})['then'](handleEntityNotFound(_0x16c311,null))[_0x7f0c('0x1e')](function(_0x1b5935){if(_0x1b5935){_0x2c727b=_0x1b5935;_0x2c56ac[_0x7f0c('0x2e')]=_[_0x7f0c('0x40')](db[_0x7f0c('0x51')][_0x7f0c('0x3f')]);_0x2c56ac[_0x7f0c('0x2b')]=_[_0x7f0c('0x40')](_0x128bc1[_0x7f0c('0x2b')]);_0x2c56ac['filters']=_['intersection'](_0x2c56ac[_0x7f0c('0x2e')],_0x2c56ac['query']);_0x16e4b0[_0x7f0c('0x2f')]=_[_0x7f0c('0x2d')](_0x2c56ac[_0x7f0c('0x2e')],qs[_0x7f0c('0x30')](_0x128bc1['query']['fields']));_0x16e4b0[_0x7f0c('0x2f')]=_0x16e4b0[_0x7f0c('0x2f')]['length']?_0x16e4b0[_0x7f0c('0x2f')]:_0x2c56ac[_0x7f0c('0x2e')];_0x16e4b0['order']=qs[_0x7f0c('0x34')](_0x128bc1[_0x7f0c('0x2b')]['sort']);_0x16e4b0[_0x7f0c('0x37')]=qs[_0x7f0c('0x2c')](_[_0x7f0c('0x35')](_0x128bc1[_0x7f0c('0x2b')],_0x2c56ac[_0x7f0c('0x2c')]));if(_0x128bc1[_0x7f0c('0x2b')][_0x7f0c('0x38')]){_0x16e4b0[_0x7f0c('0x37')]=_[_0x7f0c('0x36')](_0x16e4b0[_0x7f0c('0x37')],{'$or':_[_0x7f0c('0x2a')](_0x16e4b0['attributes'],function(_0x2f094d){var _0x2f2fa3={};_0x2f2fa3[_0x2f094d]={'$like':'%'+_0x128bc1['query'][_0x7f0c('0x38')]+'%'};return _0x2f2fa3;})});}_0x16e4b0=_[_0x7f0c('0x36')]({},_0x16e4b0,_0x128bc1[_0x7f0c('0x39')]);return _0x2c727b['getAllConditions'](_0x16e4b0);}})[_0x7f0c('0x1e')](function(_0x467850){if(_0x467850){_0x330c11=_0x467850['length'];if(!_0x128bc1[_0x7f0c('0x2b')][_0x7f0c('0x32')](_0x7f0c('0x33'))){_0x16e4b0['limit']=qs[_0x7f0c('0x18')](_0x128bc1[_0x7f0c('0x2b')][_0x7f0c('0x18')]);_0x16e4b0[_0x7f0c('0x16')]=qs[_0x7f0c('0x16')](_0x128bc1[_0x7f0c('0x2b')][_0x7f0c('0x16')]);}return _0x2c727b['getAllConditions'](_0x16e4b0);}})['then'](function(_0x8ca04f){if(_0x8ca04f){return _0x8ca04f?{'count':_0x330c11,'rows':_0x8ca04f}:null;}})[_0x7f0c('0x1e')](respondWithResult(_0x16c311,null))['catch'](handleError(_0x16c311,null));};exports[_0x7f0c('0x52')]=function(_0x5d32d6,_0x257331,_0xaca28d){var _0x37e13e={};var _0x1a0492={};var _0x838b1f;var _0x128ec8;return db[_0x7f0c('0x26')][_0x7f0c('0x50')]({'where':{'id':_0x5d32d6['params']['id']}})[_0x7f0c('0x1e')](handleEntityNotFound(_0x257331,null))[_0x7f0c('0x1e')](function(_0x22eb3d){if(_0x22eb3d){_0x838b1f=_0x22eb3d;_0x1a0492[_0x7f0c('0x2e')]=_['keys'](db[_0x7f0c('0x51')]['rawAttributes']);_0x1a0492[_0x7f0c('0x2b')]=_[_0x7f0c('0x40')](_0x5d32d6['query']);_0x1a0492[_0x7f0c('0x2c')]=_[_0x7f0c('0x2d')](_0x1a0492[_0x7f0c('0x2e')],_0x1a0492[_0x7f0c('0x2b')]);_0x37e13e[_0x7f0c('0x2f')]=_[_0x7f0c('0x2d')](_0x1a0492[_0x7f0c('0x2e')],qs[_0x7f0c('0x30')](_0x5d32d6[_0x7f0c('0x2b')][_0x7f0c('0x30')]));_0x37e13e[_0x7f0c('0x2f')]=_0x37e13e[_0x7f0c('0x2f')][_0x7f0c('0x31')]?_0x37e13e[_0x7f0c('0x2f')]:_0x1a0492['model'];_0x37e13e[_0x7f0c('0x53')]=qs[_0x7f0c('0x34')](_0x5d32d6['query']['sort']);_0x37e13e[_0x7f0c('0x37')]=qs['filters'](_[_0x7f0c('0x35')](_0x5d32d6[_0x7f0c('0x2b')],_0x1a0492[_0x7f0c('0x2c')]));if(_0x5d32d6[_0x7f0c('0x2b')][_0x7f0c('0x38')]){_0x37e13e[_0x7f0c('0x37')]=_[_0x7f0c('0x36')](_0x37e13e['where'],{'$or':_[_0x7f0c('0x2a')](_0x37e13e[_0x7f0c('0x2f')],function(_0x238fae){var _0x21a0f9={};_0x21a0f9[_0x238fae]={'$like':'%'+_0x5d32d6[_0x7f0c('0x2b')][_0x7f0c('0x38')]+'%'};return _0x21a0f9;})});}_0x37e13e=_[_0x7f0c('0x36')]({},_0x37e13e,_0x5d32d6[_0x7f0c('0x39')]);return _0x838b1f[_0x7f0c('0x52')](_0x37e13e);}})[_0x7f0c('0x1e')](function(_0x486223){if(_0x486223){_0x128ec8=_0x486223[_0x7f0c('0x31')];if(!_0x5d32d6['query']['hasOwnProperty'](_0x7f0c('0x33'))){_0x37e13e[_0x7f0c('0x18')]=qs[_0x7f0c('0x18')](_0x5d32d6[_0x7f0c('0x2b')][_0x7f0c('0x18')]);_0x37e13e[_0x7f0c('0x16')]=qs[_0x7f0c('0x16')](_0x5d32d6[_0x7f0c('0x2b')][_0x7f0c('0x16')]);}return _0x838b1f[_0x7f0c('0x52')](_0x37e13e);}})[_0x7f0c('0x1e')](function(_0x175b97){if(_0x175b97){return _0x175b97?{'count':_0x128ec8,'rows':_0x175b97}:null;}})[_0x7f0c('0x1e')](respondWithResult(_0x257331,null))[_0x7f0c('0x3d')](handleError(_0x257331,null));};exports[_0x7f0c('0x54')]=function(_0x35988a,_0x41b219,_0x24e51f){if(_0x35988a[_0x7f0c('0x43')]['id']){delete _0x35988a[_0x7f0c('0x43')]['id'];}return db[_0x7f0c('0x26')]['find']({'where':{'id':_0x35988a[_0x7f0c('0x4d')]['id']}})[_0x7f0c('0x1e')](handleEntityNotFound(_0x41b219,null))['then'](function(_0x2c95c1){if(_0x2c95c1){_0x35988a[_0x7f0c('0x43')][_0x7f0c('0x55')]=_0x2c95c1['id'];return db['Action']['create'](_0x35988a[_0x7f0c('0x43')]);}})[_0x7f0c('0x1e')](respondWithResult(_0x41b219,null))[_0x7f0c('0x3d')](handleError(_0x41b219,null));};exports[_0x7f0c('0x56')]=function(_0x2b0aff,_0x4fa6a4,_0x3a9714){var _0x4a2bbc={};var _0x54f107={};var _0x5d9a89;var _0x43dc75;return db[_0x7f0c('0x26')][_0x7f0c('0x50')]({'where':{'id':_0x2b0aff['params']['id']}})[_0x7f0c('0x1e')](handleEntityNotFound(_0x4fa6a4,null))[_0x7f0c('0x1e')](function(_0x4726fb){if(_0x4726fb){_0x5d9a89=_0x4726fb;_0x54f107[_0x7f0c('0x2e')]=_[_0x7f0c('0x40')](db[_0x7f0c('0x57')]['rawAttributes']);_0x54f107[_0x7f0c('0x2b')]=_[_0x7f0c('0x40')](_0x2b0aff['query']);_0x54f107[_0x7f0c('0x2c')]=_[_0x7f0c('0x2d')](_0x54f107[_0x7f0c('0x2e')],_0x54f107['query']);_0x4a2bbc[_0x7f0c('0x2f')]=_[_0x7f0c('0x2d')](_0x54f107[_0x7f0c('0x2e')],qs[_0x7f0c('0x30')](_0x2b0aff[_0x7f0c('0x2b')][_0x7f0c('0x30')]));_0x4a2bbc[_0x7f0c('0x2f')]=_0x4a2bbc['attributes'][_0x7f0c('0x31')]?_0x4a2bbc[_0x7f0c('0x2f')]:_0x54f107[_0x7f0c('0x2e')];_0x4a2bbc['order']=qs[_0x7f0c('0x34')](_0x2b0aff['query'][_0x7f0c('0x34')]);_0x4a2bbc[_0x7f0c('0x37')]=qs['filters'](_['pick'](_0x2b0aff['query'],_0x54f107[_0x7f0c('0x2c')]));if(_0x2b0aff[_0x7f0c('0x2b')][_0x7f0c('0x38')]){_0x4a2bbc['where']=_[_0x7f0c('0x36')](_0x4a2bbc[_0x7f0c('0x37')],{'$or':_[_0x7f0c('0x2a')](_0x4a2bbc[_0x7f0c('0x2f')],function(_0x20648b){var _0x428b5={};_0x428b5[_0x20648b]={'$like':'%'+_0x2b0aff[_0x7f0c('0x2b')][_0x7f0c('0x38')]+'%'};return _0x428b5;})});}_0x4a2bbc=_[_0x7f0c('0x36')]({},_0x4a2bbc,_0x2b0aff[_0x7f0c('0x39')]);return _0x5d9a89[_0x7f0c('0x56')](_0x4a2bbc);}})[_0x7f0c('0x1e')](function(_0x1f73cf){if(_0x1f73cf){_0x43dc75=_0x1f73cf['length'];if(!_0x2b0aff[_0x7f0c('0x2b')]['hasOwnProperty'](_0x7f0c('0x33'))){_0x4a2bbc['limit']=qs[_0x7f0c('0x18')](_0x2b0aff[_0x7f0c('0x2b')]['limit']);_0x4a2bbc[_0x7f0c('0x16')]=qs[_0x7f0c('0x16')](_0x2b0aff[_0x7f0c('0x2b')][_0x7f0c('0x16')]);}return _0x5d9a89[_0x7f0c('0x56')](_0x4a2bbc);}})['then'](function(_0x11693e){if(_0x11693e){return _0x11693e?{'count':_0x43dc75,'rows':_0x11693e}:null;}})[_0x7f0c('0x1e')](respondWithResult(_0x4fa6a4,null))[_0x7f0c('0x3d')](handleError(_0x4fa6a4,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 817e238..5af77aa 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 _0x9f75=['path','rimraf','../../config/environment','exports','Trigger','tools_triggers','lodash','../../config/logger','api','request-promise'];(function(_0x5e7b21,_0x4640a9){var _0x1444ec=function(_0x4d14b7){while(--_0x4d14b7){_0x5e7b21['push'](_0x5e7b21['shift']());}};_0x1444ec(++_0x4640a9);}(_0x9f75,0x15a));var _0x59f7=function(_0x57b1fd,_0xcdddb4){_0x57b1fd=_0x57b1fd-0x0;var _0x3fe7ad=_0x9f75[_0x57b1fd];return _0x3fe7ad;};'use strict';var _=require(_0x59f7('0x0'));var util=require('util');var logger=require(_0x59f7('0x1'))(_0x59f7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x59f7('0x3'));var fs=require('fs');var path=require(_0x59f7('0x4'));var rimraf=require(_0x59f7('0x5'));var config=require(_0x59f7('0x6'));var attributes=require('./trigger.attributes');module[_0x59f7('0x7')]=function(_0x278f11,_0x5485fa){return _0x278f11['define'](_0x59f7('0x8'),attributes,{'tableName':_0x59f7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa566=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','define','tools_triggers','lodash'];(function(_0x5f4cd7,_0x459c44){var _0x47c93f=function(_0x11f384){while(--_0x11f384){_0x5f4cd7['push'](_0x5f4cd7['shift']());}};_0x47c93f(++_0x459c44);}(_0xa566,0x1c1));var _0x6a56=function(_0x3d2bb5,_0x56ba29){_0x3d2bb5=_0x3d2bb5-0x0;var _0x1e215f=_0xa566[_0x3d2bb5];return _0x1e215f;};'use strict';var _=require(_0x6a56('0x0'));var util=require(_0x6a56('0x1'));var logger=require(_0x6a56('0x2'))('api');var moment=require(_0x6a56('0x3'));var BPromise=require(_0x6a56('0x4'));var rp=require(_0x6a56('0x5'));var fs=require('fs');var path=require(_0x6a56('0x6'));var rimraf=require('rimraf');var config=require(_0x6a56('0x7'));var attributes=require('./trigger.attributes');module['exports']=function(_0x4c58b0,_0x47ecb8){return _0x4c58b0[_0x6a56('0x8')]('Trigger',attributes,{'tableName':_0x6a56('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 2e67267..2c56d82 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 _0xc200=['catch','Trigger','findAll','options','raw','where','limit','include','attributes','map','info','GetTrigger','stringify','find','model','ShowTrigger','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','Trigger,\x20%s,\x20%s','request\x20sent','result'];(function(_0x4b2456,_0x66022b){var _0x1d2936=function(_0x3784ae){while(--_0x3784ae){_0x4b2456['push'](_0x4b2456['shift']());}};_0x1d2936(++_0x66022b);}(_0xc200,0x138));var _0x0c20=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xc200[_0x341e0f];return _0x59555a;};'use strict';var _=require('lodash');var util=require(_0x0c20('0x0'));var moment=require(_0x0c20('0x1'));var BPromise=require(_0x0c20('0x2'));var rs=require(_0x0c20('0x3'));var fs=require('fs');var Redis=require(_0x0c20('0x4'));var db=require(_0x0c20('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c20('0x6'))(_0x0c20('0x7'));var config=require(_0x0c20('0x8'));var jayson=require(_0x0c20('0x9'));var client=jayson['client'][_0x0c20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12c0d5,_0x1397c4,_0x46a31c){return new BPromise(function(_0x47844b,_0x31323b){return client[_0x0c20('0xb')](_0x12c0d5,_0x46a31c)[_0x0c20('0xc')](function(_0x12fb83){logger['info']('Trigger,\x20%s,\x20%s',_0x1397c4,'request\x20sent');logger[_0x0c20('0xd')](_0x0c20('0xe'),_0x1397c4,'request\x20sent',JSON['stringify'](_0x12fb83));if(_0x12fb83[_0x0c20('0xf')]){if(_0x12fb83[_0x0c20('0xf')][_0x0c20('0x10')]===0x1f4){logger[_0x0c20('0xf')]('Trigger,\x20%s,\x20%s',_0x1397c4,_0x12fb83['error'][_0x0c20('0x11')]);return _0x31323b(_0x12fb83[_0x0c20('0xf')]['message']);}logger[_0x0c20('0xf')](_0x0c20('0x12'),_0x1397c4,_0x12fb83['error']['message']);return _0x47844b(_0x12fb83[_0x0c20('0xf')][_0x0c20('0x11')]);}else{logger['info'](_0x0c20('0x12'),_0x1397c4,_0x0c20('0x13'));_0x47844b(_0x12fb83[_0x0c20('0x14')]['message']);}})[_0x0c20('0x15')](function(_0x13ed33){logger[_0x0c20('0xf')]('Trigger,\x20%s,\x20%s',_0x1397c4,_0x13ed33);_0x31323b(_0x13ed33);});});}exports['GetTrigger']=function(_0x3239f9){var _0x3c1e25=this;return new Promise(function(_0x27bebb,_0x3b3cdc){return db[_0x0c20('0x16')][_0x0c20('0x17')]({'raw':_0x3239f9[_0x0c20('0x18')]?_0x3239f9[_0x0c20('0x18')][_0x0c20('0x19')]===undefined?!![]:![]:!![],'where':_0x3239f9['options']?_0x3239f9['options'][_0x0c20('0x1a')]||null:null,'attributes':_0x3239f9[_0x0c20('0x18')]?_0x3239f9[_0x0c20('0x18')]['attributes']||null:null,'limit':_0x3239f9[_0x0c20('0x18')]?_0x3239f9[_0x0c20('0x18')][_0x0c20('0x1b')]||null:null,'include':_0x3239f9[_0x0c20('0x18')]?_0x3239f9[_0x0c20('0x18')][_0x0c20('0x1c')]?_['map'](_0x3239f9[_0x0c20('0x18')]['include'],function(_0x122dd8){return{'model':db[_0x122dd8['model']],'as':_0x122dd8['as'],'attributes':_0x122dd8[_0x0c20('0x1d')],'include':_0x122dd8[_0x0c20('0x1c')]?_[_0x0c20('0x1e')](_0x122dd8[_0x0c20('0x1c')],function(_0x3b7545){return{'model':db[_0x3b7545['model']],'as':_0x3b7545['as'],'attributes':_0x3b7545[_0x0c20('0x1d')],'include':_0x3b7545[_0x0c20('0x1c')]?_[_0x0c20('0x1e')](_0x3b7545[_0x0c20('0x1c')],function(_0x3723a3){return{'model':db[_0x3723a3['model']],'as':_0x3723a3['as'],'attributes':_0x3723a3[_0x0c20('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0c20('0xc')](function(_0x51c55c){logger[_0x0c20('0x1f')](_0x0c20('0x20'),_0x3239f9);logger[_0x0c20('0xd')](_0x0c20('0x20'),_0x3239f9,JSON[_0x0c20('0x21')](_0x51c55c));_0x27bebb(_0x51c55c);})[_0x0c20('0x15')](function(_0x3d509e){logger['error'](_0x0c20('0x20'),_0x3d509e[_0x0c20('0x11')],_0x3239f9);_0x3b3cdc(_0x3c1e25[_0x0c20('0xf')](0x1f4,_0x3d509e[_0x0c20('0x11')]));});});};exports['ShowTrigger']=function(_0x144769){var _0x9eac7=this;return new Promise(function(_0x2298a7,_0x2a55e1){return db[_0x0c20('0x16')][_0x0c20('0x22')]({'raw':_0x144769[_0x0c20('0x18')]?_0x144769['options'][_0x0c20('0x19')]===undefined?!![]:![]:!![],'where':_0x144769[_0x0c20('0x18')]?_0x144769[_0x0c20('0x18')][_0x0c20('0x1a')]||null:null,'attributes':_0x144769[_0x0c20('0x18')]?_0x144769[_0x0c20('0x18')]['attributes']||null:null,'include':_0x144769[_0x0c20('0x18')]?_0x144769['options'][_0x0c20('0x1c')]?_[_0x0c20('0x1e')](_0x144769[_0x0c20('0x18')][_0x0c20('0x1c')],function(_0x4999df){return{'model':db[_0x4999df[_0x0c20('0x23')]],'as':_0x4999df['as'],'attributes':_0x4999df[_0x0c20('0x1d')],'include':_0x4999df['include']?_[_0x0c20('0x1e')](_0x4999df[_0x0c20('0x1c')],function(_0xac011e){return{'model':db[_0xac011e[_0x0c20('0x23')]],'as':_0xac011e['as'],'attributes':_0xac011e[_0x0c20('0x1d')],'include':_0xac011e[_0x0c20('0x1c')]?_[_0x0c20('0x1e')](_0xac011e[_0x0c20('0x1c')],function(_0x39a956){return{'model':db[_0x39a956['model']],'as':_0x39a956['as'],'attributes':_0x39a956[_0x0c20('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1da606){logger[_0x0c20('0x1f')](_0x0c20('0x24'),_0x144769);logger['debug'](_0x0c20('0x24'),_0x144769,JSON[_0x0c20('0x21')](_0x1da606));_0x2298a7(_0x1da606);})['catch'](function(_0x1b76b4){logger[_0x0c20('0xf')](_0x0c20('0x24'),_0x1b76b4[_0x0c20('0x11')],_0x144769);_0x2a55e1(_0x9eac7[_0x0c20('0xf')](0x1f4,_0x1b76b4[_0x0c20('0x11')]));});});}; \ No newline at end of file +var _0xb0e0=['client','http','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetTrigger','Trigger','options','raw','where','attributes','include','map','model','info','ShowTrigger','util','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise'];(function(_0x51fcd6,_0x2f83fc){var _0x5626e2=function(_0x4d9ee){while(--_0x4d9ee){_0x51fcd6['push'](_0x51fcd6['shift']());}};_0x5626e2(++_0x2f83fc);}(_0xb0e0,0x72));var _0x0b0e=function(_0x46ff9a,_0xe72687){_0x46ff9a=_0x46ff9a-0x0;var _0x3173c7=_0xb0e0[_0x46ff9a];return _0x3173c7;};'use strict';var _=require('lodash');var util=require(_0x0b0e('0x0'));var moment=require('moment');var BPromise=require(_0x0b0e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b0e('0x2'));var db=require(_0x0b0e('0x3'))['db'];var utils=require(_0x0b0e('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0b0e('0x5'));var client=jayson[_0x0b0e('0x6')][_0x0b0e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x296abf,_0x17bf42,_0x5a2b3d){return new BPromise(function(_0x233866,_0x4087c8){return client['request'](_0x296abf,_0x5a2b3d)[_0x0b0e('0x8')](function(_0x609e33){logger['info'](_0x0b0e('0x9'),_0x17bf42,_0x0b0e('0xa'));logger[_0x0b0e('0xb')](_0x0b0e('0xc'),_0x17bf42,'request\x20sent',JSON[_0x0b0e('0xd')](_0x609e33));if(_0x609e33['error']){if(_0x609e33['error'][_0x0b0e('0xe')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x17bf42,_0x609e33[_0x0b0e('0xf')][_0x0b0e('0x10')]);return _0x4087c8(_0x609e33['error'][_0x0b0e('0x10')]);}logger[_0x0b0e('0xf')](_0x0b0e('0x9'),_0x17bf42,_0x609e33[_0x0b0e('0xf')][_0x0b0e('0x10')]);return _0x233866(_0x609e33[_0x0b0e('0xf')]['message']);}else{logger['info'](_0x0b0e('0x9'),_0x17bf42,_0x0b0e('0xa'));_0x233866(_0x609e33[_0x0b0e('0x11')][_0x0b0e('0x10')]);}})[_0x0b0e('0x12')](function(_0x173250){logger[_0x0b0e('0xf')]('Trigger,\x20%s,\x20%s',_0x17bf42,_0x173250);_0x4087c8(_0x173250);});});}exports[_0x0b0e('0x13')]=function(_0x46bbce){var _0x516d39=this;return new Promise(function(_0x23e76e,_0x154db5){return db[_0x0b0e('0x14')]['findAll']({'raw':_0x46bbce[_0x0b0e('0x15')]?_0x46bbce['options'][_0x0b0e('0x16')]===undefined?!![]:![]:!![],'where':_0x46bbce[_0x0b0e('0x15')]?_0x46bbce[_0x0b0e('0x15')][_0x0b0e('0x17')]||null:null,'attributes':_0x46bbce[_0x0b0e('0x15')]?_0x46bbce[_0x0b0e('0x15')][_0x0b0e('0x18')]||null:null,'limit':_0x46bbce[_0x0b0e('0x15')]?_0x46bbce[_0x0b0e('0x15')]['limit']||null:null,'include':_0x46bbce[_0x0b0e('0x15')]?_0x46bbce[_0x0b0e('0x15')][_0x0b0e('0x19')]?_[_0x0b0e('0x1a')](_0x46bbce['options'][_0x0b0e('0x19')],function(_0xe6658b){return{'model':db[_0xe6658b['model']],'as':_0xe6658b['as'],'attributes':_0xe6658b[_0x0b0e('0x18')],'include':_0xe6658b[_0x0b0e('0x19')]?_[_0x0b0e('0x1a')](_0xe6658b[_0x0b0e('0x19')],function(_0x1db9df){return{'model':db[_0x1db9df[_0x0b0e('0x1b')]],'as':_0x1db9df['as'],'attributes':_0x1db9df[_0x0b0e('0x18')],'include':_0x1db9df['include']?_[_0x0b0e('0x1a')](_0x1db9df[_0x0b0e('0x19')],function(_0x2bfd3c){return{'model':db[_0x2bfd3c['model']],'as':_0x2bfd3c['as'],'attributes':_0x2bfd3c[_0x0b0e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0b0e('0x8')](function(_0x44ec8d){logger[_0x0b0e('0x1c')](_0x0b0e('0x13'),_0x46bbce);logger['debug'](_0x0b0e('0x13'),_0x46bbce,JSON[_0x0b0e('0xd')](_0x44ec8d));_0x23e76e(_0x44ec8d);})[_0x0b0e('0x12')](function(_0x1a995a){logger[_0x0b0e('0xf')](_0x0b0e('0x13'),_0x1a995a[_0x0b0e('0x10')],_0x46bbce);_0x154db5(_0x516d39[_0x0b0e('0xf')](0x1f4,_0x1a995a[_0x0b0e('0x10')]));});});};exports['ShowTrigger']=function(_0x421d5c){var _0x307f55=this;return new Promise(function(_0x1ffed9,_0x38e665){return db[_0x0b0e('0x14')]['find']({'raw':_0x421d5c['options']?_0x421d5c[_0x0b0e('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x421d5c[_0x0b0e('0x15')]?_0x421d5c['options'][_0x0b0e('0x17')]||null:null,'attributes':_0x421d5c[_0x0b0e('0x15')]?_0x421d5c[_0x0b0e('0x15')][_0x0b0e('0x18')]||null:null,'include':_0x421d5c[_0x0b0e('0x15')]?_0x421d5c[_0x0b0e('0x15')][_0x0b0e('0x19')]?_[_0x0b0e('0x1a')](_0x421d5c[_0x0b0e('0x15')][_0x0b0e('0x19')],function(_0x45c9c6){return{'model':db[_0x45c9c6[_0x0b0e('0x1b')]],'as':_0x45c9c6['as'],'attributes':_0x45c9c6['attributes'],'include':_0x45c9c6['include']?_[_0x0b0e('0x1a')](_0x45c9c6[_0x0b0e('0x19')],function(_0x307177){return{'model':db[_0x307177[_0x0b0e('0x1b')]],'as':_0x307177['as'],'attributes':_0x307177[_0x0b0e('0x18')],'include':_0x307177['include']?_[_0x0b0e('0x1a')](_0x307177[_0x0b0e('0x19')],function(_0x1885f5){return{'model':db[_0x1885f5[_0x0b0e('0x1b')]],'as':_0x1885f5['as'],'attributes':_0x1885f5[_0x0b0e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0b0e('0x8')](function(_0x4be712){logger[_0x0b0e('0x1c')](_0x0b0e('0x1d'),_0x421d5c);logger['debug'](_0x0b0e('0x1d'),_0x421d5c,JSON[_0x0b0e('0xd')](_0x4be712));_0x1ffed9(_0x4be712);})[_0x0b0e('0x12')](function(_0x1e596e){logger[_0x0b0e('0xf')](_0x0b0e('0x1d'),_0x1e596e[_0x0b0e('0x10')],_0x421d5c);_0x38e665(_0x307f55[_0x0b0e('0xf')](0x1f4,_0x1e596e['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 3ec9d73..02c28a8 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 _0xd77a=['fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','post','/:id/clone','clone','create','put','update','/:id','exports','multer','path','connect-timeout','express'];(function(_0x2241f8,_0x4af10d){var _0x19e532=function(_0xbaefb6){while(--_0xbaefb6){_0x2241f8['push'](_0x2241f8['shift']());}};_0x19e532(++_0x4af10d);}(_0xd77a,0x178));var _0xad77=function(_0x30f71d,_0x526d58){_0x30f71d=_0x30f71d-0x0;var _0x2af603=_0xd77a[_0x30f71d];return _0x2af603;};'use strict';var multer=require(_0xad77('0x0'));var util=require('util');var path=require(_0xad77('0x1'));var timeout=require(_0xad77('0x2'));var express=require(_0xad77('0x3'));var router=express['Router']();var fs_extra=require(_0xad77('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xad77('0x5'));var config=require(_0xad77('0x6'));var controller=require('./trunk.controller');router['get']('/',auth[_0xad77('0x7')](),controller[_0xad77('0x8')]);router[_0xad77('0x9')]('/:id',auth[_0xad77('0x7')](),controller[_0xad77('0xa')]);router[_0xad77('0xb')](_0xad77('0xc'),auth[_0xad77('0x7')](),controller[_0xad77('0xd')]);router[_0xad77('0xb')]('/',auth[_0xad77('0x7')](),controller[_0xad77('0xe')]);router[_0xad77('0xf')]('/:id',auth[_0xad77('0x7')](),controller[_0xad77('0x10')]);router['delete'](_0xad77('0x11'),auth[_0xad77('0x7')](),controller['destroy']);module[_0xad77('0x12')]=router; \ No newline at end of file +var _0x6789=['/:id/clone','clone','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','get','/:id','post'];(function(_0x5db030,_0xba34a0){var _0x45dc4e=function(_0x1a0ef9){while(--_0x1a0ef9){_0x5db030['push'](_0x5db030['shift']());}};_0x45dc4e(++_0xba34a0);}(_0x6789,0x1aa));var _0x9678=function(_0x28406c,_0xb0fcd7){_0x28406c=_0x28406c-0x0;var _0x53c6e0=_0x6789[_0x28406c];return _0x53c6e0;};'use strict';var multer=require(_0x9678('0x0'));var util=require(_0x9678('0x1'));var path=require(_0x9678('0x2'));var timeout=require(_0x9678('0x3'));var express=require(_0x9678('0x4'));var router=express['Router']();var fs_extra=require(_0x9678('0x5'));var auth=require(_0x9678('0x6'));var interaction=require(_0x9678('0x7'));var config=require(_0x9678('0x8'));var controller=require(_0x9678('0x9'));router['get']('/',auth[_0x9678('0xa')](),controller['index']);router[_0x9678('0xb')](_0x9678('0xc'),auth[_0x9678('0xa')](),controller['show']);router[_0x9678('0xd')](_0x9678('0xe'),auth['isAuthenticated'](),controller[_0x9678('0xf')]);router[_0x9678('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9678('0x10')](_0x9678('0xc'),auth[_0x9678('0xa')](),controller[_0x9678('0x11')]);router[_0x9678('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x9678('0x13')]);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 524359c..91d82b3 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 _0x427c=['yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','insecure','never','INTEGER','\x22\x22\x20<>','accept','uac','uas','active','passive','actpass','dynamic','update,nonat','BOOLEAN','exports','name','ENUM','friend','user','peer','STRING','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','rfc2833','nonat','update','outgoing'];(function(_0x42dc70,_0x5a4024){var _0x423268=function(_0x2736c5){while(--_0x2736c5){_0x42dc70['push'](_0x42dc70['shift']());}};_0x423268(++_0x5a4024);}(_0x427c,0x1eb));var _0xc427=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x427c[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xc427('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc427('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc427('0x2')](_0xc427('0x3'),_0xc427('0x4'),_0xc427('0x5')),'allowNull':![],'defaultValue':_0xc427('0x3')},'context':{'type':Sequelize[_0xc427('0x6')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xc427('0x2')]('ALLOWED_NOT_SCREENED',_0xc427('0x7'),_0xc427('0x8'),'ALLOWED',_0xc427('0x9'),_0xc427('0xa'),_0xc427('0xb'),_0xc427('0xc'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xc427('0x6')]},'remotesecret':{'type':Sequelize[_0xc427('0x6')]},'transport':{'type':Sequelize[_0xc427('0x6')],'defaultValue':'udp','set':function(_0x257276){this[_0xc427('0xd')](_0xc427('0xe'),_0x257276?_0x257276[_0xc427('0xf')](','):null);},'get':function(){return this[_0xc427('0x10')](_0xc427('0xe'))?this[_0xc427('0x10')](_0xc427('0xe'))[_0xc427('0x11')](','):null;},'comment':_0xc427('0x12')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0xc427('0x13'),_0xc427('0x14'),_0xc427('0x15'),'auto'),'defaultValue':_0xc427('0x16')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0xc427('0x17'),_0xc427('0x18'),_0xc427('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc427('0x2')](_0xc427('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xc427('0x6')]},'nat':{'type':Sequelize[_0xc427('0x6')],'defaultValue':_0xc427('0x1b'),'set':function(_0x18c256){this[_0xc427('0xd')]('nat',_0x18c256?_0x18c256[_0xc427('0xf')](','):null);},'get':function(){return this['getDataValue']('nat')?this['getDataValue'](_0xc427('0x1c'))[_0xc427('0x11')](','):null;},'comment':_0xc427('0x1d')},'callgroup':{'type':Sequelize[_0xc427('0x6')]},'namedcallgroup':{'type':Sequelize[_0xc427('0x6')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xc427('0x6')]},'language':{'type':Sequelize[_0xc427('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc427('0x6')],'defaultValue':_0xc427('0x1e')},'allow':{'type':Sequelize[_0xc427('0x6')],'allowNull':![],'defaultValue':_0xc427('0x1f'),'set':function(_0x378a6a){this[_0xc427('0xd')](_0xc427('0x20'),_0x378a6a?_0x378a6a['join'](';'):_0xc427('0x1f'));},'get':function(){return this[_0xc427('0x10')](_0xc427('0x20'))?this[_0xc427('0x10')](_0xc427('0x20'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xc427('0x1a'),'no')},'insecure':{'type':Sequelize[_0xc427('0x6')],'defaultValue':_0xc427('0x21'),'set':function(_0x3b563d){this[_0xc427('0xd')]('insecure',_0x3b563d?_0x3b563d[_0xc427('0xf')](','):null);},'get':function(){return this[_0xc427('0x10')](_0xc427('0x22'))?this[_0xc427('0x10')](_0xc427('0x22'))[_0xc427('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0xc427('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc427('0x2')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc427('0x2')]('yes','no',_0xc427('0x23'))},'promiscredir':{'type':Sequelize[_0xc427('0x2')](_0xc427('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0xc427('0x2')](_0xc427('0x1a'),'no')},'accountcode':{'type':Sequelize[_0xc427('0x24')](0xb)},'setvar':{'type':Sequelize[_0xc427('0x6')]},'callerid':{'type':Sequelize[_0xc427('0x6')],'defaultValue':_0xc427('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xc427('0x2')](_0xc427('0x1a'),'no'),'defaultValue':_0xc427('0x1a')},'busylevel':{'type':Sequelize[_0xc427('0x24')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xc427('0x1a'),'no')},'allowsubscribe':{'type':Sequelize[_0xc427('0x2')](_0xc427('0x1a'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xc427('0x2')](_0xc427('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0xc427('0x6')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xc427('0x2')](_0xc427('0x1a'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc427('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xc427('0x2')]('yes','no')},'mailbox':{'type':Sequelize[_0xc427('0x6')]},'session_timers':{'type':Sequelize[_0xc427('0x2')](_0xc427('0x26'),'refuse','originate')},'session_expires':{'type':Sequelize[_0xc427('0x24')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xc427('0x2')](_0xc427('0x27'),_0xc427('0x28')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xc427('0x6')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xc427('0x6')]},'fromuser':{'type':Sequelize[_0xc427('0x6')]},'port':{'type':Sequelize[_0xc427('0x24')](0x5)},'qualify':{'type':Sequelize[_0xc427('0x2')](_0xc427('0x1a'),'no'),'defaultValue':_0xc427('0x1a')},'keepalive':{'type':Sequelize[_0xc427('0x24')](0xb)},'defaultip':{'type':Sequelize[_0xc427('0x6')]},'defaultuser':{'type':Sequelize[_0xc427('0x6')]},'rtptimeout':{'type':Sequelize[_0xc427('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xc427('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xc427('0x2')]('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc427('0x6')]},'callbackextension':{'type':Sequelize[_0xc427('0x6')]},'timert1':{'type':Sequelize[_0xc427('0x24')](0xb)},'timerb':{'type':Sequelize[_0xc427('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0xc427('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0xc427('0x6')]},'contactdeny':{'type':Sequelize[_0xc427('0x6')]},'contactacl':{'type':Sequelize[_0xc427('0x6')]},'unsolicited_mailbox':{'type':Sequelize[_0xc427('0x6')]},'use_q850_reason':{'type':Sequelize[_0xc427('0x6')]},'maxforwards':{'type':Sequelize[_0xc427('0x24')](0xb)},'encryption':{'type':Sequelize[_0xc427('0x2')](_0xc427('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc427('0x2')]('yes','no')},'force_avp':{'type':Sequelize[_0xc427('0x2')](_0xc427('0x1a'),'no')},'icesupport':{'type':Sequelize[_0xc427('0x2')](_0xc427('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0xc427('0x2')](_0xc427('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0xc427('0x2')]('yes','no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0xc427('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xc427('0x6')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xc427('0x6')]},'dtlscafile':{'type':Sequelize[_0xc427('0x6')]},'dtlscapath':{'type':Sequelize[_0xc427('0x6')]},'dtlssetup':{'type':Sequelize[_0xc427('0x2')](_0xc427('0x29'),_0xc427('0x2a'),_0xc427('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc427('0x6')]},'usereqphone':{'type':Sequelize[_0xc427('0x2')](_0xc427('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc427('0x6')]},'recordofffeature':{'type':Sequelize[_0xc427('0x6')]},'call_limit':{'type':Sequelize[_0xc427('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xc427('0x2')](_0xc427('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0xc427('0x2')](_0xc427('0x1a'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xc427('0x6')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc427('0x6')]},'host':{'type':Sequelize[_0xc427('0x6')],'defaultValue':_0xc427('0x2c')},'canreinvite':{'type':Sequelize[_0xc427('0x2')](_0xc427('0x1a'),'no',_0xc427('0x17'),_0xc427('0x18'),_0xc427('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc427('0x6')]},'otherFields':{'type':Sequelize[_0xc427('0x6')]},'active':{'type':Sequelize[_0xc427('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc427('0x6')],'defaultValue':'no'}}; \ No newline at end of file +var _0x3b6c=['update,nonat','BOOLEAN','sequelize','STRING','ENUM','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','pai','certificate','passive','actpass','dynamic','update'];(function(_0x4af13d,_0xdf11d){var _0x51b1b5=function(_0x33fc59){while(--_0x33fc59){_0x4af13d['push'](_0x4af13d['shift']());}};_0x51b1b5(++_0xdf11d);}(_0x3b6c,0xc2));var _0xc3b6=function(_0x50e375,_0xf84903){_0x50e375=_0x50e375-0x0;var _0xccfa14=_0x3b6c[_0x50e375];return _0xccfa14;};'use strict';var Sequelize=require(_0xc3b6('0x0'));module['exports']={'name':{'type':Sequelize[_0xc3b6('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc3b6('0x2')]('friend','user',_0xc3b6('0x3')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x4'),_0xc3b6('0x5'),_0xc3b6('0x6'),_0xc3b6('0x7'),_0xc3b6('0x8'),_0xc3b6('0x9'),_0xc3b6('0xa'),'PROHIB')},'deny':{'type':Sequelize[_0xc3b6('0x1')]},'permit':{'type':Sequelize[_0xc3b6('0x1')]},'secret':{'type':Sequelize[_0xc3b6('0x1')]},'md5secret':{'type':Sequelize[_0xc3b6('0x1')]},'remotesecret':{'type':Sequelize[_0xc3b6('0x1')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xc3b6('0xb'),'set':function(_0x58a0de){this[_0xc3b6('0xc')](_0xc3b6('0xd'),_0x58a0de?_0x58a0de[_0xc3b6('0xe')](','):null);},'get':function(){return this['getDataValue'](_0xc3b6('0xd'))?this[_0xc3b6('0xf')](_0xc3b6('0xd'))[_0xc3b6('0x10')](','):null;},'comment':_0xc3b6('0x11')},'dtmfmode':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x12'),_0xc3b6('0x13'),_0xc3b6('0x14'),'inband','auto'),'defaultValue':_0xc3b6('0x12')},'directmedia':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x15'),'no',_0xc3b6('0x16'),'update',_0xc3b6('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc3b6('0x1')]},'directmediadeny':{'type':Sequelize[_0xc3b6('0x1')]},'nat':{'type':Sequelize[_0xc3b6('0x1')],'defaultValue':_0xc3b6('0x18'),'set':function(_0x3945b9){this['setDataValue']('nat',_0x3945b9?_0x3945b9[_0xc3b6('0xe')](','):null);},'get':function(){return this[_0xc3b6('0xf')](_0xc3b6('0x19'))?this['getDataValue'](_0xc3b6('0x19'))[_0xc3b6('0x10')](','):null;},'comment':_0xc3b6('0x1a')},'callgroup':{'type':Sequelize[_0xc3b6('0x1')]},'namedcallgroup':{'type':Sequelize[_0xc3b6('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xc3b6('0x1')]},'language':{'type':Sequelize[_0xc3b6('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc3b6('0x1')],'defaultValue':_0xc3b6('0x1b')},'allow':{'type':Sequelize[_0xc3b6('0x1')],'allowNull':![],'defaultValue':_0xc3b6('0x1c'),'set':function(_0x47d9e4){this[_0xc3b6('0xc')]('allow',_0x47d9e4?_0x47d9e4[_0xc3b6('0xe')](';'):_0xc3b6('0x1c'));},'get':function(){return this[_0xc3b6('0xf')]('allow')?this[_0xc3b6('0xf')](_0xc3b6('0x1d'))['split'](';'):null;},'comment':_0xc3b6('0x1e')},'autoframing':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x15'),'no')},'insecure':{'type':Sequelize[_0xc3b6('0x1')],'defaultValue':'port,invite','set':function(_0x432bdb){this[_0xc3b6('0xc')](_0xc3b6('0x1f'),_0x432bdb?_0x432bdb[_0xc3b6('0xe')](','):null);},'get':function(){return this[_0xc3b6('0xf')](_0xc3b6('0x1f'))?this[_0xc3b6('0xf')](_0xc3b6('0x1f'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc3b6('0x2')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x15'),'no',_0xc3b6('0x20'))},'promiscredir':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x15'),'no')},'useclientcode':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x15'),'no')},'accountcode':{'type':Sequelize[_0xc3b6('0x21')](0xb)},'setvar':{'type':Sequelize[_0xc3b6('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xc3b6('0x22')},'amaflags':{'type':Sequelize[_0xc3b6('0x1')]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xc3b6('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x15'),'no')},'allowsubscribe':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0xc3b6('0x2')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0xc3b6('0x1')]},'template':{'type':Sequelize[_0xc3b6('0x1')]},'videosupport':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x15'),'no',_0xc3b6('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc3b6('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xc3b6('0x15'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x24'),_0xc3b6('0x25'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xc3b6('0x21')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xc3b6('0x26'),'uas'),'defaultValue':_0xc3b6('0x27')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xc3b6('0x1')]},'fromdomain':{'type':Sequelize[_0xc3b6('0x1')]},'fromuser':{'type':Sequelize[_0xc3b6('0x1')]},'port':{'type':Sequelize[_0xc3b6('0x21')](0x5)},'qualify':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x15'),'no'),'defaultValue':_0xc3b6('0x15')},'keepalive':{'type':Sequelize[_0xc3b6('0x21')](0xb)},'defaultip':{'type':Sequelize[_0xc3b6('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0xc3b6('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xc3b6('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xc3b6('0x21')](0xb)},'sendrpid':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x15'),'no',_0xc3b6('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc3b6('0x1')]},'callbackextension':{'type':Sequelize[_0xc3b6('0x1')]},'timert1':{'type':Sequelize[_0xc3b6('0x21')](0xb)},'timerb':{'type':Sequelize[_0xc3b6('0x21')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xc3b6('0x1')]},'contactdeny':{'type':Sequelize[_0xc3b6('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xc3b6('0x1')]},'use_q850_reason':{'type':Sequelize[_0xc3b6('0x1')]},'maxforwards':{'type':Sequelize[_0xc3b6('0x21')](0xb)},'encryption':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc3b6('0x2')]('yes','no')},'force_avp':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x15'),'no')},'icesupport':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x15'),'no','fingerprint',_0xc3b6('0x29'))},'dtlsrekey':{'type':Sequelize[_0xc3b6('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0xc3b6('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xc3b6('0x1')]},'dtlscipher':{'type':Sequelize[_0xc3b6('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xc3b6('0x2')]('active',_0xc3b6('0x2a'),_0xc3b6('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc3b6('0x1')]},'recordofffeature':{'type':Sequelize[_0xc3b6('0x1')]},'call_limit':{'type':Sequelize[_0xc3b6('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0xc3b6('0x2')](_0xc3b6('0x15'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xc3b6('0x1')]},'mohsuggest':{'type':Sequelize[_0xc3b6('0x1')]},'parkinglot':{'type':Sequelize[_0xc3b6('0x1')]},'description':{'type':Sequelize[_0xc3b6('0x1')]},'host':{'type':Sequelize[_0xc3b6('0x1')],'defaultValue':_0xc3b6('0x2c')},'canreinvite':{'type':Sequelize[_0xc3b6('0x2')]('yes','no',_0xc3b6('0x16'),_0xc3b6('0x2d'),_0xc3b6('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc3b6('0x1')]},'otherFields':{'type':Sequelize[_0xc3b6('0x1')]},'active':{'type':Sequelize[_0xc3b6('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc3b6('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 274d63d..4aefd92 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 _0x98a8=['../../mysqldb','jayson/promise','client','request','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Trunks','UserProfileResource','stack','name','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Trunk','include','show','params','keys','rawAttributes','includeAll','clone','find','createdAt','updatedAt','body','omit','create','user','role','UserProfileSection','userProfileId','autoAssociation','findAll','readFileSync','root','server/files/templates/trunk.ejs','join','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x17397c,_0x524c74){var _0x10bf53=function(_0x4f24d1){while(--_0x4f24d1){_0x17397c['push'](_0x17397c['shift']());}};_0x10bf53(++_0x524c74);}(_0x98a8,0x12c));var _0x898a=function(_0x1cad41,_0x5b2b4c){_0x1cad41=_0x1cad41-0x0;var _0x48b89d=_0x98a8[_0x1cad41];return _0x48b89d;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];var jayson=require(_0x898a('0x19'));var client=jayson[_0x898a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfded,_0x5b5c9c,_0x373d53,_0x1f5be4){return new BPromise(function(_0xb24335,_0x116fbe){var _0x1873e9=_0x1f5be4||client;return _0x1873e9[_0x898a('0x1b')](_0x5bfded,_0x373d53)['then'](function(_0x47033c){logger['info'](_0x898a('0x1c'),_0x5b5c9c,'request\x20sent');logger[_0x898a('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5b5c9c,_0x898a('0x1e'),JSON['stringify'](_0x47033c));if(_0x47033c[_0x898a('0x1f')]){if(_0x47033c[_0x898a('0x1f')][_0x898a('0x20')]===0x1f4){logger['error'](_0x898a('0x1c'),_0x5b5c9c,_0x47033c['error']['message']);return _0x116fbe(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5b5c9c,_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);return _0xb24335(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}else{logger[_0x898a('0x22')](_0x898a('0x1c'),_0x5b5c9c,_0x898a('0x1e'));_0xb24335(_0x47033c['result'][_0x898a('0x21')]);}})[_0x898a('0x23')](function(_0x11cae2){logger[_0x898a('0x1f')](_0x898a('0x1c'),_0x5b5c9c,_0x11cae2);_0x116fbe(_0x11cae2);});});}function respondWithStatusCode(_0x310bfa,_0x4e254d){_0x4e254d=_0x4e254d||0xcc;return function(_0x274cdf){if(_0x274cdf){return _0x310bfa[_0x898a('0x24')](_0x4e254d);}return _0x310bfa[_0x898a('0x25')](_0x4e254d)[_0x898a('0x26')]();};}function respondWithResult(_0x3901ab,_0x1426e3){_0x1426e3=_0x1426e3||0xc8;return function(_0x5b7719){if(_0x5b7719){return _0x3901ab[_0x898a('0x25')](_0x1426e3)['json'](_0x5b7719);}};}function respondWithFilteredResult(_0x513c6b,_0x53ddb2){return function(_0x3678be){if(_0x3678be){var _0x1f4d86=typeof _0x53ddb2[_0x898a('0x27')]===_0x898a('0x28')&&typeof _0x53ddb2[_0x898a('0x29')]===_0x898a('0x28');var _0x398e98=_0x3678be[_0x898a('0x2a')];var _0xd31922=_0x1f4d86?0x0:_0x53ddb2['offset'];var _0x4b3e68=_0x1f4d86?_0x3678be['count']:_0x53ddb2[_0x898a('0x27')]+_0x53ddb2[_0x898a('0x29')];var _0x3b7704;if(_0x4b3e68>=_0x398e98){_0x4b3e68=_0x398e98;_0x3b7704=0xc8;}else{_0x3b7704=0xce;}_0x513c6b[_0x898a('0x25')](_0x3b7704);return _0x513c6b[_0x898a('0x2b')](_0x898a('0x2c'),_0xd31922+'-'+_0x4b3e68+'/'+_0x398e98)[_0x898a('0x2d')](_0x3678be);}return null;};}function patchUpdates(_0xf74645){return function(_0x18773a){try{jsonpatch[_0x898a('0x2e')](_0x18773a,_0xf74645,!![]);}catch(_0x44c5d2){return BPromise[_0x898a('0x2f')](_0x44c5d2);}return _0x18773a['save']();};}function saveUpdates(_0x7a1eb5,_0x17a5f3){return function(_0x26eead){if(_0x26eead){return _0x26eead[_0x898a('0x30')](_0x7a1eb5)[_0x898a('0x31')](function(_0x47af5b){return _0x47af5b;});}return null;};}function removeEntity(_0x48cefb,_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x32')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x33')]({'plain':!![]});var _0x5eafc7=_0x898a('0x34');return db[_0x898a('0x35')][_0x898a('0x32')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x31')](function(){return _0x1e2fd4;});})[_0x898a('0x31')](function(){_0x48cefb['status'](0xcc)[_0x898a('0x26')]();});}};}function handleEntityNotFound(_0x5baf5b,_0x573eb3){return function(_0x14e2dc){if(!_0x14e2dc){_0x5baf5b['sendStatus'](0x194);}return _0x14e2dc;};}function handleError(_0x3c9588,_0x4b3aac){_0x4b3aac=_0x4b3aac||0x1f4;return function(_0x37cb11){logger['error'](_0x37cb11[_0x898a('0x36')]);if(_0x37cb11[_0x898a('0x37')]){delete _0x37cb11[_0x898a('0x37')];}_0x3c9588['status'](_0x4b3aac)['send'](_0x37cb11);};}exports['index']=function(_0x1575d2,_0x429c32){var _0x5a228f={},_0xdd019d={},_0x3d3463={'count':0x0,'rows':[]};var _0xe84f7e=_[_0x898a('0x38')](db['Trunk']['rawAttributes'],function(_0x3aed01){return{'name':_0x3aed01[_0x898a('0x39')],'type':_0x3aed01['type']['key']};});_0xdd019d[_0x898a('0x3a')]=_[_0x898a('0x38')](_0xe84f7e,_0x898a('0x37'));_0xdd019d[_0x898a('0x3b')]=_['keys'](_0x1575d2[_0x898a('0x3b')]);_0xdd019d[_0x898a('0x3c')]=_['intersection'](_0xdd019d['model'],_0xdd019d['query']);_0x5a228f[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0xdd019d[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x3f')]));_0x5a228f[_0x898a('0x3d')]=_0x5a228f[_0x898a('0x3d')][_0x898a('0x40')]?_0x5a228f[_0x898a('0x3d')]:_0xdd019d[_0x898a('0x3a')];if(!_0x1575d2[_0x898a('0x3b')][_0x898a('0x41')](_0x898a('0x42'))){_0x5a228f[_0x898a('0x29')]=qs['limit'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x29')]);_0x5a228f[_0x898a('0x27')]=qs['offset'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x27')]);}_0x5a228f[_0x898a('0x43')]=qs[_0x898a('0x44')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x44')]);_0x5a228f[_0x898a('0x45')]=qs[_0x898a('0x3c')](_['pick'](_0x1575d2[_0x898a('0x3b')],_0xdd019d[_0x898a('0x3c')]),_0xe84f7e);if(_0x1575d2[_0x898a('0x3b')][_0x898a('0x46')]){_0x5a228f['where']=_[_0x898a('0x47')](_0x5a228f[_0x898a('0x45')],{'$or':_['map'](_0xe84f7e,function(_0x241677){if(_0x241677['type']!==_0x898a('0x48')){var _0x5137c4={};_0x5137c4[_0x241677['name']]={'$like':'%'+_0x1575d2[_0x898a('0x3b')]['filter']+'%'};return _0x5137c4;}})});}_0x5a228f=_[_0x898a('0x47')]({},_0x5a228f,_0x1575d2[_0x898a('0x49')]);var _0x4d6ac0={'where':_0x5a228f[_0x898a('0x45')]};return db[_0x898a('0x4a')]['count'](_0x4d6ac0)[_0x898a('0x31')](function(_0x199437){_0x3d3463[_0x898a('0x2a')]=_0x199437;if(_0x1575d2[_0x898a('0x3b')]['includeAll']){_0x5a228f[_0x898a('0x4b')]=[{'all':!![]}];}return db[_0x898a('0x4a')]['findAll'](_0x5a228f);})[_0x898a('0x31')](function(_0x1d8c16){_0x3d3463['rows']=_0x1d8c16;return _0x3d3463;})[_0x898a('0x31')](respondWithFilteredResult(_0x429c32,_0x5a228f))['catch'](handleError(_0x429c32,null));};exports[_0x898a('0x4c')]=function(_0x41f291,_0x32ccb9){var _0x50f9e3={'raw':![],'where':{'id':_0x41f291[_0x898a('0x4d')]['id']}},_0x2f6cb3={};_0x2f6cb3[_0x898a('0x3a')]=_[_0x898a('0x4e')](db['Trunk'][_0x898a('0x4f')]);_0x2f6cb3['query']=_[_0x898a('0x4e')](_0x41f291[_0x898a('0x3b')]);_0x2f6cb3[_0x898a('0x3c')]=_['intersection'](_0x2f6cb3[_0x898a('0x3a')],_0x2f6cb3[_0x898a('0x3b')]);_0x50f9e3[_0x898a('0x3d')]=_['intersection'](_0x2f6cb3['model'],qs[_0x898a('0x3f')](_0x41f291[_0x898a('0x3b')][_0x898a('0x3f')]));_0x50f9e3[_0x898a('0x3d')]=_0x50f9e3[_0x898a('0x3d')][_0x898a('0x40')]?_0x50f9e3[_0x898a('0x3d')]:_0x2f6cb3[_0x898a('0x3a')];if(_0x41f291[_0x898a('0x3b')][_0x898a('0x50')]){_0x50f9e3[_0x898a('0x4b')]=[{'all':!![]}];}_0x50f9e3=_['merge']({},_0x50f9e3,_0x41f291[_0x898a('0x49')]);return db[_0x898a('0x4a')]['find'](_0x50f9e3)[_0x898a('0x31')](handleEntityNotFound(_0x32ccb9,null))['then'](respondWithResult(_0x32ccb9,null))['catch'](handleError(_0x32ccb9,null));};exports[_0x898a('0x51')]=function(_0x124f9b,_0x209529){var _0x5bfd61={'where':{'id':_0x124f9b[_0x898a('0x4d')]['id']}},_0x556fd8={};_0x556fd8[_0x898a('0x3a')]=_['keys'](db[_0x898a('0x4a')][_0x898a('0x4f')]);_0x5bfd61['attributes']=_[_0x898a('0x3e')](_0x556fd8[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x124f9b['query'][_0x898a('0x3f')]));_0x5bfd61[_0x898a('0x3d')]=_0x5bfd61[_0x898a('0x3d')][_0x898a('0x40')]?_0x5bfd61[_0x898a('0x3d')]:_0x556fd8[_0x898a('0x3a')];if(_0x124f9b['query'][_0x898a('0x50')]){_0x5bfd61['include']=[{'all':!![]}];}_0x5bfd61=_[_0x898a('0x47')]({},_0x5bfd61,_0x124f9b[_0x898a('0x49')]);return db[_0x898a('0x4a')][_0x898a('0x52')](_0x5bfd61)[_0x898a('0x31')](handleEntityNotFound(_0x209529,null))[_0x898a('0x31')](function(_0x2486a5){if(_0x2486a5){var _0x75ff57=_0x2486a5[_0x898a('0x33')]({'plain':!![]});_0x75ff57=qs['omit'](_0x75ff57,['id',_0x898a('0x53'),_0x898a('0x54')]);_0x124f9b[_0x898a('0x55')]=_[_0x898a('0x56')](_0x124f9b[_0x898a('0x55')],['id',_0x898a('0x53'),_0x898a('0x54')]);return db[_0x898a('0x4a')][_0x898a('0x57')](_[_0x898a('0x47')](_0x75ff57,_0x124f9b[_0x898a('0x55')]),{'include':_0x124f9b[_0x898a('0x3b')][_0x898a('0x50')]?[{'all':!![]}]:undefined})[_0x898a('0x31')](function(_0x22f9ba){var _0x5f42ae=_0x124f9b[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x5f42ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f42ae[_0x898a('0x59')]===_0x898a('0x58')){var _0x5f0944=_0x22f9ba[_0x898a('0x33')]({'plain':!![]});var _0x1daecd=_0x898a('0x34');return db[_0x898a('0x5a')]['find']({'where':{'name':_0x1daecd,'userProfileId':_0x5f42ae[_0x898a('0x5b')]},'raw':!![]})[_0x898a('0x31')](function(_0x137935){if(_0x137935&&_0x137935[_0x898a('0x5c')]===0x0){return db['UserProfileResource'][_0x898a('0x57')]({'name':_0x5f0944[_0x898a('0x37')],'resourceId':_0x5f0944['id'],'type':_0x137935['name'],'sectionId':_0x137935['id']},{})[_0x898a('0x31')](function(){return _0x22f9ba;});}else{return _0x22f9ba;}})[_0x898a('0x23')](function(_0x5b7019){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7019);throw _0x5b7019;});}return _0x22f9ba;});}})[_0x898a('0x31')](respondWithResult(_0x209529,0xc9))['catch'](handleError(_0x209529,null));};exports['create']=function(_0x5ed35e,_0xfdd6d8,_0x473f5c){var _0x3909c5;return db[_0x898a('0x4a')]['create'](_0x5ed35e['body'],{'raw':!![]})[_0x898a('0x31')](function(_0x232be0){_0x3909c5=_0x232be0;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x41cf94){var _0x30051d=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x42fda8=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),_0x898a('0x63'));var _0x3bcc3d=ejs[_0x898a('0x64')](_0x30051d,{'trunks':_0x41cf94||[]});fs[_0x898a('0x65')](_0x898a('0x66'),_0x3bcc3d);if(_0x3909c5[_0x898a('0x67')]){var _0x307849=ejs[_0x898a('0x64')](_0x42fda8,{'trunks':_0x41cf94||[]});fs['writeFileSync'](_0x898a('0x68'),_0x307849);}})['then'](function(){return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x57'),{'module':_0x898a('0x6a')});})['then'](function(){var _0x31102d=_0x5ed35e[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x31102d)throw new Error(_0x898a('0x6b'));if(_0x31102d[_0x898a('0x59')]==='user'){var _0x4b9487=_0x3909c5[_0x898a('0x33')]({'plain':!![]});return db[_0x898a('0x5a')][_0x898a('0x52')]({'where':{'name':_0x898a('0x34'),'userProfileId':_0x31102d['userProfileId']},'raw':!![]})[_0x898a('0x31')](function(_0x3d3451){if(_0x3d3451&&_0x3d3451[_0x898a('0x5c')]===0x0){return db[_0x898a('0x35')][_0x898a('0x57')]({'name':_0x4b9487[_0x898a('0x37')],'resourceId':_0x4b9487['id'],'type':_0x3d3451[_0x898a('0x37')],'sectionId':_0x3d3451['id']},{})[_0x898a('0x31')](function(){return _0x3909c5;});}else{return _0x3909c5;}})['catch'](function(_0x32a207){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32a207);throw _0x32a207;});}return _0x3909c5;})[_0x898a('0x31')](respondWithResult(_0xfdd6d8,0xc9))['catch'](handleError(_0xfdd6d8,null));};exports[_0x898a('0x30')]=function(_0x4b2575,_0x2471d8,_0x387f2c){var _0x3b07dc;return db[_0x898a('0x4a')][_0x898a('0x52')]({'where':{'id':_0x4b2575[_0x898a('0x4d')]['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x2471d8,null))[_0x898a('0x31')](saveUpdates(_0x4b2575[_0x898a('0x55')],null))['then'](function(_0x3fe54b){if(_0x3fe54b){_0x3b07dc=_0x3fe54b;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});}})[_0x898a('0x31')](function(_0x290972){if(_0x290972){var _0x1d594b=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x4fad03=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x898a('0x63'));var _0x4a79a4=ejs[_0x898a('0x64')](_0x1d594b,{'trunks':_0x290972||[]});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a79a4);var _0x3f6815=ejs[_0x898a('0x64')](_0x4fad03,{'trunks':_0x290972||[]});fs[_0x898a('0x65')](_0x898a('0x68'),_0x3f6815);return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x30'),{'module':_0x898a('0x6a')});}return null;})['then'](function(_0x3237e8){if(_0x3237e8){return _0x3b07dc;}})[_0x898a('0x31')](respondWithResult(_0x2471d8,null))[_0x898a('0x23')](handleError(_0x2471d8,null));};exports['destroy']=function(_0x27560f,_0x61247c,_0x5c6247){var _0x39e917;return db['Trunk']['find']({'where':{'id':_0x27560f['params']['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x61247c,null))[_0x898a('0x31')](removeEntity(_0x61247c,null))[_0x898a('0x31')](function(){return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x12e54b){var _0x50dd52=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x24670c=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),'utf8');var _0x5847cb=ejs['render'](_0x50dd52,{'trunks':_0x12e54b});var _0x3b8fb5=ejs[_0x898a('0x64')](_0x24670c,{'trunks':_0x12e54b});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5847cb);fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3b8fb5);return respondWithRpcPromise('Reload',_0x898a('0x32'),{'module':_0x898a('0x6a')});})[_0x898a('0x23')](handleError(_0x61247c,null));}; \ No newline at end of file +var _0xa41a=['server/files/templates/registry.ejs','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','reject','update','destroy','get','UserProfileResource','end','name','send','map','Trunk','fieldName','type','key','query','intersection','model','attributes','fields','length','order','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','rawAttributes','find','createdAt','updatedAt','body','create','user','UserProfileSection','userProfileId','autoAssociation','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','Trunks','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload'];(function(_0x88ae35,_0x6a717e){var _0x5c1025=function(_0x20b91a){while(--_0x20b91a){_0x88ae35['push'](_0x88ae35['shift']());}};_0x5c1025(++_0x6a717e);}(_0xa41a,0x6b));var _0xaa41=function(_0x834ed,_0x45443d){_0x834ed=_0x834ed-0x0;var _0xb4d7a5=_0xa41a[_0x834ed];return _0xb4d7a5;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xaa41('0x19'));var client=jayson['client'][_0xaa41('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x12d9e6,_0x2f64bc,_0x889d44,_0x6f9ade){return new BPromise(function(_0x4eaf81,_0x1e9d7f){var _0x178170=_0x6f9ade||client;return _0x178170[_0xaa41('0x1b')](_0x12d9e6,_0x889d44)[_0xaa41('0x1c')](function(_0x2a6988){logger[_0xaa41('0x1d')](_0xaa41('0x1e'),_0x2f64bc,'request\x20sent');logger[_0xaa41('0x1f')](_0xaa41('0x20'),_0x2f64bc,_0xaa41('0x21'),JSON[_0xaa41('0x22')](_0x2a6988));if(_0x2a6988[_0xaa41('0x23')]){if(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x24')]===0x1f4){logger[_0xaa41('0x23')](_0xaa41('0x1e'),_0x2f64bc,_0x2a6988['error']['message']);return _0x1e9d7f(_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);}logger[_0xaa41('0x23')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0x2a6988[_0xaa41('0x23')][_0xaa41('0x25')]);return _0x4eaf81(_0x2a6988['error']['message']);}else{logger[_0xaa41('0x1d')]('Trunk,\x20%s,\x20%s',_0x2f64bc,_0xaa41('0x21'));_0x4eaf81(_0x2a6988[_0xaa41('0x26')][_0xaa41('0x25')]);}})[_0xaa41('0x27')](function(_0x1d623c){logger['error'](_0xaa41('0x1e'),_0x2f64bc,_0x1d623c);_0x1e9d7f(_0x1d623c);});});}function respondWithStatusCode(_0x43a85c,_0x448a21){_0x448a21=_0x448a21||0xcc;return function(_0x21f596){if(_0x21f596){return _0x43a85c[_0xaa41('0x28')](_0x448a21);}return _0x43a85c[_0xaa41('0x29')](_0x448a21)['end']();};}function respondWithResult(_0x5795f4,_0x16aec5){_0x16aec5=_0x16aec5||0xc8;return function(_0x527cac){if(_0x527cac){return _0x5795f4['status'](_0x16aec5)[_0xaa41('0x2a')](_0x527cac);}};}function respondWithFilteredResult(_0x59707f,_0x536bed){return function(_0x2d0ac0){if(_0x2d0ac0){var _0x9c8c21=typeof _0x536bed[_0xaa41('0x2b')]===_0xaa41('0x2c')&&typeof _0x536bed[_0xaa41('0x2d')]===_0xaa41('0x2c');var _0x57ef96=_0x2d0ac0[_0xaa41('0x2e')];var _0x1f0275=_0x9c8c21?0x0:_0x536bed[_0xaa41('0x2b')];var _0x9a16e3=_0x9c8c21?_0x2d0ac0[_0xaa41('0x2e')]:_0x536bed[_0xaa41('0x2b')]+_0x536bed[_0xaa41('0x2d')];var _0x104a95;if(_0x9a16e3>=_0x57ef96){_0x9a16e3=_0x57ef96;_0x104a95=0xc8;}else{_0x104a95=0xce;}_0x59707f['status'](_0x104a95);return _0x59707f[_0xaa41('0x2f')]('Content-Range',_0x1f0275+'-'+_0x9a16e3+'/'+_0x57ef96)['json'](_0x2d0ac0);}return null;};}function patchUpdates(_0x714537){return function(_0x1176bd){try{jsonpatch['apply'](_0x1176bd,_0x714537,!![]);}catch(_0x392b5d){return BPromise[_0xaa41('0x30')](_0x392b5d);}return _0x1176bd['save']();};}function saveUpdates(_0x5022fb,_0x5c25fb){return function(_0x1cf3da){if(_0x1cf3da){return _0x1cf3da[_0xaa41('0x31')](_0x5022fb)[_0xaa41('0x1c')](function(_0x38afc4){return _0x38afc4;});}return null;};}function removeEntity(_0x58f203,_0x289c4a){return function(_0x45c8fe){if(_0x45c8fe){return _0x45c8fe[_0xaa41('0x32')]()['then'](function(){var _0x387c55=_0x45c8fe[_0xaa41('0x33')]({'plain':!![]});var _0x321eb7='Trunks';return db[_0xaa41('0x34')][_0xaa41('0x32')]({'where':{'type':_0x321eb7,'resourceId':_0x387c55['id']}})['then'](function(){return _0x45c8fe;});})[_0xaa41('0x1c')](function(){_0x58f203[_0xaa41('0x29')](0xcc)[_0xaa41('0x35')]();});}};}function handleEntityNotFound(_0x5cec87,_0x22b272){return function(_0x48335f){if(!_0x48335f){_0x5cec87[_0xaa41('0x28')](0x194);}return _0x48335f;};}function handleError(_0x199b24,_0xf13742){_0xf13742=_0xf13742||0x1f4;return function(_0x49b77a){logger['error'](_0x49b77a['stack']);if(_0x49b77a[_0xaa41('0x36')]){delete _0x49b77a[_0xaa41('0x36')];}_0x199b24[_0xaa41('0x29')](_0xf13742)[_0xaa41('0x37')](_0x49b77a);};}exports['index']=function(_0x53a2e4,_0x267999){var _0x5673c={},_0x951e52={},_0x4e8d2e={'count':0x0,'rows':[]};var _0xba115a=_[_0xaa41('0x38')](db[_0xaa41('0x39')]['rawAttributes'],function(_0x3adc28){return{'name':_0x3adc28[_0xaa41('0x3a')],'type':_0x3adc28[_0xaa41('0x3b')][_0xaa41('0x3c')]};});_0x951e52['model']=_['map'](_0xba115a,_0xaa41('0x36'));_0x951e52[_0xaa41('0x3d')]=_['keys'](_0x53a2e4[_0xaa41('0x3d')]);_0x951e52['filters']=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],_0x951e52[_0xaa41('0x3d')]);_0x5673c[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x951e52[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x53a2e4[_0xaa41('0x3d')]['fields']));_0x5673c[_0xaa41('0x40')]=_0x5673c[_0xaa41('0x40')][_0xaa41('0x42')]?_0x5673c[_0xaa41('0x40')]:_0x951e52[_0xaa41('0x3f')];if(!_0x53a2e4[_0xaa41('0x3d')]['hasOwnProperty']('nolimit')){_0x5673c[_0xaa41('0x2d')]=qs['limit'](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2d')]);_0x5673c[_0xaa41('0x2b')]=qs[_0xaa41('0x2b')](_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x2b')]);}_0x5673c[_0xaa41('0x43')]=qs['sort'](_0x53a2e4[_0xaa41('0x3d')]['sort']);_0x5673c['where']=qs[_0xaa41('0x44')](_['pick'](_0x53a2e4['query'],_0x951e52['filters']),_0xba115a);if(_0x53a2e4[_0xaa41('0x3d')]['filter']){_0x5673c[_0xaa41('0x45')]=_[_0xaa41('0x46')](_0x5673c['where'],{'$or':_['map'](_0xba115a,function(_0xe58f5e){if(_0xe58f5e[_0xaa41('0x3b')]!==_0xaa41('0x47')){var _0x2af8ba={};_0x2af8ba[_0xe58f5e[_0xaa41('0x36')]]={'$like':'%'+_0x53a2e4[_0xaa41('0x3d')][_0xaa41('0x48')]+'%'};return _0x2af8ba;}})});}_0x5673c=_[_0xaa41('0x46')]({},_0x5673c,_0x53a2e4[_0xaa41('0x49')]);var _0x4e1ac4={'where':_0x5673c[_0xaa41('0x45')]};return db[_0xaa41('0x39')][_0xaa41('0x2e')](_0x4e1ac4)[_0xaa41('0x1c')](function(_0x206d86){_0x4e8d2e[_0xaa41('0x2e')]=_0x206d86;if(_0x53a2e4['query'][_0xaa41('0x4a')]){_0x5673c[_0xaa41('0x4b')]=[{'all':!![]}];}return db[_0xaa41('0x39')][_0xaa41('0x4c')](_0x5673c);})['then'](function(_0x23bc61){_0x4e8d2e['rows']=_0x23bc61;return _0x4e8d2e;})['then'](respondWithFilteredResult(_0x267999,_0x5673c))[_0xaa41('0x27')](handleError(_0x267999,null));};exports[_0xaa41('0x4d')]=function(_0x3e16ef,_0x4ca114){var _0xb4773b={'raw':![],'where':{'id':_0x3e16ef[_0xaa41('0x4e')]['id']}},_0x3e1a73={};_0x3e1a73['model']=_[_0xaa41('0x4f')](db[_0xaa41('0x39')][_0xaa41('0x50')]);_0x3e1a73[_0xaa41('0x3d')]=_[_0xaa41('0x4f')](_0x3e16ef[_0xaa41('0x3d')]);_0x3e1a73[_0xaa41('0x44')]=_[_0xaa41('0x3e')](_0x3e1a73['model'],_0x3e1a73[_0xaa41('0x3d')]);_0xb4773b['attributes']=_['intersection'](_0x3e1a73[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x41')]));_0xb4773b[_0xaa41('0x40')]=_0xb4773b[_0xaa41('0x40')][_0xaa41('0x42')]?_0xb4773b[_0xaa41('0x40')]:_0x3e1a73['model'];if(_0x3e16ef[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0xb4773b[_0xaa41('0x4b')]=[{'all':!![]}];}_0xb4773b=_['merge']({},_0xb4773b,_0x3e16ef[_0xaa41('0x49')]);return db[_0xaa41('0x39')]['find'](_0xb4773b)[_0xaa41('0x1c')](handleEntityNotFound(_0x4ca114,null))[_0xaa41('0x1c')](respondWithResult(_0x4ca114,null))[_0xaa41('0x27')](handleError(_0x4ca114,null));};exports['clone']=function(_0x2cf32c,_0xc8e626){var _0x4e3b13={'where':{'id':_0x2cf32c[_0xaa41('0x4e')]['id']}},_0x49789a={};_0x49789a[_0xaa41('0x3f')]=_[_0xaa41('0x4f')](db['Trunk'][_0xaa41('0x50')]);_0x4e3b13[_0xaa41('0x40')]=_[_0xaa41('0x3e')](_0x49789a[_0xaa41('0x3f')],qs[_0xaa41('0x41')](_0x2cf32c['query'][_0xaa41('0x41')]));_0x4e3b13['attributes']=_0x4e3b13['attributes'][_0xaa41('0x42')]?_0x4e3b13['attributes']:_0x49789a[_0xaa41('0x3f')];if(_0x2cf32c[_0xaa41('0x3d')][_0xaa41('0x4a')]){_0x4e3b13['include']=[{'all':!![]}];}_0x4e3b13=_[_0xaa41('0x46')]({},_0x4e3b13,_0x2cf32c[_0xaa41('0x49')]);return db[_0xaa41('0x39')][_0xaa41('0x51')](_0x4e3b13)[_0xaa41('0x1c')](handleEntityNotFound(_0xc8e626,null))[_0xaa41('0x1c')](function(_0xc56018){if(_0xc56018){var _0x337059=_0xc56018[_0xaa41('0x33')]({'plain':!![]});_0x337059=qs['omit'](_0x337059,['id',_0xaa41('0x52'),_0xaa41('0x53')]);_0x2cf32c[_0xaa41('0x54')]=_['omit'](_0x2cf32c[_0xaa41('0x54')],['id',_0xaa41('0x52'),_0xaa41('0x53')]);return db[_0xaa41('0x39')][_0xaa41('0x55')](_[_0xaa41('0x46')](_0x337059,_0x2cf32c[_0xaa41('0x54')]),{'include':_0x2cf32c['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x540325){var _0x4ec357=_0x2cf32c['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x4ec357)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ec357['role']===_0xaa41('0x56')){var _0x40a524=_0x540325[_0xaa41('0x33')]({'plain':!![]});var _0x312eee='Trunks';return db[_0xaa41('0x57')][_0xaa41('0x51')]({'where':{'name':_0x312eee,'userProfileId':_0x4ec357[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0xa71432){if(_0xa71432&&_0xa71432[_0xaa41('0x59')]===0x0){return db[_0xaa41('0x34')][_0xaa41('0x55')]({'name':_0x40a524[_0xaa41('0x36')],'resourceId':_0x40a524['id'],'type':_0xa71432['name'],'sectionId':_0xa71432['id']},{})[_0xaa41('0x1c')](function(){return _0x540325;});}else{return _0x540325;}})[_0xaa41('0x27')](function(_0x50170f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50170f);throw _0x50170f;});}return _0x540325;});}})[_0xaa41('0x1c')](respondWithResult(_0xc8e626,0xc9))['catch'](handleError(_0xc8e626,null));};exports[_0xaa41('0x55')]=function(_0x5c8028,_0x5423b6,_0x18d18b){var _0x4b1ec4;return db[_0xaa41('0x39')][_0xaa41('0x55')](_0x5c8028[_0xaa41('0x54')],{'raw':!![]})[_0xaa41('0x1c')](function(_0x5a2683){_0x4b1ec4=_0x5a2683;return db['Trunk'][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x4d6d0c){var _0x5954ba=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x5a385e=fs[_0xaa41('0x5a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x19ec63=ejs[_0xaa41('0x5f')](_0x5954ba,{'trunks':_0x4d6d0c||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x19ec63);if(_0x4b1ec4[_0xaa41('0x61')]){var _0x19ed68=ejs[_0xaa41('0x5f')](_0x5a385e,{'trunks':_0x4d6d0c||[]});fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x19ed68);}})[_0xaa41('0x1c')](function(){return respondWithRpcPromise('Reload',_0xaa41('0x55'),{'module':_0xaa41('0x64')});})[_0xaa41('0x1c')](function(){var _0x175ca9=_0x5c8028['user'][_0xaa41('0x33')]({'plain':!![]});if(!_0x175ca9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x175ca9[_0xaa41('0x65')]===_0xaa41('0x56')){var _0x2b9e68=_0x4b1ec4[_0xaa41('0x33')]({'plain':!![]});return db['UserProfileSection'][_0xaa41('0x51')]({'where':{'name':_0xaa41('0x66'),'userProfileId':_0x175ca9[_0xaa41('0x58')]},'raw':!![]})[_0xaa41('0x1c')](function(_0x59052d){if(_0x59052d&&_0x59052d[_0xaa41('0x59')]===0x0){return db['UserProfileResource'][_0xaa41('0x55')]({'name':_0x2b9e68[_0xaa41('0x36')],'resourceId':_0x2b9e68['id'],'type':_0x59052d['name'],'sectionId':_0x59052d['id']},{})[_0xaa41('0x1c')](function(){return _0x4b1ec4;});}else{return _0x4b1ec4;}})[_0xaa41('0x27')](function(_0x2ba160){logger[_0xaa41('0x23')](_0xaa41('0x67'),_0x2ba160);throw _0x2ba160;});}return _0x4b1ec4;})[_0xaa41('0x1c')](respondWithResult(_0x5423b6,0xc9))[_0xaa41('0x27')](handleError(_0x5423b6,null));};exports[_0xaa41('0x31')]=function(_0x33b5f4,_0x3d4f1e,_0x25a064){var _0x59a30b;return db[_0xaa41('0x39')][_0xaa41('0x51')]({'where':{'id':_0x33b5f4[_0xaa41('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3d4f1e,null))['then'](saveUpdates(_0x33b5f4[_0xaa41('0x54')],null))[_0xaa41('0x1c')](function(_0x59fd6a){if(_0x59fd6a){_0x59a30b=_0x59fd6a;return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});}})['then'](function(_0x305050){if(_0x305050){var _0x3dd47e=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config[_0xaa41('0x5c')],_0xaa41('0x5d')),_0xaa41('0x5e'));var _0x1472be=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],'server/files/templates/registry.ejs'),_0xaa41('0x5e'));var _0x44154f=ejs[_0xaa41('0x5f')](_0x3dd47e,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x60'),_0x44154f);var _0x404c38=ejs[_0xaa41('0x5f')](_0x1472be,{'trunks':_0x305050||[]});fs['writeFileSync'](_0xaa41('0x63'),_0x404c38);return respondWithRpcPromise(_0xaa41('0x68'),'update',{'module':_0xaa41('0x64')});}return null;})['then'](function(_0x53faf4){if(_0x53faf4){return _0x59a30b;}})[_0xaa41('0x1c')](respondWithResult(_0x3d4f1e,null))[_0xaa41('0x27')](handleError(_0x3d4f1e,null));};exports['destroy']=function(_0x5a8cb0,_0x241e1a,_0x1726ec){var _0x3c189d;return db[_0xaa41('0x39')]['find']({'where':{'id':_0x5a8cb0[_0xaa41('0x4e')]['id']}})[_0xaa41('0x1c')](handleEntityNotFound(_0x241e1a,null))[_0xaa41('0x1c')](removeEntity(_0x241e1a,null))['then'](function(){return db[_0xaa41('0x39')][_0xaa41('0x4c')]({'raw':!![]});})[_0xaa41('0x1c')](function(_0x5697b6){var _0x183b36=fs['readFileSync'](path['join'](config[_0xaa41('0x5c')],_0xaa41('0x5d')),'utf8');var _0x399fbd=fs[_0xaa41('0x5a')](path[_0xaa41('0x5b')](config['root'],_0xaa41('0x69')),_0xaa41('0x5e'));var _0x1a2deb=ejs[_0xaa41('0x5f')](_0x183b36,{'trunks':_0x5697b6});var _0x38f5d0=ejs['render'](_0x399fbd,{'trunks':_0x5697b6});fs[_0xaa41('0x62')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1a2deb);fs[_0xaa41('0x62')](_0xaa41('0x63'),_0x38f5d0);return respondWithRpcPromise(_0xaa41('0x68'),_0xaa41('0x32'),{'module':_0xaa41('0x64')});})[_0xaa41('0x27')](handleError(_0x241e1a,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 6d62701..5f54d06 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 _0xde47=['./trunk.attributes','Trunk','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x494f86,_0x316cfb){var _0x24eb00=function(_0x101695){while(--_0x101695){_0x494f86['push'](_0x494f86['shift']());}};_0x24eb00(++_0x316cfb);}(_0xde47,0x1ba));var _0x7de4=function(_0x433b93,_0x40db4f){_0x433b93=_0x433b93-0x0;var _0x116edd=_0xde47[_0x433b93];return _0x116edd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7de4('0x0'))(_0x7de4('0x1'));var moment=require('moment');var BPromise=require(_0x7de4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7de4('0x3'));var rimraf=require(_0x7de4('0x4'));var config=require(_0x7de4('0x5'));var attributes=require(_0x7de4('0x6'));module['exports']=function(_0x47b446,_0x262158){return _0x47b446['define'](_0x7de4('0x7'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4f9=['./trunk.attributes','exports','define','Trunk','tools_trunks','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x41835f,_0x4f3303){var _0x2b5d76=function(_0x38d6a7){while(--_0x38d6a7){_0x41835f['push'](_0x41835f['shift']());}};_0x2b5d76(++_0x4f3303);}(_0xd4f9,0xd6));var _0x9d4f=function(_0x4495ce,_0x38c74d){_0x4495ce=_0x4495ce-0x0;var _0xdc71df=_0xd4f9[_0x4495ce];return _0xdc71df;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9d4f('0x0'))(_0x9d4f('0x1'));var moment=require(_0x9d4f('0x2'));var BPromise=require(_0x9d4f('0x3'));var rp=require(_0x9d4f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9d4f('0x5'));var attributes=require(_0x9d4f('0x6'));module[_0x9d4f('0x7')]=function(_0x221708,_0x4495a4){return _0x221708[_0x9d4f('0x8')](_0x9d4f('0x9'),attributes,{'tableName':_0x9d4f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 9229d30..53e1298 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 _0x6ea9=['ShowTrunk','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options','raw','include','map','model','attributes','find','where'];(function(_0x5d6ca7,_0x438e99){var _0x11143e=function(_0x37dc8f){while(--_0x37dc8f){_0x5d6ca7['push'](_0x5d6ca7['shift']());}};_0x11143e(++_0x438e99);}(_0x6ea9,0xd3));var _0x96ea=function(_0x3bcb78,_0xc607dc){_0x3bcb78=_0x3bcb78-0x0;var _0x31bb49=_0x6ea9[_0x3bcb78];return _0x31bb49;};'use strict';var _=require(_0x96ea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x96ea('0x1'));var fs=require('fs');var Redis=require(_0x96ea('0x2'));var db=require(_0x96ea('0x3'))['db'];var utils=require(_0x96ea('0x4'));var logger=require(_0x96ea('0x5'))('rpc');var config=require(_0x96ea('0x6'));var jayson=require(_0x96ea('0x7'));var client=jayson[_0x96ea('0x8')][_0x96ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x368e24,_0x14656b,_0x431254){return new BPromise(function(_0x1e6525,_0x10b439){return client[_0x96ea('0xa')](_0x368e24,_0x431254)[_0x96ea('0xb')](function(_0x3aa021){logger[_0x96ea('0xc')](_0x96ea('0xd'),_0x14656b,_0x96ea('0xe'));logger[_0x96ea('0xf')](_0x96ea('0x10'),_0x14656b,_0x96ea('0xe'),JSON[_0x96ea('0x11')](_0x3aa021));if(_0x3aa021[_0x96ea('0x12')]){if(_0x3aa021['error'][_0x96ea('0x13')]===0x1f4){logger['error'](_0x96ea('0xd'),_0x14656b,_0x3aa021[_0x96ea('0x12')][_0x96ea('0x14')]);return _0x10b439(_0x3aa021[_0x96ea('0x12')][_0x96ea('0x14')]);}logger[_0x96ea('0x12')]('Trunk,\x20%s,\x20%s',_0x14656b,_0x3aa021[_0x96ea('0x12')]['message']);return _0x1e6525(_0x3aa021[_0x96ea('0x12')][_0x96ea('0x14')]);}else{logger[_0x96ea('0xc')](_0x96ea('0xd'),_0x14656b,'request\x20sent');_0x1e6525(_0x3aa021[_0x96ea('0x15')]['message']);}})[_0x96ea('0x16')](function(_0x655ef4){logger[_0x96ea('0x12')](_0x96ea('0xd'),_0x14656b,_0x655ef4);_0x10b439(_0x655ef4);});});}exports[_0x96ea('0x17')]=function(_0x4b8f59){var _0x5bf0fe=this;return new Promise(function(_0x483bad,_0x818bbe){return db[_0x96ea('0x18')][_0x96ea('0x19')]({'raw':_0x4b8f59[_0x96ea('0x1a')]?_0x4b8f59['options'][_0x96ea('0x1b')]===undefined?!![]:![]:!![],'where':_0x4b8f59[_0x96ea('0x1a')]?_0x4b8f59[_0x96ea('0x1a')]['where']||null:null,'attributes':_0x4b8f59[_0x96ea('0x1a')]?_0x4b8f59[_0x96ea('0x1a')]['attributes']||null:null,'limit':_0x4b8f59['options']?_0x4b8f59[_0x96ea('0x1a')]['limit']||null:null,'include':_0x4b8f59['options']?_0x4b8f59[_0x96ea('0x1a')][_0x96ea('0x1c')]?_[_0x96ea('0x1d')](_0x4b8f59[_0x96ea('0x1a')][_0x96ea('0x1c')],function(_0xf7a68d){return{'model':db[_0xf7a68d[_0x96ea('0x1e')]],'as':_0xf7a68d['as'],'attributes':_0xf7a68d[_0x96ea('0x1f')],'include':_0xf7a68d[_0x96ea('0x1c')]?_[_0x96ea('0x1d')](_0xf7a68d[_0x96ea('0x1c')],function(_0x5289e0){return{'model':db[_0x5289e0['model']],'as':_0x5289e0['as'],'attributes':_0x5289e0[_0x96ea('0x1f')],'include':_0x5289e0['include']?_[_0x96ea('0x1d')](_0x5289e0[_0x96ea('0x1c')],function(_0x46832a){return{'model':db[_0x46832a['model']],'as':_0x46832a['as'],'attributes':_0x46832a['attributes']};}):[]};}):[]};}):[]:[]})[_0x96ea('0xb')](function(_0x4de322){logger[_0x96ea('0xc')](_0x96ea('0x17'),_0x4b8f59);logger['debug']('GetTrunk',_0x4b8f59,JSON[_0x96ea('0x11')](_0x4de322));_0x483bad(_0x4de322);})[_0x96ea('0x16')](function(_0x1a9f32){logger[_0x96ea('0x12')](_0x96ea('0x17'),_0x1a9f32[_0x96ea('0x14')],_0x4b8f59);_0x818bbe(_0x5bf0fe[_0x96ea('0x12')](0x1f4,_0x1a9f32['message']));});});};exports['ShowTrunk']=function(_0x476f6b){var _0x264226=this;return new Promise(function(_0x2789d9,_0x1562af){return db['Trunk'][_0x96ea('0x20')]({'raw':_0x476f6b['options']?_0x476f6b[_0x96ea('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x476f6b[_0x96ea('0x1a')]?_0x476f6b['options'][_0x96ea('0x21')]||null:null,'attributes':_0x476f6b[_0x96ea('0x1a')]?_0x476f6b[_0x96ea('0x1a')][_0x96ea('0x1f')]||null:null,'include':_0x476f6b[_0x96ea('0x1a')]?_0x476f6b[_0x96ea('0x1a')][_0x96ea('0x1c')]?_['map'](_0x476f6b['options'][_0x96ea('0x1c')],function(_0x39e957){return{'model':db[_0x39e957['model']],'as':_0x39e957['as'],'attributes':_0x39e957[_0x96ea('0x1f')],'include':_0x39e957[_0x96ea('0x1c')]?_['map'](_0x39e957[_0x96ea('0x1c')],function(_0x1b7c82){return{'model':db[_0x1b7c82[_0x96ea('0x1e')]],'as':_0x1b7c82['as'],'attributes':_0x1b7c82[_0x96ea('0x1f')],'include':_0x1b7c82['include']?_[_0x96ea('0x1d')](_0x1b7c82[_0x96ea('0x1c')],function(_0x2e18a5){return{'model':db[_0x2e18a5[_0x96ea('0x1e')]],'as':_0x2e18a5['as'],'attributes':_0x2e18a5[_0x96ea('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x96ea('0xb')](function(_0x25a25b){logger[_0x96ea('0xc')](_0x96ea('0x22'),_0x476f6b);logger[_0x96ea('0xf')](_0x96ea('0x22'),_0x476f6b,JSON['stringify'](_0x25a25b));_0x2789d9(_0x25a25b);})[_0x96ea('0x16')](function(_0x41fc9b){logger[_0x96ea('0x12')]('ShowTrunk',_0x41fc9b['message'],_0x476f6b);_0x1562af(_0x264226[_0x96ea('0x12')](0x1f4,_0x41fc9b[_0x96ea('0x14')]));});});}; \ No newline at end of file +var _0x5c1f=['code','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','map','model','ShowTrunk','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','stringify','error'];(function(_0x3b2537,_0x20b0df){var _0x567752=function(_0x57d879){while(--_0x57d879){_0x3b2537['push'](_0x3b2537['shift']());}};_0x567752(++_0x20b0df);}(_0x5c1f,0x106));var _0xf5c1=function(_0x2bf466,_0x4929a5){_0x2bf466=_0x2bf466-0x0;var _0x856885=_0x5c1f[_0x2bf466];return _0x856885;};'use strict';var _=require(_0xf5c1('0x0'));var util=require('util');var moment=require(_0xf5c1('0x1'));var BPromise=require(_0xf5c1('0x2'));var rs=require(_0xf5c1('0x3'));var fs=require('fs');var Redis=require(_0xf5c1('0x4'));var db=require(_0xf5c1('0x5'))['db'];var utils=require(_0xf5c1('0x6'));var logger=require(_0xf5c1('0x7'))(_0xf5c1('0x8'));var config=require(_0xf5c1('0x9'));var jayson=require(_0xf5c1('0xa'));var client=jayson[_0xf5c1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52a0e6,_0x52185b,_0x339473){return new BPromise(function(_0x465ec4,_0x588940){return client[_0xf5c1('0xc')](_0x52a0e6,_0x339473)[_0xf5c1('0xd')](function(_0xea120d){logger['info']('Trunk,\x20%s,\x20%s',_0x52185b,_0xf5c1('0xe'));logger[_0xf5c1('0xf')]('Trunk,\x20%s,\x20%s,\x20%s',_0x52185b,_0xf5c1('0xe'),JSON[_0xf5c1('0x10')](_0xea120d));if(_0xea120d[_0xf5c1('0x11')]){if(_0xea120d[_0xf5c1('0x11')][_0xf5c1('0x12')]===0x1f4){logger[_0xf5c1('0x11')](_0xf5c1('0x13'),_0x52185b,_0xea120d[_0xf5c1('0x11')][_0xf5c1('0x14')]);return _0x588940(_0xea120d[_0xf5c1('0x11')][_0xf5c1('0x14')]);}logger['error'](_0xf5c1('0x13'),_0x52185b,_0xea120d[_0xf5c1('0x11')][_0xf5c1('0x14')]);return _0x465ec4(_0xea120d[_0xf5c1('0x11')][_0xf5c1('0x14')]);}else{logger['info'](_0xf5c1('0x13'),_0x52185b,_0xf5c1('0xe'));_0x465ec4(_0xea120d[_0xf5c1('0x15')]['message']);}})[_0xf5c1('0x16')](function(_0x114cef){logger[_0xf5c1('0x11')](_0xf5c1('0x13'),_0x52185b,_0x114cef);_0x588940(_0x114cef);});});}exports[_0xf5c1('0x17')]=function(_0x3f78e5){var _0x776ead=this;return new Promise(function(_0x2e7be1,_0x237e26){return db[_0xf5c1('0x18')][_0xf5c1('0x19')]({'raw':_0x3f78e5[_0xf5c1('0x1a')]?_0x3f78e5[_0xf5c1('0x1a')][_0xf5c1('0x1b')]===undefined?!![]:![]:!![],'where':_0x3f78e5[_0xf5c1('0x1a')]?_0x3f78e5[_0xf5c1('0x1a')][_0xf5c1('0x1c')]||null:null,'attributes':_0x3f78e5[_0xf5c1('0x1a')]?_0x3f78e5[_0xf5c1('0x1a')][_0xf5c1('0x1d')]||null:null,'limit':_0x3f78e5[_0xf5c1('0x1a')]?_0x3f78e5['options']['limit']||null:null,'include':_0x3f78e5[_0xf5c1('0x1a')]?_0x3f78e5[_0xf5c1('0x1a')][_0xf5c1('0x1e')]?_['map'](_0x3f78e5[_0xf5c1('0x1a')][_0xf5c1('0x1e')],function(_0xa62eeb){return{'model':db[_0xa62eeb['model']],'as':_0xa62eeb['as'],'attributes':_0xa62eeb[_0xf5c1('0x1d')],'include':_0xa62eeb[_0xf5c1('0x1e')]?_[_0xf5c1('0x1f')](_0xa62eeb[_0xf5c1('0x1e')],function(_0x3d736d){return{'model':db[_0x3d736d[_0xf5c1('0x20')]],'as':_0x3d736d['as'],'attributes':_0x3d736d[_0xf5c1('0x1d')],'include':_0x3d736d['include']?_['map'](_0x3d736d[_0xf5c1('0x1e')],function(_0x230b10){return{'model':db[_0x230b10['model']],'as':_0x230b10['as'],'attributes':_0x230b10['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5c1('0xd')](function(_0x81f21b){logger['info'](_0xf5c1('0x17'),_0x3f78e5);logger[_0xf5c1('0xf')](_0xf5c1('0x17'),_0x3f78e5,JSON[_0xf5c1('0x10')](_0x81f21b));_0x2e7be1(_0x81f21b);})['catch'](function(_0x447d67){logger[_0xf5c1('0x11')](_0xf5c1('0x17'),_0x447d67['message'],_0x3f78e5);_0x237e26(_0x776ead['error'](0x1f4,_0x447d67['message']));});});};exports[_0xf5c1('0x21')]=function(_0x55c637){var _0x3f3984=this;return new Promise(function(_0x419121,_0x45983f){return db['Trunk'][_0xf5c1('0x22')]({'raw':_0x55c637[_0xf5c1('0x1a')]?_0x55c637['options'][_0xf5c1('0x1b')]===undefined?!![]:![]:!![],'where':_0x55c637['options']?_0x55c637[_0xf5c1('0x1a')][_0xf5c1('0x1c')]||null:null,'attributes':_0x55c637[_0xf5c1('0x1a')]?_0x55c637['options'][_0xf5c1('0x1d')]||null:null,'include':_0x55c637[_0xf5c1('0x1a')]?_0x55c637[_0xf5c1('0x1a')][_0xf5c1('0x1e')]?_['map'](_0x55c637[_0xf5c1('0x1a')]['include'],function(_0x32a2c9){return{'model':db[_0x32a2c9[_0xf5c1('0x20')]],'as':_0x32a2c9['as'],'attributes':_0x32a2c9[_0xf5c1('0x1d')],'include':_0x32a2c9['include']?_[_0xf5c1('0x1f')](_0x32a2c9['include'],function(_0x277591){return{'model':db[_0x277591[_0xf5c1('0x20')]],'as':_0x277591['as'],'attributes':_0x277591['attributes'],'include':_0x277591['include']?_[_0xf5c1('0x1f')](_0x277591[_0xf5c1('0x1e')],function(_0x291c4e){return{'model':db[_0x291c4e[_0xf5c1('0x20')]],'as':_0x291c4e['as'],'attributes':_0x291c4e[_0xf5c1('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2605e9){logger['info'](_0xf5c1('0x21'),_0x55c637);logger[_0xf5c1('0xf')]('ShowTrunk',_0x55c637,JSON[_0xf5c1('0x10')](_0x2605e9));_0x419121(_0x2605e9);})[_0xf5c1('0x16')](function(_0x2f8f86){logger[_0xf5c1('0x11')](_0xf5c1('0x21'),_0x2f8f86[_0xf5c1('0x14')],_0x55c637);_0x45983f(_0x3f3984[_0xf5c1('0x11')](0x1f4,_0x2f8f86[_0xf5c1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index fc1207d..78f3fbb 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00d0=['update','exports','../../components/auth/service','./user-setting.controller','put','isAuthenticated'];(function(_0xfb94aa,_0x1abd00){var _0x25f2bb=function(_0x4cf0e3){while(--_0x4cf0e3){_0xfb94aa['push'](_0xfb94aa['shift']());}};_0x25f2bb(++_0x1abd00);}(_0x00d0,0x13a));var _0x000d=function(_0x542437,_0x4dd6e5){_0x542437=_0x542437-0x0;var _0x340c77=_0x00d0[_0x542437];return _0x340c77;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x000d('0x0'));var controller=require(_0x000d('0x1'));router[_0x000d('0x2')]('/:id',auth[_0x000d('0x3')](),controller[_0x000d('0x4')]);module[_0x000d('0x5')]=router; \ No newline at end of file +var _0x6894=['exports','express','../../components/auth/service','./user-setting.controller','put','/:id','update'];(function(_0x1ef5bb,_0x1f6f91){var _0x1083eb=function(_0x3c8975){while(--_0x3c8975){_0x1ef5bb['push'](_0x1ef5bb['shift']());}};_0x1083eb(++_0x1f6f91);}(_0x6894,0x78));var _0x4689=function(_0x2bfd4f,_0x1bbf2c){_0x2bfd4f=_0x2bfd4f-0x0;var _0x341849=_0x6894[_0x2bfd4f];return _0x341849;};'use strict';var express=require(_0x4689('0x0'));var router=express['Router']();var auth=require(_0x4689('0x1'));var controller=require(_0x4689('0x2'));router[_0x4689('0x3')](_0x4689('0x4'),auth['isAuthenticated'](),controller[_0x4689('0x5')]);module[_0x4689('0x6')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 2c657e2..3c03b84 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe73f=['error','info','exports','BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize'];(function(_0x57d3ff,_0x396465){var _0x19e4a7=function(_0x1a2459){while(--_0x1a2459){_0x57d3ff['push'](_0x57d3ff['shift']());}};_0x19e4a7(++_0x396465);}(_0xe73f,0x98));var _0xfe73=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xe73f[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0xfe73('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xfe73('0x1'),'warning',_0xfe73('0x2'),'debug'];module[_0xfe73('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xfe73('0x4')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xfe73('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xfe73('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xfe73('0x7')],'unique':_0xfe73('0x8')}}; \ No newline at end of file +var _0xba21=['error','warning','info','debug','exports','TEXT','DATE','INTEGER','UserId','sequelize'];(function(_0x5b98a3,_0x73f961){var _0x1620fb=function(_0x52eb18){while(--_0x52eb18){_0x5b98a3['push'](_0x5b98a3['shift']());}};_0x1620fb(++_0x73f961);}(_0xba21,0x17b));var _0x1ba2=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xba21[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x1ba2('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x1ba2('0x1'),_0x1ba2('0x2'),_0x1ba2('0x3'),_0x1ba2('0x4')];module[_0x1ba2('0x5')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x1ba2('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x1ba2('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x1ba2('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x1ba2('0x8')],'unique':_0x1ba2('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 36196a9..d5cf1bb 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x780f=['role','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','redis','./user-setting.socket','register','status','json','update','then','sendStatus','error','stack','name','send'];(function(_0xb5f215,_0x4ec38c){var _0x5b64c9=function(_0x108074){while(--_0x108074){_0xb5f215['push'](_0xb5f215['shift']());}};_0x5b64c9(++_0x4ec38c);}(_0x780f,0x6c));var _0xf780=function(_0x27d8bc,_0x19e010){_0x27d8bc=_0x27d8bc-0x0;var _0x4b04cb=_0x780f[_0x27d8bc];return _0x4b04cb;};'use strict';var _=require(_0xf780('0x0'));var Redis=require(_0xf780('0x1'));var logger=require(_0xf780('0x2'))(_0xf780('0x3'));var config=require(_0xf780('0x4'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xf780('0x5')]));require(_0xf780('0x6'))[_0xf780('0x7')](socket);config[_0xf780('0x5')]=_['defaults'](config[_0xf780('0x5')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x1bd856,_0x93539d){_0x93539d=_0x93539d||0xc8;return function(_0x1c3fdc){if(_0x1c3fdc){return _0x1bd856[_0xf780('0x8')](_0x93539d)[_0xf780('0x9')](_0x1c3fdc);}};}function saveUpdates(_0xa30476){return function(_0x53b673){if(_0x53b673){return _0x53b673[_0xf780('0xa')](_0xa30476)[_0xf780('0xb')](function(_0x121d96){return _0x121d96;});}return null;};}function handleEntityNotFound(_0x14d6e0){return function(_0x343856){if(!_0x343856){_0x14d6e0[_0xf780('0xc')](0x194);}return _0x343856;};}function handleError(_0x491ab5,_0x47f3c9){_0x47f3c9=_0x47f3c9||0x1f4;return function(_0x4b95fd){logger[_0xf780('0xd')](_0x4b95fd[_0xf780('0xe')]);if(_0x4b95fd[_0xf780('0xf')]){delete _0x4b95fd[_0xf780('0xf')];}_0x491ab5['status'](_0x47f3c9)[_0xf780('0x10')](_0x4b95fd);};}exports[_0xf780('0xa')]=function(_0x29a1eb,_0xdebda9){if(_0x29a1eb['user'][_0xf780('0x11')]!=='admin')throw new Error(_0xf780('0x12'));if(isNaN(Number(_0x29a1eb[_0xf780('0x13')]['id'])))throw new Error(_0xf780('0x14'));return db[_0xf780('0x15')][_0xf780('0x16')]({'where':{'id':_0x29a1eb[_0xf780('0x13')]['id']}})[_0xf780('0xb')](handleEntityNotFound(_0xdebda9,null))['then'](saveUpdates(_0x29a1eb[_0xf780('0x17')],null))[_0xf780('0xb')](respondWithResult(_0xdebda9,null))[_0xf780('0x18')](handleError(_0xdebda9,null));}; \ No newline at end of file +var _0xe3c5=['api','../../config/environment','../../mysqldb','redis','./user-setting.socket','register','defaults','localhost','status','json','update','then','error','name','send','user','role','params','Invalid\x20user\x20setting\x20id','UserSetting','body','lodash','ioredis','../../config/logger'];(function(_0x94bb2a,_0x4e0eef){var _0x2ad812=function(_0x3133c8){while(--_0x3133c8){_0x94bb2a['push'](_0x94bb2a['shift']());}};_0x2ad812(++_0x4e0eef);}(_0xe3c5,0x17d));var _0x5e3c=function(_0x466f51,_0x1393ed){_0x466f51=_0x466f51-0x0;var _0x2db305=_0xe3c5[_0x466f51];return _0x2db305;};'use strict';var _=require(_0x5e3c('0x0'));var Redis=require(_0x5e3c('0x1'));var logger=require(_0x5e3c('0x2'))(_0x5e3c('0x3'));var config=require(_0x5e3c('0x4'));var db=require(_0x5e3c('0x5'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x5e3c('0x6')]));require(_0x5e3c('0x7'))[_0x5e3c('0x8')](socket);config[_0x5e3c('0x6')]=_[_0x5e3c('0x9')](config[_0x5e3c('0x6')],{'host':_0x5e3c('0xa'),'port':0x18eb});function respondWithResult(_0x2d6b68,_0xc8c788){_0xc8c788=_0xc8c788||0xc8;return function(_0x17076a){if(_0x17076a){return _0x2d6b68[_0x5e3c('0xb')](_0xc8c788)[_0x5e3c('0xc')](_0x17076a);}};}function saveUpdates(_0x4995a3){return function(_0x58769f){if(_0x58769f){return _0x58769f[_0x5e3c('0xd')](_0x4995a3)[_0x5e3c('0xe')](function(_0x1835d9){return _0x1835d9;});}return null;};}function handleEntityNotFound(_0x167eee){return function(_0x3ffc9){if(!_0x3ffc9){_0x167eee['sendStatus'](0x194);}return _0x3ffc9;};}function handleError(_0x3956a9,_0x375352){_0x375352=_0x375352||0x1f4;return function(_0x5e110b){logger[_0x5e3c('0xf')](_0x5e110b['stack']);if(_0x5e110b['name']){delete _0x5e110b[_0x5e3c('0x10')];}_0x3956a9[_0x5e3c('0xb')](_0x375352)[_0x5e3c('0x11')](_0x5e110b);};}exports[_0x5e3c('0xd')]=function(_0x32efb7,_0x30bc22){if(_0x32efb7[_0x5e3c('0x12')][_0x5e3c('0x13')]!=='admin')throw new Error('Unauthorized');if(isNaN(Number(_0x32efb7[_0x5e3c('0x14')]['id'])))throw new Error(_0x5e3c('0x15'));return db[_0x5e3c('0x16')]['find']({'where':{'id':_0x32efb7['params']['id']}})[_0x5e3c('0xe')](handleEntityNotFound(_0x30bc22,null))[_0x5e3c('0xe')](saveUpdates(_0x32efb7[_0x5e3c('0x17')],null))[_0x5e3c('0xe')](respondWithResult(_0x30bc22,null))['catch'](handleError(_0x30bc22,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index ff414bb..fa14be8 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0992=['emit','hasOwnProperty','hook','exports','../../mysqldb','UserSetting','save','update','remove'];(function(_0x4f2da6,_0x30a6c2){var _0x5a44b5=function(_0x128bc5){while(--_0x128bc5){_0x4f2da6['push'](_0x4f2da6['shift']());}};_0x5a44b5(++_0x30a6c2);}(_0x0992,0x12d));var _0x2099=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x0992[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x2099('0x0'))['db'][_0x2099('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2099('0x2'),'afterUpdate':_0x2099('0x3'),'afterDestroy':_0x2099('0x4')};function emitEvent(_0x238dea){return function(_0x4c8c71,_0x154f52,_0x495d53){UserSettingEvents[_0x2099('0x5')](_0x238dea+':'+_0x4c8c71['id'],_0x4c8c71);UserSettingEvents[_0x2099('0x5')](_0x238dea,_0x4c8c71);_0x495d53(null);};}for(var e in events){if(events[_0x2099('0x6')](e)){var event=events[e];UserSetting[_0x2099('0x7')](e,emitEvent(event));}}module[_0x2099('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x66f2=['events','../../mysqldb','UserSetting','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x66f2,0xc8));var _0x266f=function(_0x527a01,_0x99a1af){_0x527a01=_0x527a01-0x0;var _0x39d696=_0x66f2[_0x527a01];return _0x39d696;};'use strict';var EventEmitter=require(_0x266f('0x0'));var UserSetting=require(_0x266f('0x1'))['db'][_0x266f('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x266f('0x3')](0x0);var events={'afterCreate':_0x266f('0x4'),'afterUpdate':_0x266f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1b4c50){return function(_0x43ded5,_0x58f1d1,_0x21ec3a){UserSettingEvents['emit'](_0x1b4c50+':'+_0x43ded5['id'],_0x43ded5);UserSettingEvents[_0x266f('0x6')](_0x1b4c50,_0x43ded5);_0x21ec3a(null);};}for(var e in events){if(events[_0x266f('0x7')](e)){var event=events[e];UserSetting[_0x266f('0x8')](e,emitEvent(event));}}module[_0x266f('0x9')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index 68888be..30aaaf1 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ec6=['exports','UserSetting','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0x5ec6,0x7f));var _0x65ec=function(_0x2a12bf,_0x209420){_0x2a12bf=_0x2a12bf-0x0;var _0x4cde0b=_0x5ec6[_0x2a12bf];return _0x4cde0b;};'use strict';var attributes=require(_0x65ec('0x0'));module[_0x65ec('0x1')]=function(_0x26f68b){return _0x26f68b['define'](_0x65ec('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x476873){if(!_0x476873['clientSideLoggingEnabled'])_0x476873[_0x65ec('0x3')]=null;else if(_0x476873['clientSideLoggingEnabledSince']===null)_0x476873[_0x65ec('0x3')]=new Date();}}});}; \ No newline at end of file +var _0x574d=['./user-setting.attributes','exports','define','UserSetting','user_settings','clientSideLoggingEnabledSince'];(function(_0x183b02,_0x309cb0){var _0x5846f6=function(_0x222785){while(--_0x222785){_0x183b02['push'](_0x183b02['shift']());}};_0x5846f6(++_0x309cb0);}(_0x574d,0xc0));var _0xd574=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x574d[_0x5d2803];return _0xdcad2c;};'use strict';var attributes=require(_0xd574('0x0'));module[_0xd574('0x1')]=function(_0x2ef0b0){return _0x2ef0b0[_0xd574('0x2')](_0xd574('0x3'),attributes,{'tableName':_0xd574('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x46aec5){if(!_0x46aec5['clientSideLoggingEnabled'])_0x46aec5[_0xd574('0x5')]=null;else if(_0x46aec5[_0xd574('0x5')]===null)_0x46aec5[_0xd574('0x5')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index e1f0b88..6126172 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e32=['save','remove','update','emit','user-setting:update','user-setting:update:user-','register','length','user-setting:','./user-setting.events'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x5e32,0x15d));var _0x25e3=function(_0x5c2320,_0x543863){_0x5c2320=_0x5c2320-0x0;var _0x50d333=_0x5e32[_0x5c2320];return _0x50d333;};'use strict';var UserSettingEvents=require(_0x25e3('0x0'));var events=[_0x25e3('0x1'),_0x25e3('0x2'),_0x25e3('0x3')];function createListener(_0x1724e4,_0x39eaf0){return function(_0x3019e2){_0x39eaf0[_0x25e3('0x4')](_0x1724e4,_0x3019e2);if(_0x1724e4===_0x25e3('0x5')){_0x39eaf0[_0x25e3('0x4')](_0x25e3('0x6')+_0x3019e2['UserId'],_0x3019e2);}};}exports[_0x25e3('0x7')]=function(_0x2097e0){for(var _0x978e86=0x0,_0x372751=events[_0x25e3('0x8')];_0x978e86<_0x372751;_0x978e86++){var _0xd8976a=events[_0x978e86];var _0x360d5a=createListener(_0x25e3('0x9')+_0xd8976a,_0x2097e0);UserSettingEvents['on'](_0xd8976a,_0x360d5a);}}; \ No newline at end of file +var _0xdf0f=['remove','update','emit','user-setting:update','user-setting:update:user-','UserId','register','length','user-setting:','save'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xdf0f,0x199));var _0xfdf0=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdf0f[_0xa464c9];return _0x3d73c4;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0xfdf0('0x0'),_0xfdf0('0x1'),_0xfdf0('0x2')];function createListener(_0x33adfa,_0x4da07d){return function(_0x1a7c01){_0x4da07d[_0xfdf0('0x3')](_0x33adfa,_0x1a7c01);if(_0x33adfa===_0xfdf0('0x4')){_0x4da07d[_0xfdf0('0x3')](_0xfdf0('0x5')+_0x1a7c01[_0xfdf0('0x6')],_0x1a7c01);}};}exports[_0xfdf0('0x7')]=function(_0x1c00a0){for(var _0x139073=0x0,_0x1bb5fc=events[_0xfdf0('0x8')];_0x139073<_0x1bb5fc;_0x139073++){var _0x637909=events[_0x139073];var _0x5649ec=createListener(_0xfdf0('0x9')+_0x637909,_0x1c00a0);UserSettingEvents['on'](_0x637909,_0x5649ec);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 82fb2e2..916c9d0 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 _0x203a=['/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key','createApiKey','put','update','/:id/password','changePassword','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','path','connect-timeout','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','getApiKey','post','/:id/contacts','addContacts','create','/create_many','addQueues','diskStorage','join','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login'];(function(_0xdacb89,_0x166eea){var _0x2bc41b=function(_0x25b407){while(--_0x25b407){_0xdacb89['push'](_0xdacb89['shift']());}};_0x2bc41b(++_0x166eea);}(_0x203a,0xa3));var _0xa203=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x203a[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xa203('0x0'));var util=require('util');var path=require(_0xa203('0x1'));var timeout=require(_0xa203('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa203('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa203('0x4'));var controller=require('./user.controller');router[_0xa203('0x5')]('/',auth[_0xa203('0x6')](),controller[_0xa203('0x7')]);router[_0xa203('0x5')](_0xa203('0x8'),auth[_0xa203('0x6')](),controller['describe']);router[_0xa203('0x5')](_0xa203('0x9'),auth['isAuthenticated'](),controller['whoami']);router[_0xa203('0x5')](_0xa203('0xa'),auth[_0xa203('0x6')](),controller[_0xa203('0xb')]);router[_0xa203('0x5')](_0xa203('0xc'),auth[_0xa203('0x6')](),controller[_0xa203('0xd')]);router[_0xa203('0x5')](_0xa203('0xe'),controller[_0xa203('0xf')]);router[_0xa203('0x5')](_0xa203('0x10'),auth[_0xa203('0x6')](),controller[_0xa203('0x11')]);router[_0xa203('0x5')]('/:id/contacts',auth[_0xa203('0x6')](),controller['getContacts']);router[_0xa203('0x5')](_0xa203('0x12'),auth[_0xa203('0x6')](),controller[_0xa203('0x13')]);router[_0xa203('0x5')]('/:id/queues_rt',auth[_0xa203('0x6')](),controller[_0xa203('0x14')]);router[_0xa203('0x5')](_0xa203('0x15'),auth[_0xa203('0x6')](),controller[_0xa203('0x16')]);router[_0xa203('0x5')](_0xa203('0x17'),auth[_0xa203('0x6')](),controller[_0xa203('0x18')]);router[_0xa203('0x5')]('/:id/screen_recordings',auth['isAuthenticated'](),controller['getScreenRecordings']);router['get'](_0xa203('0x19'),auth[_0xa203('0x6')](),controller[_0xa203('0x1a')]);router[_0xa203('0x5')](_0xa203('0x1b'),auth['isAuthenticated'](),controller[_0xa203('0x1c')]);router['get'](_0xa203('0x1d'),auth[_0xa203('0x6')](),controller[_0xa203('0x1e')]);router['get'](_0xa203('0x1f'),auth['isAuthenticated'](),controller[_0xa203('0x20')]);router[_0xa203('0x5')](_0xa203('0x21'),auth[_0xa203('0x6')](),controller[_0xa203('0x22')]);router[_0xa203('0x5')](_0xa203('0x23'),auth[_0xa203('0x6')](),controller[_0xa203('0x24')]);router[_0xa203('0x5')](_0xa203('0x25'),auth[_0xa203('0x6')](),controller[_0xa203('0x26')]);router['get'](_0xa203('0x27'),auth[_0xa203('0x6')](),controller[_0xa203('0x28')]);router[_0xa203('0x5')](_0xa203('0x29'),auth[_0xa203('0x6')](),controller['getAgents']);router[_0xa203('0x5')]('/:id/prefixes',auth[_0xa203('0x6')](),controller[_0xa203('0x2a')]);router[_0xa203('0x5')](_0xa203('0x2b'),auth[_0xa203('0x6')](),controller['getFaxAccounts']);router['get'](_0xa203('0x2c'),auth['isAuthenticated'](),controller[_0xa203('0x2d')]);router[_0xa203('0x5')](_0xa203('0x2e'),auth[_0xa203('0x6')](),controller[_0xa203('0x2f')]);router[_0xa203('0x5')](_0xa203('0x30'),auth[_0xa203('0x6')](),controller['getSmsAccounts']);router['get'](_0xa203('0x31'),auth['isAuthenticated'](),controller[_0xa203('0x32')]);router['get'](_0xa203('0x33'),auth['isAuthenticated'](),controller[_0xa203('0x34')]);router[_0xa203('0x5')](_0xa203('0x35'),auth[_0xa203('0x6')](),controller[_0xa203('0x36')]);router[_0xa203('0x5')]('/:id/scheduled_calls',auth[_0xa203('0x6')](),controller[_0xa203('0x37')]);router[_0xa203('0x5')]('/:id/api_key',auth[_0xa203('0x6')](),controller[_0xa203('0x38')]);router[_0xa203('0x39')](_0xa203('0x3a'),auth[_0xa203('0x6')](),controller[_0xa203('0x3b')]);router[_0xa203('0x39')]('/',auth['isAuthenticated'](),controller[_0xa203('0x3c')]);router['post'](_0xa203('0x3d'),auth[_0xa203('0x6')](),controller['bulkCreate']);router[_0xa203('0x39')]('/:id/queues',auth['isAuthenticated'](),controller[_0xa203('0x3e')]);var upload=multer({'storage':multer[_0xa203('0x3f')]({'destination':function(_0x558ed4,_0x583eb4,_0x4e2257){_0x4e2257(null,path[_0xa203('0x40')](config['root'],_0xa203('0x41')));},'filename':function(_0x377d55,_0x422092,_0xf94357){_0xf94357(null,util[_0xa203('0x42')](_0xa203('0x43'),Date[_0xa203('0x44')](),_0x422092[_0xa203('0x45')]));}})});router[_0xa203('0x39')](_0xa203('0xe'),upload[_0xa203('0x46')](_0xa203('0x47')),controller[_0xa203('0x48')]);router['post'](_0xa203('0x49'),auth[_0xa203('0x6')](),controller[_0xa203('0x4a')]);router[_0xa203('0x39')](_0xa203('0x4b'),auth[_0xa203('0x6')](),controller[_0xa203('0x4c')]);router[_0xa203('0x39')](_0xa203('0x4d'),auth[_0xa203('0x6')](),controller[_0xa203('0x4e')]);router[_0xa203('0x39')](_0xa203('0x4f'),auth[_0xa203('0x6')](),controller[_0xa203('0x50')]);router['post']('/:id/teams',auth[_0xa203('0x6')](),controller[_0xa203('0x51')]);router[_0xa203('0x39')](_0xa203('0x52'),auth[_0xa203('0x6')](),controller[_0xa203('0x53')]);router['post'](_0xa203('0x54'),auth[_0xa203('0x6')](),controller[_0xa203('0x55')]);router['post'](_0xa203('0x56'),auth[_0xa203('0x6')](),controller['addFaxInteractions']);router[_0xa203('0x39')](_0xa203('0x57'),auth[_0xa203('0x6')](),controller[_0xa203('0x58')]);router['post']('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0xa203('0x59')]);router['post'](_0xa203('0x5a'),auth['isAuthenticated'](),controller[_0xa203('0x5b')]);router[_0xa203('0x39')](_0xa203('0x2b'),auth['isAuthenticated'](),controller[_0xa203('0x5c')]);router[_0xa203('0x39')](_0xa203('0x2c'),auth[_0xa203('0x6')](),controller[_0xa203('0x5d')]);router['post'](_0xa203('0x2e'),auth[_0xa203('0x6')](),controller[_0xa203('0x5e')]);router['post'](_0xa203('0x30'),auth[_0xa203('0x6')](),controller[_0xa203('0x5f')]);router[_0xa203('0x39')](_0xa203('0x31'),auth['isAuthenticated'](),controller[_0xa203('0x60')]);router[_0xa203('0x39')](_0xa203('0x33'),auth[_0xa203('0x6')](),controller[_0xa203('0x61')]);router[_0xa203('0x39')](_0xa203('0x35'),auth['isAuthenticated'](),controller['addSquareProjects']);router[_0xa203('0x39')](_0xa203('0x62'),auth[_0xa203('0x6')](),controller[_0xa203('0x63')]);router[_0xa203('0x64')](_0xa203('0xc'),auth['isAuthenticated'](),controller[_0xa203('0x65')]);router['put'](_0xa203('0x66'),auth[_0xa203('0x6')](),controller[_0xa203('0x67')]);router[_0xa203('0x68')]('/:id/queues',auth[_0xa203('0x6')](),controller['removeQueues']);router[_0xa203('0x68')](_0xa203('0x25'),auth[_0xa203('0x6')](),controller[_0xa203('0x69')]);router[_0xa203('0x68')]('/:id',auth[_0xa203('0x6')](),controller[_0xa203('0x6a')]);router[_0xa203('0x68')](_0xa203('0x52'),auth[_0xa203('0x6')](),controller[_0xa203('0x6b')]);router[_0xa203('0x68')]('/:id/mail_interactions',auth[_0xa203('0x6')](),controller[_0xa203('0x6c')]);router[_0xa203('0x68')](_0xa203('0x56'),auth[_0xa203('0x6')](),controller['removeFaxInteractions']);router[_0xa203('0x68')](_0xa203('0x57'),auth[_0xa203('0x6')](),controller[_0xa203('0x6d')]);router['delete'](_0xa203('0x6e'),auth[_0xa203('0x6')](),controller[_0xa203('0x6f')]);router['delete'](_0xa203('0x5a'),auth[_0xa203('0x6')](),controller[_0xa203('0x70')]);router['delete'](_0xa203('0x2b'),auth[_0xa203('0x6')](),controller['removeFaxAccounts']);router[_0xa203('0x68')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0xa203('0x71')]);router[_0xa203('0x68')]('/:id/openchannel_accounts',auth[_0xa203('0x6')](),controller['removeOpenchannelAccounts']);router[_0xa203('0x68')](_0xa203('0x30'),auth['isAuthenticated'](),controller[_0xa203('0x72')]);router[_0xa203('0x68')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xa203('0x73')]);router[_0xa203('0x68')](_0xa203('0x33'),auth[_0xa203('0x6')](),controller['removeWhatsappAccounts']);router[_0xa203('0x68')](_0xa203('0x35'),auth[_0xa203('0x6')](),controller[_0xa203('0x74')]);router[_0xa203('0x68')](_0xa203('0x62'),auth['isAuthenticated'](),controller[_0xa203('0x75')]);module[_0xa203('0x76')]=router; \ No newline at end of file +var _0x1bc8=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','getOpenTabs','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/:id/contacts','addContacts','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/square_projects','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout'];(function(_0x4080dd,_0x5b595d){var _0x4ecf85=function(_0x5d281a){while(--_0x5d281a){_0x4080dd['push'](_0x4080dd['shift']());}};_0x4ecf85(++_0x5b595d);}(_0x1bc8,0xf4));var _0x81bc=function(_0x19616a,_0x545c46){_0x19616a=_0x19616a-0x0;var _0x57bfb4=_0x1bc8[_0x19616a];return _0x57bfb4;};'use strict';var multer=require(_0x81bc('0x0'));var util=require(_0x81bc('0x1'));var path=require(_0x81bc('0x2'));var timeout=require(_0x81bc('0x3'));var express=require(_0x81bc('0x4'));var router=express[_0x81bc('0x5')]();var fs_extra=require(_0x81bc('0x6'));var auth=require(_0x81bc('0x7'));var interaction=require(_0x81bc('0x8'));var config=require(_0x81bc('0x9'));var controller=require(_0x81bc('0xa'));router[_0x81bc('0xb')]('/',auth[_0x81bc('0xc')](),controller['index']);router['get'](_0x81bc('0xd'),auth['isAuthenticated'](),controller[_0x81bc('0xe')]);router[_0x81bc('0xb')](_0x81bc('0xf'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x10')]);router['get'](_0x81bc('0x11'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x12')]);router[_0x81bc('0xb')](_0x81bc('0x13'),auth['isAuthenticated'](),controller['show']);router[_0x81bc('0xb')](_0x81bc('0x14'),controller[_0x81bc('0x15')]);router[_0x81bc('0xb')]('/:id/open_tabs',auth[_0x81bc('0xc')](),controller[_0x81bc('0x16')]);router[_0x81bc('0xb')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x81bc('0x17')]);router[_0x81bc('0xb')](_0x81bc('0x18'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x19')]);router[_0x81bc('0xb')](_0x81bc('0x1a'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x1b')]);router['get'](_0x81bc('0x1c'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x1d')]);router['get']('/:id/recordings',auth[_0x81bc('0xc')](),controller[_0x81bc('0x1e')]);router['get'](_0x81bc('0x1f'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x20')]);router[_0x81bc('0xb')](_0x81bc('0x21'),auth[_0x81bc('0xc')](),controller['getChatInteractions']);router[_0x81bc('0xb')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x81bc('0x22')]);router['get']('/:id/mail/interactions',auth[_0x81bc('0xc')](),controller[_0x81bc('0x23')]);router[_0x81bc('0xb')](_0x81bc('0x24'),auth['isAuthenticated'](),controller[_0x81bc('0x25')]);router['get']('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0x81bc('0x26')]);router[_0x81bc('0xb')](_0x81bc('0x27'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x28')]);router['get'](_0x81bc('0x29'),auth['isAuthenticated'](),controller['getTeams']);router['get'](_0x81bc('0x2a'),auth['isAuthenticated'](),controller['getLists']);router[_0x81bc('0xb')](_0x81bc('0x2b'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x2c')]);router[_0x81bc('0xb')](_0x81bc('0x2d'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x2e')]);router[_0x81bc('0xb')](_0x81bc('0x2f'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x30')]);router[_0x81bc('0xb')](_0x81bc('0x31'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x32')]);router[_0x81bc('0xb')]('/:id/openchannel_accounts',auth[_0x81bc('0xc')](),controller[_0x81bc('0x33')]);router[_0x81bc('0xb')]('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x81bc('0x34')]);router[_0x81bc('0xb')](_0x81bc('0x35'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x36')]);router[_0x81bc('0xb')]('/:id/whatsapp_accounts',auth[_0x81bc('0xc')](),controller[_0x81bc('0x37')]);router[_0x81bc('0xb')]('/:id/square_projects',auth[_0x81bc('0xc')](),controller[_0x81bc('0x38')]);router[_0x81bc('0xb')](_0x81bc('0x39'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x3a')]);router[_0x81bc('0xb')](_0x81bc('0x3b'),auth[_0x81bc('0xc')](),controller['getApiKey']);router[_0x81bc('0x3c')](_0x81bc('0x3d'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x3e')]);router[_0x81bc('0x3c')]('/',auth['isAuthenticated'](),controller['create']);router[_0x81bc('0x3c')](_0x81bc('0x3f'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x40')]);router[_0x81bc('0x3c')](_0x81bc('0x18'),auth['isAuthenticated'](),controller[_0x81bc('0x41')]);var upload=multer({'storage':multer[_0x81bc('0x42')]({'destination':function(_0x3bd41c,_0x50c2a1,_0x9b5984){_0x9b5984(null,path[_0x81bc('0x43')](config[_0x81bc('0x44')],_0x81bc('0x45')));},'filename':function(_0x2619c8,_0xde7f47,_0x345549){_0x345549(null,util[_0x81bc('0x46')](_0x81bc('0x47'),Date[_0x81bc('0x48')](),_0xde7f47[_0x81bc('0x49')]));}})});router[_0x81bc('0x3c')](_0x81bc('0x14'),upload[_0x81bc('0x4a')](_0x81bc('0x4b')),controller[_0x81bc('0x4c')]);router[_0x81bc('0x3c')](_0x81bc('0x4d'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x4e')]);router[_0x81bc('0x3c')](_0x81bc('0x4f'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x50')]);router[_0x81bc('0x3c')](_0x81bc('0x51'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x52')]);router[_0x81bc('0x3c')]('/:id/unpause',auth[_0x81bc('0xc')](),controller[_0x81bc('0x53')]);router[_0x81bc('0x3c')]('/:id/teams',auth[_0x81bc('0xc')](),controller[_0x81bc('0x54')]);router['post'](_0x81bc('0x55'),auth[_0x81bc('0xc')](),controller['addChatInteractions']);router[_0x81bc('0x3c')](_0x81bc('0x56'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x57')]);router[_0x81bc('0x3c')](_0x81bc('0x58'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x59')]);router[_0x81bc('0x3c')](_0x81bc('0x5a'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x5b')]);router[_0x81bc('0x3c')](_0x81bc('0x5c'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x5d')]);router['post']('/:id/whatsapp_interactions',auth[_0x81bc('0xc')](),controller[_0x81bc('0x5e')]);router[_0x81bc('0x3c')](_0x81bc('0x2f'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x5f')]);router[_0x81bc('0x3c')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['addMailAccounts']);router[_0x81bc('0x3c')](_0x81bc('0x60'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x61')]);router[_0x81bc('0x3c')](_0x81bc('0x62'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x63')]);router[_0x81bc('0x3c')](_0x81bc('0x35'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x64')]);router[_0x81bc('0x3c')](_0x81bc('0x65'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x66')]);router[_0x81bc('0x3c')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x81bc('0x67')]);router['post'](_0x81bc('0x3b'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x68')]);router[_0x81bc('0x69')]('/:id',auth[_0x81bc('0xc')](),controller[_0x81bc('0x6a')]);router[_0x81bc('0x69')](_0x81bc('0x6b'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x6c')]);router[_0x81bc('0x6d')](_0x81bc('0x18'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x6e')]);router['delete'](_0x81bc('0x29'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x6f')]);router[_0x81bc('0x6d')](_0x81bc('0x13'),auth['isAuthenticated'](),controller['destroy']);router[_0x81bc('0x6d')](_0x81bc('0x55'),auth[_0x81bc('0xc')](),controller['removeChatInteractions']);router[_0x81bc('0x6d')](_0x81bc('0x56'),auth[_0x81bc('0xc')](),controller['removeMailInteractions']);router[_0x81bc('0x6d')](_0x81bc('0x58'),auth[_0x81bc('0xc')](),controller['removeFaxInteractions']);router['delete'](_0x81bc('0x5a'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x70')]);router['delete'](_0x81bc('0x5c'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0x81bc('0x6d')]('/:id/whatsapp_interactions',auth[_0x81bc('0xc')](),controller[_0x81bc('0x71')]);router[_0x81bc('0x6d')](_0x81bc('0x2f'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x72')]);router[_0x81bc('0x6d')](_0x81bc('0x31'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x73')]);router[_0x81bc('0x6d')](_0x81bc('0x60'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x74')]);router['delete'](_0x81bc('0x62'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x75')]);router['delete']('/:id/chat_websites',auth[_0x81bc('0xc')](),controller[_0x81bc('0x76')]);router[_0x81bc('0x6d')](_0x81bc('0x65'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x77')]);router[_0x81bc('0x6d')](_0x81bc('0x78'),auth[_0x81bc('0xc')](),controller[_0x81bc('0x79')]);router[_0x81bc('0x6d')](_0x81bc('0x3b'),auth['isAuthenticated'](),controller[_0x81bc('0x7a')]);module[_0x81bc('0x7b')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index b3dd22b..98db3f6 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 _0x34e8=['isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','avpf','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get'];(function(_0x48b011,_0x1e903e){var _0x1350de=function(_0x50a470){while(--_0x50a470){_0x48b011['push'](_0x48b011['shift']());}};_0x1350de(++_0x1e903e);}(_0x34e8,0x12c));var _0x834e=function(_0x21d2ba,_0x4449d6){_0x21d2ba=_0x21d2ba-0x0;var _0x2af304=_0x34e8[_0x21d2ba];return _0x2af304;};'use strict';var Sequelize=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));module['exports']={'name':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x472111){this[_0x834e('0x6')](_0x834e('0x5'),_0x472111);this[_0x834e('0x6')](_0x834e('0x7'),_0x472111);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'set':function(_0x52056d){this[_0x834e('0x6')](_0x834e('0x8'),_0x52056d);this[_0x834e('0x6')](_0x834e('0x9'),util[_0x834e('0xa')](_0x834e('0xb'),_0x52056d,this[_0x834e('0xc')](_0x834e('0xd'))));}},'alias':{'type':Sequelize[_0x834e('0x4')]},'email':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0xe'),'validate':{'isEmail':!![]},'set':function(_0x36e124){if(_0x36e124){this[_0x834e('0x6')](_0x834e('0xe'),_0x36e124[_0x834e('0xf')]());}}},'role':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x11'),'user',_0x834e('0x12'),_0x834e('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x834e('0x4')],'defaultValue':_0x834e('0x14')},'internal':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':![],'unique':_0x834e('0xd'),'set':function(_0x50e860){this[_0x834e('0x6')](_0x834e('0xd'),_0x50e860);this['setDataValue'](_0x834e('0x16'),_0x50e860);this['setDataValue'](_0x834e('0x9'),util[_0x834e('0xa')]('\x22%s\x22\x20<%s>',this[_0x834e('0xc')](_0x834e('0x8')),_0x50e860));}},'salt':{'type':Sequelize[_0x834e('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x834e('0x4')]},'address':{'type':Sequelize[_0x834e('0x4')]},'zipcode':{'type':Sequelize[_0x834e('0x4')]},'userpic':{'type':Sequelize[_0x834e('0x4')]},'city':{'type':Sequelize[_0x834e('0x4')]},'country':{'type':Sequelize[_0x834e('0x4')]},'online':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x834e('0x18')},'lastPauseAt':{'type':Sequelize[_0x834e('0x19')]},'chatCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x834e('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x834e('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':!![],'defaultValue':_0x834e('0x1b')},'context':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x834e('0x1d'),_0x834e('0x1e'),_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),_0x834e('0x23'),_0x834e('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x25'),'set':function(_0x2b3418){this[_0x834e('0x6')](_0x834e('0x26'),_0x2b3418?_0x2b3418[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x26'))?this[_0x834e('0xc')]('transport')[_0x834e('0x28')](','):null;},'comment':_0x834e('0x29')},'dtmfmode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2a'),'info',_0x834e('0x2b'),_0x834e('0x2c'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x31'),'set':function(_0x6a3ac){this['setDataValue'](_0x834e('0x32'),_0x6a3ac?_0x6a3ac[_0x834e('0x27')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x834e('0xc')](_0x834e('0x32'))[_0x834e('0x28')](','):null;},'comment':_0x834e('0x33')},'callgroup':{'type':Sequelize[_0x834e('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x834e('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x834e('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x834e('0x34')},'allow':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'defaultValue':_0x834e('0x35'),'set':function(_0x3c59af){this[_0x834e('0x6')]('allow',_0x3c59af?_0x3c59af[_0x834e('0x27')](';'):_0x834e('0x35'));},'get':function(){return this[_0x834e('0xc')]('allow')?this[_0x834e('0xc')](_0x834e('0x36'))['split'](';'):null;},'comment':_0x834e('0x37')},'autoframing':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'set':function(_0x4a18bb){this['setDataValue'](_0x834e('0x38'),_0x4a18bb?_0x4a18bb[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x38'))?this[_0x834e('0xc')](_0x834e('0x38'))[_0x834e('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x834e('0x10')]('yes','no',_0x834e('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x3a')},'amaflags':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3c'),_0x834e('0x3d'),_0x834e('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3f'),_0x834e('0x40')),'allowNull':!![],'defaultValue':_0x834e('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x834e('0x10')]('yes','no','fingerprint',_0x834e('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x834e('0x10')]('active',_0x834e('0x42'),_0x834e('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x834e('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x834e('0x19')]},'passwordResetAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x834e('0x45')]},'showWebBar':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0,'set':function(_0x1e4310){this[_0x834e('0x6')](_0x834e('0x46'),_0x1e4310);var _0x1659c8=this[_0x834e('0x47')]({'plain':!![]});switch(_0x1e4310){case 0x0:case 0x1:var _0x17b8e3=_0x1659c8[_0x834e('0x26')]?_[_0x834e('0x48')](_0x1659c8[_0x834e('0x26')])?_0x1659c8[_0x834e('0x26')][_0x834e('0x27')]():_0x1659c8[_0x834e('0x26')]:'udp';if(_0x17b8e3===_0x834e('0x49')){_0x17b8e3=_0x834e('0x25');}this[_0x834e('0x6')](_0x834e('0x26'),_0x17b8e3);this['setDataValue'](_0x834e('0x4a'),'no');this['setDataValue']('avpf',null);this[_0x834e('0x6')](_0x834e('0x4b'),null);this[_0x834e('0x6')](_0x834e('0x4c'),null);this[_0x834e('0x6')](_0x834e('0x4d'),null);this[_0x834e('0x6')](_0x834e('0x4e'),null);this['setDataValue'](_0x834e('0x4f'),null);this['setDataValue'](_0x834e('0x50'),null);this[_0x834e('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x834e('0x51'),'no');break;case 0x2:this[_0x834e('0x6')](_0x834e('0x26'),_0x834e('0x49'));this[_0x834e('0x6')]('encryption',_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x52'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4b'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4c'),_0x834e('0x2d'));this['setDataValue'](_0x834e('0x4d'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4e'),'no');this['setDataValue'](_0x834e('0x4f'),'actpass');this['setDataValue']('dtlscertfile',_0x1659c8[_0x834e('0x50')]||_0x834e('0x53'));this['setDataValue'](_0x834e('0x54'),_0x1659c8[_0x834e('0x54')]||'/etc/pki/tls/private/motion.key');this[_0x834e('0x6')](_0x834e('0x51'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x346be5){this[_0x834e('0x6')](_0x834e('0x55'),_0x346be5?_0x346be5[_0x834e('0x27')](','):[]);},'get':function(){return this[_0x834e('0xc')]('permissions')?_[_0x834e('0x56')](this['getDataValue'](_0x834e('0x55'))[_0x834e('0x28')](','),function(_0x2c758c){return parseInt(_0x2c758c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x834e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x834e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x834e('0xc')](_0x834e('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x18ddac){if(typeof _0x18ddac===_0x834e('0x58')){var _0x5acf5c=_0x18ddac==='1'?!![]:_0x18ddac==='0'?![]:_0x18ddac===_0x834e('0x59')?!![]:_0x18ddac===_0x834e('0x5a')?![]:![];this[_0x834e('0x6')]('screenrecording',_0x5acf5c);}else{this[_0x834e('0x6')](_0x834e('0x5b'),_0x18ddac);}}},'blocked':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x443633){this[_0x834e('0x6')]('blocked',_0x443633);if(_0x443633===!![]){this['setDataValue'](_0x834e('0x5c'),moment());this[_0x834e('0x6')]('loginAttempts',0x0);}else{this[_0x834e('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x834e('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0}}; \ No newline at end of file +var _0x34e8=['isArray','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','avpf','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','lodash','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','passive','actpass','update,nonat','TEXT','showWebBar','get'];(function(_0x2502b3,_0x22e266){var _0x1157e3=function(_0x38449c){while(--_0x38449c){_0x2502b3['push'](_0x2502b3['shift']());}};_0x1157e3(++_0x22e266);}(_0x34e8,0x12c));var _0x834e=function(_0x168864,_0x5d13a1){_0x168864=_0x168864-0x0;var _0x337f08=_0x34e8[_0x168864];return _0x337f08;};'use strict';var Sequelize=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var _=require(_0x834e('0x3'));module['exports']={'name':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x472111){this[_0x834e('0x6')](_0x834e('0x5'),_0x472111);this[_0x834e('0x6')](_0x834e('0x7'),_0x472111);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'set':function(_0x52056d){this[_0x834e('0x6')](_0x834e('0x8'),_0x52056d);this[_0x834e('0x6')](_0x834e('0x9'),util[_0x834e('0xa')](_0x834e('0xb'),_0x52056d,this[_0x834e('0xc')](_0x834e('0xd'))));}},'alias':{'type':Sequelize[_0x834e('0x4')]},'email':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'unique':_0x834e('0xe'),'validate':{'isEmail':!![]},'set':function(_0x36e124){if(_0x36e124){this[_0x834e('0x6')](_0x834e('0xe'),_0x36e124[_0x834e('0xf')]());}}},'role':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x11'),'user',_0x834e('0x12'),_0x834e('0x13')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x834e('0x4')],'defaultValue':_0x834e('0x14')},'internal':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':![],'unique':_0x834e('0xd'),'set':function(_0x50e860){this[_0x834e('0x6')](_0x834e('0xd'),_0x50e860);this['setDataValue'](_0x834e('0x16'),_0x50e860);this['setDataValue'](_0x834e('0x9'),util[_0x834e('0xa')]('\x22%s\x22\x20<%s>',this[_0x834e('0xc')](_0x834e('0x8')),_0x50e860));}},'salt':{'type':Sequelize[_0x834e('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x834e('0x4')]},'address':{'type':Sequelize[_0x834e('0x4')]},'zipcode':{'type':Sequelize[_0x834e('0x4')]},'userpic':{'type':Sequelize[_0x834e('0x4')]},'city':{'type':Sequelize[_0x834e('0x4')]},'country':{'type':Sequelize[_0x834e('0x4')]},'online':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x834e('0x18')},'lastPauseAt':{'type':Sequelize[_0x834e('0x19')]},'chatCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x834e('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x834e('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user','peer'),'allowNull':!![],'defaultValue':_0x834e('0x1b')},'context':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x1c')},'callingpres':{'type':Sequelize['ENUM'](_0x834e('0x1d'),_0x834e('0x1e'),_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),_0x834e('0x23'),_0x834e('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x25'),'set':function(_0x2b3418){this[_0x834e('0x6')](_0x834e('0x26'),_0x2b3418?_0x2b3418[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x26'))?this[_0x834e('0xc')]('transport')[_0x834e('0x28')](','):null;},'comment':_0x834e('0x29')},'dtmfmode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2a'),'info',_0x834e('0x2b'),_0x834e('0x2c'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x834e('0x31'),'set':function(_0x6a3ac){this['setDataValue'](_0x834e('0x32'),_0x6a3ac?_0x6a3ac[_0x834e('0x27')](','):null);},'get':function(){return this['getDataValue']('nat')?this[_0x834e('0xc')](_0x834e('0x32'))[_0x834e('0x28')](','):null;},'comment':_0x834e('0x33')},'callgroup':{'type':Sequelize[_0x834e('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x834e('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x834e('0x4')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x834e('0x34')},'allow':{'type':Sequelize[_0x834e('0x4')],'allowNull':![],'defaultValue':_0x834e('0x35'),'set':function(_0x3c59af){this[_0x834e('0x6')]('allow',_0x3c59af?_0x3c59af[_0x834e('0x27')](';'):_0x834e('0x35'));},'get':function(){return this[_0x834e('0xc')]('allow')?this[_0x834e('0xc')](_0x834e('0x36'))['split'](';'):null;},'comment':_0x834e('0x37')},'autoframing':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'set':function(_0x4a18bb){this['setDataValue'](_0x834e('0x38'),_0x4a18bb?_0x4a18bb[_0x834e('0x27')](','):null);},'get':function(){return this[_0x834e('0xc')](_0x834e('0x38'))?this[_0x834e('0xc')](_0x834e('0x38'))[_0x834e('0x28')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x834e('0x10')]('yes','no',_0x834e('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![],'defaultValue':_0x834e('0x3a')},'amaflags':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3c'),_0x834e('0x3d'),_0x834e('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x3f'),_0x834e('0x40')),'allowNull':!![],'defaultValue':_0x834e('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':_0x834e('0x2d')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x834e('0x10')]('yes','no','fingerprint',_0x834e('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x834e('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x834e('0x10')]('active',_0x834e('0x42'),_0x834e('0x43')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x834e('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x834e('0x2d'),'no',_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x834e('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x834e('0x19')]},'passwordResetAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x834e('0x45')]},'showWebBar':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0,'set':function(_0x1e4310){this[_0x834e('0x6')](_0x834e('0x46'),_0x1e4310);var _0x1659c8=this[_0x834e('0x47')]({'plain':!![]});switch(_0x1e4310){case 0x0:case 0x1:var _0x17b8e3=_0x1659c8[_0x834e('0x26')]?_[_0x834e('0x48')](_0x1659c8[_0x834e('0x26')])?_0x1659c8[_0x834e('0x26')][_0x834e('0x27')]():_0x1659c8[_0x834e('0x26')]:'udp';if(_0x17b8e3===_0x834e('0x49')){_0x17b8e3=_0x834e('0x25');}this[_0x834e('0x6')](_0x834e('0x26'),_0x17b8e3);this['setDataValue'](_0x834e('0x4a'),'no');this['setDataValue']('avpf',null);this[_0x834e('0x6')](_0x834e('0x4b'),null);this[_0x834e('0x6')](_0x834e('0x4c'),null);this[_0x834e('0x6')](_0x834e('0x4d'),null);this[_0x834e('0x6')](_0x834e('0x4e'),null);this['setDataValue'](_0x834e('0x4f'),null);this['setDataValue'](_0x834e('0x50'),null);this[_0x834e('0x6')]('dtlsprivatekey',null);this['setDataValue'](_0x834e('0x51'),'no');break;case 0x2:this[_0x834e('0x6')](_0x834e('0x26'),_0x834e('0x49'));this[_0x834e('0x6')]('encryption',_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x52'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4b'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4c'),_0x834e('0x2d'));this['setDataValue'](_0x834e('0x4d'),_0x834e('0x2d'));this[_0x834e('0x6')](_0x834e('0x4e'),'no');this['setDataValue'](_0x834e('0x4f'),'actpass');this['setDataValue']('dtlscertfile',_0x1659c8[_0x834e('0x50')]||_0x834e('0x53'));this['setDataValue'](_0x834e('0x54'),_0x1659c8[_0x834e('0x54')]||'/etc/pki/tls/private/motion.key');this[_0x834e('0x6')](_0x834e('0x51'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x346be5){this[_0x834e('0x6')](_0x834e('0x55'),_0x346be5?_0x346be5[_0x834e('0x27')](','):[]);},'get':function(){return this[_0x834e('0xc')]('permissions')?_[_0x834e('0x56')](this['getDataValue'](_0x834e('0x55'))[_0x834e('0x28')](','),function(_0x2c758c){return parseInt(_0x2c758c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x834e('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x834e('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x834e('0x10')](_0x834e('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x834e('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0x834e('0xc')](_0x834e('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x834e('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x18ddac){if(typeof _0x18ddac===_0x834e('0x58')){var _0x5acf5c=_0x18ddac==='1'?!![]:_0x18ddac==='0'?![]:_0x18ddac===_0x834e('0x59')?!![]:_0x18ddac===_0x834e('0x5a')?![]:![];this[_0x834e('0x6')]('screenrecording',_0x5acf5c);}else{this[_0x834e('0x6')](_0x834e('0x5b'),_0x18ddac);}}},'blocked':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![],'set':function(_0x443633){this[_0x834e('0x6')]('blocked',_0x443633);if(_0x443633===!![]){this['setDataValue'](_0x834e('0x5c'),moment());this[_0x834e('0x6')]('loginAttempts',0x0);}else{this[_0x834e('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x834e('0x19')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x834e('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x834e('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x834e('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x834e('0x15')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index f384437..7fe571e 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 _0x3a4c=['UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','updateAttributes','DEFAULT\x20PAUSE','unpause','faxPause','pauseType','lastPauseAt','manual','mail','%s%s','Pause','QueuePause','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','User\x20with\x20id\x20%s\x20not\x20found','transaction','getAssociatedQueues','flattenDeep','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','QueueId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','VoicePrefixId','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$notIn','$like','$notILike','$contains','$any','firstName','lastName','phone','dialActive','VoiceQueue','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','removeApiKey','apiKeyNonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','teams','queues','isEmpty','inbound','flatten','col','toString','asc','desc','substring','uniqBy','orderBy','request','http','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','pause','idle','unknown','unavailable','ringing','voiceStatus','slice','charAt','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','util','lodash','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','defaults','localhost','client','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','limit','undefined','count','offset','set','json','userNotification:recalc:','destroy','get','admin','Users','Agents','Telephones','telephone','filter','map','value','includes','role','name','UserProfileResource','status','stack','send','index','User','rawAttributes','fieldName','type','password','getOptions','where','query','userSetting','true','push','findAll','rows','openTabs','length','chat','dataValues','openchannel','whatsapp','all','show','model','differenceBy','keys','salt','filters','intersection','attributes','fields','includeAll','include','UserSetting','merge','options','find','sms','fax','update','body','describe','addContacts','ids','omit','internal','Setting','findById','validatePasswordPattern','max','isNil','min_internal','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)','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','email','agent','permissions','101','110','104','106','107','108','109','100','114','115','create','user','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','securePassword','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','params','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','penalty','spread','emit','Queue:save','voice','SIP/%s','upsert','removeQueues','Queues','isArray','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','file','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','server/files/images/','download','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','concat','getContacts','findOne','order','sort','hasOwnProperty','CmList','Tags','color','tag','getQueues','Queue','Unknown\x20role','nolimit','getVoiceQueuesRt','pick','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','ScreenRecording','getChatInteractions','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','WhatsappInteraction','getWhatsappInteractions','login','mobile','format','intrf','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3a4c,0xa0));var _0xc3a4=function(_0x3289bd,_0x44531c){_0x3289bd=_0x3289bd-0x0;var _0x212de2=_0x3a4c[_0x3289bd];return _0x212de2;};'use strict';var moment=require(_0xc3a4('0x0'));var BPromise=require('bluebird');var util=require(_0xc3a4('0x1'));var path=require('path');var fs=require('fs');var _=require(_0xc3a4('0x2'));var squel=require('squel');var jayson=require(_0xc3a4('0x3'));var Redis=require(_0xc3a4('0x4'));var authService=require(_0xc3a4('0x5'));var qs=require(_0xc3a4('0x6'));var logger=require(_0xc3a4('0x7'))(_0xc3a4('0x8'));var utils=require(_0xc3a4('0x9'));var config=require(_0xc3a4('0xa'));var licenseUtil=require(_0xc3a4('0xb'));var APIBadRequestError=require(_0xc3a4('0xc'))[_0xc3a4('0xd')];var APINotFoundError=require(_0xc3a4('0xc'))[_0xc3a4('0xe')];var APIHandleError=require(_0xc3a4('0xc'))[_0xc3a4('0xf')];var db=require(_0xc3a4('0x10'))['db'];var socket=require(_0xc3a4('0x11'))(new Redis(config[_0xc3a4('0x12')]));require(_0xc3a4('0x13'))['register'](socket);config['redis']=_[_0xc3a4('0x14')](config['redis'],{'host':_0xc3a4('0x15'),'port':0x18eb});var client=jayson[_0xc3a4('0x16')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x14ad66,_0x40bc77,_0x2190ed,_0x4ac5a4){return new BPromise(function(_0x2d1e6d,_0x4c9ddf){var _0x2ae3a7=_0x4ac5a4||client;return _0x2ae3a7['request'](_0x14ad66,_0x2190ed)[_0xc3a4('0x17')](function(_0x262777){logger[_0xc3a4('0x18')](_0xc3a4('0x19'),_0x40bc77,_0xc3a4('0x1a'));logger[_0xc3a4('0x1b')](_0xc3a4('0x1c'),_0x40bc77,_0xc3a4('0x1a'),JSON['stringify'](_0x262777));if(_0x262777['error']){if(_0x262777[_0xc3a4('0x1d')][_0xc3a4('0x1e')]===0x1f4){logger[_0xc3a4('0x1d')](_0xc3a4('0x19'),_0x40bc77,_0x262777[_0xc3a4('0x1d')][_0xc3a4('0x1f')]);return _0x4c9ddf(_0x262777[_0xc3a4('0x1d')][_0xc3a4('0x1f')]);}logger[_0xc3a4('0x1d')](_0xc3a4('0x19'),_0x40bc77,_0x262777[_0xc3a4('0x1d')][_0xc3a4('0x1f')]);return _0x2d1e6d(_0x262777[_0xc3a4('0x1d')][_0xc3a4('0x1f')]);}else{logger[_0xc3a4('0x18')](_0xc3a4('0x19'),_0x40bc77,_0xc3a4('0x1a'));_0x2d1e6d(_0x262777[_0xc3a4('0x20')][_0xc3a4('0x1f')]);}})[_0xc3a4('0x21')](function(_0x42eb08){logger[_0xc3a4('0x1d')]('User,\x20%s,\x20%s',_0x40bc77,_0x42eb08);_0x4c9ddf(_0x42eb08);});});}function respondWithStatusCode(_0x2ff900,_0x4cb462){_0x4cb462=_0x4cb462||0xcc;return function(_0x4a76ad){if(_0x4a76ad){return _0x2ff900[_0xc3a4('0x22')](_0x4cb462);}return _0x2ff900['status'](_0x4cb462)[_0xc3a4('0x23')]();};}function respondWithResult(_0x4c7d61,_0x28ac84){_0x28ac84=_0x28ac84||0xc8;return function(_0x1d6a83){if(_0x1d6a83){return _0x4c7d61['status'](_0x28ac84)['json'](_0x1d6a83);}};}function respondWithFilteredResult(_0x5e3fac,_0xffd5ad){return function(_0x1d163d){if(_0x1d163d){var _0x49250a=typeof _0xffd5ad['offset']==='undefined'&&typeof _0xffd5ad[_0xc3a4('0x24')]===_0xc3a4('0x25');var _0x4fd63d=_0x1d163d[_0xc3a4('0x26')];var _0x243987=_0x49250a?0x0:_0xffd5ad[_0xc3a4('0x27')];var _0x3e12b9=_0x49250a?_0x1d163d[_0xc3a4('0x26')]:_0xffd5ad[_0xc3a4('0x27')]+_0xffd5ad[_0xc3a4('0x24')];var _0x242447;if(_0x3e12b9>=_0x4fd63d){_0x3e12b9=_0x4fd63d;_0x242447=0xc8;}else{_0x242447=0xce;}_0x5e3fac['status'](_0x242447);return _0x5e3fac[_0xc3a4('0x28')]('Content-Range',_0x243987+'-'+_0x3e12b9+'/'+_0x4fd63d)[_0xc3a4('0x29')](_0x1d163d);}return null;};}function saveUpdates(_0x494e4c){return function(_0x5959c2){if(_0x5959c2){return _0x5959c2['update'](_0x494e4c)[_0xc3a4('0x17')](function(_0x5a26ba){socket['emit'](_0xc3a4('0x2a')+_0x5a26ba['id'],{});return _0x5a26ba;});}return null;};}function removeEntity(_0x334f04){return function(_0x42c030){if(_0x42c030){return _0x42c030[_0xc3a4('0x2b')]()[_0xc3a4('0x17')](function(){var _0xda2731=_0x42c030[_0xc3a4('0x2c')]({'plain':!![]});if(_0xda2731['role']===_0xc3a4('0x2d'))return;var _0x27c234=[{'name':_0xc3a4('0x2e'),'value':'user','ignore':!![]},{'name':_0xc3a4('0x2f'),'value':'agent','ignore':![]},{'name':_0xc3a4('0x30'),'value':_0xc3a4('0x31'),'ignore':![]}];var _0x5dd67a=_(_0x27c234)[_0xc3a4('0x32')]('ignore')[_0xc3a4('0x33')](_0xc3a4('0x34'))['value']();if(_[_0xc3a4('0x35')](_0x5dd67a,_0xda2731[_0xc3a4('0x36')])){return;}var _0x5e782a=_['find'](_0x27c234,[_0xc3a4('0x34'),_0xda2731[_0xc3a4('0x36')]])[_0xc3a4('0x37')];return db[_0xc3a4('0x38')][_0xc3a4('0x2b')]({'where':{'type':_0x5e782a,'resourceId':_0xda2731['id']}})[_0xc3a4('0x17')](function(){return _0x42c030;});})['then'](function(){_0x334f04[_0xc3a4('0x39')](0xcc)[_0xc3a4('0x23')]();});}};}function handleEntityNotFound(_0x126813){return function(_0x2d1ffb){if(!_0x2d1ffb){_0x126813[_0xc3a4('0x22')](0x194);}return _0x2d1ffb;};}function handleError(_0x1eb2ca,_0x3a1c7d){_0x3a1c7d=_0x3a1c7d||0x1f4;return function(_0x55a209){logger['error'](_0x55a209[_0xc3a4('0x3a')]);if(_0x55a209[_0xc3a4('0x37')]){delete _0x55a209['name'];}_0x1eb2ca[_0xc3a4('0x39')](_0x3a1c7d)[_0xc3a4('0x3b')](_0x55a209);};}exports[_0xc3a4('0x3c')]=function(_0x882275,_0x351a5c){var _0x14e123={},_0x2b18ed={'count':0x0,'rows':[]};var _0x47e190=_(db[_0xc3a4('0x3d')][_0xc3a4('0x3e')])[_0xc3a4('0x33')](function(_0x2fa5a2){return{'name':_0x2fa5a2[_0xc3a4('0x3f')],'type':_0x2fa5a2[_0xc3a4('0x40')]['key']};})[_0xc3a4('0x32')](function(_0x40253a){return!_[_0xc3a4('0x35')]([_0xc3a4('0x41'),'salt'],_0x40253a[_0xc3a4('0x37')]);})[_0xc3a4('0x34')]();_0x14e123=qs[_0xc3a4('0x42')](_0x47e190,_0x882275);var _0x2a5a3e={'where':_0x14e123[_0xc3a4('0x43')]};return db[_0xc3a4('0x3d')]['count'](_0x2a5a3e)[_0xc3a4('0x17')](function(_0x1f5bbe){_0x2b18ed[_0xc3a4('0x26')]=_0x1f5bbe;if(_0x882275[_0xc3a4('0x44')]['includeAll']){_0x14e123['include']=[{'all':!![]}];}if(_0x882275['query'][_0xc3a4('0x45')]===_0xc3a4('0x46')){_0x14e123['include']=[{'model':db['UserSetting'],'as':_0xc3a4('0x45')}];}if(!_[_0xc3a4('0x35')](_0x14e123['attributes'],'id')){_0x14e123['attributes'][_0xc3a4('0x47')]('id');}return db[_0xc3a4('0x3d')][_0xc3a4('0x48')](_0x14e123);})[_0xc3a4('0x17')](function(_0x310c5a){_0x2b18ed[_0xc3a4('0x49')]=_0x310c5a;if(_0x882275[_0xc3a4('0x44')][_0xc3a4('0x4a')]==='true'){var _0x557561=[];for(var _0x44a4bf=0x0;_0x44a4bf<_0x2b18ed['rows'][_0xc3a4('0x4b')];_0x44a4bf++){_0x557561['push'](get_open_tabs(_0xc3a4('0x4c'),_0x2b18ed[_0xc3a4('0x49')][_0x44a4bf][_0xc3a4('0x4d')]));_0x557561[_0xc3a4('0x47')](get_open_tabs('sms',_0x2b18ed[_0xc3a4('0x49')][_0x44a4bf]['dataValues']));_0x557561[_0xc3a4('0x47')](get_open_tabs('fax',_0x2b18ed[_0xc3a4('0x49')][_0x44a4bf]['dataValues']));_0x557561[_0xc3a4('0x47')](get_open_tabs('mail',_0x2b18ed[_0xc3a4('0x49')][_0x44a4bf][_0xc3a4('0x4d')]));_0x557561['push'](get_open_tabs(_0xc3a4('0x4e'),_0x2b18ed[_0xc3a4('0x49')][_0x44a4bf][_0xc3a4('0x4d')]));_0x557561[_0xc3a4('0x47')](get_open_tabs(_0xc3a4('0x4f'),_0x2b18ed[_0xc3a4('0x49')][_0x44a4bf]['dataValues']));}return BPromise[_0xc3a4('0x50')](_0x557561)[_0xc3a4('0x17')](function(){return _0x2b18ed;});}else{return _0x2b18ed;}})[_0xc3a4('0x17')](respondWithFilteredResult(_0x351a5c,_0x14e123))[_0xc3a4('0x21')](handleError(_0x351a5c,null));};exports[_0xc3a4('0x51')]=function(_0x401294,_0x5ecd36){var _0x570c99={'raw':![],'where':{'id':_0x401294['params']['id']}},_0x2906d0={};_0x2906d0[_0xc3a4('0x52')]=_[_0xc3a4('0x53')](_[_0xc3a4('0x54')](db[_0xc3a4('0x3d')][_0xc3a4('0x3e')]),[_0xc3a4('0x41'),_0xc3a4('0x55')]);_0x2906d0[_0xc3a4('0x44')]=_[_0xc3a4('0x54')](_0x401294[_0xc3a4('0x44')]);_0x2906d0[_0xc3a4('0x56')]=_[_0xc3a4('0x57')](_0x2906d0[_0xc3a4('0x52')],_0x2906d0[_0xc3a4('0x44')]);_0x570c99[_0xc3a4('0x58')]=_[_0xc3a4('0x57')](_0x2906d0[_0xc3a4('0x52')],qs[_0xc3a4('0x59')](_0x401294[_0xc3a4('0x44')][_0xc3a4('0x59')]));_0x570c99[_0xc3a4('0x58')]=_0x570c99['attributes']['length']?_0x570c99[_0xc3a4('0x58')]:_0x2906d0[_0xc3a4('0x52')];if(_0x401294[_0xc3a4('0x44')][_0xc3a4('0x5a')]){_0x570c99[_0xc3a4('0x5b')]=[{'all':!![]}];}if(_0x401294[_0xc3a4('0x44')]['userSetting']===_0xc3a4('0x46')){_0x570c99['include']=[{'model':db[_0xc3a4('0x5c')],'as':_0xc3a4('0x45')}];}_0x570c99=_[_0xc3a4('0x5d')]({},_0x570c99,_0x401294[_0xc3a4('0x5e')]);if(!_[_0xc3a4('0x35')](_0x570c99['attributes'],'id')){_0x570c99[_0xc3a4('0x58')]['push']('id');}return db[_0xc3a4('0x3d')][_0xc3a4('0x5f')](_0x570c99)[_0xc3a4('0x17')](handleEntityNotFound(_0x5ecd36,null))[_0xc3a4('0x17')](function(_0x5d71b9){var _0x17afee=[];values=_0x5d71b9;if(_0x401294[_0xc3a4('0x44')][_0xc3a4('0x4a')]===_0xc3a4('0x46')){_0x17afee['push'](get_open_tabs(_0xc3a4('0x4c'),_0x5d71b9['dataValues']));_0x17afee['push'](get_open_tabs(_0xc3a4('0x60'),_0x5d71b9['dataValues']));_0x17afee[_0xc3a4('0x47')](get_open_tabs('openchannel',_0x5d71b9[_0xc3a4('0x4d')]));_0x17afee[_0xc3a4('0x47')](get_open_tabs('whatsapp',_0x5d71b9[_0xc3a4('0x4d')]));_0x17afee[_0xc3a4('0x47')](get_open_tabs(_0xc3a4('0x61'),_0x5d71b9[_0xc3a4('0x4d')]));_0x17afee[_0xc3a4('0x47')](get_open_tabs('mail',_0x5d71b9[_0xc3a4('0x4d')]));return BPromise[_0xc3a4('0x50')](_0x17afee);}else{return values;}})[_0xc3a4('0x17')](function(){return values;})['then'](respondWithResult(_0x5ecd36,null))['catch'](handleError(_0x5ecd36,null));};exports[_0xc3a4('0x62')]=function(_0x5e03ea,_0x14edb9){if(_0x5e03ea[_0xc3a4('0x63')]['id']){delete _0x5e03ea[_0xc3a4('0x63')]['id'];}delete _0x5e03ea[_0xc3a4('0x63')][_0xc3a4('0x36')];return db[_0xc3a4('0x3d')][_0xc3a4('0x5f')]({'where':{'id':_0x5e03ea['params']['id']}})[_0xc3a4('0x17')](handleEntityNotFound(_0x14edb9,null))['then'](saveUpdates(_0x5e03ea['body'],null))[_0xc3a4('0x17')](respondWithResult(_0x14edb9,null))['catch'](handleError(_0x14edb9,null));};exports[_0xc3a4('0x64')]=function(_0x351eb8,_0xc6b69c){return db[_0xc3a4('0x3d')][_0xc3a4('0x64')]()['then'](respondWithResult(_0xc6b69c,null))[_0xc3a4('0x21')](handleError(_0xc6b69c,null));};exports[_0xc3a4('0x65')]=function(_0x36e411,_0x1433ef){return db[_0xc3a4('0x3d')]['find']({'where':{'id':_0x36e411['params']['id']}})[_0xc3a4('0x17')](handleEntityNotFound(_0x1433ef,null))[_0xc3a4('0x17')](function(_0x674d4a){if(_0x674d4a){return _0x674d4a[_0xc3a4('0x65')](_0x36e411[_0xc3a4('0x63')][_0xc3a4('0x66')],_[_0xc3a4('0x67')](_0x36e411[_0xc3a4('0x63')],[_0xc3a4('0x66'),'id'])||{});}})[_0xc3a4('0x17')](respondWithResult(_0x1433ef,null))[_0xc3a4('0x21')](handleError(_0x1433ef,null));};function validateUser(_0x543b1b){return new BPromise(function(_0x410a8a,_0x348866){if(_0x543b1b[_0xc3a4('0x68')])return _0x410a8a(_0x543b1b);return db[_0xc3a4('0x69')][_0xc3a4('0x6a')](0x1)[_0xc3a4('0x17')](function(_0x495f2e){if(_0x495f2e['securePassword'])authService[_0xc3a4('0x6b')](_0x543b1b[_0xc3a4('0x41')]);db[_0xc3a4('0x3d')][_0xc3a4('0x6c')](_0xc3a4('0x68'))[_0xc3a4('0x17')](function(_0x20603e){if(_[_0xc3a4('0x6d')](_0x20603e)){_0x543b1b[_0xc3a4('0x68')]=_0x495f2e[_0xc3a4('0x6e')]||0x1;return;}if(_[_0xc3a4('0x6d')](_0x495f2e['min_internal'])||_0x495f2e[_0xc3a4('0x6e')]===_0x20603e){_0x543b1b[_0xc3a4('0x68')]=_0x20603e+0x1;return;}if(_0x495f2e[_0xc3a4('0x6e')]>_0x20603e){_0x543b1b[_0xc3a4('0x68')]=_0x495f2e['min_internal'];return;}return db['sequelize'][_0xc3a4('0x44')](_0xc3a4('0x6f'),{'type':db[_0xc3a4('0x70')][_0xc3a4('0x71')][_0xc3a4('0x72')]})[_0xc3a4('0x17')](function(_0x15713e){if(_0x15713e&&_0x15713e['length']){for(var _0x135d6f=0x0,_0x4de8d5=_0x15713e['length'];_0x135d6f<_0x4de8d5&&_[_0xc3a4('0x6d')](_0x543b1b[_0xc3a4('0x68')]);_0x135d6f++){if(_0x495f2e[_0xc3a4('0x6e')]<=_0x15713e[_0x135d6f][_0xc3a4('0x73')]){_0x543b1b[_0xc3a4('0x68')]=_0x15713e[_0x135d6f]['from'];}else if(_0x495f2e[_0xc3a4('0x6e')]>_0x15713e[_0x135d6f][_0xc3a4('0x73')]&&_0x495f2e['min_internal']<=_0x15713e[_0x135d6f]['to']){_0x543b1b[_0xc3a4('0x68')]=_0x495f2e['min_internal'];}}}if(_[_0xc3a4('0x6d')](_0x543b1b[_0xc3a4('0x68')])){_0x543b1b[_0xc3a4('0x68')]=_0x20603e+0x1;}return _0x410a8a(_0x543b1b);});});})[_0xc3a4('0x21')](function(_0x3463f0){_0x348866(_0x3463f0);});});}function updateUser(_0x4c8610){return new BPromise(function(_0x2b3a9d,_0x41cbc7){try{if(_0x4c8610[_0xc3a4('0x74')]){_0x4c8610[_0xc3a4('0x75')]=_0x4c8610[_0xc3a4('0x68')];_0x4c8610[_0xc3a4('0x76')]={'mailbox':_0x4c8610[_0xc3a4('0x68')],'password':_0x4c8610[_0xc3a4('0x41')],'fullname':_0x4c8610['fullname'],'email':_0x4c8610[_0xc3a4('0x77')]};}if(_0x4c8610[_0xc3a4('0x36')]===_0xc3a4('0x78')){if(!_0x4c8610['permissions'])_0x4c8610[_0xc3a4('0x79')]=[_0xc3a4('0x7a'),'102','103','113',_0xc3a4('0x7b'),_0xc3a4('0x7c'),'105',_0xc3a4('0x7d'),_0xc3a4('0x7e'),_0xc3a4('0x7f'),_0xc3a4('0x80'),_0xc3a4('0x81'),'111',_0xc3a4('0x82'),_0xc3a4('0x83')];}_0x2b3a9d(_0x4c8610);}catch(_0x2241f8){_0x41cbc7(_0x2241f8);}});}exports[_0xc3a4('0x84')]=function(_0x1d59e1,_0x56c8a6){if(_0x1d59e1[_0xc3a4('0x85')][_0xc3a4('0x36')]==='agent')throw new Error(_0xc3a4('0x86'));if(_0x1d59e1[_0xc3a4('0x63')]['role']===_0xc3a4('0x85')&&_0x1d59e1['user'][_0xc3a4('0x36')]!==_0xc3a4('0x2d')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x1d59e1[_0xc3a4('0x63')][_0xc3a4('0x36')]===_0xc3a4('0x2d')&&_0x1d59e1[_0xc3a4('0x85')][_0xc3a4('0x36')]!==_0xc3a4('0x2d')){throw new Error(_0xc3a4('0x87'));}return licenseUtil[_0xc3a4('0x88')]([_0x1d59e1[_0xc3a4('0x63')]])['then'](function(){return validateUser(_0x1d59e1['body']);})['then'](function(_0x2ca908){return updateUser(_0x2ca908)[_0xc3a4('0x17')](function(_0x3eb03a){if(_0x3eb03a['role']===_0xc3a4('0x2d')){_0x3eb03a[_0xc3a4('0x89')]=_0x1d59e1[_0xc3a4('0x85')][_0xc3a4('0x89')];delete _0x3eb03a[_0xc3a4('0x8a')];}return _0x3eb03a;});})['then'](function(_0x5a7819){return db[_0xc3a4('0x3d')][_0xc3a4('0x84')](_0x5a7819,{'include':[{'model':db[_0xc3a4('0x76')],'as':'VoiceMail'}]});})[_0xc3a4('0x17')](function(_0x78780b){if(_0x1d59e1['body'][_0xc3a4('0x36')]==='user')return _0x78780b;if(_0x1d59e1[_0xc3a4('0x85')][_0xc3a4('0x36')]!==_0xc3a4('0x85'))return _0x78780b;return db[_0xc3a4('0x8b')]['find']({'where':{'name':_0x78780b[_0xc3a4('0x36')]===_0xc3a4('0x78')?'Agents':_0xc3a4('0x30'),'userProfileId':_0x1d59e1['user'][_0xc3a4('0x8a')]},'raw':!![]})[_0xc3a4('0x17')](function(_0x50adf9){if(!_0x50adf9||_0x50adf9[_0xc3a4('0x8c')]!=0x0)return _0x78780b;return db[_0xc3a4('0x38')][_0xc3a4('0x84')]({'name':_0x78780b[_0xc3a4('0x37')],'resourceId':_0x78780b['id'],'type':_0x50adf9[_0xc3a4('0x37')],'sectionId':_0x50adf9['id']},{})[_0xc3a4('0x17')](function(){return _0x78780b;});})[_0xc3a4('0x21')](function(_0x2d9c74){logger[_0xc3a4('0x1d')](_0xc3a4('0x8d'),_0x2d9c74);throw _0x2d9c74;});})[_0xc3a4('0x17')](respondWithResult(_0x56c8a6,0xc9))[_0xc3a4('0x21')](handleError(_0x56c8a6,null));};exports[_0xc3a4('0x8e')]=function(_0x56e0d3,_0x5e1782){var _0x147763=_0x56e0d3[_0xc3a4('0x63')];var _0x22a7b1=[];if(_0x56e0d3['user'][_0xc3a4('0x36')]===_0xc3a4('0x78'))throw new Error(_0xc3a4('0x86'));if(_[_0xc3a4('0x8f')](_0x147763,['role',_0xc3a4('0x85')])&&_0x56e0d3[_0xc3a4('0x85')][_0xc3a4('0x36')]!==_0xc3a4('0x2d')){throw new Error(_0xc3a4('0x90'));}if(_[_0xc3a4('0x8f')](_0x147763,['role',_0xc3a4('0x2d')])&&_0x56e0d3['user'][_0xc3a4('0x36')]!=='admin'){throw new Error(_0xc3a4('0x91'));}return licenseUtil[_0xc3a4('0x88')](_0x147763)[_0xc3a4('0x17')](function(){return validateUser(_0x147763[0x0]);})[_0xc3a4('0x17')](function(){for(var _0x4a18f0=0x1;_0x4a18f0<_0x147763['length'];_0x4a18f0++){var _0x21a59d=_0x147763[_0x4a18f0-0x1][_0xc3a4('0x68')];if(!_0x147763[_0x4a18f0][_0xc3a4('0x68')])_0x147763[_0x4a18f0][_0xc3a4('0x68')]=_0x21a59d+0x1;_0x22a7b1['push'](validateUser(_0x147763[_0x4a18f0]));}return BPromise[_0xc3a4('0x50')](_0x22a7b1);})['then'](function(){_0x22a7b1=[];for(var _0x5e4951=0x0;_0x5e4951<_0x147763[_0xc3a4('0x4b')];_0x5e4951++){_0x22a7b1[_0xc3a4('0x47')](updateUser(_0x147763[_0x5e4951]));}return BPromise[_0xc3a4('0x50')](_0x22a7b1);})['then'](function(){return BPromise[_0xc3a4('0x92')](_0x147763,function(_0x17e561){return db[_0xc3a4('0x3d')]['create'](_0x17e561,{'include':[{'model':db[_0xc3a4('0x76')],'as':_0xc3a4('0x76')}]})[_0xc3a4('0x17')](function(_0x5b189c){_0x17e561['id']=_0x5b189c['id'];return _0x17e561;});});})[_0xc3a4('0x17')](function(_0x35d937){if(_0x56e0d3[_0xc3a4('0x63')][_0xc3a4('0x36')]==='user')return _0x35d937;if(_0x56e0d3['user']['role']!=='user')return _0x35d937;var _0x4d4ed7=_['some'](_0x35d937,function(_0x7d1536){return _0x7d1536['role']===_0xc3a4('0x78')||_0x7d1536['role']===_0xc3a4('0x31');});if(!_0x4d4ed7)return _0x35d937;return db[_0xc3a4('0x8b')][_0xc3a4('0x48')]({'where':{'name':{'$or':[_0xc3a4('0x2f'),_0xc3a4('0x30')]},'userProfileId':_0x56e0d3[_0xc3a4('0x85')]['userProfileId']},'raw':!![]})[_0xc3a4('0x17')](function(_0x393682){if(_['isEmpty'](_0x393682)||!_[_0xc3a4('0x8f')](_0x393682,[_0xc3a4('0x8c'),0x0]))return _0x35d937;_0x22a7b1=[];var _0x96255d=_(_0x393682)['map'](function(_0x4d0922){if(_0x4d0922['autoAssociation']===0x1)return;return _0x4d0922[_0xc3a4('0x37')]===_0xc3a4('0x2f')?'agent':_0xc3a4('0x31');})[_0xc3a4('0x93')]()[_0xc3a4('0x34')]();for(var _0x26138=0x0;_0x26138<_0x35d937[_0xc3a4('0x4b')];_0x26138++){if(!_[_0xc3a4('0x35')](_0x96255d,_0x35d937[_0x26138][_0xc3a4('0x36')]))return;var _0x1f3829=_0x35d937[_0x26138][_0xc3a4('0x36')]===_0xc3a4('0x78')?_0xc3a4('0x2f'):_0xc3a4('0x30');_0x22a7b1[_0xc3a4('0x47')](db[_0xc3a4('0x38')][_0xc3a4('0x84')]({'name':_0x35d937[_0x26138]['name'],'resourceId':_0x35d937[_0x26138]['id'],'type':_0x1f3829,'sectionId':_[_0xc3a4('0x5f')](_0x393682,[_0xc3a4('0x37'),_0x1f3829])['id']},{}));}return BPromise[_0xc3a4('0x50')](_0x22a7b1);});})[_0xc3a4('0x17')](respondWithResult(_0x5e1782,0xc9))[_0xc3a4('0x21')](handleError(_0x5e1782,null));};exports[_0xc3a4('0x94')]=function(_0x4c863b,_0xc28546){if(_0x4c863b[_0xc3a4('0x63')]['id']){delete _0x4c863b['body']['id'];}return db['User'][_0xc3a4('0x5f')]({'where':{'id':_0x4c863b['params']['id']}})[_0xc3a4('0x17')](function(_0x21b697){if(!_0x21b697)return null;if(_0x21b697['id']===_0x4c863b['user']['id']){if(!_0x4c863b[_0xc3a4('0x63')][_0xc3a4('0x95')]||!_0x4c863b['body'][_0xc3a4('0x96')]){throw new db[(_0xc3a4('0x97'))][(_0xc3a4('0x98'))](_0xc3a4('0x99'));}if(!_0x21b697[_0xc3a4('0x9a')](_0x4c863b[_0xc3a4('0x63')][_0xc3a4('0x95')])){throw new db[(_0xc3a4('0x97'))][(_0xc3a4('0x98'))](_0xc3a4('0x9b'));}if(_0x4c863b[_0xc3a4('0x63')][_0xc3a4('0x95')]===_0x4c863b[_0xc3a4('0x63')][_0xc3a4('0x96')]){throw new db[(_0xc3a4('0x97'))][(_0xc3a4('0x98'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x4c863b[_0xc3a4('0x85')]['role']==='admin'){if(!_0x4c863b[_0xc3a4('0x63')][_0xc3a4('0x96')]){throw new db['Sequelize'][(_0xc3a4('0x98'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x4c863b[_0xc3a4('0x85')][_0xc3a4('0x36')]===_0xc3a4('0x85')){if(!_0x4c863b['body'][_0xc3a4('0x96')]){throw new db[(_0xc3a4('0x97'))][(_0xc3a4('0x98'))](_0xc3a4('0x9c'));}if(_0x21b697[_0xc3a4('0x36')]!==_0xc3a4('0x78')){throw new db['Sequelize'][(_0xc3a4('0x98'))](_0xc3a4('0x86'));}}else{throw new db[(_0xc3a4('0x97'))][(_0xc3a4('0x98'))]('Unauthorized');}return _0x21b697;})[_0xc3a4('0x17')](handleEntityNotFound(_0xc28546,null))[_0xc3a4('0x17')](function(_0x4cac06){return db[_0xc3a4('0x69')]['findOne']({'attributes':['id',_0xc3a4('0x9d'),_0xc3a4('0x9e'),'passwordHistoryLimit']})[_0xc3a4('0x17')](function(_0x509a1f){if(_0x509a1f[_0xc3a4('0x9d')])authService['validatePasswordPattern'](_0x4c863b['body']['newPassword']);if(!_0x509a1f[_0xc3a4('0x9e')]||!_0x4cac06[_0xc3a4('0x9f')])return _0x4cac06;authService[_0xc3a4('0xa0')](_0x4c863b[_0xc3a4('0x63')][_0xc3a4('0x96')],_0x4cac06[_0xc3a4('0x9f')],_0x509a1f[_0xc3a4('0xa1')]);return _0x4cac06;})['then'](saveUpdates({'password':_0x4c863b[_0xc3a4('0x63')]['newPassword'],'passwordResetAt':_0x4c863b[_0xc3a4('0x85')]['id']==_0x4c863b[_0xc3a4('0xa2')]['id']?moment():null,'previousPasswords':authService[_0xc3a4('0xa3')](_0x4c863b[_0xc3a4('0x63')]['newPassword'],_0x4cac06[_0xc3a4('0x9f')])},null));})[_0xc3a4('0x17')](respondWithResult(_0xc28546,null))[_0xc3a4('0x21')](handleError(_0xc28546,null));};exports[_0xc3a4('0xa4')]=function(_0x4c3bd7,_0x314499){var _0x93b57c=_0x4c3bd7[_0xc3a4('0x63')][_0xc3a4('0xa5')];return db['User'][_0xc3a4('0x5f')]({'where':{'id':_0x4c3bd7[_0xc3a4('0xa2')]['id']},'attributes':['id',_0xc3a4('0x37'),_0xc3a4('0x36'),_0xc3a4('0xa6'),_0xc3a4('0xa7'),_0xc3a4('0xa8'),_0xc3a4('0xa9')]})[_0xc3a4('0x17')](handleEntityNotFound(_0x314499,null))['then'](function(_0x275b03){if(_0x275b03){if(!utils[_0xc3a4('0xaa')](_0x93b57c)){throw new db[(_0xc3a4('0x97'))][(_0xc3a4('0x98'))](_0xc3a4('0xab'));}return _0x275b03['add'+_[_0xc3a4('0xac')](_0x93b57c[_0xc3a4('0xad')]())+'Queues'](_0x4c3bd7['body'][_0xc3a4('0x66')],{'penalty':_0x4c3bd7['body'][_0xc3a4('0xae')]||0x0})[_0xc3a4('0xaf')](function(_0x2d5863){for(var _0x1a0de4=0x0;_0x1a0de4<_0x4c3bd7['body'][_0xc3a4('0x66')][_0xc3a4('0x4b')];_0x1a0de4+=0x1){var _0x40e010={'UserId':Number(_0x4c3bd7[_0xc3a4('0xa2')]['id'])};_0x40e010[_['capitalize'](_0x93b57c[_0xc3a4('0xad')]())+'QueueId']=Number(_0x4c3bd7[_0xc3a4('0x63')]['ids'][_0x1a0de4]);socket[_0xc3a4('0xb0')](_0xc3a4('0x85')+_['capitalize'](_0x93b57c['toLowerCase']())+_0xc3a4('0xb1'),_0x40e010);}return _0x2d5863;})['then'](function(){if(_0x93b57c===_0xc3a4('0xb2')){return db['VoiceQueue']['findAll']({'where':{'id':_0x4c3bd7[_0xc3a4('0x63')][_0xc3a4('0x66')]||[]},'raw':!![],'attributes':['id',_0xc3a4('0x37')]});}})[_0xc3a4('0x17')](function(_0x3721ee){var _0x2d6709=_0x275b03[_0xc3a4('0x2c')]({'plain':!![]});var _0x3fccc9=[];if(_0x93b57c===_0xc3a4('0xb2')&&_0x2d6709[_0xc3a4('0x36')]===_0xc3a4('0x78')&&_0x2d6709[_0xc3a4('0xa6')]){for(var _0x252c75=0x0;_0x252c75<_0x3721ee[_0xc3a4('0x4b')];_0x252c75+=0x1){_0x3fccc9[_0xc3a4('0x47')]({'membername':_0x2d6709[_0xc3a4('0x37')],'UserId':_0x2d6709['id'],'queue_name':_0x3721ee[_0x252c75][_0xc3a4('0x37')],'VoiceQueueId':_0x3721ee[_0x252c75]['id'],'interface':_[_0xc3a4('0x6d')](_0x2d6709[_0xc3a4('0xa9')])?util['format'](_0xc3a4('0xb3'),_0x2d6709[_0xc3a4('0x37')]):_0x2d6709[_0xc3a4('0xa9')],'paused':_0x2d6709[_0xc3a4('0xa8')]||![],'penalty':_0x4c3bd7[_0xc3a4('0x63')]['penalty']||0x0});}return BPromise[_0xc3a4('0x92')](_0x3fccc9,function(_0x11fe5f){return db['UserVoiceQueueRt'][_0xc3a4('0xb4')](_0x11fe5f);});}return _0x275b03;});}})['then'](respondWithStatusCode(_0x314499,null))['catch'](handleError(_0x314499,null));};exports[_0xc3a4('0xb5')]=function(_0x52fcc8,_0x50b21d){var _0x10940f,_0x1d2acd;return db[_0xc3a4('0x3d')][_0xc3a4('0x5f')]({'where':{'id':_0x52fcc8[_0xc3a4('0xa2')]['id']},'attributes':['id',_0xc3a4('0x37'),_0xc3a4('0x36')]})[_0xc3a4('0x17')](handleEntityNotFound(_0x50b21d,null))[_0xc3a4('0x17')](function(_0x17fcec){if(_0x17fcec){_0x10940f=_0x17fcec;if(!_0x52fcc8[_0xc3a4('0x44')]['channel']||!utils[_0xc3a4('0xaa')](_0x52fcc8[_0xc3a4('0x44')][_0xc3a4('0xa5')])){throw new db[(_0xc3a4('0x97'))]['ValidationError'](_0xc3a4('0xab'));}return _0x17fcec['remove'+_[_0xc3a4('0xac')](_0x52fcc8[_0xc3a4('0x44')][_0xc3a4('0xa5')]['toLowerCase']())+_0xc3a4('0xb6')](_0x52fcc8[_0xc3a4('0x44')][_0xc3a4('0x66')]);}})['then'](function(_0x34c77c){if(_[_0xc3a4('0xb7')](_0x52fcc8['query'][_0xc3a4('0x66')])){for(var _0x3e43b4=0x0;_0x3e43b4<_0x52fcc8['query'][_0xc3a4('0x66')]['length'];_0x3e43b4+=0x1){_0x1d2acd={'UserId':Number(_0x52fcc8[_0xc3a4('0xa2')]['id'])};_0x1d2acd[_[_0xc3a4('0xac')](_0x52fcc8[_0xc3a4('0x44')][_0xc3a4('0xa5')]['toLowerCase']())+'QueueId']=Number(_0x52fcc8['query'][_0xc3a4('0x66')][_0x3e43b4]);socket['emit'](_0xc3a4('0x85')+_[_0xc3a4('0xac')](_0x52fcc8[_0xc3a4('0x44')]['channel'][_0xc3a4('0xad')]())+_0xc3a4('0xb8'),_0x1d2acd);}}else{_0x1d2acd={'UserId':Number(_0x52fcc8[_0xc3a4('0xa2')]['id'])};_0x1d2acd[_[_0xc3a4('0xac')](_0x52fcc8[_0xc3a4('0x44')][_0xc3a4('0xa5')][_0xc3a4('0xad')]())+'QueueId']=Number(_0x52fcc8['query'][_0xc3a4('0x66')]);socket[_0xc3a4('0xb0')](_0xc3a4('0x85')+_[_0xc3a4('0xac')](_0x52fcc8['query']['channel']['toLowerCase']())+_0xc3a4('0xb8'),_0x1d2acd);}return _0x34c77c;})['then'](function(){if(_0x52fcc8[_0xc3a4('0x44')]['channel']===_0xc3a4('0xb2')){return db[_0xc3a4('0xb9')][_0xc3a4('0x2b')]({'where':{'UserId':_0x52fcc8['params']['id'],'VoiceQueueId':_0x52fcc8[_0xc3a4('0x44')]['ids']},'individualHooks':!![]})['then'](function(){return _0x10940f;});}return _0x10940f;})['then'](respondWithStatusCode(_0x50b21d,null))['catch'](handleError(_0x50b21d,null));};exports[_0xc3a4('0xba')]=function(_0x3dffed,_0x11984a){_0x3dffed[_0xc3a4('0x63')][_0xc3a4('0xbb')]=_0x3dffed[_0xc3a4('0xbc')][_0xc3a4('0xbd')];return db[_0xc3a4('0x3d')]['find']({'where':{'id':_0x3dffed[_0xc3a4('0xa2')]['id']}})[_0xc3a4('0x17')](handleEntityNotFound(_0x11984a,null))['then'](saveUpdates(_0x3dffed[_0xc3a4('0x63')],null))[_0xc3a4('0x17')](respondWithResult(_0x11984a,null))['catch'](handleError(_0x11984a,null));};exports[_0xc3a4('0xbe')]=function(_0x4d42bd,_0x3a744e){var _0x3e1c8e=path[_0xc3a4('0xbf')](config[_0xc3a4('0xc0')],_0xc3a4('0xc1'));return db[_0xc3a4('0x3d')][_0xc3a4('0x5f')]({'where':{'id':_0x4d42bd['params']['id']},'attributes':['id',_0xc3a4('0xbb')],'raw':!![]})[_0xc3a4('0x17')](handleEntityNotFound(_0x3a744e,null))[_0xc3a4('0x17')](function(_0x212f7c){if(_0x212f7c){if(_[_0xc3a4('0x6d')](_0x212f7c[_0xc3a4('0xbb')])){return _0x3a744e['download'](_0x3e1c8e);}else{if(!fs['existsSync'](path[_0xc3a4('0xbf')](config[_0xc3a4('0xc0')],_0xc3a4('0xc2'),_0x212f7c[_0xc3a4('0xbb')]))){return _0x3a744e[_0xc3a4('0xc3')](_0x3e1c8e);}return _0x3a744e['download'](path[_0xc3a4('0xbf')](config[_0xc3a4('0xc0')],'server/files/images/',_0x212f7c['userpic']));}}})[_0xc3a4('0x21')](handleError(_0x3a744e,null));};exports['getOpenTabs']=function(_0x1e1e18,_0x5ebe68){return db[_0xc3a4('0x3d')][_0xc3a4('0x5f')]({'where':{'id':_0x1e1e18[_0xc3a4('0xa2')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x5ebe68,null))[_0xc3a4('0x17')](function(_0x58fd9c){var _0xcee8ba=[];values=_0x58fd9c[_0xc3a4('0x4d')];_0xcee8ba[_0xc3a4('0x47')](get_open_tabs(_0xc3a4('0x4c'),_0x58fd9c['dataValues']));_0xcee8ba[_0xc3a4('0x47')](get_open_tabs('sms',_0x58fd9c['dataValues']));_0xcee8ba[_0xc3a4('0x47')](get_open_tabs(_0xc3a4('0x4e'),_0x58fd9c['dataValues']));_0xcee8ba['push'](get_open_tabs(_0xc3a4('0x4f'),_0x58fd9c['dataValues']));_0xcee8ba[_0xc3a4('0x47')](get_open_tabs(_0xc3a4('0x61'),_0x58fd9c['dataValues']));_0xcee8ba[_0xc3a4('0x47')](get_open_tabs('mail',_0x58fd9c[_0xc3a4('0x4d')]));return BPromise['all'](_0xcee8ba);})[_0xc3a4('0x17')](function(_0x40aee4){if(_0x40aee4){var _0x4d3bd0=_['map'](values[_0xc3a4('0xc4')],function(_0x5c6a87){return{'channel':_0xc3a4('0xc5'),'id':_0x5c6a87['id'],'createdAt':_0x5c6a87[_0xc3a4('0xc6')]};});var _0x43fa91=_['map'](values[_0xc3a4('0xc7')],function(_0x5b6768){return{'channel':'FAX','id':_0x5b6768['id'],'createdAt':_0x5b6768[_0xc3a4('0xc6')]};});var _0xb01f6e=_[_0xc3a4('0x33')](values[_0xc3a4('0xc8')],function(_0x18b78f){return{'channel':_0xc3a4('0xc9'),'id':_0x18b78f['id'],'createdAt':_0x18b78f['createdAt']};});var _0x4b6319=_[_0xc3a4('0x33')](values[_0xc3a4('0xca')],function(_0x5aac9c){return{'channel':_0xc3a4('0xcb'),'id':_0x5aac9c['id'],'createdAt':_0x5aac9c[_0xc3a4('0xc6')]};});var _0x2d53b0=_[_0xc3a4('0x33')](values[_0xc3a4('0xcc')],function(_0x2fab87){return{'channel':'SMS','id':_0x2fab87['id'],'createdAt':_0x2fab87['createdAt']};});var _0x10898b=_[_0xc3a4('0x33')](values[_0xc3a4('0xcd')],function(_0x4bf29a){return{'channel':'WHATSAPP','id':_0x4bf29a['id'],'createdAt':_0x4bf29a[_0xc3a4('0xc6')]};});var _0x11eb55=_[_0xc3a4('0xce')](_0x4d3bd0,_0x43fa91,_0xb01f6e,_0x4b6319,_0x2d53b0,_0x10898b);var _0x1d9db6={'count':_0x11eb55['length'],'rows':_0x11eb55};return _0x1d9db6;}else return null;})[_0xc3a4('0x17')](respondWithResult(_0x5ebe68,null))[_0xc3a4('0x21')](handleError(_0x5ebe68,null));};exports[_0xc3a4('0xcf')]=function(_0x16832a,_0x382fe5){var _0x453976={};var _0x3712c2={};var _0x513d02;var _0x2a17d9;return db[_0xc3a4('0x3d')][_0xc3a4('0xd0')]({'where':{'id':_0x16832a[_0xc3a4('0xa2')]['id']}})[_0xc3a4('0x17')](handleEntityNotFound(_0x382fe5,null))[_0xc3a4('0x17')](function(_0x29fa2e){if(_0x29fa2e){_0x513d02=_0x29fa2e;_0x3712c2[_0xc3a4('0x52')]=_[_0xc3a4('0x54')](db['CmContact'][_0xc3a4('0x3e')]);_0x3712c2[_0xc3a4('0x44')]=_['keys'](_0x16832a['query']);_0x3712c2['filters']=_[_0xc3a4('0x57')](_0x3712c2[_0xc3a4('0x52')],_0x3712c2[_0xc3a4('0x44')]);_0x453976[_0xc3a4('0x58')]=_[_0xc3a4('0x57')](_0x3712c2[_0xc3a4('0x52')],qs[_0xc3a4('0x59')](_0x16832a[_0xc3a4('0x44')][_0xc3a4('0x59')]));_0x453976[_0xc3a4('0x58')]=_0x453976[_0xc3a4('0x58')][_0xc3a4('0x4b')]?_0x453976[_0xc3a4('0x58')]:_0x3712c2[_0xc3a4('0x52')];_0x453976[_0xc3a4('0xd1')]=qs['sort'](_0x16832a[_0xc3a4('0x44')][_0xc3a4('0xd2')]);_0x453976['where']=qs[_0xc3a4('0x56')](_['pick'](_0x16832a[_0xc3a4('0x44')],_0x3712c2[_0xc3a4('0x56')]));if(_0x16832a[_0xc3a4('0x44')]['filter']){_0x453976[_0xc3a4('0x43')]=_[_0xc3a4('0x5d')](_0x453976[_0xc3a4('0x43')],{'$or':_['map'](_0x453976[_0xc3a4('0x58')],function(_0x25ebff){var _0x695912={};_0x695912[_0x25ebff]={'$like':'%'+_0x16832a[_0xc3a4('0x44')][_0xc3a4('0x32')]+'%'};return _0x695912;})});}_0x453976=_[_0xc3a4('0x5d')]({},_0x453976,_0x16832a[_0xc3a4('0x5e')]);return _0x513d02['getContacts'](_0x453976);}})[_0xc3a4('0x17')](function(_0x37626a){if(_0x37626a){_0x2a17d9=_0x37626a['length'];if(_0x16832a[_0xc3a4('0x44')][_0xc3a4('0xd3')]('includeAll')){_0x453976[_0xc3a4('0x5b')]=[{'model':db[_0xc3a4('0xd4')],'as':'List','required':![]},{'model':db['Tag'],'as':_0xc3a4('0xd5'),'attributes':['id',_0xc3a4('0x37'),_0xc3a4('0xd6')],'where':_0x16832a[_0xc3a4('0x44')][_0xc3a4('0xd7')]?{'id':_0x16832a[_0xc3a4('0x44')][_0xc3a4('0xd7')]}:undefined,'required':_0x16832a[_0xc3a4('0x44')][_0xc3a4('0xd7')]?!![]:![]}];}if(!_0x16832a['query'][_0xc3a4('0xd3')]('nolimit')){_0x453976[_0xc3a4('0x24')]=qs[_0xc3a4('0x24')](_0x16832a[_0xc3a4('0x44')][_0xc3a4('0x24')]);_0x453976['offset']=qs['offset'](_0x16832a['query'][_0xc3a4('0x27')]);}return _0x513d02['getContacts'](_0x453976);}})[_0xc3a4('0x17')](function(_0x2a7dde){if(_0x2a7dde){return _0x2a7dde?{'count':_0x2a17d9,'rows':_0x2a7dde}:null;}})['then'](respondWithResult(_0x382fe5,null))['catch'](handleError(_0x382fe5,null));};exports[_0xc3a4('0xd8')]=function(_0x457083,_0x28f098){var _0x32006c;var _0x304a09={};var _0x5aef3e;return db['User']['findOne']({'where':{'id':_0x457083[_0xc3a4('0xa2')]['id']},'attributes':['id',_0xc3a4('0x37'),_0xc3a4('0x36')]})[_0xc3a4('0x17')](handleEntityNotFound(_0x28f098,null))[_0xc3a4('0x17')](function(_0x333da4){if(!utils['isValidChannel'](_0x457083['query'][_0xc3a4('0xa5')])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}_0x32006c=_0x333da4;var _0x303192={};_0x303192[_0xc3a4('0x52')]=_[_0xc3a4('0x54')](db[_[_0xc3a4('0xac')](_0x457083['query'][_0xc3a4('0xa5')])+_0xc3a4('0xd9')]['rawAttributes']);_0x303192[_0xc3a4('0x44')]=_['keys'](_0x457083['query']);_0x303192[_0xc3a4('0x56')]=_['intersection'](_0x303192[_0xc3a4('0x52')],_0x303192[_0xc3a4('0x44')]);_0x304a09['attributes']=_[_0xc3a4('0x57')](_0x303192['model'],qs[_0xc3a4('0x59')](_0x457083[_0xc3a4('0x44')]['fields']));_0x304a09[_0xc3a4('0x58')]=_0x304a09[_0xc3a4('0x58')]['length']?_0x304a09[_0xc3a4('0x58')]:_0x303192[_0xc3a4('0x52')];_0x304a09[_0xc3a4('0xd1')]=qs[_0xc3a4('0xd2')](_0x457083[_0xc3a4('0x44')]['sort']);_0x304a09[_0xc3a4('0x43')]=qs[_0xc3a4('0x56')](_['pick'](_0x457083[_0xc3a4('0x44')],_0x303192[_0xc3a4('0x56')]));if(_0x457083[_0xc3a4('0x44')][_0xc3a4('0x32')]){_0x304a09[_0xc3a4('0x43')]=_[_0xc3a4('0x5d')](_0x304a09[_0xc3a4('0x43')],{'$or':_[_0xc3a4('0x33')](_0x304a09['attributes'],function(_0x11b6f3){var _0x1555f2={};_0x1555f2[_0x11b6f3]={'$like':'%'+_0x457083[_0xc3a4('0x44')][_0xc3a4('0x32')]+'%'};return _0x1555f2;})});}_0x304a09=_['merge']({},_0x304a09,_0x457083[_0xc3a4('0x5e')]);switch(_0x32006c[_0xc3a4('0x36')]){case _0xc3a4('0x2d'):return db[_['capitalize'](_0x457083[_0xc3a4('0x44')][_0xc3a4('0xa5')])+_0xc3a4('0xd9')][_0xc3a4('0x48')](_0x304a09);case _0xc3a4('0x85'):case'agent':return _0x32006c['get'+_[_0xc3a4('0xac')](_0x457083['query'][_0xc3a4('0xa5')])+_0xc3a4('0xb6')](_0x304a09);default:throw new db['Sequelize']['ValidationError'](_0xc3a4('0xda'));}})[_0xc3a4('0x17')](function(_0x56c8e1){_0x5aef3e=_0x56c8e1['length'];if(!_0x457083[_0xc3a4('0x44')][_0xc3a4('0xd3')](_0xc3a4('0xdb'))){_0x304a09[_0xc3a4('0x24')]=qs['limit'](_0x457083[_0xc3a4('0x44')]['limit']);_0x304a09[_0xc3a4('0x27')]=qs['offset'](_0x457083['query'][_0xc3a4('0x27')]);}switch(_0x32006c[_0xc3a4('0x36')]){case _0xc3a4('0x2d'):return db[_['capitalize'](_0x457083['query']['channel'])+'Queue'][_0xc3a4('0x48')](_0x304a09);case'user':case _0xc3a4('0x78'):return _0x32006c[_0xc3a4('0x2c')+_[_0xc3a4('0xac')](_0x457083['query']['channel'])+_0xc3a4('0xb6')](_0x304a09);}})[_0xc3a4('0x17')](function(_0x4b456a){return{'count':_0x5aef3e,'rows':_0x4b456a};})['then'](respondWithResult(_0x28f098,null))['catch'](handleError(_0x28f098,null));};exports[_0xc3a4('0xdc')]=function(_0x52d6d2,_0x16d93d){var _0x2e2c79={};var _0x3f30be={};var _0x38b565;var _0x267cfa;return db[_0xc3a4('0x3d')][_0xc3a4('0xd0')]({'where':{'id':_0x52d6d2['params']['id']}})[_0xc3a4('0x17')](handleEntityNotFound(_0x16d93d,null))[_0xc3a4('0x17')](function(_0x4e5368){if(_0x4e5368){_0x38b565=_0x4e5368;_0x3f30be[_0xc3a4('0x52')]=_[_0xc3a4('0x54')](db[_0xc3a4('0xb9')][_0xc3a4('0x3e')]);_0x3f30be[_0xc3a4('0x44')]=_[_0xc3a4('0x54')](_0x52d6d2['query']);_0x3f30be[_0xc3a4('0x56')]=_['intersection'](_0x3f30be['model'],_0x3f30be['query']);_0x2e2c79[_0xc3a4('0x58')]=_['intersection'](_0x3f30be[_0xc3a4('0x52')],qs[_0xc3a4('0x59')](_0x52d6d2[_0xc3a4('0x44')]['fields']));_0x2e2c79[_0xc3a4('0x58')]=_0x2e2c79[_0xc3a4('0x58')][_0xc3a4('0x4b')]?_0x2e2c79['attributes']:_0x3f30be[_0xc3a4('0x52')];_0x2e2c79[_0xc3a4('0xd1')]=qs[_0xc3a4('0xd2')](_0x52d6d2['query'][_0xc3a4('0xd2')]);_0x2e2c79['where']=qs[_0xc3a4('0x56')](_[_0xc3a4('0xdd')](_0x52d6d2[_0xc3a4('0x44')],_0x3f30be[_0xc3a4('0x56')]));if(_0x52d6d2[_0xc3a4('0x44')][_0xc3a4('0x32')]){_0x2e2c79[_0xc3a4('0x43')]=_['merge'](_0x2e2c79[_0xc3a4('0x43')],{'$or':_['map'](_0x2e2c79[_0xc3a4('0x58')],function(_0x5e238a){var _0x4cd86d={};_0x4cd86d[_0x5e238a]={'$like':'%'+_0x52d6d2[_0xc3a4('0x44')][_0xc3a4('0x32')]+'%'};return _0x4cd86d;})});}_0x2e2c79=_[_0xc3a4('0x5d')]({},_0x2e2c79,_0x52d6d2['options']);return _0x38b565[_0xc3a4('0xdc')](_0x2e2c79);}})[_0xc3a4('0x17')](function(_0x12abdd){if(_0x12abdd){_0x267cfa=_0x12abdd[_0xc3a4('0x4b')];if(!_0x52d6d2[_0xc3a4('0x44')][_0xc3a4('0xd3')](_0xc3a4('0xdb'))){_0x2e2c79[_0xc3a4('0x24')]=qs[_0xc3a4('0x24')](_0x52d6d2[_0xc3a4('0x44')][_0xc3a4('0x24')]);_0x2e2c79['offset']=qs[_0xc3a4('0x27')](_0x52d6d2[_0xc3a4('0x44')][_0xc3a4('0x27')]);}return _0x38b565[_0xc3a4('0xdc')](_0x2e2c79);}})[_0xc3a4('0x17')](function(_0x4bdce6){if(_0x4bdce6){return _0x4bdce6?{'count':_0x267cfa,'rows':_0x4bdce6}:null;}})[_0xc3a4('0x17')](respondWithResult(_0x16d93d,null))[_0xc3a4('0x21')](handleError(_0x16d93d,null));};exports[_0xc3a4('0xde')]=function(_0x2f6029,_0x331255){var _0x3b8165={};var _0x40c21a={};var _0x3ac3f3;var _0x56d96e;return db[_0xc3a4('0x3d')]['findOne']({'where':{'id':_0x2f6029[_0xc3a4('0xa2')]['id']}})[_0xc3a4('0x17')](handleEntityNotFound(_0x331255,null))[_0xc3a4('0x17')](function(_0x3a13cb){if(_0x3a13cb){_0x3ac3f3=_0x3a13cb;_0x40c21a[_0xc3a4('0x52')]=_['keys'](db[_0xc3a4('0xdf')][_0xc3a4('0x3e')]);_0x40c21a[_0xc3a4('0x44')]=_[_0xc3a4('0x54')](_0x2f6029[_0xc3a4('0x44')]);_0x40c21a[_0xc3a4('0x56')]=_[_0xc3a4('0x57')](_0x40c21a['model'],_0x40c21a[_0xc3a4('0x44')]);_0x3b8165[_0xc3a4('0x58')]=_[_0xc3a4('0x57')](_0x40c21a['model'],qs[_0xc3a4('0x59')](_0x2f6029[_0xc3a4('0x44')]['fields']));_0x3b8165[_0xc3a4('0x58')]=_0x3b8165[_0xc3a4('0x58')][_0xc3a4('0x4b')]?_0x3b8165[_0xc3a4('0x58')]:_0x40c21a[_0xc3a4('0x52')];_0x3b8165['order']=qs[_0xc3a4('0xd2')](_0x2f6029[_0xc3a4('0x44')]['sort']);_0x3b8165[_0xc3a4('0x43')]=qs[_0xc3a4('0x56')](_['pick'](_0x2f6029[_0xc3a4('0x44')],_0x40c21a[_0xc3a4('0x56')]));if(_0x2f6029[_0xc3a4('0x44')][_0xc3a4('0x32')]){_0x3b8165[_0xc3a4('0x43')]=_[_0xc3a4('0x5d')](_0x3b8165[_0xc3a4('0x43')],{'$or':_[_0xc3a4('0x33')](_0x3b8165[_0xc3a4('0x58')],function(_0x2aea32){var _0x3a2ca3={};_0x3a2ca3[_0x2aea32]={'$like':'%'+_0x2f6029[_0xc3a4('0x44')][_0xc3a4('0x32')]+'%'};return _0x3a2ca3;})});}_0x3b8165=_[_0xc3a4('0x5d')]({},_0x3b8165,_0x2f6029[_0xc3a4('0x5e')]);return _0x3ac3f3[_0xc3a4('0xde')](_0x3b8165);}})[_0xc3a4('0x17')](function(_0xb0a802){if(_0xb0a802){_0x56d96e=_0xb0a802[_0xc3a4('0x4b')];if(!_0x2f6029[_0xc3a4('0x44')]['hasOwnProperty']('nolimit')){_0x3b8165[_0xc3a4('0x24')]=qs[_0xc3a4('0x24')](_0x2f6029[_0xc3a4('0x44')][_0xc3a4('0x24')]);_0x3b8165['offset']=qs[_0xc3a4('0x27')](_0x2f6029['query']['offset']);}return _0x3ac3f3[_0xc3a4('0xde')](_0x3b8165);}})[_0xc3a4('0x17')](function(_0x137cd2){if(_0x137cd2){return _0x137cd2?{'count':_0x56d96e,'rows':_0x137cd2}:null;}})[_0xc3a4('0x17')](respondWithResult(_0x331255,null))[_0xc3a4('0x21')](handleError(_0x331255,null));};exports[_0xc3a4('0xe0')]=function(_0x4525ec,_0x515e8b){var _0x11cc3f={'raw':!![],'where':{}};var _0x3fa4ee={};var _0x36d6cc={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x4525ec[_0xc3a4('0xa2')]['id']}})[_0xc3a4('0x17')](handleEntityNotFound(_0x515e8b,null))[_0xc3a4('0x17')](function(_0x476d49){if(_0x476d49){_0x3fa4ee[_0xc3a4('0x52')]=_[_0xc3a4('0x54')](db['VoiceRecording'][_0xc3a4('0x3e')]);_0x3fa4ee[_0xc3a4('0x44')]=_['keys'](_0x4525ec[_0xc3a4('0x44')]);_0x3fa4ee[_0xc3a4('0x56')]=_[_0xc3a4('0x57')](_0x3fa4ee[_0xc3a4('0x52')],_0x3fa4ee[_0xc3a4('0x44')]);_0x11cc3f[_0xc3a4('0x58')]=_[_0xc3a4('0x57')](_0x3fa4ee['model'],qs[_0xc3a4('0x59')](_0x4525ec[_0xc3a4('0x44')][_0xc3a4('0x59')]));_0x11cc3f[_0xc3a4('0x58')]=_0x11cc3f[_0xc3a4('0x58')][_0xc3a4('0x4b')]?_0x11cc3f[_0xc3a4('0x58')]:_0x3fa4ee[_0xc3a4('0x52')];if(!_0x4525ec[_0xc3a4('0x44')][_0xc3a4('0xd3')](_0xc3a4('0xdb'))){_0x11cc3f[_0xc3a4('0x24')]=qs[_0xc3a4('0x24')](_0x4525ec['query']['limit']);_0x11cc3f[_0xc3a4('0x27')]=qs[_0xc3a4('0x27')](_0x4525ec[_0xc3a4('0x44')][_0xc3a4('0x27')]);}_0x11cc3f['order']=qs['sort'](_0x4525ec[_0xc3a4('0x44')][_0xc3a4('0xd2')]);_0x11cc3f[_0xc3a4('0x43')]=qs[_0xc3a4('0x56')](_[_0xc3a4('0xdd')](_0x4525ec[_0xc3a4('0x44')],_0x3fa4ee[_0xc3a4('0x56')]));_0x11cc3f['where']['UserId']=_0x476d49['id'];if(_0x4525ec[_0xc3a4('0x44')][_0xc3a4('0x32')]){_0x11cc3f['where']=_[_0xc3a4('0x5d')](_0x11cc3f[_0xc3a4('0x43')],{'$or':_['map'](_0x11cc3f[_0xc3a4('0x58')],function(_0x1da8e1){var _0x8b368b={};_0x8b368b[_0x1da8e1]={'$like':'%'+_0x4525ec[_0xc3a4('0x44')][_0xc3a4('0x32')]+'%'};return _0x8b368b;})});}_0x11cc3f=_[_0xc3a4('0x5d')]({},_0x11cc3f,_0x4525ec[_0xc3a4('0x5e')]);return db[_0xc3a4('0xe1')][_0xc3a4('0x26')]({'where':_0x11cc3f[_0xc3a4('0x43')]})['then'](function(_0x28fad2){_0x36d6cc['count']=_0x28fad2;if(_0x4525ec['query'][_0xc3a4('0x5a')]){_0x11cc3f['include']=[{'all':!![]}];}return db[_0xc3a4('0xe1')]['findAll'](_0x11cc3f);})['then'](function(_0x26a78e){_0x36d6cc[_0xc3a4('0x49')]=_0x26a78e;return _0x36d6cc;});}})[_0xc3a4('0x17')](respondWithFilteredResult(_0x515e8b,_0x11cc3f))[_0xc3a4('0x21')](handleError(_0x515e8b,null));};exports['getScreenRecordings']=function(_0x399047,_0x5647ea){var _0x32d957={'raw':!![],'where':{}};var _0x3fdbd9={};var _0x43e283={'count':0x0,'rows':[]};return db[_0xc3a4('0x3d')][_0xc3a4('0xd0')]({'where':{'id':_0x399047[_0xc3a4('0xa2')]['id']}})[_0xc3a4('0x17')](handleEntityNotFound(_0x5647ea,null))[_0xc3a4('0x17')](function(_0x3e0a48){if(_0x3e0a48){_0x3fdbd9[_0xc3a4('0x52')]=_[_0xc3a4('0x54')](db['ScreenRecording'][_0xc3a4('0x3e')]);_0x3fdbd9[_0xc3a4('0x44')]=_[_0xc3a4('0x54')](_0x399047[_0xc3a4('0x44')]);_0x3fdbd9[_0xc3a4('0x56')]=_[_0xc3a4('0x57')](_0x3fdbd9[_0xc3a4('0x52')],_0x3fdbd9[_0xc3a4('0x44')]);_0x32d957[_0xc3a4('0x58')]=_[_0xc3a4('0x57')](_0x3fdbd9['model'],qs['fields'](_0x399047[_0xc3a4('0x44')]['fields']));_0x32d957[_0xc3a4('0x58')]=_0x32d957[_0xc3a4('0x58')][_0xc3a4('0x4b')]?_0x32d957[_0xc3a4('0x58')]:_0x3fdbd9[_0xc3a4('0x52')];if(!_0x399047['query'][_0xc3a4('0xd3')](_0xc3a4('0xdb'))){_0x32d957[_0xc3a4('0x24')]=qs[_0xc3a4('0x24')](_0x399047['query'][_0xc3a4('0x24')]);_0x32d957[_0xc3a4('0x27')]=qs['offset'](_0x399047[_0xc3a4('0x44')]['offset']);}_0x32d957[_0xc3a4('0xd1')]=qs[_0xc3a4('0xd2')](_0x399047['query']['sort']);_0x32d957[_0xc3a4('0x43')]=qs[_0xc3a4('0x56')](_[_0xc3a4('0xdd')](_0x399047['query'],_0x3fdbd9[_0xc3a4('0x56')]));_0x32d957[_0xc3a4('0x43')][_0xc3a4('0xe2')]=_0x3e0a48['id'];if(_0x399047[_0xc3a4('0x44')]['filter']){_0x32d957[_0xc3a4('0x43')]=_[_0xc3a4('0x5d')](_0x32d957[_0xc3a4('0x43')],{'$or':_[_0xc3a4('0x33')](_0x32d957['attributes'],function(_0x25f8bd){var _0x2a5eed={};_0x2a5eed[_0x25f8bd]={'$like':'%'+_0x399047['query'][_0xc3a4('0x32')]+'%'};return _0x2a5eed;})});}_0x32d957=_[_0xc3a4('0x5d')]({},_0x32d957,_0x399047[_0xc3a4('0x5e')]);return db[_0xc3a4('0xe3')]['count']({'where':_0x32d957[_0xc3a4('0x43')]})[_0xc3a4('0x17')](function(_0x22e163){_0x43e283[_0xc3a4('0x26')]=_0x22e163;if(_0x399047[_0xc3a4('0x44')][_0xc3a4('0x5a')]){_0x32d957[_0xc3a4('0x5b')]=[{'all':!![]}];}return db['ScreenRecording'][_0xc3a4('0x48')](_0x32d957);})[_0xc3a4('0x17')](function(_0xa5a267){_0x43e283[_0xc3a4('0x49')]=_0xa5a267;return _0x43e283;});}})[_0xc3a4('0x17')](respondWithFilteredResult(_0x5647ea,_0x32d957))['catch'](handleError(_0x5647ea,null));};exports[_0xc3a4('0xe4')]=function(_0x1cf221,_0x32def3){var _0x224deb={};var _0x2aa770={};var _0x5f02d5;var _0x5538e2;return db['User'][_0xc3a4('0xd0')]({'where':{'id':_0x1cf221['params']['id']}})[_0xc3a4('0x17')](handleEntityNotFound(_0x32def3,null))[_0xc3a4('0x17')](function(_0x3b580f){if(_0x3b580f){_0x5f02d5=_0x3b580f;_0x2aa770['model']=_[_0xc3a4('0x54')](db['ChatInteraction'][_0xc3a4('0x3e')]);_0x2aa770[_0xc3a4('0x44')]=_[_0xc3a4('0x54')](_0x1cf221[_0xc3a4('0x44')]);_0x2aa770[_0xc3a4('0x56')]=_[_0xc3a4('0x57')](_0x2aa770[_0xc3a4('0x52')],_0x2aa770['query']);_0x224deb['attributes']=_[_0xc3a4('0x57')](_0x2aa770['model'],qs['fields'](_0x1cf221['query'][_0xc3a4('0x59')]));_0x224deb['attributes']=_0x224deb[_0xc3a4('0x58')][_0xc3a4('0x4b')]?_0x224deb[_0xc3a4('0x58')]:_0x2aa770[_0xc3a4('0x52')];_0x224deb['order']=qs['sort'](_0x1cf221['query'][_0xc3a4('0xd2')]);_0x224deb[_0xc3a4('0x43')]=qs[_0xc3a4('0x56')](_[_0xc3a4('0xdd')](_0x1cf221[_0xc3a4('0x44')],_0x2aa770['filters']));if(_0x1cf221[_0xc3a4('0x44')]['filter']){_0x224deb[_0xc3a4('0x43')]=_[_0xc3a4('0x5d')](_0x224deb[_0xc3a4('0x43')],{'$or':_[_0xc3a4('0x33')](_0x224deb['attributes'],function(_0x24e8ba){var _0x3cd38b={};_0x3cd38b[_0x24e8ba]={'$like':'%'+_0x1cf221[_0xc3a4('0x44')]['filter']+'%'};return _0x3cd38b;})});}_0x224deb=_[_0xc3a4('0x5d')]({},_0x224deb,_0x1cf221[_0xc3a4('0x5e')]);return _0x5f02d5['getChatInteractions'](_0x224deb);}})[_0xc3a4('0x17')](function(_0x5b04f3){if(_0x5b04f3){_0x5538e2=_0x5b04f3['length'];if(!_0x1cf221[_0xc3a4('0x44')][_0xc3a4('0xd3')](_0xc3a4('0xdb'))){_0x224deb[_0xc3a4('0x24')]=qs['limit'](_0x1cf221[_0xc3a4('0x44')][_0xc3a4('0x24')]);_0x224deb['offset']=qs[_0xc3a4('0x27')](_0x1cf221[_0xc3a4('0x44')][_0xc3a4('0x27')]);}return _0x5f02d5['getChatInteractions'](_0x224deb);}})['then'](function(_0x4a0f95){if(_0x4a0f95){return _0x4a0f95?{'count':_0x5538e2,'rows':_0x4a0f95}:null;}})[_0xc3a4('0x17')](respondWithResult(_0x32def3,null))[_0xc3a4('0x21')](handleError(_0x32def3,null));};exports['getOpenchannelInteractions']=function(_0x22bd2e,_0x114712){var _0x5f0dff={};var _0xe4e033={};var _0x2f2391;var _0x4c775a;return db['User'][_0xc3a4('0xd0')]({'where':{'id':_0x22bd2e[_0xc3a4('0xa2')]['id']}})[_0xc3a4('0x17')](handleEntityNotFound(_0x114712,null))['then'](function(_0x36b74f){if(_0x36b74f){_0x2f2391=_0x36b74f;_0xe4e033['model']=_[_0xc3a4('0x54')](db[_0xc3a4('0xe5')][_0xc3a4('0x3e')]);_0xe4e033[_0xc3a4('0x44')]=_[_0xc3a4('0x54')](_0x22bd2e[_0xc3a4('0x44')]);_0xe4e033[_0xc3a4('0x56')]=_[_0xc3a4('0x57')](_0xe4e033[_0xc3a4('0x52')],_0xe4e033[_0xc3a4('0x44')]);_0x5f0dff[_0xc3a4('0x58')]=_[_0xc3a4('0x57')](_0xe4e033['model'],qs[_0xc3a4('0x59')](_0x22bd2e['query'][_0xc3a4('0x59')]));_0x5f0dff[_0xc3a4('0x58')]=_0x5f0dff[_0xc3a4('0x58')]['length']?_0x5f0dff[_0xc3a4('0x58')]:_0xe4e033[_0xc3a4('0x52')];_0x5f0dff[_0xc3a4('0xd1')]=qs[_0xc3a4('0xd2')](_0x22bd2e[_0xc3a4('0x44')][_0xc3a4('0xd2')]);_0x5f0dff[_0xc3a4('0x43')]=qs['filters'](_[_0xc3a4('0xdd')](_0x22bd2e['query'],_0xe4e033['filters']));if(_0x22bd2e[_0xc3a4('0x44')][_0xc3a4('0x32')]){_0x5f0dff[_0xc3a4('0x43')]=_['merge'](_0x5f0dff[_0xc3a4('0x43')],{'$or':_[_0xc3a4('0x33')](_0x5f0dff['attributes'],function(_0x5a33a0){var _0x286710={};_0x286710[_0x5a33a0]={'$like':'%'+_0x22bd2e[_0xc3a4('0x44')][_0xc3a4('0x32')]+'%'};return _0x286710;})});}_0x5f0dff=_[_0xc3a4('0x5d')]({},_0x5f0dff,_0x22bd2e['options']);return _0x2f2391['getOpenchannelInteractions'](_0x5f0dff);}})[_0xc3a4('0x17')](function(_0x52c657){if(_0x52c657){_0x4c775a=_0x52c657[_0xc3a4('0x4b')];if(!_0x22bd2e[_0xc3a4('0x44')][_0xc3a4('0xd3')](_0xc3a4('0xdb'))){_0x5f0dff['limit']=qs[_0xc3a4('0x24')](_0x22bd2e[_0xc3a4('0x44')][_0xc3a4('0x24')]);_0x5f0dff[_0xc3a4('0x27')]=qs['offset'](_0x22bd2e[_0xc3a4('0x44')][_0xc3a4('0x27')]);}return _0x2f2391[_0xc3a4('0xe6')](_0x5f0dff);}})[_0xc3a4('0x17')](function(_0x3068a1){if(_0x3068a1){return _0x3068a1?{'count':_0x4c775a,'rows':_0x3068a1}:null;}})[_0xc3a4('0x17')](respondWithResult(_0x114712,null))[_0xc3a4('0x21')](handleError(_0x114712,null));};exports[_0xc3a4('0xe7')]=function(_0x130a8e,_0x3b1a58){var _0x429c0a={'raw':!![],'where':{}};var _0x527483={};var _0x41044c={'count':0x0,'rows':[]};return db[_0xc3a4('0x3d')][_0xc3a4('0xd0')]({'where':{'id':_0x130a8e[_0xc3a4('0xa2')]['id']}})[_0xc3a4('0x17')](handleEntityNotFound(_0x3b1a58,null))[_0xc3a4('0x17')](function(_0xd27c21){if(_0xd27c21){_0x527483['model']=_[_0xc3a4('0x54')](db[_0xc3a4('0xe8')][_0xc3a4('0x3e')]);_0x527483[_0xc3a4('0x44')]=_['keys'](_0x130a8e[_0xc3a4('0x44')]);_0x527483[_0xc3a4('0x56')]=_[_0xc3a4('0x57')](_0x527483[_0xc3a4('0x52')],_0x527483[_0xc3a4('0x44')]);_0x429c0a[_0xc3a4('0x58')]=_[_0xc3a4('0x57')](_0x527483[_0xc3a4('0x52')],qs[_0xc3a4('0x59')](_0x130a8e['query'][_0xc3a4('0x59')]));_0x429c0a[_0xc3a4('0x58')]=_0x429c0a[_0xc3a4('0x58')][_0xc3a4('0x4b')]?_0x429c0a['attributes']:_0x527483[_0xc3a4('0x52')];if(!_0x130a8e[_0xc3a4('0x44')]['hasOwnProperty'](_0xc3a4('0xdb'))){_0x429c0a[_0xc3a4('0x24')]=qs['limit'](_0x130a8e[_0xc3a4('0x44')][_0xc3a4('0x24')]);_0x429c0a[_0xc3a4('0x27')]=qs['offset'](_0x130a8e['query']['offset']);}_0x429c0a[_0xc3a4('0xd1')]=qs[_0xc3a4('0xd2')](_0x130a8e[_0xc3a4('0x44')][_0xc3a4('0xd2')]);_0x429c0a['where']=qs[_0xc3a4('0x56')](_['pick'](_0x130a8e['query'],_0x527483['filters']));_0x429c0a[_0xc3a4('0x43')][_0xc3a4('0xe2')]=_0xd27c21['id'];if(_0x130a8e[_0xc3a4('0x44')][_0xc3a4('0x32')]){_0x429c0a[_0xc3a4('0x43')]=_[_0xc3a4('0x5d')](_0x429c0a['where'],{'$or':_[_0xc3a4('0x33')](_0x429c0a['attributes'],function(_0x546a85){var _0xe8c3b={};_0xe8c3b[_0x546a85]={'$like':'%'+_0x130a8e[_0xc3a4('0x44')][_0xc3a4('0x32')]+'%'};return _0xe8c3b;})});}_0x429c0a=_[_0xc3a4('0x5d')]({},_0x429c0a,_0x130a8e[_0xc3a4('0x5e')]);return db[_0xc3a4('0xe8')][_0xc3a4('0x26')]({'where':_0x429c0a[_0xc3a4('0x43')]})['then'](function(_0x445340){_0x41044c[_0xc3a4('0x26')]=_0x445340;if(_0x130a8e[_0xc3a4('0x44')][_0xc3a4('0x5a')]){_0x429c0a['include']=[{'all':!![]}];}return db[_0xc3a4('0xe8')][_0xc3a4('0x48')](_0x429c0a);})[_0xc3a4('0x17')](function(_0x42a421){_0x41044c['rows']=_0x42a421;return _0x41044c;});}})[_0xc3a4('0x17')](respondWithFilteredResult(_0x3b1a58,_0x429c0a))[_0xc3a4('0x21')](handleError(_0x3b1a58,null));};exports[_0xc3a4('0xe9')]=function(_0x2ef362,_0x15b0f5){var _0x4a7997={};var _0x1f34e3={};var _0x5afd7b;var _0x18442a;return db['User'][_0xc3a4('0xd0')]({'where':{'id':_0x2ef362['params']['id']}})['then'](handleEntityNotFound(_0x15b0f5,null))[_0xc3a4('0x17')](function(_0x8ba263){if(_0x8ba263){_0x5afd7b=_0x8ba263;_0x1f34e3[_0xc3a4('0x52')]=_[_0xc3a4('0x54')](db[_0xc3a4('0xea')][_0xc3a4('0x3e')]);_0x1f34e3[_0xc3a4('0x44')]=_['keys'](_0x2ef362[_0xc3a4('0x44')]);_0x1f34e3['filters']=_[_0xc3a4('0x57')](_0x1f34e3[_0xc3a4('0x52')],_0x1f34e3['query']);_0x4a7997[_0xc3a4('0x58')]=_['intersection'](_0x1f34e3[_0xc3a4('0x52')],qs[_0xc3a4('0x59')](_0x2ef362[_0xc3a4('0x44')][_0xc3a4('0x59')]));_0x4a7997['attributes']=_0x4a7997[_0xc3a4('0x58')][_0xc3a4('0x4b')]?_0x4a7997['attributes']:_0x1f34e3[_0xc3a4('0x52')];_0x4a7997[_0xc3a4('0xd1')]=qs['sort'](_0x2ef362[_0xc3a4('0x44')][_0xc3a4('0xd2')]);_0x4a7997[_0xc3a4('0x43')]=qs[_0xc3a4('0x56')](_[_0xc3a4('0xdd')](_0x2ef362['query'],_0x1f34e3['filters']));if(_0x2ef362[_0xc3a4('0x44')][_0xc3a4('0x32')]){_0x4a7997[_0xc3a4('0x43')]=_[_0xc3a4('0x5d')](_0x4a7997[_0xc3a4('0x43')],{'$or':_[_0xc3a4('0x33')](_0x4a7997[_0xc3a4('0x58')],function(_0x17e1d8){var _0x42cff0={};_0x42cff0[_0x17e1d8]={'$like':'%'+_0x2ef362['query'][_0xc3a4('0x32')]+'%'};return _0x42cff0;})});}_0x4a7997=_[_0xc3a4('0x5d')]({},_0x4a7997,_0x2ef362['options']);return _0x5afd7b[_0xc3a4('0xe9')](_0x4a7997);}})[_0xc3a4('0x17')](function(_0x52c595){if(_0x52c595){_0x18442a=_0x52c595[_0xc3a4('0x4b')];if(!_0x2ef362[_0xc3a4('0x44')][_0xc3a4('0xd3')](_0xc3a4('0xdb'))){_0x4a7997[_0xc3a4('0x24')]=qs[_0xc3a4('0x24')](_0x2ef362[_0xc3a4('0x44')][_0xc3a4('0x24')]);_0x4a7997[_0xc3a4('0x27')]=qs[_0xc3a4('0x27')](_0x2ef362[_0xc3a4('0x44')][_0xc3a4('0x27')]);}return _0x5afd7b[_0xc3a4('0xe9')](_0x4a7997);}})[_0xc3a4('0x17')](function(_0x2e2f98){if(_0x2e2f98){return _0x2e2f98?{'count':_0x18442a,'rows':_0x2e2f98}:null;}})[_0xc3a4('0x17')](respondWithResult(_0x15b0f5,null))[_0xc3a4('0x21')](handleError(_0x15b0f5,null));};exports['getFaxInteractions']=function(_0x1c4c8c,_0x494324){var _0x390e08={};var _0x1e40fd={};var _0x89b8a7;var _0x1bce18;return db['User'][_0xc3a4('0xd0')]({'where':{'id':_0x1c4c8c['params']['id']}})[_0xc3a4('0x17')](handleEntityNotFound(_0x494324,null))[_0xc3a4('0x17')](function(_0x532260){if(_0x532260){_0x89b8a7=_0x532260;_0x1e40fd['model']=_[_0xc3a4('0x54')](db[_0xc3a4('0xeb')]['rawAttributes']);_0x1e40fd[_0xc3a4('0x44')]=_[_0xc3a4('0x54')](_0x1c4c8c[_0xc3a4('0x44')]);_0x1e40fd[_0xc3a4('0x56')]=_[_0xc3a4('0x57')](_0x1e40fd[_0xc3a4('0x52')],_0x1e40fd[_0xc3a4('0x44')]);_0x390e08[_0xc3a4('0x58')]=_[_0xc3a4('0x57')](_0x1e40fd[_0xc3a4('0x52')],qs[_0xc3a4('0x59')](_0x1c4c8c[_0xc3a4('0x44')]['fields']));_0x390e08[_0xc3a4('0x58')]=_0x390e08[_0xc3a4('0x58')][_0xc3a4('0x4b')]?_0x390e08[_0xc3a4('0x58')]:_0x1e40fd[_0xc3a4('0x52')];_0x390e08[_0xc3a4('0xd1')]=qs[_0xc3a4('0xd2')](_0x1c4c8c[_0xc3a4('0x44')][_0xc3a4('0xd2')]);_0x390e08[_0xc3a4('0x43')]=qs[_0xc3a4('0x56')](_[_0xc3a4('0xdd')](_0x1c4c8c[_0xc3a4('0x44')],_0x1e40fd[_0xc3a4('0x56')]));if(_0x1c4c8c[_0xc3a4('0x44')][_0xc3a4('0x32')]){_0x390e08[_0xc3a4('0x43')]=_[_0xc3a4('0x5d')](_0x390e08[_0xc3a4('0x43')],{'$or':_['map'](_0x390e08[_0xc3a4('0x58')],function(_0x46830e){var _0x21a480={};_0x21a480[_0x46830e]={'$like':'%'+_0x1c4c8c[_0xc3a4('0x44')]['filter']+'%'};return _0x21a480;})});}_0x390e08=_[_0xc3a4('0x5d')]({},_0x390e08,_0x1c4c8c[_0xc3a4('0x5e')]);return _0x89b8a7[_0xc3a4('0xec')](_0x390e08);}})[_0xc3a4('0x17')](function(_0x20353c){if(_0x20353c){_0x1bce18=_0x20353c['length'];if(!_0x1c4c8c[_0xc3a4('0x44')][_0xc3a4('0xd3')]('nolimit')){_0x390e08[_0xc3a4('0x24')]=qs[_0xc3a4('0x24')](_0x1c4c8c[_0xc3a4('0x44')][_0xc3a4('0x24')]);_0x390e08[_0xc3a4('0x27')]=qs[_0xc3a4('0x27')](_0x1c4c8c[_0xc3a4('0x44')][_0xc3a4('0x27')]);}return _0x89b8a7[_0xc3a4('0xec')](_0x390e08);}})[_0xc3a4('0x17')](function(_0x178a7e){if(_0x178a7e){return _0x178a7e?{'count':_0x1bce18,'rows':_0x178a7e}:null;}})[_0xc3a4('0x17')](respondWithResult(_0x494324,null))[_0xc3a4('0x21')](handleError(_0x494324,null));};exports['getWhatsappInteractions']=function(_0x2e84f6,_0x46069a){var _0xd1034={};var _0x28de27={};var _0x230963;var _0x739d81;return db[_0xc3a4('0x3d')][_0xc3a4('0xd0')]({'where':{'id':_0x2e84f6[_0xc3a4('0xa2')]['id']}})['then'](handleEntityNotFound(_0x46069a,null))[_0xc3a4('0x17')](function(_0x3738f9){if(_0x3738f9){_0x230963=_0x3738f9;_0x28de27[_0xc3a4('0x52')]=_[_0xc3a4('0x54')](db[_0xc3a4('0xed')][_0xc3a4('0x3e')]);_0x28de27[_0xc3a4('0x44')]=_['keys'](_0x2e84f6['query']);_0x28de27[_0xc3a4('0x56')]=_[_0xc3a4('0x57')](_0x28de27['model'],_0x28de27['query']);_0xd1034[_0xc3a4('0x58')]=_['intersection'](_0x28de27['model'],qs[_0xc3a4('0x59')](_0x2e84f6['query'][_0xc3a4('0x59')]));_0xd1034[_0xc3a4('0x58')]=_0xd1034[_0xc3a4('0x58')][_0xc3a4('0x4b')]?_0xd1034[_0xc3a4('0x58')]:_0x28de27[_0xc3a4('0x52')];_0xd1034['order']=qs[_0xc3a4('0xd2')](_0x2e84f6[_0xc3a4('0x44')][_0xc3a4('0xd2')]);_0xd1034[_0xc3a4('0x43')]=qs['filters'](_[_0xc3a4('0xdd')](_0x2e84f6[_0xc3a4('0x44')],_0x28de27['filters']));if(_0x2e84f6[_0xc3a4('0x44')][_0xc3a4('0x32')]){_0xd1034['where']=_['merge'](_0xd1034[_0xc3a4('0x43')],{'$or':_['map'](_0xd1034[_0xc3a4('0x58')],function(_0x477825){var _0x51662e={};_0x51662e[_0x477825]={'$like':'%'+_0x2e84f6['query']['filter']+'%'};return _0x51662e;})});}_0xd1034=_['merge']({},_0xd1034,_0x2e84f6[_0xc3a4('0x5e')]);return _0x230963['getWhatsappInteractions'](_0xd1034);}})[_0xc3a4('0x17')](function(_0x5e0de6){if(_0x5e0de6){_0x739d81=_0x5e0de6['length'];if(!_0x2e84f6['query']['hasOwnProperty'](_0xc3a4('0xdb'))){_0xd1034[_0xc3a4('0x24')]=qs[_0xc3a4('0x24')](_0x2e84f6[_0xc3a4('0x44')][_0xc3a4('0x24')]);_0xd1034[_0xc3a4('0x27')]=qs['offset'](_0x2e84f6[_0xc3a4('0x44')][_0xc3a4('0x27')]);}return _0x230963[_0xc3a4('0xee')](_0xd1034);}})[_0xc3a4('0x17')](function(_0x3de2ed){if(_0x3de2ed){return _0x3de2ed?{'count':_0x739d81,'rows':_0x3de2ed}:null;}})['then'](respondWithResult(_0x46069a,null))[_0xc3a4('0x21')](handleError(_0x46069a,null));};exports[_0xc3a4('0xef')]=function(_0x35019f,_0x2aeeaa,_0x296ebc){var _0x35698b;var _0x547f0b;var _0xed61ef;var _0x390178=!_[_0xc3a4('0x6d')](_0x35019f[_0xc3a4('0xa2')]['id'])?_0x35019f[_0xc3a4('0xa2')]['id']:!_[_0xc3a4('0x6d')](_0x35019f[_0xc3a4('0x85')]['id'])?_0x35019f[_0xc3a4('0x85')]['id']:null;return db['User'][_0xc3a4('0x5f')]({'where':{'id':_0x390178,'role':{'$or':[_0xc3a4('0x2d'),_0xc3a4('0x85'),'agent']}},'attributes':['id',_0xc3a4('0x37'),'phone',_0xc3a4('0xf0'),'role','internal',_0xc3a4('0xa7')]})[_0xc3a4('0x17')](function(_0x48f634){if(_0x48f634){if(_0x48f634[_0xc3a4('0x36')]===_0xc3a4('0x78')){_0x35698b=_0x48f634;if(_0x35019f[_0xc3a4('0x63')][_0xc3a4('0xa9')]){_0xed61ef=util[_0xc3a4('0xf1')]('LOCAL/%s@from-sip/n',_0x35698b[_0x35019f['body'][_0xc3a4('0xa9')]]);}else if(_0x35019f['body']['intrf']){_0xed61ef=util[_0xc3a4('0xf1')]('SIP/%s',_0x35019f[_0xc3a4('0x63')][_0xc3a4('0xf2')]);}else{_0xed61ef=util[_0xc3a4('0xf1')](_0xc3a4('0xb3'),_0x35698b[_0xc3a4('0x37')]);}socket['to'](util[_0xc3a4('0xf1')]('user:%s',_0x35698b[_0xc3a4('0x37')]))['emit'](_0xc3a4('0xf3'),{'user':{'id':_0x35698b['id'],'name':_0x35698b['name']},'ip':_0x35019f[_0xc3a4('0xf4')][_0xc3a4('0xf5')]||_0x35019f[_0xc3a4('0xf6')][_0xc3a4('0xf7')]||_0x35019f[_0xc3a4('0xf8')][_0xc3a4('0xf7')]||_0x35019f['connection'][_0xc3a4('0xf8')]['remoteAddress']});return db[_0xc3a4('0xb9')][_0xc3a4('0x2b')]({'where':{'membername':_0x35698b['name']},'individualHooks':!![]});}}else{throw new db[(_0xc3a4('0x97'))]['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})['then'](function(){if(_0x35698b){return _0x35698b['getVoiceQueues']({'raw':!![]});}})[_0xc3a4('0x17')](function(_0x18ccdf){if(_0x35698b){var _0x79cf0d=[];if(_0x18ccdf){_0x547f0b=_0x18ccdf;if(_0x547f0b[_0xc3a4('0x4b')]){for(var _0x46ddce=0x0;_0x46ddce<_0x547f0b[_0xc3a4('0x4b')];_0x46ddce++){_0x79cf0d[_0xc3a4('0x47')]({'membername':_0x35698b['name'],'UserId':_0x35698b['id'],'queue_name':_0x547f0b[_0x46ddce]['name'],'VoiceQueueId':_0x547f0b[_0x46ddce]['id'],'interface':_0xed61ef,'paused':_0x35698b[_0xc3a4('0xa7')]||![],'penalty':_0x547f0b[_0x46ddce][_0xc3a4('0xf9')]||0x0});}return BPromise[_0xc3a4('0x92')](_0x79cf0d,function(_0x17f85c){return db[_0xc3a4('0xb9')]['upsert'](_0x17f85c);});}}}})[_0xc3a4('0x17')](function(){if(_0x35698b){return db[_0xc3a4('0xfa')][_0xc3a4('0x48')]({'where':{'membername':_0x35698b['name'],'exitAt':null}});}})[_0xc3a4('0x17')](function(_0x4090d3){if(_0x35698b){var _0x31cf64=[];_0x4090d3[_0xc3a4('0xfb')](function(_0x3682bf){_0x31cf64[_0xc3a4('0x47')](_0x3682bf[_0xc3a4('0x62')]({'exitAt':moment()['format'](_0xc3a4('0xfc'))}));});return BPromise[_0xc3a4('0x50')](_0x31cf64);}})[_0xc3a4('0x17')](function(){if(_0x35698b){var _0x483213=[];var _0x5123a8=[];var _0x3ec47c=utils[_0xc3a4('0xfd')]();var _0x9acc3a={'membername':_0x35698b['name'],'interface':_0xed61ef,'enterAt':moment()[_0xc3a4('0xf1')](_0xc3a4('0xfc')),'role':_0x35698b[_0xc3a4('0x36')],'internal':_0x35698b[_0xc3a4('0x68')]};_0x3ec47c['forEach'](function(_0x17a6f7){_0x483213[_0xc3a4('0x47')](_[_0xc3a4('0x5d')]({'channel':_0x17a6f7,'type':_0xc3a4('0xfe'),'data1':_0x35019f[_0xc3a4('0x63')][_0xc3a4('0xff')],'data2':_0xed61ef},_0x9acc3a));if(_0x35698b[_0xc3a4('0xa7')]){_0x5123a8[_0xc3a4('0x47')](_[_0xc3a4('0x5d')]({'channel':_0x17a6f7,'type':_0xc3a4('0x100'),'data1':_0xc3a4('0x101')},_0x9acc3a));}});return db[_0xc3a4('0xfa')]['bulkCreate'](_0x483213[_0xc3a4('0xce')](_0x5123a8),{'individualHooks':!![]});}})[_0xc3a4('0x17')](function(){if(_0x35698b){return _0x35698b[_0xc3a4('0x62')]({'online':!![],'lastLoginAt':moment()[_0xc3a4('0xf1')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x35698b[_0xc3a4('0xa7')]||![],'mailPause':_0x35698b[_0xc3a4('0xa7')]||![],'chatPause':_0x35698b[_0xc3a4('0xa7')]||![],'faxPause':_0x35698b[_0xc3a4('0xa7')]||![],'smsPause':_0x35698b[_0xc3a4('0xa7')]||![],'openchannelPause':_0x35698b[_0xc3a4('0xa7')]||![],'whatsappPause':_0x35698b['loginInPause']||![],'pauseType':_0x35698b['loginInPause']?'LOGININPAUSE':null,'interface':_0xed61ef,'lastPauseAt':moment()[_0xc3a4('0xf1')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x1dc36d){if(_0x35019f[_0xc3a4('0x102')]){return _0x296ebc();}else{return BPromise[_0xc3a4('0x103')](_0x1dc36d)[_0xc3a4('0x17')](respondWithResult(_0x2aeeaa,null));}})[_0xc3a4('0x21')](handleError(_0x2aeeaa,null));};exports[_0xc3a4('0x104')]=function(_0x136cdb,_0x24ebb8){var _0x305eb3;return db[_0xc3a4('0x3d')][_0xc3a4('0x5f')]({'where':{'id':_0x136cdb['params']['id'],'role':_0xc3a4('0x78')},'attributes':['id',_0xc3a4('0x37'),_0xc3a4('0x36')]})['then'](handleEntityNotFound(_0x24ebb8,null))[_0xc3a4('0x17')](function(_0x15693d){if(_0x15693d){_0x305eb3=_0x15693d;return db[_0xc3a4('0xb9')][_0xc3a4('0x2b')]({'where':{'membername':_0x305eb3[_0xc3a4('0x37')]},'individualHooks':!![]});}})[_0xc3a4('0x17')](function(){return db[_0xc3a4('0xfa')][_0xc3a4('0x48')]({'where':{'membername':_0x305eb3[_0xc3a4('0x37')],'exitAt':null}});})[_0xc3a4('0x17')](function(_0x438416){var _0x403580=[];_0x438416[_0xc3a4('0xfb')](function(_0x1b42a5){_0x403580[_0xc3a4('0x47')](_0x1b42a5[_0xc3a4('0x62')]({'exitAt':moment()[_0xc3a4('0xf1')](_0xc3a4('0xfc'))}));});return BPromise[_0xc3a4('0x50')](_0x403580);})[_0xc3a4('0x17')](function(){return _0x305eb3[_0xc3a4('0x62')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xc3a4('0x17')](respondWithResult(_0x24ebb8,null))[_0xc3a4('0x21')](handleError(_0x24ebb8,null));};exports['pause']=function(_0x1478e1,_0x5f0f05){var _0x144015;return db['UserVoiceQueueRt'][_0xc3a4('0x62')]({'paused':0x1},{'where':{'UserId':_0x1478e1['params']['id']},'individualHooks':!![]})['then'](function(){return db['User']['find']({'where':{'id':_0x1478e1[_0xc3a4('0xa2')]['id'],'role':_0xc3a4('0x78')},'attributes':['id',_0xc3a4('0x37'),_0xc3a4('0x36'),_0xc3a4('0x68'),_0xc3a4('0xa9')]});})[_0xc3a4('0x17')](handleEntityNotFound(_0x5f0f05,null))[_0xc3a4('0x17')](function(_0x9d6e17){if(_0x9d6e17){_0x144015=_0x9d6e17;return respondWithRpcPromise('QueuePause','pause',{'id':_0x144015['id'],'name':_0x144015[_0xc3a4('0x37')],'pause':!![]});}})[_0xc3a4('0x17')](function(){if(_0x144015){return db['MemberReport'][_0xc3a4('0x48')]({'where':{'membername':_0x144015[_0xc3a4('0x37')],'type':_0xc3a4('0x100'),'exitAt':null}});}})['then'](function(_0x330845){if(_0x330845[_0xc3a4('0x4b')]){var _0x238366=moment()[_0xc3a4('0xf1')](_0xc3a4('0xfc'));for(var _0x24d2fc=0x0,_0x59d678=_0x330845[_0xc3a4('0x4b')];_0x24d2fc<_0x59d678;_0x24d2fc++){_0x330845[_0x24d2fc][_0xc3a4('0x105')]({'exitAt':_0x238366});}}})[_0xc3a4('0x17')](function(){var _0x477a55=[];var _0x23e918=utils['getChannels']();_0x23e918[_0xc3a4('0xfb')](function(_0xf86786){_0x477a55[_0xc3a4('0x47')]({'channel':_0xf86786,'membername':_0x144015['name'],'interface':_[_0xc3a4('0x6d')](_0x144015[_0xc3a4('0xa9')])?util[_0xc3a4('0xf1')]('SIP/%s',_0x144015[_0xc3a4('0x37')]):_0x144015['interface'],'type':'PAUSE','enterAt':moment()[_0xc3a4('0xf1')](_0xc3a4('0xfc')),'data1':_0x1478e1['body']['type']||_0xc3a4('0x106'),'role':_0x144015[_0xc3a4('0x36')],'internal':_0x144015[_0xc3a4('0x68')]});});return db['MemberReport']['bulkCreate'](_0x477a55,{'individualHooks':!![]});})[_0xc3a4('0x17')](function(){return _0x144015['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1478e1[_0xc3a4('0x63')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0xc3a4('0xfc'))});})[_0xc3a4('0x17')](respondWithResult(_0x5f0f05,null))['catch'](handleError(_0x5f0f05,null));};exports[_0xc3a4('0x107')]=function(_0x578c4f,_0x500d53){var _0x2b3537;return db['User'][_0xc3a4('0x5f')]({'where':{'id':_0x578c4f[_0xc3a4('0xa2')]['id']},'attributes':['id',_0xc3a4('0x37'),_0xc3a4('0x36'),_0xc3a4('0xa8'),'mailPause','chatPause',_0xc3a4('0x108'),'openchannelPause','smsPause','whatsapppause',_0xc3a4('0x109'),_0xc3a4('0x10a')]})[_0xc3a4('0x17')](handleEntityNotFound(_0x500d53,null))[_0xc3a4('0x17')](function(_0x47b2ea){if(_0x47b2ea){_0x2b3537=_0x47b2ea;if(_0x578c4f[_0xc3a4('0x63')]['channel']&&!utils[_0xc3a4('0xaa')](_0x578c4f[_0xc3a4('0x63')][_0xc3a4('0xa5')])){throw new db[(_0xc3a4('0x97'))][(_0xc3a4('0x98'))](_0xc3a4('0xab'));}switch(_0x578c4f[_0xc3a4('0x63')][_0xc3a4('0xa5')]){case'voice':return respondWithRpcPromise('QueuePause',_0xc3a4('0x107'),{'id':_0x2b3537['id'],'name':_0x2b3537[_0xc3a4('0x37')],'pause':![]})[_0xc3a4('0x17')](function(){return db[_0xc3a4('0xb9')][_0xc3a4('0x62')]({'paused':0x0},{'where':{'UserId':_0x2b3537['id']},'individualHooks':!![]});})[_0xc3a4('0x17')](function(){return db[_0xc3a4('0xfa')][_0xc3a4('0x5f')]({'where':{'channel':_0x578c4f[_0xc3a4('0x63')]['channel'],'membername':_0x2b3537[_0xc3a4('0x37')],'type':_0xc3a4('0x100'),'exitAt':null}});})['then'](function(_0x5ca247){if(_0x5ca247){return _0x5ca247[_0xc3a4('0x62')]({'exitAt':moment()[_0xc3a4('0xf1')](_0xc3a4('0xfc')),'data2':_0xc3a4('0x10b')},{'individualHooks':!![]});}return null;})[_0xc3a4('0x17')](function(){return _0x2b3537['update']({'voicePause':![]});});case _0xc3a4('0x10c'):case'chat':case _0xc3a4('0x61'):case'sms':case'whatsapp':case'openchannel':return db[_0xc3a4('0xfa')][_0xc3a4('0x5f')]({'where':{'channel':_0x578c4f['body'][_0xc3a4('0xa5')],'membername':_0x2b3537['name'],'type':_0xc3a4('0x100'),'exitAt':null}})[_0xc3a4('0x17')](function(_0x4f8f35){if(_0x4f8f35){return _0x4f8f35[_0xc3a4('0x62')]({'exitAt':moment()['format'](_0xc3a4('0xfc')),'data2':_0xc3a4('0x10b')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x3cd300={};_[_0xc3a4('0x28')](_0x3cd300,util[_0xc3a4('0xf1')](_0xc3a4('0x10d'),_0x578c4f['body'][_0xc3a4('0xa5')],_0xc3a4('0x10e')),![]);return _0x2b3537[_0xc3a4('0x62')](_0x3cd300);});default:return respondWithRpcPromise(_0xc3a4('0x10f'),'unpause',{'id':_0x2b3537['id'],'name':_0x2b3537['name'],'pause':![]})['then'](function(){return db[_0xc3a4('0xb9')][_0xc3a4('0x62')]({'paused':0x0},{'where':{'UserId':_0x2b3537['id']}});})['then'](function(){return db[_0xc3a4('0xfa')][_0xc3a4('0x48')]({'where':{'membername':_0x2b3537['name'],'type':_0xc3a4('0x100'),'exitAt':null}});})['then'](function(_0x530fa6){var _0x27f3c6=[];_0x530fa6[_0xc3a4('0xfb')](function(_0x1b68a1){_0x27f3c6[_0xc3a4('0x47')](_0x1b68a1[_0xc3a4('0x62')]({'exitAt':moment()[_0xc3a4('0xf1')](_0xc3a4('0xfc')),'data2':'manual'}));});return BPromise[_0xc3a4('0x50')](_0x27f3c6);})[_0xc3a4('0x17')](function(){return _0x2b3537[_0xc3a4('0x62')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x500d53,null))[_0xc3a4('0x21')](handleError(_0x500d53,null));};exports[_0xc3a4('0x110')]=function(_0x20e484,_0x33e438){var _0x2f4288={};var _0x1de33d={};var _0x524144;var _0x1d1788;return db[_0xc3a4('0x3d')][_0xc3a4('0xd0')]({'where':{'id':_0x20e484['params']['id']}})['then'](handleEntityNotFound(_0x33e438,null))[_0xc3a4('0x17')](function(_0x23ce2c){if(_0x23ce2c){_0x524144=_0x23ce2c;_0x1de33d[_0xc3a4('0x52')]=_[_0xc3a4('0x54')](db[_0xc3a4('0x111')][_0xc3a4('0x3e')]);_0x1de33d[_0xc3a4('0x44')]=_[_0xc3a4('0x54')](_0x20e484[_0xc3a4('0x44')]);_0x1de33d['filters']=_['intersection'](_0x1de33d[_0xc3a4('0x52')],_0x1de33d['query']);_0x2f4288[_0xc3a4('0x58')]=_[_0xc3a4('0x57')](_0x1de33d[_0xc3a4('0x52')],qs[_0xc3a4('0x59')](_0x20e484[_0xc3a4('0x44')]['fields']));_0x2f4288[_0xc3a4('0x58')]=_0x2f4288[_0xc3a4('0x58')]['length']?_0x2f4288[_0xc3a4('0x58')]:_0x1de33d[_0xc3a4('0x52')];_0x2f4288[_0xc3a4('0xd1')]=qs[_0xc3a4('0xd2')](_0x20e484[_0xc3a4('0x44')]['sort']);_0x2f4288['where']=qs['filters'](_[_0xc3a4('0xdd')](_0x20e484[_0xc3a4('0x44')],_0x1de33d[_0xc3a4('0x56')]));if(_0x20e484[_0xc3a4('0x44')][_0xc3a4('0x32')]){_0x2f4288[_0xc3a4('0x43')]=_[_0xc3a4('0x5d')](_0x2f4288['where'],{'$or':_[_0xc3a4('0x33')](_0x2f4288[_0xc3a4('0x58')],function(_0x5cc015){var _0x25ddb9={};_0x25ddb9[_0x5cc015]={'$like':'%'+_0x20e484[_0xc3a4('0x44')][_0xc3a4('0x32')]+'%'};return _0x25ddb9;})});}_0x2f4288=_['merge']({},_0x2f4288,_0x20e484[_0xc3a4('0x5e')]);return _0x524144['getTeams'](_0x2f4288);}})[_0xc3a4('0x17')](function(_0x4e195c){if(_0x4e195c){_0x1d1788=_0x4e195c['length'];if(!_0x20e484['query'][_0xc3a4('0xd3')]('nolimit')){_0x2f4288[_0xc3a4('0x24')]=qs[_0xc3a4('0x24')](_0x20e484[_0xc3a4('0x44')][_0xc3a4('0x24')]);_0x2f4288[_0xc3a4('0x27')]=qs[_0xc3a4('0x27')](_0x20e484[_0xc3a4('0x44')][_0xc3a4('0x27')]);}return _0x524144[_0xc3a4('0x110')](_0x2f4288);}})[_0xc3a4('0x17')](function(_0x513681){if(_0x513681){return _0x513681?{'count':_0x1d1788,'rows':_0x513681}:null;}})[_0xc3a4('0x17')](respondWithResult(_0x33e438,null))[_0xc3a4('0x21')](handleError(_0x33e438,null));};exports[_0xc3a4('0x112')]=function(_0x6714d2,_0x9fb75){var _0x44265a=_0x6714d2[_0xc3a4('0xa2')]['id'];var _0x40d024=_0x6714d2[_0xc3a4('0x63')]?_0x6714d2[_0xc3a4('0x63')][_0xc3a4('0x66')]:null;var _0x16cf32=[];return Promise[_0xc3a4('0x103')]()[_0xc3a4('0x17')](function(){if(!_0x40d024)throw new APIBadRequestError(_0xc3a4('0x113'));})[_0xc3a4('0x17')](function(){return db[_0xc3a4('0x3d')][_0xc3a4('0xd0')]({'where':{'id':_0x44265a}});})[_0xc3a4('0x17')](function(_0x2c2433){if(!_0x2c2433)throw new APINotFoundError(util[_0xc3a4('0xf1')](_0xc3a4('0x114'),_0x6714d2[_0xc3a4('0xa2')]['id']));return db['sequelize'][_0xc3a4('0x115')](function(_0x42712e){return _0x2c2433[_0xc3a4('0x112')](_0x40d024,{'transaction':_0x42712e})[_0xc3a4('0x17')](function(){return db[_0xc3a4('0x111')]['findAll']({'where':{'id':{'$in':_0x40d024}}});})['then'](function(_0x5c451e){var _0x3a2a09=_[_0xc3a4('0x33')](_0x5c451e,function(_0x522b81){return _0x522b81[_0xc3a4('0x116')]();});return Promise[_0xc3a4('0x50')](_0x3a2a09);})['then'](function(_0x59e1d2){_0x16cf32=_[_0xc3a4('0x117')](_0x59e1d2);var _0x808ec9=_['map'](_0x16cf32,function(_0xaa5ce4){return _0xaa5ce4['addAgent'](_0x2c2433['id'],{'transaction':_0x42712e});});return Promise['all'](_0x808ec9);})[_0xc3a4('0x17')](function(){if(!_0x2c2433[_0xc3a4('0xa6')])return;var _0x440bcb=_['filter'](_0x16cf32,function(_0x20d874){return _0x20d874[_0xc3a4('0x118')](_0xc3a4('0xa5'))===_0xc3a4('0x119');});var _0x48ea72=_[_0xc3a4('0x33')](_0x440bcb,function(_0x38a83c){return db['UserVoiceQueueRt'][_0xc3a4('0xb4')]({'membername':_0x2c2433[_0xc3a4('0x37')],'UserId':_0x2c2433['id'],'queue_name':_0x38a83c[_0xc3a4('0x37')],'VoiceQueueId':_0x38a83c['id'],'interface':_[_0xc3a4('0x6d')](_0x2c2433[_0xc3a4('0xa9')])?util[_0xc3a4('0xf1')](_0xc3a4('0xb3'),_0x2c2433['name']):_0x2c2433['interface'],'paused':_0x2c2433[_0xc3a4('0xa8')]||![],'penalty':_0x2c2433[_0xc3a4('0xae')]},{'transaction':_0x42712e});});return Promise[_0xc3a4('0x50')](_0x48ea72);})['then'](function(){return db[_0xc3a4('0x11a')][_0xc3a4('0x48')]({'where':{'teamId':{'$in':_0x40d024}}});})[_0xc3a4('0x17')](function(_0x181ab9){var _0x4f914e=_['map'](_0x181ab9,function(_0x2f0525){return db[_0xc3a4('0x11b')]['create']({'UserId':_0x2c2433['id'],'VoicePrefixId':_0x2f0525['VoicePrefixId']},{'transaction':_0x42712e});});return Promise['all'](_0x4f914e);});});})[_0xc3a4('0x17')](function(){for(var _0x118ff2=0x0;_0x118ff2<_0x16cf32['length'];_0x118ff2++){var _0x32d47a=_0x16cf32[_0x118ff2][_0xc3a4('0x118')](_0xc3a4('0xa5'));var _0x5baa4f=_0x32d47a+_0xc3a4('0x11c');socket['emit'](_0xc3a4('0x85')+_0x32d47a+_0xc3a4('0xb1'),{'UserId':_0x44265a,['queueField']:_0x16cf32[_0x118ff2]['id']});}})[_0xc3a4('0x17')](respondWithStatusCode(_0x9fb75,null))['catch'](APIHandleError(_0x9fb75));};exports[_0xc3a4('0x11d')]=function(_0x319859,_0x13329c){var _0x65a712=_0x319859[_0xc3a4('0xa2')]['id'];var _0x536948=null;if(_0x319859[_0xc3a4('0x44')][_0xc3a4('0x66')]){_0x536948=_['isArray'](_0x319859['query'][_0xc3a4('0x66')])?_0x319859[_0xc3a4('0x44')][_0xc3a4('0x66')]:[_0x319859[_0xc3a4('0x44')][_0xc3a4('0x66')]];}var _0x302584=[];return Promise[_0xc3a4('0x103')]()[_0xc3a4('0x17')](function(){if(!_0x536948)throw new APIBadRequestError(_0xc3a4('0x11e'));})[_0xc3a4('0x17')](function(){return db[_0xc3a4('0x3d')]['findOne']({'where':{'id':_0x65a712}});})['then'](function(_0x35669d){if(!_0x35669d)throw new APINotFoundError(util[_0xc3a4('0xf1')]('User\x20with\x20id\x20%s\x20not\x20found',_0x319859[_0xc3a4('0xa2')]['id']));return db[_0xc3a4('0x70')][_0xc3a4('0x115')](function(_0x36a19d){return _0x35669d[_0xc3a4('0x11d')](_0x536948,{'transaction':_0x36a19d})[_0xc3a4('0x17')](function(){return db[_0xc3a4('0x111')][_0xc3a4('0x48')]({'where':{'id':{'$in':_0x536948}}});})[_0xc3a4('0x17')](function(_0x20caf8){var _0x5b3811=_[_0xc3a4('0x33')](_0x20caf8,function(_0x596d21){return _0x596d21['getAssociatedQueues']();});return Promise[_0xc3a4('0x50')](_0x5b3811);})[_0xc3a4('0x17')](function(_0x42911b){_0x302584=_['flattenDeep'](_0x42911b);var _0x33a2d8=_['map'](_0x302584,function(_0x5d9de0){return _0x5d9de0[_0xc3a4('0x11f')](_0x35669d['id'],{'transaction':_0x36a19d});});return Promise[_0xc3a4('0x50')](_0x33a2d8);})[_0xc3a4('0x17')](function(){if(!_0x35669d[_0xc3a4('0xa6')])return;var _0x5276d4=_[_0xc3a4('0x32')](_0x302584,function(_0x3c3c6c){return _0x3c3c6c[_0xc3a4('0x118')](_0xc3a4('0xa5'))==='Voice';});var _0x3c7b56=_[_0xc3a4('0x33')](_0x5276d4,function(_0x41a676){return db['UserVoiceQueueRt'][_0xc3a4('0x2b')]({'where':{'VoiceQueueId':_0x41a676['id'],'UserId':_0x35669d['id']},'transaction':_0x36a19d});});return Promise[_0xc3a4('0x50')](_0x3c7b56);})[_0xc3a4('0x17')](function(){return db[_0xc3a4('0x11a')][_0xc3a4('0x48')]({'where':{'teamId':{'$in':_0x536948}}});})['then'](function(_0x2469a2){var _0xcf7f04=_['map'](_0x2469a2,function(_0xce26e5){return db[_0xc3a4('0x11b')][_0xc3a4('0x2b')]({'where':{'UserId':_0x35669d['id'],'VoicePrefixId':_0xce26e5[_0xc3a4('0x120')]}},{'transaction':_0x36a19d});});return Promise['all'](_0xcf7f04);});});})['then'](function(){for(var _0x430abb=0x0;_0x430abb<_0x302584[_0xc3a4('0x4b')];_0x430abb++){var _0x348941=_0x302584[_0x430abb]['getDataValue'](_0xc3a4('0xa5'));var _0x43946f=_0x348941+_0xc3a4('0x11c');socket[_0xc3a4('0xb0')](_0xc3a4('0x85')+_0x348941+_0xc3a4('0xb8'),{'UserId':_0x65a712,['queueField']:_0x302584[_0x430abb]['id']});}})[_0xc3a4('0x17')](respondWithStatusCode(_0x13329c,null))[_0xc3a4('0x21')](APIHandleError(_0x13329c));};exports[_0xc3a4('0x121')]=function(_0x6c6944,_0x47051a){var _0x400bd7={};var _0x87096d={};var _0x341403;var _0xff2c77;return db[_0xc3a4('0x3d')][_0xc3a4('0xd0')]({'where':{'id':_0x6c6944['params']['id']}})['then'](handleEntityNotFound(_0x47051a,null))[_0xc3a4('0x17')](function(_0x367bf1){if(_0x367bf1){_0x341403=_0x367bf1;_0x87096d[_0xc3a4('0x52')]=_[_0xc3a4('0x54')](db[_0xc3a4('0xd4')][_0xc3a4('0x3e')]);_0x87096d[_0xc3a4('0x44')]=_[_0xc3a4('0x54')](_0x6c6944[_0xc3a4('0x44')]);_0x87096d[_0xc3a4('0x56')]=_[_0xc3a4('0x57')](_0x87096d[_0xc3a4('0x52')],_0x87096d['query']);_0x400bd7[_0xc3a4('0x58')]=_[_0xc3a4('0x57')](_0x87096d[_0xc3a4('0x52')],qs[_0xc3a4('0x59')](_0x6c6944[_0xc3a4('0x44')]['fields']));_0x400bd7[_0xc3a4('0x58')]=_0x400bd7[_0xc3a4('0x58')][_0xc3a4('0x4b')]?_0x400bd7['attributes']:_0x87096d[_0xc3a4('0x52')];_0x400bd7[_0xc3a4('0xd1')]=qs['sort'](_0x6c6944['query'][_0xc3a4('0xd2')]);_0x400bd7[_0xc3a4('0x43')]=qs[_0xc3a4('0x56')](_[_0xc3a4('0xdd')](_0x6c6944['query'],_0x87096d[_0xc3a4('0x56')]));if(_0x6c6944['query'][_0xc3a4('0x32')]){_0x400bd7[_0xc3a4('0x43')]=_[_0xc3a4('0x5d')](_0x400bd7[_0xc3a4('0x43')],{'$or':_['map'](_0x400bd7['attributes'],function(_0x2156df){var _0x1a2d58={};_0x1a2d58[_0x2156df]={'$like':'%'+_0x6c6944[_0xc3a4('0x44')][_0xc3a4('0x32')]+'%'};return _0x1a2d58;})});}_0x400bd7=_['merge']({},_0x400bd7,_0x6c6944[_0xc3a4('0x5e')]);return _0x341403['getLists'](_0x400bd7);}})[_0xc3a4('0x17')](function(_0x448303){if(_0x448303){_0xff2c77=_0x448303[_0xc3a4('0x4b')];if(!_0x6c6944[_0xc3a4('0x44')][_0xc3a4('0xd3')](_0xc3a4('0xdb'))){_0x400bd7[_0xc3a4('0x24')]=qs[_0xc3a4('0x24')](_0x6c6944[_0xc3a4('0x44')][_0xc3a4('0x24')]);_0x400bd7[_0xc3a4('0x27')]=qs['offset'](_0x6c6944[_0xc3a4('0x44')]['offset']);}return _0x341403[_0xc3a4('0x121')](_0x400bd7);}})[_0xc3a4('0x17')](function(_0x40dc99){if(_0x40dc99){return _0x40dc99?{'count':_0xff2c77,'rows':_0x40dc99}:null;}})['then'](respondWithResult(_0x47051a,null))['catch'](handleError(_0x47051a,null));};exports[_0xc3a4('0x122')]=function(_0x3ef190,_0x1739e6){var _0x495498={};var _0x4ea850={};var _0x44ccaf;return db['User'][_0xc3a4('0xd0')]({'where':{'id':_0x3ef190[_0xc3a4('0xa2')]['id']}})[_0xc3a4('0x17')](handleEntityNotFound(_0x1739e6,null))[_0xc3a4('0x17')](function(_0xfa034a){if(_0xfa034a){_0x44ccaf=_0xfa034a;_0x4ea850[_0xc3a4('0x52')]=_[_0xc3a4('0x54')](db[_0xc3a4('0x3d')][_0xc3a4('0x3e')]);_0x4ea850[_0xc3a4('0x44')]=_[_0xc3a4('0x54')](_0x3ef190[_0xc3a4('0x44')]);_0x4ea850['filters']=_[_0xc3a4('0x57')](_0x4ea850[_0xc3a4('0x52')],_0x4ea850[_0xc3a4('0x44')]);_0x495498[_0xc3a4('0x58')]=_[_0xc3a4('0x57')](_0x4ea850[_0xc3a4('0x52')],qs[_0xc3a4('0x59')](_0x3ef190['query'][_0xc3a4('0x59')]));_0x495498[_0xc3a4('0x58')]=_0x495498[_0xc3a4('0x58')][_0xc3a4('0x4b')]?_0x495498[_0xc3a4('0x58')]:_0x4ea850[_0xc3a4('0x52')];_0x495498['order']=qs[_0xc3a4('0xd2')](_0x3ef190[_0xc3a4('0x44')][_0xc3a4('0xd2')]);_0x495498[_0xc3a4('0x43')]=qs[_0xc3a4('0x56')](_[_0xc3a4('0xdd')](_0x3ef190[_0xc3a4('0x44')],_0x4ea850[_0xc3a4('0x56')]));if(_0x3ef190[_0xc3a4('0x44')][_0xc3a4('0x32')]){_0x495498[_0xc3a4('0x43')]=_[_0xc3a4('0x5d')](_0x495498['where'],{'$or':_[_0xc3a4('0x33')](_0x495498[_0xc3a4('0x58')],function(_0x5c5d22){var _0x31b403={};_0x31b403[_0x5c5d22]={'$like':'%'+_0x3ef190['query'][_0xc3a4('0x32')]+'%'};return _0x31b403;})});}_0x495498[_0xc3a4('0x52')]=db[_0xc3a4('0x3d')];_0x495498['as']=_0xc3a4('0x2f');_0x495498=_['merge']({},_0x495498,_0x3ef190[_0xc3a4('0x5e')]);return _0x44ccaf['getVoiceQueues']({'include':[_0x495498]});}})[_0xc3a4('0x17')](function(_0x274f84){if(_0x274f84){var _0x3fef9c={},_0x10ff94=[];for(var _0x39807b=0x0;_0x39807b<_0x274f84['length'];_0x39807b+=0x1){for(var _0x2bf338=0x0,_0x261633;_0x2bf338<_0x274f84[_0x39807b][_0xc3a4('0x2f')]['length'];_0x2bf338+=0x1){_0x261633=_0x274f84[_0x39807b][_0xc3a4('0x2f')][_0x2bf338][_0xc3a4('0x2c')]({'plain':!![]});_0x3fef9c[_0x261633['id']]=_0x261633;}}_0x3fef9c=_['values'](_0x3fef9c);for(var _0x40b706=qs['offset'](_0x3ef190['query']['offset']);_0x40b706<_0x3fef9c[_0xc3a4('0x4b')]&&_0x10ff94[_0xc3a4('0x4b')]=_0x3306c6){_0x29a863=_0x3306c6;_0x38e4a3=0xc8;}else{_0x38e4a3=0xce;}_0x28876[_0x8c9b('0x1d')](_0x38e4a3);return _0x28876[_0x8c9b('0x24')](_0x8c9b('0x25'),_0x453ede+'-'+_0x29a863+'/'+_0x3306c6)[_0x8c9b('0x1f')](_0x5b2e63);}return null;};}function saveUpdates(_0x3f6da9){return function(_0xdd50dd){if(_0xdd50dd){return _0xdd50dd['update'](_0x3f6da9)[_0x8c9b('0x26')](function(_0x31da54){socket[_0x8c9b('0x27')]('userNotification:recalc:'+_0x31da54['id'],{});return _0x31da54;});}return null;};}function removeEntity(_0x3741e5){return function(_0x2eb979){if(_0x2eb979){return _0x2eb979['destroy']()['then'](function(){var _0x172122=_0x2eb979[_0x8c9b('0x28')]({'plain':!![]});if(_0x172122['role']===_0x8c9b('0x29'))return;var _0x1a9334=[{'name':_0x8c9b('0x2a'),'value':'user','ignore':!![]},{'name':_0x8c9b('0x2b'),'value':_0x8c9b('0x2c'),'ignore':![]},{'name':_0x8c9b('0x2d'),'value':_0x8c9b('0x2e'),'ignore':![]}];var _0x48a5b8=_(_0x1a9334)[_0x8c9b('0x2f')](_0x8c9b('0x30'))[_0x8c9b('0x31')]('value')[_0x8c9b('0x32')]();if(_['includes'](_0x48a5b8,_0x172122['role'])){return;}var _0x54ce40=_[_0x8c9b('0x33')](_0x1a9334,[_0x8c9b('0x32'),_0x172122[_0x8c9b('0x34')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x54ce40,'resourceId':_0x172122['id']}})[_0x8c9b('0x26')](function(){return _0x2eb979;});})['then'](function(){_0x3741e5['status'](0xcc)[_0x8c9b('0x1e')]();});}};}function handleEntityNotFound(_0x45ac68){return function(_0x4af4e7){if(!_0x4af4e7){_0x45ac68['sendStatus'](0x194);}return _0x4af4e7;};}function handleError(_0x3affc1,_0xa60fab){_0xa60fab=_0xa60fab||0x1f4;return function(_0x1eefdc){logger['error'](_0x1eefdc[_0x8c9b('0x35')]);if(_0x1eefdc['name']){delete _0x1eefdc['name'];}_0x3affc1[_0x8c9b('0x1d')](_0xa60fab)[_0x8c9b('0x36')](_0x1eefdc);};}exports[_0x8c9b('0x37')]=function(_0x344887,_0x31c17b){var _0x3394a3={},_0x816e85={'count':0x0,'rows':[]};var _0x4f38aa=_(db['User'][_0x8c9b('0x38')])[_0x8c9b('0x31')](function(_0x3eeb19){return{'name':_0x3eeb19['fieldName'],'type':_0x3eeb19['type']['key']};})[_0x8c9b('0x2f')](function(_0x46a44f){return!_[_0x8c9b('0x39')]([_0x8c9b('0x3a'),_0x8c9b('0x3b')],_0x46a44f[_0x8c9b('0x3c')]);})['value']();_0x3394a3=qs[_0x8c9b('0x3d')](_0x4f38aa,_0x344887);var _0x495830={'where':_0x3394a3[_0x8c9b('0x3e')]};return db[_0x8c9b('0x3f')]['count'](_0x495830)['then'](function(_0x326026){_0x816e85[_0x8c9b('0x23')]=_0x326026;if(_0x344887['query'][_0x8c9b('0x40')]){_0x3394a3[_0x8c9b('0x41')]=[{'all':!![]}];}if(_0x344887[_0x8c9b('0x42')]['userSetting']===_0x8c9b('0x43')){_0x3394a3['include']=[{'model':db[_0x8c9b('0x44')],'as':_0x8c9b('0x45')}];}if(!_[_0x8c9b('0x39')](_0x3394a3[_0x8c9b('0x46')],'id')){_0x3394a3[_0x8c9b('0x46')]['push']('id');}return db['User']['findAll'](_0x3394a3);})[_0x8c9b('0x26')](function(_0x47610d){_0x816e85['rows']=_0x47610d;if(_0x344887[_0x8c9b('0x42')][_0x8c9b('0x47')]===_0x8c9b('0x43')){var _0x41ab87=[];for(var _0x5ca8d5=0x0;_0x5ca8d5<_0x816e85['rows'][_0x8c9b('0x48')];_0x5ca8d5++){_0x41ab87[_0x8c9b('0x49')](get_open_tabs(_0x8c9b('0x4a'),_0x816e85[_0x8c9b('0x4b')][_0x5ca8d5][_0x8c9b('0x4c')]));_0x41ab87[_0x8c9b('0x49')](get_open_tabs(_0x8c9b('0x4d'),_0x816e85[_0x8c9b('0x4b')][_0x5ca8d5]['dataValues']));_0x41ab87[_0x8c9b('0x49')](get_open_tabs(_0x8c9b('0x4e'),_0x816e85['rows'][_0x5ca8d5][_0x8c9b('0x4c')]));_0x41ab87[_0x8c9b('0x49')](get_open_tabs(_0x8c9b('0x4f'),_0x816e85[_0x8c9b('0x4b')][_0x5ca8d5]['dataValues']));_0x41ab87['push'](get_open_tabs(_0x8c9b('0x50'),_0x816e85[_0x8c9b('0x4b')][_0x5ca8d5][_0x8c9b('0x4c')]));_0x41ab87[_0x8c9b('0x49')](get_open_tabs(_0x8c9b('0x51'),_0x816e85[_0x8c9b('0x4b')][_0x5ca8d5][_0x8c9b('0x4c')]));}return BPromise['all'](_0x41ab87)[_0x8c9b('0x26')](function(){return _0x816e85;});}else{return _0x816e85;}})[_0x8c9b('0x26')](respondWithFilteredResult(_0x31c17b,_0x3394a3))[_0x8c9b('0x1b')](handleError(_0x31c17b,null));};exports[_0x8c9b('0x52')]=function(_0x2a3a1e,_0x1657ee){var _0x5c036f={'raw':![],'where':{'id':_0x2a3a1e['params']['id']}},_0x2adcd2={};_0x2adcd2['model']=_[_0x8c9b('0x53')](_[_0x8c9b('0x54')](db[_0x8c9b('0x3f')][_0x8c9b('0x38')]),['password',_0x8c9b('0x3b')]);_0x2adcd2[_0x8c9b('0x42')]=_[_0x8c9b('0x54')](_0x2a3a1e[_0x8c9b('0x42')]);_0x2adcd2[_0x8c9b('0x55')]=_['intersection'](_0x2adcd2[_0x8c9b('0x56')],_0x2adcd2[_0x8c9b('0x42')]);_0x5c036f[_0x8c9b('0x46')]=_['intersection'](_0x2adcd2['model'],qs[_0x8c9b('0x57')](_0x2a3a1e[_0x8c9b('0x42')]['fields']));_0x5c036f[_0x8c9b('0x46')]=_0x5c036f[_0x8c9b('0x46')][_0x8c9b('0x48')]?_0x5c036f[_0x8c9b('0x46')]:_0x2adcd2['model'];if(_0x2a3a1e[_0x8c9b('0x42')][_0x8c9b('0x40')]){_0x5c036f['include']=[{'all':!![]}];}if(_0x2a3a1e[_0x8c9b('0x42')][_0x8c9b('0x45')]==='true'){_0x5c036f['include']=[{'model':db[_0x8c9b('0x44')],'as':_0x8c9b('0x45')}];}_0x5c036f=_[_0x8c9b('0x58')]({},_0x5c036f,_0x2a3a1e[_0x8c9b('0x59')]);if(!_[_0x8c9b('0x39')](_0x5c036f[_0x8c9b('0x46')],'id')){_0x5c036f[_0x8c9b('0x46')][_0x8c9b('0x49')]('id');}return db[_0x8c9b('0x3f')][_0x8c9b('0x33')](_0x5c036f)['then'](handleEntityNotFound(_0x1657ee,null))['then'](function(_0x158fb1){var _0x45828a=[];values=_0x158fb1;if(_0x2a3a1e['query'][_0x8c9b('0x47')]==='true'){_0x45828a[_0x8c9b('0x49')](get_open_tabs(_0x8c9b('0x4a'),_0x158fb1[_0x8c9b('0x4c')]));_0x45828a[_0x8c9b('0x49')](get_open_tabs('sms',_0x158fb1[_0x8c9b('0x4c')]));_0x45828a[_0x8c9b('0x49')](get_open_tabs('openchannel',_0x158fb1[_0x8c9b('0x4c')]));_0x45828a[_0x8c9b('0x49')](get_open_tabs(_0x8c9b('0x51'),_0x158fb1[_0x8c9b('0x4c')]));_0x45828a['push'](get_open_tabs(_0x8c9b('0x4e'),_0x158fb1['dataValues']));_0x45828a[_0x8c9b('0x49')](get_open_tabs('mail',_0x158fb1[_0x8c9b('0x4c')]));return BPromise[_0x8c9b('0x5a')](_0x45828a);}else{return values;}})[_0x8c9b('0x26')](function(){return values;})[_0x8c9b('0x26')](respondWithResult(_0x1657ee,null))[_0x8c9b('0x1b')](handleError(_0x1657ee,null));};exports[_0x8c9b('0x5b')]=function(_0x32ddfb,_0x56c851){if(_0x32ddfb[_0x8c9b('0x5c')]['id']){delete _0x32ddfb[_0x8c9b('0x5c')]['id'];}delete _0x32ddfb[_0x8c9b('0x5c')][_0x8c9b('0x34')];return db[_0x8c9b('0x3f')][_0x8c9b('0x33')]({'where':{'id':_0x32ddfb[_0x8c9b('0x5d')]['id']}})[_0x8c9b('0x26')](handleEntityNotFound(_0x56c851,null))[_0x8c9b('0x26')](saveUpdates(_0x32ddfb['body'],null))[_0x8c9b('0x26')](respondWithResult(_0x56c851,null))['catch'](handleError(_0x56c851,null));};exports[_0x8c9b('0x5e')]=function(_0x46e5f4,_0x3dac13){return db[_0x8c9b('0x3f')][_0x8c9b('0x5e')]()[_0x8c9b('0x26')](respondWithResult(_0x3dac13,null))['catch'](handleError(_0x3dac13,null));};exports[_0x8c9b('0x5f')]=function(_0x4725ac,_0x4da1a4){return db[_0x8c9b('0x3f')][_0x8c9b('0x33')]({'where':{'id':_0x4725ac['params']['id']}})[_0x8c9b('0x26')](handleEntityNotFound(_0x4da1a4,null))[_0x8c9b('0x26')](function(_0x43c7a1){if(_0x43c7a1){return _0x43c7a1[_0x8c9b('0x5f')](_0x4725ac['body'][_0x8c9b('0x60')],_[_0x8c9b('0x61')](_0x4725ac[_0x8c9b('0x5c')],[_0x8c9b('0x60'),'id'])||{});}})[_0x8c9b('0x26')](respondWithResult(_0x4da1a4,null))[_0x8c9b('0x1b')](handleError(_0x4da1a4,null));};function validateUser(_0x36ddbc){return new BPromise(function(_0x5bc078,_0x1c94be){if(_0x36ddbc[_0x8c9b('0x62')])return _0x5bc078(_0x36ddbc);return db[_0x8c9b('0x63')][_0x8c9b('0x64')](0x1)[_0x8c9b('0x26')](function(_0x18a5dd){if(_0x18a5dd['securePassword'])authService[_0x8c9b('0x65')](_0x36ddbc[_0x8c9b('0x3a')]);db[_0x8c9b('0x3f')][_0x8c9b('0x66')]('internal')['then'](function(_0x1b9db5){if(_[_0x8c9b('0x67')](_0x1b9db5)){_0x36ddbc['internal']=_0x18a5dd[_0x8c9b('0x68')]||0x1;return;}if(_[_0x8c9b('0x67')](_0x18a5dd[_0x8c9b('0x68')])||_0x18a5dd['min_internal']===_0x1b9db5){_0x36ddbc[_0x8c9b('0x62')]=_0x1b9db5+0x1;return;}if(_0x18a5dd['min_internal']>_0x1b9db5){_0x36ddbc[_0x8c9b('0x62')]=_0x18a5dd['min_internal'];return;}return db[_0x8c9b('0x69')][_0x8c9b('0x42')](_0x8c9b('0x6a'),{'type':db[_0x8c9b('0x69')][_0x8c9b('0x6b')]['SELECT']})['then'](function(_0x5e0a2f){if(_0x5e0a2f&&_0x5e0a2f[_0x8c9b('0x48')]){for(var _0x3c9999=0x0,_0x5ce166=_0x5e0a2f[_0x8c9b('0x48')];_0x3c9999<_0x5ce166&&_['isNil'](_0x36ddbc[_0x8c9b('0x62')]);_0x3c9999++){if(_0x18a5dd[_0x8c9b('0x68')]<=_0x5e0a2f[_0x3c9999]['from']){_0x36ddbc['internal']=_0x5e0a2f[_0x3c9999]['from'];}else if(_0x18a5dd[_0x8c9b('0x68')]>_0x5e0a2f[_0x3c9999][_0x8c9b('0x6c')]&&_0x18a5dd[_0x8c9b('0x68')]<=_0x5e0a2f[_0x3c9999]['to']){_0x36ddbc[_0x8c9b('0x62')]=_0x18a5dd[_0x8c9b('0x68')];}}}if(_[_0x8c9b('0x67')](_0x36ddbc[_0x8c9b('0x62')])){_0x36ddbc[_0x8c9b('0x62')]=_0x1b9db5+0x1;}return _0x5bc078(_0x36ddbc);});});})[_0x8c9b('0x1b')](function(_0x1f7bef){_0x1c94be(_0x1f7bef);});});}function updateUser(_0x16cf0a){return new BPromise(function(_0x357b57,_0x2c2a3f){try{if(_0x16cf0a[_0x8c9b('0x6d')]){_0x16cf0a[_0x8c9b('0x6e')]=_0x16cf0a[_0x8c9b('0x62')];_0x16cf0a[_0x8c9b('0x6f')]={'mailbox':_0x16cf0a['internal'],'password':_0x16cf0a[_0x8c9b('0x3a')],'fullname':_0x16cf0a[_0x8c9b('0x70')],'email':_0x16cf0a[_0x8c9b('0x71')]};}if(_0x16cf0a[_0x8c9b('0x34')]===_0x8c9b('0x2c')){if(!_0x16cf0a['permissions'])_0x16cf0a['permissions']=[_0x8c9b('0x72'),'102',_0x8c9b('0x73'),'113','110',_0x8c9b('0x74'),_0x8c9b('0x75'),'106',_0x8c9b('0x76'),'108',_0x8c9b('0x77'),_0x8c9b('0x78'),_0x8c9b('0x79'),_0x8c9b('0x7a'),'115'];}_0x357b57(_0x16cf0a);}catch(_0x1f54c0){_0x2c2a3f(_0x1f54c0);}});}exports[_0x8c9b('0x7b')]=function(_0x43d261,_0x3c167d){if(_0x43d261['user']['role']===_0x8c9b('0x2c'))throw new Error('Unauthorized');if(_0x43d261['body'][_0x8c9b('0x34')]==='user'&&_0x43d261['user']['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x43d261[_0x8c9b('0x5c')][_0x8c9b('0x34')]==='admin'&&_0x43d261[_0x8c9b('0x7c')][_0x8c9b('0x34')]!==_0x8c9b('0x29')){throw new Error(_0x8c9b('0x7d'));}return licenseUtil['checkUserLimits']([_0x43d261['body']])[_0x8c9b('0x26')](function(){return validateUser(_0x43d261['body']);})['then'](function(_0x551de4){return updateUser(_0x551de4)[_0x8c9b('0x26')](function(_0x4701e6){if(_0x4701e6[_0x8c9b('0x34')]===_0x8c9b('0x29')){_0x4701e6[_0x8c9b('0x7e')]=_0x43d261['user']['settingsEnabled'];delete _0x4701e6[_0x8c9b('0x7f')];}return _0x4701e6;});})[_0x8c9b('0x26')](function(_0x1efd2e){return db['User']['create'](_0x1efd2e,{'include':[{'model':db[_0x8c9b('0x6f')],'as':_0x8c9b('0x6f')}]});})[_0x8c9b('0x26')](function(_0x5bb655){if(_0x43d261[_0x8c9b('0x5c')][_0x8c9b('0x34')]==='user')return _0x5bb655;if(_0x43d261['user'][_0x8c9b('0x34')]!==_0x8c9b('0x7c'))return _0x5bb655;return db[_0x8c9b('0x80')]['find']({'where':{'name':_0x5bb655[_0x8c9b('0x34')]===_0x8c9b('0x2c')?_0x8c9b('0x2b'):'Telephones','userProfileId':_0x43d261['user'][_0x8c9b('0x7f')]},'raw':!![]})[_0x8c9b('0x26')](function(_0x562955){if(!_0x562955||_0x562955[_0x8c9b('0x81')]!=0x0)return _0x5bb655;return db[_0x8c9b('0x82')][_0x8c9b('0x7b')]({'name':_0x5bb655[_0x8c9b('0x3c')],'resourceId':_0x5bb655['id'],'type':_0x562955[_0x8c9b('0x3c')],'sectionId':_0x562955['id']},{})[_0x8c9b('0x26')](function(){return _0x5bb655;});})['catch'](function(_0x51b8ac){logger['error'](_0x8c9b('0x83'),_0x51b8ac);throw _0x51b8ac;});})[_0x8c9b('0x26')](respondWithResult(_0x3c167d,0xc9))[_0x8c9b('0x1b')](handleError(_0x3c167d,null));};exports[_0x8c9b('0x84')]=function(_0x25cac7,_0x353f43){var _0x33e76d=_0x25cac7[_0x8c9b('0x5c')];var _0x1bfc37=[];if(_0x25cac7[_0x8c9b('0x7c')][_0x8c9b('0x34')]==='agent')throw new Error(_0x8c9b('0x85'));if(_['some'](_0x33e76d,[_0x8c9b('0x34'),_0x8c9b('0x7c')])&&_0x25cac7[_0x8c9b('0x7c')][_0x8c9b('0x34')]!==_0x8c9b('0x29')){throw new Error(_0x8c9b('0x86'));}if(_[_0x8c9b('0x87')](_0x33e76d,['role',_0x8c9b('0x29')])&&_0x25cac7[_0x8c9b('0x7c')][_0x8c9b('0x34')]!==_0x8c9b('0x29')){throw new Error(_0x8c9b('0x88'));}return licenseUtil[_0x8c9b('0x89')](_0x33e76d)[_0x8c9b('0x26')](function(){return validateUser(_0x33e76d[0x0]);})[_0x8c9b('0x26')](function(){for(var _0x9857d4=0x1;_0x9857d4<_0x33e76d['length'];_0x9857d4++){var _0x369197=_0x33e76d[_0x9857d4-0x1][_0x8c9b('0x62')];if(!_0x33e76d[_0x9857d4]['internal'])_0x33e76d[_0x9857d4][_0x8c9b('0x62')]=_0x369197+0x1;_0x1bfc37['push'](validateUser(_0x33e76d[_0x9857d4]));}return BPromise[_0x8c9b('0x5a')](_0x1bfc37);})[_0x8c9b('0x26')](function(){_0x1bfc37=[];for(var _0x139713=0x0;_0x139713<_0x33e76d['length'];_0x139713++){_0x1bfc37[_0x8c9b('0x49')](updateUser(_0x33e76d[_0x139713]));}return BPromise[_0x8c9b('0x5a')](_0x1bfc37);})['then'](function(){return BPromise[_0x8c9b('0x8a')](_0x33e76d,function(_0x27d857){return db[_0x8c9b('0x3f')][_0x8c9b('0x7b')](_0x27d857,{'include':[{'model':db[_0x8c9b('0x6f')],'as':_0x8c9b('0x6f')}]})[_0x8c9b('0x26')](function(_0x51afcc){_0x27d857['id']=_0x51afcc['id'];return _0x27d857;});});})[_0x8c9b('0x26')](function(_0x138831){if(_0x25cac7[_0x8c9b('0x5c')][_0x8c9b('0x34')]==='user')return _0x138831;if(_0x25cac7[_0x8c9b('0x7c')][_0x8c9b('0x34')]!=='user')return _0x138831;var _0xa3d4dc=_[_0x8c9b('0x87')](_0x138831,function(_0x388204){return _0x388204[_0x8c9b('0x34')]==='agent'||_0x388204[_0x8c9b('0x34')]===_0x8c9b('0x2e');});if(!_0xa3d4dc)return _0x138831;return db['UserProfileSection'][_0x8c9b('0x8b')]({'where':{'name':{'$or':[_0x8c9b('0x2b'),'Telephones']},'userProfileId':_0x25cac7[_0x8c9b('0x7c')][_0x8c9b('0x7f')]},'raw':!![]})['then'](function(_0x3afbfb){if(_[_0x8c9b('0x8c')](_0x3afbfb)||!_[_0x8c9b('0x87')](_0x3afbfb,[_0x8c9b('0x81'),0x0]))return _0x138831;_0x1bfc37=[];var _0x5d9c58=_(_0x3afbfb)[_0x8c9b('0x31')](function(_0x306589){if(_0x306589[_0x8c9b('0x81')]===0x1)return;return _0x306589[_0x8c9b('0x3c')]===_0x8c9b('0x2b')?_0x8c9b('0x2c'):'telephone';})['compact']()[_0x8c9b('0x32')]();for(var _0x202c6e=0x0;_0x202c6e<_0x138831[_0x8c9b('0x48')];_0x202c6e++){if(!_['includes'](_0x5d9c58,_0x138831[_0x202c6e][_0x8c9b('0x34')]))return;var _0x2010ae=_0x138831[_0x202c6e]['role']===_0x8c9b('0x2c')?_0x8c9b('0x2b'):'Telephones';_0x1bfc37[_0x8c9b('0x49')](db[_0x8c9b('0x82')][_0x8c9b('0x7b')]({'name':_0x138831[_0x202c6e]['name'],'resourceId':_0x138831[_0x202c6e]['id'],'type':_0x2010ae,'sectionId':_['find'](_0x3afbfb,['name',_0x2010ae])['id']},{}));}return BPromise['all'](_0x1bfc37);});})[_0x8c9b('0x26')](respondWithResult(_0x353f43,0xc9))[_0x8c9b('0x1b')](handleError(_0x353f43,null));};exports[_0x8c9b('0x8d')]=function(_0xa08b01,_0x1972d2){if(_0xa08b01[_0x8c9b('0x5c')]['id']){delete _0xa08b01['body']['id'];}return db[_0x8c9b('0x3f')][_0x8c9b('0x33')]({'where':{'id':_0xa08b01[_0x8c9b('0x5d')]['id']}})[_0x8c9b('0x26')](function(_0x172b79){if(!_0x172b79)return null;if(_0x172b79['id']===_0xa08b01[_0x8c9b('0x7c')]['id']){if(!_0xa08b01['body'][_0x8c9b('0x8e')]||!_0xa08b01[_0x8c9b('0x5c')][_0x8c9b('0x8f')]){throw new db[(_0x8c9b('0x90'))][(_0x8c9b('0x91'))](_0x8c9b('0x92'));}if(!_0x172b79[_0x8c9b('0x93')](_0xa08b01[_0x8c9b('0x5c')][_0x8c9b('0x8e')])){throw new db['Sequelize'][(_0x8c9b('0x91'))](_0x8c9b('0x94'));}if(_0xa08b01[_0x8c9b('0x5c')][_0x8c9b('0x8e')]===_0xa08b01[_0x8c9b('0x5c')]['newPassword']){throw new db['Sequelize'][(_0x8c9b('0x91'))](_0x8c9b('0x95'));}}else if(_0xa08b01['user'][_0x8c9b('0x34')]===_0x8c9b('0x29')){if(!_0xa08b01['body'][_0x8c9b('0x8f')]){throw new db[(_0x8c9b('0x90'))][(_0x8c9b('0x91'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0xa08b01['user'][_0x8c9b('0x34')]==='user'){if(!_0xa08b01[_0x8c9b('0x5c')][_0x8c9b('0x8f')]){throw new db[(_0x8c9b('0x90'))]['ValidationError'](_0x8c9b('0x96'));}if(_0x172b79[_0x8c9b('0x34')]!==_0x8c9b('0x2c')){throw new db[(_0x8c9b('0x90'))][(_0x8c9b('0x91'))](_0x8c9b('0x85'));}}else{throw new db['Sequelize']['ValidationError'](_0x8c9b('0x85'));}return _0x172b79;})['then'](handleEntityNotFound(_0x1972d2,null))[_0x8c9b('0x26')](function(_0x29a661){return db['Setting']['findOne']({'attributes':['id',_0x8c9b('0x97'),'enforcePasswordHistory',_0x8c9b('0x98')]})[_0x8c9b('0x26')](function(_0x4e6068){if(_0x4e6068['securePassword'])authService[_0x8c9b('0x65')](_0xa08b01['body'][_0x8c9b('0x8f')]);if(!_0x4e6068['enforcePasswordHistory']||!_0x29a661[_0x8c9b('0x99')])return _0x29a661;authService[_0x8c9b('0x9a')](_0xa08b01[_0x8c9b('0x5c')][_0x8c9b('0x8f')],_0x29a661[_0x8c9b('0x99')],_0x4e6068[_0x8c9b('0x98')]);return _0x29a661;})[_0x8c9b('0x26')](saveUpdates({'password':_0xa08b01[_0x8c9b('0x5c')][_0x8c9b('0x8f')],'passwordResetAt':_0xa08b01[_0x8c9b('0x7c')]['id']==_0xa08b01[_0x8c9b('0x5d')]['id']?moment():null,'previousPasswords':authService[_0x8c9b('0x9b')](_0xa08b01[_0x8c9b('0x5c')][_0x8c9b('0x8f')],_0x29a661['previousPasswords'])},null));})['then'](respondWithResult(_0x1972d2,null))[_0x8c9b('0x1b')](handleError(_0x1972d2,null));};exports[_0x8c9b('0x9c')]=function(_0x302ada,_0x5bd000){var _0x3c1f64=_0x302ada[_0x8c9b('0x5c')]['channel'];return db['User'][_0x8c9b('0x33')]({'where':{'id':_0x302ada[_0x8c9b('0x5d')]['id']},'attributes':['id','name',_0x8c9b('0x34'),_0x8c9b('0x9d'),_0x8c9b('0x9e'),_0x8c9b('0x9f'),'interface']})['then'](handleEntityNotFound(_0x5bd000,null))[_0x8c9b('0x26')](function(_0x2db18e){if(_0x2db18e){if(!utils[_0x8c9b('0xa0')](_0x3c1f64)){throw new db['Sequelize'][(_0x8c9b('0x91'))](_0x8c9b('0xa1'));}return _0x2db18e[_0x8c9b('0xa2')+_[_0x8c9b('0xa3')](_0x3c1f64['toLowerCase']())+_0x8c9b('0xa4')](_0x302ada[_0x8c9b('0x5c')][_0x8c9b('0x60')],{'penalty':_0x302ada[_0x8c9b('0x5c')][_0x8c9b('0xa5')]||0x0})[_0x8c9b('0xa6')](function(_0x31656b){for(var _0xbacffa=0x0;_0xbacffa<_0x302ada['body'][_0x8c9b('0x60')][_0x8c9b('0x48')];_0xbacffa+=0x1){var _0x2b72c7={'UserId':Number(_0x302ada[_0x8c9b('0x5d')]['id'])};_0x2b72c7[_[_0x8c9b('0xa3')](_0x3c1f64[_0x8c9b('0xa7')]())+_0x8c9b('0xa8')]=Number(_0x302ada['body'][_0x8c9b('0x60')][_0xbacffa]);socket[_0x8c9b('0x27')]('user'+_[_0x8c9b('0xa3')](_0x3c1f64[_0x8c9b('0xa7')]())+_0x8c9b('0xa9'),_0x2b72c7);}return _0x31656b;})[_0x8c9b('0x26')](function(){if(_0x3c1f64===_0x8c9b('0xaa')){return db[_0x8c9b('0xab')][_0x8c9b('0x8b')]({'where':{'id':_0x302ada[_0x8c9b('0x5c')]['ids']||[]},'raw':!![],'attributes':['id',_0x8c9b('0x3c')]});}})['then'](function(_0x1f698f){var _0x2f8440=_0x2db18e['get']({'plain':!![]});var _0xff21e2=[];if(_0x3c1f64==='voice'&&_0x2f8440[_0x8c9b('0x34')]==='agent'&&_0x2f8440[_0x8c9b('0x9d')]){for(var _0x3dbc53=0x0;_0x3dbc53<_0x1f698f[_0x8c9b('0x48')];_0x3dbc53+=0x1){_0xff21e2[_0x8c9b('0x49')]({'membername':_0x2f8440[_0x8c9b('0x3c')],'UserId':_0x2f8440['id'],'queue_name':_0x1f698f[_0x3dbc53]['name'],'VoiceQueueId':_0x1f698f[_0x3dbc53]['id'],'interface':_[_0x8c9b('0x67')](_0x2f8440['interface'])?util[_0x8c9b('0xac')]('SIP/%s',_0x2f8440['name']):_0x2f8440[_0x8c9b('0xad')],'paused':_0x2f8440['voicePause']||![],'penalty':_0x302ada[_0x8c9b('0x5c')][_0x8c9b('0xa5')]||0x0});}return BPromise['each'](_0xff21e2,function(_0x228770){return db['UserVoiceQueueRt'][_0x8c9b('0xae')](_0x228770);});}return _0x2db18e;});}})[_0x8c9b('0x26')](respondWithStatusCode(_0x5bd000,null))[_0x8c9b('0x1b')](handleError(_0x5bd000,null));};exports[_0x8c9b('0xaf')]=function(_0x2c92d1,_0x459d51){var _0x257a65,_0x146ac9;return db[_0x8c9b('0x3f')]['find']({'where':{'id':_0x2c92d1[_0x8c9b('0x5d')]['id']},'attributes':['id',_0x8c9b('0x3c'),_0x8c9b('0x34')]})[_0x8c9b('0x26')](handleEntityNotFound(_0x459d51,null))['then'](function(_0xdc9685){if(_0xdc9685){_0x257a65=_0xdc9685;if(!_0x2c92d1['query'][_0x8c9b('0xb0')]||!utils['isValidChannel'](_0x2c92d1[_0x8c9b('0x42')][_0x8c9b('0xb0')])){throw new db[(_0x8c9b('0x90'))][(_0x8c9b('0x91'))]('Unknown\x20channel');}return _0xdc9685[_0x8c9b('0xb1')+_['capitalize'](_0x2c92d1[_0x8c9b('0x42')][_0x8c9b('0xb0')][_0x8c9b('0xa7')]())+_0x8c9b('0xa4')](_0x2c92d1['query']['ids']);}})[_0x8c9b('0x26')](function(_0x5a008a){if(_[_0x8c9b('0xb2')](_0x2c92d1[_0x8c9b('0x42')][_0x8c9b('0x60')])){for(var _0x52197d=0x0;_0x52197d<_0x2c92d1[_0x8c9b('0x42')][_0x8c9b('0x60')][_0x8c9b('0x48')];_0x52197d+=0x1){_0x146ac9={'UserId':Number(_0x2c92d1[_0x8c9b('0x5d')]['id'])};_0x146ac9[_['capitalize'](_0x2c92d1[_0x8c9b('0x42')]['channel'][_0x8c9b('0xa7')]())+_0x8c9b('0xa8')]=Number(_0x2c92d1['query'][_0x8c9b('0x60')][_0x52197d]);socket[_0x8c9b('0x27')](_0x8c9b('0x7c')+_[_0x8c9b('0xa3')](_0x2c92d1[_0x8c9b('0x42')][_0x8c9b('0xb0')][_0x8c9b('0xa7')]())+_0x8c9b('0xb3'),_0x146ac9);}}else{_0x146ac9={'UserId':Number(_0x2c92d1[_0x8c9b('0x5d')]['id'])};_0x146ac9[_[_0x8c9b('0xa3')](_0x2c92d1[_0x8c9b('0x42')][_0x8c9b('0xb0')]['toLowerCase']())+_0x8c9b('0xa8')]=Number(_0x2c92d1[_0x8c9b('0x42')][_0x8c9b('0x60')]);socket[_0x8c9b('0x27')](_0x8c9b('0x7c')+_[_0x8c9b('0xa3')](_0x2c92d1[_0x8c9b('0x42')][_0x8c9b('0xb0')][_0x8c9b('0xa7')]())+_0x8c9b('0xb3'),_0x146ac9);}return _0x5a008a;})[_0x8c9b('0x26')](function(){if(_0x2c92d1['query'][_0x8c9b('0xb0')]===_0x8c9b('0xaa')){return db[_0x8c9b('0xb4')][_0x8c9b('0xb5')]({'where':{'UserId':_0x2c92d1[_0x8c9b('0x5d')]['id'],'VoiceQueueId':_0x2c92d1[_0x8c9b('0x42')]['ids']},'individualHooks':!![]})['then'](function(){return _0x257a65;});}return _0x257a65;})[_0x8c9b('0x26')](respondWithStatusCode(_0x459d51,null))[_0x8c9b('0x1b')](handleError(_0x459d51,null));};exports['addAvatar']=function(_0x495d04,_0x7e45bb){_0x495d04[_0x8c9b('0x5c')][_0x8c9b('0xb6')]=_0x495d04['file'][_0x8c9b('0xb7')];return db[_0x8c9b('0x3f')][_0x8c9b('0x33')]({'where':{'id':_0x495d04[_0x8c9b('0x5d')]['id']}})[_0x8c9b('0x26')](handleEntityNotFound(_0x7e45bb,null))[_0x8c9b('0x26')](saveUpdates(_0x495d04[_0x8c9b('0x5c')],null))[_0x8c9b('0x26')](respondWithResult(_0x7e45bb,null))['catch'](handleError(_0x7e45bb,null));};exports[_0x8c9b('0xb8')]=function(_0x4028e5,_0xfa8084){var _0x1fdfa5=path['join'](config[_0x8c9b('0xb9')],_0x8c9b('0xba'));return db[_0x8c9b('0x3f')][_0x8c9b('0x33')]({'where':{'id':_0x4028e5['params']['id']},'attributes':['id',_0x8c9b('0xb6')],'raw':!![]})[_0x8c9b('0x26')](handleEntityNotFound(_0xfa8084,null))[_0x8c9b('0x26')](function(_0x5c7e49){if(_0x5c7e49){if(_['isNil'](_0x5c7e49[_0x8c9b('0xb6')])){return _0xfa8084['download'](_0x1fdfa5);}else{if(!fs[_0x8c9b('0xbb')](path[_0x8c9b('0xbc')](config[_0x8c9b('0xb9')],_0x8c9b('0xbd'),_0x5c7e49[_0x8c9b('0xb6')]))){return _0xfa8084[_0x8c9b('0xbe')](_0x1fdfa5);}return _0xfa8084[_0x8c9b('0xbe')](path['join'](config['root'],_0x8c9b('0xbd'),_0x5c7e49[_0x8c9b('0xb6')]));}}})['catch'](handleError(_0xfa8084,null));};exports[_0x8c9b('0xbf')]=function(_0x2c9353,_0x5263a6){return db[_0x8c9b('0x3f')][_0x8c9b('0x33')]({'where':{'id':_0x2c9353['params']['id']},'attributes':['id']})[_0x8c9b('0x26')](handleEntityNotFound(_0x5263a6,null))['then'](function(_0x5eae91){var _0x547674=[];values=_0x5eae91[_0x8c9b('0x4c')];_0x547674[_0x8c9b('0x49')](get_open_tabs(_0x8c9b('0x4a'),_0x5eae91[_0x8c9b('0x4c')]));_0x547674[_0x8c9b('0x49')](get_open_tabs(_0x8c9b('0x4d'),_0x5eae91[_0x8c9b('0x4c')]));_0x547674['push'](get_open_tabs('openchannel',_0x5eae91[_0x8c9b('0x4c')]));_0x547674[_0x8c9b('0x49')](get_open_tabs('whatsapp',_0x5eae91[_0x8c9b('0x4c')]));_0x547674[_0x8c9b('0x49')](get_open_tabs(_0x8c9b('0x4e'),_0x5eae91['dataValues']));_0x547674[_0x8c9b('0x49')](get_open_tabs(_0x8c9b('0x4f'),_0x5eae91[_0x8c9b('0x4c')]));return BPromise[_0x8c9b('0x5a')](_0x547674);})[_0x8c9b('0x26')](function(_0x364a83){if(_0x364a83){var _0x3a4cd8=_[_0x8c9b('0x31')](values[_0x8c9b('0xc0')],function(_0x15ac10){return{'channel':_0x8c9b('0xc1'),'id':_0x15ac10['id'],'createdAt':_0x15ac10[_0x8c9b('0xc2')]};});var _0x2e406f=_[_0x8c9b('0x31')](values[_0x8c9b('0xc3')],function(_0x5e6604){return{'channel':'FAX','id':_0x5e6604['id'],'createdAt':_0x5e6604[_0x8c9b('0xc2')]};});var _0x5f0bb3=_[_0x8c9b('0x31')](values[_0x8c9b('0xc4')],function(_0x15bb1a){return{'channel':_0x8c9b('0xc5'),'id':_0x15bb1a['id'],'createdAt':_0x15bb1a['createdAt']};});var _0x53aed2=_[_0x8c9b('0x31')](values[_0x8c9b('0xc6')],function(_0x4b24bf){return{'channel':_0x8c9b('0xc7'),'id':_0x4b24bf['id'],'createdAt':_0x4b24bf[_0x8c9b('0xc2')]};});var _0x4fdfb0=_[_0x8c9b('0x31')](values[_0x8c9b('0xc8')],function(_0x1ff083){return{'channel':_0x8c9b('0xc9'),'id':_0x1ff083['id'],'createdAt':_0x1ff083[_0x8c9b('0xc2')]};});var _0x4f5bb1=_['map'](values[_0x8c9b('0xca')],function(_0x4da28d){return{'channel':'WHATSAPP','id':_0x4da28d['id'],'createdAt':_0x4da28d[_0x8c9b('0xc2')]};});var _0x8d7477=_[_0x8c9b('0xcb')](_0x3a4cd8,_0x2e406f,_0x5f0bb3,_0x53aed2,_0x4fdfb0,_0x4f5bb1);var _0x3ad633={'count':_0x8d7477[_0x8c9b('0x48')],'rows':_0x8d7477};return _0x3ad633;}else return null;})['then'](respondWithResult(_0x5263a6,null))['catch'](handleError(_0x5263a6,null));};exports[_0x8c9b('0xcc')]=function(_0x193ab5,_0xaa39e8){var _0x13b79e={};var _0x14945e={};var _0x276243;var _0x128b85;return db[_0x8c9b('0x3f')][_0x8c9b('0xcd')]({'where':{'id':_0x193ab5[_0x8c9b('0x5d')]['id']}})[_0x8c9b('0x26')](handleEntityNotFound(_0xaa39e8,null))[_0x8c9b('0x26')](function(_0x16dd12){if(_0x16dd12){_0x276243=_0x16dd12;_0x14945e[_0x8c9b('0x56')]=_[_0x8c9b('0x54')](db[_0x8c9b('0xce')][_0x8c9b('0x38')]);_0x14945e[_0x8c9b('0x42')]=_[_0x8c9b('0x54')](_0x193ab5['query']);_0x14945e['filters']=_[_0x8c9b('0xcf')](_0x14945e[_0x8c9b('0x56')],_0x14945e[_0x8c9b('0x42')]);_0x13b79e[_0x8c9b('0x46')]=_[_0x8c9b('0xcf')](_0x14945e[_0x8c9b('0x56')],qs[_0x8c9b('0x57')](_0x193ab5[_0x8c9b('0x42')][_0x8c9b('0x57')]));_0x13b79e['attributes']=_0x13b79e[_0x8c9b('0x46')][_0x8c9b('0x48')]?_0x13b79e[_0x8c9b('0x46')]:_0x14945e[_0x8c9b('0x56')];_0x13b79e['order']=qs[_0x8c9b('0xd0')](_0x193ab5[_0x8c9b('0x42')]['sort']);_0x13b79e['where']=qs[_0x8c9b('0x55')](_[_0x8c9b('0xd1')](_0x193ab5[_0x8c9b('0x42')],_0x14945e['filters']));if(_0x193ab5[_0x8c9b('0x42')][_0x8c9b('0x2f')]){_0x13b79e[_0x8c9b('0x3e')]=_[_0x8c9b('0x58')](_0x13b79e['where'],{'$or':_[_0x8c9b('0x31')](_0x13b79e[_0x8c9b('0x46')],function(_0x3f0212){var _0x250103={};_0x250103[_0x3f0212]={'$like':'%'+_0x193ab5['query'][_0x8c9b('0x2f')]+'%'};return _0x250103;})});}_0x13b79e=_[_0x8c9b('0x58')]({},_0x13b79e,_0x193ab5['options']);return _0x276243[_0x8c9b('0xcc')](_0x13b79e);}})[_0x8c9b('0x26')](function(_0x21edcf){if(_0x21edcf){_0x128b85=_0x21edcf[_0x8c9b('0x48')];if(_0x193ab5['query'][_0x8c9b('0xd2')](_0x8c9b('0x40'))){_0x13b79e[_0x8c9b('0x41')]=[{'model':db[_0x8c9b('0xd3')],'as':_0x8c9b('0xd4'),'required':![]},{'model':db[_0x8c9b('0xd5')],'as':_0x8c9b('0xd6'),'attributes':['id','name','color'],'where':_0x193ab5['query']['tag']?{'id':_0x193ab5['query'][_0x8c9b('0xd7')]}:undefined,'required':_0x193ab5[_0x8c9b('0x42')][_0x8c9b('0xd7')]?!![]:![]}];}if(!_0x193ab5['query'][_0x8c9b('0xd2')](_0x8c9b('0xd8'))){_0x13b79e[_0x8c9b('0x21')]=qs[_0x8c9b('0x21')](_0x193ab5['query'][_0x8c9b('0x21')]);_0x13b79e[_0x8c9b('0x20')]=qs[_0x8c9b('0x20')](_0x193ab5[_0x8c9b('0x42')][_0x8c9b('0x20')]);}return _0x276243['getContacts'](_0x13b79e);}})['then'](function(_0x11499f){if(_0x11499f){return _0x11499f?{'count':_0x128b85,'rows':_0x11499f}:null;}})[_0x8c9b('0x26')](respondWithResult(_0xaa39e8,null))[_0x8c9b('0x1b')](handleError(_0xaa39e8,null));};exports[_0x8c9b('0xd9')]=function(_0x4b7ef7,_0x4f6e14){var _0x10dbd9;var _0x528ccf={};var _0x30c213;return db[_0x8c9b('0x3f')][_0x8c9b('0xcd')]({'where':{'id':_0x4b7ef7[_0x8c9b('0x5d')]['id']},'attributes':['id',_0x8c9b('0x3c'),_0x8c9b('0x34')]})[_0x8c9b('0x26')](handleEntityNotFound(_0x4f6e14,null))[_0x8c9b('0x26')](function(_0x2250c3){if(!utils['isValidChannel'](_0x4b7ef7['query'][_0x8c9b('0xb0')])){throw new db[(_0x8c9b('0x90'))][(_0x8c9b('0x91'))]('Unknown\x20channel');}_0x10dbd9=_0x2250c3;var _0x11daec={};_0x11daec[_0x8c9b('0x56')]=_['keys'](db[_[_0x8c9b('0xa3')](_0x4b7ef7['query']['channel'])+'Queue'][_0x8c9b('0x38')]);_0x11daec[_0x8c9b('0x42')]=_[_0x8c9b('0x54')](_0x4b7ef7[_0x8c9b('0x42')]);_0x11daec[_0x8c9b('0x55')]=_[_0x8c9b('0xcf')](_0x11daec[_0x8c9b('0x56')],_0x11daec['query']);_0x528ccf['attributes']=_[_0x8c9b('0xcf')](_0x11daec[_0x8c9b('0x56')],qs['fields'](_0x4b7ef7[_0x8c9b('0x42')][_0x8c9b('0x57')]));_0x528ccf[_0x8c9b('0x46')]=_0x528ccf[_0x8c9b('0x46')]['length']?_0x528ccf[_0x8c9b('0x46')]:_0x11daec[_0x8c9b('0x56')];_0x528ccf[_0x8c9b('0xda')]=qs[_0x8c9b('0xd0')](_0x4b7ef7['query'][_0x8c9b('0xd0')]);_0x528ccf[_0x8c9b('0x3e')]=qs[_0x8c9b('0x55')](_[_0x8c9b('0xd1')](_0x4b7ef7[_0x8c9b('0x42')],_0x11daec[_0x8c9b('0x55')]));if(_0x4b7ef7['query'][_0x8c9b('0x2f')]){_0x528ccf[_0x8c9b('0x3e')]=_['merge'](_0x528ccf[_0x8c9b('0x3e')],{'$or':_['map'](_0x528ccf['attributes'],function(_0x31e0d8){var _0x260b77={};_0x260b77[_0x31e0d8]={'$like':'%'+_0x4b7ef7['query'][_0x8c9b('0x2f')]+'%'};return _0x260b77;})});}_0x528ccf=_['merge']({},_0x528ccf,_0x4b7ef7['options']);switch(_0x10dbd9[_0x8c9b('0x34')]){case _0x8c9b('0x29'):return db[_[_0x8c9b('0xa3')](_0x4b7ef7[_0x8c9b('0x42')][_0x8c9b('0xb0')])+_0x8c9b('0xdb')]['findAll'](_0x528ccf);case _0x8c9b('0x7c'):case'agent':return _0x10dbd9['get'+_[_0x8c9b('0xa3')](_0x4b7ef7[_0x8c9b('0x42')]['channel'])+_0x8c9b('0xa4')](_0x528ccf);default:throw new db[(_0x8c9b('0x90'))][(_0x8c9b('0x91'))](_0x8c9b('0xdc'));}})[_0x8c9b('0x26')](function(_0x4ac1a2){_0x30c213=_0x4ac1a2[_0x8c9b('0x48')];if(!_0x4b7ef7['query'][_0x8c9b('0xd2')](_0x8c9b('0xd8'))){_0x528ccf[_0x8c9b('0x21')]=qs['limit'](_0x4b7ef7[_0x8c9b('0x42')]['limit']);_0x528ccf[_0x8c9b('0x20')]=qs[_0x8c9b('0x20')](_0x4b7ef7[_0x8c9b('0x42')][_0x8c9b('0x20')]);}switch(_0x10dbd9[_0x8c9b('0x34')]){case _0x8c9b('0x29'):return db[_['capitalize'](_0x4b7ef7['query'][_0x8c9b('0xb0')])+_0x8c9b('0xdb')][_0x8c9b('0x8b')](_0x528ccf);case _0x8c9b('0x7c'):case'agent':return _0x10dbd9[_0x8c9b('0x28')+_[_0x8c9b('0xa3')](_0x4b7ef7[_0x8c9b('0x42')][_0x8c9b('0xb0')])+_0x8c9b('0xa4')](_0x528ccf);}})[_0x8c9b('0x26')](function(_0x37f1e8){return{'count':_0x30c213,'rows':_0x37f1e8};})[_0x8c9b('0x26')](respondWithResult(_0x4f6e14,null))[_0x8c9b('0x1b')](handleError(_0x4f6e14,null));};exports[_0x8c9b('0xdd')]=function(_0x2bdfc9,_0x19b309){var _0x493cfd={};var _0x4df47c={};var _0x3f1d1a;var _0x4ba7bd;return db[_0x8c9b('0x3f')][_0x8c9b('0xcd')]({'where':{'id':_0x2bdfc9['params']['id']}})[_0x8c9b('0x26')](handleEntityNotFound(_0x19b309,null))[_0x8c9b('0x26')](function(_0x859763){if(_0x859763){_0x3f1d1a=_0x859763;_0x4df47c[_0x8c9b('0x56')]=_[_0x8c9b('0x54')](db[_0x8c9b('0xb4')][_0x8c9b('0x38')]);_0x4df47c['query']=_['keys'](_0x2bdfc9['query']);_0x4df47c[_0x8c9b('0x55')]=_[_0x8c9b('0xcf')](_0x4df47c[_0x8c9b('0x56')],_0x4df47c[_0x8c9b('0x42')]);_0x493cfd['attributes']=_[_0x8c9b('0xcf')](_0x4df47c['model'],qs['fields'](_0x2bdfc9[_0x8c9b('0x42')][_0x8c9b('0x57')]));_0x493cfd[_0x8c9b('0x46')]=_0x493cfd[_0x8c9b('0x46')][_0x8c9b('0x48')]?_0x493cfd['attributes']:_0x4df47c[_0x8c9b('0x56')];_0x493cfd[_0x8c9b('0xda')]=qs[_0x8c9b('0xd0')](_0x2bdfc9[_0x8c9b('0x42')][_0x8c9b('0xd0')]);_0x493cfd[_0x8c9b('0x3e')]=qs['filters'](_['pick'](_0x2bdfc9[_0x8c9b('0x42')],_0x4df47c[_0x8c9b('0x55')]));if(_0x2bdfc9[_0x8c9b('0x42')][_0x8c9b('0x2f')]){_0x493cfd['where']=_[_0x8c9b('0x58')](_0x493cfd['where'],{'$or':_[_0x8c9b('0x31')](_0x493cfd['attributes'],function(_0x5f10c9){var _0x46605={};_0x46605[_0x5f10c9]={'$like':'%'+_0x2bdfc9[_0x8c9b('0x42')][_0x8c9b('0x2f')]+'%'};return _0x46605;})});}_0x493cfd=_['merge']({},_0x493cfd,_0x2bdfc9['options']);return _0x3f1d1a[_0x8c9b('0xdd')](_0x493cfd);}})[_0x8c9b('0x26')](function(_0x257730){if(_0x257730){_0x4ba7bd=_0x257730[_0x8c9b('0x48')];if(!_0x2bdfc9[_0x8c9b('0x42')][_0x8c9b('0xd2')](_0x8c9b('0xd8'))){_0x493cfd[_0x8c9b('0x21')]=qs[_0x8c9b('0x21')](_0x2bdfc9[_0x8c9b('0x42')]['limit']);_0x493cfd[_0x8c9b('0x20')]=qs['offset'](_0x2bdfc9[_0x8c9b('0x42')][_0x8c9b('0x20')]);}return _0x3f1d1a[_0x8c9b('0xdd')](_0x493cfd);}})[_0x8c9b('0x26')](function(_0x649496){if(_0x649496){return _0x649496?{'count':_0x4ba7bd,'rows':_0x649496}:null;}})[_0x8c9b('0x26')](respondWithResult(_0x19b309,null))[_0x8c9b('0x1b')](handleError(_0x19b309,null));};exports[_0x8c9b('0xde')]=function(_0x2cc710,_0x274317){var _0x3a24f9={};var _0x1d3d24={};var _0x484371;var _0x4dcde0;return db['User'][_0x8c9b('0xcd')]({'where':{'id':_0x2cc710[_0x8c9b('0x5d')]['id']}})[_0x8c9b('0x26')](handleEntityNotFound(_0x274317,null))[_0x8c9b('0x26')](function(_0x3b1ace){if(_0x3b1ace){_0x484371=_0x3b1ace;_0x1d3d24[_0x8c9b('0x56')]=_[_0x8c9b('0x54')](db[_0x8c9b('0xdf')][_0x8c9b('0x38')]);_0x1d3d24['query']=_[_0x8c9b('0x54')](_0x2cc710['query']);_0x1d3d24[_0x8c9b('0x55')]=_[_0x8c9b('0xcf')](_0x1d3d24[_0x8c9b('0x56')],_0x1d3d24[_0x8c9b('0x42')]);_0x3a24f9[_0x8c9b('0x46')]=_[_0x8c9b('0xcf')](_0x1d3d24[_0x8c9b('0x56')],qs[_0x8c9b('0x57')](_0x2cc710[_0x8c9b('0x42')][_0x8c9b('0x57')]));_0x3a24f9[_0x8c9b('0x46')]=_0x3a24f9[_0x8c9b('0x46')]['length']?_0x3a24f9[_0x8c9b('0x46')]:_0x1d3d24[_0x8c9b('0x56')];_0x3a24f9[_0x8c9b('0xda')]=qs['sort'](_0x2cc710[_0x8c9b('0x42')][_0x8c9b('0xd0')]);_0x3a24f9['where']=qs['filters'](_[_0x8c9b('0xd1')](_0x2cc710[_0x8c9b('0x42')],_0x1d3d24['filters']));if(_0x2cc710['query'][_0x8c9b('0x2f')]){_0x3a24f9[_0x8c9b('0x3e')]=_[_0x8c9b('0x58')](_0x3a24f9[_0x8c9b('0x3e')],{'$or':_[_0x8c9b('0x31')](_0x3a24f9[_0x8c9b('0x46')],function(_0x5def78){var _0x31789f={};_0x31789f[_0x5def78]={'$like':'%'+_0x2cc710[_0x8c9b('0x42')]['filter']+'%'};return _0x31789f;})});}_0x3a24f9=_[_0x8c9b('0x58')]({},_0x3a24f9,_0x2cc710[_0x8c9b('0x59')]);return _0x484371['getGroups'](_0x3a24f9);}})['then'](function(_0x24aa05){if(_0x24aa05){_0x4dcde0=_0x24aa05[_0x8c9b('0x48')];if(!_0x2cc710[_0x8c9b('0x42')]['hasOwnProperty'](_0x8c9b('0xd8'))){_0x3a24f9[_0x8c9b('0x21')]=qs[_0x8c9b('0x21')](_0x2cc710[_0x8c9b('0x42')]['limit']);_0x3a24f9[_0x8c9b('0x20')]=qs[_0x8c9b('0x20')](_0x2cc710['query'][_0x8c9b('0x20')]);}return _0x484371[_0x8c9b('0xde')](_0x3a24f9);}})['then'](function(_0x5c77e9){if(_0x5c77e9){return _0x5c77e9?{'count':_0x4dcde0,'rows':_0x5c77e9}:null;}})[_0x8c9b('0x26')](respondWithResult(_0x274317,null))[_0x8c9b('0x1b')](handleError(_0x274317,null));};exports['getRecordings']=function(_0x31259c,_0x15124f){var _0x34f96d={'raw':!![],'where':{}};var _0xee7dfe={};var _0xe9d7f1={'count':0x0,'rows':[]};return db['User'][_0x8c9b('0xcd')]({'where':{'id':_0x31259c[_0x8c9b('0x5d')]['id']}})[_0x8c9b('0x26')](handleEntityNotFound(_0x15124f,null))['then'](function(_0x46dcf0){if(_0x46dcf0){_0xee7dfe[_0x8c9b('0x56')]=_[_0x8c9b('0x54')](db[_0x8c9b('0xe0')][_0x8c9b('0x38')]);_0xee7dfe[_0x8c9b('0x42')]=_[_0x8c9b('0x54')](_0x31259c['query']);_0xee7dfe[_0x8c9b('0x55')]=_[_0x8c9b('0xcf')](_0xee7dfe[_0x8c9b('0x56')],_0xee7dfe[_0x8c9b('0x42')]);_0x34f96d[_0x8c9b('0x46')]=_['intersection'](_0xee7dfe[_0x8c9b('0x56')],qs[_0x8c9b('0x57')](_0x31259c['query'][_0x8c9b('0x57')]));_0x34f96d[_0x8c9b('0x46')]=_0x34f96d[_0x8c9b('0x46')][_0x8c9b('0x48')]?_0x34f96d[_0x8c9b('0x46')]:_0xee7dfe['model'];if(!_0x31259c['query']['hasOwnProperty'](_0x8c9b('0xd8'))){_0x34f96d[_0x8c9b('0x21')]=qs['limit'](_0x31259c[_0x8c9b('0x42')][_0x8c9b('0x21')]);_0x34f96d[_0x8c9b('0x20')]=qs[_0x8c9b('0x20')](_0x31259c['query'][_0x8c9b('0x20')]);}_0x34f96d['order']=qs[_0x8c9b('0xd0')](_0x31259c[_0x8c9b('0x42')]['sort']);_0x34f96d[_0x8c9b('0x3e')]=qs[_0x8c9b('0x55')](_[_0x8c9b('0xd1')](_0x31259c[_0x8c9b('0x42')],_0xee7dfe[_0x8c9b('0x55')]));_0x34f96d['where']['UserId']=_0x46dcf0['id'];if(_0x31259c[_0x8c9b('0x42')]['filter']){_0x34f96d[_0x8c9b('0x3e')]=_[_0x8c9b('0x58')](_0x34f96d['where'],{'$or':_[_0x8c9b('0x31')](_0x34f96d['attributes'],function(_0x4b7958){var _0xebc18d={};_0xebc18d[_0x4b7958]={'$like':'%'+_0x31259c['query'][_0x8c9b('0x2f')]+'%'};return _0xebc18d;})});}_0x34f96d=_[_0x8c9b('0x58')]({},_0x34f96d,_0x31259c[_0x8c9b('0x59')]);return db[_0x8c9b('0xe0')][_0x8c9b('0x23')]({'where':_0x34f96d[_0x8c9b('0x3e')]})['then'](function(_0x3e105f){_0xe9d7f1[_0x8c9b('0x23')]=_0x3e105f;if(_0x31259c['query'][_0x8c9b('0x40')]){_0x34f96d[_0x8c9b('0x41')]=[{'all':!![]}];}return db[_0x8c9b('0xe0')]['findAll'](_0x34f96d);})[_0x8c9b('0x26')](function(_0x4b7a8e){_0xe9d7f1['rows']=_0x4b7a8e;return _0xe9d7f1;});}})[_0x8c9b('0x26')](respondWithFilteredResult(_0x15124f,_0x34f96d))[_0x8c9b('0x1b')](handleError(_0x15124f,null));};exports[_0x8c9b('0xe1')]=function(_0x10481d,_0x499328){var _0x4a1074={'raw':!![],'where':{}};var _0x3edb44={};var _0x344b19={'count':0x0,'rows':[]};return db['User'][_0x8c9b('0xcd')]({'where':{'id':_0x10481d[_0x8c9b('0x5d')]['id']}})[_0x8c9b('0x26')](handleEntityNotFound(_0x499328,null))[_0x8c9b('0x26')](function(_0xe85d61){if(_0xe85d61){_0x3edb44[_0x8c9b('0x56')]=_[_0x8c9b('0x54')](db[_0x8c9b('0xe2')][_0x8c9b('0x38')]);_0x3edb44[_0x8c9b('0x42')]=_[_0x8c9b('0x54')](_0x10481d[_0x8c9b('0x42')]);_0x3edb44['filters']=_[_0x8c9b('0xcf')](_0x3edb44['model'],_0x3edb44[_0x8c9b('0x42')]);_0x4a1074[_0x8c9b('0x46')]=_[_0x8c9b('0xcf')](_0x3edb44[_0x8c9b('0x56')],qs[_0x8c9b('0x57')](_0x10481d[_0x8c9b('0x42')][_0x8c9b('0x57')]));_0x4a1074[_0x8c9b('0x46')]=_0x4a1074[_0x8c9b('0x46')][_0x8c9b('0x48')]?_0x4a1074[_0x8c9b('0x46')]:_0x3edb44[_0x8c9b('0x56')];if(!_0x10481d[_0x8c9b('0x42')][_0x8c9b('0xd2')](_0x8c9b('0xd8'))){_0x4a1074[_0x8c9b('0x21')]=qs['limit'](_0x10481d[_0x8c9b('0x42')][_0x8c9b('0x21')]);_0x4a1074[_0x8c9b('0x20')]=qs[_0x8c9b('0x20')](_0x10481d[_0x8c9b('0x42')]['offset']);}_0x4a1074[_0x8c9b('0xda')]=qs[_0x8c9b('0xd0')](_0x10481d[_0x8c9b('0x42')]['sort']);_0x4a1074['where']=qs[_0x8c9b('0x55')](_[_0x8c9b('0xd1')](_0x10481d[_0x8c9b('0x42')],_0x3edb44[_0x8c9b('0x55')]));_0x4a1074[_0x8c9b('0x3e')][_0x8c9b('0xe3')]=_0xe85d61['id'];if(_0x10481d[_0x8c9b('0x42')][_0x8c9b('0x2f')]){_0x4a1074[_0x8c9b('0x3e')]=_[_0x8c9b('0x58')](_0x4a1074[_0x8c9b('0x3e')],{'$or':_['map'](_0x4a1074['attributes'],function(_0x377032){var _0x1ae086={};_0x1ae086[_0x377032]={'$like':'%'+_0x10481d[_0x8c9b('0x42')][_0x8c9b('0x2f')]+'%'};return _0x1ae086;})});}_0x4a1074=_['merge']({},_0x4a1074,_0x10481d['options']);return db[_0x8c9b('0xe2')][_0x8c9b('0x23')]({'where':_0x4a1074['where']})[_0x8c9b('0x26')](function(_0x46c487){_0x344b19[_0x8c9b('0x23')]=_0x46c487;if(_0x10481d[_0x8c9b('0x42')][_0x8c9b('0x40')]){_0x4a1074['include']=[{'all':!![]}];}return db[_0x8c9b('0xe2')][_0x8c9b('0x8b')](_0x4a1074);})[_0x8c9b('0x26')](function(_0x172bc3){_0x344b19['rows']=_0x172bc3;return _0x344b19;});}})[_0x8c9b('0x26')](respondWithFilteredResult(_0x499328,_0x4a1074))['catch'](handleError(_0x499328,null));};exports['getChatInteractions']=function(_0xb945ec,_0x53dc63){var _0x4525ae={};var _0x81ef58={};var _0x545680;var _0x96ae61;return db[_0x8c9b('0x3f')][_0x8c9b('0xcd')]({'where':{'id':_0xb945ec[_0x8c9b('0x5d')]['id']}})['then'](handleEntityNotFound(_0x53dc63,null))[_0x8c9b('0x26')](function(_0x3810c8){if(_0x3810c8){_0x545680=_0x3810c8;_0x81ef58[_0x8c9b('0x56')]=_[_0x8c9b('0x54')](db[_0x8c9b('0xe4')][_0x8c9b('0x38')]);_0x81ef58[_0x8c9b('0x42')]=_['keys'](_0xb945ec[_0x8c9b('0x42')]);_0x81ef58[_0x8c9b('0x55')]=_[_0x8c9b('0xcf')](_0x81ef58[_0x8c9b('0x56')],_0x81ef58[_0x8c9b('0x42')]);_0x4525ae[_0x8c9b('0x46')]=_['intersection'](_0x81ef58[_0x8c9b('0x56')],qs['fields'](_0xb945ec[_0x8c9b('0x42')][_0x8c9b('0x57')]));_0x4525ae[_0x8c9b('0x46')]=_0x4525ae[_0x8c9b('0x46')][_0x8c9b('0x48')]?_0x4525ae['attributes']:_0x81ef58[_0x8c9b('0x56')];_0x4525ae[_0x8c9b('0xda')]=qs[_0x8c9b('0xd0')](_0xb945ec[_0x8c9b('0x42')][_0x8c9b('0xd0')]);_0x4525ae[_0x8c9b('0x3e')]=qs[_0x8c9b('0x55')](_[_0x8c9b('0xd1')](_0xb945ec[_0x8c9b('0x42')],_0x81ef58[_0x8c9b('0x55')]));if(_0xb945ec[_0x8c9b('0x42')][_0x8c9b('0x2f')]){_0x4525ae[_0x8c9b('0x3e')]=_[_0x8c9b('0x58')](_0x4525ae[_0x8c9b('0x3e')],{'$or':_[_0x8c9b('0x31')](_0x4525ae['attributes'],function(_0x2380e1){var _0x30b4a9={};_0x30b4a9[_0x2380e1]={'$like':'%'+_0xb945ec['query'][_0x8c9b('0x2f')]+'%'};return _0x30b4a9;})});}_0x4525ae=_[_0x8c9b('0x58')]({},_0x4525ae,_0xb945ec[_0x8c9b('0x59')]);return _0x545680[_0x8c9b('0xe5')](_0x4525ae);}})[_0x8c9b('0x26')](function(_0x314102){if(_0x314102){_0x96ae61=_0x314102['length'];if(!_0xb945ec['query'][_0x8c9b('0xd2')](_0x8c9b('0xd8'))){_0x4525ae[_0x8c9b('0x21')]=qs['limit'](_0xb945ec[_0x8c9b('0x42')][_0x8c9b('0x21')]);_0x4525ae[_0x8c9b('0x20')]=qs[_0x8c9b('0x20')](_0xb945ec['query'][_0x8c9b('0x20')]);}return _0x545680['getChatInteractions'](_0x4525ae);}})[_0x8c9b('0x26')](function(_0x4eb817){if(_0x4eb817){return _0x4eb817?{'count':_0x96ae61,'rows':_0x4eb817}:null;}})[_0x8c9b('0x26')](respondWithResult(_0x53dc63,null))[_0x8c9b('0x1b')](handleError(_0x53dc63,null));};exports['getOpenchannelInteractions']=function(_0x4624cf,_0x30c970){var _0x17454b={};var _0x17eb95={};var _0x219dbc;var _0xcb915c;return db['User'][_0x8c9b('0xcd')]({'where':{'id':_0x4624cf[_0x8c9b('0x5d')]['id']}})[_0x8c9b('0x26')](handleEntityNotFound(_0x30c970,null))[_0x8c9b('0x26')](function(_0x1e449f){if(_0x1e449f){_0x219dbc=_0x1e449f;_0x17eb95['model']=_[_0x8c9b('0x54')](db['OpenchannelInteraction'][_0x8c9b('0x38')]);_0x17eb95['query']=_[_0x8c9b('0x54')](_0x4624cf[_0x8c9b('0x42')]);_0x17eb95['filters']=_[_0x8c9b('0xcf')](_0x17eb95[_0x8c9b('0x56')],_0x17eb95[_0x8c9b('0x42')]);_0x17454b[_0x8c9b('0x46')]=_[_0x8c9b('0xcf')](_0x17eb95[_0x8c9b('0x56')],qs[_0x8c9b('0x57')](_0x4624cf[_0x8c9b('0x42')][_0x8c9b('0x57')]));_0x17454b[_0x8c9b('0x46')]=_0x17454b[_0x8c9b('0x46')]['length']?_0x17454b[_0x8c9b('0x46')]:_0x17eb95[_0x8c9b('0x56')];_0x17454b[_0x8c9b('0xda')]=qs['sort'](_0x4624cf[_0x8c9b('0x42')]['sort']);_0x17454b[_0x8c9b('0x3e')]=qs['filters'](_[_0x8c9b('0xd1')](_0x4624cf['query'],_0x17eb95[_0x8c9b('0x55')]));if(_0x4624cf[_0x8c9b('0x42')][_0x8c9b('0x2f')]){_0x17454b[_0x8c9b('0x3e')]=_[_0x8c9b('0x58')](_0x17454b['where'],{'$or':_[_0x8c9b('0x31')](_0x17454b['attributes'],function(_0x3ea1f6){var _0x4b93fe={};_0x4b93fe[_0x3ea1f6]={'$like':'%'+_0x4624cf[_0x8c9b('0x42')][_0x8c9b('0x2f')]+'%'};return _0x4b93fe;})});}_0x17454b=_[_0x8c9b('0x58')]({},_0x17454b,_0x4624cf['options']);return _0x219dbc[_0x8c9b('0xe6')](_0x17454b);}})[_0x8c9b('0x26')](function(_0x37d1c7){if(_0x37d1c7){_0xcb915c=_0x37d1c7[_0x8c9b('0x48')];if(!_0x4624cf[_0x8c9b('0x42')][_0x8c9b('0xd2')]('nolimit')){_0x17454b['limit']=qs[_0x8c9b('0x21')](_0x4624cf[_0x8c9b('0x42')]['limit']);_0x17454b[_0x8c9b('0x20')]=qs[_0x8c9b('0x20')](_0x4624cf[_0x8c9b('0x42')][_0x8c9b('0x20')]);}return _0x219dbc[_0x8c9b('0xe6')](_0x17454b);}})[_0x8c9b('0x26')](function(_0xb11199){if(_0xb11199){return _0xb11199?{'count':_0xcb915c,'rows':_0xb11199}:null;}})['then'](respondWithResult(_0x30c970,null))[_0x8c9b('0x1b')](handleError(_0x30c970,null));};exports[_0x8c9b('0xe7')]=function(_0x57ef9b,_0x3b58c0){var _0x2b08c9={'raw':!![],'where':{}};var _0x1b1baa={};var _0x4d94dc={'count':0x0,'rows':[]};return db[_0x8c9b('0x3f')][_0x8c9b('0xcd')]({'where':{'id':_0x57ef9b[_0x8c9b('0x5d')]['id']}})[_0x8c9b('0x26')](handleEntityNotFound(_0x3b58c0,null))['then'](function(_0x45f25e){if(_0x45f25e){_0x1b1baa[_0x8c9b('0x56')]=_['keys'](db[_0x8c9b('0xe8')][_0x8c9b('0x38')]);_0x1b1baa[_0x8c9b('0x42')]=_['keys'](_0x57ef9b['query']);_0x1b1baa[_0x8c9b('0x55')]=_[_0x8c9b('0xcf')](_0x1b1baa[_0x8c9b('0x56')],_0x1b1baa[_0x8c9b('0x42')]);_0x2b08c9[_0x8c9b('0x46')]=_[_0x8c9b('0xcf')](_0x1b1baa[_0x8c9b('0x56')],qs[_0x8c9b('0x57')](_0x57ef9b[_0x8c9b('0x42')][_0x8c9b('0x57')]));_0x2b08c9['attributes']=_0x2b08c9['attributes'][_0x8c9b('0x48')]?_0x2b08c9['attributes']:_0x1b1baa['model'];if(!_0x57ef9b['query'][_0x8c9b('0xd2')](_0x8c9b('0xd8'))){_0x2b08c9[_0x8c9b('0x21')]=qs[_0x8c9b('0x21')](_0x57ef9b[_0x8c9b('0x42')][_0x8c9b('0x21')]);_0x2b08c9[_0x8c9b('0x20')]=qs[_0x8c9b('0x20')](_0x57ef9b[_0x8c9b('0x42')]['offset']);}_0x2b08c9[_0x8c9b('0xda')]=qs['sort'](_0x57ef9b[_0x8c9b('0x42')]['sort']);_0x2b08c9[_0x8c9b('0x3e')]=qs[_0x8c9b('0x55')](_[_0x8c9b('0xd1')](_0x57ef9b[_0x8c9b('0x42')],_0x1b1baa[_0x8c9b('0x55')]));_0x2b08c9[_0x8c9b('0x3e')][_0x8c9b('0xe3')]=_0x45f25e['id'];if(_0x57ef9b[_0x8c9b('0x42')][_0x8c9b('0x2f')]){_0x2b08c9[_0x8c9b('0x3e')]=_[_0x8c9b('0x58')](_0x2b08c9['where'],{'$or':_[_0x8c9b('0x31')](_0x2b08c9[_0x8c9b('0x46')],function(_0x5c0dde){var _0x57b504={};_0x57b504[_0x5c0dde]={'$like':'%'+_0x57ef9b[_0x8c9b('0x42')][_0x8c9b('0x2f')]+'%'};return _0x57b504;})});}_0x2b08c9=_[_0x8c9b('0x58')]({},_0x2b08c9,_0x57ef9b[_0x8c9b('0x59')]);return db[_0x8c9b('0xe8')][_0x8c9b('0x23')]({'where':_0x2b08c9[_0x8c9b('0x3e')]})['then'](function(_0x2b467c){_0x4d94dc[_0x8c9b('0x23')]=_0x2b467c;if(_0x57ef9b[_0x8c9b('0x42')][_0x8c9b('0x40')]){_0x2b08c9[_0x8c9b('0x41')]=[{'all':!![]}];}return db['MailInteraction'][_0x8c9b('0x8b')](_0x2b08c9);})[_0x8c9b('0x26')](function(_0x299903){_0x4d94dc['rows']=_0x299903;return _0x4d94dc;});}})[_0x8c9b('0x26')](respondWithFilteredResult(_0x3b58c0,_0x2b08c9))['catch'](handleError(_0x3b58c0,null));};exports[_0x8c9b('0xe9')]=function(_0x4080b9,_0x23f0c9){var _0x47e5df={};var _0x18889b={};var _0x4d8f93;var _0x17fbac;return db['User'][_0x8c9b('0xcd')]({'where':{'id':_0x4080b9[_0x8c9b('0x5d')]['id']}})['then'](handleEntityNotFound(_0x23f0c9,null))[_0x8c9b('0x26')](function(_0x1315b2){if(_0x1315b2){_0x4d8f93=_0x1315b2;_0x18889b[_0x8c9b('0x56')]=_[_0x8c9b('0x54')](db[_0x8c9b('0xea')][_0x8c9b('0x38')]);_0x18889b[_0x8c9b('0x42')]=_[_0x8c9b('0x54')](_0x4080b9[_0x8c9b('0x42')]);_0x18889b['filters']=_[_0x8c9b('0xcf')](_0x18889b['model'],_0x18889b[_0x8c9b('0x42')]);_0x47e5df[_0x8c9b('0x46')]=_['intersection'](_0x18889b['model'],qs[_0x8c9b('0x57')](_0x4080b9[_0x8c9b('0x42')][_0x8c9b('0x57')]));_0x47e5df[_0x8c9b('0x46')]=_0x47e5df[_0x8c9b('0x46')][_0x8c9b('0x48')]?_0x47e5df[_0x8c9b('0x46')]:_0x18889b[_0x8c9b('0x56')];_0x47e5df[_0x8c9b('0xda')]=qs[_0x8c9b('0xd0')](_0x4080b9[_0x8c9b('0x42')][_0x8c9b('0xd0')]);_0x47e5df['where']=qs[_0x8c9b('0x55')](_[_0x8c9b('0xd1')](_0x4080b9[_0x8c9b('0x42')],_0x18889b['filters']));if(_0x4080b9['query'][_0x8c9b('0x2f')]){_0x47e5df['where']=_[_0x8c9b('0x58')](_0x47e5df['where'],{'$or':_[_0x8c9b('0x31')](_0x47e5df[_0x8c9b('0x46')],function(_0x3af6a7){var _0x1955c1={};_0x1955c1[_0x3af6a7]={'$like':'%'+_0x4080b9[_0x8c9b('0x42')]['filter']+'%'};return _0x1955c1;})});}_0x47e5df=_['merge']({},_0x47e5df,_0x4080b9[_0x8c9b('0x59')]);return _0x4d8f93['getSmsInteractions'](_0x47e5df);}})[_0x8c9b('0x26')](function(_0x5d8095){if(_0x5d8095){_0x17fbac=_0x5d8095[_0x8c9b('0x48')];if(!_0x4080b9[_0x8c9b('0x42')]['hasOwnProperty'](_0x8c9b('0xd8'))){_0x47e5df[_0x8c9b('0x21')]=qs[_0x8c9b('0x21')](_0x4080b9['query']['limit']);_0x47e5df['offset']=qs[_0x8c9b('0x20')](_0x4080b9['query']['offset']);}return _0x4d8f93['getSmsInteractions'](_0x47e5df);}})['then'](function(_0x55691e){if(_0x55691e){return _0x55691e?{'count':_0x17fbac,'rows':_0x55691e}:null;}})[_0x8c9b('0x26')](respondWithResult(_0x23f0c9,null))[_0x8c9b('0x1b')](handleError(_0x23f0c9,null));};exports['getFaxInteractions']=function(_0x24697d,_0x28d95d){var _0x3be974={};var _0x32fb34={};var _0x53a3b2;var _0x658412;return db['User'][_0x8c9b('0xcd')]({'where':{'id':_0x24697d['params']['id']}})[_0x8c9b('0x26')](handleEntityNotFound(_0x28d95d,null))[_0x8c9b('0x26')](function(_0x93f4c9){if(_0x93f4c9){_0x53a3b2=_0x93f4c9;_0x32fb34[_0x8c9b('0x56')]=_[_0x8c9b('0x54')](db[_0x8c9b('0xeb')]['rawAttributes']);_0x32fb34['query']=_[_0x8c9b('0x54')](_0x24697d[_0x8c9b('0x42')]);_0x32fb34[_0x8c9b('0x55')]=_[_0x8c9b('0xcf')](_0x32fb34[_0x8c9b('0x56')],_0x32fb34[_0x8c9b('0x42')]);_0x3be974[_0x8c9b('0x46')]=_[_0x8c9b('0xcf')](_0x32fb34[_0x8c9b('0x56')],qs[_0x8c9b('0x57')](_0x24697d[_0x8c9b('0x42')][_0x8c9b('0x57')]));_0x3be974['attributes']=_0x3be974[_0x8c9b('0x46')][_0x8c9b('0x48')]?_0x3be974[_0x8c9b('0x46')]:_0x32fb34[_0x8c9b('0x56')];_0x3be974[_0x8c9b('0xda')]=qs[_0x8c9b('0xd0')](_0x24697d['query'][_0x8c9b('0xd0')]);_0x3be974[_0x8c9b('0x3e')]=qs[_0x8c9b('0x55')](_[_0x8c9b('0xd1')](_0x24697d[_0x8c9b('0x42')],_0x32fb34[_0x8c9b('0x55')]));if(_0x24697d[_0x8c9b('0x42')]['filter']){_0x3be974[_0x8c9b('0x3e')]=_[_0x8c9b('0x58')](_0x3be974[_0x8c9b('0x3e')],{'$or':_[_0x8c9b('0x31')](_0x3be974[_0x8c9b('0x46')],function(_0x4194b8){var _0x49975a={};_0x49975a[_0x4194b8]={'$like':'%'+_0x24697d[_0x8c9b('0x42')]['filter']+'%'};return _0x49975a;})});}_0x3be974=_[_0x8c9b('0x58')]({},_0x3be974,_0x24697d[_0x8c9b('0x59')]);return _0x53a3b2[_0x8c9b('0xec')](_0x3be974);}})['then'](function(_0xdc6e07){if(_0xdc6e07){_0x658412=_0xdc6e07['length'];if(!_0x24697d[_0x8c9b('0x42')][_0x8c9b('0xd2')]('nolimit')){_0x3be974['limit']=qs[_0x8c9b('0x21')](_0x24697d[_0x8c9b('0x42')][_0x8c9b('0x21')]);_0x3be974[_0x8c9b('0x20')]=qs['offset'](_0x24697d[_0x8c9b('0x42')][_0x8c9b('0x20')]);}return _0x53a3b2[_0x8c9b('0xec')](_0x3be974);}})['then'](function(_0x306284){if(_0x306284){return _0x306284?{'count':_0x658412,'rows':_0x306284}:null;}})[_0x8c9b('0x26')](respondWithResult(_0x28d95d,null))[_0x8c9b('0x1b')](handleError(_0x28d95d,null));};exports['getWhatsappInteractions']=function(_0x5b38f0,_0x5e709b){var _0x5c9d5b={};var _0x4aa090={};var _0x74aa31;var _0x154b44;return db[_0x8c9b('0x3f')][_0x8c9b('0xcd')]({'where':{'id':_0x5b38f0[_0x8c9b('0x5d')]['id']}})[_0x8c9b('0x26')](handleEntityNotFound(_0x5e709b,null))[_0x8c9b('0x26')](function(_0x5ee733){if(_0x5ee733){_0x74aa31=_0x5ee733;_0x4aa090[_0x8c9b('0x56')]=_[_0x8c9b('0x54')](db['WhatsappInteraction']['rawAttributes']);_0x4aa090[_0x8c9b('0x42')]=_[_0x8c9b('0x54')](_0x5b38f0['query']);_0x4aa090['filters']=_['intersection'](_0x4aa090[_0x8c9b('0x56')],_0x4aa090['query']);_0x5c9d5b[_0x8c9b('0x46')]=_[_0x8c9b('0xcf')](_0x4aa090[_0x8c9b('0x56')],qs[_0x8c9b('0x57')](_0x5b38f0[_0x8c9b('0x42')][_0x8c9b('0x57')]));_0x5c9d5b['attributes']=_0x5c9d5b[_0x8c9b('0x46')][_0x8c9b('0x48')]?_0x5c9d5b[_0x8c9b('0x46')]:_0x4aa090[_0x8c9b('0x56')];_0x5c9d5b[_0x8c9b('0xda')]=qs[_0x8c9b('0xd0')](_0x5b38f0[_0x8c9b('0x42')][_0x8c9b('0xd0')]);_0x5c9d5b[_0x8c9b('0x3e')]=qs[_0x8c9b('0x55')](_['pick'](_0x5b38f0[_0x8c9b('0x42')],_0x4aa090['filters']));if(_0x5b38f0[_0x8c9b('0x42')][_0x8c9b('0x2f')]){_0x5c9d5b['where']=_[_0x8c9b('0x58')](_0x5c9d5b[_0x8c9b('0x3e')],{'$or':_[_0x8c9b('0x31')](_0x5c9d5b[_0x8c9b('0x46')],function(_0x31567a){var _0x501b53={};_0x501b53[_0x31567a]={'$like':'%'+_0x5b38f0[_0x8c9b('0x42')][_0x8c9b('0x2f')]+'%'};return _0x501b53;})});}_0x5c9d5b=_[_0x8c9b('0x58')]({},_0x5c9d5b,_0x5b38f0['options']);return _0x74aa31['getWhatsappInteractions'](_0x5c9d5b);}})[_0x8c9b('0x26')](function(_0x167961){if(_0x167961){_0x154b44=_0x167961[_0x8c9b('0x48')];if(!_0x5b38f0[_0x8c9b('0x42')]['hasOwnProperty'](_0x8c9b('0xd8'))){_0x5c9d5b['limit']=qs[_0x8c9b('0x21')](_0x5b38f0['query']['limit']);_0x5c9d5b['offset']=qs[_0x8c9b('0x20')](_0x5b38f0['query'][_0x8c9b('0x20')]);}return _0x74aa31['getWhatsappInteractions'](_0x5c9d5b);}})[_0x8c9b('0x26')](function(_0x47b61a){if(_0x47b61a){return _0x47b61a?{'count':_0x154b44,'rows':_0x47b61a}:null;}})[_0x8c9b('0x26')](respondWithResult(_0x5e709b,null))[_0x8c9b('0x1b')](handleError(_0x5e709b,null));};exports[_0x8c9b('0xed')]=function(_0xd4da79,_0x5495ca,_0x4da757){var _0x1f91a1;var _0x4c46d6;var _0x5b7d96;var _0x2efa20=!_[_0x8c9b('0x67')](_0xd4da79[_0x8c9b('0x5d')]['id'])?_0xd4da79[_0x8c9b('0x5d')]['id']:!_['isNil'](_0xd4da79['user']['id'])?_0xd4da79[_0x8c9b('0x7c')]['id']:null;return db[_0x8c9b('0x3f')]['find']({'where':{'id':_0x2efa20,'role':{'$or':[_0x8c9b('0x29'),'user',_0x8c9b('0x2c')]}},'attributes':['id',_0x8c9b('0x3c'),_0x8c9b('0xee'),_0x8c9b('0xef'),_0x8c9b('0x34'),_0x8c9b('0x62'),_0x8c9b('0x9e')]})[_0x8c9b('0x26')](function(_0x3bd397){if(_0x3bd397){if(_0x3bd397[_0x8c9b('0x34')]===_0x8c9b('0x2c')){_0x1f91a1=_0x3bd397;if(_0xd4da79['body'][_0x8c9b('0xad')]){_0x5b7d96=util[_0x8c9b('0xac')](_0x8c9b('0xf0'),_0x1f91a1[_0xd4da79[_0x8c9b('0x5c')][_0x8c9b('0xad')]]);}else if(_0xd4da79[_0x8c9b('0x5c')][_0x8c9b('0xf1')]){_0x5b7d96=util[_0x8c9b('0xac')](_0x8c9b('0xf2'),_0xd4da79[_0x8c9b('0x5c')][_0x8c9b('0xf1')]);}else{_0x5b7d96=util[_0x8c9b('0xac')]('SIP/%s',_0x1f91a1[_0x8c9b('0x3c')]);}socket['to'](util[_0x8c9b('0xac')](_0x8c9b('0xf3'),_0x1f91a1[_0x8c9b('0x3c')]))[_0x8c9b('0x27')](_0x8c9b('0xf4'),{'user':{'id':_0x1f91a1['id'],'name':_0x1f91a1[_0x8c9b('0x3c')]},'ip':_0xd4da79[_0x8c9b('0xf5')][_0x8c9b('0xf6')]||_0xd4da79[_0x8c9b('0xf7')]['remoteAddress']||_0xd4da79[_0x8c9b('0xf8')][_0x8c9b('0xf9')]||_0xd4da79[_0x8c9b('0xf7')][_0x8c9b('0xf8')]['remoteAddress']});return db[_0x8c9b('0xb4')]['destroy']({'where':{'membername':_0x1f91a1[_0x8c9b('0x3c')]},'individualHooks':!![]});}}else{throw new db[(_0x8c9b('0x90'))]['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x8c9b('0x26')](function(){if(_0x1f91a1){return _0x1f91a1[_0x8c9b('0xfa')]({'raw':!![]});}})[_0x8c9b('0x26')](function(_0x14ceee){if(_0x1f91a1){var _0xc79078=[];if(_0x14ceee){_0x4c46d6=_0x14ceee;if(_0x4c46d6[_0x8c9b('0x48')]){for(var _0x14798f=0x0;_0x14798f<_0x4c46d6[_0x8c9b('0x48')];_0x14798f++){_0xc79078['push']({'membername':_0x1f91a1['name'],'UserId':_0x1f91a1['id'],'queue_name':_0x4c46d6[_0x14798f]['name'],'VoiceQueueId':_0x4c46d6[_0x14798f]['id'],'interface':_0x5b7d96,'paused':_0x1f91a1[_0x8c9b('0x9e')]||![],'penalty':_0x4c46d6[_0x14798f][_0x8c9b('0xfb')]||0x0});}return BPromise['each'](_0xc79078,function(_0x64a1d4){return db[_0x8c9b('0xb4')][_0x8c9b('0xae')](_0x64a1d4);});}}}})['then'](function(){if(_0x1f91a1){return db[_0x8c9b('0xfc')][_0x8c9b('0x8b')]({'where':{'membername':_0x1f91a1[_0x8c9b('0x3c')],'exitAt':null}});}})[_0x8c9b('0x26')](function(_0xe4d74f){if(_0x1f91a1){var _0x534b7f=[];_0xe4d74f[_0x8c9b('0xfd')](function(_0x577e0d){_0x534b7f[_0x8c9b('0x49')](_0x577e0d[_0x8c9b('0x5b')]({'exitAt':moment()[_0x8c9b('0xac')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x8c9b('0x5a')](_0x534b7f);}})[_0x8c9b('0x26')](function(){if(_0x1f91a1){var _0x554597=[];var _0x546318=[];var _0x3975d9=utils[_0x8c9b('0xfe')]();var _0x519339={'membername':_0x1f91a1[_0x8c9b('0x3c')],'interface':_0x5b7d96,'enterAt':moment()[_0x8c9b('0xac')](_0x8c9b('0xff')),'role':_0x1f91a1[_0x8c9b('0x34')],'internal':_0x1f91a1[_0x8c9b('0x62')]};_0x3975d9[_0x8c9b('0xfd')](function(_0x20c8c2){_0x554597[_0x8c9b('0x49')](_[_0x8c9b('0x58')]({'channel':_0x20c8c2,'type':_0x8c9b('0x100'),'data1':_0xd4da79[_0x8c9b('0x5c')][_0x8c9b('0x101')],'data2':_0x5b7d96},_0x519339));if(_0x1f91a1['loginInPause']){_0x546318[_0x8c9b('0x49')](_['merge']({'channel':_0x20c8c2,'type':_0x8c9b('0x102'),'data1':_0x8c9b('0x103')},_0x519339));}});return db[_0x8c9b('0xfc')][_0x8c9b('0x84')](_0x554597[_0x8c9b('0xcb')](_0x546318),{'individualHooks':!![]});}})['then'](function(){if(_0x1f91a1){return _0x1f91a1['update']({'online':!![],'lastLoginAt':moment()[_0x8c9b('0xac')](_0x8c9b('0xff')),'voicePause':_0x1f91a1[_0x8c9b('0x9e')]||![],'mailPause':_0x1f91a1[_0x8c9b('0x9e')]||![],'chatPause':_0x1f91a1[_0x8c9b('0x9e')]||![],'faxPause':_0x1f91a1[_0x8c9b('0x9e')]||![],'smsPause':_0x1f91a1[_0x8c9b('0x9e')]||![],'openchannelPause':_0x1f91a1[_0x8c9b('0x9e')]||![],'whatsappPause':_0x1f91a1[_0x8c9b('0x9e')]||![],'pauseType':_0x1f91a1[_0x8c9b('0x9e')]?'LOGININPAUSE':null,'interface':_0x5b7d96,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x8c9b('0x26')](function(_0x3f6ff1){if(_0xd4da79[_0x8c9b('0x104')]){return _0x4da757();}else{return BPromise[_0x8c9b('0x105')](_0x3f6ff1)['then'](respondWithResult(_0x5495ca,null));}})[_0x8c9b('0x1b')](handleError(_0x5495ca,null));};exports[_0x8c9b('0x106')]=function(_0x2015c2,_0x552e99){var _0x219570;return db[_0x8c9b('0x3f')][_0x8c9b('0x33')]({'where':{'id':_0x2015c2[_0x8c9b('0x5d')]['id'],'role':_0x8c9b('0x2c')},'attributes':['id',_0x8c9b('0x3c'),_0x8c9b('0x34')]})['then'](handleEntityNotFound(_0x552e99,null))['then'](function(_0x50d194){if(_0x50d194){_0x219570=_0x50d194;return db[_0x8c9b('0xb4')]['destroy']({'where':{'membername':_0x219570[_0x8c9b('0x3c')]},'individualHooks':!![]});}})[_0x8c9b('0x26')](function(){return db['MemberReport'][_0x8c9b('0x8b')]({'where':{'membername':_0x219570['name'],'exitAt':null}});})[_0x8c9b('0x26')](function(_0x3f0336){var _0xfa7fdf=[];_0x3f0336[_0x8c9b('0xfd')](function(_0x1bbebf){_0xfa7fdf[_0x8c9b('0x49')](_0x1bbebf[_0x8c9b('0x5b')]({'exitAt':moment()[_0x8c9b('0xac')](_0x8c9b('0xff'))}));});return BPromise[_0x8c9b('0x5a')](_0xfa7fdf);})['then'](function(){return _0x219570[_0x8c9b('0x5b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x8c9b('0x26')](respondWithResult(_0x552e99,null))[_0x8c9b('0x1b')](handleError(_0x552e99,null));};exports[_0x8c9b('0x107')]=function(_0x442ff7,_0x56d96a){var _0xccdf95;return db[_0x8c9b('0xb4')][_0x8c9b('0x5b')]({'paused':0x1},{'where':{'UserId':_0x442ff7[_0x8c9b('0x5d')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x8c9b('0x3f')][_0x8c9b('0x33')]({'where':{'id':_0x442ff7['params']['id'],'role':_0x8c9b('0x2c')},'attributes':['id',_0x8c9b('0x3c'),_0x8c9b('0x34'),_0x8c9b('0x62'),'interface']});})[_0x8c9b('0x26')](handleEntityNotFound(_0x56d96a,null))[_0x8c9b('0x26')](function(_0x23262c){if(_0x23262c){_0xccdf95=_0x23262c;return respondWithRpcPromise(_0x8c9b('0x108'),_0x8c9b('0x107'),{'id':_0xccdf95['id'],'name':_0xccdf95[_0x8c9b('0x3c')],'pause':!![]});}})[_0x8c9b('0x26')](function(){if(_0xccdf95){return db[_0x8c9b('0xfc')][_0x8c9b('0x8b')]({'where':{'membername':_0xccdf95[_0x8c9b('0x3c')],'type':'PAUSE','exitAt':null}});}})[_0x8c9b('0x26')](function(_0x140526){if(_0x140526['length']){var _0x2bd3b7=moment()[_0x8c9b('0xac')](_0x8c9b('0xff'));for(var _0x3fd1f2=0x0,_0x184505=_0x140526[_0x8c9b('0x48')];_0x3fd1f2<_0x184505;_0x3fd1f2++){_0x140526[_0x3fd1f2]['updateAttributes']({'exitAt':_0x2bd3b7});}}})[_0x8c9b('0x26')](function(){var _0x5c7e78=[];var _0x3fe2a6=utils[_0x8c9b('0xfe')]();_0x3fe2a6[_0x8c9b('0xfd')](function(_0x56933d){_0x5c7e78[_0x8c9b('0x49')]({'channel':_0x56933d,'membername':_0xccdf95[_0x8c9b('0x3c')],'interface':_[_0x8c9b('0x67')](_0xccdf95['interface'])?util[_0x8c9b('0xac')](_0x8c9b('0xf2'),_0xccdf95[_0x8c9b('0x3c')]):_0xccdf95['interface'],'type':'PAUSE','enterAt':moment()[_0x8c9b('0xac')](_0x8c9b('0xff')),'data1':_0x442ff7['body'][_0x8c9b('0x109')]||_0x8c9b('0x10a'),'role':_0xccdf95['role'],'internal':_0xccdf95[_0x8c9b('0x62')]});});return db[_0x8c9b('0xfc')]['bulkCreate'](_0x5c7e78,{'individualHooks':!![]});})[_0x8c9b('0x26')](function(){return _0xccdf95[_0x8c9b('0x5b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x442ff7['body'][_0x8c9b('0x109')]||_0x8c9b('0x10a'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x8c9b('0x26')](respondWithResult(_0x56d96a,null))[_0x8c9b('0x1b')](handleError(_0x56d96a,null));};exports[_0x8c9b('0x10b')]=function(_0x1b7d66,_0x478a1c){var _0x26e976;return db[_0x8c9b('0x3f')][_0x8c9b('0x33')]({'where':{'id':_0x1b7d66[_0x8c9b('0x5d')]['id']},'attributes':['id',_0x8c9b('0x3c'),_0x8c9b('0x34'),_0x8c9b('0x9f'),_0x8c9b('0x10c'),'chatPause',_0x8c9b('0x10d'),_0x8c9b('0x10e'),_0x8c9b('0x10f'),_0x8c9b('0x110'),_0x8c9b('0x111'),_0x8c9b('0x112')]})[_0x8c9b('0x26')](handleEntityNotFound(_0x478a1c,null))['then'](function(_0x1670f5){if(_0x1670f5){_0x26e976=_0x1670f5;if(_0x1b7d66[_0x8c9b('0x5c')][_0x8c9b('0xb0')]&&!utils[_0x8c9b('0xa0')](_0x1b7d66[_0x8c9b('0x5c')][_0x8c9b('0xb0')])){throw new db[(_0x8c9b('0x90'))][(_0x8c9b('0x91'))]('Unknown\x20channel');}switch(_0x1b7d66[_0x8c9b('0x5c')][_0x8c9b('0xb0')]){case _0x8c9b('0xaa'):return respondWithRpcPromise(_0x8c9b('0x108'),'unpause',{'id':_0x26e976['id'],'name':_0x26e976['name'],'pause':![]})[_0x8c9b('0x26')](function(){return db[_0x8c9b('0xb4')][_0x8c9b('0x5b')]({'paused':0x0},{'where':{'UserId':_0x26e976['id']},'individualHooks':!![]});})[_0x8c9b('0x26')](function(){return db[_0x8c9b('0xfc')][_0x8c9b('0x33')]({'where':{'channel':_0x1b7d66[_0x8c9b('0x5c')][_0x8c9b('0xb0')],'membername':_0x26e976['name'],'type':'PAUSE','exitAt':null}});})[_0x8c9b('0x26')](function(_0x26795d){if(_0x26795d){return _0x26795d['update']({'exitAt':moment()[_0x8c9b('0xac')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x8c9b('0x26')](function(){return _0x26e976[_0x8c9b('0x5b')]({'voicePause':![]});});case _0x8c9b('0x4f'):case'chat':case'fax':case'sms':case _0x8c9b('0x51'):case _0x8c9b('0x50'):return db['MemberReport'][_0x8c9b('0x33')]({'where':{'channel':_0x1b7d66[_0x8c9b('0x5c')][_0x8c9b('0xb0')],'membername':_0x26e976[_0x8c9b('0x3c')],'type':_0x8c9b('0x102'),'exitAt':null}})['then'](function(_0xb08837){if(_0xb08837){return _0xb08837[_0x8c9b('0x5b')]({'exitAt':moment()[_0x8c9b('0xac')](_0x8c9b('0xff')),'data2':_0x8c9b('0x113')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x441caa={};_[_0x8c9b('0x24')](_0x441caa,util[_0x8c9b('0xac')]('%s%s',_0x1b7d66[_0x8c9b('0x5c')]['channel'],_0x8c9b('0x114')),![]);return _0x26e976['update'](_0x441caa);});default:return respondWithRpcPromise(_0x8c9b('0x108'),_0x8c9b('0x10b'),{'id':_0x26e976['id'],'name':_0x26e976[_0x8c9b('0x3c')],'pause':![]})[_0x8c9b('0x26')](function(){return db[_0x8c9b('0xb4')][_0x8c9b('0x5b')]({'paused':0x0},{'where':{'UserId':_0x26e976['id']}});})['then'](function(){return db[_0x8c9b('0xfc')][_0x8c9b('0x8b')]({'where':{'membername':_0x26e976[_0x8c9b('0x3c')],'type':_0x8c9b('0x102'),'exitAt':null}});})['then'](function(_0x3cf781){var _0x5bf421=[];_0x3cf781[_0x8c9b('0xfd')](function(_0xffc277){_0x5bf421[_0x8c9b('0x49')](_0xffc277[_0x8c9b('0x5b')]({'exitAt':moment()[_0x8c9b('0xac')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x8c9b('0x113')}));});return BPromise[_0x8c9b('0x5a')](_0x5bf421);})[_0x8c9b('0x26')](function(){return _0x26e976['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x8c9b('0x26')](respondWithResult(_0x478a1c,null))['catch'](handleError(_0x478a1c,null));};exports[_0x8c9b('0x115')]=function(_0xd5d64d,_0x1d8866){var _0x10c05c={};var _0x59b851={};var _0x141f03;var _0x1f48b0;return db['User'][_0x8c9b('0xcd')]({'where':{'id':_0xd5d64d['params']['id']}})[_0x8c9b('0x26')](handleEntityNotFound(_0x1d8866,null))[_0x8c9b('0x26')](function(_0x4e0071){if(_0x4e0071){_0x141f03=_0x4e0071;_0x59b851[_0x8c9b('0x56')]=_[_0x8c9b('0x54')](db['Team'][_0x8c9b('0x38')]);_0x59b851[_0x8c9b('0x42')]=_[_0x8c9b('0x54')](_0xd5d64d[_0x8c9b('0x42')]);_0x59b851[_0x8c9b('0x55')]=_[_0x8c9b('0xcf')](_0x59b851[_0x8c9b('0x56')],_0x59b851[_0x8c9b('0x42')]);_0x10c05c[_0x8c9b('0x46')]=_[_0x8c9b('0xcf')](_0x59b851[_0x8c9b('0x56')],qs['fields'](_0xd5d64d[_0x8c9b('0x42')][_0x8c9b('0x57')]));_0x10c05c[_0x8c9b('0x46')]=_0x10c05c[_0x8c9b('0x46')][_0x8c9b('0x48')]?_0x10c05c[_0x8c9b('0x46')]:_0x59b851['model'];_0x10c05c['order']=qs['sort'](_0xd5d64d[_0x8c9b('0x42')]['sort']);_0x10c05c[_0x8c9b('0x3e')]=qs[_0x8c9b('0x55')](_[_0x8c9b('0xd1')](_0xd5d64d[_0x8c9b('0x42')],_0x59b851[_0x8c9b('0x55')]));if(_0xd5d64d[_0x8c9b('0x42')][_0x8c9b('0x2f')]){_0x10c05c[_0x8c9b('0x3e')]=_['merge'](_0x10c05c['where'],{'$or':_['map'](_0x10c05c[_0x8c9b('0x46')],function(_0x18a83a){var _0x4d4b7c={};_0x4d4b7c[_0x18a83a]={'$like':'%'+_0xd5d64d[_0x8c9b('0x42')][_0x8c9b('0x2f')]+'%'};return _0x4d4b7c;})});}_0x10c05c=_[_0x8c9b('0x58')]({},_0x10c05c,_0xd5d64d[_0x8c9b('0x59')]);return _0x141f03[_0x8c9b('0x115')](_0x10c05c);}})[_0x8c9b('0x26')](function(_0x21e7d4){if(_0x21e7d4){_0x1f48b0=_0x21e7d4[_0x8c9b('0x48')];if(!_0xd5d64d[_0x8c9b('0x42')][_0x8c9b('0xd2')]('nolimit')){_0x10c05c[_0x8c9b('0x21')]=qs[_0x8c9b('0x21')](_0xd5d64d[_0x8c9b('0x42')][_0x8c9b('0x21')]);_0x10c05c[_0x8c9b('0x20')]=qs['offset'](_0xd5d64d[_0x8c9b('0x42')][_0x8c9b('0x20')]);}return _0x141f03[_0x8c9b('0x115')](_0x10c05c);}})[_0x8c9b('0x26')](function(_0x5aabab){if(_0x5aabab){return _0x5aabab?{'count':_0x1f48b0,'rows':_0x5aabab}:null;}})[_0x8c9b('0x26')](respondWithResult(_0x1d8866,null))['catch'](handleError(_0x1d8866,null));};exports[_0x8c9b('0x116')]=function(_0x9621ab,_0x134bbd){var _0x5b37cc=_0x9621ab[_0x8c9b('0x5d')]['id'];var _0x12623e=_0x9621ab[_0x8c9b('0x5c')]?_0x9621ab['body'][_0x8c9b('0x60')]:null;var _0x5e69b3=[];return Promise[_0x8c9b('0x105')]()[_0x8c9b('0x26')](function(){if(!_0x12623e)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x8c9b('0x26')](function(){return db[_0x8c9b('0x3f')][_0x8c9b('0xcd')]({'where':{'id':_0x5b37cc}});})[_0x8c9b('0x26')](function(_0x54ae4d){if(!_0x54ae4d)throw new APINotFoundError(util[_0x8c9b('0xac')](_0x8c9b('0x117'),_0x9621ab[_0x8c9b('0x5d')]['id']));return db[_0x8c9b('0x69')]['transaction'](function(_0x3351a2){return _0x54ae4d[_0x8c9b('0x116')](_0x12623e,{'transaction':_0x3351a2})[_0x8c9b('0x26')](function(){return db[_0x8c9b('0x118')]['findAll']({'where':{'id':{'$in':_0x12623e}}});})[_0x8c9b('0x26')](function(_0x56c0cd){var _0xa825f=_[_0x8c9b('0x31')](_0x56c0cd,function(_0x1b3cc7){return _0x1b3cc7['getAssociatedQueues']();});return Promise[_0x8c9b('0x5a')](_0xa825f);})[_0x8c9b('0x26')](function(_0x343725){_0x5e69b3=_[_0x8c9b('0x119')](_0x343725);var _0x3ad7f2=_['map'](_0x5e69b3,function(_0x1254d1){return _0x1254d1['addAgent'](_0x54ae4d['id'],{'transaction':_0x3351a2});});return Promise[_0x8c9b('0x5a')](_0x3ad7f2);})['then'](function(){if(!_0x54ae4d['online'])return;var _0x49e101=_[_0x8c9b('0x2f')](_0x5e69b3,function(_0xe2e81f){return _0xe2e81f[_0x8c9b('0x11a')](_0x8c9b('0xb0'))===_0x8c9b('0x11b');});var _0x4a5e01=_[_0x8c9b('0x31')](_0x49e101,function(_0x239183){return db[_0x8c9b('0xb4')]['upsert']({'membername':_0x54ae4d[_0x8c9b('0x3c')],'UserId':_0x54ae4d['id'],'queue_name':_0x239183[_0x8c9b('0x3c')],'VoiceQueueId':_0x239183['id'],'interface':_[_0x8c9b('0x67')](_0x54ae4d[_0x8c9b('0xad')])?util[_0x8c9b('0xac')](_0x8c9b('0xf2'),_0x54ae4d['name']):_0x54ae4d[_0x8c9b('0xad')],'paused':_0x54ae4d[_0x8c9b('0x9f')]||![],'penalty':_0x54ae4d[_0x8c9b('0xa5')]},{'transaction':_0x3351a2});});return Promise[_0x8c9b('0x5a')](_0x4a5e01);})[_0x8c9b('0x26')](function(){return db[_0x8c9b('0x11c')][_0x8c9b('0x8b')]({'where':{'teamId':{'$in':_0x12623e}}});})[_0x8c9b('0x26')](function(_0x1e5b56){var _0x5e02c2=_[_0x8c9b('0x31')](_0x1e5b56,function(_0x36cf2b){return db[_0x8c9b('0x11d')]['create']({'UserId':_0x54ae4d['id'],'VoicePrefixId':_0x36cf2b[_0x8c9b('0x11e')]},{'transaction':_0x3351a2});});return Promise[_0x8c9b('0x5a')](_0x5e02c2);});});})[_0x8c9b('0x26')](function(){for(var _0x35b461=0x0;_0x35b461<_0x5e69b3['length'];_0x35b461++){var _0x1798a3=_0x5e69b3[_0x35b461][_0x8c9b('0x11a')](_0x8c9b('0xb0'));var _0x4b1116=_0x1798a3+_0x8c9b('0xa8');socket[_0x8c9b('0x27')]('user'+_0x1798a3+_0x8c9b('0xa9'),{'UserId':_0x5b37cc,['queueField']:_0x5e69b3[_0x35b461]['id']});}})[_0x8c9b('0x26')](respondWithStatusCode(_0x134bbd,null))[_0x8c9b('0x1b')](APIHandleError(_0x134bbd));};exports[_0x8c9b('0x11f')]=function(_0x3dbfbd,_0x351f17){var _0x418324=_0x3dbfbd[_0x8c9b('0x5d')]['id'];var _0x3d43f8=null;if(_0x3dbfbd[_0x8c9b('0x42')]['ids']){_0x3d43f8=_[_0x8c9b('0xb2')](_0x3dbfbd[_0x8c9b('0x42')][_0x8c9b('0x60')])?_0x3dbfbd['query'][_0x8c9b('0x60')]:[_0x3dbfbd[_0x8c9b('0x42')][_0x8c9b('0x60')]];}var _0x1a2f99=[];return Promise[_0x8c9b('0x105')]()[_0x8c9b('0x26')](function(){if(!_0x3d43f8)throw new APIBadRequestError(_0x8c9b('0x120'));})[_0x8c9b('0x26')](function(){return db[_0x8c9b('0x3f')]['findOne']({'where':{'id':_0x418324}});})[_0x8c9b('0x26')](function(_0x3959a5){if(!_0x3959a5)throw new APINotFoundError(util['format'](_0x8c9b('0x117'),_0x3dbfbd[_0x8c9b('0x5d')]['id']));return db[_0x8c9b('0x69')]['transaction'](function(_0x33104b){return _0x3959a5[_0x8c9b('0x11f')](_0x3d43f8,{'transaction':_0x33104b})['then'](function(){return db['Team'][_0x8c9b('0x8b')]({'where':{'id':{'$in':_0x3d43f8}}});})['then'](function(_0x59af65){var _0x5e8579=_[_0x8c9b('0x31')](_0x59af65,function(_0x4e7962){return _0x4e7962[_0x8c9b('0x121')]();});return Promise['all'](_0x5e8579);})[_0x8c9b('0x26')](function(_0x3d2d98){_0x1a2f99=_['flattenDeep'](_0x3d2d98);var _0xed3d53=_[_0x8c9b('0x31')](_0x1a2f99,function(_0x21f2a5){return _0x21f2a5[_0x8c9b('0x122')](_0x3959a5['id'],{'transaction':_0x33104b});});return Promise[_0x8c9b('0x5a')](_0xed3d53);})['then'](function(){if(!_0x3959a5[_0x8c9b('0x9d')])return;var _0x46db77=_[_0x8c9b('0x2f')](_0x1a2f99,function(_0x5ce7c5){return _0x5ce7c5[_0x8c9b('0x11a')](_0x8c9b('0xb0'))==='Voice';});var _0x3b78a3=_[_0x8c9b('0x31')](_0x46db77,function(_0xf64cc8){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0xf64cc8['id'],'UserId':_0x3959a5['id']},'transaction':_0x33104b});});return Promise[_0x8c9b('0x5a')](_0x3b78a3);})['then'](function(){return db[_0x8c9b('0x11c')][_0x8c9b('0x8b')]({'where':{'teamId':{'$in':_0x3d43f8}}});})['then'](function(_0x22683c){var _0x829920=_['map'](_0x22683c,function(_0x4328ef){return db[_0x8c9b('0x11d')][_0x8c9b('0xb5')]({'where':{'UserId':_0x3959a5['id'],'VoicePrefixId':_0x4328ef[_0x8c9b('0x11e')]}},{'transaction':_0x33104b});});return Promise['all'](_0x829920);});});})['then'](function(){for(var _0x1c3e81=0x0;_0x1c3e81<_0x1a2f99[_0x8c9b('0x48')];_0x1c3e81++){var _0x862b6c=_0x1a2f99[_0x1c3e81][_0x8c9b('0x11a')](_0x8c9b('0xb0'));var _0x407dd2=_0x862b6c+_0x8c9b('0xa8');socket['emit']('user'+_0x862b6c+_0x8c9b('0xb3'),{'UserId':_0x418324,['queueField']:_0x1a2f99[_0x1c3e81]['id']});}})[_0x8c9b('0x26')](respondWithStatusCode(_0x351f17,null))['catch'](APIHandleError(_0x351f17));};exports['getLists']=function(_0x1f2b17,_0x5012ad){var _0x9dcc5b={};var _0x105388={};var _0x5b0b49;var _0x18859d;return db[_0x8c9b('0x3f')][_0x8c9b('0xcd')]({'where':{'id':_0x1f2b17[_0x8c9b('0x5d')]['id']}})[_0x8c9b('0x26')](handleEntityNotFound(_0x5012ad,null))['then'](function(_0xb040b0){if(_0xb040b0){_0x5b0b49=_0xb040b0;_0x105388[_0x8c9b('0x56')]=_[_0x8c9b('0x54')](db[_0x8c9b('0xd3')]['rawAttributes']);_0x105388[_0x8c9b('0x42')]=_['keys'](_0x1f2b17[_0x8c9b('0x42')]);_0x105388[_0x8c9b('0x55')]=_[_0x8c9b('0xcf')](_0x105388['model'],_0x105388[_0x8c9b('0x42')]);_0x9dcc5b[_0x8c9b('0x46')]=_[_0x8c9b('0xcf')](_0x105388[_0x8c9b('0x56')],qs[_0x8c9b('0x57')](_0x1f2b17['query']['fields']));_0x9dcc5b['attributes']=_0x9dcc5b[_0x8c9b('0x46')][_0x8c9b('0x48')]?_0x9dcc5b[_0x8c9b('0x46')]:_0x105388[_0x8c9b('0x56')];_0x9dcc5b[_0x8c9b('0xda')]=qs[_0x8c9b('0xd0')](_0x1f2b17[_0x8c9b('0x42')][_0x8c9b('0xd0')]);_0x9dcc5b['where']=qs['filters'](_[_0x8c9b('0xd1')](_0x1f2b17[_0x8c9b('0x42')],_0x105388[_0x8c9b('0x55')]));if(_0x1f2b17['query'][_0x8c9b('0x2f')]){_0x9dcc5b['where']=_[_0x8c9b('0x58')](_0x9dcc5b[_0x8c9b('0x3e')],{'$or':_[_0x8c9b('0x31')](_0x9dcc5b['attributes'],function(_0x368f65){var _0x2a94ce={};_0x2a94ce[_0x368f65]={'$like':'%'+_0x1f2b17[_0x8c9b('0x42')][_0x8c9b('0x2f')]+'%'};return _0x2a94ce;})});}_0x9dcc5b=_['merge']({},_0x9dcc5b,_0x1f2b17['options']);return _0x5b0b49[_0x8c9b('0x123')](_0x9dcc5b);}})[_0x8c9b('0x26')](function(_0x2f54c9){if(_0x2f54c9){_0x18859d=_0x2f54c9[_0x8c9b('0x48')];if(!_0x1f2b17['query'][_0x8c9b('0xd2')](_0x8c9b('0xd8'))){_0x9dcc5b[_0x8c9b('0x21')]=qs['limit'](_0x1f2b17['query'][_0x8c9b('0x21')]);_0x9dcc5b[_0x8c9b('0x20')]=qs['offset'](_0x1f2b17[_0x8c9b('0x42')][_0x8c9b('0x20')]);}return _0x5b0b49[_0x8c9b('0x123')](_0x9dcc5b);}})['then'](function(_0x45b083){if(_0x45b083){return _0x45b083?{'count':_0x18859d,'rows':_0x45b083}:null;}})['then'](respondWithResult(_0x5012ad,null))[_0x8c9b('0x1b')](handleError(_0x5012ad,null));};exports[_0x8c9b('0x124')]=function(_0x7fbc14,_0xc3e163){var _0x34378b={};var _0x6451de={};var _0x523c5f;return db['User'][_0x8c9b('0xcd')]({'where':{'id':_0x7fbc14[_0x8c9b('0x5d')]['id']}})[_0x8c9b('0x26')](handleEntityNotFound(_0xc3e163,null))[_0x8c9b('0x26')](function(_0x210dbe){if(_0x210dbe){_0x523c5f=_0x210dbe;_0x6451de[_0x8c9b('0x56')]=_['keys'](db['User'][_0x8c9b('0x38')]);_0x6451de[_0x8c9b('0x42')]=_[_0x8c9b('0x54')](_0x7fbc14[_0x8c9b('0x42')]);_0x6451de[_0x8c9b('0x55')]=_[_0x8c9b('0xcf')](_0x6451de[_0x8c9b('0x56')],_0x6451de['query']);_0x34378b['attributes']=_['intersection'](_0x6451de[_0x8c9b('0x56')],qs[_0x8c9b('0x57')](_0x7fbc14['query'][_0x8c9b('0x57')]));_0x34378b[_0x8c9b('0x46')]=_0x34378b[_0x8c9b('0x46')][_0x8c9b('0x48')]?_0x34378b[_0x8c9b('0x46')]:_0x6451de[_0x8c9b('0x56')];_0x34378b[_0x8c9b('0xda')]=qs[_0x8c9b('0xd0')](_0x7fbc14[_0x8c9b('0x42')][_0x8c9b('0xd0')]);_0x34378b['where']=qs[_0x8c9b('0x55')](_[_0x8c9b('0xd1')](_0x7fbc14[_0x8c9b('0x42')],_0x6451de[_0x8c9b('0x55')]));if(_0x7fbc14['query'][_0x8c9b('0x2f')]){_0x34378b[_0x8c9b('0x3e')]=_[_0x8c9b('0x58')](_0x34378b[_0x8c9b('0x3e')],{'$or':_[_0x8c9b('0x31')](_0x34378b[_0x8c9b('0x46')],function(_0xbb1c71){var _0x3048ea={};_0x3048ea[_0xbb1c71]={'$like':'%'+_0x7fbc14['query'][_0x8c9b('0x2f')]+'%'};return _0x3048ea;})});}_0x34378b[_0x8c9b('0x56')]=db['User'];_0x34378b['as']=_0x8c9b('0x2b');_0x34378b=_[_0x8c9b('0x58')]({},_0x34378b,_0x7fbc14['options']);return _0x523c5f[_0x8c9b('0xfa')]({'include':[_0x34378b]});}})[_0x8c9b('0x26')](function(_0x59d3d4){if(_0x59d3d4){var _0x238f6a={},_0x3e1387=[];for(var _0x1dc866=0x0;_0x1dc866<_0x59d3d4['length'];_0x1dc866+=0x1){for(var _0x1b8eda=0x0,_0xc659e2;_0x1b8eda<_0x59d3d4[_0x1dc866][_0x8c9b('0x2b')][_0x8c9b('0x48')];_0x1b8eda+=0x1){_0xc659e2=_0x59d3d4[_0x1dc866][_0x8c9b('0x2b')][_0x1b8eda][_0x8c9b('0x28')]({'plain':!![]});_0x238f6a[_0xc659e2['id']]=_0xc659e2;}}_0x238f6a=_[_0x8c9b('0x125')](_0x238f6a);for(var _0x2d8f0d=qs[_0x8c9b('0x20')](_0x7fbc14['query']['offset']);_0x2d8f0d<_0x238f6a[_0x8c9b('0x48')]&&_0x3e1387['length']=_0x1cea77[_0xa992('0x56')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xa992('0x21')](function(){if(_0x4974f1){return db[_0xa992('0x2c')]['destroy']({'where':{'membername':_0x4974f1[_0xa992('0x28')]},'individualHooks':!![]});}})[_0xa992('0x21')](function(){if(_0x4974f1){return _0x4974f1[_0xa992('0x57')]({'raw':!![]});}})['then'](function(_0x1622a7){if(_0x4974f1){if(_0x1622a7){var _0x2c36d7=[];_0x4ceb4d=_0x1622a7;if(_0x4ceb4d['length']){for(var _0x2a123b=0x0;_0x2a123b<_0x4ceb4d[_0xa992('0x32')];_0x2a123b++){_0x2c36d7[_0xa992('0x35')](db['UserVoiceQueueRt']['upsert']({'membername':_0x4974f1['name'],'UserId':_0x4974f1['id'],'queue_name':_0x4ceb4d[_0x2a123b][_0xa992('0x28')],'VoiceQueueId':_0x4ceb4d[_0x2a123b]['id'],'interface':_0x355299,'paused':_0x4974f1[_0xa992('0x51')]||![],'penalty':_0x4ceb4d[_0x2a123b]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x2c36d7);}}}})['then'](function(){if(_0x4974f1){return db[_0xa992('0x2e')][_0xa992('0x4a')]({'where':{'membername':_0x4974f1[_0xa992('0x28')],'exitAt':null}});}})[_0xa992('0x21')](function(_0xf385c){if(_0x4974f1){if(_0xf385c&&_0xf385c[_0xa992('0x32')]){var _0x4a6ced=[];_0xf385c[_0xa992('0x34')](function(_0x4e6d17){_0x4a6ced[_0xa992('0x35')](_0x4e6d17['update']({'exitAt':moment()[_0xa992('0x30')](_0xa992('0x31'))}));});return BPromise[_0xa992('0x4b')](_0x4a6ced);}}})[_0xa992('0x21')](function(_0x5c84ce){if(_0x4974f1){var _0x43f4e5=[];var _0x24eb50=[];var _0x470721=utils[_0xa992('0x58')]();var _0x1c30b0={'membername':_0x4974f1[_0xa992('0x28')],'interface':_0x355299,'enterAt':moment()['format'](_0xa992('0x31')),'role':_0x4974f1['role'],'internal':_0x4974f1[_0xa992('0x2a')]};_0x470721['forEach'](function(_0x55a728){_0x43f4e5[_0xa992('0x35')](_['merge']({'channel':_0x55a728,'type':_0xa992('0x59'),'data1':_0xa992('0x5a'),'data2':_0x355299},_0x1c30b0));if(_0x4974f1[_0xa992('0x51')]){_0x24eb50[_0xa992('0x35')](_[_0xa992('0x5b')]({'channel':_0x55a728,'type':_0xa992('0x2f'),'data1':_0xa992('0x5c')},_0x1c30b0));}});return db[_0xa992('0x2e')][_0xa992('0x3c')](_0x43f4e5[_0xa992('0x5d')](_0x24eb50),{'individualHooks':!![]});}})[_0xa992('0x21')](function(){if(_0x4974f1){return _0x4974f1[_0xa992('0x2d')]({'online':!![],'lastLoginAt':moment()[_0xa992('0x30')](_0xa992('0x31')),'voicePause':_0x4974f1[_0xa992('0x51')]||![],'mailPause':_0x4974f1['loginInPause']||![],'chatPause':_0x4974f1['loginInPause']||![],'faxPause':_0x4974f1[_0xa992('0x51')]||![],'smsPause':_0x4974f1[_0xa992('0x51')]||![],'openchannelPause':_0x4974f1['loginInPause']||![],'pauseType':_0x4974f1[_0xa992('0x51')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xa992('0x30')](_0xa992('0x31')),'interface':_0x355299});}})[_0xa992('0x21')](function(_0x7d3f6){_0x4e3626(_0x7d3f6);})[_0xa992('0x18')](function(_0x27fd53){_0x1a716f(_0x2892a7[_0xa992('0x13')](0x1f4,_0x27fd53[_0xa992('0x15')]));});});}; \ No newline at end of file +var _0x5435=['findAll','options','raw','attributes','include','map','model','ShowUser','User','where','PauseUser','find','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','bulkCreate','UnpauseUser','channel','Unknown\x20channel','voice','system','mail','chat','sms','%s%s','all','LogoutUser','destroy','push','LoginUser','findOne','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','LOGIN','merge','LOGININPAUSE','concat','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetUser'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x5435,0x141));var _0x5543=function(_0x569489,_0x3d6c6f){_0x569489=_0x569489-0x0;var _0x5e28dc=_0x5435[_0x569489];return _0x5e28dc;};'use strict';var _=require(_0x5543('0x0'));var util=require('util');var moment=require(_0x5543('0x1'));var BPromise=require('bluebird');var rs=require(_0x5543('0x2'));var fs=require('fs');var Redis=require(_0x5543('0x3'));var db=require(_0x5543('0x4'))['db'];var utils=require(_0x5543('0x5'));var logger=require('../../config/logger')(_0x5543('0x6'));var config=require(_0x5543('0x7'));var jayson=require(_0x5543('0x8'));var client=jayson[_0x5543('0x9')]['http']({'port':0x232a});config[_0x5543('0xa')]=_[_0x5543('0xb')](config[_0x5543('0xa')],{'host':_0x5543('0xc'),'port':0x18eb});var socket=require(_0x5543('0xd'))(new Redis(config[_0x5543('0xa')]));require('./user.socket')[_0x5543('0xe')](socket);function respondWithRpcPromise(_0x251b1b,_0x1274d1,_0x4c1126){return new BPromise(function(_0x379bf7,_0x34f0d0){return client[_0x5543('0xf')](_0x251b1b,_0x4c1126)[_0x5543('0x10')](function(_0x20a8b0){logger[_0x5543('0x11')](_0x5543('0x12'),_0x1274d1,_0x5543('0x13'));logger[_0x5543('0x14')](_0x5543('0x15'),_0x1274d1,_0x5543('0x13'),JSON[_0x5543('0x16')](_0x20a8b0));if(_0x20a8b0['error']){if(_0x20a8b0['error']['code']===0x1f4){logger['error'](_0x5543('0x12'),_0x1274d1,_0x20a8b0[_0x5543('0x17')][_0x5543('0x18')]);return _0x34f0d0(_0x20a8b0[_0x5543('0x17')][_0x5543('0x18')]);}logger[_0x5543('0x17')]('User,\x20%s,\x20%s',_0x1274d1,_0x20a8b0[_0x5543('0x17')][_0x5543('0x18')]);return _0x379bf7(_0x20a8b0[_0x5543('0x17')]['message']);}else{logger['info'](_0x5543('0x12'),_0x1274d1,_0x5543('0x13'));_0x379bf7(_0x20a8b0['result'][_0x5543('0x18')]);}})[_0x5543('0x19')](function(_0x3b70a4){logger[_0x5543('0x17')](_0x5543('0x12'),_0x1274d1,_0x3b70a4);_0x34f0d0(_0x3b70a4);});});}exports[_0x5543('0x1a')]=function(_0x52ca27){var _0x3eb627=this;return new Promise(function(_0x1aab60,_0x324112){return db['User'][_0x5543('0x1b')]({'raw':_0x52ca27[_0x5543('0x1c')]?_0x52ca27[_0x5543('0x1c')][_0x5543('0x1d')]===undefined?!![]:![]:!![],'where':_0x52ca27['options']?_0x52ca27[_0x5543('0x1c')]['where']||null:null,'attributes':_0x52ca27[_0x5543('0x1c')]?_0x52ca27['options'][_0x5543('0x1e')]||null:null,'limit':_0x52ca27[_0x5543('0x1c')]?_0x52ca27[_0x5543('0x1c')]['limit']||null:null,'include':_0x52ca27[_0x5543('0x1c')]?_0x52ca27[_0x5543('0x1c')][_0x5543('0x1f')]?_[_0x5543('0x20')](_0x52ca27[_0x5543('0x1c')][_0x5543('0x1f')],function(_0x3abc4a){return{'model':db[_0x3abc4a[_0x5543('0x21')]],'as':_0x3abc4a['as'],'attributes':_0x3abc4a['attributes'],'include':_0x3abc4a[_0x5543('0x1f')]?_[_0x5543('0x20')](_0x3abc4a[_0x5543('0x1f')],function(_0x4adb45){return{'model':db[_0x4adb45[_0x5543('0x21')]],'as':_0x4adb45['as'],'attributes':_0x4adb45[_0x5543('0x1e')],'include':_0x4adb45[_0x5543('0x1f')]?_[_0x5543('0x20')](_0x4adb45[_0x5543('0x1f')],function(_0x1f4993){return{'model':db[_0x1f4993[_0x5543('0x21')]],'as':_0x1f4993['as'],'attributes':_0x1f4993[_0x5543('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5543('0x10')](function(_0x216789){logger[_0x5543('0x11')]('GetUser',_0x52ca27);logger[_0x5543('0x14')]('GetUser',_0x52ca27,JSON[_0x5543('0x16')](_0x216789));_0x1aab60(_0x216789);})[_0x5543('0x19')](function(_0xc3c645){logger[_0x5543('0x17')](_0x5543('0x1a'),_0xc3c645[_0x5543('0x18')],_0x52ca27);_0x324112(_0x3eb627['error'](0x1f4,_0xc3c645[_0x5543('0x18')]));});});};exports[_0x5543('0x22')]=function(_0x203ab7){var _0x8e4c2f=this;return new Promise(function(_0x1602e0,_0x12bb30){return db[_0x5543('0x23')]['find']({'raw':_0x203ab7[_0x5543('0x1c')]?_0x203ab7['options'][_0x5543('0x1d')]===undefined?!![]:![]:!![],'where':_0x203ab7['options']?_0x203ab7[_0x5543('0x1c')][_0x5543('0x24')]||null:null,'attributes':_0x203ab7['options']?_0x203ab7[_0x5543('0x1c')][_0x5543('0x1e')]||null:null,'include':_0x203ab7[_0x5543('0x1c')]?_0x203ab7[_0x5543('0x1c')][_0x5543('0x1f')]?_[_0x5543('0x20')](_0x203ab7[_0x5543('0x1c')]['include'],function(_0x271015){return{'model':db[_0x271015[_0x5543('0x21')]],'as':_0x271015['as'],'attributes':_0x271015[_0x5543('0x1e')],'include':_0x271015[_0x5543('0x1f')]?_[_0x5543('0x20')](_0x271015[_0x5543('0x1f')],function(_0x3872cd){return{'model':db[_0x3872cd[_0x5543('0x21')]],'as':_0x3872cd['as'],'attributes':_0x3872cd[_0x5543('0x1e')],'include':_0x3872cd[_0x5543('0x1f')]?_[_0x5543('0x20')](_0x3872cd[_0x5543('0x1f')],function(_0x41cc6f){return{'model':db[_0x41cc6f['model']],'as':_0x41cc6f['as'],'attributes':_0x41cc6f[_0x5543('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5543('0x10')](function(_0x28af7c){logger[_0x5543('0x11')]('ShowUser',_0x203ab7);logger[_0x5543('0x14')](_0x5543('0x22'),_0x203ab7,JSON['stringify'](_0x28af7c));_0x1602e0(_0x28af7c);})[_0x5543('0x19')](function(_0x16aa71){logger[_0x5543('0x17')](_0x5543('0x22'),_0x16aa71[_0x5543('0x18')],_0x203ab7);_0x12bb30(_0x8e4c2f[_0x5543('0x17')](0x1f4,_0x16aa71['message']));});});};exports[_0x5543('0x25')]=function(_0x3df1d0){var _0x4a6d99=this;return new Promise(function(_0x4c2add,_0x844930){var _0x3106dc;return db[_0x5543('0x23')][_0x5543('0x26')]({'where':_0x3df1d0['options'][_0x5543('0x24')]||{},'attributes':['id',_0x5543('0x27'),_0x5543('0x28'),_0x5543('0x29'),_0x5543('0x2a')]})[_0x5543('0x10')](function(_0x296135){if(_0x296135){_0x3106dc=_0x296135;return db[_0x5543('0x2b')][_0x5543('0x2c')]({'paused':0x1},{'where':{'UserId':_0x3106dc['id']},'individualHooks':!![]});}})[_0x5543('0x10')](function(){if(_0x3106dc){return db[_0x5543('0x2d')][_0x5543('0x1b')]({'where':{'membername':_0x3106dc[_0x5543('0x27')],'type':_0x5543('0x2e'),'exitAt':null}});}})[_0x5543('0x10')](function(_0x2e727b){if(_0x3106dc){if(_0x2e727b&&_0x2e727b[_0x5543('0x2f')]){var _0x2e8e43=moment()[_0x5543('0x30')](_0x5543('0x31'));for(var _0x1b98b7=0x0,_0xc2f9a9=_0x2e727b[_0x5543('0x2f')];_0x1b98b7<_0xc2f9a9;_0x1b98b7++){_0x2e727b[_0x1b98b7][_0x5543('0x32')]({'exitAt':_0x2e8e43});}}}})[_0x5543('0x10')](function(){if(_0x3106dc){var _0x41015c=[];var _0x107141=utils[_0x5543('0x33')]();_0x107141[_0x5543('0x34')](function(_0x1e34d5){_0x41015c['push']({'channel':_0x1e34d5,'membername':_0x3106dc[_0x5543('0x27')],'interface':_[_0x5543('0x35')](_0x3106dc['interface'])?util[_0x5543('0x30')](_0x5543('0x36'),_0x3106dc[_0x5543('0x27')]):_0x3106dc['interface'],'type':_0x5543('0x2e'),'enterAt':moment()[_0x5543('0x30')](_0x5543('0x31')),'data1':_0x3df1d0[_0x5543('0x37')][_0x5543('0x38')]||_0x5543('0x39'),'role':_0x3106dc[_0x5543('0x28')],'internal':_0x3106dc[_0x5543('0x29')],'uniqueid':_0x3df1d0[_0x5543('0x37')]['uniqueid']||null});});return db[_0x5543('0x2d')][_0x5543('0x3a')](_0x41015c,{'individualHooks':!![]});}})[_0x5543('0x10')](function(){if(_0x3106dc){return _0x3106dc['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3df1d0[_0x5543('0x37')][_0x5543('0x38')]||_0x5543('0x39'),'lastPauseAt':moment()[_0x5543('0x30')](_0x5543('0x31'))});}})['then'](function(_0x356bbb){_0x4c2add(_0x356bbb);})['catch'](function(_0x49472a){_0x844930(_0x4a6d99['error'](0x1f4,_0x49472a[_0x5543('0x18')]));});});};exports[_0x5543('0x3b')]=function(_0x2ed02b){var _0x25579a=this;return new Promise(function(_0x1e595b,_0x5db9db){var _0xab489e;return db[_0x5543('0x23')]['findOne']({'where':_0x2ed02b[_0x5543('0x1c')][_0x5543('0x24')]||{},'attributes':['id',_0x5543('0x27')]})[_0x5543('0x10')](function(_0x65f981){if(_0x65f981){_0xab489e=_0x65f981;if(_0x2ed02b[_0x5543('0x37')][_0x5543('0x3c')]&&!utils['isValidChannel'](_0x2ed02b[_0x5543('0x37')]['channel'])){throw new Error(_0x5543('0x3d'));}switch(_0x2ed02b[_0x5543('0x37')][_0x5543('0x3c')]){case _0x5543('0x3e'):return db[_0x5543('0x2b')][_0x5543('0x2c')]({'paused':0x0},{'where':{'UserId':_0xab489e['id']}})[_0x5543('0x10')](function(){return db[_0x5543('0x2d')][_0x5543('0x26')]({'where':{'channel':_0x2ed02b[_0x5543('0x37')][_0x5543('0x3c')],'membername':_0xab489e[_0x5543('0x27')],'type':_0x5543('0x2e'),'exitAt':null}});})[_0x5543('0x10')](function(_0x1dc576){if(_0x1dc576){return _0x1dc576['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x5543('0x3f')},{'individualHooks':!![]});}return null;})[_0x5543('0x10')](function(){return _0xab489e[_0x5543('0x2c')]({'voicePause':![]});});case _0x5543('0x40'):case _0x5543('0x41'):case'fax':case _0x5543('0x42'):case'openchannel':case'whatsapp':return db[_0x5543('0x2d')][_0x5543('0x26')]({'where':{'channel':_0x2ed02b[_0x5543('0x37')][_0x5543('0x3c')],'membername':_0xab489e[_0x5543('0x27')],'type':_0x5543('0x2e'),'exitAt':null}})[_0x5543('0x10')](function(_0x3c684b){return _0x3c684b[_0x5543('0x2c')]({'exitAt':moment()[_0x5543('0x30')](_0x5543('0x31')),'data2':_0x5543('0x3f')},{'individualHooks':!![]});})[_0x5543('0x10')](function(){var _0x5b22a7={};_['set'](_0x5b22a7,util[_0x5543('0x30')](_0x5543('0x43'),_0x2ed02b[_0x5543('0x37')][_0x5543('0x3c')],'Pause'),![]);return _0xab489e[_0x5543('0x2c')](_0x5b22a7);});default:return db['UserVoiceQueueRt'][_0x5543('0x2c')]({'paused':0x0},{'where':{'UserId':_0xab489e['id']}})['then'](function(){return db[_0x5543('0x2d')][_0x5543('0x1b')]({'where':{'membername':_0xab489e[_0x5543('0x27')],'type':_0x5543('0x2e'),'exitAt':null}});})[_0x5543('0x10')](function(_0x293c00){var _0x41b975=[];_0x293c00['forEach'](function(_0xe05e9d){_0x41b975['push'](_0xe05e9d[_0x5543('0x2c')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x5543('0x3f')}));});return BPromise[_0x5543('0x44')](_0x41b975);})[_0x5543('0x10')](function(){return _0xab489e[_0x5543('0x2c')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0xd89cc){_0x1e595b(_0xd89cc);})[_0x5543('0x19')](function(_0x3e16e8){_0x5db9db(_0x25579a['error'](0x1f4,_0x3e16e8[_0x5543('0x18')]));});});};exports[_0x5543('0x45')]=function(_0x2fe798){var _0x128605=this;return new Promise(function(_0x4fdd0a,_0x507c53){var _0x559dd3;return db[_0x5543('0x23')]['findOne']({'where':_0x2fe798[_0x5543('0x1c')]['where']||{},'attributes':['id',_0x5543('0x27')]})[_0x5543('0x10')](function(_0x4ce0d8){if(_0x4ce0d8){_0x559dd3=_0x4ce0d8;return db['UserVoiceQueueRt'][_0x5543('0x46')]({'where':{'membername':_0x559dd3[_0x5543('0x27')]},'individualHooks':!![]});}})[_0x5543('0x10')](function(){if(_0x559dd3){return db[_0x5543('0x2d')][_0x5543('0x1b')]({'where':{'membername':_0x559dd3[_0x5543('0x27')],'exitAt':null}});}})[_0x5543('0x10')](function(_0x288ac7){if(_0x559dd3){if(_0x288ac7&&_0x288ac7[_0x5543('0x2f')]){var _0xa16e2e=[];_0x288ac7[_0x5543('0x34')](function(_0x2d9435){_0xa16e2e[_0x5543('0x47')](_0x2d9435[_0x5543('0x2c')]({'exitAt':moment()[_0x5543('0x30')](_0x5543('0x31'))}));});return BPromise['all'](_0xa16e2e);}}})[_0x5543('0x10')](function(){if(_0x559dd3){return _0x559dd3[_0x5543('0x2c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x5543('0x10')](function(_0x19ff92){_0x4fdd0a(_0x19ff92);})['catch'](function(_0x11b4a1){_0x507c53(_0x128605['error'](0x1f4,_0x11b4a1[_0x5543('0x18')]));});});};exports[_0x5543('0x48')]=function(_0x78da79){var _0x2e7097=this;return new Promise(function(_0x5220dc,_0x268ebf){var _0x41ad52;var _0x4c557e;var _0x3dee7f;var _0x2d1a87;return db[_0x5543('0x23')][_0x5543('0x49')]({'where':_0x78da79[_0x5543('0x1c')]['where']||{},'attributes':['id',_0x5543('0x27'),_0x5543('0x28'),'mobile',_0x5543('0x4a'),'internal',_0x5543('0x4b'),'interface']})[_0x5543('0x10')](function(_0x4a88cd){if(_0x4a88cd){_0x41ad52=_0x4a88cd;_0x2d1a87=_0x78da79['body'][_0x5543('0x2a')]?_0x78da79[_0x5543('0x37')][_0x5543('0x2a')]:util[_0x5543('0x30')](_0x5543('0x36'),_0x41ad52[_0x5543('0x27')]);return db['User'][_0x5543('0x4c')]({'where':{'role':_0x5543('0x4d'),'online':!![],'id':{'$ne':_0x41ad52['id']}}});}})[_0x5543('0x10')](function(_0x2bb376){if(_0x2bb376){_0x3dee7f=_0x2bb376;return require(_0x5543('0x4e'))[_0x5543('0x4f')]();}})['then'](function(_0x52a448){if(_0x52a448&&_0x52a448[_0x5543('0x50')]&&_0x3dee7f>=_0x52a448[_0x5543('0x50')]){throw new Error(_0x5543('0x51'));}})[_0x5543('0x10')](function(){if(_0x41ad52){return db[_0x5543('0x2b')][_0x5543('0x46')]({'where':{'membername':_0x41ad52[_0x5543('0x27')]},'individualHooks':!![]});}})[_0x5543('0x10')](function(){if(_0x41ad52){return _0x41ad52['getVoiceQueues']({'raw':!![]});}})[_0x5543('0x10')](function(_0x561d3b){if(_0x41ad52){if(_0x561d3b){var _0x64f2e5=[];_0x4c557e=_0x561d3b;if(_0x4c557e['length']){for(var _0x58ccca=0x0;_0x58ccca<_0x4c557e['length'];_0x58ccca++){_0x64f2e5[_0x5543('0x47')](db[_0x5543('0x2b')][_0x5543('0x52')]({'membername':_0x41ad52['name'],'UserId':_0x41ad52['id'],'queue_name':_0x4c557e[_0x58ccca][_0x5543('0x27')],'VoiceQueueId':_0x4c557e[_0x58ccca]['id'],'interface':_0x2d1a87,'paused':_0x41ad52[_0x5543('0x4b')]||![],'penalty':_0x4c557e[_0x58ccca]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x5543('0x44')](_0x64f2e5);}}}})[_0x5543('0x10')](function(){if(_0x41ad52){return db[_0x5543('0x2d')][_0x5543('0x1b')]({'where':{'membername':_0x41ad52[_0x5543('0x27')],'exitAt':null}});}})[_0x5543('0x10')](function(_0x1f2e4b){if(_0x41ad52){if(_0x1f2e4b&&_0x1f2e4b[_0x5543('0x2f')]){var _0x587b4a=[];_0x1f2e4b[_0x5543('0x34')](function(_0x49d3ad){_0x587b4a[_0x5543('0x47')](_0x49d3ad[_0x5543('0x2c')]({'exitAt':moment()[_0x5543('0x30')](_0x5543('0x31'))}));});return BPromise[_0x5543('0x44')](_0x587b4a);}}})['then'](function(_0x538e96){if(_0x41ad52){var _0x3fcc2c=[];var _0x57233e=[];var _0x5ce5b7=utils[_0x5543('0x33')]();var _0x4088b7={'membername':_0x41ad52[_0x5543('0x27')],'interface':_0x2d1a87,'enterAt':moment()[_0x5543('0x30')](_0x5543('0x31')),'role':_0x41ad52[_0x5543('0x28')],'internal':_0x41ad52[_0x5543('0x29')]};_0x5ce5b7[_0x5543('0x34')](function(_0x3e2ad8){_0x3fcc2c[_0x5543('0x47')](_['merge']({'channel':_0x3e2ad8,'type':_0x5543('0x53'),'data1':'callysquare','data2':_0x2d1a87},_0x4088b7));if(_0x41ad52[_0x5543('0x4b')]){_0x57233e['push'](_[_0x5543('0x54')]({'channel':_0x3e2ad8,'type':'PAUSE','data1':_0x5543('0x55')},_0x4088b7));}});return db[_0x5543('0x2d')][_0x5543('0x3a')](_0x3fcc2c[_0x5543('0x56')](_0x57233e),{'individualHooks':!![]});}})[_0x5543('0x10')](function(){if(_0x41ad52){return _0x41ad52[_0x5543('0x2c')]({'online':!![],'lastLoginAt':moment()[_0x5543('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x41ad52['loginInPause']||![],'mailPause':_0x41ad52[_0x5543('0x4b')]||![],'chatPause':_0x41ad52[_0x5543('0x4b')]||![],'faxPause':_0x41ad52[_0x5543('0x4b')]||![],'smsPause':_0x41ad52[_0x5543('0x4b')]||![],'openchannelPause':_0x41ad52['loginInPause']||![],'pauseType':_0x41ad52['loginInPause']?_0x5543('0x55'):null,'lastPauseAt':moment()[_0x5543('0x30')](_0x5543('0x31')),'interface':_0x2d1a87});}})['then'](function(_0x3a5015){_0x5220dc(_0x3a5015);})[_0x5543('0x19')](function(_0x44d22e){_0x268ebf(_0x2e7097[_0x5543('0x17')](0x1f4,_0x44d22e[_0x5543('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 5a8fb55..573181f 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 _0xa7a6=['update','removeListener','register'];(function(_0x26353a,_0x1896ec){var _0x29b0bf=function(_0xd9bac4){while(--_0xd9bac4){_0x26353a['push'](_0x26353a['shift']());}};_0x29b0bf(++_0x1896ec);}(_0xa7a6,0x162));var _0x6a7a=function(_0x524b2a,_0x13e281){_0x524b2a=_0x524b2a-0x0;var _0x176cc5=_0xa7a6[_0x524b2a];return _0x176cc5;};'use strict';var UserEvents=require('./user.events');var events=['save','remove',_0x6a7a('0x0')];function createListener(_0x3e89f6,_0x13d5cb){return function(_0x137e06){_0x13d5cb['emit'](_0x3e89f6,_0x137e06);};}function removeListener(_0x36aac3,_0x2f07ec){return function(){UserEvents[_0x6a7a('0x1')](_0x36aac3,_0x2f07ec);};}exports[_0x6a7a('0x2')]=function(_0x27ba42){for(var _0x35b9b5=0x0,_0x50c2eb=events['length'];_0x35b9b5<_0x50c2eb;_0x35b9b5++){var _0x3f4f=events[_0x35b9b5];var _0xeed1df=createListener('user:'+_0x3f4f,_0x27ba42);UserEvents['on'](_0x3f4f,_0xeed1df);}}; \ No newline at end of file +var _0x4877=['save','remove','emit','removeListener','length','user:'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0x4877,0x1d4));var _0x7487=function(_0x1ff385,_0x5296e9){_0x1ff385=_0x1ff385-0x0;var _0x108eed=_0x4877[_0x1ff385];return _0x108eed;};'use strict';var UserEvents=require('./user.events');var events=[_0x7487('0x0'),_0x7487('0x1'),'update'];function createListener(_0x4de5f1,_0x242949){return function(_0x3cf25a){_0x242949[_0x7487('0x2')](_0x4de5f1,_0x3cf25a);};}function removeListener(_0x566e18,_0x5871d1){return function(){UserEvents[_0x7487('0x3')](_0x566e18,_0x5871d1);};}exports['register']=function(_0x4892c6){for(var _0x5e2b97=0x0,_0x2f1cf2=events[_0x7487('0x4')];_0x5e2b97<_0x2f1cf2;_0x5e2b97++){var _0x1b3d67=events[_0x5e2b97];var _0x554ce0=createListener(_0x7487('0x5')+_0x1b3d67,_0x4892c6);UserEvents['on'](_0x1b3d67,_0x554ce0);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index c43d95e..62f721a 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x234869,_0x25ce29){var _0xdc5c37=function(_0x1bb15a){while(--_0x1bb15a){_0x234869['push'](_0x234869['shift']());}};_0xdc5c37(++_0x25ce29);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5e777e,_0x1db6bc){var _0x4d8d3c=function(_0x3a1e91){while(--_0x3a1e91){_0x5e777e['push'](_0x5e777e['shift']());}};_0x4d8d3c(++_0x1db6bc);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 49a8ec4..366f7e7 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 _0x360c=['sequelize','exports'];(function(_0x5e415c,_0x3a2627){var _0x42d342=function(_0x3e994b){while(--_0x3e994b){_0x5e415c['push'](_0x5e415c['shift']());}};_0x42d342(++_0x3a2627);}(_0x360c,0xac));var _0xc360=function(_0x56eaab,_0x345744){_0x56eaab=_0x56eaab-0x0;var _0x1e02c6=_0x360c[_0x56eaab];return _0x1e02c6;};'use strict';var Sequelize=require(_0xc360('0x0'));module[_0xc360('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8087=['exports','sequelize'];(function(_0x351809,_0x5aa2a6){var _0x379328=function(_0x132ba2){while(--_0x132ba2){_0x351809['push'](_0x351809['shift']());}};_0x379328(++_0x5aa2a6);}(_0x8087,0x89));var _0x7808=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x8087[_0x31cb5f];return _0x586042;};'use strict';var Sequelize=require(_0x7808('0x0'));module[_0x7808('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 adbc90e..24e0b3d 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 _0x0aa1=['UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','./userChatQueue.attributes','exports','define'];(function(_0x83159,_0x487398){var _0x443a2a=function(_0x429de1){while(--_0x429de1){_0x83159['push'](_0x83159['shift']());}};_0x443a2a(++_0x487398);}(_0x0aa1,0xce));var _0x10aa=function(_0x4ebf9b,_0x4b5e37){_0x4ebf9b=_0x4ebf9b-0x0;var _0x3865d4=_0x0aa1[_0x4ebf9b];return _0x3865d4;};'use strict';var _=require('lodash');var util=require(_0x10aa('0x0'));var logger=require(_0x10aa('0x1'))(_0x10aa('0x2'));var moment=require(_0x10aa('0x3'));var BPromise=require(_0x10aa('0x4'));var rp=require(_0x10aa('0x5'));var fs=require('fs');var path=require(_0x10aa('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x10aa('0x7'));module[_0x10aa('0x8')]=function(_0x53d3e1,_0x577a7){return _0x53d3e1[_0x10aa('0x9')](_0x10aa('0xa'),attributes,{'tableName':_0x10aa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd64b=['define','UserChatQueue','user_has_chat_queues','api','rimraf','exports'];(function(_0x5d8afc,_0x4dd561){var _0x5b0f9e=function(_0x5b7145){while(--_0x5b7145){_0x5d8afc['push'](_0x5d8afc['shift']());}};_0x5b0f9e(++_0x4dd561);}(_0xd64b,0x153));var _0xbd64=function(_0x439e06,_0xe6d21c){_0x439e06=_0x439e06-0x0;var _0xaa57c1=_0xd64b[_0x439e06];return _0xaa57c1;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbd64('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbd64('0x1'));var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module[_0xbd64('0x2')]=function(_0xbe2205,_0x27ff54){return _0xbe2205[_0xbd64('0x3')](_0xbd64('0x4'),attributes,{'tableName':_0xbd64('0x5'),'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 7e86346..20f73b7 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 _0x7ef0=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x7ef0,0x161));var _0x07ef=function(_0x43f8ba,_0x2690b1){_0x43f8ba=_0x43f8ba-0x0;var _0x342bf7=_0x7ef0[_0x43f8ba];return _0x342bf7;};'use strict';var _=require(_0x07ef('0x0'));var util=require(_0x07ef('0x1'));var moment=require(_0x07ef('0x2'));var BPromise=require(_0x07ef('0x3'));var rs=require(_0x07ef('0x4'));var fs=require('fs');var Redis=require(_0x07ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x07ef('0x6'));var logger=require(_0x07ef('0x7'))(_0x07ef('0x8'));var config=require(_0x07ef('0x9'));var jayson=require(_0x07ef('0xa'));var client=jayson['client'][_0x07ef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3dc4a7,_0x326517,_0x38f8ba){return new BPromise(function(_0x3d178b,_0x3c3e6f){return client[_0x07ef('0xc')](_0x3dc4a7,_0x38f8ba)['then'](function(_0x5c040d){logger[_0x07ef('0xd')](_0x07ef('0xe'),_0x326517,_0x07ef('0xf'));logger['debug'](_0x07ef('0x10'),_0x326517,_0x07ef('0xf'),JSON['stringify'](_0x5c040d));if(_0x5c040d[_0x07ef('0x11')]){if(_0x5c040d[_0x07ef('0x11')][_0x07ef('0x12')]===0x1f4){logger[_0x07ef('0x11')](_0x07ef('0xe'),_0x326517,_0x5c040d['error'][_0x07ef('0x13')]);return _0x3c3e6f(_0x5c040d[_0x07ef('0x11')]['message']);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x326517,_0x5c040d[_0x07ef('0x11')][_0x07ef('0x13')]);return _0x3d178b(_0x5c040d['error'][_0x07ef('0x13')]);}else{logger[_0x07ef('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x326517,_0x07ef('0xf'));_0x3d178b(_0x5c040d[_0x07ef('0x14')][_0x07ef('0x13')]);}})[_0x07ef('0x15')](function(_0x1568e3){logger[_0x07ef('0x11')](_0x07ef('0xe'),_0x326517,_0x1568e3);_0x3c3e6f(_0x1568e3);});});} \ No newline at end of file +var _0x841a=['message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x590be3,_0x45e19b){var _0x5667a4=function(_0x2c5107){while(--_0x2c5107){_0x590be3['push'](_0x590be3['shift']());}};_0x5667a4(++_0x45e19b);}(_0x841a,0x163));var _0xa841=function(_0x2bdde3,_0x261afb){_0x2bdde3=_0x2bdde3-0x0;var _0x15fbeb=_0x841a[_0x2bdde3];return _0x15fbeb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa841('0x0'));var BPromise=require(_0xa841('0x1'));var rs=require(_0xa841('0x2'));var fs=require('fs');var Redis=require(_0xa841('0x3'));var db=require(_0xa841('0x4'))['db'];var utils=require(_0xa841('0x5'));var logger=require('../../config/logger')(_0xa841('0x6'));var config=require(_0xa841('0x7'));var jayson=require(_0xa841('0x8'));var client=jayson[_0xa841('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f5143,_0x468b65,_0x44eb13){return new BPromise(function(_0x38c916,_0x2e9532){return client[_0xa841('0xa')](_0x2f5143,_0x44eb13)['then'](function(_0x13149a){logger[_0xa841('0xb')](_0xa841('0xc'),_0x468b65,_0xa841('0xd'));logger[_0xa841('0xe')](_0xa841('0xf'),_0x468b65,_0xa841('0xd'),JSON[_0xa841('0x10')](_0x13149a));if(_0x13149a['error']){if(_0x13149a[_0xa841('0x11')][_0xa841('0x12')]===0x1f4){logger[_0xa841('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x468b65,_0x13149a[_0xa841('0x11')]['message']);return _0x2e9532(_0x13149a[_0xa841('0x11')]['message']);}logger[_0xa841('0x11')](_0xa841('0xc'),_0x468b65,_0x13149a['error'][_0xa841('0x13')]);return _0x38c916(_0x13149a[_0xa841('0x11')][_0xa841('0x13')]);}else{logger[_0xa841('0xb')](_0xa841('0xc'),_0x468b65,_0xa841('0xd'));_0x38c916(_0x13149a[_0xa841('0x14')][_0xa841('0x13')]);}})[_0xa841('0x15')](function(_0x5d5e55){logger[_0xa841('0x11')](_0xa841('0xc'),_0x468b65,_0x5d5e55);_0x2e9532(_0x5d5e55);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index aea28a3..15842bf 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x25dfdf,_0x542333){var _0x5220da=function(_0x53accc){while(--_0x53accc){_0x25dfdf['push'](_0x25dfdf['shift']());}};_0x5220da(++_0x542333);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xd1af75,_0x5f3051){var _0x59bb6e=function(_0x1ae1c3){while(--_0x1ae1c3){_0xd1af75['push'](_0xd1af75['shift']());}};_0x59bb6e(++_0x5f3051);}(_0x70e0,0x17b));var _0x070e=function(_0x2ff8a7,_0x20be13){_0x2ff8a7=_0x2ff8a7-0x0;var _0x591639=_0x70e0[_0x2ff8a7];return _0x591639;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index ee8127b..c7a687f 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 _0xb4a5=['INTEGER','STRING'];(function(_0x37e0c5,_0x46c212){var _0x22f40e=function(_0x3488dc){while(--_0x3488dc){_0x37e0c5['push'](_0x37e0c5['shift']());}};_0x22f40e(++_0x46c212);}(_0xb4a5,0x122));var _0x5b4a=function(_0x2ea35a,_0x20f6de){_0x2ea35a=_0x2ea35a-0x0;var _0x3eb8ef=_0xb4a5[_0x2ea35a];return _0x3eb8ef;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x5b4a('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5b4a('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x5b4a('0x1')]}}; \ No newline at end of file +var _0x045b=['STRING','sequelize','exports','INTEGER'];(function(_0x26e6f4,_0x39e87b){var _0x59b5fa=function(_0x4f935d){while(--_0x4f935d){_0x26e6f4['push'](_0x26e6f4['shift']());}};_0x59b5fa(++_0x39e87b);}(_0x045b,0x1a1));var _0xb045=function(_0x358806,_0x322b66){_0x358806=_0x358806-0x0;var _0x19fdcb=_0x045b[_0x358806];return _0x19fdcb;};'use strict';var Sequelize=require(_0xb045('0x0'));module[_0xb045('0x1')]={'penalty':{'type':Sequelize[_0xb045('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xb045('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 760da78..e2fb62c 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 _0xd83e=['user_has_fax_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userFaxQueue.attributes','exports','define','UserFaxQueue'];(function(_0x50066e,_0x2f8fd2){var _0x13d9da=function(_0x1f56e8){while(--_0x1f56e8){_0x50066e['push'](_0x50066e['shift']());}};_0x13d9da(++_0x2f8fd2);}(_0xd83e,0x11f));var _0xed83=function(_0x2f5cc9,_0x1fe974){_0x2f5cc9=_0x2f5cc9-0x0;var _0x39f3d6=_0xd83e[_0x2f5cc9];return _0x39f3d6;};'use strict';var _=require('lodash');var util=require(_0xed83('0x0'));var logger=require(_0xed83('0x1'))(_0xed83('0x2'));var moment=require(_0xed83('0x3'));var BPromise=require(_0xed83('0x4'));var rp=require(_0xed83('0x5'));var fs=require('fs');var path=require(_0xed83('0x6'));var rimraf=require(_0xed83('0x7'));var config=require('../../config/environment');var attributes=require(_0xed83('0x8'));module[_0xed83('0x9')]=function(_0x4cff88,_0x11c25c){return _0x4cff88[_0xed83('0xa')](_0xed83('0xb'),attributes,{'tableName':_0xed83('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9113=['rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9113,0x118));var _0x3911=function(_0x4315a1,_0x274444){_0x4315a1=_0x4315a1-0x0;var _0x3afcdf=_0x9113[_0x4315a1];return _0x3afcdf;};'use strict';var _=require(_0x3911('0x0'));var util=require(_0x3911('0x1'));var logger=require(_0x3911('0x2'))(_0x3911('0x3'));var moment=require(_0x3911('0x4'));var BPromise=require('bluebird');var rp=require(_0x3911('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3911('0x6'));var config=require(_0x3911('0x7'));var attributes=require(_0x3911('0x8'));module[_0x3911('0x9')]=function(_0x4da4f6,_0x3ddbae){return _0x4da4f6[_0x3911('0xa')](_0x3911('0xb'),attributes,{'tableName':_0x3911('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 176d5ae..185337e 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 _0x8bb3=['then','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8bb3,0x1c4));var _0x38bb=function(_0x2bfde2,_0x48093f){_0x2bfde2=_0x2bfde2-0x0;var _0x2e3a25=_0x8bb3[_0x2bfde2];return _0x2e3a25;};'use strict';var _=require(_0x38bb('0x0'));var util=require('util');var moment=require(_0x38bb('0x1'));var BPromise=require(_0x38bb('0x2'));var rs=require(_0x38bb('0x3'));var fs=require('fs');var Redis=require(_0x38bb('0x4'));var db=require(_0x38bb('0x5'))['db'];var utils=require(_0x38bb('0x6'));var logger=require('../../config/logger')(_0x38bb('0x7'));var config=require(_0x38bb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x38bb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x322833,_0xa7350f,_0x5af552){return new BPromise(function(_0x3540d6,_0x2f1902){return client['request'](_0x322833,_0x5af552)[_0x38bb('0xa')](function(_0x522692){logger['info'](_0x38bb('0xb'),_0xa7350f,'request\x20sent');logger[_0x38bb('0xc')](_0x38bb('0xd'),_0xa7350f,_0x38bb('0xe'),JSON[_0x38bb('0xf')](_0x522692));if(_0x522692[_0x38bb('0x10')]){if(_0x522692['error']['code']===0x1f4){logger[_0x38bb('0x10')](_0x38bb('0xb'),_0xa7350f,_0x522692[_0x38bb('0x10')]['message']);return _0x2f1902(_0x522692[_0x38bb('0x10')][_0x38bb('0x11')]);}logger[_0x38bb('0x10')](_0x38bb('0xb'),_0xa7350f,_0x522692[_0x38bb('0x10')][_0x38bb('0x11')]);return _0x3540d6(_0x522692['error'][_0x38bb('0x11')]);}else{logger[_0x38bb('0x12')](_0x38bb('0xb'),_0xa7350f,_0x38bb('0xe'));_0x3540d6(_0x522692[_0x38bb('0x13')]['message']);}})[_0x38bb('0x14')](function(_0x35d759){logger['error'](_0x38bb('0xb'),_0xa7350f,_0x35d759);_0x2f1902(_0x35d759);});});} \ No newline at end of file +var _0xa77e=['catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x4f068f,_0x1732f7){var _0x590f01=function(_0x58a636){while(--_0x58a636){_0x4f068f['push'](_0x4f068f['shift']());}};_0x590f01(++_0x1732f7);}(_0xa77e,0xb9));var _0xea77=function(_0x3a4744,_0x1f7368){_0x3a4744=_0x3a4744-0x0;var _0x29baea=_0xa77e[_0x3a4744];return _0x29baea;};'use strict';var _=require(_0xea77('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xea77('0x1'));var rs=require(_0xea77('0x2'));var fs=require('fs');var Redis=require(_0xea77('0x3'));var db=require(_0xea77('0x4'))['db'];var utils=require(_0xea77('0x5'));var logger=require(_0xea77('0x6'))(_0xea77('0x7'));var config=require('../../config/environment');var jayson=require(_0xea77('0x8'));var client=jayson[_0xea77('0x9')][_0xea77('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cafca,_0x276ada,_0xd7889e){return new BPromise(function(_0x1e868c,_0x4dda18){return client['request'](_0x1cafca,_0xd7889e)[_0xea77('0xb')](function(_0x11ba3f){logger[_0xea77('0xc')](_0xea77('0xd'),_0x276ada,_0xea77('0xe'));logger[_0xea77('0xf')](_0xea77('0x10'),_0x276ada,_0xea77('0xe'),JSON[_0xea77('0x11')](_0x11ba3f));if(_0x11ba3f['error']){if(_0x11ba3f[_0xea77('0x12')][_0xea77('0x13')]===0x1f4){logger[_0xea77('0x12')](_0xea77('0xd'),_0x276ada,_0x11ba3f['error'][_0xea77('0x14')]);return _0x4dda18(_0x11ba3f[_0xea77('0x12')][_0xea77('0x14')]);}logger[_0xea77('0x12')](_0xea77('0xd'),_0x276ada,_0x11ba3f[_0xea77('0x12')][_0xea77('0x14')]);return _0x1e868c(_0x11ba3f[_0xea77('0x12')][_0xea77('0x14')]);}else{logger[_0xea77('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x276ada,_0xea77('0xe'));_0x1e868c(_0x11ba3f[_0xea77('0x15')][_0xea77('0x14')]);}})[_0xea77('0x16')](function(_0x32f2af){logger[_0xea77('0x12')](_0xea77('0xd'),_0x276ada,_0x32f2af);_0x4dda18(_0x32f2af);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index e8021a8..b48ffcd 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x131090,_0x4b5e43){var _0x1e10cf=function(_0x489085){while(--_0x489085){_0x131090['push'](_0x131090['shift']());}};_0x1e10cf(++_0x4b5e43);}(_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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3fdae9,_0x561404){var _0x3d7777=function(_0x4b40a1){while(--_0x4b40a1){_0x3fdae9['push'](_0x3fdae9['shift']());}};_0x3d7777(++_0x561404);}(_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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 24d2889..866dd04 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 _0x5a78=['INTEGER','sequelize','exports'];(function(_0x205f5e,_0x41d484){var _0x231680=function(_0x4f7a5c){while(--_0x4f7a5c){_0x205f5e['push'](_0x205f5e['shift']());}};_0x231680(++_0x41d484);}(_0x5a78,0x14e));var _0x85a7=function(_0x4880f8,_0x34aeb7){_0x4880f8=_0x4880f8-0x0;var _0x567265=_0x5a78[_0x4880f8];return _0x567265;};'use strict';var Sequelize=require(_0x85a7('0x0'));module[_0x85a7('0x1')]={'penalty':{'type':Sequelize[_0x85a7('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x05c9=['exports','sequelize'];(function(_0x513cf7,_0x23bd7e){var _0x1d1eba=function(_0x25ddb0){while(--_0x25ddb0){_0x513cf7['push'](_0x513cf7['shift']());}};_0x1d1eba(++_0x23bd7e);}(_0x05c9,0x19b));var _0x905c=function(_0x31772a,_0xef5284){_0x31772a=_0x31772a-0x0;var _0x3903be=_0x05c9[_0x31772a];return _0x3903be;};'use strict';var Sequelize=require(_0x905c('0x0'));module[_0x905c('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 11a6b1a..f58462a 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 _0xcecf=['lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./userMailQueue.attributes','exports','UserMailQueue','user_has_mail_queues'];(function(_0x4f8a99,_0xc39ea6){var _0x5edbc3=function(_0x1ff106){while(--_0x1ff106){_0x4f8a99['push'](_0x4f8a99['shift']());}};_0x5edbc3(++_0xc39ea6);}(_0xcecf,0x8c));var _0xfcec=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xcecf[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xfcec('0x0'));var util=require('util');var logger=require(_0xfcec('0x1'))('api');var moment=require('moment');var BPromise=require(_0xfcec('0x2'));var rp=require(_0xfcec('0x3'));var fs=require('fs');var path=require(_0xfcec('0x4'));var rimraf=require('rimraf');var config=require(_0xfcec('0x5'));var attributes=require(_0xfcec('0x6'));module[_0xfcec('0x7')]=function(_0x18a612,_0x3adb04){return _0x18a612['define'](_0xfcec('0x8'),attributes,{'tableName':_0xfcec('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc340=['api','moment','bluebird','request-promise','path','./userMailQueue.attributes','exports','define','lodash','util'];(function(_0xdea129,_0x34ceac){var _0x3cee83=function(_0x588b3e){while(--_0x588b3e){_0xdea129['push'](_0xdea129['shift']());}};_0x3cee83(++_0x34ceac);}(_0xc340,0x1c0));var _0x0c34=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc340[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x0c34('0x0'));var util=require(_0x0c34('0x1'));var logger=require('../../config/logger')(_0x0c34('0x2'));var moment=require(_0x0c34('0x3'));var BPromise=require(_0x0c34('0x4'));var rp=require(_0x0c34('0x5'));var fs=require('fs');var path=require(_0x0c34('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0c34('0x7'));module[_0x0c34('0x8')]=function(_0x3d7e32,_0x49fed5){return _0x3d7e32[_0x0c34('0x9')]('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index da3cac4..1f47e10 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5755c2,_0x57dd0e){var _0x162719=function(_0xbf3040){while(--_0xbf3040){_0x5755c2['push'](_0x5755c2['shift']());}};_0x162719(++_0x57dd0e);}(_0x34e8,0x12c));var _0x834e=function(_0x351d37,_0x1b40be){_0x351d37=_0x351d37-0x0;var _0x357046=_0x34e8[_0x351d37];return _0x357046;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x36122f,_0x4e3e01){var _0x5ba75f=function(_0x303322){while(--_0x303322){_0x36122f['push'](_0x36122f['shift']());}};_0x5ba75f(++_0x4e3e01);}(_0x4b84,0x1cc));var _0x44b8=function(_0x492221,_0x9e2521){_0x492221=_0x492221-0x0;var _0x398bf9=_0x4b84[_0x492221];return _0x398bf9;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 70b73b7..188b094 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 _0x09e8=['../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x15b00a,_0x15312c){var _0x1fd156=function(_0x5d2f89){while(--_0x5d2f89){_0x15b00a['push'](_0x15b00a['shift']());}};_0x1fd156(++_0x15312c);}(_0x09e8,0x180));var _0x809e=function(_0x5f3670,_0x1d270d){_0x5f3670=_0x5f3670-0x0;var _0x4c4d66=_0x09e8[_0x5f3670];return _0x4c4d66;};'use strict';var multer=require(_0x809e('0x0'));var util=require(_0x809e('0x1'));var path=require(_0x809e('0x2'));var timeout=require(_0x809e('0x3'));var express=require(_0x809e('0x4'));var router=express[_0x809e('0x5')]();var fs_extra=require(_0x809e('0x6'));var auth=require(_0x809e('0x7'));var interaction=require(_0x809e('0x8'));var config=require(_0x809e('0x9'));var controller=require(_0x809e('0xa'));router['post']('/',auth[_0x809e('0xb')](),controller[_0x809e('0xc')]);module[_0x809e('0xd')]=router; \ No newline at end of file +var _0x69d0=['multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','exports'];(function(_0x3886dc,_0x36fffb){var _0x2ad023=function(_0x412a4d){while(--_0x412a4d){_0x3886dc['push'](_0x3886dc['shift']());}};_0x2ad023(++_0x36fffb);}(_0x69d0,0x136));var _0x069d=function(_0x3d4bf8,_0x31550a){_0x3d4bf8=_0x3d4bf8-0x0;var _0x27fcfe=_0x69d0[_0x3d4bf8];return _0x27fcfe;};'use strict';var multer=require(_0x069d('0x0'));var util=require(_0x069d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x069d('0x2')]();var fs_extra=require(_0x069d('0x3'));var auth=require(_0x069d('0x4'));var interaction=require(_0x069d('0x5'));var config=require(_0x069d('0x6'));var controller=require('./userNotification.controller');router[_0x069d('0x7')]('/',auth[_0x069d('0x8')](),controller['sendUserNotification']);module[_0x069d('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index ee400f0..759859c 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 _0x0e46=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x503564,_0x55867e){var _0x4be9fd=function(_0x41c543){while(--_0x41c543){_0x503564['push'](_0x503564['shift']());}};_0x4be9fd(++_0x55867e);}(_0x0e46,0x1a8));var _0x60e4=function(_0x2ab3fb,_0x187e50){_0x2ab3fb=_0x2ab3fb-0x0;var _0x177fe6=_0x0e46[_0x2ab3fb];return _0x177fe6;};'use strict';var Sequelize=require(_0x60e4('0x0'));module[_0x60e4('0x1')]={'body':{'type':Sequelize[_0x60e4('0x2')]},'senderName':{'type':Sequelize[_0x60e4('0x3')]},'recipientsId':{'type':Sequelize[_0x60e4('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x60e4('0x4')]}}; \ No newline at end of file +var _0x504f=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x5abe52,_0x10c484){var _0x4be6a1=function(_0x23c30a){while(--_0x23c30a){_0x5abe52['push'](_0x5abe52['shift']());}};_0x4be6a1(++_0x10c484);}(_0x504f,0x1b5));var _0xf504=function(_0x589b04,_0x1e7fbe){_0x589b04=_0x589b04-0x0;var _0x2ef175=_0x504f[_0x589b04];return _0x2ef175;};'use strict';var Sequelize=require(_0xf504('0x0'));module[_0xf504('0x1')]={'body':{'type':Sequelize[_0xf504('0x2')]},'senderName':{'type':Sequelize[_0xf504('0x3')]},'recipientsId':{'type':Sequelize[_0xf504('0x2')]},'recipientsDescription':{'type':Sequelize[_0xf504('0x3')]},'beep':{'type':Sequelize[_0xf504('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index b3cf6b9..3eaa993 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 _0xde67=['transaction','create','forEach','emit','userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','startCase','User','union','queue','replace','Queue','ids','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./userNotification.socket','register','sendStatus','end','status','undefined','limit','count','set','Content-Range','json','reject','save','update','then','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','sortBy','join','sequelize'];(function(_0x35c923,_0x2d150b){var _0x142a94=function(_0x1de3b6){while(--_0x1de3b6){_0x35c923['push'](_0x35c923['shift']());}};_0x142a94(++_0x2d150b);}(_0xde67,0x1a4));var _0x7de6=function(_0x4c1b76,_0x2cdc2d){_0x4c1b76=_0x4c1b76-0x0;var _0x3ace6b=_0xde67[_0x4c1b76];return _0x3ace6b;};'use strict';var emlformat=require(_0x7de6('0x0'));var rimraf=require(_0x7de6('0x1'));var zipdir=require(_0x7de6('0x2'));var jsonpatch=require(_0x7de6('0x3'));var rp=require(_0x7de6('0x4'));var moment=require(_0x7de6('0x5'));var BPromise=require(_0x7de6('0x6'));var Mustache=require(_0x7de6('0x7'));var util=require(_0x7de6('0x8'));var path=require(_0x7de6('0x9'));var sox=require('sox');var csv=require(_0x7de6('0xa'));var ejs=require(_0x7de6('0xb'));var fs=require('fs');var fs_extra=require(_0x7de6('0xc'));var _=require(_0x7de6('0xd'));var squel=require(_0x7de6('0xe'));var crypto=require(_0x7de6('0xf'));var jsforce=require(_0x7de6('0x10'));var deskjs=require(_0x7de6('0x11'));var toCsv=require(_0x7de6('0xa'));var querystring=require(_0x7de6('0x12'));var Papa=require(_0x7de6('0x13'));var Redis=require(_0x7de6('0x14'));var authService=require(_0x7de6('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x7de6('0x16'));var hardwareService=require(_0x7de6('0x17'));var logger=require(_0x7de6('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x7de6('0x19'));var licenseUtil=require(_0x7de6('0x1a'));var db=require(_0x7de6('0x1b'))['db'];config['redis']=_[_0x7de6('0x1c')](config['redis'],{'host':_0x7de6('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7de6('0x1e')]));require(_0x7de6('0x1f'))[_0x7de6('0x20')](socket);function respondWithStatusCode(_0x14242e,_0x5c7e85){_0x5c7e85=_0x5c7e85||0xcc;return function(_0x223cb5){if(_0x223cb5){return _0x14242e[_0x7de6('0x21')](_0x5c7e85);}return _0x14242e['status'](_0x5c7e85)[_0x7de6('0x22')]();};}function respondWithResult(_0x957fd7,_0x5de2e5){_0x5de2e5=_0x5de2e5||0xc8;return function(_0x209cdc){if(_0x209cdc){return _0x957fd7[_0x7de6('0x23')](_0x5de2e5)['json'](_0x209cdc);}};}function respondWithFilteredResult(_0x1c5e25,_0xdede30){return function(_0x5b3177){if(_0x5b3177){var _0x1f03be=typeof _0xdede30['offset']===_0x7de6('0x24')&&typeof _0xdede30[_0x7de6('0x25')]===_0x7de6('0x24');var _0x5c08a3=_0x5b3177[_0x7de6('0x26')];var _0x4e56f3=_0x1f03be?0x0:_0xdede30['offset'];var _0x5428bd=_0x1f03be?_0x5b3177[_0x7de6('0x26')]:_0xdede30['offset']+_0xdede30[_0x7de6('0x25')];var _0xc75f0e;if(_0x5428bd>=_0x5c08a3){_0x5428bd=_0x5c08a3;_0xc75f0e=0xc8;}else{_0xc75f0e=0xce;}_0x1c5e25[_0x7de6('0x23')](_0xc75f0e);return _0x1c5e25[_0x7de6('0x27')](_0x7de6('0x28'),_0x4e56f3+'-'+_0x5428bd+'/'+_0x5c08a3)[_0x7de6('0x29')](_0x5b3177);}return null;};}function patchUpdates(_0x1d0fe5){return function(_0x80cfc4){try{jsonpatch['apply'](_0x80cfc4,_0x1d0fe5,!![]);}catch(_0x3d35d5){return BPromise[_0x7de6('0x2a')](_0x3d35d5);}return _0x80cfc4[_0x7de6('0x2b')]();};}function saveUpdates(_0x534ef2,_0x171c21){return function(_0x34d7eb){if(_0x34d7eb){return _0x34d7eb[_0x7de6('0x2c')](_0x534ef2)[_0x7de6('0x2d')](function(_0x53c1aa){return _0x53c1aa;});}return null;};}function removeEntity(_0x2978de,_0xc43326){return function(_0x50e189){if(_0x50e189){return _0x50e189['destroy']()[_0x7de6('0x2d')](function(){_0x2978de['status'](0xcc)[_0x7de6('0x22')]();});}};}function handleEntityNotFound(_0x3758d5,_0x103f71){return function(_0x471c6b){if(!_0x471c6b){_0x3758d5['sendStatus'](0x194);}return _0x471c6b;};}function handleError(_0x5f3dea,_0x5e1a00){_0x5e1a00=_0x5e1a00||0x1f4;return function(_0x48f4e2){logger['error'](_0x48f4e2[_0x7de6('0x2e')]);if(_0x48f4e2[_0x7de6('0x2f')]){delete _0x48f4e2[_0x7de6('0x2f')];}_0x5f3dea[_0x7de6('0x23')](_0x5e1a00)['send'](_0x48f4e2);};}exports[_0x7de6('0x30')]=function(_0x567a28,_0x12948e,_0x4dabb0){if(!_0x567a28[_0x7de6('0x31')][_0x7de6('0x32')](_0x7de6('0x33'))&&!_0x567a28[_0x7de6('0x31')][_0x7de6('0x32')](_0x7de6('0x34'))){throw new db[(_0x7de6('0x35'))][(_0x7de6('0x36'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x567a28[_0x7de6('0x31')][_0x7de6('0x32')](_0x7de6('0x34'))&&!_0x567a28[_0x7de6('0x31')][_0x7de6('0x32')](_0x7de6('0x37'))){throw new db[(_0x7de6('0x35'))][(_0x7de6('0x36'))](_0x7de6('0x38'));}if(!_0x567a28['body'][_0x7de6('0x32')](_0x7de6('0x39'))){throw new db['Sequelize'][(_0x7de6('0x36'))](_0x7de6('0x3a'));}else{try{var _0x1ecd76=JSON[_0x7de6('0x3b')](_0x567a28['body'][_0x7de6('0x39')]);}catch(_0x3d1b66){logger[_0x7de6('0x3c')](_0x3d1b66);throw new db[(_0x7de6('0x35'))][(_0x7de6('0x36'))](_0x7de6('0x3d'));}var _0x2d1374=[_0x7de6('0x3e'),_0x7de6('0x3f'),_0x7de6('0x40'),'openchannelqueue',_0x7de6('0x41'),_0x7de6('0x42'),'whatsappqueue','team',_0x7de6('0x43')];if(_[_0x7de6('0x44')](_0x1ecd76,function(_0x3c7418){return!_[_0x7de6('0x45')](_0x2d1374,_0x3c7418[_0x7de6('0x46')][_0x7de6('0x47')]());})){throw new db[(_0x7de6('0x35'))][(_0x7de6('0x36'))](_0x7de6('0x48'));}}}var _0xb47936={};_0xb47936[_0x7de6('0x49')]=_0x567a28[_0x7de6('0x31')]['hasOwnProperty'](_0x7de6('0x49'))?_0x567a28[_0x7de6('0x31')][_0x7de6('0x49')]:_0x567a28[_0x7de6('0x43')]['fullname'];_0xb47936[_0x7de6('0x4a')]=_[_0x7de6('0x4b')](_0x567a28[_0x7de6('0x31')][_0x7de6('0x4a')])?null:_0x567a28['body'][_0x7de6('0x4a')];_0xb47936[_0x7de6('0x4c')]=_0x567a28[_0x7de6('0x31')][_0x7de6('0x4c')]||![];_0xb47936['SenderId']=_0x567a28[_0x7de6('0x43')]['id'];return getContent(_0x567a28[_0x7de6('0x31')])[_0x7de6('0x2d')](function(_0xead858){_0xb47936[_0x7de6('0x31')]=_0xead858;return getRecipients(_0x1ecd76);})[_0x7de6('0x2d')](function(_0x738520){_0xb47936['recipientsId']=_[_0x7de6('0x4d')](_0x738520)[_0x7de6('0x4e')](',');return db[_0x7de6('0x4f')][_0x7de6('0x50')](function(_0x4de6f1){return db['UserNotification'][_0x7de6('0x51')](_0xb47936,{'raw':!![],'transaction':_0x4de6f1})[_0x7de6('0x2d')](function(_0x4ef76a){var _0x36523d={'sender':_0xb47936['senderName'],'description':_0xb47936[_0x7de6('0x4a')],'content':_0xb47936[_0x7de6('0x31')],'beep':_0xb47936[_0x7de6('0x4c')]};_0x738520[_0x7de6('0x52')](function(_0x2181ec){_0x36523d['recipient']=_0x2181ec;socket[_0x7de6('0x53')](_0x7de6('0x54'),_0x36523d);});return _0x4ef76a;});});})[_0x7de6('0x2d')](respondWithResult(_0x12948e,0xc9))[_0x7de6('0x55')](handleError(_0x12948e,null));};function getContent(_0x59434e){return new BPromise(function(_0x57c5a0,_0x374897){if(_0x59434e[_0x7de6('0x33')]){_0x57c5a0(_0x59434e[_0x7de6('0x33')]);return;}return db[_0x7de6('0x56')][_0x7de6('0x57')]({'attributes':['html'],'where':{'id':_0x59434e[_0x7de6('0x34')]},'raw':!![]})[_0x7de6('0x2d')](function(_0xeda831){if(!_0xeda831)throw new db[(_0x7de6('0x35'))][(_0x7de6('0x36'))](_0x7de6('0x58'));var _0x125a34=Mustache['render'](_0xeda831[_0x7de6('0x59')],_0x59434e[_0x7de6('0x37')]);_0x57c5a0(_0x125a34);})[_0x7de6('0x55')](function(_0x2e6cff){_0x374897(_0x2e6cff);});});}function getRecipients(_0x47682d){return new BPromise(function(_0x5dbb38,_0x29962d){var _0x58fe57=[];var _0x370509=[];_0x47682d['forEach'](function(_0x59c722){var _0xe6bf0d=_[_0x7de6('0x5a')](_0x59c722[_0x7de6('0x46')][_0x7de6('0x47')]());if(_0xe6bf0d===_0x7de6('0x5b')){_0x58fe57=_[_0x7de6('0x5c')](_0x58fe57,_0x59c722['ids']);}else{if(_[_0x7de6('0x45')](_0xe6bf0d,_0x7de6('0x5d')))_0xe6bf0d=_0xe6bf0d[_0x7de6('0x5e')](_0x7de6('0x5d'),_0x7de6('0x5f'));_0x59c722[_0x7de6('0x60')][_0x7de6('0x52')](function(_0x30f2c7){_0x370509['push'](getAgents(_0xe6bf0d,_0x30f2c7));});}});return BPromise['all'](_0x370509)[_0x7de6('0x2d')](function(_0x4bb26c){_0x58fe57=_[_0x7de6('0x5c')](_0x58fe57,_[_0x7de6('0x61')](_0x4bb26c));_0x5dbb38(_0x58fe57);})[_0x7de6('0x55')](function(_0x1fd202){_0x29962d(_0x1fd202);});});}function getAgents(_0x525af3,_0x2f835f){return new BPromise(function(_0x3a842c,_0x2889ea){return db[_0x525af3]['findOne']({'where':{'id':_0x2f835f}})[_0x7de6('0x2d')](function(_0xee8937){return _0xee8937[_0x7de6('0x62')]({'attributes':['id'],'raw':!![]})[_0x7de6('0x2d')](function(_0x33f9c8){var _0x288611=_[_0x7de6('0x63')](_0x33f9c8,'id');_0x3a842c(_0x288611);});})[_0x7de6('0x55')](function(_0x2a7ebc){_0x2889ea(_0x2a7ebc);});});} \ No newline at end of file +var _0x3268=['path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','fullname','recipientsDescription','isEmpty','beep','join','sequelize','transaction','UserNotification','create','senderName','forEach','recipient','emit','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','catch','User','union','ids','queue','replace','Queue','all','flatten','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x4f53a6,_0x582ff5){var _0x30e4b7=function(_0x1aaf04){while(--_0x1aaf04){_0x4f53a6['push'](_0x4f53a6['shift']());}};_0x30e4b7(++_0x582ff5);}(_0x3268,0xbb));var _0x8326=function(_0x20cc1e,_0x326ed6){_0x20cc1e=_0x20cc1e-0x0;var _0x3c967b=_0x3268[_0x20cc1e];return _0x3c967b;};'use strict';var emlformat=require(_0x8326('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8326('0x1'));var jsonpatch=require(_0x8326('0x2'));var rp=require(_0x8326('0x3'));var moment=require(_0x8326('0x4'));var BPromise=require(_0x8326('0x5'));var Mustache=require('mustache');var util=require(_0x8326('0x6'));var path=require(_0x8326('0x7'));var sox=require(_0x8326('0x8'));var csv=require(_0x8326('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8326('0xa'));var _=require(_0x8326('0xb'));var squel=require('squel');var crypto=require(_0x8326('0xc'));var jsforce=require(_0x8326('0xd'));var deskjs=require(_0x8326('0xe'));var toCsv=require(_0x8326('0x9'));var querystring=require('querystring');var Papa=require(_0x8326('0xf'));var Redis=require(_0x8326('0x10'));var authService=require(_0x8326('0x11'));var qs=require(_0x8326('0x12'));var as=require(_0x8326('0x13'));var hardwareService=require(_0x8326('0x14'));var logger=require(_0x8326('0x15'))(_0x8326('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8326('0x17'));var db=require(_0x8326('0x18'))['db'];config[_0x8326('0x19')]=_[_0x8326('0x1a')](config[_0x8326('0x19')],{'host':_0x8326('0x1b'),'port':0x18eb});var socket=require(_0x8326('0x1c'))(new Redis(config[_0x8326('0x19')]));require(_0x8326('0x1d'))[_0x8326('0x1e')](socket);function respondWithStatusCode(_0x179f54,_0x53b9ee){_0x53b9ee=_0x53b9ee||0xcc;return function(_0x20cbd4){if(_0x20cbd4){return _0x179f54[_0x8326('0x1f')](_0x53b9ee);}return _0x179f54[_0x8326('0x20')](_0x53b9ee)['end']();};}function respondWithResult(_0x2ceb9e,_0x5d5669){_0x5d5669=_0x5d5669||0xc8;return function(_0x38abb7){if(_0x38abb7){return _0x2ceb9e['status'](_0x5d5669)[_0x8326('0x21')](_0x38abb7);}};}function respondWithFilteredResult(_0x598c34,_0x3d318f){return function(_0x10a067){if(_0x10a067){var _0x4efde0=typeof _0x3d318f[_0x8326('0x22')]==='undefined'&&typeof _0x3d318f[_0x8326('0x23')]==='undefined';var _0x38b497=_0x10a067[_0x8326('0x24')];var _0x38309c=_0x4efde0?0x0:_0x3d318f[_0x8326('0x22')];var _0x1d5aae=_0x4efde0?_0x10a067[_0x8326('0x24')]:_0x3d318f[_0x8326('0x22')]+_0x3d318f[_0x8326('0x23')];var _0x5927f6;if(_0x1d5aae>=_0x38b497){_0x1d5aae=_0x38b497;_0x5927f6=0xc8;}else{_0x5927f6=0xce;}_0x598c34[_0x8326('0x20')](_0x5927f6);return _0x598c34['set'](_0x8326('0x25'),_0x38309c+'-'+_0x1d5aae+'/'+_0x38b497)[_0x8326('0x21')](_0x10a067);}return null;};}function patchUpdates(_0x4014db){return function(_0x59c9dc){try{jsonpatch[_0x8326('0x26')](_0x59c9dc,_0x4014db,!![]);}catch(_0x334ee5){return BPromise[_0x8326('0x27')](_0x334ee5);}return _0x59c9dc[_0x8326('0x28')]();};}function saveUpdates(_0x5b7091,_0x13f70a){return function(_0x1f3c9d){if(_0x1f3c9d){return _0x1f3c9d[_0x8326('0x29')](_0x5b7091)[_0x8326('0x2a')](function(_0x3050b3){return _0x3050b3;});}return null;};}function removeEntity(_0x14dae2,_0x9bd7bb){return function(_0x203089){if(_0x203089){return _0x203089[_0x8326('0x2b')]()['then'](function(){_0x14dae2['status'](0xcc)[_0x8326('0x2c')]();});}};}function handleEntityNotFound(_0x37ea41,_0x9ecbf0){return function(_0x17fad8){if(!_0x17fad8){_0x37ea41[_0x8326('0x1f')](0x194);}return _0x17fad8;};}function handleError(_0x29f3a6,_0x42d6a4){_0x42d6a4=_0x42d6a4||0x1f4;return function(_0x34eeac){logger[_0x8326('0x2d')](_0x34eeac[_0x8326('0x2e')]);if(_0x34eeac[_0x8326('0x2f')]){delete _0x34eeac[_0x8326('0x2f')];}_0x29f3a6[_0x8326('0x20')](_0x42d6a4)['send'](_0x34eeac);};}exports[_0x8326('0x30')]=function(_0x522dd3,_0x14f0c8,_0x3ace84){if(!_0x522dd3[_0x8326('0x31')][_0x8326('0x32')](_0x8326('0x33'))&&!_0x522dd3[_0x8326('0x31')]['hasOwnProperty'](_0x8326('0x34'))){throw new db[(_0x8326('0x35'))][(_0x8326('0x36'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x522dd3[_0x8326('0x31')][_0x8326('0x32')](_0x8326('0x34'))&&!_0x522dd3['body'][_0x8326('0x32')](_0x8326('0x37'))){throw new db['Sequelize'][(_0x8326('0x36'))](_0x8326('0x38'));}if(!_0x522dd3[_0x8326('0x31')][_0x8326('0x32')](_0x8326('0x39'))){throw new db['Sequelize'][(_0x8326('0x36'))](_0x8326('0x3a'));}else{try{var _0x3e33a1=JSON[_0x8326('0x3b')](_0x522dd3[_0x8326('0x31')][_0x8326('0x39')]);}catch(_0x54f2d8){logger[_0x8326('0x2d')](_0x54f2d8);throw new db[(_0x8326('0x35'))][(_0x8326('0x36'))](_0x8326('0x3c'));}var _0x3fb2d7=[_0x8326('0x3d'),'faxqueue',_0x8326('0x3e'),_0x8326('0x3f'),'smsqueue','voicequeue','whatsappqueue',_0x8326('0x40'),_0x8326('0x41')];if(_[_0x8326('0x42')](_0x3e33a1,function(_0xfe0d2c){return!_[_0x8326('0x43')](_0x3fb2d7,_0xfe0d2c[_0x8326('0x44')][_0x8326('0x45')]());})){throw new db[(_0x8326('0x35'))][(_0x8326('0x36'))](_0x8326('0x46'));}}}var _0x25aaf2={};_0x25aaf2['senderName']=_0x522dd3[_0x8326('0x31')][_0x8326('0x32')]('senderName')?_0x522dd3[_0x8326('0x31')]['senderName']:_0x522dd3[_0x8326('0x41')][_0x8326('0x47')];_0x25aaf2[_0x8326('0x48')]=_[_0x8326('0x49')](_0x522dd3[_0x8326('0x31')][_0x8326('0x48')])?null:_0x522dd3[_0x8326('0x31')]['recipientsDescription'];_0x25aaf2[_0x8326('0x4a')]=_0x522dd3['body'][_0x8326('0x4a')]||![];_0x25aaf2['SenderId']=_0x522dd3['user']['id'];return getContent(_0x522dd3[_0x8326('0x31')])[_0x8326('0x2a')](function(_0x943c1f){_0x25aaf2[_0x8326('0x31')]=_0x943c1f;return getRecipients(_0x3e33a1);})[_0x8326('0x2a')](function(_0x1881ad){_0x25aaf2['recipientsId']=_['sortBy'](_0x1881ad)[_0x8326('0x4b')](',');return db[_0x8326('0x4c')][_0x8326('0x4d')](function(_0x26b43c){return db[_0x8326('0x4e')][_0x8326('0x4f')](_0x25aaf2,{'raw':!![],'transaction':_0x26b43c})[_0x8326('0x2a')](function(_0x52c032){var _0x18f8cc={'sender':_0x25aaf2[_0x8326('0x50')],'description':_0x25aaf2['recipientsDescription'],'content':_0x25aaf2[_0x8326('0x31')],'beep':_0x25aaf2['beep']};_0x1881ad[_0x8326('0x51')](function(_0x126419){_0x18f8cc[_0x8326('0x52')]=_0x126419;socket[_0x8326('0x53')]('userNotification:send',_0x18f8cc);});return _0x52c032;});});})[_0x8326('0x2a')](respondWithResult(_0x14f0c8,0xc9))['catch'](handleError(_0x14f0c8,null));};function getContent(_0x34a1de){return new BPromise(function(_0xf98d6c,_0x26d881){if(_0x34a1de[_0x8326('0x33')]){_0xf98d6c(_0x34a1de[_0x8326('0x33')]);return;}return db[_0x8326('0x54')][_0x8326('0x55')]({'attributes':[_0x8326('0x56')],'where':{'id':_0x34a1de[_0x8326('0x34')]},'raw':!![]})[_0x8326('0x2a')](function(_0xc27f5d){if(!_0xc27f5d)throw new db[(_0x8326('0x35'))][(_0x8326('0x36'))](_0x8326('0x57'));var _0x1fd333=Mustache['render'](_0xc27f5d[_0x8326('0x56')],_0x34a1de[_0x8326('0x37')]);_0xf98d6c(_0x1fd333);})[_0x8326('0x58')](function(_0xd314b6){_0x26d881(_0xd314b6);});});}function getRecipients(_0x43af22){return new BPromise(function(_0x53334f,_0x2b9082){var _0x42453=[];var _0x3f40dc=[];_0x43af22[_0x8326('0x51')](function(_0x491285){var _0x5467e9=_['startCase'](_0x491285[_0x8326('0x44')][_0x8326('0x45')]());if(_0x5467e9===_0x8326('0x59')){_0x42453=_[_0x8326('0x5a')](_0x42453,_0x491285[_0x8326('0x5b')]);}else{if(_[_0x8326('0x43')](_0x5467e9,_0x8326('0x5c')))_0x5467e9=_0x5467e9[_0x8326('0x5d')](_0x8326('0x5c'),_0x8326('0x5e'));_0x491285[_0x8326('0x5b')][_0x8326('0x51')](function(_0x15f6c5){_0x3f40dc['push'](getAgents(_0x5467e9,_0x15f6c5));});}});return BPromise[_0x8326('0x5f')](_0x3f40dc)['then'](function(_0xd6bbd4){_0x42453=_['union'](_0x42453,_[_0x8326('0x60')](_0xd6bbd4));_0x53334f(_0x42453);})[_0x8326('0x58')](function(_0xdfac0d){_0x2b9082(_0xdfac0d);});});}function getAgents(_0x152984,_0x517db7){return new BPromise(function(_0x1cadbd,_0x43b0bd){return db[_0x152984][_0x8326('0x55')]({'where':{'id':_0x517db7}})[_0x8326('0x2a')](function(_0x1fa9e5){return _0x1fa9e5['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x5720e0){var _0x49890e=_['map'](_0x5720e0,'id');_0x1cadbd(_0x49890e);});})['catch'](function(_0x4575fd){_0x43b0bd(_0x4575fd);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 6b7aaa3..777ef38 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 _0xc63d=['events','../../mysqldb','UserNotification','save','update','emit','hook','exports'];(function(_0x3d779a,_0x2b7243){var _0x51e25c=function(_0x222109){while(--_0x222109){_0x3d779a['push'](_0x3d779a['shift']());}};_0x51e25c(++_0x2b7243);}(_0xc63d,0x130));var _0xdc63=function(_0x85d540,_0x47a3ef){_0x85d540=_0x85d540-0x0;var _0x4701c2=_0xc63d[_0x85d540];return _0x4701c2;};'use strict';var EventEmitter=require(_0xdc63('0x0'));var UserNotification=require(_0xdc63('0x1'))['db'][_0xdc63('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdc63('0x3'),'afterUpdate':_0xdc63('0x4'),'afterDestroy':'remove'};function emitEvent(_0x308be3){return function(_0x46b7b3,_0x447e7c,_0x252cb4){UserNotificationEvents[_0xdc63('0x5')](_0x308be3+':'+_0x46b7b3['id'],_0x46b7b3);UserNotificationEvents[_0xdc63('0x5')](_0x308be3,_0x46b7b3);_0x252cb4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xdc63('0x6')](e,emitEvent(event));}}module[_0xdc63('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x629a=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x322bef,_0x4890d4){var _0x229e60=function(_0x45f89b){while(--_0x45f89b){_0x322bef['push'](_0x322bef['shift']());}};_0x229e60(++_0x4890d4);}(_0x629a,0xff));var _0xa629=function(_0xbe0454,_0x13272f){_0xbe0454=_0xbe0454-0x0;var _0x51c015=_0x629a[_0xbe0454];return _0x51c015;};'use strict';var EventEmitter=require(_0xa629('0x0'));var UserNotification=require(_0xa629('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xa629('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa629('0x3'),'afterDestroy':_0xa629('0x4')};function emitEvent(_0x406841){return function(_0x277b4b,_0x165ab9,_0x522cab){UserNotificationEvents[_0xa629('0x5')](_0x406841+':'+_0x277b4b['id'],_0x277b4b);UserNotificationEvents['emit'](_0x406841,_0x277b4b);_0x522cab(null);};}for(var e in events){if(events[_0xa629('0x6')](e)){var event=events[e];UserNotification[_0xa629('0x7')](e,emitEvent(event));}}module[_0xa629('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 26b8440..2502cd0 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 _0x2f64=['UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','../../config/environment','./userNotification.attributes','exports'];(function(_0x3267d5,_0x82e4d6){var _0x279fac=function(_0x4a0708){while(--_0x4a0708){_0x3267d5['push'](_0x3267d5['shift']());}};_0x279fac(++_0x82e4d6);}(_0x2f64,0xba));var _0x42f6=function(_0x5101b8,_0xe57d1d){_0x5101b8=_0x5101b8-0x0;var _0x4644e0=_0x2f64[_0x5101b8];return _0x4644e0;};'use strict';var _=require('lodash');var util=require(_0x42f6('0x0'));var logger=require('../../config/logger')(_0x42f6('0x1'));var moment=require(_0x42f6('0x2'));var BPromise=require(_0x42f6('0x3'));var rp=require(_0x42f6('0x4'));var fs=require('fs');var path=require(_0x42f6('0x5'));var rimraf=require('rimraf');var config=require(_0x42f6('0x6'));var attributes=require(_0x42f6('0x7'));module[_0x42f6('0x8')]=function(_0x2539f4,_0x5b767a){return _0x2539f4['define'](_0x42f6('0x9'),attributes,{'tableName':_0x42f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x42f6('0xb'),'collate':_0x42f6('0xc')});}; \ No newline at end of file +var _0x90cf=['moment','bluebird','request-promise','path','./userNotification.attributes','exports','define','UserNotification','userNotifications','lodash','util'];(function(_0x4d91b4,_0x3d9e10){var _0x3e4be9=function(_0x43d10f){while(--_0x43d10f){_0x4d91b4['push'](_0x4d91b4['shift']());}};_0x3e4be9(++_0x3d9e10);}(_0x90cf,0x1b6));var _0xf90c=function(_0x75dbc1,_0x28096c){_0x75dbc1=_0x75dbc1-0x0;var _0x564daa=_0x90cf[_0x75dbc1];return _0x564daa;};'use strict';var _=require(_0xf90c('0x0'));var util=require(_0xf90c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf90c('0x2'));var BPromise=require(_0xf90c('0x3'));var rp=require(_0xf90c('0x4'));var fs=require('fs');var path=require(_0xf90c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf90c('0x6'));module[_0xf90c('0x7')]=function(_0x35bcaa,_0x5a896c){return _0x35bcaa[_0xf90c('0x8')](_0xf90c('0x9'),attributes,{'tableName':_0xf90c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 7b36f41..3a7b06e 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 _0xe08c=['register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','UserNotification,\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','redis','localhost','socket.io-emitter'];(function(_0xd8a959,_0x169203){var _0x536e01=function(_0x16fb33){while(--_0x16fb33){_0xd8a959['push'](_0xd8a959['shift']());}};_0x536e01(++_0x169203);}(_0xe08c,0x1b0));var _0xce08=function(_0x49d700,_0xeaf9f){_0x49d700=_0x49d700-0x0;var _0x2a2dc3=_0xe08c[_0x49d700];return _0x2a2dc3;};'use strict';var _=require(_0xce08('0x0'));var util=require(_0xce08('0x1'));var moment=require(_0xce08('0x2'));var BPromise=require(_0xce08('0x3'));var rs=require(_0xce08('0x4'));var fs=require('fs');var Redis=require(_0xce08('0x5'));var db=require(_0xce08('0x6'))['db'];var utils=require(_0xce08('0x7'));var logger=require(_0xce08('0x8'))('rpc');var config=require(_0xce08('0x9'));var jayson=require(_0xce08('0xa'));var client=jayson[_0xce08('0xb')][_0xce08('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0xce08('0xd')],{'host':_0xce08('0xe'),'port':0x18eb});var socket=require(_0xce08('0xf'))(new Redis(config[_0xce08('0xd')]));require('./userNotification.socket')[_0xce08('0x10')](socket);function respondWithRpcPromise(_0x11e8d0,_0x382f73,_0x33745e){return new BPromise(function(_0x25a12b,_0xd255fd){return client[_0xce08('0x11')](_0x11e8d0,_0x33745e)[_0xce08('0x12')](function(_0x1b6974){logger[_0xce08('0x13')](_0xce08('0x14'),_0x382f73,_0xce08('0x15'));logger['debug'](_0xce08('0x16'),_0x382f73,_0xce08('0x15'),JSON[_0xce08('0x17')](_0x1b6974));if(_0x1b6974[_0xce08('0x18')]){if(_0x1b6974[_0xce08('0x18')][_0xce08('0x19')]===0x1f4){logger[_0xce08('0x18')](_0xce08('0x14'),_0x382f73,_0x1b6974[_0xce08('0x18')][_0xce08('0x1a')]);return _0xd255fd(_0x1b6974[_0xce08('0x18')]['message']);}logger[_0xce08('0x18')](_0xce08('0x14'),_0x382f73,_0x1b6974[_0xce08('0x18')][_0xce08('0x1a')]);return _0x25a12b(_0x1b6974[_0xce08('0x18')]['message']);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x382f73,_0xce08('0x15'));_0x25a12b(_0x1b6974['result']['message']);}})[_0xce08('0x1b')](function(_0x22f6df){logger[_0xce08('0x18')](_0xce08('0x14'),_0x382f73,_0x22f6df);_0xd255fd(_0x22f6df);});});} \ No newline at end of file +var _0x6e32=['http','redis','defaults','socket.io-emitter','./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0x6e32,0x152));var _0x26e3=function(_0x1ad6b3,_0x487cc6){_0x1ad6b3=_0x1ad6b3-0x0;var _0x1f4e71=_0x6e32[_0x1ad6b3];return _0x1f4e71;};'use strict';var _=require(_0x26e3('0x0'));var util=require(_0x26e3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x26e3('0x2'));var fs=require('fs');var Redis=require(_0x26e3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x26e3('0x4'));var logger=require(_0x26e3('0x5'))(_0x26e3('0x6'));var config=require(_0x26e3('0x7'));var jayson=require(_0x26e3('0x8'));var client=jayson[_0x26e3('0x9')][_0x26e3('0xa')]({'port':0x232a});config[_0x26e3('0xb')]=_[_0x26e3('0xc')](config[_0x26e3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x26e3('0xd'))(new Redis(config[_0x26e3('0xb')]));require(_0x26e3('0xe'))[_0x26e3('0xf')](socket);function respondWithRpcPromise(_0x2f6cc9,_0x3ca3c4,_0x432f9c){return new BPromise(function(_0x2c01b7,_0x148556){return client[_0x26e3('0x10')](_0x2f6cc9,_0x432f9c)[_0x26e3('0x11')](function(_0x4761ff){logger['info'](_0x26e3('0x12'),_0x3ca3c4,_0x26e3('0x13'));logger[_0x26e3('0x14')](_0x26e3('0x15'),_0x3ca3c4,_0x26e3('0x13'),JSON[_0x26e3('0x16')](_0x4761ff));if(_0x4761ff[_0x26e3('0x17')]){if(_0x4761ff[_0x26e3('0x17')][_0x26e3('0x18')]===0x1f4){logger[_0x26e3('0x17')](_0x26e3('0x12'),_0x3ca3c4,_0x4761ff[_0x26e3('0x17')]['message']);return _0x148556(_0x4761ff['error'][_0x26e3('0x19')]);}logger[_0x26e3('0x17')](_0x26e3('0x12'),_0x3ca3c4,_0x4761ff[_0x26e3('0x17')][_0x26e3('0x19')]);return _0x2c01b7(_0x4761ff[_0x26e3('0x17')]['message']);}else{logger[_0x26e3('0x1a')](_0x26e3('0x12'),_0x3ca3c4,_0x26e3('0x13'));_0x2c01b7(_0x4761ff[_0x26e3('0x1b')][_0x26e3('0x19')]);}})[_0x26e3('0x1c')](function(_0x1fbebe){logger['error']('UserNotification,\x20%s,\x20%s',_0x3ca3c4,_0x1fbebe);_0x148556(_0x1fbebe);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 5101a82..b781141 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 _0xba24=['./userNotification.events','save','remove','update','emit','removeListener','register'];(function(_0x30caac,_0x470178){var _0x226383=function(_0x41cf90){while(--_0x41cf90){_0x30caac['push'](_0x30caac['shift']());}};_0x226383(++_0x470178);}(_0xba24,0x19d));var _0x4ba2=function(_0x32017e,_0x546c4c){_0x32017e=_0x32017e-0x0;var _0x19981c=_0xba24[_0x32017e];return _0x19981c;};'use strict';var UserNotificationEvents=require(_0x4ba2('0x0'));var events=[_0x4ba2('0x1'),_0x4ba2('0x2'),_0x4ba2('0x3')];function createListener(_0x5ee34e,_0x123696){return function(_0x10811f){_0x123696[_0x4ba2('0x4')](_0x5ee34e,_0x10811f);};}function removeListener(_0x5710ca,_0x2e9adf){return function(){UserNotificationEvents[_0x4ba2('0x5')](_0x5710ca,_0x2e9adf);};}exports[_0x4ba2('0x6')]=function(_0xaf9490){for(var _0x2db88a=0x0,_0x9df68=events['length'];_0x2db88a<_0x9df68;_0x2db88a++){var _0x524ebd=events[_0x2db88a];var _0x2e3b82=createListener('userNotification:'+_0x524ebd,_0xaf9490);UserNotificationEvents['on'](_0x524ebd,_0x2e3b82);}}; \ No newline at end of file +var _0xe9cb=['register','length','userNotification:','./userNotification.events','save','remove','update','removeListener'];(function(_0x1057ca,_0x316455){var _0x279fdd=function(_0x15102a){while(--_0x15102a){_0x1057ca['push'](_0x1057ca['shift']());}};_0x279fdd(++_0x316455);}(_0xe9cb,0x113));var _0xbe9c=function(_0x1c6145,_0x410a9d){_0x1c6145=_0x1c6145-0x0;var _0x224655=_0xe9cb[_0x1c6145];return _0x224655;};'use strict';var UserNotificationEvents=require(_0xbe9c('0x0'));var events=[_0xbe9c('0x1'),_0xbe9c('0x2'),_0xbe9c('0x3')];function createListener(_0x1521d6,_0x338f8a){return function(_0x5dc7c6){_0x338f8a['emit'](_0x1521d6,_0x5dc7c6);};}function removeListener(_0xa3a84b,_0x41fd25){return function(){UserNotificationEvents[_0xbe9c('0x4')](_0xa3a84b,_0x41fd25);};}exports[_0xbe9c('0x5')]=function(_0x265c7d){for(var _0x365f7a=0x0,_0xf62726=events[_0xbe9c('0x6')];_0x365f7a<_0xf62726;_0x365f7a++){var _0x33cdc8=events[_0x365f7a];var _0x442f44=createListener(_0xbe9c('0x7')+_0x33cdc8,_0x265c7d);UserNotificationEvents['on'](_0x33cdc8,_0x442f44);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index abf472b..0312ec6 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2ec9d4,_0x442f46){var _0x580f63=function(_0x4b4f02){while(--_0x4b4f02){_0x2ec9d4['push'](_0x2ec9d4['shift']());}};_0x580f63(++_0x442f46);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xc0d9bc,_0x2bd6be){_0xc0d9bc=_0xc0d9bc-0x0;var _0x32ff73=_0xcb91[_0xc0d9bc];return _0x32ff73;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2c50f8,_0x8251dc){var _0x4e265f=function(_0x168094){while(--_0x168094){_0x2c50f8['push'](_0x2c50f8['shift']());}};_0x4e265f(++_0x8251dc);}(_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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 4e8c9c1..e761e24 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 _0x7e15=['INTEGER','exports'];(function(_0x2584cd,_0x8f38ae){var _0x560865=function(_0x2dc236){while(--_0x2dc236){_0x2584cd['push'](_0x2584cd['shift']());}};_0x560865(++_0x8f38ae);}(_0x7e15,0x1e5));var _0x57e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7e15[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x57e1('0x0')]={'penalty':{'type':Sequelize[_0x57e1('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0d8d=['exports','INTEGER','sequelize'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0d8d,0x1f4));var _0xd0d8=function(_0x534b5a,_0x2ed076){_0x534b5a=_0x534b5a-0x0;var _0x311184=_0x0d8d[_0x534b5a];return _0x311184;};'use strict';var Sequelize=require(_0xd0d8('0x0'));module[_0xd0d8('0x1')]={'penalty':{'type':Sequelize[_0xd0d8('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 51326c1..2a88add 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 _0xe8e4=['moment','bluebird','request-promise','../../config/environment','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','api'];(function(_0x1c3871,_0x41bde8){var _0xd4d12c=function(_0x3e942e){while(--_0x3e942e){_0x1c3871['push'](_0x1c3871['shift']());}};_0xd4d12c(++_0x41bde8);}(_0xe8e4,0x19f));var _0x4e8e=function(_0x5f44df,_0x4d6c83){_0x5f44df=_0x5f44df-0x0;var _0x3fb1e2=_0xe8e4[_0x5f44df];return _0x3fb1e2;};'use strict';var _=require(_0x4e8e('0x0'));var util=require(_0x4e8e('0x1'));var logger=require('../../config/logger')(_0x4e8e('0x2'));var moment=require(_0x4e8e('0x3'));var BPromise=require(_0x4e8e('0x4'));var rp=require(_0x4e8e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4e8e('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x4e8e('0x7')]=function(_0x244705,_0x25e607){return _0x244705[_0x4e8e('0x8')](_0x4e8e('0x9'),attributes,{'tableName':_0x4e8e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5809=['path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','../../config/logger','api','moment','request-promise'];(function(_0x5cea9e,_0x45e83f){var _0x155b94=function(_0x30e40a){while(--_0x30e40a){_0x5cea9e['push'](_0x5cea9e['shift']());}};_0x155b94(++_0x45e83f);}(_0x5809,0xf6));var _0x9580=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5809[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9580('0x0'))(_0x9580('0x1'));var moment=require(_0x9580('0x2'));var BPromise=require('bluebird');var rp=require(_0x9580('0x3'));var fs=require('fs');var path=require(_0x9580('0x4'));var rimraf=require(_0x9580('0x5'));var config=require(_0x9580('0x6'));var attributes=require(_0x9580('0x7'));module[_0x9580('0x8')]=function(_0x587f61,_0x22ed9b){return _0x587f61['define'](_0x9580('0x9'),attributes,{'tableName':'user_has_openchannel_queues','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 69f5403..e37c82b 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 _0x7f9f=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xce8797,_0xd2b461){var _0x18f85c=function(_0x2242cb){while(--_0x2242cb){_0xce8797['push'](_0xce8797['shift']());}};_0x18f85c(++_0xd2b461);}(_0x7f9f,0x102));var _0xf7f9=function(_0x4d8c9c,_0x2dcf3a){_0x4d8c9c=_0x4d8c9c-0x0;var _0xaf1e04=_0x7f9f[_0x4d8c9c];return _0xaf1e04;};'use strict';var _=require(_0xf7f9('0x0'));var util=require(_0xf7f9('0x1'));var moment=require(_0xf7f9('0x2'));var BPromise=require(_0xf7f9('0x3'));var rs=require(_0xf7f9('0x4'));var fs=require('fs');var Redis=require(_0xf7f9('0x5'));var db=require(_0xf7f9('0x6'))['db'];var utils=require(_0xf7f9('0x7'));var logger=require('../../config/logger')(_0xf7f9('0x8'));var config=require(_0xf7f9('0x9'));var jayson=require(_0xf7f9('0xa'));var client=jayson['client'][_0xf7f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23ba33,_0x55e4bb,_0x2b36c3){return new BPromise(function(_0x4b2ada,_0x3c7bf8){return client[_0xf7f9('0xc')](_0x23ba33,_0x2b36c3)[_0xf7f9('0xd')](function(_0xd96b85){logger[_0xf7f9('0xe')](_0xf7f9('0xf'),_0x55e4bb,_0xf7f9('0x10'));logger[_0xf7f9('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x55e4bb,_0xf7f9('0x10'),JSON[_0xf7f9('0x12')](_0xd96b85));if(_0xd96b85[_0xf7f9('0x13')]){if(_0xd96b85[_0xf7f9('0x13')][_0xf7f9('0x14')]===0x1f4){logger[_0xf7f9('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x55e4bb,_0xd96b85[_0xf7f9('0x13')][_0xf7f9('0x15')]);return _0x3c7bf8(_0xd96b85[_0xf7f9('0x13')]['message']);}logger[_0xf7f9('0x13')](_0xf7f9('0xf'),_0x55e4bb,_0xd96b85[_0xf7f9('0x13')][_0xf7f9('0x15')]);return _0x4b2ada(_0xd96b85[_0xf7f9('0x13')][_0xf7f9('0x15')]);}else{logger[_0xf7f9('0xe')](_0xf7f9('0xf'),_0x55e4bb,_0xf7f9('0x10'));_0x4b2ada(_0xd96b85[_0xf7f9('0x16')][_0xf7f9('0x15')]);}})[_0xf7f9('0x17')](function(_0x4ed3cd){logger[_0xf7f9('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x55e4bb,_0x4ed3cd);_0x3c7bf8(_0x4ed3cd);});});} \ No newline at end of file +var _0x1b78=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5af962,_0x416289){var _0x5f3352=function(_0x2b58a0){while(--_0x2b58a0){_0x5af962['push'](_0x5af962['shift']());}};_0x5f3352(++_0x416289);}(_0x1b78,0xf1));var _0x81b7=function(_0x121e7e,_0x560fac){_0x121e7e=_0x121e7e-0x0;var _0x39a83f=_0x1b78[_0x121e7e];return _0x39a83f;};'use strict';var _=require(_0x81b7('0x0'));var util=require(_0x81b7('0x1'));var moment=require('moment');var BPromise=require(_0x81b7('0x2'));var rs=require(_0x81b7('0x3'));var fs=require('fs');var Redis=require(_0x81b7('0x4'));var db=require(_0x81b7('0x5'))['db'];var utils=require(_0x81b7('0x6'));var logger=require(_0x81b7('0x7'))(_0x81b7('0x8'));var config=require(_0x81b7('0x9'));var jayson=require(_0x81b7('0xa'));var client=jayson[_0x81b7('0xb')][_0x81b7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22e165,_0x38c277,_0x5add1d){return new BPromise(function(_0x29244a,_0x19c1b5){return client[_0x81b7('0xd')](_0x22e165,_0x5add1d)[_0x81b7('0xe')](function(_0x340c1d){logger[_0x81b7('0xf')](_0x81b7('0x10'),_0x38c277,_0x81b7('0x11'));logger['debug'](_0x81b7('0x12'),_0x38c277,_0x81b7('0x11'),JSON[_0x81b7('0x13')](_0x340c1d));if(_0x340c1d[_0x81b7('0x14')]){if(_0x340c1d[_0x81b7('0x14')][_0x81b7('0x15')]===0x1f4){logger[_0x81b7('0x14')](_0x81b7('0x10'),_0x38c277,_0x340c1d[_0x81b7('0x14')]['message']);return _0x19c1b5(_0x340c1d['error'][_0x81b7('0x16')]);}logger['error'](_0x81b7('0x10'),_0x38c277,_0x340c1d['error']['message']);return _0x29244a(_0x340c1d['error'][_0x81b7('0x16')]);}else{logger[_0x81b7('0xf')](_0x81b7('0x10'),_0x38c277,_0x81b7('0x11'));_0x29244a(_0x340c1d['result'][_0x81b7('0x16')]);}})[_0x81b7('0x17')](function(_0x283e3c){logger[_0x81b7('0x14')](_0x81b7('0x10'),_0x38c277,_0x283e3c);_0x19c1b5(_0x283e3c);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index e030a56..66b6d87 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 _0x3b6c=['getResources','post','create','/:id/clone','clone','addSections','put','update','delete','destroy','removeSections','removeResources','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./userProfile.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources'];(function(_0x5aaddf,_0x3bd01b){var _0x5fa18e=function(_0x8f9bb2){while(--_0x8f9bb2){_0x5aaddf['push'](_0x5aaddf['shift']());}};_0x5fa18e(++_0x3bd01b);}(_0x3b6c,0x138));var _0xc3b6=function(_0x334bbd,_0x1a9e64){_0x334bbd=_0x334bbd-0x0;var _0x39cd75=_0x3b6c[_0x334bbd];return _0x39cd75;};'use strict';var multer=require(_0xc3b6('0x0'));var util=require(_0xc3b6('0x1'));var path=require(_0xc3b6('0x2'));var timeout=require(_0xc3b6('0x3'));var express=require(_0xc3b6('0x4'));var router=express[_0xc3b6('0x5')]();var fs_extra=require(_0xc3b6('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc3b6('0x7'));var controller=require(_0xc3b6('0x8'));router[_0xc3b6('0x9')]('/',auth[_0xc3b6('0xa')](),controller['index']);router[_0xc3b6('0x9')](_0xc3b6('0xb'),auth[_0xc3b6('0xa')](),controller[_0xc3b6('0xc')]);router[_0xc3b6('0x9')](_0xc3b6('0xd'),auth[_0xc3b6('0xa')](),controller[_0xc3b6('0xe')]);router[_0xc3b6('0x9')](_0xc3b6('0xf'),auth[_0xc3b6('0xa')](),controller[_0xc3b6('0x10')]);router[_0xc3b6('0x9')](_0xc3b6('0x11'),auth[_0xc3b6('0xa')](),controller[_0xc3b6('0x12')]);router[_0xc3b6('0x13')]('/',auth['isAuthenticated'](),controller[_0xc3b6('0x14')]);router['post'](_0xc3b6('0x15'),auth['isAuthenticated'](),controller[_0xc3b6('0x16')]);router['post']('/:id/sections',auth['isAuthenticated'](),controller[_0xc3b6('0x17')]);router[_0xc3b6('0x13')](_0xc3b6('0x11'),auth['isAuthenticated'](),controller['addResources']);router[_0xc3b6('0x18')](_0xc3b6('0xd'),auth[_0xc3b6('0xa')](),controller[_0xc3b6('0x19')]);router[_0xc3b6('0x1a')](_0xc3b6('0xd'),auth[_0xc3b6('0xa')](),controller[_0xc3b6('0x1b')]);router[_0xc3b6('0x1a')]('/:id/sections',auth[_0xc3b6('0xa')](),controller[_0xc3b6('0x1c')]);router[_0xc3b6('0x1a')]('/:id/resources',auth['isAuthenticated'](),controller[_0xc3b6('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x201d=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','/:id/sections','addSections','addResources','put','update','delete','destroy','removeSections','exports','multer','util'];(function(_0x4b5c83,_0x2093c5){var _0xfb5ac7=function(_0x4df095){while(--_0x4df095){_0x4b5c83['push'](_0x4b5c83['shift']());}};_0xfb5ac7(++_0x2093c5);}(_0x201d,0x184));var _0xd201=function(_0x53cd3e,_0x37f555){_0x53cd3e=_0x53cd3e-0x0;var _0x5a6fb4=_0x201d[_0x53cd3e];return _0x5a6fb4;};'use strict';var multer=require(_0xd201('0x0'));var util=require(_0xd201('0x1'));var path=require(_0xd201('0x2'));var timeout=require(_0xd201('0x3'));var express=require(_0xd201('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd201('0x5'));var interaction=require(_0xd201('0x6'));var config=require(_0xd201('0x7'));var controller=require('./userProfile.controller');router[_0xd201('0x8')]('/',auth[_0xd201('0x9')](),controller['index']);router[_0xd201('0x8')](_0xd201('0xa'),auth[_0xd201('0x9')](),controller[_0xd201('0xb')]);router[_0xd201('0x8')](_0xd201('0xc'),auth[_0xd201('0x9')](),controller[_0xd201('0xd')]);router['get']('/:id/sections',auth[_0xd201('0x9')](),controller[_0xd201('0xe')]);router[_0xd201('0x8')](_0xd201('0xf'),auth[_0xd201('0x9')](),controller[_0xd201('0x10')]);router[_0xd201('0x11')]('/',auth[_0xd201('0x9')](),controller[_0xd201('0x12')]);router[_0xd201('0x11')](_0xd201('0x13'),auth[_0xd201('0x9')](),controller[_0xd201('0x14')]);router[_0xd201('0x11')](_0xd201('0x15'),auth[_0xd201('0x9')](),controller[_0xd201('0x16')]);router[_0xd201('0x11')](_0xd201('0xf'),auth[_0xd201('0x9')](),controller[_0xd201('0x17')]);router[_0xd201('0x18')](_0xd201('0xc'),auth[_0xd201('0x9')](),controller[_0xd201('0x19')]);router[_0xd201('0x1a')](_0xd201('0xc'),auth['isAuthenticated'](),controller[_0xd201('0x1b')]);router[_0xd201('0x1a')](_0xd201('0x15'),auth['isAuthenticated'](),controller[_0xd201('0x1c')]);router['delete'](_0xd201('0xf'),auth[_0xd201('0x9')](),controller['removeResources']);module[_0xd201('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 5fc5d0f..1ab7f50 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 _0x5527=['getDataValue','STRING','BOOLEAN','setDataValue','crudPermissions','join'];(function(_0xef9f7f,_0x259a17){var _0x6ca606=function(_0x1c200f){while(--_0x1c200f){_0xef9f7f['push'](_0xef9f7f['shift']());}};_0x6ca606(++_0x259a17);}(_0x5527,0x105));var _0x7552=function(_0x51e99b,_0x2d7d42){_0x51e99b=_0x51e99b-0x0;var _0x2af489=_0x5527[_0x51e99b];return _0x2af489;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x246c19){this[_0x7552('0x0')](_0x7552('0x1'),_0x246c19?_0x246c19[_0x7552('0x2')](''):[]);},'get':function(){return this['getDataValue'](_0x7552('0x1'))?this[_0x7552('0x3')](_0x7552('0x1'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x7552('0x4')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x7552('0x5')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x7552('0x5')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x7552('0x5')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x274f=['join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','crudPermissions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x274f,0xd6));var _0xf274=function(_0xfc2644,_0x4a3b13){_0xfc2644=_0xfc2644-0x0;var _0x4873b7=_0x274f[_0xfc2644];return _0x4873b7;};'use strict';var Sequelize=require(_0xf274('0x0'));module[_0xf274('0x1')]={'name':{'type':Sequelize[_0xf274('0x2')],'allowNull':![],'unique':_0xf274('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x5c0382){this[_0xf274('0x4')](_0xf274('0x5'),_0x5c0382?_0x5c0382[_0xf274('0x6')](''):[]);},'get':function(){return this[_0xf274('0x7')](_0xf274('0x5'))?this[_0xf274('0x7')](_0xf274('0x5'))[_0xf274('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xf274('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xf274('0x9')],'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 73d6d95..6b66131 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 _0xb7aa=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','clone','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileSection','update','describe','UserProfileResource','push','removeSections','ids','getSections','includes','enabled','subsections','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','section','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','index','map','UserProfile','type','key','model','name','keys','query','filters'];(function(_0x1754fb,_0x5b176a){var _0x474cb4=function(_0x1a9fd7){while(--_0x1a9fd7){_0x1754fb['push'](_0x1754fb['shift']());}};_0x474cb4(++_0x5b176a);}(_0xb7aa,0x11a));var _0xab7a=function(_0x34b57c,_0x97c5c9){_0x34b57c=_0x34b57c-0x0;var _0x2ac76b=_0xb7aa[_0x34b57c];return _0x2ac76b;};'use strict';var emlformat=require(_0xab7a('0x0'));var rimraf=require(_0xab7a('0x1'));var zipdir=require(_0xab7a('0x2'));var jsonpatch=require(_0xab7a('0x3'));var rp=require(_0xab7a('0x4'));var moment=require(_0xab7a('0x5'));var BPromise=require(_0xab7a('0x6'));var Mustache=require(_0xab7a('0x7'));var util=require(_0xab7a('0x8'));var path=require(_0xab7a('0x9'));var sox=require('sox');var csv=require(_0xab7a('0xa'));var ejs=require(_0xab7a('0xb'));var fs=require('fs');var fs_extra=require(_0xab7a('0xc'));var _=require(_0xab7a('0xd'));var squel=require('squel');var crypto=require(_0xab7a('0xe'));var jsforce=require(_0xab7a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xab7a('0xa'));var querystring=require(_0xab7a('0x10'));var Papa=require(_0xab7a('0x11'));var Redis=require(_0xab7a('0x12'));var authService=require(_0xab7a('0x13'));var qs=require(_0xab7a('0x14'));var as=require(_0xab7a('0x15'));var hardwareService=require(_0xab7a('0x16'));var logger=require(_0xab7a('0x17'))(_0xab7a('0x18'));var utils=require('../../config/utils');var config=require(_0xab7a('0x19'));var licenseUtil=require(_0xab7a('0x1a'));var db=require(_0xab7a('0x1b'))['db'];config[_0xab7a('0x1c')]=_['defaults'](config[_0xab7a('0x1c')],{'host':_0xab7a('0x1d'),'port':0x18eb});var socket=require(_0xab7a('0x1e'))(new Redis(config[_0xab7a('0x1c')]));require('./userProfile.socket')[_0xab7a('0x1f')](socket);function respondWithStatusCode(_0x1cc43f,_0x4a78b8){_0x4a78b8=_0x4a78b8||0xcc;return function(_0x899a95){if(_0x899a95){return _0x1cc43f[_0xab7a('0x20')](_0x4a78b8);}return _0x1cc43f[_0xab7a('0x21')](_0x4a78b8)[_0xab7a('0x22')]();};}function respondWithResult(_0x30146c,_0x522f10){_0x522f10=_0x522f10||0xc8;return function(_0x198e78){if(_0x198e78){return _0x30146c[_0xab7a('0x21')](_0x522f10)['json'](_0x198e78);}};}function respondWithFilteredResult(_0x203980,_0x177c90){return function(_0x187f51){if(_0x187f51){var _0xc3bb41=typeof _0x177c90[_0xab7a('0x23')]===_0xab7a('0x24')&&typeof _0x177c90[_0xab7a('0x25')]==='undefined';var _0x41f3c0=_0x187f51[_0xab7a('0x26')];var _0x16ce64=_0xc3bb41?0x0:_0x177c90[_0xab7a('0x23')];var _0x2fa287=_0xc3bb41?_0x187f51[_0xab7a('0x26')]:_0x177c90[_0xab7a('0x23')]+_0x177c90[_0xab7a('0x25')];var _0x169988;if(_0x2fa287>=_0x41f3c0){_0x2fa287=_0x41f3c0;_0x169988=0xc8;}else{_0x169988=0xce;}_0x203980[_0xab7a('0x21')](_0x169988);return _0x203980[_0xab7a('0x27')]('Content-Range',_0x16ce64+'-'+_0x2fa287+'/'+_0x41f3c0)['json'](_0x187f51);}return null;};}function patchUpdates(_0x5c4c3e){return function(_0x60ad2b){try{jsonpatch[_0xab7a('0x28')](_0x60ad2b,_0x5c4c3e,!![]);}catch(_0x33f484){return BPromise[_0xab7a('0x29')](_0x33f484);}return _0x60ad2b[_0xab7a('0x2a')]();};}function saveUpdates(_0x8c1e1f,_0x3324f2){return function(_0x533680){if(_0x533680){return _0x533680['update'](_0x8c1e1f)[_0xab7a('0x2b')](function(_0x4a13dd){return _0x4a13dd;});}return null;};}function removeEntity(_0x4d8e6b,_0x249904){return function(_0x570a8b){if(_0x570a8b){return _0x570a8b[_0xab7a('0x2c')]()[_0xab7a('0x2b')](function(){_0x4d8e6b[_0xab7a('0x21')](0xcc)[_0xab7a('0x22')]();});}};}function handleEntityNotFound(_0x2b0885,_0x5bd2b2){return function(_0x14fbee){if(!_0x14fbee){_0x2b0885[_0xab7a('0x20')](0x194);}return _0x14fbee;};}function handleError(_0x26c106,_0x4e4514){_0x4e4514=_0x4e4514||0x1f4;return function(_0x42f40b){logger[_0xab7a('0x2d')](_0x42f40b[_0xab7a('0x2e')]);if(_0x42f40b['name']){delete _0x42f40b['name'];}_0x26c106[_0xab7a('0x21')](_0x4e4514)['send'](_0x42f40b);};}exports[_0xab7a('0x2f')]=function(_0x3dfbaf,_0x5a1eb4){var _0x14065b={},_0x3d31a1={},_0x467dce={'count':0x0,'rows':[]};var _0x6e0d82=_[_0xab7a('0x30')](db[_0xab7a('0x31')]['rawAttributes'],function(_0x44ba02){return{'name':_0x44ba02['fieldName'],'type':_0x44ba02[_0xab7a('0x32')][_0xab7a('0x33')]};});_0x3d31a1[_0xab7a('0x34')]=_['map'](_0x6e0d82,_0xab7a('0x35'));_0x3d31a1['query']=_[_0xab7a('0x36')](_0x3dfbaf[_0xab7a('0x37')]);_0x3d31a1[_0xab7a('0x38')]=_[_0xab7a('0x39')](_0x3d31a1[_0xab7a('0x34')],_0x3d31a1[_0xab7a('0x37')]);_0x14065b[_0xab7a('0x3a')]=_[_0xab7a('0x39')](_0x3d31a1['model'],qs[_0xab7a('0x3b')](_0x3dfbaf[_0xab7a('0x37')][_0xab7a('0x3b')]));_0x14065b[_0xab7a('0x3a')]=_0x14065b['attributes'][_0xab7a('0x3c')]?_0x14065b[_0xab7a('0x3a')]:_0x3d31a1[_0xab7a('0x34')];if(!_0x3dfbaf['query'][_0xab7a('0x3d')](_0xab7a('0x3e'))){_0x14065b[_0xab7a('0x25')]=qs[_0xab7a('0x25')](_0x3dfbaf['query'][_0xab7a('0x25')]);_0x14065b[_0xab7a('0x23')]=qs[_0xab7a('0x23')](_0x3dfbaf['query']['offset']);}_0x14065b[_0xab7a('0x3f')]=qs['sort'](_0x3dfbaf[_0xab7a('0x37')][_0xab7a('0x40')]);_0x14065b['where']=qs['filters'](_[_0xab7a('0x41')](_0x3dfbaf[_0xab7a('0x37')],_0x3d31a1[_0xab7a('0x38')]),_0x6e0d82);if(_0x3dfbaf[_0xab7a('0x37')]['filter']){_0x14065b['where']=_[_0xab7a('0x42')](_0x14065b[_0xab7a('0x43')],{'$or':_[_0xab7a('0x30')](_0x6e0d82,function(_0x42f2db){if(_0x42f2db['type']!==_0xab7a('0x44')){var _0xcac61={};_0xcac61[_0x42f2db[_0xab7a('0x35')]]={'$like':'%'+_0x3dfbaf['query'][_0xab7a('0x45')]+'%'};return _0xcac61;}})});}_0x14065b=_[_0xab7a('0x42')]({},_0x14065b,_0x3dfbaf[_0xab7a('0x46')]);var _0x9cfc25={'where':_0x14065b['where']};return db[_0xab7a('0x31')]['count'](_0x9cfc25)[_0xab7a('0x2b')](function(_0x1bf286){_0x467dce[_0xab7a('0x26')]=_0x1bf286;if(_0x3dfbaf['query'][_0xab7a('0x47')]){_0x14065b[_0xab7a('0x48')]=[{'all':!![]}];}return db[_0xab7a('0x31')][_0xab7a('0x49')](_0x14065b);})['then'](function(_0x2ddf18){_0x467dce[_0xab7a('0x4a')]=_0x2ddf18;return _0x467dce;})[_0xab7a('0x2b')](respondWithFilteredResult(_0x5a1eb4,_0x14065b))[_0xab7a('0x4b')](handleError(_0x5a1eb4,null));};exports['show']=function(_0x111d2a,_0x5c03b5){var _0x2fe553={'raw':![],'where':{'id':_0x111d2a[_0xab7a('0x4c')]['id']}},_0x4d980a={};_0x4d980a[_0xab7a('0x34')]=_['keys'](db[_0xab7a('0x31')][_0xab7a('0x4d')]);_0x4d980a[_0xab7a('0x37')]=_[_0xab7a('0x36')](_0x111d2a[_0xab7a('0x37')]);_0x4d980a[_0xab7a('0x38')]=_['intersection'](_0x4d980a['model'],_0x4d980a[_0xab7a('0x37')]);_0x2fe553[_0xab7a('0x3a')]=_[_0xab7a('0x39')](_0x4d980a[_0xab7a('0x34')],qs[_0xab7a('0x3b')](_0x111d2a[_0xab7a('0x37')][_0xab7a('0x3b')]));_0x2fe553[_0xab7a('0x3a')]=_0x2fe553[_0xab7a('0x3a')][_0xab7a('0x3c')]?_0x2fe553[_0xab7a('0x3a')]:_0x4d980a[_0xab7a('0x34')];if(_0x111d2a['query']['includeAll']){_0x2fe553[_0xab7a('0x48')]=[{'all':!![]}];}_0x2fe553=_[_0xab7a('0x42')]({},_0x2fe553,_0x111d2a[_0xab7a('0x46')]);return db['UserProfile'][_0xab7a('0x4e')](_0x2fe553)['then'](handleEntityNotFound(_0x5c03b5,null))[_0xab7a('0x2b')](respondWithResult(_0x5c03b5,null))[_0xab7a('0x4b')](handleError(_0x5c03b5,null));};exports['create']=function(_0x49438f,_0x5081e6){return db[_0xab7a('0x31')][_0xab7a('0x4f')](_0x49438f['body'],{})['then'](respondWithResult(_0x5081e6,0xc9))[_0xab7a('0x4b')](handleError(_0x5081e6,null));};exports[_0xab7a('0x50')]=function(_0xf7344c,_0x1ba1ef){var _0x18fed9={'where':{'id':_0xf7344c['params']['id']}},_0x59e28d={};_0x59e28d[_0xab7a('0x34')]=_['keys'](db[_0xab7a('0x31')]['rawAttributes']);_0x18fed9[_0xab7a('0x3a')]=_[_0xab7a('0x39')](_0x59e28d[_0xab7a('0x34')],qs[_0xab7a('0x3b')](_0xf7344c[_0xab7a('0x37')][_0xab7a('0x3b')]));_0x18fed9[_0xab7a('0x3a')]=_0x18fed9[_0xab7a('0x3a')][_0xab7a('0x3c')]?_0x18fed9[_0xab7a('0x3a')]:_0x59e28d[_0xab7a('0x34')];if(_0xf7344c['query'][_0xab7a('0x47')]){_0x18fed9[_0xab7a('0x48')]=[{'all':!![]}];}_0x18fed9=_[_0xab7a('0x42')]({},_0x18fed9,_0xf7344c[_0xab7a('0x46')]);return db['UserProfile']['find'](_0x18fed9)['then'](handleEntityNotFound(_0x1ba1ef,null))[_0xab7a('0x2b')](function(_0x114dc6){if(_0x114dc6){var _0x49f75e=_0x114dc6[_0xab7a('0x51')]({'plain':!![]});_0x49f75e=qs[_0xab7a('0x52')](_0x49f75e,['id',_0xab7a('0x53'),_0xab7a('0x54'),_0xab7a('0x55')]);_0xf7344c[_0xab7a('0x56')]=_[_0xab7a('0x52')](_0xf7344c[_0xab7a('0x56')],['id',_0xab7a('0x53'),_0xab7a('0x54')]);return db[_0xab7a('0x57')][_0xab7a('0x58')](function(_0x4ef38e){return db['UserProfile'][_0xab7a('0x4f')](_[_0xab7a('0x42')](_0x49f75e,_0xf7344c[_0xab7a('0x56')]),{'include':_0xf7344c['query'][_0xab7a('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x4ef38e})['then'](function(_0x2470b4){var _0x59c336=_0x2470b4[_0xab7a('0x51')]({'plain':!![]});return db['UserProfileSection'][_0xab7a('0x49')]({'where':{'userProfileId':_0xf7344c[_0xab7a('0x4c')]['id']},'raw':!![]})[_0xab7a('0x2b')](function(_0x187198){if(_0x187198){return BPromise[_0xab7a('0x59')](_0x187198,function(_0x13762f){return new BPromise(function(_0x23055d,_0xfb96fa){if(_0x13762f[_0xab7a('0x5a')]===null||_0x13762f['autoAssociation']===0x1)_0x23055d(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x13762f['id']},'raw':!![]})[_0xab7a('0x2b')](function(_0x2964d7){var _0x47bf46=_[_0xab7a('0x30')](_0x2964d7,function(_0x40669c){return qs[_0xab7a('0x52')](_0x40669c,['id',_0xab7a('0x53'),_0xab7a('0x54'),_0xab7a('0x5b')]);});_0x23055d(_0x47bf46);})[_0xab7a('0x4b')](function(_0x5312e4){_0xfb96fa(_0x5312e4);});})['then'](function(_0x17b982){var _0x44e31c=qs[_0xab7a('0x52')](_0x13762f,['id',_0xab7a('0x53'),_0xab7a('0x54')]);_0x44e31c[_0xab7a('0x5c')]=_0x59c336['id'];if(_0x17b982)_0x44e31c[_0xab7a('0x5d')]=_0x17b982;return _0x44e31c;})[_0xab7a('0x2b')](function(_0x37db85){return db[_0xab7a('0x5e')][_0xab7a('0x4f')](_0x37db85,{'include':[{'model':db['UserProfileResource'],'as':_0xab7a('0x5d')}],'raw':!![],'transaction':_0x4ef38e});});})['then'](function(){return _0x59c336;});}});});});}})[_0xab7a('0x2b')](respondWithResult(_0x1ba1ef,0xc9))[_0xab7a('0x4b')](handleError(_0x1ba1ef,null));};exports[_0xab7a('0x5f')]=function(_0x54307b,_0x520c83){if(_0x54307b['body']['id']){delete _0x54307b['body']['id'];}return db[_0xab7a('0x31')][_0xab7a('0x4e')]({'where':{'id':_0x54307b['params']['id']}})[_0xab7a('0x2b')](handleEntityNotFound(_0x520c83,null))[_0xab7a('0x2b')](saveUpdates(_0x54307b[_0xab7a('0x56')],null))[_0xab7a('0x2b')](respondWithResult(_0x520c83,null))[_0xab7a('0x4b')](handleError(_0x520c83,null));};exports[_0xab7a('0x2c')]=function(_0x12bc47,_0xfbdb0f){return db[_0xab7a('0x31')][_0xab7a('0x4e')]({'where':{'id':_0x12bc47['params']['id']}})[_0xab7a('0x2b')](handleEntityNotFound(_0xfbdb0f,null))[_0xab7a('0x2b')](removeEntity(_0xfbdb0f,null))[_0xab7a('0x4b')](handleError(_0xfbdb0f,null));};exports[_0xab7a('0x60')]=function(_0x3c3fe5,_0x5bfa32){return db[_0xab7a('0x31')][_0xab7a('0x60')]()[_0xab7a('0x2b')](respondWithResult(_0x5bfa32,null))['catch'](handleError(_0x5bfa32,null));};exports['addSections']=function(_0x40d4f0,_0x4cc81a){var _0x26282e=_0x40d4f0['body'];return db[_0xab7a('0x31')][_0xab7a('0x4e')]({'where':{'id':_0x40d4f0[_0xab7a('0x4c')]['id']}})[_0xab7a('0x2b')](handleEntityNotFound(_0x4cc81a,null))[_0xab7a('0x2b')](function(_0x354556){if(_0x354556){return db[_0xab7a('0x57')]['transaction'](function(_0x5267b7){return db[_0xab7a('0x5e')][_0xab7a('0x2c')]({'where':{'userProfileId':_0x40d4f0[_0xab7a('0x4c')]['id'],'sectionId':_['map'](_0x26282e,function(_0x2c54c3){return _0x2c54c3['sectionId'];})},'transaction':_0x5267b7})[_0xab7a('0x2b')](function(){var _0x369fe8=_[_0xab7a('0x30')](_0x26282e,function(_0x27b603){_0x27b603[_0xab7a('0x5c')]=_0x40d4f0[_0xab7a('0x4c')]['id'];return _0x27b603;});var _0x187228=[];return BPromise[_0xab7a('0x59')](_0x369fe8,function(_0x392ed3){return db['UserProfileSection'][_0xab7a('0x4f')](_0x392ed3,{'include':[{'model':db[_0xab7a('0x61')],'as':_0xab7a('0x5d')}],'raw':!![],'transaction':_0x5267b7})['then'](function(_0xfbebd7){_0x187228[_0xab7a('0x62')](_0xfbebd7[_0xab7a('0x51')]({'plain':!![]}));});})[_0xab7a('0x2b')](function(){return _0x187228;});});});}})[_0xab7a('0x2b')](function(_0xc2dfaa){return _0xc2dfaa;})[_0xab7a('0x2b')](respondWithResult(_0x4cc81a,null))[_0xab7a('0x4b')](handleError(_0x4cc81a,null));};exports[_0xab7a('0x63')]=function(_0x3ab784,_0x3c48f1){var _0x3667d2;return db[_0xab7a('0x31')][_0xab7a('0x4e')]({'where':{'id':_0x3ab784['params']['id']},'attributes':['id','name']})[_0xab7a('0x2b')](handleEntityNotFound(_0x3c48f1,null))[_0xab7a('0x2b')](function(_0x5ef7f1){if(_0x5ef7f1){_0x3667d2=_0x5ef7f1;return db[_0xab7a('0x5e')]['destroy']({'where':{'userProfileId':_0x3ab784[_0xab7a('0x4c')]['id'],'sectionId':_0x3ab784['query'][_0xab7a('0x64')]}});}})[_0xab7a('0x2b')](function(){return _0x3667d2;})[_0xab7a('0x2b')](respondWithStatusCode(_0x3c48f1,null))[_0xab7a('0x4b')](handleError(_0x3c48f1,null));};exports[_0xab7a('0x65')]=function(_0x22bcfc,_0x335258){var _0xedf13b=[];var _0x57fa58=[];return db[_0xab7a('0x5e')][_0xab7a('0x49')]({'where':{'userProfileId':_0x22bcfc['params']['id']},'raw':!![]})[_0xab7a('0x2b')](function(_0x103a1d){_0xedf13b=_['filter'](_0x103a1d,function(_0x3532b9){return _0x3532b9['enabled']===0x1||_[_0xab7a('0x66')]([0x3eb,0x709],_0x3532b9[_0xab7a('0x5b')]);});if(!_['isEmpty'](_0xedf13b)){return _['map'](_0xedf13b,function(_0x56b8aa){return _0x56b8aa[_0xab7a('0x5b')];});}else{return;}})[_0xab7a('0x2b')](function(_0x1c4a7f){if(_0x1c4a7f)_0x57fa58=_0x1c4a7f;if(_['includes'](_0x57fa58,0x64)){var _0x569ecd=_[_0xab7a('0x4e')](_0xedf13b,{'sectionId':0x64});return hasDefaultDashboard(_0x569ecd)[_0xab7a('0x2b')](function(_0x32aa66){return _['map'](_0xedf13b,function(_0x2bb411){if(_0x2bb411[_0xab7a('0x5b')]===0x64){_0x2bb411['subsections']=_0x32aa66;}return _0x2bb411;});});}else{return;}})['then'](function(_0x2ccb5c){if(_0x2ccb5c)_0xedf13b=_0x2ccb5c;if(_[_0xab7a('0x66')](_0x57fa58,0x3eb)){var _0x24b743=_[_0xab7a('0x4e')](_0xedf13b,{'sectionId':0x3eb});return getCustomDashboards(_0x24b743)[_0xab7a('0x2b')](function(_0xf0f63f){return _[_0xab7a('0x30')](_0xedf13b,function(_0x246127){if(_0x24b743[_0xab7a('0x67')]){if(_0x246127[_0xab7a('0x5b')]===0x3eb){_0x246127[_0xab7a('0x68')]=_0xf0f63f;}}else{if(_0x246127[_0xab7a('0x5b')]===0x64){_0x246127[_0xab7a('0x68')]=_0xf0f63f;}}return _0x246127;});});}else{return;}})[_0xab7a('0x2b')](function(_0x41159e){if(_0x41159e)_0xedf13b=_0x41159e;if(_[_0xab7a('0x66')](_0x57fa58,0x709)){var _0x345496=_[_0xab7a('0x4e')](_0xedf13b,{'sectionId':0x709});return getPlugins(_0x345496)[_0xab7a('0x2b')](function(_0xd485af){if(_0x345496[_0xab7a('0x67')]){return _[_0xab7a('0x30')](_0xedf13b,function(_0x376f98){if(_0x376f98[_0xab7a('0x5b')]===0x709){_0x376f98[_0xab7a('0x68')]=_0xd485af;}return _0x376f98;});}else{var _0x28206d={'sectionId':0x76c,'enabled':0x1,'subsections':_0xd485af};var _0x387023=_[_0xab7a('0x30')](_0xedf13b);_0x387023[_0xab7a('0x62')](_0x28206d);return _0x387023;}});}else{return;}})[_0xab7a('0x2b')](function(_0x4cf273){if(_0x4cf273)_0xedf13b=_0x4cf273;return _[_0xab7a('0x45')](_0xedf13b,['enabled',0x1]);})[_0xab7a('0x2b')](respondWithResult(_0x335258,null))[_0xab7a('0x4b')](handleError(_0x335258,null));};function hasDefaultDashboard(_0xe4b08a){var _0x2a22b9=[0x65];return new BPromise(function(_0xef8de9,_0x41e4a7){try{if(_0xe4b08a[_0xab7a('0x5a')]){_0xef8de9(_0x2a22b9);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0xe4b08a['id']},'raw':!![]})[_0xab7a('0x2b')](function(_0x292693){_0x292693?_0xef8de9(_0x2a22b9):_0xef8de9();});}}catch(_0x448f1f){_0x41e4a7(_0x448f1f);}});}function getCustomDashboards(_0x9d221f){var _0x141a2c=[];return new BPromise(function(_0x4128cf,_0x5e7dec){try{if(_0x9d221f[_0xab7a('0x5a')]){return db[_0xab7a('0x69')]['findAll']({'raw':!![]})[_0xab7a('0x2b')](function(_0xa9ac77){_0xa9ac77[_0xab7a('0x6a')](function(_0x4a375c){_0x141a2c[_0xab7a('0x62')](_0x4a375c['id']+0x1869f);});_0x4128cf(_0x141a2c);});}else{return db['UserProfileResource'][_0xab7a('0x49')]({'where':{'sectionId':_0x9d221f['id']},'raw':!![]})[_0xab7a('0x2b')](function(_0x4a3a56){_0x4a3a56[_0xab7a('0x6a')](function(_0x3f4b28){_0x141a2c[_0xab7a('0x62')](_0x3f4b28[_0xab7a('0x6b')]+0x1869f);});_0x4128cf(_0x141a2c);});}}catch(_0x3dd12f){_0x5e7dec(_0x3dd12f);}});}function getPlugins(_0x587f1d){var _0x51e595=[];return new BPromise(function(_0xdf83a4,_0x9ca150){try{if(_0x587f1d[_0xab7a('0x5a')]){return db[_0xab7a('0x6c')][_0xab7a('0x49')]({'raw':!![]})[_0xab7a('0x2b')](function(_0x1893b8){_0x1893b8[_0xab7a('0x6a')](function(_0x1e5ed0){_0x51e595[_0xab7a('0x62')](_0x1e5ed0['id']+0x15b38);});_0xdf83a4(_0x51e595);});}else{return db[_0xab7a('0x61')]['findAll']({'where':{'sectionId':_0x587f1d['id']},'raw':!![]})[_0xab7a('0x2b')](function(_0x3fcf70){_0x3fcf70[_0xab7a('0x6a')](function(_0xddb0b1){_0x51e595[_0xab7a('0x62')](_0xddb0b1[_0xab7a('0x6b')]+0x15b38);});_0xdf83a4(_0x51e595);});}}catch(_0x22235b){_0x9ca150(_0x22235b);}});}exports['addResources']=function(_0x3ad93e,_0x2f512e){return db['UserProfile'][_0xab7a('0x4e')]({'where':{'id':_0x3ad93e[_0xab7a('0x4c')]['id']}})[_0xab7a('0x2b')](handleEntityNotFound(_0x2f512e,null))[_0xab7a('0x2b')](function(_0x46f7ce){if(_0x46f7ce){return db[_0xab7a('0x57')][_0xab7a('0x58')](function(_0x414376){return db['UserProfileSection'][_0xab7a('0x49')]({'where':{'userProfileId':_0x3ad93e['params']['id']},'attributes':['id'],'raw':!![]})[_0xab7a('0x2b')](function(_0x52538e){if(_0x52538e){return db[_0xab7a('0x5e')]['destroy']({'where':{'userProfileId':_0x3ad93e[_0xab7a('0x4c')]['id'],'id':_[_0xab7a('0x30')](_0x52538e,function(_0x31bdfd){return _0x31bdfd['id'];})},'transaction':_0x414376});}})['then'](function(_0x1574af){var _0x44ae3d=_[_0xab7a('0x30')](_0x3ad93e[_0xab7a('0x56')],function(_0x9afb97){_0x9afb97[_0xab7a('0x5c')]=_0x3ad93e[_0xab7a('0x4c')]['id'];return _0x9afb97;});return db[_0xab7a('0x5e')][_0xab7a('0x6d')](_0x44ae3d,{'raw':!![],'transaction':_0x414376});})[_0xab7a('0x2b')](function(_0xbb3028){var _0x3a90a9=_[_0xab7a('0x45')](_[_0xab7a('0x30')](_0xbb3028,function(_0x56097d){return _0x56097d[_0xab7a('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x3a90a9){return db[_0xab7a('0x5e')][_0xab7a('0x49')]({'where':{'userProfileId':_0x3ad93e[_0xab7a('0x4c')]['id'],'sectionId':_[_0xab7a('0x30')](_0x3a90a9,function(_0x50929a){return _0x50929a[_0xab7a('0x5b')];})},'attributes':['id',_0xab7a('0x5b')],'raw':!![]})[_0xab7a('0x2b')](function(_0x4b192f){var _0x419053=_[_0xab7a('0x30')](_0x3ad93e['body'],function(_0x2abfe7){_0x2abfe7[_0xab7a('0x5c')]=_0x3ad93e[_0xab7a('0x4c')]['id'];return _0x2abfe7;});return db[_0xab7a('0x61')][_0xab7a('0x6d')](_0x419053,{'raw':!![],'transaction':_0x414376});});}})['catch'](handleError(_0x2f512e,null));});}})[_0xab7a('0x2b')](function(_0x328630){var _0x4685ce=_[_0xab7a('0x30')](_0x328630,function(_0x5a1eff){return _0x5a1eff[_0xab7a('0x51')]({'plain':!![]});});})[_0xab7a('0x2b')](respondWithResult(_0x2f512e,null))[_0xab7a('0x4b')](handleError(_0x2f512e,null));};exports[_0xab7a('0x6e')]=function(_0x5d71af,_0x5bef94,_0x58465d){return db['UserProfile'][_0xab7a('0x4e')]({'where':{'id':_0x5d71af[_0xab7a('0x4c')]['id']}})[_0xab7a('0x2b')](handleEntityNotFound(_0x5bef94,null))['then'](function(_0x27e329){if(_0x27e329){return _0x27e329['removeResources'](_0x5d71af[_0xab7a('0x37')]['ids']);}})['then'](respondWithStatusCode(_0x5bef94,null))[_0xab7a('0x4b')](handleError(_0x5bef94,null));};exports[_0xab7a('0x6f')]=function(_0xd712ca,_0x37c82d){var _0x2634f2={};if(!_0xd712ca[_0xab7a('0x37')][_0xab7a('0x70')])throw new Error('Missing\x20section\x20parameter');if(!_0xd712ca[_0xab7a('0x37')][_0xab7a('0x3d')]('nolimit')){_0x2634f2['limit']=qs['limit'](_0xd712ca[_0xab7a('0x37')][_0xab7a('0x25')]);_0x2634f2['offset']=qs[_0xab7a('0x23')](_0xd712ca[_0xab7a('0x37')][_0xab7a('0x23')]);}return db['UserProfile']['find']({'where':{'id':_0xd712ca[_0xab7a('0x4c')]['id']}})[_0xab7a('0x2b')](function(_0x8f0c29){if(!_0x8f0c29)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0xd712ca[_0xab7a('0x4c')]['id']);return db[_0xab7a('0x31')][_0xab7a('0x6f')](_0xd712ca);})[_0xab7a('0x2b')](respondWithFilteredResult(_0x37c82d,_0x2634f2))[_0xab7a('0x4b')](handleError(_0x37c82d,null));}; \ No newline at end of file +var _0x6302=['merge','options','includeAll','findAll','rows','catch','params','keys','include','create','body','clone','find','get','createdAt','sequelize','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','map','updatedAt','sectionId','omit','userProfileId','Resources','describe','addSections','push','removeSections','enabled','isEmpty','includes','subsections','findOne','forEach','resourceId','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','limit','undefined','count','offset','apply','reject','save','update','then','destroy','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter'];(function(_0x5c8647,_0x3b0594){var _0xc857fb=function(_0x3d4f3f){while(--_0x3d4f3f){_0x5c8647['push'](_0x5c8647['shift']());}};_0xc857fb(++_0x3b0594);}(_0x6302,0x109));var _0x2630=function(_0x151fe0,_0x49e77e){_0x151fe0=_0x151fe0-0x0;var _0x42aa6c=_0x6302[_0x151fe0];return _0x42aa6c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2630('0x0'));var zipdir=require(_0x2630('0x1'));var jsonpatch=require(_0x2630('0x2'));var rp=require(_0x2630('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2630('0x4'));var util=require('util');var path=require('path');var sox=require(_0x2630('0x5'));var csv=require(_0x2630('0x6'));var ejs=require(_0x2630('0x7'));var fs=require('fs');var fs_extra=require(_0x2630('0x8'));var _=require(_0x2630('0x9'));var squel=require(_0x2630('0xa'));var crypto=require(_0x2630('0xb'));var jsforce=require(_0x2630('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2630('0xd'));var Papa=require(_0x2630('0xe'));var Redis=require('ioredis');var authService=require(_0x2630('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2630('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2630('0x11'))(_0x2630('0x12'));var utils=require(_0x2630('0x13'));var config=require(_0x2630('0x14'));var licenseUtil=require(_0x2630('0x15'));var db=require(_0x2630('0x16'))['db'];config['redis']=_[_0x2630('0x17')](config[_0x2630('0x18')],{'host':_0x2630('0x19'),'port':0x18eb});var socket=require(_0x2630('0x1a'))(new Redis(config['redis']));require(_0x2630('0x1b'))[_0x2630('0x1c')](socket);function respondWithStatusCode(_0x23179e,_0x4dc77f){_0x4dc77f=_0x4dc77f||0xcc;return function(_0x15ada2){if(_0x15ada2){return _0x23179e['sendStatus'](_0x4dc77f);}return _0x23179e[_0x2630('0x1d')](_0x4dc77f)[_0x2630('0x1e')]();};}function respondWithResult(_0x3b1b78,_0x249507){_0x249507=_0x249507||0xc8;return function(_0x157d35){if(_0x157d35){return _0x3b1b78[_0x2630('0x1d')](_0x249507)[_0x2630('0x1f')](_0x157d35);}};}function respondWithFilteredResult(_0x2c7855,_0x528b3a){return function(_0x427b3c){if(_0x427b3c){var _0x4fc0bb=typeof _0x528b3a['offset']==='undefined'&&typeof _0x528b3a[_0x2630('0x20')]===_0x2630('0x21');var _0x1fd31c=_0x427b3c[_0x2630('0x22')];var _0x1c292c=_0x4fc0bb?0x0:_0x528b3a[_0x2630('0x23')];var _0x4364a0=_0x4fc0bb?_0x427b3c[_0x2630('0x22')]:_0x528b3a[_0x2630('0x23')]+_0x528b3a[_0x2630('0x20')];var _0x713af1;if(_0x4364a0>=_0x1fd31c){_0x4364a0=_0x1fd31c;_0x713af1=0xc8;}else{_0x713af1=0xce;}_0x2c7855[_0x2630('0x1d')](_0x713af1);return _0x2c7855['set']('Content-Range',_0x1c292c+'-'+_0x4364a0+'/'+_0x1fd31c)[_0x2630('0x1f')](_0x427b3c);}return null;};}function patchUpdates(_0x42f98a){return function(_0x4f7617){try{jsonpatch[_0x2630('0x24')](_0x4f7617,_0x42f98a,!![]);}catch(_0x5c67b7){return BPromise[_0x2630('0x25')](_0x5c67b7);}return _0x4f7617[_0x2630('0x26')]();};}function saveUpdates(_0xafc7c6,_0x22a617){return function(_0x57f7e6){if(_0x57f7e6){return _0x57f7e6[_0x2630('0x27')](_0xafc7c6)[_0x2630('0x28')](function(_0x126ec3){return _0x126ec3;});}return null;};}function removeEntity(_0x81ced7,_0x3468dc){return function(_0x161248){if(_0x161248){return _0x161248[_0x2630('0x29')]()[_0x2630('0x28')](function(){_0x81ced7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e57d6,_0x3c654c){return function(_0x41c2c3){if(!_0x41c2c3){_0x1e57d6['sendStatus'](0x194);}return _0x41c2c3;};}function handleError(_0x10d4ce,_0x6f2413){_0x6f2413=_0x6f2413||0x1f4;return function(_0x3e0f49){logger['error'](_0x3e0f49[_0x2630('0x2a')]);if(_0x3e0f49['name']){delete _0x3e0f49[_0x2630('0x2b')];}_0x10d4ce['status'](_0x6f2413)[_0x2630('0x2c')](_0x3e0f49);};}exports[_0x2630('0x2d')]=function(_0x560dd8,_0x683f3d){var _0x552c05={},_0x547d25={},_0x329bac={'count':0x0,'rows':[]};var _0xee67a1=_['map'](db[_0x2630('0x2e')][_0x2630('0x2f')],function(_0x37e326){return{'name':_0x37e326[_0x2630('0x30')],'type':_0x37e326[_0x2630('0x31')][_0x2630('0x32')]};});_0x547d25[_0x2630('0x33')]=_['map'](_0xee67a1,_0x2630('0x2b'));_0x547d25[_0x2630('0x34')]=_['keys'](_0x560dd8[_0x2630('0x34')]);_0x547d25['filters']=_[_0x2630('0x35')](_0x547d25['model'],_0x547d25['query']);_0x552c05[_0x2630('0x36')]=_[_0x2630('0x35')](_0x547d25[_0x2630('0x33')],qs['fields'](_0x560dd8[_0x2630('0x34')][_0x2630('0x37')]));_0x552c05['attributes']=_0x552c05[_0x2630('0x36')][_0x2630('0x38')]?_0x552c05['attributes']:_0x547d25[_0x2630('0x33')];if(!_0x560dd8['query'][_0x2630('0x39')](_0x2630('0x3a'))){_0x552c05['limit']=qs[_0x2630('0x20')](_0x560dd8[_0x2630('0x34')]['limit']);_0x552c05[_0x2630('0x23')]=qs[_0x2630('0x23')](_0x560dd8[_0x2630('0x34')][_0x2630('0x23')]);}_0x552c05[_0x2630('0x3b')]=qs[_0x2630('0x3c')](_0x560dd8[_0x2630('0x34')][_0x2630('0x3c')]);_0x552c05[_0x2630('0x3d')]=qs['filters'](_[_0x2630('0x3e')](_0x560dd8['query'],_0x547d25[_0x2630('0x3f')]),_0xee67a1);if(_0x560dd8[_0x2630('0x34')][_0x2630('0x40')]){_0x552c05[_0x2630('0x3d')]=_[_0x2630('0x41')](_0x552c05[_0x2630('0x3d')],{'$or':_['map'](_0xee67a1,function(_0x36082c){if(_0x36082c[_0x2630('0x31')]!=='VIRTUAL'){var _0x4a0d71={};_0x4a0d71[_0x36082c[_0x2630('0x2b')]]={'$like':'%'+_0x560dd8['query'][_0x2630('0x40')]+'%'};return _0x4a0d71;}})});}_0x552c05=_[_0x2630('0x41')]({},_0x552c05,_0x560dd8[_0x2630('0x42')]);var _0x5e1988={'where':_0x552c05[_0x2630('0x3d')]};return db[_0x2630('0x2e')]['count'](_0x5e1988)['then'](function(_0x181fec){_0x329bac[_0x2630('0x22')]=_0x181fec;if(_0x560dd8[_0x2630('0x34')][_0x2630('0x43')]){_0x552c05['include']=[{'all':!![]}];}return db[_0x2630('0x2e')][_0x2630('0x44')](_0x552c05);})[_0x2630('0x28')](function(_0x45f5b0){_0x329bac[_0x2630('0x45')]=_0x45f5b0;return _0x329bac;})[_0x2630('0x28')](respondWithFilteredResult(_0x683f3d,_0x552c05))[_0x2630('0x46')](handleError(_0x683f3d,null));};exports['show']=function(_0x391226,_0x3d3b06){var _0xd857be={'raw':![],'where':{'id':_0x391226[_0x2630('0x47')]['id']}},_0x916fc1={};_0x916fc1[_0x2630('0x33')]=_[_0x2630('0x48')](db[_0x2630('0x2e')]['rawAttributes']);_0x916fc1['query']=_[_0x2630('0x48')](_0x391226[_0x2630('0x34')]);_0x916fc1[_0x2630('0x3f')]=_[_0x2630('0x35')](_0x916fc1[_0x2630('0x33')],_0x916fc1['query']);_0xd857be[_0x2630('0x36')]=_['intersection'](_0x916fc1[_0x2630('0x33')],qs['fields'](_0x391226[_0x2630('0x34')][_0x2630('0x37')]));_0xd857be[_0x2630('0x36')]=_0xd857be[_0x2630('0x36')][_0x2630('0x38')]?_0xd857be[_0x2630('0x36')]:_0x916fc1[_0x2630('0x33')];if(_0x391226[_0x2630('0x34')]['includeAll']){_0xd857be[_0x2630('0x49')]=[{'all':!![]}];}_0xd857be=_[_0x2630('0x41')]({},_0xd857be,_0x391226[_0x2630('0x42')]);return db[_0x2630('0x2e')]['find'](_0xd857be)[_0x2630('0x28')](handleEntityNotFound(_0x3d3b06,null))[_0x2630('0x28')](respondWithResult(_0x3d3b06,null))['catch'](handleError(_0x3d3b06,null));};exports['create']=function(_0x23d240,_0x35a0e5){return db['UserProfile'][_0x2630('0x4a')](_0x23d240[_0x2630('0x4b')],{})[_0x2630('0x28')](respondWithResult(_0x35a0e5,0xc9))['catch'](handleError(_0x35a0e5,null));};exports[_0x2630('0x4c')]=function(_0x643e1d,_0x4dcbd0){var _0x4cc427={'where':{'id':_0x643e1d[_0x2630('0x47')]['id']}},_0x4c298b={};_0x4c298b[_0x2630('0x33')]=_['keys'](db[_0x2630('0x2e')][_0x2630('0x2f')]);_0x4cc427['attributes']=_[_0x2630('0x35')](_0x4c298b[_0x2630('0x33')],qs[_0x2630('0x37')](_0x643e1d[_0x2630('0x34')][_0x2630('0x37')]));_0x4cc427[_0x2630('0x36')]=_0x4cc427[_0x2630('0x36')][_0x2630('0x38')]?_0x4cc427[_0x2630('0x36')]:_0x4c298b[_0x2630('0x33')];if(_0x643e1d[_0x2630('0x34')]['includeAll']){_0x4cc427['include']=[{'all':!![]}];}_0x4cc427=_[_0x2630('0x41')]({},_0x4cc427,_0x643e1d[_0x2630('0x42')]);return db['UserProfile'][_0x2630('0x4d')](_0x4cc427)[_0x2630('0x28')](handleEntityNotFound(_0x4dcbd0,null))[_0x2630('0x28')](function(_0xbfc6ee){if(_0xbfc6ee){var _0x314546=_0xbfc6ee[_0x2630('0x4e')]({'plain':!![]});_0x314546=qs['omit'](_0x314546,['id',_0x2630('0x4f'),'updatedAt','crudPermissions']);_0x643e1d[_0x2630('0x4b')]=_['omit'](_0x643e1d[_0x2630('0x4b')],['id',_0x2630('0x4f'),'updatedAt']);return db[_0x2630('0x50')][_0x2630('0x51')](function(_0x315835){return db[_0x2630('0x2e')][_0x2630('0x4a')](_[_0x2630('0x41')](_0x314546,_0x643e1d[_0x2630('0x4b')]),{'include':_0x643e1d[_0x2630('0x34')][_0x2630('0x43')]?[{'all':!![]}]:undefined,'transaction':_0x315835})[_0x2630('0x28')](function(_0x295c96){var _0x4b3456=_0x295c96[_0x2630('0x4e')]({'plain':!![]});return db[_0x2630('0x52')][_0x2630('0x44')]({'where':{'userProfileId':_0x643e1d[_0x2630('0x47')]['id']},'raw':!![]})[_0x2630('0x28')](function(_0x307612){if(_0x307612){return BPromise[_0x2630('0x53')](_0x307612,function(_0x5af633){return new BPromise(function(_0x13202a,_0x2479d0){if(_0x5af633[_0x2630('0x54')]===null||_0x5af633['autoAssociation']===0x1)_0x13202a(null);return db[_0x2630('0x55')][_0x2630('0x44')]({'where':{'sectionId':_0x5af633['id']},'raw':!![]})[_0x2630('0x28')](function(_0x44b364){var _0x275c76=_[_0x2630('0x56')](_0x44b364,function(_0x1ad0de){return qs['omit'](_0x1ad0de,['id',_0x2630('0x4f'),_0x2630('0x57'),_0x2630('0x58')]);});_0x13202a(_0x275c76);})[_0x2630('0x46')](function(_0x7eb271){_0x2479d0(_0x7eb271);});})['then'](function(_0x1c7dd8){var _0x466e4b=qs[_0x2630('0x59')](_0x5af633,['id',_0x2630('0x4f'),_0x2630('0x57')]);_0x466e4b[_0x2630('0x5a')]=_0x4b3456['id'];if(_0x1c7dd8)_0x466e4b['Resources']=_0x1c7dd8;return _0x466e4b;})[_0x2630('0x28')](function(_0x1e26c2){return db['UserProfileSection'][_0x2630('0x4a')](_0x1e26c2,{'include':[{'model':db[_0x2630('0x55')],'as':_0x2630('0x5b')}],'raw':!![],'transaction':_0x315835});});})[_0x2630('0x28')](function(){return _0x4b3456;});}});});});}})[_0x2630('0x28')](respondWithResult(_0x4dcbd0,0xc9))[_0x2630('0x46')](handleError(_0x4dcbd0,null));};exports[_0x2630('0x27')]=function(_0x302dd6,_0x263ac6){if(_0x302dd6['body']['id']){delete _0x302dd6[_0x2630('0x4b')]['id'];}return db[_0x2630('0x2e')][_0x2630('0x4d')]({'where':{'id':_0x302dd6[_0x2630('0x47')]['id']}})['then'](handleEntityNotFound(_0x263ac6,null))[_0x2630('0x28')](saveUpdates(_0x302dd6[_0x2630('0x4b')],null))[_0x2630('0x28')](respondWithResult(_0x263ac6,null))['catch'](handleError(_0x263ac6,null));};exports[_0x2630('0x29')]=function(_0x19a488,_0x2bad2a){return db[_0x2630('0x2e')]['find']({'where':{'id':_0x19a488[_0x2630('0x47')]['id']}})[_0x2630('0x28')](handleEntityNotFound(_0x2bad2a,null))[_0x2630('0x28')](removeEntity(_0x2bad2a,null))[_0x2630('0x46')](handleError(_0x2bad2a,null));};exports['describe']=function(_0x454125,_0x40f213){return db[_0x2630('0x2e')][_0x2630('0x5c')]()['then'](respondWithResult(_0x40f213,null))[_0x2630('0x46')](handleError(_0x40f213,null));};exports[_0x2630('0x5d')]=function(_0x494ca6,_0x35cd41){var _0xde2611=_0x494ca6[_0x2630('0x4b')];return db[_0x2630('0x2e')]['find']({'where':{'id':_0x494ca6[_0x2630('0x47')]['id']}})[_0x2630('0x28')](handleEntityNotFound(_0x35cd41,null))[_0x2630('0x28')](function(_0x20e571){if(_0x20e571){return db['sequelize'][_0x2630('0x51')](function(_0x1f6ff0){return db[_0x2630('0x52')]['destroy']({'where':{'userProfileId':_0x494ca6[_0x2630('0x47')]['id'],'sectionId':_[_0x2630('0x56')](_0xde2611,function(_0x5c311b){return _0x5c311b['sectionId'];})},'transaction':_0x1f6ff0})[_0x2630('0x28')](function(){var _0x3e894b=_[_0x2630('0x56')](_0xde2611,function(_0x4bc208){_0x4bc208[_0x2630('0x5a')]=_0x494ca6[_0x2630('0x47')]['id'];return _0x4bc208;});var _0x2bf68a=[];return BPromise[_0x2630('0x53')](_0x3e894b,function(_0x535c23){return db[_0x2630('0x52')][_0x2630('0x4a')](_0x535c23,{'include':[{'model':db[_0x2630('0x55')],'as':_0x2630('0x5b')}],'raw':!![],'transaction':_0x1f6ff0})[_0x2630('0x28')](function(_0x2c655b){_0x2bf68a[_0x2630('0x5e')](_0x2c655b[_0x2630('0x4e')]({'plain':!![]}));});})[_0x2630('0x28')](function(){return _0x2bf68a;});});});}})[_0x2630('0x28')](function(_0x2aa1e0){return _0x2aa1e0;})[_0x2630('0x28')](respondWithResult(_0x35cd41,null))[_0x2630('0x46')](handleError(_0x35cd41,null));};exports[_0x2630('0x5f')]=function(_0x10b200,_0x2c004d){var _0x523e70;return db[_0x2630('0x2e')][_0x2630('0x4d')]({'where':{'id':_0x10b200['params']['id']},'attributes':['id',_0x2630('0x2b')]})[_0x2630('0x28')](handleEntityNotFound(_0x2c004d,null))[_0x2630('0x28')](function(_0x2b2a4a){if(_0x2b2a4a){_0x523e70=_0x2b2a4a;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x10b200[_0x2630('0x47')]['id'],'sectionId':_0x10b200[_0x2630('0x34')]['ids']}});}})['then'](function(){return _0x523e70;})[_0x2630('0x28')](respondWithStatusCode(_0x2c004d,null))['catch'](handleError(_0x2c004d,null));};exports['getSections']=function(_0x28a4ec,_0x2670f5){var _0x2cc8ae=[];var _0xa63ad0=[];return db[_0x2630('0x52')][_0x2630('0x44')]({'where':{'userProfileId':_0x28a4ec['params']['id']},'raw':!![]})[_0x2630('0x28')](function(_0xcf2858){_0x2cc8ae=_['filter'](_0xcf2858,function(_0x1f7ca4){return _0x1f7ca4[_0x2630('0x60')]===0x1||_['includes']([0x3eb,0x709],_0x1f7ca4[_0x2630('0x58')]);});if(!_[_0x2630('0x61')](_0x2cc8ae)){return _['map'](_0x2cc8ae,function(_0x59db41){return _0x59db41[_0x2630('0x58')];});}else{return;}})[_0x2630('0x28')](function(_0x57aee6){if(_0x57aee6)_0xa63ad0=_0x57aee6;if(_[_0x2630('0x62')](_0xa63ad0,0x64)){var _0x1cdda7=_['find'](_0x2cc8ae,{'sectionId':0x64});return hasDefaultDashboard(_0x1cdda7)[_0x2630('0x28')](function(_0x1343db){return _[_0x2630('0x56')](_0x2cc8ae,function(_0x14712a){if(_0x14712a[_0x2630('0x58')]===0x64){_0x14712a[_0x2630('0x63')]=_0x1343db;}return _0x14712a;});});}else{return;}})[_0x2630('0x28')](function(_0x1b5a06){if(_0x1b5a06)_0x2cc8ae=_0x1b5a06;if(_['includes'](_0xa63ad0,0x3eb)){var _0x986c10=_[_0x2630('0x4d')](_0x2cc8ae,{'sectionId':0x3eb});return getCustomDashboards(_0x986c10)[_0x2630('0x28')](function(_0xb9d42f){return _[_0x2630('0x56')](_0x2cc8ae,function(_0x502475){if(_0x986c10[_0x2630('0x60')]){if(_0x502475[_0x2630('0x58')]===0x3eb){_0x502475[_0x2630('0x63')]=_0xb9d42f;}}else{if(_0x502475[_0x2630('0x58')]===0x64){_0x502475[_0x2630('0x63')]=_0xb9d42f;}}return _0x502475;});});}else{return;}})[_0x2630('0x28')](function(_0x4c8026){if(_0x4c8026)_0x2cc8ae=_0x4c8026;if(_[_0x2630('0x62')](_0xa63ad0,0x709)){var _0x1bfafa=_[_0x2630('0x4d')](_0x2cc8ae,{'sectionId':0x709});return getPlugins(_0x1bfafa)[_0x2630('0x28')](function(_0x15d30e){if(_0x1bfafa[_0x2630('0x60')]){return _[_0x2630('0x56')](_0x2cc8ae,function(_0xc89876){if(_0xc89876[_0x2630('0x58')]===0x709){_0xc89876[_0x2630('0x63')]=_0x15d30e;}return _0xc89876;});}else{var _0x468804={'sectionId':0x76c,'enabled':0x1,'subsections':_0x15d30e};var _0x573047=_[_0x2630('0x56')](_0x2cc8ae);_0x573047[_0x2630('0x5e')](_0x468804);return _0x573047;}});}else{return;}})[_0x2630('0x28')](function(_0x59c418){if(_0x59c418)_0x2cc8ae=_0x59c418;return _[_0x2630('0x40')](_0x2cc8ae,['enabled',0x1]);})['then'](respondWithResult(_0x2670f5,null))['catch'](handleError(_0x2670f5,null));};function hasDefaultDashboard(_0x1080c5){var _0x3ef6d2=[0x65];return new BPromise(function(_0x4f3acb,_0x4dd5af){try{if(_0x1080c5[_0x2630('0x54')]){_0x4f3acb(_0x3ef6d2);}else{return db[_0x2630('0x55')][_0x2630('0x64')]({'where':{'sectionId':_0x1080c5['id']},'raw':!![]})[_0x2630('0x28')](function(_0x3f4f64){_0x3f4f64?_0x4f3acb(_0x3ef6d2):_0x4f3acb();});}}catch(_0x25b952){_0x4dd5af(_0x25b952);}});}function getCustomDashboards(_0x2950c7){var _0x4523cb=[];return new BPromise(function(_0x299454,_0x46758b){try{if(_0x2950c7[_0x2630('0x54')]){return db['Dashboard'][_0x2630('0x44')]({'raw':!![]})[_0x2630('0x28')](function(_0x4fa360){_0x4fa360[_0x2630('0x65')](function(_0x587b29){_0x4523cb[_0x2630('0x5e')](_0x587b29['id']+0x1869f);});_0x299454(_0x4523cb);});}else{return db[_0x2630('0x55')]['findAll']({'where':{'sectionId':_0x2950c7['id']},'raw':!![]})['then'](function(_0x152741){_0x152741[_0x2630('0x65')](function(_0x3e24cd){_0x4523cb[_0x2630('0x5e')](_0x3e24cd[_0x2630('0x66')]+0x1869f);});_0x299454(_0x4523cb);});}}catch(_0x30939e){_0x46758b(_0x30939e);}});}function getPlugins(_0x526bb2){var _0x27a5ae=[];return new BPromise(function(_0x56c311,_0x19bdd8){try{if(_0x526bb2[_0x2630('0x54')]){return db['Plugin']['findAll']({'raw':!![]})[_0x2630('0x28')](function(_0x55a7b3){_0x55a7b3[_0x2630('0x65')](function(_0x481f7){_0x27a5ae[_0x2630('0x5e')](_0x481f7['id']+0x15b38);});_0x56c311(_0x27a5ae);});}else{return db[_0x2630('0x55')][_0x2630('0x44')]({'where':{'sectionId':_0x526bb2['id']},'raw':!![]})[_0x2630('0x28')](function(_0x512f25){_0x512f25[_0x2630('0x65')](function(_0x5685b9){_0x27a5ae[_0x2630('0x5e')](_0x5685b9[_0x2630('0x66')]+0x15b38);});_0x56c311(_0x27a5ae);});}}catch(_0x4a4443){_0x19bdd8(_0x4a4443);}});}exports[_0x2630('0x67')]=function(_0x13852d,_0x128508){return db['UserProfile'][_0x2630('0x4d')]({'where':{'id':_0x13852d[_0x2630('0x47')]['id']}})['then'](handleEntityNotFound(_0x128508,null))[_0x2630('0x28')](function(_0x634d68){if(_0x634d68){return db[_0x2630('0x50')]['transaction'](function(_0xfd726f){return db[_0x2630('0x52')][_0x2630('0x44')]({'where':{'userProfileId':_0x13852d[_0x2630('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0x2630('0x28')](function(_0x3de7b2){if(_0x3de7b2){return db[_0x2630('0x52')]['destroy']({'where':{'userProfileId':_0x13852d['params']['id'],'id':_[_0x2630('0x56')](_0x3de7b2,function(_0x564a56){return _0x564a56['id'];})},'transaction':_0xfd726f});}})[_0x2630('0x28')](function(_0x4986a8){var _0x49a8ea=_[_0x2630('0x56')](_0x13852d[_0x2630('0x4b')],function(_0x52df72){_0x52df72['userProfileId']=_0x13852d['params']['id'];return _0x52df72;});return db[_0x2630('0x52')][_0x2630('0x68')](_0x49a8ea,{'raw':!![],'transaction':_0xfd726f});})[_0x2630('0x28')](function(_0x5d86cd){var _0x5f08a0=_[_0x2630('0x40')](_[_0x2630('0x56')](_0x5d86cd,function(_0x17c688){return _0x17c688[_0x2630('0x4e')]({'plain':!![]});}),{'includeAll':![]});if(_0x5f08a0){return db[_0x2630('0x52')][_0x2630('0x44')]({'where':{'userProfileId':_0x13852d[_0x2630('0x47')]['id'],'sectionId':_[_0x2630('0x56')](_0x5f08a0,function(_0x366d3d){return _0x366d3d['sectionId'];})},'attributes':['id',_0x2630('0x58')],'raw':!![]})[_0x2630('0x28')](function(_0x569658){var _0x5f4597=_['map'](_0x13852d[_0x2630('0x4b')],function(_0x47798b){_0x47798b[_0x2630('0x5a')]=_0x13852d[_0x2630('0x47')]['id'];return _0x47798b;});return db[_0x2630('0x55')][_0x2630('0x68')](_0x5f4597,{'raw':!![],'transaction':_0xfd726f});});}})[_0x2630('0x46')](handleError(_0x128508,null));});}})[_0x2630('0x28')](function(_0x949804){var _0x130930=_[_0x2630('0x56')](_0x949804,function(_0x292ba6){return _0x292ba6['get']({'plain':!![]});});})[_0x2630('0x28')](respondWithResult(_0x128508,null))[_0x2630('0x46')](handleError(_0x128508,null));};exports[_0x2630('0x69')]=function(_0x51c888,_0x22db3e,_0x5d62a6){return db[_0x2630('0x2e')][_0x2630('0x4d')]({'where':{'id':_0x51c888['params']['id']}})[_0x2630('0x28')](handleEntityNotFound(_0x22db3e,null))['then'](function(_0x387306){if(_0x387306){return _0x387306[_0x2630('0x69')](_0x51c888[_0x2630('0x34')]['ids']);}})[_0x2630('0x28')](respondWithStatusCode(_0x22db3e,null))[_0x2630('0x46')](handleError(_0x22db3e,null));};exports[_0x2630('0x6a')]=function(_0x3e6c5e,_0x53d562){var _0x5f3652={};if(!_0x3e6c5e['query'][_0x2630('0x6b')])throw new Error(_0x2630('0x6c'));if(!_0x3e6c5e['query'][_0x2630('0x39')](_0x2630('0x3a'))){_0x5f3652['limit']=qs['limit'](_0x3e6c5e['query'][_0x2630('0x20')]);_0x5f3652[_0x2630('0x23')]=qs['offset'](_0x3e6c5e['query'][_0x2630('0x23')]);}return db[_0x2630('0x2e')]['find']({'where':{'id':_0x3e6c5e['params']['id']}})[_0x2630('0x28')](function(_0x49237e){if(!_0x49237e)throw new Error(_0x2630('0x6d')+_0x3e6c5e[_0x2630('0x47')]['id']);return db[_0x2630('0x2e')][_0x2630('0x6a')](_0x3e6c5e);})[_0x2630('0x28')](respondWithFilteredResult(_0x53d562,_0x5f3652))[_0x2630('0x46')](handleError(_0x53d562,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 032aa3d..b0bc08f 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 _0x3f96=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3f96,0x1d3));var _0x63f9=function(_0x34a473,_0xee6618){_0x34a473=_0x34a473-0x0;var _0x507310=_0x3f96[_0x34a473];return _0x507310;};'use strict';var EventEmitter=require(_0x63f9('0x0'));var UserProfile=require(_0x63f9('0x1'))['db'][_0x63f9('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x63f9('0x3')](0x0);var events={'afterCreate':_0x63f9('0x4'),'afterUpdate':'update','afterDestroy':_0x63f9('0x5')};function emitEvent(_0x113895){return function(_0x859291,_0x26ff58,_0x2109ce){UserProfileEvents['emit'](_0x113895+':'+_0x859291['id'],_0x859291);UserProfileEvents[_0x63f9('0x6')](_0x113895,_0x859291);_0x2109ce(null);};}for(var e in events){if(events[_0x63f9('0x7')](e)){var event=events[e];UserProfile[_0x63f9('0x8')](e,emitEvent(event));}}module[_0x63f9('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x8b52=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','save','update'];(function(_0x2fb94f,_0x35a8b0){var _0x11da41=function(_0x75d17){while(--_0x75d17){_0x2fb94f['push'](_0x2fb94f['shift']());}};_0x11da41(++_0x35a8b0);}(_0x8b52,0x151));var _0x28b5=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8b52[_0x4b369d];return _0x571a98;};'use strict';var EventEmitter=require(_0x28b5('0x0'));var UserProfile=require(_0x28b5('0x1'))['db'][_0x28b5('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x28b5('0x3'),'afterUpdate':_0x28b5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4110e8){return function(_0x3d0e93,_0x3a762e,_0x226981){UserProfileEvents[_0x28b5('0x5')](_0x4110e8+':'+_0x3d0e93['id'],_0x3d0e93);UserProfileEvents[_0x28b5('0x5')](_0x4110e8,_0x3d0e93);_0x226981(null);};}for(var e in events){if(events[_0x28b5('0x6')](e)){var event=events[e];UserProfile[_0x28b5('0x7')](e,emitEvent(event));}}module[_0x28b5('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 89f7691..274a2b2 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 _0xdb28=['Trunk','variables','Variable','plugins','Plugin','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','isEmpty','length','push','find','params','all','ignore','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','pick','VIRTUAL','foreignKey','merge','includeAll','include','forEach','DefaultReports','custom','count','rows','ids','Tags','color','tag','openTabs','true','chat','dataValues','sms','fax','mail','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','squel','models','filter','field','value','findAll','then','map','catch','model','associatedResources','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','parentSections','SquareProjects','projectName','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','role','agent','Telephones','User','telephone','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','type','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','sounds','Sound','Tag','templates','Template','Trigger','trunks'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0xdb28,0x106));var _0x8db2=function(_0x47ff91,_0x144f1d){_0x47ff91=_0x47ff91-0x0;var _0x54a8a7=_0xdb28[_0x47ff91];return _0x54a8a7;};'use strict';var _=require(_0x8db2('0x0'));var attributes=require(_0x8db2('0x1'));var qs=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));module['exports']=function(_0x1f4c45){var _0x11c26d=_0x1f4c45[_0x8db2('0x4')];function _0x4426fe(_0x11109e,_0x52bf99){return new Promise(function(_0x21a03e,_0x1d2dd3){if(!_0x52bf99)return _0x21a03e(null);var _0x5f42ee=_0x52bf99['filter']?{[_0x52bf99[_0x8db2('0x5')][_0x8db2('0x6')]]:_0x52bf99[_0x8db2('0x5')][_0x8db2('0x7')]}:undefined;return _0x11c26d[_0x11109e][_0x8db2('0x8')]({'where':_0x5f42ee,'raw':!![]})[_0x8db2('0x9')](function(_0x126c78){_0x52bf99['associatedResources']=_[_0x8db2('0xa')](_0x126c78,'id');_0x21a03e(_0x52bf99);})[_0x8db2('0xb')](function(_0x1f62af){_0x1d2dd3(_0x1f62af);});});}function _0x57015f(_0x1d9371,_0x150942){return new Promise(function(_0x576475,_0x41beda){var _0x3b2faa=_0x1d9371[_0x8db2('0x5')]?{[_0x1d9371[_0x8db2('0x5')][_0x8db2('0x6')]]:_0x1d9371['filter']['value']}:undefined;return _0x11c26d[_0x1d9371[_0x8db2('0xc')]][_0x8db2('0x8')]({'where':_0x3b2faa,'raw':!![]})[_0x8db2('0x9')](function(_0x1d6a15){_0x150942[_0x8db2('0xd')]=_[_0x8db2('0xa')](_0x1d6a15,function(_0x2f177a){return _0x2f177a[_0x8db2('0xe')];});_0x576475(_0x150942);})[_0x8db2('0xb')](function(_0x16c8c2){_0x41beda(_0x16c8c2);});});}function _0x5489a9(_0x13b0f5,_0x24da1b,_0x48101e){if(!_0x24da1b)return Promise[_0x8db2('0xf')](null);return new Promise(function(_0x44957d,_0x21db8c){return _0x11c26d[_0x8db2('0x10')][_0x8db2('0x8')]({'where':{'sectionId':_0x24da1b['id']},'raw':!![]})[_0x8db2('0x9')](function(_0x51d60d){if(_0x13b0f5['field']&&_0x13b0f5[_0x8db2('0x6')]!=='id'){_0x24da1b[_0x8db2('0xd')]=_[_0x8db2('0xa')](_0x51d60d,function(_0x1b64e4){return _0x1b64e4[_0x13b0f5['field']];});}else{if(_0x48101e===_0x8db2('0x11')){_0x24da1b[_0x8db2('0xd')]=_[_0x8db2('0xa')](_0x51d60d,function(_0x297ba3){return{'id':_0x297ba3[_0x8db2('0x12')],'type':_0x297ba3['type']};});}else{_0x24da1b[_0x8db2('0xd')]=_[_0x8db2('0xa')](_0x51d60d,function(_0x18f69c){return _0x18f69c[_0x8db2('0x12')];});}}_0x44957d(_0x24da1b);})[_0x8db2('0xb')](function(_0x21704c){_0x21db8c(_0x21704c);});});}function _0x796ec1(_0x5c6614,_0x256202){var _0x4f6516={'parentSections':[]};switch(_0x5c6614['toLowerCase']()){case'squareprojects':_0x4f6516['childModel']=_0x8db2('0x13');break;case _0x8db2('0x14'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x16');break;case _0x8db2('0x17'):_0x4f6516[_0x8db2('0x15')]='SquareRecording';_0x4f6516[_0x8db2('0x18')]=[{'name':_0x8db2('0x19'),'field':_0x8db2('0xe'),'foreignKey':_0x8db2('0x1a')}];break;case'projects':_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x1b');break;case _0x8db2('0x1c'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x1d');_0x4f6516[_0x8db2('0x18')]=[{'name':_0x8db2('0x1e'),'field':'id','foreignKey':_0x8db2('0x1f')}];break;case _0x8db2('0x20'):_0x4f6516['childModel']=_0x8db2('0x21');break;case'companies':_0x4f6516['childModel']=_0x8db2('0x22');break;case _0x8db2('0x23'):_0x4f6516[_0x8db2('0x15')]='CmCustomField';break;case _0x8db2('0x24'):_0x4f6516['childModel']=_0x8db2('0x25');break;case _0x8db2('0x26'):_0x4f6516[_0x8db2('0x15')]='ChatWebsite';break;case'faxqueues':_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x27');break;case'faxaccounts':_0x4f6516['childModel']=_0x8db2('0x28');break;case _0x8db2('0x29'):case _0x8db2('0x2a'):case _0x8db2('0x2b'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x2c');break;case _0x8db2('0x2d'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x2e');break;case _0x8db2('0x2f'):_0x4f6516['childModel']=_0x8db2('0x30');break;case _0x8db2('0x31'):_0x4f6516['childModel']=_0x8db2('0x32');_0x4f6516[_0x8db2('0x18')]=[{'name':'Agents','field':'name','foreignKey':_0x8db2('0x33'),'model':'User','filter':{'field':_0x8db2('0x34'),'value':[_0x8db2('0x35')]}},{'name':_0x8db2('0x36'),'field':_0x8db2('0xe'),'foreignKey':'membername','model':_0x8db2('0x37'),'filter':{'field':'role','value':[_0x8db2('0x38')]}},{'name':_0x8db2('0x39'),'field':_0x8db2('0xe'),'foreignKey':_0x8db2('0x3a'),'model':'VoiceQueue','filter':{'field':'type','value':[_0x8db2('0x3b')]}},{'name':_0x8db2('0x3c'),'field':'name','foreignKey':_0x8db2('0x3a'),'model':_0x8db2('0x3d'),'filter':{'field':_0x8db2('0x3e'),'value':['outbound']}}];break;case _0x8db2('0x3f'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x40');break;case _0x8db2('0x41'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x42');break;case _0x8db2('0x43'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x44');break;case _0x8db2('0x45'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x46');break;case _0x8db2('0x47'):_0x4f6516['childModel']=_0x8db2('0x48');break;case _0x8db2('0x49'):_0x4f6516['childModel']='MailAccount';break;case _0x8db2('0x4a'):_0x4f6516['childModel']=_0x8db2('0x4b');break;case _0x8db2('0x4c'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x4d');break;case _0x8db2('0x4e'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x4f');break;case'smsqueues':_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x50');break;case _0x8db2('0x51'):_0x4f6516[_0x8db2('0x15')]='SmsAccount';break;case _0x8db2('0x52'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x53');break;case _0x8db2('0x54'):_0x4f6516['childModel']=_0x8db2('0x55');break;case'teams':_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x56');break;case _0x8db2('0x57'):case'queuecampaigns':_0x4f6516['childModel']=_0x8db2('0x3d');if(_0x256202){_0x4f6516['parentSections']=[{'name':_0x8db2('0x39')},{'name':_0x8db2('0x3c')}];}break;case _0x8db2('0x58'):case _0x8db2('0x59'):case _0x8db2('0x5a'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x37');if(_0x256202){_0x4f6516[_0x8db2('0x18')]=[{'name':_0x8db2('0x5b'),'filter':{'field':_0x8db2('0x34'),'value':[_0x8db2('0x5c'),_0x8db2('0x5d')]},'ignore':!![]},{'name':'Agents'},{'name':_0x8db2('0x36')}];}break;case _0x8db2('0x5e'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x5f');break;case'salesforceaccounts':_0x4f6516['childModel']=_0x8db2('0x60');break;case _0x8db2('0x61'):_0x4f6516[_0x8db2('0x15')]='FreshdeskAccount';break;case'sugarcrmaccounts':_0x4f6516['childModel']=_0x8db2('0x62');break;case _0x8db2('0x63'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x64');break;case _0x8db2('0x65'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x66');break;case'vtigeraccounts':_0x4f6516['childModel']=_0x8db2('0x37');break;case _0x8db2('0x67'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x68');break;case _0x8db2('0x69'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x6a');break;case _0x8db2('0x6b'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x6c');break;case _0x8db2('0x6d'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x6e');break;case _0x8db2('0x6f'):_0x4f6516[_0x8db2('0x15')]='Pause';break;case _0x8db2('0x70'):_0x4f6516[_0x8db2('0x15')]='Schedule';break;case _0x8db2('0x71'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x72');break;case'tags':_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x73');break;case _0x8db2('0x74'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x75');break;case'triggers':_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x76');break;case _0x8db2('0x77'):_0x4f6516['childModel']=_0x8db2('0x78');break;case _0x8db2('0x79'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x7a');break;case _0x8db2('0x7b'):_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x7c');break;case'extractedreports':_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x11');_0x4f6516['parentSections']=[{'name':_0x8db2('0x7d'),'field':'id','foreignKey':_0x8db2('0x7e')}];break;case'metrics':_0x4f6516[_0x8db2('0x15')]=_0x8db2('0x7f');break;}return _0x4f6516;}function _0x63e8f7(_0x30f4f3,_0x42b941){var _0x3c7d8c=_0x30f4f3[_0x8db2('0x80')](0x0)[_0x8db2('0x81')]()+_0x30f4f3[_0x8db2('0x82')](0x1);var _0x173a5e={'type':_0x11c26d[_0x8db2('0x83')][_0x8db2('0x84')][_0x8db2('0x85')],'raw':!![]};return new Promise(function(_0x1ce89f,_0x64ec90){var _0x105a53=squel['select']()[_0x8db2('0x6')](_0x8db2('0x86')+_0x3c7d8c+_0x8db2('0x87'),'id')[_0x8db2('0x6')](_0x8db2('0x88'))['from'](_0x8db2('0x89')+_0x30f4f3+_0x8db2('0x8a'),'ui')[_0x8db2('0x8b')](_0x8db2('0x8c'),_0x42b941['id']);return _0x11c26d[_0x8db2('0x8d')][_0x8db2('0x8e')](_0x105a53[_0x8db2('0x8f')](),_0x173a5e)[_0x8db2('0x9')](function(_0x24cfe9){_0x42b941[_0x3c7d8c+_0x8db2('0x90')]=_0x24cfe9;_0x1ce89f(_0x24cfe9);})[_0x8db2('0xb')](function(_0xfe6bac){_0x64ec90(_0xfe6bac);});});}return _0x1f4c45[_0x8db2('0x91')](_0x8db2('0x92'),attributes,{'tableName':_0x8db2('0x93'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x270fc0){var _0x1d7862={'raw':_0x270fc0[_0x8db2('0x8e')]['raw'],'where':{}};var _0x3273dd={};var _0x536ac1={'count':0x0,'rows':[]};var _0x364176=_0x270fc0['query'][_0x8db2('0x94')];var _0x39330c=_0x270fc0[_0x8db2('0x8e')][_0x8db2('0x95')]||![];var _0x1e812e=_0x796ec1(_0x364176,_0x39330c);if(!_0x1e812e['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x364176+'\x27');var _0x3d1128=[{'name':_0x364176}];if(!_[_0x8db2('0x96')](_0x1e812e[_0x8db2('0x18')]))_0x3d1128=_0x1e812e[_0x8db2('0x18')];var _0x20b49c=[];for(var _0x1f28d2=0x0;_0x1f28d2<_0x3d1128[_0x8db2('0x97')];_0x1f28d2++){_0x20b49c[_0x8db2('0x98')](_0x11c26d['UserProfileSection'][_0x8db2('0x99')]({'where':{'userProfileId':_0x270fc0[_0x8db2('0x9a')]['id'],'name':_0x3d1128[_0x1f28d2][_0x8db2('0xe')]},'raw':!![]}));}return Promise[_0x8db2('0x9b')](_0x20b49c)[_0x8db2('0x9')](function(_0x382c75){var _0x451746=_[_0x8db2('0x5')](_0x382c75,function(_0x4938bb){return _0x4938bb?_0x4938bb:undefined;});var _0x54318c=_[_0x8db2('0x5')](_0x3d1128,[_0x8db2('0x9c'),!![]]);var _0x1d2dfc=_[_0x8db2('0x96')](_0x451746)&&_[_0x8db2('0x96')](_0x54318c)?null:_['union'](_0x54318c,_0x451746);if(!_0x1d2dfc)return null;var _0x5e8146=[];for(var _0x3611da=0x0;_0x3611da<_0x1d2dfc[_0x8db2('0x97')];_0x3611da++){var _0x54f0d4=_[_0x8db2('0x99')](_0x3d1128,function(_0x2be647){return _0x1d2dfc[_0x3611da]?_0x2be647[_0x8db2('0xe')]===_0x1d2dfc[_0x3611da]['name']:null;});if(_0x54f0d4){if(_0x1d2dfc[_0x3611da][_0x8db2('0x9c')]){_0x5e8146[_0x8db2('0x98')](_0x4426fe(_0x1e812e[_0x8db2('0x15')],_0x1d2dfc[_0x3611da]));}else{if(!_0x1d2dfc[_0x3611da]['autoAssociation']){_0x5e8146[_0x8db2('0x98')](_0x5489a9(_0x54f0d4,_0x1d2dfc[_0x3611da],_0x1e812e[_0x8db2('0x15')]));}else{if(_0x54f0d4[_0x8db2('0xc')]){_0x5e8146[_0x8db2('0x98')](_0x57015f(_0x54f0d4,_0x1d2dfc[_0x3611da]));}}}}}return Promise[_0x8db2('0x9b')](_0x5e8146);})['then'](function(_0x3c9af4){var _0x3023fe=_0x3c9af4;var _0x150439=null;if(_0x3023fe){_0x150439=_0x3023fe['length']===0x1?_0x3023fe[0x0]:null;}if(!_0x150439&&!_0x3023fe)return _0x536ac1;var _0x59e740=_0x11c26d[_0x1e812e[_0x8db2('0x15')]][_0x8db2('0x9d')];_0x3273dd['model']=_[_0x8db2('0x9e')](_0x59e740);_0x3273dd[_0x8db2('0x8e')]=_[_0x8db2('0x9e')](_0x270fc0[_0x8db2('0x8e')]);_0x3273dd[_0x8db2('0x9f')]=_[_0x8db2('0xa0')](_0x3273dd[_0x8db2('0xc')],_0x3273dd[_0x8db2('0x8e')]);_0x1d7862[_0x8db2('0xa1')]=_[_0x8db2('0xa0')](_0x3273dd[_0x8db2('0xc')],qs[_0x8db2('0xa2')](_0x270fc0[_0x8db2('0x8e')]['fields']));_0x1d7862[_0x8db2('0xa1')]=_0x1d7862['attributes'][_0x8db2('0x97')]?_0x1d7862[_0x8db2('0xa1')]:_0x3273dd['model'];if(!_0x270fc0[_0x8db2('0x8e')][_0x8db2('0xa3')]('nolimit')){_0x1d7862[_0x8db2('0xa4')]=qs[_0x8db2('0xa4')](_0x270fc0[_0x8db2('0x8e')][_0x8db2('0xa4')]);_0x1d7862[_0x8db2('0xa5')]=qs[_0x8db2('0xa5')](_0x270fc0[_0x8db2('0x8e')][_0x8db2('0xa5')]);}_0x1d7862[_0x8db2('0xa6')]=qs['sort'](_0x270fc0['query'][_0x8db2('0xa7')]);_0x1d7862['where']=qs[_0x8db2('0x9f')](_[_0x8db2('0xa8')](_0x270fc0[_0x8db2('0x8e')],_0x3273dd['filters']));if(_0x270fc0[_0x8db2('0x8e')][_0x8db2('0x5')]){_0x1d7862[_0x8db2('0x8b')]=_['merge'](_0x1d7862[_0x8db2('0x8b')],{'$or':_[_0x8db2('0xa')](_0x59e740,function(_0x42f4de){if(_0x42f4de[_0x8db2('0x3e')]['key']!==_0x8db2('0xa9')){var _0x5f61b8={};_0x5f61b8[_0x42f4de[_0x8db2('0x6')]]={'$like':'%'+_0x270fc0[_0x8db2('0x8e')][_0x8db2('0x5')]+'%'};return _0x5f61b8;}})});}var _0x15fd4=[];var _0x1aadfb=null;var _0x3682bf={};if(_0x150439){_0x1aadfb=_[_0x8db2('0x99')](_0x3d1128,[_0x8db2('0xe'),_0x150439[_0x8db2('0xe')]]);if(_0x1aadfb['field']){_0x3682bf={};if(_0x1e812e[_0x8db2('0x15')]===_0x8db2('0x11')){_0x3682bf[_0x1aadfb[_0x8db2('0xaa')]]=_['map'](_0x150439['associatedResources'],'id');}else{_0x3682bf[_0x1aadfb['foreignKey']]=_0x150439[_0x8db2('0xd')];}_0x15fd4[_0x8db2('0x98')](_0x3682bf);}else{_0x1d7862[_0x8db2('0x8b')]['id']=_0x150439[_0x8db2('0xd')];}}else{for(var _0x2ad024=0x0;_0x2ad024<_0x3023fe[_0x8db2('0x97')];_0x2ad024++){_0x1aadfb=_[_0x8db2('0x99')](_0x3d1128,[_0x8db2('0xe'),_0x3023fe[_0x2ad024][_0x8db2('0xe')]]);if(_0x1aadfb[_0x8db2('0x6')]){_0x3682bf={};_0x3682bf[_0x1aadfb[_0x8db2('0xaa')]]=_0x3023fe[_0x2ad024]['associatedResources'];_0x15fd4[_0x8db2('0x98')](_0x3682bf);}else{if(!_0x1d7862[_0x8db2('0x8b')]['id'])_0x1d7862[_0x8db2('0x8b')]['id']=[];_0x3023fe[_0x2ad024][_0x8db2('0xd')]['forEach'](function(_0x4bd03d){_0x1d7862[_0x8db2('0x8b')]['id'][_0x8db2('0x98')](_0x4bd03d);});}}}if(!_['isEmpty'](_0x15fd4)){_0x1d7862[_0x8db2('0x8b')]=_[_0x8db2('0xab')](_0x1d7862[_0x8db2('0x8b')],{'$and':{'$or':_0x15fd4}});}_0x1d7862=_['merge']({},_0x1d7862,_0x270fc0['options']);if(_0x150439&&!_0x150439['autoAssociation']&&_0x1e812e[_0x8db2('0x15')]===_0x8db2('0x11')){if(_0x270fc0[_0x8db2('0x8e')][_0x8db2('0xac')]){_0x1d7862[_0x8db2('0xad')]=[{'all':!![]}];}return _0x11c26d[_0x1e812e['childModel']][_0x8db2('0x8')](_0x1d7862)['then'](function(_0x8c54c){var _0x353101=[];_0x8c54c[_0x8db2('0xae')](function(_0x18d1eb){var _0x3f3040;switch(_0x18d1eb['reportType']){case'default':_0x3f3040=_[_0x8db2('0x99')](_0x150439['associatedResources'],function(_0x6c74f2){return _0x6c74f2['id']===_0x18d1eb[_0x8db2('0x7e')]&&_0x6c74f2[_0x8db2('0x3e')]===_0x8db2('0xaf');});break;case _0x8db2('0xb0'):_0x3f3040=_[_0x8db2('0x99')](_0x150439['associatedResources'],function(_0x19f9a0){return _0x19f9a0['id']===_0x18d1eb[_0x8db2('0x7e')]&&_0x19f9a0[_0x8db2('0x3e')]==='CustomReports';});break;}if(_0x3f3040)_0x353101[_0x8db2('0x98')](_0x18d1eb);});_0x536ac1[_0x8db2('0xb1')]=_0x353101['length'];_0x536ac1[_0x8db2('0xb2')]=_0x353101;return _0x536ac1;});}else{if(!_[_0x8db2('0x96')](_0x270fc0[_0x8db2('0x8e')][_0x8db2('0xb3')])){_0x1d7862[_0x8db2('0x8b')]['id']=_0x1d7862[_0x8db2('0x8b')]['id']?_[_0x8db2('0xa0')](_0x1d7862[_0x8db2('0x8b')]['id'],_0x270fc0[_0x8db2('0x8e')]['ids']):_0x270fc0[_0x8db2('0x8e')][_0x8db2('0xb3')];}return _0x11c26d[_0x1e812e[_0x8db2('0x15')]][_0x8db2('0xb1')]({'where':_0x1d7862[_0x8db2('0x8b')]})[_0x8db2('0x9')](function(_0x16d1c5){_0x536ac1[_0x8db2('0xb1')]=_0x16d1c5;if(_0x270fc0[_0x8db2('0x8e')][_0x8db2('0xac')]){if(_0x1e812e['childModel']===_0x8db2('0x1d')){_0x1d7862[_0x8db2('0xad')]=[{'model':_0x11c26d[_0x8db2('0x73')],'as':_0x8db2('0xb4'),'attributes':['id','name',_0x8db2('0xb5')],'required':_0x270fc0[_0x8db2('0x8e')][_0x8db2('0xb6')]?!![]:![]},{'model':_0x11c26d['Tag'],'as':'ThroughTags','attributes':['id',_0x8db2('0xe'),_0x8db2('0xb5')],'through':_0x270fc0[_0x8db2('0x8e')][_0x8db2('0xb6')]?{'attributes':[],'where':{'TagId':_0x270fc0['query'][_0x8db2('0xb6')]||undefined}}:{},'required':_0x270fc0[_0x8db2('0x8e')][_0x8db2('0xb6')]?!![]:![]}];}else{_0x1d7862[_0x8db2('0xad')]=[{'all':!![]}];}}return _0x11c26d[_0x1e812e['childModel']][_0x8db2('0x8')](_0x1d7862);})[_0x8db2('0x9')](function(_0x3e7b24){_0x536ac1['rows']=_0x3e7b24;if(_0x364176==='Agents'&&_0x270fc0['query'][_0x8db2('0xb7')]===_0x8db2('0xb8')){var _0x122029=[];for(var _0x4ef212=0x0;_0x4ef212<_0x536ac1['rows']['length'];_0x4ef212++){_0x122029[_0x8db2('0x98')](_0x63e8f7(_0x8db2('0xb9'),_0x536ac1[_0x8db2('0xb2')][_0x4ef212][_0x8db2('0xba')]));_0x122029[_0x8db2('0x98')](_0x63e8f7(_0x8db2('0xbb'),_0x536ac1['rows'][_0x4ef212][_0x8db2('0xba')]));_0x122029['push'](_0x63e8f7(_0x8db2('0xbc'),_0x536ac1[_0x8db2('0xb2')][_0x4ef212][_0x8db2('0xba')]));_0x122029[_0x8db2('0x98')](_0x63e8f7(_0x8db2('0xbd'),_0x536ac1['rows'][_0x4ef212][_0x8db2('0xba')]));_0x122029[_0x8db2('0x98')](_0x63e8f7('openchannel',_0x536ac1[_0x8db2('0xb2')][_0x4ef212][_0x8db2('0xba')]));_0x122029[_0x8db2('0x98')](_0x63e8f7(_0x8db2('0xbe'),_0x536ac1['rows'][_0x4ef212][_0x8db2('0xba')]));}return Promise['all'](_0x122029)['then'](function(){return _0x536ac1;});}return _0x536ac1;});}});}}});}; \ No newline at end of file +var _0x781d=['JscriptyProject','contacts','parentSections','ListId','CmList','CmCompany','globalcustomfields','ChatQueue','chatwebsites','faxqueues','faxaccounts','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','Telephones','membername','telephone','VoiceQueues','queue','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','voiceprefixes','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','SmsQueue','smsaccounts','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','voicequeues','queuecampaigns','users','agents','admin','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','vtigeraccounts','cannedanswers','dispositions','Disposition','Dashboard','Pause','scheduler','Schedule','Sound','tags','templates','Template','Trigger','Trunk','variables','Variable','plugins','extractedreports','reportId','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','mergeResources','Invalid\x20section\x20\x27','length','push','params','all','ignore','isEmpty','find','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','default','custom','CustomReports','count','ids','CmContact','Tag','Tags','color','tag','rows','true','chat','dataValues','sms','openchannel','whatsapp','lodash','./userProfile.attributes','exports','models','filter','field','value','then','associatedResources','map','model','findAll','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','catch','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','SquareProjects','projects'];(function(_0x22581b,_0x2e99e4){var _0x1e1803=function(_0x22451d){while(--_0x22451d){_0x22581b['push'](_0x22581b['shift']());}};_0x1e1803(++_0x2e99e4);}(_0x781d,0x14a));var _0xd781=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x781d[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xd781('0x0'));var attributes=require(_0xd781('0x1'));var qs=require('../../components/parsers/qs');var squel=require('squel');module[_0xd781('0x2')]=function(_0x44a72d){var _0x3cd308=_0x44a72d[_0xd781('0x3')];function _0xfd915d(_0x42258e,_0x446534){return new Promise(function(_0x1d4f4e,_0x830b){if(!_0x446534)return _0x1d4f4e(null);var _0x2f98ee=_0x446534['filter']?{[_0x446534[_0xd781('0x4')][_0xd781('0x5')]]:_0x446534[_0xd781('0x4')][_0xd781('0x6')]}:undefined;return _0x3cd308[_0x42258e]['findAll']({'where':_0x2f98ee,'raw':!![]})[_0xd781('0x7')](function(_0x5c18c8){_0x446534[_0xd781('0x8')]=_[_0xd781('0x9')](_0x5c18c8,'id');_0x1d4f4e(_0x446534);})['catch'](function(_0x346756){_0x830b(_0x346756);});});}function _0x29c2a7(_0x4bf265,_0x4c2aab){return new Promise(function(_0x40a900,_0x28b74c){var _0x36f086=_0x4bf265[_0xd781('0x4')]?{[_0x4bf265[_0xd781('0x4')][_0xd781('0x5')]]:_0x4bf265[_0xd781('0x4')][_0xd781('0x6')]}:undefined;return _0x3cd308[_0x4bf265[_0xd781('0xa')]][_0xd781('0xb')]({'where':_0x36f086,'raw':!![]})[_0xd781('0x7')](function(_0x587953){_0x4c2aab[_0xd781('0x8')]=_[_0xd781('0x9')](_0x587953,function(_0x498674){return _0x498674[_0xd781('0xc')];});_0x40a900(_0x4c2aab);})['catch'](function(_0x294e5a){_0x28b74c(_0x294e5a);});});}function _0x22d787(_0x9f25f7,_0x1409dd,_0x42a9c1){if(!_0x1409dd)return Promise[_0xd781('0xd')](null);return new Promise(function(_0x501b0d,_0x5770b0){return _0x3cd308[_0xd781('0xe')][_0xd781('0xb')]({'where':{'sectionId':_0x1409dd['id']},'raw':!![]})[_0xd781('0x7')](function(_0x2f1273){if(_0x9f25f7[_0xd781('0x5')]&&_0x9f25f7[_0xd781('0x5')]!=='id'){_0x1409dd[_0xd781('0x8')]=_[_0xd781('0x9')](_0x2f1273,function(_0x5a5ff5){return _0x5a5ff5[_0x9f25f7[_0xd781('0x5')]];});}else{if(_0x42a9c1===_0xd781('0xf')){_0x1409dd[_0xd781('0x8')]=_[_0xd781('0x9')](_0x2f1273,function(_0x36d320){return{'id':_0x36d320[_0xd781('0x10')],'type':_0x36d320[_0xd781('0x11')]};});}else{_0x1409dd['associatedResources']=_[_0xd781('0x9')](_0x2f1273,function(_0x4e2c56){return _0x4e2c56['resourceId'];});}}_0x501b0d(_0x1409dd);})[_0xd781('0x12')](function(_0x568001){_0x5770b0(_0x568001);});});}function _0x175ba6(_0x101480,_0x395087){var _0x31bf57={'parentSections':[]};switch(_0x101480[_0xd781('0x13')]()){case _0xd781('0x14'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x16');break;case _0xd781('0x17'):_0x31bf57['childModel']='SquareOdbc';break;case _0xd781('0x18'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x19');_0x31bf57['parentSections']=[{'name':_0xd781('0x1a'),'field':'name','foreignKey':'projectName'}];break;case _0xd781('0x1b'):_0x31bf57['childModel']=_0xd781('0x1c');break;case _0xd781('0x1d'):_0x31bf57['childModel']='CmContact';_0x31bf57[_0xd781('0x1e')]=[{'name':'Lists','field':'id','foreignKey':_0xd781('0x1f')}];break;case'lists':_0x31bf57[_0xd781('0x15')]=_0xd781('0x20');break;case'companies':_0x31bf57['childModel']=_0xd781('0x21');break;case _0xd781('0x22'):_0x31bf57[_0xd781('0x15')]='CmCustomField';break;case'chatqueues':_0x31bf57[_0xd781('0x15')]=_0xd781('0x23');break;case _0xd781('0x24'):_0x31bf57['childModel']='ChatWebsite';break;case _0xd781('0x25'):_0x31bf57[_0xd781('0x15')]='FaxQueue';break;case _0xd781('0x26'):_0x31bf57[_0xd781('0x15')]='FaxAccount';break;case _0xd781('0x27'):case _0xd781('0x28'):case _0xd781('0x29'):_0x31bf57[_0xd781('0x15')]='VoiceExtension';break;case _0xd781('0x2a'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x2b');break;case _0xd781('0x2c'):_0x31bf57['childModel']=_0xd781('0x2d');break;case _0xd781('0x2e'):_0x31bf57['childModel']=_0xd781('0x2f');_0x31bf57['parentSections']=[{'name':_0xd781('0x30'),'field':_0xd781('0xc'),'foreignKey':'membername','model':_0xd781('0x31'),'filter':{'field':_0xd781('0x32'),'value':['agent']}},{'name':_0xd781('0x33'),'field':'name','foreignKey':_0xd781('0x34'),'model':_0xd781('0x31'),'filter':{'field':'role','value':[_0xd781('0x35')]}},{'name':_0xd781('0x36'),'field':'name','foreignKey':_0xd781('0x37'),'model':_0xd781('0x38'),'filter':{'field':_0xd781('0x11'),'value':['inbound']}},{'name':_0xd781('0x39'),'field':_0xd781('0xc'),'foreignKey':_0xd781('0x37'),'model':_0xd781('0x38'),'filter':{'field':_0xd781('0x11'),'value':[_0xd781('0x3a')]}}];break;case _0xd781('0x3b'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x3c');break;case'chanspies':_0x31bf57[_0xd781('0x15')]='VoiceChanSpy';break;case _0xd781('0x3d'):_0x31bf57[_0xd781('0x15')]='VoicePrefix';break;case _0xd781('0x3e'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x3f');break;case _0xd781('0x40'):_0x31bf57['childModel']=_0xd781('0x41');break;case'mailaccounts':_0x31bf57[_0xd781('0x15')]=_0xd781('0x42');break;case'mailsubstatuses':_0x31bf57['childModel']=_0xd781('0x43');break;case _0xd781('0x44'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x45');break;case'openchannelaccounts':_0x31bf57[_0xd781('0x15')]=_0xd781('0x46');break;case'smsqueues':_0x31bf57['childModel']=_0xd781('0x47');break;case _0xd781('0x48'):_0x31bf57[_0xd781('0x15')]='SmsAccount';break;case'whatsappqueues':_0x31bf57[_0xd781('0x15')]=_0xd781('0x49');break;case _0xd781('0x4a'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x4b');break;case _0xd781('0x4c'):_0x31bf57['childModel']='Team';break;case _0xd781('0x4d'):case _0xd781('0x4e'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x38');if(_0x395087){_0x31bf57[_0xd781('0x1e')]=[{'name':'VoiceQueues'},{'name':_0xd781('0x39')}];}break;case _0xd781('0x4f'):case _0xd781('0x50'):case'telephones':_0x31bf57[_0xd781('0x15')]=_0xd781('0x31');if(_0x395087){_0x31bf57[_0xd781('0x1e')]=[{'name':'Users','filter':{'field':_0xd781('0x32'),'value':[_0xd781('0x51'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0xd781('0x33')}];}break;case _0xd781('0x52'):_0x31bf57[_0xd781('0x15')]='ZendeskAccount';break;case _0xd781('0x53'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x54');break;case _0xd781('0x55'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x56');break;case _0xd781('0x57'):_0x31bf57['childModel']=_0xd781('0x58');break;case _0xd781('0x59'):_0x31bf57[_0xd781('0x15')]='DeskAccount';break;case _0xd781('0x5a'):_0x31bf57[_0xd781('0x15')]='ZohoAccount';break;case _0xd781('0x5b'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x31');break;case _0xd781('0x5c'):_0x31bf57[_0xd781('0x15')]='CannedAnswer';break;case _0xd781('0x5d'):_0x31bf57['childModel']=_0xd781('0x5e');break;case'customdashboards':_0x31bf57[_0xd781('0x15')]=_0xd781('0x5f');break;case'intervals':_0x31bf57[_0xd781('0x15')]='Interval';break;case'pauses':_0x31bf57['childModel']=_0xd781('0x60');break;case _0xd781('0x61'):_0x31bf57['childModel']=_0xd781('0x62');break;case'sounds':_0x31bf57[_0xd781('0x15')]=_0xd781('0x63');break;case _0xd781('0x64'):_0x31bf57[_0xd781('0x15')]='Tag';break;case _0xd781('0x65'):_0x31bf57['childModel']=_0xd781('0x66');break;case'triggers':_0x31bf57[_0xd781('0x15')]=_0xd781('0x67');break;case'trunks':_0x31bf57[_0xd781('0x15')]=_0xd781('0x68');break;case _0xd781('0x69'):_0x31bf57[_0xd781('0x15')]=_0xd781('0x6a');break;case _0xd781('0x6b'):_0x31bf57['childModel']='Plugin';break;case _0xd781('0x6c'):_0x31bf57[_0xd781('0x15')]=_0xd781('0xf');_0x31bf57[_0xd781('0x1e')]=[{'name':'Reports','field':'id','foreignKey':_0xd781('0x6d')}];break;case'metrics':_0x31bf57[_0xd781('0x15')]=_0xd781('0x6e');break;}return _0x31bf57;}function _0x5e527c(_0x2385fb,_0x4c8c50){var _0x53dae6=_0x2385fb[_0xd781('0x6f')](0x0)['toUpperCase']()+_0x2385fb[_0xd781('0x70')](0x1);var _0x1c9caa={'type':_0x3cd308[_0xd781('0x71')][_0xd781('0x72')][_0xd781('0x73')],'raw':!![]};return new Promise(function(_0x49b84f,_0x34bdba){var _0x1c0023=squel['select']()[_0xd781('0x5')](_0xd781('0x74')+_0x53dae6+_0xd781('0x75'),'id')[_0xd781('0x5')](_0xd781('0x76'))[_0xd781('0x77')](_0xd781('0x78')+_0x2385fb+_0xd781('0x79'),'ui')[_0xd781('0x7a')](_0xd781('0x7b'),_0x4c8c50['id']);return _0x3cd308[_0xd781('0x7c')][_0xd781('0x7d')](_0x1c0023[_0xd781('0x7e')](),_0x1c9caa)[_0xd781('0x7')](function(_0x42adc4){_0x4c8c50[_0x53dae6+_0xd781('0x7f')]=_0x42adc4;_0x49b84f(_0x42adc4);})[_0xd781('0x12')](function(_0x5e0774){_0x34bdba(_0x5e0774);});});}return _0x44a72d[_0xd781('0x80')](_0xd781('0x81'),attributes,{'tableName':_0xd781('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0xfc428d){var _0x2d0273={'raw':_0xfc428d['query']['raw'],'where':{}};var _0x645c0c={};var _0x562653={'count':0x0,'rows':[]};var _0x5846a2=_0xfc428d['query']['section'];var _0x4150ce=_0xfc428d['query'][_0xd781('0x83')]||![];var _0x3c1742=_0x175ba6(_0x5846a2,_0x4150ce);if(!_0x3c1742[_0xd781('0x15')])throw new Error(_0xd781('0x84')+_0x5846a2+'\x27');var _0x168b6c=[{'name':_0x5846a2}];if(!_['isEmpty'](_0x3c1742[_0xd781('0x1e')]))_0x168b6c=_0x3c1742[_0xd781('0x1e')];var _0x11457b=[];for(var _0x214de8=0x0;_0x214de8<_0x168b6c[_0xd781('0x85')];_0x214de8++){_0x11457b[_0xd781('0x86')](_0x3cd308['UserProfileSection']['find']({'where':{'userProfileId':_0xfc428d[_0xd781('0x87')]['id'],'name':_0x168b6c[_0x214de8]['name']},'raw':!![]}));}return Promise[_0xd781('0x88')](_0x11457b)[_0xd781('0x7')](function(_0x3fa455){var _0x2fe890=_['filter'](_0x3fa455,function(_0x1afc37){return _0x1afc37?_0x1afc37:undefined;});var _0x283264=_[_0xd781('0x4')](_0x168b6c,[_0xd781('0x89'),!![]]);var _0x13cf90=_['isEmpty'](_0x2fe890)&&_[_0xd781('0x8a')](_0x283264)?null:_['union'](_0x283264,_0x2fe890);if(!_0x13cf90)return null;var _0x3603ec=[];for(var _0x327109=0x0;_0x327109<_0x13cf90['length'];_0x327109++){var _0x4d5c37=_[_0xd781('0x8b')](_0x168b6c,function(_0xbf6d54){return _0x13cf90[_0x327109]?_0xbf6d54[_0xd781('0xc')]===_0x13cf90[_0x327109][_0xd781('0xc')]:null;});if(_0x4d5c37){if(_0x13cf90[_0x327109][_0xd781('0x89')]){_0x3603ec[_0xd781('0x86')](_0xfd915d(_0x3c1742[_0xd781('0x15')],_0x13cf90[_0x327109]));}else{if(!_0x13cf90[_0x327109][_0xd781('0x8c')]){_0x3603ec[_0xd781('0x86')](_0x22d787(_0x4d5c37,_0x13cf90[_0x327109],_0x3c1742['childModel']));}else{if(_0x4d5c37[_0xd781('0xa')]){_0x3603ec[_0xd781('0x86')](_0x29c2a7(_0x4d5c37,_0x13cf90[_0x327109]));}}}}}return Promise['all'](_0x3603ec);})[_0xd781('0x7')](function(_0x5bba63){var _0x2948a6=_0x5bba63;var _0x2c4a8b=null;if(_0x2948a6){_0x2c4a8b=_0x2948a6['length']===0x1?_0x2948a6[0x0]:null;}if(!_0x2c4a8b&&!_0x2948a6)return _0x562653;var _0x57184f=_0x3cd308[_0x3c1742[_0xd781('0x15')]][_0xd781('0x8d')];_0x645c0c[_0xd781('0xa')]=_[_0xd781('0x8e')](_0x57184f);_0x645c0c[_0xd781('0x7d')]=_[_0xd781('0x8e')](_0xfc428d['query']);_0x645c0c[_0xd781('0x8f')]=_[_0xd781('0x90')](_0x645c0c[_0xd781('0xa')],_0x645c0c[_0xd781('0x7d')]);_0x2d0273[_0xd781('0x91')]=_[_0xd781('0x90')](_0x645c0c[_0xd781('0xa')],qs[_0xd781('0x92')](_0xfc428d[_0xd781('0x7d')][_0xd781('0x92')]));_0x2d0273[_0xd781('0x91')]=_0x2d0273['attributes'][_0xd781('0x85')]?_0x2d0273['attributes']:_0x645c0c[_0xd781('0xa')];if(!_0xfc428d[_0xd781('0x7d')][_0xd781('0x93')](_0xd781('0x94'))){_0x2d0273[_0xd781('0x95')]=qs[_0xd781('0x95')](_0xfc428d[_0xd781('0x7d')][_0xd781('0x95')]);_0x2d0273[_0xd781('0x96')]=qs[_0xd781('0x96')](_0xfc428d['query'][_0xd781('0x96')]);}_0x2d0273[_0xd781('0x97')]=qs['sort'](_0xfc428d[_0xd781('0x7d')][_0xd781('0x98')]);_0x2d0273[_0xd781('0x7a')]=qs['filters'](_['pick'](_0xfc428d[_0xd781('0x7d')],_0x645c0c['filters']));if(_0xfc428d[_0xd781('0x7d')][_0xd781('0x4')]){_0x2d0273[_0xd781('0x7a')]=_[_0xd781('0x99')](_0x2d0273[_0xd781('0x7a')],{'$or':_['map'](_0x57184f,function(_0x73f18d){if(_0x73f18d[_0xd781('0x11')][_0xd781('0x9a')]!==_0xd781('0x9b')){var _0x401c25={};_0x401c25[_0x73f18d[_0xd781('0x5')]]={'$like':'%'+_0xfc428d[_0xd781('0x7d')][_0xd781('0x4')]+'%'};return _0x401c25;}})});}var _0x3665f0=[];var _0x3a1045=null;var _0x47d6a3={};if(_0x2c4a8b){_0x3a1045=_['find'](_0x168b6c,[_0xd781('0xc'),_0x2c4a8b[_0xd781('0xc')]]);if(_0x3a1045['field']){_0x47d6a3={};if(_0x3c1742[_0xd781('0x15')]===_0xd781('0xf')){_0x47d6a3[_0x3a1045[_0xd781('0x9c')]]=_['map'](_0x2c4a8b[_0xd781('0x8')],'id');}else{_0x47d6a3[_0x3a1045[_0xd781('0x9c')]]=_0x2c4a8b['associatedResources'];}_0x3665f0[_0xd781('0x86')](_0x47d6a3);}else{_0x2d0273['where']['id']=_0x2c4a8b[_0xd781('0x8')];}}else{for(var _0x23dba5=0x0;_0x23dba5<_0x2948a6[_0xd781('0x85')];_0x23dba5++){_0x3a1045=_[_0xd781('0x8b')](_0x168b6c,[_0xd781('0xc'),_0x2948a6[_0x23dba5]['name']]);if(_0x3a1045[_0xd781('0x5')]){_0x47d6a3={};_0x47d6a3[_0x3a1045[_0xd781('0x9c')]]=_0x2948a6[_0x23dba5][_0xd781('0x8')];_0x3665f0[_0xd781('0x86')](_0x47d6a3);}else{if(!_0x2d0273[_0xd781('0x7a')]['id'])_0x2d0273[_0xd781('0x7a')]['id']=[];_0x2948a6[_0x23dba5]['associatedResources'][_0xd781('0x9d')](function(_0x40b2f3){_0x2d0273['where']['id'][_0xd781('0x86')](_0x40b2f3);});}}}if(!_[_0xd781('0x8a')](_0x3665f0)){_0x2d0273['where']=_[_0xd781('0x99')](_0x2d0273[_0xd781('0x7a')],{'$and':{'$or':_0x3665f0}});}_0x2d0273=_[_0xd781('0x99')]({},_0x2d0273,_0xfc428d[_0xd781('0x9e')]);if(_0x2c4a8b&&!_0x2c4a8b[_0xd781('0x8c')]&&_0x3c1742['childModel']==='AnalyticExtractedReport'){if(_0xfc428d['query'][_0xd781('0x9f')]){_0x2d0273[_0xd781('0xa0')]=[{'all':!![]}];}return _0x3cd308[_0x3c1742[_0xd781('0x15')]][_0xd781('0xb')](_0x2d0273)[_0xd781('0x7')](function(_0x45013d){var _0x2c96c5=[];_0x45013d[_0xd781('0x9d')](function(_0x2eef85){var _0x4b8fc7;switch(_0x2eef85[_0xd781('0xa1')]){case _0xd781('0xa2'):_0x4b8fc7=_[_0xd781('0x8b')](_0x2c4a8b[_0xd781('0x8')],function(_0x434d63){return _0x434d63['id']===_0x2eef85['reportId']&&_0x434d63['type']==='DefaultReports';});break;case _0xd781('0xa3'):_0x4b8fc7=_['find'](_0x2c4a8b[_0xd781('0x8')],function(_0x554500){return _0x554500['id']===_0x2eef85['reportId']&&_0x554500['type']===_0xd781('0xa4');});break;}if(_0x4b8fc7)_0x2c96c5[_0xd781('0x86')](_0x2eef85);});_0x562653[_0xd781('0xa5')]=_0x2c96c5[_0xd781('0x85')];_0x562653['rows']=_0x2c96c5;return _0x562653;});}else{if(!_[_0xd781('0x8a')](_0xfc428d[_0xd781('0x7d')][_0xd781('0xa6')])){_0x2d0273[_0xd781('0x7a')]['id']=_0x2d0273[_0xd781('0x7a')]['id']?_['intersection'](_0x2d0273[_0xd781('0x7a')]['id'],_0xfc428d[_0xd781('0x7d')]['ids']):_0xfc428d[_0xd781('0x7d')][_0xd781('0xa6')];}return _0x3cd308[_0x3c1742[_0xd781('0x15')]][_0xd781('0xa5')]({'where':_0x2d0273[_0xd781('0x7a')]})[_0xd781('0x7')](function(_0x289ecb){_0x562653[_0xd781('0xa5')]=_0x289ecb;if(_0xfc428d['query']['includeAll']){if(_0x3c1742[_0xd781('0x15')]===_0xd781('0xa7')){_0x2d0273['include']=[{'model':_0x3cd308[_0xd781('0xa8')],'as':_0xd781('0xa9'),'attributes':['id','name',_0xd781('0xaa')],'required':_0xfc428d[_0xd781('0x7d')]['tag']?!![]:![]},{'model':_0x3cd308[_0xd781('0xa8')],'as':'ThroughTags','attributes':['id',_0xd781('0xc'),_0xd781('0xaa')],'through':_0xfc428d[_0xd781('0x7d')]['tag']?{'attributes':[],'where':{'TagId':_0xfc428d['query'][_0xd781('0xab')]||undefined}}:{},'required':_0xfc428d[_0xd781('0x7d')]['tag']?!![]:![]}];}else{_0x2d0273[_0xd781('0xa0')]=[{'all':!![]}];}}return _0x3cd308[_0x3c1742[_0xd781('0x15')]][_0xd781('0xb')](_0x2d0273);})[_0xd781('0x7')](function(_0xb777fd){_0x562653[_0xd781('0xac')]=_0xb777fd;if(_0x5846a2===_0xd781('0x30')&&_0xfc428d[_0xd781('0x7d')]['openTabs']===_0xd781('0xad')){var _0x1b8a4e=[];for(var _0x3fd641=0x0;_0x3fd641<_0x562653[_0xd781('0xac')][_0xd781('0x85')];_0x3fd641++){_0x1b8a4e['push'](_0x5e527c(_0xd781('0xae'),_0x562653[_0xd781('0xac')][_0x3fd641][_0xd781('0xaf')]));_0x1b8a4e[_0xd781('0x86')](_0x5e527c(_0xd781('0xb0'),_0x562653[_0xd781('0xac')][_0x3fd641][_0xd781('0xaf')]));_0x1b8a4e['push'](_0x5e527c('fax',_0x562653['rows'][_0x3fd641]['dataValues']));_0x1b8a4e[_0xd781('0x86')](_0x5e527c('mail',_0x562653[_0xd781('0xac')][_0x3fd641]['dataValues']));_0x1b8a4e['push'](_0x5e527c(_0xd781('0xb1'),_0x562653[_0xd781('0xac')][_0x3fd641][_0xd781('0xaf')]));_0x1b8a4e[_0xd781('0x86')](_0x5e527c(_0xd781('0xb2'),_0x562653[_0xd781('0xac')][_0x3fd641][_0xd781('0xaf')]));}return Promise[_0xd781('0x88')](_0x1b8a4e)[_0xd781('0x7')](function(){return _0x562653;});}return _0x562653;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index a50b2e7..39203c2 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 _0xdcfa=['jayson/promise','client','http','redis','defaults','localhost','./userProfile.socket','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdcfa,0xad));var _0xadcf=function(_0x579d60,_0x26c7d1){_0x579d60=_0x579d60-0x0;var _0x2dfab2=_0xdcfa[_0x579d60];return _0x2dfab2;};'use strict';var _=require(_0xadcf('0x0'));var util=require('util');var moment=require(_0xadcf('0x1'));var BPromise=require('bluebird');var rs=require(_0xadcf('0x2'));var fs=require('fs');var Redis=require(_0xadcf('0x3'));var db=require(_0xadcf('0x4'))['db'];var utils=require(_0xadcf('0x5'));var logger=require(_0xadcf('0x6'))(_0xadcf('0x7'));var config=require(_0xadcf('0x8'));var jayson=require(_0xadcf('0x9'));var client=jayson[_0xadcf('0xa')][_0xadcf('0xb')]({'port':0x232a});config[_0xadcf('0xc')]=_[_0xadcf('0xd')](config['redis'],{'host':_0xadcf('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xadcf('0xc')]));require(_0xadcf('0xf'))['register'](socket);function respondWithRpcPromise(_0x75bc59,_0x5d2cbf,_0x390d09){return new BPromise(function(_0x5c6a93,_0x1e217b){return client[_0xadcf('0x10')](_0x75bc59,_0x390d09)['then'](function(_0x23aa9b){logger[_0xadcf('0x11')](_0xadcf('0x12'),_0x5d2cbf,_0xadcf('0x13'));logger[_0xadcf('0x14')](_0xadcf('0x15'),_0x5d2cbf,'request\x20sent',JSON[_0xadcf('0x16')](_0x23aa9b));if(_0x23aa9b[_0xadcf('0x17')]){if(_0x23aa9b[_0xadcf('0x17')][_0xadcf('0x18')]===0x1f4){logger[_0xadcf('0x17')]('UserProfile,\x20%s,\x20%s',_0x5d2cbf,_0x23aa9b[_0xadcf('0x17')][_0xadcf('0x19')]);return _0x1e217b(_0x23aa9b['error'][_0xadcf('0x19')]);}logger[_0xadcf('0x17')](_0xadcf('0x12'),_0x5d2cbf,_0x23aa9b[_0xadcf('0x17')][_0xadcf('0x19')]);return _0x5c6a93(_0x23aa9b['error'][_0xadcf('0x19')]);}else{logger['info'](_0xadcf('0x12'),_0x5d2cbf,_0xadcf('0x13'));_0x5c6a93(_0x23aa9b['result'][_0xadcf('0x19')]);}})['catch'](function(_0x1baa24){logger[_0xadcf('0x17')](_0xadcf('0x12'),_0x5d2cbf,_0x1baa24);_0x1e217b(_0x1baa24);});});} \ No newline at end of file +var _0x7c71=['register','request','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userProfile.socket'];(function(_0x399f63,_0x3e66ed){var _0x17f075=function(_0x1b7eae){while(--_0x1b7eae){_0x399f63['push'](_0x399f63['shift']());}};_0x17f075(++_0x3e66ed);}(_0x7c71,0x177));var _0x17c7=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0x7c71[_0x33bc64];return _0x3fdd34;};'use strict';var _=require(_0x17c7('0x0'));var util=require(_0x17c7('0x1'));var moment=require(_0x17c7('0x2'));var BPromise=require(_0x17c7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x17c7('0x4'));var db=require(_0x17c7('0x5'))['db'];var utils=require(_0x17c7('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x17c7('0x7'));var jayson=require(_0x17c7('0x8'));var client=jayson[_0x17c7('0x9')][_0x17c7('0xa')]({'port':0x232a});config[_0x17c7('0xb')]=_[_0x17c7('0xc')](config[_0x17c7('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x17c7('0xd'))(new Redis(config[_0x17c7('0xb')]));require(_0x17c7('0xe'))[_0x17c7('0xf')](socket);function respondWithRpcPromise(_0xa21ca2,_0x21aa20,_0x2df59d){return new BPromise(function(_0x45dcce,_0x16965c){return client[_0x17c7('0x10')](_0xa21ca2,_0x2df59d)['then'](function(_0x4da796){logger[_0x17c7('0x11')](_0x17c7('0x12'),_0x21aa20,'request\x20sent');logger[_0x17c7('0x13')](_0x17c7('0x14'),_0x21aa20,'request\x20sent',JSON[_0x17c7('0x15')](_0x4da796));if(_0x4da796[_0x17c7('0x16')]){if(_0x4da796['error']['code']===0x1f4){logger[_0x17c7('0x16')](_0x17c7('0x12'),_0x21aa20,_0x4da796[_0x17c7('0x16')][_0x17c7('0x17')]);return _0x16965c(_0x4da796[_0x17c7('0x16')][_0x17c7('0x17')]);}logger[_0x17c7('0x16')](_0x17c7('0x12'),_0x21aa20,_0x4da796[_0x17c7('0x16')][_0x17c7('0x17')]);return _0x45dcce(_0x4da796[_0x17c7('0x16')][_0x17c7('0x17')]);}else{logger['info'](_0x17c7('0x12'),_0x21aa20,_0x17c7('0x18'));_0x45dcce(_0x4da796['result'][_0x17c7('0x17')]);}})[_0x17c7('0x19')](function(_0x2c652c){logger[_0x17c7('0x16')]('UserProfile,\x20%s,\x20%s',_0x21aa20,_0x2c652c);_0x16965c(_0x2c652c);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index dbaef7c..d286828 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 _0x8501=['./userProfile.events','save','update','emit','length'];(function(_0x3a45fd,_0x189025){var _0x55f64c=function(_0x3e5cd1){while(--_0x3e5cd1){_0x3a45fd['push'](_0x3a45fd['shift']());}};_0x55f64c(++_0x189025);}(_0x8501,0x96));var _0x1850=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0x8501[_0xc77819];return _0x1c9434;};'use strict';var UserProfileEvents=require(_0x1850('0x0'));var events=[_0x1850('0x1'),'remove',_0x1850('0x2')];function createListener(_0x3cec03,_0x4086c5){return function(_0x253b5e){_0x4086c5[_0x1850('0x3')](_0x3cec03,_0x253b5e);};}function removeListener(_0x255eec,_0x41feda){return function(){UserProfileEvents['removeListener'](_0x255eec,_0x41feda);};}exports['register']=function(_0x160233){for(var _0x51046a=0x0,_0x4a1914=events[_0x1850('0x4')];_0x51046a<_0x4a1914;_0x51046a++){var _0x2e40b8=events[_0x51046a];var _0x2ad510=createListener('userProfile:'+_0x2e40b8,_0x160233);UserProfileEvents['on'](_0x2e40b8,_0x2ad510);}}; \ No newline at end of file +var _0xe329=['emit','register','length','userProfile:','./userProfile.events','save','update'];(function(_0x3231e8,_0x41df58){var _0x13a897=function(_0x5c01b5){while(--_0x5c01b5){_0x3231e8['push'](_0x3231e8['shift']());}};_0x13a897(++_0x41df58);}(_0xe329,0x7b));var _0x9e32=function(_0x2f9618,_0x50a2e4){_0x2f9618=_0x2f9618-0x0;var _0x5db31b=_0xe329[_0x2f9618];return _0x5db31b;};'use strict';var UserProfileEvents=require(_0x9e32('0x0'));var events=[_0x9e32('0x1'),'remove',_0x9e32('0x2')];function createListener(_0x3bd797,_0x64dfec){return function(_0x506eab){_0x64dfec[_0x9e32('0x3')](_0x3bd797,_0x506eab);};}function removeListener(_0x1b263c,_0x5de463){return function(){UserProfileEvents['removeListener'](_0x1b263c,_0x5de463);};}exports[_0x9e32('0x4')]=function(_0x1b8ee9){for(var _0x1f34e4=0x0,_0x535a63=events[_0x9e32('0x5')];_0x1f34e4<_0x535a63;_0x1f34e4++){var _0x3daae9=events[_0x1f34e4];var _0x311eb6=createListener(_0x9e32('0x6')+_0x3daae9,_0x1b8ee9);UserProfileEvents['on'](_0x3daae9,_0x311eb6);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index f1573d0..834ce7f 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 _0xdf9b=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete'];(function(_0x41930d,_0x478ed3){var _0x455ade=function(_0x24cb07){while(--_0x24cb07){_0x41930d['push'](_0x41930d['shift']());}};_0x455ade(++_0x478ed3);}(_0xdf9b,0x1d0));var _0xbdf9=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xdf9b[_0x5627e1];return _0x2f013f;};'use strict';var multer=require(_0xbdf9('0x0'));var util=require(_0xbdf9('0x1'));var path=require(_0xbdf9('0x2'));var timeout=require(_0xbdf9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbdf9('0x4'));var auth=require(_0xbdf9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbdf9('0x6'));var controller=require(_0xbdf9('0x7'));router[_0xbdf9('0x8')]('/',auth[_0xbdf9('0x9')](),controller[_0xbdf9('0xa')]);router[_0xbdf9('0x8')](_0xbdf9('0xb'),auth[_0xbdf9('0x9')](),controller[_0xbdf9('0xc')]);router['get'](_0xbdf9('0xd'),auth[_0xbdf9('0x9')](),controller[_0xbdf9('0xe')]);router[_0xbdf9('0xf')]('/',auth[_0xbdf9('0x9')](),controller['create']);router[_0xbdf9('0x10')](_0xbdf9('0xd'),auth[_0xbdf9('0x9')](),controller[_0xbdf9('0x11')]);router[_0xbdf9('0x12')](_0xbdf9('0xd'),auth[_0xbdf9('0x9')](),controller[_0xbdf9('0x13')]);module[_0xbdf9('0x14')]=router; \ No newline at end of file +var _0xf3fa=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','util','path'];(function(_0xe86041,_0x2fbd7b){var _0x1230a9=function(_0x1366e8){while(--_0x1366e8){_0xe86041['push'](_0xe86041['shift']());}};_0x1230a9(++_0x2fbd7b);}(_0xf3fa,0xfd));var _0xaf3f=function(_0x4bf96c,_0x4d24fd){_0x4bf96c=_0x4bf96c-0x0;var _0x281d09=_0xf3fa[_0x4bf96c];return _0x281d09;};'use strict';var multer=require('multer');var util=require(_0xaf3f('0x0'));var path=require(_0xaf3f('0x1'));var timeout=require(_0xaf3f('0x2'));var express=require(_0xaf3f('0x3'));var router=express[_0xaf3f('0x4')]();var fs_extra=require(_0xaf3f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaf3f('0x6'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0xaf3f('0x7')]('/',auth[_0xaf3f('0x8')](),controller[_0xaf3f('0x9')]);router[_0xaf3f('0x7')](_0xaf3f('0xa'),auth[_0xaf3f('0x8')](),controller[_0xaf3f('0xb')]);router[_0xaf3f('0x7')](_0xaf3f('0xc'),auth[_0xaf3f('0x8')](),controller['show']);router[_0xaf3f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaf3f('0xe')]('/:id',auth[_0xaf3f('0x8')](),controller[_0xaf3f('0xf')]);router[_0xaf3f('0x10')](_0xaf3f('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index bc391a6..93052f3 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 _0x5b0e=['STRING','sequelize'];(function(_0x23a8ba,_0xab5848){var _0x468389=function(_0x5ea5f4){while(--_0x5ea5f4){_0x23a8ba['push'](_0x23a8ba['shift']());}};_0x468389(++_0xab5848);}(_0x5b0e,0x179));var _0xe5b0=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0x5b0e[_0x46ae5a];return _0x434986;};'use strict';var Sequelize=require(_0xe5b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe5b0('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xe5b0('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xcfa5=['INTEGER','sequelize','STRING'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0xcfa5,0x1e1));var _0x5cfa=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xcfa5[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0x5cfa('0x0'));module['exports']={'name':{'type':Sequelize[_0x5cfa('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5cfa('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5cfa('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 7a21490..9023fe2 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2fe=['find','body','params','describe','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','UserProfileResource','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show'];(function(_0x12e747,_0x33ab29){var _0x54adb6=function(_0x2ac204){while(--_0x2ac204){_0x12e747['push'](_0x12e747['shift']());}};_0x54adb6(++_0x33ab29);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['UserProfileResource']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['create']=function(_0x1609f0,_0x54cc44){return db['UserProfileResource']['create'](_0x1609f0['body'],{})[_0xee2f('0x1c')](respondWithResult(_0x54cc44,0xc9))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x584383,_0x22506e){if(_0x584383['body']['id']){delete _0x584383[_0xee2f('0x3e')]['id'];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'id':_0x584383[_0xee2f('0x3f')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x22506e,null))['then'](saveUpdates(_0x584383['body'],null))[_0xee2f('0x1c')](respondWithResult(_0x22506e,null))['catch'](handleError(_0x22506e,null));};exports[_0xee2f('0x1d')]=function(_0x282e89,_0x1928f8){return db[_0xee2f('0x23')]['find']({'where':{'id':_0x282e89['params']['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x1928f8,null))[_0xee2f('0x1c')](removeEntity(_0x1928f8,null))[_0xee2f('0x3b')](handleError(_0x1928f8,null));};exports[_0xee2f('0x40')]=function(_0x3acae6,_0x2a450f){return db[_0xee2f('0x23')][_0xee2f('0x40')]()[_0xee2f('0x1c')](respondWithResult(_0x2a450f,null))[_0xee2f('0x3b')](handleError(_0x2a450f,null));}; \ No newline at end of file +var _0x47c5=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','model'];(function(_0x1717f0,_0x528713){var _0x47e926=function(_0x4e2831){while(--_0x4e2831){_0x1717f0['push'](_0x1717f0['shift']());}};_0x47e926(++_0x528713);}(_0x47c5,0x165));var _0x547c=function(_0x412c8f,_0x11ec94){_0x412c8f=_0x412c8f-0x0;var _0x27c005=_0x47c5[_0x412c8f];return _0x27c005;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['UserProfileResource'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['UserProfileResource']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['UserProfileResource'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['UserProfileResource'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));};exports['describe']=function(_0x152982,_0x5258cf){return db[_0x547c('0x2f')][_0x547c('0x51')]()[_0x547c('0x2a')](respondWithResult(_0x5258cf,null))['catch'](handleError(_0x5258cf,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index d34d977..053551a 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 _0x54dc=['api','bluebird','request-promise','path','../../config/environment','define','UserProfileResource','user_profile_has_resources','resourceId','sectionId','lodash','util','../../config/logger'];(function(_0x1c53e2,_0x144980){var _0x160778=function(_0x1881b8){while(--_0x1881b8){_0x1c53e2['push'](_0x1c53e2['shift']());}};_0x160778(++_0x144980);}(_0x54dc,0xa6));var _0xc54d=function(_0x7978a5,_0x5a4e10){_0x7978a5=_0x7978a5-0x0;var _0x5a7ad3=_0x54dc[_0x7978a5];return _0x5a7ad3;};'use strict';var _=require(_0xc54d('0x0'));var util=require(_0xc54d('0x1'));var logger=require(_0xc54d('0x2'))(_0xc54d('0x3'));var moment=require('moment');var BPromise=require(_0xc54d('0x4'));var rp=require(_0xc54d('0x5'));var fs=require('fs');var path=require(_0xc54d('0x6'));var rimraf=require('rimraf');var config=require(_0xc54d('0x7'));var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x2feecd,_0x4e9d25){return _0x2feecd[_0xc54d('0x8')](_0xc54d('0x9'),attributes,{'tableName':_0xc54d('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xc54d('0xb'),_0xc54d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x600d=['moment','bluebird','request-promise','path','rimraf','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api'];(function(_0x50b8b2,_0xd7ad89){var _0x2b7810=function(_0x51bcfd){while(--_0x51bcfd){_0x50b8b2['push'](_0x50b8b2['shift']());}};_0x2b7810(++_0xd7ad89);}(_0x600d,0xb7));var _0xd600=function(_0xd24c17,_0x5b6e5f){_0xd24c17=_0xd24c17-0x0;var _0x2a7f02=_0x600d[_0xd24c17];return _0x2a7f02;};'use strict';var _=require(_0xd600('0x0'));var util=require(_0xd600('0x1'));var logger=require(_0xd600('0x2'))(_0xd600('0x3'));var moment=require(_0xd600('0x4'));var BPromise=require(_0xd600('0x5'));var rp=require(_0xd600('0x6'));var fs=require('fs');var path=require(_0xd600('0x7'));var rimraf=require(_0xd600('0x8'));var config=require('../../config/environment');var attributes=require(_0xd600('0x9'));module[_0xd600('0xa')]=function(_0x1d8c4a,_0x3fb0bb){return _0x1d8c4a[_0xd600('0xb')](_0xd600('0xc'),attributes,{'tableName':_0xd600('0xd'),'paranoid':![],'indexes':[{'name':_0xd600('0xe'),'fields':[_0xd600('0xf'),_0xd600('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 5a1245b..8ab8a2b 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 _0x8e5c=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','UserProfileResource,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash'];(function(_0x333f9a,_0x40f059){var _0x77e3df=function(_0x4cee0d){while(--_0x4cee0d){_0x333f9a['push'](_0x333f9a['shift']());}};_0x77e3df(++_0x40f059);}(_0x8e5c,0x167));var _0xc8e5=function(_0x4646a0,_0x2c1e8f){_0x4646a0=_0x4646a0-0x0;var _0x2d8138=_0x8e5c[_0x4646a0];return _0x2d8138;};'use strict';var _=require(_0xc8e5('0x0'));var util=require(_0xc8e5('0x1'));var moment=require(_0xc8e5('0x2'));var BPromise=require('bluebird');var rs=require(_0xc8e5('0x3'));var fs=require('fs');var Redis=require(_0xc8e5('0x4'));var db=require(_0xc8e5('0x5'))['db'];var utils=require(_0xc8e5('0x6'));var logger=require(_0xc8e5('0x7'))(_0xc8e5('0x8'));var config=require(_0xc8e5('0x9'));var jayson=require(_0xc8e5('0xa'));var client=jayson['client'][_0xc8e5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a72dd,_0x35044e,_0x27ac56){return new BPromise(function(_0x27b78f,_0x100ffb){return client[_0xc8e5('0xc')](_0x1a72dd,_0x27ac56)[_0xc8e5('0xd')](function(_0x128a28){logger[_0xc8e5('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x35044e,'request\x20sent');logger[_0xc8e5('0xf')](_0xc8e5('0x10'),_0x35044e,'request\x20sent',JSON[_0xc8e5('0x11')](_0x128a28));if(_0x128a28[_0xc8e5('0x12')]){if(_0x128a28['error']['code']===0x1f4){logger['error'](_0xc8e5('0x13'),_0x35044e,_0x128a28[_0xc8e5('0x12')][_0xc8e5('0x14')]);return _0x100ffb(_0x128a28[_0xc8e5('0x12')][_0xc8e5('0x14')]);}logger['error'](_0xc8e5('0x13'),_0x35044e,_0x128a28[_0xc8e5('0x12')][_0xc8e5('0x14')]);return _0x27b78f(_0x128a28[_0xc8e5('0x12')][_0xc8e5('0x14')]);}else{logger[_0xc8e5('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x35044e,_0xc8e5('0x15'));_0x27b78f(_0x128a28[_0xc8e5('0x16')][_0xc8e5('0x14')]);}})[_0xc8e5('0x17')](function(_0x5942d3){logger[_0xc8e5('0x12')](_0xc8e5('0x13'),_0x35044e,_0x5942d3);_0x100ffb(_0x5942d3);});});} \ No newline at end of file +var _0xeb9d=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xd5c076,_0x3fc35c){var _0x577241=function(_0x2259ab){while(--_0x2259ab){_0xd5c076['push'](_0xd5c076['shift']());}};_0x577241(++_0x3fc35c);}(_0xeb9d,0x7f));var _0xdeb9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb9d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdeb9('0x0'));var util=require('util');var moment=require(_0xdeb9('0x1'));var BPromise=require(_0xdeb9('0x2'));var rs=require(_0xdeb9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdeb9('0x4'))['db'];var utils=require(_0xdeb9('0x5'));var logger=require(_0xdeb9('0x6'))(_0xdeb9('0x7'));var config=require(_0xdeb9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdeb9('0x9')][_0xdeb9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfdb17c,_0x24f21b,_0x4404c){return new BPromise(function(_0x482fb5,_0x36ee5c){return client['request'](_0xfdb17c,_0x4404c)['then'](function(_0x275540){logger[_0xdeb9('0xb')](_0xdeb9('0xc'),_0x24f21b,_0xdeb9('0xd'));logger[_0xdeb9('0xe')](_0xdeb9('0xf'),_0x24f21b,_0xdeb9('0xd'),JSON[_0xdeb9('0x10')](_0x275540));if(_0x275540[_0xdeb9('0x11')]){if(_0x275540['error'][_0xdeb9('0x12')]===0x1f4){logger[_0xdeb9('0x11')](_0xdeb9('0xc'),_0x24f21b,_0x275540[_0xdeb9('0x11')]['message']);return _0x36ee5c(_0x275540[_0xdeb9('0x11')][_0xdeb9('0x13')]);}logger['error']('UserProfileResource,\x20%s,\x20%s',_0x24f21b,_0x275540[_0xdeb9('0x11')][_0xdeb9('0x13')]);return _0x482fb5(_0x275540[_0xdeb9('0x11')][_0xdeb9('0x13')]);}else{logger[_0xdeb9('0xb')](_0xdeb9('0xc'),_0x24f21b,_0xdeb9('0xd'));_0x482fb5(_0x275540['result'][_0xdeb9('0x13')]);}})[_0xdeb9('0x14')](function(_0x452914){logger['error'](_0xdeb9('0xc'),_0x24f21b,_0x452914);_0x36ee5c(_0x452914);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index e1fb41d..2efad02 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 _0xa0a1=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x5a3c68,_0x1633b5){var _0x500a46=function(_0x5832eb){while(--_0x5832eb){_0x5a3c68['push'](_0x5a3c68['shift']());}};_0x500a46(++_0x1633b5);}(_0xa0a1,0xcc));var _0x1a0a=function(_0x4f26a3,_0x265141){_0x4f26a3=_0x4f26a3-0x0;var _0x4eb62e=_0xa0a1[_0x4f26a3];return _0x4eb62e;};'use strict';var multer=require('multer');var util=require(_0x1a0a('0x0'));var path=require(_0x1a0a('0x1'));var timeout=require(_0x1a0a('0x2'));var express=require('express');var router=express[_0x1a0a('0x3')]();var fs_extra=require(_0x1a0a('0x4'));var auth=require(_0x1a0a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1a0a('0x6'));var controller=require('./userProfileSection.controller');router[_0x1a0a('0x7')]('/',auth[_0x1a0a('0x8')](),controller[_0x1a0a('0x9')]);router[_0x1a0a('0x7')](_0x1a0a('0xa'),auth[_0x1a0a('0x8')](),controller[_0x1a0a('0xb')]);router['get'](_0x1a0a('0xc'),auth['isAuthenticated'](),controller[_0x1a0a('0xd')]);router[_0x1a0a('0xe')]('/',auth[_0x1a0a('0x8')](),controller[_0x1a0a('0xf')]);router[_0x1a0a('0x10')](_0x1a0a('0xc'),auth[_0x1a0a('0x8')](),controller[_0x1a0a('0x11')]);router[_0x1a0a('0x12')]('/:id',auth[_0x1a0a('0x8')](),controller[_0x1a0a('0x13')]);module[_0x1a0a('0x14')]=router; \ No newline at end of file +var _0x0c61=['index','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated'];(function(_0x559a80,_0x3d193d){var _0x42f555=function(_0x24e596){while(--_0x24e596){_0x559a80['push'](_0x559a80['shift']());}};_0x42f555(++_0x3d193d);}(_0x0c61,0x112));var _0x10c6=function(_0x20cf8a,_0x44cd6b){_0x20cf8a=_0x20cf8a-0x0;var _0x54e165=_0x0c61[_0x20cf8a];return _0x54e165;};'use strict';var multer=require(_0x10c6('0x0'));var util=require(_0x10c6('0x1'));var path=require(_0x10c6('0x2'));var timeout=require(_0x10c6('0x3'));var express=require(_0x10c6('0x4'));var router=express[_0x10c6('0x5')]();var fs_extra=require(_0x10c6('0x6'));var auth=require(_0x10c6('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x10c6('0x8'));var controller=require(_0x10c6('0x9'));router[_0x10c6('0xa')]('/',auth[_0x10c6('0xb')](),controller[_0x10c6('0xc')]);router[_0x10c6('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x10c6('0xd')]);router['get'](_0x10c6('0xe'),auth['isAuthenticated'](),controller[_0x10c6('0xf')]);router[_0x10c6('0x10')]('/',auth[_0x10c6('0xb')](),controller[_0x10c6('0x11')]);router['put'](_0x10c6('0xe'),auth[_0x10c6('0xb')](),controller[_0x10c6('0x12')]);router[_0x10c6('0x13')](_0x10c6('0xe'),auth[_0x10c6('0xb')](),controller[_0x10c6('0x14')]);module[_0x10c6('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 89a7d59..c9dbe90 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 _0x7334=['split','sequelize','exports','STRING','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0x7334,0x184));var _0x4733=function(_0x56fe5a,_0x315824){_0x56fe5a=_0x56fe5a-0x0;var _0xc741ca=_0x7334[_0x56fe5a];return _0xc741ca;};'use strict';var Sequelize=require(_0x4733('0x0'));module[_0x4733('0x1')]={'name':{'type':Sequelize[_0x4733('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x4733('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4733('0x2')],'set':function(_0x218143){this[_0x4733('0x4')](_0x4733('0x5'),_0x218143?_0x218143[_0x4733('0x6')](''):[]);},'get':function(){return this[_0x4733('0x7')](_0x4733('0x5'))?this[_0x4733('0x7')](_0x4733('0x5'))[_0x4733('0x8')](''):[];}}}; \ No newline at end of file +var _0x02ce=['BOOLEAN','setDataValue','crudPermissions','join','getDataValue','sequelize','exports','STRING','INTEGER'];(function(_0x2fb1b5,_0x592d84){var _0x30ae41=function(_0x501552){while(--_0x501552){_0x2fb1b5['push'](_0x2fb1b5['shift']());}};_0x30ae41(++_0x592d84);}(_0x02ce,0x1ac));var _0xe02c=function(_0x31cd93,_0x5a8709){_0x31cd93=_0x31cd93-0x0;var _0x568d53=_0x02ce[_0x31cd93];return _0x568d53;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'name':{'type':Sequelize[_0xe02c('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xe02c('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xe02c('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xe02c('0x2')],'set':function(_0x46475c){this[_0xe02c('0x5')](_0xe02c('0x6'),_0x46475c?_0x46475c[_0xe02c('0x7')](''):[]);},'get':function(){return this[_0xe02c('0x8')](_0xe02c('0x6'))?this[_0xe02c('0x8')]('crudPermissions')['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index b9bcd7f..9044cd9 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 _0x2141=['rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format'];(function(_0x1db8b6,_0x2b356f){var _0x3782a1=function(_0x3e36eb){while(--_0x3e36eb){_0x1db8b6['push'](_0x1db8b6['shift']());}};_0x3782a1(++_0x2b356f);}(_0x2141,0x185));var _0x1214=function(_0x3d740b,_0x2cc2af){_0x3d740b=_0x3d740b-0x0;var _0x566ffc=_0x2141[_0x3d740b];return _0x566ffc;};'use strict';var emlformat=require(_0x1214('0x0'));var rimraf=require(_0x1214('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1214('0x2'));var moment=require('moment');var BPromise=require(_0x1214('0x3'));var Mustache=require(_0x1214('0x4'));var util=require(_0x1214('0x5'));var path=require(_0x1214('0x6'));var sox=require(_0x1214('0x7'));var csv=require('to-csv');var ejs=require(_0x1214('0x8'));var fs=require('fs');var fs_extra=require(_0x1214('0x9'));var _=require('lodash');var squel=require(_0x1214('0xa'));var crypto=require(_0x1214('0xb'));var jsforce=require(_0x1214('0xc'));var deskjs=require(_0x1214('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1214('0xe'));var Papa=require(_0x1214('0xf'));var Redis=require(_0x1214('0x10'));var authService=require(_0x1214('0x11'));var qs=require(_0x1214('0x12'));var as=require(_0x1214('0x13'));var hardwareService=require(_0x1214('0x14'));var logger=require(_0x1214('0x15'))(_0x1214('0x16'));var utils=require(_0x1214('0x17'));var config=require(_0x1214('0x18'));var licenseUtil=require(_0x1214('0x19'));var db=require(_0x1214('0x1a'))['db'];function respondWithStatusCode(_0x1b68b6,_0x26d9cb){_0x26d9cb=_0x26d9cb||0xcc;return function(_0x1cc379){if(_0x1cc379){return _0x1b68b6[_0x1214('0x1b')](_0x26d9cb);}return _0x1b68b6[_0x1214('0x1c')](_0x26d9cb)[_0x1214('0x1d')]();};}function respondWithResult(_0x1133d9,_0x1653d5){_0x1653d5=_0x1653d5||0xc8;return function(_0x7f5625){if(_0x7f5625){return _0x1133d9[_0x1214('0x1c')](_0x1653d5)['json'](_0x7f5625);}};}function respondWithFilteredResult(_0x3d557c,_0x42cfc7){return function(_0x4b152a){if(_0x4b152a){var _0x3c4f13=typeof _0x42cfc7[_0x1214('0x1e')]===_0x1214('0x1f')&&typeof _0x42cfc7[_0x1214('0x20')]===_0x1214('0x1f');var _0x487504=_0x4b152a[_0x1214('0x21')];var _0x488915=_0x3c4f13?0x0:_0x42cfc7[_0x1214('0x1e')];var _0x59e1cb=_0x3c4f13?_0x4b152a[_0x1214('0x21')]:_0x42cfc7['offset']+_0x42cfc7['limit'];var _0x5cc46f;if(_0x59e1cb>=_0x487504){_0x59e1cb=_0x487504;_0x5cc46f=0xc8;}else{_0x5cc46f=0xce;}_0x3d557c[_0x1214('0x1c')](_0x5cc46f);return _0x3d557c[_0x1214('0x22')](_0x1214('0x23'),_0x488915+'-'+_0x59e1cb+'/'+_0x487504)[_0x1214('0x24')](_0x4b152a);}return null;};}function patchUpdates(_0x46a2ac){return function(_0x44dc0d){try{jsonpatch[_0x1214('0x25')](_0x44dc0d,_0x46a2ac,!![]);}catch(_0x491370){return BPromise[_0x1214('0x26')](_0x491370);}return _0x44dc0d[_0x1214('0x27')]();};}function saveUpdates(_0xdb8d51,_0x2db7fb){return function(_0x2f3aab){if(_0x2f3aab){return _0x2f3aab[_0x1214('0x28')](_0xdb8d51)['then'](function(_0x591b6d){return _0x591b6d;});}return null;};}function removeEntity(_0x5093eb,_0x53313b){return function(_0x5903eb){if(_0x5903eb){return _0x5903eb[_0x1214('0x29')]()[_0x1214('0x2a')](function(){_0x5093eb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x11dcd0,_0x4551e1){return function(_0x319b93){if(!_0x319b93){_0x11dcd0['sendStatus'](0x194);}return _0x319b93;};}function handleError(_0x4db331,_0x3a86c3){_0x3a86c3=_0x3a86c3||0x1f4;return function(_0x1c0aa2){logger[_0x1214('0x2b')](_0x1c0aa2[_0x1214('0x2c')]);if(_0x1c0aa2[_0x1214('0x2d')]){delete _0x1c0aa2[_0x1214('0x2d')];}_0x4db331[_0x1214('0x1c')](_0x3a86c3)[_0x1214('0x2e')](_0x1c0aa2);};}exports[_0x1214('0x2f')]=function(_0x293189,_0x3404a5){var _0x3a5b75={},_0x36ce9a={},_0x3e15d0={'count':0x0,'rows':[]};var _0x340044=_[_0x1214('0x30')](db[_0x1214('0x31')][_0x1214('0x32')],function(_0x1ad189){return{'name':_0x1ad189[_0x1214('0x33')],'type':_0x1ad189[_0x1214('0x34')][_0x1214('0x35')]};});_0x36ce9a[_0x1214('0x36')]=_[_0x1214('0x30')](_0x340044,'name');_0x36ce9a['query']=_[_0x1214('0x37')](_0x293189[_0x1214('0x38')]);_0x36ce9a[_0x1214('0x39')]=_[_0x1214('0x3a')](_0x36ce9a[_0x1214('0x36')],_0x36ce9a[_0x1214('0x38')]);_0x3a5b75['attributes']=_[_0x1214('0x3a')](_0x36ce9a[_0x1214('0x36')],qs['fields'](_0x293189['query'][_0x1214('0x3b')]));_0x3a5b75[_0x1214('0x3c')]=_0x3a5b75[_0x1214('0x3c')]['length']?_0x3a5b75[_0x1214('0x3c')]:_0x36ce9a[_0x1214('0x36')];if(!_0x293189[_0x1214('0x38')]['hasOwnProperty']('nolimit')){_0x3a5b75['limit']=qs[_0x1214('0x20')](_0x293189[_0x1214('0x38')]['limit']);_0x3a5b75['offset']=qs[_0x1214('0x1e')](_0x293189[_0x1214('0x38')][_0x1214('0x1e')]);}_0x3a5b75[_0x1214('0x3d')]=qs[_0x1214('0x3e')](_0x293189['query'][_0x1214('0x3e')]);_0x3a5b75['where']=qs[_0x1214('0x39')](_['pick'](_0x293189[_0x1214('0x38')],_0x36ce9a[_0x1214('0x39')]),_0x340044);if(_0x293189[_0x1214('0x38')]['filter']){_0x3a5b75[_0x1214('0x3f')]=_[_0x1214('0x40')](_0x3a5b75['where'],{'$or':_['map'](_0x340044,function(_0x35d425){if(_0x35d425[_0x1214('0x34')]!=='VIRTUAL'){var _0x52698b={};_0x52698b[_0x35d425[_0x1214('0x2d')]]={'$like':'%'+_0x293189[_0x1214('0x38')][_0x1214('0x41')]+'%'};return _0x52698b;}})});}_0x3a5b75=_[_0x1214('0x40')]({},_0x3a5b75,_0x293189[_0x1214('0x42')]);var _0x21aa92={'where':_0x3a5b75['where']};return db[_0x1214('0x31')][_0x1214('0x21')](_0x21aa92)[_0x1214('0x2a')](function(_0x2ce24e){_0x3e15d0[_0x1214('0x21')]=_0x2ce24e;if(_0x293189['query'][_0x1214('0x43')]){_0x3a5b75[_0x1214('0x44')]=[{'all':!![]}];}return db['UserProfileSection'][_0x1214('0x45')](_0x3a5b75);})[_0x1214('0x2a')](function(_0xc822c9){_0x3e15d0[_0x1214('0x46')]=_0xc822c9;return _0x3e15d0;})['then'](respondWithFilteredResult(_0x3404a5,_0x3a5b75))[_0x1214('0x47')](handleError(_0x3404a5,null));};exports[_0x1214('0x48')]=function(_0x31e068,_0x3443fc){var _0x338799={'raw':![],'where':{'id':_0x31e068[_0x1214('0x49')]['id']}},_0xfd2d23={};_0xfd2d23[_0x1214('0x36')]=_['keys'](db['UserProfileSection']['rawAttributes']);_0xfd2d23[_0x1214('0x38')]=_[_0x1214('0x37')](_0x31e068[_0x1214('0x38')]);_0xfd2d23[_0x1214('0x39')]=_[_0x1214('0x3a')](_0xfd2d23[_0x1214('0x36')],_0xfd2d23[_0x1214('0x38')]);_0x338799['attributes']=_[_0x1214('0x3a')](_0xfd2d23['model'],qs['fields'](_0x31e068[_0x1214('0x38')]['fields']));_0x338799['attributes']=_0x338799[_0x1214('0x3c')]['length']?_0x338799['attributes']:_0xfd2d23['model'];if(_0x31e068[_0x1214('0x38')][_0x1214('0x43')]){_0x338799[_0x1214('0x44')]=[{'all':!![]}];}_0x338799=_[_0x1214('0x40')]({},_0x338799,_0x31e068['options']);return db[_0x1214('0x31')][_0x1214('0x4a')](_0x338799)[_0x1214('0x2a')](handleEntityNotFound(_0x3443fc,null))[_0x1214('0x2a')](respondWithResult(_0x3443fc,null))['catch'](handleError(_0x3443fc,null));};exports[_0x1214('0x4b')]=function(_0xca2cb3,_0x27283a){return db[_0x1214('0x31')][_0x1214('0x4b')](_0xca2cb3[_0x1214('0x4c')],{})[_0x1214('0x2a')](respondWithResult(_0x27283a,0xc9))[_0x1214('0x47')](handleError(_0x27283a,null));};exports[_0x1214('0x28')]=function(_0x9bc9d1,_0x416eb9){if(_0x9bc9d1[_0x1214('0x4c')]['id']){delete _0x9bc9d1[_0x1214('0x4c')]['id'];}return db['UserProfileSection'][_0x1214('0x4a')]({'where':{'id':_0x9bc9d1[_0x1214('0x49')]['id']}})['then'](handleEntityNotFound(_0x416eb9,null))['then'](saveUpdates(_0x9bc9d1[_0x1214('0x4c')],null))[_0x1214('0x2a')](respondWithResult(_0x416eb9,null))[_0x1214('0x47')](handleError(_0x416eb9,null));};exports[_0x1214('0x29')]=function(_0x5ef7ff,_0x2ecd2a){return db[_0x1214('0x31')]['find']({'where':{'id':_0x5ef7ff[_0x1214('0x49')]['id']}})[_0x1214('0x2a')](handleEntityNotFound(_0x2ecd2a,null))['then'](removeEntity(_0x2ecd2a,null))[_0x1214('0x47')](handleError(_0x2ecd2a,null));};exports['describe']=function(_0x3481ba,_0xf70d57){return db[_0x1214('0x31')][_0x1214('0x4d')]()[_0x1214('0x2a')](respondWithResult(_0xf70d57,null))[_0x1214('0x47')](handleError(_0xf70d57,null));}; \ No newline at end of file +var _0xc9d7=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','set','apply','save','update','then','destroy','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','count','include','rows','show','params','includeAll','options','catch','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x5e33ce,_0x3af537){var _0x500145=function(_0x332bc1){while(--_0x332bc1){_0x5e33ce['push'](_0x5e33ce['shift']());}};_0x500145(++_0x3af537);}(_0xc9d7,0x165));var _0x7c9d=function(_0x4a93bb,_0x495404){_0x4a93bb=_0x4a93bb-0x0;var _0x208468=_0xc9d7[_0x4a93bb];return _0x208468;};'use strict';var emlformat=require(_0x7c9d('0x0'));var rimraf=require(_0x7c9d('0x1'));var zipdir=require(_0x7c9d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7c9d('0x3'));var moment=require(_0x7c9d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7c9d('0x5'));var path=require(_0x7c9d('0x6'));var sox=require('sox');var csv=require(_0x7c9d('0x7'));var ejs=require(_0x7c9d('0x8'));var fs=require('fs');var fs_extra=require(_0x7c9d('0x9'));var _=require(_0x7c9d('0xa'));var squel=require(_0x7c9d('0xb'));var crypto=require(_0x7c9d('0xc'));var jsforce=require(_0x7c9d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7c9d('0x7'));var querystring=require(_0x7c9d('0xe'));var Papa=require(_0x7c9d('0xf'));var Redis=require(_0x7c9d('0x10'));var authService=require(_0x7c9d('0x11'));var qs=require(_0x7c9d('0x12'));var as=require(_0x7c9d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c9d('0x14'))(_0x7c9d('0x15'));var utils=require(_0x7c9d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7c9d('0x17'));var db=require(_0x7c9d('0x18'))['db'];function respondWithStatusCode(_0x295569,_0x1f8665){_0x1f8665=_0x1f8665||0xcc;return function(_0x3a1a63){if(_0x3a1a63){return _0x295569[_0x7c9d('0x19')](_0x1f8665);}return _0x295569[_0x7c9d('0x1a')](_0x1f8665)[_0x7c9d('0x1b')]();};}function respondWithResult(_0x133af1,_0xd70969){_0xd70969=_0xd70969||0xc8;return function(_0x443487){if(_0x443487){return _0x133af1[_0x7c9d('0x1a')](_0xd70969)[_0x7c9d('0x1c')](_0x443487);}};}function respondWithFilteredResult(_0x5673c4,_0x53533b){return function(_0x27ec3d){if(_0x27ec3d){var _0x30c239=typeof _0x53533b[_0x7c9d('0x1d')]===_0x7c9d('0x1e')&&typeof _0x53533b['limit']===_0x7c9d('0x1e');var _0x7af69a=_0x27ec3d['count'];var _0x21532e=_0x30c239?0x0:_0x53533b[_0x7c9d('0x1d')];var _0xce57a6=_0x30c239?_0x27ec3d['count']:_0x53533b[_0x7c9d('0x1d')]+_0x53533b['limit'];var _0x3fcf5a;if(_0xce57a6>=_0x7af69a){_0xce57a6=_0x7af69a;_0x3fcf5a=0xc8;}else{_0x3fcf5a=0xce;}_0x5673c4[_0x7c9d('0x1a')](_0x3fcf5a);return _0x5673c4[_0x7c9d('0x1f')]('Content-Range',_0x21532e+'-'+_0xce57a6+'/'+_0x7af69a)[_0x7c9d('0x1c')](_0x27ec3d);}return null;};}function patchUpdates(_0x2e9910){return function(_0xd1bb67){try{jsonpatch[_0x7c9d('0x20')](_0xd1bb67,_0x2e9910,!![]);}catch(_0x29ebd9){return BPromise['reject'](_0x29ebd9);}return _0xd1bb67[_0x7c9d('0x21')]();};}function saveUpdates(_0x26c920,_0x33b28d){return function(_0x16e04f){if(_0x16e04f){return _0x16e04f[_0x7c9d('0x22')](_0x26c920)[_0x7c9d('0x23')](function(_0x19e5f2){return _0x19e5f2;});}return null;};}function removeEntity(_0x334309,_0x1b524d){return function(_0x40c073){if(_0x40c073){return _0x40c073[_0x7c9d('0x24')]()[_0x7c9d('0x23')](function(){_0x334309[_0x7c9d('0x1a')](0xcc)[_0x7c9d('0x1b')]();});}};}function handleEntityNotFound(_0x34589d,_0x440ae6){return function(_0x4c07bb){if(!_0x4c07bb){_0x34589d[_0x7c9d('0x19')](0x194);}return _0x4c07bb;};}function handleError(_0x1c322f,_0x1f9867){_0x1f9867=_0x1f9867||0x1f4;return function(_0x4f4bb6){logger['error'](_0x4f4bb6['stack']);if(_0x4f4bb6[_0x7c9d('0x25')]){delete _0x4f4bb6[_0x7c9d('0x25')];}_0x1c322f[_0x7c9d('0x1a')](_0x1f9867)[_0x7c9d('0x26')](_0x4f4bb6);};}exports[_0x7c9d('0x27')]=function(_0x545723,_0x5012c2){var _0x328ff0={},_0x28039d={},_0x1625c0={'count':0x0,'rows':[]};var _0x3f2e31=_[_0x7c9d('0x28')](db[_0x7c9d('0x29')][_0x7c9d('0x2a')],function(_0x391f5a){return{'name':_0x391f5a[_0x7c9d('0x2b')],'type':_0x391f5a[_0x7c9d('0x2c')]['key']};});_0x28039d[_0x7c9d('0x2d')]=_[_0x7c9d('0x28')](_0x3f2e31,'name');_0x28039d[_0x7c9d('0x2e')]=_[_0x7c9d('0x2f')](_0x545723[_0x7c9d('0x2e')]);_0x28039d[_0x7c9d('0x30')]=_[_0x7c9d('0x31')](_0x28039d[_0x7c9d('0x2d')],_0x28039d[_0x7c9d('0x2e')]);_0x328ff0[_0x7c9d('0x32')]=_[_0x7c9d('0x31')](_0x28039d[_0x7c9d('0x2d')],qs[_0x7c9d('0x33')](_0x545723[_0x7c9d('0x2e')][_0x7c9d('0x33')]));_0x328ff0['attributes']=_0x328ff0[_0x7c9d('0x32')][_0x7c9d('0x34')]?_0x328ff0[_0x7c9d('0x32')]:_0x28039d[_0x7c9d('0x2d')];if(!_0x545723[_0x7c9d('0x2e')][_0x7c9d('0x35')](_0x7c9d('0x36'))){_0x328ff0[_0x7c9d('0x37')]=qs[_0x7c9d('0x37')](_0x545723[_0x7c9d('0x2e')][_0x7c9d('0x37')]);_0x328ff0[_0x7c9d('0x1d')]=qs[_0x7c9d('0x1d')](_0x545723['query'][_0x7c9d('0x1d')]);}_0x328ff0[_0x7c9d('0x38')]=qs[_0x7c9d('0x39')](_0x545723[_0x7c9d('0x2e')][_0x7c9d('0x39')]);_0x328ff0[_0x7c9d('0x3a')]=qs[_0x7c9d('0x30')](_[_0x7c9d('0x3b')](_0x545723['query'],_0x28039d[_0x7c9d('0x30')]),_0x3f2e31);if(_0x545723[_0x7c9d('0x2e')][_0x7c9d('0x3c')]){_0x328ff0[_0x7c9d('0x3a')]=_[_0x7c9d('0x3d')](_0x328ff0[_0x7c9d('0x3a')],{'$or':_[_0x7c9d('0x28')](_0x3f2e31,function(_0x1de76d){if(_0x1de76d[_0x7c9d('0x2c')]!==_0x7c9d('0x3e')){var _0x325867={};_0x325867[_0x1de76d[_0x7c9d('0x25')]]={'$like':'%'+_0x545723[_0x7c9d('0x2e')][_0x7c9d('0x3c')]+'%'};return _0x325867;}})});}_0x328ff0=_['merge']({},_0x328ff0,_0x545723['options']);var _0x451276={'where':_0x328ff0['where']};return db[_0x7c9d('0x29')][_0x7c9d('0x3f')](_0x451276)[_0x7c9d('0x23')](function(_0x16e318){_0x1625c0[_0x7c9d('0x3f')]=_0x16e318;if(_0x545723['query']['includeAll']){_0x328ff0[_0x7c9d('0x40')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x328ff0);})['then'](function(_0x4e2691){_0x1625c0[_0x7c9d('0x41')]=_0x4e2691;return _0x1625c0;})[_0x7c9d('0x23')](respondWithFilteredResult(_0x5012c2,_0x328ff0))['catch'](handleError(_0x5012c2,null));};exports[_0x7c9d('0x42')]=function(_0x4a010c,_0x50f0a5){var _0x1660f8={'raw':![],'where':{'id':_0x4a010c[_0x7c9d('0x43')]['id']}},_0x50ee44={};_0x50ee44[_0x7c9d('0x2d')]=_[_0x7c9d('0x2f')](db['UserProfileSection']['rawAttributes']);_0x50ee44[_0x7c9d('0x2e')]=_[_0x7c9d('0x2f')](_0x4a010c[_0x7c9d('0x2e')]);_0x50ee44['filters']=_[_0x7c9d('0x31')](_0x50ee44['model'],_0x50ee44[_0x7c9d('0x2e')]);_0x1660f8['attributes']=_[_0x7c9d('0x31')](_0x50ee44[_0x7c9d('0x2d')],qs[_0x7c9d('0x33')](_0x4a010c[_0x7c9d('0x2e')][_0x7c9d('0x33')]));_0x1660f8[_0x7c9d('0x32')]=_0x1660f8[_0x7c9d('0x32')][_0x7c9d('0x34')]?_0x1660f8[_0x7c9d('0x32')]:_0x50ee44[_0x7c9d('0x2d')];if(_0x4a010c['query'][_0x7c9d('0x44')]){_0x1660f8[_0x7c9d('0x40')]=[{'all':!![]}];}_0x1660f8=_[_0x7c9d('0x3d')]({},_0x1660f8,_0x4a010c[_0x7c9d('0x45')]);return db['UserProfileSection']['find'](_0x1660f8)['then'](handleEntityNotFound(_0x50f0a5,null))[_0x7c9d('0x23')](respondWithResult(_0x50f0a5,null))[_0x7c9d('0x46')](handleError(_0x50f0a5,null));};exports['create']=function(_0x4482b8,_0x3f0e4e){return db[_0x7c9d('0x29')][_0x7c9d('0x47')](_0x4482b8['body'],{})[_0x7c9d('0x23')](respondWithResult(_0x3f0e4e,0xc9))[_0x7c9d('0x46')](handleError(_0x3f0e4e,null));};exports[_0x7c9d('0x22')]=function(_0x28b1dd,_0x4f805f){if(_0x28b1dd[_0x7c9d('0x48')]['id']){delete _0x28b1dd['body']['id'];}return db[_0x7c9d('0x29')][_0x7c9d('0x49')]({'where':{'id':_0x28b1dd[_0x7c9d('0x43')]['id']}})[_0x7c9d('0x23')](handleEntityNotFound(_0x4f805f,null))['then'](saveUpdates(_0x28b1dd['body'],null))[_0x7c9d('0x23')](respondWithResult(_0x4f805f,null))['catch'](handleError(_0x4f805f,null));};exports[_0x7c9d('0x24')]=function(_0x394e0b,_0x476326){return db[_0x7c9d('0x29')][_0x7c9d('0x49')]({'where':{'id':_0x394e0b['params']['id']}})[_0x7c9d('0x23')](handleEntityNotFound(_0x476326,null))[_0x7c9d('0x23')](removeEntity(_0x476326,null))[_0x7c9d('0x46')](handleError(_0x476326,null));};exports[_0x7c9d('0x4a')]=function(_0x38defa,_0x33dabc){return db[_0x7c9d('0x29')]['describe']()['then'](respondWithResult(_0x33dabc,null))[_0x7c9d('0x46')](handleError(_0x33dabc,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 346014b..d71decc 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 _0xd1bd=['../../config/logger','api','moment','request-promise','path','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','lodash','util'];(function(_0x408a94,_0x47fbf1){var _0x18fc0e=function(_0x1353c7){while(--_0x1353c7){_0x408a94['push'](_0x408a94['shift']());}};_0x18fc0e(++_0x47fbf1);}(_0xd1bd,0x184));var _0xdd1b=function(_0x367e6c,_0x5896c6){_0x367e6c=_0x367e6c-0x0;var _0x416091=_0xd1bd[_0x367e6c];return _0x416091;};'use strict';var _=require(_0xdd1b('0x0'));var util=require(_0xdd1b('0x1'));var logger=require(_0xdd1b('0x2'))(_0xdd1b('0x3'));var moment=require(_0xdd1b('0x4'));var BPromise=require('bluebird');var rp=require(_0xdd1b('0x5'));var fs=require('fs');var path=require(_0xdd1b('0x6'));var rimraf=require('rimraf');var config=require(_0xdd1b('0x7'));var attributes=require(_0xdd1b('0x8'));module[_0xdd1b('0x9')]=function(_0x5be672,_0xeebc65){return _0x5be672[_0xdd1b('0xa')](_0xdd1b('0xb'),attributes,{'tableName':_0xdd1b('0xc'),'paranoid':![],'indexes':[{'name':_0xdd1b('0xd'),'fields':[_0xdd1b('0xe'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2309=['util','../../config/logger','api','bluebird','request-promise','path','./userProfileSection.attributes','UserProfileSection','user_profile_has_sections','sectionId','userProfileId'];(function(_0x3b78e1,_0x5aaca2){var _0x2871d1=function(_0x3025ad){while(--_0x3025ad){_0x3b78e1['push'](_0x3b78e1['shift']());}};_0x2871d1(++_0x5aaca2);}(_0x2309,0xb0));var _0x9230=function(_0x4545bb,_0x1367ed){_0x4545bb=_0x4545bb-0x0;var _0x1cdaca=_0x2309[_0x4545bb];return _0x1cdaca;};'use strict';var _=require('lodash');var util=require(_0x9230('0x0'));var logger=require(_0x9230('0x1'))(_0x9230('0x2'));var moment=require('moment');var BPromise=require(_0x9230('0x3'));var rp=require(_0x9230('0x4'));var fs=require('fs');var path=require(_0x9230('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9230('0x6'));module['exports']=function(_0x240410,_0x49407b){return _0x240410['define'](_0x9230('0x7'),attributes,{'tableName':_0x9230('0x8'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x9230('0x9'),_0x9230('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 3f2e6c7..fd41b8e 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 _0x8873=['../../config/environment','client','http','request','then','info','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','UserProfileSection,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x53ac9f,_0x1d5520){var _0x187405=function(_0x4e9feb){while(--_0x4e9feb){_0x53ac9f['push'](_0x53ac9f['shift']());}};_0x187405(++_0x1d5520);}(_0x8873,0xc7));var _0x3887=function(_0x12309b,_0x59dd8c){_0x12309b=_0x12309b-0x0;var _0x482e4d=_0x8873[_0x12309b];return _0x482e4d;};'use strict';var _=require(_0x3887('0x0'));var util=require(_0x3887('0x1'));var moment=require('moment');var BPromise=require(_0x3887('0x2'));var rs=require(_0x3887('0x3'));var fs=require('fs');var Redis=require(_0x3887('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3887('0x5'));var logger=require(_0x3887('0x6'))(_0x3887('0x7'));var config=require(_0x3887('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3887('0x9')][_0x3887('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c1d3e,_0x4a8637,_0x14af44){return new BPromise(function(_0x1d912d,_0x550bf0){return client[_0x3887('0xb')](_0x5c1d3e,_0x14af44)[_0x3887('0xc')](function(_0x120890){logger[_0x3887('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x4a8637,'request\x20sent');logger[_0x3887('0xe')](_0x3887('0xf'),_0x4a8637,_0x3887('0x10'),JSON['stringify'](_0x120890));if(_0x120890[_0x3887('0x11')]){if(_0x120890['error'][_0x3887('0x12')]===0x1f4){logger[_0x3887('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x4a8637,_0x120890[_0x3887('0x11')][_0x3887('0x13')]);return _0x550bf0(_0x120890[_0x3887('0x11')][_0x3887('0x13')]);}logger['error'](_0x3887('0x14'),_0x4a8637,_0x120890[_0x3887('0x11')][_0x3887('0x13')]);return _0x1d912d(_0x120890[_0x3887('0x11')]['message']);}else{logger[_0x3887('0xd')]('UserProfileSection,\x20%s,\x20%s',_0x4a8637,_0x3887('0x10'));_0x1d912d(_0x120890[_0x3887('0x15')][_0x3887('0x13')]);}})[_0x3887('0x16')](function(_0x54ef60){logger[_0x3887('0x11')](_0x3887('0x14'),_0x4a8637,_0x54ef60);_0x550bf0(_0x54ef60);});});} \ No newline at end of file +var _0xe956=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x1fc7bf,_0x3f1119){var _0x467fdc=function(_0xc01300){while(--_0xc01300){_0x1fc7bf['push'](_0x1fc7bf['shift']());}};_0x467fdc(++_0x3f1119);}(_0xe956,0x168));var _0x6e95=function(_0x384639,_0x5f8682){_0x384639=_0x384639-0x0;var _0x5c1671=_0xe956[_0x384639];return _0x5c1671;};'use strict';var _=require(_0x6e95('0x0'));var util=require(_0x6e95('0x1'));var moment=require(_0x6e95('0x2'));var BPromise=require(_0x6e95('0x3'));var rs=require(_0x6e95('0x4'));var fs=require('fs');var Redis=require(_0x6e95('0x5'));var db=require(_0x6e95('0x6'))['db'];var utils=require(_0x6e95('0x7'));var logger=require(_0x6e95('0x8'))('rpc');var config=require(_0x6e95('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6e95('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48bd7a,_0x31670c,_0x564934){return new BPromise(function(_0x32425c,_0x23a342){return client[_0x6e95('0xb')](_0x48bd7a,_0x564934)[_0x6e95('0xc')](function(_0x1dd823){logger[_0x6e95('0xd')](_0x6e95('0xe'),_0x31670c,_0x6e95('0xf'));logger[_0x6e95('0x10')](_0x6e95('0x11'),_0x31670c,'request\x20sent',JSON[_0x6e95('0x12')](_0x1dd823));if(_0x1dd823[_0x6e95('0x13')]){if(_0x1dd823['error'][_0x6e95('0x14')]===0x1f4){logger[_0x6e95('0x13')](_0x6e95('0xe'),_0x31670c,_0x1dd823['error'][_0x6e95('0x15')]);return _0x23a342(_0x1dd823[_0x6e95('0x13')][_0x6e95('0x15')]);}logger[_0x6e95('0x13')](_0x6e95('0xe'),_0x31670c,_0x1dd823['error'][_0x6e95('0x15')]);return _0x32425c(_0x1dd823[_0x6e95('0x13')]['message']);}else{logger[_0x6e95('0xd')](_0x6e95('0xe'),_0x31670c,_0x6e95('0xf'));_0x32425c(_0x1dd823[_0x6e95('0x16')][_0x6e95('0x15')]);}})[_0x6e95('0x17')](function(_0x777071){logger[_0x6e95('0x13')](_0x6e95('0xe'),_0x31670c,_0x777071);_0x23a342(_0x777071);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index a5d8365..331657d 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xf78e4e,_0x41364d){var _0x5e3dc4=function(_0x58c154){while(--_0x58c154){_0xf78e4e['push'](_0xf78e4e['shift']());}};_0x5e3dc4(++_0x41364d);}(_0xe706,0xa3));var _0x6e70=function(_0x325539,_0x36ad8f){_0x325539=_0x325539-0x0;var _0x47401d=_0xe706[_0x325539];return _0x47401d;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3d3b05,_0x334c57){var _0x2c6ca3=function(_0x3fd1cc){while(--_0x3fd1cc){_0x3d3b05['push'](_0x3d3b05['shift']());}};_0x2c6ca3(++_0x334c57);}(_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 diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 5a9dc7f..24bb178 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 _0xc50d=['exports','INTEGER'];(function(_0x489bc7,_0xb17020){var _0x1bc313=function(_0x9df9be){while(--_0x9df9be){_0x489bc7['push'](_0x489bc7['shift']());}};_0x1bc313(++_0xb17020);}(_0xc50d,0x1aa));var _0xdc50=function(_0x161d52,_0x1d476a){_0x161d52=_0x161d52-0x0;var _0x1875c6=_0xc50d[_0x161d52];return _0x1875c6;};'use strict';var Sequelize=require('sequelize');module[_0xdc50('0x0')]={'penalty':{'type':Sequelize[_0xdc50('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7610=['sequelize','exports','INTEGER'];(function(_0xac73bf,_0x387fe0){var _0x21d34d=function(_0x22a057){while(--_0x22a057){_0xac73bf['push'](_0xac73bf['shift']());}};_0x21d34d(++_0x387fe0);}(_0x7610,0x123));var _0x0761=function(_0x577812,_0x14a2c7){_0x577812=_0x577812-0x0;var _0x2b3901=_0x7610[_0x577812];return _0x2b3901;};'use strict';var Sequelize=require(_0x0761('0x0'));module[_0x0761('0x1')]={'penalty':{'type':Sequelize[_0x0761('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 9f21e96..c7a09cb 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 _0xbd10=['UserSmsQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xbd10,0x85));var _0x0bd1=function(_0x5d1a13,_0x205e19){_0x5d1a13=_0x5d1a13-0x0;var _0x4a45b5=_0xbd10[_0x5d1a13];return _0x4a45b5;};'use strict';var _=require(_0x0bd1('0x0'));var util=require(_0x0bd1('0x1'));var logger=require(_0x0bd1('0x2'))('api');var moment=require(_0x0bd1('0x3'));var BPromise=require(_0x0bd1('0x4'));var rp=require(_0x0bd1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0bd1('0x6'));var config=require(_0x0bd1('0x7'));var attributes=require(_0x0bd1('0x8'));module[_0x0bd1('0x9')]=function(_0x453508,_0x46c432){return _0x453508['define'](_0x0bd1('0xa'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa809=['exports','UserSmsQueue','user_has_sms_queues','util','moment','rimraf','../../config/environment','./userSmsQueue.attributes'];(function(_0x1ebfba,_0x5c7da1){var _0xac7f9c=function(_0x14cdc9){while(--_0x14cdc9){_0x1ebfba['push'](_0x1ebfba['shift']());}};_0xac7f9c(++_0x5c7da1);}(_0xa809,0x1f3));var _0x9a80=function(_0x12fc25,_0x1c877a){_0x12fc25=_0x12fc25-0x0;var _0x106e42=_0xa809[_0x12fc25];return _0x106e42;};'use strict';var _=require('lodash');var util=require(_0x9a80('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9a80('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9a80('0x2'));var config=require(_0x9a80('0x3'));var attributes=require(_0x9a80('0x4'));module[_0x9a80('0x5')]=function(_0x4c748d,_0x295910){return _0x4c748d['define'](_0x9a80('0x6'),attributes,{'tableName':_0x9a80('0x7'),'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 b61bf6e..e048c22 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 _0x67af=['error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x513605,_0x3b7e09){var _0x34c331=function(_0x122693){while(--_0x122693){_0x513605['push'](_0x513605['shift']());}};_0x34c331(++_0x3b7e09);}(_0x67af,0x6d));var _0xf67a=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0x67af[_0x3fb030];return _0xd6899b;};'use strict';var _=require(_0xf67a('0x0'));var util=require(_0xf67a('0x1'));var moment=require(_0xf67a('0x2'));var BPromise=require(_0xf67a('0x3'));var rs=require(_0xf67a('0x4'));var fs=require('fs');var Redis=require(_0xf67a('0x5'));var db=require(_0xf67a('0x6'))['db'];var utils=require(_0xf67a('0x7'));var logger=require(_0xf67a('0x8'))(_0xf67a('0x9'));var config=require(_0xf67a('0xa'));var jayson=require(_0xf67a('0xb'));var client=jayson[_0xf67a('0xc')][_0xf67a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4807b0,_0x49d458,_0x204d4d){return new BPromise(function(_0x5f0c94,_0x304212){return client[_0xf67a('0xe')](_0x4807b0,_0x204d4d)[_0xf67a('0xf')](function(_0x32ae0f){logger['info'](_0xf67a('0x10'),_0x49d458,_0xf67a('0x11'));logger[_0xf67a('0x12')](_0xf67a('0x13'),_0x49d458,_0xf67a('0x11'),JSON[_0xf67a('0x14')](_0x32ae0f));if(_0x32ae0f[_0xf67a('0x15')]){if(_0x32ae0f[_0xf67a('0x15')]['code']===0x1f4){logger[_0xf67a('0x15')](_0xf67a('0x10'),_0x49d458,_0x32ae0f['error']['message']);return _0x304212(_0x32ae0f[_0xf67a('0x15')]['message']);}logger[_0xf67a('0x15')](_0xf67a('0x10'),_0x49d458,_0x32ae0f['error'][_0xf67a('0x16')]);return _0x5f0c94(_0x32ae0f['error'][_0xf67a('0x16')]);}else{logger[_0xf67a('0x17')](_0xf67a('0x10'),_0x49d458,_0xf67a('0x11'));_0x5f0c94(_0x32ae0f[_0xf67a('0x18')]['message']);}})[_0xf67a('0x19')](function(_0x55c1c5){logger[_0xf67a('0x15')](_0xf67a('0x10'),_0x49d458,_0x55c1c5);_0x304212(_0x55c1c5);});});} \ No newline at end of file +var _0x7aa7=['http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x4f46f1,_0x2a39b9){var _0x5e146b=function(_0x5aed22){while(--_0x5aed22){_0x4f46f1['push'](_0x4f46f1['shift']());}};_0x5e146b(++_0x2a39b9);}(_0x7aa7,0x1f0));var _0x77aa=function(_0x2e1521,_0x34d611){_0x2e1521=_0x2e1521-0x0;var _0x3a9886=_0x7aa7[_0x2e1521];return _0x3a9886;};'use strict';var _=require(_0x77aa('0x0'));var util=require(_0x77aa('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77aa('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x77aa('0x3'));var logger=require(_0x77aa('0x4'))(_0x77aa('0x5'));var config=require('../../config/environment');var jayson=require(_0x77aa('0x6'));var client=jayson[_0x77aa('0x7')][_0x77aa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa9836c,_0xe4e7f6,_0x8b3a97){return new BPromise(function(_0x2a6bc4,_0x10bfe5){return client[_0x77aa('0x9')](_0xa9836c,_0x8b3a97)[_0x77aa('0xa')](function(_0x1a003a){logger[_0x77aa('0xb')](_0x77aa('0xc'),_0xe4e7f6,'request\x20sent');logger[_0x77aa('0xd')](_0x77aa('0xe'),_0xe4e7f6,_0x77aa('0xf'),JSON['stringify'](_0x1a003a));if(_0x1a003a[_0x77aa('0x10')]){if(_0x1a003a[_0x77aa('0x10')][_0x77aa('0x11')]===0x1f4){logger['error'](_0x77aa('0xc'),_0xe4e7f6,_0x1a003a[_0x77aa('0x10')][_0x77aa('0x12')]);return _0x10bfe5(_0x1a003a[_0x77aa('0x10')][_0x77aa('0x12')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0xe4e7f6,_0x1a003a[_0x77aa('0x10')][_0x77aa('0x12')]);return _0x2a6bc4(_0x1a003a[_0x77aa('0x10')][_0x77aa('0x12')]);}else{logger[_0x77aa('0xb')](_0x77aa('0xc'),_0xe4e7f6,_0x77aa('0xf'));_0x2a6bc4(_0x1a003a[_0x77aa('0x13')][_0x77aa('0x12')]);}})[_0x77aa('0x14')](function(_0x16fa29){logger[_0x77aa('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0xe4e7f6,_0x16fa29);_0x10bfe5(_0x16fa29);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 91f844a..60982d7 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 _0xb04e=['sequelize','exports','INTEGER'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0xb04e,0x1d1));var _0xeb04=function(_0x244453,_0x3b736b){_0x244453=_0x244453-0x0;var _0xbb315f=_0xb04e[_0x244453];return _0xbb315f;};'use strict';var Sequelize=require(_0xeb04('0x0'));module[_0xeb04('0x1')]={'UserId':{'type':Sequelize[_0xeb04('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe476=['exports','INTEGER','sequelize'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0xe476,0x1a0));var _0x6e47=function(_0x4f6ef5,_0x4dd3fe){_0x4f6ef5=_0x4f6ef5-0x0;var _0x34021c=_0xe476[_0x4f6ef5];return _0x34021c;};'use strict';var Sequelize=require(_0x6e47('0x0'));module[_0x6e47('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x6e47('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index a7eaae0..723ed18 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(_0x5581c7,_0x8e73ff){var _0x33288b=function(_0x14a208){while(--_0x14a208){_0x5581c7['push'](_0x5581c7['shift']());}};_0x33288b(++_0x8e73ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x13e889,_0x5473bf){var _0xb04284=function(_0x842350){while(--_0x842350){_0x13e889['push'](_0x13e889['shift']());}};_0xb04284(++_0x5473bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 f7b1728..1c02a0f 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4a4760,_0x7ce6b4){var _0x3c2c17=function(_0x201577){while(--_0x201577){_0x4a4760['push'](_0x4a4760['shift']());}};_0x3c2c17(++_0x7ce6b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x39771e,_0x5f9c91){var _0x50dba8=function(_0xf2fff){while(--_0xf2fff){_0x39771e['push'](_0x39771e['shift']());}};_0x50dba8(++_0x5f9c91);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0xcb91[_0x5c5c52];return _0x4229ff;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index e817529..04694b7 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 _0x5d95=['exports','sequelize'];(function(_0x1fa381,_0x758c2a){var _0x47eefe=function(_0x127f8c){while(--_0x127f8c){_0x1fa381['push'](_0x1fa381['shift']());}};_0x47eefe(++_0x758c2a);}(_0x5d95,0x161));var _0x55d9=function(_0x24d17b,_0x38a722){_0x24d17b=_0x24d17b-0x0;var _0x4ea101=_0x5d95[_0x24d17b];return _0x4ea101;};'use strict';var Sequelize=require(_0x55d9('0x0'));module[_0x55d9('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4316=['exports','INTEGER','sequelize'];(function(_0x5e1ca5,_0x59c8e8){var _0xfee2c=function(_0x4032d8){while(--_0x4032d8){_0x5e1ca5['push'](_0x5e1ca5['shift']());}};_0xfee2c(++_0x59c8e8);}(_0x4316,0x1ee));var _0x6431=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4316[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6431('0x0'));module[_0x6431('0x1')]={'penalty':{'type':Sequelize[_0x6431('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 32a332d..e82d094 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 _0x9317=['path','rimraf','../../config/environment','exports','define','UserVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x242299,_0x42b336){var _0x77b12b=function(_0x59887d){while(--_0x59887d){_0x242299['push'](_0x242299['shift']());}};_0x77b12b(++_0x42b336);}(_0x9317,0xe3));var _0x7931=function(_0x309d93,_0x157662){_0x309d93=_0x309d93-0x0;var _0x2dd61d=_0x9317[_0x309d93];return _0x2dd61d;};'use strict';var _=require(_0x7931('0x0'));var util=require(_0x7931('0x1'));var logger=require(_0x7931('0x2'))(_0x7931('0x3'));var moment=require(_0x7931('0x4'));var BPromise=require(_0x7931('0x5'));var rp=require(_0x7931('0x6'));var fs=require('fs');var path=require(_0x7931('0x7'));var rimraf=require(_0x7931('0x8'));var config=require(_0x7931('0x9'));var attributes=require('./userVoiceQueue.attributes');module[_0x7931('0xa')]=function(_0x472c85,_0x3fd0d0){return _0x472c85[_0x7931('0xb')](_0x7931('0xc'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56fa=['exports','define','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x44df6a,_0x5056c0){var _0x5320c5=function(_0x37bd5b){while(--_0x37bd5b){_0x44df6a['push'](_0x44df6a['shift']());}};_0x5320c5(++_0x5056c0);}(_0x56fa,0xca));var _0xa56f=function(_0x4f8cb0,_0x4ee989){_0x4f8cb0=_0x4f8cb0-0x0;var _0x48ebc4=_0x56fa[_0x4f8cb0];return _0x48ebc4;};'use strict';var _=require('lodash');var util=require(_0xa56f('0x0'));var logger=require(_0xa56f('0x1'))(_0xa56f('0x2'));var moment=require(_0xa56f('0x3'));var BPromise=require(_0xa56f('0x4'));var rp=require(_0xa56f('0x5'));var fs=require('fs');var path=require(_0xa56f('0x6'));var rimraf=require(_0xa56f('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0xa56f('0x8')]=function(_0x4fae7d,_0x1557e4){return _0x4fae7d[_0xa56f('0x9')]('UserVoiceQueue',attributes,{'tableName':'user_has_voice_queues','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 6e12145..c434609 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 _0x7c32=['bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util'];(function(_0x33a7dd,_0x215615){var _0x438702=function(_0x556e69){while(--_0x556e69){_0x33a7dd['push'](_0x33a7dd['shift']());}};_0x438702(++_0x215615);}(_0x7c32,0x14e));var _0x27c3=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7c32[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x27c3('0x0'));var util=require(_0x27c3('0x1'));var moment=require('moment');var BPromise=require(_0x27c3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x27c3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x27c3('0x4'));var logger=require(_0x27c3('0x5'))(_0x27c3('0x6'));var config=require(_0x27c3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x27c3('0x8')][_0x27c3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf2480f,_0x42d0fa,_0xcebb6d){return new BPromise(function(_0x498e27,_0x4f6ddc){return client[_0x27c3('0xa')](_0xf2480f,_0xcebb6d)[_0x27c3('0xb')](function(_0x16c4e7){logger[_0x27c3('0xc')](_0x27c3('0xd'),_0x42d0fa,_0x27c3('0xe'));logger[_0x27c3('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x42d0fa,'request\x20sent',JSON['stringify'](_0x16c4e7));if(_0x16c4e7[_0x27c3('0x10')]){if(_0x16c4e7['error'][_0x27c3('0x11')]===0x1f4){logger['error'](_0x27c3('0xd'),_0x42d0fa,_0x16c4e7[_0x27c3('0x10')][_0x27c3('0x12')]);return _0x4f6ddc(_0x16c4e7[_0x27c3('0x10')][_0x27c3('0x12')]);}logger[_0x27c3('0x10')](_0x27c3('0xd'),_0x42d0fa,_0x16c4e7[_0x27c3('0x10')][_0x27c3('0x12')]);return _0x498e27(_0x16c4e7[_0x27c3('0x10')][_0x27c3('0x12')]);}else{logger['info'](_0x27c3('0xd'),_0x42d0fa,_0x27c3('0xe'));_0x498e27(_0x16c4e7[_0x27c3('0x13')][_0x27c3('0x12')]);}})[_0x27c3('0x14')](function(_0x4ea6c1){logger[_0x27c3('0x10')](_0x27c3('0xd'),_0x42d0fa,_0x4ea6c1);_0x4f6ddc(_0x4ea6c1);});});} \ No newline at end of file +var _0xb8df=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x52c206,_0x3ed3d4){var _0x2ca104=function(_0x54661f){while(--_0x54661f){_0x52c206['push'](_0x52c206['shift']());}};_0x2ca104(++_0x3ed3d4);}(_0xb8df,0x18e));var _0xfb8d=function(_0x5a1cc9,_0x28f54d){_0x5a1cc9=_0x5a1cc9-0x0;var _0x471761=_0xb8df[_0x5a1cc9];return _0x471761;};'use strict';var _=require(_0xfb8d('0x0'));var util=require(_0xfb8d('0x1'));var moment=require(_0xfb8d('0x2'));var BPromise=require(_0xfb8d('0x3'));var rs=require(_0xfb8d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfb8d('0x5'))['db'];var utils=require(_0xfb8d('0x6'));var logger=require('../../config/logger')(_0xfb8d('0x7'));var config=require(_0xfb8d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfb8d('0x9')][_0xfb8d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35af2e,_0x3aa0be,_0x4c3359){return new BPromise(function(_0x3afa88,_0x18ee9){return client[_0xfb8d('0xb')](_0x35af2e,_0x4c3359)[_0xfb8d('0xc')](function(_0x22c88c){logger['info'](_0xfb8d('0xd'),_0x3aa0be,_0xfb8d('0xe'));logger['debug'](_0xfb8d('0xf'),_0x3aa0be,_0xfb8d('0xe'),JSON[_0xfb8d('0x10')](_0x22c88c));if(_0x22c88c[_0xfb8d('0x11')]){if(_0x22c88c['error'][_0xfb8d('0x12')]===0x1f4){logger[_0xfb8d('0x11')](_0xfb8d('0xd'),_0x3aa0be,_0x22c88c[_0xfb8d('0x11')]['message']);return _0x18ee9(_0x22c88c[_0xfb8d('0x11')][_0xfb8d('0x13')]);}logger[_0xfb8d('0x11')](_0xfb8d('0xd'),_0x3aa0be,_0x22c88c[_0xfb8d('0x11')][_0xfb8d('0x13')]);return _0x3afa88(_0x22c88c[_0xfb8d('0x11')]['message']);}else{logger['info'](_0xfb8d('0xd'),_0x3aa0be,'request\x20sent');_0x3afa88(_0x22c88c[_0xfb8d('0x14')][_0xfb8d('0x13')]);}})['catch'](function(_0x1e11cf){logger[_0xfb8d('0x11')](_0xfb8d('0xd'),_0x3aa0be,_0x1e11cf);_0x18ee9(_0x1e11cf);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index d14600a..34fc59e 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x500914,_0x3dc5ad){var _0x189042=function(_0x23d970){while(--_0x23d970){_0x500914['push'](_0x500914['shift']());}};_0x189042(++_0x3dc5ad);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x666065,_0xf3ed90){var _0x1fd893=function(_0x59d72c){while(--_0x59d72c){_0x666065['push'](_0x666065['shift']());}};_0x1fd893(++_0xf3ed90);}(_0x70e0,0x17b));var _0x070e=function(_0x571e9c,_0x387dce){_0x571e9c=_0x571e9c-0x0;var _0x143100=_0x70e0[_0x571e9c];return _0x143100;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 8d88c74..a570f93 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 _0x342a=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x4ed8c6,_0x59180b){var _0x10d4df=function(_0x3f5508){while(--_0x3f5508){_0x4ed8c6['push'](_0x4ed8c6['shift']());}};_0x10d4df(++_0x59180b);}(_0x342a,0xa2));var _0xa342=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x342a[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xa342('0x0'));module[_0xa342('0x1')]={'uniqueid':{'type':Sequelize[_0xa342('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xa342('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xa342('0x3')},'UserId':{'type':Sequelize[_0xa342('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xa342('0x4')],'allowNull':![],'unique':_0xa342('0x5'),'comment':_0xa342('0x3')},'VoiceQueueId':{'type':Sequelize[_0xa342('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xa342('0x4')],'allowNull':![],'unique':_0xa342('0x5'),'comment':_0xa342('0x3')},'penalty':{'type':Sequelize[_0xa342('0x2')](0xb),'defaultValue':0x0,'comment':_0xa342('0x3')},'paused':{'type':Sequelize[_0xa342('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x3c15=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x3c15,0x172));var _0x53c1=function(_0x3ed75e,_0x5f465a){_0x3ed75e=_0x3ed75e-0x0;var _0x441dac=_0x3c15[_0x3ed75e];return _0x441dac;};'use strict';var Sequelize=require('sequelize');module[_0x53c1('0x0')]={'uniqueid':{'type':Sequelize[_0x53c1('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x53c1('0x2')},'membername':{'type':Sequelize[_0x53c1('0x3')],'allowNull':![],'comment':_0x53c1('0x2')},'UserId':{'type':Sequelize[_0x53c1('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x53c1('0x4'),'comment':_0x53c1('0x2')},'VoiceQueueId':{'type':Sequelize[_0x53c1('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':'queue_interface','comment':_0x53c1('0x2')},'penalty':{'type':Sequelize[_0x53c1('0x1')](0xb),'defaultValue':0x0,'comment':_0x53c1('0x2')},'paused':{'type':Sequelize[_0x53c1('0x1')](0xb),'defaultValue':0x0,'comment':_0x53c1('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 2b10c88..118c057 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 _0xe051=['remove','emit','hasOwnProperty','hook','events','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x22ad2,_0x4d5987){var _0x423856=function(_0x293c83){while(--_0x293c83){_0x22ad2['push'](_0x22ad2['shift']());}};_0x423856(++_0x4d5987);}(_0xe051,0xf4));var _0x1e05=function(_0x5e50c4,_0x48576f){_0x5e50c4=_0x5e50c4-0x0;var _0x10abd2=_0xe051[_0x5e50c4];return _0x10abd2;};'use strict';var EventEmitter=require(_0x1e05('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x1e05('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x1e05('0x2')](0x0);var events={'afterCreate':_0x1e05('0x3'),'afterUpdate':'update','afterDestroy':_0x1e05('0x4')};function emitEvent(_0x4f76b9){return function(_0x31e869,_0x101942,_0x3c763b){UserVoiceQueueRtEvents[_0x1e05('0x5')](_0x4f76b9+':'+_0x31e869['id'],_0x31e869);UserVoiceQueueRtEvents[_0x1e05('0x5')](_0x4f76b9,_0x31e869);_0x3c763b(null);};}for(var e in events){if(events[_0x1e05('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x1e05('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x3e03=['events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x1942c0,_0x499203){var _0x1e3575=function(_0x22c8ac){while(--_0x22c8ac){_0x1942c0['push'](_0x1942c0['shift']());}};_0x1e3575(++_0x499203);}(_0x3e03,0x10e));var _0x33e0=function(_0x204ad4,_0x502841){_0x204ad4=_0x204ad4-0x0;var _0x50675f=_0x3e03[_0x204ad4];return _0x50675f;};'use strict';var EventEmitter=require(_0x33e0('0x0'));var UserVoiceQueueRt=require(_0x33e0('0x1'))['db'][_0x33e0('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x33e0('0x3')](0x0);var events={'afterCreate':_0x33e0('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x59a24b){return function(_0x26a135,_0x473997,_0x46e8d8){UserVoiceQueueRtEvents[_0x33e0('0x5')](_0x59a24b+':'+_0x26a135['id'],_0x26a135);UserVoiceQueueRtEvents['emit'](_0x59a24b,_0x26a135);_0x46e8d8(null);};}for(var e in events){if(events[_0x33e0('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x33e0('0x7')](e,emitEvent(event));}}module[_0x33e0('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 13cc1b1..9c8ffc9 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 _0x9b67=['moment','bluebird','path','rimraf','../../config/environment','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger'];(function(_0x46bb87,_0x5a88fa){var _0x304cdc=function(_0x277021){while(--_0x277021){_0x46bb87['push'](_0x46bb87['shift']());}};_0x304cdc(++_0x5a88fa);}(_0x9b67,0x73));var _0x79b6=function(_0x1f6495,_0x505632){_0x1f6495=_0x1f6495-0x0;var _0x517a91=_0x9b67[_0x1f6495];return _0x517a91;};'use strict';var _=require(_0x79b6('0x0'));var util=require('util');var logger=require(_0x79b6('0x1'))('api');var moment=require(_0x79b6('0x2'));var BPromise=require(_0x79b6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79b6('0x4'));var rimraf=require(_0x79b6('0x5'));var config=require(_0x79b6('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x372bdf,_0x4b08ab){return _0x372bdf['define'](_0x79b6('0x7'),attributes,{'tableName':_0x79b6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f60=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./userVoiceQueueRt.attributes','UserVoiceQueueRt'];(function(_0x2291e2,_0x2f2898){var _0x33d13f=function(_0x239a0d){while(--_0x239a0d){_0x2291e2['push'](_0x2291e2['shift']());}};_0x33d13f(++_0x2f2898);}(_0x3f60,0x18c));var _0x03f6=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x3f60[_0x1477ef];return _0x164acd;};'use strict';var _=require('lodash');var util=require(_0x03f6('0x0'));var logger=require(_0x03f6('0x1'))('api');var moment=require(_0x03f6('0x2'));var BPromise=require(_0x03f6('0x3'));var rp=require(_0x03f6('0x4'));var fs=require('fs');var path=require(_0x03f6('0x5'));var rimraf=require('rimraf');var config=require(_0x03f6('0x6'));var attributes=require(_0x03f6('0x7'));module['exports']=function(_0x495339,_0x87a622){return _0x495339['define'](_0x03f6('0x8'),attributes,{'tableName':'user_has_voice_queues_rt','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 eb71b8a..0059e01 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 _0x58ae=['moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','stringify','lodash','util'];(function(_0x1ba75d,_0x39f1f3){var _0x325497=function(_0x5d09f4){while(--_0x5d09f4){_0x1ba75d['push'](_0x1ba75d['shift']());}};_0x325497(++_0x39f1f3);}(_0x58ae,0x152));var _0xe58a=function(_0x1a362a,_0x532d2e){_0x1a362a=_0x1a362a-0x0;var _0x1c6fc4=_0x58ae[_0x1a362a];return _0x1c6fc4;};'use strict';var _=require(_0xe58a('0x0'));var util=require(_0xe58a('0x1'));var moment=require(_0xe58a('0x2'));var BPromise=require(_0xe58a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe58a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe58a('0x5'));var logger=require(_0xe58a('0x6'))('rpc');var config=require(_0xe58a('0x7'));var jayson=require(_0xe58a('0x8'));var client=jayson[_0xe58a('0x9')][_0xe58a('0xa')]({'port':0x232a});config[_0xe58a('0xb')]=_[_0xe58a('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe58a('0xd'))(new Redis(config['redis']));require('./userVoiceQueueRt.socket')[_0xe58a('0xe')](socket);function respondWithRpcPromise(_0x231d82,_0x3be3ee,_0x1c321b){return new BPromise(function(_0xddc2ea,_0x302c7f){return client[_0xe58a('0xf')](_0x231d82,_0x1c321b)['then'](function(_0x248eb5){logger[_0xe58a('0x10')](_0xe58a('0x11'),_0x3be3ee,_0xe58a('0x12'));logger[_0xe58a('0x13')](_0xe58a('0x14'),_0x3be3ee,_0xe58a('0x12'),JSON['stringify'](_0x248eb5));if(_0x248eb5[_0xe58a('0x15')]){if(_0x248eb5[_0xe58a('0x15')]['code']===0x1f4){logger[_0xe58a('0x15')](_0xe58a('0x11'),_0x3be3ee,_0x248eb5['error']['message']);return _0x302c7f(_0x248eb5[_0xe58a('0x15')]['message']);}logger[_0xe58a('0x15')](_0xe58a('0x11'),_0x3be3ee,_0x248eb5['error'][_0xe58a('0x16')]);return _0xddc2ea(_0x248eb5[_0xe58a('0x15')][_0xe58a('0x16')]);}else{logger[_0xe58a('0x10')](_0xe58a('0x11'),_0x3be3ee,'request\x20sent');_0xddc2ea(_0x248eb5['result'][_0xe58a('0x16')]);}})[_0xe58a('0x17')](function(_0x4e0350){logger[_0xe58a('0x15')](_0xe58a('0x11'),_0x3be3ee,_0x4e0350);_0x302c7f(_0x4e0350);});});}exports[_0xe58a('0x18')]=function(_0x328a9f){var _0x1b812b=this;return new Promise(function(_0x3ec115,_0x2245d2){return db[_0xe58a('0x19')][_0xe58a('0x1a')]({'raw':_0x328a9f['options']?_0x328a9f['options']['raw']===undefined?!![]:![]:!![],'where':_0x328a9f[_0xe58a('0x1b')]?_0x328a9f['options'][_0xe58a('0x1c')]||null:null,'attributes':[[db['sequelize']['fn'](_0xe58a('0x1d'),db[_0xe58a('0x1e')]['fn']('IF',db[_0xe58a('0x1e')][_0xe58a('0x1f')](_0xe58a('0x20')))),'outboundQueuePauses']]})['then'](function(_0x3d6fc6){logger['info']('GetVoiceQueueRtPauses',_0x328a9f);logger[_0xe58a('0x13')](_0xe58a('0x18'),_0x328a9f,JSON[_0xe58a('0x21')](_0x3d6fc6));_0x3ec115(_0x3d6fc6);})['catch'](function(_0x571f54){logger['error'](_0xe58a('0x18'),_0x571f54['message'],_0x328a9f);_0x2245d2(_0x1b812b['error'](0x1f4,_0x571f54['message']));});});}; \ No newline at end of file +var _0x8320=['raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options'];(function(_0x494ec2,_0x347ffc){var _0x3ef604=function(_0x121036){while(--_0x121036){_0x494ec2['push'](_0x494ec2['shift']());}};_0x3ef604(++_0x347ffc);}(_0x8320,0xa5));var _0x0832=function(_0x39a757,_0x51e36d){_0x39a757=_0x39a757-0x0;var _0x3df2f=_0x8320[_0x39a757];return _0x3df2f;};'use strict';var _=require('lodash');var util=require(_0x0832('0x0'));var moment=require(_0x0832('0x1'));var BPromise=require(_0x0832('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0832('0x3'));var db=require(_0x0832('0x4'))['db'];var utils=require(_0x0832('0x5'));var logger=require(_0x0832('0x6'))(_0x0832('0x7'));var config=require(_0x0832('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0832('0x9')][_0x0832('0xa')]({'port':0x232a});config['redis']=_[_0x0832('0xb')](config[_0x0832('0xc')],{'host':_0x0832('0xd'),'port':0x18eb});var socket=require(_0x0832('0xe'))(new Redis(config[_0x0832('0xc')]));require(_0x0832('0xf'))[_0x0832('0x10')](socket);function respondWithRpcPromise(_0x30d636,_0x9911b,_0x213037){return new BPromise(function(_0x2d1684,_0x389cf5){return client[_0x0832('0x11')](_0x30d636,_0x213037)['then'](function(_0x365dbf){logger[_0x0832('0x12')](_0x0832('0x13'),_0x9911b,_0x0832('0x14'));logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x9911b,_0x0832('0x14'),JSON['stringify'](_0x365dbf));if(_0x365dbf[_0x0832('0x15')]){if(_0x365dbf[_0x0832('0x15')][_0x0832('0x16')]===0x1f4){logger['error'](_0x0832('0x13'),_0x9911b,_0x365dbf[_0x0832('0x15')][_0x0832('0x17')]);return _0x389cf5(_0x365dbf[_0x0832('0x15')][_0x0832('0x17')]);}logger[_0x0832('0x15')](_0x0832('0x13'),_0x9911b,_0x365dbf[_0x0832('0x15')]['message']);return _0x2d1684(_0x365dbf[_0x0832('0x15')][_0x0832('0x17')]);}else{logger[_0x0832('0x12')](_0x0832('0x13'),_0x9911b,'request\x20sent');_0x2d1684(_0x365dbf[_0x0832('0x18')][_0x0832('0x17')]);}})[_0x0832('0x19')](function(_0x48625d){logger[_0x0832('0x15')](_0x0832('0x13'),_0x9911b,_0x48625d);_0x389cf5(_0x48625d);});});}exports[_0x0832('0x1a')]=function(_0x1c5834){var _0x473bad=this;return new Promise(function(_0xcad556,_0x5232f7){return db[_0x0832('0x1b')][_0x0832('0x1c')]({'raw':_0x1c5834[_0x0832('0x1d')]?_0x1c5834[_0x0832('0x1d')][_0x0832('0x1e')]===undefined?!![]:![]:!![],'where':_0x1c5834[_0x0832('0x1d')]?_0x1c5834['options'][_0x0832('0x1f')]||null:null,'attributes':[[db[_0x0832('0x20')]['fn'](_0x0832('0x21'),db[_0x0832('0x20')]['fn']('IF',db[_0x0832('0x20')][_0x0832('0x22')](_0x0832('0x23')))),_0x0832('0x24')]]})[_0x0832('0x25')](function(_0xa9c906){logger['info']('GetVoiceQueueRtPauses',_0x1c5834);logger['debug'](_0x0832('0x1a'),_0x1c5834,JSON[_0x0832('0x26')](_0xa9c906));_0xcad556(_0xa9c906);})[_0x0832('0x19')](function(_0x1ba621){logger[_0x0832('0x15')]('GetVoiceQueueRtPauses',_0x1ba621[_0x0832('0x17')],_0x1c5834);_0x5232f7(_0x473bad[_0x0832('0x15')](0x1f4,_0x1ba621[_0x0832('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index b1e19f7..558f26b 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 _0xd2f5=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','emit','removeListener','register'];(function(_0x58eaec,_0x33c456){var _0x5baa30=function(_0x10589f){while(--_0x10589f){_0x58eaec['push'](_0x58eaec['shift']());}};_0x5baa30(++_0x33c456);}(_0xd2f5,0x144));var _0x5d2f=function(_0xe2e08f,_0x46dcc3){_0xe2e08f=_0xe2e08f-0x0;var _0x6a309c=_0xd2f5[_0xe2e08f];return _0x6a309c;};'use strict';var UserVoiceQueueRtEvents=require(_0x5d2f('0x0'));var events=['save',_0x5d2f('0x1'),'update'];function createListener(_0x2a7bb2,_0x4b9d79){return function(_0x784b59){_0x4b9d79[_0x5d2f('0x2')](_0x2a7bb2,_0x784b59);};}function removeListener(_0x102911,_0xc7102b){return function(){UserVoiceQueueRtEvents[_0x5d2f('0x3')](_0x102911,_0xc7102b);};}exports[_0x5d2f('0x4')]=function(_0x2392df){for(var _0x16e9fa=0x0,_0x4b2540=events[_0x5d2f('0x5')];_0x16e9fa<_0x4b2540;_0x16e9fa++){var _0x908c6=events[_0x16e9fa];var _0x1c8c59=createListener(_0x5d2f('0x6')+_0x908c6,_0x2392df);UserVoiceQueueRtEvents['on'](_0x908c6,_0x1c8c59);}}; \ No newline at end of file +var _0xdcf6=['update','emit','removeListener','save','remove'];(function(_0x3f557e,_0x5d7da5){var _0x297d3a=function(_0x1d7392){while(--_0x1d7392){_0x3f557e['push'](_0x3f557e['shift']());}};_0x297d3a(++_0x5d7da5);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x30861a,_0x337deb){_0x30861a=_0x30861a-0x0;var _0xa37ad6=_0xdcf6[_0x30861a];return _0xa37ad6;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x6dcf('0x0'),_0x6dcf('0x1'),_0x6dcf('0x2')];function createListener(_0x4402e7,_0x34db3b){return function(_0x17056c){_0x34db3b[_0x6dcf('0x3')](_0x4402e7,_0x17056c);};}function removeListener(_0x513bcb,_0x69f442){return function(){UserVoiceQueueRtEvents[_0x6dcf('0x4')](_0x513bcb,_0x69f442);};}exports['register']=function(_0x1ff8b6){for(var _0x3364bd=0x0,_0x5abd79=events['length'];_0x3364bd<_0x5abd79;_0x3364bd++){var _0x5766db=events[_0x3364bd];var _0x34517a=createListener('userVoiceQueueRt:'+_0x5766db,_0x1ff8b6);UserVoiceQueueRtEvents['on'](_0x5766db,_0x34517a);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index c54aa13..94d1807 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x316cfb,_0x162c74){var _0x48c38b=function(_0x4a45ca){while(--_0x4a45ca){_0x316cfb['push'](_0x316cfb['shift']());}};_0x48c38b(++_0x162c74);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x583e57,_0x591af5){var _0xf66be2=function(_0x3a1208){while(--_0x3a1208){_0x583e57['push'](_0x583e57['shift']());}};_0xf66be2(++_0x591af5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x274638,_0x578968){_0x274638=_0x274638-0x0;var _0x5755df=_0xcb91[_0x274638];return _0x5755df;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 2250b94..b20fba6 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 _0x6e03=['sequelize','exports','INTEGER'];(function(_0x39bc44,_0x1d4373){var _0x2916d8=function(_0x1767ac){while(--_0x1767ac){_0x39bc44['push'](_0x39bc44['shift']());}};_0x2916d8(++_0x1d4373);}(_0x6e03,0x17d));var _0x36e0=function(_0x3add3d,_0x4a60dd){_0x3add3d=_0x3add3d-0x0;var _0x578e66=_0x6e03[_0x3add3d];return _0x578e66;};'use strict';var Sequelize=require(_0x36e0('0x0'));module[_0x36e0('0x1')]={'penalty':{'type':Sequelize[_0x36e0('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfb44=['INTEGER','sequelize','exports'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0xfb44,0xd9));var _0x4fb4=function(_0x5d3b93,_0x3ad616){_0x5d3b93=_0x5d3b93-0x0;var _0x59ee25=_0xfb44[_0x5d3b93];return _0x59ee25;};'use strict';var Sequelize=require(_0x4fb4('0x0'));module[_0x4fb4('0x1')]={'penalty':{'type':Sequelize[_0x4fb4('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 156d0bf..f139cd9 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 _0x3277=['./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x1deb72,_0x3f6338){var _0x18bbdf=function(_0x1b4b9b){while(--_0x1b4b9b){_0x1deb72['push'](_0x1deb72['shift']());}};_0x18bbdf(++_0x3f6338);}(_0x3277,0xf4));var _0x7327=function(_0x43734a,_0x629b4){_0x43734a=_0x43734a-0x0;var _0x531561=_0x3277[_0x43734a];return _0x531561;};'use strict';var _=require(_0x7327('0x0'));var util=require('util');var logger=require(_0x7327('0x1'))(_0x7327('0x2'));var moment=require('moment');var BPromise=require(_0x7327('0x3'));var rp=require(_0x7327('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7327('0x5'));var config=require('../../config/environment');var attributes=require(_0x7327('0x6'));module['exports']=function(_0x1d37d2,_0xbbf5af){return _0x1d37d2[_0x7327('0x7')](_0x7327('0x8'),attributes,{'tableName':_0x7327('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2637=['./userWhatsappQueue.attributes','exports','define','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x2637,0x111));var _0x7263=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x2637[_0x4fde08];return _0x12e725;};'use strict';var _=require(_0x7263('0x0'));var util=require(_0x7263('0x1'));var logger=require(_0x7263('0x2'))('api');var moment=require(_0x7263('0x3'));var BPromise=require(_0x7263('0x4'));var rp=require(_0x7263('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7263('0x6'));var config=require('../../config/environment');var attributes=require(_0x7263('0x7'));module[_0x7263('0x8')]=function(_0x204b14,_0x9b2774){return _0x204b14[_0x7263('0x9')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 3f9cc92..596d0c6 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 _0x8c36=['then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','error','message','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request'];(function(_0x376391,_0x24f107){var _0x357f31=function(_0x5a7087){while(--_0x5a7087){_0x376391['push'](_0x376391['shift']());}};_0x357f31(++_0x24f107);}(_0x8c36,0xb1));var _0x68c3=function(_0x2ffc26,_0x2696c4){_0x2ffc26=_0x2ffc26-0x0;var _0x4e2fc3=_0x8c36[_0x2ffc26];return _0x4e2fc3;};'use strict';var _=require('lodash');var util=require(_0x68c3('0x0'));var moment=require(_0x68c3('0x1'));var BPromise=require(_0x68c3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x68c3('0x3'));var db=require(_0x68c3('0x4'))['db'];var utils=require(_0x68c3('0x5'));var logger=require('../../config/logger')(_0x68c3('0x6'));var config=require('../../config/environment');var jayson=require(_0x68c3('0x7'));var client=jayson[_0x68c3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x173a12,_0x56d7df,_0x3c65c1){return new BPromise(function(_0x4af716,_0x4559f2){return client[_0x68c3('0x9')](_0x173a12,_0x3c65c1)[_0x68c3('0xa')](function(_0x3ae399){logger[_0x68c3('0xb')](_0x68c3('0xc'),_0x56d7df,'request\x20sent');logger[_0x68c3('0xd')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x56d7df,_0x68c3('0xe'),JSON['stringify'](_0x3ae399));if(_0x3ae399['error']){if(_0x3ae399['error']['code']===0x1f4){logger['error'](_0x68c3('0xc'),_0x56d7df,_0x3ae399[_0x68c3('0xf')][_0x68c3('0x10')]);return _0x4559f2(_0x3ae399['error']['message']);}logger[_0x68c3('0xf')](_0x68c3('0xc'),_0x56d7df,_0x3ae399[_0x68c3('0xf')][_0x68c3('0x10')]);return _0x4af716(_0x3ae399[_0x68c3('0xf')]['message']);}else{logger[_0x68c3('0xb')](_0x68c3('0xc'),_0x56d7df,_0x68c3('0xe'));_0x4af716(_0x3ae399['result'][_0x68c3('0x10')]);}})['catch'](function(_0x398952){logger['error'](_0x68c3('0xc'),_0x56d7df,_0x398952);_0x4559f2(_0x398952);});});} \ No newline at end of file +var _0x0c7c=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils'];(function(_0x3e1d8e,_0x367a9b){var _0x557f6a=function(_0x989439){while(--_0x989439){_0x3e1d8e['push'](_0x3e1d8e['shift']());}};_0x557f6a(++_0x367a9b);}(_0x0c7c,0xe0));var _0xc0c7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0c7c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc0c7('0x0'));var util=require(_0xc0c7('0x1'));var moment=require(_0xc0c7('0x2'));var BPromise=require('bluebird');var rs=require(_0xc0c7('0x3'));var fs=require('fs');var Redis=require(_0xc0c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc0c7('0x5'));var logger=require(_0xc0c7('0x6'))('rpc');var config=require(_0xc0c7('0x7'));var jayson=require(_0xc0c7('0x8'));var client=jayson[_0xc0c7('0x9')][_0xc0c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59ef05,_0xbf26c2,_0x1c606c){return new BPromise(function(_0x3edf31,_0x28ee97){return client[_0xc0c7('0xb')](_0x59ef05,_0x1c606c)[_0xc0c7('0xc')](function(_0xdd9536){logger[_0xc0c7('0xd')](_0xc0c7('0xe'),_0xbf26c2,_0xc0c7('0xf'));logger[_0xc0c7('0x10')](_0xc0c7('0x11'),_0xbf26c2,'request\x20sent',JSON[_0xc0c7('0x12')](_0xdd9536));if(_0xdd9536[_0xc0c7('0x13')]){if(_0xdd9536['error']['code']===0x1f4){logger[_0xc0c7('0x13')](_0xc0c7('0xe'),_0xbf26c2,_0xdd9536[_0xc0c7('0x13')][_0xc0c7('0x14')]);return _0x28ee97(_0xdd9536['error'][_0xc0c7('0x14')]);}logger['error'](_0xc0c7('0xe'),_0xbf26c2,_0xdd9536[_0xc0c7('0x13')]['message']);return _0x3edf31(_0xdd9536[_0xc0c7('0x13')][_0xc0c7('0x14')]);}else{logger[_0xc0c7('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0xbf26c2,_0xc0c7('0xf'));_0x3edf31(_0xdd9536[_0xc0c7('0x15')]['message']);}})[_0xc0c7('0x16')](function(_0x2b34d6){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0xbf26c2,_0x2b34d6);_0x28ee97(_0x2b34d6);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 45b0457..cb298ba 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 _0x22fb=['./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x29d0d7,_0xc8a6ce){var _0x54fac3=function(_0x21bc88){while(--_0x21bc88){_0x29d0d7['push'](_0x29d0d7['shift']());}};_0x54fac3(++_0xc8a6ce);}(_0x22fb,0x192));var _0xb22f=function(_0x2b2b22,_0x3ca686){_0x2b2b22=_0x2b2b22-0x0;var _0x1cb616=_0x22fb[_0x2b2b22];return _0x1cb616;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var fs_extra=require(_0xb22f('0x3'));var auth=require(_0xb22f('0x4'));var interaction=require(_0xb22f('0x5'));var config=require('../../config/environment');var controller=require(_0xb22f('0x6'));router[_0xb22f('0x7')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0x9')]);router[_0xb22f('0x7')](_0xb22f('0xa'),auth['isAuthenticated'](),controller[_0xb22f('0xb')]);router[_0xb22f('0xc')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0xd')]);router[_0xb22f('0xe')](_0xb22f('0xa'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')](_0xb22f('0xa'),auth[_0xb22f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfe60=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','post','update','delete','destroy','exports'];(function(_0x3800a1,_0x2f706d){var _0x1ac34f=function(_0x21346c){while(--_0x21346c){_0x3800a1['push'](_0x3800a1['shift']());}};_0x1ac34f(++_0x2f706d);}(_0xfe60,0x1cb));var _0x0fe6=function(_0x5150f9,_0x3a4d65){_0x5150f9=_0x5150f9-0x0;var _0x56a6bd=_0xfe60[_0x5150f9];return _0x56a6bd;};'use strict';var multer=require('multer');var util=require(_0x0fe6('0x0'));var path=require('path');var timeout=require(_0x0fe6('0x1'));var express=require(_0x0fe6('0x2'));var router=express[_0x0fe6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0fe6('0x4'));var interaction=require(_0x0fe6('0x5'));var config=require(_0x0fe6('0x6'));var controller=require(_0x0fe6('0x7'));router[_0x0fe6('0x8')]('/',auth[_0x0fe6('0x9')](),controller[_0x0fe6('0xa')]);router[_0x0fe6('0x8')](_0x0fe6('0xb'),auth[_0x0fe6('0x9')](),controller['show']);router[_0x0fe6('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0fe6('0xb'),auth['isAuthenticated'](),controller[_0x0fe6('0xd')]);router[_0x0fe6('0xe')](_0x0fe6('0xb'),auth[_0x0fe6('0x9')](),controller[_0x0fe6('0xf')]);module[_0x0fe6('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 9f5f7e9..886db81 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 _0x2a8d=['STRING','name','sequelize','exports'];(function(_0x5acf1e,_0x2ba27c){var _0x22de0c=function(_0x49e51d){while(--_0x49e51d){_0x5acf1e['push'](_0x5acf1e['shift']());}};_0x22de0c(++_0x2ba27c);}(_0x2a8d,0x11e));var _0xd2a8=function(_0x4dc392,_0x255362){_0x4dc392=_0x4dc392-0x0;var _0x4e45ad=_0x2a8d[_0x4dc392];return _0x4e45ad;};'use strict';var Sequelize=require(_0xd2a8('0x0'));module[_0xd2a8('0x1')]={'name':{'type':Sequelize[_0xd2a8('0x2')],'unique':_0xd2a8('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd2a8('0x2')]}}; \ No newline at end of file +var _0x1d99=['exports','STRING','sequelize'];(function(_0x539fc4,_0x2ee1eb){var _0x450713=function(_0x3bad73){while(--_0x3bad73){_0x539fc4['push'](_0x539fc4['shift']());}};_0x450713(++_0x2ee1eb);}(_0x1d99,0xaa));var _0x91d9=function(_0x46579c,_0x1d2fbb){_0x46579c=_0x46579c-0x0;var _0x5354d5=_0x1d99[_0x46579c];return _0x5354d5;};'use strict';var Sequelize=require(_0x91d9('0x0'));module[_0x91d9('0x1')]={'name':{'type':Sequelize[_0x91d9('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x91d9('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index f9ec470..3f662db 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 _0x3b91=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','userProfileId','autoAssociation','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x180bc5,_0x17fd8d){var _0x310566=function(_0x5cf9fd){while(--_0x5cf9fd){_0x180bc5['push'](_0x180bc5['shift']());}};_0x310566(++_0x17fd8d);}(_0x3b91,0xe8));var _0x13b9=function(_0x2c3cea,_0x4273db){_0x2c3cea=_0x2c3cea-0x0;var _0x19136d=_0x3b91[_0x2c3cea];return _0x19136d;};'use strict';var emlformat=require(_0x13b9('0x0'));var rimraf=require(_0x13b9('0x1'));var zipdir=require(_0x13b9('0x2'));var jsonpatch=require(_0x13b9('0x3'));var rp=require(_0x13b9('0x4'));var moment=require(_0x13b9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x13b9('0x6'));var util=require(_0x13b9('0x7'));var path=require('path');var sox=require(_0x13b9('0x8'));var csv=require(_0x13b9('0x9'));var ejs=require(_0x13b9('0xa'));var fs=require('fs');var fs_extra=require(_0x13b9('0xb'));var _=require(_0x13b9('0xc'));var squel=require(_0x13b9('0xd'));var crypto=require(_0x13b9('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x13b9('0xf'));var Papa=require('papaparse');var Redis=require(_0x13b9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x13b9('0x11'));var as=require(_0x13b9('0x12'));var hardwareService=require(_0x13b9('0x13'));var logger=require(_0x13b9('0x14'))(_0x13b9('0x15'));var utils=require(_0x13b9('0x16'));var config=require(_0x13b9('0x17'));var licenseUtil=require(_0x13b9('0x18'));var db=require(_0x13b9('0x19'))['db'];function respondWithStatusCode(_0x1c2cd2,_0x13dcca){_0x13dcca=_0x13dcca||0xcc;return function(_0x3abbad){if(_0x3abbad){return _0x1c2cd2[_0x13b9('0x1a')](_0x13dcca);}return _0x1c2cd2[_0x13b9('0x1b')](_0x13dcca)[_0x13b9('0x1c')]();};}function respondWithResult(_0x1c0940,_0x5560dc){_0x5560dc=_0x5560dc||0xc8;return function(_0x2429cd){if(_0x2429cd){return _0x1c0940[_0x13b9('0x1b')](_0x5560dc)[_0x13b9('0x1d')](_0x2429cd);}};}function respondWithFilteredResult(_0x56a14a,_0x5189c6){return function(_0x240531){if(_0x240531){var _0x6a748f=typeof _0x5189c6[_0x13b9('0x1e')]===_0x13b9('0x1f')&&typeof _0x5189c6[_0x13b9('0x20')]===_0x13b9('0x1f');var _0x4da600=_0x240531[_0x13b9('0x21')];var _0x2f03aa=_0x6a748f?0x0:_0x5189c6['offset'];var _0x2431d6=_0x6a748f?_0x240531['count']:_0x5189c6['offset']+_0x5189c6[_0x13b9('0x20')];var _0x8729f3;if(_0x2431d6>=_0x4da600){_0x2431d6=_0x4da600;_0x8729f3=0xc8;}else{_0x8729f3=0xce;}_0x56a14a[_0x13b9('0x1b')](_0x8729f3);return _0x56a14a[_0x13b9('0x22')](_0x13b9('0x23'),_0x2f03aa+'-'+_0x2431d6+'/'+_0x4da600)[_0x13b9('0x1d')](_0x240531);}return null;};}function patchUpdates(_0x1bcdfb){return function(_0x56c88a){try{jsonpatch[_0x13b9('0x24')](_0x56c88a,_0x1bcdfb,!![]);}catch(_0x21d88d){return BPromise['reject'](_0x21d88d);}return _0x56c88a['save']();};}function saveUpdates(_0xfe088,_0x2e14c7){return function(_0x341ae0){if(_0x341ae0){return _0x341ae0[_0x13b9('0x25')](_0xfe088)[_0x13b9('0x26')](function(_0x2ea85b){return _0x2ea85b;});}return null;};}function removeEntity(_0x27d6cb,_0x3b8d88){return function(_0x1cd226){if(_0x1cd226){return _0x1cd226[_0x13b9('0x27')]()[_0x13b9('0x26')](function(){var _0x3428ae=_0x1cd226[_0x13b9('0x28')]({'plain':!![]});var _0x53e53d='Variables';return db[_0x13b9('0x29')][_0x13b9('0x27')]({'where':{'type':_0x53e53d,'resourceId':_0x3428ae['id']}})[_0x13b9('0x26')](function(){return _0x1cd226;});})[_0x13b9('0x26')](function(){_0x27d6cb[_0x13b9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x579c0c,_0x120cbb){return function(_0x4b04da){if(!_0x4b04da){_0x579c0c['sendStatus'](0x194);}return _0x4b04da;};}function handleError(_0x2752a0,_0x54fcf5){_0x54fcf5=_0x54fcf5||0x1f4;return function(_0x1b875d){logger[_0x13b9('0x2a')](_0x1b875d[_0x13b9('0x2b')]);if(_0x1b875d[_0x13b9('0x2c')]){delete _0x1b875d[_0x13b9('0x2c')];}_0x2752a0[_0x13b9('0x1b')](_0x54fcf5)[_0x13b9('0x2d')](_0x1b875d);};}exports[_0x13b9('0x2e')]=function(_0x27749c,_0x53dfd4){var _0x15f406={},_0x258e25={},_0x89395a={'count':0x0,'rows':[]};var _0x5b5533=_[_0x13b9('0x2f')](db[_0x13b9('0x30')][_0x13b9('0x31')],function(_0x19c3a2){return{'name':_0x19c3a2[_0x13b9('0x32')],'type':_0x19c3a2[_0x13b9('0x33')][_0x13b9('0x34')]};});_0x258e25[_0x13b9('0x35')]=_[_0x13b9('0x2f')](_0x5b5533,_0x13b9('0x2c'));_0x258e25['query']=_[_0x13b9('0x36')](_0x27749c[_0x13b9('0x37')]);_0x258e25['filters']=_['intersection'](_0x258e25['model'],_0x258e25['query']);_0x15f406[_0x13b9('0x38')]=_[_0x13b9('0x39')](_0x258e25[_0x13b9('0x35')],qs[_0x13b9('0x3a')](_0x27749c[_0x13b9('0x37')]['fields']));_0x15f406['attributes']=_0x15f406[_0x13b9('0x38')]['length']?_0x15f406[_0x13b9('0x38')]:_0x258e25['model'];if(!_0x27749c[_0x13b9('0x37')]['hasOwnProperty'](_0x13b9('0x3b'))){_0x15f406[_0x13b9('0x20')]=qs[_0x13b9('0x20')](_0x27749c[_0x13b9('0x37')]['limit']);_0x15f406[_0x13b9('0x1e')]=qs[_0x13b9('0x1e')](_0x27749c['query'][_0x13b9('0x1e')]);}_0x15f406[_0x13b9('0x3c')]=qs[_0x13b9('0x3d')](_0x27749c[_0x13b9('0x37')][_0x13b9('0x3d')]);_0x15f406[_0x13b9('0x3e')]=qs[_0x13b9('0x3f')](_[_0x13b9('0x40')](_0x27749c[_0x13b9('0x37')],_0x258e25[_0x13b9('0x3f')]),_0x5b5533);if(_0x27749c[_0x13b9('0x37')][_0x13b9('0x41')]){_0x15f406[_0x13b9('0x3e')]=_[_0x13b9('0x42')](_0x15f406[_0x13b9('0x3e')],{'$or':_[_0x13b9('0x2f')](_0x5b5533,function(_0x53245e){if(_0x53245e[_0x13b9('0x33')]!==_0x13b9('0x43')){var _0x210f7c={};_0x210f7c[_0x53245e[_0x13b9('0x2c')]]={'$like':'%'+_0x27749c[_0x13b9('0x37')][_0x13b9('0x41')]+'%'};return _0x210f7c;}})});}_0x15f406=_[_0x13b9('0x42')]({},_0x15f406,_0x27749c[_0x13b9('0x44')]);var _0x297797={'where':_0x15f406[_0x13b9('0x3e')]};return db[_0x13b9('0x30')][_0x13b9('0x21')](_0x297797)['then'](function(_0x353f00){_0x89395a[_0x13b9('0x21')]=_0x353f00;if(_0x27749c[_0x13b9('0x37')][_0x13b9('0x45')]){_0x15f406['include']=[{'all':!![]}];}return db['Variable'][_0x13b9('0x46')](_0x15f406);})['then'](function(_0x86954c){_0x89395a[_0x13b9('0x47')]=_0x86954c;return _0x89395a;})[_0x13b9('0x26')](respondWithFilteredResult(_0x53dfd4,_0x15f406))[_0x13b9('0x48')](handleError(_0x53dfd4,null));};exports['show']=function(_0x42c1db,_0x39e039){var _0x4f42f2={'raw':!![],'where':{'id':_0x42c1db[_0x13b9('0x49')]['id']}},_0x450b86={};_0x450b86[_0x13b9('0x35')]=_[_0x13b9('0x36')](db[_0x13b9('0x30')][_0x13b9('0x31')]);_0x450b86['query']=_[_0x13b9('0x36')](_0x42c1db[_0x13b9('0x37')]);_0x450b86[_0x13b9('0x3f')]=_['intersection'](_0x450b86[_0x13b9('0x35')],_0x450b86[_0x13b9('0x37')]);_0x4f42f2[_0x13b9('0x38')]=_[_0x13b9('0x39')](_0x450b86[_0x13b9('0x35')],qs[_0x13b9('0x3a')](_0x42c1db[_0x13b9('0x37')][_0x13b9('0x3a')]));_0x4f42f2[_0x13b9('0x38')]=_0x4f42f2[_0x13b9('0x38')][_0x13b9('0x4a')]?_0x4f42f2[_0x13b9('0x38')]:_0x450b86['model'];if(_0x42c1db[_0x13b9('0x37')][_0x13b9('0x45')]){_0x4f42f2[_0x13b9('0x4b')]=[{'all':!![]}];}_0x4f42f2=_[_0x13b9('0x42')]({},_0x4f42f2,_0x42c1db[_0x13b9('0x44')]);return db['Variable'][_0x13b9('0x4c')](_0x4f42f2)[_0x13b9('0x26')](handleEntityNotFound(_0x39e039,null))[_0x13b9('0x26')](respondWithResult(_0x39e039,null))[_0x13b9('0x48')](handleError(_0x39e039,null));};exports[_0x13b9('0x4d')]=function(_0x3d8ed3,_0x169d6d){return db[_0x13b9('0x30')][_0x13b9('0x4d')](_0x3d8ed3['body'],{})[_0x13b9('0x26')](function(_0x59e87a){var _0x56d053=_0x3d8ed3[_0x13b9('0x4e')][_0x13b9('0x28')]({'plain':!![]});if(!_0x56d053)throw new Error(_0x13b9('0x4f'));if(_0x56d053[_0x13b9('0x50')]===_0x13b9('0x4e')){var _0x52103a=_0x59e87a['get']({'plain':!![]});var _0x43ee8a=_0x13b9('0x51');return db['UserProfileSection'][_0x13b9('0x4c')]({'where':{'name':_0x43ee8a,'userProfileId':_0x56d053[_0x13b9('0x52')]},'raw':!![]})['then'](function(_0x3005c6){if(_0x3005c6&&_0x3005c6[_0x13b9('0x53')]===0x0){return db[_0x13b9('0x29')]['create']({'name':_0x52103a[_0x13b9('0x2c')],'resourceId':_0x52103a['id'],'type':_0x3005c6[_0x13b9('0x2c')],'sectionId':_0x3005c6['id']},{})['then'](function(){return _0x59e87a;});}else{return _0x59e87a;}})[_0x13b9('0x48')](function(_0x4449e4){logger[_0x13b9('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4449e4);throw _0x4449e4;});}return _0x59e87a;})['then'](respondWithResult(_0x169d6d,0xc9))['catch'](handleError(_0x169d6d,null));};exports[_0x13b9('0x25')]=function(_0xacdfa5,_0x1a8775){if(_0xacdfa5[_0x13b9('0x54')]['id']){delete _0xacdfa5[_0x13b9('0x54')]['id'];}return db[_0x13b9('0x30')][_0x13b9('0x4c')]({'where':{'id':_0xacdfa5['params']['id']}})[_0x13b9('0x26')](handleEntityNotFound(_0x1a8775,null))['then'](saveUpdates(_0xacdfa5[_0x13b9('0x54')],null))[_0x13b9('0x26')](respondWithResult(_0x1a8775,null))[_0x13b9('0x48')](handleError(_0x1a8775,null));};exports['destroy']=function(_0x1f5212,_0x2035a9){return db['Variable'][_0x13b9('0x4c')]({'where':{'id':_0x1f5212[_0x13b9('0x49')]['id']}})[_0x13b9('0x26')](handleEntityNotFound(_0x2035a9,null))[_0x13b9('0x26')](removeEntity(_0x2035a9,null))[_0x13b9('0x48')](handleError(_0x2035a9,null));}; \ No newline at end of file +var _0x1990=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','save','update','then','get','Variables','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error'];(function(_0x577024,_0x458164){var _0x2dd7ea=function(_0x528fb3){while(--_0x528fb3){_0x577024['push'](_0x577024['shift']());}};_0x2dd7ea(++_0x458164);}(_0x1990,0x13d));var _0x0199=function(_0xf98e3e,_0x5aa606){_0xf98e3e=_0xf98e3e-0x0;var _0x529ef8=_0x1990[_0xf98e3e];return _0x529ef8;};'use strict';var emlformat=require(_0x0199('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0199('0x1'));var rp=require(_0x0199('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0199('0x3'));var util=require('util');var path=require(_0x0199('0x4'));var sox=require(_0x0199('0x5'));var csv=require(_0x0199('0x6'));var ejs=require(_0x0199('0x7'));var fs=require('fs');var fs_extra=require(_0x0199('0x8'));var _=require(_0x0199('0x9'));var squel=require(_0x0199('0xa'));var crypto=require('crypto');var jsforce=require(_0x0199('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0199('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0199('0xc'));var as=require(_0x0199('0xd'));var hardwareService=require(_0x0199('0xe'));var logger=require(_0x0199('0xf'))(_0x0199('0x10'));var utils=require('../../config/utils');var config=require(_0x0199('0x11'));var licenseUtil=require(_0x0199('0x12'));var db=require(_0x0199('0x13'))['db'];function respondWithStatusCode(_0x1ba9d0,_0x21f75e){_0x21f75e=_0x21f75e||0xcc;return function(_0x5e8aee){if(_0x5e8aee){return _0x1ba9d0['sendStatus'](_0x21f75e);}return _0x1ba9d0[_0x0199('0x14')](_0x21f75e)[_0x0199('0x15')]();};}function respondWithResult(_0x59e186,_0x2d719d){_0x2d719d=_0x2d719d||0xc8;return function(_0x134cb3){if(_0x134cb3){return _0x59e186[_0x0199('0x14')](_0x2d719d)[_0x0199('0x16')](_0x134cb3);}};}function respondWithFilteredResult(_0x2fe75b,_0x316aed){return function(_0x290a46){if(_0x290a46){var _0x14515a=typeof _0x316aed['offset']===_0x0199('0x17')&&typeof _0x316aed['limit']===_0x0199('0x17');var _0x110fb5=_0x290a46[_0x0199('0x18')];var _0x5f2b9f=_0x14515a?0x0:_0x316aed[_0x0199('0x19')];var _0x1c5f62=_0x14515a?_0x290a46[_0x0199('0x18')]:_0x316aed[_0x0199('0x19')]+_0x316aed[_0x0199('0x1a')];var _0x1ef73b;if(_0x1c5f62>=_0x110fb5){_0x1c5f62=_0x110fb5;_0x1ef73b=0xc8;}else{_0x1ef73b=0xce;}_0x2fe75b[_0x0199('0x14')](_0x1ef73b);return _0x2fe75b[_0x0199('0x1b')]('Content-Range',_0x5f2b9f+'-'+_0x1c5f62+'/'+_0x110fb5)[_0x0199('0x16')](_0x290a46);}return null;};}function patchUpdates(_0x1d295a){return function(_0x39b3b4){try{jsonpatch['apply'](_0x39b3b4,_0x1d295a,!![]);}catch(_0x22a223){return BPromise['reject'](_0x22a223);}return _0x39b3b4[_0x0199('0x1c')]();};}function saveUpdates(_0x1f4b02,_0x1c4692){return function(_0x1d594a){if(_0x1d594a){return _0x1d594a[_0x0199('0x1d')](_0x1f4b02)['then'](function(_0x20e495){return _0x20e495;});}return null;};}function removeEntity(_0x98f391,_0x10f2ed){return function(_0x215f1b){if(_0x215f1b){return _0x215f1b['destroy']()[_0x0199('0x1e')](function(){var _0x4bba89=_0x215f1b[_0x0199('0x1f')]({'plain':!![]});var _0x62b43=_0x0199('0x20');return db[_0x0199('0x21')][_0x0199('0x22')]({'where':{'type':_0x62b43,'resourceId':_0x4bba89['id']}})[_0x0199('0x1e')](function(){return _0x215f1b;});})['then'](function(){_0x98f391['status'](0xcc)[_0x0199('0x15')]();});}};}function handleEntityNotFound(_0x39f107,_0x444aec){return function(_0x1b5b29){if(!_0x1b5b29){_0x39f107[_0x0199('0x23')](0x194);}return _0x1b5b29;};}function handleError(_0x4a322d,_0x37f2b3){_0x37f2b3=_0x37f2b3||0x1f4;return function(_0xc74186){logger['error'](_0xc74186[_0x0199('0x24')]);if(_0xc74186['name']){delete _0xc74186[_0x0199('0x25')];}_0x4a322d[_0x0199('0x14')](_0x37f2b3)[_0x0199('0x26')](_0xc74186);};}exports[_0x0199('0x27')]=function(_0x4ea0ae,_0x4bc83a){var _0x3fc021={},_0x5be193={},_0x43f0fa={'count':0x0,'rows':[]};var _0x32f837=_[_0x0199('0x28')](db[_0x0199('0x29')][_0x0199('0x2a')],function(_0x4fadc6){return{'name':_0x4fadc6[_0x0199('0x2b')],'type':_0x4fadc6[_0x0199('0x2c')][_0x0199('0x2d')]};});_0x5be193[_0x0199('0x2e')]=_[_0x0199('0x28')](_0x32f837,_0x0199('0x25'));_0x5be193[_0x0199('0x2f')]=_[_0x0199('0x30')](_0x4ea0ae['query']);_0x5be193[_0x0199('0x31')]=_[_0x0199('0x32')](_0x5be193[_0x0199('0x2e')],_0x5be193['query']);_0x3fc021[_0x0199('0x33')]=_[_0x0199('0x32')](_0x5be193[_0x0199('0x2e')],qs[_0x0199('0x34')](_0x4ea0ae[_0x0199('0x2f')][_0x0199('0x34')]));_0x3fc021[_0x0199('0x33')]=_0x3fc021['attributes'][_0x0199('0x35')]?_0x3fc021[_0x0199('0x33')]:_0x5be193[_0x0199('0x2e')];if(!_0x4ea0ae[_0x0199('0x2f')][_0x0199('0x36')](_0x0199('0x37'))){_0x3fc021[_0x0199('0x1a')]=qs[_0x0199('0x1a')](_0x4ea0ae[_0x0199('0x2f')][_0x0199('0x1a')]);_0x3fc021[_0x0199('0x19')]=qs[_0x0199('0x19')](_0x4ea0ae[_0x0199('0x2f')][_0x0199('0x19')]);}_0x3fc021['order']=qs['sort'](_0x4ea0ae[_0x0199('0x2f')][_0x0199('0x38')]);_0x3fc021[_0x0199('0x39')]=qs['filters'](_[_0x0199('0x3a')](_0x4ea0ae[_0x0199('0x2f')],_0x5be193[_0x0199('0x31')]),_0x32f837);if(_0x4ea0ae[_0x0199('0x2f')][_0x0199('0x3b')]){_0x3fc021[_0x0199('0x39')]=_[_0x0199('0x3c')](_0x3fc021[_0x0199('0x39')],{'$or':_[_0x0199('0x28')](_0x32f837,function(_0x541641){if(_0x541641[_0x0199('0x2c')]!=='VIRTUAL'){var _0x52029e={};_0x52029e[_0x541641[_0x0199('0x25')]]={'$like':'%'+_0x4ea0ae['query'][_0x0199('0x3b')]+'%'};return _0x52029e;}})});}_0x3fc021=_[_0x0199('0x3c')]({},_0x3fc021,_0x4ea0ae[_0x0199('0x3d')]);var _0x45490e={'where':_0x3fc021[_0x0199('0x39')]};return db[_0x0199('0x29')][_0x0199('0x18')](_0x45490e)[_0x0199('0x1e')](function(_0x114fb6){_0x43f0fa['count']=_0x114fb6;if(_0x4ea0ae[_0x0199('0x2f')][_0x0199('0x3e')]){_0x3fc021[_0x0199('0x3f')]=[{'all':!![]}];}return db[_0x0199('0x29')][_0x0199('0x40')](_0x3fc021);})['then'](function(_0x10448a){_0x43f0fa[_0x0199('0x41')]=_0x10448a;return _0x43f0fa;})[_0x0199('0x1e')](respondWithFilteredResult(_0x4bc83a,_0x3fc021))[_0x0199('0x42')](handleError(_0x4bc83a,null));};exports[_0x0199('0x43')]=function(_0x5cb449,_0x3ae2bb){var _0x5a63b4={'raw':!![],'where':{'id':_0x5cb449[_0x0199('0x44')]['id']}},_0x2d4cdb={};_0x2d4cdb[_0x0199('0x2e')]=_[_0x0199('0x30')](db[_0x0199('0x29')][_0x0199('0x2a')]);_0x2d4cdb[_0x0199('0x2f')]=_[_0x0199('0x30')](_0x5cb449[_0x0199('0x2f')]);_0x2d4cdb[_0x0199('0x31')]=_[_0x0199('0x32')](_0x2d4cdb[_0x0199('0x2e')],_0x2d4cdb['query']);_0x5a63b4[_0x0199('0x33')]=_[_0x0199('0x32')](_0x2d4cdb[_0x0199('0x2e')],qs['fields'](_0x5cb449[_0x0199('0x2f')][_0x0199('0x34')]));_0x5a63b4[_0x0199('0x33')]=_0x5a63b4[_0x0199('0x33')]['length']?_0x5a63b4['attributes']:_0x2d4cdb[_0x0199('0x2e')];if(_0x5cb449['query'][_0x0199('0x3e')]){_0x5a63b4[_0x0199('0x3f')]=[{'all':!![]}];}_0x5a63b4=_[_0x0199('0x3c')]({},_0x5a63b4,_0x5cb449['options']);return db['Variable'][_0x0199('0x45')](_0x5a63b4)[_0x0199('0x1e')](handleEntityNotFound(_0x3ae2bb,null))[_0x0199('0x1e')](respondWithResult(_0x3ae2bb,null))[_0x0199('0x42')](handleError(_0x3ae2bb,null));};exports[_0x0199('0x46')]=function(_0x4070c1,_0x5f40d9){return db['Variable'][_0x0199('0x46')](_0x4070c1[_0x0199('0x47')],{})[_0x0199('0x1e')](function(_0x3f1bb2){var _0x9a9676=_0x4070c1[_0x0199('0x48')][_0x0199('0x1f')]({'plain':!![]});if(!_0x9a9676)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x9a9676[_0x0199('0x49')]===_0x0199('0x48')){var _0x158d3b=_0x3f1bb2['get']({'plain':!![]});var _0x591c91='Variables';return db[_0x0199('0x4a')][_0x0199('0x45')]({'where':{'name':_0x591c91,'userProfileId':_0x9a9676[_0x0199('0x4b')]},'raw':!![]})[_0x0199('0x1e')](function(_0x385ae8){if(_0x385ae8&&_0x385ae8[_0x0199('0x4c')]===0x0){return db['UserProfileResource'][_0x0199('0x46')]({'name':_0x158d3b[_0x0199('0x25')],'resourceId':_0x158d3b['id'],'type':_0x385ae8[_0x0199('0x25')],'sectionId':_0x385ae8['id']},{})[_0x0199('0x1e')](function(){return _0x3f1bb2;});}else{return _0x3f1bb2;}})[_0x0199('0x42')](function(_0x1ec618){logger[_0x0199('0x4d')](_0x0199('0x4e'),_0x1ec618);throw _0x1ec618;});}return _0x3f1bb2;})[_0x0199('0x1e')](respondWithResult(_0x5f40d9,0xc9))[_0x0199('0x42')](handleError(_0x5f40d9,null));};exports['update']=function(_0x53900f,_0x109295){if(_0x53900f[_0x0199('0x47')]['id']){delete _0x53900f[_0x0199('0x47')]['id'];}return db[_0x0199('0x29')][_0x0199('0x45')]({'where':{'id':_0x53900f[_0x0199('0x44')]['id']}})[_0x0199('0x1e')](handleEntityNotFound(_0x109295,null))[_0x0199('0x1e')](saveUpdates(_0x53900f[_0x0199('0x47')],null))['then'](respondWithResult(_0x109295,null))[_0x0199('0x42')](handleError(_0x109295,null));};exports['destroy']=function(_0x34665a,_0x511840){return db['Variable'][_0x0199('0x45')]({'where':{'id':_0x34665a[_0x0199('0x44')]['id']}})[_0x0199('0x1e')](handleEntityNotFound(_0x511840,null))[_0x0199('0x1e')](removeEntity(_0x511840,null))[_0x0199('0x42')](handleError(_0x511840,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index da84a8f..5a29b6c 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 _0x1062=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./variable.attributes','define','Variable','tools_variables','lodash'];(function(_0x50a7ca,_0x3233f4){var _0x19a555=function(_0x30b430){while(--_0x30b430){_0x50a7ca['push'](_0x50a7ca['shift']());}};_0x19a555(++_0x3233f4);}(_0x1062,0x185));var _0x2106=function(_0x50bf3e,_0x251ff8){_0x50bf3e=_0x50bf3e-0x0;var _0x38c56a=_0x1062[_0x50bf3e];return _0x38c56a;};'use strict';var _=require(_0x2106('0x0'));var util=require(_0x2106('0x1'));var logger=require(_0x2106('0x2'))(_0x2106('0x3'));var moment=require(_0x2106('0x4'));var BPromise=require('bluebird');var rp=require(_0x2106('0x5'));var fs=require('fs');var path=require(_0x2106('0x6'));var rimraf=require(_0x2106('0x7'));var config=require(_0x2106('0x8'));var attributes=require(_0x2106('0x9'));module['exports']=function(_0x2fd481,_0x152fb9){return _0x2fd481[_0x2106('0xa')](_0x2106('0xb'),attributes,{'tableName':_0x2106('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x877a=['rimraf','../../config/environment','Variable','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x672f5a,_0x309026){var _0x5744a6=function(_0x33279c){while(--_0x33279c){_0x672f5a['push'](_0x672f5a['shift']());}};_0x5744a6(++_0x309026);}(_0x877a,0xad));var _0xa877=function(_0x1cce58,_0x2d0daf){_0x1cce58=_0x1cce58-0x0;var _0x4b4b33=_0x877a[_0x1cce58];return _0x4b4b33;};'use strict';var _=require(_0xa877('0x0'));var util=require(_0xa877('0x1'));var logger=require(_0xa877('0x2'))(_0xa877('0x3'));var moment=require(_0xa877('0x4'));var BPromise=require('bluebird');var rp=require(_0xa877('0x5'));var fs=require('fs');var path=require(_0xa877('0x6'));var rimraf=require(_0xa877('0x7'));var config=require(_0xa877('0x8'));var attributes=require('./variable.attributes');module['exports']=function(_0x5b417d,_0x1b8902){return _0x5b417d['define'](_0xa877('0x9'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index fc7302b..dec3111 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(_0x242566,_0x4ec88d){var _0x1bc410=function(_0x2996fa){while(--_0x2996fa){_0x242566['push'](_0x242566['shift']());}};_0x1bc410(++_0x4ec88d);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1a950c,_0x2d1624){_0x1a950c=_0x1a950c-0x0;var _0x228503=_0x8ef6[_0x1a950c];return _0x228503;};'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 _0xa41a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xa41a,0x6b));var _0xaa41=function(_0x25590f,_0x459d9d){_0x25590f=_0x25590f-0x0;var _0x4ba2a7=_0xa41a[_0x25590f];return _0x4ba2a7;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['Variable']['find']({'raw':_0xd20ddf[_0xaa41('0x18')]?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x19')]===undefined?!![]:![]:!![],'where':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1a')]||null:null,'attributes':_0xd20ddf['options']?_0xd20ddf['options'][_0xaa41('0x1b')]||null:null,'include':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')],function(_0x4eb01f){return{'model':db[_0x4eb01f[_0xaa41('0x1e')]],'as':_0x4eb01f['as'],'attributes':_0x4eb01f[_0xaa41('0x1b')],'include':_0x4eb01f[_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0x4eb01f[_0xaa41('0x1c')],function(_0xa1f024){return{'model':db[_0xa1f024['model']],'as':_0xa1f024['as'],'attributes':_0xa1f024['attributes'],'include':_0xa1f024[_0xaa41('0x1c')]?_['map'](_0xa1f024['include'],function(_0x12e362){return{'model':db[_0x12e362['model']],'as':_0x12e362['as'],'attributes':_0x12e362['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa41('0xd')](function(_0x9c8c21){logger[_0xaa41('0xe')](_0xaa41('0x17'),_0xd20ddf);logger[_0xaa41('0x11')](_0xaa41('0x17'),_0xd20ddf,JSON['stringify'](_0x9c8c21));_0x46e6d3(_0x9c8c21);})[_0xaa41('0x16')](function(_0x1f0275){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x1f0275[_0xaa41('0x14')],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x1f0275[_0xaa41('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 0c5d4dd..0af933d 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 _0xca74=['canUpdate','fetch','/reset','reset','/pull','/restart','restart','/migrations','migrations','express','get','isAuthenticated'];(function(_0x5fae11,_0x812d2a){var _0x22695b=function(_0xae0edd){while(--_0xae0edd){_0x5fae11['push'](_0x5fae11['shift']());}};_0x22695b(++_0x812d2a);}(_0xca74,0xc9));var _0x4ca7=function(_0x512550,_0x6a8b6f){_0x512550=_0x512550-0x0;var _0x19f661=_0xca74[_0x512550];return _0x19f661;};'use strict';var express=require(_0x4ca7('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0x4ca7('0x1')]('/',controller['index']);router['get']('/fetch',auth[_0x4ca7('0x2')](),auth[_0x4ca7('0x3')](),controller[_0x4ca7('0x4')]);router[_0x4ca7('0x1')](_0x4ca7('0x5'),auth[_0x4ca7('0x2')](),auth['canUpdate'](),controller[_0x4ca7('0x6')]);router['get'](_0x4ca7('0x7'),auth[_0x4ca7('0x2')](),auth[_0x4ca7('0x3')](),controller['pull']);router[_0x4ca7('0x1')](_0x4ca7('0x8'),auth[_0x4ca7('0x2')](),controller[_0x4ca7('0x9')]);router[_0x4ca7('0x1')](_0x4ca7('0xa'),controller[_0x4ca7('0xb')]);module['exports']=router; \ No newline at end of file +var _0x3824=['/reset','reset','pull','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate'];(function(_0x28d1cd,_0x192371){var _0xdcb892=function(_0x145f6e){while(--_0x145f6e){_0x28d1cd['push'](_0x28d1cd['shift']());}};_0xdcb892(++_0x192371);}(_0x3824,0x1d7));var _0x4382=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0x3824[_0x3be7ff];return _0x186721;};'use strict';var express=require(_0x4382('0x0'));var router=express[_0x4382('0x1')]();var auth=require(_0x4382('0x2'));var controller=require(_0x4382('0x3'));router[_0x4382('0x4')]('/',controller[_0x4382('0x5')]);router[_0x4382('0x4')](_0x4382('0x6'),auth[_0x4382('0x7')](),auth[_0x4382('0x8')](),controller['fetch']);router[_0x4382('0x4')](_0x4382('0x9'),auth[_0x4382('0x7')](),auth[_0x4382('0x8')](),controller[_0x4382('0xa')]);router[_0x4382('0x4')]('/pull',auth[_0x4382('0x7')](),auth[_0x4382('0x8')](),controller[_0x4382('0xb')]);router[_0x4382('0x4')]('/restart',auth['isAuthenticated'](),controller[_0x4382('0xc')]);router[_0x4382('0x4')](_0x4382('0xd'),controller[_0x4382('0xe')]);module[_0x4382('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 6d01cd2..216c970 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 _0x29d5=['git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','status','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','join','server','migrations','length','replace','.js','push','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','tags','2.0.0','json','fetch','origin','master','error','info'];(function(_0x3572b3,_0x593ffe){var _0x55e4aa=function(_0x5a6b53){while(--_0x5a6b53){_0x3572b3['push'](_0x3572b3['shift']());}};_0x55e4aa(++_0x593ffe);}(_0x29d5,0x12b));var _0x529d=function(_0x369752,_0x338a1b){_0x369752=_0x369752-0x0;var _0xb6e516=_0x29d5[_0x369752];return _0xb6e516;};'use strict';var Umzug=require('umzug');var path=require(_0x529d('0x0'));var fs=require('fs');var _=require(_0x529d('0x1'));var pkginfo=require(_0x529d('0x2'))(module,_0x529d('0x3'));var compareVersions=require(_0x529d('0x4'));var exec=require(_0x529d('0x5'))['exec'];var db=require(_0x529d('0x6'))['db'];var config=require(_0x529d('0x7'));var pm2=require(_0x529d('0x8'));var logger=require(_0x529d('0x9'))(_0x529d('0xa'));var git=require(_0x529d('0xb'))(config[_0x529d('0xc')]);exports[_0x529d('0xd')]=function(_0x4b7121,_0x270c59){var _0x5ee3f7={'current':module[_0x529d('0xe')][_0x529d('0x3')],'phonebar':0x2};if(_0x4b7121[_0x529d('0xf')]&&_0x4b7121[_0x529d('0xf')][_0x529d('0x10')]){return git['fetch']()[_0x529d('0x11')](function(_0x1b2975,_0xc0c1b0){_0x5ee3f7[_0x529d('0x10')]=(_0x1b2975?module[_0x529d('0xe')]['version']:_0xc0c1b0[_0x529d('0x10')])||_0x529d('0x12');return _0x270c59['status'](0xc8)[_0x529d('0x13')](_0x5ee3f7);});}else{return _0x270c59['status'](0xc8)[_0x529d('0x13')](_0x5ee3f7);}};exports[_0x529d('0x14')]=function(_0x5eb2a2,_0x157824){return git[_0x529d('0x14')]([_0x529d('0x15'),_0x529d('0x16')],function(_0x109a00){if(_0x109a00){logger[_0x529d('0x17')](_0x109a00);return _0x157824['status'](0x1f4)[_0x529d('0x13')](_0x109a00);}logger[_0x529d('0x18')](_0x529d('0x19'));return _0x157824['status'](0xc8)[_0x529d('0x13')]({'output':_0x529d('0x1a')});});};exports[_0x529d('0x1b')]=function(_0xb315a9,_0xc83fa8){return git[_0x529d('0x1b')]([_0x529d('0x1c'),_0x529d('0x1d')],function(_0x3725a1){if(_0x3725a1){logger[_0x529d('0x17')](_0x3725a1);return _0xc83fa8[_0x529d('0x1e')](0x1f4)[_0x529d('0x13')](_0x3725a1);}logger[_0x529d('0x18')](_0x529d('0x1f'));return _0xc83fa8[_0x529d('0x1e')](0xc8)['json']({'output':_0x529d('0x20')});});};exports[_0x529d('0x21')]=function(_0x103aea,_0x55e0b4){exec(_0x529d('0x22'),function(_0x4eee7b,_0x22d9ad,_0xfa5cdf){logger[_0x529d('0x18')](_0x22d9ad);logger[_0x529d('0x18')](_0xfa5cdf);if(_0x4eee7b){logger['error'](_0x4eee7b);return _0x55e0b4[_0x529d('0x1e')](0x1f4)['json'](_0x4eee7b);}return _0x55e0b4[_0x529d('0x1e')](0xc8)[_0x529d('0x13')]({'output':_0x22d9ad});});};exports[_0x529d('0x23')]=function(_0x3946d6,_0x7112fb){return pm2[_0x529d('0x23')](_0x529d('0x24'))[_0x529d('0x25')](function(_0x21ab56){logger[_0x529d('0x18')](_0x529d('0x26'),_0x21ab56);return _0x7112fb[_0x529d('0x1e')](0xc8)[_0x529d('0x13')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})['catch'](function(_0x490146){logger[_0x529d('0x17')](_0x490146);return _0x7112fb[_0x529d('0x1e')](0x1f4)[_0x529d('0x13')](_0x490146);});};exports['migrations']=function(_0x54515a,_0x46b6ad){var _0xc3b5b2=fs['readdirSync'](path[_0x529d('0x27')](config[_0x529d('0xc')],_0x529d('0x28'),_0x529d('0x29')));var _0x1cbbe9=[];for(var _0x567816=0x0;_0x567816<_0xc3b5b2[_0x529d('0x2a')];_0x567816++){var _0x27015a=_0xc3b5b2[_0x567816][_0x529d('0x2b')](_0x529d('0x2c'),'');if(compareVersions(module[_0x529d('0xe')][_0x529d('0x3')],_0x27015a)===-0x1){_0x1cbbe9[_0x529d('0x2d')](_0x27015a);}}if(_0x1cbbe9[_0x529d('0x2a')]){var _0x2e026a=_0x1cbbe9['sort'](compareVersions);var _0x897209=new Umzug({'storage':_0x529d('0x2e'),'storageOptions':{'model':db[_0x529d('0x2f')],'modelName':_0x529d('0x2f'),'columnName':'version'},'migrations':{'params':[db[_0x529d('0x2e')]['getQueryInterface'](),db[_0x529d('0x2e')][_0x529d('0x30')],function(){throw new Error(_0x529d('0x31'));}],'path':path['join'](config[_0x529d('0xc')],_0x529d('0x28'),'migrations'),'pattern':/\.js$/}});_0x897209['up']({'migrations':_[_0x529d('0x32')](_0x2e026a,function(_0x1d5288){return _0x1d5288+_0x529d('0x2c');})})[_0x529d('0x25')](function(){return _0x46b6ad[_0x529d('0x1e')](0xc8)[_0x529d('0x13')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x529d('0xe')][_0x529d('0x3')]+_0x529d('0x33')+_['last'](_0x2e026a),'migrations':_[_0x529d('0x27')](_0x2e026a)});})['catch'](function(_0x34611d){if(_0x34611d instanceof db['sequelize'][_0x529d('0x34')]){return _0x46b6ad[_0x529d('0x1e')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x46b6ad[_0x529d('0x1e')](0x1f4)[_0x529d('0x13')](_0x34611d);}});}else{return _0x46b6ad[_0x529d('0x1e')](0xc8)['json']({'output':_0x529d('0x35')});}}; \ No newline at end of file +var _0x1252=['info','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','length','replace','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','UniqueConstraintError','Database\x20already\x20up-to-date','path','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/logger','update','index','exports','query','latest','fetch','tags','2.0.0','status','origin','master','json','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error'];(function(_0x2b012b,_0x463e28){var _0x32c4cf=function(_0x5871f2){while(--_0x5871f2){_0x2b012b['push'](_0x2b012b['shift']());}};_0x32c4cf(++_0x463e28);}(_0x1252,0xe5));var _0x2125=function(_0x225b6d,_0x47d607){_0x225b6d=_0x225b6d-0x0;var _0x3eea3f=_0x1252[_0x225b6d];return _0x3eea3f;};'use strict';var Umzug=require('umzug');var path=require(_0x2125('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x2125('0x1'))(module,_0x2125('0x2'));var compareVersions=require(_0x2125('0x3'));var exec=require('child_process')[_0x2125('0x4')];var db=require(_0x2125('0x5'))['db'];var config=require(_0x2125('0x6'));var pm2=require('../../config/pm2');var logger=require(_0x2125('0x7'))(_0x2125('0x8'));var git=require('simple-git')(config['root']);exports[_0x2125('0x9')]=function(_0x5397e6,_0x41bedf){var _0x5e4b78={'current':module[_0x2125('0xa')][_0x2125('0x2')],'phonebar':0x2};if(_0x5397e6['query']&&_0x5397e6[_0x2125('0xb')][_0x2125('0xc')]){return git[_0x2125('0xd')]()[_0x2125('0xe')](function(_0x3d8443,_0x3c92b7){_0x5e4b78[_0x2125('0xc')]=(_0x3d8443?module[_0x2125('0xa')][_0x2125('0x2')]:_0x3c92b7[_0x2125('0xc')])||_0x2125('0xf');return _0x41bedf[_0x2125('0x10')](0xc8)['json'](_0x5e4b78);});}else{return _0x41bedf[_0x2125('0x10')](0xc8)['json'](_0x5e4b78);}};exports[_0x2125('0xd')]=function(_0x1f1b11,_0x23d1f7){return git['fetch']([_0x2125('0x11'),_0x2125('0x12')],function(_0x44d794){if(_0x44d794){logger['error'](_0x44d794);return _0x23d1f7[_0x2125('0x10')](0x1f4)[_0x2125('0x13')](_0x44d794);}logger['info'](_0x2125('0x14'));return _0x23d1f7[_0x2125('0x10')](0xc8)[_0x2125('0x13')]({'output':_0x2125('0x15')});});};exports[_0x2125('0x16')]=function(_0x37fe61,_0x7719ba){return git[_0x2125('0x16')]([_0x2125('0x17'),_0x2125('0x18')],function(_0x39e375){if(_0x39e375){logger[_0x2125('0x19')](_0x39e375);return _0x7719ba[_0x2125('0x10')](0x1f4)[_0x2125('0x13')](_0x39e375);}logger[_0x2125('0x1a')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x7719ba[_0x2125('0x10')](0xc8)[_0x2125('0x13')]({'output':_0x2125('0x1b')});});};exports[_0x2125('0x1c')]=function(_0x12a9e5,_0x4af81d){exec(_0x2125('0x1d'),function(_0x5af698,_0x121910,_0x3b997f){logger['info'](_0x121910);logger['info'](_0x3b997f);if(_0x5af698){logger[_0x2125('0x19')](_0x5af698);return _0x4af81d[_0x2125('0x10')](0x1f4)[_0x2125('0x13')](_0x5af698);}return _0x4af81d[_0x2125('0x10')](0xc8)[_0x2125('0x13')]({'output':_0x121910});});};exports[_0x2125('0x1e')]=function(_0x111dac,_0x4ceaf2){return pm2[_0x2125('0x1e')](_0x2125('0x1f'))[_0x2125('0x20')](function(_0x107f22){logger['info'](_0x2125('0x21'),_0x107f22);return _0x4ceaf2[_0x2125('0x10')](0xc8)[_0x2125('0x13')]({'output':_0x2125('0x22')});})[_0x2125('0x23')](function(_0x26db1c){logger['error'](_0x26db1c);return _0x4ceaf2[_0x2125('0x10')](0x1f4)[_0x2125('0x13')](_0x26db1c);});};exports[_0x2125('0x24')]=function(_0x55ee9b,_0x2d3eea){var _0x612be9=fs[_0x2125('0x25')](path[_0x2125('0x26')](config[_0x2125('0x27')],_0x2125('0x28'),'migrations'));var _0x4e6a93=[];for(var _0x252de2=0x0;_0x252de2<_0x612be9[_0x2125('0x29')];_0x252de2++){var _0x49a180=_0x612be9[_0x252de2][_0x2125('0x2a')]('.js','');if(compareVersions(module[_0x2125('0xa')][_0x2125('0x2')],_0x49a180)===-0x1){_0x4e6a93['push'](_0x49a180);}}if(_0x4e6a93['length']){var _0x52d8a1=_0x4e6a93[_0x2125('0x2b')](compareVersions);var _0x362044=new Umzug({'storage':_0x2125('0x2c'),'storageOptions':{'model':db[_0x2125('0x2d')],'modelName':_0x2125('0x2d'),'columnName':_0x2125('0x2')},'migrations':{'params':[db[_0x2125('0x2c')][_0x2125('0x2e')](),db[_0x2125('0x2c')]['constructor'],function(){throw new Error(_0x2125('0x2f'));}],'path':path['join'](config['root'],'server','migrations'),'pattern':/\.js$/}});_0x362044['up']({'migrations':_['map'](_0x52d8a1,function(_0x354517){return _0x354517+'.js';})})[_0x2125('0x20')](function(){return _0x2d3eea[_0x2125('0x10')](0xc8)[_0x2125('0x13')]({'output':_0x2125('0x30')+module[_0x2125('0xa')][_0x2125('0x2')]+'\x20to\x20'+_['last'](_0x52d8a1),'migrations':_[_0x2125('0x26')](_0x52d8a1)});})[_0x2125('0x23')](function(_0x497e07){if(_0x497e07 instanceof db['sequelize'][_0x2125('0x31')]){return _0x2d3eea['status'](0xc8)[_0x2125('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x2d3eea[_0x2125('0x10')](0x1f4)['json'](_0x497e07);}});}else{return _0x2d3eea[_0x2125('0x10')](0xc8)['json']({'output':_0x2125('0x32')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 89557e5..ac8f875 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 _0x486d=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','create','put','update','/:id','destroy','multer'];(function(_0x4da758,_0x5393c4){var _0x4f8dd6=function(_0x22aa7d){while(--_0x22aa7d){_0x4da758['push'](_0x4da758['shift']());}};_0x4f8dd6(++_0x5393c4);}(_0x486d,0x17b));var _0xd486=function(_0x230d9e,_0x23e6a0){_0x230d9e=_0x230d9e-0x0;var _0x5ce8d7=_0x486d[_0x230d9e];return _0x5ce8d7;};'use strict';var multer=require(_0xd486('0x0'));var util=require('util');var path=require(_0xd486('0x1'));var timeout=require(_0xd486('0x2'));var express=require(_0xd486('0x3'));var router=express[_0xd486('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd486('0x5'));var interaction=require(_0xd486('0x6'));var config=require(_0xd486('0x7'));var controller=require(_0xd486('0x8'));router[_0xd486('0x9')]('/',auth[_0xd486('0xa')](),controller[_0xd486('0xb')]);router[_0xd486('0x9')](_0xd486('0xc'),auth[_0xd486('0xa')](),controller[_0xd486('0xd')]);router[_0xd486('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xd486('0xe')]);router[_0xd486('0xf')]('/:id',auth[_0xd486('0xa')](),controller[_0xd486('0x10')]);router['delete'](_0xd486('0x11'),auth[_0xd486('0xa')](),controller[_0xd486('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2643=['describe','/:id','show','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe'];(function(_0x40de0c,_0x95fecf){var _0x5885d0=function(_0x54cfed){while(--_0x54cfed){_0x40de0c['push'](_0x40de0c['shift']());}};_0x5885d0(++_0x95fecf);}(_0x2643,0xaf));var _0x3264=function(_0x5e0e24,_0x5acafb){_0x5e0e24=_0x5e0e24-0x0;var _0x10114e=_0x2643[_0x5e0e24];return _0x10114e;};'use strict';var multer=require(_0x3264('0x0'));var util=require(_0x3264('0x1'));var path=require(_0x3264('0x2'));var timeout=require(_0x3264('0x3'));var express=require('express');var router=express[_0x3264('0x4')]();var fs_extra=require(_0x3264('0x5'));var auth=require(_0x3264('0x6'));var interaction=require(_0x3264('0x7'));var config=require(_0x3264('0x8'));var controller=require(_0x3264('0x9'));router[_0x3264('0xa')]('/',auth[_0x3264('0xb')](),controller[_0x3264('0xc')]);router[_0x3264('0xa')](_0x3264('0xd'),auth['isAuthenticated'](),controller[_0x3264('0xe')]);router[_0x3264('0xa')](_0x3264('0xf'),auth['isAuthenticated'](),controller[_0x3264('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3264('0x11')](_0x3264('0xf'),auth[_0x3264('0xb')](),controller[_0x3264('0x12')]);router[_0x3264('0x13')](_0x3264('0xf'),auth[_0x3264('0xb')](),controller[_0x3264('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 4fc3ec6..d7bdcba 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 _0x0120=['exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x22bf49,_0x14c5e3){var _0xea63b0=function(_0x386fc0){while(--_0x386fc0){_0x22bf49['push'](_0x22bf49['shift']());}};_0xea63b0(++_0x14c5e3);}(_0x0120,0x6f));var _0x0012=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0120[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x0012('0x0'));module[_0x0012('0x1')]={'type':{'type':Sequelize[_0x0012('0x2')]},'uniqueid':{'type':Sequelize[_0x0012('0x2')]},'calleridnum':{'type':Sequelize[_0x0012('0x2')]},'calleridname':{'type':Sequelize[_0x0012('0x2')]},'queue':{'type':Sequelize[_0x0012('0x2')]},'interface':{'type':Sequelize[_0x0012('0x2')]},'membername':{'type':Sequelize[_0x0012('0x2')]},'agentcalledAt':{'type':Sequelize[_0x0012('0x3')]},'agentconnectAt':{'type':Sequelize[_0x0012('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x0012('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x0012('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x0012('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x0012('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x0012('0x5')]},'agentacw':{'type':Sequelize[_0x0012('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x0012('0x2')]},'lastevent':{'type':Sequelize[_0x0012('0x2')]},'channel':{'type':Sequelize[_0x0012('0x2')]},'channelstate':{'type':Sequelize[_0x0012('0x5')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0012('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0012('0x2')]},'accountcode':{'type':Sequelize[_0x0012('0x2')]},'context':{'type':Sequelize[_0x0012('0x2')]},'exten':{'type':Sequelize[_0x0012('0x2')]},'priority':{'type':Sequelize[_0x0012('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x0012('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x0012('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x0012('0x2')]},'destcontext':{'type':Sequelize[_0x0012('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x0012('0x2')]},'destuniqueid':{'type':Sequelize[_0x0012('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x0012('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x0012('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x0012('0x6')},'transferexten':{'type':Sequelize[_0x0012('0x2')]},'transferuniqueid':{'type':Sequelize[_0x0012('0x2')]},'agententerreason':{'type':Sequelize[_0x0012('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x56bd=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0x56bd,0xe9));var _0xd56b=function(_0x4f1499,_0x168614){_0x4f1499=_0x4f1499-0x0;var _0x54ff0f=_0x56bd[_0x4f1499];return _0x54ff0f;};'use strict';var Sequelize=require('sequelize');module[_0xd56b('0x0')]={'type':{'type':Sequelize[_0xd56b('0x1')]},'uniqueid':{'type':Sequelize[_0xd56b('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd56b('0x1')]},'queue':{'type':Sequelize[_0xd56b('0x1')]},'interface':{'type':Sequelize[_0xd56b('0x1')]},'membername':{'type':Sequelize[_0xd56b('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xd56b('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xd56b('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xd56b('0x2')]},'agentdumpAt':{'type':Sequelize[_0xd56b('0x2')]},'holdtime':{'type':Sequelize[_0xd56b('0x3')]},'agentcomplete':{'type':Sequelize[_0xd56b('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd56b('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd56b('0x3')]},'agentacw':{'type':Sequelize[_0xd56b('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd56b('0x3')]},'reason':{'type':Sequelize[_0xd56b('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xd56b('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd56b('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xd56b('0x1')]},'language':{'type':Sequelize[_0xd56b('0x1')]},'accountcode':{'type':Sequelize[_0xd56b('0x1')]},'context':{'type':Sequelize[_0xd56b('0x1')]},'exten':{'type':Sequelize[_0xd56b('0x1')]},'priority':{'type':Sequelize[_0xd56b('0x1')]},'destchannel':{'type':Sequelize[_0xd56b('0x1')]},'destchannelstate':{'type':Sequelize[_0xd56b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xd56b('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd56b('0x1')]},'destcalleridname':{'type':Sequelize[_0xd56b('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd56b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd56b('0x1')]},'destlanguage':{'type':Sequelize[_0xd56b('0x1')]},'destaccountcode':{'type':Sequelize[_0xd56b('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xd56b('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xd56b('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd56b('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xd56b('0x1')]},'transfer':{'type':Sequelize[_0xd56b('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd56b('0x1')],'comment':_0xd56b('0x5')},'transferexten':{'type':Sequelize[_0xd56b('0x1')]},'transferuniqueid':{'type':Sequelize[_0xd56b('0x1')]},'agententerreason':{'type':Sequelize[_0xd56b('0x3')],'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 44aecae..e8e08a7 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(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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 61de689..1e2fd7f 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 _0x5577=['uniqueid','destuniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent'];(function(_0x908eb6,_0x59199b){var _0x511a09=function(_0x376c8b){while(--_0x376c8b){_0x908eb6['push'](_0x908eb6['shift']());}};_0x511a09(++_0x59199b);}(_0x5577,0x1b4));var _0x7557=function(_0x3c2bfe,_0x2aa0c5){_0x3c2bfe=_0x3c2bfe-0x0;var _0x93f16=_0x5577[_0x3c2bfe];return _0x93f16;};'use strict';var _=require(_0x7557('0x0'));var util=require('util');var logger=require(_0x7557('0x1'))(_0x7557('0x2'));var moment=require('moment');var BPromise=require(_0x7557('0x3'));var rp=require(_0x7557('0x4'));var fs=require('fs');var path=require(_0x7557('0x5'));var rimraf=require(_0x7557('0x6'));var config=require(_0x7557('0x7'));var attributes=require(_0x7557('0x8'));module['exports']=function(_0x7bb8c,_0x41a4a5){return _0x7bb8c[_0x7557('0x9')](_0x7557('0xa'),attributes,{'tableName':_0x7557('0xb'),'paranoid':![],'indexes':[{'fields':[_0x7557('0xc'),_0x7557('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x975f=['destuniqueid','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','uniqueid'];(function(_0x5f5aa9,_0x472354){var _0x1bbe9d=function(_0x2b35f5){while(--_0x2b35f5){_0x5f5aa9['push'](_0x5f5aa9['shift']());}};_0x1bbe9d(++_0x472354);}(_0x975f,0x109));var _0xf975=function(_0x595bd1,_0xb1e7a){_0x595bd1=_0x595bd1-0x0;var _0xd0344f=_0x975f[_0x595bd1];return _0xd0344f;};'use strict';var _=require(_0xf975('0x0'));var util=require(_0xf975('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf975('0x2'));var BPromise=require(_0xf975('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf975('0x4'));var rimraf=require(_0xf975('0x5'));var config=require(_0xf975('0x6'));var attributes=require(_0xf975('0x7'));module['exports']=function(_0x356f71,_0x5a9aca){return _0x356f71[_0xf975('0x8')](_0xf975('0x9'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xf975('0xa'),_0xf975('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index e637b6a..aedb777 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 _0x8b47=['error','code','message','VoiceAgentReport,\x20%s,\x20%s','result','catch','CreateVoiceAgentReport','create','body','options','then','debug','UpdateVoiceAgentReport','VoiceAgentReport','update','raw','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x662d1d,_0x40469a){var _0x3e7796=function(_0x49a78d){while(--_0x49a78d){_0x662d1d['push'](_0x662d1d['shift']());}};_0x3e7796(++_0x40469a);}(_0x8b47,0x171));var _0x78b4=function(_0x313dd7,_0x3bb810){_0x313dd7=_0x313dd7-0x0;var _0x3fda50=_0x8b47[_0x313dd7];return _0x3fda50;};'use strict';var _=require(_0x78b4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x78b4('0x1'));var rs=require(_0x78b4('0x2'));var fs=require('fs');var Redis=require(_0x78b4('0x3'));var db=require(_0x78b4('0x4'))['db'];var utils=require(_0x78b4('0x5'));var logger=require(_0x78b4('0x6'))(_0x78b4('0x7'));var config=require(_0x78b4('0x8'));var jayson=require(_0x78b4('0x9'));var client=jayson[_0x78b4('0xa')][_0x78b4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3478bc,_0x26af7f,_0x3ecf76){return new BPromise(function(_0x35a9eb,_0x42218c){return client['request'](_0x3478bc,_0x3ecf76)['then'](function(_0x4057ca){logger[_0x78b4('0xc')]('VoiceAgentReport,\x20%s,\x20%s',_0x26af7f,'request\x20sent');logger['debug'](_0x78b4('0xd'),_0x26af7f,_0x78b4('0xe'),JSON[_0x78b4('0xf')](_0x4057ca));if(_0x4057ca[_0x78b4('0x10')]){if(_0x4057ca[_0x78b4('0x10')][_0x78b4('0x11')]===0x1f4){logger[_0x78b4('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x26af7f,_0x4057ca[_0x78b4('0x10')][_0x78b4('0x12')]);return _0x42218c(_0x4057ca[_0x78b4('0x10')][_0x78b4('0x12')]);}logger[_0x78b4('0x10')](_0x78b4('0x13'),_0x26af7f,_0x4057ca['error'][_0x78b4('0x12')]);return _0x35a9eb(_0x4057ca['error'][_0x78b4('0x12')]);}else{logger[_0x78b4('0xc')](_0x78b4('0x13'),_0x26af7f,'request\x20sent');_0x35a9eb(_0x4057ca[_0x78b4('0x14')][_0x78b4('0x12')]);}})[_0x78b4('0x15')](function(_0x4f470c){logger['error'](_0x78b4('0x13'),_0x26af7f,_0x4f470c);_0x42218c(_0x4f470c);});});}exports[_0x78b4('0x16')]=function(_0x375799){var _0x446738=this;return new Promise(function(_0x134059,_0x4c5c9b){return db['VoiceAgentReport'][_0x78b4('0x17')](_0x375799[_0x78b4('0x18')],{'raw':_0x375799[_0x78b4('0x19')]?_0x375799[_0x78b4('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x78b4('0x1a')](function(_0x8a36e0){logger[_0x78b4('0xc')]('CreateVoiceAgentReport',_0x375799);logger[_0x78b4('0x1b')](_0x78b4('0x16'),_0x375799,JSON['stringify'](_0x8a36e0));_0x134059(_0x8a36e0);})[_0x78b4('0x15')](function(_0x493b5c){logger[_0x78b4('0x10')](_0x78b4('0x16'),_0x493b5c[_0x78b4('0x12')],_0x375799);_0x4c5c9b(_0x446738[_0x78b4('0x10')](0x1f4,_0x493b5c[_0x78b4('0x12')]));});});};exports[_0x78b4('0x1c')]=function(_0x414f9f){var _0x23b6a6=this;return new Promise(function(_0x370948,_0x448af9){return db[_0x78b4('0x1d')][_0x78b4('0x1e')](_0x414f9f[_0x78b4('0x18')],{'raw':_0x414f9f[_0x78b4('0x19')]?_0x414f9f[_0x78b4('0x19')][_0x78b4('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x414f9f[_0x78b4('0x19')]?_0x414f9f[_0x78b4('0x19')][_0x78b4('0x20')]||null:null,'attributes':_0x414f9f[_0x78b4('0x19')]?_0x414f9f[_0x78b4('0x19')][_0x78b4('0x21')]||null:null,'limit':_0x414f9f[_0x78b4('0x19')]?_0x414f9f[_0x78b4('0x19')][_0x78b4('0x22')]||null:null})['then'](function(_0x55255f){logger['info'](_0x78b4('0x1c'),_0x414f9f);logger[_0x78b4('0x1b')]('UpdateVoiceAgentReport',_0x414f9f,JSON[_0x78b4('0xf')](_0x55255f));_0x370948(_0x55255f);})[_0x78b4('0x15')](function(_0x16eeb2){logger[_0x78b4('0x10')](_0x78b4('0x1c'),_0x16eeb2[_0x78b4('0x12')],_0x414f9f);_0x448af9(_0x23b6a6['error'](0x1f4,_0x16eeb2['message']));});});}; \ No newline at end of file +var _0xa9cb=['jayson/promise','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport','options','raw','then','UpdateVoiceAgentReport','update','body','where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x1dfc81,_0x3b4483){var _0x3a2430=function(_0x301925){while(--_0x301925){_0x1dfc81['push'](_0x1dfc81['shift']());}};_0x3a2430(++_0x3b4483);}(_0xa9cb,0x14b));var _0xba9c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9cb[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xba9c('0x0'));var util=require(_0xba9c('0x1'));var moment=require('moment');var BPromise=require(_0xba9c('0x2'));var rs=require(_0xba9c('0x3'));var fs=require('fs');var Redis=require(_0xba9c('0x4'));var db=require(_0xba9c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xba9c('0x6'))(_0xba9c('0x7'));var config=require(_0xba9c('0x8'));var jayson=require(_0xba9c('0x9'));var client=jayson[_0xba9c('0xa')][_0xba9c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1da8a4,_0x3dd497,_0x5b5738){return new BPromise(function(_0x514b77,_0x20ad22){return client[_0xba9c('0xc')](_0x1da8a4,_0x5b5738)['then'](function(_0x10c0e2){logger[_0xba9c('0xd')](_0xba9c('0xe'),_0x3dd497,_0xba9c('0xf'));logger[_0xba9c('0x10')](_0xba9c('0x11'),_0x3dd497,_0xba9c('0xf'),JSON[_0xba9c('0x12')](_0x10c0e2));if(_0x10c0e2[_0xba9c('0x13')]){if(_0x10c0e2[_0xba9c('0x13')][_0xba9c('0x14')]===0x1f4){logger['error'](_0xba9c('0xe'),_0x3dd497,_0x10c0e2[_0xba9c('0x13')][_0xba9c('0x15')]);return _0x20ad22(_0x10c0e2[_0xba9c('0x13')][_0xba9c('0x15')]);}logger['error'](_0xba9c('0xe'),_0x3dd497,_0x10c0e2[_0xba9c('0x13')][_0xba9c('0x15')]);return _0x514b77(_0x10c0e2['error'][_0xba9c('0x15')]);}else{logger[_0xba9c('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x3dd497,'request\x20sent');_0x514b77(_0x10c0e2[_0xba9c('0x16')][_0xba9c('0x15')]);}})[_0xba9c('0x17')](function(_0x476926){logger['error'](_0xba9c('0xe'),_0x3dd497,_0x476926);_0x20ad22(_0x476926);});});}exports[_0xba9c('0x18')]=function(_0x2f498b){var _0xeb8478=this;return new Promise(function(_0x1f6322,_0x577691){return db[_0xba9c('0x19')]['create'](_0x2f498b['body'],{'raw':_0x2f498b[_0xba9c('0x1a')]?_0x2f498b['options'][_0xba9c('0x1b')]===undefined?!![]:![]:!![]})[_0xba9c('0x1c')](function(_0x26ee8d){logger[_0xba9c('0xd')](_0xba9c('0x18'),_0x2f498b);logger[_0xba9c('0x10')](_0xba9c('0x18'),_0x2f498b,JSON['stringify'](_0x26ee8d));_0x1f6322(_0x26ee8d);})[_0xba9c('0x17')](function(_0x504029){logger[_0xba9c('0x13')](_0xba9c('0x18'),_0x504029[_0xba9c('0x15')],_0x2f498b);_0x577691(_0xeb8478[_0xba9c('0x13')](0x1f4,_0x504029[_0xba9c('0x15')]));});});};exports[_0xba9c('0x1d')]=function(_0x885594){var _0x219887=this;return new Promise(function(_0x4e7e54,_0x5bb926){return db[_0xba9c('0x19')][_0xba9c('0x1e')](_0x885594[_0xba9c('0x1f')],{'raw':_0x885594[_0xba9c('0x1a')]?_0x885594[_0xba9c('0x1a')][_0xba9c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x885594[_0xba9c('0x1a')]?_0x885594[_0xba9c('0x1a')][_0xba9c('0x20')]||null:null,'attributes':_0x885594[_0xba9c('0x1a')]?_0x885594['options'][_0xba9c('0x21')]||null:null,'limit':_0x885594['options']?_0x885594[_0xba9c('0x1a')]['limit']||null:null})[_0xba9c('0x1c')](function(_0x484b53){logger[_0xba9c('0xd')](_0xba9c('0x1d'),_0x885594);logger[_0xba9c('0x10')](_0xba9c('0x1d'),_0x885594,JSON[_0xba9c('0x12')](_0x484b53));_0x4e7e54(_0x484b53);})[_0xba9c('0x17')](function(_0x4993e5){logger[_0xba9c('0x13')]('UpdateVoiceAgentReport',_0x4993e5['message'],_0x885594);_0x5bb926(_0x219887[_0xba9c('0x13')](0x1f4,_0x4993e5[_0xba9c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index d3047fd..2f4327d 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 _0x98a8=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports'];(function(_0x291830,_0x386bb0){var _0x4713e2=function(_0x301237){while(--_0x301237){_0x291830['push'](_0x291830['shift']());}};_0x4713e2(++_0x386bb0);}(_0x98a8,0x12c));var _0x898a=function(_0x3bafbc,_0x5d6760){_0x3bafbc=_0x3bafbc-0x0;var _0x4d3aed=_0x98a8[_0x3bafbc];return _0x4d3aed;};'use strict';var multer=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var timeout=require(_0x898a('0x3'));var express=require(_0x898a('0x4'));var router=express[_0x898a('0x5')]();var fs_extra=require(_0x898a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var controller=require(_0x898a('0x9'));router[_0x898a('0xa')]('/',auth[_0x898a('0xb')](),controller['index']);router[_0x898a('0xa')]('/describe',auth[_0x898a('0xb')](),controller['describe']);router[_0x898a('0xa')](_0x898a('0xc'),auth[_0x898a('0xb')](),controller[_0x898a('0xd')]);router[_0x898a('0xe')]('/',auth[_0x898a('0xb')](),controller[_0x898a('0xf')]);router[_0x898a('0x10')](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0x11')]);router['delete'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0x12')]);module[_0x898a('0x13')]=router; \ No newline at end of file +var _0x24ca=['create','update','delete','destroy','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','/describe','isAuthenticated','describe','/:id','post'];(function(_0x22b1b5,_0x181a1e){var _0x20f79d=function(_0x5f1ae8){while(--_0x5f1ae8){_0x22b1b5['push'](_0x22b1b5['shift']());}};_0x20f79d(++_0x181a1e);}(_0x24ca,0x8c));var _0xa24c=function(_0x555069,_0x23d66a){_0x555069=_0x555069-0x0;var _0x100af7=_0x24ca[_0x555069];return _0x100af7;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa24c('0x1'));var express=require('express');var router=express[_0xa24c('0x2')]();var fs_extra=require(_0xa24c('0x3'));var auth=require(_0xa24c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa24c('0x5'));var controller=require(_0xa24c('0x6'));router[_0xa24c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa24c('0x8'),auth[_0xa24c('0x9')](),controller[_0xa24c('0xa')]);router[_0xa24c('0x7')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller['show']);router[_0xa24c('0xc')]('/',auth[_0xa24c('0x9')](),controller[_0xa24c('0xd')]);router['put']('/:id',auth[_0xa24c('0x9')](),controller[_0xa24c('0xe')]);router[_0xa24c('0xf')](_0xa24c('0xb'),auth[_0xa24c('0x9')](),controller[_0xa24c('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 98b1ae9..fdba937 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 _0x2129=['DATE','INTEGER','exports','STRING','inbound','internal','outbound','dialer'];(function(_0x2c1837,_0x82ad96){var _0x5041a0=function(_0x35a869){while(--_0x35a869){_0x2c1837['push'](_0x2c1837['shift']());}};_0x5041a0(++_0x82ad96);}(_0x2129,0x1ea));var _0x9212=function(_0x1c7758,_0x70dee0){_0x1c7758=_0x1c7758-0x0;var _0x275d5e=_0x2129[_0x1c7758];return _0x275d5e;};'use strict';var Sequelize=require('sequelize');module[_0x9212('0x0')]={'uniqueid':{'type':Sequelize[_0x9212('0x1')]},'type':{'type':Sequelize['ENUM'](_0x9212('0x2'),_0x9212('0x3'),_0x9212('0x4'),'inbound-fax','outbound-fax',_0x9212('0x5'))},'tag':{'type':Sequelize[_0x9212('0x1')]},'accountcode':{'type':Sequelize[_0x9212('0x1')]},'source':{'type':Sequelize[_0x9212('0x1')]},'destination':{'type':Sequelize[_0x9212('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9212('0x1')]},'channel':{'type':Sequelize[_0x9212('0x1')]},'destinationchannel':{'type':Sequelize[_0x9212('0x1')]},'lastapplication':{'type':Sequelize[_0x9212('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x9212('0x6')]},'systemanswertime':{'type':Sequelize[_0x9212('0x6')]},'answertime':{'type':Sequelize[_0x9212('0x6')]},'endtime':{'type':Sequelize[_0x9212('0x6')]},'duration':{'type':Sequelize[_0x9212('0x7')]},'billableseconds':{'type':Sequelize[_0x9212('0x7')]},'mohtime':{'type':Sequelize[_0x9212('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x9212('0x1')]},'userDisposition':{'type':Sequelize[_0x9212('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x9212('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x9212('0x1')]},'note':{'type':Sequelize[_0x9212('0x1')]},'prefix':{'type':Sequelize[_0x9212('0x1')]},'routeid':{'type':Sequelize[_0x9212('0x7')]},'sipcallid':{'type':Sequelize[_0x9212('0x1')]}}; \ No newline at end of file +var _0x84e5=['inbound','internal','outbound','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER','exports','ENUM'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x84e5,0x111));var _0x584e=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0x84e5[_0x44d9ab];return _0x31485e;};'use strict';var Sequelize=require('sequelize');module[_0x584e('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x584e('0x1')](_0x584e('0x2'),_0x584e('0x3'),_0x584e('0x4'),'inbound-fax',_0x584e('0x5'),_0x584e('0x6'))},'tag':{'type':Sequelize[_0x584e('0x7')]},'accountcode':{'type':Sequelize[_0x584e('0x7')]},'source':{'type':Sequelize[_0x584e('0x7')]},'destination':{'type':Sequelize[_0x584e('0x7')]},'destinationcontext':{'type':Sequelize[_0x584e('0x7')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x584e('0x7')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x584e('0x7')]},'lastdata':{'type':Sequelize[_0x584e('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x584e('0x9')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x584e('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x584e('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x584e('0x7')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x584e('0x7')]},'userDisposition':{'type':Sequelize[_0x584e('0x7')]},'userSecondDisposition':{'type':Sequelize[_0x584e('0x7')]},'userThirdDisposition':{'type':Sequelize[_0x584e('0x7')]},'note':{'type':Sequelize[_0x584e('0x7')]},'prefix':{'type':Sequelize[_0x584e('0x7')]},'routeid':{'type':Sequelize[_0x584e('0xa')]},'sipcallid':{'type':Sequelize[_0x584e('0x7')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 36802b2..06183a3 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 _0x5f66=['../../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','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','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'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'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')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file +var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x1ebce2,_0x10e903){var _0x4a330c=function(_0x4fd810){while(--_0x4fd810){_0x1ebce2['push'](_0x1ebce2['shift']());}};_0x4a330c(++_0x10e903);}(_0x2ef3,0xba));var _0x32ef=function(_0x3e67d6,_0x77f8db){_0x3e67d6=_0x3e67d6-0x0;var _0x59a7c1=_0x2ef3[_0x3e67d6];return _0x59a7c1;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 21e44af..9d81af2 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 _0x3c4c=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid'];(function(_0x23ab5c,_0x219f93){var _0x23245c=function(_0x94bfd7){while(--_0x94bfd7){_0x23ab5c['push'](_0x23ab5c['shift']());}};_0x23245c(++_0x219f93);}(_0x3c4c,0x16c));var _0xc3c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x3c4c[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xc3c4('0x0'));var util=require('util');var logger=require(_0xc3c4('0x1'))(_0xc3c4('0x2'));var moment=require(_0xc3c4('0x3'));var BPromise=require(_0xc3c4('0x4'));var rp=require(_0xc3c4('0x5'));var fs=require('fs');var path=require(_0xc3c4('0x6'));var rimraf=require(_0xc3c4('0x7'));var config=require('../../config/environment');var attributes=require(_0xc3c4('0x8'));module[_0xc3c4('0x9')]=function(_0x5ae28f,_0x118d39){return _0x5ae28f[_0xc3c4('0xa')](_0xc3c4('0xb'),attributes,{'tableName':_0xc3c4('0xc'),'paranoid':![],'indexes':[{'fields':[_0xc3c4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5959=['VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes'];(function(_0x275fbb,_0x52bdd9){var _0x1a1699=function(_0x2ded23){while(--_0x2ded23){_0x275fbb['push'](_0x275fbb['shift']());}};_0x1a1699(++_0x52bdd9);}(_0x5959,0x17c));var _0x9595=function(_0x12ddb2,_0x5ad61e){_0x12ddb2=_0x12ddb2-0x0;var _0x10b6dd=_0x5959[_0x12ddb2];return _0x10b6dd;};'use strict';var _=require(_0x9595('0x0'));var util=require(_0x9595('0x1'));var logger=require(_0x9595('0x2'))('api');var moment=require(_0x9595('0x3'));var BPromise=require(_0x9595('0x4'));var rp=require(_0x9595('0x5'));var fs=require('fs');var path=require(_0x9595('0x6'));var rimraf=require(_0x9595('0x7'));var config=require(_0x9595('0x8'));var attributes=require(_0x9595('0x9'));module['exports']=function(_0x20e2fb,_0x19b27c){return _0x20e2fb['define'](_0x9595('0xa'),attributes,{'tableName':_0x9595('0xb'),'paranoid':![],'indexes':[{'fields':[_0x9595('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 1da181e..bd91bb3 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 _0xdf4a=['CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','debug','request\x20sent','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','include','model','attributes','map','catch'];(function(_0x22036a,_0x51326d){var _0x1b20b=function(_0x401a74){while(--_0x401a74){_0x22036a['push'](_0x22036a['shift']());}};_0x1b20b(++_0x51326d);}(_0xdf4a,0x1f3));var _0xadf4=function(_0x436fa1,_0x2f747a){_0x436fa1=_0x436fa1-0x0;var _0x3af183=_0xdf4a[_0x436fa1];return _0x3af183;};'use strict';var _=require(_0xadf4('0x0'));var util=require(_0xadf4('0x1'));var moment=require('moment');var BPromise=require(_0xadf4('0x2'));var rs=require(_0xadf4('0x3'));var fs=require('fs');var Redis=require(_0xadf4('0x4'));var db=require(_0xadf4('0x5'))['db'];var utils=require(_0xadf4('0x6'));var logger=require(_0xadf4('0x7'))('rpc');var config=require(_0xadf4('0x8'));var jayson=require(_0xadf4('0x9'));var client=jayson[_0xadf4('0xa')][_0xadf4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x152f45,_0x1a67e6,_0x284e81){return new BPromise(function(_0x3b1540,_0x56b4fa){return client['request'](_0x152f45,_0x284e81)[_0xadf4('0xc')](function(_0x5f1ff6){logger[_0xadf4('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x1a67e6,'request\x20sent');logger[_0xadf4('0xe')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x1a67e6,_0xadf4('0xf'),JSON[_0xadf4('0x10')](_0x5f1ff6));if(_0x5f1ff6[_0xadf4('0x11')]){if(_0x5f1ff6['error'][_0xadf4('0x12')]===0x1f4){logger['error'](_0xadf4('0x13'),_0x1a67e6,_0x5f1ff6[_0xadf4('0x11')]['message']);return _0x56b4fa(_0x5f1ff6[_0xadf4('0x11')][_0xadf4('0x14')]);}logger[_0xadf4('0x11')](_0xadf4('0x13'),_0x1a67e6,_0x5f1ff6[_0xadf4('0x11')]['message']);return _0x3b1540(_0x5f1ff6[_0xadf4('0x11')]['message']);}else{logger[_0xadf4('0xd')](_0xadf4('0x13'),_0x1a67e6,_0xadf4('0xf'));_0x3b1540(_0x5f1ff6[_0xadf4('0x15')][_0xadf4('0x14')]);}})['catch'](function(_0x59d2dc){logger[_0xadf4('0x11')](_0xadf4('0x13'),_0x1a67e6,_0x59d2dc);_0x56b4fa(_0x59d2dc);});});}exports[_0xadf4('0x16')]=function(_0x177952){var _0x42dc54=this;return new Promise(function(_0x743004,_0x57b5fe){return db[_0xadf4('0x17')][_0xadf4('0x18')]({'raw':_0x177952[_0xadf4('0x19')]?_0x177952['options'][_0xadf4('0x1a')]===undefined?!![]:![]:!![],'where':_0x177952[_0xadf4('0x19')]?_0x177952[_0xadf4('0x19')][_0xadf4('0x1b')]||null:null,'attributes':_0x177952[_0xadf4('0x19')]?_0x177952['options']['attributes']||null:null,'limit':_0x177952['options']?_0x177952[_0xadf4('0x19')]['limit']||null:null,'include':_0x177952[_0xadf4('0x19')]?_0x177952[_0xadf4('0x19')][_0xadf4('0x1c')]?_['map'](_0x177952[_0xadf4('0x19')][_0xadf4('0x1c')],function(_0x2c53ba){return{'model':db[_0x2c53ba[_0xadf4('0x1d')]],'as':_0x2c53ba['as'],'attributes':_0x2c53ba[_0xadf4('0x1e')],'include':_0x2c53ba[_0xadf4('0x1c')]?_['map'](_0x2c53ba[_0xadf4('0x1c')],function(_0x44cad3){return{'model':db[_0x44cad3[_0xadf4('0x1d')]],'as':_0x44cad3['as'],'attributes':_0x44cad3[_0xadf4('0x1e')],'include':_0x44cad3[_0xadf4('0x1c')]?_[_0xadf4('0x1f')](_0x44cad3[_0xadf4('0x1c')],function(_0x2589c6){return{'model':db[_0x2589c6['model']],'as':_0x2589c6['as'],'attributes':_0x2589c6[_0xadf4('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x109cd2){logger[_0xadf4('0xd')](_0xadf4('0x16'),_0x177952);logger[_0xadf4('0xe')](_0xadf4('0x16'),_0x177952,JSON[_0xadf4('0x10')](_0x109cd2));_0x743004(_0x109cd2);})[_0xadf4('0x20')](function(_0x5d5143){logger[_0xadf4('0x11')]('GetVoiceCallReport',_0x5d5143[_0xadf4('0x14')],_0x177952);_0x57b5fe(_0x42dc54[_0xadf4('0x11')](0x1f4,_0x5d5143[_0xadf4('0x14')]));});});};exports[_0xadf4('0x21')]=function(_0x267645){var _0x318043=this;return new Promise(function(_0x3a1b86,_0x528ea7){return db['VoiceCallReport'][_0xadf4('0x22')](_0x267645[_0xadf4('0x23')],{'raw':_0x267645[_0xadf4('0x19')]?_0x267645[_0xadf4('0x19')][_0xadf4('0x1a')]===undefined?!![]:![]:!![]})[_0xadf4('0xc')](function(_0x3626fb){logger[_0xadf4('0xd')](_0xadf4('0x21'),_0x267645);logger[_0xadf4('0xe')](_0xadf4('0x21'),_0x267645,JSON['stringify'](_0x3626fb));_0x3a1b86(_0x3626fb);})[_0xadf4('0x20')](function(_0x25e8b3){logger[_0xadf4('0x11')](_0xadf4('0x21'),_0x25e8b3[_0xadf4('0x14')],_0x267645);_0x528ea7(_0x318043[_0xadf4('0x11')](0x1f4,_0x25e8b3[_0xadf4('0x14')]));});});};exports[_0xadf4('0x24')]=function(_0x2637b2){var _0x80b83a=this;return new Promise(function(_0x2d4110,_0x41c94b){return db['VoiceCallReport'][_0xadf4('0x25')](_0x2637b2[_0xadf4('0x23')],{'raw':_0x2637b2[_0xadf4('0x19')]?_0x2637b2[_0xadf4('0x19')][_0xadf4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2637b2['options']?_0x2637b2[_0xadf4('0x19')]['where']||null:null,'attributes':_0x2637b2['options']?_0x2637b2[_0xadf4('0x19')]['attributes']||null:null,'limit':_0x2637b2['options']?_0x2637b2[_0xadf4('0x19')]['limit']||null:null})['then'](function(_0x144cab){logger[_0xadf4('0xd')](_0xadf4('0x24'),_0x2637b2);logger['debug'](_0xadf4('0x24'),_0x2637b2,JSON[_0xadf4('0x10')](_0x144cab));_0x2d4110(_0x144cab);})[_0xadf4('0x20')](function(_0xcd8267){logger[_0xadf4('0x11')](_0xadf4('0x24'),_0xcd8267[_0xadf4('0x14')],_0x2637b2);_0x41c94b(_0x80b83a['error'](0x1f4,_0xcd8267[_0xadf4('0x14')]));});});}; \ No newline at end of file +var _0x0c1c=['where','attributes','limit','include','map','model','debug','stringify','catch','CreateVoiceCallReport','create','update','body','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw'];(function(_0xc9ac52,_0xdac49f){var _0x400f6e=function(_0x1cfb02){while(--_0x1cfb02){_0xc9ac52['push'](_0xc9ac52['shift']());}};_0x400f6e(++_0xdac49f);}(_0x0c1c,0x83));var _0xc0c1=function(_0xcfd89f,_0x106e8f){_0xcfd89f=_0xcfd89f-0x0;var _0x59acd4=_0x0c1c[_0xcfd89f];return _0x59acd4;};'use strict';var _=require(_0xc0c1('0x0'));var util=require(_0xc0c1('0x1'));var moment=require(_0xc0c1('0x2'));var BPromise=require(_0xc0c1('0x3'));var rs=require(_0xc0c1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc0c1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc0c1('0x6'))('rpc');var config=require(_0xc0c1('0x7'));var jayson=require(_0xc0c1('0x8'));var client=jayson[_0xc0c1('0x9')][_0xc0c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cbb6a,_0x1549f8,_0x2b3b79){return new BPromise(function(_0x1e6727,_0xb2205e){return client[_0xc0c1('0xb')](_0x2cbb6a,_0x2b3b79)[_0xc0c1('0xc')](function(_0x3c9f41){logger[_0xc0c1('0xd')](_0xc0c1('0xe'),_0x1549f8,'request\x20sent');logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x1549f8,_0xc0c1('0xf'),JSON['stringify'](_0x3c9f41));if(_0x3c9f41[_0xc0c1('0x10')]){if(_0x3c9f41[_0xc0c1('0x10')][_0xc0c1('0x11')]===0x1f4){logger[_0xc0c1('0x10')](_0xc0c1('0xe'),_0x1549f8,_0x3c9f41['error']['message']);return _0xb2205e(_0x3c9f41['error'][_0xc0c1('0x12')]);}logger[_0xc0c1('0x10')](_0xc0c1('0xe'),_0x1549f8,_0x3c9f41[_0xc0c1('0x10')]['message']);return _0x1e6727(_0x3c9f41[_0xc0c1('0x10')][_0xc0c1('0x12')]);}else{logger[_0xc0c1('0xd')](_0xc0c1('0xe'),_0x1549f8,_0xc0c1('0xf'));_0x1e6727(_0x3c9f41[_0xc0c1('0x13')]['message']);}})['catch'](function(_0x33ee11){logger[_0xc0c1('0x10')](_0xc0c1('0xe'),_0x1549f8,_0x33ee11);_0xb2205e(_0x33ee11);});});}exports[_0xc0c1('0x14')]=function(_0x156f94){var _0x56f7d6=this;return new Promise(function(_0x438b25,_0x1e2df0){return db[_0xc0c1('0x15')][_0xc0c1('0x16')]({'raw':_0x156f94[_0xc0c1('0x17')]?_0x156f94['options'][_0xc0c1('0x18')]===undefined?!![]:![]:!![],'where':_0x156f94['options']?_0x156f94[_0xc0c1('0x17')][_0xc0c1('0x19')]||null:null,'attributes':_0x156f94[_0xc0c1('0x17')]?_0x156f94[_0xc0c1('0x17')][_0xc0c1('0x1a')]||null:null,'limit':_0x156f94[_0xc0c1('0x17')]?_0x156f94['options'][_0xc0c1('0x1b')]||null:null,'include':_0x156f94['options']?_0x156f94['options'][_0xc0c1('0x1c')]?_[_0xc0c1('0x1d')](_0x156f94['options'][_0xc0c1('0x1c')],function(_0xf29b93){return{'model':db[_0xf29b93[_0xc0c1('0x1e')]],'as':_0xf29b93['as'],'attributes':_0xf29b93[_0xc0c1('0x1a')],'include':_0xf29b93['include']?_[_0xc0c1('0x1d')](_0xf29b93[_0xc0c1('0x1c')],function(_0x6ae01){return{'model':db[_0x6ae01[_0xc0c1('0x1e')]],'as':_0x6ae01['as'],'attributes':_0x6ae01['attributes'],'include':_0x6ae01['include']?_[_0xc0c1('0x1d')](_0x6ae01[_0xc0c1('0x1c')],function(_0x503510){return{'model':db[_0x503510[_0xc0c1('0x1e')]],'as':_0x503510['as'],'attributes':_0x503510[_0xc0c1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc0c1('0xc')](function(_0x58d22c){logger['info'](_0xc0c1('0x14'),_0x156f94);logger[_0xc0c1('0x1f')](_0xc0c1('0x14'),_0x156f94,JSON[_0xc0c1('0x20')](_0x58d22c));_0x438b25(_0x58d22c);})[_0xc0c1('0x21')](function(_0x5d4ffe){logger['error'](_0xc0c1('0x14'),_0x5d4ffe[_0xc0c1('0x12')],_0x156f94);_0x1e2df0(_0x56f7d6['error'](0x1f4,_0x5d4ffe['message']));});});};exports[_0xc0c1('0x22')]=function(_0x5c39d3){var _0x11557a=this;return new Promise(function(_0x4b3a99,_0x1846fc){return db[_0xc0c1('0x15')][_0xc0c1('0x23')](_0x5c39d3['body'],{'raw':_0x5c39d3[_0xc0c1('0x17')]?_0x5c39d3[_0xc0c1('0x17')][_0xc0c1('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x463bf4){logger[_0xc0c1('0xd')](_0xc0c1('0x22'),_0x5c39d3);logger[_0xc0c1('0x1f')](_0xc0c1('0x22'),_0x5c39d3,JSON['stringify'](_0x463bf4));_0x4b3a99(_0x463bf4);})[_0xc0c1('0x21')](function(_0x32a58e){logger[_0xc0c1('0x10')](_0xc0c1('0x22'),_0x32a58e[_0xc0c1('0x12')],_0x5c39d3);_0x1846fc(_0x11557a[_0xc0c1('0x10')](0x1f4,_0x32a58e[_0xc0c1('0x12')]));});});};exports['UpdateVoiceCallReport']=function(_0x482dc7){var _0x47b5dc=this;return new Promise(function(_0x474caa,_0x2e768e){return db[_0xc0c1('0x15')][_0xc0c1('0x24')](_0x482dc7[_0xc0c1('0x25')],{'raw':_0x482dc7[_0xc0c1('0x17')]?_0x482dc7[_0xc0c1('0x17')][_0xc0c1('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x482dc7[_0xc0c1('0x17')]?_0x482dc7[_0xc0c1('0x17')]['where']||null:null,'attributes':_0x482dc7['options']?_0x482dc7['options'][_0xc0c1('0x1a')]||null:null,'limit':_0x482dc7[_0xc0c1('0x17')]?_0x482dc7[_0xc0c1('0x17')][_0xc0c1('0x1b')]||null:null})[_0xc0c1('0xc')](function(_0xdd934f){logger[_0xc0c1('0xd')](_0xc0c1('0x26'),_0x482dc7);logger[_0xc0c1('0x1f')](_0xc0c1('0x26'),_0x482dc7,JSON[_0xc0c1('0x20')](_0xdd934f));_0x474caa(_0xdd934f);})[_0xc0c1('0x21')](function(_0x115288){logger[_0xc0c1('0x10')](_0xc0c1('0x26'),_0x115288['message'],_0x482dc7);_0x2e768e(_0x47b5dc[_0xc0c1('0x10')](0x1f4,_0x115288['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 37f05e0..79bbde4 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 _0xf47a=['../../components/interaction/service','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x404bce,_0x3f2d7e){var _0x5ea4b7=function(_0x3d33d0){while(--_0x3d33d0){_0x404bce['push'](_0x404bce['shift']());}};_0x5ea4b7(++_0x3f2d7e);}(_0xf47a,0xa4));var _0xaf47=function(_0x4c5eb2,_0x4ba2fa){_0x4c5eb2=_0x4c5eb2-0x0;var _0x32b32b=_0xf47a[_0x4c5eb2];return _0x32b32b;};'use strict';var multer=require(_0xaf47('0x0'));var util=require('util');var path=require(_0xaf47('0x1'));var timeout=require(_0xaf47('0x2'));var express=require(_0xaf47('0x3'));var router=express['Router']();var fs_extra=require(_0xaf47('0x4'));var auth=require(_0xaf47('0x5'));var interaction=require(_0xaf47('0x6'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xaf47('0x7')]);router['get'](_0xaf47('0x8'),auth[_0xaf47('0x9')](),controller[_0xaf47('0xa')]);router[_0xaf47('0xb')]('/',auth['isAuthenticated'](),controller[_0xaf47('0xc')]);router[_0xaf47('0xd')](_0xaf47('0x8'),auth['isAuthenticated'](),controller[_0xaf47('0xe')]);router[_0xaf47('0xf')](_0xaf47('0x8'),auth[_0xaf47('0x9')](),controller[_0xaf47('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa887=['put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xa887,0x89));var _0x7a88=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa887[_0x433a86];return _0x23000c;};'use strict';var multer=require(_0x7a88('0x0'));var util=require('util');var path=require(_0x7a88('0x1'));var timeout=require(_0x7a88('0x2'));var express=require('express');var router=express[_0x7a88('0x3')]();var fs_extra=require(_0x7a88('0x4'));var auth=require(_0x7a88('0x5'));var interaction=require(_0x7a88('0x6'));var config=require(_0x7a88('0x7'));var controller=require(_0x7a88('0x8'));router[_0x7a88('0x9')]('/',auth[_0x7a88('0xa')](),controller[_0x7a88('0xb')]);router['get'](_0x7a88('0xc'),auth[_0x7a88('0xa')](),controller['show']);router[_0x7a88('0xd')]('/',auth['isAuthenticated'](),controller[_0x7a88('0xe')]);router[_0x7a88('0xf')](_0x7a88('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x7a88('0x10')](_0x7a88('0xc'),auth[_0x7a88('0xa')](),controller[_0x7a88('0x11')]);module[_0x7a88('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index d01b928..4063fce 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 _0xe0dd=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','setDataValue','options','join'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe0dd,0x1aa));var _0xde0d=function(_0x72a33d,_0x5691da){_0x72a33d=_0x72a33d-0x0;var _0x2621d5=_0xe0dd[_0x72a33d];return _0x2621d5;};'use strict';var Sequelize=require(_0xde0d('0x0'));module[_0xde0d('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xde0d('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x3ef4e5){this[_0xde0d('0x3')](_0xde0d('0x4'),_0x3ef4e5?_0x3ef4e5[_0xde0d('0x5')](''):[]);},'get':function(){return this[_0xde0d('0x6')](_0xde0d('0x4'))?this[_0xde0d('0x6')](_0xde0d('0x4'))[_0xde0d('0x7')](''):[];}},'auth':{'type':Sequelize[_0xde0d('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xde0d('0x2')]},'record':{'type':Sequelize[_0xde0d('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xde0d('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x034a=['name','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x42b74a,_0x2c2053){var _0xa73df3=function(_0x3bddf5){while(--_0x3bddf5){_0x42b74a['push'](_0x42b74a['shift']());}};_0xa73df3(++_0x2c2053);}(_0x034a,0x1ab));var _0xa034=function(_0x1d1ad8,_0x1e6c63){_0x1d1ad8=_0x1d1ad8-0x0;var _0x4d134e=_0x034a[_0x1d1ad8];return _0x4d134e;};'use strict';var Sequelize=require(_0xa034('0x0'));module[_0xa034('0x1')]={'name':{'type':Sequelize[_0xa034('0x2')]},'prefix':{'type':Sequelize[_0xa034('0x2')],'unique':_0xa034('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xa034('0x2')],'set':function(_0x176272){this[_0xa034('0x4')](_0xa034('0x5'),_0x176272?_0x176272[_0xa034('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xa034('0x5'))?this[_0xa034('0x7')](_0xa034('0x5'))[_0xa034('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xa034('0x2')]},'record':{'type':Sequelize[_0xa034('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xa034('0x2')]},'description':{'type':Sequelize[_0xa034('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 924470e..95349e3 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 _0xe28e=['stack','name','send','index','map','VoiceChanSpy','fieldName','key','model','query','keys','attributes','intersection','fields','limit','order','sort','where','filters','pick','VIRTUAL','merge','include','catch','show','rawAttributes','length','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','set','json','apply','reject','save','update','destroy','then','get','ChanSpies','UserProfileResource','error'];(function(_0x1c4865,_0x163598){var _0x2a3640=function(_0x16e8d8){while(--_0x16e8d8){_0x1c4865['push'](_0x1c4865['shift']());}};_0x2a3640(++_0x163598);}(_0xe28e,0x1ba));var _0xee28=function(_0x2a030c,_0x2f23dc){_0x2a030c=_0x2a030c-0x0;var _0x472113=_0xe28e[_0x2a030c];return _0x472113;};'use strict';var emlformat=require(_0xee28('0x0'));var rimraf=require(_0xee28('0x1'));var zipdir=require(_0xee28('0x2'));var jsonpatch=require(_0xee28('0x3'));var rp=require(_0xee28('0x4'));var moment=require(_0xee28('0x5'));var BPromise=require(_0xee28('0x6'));var Mustache=require(_0xee28('0x7'));var util=require(_0xee28('0x8'));var path=require(_0xee28('0x9'));var sox=require(_0xee28('0xa'));var csv=require(_0xee28('0xb'));var ejs=require(_0xee28('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee28('0xd'));var squel=require(_0xee28('0xe'));var crypto=require(_0xee28('0xf'));var jsforce=require(_0xee28('0x10'));var deskjs=require(_0xee28('0x11'));var toCsv=require(_0xee28('0xb'));var querystring=require(_0xee28('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xee28('0x13'));var as=require(_0xee28('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee28('0x15'))(_0xee28('0x16'));var utils=require('../../config/utils');var config=require(_0xee28('0x17'));var licenseUtil=require(_0xee28('0x18'));var db=require(_0xee28('0x19'))['db'];function respondWithStatusCode(_0x2488cf,_0x267031){_0x267031=_0x267031||0xcc;return function(_0x46e784){if(_0x46e784){return _0x2488cf[_0xee28('0x1a')](_0x267031);}return _0x2488cf['status'](_0x267031)[_0xee28('0x1b')]();};}function respondWithResult(_0x1df69a,_0x555b9c){_0x555b9c=_0x555b9c||0xc8;return function(_0x331b7c){if(_0x331b7c){return _0x1df69a[_0xee28('0x1c')](_0x555b9c)['json'](_0x331b7c);}};}function respondWithFilteredResult(_0x11ac93,_0x17c99a){return function(_0x3d3a5c){if(_0x3d3a5c){var _0x343358=typeof _0x17c99a[_0xee28('0x1d')]===_0xee28('0x1e')&&typeof _0x17c99a['limit']===_0xee28('0x1e');var _0x5de212=_0x3d3a5c[_0xee28('0x1f')];var _0x19472a=_0x343358?0x0:_0x17c99a['offset'];var _0x355b07=_0x343358?_0x3d3a5c['count']:_0x17c99a[_0xee28('0x1d')]+_0x17c99a['limit'];var _0x28da88;if(_0x355b07>=_0x5de212){_0x355b07=_0x5de212;_0x28da88=0xc8;}else{_0x28da88=0xce;}_0x11ac93['status'](_0x28da88);return _0x11ac93[_0xee28('0x20')]('Content-Range',_0x19472a+'-'+_0x355b07+'/'+_0x5de212)[_0xee28('0x21')](_0x3d3a5c);}return null;};}function patchUpdates(_0x2a01ff){return function(_0x96f5db){try{jsonpatch[_0xee28('0x22')](_0x96f5db,_0x2a01ff,!![]);}catch(_0x21ee24){return BPromise[_0xee28('0x23')](_0x21ee24);}return _0x96f5db[_0xee28('0x24')]();};}function saveUpdates(_0x4bda53,_0x342798){return function(_0x44d7ff){if(_0x44d7ff){return _0x44d7ff[_0xee28('0x25')](_0x4bda53)['then'](function(_0x5b500b){return _0x5b500b;});}return null;};}function removeEntity(_0x17d8e4,_0x4a524d){return function(_0x1519ae){if(_0x1519ae){return _0x1519ae[_0xee28('0x26')]()[_0xee28('0x27')](function(){var _0x3acfc9=_0x1519ae[_0xee28('0x28')]({'plain':!![]});var _0x95d917=_0xee28('0x29');return db[_0xee28('0x2a')][_0xee28('0x26')]({'where':{'type':_0x95d917,'resourceId':_0x3acfc9['id']}})['then'](function(){return _0x1519ae;});})[_0xee28('0x27')](function(){_0x17d8e4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54528b,_0x587aac){return function(_0x51eae7){if(!_0x51eae7){_0x54528b[_0xee28('0x1a')](0x194);}return _0x51eae7;};}function handleError(_0x884e7d,_0x3b64ad){_0x3b64ad=_0x3b64ad||0x1f4;return function(_0x469889){logger[_0xee28('0x2b')](_0x469889[_0xee28('0x2c')]);if(_0x469889[_0xee28('0x2d')]){delete _0x469889['name'];}_0x884e7d[_0xee28('0x1c')](_0x3b64ad)[_0xee28('0x2e')](_0x469889);};}exports[_0xee28('0x2f')]=function(_0x49644a,_0x14f7c4){var _0x2890ad={},_0x213e45={},_0xf0b169={'count':0x0,'rows':[]};var _0x1421bc=_[_0xee28('0x30')](db[_0xee28('0x31')]['rawAttributes'],function(_0x15f294){return{'name':_0x15f294[_0xee28('0x32')],'type':_0x15f294['type'][_0xee28('0x33')]};});_0x213e45[_0xee28('0x34')]=_[_0xee28('0x30')](_0x1421bc,_0xee28('0x2d'));_0x213e45[_0xee28('0x35')]=_[_0xee28('0x36')](_0x49644a[_0xee28('0x35')]);_0x213e45['filters']=_['intersection'](_0x213e45['model'],_0x213e45[_0xee28('0x35')]);_0x2890ad[_0xee28('0x37')]=_[_0xee28('0x38')](_0x213e45[_0xee28('0x34')],qs[_0xee28('0x39')](_0x49644a[_0xee28('0x35')]['fields']));_0x2890ad[_0xee28('0x37')]=_0x2890ad[_0xee28('0x37')]['length']?_0x2890ad['attributes']:_0x213e45[_0xee28('0x34')];if(!_0x49644a[_0xee28('0x35')]['hasOwnProperty']('nolimit')){_0x2890ad[_0xee28('0x3a')]=qs[_0xee28('0x3a')](_0x49644a['query'][_0xee28('0x3a')]);_0x2890ad[_0xee28('0x1d')]=qs[_0xee28('0x1d')](_0x49644a[_0xee28('0x35')][_0xee28('0x1d')]);}_0x2890ad[_0xee28('0x3b')]=qs[_0xee28('0x3c')](_0x49644a[_0xee28('0x35')][_0xee28('0x3c')]);_0x2890ad[_0xee28('0x3d')]=qs[_0xee28('0x3e')](_[_0xee28('0x3f')](_0x49644a['query'],_0x213e45[_0xee28('0x3e')]),_0x1421bc);if(_0x49644a['query']['filter']){_0x2890ad[_0xee28('0x3d')]=_['merge'](_0x2890ad[_0xee28('0x3d')],{'$or':_['map'](_0x1421bc,function(_0x2b73d9){if(_0x2b73d9['type']!==_0xee28('0x40')){var _0x211345={};_0x211345[_0x2b73d9[_0xee28('0x2d')]]={'$like':'%'+_0x49644a[_0xee28('0x35')]['filter']+'%'};return _0x211345;}})});}_0x2890ad=_[_0xee28('0x41')]({},_0x2890ad,_0x49644a['options']);var _0x45ed94={'where':_0x2890ad[_0xee28('0x3d')]};return db[_0xee28('0x31')][_0xee28('0x1f')](_0x45ed94)[_0xee28('0x27')](function(_0x2e046e){_0xf0b169[_0xee28('0x1f')]=_0x2e046e;if(_0x49644a['query']['includeAll']){_0x2890ad[_0xee28('0x42')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x2890ad);})[_0xee28('0x27')](function(_0x14bd8d){_0xf0b169['rows']=_0x14bd8d;return _0xf0b169;})[_0xee28('0x27')](respondWithFilteredResult(_0x14f7c4,_0x2890ad))[_0xee28('0x43')](handleError(_0x14f7c4,null));};exports[_0xee28('0x44')]=function(_0x24cfaa,_0x460c61){var _0x2351f7={'raw':![],'where':{'id':_0x24cfaa['params']['id']}},_0x1735a9={};_0x1735a9[_0xee28('0x34')]=_[_0xee28('0x36')](db[_0xee28('0x31')][_0xee28('0x45')]);_0x1735a9[_0xee28('0x35')]=_['keys'](_0x24cfaa[_0xee28('0x35')]);_0x1735a9[_0xee28('0x3e')]=_['intersection'](_0x1735a9[_0xee28('0x34')],_0x1735a9[_0xee28('0x35')]);_0x2351f7[_0xee28('0x37')]=_[_0xee28('0x38')](_0x1735a9[_0xee28('0x34')],qs[_0xee28('0x39')](_0x24cfaa['query'][_0xee28('0x39')]));_0x2351f7['attributes']=_0x2351f7['attributes'][_0xee28('0x46')]?_0x2351f7[_0xee28('0x37')]:_0x1735a9['model'];if(_0x24cfaa[_0xee28('0x35')][_0xee28('0x47')]){_0x2351f7[_0xee28('0x42')]=[{'all':!![]}];}_0x2351f7=_['merge']({},_0x2351f7,_0x24cfaa['options']);return db[_0xee28('0x31')][_0xee28('0x48')](_0x2351f7)[_0xee28('0x27')](handleEntityNotFound(_0x460c61,null))[_0xee28('0x27')](respondWithResult(_0x460c61,null))[_0xee28('0x43')](handleError(_0x460c61,null));};exports[_0xee28('0x49')]=function(_0x2574c5,_0x2b5f36){return db[_0xee28('0x31')][_0xee28('0x49')](_0x2574c5['body'],{})[_0xee28('0x27')](function(_0x5e174f){var _0x21a66a=_0x2574c5[_0xee28('0x4a')][_0xee28('0x28')]({'plain':!![]});if(!_0x21a66a)throw new Error(_0xee28('0x4b'));if(_0x21a66a[_0xee28('0x4c')]==='user'){var _0x5247fe=_0x5e174f['get']({'plain':!![]});var _0x1b15a4='ChanSpies';return db['UserProfileSection'][_0xee28('0x48')]({'where':{'name':_0x1b15a4,'userProfileId':_0x21a66a['userProfileId']},'raw':!![]})[_0xee28('0x27')](function(_0x1f6754){if(_0x1f6754&&_0x1f6754[_0xee28('0x4d')]===0x0){return db[_0xee28('0x2a')][_0xee28('0x49')]({'name':_0x5247fe[_0xee28('0x2d')],'resourceId':_0x5247fe['id'],'type':_0x1f6754[_0xee28('0x2d')],'sectionId':_0x1f6754['id']},{})[_0xee28('0x27')](function(){return _0x5e174f;});}else{return _0x5e174f;}})[_0xee28('0x43')](function(_0x10d393){logger['error'](_0xee28('0x4e'),_0x10d393);throw _0x10d393;});}return _0x5e174f;})[_0xee28('0x27')](respondWithResult(_0x2b5f36,0xc9))[_0xee28('0x43')](handleError(_0x2b5f36,null));};exports['update']=function(_0x5b9ced,_0x57d865){if(_0x5b9ced['body']['id']){delete _0x5b9ced[_0xee28('0x4f')]['id'];}return db[_0xee28('0x31')][_0xee28('0x48')]({'where':{'id':_0x5b9ced['params']['id']}})[_0xee28('0x27')](handleEntityNotFound(_0x57d865,null))[_0xee28('0x27')](saveUpdates(_0x5b9ced[_0xee28('0x4f')],null))[_0xee28('0x27')](respondWithResult(_0x57d865,null))[_0xee28('0x43')](handleError(_0x57d865,null));};exports['destroy']=function(_0x2a5da9,_0x1c6696){return db[_0xee28('0x31')]['find']({'where':{'id':_0x2a5da9[_0xee28('0x50')]['id']}})[_0xee28('0x27')](handleEntityNotFound(_0x1c6696,null))[_0xee28('0x27')](removeEntity(_0x1c6696,null))[_0xee28('0x43')](handleError(_0x1c6696,null));}; \ No newline at end of file +var _0xf874=['ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','ChanSpies','UserProfileResource','error','stack','name','index','VoiceChanSpy','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','findAll','show','length','include','options','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x388c94,_0x53e4a0){var _0x26bf41=function(_0x471a68){while(--_0x471a68){_0x388c94['push'](_0x388c94['shift']());}};_0x26bf41(++_0x53e4a0);}(_0xf874,0xed));var _0x4f87=function(_0x579c1a,_0x5c5701){_0x579c1a=_0x579c1a-0x0;var _0x3e00ca=_0xf874[_0x579c1a];return _0x3e00ca;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4f87('0x0'));var jsonpatch=require(_0x4f87('0x1'));var rp=require(_0x4f87('0x2'));var moment=require(_0x4f87('0x3'));var BPromise=require(_0x4f87('0x4'));var Mustache=require(_0x4f87('0x5'));var util=require('util');var path=require(_0x4f87('0x6'));var sox=require(_0x4f87('0x7'));var csv=require(_0x4f87('0x8'));var ejs=require(_0x4f87('0x9'));var fs=require('fs');var fs_extra=require(_0x4f87('0xa'));var _=require(_0x4f87('0xb'));var squel=require('squel');var crypto=require(_0x4f87('0xc'));var jsforce=require(_0x4f87('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4f87('0x8'));var querystring=require(_0x4f87('0xe'));var Papa=require('papaparse');var Redis=require(_0x4f87('0xf'));var authService=require(_0x4f87('0x10'));var qs=require(_0x4f87('0x11'));var as=require(_0x4f87('0x12'));var hardwareService=require(_0x4f87('0x13'));var logger=require(_0x4f87('0x14'))(_0x4f87('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4f87('0x16'));var db=require(_0x4f87('0x17'))['db'];function respondWithStatusCode(_0x107d98,_0x5e6d04){_0x5e6d04=_0x5e6d04||0xcc;return function(_0x4ebb6a){if(_0x4ebb6a){return _0x107d98[_0x4f87('0x18')](_0x5e6d04);}return _0x107d98[_0x4f87('0x19')](_0x5e6d04)[_0x4f87('0x1a')]();};}function respondWithResult(_0x482c6e,_0x2f11d2){_0x2f11d2=_0x2f11d2||0xc8;return function(_0x4a0e2f){if(_0x4a0e2f){return _0x482c6e[_0x4f87('0x19')](_0x2f11d2)[_0x4f87('0x1b')](_0x4a0e2f);}};}function respondWithFilteredResult(_0x4ea72f,_0x2907f6){return function(_0x325edc){if(_0x325edc){var _0xa47360=typeof _0x2907f6[_0x4f87('0x1c')]===_0x4f87('0x1d')&&typeof _0x2907f6[_0x4f87('0x1e')]==='undefined';var _0x3571be=_0x325edc['count'];var _0x10551e=_0xa47360?0x0:_0x2907f6[_0x4f87('0x1c')];var _0x46492d=_0xa47360?_0x325edc[_0x4f87('0x1f')]:_0x2907f6[_0x4f87('0x1c')]+_0x2907f6[_0x4f87('0x1e')];var _0x36cd37;if(_0x46492d>=_0x3571be){_0x46492d=_0x3571be;_0x36cd37=0xc8;}else{_0x36cd37=0xce;}_0x4ea72f[_0x4f87('0x19')](_0x36cd37);return _0x4ea72f[_0x4f87('0x20')](_0x4f87('0x21'),_0x10551e+'-'+_0x46492d+'/'+_0x3571be)[_0x4f87('0x1b')](_0x325edc);}return null;};}function patchUpdates(_0x2c13a0){return function(_0x17d5f8){try{jsonpatch['apply'](_0x17d5f8,_0x2c13a0,!![]);}catch(_0x47ed1e){return BPromise[_0x4f87('0x22')](_0x47ed1e);}return _0x17d5f8[_0x4f87('0x23')]();};}function saveUpdates(_0x5bc73b,_0x592edd){return function(_0x30636d){if(_0x30636d){return _0x30636d['update'](_0x5bc73b)['then'](function(_0x401cd6){return _0x401cd6;});}return null;};}function removeEntity(_0x3c4450,_0x2a382c){return function(_0x3cf180){if(_0x3cf180){return _0x3cf180[_0x4f87('0x24')]()[_0x4f87('0x25')](function(){var _0x197f44=_0x3cf180['get']({'plain':!![]});var _0x234106=_0x4f87('0x26');return db[_0x4f87('0x27')]['destroy']({'where':{'type':_0x234106,'resourceId':_0x197f44['id']}})[_0x4f87('0x25')](function(){return _0x3cf180;});})[_0x4f87('0x25')](function(){_0x3c4450['status'](0xcc)[_0x4f87('0x1a')]();});}};}function handleEntityNotFound(_0xe299f1,_0x3eab48){return function(_0x41e940){if(!_0x41e940){_0xe299f1['sendStatus'](0x194);}return _0x41e940;};}function handleError(_0x4f60dc,_0x2ed28d){_0x2ed28d=_0x2ed28d||0x1f4;return function(_0x208f0a){logger[_0x4f87('0x28')](_0x208f0a[_0x4f87('0x29')]);if(_0x208f0a[_0x4f87('0x2a')]){delete _0x208f0a['name'];}_0x4f60dc[_0x4f87('0x19')](_0x2ed28d)['send'](_0x208f0a);};}exports[_0x4f87('0x2b')]=function(_0x8f847e,_0x149a5b){var _0x430cf9={},_0x3e04ce={},_0x23e54a={'count':0x0,'rows':[]};var _0xaa4ba4=_['map'](db[_0x4f87('0x2c')]['rawAttributes'],function(_0x1d3bec){return{'name':_0x1d3bec[_0x4f87('0x2d')],'type':_0x1d3bec[_0x4f87('0x2e')][_0x4f87('0x2f')]};});_0x3e04ce[_0x4f87('0x30')]=_[_0x4f87('0x31')](_0xaa4ba4,_0x4f87('0x2a'));_0x3e04ce[_0x4f87('0x32')]=_[_0x4f87('0x33')](_0x8f847e[_0x4f87('0x32')]);_0x3e04ce[_0x4f87('0x34')]=_[_0x4f87('0x35')](_0x3e04ce['model'],_0x3e04ce[_0x4f87('0x32')]);_0x430cf9[_0x4f87('0x36')]=_['intersection'](_0x3e04ce[_0x4f87('0x30')],qs[_0x4f87('0x37')](_0x8f847e[_0x4f87('0x32')]['fields']));_0x430cf9[_0x4f87('0x36')]=_0x430cf9[_0x4f87('0x36')]['length']?_0x430cf9[_0x4f87('0x36')]:_0x3e04ce['model'];if(!_0x8f847e[_0x4f87('0x32')][_0x4f87('0x38')](_0x4f87('0x39'))){_0x430cf9['limit']=qs[_0x4f87('0x1e')](_0x8f847e['query']['limit']);_0x430cf9[_0x4f87('0x1c')]=qs[_0x4f87('0x1c')](_0x8f847e['query'][_0x4f87('0x1c')]);}_0x430cf9[_0x4f87('0x3a')]=qs[_0x4f87('0x3b')](_0x8f847e[_0x4f87('0x32')]['sort']);_0x430cf9['where']=qs['filters'](_['pick'](_0x8f847e[_0x4f87('0x32')],_0x3e04ce[_0x4f87('0x34')]),_0xaa4ba4);if(_0x8f847e['query'][_0x4f87('0x3c')]){_0x430cf9[_0x4f87('0x3d')]=_[_0x4f87('0x3e')](_0x430cf9[_0x4f87('0x3d')],{'$or':_[_0x4f87('0x31')](_0xaa4ba4,function(_0x42bf41){if(_0x42bf41['type']!==_0x4f87('0x3f')){var _0x4bae2d={};_0x4bae2d[_0x42bf41['name']]={'$like':'%'+_0x8f847e[_0x4f87('0x32')][_0x4f87('0x3c')]+'%'};return _0x4bae2d;}})});}_0x430cf9=_[_0x4f87('0x3e')]({},_0x430cf9,_0x8f847e['options']);var _0x1d6415={'where':_0x430cf9[_0x4f87('0x3d')]};return db['VoiceChanSpy'][_0x4f87('0x1f')](_0x1d6415)[_0x4f87('0x25')](function(_0x3ae242){_0x23e54a[_0x4f87('0x1f')]=_0x3ae242;if(_0x8f847e[_0x4f87('0x32')][_0x4f87('0x40')]){_0x430cf9['include']=[{'all':!![]}];}return db[_0x4f87('0x2c')][_0x4f87('0x41')](_0x430cf9);})[_0x4f87('0x25')](function(_0x29c7c5){_0x23e54a['rows']=_0x29c7c5;return _0x23e54a;})[_0x4f87('0x25')](respondWithFilteredResult(_0x149a5b,_0x430cf9))['catch'](handleError(_0x149a5b,null));};exports[_0x4f87('0x42')]=function(_0x28f049,_0x3afdcb){var _0x1610f1={'raw':![],'where':{'id':_0x28f049['params']['id']}},_0x58f2db={};_0x58f2db['model']=_['keys'](db['VoiceChanSpy']['rawAttributes']);_0x58f2db[_0x4f87('0x32')]=_[_0x4f87('0x33')](_0x28f049[_0x4f87('0x32')]);_0x58f2db[_0x4f87('0x34')]=_[_0x4f87('0x35')](_0x58f2db[_0x4f87('0x30')],_0x58f2db[_0x4f87('0x32')]);_0x1610f1[_0x4f87('0x36')]=_['intersection'](_0x58f2db[_0x4f87('0x30')],qs[_0x4f87('0x37')](_0x28f049[_0x4f87('0x32')][_0x4f87('0x37')]));_0x1610f1[_0x4f87('0x36')]=_0x1610f1[_0x4f87('0x36')][_0x4f87('0x43')]?_0x1610f1[_0x4f87('0x36')]:_0x58f2db[_0x4f87('0x30')];if(_0x28f049[_0x4f87('0x32')][_0x4f87('0x40')]){_0x1610f1[_0x4f87('0x44')]=[{'all':!![]}];}_0x1610f1=_[_0x4f87('0x3e')]({},_0x1610f1,_0x28f049[_0x4f87('0x45')]);return db[_0x4f87('0x2c')][_0x4f87('0x46')](_0x1610f1)[_0x4f87('0x25')](handleEntityNotFound(_0x3afdcb,null))['then'](respondWithResult(_0x3afdcb,null))[_0x4f87('0x47')](handleError(_0x3afdcb,null));};exports['create']=function(_0x59a7ce,_0x3e7383){return db[_0x4f87('0x2c')][_0x4f87('0x48')](_0x59a7ce[_0x4f87('0x49')],{})[_0x4f87('0x25')](function(_0x1e29dc){var _0x221c14=_0x59a7ce[_0x4f87('0x4a')][_0x4f87('0x4b')]({'plain':!![]});if(!_0x221c14)throw new Error(_0x4f87('0x4c'));if(_0x221c14['role']==='user'){var _0x2b9af9=_0x1e29dc[_0x4f87('0x4b')]({'plain':!![]});var _0xb34275='ChanSpies';return db['UserProfileSection'][_0x4f87('0x46')]({'where':{'name':_0xb34275,'userProfileId':_0x221c14[_0x4f87('0x4d')]},'raw':!![]})[_0x4f87('0x25')](function(_0xc81d81){if(_0xc81d81&&_0xc81d81[_0x4f87('0x4e')]===0x0){return db[_0x4f87('0x27')]['create']({'name':_0x2b9af9[_0x4f87('0x2a')],'resourceId':_0x2b9af9['id'],'type':_0xc81d81['name'],'sectionId':_0xc81d81['id']},{})[_0x4f87('0x25')](function(){return _0x1e29dc;});}else{return _0x1e29dc;}})['catch'](function(_0x225c5c){logger[_0x4f87('0x28')](_0x4f87('0x4f'),_0x225c5c);throw _0x225c5c;});}return _0x1e29dc;})[_0x4f87('0x25')](respondWithResult(_0x3e7383,0xc9))[_0x4f87('0x47')](handleError(_0x3e7383,null));};exports[_0x4f87('0x50')]=function(_0x22c389,_0x526c78){if(_0x22c389[_0x4f87('0x49')]['id']){delete _0x22c389[_0x4f87('0x49')]['id'];}return db[_0x4f87('0x2c')]['find']({'where':{'id':_0x22c389[_0x4f87('0x51')]['id']}})['then'](handleEntityNotFound(_0x526c78,null))[_0x4f87('0x25')](saveUpdates(_0x22c389[_0x4f87('0x49')],null))[_0x4f87('0x25')](respondWithResult(_0x526c78,null))[_0x4f87('0x47')](handleError(_0x526c78,null));};exports[_0x4f87('0x24')]=function(_0x51ee0e,_0x16e323){return db[_0x4f87('0x2c')]['find']({'where':{'id':_0x51ee0e[_0x4f87('0x51')]['id']}})[_0x4f87('0x25')](handleEntityNotFound(_0x16e323,null))[_0x4f87('0x25')](removeEntity(_0x16e323,null))[_0x4f87('0x47')](handleError(_0x16e323,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index b143095..f2ed7e7 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 _0x5965=['VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','SIP/%s,%s','options','StopMixMonitor','length','internal','concat','name','findAll','agent','then','catch','define','VoiceChanSpy','voice_chanspy'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x5965,0xf8));var _0x5596=function(_0xb2d229,_0x5ba299){_0xb2d229=_0xb2d229-0x0;var _0xc342d6=_0x5965[_0xb2d229];return _0xc342d6;};'use strict';var _=require(_0x5596('0x0'));var util=require(_0x5596('0x1'));var BPromise=require(_0x5596('0x2'));var attributes=require(_0x5596('0x3'));var getUserApplications=function(_0x55ecc0,_0x3bb1b7,_0x45451f){var _0xff09c6=0x1;var _0x33bf7b=[];var _0x2b9ea9={'context':_0x3bb1b7['context']||'from-sip','exten':util[_0x5596('0x4')](_0x5596('0x5'),_0x55ecc0[_0x5596('0x6')],_0x45451f),'type':_0x5596('0x7'),'isApp':![],'ChanSpyId':_0x55ecc0['id'],'UserId':_0x3bb1b7['id']};_0x33bf7b[_0x5596('0x8')](_[_0x5596('0x9')]({'app':_0x5596('0xa'),'appdata':util[_0x5596('0x4')](_0x5596('0xb'),_0x5596('0xc')),'priority':_0xff09c6++},_0x2b9ea9));if(_0x55ecc0[_0x5596('0xd')]){_0x33bf7b[_0x5596('0x8')](_[_0x5596('0x9')]({'app':_0x5596('0xe'),'appdata':util[_0x5596('0x4')](_0x5596('0xf'),_0x55ecc0[_0x5596('0x10')]),'priority':_0xff09c6++},_0x2b9ea9));}if(_0x55ecc0['auth']){_0x33bf7b[_0x5596('0x8')](_[_0x5596('0x9')]({'app':_0x5596('0x11'),'appdata':_0x55ecc0['password'],'priority':_0xff09c6++},_0x2b9ea9));}_0x33bf7b[_0x5596('0x8')](_['merge']({'app':'ChanSpy','appdata':util[_0x5596('0x4')](_0x5596('0x12'),_0x3bb1b7['name'],_0x55ecc0[_0x5596('0x13')]?_0x55ecc0[_0x5596('0x13')]['join'](''):''),'priority':_0xff09c6++},_0x2b9ea9));if(_0x55ecc0[_0x5596('0xd')]){_0x33bf7b['push'](_[_0x5596('0x9')]({'app':_0x5596('0x14'),'priority':_0xff09c6++},_0x2b9ea9));}return _0x33bf7b;};var getChanSpyApplications=function(_0x141bd5,_0x49939f){var _0x27924d=[];for(var _0x30eac7=0x0,_0x44d31a=0x1;_0x30eac7<_0x49939f[_0x5596('0x15')];_0x30eac7++,_0x44d31a=0x1){_0x27924d=_0x27924d['concat'](getUserApplications(_0x141bd5,_0x49939f[_0x30eac7],_0x49939f[_0x30eac7][_0x5596('0x16')]));if(_0x49939f[_0x30eac7][_0x5596('0x16')]!=_0x49939f[_0x30eac7]['name']){_0x27924d=_0x27924d[_0x5596('0x17')](getUserApplications(_0x141bd5,_0x49939f[_0x30eac7],_0x49939f[_0x30eac7][_0x5596('0x18')]));}}return _0x27924d;};var getChanSpyPromise=function(_0x12cca3,_0x17091f){return new BPromise(function(_0x1ab6c4,_0x32b340){return _0x12cca3['User'][_0x5596('0x19')]({'attributes':['id','name','internal'],'where':{'role':_0x5596('0x1a'),'chanspy':!![]},'raw':!![]})[_0x5596('0x1b')](function(_0x4256c2){if(_0x4256c2){return _0x1ab6c4(getChanSpyApplications(_0x17091f,_0x4256c2));}return _0x1ab6c4([]);})[_0x5596('0x1c')](function(_0x5af011){_0x32b340(_0x5af011);});});};module['exports']=function(_0x14bd56,_0x1e9338){var _0x529cba=_0x14bd56['models'];return _0x14bd56[_0x5596('0x1d')](_0x5596('0x1e'),attributes,{'tableName':_0x5596('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x52d0f0,_0x359c95,_0x5dc08){return getChanSpyPromise(_0x529cba,_0x52d0f0)[_0x5596('0x1b')](function(_0x15daa5){if(_0x15daa5&&_0x15daa5[_0x5596('0x15')]){return _0x529cba[_0x5596('0x20')][_0x5596('0x21')](_0x15daa5);}})[_0x5596('0x1b')](function(){_0x5dc08();})[_0x5596('0x1c')](function(_0x5ed188){_0x5dc08(_0x5ed188);});},'afterUpdate':function(_0x5c2a2d,_0x31068a,_0x3bda78){return _0x529cba[_0x5596('0x20')][_0x5596('0x22')]({'where':{'ChanSpyId':_0x5c2a2d['id']}})[_0x5596('0x1b')](function(){return getChanSpyPromise(_0x529cba,_0x5c2a2d);})[_0x5596('0x1b')](function(_0x2d80d4){if(_0x2d80d4&&_0x2d80d4[_0x5596('0x15')]){return _0x529cba[_0x5596('0x20')]['bulkCreate'](_0x2d80d4);}})[_0x5596('0x1b')](function(){_0x3bda78();})['catch'](function(_0x21549a){_0x3bda78(_0x21549a);});},'afterDestroy':function(_0x17ae7b,_0x578aab,_0x4aa868){return _0x529cba[_0x5596('0x20')][_0x5596('0x22')]({'where':{'ChanSpyId':_0x17ae7b['id']}})[_0x5596('0x1b')](function(){_0x4aa868();})[_0x5596('0x1c')](function(_0x50083d){_0x4aa868(_0x50083d);});}}});}; \ No newline at end of file +var _0xede8=['exports','models','define','voice_chanspy','VoiceExtension','bulkCreate','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','merge','Set','CDR(type)=%s','MixMonitor','${UNIQUEID}.%s,a','Authenticate','password','push','ChanSpy','name','options','join','record','StopMixMonitor','length','internal','concat','findAll','agent','then','catch'];(function(_0x475335,_0x4012a8){var _0x5c5387=function(_0x264014){while(--_0x264014){_0x475335['push'](_0x475335['shift']());}};_0x5c5387(++_0x4012a8);}(_0xede8,0x72));var _0x8ede=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xede8[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x8ede('0x0'));var util=require('util');var BPromise=require(_0x8ede('0x1'));var attributes=require(_0x8ede('0x2'));var getUserApplications=function(_0x2cff3e,_0x978b15,_0x5bb0aa){var _0x1e5595=0x1;var _0x2a3809=[];var _0x34e0d3={'context':_0x978b15[_0x8ede('0x3')]||_0x8ede('0x4'),'exten':util[_0x8ede('0x5')](_0x8ede('0x6'),_0x2cff3e[_0x8ede('0x7')],_0x5bb0aa),'type':_0x8ede('0x8'),'isApp':![],'ChanSpyId':_0x2cff3e['id'],'UserId':_0x978b15['id']};_0x2a3809['push'](_[_0x8ede('0x9')]({'app':_0x8ede('0xa'),'appdata':util['format'](_0x8ede('0xb'),'chanspy'),'priority':_0x1e5595++},_0x34e0d3));if(_0x2cff3e['record']){_0x2a3809['push'](_[_0x8ede('0x9')]({'app':_0x8ede('0xc'),'appdata':util['format'](_0x8ede('0xd'),_0x2cff3e['recordingFormat']),'priority':_0x1e5595++},_0x34e0d3));}if(_0x2cff3e['auth']){_0x2a3809['push'](_[_0x8ede('0x9')]({'app':_0x8ede('0xe'),'appdata':_0x2cff3e[_0x8ede('0xf')],'priority':_0x1e5595++},_0x34e0d3));}_0x2a3809[_0x8ede('0x10')](_[_0x8ede('0x9')]({'app':_0x8ede('0x11'),'appdata':util[_0x8ede('0x5')]('SIP/%s,%s',_0x978b15[_0x8ede('0x12')],_0x2cff3e[_0x8ede('0x13')]?_0x2cff3e[_0x8ede('0x13')][_0x8ede('0x14')](''):''),'priority':_0x1e5595++},_0x34e0d3));if(_0x2cff3e[_0x8ede('0x15')]){_0x2a3809['push'](_[_0x8ede('0x9')]({'app':_0x8ede('0x16'),'priority':_0x1e5595++},_0x34e0d3));}return _0x2a3809;};var getChanSpyApplications=function(_0xe23cfb,_0x3515c9){var _0x25c6e=[];for(var _0x13c0fa=0x0,_0x4ea66f=0x1;_0x13c0fa<_0x3515c9[_0x8ede('0x17')];_0x13c0fa++,_0x4ea66f=0x1){_0x25c6e=_0x25c6e['concat'](getUserApplications(_0xe23cfb,_0x3515c9[_0x13c0fa],_0x3515c9[_0x13c0fa][_0x8ede('0x18')]));if(_0x3515c9[_0x13c0fa][_0x8ede('0x18')]!=_0x3515c9[_0x13c0fa][_0x8ede('0x12')]){_0x25c6e=_0x25c6e[_0x8ede('0x19')](getUserApplications(_0xe23cfb,_0x3515c9[_0x13c0fa],_0x3515c9[_0x13c0fa][_0x8ede('0x12')]));}}return _0x25c6e;};var getChanSpyPromise=function(_0x17dca7,_0x298a58){return new BPromise(function(_0x1bd2d6,_0x373ff6){return _0x17dca7['User'][_0x8ede('0x1a')]({'attributes':['id','name','internal'],'where':{'role':_0x8ede('0x1b'),'chanspy':!![]},'raw':!![]})[_0x8ede('0x1c')](function(_0x2abddb){if(_0x2abddb){return _0x1bd2d6(getChanSpyApplications(_0x298a58,_0x2abddb));}return _0x1bd2d6([]);})[_0x8ede('0x1d')](function(_0x1692a0){_0x373ff6(_0x1692a0);});});};module[_0x8ede('0x1e')]=function(_0x240838,_0x412903){var _0x459dd1=_0x240838[_0x8ede('0x1f')];return _0x240838[_0x8ede('0x20')]('VoiceChanSpy',attributes,{'tableName':_0x8ede('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a93eb,_0x5b17aa,_0x2d17d1){return getChanSpyPromise(_0x459dd1,_0x2a93eb)[_0x8ede('0x1c')](function(_0x3f0469){if(_0x3f0469&&_0x3f0469[_0x8ede('0x17')]){return _0x459dd1[_0x8ede('0x22')]['bulkCreate'](_0x3f0469);}})[_0x8ede('0x1c')](function(){_0x2d17d1();})['catch'](function(_0x48ec5f){_0x2d17d1(_0x48ec5f);});},'afterUpdate':function(_0x589793,_0x4690c6,_0x50aaf1){return _0x459dd1[_0x8ede('0x22')]['destroy']({'where':{'ChanSpyId':_0x589793['id']}})['then'](function(){return getChanSpyPromise(_0x459dd1,_0x589793);})['then'](function(_0x4d6354){if(_0x4d6354&&_0x4d6354[_0x8ede('0x17')]){return _0x459dd1[_0x8ede('0x22')][_0x8ede('0x23')](_0x4d6354);}})[_0x8ede('0x1c')](function(){_0x50aaf1();})['catch'](function(_0xf3b1d4){_0x50aaf1(_0xf3b1d4);});},'afterDestroy':function(_0x4777b6,_0x1f0021,_0x54e216){return _0x459dd1[_0x8ede('0x22')]['destroy']({'where':{'ChanSpyId':_0x4777b6['id']}})[_0x8ede('0x1c')](function(){_0x54e216();})[_0x8ede('0x1d')](function(_0x51f81c){_0x54e216(_0x51f81c);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 4a1f688..380a225 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 _0xc788=['request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','message','VoiceChanSpy,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x503306,_0x356f2f){var _0x44a99d=function(_0x1a6ec4){while(--_0x1a6ec4){_0x503306['push'](_0x503306['shift']());}};_0x44a99d(++_0x356f2f);}(_0xc788,0xc4));var _0x8c78=function(_0x4be774,_0x5b2d48){_0x4be774=_0x4be774-0x0;var _0x31d1c9=_0xc788[_0x4be774];return _0x31d1c9;};'use strict';var _=require(_0x8c78('0x0'));var util=require(_0x8c78('0x1'));var moment=require(_0x8c78('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c78('0x3'));var db=require(_0x8c78('0x4'))['db'];var utils=require(_0x8c78('0x5'));var logger=require(_0x8c78('0x6'))(_0x8c78('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c78('0x8'));var client=jayson[_0x8c78('0x9')][_0x8c78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ac27f,_0x205cc1,_0x4d54a5){return new BPromise(function(_0x247188,_0x299d9d){return client[_0x8c78('0xb')](_0x1ac27f,_0x4d54a5)[_0x8c78('0xc')](function(_0xdb0c17){logger[_0x8c78('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));logger['debug'](_0x8c78('0xf'),_0x205cc1,_0x8c78('0xe'),JSON['stringify'](_0xdb0c17));if(_0xdb0c17[_0x8c78('0x10')]){if(_0xdb0c17[_0x8c78('0x10')]['code']===0x1f4){logger[_0x8c78('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x205cc1,_0xdb0c17['error'][_0x8c78('0x11')]);return _0x299d9d(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);return _0x247188(_0xdb0c17[_0x8c78('0x10')][_0x8c78('0x11')]);}else{logger[_0x8c78('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x205cc1,_0x8c78('0xe'));_0x247188(_0xdb0c17[_0x8c78('0x13')]['message']);}})[_0x8c78('0x14')](function(_0x554464){logger[_0x8c78('0x10')](_0x8c78('0x12'),_0x205cc1,_0x554464);_0x299d9d(_0x554464);});});} \ No newline at end of file +var _0xeb74=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x5b6a1c,_0x306ac9){var _0x1f6c3f=function(_0x5d461a){while(--_0x5d461a){_0x5b6a1c['push'](_0x5b6a1c['shift']());}};_0x1f6c3f(++_0x306ac9);}(_0xeb74,0xe3));var _0x4eb7=function(_0x598e71,_0x50f23b){_0x598e71=_0x598e71-0x0;var _0x1c4ef0=_0xeb74[_0x598e71];return _0x1c4ef0;};'use strict';var _=require(_0x4eb7('0x0'));var util=require(_0x4eb7('0x1'));var moment=require(_0x4eb7('0x2'));var BPromise=require(_0x4eb7('0x3'));var rs=require(_0x4eb7('0x4'));var fs=require('fs');var Redis=require(_0x4eb7('0x5'));var db=require(_0x4eb7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eb7('0x7'))(_0x4eb7('0x8'));var config=require(_0x4eb7('0x9'));var jayson=require(_0x4eb7('0xa'));var client=jayson[_0x4eb7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3986cd,_0x54859c,_0xcac7c5){return new BPromise(function(_0x2cffe7,_0x588a1c){return client['request'](_0x3986cd,_0xcac7c5)[_0x4eb7('0xc')](function(_0x2f8296){logger['info'](_0x4eb7('0xd'),_0x54859c,'request\x20sent');logger[_0x4eb7('0xe')](_0x4eb7('0xf'),_0x54859c,_0x4eb7('0x10'),JSON['stringify'](_0x2f8296));if(_0x2f8296[_0x4eb7('0x11')]){if(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x12')]===0x1f4){logger[_0x4eb7('0x11')](_0x4eb7('0xd'),_0x54859c,_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);return _0x588a1c(_0x2f8296['error']['message']);}logger['error'](_0x4eb7('0xd'),_0x54859c,_0x2f8296['error'][_0x4eb7('0x13')]);return _0x2cffe7(_0x2f8296[_0x4eb7('0x11')][_0x4eb7('0x13')]);}else{logger[_0x4eb7('0x14')](_0x4eb7('0xd'),_0x54859c,_0x4eb7('0x10'));_0x2cffe7(_0x2f8296[_0x4eb7('0x15')][_0x4eb7('0x13')]);}})[_0x4eb7('0x16')](function(_0x17377f){logger['error'](_0x4eb7('0xd'),_0x54859c,_0x17377f);_0x588a1c(_0x17377f);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index c74f93c..cdad84e 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 _0x95bc=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','get','/:id','isAuthenticated','update','exports','path'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0x95bc,0xd7));var _0xc95b=function(_0x387c7b,_0x82dd58){_0x387c7b=_0x387c7b-0x0;var _0x12e5e5=_0x95bc[_0x387c7b];return _0x12e5e5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc95b('0x0'));var timeout=require('connect-timeout');var express=require(_0xc95b('0x1'));var router=express[_0xc95b('0x2')]();var fs_extra=require(_0xc95b('0x3'));var auth=require(_0xc95b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc95b('0x5'));var controller=require(_0xc95b('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc95b('0x7')](_0xc95b('0x8'),auth[_0xc95b('0x9')](),controller['show']);router['post']('/',auth[_0xc95b('0x9')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc95b('0xa')]);router['delete'](_0xc95b('0x8'),auth[_0xc95b('0x9')](),controller['destroy']);module[_0xc95b('0xb')]=router; \ No newline at end of file +var _0xd7ab=['index','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get'];(function(_0x2d17dc,_0x3102c1){var _0x234bba=function(_0x214a62){while(--_0x214a62){_0x2d17dc['push'](_0x2d17dc['shift']());}};_0x234bba(++_0x3102c1);}(_0xd7ab,0xa2));var _0xbd7a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd7ab[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0xbd7a('0x0'));var path=require(_0xbd7a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbd7a('0x2')]();var fs_extra=require(_0xbd7a('0x3'));var auth=require(_0xbd7a('0x4'));var interaction=require(_0xbd7a('0x5'));var config=require(_0xbd7a('0x6'));var controller=require(_0xbd7a('0x7'));router[_0xbd7a('0x8')]('/',auth['isAuthenticated'](),controller[_0xbd7a('0x9')]);router[_0xbd7a('0x8')](_0xbd7a('0xa'),auth[_0xbd7a('0xb')](),controller[_0xbd7a('0xc')]);router[_0xbd7a('0xd')]('/',auth[_0xbd7a('0xb')](),controller[_0xbd7a('0xe')]);router['put'](_0xbd7a('0xa'),auth[_0xbd7a('0xb')](),controller[_0xbd7a('0xf')]);router[_0xbd7a('0x10')](_0xbd7a('0xa'),auth['isAuthenticated'](),controller[_0xbd7a('0x11')]);module[_0xbd7a('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 2a3c40b..f6b8ea2 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 _0xbe62=['exports','STRING','BOOLEAN'];(function(_0xb7301f,_0x1dee15){var _0x56bb95=function(_0x23da8c){while(--_0x23da8c){_0xb7301f['push'](_0xb7301f['shift']());}};_0x56bb95(++_0x1dee15);}(_0xbe62,0x8d));var _0x2be6=function(_0x134a3a,_0x49ceae){_0x134a3a=_0x134a3a-0x0;var _0xe4337f=_0xbe62[_0x134a3a];return _0xe4337f;};'use strict';var Sequelize=require('sequelize');module[_0x2be6('0x0')]={'name':{'type':Sequelize[_0x2be6('0x1')],'unique':'name'},'description':{'type':Sequelize[_0x2be6('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x2be6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x585c=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x56cee8,_0x594a41){var _0x349979=function(_0x184411){while(--_0x184411){_0x56cee8['push'](_0x56cee8['shift']());}};_0x349979(++_0x594a41);}(_0x585c,0xe6));var _0xc585=function(_0x593c84,_0x2dcc2a){_0x593c84=_0x593c84-0x0;var _0x2c939d=_0x585c[_0x593c84];return _0x2c939d;};'use strict';var Sequelize=require(_0xc585('0x0'));module[_0xc585('0x1')]={'name':{'type':Sequelize[_0xc585('0x2')],'unique':_0xc585('0x3')},'description':{'type':Sequelize[_0xc585('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xc585('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 0c93299..8f92a03 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 _0xe4b9=['result','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','name','map','VoiceContext','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0xe4b9,0x176));var _0x9e4b=function(_0x16803d,_0x2d35fa){_0x16803d=_0x16803d-0x0;var _0x47bd54=_0xe4b9[_0x16803d];return _0x47bd54;};'use strict';var emlformat=require(_0x9e4b('0x0'));var rimraf=require(_0x9e4b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9e4b('0x2'));var rp=require(_0x9e4b('0x3'));var moment=require('moment');var BPromise=require(_0x9e4b('0x4'));var Mustache=require(_0x9e4b('0x5'));var util=require(_0x9e4b('0x6'));var path=require(_0x9e4b('0x7'));var sox=require(_0x9e4b('0x8'));var csv=require(_0x9e4b('0x9'));var ejs=require(_0x9e4b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9e4b('0xb'));var squel=require('squel');var crypto=require(_0x9e4b('0xc'));var jsforce=require(_0x9e4b('0xd'));var deskjs=require(_0x9e4b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9e4b('0xf'));var Papa=require(_0x9e4b('0x10'));var Redis=require('ioredis');var authService=require(_0x9e4b('0x11'));var qs=require(_0x9e4b('0x12'));var as=require(_0x9e4b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e4b('0x14'))(_0x9e4b('0x15'));var utils=require(_0x9e4b('0x16'));var config=require(_0x9e4b('0x17'));var licenseUtil=require(_0x9e4b('0x18'));var db=require(_0x9e4b('0x19'))['db'];var jayson=require(_0x9e4b('0x1a'));var client=jayson[_0x9e4b('0x1b')][_0x9e4b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x568842,_0x1f2f4e,_0x531b61,_0x3776c9){return new BPromise(function(_0x57d112,_0x1fa062){var _0x823705=_0x3776c9||client;return _0x823705['request'](_0x568842,_0x531b61)[_0x9e4b('0x1d')](function(_0x2909ab){logger[_0x9e4b('0x1e')](_0x9e4b('0x1f'),_0x1f2f4e,_0x9e4b('0x20'));logger[_0x9e4b('0x21')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1f2f4e,'request\x20sent',JSON[_0x9e4b('0x22')](_0x2909ab));if(_0x2909ab[_0x9e4b('0x23')]){if(_0x2909ab['error'][_0x9e4b('0x24')]===0x1f4){logger[_0x9e4b('0x23')](_0x9e4b('0x1f'),_0x1f2f4e,_0x2909ab[_0x9e4b('0x23')]['message']);return _0x1fa062(_0x2909ab[_0x9e4b('0x23')][_0x9e4b('0x25')]);}logger[_0x9e4b('0x23')]('VoiceContext,\x20%s,\x20%s',_0x1f2f4e,_0x2909ab[_0x9e4b('0x23')]['message']);return _0x57d112(_0x2909ab['error']['message']);}else{logger[_0x9e4b('0x1e')](_0x9e4b('0x1f'),_0x1f2f4e,'request\x20sent');_0x57d112(_0x2909ab[_0x9e4b('0x26')][_0x9e4b('0x25')]);}})['catch'](function(_0x500d98){logger[_0x9e4b('0x23')](_0x9e4b('0x1f'),_0x1f2f4e,_0x500d98);_0x1fa062(_0x500d98);});});}function respondWithStatusCode(_0x340fcd,_0x5a9424){_0x5a9424=_0x5a9424||0xcc;return function(_0x127ad0){if(_0x127ad0){return _0x340fcd[_0x9e4b('0x27')](_0x5a9424);}return _0x340fcd['status'](_0x5a9424)[_0x9e4b('0x28')]();};}function respondWithResult(_0xddd5b,_0xbe4d25){_0xbe4d25=_0xbe4d25||0xc8;return function(_0x395519){if(_0x395519){return _0xddd5b[_0x9e4b('0x29')](_0xbe4d25)[_0x9e4b('0x2a')](_0x395519);}};}function respondWithFilteredResult(_0x546c62,_0x2e9d8b){return function(_0x4e83b1){if(_0x4e83b1){var _0x856466=typeof _0x2e9d8b['offset']===_0x9e4b('0x2b')&&typeof _0x2e9d8b[_0x9e4b('0x2c')]===_0x9e4b('0x2b');var _0x4d489d=_0x4e83b1[_0x9e4b('0x2d')];var _0x543a8c=_0x856466?0x0:_0x2e9d8b[_0x9e4b('0x2e')];var _0x4b43c1=_0x856466?_0x4e83b1['count']:_0x2e9d8b[_0x9e4b('0x2e')]+_0x2e9d8b[_0x9e4b('0x2c')];var _0x4a1dd8;if(_0x4b43c1>=_0x4d489d){_0x4b43c1=_0x4d489d;_0x4a1dd8=0xc8;}else{_0x4a1dd8=0xce;}_0x546c62[_0x9e4b('0x29')](_0x4a1dd8);return _0x546c62[_0x9e4b('0x2f')](_0x9e4b('0x30'),_0x543a8c+'-'+_0x4b43c1+'/'+_0x4d489d)['json'](_0x4e83b1);}return null;};}function patchUpdates(_0x4bd236){return function(_0x334cb7){try{jsonpatch[_0x9e4b('0x31')](_0x334cb7,_0x4bd236,!![]);}catch(_0x246850){return BPromise[_0x9e4b('0x32')](_0x246850);}return _0x334cb7[_0x9e4b('0x33')]();};}function saveUpdates(_0x3ac0fe,_0x439ff3){return function(_0x16772d){if(_0x16772d){return _0x16772d[_0x9e4b('0x34')](_0x3ac0fe)['then'](function(_0x2ad0bc){return _0x2ad0bc;});}return null;};}function removeEntity(_0x2a4b04,_0x2bdeac){return function(_0x47ed8f){if(_0x47ed8f){return _0x47ed8f[_0x9e4b('0x35')]()[_0x9e4b('0x1d')](function(){var _0x200b9e=_0x47ed8f[_0x9e4b('0x36')]({'plain':!![]});var _0x2dca95=_0x9e4b('0x37');return db['UserProfileResource'][_0x9e4b('0x35')]({'where':{'type':_0x2dca95,'resourceId':_0x200b9e['id']}})[_0x9e4b('0x1d')](function(){return _0x47ed8f;});})[_0x9e4b('0x1d')](function(){_0x2a4b04['status'](0xcc)[_0x9e4b('0x28')]();});}};}function handleEntityNotFound(_0x349b55,_0x4b16ff){return function(_0x176d3d){if(!_0x176d3d){_0x349b55[_0x9e4b('0x27')](0x194);}return _0x176d3d;};}function handleError(_0x930723,_0x55c668){_0x55c668=_0x55c668||0x1f4;return function(_0x1cc3ac){logger[_0x9e4b('0x23')](_0x1cc3ac['stack']);if(_0x1cc3ac['name']){delete _0x1cc3ac[_0x9e4b('0x38')];}_0x930723[_0x9e4b('0x29')](_0x55c668)['send'](_0x1cc3ac);};}exports['index']=function(_0x1d1d5a,_0x4a2d28){var _0x2bf649={},_0x57c72a={},_0x5dbc71={'count':0x0,'rows':[]};var _0x3420d8=_[_0x9e4b('0x39')](db[_0x9e4b('0x3a')]['rawAttributes'],function(_0x1827ae){return{'name':_0x1827ae[_0x9e4b('0x3b')],'type':_0x1827ae['type'][_0x9e4b('0x3c')]};});_0x57c72a[_0x9e4b('0x3d')]=_[_0x9e4b('0x39')](_0x3420d8,_0x9e4b('0x38'));_0x57c72a[_0x9e4b('0x3e')]=_['keys'](_0x1d1d5a[_0x9e4b('0x3e')]);_0x57c72a['filters']=_[_0x9e4b('0x3f')](_0x57c72a[_0x9e4b('0x3d')],_0x57c72a[_0x9e4b('0x3e')]);_0x2bf649['attributes']=_[_0x9e4b('0x3f')](_0x57c72a[_0x9e4b('0x3d')],qs[_0x9e4b('0x40')](_0x1d1d5a[_0x9e4b('0x3e')][_0x9e4b('0x40')]));_0x2bf649[_0x9e4b('0x41')]=_0x2bf649[_0x9e4b('0x41')][_0x9e4b('0x42')]?_0x2bf649[_0x9e4b('0x41')]:_0x57c72a['model'];if(!_0x1d1d5a[_0x9e4b('0x3e')][_0x9e4b('0x43')]('nolimit')){_0x2bf649[_0x9e4b('0x2c')]=qs[_0x9e4b('0x2c')](_0x1d1d5a[_0x9e4b('0x3e')][_0x9e4b('0x2c')]);_0x2bf649['offset']=qs['offset'](_0x1d1d5a[_0x9e4b('0x3e')]['offset']);}_0x2bf649[_0x9e4b('0x44')]=qs[_0x9e4b('0x45')](_0x1d1d5a[_0x9e4b('0x3e')][_0x9e4b('0x45')]);_0x2bf649[_0x9e4b('0x46')]=qs[_0x9e4b('0x47')](_[_0x9e4b('0x48')](_0x1d1d5a['query'],_0x57c72a[_0x9e4b('0x47')]),_0x3420d8);if(_0x1d1d5a[_0x9e4b('0x3e')][_0x9e4b('0x49')]){_0x2bf649[_0x9e4b('0x46')]=_[_0x9e4b('0x4a')](_0x2bf649[_0x9e4b('0x46')],{'$or':_[_0x9e4b('0x39')](_0x3420d8,function(_0x14c39c){if(_0x14c39c['type']!==_0x9e4b('0x4b')){var _0xa4cef={};_0xa4cef[_0x14c39c[_0x9e4b('0x38')]]={'$like':'%'+_0x1d1d5a[_0x9e4b('0x3e')][_0x9e4b('0x49')]+'%'};return _0xa4cef;}})});}_0x2bf649=_[_0x9e4b('0x4a')]({},_0x2bf649,_0x1d1d5a['options']);var _0x1cf754={'where':_0x2bf649['where']};return db[_0x9e4b('0x3a')]['count'](_0x1cf754)[_0x9e4b('0x1d')](function(_0x3dea0d){_0x5dbc71['count']=_0x3dea0d;if(_0x1d1d5a[_0x9e4b('0x3e')][_0x9e4b('0x4c')]){_0x2bf649[_0x9e4b('0x4d')]=[{'all':!![]}];}return db['VoiceContext'][_0x9e4b('0x4e')](_0x2bf649);})[_0x9e4b('0x1d')](function(_0x3873d1){_0x5dbc71[_0x9e4b('0x4f')]=_0x3873d1;return _0x5dbc71;})[_0x9e4b('0x1d')](respondWithFilteredResult(_0x4a2d28,_0x2bf649))[_0x9e4b('0x50')](handleError(_0x4a2d28,null));};exports[_0x9e4b('0x51')]=function(_0x342d50,_0x182a56){var _0xb4621d={'raw':![],'where':{'id':_0x342d50[_0x9e4b('0x52')]['id']}},_0x2cdd44={};_0x2cdd44[_0x9e4b('0x3d')]=_[_0x9e4b('0x53')](db[_0x9e4b('0x3a')][_0x9e4b('0x54')]);_0x2cdd44[_0x9e4b('0x3e')]=_['keys'](_0x342d50[_0x9e4b('0x3e')]);_0x2cdd44['filters']=_[_0x9e4b('0x3f')](_0x2cdd44[_0x9e4b('0x3d')],_0x2cdd44[_0x9e4b('0x3e')]);_0xb4621d[_0x9e4b('0x41')]=_[_0x9e4b('0x3f')](_0x2cdd44[_0x9e4b('0x3d')],qs[_0x9e4b('0x40')](_0x342d50['query'][_0x9e4b('0x40')]));_0xb4621d['attributes']=_0xb4621d[_0x9e4b('0x41')][_0x9e4b('0x42')]?_0xb4621d['attributes']:_0x2cdd44[_0x9e4b('0x3d')];if(_0x342d50[_0x9e4b('0x3e')][_0x9e4b('0x4c')]){_0xb4621d['include']=[{'all':!![]}];}_0xb4621d=_['merge']({},_0xb4621d,_0x342d50[_0x9e4b('0x55')]);return db['VoiceContext']['find'](_0xb4621d)[_0x9e4b('0x1d')](handleEntityNotFound(_0x182a56,null))['then'](respondWithResult(_0x182a56,null))[_0x9e4b('0x50')](handleError(_0x182a56,null));};exports['create']=function(_0x28e695,_0x3c0681,_0x2b8190){var _0x2635ca;return db[_0x9e4b('0x3a')][_0x9e4b('0x56')](_0x28e695[_0x9e4b('0x57')],{'raw':!![]})['then'](function(_0x2c774c){_0x2635ca=_0x2c774c;return db[_0x9e4b('0x3a')][_0x9e4b('0x4e')]({'raw':!![]});})[_0x9e4b('0x1d')](function(_0x5286bc){var _0x420825=fs[_0x9e4b('0x58')](path[_0x9e4b('0x59')](config[_0x9e4b('0x5a')],_0x9e4b('0x5b')),_0x9e4b('0x5c'));var _0xa7c27b=ejs[_0x9e4b('0x5d')](_0x420825,{'contexts':_0x5286bc||[]});fs[_0x9e4b('0x5e')](_0x9e4b('0x5f'),_0xa7c27b);})[_0x9e4b('0x1d')](function(){return respondWithRpcPromise(_0x9e4b('0x60'),_0x9e4b('0x56'),{'module':_0x9e4b('0x61')});})[_0x9e4b('0x1d')](function(){var _0xe204aa=_0x28e695[_0x9e4b('0x62')][_0x9e4b('0x36')]({'plain':!![]});if(!_0xe204aa)throw new Error(_0x9e4b('0x63'));if(_0xe204aa['role']===_0x9e4b('0x62')){var _0x22cd4b=_0x2635ca['get']({'plain':!![]});return db['UserProfileSection'][_0x9e4b('0x64')]({'where':{'name':'Contexts','userProfileId':_0xe204aa[_0x9e4b('0x65')]},'raw':!![]})['then'](function(_0x15b29b){if(_0x15b29b&&_0x15b29b['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x22cd4b['name'],'resourceId':_0x22cd4b['id'],'type':_0x15b29b['name'],'sectionId':_0x15b29b['id']},{})['then'](function(){return _0x2635ca;});}else{return _0x2635ca;}})['catch'](function(_0x36c87b){logger[_0x9e4b('0x23')](_0x9e4b('0x66'),_0x36c87b);throw _0x36c87b;});}return _0x2635ca;})[_0x9e4b('0x1d')](respondWithResult(_0x3c0681,0xc9))['catch'](handleError(_0x3c0681,null));};exports[_0x9e4b('0x34')]=function(_0x370e10,_0x440c16,_0x3e5247){var _0x2e5ef3;return db[_0x9e4b('0x3a')][_0x9e4b('0x64')]({'where':{'id':_0x370e10['params']['id']}})[_0x9e4b('0x1d')](handleEntityNotFound(_0x440c16,null))['then'](saveUpdates(_0x370e10['body'],null))[_0x9e4b('0x1d')](function(_0x3545c7){if(_0x3545c7){_0x2e5ef3=_0x3545c7;return db[_0x9e4b('0x3a')][_0x9e4b('0x4e')]({'raw':!![]});}})['then'](function(_0x4de2f3){var _0x13bdf7=fs['readFileSync'](path[_0x9e4b('0x59')](config[_0x9e4b('0x5a')],_0x9e4b('0x5b')),_0x9e4b('0x5c'));var _0x4a52ed=ejs[_0x9e4b('0x5d')](_0x13bdf7,{'contexts':_0x4de2f3||[]});fs[_0x9e4b('0x5e')](_0x9e4b('0x5f'),_0x4a52ed);})['then'](function(){return respondWithRpcPromise(_0x9e4b('0x60'),_0x9e4b('0x34'),{'module':'chan_sip.so'});})[_0x9e4b('0x1d')](function(){return _0x2e5ef3;})['then'](respondWithResult(_0x440c16,null))[_0x9e4b('0x50')](handleError(_0x440c16,null));};exports['destroy']=function(_0x32b7ed,_0xd62c84,_0x4beb74){var _0x52f8f2;return db[_0x9e4b('0x3a')][_0x9e4b('0x64')]({'where':{'id':_0x32b7ed['params']['id']}})[_0x9e4b('0x1d')](handleEntityNotFound(_0xd62c84,null))['then'](removeEntity(_0xd62c84,null))[_0x9e4b('0x1d')](function(){return db[_0x9e4b('0x3a')]['findAll']({'raw':!![]});})[_0x9e4b('0x1d')](function(_0x1eda2e){var _0x313544=fs[_0x9e4b('0x58')](path[_0x9e4b('0x59')](config[_0x9e4b('0x5a')],_0x9e4b('0x5b')),_0x9e4b('0x5c'));var _0x45d8d7=ejs['render'](_0x313544,{'contexts':_0x1eda2e});fs[_0x9e4b('0x5e')](_0x9e4b('0x5f'),_0x45d8d7);return respondWithRpcPromise(_0x9e4b('0x60'),'destroy',{'module':_0x9e4b('0x61')});})['catch'](handleError(_0xd62c84,null));}; \ No newline at end of file +var _0xa4e5=['squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','get','UserProfileResource','stack','name','index','map','VoiceContext','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','options','includeAll','findAll','rows','show','params','include','merge','create','readFileSync','root','server/files/templates/context.ejs','render','writeFileSync','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','chan_sip.so','destroy','/etc/asterisk/extensions_xcally_contexts.conf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x252550,_0x1ffe4d){var _0x352629=function(_0x31548e){while(--_0x31548e){_0x252550['push'](_0x252550['shift']());}};_0x352629(++_0x1ffe4d);}(_0xa4e5,0xbf));var _0x5a4e=function(_0x9dd92f,_0x1d341c){_0x9dd92f=_0x9dd92f-0x0;var _0x4534d3=_0xa4e5[_0x9dd92f];return _0x4534d3;};'use strict';var emlformat=require(_0x5a4e('0x0'));var rimraf=require(_0x5a4e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5a4e('0x2'));var moment=require('moment');var BPromise=require(_0x5a4e('0x3'));var Mustache=require(_0x5a4e('0x4'));var util=require(_0x5a4e('0x5'));var path=require(_0x5a4e('0x6'));var sox=require(_0x5a4e('0x7'));var csv=require(_0x5a4e('0x8'));var ejs=require(_0x5a4e('0x9'));var fs=require('fs');var fs_extra=require(_0x5a4e('0xa'));var _=require('lodash');var squel=require(_0x5a4e('0xb'));var crypto=require(_0x5a4e('0xc'));var jsforce=require(_0x5a4e('0xd'));var deskjs=require(_0x5a4e('0xe'));var toCsv=require(_0x5a4e('0x8'));var querystring=require(_0x5a4e('0xf'));var Papa=require(_0x5a4e('0x10'));var Redis=require('ioredis');var authService=require(_0x5a4e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5a4e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a4e('0x13'))(_0x5a4e('0x14'));var utils=require(_0x5a4e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5a4e('0x16'));var db=require(_0x5a4e('0x17'))['db'];var jayson=require(_0x5a4e('0x18'));var client=jayson[_0x5a4e('0x19')][_0x5a4e('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x8f783c,_0x4b484a,_0x25519d,_0x53385){return new BPromise(function(_0x11e588,_0xd0a688){var _0x3bb014=_0x53385||client;return _0x3bb014['request'](_0x8f783c,_0x25519d)[_0x5a4e('0x1b')](function(_0x11af24){logger['info'](_0x5a4e('0x1c'),_0x4b484a,_0x5a4e('0x1d'));logger[_0x5a4e('0x1e')](_0x5a4e('0x1f'),_0x4b484a,'request\x20sent',JSON['stringify'](_0x11af24));if(_0x11af24[_0x5a4e('0x20')]){if(_0x11af24['error']['code']===0x1f4){logger[_0x5a4e('0x20')](_0x5a4e('0x1c'),_0x4b484a,_0x11af24[_0x5a4e('0x20')][_0x5a4e('0x21')]);return _0xd0a688(_0x11af24[_0x5a4e('0x20')][_0x5a4e('0x21')]);}logger[_0x5a4e('0x20')]('VoiceContext,\x20%s,\x20%s',_0x4b484a,_0x11af24[_0x5a4e('0x20')][_0x5a4e('0x21')]);return _0x11e588(_0x11af24['error'][_0x5a4e('0x21')]);}else{logger[_0x5a4e('0x22')]('VoiceContext,\x20%s,\x20%s',_0x4b484a,'request\x20sent');_0x11e588(_0x11af24[_0x5a4e('0x23')][_0x5a4e('0x21')]);}})[_0x5a4e('0x24')](function(_0x51c03b){logger[_0x5a4e('0x20')](_0x5a4e('0x1c'),_0x4b484a,_0x51c03b);_0xd0a688(_0x51c03b);});});}function respondWithStatusCode(_0x1d4363,_0x1bf1e6){_0x1bf1e6=_0x1bf1e6||0xcc;return function(_0x383c41){if(_0x383c41){return _0x1d4363[_0x5a4e('0x25')](_0x1bf1e6);}return _0x1d4363['status'](_0x1bf1e6)[_0x5a4e('0x26')]();};}function respondWithResult(_0x13f279,_0x64c7d3){_0x64c7d3=_0x64c7d3||0xc8;return function(_0x2b7e85){if(_0x2b7e85){return _0x13f279[_0x5a4e('0x27')](_0x64c7d3)[_0x5a4e('0x28')](_0x2b7e85);}};}function respondWithFilteredResult(_0x3f9ff6,_0x2624a0){return function(_0x183532){if(_0x183532){var _0x1d390a=typeof _0x2624a0[_0x5a4e('0x29')]==='undefined'&&typeof _0x2624a0[_0x5a4e('0x2a')]===_0x5a4e('0x2b');var _0x3346dc=_0x183532[_0x5a4e('0x2c')];var _0x336028=_0x1d390a?0x0:_0x2624a0[_0x5a4e('0x29')];var _0x10c79f=_0x1d390a?_0x183532[_0x5a4e('0x2c')]:_0x2624a0[_0x5a4e('0x29')]+_0x2624a0['limit'];var _0xc40b34;if(_0x10c79f>=_0x3346dc){_0x10c79f=_0x3346dc;_0xc40b34=0xc8;}else{_0xc40b34=0xce;}_0x3f9ff6['status'](_0xc40b34);return _0x3f9ff6[_0x5a4e('0x2d')](_0x5a4e('0x2e'),_0x336028+'-'+_0x10c79f+'/'+_0x3346dc)['json'](_0x183532);}return null;};}function patchUpdates(_0x58d748){return function(_0xf6ce02){try{jsonpatch[_0x5a4e('0x2f')](_0xf6ce02,_0x58d748,!![]);}catch(_0x47d581){return BPromise['reject'](_0x47d581);}return _0xf6ce02[_0x5a4e('0x30')]();};}function saveUpdates(_0x22f7dd,_0x1238aa){return function(_0x5cd4fc){if(_0x5cd4fc){return _0x5cd4fc[_0x5a4e('0x31')](_0x22f7dd)[_0x5a4e('0x1b')](function(_0x5c0d47){return _0x5c0d47;});}return null;};}function removeEntity(_0x473444,_0x37dd58){return function(_0x4a8966){if(_0x4a8966){return _0x4a8966['destroy']()['then'](function(){var _0xfe2764=_0x4a8966[_0x5a4e('0x32')]({'plain':!![]});var _0x393d04='Contexts';return db[_0x5a4e('0x33')]['destroy']({'where':{'type':_0x393d04,'resourceId':_0xfe2764['id']}})['then'](function(){return _0x4a8966;});})[_0x5a4e('0x1b')](function(){_0x473444[_0x5a4e('0x27')](0xcc)[_0x5a4e('0x26')]();});}};}function handleEntityNotFound(_0x30cd47,_0x18757f){return function(_0x39b507){if(!_0x39b507){_0x30cd47[_0x5a4e('0x25')](0x194);}return _0x39b507;};}function handleError(_0x43e305,_0x211192){_0x211192=_0x211192||0x1f4;return function(_0x35f811){logger[_0x5a4e('0x20')](_0x35f811[_0x5a4e('0x34')]);if(_0x35f811[_0x5a4e('0x35')]){delete _0x35f811['name'];}_0x43e305[_0x5a4e('0x27')](_0x211192)['send'](_0x35f811);};}exports[_0x5a4e('0x36')]=function(_0x2af1c6,_0x261ebe){var _0x40bb1d={},_0x21c485={},_0xb52d52={'count':0x0,'rows':[]};var _0x4d5c67=_[_0x5a4e('0x37')](db[_0x5a4e('0x38')][_0x5a4e('0x39')],function(_0x49a4a0){return{'name':_0x49a4a0[_0x5a4e('0x3a')],'type':_0x49a4a0['type']['key']};});_0x21c485[_0x5a4e('0x3b')]=_[_0x5a4e('0x37')](_0x4d5c67,_0x5a4e('0x35'));_0x21c485['query']=_[_0x5a4e('0x3c')](_0x2af1c6[_0x5a4e('0x3d')]);_0x21c485[_0x5a4e('0x3e')]=_[_0x5a4e('0x3f')](_0x21c485[_0x5a4e('0x3b')],_0x21c485[_0x5a4e('0x3d')]);_0x40bb1d[_0x5a4e('0x40')]=_['intersection'](_0x21c485[_0x5a4e('0x3b')],qs[_0x5a4e('0x41')](_0x2af1c6[_0x5a4e('0x3d')][_0x5a4e('0x41')]));_0x40bb1d[_0x5a4e('0x40')]=_0x40bb1d[_0x5a4e('0x40')][_0x5a4e('0x42')]?_0x40bb1d['attributes']:_0x21c485[_0x5a4e('0x3b')];if(!_0x2af1c6[_0x5a4e('0x3d')][_0x5a4e('0x43')]('nolimit')){_0x40bb1d['limit']=qs[_0x5a4e('0x2a')](_0x2af1c6[_0x5a4e('0x3d')][_0x5a4e('0x2a')]);_0x40bb1d[_0x5a4e('0x29')]=qs[_0x5a4e('0x29')](_0x2af1c6[_0x5a4e('0x3d')][_0x5a4e('0x29')]);}_0x40bb1d['order']=qs[_0x5a4e('0x44')](_0x2af1c6['query']['sort']);_0x40bb1d[_0x5a4e('0x45')]=qs[_0x5a4e('0x3e')](_[_0x5a4e('0x46')](_0x2af1c6[_0x5a4e('0x3d')],_0x21c485[_0x5a4e('0x3e')]),_0x4d5c67);if(_0x2af1c6[_0x5a4e('0x3d')][_0x5a4e('0x47')]){_0x40bb1d[_0x5a4e('0x45')]=_['merge'](_0x40bb1d[_0x5a4e('0x45')],{'$or':_[_0x5a4e('0x37')](_0x4d5c67,function(_0x922c48){if(_0x922c48[_0x5a4e('0x48')]!==_0x5a4e('0x49')){var _0x31a420={};_0x31a420[_0x922c48['name']]={'$like':'%'+_0x2af1c6[_0x5a4e('0x3d')]['filter']+'%'};return _0x31a420;}})});}_0x40bb1d=_['merge']({},_0x40bb1d,_0x2af1c6[_0x5a4e('0x4a')]);var _0x51a411={'where':_0x40bb1d[_0x5a4e('0x45')]};return db[_0x5a4e('0x38')][_0x5a4e('0x2c')](_0x51a411)['then'](function(_0x2b5114){_0xb52d52[_0x5a4e('0x2c')]=_0x2b5114;if(_0x2af1c6[_0x5a4e('0x3d')][_0x5a4e('0x4b')]){_0x40bb1d['include']=[{'all':!![]}];}return db[_0x5a4e('0x38')][_0x5a4e('0x4c')](_0x40bb1d);})[_0x5a4e('0x1b')](function(_0xe8c901){_0xb52d52[_0x5a4e('0x4d')]=_0xe8c901;return _0xb52d52;})['then'](respondWithFilteredResult(_0x261ebe,_0x40bb1d))[_0x5a4e('0x24')](handleError(_0x261ebe,null));};exports[_0x5a4e('0x4e')]=function(_0x119263,_0x3a6881){var _0x541536={'raw':![],'where':{'id':_0x119263[_0x5a4e('0x4f')]['id']}},_0x24e3cf={};_0x24e3cf[_0x5a4e('0x3b')]=_[_0x5a4e('0x3c')](db[_0x5a4e('0x38')]['rawAttributes']);_0x24e3cf[_0x5a4e('0x3d')]=_[_0x5a4e('0x3c')](_0x119263[_0x5a4e('0x3d')]);_0x24e3cf[_0x5a4e('0x3e')]=_[_0x5a4e('0x3f')](_0x24e3cf['model'],_0x24e3cf[_0x5a4e('0x3d')]);_0x541536[_0x5a4e('0x40')]=_[_0x5a4e('0x3f')](_0x24e3cf['model'],qs['fields'](_0x119263[_0x5a4e('0x3d')][_0x5a4e('0x41')]));_0x541536[_0x5a4e('0x40')]=_0x541536[_0x5a4e('0x40')][_0x5a4e('0x42')]?_0x541536[_0x5a4e('0x40')]:_0x24e3cf[_0x5a4e('0x3b')];if(_0x119263[_0x5a4e('0x3d')][_0x5a4e('0x4b')]){_0x541536[_0x5a4e('0x50')]=[{'all':!![]}];}_0x541536=_[_0x5a4e('0x51')]({},_0x541536,_0x119263[_0x5a4e('0x4a')]);return db[_0x5a4e('0x38')]['find'](_0x541536)['then'](handleEntityNotFound(_0x3a6881,null))['then'](respondWithResult(_0x3a6881,null))[_0x5a4e('0x24')](handleError(_0x3a6881,null));};exports[_0x5a4e('0x52')]=function(_0x5610ba,_0x4bac71,_0x3607d9){var _0x1675c6;return db[_0x5a4e('0x38')][_0x5a4e('0x52')](_0x5610ba['body'],{'raw':!![]})['then'](function(_0x14a106){_0x1675c6=_0x14a106;return db['VoiceContext'][_0x5a4e('0x4c')]({'raw':!![]});})[_0x5a4e('0x1b')](function(_0xf2ba00){var _0x1bd28d=fs[_0x5a4e('0x53')](path['join'](config[_0x5a4e('0x54')],_0x5a4e('0x55')),'utf8');var _0x338687=ejs[_0x5a4e('0x56')](_0x1bd28d,{'contexts':_0xf2ba00||[]});fs[_0x5a4e('0x57')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x338687);})[_0x5a4e('0x1b')](function(){return respondWithRpcPromise(_0x5a4e('0x58'),_0x5a4e('0x52'),{'module':'chan_sip.so'});})[_0x5a4e('0x1b')](function(){var _0x4ae3dd=_0x5610ba[_0x5a4e('0x59')][_0x5a4e('0x32')]({'plain':!![]});if(!_0x4ae3dd)throw new Error(_0x5a4e('0x5a'));if(_0x4ae3dd[_0x5a4e('0x5b')]===_0x5a4e('0x59')){var _0x3cbc9b=_0x1675c6['get']({'plain':!![]});return db['UserProfileSection'][_0x5a4e('0x5c')]({'where':{'name':_0x5a4e('0x5d'),'userProfileId':_0x4ae3dd[_0x5a4e('0x5e')]},'raw':!![]})[_0x5a4e('0x1b')](function(_0x37e6cf){if(_0x37e6cf&&_0x37e6cf[_0x5a4e('0x5f')]===0x0){return db[_0x5a4e('0x33')][_0x5a4e('0x52')]({'name':_0x3cbc9b['name'],'resourceId':_0x3cbc9b['id'],'type':_0x37e6cf['name'],'sectionId':_0x37e6cf['id']},{})[_0x5a4e('0x1b')](function(){return _0x1675c6;});}else{return _0x1675c6;}})['catch'](function(_0x27aaf9){logger['error'](_0x5a4e('0x60'),_0x27aaf9);throw _0x27aaf9;});}return _0x1675c6;})[_0x5a4e('0x1b')](respondWithResult(_0x4bac71,0xc9))[_0x5a4e('0x24')](handleError(_0x4bac71,null));};exports['update']=function(_0x443963,_0x42fa74,_0x1b6d9f){var _0x29d5cb;return db[_0x5a4e('0x38')][_0x5a4e('0x5c')]({'where':{'id':_0x443963[_0x5a4e('0x4f')]['id']}})[_0x5a4e('0x1b')](handleEntityNotFound(_0x42fa74,null))[_0x5a4e('0x1b')](saveUpdates(_0x443963[_0x5a4e('0x61')],null))[_0x5a4e('0x1b')](function(_0x58b8b4){if(_0x58b8b4){_0x29d5cb=_0x58b8b4;return db['VoiceContext'][_0x5a4e('0x4c')]({'raw':!![]});}})['then'](function(_0x1ad74e){var _0x58a431=fs[_0x5a4e('0x53')](path['join'](config[_0x5a4e('0x54')],_0x5a4e('0x55')),'utf8');var _0x234a97=ejs[_0x5a4e('0x56')](_0x58a431,{'contexts':_0x1ad74e||[]});fs[_0x5a4e('0x57')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x234a97);})[_0x5a4e('0x1b')](function(){return respondWithRpcPromise(_0x5a4e('0x58'),_0x5a4e('0x31'),{'module':_0x5a4e('0x62')});})[_0x5a4e('0x1b')](function(){return _0x29d5cb;})[_0x5a4e('0x1b')](respondWithResult(_0x42fa74,null))[_0x5a4e('0x24')](handleError(_0x42fa74,null));};exports[_0x5a4e('0x63')]=function(_0x7e824a,_0x28f1c2,_0x539fa2){var _0x139472;return db[_0x5a4e('0x38')]['find']({'where':{'id':_0x7e824a[_0x5a4e('0x4f')]['id']}})[_0x5a4e('0x1b')](handleEntityNotFound(_0x28f1c2,null))[_0x5a4e('0x1b')](removeEntity(_0x28f1c2,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0x5a4e('0x1b')](function(_0x1a6dd3){var _0x5124d8=fs[_0x5a4e('0x53')](path['join'](config[_0x5a4e('0x54')],'server/files/templates/context.ejs'),'utf8');var _0x1be3a3=ejs['render'](_0x5124d8,{'contexts':_0x1a6dd3});fs[_0x5a4e('0x57')](_0x5a4e('0x64'),_0x1be3a3);return respondWithRpcPromise(_0x5a4e('0x58'),_0x5a4e('0x63'),{'module':_0x5a4e('0x62')});})[_0x5a4e('0x24')](handleError(_0x28f1c2,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index b5da362..e125c03 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 _0xe9bd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','VoiceContext','voice_contexts'];(function(_0x5c8e6d,_0x2b57cf){var _0x58880d=function(_0x1885f1){while(--_0x1885f1){_0x5c8e6d['push'](_0x5c8e6d['shift']());}};_0x58880d(++_0x2b57cf);}(_0xe9bd,0x111));var _0xde9b=function(_0xbd09cb,_0x5c001d){_0xbd09cb=_0xbd09cb-0x0;var _0x13695b=_0xe9bd[_0xbd09cb];return _0x13695b;};'use strict';var _=require(_0xde9b('0x0'));var util=require(_0xde9b('0x1'));var logger=require(_0xde9b('0x2'))(_0xde9b('0x3'));var moment=require(_0xde9b('0x4'));var BPromise=require(_0xde9b('0x5'));var rp=require(_0xde9b('0x6'));var fs=require('fs');var path=require(_0xde9b('0x7'));var rimraf=require('rimraf');var config=require(_0xde9b('0x8'));var attributes=require('./voiceContext.attributes');module[_0xde9b('0x9')]=function(_0x5e6111,_0x505c0e){return _0x5e6111[_0xde9b('0xa')](_0xde9b('0xb'),attributes,{'tableName':_0xde9b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1418=['request-promise','path','rimraf','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x584513,_0x37c6c9){var _0xe4a14e=function(_0x4aadc0){while(--_0x4aadc0){_0x584513['push'](_0x584513['shift']());}};_0xe4a14e(++_0x37c6c9);}(_0x1418,0x86));var _0x8141=function(_0x282d13,_0x3af03d){_0x282d13=_0x282d13-0x0;var _0x473d9d=_0x1418[_0x282d13];return _0x473d9d;};'use strict';var _=require(_0x8141('0x0'));var util=require(_0x8141('0x1'));var logger=require(_0x8141('0x2'))(_0x8141('0x3'));var moment=require(_0x8141('0x4'));var BPromise=require(_0x8141('0x5'));var rp=require(_0x8141('0x6'));var fs=require('fs');var path=require(_0x8141('0x7'));var rimraf=require(_0x8141('0x8'));var config=require('../../config/environment');var attributes=require(_0x8141('0x9'));module[_0x8141('0xa')]=function(_0xca74ee,_0x222b26){return _0xca74ee[_0x8141('0xb')](_0x8141('0xc'),attributes,{'tableName':_0x8141('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 3116591..1434244 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 _0x6d2d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb'];(function(_0x49b606,_0x1c3110){var _0x16dc21=function(_0xcad95){while(--_0xcad95){_0x49b606['push'](_0x49b606['shift']());}};_0x16dc21(++_0x1c3110);}(_0x6d2d,0xbc));var _0xd6d2=function(_0x4e495f,_0x171ead){_0x4e495f=_0x4e495f-0x0;var _0x10bd76=_0x6d2d[_0x4e495f];return _0x10bd76;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd6d2('0x0'));var BPromise=require(_0xd6d2('0x1'));var rs=require(_0xd6d2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6d2('0x3'))['db'];var utils=require(_0xd6d2('0x4'));var logger=require(_0xd6d2('0x5'))(_0xd6d2('0x6'));var config=require(_0xd6d2('0x7'));var jayson=require(_0xd6d2('0x8'));var client=jayson[_0xd6d2('0x9')][_0xd6d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e981a,_0xd7f991,_0x736bc2){return new BPromise(function(_0x326cad,_0x539292){return client[_0xd6d2('0xb')](_0x5e981a,_0x736bc2)[_0xd6d2('0xc')](function(_0x390aaf){logger[_0xd6d2('0xd')](_0xd6d2('0xe'),_0xd7f991,_0xd6d2('0xf'));logger[_0xd6d2('0x10')](_0xd6d2('0x11'),_0xd7f991,'request\x20sent',JSON[_0xd6d2('0x12')](_0x390aaf));if(_0x390aaf[_0xd6d2('0x13')]){if(_0x390aaf[_0xd6d2('0x13')][_0xd6d2('0x14')]===0x1f4){logger[_0xd6d2('0x13')](_0xd6d2('0xe'),_0xd7f991,_0x390aaf[_0xd6d2('0x13')]['message']);return _0x539292(_0x390aaf[_0xd6d2('0x13')][_0xd6d2('0x15')]);}logger[_0xd6d2('0x13')](_0xd6d2('0xe'),_0xd7f991,_0x390aaf[_0xd6d2('0x13')]['message']);return _0x326cad(_0x390aaf[_0xd6d2('0x13')][_0xd6d2('0x15')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0xd7f991,_0xd6d2('0xf'));_0x326cad(_0x390aaf[_0xd6d2('0x16')]['message']);}})[_0xd6d2('0x17')](function(_0x39c029){logger['error'](_0xd6d2('0xe'),_0xd7f991,_0x39c029);_0x539292(_0x39c029);});});} \ No newline at end of file +var _0x4edf=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x38d2ac,_0x3d2bed){var _0x32f393=function(_0x45d82d){while(--_0x45d82d){_0x38d2ac['push'](_0x38d2ac['shift']());}};_0x32f393(++_0x3d2bed);}(_0x4edf,0x196));var _0xf4ed=function(_0x5ad07c,_0x324dcd){_0x5ad07c=_0x5ad07c-0x0;var _0x204bae=_0x4edf[_0x5ad07c];return _0x204bae;};'use strict';var _=require(_0xf4ed('0x0'));var util=require(_0xf4ed('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf4ed('0x2'));var fs=require('fs');var Redis=require(_0xf4ed('0x3'));var db=require(_0xf4ed('0x4'))['db'];var utils=require(_0xf4ed('0x5'));var logger=require(_0xf4ed('0x6'))(_0xf4ed('0x7'));var config=require(_0xf4ed('0x8'));var jayson=require(_0xf4ed('0x9'));var client=jayson['client'][_0xf4ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x174d4b,_0x477cb2,_0x2f0995){return new BPromise(function(_0x5cb6ac,_0x175eed){return client[_0xf4ed('0xb')](_0x174d4b,_0x2f0995)[_0xf4ed('0xc')](function(_0x5655c1){logger[_0xf4ed('0xd')]('VoiceContext,\x20%s,\x20%s',_0x477cb2,_0xf4ed('0xe'));logger[_0xf4ed('0xf')](_0xf4ed('0x10'),_0x477cb2,_0xf4ed('0xe'),JSON[_0xf4ed('0x11')](_0x5655c1));if(_0x5655c1[_0xf4ed('0x12')]){if(_0x5655c1[_0xf4ed('0x12')][_0xf4ed('0x13')]===0x1f4){logger[_0xf4ed('0x12')](_0xf4ed('0x14'),_0x477cb2,_0x5655c1[_0xf4ed('0x12')]['message']);return _0x175eed(_0x5655c1['error'][_0xf4ed('0x15')]);}logger[_0xf4ed('0x12')](_0xf4ed('0x14'),_0x477cb2,_0x5655c1[_0xf4ed('0x12')][_0xf4ed('0x15')]);return _0x5cb6ac(_0x5655c1[_0xf4ed('0x12')][_0xf4ed('0x15')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x477cb2,_0xf4ed('0xe'));_0x5cb6ac(_0x5655c1[_0xf4ed('0x16')][_0xf4ed('0x15')]);}})[_0xf4ed('0x17')](function(_0xfa4141){logger['error'](_0xf4ed('0x14'),_0x477cb2,_0xfa4141);_0x175eed(_0xfa4141);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index c89e7db..1f85552 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 _0xb7df=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0xf26fbc,_0x401b63){var _0x4a7e85=function(_0x23ad43){while(--_0x23ad43){_0xf26fbc['push'](_0xf26fbc['shift']());}};_0x4a7e85(++_0x401b63);}(_0xb7df,0xf6));var _0xfb7d=function(_0x2633ff,_0x450159){_0x2633ff=_0x2633ff-0x0;var _0x440726=_0xb7df[_0x2633ff];return _0x440726;};'use strict';var multer=require(_0xfb7d('0x0'));var util=require(_0xfb7d('0x1'));var path=require(_0xfb7d('0x2'));var timeout=require(_0xfb7d('0x3'));var express=require(_0xfb7d('0x4'));var router=express[_0xfb7d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfb7d('0x6'));var interaction=require(_0xfb7d('0x7'));var config=require(_0xfb7d('0x8'));var controller=require(_0xfb7d('0x9'));router[_0xfb7d('0xa')]('/',auth[_0xfb7d('0xb')](),controller[_0xfb7d('0xc')]);router[_0xfb7d('0xa')](_0xfb7d('0xd'),auth[_0xfb7d('0xb')](),controller['describe']);router['get'](_0xfb7d('0xe'),auth[_0xfb7d('0xb')](),controller[_0xfb7d('0xf')]);router[_0xfb7d('0x10')]('/',auth['isAuthenticated'](),controller[_0xfb7d('0x11')]);router[_0xfb7d('0x12')](_0xfb7d('0xe'),auth[_0xfb7d('0xb')](),controller['update']);router[_0xfb7d('0x13')](_0xfb7d('0xe'),auth[_0xfb7d('0xb')](),controller['destroy']);module[_0xfb7d('0x14')]=router; \ No newline at end of file +var _0xde71=['/describe','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0xde71,0x1c1));var _0x1de7=function(_0x490be3,_0xf0fca3){_0x490be3=_0x490be3-0x0;var _0x3f5140=_0xde71[_0x490be3];return _0x3f5140;};'use strict';var multer=require(_0x1de7('0x0'));var util=require(_0x1de7('0x1'));var path=require(_0x1de7('0x2'));var timeout=require(_0x1de7('0x3'));var express=require('express');var router=express[_0x1de7('0x4')]();var fs_extra=require(_0x1de7('0x5'));var auth=require(_0x1de7('0x6'));var interaction=require(_0x1de7('0x7'));var config=require(_0x1de7('0x8'));var controller=require(_0x1de7('0x9'));router['get']('/',auth[_0x1de7('0xa')](),controller[_0x1de7('0xb')]);router[_0x1de7('0xc')](_0x1de7('0xd'),auth[_0x1de7('0xa')](),controller['describe']);router['get'](_0x1de7('0xe'),auth[_0x1de7('0xa')](),controller[_0x1de7('0xf')]);router[_0x1de7('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1de7('0x11')](_0x1de7('0xe'),auth[_0x1de7('0xa')](),controller[_0x1de7('0x12')]);router['delete']('/:id',auth[_0x1de7('0xa')](),controller[_0x1de7('0x13')]);module[_0x1de7('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 7b5eb3b..f752587 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 _0xb821=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0xb821,0xa7));var _0x1b82=function(_0x1f36da,_0x54e2d2){_0x1f36da=_0x1f36da-0x0;var _0xb0d5b0=_0xb821[_0x1f36da];return _0xb0d5b0;};'use strict';var Sequelize=require('sequelize');module[_0x1b82('0x0')]={'privilege':{'type':Sequelize[_0x1b82('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x1b82('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1b82('0x1')]},'connectedlinename':{'type':Sequelize[_0x1b82('0x1')]},'language':{'type':Sequelize[_0x1b82('0x1')]},'accountcode':{'type':Sequelize[_0x1b82('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1b82('0x1')]},'priority':{'type':Sequelize[_0x1b82('0x2')]},'uniqueid':{'type':Sequelize[_0x1b82('0x1')]},'linkedid':{'type':Sequelize[_0x1b82('0x1')]},'destchannel':{'type':Sequelize[_0x1b82('0x1')]},'destchannelstate':{'type':Sequelize[_0x1b82('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x1b82('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1b82('0x1')]},'destcalleridname':{'type':Sequelize[_0x1b82('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x1b82('0x1')]},'destlanguage':{'type':Sequelize[_0x1b82('0x1')]},'destaccountcode':{'type':Sequelize[_0x1b82('0x1')]},'destcontext':{'type':Sequelize[_0x1b82('0x1')]},'destexten':{'type':Sequelize[_0x1b82('0x1')]},'destpriority':{'type':Sequelize[_0x1b82('0x2')]},'destuniqueid':{'type':Sequelize[_0x1b82('0x1')]},'destlinkedid':{'type':Sequelize[_0x1b82('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x1b82('0x1')]},'starttime':{'type':Sequelize[_0x1b82('0x3')]},'answertime':{'type':Sequelize[_0x1b82('0x3')]},'endtime':{'type':Sequelize[_0x1b82('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x1b82('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x1b82('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6f0d=['STRING','INTEGER','DATE','called,connect,complete','exports'];(function(_0x5033c9,_0x1e7e4f){var _0x4e08e4=function(_0x71b517){while(--_0x71b517){_0x5033c9['push'](_0x5033c9['shift']());}};_0x4e08e4(++_0x1e7e4f);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x145660,_0x53442e){_0x145660=_0x145660-0x0;var _0x244e9e=_0x6f0d[_0x145660];return _0x244e9e;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'privilege':{'type':Sequelize[_0xd6f0('0x1')]},'channel':{'type':Sequelize[_0xd6f0('0x1')]},'channelstate':{'type':Sequelize[_0xd6f0('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'calleridname':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'language':{'type':Sequelize[_0xd6f0('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd6f0('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd6f0('0x2')]},'uniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'linkedid':{'type':Sequelize[_0xd6f0('0x1')]},'destchannel':{'type':Sequelize[_0xd6f0('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'destcalleridname':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'destlanguage':{'type':Sequelize[_0xd6f0('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd6f0('0x1')]},'destexten':{'type':Sequelize[_0xd6f0('0x1')]},'destpriority':{'type':Sequelize[_0xd6f0('0x2')]},'destuniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xd6f0('0x1')]},'dialstatus':{'type':Sequelize[_0xd6f0('0x1')]},'starttime':{'type':Sequelize[_0xd6f0('0x3')]},'answertime':{'type':Sequelize[_0xd6f0('0x3')]},'endtime':{'type':Sequelize[_0xd6f0('0x3')]},'lastevent':{'type':Sequelize[_0xd6f0('0x1')],'comment':_0xd6f0('0x4')},'routeId':{'type':Sequelize[_0xd6f0('0x2')]},'duration':{'type':Sequelize[_0xd6f0('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xd6f0('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index bdad784..614c9ab 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 _0xf644=['find','destroy','params','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','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','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','VoiceDialReport','type','key','query','keys','filters','model','attributes','intersection','fields','nolimit','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','rawAttributes','length','create','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf644,0x1c6));var _0x4f64=function(_0x31b9ce,_0x591333){_0x31b9ce=_0x31b9ce-0x0;var _0x245172=_0xf644[_0x31b9ce];return _0x245172;};'use strict';var emlformat=require(_0x4f64('0x0'));var rimraf=require(_0x4f64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f64('0x2'));var rp=require(_0x4f64('0x3'));var moment=require('moment');var BPromise=require(_0x4f64('0x4'));var Mustache=require(_0x4f64('0x5'));var util=require('util');var path=require(_0x4f64('0x6'));var sox=require(_0x4f64('0x7'));var csv=require(_0x4f64('0x8'));var ejs=require(_0x4f64('0x9'));var fs=require('fs');var fs_extra=require(_0x4f64('0xa'));var _=require(_0x4f64('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4f64('0xc'));var toCsv=require(_0x4f64('0x8'));var querystring=require(_0x4f64('0xd'));var Papa=require(_0x4f64('0xe'));var Redis=require(_0x4f64('0xf'));var authService=require(_0x4f64('0x10'));var qs=require(_0x4f64('0x11'));var as=require(_0x4f64('0x12'));var hardwareService=require(_0x4f64('0x13'));var logger=require(_0x4f64('0x14'))('api');var utils=require(_0x4f64('0x15'));var config=require(_0x4f64('0x16'));var licenseUtil=require(_0x4f64('0x17'));var db=require(_0x4f64('0x18'))['db'];function respondWithStatusCode(_0x7e17ad,_0x52f083){_0x52f083=_0x52f083||0xcc;return function(_0x3254d8){if(_0x3254d8){return _0x7e17ad[_0x4f64('0x19')](_0x52f083);}return _0x7e17ad['status'](_0x52f083)[_0x4f64('0x1a')]();};}function respondWithResult(_0x5444e2,_0xa4734b){_0xa4734b=_0xa4734b||0xc8;return function(_0x49c7a9){if(_0x49c7a9){return _0x5444e2[_0x4f64('0x1b')](_0xa4734b)[_0x4f64('0x1c')](_0x49c7a9);}};}function respondWithFilteredResult(_0x63e1a9,_0x14730e){return function(_0x249091){if(_0x249091){var _0x376a22=typeof _0x14730e[_0x4f64('0x1d')]===_0x4f64('0x1e')&&typeof _0x14730e[_0x4f64('0x1f')]===_0x4f64('0x1e');var _0x1daa5c=_0x249091[_0x4f64('0x20')];var _0x574ed6=_0x376a22?0x0:_0x14730e[_0x4f64('0x1d')];var _0x4aa783=_0x376a22?_0x249091['count']:_0x14730e['offset']+_0x14730e[_0x4f64('0x1f')];var _0x33e235;if(_0x4aa783>=_0x1daa5c){_0x4aa783=_0x1daa5c;_0x33e235=0xc8;}else{_0x33e235=0xce;}_0x63e1a9[_0x4f64('0x1b')](_0x33e235);return _0x63e1a9[_0x4f64('0x21')](_0x4f64('0x22'),_0x574ed6+'-'+_0x4aa783+'/'+_0x1daa5c)[_0x4f64('0x1c')](_0x249091);}return null;};}function patchUpdates(_0x4e506a){return function(_0xdc8b03){try{jsonpatch[_0x4f64('0x23')](_0xdc8b03,_0x4e506a,!![]);}catch(_0x4bdfea){return BPromise[_0x4f64('0x24')](_0x4bdfea);}return _0xdc8b03[_0x4f64('0x25')]();};}function saveUpdates(_0x24fc45,_0x516fa6){return function(_0x2d56ea){if(_0x2d56ea){return _0x2d56ea[_0x4f64('0x26')](_0x24fc45)[_0x4f64('0x27')](function(_0x1080bb){return _0x1080bb;});}return null;};}function removeEntity(_0x2c680c,_0x386de9){return function(_0x5b9298){if(_0x5b9298){return _0x5b9298['destroy']()[_0x4f64('0x27')](function(){_0x2c680c[_0x4f64('0x1b')](0xcc)[_0x4f64('0x1a')]();});}};}function handleEntityNotFound(_0x3bba34,_0x2ccb52){return function(_0x3b551f){if(!_0x3b551f){_0x3bba34['sendStatus'](0x194);}return _0x3b551f;};}function handleError(_0x416b0e,_0x3ddbc0){_0x3ddbc0=_0x3ddbc0||0x1f4;return function(_0x5de456){logger['error'](_0x5de456[_0x4f64('0x28')]);if(_0x5de456[_0x4f64('0x29')]){delete _0x5de456[_0x4f64('0x29')];}_0x416b0e[_0x4f64('0x1b')](_0x3ddbc0)[_0x4f64('0x2a')](_0x5de456);};}exports[_0x4f64('0x2b')]=function(_0x2f0834,_0x310f7b){var _0x4a4022={},_0x58e031={},_0x321c97={'count':0x0,'rows':[]};var _0xceae8c=_[_0x4f64('0x2c')](db[_0x4f64('0x2d')]['rawAttributes'],function(_0x3cbf96){return{'name':_0x3cbf96['fieldName'],'type':_0x3cbf96[_0x4f64('0x2e')][_0x4f64('0x2f')]};});_0x58e031['model']=_[_0x4f64('0x2c')](_0xceae8c,_0x4f64('0x29'));_0x58e031[_0x4f64('0x30')]=_[_0x4f64('0x31')](_0x2f0834[_0x4f64('0x30')]);_0x58e031[_0x4f64('0x32')]=_['intersection'](_0x58e031[_0x4f64('0x33')],_0x58e031[_0x4f64('0x30')]);_0x4a4022[_0x4f64('0x34')]=_[_0x4f64('0x35')](_0x58e031[_0x4f64('0x33')],qs[_0x4f64('0x36')](_0x2f0834[_0x4f64('0x30')]['fields']));_0x4a4022[_0x4f64('0x34')]=_0x4a4022['attributes']['length']?_0x4a4022[_0x4f64('0x34')]:_0x58e031[_0x4f64('0x33')];if(!_0x2f0834[_0x4f64('0x30')]['hasOwnProperty'](_0x4f64('0x37'))){_0x4a4022[_0x4f64('0x1f')]=qs[_0x4f64('0x1f')](_0x2f0834[_0x4f64('0x30')][_0x4f64('0x1f')]);_0x4a4022['offset']=qs[_0x4f64('0x1d')](_0x2f0834['query']['offset']);}_0x4a4022['order']=qs[_0x4f64('0x38')](_0x2f0834[_0x4f64('0x30')][_0x4f64('0x38')]);_0x4a4022[_0x4f64('0x39')]=qs[_0x4f64('0x32')](_[_0x4f64('0x3a')](_0x2f0834[_0x4f64('0x30')],_0x58e031[_0x4f64('0x32')]),_0xceae8c);if(_0x2f0834[_0x4f64('0x30')]['filter']){_0x4a4022[_0x4f64('0x39')]=_['merge'](_0x4a4022[_0x4f64('0x39')],{'$or':_[_0x4f64('0x2c')](_0xceae8c,function(_0x15f724){if(_0x15f724[_0x4f64('0x2e')]!==_0x4f64('0x3b')){var _0x46ff73={};_0x46ff73[_0x15f724[_0x4f64('0x29')]]={'$like':'%'+_0x2f0834[_0x4f64('0x30')]['filter']+'%'};return _0x46ff73;}})});}_0x4a4022=_[_0x4f64('0x3c')]({},_0x4a4022,_0x2f0834[_0x4f64('0x3d')]);var _0x150938={'where':_0x4a4022['where']};return db[_0x4f64('0x2d')][_0x4f64('0x20')](_0x150938)[_0x4f64('0x27')](function(_0x51ae47){_0x321c97[_0x4f64('0x20')]=_0x51ae47;if(_0x2f0834['query'][_0x4f64('0x3e')]){_0x4a4022[_0x4f64('0x3f')]=[{'all':!![]}];}return db[_0x4f64('0x2d')][_0x4f64('0x40')](_0x4a4022);})['then'](function(_0x4d95b5){_0x321c97[_0x4f64('0x41')]=_0x4d95b5;return _0x321c97;})[_0x4f64('0x27')](respondWithFilteredResult(_0x310f7b,_0x4a4022))[_0x4f64('0x42')](handleError(_0x310f7b,null));};exports['show']=function(_0x3bca48,_0x263a4a){var _0x3b60de={'raw':!![],'where':{'id':_0x3bca48['params']['id']}},_0x5ce9b3={};_0x5ce9b3[_0x4f64('0x33')]=_[_0x4f64('0x31')](db[_0x4f64('0x2d')][_0x4f64('0x43')]);_0x5ce9b3[_0x4f64('0x30')]=_['keys'](_0x3bca48[_0x4f64('0x30')]);_0x5ce9b3[_0x4f64('0x32')]=_[_0x4f64('0x35')](_0x5ce9b3[_0x4f64('0x33')],_0x5ce9b3[_0x4f64('0x30')]);_0x3b60de[_0x4f64('0x34')]=_[_0x4f64('0x35')](_0x5ce9b3[_0x4f64('0x33')],qs['fields'](_0x3bca48[_0x4f64('0x30')][_0x4f64('0x36')]));_0x3b60de[_0x4f64('0x34')]=_0x3b60de[_0x4f64('0x34')][_0x4f64('0x44')]?_0x3b60de[_0x4f64('0x34')]:_0x5ce9b3[_0x4f64('0x33')];if(_0x3bca48[_0x4f64('0x30')]['includeAll']){_0x3b60de[_0x4f64('0x3f')]=[{'all':!![]}];}_0x3b60de=_['merge']({},_0x3b60de,_0x3bca48[_0x4f64('0x3d')]);return db[_0x4f64('0x2d')]['find'](_0x3b60de)[_0x4f64('0x27')](handleEntityNotFound(_0x263a4a,null))[_0x4f64('0x27')](respondWithResult(_0x263a4a,null))[_0x4f64('0x42')](handleError(_0x263a4a,null));};exports[_0x4f64('0x45')]=function(_0x3f8a59,_0x3bc52a){return db[_0x4f64('0x2d')]['create'](_0x3f8a59[_0x4f64('0x46')],{})['then'](respondWithResult(_0x3bc52a,0xc9))[_0x4f64('0x42')](handleError(_0x3bc52a,null));};exports[_0x4f64('0x26')]=function(_0x3a66cf,_0xe3a263){if(_0x3a66cf['body']['id']){delete _0x3a66cf[_0x4f64('0x46')]['id'];}return db[_0x4f64('0x2d')][_0x4f64('0x47')]({'where':{'id':_0x3a66cf['params']['id']}})[_0x4f64('0x27')](handleEntityNotFound(_0xe3a263,null))[_0x4f64('0x27')](saveUpdates(_0x3a66cf[_0x4f64('0x46')],null))[_0x4f64('0x27')](respondWithResult(_0xe3a263,null))['catch'](handleError(_0xe3a263,null));};exports[_0x4f64('0x48')]=function(_0x2ab4ff,_0x229d7b){return db[_0x4f64('0x2d')][_0x4f64('0x47')]({'where':{'id':_0x2ab4ff[_0x4f64('0x49')]['id']}})['then'](handleEntityNotFound(_0x229d7b,null))['then'](removeEntity(_0x229d7b,null))[_0x4f64('0x42')](handleError(_0x229d7b,null));};exports[_0x4f64('0x4a')]=function(_0x1571bd,_0x229c95){return db[_0x4f64('0x2d')]['describe']()[_0x4f64('0x27')](respondWithResult(_0x229c95,null))['catch'](handleError(_0x229c95,null));}; \ No newline at end of file +var _0xc0a7=['json','offset','undefined','limit','count','set','save','update','destroy','then','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','merge','create','body','find','describe','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0xe615f5,_0x344981){var _0xbc075c=function(_0x50fcf2){while(--_0x50fcf2){_0xe615f5['push'](_0xe615f5['shift']());}};_0xbc075c(++_0x344981);}(_0xc0a7,0x157));var _0x7c0a=function(_0x2e663a,_0xfe7e99){_0x2e663a=_0x2e663a-0x0;var _0x4980eb=_0xc0a7[_0x2e663a];return _0x4980eb;};'use strict';var emlformat=require(_0x7c0a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7c0a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7c0a('0x2'));var moment=require(_0x7c0a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7c0a('0x4'));var util=require(_0x7c0a('0x5'));var path=require(_0x7c0a('0x6'));var sox=require(_0x7c0a('0x7'));var csv=require(_0x7c0a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c0a('0x9'));var _=require(_0x7c0a('0xa'));var squel=require('squel');var crypto=require(_0x7c0a('0xb'));var jsforce=require(_0x7c0a('0xc'));var deskjs=require(_0x7c0a('0xd'));var toCsv=require(_0x7c0a('0x8'));var querystring=require(_0x7c0a('0xe'));var Papa=require('papaparse');var Redis=require(_0x7c0a('0xf'));var authService=require(_0x7c0a('0x10'));var qs=require(_0x7c0a('0x11'));var as=require(_0x7c0a('0x12'));var hardwareService=require(_0x7c0a('0x13'));var logger=require('../../config/logger')(_0x7c0a('0x14'));var utils=require(_0x7c0a('0x15'));var config=require(_0x7c0a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c0a('0x17'))['db'];function respondWithStatusCode(_0x527b56,_0x51942a){_0x51942a=_0x51942a||0xcc;return function(_0x52e45d){if(_0x52e45d){return _0x527b56[_0x7c0a('0x18')](_0x51942a);}return _0x527b56[_0x7c0a('0x19')](_0x51942a)[_0x7c0a('0x1a')]();};}function respondWithResult(_0x1d0b73,_0x4e9757){_0x4e9757=_0x4e9757||0xc8;return function(_0x41f132){if(_0x41f132){return _0x1d0b73[_0x7c0a('0x19')](_0x4e9757)[_0x7c0a('0x1b')](_0x41f132);}};}function respondWithFilteredResult(_0x9f334b,_0x5a3135){return function(_0x1fcbbc){if(_0x1fcbbc){var _0x326959=typeof _0x5a3135[_0x7c0a('0x1c')]===_0x7c0a('0x1d')&&typeof _0x5a3135[_0x7c0a('0x1e')]===_0x7c0a('0x1d');var _0x379eb3=_0x1fcbbc[_0x7c0a('0x1f')];var _0x52efd6=_0x326959?0x0:_0x5a3135[_0x7c0a('0x1c')];var _0x27fa30=_0x326959?_0x1fcbbc['count']:_0x5a3135[_0x7c0a('0x1c')]+_0x5a3135[_0x7c0a('0x1e')];var _0x1e04aa;if(_0x27fa30>=_0x379eb3){_0x27fa30=_0x379eb3;_0x1e04aa=0xc8;}else{_0x1e04aa=0xce;}_0x9f334b[_0x7c0a('0x19')](_0x1e04aa);return _0x9f334b[_0x7c0a('0x20')]('Content-Range',_0x52efd6+'-'+_0x27fa30+'/'+_0x379eb3)[_0x7c0a('0x1b')](_0x1fcbbc);}return null;};}function patchUpdates(_0x5d7a52){return function(_0x36fe98){try{jsonpatch['apply'](_0x36fe98,_0x5d7a52,!![]);}catch(_0x97bb30){return BPromise['reject'](_0x97bb30);}return _0x36fe98[_0x7c0a('0x21')]();};}function saveUpdates(_0x30e80a,_0x54a336){return function(_0x5c82a0){if(_0x5c82a0){return _0x5c82a0[_0x7c0a('0x22')](_0x30e80a)['then'](function(_0x207b29){return _0x207b29;});}return null;};}function removeEntity(_0x5485c2,_0x53712e){return function(_0xdec205){if(_0xdec205){return _0xdec205[_0x7c0a('0x23')]()[_0x7c0a('0x24')](function(){_0x5485c2[_0x7c0a('0x19')](0xcc)[_0x7c0a('0x1a')]();});}};}function handleEntityNotFound(_0x25ff28,_0x13df94){return function(_0x64a933){if(!_0x64a933){_0x25ff28[_0x7c0a('0x18')](0x194);}return _0x64a933;};}function handleError(_0x566429,_0x36681e){_0x36681e=_0x36681e||0x1f4;return function(_0x4cd8bb){logger['error'](_0x4cd8bb[_0x7c0a('0x25')]);if(_0x4cd8bb['name']){delete _0x4cd8bb[_0x7c0a('0x26')];}_0x566429[_0x7c0a('0x19')](_0x36681e)['send'](_0x4cd8bb);};}exports[_0x7c0a('0x27')]=function(_0x4eefc2,_0x21174d){var _0x4c4879={},_0x2a8c12={},_0x2dc278={'count':0x0,'rows':[]};var _0x428727=_[_0x7c0a('0x28')](db[_0x7c0a('0x29')][_0x7c0a('0x2a')],function(_0x24fa5f){return{'name':_0x24fa5f[_0x7c0a('0x2b')],'type':_0x24fa5f['type'][_0x7c0a('0x2c')]};});_0x2a8c12[_0x7c0a('0x2d')]=_[_0x7c0a('0x28')](_0x428727,_0x7c0a('0x26'));_0x2a8c12[_0x7c0a('0x2e')]=_[_0x7c0a('0x2f')](_0x4eefc2['query']);_0x2a8c12[_0x7c0a('0x30')]=_[_0x7c0a('0x31')](_0x2a8c12[_0x7c0a('0x2d')],_0x2a8c12[_0x7c0a('0x2e')]);_0x4c4879[_0x7c0a('0x32')]=_['intersection'](_0x2a8c12[_0x7c0a('0x2d')],qs[_0x7c0a('0x33')](_0x4eefc2[_0x7c0a('0x2e')]['fields']));_0x4c4879[_0x7c0a('0x32')]=_0x4c4879[_0x7c0a('0x32')][_0x7c0a('0x34')]?_0x4c4879[_0x7c0a('0x32')]:_0x2a8c12['model'];if(!_0x4eefc2['query'][_0x7c0a('0x35')](_0x7c0a('0x36'))){_0x4c4879[_0x7c0a('0x1e')]=qs['limit'](_0x4eefc2[_0x7c0a('0x2e')]['limit']);_0x4c4879[_0x7c0a('0x1c')]=qs['offset'](_0x4eefc2[_0x7c0a('0x2e')][_0x7c0a('0x1c')]);}_0x4c4879[_0x7c0a('0x37')]=qs[_0x7c0a('0x38')](_0x4eefc2[_0x7c0a('0x2e')]['sort']);_0x4c4879[_0x7c0a('0x39')]=qs[_0x7c0a('0x30')](_['pick'](_0x4eefc2[_0x7c0a('0x2e')],_0x2a8c12[_0x7c0a('0x30')]),_0x428727);if(_0x4eefc2[_0x7c0a('0x2e')][_0x7c0a('0x3a')]){_0x4c4879[_0x7c0a('0x39')]=_['merge'](_0x4c4879[_0x7c0a('0x39')],{'$or':_['map'](_0x428727,function(_0x2f0752){if(_0x2f0752[_0x7c0a('0x3b')]!==_0x7c0a('0x3c')){var _0x2a86e3={};_0x2a86e3[_0x2f0752['name']]={'$like':'%'+_0x4eefc2['query']['filter']+'%'};return _0x2a86e3;}})});}_0x4c4879=_['merge']({},_0x4c4879,_0x4eefc2[_0x7c0a('0x3d')]);var _0x321afd={'where':_0x4c4879[_0x7c0a('0x39')]};return db['VoiceDialReport'][_0x7c0a('0x1f')](_0x321afd)[_0x7c0a('0x24')](function(_0x1a1041){_0x2dc278[_0x7c0a('0x1f')]=_0x1a1041;if(_0x4eefc2[_0x7c0a('0x2e')][_0x7c0a('0x3e')]){_0x4c4879['include']=[{'all':!![]}];}return db[_0x7c0a('0x29')][_0x7c0a('0x3f')](_0x4c4879);})[_0x7c0a('0x24')](function(_0x193eb6){_0x2dc278[_0x7c0a('0x40')]=_0x193eb6;return _0x2dc278;})[_0x7c0a('0x24')](respondWithFilteredResult(_0x21174d,_0x4c4879))[_0x7c0a('0x41')](handleError(_0x21174d,null));};exports[_0x7c0a('0x42')]=function(_0x269337,_0x47e5b5){var _0x3c7145={'raw':!![],'where':{'id':_0x269337[_0x7c0a('0x43')]['id']}},_0x4799e7={};_0x4799e7[_0x7c0a('0x2d')]=_['keys'](db['VoiceDialReport'][_0x7c0a('0x2a')]);_0x4799e7[_0x7c0a('0x2e')]=_[_0x7c0a('0x2f')](_0x269337[_0x7c0a('0x2e')]);_0x4799e7[_0x7c0a('0x30')]=_['intersection'](_0x4799e7['model'],_0x4799e7[_0x7c0a('0x2e')]);_0x3c7145[_0x7c0a('0x32')]=_[_0x7c0a('0x31')](_0x4799e7[_0x7c0a('0x2d')],qs[_0x7c0a('0x33')](_0x269337['query'][_0x7c0a('0x33')]));_0x3c7145[_0x7c0a('0x32')]=_0x3c7145[_0x7c0a('0x32')][_0x7c0a('0x34')]?_0x3c7145[_0x7c0a('0x32')]:_0x4799e7[_0x7c0a('0x2d')];if(_0x269337[_0x7c0a('0x2e')]['includeAll']){_0x3c7145[_0x7c0a('0x44')]=[{'all':!![]}];}_0x3c7145=_[_0x7c0a('0x45')]({},_0x3c7145,_0x269337[_0x7c0a('0x3d')]);return db['VoiceDialReport']['find'](_0x3c7145)[_0x7c0a('0x24')](handleEntityNotFound(_0x47e5b5,null))[_0x7c0a('0x24')](respondWithResult(_0x47e5b5,null))[_0x7c0a('0x41')](handleError(_0x47e5b5,null));};exports['create']=function(_0x3a6822,_0x3658cc){return db[_0x7c0a('0x29')][_0x7c0a('0x46')](_0x3a6822[_0x7c0a('0x47')],{})[_0x7c0a('0x24')](respondWithResult(_0x3658cc,0xc9))[_0x7c0a('0x41')](handleError(_0x3658cc,null));};exports[_0x7c0a('0x22')]=function(_0xbe7fc0,_0x2e117f){if(_0xbe7fc0['body']['id']){delete _0xbe7fc0[_0x7c0a('0x47')]['id'];}return db[_0x7c0a('0x29')][_0x7c0a('0x48')]({'where':{'id':_0xbe7fc0[_0x7c0a('0x43')]['id']}})['then'](handleEntityNotFound(_0x2e117f,null))['then'](saveUpdates(_0xbe7fc0['body'],null))[_0x7c0a('0x24')](respondWithResult(_0x2e117f,null))[_0x7c0a('0x41')](handleError(_0x2e117f,null));};exports[_0x7c0a('0x23')]=function(_0x2add6d,_0x4bb744){return db[_0x7c0a('0x29')][_0x7c0a('0x48')]({'where':{'id':_0x2add6d[_0x7c0a('0x43')]['id']}})[_0x7c0a('0x24')](handleEntityNotFound(_0x4bb744,null))[_0x7c0a('0x24')](removeEntity(_0x4bb744,null))[_0x7c0a('0x41')](handleError(_0x4bb744,null));};exports['describe']=function(_0x2feeb2,_0x51f8c6){return db[_0x7c0a('0x29')][_0x7c0a('0x49')]()[_0x7c0a('0x24')](respondWithResult(_0x51f8c6,null))[_0x7c0a('0x41')](handleError(_0x51f8c6,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 3159828..1c9ea17 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 _0xaf66=['uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf66,0x7f));var _0x6af6=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0xaf66[_0x246148];return _0x453d94;};'use strict';var _=require(_0x6af6('0x0'));var util=require(_0x6af6('0x1'));var logger=require(_0x6af6('0x2'))(_0x6af6('0x3'));var moment=require(_0x6af6('0x4'));var BPromise=require('bluebird');var rp=require(_0x6af6('0x5'));var fs=require('fs');var path=require(_0x6af6('0x6'));var rimraf=require('rimraf');var config=require(_0x6af6('0x7'));var attributes=require(_0x6af6('0x8'));module[_0x6af6('0x9')]=function(_0x2c5ecd,_0x5a0817){return _0x2c5ecd[_0x6af6('0xa')](_0x6af6('0xb'),attributes,{'tableName':_0x6af6('0xc'),'paranoid':![],'indexes':[{'fields':[_0x6af6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x684d=['api','bluebird','path','rimraf','../../config/environment','exports','VoiceDialReport','report_dial','uniqueid','util','../../config/logger'];(function(_0x307c8f,_0x199d78){var _0x25eb16=function(_0x51978b){while(--_0x51978b){_0x307c8f['push'](_0x307c8f['shift']());}};_0x25eb16(++_0x199d78);}(_0x684d,0x174));var _0xd684=function(_0x2980a7,_0xd0061f){_0x2980a7=_0x2980a7-0x0;var _0x5963f4=_0x684d[_0x2980a7];return _0x5963f4;};'use strict';var _=require('lodash');var util=require(_0xd684('0x0'));var logger=require(_0xd684('0x1'))(_0xd684('0x2'));var moment=require('moment');var BPromise=require(_0xd684('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd684('0x4'));var rimraf=require(_0xd684('0x5'));var config=require(_0xd684('0x6'));var attributes=require('./voiceDialReport.attributes');module[_0xd684('0x7')]=function(_0x5f50ac,_0x3bf907){return _0x5f50ac['define'](_0xd684('0x8'),attributes,{'tableName':_0xd684('0x9'),'paranoid':![],'indexes':[{'fields':[_0xd684('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index ffd6649..abb553f 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 _0x63f4=['update','attributes','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceDialReport','create','body','options','raw','then','CreateVoiceDialReport'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x63f4,0x16e));var _0x463f=function(_0x275ae5,_0x46fcb0){_0x275ae5=_0x275ae5-0x0;var _0xef14bd=_0x63f4[_0x275ae5];return _0xef14bd;};'use strict';var _=require(_0x463f('0x0'));var util=require(_0x463f('0x1'));var moment=require(_0x463f('0x2'));var BPromise=require(_0x463f('0x3'));var rs=require(_0x463f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x463f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x463f('0x6'))(_0x463f('0x7'));var config=require(_0x463f('0x8'));var jayson=require(_0x463f('0x9'));var client=jayson[_0x463f('0xa')][_0x463f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28e7c3,_0x187f2b,_0x4cbbb0){return new BPromise(function(_0x1e5380,_0x6dd7ca){return client['request'](_0x28e7c3,_0x4cbbb0)['then'](function(_0x104c19){logger[_0x463f('0xc')](_0x463f('0xd'),_0x187f2b,_0x463f('0xe'));logger[_0x463f('0xf')](_0x463f('0x10'),_0x187f2b,_0x463f('0xe'),JSON[_0x463f('0x11')](_0x104c19));if(_0x104c19[_0x463f('0x12')]){if(_0x104c19[_0x463f('0x12')][_0x463f('0x13')]===0x1f4){logger[_0x463f('0x12')](_0x463f('0xd'),_0x187f2b,_0x104c19['error'][_0x463f('0x14')]);return _0x6dd7ca(_0x104c19[_0x463f('0x12')][_0x463f('0x14')]);}logger[_0x463f('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x187f2b,_0x104c19[_0x463f('0x12')][_0x463f('0x14')]);return _0x1e5380(_0x104c19[_0x463f('0x12')][_0x463f('0x14')]);}else{logger[_0x463f('0xc')](_0x463f('0xd'),_0x187f2b,_0x463f('0xe'));_0x1e5380(_0x104c19[_0x463f('0x15')]['message']);}})[_0x463f('0x16')](function(_0x11a3d5){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x187f2b,_0x11a3d5);_0x6dd7ca(_0x11a3d5);});});}exports['CreateVoiceDialReport']=function(_0x25d75a){var _0xd67b0d=this;return new Promise(function(_0x150985,_0x40cba4){return db[_0x463f('0x17')][_0x463f('0x18')](_0x25d75a[_0x463f('0x19')],{'raw':_0x25d75a['options']?_0x25d75a[_0x463f('0x1a')][_0x463f('0x1b')]===undefined?!![]:![]:!![]})[_0x463f('0x1c')](function(_0x1e3712){logger[_0x463f('0xc')](_0x463f('0x1d'),_0x25d75a);logger[_0x463f('0xf')](_0x463f('0x1d'),_0x25d75a,JSON[_0x463f('0x11')](_0x1e3712));_0x150985(_0x1e3712);})[_0x463f('0x16')](function(_0x25f804){logger[_0x463f('0x12')](_0x463f('0x1d'),_0x25f804[_0x463f('0x14')],_0x25d75a);_0x40cba4(_0xd67b0d[_0x463f('0x12')](0x1f4,_0x25f804[_0x463f('0x14')]));});});};exports['UpdateVoiceDialReport']=function(_0x184789){var _0x1646af=this;return new Promise(function(_0x2e47be,_0x42c523){return db['VoiceDialReport'][_0x463f('0x1e')](_0x184789[_0x463f('0x19')],{'raw':_0x184789[_0x463f('0x1a')]?_0x184789[_0x463f('0x1a')][_0x463f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x184789[_0x463f('0x1a')]?_0x184789[_0x463f('0x1a')]['where']||null:null,'attributes':_0x184789[_0x463f('0x1a')]?_0x184789[_0x463f('0x1a')][_0x463f('0x1f')]||null:null,'limit':_0x184789[_0x463f('0x1a')]?_0x184789['options']['limit']||null:null})['then'](function(_0x4b4257){logger[_0x463f('0xc')](_0x463f('0x20'),_0x184789);logger['debug']('UpdateVoiceDialReport',_0x184789,JSON['stringify'](_0x4b4257));_0x2e47be(_0x4b4257);})['catch'](function(_0x5775c2){logger[_0x463f('0x12')]('UpdateVoiceDialReport',_0x5775c2['message'],_0x184789);_0x42c523(_0x1646af['error'](0x1f4,_0x5775c2[_0x463f('0x14')]));});});}; \ No newline at end of file +var _0xdaf7=['../../config/logger','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','raw','debug','UpdateVoiceDialReport','update','options','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x5210a2,_0x4f5288){var _0x597bd9=function(_0x3cadb0){while(--_0x3cadb0){_0x5210a2['push'](_0x5210a2['shift']());}};_0x597bd9(++_0x4f5288);}(_0xdaf7,0x130));var _0x7daf=function(_0x3b56f1,_0x53000c){_0x3b56f1=_0x3b56f1-0x0;var _0x5354e7=_0xdaf7[_0x3b56f1];return _0x5354e7;};'use strict';var _=require(_0x7daf('0x0'));var util=require(_0x7daf('0x1'));var moment=require(_0x7daf('0x2'));var BPromise=require(_0x7daf('0x3'));var rs=require(_0x7daf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7daf('0x5'));var logger=require(_0x7daf('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7daf('0x7'));var client=jayson[_0x7daf('0x8')][_0x7daf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27c7d4,_0x4b8710,_0x33566b){return new BPromise(function(_0x48b3b9,_0x302042){return client[_0x7daf('0xa')](_0x27c7d4,_0x33566b)[_0x7daf('0xb')](function(_0x55a460){logger[_0x7daf('0xc')](_0x7daf('0xd'),_0x4b8710,_0x7daf('0xe'));logger['debug'](_0x7daf('0xf'),_0x4b8710,_0x7daf('0xe'),JSON[_0x7daf('0x10')](_0x55a460));if(_0x55a460[_0x7daf('0x11')]){if(_0x55a460[_0x7daf('0x11')]['code']===0x1f4){logger['error'](_0x7daf('0xd'),_0x4b8710,_0x55a460[_0x7daf('0x11')][_0x7daf('0x12')]);return _0x302042(_0x55a460['error'][_0x7daf('0x12')]);}logger['error'](_0x7daf('0xd'),_0x4b8710,_0x55a460[_0x7daf('0x11')][_0x7daf('0x12')]);return _0x48b3b9(_0x55a460['error']['message']);}else{logger[_0x7daf('0xc')](_0x7daf('0xd'),_0x4b8710,'request\x20sent');_0x48b3b9(_0x55a460[_0x7daf('0x13')][_0x7daf('0x12')]);}})[_0x7daf('0x14')](function(_0x3b3cae){logger['error'](_0x7daf('0xd'),_0x4b8710,_0x3b3cae);_0x302042(_0x3b3cae);});});}exports[_0x7daf('0x15')]=function(_0x2fcecc){var _0x3bcc99=this;return new Promise(function(_0x14ad5a,_0x550bd0){return db[_0x7daf('0x16')]['create'](_0x2fcecc[_0x7daf('0x17')],{'raw':_0x2fcecc['options']?_0x2fcecc['options'][_0x7daf('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x482f32){logger[_0x7daf('0xc')](_0x7daf('0x15'),_0x2fcecc);logger[_0x7daf('0x19')](_0x7daf('0x15'),_0x2fcecc,JSON[_0x7daf('0x10')](_0x482f32));_0x14ad5a(_0x482f32);})[_0x7daf('0x14')](function(_0x1de122){logger[_0x7daf('0x11')](_0x7daf('0x15'),_0x1de122[_0x7daf('0x12')],_0x2fcecc);_0x550bd0(_0x3bcc99[_0x7daf('0x11')](0x1f4,_0x1de122[_0x7daf('0x12')]));});});};exports[_0x7daf('0x1a')]=function(_0x5602a3){var _0x449e14=this;return new Promise(function(_0x29f280,_0x54cb74){return db[_0x7daf('0x16')][_0x7daf('0x1b')](_0x5602a3[_0x7daf('0x17')],{'raw':_0x5602a3['options']?_0x5602a3[_0x7daf('0x1c')][_0x7daf('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5602a3[_0x7daf('0x1c')]?_0x5602a3[_0x7daf('0x1c')]['where']||null:null,'attributes':_0x5602a3[_0x7daf('0x1c')]?_0x5602a3[_0x7daf('0x1c')][_0x7daf('0x1d')]||null:null,'limit':_0x5602a3[_0x7daf('0x1c')]?_0x5602a3[_0x7daf('0x1c')][_0x7daf('0x1e')]||null:null})[_0x7daf('0xb')](function(_0x51a8c8){logger['info'](_0x7daf('0x1a'),_0x5602a3);logger['debug'](_0x7daf('0x1a'),_0x5602a3,JSON[_0x7daf('0x10')](_0x51a8c8));_0x29f280(_0x51a8c8);})[_0x7daf('0x14')](function(_0x4dc5a0){logger['error']('UpdateVoiceDialReport',_0x4dc5a0['message'],_0x5602a3);_0x54cb74(_0x449e14[_0x7daf('0x11')](0x1f4,_0x4dc5a0[_0x7daf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 5c28d61..31b9e7f 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 _0x41ab=['put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','/:id','isAuthenticated','show','post','create','/:id/applications','addApplications'];(function(_0x502b83,_0x4b0040){var _0x3a5802=function(_0x5c1a52){while(--_0x5c1a52){_0x502b83['push'](_0x502b83['shift']());}};_0x3a5802(++_0x4b0040);}(_0x41ab,0x17b));var _0xb41a=function(_0x533512,_0x23758e){_0x533512=_0x533512-0x0;var _0x5f56f2=_0x41ab[_0x533512];return _0x5f56f2;};'use strict';var multer=require(_0xb41a('0x0'));var util=require(_0xb41a('0x1'));var path=require('path');var timeout=require(_0xb41a('0x2'));var express=require('express');var router=express[_0xb41a('0x3')]();var fs_extra=require(_0xb41a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb41a('0x5'));var config=require(_0xb41a('0x6'));var controller=require(_0xb41a('0x7'));router[_0xb41a('0x8')]('/',auth['isAuthenticated'](),controller[_0xb41a('0x9')]);router['get'](_0xb41a('0xa'),auth[_0xb41a('0xb')](),controller[_0xb41a('0xc')]);router[_0xb41a('0xd')]('/',auth['isAuthenticated'](),controller[_0xb41a('0xe')]);router[_0xb41a('0xd')](_0xb41a('0xf'),auth[_0xb41a('0xb')](),controller[_0xb41a('0x10')]);router[_0xb41a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb41a('0x12')]);router[_0xb41a('0x13')](_0xb41a('0xa'),auth[_0xb41a('0xb')](),controller[_0xb41a('0x14')]);module[_0xb41a('0x15')]=router; \ No newline at end of file +var _0xb880=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','post','create','/:id/applications','addApplications','put','/:id','delete','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x2675da,_0x5a250e){var _0x5e6153=function(_0xf93114){while(--_0xf93114){_0x2675da['push'](_0x2675da['shift']());}};_0x5e6153(++_0x5a250e);}(_0xb880,0x93));var _0x0b88=function(_0x3cbcc4,_0x41013a){_0x3cbcc4=_0x3cbcc4-0x0;var _0x51f880=_0xb880[_0x3cbcc4];return _0x51f880;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0b88('0x0'));var timeout=require(_0x0b88('0x1'));var express=require(_0x0b88('0x2'));var router=express[_0x0b88('0x3')]();var fs_extra=require(_0x0b88('0x4'));var auth=require(_0x0b88('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0b88('0x6'));var controller=require('./voiceExtension.controller');router[_0x0b88('0x7')]('/',auth[_0x0b88('0x8')](),controller[_0x0b88('0x9')]);router['get']('/:id',auth[_0x0b88('0x8')](),controller[_0x0b88('0xa')]);router[_0x0b88('0xb')]('/',auth[_0x0b88('0x8')](),controller[_0x0b88('0xc')]);router[_0x0b88('0xb')](_0x0b88('0xd'),auth[_0x0b88('0x8')](),controller[_0x0b88('0xe')]);router[_0x0b88('0xf')](_0x0b88('0x10'),auth[_0x0b88('0x8')](),controller['update']);router[_0x0b88('0x11')](_0x0b88('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x0b88('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 2a673fb..3be4623 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 _0xdb48=['exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','exten'];(function(_0x5d6001,_0x428b3c){var _0x5cfade=function(_0x1ba1b1){while(--_0x1ba1b1){_0x5d6001['push'](_0x5d6001['shift']());}};_0x5cfade(++_0x428b3c);}(_0xdb48,0x1cb));var _0x8db4=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xdb48[_0x1eda20];return _0x31b953;};'use strict';var Sequelize=require('sequelize');module[_0x8db4('0x0')]={'context':{'type':Sequelize[_0x8db4('0x1')],'allowNull':![],'unique':_0x8db4('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x8db4('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x8db4('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x8db4('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x8db4('0x1')],'allowNull':![],'defaultValue':_0x8db4('0x3')},'appdata':{'type':Sequelize[_0x8db4('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x8db4('0x4')](_0x8db4('0x5'),_0x8db4('0x6'),_0x8db4('0x7'),_0x8db4('0x8'),_0x8db4('0x9'),'system',_0x8db4('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x8db4('0x1')]},'interval':{'type':Sequelize[_0x8db4('0x1')],'allowNull':![],'defaultValue':_0x8db4('0xb')},'IntervalId':{'type':Sequelize[_0x8db4('0xc')]},'isApp':{'type':Sequelize[_0x8db4('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x8db4('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x8db4('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x8db4('0xc')]},'recordingFormat':{'type':Sequelize[_0x8db4('0x1')],'defaultValue':_0x8db4('0xe')},'answer':{'type':Sequelize[_0x8db4('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x8db4('0xf')],'get':function(_0x4ca40d){return this['getDataValue'](_0x8db4('0x10'));}},'alias':{'type':Sequelize[_0x8db4('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x930d=['sequelize','exports','STRING','compositeIndex','ENUM','inbound','internal','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue'];(function(_0x3823d3,_0x30d63a){var _0x163cd9=function(_0x3776d7){while(--_0x3776d7){_0x3823d3['push'](_0x3823d3['shift']());}};_0x163cd9(++_0x30d63a);}(_0x930d,0x1a0));var _0xd930=function(_0x290694,_0x281935){_0x290694=_0x290694-0x0;var _0x5a0f2e=_0x930d[_0x290694];return _0x5a0f2e;};'use strict';var Sequelize=require(_0xd930('0x0'));module[_0xd930('0x1')]={'context':{'type':Sequelize[_0xd930('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xd930('0x2')],'allowNull':![],'unique':_0xd930('0x3')},'priority':{'type':Sequelize[_0xd930('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xd930('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xd930('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0xd930('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xd930('0x4')](_0xd930('0x5'),'outbound',_0xd930('0x6'),_0xd930('0x7'),_0xd930('0x8'),'system',_0xd930('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0xd930('0x2')]},'interval':{'type':Sequelize[_0xd930('0x2')],'allowNull':![],'defaultValue':_0xd930('0xa')},'IntervalId':{'type':Sequelize[_0xd930('0xb')]},'isApp':{'type':Sequelize[_0xd930('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd930('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xd930('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xd930('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xd930('0xb')]},'recordingFormat':{'type':Sequelize[_0xd930('0x2')],'defaultValue':_0xd930('0xd')},'answer':{'type':Sequelize[_0xd930('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0xd930('0xe')],'get':function(_0x192911){return this[_0xd930('0xf')]('exten');}},'alias':{'type':Sequelize[_0xd930('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 1e8a5fc..a6d6340 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 _0x217c=['autoAssociation','update','context','recordingFormat','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','destroy','then','get','InboundRoutes','inbound','outbound','InternalRoutes','ignore','map','value','includes','type','find','UserProfileResource','error','stack','name','send','index','VoiceExtension','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','options','include','findAll','catch','params','length','startsWith','body','exten','concat','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OutboundRoutes','internal'];(function(_0x1fcd72,_0x155c9f){var _0x25a0b6=function(_0x5d82e4){while(--_0x5d82e4){_0x1fcd72['push'](_0x1fcd72['shift']());}};_0x25a0b6(++_0x155c9f);}(_0x217c,0x69));var _0xc217=function(_0x1f9a9f,_0x159349){_0x1f9a9f=_0x1f9a9f-0x0;var _0x54e90c=_0x217c[_0x1f9a9f];return _0x54e90c;};'use strict';var _=require('lodash');var Redis=require(_0xc217('0x0'));var qs=require(_0xc217('0x1'));var logger=require(_0xc217('0x2'))(_0xc217('0x3'));var config=require(_0xc217('0x4'));var db=require(_0xc217('0x5'))['db'];config[_0xc217('0x6')]=_[_0xc217('0x7')](config['redis'],{'host':_0xc217('0x8'),'port':0x18eb});var socket=require(_0xc217('0x9'))(new Redis(config[_0xc217('0x6')]));require(_0xc217('0xa'))[_0xc217('0xb')](socket);function respondWithStatusCode(_0x41a11b,_0x2bc73a){_0x2bc73a=_0x2bc73a||0xcc;return function(_0x2fb977){if(_0x2fb977){return _0x41a11b[_0xc217('0xc')](_0x2bc73a);}return _0x41a11b[_0xc217('0xd')](_0x2bc73a)[_0xc217('0xe')]();};}function respondWithResult(_0x5dd77b,_0x368aee){_0x368aee=_0x368aee||0xc8;return function(_0x48e923){if(_0x48e923){return _0x5dd77b['status'](_0x368aee)[_0xc217('0xf')](_0x48e923);}};}function respondWithFilteredResult(_0x42a103,_0x364d65){return function(_0x594b0a){if(_0x594b0a){var _0xdffca8=typeof _0x364d65['offset']===_0xc217('0x10')&&typeof _0x364d65[_0xc217('0x11')]===_0xc217('0x10');var _0x5e0acc=_0x594b0a[_0xc217('0x12')];var _0x5884b0=_0xdffca8?0x0:_0x364d65[_0xc217('0x13')];var _0x4499f2=_0xdffca8?_0x594b0a[_0xc217('0x12')]:_0x364d65[_0xc217('0x13')]+_0x364d65[_0xc217('0x11')];var _0x1e8285;if(_0x4499f2>=_0x5e0acc){_0x4499f2=_0x5e0acc;_0x1e8285=0xc8;}else{_0x1e8285=0xce;}_0x42a103[_0xc217('0xd')](_0x1e8285);return _0x42a103['set'](_0xc217('0x14'),_0x5884b0+'-'+_0x4499f2+'/'+_0x5e0acc)['json'](_0x594b0a);}return null;};}function removeEntity(_0x114b04){return function(_0x57f5a6){if(_0x57f5a6){return _0x57f5a6[_0xc217('0x15')]()[_0xc217('0x16')](function(){var _0x102c48=_0x57f5a6[_0xc217('0x17')]({'plain':!![]});var _0x12fc6b=[{'name':_0xc217('0x18'),'value':_0xc217('0x19'),'ignore':![]},{'name':'OutboundRoutes','value':_0xc217('0x1a'),'ignore':![]},{'name':_0xc217('0x1b'),'value':'internal','ignore':![]}];var _0x25e84b=_(_0x12fc6b)['filter'](_0xc217('0x1c'))[_0xc217('0x1d')](_0xc217('0x1e'))[_0xc217('0x1e')]();if(_[_0xc217('0x1f')](_0x25e84b,_0x102c48[_0xc217('0x20')])){return;}var _0x2119ab=_[_0xc217('0x21')](_0x12fc6b,[_0xc217('0x1e'),_0x102c48[_0xc217('0x20')]])['name'];return db[_0xc217('0x22')][_0xc217('0x15')]({'where':{'type':_0x2119ab,'resourceId':_0x102c48['id']}})[_0xc217('0x16')](function(){return _0x57f5a6;});})[_0xc217('0x16')](function(){_0x114b04['status'](0xcc)[_0xc217('0xe')]();});}};}function handleEntityNotFound(_0x2e678e){return function(_0x526ccd){if(!_0x526ccd){_0x2e678e[_0xc217('0xc')](0x194);}return _0x526ccd;};}function handleError(_0x15a8ea,_0x1c958f){_0x1c958f=_0x1c958f||0x1f4;return function(_0xd341aa){logger[_0xc217('0x23')](_0xd341aa[_0xc217('0x24')]);if(_0xd341aa[_0xc217('0x25')]){delete _0xd341aa[_0xc217('0x25')];}_0x15a8ea[_0xc217('0xd')](_0x1c958f)[_0xc217('0x26')](_0xd341aa);};}exports[_0xc217('0x27')]=function(_0x1fe835,_0x1c2965){var _0x808260={},_0x1b8100={},_0x584354={'count':0x0,'rows':[]};var _0x527964=_[_0xc217('0x1d')](db[_0xc217('0x28')][_0xc217('0x29')],function(_0x37c08b){return{'name':_0x37c08b[_0xc217('0x2a')],'type':_0x37c08b[_0xc217('0x20')][_0xc217('0x2b')]};});_0x1b8100[_0xc217('0x2c')]=_[_0xc217('0x1d')](_0x527964,_0xc217('0x25'));_0x1b8100['query']=_[_0xc217('0x2d')](_0x1fe835[_0xc217('0x2e')]);_0x1b8100['filters']=_[_0xc217('0x2f')](_0x1b8100[_0xc217('0x2c')],_0x1b8100[_0xc217('0x2e')]);_0x808260[_0xc217('0x30')]=_['intersection'](_0x1b8100[_0xc217('0x2c')],qs[_0xc217('0x31')](_0x1fe835[_0xc217('0x2e')][_0xc217('0x31')]));_0x808260[_0xc217('0x30')]=_0x808260['attributes']['length']?_0x808260['attributes']:_0x1b8100[_0xc217('0x2c')];if(!_0x1fe835['query'][_0xc217('0x32')](_0xc217('0x33'))){_0x808260[_0xc217('0x11')]=qs[_0xc217('0x11')](_0x1fe835[_0xc217('0x2e')]['limit']);_0x808260[_0xc217('0x13')]=qs[_0xc217('0x13')](_0x1fe835[_0xc217('0x2e')]['offset']);}_0x808260[_0xc217('0x34')]=qs['sort'](_0x1fe835[_0xc217('0x2e')]['sort']);_0x808260[_0xc217('0x35')]=qs[_0xc217('0x36')](_[_0xc217('0x37')](_0x1fe835['query'],_0x1b8100['filters']),_0x527964);if(_0x1fe835['query'][_0xc217('0x38')]){_0x808260[_0xc217('0x35')]=_[_0xc217('0x39')](_0x808260[_0xc217('0x35')],{'$or':_[_0xc217('0x1d')](_0x527964,function(_0x12aebf){if(_0x12aebf[_0xc217('0x20')]!=='VIRTUAL'){var _0x58ae5d={};_0x58ae5d[_0x12aebf['name']]={'$like':'%'+_0x1fe835['query'][_0xc217('0x38')]+'%'};return _0x58ae5d;}})});}_0x808260=_[_0xc217('0x39')]({},_0x808260,_0x1fe835[_0xc217('0x3a')]);var _0x112961={'where':_0x808260[_0xc217('0x35')]};return db[_0xc217('0x28')][_0xc217('0x12')](_0x112961)[_0xc217('0x16')](function(_0x3be03b){_0x584354[_0xc217('0x12')]=_0x3be03b;if(_0x1fe835[_0xc217('0x2e')]['includeAll']){_0x808260[_0xc217('0x3b')]=[{'all':!![]}];}return db[_0xc217('0x28')][_0xc217('0x3c')](_0x808260);})[_0xc217('0x16')](function(_0x2cc152){_0x584354['rows']=_0x2cc152;return _0x584354;})['then'](respondWithFilteredResult(_0x1c2965,_0x808260))[_0xc217('0x3d')](handleError(_0x1c2965,null));};exports['show']=function(_0x3ac26d,_0x535a07){var _0x2ae0a9={'raw':![],'where':{'id':_0x3ac26d[_0xc217('0x3e')]['id']}},_0x1cd431={};_0x1cd431[_0xc217('0x2c')]=_[_0xc217('0x2d')](db[_0xc217('0x28')][_0xc217('0x29')]);_0x1cd431[_0xc217('0x2e')]=_[_0xc217('0x2d')](_0x3ac26d[_0xc217('0x2e')]);_0x1cd431['filters']=_[_0xc217('0x2f')](_0x1cd431['model'],_0x1cd431[_0xc217('0x2e')]);_0x2ae0a9['attributes']=_[_0xc217('0x2f')](_0x1cd431[_0xc217('0x2c')],qs[_0xc217('0x31')](_0x3ac26d[_0xc217('0x2e')][_0xc217('0x31')]));_0x2ae0a9[_0xc217('0x30')]=_0x2ae0a9[_0xc217('0x30')][_0xc217('0x3f')]?_0x2ae0a9[_0xc217('0x30')]:_0x1cd431[_0xc217('0x2c')];if(_0x3ac26d[_0xc217('0x2e')]['includeAll']){_0x2ae0a9['include']=[{'all':!![]}];}_0x2ae0a9=_[_0xc217('0x39')]({},_0x2ae0a9,_0x3ac26d[_0xc217('0x3a')]);return db[_0xc217('0x28')][_0xc217('0x21')](_0x2ae0a9)[_0xc217('0x16')](handleEntityNotFound(_0x535a07,null))[_0xc217('0x16')](respondWithResult(_0x535a07,null))[_0xc217('0x3d')](handleError(_0x535a07,null));};exports[_0xc217('0x15')]=function(_0x5720dd,_0x1494b3){return db[_0xc217('0x28')][_0xc217('0x21')]({'where':{'id':_0x5720dd['params']['id']}})['then'](handleEntityNotFound(_0x1494b3,null))[_0xc217('0x16')](removeEntity(_0x1494b3,null))[_0xc217('0x3d')](handleError(_0x1494b3,null));};exports['create']=function(_0x332edd,_0x4d226a){if(_0x332edd['body']['type']==='outbound'&&!_[_0xc217('0x40')](_0x332edd[_0xc217('0x41')]['exten'],'_')){_0x332edd[_0xc217('0x41')][_0xc217('0x42')]='_'[_0xc217('0x43')](_0x332edd[_0xc217('0x41')][_0xc217('0x42')]);}return db['VoiceExtension'][_0xc217('0x44')](_0x332edd[_0xc217('0x41')],{'raw':![]})[_0xc217('0x16')](function(_0x25c48f){var _0x1846be=_0x332edd[_0xc217('0x45')][_0xc217('0x17')]({'plain':!![]});if(!_0x1846be)throw new Error(_0xc217('0x46'));if(_0x1846be['role']===_0xc217('0x45')){var _0x103c4e=_0x25c48f['get']({'plain':!![]});var _0x3e218d=[{'name':_0xc217('0x18'),'value':_0xc217('0x19')},{'name':_0xc217('0x47'),'value':_0xc217('0x1a')},{'name':_0xc217('0x1b'),'value':_0xc217('0x48')}];var _0x538284=_[_0xc217('0x21')](_0x3e218d,[_0xc217('0x1e'),_0x103c4e[_0xc217('0x20')]])[_0xc217('0x25')];return db['UserProfileSection'][_0xc217('0x21')]({'where':{'name':_0x538284,'userProfileId':_0x1846be['userProfileId']},'raw':!![]})[_0xc217('0x16')](function(_0x183c4c){if(_0x183c4c&&_0x183c4c[_0xc217('0x49')]===0x0){return db[_0xc217('0x22')][_0xc217('0x44')]({'name':_0x103c4e[_0xc217('0x25')],'resourceId':_0x103c4e['id'],'type':_0x183c4c[_0xc217('0x25')],'sectionId':_0x183c4c['id']},{})[_0xc217('0x16')](function(){return _0x25c48f;});}else{return _0x25c48f;}})[_0xc217('0x3d')](function(_0x753a08){logger[_0xc217('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x753a08);throw _0x753a08;});}return _0x25c48f;})['then'](respondWithResult(_0x4d226a,0xc9))[_0xc217('0x3d')](handleError(_0x4d226a,null));};exports['update']=function(_0x578f2b,_0x31e7ce){if(_0x578f2b[_0xc217('0x41')]['id']){delete _0x578f2b['body']['id'];}return db[_0xc217('0x28')][_0xc217('0x21')]({'where':{'id':_0x578f2b['params']['id']}})[_0xc217('0x16')](handleEntityNotFound(_0x31e7ce,null))[_0xc217('0x16')](function(_0x3e8670){if(_0x3e8670){return db['VoiceExtension'][_0xc217('0x4a')](_['pick'](_0x578f2b[_0xc217('0x41')],[_0xc217('0x42'),_0xc217('0x4b'),'description',_0xc217('0x4c'),'cutdigits','mandatoryDisposition','alias']),{'where':{'context':_0x3e8670[_0xc217('0x4b')],'exten':_0x3e8670[_0xc217('0x42')]},'individualHooks':!![]})[_0xc217('0x16')](function(_0x4ab664){return _0x4ab664;});}return null;})[_0xc217('0x16')](respondWithStatusCode(_0x31e7ce,null))[_0xc217('0x3d')](handleError(_0x31e7ce,null));};exports[_0xc217('0x4d')]=function(_0x556302,_0x533a7f){var _0x5271b2=_0x556302[_0xc217('0x3e')]['id'];var _0x367e79=_0x556302[_0xc217('0x41')];var _0x4c1376=0xc8;var _0x57c06c=null;return db[_0xc217('0x4e')][_0xc217('0x4f')]({'isolationLevel':db['sequelize'][_0xc217('0x50')][_0xc217('0x51')][_0xc217('0x52')]},function(_0x207cea){return db['VoiceExtension'][_0xc217('0x53')]({'where':{'id':_0x5271b2},'transaction':_0x207cea})[_0xc217('0x16')](function(_0x4430c4){if(_0x4430c4){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x5271b2},'transaction':_0x207cea})[_0xc217('0x16')](function(){var _0x74b39e=_['map'](_0x367e79,function(_0x3f03bc){_0x3f03bc['VoiceExtensionId']=_0x5271b2;_0x3f03bc[_0xc217('0x54')]=!![];return _0x3f03bc;});return _0x4430c4[_0xc217('0x55')](_0x74b39e);})[_0xc217('0x16')](function(_0x210398){return db[_0xc217('0x28')][_0xc217('0x56')](_0x210398,{'transaction':_0x207cea});});}else{_0x4c1376=0x194;_0x57c06c=[];}});})['then'](function(){if(_0x4c1376!==0x194){return db[_0xc217('0x28')][_0xc217('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5271b2},'order':_0xc217('0x58')})['then'](function(_0x4aaa8d){_0x57c06c=_0x4aaa8d;});}})['catch'](function(_0x369131){_0x4c1376=0x1f4;logger[_0xc217('0x23')](_0x369131[_0xc217('0x24')]);if(_0x369131[_0xc217('0x25')]){delete _0x369131[_0xc217('0x25')];}_0x57c06c=_0x369131;})['finally'](function(){if(_0x57c06c===null){_0x533a7f[_0xc217('0xc')](_0x4c1376);}else{if(_0x4c1376===0x1f4){_0x533a7f[_0xc217('0xd')](_0x4c1376)['send'](_0x57c06c);}else{_0x533a7f[_0xc217('0xd')](_0x4c1376)[_0xc217('0xf')](_0x57c06c);}}});}; \ No newline at end of file +var _0xe109=['UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','offset','undefined','limit','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','map','value','includes','type','stack','name','send','index','VoiceExtension','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','params','keys','find','body','exten','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','internal'];(function(_0xe60400,_0x4fdb19){var _0x48a1be=function(_0x233b37){while(--_0x233b37){_0xe60400['push'](_0xe60400['shift']());}};_0x48a1be(++_0x4fdb19);}(_0xe109,0x1e3));var _0x9e10=function(_0x155c8f,_0x2d7bc0){_0x155c8f=_0x155c8f-0x0;var _0x171776=_0xe109[_0x155c8f];return _0x171776;};'use strict';var _=require(_0x9e10('0x0'));var Redis=require(_0x9e10('0x1'));var qs=require(_0x9e10('0x2'));var logger=require(_0x9e10('0x3'))(_0x9e10('0x4'));var config=require(_0x9e10('0x5'));var db=require('../../mysqldb')['db'];config[_0x9e10('0x6')]=_[_0x9e10('0x7')](config[_0x9e10('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e10('0x8'))(new Redis(config['redis']));require(_0x9e10('0x9'))[_0x9e10('0xa')](socket);function respondWithStatusCode(_0x26b162,_0x2ee065){_0x2ee065=_0x2ee065||0xcc;return function(_0x42a473){if(_0x42a473){return _0x26b162[_0x9e10('0xb')](_0x2ee065);}return _0x26b162['status'](_0x2ee065)[_0x9e10('0xc')]();};}function respondWithResult(_0x15e606,_0x494d1c){_0x494d1c=_0x494d1c||0xc8;return function(_0x441d8c){if(_0x441d8c){return _0x15e606[_0x9e10('0xd')](_0x494d1c)[_0x9e10('0xe')](_0x441d8c);}};}function respondWithFilteredResult(_0x4c9f01,_0x4c5374){return function(_0x276101){if(_0x276101){var _0x286cf4=typeof _0x4c5374[_0x9e10('0xf')]===_0x9e10('0x10')&&typeof _0x4c5374[_0x9e10('0x11')]===_0x9e10('0x10');var _0x384c6c=_0x276101['count'];var _0x151032=_0x286cf4?0x0:_0x4c5374['offset'];var _0x45f76c=_0x286cf4?_0x276101['count']:_0x4c5374[_0x9e10('0xf')]+_0x4c5374['limit'];var _0x392af5;if(_0x45f76c>=_0x384c6c){_0x45f76c=_0x384c6c;_0x392af5=0xc8;}else{_0x392af5=0xce;}_0x4c9f01[_0x9e10('0xd')](_0x392af5);return _0x4c9f01['set'](_0x9e10('0x12'),_0x151032+'-'+_0x45f76c+'/'+_0x384c6c)[_0x9e10('0xe')](_0x276101);}return null;};}function removeEntity(_0x1c4742){return function(_0x47d72b){if(_0x47d72b){return _0x47d72b[_0x9e10('0x13')]()[_0x9e10('0x14')](function(){var _0x25b4af=_0x47d72b[_0x9e10('0x15')]({'plain':!![]});var _0x4f7fe4=[{'name':_0x9e10('0x16'),'value':_0x9e10('0x17'),'ignore':![]},{'name':_0x9e10('0x18'),'value':_0x9e10('0x19'),'ignore':![]},{'name':_0x9e10('0x1a'),'value':'internal','ignore':![]}];var _0x50c373=_(_0x4f7fe4)['filter']('ignore')[_0x9e10('0x1b')](_0x9e10('0x1c'))[_0x9e10('0x1c')]();if(_[_0x9e10('0x1d')](_0x50c373,_0x25b4af[_0x9e10('0x1e')])){return;}var _0x5dbbd2=_['find'](_0x4f7fe4,[_0x9e10('0x1c'),_0x25b4af[_0x9e10('0x1e')]])['name'];return db['UserProfileResource'][_0x9e10('0x13')]({'where':{'type':_0x5dbbd2,'resourceId':_0x25b4af['id']}})[_0x9e10('0x14')](function(){return _0x47d72b;});})[_0x9e10('0x14')](function(){_0x1c4742[_0x9e10('0xd')](0xcc)[_0x9e10('0xc')]();});}};}function handleEntityNotFound(_0x4048b2){return function(_0x4654c8){if(!_0x4654c8){_0x4048b2[_0x9e10('0xb')](0x194);}return _0x4654c8;};}function handleError(_0x4fa0ce,_0x2b6b44){_0x2b6b44=_0x2b6b44||0x1f4;return function(_0x14b535){logger['error'](_0x14b535[_0x9e10('0x1f')]);if(_0x14b535[_0x9e10('0x20')]){delete _0x14b535[_0x9e10('0x20')];}_0x4fa0ce[_0x9e10('0xd')](_0x2b6b44)[_0x9e10('0x21')](_0x14b535);};}exports[_0x9e10('0x22')]=function(_0x1fa9ce,_0x385e9c){var _0x7cbe69={},_0x12328f={},_0x145de6={'count':0x0,'rows':[]};var _0x569d20=_['map'](db[_0x9e10('0x23')]['rawAttributes'],function(_0xd0cbd0){return{'name':_0xd0cbd0[_0x9e10('0x24')],'type':_0xd0cbd0[_0x9e10('0x1e')][_0x9e10('0x25')]};});_0x12328f[_0x9e10('0x26')]=_[_0x9e10('0x1b')](_0x569d20,'name');_0x12328f[_0x9e10('0x27')]=_['keys'](_0x1fa9ce[_0x9e10('0x27')]);_0x12328f['filters']=_[_0x9e10('0x28')](_0x12328f[_0x9e10('0x26')],_0x12328f[_0x9e10('0x27')]);_0x7cbe69[_0x9e10('0x29')]=_[_0x9e10('0x28')](_0x12328f[_0x9e10('0x26')],qs[_0x9e10('0x2a')](_0x1fa9ce[_0x9e10('0x27')]['fields']));_0x7cbe69[_0x9e10('0x29')]=_0x7cbe69[_0x9e10('0x29')][_0x9e10('0x2b')]?_0x7cbe69[_0x9e10('0x29')]:_0x12328f[_0x9e10('0x26')];if(!_0x1fa9ce[_0x9e10('0x27')][_0x9e10('0x2c')]('nolimit')){_0x7cbe69['limit']=qs[_0x9e10('0x11')](_0x1fa9ce['query']['limit']);_0x7cbe69[_0x9e10('0xf')]=qs[_0x9e10('0xf')](_0x1fa9ce[_0x9e10('0x27')][_0x9e10('0xf')]);}_0x7cbe69[_0x9e10('0x2d')]=qs['sort'](_0x1fa9ce[_0x9e10('0x27')][_0x9e10('0x2e')]);_0x7cbe69[_0x9e10('0x2f')]=qs[_0x9e10('0x30')](_[_0x9e10('0x31')](_0x1fa9ce[_0x9e10('0x27')],_0x12328f[_0x9e10('0x30')]),_0x569d20);if(_0x1fa9ce[_0x9e10('0x27')][_0x9e10('0x32')]){_0x7cbe69[_0x9e10('0x2f')]=_['merge'](_0x7cbe69['where'],{'$or':_['map'](_0x569d20,function(_0x573ba6){if(_0x573ba6[_0x9e10('0x1e')]!==_0x9e10('0x33')){var _0x48b2b0={};_0x48b2b0[_0x573ba6['name']]={'$like':'%'+_0x1fa9ce['query'][_0x9e10('0x32')]+'%'};return _0x48b2b0;}})});}_0x7cbe69=_[_0x9e10('0x34')]({},_0x7cbe69,_0x1fa9ce[_0x9e10('0x35')]);var _0xb72f99={'where':_0x7cbe69[_0x9e10('0x2f')]};return db[_0x9e10('0x23')][_0x9e10('0x36')](_0xb72f99)[_0x9e10('0x14')](function(_0x219106){_0x145de6[_0x9e10('0x36')]=_0x219106;if(_0x1fa9ce[_0x9e10('0x27')][_0x9e10('0x37')]){_0x7cbe69['include']=[{'all':!![]}];}return db[_0x9e10('0x23')][_0x9e10('0x38')](_0x7cbe69);})['then'](function(_0x1dd727){_0x145de6[_0x9e10('0x39')]=_0x1dd727;return _0x145de6;})[_0x9e10('0x14')](respondWithFilteredResult(_0x385e9c,_0x7cbe69))[_0x9e10('0x3a')](handleError(_0x385e9c,null));};exports[_0x9e10('0x3b')]=function(_0x7f0658,_0x2f779a){var _0x9632ec={'raw':![],'where':{'id':_0x7f0658[_0x9e10('0x3c')]['id']}},_0x3869a8={};_0x3869a8['model']=_[_0x9e10('0x3d')](db[_0x9e10('0x23')]['rawAttributes']);_0x3869a8[_0x9e10('0x27')]=_[_0x9e10('0x3d')](_0x7f0658[_0x9e10('0x27')]);_0x3869a8[_0x9e10('0x30')]=_[_0x9e10('0x28')](_0x3869a8[_0x9e10('0x26')],_0x3869a8['query']);_0x9632ec[_0x9e10('0x29')]=_[_0x9e10('0x28')](_0x3869a8['model'],qs['fields'](_0x7f0658['query'][_0x9e10('0x2a')]));_0x9632ec['attributes']=_0x9632ec[_0x9e10('0x29')][_0x9e10('0x2b')]?_0x9632ec[_0x9e10('0x29')]:_0x3869a8['model'];if(_0x7f0658['query'][_0x9e10('0x37')]){_0x9632ec['include']=[{'all':!![]}];}_0x9632ec=_[_0x9e10('0x34')]({},_0x9632ec,_0x7f0658[_0x9e10('0x35')]);return db[_0x9e10('0x23')]['find'](_0x9632ec)['then'](handleEntityNotFound(_0x2f779a,null))['then'](respondWithResult(_0x2f779a,null))[_0x9e10('0x3a')](handleError(_0x2f779a,null));};exports[_0x9e10('0x13')]=function(_0x5d5af1,_0x16a360){return db[_0x9e10('0x23')][_0x9e10('0x3e')]({'where':{'id':_0x5d5af1[_0x9e10('0x3c')]['id']}})['then'](handleEntityNotFound(_0x16a360,null))[_0x9e10('0x14')](removeEntity(_0x16a360,null))[_0x9e10('0x3a')](handleError(_0x16a360,null));};exports['create']=function(_0x4d5bc5,_0x15b991){if(_0x4d5bc5[_0x9e10('0x3f')][_0x9e10('0x1e')]===_0x9e10('0x19')&&!_['startsWith'](_0x4d5bc5[_0x9e10('0x3f')][_0x9e10('0x40')],'_')){_0x4d5bc5[_0x9e10('0x3f')][_0x9e10('0x40')]='_'['concat'](_0x4d5bc5[_0x9e10('0x3f')][_0x9e10('0x40')]);}return db[_0x9e10('0x23')][_0x9e10('0x41')](_0x4d5bc5[_0x9e10('0x3f')],{'raw':![]})[_0x9e10('0x14')](function(_0x5a7aac){var _0x18a935=_0x4d5bc5[_0x9e10('0x42')][_0x9e10('0x15')]({'plain':!![]});if(!_0x18a935)throw new Error(_0x9e10('0x43'));if(_0x18a935['role']===_0x9e10('0x42')){var _0x380096=_0x5a7aac[_0x9e10('0x15')]({'plain':!![]});var _0x3cfd5e=[{'name':_0x9e10('0x16'),'value':_0x9e10('0x17')},{'name':_0x9e10('0x18'),'value':_0x9e10('0x19')},{'name':_0x9e10('0x1a'),'value':_0x9e10('0x44')}];var _0x2fdfe4=_['find'](_0x3cfd5e,[_0x9e10('0x1c'),_0x380096[_0x9e10('0x1e')]])['name'];return db[_0x9e10('0x45')][_0x9e10('0x3e')]({'where':{'name':_0x2fdfe4,'userProfileId':_0x18a935[_0x9e10('0x46')]},'raw':!![]})[_0x9e10('0x14')](function(_0x2d9416){if(_0x2d9416&&_0x2d9416['autoAssociation']===0x0){return db[_0x9e10('0x47')][_0x9e10('0x41')]({'name':_0x380096['name'],'resourceId':_0x380096['id'],'type':_0x2d9416[_0x9e10('0x20')],'sectionId':_0x2d9416['id']},{})[_0x9e10('0x14')](function(){return _0x5a7aac;});}else{return _0x5a7aac;}})[_0x9e10('0x3a')](function(_0x1f6d7d){logger['error'](_0x9e10('0x48'),_0x1f6d7d);throw _0x1f6d7d;});}return _0x5a7aac;})[_0x9e10('0x14')](respondWithResult(_0x15b991,0xc9))['catch'](handleError(_0x15b991,null));};exports[_0x9e10('0x49')]=function(_0x2a0bb3,_0x4b23ae){if(_0x2a0bb3[_0x9e10('0x3f')]['id']){delete _0x2a0bb3['body']['id'];}return db[_0x9e10('0x23')][_0x9e10('0x3e')]({'where':{'id':_0x2a0bb3['params']['id']}})['then'](handleEntityNotFound(_0x4b23ae,null))['then'](function(_0x50de01){if(_0x50de01){return db['VoiceExtension'][_0x9e10('0x49')](_[_0x9e10('0x31')](_0x2a0bb3[_0x9e10('0x3f')],[_0x9e10('0x40'),_0x9e10('0x4a'),_0x9e10('0x4b'),_0x9e10('0x4c'),_0x9e10('0x4d'),_0x9e10('0x4e'),_0x9e10('0x4f')]),{'where':{'context':_0x50de01[_0x9e10('0x4a')],'exten':_0x50de01[_0x9e10('0x40')]},'individualHooks':!![]})[_0x9e10('0x14')](function(_0x456565){return _0x456565;});}return null;})[_0x9e10('0x14')](respondWithStatusCode(_0x4b23ae,null))[_0x9e10('0x3a')](handleError(_0x4b23ae,null));};exports[_0x9e10('0x50')]=function(_0x4c2898,_0x315a88){var _0x5f48fe=_0x4c2898['params']['id'];var _0x3ff3c8=_0x4c2898['body'];var _0x1cead2=0xc8;var _0x346f99=null;return db[_0x9e10('0x51')][_0x9e10('0x52')]({'isolationLevel':db['sequelize'][_0x9e10('0x53')][_0x9e10('0x54')][_0x9e10('0x55')]},function(_0x4c4cb1){return db['VoiceExtension'][_0x9e10('0x56')]({'where':{'id':_0x5f48fe},'transaction':_0x4c4cb1})[_0x9e10('0x14')](function(_0x14ac66){if(_0x14ac66){return db[_0x9e10('0x23')][_0x9e10('0x13')]({'where':{'VoiceExtensionId':_0x5f48fe},'transaction':_0x4c4cb1})[_0x9e10('0x14')](function(){var _0x136223=_['map'](_0x3ff3c8,function(_0x103b38){_0x103b38[_0x9e10('0x57')]=_0x5f48fe;_0x103b38[_0x9e10('0x58')]=!![];return _0x103b38;});return _0x14ac66['createRouting'](_0x136223);})[_0x9e10('0x14')](function(_0xa6e1f8){return db[_0x9e10('0x23')]['bulkCreate'](_0xa6e1f8,{'transaction':_0x4c4cb1});});}else{_0x1cead2=0x194;_0x346f99=[];}});})[_0x9e10('0x14')](function(){if(_0x1cead2!==0x194){return db[_0x9e10('0x23')][_0x9e10('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5f48fe},'order':_0x9e10('0x5a')})[_0x9e10('0x14')](function(_0x5ad22c){_0x346f99=_0x5ad22c;});}})[_0x9e10('0x3a')](function(_0x123928){_0x1cead2=0x1f4;logger['error'](_0x123928[_0x9e10('0x1f')]);if(_0x123928[_0x9e10('0x20')]){delete _0x123928[_0x9e10('0x20')];}_0x346f99=_0x123928;})[_0x9e10('0x5b')](function(){if(_0x346f99===null){_0x315a88[_0x9e10('0xb')](_0x1cead2);}else{if(_0x1cead2===0x1f4){_0x315a88[_0x9e10('0xd')](_0x1cead2)['send'](_0x346f99);}else{_0x315a88[_0x9e10('0xd')](_0x1cead2)['json'](_0x346f99);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index cd00f56..deb6c7b 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 _0x619b=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0x7523bb,_0x5d3b1b){var _0x184795=function(_0x43a856){while(--_0x43a856){_0x7523bb['push'](_0x7523bb['shift']());}};_0x184795(++_0x5d3b1b);}(_0x619b,0x191));var _0xb619=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x619b[_0x110c3d];return _0x226d67;};'use strict';var EventEmitter=require(_0xb619('0x0'));var VoiceExtension=require(_0xb619('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb619('0x2'),'afterUpdate':_0xb619('0x3'),'afterDestroy':_0xb619('0x4')};function emitEvent(_0x30fb7d){return function(_0x35f8b8,_0x146a62,_0x5d4770){VoiceExtensionEvents[_0xb619('0x5')](_0x30fb7d+':'+_0x35f8b8['id'],_0x35f8b8);VoiceExtensionEvents[_0xb619('0x5')](_0x30fb7d,_0x35f8b8);_0x5d4770(null);};}for(var e in events){if(events[_0xb619('0x6')](e)){var event=events[e];VoiceExtension[_0xb619('0x7')](e,emitEvent(event));}}module[_0xb619('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xb903=['hasOwnProperty','hook','events','../../mysqldb','VoiceExtension','update','remove','emit'];(function(_0x554068,_0x1f1442){var _0x116cd1=function(_0x529244){while(--_0x529244){_0x554068['push'](_0x554068['shift']());}};_0x116cd1(++_0x1f1442);}(_0xb903,0x172));var _0x3b90=function(_0x4bf0d7,_0x286803){_0x4bf0d7=_0x4bf0d7-0x0;var _0x415e2e=_0xb903[_0x4bf0d7];return _0x415e2e;};'use strict';var EventEmitter=require(_0x3b90('0x0'));var VoiceExtension=require(_0x3b90('0x1'))['db'][_0x3b90('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x3b90('0x3'),'afterDestroy':_0x3b90('0x4')};function emitEvent(_0x3aa97e){return function(_0x357c5b,_0x13ef39,_0x42d3f0){VoiceExtensionEvents[_0x3b90('0x5')](_0x3aa97e+':'+_0x357c5b['id'],_0x357c5b);VoiceExtensionEvents[_0x3b90('0x5')](_0x3aa97e,_0x357c5b);_0x42d3f0(null);};}for(var e in events){if(events[_0x3b90('0x6')](e)){var event=events[e];VoiceExtension[_0x3b90('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 08b3f0e..452bc6f 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 _0xef39=['push','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','split','length','name','param','phone','prefix','SIP','indexOf','replace','U(xcally-mixmonitor-context)','join','isEmpty','Interval','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','hasOwnProperty','queue','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','voice_extensions','get','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set'];(function(_0x1dc9f6,_0xcfafa2){var _0x7bfc9a=function(_0x1779b9){while(--_0x1779b9){_0x1dc9f6['push'](_0x1dc9f6['shift']());}};_0x7bfc9a(++_0xcfafa2);}(_0xef39,0x92));var _0x9ef3=function(_0x1f1b36,_0x21e053){_0x1f1b36=_0x1f1b36-0x0;var _0x3938a7=_0xef39[_0x1f1b36];return _0x3938a7;};'use strict';var _=require('lodash');var attributes=require(_0x9ef3('0x0'));module[_0x9ef3('0x1')]=function(_0x363265){var _0x1b0836=_0x363265[_0x9ef3('0x2')];function _0xd297b1(_0x15e14e){var _0x162196=0x2;var _0x2c4541=[{'type':_0x15e14e[_0x9ef3('0x3')],'app':_0x9ef3('0x4'),'appdata':_0x9ef3('0x5')+_0x15e14e['type'],'context':_0x15e14e[_0x9ef3('0x6')],'exten':_0x15e14e[_0x9ef3('0x7')],'priority':_0x162196++,'VoiceExtensionId':_0x15e14e['id']},{'type':_0x15e14e[_0x9ef3('0x3')],'app':_0x15e14e[_0x9ef3('0x8')]?_0x9ef3('0x4'):_0x9ef3('0x9'),'appdata':_0x15e14e[_0x9ef3('0x8')]?_0x9ef3('0xa')+_0x15e14e[_0x9ef3('0x8')]:_0x9ef3('0xb'),'context':_0x15e14e[_0x9ef3('0x6')],'exten':_0x15e14e[_0x9ef3('0x7')],'priority':_0x162196++,'VoiceExtensionId':_0x15e14e['id']}];if(_0x15e14e[_0x9ef3('0x3')]==='inbound'){_0x2c4541[_0x9ef3('0xc')]({'type':_0x9ef3('0xd'),'app':_0x9ef3('0x4'),'appdata':_0x9ef3('0xe')+_0x15e14e['id'],'context':_0x15e14e[_0x9ef3('0x6')],'exten':_0x15e14e[_0x9ef3('0x7')],'priority':_0x162196++,'VoiceExtensionId':_0x15e14e['id']});}_0x2c4541['push']({'type':_0x15e14e[_0x9ef3('0x3')],'app':_0x9ef3('0x4'),'appdata':_0x9ef3('0xf'),'context':_0x15e14e['context'],'exten':_0x15e14e[_0x9ef3('0x7')],'priority':_0x162196++,'VoiceExtensionId':_0x15e14e['id']},{'type':_0x15e14e[_0x9ef3('0x3')],'app':'Set','appdata':_0x9ef3('0x10'),'context':_0x15e14e[_0x9ef3('0x6')],'exten':_0x15e14e[_0x9ef3('0x7')],'priority':_0x162196++,'VoiceExtensionId':_0x15e14e['id']},{'type':_0x15e14e[_0x9ef3('0x3')],'app':_0x9ef3('0x4'),'appdata':_0x9ef3('0x11'),'context':_0x15e14e['context'],'exten':_0x15e14e[_0x9ef3('0x7')],'priority':_0x162196++,'VoiceExtensionId':_0x15e14e['id']});return _0x2c4541;}function _0x355dbb(_0xe865b6){var _0x52a382=0x2;var _0x20426c=[{'type':_0x9ef3('0x12'),'app':'Set','appdata':'CDR(type)=outbound','context':_0xe865b6['context'],'exten':_0xe865b6[_0x9ef3('0x7')],'priority':_0x52a382++,'VoiceExtensionId':_0xe865b6['id']},{'type':_0x9ef3('0x12'),'app':_0xe865b6['alias']?'Set':'NoOp','appdata':_0xe865b6[_0x9ef3('0x8')]?'CDR(routeAlias)='+_0xe865b6[_0x9ef3('0x8')]:'No\x20alias\x20set','context':_0xe865b6[_0x9ef3('0x6')],'exten':_0xe865b6[_0x9ef3('0x7')],'priority':_0x52a382++,'VoiceExtensionId':_0xe865b6['id']},{'type':_0x9ef3('0x12'),'app':'Set','appdata':_0x9ef3('0x13')+(_0xe865b6[_0x9ef3('0x14')]?_0x9ef3('0x15')+_0xe865b6['cutdigits']+'}':_0x9ef3('0x16')),'context':_0xe865b6[_0x9ef3('0x6')],'exten':_0xe865b6[_0x9ef3('0x7')],'priority':_0x52a382++,'VoiceExtensionId':_0xe865b6['id']},{'type':_0x9ef3('0x12'),'app':_0x9ef3('0x4'),'appdata':_0x9ef3('0xe')+_0xe865b6['id'],'context':_0xe865b6['context'],'exten':_0xe865b6[_0x9ef3('0x7')],'priority':_0x52a382++,'VoiceExtensionId':_0xe865b6['id']},{'type':_0x9ef3('0x12'),'app':_0x9ef3('0x17'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x52a382+0x2)+_0x9ef3('0x18')+(_0x52a382+0x1)+')','context':_0xe865b6[_0x9ef3('0x6')],'exten':_0xe865b6[_0x9ef3('0x7')],'priority':_0x52a382++,'VoiceExtensionId':_0xe865b6['id']},{'type':_0x9ef3('0x12'),'app':_0x9ef3('0x4'),'appdata':_0xe865b6[_0x9ef3('0x14')]?_0x9ef3('0x19')+_0xe865b6[_0x9ef3('0x14')]+'}':_0x9ef3('0x1a'),'context':_0xe865b6[_0x9ef3('0x6')],'exten':_0xe865b6['exten'],'priority':_0x52a382++,'VoiceExtensionId':_0xe865b6['id']},{'type':_0x9ef3('0x12'),'app':'Set','appdata':_0x9ef3('0xf'),'context':_0xe865b6[_0x9ef3('0x6')],'exten':_0xe865b6[_0x9ef3('0x7')],'priority':_0x52a382++,'VoiceExtensionId':_0xe865b6['id']},{'type':_0x9ef3('0x12'),'app':_0x9ef3('0x4'),'appdata':_0x9ef3('0x10'),'context':_0xe865b6[_0x9ef3('0x6')],'exten':_0xe865b6[_0x9ef3('0x7')],'priority':_0x52a382++,'VoiceExtensionId':_0xe865b6['id']},{'type':_0x9ef3('0x12'),'app':_0x9ef3('0x4'),'appdata':'MONITOR_OPTIONS=ab','context':_0xe865b6[_0x9ef3('0x6')],'exten':_0xe865b6[_0x9ef3('0x7')],'priority':_0x52a382++,'VoiceExtensionId':_0xe865b6['id']},{'type':'outbound','app':_0x9ef3('0x4'),'appdata':_0x9ef3('0x1b')+_0xe865b6['id'],'context':_0xe865b6[_0x9ef3('0x6')],'exten':_0xe865b6['exten'],'priority':_0x52a382++,'VoiceExtensionId':_0xe865b6['id']}];if(_0xe865b6['hasOwnProperty'](_0x9ef3('0x1c'))&&_0xe865b6[_0x9ef3('0x1c')]!==_0x9ef3('0x1d')){_0x20426c['push']({'type':_0x9ef3('0x12'),'app':_0x9ef3('0x4'),'appdata':_0x9ef3('0x1e'),'context':_0xe865b6[_0x9ef3('0x6')],'exten':_0xe865b6[_0x9ef3('0x7')],'priority':_0x52a382++,'VoiceExtensionId':_0xe865b6['id']},{'type':_0x9ef3('0x12'),'app':'Set','appdata':_0x9ef3('0x1f')+_0xe865b6['recordingFormat']||'wav','context':_0xe865b6['context'],'exten':_0xe865b6[_0x9ef3('0x7')],'priority':_0x52a382++,'VoiceExtensionId':_0xe865b6['id']});}return _0x20426c;}function _0x500479(_0x3e31ad,_0x247513){var _0x35d174=[{'name':_0x9ef3('0x20'),'param':0x0},{'name':_0x9ef3('0x21'),'param':0x1},{'name':_0x9ef3('0x22'),'param':0x2},{'name':_0x9ef3('0x23'),'param':0x3}];var _0x52a6eb={};var _0x5b1549=_0x247513[_0x9ef3('0x24')](',');var _0x348263=[];for(var _0x337d46=0x0;_0x337d46<_0x35d174[_0x9ef3('0x25')];_0x337d46++){switch(_0x35d174[_0x337d46][_0x9ef3('0x26')]){case'trunk':_0x52a6eb['trunk']=_0x5b1549[_0x35d174[_0x337d46][_0x9ef3('0x27')]][_0x9ef3('0x24')]('/')[0x1];_0x52a6eb[_0x9ef3('0x28')]=_0x5b1549[_0x35d174[_0x337d46][_0x9ef3('0x27')]][_0x9ef3('0x24')]('/')[0x2];_0x52a6eb['prefix']=_0x52a6eb[_0x9ef3('0x28')]?_0x52a6eb[_0x9ef3('0x28')]['split']('$')[0x0]:undefined;_0x52a6eb[_0x9ef3('0x28')]=_0x3e31ad[_0x9ef3('0x14')]?(_0x52a6eb[_0x9ef3('0x29')]||'')+_0x9ef3('0x15')+_0x3e31ad[_0x9ef3('0x14')]+'}':(_0x52a6eb[_0x9ef3('0x29')]||'')+'${EXTEN}';_0x348263[_0x35d174[_0x337d46]['param']]=[_0x9ef3('0x2a'),_0x52a6eb['trunk'],_0x52a6eb[_0x9ef3('0x28')]]['join']('/');break;case _0x9ef3('0x22'):_0x52a6eb[_0x9ef3('0x22')]=_0x5b1549[_0x35d174[_0x337d46]['param']];if(_0x3e31ad[_0x9ef3('0x1c')]!==_0x9ef3('0x1d')){if(_0x52a6eb[_0x9ef3('0x22')][_0x9ef3('0x2b')]('U(xcally-mixmonitor-context)')<0x0){_0x52a6eb['options']+='U(xcally-mixmonitor-context)';}}else{_0x52a6eb[_0x9ef3('0x22')]=_0x52a6eb['options'][_0x9ef3('0x2c')](_0x9ef3('0x2d'),'');}_0x348263[_0x35d174[_0x337d46][_0x9ef3('0x27')]]=_0x52a6eb['options'];break;default:_0x348263[_0x35d174[_0x337d46][_0x9ef3('0x27')]]=_0x5b1549[_0x35d174[_0x337d46][_0x9ef3('0x27')]];}}return _0x348263[_0x9ef3('0x2e')](',');}function _0x2d34a1(_0x5cfc47,_0x381231,_0x4c69c1){return new Promise(function(_0x442e7e,_0x339833){var _0x4ce318=[];if(_[_0x9ef3('0x2f')](_0x381231))return _0x442e7e(_0x4ce318);_0x1b0836[_0x9ef3('0x30')]['findAll']({'attributes':['id',_0x9ef3('0x31'),_0x9ef3('0x32')],'raw':!![]})[_0x9ef3('0x33')](function(_0x293261){for(var _0x141ed0=0x0,_0x5edd22=0x0;_0x141ed0<_0x381231[_0x9ef3('0x25')];_0x141ed0++,_0x5edd22=0x0){var _0x3f0915=_0x381231[_0x141ed0];var _0x2b7bd3=[];var _0x2340f3=[];delete _0x3f0915['id'];if(_0x3f0915[_0x9ef3('0x31')]!==_0x9ef3('0x34')){_0x3f0915[_0x9ef3('0x35')]=[_0x3f0915[_0x9ef3('0x31')]];}else{_0x3f0915[_0x9ef3('0x35')]=_0x3f0915[_0x9ef3('0x32')]?_[_0x9ef3('0x36')](_[_0x9ef3('0x37')](_0x293261,{'IntervalId':_0x3f0915[_0x9ef3('0x32')]}),_0x9ef3('0x31')):[];}_0x3f0915[_0x9ef3('0x6')]=_0x5cfc47[_0x9ef3('0x6')];_0x3f0915[_0x9ef3('0x7')]=_0x5cfc47[_0x9ef3('0x7')];if(_0x3f0915[_0x9ef3('0x3')])_0x3f0915[_0x9ef3('0x3')]=_0x3f0915[_0x9ef3('0x3')][_0x9ef3('0x38')]();if(_0x5cfc47[_0x9ef3('0x3')]===_0x9ef3('0x12')){if(_0x3f0915['hasOwnProperty'](_0x9ef3('0x39'))&&_0x3f0915[_0x9ef3('0x39')]&&_0x3f0915[_0x9ef3('0x39')]!=='--'){_0x2b7bd3[_0x9ef3('0xc')]({'type':_0x3f0915[_0x9ef3('0x3')][_0x9ef3('0x38')](),'app':_0x9ef3('0x4'),'appdata':'CDR(tag)='+_0x3f0915[_0x9ef3('0x39')],'context':_0x5cfc47[_0x9ef3('0x6')],'exten':_0x5cfc47[_0x9ef3('0x7')],'priority':_0x3f0915[_0x9ef3('0x35')][_0x9ef3('0x25')]+_0x4c69c1+_0x5edd22++,'VoiceExtensionId':_0x5cfc47['id']});}_0x2b7bd3[_0x9ef3('0xc')]({'type':_0x3f0915[_0x9ef3('0x3')][_0x9ef3('0x38')](),'app':'ExecIf','appdata':_0x9ef3('0x3a')+(_0x3f0915['callerID']?_0x9ef3('0x3b')+_0x3f0915[_0x9ef3('0x3c')]+')':'NoOp(No\x20number\x20available)'),'context':_0x5cfc47[_0x9ef3('0x6')],'exten':_0x5cfc47['exten'],'priority':_0x3f0915[_0x9ef3('0x35')][_0x9ef3('0x25')]+_0x4c69c1+_0x5edd22++,'VoiceExtensionId':_0x5cfc47['id']});}else{if(_0x3f0915[_0x9ef3('0x3d')]('answer')){if([_0x9ef3('0x3e'),'playback']['includes'](_0x3f0915[_0x9ef3('0x3f')][_0x9ef3('0x38')]())&&_0x3f0915[_0x9ef3('0x40')]!==_0x9ef3('0x41')){if(_0x3f0915['answer']){_0x2b7bd3[_0x9ef3('0xc')]({'type':_0x3f0915[_0x9ef3('0x3')]['toLowerCase'](),'app':_0x9ef3('0x17'),'appdata':_0x9ef3('0x42'),'context':_0x5cfc47['context'],'exten':_0x5cfc47[_0x9ef3('0x7')],'priority':_0x3f0915[_0x9ef3('0x35')][_0x9ef3('0x25')]+_0x4c69c1+_0x5edd22++,'VoiceExtensionId':_0x5cfc47['id']});_0x2b7bd3[_0x9ef3('0xc')]({'type':_0x3f0915[_0x9ef3('0x3')]['toLowerCase'](),'app':_0x9ef3('0x4'),'appdata':_0x9ef3('0x43'),'context':_0x5cfc47[_0x9ef3('0x6')],'exten':_0x5cfc47[_0x9ef3('0x7')],'priority':_0x3f0915[_0x9ef3('0x35')][_0x9ef3('0x25')]+_0x4c69c1+_0x5edd22++,'VoiceExtensionId':_0x5cfc47['id']});}else{_0x2b7bd3[_0x9ef3('0xc')]({'type':_0x3f0915[_0x9ef3('0x3')][_0x9ef3('0x38')](),'app':_0x9ef3('0x17'),'appdata':_0x9ef3('0x44'),'context':_0x5cfc47['context'],'exten':_0x5cfc47[_0x9ef3('0x7')],'priority':_0x3f0915['intervals'][_0x9ef3('0x25')]+_0x4c69c1+_0x5edd22++,'VoiceExtensionId':_0x5cfc47['id']});_0x2b7bd3[_0x9ef3('0xc')]({'type':_0x3f0915[_0x9ef3('0x3')]['toLowerCase'](),'app':_0x9ef3('0x4'),'appdata':_0x9ef3('0x45'),'context':_0x5cfc47[_0x9ef3('0x6')],'exten':_0x5cfc47[_0x9ef3('0x7')],'priority':_0x3f0915['intervals'][_0x9ef3('0x25')]+_0x4c69c1+_0x5edd22++,'VoiceExtensionId':_0x5cfc47['id']});}}}}for(var _0x38271e=0x0;_0x38271e<_0x3f0915[_0x9ef3('0x35')]['length'];_0x38271e++){var _0x1a8eca=_0x4c69c1+_0x3f0915['intervals'][_0x9ef3('0x25')];var _0x65cf51=_0x38271e===_0x3f0915[_0x9ef3('0x35')][_0x9ef3('0x25')]-0x1?_0x4c69c1+_0x2b7bd3[_0x9ef3('0x25')]+_0x2340f3[_0x9ef3('0x25')]+0x2:_0x4c69c1+_0x38271e+0x1;_0x2b7bd3['splice'](_0x38271e,0x0,{'type':_0x5cfc47[_0x9ef3('0x3')],'app':'GotoIfTime','appdata':_0x3f0915[_0x9ef3('0x35')][_0x38271e]+'?'+_0x5cfc47['context']+_0x9ef3('0x46')+_0x1a8eca+':'+_0x5cfc47[_0x9ef3('0x6')]+_0x9ef3('0x46')+_0x65cf51,'exten':_0x5cfc47['exten'],'context':_0x5cfc47['context'],'priority':_0x4c69c1+_0x38271e,'VoiceExtensionId':_0x5cfc47['id']});}if(_0x3f0915[_0x9ef3('0x40')]===_0x9ef3('0x47'))_0x3f0915[_0x9ef3('0x48')]=_0x500479(_0x5cfc47,_0x3f0915[_0x9ef3('0x48')]);_0x3f0915[_0x9ef3('0x49')]=_0x2b7bd3[_0x9ef3('0x25')]?_[_0x9ef3('0x4a')](_0x2b7bd3)['priority']+0x1:_0x4c69c1;_0x4ce318=_[_0x9ef3('0x4b')](_0x4ce318,_0x2b7bd3,[_0x3f0915],_0x2340f3);_0x4c69c1=_[_0x9ef3('0x4a')](_0x4ce318)[_0x9ef3('0x49')]+0x1;}return _0x442e7e(_0x4ce318);})[_0x9ef3('0x4c')](function(_0x56f94d){_0x339833(_0x56f94d);});});}return _0x363265['define']('VoiceExtension',attributes,{'tableName':_0x9ef3('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xc17d87){var _0x5919d9=this[_0x9ef3('0x4e')]({'plain':!![]});var _0x52a071=_0x5919d9[_0x9ef3('0x3')]==='outbound'?_0x355dbb(_0x5919d9):_0xd297b1(_0x5919d9);return _0x2d34a1(_0x5919d9,_0xc17d87,_[_0x9ef3('0x4a')](_0x52a071)[_0x9ef3('0x49')]+0x1)[_0x9ef3('0x33')](function(_0x3ddb82){var _0x1824d5=_[_0x9ef3('0x4b')](_0x52a071,_0x3ddb82);_0x1824d5[_0x9ef3('0xc')]({'type':_0x5919d9[_0x9ef3('0x3')],'app':'Hangup','exten':_0x5919d9[_0x9ef3('0x7')],'context':_0x5919d9['context'],'priority':_[_0x9ef3('0x4a')](_0x1824d5)[_0x9ef3('0x49')]+0x1,'VoiceExtensionId':_0x5919d9['id']});return _0x1824d5;});}}});}; \ No newline at end of file +var _0x46e1=['splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority','concat','last','catch','define','VoiceExtension','get','lodash','./voiceExtension.attributes','exports','models','Set','CDR(type)=','type','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','CDR(routeid)=','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','split','length','param','phone','prefix','cutdigits','${EXTEN:','${EXTEN}','SIP','options','indexOf','U(xcally-mixmonitor-context)','join','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','includes','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1'];(function(_0x43ba80,_0x1694fd){var _0x36eeb3=function(_0x219478){while(--_0x219478){_0x43ba80['push'](_0x43ba80['shift']());}};_0x36eeb3(++_0x1694fd);}(_0x46e1,0x155));var _0x146e=function(_0x4bcefe,_0x24ce60){_0x4bcefe=_0x4bcefe-0x0;var _0x507ff1=_0x46e1[_0x4bcefe];return _0x507ff1;};'use strict';var _=require(_0x146e('0x0'));var attributes=require(_0x146e('0x1'));module[_0x146e('0x2')]=function(_0xb2e948){var _0x155784=_0xb2e948[_0x146e('0x3')];function _0x3708b1(_0x186d9b){var _0x18dab9=0x2;var _0x3bbaec=[{'type':_0x186d9b['type'],'app':_0x146e('0x4'),'appdata':_0x146e('0x5')+_0x186d9b[_0x146e('0x6')],'context':_0x186d9b[_0x146e('0x7')],'exten':_0x186d9b[_0x146e('0x8')],'priority':_0x18dab9++,'VoiceExtensionId':_0x186d9b['id']},{'type':_0x186d9b[_0x146e('0x6')],'app':_0x186d9b[_0x146e('0x9')]?'Set':_0x146e('0xa'),'appdata':_0x186d9b['alias']?_0x146e('0xb')+_0x186d9b[_0x146e('0x9')]:_0x146e('0xc'),'context':_0x186d9b[_0x146e('0x7')],'exten':_0x186d9b[_0x146e('0x8')],'priority':_0x18dab9++,'VoiceExtensionId':_0x186d9b['id']}];if(_0x186d9b[_0x146e('0x6')]==='inbound'){_0x3bbaec['push']({'type':_0x146e('0xd'),'app':_0x146e('0x4'),'appdata':_0x146e('0xe')+_0x186d9b['id'],'context':_0x186d9b[_0x146e('0x7')],'exten':_0x186d9b[_0x146e('0x8')],'priority':_0x18dab9++,'VoiceExtensionId':_0x186d9b['id']});}_0x3bbaec[_0x146e('0xf')]({'type':_0x186d9b[_0x146e('0x6')],'app':_0x146e('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x186d9b['context'],'exten':_0x186d9b[_0x146e('0x8')],'priority':_0x18dab9++,'VoiceExtensionId':_0x186d9b['id']},{'type':_0x186d9b[_0x146e('0x6')],'app':_0x146e('0x4'),'appdata':_0x146e('0x10'),'context':_0x186d9b[_0x146e('0x7')],'exten':_0x186d9b[_0x146e('0x8')],'priority':_0x18dab9++,'VoiceExtensionId':_0x186d9b['id']},{'type':_0x186d9b[_0x146e('0x6')],'app':_0x146e('0x4'),'appdata':_0x146e('0x11'),'context':_0x186d9b[_0x146e('0x7')],'exten':_0x186d9b[_0x146e('0x8')],'priority':_0x18dab9++,'VoiceExtensionId':_0x186d9b['id']});return _0x3bbaec;}function _0x55fddc(_0xcfd5f6){var _0x1a8a20=0x2;var _0x3f77d3=[{'type':_0x146e('0x12'),'app':_0x146e('0x4'),'appdata':_0x146e('0x13'),'context':_0xcfd5f6[_0x146e('0x7')],'exten':_0xcfd5f6['exten'],'priority':_0x1a8a20++,'VoiceExtensionId':_0xcfd5f6['id']},{'type':_0x146e('0x12'),'app':_0xcfd5f6['alias']?_0x146e('0x4'):_0x146e('0xa'),'appdata':_0xcfd5f6[_0x146e('0x9')]?'CDR(routeAlias)='+_0xcfd5f6[_0x146e('0x9')]:'No\x20alias\x20set','context':_0xcfd5f6[_0x146e('0x7')],'exten':_0xcfd5f6['exten'],'priority':_0x1a8a20++,'VoiceExtensionId':_0xcfd5f6['id']},{'type':_0x146e('0x12'),'app':_0x146e('0x4'),'appdata':'CDR(destination)='+(_0xcfd5f6['cutdigits']?'${EXTEN:'+_0xcfd5f6['cutdigits']+'}':'${EXTEN}'),'context':_0xcfd5f6['context'],'exten':_0xcfd5f6[_0x146e('0x8')],'priority':_0x1a8a20++,'VoiceExtensionId':_0xcfd5f6['id']},{'type':'outbound','app':_0x146e('0x4'),'appdata':_0x146e('0xe')+_0xcfd5f6['id'],'context':_0xcfd5f6[_0x146e('0x7')],'exten':_0xcfd5f6[_0x146e('0x8')],'priority':_0x1a8a20++,'VoiceExtensionId':_0xcfd5f6['id']},{'type':_0x146e('0x12'),'app':_0x146e('0x14'),'appdata':_0x146e('0x15')+(_0x1a8a20+0x2)+'):Goto('+(_0x1a8a20+0x1)+')','context':_0xcfd5f6[_0x146e('0x7')],'exten':_0xcfd5f6['exten'],'priority':_0x1a8a20++,'VoiceExtensionId':_0xcfd5f6['id']},{'type':_0x146e('0x12'),'app':'Set','appdata':_0xcfd5f6['cutdigits']?_0x146e('0x16')+_0xcfd5f6['cutdigits']+'}':_0x146e('0x17'),'context':_0xcfd5f6[_0x146e('0x7')],'exten':_0xcfd5f6[_0x146e('0x8')],'priority':_0x1a8a20++,'VoiceExtensionId':_0xcfd5f6['id']},{'type':_0x146e('0x12'),'app':_0x146e('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0xcfd5f6[_0x146e('0x7')],'exten':_0xcfd5f6[_0x146e('0x8')],'priority':_0x1a8a20++,'VoiceExtensionId':_0xcfd5f6['id']},{'type':_0x146e('0x12'),'app':_0x146e('0x4'),'appdata':_0x146e('0x10'),'context':_0xcfd5f6[_0x146e('0x7')],'exten':_0xcfd5f6[_0x146e('0x8')],'priority':_0x1a8a20++,'VoiceExtensionId':_0xcfd5f6['id']},{'type':_0x146e('0x12'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0xcfd5f6[_0x146e('0x7')],'exten':_0xcfd5f6['exten'],'priority':_0x1a8a20++,'VoiceExtensionId':_0xcfd5f6['id']},{'type':_0x146e('0x12'),'app':'Set','appdata':'outboundrouteid='+_0xcfd5f6['id'],'context':_0xcfd5f6[_0x146e('0x7')],'exten':_0xcfd5f6[_0x146e('0x8')],'priority':_0x1a8a20++,'VoiceExtensionId':_0xcfd5f6['id']}];if(_0xcfd5f6[_0x146e('0x18')](_0x146e('0x19'))&&_0xcfd5f6[_0x146e('0x19')]!==_0x146e('0x1a')){_0x3f77d3['push']({'type':_0x146e('0x12'),'app':'Set','appdata':_0x146e('0x1b'),'context':_0xcfd5f6['context'],'exten':_0xcfd5f6[_0x146e('0x8')],'priority':_0x1a8a20++,'VoiceExtensionId':_0xcfd5f6['id']},{'type':_0x146e('0x12'),'app':_0x146e('0x4'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0xcfd5f6[_0x146e('0x19')]||_0x146e('0x1c'),'context':_0xcfd5f6['context'],'exten':_0xcfd5f6[_0x146e('0x8')],'priority':_0x1a8a20++,'VoiceExtensionId':_0xcfd5f6['id']});}return _0x3f77d3;}function _0x3271e1(_0x2f438d,_0x10e007){var _0x449162=[{'name':_0x146e('0x1d'),'param':0x0},{'name':_0x146e('0x1e'),'param':0x1},{'name':'options','param':0x2},{'name':'url','param':0x3}];var _0x257b42={};var _0x31951c=_0x10e007[_0x146e('0x1f')](',');var _0x36bb15=[];for(var _0x3cbf6f=0x0;_0x3cbf6f<_0x449162[_0x146e('0x20')];_0x3cbf6f++){switch(_0x449162[_0x3cbf6f]['name']){case _0x146e('0x1d'):_0x257b42['trunk']=_0x31951c[_0x449162[_0x3cbf6f][_0x146e('0x21')]][_0x146e('0x1f')]('/')[0x1];_0x257b42[_0x146e('0x22')]=_0x31951c[_0x449162[_0x3cbf6f][_0x146e('0x21')]][_0x146e('0x1f')]('/')[0x2];_0x257b42[_0x146e('0x23')]=_0x257b42['phone']?_0x257b42['phone']['split']('$')[0x0]:undefined;_0x257b42['phone']=_0x2f438d[_0x146e('0x24')]?(_0x257b42[_0x146e('0x23')]||'')+_0x146e('0x25')+_0x2f438d[_0x146e('0x24')]+'}':(_0x257b42[_0x146e('0x23')]||'')+_0x146e('0x26');_0x36bb15[_0x449162[_0x3cbf6f][_0x146e('0x21')]]=[_0x146e('0x27'),_0x257b42[_0x146e('0x1d')],_0x257b42[_0x146e('0x22')]]['join']('/');break;case _0x146e('0x28'):_0x257b42[_0x146e('0x28')]=_0x31951c[_0x449162[_0x3cbf6f][_0x146e('0x21')]];if(_0x2f438d[_0x146e('0x19')]!==_0x146e('0x1a')){if(_0x257b42['options'][_0x146e('0x29')](_0x146e('0x2a'))<0x0){_0x257b42[_0x146e('0x28')]+=_0x146e('0x2a');}}else{_0x257b42[_0x146e('0x28')]=_0x257b42[_0x146e('0x28')]['replace'](_0x146e('0x2a'),'');}_0x36bb15[_0x449162[_0x3cbf6f][_0x146e('0x21')]]=_0x257b42[_0x146e('0x28')];break;default:_0x36bb15[_0x449162[_0x3cbf6f]['param']]=_0x31951c[_0x449162[_0x3cbf6f][_0x146e('0x21')]];}}return _0x36bb15[_0x146e('0x2b')](',');}function _0x4be842(_0x5851e1,_0x4e1747,_0x36c0df){return new Promise(function(_0x34bb2a,_0x1a8cb9){var _0x41c45b=[];if(_['isEmpty'](_0x4e1747))return _0x34bb2a(_0x41c45b);_0x155784[_0x146e('0x2c')][_0x146e('0x2d')]({'attributes':['id',_0x146e('0x2e'),_0x146e('0x2f')],'raw':!![]})[_0x146e('0x30')](function(_0x4e0d00){for(var _0x4d3b3d=0x0,_0x54bfec=0x0;_0x4d3b3d<_0x4e1747[_0x146e('0x20')];_0x4d3b3d++,_0x54bfec=0x0){var _0x1476c1=_0x4e1747[_0x4d3b3d];var _0xf50315=[];var _0x267292=[];delete _0x1476c1['id'];if(_0x1476c1['interval']!==_0x146e('0x31')){_0x1476c1['intervals']=[_0x1476c1[_0x146e('0x2e')]];}else{_0x1476c1[_0x146e('0x32')]=_0x1476c1[_0x146e('0x2f')]?_[_0x146e('0x33')](_[_0x146e('0x34')](_0x4e0d00,{'IntervalId':_0x1476c1[_0x146e('0x2f')]}),'interval'):[];}_0x1476c1[_0x146e('0x7')]=_0x5851e1[_0x146e('0x7')];_0x1476c1['exten']=_0x5851e1[_0x146e('0x8')];if(_0x1476c1[_0x146e('0x6')])_0x1476c1[_0x146e('0x6')]=_0x1476c1[_0x146e('0x6')][_0x146e('0x35')]();if(_0x5851e1[_0x146e('0x6')]==='outbound'){if(_0x1476c1[_0x146e('0x18')](_0x146e('0x36'))&&_0x1476c1[_0x146e('0x36')]&&_0x1476c1[_0x146e('0x36')]!=='--'){_0xf50315[_0x146e('0xf')]({'type':_0x1476c1[_0x146e('0x6')][_0x146e('0x35')](),'app':_0x146e('0x4'),'appdata':'CDR(tag)='+_0x1476c1[_0x146e('0x36')],'context':_0x5851e1[_0x146e('0x7')],'exten':_0x5851e1['exten'],'priority':_0x1476c1[_0x146e('0x32')][_0x146e('0x20')]+_0x36c0df+_0x54bfec++,'VoiceExtensionId':_0x5851e1['id']});}_0xf50315[_0x146e('0xf')]({'type':_0x1476c1[_0x146e('0x6')]['toLowerCase'](),'app':_0x146e('0x14'),'appdata':_0x146e('0x37')+(_0x1476c1[_0x146e('0x38')]?_0x146e('0x39')+_0x1476c1[_0x146e('0x38')]+')':_0x146e('0x3a')),'context':_0x5851e1['context'],'exten':_0x5851e1[_0x146e('0x8')],'priority':_0x1476c1[_0x146e('0x32')][_0x146e('0x20')]+_0x36c0df+_0x54bfec++,'VoiceExtensionId':_0x5851e1['id']});}else{if(_0x1476c1[_0x146e('0x18')]('answer')){if([_0x146e('0x3b'),_0x146e('0x3c')][_0x146e('0x3d')](_0x1476c1[_0x146e('0x3e')][_0x146e('0x35')]())&&_0x1476c1['appType']!==_0x146e('0x3f')){if(_0x1476c1[_0x146e('0x40')]){_0xf50315[_0x146e('0xf')]({'type':_0x1476c1[_0x146e('0x6')]['toLowerCase'](),'app':_0x146e('0x14'),'appdata':_0x146e('0x41'),'context':_0x5851e1['context'],'exten':_0x5851e1[_0x146e('0x8')],'priority':_0x1476c1[_0x146e('0x32')][_0x146e('0x20')]+_0x36c0df+_0x54bfec++,'VoiceExtensionId':_0x5851e1['id']});_0xf50315[_0x146e('0xf')]({'type':_0x1476c1['type'][_0x146e('0x35')](),'app':'Set','appdata':_0x146e('0x42'),'context':_0x5851e1[_0x146e('0x7')],'exten':_0x5851e1[_0x146e('0x8')],'priority':_0x1476c1['intervals']['length']+_0x36c0df+_0x54bfec++,'VoiceExtensionId':_0x5851e1['id']});}else{_0xf50315[_0x146e('0xf')]({'type':_0x1476c1[_0x146e('0x6')][_0x146e('0x35')](),'app':_0x146e('0x14'),'appdata':_0x146e('0x43'),'context':_0x5851e1[_0x146e('0x7')],'exten':_0x5851e1['exten'],'priority':_0x1476c1[_0x146e('0x32')]['length']+_0x36c0df+_0x54bfec++,'VoiceExtensionId':_0x5851e1['id']});_0xf50315[_0x146e('0xf')]({'type':_0x1476c1['type']['toLowerCase'](),'app':'Set','appdata':_0x146e('0x44'),'context':_0x5851e1[_0x146e('0x7')],'exten':_0x5851e1[_0x146e('0x8')],'priority':_0x1476c1[_0x146e('0x32')][_0x146e('0x20')]+_0x36c0df+_0x54bfec++,'VoiceExtensionId':_0x5851e1['id']});}}}}for(var _0x45955b=0x0;_0x45955b<_0x1476c1['intervals'][_0x146e('0x20')];_0x45955b++){var _0x2ac2fe=_0x36c0df+_0x1476c1[_0x146e('0x32')][_0x146e('0x20')];var _0x4644a7=_0x45955b===_0x1476c1['intervals']['length']-0x1?_0x36c0df+_0xf50315['length']+_0x267292[_0x146e('0x20')]+0x2:_0x36c0df+_0x45955b+0x1;_0xf50315[_0x146e('0x45')](_0x45955b,0x0,{'type':_0x5851e1[_0x146e('0x6')],'app':_0x146e('0x46'),'appdata':_0x1476c1[_0x146e('0x32')][_0x45955b]+'?'+_0x5851e1[_0x146e('0x7')]+_0x146e('0x47')+_0x2ac2fe+':'+_0x5851e1[_0x146e('0x7')]+_0x146e('0x47')+_0x4644a7,'exten':_0x5851e1[_0x146e('0x8')],'context':_0x5851e1['context'],'priority':_0x36c0df+_0x45955b,'VoiceExtensionId':_0x5851e1['id']});}if(_0x1476c1[_0x146e('0x48')]===_0x146e('0x49'))_0x1476c1['appdata']=_0x3271e1(_0x5851e1,_0x1476c1[_0x146e('0x4a')]);_0x1476c1[_0x146e('0x4b')]=_0xf50315[_0x146e('0x20')]?_['last'](_0xf50315)[_0x146e('0x4b')]+0x1:_0x36c0df;_0x41c45b=_[_0x146e('0x4c')](_0x41c45b,_0xf50315,[_0x1476c1],_0x267292);_0x36c0df=_[_0x146e('0x4d')](_0x41c45b)[_0x146e('0x4b')]+0x1;}return _0x34bb2a(_0x41c45b);})[_0x146e('0x4e')](function(_0x3063a6){_0x1a8cb9(_0x3063a6);});});}return _0xb2e948[_0x146e('0x4f')](_0x146e('0x50'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x47889a){var _0x5f12e4=this[_0x146e('0x51')]({'plain':!![]});var _0x34ca1b=_0x5f12e4[_0x146e('0x6')]==='outbound'?_0x55fddc(_0x5f12e4):_0x3708b1(_0x5f12e4);return _0x4be842(_0x5f12e4,_0x47889a,_['last'](_0x34ca1b)[_0x146e('0x4b')]+0x1)[_0x146e('0x30')](function(_0xb37c7b){var _0x3a56f7=_[_0x146e('0x4c')](_0x34ca1b,_0xb37c7b);_0x3a56f7[_0x146e('0xf')]({'type':_0x5f12e4['type'],'app':'Hangup','exten':_0x5f12e4['exten'],'context':_0x5f12e4[_0x146e('0x7')],'priority':_[_0x146e('0x4d')](_0x3a56f7)[_0x146e('0x4b')]+0x1,'VoiceExtensionId':_0x5f12e4['id']});return _0x3a56f7;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index ed1a3ed..ce1ffad 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 _0xe574=['jayson/promise','client','http','redis','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','findAll','options','raw','where','attributes','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x504b52,_0x1528ec){var _0x400792=function(_0x3ec641){while(--_0x3ec641){_0x504b52['push'](_0x504b52['shift']());}};_0x400792(++_0x1528ec);}(_0xe574,0x100));var _0x4e57=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xe574[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x4e57('0x0'));var util=require('util');var moment=require(_0x4e57('0x1'));var BPromise=require(_0x4e57('0x2'));var rs=require(_0x4e57('0x3'));var fs=require('fs');var Redis=require(_0x4e57('0x4'));var db=require(_0x4e57('0x5'))['db'];var utils=require(_0x4e57('0x6'));var logger=require(_0x4e57('0x7'))(_0x4e57('0x8'));var config=require(_0x4e57('0x9'));var jayson=require(_0x4e57('0xa'));var client=jayson[_0x4e57('0xb')][_0x4e57('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4e57('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4e57('0xd')]));require(_0x4e57('0xe'))[_0x4e57('0xf')](socket);function respondWithRpcPromise(_0x1a1afa,_0x26a43d,_0x53e34a){return new BPromise(function(_0x251aac,_0x2dbdd5){return client[_0x4e57('0x10')](_0x1a1afa,_0x53e34a)[_0x4e57('0x11')](function(_0x300430){logger[_0x4e57('0x12')](_0x4e57('0x13'),_0x26a43d,_0x4e57('0x14'));logger[_0x4e57('0x15')](_0x4e57('0x16'),_0x26a43d,_0x4e57('0x14'),JSON[_0x4e57('0x17')](_0x300430));if(_0x300430[_0x4e57('0x18')]){if(_0x300430[_0x4e57('0x18')][_0x4e57('0x19')]===0x1f4){logger[_0x4e57('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x26a43d,_0x300430[_0x4e57('0x18')]['message']);return _0x2dbdd5(_0x300430[_0x4e57('0x18')]['message']);}logger[_0x4e57('0x18')](_0x4e57('0x13'),_0x26a43d,_0x300430['error'][_0x4e57('0x1a')]);return _0x251aac(_0x300430[_0x4e57('0x18')][_0x4e57('0x1a')]);}else{logger[_0x4e57('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x26a43d,_0x4e57('0x14'));_0x251aac(_0x300430[_0x4e57('0x1b')][_0x4e57('0x1a')]);}})[_0x4e57('0x1c')](function(_0x1acce1){logger['error'](_0x4e57('0x13'),_0x26a43d,_0x1acce1);_0x2dbdd5(_0x1acce1);});});}exports[_0x4e57('0x1d')]=function(_0x7cf030){var _0x43e77f=this;return new Promise(function(_0x49c9cc,_0x372295){return db['VoiceExtension'][_0x4e57('0x1e')]({'raw':_0x7cf030['options']?_0x7cf030[_0x4e57('0x1f')][_0x4e57('0x20')]===undefined?!![]:![]:!![],'where':_0x7cf030[_0x4e57('0x1f')]?_0x7cf030[_0x4e57('0x1f')][_0x4e57('0x21')]||null:null,'attributes':_0x7cf030['options']?_0x7cf030['options'][_0x4e57('0x22')]||null:null,'limit':_0x7cf030['options']?_0x7cf030[_0x4e57('0x1f')]['limit']||null:null,'include':_0x7cf030[_0x4e57('0x1f')]?_0x7cf030[_0x4e57('0x1f')][_0x4e57('0x23')]?_[_0x4e57('0x24')](_0x7cf030[_0x4e57('0x1f')][_0x4e57('0x23')],function(_0x4fb5db){return{'model':db[_0x4fb5db[_0x4e57('0x25')]],'as':_0x4fb5db['as'],'attributes':_0x4fb5db[_0x4e57('0x22')],'include':_0x4fb5db['include']?_[_0x4e57('0x24')](_0x4fb5db[_0x4e57('0x23')],function(_0x24b9b5){return{'model':db[_0x24b9b5[_0x4e57('0x25')]],'as':_0x24b9b5['as'],'attributes':_0x24b9b5[_0x4e57('0x22')],'include':_0x24b9b5[_0x4e57('0x23')]?_[_0x4e57('0x24')](_0x24b9b5['include'],function(_0x1a26f6){return{'model':db[_0x1a26f6[_0x4e57('0x25')]],'as':_0x1a26f6['as'],'attributes':_0x1a26f6[_0x4e57('0x22')]};}):[]};}):[]};}):[]:[]})[_0x4e57('0x11')](function(_0x27a22f){logger['info']('GetVoiceExtension',_0x7cf030);logger[_0x4e57('0x15')](_0x4e57('0x1d'),_0x7cf030,JSON[_0x4e57('0x17')](_0x27a22f));_0x49c9cc(_0x27a22f);})[_0x4e57('0x1c')](function(_0x4bafa8){logger[_0x4e57('0x18')](_0x4e57('0x1d'),_0x4bafa8[_0x4e57('0x1a')],_0x7cf030);_0x372295(_0x43e77f[_0x4e57('0x18')](0x1f4,_0x4bafa8[_0x4e57('0x1a')]));});});}; \ No newline at end of file +var _0xdced=['result','VoiceExtension','findAll','options','raw','where','attributes','limit','include','model','map','debug','GetVoiceExtension','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceExtension,\x20%s,\x20%s'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xdced,0xcb));var _0xddce=function(_0x20c7a8,_0x4719b7){_0x20c7a8=_0x20c7a8-0x0;var _0x145bb0=_0xdced[_0x20c7a8];return _0x145bb0;};'use strict';var _=require('lodash');var util=require(_0xddce('0x0'));var moment=require(_0xddce('0x1'));var BPromise=require(_0xddce('0x2'));var rs=require(_0xddce('0x3'));var fs=require('fs');var Redis=require(_0xddce('0x4'));var db=require(_0xddce('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xddce('0x6'))('rpc');var config=require(_0xddce('0x7'));var jayson=require(_0xddce('0x8'));var client=jayson['client'][_0xddce('0x9')]({'port':0x232a});config['redis']=_[_0xddce('0xa')](config[_0xddce('0xb')],{'host':_0xddce('0xc'),'port':0x18eb});var socket=require(_0xddce('0xd'))(new Redis(config['redis']));require(_0xddce('0xe'))[_0xddce('0xf')](socket);function respondWithRpcPromise(_0x2186ba,_0x4fe75a,_0x49642c){return new BPromise(function(_0x3cb231,_0xe69047){return client['request'](_0x2186ba,_0x49642c)[_0xddce('0x10')](function(_0x362144){logger[_0xddce('0x11')]('VoiceExtension,\x20%s,\x20%s',_0x4fe75a,_0xddce('0x12'));logger['debug'](_0xddce('0x13'),_0x4fe75a,_0xddce('0x12'),JSON[_0xddce('0x14')](_0x362144));if(_0x362144[_0xddce('0x15')]){if(_0x362144[_0xddce('0x15')][_0xddce('0x16')]===0x1f4){logger[_0xddce('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x4fe75a,_0x362144['error'][_0xddce('0x17')]);return _0xe69047(_0x362144[_0xddce('0x15')]['message']);}logger[_0xddce('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x4fe75a,_0x362144[_0xddce('0x15')]['message']);return _0x3cb231(_0x362144[_0xddce('0x15')][_0xddce('0x17')]);}else{logger['info'](_0xddce('0x18'),_0x4fe75a,_0xddce('0x12'));_0x3cb231(_0x362144[_0xddce('0x19')][_0xddce('0x17')]);}})['catch'](function(_0x3b44ad){logger[_0xddce('0x15')](_0xddce('0x18'),_0x4fe75a,_0x3b44ad);_0xe69047(_0x3b44ad);});});}exports['GetVoiceExtension']=function(_0x452c15){var _0x4d5465=this;return new Promise(function(_0x14ab09,_0x5cb4ba){return db[_0xddce('0x1a')][_0xddce('0x1b')]({'raw':_0x452c15[_0xddce('0x1c')]?_0x452c15['options'][_0xddce('0x1d')]===undefined?!![]:![]:!![],'where':_0x452c15[_0xddce('0x1c')]?_0x452c15[_0xddce('0x1c')][_0xddce('0x1e')]||null:null,'attributes':_0x452c15[_0xddce('0x1c')]?_0x452c15[_0xddce('0x1c')][_0xddce('0x1f')]||null:null,'limit':_0x452c15[_0xddce('0x1c')]?_0x452c15['options'][_0xddce('0x20')]||null:null,'include':_0x452c15[_0xddce('0x1c')]?_0x452c15[_0xddce('0x1c')][_0xddce('0x21')]?_['map'](_0x452c15[_0xddce('0x1c')][_0xddce('0x21')],function(_0x5036fa){return{'model':db[_0x5036fa[_0xddce('0x22')]],'as':_0x5036fa['as'],'attributes':_0x5036fa[_0xddce('0x1f')],'include':_0x5036fa[_0xddce('0x21')]?_[_0xddce('0x23')](_0x5036fa[_0xddce('0x21')],function(_0x3a7d40){return{'model':db[_0x3a7d40[_0xddce('0x22')]],'as':_0x3a7d40['as'],'attributes':_0x3a7d40['attributes'],'include':_0x3a7d40['include']?_['map'](_0x3a7d40[_0xddce('0x21')],function(_0x2cac62){return{'model':db[_0x2cac62[_0xddce('0x22')]],'as':_0x2cac62['as'],'attributes':_0x2cac62[_0xddce('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xddce('0x10')](function(_0x1c6c18){logger[_0xddce('0x11')]('GetVoiceExtension',_0x452c15);logger[_0xddce('0x24')](_0xddce('0x25'),_0x452c15,JSON[_0xddce('0x14')](_0x1c6c18));_0x14ab09(_0x1c6c18);})['catch'](function(_0x5bee5a){logger[_0xddce('0x15')](_0xddce('0x25'),_0x5bee5a[_0xddce('0x17')],_0x452c15);_0x5cb4ba(_0x4d5465['error'](0x1f4,_0x5bee5a[_0xddce('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 996452b..0de2cac 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 _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x3bd0d,_0x41335e){var _0x1b72d6=function(_0x5201b9){while(--_0x5201b9){_0x3bd0d['push'](_0x3bd0d['shift']());}};_0x1b72d6(++_0x41335e);}(_0xf494,0x1c6));var _0x4f49=function(_0x1109db,_0x5c6dc7){_0x1109db=_0x1109db-0x0;var _0x27d529=_0xf494[_0x1109db];return _0x27d529;};'use strict';var VoiceExtensionEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){VoiceExtensionEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);VoiceExtensionEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file +var _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x41eb6f,_0x48ba76){var _0x349714=function(_0x4b4eaa){while(--_0x4b4eaa){_0x41eb6f['push'](_0x41eb6f['shift']());}};_0x349714(++_0x48ba76);}(_0x0295,0x1f0));var _0x5029=function(_0x7577b9,_0x4fe21c){_0x7577b9=_0x7577b9-0x0;var _0x2660c8=_0x0295[_0x7577b9];return _0x2660c8;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 4a5eb16..1739caf 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 _0x1893=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','create','put','update'];(function(_0x27462a,_0x329213){var _0x4e0e13=function(_0x365b36){while(--_0x365b36){_0x27462a['push'](_0x27462a['shift']());}};_0x4e0e13(++_0x329213);}(_0x1893,0xa2));var _0x3189=function(_0x49c640,_0x548ccf){_0x49c640=_0x49c640-0x0;var _0xb21b73=_0x1893[_0x49c640];return _0xb21b73;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3189('0x0'));var timeout=require(_0x3189('0x1'));var express=require(_0x3189('0x2'));var router=express[_0x3189('0x3')]();var fs_extra=require(_0x3189('0x4'));var auth=require(_0x3189('0x5'));var interaction=require(_0x3189('0x6'));var config=require('../../config/environment');var controller=require(_0x3189('0x7'));router[_0x3189('0x8')]('/',auth[_0x3189('0x9')](),controller[_0x3189('0xa')]);router[_0x3189('0x8')](_0x3189('0xb'),auth[_0x3189('0x9')](),controller[_0x3189('0xc')]);router['get'](_0x3189('0xd'),auth['isAuthenticated'](),controller[_0x3189('0xe')]);router['post']('/',auth[_0x3189('0x9')](),controller[_0x3189('0xf')]);router[_0x3189('0x10')](_0x3189('0xb'),auth['isAuthenticated'](),controller[_0x3189('0x11')]);router[_0x3189('0x12')](_0x3189('0xb'),auth[_0x3189('0x9')](),controller[_0x3189('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2a07=['getMessages','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages'];(function(_0x132558,_0x521d93){var _0x34f138=function(_0x3e3541){while(--_0x3e3541){_0x132558['push'](_0x132558['shift']());}};_0x34f138(++_0x521d93);}(_0x2a07,0x74));var _0x72a0=function(_0x1bd323,_0x1c16ab){_0x1bd323=_0x1bd323-0x0;var _0x13097b=_0x2a07[_0x1bd323];return _0x13097b;};'use strict';var multer=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var path=require(_0x72a0('0x2'));var timeout=require(_0x72a0('0x3'));var express=require(_0x72a0('0x4'));var router=express['Router']();var fs_extra=require(_0x72a0('0x5'));var auth=require(_0x72a0('0x6'));var interaction=require(_0x72a0('0x7'));var config=require(_0x72a0('0x8'));var controller=require(_0x72a0('0x9'));router[_0x72a0('0xa')]('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0xc')]);router[_0x72a0('0xa')](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0xe')]);router[_0x72a0('0xa')](_0x72a0('0xf'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x10')]);router['post']('/',auth[_0x72a0('0xb')](),controller[_0x72a0('0x11')]);router['put'](_0x72a0('0xd'),auth[_0x72a0('0xb')](),controller[_0x72a0('0x12')]);router[_0x72a0('0x13')](_0x72a0('0xd'),auth['isAuthenticated'](),controller[_0x72a0('0x14')]);module[_0x72a0('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index dad0654..bbe237e 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 _0x0c7e=['fullname','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','central','yes','ENUM','TIMESTAMP','INTEGER','VIRTUAL'];(function(_0x521790,_0x4174ed){var _0x168e2a=function(_0x371514){while(--_0x371514){_0x521790['push'](_0x521790['shift']());}};_0x168e2a(++_0x4174ed);}(_0x0c7e,0x16d));var _0xe0c7=function(_0x5f3706,_0x2ad13c){_0x5f3706=_0x5f3706-0x0;var _0xdd4d3e=_0x0c7e[_0x5f3706];return _0xdd4d3e;};'use strict';var Sequelize=require('sequelize');module[_0xe0c7('0x0')]={'customer_id':{'type':Sequelize[_0xe0c7('0x1')]},'context':{'type':Sequelize[_0xe0c7('0x1')],'defaultValue':_0xe0c7('0x2'),'unique':_0xe0c7('0x3')},'mailbox':{'type':Sequelize[_0xe0c7('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xe0c7('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xe0c7('0x1')],'validate':{'isEmail':!![]},'set':function(_0x529761){this[_0xe0c7('0x4')](_0xe0c7('0x5'),typeof _0x529761==='string'&&_0x529761[_0xe0c7('0x6')]()?_0x529761[_0xe0c7('0x6')]():null);}},'pager':{'type':Sequelize[_0xe0c7('0x1')]},'tz':{'type':Sequelize[_0xe0c7('0x1')],'defaultValue':_0xe0c7('0x7')},'attach':{'type':Sequelize['ENUM'](_0xe0c7('0x8'),'no'),'defaultValue':_0xe0c7('0x8'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xe0c7('0x8'),'no'),'defaultValue':_0xe0c7('0x8'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xe0c7('0x1')]},'review':{'type':Sequelize[_0xe0c7('0x9')](_0xe0c7('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xe0c7('0x9')](_0xe0c7('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xe0c7('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xe0c7('0x9')](_0xe0c7('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xe0c7('0x9')](_0xe0c7('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xe0c7('0x9')](_0xe0c7('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xe0c7('0x9')](_0xe0c7('0x8'),'no'),'defaultValue':_0xe0c7('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xe0c7('0x9')](_0xe0c7('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xe0c7('0x9')](_0xe0c7('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xe0c7('0x9')](_0xe0c7('0x8'),'no'),'defaultValue':_0xe0c7('0x8'),'allowNull':![]},'stamp':{'type':_0xe0c7('0xa')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xe0c7('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xe0c7('0xc')],'get':function(){return this['getDataValue'](_0xe0c7('0xd'))+'\x20-\x20'+this['getDataValue']('mailbox');}}}; \ No newline at end of file +var _0x3508=['email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue'];(function(_0x450617,_0x431d67){var _0x5ebadb=function(_0x6410f1){while(--_0x6410f1){_0x450617['push'](_0x450617['shift']());}};_0x5ebadb(++_0x431d67);}(_0x3508,0xd6));var _0x8350=function(_0x48498d,_0x22a1ae){_0x48498d=_0x48498d-0x0;var _0x4812d0=_0x3508[_0x48498d];return _0x4812d0;};'use strict';var Sequelize=require(_0x8350('0x0'));module[_0x8350('0x1')]={'customer_id':{'type':Sequelize[_0x8350('0x2')]},'context':{'type':Sequelize[_0x8350('0x2')],'defaultValue':_0x8350('0x3'),'unique':_0x8350('0x4')},'mailbox':{'type':Sequelize[_0x8350('0x2')],'defaultValue':'','allowNull':![],'unique':_0x8350('0x4')},'password':{'type':Sequelize[_0x8350('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8350('0x2')],'validate':{'isEmail':!![]},'set':function(_0x11f6f5){this[_0x8350('0x5')](_0x8350('0x6'),typeof _0x11f6f5===_0x8350('0x7')&&_0x11f6f5[_0x8350('0x8')]()?_0x11f6f5[_0x8350('0x8')]():null);}},'pager':{'type':Sequelize[_0x8350('0x2')]},'tz':{'type':Sequelize[_0x8350('0x2')],'defaultValue':_0x8350('0x9')},'attach':{'type':Sequelize[_0x8350('0xa')](_0x8350('0xb'),'no'),'defaultValue':_0x8350('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0x8350('0xa')](_0x8350('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x8350('0x2')]},'callback':{'type':Sequelize[_0x8350('0x2')]},'review':{'type':Sequelize[_0x8350('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8350('0xa')](_0x8350('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x8350('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8350('0xa')](_0x8350('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x8350('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x8350('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x8350('0xa')](_0x8350('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x8350('0xb'),'no'),'defaultValue':_0x8350('0xb'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8350('0xa')](_0x8350('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x8350('0xa')](_0x8350('0xb'),'no'),'defaultValue':_0x8350('0xb'),'allowNull':![]},'stamp':{'type':_0x8350('0xd')},'emailsubject':{'type':Sequelize[_0x8350('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x8350('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x8350('0xf')],'get':function(){return this[_0x8350('0x10')](_0x8350('0x11'))+_0x8350('0x12')+this[_0x8350('0x10')](_0x8350('0x13'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 5bedcb5..8f282fa 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 _0x9348=['includeAll','options','find','create','body','user','get','Voicemails','userProfileId','autoAssociation','findOne','hasOwnProperty','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','nolimit','order','sort','where','pick','filter','merge','VoiceMail','count','include','findAll','rows','catch','params','length'];(function(_0x23d196,_0x34501b){var _0x3d7030=function(_0x49d02e){while(--_0x49d02e){_0x23d196['push'](_0x23d196['shift']());}};_0x3d7030(++_0x34501b);}(_0x9348,0x10d));var _0x8934=function(_0x5afb7f,_0x35bea1){_0x5afb7f=_0x5afb7f-0x0;var _0x186c34=_0x9348[_0x5afb7f];return _0x186c34;};'use strict';var emlformat=require(_0x8934('0x0'));var rimraf=require(_0x8934('0x1'));var zipdir=require(_0x8934('0x2'));var jsonpatch=require(_0x8934('0x3'));var rp=require(_0x8934('0x4'));var moment=require('moment');var BPromise=require(_0x8934('0x5'));var Mustache=require(_0x8934('0x6'));var util=require('util');var path=require(_0x8934('0x7'));var sox=require(_0x8934('0x8'));var csv=require(_0x8934('0x9'));var ejs=require(_0x8934('0xa'));var fs=require('fs');var fs_extra=require(_0x8934('0xb'));var _=require(_0x8934('0xc'));var squel=require('squel');var crypto=require(_0x8934('0xd'));var jsforce=require(_0x8934('0xe'));var deskjs=require(_0x8934('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8934('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8934('0x11'));var hardwareService=require(_0x8934('0x12'));var logger=require(_0x8934('0x13'))(_0x8934('0x14'));var utils=require(_0x8934('0x15'));var config=require(_0x8934('0x16'));var licenseUtil=require(_0x8934('0x17'));var db=require(_0x8934('0x18'))['db'];function respondWithStatusCode(_0x4a999c,_0x68427d){_0x68427d=_0x68427d||0xcc;return function(_0x108eab){if(_0x108eab){return _0x4a999c[_0x8934('0x19')](_0x68427d);}return _0x4a999c[_0x8934('0x1a')](_0x68427d)[_0x8934('0x1b')]();};}function respondWithResult(_0xdf59f4,_0x5b560f){_0x5b560f=_0x5b560f||0xc8;return function(_0x254720){if(_0x254720){return _0xdf59f4[_0x8934('0x1a')](_0x5b560f)[_0x8934('0x1c')](_0x254720);}};}function respondWithFilteredResult(_0x94b948,_0x34d4dc){return function(_0x41e6a9){if(_0x41e6a9){var _0x2a5b04=typeof _0x34d4dc[_0x8934('0x1d')]==='undefined'&&typeof _0x34d4dc[_0x8934('0x1e')]===_0x8934('0x1f');var _0x261c78=_0x41e6a9['count'];var _0x47f25e=_0x2a5b04?0x0:_0x34d4dc['offset'];var _0x2ff9ce=_0x2a5b04?_0x41e6a9['count']:_0x34d4dc[_0x8934('0x1d')]+_0x34d4dc[_0x8934('0x1e')];var _0x14b4e4;if(_0x2ff9ce>=_0x261c78){_0x2ff9ce=_0x261c78;_0x14b4e4=0xc8;}else{_0x14b4e4=0xce;}_0x94b948[_0x8934('0x1a')](_0x14b4e4);return _0x94b948[_0x8934('0x20')]('Content-Range',_0x47f25e+'-'+_0x2ff9ce+'/'+_0x261c78)[_0x8934('0x1c')](_0x41e6a9);}return null;};}function patchUpdates(_0x5ae49f){return function(_0x476c6c){try{jsonpatch[_0x8934('0x21')](_0x476c6c,_0x5ae49f,!![]);}catch(_0x1ccbe5){return BPromise[_0x8934('0x22')](_0x1ccbe5);}return _0x476c6c[_0x8934('0x23')]();};}function saveUpdates(_0x331e18,_0x36fe20){return function(_0x4f4a9b){if(_0x4f4a9b){return _0x4f4a9b[_0x8934('0x24')](_0x331e18)[_0x8934('0x25')](function(_0x32020a){return _0x32020a;});}return null;};}function removeEntity(_0x343e09,_0x43b89a){return function(_0x5e593b){if(_0x5e593b){return _0x5e593b[_0x8934('0x26')]()[_0x8934('0x25')](function(){var _0x1b5775=_0x5e593b['get']({'plain':!![]});var _0x16cfc2='Voicemails';return db[_0x8934('0x27')][_0x8934('0x26')]({'where':{'type':_0x16cfc2,'resourceId':_0x1b5775['id']}})[_0x8934('0x25')](function(){return _0x5e593b;});})['then'](function(){_0x343e09[_0x8934('0x1a')](0xcc)[_0x8934('0x1b')]();});}};}function handleEntityNotFound(_0x310454,_0x50b89e){return function(_0x4b5780){if(!_0x4b5780){_0x310454[_0x8934('0x19')](0x194);}return _0x4b5780;};}function handleError(_0x249031,_0x358445){_0x358445=_0x358445||0x1f4;return function(_0x3d93c7){logger[_0x8934('0x28')](_0x3d93c7[_0x8934('0x29')]);if(_0x3d93c7[_0x8934('0x2a')]){delete _0x3d93c7[_0x8934('0x2a')];}_0x249031[_0x8934('0x1a')](_0x358445)[_0x8934('0x2b')](_0x3d93c7);};}exports['index']=function(_0x1d068c,_0x3e973e){var _0x54d28d={},_0x2aa18e={},_0x3d60f9={'count':0x0,'rows':[]};var _0x1a17b5=_[_0x8934('0x2c')](db['VoiceMail'][_0x8934('0x2d')],function(_0x18e881){return{'name':_0x18e881[_0x8934('0x2e')],'type':_0x18e881[_0x8934('0x2f')][_0x8934('0x30')]};});_0x2aa18e['model']=_[_0x8934('0x2c')](_0x1a17b5,'name');_0x2aa18e['query']=_[_0x8934('0x31')](_0x1d068c[_0x8934('0x32')]);_0x2aa18e[_0x8934('0x33')]=_[_0x8934('0x34')](_0x2aa18e['model'],_0x2aa18e[_0x8934('0x32')]);_0x54d28d[_0x8934('0x35')]=_[_0x8934('0x34')](_0x2aa18e[_0x8934('0x36')],qs[_0x8934('0x37')](_0x1d068c['query'][_0x8934('0x37')]));_0x54d28d[_0x8934('0x35')]=_0x54d28d['attributes']['length']?_0x54d28d[_0x8934('0x35')]:_0x2aa18e[_0x8934('0x36')];if(!_0x1d068c['query']['hasOwnProperty'](_0x8934('0x38'))){_0x54d28d[_0x8934('0x1e')]=qs[_0x8934('0x1e')](_0x1d068c[_0x8934('0x32')][_0x8934('0x1e')]);_0x54d28d[_0x8934('0x1d')]=qs[_0x8934('0x1d')](_0x1d068c[_0x8934('0x32')][_0x8934('0x1d')]);}_0x54d28d[_0x8934('0x39')]=qs[_0x8934('0x3a')](_0x1d068c['query'][_0x8934('0x3a')]);_0x54d28d[_0x8934('0x3b')]=qs['filters'](_[_0x8934('0x3c')](_0x1d068c[_0x8934('0x32')],_0x2aa18e[_0x8934('0x33')]),_0x1a17b5);if(_0x1d068c[_0x8934('0x32')][_0x8934('0x3d')]){_0x54d28d['where']=_['merge'](_0x54d28d['where'],{'$or':_[_0x8934('0x2c')](_0x1a17b5,function(_0x107d0e){if(_0x107d0e[_0x8934('0x2f')]!=='VIRTUAL'){var _0x298e3d={};_0x298e3d[_0x107d0e['name']]={'$like':'%'+_0x1d068c['query'][_0x8934('0x3d')]+'%'};return _0x298e3d;}})});}_0x54d28d=_[_0x8934('0x3e')]({},_0x54d28d,_0x1d068c['options']);var _0x52b95f={'where':_0x54d28d[_0x8934('0x3b')]};return db[_0x8934('0x3f')][_0x8934('0x40')](_0x52b95f)['then'](function(_0x46bfe7){_0x3d60f9['count']=_0x46bfe7;if(_0x1d068c[_0x8934('0x32')]['includeAll']){_0x54d28d[_0x8934('0x41')]=[{'all':!![]}];}return db[_0x8934('0x3f')][_0x8934('0x42')](_0x54d28d);})['then'](function(_0xefdfab){_0x3d60f9[_0x8934('0x43')]=_0xefdfab;return _0x3d60f9;})[_0x8934('0x25')](respondWithFilteredResult(_0x3e973e,_0x54d28d))[_0x8934('0x44')](handleError(_0x3e973e,null));};exports['show']=function(_0x2182db,_0x2ec412){var _0x3aa062={'raw':!![],'where':{'id':_0x2182db[_0x8934('0x45')]['id']}},_0x3feecb={};_0x3feecb[_0x8934('0x36')]=_[_0x8934('0x31')](db[_0x8934('0x3f')]['rawAttributes']);_0x3feecb['query']=_['keys'](_0x2182db[_0x8934('0x32')]);_0x3feecb[_0x8934('0x33')]=_['intersection'](_0x3feecb[_0x8934('0x36')],_0x3feecb['query']);_0x3aa062[_0x8934('0x35')]=_[_0x8934('0x34')](_0x3feecb['model'],qs[_0x8934('0x37')](_0x2182db[_0x8934('0x32')][_0x8934('0x37')]));_0x3aa062[_0x8934('0x35')]=_0x3aa062['attributes'][_0x8934('0x46')]?_0x3aa062[_0x8934('0x35')]:_0x3feecb['model'];if(_0x2182db[_0x8934('0x32')][_0x8934('0x47')]){_0x3aa062[_0x8934('0x41')]=[{'all':!![]}];}_0x3aa062=_[_0x8934('0x3e')]({},_0x3aa062,_0x2182db[_0x8934('0x48')]);return db[_0x8934('0x3f')][_0x8934('0x49')](_0x3aa062)[_0x8934('0x25')](handleEntityNotFound(_0x2ec412,null))[_0x8934('0x25')](respondWithResult(_0x2ec412,null))[_0x8934('0x44')](handleError(_0x2ec412,null));};exports[_0x8934('0x4a')]=function(_0xe212bc,_0x2c322d){return db[_0x8934('0x3f')][_0x8934('0x4a')](_0xe212bc[_0x8934('0x4b')],{})[_0x8934('0x25')](function(_0x248d88){var _0x53d058=_0xe212bc[_0x8934('0x4c')][_0x8934('0x4d')]({'plain':!![]});if(!_0x53d058)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53d058['role']==='user'){var _0x4bc431=_0x248d88[_0x8934('0x4d')]({'plain':!![]});var _0x15310a=_0x8934('0x4e');return db['UserProfileSection']['find']({'where':{'name':_0x15310a,'userProfileId':_0x53d058[_0x8934('0x4f')]},'raw':!![]})['then'](function(_0x4d9a43){if(_0x4d9a43&&_0x4d9a43[_0x8934('0x50')]===0x0){return db[_0x8934('0x27')][_0x8934('0x4a')]({'name':_0x4bc431[_0x8934('0x2a')],'resourceId':_0x4bc431['id'],'type':_0x4d9a43[_0x8934('0x2a')],'sectionId':_0x4d9a43['id']},{})[_0x8934('0x25')](function(){return _0x248d88;});}else{return _0x248d88;}})[_0x8934('0x44')](function(_0x575bd7){logger[_0x8934('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x575bd7);throw _0x575bd7;});}return _0x248d88;})[_0x8934('0x25')](respondWithResult(_0x2c322d,0xc9))[_0x8934('0x44')](handleError(_0x2c322d,null));};exports[_0x8934('0x24')]=function(_0x3df31e,_0x40be23){if(_0x3df31e[_0x8934('0x4b')]['id']){delete _0x3df31e[_0x8934('0x4b')]['id'];}return db[_0x8934('0x3f')]['find']({'where':{'id':_0x3df31e[_0x8934('0x45')]['id']}})[_0x8934('0x25')](handleEntityNotFound(_0x40be23,null))[_0x8934('0x25')](saveUpdates(_0x3df31e[_0x8934('0x4b')],null))[_0x8934('0x25')](respondWithResult(_0x40be23,null))['catch'](handleError(_0x40be23,null));};exports[_0x8934('0x26')]=function(_0x38d604,_0x336501){return db['VoiceMail'][_0x8934('0x49')]({'where':{'id':_0x38d604[_0x8934('0x45')]['id']}})[_0x8934('0x25')](handleEntityNotFound(_0x336501,null))['then'](removeEntity(_0x336501,null))['catch'](handleError(_0x336501,null));};exports['getMessages']=function(_0x3d5b45,_0x8e3e85,_0x3aab00){return db['VoiceMail'][_0x8934('0x51')]({'where':{'id':_0x3d5b45[_0x8934('0x45')]['id']}})['then'](handleEntityNotFound(_0x8e3e85,null))['then'](function(_0xf993d2){var _0x429769;var _0x44d892={},_0xb9e4ac={};_0xb9e4ac['model']=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0xb9e4ac[_0x8934('0x32')]=_[_0x8934('0x31')](_0x3d5b45[_0x8934('0x32')]);_0xb9e4ac[_0x8934('0x33')]=_[_0x8934('0x34')](_0xb9e4ac[_0x8934('0x36')],_0xb9e4ac['query']);_0x44d892[_0x8934('0x35')]=_[_0x8934('0x34')](_0xb9e4ac['model'],qs[_0x8934('0x37')](_0x3d5b45['query'][_0x8934('0x37')]));_0x44d892['attributes']=_0x44d892[_0x8934('0x35')][_0x8934('0x46')]?_0x44d892[_0x8934('0x35')]:_0xb9e4ac[_0x8934('0x36')];if(!_0x3d5b45[_0x8934('0x32')][_0x8934('0x52')](_0x8934('0x38'))){_0x44d892['limit']=qs['limit'](_0x3d5b45[_0x8934('0x32')][_0x8934('0x1e')]);_0x44d892[_0x8934('0x1d')]=qs[_0x8934('0x1d')](_0x3d5b45[_0x8934('0x32')][_0x8934('0x1d')]);}_0x44d892[_0x8934('0x39')]=qs[_0x8934('0x3a')](_0x3d5b45[_0x8934('0x32')][_0x8934('0x3a')]);_0x44d892[_0x8934('0x3b')]=qs[_0x8934('0x33')](_[_0x8934('0x3c')](_0x3d5b45[_0x8934('0x32')],_0xb9e4ac['filters']));if(_0x3d5b45['query'][_0x8934('0x3d')]){_0x44d892[_0x8934('0x3b')]=_[_0x8934('0x3e')](_0x44d892[_0x8934('0x3b')],{'$or':_[_0x8934('0x2c')](_0x44d892[_0x8934('0x35')],function(_0x2f8318){var _0x5ed8ff={};_0x5ed8ff[_0x2f8318]={'$like':'%'+_0x3d5b45[_0x8934('0x32')][_0x8934('0x3d')]+'%'};return _0x5ed8ff;})});}_0x44d892['where']=_[_0x8934('0x3e')](_0x44d892['where'],{'mailboxuser':_0xf993d2[_0x8934('0x53')]});_0x44d892=_[_0x8934('0x3e')]({},_0x44d892,_0x3d5b45[_0x8934('0x48')]);return db['VoiceMailMessage'][_0x8934('0x54')](_0x44d892)[_0x8934('0x25')](respondWithFilteredResult(_0x8e3e85,_0x44d892));})['catch'](handleError(_0x8e3e85,null));}; \ No newline at end of file +var _0x0fd9=['ejs','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','Voicemails','UserProfileResource','destroy','error','stack','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv'];(function(_0x32c1fc,_0x11ab2a){var _0x32caac=function(_0x4790ed){while(--_0x4790ed){_0x32c1fc['push'](_0x32c1fc['shift']());}};_0x32caac(++_0x11ab2a);}(_0x0fd9,0xa3));var _0x90fd=function(_0x5dfc2a,_0x1a953f){_0x5dfc2a=_0x5dfc2a-0x0;var _0x3f1a71=_0x0fd9[_0x5dfc2a];return _0x3f1a71;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90fd('0x0'));var zipdir=require(_0x90fd('0x1'));var jsonpatch=require(_0x90fd('0x2'));var rp=require(_0x90fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x90fd('0x4'));var util=require(_0x90fd('0x5'));var path=require(_0x90fd('0x6'));var sox=require(_0x90fd('0x7'));var csv=require(_0x90fd('0x8'));var ejs=require(_0x90fd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x90fd('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x90fd('0xb'));var toCsv=require(_0x90fd('0x8'));var querystring=require('querystring');var Papa=require(_0x90fd('0xc'));var Redis=require(_0x90fd('0xd'));var authService=require(_0x90fd('0xe'));var qs=require(_0x90fd('0xf'));var as=require(_0x90fd('0x10'));var hardwareService=require(_0x90fd('0x11'));var logger=require(_0x90fd('0x12'))(_0x90fd('0x13'));var utils=require(_0x90fd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x90fd('0x15'));var db=require(_0x90fd('0x16'))['db'];function respondWithStatusCode(_0x4e8b99,_0x1439ed){_0x1439ed=_0x1439ed||0xcc;return function(_0x37a0f8){if(_0x37a0f8){return _0x4e8b99[_0x90fd('0x17')](_0x1439ed);}return _0x4e8b99['status'](_0x1439ed)[_0x90fd('0x18')]();};}function respondWithResult(_0x48e701,_0x1cae40){_0x1cae40=_0x1cae40||0xc8;return function(_0xb402d9){if(_0xb402d9){return _0x48e701[_0x90fd('0x19')](_0x1cae40)[_0x90fd('0x1a')](_0xb402d9);}};}function respondWithFilteredResult(_0x3c5da8,_0x442a19){return function(_0x296a64){if(_0x296a64){var _0x4eb953=typeof _0x442a19['offset']===_0x90fd('0x1b')&&typeof _0x442a19[_0x90fd('0x1c')]==='undefined';var _0x130489=_0x296a64[_0x90fd('0x1d')];var _0x1fcc87=_0x4eb953?0x0:_0x442a19['offset'];var _0x3f9c76=_0x4eb953?_0x296a64[_0x90fd('0x1d')]:_0x442a19[_0x90fd('0x1e')]+_0x442a19[_0x90fd('0x1c')];var _0x251957;if(_0x3f9c76>=_0x130489){_0x3f9c76=_0x130489;_0x251957=0xc8;}else{_0x251957=0xce;}_0x3c5da8[_0x90fd('0x19')](_0x251957);return _0x3c5da8[_0x90fd('0x1f')](_0x90fd('0x20'),_0x1fcc87+'-'+_0x3f9c76+'/'+_0x130489)[_0x90fd('0x1a')](_0x296a64);}return null;};}function patchUpdates(_0x90197e){return function(_0x19e79b){try{jsonpatch[_0x90fd('0x21')](_0x19e79b,_0x90197e,!![]);}catch(_0x1fb31a){return BPromise[_0x90fd('0x22')](_0x1fb31a);}return _0x19e79b[_0x90fd('0x23')]();};}function saveUpdates(_0x493c26,_0x35ce4e){return function(_0xc4e4e2){if(_0xc4e4e2){return _0xc4e4e2[_0x90fd('0x24')](_0x493c26)[_0x90fd('0x25')](function(_0x411a6a){return _0x411a6a;});}return null;};}function removeEntity(_0x3ad6c6,_0x30f67e){return function(_0x300262){if(_0x300262){return _0x300262['destroy']()[_0x90fd('0x25')](function(){var _0x52b066=_0x300262[_0x90fd('0x26')]({'plain':!![]});var _0x18d5b3=_0x90fd('0x27');return db[_0x90fd('0x28')][_0x90fd('0x29')]({'where':{'type':_0x18d5b3,'resourceId':_0x52b066['id']}})['then'](function(){return _0x300262;});})[_0x90fd('0x25')](function(){_0x3ad6c6[_0x90fd('0x19')](0xcc)[_0x90fd('0x18')]();});}};}function handleEntityNotFound(_0x1cdc38,_0x1c3805){return function(_0x428bc2){if(!_0x428bc2){_0x1cdc38['sendStatus'](0x194);}return _0x428bc2;};}function handleError(_0x5671fc,_0xbf1c9b){_0xbf1c9b=_0xbf1c9b||0x1f4;return function(_0x170cfb){logger[_0x90fd('0x2a')](_0x170cfb[_0x90fd('0x2b')]);if(_0x170cfb[_0x90fd('0x2c')]){delete _0x170cfb['name'];}_0x5671fc['status'](_0xbf1c9b)[_0x90fd('0x2d')](_0x170cfb);};}exports[_0x90fd('0x2e')]=function(_0x228fbc,_0x3a0102){var _0x4a3ae4={},_0x59aede={},_0x12dea4={'count':0x0,'rows':[]};var _0x21a9cf=_[_0x90fd('0x2f')](db[_0x90fd('0x30')]['rawAttributes'],function(_0x2c5204){return{'name':_0x2c5204[_0x90fd('0x31')],'type':_0x2c5204[_0x90fd('0x32')][_0x90fd('0x33')]};});_0x59aede[_0x90fd('0x34')]=_[_0x90fd('0x2f')](_0x21a9cf,_0x90fd('0x2c'));_0x59aede[_0x90fd('0x35')]=_[_0x90fd('0x36')](_0x228fbc[_0x90fd('0x35')]);_0x59aede[_0x90fd('0x37')]=_[_0x90fd('0x38')](_0x59aede[_0x90fd('0x34')],_0x59aede[_0x90fd('0x35')]);_0x4a3ae4[_0x90fd('0x39')]=_[_0x90fd('0x38')](_0x59aede['model'],qs[_0x90fd('0x3a')](_0x228fbc[_0x90fd('0x35')][_0x90fd('0x3a')]));_0x4a3ae4[_0x90fd('0x39')]=_0x4a3ae4[_0x90fd('0x39')][_0x90fd('0x3b')]?_0x4a3ae4[_0x90fd('0x39')]:_0x59aede[_0x90fd('0x34')];if(!_0x228fbc[_0x90fd('0x35')][_0x90fd('0x3c')](_0x90fd('0x3d'))){_0x4a3ae4[_0x90fd('0x1c')]=qs[_0x90fd('0x1c')](_0x228fbc['query'][_0x90fd('0x1c')]);_0x4a3ae4[_0x90fd('0x1e')]=qs[_0x90fd('0x1e')](_0x228fbc[_0x90fd('0x35')]['offset']);}_0x4a3ae4[_0x90fd('0x3e')]=qs[_0x90fd('0x3f')](_0x228fbc[_0x90fd('0x35')]['sort']);_0x4a3ae4['where']=qs[_0x90fd('0x37')](_[_0x90fd('0x40')](_0x228fbc[_0x90fd('0x35')],_0x59aede[_0x90fd('0x37')]),_0x21a9cf);if(_0x228fbc[_0x90fd('0x35')][_0x90fd('0x41')]){_0x4a3ae4[_0x90fd('0x42')]=_[_0x90fd('0x43')](_0x4a3ae4[_0x90fd('0x42')],{'$or':_[_0x90fd('0x2f')](_0x21a9cf,function(_0x3265c6){if(_0x3265c6[_0x90fd('0x32')]!==_0x90fd('0x44')){var _0x47856d={};_0x47856d[_0x3265c6[_0x90fd('0x2c')]]={'$like':'%'+_0x228fbc[_0x90fd('0x35')][_0x90fd('0x41')]+'%'};return _0x47856d;}})});}_0x4a3ae4=_[_0x90fd('0x43')]({},_0x4a3ae4,_0x228fbc['options']);var _0xa5f17={'where':_0x4a3ae4[_0x90fd('0x42')]};return db[_0x90fd('0x30')]['count'](_0xa5f17)['then'](function(_0x47b8c8){_0x12dea4[_0x90fd('0x1d')]=_0x47b8c8;if(_0x228fbc[_0x90fd('0x35')][_0x90fd('0x45')]){_0x4a3ae4[_0x90fd('0x46')]=[{'all':!![]}];}return db[_0x90fd('0x30')][_0x90fd('0x47')](_0x4a3ae4);})[_0x90fd('0x25')](function(_0x733d4d){_0x12dea4[_0x90fd('0x48')]=_0x733d4d;return _0x12dea4;})[_0x90fd('0x25')](respondWithFilteredResult(_0x3a0102,_0x4a3ae4))[_0x90fd('0x49')](handleError(_0x3a0102,null));};exports[_0x90fd('0x4a')]=function(_0x4cb682,_0x386a0e){var _0x311cbf={'raw':!![],'where':{'id':_0x4cb682['params']['id']}},_0x50b722={};_0x50b722[_0x90fd('0x34')]=_[_0x90fd('0x36')](db[_0x90fd('0x30')]['rawAttributes']);_0x50b722['query']=_[_0x90fd('0x36')](_0x4cb682[_0x90fd('0x35')]);_0x50b722['filters']=_['intersection'](_0x50b722[_0x90fd('0x34')],_0x50b722[_0x90fd('0x35')]);_0x311cbf['attributes']=_['intersection'](_0x50b722[_0x90fd('0x34')],qs[_0x90fd('0x3a')](_0x4cb682[_0x90fd('0x35')]['fields']));_0x311cbf[_0x90fd('0x39')]=_0x311cbf[_0x90fd('0x39')]['length']?_0x311cbf['attributes']:_0x50b722['model'];if(_0x4cb682[_0x90fd('0x35')][_0x90fd('0x45')]){_0x311cbf['include']=[{'all':!![]}];}_0x311cbf=_[_0x90fd('0x43')]({},_0x311cbf,_0x4cb682[_0x90fd('0x4b')]);return db[_0x90fd('0x30')][_0x90fd('0x4c')](_0x311cbf)[_0x90fd('0x25')](handleEntityNotFound(_0x386a0e,null))['then'](respondWithResult(_0x386a0e,null))['catch'](handleError(_0x386a0e,null));};exports[_0x90fd('0x4d')]=function(_0x326e4d,_0x125874){return db[_0x90fd('0x30')][_0x90fd('0x4d')](_0x326e4d[_0x90fd('0x4e')],{})[_0x90fd('0x25')](function(_0x277751){var _0x31b284=_0x326e4d[_0x90fd('0x4f')]['get']({'plain':!![]});if(!_0x31b284)throw new Error(_0x90fd('0x50'));if(_0x31b284[_0x90fd('0x51')]===_0x90fd('0x4f')){var _0x38021b=_0x277751['get']({'plain':!![]});var _0x4cf061=_0x90fd('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x4cf061,'userProfileId':_0x31b284[_0x90fd('0x52')]},'raw':!![]})[_0x90fd('0x25')](function(_0x41f029){if(_0x41f029&&_0x41f029[_0x90fd('0x53')]===0x0){return db[_0x90fd('0x28')][_0x90fd('0x4d')]({'name':_0x38021b[_0x90fd('0x2c')],'resourceId':_0x38021b['id'],'type':_0x41f029['name'],'sectionId':_0x41f029['id']},{})['then'](function(){return _0x277751;});}else{return _0x277751;}})[_0x90fd('0x49')](function(_0x43d076){logger[_0x90fd('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43d076);throw _0x43d076;});}return _0x277751;})[_0x90fd('0x25')](respondWithResult(_0x125874,0xc9))[_0x90fd('0x49')](handleError(_0x125874,null));};exports[_0x90fd('0x24')]=function(_0x3494f7,_0x437abd){if(_0x3494f7[_0x90fd('0x4e')]['id']){delete _0x3494f7[_0x90fd('0x4e')]['id'];}return db[_0x90fd('0x30')]['find']({'where':{'id':_0x3494f7['params']['id']}})[_0x90fd('0x25')](handleEntityNotFound(_0x437abd,null))[_0x90fd('0x25')](saveUpdates(_0x3494f7[_0x90fd('0x4e')],null))['then'](respondWithResult(_0x437abd,null))[_0x90fd('0x49')](handleError(_0x437abd,null));};exports[_0x90fd('0x29')]=function(_0x29b880,_0x24229f){return db[_0x90fd('0x30')][_0x90fd('0x4c')]({'where':{'id':_0x29b880['params']['id']}})[_0x90fd('0x25')](handleEntityNotFound(_0x24229f,null))['then'](removeEntity(_0x24229f,null))[_0x90fd('0x49')](handleError(_0x24229f,null));};exports['getMessages']=function(_0x29b7ea,_0x461509,_0x2fb220){return db[_0x90fd('0x30')]['findOne']({'where':{'id':_0x29b7ea[_0x90fd('0x54')]['id']}})[_0x90fd('0x25')](handleEntityNotFound(_0x461509,null))[_0x90fd('0x25')](function(_0x40fea3){var _0x4586e9;var _0x15bca2={},_0x57acf6={};_0x57acf6['model']=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x57acf6[_0x90fd('0x35')]=_[_0x90fd('0x36')](_0x29b7ea[_0x90fd('0x35')]);_0x57acf6[_0x90fd('0x37')]=_[_0x90fd('0x38')](_0x57acf6['model'],_0x57acf6['query']);_0x15bca2['attributes']=_[_0x90fd('0x38')](_0x57acf6[_0x90fd('0x34')],qs['fields'](_0x29b7ea[_0x90fd('0x35')][_0x90fd('0x3a')]));_0x15bca2[_0x90fd('0x39')]=_0x15bca2[_0x90fd('0x39')][_0x90fd('0x3b')]?_0x15bca2[_0x90fd('0x39')]:_0x57acf6[_0x90fd('0x34')];if(!_0x29b7ea[_0x90fd('0x35')][_0x90fd('0x3c')]('nolimit')){_0x15bca2[_0x90fd('0x1c')]=qs[_0x90fd('0x1c')](_0x29b7ea[_0x90fd('0x35')]['limit']);_0x15bca2['offset']=qs[_0x90fd('0x1e')](_0x29b7ea[_0x90fd('0x35')]['offset']);}_0x15bca2[_0x90fd('0x3e')]=qs['sort'](_0x29b7ea['query'][_0x90fd('0x3f')]);_0x15bca2[_0x90fd('0x42')]=qs[_0x90fd('0x37')](_[_0x90fd('0x40')](_0x29b7ea[_0x90fd('0x35')],_0x57acf6[_0x90fd('0x37')]));if(_0x29b7ea[_0x90fd('0x35')][_0x90fd('0x41')]){_0x15bca2['where']=_[_0x90fd('0x43')](_0x15bca2[_0x90fd('0x42')],{'$or':_[_0x90fd('0x2f')](_0x15bca2['attributes'],function(_0x2d0f4b){var _0x4636d5={};_0x4636d5[_0x2d0f4b]={'$like':'%'+_0x29b7ea['query']['filter']+'%'};return _0x4636d5;})});}_0x15bca2[_0x90fd('0x42')]=_[_0x90fd('0x43')](_0x15bca2[_0x90fd('0x42')],{'mailboxuser':_0x40fea3['mailbox']});_0x15bca2=_[_0x90fd('0x43')]({},_0x15bca2,_0x29b7ea['options']);return db['VoiceMailMessage'][_0x90fd('0x55')](_0x15bca2)['then'](respondWithFilteredResult(_0x461509,_0x15bca2));})[_0x90fd('0x49')](handleError(_0x461509,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 853fdd4..43d418e 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 _0x5f18=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash'];(function(_0x2a1673,_0x4fd857){var _0x447362=function(_0x1288c4){while(--_0x1288c4){_0x2a1673['push'](_0x2a1673['shift']());}};_0x447362(++_0x4fd857);}(_0x5f18,0xc5));var _0x85f1=function(_0x44a12c,_0x45e781){_0x44a12c=_0x44a12c-0x0;var _0x36fca7=_0x5f18[_0x44a12c];return _0x36fca7;};'use strict';var _=require(_0x85f1('0x0'));var util=require(_0x85f1('0x1'));var logger=require(_0x85f1('0x2'))(_0x85f1('0x3'));var moment=require(_0x85f1('0x4'));var BPromise=require(_0x85f1('0x5'));var rp=require(_0x85f1('0x6'));var fs=require('fs');var path=require(_0x85f1('0x7'));var rimraf=require(_0x85f1('0x8'));var config=require(_0x85f1('0x9'));var attributes=require(_0x85f1('0xa'));module[_0x85f1('0xb')]=function(_0x28d4b5,_0x3ee87b){return _0x28d4b5[_0x85f1('0xc')](_0x85f1('0xd'),attributes,{'tableName':_0x85f1('0xe'),'paranoid':![],'indexes':[{'name':_0x85f1('0xf'),'fields':[_0x85f1('0x10'),_0x85f1('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdaa4=['exports','define','VoiceMail','mailbox_context','context','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes'];(function(_0x5c55fc,_0x5a98d5){var _0x38dc9c=function(_0x53b69d){while(--_0x53b69d){_0x5c55fc['push'](_0x5c55fc['shift']());}};_0x38dc9c(++_0x5a98d5);}(_0xdaa4,0x13d));var _0x4daa=function(_0x49f1cf,_0x5e9d54){_0x49f1cf=_0x49f1cf-0x0;var _0x567020=_0xdaa4[_0x49f1cf];return _0x567020;};'use strict';var _=require('lodash');var util=require(_0x4daa('0x0'));var logger=require(_0x4daa('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4daa('0x2'));var fs=require('fs');var path=require(_0x4daa('0x3'));var rimraf=require(_0x4daa('0x4'));var config=require(_0x4daa('0x5'));var attributes=require(_0x4daa('0x6'));module[_0x4daa('0x7')]=function(_0x21646f,_0x5bedc6){return _0x21646f[_0x4daa('0x8')](_0x4daa('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x4daa('0xa'),'fields':['mailbox',_0x4daa('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index d2c40b7..1b2059b 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 _0xa25d=['request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http'];(function(_0x5458a6,_0x1688c5){var _0x2669fc=function(_0x54ed83){while(--_0x54ed83){_0x5458a6['push'](_0x5458a6['shift']());}};_0x2669fc(++_0x1688c5);}(_0xa25d,0x1db));var _0xda25=function(_0x21f98f,_0x3a67da){_0x21f98f=_0x21f98f-0x0;var _0x48fc8d=_0xa25d[_0x21f98f];return _0x48fc8d;};'use strict';var _=require('lodash');var util=require(_0xda25('0x0'));var moment=require(_0xda25('0x1'));var BPromise=require('bluebird');var rs=require(_0xda25('0x2'));var fs=require('fs');var Redis=require(_0xda25('0x3'));var db=require(_0xda25('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xda25('0x5'));var config=require(_0xda25('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xda25('0x7')][_0xda25('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ad2da,_0x286a90,_0x579c1f){return new BPromise(function(_0x45d707,_0x1bca0b){return client[_0xda25('0x9')](_0x1ad2da,_0x579c1f)[_0xda25('0xa')](function(_0x3a9055){logger[_0xda25('0xb')](_0xda25('0xc'),_0x286a90,_0xda25('0xd'));logger[_0xda25('0xe')](_0xda25('0xf'),_0x286a90,_0xda25('0xd'),JSON[_0xda25('0x10')](_0x3a9055));if(_0x3a9055[_0xda25('0x11')]){if(_0x3a9055[_0xda25('0x11')][_0xda25('0x12')]===0x1f4){logger[_0xda25('0x11')](_0xda25('0xc'),_0x286a90,_0x3a9055[_0xda25('0x11')][_0xda25('0x13')]);return _0x1bca0b(_0x3a9055[_0xda25('0x11')][_0xda25('0x13')]);}logger['error'](_0xda25('0xc'),_0x286a90,_0x3a9055['error']['message']);return _0x45d707(_0x3a9055[_0xda25('0x11')][_0xda25('0x13')]);}else{logger['info'](_0xda25('0xc'),_0x286a90,_0xda25('0xd'));_0x45d707(_0x3a9055[_0xda25('0x14')][_0xda25('0x13')]);}})[_0xda25('0x15')](function(_0x564656){logger[_0xda25('0x11')](_0xda25('0xc'),_0x286a90,_0x564656);_0x1bca0b(_0x564656);});});} \ No newline at end of file +var _0x6969=['request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','VoiceMail,\x20%s,\x20%s'];(function(_0x38b14f,_0xd08fa8){var _0x22a324=function(_0x4bbb05){while(--_0x4bbb05){_0x38b14f['push'](_0x38b14f['shift']());}};_0x22a324(++_0xd08fa8);}(_0x6969,0x98));var _0x9696=function(_0x2ee5c3,_0x194a85){_0x2ee5c3=_0x2ee5c3-0x0;var _0x3314ee=_0x6969[_0x2ee5c3];return _0x3314ee;};'use strict';var _=require('lodash');var util=require(_0x9696('0x0'));var moment=require('moment');var BPromise=require(_0x9696('0x1'));var rs=require(_0x9696('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9696('0x3'))['db'];var utils=require(_0x9696('0x4'));var logger=require(_0x9696('0x5'))('rpc');var config=require(_0x9696('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9696('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x204e95,_0x40d65b,_0x1ec71e){return new BPromise(function(_0x7844f,_0x20d078){return client['request'](_0x204e95,_0x1ec71e)[_0x9696('0x8')](function(_0x289087){logger['info'](_0x9696('0x9'),_0x40d65b,_0x9696('0xa'));logger[_0x9696('0xb')](_0x9696('0xc'),_0x40d65b,'request\x20sent',JSON[_0x9696('0xd')](_0x289087));if(_0x289087[_0x9696('0xe')]){if(_0x289087[_0x9696('0xe')][_0x9696('0xf')]===0x1f4){logger[_0x9696('0xe')]('VoiceMail,\x20%s,\x20%s',_0x40d65b,_0x289087['error']['message']);return _0x20d078(_0x289087['error']['message']);}logger[_0x9696('0xe')](_0x9696('0x9'),_0x40d65b,_0x289087[_0x9696('0xe')][_0x9696('0x10')]);return _0x7844f(_0x289087['error'][_0x9696('0x10')]);}else{logger['info'](_0x9696('0x9'),_0x40d65b,_0x9696('0xa'));_0x7844f(_0x289087[_0x9696('0x11')][_0x9696('0x10')]);}})['catch'](function(_0x4aedf8){logger[_0x9696('0xe')](_0x9696('0x9'),_0x40d65b,_0x4aedf8);_0x20d078(_0x4aedf8);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 94dcd06..c7e573c 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 _0xa0ae=['/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','show','download','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa0ae,0x144));var _0xea0a=function(_0x2f4173,_0x1f5d89){_0x2f4173=_0x2f4173-0x0;var _0x1f9f8d=_0xa0ae[_0x2f4173];return _0x1f9f8d;};'use strict';var multer=require(_0xea0a('0x0'));var util=require(_0xea0a('0x1'));var path=require('path');var timeout=require(_0xea0a('0x2'));var express=require(_0xea0a('0x3'));var router=express[_0xea0a('0x4')]();var fs_extra=require(_0xea0a('0x5'));var auth=require(_0xea0a('0x6'));var interaction=require(_0xea0a('0x7'));var config=require(_0xea0a('0x8'));var controller=require(_0xea0a('0x9'));router[_0xea0a('0xa')]('/',auth[_0xea0a('0xb')](),controller[_0xea0a('0xc')]);router[_0xea0a('0xa')]('/:id',auth[_0xea0a('0xb')](),controller[_0xea0a('0xd')]);router[_0xea0a('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0xea0a('0xe')]);router['post']('/',auth[_0xea0a('0xb')](),controller[_0xea0a('0xf')]);router['put'](_0xea0a('0x10'),auth[_0xea0a('0xb')](),controller[_0xea0a('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xea0a('0x12')]);module[_0xea0a('0x13')]=router; \ No newline at end of file +var _0xfe3c=['../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','index','isAuthenticated','/:id/download','post','create','put','update','delete','/:id','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3892fd,_0x1757f7){var _0x167310=function(_0x1df0fa){while(--_0x1df0fa){_0x3892fd['push'](_0x3892fd['shift']());}};_0x167310(++_0x1757f7);}(_0xfe3c,0x1b2));var _0xcfe3=function(_0x2bb5c4,_0x541b15){_0x2bb5c4=_0x2bb5c4-0x0;var _0x249e25=_0xfe3c[_0x2bb5c4];return _0x249e25;};'use strict';var multer=require('multer');var util=require(_0xcfe3('0x0'));var path=require(_0xcfe3('0x1'));var timeout=require(_0xcfe3('0x2'));var express=require('express');var router=express[_0xcfe3('0x3')]();var fs_extra=require(_0xcfe3('0x4'));var auth=require(_0xcfe3('0x5'));var interaction=require(_0xcfe3('0x6'));var config=require(_0xcfe3('0x7'));var controller=require(_0xcfe3('0x8'));router[_0xcfe3('0x9')]('/',auth['isAuthenticated'](),controller[_0xcfe3('0xa')]);router['get']('/:id',auth[_0xcfe3('0xb')](),controller['show']);router[_0xcfe3('0x9')](_0xcfe3('0xc'),auth[_0xcfe3('0xb')](),controller['download']);router[_0xcfe3('0xd')]('/',auth[_0xcfe3('0xb')](),controller[_0xcfe3('0xe')]);router[_0xcfe3('0xf')]('/:id',auth[_0xcfe3('0xb')](),controller[_0xcfe3('0x10')]);router[_0xcfe3('0x11')](_0xcfe3('0x12'),auth[_0xcfe3('0xb')](),controller[_0xcfe3('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 78a6b4d..603366a 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 _0x301d=['sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','TIMESTAMP','literal'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x301d,0x14d));var _0xd301=function(_0x123ca3,_0x29ad59){_0x123ca3=_0x123ca3-0x0;var _0x416acd=_0x301d[_0x123ca3];return _0x416acd;};'use strict';var Sequelize=require(_0xd301('0x0'));module[_0xd301('0x1')]={'name':{'type':Sequelize[_0xd301('0x2')],'get':function(_0x531b1b){return this[_0xd301('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xd301('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xd301('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xd301('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xd301('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xd301('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xd301('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xd301('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xd301('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xd301('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xd301('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xd301('0x7'),'defaultValue':Sequelize[_0xd301('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x0076=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','INTEGER','STRING','long'];(function(_0x545238,_0xb68eae){var _0x10a6c8=function(_0x4acaec){while(--_0x4acaec){_0x545238['push'](_0x545238['shift']());}};_0x10a6c8(++_0xb68eae);}(_0x0076,0xea));var _0x6007=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x0076[_0x1969a7];return _0x3d665f;};'use strict';var Sequelize=require(_0x6007('0x0'));module[_0x6007('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x352a0d){return this[_0x6007('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x6007('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x6007('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x6007('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x6007('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x6007('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x6007('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x6007('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6007('0x4')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x6007('0x6')](_0x6007('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 0cf83fd..98d1e2c 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 _0xeef2=['merge','VIRTUAL','options','include','findAll','rows','catch','params','attributes','includeAll','create','body','find','recording','Sequelize','ValidationError','audio/wav','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','request-promise','bluebird','util','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x8a7e38,_0x473a5d){var _0x228609=function(_0x5dcb5c){while(--_0x5dcb5c){_0x8a7e38['push'](_0x8a7e38['shift']());}};_0x228609(++_0x473a5d);}(_0xeef2,0x10f));var _0x2eef=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xeef2[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0x2eef('0x0'));var rimraf=require(_0x2eef('0x1'));var zipdir=require(_0x2eef('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2eef('0x3'));var moment=require('moment');var BPromise=require(_0x2eef('0x4'));var Mustache=require('mustache');var util=require(_0x2eef('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x2eef('0x6'));var ejs=require(_0x2eef('0x7'));var fs=require('fs');var fs_extra=require(_0x2eef('0x8'));var _=require(_0x2eef('0x9'));var squel=require(_0x2eef('0xa'));var crypto=require(_0x2eef('0xb'));var jsforce=require(_0x2eef('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2eef('0x6'));var querystring=require(_0x2eef('0xd'));var Papa=require(_0x2eef('0xe'));var Redis=require(_0x2eef('0xf'));var authService=require(_0x2eef('0x10'));var qs=require(_0x2eef('0x11'));var as=require(_0x2eef('0x12'));var hardwareService=require(_0x2eef('0x13'));var logger=require(_0x2eef('0x14'))(_0x2eef('0x15'));var utils=require('../../config/utils');var config=require(_0x2eef('0x16'));var licenseUtil=require(_0x2eef('0x17'));var db=require(_0x2eef('0x18'))['db'];function respondWithStatusCode(_0x37575c,_0xdb3184){_0xdb3184=_0xdb3184||0xcc;return function(_0x4c1345){if(_0x4c1345){return _0x37575c[_0x2eef('0x19')](_0xdb3184);}return _0x37575c[_0x2eef('0x1a')](_0xdb3184)[_0x2eef('0x1b')]();};}function respondWithResult(_0x5c553b,_0x52a4e5){_0x52a4e5=_0x52a4e5||0xc8;return function(_0x285b87){if(_0x285b87){return _0x5c553b['status'](_0x52a4e5)[_0x2eef('0x1c')](_0x285b87);}};}function respondWithFilteredResult(_0x396456,_0xae1dae){return function(_0x3e7e0d){if(_0x3e7e0d){var _0x56658a=typeof _0xae1dae[_0x2eef('0x1d')]===_0x2eef('0x1e')&&typeof _0xae1dae['limit']==='undefined';var _0x4da22a=_0x3e7e0d[_0x2eef('0x1f')];var _0x4a22fb=_0x56658a?0x0:_0xae1dae[_0x2eef('0x1d')];var _0x2d1b08=_0x56658a?_0x3e7e0d[_0x2eef('0x1f')]:_0xae1dae[_0x2eef('0x1d')]+_0xae1dae[_0x2eef('0x20')];var _0x25a6a1;if(_0x2d1b08>=_0x4da22a){_0x2d1b08=_0x4da22a;_0x25a6a1=0xc8;}else{_0x25a6a1=0xce;}_0x396456[_0x2eef('0x1a')](_0x25a6a1);return _0x396456[_0x2eef('0x21')](_0x2eef('0x22'),_0x4a22fb+'-'+_0x2d1b08+'/'+_0x4da22a)['json'](_0x3e7e0d);}return null;};}function patchUpdates(_0xf981b3){return function(_0x27892c){try{jsonpatch[_0x2eef('0x23')](_0x27892c,_0xf981b3,!![]);}catch(_0x4b028a){return BPromise[_0x2eef('0x24')](_0x4b028a);}return _0x27892c[_0x2eef('0x25')]();};}function saveUpdates(_0x13ac03,_0x3adbc9){return function(_0x24cc1b){if(_0x24cc1b){return _0x24cc1b[_0x2eef('0x26')](_0x13ac03)['then'](function(_0x285ff5){return _0x285ff5;});}return null;};}function removeEntity(_0x1b0875,_0x3f3d2a){return function(_0x981d6e){if(_0x981d6e){return _0x981d6e[_0x2eef('0x27')]()[_0x2eef('0x28')](function(){_0x1b0875[_0x2eef('0x1a')](0xcc)[_0x2eef('0x1b')]();});}};}function handleEntityNotFound(_0x49cd5d,_0x182459){return function(_0x578748){if(!_0x578748){_0x49cd5d[_0x2eef('0x19')](0x194);}return _0x578748;};}function handleError(_0x38018c,_0x21237a){_0x21237a=_0x21237a||0x1f4;return function(_0x1655e8){logger[_0x2eef('0x29')](_0x1655e8[_0x2eef('0x2a')]);if(_0x1655e8[_0x2eef('0x2b')]){delete _0x1655e8[_0x2eef('0x2b')];}_0x38018c['status'](_0x21237a)[_0x2eef('0x2c')](_0x1655e8);};}exports[_0x2eef('0x2d')]=function(_0x51a3df,_0x465fcf){var _0x2b08e3={},_0x114f6d={},_0x2b7a34={'count':0x0,'rows':[]};var _0x38b51d=_[_0x2eef('0x2e')](db[_0x2eef('0x2f')][_0x2eef('0x30')],function(_0x20a5c8){return{'name':_0x20a5c8[_0x2eef('0x31')],'type':_0x20a5c8[_0x2eef('0x32')][_0x2eef('0x33')]};});_0x114f6d[_0x2eef('0x34')]=_[_0x2eef('0x35')](_[_0x2eef('0x2e')](_0x38b51d,_0x2eef('0x2b')),[_0x2eef('0x2b')]);_0x114f6d[_0x2eef('0x36')]=_[_0x2eef('0x37')](_0x51a3df['query']);_0x114f6d[_0x2eef('0x38')]=_[_0x2eef('0x39')](_0x114f6d[_0x2eef('0x34')],_0x114f6d[_0x2eef('0x36')]);_0x2b08e3['attributes']=_[_0x2eef('0x39')](_0x114f6d[_0x2eef('0x34')],qs[_0x2eef('0x3a')](_0x51a3df[_0x2eef('0x36')][_0x2eef('0x3a')]));_0x2b08e3['attributes']=_0x2b08e3['attributes']['length']?_0x2b08e3['attributes']:_0x114f6d[_0x2eef('0x34')];if(!_0x51a3df[_0x2eef('0x36')][_0x2eef('0x3b')](_0x2eef('0x3c'))){_0x2b08e3['limit']=qs[_0x2eef('0x20')](_0x51a3df[_0x2eef('0x36')]['limit']);_0x2b08e3[_0x2eef('0x1d')]=qs[_0x2eef('0x1d')](_0x51a3df['query'][_0x2eef('0x1d')]);}_0x2b08e3['order']=qs[_0x2eef('0x3d')](_0x51a3df[_0x2eef('0x36')]['sort']);_0x2b08e3[_0x2eef('0x3e')]=qs[_0x2eef('0x38')](_[_0x2eef('0x3f')](_0x51a3df[_0x2eef('0x36')],_0x114f6d[_0x2eef('0x38')]),_0x38b51d);if(_0x51a3df[_0x2eef('0x36')][_0x2eef('0x40')]){_0x2b08e3[_0x2eef('0x3e')]=_[_0x2eef('0x41')](_0x2b08e3[_0x2eef('0x3e')],{'$or':_[_0x2eef('0x2e')](_0x38b51d,function(_0xdb314){if(_0xdb314[_0x2eef('0x32')]!==_0x2eef('0x42')){var _0x413e78={};_0x413e78[_0xdb314[_0x2eef('0x2b')]]={'$like':'%'+_0x51a3df[_0x2eef('0x36')][_0x2eef('0x40')]+'%'};return _0x413e78;}})});}_0x2b08e3=_['merge']({},_0x2b08e3,_0x51a3df[_0x2eef('0x43')]);var _0x18b270={'where':_0x2b08e3[_0x2eef('0x3e')]};return db[_0x2eef('0x2f')]['count'](_0x18b270)[_0x2eef('0x28')](function(_0x3bb7e0){_0x2b7a34[_0x2eef('0x1f')]=_0x3bb7e0;if(_0x51a3df['query']['includeAll']){_0x2b08e3[_0x2eef('0x44')]=[{'all':!![]}];}return db[_0x2eef('0x2f')][_0x2eef('0x45')](_0x2b08e3);})[_0x2eef('0x28')](function(_0x50d4e3){_0x2b7a34[_0x2eef('0x46')]=_0x50d4e3;return _0x2b7a34;})['then'](respondWithFilteredResult(_0x465fcf,_0x2b08e3))[_0x2eef('0x47')](handleError(_0x465fcf,null));};exports['show']=function(_0x508f33,_0x4f7f00){var _0x1842c4={'raw':!![],'where':{'id':_0x508f33[_0x2eef('0x48')]['id']}},_0x3f54a4={};_0x3f54a4[_0x2eef('0x34')]=_[_0x2eef('0x37')](db[_0x2eef('0x2f')][_0x2eef('0x30')]);_0x3f54a4[_0x2eef('0x36')]=_['keys'](_0x508f33[_0x2eef('0x36')]);_0x3f54a4[_0x2eef('0x38')]=_[_0x2eef('0x39')](_0x3f54a4['model'],_0x3f54a4[_0x2eef('0x36')]);_0x1842c4[_0x2eef('0x49')]=_[_0x2eef('0x39')](_0x3f54a4[_0x2eef('0x34')],qs[_0x2eef('0x3a')](_0x508f33[_0x2eef('0x36')][_0x2eef('0x3a')]));_0x1842c4[_0x2eef('0x49')]=_0x1842c4['attributes']['length']?_0x1842c4['attributes']:_0x3f54a4[_0x2eef('0x34')];if(_0x508f33['query'][_0x2eef('0x4a')]){_0x1842c4[_0x2eef('0x44')]=[{'all':!![]}];}_0x1842c4=_[_0x2eef('0x41')]({},_0x1842c4,_0x508f33['options']);return db[_0x2eef('0x2f')]['find'](_0x1842c4)[_0x2eef('0x28')](handleEntityNotFound(_0x4f7f00,null))[_0x2eef('0x28')](respondWithResult(_0x4f7f00,null))['catch'](handleError(_0x4f7f00,null));};exports[_0x2eef('0x4b')]=function(_0x542a13,_0x590f2a){return db['VoiceMailMessage'][_0x2eef('0x4b')](_0x542a13[_0x2eef('0x4c')],{})['then'](respondWithResult(_0x590f2a,0xc9))[_0x2eef('0x47')](handleError(_0x590f2a,null));};exports[_0x2eef('0x26')]=function(_0x3f964e,_0x4d9476){if(_0x3f964e['body']['id']){delete _0x3f964e[_0x2eef('0x4c')]['id'];}return db[_0x2eef('0x2f')][_0x2eef('0x4d')]({'where':{'id':_0x3f964e['params']['id']}})[_0x2eef('0x28')](handleEntityNotFound(_0x4d9476,null))['then'](saveUpdates(_0x3f964e['body'],null))[_0x2eef('0x28')](respondWithResult(_0x4d9476,null))['catch'](handleError(_0x4d9476,null));};exports[_0x2eef('0x27')]=function(_0x5a48ca,_0x51a894){return db[_0x2eef('0x2f')][_0x2eef('0x4d')]({'where':{'id':_0x5a48ca[_0x2eef('0x48')]['id']}})['then'](handleEntityNotFound(_0x51a894,null))[_0x2eef('0x28')](removeEntity(_0x51a894,null))[_0x2eef('0x47')](handleError(_0x51a894,null));};exports['download']=function(_0xa98ef3,_0x4c92dd,_0x24855c){return db['VoiceMailMessage'][_0x2eef('0x4d')]({'where':{'id':_0xa98ef3['params']['id']},'attributes':['id',_0x2eef('0x4e'),'msg_id']})[_0x2eef('0x28')](handleEntityNotFound(_0x4c92dd,null))[_0x2eef('0x28')](function(_0x5eecc1){if(_0x5eecc1){if(!_0x5eecc1[_0x2eef('0x4e')]){throw new db[(_0x2eef('0x4f'))][(_0x2eef('0x50'))]('VoiceMailMessage\x20not\x20found');}var _0x1e6b53={'Content-Type':_0x2eef('0x51'),'Content-Disposition':'attachment'};if(_0x5eecc1['msg_id']){_0x1e6b53['Content-Disposition']=_0x2eef('0x52')+_0x5eecc1['msg_id']+_0x2eef('0x53');}_0x4c92dd[_0x2eef('0x21')](_0x1e6b53);return _0x4c92dd[_0x2eef('0x2c')](new Buffer(_0x5eecc1['recording']));}})[_0x2eef('0x47')](handleError(_0x4c92dd,null));}; \ No newline at end of file +var _0x8300=['request-promise','bluebird','util','sox','fs-extra','lodash','crypto','desk.js','to-csv','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceMailMessage','include','findAll','rows','catch','params','intersection','body','find','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x19cd66,_0x2969e5){var _0x2c1ccb=function(_0xd5cdd4){while(--_0xd5cdd4){_0x19cd66['push'](_0x19cd66['shift']());}};_0x2c1ccb(++_0x2969e5);}(_0x8300,0x1c4));var _0x0830=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0x8300[_0x31eb67];return _0x2a8cb8;};'use strict';var emlformat=require(_0x0830('0x0'));var rimraf=require(_0x0830('0x1'));var zipdir=require(_0x0830('0x2'));var jsonpatch=require(_0x0830('0x3'));var rp=require(_0x0830('0x4'));var moment=require('moment');var BPromise=require(_0x0830('0x5'));var Mustache=require('mustache');var util=require(_0x0830('0x6'));var path=require('path');var sox=require(_0x0830('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0830('0x8'));var _=require(_0x0830('0x9'));var squel=require('squel');var crypto=require(_0x0830('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0830('0xb'));var toCsv=require(_0x0830('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0830('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0830('0xe'))(_0x0830('0xf'));var utils=require(_0x0830('0x10'));var config=require(_0x0830('0x11'));var licenseUtil=require(_0x0830('0x12'));var db=require(_0x0830('0x13'))['db'];function respondWithStatusCode(_0x54901e,_0x1bf985){_0x1bf985=_0x1bf985||0xcc;return function(_0x1ff1ac){if(_0x1ff1ac){return _0x54901e['sendStatus'](_0x1bf985);}return _0x54901e[_0x0830('0x14')](_0x1bf985)[_0x0830('0x15')]();};}function respondWithResult(_0x100972,_0x50bc5f){_0x50bc5f=_0x50bc5f||0xc8;return function(_0x525fb3){if(_0x525fb3){return _0x100972[_0x0830('0x14')](_0x50bc5f)[_0x0830('0x16')](_0x525fb3);}};}function respondWithFilteredResult(_0x41c2be,_0x50a10d){return function(_0xcee3f7){if(_0xcee3f7){var _0x32adb9=typeof _0x50a10d[_0x0830('0x17')]===_0x0830('0x18')&&typeof _0x50a10d[_0x0830('0x19')]==='undefined';var _0x2fd7ab=_0xcee3f7[_0x0830('0x1a')];var _0xcdf2a9=_0x32adb9?0x0:_0x50a10d[_0x0830('0x17')];var _0x5c780a=_0x32adb9?_0xcee3f7[_0x0830('0x1a')]:_0x50a10d[_0x0830('0x17')]+_0x50a10d[_0x0830('0x19')];var _0x40312a;if(_0x5c780a>=_0x2fd7ab){_0x5c780a=_0x2fd7ab;_0x40312a=0xc8;}else{_0x40312a=0xce;}_0x41c2be[_0x0830('0x14')](_0x40312a);return _0x41c2be[_0x0830('0x1b')](_0x0830('0x1c'),_0xcdf2a9+'-'+_0x5c780a+'/'+_0x2fd7ab)[_0x0830('0x16')](_0xcee3f7);}return null;};}function patchUpdates(_0x4d1996){return function(_0x5cbba6){try{jsonpatch[_0x0830('0x1d')](_0x5cbba6,_0x4d1996,!![]);}catch(_0x347871){return BPromise[_0x0830('0x1e')](_0x347871);}return _0x5cbba6[_0x0830('0x1f')]();};}function saveUpdates(_0x15d669,_0x36765c){return function(_0x10be9b){if(_0x10be9b){return _0x10be9b[_0x0830('0x20')](_0x15d669)[_0x0830('0x21')](function(_0x54cd95){return _0x54cd95;});}return null;};}function removeEntity(_0x436a2a,_0x1f5489){return function(_0xf1c994){if(_0xf1c994){return _0xf1c994[_0x0830('0x22')]()[_0x0830('0x21')](function(){_0x436a2a[_0x0830('0x14')](0xcc)[_0x0830('0x15')]();});}};}function handleEntityNotFound(_0x119423,_0x24eb63){return function(_0x104984){if(!_0x104984){_0x119423['sendStatus'](0x194);}return _0x104984;};}function handleError(_0x5728c7,_0x51ce0e){_0x51ce0e=_0x51ce0e||0x1f4;return function(_0x47eab3){logger[_0x0830('0x23')](_0x47eab3[_0x0830('0x24')]);if(_0x47eab3[_0x0830('0x25')]){delete _0x47eab3[_0x0830('0x25')];}_0x5728c7[_0x0830('0x14')](_0x51ce0e)[_0x0830('0x26')](_0x47eab3);};}exports['index']=function(_0x29255f,_0xab1a0f){var _0xca7166={},_0xc3ace4={},_0x16955c={'count':0x0,'rows':[]};var _0x525878=_[_0x0830('0x27')](db['VoiceMailMessage'][_0x0830('0x28')],function(_0x4585df){return{'name':_0x4585df['fieldName'],'type':_0x4585df[_0x0830('0x29')][_0x0830('0x2a')]};});_0xc3ace4[_0x0830('0x2b')]=_['differenceBy'](_[_0x0830('0x27')](_0x525878,'name'),[_0x0830('0x25')]);_0xc3ace4[_0x0830('0x2c')]=_[_0x0830('0x2d')](_0x29255f[_0x0830('0x2c')]);_0xc3ace4[_0x0830('0x2e')]=_['intersection'](_0xc3ace4[_0x0830('0x2b')],_0xc3ace4[_0x0830('0x2c')]);_0xca7166[_0x0830('0x2f')]=_['intersection'](_0xc3ace4['model'],qs[_0x0830('0x30')](_0x29255f[_0x0830('0x2c')][_0x0830('0x30')]));_0xca7166[_0x0830('0x2f')]=_0xca7166[_0x0830('0x2f')][_0x0830('0x31')]?_0xca7166[_0x0830('0x2f')]:_0xc3ace4[_0x0830('0x2b')];if(!_0x29255f[_0x0830('0x2c')][_0x0830('0x32')]('nolimit')){_0xca7166[_0x0830('0x19')]=qs[_0x0830('0x19')](_0x29255f[_0x0830('0x2c')][_0x0830('0x19')]);_0xca7166['offset']=qs[_0x0830('0x17')](_0x29255f[_0x0830('0x2c')][_0x0830('0x17')]);}_0xca7166[_0x0830('0x33')]=qs[_0x0830('0x34')](_0x29255f[_0x0830('0x2c')]['sort']);_0xca7166[_0x0830('0x35')]=qs[_0x0830('0x2e')](_[_0x0830('0x36')](_0x29255f[_0x0830('0x2c')],_0xc3ace4[_0x0830('0x2e')]),_0x525878);if(_0x29255f[_0x0830('0x2c')][_0x0830('0x37')]){_0xca7166[_0x0830('0x35')]=_[_0x0830('0x38')](_0xca7166[_0x0830('0x35')],{'$or':_[_0x0830('0x27')](_0x525878,function(_0x1a4d44){if(_0x1a4d44[_0x0830('0x29')]!==_0x0830('0x39')){var _0x2363e1={};_0x2363e1[_0x1a4d44[_0x0830('0x25')]]={'$like':'%'+_0x29255f[_0x0830('0x2c')][_0x0830('0x37')]+'%'};return _0x2363e1;}})});}_0xca7166=_['merge']({},_0xca7166,_0x29255f[_0x0830('0x3a')]);var _0x1c3b10={'where':_0xca7166[_0x0830('0x35')]};return db[_0x0830('0x3b')][_0x0830('0x1a')](_0x1c3b10)['then'](function(_0x37592d){_0x16955c['count']=_0x37592d;if(_0x29255f[_0x0830('0x2c')]['includeAll']){_0xca7166[_0x0830('0x3c')]=[{'all':!![]}];}return db[_0x0830('0x3b')][_0x0830('0x3d')](_0xca7166);})['then'](function(_0x18a301){_0x16955c[_0x0830('0x3e')]=_0x18a301;return _0x16955c;})['then'](respondWithFilteredResult(_0xab1a0f,_0xca7166))[_0x0830('0x3f')](handleError(_0xab1a0f,null));};exports['show']=function(_0x2bc103,_0x14b786){var _0x32effd={'raw':!![],'where':{'id':_0x2bc103[_0x0830('0x40')]['id']}},_0x1b9362={};_0x1b9362['model']=_[_0x0830('0x2d')](db[_0x0830('0x3b')]['rawAttributes']);_0x1b9362[_0x0830('0x2c')]=_[_0x0830('0x2d')](_0x2bc103['query']);_0x1b9362['filters']=_[_0x0830('0x41')](_0x1b9362[_0x0830('0x2b')],_0x1b9362[_0x0830('0x2c')]);_0x32effd['attributes']=_[_0x0830('0x41')](_0x1b9362[_0x0830('0x2b')],qs[_0x0830('0x30')](_0x2bc103[_0x0830('0x2c')]['fields']));_0x32effd[_0x0830('0x2f')]=_0x32effd['attributes']['length']?_0x32effd[_0x0830('0x2f')]:_0x1b9362[_0x0830('0x2b')];if(_0x2bc103[_0x0830('0x2c')]['includeAll']){_0x32effd[_0x0830('0x3c')]=[{'all':!![]}];}_0x32effd=_[_0x0830('0x38')]({},_0x32effd,_0x2bc103[_0x0830('0x3a')]);return db['VoiceMailMessage']['find'](_0x32effd)[_0x0830('0x21')](handleEntityNotFound(_0x14b786,null))[_0x0830('0x21')](respondWithResult(_0x14b786,null))[_0x0830('0x3f')](handleError(_0x14b786,null));};exports['create']=function(_0x5f4b0c,_0x124164){return db[_0x0830('0x3b')]['create'](_0x5f4b0c[_0x0830('0x42')],{})[_0x0830('0x21')](respondWithResult(_0x124164,0xc9))[_0x0830('0x3f')](handleError(_0x124164,null));};exports[_0x0830('0x20')]=function(_0x43c439,_0x37fa00){if(_0x43c439[_0x0830('0x42')]['id']){delete _0x43c439[_0x0830('0x42')]['id'];}return db[_0x0830('0x3b')][_0x0830('0x43')]({'where':{'id':_0x43c439[_0x0830('0x40')]['id']}})[_0x0830('0x21')](handleEntityNotFound(_0x37fa00,null))[_0x0830('0x21')](saveUpdates(_0x43c439[_0x0830('0x42')],null))[_0x0830('0x21')](respondWithResult(_0x37fa00,null))[_0x0830('0x3f')](handleError(_0x37fa00,null));};exports[_0x0830('0x22')]=function(_0x38e688,_0x1223da){return db[_0x0830('0x3b')][_0x0830('0x43')]({'where':{'id':_0x38e688[_0x0830('0x40')]['id']}})[_0x0830('0x21')](handleEntityNotFound(_0x1223da,null))[_0x0830('0x21')](removeEntity(_0x1223da,null))[_0x0830('0x3f')](handleError(_0x1223da,null));};exports['download']=function(_0x305fd5,_0x113fa2,_0x11d3a8){return db['VoiceMailMessage'][_0x0830('0x43')]({'where':{'id':_0x305fd5['params']['id']},'attributes':['id',_0x0830('0x44'),_0x0830('0x45')]})[_0x0830('0x21')](handleEntityNotFound(_0x113fa2,null))[_0x0830('0x21')](function(_0x4c44be){if(_0x4c44be){if(!_0x4c44be[_0x0830('0x44')]){throw new db[(_0x0830('0x46'))]['ValidationError'](_0x0830('0x47'));}var _0x5469f4={'Content-Type':'audio/wav','Content-Disposition':_0x0830('0x48')};if(_0x4c44be['msg_id']){_0x5469f4[_0x0830('0x49')]=_0x0830('0x4a')+_0x4c44be[_0x0830('0x45')]+_0x0830('0x4b');}_0x113fa2[_0x0830('0x1b')](_0x5469f4);return _0x113fa2[_0x0830('0x26')](new Buffer(_0x4c44be[_0x0830('0x44')]));}})[_0x0830('0x3f')](handleError(_0x113fa2,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 804ed42..dbd849d 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 _0x72d6=['request-promise','path','rimraf','./voiceMailMessage.attributes','exports','define','voice_voicemail_messages','util','../../config/logger','api','moment'];(function(_0x132545,_0x4b2cec){var _0xe7790a=function(_0x361951){while(--_0x361951){_0x132545['push'](_0x132545['shift']());}};_0xe7790a(++_0x4b2cec);}(_0x72d6,0x17d));var _0x672d=function(_0x1c57a5,_0x433064){_0x1c57a5=_0x1c57a5-0x0;var _0x3dadb9=_0x72d6[_0x1c57a5];return _0x3dadb9;};'use strict';var _=require('lodash');var util=require(_0x672d('0x0'));var logger=require(_0x672d('0x1'))(_0x672d('0x2'));var moment=require(_0x672d('0x3'));var BPromise=require('bluebird');var rp=require(_0x672d('0x4'));var fs=require('fs');var path=require(_0x672d('0x5'));var rimraf=require(_0x672d('0x6'));var config=require('../../config/environment');var attributes=require(_0x672d('0x7'));module[_0x672d('0x8')]=function(_0x262d48,_0x4196e4){return _0x262d48[_0x672d('0x9')]('VoiceMailMessage',attributes,{'tableName':_0x672d('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0xbaa5=['moment','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','lodash','../../config/logger'];(function(_0x2737b1,_0x5dcba2){var _0x493345=function(_0x604499){while(--_0x604499){_0x2737b1['push'](_0x2737b1['shift']());}};_0x493345(++_0x5dcba2);}(_0xbaa5,0xee));var _0x5baa=function(_0x4eb250,_0x214152){_0x4eb250=_0x4eb250-0x0;var _0x5216a5=_0xbaa5[_0x4eb250];return _0x5216a5;};'use strict';var _=require(_0x5baa('0x0'));var util=require('util');var logger=require(_0x5baa('0x1'))('api');var moment=require(_0x5baa('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5baa('0x3'));var config=require(_0x5baa('0x4'));var attributes=require(_0x5baa('0x5'));module[_0x5baa('0x6')]=function(_0x542108,_0x1a4c54){return _0x542108[_0x5baa('0x7')]('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index a7dbe45..4d3aae1 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 _0x021b=['util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x55807e,_0x4423e4){var _0x576041=function(_0x1290df){while(--_0x1290df){_0x55807e['push'](_0x55807e['shift']());}};_0x576041(++_0x4423e4);}(_0x021b,0x1b4));var _0xb021=function(_0xbfe3fb,_0x2271ef){_0xbfe3fb=_0xbfe3fb-0x0;var _0x2608c3=_0x021b[_0xbfe3fb];return _0x2608c3;};'use strict';var _=require(_0xb021('0x0'));var util=require(_0xb021('0x1'));var moment=require(_0xb021('0x2'));var BPromise=require(_0xb021('0x3'));var rs=require(_0xb021('0x4'));var fs=require('fs');var Redis=require(_0xb021('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb021('0x6'))('rpc');var config=require(_0xb021('0x7'));var jayson=require(_0xb021('0x8'));var client=jayson[_0xb021('0x9')][_0xb021('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e7b15,_0x8fdb37,_0xb58cab){return new BPromise(function(_0x503801,_0x52b01a){return client[_0xb021('0xb')](_0x1e7b15,_0xb58cab)[_0xb021('0xc')](function(_0x5d9a3f){logger[_0xb021('0xd')](_0xb021('0xe'),_0x8fdb37,_0xb021('0xf'));logger[_0xb021('0x10')](_0xb021('0x11'),_0x8fdb37,'request\x20sent',JSON['stringify'](_0x5d9a3f));if(_0x5d9a3f[_0xb021('0x12')]){if(_0x5d9a3f[_0xb021('0x12')][_0xb021('0x13')]===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x8fdb37,_0x5d9a3f[_0xb021('0x12')][_0xb021('0x14')]);return _0x52b01a(_0x5d9a3f['error'][_0xb021('0x14')]);}logger['error'](_0xb021('0xe'),_0x8fdb37,_0x5d9a3f[_0xb021('0x12')]['message']);return _0x503801(_0x5d9a3f[_0xb021('0x12')][_0xb021('0x14')]);}else{logger[_0xb021('0xd')](_0xb021('0xe'),_0x8fdb37,'request\x20sent');_0x503801(_0x5d9a3f[_0xb021('0x15')]['message']);}})[_0xb021('0x16')](function(_0x519c4d){logger['error'](_0xb021('0xe'),_0x8fdb37,_0x519c4d);_0x52b01a(_0x519c4d);});});} \ No newline at end of file +var _0x60f6=['info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then'];(function(_0x54bc17,_0xe430eb){var _0x12de15=function(_0x5f926d){while(--_0x5f926d){_0x54bc17['push'](_0x54bc17['shift']());}};_0x12de15(++_0xe430eb);}(_0x60f6,0x128));var _0x660f=function(_0x20509f,_0xeb9323){_0x20509f=_0x20509f-0x0;var _0x5debe4=_0x60f6[_0x20509f];return _0x5debe4;};'use strict';var _=require(_0x660f('0x0'));var util=require(_0x660f('0x1'));var moment=require(_0x660f('0x2'));var BPromise=require(_0x660f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x660f('0x4'));var db=require(_0x660f('0x5'))['db'];var utils=require(_0x660f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x660f('0x7'));var jayson=require(_0x660f('0x8'));var client=jayson[_0x660f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14915e,_0x2b36b1,_0x187a8d){return new BPromise(function(_0x3c57c3,_0x2c2575){return client[_0x660f('0xa')](_0x14915e,_0x187a8d)[_0x660f('0xb')](function(_0x59bb4b){logger[_0x660f('0xc')](_0x660f('0xd'),_0x2b36b1,_0x660f('0xe'));logger[_0x660f('0xf')](_0x660f('0x10'),_0x2b36b1,_0x660f('0xe'),JSON[_0x660f('0x11')](_0x59bb4b));if(_0x59bb4b[_0x660f('0x12')]){if(_0x59bb4b[_0x660f('0x12')][_0x660f('0x13')]===0x1f4){logger[_0x660f('0x12')](_0x660f('0xd'),_0x2b36b1,_0x59bb4b[_0x660f('0x12')]['message']);return _0x2c2575(_0x59bb4b[_0x660f('0x12')][_0x660f('0x14')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x2b36b1,_0x59bb4b['error']['message']);return _0x3c57c3(_0x59bb4b[_0x660f('0x12')][_0x660f('0x14')]);}else{logger[_0x660f('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x2b36b1,_0x660f('0xe'));_0x3c57c3(_0x59bb4b[_0x660f('0x15')]['message']);}})['catch'](function(_0x38214e){logger[_0x660f('0x12')](_0x660f('0xd'),_0x2b36b1,_0x38214e);_0x2c2575(_0x38214e);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index f069171..584d34d 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 _0x7ada=['update','delete','destroy','removeSound','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','/:id/sounds','getSounds','post','addSound'];(function(_0x1c3614,_0x24ee54){var _0x3228d0=function(_0x349ae5){while(--_0x349ae5){_0x1c3614['push'](_0x1c3614['shift']());}};_0x3228d0(++_0x24ee54);}(_0x7ada,0xf7));var _0xa7ad=function(_0x44cbda,_0x8a881c){_0x44cbda=_0x44cbda-0x0;var _0x2a2645=_0x7ada[_0x44cbda];return _0x2a2645;};'use strict';var multer=require(_0xa7ad('0x0'));var util=require(_0xa7ad('0x1'));var path=require(_0xa7ad('0x2'));var timeout=require(_0xa7ad('0x3'));var express=require(_0xa7ad('0x4'));var router=express[_0xa7ad('0x5')]();var fs_extra=require(_0xa7ad('0x6'));var auth=require(_0xa7ad('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa7ad('0x8'));var controller=require(_0xa7ad('0x9'));router[_0xa7ad('0xa')]('/',auth[_0xa7ad('0xb')](),controller['index']);router[_0xa7ad('0xa')](_0xa7ad('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xa7ad('0xa')](_0xa7ad('0xd'),auth['isAuthenticated'](),controller[_0xa7ad('0xe')]);router[_0xa7ad('0xf')]('/',auth[_0xa7ad('0xb')](),controller['create']);router['post'](_0xa7ad('0xd'),auth[_0xa7ad('0xb')](),controller[_0xa7ad('0x10')]);router['put']('/:id',auth[_0xa7ad('0xb')](),controller[_0xa7ad('0x11')]);router[_0xa7ad('0x12')]('/:id',auth[_0xa7ad('0xb')](),controller[_0xa7ad('0x13')]);router[_0xa7ad('0x12')]('/:id/sounds/:id2',auth[_0xa7ad('0xb')](),controller[_0xa7ad('0x14')]);module[_0xa7ad('0x15')]=router; \ No newline at end of file +var _0x1b7f=['destroy','/:id/sounds/:id2','removeSound','exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','/:id','show','get','/:id/sounds','getSounds','post','addSound','delete'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x1b7f,0xb8));var _0xf1b7=function(_0x51cbf2,_0x509af7){_0x51cbf2=_0x51cbf2-0x0;var _0x1fe4ba=_0x1b7f[_0x51cbf2];return _0x1fe4ba;};'use strict';var multer=require(_0xf1b7('0x0'));var util=require(_0xf1b7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf1b7('0x2')]();var fs_extra=require(_0xf1b7('0x3'));var auth=require(_0xf1b7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf1b7('0x5'));var controller=require(_0xf1b7('0x6'));router['get']('/',auth[_0xf1b7('0x7')](),controller['index']);router['get'](_0xf1b7('0x8'),auth['isAuthenticated'](),controller[_0xf1b7('0x9')]);router[_0xf1b7('0xa')](_0xf1b7('0xb'),auth[_0xf1b7('0x7')](),controller[_0xf1b7('0xc')]);router[_0xf1b7('0xd')]('/',auth[_0xf1b7('0x7')](),controller['create']);router[_0xf1b7('0xd')](_0xf1b7('0xb'),auth['isAuthenticated'](),controller[_0xf1b7('0xe')]);router['put']('/:id',auth[_0xf1b7('0x7')](),controller['update']);router[_0xf1b7('0xf')](_0xf1b7('0x8'),auth[_0xf1b7('0x7')](),controller[_0xf1b7('0x10')]);router[_0xf1b7('0xf')](_0xf1b7('0x11'),auth[_0xf1b7('0x7')](),controller[_0xf1b7('0x12')]);module[_0xf1b7('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 464fd60..63b9f63 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 _0x74af=['ENUM','custom','files','quietmp3','mp3','BOOLEAN','STRING','name'];(function(_0x2cac04,_0x14b883){var _0x3c4c12=function(_0x3903ad){while(--_0x3903ad){_0x2cac04['push'](_0x2cac04['shift']());}};_0x3c4c12(++_0x14b883);}(_0x74af,0xc6));var _0xf74a=function(_0x4a44d0,_0x1006df){_0x4a44d0=_0x4a44d0-0x0;var _0x17129d=_0x74af[_0x4a44d0];return _0x17129d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf74a('0x0')],'allowNull':![],'unique':_0xf74a('0x1')},'mode':{'type':Sequelize[_0xf74a('0x2')](_0xf74a('0x3'),_0xf74a('0x4'),'mp3nb','quietmp3nb',_0xf74a('0x5'),_0xf74a('0x6')),'allowNull':!![],'defaultValue':_0xf74a('0x4')},'directory':{'type':Sequelize[_0xf74a('0x0')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xf74a('0x0')],'allowNull':!![]},'sort':{'type':Sequelize[_0xf74a('0x0')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xf74a('0x0')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xf74a('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7529=['custom','files','mp3','alpha','TIMESTAMP','sequelize','STRING','name','ENUM'];(function(_0x5a11be,_0x45c909){var _0x1a591b=function(_0x24dc45){while(--_0x24dc45){_0x5a11be['push'](_0x5a11be['shift']());}};_0x1a591b(++_0x45c909);}(_0x7529,0x191));var _0x9752=function(_0x54d206,_0x19b423){_0x54d206=_0x54d206-0x0;var _0x58fa1b=_0x7529[_0x54d206];return _0x58fa1b;};'use strict';var Sequelize=require(_0x9752('0x0'));module['exports']={'name':{'type':Sequelize[_0x9752('0x1')],'allowNull':![],'unique':_0x9752('0x2')},'mode':{'type':Sequelize[_0x9752('0x3')](_0x9752('0x4'),_0x9752('0x5'),'mp3nb','quietmp3nb','quietmp3',_0x9752('0x6')),'allowNull':!![],'defaultValue':_0x9752('0x5')},'directory':{'type':Sequelize[_0x9752('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x9752('0x1')],'allowNull':!![],'defaultValue':_0x9752('0x7')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x9752('0x8')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 52c5f73..4e9bb3a 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 _0xe85c=['eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','VoiceMusicOnHold','include','findAll','rows','catch','show','params','keys','length','includeAll','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','addSound','Sound','save_name','converted_format','server/files/sounds/converted','format','extname','%s.%s','symlinkSync','ValidationError','message','removeSound','id2','findOne','createdAt','getSounds','options'];(function(_0x1fe8da,_0x54648a){var _0x4eeacf=function(_0x5b4fb8){while(--_0x5b4fb8){_0x1fe8da['push'](_0x1fe8da['shift']());}};_0x4eeacf(++_0x54648a);}(_0xe85c,0xec));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xce85('0x0'));var rimraf=require(_0xce85('0x1'));var zipdir=require(_0xce85('0x2'));var jsonpatch=require(_0xce85('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xce85('0x4'));var Mustache=require(_0xce85('0x5'));var util=require(_0xce85('0x6'));var path=require(_0xce85('0x7'));var sox=require(_0xce85('0x8'));var csv=require(_0xce85('0x9'));var ejs=require(_0xce85('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce85('0xb'));var squel=require(_0xce85('0xc'));var crypto=require(_0xce85('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xce85('0xe'));var toCsv=require(_0xce85('0x9'));var querystring=require(_0xce85('0xf'));var Papa=require(_0xce85('0x10'));var Redis=require('ioredis');var authService=require(_0xce85('0x11'));var qs=require(_0xce85('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce85('0x13'));var logger=require(_0xce85('0x14'))(_0xce85('0x15'));var utils=require(_0xce85('0x16'));var config=require(_0xce85('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xce85('0x18'))['db'];function respondWithStatusCode(_0x4c3aa4,_0x1e078a){_0x1e078a=_0x1e078a||0xcc;return function(_0x4baf59){if(_0x4baf59){return _0x4c3aa4[_0xce85('0x19')](_0x1e078a);}return _0x4c3aa4[_0xce85('0x1a')](_0x1e078a)[_0xce85('0x1b')]();};}function respondWithResult(_0xc0b41b,_0x2feda6){_0x2feda6=_0x2feda6||0xc8;return function(_0x46f451){if(_0x46f451){return _0xc0b41b[_0xce85('0x1a')](_0x2feda6)[_0xce85('0x1c')](_0x46f451);}};}function respondWithFilteredResult(_0x2717bd,_0x52994c){return function(_0x2cb73a){if(_0x2cb73a){var _0x12e4f9=typeof _0x52994c[_0xce85('0x1d')]===_0xce85('0x1e')&&typeof _0x52994c[_0xce85('0x1f')]==='undefined';var _0x359bcb=_0x2cb73a[_0xce85('0x20')];var _0x34e8d3=_0x12e4f9?0x0:_0x52994c[_0xce85('0x1d')];var _0x1a0ef3=_0x12e4f9?_0x2cb73a[_0xce85('0x20')]:_0x52994c[_0xce85('0x1d')]+_0x52994c[_0xce85('0x1f')];var _0x2ad5d7;if(_0x1a0ef3>=_0x359bcb){_0x1a0ef3=_0x359bcb;_0x2ad5d7=0xc8;}else{_0x2ad5d7=0xce;}_0x2717bd[_0xce85('0x1a')](_0x2ad5d7);return _0x2717bd[_0xce85('0x21')](_0xce85('0x22'),_0x34e8d3+'-'+_0x1a0ef3+'/'+_0x359bcb)[_0xce85('0x1c')](_0x2cb73a);}return null;};}function patchUpdates(_0x3caf28){return function(_0x2141b8){try{jsonpatch[_0xce85('0x23')](_0x2141b8,_0x3caf28,!![]);}catch(_0x16f419){return BPromise[_0xce85('0x24')](_0x16f419);}return _0x2141b8[_0xce85('0x25')]();};}function saveUpdates(_0x1b8dc0,_0x2f12a9){return function(_0x1b3fbd){if(_0x1b3fbd){return _0x1b3fbd['update'](_0x1b8dc0)[_0xce85('0x26')](function(_0x5e0fb2){return _0x5e0fb2;});}return null;};}function removeEntity(_0x4437f4,_0x42b419){return function(_0x196089){if(_0x196089){return _0x196089[_0xce85('0x27')]()[_0xce85('0x26')](function(){var _0x5e0cf6=_0x196089[_0xce85('0x28')]({'plain':!![]});var _0x4a940e=_0xce85('0x29');return db[_0xce85('0x2a')][_0xce85('0x27')]({'where':{'type':_0x4a940e,'resourceId':_0x5e0cf6['id']}})[_0xce85('0x26')](function(){return _0x196089;});})[_0xce85('0x26')](function(){_0x4437f4[_0xce85('0x1a')](0xcc)[_0xce85('0x1b')]();});}};}function handleEntityNotFound(_0x2a598f,_0x2da66d){return function(_0x4b5670){if(!_0x4b5670){_0x2a598f[_0xce85('0x19')](0x194);}return _0x4b5670;};}function handleError(_0x5da6be,_0x1ca2ca){_0x1ca2ca=_0x1ca2ca||0x1f4;return function(_0x2afa55){logger[_0xce85('0x2b')](_0x2afa55[_0xce85('0x2c')]);if(_0x2afa55[_0xce85('0x2d')]){delete _0x2afa55['name'];}_0x5da6be[_0xce85('0x1a')](_0x1ca2ca)[_0xce85('0x2e')](_0x2afa55);};}exports[_0xce85('0x2f')]=function(_0x425051,_0x20c13c){var _0x44ad1a={},_0x37851e={},_0x16763d={'count':0x0,'rows':[]};var _0x22ff40=_[_0xce85('0x30')](db['VoiceMusicOnHold'][_0xce85('0x31')],function(_0x2ac219){return{'name':_0x2ac219[_0xce85('0x32')],'type':_0x2ac219[_0xce85('0x33')]['key']};});_0x37851e[_0xce85('0x34')]=_['map'](_0x22ff40,_0xce85('0x2d'));_0x37851e[_0xce85('0x35')]=_['keys'](_0x425051['query']);_0x37851e[_0xce85('0x36')]=_['intersection'](_0x37851e[_0xce85('0x34')],_0x37851e['query']);_0x44ad1a[_0xce85('0x37')]=_[_0xce85('0x38')](_0x37851e[_0xce85('0x34')],qs['fields'](_0x425051[_0xce85('0x35')][_0xce85('0x39')]));_0x44ad1a[_0xce85('0x37')]=_0x44ad1a[_0xce85('0x37')]['length']?_0x44ad1a[_0xce85('0x37')]:_0x37851e[_0xce85('0x34')];if(!_0x425051[_0xce85('0x35')][_0xce85('0x3a')](_0xce85('0x3b'))){_0x44ad1a['limit']=qs['limit'](_0x425051['query']['limit']);_0x44ad1a[_0xce85('0x1d')]=qs[_0xce85('0x1d')](_0x425051[_0xce85('0x35')][_0xce85('0x1d')]);}_0x44ad1a['order']=qs['sort'](_0x425051['query'][_0xce85('0x3c')]);delete _0x425051['query'][_0xce85('0x3c')];_0x44ad1a['where']=qs[_0xce85('0x36')](_[_0xce85('0x3d')](_0x425051[_0xce85('0x35')],_0x37851e[_0xce85('0x36')]),_0x22ff40);if(_0x425051['query'][_0xce85('0x3e')]){_0x44ad1a[_0xce85('0x3f')]=_['merge'](_0x44ad1a[_0xce85('0x3f')],{'$or':_[_0xce85('0x30')](_0x22ff40,function(_0x1863c9){if(_0x1863c9[_0xce85('0x33')]!==_0xce85('0x40')){var _0x2926b9={};_0x2926b9[_0x1863c9[_0xce85('0x2d')]]={'$like':'%'+_0x425051['query'][_0xce85('0x3e')]+'%'};return _0x2926b9;}})});}_0x44ad1a=_[_0xce85('0x41')]({},_0x44ad1a,_0x425051['options']);var _0x342117={'where':_0x44ad1a['where']};return db[_0xce85('0x42')]['count'](_0x342117)[_0xce85('0x26')](function(_0x319dd1){_0x16763d['count']=_0x319dd1;if(_0x425051[_0xce85('0x35')]['includeAll']){_0x44ad1a[_0xce85('0x43')]=[{'all':!![]}];}return db[_0xce85('0x42')][_0xce85('0x44')](_0x44ad1a);})['then'](function(_0x3da310){_0x16763d[_0xce85('0x45')]=_0x3da310;return _0x16763d;})[_0xce85('0x26')](respondWithFilteredResult(_0x20c13c,_0x44ad1a))[_0xce85('0x46')](handleError(_0x20c13c,null));};exports[_0xce85('0x47')]=function(_0x5c4ac4,_0x12fd78){var _0x1d2774={'raw':![],'where':{'id':_0x5c4ac4[_0xce85('0x48')]['id']}},_0xe46a3f={};_0xe46a3f[_0xce85('0x34')]=_['keys'](db['VoiceMusicOnHold'][_0xce85('0x31')]);_0xe46a3f['query']=_[_0xce85('0x49')](_0x5c4ac4[_0xce85('0x35')]);_0xe46a3f[_0xce85('0x36')]=_[_0xce85('0x38')](_0xe46a3f[_0xce85('0x34')],_0xe46a3f[_0xce85('0x35')]);_0x1d2774['attributes']=_[_0xce85('0x38')](_0xe46a3f[_0xce85('0x34')],qs[_0xce85('0x39')](_0x5c4ac4[_0xce85('0x35')][_0xce85('0x39')]));_0x1d2774[_0xce85('0x37')]=_0x1d2774[_0xce85('0x37')][_0xce85('0x4a')]?_0x1d2774['attributes']:_0xe46a3f['model'];if(_0x5c4ac4[_0xce85('0x35')][_0xce85('0x4b')]){_0x1d2774[_0xce85('0x43')]=[{'all':!![]}];}_0x1d2774=_[_0xce85('0x41')]({},_0x1d2774,_0x5c4ac4['options']);return db['VoiceMusicOnHold'][_0xce85('0x4c')](_0x1d2774)[_0xce85('0x26')](handleEntityNotFound(_0x12fd78,null))[_0xce85('0x26')](respondWithResult(_0x12fd78,null))[_0xce85('0x46')](handleError(_0x12fd78,null));};exports[_0xce85('0x4d')]=function(_0x366a24,_0x2986ad){if(_0x366a24[_0xce85('0x4e')]['id']){delete _0x366a24[_0xce85('0x4e')]['id'];}return db[_0xce85('0x42')][_0xce85('0x4c')]({'where':{'id':_0x366a24[_0xce85('0x48')]['id']}})['then'](handleEntityNotFound(_0x2986ad,null))[_0xce85('0x26')](saveUpdates(_0x366a24[_0xce85('0x4e')],null))['then'](respondWithResult(_0x2986ad,null))['catch'](handleError(_0x2986ad,null));};exports[_0xce85('0x4f')]=function(_0x51e3e7,_0x488e19,_0x38defa){return db[_0xce85('0x50')][_0xce85('0x51')](function(_0x2d5b26){if(_0x51e3e7[_0xce85('0x4e')][_0xce85('0x52')]===_0xce85('0x53')){_0x51e3e7[_0xce85('0x4e')][_0xce85('0x54')]=path[_0xce85('0x55')](config[_0xce85('0x56')],_0xce85('0x57'),_0x51e3e7[_0xce85('0x4e')][_0xce85('0x2d')]);}return db[_0xce85('0x42')][_0xce85('0x4f')](_0x51e3e7[_0xce85('0x4e')],{'transaction':_0x2d5b26})[_0xce85('0x26')](function(_0x469c96){if(_0x51e3e7[_0xce85('0x4e')][_0xce85('0x52')]===_0xce85('0x53')){fs[_0xce85('0x58')](_0x469c96[_0xce85('0x54')],parseInt(_0xce85('0x59'),0x8));}var _0x3e54d2=_0x51e3e7[_0xce85('0x5a')][_0xce85('0x28')]({'plain':!![]});if(!_0x3e54d2)throw new Error(_0xce85('0x5b'));if(_0x3e54d2[_0xce85('0x5c')]===_0xce85('0x5a')){var _0x1e85a2=_0x469c96[_0xce85('0x28')]({'plain':!![]});return db[_0xce85('0x5d')][_0xce85('0x4c')]({'where':{'name':_0xce85('0x29'),'userProfileId':_0x3e54d2[_0xce85('0x5e')]},'raw':!![]})['then'](function(_0x5276a0){if(_0x5276a0&&_0x5276a0['autoAssociation']===0x0){return db[_0xce85('0x2a')]['create']({'name':_0x1e85a2[_0xce85('0x2d')],'resourceId':_0x1e85a2['id'],'type':_0x5276a0[_0xce85('0x2d')],'sectionId':_0x5276a0['id']},{})['then'](function(){return _0x469c96;});}else{return _0x469c96;}})[_0xce85('0x46')](function(_0x2b1658){logger[_0xce85('0x2b')](_0xce85('0x5f'),_0x2b1658);});}return _0x469c96;});})[_0xce85('0x26')](respondWithResult(_0x488e19,0xc9))[_0xce85('0x46')](handleError(_0x488e19,null));};exports[_0xce85('0x27')]=function(_0x460e89,_0x4a64a7,_0x272c35){var _0x265edd;return db[_0xce85('0x42')][_0xce85('0x4c')]({'where':{'id':_0x460e89[_0xce85('0x48')]['id']}})[_0xce85('0x26')](function(_0x59c6d5){if(_0x59c6d5){return db[_0xce85('0x50')][_0xce85('0x51')](function(_0x2a519d){return _0x59c6d5['destroy']({'transaction':_0x2a519d,'raw':!![]})['then'](function(_0xbb2dcd){if(_0xbb2dcd[_0xce85('0x54')]){fs[_0xce85('0x60')](_0xbb2dcd['directory'])[_0xce85('0x61')](function(_0x3fae18){fs[_0xce85('0x62')](path[_0xce85('0x55')](_0xbb2dcd['directory'],_0x3fae18));});fs[_0xce85('0x63')](_0xbb2dcd[_0xce85('0x54')]);}return _0xbb2dcd;});})[_0xce85('0x46')](function(_0x56e402){throw new db[(_0xce85('0x64'))]['ValidationError'](_0x56e402['message']);});}})[_0xce85('0x26')](handleEntityNotFound(_0x4a64a7,null))[_0xce85('0x26')](removeEntity(_0x4a64a7,null))[_0xce85('0x46')](handleError(_0x4a64a7,null));};exports[_0xce85('0x65')]=function(_0x12adc,_0x59ec70,_0xd944dd){return db[_0xce85('0x50')]['transaction'](function(_0x22e8df){var _0x31271a;return db[_0xce85('0x42')][_0xce85('0x4c')]({'where':{'id':_0x12adc[_0xce85('0x48')]['id']}})[_0xce85('0x26')](function(_0x1843a9){if(_0x1843a9){_0x31271a=_0x1843a9;return _0x1843a9['addSound'](_0x12adc[_0xce85('0x4e')]['id'],{'transaction':_0x22e8df});}})[_0xce85('0x26')](function(_0x4abd02){if(_0x4abd02){return db[_0xce85('0x66')]['findOne']({'where':{'id':_0x12adc[_0xce85('0x4e')]['id']},'attributes':['id','name',_0xce85('0x67'),_0xce85('0x68'),'createdAt'],'raw':!![]});}})['then'](function(_0x31e52b){if(_0x31e52b){var _0x5c169d=path[_0xce85('0x55')](config[_0xce85('0x56')],_0xce85('0x69'),util[_0xce85('0x6a')]('%s.%s',path['basename'](_0x31e52b['save_name'],path[_0xce85('0x6b')](_0x31e52b[_0xce85('0x67')])),_0x31e52b[_0xce85('0x68')]));var _0x5d81da=path['join'](config[_0xce85('0x56')],_0xce85('0x57'),_0x31271a['name'],util['format'](_0xce85('0x6c'),_0x31e52b[_0xce85('0x2d')],_0x31e52b[_0xce85('0x68')]));fs[_0xce85('0x6d')](_0x5c169d,_0x5d81da);return _0x31e52b;}})[_0xce85('0x46')](function(_0x1a307f){throw new db['Sequelize'][(_0xce85('0x6e'))](_0x1a307f[_0xce85('0x6f')]);});})[_0xce85('0x26')](handleEntityNotFound(_0x59ec70,null))[_0xce85('0x26')](respondWithResult(_0x59ec70,0xc9))[_0xce85('0x46')](handleError(_0x59ec70,null));};exports[_0xce85('0x70')]=function(_0x25c34f,_0x136fc9,_0x4c9d70){return db[_0xce85('0x50')][_0xce85('0x51')](function(_0x61cb8f){var _0x514e6a;return db[_0xce85('0x42')]['findOne']({'where':{'id':_0x25c34f[_0xce85('0x48')]['id']}})[_0xce85('0x26')](handleEntityNotFound(_0x136fc9,null))[_0xce85('0x26')](function(_0x3e73c5){if(_0x3e73c5){_0x514e6a=_0x3e73c5;return _0x3e73c5['removeSound'](_0x25c34f[_0xce85('0x48')][_0xce85('0x71')]);}})[_0xce85('0x26')](function(_0x5566d3){if(_0x5566d3){return db['Sound'][_0xce85('0x72')]({'where':{'id':_0x25c34f['params'][_0xce85('0x71')]},'attributes':['id',_0xce85('0x2d'),_0xce85('0x67'),_0xce85('0x68'),_0xce85('0x73')],'raw':!![]});}})[_0xce85('0x26')](function(_0x265aee){if(_0x265aee){fs[_0xce85('0x62')](path[_0xce85('0x55')](_0x514e6a[_0xce85('0x54')],util[_0xce85('0x6a')](_0xce85('0x6c'),_0x265aee['name'],_0x265aee[_0xce85('0x68')])));return _0x265aee;}})[_0xce85('0x46')](function(_0x3f0b88){throw new db['Sequelize'][(_0xce85('0x6e'))](_0x3f0b88['message']);});})['then'](handleEntityNotFound(_0x136fc9,null))[_0xce85('0x26')](respondWithStatusCode(_0x136fc9,0xcc))[_0xce85('0x46')](handleError(_0x136fc9,null));};exports[_0xce85('0x74')]=function(_0xc80f5f,_0x3e5d57,_0x12bc77){var _0x17f858={};var _0x224dc3={};var _0x5dba7d;var _0x5e30d6;return db[_0xce85('0x42')][_0xce85('0x72')]({'where':{'id':_0xc80f5f[_0xce85('0x48')]['id']}})['then'](handleEntityNotFound(_0x3e5d57,null))['then'](function(_0x1e452f){if(_0x1e452f){_0x5dba7d=_0x1e452f;_0x224dc3[_0xce85('0x34')]=_['keys'](db['Sound'][_0xce85('0x31')]);_0x224dc3[_0xce85('0x35')]=_[_0xce85('0x49')](_0xc80f5f[_0xce85('0x35')]);_0x224dc3[_0xce85('0x36')]=_[_0xce85('0x38')](_0x224dc3[_0xce85('0x34')],_0x224dc3[_0xce85('0x35')]);_0x17f858[_0xce85('0x37')]=_[_0xce85('0x38')](_0x224dc3[_0xce85('0x34')],qs[_0xce85('0x39')](_0xc80f5f[_0xce85('0x35')][_0xce85('0x39')]));_0x17f858[_0xce85('0x37')]=_0x17f858[_0xce85('0x37')][_0xce85('0x4a')]?_0x17f858[_0xce85('0x37')]:_0x224dc3[_0xce85('0x34')];_0x17f858['order']=qs[_0xce85('0x3c')](_0xc80f5f[_0xce85('0x35')][_0xce85('0x3c')]);_0x17f858[_0xce85('0x3f')]=qs[_0xce85('0x36')](_[_0xce85('0x3d')](_0xc80f5f[_0xce85('0x35')],_0x224dc3[_0xce85('0x36')]));if(_0xc80f5f[_0xce85('0x35')][_0xce85('0x3e')]){_0x17f858[_0xce85('0x3f')]=_['merge'](_0x17f858[_0xce85('0x3f')],{'$or':_[_0xce85('0x30')](_0x17f858[_0xce85('0x37')],function(_0x5be5e2){var _0x1df36e={};_0x1df36e[_0x5be5e2]={'$like':'%'+_0xc80f5f[_0xce85('0x35')][_0xce85('0x3e')]+'%'};return _0x1df36e;})});}_0x17f858=_['merge']({},_0x17f858,_0xc80f5f[_0xce85('0x75')]);return _0x5dba7d[_0xce85('0x74')](_0x17f858);}})[_0xce85('0x26')](function(_0x4efbc3){if(_0x4efbc3){_0x5e30d6=_0x4efbc3[_0xce85('0x4a')];if(!_0xc80f5f[_0xce85('0x35')][_0xce85('0x3a')](_0xce85('0x3b'))){_0x17f858[_0xce85('0x1f')]=qs['limit'](_0xc80f5f[_0xce85('0x35')][_0xce85('0x1f')]);_0x17f858[_0xce85('0x1d')]=qs['offset'](_0xc80f5f[_0xce85('0x35')][_0xce85('0x1d')]);}return _0x5dba7d[_0xce85('0x74')](_0x17f858);}})[_0xce85('0x26')](function(_0x38be42){if(_0x38be42){return _0x38be42?{'count':_0x5e30d6,'rows':_0x38be42}:null;}})['then'](respondWithResult(_0x3e5d57,null))[_0xce85('0x46')](handleError(_0x3e5d57,null));}; \ No newline at end of file +var _0xf63c=['UserProfileSection','MusicOnHolds','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt','join','format','basename','root','%s.%s','removeSound','id2','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','save','then','destroy','get','UserProfileResource','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','find','update','body','params','create','sequelize','transaction','directory','server/files/moh','files','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf63c,0x162));var _0xcf63=function(_0x8a8e33,_0x2bc1fb){_0x8a8e33=_0x8a8e33-0x0;var _0x10024e=_0xf63c[_0x8a8e33];return _0x10024e;};'use strict';var emlformat=require(_0xcf63('0x0'));var rimraf=require(_0xcf63('0x1'));var zipdir=require(_0xcf63('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcf63('0x3'));var moment=require('moment');var BPromise=require(_0xcf63('0x4'));var Mustache=require('mustache');var util=require(_0xcf63('0x5'));var path=require(_0xcf63('0x6'));var sox=require(_0xcf63('0x7'));var csv=require('to-csv');var ejs=require(_0xcf63('0x8'));var fs=require('fs');var fs_extra=require(_0xcf63('0x9'));var _=require(_0xcf63('0xa'));var squel=require(_0xcf63('0xb'));var crypto=require(_0xcf63('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcf63('0xd'));var toCsv=require(_0xcf63('0xe'));var querystring=require(_0xcf63('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcf63('0x10'));var qs=require(_0xcf63('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcf63('0x12'))(_0xcf63('0x13'));var utils=require(_0xcf63('0x14'));var config=require(_0xcf63('0x15'));var licenseUtil=require(_0xcf63('0x16'));var db=require(_0xcf63('0x17'))['db'];function respondWithStatusCode(_0x200497,_0x545e97){_0x545e97=_0x545e97||0xcc;return function(_0x1dcffe){if(_0x1dcffe){return _0x200497[_0xcf63('0x18')](_0x545e97);}return _0x200497['status'](_0x545e97)[_0xcf63('0x19')]();};}function respondWithResult(_0x510a9a,_0x34ec79){_0x34ec79=_0x34ec79||0xc8;return function(_0x262d8a){if(_0x262d8a){return _0x510a9a['status'](_0x34ec79)[_0xcf63('0x1a')](_0x262d8a);}};}function respondWithFilteredResult(_0x499e5d,_0x1ba07a){return function(_0x5df704){if(_0x5df704){var _0x57f28c=typeof _0x1ba07a[_0xcf63('0x1b')]==='undefined'&&typeof _0x1ba07a[_0xcf63('0x1c')]===_0xcf63('0x1d');var _0x674e82=_0x5df704[_0xcf63('0x1e')];var _0x493746=_0x57f28c?0x0:_0x1ba07a[_0xcf63('0x1b')];var _0x1e1b22=_0x57f28c?_0x5df704['count']:_0x1ba07a['offset']+_0x1ba07a[_0xcf63('0x1c')];var _0x49715b;if(_0x1e1b22>=_0x674e82){_0x1e1b22=_0x674e82;_0x49715b=0xc8;}else{_0x49715b=0xce;}_0x499e5d[_0xcf63('0x1f')](_0x49715b);return _0x499e5d[_0xcf63('0x20')](_0xcf63('0x21'),_0x493746+'-'+_0x1e1b22+'/'+_0x674e82)['json'](_0x5df704);}return null;};}function patchUpdates(_0x460a0d){return function(_0x2b3c18){try{jsonpatch[_0xcf63('0x22')](_0x2b3c18,_0x460a0d,!![]);}catch(_0x3cd28d){return BPromise['reject'](_0x3cd28d);}return _0x2b3c18[_0xcf63('0x23')]();};}function saveUpdates(_0x208235,_0x4717b3){return function(_0xb35258){if(_0xb35258){return _0xb35258['update'](_0x208235)[_0xcf63('0x24')](function(_0xf05c92){return _0xf05c92;});}return null;};}function removeEntity(_0x1cad83,_0x4fc9e2){return function(_0x280434){if(_0x280434){return _0x280434[_0xcf63('0x25')]()[_0xcf63('0x24')](function(){var _0x4b32ef=_0x280434[_0xcf63('0x26')]({'plain':!![]});var _0x368c96='MusicOnHolds';return db[_0xcf63('0x27')][_0xcf63('0x25')]({'where':{'type':_0x368c96,'resourceId':_0x4b32ef['id']}})['then'](function(){return _0x280434;});})[_0xcf63('0x24')](function(){_0x1cad83['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x322cdb,_0x49ecbd){return function(_0x1d3b0b){if(!_0x1d3b0b){_0x322cdb['sendStatus'](0x194);}return _0x1d3b0b;};}function handleError(_0x4310fb,_0x284d97){_0x284d97=_0x284d97||0x1f4;return function(_0x199c56){logger['error'](_0x199c56['stack']);if(_0x199c56['name']){delete _0x199c56[_0xcf63('0x28')];}_0x4310fb[_0xcf63('0x1f')](_0x284d97)[_0xcf63('0x29')](_0x199c56);};}exports[_0xcf63('0x2a')]=function(_0x42ced7,_0x5bcf00){var _0x441ee9={},_0x5efe30={},_0x4dcad3={'count':0x0,'rows':[]};var _0x2aee41=_[_0xcf63('0x2b')](db[_0xcf63('0x2c')][_0xcf63('0x2d')],function(_0x22c56f){return{'name':_0x22c56f[_0xcf63('0x2e')],'type':_0x22c56f[_0xcf63('0x2f')][_0xcf63('0x30')]};});_0x5efe30[_0xcf63('0x31')]=_[_0xcf63('0x2b')](_0x2aee41,_0xcf63('0x28'));_0x5efe30['query']=_['keys'](_0x42ced7[_0xcf63('0x32')]);_0x5efe30['filters']=_[_0xcf63('0x33')](_0x5efe30['model'],_0x5efe30[_0xcf63('0x32')]);_0x441ee9[_0xcf63('0x34')]=_[_0xcf63('0x33')](_0x5efe30[_0xcf63('0x31')],qs['fields'](_0x42ced7['query'][_0xcf63('0x35')]));_0x441ee9[_0xcf63('0x34')]=_0x441ee9[_0xcf63('0x34')][_0xcf63('0x36')]?_0x441ee9[_0xcf63('0x34')]:_0x5efe30[_0xcf63('0x31')];if(!_0x42ced7[_0xcf63('0x32')][_0xcf63('0x37')](_0xcf63('0x38'))){_0x441ee9[_0xcf63('0x1c')]=qs[_0xcf63('0x1c')](_0x42ced7[_0xcf63('0x32')][_0xcf63('0x1c')]);_0x441ee9[_0xcf63('0x1b')]=qs['offset'](_0x42ced7['query']['offset']);}_0x441ee9[_0xcf63('0x39')]=qs[_0xcf63('0x3a')](_0x42ced7[_0xcf63('0x32')][_0xcf63('0x3a')]);delete _0x42ced7[_0xcf63('0x32')][_0xcf63('0x3a')];_0x441ee9[_0xcf63('0x3b')]=qs[_0xcf63('0x3c')](_[_0xcf63('0x3d')](_0x42ced7['query'],_0x5efe30[_0xcf63('0x3c')]),_0x2aee41);if(_0x42ced7[_0xcf63('0x32')][_0xcf63('0x3e')]){_0x441ee9['where']=_[_0xcf63('0x3f')](_0x441ee9[_0xcf63('0x3b')],{'$or':_[_0xcf63('0x2b')](_0x2aee41,function(_0x3fb30e){if(_0x3fb30e['type']!==_0xcf63('0x40')){var _0x31f0c0={};_0x31f0c0[_0x3fb30e[_0xcf63('0x28')]]={'$like':'%'+_0x42ced7[_0xcf63('0x32')]['filter']+'%'};return _0x31f0c0;}})});}_0x441ee9=_[_0xcf63('0x3f')]({},_0x441ee9,_0x42ced7['options']);var _0x3bb0cf={'where':_0x441ee9[_0xcf63('0x3b')]};return db['VoiceMusicOnHold'][_0xcf63('0x1e')](_0x3bb0cf)[_0xcf63('0x24')](function(_0x4925a3){_0x4dcad3[_0xcf63('0x1e')]=_0x4925a3;if(_0x42ced7[_0xcf63('0x32')][_0xcf63('0x41')]){_0x441ee9[_0xcf63('0x42')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xcf63('0x43')](_0x441ee9);})[_0xcf63('0x24')](function(_0x18492d){_0x4dcad3[_0xcf63('0x44')]=_0x18492d;return _0x4dcad3;})['then'](respondWithFilteredResult(_0x5bcf00,_0x441ee9))[_0xcf63('0x45')](handleError(_0x5bcf00,null));};exports[_0xcf63('0x46')]=function(_0x16030d,_0x2af606){var _0x2c1f1f={'raw':![],'where':{'id':_0x16030d['params']['id']}},_0x311ca6={};_0x311ca6['model']=_[_0xcf63('0x47')](db[_0xcf63('0x2c')][_0xcf63('0x2d')]);_0x311ca6['query']=_[_0xcf63('0x47')](_0x16030d[_0xcf63('0x32')]);_0x311ca6['filters']=_[_0xcf63('0x33')](_0x311ca6[_0xcf63('0x31')],_0x311ca6[_0xcf63('0x32')]);_0x2c1f1f[_0xcf63('0x34')]=_[_0xcf63('0x33')](_0x311ca6[_0xcf63('0x31')],qs[_0xcf63('0x35')](_0x16030d[_0xcf63('0x32')][_0xcf63('0x35')]));_0x2c1f1f[_0xcf63('0x34')]=_0x2c1f1f[_0xcf63('0x34')]['length']?_0x2c1f1f['attributes']:_0x311ca6[_0xcf63('0x31')];if(_0x16030d[_0xcf63('0x32')]['includeAll']){_0x2c1f1f[_0xcf63('0x42')]=[{'all':!![]}];}_0x2c1f1f=_[_0xcf63('0x3f')]({},_0x2c1f1f,_0x16030d['options']);return db['VoiceMusicOnHold'][_0xcf63('0x48')](_0x2c1f1f)[_0xcf63('0x24')](handleEntityNotFound(_0x2af606,null))['then'](respondWithResult(_0x2af606,null))[_0xcf63('0x45')](handleError(_0x2af606,null));};exports[_0xcf63('0x49')]=function(_0x1d01a1,_0x56acbe){if(_0x1d01a1[_0xcf63('0x4a')]['id']){delete _0x1d01a1[_0xcf63('0x4a')]['id'];}return db[_0xcf63('0x2c')][_0xcf63('0x48')]({'where':{'id':_0x1d01a1[_0xcf63('0x4b')]['id']}})[_0xcf63('0x24')](handleEntityNotFound(_0x56acbe,null))['then'](saveUpdates(_0x1d01a1['body'],null))[_0xcf63('0x24')](respondWithResult(_0x56acbe,null))['catch'](handleError(_0x56acbe,null));};exports[_0xcf63('0x4c')]=function(_0x271143,_0x8cbabb,_0x1abaf9){return db[_0xcf63('0x4d')][_0xcf63('0x4e')](function(_0x210716){if(_0x271143[_0xcf63('0x4a')]['mode']==='files'){_0x271143[_0xcf63('0x4a')][_0xcf63('0x4f')]=path['join'](config['root'],_0xcf63('0x50'),_0x271143['body'][_0xcf63('0x28')]);}return db['VoiceMusicOnHold'][_0xcf63('0x4c')](_0x271143[_0xcf63('0x4a')],{'transaction':_0x210716})[_0xcf63('0x24')](function(_0x407515){if(_0x271143[_0xcf63('0x4a')]['mode']===_0xcf63('0x51')){fs[_0xcf63('0x52')](_0x407515['directory'],parseInt(_0xcf63('0x53'),0x8));}var _0x4f06e9=_0x271143[_0xcf63('0x54')][_0xcf63('0x26')]({'plain':!![]});if(!_0x4f06e9)throw new Error(_0xcf63('0x55'));if(_0x4f06e9['role']===_0xcf63('0x54')){var _0x273f15=_0x407515[_0xcf63('0x26')]({'plain':!![]});return db[_0xcf63('0x56')][_0xcf63('0x48')]({'where':{'name':_0xcf63('0x57'),'userProfileId':_0x4f06e9[_0xcf63('0x58')]},'raw':!![]})[_0xcf63('0x24')](function(_0x379a7f){if(_0x379a7f&&_0x379a7f['autoAssociation']===0x0){return db[_0xcf63('0x27')][_0xcf63('0x4c')]({'name':_0x273f15[_0xcf63('0x28')],'resourceId':_0x273f15['id'],'type':_0x379a7f[_0xcf63('0x28')],'sectionId':_0x379a7f['id']},{})['then'](function(){return _0x407515;});}else{return _0x407515;}})[_0xcf63('0x45')](function(_0x24499a){logger[_0xcf63('0x59')](_0xcf63('0x5a'),_0x24499a);});}return _0x407515;});})[_0xcf63('0x24')](respondWithResult(_0x8cbabb,0xc9))[_0xcf63('0x45')](handleError(_0x8cbabb,null));};exports[_0xcf63('0x25')]=function(_0x46e3a0,_0x5dbfcc,_0x2202f0){var _0x8717ed;return db[_0xcf63('0x2c')][_0xcf63('0x48')]({'where':{'id':_0x46e3a0[_0xcf63('0x4b')]['id']}})[_0xcf63('0x24')](function(_0x276103){if(_0x276103){return db[_0xcf63('0x4d')][_0xcf63('0x4e')](function(_0x1bb769){return _0x276103[_0xcf63('0x25')]({'transaction':_0x1bb769,'raw':!![]})[_0xcf63('0x24')](function(_0x1ba771){if(_0x1ba771[_0xcf63('0x4f')]){fs[_0xcf63('0x5b')](_0x1ba771[_0xcf63('0x4f')])[_0xcf63('0x5c')](function(_0x4130a7){fs[_0xcf63('0x5d')](path['join'](_0x1ba771[_0xcf63('0x4f')],_0x4130a7));});fs[_0xcf63('0x5e')](_0x1ba771['directory']);}return _0x1ba771;});})[_0xcf63('0x45')](function(_0x4b59cb){throw new db[(_0xcf63('0x5f'))][(_0xcf63('0x60'))](_0x4b59cb[_0xcf63('0x61')]);});}})[_0xcf63('0x24')](handleEntityNotFound(_0x5dbfcc,null))[_0xcf63('0x24')](removeEntity(_0x5dbfcc,null))[_0xcf63('0x45')](handleError(_0x5dbfcc,null));};exports['addSound']=function(_0x517d8e,_0x140d05,_0x237e66){return db[_0xcf63('0x4d')][_0xcf63('0x4e')](function(_0x5b34f6){var _0x327d18;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x517d8e['params']['id']}})[_0xcf63('0x24')](function(_0x55403f){if(_0x55403f){_0x327d18=_0x55403f;return _0x55403f[_0xcf63('0x62')](_0x517d8e[_0xcf63('0x4a')]['id'],{'transaction':_0x5b34f6});}})[_0xcf63('0x24')](function(_0x56136a){if(_0x56136a){return db['Sound'][_0xcf63('0x63')]({'where':{'id':_0x517d8e[_0xcf63('0x4a')]['id']},'attributes':['id',_0xcf63('0x28'),_0xcf63('0x64'),_0xcf63('0x65'),_0xcf63('0x66')],'raw':!![]});}})[_0xcf63('0x24')](function(_0x522ffe){if(_0x522ffe){var _0x11a745=path[_0xcf63('0x67')](config['root'],'server/files/sounds/converted',util[_0xcf63('0x68')]('%s.%s',path[_0xcf63('0x69')](_0x522ffe[_0xcf63('0x64')],path['extname'](_0x522ffe[_0xcf63('0x64')])),_0x522ffe[_0xcf63('0x65')]));var _0xd704f0=path[_0xcf63('0x67')](config[_0xcf63('0x6a')],_0xcf63('0x50'),_0x327d18[_0xcf63('0x28')],util[_0xcf63('0x68')](_0xcf63('0x6b'),_0x522ffe[_0xcf63('0x28')],_0x522ffe[_0xcf63('0x65')]));fs['symlinkSync'](_0x11a745,_0xd704f0);return _0x522ffe;}})['catch'](function(_0x1cc0c7){throw new db[(_0xcf63('0x5f'))][(_0xcf63('0x60'))](_0x1cc0c7['message']);});})[_0xcf63('0x24')](handleEntityNotFound(_0x140d05,null))['then'](respondWithResult(_0x140d05,0xc9))[_0xcf63('0x45')](handleError(_0x140d05,null));};exports[_0xcf63('0x6c')]=function(_0x255560,_0x65b1b8,_0x546627){return db['sequelize'][_0xcf63('0x4e')](function(_0x4c8690){var _0xe11f20;return db[_0xcf63('0x2c')][_0xcf63('0x63')]({'where':{'id':_0x255560[_0xcf63('0x4b')]['id']}})[_0xcf63('0x24')](handleEntityNotFound(_0x65b1b8,null))[_0xcf63('0x24')](function(_0x5a701b){if(_0x5a701b){_0xe11f20=_0x5a701b;return _0x5a701b[_0xcf63('0x6c')](_0x255560[_0xcf63('0x4b')]['id2']);}})[_0xcf63('0x24')](function(_0x214555){if(_0x214555){return db['Sound']['findOne']({'where':{'id':_0x255560[_0xcf63('0x4b')][_0xcf63('0x6d')]},'attributes':['id',_0xcf63('0x28'),_0xcf63('0x64'),'converted_format',_0xcf63('0x66')],'raw':!![]});}})[_0xcf63('0x24')](function(_0x860f34){if(_0x860f34){fs[_0xcf63('0x5d')](path[_0xcf63('0x67')](_0xe11f20[_0xcf63('0x4f')],util['format']('%s.%s',_0x860f34['name'],_0x860f34[_0xcf63('0x65')])));return _0x860f34;}})[_0xcf63('0x45')](function(_0x5ed5c6){throw new db[(_0xcf63('0x5f'))]['ValidationError'](_0x5ed5c6[_0xcf63('0x61')]);});})[_0xcf63('0x24')](handleEntityNotFound(_0x65b1b8,null))[_0xcf63('0x24')](respondWithStatusCode(_0x65b1b8,0xcc))[_0xcf63('0x45')](handleError(_0x65b1b8,null));};exports['getSounds']=function(_0x4355ca,_0x1adf87,_0x16c85a){var _0x364a3d={};var _0x136f2c={};var _0x1ae832;var _0xb8af00;return db[_0xcf63('0x2c')][_0xcf63('0x63')]({'where':{'id':_0x4355ca[_0xcf63('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1adf87,null))['then'](function(_0x407eb8){if(_0x407eb8){_0x1ae832=_0x407eb8;_0x136f2c[_0xcf63('0x31')]=_['keys'](db['Sound'][_0xcf63('0x2d')]);_0x136f2c['query']=_[_0xcf63('0x47')](_0x4355ca[_0xcf63('0x32')]);_0x136f2c[_0xcf63('0x3c')]=_[_0xcf63('0x33')](_0x136f2c[_0xcf63('0x31')],_0x136f2c['query']);_0x364a3d['attributes']=_['intersection'](_0x136f2c[_0xcf63('0x31')],qs[_0xcf63('0x35')](_0x4355ca['query']['fields']));_0x364a3d[_0xcf63('0x34')]=_0x364a3d[_0xcf63('0x34')]['length']?_0x364a3d[_0xcf63('0x34')]:_0x136f2c[_0xcf63('0x31')];_0x364a3d['order']=qs[_0xcf63('0x3a')](_0x4355ca['query']['sort']);_0x364a3d['where']=qs['filters'](_[_0xcf63('0x3d')](_0x4355ca[_0xcf63('0x32')],_0x136f2c[_0xcf63('0x3c')]));if(_0x4355ca[_0xcf63('0x32')]['filter']){_0x364a3d[_0xcf63('0x3b')]=_[_0xcf63('0x3f')](_0x364a3d[_0xcf63('0x3b')],{'$or':_[_0xcf63('0x2b')](_0x364a3d['attributes'],function(_0x300496){var _0x1e03cc={};_0x1e03cc[_0x300496]={'$like':'%'+_0x4355ca[_0xcf63('0x32')][_0xcf63('0x3e')]+'%'};return _0x1e03cc;})});}_0x364a3d=_[_0xcf63('0x3f')]({},_0x364a3d,_0x4355ca['options']);return _0x1ae832['getSounds'](_0x364a3d);}})[_0xcf63('0x24')](function(_0x5ba92f){if(_0x5ba92f){_0xb8af00=_0x5ba92f['length'];if(!_0x4355ca[_0xcf63('0x32')]['hasOwnProperty'](_0xcf63('0x38'))){_0x364a3d['limit']=qs['limit'](_0x4355ca['query']['limit']);_0x364a3d[_0xcf63('0x1b')]=qs[_0xcf63('0x1b')](_0x4355ca['query'][_0xcf63('0x1b')]);}return _0x1ae832['getSounds'](_0x364a3d);}})['then'](function(_0x54a031){if(_0x54a031){return _0x54a031?{'count':_0xb8af00,'rows':_0x54a031}:null;}})[_0xcf63('0x24')](respondWithResult(_0x1adf87,null))[_0xcf63('0x45')](handleError(_0x1adf87,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 4932deb..9e1bc98 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 _0x649c=['../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x45a29d,_0x49bcaa){var _0x3c6580=function(_0x353189){while(--_0x353189){_0x45a29d['push'](_0x45a29d['shift']());}};_0x3c6580(++_0x49bcaa);}(_0x649c,0x1c1));var _0xc649=function(_0x1f344b,_0x37ad46){_0x1f344b=_0x1f344b-0x0;var _0x3069fe=_0x649c[_0x1f344b];return _0x3069fe;};'use strict';var _=require(_0xc649('0x0'));var util=require(_0xc649('0x1'));var logger=require(_0xc649('0x2'))('api');var moment=require(_0xc649('0x3'));var BPromise=require(_0xc649('0x4'));var rp=require(_0xc649('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc649('0x6'));var config=require(_0xc649('0x7'));var attributes=require(_0xc649('0x8'));module[_0xc649('0x9')]=function(_0x13b222,_0x3fe864){return _0x13b222[_0xc649('0xa')]('VoiceMusicOnHold',attributes,{'tableName':_0xc649('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa978=['rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0xa978,0x93));var _0x8a97=function(_0x61a93d,_0x7adc76){_0x61a93d=_0x61a93d-0x0;var _0x564ad7=_0xa978[_0x61a93d];return _0x564ad7;};'use strict';var _=require(_0x8a97('0x0'));var util=require(_0x8a97('0x1'));var logger=require(_0x8a97('0x2'))(_0x8a97('0x3'));var moment=require(_0x8a97('0x4'));var BPromise=require(_0x8a97('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a97('0x6'));var rimraf=require(_0x8a97('0x7'));var config=require(_0x8a97('0x8'));var attributes=require(_0x8a97('0x9'));module[_0x8a97('0xa')]=function(_0x1867b3,_0x402b60){return _0x1867b3[_0x8a97('0xb')](_0x8a97('0xc'),attributes,{'tableName':_0x8a97('0xd'),'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 c47d944..0abf2d2 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 _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0x1d2d8d,_0x36a5e5){var _0xca8026=function(_0x4273fd){while(--_0x4273fd){_0x1d2d8d['push'](_0x1d2d8d['shift']());}};_0xca8026(++_0x36a5e5);}(_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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file +var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xddec16,_0x60864e){var _0x298bc6=function(_0x110892){while(--_0x110892){_0xddec16['push'](_0xddec16['shift']());}};_0x298bc6(++_0x60864e);}(_0x70e0,0x17b));var _0x070e=function(_0x10e0af,_0x35a91c){_0x10e0af=_0x10e0af-0x0;var _0x402a6f=_0x70e0[_0x10e0af];return _0x402a6f;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 9f31268..b81e2d3 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 _0xeb5d=['/:id','show','/:id/users','getAgents','getTeams','post','create','addTeams','put','delete','destroy','removeTeams','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe'];(function(_0xeb7891,_0x4771f7){var _0x11cc19=function(_0x768961){while(--_0x768961){_0xeb7891['push'](_0xeb7891['shift']());}};_0x11cc19(++_0x4771f7);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xeb5d[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require(_0xdeb5('0x0'));var path=require(_0xdeb5('0x1'));var timeout=require(_0xdeb5('0x2'));var express=require(_0xdeb5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdeb5('0x4'));var interaction=require(_0xdeb5('0x5'));var config=require('../../config/environment');var controller=require(_0xdeb5('0x6'));router[_0xdeb5('0x7')]('/',auth[_0xdeb5('0x8')](),controller[_0xdeb5('0x9')]);router[_0xdeb5('0x7')](_0xdeb5('0xa'),auth[_0xdeb5('0x8')](),controller[_0xdeb5('0xb')]);router[_0xdeb5('0x7')](_0xdeb5('0xc'),auth[_0xdeb5('0x8')](),controller[_0xdeb5('0xd')]);router[_0xdeb5('0x7')](_0xdeb5('0xe'),auth[_0xdeb5('0x8')](),controller[_0xdeb5('0xf')]);router[_0xdeb5('0x7')]('/:id/teams',auth[_0xdeb5('0x8')](),controller[_0xdeb5('0x10')]);router[_0xdeb5('0x11')]('/',auth[_0xdeb5('0x8')](),controller[_0xdeb5('0x12')]);router[_0xdeb5('0x11')](_0xdeb5('0xe'),auth[_0xdeb5('0x8')](),controller['addAgents']);router[_0xdeb5('0x11')]('/:id/teams',auth[_0xdeb5('0x8')](),controller[_0xdeb5('0x13')]);router[_0xdeb5('0x14')](_0xdeb5('0xc'),auth[_0xdeb5('0x8')](),controller['update']);router[_0xdeb5('0x15')](_0xdeb5('0xc'),auth['isAuthenticated'](),controller[_0xdeb5('0x16')]);router[_0xdeb5('0x15')](_0xdeb5('0xe'),auth['isAuthenticated'](),controller['removeAgents']);router[_0xdeb5('0x15')]('/:id/teams',auth[_0xdeb5('0x8')](),controller[_0xdeb5('0x17')]);module[_0xdeb5('0x18')]=router; \ No newline at end of file +var _0x9589=['./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','delete','removeAgents','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x13520e,_0x452769){var _0x38e4e7=function(_0x3f8605){while(--_0x3f8605){_0x13520e['push'](_0x13520e['shift']());}};_0x38e4e7(++_0x452769);}(_0x9589,0xbc));var _0x9958=function(_0x14be7b,_0x369d2d){_0x14be7b=_0x14be7b-0x0;var _0x5c9127=_0x9589[_0x14be7b];return _0x5c9127;};'use strict';var multer=require(_0x9958('0x0'));var util=require(_0x9958('0x1'));var path=require(_0x9958('0x2'));var timeout=require(_0x9958('0x3'));var express=require(_0x9958('0x4'));var router=express['Router']();var fs_extra=require(_0x9958('0x5'));var auth=require(_0x9958('0x6'));var interaction=require(_0x9958('0x7'));var config=require('../../config/environment');var controller=require(_0x9958('0x8'));router[_0x9958('0x9')]('/',auth[_0x9958('0xa')](),controller[_0x9958('0xb')]);router[_0x9958('0x9')](_0x9958('0xc'),auth['isAuthenticated'](),controller[_0x9958('0xd')]);router[_0x9958('0x9')](_0x9958('0xe'),auth[_0x9958('0xa')](),controller[_0x9958('0xf')]);router[_0x9958('0x9')](_0x9958('0x10'),auth[_0x9958('0xa')](),controller[_0x9958('0x11')]);router[_0x9958('0x9')](_0x9958('0x12'),auth[_0x9958('0xa')](),controller[_0x9958('0x13')]);router[_0x9958('0x14')]('/',auth[_0x9958('0xa')](),controller[_0x9958('0x15')]);router[_0x9958('0x14')](_0x9958('0x10'),auth['isAuthenticated'](),controller[_0x9958('0x16')]);router['post'](_0x9958('0x12'),auth['isAuthenticated'](),controller[_0x9958('0x17')]);router[_0x9958('0x18')](_0x9958('0xe'),auth[_0x9958('0xa')](),controller['update']);router[_0x9958('0x19')](_0x9958('0xe'),auth['isAuthenticated'](),controller['destroy']);router[_0x9958('0x19')]('/:id/users',auth[_0x9958('0xa')](),controller[_0x9958('0x1a')]);router[_0x9958('0x19')](_0x9958('0x12'),auth[_0x9958('0xa')](),controller[_0x9958('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 272ffbd..3e163d6 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 _0x0ba1=['getDataValue','sequelize','STRING','name','VIRTUAL','system-'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0ba1,0x181));var _0x10ba=function(_0x176acd,_0x469f4f){_0x176acd=_0x176acd-0x0;var _0x251766=_0x0ba1[_0x176acd];return _0x251766;};'use strict';var Sequelize=require(_0x10ba('0x0'));module['exports']={'name':{'type':Sequelize[_0x10ba('0x1')],'allowNull':![],'unique':_0x10ba('0x2')},'prefix':{'type':Sequelize[_0x10ba('0x3')],'get':function(_0x15ebc4){return _0x10ba('0x4')+this[_0x10ba('0x5')](_0x10ba('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x10ba('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x0fdc=['INTEGER','sequelize','exports','STRING','VIRTUAL','name'];(function(_0x1029d2,_0x5d4463){var _0x5c1b84=function(_0x47aee4){while(--_0x47aee4){_0x1029d2['push'](_0x1029d2['shift']());}};_0x5c1b84(++_0x5d4463);}(_0x0fdc,0xcd));var _0xc0fd=function(_0x534de1,_0x384bac){_0x534de1=_0x534de1-0x0;var _0x53a4a9=_0x0fdc[_0x534de1];return _0x53a4a9;};'use strict';var Sequelize=require(_0xc0fd('0x0'));module[_0xc0fd('0x1')]={'name':{'type':Sequelize[_0xc0fd('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xc0fd('0x3')],'get':function(_0x1e96e1){return'system-'+this['getDataValue'](_0xc0fd('0x4'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0xc0fd('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 16b0d6d..6021671 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 _0x9f0e=['limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','index','map','VoicePrefix','rawAttributes','key','keys','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','filters','options','find','describe','create','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','app','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','sequelize','findById','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','findOne','order','pick','getAgents','getTeams','Team','User','Agents','flatMap','addTeams','each','TeamVoicePrefix','upsert','forEach','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','QueryTypes','SELECT','TeamId','all','union','value','removeTeams','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','status','end','json','undefined'];(function(_0xc611d9,_0x1447d4){var _0xc6649e=function(_0x360115){while(--_0x360115){_0xc611d9['push'](_0xc611d9['shift']());}};_0xc6649e(++_0x1447d4);}(_0x9f0e,0x116));var _0xe9f0=function(_0x514627,_0x551e4f){_0x514627=_0x514627-0x0;var _0x5f2473=_0x9f0e[_0x514627];return _0x5f2473;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];config['redis']=_[_0xe9f0('0x19')](config[_0xe9f0('0x1a')],{'host':_0xe9f0('0x1b'),'port':0x18eb});var socket=require(_0xe9f0('0x1c'))(new Redis(config['redis']));require(_0xe9f0('0x1d'))['register'](socket);function respondWithStatusCode(_0x1e3ba8,_0x23914b){_0x23914b=_0x23914b||0xcc;return function(_0x3800e8){if(_0x3800e8){return _0x1e3ba8['sendStatus'](_0x23914b);}return _0x1e3ba8[_0xe9f0('0x1e')](_0x23914b)[_0xe9f0('0x1f')]();};}function respondWithResult(_0x2e68ef,_0x598eee){_0x598eee=_0x598eee||0xc8;return function(_0xaa7aa6){if(_0xaa7aa6){return _0x2e68ef[_0xe9f0('0x1e')](_0x598eee)[_0xe9f0('0x20')](_0xaa7aa6);}};}function respondWithFilteredResult(_0xd71ac8,_0x3ed69a){return function(_0x2ab12b){if(_0x2ab12b){var _0x3da237=typeof _0x3ed69a['offset']===_0xe9f0('0x21')&&typeof _0x3ed69a[_0xe9f0('0x22')]===_0xe9f0('0x21');var _0x5c4182=_0x2ab12b[_0xe9f0('0x23')];var _0x30b8c7=_0x3da237?0x0:_0x3ed69a[_0xe9f0('0x24')];var _0x43f399=_0x3da237?_0x2ab12b['count']:_0x3ed69a[_0xe9f0('0x24')]+_0x3ed69a[_0xe9f0('0x22')];var _0x583687;if(_0x43f399>=_0x5c4182){_0x43f399=_0x5c4182;_0x583687=0xc8;}else{_0x583687=0xce;}_0xd71ac8['status'](_0x583687);return _0xd71ac8['set'](_0xe9f0('0x25'),_0x30b8c7+'-'+_0x43f399+'/'+_0x5c4182)[_0xe9f0('0x20')](_0x2ab12b);}return null;};}function patchUpdates(_0x1211ae){return function(_0x316cdf){try{jsonpatch[_0xe9f0('0x26')](_0x316cdf,_0x1211ae,!![]);}catch(_0x4a5c27){return BPromise[_0xe9f0('0x27')](_0x4a5c27);}return _0x316cdf[_0xe9f0('0x28')]();};}function saveUpdates(_0x437d43,_0x10801b){return function(_0x3ca991){if(_0x3ca991){return _0x3ca991[_0xe9f0('0x29')](_0x437d43)[_0xe9f0('0x2a')](function(_0x1321bb){return _0x1321bb;});}return null;};}function removeEntity(_0x3c4ba9,_0x3fce54){return function(_0x48128a){if(_0x48128a){return _0x48128a[_0xe9f0('0x2b')]()[_0xe9f0('0x2a')](function(){var _0x2ddfba=_0x48128a[_0xe9f0('0x2c')]({'plain':!![]});var _0x4cf1b1=_0xe9f0('0x2d');return db[_0xe9f0('0x2e')][_0xe9f0('0x2b')]({'where':{'type':_0x4cf1b1,'resourceId':_0x2ddfba['id']}})[_0xe9f0('0x2a')](function(){return _0x48128a;});})[_0xe9f0('0x2a')](function(){_0x3c4ba9['status'](0xcc)[_0xe9f0('0x1f')]();});}};}function handleEntityNotFound(_0xdc16bc,_0x44fb5b){return function(_0xab3d81){if(!_0xab3d81){_0xdc16bc[_0xe9f0('0x2f')](0x194);}return _0xab3d81;};}function handleError(_0xd19788,_0x1d788a){_0x1d788a=_0x1d788a||0x1f4;return function(_0x2efd33){logger[_0xe9f0('0x30')](_0x2efd33[_0xe9f0('0x31')]);if(_0x2efd33[_0xe9f0('0x32')]){delete _0x2efd33[_0xe9f0('0x32')];}_0xd19788[_0xe9f0('0x1e')](_0x1d788a)[_0xe9f0('0x33')](_0x2efd33);};}exports[_0xe9f0('0x34')]=function(_0x2097c4,_0x80e3ac){var _0x3e1846={},_0x2e7535={},_0x19d799={'count':0x0,'rows':[]};var _0x4089cc=_[_0xe9f0('0x35')](db[_0xe9f0('0x36')][_0xe9f0('0x37')],function(_0x5480ce){return{'name':_0x5480ce['fieldName'],'type':_0x5480ce['type'][_0xe9f0('0x38')]};});_0x2e7535['model']=_[_0xe9f0('0x35')](_0x4089cc,_0xe9f0('0x32'));_0x2e7535['query']=_[_0xe9f0('0x39')](_0x2097c4['query']);_0x2e7535['filters']=_['intersection'](_0x2e7535[_0xe9f0('0x3a')],_0x2e7535[_0xe9f0('0x3b')]);_0x3e1846['attributes']=_[_0xe9f0('0x3c')](_0x2e7535[_0xe9f0('0x3a')],qs[_0xe9f0('0x3d')](_0x2097c4['query']['fields']));_0x3e1846[_0xe9f0('0x3e')]=_0x3e1846[_0xe9f0('0x3e')][_0xe9f0('0x3f')]?_0x3e1846['attributes']:_0x2e7535[_0xe9f0('0x3a')];if(!_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x40')](_0xe9f0('0x41'))){_0x3e1846[_0xe9f0('0x22')]=qs['limit'](_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x22')]);_0x3e1846[_0xe9f0('0x24')]=qs['offset'](_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x24')]);}_0x3e1846['order']=qs[_0xe9f0('0x42')](_0x2097c4['query'][_0xe9f0('0x42')]);_0x3e1846['where']=qs['filters'](_['pick'](_0x2097c4['query'],_0x2e7535['filters']),_0x4089cc);if(_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x43')]){_0x3e1846[_0xe9f0('0x44')]=_[_0xe9f0('0x45')](_0x3e1846[_0xe9f0('0x44')],{'$or':_[_0xe9f0('0x35')](_0x4089cc,function(_0x3d4eb7){if(_0x3d4eb7[_0xe9f0('0x46')]!==_0xe9f0('0x47')){var _0x4e1c68={};_0x4e1c68[_0x3d4eb7[_0xe9f0('0x32')]]={'$like':'%'+_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x43')]+'%'};return _0x4e1c68;}})});}_0x3e1846=_['merge']({},_0x3e1846,_0x2097c4['options']);var _0x3cbf49={'where':_0x3e1846['where']};return db[_0xe9f0('0x36')][_0xe9f0('0x23')](_0x3cbf49)[_0xe9f0('0x2a')](function(_0x42d9d2){_0x19d799['count']=_0x42d9d2;if(_0x2097c4[_0xe9f0('0x3b')][_0xe9f0('0x48')]){_0x3e1846[_0xe9f0('0x49')]=[{'all':!![]}];}return db[_0xe9f0('0x36')][_0xe9f0('0x4a')](_0x3e1846);})['then'](function(_0x60a40d){_0x19d799[_0xe9f0('0x4b')]=_0x60a40d;return _0x19d799;})[_0xe9f0('0x2a')](respondWithFilteredResult(_0x80e3ac,_0x3e1846))[_0xe9f0('0x4c')](handleError(_0x80e3ac,null));};exports[_0xe9f0('0x4d')]=function(_0x4ffc17,_0x3a8d1d){var _0x54ab8f={'raw':![],'where':{'id':_0x4ffc17[_0xe9f0('0x4e')]['id']}},_0x54e432={};_0x54e432[_0xe9f0('0x3a')]=_['keys'](db[_0xe9f0('0x36')][_0xe9f0('0x37')]);_0x54e432[_0xe9f0('0x3b')]=_[_0xe9f0('0x39')](_0x4ffc17[_0xe9f0('0x3b')]);_0x54e432[_0xe9f0('0x4f')]=_[_0xe9f0('0x3c')](_0x54e432['model'],_0x54e432[_0xe9f0('0x3b')]);_0x54ab8f['attributes']=_[_0xe9f0('0x3c')](_0x54e432['model'],qs[_0xe9f0('0x3d')](_0x4ffc17['query'][_0xe9f0('0x3d')]));_0x54ab8f[_0xe9f0('0x3e')]=_0x54ab8f[_0xe9f0('0x3e')]['length']?_0x54ab8f[_0xe9f0('0x3e')]:_0x54e432[_0xe9f0('0x3a')];if(_0x4ffc17[_0xe9f0('0x3b')][_0xe9f0('0x48')]){_0x54ab8f[_0xe9f0('0x49')]=[{'all':!![]}];}_0x54ab8f=_[_0xe9f0('0x45')]({},_0x54ab8f,_0x4ffc17[_0xe9f0('0x50')]);return db[_0xe9f0('0x36')][_0xe9f0('0x51')](_0x54ab8f)[_0xe9f0('0x2a')](handleEntityNotFound(_0x3a8d1d,null))[_0xe9f0('0x2a')](respondWithResult(_0x3a8d1d,null))[_0xe9f0('0x4c')](handleError(_0x3a8d1d,null));};exports['destroy']=function(_0x55e898,_0x31aa19){return db[_0xe9f0('0x36')][_0xe9f0('0x51')]({'where':{'id':_0x55e898['params']['id']}})[_0xe9f0('0x2a')](handleEntityNotFound(_0x31aa19,null))['then'](removeEntity(_0x31aa19,null))[_0xe9f0('0x4c')](handleError(_0x31aa19,null));};exports[_0xe9f0('0x52')]=function(_0x31770f,_0x4e8416){return db['VoicePrefix'][_0xe9f0('0x52')]()[_0xe9f0('0x2a')](respondWithResult(_0x4e8416,null))['catch'](handleError(_0x4e8416,null));};exports[_0xe9f0('0x53')]=function(_0xafb4d7,_0x33f26c){var _0xa26972;return db['sequelize'][_0xe9f0('0x54')](function(_0x3a5d19){return db[_0xe9f0('0x36')][_0xe9f0('0x53')](_0xafb4d7[_0xe9f0('0x55')],{'transaction':_0x3a5d19})[_0xe9f0('0x2a')](function(_0x1cba23){_0xa26972=_0x1cba23[_0xe9f0('0x2c')]({'plain':!![]});return db['VoiceExtension'][_0xe9f0('0x51')]({'where':{'id':_0xa26972[_0xe9f0('0x56')]},'raw':!![]})[_0xe9f0('0x2a')](function(_0x4728e7){return createVoicePrefixExtensions(_0xa26972,_0x4728e7,_0x3a5d19);});});})[_0xe9f0('0x2a')](function(){var _0xe67052=_0xafb4d7[_0xe9f0('0x57')][_0xe9f0('0x2c')]({'plain':!![]});if(!_0xe67052)throw new Error(_0xe9f0('0x58'));if(_0xe67052[_0xe9f0('0x59')]===_0xe9f0('0x57')){var _0x3c26ac=_0xa26972;return db[_0xe9f0('0x5a')][_0xe9f0('0x51')]({'where':{'name':'VoicePrefixes','userProfileId':_0xe67052[_0xe9f0('0x5b')]},'raw':!![]})[_0xe9f0('0x2a')](function(_0x52bcce){if(_0x52bcce&&_0x52bcce['autoAssociation']===0x0){return db['UserProfileResource'][_0xe9f0('0x53')]({'name':_0x3c26ac['name'],'resourceId':_0x3c26ac['id'],'type':_0x52bcce[_0xe9f0('0x32')],'sectionId':_0x52bcce['id']},{})[_0xe9f0('0x2a')](function(){return _0xa26972;});}else{return _0xa26972;}})[_0xe9f0('0x4c')](function(_0x4c983e){logger[_0xe9f0('0x30')](_0xe9f0('0x5c'),_0x4c983e);throw _0x4c983e;});}return _0xa26972;})[_0xe9f0('0x2a')](respondWithResult(_0x33f26c,null))[_0xe9f0('0x4c')](handleError(_0x33f26c,null));};function Extension(_0x4bb39d,_0x392eae,_0x3a05e7,_0x28a66e){this[_0xe9f0('0x5d')]='from-sip';this['exten']=_0x4bb39d;this[_0xe9f0('0x5e')]=_0x3a05e7;this[_0xe9f0('0x46')]=_0xe9f0('0x5f');this[_0xe9f0('0x60')]=_0xe9f0('0x61');this['priority']=_0x392eae;this[_0xe9f0('0x62')]=_0x28a66e;}function createVoicePrefixExtensions(_0x55ce2d,_0x16b3c0,_0x5858a9){return new BPromise(function(_0x7c05aa,_0x15ece3){var _0x8b26f2=new Extension(formatPrefixName(_0x55ce2d[_0xe9f0('0x63')]),0x1,_0xe9f0('0x64'),'Voice\x20Prefix');_0x8b26f2['VoicePrefixId']=_0x55ce2d['id'];return db['VoiceExtension'][_0xe9f0('0x53')](_0x8b26f2,{'transaction':_0x5858a9})[_0xe9f0('0x2a')](function(_0x4f6f7c){var _0x2fd3b2=_0x4f6f7c['get']({'plain':!![]});var _0x4f6a5b=_[_0xe9f0('0x35')](addVoicePrefixExtensions(_0x55ce2d,_0x16b3c0),function(_0x329e9e){_0x329e9e[_0xe9f0('0x56')]=_0x2fd3b2['id'];_0x329e9e[_0xe9f0('0x65')]=_0x55ce2d['id'];return _0x329e9e;});return db[_0xe9f0('0x66')][_0xe9f0('0x67')](_0x4f6a5b,{'transaction':_0x5858a9})['then'](function(_0x5e4ad4){if(!_0x5e4ad4){return _0x15ece3(_0xe9f0('0x68'));}else{return _0x7c05aa(_0x5e4ad4);}})[_0xe9f0('0x4c')](function(_0x12d40a){return _0x15ece3(_0x12d40a);});});;});};function addVoicePrefixExtensions(_0x1f57a1,_0x55dae1){var _0xb9b439=[];var _0x83dea9=formatPrefixName(_0x1f57a1[_0xe9f0('0x63')]);_0xb9b439[_0xe9f0('0x69')](new Extension(_0x83dea9,0x2,_0xe9f0('0x6a'),_0xe9f0('0x6b')+_0x1f57a1['name']));if(_0x1f57a1[_0xe9f0('0x6c')]){_0xb9b439[_0xe9f0('0x69')](new Extension(_0x83dea9,0x3,_0xe9f0('0x6a'),_0xe9f0('0x6d')+_0x1f57a1[_0xe9f0('0x6c')]));}else{_0xb9b439['push'](new Extension(_0x83dea9,0x3,_0xe9f0('0x64'),_0xe9f0('0x6e')));}_0xb9b439[_0xe9f0('0x69')](new Extension(_0x83dea9,0x4,_0xe9f0('0x6f'),_0x55dae1[_0xe9f0('0x5d')]+','+_0xe9f0('0x70')+(0x8+_0x1f57a1[_0xe9f0('0x32')][_0xe9f0('0x3f')])+'}'+','+0x1));return _0xb9b439;}function formatPrefixName(_0x2eaead){var _0x27e6bc='_';for(var _0xeaab41=0x0;_0xeaab41<_0x2eaead[_0xe9f0('0x3f')];_0xeaab41++){if(_0x2eaead['charAt'](_0xeaab41)=='-'){_0x27e6bc+=_0x2eaead[_0xe9f0('0x71')](_0xeaab41);}else{_0x27e6bc+='['+_0x2eaead[_0xe9f0('0x71')](_0xeaab41)+']';}}_0x27e6bc+='.';return _0x27e6bc;}exports[_0xe9f0('0x29')]=function(_0x116ec5,_0x3c700e,_0x2428aa){var _0x158e44=_0x116ec5['body'];_0x158e44[_0xe9f0('0x63')]=_0xe9f0('0x72')+_0x158e44['name']+'-';return db[_0xe9f0('0x73')][_0xe9f0('0x54')](function(_0x442b78){return db['VoicePrefix'][_0xe9f0('0x29')](_0x158e44,{'where':{'id':_0x158e44['id']},'transaction':_0x442b78})[_0xe9f0('0x2a')](function(){return db['VoiceExtension'][_0xe9f0('0x2b')]({'where':{'VoicePrefixId':_0x158e44['id']},'transaction':_0x442b78})[_0xe9f0('0x2a')](function(){return db['VoiceExtension']['find']({'where':{'id':_0x158e44[_0xe9f0('0x56')]},'raw':!![]})['then'](function(_0x386d7b){return createVoicePrefixExtensions(_0x158e44,_0x386d7b,_0x442b78);});});});})[_0xe9f0('0x2a')](function(){return db['VoicePrefix'][_0xe9f0('0x74')](_0x158e44['id']);})[_0xe9f0('0x2a')](respondWithResult(_0x3c700e,null))[_0xe9f0('0x4c')](handleError(_0x3c700e,null));};exports[_0xe9f0('0x75')]=function(_0x161ee4,_0x8096c2,_0x42e4e9){return db[_0xe9f0('0x36')][_0xe9f0('0x51')]({'where':{'id':_0x161ee4['params']['id']}})[_0xe9f0('0x2a')](handleEntityNotFound(_0x8096c2,null))[_0xe9f0('0x2a')](function(_0xe7fdb){if(_0xe7fdb){return _0xe7fdb[_0xe9f0('0x75')](_0x161ee4[_0xe9f0('0x55')][_0xe9f0('0x76')],_[_0xe9f0('0x77')](_0x161ee4[_0xe9f0('0x55')],['ids','id'])||{})[_0xe9f0('0x78')](function(_0x17c18c){for(var _0x2ce60c=0x0;_0x2ce60c<_0x161ee4[_0xe9f0('0x55')][_0xe9f0('0x76')][_0xe9f0('0x3f')];_0x2ce60c+=0x1){socket['emit'](_0xe9f0('0x79'),{'UserId':Number(_0x161ee4['body']['ids'][_0x2ce60c]),'VoicePrefixId':Number(_0x161ee4['params']['id'])});}return _0x17c18c;});}})[_0xe9f0('0x2a')](respondWithResult(_0x8096c2,null))[_0xe9f0('0x4c')](handleError(_0x8096c2,null));};exports[_0xe9f0('0x7a')]=function(_0x3b5b57,_0x2bf006,_0x8f8df5){return db[_0xe9f0('0x36')][_0xe9f0('0x51')]({'where':{'id':_0x3b5b57[_0xe9f0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2bf006,null))[_0xe9f0('0x2a')](function(_0x29eee2){if(_0x29eee2){return _0x29eee2[_0xe9f0('0x7a')](_0x3b5b57[_0xe9f0('0x3b')][_0xe9f0('0x76')])[_0xe9f0('0x2a')](function(){if(_[_0xe9f0('0x7b')](_0x3b5b57[_0xe9f0('0x3b')][_0xe9f0('0x76')])){for(var _0x1a4217=0x0;_0x1a4217<_0x3b5b57['query']['ids'][_0xe9f0('0x3f')];_0x1a4217+=0x1){socket[_0xe9f0('0x7c')](_0xe9f0('0x7d'),{'UserId':Number(_0x3b5b57[_0xe9f0('0x3b')][_0xe9f0('0x76')][_0x1a4217]),'VoicePrefixId':Number(_0x3b5b57[_0xe9f0('0x4e')]['id'])});}}else{socket[_0xe9f0('0x7c')](_0xe9f0('0x7d'),{'UserId':Number(_0x3b5b57['query']['ids']),'VoicePrefixId':Number(_0x3b5b57[_0xe9f0('0x4e')]['id'])});}});}})[_0xe9f0('0x2a')](respondWithStatusCode(_0x2bf006,null))['catch'](handleError(_0x2bf006,null));};exports['getAgents']=function(_0x2c9d84,_0x145040,_0x3ed26a){var _0xab92b={};var _0x2f73cd={};var _0x5553df;var _0x20c026;return db[_0xe9f0('0x36')][_0xe9f0('0x7e')]({'where':{'id':_0x2c9d84[_0xe9f0('0x4e')]['id']}})[_0xe9f0('0x2a')](handleEntityNotFound(_0x145040,null))[_0xe9f0('0x2a')](function(_0x2aca09){if(_0x2aca09){_0x5553df=_0x2aca09;_0x2f73cd['model']=_['keys'](db['User'][_0xe9f0('0x37')]);_0x2f73cd[_0xe9f0('0x3b')]=_[_0xe9f0('0x39')](_0x2c9d84[_0xe9f0('0x3b')]);_0x2f73cd['filters']=_[_0xe9f0('0x3c')](_0x2f73cd['model'],_0x2f73cd[_0xe9f0('0x3b')]);_0xab92b['attributes']=_[_0xe9f0('0x3c')](_0x2f73cd[_0xe9f0('0x3a')],qs[_0xe9f0('0x3d')](_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x3d')]));_0xab92b[_0xe9f0('0x3e')]=_0xab92b['attributes'][_0xe9f0('0x3f')]?_0xab92b[_0xe9f0('0x3e')]:_0x2f73cd[_0xe9f0('0x3a')];_0xab92b[_0xe9f0('0x7f')]=qs[_0xe9f0('0x42')](_0x2c9d84['query'][_0xe9f0('0x42')]);_0xab92b[_0xe9f0('0x44')]=qs['filters'](_[_0xe9f0('0x80')](_0x2c9d84['query'],_0x2f73cd[_0xe9f0('0x4f')]));if(_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x43')]){_0xab92b['where']=_[_0xe9f0('0x45')](_0xab92b[_0xe9f0('0x44')],{'$or':_[_0xe9f0('0x35')](_0xab92b['attributes'],function(_0x2a5d79){var _0x473f78={};_0x473f78[_0x2a5d79]={'$like':'%'+_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x43')]+'%'};return _0x473f78;})});}_0xab92b=_[_0xe9f0('0x45')]({},_0xab92b,_0x2c9d84[_0xe9f0('0x50')]);return _0x5553df[_0xe9f0('0x81')](_0xab92b);}})['then'](function(_0x4a416c){if(_0x4a416c){_0x20c026=_0x4a416c[_0xe9f0('0x3f')];if(!_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x40')]('nolimit')){_0xab92b[_0xe9f0('0x22')]=qs[_0xe9f0('0x22')](_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x22')]);_0xab92b['offset']=qs['offset'](_0x2c9d84[_0xe9f0('0x3b')][_0xe9f0('0x24')]);}return _0x5553df['getAgents'](_0xab92b);}})[_0xe9f0('0x2a')](function(_0x5b26b1){if(_0x5b26b1){return _0x5b26b1?{'count':_0x20c026,'rows':_0x5b26b1}:null;}})['then'](respondWithResult(_0x145040,null))[_0xe9f0('0x4c')](handleError(_0x145040,null));};exports[_0xe9f0('0x82')]=function(_0x77b59d,_0x32ad0e,_0x10c4cf){var _0x563f55={};var _0x5761d3={};var _0x3e323e;var _0x41c1a9;return db[_0xe9f0('0x36')][_0xe9f0('0x7e')]({'where':{'id':_0x77b59d[_0xe9f0('0x4e')]['id']}})['then'](handleEntityNotFound(_0x32ad0e,null))['then'](function(_0x5ae1ce){if(_0x5ae1ce){_0x3e323e=_0x5ae1ce;_0x5761d3[_0xe9f0('0x3a')]=_['keys'](db[_0xe9f0('0x83')][_0xe9f0('0x37')]);_0x5761d3[_0xe9f0('0x3b')]=_[_0xe9f0('0x39')](_0x77b59d[_0xe9f0('0x3b')]);_0x5761d3[_0xe9f0('0x4f')]=_['intersection'](_0x5761d3['model'],_0x5761d3[_0xe9f0('0x3b')]);_0x563f55[_0xe9f0('0x3e')]=_[_0xe9f0('0x3c')](_0x5761d3[_0xe9f0('0x3a')],qs[_0xe9f0('0x3d')](_0x77b59d[_0xe9f0('0x3b')][_0xe9f0('0x3d')]));_0x563f55[_0xe9f0('0x3e')]=_0x563f55[_0xe9f0('0x3e')][_0xe9f0('0x3f')]?_0x563f55[_0xe9f0('0x3e')]:_0x5761d3[_0xe9f0('0x3a')];_0x563f55[_0xe9f0('0x7f')]=qs[_0xe9f0('0x42')](_0x77b59d['query'][_0xe9f0('0x42')]);_0x563f55[_0xe9f0('0x44')]=qs[_0xe9f0('0x4f')](_[_0xe9f0('0x80')](_0x77b59d[_0xe9f0('0x3b')],_0x5761d3[_0xe9f0('0x4f')]));if(_0x77b59d[_0xe9f0('0x3b')][_0xe9f0('0x43')]){_0x563f55[_0xe9f0('0x44')]=_[_0xe9f0('0x45')](_0x563f55[_0xe9f0('0x44')],{'$or':_['map'](_0x563f55[_0xe9f0('0x3e')],function(_0x2b9c16){var _0x41ef5b={};_0x41ef5b[_0x2b9c16]={'$like':'%'+_0x77b59d[_0xe9f0('0x3b')][_0xe9f0('0x43')]+'%'};return _0x41ef5b;})});}_0x563f55=_[_0xe9f0('0x45')]({},_0x563f55,_0x77b59d[_0xe9f0('0x50')]);return _0x3e323e[_0xe9f0('0x82')](_0x563f55);}})['then'](function(_0x5c5ac9){if(_0x5c5ac9){_0x41c1a9=_0x5c5ac9[_0xe9f0('0x3f')];if(!_0x77b59d[_0xe9f0('0x3b')]['hasOwnProperty']('nolimit')){_0x563f55[_0xe9f0('0x22')]=qs[_0xe9f0('0x22')](_0x77b59d[_0xe9f0('0x3b')][_0xe9f0('0x22')]);_0x563f55[_0xe9f0('0x24')]=qs[_0xe9f0('0x24')](_0x77b59d['query'][_0xe9f0('0x24')]);}return _0x3e323e[_0xe9f0('0x82')](_0x563f55);}})['then'](function(_0x4d59c0){if(_0x4d59c0){return _0x4d59c0?{'count':_0x41c1a9,'rows':_0x4d59c0}:null;}})[_0xe9f0('0x2a')](respondWithResult(_0x32ad0e,null))[_0xe9f0('0x4c')](handleError(_0x32ad0e,null));};exports['addTeams']=function(_0x17013a,_0x63e374,_0x34eda8){var _0x5a38f4=_0x17013a[_0xe9f0('0x55')][_0xe9f0('0x76')];var _0x2a607b;return db[_0xe9f0('0x83')]['findAll']({'where':{'id':_0x5a38f4},'attributes':['id'],'include':[{'model':db[_0xe9f0('0x84')],'as':_0xe9f0('0x85'),'attributes':['id',_0xe9f0('0x32'),'online','voicePause','interface'],'raw':!![]}]})[_0xe9f0('0x2a')](function(_0x58db9d){if(_0x58db9d){_0x2a607b=_0x58db9d;var _0x4820a1=_[_0xe9f0('0x86')](_0x58db9d,function(_0x4cd8bc){var _0x1b2532=_0x4cd8bc[_0xe9f0('0x2c')]({'plain':!![]});return _0x1b2532[_0xe9f0('0x85')];});return db[_0xe9f0('0x36')]['find']({'where':{'id':_0x17013a[_0xe9f0('0x4e')]['id']}})[_0xe9f0('0x2a')](function(_0x231d94){return db[_0xe9f0('0x73')][_0xe9f0('0x54')](function(_0x25c2f6){return _0x231d94[_0xe9f0('0x87')](_0x5a38f4,{'transaction':_0x25c2f6})[_0xe9f0('0x2a')](function(){return BPromise[_0xe9f0('0x88')](_0x2a607b,function(_0x2cd0a5){return db[_0xe9f0('0x89')][_0xe9f0('0x8a')]({'TeamId':_0x2cd0a5['id'],'VoicePrefixId':_0x17013a[_0xe9f0('0x4e')]['id']},{'transaction':_0x25c2f6});});})['then'](function(){return BPromise[_0xe9f0('0x88')](_0x4820a1,function(_0x1d8fb5){return db['UserVoicePrefix']['findOrCreate']({'where':{'UserId':_0x1d8fb5['id'],'VoicePrefixId':_0x17013a[_0xe9f0('0x4e')]['id']},'transaction':_0x25c2f6});});})[_0xe9f0('0x2a')](function(){_0x4820a1[_0xe9f0('0x8b')](function(_0x1c0db4){socket['emit'](_0xe9f0('0x79'),{'UserId':_0x1c0db4['id'],'VoicePrefixId':_0x231d94['id']});});});});});}})[_0xe9f0('0x2a')](respondWithStatusCode(_0x63e374,null))[_0xe9f0('0x4c')](handleError(_0x63e374,null));};exports['removeTeams']=function(_0x448834,_0x116aec,_0x4398fd){return db[_0xe9f0('0x83')][_0xe9f0('0x4a')]({'where':{'id':_0x448834['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xe9f0('0x84')],'as':_0xe9f0('0x85'),'attributes':['id'],'raw':!![]}]})[_0xe9f0('0x2a')](handleEntityNotFound(_0x116aec,null))[_0xe9f0('0x2a')](function(_0x13ad0d){var _0x1b4977=_[_0xe9f0('0x35')](_0x13ad0d,'id');var _0x34f99d=[];var _0x5ae9f1=[];var _0x1aacfa=squel['select']();_0x1aacfa['field'](_0xe9f0('0x8c'))[_0xe9f0('0x8d')](_0xe9f0('0x8e'),'tq')['join'](_0xe9f0('0x8f'),'ut',_0xe9f0('0x90'))['where'](_0xe9f0('0x91'),_0x448834[_0xe9f0('0x4e')]['id']);for(var _0x14e369=0x0;_0x14e369<_0x13ad0d[_0xe9f0('0x3f')];_0x14e369+=0x1){let _0x56e09f=_0x13ad0d[_0x14e369];for(var _0x25750e=0x0;_0x25750e<_0x56e09f['Agents'][_0xe9f0('0x3f')];_0x25750e+=0x1){let _0x56e47c=_0x56e09f['Agents'][_0x25750e];var _0x58d863=_0x1aacfa[_0xe9f0('0x92')]();_0x58d863[_0xe9f0('0x44')]('ut.UserId\x20=\x20?',_0x56e47c['id']);_0x5ae9f1[_0xe9f0('0x69')](db[_0xe9f0('0x73')][_0xe9f0('0x3b')](_0x58d863[_0xe9f0('0x93')](),{'type':db[_0xe9f0('0x73')][_0xe9f0('0x94')][_0xe9f0('0x95')]})['then'](function(_0x5b10a5){if(_0x5b10a5[_0xe9f0('0x3f')]===0x1){return _0x56e47c['id'];}else{var _0x32eb6c=_['every'](_[_0xe9f0('0x35')](_0x5b10a5,_0xe9f0('0x96')),function(_0x96e959){return _['includes'](_0x1b4977,_0x96e959);});if(_0x32eb6c){return _0x56e47c['id'];}}}));}}return BPromise[_0xe9f0('0x97')](_0x5ae9f1)[_0xe9f0('0x2a')](function(_0x59fbca){_0x34f99d=_(_0x34f99d)[_0xe9f0('0x98')](_0x59fbca)['compact']()[_0xe9f0('0x99')]();return db[_0xe9f0('0x36')][_0xe9f0('0x51')]({'where':{'id':_0x448834[_0xe9f0('0x4e')]['id']}})[_0xe9f0('0x2a')](function(_0x305d2f){return db['sequelize'][_0xe9f0('0x54')](function(_0x17f9bd){return _0x305d2f[_0xe9f0('0x9a')](_0x448834[_0xe9f0('0x3b')][_0xe9f0('0x76')],{'transaction':_0x17f9bd})[_0xe9f0('0x2a')](function(){if(!_[_0xe9f0('0x9b')](_0x34f99d)){return _0x305d2f['removeAgents'](_0x34f99d,{'transaction':_0x17f9bd});}})['then'](function(){_0x34f99d[_0xe9f0('0x8b')](function(_0x3e8745){socket['emit'](_0xe9f0('0x7d'),{'UserId':_0x3e8745,'VoicePrefixId':_0x305d2f['id']});});});});});});})['then'](respondWithStatusCode(_0x116aec,null))[_0xe9f0('0x4c')](handleError(_0x116aec,null));}; \ No newline at end of file +var _0xbaf0=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','length','find','catch','describe','create','sequelize','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','VoiceExtension','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','body','prefix','system-','ids','omit','spread','userVoicePrefix:save','params','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','User','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','transaction','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','TeamId','includes','compact','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x48b3ef,_0x1fcdbf){var _0x53b4d1=function(_0x34346a){while(--_0x34346a){_0x48b3ef['push'](_0x48b3ef['shift']());}};_0x53b4d1(++_0x1fcdbf);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0baf('0x0'));var zipdir=require(_0x0baf('0x1'));var jsonpatch=require(_0x0baf('0x2'));var rp=require(_0x0baf('0x3'));var moment=require(_0x0baf('0x4'));var BPromise=require(_0x0baf('0x5'));var Mustache=require('mustache');var util=require(_0x0baf('0x6'));var path=require(_0x0baf('0x7'));var sox=require(_0x0baf('0x8'));var csv=require(_0x0baf('0x9'));var ejs=require(_0x0baf('0xa'));var fs=require('fs');var fs_extra=require(_0x0baf('0xb'));var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0baf('0x1b')]=_[_0x0baf('0x1c')](config[_0x0baf('0x1b')],{'host':_0x0baf('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0baf('0x1b')]));require('./voicePrefix.socket')[_0x0baf('0x1e')](socket);function respondWithStatusCode(_0x1f50c3,_0x7fbf67){_0x7fbf67=_0x7fbf67||0xcc;return function(_0x2bc381){if(_0x2bc381){return _0x1f50c3[_0x0baf('0x1f')](_0x7fbf67);}return _0x1f50c3[_0x0baf('0x20')](_0x7fbf67)['end']();};}function respondWithResult(_0x4cd79d,_0x2312c7){_0x2312c7=_0x2312c7||0xc8;return function(_0x38395b){if(_0x38395b){return _0x4cd79d[_0x0baf('0x20')](_0x2312c7)[_0x0baf('0x21')](_0x38395b);}};}function respondWithFilteredResult(_0x2cf7da,_0x288a98){return function(_0x53c338){if(_0x53c338){var _0x63c820=typeof _0x288a98[_0x0baf('0x22')]===_0x0baf('0x23')&&typeof _0x288a98[_0x0baf('0x24')]===_0x0baf('0x23');var _0x42b7f2=_0x53c338['count'];var _0x5cff5d=_0x63c820?0x0:_0x288a98[_0x0baf('0x22')];var _0x154f48=_0x63c820?_0x53c338[_0x0baf('0x25')]:_0x288a98[_0x0baf('0x22')]+_0x288a98[_0x0baf('0x24')];var _0x3e3e20;if(_0x154f48>=_0x42b7f2){_0x154f48=_0x42b7f2;_0x3e3e20=0xc8;}else{_0x3e3e20=0xce;}_0x2cf7da[_0x0baf('0x20')](_0x3e3e20);return _0x2cf7da[_0x0baf('0x26')](_0x0baf('0x27'),_0x5cff5d+'-'+_0x154f48+'/'+_0x42b7f2)[_0x0baf('0x21')](_0x53c338);}return null;};}function patchUpdates(_0x54f2fa){return function(_0x334bd6){try{jsonpatch['apply'](_0x334bd6,_0x54f2fa,!![]);}catch(_0xf6c158){return BPromise['reject'](_0xf6c158);}return _0x334bd6['save']();};}function saveUpdates(_0x2ef0aa,_0x48a0e9){return function(_0x4be1b9){if(_0x4be1b9){return _0x4be1b9[_0x0baf('0x28')](_0x2ef0aa)[_0x0baf('0x29')](function(_0x34e264){return _0x34e264;});}return null;};}function removeEntity(_0x19d9fd,_0x3a1ba1){return function(_0x56b299){if(_0x56b299){return _0x56b299[_0x0baf('0x2a')]()[_0x0baf('0x29')](function(){var _0x1ca35a=_0x56b299[_0x0baf('0x2b')]({'plain':!![]});var _0x3843b8=_0x0baf('0x2c');return db[_0x0baf('0x2d')]['destroy']({'where':{'type':_0x3843b8,'resourceId':_0x1ca35a['id']}})[_0x0baf('0x29')](function(){return _0x56b299;});})[_0x0baf('0x29')](function(){_0x19d9fd[_0x0baf('0x20')](0xcc)[_0x0baf('0x2e')]();});}};}function handleEntityNotFound(_0x55c715,_0x29dbdf){return function(_0x34a58a){if(!_0x34a58a){_0x55c715['sendStatus'](0x194);}return _0x34a58a;};}function handleError(_0x44ec31,_0x32e4fb){_0x32e4fb=_0x32e4fb||0x1f4;return function(_0x478ce8){logger[_0x0baf('0x2f')](_0x478ce8[_0x0baf('0x30')]);if(_0x478ce8[_0x0baf('0x31')]){delete _0x478ce8[_0x0baf('0x31')];}_0x44ec31['status'](_0x32e4fb)[_0x0baf('0x32')](_0x478ce8);};}exports[_0x0baf('0x33')]=function(_0x37be4e,_0x3ed995){var _0x24ecee={},_0x275ea1={},_0x2fc983={'count':0x0,'rows':[]};var _0x2f0a45=_[_0x0baf('0x34')](db[_0x0baf('0x35')][_0x0baf('0x36')],function(_0x165d14){return{'name':_0x165d14[_0x0baf('0x37')],'type':_0x165d14[_0x0baf('0x38')]['key']};});_0x275ea1[_0x0baf('0x39')]=_['map'](_0x2f0a45,_0x0baf('0x31'));_0x275ea1[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x37be4e[_0x0baf('0x3a')]);_0x275ea1['filters']=_[_0x0baf('0x3c')](_0x275ea1[_0x0baf('0x39')],_0x275ea1['query']);_0x24ecee[_0x0baf('0x3d')]=_[_0x0baf('0x3c')](_0x275ea1[_0x0baf('0x39')],qs[_0x0baf('0x3e')](_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x24ecee[_0x0baf('0x3d')]=_0x24ecee[_0x0baf('0x3d')]['length']?_0x24ecee[_0x0baf('0x3d')]:_0x275ea1[_0x0baf('0x39')];if(!_0x37be4e['query'][_0x0baf('0x3f')]('nolimit')){_0x24ecee['limit']=qs[_0x0baf('0x24')](_0x37be4e[_0x0baf('0x3a')]['limit']);_0x24ecee['offset']=qs[_0x0baf('0x22')](_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x22')]);}_0x24ecee[_0x0baf('0x40')]=qs[_0x0baf('0x41')](_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x41')]);_0x24ecee[_0x0baf('0x42')]=qs[_0x0baf('0x43')](_[_0x0baf('0x44')](_0x37be4e[_0x0baf('0x3a')],_0x275ea1[_0x0baf('0x43')]),_0x2f0a45);if(_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x45')]){_0x24ecee['where']=_[_0x0baf('0x46')](_0x24ecee[_0x0baf('0x42')],{'$or':_['map'](_0x2f0a45,function(_0x38006a){if(_0x38006a[_0x0baf('0x38')]!==_0x0baf('0x47')){var _0x299f93={};_0x299f93[_0x38006a[_0x0baf('0x31')]]={'$like':'%'+_0x37be4e[_0x0baf('0x3a')]['filter']+'%'};return _0x299f93;}})});}_0x24ecee=_[_0x0baf('0x46')]({},_0x24ecee,_0x37be4e[_0x0baf('0x48')]);var _0x540c41={'where':_0x24ecee[_0x0baf('0x42')]};return db[_0x0baf('0x35')][_0x0baf('0x25')](_0x540c41)[_0x0baf('0x29')](function(_0x504031){_0x2fc983[_0x0baf('0x25')]=_0x504031;if(_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x49')]){_0x24ecee[_0x0baf('0x4a')]=[{'all':!![]}];}return db[_0x0baf('0x35')][_0x0baf('0x4b')](_0x24ecee);})[_0x0baf('0x29')](function(_0x1fa237){_0x2fc983[_0x0baf('0x4c')]=_0x1fa237;return _0x2fc983;})[_0x0baf('0x29')](respondWithFilteredResult(_0x3ed995,_0x24ecee))['catch'](handleError(_0x3ed995,null));};exports[_0x0baf('0x4d')]=function(_0x2bc755,_0x1daf1d){var _0x339aff={'raw':![],'where':{'id':_0x2bc755['params']['id']}},_0x22207a={};_0x22207a[_0x0baf('0x39')]=_[_0x0baf('0x3b')](db[_0x0baf('0x35')][_0x0baf('0x36')]);_0x22207a[_0x0baf('0x3a')]=_['keys'](_0x2bc755[_0x0baf('0x3a')]);_0x22207a[_0x0baf('0x43')]=_[_0x0baf('0x3c')](_0x22207a[_0x0baf('0x39')],_0x22207a[_0x0baf('0x3a')]);_0x339aff[_0x0baf('0x3d')]=_[_0x0baf('0x3c')](_0x22207a['model'],qs[_0x0baf('0x3e')](_0x2bc755[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x339aff['attributes']=_0x339aff[_0x0baf('0x3d')][_0x0baf('0x4e')]?_0x339aff[_0x0baf('0x3d')]:_0x22207a[_0x0baf('0x39')];if(_0x2bc755[_0x0baf('0x3a')][_0x0baf('0x49')]){_0x339aff[_0x0baf('0x4a')]=[{'all':!![]}];}_0x339aff=_['merge']({},_0x339aff,_0x2bc755[_0x0baf('0x48')]);return db[_0x0baf('0x35')][_0x0baf('0x4f')](_0x339aff)[_0x0baf('0x29')](handleEntityNotFound(_0x1daf1d,null))[_0x0baf('0x29')](respondWithResult(_0x1daf1d,null))[_0x0baf('0x50')](handleError(_0x1daf1d,null));};exports[_0x0baf('0x2a')]=function(_0x1af4aa,_0x2be7fe){return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x1af4aa['params']['id']}})['then'](handleEntityNotFound(_0x2be7fe,null))[_0x0baf('0x29')](removeEntity(_0x2be7fe,null))[_0x0baf('0x50')](handleError(_0x2be7fe,null));};exports[_0x0baf('0x51')]=function(_0xb8fa28,_0x21b108){return db[_0x0baf('0x35')][_0x0baf('0x51')]()['then'](respondWithResult(_0x21b108,null))[_0x0baf('0x50')](handleError(_0x21b108,null));};exports[_0x0baf('0x52')]=function(_0xf2424,_0x16d9fb){var _0x3fdb41;return db[_0x0baf('0x53')]['transaction'](function(_0x3eebe5){return db['VoicePrefix'][_0x0baf('0x52')](_0xf2424['body'],{'transaction':_0x3eebe5})[_0x0baf('0x29')](function(_0x5eaeb2){_0x3fdb41=_0x5eaeb2[_0x0baf('0x2b')]({'plain':!![]});return db['VoiceExtension'][_0x0baf('0x4f')]({'where':{'id':_0x3fdb41[_0x0baf('0x54')]},'raw':!![]})[_0x0baf('0x29')](function(_0x4520d1){return createVoicePrefixExtensions(_0x3fdb41,_0x4520d1,_0x3eebe5);});});})[_0x0baf('0x29')](function(){var _0x576475=_0xf2424[_0x0baf('0x55')][_0x0baf('0x2b')]({'plain':!![]});if(!_0x576475)throw new Error(_0x0baf('0x56'));if(_0x576475[_0x0baf('0x57')]===_0x0baf('0x55')){var _0xa19b21=_0x3fdb41;return db['UserProfileSection'][_0x0baf('0x4f')]({'where':{'name':_0x0baf('0x2c'),'userProfileId':_0x576475[_0x0baf('0x58')]},'raw':!![]})[_0x0baf('0x29')](function(_0xbc7cc2){if(_0xbc7cc2&&_0xbc7cc2[_0x0baf('0x59')]===0x0){return db[_0x0baf('0x2d')]['create']({'name':_0xa19b21['name'],'resourceId':_0xa19b21['id'],'type':_0xbc7cc2[_0x0baf('0x31')],'sectionId':_0xbc7cc2['id']},{})[_0x0baf('0x29')](function(){return _0x3fdb41;});}else{return _0x3fdb41;}})[_0x0baf('0x50')](function(_0x337d94){logger[_0x0baf('0x2f')](_0x0baf('0x5a'),_0x337d94);throw _0x337d94;});}return _0x3fdb41;})[_0x0baf('0x29')](respondWithResult(_0x16d9fb,null))[_0x0baf('0x50')](handleError(_0x16d9fb,null));};function Extension(_0x3d9a32,_0x585969,_0x3238f9,_0x268be8){this[_0x0baf('0x5b')]=_0x0baf('0x5c');this[_0x0baf('0x5d')]=_0x3d9a32;this[_0x0baf('0x5e')]=_0x3238f9;this[_0x0baf('0x38')]='system';this[_0x0baf('0x5f')]=_0x0baf('0x60');this[_0x0baf('0x61')]=_0x585969;this[_0x0baf('0x62')]=_0x268be8;}function createVoicePrefixExtensions(_0x1c7d88,_0x1a6d22,_0x14e6d0){return new BPromise(function(_0x12543e,_0x498405){var _0x178495=new Extension(formatPrefixName(_0x1c7d88['prefix']),0x1,_0x0baf('0x63'),'Voice\x20Prefix');_0x178495['VoicePrefixId']=_0x1c7d88['id'];return db[_0x0baf('0x64')]['create'](_0x178495,{'transaction':_0x14e6d0})[_0x0baf('0x29')](function(_0x2b17f8){var _0x49d713=_0x2b17f8[_0x0baf('0x2b')]({'plain':!![]});var _0xfb6708=_[_0x0baf('0x34')](addVoicePrefixExtensions(_0x1c7d88,_0x1a6d22),function(_0x5b3c1d){_0x5b3c1d['VoiceExtensionId']=_0x49d713['id'];_0x5b3c1d[_0x0baf('0x65')]=_0x1c7d88['id'];return _0x5b3c1d;});return db[_0x0baf('0x64')][_0x0baf('0x66')](_0xfb6708,{'transaction':_0x14e6d0})[_0x0baf('0x29')](function(_0x784e1a){if(!_0x784e1a){return _0x498405('Extensions\x20creation\x20failed');}else{return _0x12543e(_0x784e1a);}})[_0x0baf('0x50')](function(_0x4c02ca){return _0x498405(_0x4c02ca);});});;});};function addVoicePrefixExtensions(_0x5d5751,_0x59a0b2){var _0x427ed1=[];var _0x58a366=formatPrefixName(_0x5d5751['prefix']);_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x2,_0x0baf('0x68'),_0x0baf('0x69')+_0x5d5751[_0x0baf('0x31')]));if(_0x5d5751[_0x0baf('0x6a')]){_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x3,'Set',_0x0baf('0x6b')+_0x5d5751[_0x0baf('0x6a')]));}else{_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x3,_0x0baf('0x63'),_0x0baf('0x6c')));}_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x4,'goto',_0x59a0b2[_0x0baf('0x5b')]+','+_0x0baf('0x6d')+(0x8+_0x5d5751[_0x0baf('0x31')]['length'])+'}'+','+0x1));return _0x427ed1;}function formatPrefixName(_0x89484d){var _0x1e474f='_';for(var _0x3d333d=0x0;_0x3d333d<_0x89484d[_0x0baf('0x4e')];_0x3d333d++){if(_0x89484d[_0x0baf('0x6e')](_0x3d333d)=='-'){_0x1e474f+=_0x89484d[_0x0baf('0x6e')](_0x3d333d);}else{_0x1e474f+='['+_0x89484d[_0x0baf('0x6e')](_0x3d333d)+']';}}_0x1e474f+='.';return _0x1e474f;}exports['update']=function(_0x54353a,_0x4b7caa,_0x6ce83c){var _0x89bec7=_0x54353a[_0x0baf('0x6f')];_0x89bec7[_0x0baf('0x70')]=_0x0baf('0x71')+_0x89bec7[_0x0baf('0x31')]+'-';return db['sequelize']['transaction'](function(_0x34c1f4){return db['VoicePrefix'][_0x0baf('0x28')](_0x89bec7,{'where':{'id':_0x89bec7['id']},'transaction':_0x34c1f4})[_0x0baf('0x29')](function(){return db['VoiceExtension'][_0x0baf('0x2a')]({'where':{'VoicePrefixId':_0x89bec7['id']},'transaction':_0x34c1f4})[_0x0baf('0x29')](function(){return db[_0x0baf('0x64')][_0x0baf('0x4f')]({'where':{'id':_0x89bec7[_0x0baf('0x54')]},'raw':!![]})[_0x0baf('0x29')](function(_0x1b6b73){return createVoicePrefixExtensions(_0x89bec7,_0x1b6b73,_0x34c1f4);});});});})[_0x0baf('0x29')](function(){return db[_0x0baf('0x35')]['findById'](_0x89bec7['id']);})['then'](respondWithResult(_0x4b7caa,null))['catch'](handleError(_0x4b7caa,null));};exports['addAgents']=function(_0x5361a5,_0x418c45,_0x18963f){return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x5361a5['params']['id']}})[_0x0baf('0x29')](handleEntityNotFound(_0x418c45,null))[_0x0baf('0x29')](function(_0x58caee){if(_0x58caee){return _0x58caee['addAgents'](_0x5361a5[_0x0baf('0x6f')][_0x0baf('0x72')],_[_0x0baf('0x73')](_0x5361a5[_0x0baf('0x6f')],[_0x0baf('0x72'),'id'])||{})[_0x0baf('0x74')](function(_0x3ce111){for(var _0x399f40=0x0;_0x399f40<_0x5361a5['body'][_0x0baf('0x72')][_0x0baf('0x4e')];_0x399f40+=0x1){socket['emit'](_0x0baf('0x75'),{'UserId':Number(_0x5361a5[_0x0baf('0x6f')]['ids'][_0x399f40]),'VoicePrefixId':Number(_0x5361a5[_0x0baf('0x76')]['id'])});}return _0x3ce111;});}})[_0x0baf('0x29')](respondWithResult(_0x418c45,null))[_0x0baf('0x50')](handleError(_0x418c45,null));};exports[_0x0baf('0x77')]=function(_0x167977,_0x4fc5af,_0x4807fc){return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x167977['params']['id']}})[_0x0baf('0x29')](handleEntityNotFound(_0x4fc5af,null))[_0x0baf('0x29')](function(_0x21ad25){if(_0x21ad25){return _0x21ad25['removeAgents'](_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')])[_0x0baf('0x29')](function(){if(_['isArray'](_0x167977[_0x0baf('0x3a')]['ids'])){for(var _0x316397=0x0;_0x316397<_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')][_0x0baf('0x4e')];_0x316397+=0x1){socket[_0x0baf('0x78')]('userVoicePrefix:remove',{'UserId':Number(_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')][_0x316397]),'VoicePrefixId':Number(_0x167977['params']['id'])});}}else{socket[_0x0baf('0x78')](_0x0baf('0x79'),{'UserId':Number(_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')]),'VoicePrefixId':Number(_0x167977[_0x0baf('0x76')]['id'])});}});}})[_0x0baf('0x29')](respondWithStatusCode(_0x4fc5af,null))[_0x0baf('0x50')](handleError(_0x4fc5af,null));};exports[_0x0baf('0x7a')]=function(_0x44ef57,_0x1ca3a6,_0x3b7abf){var _0x2c2f09={};var _0x5985f9={};var _0x599ac0;var _0x29a036;return db[_0x0baf('0x35')][_0x0baf('0x7b')]({'where':{'id':_0x44ef57['params']['id']}})['then'](handleEntityNotFound(_0x1ca3a6,null))[_0x0baf('0x29')](function(_0x368e23){if(_0x368e23){_0x599ac0=_0x368e23;_0x5985f9[_0x0baf('0x39')]=_[_0x0baf('0x3b')](db[_0x0baf('0x7c')][_0x0baf('0x36')]);_0x5985f9[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x44ef57[_0x0baf('0x3a')]);_0x5985f9['filters']=_[_0x0baf('0x3c')](_0x5985f9[_0x0baf('0x39')],_0x5985f9[_0x0baf('0x3a')]);_0x2c2f09[_0x0baf('0x3d')]=_['intersection'](_0x5985f9['model'],qs['fields'](_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x2c2f09['attributes']=_0x2c2f09['attributes'][_0x0baf('0x4e')]?_0x2c2f09[_0x0baf('0x3d')]:_0x5985f9['model'];_0x2c2f09[_0x0baf('0x40')]=qs[_0x0baf('0x41')](_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x41')]);_0x2c2f09[_0x0baf('0x42')]=qs[_0x0baf('0x43')](_[_0x0baf('0x44')](_0x44ef57[_0x0baf('0x3a')],_0x5985f9[_0x0baf('0x43')]));if(_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x45')]){_0x2c2f09[_0x0baf('0x42')]=_['merge'](_0x2c2f09[_0x0baf('0x42')],{'$or':_[_0x0baf('0x34')](_0x2c2f09[_0x0baf('0x3d')],function(_0x3bd15b){var _0x3c37b4={};_0x3c37b4[_0x3bd15b]={'$like':'%'+_0x44ef57[_0x0baf('0x3a')]['filter']+'%'};return _0x3c37b4;})});}_0x2c2f09=_[_0x0baf('0x46')]({},_0x2c2f09,_0x44ef57[_0x0baf('0x48')]);return _0x599ac0[_0x0baf('0x7a')](_0x2c2f09);}})[_0x0baf('0x29')](function(_0x4376a1){if(_0x4376a1){_0x29a036=_0x4376a1['length'];if(!_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x3f')](_0x0baf('0x7d'))){_0x2c2f09[_0x0baf('0x24')]=qs[_0x0baf('0x24')](_0x44ef57['query']['limit']);_0x2c2f09[_0x0baf('0x22')]=qs['offset'](_0x44ef57[_0x0baf('0x3a')]['offset']);}return _0x599ac0[_0x0baf('0x7a')](_0x2c2f09);}})[_0x0baf('0x29')](function(_0x1ce7bb){if(_0x1ce7bb){return _0x1ce7bb?{'count':_0x29a036,'rows':_0x1ce7bb}:null;}})[_0x0baf('0x29')](respondWithResult(_0x1ca3a6,null))['catch'](handleError(_0x1ca3a6,null));};exports[_0x0baf('0x7e')]=function(_0x106ffa,_0xf7a9d0,_0x551df3){var _0x487aec={};var _0x591cc2={};var _0x4d4884;var _0x427638;return db[_0x0baf('0x35')][_0x0baf('0x7b')]({'where':{'id':_0x106ffa[_0x0baf('0x76')]['id']}})['then'](handleEntityNotFound(_0xf7a9d0,null))[_0x0baf('0x29')](function(_0x37594e){if(_0x37594e){_0x4d4884=_0x37594e;_0x591cc2[_0x0baf('0x39')]=_['keys'](db[_0x0baf('0x7f')][_0x0baf('0x36')]);_0x591cc2['query']=_[_0x0baf('0x3b')](_0x106ffa['query']);_0x591cc2[_0x0baf('0x43')]=_[_0x0baf('0x3c')](_0x591cc2[_0x0baf('0x39')],_0x591cc2[_0x0baf('0x3a')]);_0x487aec['attributes']=_['intersection'](_0x591cc2[_0x0baf('0x39')],qs['fields'](_0x106ffa[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x487aec[_0x0baf('0x3d')]=_0x487aec[_0x0baf('0x3d')][_0x0baf('0x4e')]?_0x487aec['attributes']:_0x591cc2[_0x0baf('0x39')];_0x487aec['order']=qs[_0x0baf('0x41')](_0x106ffa['query'][_0x0baf('0x41')]);_0x487aec['where']=qs[_0x0baf('0x43')](_[_0x0baf('0x44')](_0x106ffa[_0x0baf('0x3a')],_0x591cc2['filters']));if(_0x106ffa['query'][_0x0baf('0x45')]){_0x487aec[_0x0baf('0x42')]=_[_0x0baf('0x46')](_0x487aec[_0x0baf('0x42')],{'$or':_[_0x0baf('0x34')](_0x487aec[_0x0baf('0x3d')],function(_0x4e6059){var _0xd4170d={};_0xd4170d[_0x4e6059]={'$like':'%'+_0x106ffa['query'][_0x0baf('0x45')]+'%'};return _0xd4170d;})});}_0x487aec=_['merge']({},_0x487aec,_0x106ffa[_0x0baf('0x48')]);return _0x4d4884[_0x0baf('0x7e')](_0x487aec);}})[_0x0baf('0x29')](function(_0x557a38){if(_0x557a38){_0x427638=_0x557a38[_0x0baf('0x4e')];if(!_0x106ffa[_0x0baf('0x3a')]['hasOwnProperty']('nolimit')){_0x487aec[_0x0baf('0x24')]=qs[_0x0baf('0x24')](_0x106ffa[_0x0baf('0x3a')][_0x0baf('0x24')]);_0x487aec['offset']=qs['offset'](_0x106ffa[_0x0baf('0x3a')][_0x0baf('0x22')]);}return _0x4d4884[_0x0baf('0x7e')](_0x487aec);}})[_0x0baf('0x29')](function(_0xfc91ce){if(_0xfc91ce){return _0xfc91ce?{'count':_0x427638,'rows':_0xfc91ce}:null;}})[_0x0baf('0x29')](respondWithResult(_0xf7a9d0,null))[_0x0baf('0x50')](handleError(_0xf7a9d0,null));};exports[_0x0baf('0x80')]=function(_0x205de6,_0x2369f0,_0x58f95c){var _0xdb96c0=_0x205de6['body'][_0x0baf('0x72')];var _0x42abcf;return db[_0x0baf('0x7f')][_0x0baf('0x4b')]({'where':{'id':_0xdb96c0},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0baf('0x81'),'attributes':['id',_0x0baf('0x31'),_0x0baf('0x82'),_0x0baf('0x83'),_0x0baf('0x84')],'raw':!![]}]})[_0x0baf('0x29')](function(_0x3b9101){if(_0x3b9101){_0x42abcf=_0x3b9101;var _0x205075=_[_0x0baf('0x85')](_0x3b9101,function(_0x4b6cd5){var _0x8d1bae=_0x4b6cd5[_0x0baf('0x2b')]({'plain':!![]});return _0x8d1bae['Agents'];});return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x205de6[_0x0baf('0x76')]['id']}})[_0x0baf('0x29')](function(_0x97f5d6){return db[_0x0baf('0x53')][_0x0baf('0x86')](function(_0x8c1dc2){return _0x97f5d6[_0x0baf('0x80')](_0xdb96c0,{'transaction':_0x8c1dc2})['then'](function(){return BPromise[_0x0baf('0x87')](_0x42abcf,function(_0x218fc5){return db[_0x0baf('0x88')][_0x0baf('0x89')]({'TeamId':_0x218fc5['id'],'VoicePrefixId':_0x205de6[_0x0baf('0x76')]['id']},{'transaction':_0x8c1dc2});});})[_0x0baf('0x29')](function(){return BPromise['each'](_0x205075,function(_0x121718){return db[_0x0baf('0x8a')][_0x0baf('0x8b')]({'where':{'UserId':_0x121718['id'],'VoicePrefixId':_0x205de6['params']['id']},'transaction':_0x8c1dc2});});})['then'](function(){_0x205075[_0x0baf('0x8c')](function(_0x1adb84){socket[_0x0baf('0x78')]('userVoicePrefix:save',{'UserId':_0x1adb84['id'],'VoicePrefixId':_0x97f5d6['id']});});});});});}})[_0x0baf('0x29')](respondWithStatusCode(_0x2369f0,null))['catch'](handleError(_0x2369f0,null));};exports[_0x0baf('0x8d')]=function(_0x5f09be,_0x41b216,_0x3f2838){return db['Team'][_0x0baf('0x4b')]({'where':{'id':_0x5f09be[_0x0baf('0x3a')][_0x0baf('0x72')]},'attributes':['id'],'include':[{'model':db[_0x0baf('0x7c')],'as':_0x0baf('0x81'),'attributes':['id'],'raw':!![]}]})[_0x0baf('0x29')](handleEntityNotFound(_0x41b216,null))[_0x0baf('0x29')](function(_0x5508db){var _0x727cad=_[_0x0baf('0x34')](_0x5508db,'id');var _0x2766fb=[];var _0x2e1629=[];var _0x275cc4=squel[_0x0baf('0x8e')]();_0x275cc4[_0x0baf('0x8f')](_0x0baf('0x90'))[_0x0baf('0x91')](_0x0baf('0x92'),'tq')[_0x0baf('0x93')](_0x0baf('0x94'),'ut',_0x0baf('0x95'))[_0x0baf('0x42')]('VoicePrefixId\x20=\x20?',_0x5f09be['params']['id']);for(var _0x1cd215=0x0;_0x1cd215<_0x5508db[_0x0baf('0x4e')];_0x1cd215+=0x1){let _0x3b9429=_0x5508db[_0x1cd215];for(var _0x41d397=0x0;_0x41d397<_0x3b9429['Agents'][_0x0baf('0x4e')];_0x41d397+=0x1){let _0xc6c049=_0x3b9429[_0x0baf('0x81')][_0x41d397];var _0x2fb267=_0x275cc4[_0x0baf('0x96')]();_0x2fb267[_0x0baf('0x42')]('ut.UserId\x20=\x20?',_0xc6c049['id']);_0x2e1629[_0x0baf('0x67')](db[_0x0baf('0x53')][_0x0baf('0x3a')](_0x2fb267['toString'](),{'type':db[_0x0baf('0x53')][_0x0baf('0x97')][_0x0baf('0x98')]})['then'](function(_0x4f7145){if(_0x4f7145['length']===0x1){return _0xc6c049['id'];}else{var _0x11a85a=_['every'](_[_0x0baf('0x34')](_0x4f7145,_0x0baf('0x99')),function(_0x55124b){return _[_0x0baf('0x9a')](_0x727cad,_0x55124b);});if(_0x11a85a){return _0xc6c049['id'];}}}));}}return BPromise['all'](_0x2e1629)['then'](function(_0x21516f){_0x2766fb=_(_0x2766fb)['union'](_0x21516f)[_0x0baf('0x9b')]()['value']();return db['VoicePrefix']['find']({'where':{'id':_0x5f09be[_0x0baf('0x76')]['id']}})[_0x0baf('0x29')](function(_0x3d1f80){return db[_0x0baf('0x53')][_0x0baf('0x86')](function(_0x4f9904){return _0x3d1f80[_0x0baf('0x8d')](_0x5f09be['query'][_0x0baf('0x72')],{'transaction':_0x4f9904})[_0x0baf('0x29')](function(){if(!_[_0x0baf('0x9c')](_0x2766fb)){return _0x3d1f80['removeAgents'](_0x2766fb,{'transaction':_0x4f9904});}})[_0x0baf('0x29')](function(){_0x2766fb[_0x0baf('0x8c')](function(_0x12311d){socket['emit'](_0x0baf('0x79'),{'UserId':_0x12311d,'VoicePrefixId':_0x3d1f80['id']});});});});});});})['then'](respondWithStatusCode(_0x41b216,null))[_0x0baf('0x50')](handleError(_0x41b216,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 491fee4..123c403 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 _0xc416=['save','update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x35dadd,_0x3ed50f){var _0x2728ed=function(_0x80656f){while(--_0x80656f){_0x35dadd['push'](_0x35dadd['shift']());}};_0x2728ed(++_0x3ed50f);}(_0xc416,0xf1));var _0x6c41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc416[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x6c41('0x0'));var VoicePrefix=require('../../mysqldb')['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x6c41('0x1')](0x0);var events={'afterCreate':_0x6c41('0x2'),'afterUpdate':_0x6c41('0x3'),'afterDestroy':_0x6c41('0x4')};function emitEvent(_0x13a12b){return function(_0x5e1552,_0x3fc107,_0x5a0bc3){VoicePrefixEvents[_0x6c41('0x5')](_0x13a12b+':'+_0x5e1552['id'],_0x5e1552);VoicePrefixEvents['emit'](_0x13a12b,_0x5e1552);_0x5a0bc3(null);};}for(var e in events){if(events[_0x6c41('0x6')](e)){var event=events[e];VoicePrefix[_0x6c41('0x7')](e,emitEvent(event));}}module[_0x6c41('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xb186=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoicePrefix'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xb186,0x10c));var _0x6b18=function(_0x5581ba,_0x268887){_0x5581ba=_0x5581ba-0x0;var _0x1e927f=_0xb186[_0x5581ba];return _0x1e927f;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x6b18('0x0'))['db'][_0x6b18('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x6b18('0x2')](0x0);var events={'afterCreate':_0x6b18('0x3'),'afterUpdate':_0x6b18('0x4'),'afterDestroy':_0x6b18('0x5')};function emitEvent(_0x2da917){return function(_0x2bb73d,_0x1b229f,_0x34b605){VoicePrefixEvents['emit'](_0x2da917+':'+_0x2bb73d['id'],_0x2bb73d);VoicePrefixEvents[_0x6b18('0x6')](_0x2da917,_0x2bb73d);_0x34b605(null);};}for(var e in events){if(events[_0x6b18('0x7')](e)){var event=events[e];VoicePrefix[_0x6b18('0x8')](e,emitEvent(event));}}module[_0x6b18('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 3b1118f..d938d56 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 _0x1ae4=['exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x46bd15,_0x1b9208){var _0x5cd0ed=function(_0x278ef3){while(--_0x278ef3){_0x46bd15['push'](_0x46bd15['shift']());}};_0x5cd0ed(++_0x1b9208);}(_0x1ae4,0x162));var _0x41ae=function(_0x5d6b55,_0x35a3b9){_0x5d6b55=_0x5d6b55-0x0;var _0x431e17=_0x1ae4[_0x5d6b55];return _0x431e17;};'use strict';var _=require(_0x41ae('0x0'));var util=require(_0x41ae('0x1'));var logger=require(_0x41ae('0x2'))(_0x41ae('0x3'));var moment=require(_0x41ae('0x4'));var BPromise=require(_0x41ae('0x5'));var rp=require(_0x41ae('0x6'));var fs=require('fs');var path=require(_0x41ae('0x7'));var rimraf=require(_0x41ae('0x8'));var config=require(_0x41ae('0x9'));var attributes=require('./voicePrefix.attributes');module[_0x41ae('0xa')]=function(_0x2e2602,_0xa111f7){return _0x2e2602[_0x41ae('0xb')](_0x41ae('0xc'),attributes,{'tableName':_0x41ae('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43d8=['path','rimraf','./voicePrefix.attributes','define','voice_prefixes','lodash','util','../../config/logger','api','request-promise'];(function(_0x15603a,_0x3b2b12){var _0x4ba30b=function(_0x5989d6){while(--_0x5989d6){_0x15603a['push'](_0x15603a['shift']());}};_0x4ba30b(++_0x3b2b12);}(_0x43d8,0x109));var _0x843d=function(_0x3dfea6,_0x5cd685){_0x3dfea6=_0x3dfea6-0x0;var _0x567aca=_0x43d8[_0x3dfea6];return _0x567aca;};'use strict';var _=require(_0x843d('0x0'));var util=require(_0x843d('0x1'));var logger=require(_0x843d('0x2'))(_0x843d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x843d('0x4'));var fs=require('fs');var path=require(_0x843d('0x5'));var rimraf=require(_0x843d('0x6'));var config=require('../../config/environment');var attributes=require(_0x843d('0x7'));module['exports']=function(_0x11448d,_0x12b4e6){return _0x11448d[_0x843d('0x8')]('VoicePrefix',attributes,{'tableName':_0x843d('0x9'),'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 09d79ef..8663f60 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 _0x3ef7=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./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'];(function(_0x3f0cb4,_0x49ec71){var _0x5f33b0=function(_0x13b753){while(--_0x13b753){_0x3f0cb4['push'](_0x3f0cb4['shift']());}};_0x5f33b0(++_0x49ec71);}(_0x3ef7,0xa2));var _0x73ef=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3ef7[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x73ef('0x0'));var util=require('util');var moment=require(_0x73ef('0x1'));var BPromise=require(_0x73ef('0x2'));var rs=require(_0x73ef('0x3'));var fs=require('fs');var Redis=require(_0x73ef('0x4'));var db=require(_0x73ef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x73ef('0x6'))(_0x73ef('0x7'));var config=require(_0x73ef('0x8'));var jayson=require(_0x73ef('0x9'));var client=jayson['client'][_0x73ef('0xa')]({'port':0x232a});config[_0x73ef('0xb')]=_[_0x73ef('0xc')](config[_0x73ef('0xb')],{'host':_0x73ef('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x73ef('0xb')]));require(_0x73ef('0xe'))['register'](socket);function respondWithRpcPromise(_0x1055e1,_0x21bfed,_0x364470){return new BPromise(function(_0x3bd4c9,_0x33aa09){return client['request'](_0x1055e1,_0x364470)[_0x73ef('0xf')](function(_0x111ce3){logger[_0x73ef('0x10')](_0x73ef('0x11'),_0x21bfed,_0x73ef('0x12'));logger[_0x73ef('0x13')](_0x73ef('0x14'),_0x21bfed,_0x73ef('0x12'),JSON[_0x73ef('0x15')](_0x111ce3));if(_0x111ce3[_0x73ef('0x16')]){if(_0x111ce3[_0x73ef('0x16')][_0x73ef('0x17')]===0x1f4){logger[_0x73ef('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x21bfed,_0x111ce3[_0x73ef('0x16')]['message']);return _0x33aa09(_0x111ce3[_0x73ef('0x16')][_0x73ef('0x18')]);}logger[_0x73ef('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x21bfed,_0x111ce3[_0x73ef('0x16')][_0x73ef('0x18')]);return _0x3bd4c9(_0x111ce3['error'][_0x73ef('0x18')]);}else{logger[_0x73ef('0x10')](_0x73ef('0x11'),_0x21bfed,_0x73ef('0x12'));_0x3bd4c9(_0x111ce3[_0x73ef('0x19')]['message']);}})[_0x73ef('0x1a')](function(_0x4dc000){logger[_0x73ef('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x21bfed,_0x4dc000);_0x33aa09(_0x4dc000);});});} \ No newline at end of file +var _0x58e6=['request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s'];(function(_0x238d47,_0x992d8b){var _0x339f0c=function(_0x22b90a){while(--_0x22b90a){_0x238d47['push'](_0x238d47['shift']());}};_0x339f0c(++_0x992d8b);}(_0x58e6,0x1c2));var _0x658e=function(_0x469094,_0xf38d51){_0x469094=_0x469094-0x0;var _0x448a8a=_0x58e6[_0x469094];return _0x448a8a;};'use strict';var _=require(_0x658e('0x0'));var util=require(_0x658e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x658e('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x658e('0x3'));var logger=require(_0x658e('0x4'))(_0x658e('0x5'));var config=require(_0x658e('0x6'));var jayson=require(_0x658e('0x7'));var client=jayson[_0x658e('0x8')][_0x658e('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x658e('0xa')],{'host':_0x658e('0xb'),'port':0x18eb});var socket=require(_0x658e('0xc'))(new Redis(config['redis']));require(_0x658e('0xd'))[_0x658e('0xe')](socket);function respondWithRpcPromise(_0x13ab91,_0x322320,_0x2790eb){return new BPromise(function(_0x1edbb6,_0x54ae37){return client['request'](_0x13ab91,_0x2790eb)[_0x658e('0xf')](function(_0x1ea724){logger[_0x658e('0x10')](_0x658e('0x11'),_0x322320,_0x658e('0x12'));logger[_0x658e('0x13')](_0x658e('0x14'),_0x322320,'request\x20sent',JSON[_0x658e('0x15')](_0x1ea724));if(_0x1ea724[_0x658e('0x16')]){if(_0x1ea724[_0x658e('0x16')][_0x658e('0x17')]===0x1f4){logger['error'](_0x658e('0x11'),_0x322320,_0x1ea724[_0x658e('0x16')]['message']);return _0x54ae37(_0x1ea724['error'][_0x658e('0x18')]);}logger[_0x658e('0x16')](_0x658e('0x11'),_0x322320,_0x1ea724['error'][_0x658e('0x18')]);return _0x1edbb6(_0x1ea724['error'][_0x658e('0x18')]);}else{logger[_0x658e('0x10')](_0x658e('0x11'),_0x322320,_0x658e('0x12'));_0x1edbb6(_0x1ea724[_0x658e('0x19')][_0x658e('0x18')]);}})['catch'](function(_0x2e4ad2){logger[_0x658e('0x16')](_0x658e('0x11'),_0x322320,_0x2e4ad2);_0x54ae37(_0x2e4ad2);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index e5cf0ed..368832e 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 _0x3276=['update','emit','voicePrefix:','./voicePrefix.events'];(function(_0x457d57,_0x5f34fe){var _0x514c65=function(_0x3567d1){while(--_0x3567d1){_0x457d57['push'](_0x457d57['shift']());}};_0x514c65(++_0x5f34fe);}(_0x3276,0xc7));var _0x6327=function(_0x47e021,_0x2f1ee8){_0x47e021=_0x47e021-0x0;var _0x439dda=_0x3276[_0x47e021];return _0x439dda;};'use strict';var VoicePrefixEvents=require(_0x6327('0x0'));var events=['save','remove',_0x6327('0x1')];function createListener(_0x18ab44,_0x23e033){return function(_0x1ca8a6){_0x23e033[_0x6327('0x2')](_0x18ab44,_0x1ca8a6);};}function removeListener(_0x1486a6,_0x436055){return function(){VoicePrefixEvents['removeListener'](_0x1486a6,_0x436055);};}exports['register']=function(_0x10b982){for(var _0x37adde=0x0,_0x1e6278=events['length'];_0x37adde<_0x1e6278;_0x37adde++){var _0x29ba24=events[_0x37adde];var _0x3e9616=createListener(_0x6327('0x3')+_0x29ba24,_0x10b982);VoicePrefixEvents['on'](_0x29ba24,_0x3e9616);}}; \ No newline at end of file +var _0x1db3=['emit','removeListener','register','length','voicePrefix:','save','remove','update'];(function(_0x523b84,_0x2bf779){var _0x29b8e1=function(_0x1f2711){while(--_0x1f2711){_0x523b84['push'](_0x523b84['shift']());}};_0x29b8e1(++_0x2bf779);}(_0x1db3,0x1e5));var _0x31db=function(_0x567b30,_0x554392){_0x567b30=_0x567b30-0x0;var _0x20105c=_0x1db3[_0x567b30];return _0x20105c;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x31db('0x0'),_0x31db('0x1'),_0x31db('0x2')];function createListener(_0x31ccc6,_0x840c38){return function(_0x4537f0){_0x840c38[_0x31db('0x3')](_0x31ccc6,_0x4537f0);};}function removeListener(_0x7041d7,_0x291c40){return function(){VoicePrefixEvents[_0x31db('0x4')](_0x7041d7,_0x291c40);};}exports[_0x31db('0x5')]=function(_0x3f252a){for(var _0x2b4eb6=0x0,_0x156381=events[_0x31db('0x6')];_0x2b4eb6<_0x156381;_0x2b4eb6++){var _0x44e204=events[_0x2b4eb6];var _0x3a431e=createListener(_0x31db('0x7')+_0x44e204,_0x3f252a);VoicePrefixEvents['on'](_0x44e204,_0x3a431e);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 0e58192..2a7081e 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x1a131e,_0x522eae){var _0x408971=function(_0x4fdcad){while(--_0x4fdcad){_0x1a131e['push'](_0x1a131e['shift']());}};_0x408971(++_0x522eae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x3df517,_0x373364){var _0x25ddd5=function(_0xdd2381){while(--_0xdd2381){_0x3df517['push'](_0x3df517['shift']());}};_0x25ddd5(++_0x373364);}(_0xb10b,0x12a));var _0xbb10=function(_0x528511,_0x815fd3){_0x528511=_0x528511-0x0;var _0xd1b2b7=_0xb10b[_0x528511];return _0xd1b2b7;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 482503f..5b83a6a 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 _0x0a3b=['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)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','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','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','wrandom','setDataValue','type','getDataValue','dialMethod','booked','rrmemory','roundrobin','predictive','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','leavewhenempty','BOOLEAN','acw','wrapuptime','preview','progressive','power','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x0a3b,0x18b));var _0xb0a3=function(_0x590b61,_0x4c4335){_0x590b61=_0x590b61-0x0;var _0x1a14dc=_0x0a3b[_0x590b61];return _0x1a14dc;};'use strict';var Sequelize=require(_0xb0a3('0x0'));module[_0xb0a3('0x1')]={'name':{'type':Sequelize[_0xb0a3('0x2')],'allowNull':![],'unique':_0xb0a3('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xb0a3('0x4')](_0xb0a3('0x5'),_0xb0a3('0x6')),'allowNull':![],'defaultValue':_0xb0a3('0x5')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0xb0a3('0x7')},'announce':{'type':Sequelize[_0xb0a3('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xb0a3('0x4')]('rr',_0xb0a3('0x8'),_0xb0a3('0x9'),_0xb0a3('0xa'),_0xb0a3('0xb'),'rrmemory','linear',_0xb0a3('0xc'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x4007d8){this[_0xb0a3('0xd')]('strategy',_0x4007d8?_0x4007d8:'rrmemory');},'get':function(){var _0x4f3b36=this['getDataValue'](_0xb0a3('0xe'));var _0x2f1c83=this[_0xb0a3('0xf')](_0xb0a3('0x10'));var _0x565fe4=this[_0xb0a3('0xf')]('strategy');if(_0x4f3b36==='inbound'){return _0x565fe4;}if(_0x2f1c83===_0xb0a3('0x11')&&_0x565fe4===_0xb0a3('0x12')||_0x2f1c83===_0xb0a3('0x11')&&_0x565fe4===_0xb0a3('0x13')){return _0x565fe4;}if(_0x2f1c83==='progressive'||_0x2f1c83===_0xb0a3('0x14')||_0x2f1c83==='power'){return _0x565fe4;}return null;}},'servicelevel':{'type':Sequelize[_0xb0a3('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0xb0a3('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xb0a3('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xb0a3('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xb0a3('0x4')](_0xb0a3('0x16'),'no'),'defaultValue':_0xb0a3('0x16')},'autopause':{'type':Sequelize[_0xb0a3('0x4')]('yes','no',_0xb0a3('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xb0a3('0x15')](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xb0a3('0x4')](_0xb0a3('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xb0a3('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xb0a3('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xb0a3('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xb0a3('0x4')](_0xb0a3('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xb0a3('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xb0a3('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xb0a3('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xb0a3('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xb0a3('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xb0a3('0x4')](_0xb0a3('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xb0a3('0x4')](_0xb0a3('0x16'),'no'),'defaultValue':_0xb0a3('0x16')},'announce_holdtime':{'type':Sequelize[_0xb0a3('0x4')](_0xb0a3('0x16'),'no',_0xb0a3('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xb0a3('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xb0a3('0x4')](_0xb0a3('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0xb0a3('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xb0a3('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xb0a3('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xb0a3('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xb0a3('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xb0a3('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xb0a3('0x2')]},'queue_quantity1':{'type':Sequelize[_0xb0a3('0x2')]},'queue_quantity2':{'type':Sequelize[_0xb0a3('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xb0a3('0x19')],'set':function(_0x357581){this[_0xb0a3('0xd')](_0xb0a3('0x1a'),_0x357581?_0x357581[_0xb0a3('0x1b')](','):[]);},'get':function(){return this[_0xb0a3('0xf')](_0xb0a3('0x1a'))?this[_0xb0a3('0xf')](_0xb0a3('0x1a'))[_0xb0a3('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0xb0a3('0x2')],'defaultValue':_0xb0a3('0x16'),'set':function(_0x53c955){this[_0xb0a3('0xd')]('joinempty',_0x53c955?_0x53c955[_0xb0a3('0x1b')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this[_0xb0a3('0xf')]('joinempty')[_0xb0a3('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xb0a3('0x2')],'defaultValue':'no','set':function(_0x3bfc05){this[_0xb0a3('0xd')]('leavewhenempty',_0x3bfc05?_0x3bfc05[_0xb0a3('0x1b')](','):undefined);},'get':function(){return this[_0xb0a3('0xf')](_0xb0a3('0x1d'))?this['getDataValue'](_0xb0a3('0x1d'))[_0xb0a3('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xb0a3('0x4')](_0xb0a3('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xb0a3('0x4')](_0xb0a3('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xb0a3('0x4')](_0xb0a3('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xb0a3('0x2')]},'description':{'type':Sequelize[_0xb0a3('0x2')]},'acw':{'type':Sequelize[_0xb0a3('0x1e')],'defaultValue':0x0,'set':function(_0x34ad57){this['setDataValue'](_0xb0a3('0x1f'),_0x34ad57);if(_0x34ad57){if(this[_0xb0a3('0xf')](_0xb0a3('0x20'))<0x2){this['setDataValue'](_0xb0a3('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xb0a3('0x1e')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xb0a3('0x4')](_0xb0a3('0x21'),_0xb0a3('0x22'),_0xb0a3('0x23'),_0xb0a3('0x14'),_0xb0a3('0x11')),'defaultValue':_0xb0a3('0x22'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xb0a3('0x15')](0x4)[_0xb0a3('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xb0a3('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xb0a3('0x25')},'dialPowerLevel':{'type':Sequelize[_0xb0a3('0x26')](0x2)[_0xb0a3('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xb0a3('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0xb0a3('0x4')](_0xb0a3('0x28'),'dropRate'),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xb0a3('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xb0a3('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xb0a3('0x29')},'dialOriginateCallerIdName':{'type':Sequelize[_0xb0a3('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xb0a3('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xb0a3('0x15')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xb0a3('0x2')],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xb0a3('0x15')](0x3)[_0xb0a3('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0a3('0x2a')},'dialQueueProject':{'type':Sequelize[_0xb0a3('0x2')],'comment':_0xb0a3('0x2b')},'dialCongestionMaxRetry':{'type':Sequelize[_0xb0a3('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0a3('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0a3('0x2d')},'dialBusyMaxRetry':{'type':Sequelize[_0xb0a3('0x15')](0x3)[_0xb0a3('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xb0a3('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xb0a3('0x15')](0x3)[_0xb0a3('0x24')],'defaultValue':0x3,'comment':_0xb0a3('0x2e')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xb0a3('0x15')](0x3)[_0xb0a3('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xb0a3('0x2f')},'dialTimezone':{'type':Sequelize[_0xb0a3('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb0a3('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xb0a3('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xb0a3('0x4')](_0xb0a3('0x30'),'never','onlyIfOpen'),'defaultValue':_0xb0a3('0x30')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xb0a3('0x31')},'dialAMDInitialSilence':{'type':Sequelize[_0xb0a3('0x15')](0x9)[_0xb0a3('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xb0a3('0x32')},'dialAMDGreeting':{'type':Sequelize[_0xb0a3('0x15')](0x9)[_0xb0a3('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb0a3('0x33')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xb0a3('0x15')](0x9)[_0xb0a3('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xb0a3('0x34')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xb0a3('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb0a3('0x35')},'dialAMDMinWordLength':{'type':Sequelize[_0xb0a3('0x15')](0x9)[_0xb0a3('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb0a3('0x36')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xb0a3('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xb0a3('0x37')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb0a3('0x15')](0x9)[_0xb0a3('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xb0a3('0x38')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xb0a3('0x15')](0x5)[_0xb0a3('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xb0a3('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xb0a3('0x15')](0x5)[_0xb0a3('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xb0a3('0x39')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xb0a3('0x3a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xb0a3('0x4')](_0xb0a3('0x3b'),'ASC'),'defaultValue':_0xb0a3('0x3b')},'dialQueueProject2':{'type':Sequelize[_0xb0a3('0x2')],'comment':_0xb0a3('0x2b')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xb0a3('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb0a3('0x15')](0x3)[_0xb0a3('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb0a3('0x3c')},'dialCutDigit':{'type':Sequelize[_0xb0a3('0x15')](0x3)[_0xb0a3('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb0a3('0x3d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xb0a3('0x15')](0x3)[_0xb0a3('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0a3('0x3e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xb0a3('0x15')](0x5)[_0xb0a3('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0a3('0x3f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0a3('0x40')},'dialDropRetryFrequency':{'type':Sequelize[_0xb0a3('0x15')](0x5)[_0xb0a3('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0a3('0x41')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xb0a3('0x15')](0x3)[_0xb0a3('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0a3('0x42')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb0a3('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xb0a3('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0a3('0x43')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb0a3('0x44')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb0a3('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb0a3('0x45')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb0a3('0x15')](0x5)[_0xb0a3('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xb0a3('0x46')},'mandatoryDisposition':{'type':Sequelize[_0xb0a3('0x1e')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x30c865){if(!_0x30c865)this[_0xb0a3('0xd')](_0xb0a3('0x47'),null);this[_0xb0a3('0xd')](_0xb0a3('0x48'),_0x30c865);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xb0a3('0x15')](0x3)[_0xb0a3('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xb0a3('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xb0a3('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xb0a3('0x15')](0x3)[_0xb0a3('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xb0a3('0x1e')],'defaultValue':![]}}; \ No newline at end of file +var _0x824b=['dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','name','inbound','default','ringall','random','rrmemory','wrandom','rrordered','setDataValue','getDataValue','type','strategy','roundrobin','progressive','predictive','power','INTEGER','ENUM','yes','all','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'];(function(_0x46f9fc,_0x30b951){var _0x4eca28=function(_0x3d70e9){while(--_0x3d70e9){_0x46f9fc['push'](_0x46f9fc['shift']());}};_0x4eca28(++_0x30b951);}(_0x824b,0xf7));var _0xb824=function(_0xc2d83b,_0x3a157f){_0xc2d83b=_0xc2d83b-0x0;var _0x3ad130=_0x824b[_0xc2d83b];return _0x3ad130;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb824('0x0')],'allowNull':![],'unique':_0xb824('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xb824('0x2'),'outbound'),'allowNull':![],'defaultValue':_0xb824('0x2')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0xb824('0x3')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xb824('0x4'),'leastrecent','fewestcalls',_0xb824('0x5'),_0xb824('0x6'),'linear',_0xb824('0x7'),_0xb824('0x8')),'allowNull':![],'defaultValue':_0xb824('0x4'),'set':function(_0x10078c){this[_0xb824('0x9')]('strategy',_0x10078c?_0x10078c:'rrmemory');},'get':function(){var _0x508012=this[_0xb824('0xa')](_0xb824('0xb'));var _0x54936c=this[_0xb824('0xa')]('dialMethod');var _0x58aa42=this[_0xb824('0xa')](_0xb824('0xc'));if(_0x508012==='inbound'){return _0x58aa42;}if(_0x54936c==='booked'&&_0x58aa42===_0xb824('0x6')||_0x54936c==='booked'&&_0x58aa42===_0xb824('0xd')){return _0x58aa42;}if(_0x54936c===_0xb824('0xe')||_0x54936c===_0xb824('0xf')||_0x54936c===_0xb824('0x10')){return _0x58aa42;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xb824('0x0')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0xb824('0x11')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xb824('0x11')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xb824('0x0')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xb824('0x11')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xb824('0x12')]('yes','no'),'defaultValue':_0xb824('0x13')},'autopause':{'type':Sequelize[_0xb824('0x12')](_0xb824('0x13'),'no',_0xb824('0x14')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xb824('0x11')](0xb)},'autopausebusy':{'type':Sequelize[_0xb824('0x12')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xb824('0x12')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xb824('0x11')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xb824('0x12')](_0xb824('0x13'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xb824('0x12')](_0xb824('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0xb824('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xb824('0x12')](_0xb824('0x13'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xb824('0x0')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xb824('0x11')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xb824('0x11')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xb824('0x12')](_0xb824('0x13'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xb824('0x12')](_0xb824('0x13'),'no'),'defaultValue':_0xb824('0x13')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xb824('0x13'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xb824('0x0')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0xb824('0x13'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xb824('0x12')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xb824('0x0')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xb824('0x0')]},'queue_youarenext':{'type':Sequelize[_0xb824('0x0')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xb824('0x0')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xb824('0x0')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xb824('0x0')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xb824('0x0')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xb824('0x0')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xb824('0x0')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xb824('0x0')]},'queue_quantity1':{'type':Sequelize[_0xb824('0x0')]},'queue_quantity2':{'type':Sequelize[_0xb824('0x0')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xb824('0x0')]},'periodic_announce':{'type':Sequelize[_0xb824('0x15')],'set':function(_0x126be9){this[_0xb824('0x9')](_0xb824('0x16'),_0x126be9?_0x126be9[_0xb824('0x17')](','):[]);},'get':function(){return this[_0xb824('0xa')](_0xb824('0x16'))?this['getDataValue'](_0xb824('0x16'))[_0xb824('0x18')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x5cd9e1){this[_0xb824('0x9')](_0xb824('0x19'),_0x5cd9e1?_0x5cd9e1[_0xb824('0x17')](','):undefined);},'get':function(){return this[_0xb824('0xa')](_0xb824('0x19'))?this[_0xb824('0xa')](_0xb824('0x19'))[_0xb824('0x18')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xb824('0x0')],'defaultValue':'no','set':function(_0x1c3113){this[_0xb824('0x9')](_0xb824('0x1a'),_0x1c3113?_0x1c3113['join'](','):undefined);},'get':function(){return this[_0xb824('0xa')](_0xb824('0x1a'))?this[_0xb824('0xa')](_0xb824('0x1a'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xb824('0x12')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xb824('0x12')](_0xb824('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xb824('0x11')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xb824('0x12')](_0xb824('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0xb824('0x1b')],'defaultValue':0x0,'set':function(_0x233c96){this[_0xb824('0x9')](_0xb824('0x1c'),_0x233c96);if(_0x233c96){if(this[_0xb824('0xa')](_0xb824('0x1d'))<0x2){this[_0xb824('0x9')](_0xb824('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xb824('0x11')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xb824('0x1e')},'dialMethod':{'type':Sequelize[_0xb824('0x12')]('preview',_0xb824('0xe'),'power','predictive',_0xb824('0x1f')),'defaultValue':_0xb824('0xe'),'comment':_0xb824('0x20')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xb824('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xb824('0x22')},'dialLimitQueue':{'type':Sequelize[_0xb824('0x11')](0x4)[_0xb824('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xb824('0x23')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xb824('0x24')},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0xb824('0x25')),'defaultValue':_0xb824('0x25'),'comment':_0xb824('0x26')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xb824('0x23')](0x2)[_0xb824('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xb824('0x27')},'dialPredictiveInterval':{'type':Sequelize[_0xb824('0x11')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xb824('0x28')},'dialOriginateCallerIdName':{'type':Sequelize[_0xb824('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xb824('0x0')]},'dialOriginateTimeout':{'type':Sequelize[_0xb824('0x11')](0x3)[_0xb824('0x21')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb824('0x29')},'dialQueueOptions':{'type':Sequelize[_0xb824('0x0')],'defaultValue':_0xb824('0x2a'),'comment':_0xb824('0x2b')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xb824('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb824('0x2c')},'dialQueueProject':{'type':Sequelize[_0xb824('0x0')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xb824('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xb824('0x11')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb824('0x2d')},'dialBusyMaxRetry':{'type':Sequelize[_0xb824('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xb824('0x11')](0x5)[_0xb824('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb824('0x2e')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb824('0x21')],'defaultValue':0x3,'comment':_0xb824('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb824('0x11')](0x5)[_0xb824('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xb824('0x11')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xb824('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb824('0x0')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xb824('0x0')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xb824('0x12')](_0xb824('0x30'),_0xb824('0x31'),_0xb824('0x32')),'defaultValue':_0xb824('0x30')},'dialAMDActive':{'type':Sequelize[_0xb824('0x1b')],'defaultValue':0x0,'comment':_0xb824('0x33')},'dialAMDInitialSilence':{'type':Sequelize[_0xb824('0x11')](0x9)[_0xb824('0x21')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xb824('0x11')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb824('0x34')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xb824('0x21')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xb824('0x11')](0x9)[_0xb824('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xb824('0x11')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xb824('0x21')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xb824('0x35')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb824('0x11')](0x9)[_0xb824('0x21')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xb824('0x36')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xb824('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb824('0x37')},'dialRecallMeTimeout':{'type':Sequelize[_0xb824('0x11')](0x5)[_0xb824('0x21')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0xb824('0x1b')],'defaultValue':0x0,'comment':_0xb824('0x38')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC','ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0xb824('0x0')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xb824('0x1b')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xb824('0x1b')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb824('0x39')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb824('0x3a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xb824('0x11')](0x3)[_0xb824('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb824('0x3b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xb824('0x11')](0x5)[_0xb824('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb824('0x3c')},'dialDropMaxRetry':{'type':Sequelize[_0xb824('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb824('0x3d')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb824('0x3e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xb824('0x11')](0x3)[_0xb824('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb824('0x3f')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb824('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb824('0x40')},'dialMachineMaxRetry':{'type':Sequelize[_0xb824('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb824('0x41')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xb824('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb824('0x42')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb824('0x11')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb824('0x11')](0x5)[_0xb824('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb824('0x43')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xb824('0x1b')],'defaultValue':![],'comment':_0xb824('0x44'),'set':function(_0x26c73f){if(!_0x26c73f)this['setDataValue'](_0xb824('0x45'),null);this['setDataValue'](_0xb824('0x46'),_0x26c73f);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xb824('0x11')](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xb824('0x11')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xb824('0x11')](0x3)[_0xb824('0x21')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xb824('0x1b')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index f657abf..139227f 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 _0xd9c8=['sendStatus','end','status','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','inbound','QueueCampaigns','outbound','ignore','map','includes','find','value','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','body','user','role','get','UserProfileSection','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','autoAssociation','getHoppers','findOne','CmHopper','sort','VoiceQueueId','filter','findAll','CmHopperHistory','getHopperFinals','CmHopperFinal','pick','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','Agents','online','interface','flatMap','forEach','penalty','sequelize','transaction','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','each','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','select','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','all','compact','isEmpty','userVoiceQueue:remove','addAgents','spread','removeAgents','getAgents','getMembers','CmList','getLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','from','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_contacts','into','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','redis','localhost','socket.io-emitter','./voiceQueue.socket','register'];(function(_0x294c0b,_0x55ad66){var _0x27c83d=function(_0x4df144){while(--_0x4df144){_0x294c0b['push'](_0x294c0b['shift']());}};_0x27c83d(++_0x55ad66);}(_0xd9c8,0x15c));var _0x8d9c=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xd9c8[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require(_0x8d9c('0x0'));var rimraf=require(_0x8d9c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8d9c('0x2'));var rp=require(_0x8d9c('0x3'));var moment=require(_0x8d9c('0x4'));var BPromise=require(_0x8d9c('0x5'));var Mustache=require(_0x8d9c('0x6'));var util=require(_0x8d9c('0x7'));var path=require(_0x8d9c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8d9c('0x9'));var _=require(_0x8d9c('0xa'));var squel=require(_0x8d9c('0xb'));var crypto=require('crypto');var jsforce=require(_0x8d9c('0xc'));var deskjs=require(_0x8d9c('0xd'));var toCsv=require(_0x8d9c('0xe'));var querystring=require(_0x8d9c('0xf'));var Papa=require(_0x8d9c('0x10'));var Redis=require(_0x8d9c('0x11'));var authService=require(_0x8d9c('0x12'));var qs=require(_0x8d9c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8d9c('0x14'));var logger=require('../../config/logger')(_0x8d9c('0x15'));var utils=require('../../config/utils');var config=require(_0x8d9c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8d9c('0x17')]=_['defaults'](config[_0x8d9c('0x17')],{'host':_0x8d9c('0x18'),'port':0x18eb});var socket=require(_0x8d9c('0x19'))(new Redis(config[_0x8d9c('0x17')]));require(_0x8d9c('0x1a'))[_0x8d9c('0x1b')](socket);function respondWithStatusCode(_0x1110f9,_0x1c961c){_0x1c961c=_0x1c961c||0xcc;return function(_0x2b22b4){if(_0x2b22b4){return _0x1110f9[_0x8d9c('0x1c')](_0x1c961c);}return _0x1110f9['status'](_0x1c961c)[_0x8d9c('0x1d')]();};}function respondWithResult(_0x38ea38,_0x1dbc93){_0x1dbc93=_0x1dbc93||0xc8;return function(_0x24c036){if(_0x24c036){return _0x38ea38[_0x8d9c('0x1e')](_0x1dbc93)[_0x8d9c('0x1f')](_0x24c036);}};}function respondWithFilteredResult(_0x304de9,_0x1c8d6f){return function(_0x1ed27d){if(_0x1ed27d){var _0x44896d=typeof _0x1c8d6f['offset']===_0x8d9c('0x20')&&typeof _0x1c8d6f[_0x8d9c('0x21')]==='undefined';var _0x429dcf=_0x1ed27d[_0x8d9c('0x22')];var _0x57a45b=_0x44896d?0x0:_0x1c8d6f[_0x8d9c('0x23')];var _0x2ba1c8=_0x44896d?_0x1ed27d[_0x8d9c('0x22')]:_0x1c8d6f[_0x8d9c('0x23')]+_0x1c8d6f['limit'];var _0x4467b0;if(_0x2ba1c8>=_0x429dcf){_0x2ba1c8=_0x429dcf;_0x4467b0=0xc8;}else{_0x4467b0=0xce;}_0x304de9[_0x8d9c('0x1e')](_0x4467b0);return _0x304de9['set']('Content-Range',_0x57a45b+'-'+_0x2ba1c8+'/'+_0x429dcf)[_0x8d9c('0x1f')](_0x1ed27d);}return null;};}function patchUpdates(_0x2d2bf7){return function(_0x1c2fe9){try{jsonpatch[_0x8d9c('0x24')](_0x1c2fe9,_0x2d2bf7,!![]);}catch(_0x38a32b){return BPromise[_0x8d9c('0x25')](_0x38a32b);}return _0x1c2fe9[_0x8d9c('0x26')]();};}function saveUpdates(_0x47ae95,_0x1f7c3b){return function(_0x49f4f0){if(_0x49f4f0){return _0x49f4f0[_0x8d9c('0x27')](_0x47ae95)[_0x8d9c('0x28')](function(_0x416a80){return _0x416a80;});}return null;};}function removeEntity(_0x454bdb,_0x171c96){return function(_0x1f380f){if(_0x1f380f){return _0x1f380f[_0x8d9c('0x29')]()['then'](function(){var _0x57be56=_0x1f380f['get']({'plain':!![]});var _0x527302=[{'name':'VoiceQueues','value':_0x8d9c('0x2a'),'ignore':![]},{'name':_0x8d9c('0x2b'),'value':_0x8d9c('0x2c'),'ignore':![]}];var _0x596107=_(_0x527302)['filter'](_0x8d9c('0x2d'))[_0x8d9c('0x2e')]('value')['value']();if(_[_0x8d9c('0x2f')](_0x596107,_0x57be56['type'])){return;}var _0x3eb784=_[_0x8d9c('0x30')](_0x527302,[_0x8d9c('0x31'),_0x57be56['type']])[_0x8d9c('0x32')];return db[_0x8d9c('0x33')][_0x8d9c('0x29')]({'where':{'type':_0x3eb784,'resourceId':_0x57be56['id']}})[_0x8d9c('0x28')](function(){return _0x1f380f;});})[_0x8d9c('0x28')](function(){_0x454bdb[_0x8d9c('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bd2ea,_0x1ce099){return function(_0x560412){if(!_0x560412){_0x4bd2ea[_0x8d9c('0x1c')](0x194);}return _0x560412;};}function handleError(_0x3c1780,_0x5db7c3){_0x5db7c3=_0x5db7c3||0x1f4;return function(_0x17b046){logger[_0x8d9c('0x34')](_0x17b046[_0x8d9c('0x35')]);if(_0x17b046[_0x8d9c('0x32')]){delete _0x17b046[_0x8d9c('0x32')];}_0x3c1780[_0x8d9c('0x1e')](_0x5db7c3)[_0x8d9c('0x36')](_0x17b046);};}exports[_0x8d9c('0x37')]=function(_0x2a0713,_0x34913e){var _0xcf2b45={},_0x3ec24={},_0x1d230f={'count':0x0,'rows':[]};var _0x54c4e6=_['map'](db[_0x8d9c('0x38')][_0x8d9c('0x39')],function(_0x1fe3fc){return{'name':_0x1fe3fc['fieldName'],'type':_0x1fe3fc[_0x8d9c('0x3a')][_0x8d9c('0x3b')]};});_0x3ec24[_0x8d9c('0x3c')]=_[_0x8d9c('0x2e')](_0x54c4e6,_0x8d9c('0x32'));_0x3ec24[_0x8d9c('0x3d')]=_[_0x8d9c('0x3e')](_0x2a0713['query']);_0x3ec24[_0x8d9c('0x3f')]=_['intersection'](_0x3ec24[_0x8d9c('0x3c')],_0x3ec24['query']);_0xcf2b45['attributes']=_[_0x8d9c('0x40')](_0x3ec24[_0x8d9c('0x3c')],qs[_0x8d9c('0x41')](_0x2a0713[_0x8d9c('0x3d')][_0x8d9c('0x41')]));_0xcf2b45['attributes']=_0xcf2b45['attributes'][_0x8d9c('0x42')]?_0xcf2b45[_0x8d9c('0x43')]:_0x3ec24[_0x8d9c('0x3c')];if(!_0x2a0713[_0x8d9c('0x3d')][_0x8d9c('0x44')](_0x8d9c('0x45'))){_0xcf2b45[_0x8d9c('0x21')]=qs[_0x8d9c('0x21')](_0x2a0713['query'][_0x8d9c('0x21')]);_0xcf2b45['offset']=qs['offset'](_0x2a0713[_0x8d9c('0x3d')][_0x8d9c('0x23')]);}_0xcf2b45[_0x8d9c('0x46')]=qs['sort'](_0x2a0713[_0x8d9c('0x3d')]['sort']);_0xcf2b45[_0x8d9c('0x47')]=qs['filters'](_['pick'](_0x2a0713[_0x8d9c('0x3d')],_0x3ec24[_0x8d9c('0x3f')]),_0x54c4e6);if(_0x2a0713[_0x8d9c('0x3d')]['filter']){_0xcf2b45[_0x8d9c('0x47')]=_[_0x8d9c('0x48')](_0xcf2b45[_0x8d9c('0x47')],{'$or':_[_0x8d9c('0x2e')](_0x54c4e6,function(_0x380be5){if(_0x380be5[_0x8d9c('0x3a')]!==_0x8d9c('0x49')){var _0x3794e3={};_0x3794e3[_0x380be5[_0x8d9c('0x32')]]={'$like':'%'+_0x2a0713[_0x8d9c('0x3d')]['filter']+'%'};return _0x3794e3;}})});}_0xcf2b45=_[_0x8d9c('0x48')]({},_0xcf2b45,_0x2a0713[_0x8d9c('0x4a')]);var _0x572b68={'where':_0xcf2b45[_0x8d9c('0x47')]};return db[_0x8d9c('0x38')][_0x8d9c('0x22')](_0x572b68)['then'](function(_0x21d075){_0x1d230f['count']=_0x21d075;if(_0x2a0713[_0x8d9c('0x3d')][_0x8d9c('0x4b')]){_0xcf2b45[_0x8d9c('0x4c')]=[{'all':!![]}];}return db[_0x8d9c('0x38')]['findAll'](_0xcf2b45);})[_0x8d9c('0x28')](function(_0x49af45){_0x1d230f[_0x8d9c('0x4d')]=_0x49af45;return _0x1d230f;})[_0x8d9c('0x28')](respondWithFilteredResult(_0x34913e,_0xcf2b45))[_0x8d9c('0x4e')](handleError(_0x34913e,null));};exports[_0x8d9c('0x4f')]=function(_0x333e72,_0x2b2010){var _0x37fa80={'raw':![],'where':{'id':_0x333e72[_0x8d9c('0x50')]['id']}},_0x58e447={};_0x58e447[_0x8d9c('0x3c')]=_[_0x8d9c('0x3e')](db[_0x8d9c('0x38')][_0x8d9c('0x39')]);_0x58e447[_0x8d9c('0x3d')]=_[_0x8d9c('0x3e')](_0x333e72[_0x8d9c('0x3d')]);_0x58e447['filters']=_[_0x8d9c('0x40')](_0x58e447[_0x8d9c('0x3c')],_0x58e447[_0x8d9c('0x3d')]);_0x37fa80[_0x8d9c('0x43')]=_[_0x8d9c('0x40')](_0x58e447[_0x8d9c('0x3c')],qs[_0x8d9c('0x41')](_0x333e72['query'][_0x8d9c('0x41')]));_0x37fa80[_0x8d9c('0x43')]=_0x37fa80[_0x8d9c('0x43')]['length']?_0x37fa80[_0x8d9c('0x43')]:_0x58e447[_0x8d9c('0x3c')];if(_0x333e72[_0x8d9c('0x3d')][_0x8d9c('0x4b')]){_0x37fa80[_0x8d9c('0x4c')]=[{'all':!![]}];}_0x37fa80=_[_0x8d9c('0x48')]({},_0x37fa80,_0x333e72[_0x8d9c('0x4a')]);return db[_0x8d9c('0x38')][_0x8d9c('0x30')](_0x37fa80)[_0x8d9c('0x28')](handleEntityNotFound(_0x2b2010,null))[_0x8d9c('0x28')](respondWithResult(_0x2b2010,null))[_0x8d9c('0x4e')](handleError(_0x2b2010,null));};exports[_0x8d9c('0x51')]=function(_0x11296e,_0x46f5e6){return db[_0x8d9c('0x38')][_0x8d9c('0x51')](_0x11296e[_0x8d9c('0x52')],{})[_0x8d9c('0x28')](function(_0x5d288c){var _0x3e4501=_0x11296e[_0x8d9c('0x53')]['get']({'plain':!![]});if(!_0x3e4501)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e4501[_0x8d9c('0x54')]===_0x8d9c('0x53')){var _0x3f2b79=_0x5d288c[_0x8d9c('0x55')]({'plain':!![]});var _0x593434=[{'name':'VoiceQueues','value':_0x8d9c('0x2a')},{'name':'QueueCampaigns','value':'outbound'}];var _0x581aa4=_['find'](_0x593434,[_0x8d9c('0x31'),_0x3f2b79[_0x8d9c('0x3a')]])[_0x8d9c('0x32')];return db[_0x8d9c('0x56')]['find']({'where':{'name':_0x581aa4,'userProfileId':_0x3e4501['userProfileId']},'raw':!![]})[_0x8d9c('0x28')](function(_0x4ca050){if(_0x4ca050&&_0x4ca050['autoAssociation']===0x0){return db[_0x8d9c('0x33')][_0x8d9c('0x51')]({'name':_0x3f2b79['name'],'resourceId':_0x3f2b79['id'],'type':_0x4ca050[_0x8d9c('0x32')],'sectionId':_0x4ca050['id']},{})[_0x8d9c('0x28')](function(){return _0x5d288c;});}else{return _0x5d288c;}})['catch'](function(_0x267dbd){logger[_0x8d9c('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x267dbd);throw _0x267dbd;});}return _0x5d288c;})[_0x8d9c('0x28')](respondWithResult(_0x46f5e6,0xc9))[_0x8d9c('0x4e')](handleError(_0x46f5e6,null));};exports[_0x8d9c('0x57')]=function(_0x42c2c3,_0x20ab1a){var _0x527732={'where':{'id':_0x42c2c3[_0x8d9c('0x50')]['id']}},_0x4c3aff={};_0x4c3aff[_0x8d9c('0x3c')]=_[_0x8d9c('0x3e')](db[_0x8d9c('0x38')]['rawAttributes']);_0x527732['attributes']=_[_0x8d9c('0x40')](_0x4c3aff[_0x8d9c('0x3c')],qs[_0x8d9c('0x41')](_0x42c2c3[_0x8d9c('0x3d')][_0x8d9c('0x41')]));_0x527732[_0x8d9c('0x43')]=_0x527732[_0x8d9c('0x43')][_0x8d9c('0x42')]?_0x527732[_0x8d9c('0x43')]:_0x4c3aff[_0x8d9c('0x3c')];if(_0x42c2c3[_0x8d9c('0x3d')][_0x8d9c('0x4b')]){_0x527732['include']=[{'all':!![]}];}_0x527732=_[_0x8d9c('0x48')]({},_0x527732,_0x42c2c3[_0x8d9c('0x4a')]);return db[_0x8d9c('0x38')][_0x8d9c('0x30')](_0x527732)[_0x8d9c('0x28')](handleEntityNotFound(_0x20ab1a,null))[_0x8d9c('0x28')](function(_0x4471e2){if(_0x4471e2){var _0x25996e=_0x4471e2[_0x8d9c('0x55')]({'plain':!![]});_0x25996e=qs[_0x8d9c('0x58')](_0x25996e,['id',_0x8d9c('0x59'),_0x8d9c('0x5a')]);_0x42c2c3[_0x8d9c('0x52')]=_[_0x8d9c('0x58')](_0x42c2c3[_0x8d9c('0x52')],['id',_0x8d9c('0x59'),_0x8d9c('0x5a')]);return db[_0x8d9c('0x38')][_0x8d9c('0x51')](_[_0x8d9c('0x48')](_0x25996e,_0x42c2c3[_0x8d9c('0x52')]),{'include':_0x42c2c3['query']['includeAll']?[{'all':!![]}]:undefined})[_0x8d9c('0x28')](function(_0x36aa06){var _0x45e54c=_0x42c2c3[_0x8d9c('0x53')][_0x8d9c('0x55')]({'plain':!![]});if(!_0x45e54c)throw new Error(_0x8d9c('0x5b'));if(_0x45e54c[_0x8d9c('0x54')]===_0x8d9c('0x53')){var _0x17a407=_0x36aa06[_0x8d9c('0x55')]({'plain':!![]});var _0x2464a9=[{'name':_0x8d9c('0x5c'),'value':_0x8d9c('0x2a')},{'name':_0x8d9c('0x2b'),'value':_0x8d9c('0x2c')}];var _0x3966c1=_[_0x8d9c('0x30')](_0x2464a9,[_0x8d9c('0x31'),_0x17a407[_0x8d9c('0x3a')]])[_0x8d9c('0x32')];return db[_0x8d9c('0x56')][_0x8d9c('0x30')]({'where':{'name':_0x3966c1,'userProfileId':_0x45e54c['userProfileId']},'raw':!![]})[_0x8d9c('0x28')](function(_0x1e7431){if(_0x1e7431&&_0x1e7431[_0x8d9c('0x5d')]===0x0){return db[_0x8d9c('0x33')]['create']({'name':_0x17a407[_0x8d9c('0x32')],'resourceId':_0x17a407['id'],'type':_0x1e7431[_0x8d9c('0x32')],'sectionId':_0x1e7431['id']},{})[_0x8d9c('0x28')](function(){return _0x36aa06;});}else{return _0x36aa06;}})['catch'](function(_0x327a31){logger[_0x8d9c('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x327a31);throw _0x327a31;});}return _0x36aa06;});}})[_0x8d9c('0x28')](respondWithResult(_0x20ab1a,0xc9))['catch'](handleError(_0x20ab1a,null));};exports[_0x8d9c('0x27')]=function(_0x38ffaf,_0x40c285){if(_0x38ffaf[_0x8d9c('0x52')]['id']){delete _0x38ffaf[_0x8d9c('0x52')]['id'];}return db['VoiceQueue'][_0x8d9c('0x30')]({'where':{'id':_0x38ffaf[_0x8d9c('0x50')]['id']}})[_0x8d9c('0x28')](handleEntityNotFound(_0x40c285,null))[_0x8d9c('0x28')](saveUpdates(_0x38ffaf[_0x8d9c('0x52')],null))[_0x8d9c('0x28')](respondWithResult(_0x40c285,null))[_0x8d9c('0x4e')](handleError(_0x40c285,null));};exports['destroy']=function(_0xc53977,_0x15d60e){return db[_0x8d9c('0x38')]['find']({'where':{'id':_0xc53977['params']['id']}})[_0x8d9c('0x28')](handleEntityNotFound(_0x15d60e,null))[_0x8d9c('0x28')](removeEntity(_0x15d60e,null))[_0x8d9c('0x4e')](handleError(_0x15d60e,null));};exports[_0x8d9c('0x5e')]=function(_0x3c9561,_0x57224e,_0x7ca0fe){var _0x134188={'raw':![],'where':{}};var _0x5462a5={};var _0x4f81a6={'count':0x0,'rows':[]};return db[_0x8d9c('0x38')][_0x8d9c('0x5f')]({'where':{'id':_0x3c9561[_0x8d9c('0x50')]['id']}})[_0x8d9c('0x28')](handleEntityNotFound(_0x57224e,null))[_0x8d9c('0x28')](function(_0x1dc6be){if(_0x1dc6be){_0x5462a5[_0x8d9c('0x3c')]=_['keys'](db[_0x8d9c('0x60')][_0x8d9c('0x39')]);_0x5462a5[_0x8d9c('0x3d')]=_[_0x8d9c('0x3e')](_0x3c9561['query']);_0x5462a5['filters']=_[_0x8d9c('0x40')](_0x5462a5[_0x8d9c('0x3c')],_0x5462a5['query']);_0x134188['attributes']=_[_0x8d9c('0x40')](_0x5462a5[_0x8d9c('0x3c')],qs[_0x8d9c('0x41')](_0x3c9561[_0x8d9c('0x3d')][_0x8d9c('0x41')]));_0x134188[_0x8d9c('0x43')]=_0x134188[_0x8d9c('0x43')][_0x8d9c('0x42')]?_0x134188['attributes']:_0x5462a5['model'];if(!_0x3c9561['query'][_0x8d9c('0x44')](_0x8d9c('0x45'))){_0x134188[_0x8d9c('0x21')]=qs[_0x8d9c('0x21')](_0x3c9561[_0x8d9c('0x3d')][_0x8d9c('0x21')]);_0x134188[_0x8d9c('0x23')]=qs[_0x8d9c('0x23')](_0x3c9561[_0x8d9c('0x3d')]['offset']);}_0x134188[_0x8d9c('0x46')]=qs[_0x8d9c('0x61')](_0x3c9561[_0x8d9c('0x3d')][_0x8d9c('0x61')]);_0x134188[_0x8d9c('0x47')]=qs[_0x8d9c('0x3f')](_['pick'](_0x3c9561[_0x8d9c('0x3d')],_0x5462a5['filters']));_0x134188[_0x8d9c('0x47')][_0x8d9c('0x62')]=_0x1dc6be['id'];if(_0x3c9561['query'][_0x8d9c('0x63')]){_0x134188[_0x8d9c('0x47')]=_[_0x8d9c('0x48')](_0x134188['where'],{'$or':_['map'](_0x134188[_0x8d9c('0x43')],function(_0x146580){var _0x203609={};_0x203609[_0x146580]={'$like':'%'+_0x3c9561['query']['filter']+'%'};return _0x203609;})});}_0x134188=_[_0x8d9c('0x48')]({},_0x134188,_0x3c9561[_0x8d9c('0x4a')]);return db[_0x8d9c('0x60')]['count']({'where':_0x134188[_0x8d9c('0x47')]})[_0x8d9c('0x28')](function(_0x28e96e){_0x4f81a6['count']=_0x28e96e;if(_0x3c9561[_0x8d9c('0x3d')][_0x8d9c('0x4b')]){_0x134188[_0x8d9c('0x4c')]=[{'all':!![]}];}return db['CmHopper'][_0x8d9c('0x64')](_0x134188);})[_0x8d9c('0x28')](function(_0x2e7342){_0x4f81a6[_0x8d9c('0x4d')]=_0x2e7342;return _0x4f81a6;});}})[_0x8d9c('0x28')](respondWithFilteredResult(_0x57224e,_0x134188))[_0x8d9c('0x4e')](handleError(_0x57224e,null));};exports['getHopperHistories']=function(_0x47e78a,_0x31dc6c,_0x18915f){var _0xfbcb3={'raw':!![],'where':{}};var _0x341a34={};var _0x389cef={'count':0x0,'rows':[]};return db[_0x8d9c('0x38')][_0x8d9c('0x5f')]({'where':{'id':_0x47e78a[_0x8d9c('0x50')]['id']}})['then'](handleEntityNotFound(_0x31dc6c,null))[_0x8d9c('0x28')](function(_0x2b4bc6){if(_0x2b4bc6){_0x341a34[_0x8d9c('0x3c')]=_[_0x8d9c('0x3e')](db[_0x8d9c('0x65')]['rawAttributes']);_0x341a34[_0x8d9c('0x3d')]=_[_0x8d9c('0x3e')](_0x47e78a[_0x8d9c('0x3d')]);_0x341a34[_0x8d9c('0x3f')]=_[_0x8d9c('0x40')](_0x341a34[_0x8d9c('0x3c')],_0x341a34[_0x8d9c('0x3d')]);_0xfbcb3[_0x8d9c('0x43')]=_[_0x8d9c('0x40')](_0x341a34[_0x8d9c('0x3c')],qs[_0x8d9c('0x41')](_0x47e78a[_0x8d9c('0x3d')][_0x8d9c('0x41')]));_0xfbcb3['attributes']=_0xfbcb3['attributes'][_0x8d9c('0x42')]?_0xfbcb3[_0x8d9c('0x43')]:_0x341a34[_0x8d9c('0x3c')];if(!_0x47e78a[_0x8d9c('0x3d')][_0x8d9c('0x44')](_0x8d9c('0x45'))){_0xfbcb3['limit']=qs[_0x8d9c('0x21')](_0x47e78a['query']['limit']);_0xfbcb3[_0x8d9c('0x23')]=qs['offset'](_0x47e78a['query']['offset']);}_0xfbcb3[_0x8d9c('0x46')]=qs['sort'](_0x47e78a[_0x8d9c('0x3d')][_0x8d9c('0x61')]);_0xfbcb3[_0x8d9c('0x47')]=qs[_0x8d9c('0x3f')](_['pick'](_0x47e78a[_0x8d9c('0x3d')],_0x341a34['filters']));_0xfbcb3['where'][_0x8d9c('0x62')]=_0x2b4bc6['id'];if(_0x47e78a[_0x8d9c('0x3d')][_0x8d9c('0x63')]){_0xfbcb3[_0x8d9c('0x47')]=_['merge'](_0xfbcb3['where'],{'$or':_[_0x8d9c('0x2e')](_0xfbcb3['attributes'],function(_0x2d9ac8){var _0x2f2252={};_0x2f2252[_0x2d9ac8]={'$like':'%'+_0x47e78a[_0x8d9c('0x3d')]['filter']+'%'};return _0x2f2252;})});}_0xfbcb3=_[_0x8d9c('0x48')]({},_0xfbcb3,_0x47e78a[_0x8d9c('0x4a')]);return db['CmHopperHistory'][_0x8d9c('0x22')]({'where':_0xfbcb3[_0x8d9c('0x47')]})['then'](function(_0x32e097){_0x389cef['count']=_0x32e097;if(_0x47e78a[_0x8d9c('0x3d')]['includeAll']){_0xfbcb3[_0x8d9c('0x4c')]=[{'all':!![]}];}return db[_0x8d9c('0x65')][_0x8d9c('0x64')](_0xfbcb3);})['then'](function(_0x10510b){_0x389cef[_0x8d9c('0x4d')]=_0x10510b;return _0x389cef;});}})[_0x8d9c('0x28')](respondWithFilteredResult(_0x31dc6c,_0xfbcb3))['catch'](handleError(_0x31dc6c,null));};exports[_0x8d9c('0x66')]=function(_0x21c72a,_0x37d978,_0x2d8b6e){var _0x1e5f47={'raw':!![],'where':{}};var _0x3b340b={};var _0x2d58fa={'count':0x0,'rows':[]};return db[_0x8d9c('0x38')][_0x8d9c('0x5f')]({'where':{'id':_0x21c72a[_0x8d9c('0x50')]['id']}})['then'](handleEntityNotFound(_0x37d978,null))['then'](function(_0x1c8086){if(_0x1c8086){_0x3b340b['model']=_[_0x8d9c('0x3e')](db[_0x8d9c('0x67')][_0x8d9c('0x39')]);_0x3b340b[_0x8d9c('0x3d')]=_[_0x8d9c('0x3e')](_0x21c72a[_0x8d9c('0x3d')]);_0x3b340b[_0x8d9c('0x3f')]=_[_0x8d9c('0x40')](_0x3b340b[_0x8d9c('0x3c')],_0x3b340b['query']);_0x1e5f47[_0x8d9c('0x43')]=_[_0x8d9c('0x40')](_0x3b340b[_0x8d9c('0x3c')],qs['fields'](_0x21c72a[_0x8d9c('0x3d')][_0x8d9c('0x41')]));_0x1e5f47[_0x8d9c('0x43')]=_0x1e5f47['attributes'][_0x8d9c('0x42')]?_0x1e5f47['attributes']:_0x3b340b['model'];if(!_0x21c72a[_0x8d9c('0x3d')][_0x8d9c('0x44')](_0x8d9c('0x45'))){_0x1e5f47[_0x8d9c('0x21')]=qs[_0x8d9c('0x21')](_0x21c72a[_0x8d9c('0x3d')][_0x8d9c('0x21')]);_0x1e5f47[_0x8d9c('0x23')]=qs['offset'](_0x21c72a['query'][_0x8d9c('0x23')]);}_0x1e5f47['order']=qs[_0x8d9c('0x61')](_0x21c72a['query']['sort']);_0x1e5f47[_0x8d9c('0x47')]=qs[_0x8d9c('0x3f')](_[_0x8d9c('0x68')](_0x21c72a[_0x8d9c('0x3d')],_0x3b340b[_0x8d9c('0x3f')]));_0x1e5f47[_0x8d9c('0x47')][_0x8d9c('0x62')]=_0x1c8086['id'];if(_0x21c72a[_0x8d9c('0x3d')][_0x8d9c('0x63')]){_0x1e5f47[_0x8d9c('0x47')]=_[_0x8d9c('0x48')](_0x1e5f47[_0x8d9c('0x47')],{'$or':_[_0x8d9c('0x2e')](_0x1e5f47[_0x8d9c('0x43')],function(_0x1b77c0){var _0x59327c={};_0x59327c[_0x1b77c0]={'$like':'%'+_0x21c72a[_0x8d9c('0x3d')][_0x8d9c('0x63')]+'%'};return _0x59327c;})});}_0x1e5f47=_[_0x8d9c('0x48')]({},_0x1e5f47,_0x21c72a['options']);return db[_0x8d9c('0x67')][_0x8d9c('0x22')]({'where':_0x1e5f47[_0x8d9c('0x47')]})['then'](function(_0x450730){_0x2d58fa[_0x8d9c('0x22')]=_0x450730;if(_0x21c72a[_0x8d9c('0x3d')][_0x8d9c('0x4b')]){_0x1e5f47['include']=[{'all':!![]}];}return db[_0x8d9c('0x67')]['findAll'](_0x1e5f47);})[_0x8d9c('0x28')](function(_0x52e5a6){_0x2d58fa['rows']=_0x52e5a6;return _0x2d58fa;});}})['then'](respondWithFilteredResult(_0x37d978,_0x1e5f47))[_0x8d9c('0x4e')](handleError(_0x37d978,null));};exports[_0x8d9c('0x69')]=function(_0xb62a72,_0x2c010c,_0x1873bb){var _0x8d25d0={'raw':!![],'where':{}};var _0x36694a={};var _0x2684fd={'count':0x0,'rows':[]};return db[_0x8d9c('0x38')][_0x8d9c('0x5f')]({'where':{'id':_0xb62a72[_0x8d9c('0x50')]['id']}})[_0x8d9c('0x28')](handleEntityNotFound(_0x2c010c,null))[_0x8d9c('0x28')](function(_0xd82a15){if(_0xd82a15){_0x36694a[_0x8d9c('0x3c')]=_[_0x8d9c('0x3e')](db[_0x8d9c('0x6a')][_0x8d9c('0x39')]);_0x36694a['query']=_[_0x8d9c('0x3e')](_0xb62a72['query']);_0x36694a[_0x8d9c('0x3f')]=_['intersection'](_0x36694a[_0x8d9c('0x3c')],_0x36694a[_0x8d9c('0x3d')]);_0x8d25d0[_0x8d9c('0x43')]=_[_0x8d9c('0x40')](_0x36694a[_0x8d9c('0x3c')],qs[_0x8d9c('0x41')](_0xb62a72[_0x8d9c('0x3d')][_0x8d9c('0x41')]));_0x8d25d0[_0x8d9c('0x43')]=_0x8d25d0[_0x8d9c('0x43')][_0x8d9c('0x42')]?_0x8d25d0[_0x8d9c('0x43')]:_0x36694a[_0x8d9c('0x3c')];if(!_0xb62a72[_0x8d9c('0x3d')][_0x8d9c('0x44')](_0x8d9c('0x45'))){_0x8d25d0[_0x8d9c('0x21')]=qs['limit'](_0xb62a72[_0x8d9c('0x3d')][_0x8d9c('0x21')]);_0x8d25d0[_0x8d9c('0x23')]=qs[_0x8d9c('0x23')](_0xb62a72[_0x8d9c('0x3d')]['offset']);}_0x8d25d0[_0x8d9c('0x46')]=qs['sort'](_0xb62a72[_0x8d9c('0x3d')][_0x8d9c('0x61')]);_0x8d25d0[_0x8d9c('0x47')]=qs[_0x8d9c('0x3f')](_['pick'](_0xb62a72[_0x8d9c('0x3d')],_0x36694a[_0x8d9c('0x3f')]));_0x8d25d0['where'][_0x8d9c('0x62')]=_0xd82a15['id'];if(_0xb62a72[_0x8d9c('0x3d')][_0x8d9c('0x63')]){_0x8d25d0[_0x8d9c('0x47')]=_[_0x8d9c('0x48')](_0x8d25d0[_0x8d9c('0x47')],{'$or':_[_0x8d9c('0x2e')](_0x8d25d0['attributes'],function(_0x37a5b1){var _0x2f1a78={};_0x2f1a78[_0x37a5b1]={'$like':'%'+_0xb62a72[_0x8d9c('0x3d')][_0x8d9c('0x63')]+'%'};return _0x2f1a78;})});}_0x8d25d0=_['merge']({},_0x8d25d0,_0xb62a72[_0x8d9c('0x4a')]);return db[_0x8d9c('0x6a')]['count']({'where':_0x8d25d0['where']})[_0x8d9c('0x28')](function(_0x18d6d9){_0x2684fd[_0x8d9c('0x22')]=_0x18d6d9;if(_0xb62a72['query']['includeAll']){_0x8d25d0['include']=[{'all':!![]}];}return db[_0x8d9c('0x6a')][_0x8d9c('0x64')](_0x8d25d0);})[_0x8d9c('0x28')](function(_0x472421){_0x2684fd[_0x8d9c('0x4d')]=_0x472421;return _0x2684fd;});}})['then'](respondWithFilteredResult(_0x2c010c,_0x8d25d0))[_0x8d9c('0x4e')](handleError(_0x2c010c,null));};exports[_0x8d9c('0x6b')]=function(_0x43ad9f,_0x570755,_0x3d1398){var _0x17723b={};var _0xa86af8={};var _0x2b7402;var _0x24070e;return db[_0x8d9c('0x38')][_0x8d9c('0x5f')]({'where':{'id':_0x43ad9f[_0x8d9c('0x50')]['id']}})[_0x8d9c('0x28')](handleEntityNotFound(_0x570755,null))['then'](function(_0xaba8f8){if(_0xaba8f8){_0x2b7402=_0xaba8f8;_0xa86af8[_0x8d9c('0x3c')]=_[_0x8d9c('0x3e')](db[_0x8d9c('0x6c')]['rawAttributes']);_0xa86af8[_0x8d9c('0x3d')]=_[_0x8d9c('0x3e')](_0x43ad9f[_0x8d9c('0x3d')]);_0xa86af8[_0x8d9c('0x3f')]=_['intersection'](_0xa86af8[_0x8d9c('0x3c')],_0xa86af8[_0x8d9c('0x3d')]);_0x17723b[_0x8d9c('0x43')]=_[_0x8d9c('0x40')](_0xa86af8[_0x8d9c('0x3c')],qs[_0x8d9c('0x41')](_0x43ad9f[_0x8d9c('0x3d')]['fields']));_0x17723b[_0x8d9c('0x43')]=_0x17723b[_0x8d9c('0x43')][_0x8d9c('0x42')]?_0x17723b[_0x8d9c('0x43')]:_0xa86af8[_0x8d9c('0x3c')];_0x17723b[_0x8d9c('0x46')]=qs[_0x8d9c('0x61')](_0x43ad9f['query'][_0x8d9c('0x61')]);_0x17723b[_0x8d9c('0x47')]=qs[_0x8d9c('0x3f')](_[_0x8d9c('0x68')](_0x43ad9f[_0x8d9c('0x3d')],_0xa86af8[_0x8d9c('0x3f')]));if(_0x43ad9f[_0x8d9c('0x3d')]['filter']){_0x17723b[_0x8d9c('0x47')]=_[_0x8d9c('0x48')](_0x17723b['where'],{'$or':_[_0x8d9c('0x2e')](_0x17723b[_0x8d9c('0x43')],function(_0x349fb4){var _0x1dd1d7={};_0x1dd1d7[_0x349fb4]={'$like':'%'+_0x43ad9f[_0x8d9c('0x3d')][_0x8d9c('0x63')]+'%'};return _0x1dd1d7;})});}_0x17723b=_[_0x8d9c('0x48')]({},_0x17723b,_0x43ad9f[_0x8d9c('0x4a')]);return _0x2b7402[_0x8d9c('0x6b')](_0x17723b);}})[_0x8d9c('0x28')](function(_0x36383f){if(_0x36383f){_0x24070e=_0x36383f['length'];if(!_0x43ad9f[_0x8d9c('0x3d')][_0x8d9c('0x44')](_0x8d9c('0x45'))){_0x17723b[_0x8d9c('0x21')]=qs[_0x8d9c('0x21')](_0x43ad9f[_0x8d9c('0x3d')][_0x8d9c('0x21')]);_0x17723b[_0x8d9c('0x23')]=qs[_0x8d9c('0x23')](_0x43ad9f[_0x8d9c('0x3d')][_0x8d9c('0x23')]);}return _0x2b7402['getTeams'](_0x17723b);}})['then'](function(_0x2a1fce){if(_0x2a1fce){return _0x2a1fce?{'count':_0x24070e,'rows':_0x2a1fce}:null;}})[_0x8d9c('0x28')](respondWithResult(_0x570755,null))[_0x8d9c('0x4e')](handleError(_0x570755,null));};exports[_0x8d9c('0x6d')]=function(_0x24818a,_0x343152,_0x386c36){var _0x757798=_0x24818a[_0x8d9c('0x52')]['teams'];var _0x6f31d5=_[_0x8d9c('0x2e')](_0x757798,'id');return db[_0x8d9c('0x6c')][_0x8d9c('0x64')]({'where':{'id':_0x6f31d5},'attributes':['id'],'include':[{'model':db[_0x8d9c('0x6e')],'as':_0x8d9c('0x6f'),'attributes':['id',_0x8d9c('0x32'),_0x8d9c('0x70'),'voicePause',_0x8d9c('0x71')],'raw':!![]}]})['then'](function(_0x3043b9){if(_0x3043b9){var _0x20b46a=_[_0x8d9c('0x72')](_0x3043b9,function(_0xcfdffd){var _0x243557=_0xcfdffd[_0x8d9c('0x55')]({'plain':!![]});_0x243557[_0x8d9c('0x6f')][_0x8d9c('0x73')](function(_0x501486){_0x501486[_0x8d9c('0x74')]=_['find'](_0x757798,{'id':_0x243557['id']})['penalty'];});return _0x243557[_0x8d9c('0x6f')];});return db[_0x8d9c('0x38')][_0x8d9c('0x30')]({'where':{'id':_0x24818a[_0x8d9c('0x50')]['id']}})[_0x8d9c('0x28')](function(_0x3b76a1){return db[_0x8d9c('0x75')][_0x8d9c('0x76')](function(_0x2a204e){return _0x3b76a1[_0x8d9c('0x6d')](_0x6f31d5,{'transaction':_0x2a204e})[_0x8d9c('0x28')](function(){return BPromise['each'](_0x757798,function(_0x40d3dd){return db[_0x8d9c('0x77')][_0x8d9c('0x78')]({'TeamId':_0x40d3dd['id'],'VoiceQueueId':_0x24818a[_0x8d9c('0x50')]['id'],'penalty':_0x40d3dd[_0x8d9c('0x74')]},{'transaction':_0x2a204e});});})['then'](function(){return BPromise['each'](_0x20b46a,function(_0x57515b){return db[_0x8d9c('0x79')][_0x8d9c('0x7a')]({'where':{'UserId':_0x57515b['id'],'VoiceQueueId':_0x24818a[_0x8d9c('0x50')]['id']},'defaults':{'penalty':_0x57515b[_0x8d9c('0x74')]},'transaction':_0x2a204e});});})['then'](function(){return BPromise[_0x8d9c('0x7b')](_[_0x8d9c('0x63')](_0x20b46a,{'online':!![]}),function(_0x2597f1){return db[_0x8d9c('0x7c')][_0x8d9c('0x78')]({'membername':_0x2597f1[_0x8d9c('0x32')],'UserId':_0x2597f1['id'],'queue_name':_0x3b76a1['name'],'VoiceQueueId':_0x3b76a1['id'],'interface':_[_0x8d9c('0x7d')](_0x2597f1[_0x8d9c('0x71')])?util[_0x8d9c('0x7e')](_0x8d9c('0x7f'),_0x2597f1[_0x8d9c('0x32')]):_0x2597f1['interface'],'paused':_0x2597f1[_0x8d9c('0x80')]||![],'penalty':_0x2597f1[_0x8d9c('0x74')]},{'transaction':_0x2a204e});});})['then'](function(){_0x20b46a[_0x8d9c('0x73')](function(_0x1edd95){socket[_0x8d9c('0x81')](_0x8d9c('0x82'),{'UserId':_0x1edd95['id'],'VoiceQueueId':_0x3b76a1['id']});});});});});}})[_0x8d9c('0x28')](respondWithStatusCode(_0x343152,null))['catch'](handleError(_0x343152,null));};exports[_0x8d9c('0x83')]=function(_0x136a88,_0x7d7bcb,_0x4f0840){return db[_0x8d9c('0x6c')]['findAll']({'where':{'id':_0x136a88[_0x8d9c('0x3d')][_0x8d9c('0x84')]},'attributes':['id'],'include':[{'model':db[_0x8d9c('0x6e')],'as':_0x8d9c('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x7d7bcb,null))[_0x8d9c('0x28')](function(_0x116f5d){var _0x58e221=_[_0x8d9c('0x2e')](_0x116f5d,'id');var _0x112354=[];var _0x1bc2f3=[];var _0x10001d=squel[_0x8d9c('0x85')]();_0x10001d['field']('tq.TeamId')['from'](_0x8d9c('0x86'),'tq')['join'](_0x8d9c('0x87'),'ut',_0x8d9c('0x88'))[_0x8d9c('0x47')](_0x8d9c('0x89'),_0x136a88[_0x8d9c('0x50')]['id']);for(var _0x4b5c07=0x0;_0x4b5c07<_0x116f5d['length'];_0x4b5c07+=0x1){let _0x1b0b99=_0x116f5d[_0x4b5c07];for(var _0x1ceb22=0x0;_0x1ceb22<_0x1b0b99[_0x8d9c('0x6f')][_0x8d9c('0x42')];_0x1ceb22+=0x1){let _0x170e5c=_0x1b0b99[_0x8d9c('0x6f')][_0x1ceb22];var _0x38765d=_0x10001d[_0x8d9c('0x57')]();_0x38765d['where'](_0x8d9c('0x8a'),_0x170e5c['id']);_0x1bc2f3[_0x8d9c('0x8b')](db[_0x8d9c('0x75')][_0x8d9c('0x3d')](_0x38765d[_0x8d9c('0x8c')](),{'type':db[_0x8d9c('0x75')][_0x8d9c('0x8d')]['SELECT']})[_0x8d9c('0x28')](function(_0x44d148){if(_0x44d148['length']===0x1){return _0x170e5c['id'];}else{var _0x11cefe=_[_0x8d9c('0x8e')](_['map'](_0x44d148,'TeamId'),function(_0x38f953){return _[_0x8d9c('0x2f')](_0x58e221,_0x38f953);});if(_0x11cefe){return _0x170e5c['id'];}}}));}}return BPromise[_0x8d9c('0x8f')](_0x1bc2f3)[_0x8d9c('0x28')](function(_0x54bf0b){_0x112354=_(_0x112354)['union'](_0x54bf0b)[_0x8d9c('0x90')]()[_0x8d9c('0x31')]();return db[_0x8d9c('0x38')][_0x8d9c('0x30')]({'where':{'id':_0x136a88['params']['id']}})[_0x8d9c('0x28')](function(_0x2c6c02){return db['sequelize'][_0x8d9c('0x76')](function(_0x4031fc){return _0x2c6c02['removeTeams'](_0x136a88[_0x8d9c('0x3d')][_0x8d9c('0x84')],{'transaction':_0x4031fc})[_0x8d9c('0x28')](function(){if(!_[_0x8d9c('0x91')](_0x112354)){return _0x2c6c02['removeAgents'](_0x112354,{'transaction':_0x4031fc})['then'](function(){return db[_0x8d9c('0x7c')]['destroy']({'where':{'VoiceQueueId':_0x136a88['params']['id'],'UserId':_0x112354},'transaction':_0x4031fc});});}})[_0x8d9c('0x28')](function(){_0x112354[_0x8d9c('0x73')](function(_0x2047cd){socket[_0x8d9c('0x81')](_0x8d9c('0x92'),{'UserId':_0x2047cd,'VoiceQueueId':_0x2c6c02['id']});});});});});});})['then'](respondWithStatusCode(_0x7d7bcb,null))[_0x8d9c('0x4e')](handleError(_0x7d7bcb,null));};exports[_0x8d9c('0x93')]=function(_0x1704ca,_0x2c5c70,_0x404879){var _0x4f36ea,_0x5b89e9;return db[_0x8d9c('0x38')][_0x8d9c('0x30')]({'where':{'id':_0x1704ca[_0x8d9c('0x50')]['id']}})[_0x8d9c('0x28')](handleEntityNotFound(_0x2c5c70,null))[_0x8d9c('0x28')](function(_0x2e820b){if(_0x2e820b){_0x5b89e9=_0x2e820b;return _0x2e820b[_0x8d9c('0x93')](_0x1704ca[_0x8d9c('0x52')]['ids'],_[_0x8d9c('0x58')](_0x1704ca['body'],[_0x8d9c('0x84'),'id'])||{})[_0x8d9c('0x94')](function(_0x5bb155){for(var _0x530070=0x0;_0x530070<_0x1704ca['body'][_0x8d9c('0x84')][_0x8d9c('0x42')];_0x530070+=0x1){socket[_0x8d9c('0x81')](_0x8d9c('0x82'),{'UserId':Number(_0x1704ca[_0x8d9c('0x52')][_0x8d9c('0x84')][_0x530070]),'VoiceQueueId':Number(_0x1704ca[_0x8d9c('0x50')]['id'])});}return _0x5bb155;});}})[_0x8d9c('0x28')](function(_0x19c8ae){_0x4f36ea=_0x19c8ae||[];if(_0x5b89e9){return db[_0x8d9c('0x6e')][_0x8d9c('0x64')]({'where':{'id':_0x1704ca[_0x8d9c('0x52')]['ids']},'attributes':['id','name','online',_0x8d9c('0x80'),'interface'],'raw':!![]});}})[_0x8d9c('0x28')](function(_0x23e69f){if(!_['isEmpty'](_0x23e69f)){var _0x4b6fee=[];for(var _0x1aae73=0x0;_0x1aae73<_0x23e69f[_0x8d9c('0x42')];_0x1aae73++){if(_0x23e69f[_0x1aae73][_0x8d9c('0x70')]){_0x4b6fee[_0x8d9c('0x8b')](db[_0x8d9c('0x7c')][_0x8d9c('0x78')]({'membername':_0x23e69f[_0x1aae73]['name'],'UserId':_0x23e69f[_0x1aae73]['id'],'queue_name':_0x5b89e9[_0x8d9c('0x32')],'VoiceQueueId':_0x5b89e9['id'],'interface':_['isNil'](_0x23e69f[_0x1aae73][_0x8d9c('0x71')])?util[_0x8d9c('0x7e')](_0x8d9c('0x7f'),_0x23e69f[_0x1aae73][_0x8d9c('0x32')]):_0x23e69f[_0x1aae73][_0x8d9c('0x71')],'paused':_0x23e69f[_0x1aae73][_0x8d9c('0x80')]||![],'penalty':_0x1704ca[_0x8d9c('0x52')][_0x8d9c('0x74')]||0x0}));}}return BPromise[_0x8d9c('0x8f')](_0x4b6fee);}})[_0x8d9c('0x28')](function(){return _0x4f36ea;})[_0x8d9c('0x28')](respondWithResult(_0x2c5c70,null))[_0x8d9c('0x4e')](handleError(_0x2c5c70,null));};exports[_0x8d9c('0x95')]=function(_0xc77948,_0x1649b2,_0x5146e7){return db['VoiceQueue'][_0x8d9c('0x30')]({'where':{'id':_0xc77948[_0x8d9c('0x50')]['id']}})['then'](handleEntityNotFound(_0x1649b2,null))[_0x8d9c('0x28')](function(_0x14bdb2){if(_0x14bdb2){return _0x14bdb2[_0x8d9c('0x95')](_0xc77948[_0x8d9c('0x3d')]['ids'])['then'](function(){if(_['isArray'](_0xc77948[_0x8d9c('0x3d')][_0x8d9c('0x84')])){for(var _0x5ebf39=0x0;_0x5ebf39<_0xc77948[_0x8d9c('0x3d')][_0x8d9c('0x84')]['length'];_0x5ebf39+=0x1){socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0xc77948[_0x8d9c('0x3d')][_0x8d9c('0x84')][_0x5ebf39]),'VoiceQueueId':Number(_0xc77948[_0x8d9c('0x50')]['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0xc77948[_0x8d9c('0x3d')][_0x8d9c('0x84')]),'VoiceQueueId':Number(_0xc77948[_0x8d9c('0x50')]['id'])});}});}})['then'](function(_0xd66d88){return db[_0x8d9c('0x7c')][_0x8d9c('0x29')]({'where':{'VoiceQueueId':_0xc77948['params']['id'],'UserId':_0xc77948['query'][_0x8d9c('0x84')]}})[_0x8d9c('0x28')](function(){return _0xd66d88;});})['then'](respondWithStatusCode(_0x1649b2,null))[_0x8d9c('0x4e')](handleError(_0x1649b2,null));};exports['getAgents']=function(_0x2acb22,_0x58007a,_0x1b78b3){var _0x30124f={};var _0x4df7d6={};var _0x360c67;var _0x1c6938;return db[_0x8d9c('0x38')][_0x8d9c('0x5f')]({'where':{'id':_0x2acb22['params']['id']}})['then'](handleEntityNotFound(_0x58007a,null))['then'](function(_0x5eee15){if(_0x5eee15){_0x360c67=_0x5eee15;_0x4df7d6[_0x8d9c('0x3c')]=_['keys'](db['User'][_0x8d9c('0x39')]);_0x4df7d6[_0x8d9c('0x3d')]=_[_0x8d9c('0x3e')](_0x2acb22[_0x8d9c('0x3d')]);_0x4df7d6[_0x8d9c('0x3f')]=_[_0x8d9c('0x40')](_0x4df7d6['model'],_0x4df7d6['query']);_0x30124f['attributes']=_[_0x8d9c('0x40')](_0x4df7d6[_0x8d9c('0x3c')],qs[_0x8d9c('0x41')](_0x2acb22[_0x8d9c('0x3d')][_0x8d9c('0x41')]));_0x30124f['attributes']=_0x30124f['attributes']['length']?_0x30124f[_0x8d9c('0x43')]:_0x4df7d6[_0x8d9c('0x3c')];_0x30124f[_0x8d9c('0x46')]=qs['sort'](_0x2acb22[_0x8d9c('0x3d')][_0x8d9c('0x61')]);_0x30124f[_0x8d9c('0x47')]=qs[_0x8d9c('0x3f')](_[_0x8d9c('0x68')](_0x2acb22['query'],_0x4df7d6[_0x8d9c('0x3f')]));if(_0x2acb22['query'][_0x8d9c('0x63')]){_0x30124f[_0x8d9c('0x47')]=_[_0x8d9c('0x48')](_0x30124f['where'],{'$or':_['map'](_0x30124f[_0x8d9c('0x43')],function(_0x13abbf){var _0x371427={};_0x371427[_0x13abbf]={'$like':'%'+_0x2acb22['query'][_0x8d9c('0x63')]+'%'};return _0x371427;})});}_0x30124f=_[_0x8d9c('0x48')]({},_0x30124f,_0x2acb22['options']);return _0x360c67[_0x8d9c('0x96')](_0x30124f);}})['then'](function(_0x28a8b4){if(_0x28a8b4){_0x1c6938=_0x28a8b4[_0x8d9c('0x42')];if(!_0x2acb22['query'][_0x8d9c('0x44')]('nolimit')){_0x30124f['limit']=qs[_0x8d9c('0x21')](_0x2acb22['query'][_0x8d9c('0x21')]);_0x30124f[_0x8d9c('0x23')]=qs['offset'](_0x2acb22[_0x8d9c('0x3d')]['offset']);}return _0x360c67[_0x8d9c('0x96')](_0x30124f);}})[_0x8d9c('0x28')](function(_0x52c2bc){if(_0x52c2bc){return _0x52c2bc?{'count':_0x1c6938,'rows':_0x52c2bc}:null;}})[_0x8d9c('0x28')](respondWithResult(_0x58007a,null))[_0x8d9c('0x4e')](handleError(_0x58007a,null));};exports[_0x8d9c('0x97')]=function(_0x52b4cd,_0x126dac,_0x50fe9f){var _0x3c7b72={};var _0x24647d={};var _0x5189f7;var _0x101df3;return db['VoiceQueue']['findOne']({'where':{'id':_0x52b4cd['params']['id']}})['then'](handleEntityNotFound(_0x126dac,null))['then'](function(_0x5534a5){if(_0x5534a5){_0x5189f7=_0x5534a5;_0x24647d['model']=_[_0x8d9c('0x3e')](db[_0x8d9c('0x7c')][_0x8d9c('0x39')]);_0x24647d[_0x8d9c('0x3d')]=_[_0x8d9c('0x3e')](_0x52b4cd[_0x8d9c('0x3d')]);_0x24647d[_0x8d9c('0x3f')]=_['intersection'](_0x24647d[_0x8d9c('0x3c')],_0x24647d[_0x8d9c('0x3d')]);_0x3c7b72[_0x8d9c('0x43')]=_[_0x8d9c('0x40')](_0x24647d['model'],qs[_0x8d9c('0x41')](_0x52b4cd['query'][_0x8d9c('0x41')]));_0x3c7b72[_0x8d9c('0x43')]=_0x3c7b72[_0x8d9c('0x43')][_0x8d9c('0x42')]?_0x3c7b72[_0x8d9c('0x43')]:_0x24647d[_0x8d9c('0x3c')];_0x3c7b72[_0x8d9c('0x46')]=qs[_0x8d9c('0x61')](_0x52b4cd[_0x8d9c('0x3d')][_0x8d9c('0x61')]);_0x3c7b72[_0x8d9c('0x47')]=qs[_0x8d9c('0x3f')](_[_0x8d9c('0x68')](_0x52b4cd[_0x8d9c('0x3d')],_0x24647d[_0x8d9c('0x3f')]));if(_0x52b4cd[_0x8d9c('0x3d')][_0x8d9c('0x63')]){_0x3c7b72['where']=_['merge'](_0x3c7b72[_0x8d9c('0x47')],{'$or':_[_0x8d9c('0x2e')](_0x3c7b72[_0x8d9c('0x43')],function(_0x574582){var _0x37aa8e={};_0x37aa8e[_0x574582]={'$like':'%'+_0x52b4cd[_0x8d9c('0x3d')][_0x8d9c('0x63')]+'%'};return _0x37aa8e;})});}_0x3c7b72=_[_0x8d9c('0x48')]({},_0x3c7b72,_0x52b4cd[_0x8d9c('0x4a')]);return _0x5189f7[_0x8d9c('0x97')](_0x3c7b72);}})['then'](function(_0x4e0d4e){if(_0x4e0d4e){_0x101df3=_0x4e0d4e[_0x8d9c('0x42')];if(!_0x52b4cd[_0x8d9c('0x3d')]['hasOwnProperty'](_0x8d9c('0x45'))){_0x3c7b72[_0x8d9c('0x21')]=qs['limit'](_0x52b4cd[_0x8d9c('0x3d')][_0x8d9c('0x21')]);_0x3c7b72['offset']=qs['offset'](_0x52b4cd[_0x8d9c('0x3d')]['offset']);}return _0x5189f7[_0x8d9c('0x97')](_0x3c7b72);}})[_0x8d9c('0x28')](function(_0x331778){return _0x331778?{'count':_0x101df3,'rows':_0x331778}:null;})[_0x8d9c('0x28')](respondWithResult(_0x126dac,null))[_0x8d9c('0x4e')](handleError(_0x126dac,null));};exports['getLists']=function(_0x55598c,_0x5e79d5,_0x59c9b0){var _0xbea30b={};var _0x8f79df={};var _0x4feb73;var _0x38163c;return db[_0x8d9c('0x38')][_0x8d9c('0x5f')]({'where':{'id':_0x55598c[_0x8d9c('0x50')]['id']}})['then'](handleEntityNotFound(_0x5e79d5,null))['then'](function(_0x276781){if(_0x276781){_0x4feb73=_0x276781;_0x8f79df[_0x8d9c('0x3c')]=_['keys'](db[_0x8d9c('0x98')][_0x8d9c('0x39')]);_0x8f79df[_0x8d9c('0x3d')]=_[_0x8d9c('0x3e')](_0x55598c[_0x8d9c('0x3d')]);_0x8f79df['filters']=_[_0x8d9c('0x40')](_0x8f79df[_0x8d9c('0x3c')],_0x8f79df[_0x8d9c('0x3d')]);_0xbea30b[_0x8d9c('0x43')]=_['intersection'](_0x8f79df[_0x8d9c('0x3c')],qs['fields'](_0x55598c['query'][_0x8d9c('0x41')]));_0xbea30b[_0x8d9c('0x43')]=_0xbea30b[_0x8d9c('0x43')][_0x8d9c('0x42')]?_0xbea30b[_0x8d9c('0x43')]:_0x8f79df[_0x8d9c('0x3c')];_0xbea30b[_0x8d9c('0x46')]=qs['sort'](_0x55598c[_0x8d9c('0x3d')][_0x8d9c('0x61')]);_0xbea30b[_0x8d9c('0x47')]=qs[_0x8d9c('0x3f')](_[_0x8d9c('0x68')](_0x55598c[_0x8d9c('0x3d')],_0x8f79df[_0x8d9c('0x3f')]));if(_0x55598c[_0x8d9c('0x3d')][_0x8d9c('0x63')]){_0xbea30b[_0x8d9c('0x47')]=_[_0x8d9c('0x48')](_0xbea30b['where'],{'$or':_['map'](_0xbea30b[_0x8d9c('0x43')],function(_0x34c4e6){var _0x4be668={};_0x4be668[_0x34c4e6]={'$like':'%'+_0x55598c[_0x8d9c('0x3d')][_0x8d9c('0x63')]+'%'};return _0x4be668;})});}_0xbea30b=_['merge']({},_0xbea30b,_0x55598c['options']);return _0x4feb73[_0x8d9c('0x99')](_0xbea30b);}})[_0x8d9c('0x28')](function(_0x1a4a22){if(_0x1a4a22){_0x38163c=_0x1a4a22[_0x8d9c('0x42')];if(!_0x55598c[_0x8d9c('0x3d')][_0x8d9c('0x44')](_0x8d9c('0x45'))){_0xbea30b[_0x8d9c('0x21')]=qs[_0x8d9c('0x21')](_0x55598c['query'][_0x8d9c('0x21')]);_0xbea30b['offset']=qs['offset'](_0x55598c[_0x8d9c('0x3d')]['offset']);}return _0x4feb73[_0x8d9c('0x99')](_0xbea30b);}})[_0x8d9c('0x28')](function(_0x3eed3c){if(_0x3eed3c){return _0x3eed3c?{'count':_0x38163c,'rows':_0x3eed3c}:null;}})[_0x8d9c('0x28')](respondWithResult(_0x5e79d5,null))['catch'](handleError(_0x5e79d5,null));};exports['addLists']=function(_0x3fcafd,_0x5b1159,_0x1239d7){var _0x3b7181=moment()[_0x8d9c('0x7e')](_0x8d9c('0x9a'));var _0x53d38a,_0x11ebd5;return db['VoiceQueue']['find']({'where':{'id':_0x3fcafd[_0x8d9c('0x50')]['id']}})['then'](handleEntityNotFound(_0x5b1159,null))[_0x8d9c('0x28')](function(_0x478a3b){if(_0x478a3b){_0x11ebd5=_0x478a3b;return _0x478a3b['addLists'](_0x3fcafd['body'][_0x8d9c('0x84')],_[_0x8d9c('0x58')](_0x3fcafd[_0x8d9c('0x52')],[_0x8d9c('0x84'),'id'])||{});}return null;})['spread'](function(_0x1bbccb){var _0x4484b1;_0x53d38a=_0x1bbccb||[];var _0x5c2bb3=[];if(_0x1bbccb){for(var _0x4e4b04=0x0;_0x4e4b04<_0x1bbccb['length'];_0x4e4b04+=0x1){var _0xbe7db2=_0x1bbccb[_0x4e4b04]['get']({'plain':!![]});_0x11ebd5[_0x8d9c('0x9b')]=_0x3fcafd[_0x8d9c('0x52')]['dialCheckDuplicateType']?_0x3fcafd[_0x8d9c('0x52')][_0x8d9c('0x9b')]:_0x11ebd5['dialCheckDuplicateType'];switch(_0x11ebd5[_0x8d9c('0x9b')]){case'always':_0x4484b1=squel[_0x8d9c('0x9c')]()['into'](_0x8d9c('0x9d'))[_0x8d9c('0x9e')]([_0x8d9c('0x9f'),_0x8d9c('0xa0'),_0x8d9c('0xa1'),_0x8d9c('0xa2'),'VoiceQueueId',_0x8d9c('0x59'),_0x8d9c('0x5a')],squel['select']()[_0x8d9c('0xa3')](_0x8d9c('0x9f'),_0x8d9c('0x9f'))[_0x8d9c('0xa3')]('\x27'+_0x3b7181+'\x27',_0x8d9c('0xa0'))[_0x8d9c('0xa3')]('id','ContactId')[_0x8d9c('0xa3')](_0xbe7db2[_0x8d9c('0xa4')][_0x8d9c('0x8c')](),'ListId')[_0x8d9c('0xa3')](_0x3fcafd[_0x8d9c('0x50')]['id'][_0x8d9c('0x8c')](),_0x8d9c('0x62'))[_0x8d9c('0xa3')]('\x27'+_0x3b7181+'\x27',_0x8d9c('0x59'))[_0x8d9c('0xa3')]('\x27'+_0x3b7181+'\x27','updatedAt')['from']('cm_contacts')[_0x8d9c('0x47')](_0x8d9c('0xa5'))[_0x8d9c('0x47')](_0x8d9c('0xa6'),_0xbe7db2[_0x8d9c('0xa4')][_0x8d9c('0x8c')]())['where'](_0x8d9c('0xa7'))[_0x8d9c('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0x8d9c('0x85')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0x8d9c('0xa8')](_0x8d9c('0xa9'))[_0x8d9c('0x47')](_0x8d9c('0x89'),_0x3fcafd[_0x8d9c('0x50')]['id'][_0x8d9c('0x8c')]()))['where'](_0x8d9c('0xaa'),squel[_0x8d9c('0x85')]()['field'](_0x8d9c('0xab'))[_0x8d9c('0xa8')](_0x8d9c('0x9d'))['where'](_0x8d9c('0x89'),_0x3fcafd['params']['id'][_0x8d9c('0x8c')]())))['toString']();break;case'onlyIfOpen':_0x4484b1=squel[_0x8d9c('0x9c')]()['into'](_0x8d9c('0x9d'))[_0x8d9c('0x9e')]([_0x8d9c('0x9f'),_0x8d9c('0xa0'),_0x8d9c('0xa1'),_0x8d9c('0xa2'),_0x8d9c('0x62'),'createdAt',_0x8d9c('0x5a')],squel[_0x8d9c('0x85')]()[_0x8d9c('0xa3')](_0x8d9c('0x9f'),_0x8d9c('0x9f'))[_0x8d9c('0xa3')]('\x27'+_0x3b7181+'\x27',_0x8d9c('0xa0'))['field']('id',_0x8d9c('0xa1'))[_0x8d9c('0xa3')](_0xbe7db2[_0x8d9c('0xa4')][_0x8d9c('0x8c')](),_0x8d9c('0xa2'))[_0x8d9c('0xa3')](_0x3fcafd[_0x8d9c('0x50')]['id']['toString'](),_0x8d9c('0x62'))['field']('\x27'+_0x3b7181+'\x27',_0x8d9c('0x59'))[_0x8d9c('0xa3')]('\x27'+_0x3b7181+'\x27',_0x8d9c('0x5a'))[_0x8d9c('0xa8')](_0x8d9c('0xac'))[_0x8d9c('0x47')](_0x8d9c('0xa5'))[_0x8d9c('0x47')]('ListId\x20=\x20?',_0xbe7db2[_0x8d9c('0xa4')][_0x8d9c('0x8c')]())[_0x8d9c('0x47')](_0x8d9c('0xa7'))['where'](_0x8d9c('0xaa'),squel[_0x8d9c('0x85')]()[_0x8d9c('0xa3')]('COALESCE(phone,\x27\x27)')[_0x8d9c('0xa8')](_0x8d9c('0x9d'))[_0x8d9c('0x47')]('VoiceQueueId\x20=\x20?',_0x3fcafd[_0x8d9c('0x50')]['id'][_0x8d9c('0x8c')]())))['toString']();break;default:_0x4484b1=squel[_0x8d9c('0x9c')]()['into'](_0x8d9c('0x9d'))[_0x8d9c('0x9e')]([_0x8d9c('0x9f'),_0x8d9c('0xa0'),_0x8d9c('0xa1'),'ListId','VoiceQueueId','createdAt',_0x8d9c('0x5a')],squel[_0x8d9c('0x85')]()[_0x8d9c('0xa3')](_0x8d9c('0x9f'),_0x8d9c('0x9f'))[_0x8d9c('0xa3')]('\x27'+_0x3b7181+'\x27',_0x8d9c('0xa0'))[_0x8d9c('0xa3')]('id',_0x8d9c('0xa1'))[_0x8d9c('0xa3')](_0xbe7db2[_0x8d9c('0xa4')]['toString'](),_0x8d9c('0xa2'))[_0x8d9c('0xa3')](_0x3fcafd['params']['id'][_0x8d9c('0x8c')](),_0x8d9c('0x62'))['field']('\x27'+_0x3b7181+'\x27','createdAt')['field']('\x27'+_0x3b7181+'\x27',_0x8d9c('0x5a'))[_0x8d9c('0xa8')](_0x8d9c('0xac'))[_0x8d9c('0x47')](_0x8d9c('0xa5'))[_0x8d9c('0x47')](_0x8d9c('0xa6'),_0xbe7db2[_0x8d9c('0xa4')]['toString']())['where'](_0x8d9c('0xa7')))[_0x8d9c('0x8c')]();}_0x5c2bb3[_0x8d9c('0x8b')](db[_0x8d9c('0x75')]['query'](_0x4484b1));}return BPromise[_0x8d9c('0x8f')](_0x5c2bb3);}})[_0x8d9c('0x28')](function(){var _0xa8bcba=[];var _0x1c3598=squel[_0x8d9c('0x9c')]()[_0x8d9c('0xad')]('cm_hopper_additional_phones')[_0x8d9c('0x9e')]([_0x8d9c('0xae'),'phone',_0x8d9c('0xaf'),_0x8d9c('0x59'),_0x8d9c('0x5a')],squel[_0x8d9c('0x85')]()[_0x8d9c('0xa3')](_0x8d9c('0xb0'))[_0x8d9c('0xa3')](_0x8d9c('0xb1'))['field'](_0x8d9c('0xb2'))[_0x8d9c('0xa3')]('\x27'+_0x3b7181+'\x27','createdAt')[_0x8d9c('0xa3')]('\x27'+_0x3b7181+'\x27',_0x8d9c('0x5a'))['from'](_0x8d9c('0xb3'),'ci')['join'](_0x8d9c('0x9d'),'h','h.ContactId=ci.CmContactId')[_0x8d9c('0x47')]('h.scheduledat=?',_0x3b7181)['where'](_0x8d9c('0xb4'),_0x8d9c('0xb5')))[_0x8d9c('0x8c')]();_0xa8bcba[_0x8d9c('0x8b')](db[_0x8d9c('0x75')]['query'](_0x1c3598));return BPromise[_0x8d9c('0x8f')](_0xa8bcba);})[_0x8d9c('0x28')](function(){return _0x53d38a;})[_0x8d9c('0x28')](respondWithResult(_0x5b1159,null))[_0x8d9c('0x4e')](handleError(_0x5b1159,null));};exports[_0x8d9c('0xb6')]=function(_0x4647eb,_0x5ac9a3,_0x144ce2){return db[_0x8d9c('0x38')][_0x8d9c('0x30')]({'where':{'id':_0x4647eb[_0x8d9c('0x50')]['id']}})['then'](handleEntityNotFound(_0x5ac9a3,null))['then'](function(_0x1031a6){if(_0x1031a6){return _0x1031a6[_0x8d9c('0xb6')](_0x4647eb[_0x8d9c('0x3d')][_0x8d9c('0x84')]);}})[_0x8d9c('0x28')](function(_0x535ffc){if(_0x535ffc){return db[_0x8d9c('0x60')][_0x8d9c('0x29')]({'where':{'ListId':_0x4647eb[_0x8d9c('0x3d')][_0x8d9c('0x84')],'VoiceQueueId':_0x4647eb[_0x8d9c('0x50')]['id']}})[_0x8d9c('0x28')](function(){return _0x535ffc;});}})[_0x8d9c('0x28')](respondWithStatusCode(_0x5ac9a3,null))['catch'](handleError(_0x5ac9a3,null));};exports[_0x8d9c('0xb7')]=function(_0x2201d7,_0x1abf57,_0x31e326){var _0x3f04fd={};var _0x3ec22={};var _0x4d7e0a;var _0x412db5;return db['VoiceQueue'][_0x8d9c('0x5f')]({'where':{'id':_0x2201d7[_0x8d9c('0x50')]['id']}})[_0x8d9c('0x28')](handleEntityNotFound(_0x1abf57,null))['then'](function(_0x3f9e0f){if(_0x3f9e0f){_0x4d7e0a=_0x3f9e0f;_0x3ec22[_0x8d9c('0x3c')]=_[_0x8d9c('0x3e')](db[_0x8d9c('0x98')][_0x8d9c('0x39')]);_0x3ec22[_0x8d9c('0x3d')]=_['keys'](_0x2201d7[_0x8d9c('0x3d')]);_0x3ec22[_0x8d9c('0x3f')]=_[_0x8d9c('0x40')](_0x3ec22[_0x8d9c('0x3c')],_0x3ec22['query']);_0x3f04fd['attributes']=_[_0x8d9c('0x40')](_0x3ec22['model'],qs[_0x8d9c('0x41')](_0x2201d7[_0x8d9c('0x3d')][_0x8d9c('0x41')]));_0x3f04fd['attributes']=_0x3f04fd[_0x8d9c('0x43')][_0x8d9c('0x42')]?_0x3f04fd[_0x8d9c('0x43')]:_0x3ec22[_0x8d9c('0x3c')];_0x3f04fd[_0x8d9c('0x46')]=qs[_0x8d9c('0x61')](_0x2201d7[_0x8d9c('0x3d')][_0x8d9c('0x61')]);_0x3f04fd[_0x8d9c('0x47')]=qs['filters'](_['pick'](_0x2201d7[_0x8d9c('0x3d')],_0x3ec22[_0x8d9c('0x3f')]));if(_0x2201d7[_0x8d9c('0x3d')]['filter']){_0x3f04fd[_0x8d9c('0x47')]=_['merge'](_0x3f04fd['where'],{'$or':_[_0x8d9c('0x2e')](_0x3f04fd['attributes'],function(_0x40cecc){var _0x33847a={};_0x33847a[_0x40cecc]={'$like':'%'+_0x2201d7[_0x8d9c('0x3d')]['filter']+'%'};return _0x33847a;})});}_0x3f04fd=_[_0x8d9c('0x48')]({},_0x3f04fd,_0x2201d7[_0x8d9c('0x4a')]);return _0x4d7e0a[_0x8d9c('0xb7')](_0x3f04fd);}})['then'](function(_0x5d5f2d){if(_0x5d5f2d){_0x412db5=_0x5d5f2d[_0x8d9c('0x42')];if(!_0x2201d7[_0x8d9c('0x3d')]['hasOwnProperty'](_0x8d9c('0x45'))){_0x3f04fd[_0x8d9c('0x21')]=qs['limit'](_0x2201d7['query']['limit']);_0x3f04fd[_0x8d9c('0x23')]=qs[_0x8d9c('0x23')](_0x2201d7[_0x8d9c('0x3d')][_0x8d9c('0x23')]);}return _0x4d7e0a[_0x8d9c('0xb7')](_0x3f04fd);}})['then'](function(_0x5d89c5){if(_0x5d89c5){return _0x5d89c5?{'count':_0x412db5,'rows':_0x5d89c5}:null;}})['then'](respondWithResult(_0x1abf57,null))[_0x8d9c('0x4e')](handleError(_0x1abf57,null));};exports[_0x8d9c('0xb8')]=function(_0x252ddb,_0x423910,_0x2e5bfb){var _0xbe48db,_0x18937d;return db[_0x8d9c('0x38')][_0x8d9c('0x30')]({'where':{'id':_0x252ddb[_0x8d9c('0x50')]['id']}})[_0x8d9c('0x28')](handleEntityNotFound(_0x423910,null))[_0x8d9c('0x28')](function(_0x371fe9){if(_0x371fe9){_0x18937d=_0x371fe9;return _0x371fe9[_0x8d9c('0xb8')](_0x252ddb[_0x8d9c('0x52')]['ids'],_['omit'](_0x252ddb[_0x8d9c('0x52')],[_0x8d9c('0x84'),'id'])||{});}return null;})[_0x8d9c('0x94')](function(_0x7b4c85){var _0x6c3e41;_0xbe48db=_0x7b4c85||[];var _0x4c668f=[];if(_0x7b4c85){for(var _0x5f55b8=0x0;_0x5f55b8<_0x7b4c85[_0x8d9c('0x42')];_0x5f55b8+=0x1){var _0x24e3c3=_0x7b4c85[_0x5f55b8][_0x8d9c('0x55')]({'plain':!![]});_0x6c3e41=squel[_0x8d9c('0x9c')]()['into'](_0x8d9c('0xb9'))[_0x8d9c('0x9e')]([_0x8d9c('0x9f'),_0x8d9c('0xa1'),'ListId',_0x8d9c('0x62'),_0x8d9c('0x59'),_0x8d9c('0x5a')],squel['select']()[_0x8d9c('0xa3')](_0x8d9c('0x9f'),_0x8d9c('0x9f'))[_0x8d9c('0xa3')]('id',_0x8d9c('0xa1'))['field'](_0x24e3c3[_0x8d9c('0xa4')][_0x8d9c('0x8c')](),_0x8d9c('0xa2'))['field'](_0x252ddb[_0x8d9c('0x50')]['id']['toString'](),'VoiceQueueId')[_0x8d9c('0xa3')](_0x8d9c('0xba'),_0x8d9c('0x59'))['field'](_0x8d9c('0xba'),_0x8d9c('0x5a'))[_0x8d9c('0xa8')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x8d9c('0xa6'),_0x24e3c3[_0x8d9c('0xa4')]['toString']())[_0x8d9c('0x47')]('phone\x20IS\x20NOT\x20NULL'))[_0x8d9c('0x8c')]();_0x4c668f['push'](db[_0x8d9c('0x75')][_0x8d9c('0x3d')](_0x6c3e41));}return BPromise[_0x8d9c('0x8f')](_0x4c668f);}})[_0x8d9c('0x28')](function(){return _0xbe48db;})[_0x8d9c('0x28')](respondWithResult(_0x423910,null))[_0x8d9c('0x4e')](handleError(_0x423910,null));};exports[_0x8d9c('0xbb')]=function(_0x449152,_0x98d91,_0x5e1240){return db[_0x8d9c('0x38')][_0x8d9c('0x30')]({'where':{'id':_0x449152['params']['id']}})[_0x8d9c('0x28')](handleEntityNotFound(_0x98d91,null))[_0x8d9c('0x28')](function(_0x2e6dd5){if(_0x2e6dd5){return _0x2e6dd5[_0x8d9c('0xbb')](_0x449152[_0x8d9c('0x3d')]['ids']);}})[_0x8d9c('0x28')](function(_0x511157){if(_0x511157){return db[_0x8d9c('0x6a')][_0x8d9c('0x29')]({'where':{'ListId':_0x449152[_0x8d9c('0x3d')][_0x8d9c('0x84')],'VoiceQueueId':_0x449152['params']['id']}})['then'](function(){return _0x511157;});}})[_0x8d9c('0x28')](respondWithStatusCode(_0x98d91,null))[_0x8d9c('0x4e')](handleError(_0x98d91,null));}; \ No newline at end of file +var _0x297f=['filter','merge','where','VIRTUAL','options','count','includeAll','show','include','VoiceQueue','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','outbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','UserProfileSection','getHoppers','findOne','hasOwnProperty','pick','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','findAll','rows','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','User','Agents','online','voicePause','forEach','penalty','sequelize','addTeams','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','interface','format','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','SIP/%s','all','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','from','cm_contacts','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','deletedAt\x20IS\x20NULL','fromQuery','push','CmHopperId','h.id','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./voiceQueue.socket','sendStatus','end','json','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','get','VoiceQueues','QueueCampaigns','ignore','map','value','includes','find','type','name','UserProfileResource','status','error','stack','index','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x297f,0x1f0));var _0xf297=function(_0x59ae06,_0x5ce74f){_0x59ae06=_0x59ae06-0x0;var _0x155706=_0x297f[_0x59ae06];return _0x155706;};'use strict';var emlformat=require(_0xf297('0x0'));var rimraf=require(_0xf297('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf297('0x2'));var moment=require(_0xf297('0x3'));var BPromise=require(_0xf297('0x4'));var Mustache=require(_0xf297('0x5'));var util=require('util');var path=require(_0xf297('0x6'));var sox=require('sox');var csv=require(_0xf297('0x7'));var ejs=require(_0xf297('0x8'));var fs=require('fs');var fs_extra=require(_0xf297('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf297('0xa'));var jsforce=require(_0xf297('0xb'));var deskjs=require(_0xf297('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf297('0xd'));var Papa=require(_0xf297('0xe'));var Redis=require('ioredis');var authService=require(_0xf297('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf297('0x10'));var hardwareService=require(_0xf297('0x11'));var logger=require(_0xf297('0x12'))('api');var utils=require(_0xf297('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf297('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf297('0x15')](config[_0xf297('0x16')],{'host':_0xf297('0x17'),'port':0x18eb});var socket=require(_0xf297('0x18'))(new Redis(config[_0xf297('0x16')]));require(_0xf297('0x19'))['register'](socket);function respondWithStatusCode(_0xb7647b,_0x28c55b){_0x28c55b=_0x28c55b||0xcc;return function(_0x4c1efa){if(_0x4c1efa){return _0xb7647b[_0xf297('0x1a')](_0x28c55b);}return _0xb7647b['status'](_0x28c55b)[_0xf297('0x1b')]();};}function respondWithResult(_0x12c499,_0x9d767){_0x9d767=_0x9d767||0xc8;return function(_0x4cc9a4){if(_0x4cc9a4){return _0x12c499['status'](_0x9d767)[_0xf297('0x1c')](_0x4cc9a4);}};}function respondWithFilteredResult(_0x1e2a77,_0x55f16f){return function(_0x47d584){if(_0x47d584){var _0x384cbf=typeof _0x55f16f[_0xf297('0x1d')]==='undefined'&&typeof _0x55f16f[_0xf297('0x1e')]===_0xf297('0x1f');var _0x3ccb7=_0x47d584['count'];var _0x1d312d=_0x384cbf?0x0:_0x55f16f[_0xf297('0x1d')];var _0xedddbd=_0x384cbf?_0x47d584['count']:_0x55f16f[_0xf297('0x1d')]+_0x55f16f[_0xf297('0x1e')];var _0x13ec1d;if(_0xedddbd>=_0x3ccb7){_0xedddbd=_0x3ccb7;_0x13ec1d=0xc8;}else{_0x13ec1d=0xce;}_0x1e2a77['status'](_0x13ec1d);return _0x1e2a77[_0xf297('0x20')](_0xf297('0x21'),_0x1d312d+'-'+_0xedddbd+'/'+_0x3ccb7)[_0xf297('0x1c')](_0x47d584);}return null;};}function patchUpdates(_0x4cf7f7){return function(_0x289d89){try{jsonpatch[_0xf297('0x22')](_0x289d89,_0x4cf7f7,!![]);}catch(_0x6721c2){return BPromise[_0xf297('0x23')](_0x6721c2);}return _0x289d89['save']();};}function saveUpdates(_0x27265c,_0x49852a){return function(_0x326fd0){if(_0x326fd0){return _0x326fd0[_0xf297('0x24')](_0x27265c)[_0xf297('0x25')](function(_0x3064dc){return _0x3064dc;});}return null;};}function removeEntity(_0x2bd9a3,_0x5a6335){return function(_0x4af69e){if(_0x4af69e){return _0x4af69e[_0xf297('0x26')]()[_0xf297('0x25')](function(){var _0x73cabe=_0x4af69e[_0xf297('0x27')]({'plain':!![]});var _0x1b9bcd=[{'name':_0xf297('0x28'),'value':'inbound','ignore':![]},{'name':_0xf297('0x29'),'value':'outbound','ignore':![]}];var _0x572c86=_(_0x1b9bcd)['filter'](_0xf297('0x2a'))[_0xf297('0x2b')](_0xf297('0x2c'))[_0xf297('0x2c')]();if(_[_0xf297('0x2d')](_0x572c86,_0x73cabe['type'])){return;}var _0x18458f=_[_0xf297('0x2e')](_0x1b9bcd,['value',_0x73cabe[_0xf297('0x2f')]])[_0xf297('0x30')];return db[_0xf297('0x31')]['destroy']({'where':{'type':_0x18458f,'resourceId':_0x73cabe['id']}})[_0xf297('0x25')](function(){return _0x4af69e;});})[_0xf297('0x25')](function(){_0x2bd9a3[_0xf297('0x32')](0xcc)['end']();});}};}function handleEntityNotFound(_0x453d52,_0x43dfab){return function(_0x4f1623){if(!_0x4f1623){_0x453d52[_0xf297('0x1a')](0x194);}return _0x4f1623;};}function handleError(_0x5b45ec,_0x32c1b4){_0x32c1b4=_0x32c1b4||0x1f4;return function(_0x31a8e7){logger[_0xf297('0x33')](_0x31a8e7[_0xf297('0x34')]);if(_0x31a8e7['name']){delete _0x31a8e7[_0xf297('0x30')];}_0x5b45ec[_0xf297('0x32')](_0x32c1b4)['send'](_0x31a8e7);};}exports[_0xf297('0x35')]=function(_0x6996fb,_0xc913ef){var _0x411dfc={},_0x4dfa29={},_0xa17c9c={'count':0x0,'rows':[]};var _0x3db717=_[_0xf297('0x2b')](db['VoiceQueue'][_0xf297('0x36')],function(_0x1b7b43){return{'name':_0x1b7b43[_0xf297('0x37')],'type':_0x1b7b43[_0xf297('0x2f')][_0xf297('0x38')]};});_0x4dfa29[_0xf297('0x39')]=_[_0xf297('0x2b')](_0x3db717,_0xf297('0x30'));_0x4dfa29['query']=_[_0xf297('0x3a')](_0x6996fb[_0xf297('0x3b')]);_0x4dfa29[_0xf297('0x3c')]=_[_0xf297('0x3d')](_0x4dfa29[_0xf297('0x39')],_0x4dfa29[_0xf297('0x3b')]);_0x411dfc[_0xf297('0x3e')]=_[_0xf297('0x3d')](_0x4dfa29[_0xf297('0x39')],qs[_0xf297('0x3f')](_0x6996fb[_0xf297('0x3b')][_0xf297('0x3f')]));_0x411dfc[_0xf297('0x3e')]=_0x411dfc[_0xf297('0x3e')][_0xf297('0x40')]?_0x411dfc['attributes']:_0x4dfa29[_0xf297('0x39')];if(!_0x6996fb[_0xf297('0x3b')]['hasOwnProperty'](_0xf297('0x41'))){_0x411dfc[_0xf297('0x1e')]=qs[_0xf297('0x1e')](_0x6996fb[_0xf297('0x3b')][_0xf297('0x1e')]);_0x411dfc[_0xf297('0x1d')]=qs['offset'](_0x6996fb['query'][_0xf297('0x1d')]);}_0x411dfc[_0xf297('0x42')]=qs[_0xf297('0x43')](_0x6996fb[_0xf297('0x3b')][_0xf297('0x43')]);_0x411dfc['where']=qs['filters'](_['pick'](_0x6996fb[_0xf297('0x3b')],_0x4dfa29[_0xf297('0x3c')]),_0x3db717);if(_0x6996fb['query'][_0xf297('0x44')]){_0x411dfc['where']=_[_0xf297('0x45')](_0x411dfc[_0xf297('0x46')],{'$or':_[_0xf297('0x2b')](_0x3db717,function(_0x549294){if(_0x549294[_0xf297('0x2f')]!==_0xf297('0x47')){var _0x124c53={};_0x124c53[_0x549294[_0xf297('0x30')]]={'$like':'%'+_0x6996fb[_0xf297('0x3b')][_0xf297('0x44')]+'%'};return _0x124c53;}})});}_0x411dfc=_['merge']({},_0x411dfc,_0x6996fb[_0xf297('0x48')]);var _0x3015d6={'where':_0x411dfc[_0xf297('0x46')]};return db['VoiceQueue']['count'](_0x3015d6)[_0xf297('0x25')](function(_0x57a30d){_0xa17c9c[_0xf297('0x49')]=_0x57a30d;if(_0x6996fb[_0xf297('0x3b')][_0xf297('0x4a')]){_0x411dfc['include']=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0x411dfc);})[_0xf297('0x25')](function(_0x3b2ea8){_0xa17c9c['rows']=_0x3b2ea8;return _0xa17c9c;})[_0xf297('0x25')](respondWithFilteredResult(_0xc913ef,_0x411dfc))['catch'](handleError(_0xc913ef,null));};exports[_0xf297('0x4b')]=function(_0x5df331,_0x3d8630){var _0x5b78ca={'raw':![],'where':{'id':_0x5df331['params']['id']}},_0x1eb901={};_0x1eb901[_0xf297('0x39')]=_[_0xf297('0x3a')](db['VoiceQueue']['rawAttributes']);_0x1eb901['query']=_[_0xf297('0x3a')](_0x5df331[_0xf297('0x3b')]);_0x1eb901[_0xf297('0x3c')]=_[_0xf297('0x3d')](_0x1eb901['model'],_0x1eb901['query']);_0x5b78ca[_0xf297('0x3e')]=_[_0xf297('0x3d')](_0x1eb901[_0xf297('0x39')],qs[_0xf297('0x3f')](_0x5df331[_0xf297('0x3b')]['fields']));_0x5b78ca[_0xf297('0x3e')]=_0x5b78ca[_0xf297('0x3e')][_0xf297('0x40')]?_0x5b78ca[_0xf297('0x3e')]:_0x1eb901['model'];if(_0x5df331[_0xf297('0x3b')][_0xf297('0x4a')]){_0x5b78ca[_0xf297('0x4c')]=[{'all':!![]}];}_0x5b78ca=_['merge']({},_0x5b78ca,_0x5df331[_0xf297('0x48')]);return db[_0xf297('0x4d')][_0xf297('0x2e')](_0x5b78ca)[_0xf297('0x25')](handleEntityNotFound(_0x3d8630,null))[_0xf297('0x25')](respondWithResult(_0x3d8630,null))[_0xf297('0x4e')](handleError(_0x3d8630,null));};exports[_0xf297('0x4f')]=function(_0x201a14,_0x3b22ec){return db['VoiceQueue']['create'](_0x201a14[_0xf297('0x50')],{})[_0xf297('0x25')](function(_0x15f434){var _0x6e821d=_0x201a14[_0xf297('0x51')][_0xf297('0x27')]({'plain':!![]});if(!_0x6e821d)throw new Error(_0xf297('0x52'));if(_0x6e821d[_0xf297('0x53')]===_0xf297('0x51')){var _0x54617d=_0x15f434[_0xf297('0x27')]({'plain':!![]});var _0x22fa0e=[{'name':_0xf297('0x28'),'value':_0xf297('0x54')},{'name':_0xf297('0x29'),'value':_0xf297('0x55')}];var _0x49cefa=_['find'](_0x22fa0e,[_0xf297('0x2c'),_0x54617d[_0xf297('0x2f')]])['name'];return db['UserProfileSection'][_0xf297('0x2e')]({'where':{'name':_0x49cefa,'userProfileId':_0x6e821d[_0xf297('0x56')]},'raw':!![]})[_0xf297('0x25')](function(_0xab4a85){if(_0xab4a85&&_0xab4a85[_0xf297('0x57')]===0x0){return db[_0xf297('0x31')][_0xf297('0x4f')]({'name':_0x54617d['name'],'resourceId':_0x54617d['id'],'type':_0xab4a85['name'],'sectionId':_0xab4a85['id']},{})[_0xf297('0x25')](function(){return _0x15f434;});}else{return _0x15f434;}})[_0xf297('0x4e')](function(_0x319410){logger[_0xf297('0x33')](_0xf297('0x58'),_0x319410);throw _0x319410;});}return _0x15f434;})[_0xf297('0x25')](respondWithResult(_0x3b22ec,0xc9))[_0xf297('0x4e')](handleError(_0x3b22ec,null));};exports[_0xf297('0x59')]=function(_0x1b4820,_0x1e9ae8){var _0x1a6ce8={'where':{'id':_0x1b4820[_0xf297('0x5a')]['id']}},_0x20a09e={};_0x20a09e[_0xf297('0x39')]=_[_0xf297('0x3a')](db[_0xf297('0x4d')][_0xf297('0x36')]);_0x1a6ce8[_0xf297('0x3e')]=_[_0xf297('0x3d')](_0x20a09e['model'],qs[_0xf297('0x3f')](_0x1b4820[_0xf297('0x3b')]['fields']));_0x1a6ce8[_0xf297('0x3e')]=_0x1a6ce8[_0xf297('0x3e')]['length']?_0x1a6ce8[_0xf297('0x3e')]:_0x20a09e['model'];if(_0x1b4820[_0xf297('0x3b')][_0xf297('0x4a')]){_0x1a6ce8[_0xf297('0x4c')]=[{'all':!![]}];}_0x1a6ce8=_['merge']({},_0x1a6ce8,_0x1b4820[_0xf297('0x48')]);return db['VoiceQueue'][_0xf297('0x2e')](_0x1a6ce8)[_0xf297('0x25')](handleEntityNotFound(_0x1e9ae8,null))[_0xf297('0x25')](function(_0x19202b){if(_0x19202b){var _0x562039=_0x19202b[_0xf297('0x27')]({'plain':!![]});_0x562039=qs[_0xf297('0x5b')](_0x562039,['id',_0xf297('0x5c'),_0xf297('0x5d')]);_0x1b4820[_0xf297('0x50')]=_[_0xf297('0x5b')](_0x1b4820[_0xf297('0x50')],['id','createdAt',_0xf297('0x5d')]);return db[_0xf297('0x4d')]['create'](_['merge'](_0x562039,_0x1b4820[_0xf297('0x50')]),{'include':_0x1b4820[_0xf297('0x3b')][_0xf297('0x4a')]?[{'all':!![]}]:undefined})[_0xf297('0x25')](function(_0x481f33){var _0x22b127=_0x1b4820[_0xf297('0x51')]['get']({'plain':!![]});if(!_0x22b127)throw new Error(_0xf297('0x52'));if(_0x22b127[_0xf297('0x53')]===_0xf297('0x51')){var _0x39bc14=_0x481f33[_0xf297('0x27')]({'plain':!![]});var _0x55306e=[{'name':_0xf297('0x28'),'value':_0xf297('0x54')},{'name':_0xf297('0x29'),'value':_0xf297('0x55')}];var _0x45b827=_[_0xf297('0x2e')](_0x55306e,[_0xf297('0x2c'),_0x39bc14[_0xf297('0x2f')]])[_0xf297('0x30')];return db[_0xf297('0x5e')]['find']({'where':{'name':_0x45b827,'userProfileId':_0x22b127[_0xf297('0x56')]},'raw':!![]})['then'](function(_0x4fd391){if(_0x4fd391&&_0x4fd391[_0xf297('0x57')]===0x0){return db[_0xf297('0x31')][_0xf297('0x4f')]({'name':_0x39bc14[_0xf297('0x30')],'resourceId':_0x39bc14['id'],'type':_0x4fd391[_0xf297('0x30')],'sectionId':_0x4fd391['id']},{})[_0xf297('0x25')](function(){return _0x481f33;});}else{return _0x481f33;}})[_0xf297('0x4e')](function(_0x28dc14){logger['error'](_0xf297('0x58'),_0x28dc14);throw _0x28dc14;});}return _0x481f33;});}})['then'](respondWithResult(_0x1e9ae8,0xc9))[_0xf297('0x4e')](handleError(_0x1e9ae8,null));};exports[_0xf297('0x24')]=function(_0x43dddd,_0x16f4b3){if(_0x43dddd['body']['id']){delete _0x43dddd[_0xf297('0x50')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x43dddd[_0xf297('0x5a')]['id']}})[_0xf297('0x25')](handleEntityNotFound(_0x16f4b3,null))[_0xf297('0x25')](saveUpdates(_0x43dddd[_0xf297('0x50')],null))[_0xf297('0x25')](respondWithResult(_0x16f4b3,null))[_0xf297('0x4e')](handleError(_0x16f4b3,null));};exports['destroy']=function(_0x2f67b5,_0x5a7ad0){return db[_0xf297('0x4d')][_0xf297('0x2e')]({'where':{'id':_0x2f67b5[_0xf297('0x5a')]['id']}})[_0xf297('0x25')](handleEntityNotFound(_0x5a7ad0,null))[_0xf297('0x25')](removeEntity(_0x5a7ad0,null))[_0xf297('0x4e')](handleError(_0x5a7ad0,null));};exports[_0xf297('0x5f')]=function(_0x4e140b,_0x58b0fe,_0x32da65){var _0x16bb36={'raw':![],'where':{}};var _0x5b120a={};var _0x57a250={'count':0x0,'rows':[]};return db[_0xf297('0x4d')][_0xf297('0x60')]({'where':{'id':_0x4e140b[_0xf297('0x5a')]['id']}})[_0xf297('0x25')](handleEntityNotFound(_0x58b0fe,null))[_0xf297('0x25')](function(_0x5f5af1){if(_0x5f5af1){_0x5b120a['model']=_[_0xf297('0x3a')](db['CmHopper'][_0xf297('0x36')]);_0x5b120a[_0xf297('0x3b')]=_[_0xf297('0x3a')](_0x4e140b[_0xf297('0x3b')]);_0x5b120a[_0xf297('0x3c')]=_[_0xf297('0x3d')](_0x5b120a[_0xf297('0x39')],_0x5b120a[_0xf297('0x3b')]);_0x16bb36['attributes']=_[_0xf297('0x3d')](_0x5b120a[_0xf297('0x39')],qs[_0xf297('0x3f')](_0x4e140b[_0xf297('0x3b')][_0xf297('0x3f')]));_0x16bb36[_0xf297('0x3e')]=_0x16bb36[_0xf297('0x3e')][_0xf297('0x40')]?_0x16bb36['attributes']:_0x5b120a['model'];if(!_0x4e140b['query'][_0xf297('0x61')](_0xf297('0x41'))){_0x16bb36[_0xf297('0x1e')]=qs[_0xf297('0x1e')](_0x4e140b[_0xf297('0x3b')]['limit']);_0x16bb36[_0xf297('0x1d')]=qs['offset'](_0x4e140b[_0xf297('0x3b')][_0xf297('0x1d')]);}_0x16bb36[_0xf297('0x42')]=qs[_0xf297('0x43')](_0x4e140b[_0xf297('0x3b')][_0xf297('0x43')]);_0x16bb36[_0xf297('0x46')]=qs['filters'](_[_0xf297('0x62')](_0x4e140b[_0xf297('0x3b')],_0x5b120a[_0xf297('0x3c')]));_0x16bb36['where'][_0xf297('0x63')]=_0x5f5af1['id'];if(_0x4e140b[_0xf297('0x3b')][_0xf297('0x44')]){_0x16bb36['where']=_['merge'](_0x16bb36[_0xf297('0x46')],{'$or':_[_0xf297('0x2b')](_0x16bb36['attributes'],function(_0x30df28){var _0x5f4ec4={};_0x5f4ec4[_0x30df28]={'$like':'%'+_0x4e140b[_0xf297('0x3b')][_0xf297('0x44')]+'%'};return _0x5f4ec4;})});}_0x16bb36=_['merge']({},_0x16bb36,_0x4e140b[_0xf297('0x48')]);return db[_0xf297('0x64')]['count']({'where':_0x16bb36[_0xf297('0x46')]})[_0xf297('0x25')](function(_0x8eb23d){_0x57a250[_0xf297('0x49')]=_0x8eb23d;if(_0x4e140b[_0xf297('0x3b')]['includeAll']){_0x16bb36[_0xf297('0x4c')]=[{'all':!![]}];}return db[_0xf297('0x64')]['findAll'](_0x16bb36);})[_0xf297('0x25')](function(_0x2a985b){_0x57a250['rows']=_0x2a985b;return _0x57a250;});}})['then'](respondWithFilteredResult(_0x58b0fe,_0x16bb36))[_0xf297('0x4e')](handleError(_0x58b0fe,null));};exports[_0xf297('0x65')]=function(_0x57fc0b,_0x5408cc,_0x5006c0){var _0x255988={'raw':!![],'where':{}};var _0x4132ba={};var _0x2de5b1={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xf297('0x60')]({'where':{'id':_0x57fc0b['params']['id']}})['then'](handleEntityNotFound(_0x5408cc,null))[_0xf297('0x25')](function(_0x410463){if(_0x410463){_0x4132ba['model']=_[_0xf297('0x3a')](db[_0xf297('0x66')][_0xf297('0x36')]);_0x4132ba[_0xf297('0x3b')]=_['keys'](_0x57fc0b[_0xf297('0x3b')]);_0x4132ba[_0xf297('0x3c')]=_[_0xf297('0x3d')](_0x4132ba['model'],_0x4132ba[_0xf297('0x3b')]);_0x255988[_0xf297('0x3e')]=_[_0xf297('0x3d')](_0x4132ba[_0xf297('0x39')],qs['fields'](_0x57fc0b[_0xf297('0x3b')]['fields']));_0x255988[_0xf297('0x3e')]=_0x255988['attributes']['length']?_0x255988[_0xf297('0x3e')]:_0x4132ba[_0xf297('0x39')];if(!_0x57fc0b['query']['hasOwnProperty'](_0xf297('0x41'))){_0x255988[_0xf297('0x1e')]=qs[_0xf297('0x1e')](_0x57fc0b[_0xf297('0x3b')][_0xf297('0x1e')]);_0x255988[_0xf297('0x1d')]=qs[_0xf297('0x1d')](_0x57fc0b[_0xf297('0x3b')][_0xf297('0x1d')]);}_0x255988['order']=qs['sort'](_0x57fc0b[_0xf297('0x3b')][_0xf297('0x43')]);_0x255988[_0xf297('0x46')]=qs[_0xf297('0x3c')](_['pick'](_0x57fc0b['query'],_0x4132ba[_0xf297('0x3c')]));_0x255988[_0xf297('0x46')][_0xf297('0x63')]=_0x410463['id'];if(_0x57fc0b[_0xf297('0x3b')][_0xf297('0x44')]){_0x255988[_0xf297('0x46')]=_[_0xf297('0x45')](_0x255988[_0xf297('0x46')],{'$or':_[_0xf297('0x2b')](_0x255988[_0xf297('0x3e')],function(_0x440fcc){var _0x507c44={};_0x507c44[_0x440fcc]={'$like':'%'+_0x57fc0b[_0xf297('0x3b')]['filter']+'%'};return _0x507c44;})});}_0x255988=_['merge']({},_0x255988,_0x57fc0b[_0xf297('0x48')]);return db['CmHopperHistory'][_0xf297('0x49')]({'where':_0x255988[_0xf297('0x46')]})[_0xf297('0x25')](function(_0x1f7a8f){_0x2de5b1[_0xf297('0x49')]=_0x1f7a8f;if(_0x57fc0b[_0xf297('0x3b')]['includeAll']){_0x255988[_0xf297('0x4c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xf297('0x67')](_0x255988);})['then'](function(_0x15273e){_0x2de5b1[_0xf297('0x68')]=_0x15273e;return _0x2de5b1;});}})[_0xf297('0x25')](respondWithFilteredResult(_0x5408cc,_0x255988))['catch'](handleError(_0x5408cc,null));};exports['getHopperFinals']=function(_0x1c23a7,_0x447758,_0x5a71c6){var _0x4a533b={'raw':!![],'where':{}};var _0x41afae={};var _0x28b1aa={'count':0x0,'rows':[]};return db[_0xf297('0x4d')][_0xf297('0x60')]({'where':{'id':_0x1c23a7[_0xf297('0x5a')]['id']}})[_0xf297('0x25')](handleEntityNotFound(_0x447758,null))['then'](function(_0x357ec4){if(_0x357ec4){_0x41afae[_0xf297('0x39')]=_[_0xf297('0x3a')](db[_0xf297('0x69')][_0xf297('0x36')]);_0x41afae['query']=_[_0xf297('0x3a')](_0x1c23a7[_0xf297('0x3b')]);_0x41afae[_0xf297('0x3c')]=_[_0xf297('0x3d')](_0x41afae[_0xf297('0x39')],_0x41afae['query']);_0x4a533b[_0xf297('0x3e')]=_[_0xf297('0x3d')](_0x41afae[_0xf297('0x39')],qs[_0xf297('0x3f')](_0x1c23a7['query'][_0xf297('0x3f')]));_0x4a533b[_0xf297('0x3e')]=_0x4a533b['attributes'][_0xf297('0x40')]?_0x4a533b['attributes']:_0x41afae[_0xf297('0x39')];if(!_0x1c23a7['query'][_0xf297('0x61')]('nolimit')){_0x4a533b[_0xf297('0x1e')]=qs[_0xf297('0x1e')](_0x1c23a7[_0xf297('0x3b')][_0xf297('0x1e')]);_0x4a533b[_0xf297('0x1d')]=qs[_0xf297('0x1d')](_0x1c23a7[_0xf297('0x3b')][_0xf297('0x1d')]);}_0x4a533b['order']=qs[_0xf297('0x43')](_0x1c23a7['query'][_0xf297('0x43')]);_0x4a533b[_0xf297('0x46')]=qs[_0xf297('0x3c')](_[_0xf297('0x62')](_0x1c23a7[_0xf297('0x3b')],_0x41afae[_0xf297('0x3c')]));_0x4a533b[_0xf297('0x46')][_0xf297('0x63')]=_0x357ec4['id'];if(_0x1c23a7['query'][_0xf297('0x44')]){_0x4a533b[_0xf297('0x46')]=_[_0xf297('0x45')](_0x4a533b[_0xf297('0x46')],{'$or':_[_0xf297('0x2b')](_0x4a533b['attributes'],function(_0x57c291){var _0x35b552={};_0x35b552[_0x57c291]={'$like':'%'+_0x1c23a7[_0xf297('0x3b')][_0xf297('0x44')]+'%'};return _0x35b552;})});}_0x4a533b=_['merge']({},_0x4a533b,_0x1c23a7[_0xf297('0x48')]);return db[_0xf297('0x69')][_0xf297('0x49')]({'where':_0x4a533b[_0xf297('0x46')]})['then'](function(_0x25ca3b){_0x28b1aa[_0xf297('0x49')]=_0x25ca3b;if(_0x1c23a7[_0xf297('0x3b')][_0xf297('0x4a')]){_0x4a533b[_0xf297('0x4c')]=[{'all':!![]}];}return db[_0xf297('0x69')][_0xf297('0x67')](_0x4a533b);})[_0xf297('0x25')](function(_0x194889){_0x28b1aa['rows']=_0x194889;return _0x28b1aa;});}})[_0xf297('0x25')](respondWithFilteredResult(_0x447758,_0x4a533b))[_0xf297('0x4e')](handleError(_0x447758,null));};exports[_0xf297('0x6a')]=function(_0x583814,_0x215267,_0x388e76){var _0x35e476={'raw':!![],'where':{}};var _0x1b0d85={};var _0x2c59e6={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xf297('0x60')]({'where':{'id':_0x583814['params']['id']}})['then'](handleEntityNotFound(_0x215267,null))[_0xf297('0x25')](function(_0x14c09c){if(_0x14c09c){_0x1b0d85[_0xf297('0x39')]=_[_0xf297('0x3a')](db[_0xf297('0x6b')]['rawAttributes']);_0x1b0d85[_0xf297('0x3b')]=_[_0xf297('0x3a')](_0x583814[_0xf297('0x3b')]);_0x1b0d85[_0xf297('0x3c')]=_[_0xf297('0x3d')](_0x1b0d85[_0xf297('0x39')],_0x1b0d85[_0xf297('0x3b')]);_0x35e476[_0xf297('0x3e')]=_['intersection'](_0x1b0d85['model'],qs[_0xf297('0x3f')](_0x583814[_0xf297('0x3b')][_0xf297('0x3f')]));_0x35e476['attributes']=_0x35e476[_0xf297('0x3e')][_0xf297('0x40')]?_0x35e476[_0xf297('0x3e')]:_0x1b0d85['model'];if(!_0x583814[_0xf297('0x3b')][_0xf297('0x61')](_0xf297('0x41'))){_0x35e476['limit']=qs[_0xf297('0x1e')](_0x583814['query'][_0xf297('0x1e')]);_0x35e476['offset']=qs['offset'](_0x583814['query'][_0xf297('0x1d')]);}_0x35e476[_0xf297('0x42')]=qs[_0xf297('0x43')](_0x583814[_0xf297('0x3b')]['sort']);_0x35e476[_0xf297('0x46')]=qs[_0xf297('0x3c')](_['pick'](_0x583814[_0xf297('0x3b')],_0x1b0d85['filters']));_0x35e476[_0xf297('0x46')][_0xf297('0x63')]=_0x14c09c['id'];if(_0x583814[_0xf297('0x3b')][_0xf297('0x44')]){_0x35e476[_0xf297('0x46')]=_[_0xf297('0x45')](_0x35e476[_0xf297('0x46')],{'$or':_[_0xf297('0x2b')](_0x35e476[_0xf297('0x3e')],function(_0x5a6b18){var _0xbb675a={};_0xbb675a[_0x5a6b18]={'$like':'%'+_0x583814[_0xf297('0x3b')][_0xf297('0x44')]+'%'};return _0xbb675a;})});}_0x35e476=_[_0xf297('0x45')]({},_0x35e476,_0x583814['options']);return db[_0xf297('0x6b')][_0xf297('0x49')]({'where':_0x35e476[_0xf297('0x46')]})[_0xf297('0x25')](function(_0x4096e0){_0x2c59e6[_0xf297('0x49')]=_0x4096e0;if(_0x583814[_0xf297('0x3b')][_0xf297('0x4a')]){_0x35e476[_0xf297('0x4c')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x35e476);})['then'](function(_0x50adfb){_0x2c59e6['rows']=_0x50adfb;return _0x2c59e6;});}})['then'](respondWithFilteredResult(_0x215267,_0x35e476))['catch'](handleError(_0x215267,null));};exports[_0xf297('0x6c')]=function(_0x3f41db,_0x1404fc,_0x4e4b4d){var _0x5e8fda={};var _0x1757ac={};var _0x58861a;var _0x625d9f;return db[_0xf297('0x4d')][_0xf297('0x60')]({'where':{'id':_0x3f41db[_0xf297('0x5a')]['id']}})[_0xf297('0x25')](handleEntityNotFound(_0x1404fc,null))[_0xf297('0x25')](function(_0x4189a4){if(_0x4189a4){_0x58861a=_0x4189a4;_0x1757ac['model']=_['keys'](db[_0xf297('0x6d')][_0xf297('0x36')]);_0x1757ac[_0xf297('0x3b')]=_[_0xf297('0x3a')](_0x3f41db[_0xf297('0x3b')]);_0x1757ac[_0xf297('0x3c')]=_[_0xf297('0x3d')](_0x1757ac[_0xf297('0x39')],_0x1757ac['query']);_0x5e8fda['attributes']=_[_0xf297('0x3d')](_0x1757ac[_0xf297('0x39')],qs['fields'](_0x3f41db['query'][_0xf297('0x3f')]));_0x5e8fda[_0xf297('0x3e')]=_0x5e8fda['attributes'][_0xf297('0x40')]?_0x5e8fda[_0xf297('0x3e')]:_0x1757ac[_0xf297('0x39')];_0x5e8fda[_0xf297('0x42')]=qs[_0xf297('0x43')](_0x3f41db['query']['sort']);_0x5e8fda[_0xf297('0x46')]=qs['filters'](_['pick'](_0x3f41db['query'],_0x1757ac[_0xf297('0x3c')]));if(_0x3f41db['query'][_0xf297('0x44')]){_0x5e8fda[_0xf297('0x46')]=_[_0xf297('0x45')](_0x5e8fda[_0xf297('0x46')],{'$or':_['map'](_0x5e8fda[_0xf297('0x3e')],function(_0x31294f){var _0x143bfb={};_0x143bfb[_0x31294f]={'$like':'%'+_0x3f41db[_0xf297('0x3b')][_0xf297('0x44')]+'%'};return _0x143bfb;})});}_0x5e8fda=_[_0xf297('0x45')]({},_0x5e8fda,_0x3f41db['options']);return _0x58861a[_0xf297('0x6c')](_0x5e8fda);}})[_0xf297('0x25')](function(_0x31b3a3){if(_0x31b3a3){_0x625d9f=_0x31b3a3[_0xf297('0x40')];if(!_0x3f41db[_0xf297('0x3b')][_0xf297('0x61')](_0xf297('0x41'))){_0x5e8fda[_0xf297('0x1e')]=qs[_0xf297('0x1e')](_0x3f41db[_0xf297('0x3b')][_0xf297('0x1e')]);_0x5e8fda[_0xf297('0x1d')]=qs['offset'](_0x3f41db[_0xf297('0x3b')]['offset']);}return _0x58861a[_0xf297('0x6c')](_0x5e8fda);}})['then'](function(_0xde8f3e){if(_0xde8f3e){return _0xde8f3e?{'count':_0x625d9f,'rows':_0xde8f3e}:null;}})[_0xf297('0x25')](respondWithResult(_0x1404fc,null))[_0xf297('0x4e')](handleError(_0x1404fc,null));};exports['addTeams']=function(_0x3bff5f,_0x117258,_0x1c17fd){var _0xc9651f=_0x3bff5f[_0xf297('0x50')]['teams'];var _0x54ba7c=_[_0xf297('0x2b')](_0xc9651f,'id');return db[_0xf297('0x6d')]['findAll']({'where':{'id':_0x54ba7c},'attributes':['id'],'include':[{'model':db[_0xf297('0x6e')],'as':_0xf297('0x6f'),'attributes':['id',_0xf297('0x30'),_0xf297('0x70'),_0xf297('0x71'),'interface'],'raw':!![]}]})['then'](function(_0x1815c){if(_0x1815c){var _0x3eb04c=_['flatMap'](_0x1815c,function(_0x20e4a5){var _0x2fbd09=_0x20e4a5[_0xf297('0x27')]({'plain':!![]});_0x2fbd09[_0xf297('0x6f')][_0xf297('0x72')](function(_0xe2760b){_0xe2760b[_0xf297('0x73')]=_[_0xf297('0x2e')](_0xc9651f,{'id':_0x2fbd09['id']})[_0xf297('0x73')];});return _0x2fbd09['Agents'];});return db['VoiceQueue'][_0xf297('0x2e')]({'where':{'id':_0x3bff5f['params']['id']}})['then'](function(_0x43c9b3){return db[_0xf297('0x74')]['transaction'](function(_0x683e02){return _0x43c9b3[_0xf297('0x75')](_0x54ba7c,{'transaction':_0x683e02})[_0xf297('0x25')](function(){return BPromise[_0xf297('0x76')](_0xc9651f,function(_0x2a7db9){return db['TeamVoiceQueue'][_0xf297('0x77')]({'TeamId':_0x2a7db9['id'],'VoiceQueueId':_0x3bff5f[_0xf297('0x5a')]['id'],'penalty':_0x2a7db9[_0xf297('0x73')]},{'transaction':_0x683e02});});})['then'](function(){return BPromise[_0xf297('0x76')](_0x3eb04c,function(_0x121bdd){return db[_0xf297('0x78')][_0xf297('0x79')]({'where':{'UserId':_0x121bdd['id'],'VoiceQueueId':_0x3bff5f[_0xf297('0x5a')]['id']},'defaults':{'penalty':_0x121bdd[_0xf297('0x73')]},'transaction':_0x683e02});});})['then'](function(){return BPromise[_0xf297('0x76')](_[_0xf297('0x44')](_0x3eb04c,{'online':!![]}),function(_0x175487){return db[_0xf297('0x7a')]['upsert']({'membername':_0x175487[_0xf297('0x30')],'UserId':_0x175487['id'],'queue_name':_0x43c9b3['name'],'VoiceQueueId':_0x43c9b3['id'],'interface':_[_0xf297('0x7b')](_0x175487[_0xf297('0x7c')])?util[_0xf297('0x7d')]('SIP/%s',_0x175487[_0xf297('0x30')]):_0x175487['interface'],'paused':_0x175487['voicePause']||![],'penalty':_0x175487[_0xf297('0x73')]},{'transaction':_0x683e02});});})[_0xf297('0x25')](function(){_0x3eb04c[_0xf297('0x72')](function(_0x10a0df){socket[_0xf297('0x7e')](_0xf297('0x7f'),{'UserId':_0x10a0df['id'],'VoiceQueueId':_0x43c9b3['id']});});});});});}})['then'](respondWithStatusCode(_0x117258,null))[_0xf297('0x4e')](handleError(_0x117258,null));};exports[_0xf297('0x80')]=function(_0x1d8ac1,_0x3c71ff,_0x541762){return db[_0xf297('0x6d')]['findAll']({'where':{'id':_0x1d8ac1[_0xf297('0x3b')][_0xf297('0x81')]},'attributes':['id'],'include':[{'model':db[_0xf297('0x6e')],'as':_0xf297('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xf297('0x25')](handleEntityNotFound(_0x3c71ff,null))[_0xf297('0x25')](function(_0x5d1603){var _0x5c3767=_[_0xf297('0x2b')](_0x5d1603,'id');var _0x299bb7=[];var _0x56385c=[];var _0x361279=squel[_0xf297('0x82')]();_0x361279[_0xf297('0x83')](_0xf297('0x84'))['from']('team_has_voice_queues','tq')[_0xf297('0x85')](_0xf297('0x86'),'ut',_0xf297('0x87'))[_0xf297('0x46')](_0xf297('0x88'),_0x1d8ac1[_0xf297('0x5a')]['id']);for(var _0x14e39a=0x0;_0x14e39a<_0x5d1603[_0xf297('0x40')];_0x14e39a+=0x1){let _0x2cb0c4=_0x5d1603[_0x14e39a];for(var _0x4887f1=0x0;_0x4887f1<_0x2cb0c4[_0xf297('0x6f')]['length'];_0x4887f1+=0x1){let _0x49ef2a=_0x2cb0c4[_0xf297('0x6f')][_0x4887f1];var _0x29fc43=_0x361279[_0xf297('0x59')]();_0x29fc43['where'](_0xf297('0x89'),_0x49ef2a['id']);_0x56385c['push'](db['sequelize'][_0xf297('0x3b')](_0x29fc43[_0xf297('0x8a')](),{'type':db[_0xf297('0x74')][_0xf297('0x8b')]['SELECT']})[_0xf297('0x25')](function(_0x5b99cc){if(_0x5b99cc[_0xf297('0x40')]===0x1){return _0x49ef2a['id'];}else{var _0xf12d48=_[_0xf297('0x8c')](_['map'](_0x5b99cc,_0xf297('0x8d')),function(_0x561fab){return _[_0xf297('0x2d')](_0x5c3767,_0x561fab);});if(_0xf12d48){return _0x49ef2a['id'];}}}));}}return BPromise['all'](_0x56385c)[_0xf297('0x25')](function(_0x2eb5f8){_0x299bb7=_(_0x299bb7)['union'](_0x2eb5f8)['compact']()[_0xf297('0x2c')]();return db['VoiceQueue'][_0xf297('0x2e')]({'where':{'id':_0x1d8ac1[_0xf297('0x5a')]['id']}})[_0xf297('0x25')](function(_0x22d5b9){return db[_0xf297('0x74')][_0xf297('0x8e')](function(_0x57d5d5){return _0x22d5b9[_0xf297('0x80')](_0x1d8ac1[_0xf297('0x3b')][_0xf297('0x81')],{'transaction':_0x57d5d5})[_0xf297('0x25')](function(){if(!_[_0xf297('0x8f')](_0x299bb7)){return _0x22d5b9[_0xf297('0x90')](_0x299bb7,{'transaction':_0x57d5d5})[_0xf297('0x25')](function(){return db['UserVoiceQueueRt'][_0xf297('0x26')]({'where':{'VoiceQueueId':_0x1d8ac1['params']['id'],'UserId':_0x299bb7},'transaction':_0x57d5d5});});}})['then'](function(){_0x299bb7['forEach'](function(_0x29d18c){socket[_0xf297('0x7e')](_0xf297('0x91'),{'UserId':_0x29d18c,'VoiceQueueId':_0x22d5b9['id']});});});});});});})[_0xf297('0x25')](respondWithStatusCode(_0x3c71ff,null))[_0xf297('0x4e')](handleError(_0x3c71ff,null));};exports[_0xf297('0x92')]=function(_0x15b32c,_0x58aad5,_0xff366d){var _0x586557,_0xd31568;return db[_0xf297('0x4d')][_0xf297('0x2e')]({'where':{'id':_0x15b32c[_0xf297('0x5a')]['id']}})[_0xf297('0x25')](handleEntityNotFound(_0x58aad5,null))[_0xf297('0x25')](function(_0x53b7e2){if(_0x53b7e2){_0xd31568=_0x53b7e2;return _0x53b7e2[_0xf297('0x92')](_0x15b32c[_0xf297('0x50')]['ids'],_[_0xf297('0x5b')](_0x15b32c[_0xf297('0x50')],[_0xf297('0x81'),'id'])||{})[_0xf297('0x93')](function(_0x4ef372){for(var _0x18c842=0x0;_0x18c842<_0x15b32c[_0xf297('0x50')][_0xf297('0x81')][_0xf297('0x40')];_0x18c842+=0x1){socket[_0xf297('0x7e')](_0xf297('0x7f'),{'UserId':Number(_0x15b32c[_0xf297('0x50')][_0xf297('0x81')][_0x18c842]),'VoiceQueueId':Number(_0x15b32c[_0xf297('0x5a')]['id'])});}return _0x4ef372;});}})[_0xf297('0x25')](function(_0x86b510){_0x586557=_0x86b510||[];if(_0xd31568){return db[_0xf297('0x6e')][_0xf297('0x67')]({'where':{'id':_0x15b32c[_0xf297('0x50')][_0xf297('0x81')]},'attributes':['id','name',_0xf297('0x70'),'voicePause','interface'],'raw':!![]});}})[_0xf297('0x25')](function(_0xbaf44c){if(!_[_0xf297('0x8f')](_0xbaf44c)){var _0x56be80=[];for(var _0x2fb9ae=0x0;_0x2fb9ae<_0xbaf44c[_0xf297('0x40')];_0x2fb9ae++){if(_0xbaf44c[_0x2fb9ae][_0xf297('0x70')]){_0x56be80['push'](db[_0xf297('0x7a')]['upsert']({'membername':_0xbaf44c[_0x2fb9ae][_0xf297('0x30')],'UserId':_0xbaf44c[_0x2fb9ae]['id'],'queue_name':_0xd31568['name'],'VoiceQueueId':_0xd31568['id'],'interface':_['isNil'](_0xbaf44c[_0x2fb9ae][_0xf297('0x7c')])?util[_0xf297('0x7d')](_0xf297('0x94'),_0xbaf44c[_0x2fb9ae][_0xf297('0x30')]):_0xbaf44c[_0x2fb9ae][_0xf297('0x7c')],'paused':_0xbaf44c[_0x2fb9ae][_0xf297('0x71')]||![],'penalty':_0x15b32c[_0xf297('0x50')][_0xf297('0x73')]||0x0}));}}return BPromise[_0xf297('0x95')](_0x56be80);}})[_0xf297('0x25')](function(){return _0x586557;})[_0xf297('0x25')](respondWithResult(_0x58aad5,null))[_0xf297('0x4e')](handleError(_0x58aad5,null));};exports[_0xf297('0x90')]=function(_0x4c542f,_0x2f2ee9,_0x226740){return db[_0xf297('0x4d')][_0xf297('0x2e')]({'where':{'id':_0x4c542f[_0xf297('0x5a')]['id']}})[_0xf297('0x25')](handleEntityNotFound(_0x2f2ee9,null))['then'](function(_0x333e96){if(_0x333e96){return _0x333e96[_0xf297('0x90')](_0x4c542f[_0xf297('0x3b')][_0xf297('0x81')])[_0xf297('0x25')](function(){if(_[_0xf297('0x96')](_0x4c542f[_0xf297('0x3b')][_0xf297('0x81')])){for(var _0x4f501c=0x0;_0x4f501c<_0x4c542f[_0xf297('0x3b')]['ids'][_0xf297('0x40')];_0x4f501c+=0x1){socket[_0xf297('0x7e')](_0xf297('0x91'),{'UserId':Number(_0x4c542f[_0xf297('0x3b')][_0xf297('0x81')][_0x4f501c]),'VoiceQueueId':Number(_0x4c542f['params']['id'])});}}else{socket['emit'](_0xf297('0x91'),{'UserId':Number(_0x4c542f[_0xf297('0x3b')][_0xf297('0x81')]),'VoiceQueueId':Number(_0x4c542f[_0xf297('0x5a')]['id'])});}});}})[_0xf297('0x25')](function(_0x519ccf){return db[_0xf297('0x7a')]['destroy']({'where':{'VoiceQueueId':_0x4c542f[_0xf297('0x5a')]['id'],'UserId':_0x4c542f[_0xf297('0x3b')][_0xf297('0x81')]}})['then'](function(){return _0x519ccf;});})[_0xf297('0x25')](respondWithStatusCode(_0x2f2ee9,null))[_0xf297('0x4e')](handleError(_0x2f2ee9,null));};exports[_0xf297('0x97')]=function(_0x3c6d13,_0x1e9ea6,_0x4bd095){var _0x4160d0={};var _0x526c41={};var _0x59b44d;var _0x2f8fa7;return db[_0xf297('0x4d')][_0xf297('0x60')]({'where':{'id':_0x3c6d13[_0xf297('0x5a')]['id']}})[_0xf297('0x25')](handleEntityNotFound(_0x1e9ea6,null))[_0xf297('0x25')](function(_0xb59cee){if(_0xb59cee){_0x59b44d=_0xb59cee;_0x526c41[_0xf297('0x39')]=_[_0xf297('0x3a')](db[_0xf297('0x6e')][_0xf297('0x36')]);_0x526c41[_0xf297('0x3b')]=_[_0xf297('0x3a')](_0x3c6d13[_0xf297('0x3b')]);_0x526c41[_0xf297('0x3c')]=_[_0xf297('0x3d')](_0x526c41[_0xf297('0x39')],_0x526c41[_0xf297('0x3b')]);_0x4160d0[_0xf297('0x3e')]=_[_0xf297('0x3d')](_0x526c41[_0xf297('0x39')],qs[_0xf297('0x3f')](_0x3c6d13['query'][_0xf297('0x3f')]));_0x4160d0[_0xf297('0x3e')]=_0x4160d0[_0xf297('0x3e')][_0xf297('0x40')]?_0x4160d0[_0xf297('0x3e')]:_0x526c41['model'];_0x4160d0[_0xf297('0x42')]=qs[_0xf297('0x43')](_0x3c6d13[_0xf297('0x3b')][_0xf297('0x43')]);_0x4160d0['where']=qs[_0xf297('0x3c')](_['pick'](_0x3c6d13[_0xf297('0x3b')],_0x526c41[_0xf297('0x3c')]));if(_0x3c6d13['query'][_0xf297('0x44')]){_0x4160d0['where']=_['merge'](_0x4160d0[_0xf297('0x46')],{'$or':_[_0xf297('0x2b')](_0x4160d0['attributes'],function(_0x172350){var _0xdfccc7={};_0xdfccc7[_0x172350]={'$like':'%'+_0x3c6d13[_0xf297('0x3b')][_0xf297('0x44')]+'%'};return _0xdfccc7;})});}_0x4160d0=_[_0xf297('0x45')]({},_0x4160d0,_0x3c6d13[_0xf297('0x48')]);return _0x59b44d[_0xf297('0x97')](_0x4160d0);}})[_0xf297('0x25')](function(_0x157fb6){if(_0x157fb6){_0x2f8fa7=_0x157fb6[_0xf297('0x40')];if(!_0x3c6d13['query'][_0xf297('0x61')]('nolimit')){_0x4160d0[_0xf297('0x1e')]=qs[_0xf297('0x1e')](_0x3c6d13[_0xf297('0x3b')]['limit']);_0x4160d0[_0xf297('0x1d')]=qs[_0xf297('0x1d')](_0x3c6d13[_0xf297('0x3b')][_0xf297('0x1d')]);}return _0x59b44d[_0xf297('0x97')](_0x4160d0);}})[_0xf297('0x25')](function(_0x3b8303){if(_0x3b8303){return _0x3b8303?{'count':_0x2f8fa7,'rows':_0x3b8303}:null;}})['then'](respondWithResult(_0x1e9ea6,null))[_0xf297('0x4e')](handleError(_0x1e9ea6,null));};exports[_0xf297('0x98')]=function(_0x337917,_0x281594,_0x3ddfba){var _0x3ca7bb={};var _0x2f259f={};var _0x2fa321;var _0x45a37a;return db[_0xf297('0x4d')][_0xf297('0x60')]({'where':{'id':_0x337917[_0xf297('0x5a')]['id']}})[_0xf297('0x25')](handleEntityNotFound(_0x281594,null))['then'](function(_0x1546cd){if(_0x1546cd){_0x2fa321=_0x1546cd;_0x2f259f[_0xf297('0x39')]=_[_0xf297('0x3a')](db[_0xf297('0x7a')][_0xf297('0x36')]);_0x2f259f['query']=_[_0xf297('0x3a')](_0x337917[_0xf297('0x3b')]);_0x2f259f[_0xf297('0x3c')]=_[_0xf297('0x3d')](_0x2f259f[_0xf297('0x39')],_0x2f259f[_0xf297('0x3b')]);_0x3ca7bb['attributes']=_[_0xf297('0x3d')](_0x2f259f['model'],qs[_0xf297('0x3f')](_0x337917[_0xf297('0x3b')]['fields']));_0x3ca7bb[_0xf297('0x3e')]=_0x3ca7bb[_0xf297('0x3e')]['length']?_0x3ca7bb[_0xf297('0x3e')]:_0x2f259f[_0xf297('0x39')];_0x3ca7bb['order']=qs[_0xf297('0x43')](_0x337917[_0xf297('0x3b')]['sort']);_0x3ca7bb[_0xf297('0x46')]=qs[_0xf297('0x3c')](_['pick'](_0x337917[_0xf297('0x3b')],_0x2f259f[_0xf297('0x3c')]));if(_0x337917['query'][_0xf297('0x44')]){_0x3ca7bb['where']=_['merge'](_0x3ca7bb[_0xf297('0x46')],{'$or':_[_0xf297('0x2b')](_0x3ca7bb[_0xf297('0x3e')],function(_0x27bad7){var _0x4edf87={};_0x4edf87[_0x27bad7]={'$like':'%'+_0x337917['query']['filter']+'%'};return _0x4edf87;})});}_0x3ca7bb=_[_0xf297('0x45')]({},_0x3ca7bb,_0x337917['options']);return _0x2fa321[_0xf297('0x98')](_0x3ca7bb);}})[_0xf297('0x25')](function(_0x46b813){if(_0x46b813){_0x45a37a=_0x46b813[_0xf297('0x40')];if(!_0x337917[_0xf297('0x3b')][_0xf297('0x61')](_0xf297('0x41'))){_0x3ca7bb[_0xf297('0x1e')]=qs[_0xf297('0x1e')](_0x337917['query'][_0xf297('0x1e')]);_0x3ca7bb[_0xf297('0x1d')]=qs[_0xf297('0x1d')](_0x337917[_0xf297('0x3b')][_0xf297('0x1d')]);}return _0x2fa321[_0xf297('0x98')](_0x3ca7bb);}})[_0xf297('0x25')](function(_0x4fd7c3){return _0x4fd7c3?{'count':_0x45a37a,'rows':_0x4fd7c3}:null;})[_0xf297('0x25')](respondWithResult(_0x281594,null))['catch'](handleError(_0x281594,null));};exports[_0xf297('0x99')]=function(_0xd5d1b0,_0xdebe6c,_0x49f99){var _0x3aff11={};var _0x1a9af9={};var _0x27c8a4;var _0x581828;return db[_0xf297('0x4d')][_0xf297('0x60')]({'where':{'id':_0xd5d1b0['params']['id']}})[_0xf297('0x25')](handleEntityNotFound(_0xdebe6c,null))['then'](function(_0x51c0d7){if(_0x51c0d7){_0x27c8a4=_0x51c0d7;_0x1a9af9[_0xf297('0x39')]=_[_0xf297('0x3a')](db[_0xf297('0x9a')][_0xf297('0x36')]);_0x1a9af9[_0xf297('0x3b')]=_[_0xf297('0x3a')](_0xd5d1b0[_0xf297('0x3b')]);_0x1a9af9[_0xf297('0x3c')]=_[_0xf297('0x3d')](_0x1a9af9[_0xf297('0x39')],_0x1a9af9[_0xf297('0x3b')]);_0x3aff11[_0xf297('0x3e')]=_[_0xf297('0x3d')](_0x1a9af9['model'],qs[_0xf297('0x3f')](_0xd5d1b0[_0xf297('0x3b')][_0xf297('0x3f')]));_0x3aff11[_0xf297('0x3e')]=_0x3aff11[_0xf297('0x3e')][_0xf297('0x40')]?_0x3aff11['attributes']:_0x1a9af9['model'];_0x3aff11['order']=qs['sort'](_0xd5d1b0['query'][_0xf297('0x43')]);_0x3aff11[_0xf297('0x46')]=qs[_0xf297('0x3c')](_[_0xf297('0x62')](_0xd5d1b0['query'],_0x1a9af9['filters']));if(_0xd5d1b0[_0xf297('0x3b')]['filter']){_0x3aff11[_0xf297('0x46')]=_[_0xf297('0x45')](_0x3aff11['where'],{'$or':_[_0xf297('0x2b')](_0x3aff11['attributes'],function(_0x4ed751){var _0x5e417e={};_0x5e417e[_0x4ed751]={'$like':'%'+_0xd5d1b0['query'][_0xf297('0x44')]+'%'};return _0x5e417e;})});}_0x3aff11=_['merge']({},_0x3aff11,_0xd5d1b0['options']);return _0x27c8a4['getLists'](_0x3aff11);}})[_0xf297('0x25')](function(_0x3b5eec){if(_0x3b5eec){_0x581828=_0x3b5eec[_0xf297('0x40')];if(!_0xd5d1b0['query']['hasOwnProperty'](_0xf297('0x41'))){_0x3aff11['limit']=qs[_0xf297('0x1e')](_0xd5d1b0[_0xf297('0x3b')][_0xf297('0x1e')]);_0x3aff11[_0xf297('0x1d')]=qs['offset'](_0xd5d1b0['query'][_0xf297('0x1d')]);}return _0x27c8a4[_0xf297('0x99')](_0x3aff11);}})[_0xf297('0x25')](function(_0x4329a0){if(_0x4329a0){return _0x4329a0?{'count':_0x581828,'rows':_0x4329a0}:null;}})[_0xf297('0x25')](respondWithResult(_0xdebe6c,null))[_0xf297('0x4e')](handleError(_0xdebe6c,null));};exports[_0xf297('0x9b')]=function(_0x1016ba,_0x4f940c,_0x48c6af){var _0x522c0e=moment()[_0xf297('0x7d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x24aacc,_0x5aed08;return db['VoiceQueue'][_0xf297('0x2e')]({'where':{'id':_0x1016ba[_0xf297('0x5a')]['id']}})[_0xf297('0x25')](handleEntityNotFound(_0x4f940c,null))['then'](function(_0x41d4a6){if(_0x41d4a6){_0x5aed08=_0x41d4a6;return _0x41d4a6[_0xf297('0x9b')](_0x1016ba[_0xf297('0x50')][_0xf297('0x81')],_[_0xf297('0x5b')](_0x1016ba[_0xf297('0x50')],[_0xf297('0x81'),'id'])||{});}return null;})[_0xf297('0x93')](function(_0x25b21b){var _0x47e293;_0x24aacc=_0x25b21b||[];var _0x40d339=[];if(_0x25b21b){for(var _0x310dbb=0x0;_0x310dbb<_0x25b21b[_0xf297('0x40')];_0x310dbb+=0x1){var _0x58f0a9=_0x25b21b[_0x310dbb][_0xf297('0x27')]({'plain':!![]});_0x5aed08['dialCheckDuplicateType']=_0x1016ba['body'][_0xf297('0x9c')]?_0x1016ba[_0xf297('0x50')][_0xf297('0x9c')]:_0x5aed08[_0xf297('0x9c')];switch(_0x5aed08[_0xf297('0x9c')]){case _0xf297('0x9d'):_0x47e293=squel[_0xf297('0x9e')]()[_0xf297('0x9f')](_0xf297('0xa0'))['fromQuery']([_0xf297('0xa1'),_0xf297('0xa2'),_0xf297('0xa3'),_0xf297('0xa4'),_0xf297('0x63'),_0xf297('0x5c'),_0xf297('0x5d')],squel['select']()[_0xf297('0x83')](_0xf297('0xa1'),'phone')[_0xf297('0x83')]('\x27'+_0x522c0e+'\x27',_0xf297('0xa2'))[_0xf297('0x83')]('id',_0xf297('0xa3'))[_0xf297('0x83')](_0x58f0a9['CmListId'][_0xf297('0x8a')](),_0xf297('0xa4'))[_0xf297('0x83')](_0x1016ba[_0xf297('0x5a')]['id'][_0xf297('0x8a')](),_0xf297('0x63'))[_0xf297('0x83')]('\x27'+_0x522c0e+'\x27',_0xf297('0x5c'))[_0xf297('0x83')]('\x27'+_0x522c0e+'\x27',_0xf297('0x5d'))[_0xf297('0xa5')](_0xf297('0xa6'))[_0xf297('0x46')]('deletedAt\x20IS\x20NULL')[_0xf297('0x46')](_0xf297('0xa7'),_0x58f0a9[_0xf297('0xa8')]['toString']())[_0xf297('0x46')](_0xf297('0xa9'))[_0xf297('0x46')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf297('0x82')]()[_0xf297('0x83')]('COALESCE(calleridnum,\x27\x27)')[_0xf297('0xa5')](_0xf297('0xaa'))[_0xf297('0x46')](_0xf297('0x88'),_0x1016ba[_0xf297('0x5a')]['id'][_0xf297('0x8a')]()))[_0xf297('0x46')](_0xf297('0xab'),squel[_0xf297('0x82')]()[_0xf297('0x83')](_0xf297('0xac'))[_0xf297('0xa5')](_0xf297('0xa0'))[_0xf297('0x46')](_0xf297('0x88'),_0x1016ba[_0xf297('0x5a')]['id'][_0xf297('0x8a')]())))[_0xf297('0x8a')]();break;case'onlyIfOpen':_0x47e293=squel[_0xf297('0x9e')]()[_0xf297('0x9f')](_0xf297('0xa0'))['fromQuery']([_0xf297('0xa1'),'scheduledAt',_0xf297('0xa3'),_0xf297('0xa4'),'VoiceQueueId',_0xf297('0x5c'),_0xf297('0x5d')],squel['select']()[_0xf297('0x83')](_0xf297('0xa1'),_0xf297('0xa1'))['field']('\x27'+_0x522c0e+'\x27',_0xf297('0xa2'))[_0xf297('0x83')]('id',_0xf297('0xa3'))[_0xf297('0x83')](_0x58f0a9[_0xf297('0xa8')]['toString'](),_0xf297('0xa4'))[_0xf297('0x83')](_0x1016ba['params']['id'][_0xf297('0x8a')](),_0xf297('0x63'))['field']('\x27'+_0x522c0e+'\x27',_0xf297('0x5c'))[_0xf297('0x83')]('\x27'+_0x522c0e+'\x27','updatedAt')[_0xf297('0xa5')](_0xf297('0xa6'))[_0xf297('0x46')](_0xf297('0xad'))[_0xf297('0x46')]('ListId\x20=\x20?',_0x58f0a9['CmListId'][_0xf297('0x8a')]())[_0xf297('0x46')](_0xf297('0xa9'))[_0xf297('0x46')](_0xf297('0xab'),squel['select']()[_0xf297('0x83')](_0xf297('0xac'))['from']('cm_hopper')[_0xf297('0x46')](_0xf297('0x88'),_0x1016ba[_0xf297('0x5a')]['id'][_0xf297('0x8a')]())))[_0xf297('0x8a')]();break;default:_0x47e293=squel[_0xf297('0x9e')]()['into']('cm_hopper')[_0xf297('0xae')]([_0xf297('0xa1'),_0xf297('0xa2'),_0xf297('0xa3'),_0xf297('0xa4'),_0xf297('0x63'),_0xf297('0x5c'),_0xf297('0x5d')],squel['select']()[_0xf297('0x83')]('phone','phone')[_0xf297('0x83')]('\x27'+_0x522c0e+'\x27','scheduledAt')[_0xf297('0x83')]('id',_0xf297('0xa3'))['field'](_0x58f0a9[_0xf297('0xa8')]['toString'](),_0xf297('0xa4'))['field'](_0x1016ba[_0xf297('0x5a')]['id']['toString'](),_0xf297('0x63'))[_0xf297('0x83')]('\x27'+_0x522c0e+'\x27','createdAt')[_0xf297('0x83')]('\x27'+_0x522c0e+'\x27','updatedAt')['from'](_0xf297('0xa6'))[_0xf297('0x46')]('deletedAt\x20IS\x20NULL')[_0xf297('0x46')](_0xf297('0xa7'),_0x58f0a9['CmListId'][_0xf297('0x8a')]())[_0xf297('0x46')](_0xf297('0xa9')))[_0xf297('0x8a')]();}_0x40d339[_0xf297('0xaf')](db[_0xf297('0x74')]['query'](_0x47e293));}return BPromise['all'](_0x40d339);}})[_0xf297('0x25')](function(){var _0x55420e=[];var _0x586c60=squel[_0xf297('0x9e')]()[_0xf297('0x9f')]('cm_hopper_additional_phones')['fromQuery']([_0xf297('0xb0'),_0xf297('0xa1'),'OrderBy',_0xf297('0x5c'),_0xf297('0x5d')],squel[_0xf297('0x82')]()[_0xf297('0x83')](_0xf297('0xb1'))[_0xf297('0x83')]('ci.item')[_0xf297('0x83')](_0xf297('0xb2'))[_0xf297('0x83')]('\x27'+_0x522c0e+'\x27',_0xf297('0x5c'))[_0xf297('0x83')]('\x27'+_0x522c0e+'\x27',_0xf297('0x5d'))[_0xf297('0xa5')](_0xf297('0xb3'),'ci')[_0xf297('0x85')]('cm_hopper','h','h.ContactId=ci.CmContactId')[_0xf297('0x46')](_0xf297('0xb4'),_0x522c0e)[_0xf297('0x46')]('ci.ItemClass=?',_0xf297('0xb5')))['toString']();_0x55420e[_0xf297('0xaf')](db['sequelize'][_0xf297('0x3b')](_0x586c60));return BPromise['all'](_0x55420e);})[_0xf297('0x25')](function(){return _0x24aacc;})[_0xf297('0x25')](respondWithResult(_0x4f940c,null))['catch'](handleError(_0x4f940c,null));};exports[_0xf297('0xb6')]=function(_0x1f877d,_0xb5b555,_0x3393c0){return db['VoiceQueue'][_0xf297('0x2e')]({'where':{'id':_0x1f877d[_0xf297('0x5a')]['id']}})[_0xf297('0x25')](handleEntityNotFound(_0xb5b555,null))[_0xf297('0x25')](function(_0x8638b){if(_0x8638b){return _0x8638b[_0xf297('0xb6')](_0x1f877d[_0xf297('0x3b')][_0xf297('0x81')]);}})[_0xf297('0x25')](function(_0x33c0e9){if(_0x33c0e9){return db[_0xf297('0x64')][_0xf297('0x26')]({'where':{'ListId':_0x1f877d[_0xf297('0x3b')][_0xf297('0x81')],'VoiceQueueId':_0x1f877d[_0xf297('0x5a')]['id']}})[_0xf297('0x25')](function(){return _0x33c0e9;});}})[_0xf297('0x25')](respondWithStatusCode(_0xb5b555,null))['catch'](handleError(_0xb5b555,null));};exports['getBlackLists']=function(_0x22b9ef,_0x163eec,_0x5e026e){var _0x4b08b3={};var _0x8c55c={};var _0x48c471;var _0x5dda31;return db[_0xf297('0x4d')][_0xf297('0x60')]({'where':{'id':_0x22b9ef[_0xf297('0x5a')]['id']}})[_0xf297('0x25')](handleEntityNotFound(_0x163eec,null))['then'](function(_0x2224c3){if(_0x2224c3){_0x48c471=_0x2224c3;_0x8c55c['model']=_[_0xf297('0x3a')](db[_0xf297('0x9a')][_0xf297('0x36')]);_0x8c55c[_0xf297('0x3b')]=_[_0xf297('0x3a')](_0x22b9ef[_0xf297('0x3b')]);_0x8c55c[_0xf297('0x3c')]=_[_0xf297('0x3d')](_0x8c55c[_0xf297('0x39')],_0x8c55c['query']);_0x4b08b3['attributes']=_['intersection'](_0x8c55c[_0xf297('0x39')],qs['fields'](_0x22b9ef['query'][_0xf297('0x3f')]));_0x4b08b3['attributes']=_0x4b08b3[_0xf297('0x3e')]['length']?_0x4b08b3['attributes']:_0x8c55c[_0xf297('0x39')];_0x4b08b3[_0xf297('0x42')]=qs[_0xf297('0x43')](_0x22b9ef[_0xf297('0x3b')]['sort']);_0x4b08b3[_0xf297('0x46')]=qs[_0xf297('0x3c')](_[_0xf297('0x62')](_0x22b9ef[_0xf297('0x3b')],_0x8c55c[_0xf297('0x3c')]));if(_0x22b9ef['query'][_0xf297('0x44')]){_0x4b08b3['where']=_[_0xf297('0x45')](_0x4b08b3[_0xf297('0x46')],{'$or':_[_0xf297('0x2b')](_0x4b08b3[_0xf297('0x3e')],function(_0x3bc57c){var _0x4a82ec={};_0x4a82ec[_0x3bc57c]={'$like':'%'+_0x22b9ef[_0xf297('0x3b')][_0xf297('0x44')]+'%'};return _0x4a82ec;})});}_0x4b08b3=_[_0xf297('0x45')]({},_0x4b08b3,_0x22b9ef[_0xf297('0x48')]);return _0x48c471[_0xf297('0xb7')](_0x4b08b3);}})[_0xf297('0x25')](function(_0x22c7c6){if(_0x22c7c6){_0x5dda31=_0x22c7c6['length'];if(!_0x22b9ef[_0xf297('0x3b')][_0xf297('0x61')](_0xf297('0x41'))){_0x4b08b3['limit']=qs['limit'](_0x22b9ef['query']['limit']);_0x4b08b3[_0xf297('0x1d')]=qs[_0xf297('0x1d')](_0x22b9ef['query'][_0xf297('0x1d')]);}return _0x48c471[_0xf297('0xb7')](_0x4b08b3);}})[_0xf297('0x25')](function(_0x4a047a){if(_0x4a047a){return _0x4a047a?{'count':_0x5dda31,'rows':_0x4a047a}:null;}})[_0xf297('0x25')](respondWithResult(_0x163eec,null))[_0xf297('0x4e')](handleError(_0x163eec,null));};exports[_0xf297('0xb8')]=function(_0xa20cb4,_0x3554ce,_0x1aaa3b){var _0x167fe0,_0x2428ad;return db[_0xf297('0x4d')][_0xf297('0x2e')]({'where':{'id':_0xa20cb4[_0xf297('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3554ce,null))[_0xf297('0x25')](function(_0x5821d1){if(_0x5821d1){_0x2428ad=_0x5821d1;return _0x5821d1[_0xf297('0xb8')](_0xa20cb4[_0xf297('0x50')][_0xf297('0x81')],_['omit'](_0xa20cb4['body'],[_0xf297('0x81'),'id'])||{});}return null;})[_0xf297('0x93')](function(_0x2cf703){var _0x4157d0;_0x167fe0=_0x2cf703||[];var _0x3bbde5=[];if(_0x2cf703){for(var _0x1fc2cd=0x0;_0x1fc2cd<_0x2cf703['length'];_0x1fc2cd+=0x1){var _0x41184a=_0x2cf703[_0x1fc2cd]['get']({'plain':!![]});_0x4157d0=squel[_0xf297('0x9e')]()[_0xf297('0x9f')](_0xf297('0xb9'))[_0xf297('0xae')]([_0xf297('0xa1'),_0xf297('0xa3'),_0xf297('0xa4'),_0xf297('0x63'),_0xf297('0x5c'),'updatedAt'],squel[_0xf297('0x82')]()[_0xf297('0x83')]('phone',_0xf297('0xa1'))[_0xf297('0x83')]('id',_0xf297('0xa3'))[_0xf297('0x83')](_0x41184a[_0xf297('0xa8')][_0xf297('0x8a')](),_0xf297('0xa4'))[_0xf297('0x83')](_0xa20cb4[_0xf297('0x5a')]['id'][_0xf297('0x8a')](),_0xf297('0x63'))[_0xf297('0x83')]('NOW()',_0xf297('0x5c'))[_0xf297('0x83')](_0xf297('0xba'),_0xf297('0x5d'))[_0xf297('0xa5')](_0xf297('0xa6'))[_0xf297('0x46')]('deletedAt\x20IS\x20NULL')[_0xf297('0x46')](_0xf297('0xa7'),_0x41184a['CmListId'][_0xf297('0x8a')]())[_0xf297('0x46')](_0xf297('0xa9')))[_0xf297('0x8a')]();_0x3bbde5[_0xf297('0xaf')](db[_0xf297('0x74')][_0xf297('0x3b')](_0x4157d0));}return BPromise[_0xf297('0x95')](_0x3bbde5);}})['then'](function(){return _0x167fe0;})[_0xf297('0x25')](respondWithResult(_0x3554ce,null))['catch'](handleError(_0x3554ce,null));};exports[_0xf297('0xbb')]=function(_0x5615f7,_0x2ec7ef,_0xc19e8a){return db['VoiceQueue'][_0xf297('0x2e')]({'where':{'id':_0x5615f7[_0xf297('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2ec7ef,null))[_0xf297('0x25')](function(_0x44448f){if(_0x44448f){return _0x44448f[_0xf297('0xbb')](_0x5615f7[_0xf297('0x3b')][_0xf297('0x81')]);}})[_0xf297('0x25')](function(_0x4d0660){if(_0x4d0660){return db[_0xf297('0x6b')][_0xf297('0x26')]({'where':{'ListId':_0x5615f7[_0xf297('0x3b')][_0xf297('0x81')],'VoiceQueueId':_0x5615f7['params']['id']}})[_0xf297('0x25')](function(){return _0x4d0660;});}})[_0xf297('0x25')](respondWithStatusCode(_0x2ec7ef,null))[_0xf297('0x4e')](handleError(_0x2ec7ef,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 132b0c6..def8b70 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 _0xccbd=['hasOwnProperty','hook','exports','events','VoiceQueue','update'];(function(_0x45fabc,_0x5a7327){var _0x253f59=function(_0xea4616){while(--_0xea4616){_0x45fabc['push'](_0x45fabc['shift']());}};_0x253f59(++_0x5a7327);}(_0xccbd,0x165));var _0xdccb=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xccbd[_0x17b6e3];return _0x3906f3;};'use strict';var EventEmitter=require(_0xdccb('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xdccb('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xdccb('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2e903c){return function(_0x1436c7,_0x54e93f,_0xa25e6e){VoiceQueueEvents['emit'](_0x2e903c+':'+_0x1436c7['id'],_0x1436c7);VoiceQueueEvents['emit'](_0x2e903c,_0x1436c7);_0xa25e6e(null);};}for(var e in events){if(events[_0xdccb('0x3')](e)){var event=events[e];VoiceQueue[_0xdccb('0x4')](e,emitEvent(event));}}module[_0xdccb('0x5')]=VoiceQueueEvents; \ No newline at end of file +var _0x7787=['../../mysqldb','VoiceQueue','setMaxListeners','save','emit','hasOwnProperty','hook','events'];(function(_0x1d6be0,_0x5e2b0b){var _0x4b6c6c=function(_0x45c439){while(--_0x45c439){_0x1d6be0['push'](_0x1d6be0['shift']());}};_0x4b6c6c(++_0x5e2b0b);}(_0x7787,0x9f));var _0x7778=function(_0x5d4003,_0xde382d){_0x5d4003=_0x5d4003-0x0;var _0x207dbf=_0x7787[_0x5d4003];return _0x207dbf;};'use strict';var EventEmitter=require(_0x7778('0x0'));var VoiceQueue=require(_0x7778('0x1'))['db'][_0x7778('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x7778('0x3')](0x0);var events={'afterCreate':_0x7778('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x7422d0){return function(_0x445614,_0xa3a9d4,_0x142c53){VoiceQueueEvents[_0x7778('0x5')](_0x7422d0+':'+_0x445614['id'],_0x445614);VoiceQueueEvents[_0x7778('0x5')](_0x7422d0,_0x445614);_0x142c53(null);};}for(var e in events){if(events[_0x7778('0x6')](e)){var event=events[e];VoiceQueue[_0x7778('0x7')](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 a692489..91fc6ff 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 _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x2711a1,_0x53b6e1){var _0x4a8ba8=function(_0x448d68){while(--_0x448d68){_0x2711a1['push'](_0x2711a1['shift']());}};_0x4a8ba8(++_0x53b6e1);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'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 +var _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x154a1c,_0x2490d3){var _0x1a0d80=function(_0x42727e){while(--_0x42727e){_0x154a1c['push'](_0x154a1c['shift']());}};_0x1a0d80(++_0x2490d3);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'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 2788ee7..0011701 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 _0xe483=['catch','GetVoiceQueue','VoiceQueue','options','limit','include','model','attributes','map','ShowVoiceQueue','find','raw','where','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','register','request','then','info','request\x20sent','debug','stringify','code','error','VoiceQueue,\x20%s,\x20%s','message','result'];(function(_0x1ba11f,_0xd49420){var _0xf06773=function(_0x2235b5){while(--_0x2235b5){_0x1ba11f['push'](_0x1ba11f['shift']());}};_0xf06773(++_0xd49420);}(_0xe483,0x16b));var _0x3e48=function(_0x5d6bad,_0x76b80a){_0x5d6bad=_0x5d6bad-0x0;var _0x5aeb9c=_0xe483[_0x5d6bad];return _0x5aeb9c;};'use strict';var _=require('lodash');var util=require(_0x3e48('0x0'));var moment=require(_0x3e48('0x1'));var BPromise=require(_0x3e48('0x2'));var rs=require(_0x3e48('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e48('0x4'))['db'];var utils=require(_0x3e48('0x5'));var logger=require(_0x3e48('0x6'))('rpc');var config=require(_0x3e48('0x7'));var jayson=require(_0x3e48('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x3e48('0x9')]=_['defaults'](config[_0x3e48('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3e48('0x9')]));require('./voiceQueue.socket')[_0x3e48('0xa')](socket);function respondWithRpcPromise(_0x22e32e,_0x3325c6,_0x2dd73a){return new BPromise(function(_0x120f60,_0x324c7b){return client[_0x3e48('0xb')](_0x22e32e,_0x2dd73a)[_0x3e48('0xc')](function(_0x11db5a){logger[_0x3e48('0xd')]('VoiceQueue,\x20%s,\x20%s',_0x3325c6,_0x3e48('0xe'));logger[_0x3e48('0xf')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x3325c6,_0x3e48('0xe'),JSON[_0x3e48('0x10')](_0x11db5a));if(_0x11db5a['error']){if(_0x11db5a['error'][_0x3e48('0x11')]===0x1f4){logger[_0x3e48('0x12')](_0x3e48('0x13'),_0x3325c6,_0x11db5a[_0x3e48('0x12')][_0x3e48('0x14')]);return _0x324c7b(_0x11db5a['error']['message']);}logger[_0x3e48('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x3325c6,_0x11db5a[_0x3e48('0x12')]['message']);return _0x120f60(_0x11db5a['error'][_0x3e48('0x14')]);}else{logger[_0x3e48('0xd')](_0x3e48('0x13'),_0x3325c6,_0x3e48('0xe'));_0x120f60(_0x11db5a[_0x3e48('0x15')][_0x3e48('0x14')]);}})[_0x3e48('0x16')](function(_0x414092){logger['error'](_0x3e48('0x13'),_0x3325c6,_0x414092);_0x324c7b(_0x414092);});});}exports[_0x3e48('0x17')]=function(_0x58a375){var _0x2de292=this;return new Promise(function(_0x5c18e9,_0x239836){return db[_0x3e48('0x18')]['findAll']({'raw':_0x58a375[_0x3e48('0x19')]?_0x58a375[_0x3e48('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x58a375[_0x3e48('0x19')]?_0x58a375[_0x3e48('0x19')]['where']||null:null,'attributes':_0x58a375[_0x3e48('0x19')]?_0x58a375['options']['attributes']||null:null,'limit':_0x58a375[_0x3e48('0x19')]?_0x58a375[_0x3e48('0x19')][_0x3e48('0x1a')]||null:null,'include':_0x58a375[_0x3e48('0x19')]?_0x58a375[_0x3e48('0x19')][_0x3e48('0x1b')]?_['map'](_0x58a375[_0x3e48('0x19')][_0x3e48('0x1b')],function(_0x5c28db){return{'model':db[_0x5c28db[_0x3e48('0x1c')]],'as':_0x5c28db['as'],'attributes':_0x5c28db['attributes'],'include':_0x5c28db[_0x3e48('0x1b')]?_['map'](_0x5c28db[_0x3e48('0x1b')],function(_0x281cc1){return{'model':db[_0x281cc1[_0x3e48('0x1c')]],'as':_0x281cc1['as'],'attributes':_0x281cc1[_0x3e48('0x1d')],'include':_0x281cc1[_0x3e48('0x1b')]?_[_0x3e48('0x1e')](_0x281cc1['include'],function(_0x6ad48f){return{'model':db[_0x6ad48f[_0x3e48('0x1c')]],'as':_0x6ad48f['as'],'attributes':_0x6ad48f[_0x3e48('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3e48('0xc')](function(_0x2e988c){logger[_0x3e48('0xd')](_0x3e48('0x17'),_0x58a375);logger[_0x3e48('0xf')](_0x3e48('0x17'),_0x58a375,JSON[_0x3e48('0x10')](_0x2e988c));_0x5c18e9(_0x2e988c);})['catch'](function(_0x1ffa97){logger[_0x3e48('0x12')]('GetVoiceQueue',_0x1ffa97[_0x3e48('0x14')],_0x58a375);_0x239836(_0x2de292[_0x3e48('0x12')](0x1f4,_0x1ffa97['message']));});});};exports[_0x3e48('0x1f')]=function(_0x4934c7){var _0x37db81=this;return new Promise(function(_0x7a5ae9,_0x5389f7){return db[_0x3e48('0x18')][_0x3e48('0x20')]({'raw':_0x4934c7[_0x3e48('0x19')]?_0x4934c7['options'][_0x3e48('0x21')]===undefined?!![]:![]:!![],'where':_0x4934c7['options']?_0x4934c7[_0x3e48('0x19')][_0x3e48('0x22')]||null:null,'attributes':_0x4934c7[_0x3e48('0x19')]?_0x4934c7[_0x3e48('0x19')][_0x3e48('0x1d')]||null:null,'include':_0x4934c7[_0x3e48('0x19')]?_0x4934c7[_0x3e48('0x19')][_0x3e48('0x1b')]?_[_0x3e48('0x1e')](_0x4934c7[_0x3e48('0x19')][_0x3e48('0x1b')],function(_0x915dc1){return{'model':db[_0x915dc1[_0x3e48('0x1c')]],'as':_0x915dc1['as'],'attributes':_0x915dc1[_0x3e48('0x1d')],'include':_0x915dc1[_0x3e48('0x1b')]?_[_0x3e48('0x1e')](_0x915dc1[_0x3e48('0x1b')],function(_0xe926e1){return{'model':db[_0xe926e1[_0x3e48('0x1c')]],'as':_0xe926e1['as'],'attributes':_0xe926e1[_0x3e48('0x1d')],'include':_0xe926e1[_0x3e48('0x1b')]?_['map'](_0xe926e1[_0x3e48('0x1b')],function(_0x3135bd){return{'model':db[_0x3135bd[_0x3e48('0x1c')]],'as':_0x3135bd['as'],'attributes':_0x3135bd[_0x3e48('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3e48('0xc')](function(_0x3da771){logger[_0x3e48('0xd')](_0x3e48('0x1f'),_0x4934c7);logger[_0x3e48('0xf')](_0x3e48('0x1f'),_0x4934c7,JSON[_0x3e48('0x10')](_0x3da771));_0x7a5ae9(_0x3da771);})[_0x3e48('0x16')](function(_0x4047ad){logger[_0x3e48('0x12')]('ShowVoiceQueue',_0x4047ad[_0x3e48('0x14')],_0x4934c7);_0x5389f7(_0x37db81[_0x3e48('0x12')](0x1f4,_0x4047ad[_0x3e48('0x14')]));});});}; \ No newline at end of file +var _0xc499=['register','request','then','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','VoiceQueue,\x20%s,\x20%s','result','catch','GetVoiceQueue','options','raw','attributes','limit','include','map','model','debug','stringify','ShowVoiceQueue','VoiceQueue','find','where','info','util','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x29dda1,_0x508e13){var _0x21b0ef=function(_0x118906){while(--_0x118906){_0x29dda1['push'](_0x29dda1['shift']());}};_0x21b0ef(++_0x508e13);}(_0xc499,0x68));var _0x9c49=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0xc499[_0x1e2321];return _0x1d346d;};'use strict';var _=require('lodash');var util=require(_0x9c49('0x0'));var moment=require('moment');var BPromise=require(_0x9c49('0x1'));var rs=require(_0x9c49('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c49('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9c49('0x4'));var config=require(_0x9c49('0x5'));var jayson=require(_0x9c49('0x6'));var client=jayson[_0x9c49('0x7')][_0x9c49('0x8')]({'port':0x232a});config['redis']=_[_0x9c49('0x9')](config[_0x9c49('0xa')],{'host':_0x9c49('0xb'),'port':0x18eb});var socket=require(_0x9c49('0xc'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0x9c49('0xd')](socket);function respondWithRpcPromise(_0x4eda5e,_0x198843,_0x42c69c){return new BPromise(function(_0x202333,_0x1f4f42){return client[_0x9c49('0xe')](_0x4eda5e,_0x42c69c)[_0x9c49('0xf')](function(_0x5a060c){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x198843,_0x9c49('0x10'));logger['debug'](_0x9c49('0x11'),_0x198843,_0x9c49('0x10'),JSON['stringify'](_0x5a060c));if(_0x5a060c[_0x9c49('0x12')]){if(_0x5a060c['error'][_0x9c49('0x13')]===0x1f4){logger[_0x9c49('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x198843,_0x5a060c[_0x9c49('0x12')][_0x9c49('0x14')]);return _0x1f4f42(_0x5a060c[_0x9c49('0x12')][_0x9c49('0x14')]);}logger[_0x9c49('0x12')](_0x9c49('0x15'),_0x198843,_0x5a060c['error'][_0x9c49('0x14')]);return _0x202333(_0x5a060c[_0x9c49('0x12')][_0x9c49('0x14')]);}else{logger['info'](_0x9c49('0x15'),_0x198843,'request\x20sent');_0x202333(_0x5a060c[_0x9c49('0x16')][_0x9c49('0x14')]);}})[_0x9c49('0x17')](function(_0x1f3cf4){logger['error'](_0x9c49('0x15'),_0x198843,_0x1f3cf4);_0x1f4f42(_0x1f3cf4);});});}exports[_0x9c49('0x18')]=function(_0x1dc4d3){var _0x4cf17e=this;return new Promise(function(_0x9fa466,_0x385c9e){return db['VoiceQueue']['findAll']({'raw':_0x1dc4d3[_0x9c49('0x19')]?_0x1dc4d3['options'][_0x9c49('0x1a')]===undefined?!![]:![]:!![],'where':_0x1dc4d3[_0x9c49('0x19')]?_0x1dc4d3[_0x9c49('0x19')]['where']||null:null,'attributes':_0x1dc4d3[_0x9c49('0x19')]?_0x1dc4d3[_0x9c49('0x19')][_0x9c49('0x1b')]||null:null,'limit':_0x1dc4d3[_0x9c49('0x19')]?_0x1dc4d3['options'][_0x9c49('0x1c')]||null:null,'include':_0x1dc4d3[_0x9c49('0x19')]?_0x1dc4d3[_0x9c49('0x19')][_0x9c49('0x1d')]?_[_0x9c49('0x1e')](_0x1dc4d3[_0x9c49('0x19')][_0x9c49('0x1d')],function(_0x5f26ff){return{'model':db[_0x5f26ff[_0x9c49('0x1f')]],'as':_0x5f26ff['as'],'attributes':_0x5f26ff['attributes'],'include':_0x5f26ff[_0x9c49('0x1d')]?_[_0x9c49('0x1e')](_0x5f26ff[_0x9c49('0x1d')],function(_0x464dfc){return{'model':db[_0x464dfc['model']],'as':_0x464dfc['as'],'attributes':_0x464dfc['attributes'],'include':_0x464dfc['include']?_[_0x9c49('0x1e')](_0x464dfc[_0x9c49('0x1d')],function(_0x4cf71c){return{'model':db[_0x4cf71c[_0x9c49('0x1f')]],'as':_0x4cf71c['as'],'attributes':_0x4cf71c[_0x9c49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9c49('0xf')](function(_0x10b1de){logger['info'](_0x9c49('0x18'),_0x1dc4d3);logger[_0x9c49('0x20')]('GetVoiceQueue',_0x1dc4d3,JSON[_0x9c49('0x21')](_0x10b1de));_0x9fa466(_0x10b1de);})[_0x9c49('0x17')](function(_0xd94eb5){logger['error'](_0x9c49('0x18'),_0xd94eb5[_0x9c49('0x14')],_0x1dc4d3);_0x385c9e(_0x4cf17e[_0x9c49('0x12')](0x1f4,_0xd94eb5[_0x9c49('0x14')]));});});};exports[_0x9c49('0x22')]=function(_0x5742a7){var _0x4ea925=this;return new Promise(function(_0x156b54,_0x18afc8){return db[_0x9c49('0x23')][_0x9c49('0x24')]({'raw':_0x5742a7['options']?_0x5742a7[_0x9c49('0x19')][_0x9c49('0x1a')]===undefined?!![]:![]:!![],'where':_0x5742a7[_0x9c49('0x19')]?_0x5742a7[_0x9c49('0x19')][_0x9c49('0x25')]||null:null,'attributes':_0x5742a7['options']?_0x5742a7['options'][_0x9c49('0x1b')]||null:null,'include':_0x5742a7['options']?_0x5742a7[_0x9c49('0x19')][_0x9c49('0x1d')]?_[_0x9c49('0x1e')](_0x5742a7[_0x9c49('0x19')]['include'],function(_0x4ad9ac){return{'model':db[_0x4ad9ac[_0x9c49('0x1f')]],'as':_0x4ad9ac['as'],'attributes':_0x4ad9ac[_0x9c49('0x1b')],'include':_0x4ad9ac['include']?_[_0x9c49('0x1e')](_0x4ad9ac['include'],function(_0xc98de){return{'model':db[_0xc98de[_0x9c49('0x1f')]],'as':_0xc98de['as'],'attributes':_0xc98de['attributes'],'include':_0xc98de['include']?_[_0x9c49('0x1e')](_0xc98de['include'],function(_0x522232){return{'model':db[_0x522232[_0x9c49('0x1f')]],'as':_0x522232['as'],'attributes':_0x522232[_0x9c49('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1922cd){logger[_0x9c49('0x26')]('ShowVoiceQueue',_0x5742a7);logger[_0x9c49('0x20')](_0x9c49('0x22'),_0x5742a7,JSON['stringify'](_0x1922cd));_0x156b54(_0x1922cd);})[_0x9c49('0x17')](function(_0x4d6d6f){logger[_0x9c49('0x12')]('ShowVoiceQueue',_0x4d6d6f[_0x9c49('0x14')],_0x5742a7);_0x18afc8(_0x4ea925[_0x9c49('0x12')](0x1f4,_0x4d6d6f[_0x9c49('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 3688c34..8bdcae4 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 _0xc272=['./voiceQueue.events','save','remove','update','emit','removeListener','length','voiceQueue:'];(function(_0x5b1440,_0x1712e0){var _0x561a31=function(_0x1c3dcb){while(--_0x1c3dcb){_0x5b1440['push'](_0x5b1440['shift']());}};_0x561a31(++_0x1712e0);}(_0xc272,0x138));var _0x2c27=function(_0x1e6659,_0x1f860c){_0x1e6659=_0x1e6659-0x0;var _0x4d16e4=_0xc272[_0x1e6659];return _0x4d16e4;};'use strict';var VoiceQueueEvents=require(_0x2c27('0x0'));var events=[_0x2c27('0x1'),_0x2c27('0x2'),_0x2c27('0x3')];function createListener(_0xcf3d6b,_0x259df5){return function(_0x36a548){_0x259df5[_0x2c27('0x4')](_0xcf3d6b,_0x36a548);};}function removeListener(_0x38db22,_0x5b4734){return function(){VoiceQueueEvents[_0x2c27('0x5')](_0x38db22,_0x5b4734);};}exports['register']=function(_0x5d42f3){for(var _0x542b8a=0x0,_0x5c5d38=events[_0x2c27('0x6')];_0x542b8a<_0x5c5d38;_0x542b8a++){var _0x3ebdc3=events[_0x542b8a];var _0x4e1e71=createListener(_0x2c27('0x7')+_0x3ebdc3,_0x5d42f3);VoiceQueueEvents['on'](_0x3ebdc3,_0x4e1e71);}}; \ No newline at end of file +var _0x2612=['removeListener','length','voiceQueue:','./voiceQueue.events','save','remove','update','emit'];(function(_0x649e9e,_0x549c01){var _0x2ff8a5=function(_0x3b9f78){while(--_0x3b9f78){_0x649e9e['push'](_0x649e9e['shift']());}};_0x2ff8a5(++_0x549c01);}(_0x2612,0x183));var _0x2261=function(_0x38cce1,_0x50fb8c){_0x38cce1=_0x38cce1-0x0;var _0x2f4d0b=_0x2612[_0x38cce1];return _0x2f4d0b;};'use strict';var VoiceQueueEvents=require(_0x2261('0x0'));var events=[_0x2261('0x1'),_0x2261('0x2'),_0x2261('0x3')];function createListener(_0x2731d3,_0x3d3ef8){return function(_0x1e7635){_0x3d3ef8[_0x2261('0x4')](_0x2731d3,_0x1e7635);};}function removeListener(_0x30d7c6,_0x2403fa){return function(){VoiceQueueEvents[_0x2261('0x5')](_0x30d7c6,_0x2403fa);};}exports['register']=function(_0x1d28ae){for(var _0x205a24=0x0,_0x240a1e=events[_0x2261('0x6')];_0x205a24<_0x240a1e;_0x205a24++){var _0x47f297=events[_0x205a24];var _0x465cb=createListener(_0x2261('0x7')+_0x47f297,_0x1d28ae);VoiceQueueEvents['on'](_0x47f297,_0x465cb);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index c33dbdf..2793f68 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 _0x3ed5=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','getVoiceQueuesReport','show','create','put','update','delete','/:id','destroy','exports','util','path'];(function(_0x2bcb98,_0x2dcaf8){var _0x4e0962=function(_0x33431d){while(--_0x33431d){_0x2bcb98['push'](_0x2bcb98['shift']());}};_0x4e0962(++_0x2dcaf8);}(_0x3ed5,0x11e));var _0x53ed=function(_0xc269a6,_0x1231d1){_0xc269a6=_0xc269a6-0x0;var _0xed7f07=_0x3ed5[_0xc269a6];return _0xed7f07;};'use strict';var multer=require('multer');var util=require(_0x53ed('0x0'));var path=require(_0x53ed('0x1'));var timeout=require(_0x53ed('0x2'));var express=require(_0x53ed('0x3'));var router=express[_0x53ed('0x4')]();var fs_extra=require(_0x53ed('0x5'));var auth=require(_0x53ed('0x6'));var interaction=require(_0x53ed('0x7'));var config=require(_0x53ed('0x8'));var controller=require(_0x53ed('0x9'));router[_0x53ed('0xa')]('/',auth[_0x53ed('0xb')](),controller[_0x53ed('0xc')]);router[_0x53ed('0xa')](_0x53ed('0xd'),auth[_0x53ed('0xb')](),controller[_0x53ed('0xe')]);router[_0x53ed('0xa')]('/index',auth['isAuthenticated'](),controller[_0x53ed('0xf')]);router[_0x53ed('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x53ed('0x10')]);router['post']('/',auth[_0x53ed('0xb')](),controller[_0x53ed('0x11')]);router[_0x53ed('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x53ed('0x13')]);router[_0x53ed('0x14')](_0x53ed('0x15'),auth[_0x53ed('0xb')](),controller[_0x53ed('0x16')]);module[_0x53ed('0x17')]=router; \ No newline at end of file +var _0xcb56=['./voiceQueueReport.controller','get','index','/describe','isAuthenticated','describe','/index','/:id','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x30ec16,_0x4c4683){var _0x26ae86=function(_0x5a7ed1){while(--_0x5a7ed1){_0x30ec16['push'](_0x30ec16['shift']());}};_0x26ae86(++_0x4c4683);}(_0xcb56,0x1f2));var _0x6cb5=function(_0x382735,_0x383755){_0x382735=_0x382735-0x0;var _0xfe25ae=_0xcb56[_0x382735];return _0xfe25ae;};'use strict';var multer=require('multer');var util=require(_0x6cb5('0x0'));var path=require(_0x6cb5('0x1'));var timeout=require(_0x6cb5('0x2'));var express=require(_0x6cb5('0x3'));var router=express['Router']();var fs_extra=require(_0x6cb5('0x4'));var auth=require(_0x6cb5('0x5'));var interaction=require(_0x6cb5('0x6'));var config=require(_0x6cb5('0x7'));var controller=require(_0x6cb5('0x8'));router[_0x6cb5('0x9')]('/',auth['isAuthenticated'](),controller[_0x6cb5('0xa')]);router['get'](_0x6cb5('0xb'),auth[_0x6cb5('0xc')](),controller[_0x6cb5('0xd')]);router[_0x6cb5('0x9')](_0x6cb5('0xe'),auth[_0x6cb5('0xc')](),controller['getVoiceQueuesReport']);router[_0x6cb5('0x9')](_0x6cb5('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x6cb5('0x10')]('/',auth[_0x6cb5('0xc')](),controller[_0x6cb5('0x11')]);router['put']('/:id',auth[_0x6cb5('0xc')](),controller[_0x6cb5('0x12')]);router[_0x6cb5('0x13')](_0x6cb5('0xf'),auth['isAuthenticated'](),controller[_0x6cb5('0x14')]);module[_0x6cb5('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 176632f..33b78d7 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 _0xbfed=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER'];(function(_0x36aad0,_0x3d2e17){var _0x31e987=function(_0x2d0fe4){while(--_0x2d0fe4){_0x36aad0['push'](_0x36aad0['shift']());}};_0x31e987(++_0x3d2e17);}(_0xbfed,0x1f3));var _0xdbfe=function(_0x31f8aa,_0x1d1aa1){_0x31f8aa=_0x31f8aa-0x0;var _0x5ef007=_0xbfed[_0x31f8aa];return _0x5ef007;};'use strict';var Sequelize=require(_0xdbfe('0x0'));var moment=require(_0xdbfe('0x1'));module[_0xdbfe('0x2')]={'type':{'type':Sequelize[_0xdbfe('0x3')]},'uniqueid':{'type':Sequelize[_0xdbfe('0x3')]},'calleridnum':{'type':Sequelize[_0xdbfe('0x3')]},'calleridname':{'type':Sequelize[_0xdbfe('0x3')]},'queue':{'type':Sequelize[_0xdbfe('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xdbfe('0x4')],'set':function(_0x53d444){var _0xea338b=moment(_0x53d444);var _0x569337=moment(this['getDataValue'](_0xdbfe('0x5')))[_0xdbfe('0x6')](_0xdbfe('0x7'));var _0x2dfb07=_0xea338b[_0xdbfe('0x8')](_0x569337,_0xdbfe('0x9'));this[_0xdbfe('0xa')](_0xdbfe('0xb'),_0x53d444);this[_0xdbfe('0xa')]('holdtime',_0x2dfb07||null);}},'position':{'type':Sequelize[_0xdbfe('0xc')]},'count':{'type':Sequelize[_0xdbfe('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xdbfe('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xdbfe('0x3')],'comment':_0xdbfe('0xd')},'originalposition':{'type':Sequelize[_0xdbfe('0xc')]},'channel':{'type':Sequelize[_0xdbfe('0x3')]},'connectedlinenum':{'type':Sequelize[_0xdbfe('0x3')]},'connectedlinename':{'type':Sequelize[_0xdbfe('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xdbfe('0x3')]},'exten':{'type':Sequelize[_0xdbfe('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xdbfe('0xc')]},'mohtime':{'type':Sequelize[_0xdbfe('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xdbfe('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xdbfe('0x3')]},'transfer':{'type':Sequelize[_0xdbfe('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xdbfe('0xf')},'transferexten':{'type':Sequelize[_0xdbfe('0x3')]},'transferuniqueid':{'type':Sequelize[_0xdbfe('0x3')]},'disposition':{'type':Sequelize[_0xdbfe('0x3')]},'secondDisposition':{'type':Sequelize[_0xdbfe('0x3')]},'thirdDisposition':{'type':Sequelize[_0xdbfe('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xdbfe('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x17a3=['STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports'];(function(_0x375233,_0x165da0){var _0xb1fac5=function(_0x535787){while(--_0x535787){_0x375233['push'](_0x375233['shift']());}};_0xb1fac5(++_0x165da0);}(_0x17a3,0x151));var _0x317a=function(_0x5b39e3,_0x5b49f3){_0x5b39e3=_0x5b39e3-0x0;var _0xe11877=_0x17a3[_0x5b39e3];return _0xe11877;};'use strict';var Sequelize=require(_0x317a('0x0'));var moment=require(_0x317a('0x1'));module[_0x317a('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x317a('0x3')]},'calleridnum':{'type':Sequelize[_0x317a('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x317a('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x317a('0x4')],'set':function(_0x563a8e){var _0x39c7cc=moment(_0x563a8e);var _0x210dc0=moment(this[_0x317a('0x5')](_0x317a('0x6')))[_0x317a('0x7')](_0x317a('0x8'));var _0x334968=_0x39c7cc[_0x317a('0x9')](_0x210dc0,_0x317a('0xa'));this[_0x317a('0xb')]('queuecallerleaveAt',_0x563a8e);this['setDataValue'](_0x317a('0xc'),_0x334968||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x317a('0xd')]},'queuecallerabandon':{'type':Sequelize[_0x317a('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x317a('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x317a('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x317a('0x4')]},'queuecallerexit':{'type':Sequelize[_0x317a('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x317a('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x317a('0x3')]},'connectedlinenum':{'type':Sequelize[_0x317a('0x3')]},'connectedlinename':{'type':Sequelize[_0x317a('0x3')]},'accountcode':{'type':Sequelize[_0x317a('0x3')]},'context':{'type':Sequelize[_0x317a('0x3')]},'exten':{'type':Sequelize[_0x317a('0x3')]},'priority':{'type':Sequelize[_0x317a('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x317a('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x317a('0x3')]},'transfer':{'type':Sequelize[_0x317a('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x317a('0x3')],'comment':_0x317a('0x10')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x317a('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x317a('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 d07d47b..cf82f96 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 _0xcf1e=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','name','send','map','VoiceQueueReport','rawAttributes','fieldName','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','merge','options','include','findAll','rows','show','keys','catch','create','body','find','destroy','params','describe','includeAll','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xcf1e,0x90));var _0xecf1=function(_0x21d695,_0x4f3344){_0x21d695=_0x21d695-0x0;var _0x23902b=_0xcf1e[_0x21d695];return _0x23902b;};'use strict';var emlformat=require(_0xecf1('0x0'));var rimraf=require(_0xecf1('0x1'));var zipdir=require(_0xecf1('0x2'));var jsonpatch=require(_0xecf1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xecf1('0x4'));var Mustache=require('mustache');var util=require(_0xecf1('0x5'));var path=require('path');var sox=require(_0xecf1('0x6'));var csv=require(_0xecf1('0x7'));var ejs=require(_0xecf1('0x8'));var fs=require('fs');var fs_extra=require(_0xecf1('0x9'));var _=require(_0xecf1('0xa'));var squel=require(_0xecf1('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xecf1('0xc'));var toCsv=require(_0xecf1('0x7'));var querystring=require('querystring');var Papa=require(_0xecf1('0xd'));var Redis=require(_0xecf1('0xe'));var authService=require(_0xecf1('0xf'));var qs=require(_0xecf1('0x10'));var as=require(_0xecf1('0x11'));var hardwareService=require(_0xecf1('0x12'));var logger=require(_0xecf1('0x13'))(_0xecf1('0x14'));var utils=require(_0xecf1('0x15'));var config=require(_0xecf1('0x16'));var licenseUtil=require(_0xecf1('0x17'));var db=require(_0xecf1('0x18'))['db'];config[_0xecf1('0x19')]=_['defaults'](config[_0xecf1('0x19')],{'host':_0xecf1('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xecf1('0x19')]));require(_0xecf1('0x1b'))[_0xecf1('0x1c')](socket);function respondWithStatusCode(_0x160ecb,_0x28cb64){_0x28cb64=_0x28cb64||0xcc;return function(_0x275cb4){if(_0x275cb4){return _0x160ecb[_0xecf1('0x1d')](_0x28cb64);}return _0x160ecb[_0xecf1('0x1e')](_0x28cb64)[_0xecf1('0x1f')]();};}function respondWithResult(_0x477bdd,_0x2a85ba){_0x2a85ba=_0x2a85ba||0xc8;return function(_0x3dd8c9){if(_0x3dd8c9){return _0x477bdd[_0xecf1('0x1e')](_0x2a85ba)[_0xecf1('0x20')](_0x3dd8c9);}};}function respondWithFilteredResult(_0x339b62,_0x21019a){return function(_0x1b72a5){if(_0x1b72a5){var _0x245881=typeof _0x21019a[_0xecf1('0x21')]===_0xecf1('0x22')&&typeof _0x21019a['limit']===_0xecf1('0x22');var _0xb43bf6=_0x1b72a5[_0xecf1('0x23')];var _0x2a1ead=_0x245881?0x0:_0x21019a['offset'];var _0x4f9624=_0x245881?_0x1b72a5[_0xecf1('0x23')]:_0x21019a[_0xecf1('0x21')]+_0x21019a[_0xecf1('0x24')];var _0x73cd1a;if(_0x4f9624>=_0xb43bf6){_0x4f9624=_0xb43bf6;_0x73cd1a=0xc8;}else{_0x73cd1a=0xce;}_0x339b62['status'](_0x73cd1a);return _0x339b62[_0xecf1('0x25')](_0xecf1('0x26'),_0x2a1ead+'-'+_0x4f9624+'/'+_0xb43bf6)[_0xecf1('0x20')](_0x1b72a5);}return null;};}function patchUpdates(_0x809f79){return function(_0xc83f5b){try{jsonpatch[_0xecf1('0x27')](_0xc83f5b,_0x809f79,!![]);}catch(_0x2b7c45){return BPromise[_0xecf1('0x28')](_0x2b7c45);}return _0xc83f5b[_0xecf1('0x29')]();};}function saveUpdates(_0x829fb2,_0x3d0e10){return function(_0x2dd2bc){if(_0x2dd2bc){return _0x2dd2bc[_0xecf1('0x2a')](_0x829fb2)[_0xecf1('0x2b')](function(_0x211dea){return _0x211dea;});}return null;};}function removeEntity(_0x2b3cfa,_0x3d1352){return function(_0x3679dc){if(_0x3679dc){return _0x3679dc['destroy']()['then'](function(){_0x2b3cfa['status'](0xcc)[_0xecf1('0x1f')]();});}};}function handleEntityNotFound(_0x373e1b,_0x38ec6e){return function(_0x1e47e9){if(!_0x1e47e9){_0x373e1b[_0xecf1('0x1d')](0x194);}return _0x1e47e9;};}function handleError(_0x54365e,_0xd3f731){_0xd3f731=_0xd3f731||0x1f4;return function(_0x2faaea){logger['error'](_0x2faaea['stack']);if(_0x2faaea['name']){delete _0x2faaea[_0xecf1('0x2c')];}_0x54365e['status'](_0xd3f731)[_0xecf1('0x2d')](_0x2faaea);};}exports['index']=function(_0x1fc9d4,_0x51bcb1){var _0x3b43bf={},_0x25eaa4={},_0x1c7baa={'count':0x0,'rows':[]};var _0x23a151=_[_0xecf1('0x2e')](db[_0xecf1('0x2f')][_0xecf1('0x30')],function(_0x344b21){return{'name':_0x344b21[_0xecf1('0x31')],'type':_0x344b21['type']['key']};});_0x25eaa4['model']=_[_0xecf1('0x2e')](_0x23a151,'name');_0x25eaa4[_0xecf1('0x32')]=_['keys'](_0x1fc9d4[_0xecf1('0x32')]);_0x25eaa4[_0xecf1('0x33')]=_['intersection'](_0x25eaa4['model'],_0x25eaa4[_0xecf1('0x32')]);_0x3b43bf[_0xecf1('0x34')]=_[_0xecf1('0x35')](_0x25eaa4[_0xecf1('0x36')],qs['fields'](_0x1fc9d4[_0xecf1('0x32')][_0xecf1('0x37')]));_0x3b43bf[_0xecf1('0x34')]=_0x3b43bf[_0xecf1('0x34')][_0xecf1('0x38')]?_0x3b43bf[_0xecf1('0x34')]:_0x25eaa4['model'];if(!_0x1fc9d4['query'][_0xecf1('0x39')](_0xecf1('0x3a'))){_0x3b43bf['limit']=qs['limit'](_0x1fc9d4[_0xecf1('0x32')][_0xecf1('0x24')]);_0x3b43bf[_0xecf1('0x21')]=qs[_0xecf1('0x21')](_0x1fc9d4[_0xecf1('0x32')][_0xecf1('0x21')]);}_0x3b43bf[_0xecf1('0x3b')]=qs[_0xecf1('0x3c')](_0x1fc9d4[_0xecf1('0x32')][_0xecf1('0x3c')]);_0x3b43bf[_0xecf1('0x3d')]=qs[_0xecf1('0x33')](_[_0xecf1('0x3e')](_0x1fc9d4[_0xecf1('0x32')],_0x25eaa4[_0xecf1('0x33')]),_0x23a151);if(_0x1fc9d4['query']['filter']){_0x3b43bf['where']=_['merge'](_0x3b43bf[_0xecf1('0x3d')],{'$or':_[_0xecf1('0x2e')](_0x23a151,function(_0xebd03){if(_0xebd03[_0xecf1('0x3f')]!=='VIRTUAL'){var _0x36de9a={};_0x36de9a[_0xebd03[_0xecf1('0x2c')]]={'$like':'%'+_0x1fc9d4[_0xecf1('0x32')][_0xecf1('0x40')]+'%'};return _0x36de9a;}})});}_0x3b43bf=_[_0xecf1('0x41')]({},_0x3b43bf,_0x1fc9d4[_0xecf1('0x42')]);var _0x2ba41c={'where':_0x3b43bf['where']};return db['VoiceQueueReport'][_0xecf1('0x23')](_0x2ba41c)[_0xecf1('0x2b')](function(_0x480db0){_0x1c7baa[_0xecf1('0x23')]=_0x480db0;if(_0x1fc9d4[_0xecf1('0x32')]['includeAll']){_0x3b43bf[_0xecf1('0x43')]=[{'all':!![]}];}return db[_0xecf1('0x2f')][_0xecf1('0x44')](_0x3b43bf);})['then'](function(_0x52ad7f){_0x1c7baa[_0xecf1('0x45')]=_0x52ad7f;return _0x1c7baa;})['then'](respondWithFilteredResult(_0x51bcb1,_0x3b43bf))['catch'](handleError(_0x51bcb1,null));};exports[_0xecf1('0x46')]=function(_0x3c198a,_0x2cdc87){var _0x370ee4={'raw':![],'where':{'id':_0x3c198a['params']['id']}},_0x56fd88={};_0x56fd88[_0xecf1('0x36')]=_[_0xecf1('0x47')](db[_0xecf1('0x2f')]['rawAttributes']);_0x56fd88[_0xecf1('0x32')]=_[_0xecf1('0x47')](_0x3c198a[_0xecf1('0x32')]);_0x56fd88['filters']=_[_0xecf1('0x35')](_0x56fd88[_0xecf1('0x36')],_0x56fd88[_0xecf1('0x32')]);_0x370ee4[_0xecf1('0x34')]=_[_0xecf1('0x35')](_0x56fd88[_0xecf1('0x36')],qs[_0xecf1('0x37')](_0x3c198a[_0xecf1('0x32')][_0xecf1('0x37')]));_0x370ee4[_0xecf1('0x34')]=_0x370ee4[_0xecf1('0x34')][_0xecf1('0x38')]?_0x370ee4[_0xecf1('0x34')]:_0x56fd88[_0xecf1('0x36')];if(_0x3c198a['query']['includeAll']){_0x370ee4[_0xecf1('0x43')]=[{'all':!![]}];}_0x370ee4=_[_0xecf1('0x41')]({},_0x370ee4,_0x3c198a[_0xecf1('0x42')]);return db['VoiceQueueReport']['find'](_0x370ee4)[_0xecf1('0x2b')](handleEntityNotFound(_0x2cdc87,null))[_0xecf1('0x2b')](respondWithResult(_0x2cdc87,null))[_0xecf1('0x48')](handleError(_0x2cdc87,null));};exports['create']=function(_0x34c49d,_0x27d77f){return db[_0xecf1('0x2f')][_0xecf1('0x49')](_0x34c49d['body'],{})['then'](respondWithResult(_0x27d77f,0xc9))[_0xecf1('0x48')](handleError(_0x27d77f,null));};exports[_0xecf1('0x2a')]=function(_0x404073,_0x5c1a75){if(_0x404073[_0xecf1('0x4a')]['id']){delete _0x404073[_0xecf1('0x4a')]['id'];}return db[_0xecf1('0x2f')][_0xecf1('0x4b')]({'where':{'id':_0x404073['params']['id']}})[_0xecf1('0x2b')](handleEntityNotFound(_0x5c1a75,null))[_0xecf1('0x2b')](saveUpdates(_0x404073['body'],null))['then'](respondWithResult(_0x5c1a75,null))['catch'](handleError(_0x5c1a75,null));};exports[_0xecf1('0x4c')]=function(_0x2ca74f,_0x5c78dd){return db[_0xecf1('0x2f')][_0xecf1('0x4b')]({'where':{'id':_0x2ca74f[_0xecf1('0x4d')]['id']}})[_0xecf1('0x2b')](handleEntityNotFound(_0x5c78dd,null))[_0xecf1('0x2b')](removeEntity(_0x5c78dd,null))['catch'](handleError(_0x5c78dd,null));};exports['describe']=function(_0xa4e00e,_0x12a014){return db[_0xecf1('0x2f')][_0xecf1('0x4e')]()['then'](respondWithResult(_0x12a014,null))[_0xecf1('0x48')](handleError(_0x12a014,null));};exports['getVoiceQueuesReport']=function(_0x29aa0e,_0x1266b3){var _0xe75664={},_0x482d79={},_0x5edc29={'count':0x0,'rows':[]};_0x482d79['model']=_[_0xecf1('0x47')](db[_0xecf1('0x2f')]['rawAttributes']);_0x482d79[_0xecf1('0x32')]=_[_0xecf1('0x47')](_0x29aa0e['query']);_0x482d79[_0xecf1('0x33')]=_[_0xecf1('0x35')](_0x482d79[_0xecf1('0x36')],_0x482d79[_0xecf1('0x32')]);_0xe75664[_0xecf1('0x34')]=_[_0xecf1('0x35')](_0x482d79['model'],qs[_0xecf1('0x37')](_0x29aa0e['query'][_0xecf1('0x37')]));_0xe75664[_0xecf1('0x34')]=_0xe75664[_0xecf1('0x34')][_0xecf1('0x38')]?_0xe75664[_0xecf1('0x34')]:_0x482d79[_0xecf1('0x36')];if(!_0x29aa0e[_0xecf1('0x32')][_0xecf1('0x39')](_0xecf1('0x3a'))){_0xe75664[_0xecf1('0x24')]=qs['limit'](_0x29aa0e[_0xecf1('0x32')][_0xecf1('0x24')]);_0xe75664[_0xecf1('0x21')]=qs[_0xecf1('0x21')](_0x29aa0e[_0xecf1('0x32')]['offset']);}_0xe75664['order']=qs[_0xecf1('0x3c')](_0x29aa0e[_0xecf1('0x32')][_0xecf1('0x3c')]);_0xe75664[_0xecf1('0x3d')]=qs[_0xecf1('0x33')](_[_0xecf1('0x3e')](_0x29aa0e['query'],_0x482d79[_0xecf1('0x33')]));if(_0x29aa0e[_0xecf1('0x32')]['filter']){_0xe75664[_0xecf1('0x3d')]=_['merge'](_0xe75664[_0xecf1('0x3d')],{'$or':_[_0xecf1('0x2e')](_0xe75664[_0xecf1('0x34')],function(_0x112c77){var _0x3f0e40={};_0x3f0e40[_0x112c77]={'$like':'%'+_0x29aa0e[_0xecf1('0x32')][_0xecf1('0x40')]+'%'};return _0x3f0e40;})});}_0xe75664=_[_0xecf1('0x41')]({},_0xe75664,_0x29aa0e[_0xecf1('0x42')]);var _0x33b452={'where':_0xe75664[_0xecf1('0x3d')]};return db[_0xecf1('0x2f')][_0xecf1('0x23')](_0x33b452)[_0xecf1('0x2b')](function(_0x285e0c){_0x5edc29['count']=_0x285e0c;if(_0x29aa0e['query'][_0xecf1('0x4f')]){_0xe75664[_0xecf1('0x43')]=[{'all':!![]}];}return db[_0xecf1('0x2f')][_0xecf1('0x44')](_0xe75664);})[_0xecf1('0x2b')](function(_0x4e4cac){_0x5edc29['rows']=_0x4e4cac;return _0x5edc29;})[_0xecf1('0x2b')](respondWithFilteredResult(_0x1266b3,_0xe75664,_0xecf1('0x50')))[_0xecf1('0x48')](handleError(_0x1266b3,null,_0xecf1('0x50')));}; \ No newline at end of file +var _0x9574=['find','create','body','update','params','describe','getVoiceQueuesReport','sort','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','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','redis','defaults','register','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length'];(function(_0x40a31b,_0x56bf74){var _0x5e6391=function(_0x21d7b2){while(--_0x21d7b2){_0x40a31b['push'](_0x40a31b['shift']());}};_0x5e6391(++_0x56bf74);}(_0x9574,0x150));var _0x4957=function(_0x2daedb,_0x3a2eb5){_0x2daedb=_0x2daedb-0x0;var _0x3e7747=_0x9574[_0x2daedb];return _0x3e7747;};'use strict';var emlformat=require(_0x4957('0x0'));var rimraf=require(_0x4957('0x1'));var zipdir=require(_0x4957('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4957('0x3'));var moment=require(_0x4957('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4957('0x5'));var util=require(_0x4957('0x6'));var path=require('path');var sox=require(_0x4957('0x7'));var csv=require(_0x4957('0x8'));var ejs=require(_0x4957('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4957('0xa'));var crypto=require(_0x4957('0xb'));var jsforce=require(_0x4957('0xc'));var deskjs=require(_0x4957('0xd'));var toCsv=require(_0x4957('0x8'));var querystring=require(_0x4957('0xe'));var Papa=require(_0x4957('0xf'));var Redis=require(_0x4957('0x10'));var authService=require(_0x4957('0x11'));var qs=require(_0x4957('0x12'));var as=require(_0x4957('0x13'));var hardwareService=require(_0x4957('0x14'));var logger=require(_0x4957('0x15'))(_0x4957('0x16'));var utils=require(_0x4957('0x17'));var config=require(_0x4957('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x4957('0x19')]=_[_0x4957('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4957('0x19')]));require('./voiceQueueReport.socket')[_0x4957('0x1b')](socket);function respondWithStatusCode(_0x3bd47c,_0x235c35){_0x235c35=_0x235c35||0xcc;return function(_0x39d113){if(_0x39d113){return _0x3bd47c['sendStatus'](_0x235c35);}return _0x3bd47c[_0x4957('0x1c')](_0x235c35)[_0x4957('0x1d')]();};}function respondWithResult(_0x1f974a,_0x3f99b7){_0x3f99b7=_0x3f99b7||0xc8;return function(_0x5a5e43){if(_0x5a5e43){return _0x1f974a[_0x4957('0x1c')](_0x3f99b7)[_0x4957('0x1e')](_0x5a5e43);}};}function respondWithFilteredResult(_0x5f10ab,_0x1774b1){return function(_0x344257){if(_0x344257){var _0x1453a5=typeof _0x1774b1[_0x4957('0x1f')]===_0x4957('0x20')&&typeof _0x1774b1['limit']===_0x4957('0x20');var _0x28c5da=_0x344257[_0x4957('0x21')];var _0x31e291=_0x1453a5?0x0:_0x1774b1['offset'];var _0x307718=_0x1453a5?_0x344257[_0x4957('0x21')]:_0x1774b1[_0x4957('0x1f')]+_0x1774b1[_0x4957('0x22')];var _0x4fc83e;if(_0x307718>=_0x28c5da){_0x307718=_0x28c5da;_0x4fc83e=0xc8;}else{_0x4fc83e=0xce;}_0x5f10ab[_0x4957('0x1c')](_0x4fc83e);return _0x5f10ab['set'](_0x4957('0x23'),_0x31e291+'-'+_0x307718+'/'+_0x28c5da)[_0x4957('0x1e')](_0x344257);}return null;};}function patchUpdates(_0x2f739f){return function(_0x15b86b){try{jsonpatch[_0x4957('0x24')](_0x15b86b,_0x2f739f,!![]);}catch(_0x54d185){return BPromise[_0x4957('0x25')](_0x54d185);}return _0x15b86b[_0x4957('0x26')]();};}function saveUpdates(_0x56acdf,_0x1e7d4f){return function(_0x530119){if(_0x530119){return _0x530119['update'](_0x56acdf)[_0x4957('0x27')](function(_0x2cf650){return _0x2cf650;});}return null;};}function removeEntity(_0xb478de,_0x39c473){return function(_0x2654b6){if(_0x2654b6){return _0x2654b6['destroy']()[_0x4957('0x27')](function(){_0xb478de[_0x4957('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d5f66,_0x22a284){return function(_0xb5cd51){if(!_0xb5cd51){_0x2d5f66[_0x4957('0x28')](0x194);}return _0xb5cd51;};}function handleError(_0x29fa04,_0x5b0bd0){_0x5b0bd0=_0x5b0bd0||0x1f4;return function(_0x5732f1){logger[_0x4957('0x29')](_0x5732f1[_0x4957('0x2a')]);if(_0x5732f1[_0x4957('0x2b')]){delete _0x5732f1[_0x4957('0x2b')];}_0x29fa04[_0x4957('0x1c')](_0x5b0bd0)[_0x4957('0x2c')](_0x5732f1);};}exports[_0x4957('0x2d')]=function(_0x2c538c,_0x10e4c6){var _0x264450={},_0x34ba2a={},_0x240d3a={'count':0x0,'rows':[]};var _0x3251a7=_[_0x4957('0x2e')](db[_0x4957('0x2f')][_0x4957('0x30')],function(_0x5cf43c){return{'name':_0x5cf43c[_0x4957('0x31')],'type':_0x5cf43c[_0x4957('0x32')]['key']};});_0x34ba2a[_0x4957('0x33')]=_[_0x4957('0x2e')](_0x3251a7,'name');_0x34ba2a[_0x4957('0x34')]=_[_0x4957('0x35')](_0x2c538c['query']);_0x34ba2a['filters']=_[_0x4957('0x36')](_0x34ba2a['model'],_0x34ba2a[_0x4957('0x34')]);_0x264450['attributes']=_['intersection'](_0x34ba2a[_0x4957('0x33')],qs[_0x4957('0x37')](_0x2c538c[_0x4957('0x34')]['fields']));_0x264450['attributes']=_0x264450[_0x4957('0x38')]['length']?_0x264450[_0x4957('0x38')]:_0x34ba2a['model'];if(!_0x2c538c['query'][_0x4957('0x39')](_0x4957('0x3a'))){_0x264450[_0x4957('0x22')]=qs[_0x4957('0x22')](_0x2c538c['query'][_0x4957('0x22')]);_0x264450[_0x4957('0x1f')]=qs['offset'](_0x2c538c['query'][_0x4957('0x1f')]);}_0x264450[_0x4957('0x3b')]=qs['sort'](_0x2c538c[_0x4957('0x34')]['sort']);_0x264450[_0x4957('0x3c')]=qs[_0x4957('0x3d')](_[_0x4957('0x3e')](_0x2c538c[_0x4957('0x34')],_0x34ba2a[_0x4957('0x3d')]),_0x3251a7);if(_0x2c538c[_0x4957('0x34')][_0x4957('0x3f')]){_0x264450[_0x4957('0x3c')]=_[_0x4957('0x40')](_0x264450[_0x4957('0x3c')],{'$or':_['map'](_0x3251a7,function(_0x1cb2a6){if(_0x1cb2a6['type']!==_0x4957('0x41')){var _0x555d2d={};_0x555d2d[_0x1cb2a6[_0x4957('0x2b')]]={'$like':'%'+_0x2c538c[_0x4957('0x34')][_0x4957('0x3f')]+'%'};return _0x555d2d;}})});}_0x264450=_[_0x4957('0x40')]({},_0x264450,_0x2c538c[_0x4957('0x42')]);var _0x535f08={'where':_0x264450[_0x4957('0x3c')]};return db[_0x4957('0x2f')][_0x4957('0x21')](_0x535f08)[_0x4957('0x27')](function(_0x3fab7a){_0x240d3a['count']=_0x3fab7a;if(_0x2c538c[_0x4957('0x34')][_0x4957('0x43')]){_0x264450[_0x4957('0x44')]=[{'all':!![]}];}return db[_0x4957('0x2f')][_0x4957('0x45')](_0x264450);})[_0x4957('0x27')](function(_0x18c7c9){_0x240d3a[_0x4957('0x46')]=_0x18c7c9;return _0x240d3a;})['then'](respondWithFilteredResult(_0x10e4c6,_0x264450))[_0x4957('0x47')](handleError(_0x10e4c6,null));};exports[_0x4957('0x48')]=function(_0x4686c0,_0x4cda58){var _0x3be06e={'raw':![],'where':{'id':_0x4686c0['params']['id']}},_0x4b6997={};_0x4b6997['model']=_['keys'](db[_0x4957('0x2f')][_0x4957('0x30')]);_0x4b6997['query']=_['keys'](_0x4686c0[_0x4957('0x34')]);_0x4b6997[_0x4957('0x3d')]=_[_0x4957('0x36')](_0x4b6997[_0x4957('0x33')],_0x4b6997[_0x4957('0x34')]);_0x3be06e[_0x4957('0x38')]=_[_0x4957('0x36')](_0x4b6997['model'],qs[_0x4957('0x37')](_0x4686c0[_0x4957('0x34')][_0x4957('0x37')]));_0x3be06e[_0x4957('0x38')]=_0x3be06e[_0x4957('0x38')][_0x4957('0x49')]?_0x3be06e['attributes']:_0x4b6997[_0x4957('0x33')];if(_0x4686c0['query'][_0x4957('0x43')]){_0x3be06e[_0x4957('0x44')]=[{'all':!![]}];}_0x3be06e=_[_0x4957('0x40')]({},_0x3be06e,_0x4686c0[_0x4957('0x42')]);return db[_0x4957('0x2f')][_0x4957('0x4a')](_0x3be06e)[_0x4957('0x27')](handleEntityNotFound(_0x4cda58,null))[_0x4957('0x27')](respondWithResult(_0x4cda58,null))[_0x4957('0x47')](handleError(_0x4cda58,null));};exports[_0x4957('0x4b')]=function(_0x12a394,_0x7cadab){return db[_0x4957('0x2f')][_0x4957('0x4b')](_0x12a394[_0x4957('0x4c')],{})[_0x4957('0x27')](respondWithResult(_0x7cadab,0xc9))[_0x4957('0x47')](handleError(_0x7cadab,null));};exports[_0x4957('0x4d')]=function(_0x9b1779,_0x34441b){if(_0x9b1779[_0x4957('0x4c')]['id']){delete _0x9b1779[_0x4957('0x4c')]['id'];}return db[_0x4957('0x2f')][_0x4957('0x4a')]({'where':{'id':_0x9b1779[_0x4957('0x4e')]['id']}})[_0x4957('0x27')](handleEntityNotFound(_0x34441b,null))[_0x4957('0x27')](saveUpdates(_0x9b1779[_0x4957('0x4c')],null))[_0x4957('0x27')](respondWithResult(_0x34441b,null))[_0x4957('0x47')](handleError(_0x34441b,null));};exports['destroy']=function(_0x349d72,_0x4e4666){return db['VoiceQueueReport']['find']({'where':{'id':_0x349d72['params']['id']}})[_0x4957('0x27')](handleEntityNotFound(_0x4e4666,null))[_0x4957('0x27')](removeEntity(_0x4e4666,null))[_0x4957('0x47')](handleError(_0x4e4666,null));};exports[_0x4957('0x4f')]=function(_0x4065e9,_0x118a2e){return db[_0x4957('0x2f')][_0x4957('0x4f')]()[_0x4957('0x27')](respondWithResult(_0x118a2e,null))[_0x4957('0x47')](handleError(_0x118a2e,null));};exports[_0x4957('0x50')]=function(_0x591f9a,_0x5d7170){var _0x4ff72e={},_0x4cd264={},_0x5b8bde={'count':0x0,'rows':[]};_0x4cd264[_0x4957('0x33')]=_[_0x4957('0x35')](db[_0x4957('0x2f')][_0x4957('0x30')]);_0x4cd264['query']=_[_0x4957('0x35')](_0x591f9a[_0x4957('0x34')]);_0x4cd264[_0x4957('0x3d')]=_[_0x4957('0x36')](_0x4cd264['model'],_0x4cd264['query']);_0x4ff72e[_0x4957('0x38')]=_['intersection'](_0x4cd264[_0x4957('0x33')],qs[_0x4957('0x37')](_0x591f9a[_0x4957('0x34')][_0x4957('0x37')]));_0x4ff72e[_0x4957('0x38')]=_0x4ff72e[_0x4957('0x38')][_0x4957('0x49')]?_0x4ff72e[_0x4957('0x38')]:_0x4cd264[_0x4957('0x33')];if(!_0x591f9a[_0x4957('0x34')][_0x4957('0x39')](_0x4957('0x3a'))){_0x4ff72e['limit']=qs[_0x4957('0x22')](_0x591f9a[_0x4957('0x34')][_0x4957('0x22')]);_0x4ff72e[_0x4957('0x1f')]=qs[_0x4957('0x1f')](_0x591f9a[_0x4957('0x34')][_0x4957('0x1f')]);}_0x4ff72e[_0x4957('0x3b')]=qs[_0x4957('0x51')](_0x591f9a['query'][_0x4957('0x51')]);_0x4ff72e[_0x4957('0x3c')]=qs['filters'](_[_0x4957('0x3e')](_0x591f9a['query'],_0x4cd264['filters']));if(_0x591f9a['query'][_0x4957('0x3f')]){_0x4ff72e[_0x4957('0x3c')]=_[_0x4957('0x40')](_0x4ff72e[_0x4957('0x3c')],{'$or':_[_0x4957('0x2e')](_0x4ff72e['attributes'],function(_0x4cd6ef){var _0x4069de={};_0x4069de[_0x4cd6ef]={'$like':'%'+_0x591f9a['query'][_0x4957('0x3f')]+'%'};return _0x4069de;})});}_0x4ff72e=_[_0x4957('0x40')]({},_0x4ff72e,_0x591f9a[_0x4957('0x42')]);var _0x5a8c81={'where':_0x4ff72e['where']};return db['VoiceQueueReport'][_0x4957('0x21')](_0x5a8c81)['then'](function(_0x37cca0){_0x5b8bde['count']=_0x37cca0;if(_0x591f9a[_0x4957('0x34')][_0x4957('0x43')]){_0x4ff72e['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x4957('0x45')](_0x4ff72e);})[_0x4957('0x27')](function(_0x46c330){_0x5b8bde[_0x4957('0x46')]=_0x46c330;return _0x5b8bde;})[_0x4957('0x27')](respondWithFilteredResult(_0x5d7170,_0x4ff72e,'getVoiceQueuesReport'))[_0x4957('0x47')](handleError(_0x5d7170,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 8bcc674..92bea6b 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 _0xe46e=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xe46e,0x64));var _0xee46=function(_0x4a618b,_0x11d42e){_0x4a618b=_0x4a618b-0x0;var _0x1a006d=_0xe46e[_0x4a618b];return _0x1a006d;};'use strict';var EventEmitter=require(_0xee46('0x0'));var VoiceQueueReport=require(_0xee46('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xee46('0x2')](0x0);var events={'afterCreate':_0xee46('0x3'),'afterUpdate':_0xee46('0x4'),'afterDestroy':_0xee46('0x5')};function emitEvent(_0x392847){return function(_0x12f7b7,_0x320c2d,_0x3bda05){VoiceQueueReportEvents['emit'](_0x392847+':'+_0x12f7b7['id'],_0x12f7b7);VoiceQueueReportEvents[_0xee46('0x6')](_0x392847,_0x12f7b7);_0x3bda05(null);};}for(var e in events){if(events[_0xee46('0x7')](e)){var event=events[e];VoiceQueueReport[_0xee46('0x8')](e,emitEvent(event));}}module[_0xee46('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x6606=['update','emit','hasOwnProperty','hook','VoiceQueueReport','save'];(function(_0x1bb889,_0x49c4b5){var _0xd8b76d=function(_0x1df471){while(--_0x1df471){_0x1bb889['push'](_0x1bb889['shift']());}};_0xd8b76d(++_0x49c4b5);}(_0x6606,0x1cc));var _0x6660=function(_0x3f0726,_0x4ecabf){_0x3f0726=_0x3f0726-0x0;var _0x1fbba9=_0x6606[_0x3f0726];return _0x1fbba9;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0x6660('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6660('0x1'),'afterUpdate':_0x6660('0x2'),'afterDestroy':'remove'};function emitEvent(_0x581dc2){return function(_0x5e3158,_0x35c6c3,_0x426c99){VoiceQueueReportEvents[_0x6660('0x3')](_0x581dc2+':'+_0x5e3158['id'],_0x5e3158);VoiceQueueReportEvents[_0x6660('0x3')](_0x581dc2,_0x5e3158);_0x426c99(null);};}for(var e in events){if(events[_0x6660('0x4')](e)){var event=events[e];VoiceQueueReport[_0x6660('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 410546b..24031c6 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 _0xc701=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceQueueReport.attributes','define','VoiceQueueReport','util'];(function(_0x1f4470,_0x36425b){var _0x4e003e=function(_0x2ac510){while(--_0x2ac510){_0x1f4470['push'](_0x1f4470['shift']());}};_0x4e003e(++_0x36425b);}(_0xc701,0xbd));var _0x1c70=function(_0x43bd66,_0x27e9b3){_0x43bd66=_0x43bd66-0x0;var _0x5195cb=_0xc701[_0x43bd66];return _0x5195cb;};'use strict';var _=require('lodash');var util=require(_0x1c70('0x0'));var logger=require(_0x1c70('0x1'))(_0x1c70('0x2'));var moment=require(_0x1c70('0x3'));var BPromise=require(_0x1c70('0x4'));var rp=require(_0x1c70('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1c70('0x6'));var attributes=require(_0x1c70('0x7'));module['exports']=function(_0x405eea,_0xb6a207){return _0x405eea[_0x1c70('0x8')](_0x1c70('0x9'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0xec2f=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util'];(function(_0x5820c6,_0x585c3b){var _0x2b98b5=function(_0x1c4b3d){while(--_0x1c4b3d){_0x5820c6['push'](_0x5820c6['shift']());}};_0x2b98b5(++_0x585c3b);}(_0xec2f,0x1de));var _0xfec2=function(_0x2c072b,_0x6c4449){_0x2c072b=_0x2c072b-0x0;var _0x167ee3=_0xec2f[_0x2c072b];return _0x167ee3;};'use strict';var _=require(_0xfec2('0x0'));var util=require(_0xfec2('0x1'));var logger=require(_0xfec2('0x2'))('api');var moment=require(_0xfec2('0x3'));var BPromise=require(_0xfec2('0x4'));var rp=require(_0xfec2('0x5'));var fs=require('fs');var path=require(_0xfec2('0x6'));var rimraf=require(_0xfec2('0x7'));var config=require(_0xfec2('0x8'));var attributes=require(_0xfec2('0x9'));module[_0xfec2('0xa')]=function(_0x446f84,_0x29a1d7){return _0x446f84[_0xfec2('0xb')](_0xfec2('0xc'),attributes,{'tableName':_0xfec2('0xd'),'paranoid':![],'indexes':[{'fields':[_0xfec2('0xe')]},{'fields':[_0xfec2('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index e6fb981..c82568d 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 _0xc819=['socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','include','map','model','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0xc819,0x17e));var _0x9c81=function(_0x14633a,_0x3b1b90){_0x14633a=_0x14633a-0x0;var _0x2aaeeb=_0xc819[_0x14633a];return _0x2aaeeb;};'use strict';var _=require('lodash');var util=require(_0x9c81('0x0'));var moment=require(_0x9c81('0x1'));var BPromise=require(_0x9c81('0x2'));var rs=require(_0x9c81('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c81('0x4'))['db'];var utils=require(_0x9c81('0x5'));var logger=require(_0x9c81('0x6'))(_0x9c81('0x7'));var config=require(_0x9c81('0x8'));var jayson=require(_0x9c81('0x9'));var client=jayson['client'][_0x9c81('0xa')]({'port':0x232a});config[_0x9c81('0xb')]=_[_0x9c81('0xc')](config[_0x9c81('0xb')],{'host':_0x9c81('0xd'),'port':0x18eb});var socket=require(_0x9c81('0xe'))(new Redis(config['redis']));require(_0x9c81('0xf'))[_0x9c81('0x10')](socket);function respondWithRpcPromise(_0x55b0b2,_0x59dd9f,_0x5c5d4d){return new BPromise(function(_0x395670,_0x3e4d45){return client[_0x9c81('0x11')](_0x55b0b2,_0x5c5d4d)[_0x9c81('0x12')](function(_0x4116db){logger[_0x9c81('0x13')](_0x9c81('0x14'),_0x59dd9f,_0x9c81('0x15'));logger[_0x9c81('0x16')](_0x9c81('0x17'),_0x59dd9f,_0x9c81('0x15'),JSON[_0x9c81('0x18')](_0x4116db));if(_0x4116db[_0x9c81('0x19')]){if(_0x4116db[_0x9c81('0x19')][_0x9c81('0x1a')]===0x1f4){logger[_0x9c81('0x19')](_0x9c81('0x14'),_0x59dd9f,_0x4116db[_0x9c81('0x19')][_0x9c81('0x1b')]);return _0x3e4d45(_0x4116db[_0x9c81('0x19')][_0x9c81('0x1b')]);}logger[_0x9c81('0x19')](_0x9c81('0x14'),_0x59dd9f,_0x4116db[_0x9c81('0x19')][_0x9c81('0x1b')]);return _0x395670(_0x4116db['error'][_0x9c81('0x1b')]);}else{logger[_0x9c81('0x13')](_0x9c81('0x14'),_0x59dd9f,_0x9c81('0x15'));_0x395670(_0x4116db[_0x9c81('0x1c')][_0x9c81('0x1b')]);}})[_0x9c81('0x1d')](function(_0x42baf8){logger[_0x9c81('0x19')](_0x9c81('0x14'),_0x59dd9f,_0x42baf8);_0x3e4d45(_0x42baf8);});});}exports[_0x9c81('0x1e')]=function(_0x337810){var _0x5a6224=this;return new Promise(function(_0x5bae74,_0x3f5d0b){return db[_0x9c81('0x1f')]['findAll']({'raw':_0x337810['options']?_0x337810[_0x9c81('0x20')][_0x9c81('0x21')]===undefined?!![]:![]:!![],'where':_0x337810['options']?_0x337810['options'][_0x9c81('0x22')]||null:null,'attributes':_0x337810[_0x9c81('0x20')]?_0x337810[_0x9c81('0x20')][_0x9c81('0x23')]||null:null,'limit':_0x337810[_0x9c81('0x20')]?_0x337810[_0x9c81('0x20')][_0x9c81('0x24')]||null:null,'include':_0x337810[_0x9c81('0x20')]?_0x337810[_0x9c81('0x20')][_0x9c81('0x25')]?_[_0x9c81('0x26')](_0x337810[_0x9c81('0x20')]['include'],function(_0x5c825f){return{'model':db[_0x5c825f[_0x9c81('0x27')]],'as':_0x5c825f['as'],'attributes':_0x5c825f[_0x9c81('0x23')],'include':_0x5c825f[_0x9c81('0x25')]?_[_0x9c81('0x26')](_0x5c825f[_0x9c81('0x25')],function(_0x1bc30b){return{'model':db[_0x1bc30b[_0x9c81('0x27')]],'as':_0x1bc30b['as'],'attributes':_0x1bc30b[_0x9c81('0x23')],'include':_0x1bc30b[_0x9c81('0x25')]?_[_0x9c81('0x26')](_0x1bc30b[_0x9c81('0x25')],function(_0x1d7b42){return{'model':db[_0x1d7b42[_0x9c81('0x27')]],'as':_0x1d7b42['as'],'attributes':_0x1d7b42[_0x9c81('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ce847){logger[_0x9c81('0x13')](_0x9c81('0x1e'),_0x337810);logger[_0x9c81('0x16')]('GetVoiceQueueReport',_0x337810,JSON['stringify'](_0x5ce847));_0x5bae74(_0x5ce847);})[_0x9c81('0x1d')](function(_0x5d0c77){logger[_0x9c81('0x19')](_0x9c81('0x1e'),_0x5d0c77['message'],_0x337810);_0x3f5d0b(_0x5a6224[_0x9c81('0x19')](0x1f4,_0x5d0c77[_0x9c81('0x1b')]));});});};exports['CreateVoiceQueueReport']=function(_0x3a95fc){var _0x4379ea=this;return new Promise(function(_0x55be5c,_0xa33605){return db[_0x9c81('0x1f')][_0x9c81('0x28')](_0x3a95fc[_0x9c81('0x29')],{'raw':_0x3a95fc[_0x9c81('0x20')]?_0x3a95fc['options'][_0x9c81('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x43d153){logger[_0x9c81('0x13')](_0x9c81('0x2a'),_0x3a95fc);logger[_0x9c81('0x16')](_0x9c81('0x2a'),_0x3a95fc,JSON[_0x9c81('0x18')](_0x43d153));_0x55be5c(_0x43d153);})[_0x9c81('0x1d')](function(_0x1dd53a){logger[_0x9c81('0x19')]('CreateVoiceQueueReport',_0x1dd53a[_0x9c81('0x1b')],_0x3a95fc);_0xa33605(_0x4379ea[_0x9c81('0x19')](0x1f4,_0x1dd53a['message']));});});};exports[_0x9c81('0x2b')]=function(_0x5394d3){var _0x16fb00=this;return new Promise(function(_0x5065bb,_0x1ae795){return db[_0x9c81('0x1f')]['update'](_0x5394d3[_0x9c81('0x29')],{'raw':_0x5394d3['options']?_0x5394d3[_0x9c81('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5394d3[_0x9c81('0x20')]?_0x5394d3['options'][_0x9c81('0x22')]||null:null,'attributes':_0x5394d3[_0x9c81('0x20')]?_0x5394d3[_0x9c81('0x20')][_0x9c81('0x23')]||null:null,'limit':_0x5394d3[_0x9c81('0x20')]?_0x5394d3[_0x9c81('0x20')]['limit']||null:null})[_0x9c81('0x12')](function(_0x383f92){logger[_0x9c81('0x13')]('UpdateVoiceQueueReport',_0x5394d3);logger['debug'](_0x9c81('0x2b'),_0x5394d3,JSON['stringify'](_0x383f92));_0x5065bb(_0x383f92);})[_0x9c81('0x1d')](function(_0x158dc3){logger[_0x9c81('0x19')](_0x9c81('0x2b'),_0x158dc3[_0x9c81('0x1b')],_0x5394d3);_0x1ae795(_0x16fb00[_0x9c81('0x19')](0x1f4,_0x158dc3[_0x9c81('0x1b')]));});});}; \ No newline at end of file +var _0xf909=['request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','include','map','model','then','debug','CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','request','info','VoiceQueueReport,\x20%s,\x20%s'];(function(_0x590985,_0x3a1e02){var _0x2d8d61=function(_0x406e48){while(--_0x406e48){_0x590985['push'](_0x590985['shift']());}};_0x2d8d61(++_0x3a1e02);}(_0xf909,0x1d0));var _0x9f90=function(_0x133ec8,_0x3fb9e7){_0x133ec8=_0x133ec8-0x0;var _0xba42a4=_0xf909[_0x133ec8];return _0xba42a4;};'use strict';var _=require(_0x9f90('0x0'));var util=require(_0x9f90('0x1'));var moment=require(_0x9f90('0x2'));var BPromise=require(_0x9f90('0x3'));var rs=require(_0x9f90('0x4'));var fs=require('fs');var Redis=require(_0x9f90('0x5'));var db=require(_0x9f90('0x6'))['db'];var utils=require(_0x9f90('0x7'));var logger=require(_0x9f90('0x8'))(_0x9f90('0x9'));var config=require(_0x9f90('0xa'));var jayson=require(_0x9f90('0xb'));var client=jayson['client'][_0x9f90('0xc')]({'port':0x232a});config[_0x9f90('0xd')]=_[_0x9f90('0xe')](config[_0x9f90('0xd')],{'host':_0x9f90('0xf'),'port':0x18eb});var socket=require(_0x9f90('0x10'))(new Redis(config[_0x9f90('0xd')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x5782e4,_0x5b09de,_0x21cb0c){return new BPromise(function(_0x346caa,_0x2fd877){return client[_0x9f90('0x11')](_0x5782e4,_0x21cb0c)['then'](function(_0x166c60){logger[_0x9f90('0x12')](_0x9f90('0x13'),_0x5b09de,_0x9f90('0x14'));logger['debug'](_0x9f90('0x15'),_0x5b09de,'request\x20sent',JSON[_0x9f90('0x16')](_0x166c60));if(_0x166c60['error']){if(_0x166c60[_0x9f90('0x17')][_0x9f90('0x18')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x5b09de,_0x166c60[_0x9f90('0x17')][_0x9f90('0x19')]);return _0x2fd877(_0x166c60[_0x9f90('0x17')][_0x9f90('0x19')]);}logger[_0x9f90('0x17')](_0x9f90('0x13'),_0x5b09de,_0x166c60[_0x9f90('0x17')]['message']);return _0x346caa(_0x166c60['error']['message']);}else{logger[_0x9f90('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x5b09de,_0x9f90('0x14'));_0x346caa(_0x166c60['result'][_0x9f90('0x19')]);}})[_0x9f90('0x1a')](function(_0x3f7657){logger[_0x9f90('0x17')](_0x9f90('0x13'),_0x5b09de,_0x3f7657);_0x2fd877(_0x3f7657);});});}exports[_0x9f90('0x1b')]=function(_0x817ac1){var _0x3d0525=this;return new Promise(function(_0x1ab553,_0x1075e5){return db['VoiceQueueReport'][_0x9f90('0x1c')]({'raw':_0x817ac1['options']?_0x817ac1[_0x9f90('0x1d')][_0x9f90('0x1e')]===undefined?!![]:![]:!![],'where':_0x817ac1['options']?_0x817ac1[_0x9f90('0x1d')][_0x9f90('0x1f')]||null:null,'attributes':_0x817ac1[_0x9f90('0x1d')]?_0x817ac1[_0x9f90('0x1d')][_0x9f90('0x20')]||null:null,'limit':_0x817ac1[_0x9f90('0x1d')]?_0x817ac1[_0x9f90('0x1d')]['limit']||null:null,'include':_0x817ac1[_0x9f90('0x1d')]?_0x817ac1[_0x9f90('0x1d')][_0x9f90('0x21')]?_[_0x9f90('0x22')](_0x817ac1[_0x9f90('0x1d')][_0x9f90('0x21')],function(_0x5b5721){return{'model':db[_0x5b5721[_0x9f90('0x23')]],'as':_0x5b5721['as'],'attributes':_0x5b5721[_0x9f90('0x20')],'include':_0x5b5721[_0x9f90('0x21')]?_[_0x9f90('0x22')](_0x5b5721[_0x9f90('0x21')],function(_0x5549f5){return{'model':db[_0x5549f5[_0x9f90('0x23')]],'as':_0x5549f5['as'],'attributes':_0x5549f5['attributes'],'include':_0x5549f5[_0x9f90('0x21')]?_['map'](_0x5549f5[_0x9f90('0x21')],function(_0x5d8e40){return{'model':db[_0x5d8e40[_0x9f90('0x23')]],'as':_0x5d8e40['as'],'attributes':_0x5d8e40['attributes']};}):[]};}):[]};}):[]:[]})[_0x9f90('0x24')](function(_0x260eb5){logger[_0x9f90('0x12')](_0x9f90('0x1b'),_0x817ac1);logger[_0x9f90('0x25')](_0x9f90('0x1b'),_0x817ac1,JSON['stringify'](_0x260eb5));_0x1ab553(_0x260eb5);})[_0x9f90('0x1a')](function(_0x157915){logger[_0x9f90('0x17')]('GetVoiceQueueReport',_0x157915[_0x9f90('0x19')],_0x817ac1);_0x1075e5(_0x3d0525[_0x9f90('0x17')](0x1f4,_0x157915[_0x9f90('0x19')]));});});};exports[_0x9f90('0x26')]=function(_0x1ca17e){var _0x42b1d1=this;return new Promise(function(_0x56d600,_0x37d9e9){return db[_0x9f90('0x27')][_0x9f90('0x28')](_0x1ca17e[_0x9f90('0x29')],{'raw':_0x1ca17e[_0x9f90('0x1d')]?_0x1ca17e[_0x9f90('0x1d')][_0x9f90('0x1e')]===undefined?!![]:![]:!![]})[_0x9f90('0x24')](function(_0x408a57){logger['info']('CreateVoiceQueueReport',_0x1ca17e);logger[_0x9f90('0x25')](_0x9f90('0x26'),_0x1ca17e,JSON[_0x9f90('0x16')](_0x408a57));_0x56d600(_0x408a57);})[_0x9f90('0x1a')](function(_0x4ca802){logger[_0x9f90('0x17')]('CreateVoiceQueueReport',_0x4ca802[_0x9f90('0x19')],_0x1ca17e);_0x37d9e9(_0x42b1d1['error'](0x1f4,_0x4ca802[_0x9f90('0x19')]));});});};exports[_0x9f90('0x2a')]=function(_0x550c5b){var _0x5bd1ce=this;return new Promise(function(_0x5338af,_0x468ca7){return db[_0x9f90('0x27')][_0x9f90('0x2b')](_0x550c5b[_0x9f90('0x29')],{'raw':_0x550c5b[_0x9f90('0x1d')]?_0x550c5b[_0x9f90('0x1d')][_0x9f90('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x550c5b[_0x9f90('0x1d')]?_0x550c5b['options'][_0x9f90('0x1f')]||null:null,'attributes':_0x550c5b[_0x9f90('0x1d')]?_0x550c5b[_0x9f90('0x1d')]['attributes']||null:null,'limit':_0x550c5b[_0x9f90('0x1d')]?_0x550c5b[_0x9f90('0x1d')]['limit']||null:null})[_0x9f90('0x24')](function(_0x142344){logger[_0x9f90('0x12')]('UpdateVoiceQueueReport',_0x550c5b);logger['debug'](_0x9f90('0x2a'),_0x550c5b,JSON[_0x9f90('0x16')](_0x142344));_0x5338af(_0x142344);})[_0x9f90('0x1a')](function(_0x2f65b8){logger[_0x9f90('0x17')]('UpdateVoiceQueueReport',_0x2f65b8[_0x9f90('0x19')],_0x550c5b);_0x468ca7(_0x5bd1ce['error'](0x1f4,_0x2f65b8[_0x9f90('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index e6f0ba8..2e479bc 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 _0xdabe=['emit','removeListener','register','length','save','remove','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdabe,0x1a8));var _0xedab=function(_0x2882f2,_0x375107){_0x2882f2=_0x2882f2-0x0;var _0x5f3089=_0xdabe[_0x2882f2];return _0x5f3089;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xedab('0x0'),_0xedab('0x1'),_0xedab('0x2')];function createListener(_0x15ff84,_0x442b19){return function(_0x1fc3c8){_0x442b19[_0xedab('0x3')](_0x15ff84,_0x1fc3c8);};}function removeListener(_0x3d1c0f,_0x4d61b5){return function(){VoiceQueueReportEvents[_0xedab('0x4')](_0x3d1c0f,_0x4d61b5);};}exports[_0xedab('0x5')]=function(_0x502367){for(var _0x2572ad=0x0,_0x199dff=events[_0xedab('0x6')];_0x2572ad<_0x199dff;_0x2572ad++){var _0x2e8a3b=events[_0x2572ad];var _0xe02945=createListener('voiceQueueReport:'+_0x2e8a3b,_0x502367);VoiceQueueReportEvents['on'](_0x2e8a3b,_0xe02945);}}; \ No newline at end of file +var _0x5db2=['register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','emit','removeListener'];(function(_0x1d059f,_0x578647){var _0xebd467=function(_0x213e54){while(--_0x213e54){_0x1d059f['push'](_0x1d059f['shift']());}};_0xebd467(++_0x578647);}(_0x5db2,0xf3));var _0x25db=function(_0x4e50cf,_0x27544b){_0x4e50cf=_0x4e50cf-0x0;var _0x31ac67=_0x5db2[_0x4e50cf];return _0x31ac67;};'use strict';var VoiceQueueReportEvents=require(_0x25db('0x0'));var events=[_0x25db('0x1'),_0x25db('0x2'),'update'];function createListener(_0x40b22a,_0x4381fc){return function(_0x19707e){_0x4381fc[_0x25db('0x3')](_0x40b22a,_0x19707e);};}function removeListener(_0x201231,_0xefcecd){return function(){VoiceQueueReportEvents[_0x25db('0x4')](_0x201231,_0xefcecd);};}exports[_0x25db('0x5')]=function(_0x4b9260){for(var _0x248306=0x0,_0x497759=events[_0x25db('0x6')];_0x248306<_0x497759;_0x248306++){var _0x310762=events[_0x248306];var _0x40f7eb=createListener(_0x25db('0x7')+_0x310762,_0x4b9260);VoiceQueueReportEvents['on'](_0x310762,_0x40f7eb);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 11d05b0..47235cc 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 _0xe222=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer'];(function(_0x467ed7,_0x5f3c23){var _0x4572d2=function(_0x8ccf07){while(--_0x8ccf07){_0x467ed7['push'](_0x467ed7['shift']());}};_0x4572d2(++_0x5f3c23);}(_0xe222,0x18e));var _0x2e22=function(_0x3c414c,_0x399dbb){_0x3c414c=_0x3c414c-0x0;var _0x4f3062=_0xe222[_0x3c414c];return _0x4f3062;};'use strict';var multer=require(_0x2e22('0x0'));var util=require('util');var path=require(_0x2e22('0x1'));var timeout=require(_0x2e22('0x2'));var express=require(_0x2e22('0x3'));var router=express[_0x2e22('0x4')]();var fs_extra=require(_0x2e22('0x5'));var auth=require(_0x2e22('0x6'));var interaction=require(_0x2e22('0x7'));var config=require(_0x2e22('0x8'));var controller=require(_0x2e22('0x9'));router[_0x2e22('0xa')]('/',auth[_0x2e22('0xb')](),controller[_0x2e22('0xc')]);router[_0x2e22('0xa')](_0x2e22('0xd'),auth[_0x2e22('0xb')](),controller[_0x2e22('0xe')]);router[_0x2e22('0xf')]('/',auth['isAuthenticated'](),controller[_0x2e22('0x10')]);router[_0x2e22('0x11')](_0x2e22('0xd'),auth[_0x2e22('0xb')](),controller['update']);router[_0x2e22('0x12')](_0x2e22('0xd'),auth[_0x2e22('0xb')](),controller[_0x2e22('0x13')]);module[_0x2e22('0x14')]=router; \ No newline at end of file +var _0x70e2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','show','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x319d87,_0xfc471d){var _0x758edf=function(_0x3a5d0c){while(--_0x3a5d0c){_0x319d87['push'](_0x319d87['shift']());}};_0x758edf(++_0xfc471d);}(_0x70e2,0xc3));var _0x270e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x70e2[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x270e('0x0'));var util=require(_0x270e('0x1'));var path=require(_0x270e('0x2'));var timeout=require(_0x270e('0x3'));var express=require('express');var router=express[_0x270e('0x4')]();var fs_extra=require(_0x270e('0x5'));var auth=require(_0x270e('0x6'));var interaction=require(_0x270e('0x7'));var config=require(_0x270e('0x8'));var controller=require(_0x270e('0x9'));router['get']('/',auth[_0x270e('0xa')](),controller[_0x270e('0xb')]);router[_0x270e('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x270e('0xd')]);router['post']('/',auth[_0x270e('0xa')](),controller[_0x270e('0xe')]);router[_0x270e('0xf')](_0x270e('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x270e('0x11')](_0x270e('0x10'),auth[_0x270e('0xa')](),controller[_0x270e('0x12')]);module[_0x270e('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index d055602..082271e 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 _0x2973=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE','format'];(function(_0x552fce,_0x3f24bc){var _0x3e27a2=function(_0xc91154){while(--_0xc91154){_0x552fce['push'](_0x552fce['shift']());}};_0x3e27a2(++_0x3f24bc);}(_0x2973,0xef));var _0x3297=function(_0x13f257,_0x3c3d67){_0x13f257=_0x13f257-0x0;var _0x455f37=_0x2973[_0x13f257];return _0x455f37;};'use strict';var Sequelize=require(_0x3297('0x0'));var moment=require(_0x3297('0x1'));module[_0x3297('0x2')]={'time':{'type':Sequelize[_0x3297('0x3')]},'callid':{'type':Sequelize[_0x3297('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x3297('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x3297('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x3297('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x3297('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x3297('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x3297('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x3297('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x3297('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x3297('0x4')],'allowNull':![],'defaultValue':moment()[_0x3297('0x5')](_0x3297('0x6'))}}; \ No newline at end of file +var _0x1335=['STRING','format','sequelize','moment','exports'];(function(_0x952a6d,_0x311423){var _0x422f87=function(_0x2e1c92){while(--_0x2e1c92){_0x952a6d['push'](_0x952a6d['shift']());}};_0x422f87(++_0x311423);}(_0x1335,0x19c));var _0x5133=function(_0x1c4ab7,_0x5b6490){_0x1c4ab7=_0x1c4ab7-0x0;var _0x294837=_0x1335[_0x1c4ab7];return _0x294837;};'use strict';var Sequelize=require(_0x5133('0x0'));var moment=require(_0x5133('0x1'));module[_0x5133('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x5133('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x5133('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x5133('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x5133('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x5133('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x5133('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x5133('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x5133('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x5133('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 78112dd..69e483f 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 _0xd28e=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceQueuesLog','fieldName','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','rows','catch','show','rawAttributes','fields','includeAll','create','body','find','params','eml-format','zip-dir'];(function(_0x21f16c,_0x542ae0){var _0x5029bd=function(_0x12481b){while(--_0x12481b){_0x21f16c['push'](_0x21f16c['shift']());}};_0x5029bd(++_0x542ae0);}(_0xd28e,0x126));var _0xed28=function(_0x4b8e02,_0x59e95f){_0x4b8e02=_0x4b8e02-0x0;var _0x588369=_0xd28e[_0x4b8e02];return _0x588369;};'use strict';var emlformat=require(_0xed28('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xed28('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed28('0x2'));var moment=require(_0xed28('0x3'));var BPromise=require(_0xed28('0x4'));var Mustache=require(_0xed28('0x5'));var util=require(_0xed28('0x6'));var path=require(_0xed28('0x7'));var sox=require(_0xed28('0x8'));var csv=require(_0xed28('0x9'));var ejs=require(_0xed28('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed28('0xb'));var squel=require(_0xed28('0xc'));var crypto=require(_0xed28('0xd'));var jsforce=require(_0xed28('0xe'));var deskjs=require(_0xed28('0xf'));var toCsv=require('to-csv');var querystring=require(_0xed28('0x10'));var Papa=require(_0xed28('0x11'));var Redis=require('ioredis');var authService=require(_0xed28('0x12'));var qs=require(_0xed28('0x13'));var as=require(_0xed28('0x14'));var hardwareService=require(_0xed28('0x15'));var logger=require('../../config/logger')(_0xed28('0x16'));var utils=require(_0xed28('0x17'));var config=require(_0xed28('0x18'));var licenseUtil=require(_0xed28('0x19'));var db=require(_0xed28('0x1a'))['db'];function respondWithStatusCode(_0xf61a67,_0x2edf95){_0x2edf95=_0x2edf95||0xcc;return function(_0x1c4e94){if(_0x1c4e94){return _0xf61a67['sendStatus'](_0x2edf95);}return _0xf61a67[_0xed28('0x1b')](_0x2edf95)[_0xed28('0x1c')]();};}function respondWithResult(_0x438e47,_0x15b2a5){_0x15b2a5=_0x15b2a5||0xc8;return function(_0x1e6a6e){if(_0x1e6a6e){return _0x438e47['status'](_0x15b2a5)[_0xed28('0x1d')](_0x1e6a6e);}};}function respondWithFilteredResult(_0x49212c,_0x59155c){return function(_0x3194cb){if(_0x3194cb){var _0x122a3f=typeof _0x59155c[_0xed28('0x1e')]===_0xed28('0x1f')&&typeof _0x59155c[_0xed28('0x20')]===_0xed28('0x1f');var _0x110b39=_0x3194cb[_0xed28('0x21')];var _0xf68314=_0x122a3f?0x0:_0x59155c[_0xed28('0x1e')];var _0x2d9748=_0x122a3f?_0x3194cb['count']:_0x59155c[_0xed28('0x1e')]+_0x59155c[_0xed28('0x20')];var _0x22259d;if(_0x2d9748>=_0x110b39){_0x2d9748=_0x110b39;_0x22259d=0xc8;}else{_0x22259d=0xce;}_0x49212c[_0xed28('0x1b')](_0x22259d);return _0x49212c[_0xed28('0x22')](_0xed28('0x23'),_0xf68314+'-'+_0x2d9748+'/'+_0x110b39)[_0xed28('0x1d')](_0x3194cb);}return null;};}function patchUpdates(_0x5cb1bd){return function(_0x2b3dd7){try{jsonpatch[_0xed28('0x24')](_0x2b3dd7,_0x5cb1bd,!![]);}catch(_0x1ede01){return BPromise[_0xed28('0x25')](_0x1ede01);}return _0x2b3dd7['save']();};}function saveUpdates(_0x2e152b,_0x4d5728){return function(_0x1b66b0){if(_0x1b66b0){return _0x1b66b0['update'](_0x2e152b)[_0xed28('0x26')](function(_0x59cad4){return _0x59cad4;});}return null;};}function removeEntity(_0x4a6fbc,_0x41aefb){return function(_0x2a15af){if(_0x2a15af){return _0x2a15af[_0xed28('0x27')]()[_0xed28('0x26')](function(){_0x4a6fbc[_0xed28('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27b772,_0x470e39){return function(_0x5aa569){if(!_0x5aa569){_0x27b772[_0xed28('0x28')](0x194);}return _0x5aa569;};}function handleError(_0x1ac7aa,_0x5abfad){_0x5abfad=_0x5abfad||0x1f4;return function(_0x16ee1e){logger[_0xed28('0x29')](_0x16ee1e[_0xed28('0x2a')]);if(_0x16ee1e[_0xed28('0x2b')]){delete _0x16ee1e[_0xed28('0x2b')];}_0x1ac7aa[_0xed28('0x1b')](_0x5abfad)[_0xed28('0x2c')](_0x16ee1e);};}exports[_0xed28('0x2d')]=function(_0x3116e2,_0x27f2ea){var _0x52e9f9={},_0x110c4a={},_0x101be1={'count':0x0,'rows':[]};var _0x3cae74=_[_0xed28('0x2e')](db[_0xed28('0x2f')]['rawAttributes'],function(_0x11a9c6){return{'name':_0x11a9c6[_0xed28('0x30')],'type':_0x11a9c6['type'][_0xed28('0x31')]};});_0x110c4a['model']=_[_0xed28('0x2e')](_0x3cae74,_0xed28('0x2b'));_0x110c4a[_0xed28('0x32')]=_[_0xed28('0x33')](_0x3116e2['query']);_0x110c4a[_0xed28('0x34')]=_[_0xed28('0x35')](_0x110c4a[_0xed28('0x36')],_0x110c4a[_0xed28('0x32')]);_0x52e9f9['attributes']=_[_0xed28('0x35')](_0x110c4a[_0xed28('0x36')],qs['fields'](_0x3116e2[_0xed28('0x32')]['fields']));_0x52e9f9[_0xed28('0x37')]=_0x52e9f9[_0xed28('0x37')][_0xed28('0x38')]?_0x52e9f9[_0xed28('0x37')]:_0x110c4a[_0xed28('0x36')];if(!_0x3116e2[_0xed28('0x32')][_0xed28('0x39')](_0xed28('0x3a'))){_0x52e9f9['limit']=qs[_0xed28('0x20')](_0x3116e2['query'][_0xed28('0x20')]);_0x52e9f9[_0xed28('0x1e')]=qs[_0xed28('0x1e')](_0x3116e2[_0xed28('0x32')][_0xed28('0x1e')]);}_0x52e9f9['order']=qs[_0xed28('0x3b')](_0x3116e2[_0xed28('0x32')][_0xed28('0x3b')]);_0x52e9f9['where']=qs[_0xed28('0x34')](_['pick'](_0x3116e2[_0xed28('0x32')],_0x110c4a[_0xed28('0x34')]),_0x3cae74);if(_0x3116e2[_0xed28('0x32')][_0xed28('0x3c')]){_0x52e9f9['where']=_[_0xed28('0x3d')](_0x52e9f9[_0xed28('0x3e')],{'$or':_[_0xed28('0x2e')](_0x3cae74,function(_0x5a0962){if(_0x5a0962['type']!=='VIRTUAL'){var _0x14a537={};_0x14a537[_0x5a0962[_0xed28('0x2b')]]={'$like':'%'+_0x3116e2['query']['filter']+'%'};return _0x14a537;}})});}_0x52e9f9=_[_0xed28('0x3d')]({},_0x52e9f9,_0x3116e2[_0xed28('0x3f')]);var _0x478933={'where':_0x52e9f9[_0xed28('0x3e')]};return db[_0xed28('0x2f')][_0xed28('0x21')](_0x478933)[_0xed28('0x26')](function(_0xe709b3){_0x101be1[_0xed28('0x21')]=_0xe709b3;if(_0x3116e2['query']['includeAll']){_0x52e9f9['include']=[{'all':!![]}];}return db[_0xed28('0x2f')]['findAll'](_0x52e9f9);})[_0xed28('0x26')](function(_0x332da9){_0x101be1[_0xed28('0x40')]=_0x332da9;return _0x101be1;})[_0xed28('0x26')](respondWithFilteredResult(_0x27f2ea,_0x52e9f9))[_0xed28('0x41')](handleError(_0x27f2ea,null));};exports[_0xed28('0x42')]=function(_0x2b10e9,_0x4b13ef){var _0x53d805={'raw':!![],'where':{'id':_0x2b10e9['params']['id']}},_0x5899aa={};_0x5899aa[_0xed28('0x36')]=_['keys'](db[_0xed28('0x2f')][_0xed28('0x43')]);_0x5899aa[_0xed28('0x32')]=_[_0xed28('0x33')](_0x2b10e9[_0xed28('0x32')]);_0x5899aa[_0xed28('0x34')]=_[_0xed28('0x35')](_0x5899aa[_0xed28('0x36')],_0x5899aa[_0xed28('0x32')]);_0x53d805[_0xed28('0x37')]=_[_0xed28('0x35')](_0x5899aa[_0xed28('0x36')],qs['fields'](_0x2b10e9[_0xed28('0x32')][_0xed28('0x44')]));_0x53d805[_0xed28('0x37')]=_0x53d805[_0xed28('0x37')][_0xed28('0x38')]?_0x53d805[_0xed28('0x37')]:_0x5899aa[_0xed28('0x36')];if(_0x2b10e9['query'][_0xed28('0x45')]){_0x53d805['include']=[{'all':!![]}];}_0x53d805=_[_0xed28('0x3d')]({},_0x53d805,_0x2b10e9[_0xed28('0x3f')]);return db[_0xed28('0x2f')]['find'](_0x53d805)['then'](handleEntityNotFound(_0x4b13ef,null))[_0xed28('0x26')](respondWithResult(_0x4b13ef,null))['catch'](handleError(_0x4b13ef,null));};exports[_0xed28('0x46')]=function(_0x2a3441,_0x2dd5c){return db[_0xed28('0x2f')][_0xed28('0x46')](_0x2a3441[_0xed28('0x47')],{})[_0xed28('0x26')](respondWithResult(_0x2dd5c,0xc9))[_0xed28('0x41')](handleError(_0x2dd5c,null));};exports['update']=function(_0x2cb435,_0x3ed847){if(_0x2cb435[_0xed28('0x47')]['id']){delete _0x2cb435[_0xed28('0x47')]['id'];}return db[_0xed28('0x2f')][_0xed28('0x48')]({'where':{'id':_0x2cb435[_0xed28('0x49')]['id']}})[_0xed28('0x26')](handleEntityNotFound(_0x3ed847,null))[_0xed28('0x26')](saveUpdates(_0x2cb435[_0xed28('0x47')],null))[_0xed28('0x26')](respondWithResult(_0x3ed847,null))[_0xed28('0x41')](handleError(_0x3ed847,null));};exports[_0xed28('0x27')]=function(_0x1a5827,_0x2941d7){return db['VoiceQueuesLog'][_0xed28('0x48')]({'where':{'id':_0x1a5827[_0xed28('0x49')]['id']}})[_0xed28('0x26')](handleEntityNotFound(_0x2941d7,null))[_0xed28('0x26')](removeEntity(_0x2941d7,null))[_0xed28('0x41')](handleError(_0x2941d7,null));}; \ No newline at end of file +var _0xa2db=['undefined','limit','count','offset','Content-Range','apply','destroy','end','stack','name','index','map','VoiceQueuesLog','fieldName','model','keys','query','filters','intersection','attributes','fields','sort','filter','where','merge','type','VIRTUAL','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','update','rimraf','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json'];(function(_0x156753,_0x338ab2){var _0x6a1452=function(_0x38fc8c){while(--_0x38fc8c){_0x156753['push'](_0x156753['shift']());}};_0x6a1452(++_0x338ab2);}(_0xa2db,0x6c));var _0xba2d=function(_0x52a857,_0xc99fa1){_0x52a857=_0x52a857-0x0;var _0x4e2aae=_0xa2db[_0x52a857];return _0x4e2aae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba2d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xba2d('0x1'));var rp=require('request-promise');var moment=require(_0xba2d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xba2d('0x3'));var util=require('util');var path=require(_0xba2d('0x4'));var sox=require('sox');var csv=require(_0xba2d('0x5'));var ejs=require(_0xba2d('0x6'));var fs=require('fs');var fs_extra=require(_0xba2d('0x7'));var _=require(_0xba2d('0x8'));var squel=require(_0xba2d('0x9'));var crypto=require(_0xba2d('0xa'));var jsforce=require(_0xba2d('0xb'));var deskjs=require(_0xba2d('0xc'));var toCsv=require(_0xba2d('0x5'));var querystring=require(_0xba2d('0xd'));var Papa=require(_0xba2d('0xe'));var Redis=require(_0xba2d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xba2d('0x10'));var as=require(_0xba2d('0x11'));var hardwareService=require(_0xba2d('0x12'));var logger=require(_0xba2d('0x13'))('api');var utils=require(_0xba2d('0x14'));var config=require(_0xba2d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xba2d('0x16'))['db'];function respondWithStatusCode(_0x472348,_0x55a106){_0x55a106=_0x55a106||0xcc;return function(_0x2e0332){if(_0x2e0332){return _0x472348[_0xba2d('0x17')](_0x55a106);}return _0x472348[_0xba2d('0x18')](_0x55a106)['end']();};}function respondWithResult(_0x4f09a0,_0x4a7d33){_0x4a7d33=_0x4a7d33||0xc8;return function(_0x20ceb3){if(_0x20ceb3){return _0x4f09a0[_0xba2d('0x18')](_0x4a7d33)[_0xba2d('0x19')](_0x20ceb3);}};}function respondWithFilteredResult(_0x5dc0cd,_0x3a2305){return function(_0x4c1861){if(_0x4c1861){var _0x1778da=typeof _0x3a2305['offset']===_0xba2d('0x1a')&&typeof _0x3a2305[_0xba2d('0x1b')]===_0xba2d('0x1a');var _0x3a760a=_0x4c1861[_0xba2d('0x1c')];var _0x31fd92=_0x1778da?0x0:_0x3a2305[_0xba2d('0x1d')];var _0x226b46=_0x1778da?_0x4c1861[_0xba2d('0x1c')]:_0x3a2305[_0xba2d('0x1d')]+_0x3a2305[_0xba2d('0x1b')];var _0x5c0122;if(_0x226b46>=_0x3a760a){_0x226b46=_0x3a760a;_0x5c0122=0xc8;}else{_0x5c0122=0xce;}_0x5dc0cd[_0xba2d('0x18')](_0x5c0122);return _0x5dc0cd['set'](_0xba2d('0x1e'),_0x31fd92+'-'+_0x226b46+'/'+_0x3a760a)[_0xba2d('0x19')](_0x4c1861);}return null;};}function patchUpdates(_0x232885){return function(_0x46d808){try{jsonpatch[_0xba2d('0x1f')](_0x46d808,_0x232885,!![]);}catch(_0x1aca53){return BPromise['reject'](_0x1aca53);}return _0x46d808['save']();};}function saveUpdates(_0x2b6615,_0x290e2c){return function(_0x35dd17){if(_0x35dd17){return _0x35dd17['update'](_0x2b6615)['then'](function(_0x5369d8){return _0x5369d8;});}return null;};}function removeEntity(_0x154d19,_0x467f80){return function(_0xc1855){if(_0xc1855){return _0xc1855[_0xba2d('0x20')]()['then'](function(){_0x154d19[_0xba2d('0x18')](0xcc)[_0xba2d('0x21')]();});}};}function handleEntityNotFound(_0x476dd2,_0x340188){return function(_0x265b39){if(!_0x265b39){_0x476dd2['sendStatus'](0x194);}return _0x265b39;};}function handleError(_0xa73054,_0x3e39ff){_0x3e39ff=_0x3e39ff||0x1f4;return function(_0x3e2d6a){logger['error'](_0x3e2d6a[_0xba2d('0x22')]);if(_0x3e2d6a[_0xba2d('0x23')]){delete _0x3e2d6a[_0xba2d('0x23')];}_0xa73054[_0xba2d('0x18')](_0x3e39ff)['send'](_0x3e2d6a);};}exports[_0xba2d('0x24')]=function(_0x351e02,_0x31624e){var _0x4dbe8b={},_0x22e7ae={},_0x46f86a={'count':0x0,'rows':[]};var _0xc8458f=_[_0xba2d('0x25')](db[_0xba2d('0x26')]['rawAttributes'],function(_0x35b905){return{'name':_0x35b905[_0xba2d('0x27')],'type':_0x35b905['type']['key']};});_0x22e7ae[_0xba2d('0x28')]=_[_0xba2d('0x25')](_0xc8458f,_0xba2d('0x23'));_0x22e7ae['query']=_[_0xba2d('0x29')](_0x351e02[_0xba2d('0x2a')]);_0x22e7ae[_0xba2d('0x2b')]=_[_0xba2d('0x2c')](_0x22e7ae[_0xba2d('0x28')],_0x22e7ae[_0xba2d('0x2a')]);_0x4dbe8b[_0xba2d('0x2d')]=_[_0xba2d('0x2c')](_0x22e7ae['model'],qs['fields'](_0x351e02[_0xba2d('0x2a')][_0xba2d('0x2e')]));_0x4dbe8b['attributes']=_0x4dbe8b['attributes']['length']?_0x4dbe8b[_0xba2d('0x2d')]:_0x22e7ae[_0xba2d('0x28')];if(!_0x351e02[_0xba2d('0x2a')]['hasOwnProperty']('nolimit')){_0x4dbe8b['limit']=qs[_0xba2d('0x1b')](_0x351e02['query'][_0xba2d('0x1b')]);_0x4dbe8b['offset']=qs[_0xba2d('0x1d')](_0x351e02['query']['offset']);}_0x4dbe8b['order']=qs['sort'](_0x351e02[_0xba2d('0x2a')][_0xba2d('0x2f')]);_0x4dbe8b['where']=qs[_0xba2d('0x2b')](_['pick'](_0x351e02[_0xba2d('0x2a')],_0x22e7ae[_0xba2d('0x2b')]),_0xc8458f);if(_0x351e02[_0xba2d('0x2a')][_0xba2d('0x30')]){_0x4dbe8b[_0xba2d('0x31')]=_[_0xba2d('0x32')](_0x4dbe8b[_0xba2d('0x31')],{'$or':_['map'](_0xc8458f,function(_0x2c4c65){if(_0x2c4c65[_0xba2d('0x33')]!==_0xba2d('0x34')){var _0x164dbc={};_0x164dbc[_0x2c4c65[_0xba2d('0x23')]]={'$like':'%'+_0x351e02[_0xba2d('0x2a')][_0xba2d('0x30')]+'%'};return _0x164dbc;}})});}_0x4dbe8b=_[_0xba2d('0x32')]({},_0x4dbe8b,_0x351e02['options']);var _0x5570a9={'where':_0x4dbe8b[_0xba2d('0x31')]};return db[_0xba2d('0x26')][_0xba2d('0x1c')](_0x5570a9)[_0xba2d('0x35')](function(_0x45e694){_0x46f86a[_0xba2d('0x1c')]=_0x45e694;if(_0x351e02[_0xba2d('0x2a')][_0xba2d('0x36')]){_0x4dbe8b[_0xba2d('0x37')]=[{'all':!![]}];}return db[_0xba2d('0x26')][_0xba2d('0x38')](_0x4dbe8b);})[_0xba2d('0x35')](function(_0x3a0eb6){_0x46f86a[_0xba2d('0x39')]=_0x3a0eb6;return _0x46f86a;})[_0xba2d('0x35')](respondWithFilteredResult(_0x31624e,_0x4dbe8b))[_0xba2d('0x3a')](handleError(_0x31624e,null));};exports[_0xba2d('0x3b')]=function(_0x2598a5,_0x3a1a7e){var _0x29da93={'raw':!![],'where':{'id':_0x2598a5[_0xba2d('0x3c')]['id']}},_0x3352a7={};_0x3352a7['model']=_[_0xba2d('0x29')](db[_0xba2d('0x26')][_0xba2d('0x3d')]);_0x3352a7['query']=_[_0xba2d('0x29')](_0x2598a5[_0xba2d('0x2a')]);_0x3352a7[_0xba2d('0x2b')]=_[_0xba2d('0x2c')](_0x3352a7['model'],_0x3352a7[_0xba2d('0x2a')]);_0x29da93[_0xba2d('0x2d')]=_[_0xba2d('0x2c')](_0x3352a7[_0xba2d('0x28')],qs['fields'](_0x2598a5['query'][_0xba2d('0x2e')]));_0x29da93[_0xba2d('0x2d')]=_0x29da93[_0xba2d('0x2d')]['length']?_0x29da93[_0xba2d('0x2d')]:_0x3352a7[_0xba2d('0x28')];if(_0x2598a5[_0xba2d('0x2a')]['includeAll']){_0x29da93['include']=[{'all':!![]}];}_0x29da93=_['merge']({},_0x29da93,_0x2598a5[_0xba2d('0x3e')]);return db[_0xba2d('0x26')][_0xba2d('0x3f')](_0x29da93)[_0xba2d('0x35')](handleEntityNotFound(_0x3a1a7e,null))[_0xba2d('0x35')](respondWithResult(_0x3a1a7e,null))[_0xba2d('0x3a')](handleError(_0x3a1a7e,null));};exports[_0xba2d('0x40')]=function(_0x59da3a,_0x53a8c7){return db[_0xba2d('0x26')]['create'](_0x59da3a[_0xba2d('0x41')],{})['then'](respondWithResult(_0x53a8c7,0xc9))['catch'](handleError(_0x53a8c7,null));};exports[_0xba2d('0x42')]=function(_0xe07792,_0x29e90f){if(_0xe07792[_0xba2d('0x41')]['id']){delete _0xe07792[_0xba2d('0x41')]['id'];}return db[_0xba2d('0x26')][_0xba2d('0x3f')]({'where':{'id':_0xe07792[_0xba2d('0x3c')]['id']}})[_0xba2d('0x35')](handleEntityNotFound(_0x29e90f,null))[_0xba2d('0x35')](saveUpdates(_0xe07792['body'],null))[_0xba2d('0x35')](respondWithResult(_0x29e90f,null))[_0xba2d('0x3a')](handleError(_0x29e90f,null));};exports[_0xba2d('0x20')]=function(_0x5194af,_0x2ea7d8){return db[_0xba2d('0x26')][_0xba2d('0x3f')]({'where':{'id':_0x5194af[_0xba2d('0x3c')]['id']}})[_0xba2d('0x35')](handleEntityNotFound(_0x2ea7d8,null))[_0xba2d('0x35')](removeEntity(_0x2ea7d8,null))['catch'](handleError(_0x2ea7d8,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 3955360..707ac07 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 _0x217a=['rimraf','../../config/environment','./voiceQueuesLog.attributes','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x55deec,_0x130e1f){var _0x2a071a=function(_0x292388){while(--_0x292388){_0x55deec['push'](_0x55deec['shift']());}};_0x2a071a(++_0x130e1f);}(_0x217a,0x1ac));var _0xa217=function(_0x3253f5,_0xffa22d){_0x3253f5=_0x3253f5-0x0;var _0x5dbe3d=_0x217a[_0x3253f5];return _0x5dbe3d;};'use strict';var _=require(_0xa217('0x0'));var util=require(_0xa217('0x1'));var logger=require(_0xa217('0x2'))('api');var moment=require(_0xa217('0x3'));var BPromise=require(_0xa217('0x4'));var rp=require(_0xa217('0x5'));var fs=require('fs');var path=require(_0xa217('0x6'));var rimraf=require(_0xa217('0x7'));var config=require(_0xa217('0x8'));var attributes=require(_0xa217('0x9'));module['exports']=function(_0x262492,_0x85549){return _0x262492['define'](_0xa217('0xa'),attributes,{'tableName':_0xa217('0xb'),'paranoid':![],'indexes':[{'name':_0xa217('0xc'),'fields':[_0xa217('0xd'),_0xa217('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc4ad=['exports','define','VoiceQueuesLog','voice_queues_log','event','dtm','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes'];(function(_0xf4460f,_0x159fd5){var _0x97a034=function(_0x1787c9){while(--_0x1787c9){_0xf4460f['push'](_0xf4460f['shift']());}};_0x97a034(++_0x159fd5);}(_0xc4ad,0xf4));var _0xdc4a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4ad[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xdc4a('0x0'));var logger=require(_0xdc4a('0x1'))('api');var moment=require(_0xdc4a('0x2'));var BPromise=require(_0xdc4a('0x3'));var rp=require(_0xdc4a('0x4'));var fs=require('fs');var path=require(_0xdc4a('0x5'));var rimraf=require(_0xdc4a('0x6'));var config=require('../../config/environment');var attributes=require(_0xdc4a('0x7'));module[_0xdc4a('0x8')]=function(_0x44afd7,_0x544afd){return _0x44afd7[_0xdc4a('0x9')](_0xdc4a('0xa'),attributes,{'tableName':_0xdc4a('0xb'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xdc4a('0xc'),_0xdc4a('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 269d863..076c707 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 _0x377e=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x292428,_0x337309){var _0x373963=function(_0x300bc3){while(--_0x300bc3){_0x292428['push'](_0x292428['shift']());}};_0x373963(++_0x337309);}(_0x377e,0x1e2));var _0xe377=function(_0x46ace5,_0x2e0375){_0x46ace5=_0x46ace5-0x0;var _0x11267c=_0x377e[_0x46ace5];return _0x11267c;};'use strict';var _=require(_0xe377('0x0'));var util=require(_0xe377('0x1'));var moment=require('moment');var BPromise=require(_0xe377('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe377('0x3'));var db=require(_0xe377('0x4'))['db'];var utils=require(_0xe377('0x5'));var logger=require(_0xe377('0x6'))(_0xe377('0x7'));var config=require('../../config/environment');var jayson=require(_0xe377('0x8'));var client=jayson['client'][_0xe377('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fac41,_0x1d5365,_0x574da5){return new BPromise(function(_0x26fdf9,_0x4edb2d){return client[_0xe377('0xa')](_0x3fac41,_0x574da5)[_0xe377('0xb')](function(_0x37906e){logger[_0xe377('0xc')](_0xe377('0xd'),_0x1d5365,_0xe377('0xe'));logger['debug'](_0xe377('0xf'),_0x1d5365,_0xe377('0xe'),JSON[_0xe377('0x10')](_0x37906e));if(_0x37906e[_0xe377('0x11')]){if(_0x37906e['error'][_0xe377('0x12')]===0x1f4){logger['error'](_0xe377('0xd'),_0x1d5365,_0x37906e[_0xe377('0x11')][_0xe377('0x13')]);return _0x4edb2d(_0x37906e[_0xe377('0x11')]['message']);}logger[_0xe377('0x11')](_0xe377('0xd'),_0x1d5365,_0x37906e[_0xe377('0x11')][_0xe377('0x13')]);return _0x26fdf9(_0x37906e[_0xe377('0x11')][_0xe377('0x13')]);}else{logger[_0xe377('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1d5365,'request\x20sent');_0x26fdf9(_0x37906e['result'][_0xe377('0x13')]);}})[_0xe377('0x14')](function(_0x373853){logger[_0xe377('0x11')](_0xe377('0xd'),_0x1d5365,_0x373853);_0x4edb2d(_0x373853);});});} \ No newline at end of file +var _0x4899=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util'];(function(_0x4ee97f,_0xfe51ec){var _0x29d005=function(_0x9d86a){while(--_0x9d86a){_0x4ee97f['push'](_0x4ee97f['shift']());}};_0x29d005(++_0xfe51ec);}(_0x4899,0x142));var _0x9489=function(_0x530208,_0x538b79){_0x530208=_0x530208-0x0;var _0xf30f96=_0x4899[_0x530208];return _0xf30f96;};'use strict';var _=require('lodash');var util=require(_0x9489('0x0'));var moment=require('moment');var BPromise=require(_0x9489('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9489('0x2'))['db'];var utils=require(_0x9489('0x3'));var logger=require(_0x9489('0x4'))(_0x9489('0x5'));var config=require(_0x9489('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9489('0x7')][_0x9489('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e1be2,_0x11229b,_0x42c910){return new BPromise(function(_0x84421,_0x4fcd75){return client['request'](_0x2e1be2,_0x42c910)[_0x9489('0x9')](function(_0x1c8c08){logger[_0x9489('0xa')](_0x9489('0xb'),_0x11229b,_0x9489('0xc'));logger[_0x9489('0xd')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x11229b,_0x9489('0xc'),JSON['stringify'](_0x1c8c08));if(_0x1c8c08['error']){if(_0x1c8c08[_0x9489('0xe')][_0x9489('0xf')]===0x1f4){logger[_0x9489('0xe')](_0x9489('0xb'),_0x11229b,_0x1c8c08[_0x9489('0xe')][_0x9489('0x10')]);return _0x4fcd75(_0x1c8c08[_0x9489('0xe')][_0x9489('0x10')]);}logger[_0x9489('0xe')](_0x9489('0xb'),_0x11229b,_0x1c8c08[_0x9489('0xe')][_0x9489('0x10')]);return _0x84421(_0x1c8c08[_0x9489('0xe')][_0x9489('0x10')]);}else{logger[_0x9489('0xa')]('VoiceQueuesLog,\x20%s,\x20%s',_0x11229b,_0x9489('0xc'));_0x84421(_0x1c8c08[_0x9489('0x11')]['message']);}})[_0x9489('0x12')](function(_0xa2632f){logger[_0x9489('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x11229b,_0xa2632f);_0x4fcd75(_0xa2632f);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 7ef6aca..358a6c1 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 _0x4c97=['express','Router','fs-extra','../../components/auth/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','downloads','post','/:id/transcribe','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0x4c97,0xd5));var _0x74c9=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x4c97[_0x55e08b];return _0xd1a7ff;};'use strict';var multer=require('multer');var util=require(_0x74c9('0x0'));var path=require(_0x74c9('0x1'));var timeout=require(_0x74c9('0x2'));var express=require(_0x74c9('0x3'));var router=express[_0x74c9('0x4')]();var fs_extra=require(_0x74c9('0x5'));var auth=require(_0x74c9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x74c9('0x7'));router[_0x74c9('0x8')]('/',auth[_0x74c9('0x9')](),controller[_0x74c9('0xa')]);router['get'](_0x74c9('0xb'),auth[_0x74c9('0x9')](),controller[_0x74c9('0xc')]);router[_0x74c9('0x8')](_0x74c9('0xd'),auth[_0x74c9('0x9')](),controller['show']);router[_0x74c9('0x8')](_0x74c9('0xe'),auth['isAuthenticated'](),controller[_0x74c9('0xf')]);router['get']('/:id/downloads',controller[_0x74c9('0x10')]);router['get']('/:id/transcribe',auth['isAuthenticated'](),controller['downloadTranscribe']);router[_0x74c9('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x74c9('0x11')](_0x74c9('0x12'),auth[_0x74c9('0x9')](),controller['runTranscribe']);router[_0x74c9('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x74c9('0x14')]);router[_0x74c9('0x15')](_0x74c9('0xd'),auth[_0x74c9('0x9')](),controller[_0x74c9('0x16')]);module[_0x74c9('0x17')]=router; \ No newline at end of file +var _0x5009=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','put','update','delete'];(function(_0x2c2176,_0x5330a9){var _0x320611=function(_0x12035f){while(--_0x12035f){_0x2c2176['push'](_0x2c2176['shift']());}};_0x320611(++_0x5330a9);}(_0x5009,0x188));var _0x9500=function(_0xcb5a87,_0x5a24b6){_0xcb5a87=_0xcb5a87-0x0;var _0x2d7106=_0x5009[_0xcb5a87];return _0x2d7106;};'use strict';var multer=require(_0x9500('0x0'));var util=require(_0x9500('0x1'));var path=require('path');var timeout=require(_0x9500('0x2'));var express=require(_0x9500('0x3'));var router=express[_0x9500('0x4')]();var fs_extra=require(_0x9500('0x5'));var auth=require(_0x9500('0x6'));var interaction=require(_0x9500('0x7'));var config=require(_0x9500('0x8'));var controller=require(_0x9500('0x9'));router[_0x9500('0xa')]('/',auth[_0x9500('0xb')](),controller[_0x9500('0xc')]);router[_0x9500('0xa')](_0x9500('0xd'),auth[_0x9500('0xb')](),controller[_0x9500('0xe')]);router[_0x9500('0xa')](_0x9500('0xf'),auth[_0x9500('0xb')](),controller[_0x9500('0x10')]);router['get'](_0x9500('0x11'),auth[_0x9500('0xb')](),controller[_0x9500('0x12')]);router[_0x9500('0xa')](_0x9500('0x13'),controller[_0x9500('0x14')]);router['get'](_0x9500('0x15'),auth['isAuthenticated'](),controller[_0x9500('0x16')]);router[_0x9500('0x17')]('/',auth[_0x9500('0xb')](),controller[_0x9500('0x18')]);router['post'](_0x9500('0x15'),auth[_0x9500('0xb')](),controller['runTranscribe']);router[_0x9500('0x19')](_0x9500('0xf'),auth[_0x9500('0xb')](),controller[_0x9500('0x1a')]);router[_0x9500('0x1b')](_0x9500('0xf'),auth[_0x9500('0xb')](),controller[_0x9500('0x1c')]);module[_0x9500('0x1d')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 7f8cfe7..8437880 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(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 8e12bf8..c83558c 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 _0xdbaa=['then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','VoiceRecording','find','create','body','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','col','token','$and','push','%s.cypher','recording','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','end','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','language','Transcribe\x20not\x20configured','runSentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','downloadTranscribe','fileText','.txt','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','aws-sdk','uuid/v4','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update'];(function(_0x161a94,_0x5cf648){var _0x5ce54d=function(_0x4a0574){while(--_0x4a0574){_0x161a94['push'](_0x161a94['shift']());}};_0x5ce54d(++_0x5cf648);}(_0xdbaa,0x19c));var _0xadba=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xdbaa[_0x1beef3];return _0x5af964;};'use strict';var emlformat=require(_0xadba('0x0'));var rimraf=require(_0xadba('0x1'));var zipdir=require(_0xadba('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xadba('0x3'));var moment=require(_0xadba('0x4'));var BPromise=require(_0xadba('0x5'));var Mustache=require(_0xadba('0x6'));var util=require(_0xadba('0x7'));var path=require(_0xadba('0x8'));var sox=require(_0xadba('0x9'));var csv=require(_0xadba('0xa'));var ejs=require(_0xadba('0xb'));var fs=require('fs');var fs_extra=require(_0xadba('0xc'));var _=require(_0xadba('0xd'));var squel=require('squel');var crypto=require(_0xadba('0xe'));var jsforce=require(_0xadba('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xadba('0xa'));var querystring=require(_0xadba('0x10'));var Papa=require('papaparse');var AWS=require(_0xadba('0x11'));var uuidv4=require(_0xadba('0x12'));var Redis=require(_0xadba('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xadba('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xadba('0x15'))(_0xadba('0x16'));var utils=require(_0xadba('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xadba('0x18'));var db=require(_0xadba('0x19'))['db'];function respondWithStatusCode(_0x13a9aa,_0x5744ee){_0x5744ee=_0x5744ee||0xcc;return function(_0x246d0c){if(_0x246d0c){return _0x13a9aa[_0xadba('0x1a')](_0x5744ee);}return _0x13a9aa[_0xadba('0x1b')](_0x5744ee)['end']();};}function respondWithResult(_0x50c4bd,_0x5da0cc){_0x5da0cc=_0x5da0cc||0xc8;return function(_0x525b09){if(_0x525b09){return _0x50c4bd[_0xadba('0x1b')](_0x5da0cc)[_0xadba('0x1c')](_0x525b09);}};}function respondWithFilteredResult(_0x38473e,_0xdc2170){return function(_0x90c1b1){if(_0x90c1b1){var _0x335a3b=typeof _0xdc2170[_0xadba('0x1d')]===_0xadba('0x1e')&&typeof _0xdc2170[_0xadba('0x1f')]===_0xadba('0x1e');var _0x47b7ee=_0x90c1b1[_0xadba('0x20')];var _0x2bf2c0=_0x335a3b?0x0:_0xdc2170['offset'];var _0x140010=_0x335a3b?_0x90c1b1['count']:_0xdc2170[_0xadba('0x1d')]+_0xdc2170[_0xadba('0x1f')];var _0x4eb5a5;if(_0x140010>=_0x47b7ee){_0x140010=_0x47b7ee;_0x4eb5a5=0xc8;}else{_0x4eb5a5=0xce;}_0x38473e[_0xadba('0x1b')](_0x4eb5a5);return _0x38473e['set'](_0xadba('0x21'),_0x2bf2c0+'-'+_0x140010+'/'+_0x47b7ee)[_0xadba('0x1c')](_0x90c1b1);}return null;};}function patchUpdates(_0x357dce){return function(_0x32a098){try{jsonpatch[_0xadba('0x22')](_0x32a098,_0x357dce,!![]);}catch(_0x4958cf){return BPromise[_0xadba('0x23')](_0x4958cf);}return _0x32a098[_0xadba('0x24')]();};}function saveUpdates(_0x5c2653,_0x4c01ca){return function(_0x55133f){if(_0x55133f){return _0x55133f[_0xadba('0x25')](_0x5c2653)[_0xadba('0x26')](function(_0x1ed00b){return _0x1ed00b;});}return null;};}function removeEntity(_0x1e4c3c,_0x44dd00){return function(_0x347ec7){if(_0x347ec7){return _0x347ec7[_0xadba('0x27')]()[_0xadba('0x26')](function(){_0x1e4c3c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c09c3,_0x328c36){return function(_0x2c04ab){if(!_0x2c04ab){_0x3c09c3[_0xadba('0x1a')](0x194);}return _0x2c04ab;};}function handleError(_0x56a6f5,_0x248a33){_0x248a33=_0x248a33||0x1f4;return function(_0x2c2136){logger[_0xadba('0x28')](_0x2c2136[_0xadba('0x29')]);if(_0x2c2136['name']){delete _0x2c2136[_0xadba('0x2a')];}_0x56a6f5[_0xadba('0x1b')](_0x248a33)[_0xadba('0x2b')](_0x2c2136);};}exports[_0xadba('0x2c')]=function(_0x5cf438,_0x9a2bd0){var _0x4e3186={},_0x1fb161={},_0x117476={'count':0x0,'rows':[]};var _0x43eccf=_[_0xadba('0x2d')](db['VoiceRecording']['rawAttributes'],function(_0x34e015){return{'name':_0x34e015[_0xadba('0x2e')],'type':_0x34e015[_0xadba('0x2f')][_0xadba('0x30')]};});_0x1fb161[_0xadba('0x31')]=_['differenceBy'](_[_0xadba('0x2d')](_0x43eccf,_0xadba('0x2a')),[_0xadba('0x32')]);_0x1fb161[_0xadba('0x33')]=_[_0xadba('0x34')](_0x5cf438[_0xadba('0x33')]);_0x1fb161[_0xadba('0x35')]=_['intersection'](_0x1fb161['model'],_0x1fb161[_0xadba('0x33')]);_0x4e3186[_0xadba('0x36')]=_[_0xadba('0x37')](_0x1fb161[_0xadba('0x31')],qs[_0xadba('0x38')](_0x5cf438[_0xadba('0x33')][_0xadba('0x38')]));_0x4e3186[_0xadba('0x36')]=_0x4e3186[_0xadba('0x36')][_0xadba('0x39')]?_0x4e3186[_0xadba('0x36')]:_0x1fb161['model'];if(!_0x5cf438[_0xadba('0x33')][_0xadba('0x3a')](_0xadba('0x3b'))){_0x4e3186[_0xadba('0x1f')]=qs[_0xadba('0x1f')](_0x5cf438['query']['limit']);_0x4e3186[_0xadba('0x1d')]=qs[_0xadba('0x1d')](_0x5cf438[_0xadba('0x33')][_0xadba('0x1d')]);}_0x4e3186[_0xadba('0x3c')]=qs['sort'](_0x5cf438[_0xadba('0x33')][_0xadba('0x3d')]);_0x4e3186[_0xadba('0x3e')]=qs[_0xadba('0x35')](_['pick'](_0x5cf438[_0xadba('0x33')],_0x1fb161[_0xadba('0x35')]),_0x43eccf);if(_0x5cf438['query'][_0xadba('0x3f')]){_0x4e3186[_0xadba('0x3e')]=_[_0xadba('0x40')](_0x4e3186[_0xadba('0x3e')],{'$or':_[_0xadba('0x2d')](_0x43eccf,function(_0x20889a){if(_0x20889a[_0xadba('0x2f')]!==_0xadba('0x41')){var _0x5e2a87={};_0x5e2a87[_0x20889a[_0xadba('0x2a')]]={'$like':'%'+_0x5cf438['query'][_0xadba('0x3f')]+'%'};return _0x5e2a87;}})});}_0x4e3186=_[_0xadba('0x40')]({},_0x4e3186,_0x5cf438[_0xadba('0x42')]);var _0x7e6259={'where':_0x4e3186['where']};return db['VoiceRecording'][_0xadba('0x20')](_0x7e6259)['then'](function(_0xcdbe5a){_0x117476['count']=_0xcdbe5a;if(_0x5cf438[_0xadba('0x33')][_0xadba('0x43')]){_0x4e3186[_0xadba('0x44')]=[{'all':!![]}];}return db['VoiceRecording'][_0xadba('0x45')](_0x4e3186);})['then'](function(_0x34757c){_0x117476['rows']=_0x34757c;return _0x117476;})[_0xadba('0x26')](respondWithFilteredResult(_0x9a2bd0,_0x4e3186))[_0xadba('0x46')](handleError(_0x9a2bd0,null));};exports[_0xadba('0x47')]=function(_0x565348,_0x1b8bd8){var _0xe19421={'raw':![],'where':{'id':_0x565348[_0xadba('0x48')]['id']}},_0x43253d={};_0x43253d['model']=_['keys'](db['VoiceRecording'][_0xadba('0x49')]);_0x43253d[_0xadba('0x33')]=_[_0xadba('0x34')](_0x565348[_0xadba('0x33')]);_0x43253d[_0xadba('0x35')]=_[_0xadba('0x37')](_0x43253d[_0xadba('0x31')],_0x43253d[_0xadba('0x33')]);_0xe19421[_0xadba('0x36')]=_['intersection'](_0x43253d[_0xadba('0x31')],qs[_0xadba('0x38')](_0x565348[_0xadba('0x33')][_0xadba('0x38')]));_0xe19421[_0xadba('0x36')]=_0xe19421[_0xadba('0x36')][_0xadba('0x39')]?_0xe19421[_0xadba('0x36')]:_0x43253d['model'];if(_0x565348[_0xadba('0x33')]['includeAll']){_0xe19421[_0xadba('0x44')]=[{'all':!![]}];}_0xe19421=_[_0xadba('0x40')]({},_0xe19421,_0x565348[_0xadba('0x42')]);return db[_0xadba('0x4a')][_0xadba('0x4b')](_0xe19421)[_0xadba('0x26')](handleEntityNotFound(_0x1b8bd8,null))['then'](respondWithResult(_0x1b8bd8,null))[_0xadba('0x46')](handleError(_0x1b8bd8,null));};exports[_0xadba('0x4c')]=function(_0x4f9632,_0x3f3036){return db[_0xadba('0x4a')][_0xadba('0x4c')](_0x4f9632[_0xadba('0x4d')],{})[_0xadba('0x26')](respondWithResult(_0x3f3036,0xc9))[_0xadba('0x46')](handleError(_0x3f3036,null));};exports[_0xadba('0x25')]=function(_0x5b8dba,_0x1b93ac){if(_0x5b8dba[_0xadba('0x4d')]['id']){delete _0x5b8dba['body']['id'];}return db[_0xadba('0x4a')]['find']({'where':{'id':_0x5b8dba[_0xadba('0x48')]['id']}})['then'](handleEntityNotFound(_0x1b93ac,null))['then'](saveUpdates(_0x5b8dba[_0xadba('0x4d')],null))['then'](respondWithResult(_0x1b93ac,null))['catch'](handleError(_0x1b93ac,null));};exports['describe']=function(_0x2b91eb,_0x242412){return db['VoiceRecording'][_0xadba('0x4e')]()[_0xadba('0x26')](respondWithResult(_0x242412,null))[_0xadba('0x46')](handleError(_0x242412,null));};exports[_0xadba('0x4f')]=function(_0xc44f9a,_0x24d38e,_0x43767d){var _0xffb0bd=require(_0xadba('0x50'));var _0x39642e=![];var _0x4fac1b={};if(_0xc44f9a[_0xadba('0x33')][_0xadba('0x2f')]&&_0xc44f9a[_0xadba('0x33')][_0xadba('0x2f')]===_0xadba('0x51')){_0x4fac1b['uniqueid']=_0xc44f9a[_0xadba('0x48')]['id'];}else{_0x4fac1b['id']=_0xc44f9a[_0xadba('0x48')]['id'];}return db[_0xadba('0x4a')][_0xadba('0x4b')]({'where':_0x4fac1b,'attributes':['id',_0xadba('0x52')],'raw':!![]})[_0xadba('0x26')](handleEntityNotFound(_0x24d38e,null))[_0xadba('0x26')](function(_0xe01173){if(_0xe01173){var _0x347043=_0xe01173['value'];var _0x3fc0b5=util['format']('%s.cypher',_0x347043);if(fs[_0xadba('0x53')](_0x3fc0b5)){_0x39642e=!![];return _0xffb0bd[_0xadba('0x54')](_0x3fc0b5,_0x347043,config[_0xadba('0x55')]['recording'])[_0xadba('0x26')](function(){return _0xe01173;});}return _0xe01173;}})[_0xadba('0x26')](function(_0x1b3227){if(_0x1b3227){var _0x269d82=_0x1b3227[_0xadba('0x52')];if(!fs[_0xadba('0x53')](_0x269d82)){throw new db[(_0xadba('0x56'))][(_0xadba('0x57'))](_0xadba('0x58'));}if(_0x1b3227[_0xadba('0x59')]){return _0x24d38e[_0xadba('0x4f')](_0x269d82,_0x1b3227[_0xadba('0x59')]+path[_0xadba('0x5a')](_0x269d82),function(){if(_0x39642e){fs[_0xadba('0x5b')](_0x269d82);}});}else{return _0x24d38e[_0xadba('0x4f')](_0x269d82,function(_0x2e2d68){if(_0x39642e){fs[_0xadba('0x5b')](_0x269d82);}});}}})['catch'](function(_0x47d392){if(_0x47d392[_0xadba('0x5c')]===_0xadba('0x58')){_0x24d38e[_0xadba('0x1b')](0x194)[_0xadba('0x2b')]('Not\x20found');}else{return handleError(_0x24d38e,null);}});};exports[_0xadba('0x5d')]=function(_0x4bfe01,_0x3dcf78,_0x5da3ca){var _0x412ec6=require(_0xadba('0x50'));var _0x133d4f=![];var _0x1bd94a={'$and':[db['sequelize'][_0xadba('0x3e')](db['sequelize']['fn']('MD5',db[_0xadba('0x5e')][_0xadba('0x5f')](_0xadba('0x51'))),_0x4bfe01[_0xadba('0x33')][_0xadba('0x60')])]};if(_0x4bfe01[_0xadba('0x33')][_0xadba('0x2f')]&&_0x4bfe01['query'][_0xadba('0x2f')]===_0xadba('0x51')){_0x1bd94a[_0xadba('0x61')][_0xadba('0x62')]({'uniqueid':_0x4bfe01[_0xadba('0x48')]['id']});}else{_0x1bd94a[_0xadba('0x61')][_0xadba('0x62')]({'id':_0x4bfe01[_0xadba('0x48')]['id']});}return db[_0xadba('0x4a')][_0xadba('0x4b')]({'where':_0x1bd94a,'attributes':['id','value'],'raw':!![]})[_0xadba('0x26')](handleEntityNotFound(_0x3dcf78,null))[_0xadba('0x26')](function(_0x171cd5){if(_0x171cd5){var _0x46ab97=util[_0xadba('0x32')](_0xadba('0x63'),_0x171cd5['value']);if(fs[_0xadba('0x53')](_0x46ab97)){_0x133d4f=!![];return _0x412ec6[_0xadba('0x54')](_0x46ab97,_0x171cd5[_0xadba('0x52')],config[_0xadba('0x55')][_0xadba('0x64')])[_0xadba('0x26')](function(){return _0x171cd5;});}return _0x171cd5;}})[_0xadba('0x26')](function(_0x3c35f9){if(_0x3c35f9){if(!fs[_0xadba('0x53')](_0x3c35f9['value'])){throw new db[(_0xadba('0x56'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x3c35f9['filename']){return _0x3dcf78[_0xadba('0x4f')](_0x3c35f9[_0xadba('0x52')],_0x3c35f9['filename']+path[_0xadba('0x5a')](_0x3c35f9[_0xadba('0x52')]),function(){if(_0x133d4f){fs[_0xadba('0x5b')](_0x3c35f9[_0xadba('0x52')]);}});}else{return _0x3dcf78[_0xadba('0x4f')](_0x3c35f9[_0xadba('0x52')],function(_0x4bc8de){if(_0x133d4f){fs['unlink'](_0x3c35f9[_0xadba('0x52')]);}});}}})[_0xadba('0x46')](handleError(_0x3dcf78,null));};exports[_0xadba('0x27')]=function(_0x381628,_0x45807d){return db[_0xadba('0x4a')][_0xadba('0x4b')]({'where':{'id':_0x381628['params']['id']}})[_0xadba('0x26')](function(_0x21bb36){if(_[_0xadba('0x65')](_0x21bb36)){throw new ReferenceError(_0xadba('0x66'));}return _0x21bb36;})[_0xadba('0x26')](function(_0x503486){var _0x11a428=_0x503486[_0xadba('0x52')];logger[_0xadba('0x67')](_0xadba('0x68'),_0x11a428);if(!_['isNil'](_0x503486[_0xadba('0x52')])&&fs[_0xadba('0x53')](_0x11a428)){logger[_0xadba('0x67')](_0xadba('0x69')+_0x11a428+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x11a428);}_0x11a428=_0x11a428+'.cypher';if(!_['isNil'](_0x503486['value'])&&fs['existsSync'](_0x11a428)){logger[_0xadba('0x67')](_0xadba('0x69')+_0x11a428+_0xadba('0x6a'));fs[_0xadba('0x6b')](_0x11a428);}return _0x503486;})[_0xadba('0x26')](function(_0x215b68){if(!_0x215b68)throw new InternalError();return _0x215b68[_0xadba('0x27')]();})[_0xadba('0x26')](function(){_0x45807d[_0xadba('0x1b')](0xcc)[_0xadba('0x6c')]();})[_0xadba('0x46')](handleError(_0x45807d,null));};function getBucketslist(_0x3eb4f9,_0x4e5c78,_0x37b025){return new Promise(function(_0x17f1f0,_0x17b215){var _0x65d052=new AWS['S3']({'accessKeyId':_0x4e5c78,'secretAccessKey':_0x3eb4f9,'region':_0x37b025});_0x65d052['listBuckets']({},function(_0xb9d6a,_0x4290e2){if(_0xb9d6a){return _0x17b215(_0xb9d6a);}else{return _0x17f1f0(_0x4290e2);}});});}function createBucket(_0x5613e7,_0x1dfa19,_0x398d05,_0x998a9a){return new Promise(function(_0x20564a,_0x536da6){var _0x4c3b68=new AWS['S3']({'accessKeyId':_0x1dfa19,'secretAccessKey':_0x5613e7,'region':_0x398d05});_0x4c3b68[_0xadba('0x6d')]({'Bucket':_0x998a9a},function(_0x39e589,_0x52c8fa){if(_0x39e589){return _0x536da6(_0x39e589);}else{return _0x20564a(_0x52c8fa);}});});}function uploadFile(_0x2db7ec,_0x2684ee,_0x2225cc,_0x18b3af,_0x59bc82,_0x48a683){return new Promise(function(_0x19a273,_0x5b2ca9){var _0x1fa078=new AWS['S3']({'accessKeyId':_0x2684ee,'secretAccessKey':_0x2db7ec,'region':_0x2225cc});_0x1fa078[_0xadba('0x6e')]({'Bucket':_0x18b3af,'Key':_0x59bc82,'Body':_0x48a683},function(_0x40d5d6,_0x3d88e6){if(_0x40d5d6){return _0x5b2ca9(_0x40d5d6);}else{return _0x19a273(_0x3d88e6);}});});}function startTranscribe(_0x94abd5,_0x2a6fd2,_0x478794,_0x2c7719,_0x2cf51e,_0x417227){return new Promise(function(_0x5b1ab4,_0x5073fe){var _0x467c8c=new AWS[(_0xadba('0x6f'))]({'accessKeyId':_0x2a6fd2,'secretAccessKey':_0x94abd5,'region':_0x478794});_0x467c8c[_0xadba('0x70')]({'TranscriptionJobName':_0x2c7719,'LanguageCode':_0x2cf51e,'Media':{'MediaFileUri':_0x417227}},function(_0x48b162,_0x2809da){if(_0x48b162){return _0x5073fe(_0x48b162);}else{return _0x5b1ab4(_0x2809da);}});});}function transcribe(_0x12e3c5,_0x4a3d46,_0x44e3a2,_0x539fe2,_0x4c90ae,_0x45b765,_0x50593a){return new Promise(function(_0x2ed7ae,_0x13d7a5){var _0x526510={};logger[_0xadba('0x67')](util[_0xadba('0x32')](_0xadba('0x71'),_0x12e3c5,_0x4c90ae));return uploadFile(_0x4a3d46,_0x44e3a2,_0x539fe2,_0x4c90ae,path[_0xadba('0x72')](_0x45b765),fs['readFileSync'](_0x45b765))[_0xadba('0x26')](function(_0x3c41b0){logger[_0xadba('0x67')](util['format'](_0xadba('0x73'),_0x12e3c5,_0x4c90ae,_0x3c41b0[_0xadba('0x74')]));_0x526510[_0xadba('0x75')]=_0x3c41b0[_0xadba('0x76')];_0x526510['location']=_0x3c41b0[_0xadba('0x74')];logger['info'](util[_0xadba('0x32')](_0xadba('0x77'),_0x12e3c5));return startTranscribe(_0x4a3d46,_0x44e3a2,_0x539fe2,uuidv4(),_0x50593a,_0x3c41b0[_0xadba('0x74')]);})['then'](function(_0x544071){logger[_0xadba('0x67')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x12e3c5,_0x544071['TranscriptionJob'][_0xadba('0x78')]));_0x526510[_0xadba('0x79')]=_0x544071[_0xadba('0x7a')]['TranscriptionJobName'];_0x526510[_0xadba('0x7b')]=_0x544071[_0xadba('0x7a')][_0xadba('0x7c')];return _0x2ed7ae(_0x526510);})[_0xadba('0x46')](function(_0x1859a3){return _0x13d7a5(_0x1859a3);});});}exports['runTranscribe']=function(_0x4446c7,_0x2d1579,_0xaace5c){var _0xd10340;var _0x2019e0;var _0x3c50e9;var _0x479617=require(_0xadba('0x50'));return db[_0xadba('0x4a')]['findOne']({'where':{'id':_0x4446c7[_0xadba('0x48')]['id']}})[_0xadba('0x26')](function(_0x54dc44){if(_0x54dc44){var _0x196b8d=util['format'](_0xadba('0x63'),_0x54dc44['value']);if(fs['existsSync'](_0x196b8d)){cypher=!![];return _0x479617[_0xadba('0x54')](_0x196b8d,_0x54dc44[_0xadba('0x52')],config['secrets'][_0xadba('0x64')])[_0xadba('0x26')](function(){return _0x54dc44;});}return _0x54dc44;}})[_0xadba('0x26')](function(_0x40d0f4){if(!_0x40d0f4){throw new db[(_0xadba('0x56'))]['ValidationError'](_0xadba('0x7d'));}_0x2019e0=_0x40d0f4;return db[_0xadba('0x7e')][_0xadba('0x7f')]({'where':{'id':0x1}});})[_0xadba('0x26')](handleEntityNotFound(_0x2d1579,null))[_0xadba('0x26')](function(_0xd5e61f){if(_0xd5e61f){_0xd10340=_0xd5e61f;if(!_0xd10340[_0xadba('0x80')]||!_0xd10340['transcribeAccountId']||!_0xd10340['transcribeRegion']||!_0xd10340[_0xadba('0x81')]||!_0xd10340[_0xadba('0x75')]){throw new db[(_0xadba('0x56'))]['ValidationError'](_0xadba('0x82'));}if(_0x4446c7['body'][_0xadba('0x83')]&&(!_0xd10340['sentiment']||!_0xd10340['sentimentAccountId']||!_0xd10340[_0xadba('0x84')]||!_0xd10340['language']||!_0xd10340[_0xadba('0x75')])){throw new db[(_0xadba('0x56'))][(_0xadba('0x57'))](_0xadba('0x85'));}return db[_0xadba('0x86')][_0xadba('0x7f')]({'where':{'id':_0xd10340['transcribeAccountId']}});}})[_0xadba('0x26')](function(_0x2c23eb){if(!_0x2c23eb){throw new db[(_0xadba('0x56'))][(_0xadba('0x57'))](_0xadba('0x87'));}if(!_0x2c23eb[_0xadba('0x88')]||!_0x2c23eb[_0xadba('0x89')]){throw new db[(_0xadba('0x56'))][(_0xadba('0x57'))]('Cloud\x20Provider\x20not\x20configured');}_0x3c50e9=_0x2c23eb;return getBucketslist(_0x3c50e9[_0xadba('0x88')],_0x3c50e9[_0xadba('0x89')],_0xd10340['transcribeRegion']);})[_0xadba('0x26')](function(_0x1b369c){if(_0x1b369c&&_0x1b369c[_0xadba('0x8a')]){var _0x1a1b94=_[_0xadba('0x4b')](_0x1b369c[_0xadba('0x8a')],function(_0x4b5154){return _0x4b5154[_0xadba('0x8b')]===_0xd10340[_0xadba('0x75')];});if(!_0x1a1b94){logger[_0xadba('0x67')](util[_0xadba('0x32')](_0xadba('0x8c'),_0x4446c7[_0xadba('0x48')]['id'],_0xd10340[_0xadba('0x75')]));return createBucket(_0x3c50e9[_0xadba('0x88')],_0x3c50e9['data2'],_0xd10340[_0xadba('0x8d')],_0xd10340[_0xadba('0x75')]);}logger['info'](util[_0xadba('0x32')](_0xadba('0x8e'),_0x4446c7[_0xadba('0x48')]['id'],_0xd10340['bucket']));return;}})[_0xadba('0x26')](function(_0x36da88){if(_0x2019e0[_0xadba('0x7b')]===_0xadba('0x8f')){return transcribe(_0x4446c7['params']['id'],_0x3c50e9[_0xadba('0x88')],_0x3c50e9['data2'],_0xd10340[_0xadba('0x8d')],_0xd10340['bucket'],_0x2019e0['value'],_0xd10340[_0xadba('0x81')]);}else{logger['info'](util['format'](_0xadba('0x90'),_0x4446c7[_0xadba('0x48')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xadba('0x26')](function(_0x1b796f){if(_0x1b796f){_0x1b796f[_0xadba('0x91')]=_0x4446c7[_0xadba('0x4d')][_0xadba('0x83')];return _0x2019e0[_0xadba('0x92')](_0x1b796f);}})[_0xadba('0x26')](respondWithResult(_0x2d1579,null))[_0xadba('0x46')](handleError(_0x2d1579,null));};function writeFile(_0x1832c3,_0x345427){return new Promise(function(_0x4b6446,_0x4781dc){fs['writeFile'](_0x345427,_0x1832c3,function(_0x1d3987,_0xab42b){if(_0x1d3987){return _0x4781dc(_0x1d3987);}else{return _0x4b6446(_0xab42b);}});});}exports[_0xadba('0x93')]=function(_0x226054,_0x53eff8,_0x3fdee6){return db[_0xadba('0x4a')][_0xadba('0x7f')]({'where':{'id':_0x226054['params']['id']}})[_0xadba('0x26')](handleEntityNotFound(_0x53eff8))[_0xadba('0x26')](function(_0x25b023){if(_0x25b023&&_0x25b023[_0xadba('0x94')]){var _0x35958a=_0x25b023[_0xadba('0x94')];var _0x15cf05=config['root']+'/server/files/transcribes/transcribe_'+_0x25b023['id']+_0xadba('0x95');if(fs['existsSync'](_0x15cf05)){return _0x15cf05;}return writeFile(_0x35958a,_0x15cf05)[_0xadba('0x26')](function(){return _0x15cf05;});}else{throw new db[(_0xadba('0x56'))][(_0xadba('0x57'))]('Transcript\x20not\x20available');}})[_0xadba('0x26')](function(_0x4d0150){return _0x53eff8['download'](_0x4d0150);})[_0xadba('0x46')](handleError(_0x53eff8));}; \ No newline at end of file +var _0xcd52=['mustache','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','VoiceRecording','rawAttributes','fieldName','type','differenceBy','map','format','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','where','filters','pick','merge','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','decryptFile','secrets','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','createBucket','upload','TranscribeService','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','runTranscribe','Voice\x20Recording\x20not\x20found','findOne','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','CloudProvider','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xcd52,0x8e));var _0x2cd5=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xcd52[_0x16b9ed];return _0x66b1f8;};'use strict';var emlformat=require(_0x2cd5('0x0'));var rimraf=require(_0x2cd5('0x1'));var zipdir=require(_0x2cd5('0x2'));var jsonpatch=require(_0x2cd5('0x3'));var rp=require(_0x2cd5('0x4'));var moment=require(_0x2cd5('0x5'));var BPromise=require(_0x2cd5('0x6'));var Mustache=require(_0x2cd5('0x7'));var util=require(_0x2cd5('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x2cd5('0x9'));var ejs=require(_0x2cd5('0xa'));var fs=require('fs');var fs_extra=require(_0x2cd5('0xb'));var _=require('lodash');var squel=require(_0x2cd5('0xc'));var crypto=require(_0x2cd5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2cd5('0xe'));var toCsv=require(_0x2cd5('0x9'));var querystring=require(_0x2cd5('0xf'));var Papa=require(_0x2cd5('0x10'));var AWS=require(_0x2cd5('0x11'));var uuidv4=require(_0x2cd5('0x12'));var Redis=require(_0x2cd5('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2cd5('0x14'));var as=require(_0x2cd5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2cd5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2cd5('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a88eb,_0x55c254){_0x55c254=_0x55c254||0xcc;return function(_0x75f8d5){if(_0x75f8d5){return _0x1a88eb[_0x2cd5('0x18')](_0x55c254);}return _0x1a88eb['status'](_0x55c254)[_0x2cd5('0x19')]();};}function respondWithResult(_0x3faaac,_0x496723){_0x496723=_0x496723||0xc8;return function(_0x38a34b){if(_0x38a34b){return _0x3faaac[_0x2cd5('0x1a')](_0x496723)[_0x2cd5('0x1b')](_0x38a34b);}};}function respondWithFilteredResult(_0x544eb1,_0xe7ad38){return function(_0x2f6f2f){if(_0x2f6f2f){var _0x271992=typeof _0xe7ad38[_0x2cd5('0x1c')]===_0x2cd5('0x1d')&&typeof _0xe7ad38[_0x2cd5('0x1e')]==='undefined';var _0x5dcff3=_0x2f6f2f[_0x2cd5('0x1f')];var _0x76099d=_0x271992?0x0:_0xe7ad38[_0x2cd5('0x1c')];var _0x4dc330=_0x271992?_0x2f6f2f[_0x2cd5('0x1f')]:_0xe7ad38['offset']+_0xe7ad38[_0x2cd5('0x1e')];var _0x2f4ee6;if(_0x4dc330>=_0x5dcff3){_0x4dc330=_0x5dcff3;_0x2f4ee6=0xc8;}else{_0x2f4ee6=0xce;}_0x544eb1[_0x2cd5('0x1a')](_0x2f4ee6);return _0x544eb1[_0x2cd5('0x20')](_0x2cd5('0x21'),_0x76099d+'-'+_0x4dc330+'/'+_0x5dcff3)[_0x2cd5('0x1b')](_0x2f6f2f);}return null;};}function patchUpdates(_0x49f14b){return function(_0x4e9700){try{jsonpatch[_0x2cd5('0x22')](_0x4e9700,_0x49f14b,!![]);}catch(_0x5dba0d){return BPromise['reject'](_0x5dba0d);}return _0x4e9700[_0x2cd5('0x23')]();};}function saveUpdates(_0x511a2a,_0x52ac7f){return function(_0x49f073){if(_0x49f073){return _0x49f073[_0x2cd5('0x24')](_0x511a2a)[_0x2cd5('0x25')](function(_0x3f0ba1){return _0x3f0ba1;});}return null;};}function removeEntity(_0x180e82,_0x31d4e2){return function(_0x38ba81){if(_0x38ba81){return _0x38ba81[_0x2cd5('0x26')]()[_0x2cd5('0x25')](function(){_0x180e82[_0x2cd5('0x1a')](0xcc)[_0x2cd5('0x19')]();});}};}function handleEntityNotFound(_0x141801,_0x19d793){return function(_0x29a0af){if(!_0x29a0af){_0x141801[_0x2cd5('0x18')](0x194);}return _0x29a0af;};}function handleError(_0x17a4b2,_0x4c248d){_0x4c248d=_0x4c248d||0x1f4;return function(_0x15390d){logger[_0x2cd5('0x27')](_0x15390d[_0x2cd5('0x28')]);if(_0x15390d[_0x2cd5('0x29')]){delete _0x15390d[_0x2cd5('0x29')];}_0x17a4b2[_0x2cd5('0x1a')](_0x4c248d)[_0x2cd5('0x2a')](_0x15390d);};}exports[_0x2cd5('0x2b')]=function(_0x409d34,_0x2d8dce){var _0x2e86ee={},_0x2c177d={},_0x4043ac={'count':0x0,'rows':[]};var _0x371d16=_['map'](db[_0x2cd5('0x2c')][_0x2cd5('0x2d')],function(_0x2dc895){return{'name':_0x2dc895[_0x2cd5('0x2e')],'type':_0x2dc895[_0x2cd5('0x2f')]['key']};});_0x2c177d['model']=_[_0x2cd5('0x30')](_[_0x2cd5('0x31')](_0x371d16,'name'),[_0x2cd5('0x32')]);_0x2c177d[_0x2cd5('0x33')]=_[_0x2cd5('0x34')](_0x409d34[_0x2cd5('0x33')]);_0x2c177d['filters']=_[_0x2cd5('0x35')](_0x2c177d[_0x2cd5('0x36')],_0x2c177d['query']);_0x2e86ee['attributes']=_[_0x2cd5('0x35')](_0x2c177d['model'],qs['fields'](_0x409d34[_0x2cd5('0x33')][_0x2cd5('0x37')]));_0x2e86ee[_0x2cd5('0x38')]=_0x2e86ee[_0x2cd5('0x38')][_0x2cd5('0x39')]?_0x2e86ee[_0x2cd5('0x38')]:_0x2c177d[_0x2cd5('0x36')];if(!_0x409d34[_0x2cd5('0x33')][_0x2cd5('0x3a')]('nolimit')){_0x2e86ee[_0x2cd5('0x1e')]=qs[_0x2cd5('0x1e')](_0x409d34[_0x2cd5('0x33')][_0x2cd5('0x1e')]);_0x2e86ee[_0x2cd5('0x1c')]=qs[_0x2cd5('0x1c')](_0x409d34[_0x2cd5('0x33')][_0x2cd5('0x1c')]);}_0x2e86ee[_0x2cd5('0x3b')]=qs['sort'](_0x409d34[_0x2cd5('0x33')]['sort']);_0x2e86ee[_0x2cd5('0x3c')]=qs[_0x2cd5('0x3d')](_[_0x2cd5('0x3e')](_0x409d34[_0x2cd5('0x33')],_0x2c177d[_0x2cd5('0x3d')]),_0x371d16);if(_0x409d34['query']['filter']){_0x2e86ee['where']=_[_0x2cd5('0x3f')](_0x2e86ee[_0x2cd5('0x3c')],{'$or':_['map'](_0x371d16,function(_0x3c2537){if(_0x3c2537[_0x2cd5('0x2f')]!==_0x2cd5('0x40')){var _0x5da685={};_0x5da685[_0x3c2537[_0x2cd5('0x29')]]={'$like':'%'+_0x409d34['query']['filter']+'%'};return _0x5da685;}})});}_0x2e86ee=_[_0x2cd5('0x3f')]({},_0x2e86ee,_0x409d34['options']);var _0xa13379={'where':_0x2e86ee[_0x2cd5('0x3c')]};return db[_0x2cd5('0x2c')][_0x2cd5('0x1f')](_0xa13379)['then'](function(_0x3f32e5){_0x4043ac[_0x2cd5('0x1f')]=_0x3f32e5;if(_0x409d34[_0x2cd5('0x33')]['includeAll']){_0x2e86ee[_0x2cd5('0x41')]=[{'all':!![]}];}return db['VoiceRecording'][_0x2cd5('0x42')](_0x2e86ee);})[_0x2cd5('0x25')](function(_0x104554){_0x4043ac[_0x2cd5('0x43')]=_0x104554;return _0x4043ac;})['then'](respondWithFilteredResult(_0x2d8dce,_0x2e86ee))[_0x2cd5('0x44')](handleError(_0x2d8dce,null));};exports[_0x2cd5('0x45')]=function(_0x2d530b,_0x2de3f3){var _0xc7a675={'raw':![],'where':{'id':_0x2d530b[_0x2cd5('0x46')]['id']}},_0x29e573={};_0x29e573['model']=_['keys'](db[_0x2cd5('0x2c')]['rawAttributes']);_0x29e573[_0x2cd5('0x33')]=_[_0x2cd5('0x34')](_0x2d530b[_0x2cd5('0x33')]);_0x29e573['filters']=_[_0x2cd5('0x35')](_0x29e573['model'],_0x29e573[_0x2cd5('0x33')]);_0xc7a675[_0x2cd5('0x38')]=_[_0x2cd5('0x35')](_0x29e573[_0x2cd5('0x36')],qs['fields'](_0x2d530b['query']['fields']));_0xc7a675[_0x2cd5('0x38')]=_0xc7a675['attributes'][_0x2cd5('0x39')]?_0xc7a675[_0x2cd5('0x38')]:_0x29e573[_0x2cd5('0x36')];if(_0x2d530b[_0x2cd5('0x33')][_0x2cd5('0x47')]){_0xc7a675['include']=[{'all':!![]}];}_0xc7a675=_[_0x2cd5('0x3f')]({},_0xc7a675,_0x2d530b[_0x2cd5('0x48')]);return db['VoiceRecording']['find'](_0xc7a675)[_0x2cd5('0x25')](handleEntityNotFound(_0x2de3f3,null))[_0x2cd5('0x25')](respondWithResult(_0x2de3f3,null))[_0x2cd5('0x44')](handleError(_0x2de3f3,null));};exports[_0x2cd5('0x49')]=function(_0x5345ff,_0xe1b37f){return db[_0x2cd5('0x2c')][_0x2cd5('0x49')](_0x5345ff[_0x2cd5('0x4a')],{})[_0x2cd5('0x25')](respondWithResult(_0xe1b37f,0xc9))[_0x2cd5('0x44')](handleError(_0xe1b37f,null));};exports['update']=function(_0x1da36d,_0x2c7faa){if(_0x1da36d[_0x2cd5('0x4a')]['id']){delete _0x1da36d[_0x2cd5('0x4a')]['id'];}return db[_0x2cd5('0x2c')][_0x2cd5('0x4b')]({'where':{'id':_0x1da36d[_0x2cd5('0x46')]['id']}})[_0x2cd5('0x25')](handleEntityNotFound(_0x2c7faa,null))[_0x2cd5('0x25')](saveUpdates(_0x1da36d[_0x2cd5('0x4a')],null))['then'](respondWithResult(_0x2c7faa,null))[_0x2cd5('0x44')](handleError(_0x2c7faa,null));};exports['describe']=function(_0x464040,_0xafe11c){return db['VoiceRecording']['describe']()[_0x2cd5('0x25')](respondWithResult(_0xafe11c,null))[_0x2cd5('0x44')](handleError(_0xafe11c,null));};exports[_0x2cd5('0x4c')]=function(_0x29cffb,_0x5f2858,_0x17144b){var _0x452dc4=require(_0x2cd5('0x4d'));var _0x5c65c0=![];var _0x47b523={};if(_0x29cffb[_0x2cd5('0x33')][_0x2cd5('0x2f')]&&_0x29cffb[_0x2cd5('0x33')][_0x2cd5('0x2f')]===_0x2cd5('0x4e')){_0x47b523[_0x2cd5('0x4e')]=_0x29cffb[_0x2cd5('0x46')]['id'];}else{_0x47b523['id']=_0x29cffb[_0x2cd5('0x46')]['id'];}return db[_0x2cd5('0x2c')]['find']({'where':_0x47b523,'attributes':['id',_0x2cd5('0x4f')],'raw':!![]})[_0x2cd5('0x25')](handleEntityNotFound(_0x5f2858,null))['then'](function(_0x590bf3){if(_0x590bf3){var _0x565935=_0x590bf3[_0x2cd5('0x4f')];var _0x54536c=util[_0x2cd5('0x32')](_0x2cd5('0x50'),_0x565935);if(fs[_0x2cd5('0x51')](_0x54536c)){_0x5c65c0=!![];return _0x452dc4['decryptFile'](_0x54536c,_0x565935,config['secrets'][_0x2cd5('0x52')])[_0x2cd5('0x25')](function(){return _0x590bf3;});}return _0x590bf3;}})[_0x2cd5('0x25')](function(_0x57b83f){if(_0x57b83f){var _0x5b12da=_0x57b83f[_0x2cd5('0x4f')];if(!fs[_0x2cd5('0x51')](_0x5b12da)){throw new db[(_0x2cd5('0x53'))][(_0x2cd5('0x54'))](_0x2cd5('0x55'));}if(_0x57b83f[_0x2cd5('0x56')]){return _0x5f2858['download'](_0x5b12da,_0x57b83f[_0x2cd5('0x56')]+path[_0x2cd5('0x57')](_0x5b12da),function(){if(_0x5c65c0){fs[_0x2cd5('0x58')](_0x5b12da);}});}else{return _0x5f2858[_0x2cd5('0x4c')](_0x5b12da,function(_0x47665c){if(_0x5c65c0){fs[_0x2cd5('0x58')](_0x5b12da);}});}}})['catch'](function(_0x57131f){if(_0x57131f[_0x2cd5('0x59')]===_0x2cd5('0x55')){_0x5f2858[_0x2cd5('0x1a')](0x194)[_0x2cd5('0x2a')](_0x2cd5('0x5a'));}else{return handleError(_0x5f2858,null);}});};exports[_0x2cd5('0x5b')]=function(_0xdf1d39,_0x22b61a,_0x4b9dcc){var _0x1089e9=require('../../components/encryptor');var _0x5f2054=![];var _0x3fd6ee={'$and':[db[_0x2cd5('0x5c')][_0x2cd5('0x3c')](db[_0x2cd5('0x5c')]['fn'](_0x2cd5('0x5d'),db[_0x2cd5('0x5c')][_0x2cd5('0x5e')](_0x2cd5('0x4e'))),_0xdf1d39['query'][_0x2cd5('0x5f')])]};if(_0xdf1d39['query'][_0x2cd5('0x2f')]&&_0xdf1d39[_0x2cd5('0x33')][_0x2cd5('0x2f')]===_0x2cd5('0x4e')){_0x3fd6ee[_0x2cd5('0x60')][_0x2cd5('0x61')]({'uniqueid':_0xdf1d39[_0x2cd5('0x46')]['id']});}else{_0x3fd6ee[_0x2cd5('0x60')][_0x2cd5('0x61')]({'id':_0xdf1d39[_0x2cd5('0x46')]['id']});}return db[_0x2cd5('0x2c')][_0x2cd5('0x4b')]({'where':_0x3fd6ee,'attributes':['id',_0x2cd5('0x4f')],'raw':!![]})[_0x2cd5('0x25')](handleEntityNotFound(_0x22b61a,null))[_0x2cd5('0x25')](function(_0x3e29fd){if(_0x3e29fd){var _0x51e363=util[_0x2cd5('0x32')](_0x2cd5('0x50'),_0x3e29fd['value']);if(fs[_0x2cd5('0x51')](_0x51e363)){_0x5f2054=!![];return _0x1089e9[_0x2cd5('0x62')](_0x51e363,_0x3e29fd[_0x2cd5('0x4f')],config[_0x2cd5('0x63')]['recording'])[_0x2cd5('0x25')](function(){return _0x3e29fd;});}return _0x3e29fd;}})[_0x2cd5('0x25')](function(_0x2d0282){if(_0x2d0282){if(!fs['existsSync'](_0x2d0282[_0x2cd5('0x4f')])){throw new db[(_0x2cd5('0x53'))][(_0x2cd5('0x54'))](_0x2cd5('0x55'));}if(_0x2d0282[_0x2cd5('0x56')]){return _0x22b61a['download'](_0x2d0282[_0x2cd5('0x4f')],_0x2d0282[_0x2cd5('0x56')]+path[_0x2cd5('0x57')](_0x2d0282['value']),function(){if(_0x5f2054){fs['unlink'](_0x2d0282[_0x2cd5('0x4f')]);}});}else{return _0x22b61a[_0x2cd5('0x4c')](_0x2d0282['value'],function(_0x4c21cb){if(_0x5f2054){fs[_0x2cd5('0x58')](_0x2d0282[_0x2cd5('0x4f')]);}});}}})[_0x2cd5('0x44')](handleError(_0x22b61a,null));};exports[_0x2cd5('0x26')]=function(_0x8b1e8b,_0x8810cb){return db[_0x2cd5('0x2c')][_0x2cd5('0x4b')]({'where':{'id':_0x8b1e8b[_0x2cd5('0x46')]['id']}})[_0x2cd5('0x25')](function(_0x144e1b){if(_[_0x2cd5('0x64')](_0x144e1b)){throw new ReferenceError(_0x2cd5('0x65'));}return _0x144e1b;})[_0x2cd5('0x25')](function(_0x1525bc){var _0x19f829=_0x1525bc[_0x2cd5('0x4f')];logger[_0x2cd5('0x66')](_0x2cd5('0x67'),_0x19f829);if(!_[_0x2cd5('0x64')](_0x1525bc[_0x2cd5('0x4f')])&&fs[_0x2cd5('0x51')](_0x19f829)){logger[_0x2cd5('0x66')]('File:\x20\x22'+_0x19f829+_0x2cd5('0x68'));fs[_0x2cd5('0x69')](_0x19f829);}_0x19f829=_0x19f829+'.cypher';if(!_[_0x2cd5('0x64')](_0x1525bc[_0x2cd5('0x4f')])&&fs[_0x2cd5('0x51')](_0x19f829)){logger['info'](_0x2cd5('0x6a')+_0x19f829+_0x2cd5('0x68'));fs[_0x2cd5('0x69')](_0x19f829);}return _0x1525bc;})[_0x2cd5('0x25')](function(_0x1ec389){if(!_0x1ec389)throw new InternalError();return _0x1ec389['destroy']();})[_0x2cd5('0x25')](function(){_0x8810cb['status'](0xcc)[_0x2cd5('0x19')]();})[_0x2cd5('0x44')](handleError(_0x8810cb,null));};function getBucketslist(_0x513688,_0x5dafca,_0x495995){return new Promise(function(_0x138e54,_0x2e1e8e){var _0xd59f2a=new AWS['S3']({'accessKeyId':_0x5dafca,'secretAccessKey':_0x513688,'region':_0x495995});_0xd59f2a['listBuckets']({},function(_0x402947,_0x4cc9e7){if(_0x402947){return _0x2e1e8e(_0x402947);}else{return _0x138e54(_0x4cc9e7);}});});}function createBucket(_0x45fdd3,_0x1bd5f8,_0x1ba2bf,_0x1d7047){return new Promise(function(_0x3d0a4b,_0xcd0446){var _0x4db278=new AWS['S3']({'accessKeyId':_0x1bd5f8,'secretAccessKey':_0x45fdd3,'region':_0x1ba2bf});_0x4db278[_0x2cd5('0x6b')]({'Bucket':_0x1d7047},function(_0x1fda1b,_0x5e2e82){if(_0x1fda1b){return _0xcd0446(_0x1fda1b);}else{return _0x3d0a4b(_0x5e2e82);}});});}function uploadFile(_0x5457ee,_0x5aec61,_0x118c67,_0x104969,_0x839b1b,_0xe7da1a){return new Promise(function(_0x20b044,_0xf21db4){var _0x5ba010=new AWS['S3']({'accessKeyId':_0x5aec61,'secretAccessKey':_0x5457ee,'region':_0x118c67});_0x5ba010[_0x2cd5('0x6c')]({'Bucket':_0x104969,'Key':_0x839b1b,'Body':_0xe7da1a},function(_0x3f383a,_0x5535a8){if(_0x3f383a){return _0xf21db4(_0x3f383a);}else{return _0x20b044(_0x5535a8);}});});}function startTranscribe(_0x43c63b,_0x2ec6bd,_0x28dcc3,_0x59e972,_0x3a80e6,_0x2d37bc){return new Promise(function(_0x135f08,_0x375518){var _0x55c53b=new AWS[(_0x2cd5('0x6d'))]({'accessKeyId':_0x2ec6bd,'secretAccessKey':_0x43c63b,'region':_0x28dcc3});_0x55c53b['startTranscriptionJob']({'TranscriptionJobName':_0x59e972,'LanguageCode':_0x3a80e6,'Media':{'MediaFileUri':_0x2d37bc}},function(_0x58bc29,_0x1d2160){if(_0x58bc29){return _0x375518(_0x58bc29);}else{return _0x135f08(_0x1d2160);}});});}function transcribe(_0x2a0680,_0xdc976e,_0x52bd11,_0x3d1dc6,_0x3f93eb,_0x7356c8,_0x7426f2){return new Promise(function(_0x47cf56,_0x1fa184){var _0x3e28c5={};logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x2a0680,_0x3f93eb));return uploadFile(_0xdc976e,_0x52bd11,_0x3d1dc6,_0x3f93eb,path[_0x2cd5('0x6e')](_0x7356c8),fs[_0x2cd5('0x6f')](_0x7356c8))[_0x2cd5('0x25')](function(_0x3202ef){logger[_0x2cd5('0x66')](util[_0x2cd5('0x32')](_0x2cd5('0x70'),_0x2a0680,_0x3f93eb,_0x3202ef[_0x2cd5('0x71')]));_0x3e28c5[_0x2cd5('0x72')]=_0x3202ef[_0x2cd5('0x73')];_0x3e28c5[_0x2cd5('0x74')]=_0x3202ef[_0x2cd5('0x71')];logger[_0x2cd5('0x66')](util[_0x2cd5('0x32')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x2a0680));return startTranscribe(_0xdc976e,_0x52bd11,_0x3d1dc6,uuidv4(),_0x7426f2,_0x3202ef['Location']);})['then'](function(_0x59bb8b){logger[_0x2cd5('0x66')](util[_0x2cd5('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x2a0680,_0x59bb8b[_0x2cd5('0x75')][_0x2cd5('0x76')]));_0x3e28c5[_0x2cd5('0x77')]=_0x59bb8b['TranscriptionJob'][_0x2cd5('0x76')];_0x3e28c5[_0x2cd5('0x78')]=_0x59bb8b[_0x2cd5('0x75')]['TranscriptionJobStatus'];return _0x47cf56(_0x3e28c5);})[_0x2cd5('0x44')](function(_0x2c381a){return _0x1fa184(_0x2c381a);});});}exports[_0x2cd5('0x79')]=function(_0x5061ef,_0x42a036,_0x30a6ae){var _0xd4133f;var _0x26bee5;var _0x5f5670;var _0x5769d3=require(_0x2cd5('0x4d'));return db['VoiceRecording']['findOne']({'where':{'id':_0x5061ef[_0x2cd5('0x46')]['id']}})[_0x2cd5('0x25')](function(_0x58fd94){if(_0x58fd94){var _0x5f09bd=util[_0x2cd5('0x32')](_0x2cd5('0x50'),_0x58fd94['value']);if(fs[_0x2cd5('0x51')](_0x5f09bd)){cypher=!![];return _0x5769d3[_0x2cd5('0x62')](_0x5f09bd,_0x58fd94[_0x2cd5('0x4f')],config[_0x2cd5('0x63')][_0x2cd5('0x52')])[_0x2cd5('0x25')](function(){return _0x58fd94;});}return _0x58fd94;}})[_0x2cd5('0x25')](function(_0x464bc4){if(!_0x464bc4){throw new db[(_0x2cd5('0x53'))][(_0x2cd5('0x54'))](_0x2cd5('0x7a'));}_0x26bee5=_0x464bc4;return db['Setting'][_0x2cd5('0x7b')]({'where':{'id':0x1}});})[_0x2cd5('0x25')](handleEntityNotFound(_0x42a036,null))[_0x2cd5('0x25')](function(_0x5c239a){if(_0x5c239a){_0xd4133f=_0x5c239a;if(!_0xd4133f[_0x2cd5('0x7c')]||!_0xd4133f[_0x2cd5('0x7d')]||!_0xd4133f[_0x2cd5('0x7e')]||!_0xd4133f[_0x2cd5('0x7f')]||!_0xd4133f[_0x2cd5('0x72')]){throw new db[(_0x2cd5('0x53'))][(_0x2cd5('0x54'))](_0x2cd5('0x80'));}if(_0x5061ef[_0x2cd5('0x4a')][_0x2cd5('0x81')]&&(!_0xd4133f[_0x2cd5('0x82')]||!_0xd4133f['sentimentAccountId']||!_0xd4133f[_0x2cd5('0x83')]||!_0xd4133f[_0x2cd5('0x7f')]||!_0xd4133f[_0x2cd5('0x72')])){throw new db[(_0x2cd5('0x53'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x2cd5('0x84')][_0x2cd5('0x7b')]({'where':{'id':_0xd4133f[_0x2cd5('0x7d')]}});}})[_0x2cd5('0x25')](function(_0x572f81){if(!_0x572f81){throw new db[(_0x2cd5('0x53'))][(_0x2cd5('0x54'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x572f81[_0x2cd5('0x85')]||!_0x572f81[_0x2cd5('0x86')]){throw new db[(_0x2cd5('0x53'))][(_0x2cd5('0x54'))]('Cloud\x20Provider\x20not\x20configured');}_0x5f5670=_0x572f81;return getBucketslist(_0x5f5670[_0x2cd5('0x85')],_0x5f5670['data2'],_0xd4133f[_0x2cd5('0x7e')]);})['then'](function(_0x286027){if(_0x286027&&_0x286027[_0x2cd5('0x87')]){var _0x180a10=_[_0x2cd5('0x4b')](_0x286027[_0x2cd5('0x87')],function(_0x5f5a91){return _0x5f5a91[_0x2cd5('0x88')]===_0xd4133f[_0x2cd5('0x72')];});if(!_0x180a10){logger[_0x2cd5('0x66')](util[_0x2cd5('0x32')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x5061ef[_0x2cd5('0x46')]['id'],_0xd4133f[_0x2cd5('0x72')]));return createBucket(_0x5f5670[_0x2cd5('0x85')],_0x5f5670[_0x2cd5('0x86')],_0xd4133f[_0x2cd5('0x7e')],_0xd4133f[_0x2cd5('0x72')]);}logger[_0x2cd5('0x66')](util[_0x2cd5('0x32')](_0x2cd5('0x89'),_0x5061ef[_0x2cd5('0x46')]['id'],_0xd4133f[_0x2cd5('0x72')]));return;}})[_0x2cd5('0x25')](function(_0x459403){if(_0x26bee5[_0x2cd5('0x78')]===_0x2cd5('0x8a')){return transcribe(_0x5061ef['params']['id'],_0x5f5670[_0x2cd5('0x85')],_0x5f5670['data2'],_0xd4133f[_0x2cd5('0x7e')],_0xd4133f[_0x2cd5('0x72')],_0x26bee5['value'],_0xd4133f[_0x2cd5('0x7f')]);}else{logger['info'](util[_0x2cd5('0x32')](_0x2cd5('0x8b'),_0x5061ef['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x2cd5('0x25')](function(_0x3f6add){if(_0x3f6add){_0x3f6add[_0x2cd5('0x8c')]=_0x5061ef[_0x2cd5('0x4a')][_0x2cd5('0x81')];return _0x26bee5[_0x2cd5('0x8d')](_0x3f6add);}})['then'](respondWithResult(_0x42a036,null))[_0x2cd5('0x44')](handleError(_0x42a036,null));};function writeFile(_0x3e37ae,_0x5befff){return new Promise(function(_0xa923ec,_0x3cc810){fs[_0x2cd5('0x8e')](_0x5befff,_0x3e37ae,function(_0xb3ca22,_0x4479a0){if(_0xb3ca22){return _0x3cc810(_0xb3ca22);}else{return _0xa923ec(_0x4479a0);}});});}exports[_0x2cd5('0x8f')]=function(_0x556314,_0x36e02a,_0x3fd739){return db[_0x2cd5('0x2c')][_0x2cd5('0x7b')]({'where':{'id':_0x556314[_0x2cd5('0x46')]['id']}})[_0x2cd5('0x25')](handleEntityNotFound(_0x36e02a))[_0x2cd5('0x25')](function(_0x1c5f15){if(_0x1c5f15&&_0x1c5f15[_0x2cd5('0x90')]){var _0x406df5=_0x1c5f15[_0x2cd5('0x90')];var _0x2ece93=config[_0x2cd5('0x91')]+_0x2cd5('0x92')+_0x1c5f15['id']+_0x2cd5('0x93');if(fs['existsSync'](_0x2ece93)){return _0x2ece93;}return writeFile(_0x406df5,_0x2ece93)[_0x2cd5('0x25')](function(){return _0x2ece93;});}else{throw new db[(_0x2cd5('0x53'))][(_0x2cd5('0x54'))](_0x2cd5('0x94'));}})['then'](function(_0x50e8cd){return _0x36e02a['download'](_0x50e8cd);})['catch'](handleError(_0x36e02a));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index f3b5c45..5f988b3 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 _0xe2d8=['uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./voiceRecording.attributes','define','VoiceRecording','voice_recordings'];(function(_0x59c26a,_0x2343b5){var _0x2ffe6d=function(_0x4ada53){while(--_0x4ada53){_0x59c26a['push'](_0x59c26a['shift']());}};_0x2ffe6d(++_0x2343b5);}(_0xe2d8,0x11f));var _0x8e2d=function(_0x1c3a69,_0x4223e5){_0x1c3a69=_0x1c3a69-0x0;var _0xedb04d=_0xe2d8[_0x1c3a69];return _0xedb04d;};'use strict';var _=require(_0x8e2d('0x0'));var util=require(_0x8e2d('0x1'));var logger=require(_0x8e2d('0x2'))('api');var moment=require(_0x8e2d('0x3'));var BPromise=require(_0x8e2d('0x4'));var rp=require(_0x8e2d('0x5'));var fs=require('fs');var path=require(_0x8e2d('0x6'));var rimraf=require(_0x8e2d('0x7'));var config=require('../../config/environment');var attributes=require(_0x8e2d('0x8'));module['exports']=function(_0x321f94,_0x2a0159){return _0x321f94[_0x8e2d('0x9')](_0x8e2d('0xa'),attributes,{'tableName':_0x8e2d('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8e2d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3946=['bluebird','path','rimraf','../../config/environment','./voiceRecording.attributes','define','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','api','moment'];(function(_0x397099,_0x259e70){var _0x577791=function(_0x414018){while(--_0x414018){_0x397099['push'](_0x397099['shift']());}};_0x577791(++_0x259e70);}(_0x3946,0x1d0));var _0x6394=function(_0x591d44,_0x2b43a3){_0x591d44=_0x591d44-0x0;var _0x41dd26=_0x3946[_0x591d44];return _0x41dd26;};'use strict';var _=require('lodash');var util=require(_0x6394('0x0'));var logger=require(_0x6394('0x1'))(_0x6394('0x2'));var moment=require(_0x6394('0x3'));var BPromise=require(_0x6394('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6394('0x5'));var rimraf=require(_0x6394('0x6'));var config=require(_0x6394('0x7'));var attributes=require(_0x6394('0x8'));module['exports']=function(_0x413d9d,_0x1cf698){return _0x413d9d[_0x6394('0x9')](_0x6394('0xa'),attributes,{'tableName':_0x6394('0xb'),'paranoid':![],'indexes':[{'name':_0x6394('0xc'),'fields':[_0x6394('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index bfd1e72..ad7da9a 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 _0x3e24=['client','http','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','limit','debug','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','existsSync','value','%s.cypher','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x55c3e3,_0x3ae216){var _0x5756ad=function(_0x52e8ae){while(--_0x52e8ae){_0x55c3e3['push'](_0x55c3e3['shift']());}};_0x5756ad(++_0x3ae216);}(_0x3e24,0x167));var _0x43e2=function(_0x4b8ecc,_0x4cd01c){_0x4b8ecc=_0x4b8ecc-0x0;var _0x48c1b9=_0x3e24[_0x4b8ecc];return _0x48c1b9;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var BPromise=require(_0x43e2('0x3'));var rs=require(_0x43e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43e2('0x5'))['db'];var utils=require(_0x43e2('0x6'));var logger=require('../../config/logger')(_0x43e2('0x7'));var config=require(_0x43e2('0x8'));var jayson=require(_0x43e2('0x9'));var client=jayson[_0x43e2('0xa')][_0x43e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x121e2e,_0x23b2d8,_0x59956d){return new BPromise(function(_0xb75b,_0x2357bc){return client['request'](_0x121e2e,_0x59956d)[_0x43e2('0xc')](function(_0x2fdf85){logger['info'](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));logger['debug'](_0x43e2('0xf'),_0x23b2d8,'request\x20sent',JSON['stringify'](_0x2fdf85));if(_0x2fdf85['error']){if(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x11')]===0x1f4){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0x2357bc(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);}logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0xb75b(_0x2fdf85['error'][_0x43e2('0x12')]);}else{logger[_0x43e2('0x13')](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));_0xb75b(_0x2fdf85['result']['message']);}})[_0x43e2('0x14')](function(_0x417ce5){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x417ce5);_0x2357bc(_0x417ce5);});});}exports[_0x43e2('0x15')]=function(_0x1b7cde){var _0x3ea010=this;return new Promise(function(_0x15ecb5,_0x3236b9){return db[_0x43e2('0x16')]['update'](_0x1b7cde[_0x43e2('0x17')],{'raw':_0x1b7cde[_0x43e2('0x18')]?_0x1b7cde['options'][_0x43e2('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7cde['options']?_0x1b7cde[_0x43e2('0x18')][_0x43e2('0x1a')]||null:null,'attributes':_0x1b7cde[_0x43e2('0x18')]?_0x1b7cde[_0x43e2('0x18')][_0x43e2('0x1b')]||null:null,'limit':_0x1b7cde['options']?_0x1b7cde[_0x43e2('0x18')][_0x43e2('0x1c')]||null:null})[_0x43e2('0xc')](function(_0x52e361){logger[_0x43e2('0x13')](_0x43e2('0x15'),_0x1b7cde);logger[_0x43e2('0x1d')](_0x43e2('0x15'),_0x1b7cde,JSON['stringify'](_0x52e361));_0x15ecb5(_0x52e361);})[_0x43e2('0x14')](function(_0xc717d8){logger[_0x43e2('0x10')](_0x43e2('0x15'),_0xc717d8[_0x43e2('0x12')],_0x1b7cde);_0x3236b9(_0x3ea010[_0x43e2('0x10')](0x1f4,_0xc717d8[_0x43e2('0x12')]));});});};exports[_0x43e2('0x1e')]=function(_0xd29b7b){var _0x1ec68e=this;return new Promise(function(_0x1ea844,_0x1de7e1){var _0x52ed49=require(_0x43e2('0x1f'));var _0x2f2bd8;return db['Setting'][_0x43e2('0x20')]({'attributes':['id',_0x43e2('0x21')],'where':{'id':0x1},'raw':!![]})[_0x43e2('0xc')](function(_0x404483){_0x2f2bd8=_0x404483;return db[_0x43e2('0x16')]['create'](_0xd29b7b[_0x43e2('0x17')]);})[_0x43e2('0xc')](function(_0x1779f9){if(_0x2f2bd8[_0x43e2('0x21')]&&fs[_0x43e2('0x22')](_0x1779f9[_0x43e2('0x23')])){var _0x53f797=util['format'](_0x43e2('0x24'),_0x1779f9[_0x43e2('0x23')]);return _0x52ed49[_0x43e2('0x25')](_0x1779f9[_0x43e2('0x23')],_0x53f797,config[_0x43e2('0x26')]['recording'])[_0x43e2('0xc')](function(){fs[_0x43e2('0x27')](_0x1779f9[_0x43e2('0x23')]);logger[_0x43e2('0x13')](_0x43e2('0x28'));return _0x1779f9;});}return _0x1779f9;})[_0x43e2('0xc')](function(_0x2fcdd4){logger['info']('CreateVoiceRecording',_0xd29b7b);logger[_0x43e2('0x1d')](_0x43e2('0x1e'),_0xd29b7b,JSON['stringify'](_0x2fcdd4));_0x1ea844(_0x2fcdd4);})[_0x43e2('0x14')](function(_0x34effb){logger['error'](_0x43e2('0x1e'),_0x34effb['message'],_0xd29b7b);_0x1de7e1(_0x1ec68e['error'](0x1f4,_0x34effb['message']));});});}; \ No newline at end of file +var _0x77e6=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','VoiceRecording','update','options','raw','attributes','limit','UpdateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','body','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x77e6,0x1a6));var _0x677e=function(_0x509c4f,_0x3ba06f){_0x509c4f=_0x509c4f-0x0;var _0x1d464d=_0x77e6[_0x509c4f];return _0x1d464d;};'use strict';var _=require(_0x677e('0x0'));var util=require(_0x677e('0x1'));var moment=require(_0x677e('0x2'));var BPromise=require(_0x677e('0x3'));var rs=require(_0x677e('0x4'));var fs=require('fs');var Redis=require(_0x677e('0x5'));var db=require(_0x677e('0x6'))['db'];var utils=require(_0x677e('0x7'));var logger=require('../../config/logger')(_0x677e('0x8'));var config=require(_0x677e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x677e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40d314,_0x4d1a57,_0x5a5dd3){return new BPromise(function(_0x2eb40c,_0x4c519f){return client[_0x677e('0xb')](_0x40d314,_0x5a5dd3)[_0x677e('0xc')](function(_0x552931){logger[_0x677e('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x4d1a57,_0x677e('0xe'));logger[_0x677e('0xf')](_0x677e('0x10'),_0x4d1a57,_0x677e('0xe'),JSON[_0x677e('0x11')](_0x552931));if(_0x552931[_0x677e('0x12')]){if(_0x552931[_0x677e('0x12')][_0x677e('0x13')]===0x1f4){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x552931[_0x677e('0x12')][_0x677e('0x15')]);return _0x4c519f(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}logger['error']('VoiceRecording,\x20%s,\x20%s',_0x4d1a57,_0x552931['error'][_0x677e('0x15')]);return _0x2eb40c(_0x552931[_0x677e('0x12')][_0x677e('0x15')]);}else{logger[_0x677e('0xd')](_0x677e('0x14'),_0x4d1a57,_0x677e('0xe'));_0x2eb40c(_0x552931[_0x677e('0x16')][_0x677e('0x15')]);}})[_0x677e('0x17')](function(_0x32d306){logger[_0x677e('0x12')](_0x677e('0x14'),_0x4d1a57,_0x32d306);_0x4c519f(_0x32d306);});});}exports['UpdateVoiceRecording']=function(_0x1c5124){var _0x2ef2bf=this;return new Promise(function(_0x385b06,_0x221b6d){return db[_0x677e('0x18')][_0x677e('0x19')](_0x1c5124['body'],{'raw':_0x1c5124[_0x677e('0x1a')]?_0x1c5124['options'][_0x677e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c5124[_0x677e('0x1a')]?_0x1c5124[_0x677e('0x1a')]['where']||null:null,'attributes':_0x1c5124[_0x677e('0x1a')]?_0x1c5124[_0x677e('0x1a')][_0x677e('0x1c')]||null:null,'limit':_0x1c5124[_0x677e('0x1a')]?_0x1c5124[_0x677e('0x1a')][_0x677e('0x1d')]||null:null})[_0x677e('0xc')](function(_0x52ee8b){logger['info']('UpdateVoiceRecording',_0x1c5124);logger[_0x677e('0xf')](_0x677e('0x1e'),_0x1c5124,JSON[_0x677e('0x11')](_0x52ee8b));_0x385b06(_0x52ee8b);})[_0x677e('0x17')](function(_0x424e5d){logger[_0x677e('0x12')](_0x677e('0x1e'),_0x424e5d[_0x677e('0x15')],_0x1c5124);_0x221b6d(_0x2ef2bf[_0x677e('0x12')](0x1f4,_0x424e5d[_0x677e('0x15')]));});});};exports['CreateVoiceRecording']=function(_0x5f0ba2){var _0x3d3370=this;return new Promise(function(_0x184f68,_0x4d9e0b){var _0x51e39d=require(_0x677e('0x1f'));var _0xf6b3ad;return db[_0x677e('0x20')][_0x677e('0x21')]({'attributes':['id',_0x677e('0x22')],'where':{'id':0x1},'raw':!![]})['then'](function(_0xcd4646){_0xf6b3ad=_0xcd4646;return db[_0x677e('0x18')][_0x677e('0x23')](_0x5f0ba2[_0x677e('0x24')]);})[_0x677e('0xc')](function(_0x2bd6fb){if(_0xf6b3ad[_0x677e('0x22')]&&fs[_0x677e('0x25')](_0x2bd6fb[_0x677e('0x26')])){var _0x4c5113=util[_0x677e('0x27')](_0x677e('0x28'),_0x2bd6fb[_0x677e('0x26')]);return _0x51e39d[_0x677e('0x29')](_0x2bd6fb[_0x677e('0x26')],_0x4c5113,config[_0x677e('0x2a')][_0x677e('0x2b')])[_0x677e('0xc')](function(){fs[_0x677e('0x2c')](_0x2bd6fb[_0x677e('0x26')]);logger['info'](_0x677e('0x2d'));return _0x2bd6fb;});}return _0x2bd6fb;})[_0x677e('0xc')](function(_0x2b6f24){logger[_0x677e('0xd')](_0x677e('0x2e'),_0x5f0ba2);logger[_0x677e('0xf')]('CreateVoiceRecording',_0x5f0ba2,JSON[_0x677e('0x11')](_0x2b6f24));_0x184f68(_0x2b6f24);})[_0x677e('0x17')](function(_0x2d0bc0){logger['error'](_0x677e('0x2e'),_0x2d0bc0[_0x677e('0x15')],_0x5f0ba2);_0x4d9e0b(_0x3d3370[_0x677e('0x12')](0x1f4,_0x2d0bc0[_0x677e('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index e64f33e..3eaff99 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 _0xe44f=['isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','multer','connect-timeout','express','../../components/interaction/service','../../config/environment','get'];(function(_0x404957,_0x5192a4){var _0x4e0365=function(_0x4f6cd7){while(--_0x4f6cd7){_0x404957['push'](_0x404957['shift']());}};_0x4e0365(++_0x5192a4);}(_0xe44f,0x72));var _0xfe44=function(_0x53c6f3,_0x49cb56){_0x53c6f3=_0x53c6f3-0x0;var _0x1776b0=_0xe44f[_0x53c6f3];return _0x1776b0;};'use strict';var multer=require(_0xfe44('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfe44('0x1'));var express=require(_0xfe44('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfe44('0x3'));var config=require(_0xfe44('0x4'));var controller=require('./voiceTransferReport.controller');router[_0xfe44('0x5')]('/',auth[_0xfe44('0x6')](),controller[_0xfe44('0x7')]);router[_0xfe44('0x5')](_0xfe44('0x8'),auth[_0xfe44('0x6')](),controller[_0xfe44('0x9')]);router[_0xfe44('0x5')](_0xfe44('0xa'),auth['isAuthenticated'](),controller[_0xfe44('0xb')]);router[_0xfe44('0xc')]('/',auth['isAuthenticated'](),controller[_0xfe44('0xd')]);router['put']('/:id',auth[_0xfe44('0x6')](),controller['update']);router[_0xfe44('0xe')](_0xfe44('0xa'),auth[_0xfe44('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd412=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update','delete','destroy','exports','path','express'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0xd412,0xa9));var _0x2d41=function(_0x11bc40,_0x537bbc){_0x11bc40=_0x11bc40-0x0;var _0x2b7a99=_0xd412[_0x11bc40];return _0x2b7a99;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2d41('0x0'));var timeout=require('connect-timeout');var express=require(_0x2d41('0x1'));var router=express[_0x2d41('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d41('0x3'));var interaction=require(_0x2d41('0x4'));var config=require(_0x2d41('0x5'));var controller=require('./voiceTransferReport.controller');router[_0x2d41('0x6')]('/',auth[_0x2d41('0x7')](),controller[_0x2d41('0x8')]);router[_0x2d41('0x6')](_0x2d41('0x9'),auth[_0x2d41('0x7')](),controller['describe']);router[_0x2d41('0x6')]('/:id',auth[_0x2d41('0x7')](),controller[_0x2d41('0xa')]);router[_0x2d41('0xb')]('/',auth['isAuthenticated'](),controller[_0x2d41('0xc')]);router[_0x2d41('0xd')](_0x2d41('0xe'),auth[_0x2d41('0x7')](),controller[_0x2d41('0xf')]);router[_0x2d41('0x10')](_0x2d41('0xe'),auth[_0x2d41('0x7')](),controller[_0x2d41('0x11')]);module[_0x2d41('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 8dc84cc..30fbaf8 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 _0x6dce=['attended','STRING','ENUM','moment'];(function(_0x1215f8,_0x161334){var _0xcbb12a=function(_0x3226cc){while(--_0x3226cc){_0x1215f8['push'](_0x1215f8['shift']());}};_0xcbb12a(++_0x161334);}(_0x6dce,0xa7));var _0xe6dc=function(_0x3397b3,_0x3b0051){_0x3397b3=_0x3397b3-0x0;var _0x1ccdd0=_0x6dce[_0x3397b3];return _0x1ccdd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe6dc('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('blind',_0xe6dc('0x1'))},'result':{'type':Sequelize[_0xe6dc('0x2')]},'transfererchannel':{'type':Sequelize[_0xe6dc('0x2')]},'transferercalleridnum':{'type':Sequelize[_0xe6dc('0x2')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xe6dc('0x2')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xe6dc('0x2')]},'transferercontext':{'type':Sequelize[_0xe6dc('0x2')]},'transfererexten':{'type':Sequelize[_0xe6dc('0x2')]},'transfererlinkedid':{'type':Sequelize[_0xe6dc('0x2')]},'transfereechannel':{'type':Sequelize[_0xe6dc('0x2')]},'transfereecalleridnum':{'type':Sequelize[_0xe6dc('0x2')]},'transfereecalleridname':{'type':Sequelize[_0xe6dc('0x2')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xe6dc('0x2')]},'transfereeconnectedlinename':{'type':Sequelize[_0xe6dc('0x2')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xe6dc('0x2')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xe6dc('0x2')]},'isexternal':{'type':Sequelize[_0xe6dc('0x3')]('Yes','No')},'context':{'type':Sequelize[_0xe6dc('0x2')]},'extension':{'type':Sequelize[_0xe6dc('0x2')]}}; \ No newline at end of file +var _0x17cb=['STRING','sequelize','moment','exports','ENUM','blind','attended'];(function(_0x4bd0f9,_0x1c8418){var _0x1a562c=function(_0xaf042f){while(--_0xaf042f){_0x4bd0f9['push'](_0x4bd0f9['shift']());}};_0x1a562c(++_0x1c8418);}(_0x17cb,0x158));var _0xb17c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x17cb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb17c('0x0'));var moment=require(_0xb17c('0x1'));module[_0xb17c('0x2')]={'type':{'type':Sequelize[_0xb17c('0x3')](_0xb17c('0x4'),_0xb17c('0x5'))},'result':{'type':Sequelize[_0xb17c('0x6')]},'transfererchannel':{'type':Sequelize[_0xb17c('0x6')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xb17c('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xb17c('0x6')]},'transfereraccountcode':{'type':Sequelize[_0xb17c('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xb17c('0x6')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xb17c('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xb17c('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xb17c('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0xb17c('0x6')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xb17c('0x6')]},'transfereelinkedid':{'type':Sequelize[_0xb17c('0x6')]},'isexternal':{'type':Sequelize[_0xb17c('0x3')]('Yes','No')},'context':{'type':Sequelize[_0xb17c('0x6')]},'extension':{'type':Sequelize[_0xb17c('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 205a363..97789bf 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 _0x41e3=['where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','sendStatus','error','name','send','index','map','VoiceTransferReport','rawAttributes','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x124817,_0x1888f2){var _0x1d80a9=function(_0x48f264){while(--_0x48f264){_0x124817['push'](_0x124817['shift']());}};_0x1d80a9(++_0x1888f2);}(_0x41e3,0xa1));var _0x341e=function(_0x17eed7,_0x294cfc){_0x17eed7=_0x17eed7-0x0;var _0x1715fc=_0x41e3[_0x17eed7];return _0x1715fc;};'use strict';var emlformat=require(_0x341e('0x0'));var rimraf=require(_0x341e('0x1'));var zipdir=require(_0x341e('0x2'));var jsonpatch=require(_0x341e('0x3'));var rp=require(_0x341e('0x4'));var moment=require(_0x341e('0x5'));var BPromise=require(_0x341e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x341e('0x7'));var sox=require(_0x341e('0x8'));var csv=require(_0x341e('0x9'));var ejs=require(_0x341e('0xa'));var fs=require('fs');var fs_extra=require(_0x341e('0xb'));var _=require(_0x341e('0xc'));var squel=require(_0x341e('0xd'));var crypto=require(_0x341e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x341e('0xf'));var toCsv=require(_0x341e('0x9'));var querystring=require('querystring');var Papa=require(_0x341e('0x10'));var Redis=require(_0x341e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x341e('0x12'))(_0x341e('0x13'));var utils=require(_0x341e('0x14'));var config=require(_0x341e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x341e('0x16'))['db'];function respondWithStatusCode(_0x595399,_0xf6588a){_0xf6588a=_0xf6588a||0xcc;return function(_0x59f756){if(_0x59f756){return _0x595399['sendStatus'](_0xf6588a);}return _0x595399[_0x341e('0x17')](_0xf6588a)[_0x341e('0x18')]();};}function respondWithResult(_0x781953,_0x1149a7){_0x1149a7=_0x1149a7||0xc8;return function(_0x58b0b8){if(_0x58b0b8){return _0x781953['status'](_0x1149a7)['json'](_0x58b0b8);}};}function respondWithFilteredResult(_0x5890a9,_0x386f04){return function(_0x1cfbc3){if(_0x1cfbc3){var _0x42ef52=typeof _0x386f04['offset']===_0x341e('0x19')&&typeof _0x386f04[_0x341e('0x1a')]===_0x341e('0x19');var _0x2332ab=_0x1cfbc3[_0x341e('0x1b')];var _0x573c8e=_0x42ef52?0x0:_0x386f04['offset'];var _0x208c41=_0x42ef52?_0x1cfbc3[_0x341e('0x1b')]:_0x386f04[_0x341e('0x1c')]+_0x386f04['limit'];var _0x50119b;if(_0x208c41>=_0x2332ab){_0x208c41=_0x2332ab;_0x50119b=0xc8;}else{_0x50119b=0xce;}_0x5890a9['status'](_0x50119b);return _0x5890a9[_0x341e('0x1d')](_0x341e('0x1e'),_0x573c8e+'-'+_0x208c41+'/'+_0x2332ab)[_0x341e('0x1f')](_0x1cfbc3);}return null;};}function patchUpdates(_0x3eb05d){return function(_0x27ac3c){try{jsonpatch[_0x341e('0x20')](_0x27ac3c,_0x3eb05d,!![]);}catch(_0x3c6f65){return BPromise['reject'](_0x3c6f65);}return _0x27ac3c[_0x341e('0x21')]();};}function saveUpdates(_0x55f975,_0x1bf223){return function(_0x322058){if(_0x322058){return _0x322058[_0x341e('0x22')](_0x55f975)[_0x341e('0x23')](function(_0x28186f){return _0x28186f;});}return null;};}function removeEntity(_0x5a695f,_0x4754d9){return function(_0x1c94b3){if(_0x1c94b3){return _0x1c94b3['destroy']()[_0x341e('0x23')](function(){_0x5a695f[_0x341e('0x17')](0xcc)[_0x341e('0x18')]();});}};}function handleEntityNotFound(_0x4a09cb,_0x16d0a9){return function(_0x1274a5){if(!_0x1274a5){_0x4a09cb[_0x341e('0x24')](0x194);}return _0x1274a5;};}function handleError(_0x44ce31,_0x1d3e0d){_0x1d3e0d=_0x1d3e0d||0x1f4;return function(_0x102994){logger[_0x341e('0x25')](_0x102994['stack']);if(_0x102994[_0x341e('0x26')]){delete _0x102994[_0x341e('0x26')];}_0x44ce31['status'](_0x1d3e0d)[_0x341e('0x27')](_0x102994);};}exports[_0x341e('0x28')]=function(_0x3ffd4e,_0x5d9a2c){var _0x47338d={},_0x5b2fc4={},_0x4c6620={'count':0x0,'rows':[]};var _0x383b34=_[_0x341e('0x29')](db[_0x341e('0x2a')][_0x341e('0x2b')],function(_0x3ad026){return{'name':_0x3ad026['fieldName'],'type':_0x3ad026[_0x341e('0x2c')]['key']};});_0x5b2fc4[_0x341e('0x2d')]=_['map'](_0x383b34,_0x341e('0x26'));_0x5b2fc4[_0x341e('0x2e')]=_['keys'](_0x3ffd4e[_0x341e('0x2e')]);_0x5b2fc4[_0x341e('0x2f')]=_[_0x341e('0x30')](_0x5b2fc4[_0x341e('0x2d')],_0x5b2fc4[_0x341e('0x2e')]);_0x47338d[_0x341e('0x31')]=_['intersection'](_0x5b2fc4[_0x341e('0x2d')],qs[_0x341e('0x32')](_0x3ffd4e[_0x341e('0x2e')][_0x341e('0x32')]));_0x47338d['attributes']=_0x47338d[_0x341e('0x31')]['length']?_0x47338d[_0x341e('0x31')]:_0x5b2fc4[_0x341e('0x2d')];if(!_0x3ffd4e['query'][_0x341e('0x33')](_0x341e('0x34'))){_0x47338d[_0x341e('0x1a')]=qs[_0x341e('0x1a')](_0x3ffd4e['query'][_0x341e('0x1a')]);_0x47338d[_0x341e('0x1c')]=qs['offset'](_0x3ffd4e['query']['offset']);}_0x47338d[_0x341e('0x35')]=qs[_0x341e('0x36')](_0x3ffd4e['query'][_0x341e('0x36')]);_0x47338d[_0x341e('0x37')]=qs[_0x341e('0x2f')](_['pick'](_0x3ffd4e['query'],_0x5b2fc4[_0x341e('0x2f')]),_0x383b34);if(_0x3ffd4e[_0x341e('0x2e')][_0x341e('0x38')]){_0x47338d[_0x341e('0x37')]=_[_0x341e('0x39')](_0x47338d[_0x341e('0x37')],{'$or':_[_0x341e('0x29')](_0x383b34,function(_0x1e2064){if(_0x1e2064[_0x341e('0x2c')]!==_0x341e('0x3a')){var _0x3c2816={};_0x3c2816[_0x1e2064['name']]={'$like':'%'+_0x3ffd4e['query'][_0x341e('0x38')]+'%'};return _0x3c2816;}})});}_0x47338d=_[_0x341e('0x39')]({},_0x47338d,_0x3ffd4e[_0x341e('0x3b')]);var _0x253f6b={'where':_0x47338d['where']};return db['VoiceTransferReport'][_0x341e('0x1b')](_0x253f6b)['then'](function(_0x1c0ad3){_0x4c6620[_0x341e('0x1b')]=_0x1c0ad3;if(_0x3ffd4e['query'][_0x341e('0x3c')]){_0x47338d[_0x341e('0x3d')]=[{'all':!![]}];}return db[_0x341e('0x2a')]['findAll'](_0x47338d);})[_0x341e('0x23')](function(_0x27553a){_0x4c6620['rows']=_0x27553a;return _0x4c6620;})[_0x341e('0x23')](respondWithFilteredResult(_0x5d9a2c,_0x47338d))[_0x341e('0x3e')](handleError(_0x5d9a2c,null));};exports[_0x341e('0x3f')]=function(_0x17ee84,_0x5e97c6){var _0x3a4545={'raw':!![],'where':{'id':_0x17ee84[_0x341e('0x40')]['id']}},_0x44272f={};_0x44272f[_0x341e('0x2d')]=_['keys'](db['VoiceTransferReport'][_0x341e('0x2b')]);_0x44272f[_0x341e('0x2e')]=_[_0x341e('0x41')](_0x17ee84['query']);_0x44272f[_0x341e('0x2f')]=_['intersection'](_0x44272f[_0x341e('0x2d')],_0x44272f[_0x341e('0x2e')]);_0x3a4545[_0x341e('0x31')]=_[_0x341e('0x30')](_0x44272f[_0x341e('0x2d')],qs[_0x341e('0x32')](_0x17ee84[_0x341e('0x2e')][_0x341e('0x32')]));_0x3a4545[_0x341e('0x31')]=_0x3a4545['attributes'][_0x341e('0x42')]?_0x3a4545[_0x341e('0x31')]:_0x44272f[_0x341e('0x2d')];if(_0x17ee84[_0x341e('0x2e')]['includeAll']){_0x3a4545['include']=[{'all':!![]}];}_0x3a4545=_[_0x341e('0x39')]({},_0x3a4545,_0x17ee84[_0x341e('0x3b')]);return db['VoiceTransferReport'][_0x341e('0x43')](_0x3a4545)[_0x341e('0x23')](handleEntityNotFound(_0x5e97c6,null))['then'](respondWithResult(_0x5e97c6,null))[_0x341e('0x3e')](handleError(_0x5e97c6,null));};exports[_0x341e('0x44')]=function(_0x310557,_0x36ebe2){return db['VoiceTransferReport'][_0x341e('0x44')](_0x310557[_0x341e('0x45')],{})['then'](respondWithResult(_0x36ebe2,0xc9))['catch'](handleError(_0x36ebe2,null));};exports[_0x341e('0x22')]=function(_0x5ef485,_0x4fd27d){if(_0x5ef485[_0x341e('0x45')]['id']){delete _0x5ef485[_0x341e('0x45')]['id'];}return db[_0x341e('0x2a')]['find']({'where':{'id':_0x5ef485[_0x341e('0x40')]['id']}})[_0x341e('0x23')](handleEntityNotFound(_0x4fd27d,null))['then'](saveUpdates(_0x5ef485[_0x341e('0x45')],null))[_0x341e('0x23')](respondWithResult(_0x4fd27d,null))[_0x341e('0x3e')](handleError(_0x4fd27d,null));};exports[_0x341e('0x46')]=function(_0x4e0e22,_0x477a1c){return db[_0x341e('0x2a')][_0x341e('0x43')]({'where':{'id':_0x4e0e22[_0x341e('0x40')]['id']}})[_0x341e('0x23')](handleEntityNotFound(_0x477a1c,null))['then'](removeEntity(_0x477a1c,null))[_0x341e('0x3e')](handleError(_0x477a1c,null));};exports['describe']=function(_0x17da4d,_0x27267f){return db[_0x341e('0x2a')][_0x341e('0x47')]()[_0x341e('0x23')](respondWithResult(_0x27267f,null))[_0x341e('0x3e')](handleError(_0x27267f,null));}; \ No newline at end of file +var _0xd5ff=['findAll','rows','catch','show','params','keys','options','body','find','destroy','describe','rimraf','fast-json-patch','moment','mustache','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/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include'];(function(_0x3a23b6,_0x272b99){var _0x1ffb80=function(_0x5ed21d){while(--_0x5ed21d){_0x3a23b6['push'](_0x3a23b6['shift']());}};_0x1ffb80(++_0x272b99);}(_0xd5ff,0xa3));var _0xfd5f=function(_0x28590c,_0x3f5999){_0x28590c=_0x28590c-0x0;var _0x585d17=_0xd5ff[_0x28590c];return _0x585d17;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd5f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfd5f('0x1'));var rp=require('request-promise');var moment=require(_0xfd5f('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfd5f('0x3'));var util=require('util');var path=require(_0xfd5f('0x4'));var sox=require(_0xfd5f('0x5'));var csv=require(_0xfd5f('0x6'));var ejs=require(_0xfd5f('0x7'));var fs=require('fs');var fs_extra=require(_0xfd5f('0x8'));var _=require(_0xfd5f('0x9'));var squel=require(_0xfd5f('0xa'));var crypto=require('crypto');var jsforce=require(_0xfd5f('0xb'));var deskjs=require(_0xfd5f('0xc'));var toCsv=require(_0xfd5f('0x6'));var querystring=require(_0xfd5f('0xd'));var Papa=require(_0xfd5f('0xe'));var Redis=require(_0xfd5f('0xf'));var authService=require(_0xfd5f('0x10'));var qs=require(_0xfd5f('0x11'));var as=require(_0xfd5f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfd5f('0x13'))('api');var utils=require(_0xfd5f('0x14'));var config=require(_0xfd5f('0x15'));var licenseUtil=require(_0xfd5f('0x16'));var db=require(_0xfd5f('0x17'))['db'];function respondWithStatusCode(_0x181adf,_0x31c451){_0x31c451=_0x31c451||0xcc;return function(_0x240c70){if(_0x240c70){return _0x181adf[_0xfd5f('0x18')](_0x31c451);}return _0x181adf[_0xfd5f('0x19')](_0x31c451)[_0xfd5f('0x1a')]();};}function respondWithResult(_0xd9ac7e,_0x11e75b){_0x11e75b=_0x11e75b||0xc8;return function(_0x5e83f6){if(_0x5e83f6){return _0xd9ac7e[_0xfd5f('0x19')](_0x11e75b)[_0xfd5f('0x1b')](_0x5e83f6);}};}function respondWithFilteredResult(_0x3b7ad7,_0x3c6a45){return function(_0x392d88){if(_0x392d88){var _0x55a2d2=typeof _0x3c6a45[_0xfd5f('0x1c')]==='undefined'&&typeof _0x3c6a45['limit']==='undefined';var _0x333ee8=_0x392d88[_0xfd5f('0x1d')];var _0x4e7b27=_0x55a2d2?0x0:_0x3c6a45[_0xfd5f('0x1c')];var _0x555563=_0x55a2d2?_0x392d88[_0xfd5f('0x1d')]:_0x3c6a45[_0xfd5f('0x1c')]+_0x3c6a45[_0xfd5f('0x1e')];var _0xcc4a16;if(_0x555563>=_0x333ee8){_0x555563=_0x333ee8;_0xcc4a16=0xc8;}else{_0xcc4a16=0xce;}_0x3b7ad7[_0xfd5f('0x19')](_0xcc4a16);return _0x3b7ad7[_0xfd5f('0x1f')](_0xfd5f('0x20'),_0x4e7b27+'-'+_0x555563+'/'+_0x333ee8)[_0xfd5f('0x1b')](_0x392d88);}return null;};}function patchUpdates(_0x4da0ce){return function(_0x24a9ab){try{jsonpatch[_0xfd5f('0x21')](_0x24a9ab,_0x4da0ce,!![]);}catch(_0x256136){return BPromise[_0xfd5f('0x22')](_0x256136);}return _0x24a9ab[_0xfd5f('0x23')]();};}function saveUpdates(_0x255d86,_0x44c8ae){return function(_0x4e4594){if(_0x4e4594){return _0x4e4594[_0xfd5f('0x24')](_0x255d86)[_0xfd5f('0x25')](function(_0x58a5ec){return _0x58a5ec;});}return null;};}function removeEntity(_0x4aa0e0,_0x8b3377){return function(_0x16c3ac){if(_0x16c3ac){return _0x16c3ac['destroy']()[_0xfd5f('0x25')](function(){_0x4aa0e0[_0xfd5f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fa59c,_0x2f2cfb){return function(_0x3ed1e5){if(!_0x3ed1e5){_0x4fa59c[_0xfd5f('0x18')](0x194);}return _0x3ed1e5;};}function handleError(_0x469361,_0x127c50){_0x127c50=_0x127c50||0x1f4;return function(_0x1575f6){logger[_0xfd5f('0x26')](_0x1575f6[_0xfd5f('0x27')]);if(_0x1575f6[_0xfd5f('0x28')]){delete _0x1575f6[_0xfd5f('0x28')];}_0x469361[_0xfd5f('0x19')](_0x127c50)[_0xfd5f('0x29')](_0x1575f6);};}exports['index']=function(_0x3d945a,_0x9e4f1f){var _0x3b3d89={},_0x558740={},_0x4194e5={'count':0x0,'rows':[]};var _0x1853e9=_[_0xfd5f('0x2a')](db[_0xfd5f('0x2b')][_0xfd5f('0x2c')],function(_0x3643f1){return{'name':_0x3643f1[_0xfd5f('0x2d')],'type':_0x3643f1[_0xfd5f('0x2e')][_0xfd5f('0x2f')]};});_0x558740['model']=_[_0xfd5f('0x2a')](_0x1853e9,_0xfd5f('0x28'));_0x558740[_0xfd5f('0x30')]=_['keys'](_0x3d945a[_0xfd5f('0x30')]);_0x558740[_0xfd5f('0x31')]=_['intersection'](_0x558740[_0xfd5f('0x32')],_0x558740['query']);_0x3b3d89[_0xfd5f('0x33')]=_[_0xfd5f('0x34')](_0x558740[_0xfd5f('0x32')],qs[_0xfd5f('0x35')](_0x3d945a[_0xfd5f('0x30')][_0xfd5f('0x35')]));_0x3b3d89['attributes']=_0x3b3d89['attributes'][_0xfd5f('0x36')]?_0x3b3d89[_0xfd5f('0x33')]:_0x558740[_0xfd5f('0x32')];if(!_0x3d945a[_0xfd5f('0x30')][_0xfd5f('0x37')]('nolimit')){_0x3b3d89[_0xfd5f('0x1e')]=qs[_0xfd5f('0x1e')](_0x3d945a[_0xfd5f('0x30')][_0xfd5f('0x1e')]);_0x3b3d89[_0xfd5f('0x1c')]=qs[_0xfd5f('0x1c')](_0x3d945a[_0xfd5f('0x30')]['offset']);}_0x3b3d89[_0xfd5f('0x38')]=qs[_0xfd5f('0x39')](_0x3d945a[_0xfd5f('0x30')]['sort']);_0x3b3d89[_0xfd5f('0x3a')]=qs['filters'](_[_0xfd5f('0x3b')](_0x3d945a[_0xfd5f('0x30')],_0x558740[_0xfd5f('0x31')]),_0x1853e9);if(_0x3d945a[_0xfd5f('0x30')][_0xfd5f('0x3c')]){_0x3b3d89[_0xfd5f('0x3a')]=_['merge'](_0x3b3d89['where'],{'$or':_[_0xfd5f('0x2a')](_0x1853e9,function(_0x579bb3){if(_0x579bb3[_0xfd5f('0x2e')]!==_0xfd5f('0x3d')){var _0x3038bf={};_0x3038bf[_0x579bb3[_0xfd5f('0x28')]]={'$like':'%'+_0x3d945a[_0xfd5f('0x30')]['filter']+'%'};return _0x3038bf;}})});}_0x3b3d89=_[_0xfd5f('0x3e')]({},_0x3b3d89,_0x3d945a['options']);var _0x26fcbc={'where':_0x3b3d89[_0xfd5f('0x3a')]};return db['VoiceTransferReport'][_0xfd5f('0x1d')](_0x26fcbc)['then'](function(_0xf8ca3){_0x4194e5['count']=_0xf8ca3;if(_0x3d945a[_0xfd5f('0x30')][_0xfd5f('0x3f')]){_0x3b3d89[_0xfd5f('0x40')]=[{'all':!![]}];}return db[_0xfd5f('0x2b')][_0xfd5f('0x41')](_0x3b3d89);})[_0xfd5f('0x25')](function(_0x4ffb6b){_0x4194e5[_0xfd5f('0x42')]=_0x4ffb6b;return _0x4194e5;})[_0xfd5f('0x25')](respondWithFilteredResult(_0x9e4f1f,_0x3b3d89))[_0xfd5f('0x43')](handleError(_0x9e4f1f,null));};exports[_0xfd5f('0x44')]=function(_0x1ba732,_0x8338e9){var _0x456f21={'raw':!![],'where':{'id':_0x1ba732[_0xfd5f('0x45')]['id']}},_0x1d0e31={};_0x1d0e31['model']=_[_0xfd5f('0x46')](db[_0xfd5f('0x2b')][_0xfd5f('0x2c')]);_0x1d0e31[_0xfd5f('0x30')]=_[_0xfd5f('0x46')](_0x1ba732[_0xfd5f('0x30')]);_0x1d0e31[_0xfd5f('0x31')]=_[_0xfd5f('0x34')](_0x1d0e31[_0xfd5f('0x32')],_0x1d0e31[_0xfd5f('0x30')]);_0x456f21[_0xfd5f('0x33')]=_[_0xfd5f('0x34')](_0x1d0e31['model'],qs[_0xfd5f('0x35')](_0x1ba732[_0xfd5f('0x30')][_0xfd5f('0x35')]));_0x456f21['attributes']=_0x456f21[_0xfd5f('0x33')][_0xfd5f('0x36')]?_0x456f21[_0xfd5f('0x33')]:_0x1d0e31[_0xfd5f('0x32')];if(_0x1ba732[_0xfd5f('0x30')][_0xfd5f('0x3f')]){_0x456f21['include']=[{'all':!![]}];}_0x456f21=_[_0xfd5f('0x3e')]({},_0x456f21,_0x1ba732[_0xfd5f('0x47')]);return db['VoiceTransferReport']['find'](_0x456f21)[_0xfd5f('0x25')](handleEntityNotFound(_0x8338e9,null))['then'](respondWithResult(_0x8338e9,null))[_0xfd5f('0x43')](handleError(_0x8338e9,null));};exports['create']=function(_0x51d5f6,_0x2f61ff){return db[_0xfd5f('0x2b')]['create'](_0x51d5f6[_0xfd5f('0x48')],{})[_0xfd5f('0x25')](respondWithResult(_0x2f61ff,0xc9))[_0xfd5f('0x43')](handleError(_0x2f61ff,null));};exports[_0xfd5f('0x24')]=function(_0x13da5c,_0x22ed85){if(_0x13da5c[_0xfd5f('0x48')]['id']){delete _0x13da5c['body']['id'];}return db[_0xfd5f('0x2b')][_0xfd5f('0x49')]({'where':{'id':_0x13da5c[_0xfd5f('0x45')]['id']}})[_0xfd5f('0x25')](handleEntityNotFound(_0x22ed85,null))['then'](saveUpdates(_0x13da5c[_0xfd5f('0x48')],null))[_0xfd5f('0x25')](respondWithResult(_0x22ed85,null))[_0xfd5f('0x43')](handleError(_0x22ed85,null));};exports[_0xfd5f('0x4a')]=function(_0x264a33,_0x584d1f){return db[_0xfd5f('0x2b')]['find']({'where':{'id':_0x264a33[_0xfd5f('0x45')]['id']}})[_0xfd5f('0x25')](handleEntityNotFound(_0x584d1f,null))['then'](removeEntity(_0x584d1f,null))[_0xfd5f('0x43')](handleError(_0x584d1f,null));};exports[_0xfd5f('0x4b')]=function(_0xdb3d88,_0x29d44d){return db[_0xfd5f('0x2b')][_0xfd5f('0x4b')]()['then'](respondWithResult(_0x29d44d,null))['catch'](handleError(_0x29d44d,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index b302b28..00d11f8 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 _0x9b7b=['../../config/logger','moment','bluebird','path','define','VoiceTransferReport','lodash','util'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x9b7b,0x136));var _0xb9b7=function(_0x2dc8ef,_0x307408){_0x2dc8ef=_0x2dc8ef-0x0;var _0x2c82e6=_0x9b7b[_0x2dc8ef];return _0x2c82e6;};'use strict';var _=require(_0xb9b7('0x0'));var util=require(_0xb9b7('0x1'));var logger=require(_0xb9b7('0x2'))('api');var moment=require(_0xb9b7('0x3'));var BPromise=require(_0xb9b7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9b7('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x35d4f0,_0x1d9ff4){return _0x35d4f0[_0xb9b7('0x6')](_0xb9b7('0x7'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe241=['moment','bluebird','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','lodash','util','../../config/logger','api'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xe241,0x1eb));var _0x1e24=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xe241[_0x35885a];return _0xe86249;};'use strict';var _=require(_0x1e24('0x0'));var util=require(_0x1e24('0x1'));var logger=require(_0x1e24('0x2'))(_0x1e24('0x3'));var moment=require(_0x1e24('0x4'));var BPromise=require(_0x1e24('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e24('0x6'));var rimraf=require(_0x1e24('0x7'));var config=require(_0x1e24('0x8'));var attributes=require(_0x1e24('0x9'));module[_0x1e24('0xa')]=function(_0x4a040f,_0x4ca9e3){return _0x4a040f['define']('VoiceTransferReport',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 5b1ef6f..6744218 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 _0x172d=['debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceTransferReport','body','options','raw','then','CreateVoiceTransferReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x20197c,_0x3990d3){var _0x9a1194=function(_0x26ce1c){while(--_0x26ce1c){_0x20197c['push'](_0x20197c['shift']());}};_0x9a1194(++_0x3990d3);}(_0x172d,0xd8));var _0xd172=function(_0x503fd4,_0x12c099){_0x503fd4=_0x503fd4-0x0;var _0x40ae05=_0x172d[_0x503fd4];return _0x40ae05;};'use strict';var _=require(_0xd172('0x0'));var util=require(_0xd172('0x1'));var moment=require(_0xd172('0x2'));var BPromise=require(_0xd172('0x3'));var rs=require(_0xd172('0x4'));var fs=require('fs');var Redis=require(_0xd172('0x5'));var db=require(_0xd172('0x6'))['db'];var utils=require(_0xd172('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xd172('0x8'));var jayson=require(_0xd172('0x9'));var client=jayson[_0xd172('0xa')][_0xd172('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c843e,_0x161833,_0x1da4e7){return new BPromise(function(_0x777d78,_0x5ed2fa){return client[_0xd172('0xc')](_0x4c843e,_0x1da4e7)['then'](function(_0xfd83e5){logger[_0xd172('0xd')](_0xd172('0xe'),_0x161833,_0xd172('0xf'));logger[_0xd172('0x10')](_0xd172('0x11'),_0x161833,_0xd172('0xf'),JSON[_0xd172('0x12')](_0xfd83e5));if(_0xfd83e5[_0xd172('0x13')]){if(_0xfd83e5['error']['code']===0x1f4){logger['error'](_0xd172('0xe'),_0x161833,_0xfd83e5[_0xd172('0x13')]['message']);return _0x5ed2fa(_0xfd83e5[_0xd172('0x13')][_0xd172('0x14')]);}logger[_0xd172('0x13')](_0xd172('0xe'),_0x161833,_0xfd83e5[_0xd172('0x13')][_0xd172('0x14')]);return _0x777d78(_0xfd83e5[_0xd172('0x13')][_0xd172('0x14')]);}else{logger[_0xd172('0xd')](_0xd172('0xe'),_0x161833,_0xd172('0xf'));_0x777d78(_0xfd83e5[_0xd172('0x15')][_0xd172('0x14')]);}})[_0xd172('0x16')](function(_0x485e03){logger['error'](_0xd172('0xe'),_0x161833,_0x485e03);_0x5ed2fa(_0x485e03);});});}exports['CreateVoiceTransferReport']=function(_0x3db891){var _0x4db9da=this;return new Promise(function(_0x1c2544,_0x464502){return db[_0xd172('0x17')]['create'](_0x3db891[_0xd172('0x18')],{'raw':_0x3db891[_0xd172('0x19')]?_0x3db891[_0xd172('0x19')][_0xd172('0x1a')]===undefined?!![]:![]:!![]})[_0xd172('0x1b')](function(_0x43b446){logger[_0xd172('0xd')]('CreateVoiceTransferReport',_0x3db891);logger['debug'](_0xd172('0x1c'),_0x3db891,JSON['stringify'](_0x43b446));_0x1c2544(_0x43b446);})['catch'](function(_0x49e51a){logger[_0xd172('0x13')]('CreateVoiceTransferReport',_0x49e51a['message'],_0x3db891);_0x464502(_0x4db9da[_0xd172('0x13')](0x1f4,_0x49e51a[_0xd172('0x14')]));});});}; \ No newline at end of file +var _0x3f68=['request\x20sent','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x49eb4b,_0x268cc7){var _0x2142dc=function(_0x345f40){while(--_0x345f40){_0x49eb4b['push'](_0x49eb4b['shift']());}};_0x2142dc(++_0x268cc7);}(_0x3f68,0x157));var _0x83f6=function(_0x171357,_0x3f8b20){_0x171357=_0x171357-0x0;var _0x581777=_0x3f68[_0x171357];return _0x581777;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x83f6('0x0'));var BPromise=require(_0x83f6('0x1'));var rs=require(_0x83f6('0x2'));var fs=require('fs');var Redis=require(_0x83f6('0x3'));var db=require(_0x83f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x83f6('0x5'))(_0x83f6('0x6'));var config=require(_0x83f6('0x7'));var jayson=require(_0x83f6('0x8'));var client=jayson[_0x83f6('0x9')][_0x83f6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2ad016,_0x15a422,_0x4824fd){return new BPromise(function(_0x30572f,_0x1aeea6){return client[_0x83f6('0xb')](_0x2ad016,_0x4824fd)[_0x83f6('0xc')](function(_0x33c18f){logger['info'](_0x83f6('0xd'),_0x15a422,'request\x20sent');logger[_0x83f6('0xe')](_0x83f6('0xf'),_0x15a422,'request\x20sent',JSON[_0x83f6('0x10')](_0x33c18f));if(_0x33c18f[_0x83f6('0x11')]){if(_0x33c18f[_0x83f6('0x11')][_0x83f6('0x12')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x15a422,_0x33c18f[_0x83f6('0x11')][_0x83f6('0x13')]);return _0x1aeea6(_0x33c18f[_0x83f6('0x11')]['message']);}logger['error'](_0x83f6('0xd'),_0x15a422,_0x33c18f['error'][_0x83f6('0x13')]);return _0x30572f(_0x33c18f[_0x83f6('0x11')]['message']);}else{logger[_0x83f6('0x14')](_0x83f6('0xd'),_0x15a422,_0x83f6('0x15'));_0x30572f(_0x33c18f[_0x83f6('0x16')][_0x83f6('0x13')]);}})[_0x83f6('0x17')](function(_0x1fdef7){logger[_0x83f6('0x11')](_0x83f6('0xd'),_0x15a422,_0x1fdef7);_0x1aeea6(_0x1fdef7);});});}exports[_0x83f6('0x18')]=function(_0x4d3583){var _0x182001=this;return new Promise(function(_0x4d764e,_0x2318d3){return db[_0x83f6('0x19')]['create'](_0x4d3583[_0x83f6('0x1a')],{'raw':_0x4d3583[_0x83f6('0x1b')]?_0x4d3583[_0x83f6('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x83f6('0xc')](function(_0x506927){logger[_0x83f6('0x14')](_0x83f6('0x18'),_0x4d3583);logger[_0x83f6('0xe')]('CreateVoiceTransferReport',_0x4d3583,JSON[_0x83f6('0x10')](_0x506927));_0x4d764e(_0x506927);})[_0x83f6('0x17')](function(_0x331fad){logger['error']('CreateVoiceTransferReport',_0x331fad[_0x83f6('0x13')],_0x4d3583);_0x2318d3(_0x182001['error'](0x1f4,_0x331fad[_0x83f6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index c2ec3fd..56d3339 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 _0x34e8=['/unhold','unhold','/calls','calls','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','hold'];(function(_0x4f5af0,_0x5af252){var _0x49647a=function(_0x3d9146){while(--_0x3d9146){_0x4f5af0['push'](_0x4f5af0['shift']());}};_0x49647a(++_0x5af252);}(_0x34e8,0x12c));var _0x834e=function(_0x397f6a,_0x2684d9){_0x397f6a=_0x397f6a-0x0;var _0x481875=_0x34e8[_0x397f6a];return _0x481875;};'use strict';var express=require(_0x834e('0x0'));var router=express[_0x834e('0x1')]();var auth=require(_0x834e('0x2'));var controller=require(_0x834e('0x3'));router['post'](_0x834e('0x4'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x7')]);router[_0x834e('0x8')](_0x834e('0x9'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0xa')]);router['post'](_0x834e('0xb'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xc')]);router[_0x834e('0x8')](_0x834e('0xd'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0xe')]);router[_0x834e('0x8')](_0x834e('0xf'),auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x10')]);router[_0x834e('0x8')](_0x834e('0x11'),auth[_0x834e('0x5')](),auth['isWebrtcLicence'](),controller[_0x834e('0x12')]);router[_0x834e('0x8')]('/transfer',auth[_0x834e('0x5')](),auth[_0x834e('0x6')](),controller[_0x834e('0x13')]);module[_0x834e('0x14')]=router; \ No newline at end of file +var _0xe5b3=['transfer','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','answer','hold','/unhold','unhold','/calls','calls','/transfer'];(function(_0x190148,_0xda6bdd){var _0x5009de=function(_0x19c769){while(--_0x19c769){_0x190148['push'](_0x190148['shift']());}};_0x5009de(++_0xda6bdd);}(_0xe5b3,0x133));var _0x3e5b=function(_0x4fc6f7,_0x10e344){_0x4fc6f7=_0x4fc6f7-0x0;var _0x3fcab8=_0xe5b3[_0x4fc6f7];return _0x3fcab8;};'use strict';var express=require('express');var router=express[_0x3e5b('0x0')]();var auth=require(_0x3e5b('0x1'));var controller=require(_0x3e5b('0x2'));router[_0x3e5b('0x3')](_0x3e5b('0x4'),auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0x7')]);router[_0x3e5b('0x3')](_0x3e5b('0x8'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0x9')]);router[_0x3e5b('0x3')]('/answer',auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xa')]);router[_0x3e5b('0x3')]('/hold',auth['isAuthenticated'](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0x3')](_0x3e5b('0xc'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0xd')]);router['post'](_0x3e5b('0xe'),auth[_0x3e5b('0x5')](),auth[_0x3e5b('0x6')](),controller[_0x3e5b('0xf')]);router[_0x3e5b('0x3')](_0x3e5b('0x10'),auth[_0x3e5b('0x5')](),auth['isWebrtcLicence'](),controller[_0x3e5b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index d257c84..5af05c6 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 _0x422f=['transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../config/environment','util','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','log','handleError:','name','status','send','request','error','code','message','result','catch','findOne','agent','then','all','filter','UserId','sessionId\x20','\x20not\x20found!','info','originate\x20fired:','body','length','json','userId','callbackUrl','entityFound:','format','user:%s','webbar:originate','hangup\x20fired:','sessionId','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','rows','conference','conference\x20fired:'];(function(_0x7c1f0e,_0x1defa5){var _0x30639b=function(_0x2ab00e){while(--_0x2ab00e){_0x7c1f0e['push'](_0x7c1f0e['shift']());}};_0x30639b(++_0x1defa5);}(_0x422f,0x1c7));var _0xf422=function(_0x4ce843,_0x2897bb){_0x4ce843=_0x4ce843-0x0;var _0x1b0e27=_0x422f[_0x4ce843];return _0x1b0e27;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0xf422('0x0'));var db=require('../../mysqldb')['db'];var config=require(_0xf422('0x1'));var util=require(_0xf422('0x2'));var BPromise=require('bluebird');var jayson=require(_0xf422('0x3'));var amiClient=jayson[_0xf422('0x4')][_0xf422('0x5')]({'port':0x232a});var logger=require(_0xf422('0x6'))(_0xf422('0x7'));var Redis=require(_0xf422('0x8'));config[_0xf422('0x9')]=_[_0xf422('0xa')](config[_0xf422('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xf422('0xb'))(new Redis(config[_0xf422('0x9')]));var Schema=require(_0xf422('0xc'));var originateValidation=new Schema({'userId':{'type':_0xf422('0xd'),'required':[!![],_0xf422('0xe')]},'callNumber':{'type':'string','required':[!![],_0xf422('0xf')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xf422('0xd'),'required':[!![],_0xf422('0xe')]},'sessionId':{'type':_0xf422('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf422('0xd'),'required':[!![],_0xf422('0xe')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf422('0xd'),'required':[!![],_0xf422('0xe')]},'sessionId':{'type':'string','required':[!![],_0xf422('0x11')]},'transferNumber':{'type':_0xf422('0x10'),'required':[!![],_0xf422('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xf422('0xd'),'required':[!![],_0xf422('0xe')]},'sessionId':{'type':_0xf422('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xf422('0xd'),'required':[!![],_0xf422('0xe')]},'sessionId':{'type':_0xf422('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf422('0xe')]}});function emit(_0x30b70a,_0x21a35d,_0xdf4434){logger['info'](_0x30b70a,_0x21a35d,JSON[_0xf422('0x13')](_0xdf4434));io['to'](_0x30b70a)[_0xf422('0x14')](_0x21a35d,_0xdf4434);}function handleError(_0x76e4b1){return function(_0x2ae133){console[_0xf422('0x15')](_0xf422('0x16'),_0x2ae133,_0x2ae133 instanceof RangeError);logger['error'](_0x2ae133['stack']);if(_0x2ae133 instanceof RangeError){if(_0x2ae133[_0xf422('0x17')]){delete _0x2ae133[_0xf422('0x17')];}_0x76e4b1[_0xf422('0x18')](0x194)['send'](_0x2ae133);}else{if(_0x2ae133[_0xf422('0x17')]){delete _0x2ae133['name'];}_0x76e4b1[_0xf422('0x18')](0x1f4)[_0xf422('0x19')](_0x2ae133);}};}function checkError(){return function(_0x36b7e7){if(!_0x36b7e7){throw new RangeError('NotFound');}return _0x36b7e7;};}function respondWithRpcPromise(_0xf2d06b,_0x3cdd93){return new BPromise(function(_0x511529,_0x4b80a0){var _0x268575=amiClient;return _0x268575[_0xf422('0x1a')](_0xf2d06b,_0x3cdd93)['then'](function(_0x25b6a5){if(_0x25b6a5['error']){if(_0x25b6a5[_0xf422('0x1b')][_0xf422('0x1c')]===0x1f4){return _0x4b80a0(_0x25b6a5[_0xf422('0x1b')][_0xf422('0x1d')]);}return _0x511529(_0x25b6a5[_0xf422('0x1b')][_0xf422('0x1d')]);}else{_0x511529(_0x25b6a5[_0xf422('0x1e')]);}})[_0xf422('0x1f')](function(_0x5dcab4){_0x4b80a0(_0x5dcab4);});});}function getAgent(_0x1125ce){return db['User'][_0xf422('0x20')]({'where':{'id':_0x1125ce,'role':_0xf422('0x21')}})[_0xf422('0x22')](checkError());}function getAgentCheckSession(_0x3d3fe4,_0xaa3e7e){return new BPromise(function(_0x31f439,_0x2d0053){var _0x4ebfe9=respondWithRpcPromise('VoiceChannels');var _0x35d1fa=getAgent(_0x3d3fe4);Promise[_0xf422('0x23')]([_0x4ebfe9,_0x35d1fa])[_0xf422('0x22')](function(_0x33ef63){var _0xefb99e=_0x33ef63[0x0];var _0x48e0c7=_0x33ef63[0x1];var _0x6d22f1=_[_0xf422('0x24')](_0xefb99e['rows'],function(_0x5f0186){return _0x5f0186[_0xf422('0x25')]==_0x48e0c7['id']&&_0x5f0186['sessionId']==_0xaa3e7e;});if(_0x6d22f1['length']==0x1){_0x31f439(_0x48e0c7);}else{_0x2d0053(new RangeError(_0xf422('0x26')+_0xaa3e7e+_0xf422('0x27')));}});});}exports['originate']=function(_0x261e29,_0x2f5b75){logger[_0xf422('0x28')](_0xf422('0x29'),_0x261e29[_0xf422('0x2a')]);var _0x4d8670=originateValidation[_0xf422('0xc')](_0x261e29['body']);if(_0x4d8670[_0xf422('0x2b')]>0x0){return _0x2f5b75[_0xf422('0x18')](0x190)[_0xf422('0x2c')](_0x4d8670);}var _0x1869a4=_0x261e29[_0xf422('0x2a')][_0xf422('0x2d')];var _0xbd95dd=_0x261e29['body']['callNumber'];var _0x2b35d2=_0x261e29[_0xf422('0x2a')]['callerId'];var _0x259bb2=_0x261e29[_0xf422('0x2a')][_0xf422('0x2e')];return getAgent(_0x1869a4)[_0xf422('0x22')](function(_0x12ddbf){logger[_0xf422('0x28')](_0xf422('0x2f'),_0x12ddbf[_0xf422('0x17')]);emit(util[_0xf422('0x30')](_0xf422('0x31'),_0x12ddbf[_0xf422('0x17')]),_0xf422('0x32'),{'callNumber':_0xbd95dd,'callerId':_0x2b35d2,'callbackUrl':_0x259bb2});return _0x2f5b75[_0xf422('0x18')](0xc8)[_0xf422('0x2c')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x2f5b75));};exports['hangup']=function(_0x2c9861,_0x2ae7e1){logger['info'](_0xf422('0x33'),_0x2c9861['body']);var _0x774834=hangupValidation[_0xf422('0xc')](_0x2c9861['body']);if(_0x774834[_0xf422('0x2b')]>0x0){return _0x2ae7e1[_0xf422('0x18')](0x190)[_0xf422('0x2c')](_0x774834);}var _0x511fc7=_0x2c9861[_0xf422('0x2a')]['userId'];var _0x567667=_0x2c9861['body'][_0xf422('0x34')];return getAgent(_0x511fc7)[_0xf422('0x22')](function(_0x2133a5){logger[_0xf422('0x28')](_0xf422('0x2f'),_0x2133a5[_0xf422('0x17')]);emit(util[_0xf422('0x30')](_0xf422('0x31'),_0x2133a5['name']),'webbar:hangup',{'sessionId':_0x567667});return _0x2ae7e1[_0xf422('0x18')](0xc8)[_0xf422('0x2c')]({'error':![],'message':_0xf422('0x35')});})[_0xf422('0x1f')](handleError(_0x2ae7e1));};exports[_0xf422('0x36')]=function(_0x35eac8,_0x56d615){logger[_0xf422('0x28')]('answer\x20fired:',_0x35eac8[_0xf422('0x2a')]);var _0x391e3c=answerValidation['validate'](_0x35eac8[_0xf422('0x2a')]);if(_0x391e3c[_0xf422('0x2b')]>0x0){return _0x56d615[_0xf422('0x18')](0x190)[_0xf422('0x2c')](_0x391e3c);}var _0x1658d0=_0x35eac8['body'][_0xf422('0x2d')];var _0x1e20a2=_0x35eac8[_0xf422('0x2a')][_0xf422('0x34')];return getAgent(_0x1658d0)[_0xf422('0x22')](function(_0x5ea94e){logger[_0xf422('0x28')](_0xf422('0x2f'),_0x5ea94e['name']);emit(util[_0xf422('0x30')]('user:%s',_0x5ea94e[_0xf422('0x17')]),_0xf422('0x37'),{'sessionId':_0x1e20a2});return _0x56d615[_0xf422('0x18')](0xc8)[_0xf422('0x2c')]({'error':![],'message':_0xf422('0x38')});})[_0xf422('0x1f')](handleError(_0x56d615));};exports[_0xf422('0x39')]=function(_0xd77d9,_0x2ad164){logger[_0xf422('0x28')](_0xf422('0x3a'),_0xd77d9[_0xf422('0x2a')]);var _0x154e72=holdValidation[_0xf422('0xc')](_0xd77d9[_0xf422('0x2a')]);if(_0x154e72['length']>0x0){return _0x2ad164['status'](0x190)[_0xf422('0x2c')](_0x154e72);}var _0x2c2ce9=_0xd77d9[_0xf422('0x2a')]['userId'];var _0x15967f=_0xd77d9[_0xf422('0x2a')][_0xf422('0x34')];return getAgent(_0x2c2ce9)[_0xf422('0x22')](function(_0x1f3a30){logger[_0xf422('0x28')](_0xf422('0x2f'),_0x1f3a30['name']);emit(util[_0xf422('0x30')]('user:%s',_0x1f3a30[_0xf422('0x17')]),_0xf422('0x3b'),{'sessionId':_0x15967f});return _0x2ad164['status'](0xc8)[_0xf422('0x2c')]({'error':![],'message':_0xf422('0x3c')});})[_0xf422('0x1f')](handleError(_0x2ad164));};exports[_0xf422('0x3d')]=function(_0x2df71a,_0x5c3cb8){logger['info'](_0xf422('0x3e'),_0x2df71a['body']);var _0x4429c6=unholdValidation[_0xf422('0xc')](_0x2df71a[_0xf422('0x2a')]);if(_0x4429c6[_0xf422('0x2b')]>0x0){return _0x5c3cb8['status'](0x190)['json'](_0x4429c6);}var _0x44448c=_0x2df71a[_0xf422('0x2a')][_0xf422('0x2d')];var _0xddcd6c=_0x2df71a[_0xf422('0x2a')][_0xf422('0x34')];return getAgent(_0x44448c)['then'](function(_0x315e79){logger['info'](_0xf422('0x2f'),_0x315e79[_0xf422('0x17')]);emit(util[_0xf422('0x30')](_0xf422('0x31'),_0x315e79['name']),'webbar:unhold',{'sessionId':_0xddcd6c});return _0x5c3cb8[_0xf422('0x18')](0xc8)[_0xf422('0x2c')]({'error':![],'message':_0xf422('0x3f')});})[_0xf422('0x1f')](handleError(_0x5c3cb8));};exports[_0xf422('0x40')]=function(_0x2ce919,_0x90f97f){logger['info'](_0xf422('0x41'),_0x90f97f[_0xf422('0x2a')]);var _0x19e687=callsValidation[_0xf422('0xc')](_0x2ce919[_0xf422('0x2a')]);if(_0x19e687[_0xf422('0x2b')]>0x0){return _0x90f97f[_0xf422('0x18')](0x190)[_0xf422('0x2c')](_0x19e687);}var _0x36f8ae=_0x2ce919[_0xf422('0x2a')]['userId'];var _0x4419e6=respondWithRpcPromise(_0xf422('0x42'));var _0x23ee77=getAgent(_0x36f8ae);return Promise[_0xf422('0x23')]([_0x4419e6,_0x23ee77])[_0xf422('0x22')](function(_0x5b14dd){var _0x235fff=_0x5b14dd[0x0];var _0x2b6a57=_0x5b14dd[0x1];var _0x4fa193=_[_0xf422('0x24')](_0x235fff[_0xf422('0x43')],function(_0x39fa95){return _0x39fa95[_0xf422('0x25')]==_0x2b6a57['id'];});return _0x90f97f[_0xf422('0x18')](0xc8)[_0xf422('0x2c')]({'count':_0x4fa193[_0xf422('0x2b')],'rows':_0x4fa193});})['catch'](handleError(_0x90f97f));};exports[_0xf422('0x44')]=function(_0x477a65,_0x462376){logger['info'](_0xf422('0x45'),_0x477a65[_0xf422('0x2a')]);var _0x3d9946=conferenceValidation[_0xf422('0xc')](_0x477a65[_0xf422('0x2a')]);if(_0x3d9946[_0xf422('0x2b')]>0x0){return _0x462376[_0xf422('0x18')](0x190)[_0xf422('0x2c')](_0x3d9946);}var _0x3f2095=_0x477a65[_0xf422('0x2a')][_0xf422('0x2d')];return getAgent(_0x3f2095)[_0xf422('0x22')](function(_0x28c6ac){logger[_0xf422('0x28')](_0xf422('0x2f'),_0x28c6ac[_0xf422('0x17')]);emit(util[_0xf422('0x30')](_0xf422('0x31'),_0x28c6ac[_0xf422('0x17')]),'webbar:conference');return _0x462376['status'](0xc8)[_0xf422('0x2c')]({'error':![],'message':'conference\x20executed!'});})[_0xf422('0x1f')](handleError(_0x462376));};exports[_0xf422('0x46')]=function(_0x416e40,_0x14904a){logger['info'](_0xf422('0x47'),_0x416e40[_0xf422('0x2a')]);var _0x2b1d8f=transferValidation['validate'](_0x416e40['body']);if(_0x2b1d8f[_0xf422('0x2b')]>0x0){return _0x14904a[_0xf422('0x18')](0x190)[_0xf422('0x2c')](_0x2b1d8f);}var _0x23d1b5=_0x416e40['body']['userId'];var _0x53f92e=_0x416e40[_0xf422('0x2a')][_0xf422('0x34')];var _0x3de5c5=_0x416e40[_0xf422('0x2a')][_0xf422('0x48')];return getAgent(_0x23d1b5)[_0xf422('0x22')](function(_0x3f165d){logger['info']('entityFound:',_0x3f165d['name']);emit(util[_0xf422('0x30')]('user:%s',_0x3f165d[_0xf422('0x17')]),_0xf422('0x49'),{'sessionId':_0x53f92e,'transferNumber':_0x3de5c5});return _0x14904a['status'](0xc8)[_0xf422('0x2c')]({'error':![],'message':_0xf422('0x4a')});})[_0xf422('0x1f')](handleError(_0x14904a));}; \ No newline at end of file +var _0x16d2=['localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','info','stringify','emit','log','stack','name','status','send','then','error','code','message','findOne','agent','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','entityFound:','user:%s','webbar:originate','hangup','hangup\x20fired:','validate','format','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','answer\x20executed!','catch','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','calls','calls\x20fired:','VoiceChannels','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','webbarapi','ioredis','redis','defaults'];(function(_0x4df69e,_0x5131d5){var _0x1f9041=function(_0x1e6288){while(--_0x1e6288){_0x4df69e['push'](_0x4df69e['shift']());}};_0x1f9041(++_0x5131d5);}(_0x16d2,0x123));var _0x216d=function(_0x754278,_0x3690ad){_0x754278=_0x754278-0x0;var _0xff2300=_0x16d2[_0x754278];return _0xff2300;};'use strict';var path=require(_0x216d('0x0'));var fs=require('fs');var _=require(_0x216d('0x1'));var db=require(_0x216d('0x2'))['db'];var config=require(_0x216d('0x3'));var util=require(_0x216d('0x4'));var BPromise=require(_0x216d('0x5'));var jayson=require(_0x216d('0x6'));var amiClient=jayson[_0x216d('0x7')][_0x216d('0x8')]({'port':0x232a});var logger=require('../../config/logger')(_0x216d('0x9'));var Redis=require(_0x216d('0xa'));config[_0x216d('0xb')]=_[_0x216d('0xc')](config[_0x216d('0xb')],{'host':_0x216d('0xd'),'port':0x18eb});var io=require(_0x216d('0xe'))(new Redis(config[_0x216d('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x216d('0xf'),'required':[!![],_0x216d('0x10')]},'callNumber':{'type':_0x216d('0x11'),'required':[!![],_0x216d('0x12')]},'callerId':{'type':_0x216d('0x11')},'callbackUrl':{'type':_0x216d('0x11')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0x216d('0x10')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x216d('0xf'),'required':[!![],_0x216d('0x10')]},'sessionId':{'type':_0x216d('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x216d('0xf'),'required':[!![],_0x216d('0x10')]},'sessionId':{'type':_0x216d('0x11'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x216d('0x11'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x216d('0xf'),'required':[!![],_0x216d('0x10')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x216d('0xf'),'required':[!![],_0x216d('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x216d('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x216d('0xf'),'required':[!![],_0x216d('0x10')]}});function emit(_0x4631b0,_0x23ff86,_0x3e5585){logger[_0x216d('0x13')](_0x4631b0,_0x23ff86,JSON[_0x216d('0x14')](_0x3e5585));io['to'](_0x4631b0)[_0x216d('0x15')](_0x23ff86,_0x3e5585);}function handleError(_0x19fdac){return function(_0x53d464){console[_0x216d('0x16')]('handleError:',_0x53d464,_0x53d464 instanceof RangeError);logger['error'](_0x53d464[_0x216d('0x17')]);if(_0x53d464 instanceof RangeError){if(_0x53d464[_0x216d('0x18')]){delete _0x53d464['name'];}_0x19fdac[_0x216d('0x19')](0x194)[_0x216d('0x1a')](_0x53d464);}else{if(_0x53d464['name']){delete _0x53d464[_0x216d('0x18')];}_0x19fdac[_0x216d('0x19')](0x1f4)[_0x216d('0x1a')](_0x53d464);}};}function checkError(){return function(_0x3e9818){if(!_0x3e9818){throw new RangeError('NotFound');}return _0x3e9818;};}function respondWithRpcPromise(_0x20ee7c,_0x294bbf){return new BPromise(function(_0x10f299,_0x438981){var _0x206782=amiClient;return _0x206782['request'](_0x20ee7c,_0x294bbf)[_0x216d('0x1b')](function(_0x1bd4db){if(_0x1bd4db[_0x216d('0x1c')]){if(_0x1bd4db[_0x216d('0x1c')][_0x216d('0x1d')]===0x1f4){return _0x438981(_0x1bd4db['error'][_0x216d('0x1e')]);}return _0x10f299(_0x1bd4db[_0x216d('0x1c')][_0x216d('0x1e')]);}else{_0x10f299(_0x1bd4db['result']);}})['catch'](function(_0x56460f){_0x438981(_0x56460f);});});}function getAgent(_0x4c792e){return db['User'][_0x216d('0x1f')]({'where':{'id':_0x4c792e,'role':_0x216d('0x20')}})[_0x216d('0x1b')](checkError());}function getAgentCheckSession(_0x73b509,_0x46d0ef){return new BPromise(function(_0x47fa6d,_0x5b21d8){var _0xa7624a=respondWithRpcPromise('VoiceChannels');var _0x23d1c3=getAgent(_0x73b509);Promise[_0x216d('0x21')]([_0xa7624a,_0x23d1c3])[_0x216d('0x1b')](function(_0x20bc16){var _0x307f2b=_0x20bc16[0x0];var _0x12bcab=_0x20bc16[0x1];var _0x28fcc2=_[_0x216d('0x22')](_0x307f2b[_0x216d('0x23')],function(_0x28f56a){return _0x28f56a[_0x216d('0x24')]==_0x12bcab['id']&&_0x28f56a[_0x216d('0x25')]==_0x46d0ef;});if(_0x28fcc2[_0x216d('0x26')]==0x1){_0x47fa6d(_0x12bcab);}else{_0x5b21d8(new RangeError('sessionId\x20'+_0x46d0ef+_0x216d('0x27')));}});});}exports[_0x216d('0x28')]=function(_0x37e8e6,_0x510ad9){logger[_0x216d('0x13')](_0x216d('0x29'),_0x37e8e6[_0x216d('0x2a')]);var _0xeff234=originateValidation['validate'](_0x37e8e6[_0x216d('0x2a')]);if(_0xeff234[_0x216d('0x26')]>0x0){return _0x510ad9[_0x216d('0x19')](0x190)[_0x216d('0x2b')](_0xeff234);}var _0x14d417=_0x37e8e6[_0x216d('0x2a')][_0x216d('0x2c')];var _0x35d4d2=_0x37e8e6[_0x216d('0x2a')][_0x216d('0x2d')];var _0x6eda4=_0x37e8e6['body'][_0x216d('0x2e')];var _0x451c4d=_0x37e8e6[_0x216d('0x2a')]['callbackUrl'];return getAgent(_0x14d417)[_0x216d('0x1b')](function(_0x2e86f9){logger['info'](_0x216d('0x2f'),_0x2e86f9['name']);emit(util['format'](_0x216d('0x30'),_0x2e86f9[_0x216d('0x18')]),_0x216d('0x31'),{'callNumber':_0x35d4d2,'callerId':_0x6eda4,'callbackUrl':_0x451c4d});return _0x510ad9[_0x216d('0x19')](0xc8)['json']({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x510ad9));};exports[_0x216d('0x32')]=function(_0x38972e,_0x47e006){logger[_0x216d('0x13')](_0x216d('0x33'),_0x38972e['body']);var _0xe49ba4=hangupValidation[_0x216d('0x34')](_0x38972e[_0x216d('0x2a')]);if(_0xe49ba4[_0x216d('0x26')]>0x0){return _0x47e006[_0x216d('0x19')](0x190)[_0x216d('0x2b')](_0xe49ba4);}var _0x35cb6e=_0x38972e[_0x216d('0x2a')]['userId'];var _0x4bc645=_0x38972e[_0x216d('0x2a')][_0x216d('0x25')];return getAgent(_0x35cb6e)['then'](function(_0xf33f9c){logger[_0x216d('0x13')](_0x216d('0x2f'),_0xf33f9c['name']);emit(util[_0x216d('0x35')](_0x216d('0x30'),_0xf33f9c[_0x216d('0x18')]),_0x216d('0x36'),{'sessionId':_0x4bc645});return _0x47e006['status'](0xc8)[_0x216d('0x2b')]({'error':![],'message':_0x216d('0x37')});})['catch'](handleError(_0x47e006));};exports[_0x216d('0x38')]=function(_0x306e9f,_0x590eb6){logger['info'](_0x216d('0x39'),_0x306e9f[_0x216d('0x2a')]);var _0x3c491e=answerValidation['validate'](_0x306e9f[_0x216d('0x2a')]);if(_0x3c491e['length']>0x0){return _0x590eb6['status'](0x190)[_0x216d('0x2b')](_0x3c491e);}var _0x43336e=_0x306e9f[_0x216d('0x2a')]['userId'];var _0xaccf45=_0x306e9f['body'][_0x216d('0x25')];return getAgent(_0x43336e)[_0x216d('0x1b')](function(_0x842af2){logger['info'](_0x216d('0x2f'),_0x842af2[_0x216d('0x18')]);emit(util[_0x216d('0x35')](_0x216d('0x30'),_0x842af2['name']),'webbar:answer',{'sessionId':_0xaccf45});return _0x590eb6['status'](0xc8)[_0x216d('0x2b')]({'error':![],'message':_0x216d('0x3a')});})[_0x216d('0x3b')](handleError(_0x590eb6));};exports[_0x216d('0x3c')]=function(_0x3344e3,_0x13f51c){logger[_0x216d('0x13')](_0x216d('0x3d'),_0x3344e3['body']);var _0x3771dc=holdValidation[_0x216d('0x34')](_0x3344e3[_0x216d('0x2a')]);if(_0x3771dc[_0x216d('0x26')]>0x0){return _0x13f51c['status'](0x190)[_0x216d('0x2b')](_0x3771dc);}var _0x542e1b=_0x3344e3[_0x216d('0x2a')][_0x216d('0x2c')];var _0xceb993=_0x3344e3['body']['sessionId'];return getAgent(_0x542e1b)[_0x216d('0x1b')](function(_0x32d499){logger[_0x216d('0x13')](_0x216d('0x2f'),_0x32d499[_0x216d('0x18')]);emit(util[_0x216d('0x35')]('user:%s',_0x32d499['name']),_0x216d('0x3e'),{'sessionId':_0xceb993});return _0x13f51c['status'](0xc8)[_0x216d('0x2b')]({'error':![],'message':_0x216d('0x3f')});})['catch'](handleError(_0x13f51c));};exports['unhold']=function(_0x5f37e3,_0x4bac14){logger[_0x216d('0x13')](_0x216d('0x40'),_0x5f37e3[_0x216d('0x2a')]);var _0x216f44=unholdValidation[_0x216d('0x34')](_0x5f37e3[_0x216d('0x2a')]);if(_0x216f44[_0x216d('0x26')]>0x0){return _0x4bac14['status'](0x190)[_0x216d('0x2b')](_0x216f44);}var _0x34cdb9=_0x5f37e3[_0x216d('0x2a')]['userId'];var _0x1e1caf=_0x5f37e3[_0x216d('0x2a')][_0x216d('0x25')];return getAgent(_0x34cdb9)[_0x216d('0x1b')](function(_0x481754){logger[_0x216d('0x13')](_0x216d('0x2f'),_0x481754[_0x216d('0x18')]);emit(util[_0x216d('0x35')]('user:%s',_0x481754[_0x216d('0x18')]),_0x216d('0x41'),{'sessionId':_0x1e1caf});return _0x4bac14['status'](0xc8)[_0x216d('0x2b')]({'error':![],'message':'unhold\x20executed!'});})[_0x216d('0x3b')](handleError(_0x4bac14));};exports[_0x216d('0x42')]=function(_0x22e025,_0xe65193){logger[_0x216d('0x13')](_0x216d('0x43'),_0xe65193[_0x216d('0x2a')]);var _0x2c6cb6=callsValidation[_0x216d('0x34')](_0x22e025['body']);if(_0x2c6cb6[_0x216d('0x26')]>0x0){return _0xe65193[_0x216d('0x19')](0x190)['json'](_0x2c6cb6);}var _0x241ce4=_0x22e025[_0x216d('0x2a')]['userId'];var _0x4edf77=respondWithRpcPromise(_0x216d('0x44'));var _0x5e4b3d=getAgent(_0x241ce4);return Promise[_0x216d('0x21')]([_0x4edf77,_0x5e4b3d])[_0x216d('0x1b')](function(_0x2c9b1f){var _0x590c4e=_0x2c9b1f[0x0];var _0x3acd4b=_0x2c9b1f[0x1];var _0x5112ea=_['filter'](_0x590c4e[_0x216d('0x23')],function(_0x38ee94){return _0x38ee94['UserId']==_0x3acd4b['id'];});return _0xe65193[_0x216d('0x19')](0xc8)[_0x216d('0x2b')]({'count':_0x5112ea[_0x216d('0x26')],'rows':_0x5112ea});})[_0x216d('0x3b')](handleError(_0xe65193));};exports[_0x216d('0x45')]=function(_0xd723fc,_0x5276df){logger['info'](_0x216d('0x46'),_0xd723fc[_0x216d('0x2a')]);var _0x1ce36c=conferenceValidation[_0x216d('0x34')](_0xd723fc[_0x216d('0x2a')]);if(_0x1ce36c[_0x216d('0x26')]>0x0){return _0x5276df[_0x216d('0x19')](0x190)[_0x216d('0x2b')](_0x1ce36c);}var _0x3c01a4=_0xd723fc[_0x216d('0x2a')][_0x216d('0x2c')];return getAgent(_0x3c01a4)[_0x216d('0x1b')](function(_0x489bdd){logger['info'](_0x216d('0x2f'),_0x489bdd[_0x216d('0x18')]);emit(util['format'](_0x216d('0x30'),_0x489bdd['name']),'webbar:conference');return _0x5276df[_0x216d('0x19')](0xc8)[_0x216d('0x2b')]({'error':![],'message':_0x216d('0x47')});})[_0x216d('0x3b')](handleError(_0x5276df));};exports[_0x216d('0x48')]=function(_0x3847b6,_0xb00e58){logger[_0x216d('0x13')](_0x216d('0x49'),_0x3847b6[_0x216d('0x2a')]);var _0x1c08d9=transferValidation[_0x216d('0x34')](_0x3847b6[_0x216d('0x2a')]);if(_0x1c08d9[_0x216d('0x26')]>0x0){return _0xb00e58[_0x216d('0x19')](0x190)[_0x216d('0x2b')](_0x1c08d9);}var _0xb398cc=_0x3847b6[_0x216d('0x2a')][_0x216d('0x2c')];var _0x34540e=_0x3847b6[_0x216d('0x2a')][_0x216d('0x25')];var _0x5f04ba=_0x3847b6[_0x216d('0x2a')]['transferNumber'];return getAgent(_0xb398cc)[_0x216d('0x1b')](function(_0x51507b){logger[_0x216d('0x13')](_0x216d('0x2f'),_0x51507b['name']);emit(util[_0x216d('0x35')](_0x216d('0x30'),_0x51507b[_0x216d('0x18')]),_0x216d('0x4a'),{'sessionId':_0x34540e,'transferNumber':_0x5f04ba});return _0xb00e58[_0x216d('0x19')](0xc8)[_0x216d('0x2b')]({'error':![],'message':_0x216d('0x4b')});})[_0x216d('0x3b')](handleError(_0xb00e58));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 6610213..97ae54c 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 _0xfcf0=['/:id/applications','getApplications','post','addAnswer','/:id/users','addAgents','addApplications','notify','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents'];(function(_0x2dc183,_0x18ab11){var _0x5ba9c8=function(_0x1ce7aa){while(--_0x1ce7aa){_0x2dc183['push'](_0x2dc183['shift']());}};_0x5ba9c8(++_0x18ab11);}(_0xfcf0,0x138));var _0x0fcf=function(_0x29d623,_0x1a5c9c){_0x29d623=_0x29d623-0x0;var _0x242e59=_0xfcf0[_0x29d623];return _0x242e59;};'use strict';var multer=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var path=require('path');var timeout=require(_0x0fcf('0x2'));var express=require(_0x0fcf('0x3'));var router=express[_0x0fcf('0x4')]();var fs_extra=require(_0x0fcf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var controller=require(_0x0fcf('0x8'));router[_0x0fcf('0x9')]('/',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0xb')]);router[_0x0fcf('0x9')](_0x0fcf('0xc'),auth['isAuthenticated'](),controller[_0x0fcf('0xd')]);router[_0x0fcf('0x9')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0xf')]);router[_0x0fcf('0x9')](_0x0fcf('0x10'),auth['isAuthenticated'](),controller[_0x0fcf('0x11')]);router['get'](_0x0fcf('0x12'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x13')]);router['get']('/:id/users',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x14')]);router['get'](_0x0fcf('0x15'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x16')]);router[_0x0fcf('0x17')]('/',auth[_0x0fcf('0xa')](),controller['create']);router[_0x0fcf('0x17')](_0x0fcf('0x10'),auth[_0x0fcf('0xa')](),controller['addDisposition']);router[_0x0fcf('0x17')](_0x0fcf('0x12'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x18')]);router['post'](_0x0fcf('0x19'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x1a')]);router[_0x0fcf('0x17')](_0x0fcf('0x15'),auth['isAuthenticated'](),controller[_0x0fcf('0x1b')]);router[_0x0fcf('0x17')]('/:id/notify',controller[_0x0fcf('0x1c')]);router[_0x0fcf('0x17')]('/:id/send',auth[_0x0fcf('0xa')](),controller['send']);router[_0x0fcf('0x1d')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0x1e')]);router[_0x0fcf('0x1f')](_0x0fcf('0xe'),auth['isAuthenticated'](),controller[_0x0fcf('0x20')]);router[_0x0fcf('0x1f')](_0x0fcf('0x10'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x21')]);router[_0x0fcf('0x1f')]('/:id/canned_answers',auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x22')]);router[_0x0fcf('0x1f')](_0x0fcf('0x19'),auth[_0x0fcf('0xa')](),controller[_0x0fcf('0x23')]);module[_0x0fcf('0x24')]=router; \ No newline at end of file +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(_0x1eae11,_0x74fc1){var _0x3737af=function(_0x17061d){while(--_0x17061d){_0x1eae11['push'](_0x1eae11['shift']());}};_0x3737af(++_0x74fc1);}(_0xd943,0x15d));var _0x3d94=function(_0x1a1c0e,_0x2d51ac){_0x1a1c0e=_0x1a1c0e-0x0;var _0x40c462=_0xd943[_0x1a1c0e];return _0x40c462;};'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 diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index c756c53..5f35505 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 _0xc208=['mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x5ca21e,_0x4e9bd1){var _0x2ad0d1=function(_0x26c9ed){while(--_0x26c9ed){_0x5ca21e['push'](_0x5ca21e['shift']());}};_0x2ad0d1(++_0x4e9bd1);}(_0xc208,0x189));var _0x8c20=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc208[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x8c20('0x0'));var rs=require('randomstring');module[_0x8c20('0x1')]={'name':{'type':Sequelize[_0x8c20('0x2')],'unique':_0x8c20('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8c20('0x4')]();}},'phone':{'type':Sequelize[_0x8c20('0x2')]},'type':{'type':Sequelize[_0x8c20('0x5')](_0x8c20('0x6'),_0x8c20('0x7'))},'accountSid':{'type':Sequelize[_0x8c20('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x8c20('0x2')]},'notificationTemplate':{'type':Sequelize[_0x8c20('0x8')],'defaultValue':function(){return _0x8c20('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x8c20('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8c20('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8c20('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8c20('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8c20('0xb')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8c20('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x69342d){if(!_0x69342d){this['setDataValue'](_0x8c20('0xc'),null);}this[_0x8c20('0xd')](_0x8c20('0xe'),_0x69342d);}},'description':{'type':Sequelize[_0x8c20('0x2')]}}; \ No newline at end of file +var _0xe076=['exports','STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring'];(function(_0x4791c6,_0x293adf){var _0x52b5d3=function(_0x172af3){while(--_0x172af3){_0x4791c6['push'](_0x4791c6['shift']());}};_0x52b5d3(++_0x293adf);}(_0xe076,0x86));var _0x6e07=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xe076[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require(_0x6e07('0x0'));var rs=require(_0x6e07('0x1'));module[_0x6e07('0x2')]={'name':{'type':Sequelize[_0x6e07('0x3')],'unique':_0x6e07('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x6e07('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x6e07('0x3')],'defaultValue':function(){return rs[_0x6e07('0x5')]();}},'phone':{'type':Sequelize[_0x6e07('0x3')]},'type':{'type':Sequelize[_0x6e07('0x6')](_0x6e07('0x7'),_0x6e07('0x8'))},'accountSid':{'type':Sequelize[_0x6e07('0x3')]},'baseUrl':{'type':Sequelize[_0x6e07('0x3')]},'authToken':{'type':Sequelize[_0x6e07('0x3')]},'notificationTemplate':{'type':Sequelize[_0x6e07('0x9')],'defaultValue':function(){return _0x6e07('0xa');}},'notificationSound':{'type':Sequelize[_0x6e07('0xb')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6e07('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6e07('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6e07('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6e07('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6e07('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6e07('0xc')],'comment':_0x6e07('0xd')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6e07('0xe'),'set':function(_0x56f578){if(!_0x56f578){this[_0x6e07('0xf')](_0x6e07('0x10'),null);}this[_0x6e07('0xf')]('mandatoryDisposition',_0x56f578);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 02feb9f..54f3dbc 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 _0x3749=['userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','Transaction','ISOLATION_LEVELS','WhatsappApplication','findAndCountAll','finally','Applications','account','sinch','statuses','state','read','WhatsappMessage','update','timestamp','message_id','applications','orderBy','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','whatsapp:','Body','messageId','from','notifications','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','CmContact','Contacts','DESC','list','contact','WhatsappInteraction','created','autoclose','push','close','interaction','AttachmentId','UserId','*,*,*,*','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','send','to\x20is\x20mandatory','List','out','dataValues','Messages','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','squel','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','defaults','localhost','socket.io-emitter','redis','./whatsappAccount.socket','register','client','request','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','get','WhatsappAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','VIRTUAL','filter','merge','options','WhatsappAccount','includeAll','findAll','rows','show','params','include','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','body','destroy','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','removeDispositions','ids','CannedAnswer','removeAnswers','addAgents','omit','spread','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3749,0x1bd));var _0x9374=function(_0x8f0df1,_0x2ba68f){_0x8f0df1=_0x8f0df1-0x0;var _0x2929a8=_0x3749[_0x8f0df1];return _0x2929a8;};'use strict';var emlformat=require(_0x9374('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9374('0x1'));var jsonpatch=require(_0x9374('0x2'));var rp=require('request-promise');var moment=require(_0x9374('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9374('0x4'));var path=require(_0x9374('0x5'));var sox=require(_0x9374('0x6'));var csv=require(_0x9374('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9374('0x8'));var _=require('lodash');var squel=require(_0x9374('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9374('0xa'));var toCsv=require(_0x9374('0x7'));var querystring=require(_0x9374('0xb'));var Papa=require(_0x9374('0xc'));var Redis=require('ioredis');var authService=require(_0x9374('0xd'));var qs=require(_0x9374('0xe'));var as=require(_0x9374('0xf'));var hardwareService=require(_0x9374('0x10'));var logger=require(_0x9374('0x11'))(_0x9374('0x12'));var utils=require(_0x9374('0x13'));var config=require(_0x9374('0x14'));var licenseUtil=require(_0x9374('0x15'));var db=require(_0x9374('0x16'))['db'];config['redis']=_[_0x9374('0x17')](config['redis'],{'host':_0x9374('0x18'),'port':0x18eb});var socket=require(_0x9374('0x19'))(new Redis(config[_0x9374('0x1a')]));require(_0x9374('0x1b'))[_0x9374('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9374('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3e67a6,_0x5c3dfc,_0x3d7d72,_0x583690){return new BPromise(function(_0xa33dba,_0x6101fc){var _0x38df83=_0x583690||client;return _0x38df83[_0x9374('0x1e')](_0x3e67a6,_0x3d7d72)['then'](function(_0x18d774){logger[_0x9374('0x1f')](_0x9374('0x20'),_0x5c3dfc,'request\x20sent');logger[_0x9374('0x21')](_0x9374('0x22'),_0x5c3dfc,_0x9374('0x23'),JSON[_0x9374('0x24')](_0x18d774));if(_0x18d774[_0x9374('0x25')]){if(_0x18d774[_0x9374('0x25')]['code']===0x1f4){logger[_0x9374('0x25')](_0x9374('0x20'),_0x5c3dfc,_0x18d774[_0x9374('0x25')][_0x9374('0x26')]);return _0x6101fc(_0x18d774[_0x9374('0x25')]['message']);}logger[_0x9374('0x25')](_0x9374('0x20'),_0x5c3dfc,_0x18d774[_0x9374('0x25')][_0x9374('0x26')]);return _0xa33dba(_0x18d774['error'][_0x9374('0x26')]);}else{logger['info'](_0x9374('0x20'),_0x5c3dfc,_0x9374('0x23'));_0xa33dba(_0x18d774['result']['message']);}})[_0x9374('0x27')](function(_0x242f9f){logger[_0x9374('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x5c3dfc,_0x242f9f);_0x6101fc(_0x242f9f);});});}function respondWithStatusCode(_0x33109f,_0x8a7faa){_0x8a7faa=_0x8a7faa||0xcc;return function(_0x1bc6f1){if(_0x1bc6f1){return _0x33109f[_0x9374('0x28')](_0x8a7faa);}return _0x33109f[_0x9374('0x29')](_0x8a7faa)[_0x9374('0x2a')]();};}function respondWithResult(_0xbee79e,_0xd269f8){_0xd269f8=_0xd269f8||0xc8;return function(_0x9291ef){if(_0x9291ef){return _0xbee79e[_0x9374('0x29')](_0xd269f8)[_0x9374('0x2b')](_0x9291ef);}};}function respondWithFilteredResult(_0x2f2b59,_0x4b129b){return function(_0x1c8922){if(_0x1c8922){var _0x26e60d=typeof _0x4b129b['offset']===_0x9374('0x2c')&&typeof _0x4b129b[_0x9374('0x2d')]===_0x9374('0x2c');var _0x12e8db=_0x1c8922[_0x9374('0x2e')];var _0x32ae1a=_0x26e60d?0x0:_0x4b129b['offset'];var _0x55488c=_0x26e60d?_0x1c8922[_0x9374('0x2e')]:_0x4b129b[_0x9374('0x2f')]+_0x4b129b[_0x9374('0x2d')];var _0x1c79c7;if(_0x55488c>=_0x12e8db){_0x55488c=_0x12e8db;_0x1c79c7=0xc8;}else{_0x1c79c7=0xce;}_0x2f2b59[_0x9374('0x29')](_0x1c79c7);return _0x2f2b59[_0x9374('0x30')]('Content-Range',_0x32ae1a+'-'+_0x55488c+'/'+_0x12e8db)[_0x9374('0x2b')](_0x1c8922);}return null;};}function patchUpdates(_0x582e6d){return function(_0x5f4538){try{jsonpatch[_0x9374('0x31')](_0x5f4538,_0x582e6d,!![]);}catch(_0x1fd76b){return BPromise[_0x9374('0x32')](_0x1fd76b);}return _0x5f4538[_0x9374('0x33')]();};}function saveUpdates(_0xe704f2,_0x3cc7d4){return function(_0x20d684){if(_0x20d684){return _0x20d684['update'](_0xe704f2)[_0x9374('0x34')](function(_0x5a285a){return _0x5a285a;});}return null;};}function removeEntity(_0x169fb6,_0x2543b2){return function(_0x435506){if(_0x435506){return _0x435506['destroy']()['then'](function(){var _0x22ef4a=_0x435506[_0x9374('0x35')]({'plain':!![]});var _0x1ba8c8=_0x9374('0x36');return db[_0x9374('0x37')]['destroy']({'where':{'type':_0x1ba8c8,'resourceId':_0x22ef4a['id']}})[_0x9374('0x34')](function(){return _0x435506;});})[_0x9374('0x34')](function(){_0x169fb6[_0x9374('0x29')](0xcc)[_0x9374('0x2a')]();});}};}function handleEntityNotFound(_0x3e9196,_0x35720c){return function(_0x240481){if(!_0x240481){_0x3e9196['sendStatus'](0x194);}return _0x240481;};}function handleError(_0x2ce63b,_0x344fb2){_0x344fb2=_0x344fb2||0x1f4;return function(_0x59dae6){logger[_0x9374('0x25')](_0x59dae6[_0x9374('0x38')]);if(_0x59dae6[_0x9374('0x39')]){delete _0x59dae6['name'];}_0x2ce63b[_0x9374('0x29')](_0x344fb2)['send'](_0x59dae6);};}exports[_0x9374('0x3a')]=function(_0xacc854,_0x299c07){var _0x21580c={'include':[{'model':db[_0x9374('0x3b')],'as':_0x9374('0x3c')}]},_0xaec9bb={},_0x1c0061={'count':0x0,'rows':[]};var _0x3b8da1=_[_0x9374('0x3d')](db['WhatsappAccount'][_0x9374('0x3e')],function(_0x4b3741){return{'name':_0x4b3741['fieldName'],'type':_0x4b3741[_0x9374('0x3f')][_0x9374('0x40')]};});_0xaec9bb[_0x9374('0x41')]=_[_0x9374('0x3d')](_0x3b8da1,_0x9374('0x39'));_0xaec9bb[_0x9374('0x42')]=_[_0x9374('0x43')](_0xacc854['query']);_0xaec9bb[_0x9374('0x44')]=_['intersection'](_0xaec9bb[_0x9374('0x41')],_0xaec9bb['query']);_0x21580c[_0x9374('0x45')]=_[_0x9374('0x46')](_0xaec9bb[_0x9374('0x41')],qs[_0x9374('0x47')](_0xacc854[_0x9374('0x42')][_0x9374('0x47')]));_0x21580c[_0x9374('0x45')]=_0x21580c[_0x9374('0x45')][_0x9374('0x48')]?_0x21580c['attributes']:_0xaec9bb[_0x9374('0x41')];if(!_0xacc854['query']['hasOwnProperty']('nolimit')){_0x21580c[_0x9374('0x2d')]=qs[_0x9374('0x2d')](_0xacc854[_0x9374('0x42')][_0x9374('0x2d')]);_0x21580c['offset']=qs[_0x9374('0x2f')](_0xacc854['query'][_0x9374('0x2f')]);}_0x21580c[_0x9374('0x49')]=qs['sort'](_0xacc854[_0x9374('0x42')][_0x9374('0x4a')]);_0x21580c[_0x9374('0x4b')]=qs[_0x9374('0x44')](_[_0x9374('0x4c')](_0xacc854[_0x9374('0x42')],_0xaec9bb[_0x9374('0x44')]),_0x3b8da1);if(_0xacc854[_0x9374('0x42')]['filter']){_0x21580c[_0x9374('0x4b')]=_['merge'](_0x21580c['where'],{'$or':_[_0x9374('0x3d')](_0x3b8da1,function(_0x1920e5){if(_0x1920e5['type']!==_0x9374('0x4d')){var _0x412b17={};_0x412b17[_0x1920e5[_0x9374('0x39')]]={'$like':'%'+_0xacc854[_0x9374('0x42')][_0x9374('0x4e')]+'%'};return _0x412b17;}})});}_0x21580c=_[_0x9374('0x4f')]({},_0x21580c,_0xacc854[_0x9374('0x50')]);var _0x6cf986={'where':_0x21580c[_0x9374('0x4b')]};return db[_0x9374('0x51')][_0x9374('0x2e')](_0x6cf986)[_0x9374('0x34')](function(_0x32521e){_0x1c0061[_0x9374('0x2e')]=_0x32521e;if(_0xacc854[_0x9374('0x42')][_0x9374('0x52')]){_0x21580c['include']=[{'all':!![]}];}return db[_0x9374('0x51')][_0x9374('0x53')](_0x21580c);})['then'](function(_0x27d215){_0x1c0061[_0x9374('0x54')]=_0x27d215;return _0x1c0061;})['then'](respondWithFilteredResult(_0x299c07,_0x21580c))['catch'](handleError(_0x299c07,null));};exports[_0x9374('0x55')]=function(_0x1fa5f9,_0x480aeb){var _0x249641={'raw':![],'where':{'id':_0x1fa5f9[_0x9374('0x56')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2c32ad={};_0x2c32ad[_0x9374('0x41')]=_['keys'](db['WhatsappAccount'][_0x9374('0x3e')]);_0x2c32ad[_0x9374('0x42')]=_[_0x9374('0x43')](_0x1fa5f9[_0x9374('0x42')]);_0x2c32ad[_0x9374('0x44')]=_['intersection'](_0x2c32ad[_0x9374('0x41')],_0x2c32ad[_0x9374('0x42')]);_0x249641[_0x9374('0x45')]=_[_0x9374('0x46')](_0x2c32ad['model'],qs['fields'](_0x1fa5f9['query']['fields']));_0x249641['attributes']=_0x249641[_0x9374('0x45')][_0x9374('0x48')]?_0x249641[_0x9374('0x45')]:_0x2c32ad['model'];if(_0x1fa5f9[_0x9374('0x42')][_0x9374('0x52')]){_0x249641[_0x9374('0x57')]=[{'all':!![]}];}_0x249641=_['merge']({},_0x249641,_0x1fa5f9[_0x9374('0x50')]);return db[_0x9374('0x51')][_0x9374('0x58')](_0x249641)[_0x9374('0x34')](handleEntityNotFound(_0x480aeb,null))[_0x9374('0x34')](respondWithResult(_0x480aeb,null))['catch'](handleError(_0x480aeb,null));};exports[_0x9374('0x59')]=function(_0x2e4f1d,_0x35892a){return db[_0x9374('0x51')][_0x9374('0x59')](_0x2e4f1d['body'],{})[_0x9374('0x34')](function(_0x3f08dc){var _0x34bbe6=_0x2e4f1d[_0x9374('0x5a')][_0x9374('0x35')]({'plain':!![]});if(!_0x34bbe6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x34bbe6[_0x9374('0x5b')]===_0x9374('0x5a')){var _0x53807d=_0x3f08dc[_0x9374('0x35')]({'plain':!![]});var _0x1400a4='WhatsappAccounts';return db[_0x9374('0x5c')][_0x9374('0x58')]({'where':{'name':_0x1400a4,'userProfileId':_0x34bbe6[_0x9374('0x5d')]},'raw':!![]})[_0x9374('0x34')](function(_0x232f5c){if(_0x232f5c&&_0x232f5c[_0x9374('0x5e')]===0x0){return db[_0x9374('0x37')][_0x9374('0x59')]({'name':_0x53807d[_0x9374('0x39')],'resourceId':_0x53807d['id'],'type':_0x232f5c[_0x9374('0x39')],'sectionId':_0x232f5c['id']},{})['then'](function(){return _0x3f08dc;});}else{return _0x3f08dc;}})['catch'](function(_0x3924a8){logger[_0x9374('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3924a8);throw _0x3924a8;});}return _0x3f08dc;})[_0x9374('0x34')](respondWithResult(_0x35892a,0xc9))[_0x9374('0x27')](handleError(_0x35892a,null));};exports['update']=function(_0x33c548,_0x5a82a8){if(_0x33c548['body']['id']){delete _0x33c548[_0x9374('0x5f')]['id'];}return db[_0x9374('0x51')][_0x9374('0x58')]({'where':{'id':_0x33c548[_0x9374('0x56')]['id']},'include':[{'model':db[_0x9374('0x3b')],'as':'mandatoryDispositionPause'}]})[_0x9374('0x34')](handleEntityNotFound(_0x5a82a8,null))['then'](saveUpdates(_0x33c548[_0x9374('0x5f')],null))[_0x9374('0x34')](respondWithResult(_0x5a82a8,null))[_0x9374('0x27')](handleError(_0x5a82a8,null));};exports[_0x9374('0x60')]=function(_0x11e0c9,_0x3dae2d){return db[_0x9374('0x51')][_0x9374('0x58')]({'where':{'id':_0x11e0c9[_0x9374('0x56')]['id']}})[_0x9374('0x34')](handleEntityNotFound(_0x3dae2d,null))['then'](removeEntity(_0x3dae2d,null))[_0x9374('0x27')](handleError(_0x3dae2d,null));};exports[_0x9374('0x61')]=function(_0x3b66b6,_0x5674b7){return db['WhatsappAccount']['describe']()[_0x9374('0x34')](respondWithResult(_0x5674b7,null))[_0x9374('0x27')](handleError(_0x5674b7,null));};exports[_0x9374('0x62')]=function(_0x487128,_0x45ca0e,_0x18f738){if(_0x487128[_0x9374('0x5f')]['id']){delete _0x487128['body']['id'];}return db['WhatsappAccount'][_0x9374('0x58')]({'where':{'id':_0x487128[_0x9374('0x56')]['id']}})[_0x9374('0x34')](handleEntityNotFound(_0x45ca0e,null))['then'](function(_0x3607fe){if(_0x3607fe){_0x487128[_0x9374('0x5f')][_0x9374('0x63')]=_0x3607fe['id'];return db[_0x9374('0x64')]['create'](_0x487128[_0x9374('0x5f')]);}})[_0x9374('0x34')](respondWithResult(_0x45ca0e,null))['catch'](handleError(_0x45ca0e,null));};exports[_0x9374('0x65')]=function(_0x5433fe,_0x53d565,_0x41285a){var _0x24b1fc={'raw':![],'where':{}};var _0x56701c={};var _0x28951c={'count':0x0,'rows':[]};return db[_0x9374('0x51')][_0x9374('0x66')]({'where':{'id':_0x5433fe[_0x9374('0x56')]['id']}})[_0x9374('0x34')](handleEntityNotFound(_0x53d565,null))['then'](function(_0x55cd64){if(_0x55cd64){_0x56701c[_0x9374('0x41')]=_[_0x9374('0x43')](db['Disposition'][_0x9374('0x3e')]);_0x56701c[_0x9374('0x42')]=_[_0x9374('0x43')](_0x5433fe[_0x9374('0x42')]);_0x56701c[_0x9374('0x44')]=_[_0x9374('0x46')](_0x56701c[_0x9374('0x41')],_0x56701c[_0x9374('0x42')]);_0x24b1fc['attributes']=_[_0x9374('0x46')](_0x56701c[_0x9374('0x41')],qs['fields'](_0x5433fe['query']['fields']));_0x24b1fc['attributes']=_0x24b1fc[_0x9374('0x45')]['length']?_0x24b1fc[_0x9374('0x45')]:_0x56701c[_0x9374('0x41')];if(!_0x5433fe['query'][_0x9374('0x67')](_0x9374('0x68'))){_0x24b1fc[_0x9374('0x2d')]=qs[_0x9374('0x2d')](_0x5433fe[_0x9374('0x42')]['limit']);_0x24b1fc[_0x9374('0x2f')]=qs[_0x9374('0x2f')](_0x5433fe['query'][_0x9374('0x2f')]);}_0x24b1fc[_0x9374('0x49')]=qs['sort'](_0x5433fe[_0x9374('0x42')][_0x9374('0x4a')]);_0x24b1fc[_0x9374('0x4b')]=qs['filters'](_[_0x9374('0x4c')](_0x5433fe[_0x9374('0x42')],_0x56701c['filters']));_0x24b1fc['where'][_0x9374('0x63')]=_0x55cd64['id'];if(_0x5433fe[_0x9374('0x42')][_0x9374('0x4e')]){_0x24b1fc[_0x9374('0x4b')]=_[_0x9374('0x4f')](_0x24b1fc[_0x9374('0x4b')],{'$or':_[_0x9374('0x3d')](_0x24b1fc[_0x9374('0x45')],function(_0x144831){var _0x2d9575={};_0x2d9575[_0x144831]={'$like':'%'+_0x5433fe['query']['filter']+'%'};return _0x2d9575;})});}_0x24b1fc=_[_0x9374('0x4f')]({},_0x24b1fc,_0x5433fe['options']);return db[_0x9374('0x64')][_0x9374('0x2e')]({'where':_0x24b1fc[_0x9374('0x4b')]})[_0x9374('0x34')](function(_0x30571c){_0x28951c['count']=_0x30571c;if(_0x5433fe[_0x9374('0x42')][_0x9374('0x52')]){_0x24b1fc[_0x9374('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x9374('0x53')](_0x24b1fc);})[_0x9374('0x34')](function(_0x2dc089){_0x28951c[_0x9374('0x54')]=_0x2dc089;return _0x28951c;});}})[_0x9374('0x34')](respondWithFilteredResult(_0x53d565,_0x24b1fc))[_0x9374('0x27')](handleError(_0x53d565,null));};exports[_0x9374('0x69')]=function(_0x46fc51,_0x427060,_0x58751e){return db[_0x9374('0x51')][_0x9374('0x58')]({'where':{'id':_0x46fc51['params']['id']}})['then'](handleEntityNotFound(_0x427060,null))[_0x9374('0x34')](function(_0x804b6f){if(_0x804b6f){return _0x804b6f[_0x9374('0x69')](_0x46fc51[_0x9374('0x42')][_0x9374('0x6a')]);}})['then'](respondWithStatusCode(_0x427060,null))[_0x9374('0x27')](handleError(_0x427060,null));};exports['addAnswer']=function(_0x53fade,_0x35a44c,_0x35acec){if(_0x53fade[_0x9374('0x5f')]['id']){delete _0x53fade['body']['id'];}return db[_0x9374('0x51')]['find']({'where':{'id':_0x53fade[_0x9374('0x56')]['id']}})[_0x9374('0x34')](handleEntityNotFound(_0x35a44c,null))['then'](function(_0x1894a7){if(_0x1894a7){_0x53fade[_0x9374('0x5f')][_0x9374('0x63')]=_0x1894a7['id'];return db[_0x9374('0x6b')]['create'](_0x53fade[_0x9374('0x5f')]);}})[_0x9374('0x34')](respondWithResult(_0x35a44c,null))['catch'](handleError(_0x35a44c,null));};exports['getAnswers']=function(_0xf9f163,_0x2ede5b,_0x4c73ad){var _0xc83d4a={'raw':![],'where':{}};var _0x5dc2ea={};var _0x235c85={'count':0x0,'rows':[]};return db[_0x9374('0x51')][_0x9374('0x66')]({'where':{'id':_0xf9f163['params']['id']}})[_0x9374('0x34')](handleEntityNotFound(_0x2ede5b,null))[_0x9374('0x34')](function(_0x39540f){if(_0x39540f){_0x5dc2ea[_0x9374('0x41')]=_[_0x9374('0x43')](db[_0x9374('0x6b')]['rawAttributes']);_0x5dc2ea[_0x9374('0x42')]=_[_0x9374('0x43')](_0xf9f163[_0x9374('0x42')]);_0x5dc2ea[_0x9374('0x44')]=_['intersection'](_0x5dc2ea[_0x9374('0x41')],_0x5dc2ea[_0x9374('0x42')]);_0xc83d4a['attributes']=_[_0x9374('0x46')](_0x5dc2ea['model'],qs[_0x9374('0x47')](_0xf9f163['query'][_0x9374('0x47')]));_0xc83d4a[_0x9374('0x45')]=_0xc83d4a[_0x9374('0x45')]['length']?_0xc83d4a[_0x9374('0x45')]:_0x5dc2ea[_0x9374('0x41')];if(!_0xf9f163[_0x9374('0x42')][_0x9374('0x67')](_0x9374('0x68'))){_0xc83d4a[_0x9374('0x2d')]=qs[_0x9374('0x2d')](_0xf9f163[_0x9374('0x42')]['limit']);_0xc83d4a[_0x9374('0x2f')]=qs[_0x9374('0x2f')](_0xf9f163[_0x9374('0x42')][_0x9374('0x2f')]);}_0xc83d4a['order']=qs[_0x9374('0x4a')](_0xf9f163['query'][_0x9374('0x4a')]);_0xc83d4a[_0x9374('0x4b')]=qs[_0x9374('0x44')](_[_0x9374('0x4c')](_0xf9f163['query'],_0x5dc2ea[_0x9374('0x44')]));_0xc83d4a['where'][_0x9374('0x63')]=_0x39540f['id'];if(_0xf9f163[_0x9374('0x42')]['filter']){_0xc83d4a[_0x9374('0x4b')]=_['merge'](_0xc83d4a['where'],{'$or':_['map'](_0xc83d4a[_0x9374('0x45')],function(_0x3c4734){var _0x568cd5={};_0x568cd5[_0x3c4734]={'$like':'%'+_0xf9f163['query']['filter']+'%'};return _0x568cd5;})});}_0xc83d4a=_[_0x9374('0x4f')]({},_0xc83d4a,_0xf9f163[_0x9374('0x50')]);return db[_0x9374('0x6b')][_0x9374('0x2e')]({'where':_0xc83d4a[_0x9374('0x4b')]})[_0x9374('0x34')](function(_0xbbd80e){_0x235c85['count']=_0xbbd80e;if(_0xf9f163[_0x9374('0x42')]['includeAll']){_0xc83d4a[_0x9374('0x57')]=[{'all':!![]}];}return db[_0x9374('0x6b')]['findAll'](_0xc83d4a);})['then'](function(_0x456026){_0x235c85[_0x9374('0x54')]=_0x456026;return _0x235c85;});}})[_0x9374('0x34')](respondWithFilteredResult(_0x2ede5b,_0xc83d4a))[_0x9374('0x27')](handleError(_0x2ede5b,null));};exports[_0x9374('0x6c')]=function(_0x1df4af,_0x269545,_0x2eea1f){return db[_0x9374('0x51')][_0x9374('0x58')]({'where':{'id':_0x1df4af[_0x9374('0x56')]['id']}})[_0x9374('0x34')](handleEntityNotFound(_0x269545,null))['then'](function(_0x4c4062){if(_0x4c4062){return _0x4c4062[_0x9374('0x6c')](_0x1df4af[_0x9374('0x42')][_0x9374('0x6a')]);}})['then'](respondWithStatusCode(_0x269545,null))[_0x9374('0x27')](handleError(_0x269545,null));};exports[_0x9374('0x6d')]=function(_0x51544b,_0x74ca5f,_0x48425c){return db[_0x9374('0x51')][_0x9374('0x58')]({'where':{'id':_0x51544b[_0x9374('0x56')]['id']}})[_0x9374('0x34')](handleEntityNotFound(_0x74ca5f,null))['then'](function(_0x4c1114){if(_0x4c1114){return _0x4c1114['addAgents'](_0x51544b[_0x9374('0x5f')][_0x9374('0x6a')],_[_0x9374('0x6e')](_0x51544b[_0x9374('0x5f')],[_0x9374('0x6a'),'id'])||{})[_0x9374('0x6f')](function(_0x250b24){for(var _0x4d495f=0x0;_0x4d495f<_0x51544b[_0x9374('0x5f')][_0x9374('0x6a')][_0x9374('0x48')];_0x4d495f+=0x1){socket[_0x9374('0x70')](_0x9374('0x71'),{'UserId':Number(_0x51544b[_0x9374('0x5f')][_0x9374('0x6a')][_0x4d495f]),'WhatsappAccountId':Number(_0x51544b[_0x9374('0x56')]['id'])});}return _0x250b24;});}})[_0x9374('0x34')](respondWithResult(_0x74ca5f,null))[_0x9374('0x27')](handleError(_0x74ca5f,null));};exports[_0x9374('0x72')]=function(_0x21a36a,_0x808cd0,_0x30f1dd){return db[_0x9374('0x51')][_0x9374('0x58')]({'where':{'id':_0x21a36a[_0x9374('0x56')]['id']}})['then'](handleEntityNotFound(_0x808cd0,null))[_0x9374('0x34')](function(_0x156a88){if(_0x156a88){return _0x156a88[_0x9374('0x72')](_0x21a36a['query'][_0x9374('0x6a')])[_0x9374('0x34')](function(){if(_['isArray'](_0x21a36a[_0x9374('0x42')][_0x9374('0x6a')])){for(var _0x5e4f60=0x0;_0x5e4f60<_0x21a36a[_0x9374('0x42')][_0x9374('0x6a')][_0x9374('0x48')];_0x5e4f60+=0x1){socket[_0x9374('0x70')](_0x9374('0x73'),{'UserId':Number(_0x21a36a[_0x9374('0x42')][_0x9374('0x6a')][_0x5e4f60]),'WhatsappAccountId':Number(_0x21a36a[_0x9374('0x56')]['id'])});}}else{socket[_0x9374('0x70')](_0x9374('0x73'),{'UserId':Number(_0x21a36a['query']['ids']),'WhatsappAccountId':Number(_0x21a36a[_0x9374('0x56')]['id'])});}});}})[_0x9374('0x34')](respondWithStatusCode(_0x808cd0,null))[_0x9374('0x27')](handleError(_0x808cd0,null));};exports['getAgents']=function(_0xb98d21,_0x50f618,_0x590415){var _0x305255={};var _0x1701fa={};var _0x4452ee;var _0x5f568c;return db['WhatsappAccount'][_0x9374('0x66')]({'where':{'id':_0xb98d21[_0x9374('0x56')]['id']}})[_0x9374('0x34')](handleEntityNotFound(_0x50f618,null))['then'](function(_0x13eb86){if(_0x13eb86){_0x4452ee=_0x13eb86;_0x1701fa[_0x9374('0x41')]=_[_0x9374('0x43')](db[_0x9374('0x74')][_0x9374('0x3e')]);_0x1701fa[_0x9374('0x42')]=_[_0x9374('0x43')](_0xb98d21[_0x9374('0x42')]);_0x1701fa[_0x9374('0x44')]=_['intersection'](_0x1701fa[_0x9374('0x41')],_0x1701fa[_0x9374('0x42')]);_0x305255['attributes']=_[_0x9374('0x46')](_0x1701fa[_0x9374('0x41')],qs[_0x9374('0x47')](_0xb98d21[_0x9374('0x42')][_0x9374('0x47')]));_0x305255[_0x9374('0x45')]=_0x305255[_0x9374('0x45')][_0x9374('0x48')]?_0x305255[_0x9374('0x45')]:_0x1701fa[_0x9374('0x41')];_0x305255[_0x9374('0x49')]=qs[_0x9374('0x4a')](_0xb98d21[_0x9374('0x42')][_0x9374('0x4a')]);_0x305255[_0x9374('0x4b')]=qs[_0x9374('0x44')](_[_0x9374('0x4c')](_0xb98d21[_0x9374('0x42')],_0x1701fa[_0x9374('0x44')]));if(_0xb98d21['query'][_0x9374('0x4e')]){_0x305255[_0x9374('0x4b')]=_['merge'](_0x305255[_0x9374('0x4b')],{'$or':_[_0x9374('0x3d')](_0x305255[_0x9374('0x45')],function(_0xbd73a8){var _0x335b19={};_0x335b19[_0xbd73a8]={'$like':'%'+_0xb98d21[_0x9374('0x42')][_0x9374('0x4e')]+'%'};return _0x335b19;})});}_0x305255=_['merge']({},_0x305255,_0xb98d21[_0x9374('0x50')]);return _0x4452ee[_0x9374('0x75')](_0x305255);}})[_0x9374('0x34')](function(_0x3637fb){if(_0x3637fb){_0x5f568c=_0x3637fb[_0x9374('0x48')];if(!_0xb98d21[_0x9374('0x42')][_0x9374('0x67')](_0x9374('0x68'))){_0x305255[_0x9374('0x2d')]=qs['limit'](_0xb98d21[_0x9374('0x42')][_0x9374('0x2d')]);_0x305255[_0x9374('0x2f')]=qs[_0x9374('0x2f')](_0xb98d21[_0x9374('0x42')]['offset']);}return _0x4452ee[_0x9374('0x75')](_0x305255);}})[_0x9374('0x34')](function(_0x4ae9d9){if(_0x4ae9d9){return _0x4ae9d9?{'count':_0x5f568c,'rows':_0x4ae9d9}:null;}})[_0x9374('0x34')](respondWithResult(_0x50f618,null))[_0x9374('0x27')](handleError(_0x50f618,null));};exports[_0x9374('0x76')]=function(_0xcb4c13,_0x5b7466){var _0x505995=_0xcb4c13[_0x9374('0x56')]['id'];var _0x2de008=_0xcb4c13[_0x9374('0x5f')];var _0x41c528=0xc8;var _0x2575cc=null;return db[_0x9374('0x77')]['transaction']({'isolationLevel':db['sequelize'][_0x9374('0x78')][_0x9374('0x79')]['READ_COMMITTED']},function(_0x82f5d9){return db[_0x9374('0x51')][_0x9374('0x66')]({'where':{'id':_0x505995},'transaction':_0x82f5d9})[_0x9374('0x34')](function(_0x4b5415){if(_0x4b5415){return db['WhatsappApplication'][_0x9374('0x60')]({'where':{'WhatsappAccountId':_0x505995},'transaction':_0x82f5d9})['then'](function(){var _0x235327=_[_0x9374('0x3d')](_0x2de008,function(_0x534cb4){_0x534cb4['WhatsappAccountId']=_0x505995;return _0x534cb4;});return db[_0x9374('0x7a')]['bulkCreate'](_0x235327,{'transaction':_0x82f5d9});});}else{_0x41c528=0x194;_0x2575cc=[];}});})[_0x9374('0x34')](function(){if(_0x41c528!==0x194){return db[_0x9374('0x7a')][_0x9374('0x7b')]({'where':{'WhatsappAccountId':_0x505995},'order':'priority'})[_0x9374('0x34')](function(_0x3b7b58){_0x2575cc=_0x3b7b58;});}})[_0x9374('0x27')](function(_0x3edd7a){_0x41c528=0x1f4;logger[_0x9374('0x25')](_0x3edd7a['stack']);if(_0x3edd7a[_0x9374('0x39')]){delete _0x3edd7a[_0x9374('0x39')];}_0x2575cc=_0x3edd7a;})[_0x9374('0x7c')](function(){if(_0x2575cc===null){_0x5b7466[_0x9374('0x28')](_0x41c528);}else{if(_0x41c528===0x1f4){_0x5b7466[_0x9374('0x29')](_0x41c528)['send'](_0x2575cc);}else{_0x5b7466[_0x9374('0x29')](_0x41c528)[_0x9374('0x2b')](_0x2575cc);}}});};exports['getApplications']=function(_0x1d99bf,_0x203192,_0x26803d){var _0x5aa6f7={};var _0x535444={};var _0x483bd7;var _0x2df6bd;return db[_0x9374('0x51')]['findOne']({'where':{'id':_0x1d99bf['params']['id']}})[_0x9374('0x34')](handleEntityNotFound(_0x203192,null))[_0x9374('0x34')](function(_0x3620f5){if(_0x3620f5){_0x483bd7=_0x3620f5;_0x535444[_0x9374('0x41')]=_['keys'](db[_0x9374('0x7a')][_0x9374('0x3e')]);_0x535444[_0x9374('0x42')]=_[_0x9374('0x43')](_0x1d99bf[_0x9374('0x42')]);_0x535444['filters']=_['intersection'](_0x535444[_0x9374('0x41')],_0x535444[_0x9374('0x42')]);_0x5aa6f7[_0x9374('0x45')]=_[_0x9374('0x46')](_0x535444[_0x9374('0x41')],qs[_0x9374('0x47')](_0x1d99bf['query'][_0x9374('0x47')]));_0x5aa6f7[_0x9374('0x45')]=_0x5aa6f7[_0x9374('0x45')]['length']?_0x5aa6f7['attributes']:_0x535444[_0x9374('0x41')];_0x5aa6f7[_0x9374('0x49')]=qs['sort'](_0x1d99bf[_0x9374('0x42')][_0x9374('0x4a')]);_0x5aa6f7[_0x9374('0x4b')]=qs[_0x9374('0x44')](_[_0x9374('0x4c')](_0x1d99bf[_0x9374('0x42')],_0x535444[_0x9374('0x44')]));if(_0x1d99bf[_0x9374('0x42')][_0x9374('0x4e')]){_0x5aa6f7[_0x9374('0x4b')]=_[_0x9374('0x4f')](_0x5aa6f7[_0x9374('0x4b')],{'$or':_[_0x9374('0x3d')](_0x5aa6f7[_0x9374('0x45')],function(_0x5c1439){var _0x20700f={};_0x20700f[_0x5c1439]={'$like':'%'+_0x1d99bf['query'][_0x9374('0x4e')]+'%'};return _0x20700f;})});}_0x5aa6f7=_[_0x9374('0x4f')]({},_0x5aa6f7,_0x1d99bf[_0x9374('0x50')]);return _0x483bd7['getApplications'](_0x5aa6f7);}})['then'](function(_0x3878ef){if(_0x3878ef){_0x2df6bd=_0x3878ef[_0x9374('0x48')];if(!_0x1d99bf[_0x9374('0x42')]['hasOwnProperty'](_0x9374('0x68'))){_0x5aa6f7[_0x9374('0x2d')]=qs[_0x9374('0x2d')](_0x1d99bf['query']['limit']);_0x5aa6f7[_0x9374('0x2f')]=qs['offset'](_0x1d99bf[_0x9374('0x42')][_0x9374('0x2f')]);}return _0x483bd7['getApplications'](_0x5aa6f7);}})[_0x9374('0x34')](function(_0x42ced3){if(_0x42ced3){return _0x42ced3?{'count':_0x2df6bd,'rows':_0x42ced3}:null;}})[_0x9374('0x34')](respondWithResult(_0x203192,null))[_0x9374('0x27')](handleError(_0x203192,null));};exports['notify']=function(_0x2346aa,_0x16f4e4,_0x16987d){var _0x28bf3d={'channel':'whatsapp'};var _0x46ede6=[];var _0x1f3adf=[];var _0x46f7e2={};return db['WhatsappAccount'][_0x9374('0x58')]({'where':{'id':_0x2346aa[_0x9374('0x56')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x9374('0x7d')}]})[_0x9374('0x34')](handleEntityNotFound(_0x16f4e4,null))[_0x9374('0x34')](function(_0x1401a5){_0x28bf3d[_0x9374('0x7e')]=_0x1401a5;if(_0x28bf3d[_0x9374('0x7e')]&&_0x28bf3d[_0x9374('0x7e')]['type']===_0x9374('0x7f')&&_0x2346aa[_0x9374('0x5f')][_0x9374('0x80')]){if(_0x2346aa['body'][_0x9374('0x80')]['length']===0x0)return;if(_0x2346aa[_0x9374('0x5f')]['statuses'][0x0][_0x9374('0x81')]!==_0x9374('0x82'))return;return db[_0x9374('0x83')][_0x9374('0x84')]({'read':!![],'readAt':_0x2346aa[_0x9374('0x5f')]['statuses'][0x0][_0x9374('0x85')]},{'where':{'messageId':_0x2346aa[_0x9374('0x5f')][_0x9374('0x80')][0x0][_0x9374('0x86')]},'individualHooks':!![]})[_0x9374('0x34')](function(_0x189fc8){return _0x16f4e4[_0x9374('0x29')](0xc8)[_0x9374('0x2b')](_0x189fc8);});}_0x28bf3d[_0x9374('0x87')]=_[_0x9374('0x88')](_0x1401a5[_0x9374('0x7d')],['priority'],['asc']);if(_0x28bf3d[_0x9374('0x7e')]['Applications']){delete _0x28bf3d[_0x9374('0x7e')][_0x9374('0x7d')];}return db['CmContact'][_0x9374('0x61')]()[_0x9374('0x34')](function(_0x396680){if(!_0x396680){throw new db[(_0x9374('0x89'))][(_0x9374('0x8a'))](_0x9374('0x8b'));}_0x46ede6=_[_0x9374('0x8c')](_[_0x9374('0x43')](_0x396680),[_0x9374('0x8d'),_0x9374('0x8e')]);_0x1f3adf=_[_0x9374('0x8c')](_['keys'](_0x396680),[_0x9374('0x8d'),_0x9374('0x8e'),_0x9374('0x8f'),_0x9374('0x90')]);_0x28bf3d['body']={'mapKey':_0x9374('0x91')};if(_0x28bf3d[_0x9374('0x7e')]&&_0x28bf3d[_0x9374('0x7e')][_0x9374('0x3f')]===_0x9374('0x92')){_0x28bf3d[_0x9374('0x5f')]['from']=_0x2346aa[_0x9374('0x5f')][_0x9374('0x93')]['replace'](_0x9374('0x94'),'');_0x28bf3d[_0x9374('0x5f')][_0x9374('0x5f')]=_0x2346aa['body'][_0x9374('0x95')];_0x28bf3d[_0x9374('0x5f')][_0x9374('0x96')]=_0x2346aa[_0x9374('0x5f')]['MessageSid'];}if(_0x28bf3d['account']&&_0x28bf3d['account'][_0x9374('0x3f')]===_0x9374('0x7f')){_0x28bf3d[_0x9374('0x5f')][_0x9374('0x97')]=_0x2346aa[_0x9374('0x5f')][_0x9374('0x98')][0x0]['from'];_0x28bf3d[_0x9374('0x5f')][_0x9374('0x5f')]=_0x2346aa['body'][_0x9374('0x98')][0x0][_0x9374('0x26')]['body'];_0x28bf3d[_0x9374('0x5f')][_0x9374('0x96')]=_0x2346aa['body']['notifications'][0x0][_0x9374('0x86')];}if(_0x28bf3d['body']['id']){delete _0x28bf3d[_0x9374('0x5f')]['id'];}if(_[_0x9374('0x99')](_0x28bf3d[_0x9374('0x5f')]['from'])){throw new db[(_0x9374('0x89'))]['ValidationError'](_0x9374('0x9a'));}if(_[_0x9374('0x99')](_0x28bf3d[_0x9374('0x5f')]['body'])||_0x28bf3d[_0x9374('0x5f')]['body']===''){throw new db['Sequelize'][(_0x9374('0x8a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9374('0x99')](_0x28bf3d[_0x9374('0x5f')][_0x9374('0x9b')])){throw new db[(_0x9374('0x89'))][(_0x9374('0x8a'))](_0x9374('0x9c')+_0x1f3adf);}if(!_[_0x9374('0x9d')](_0x1f3adf,_0x28bf3d[_0x9374('0x5f')][_0x9374('0x9b')])){throw new db[(_0x9374('0x89'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1f3adf);}_0x46f7e2[_0x28bf3d[_0x9374('0x5f')]['mapKey']]=_0x28bf3d[_0x9374('0x5f')][_0x9374('0x97')];return db[_0x9374('0x9e')][_0x9374('0x58')]({'where':{'id':_0x28bf3d['account'][_0x9374('0x90')]},'include':[{'model':db[_0x9374('0x9f')],'as':_0x9374('0xa0'),'where':_0x46f7e2,'limit':0x1,'order':[['updatedAt',_0x9374('0xa1')]]}]});})[_0x9374('0x34')](handleEntityNotFound(_0x16f4e4,null))[_0x9374('0x34')](function(_0xd3bbeb){if(_0xd3bbeb){_0x28bf3d[_0x9374('0xa2')]=_[_0x9374('0x6e')](_0xd3bbeb,[_0x9374('0xa0')]);if(_0xd3bbeb['Contacts'][_0x9374('0x48')]){return _0xd3bbeb[_0x9374('0xa0')][0x0];}var _0x52c85d=_[_0x9374('0x17')](_0x28bf3d['body'],{'firstName':_0x28bf3d[_0x9374('0x5f')][_0x9374('0x97')],'ListId':_0xd3bbeb['id']});_0x52c85d[_0x28bf3d['body'][_0x9374('0x9b')]]=_0x28bf3d['body']['from'];return db[_0x9374('0x9f')]['create'](_0x52c85d,{'fields':_0x46ede6,'raw':!![]});}})[_0x9374('0x34')](handleEntityNotFound(_0x16f4e4,null))[_0x9374('0x34')](function(_0xb655b8){if(_0xb655b8){_0x28bf3d[_0x9374('0xa3')]=_0xb655b8;var _0x25a1c4={'ContactId':_0xb655b8['id'],'phone':_0x28bf3d[_0x9374('0x5f')]['from'],'WhatsappAccountId':_0x2346aa[_0x9374('0x56')]['id']};var _0x1de2bf={'ContactId':_0xb655b8['id'],'WhatsappAccountId':_0x2346aa['params']['id'],'closed':![]};return db['WhatsappInteraction'][_0x9374('0x58')]({'where':_0x1de2bf})['then'](function(_0x41cabf){if(_0x41cabf){return[_0x41cabf,![]];}return db[_0x9374('0xa4')]['create'](_0x25a1c4)['then'](function(_0x171fb8){return[_0x171fb8,!![]];});});}})[_0x9374('0x6f')](function(_0x582296,_0x53b36a){_0x28bf3d['interaction']=_0x582296[_0x9374('0x35')]({'plain':!![]});_0x28bf3d['interaction'][_0x9374('0xa5')]=![];if(_0x53b36a){if(_0x28bf3d[_0x9374('0x7e')][_0x9374('0xa6')]){_0x28bf3d[_0x9374('0x87')][_0x9374('0xa7')]({'id':0x0,'priority':_0x28bf3d[_0x9374('0x87')][_0x9374('0x48')]+0x1,'app':_0x9374('0xa8'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x28bf3d[_0x9374('0xa9')]['created']=!![];}return db[_0x9374('0x83')]['create']({'phone':_0x28bf3d[_0x9374('0x5f')][_0x9374('0x97')],'messageId':_0x28bf3d['body'][_0x9374('0x96')],'body':_0x28bf3d[_0x9374('0x5f')]['body'],'WhatsappAccountId':_0x2346aa[_0x9374('0x56')]['id'],'WhatsappInteractionId':_0x582296['id'],'direction':'in','ContactId':_0x582296['ContactId'],'AttachmentId':_0x28bf3d[_0x9374('0x5f')][_0x9374('0xaa')]});})[_0x9374('0x34')](function(_0x3f5823){_0x28bf3d[_0x9374('0x26')]=_0x3f5823;if(_0x28bf3d[_0x9374('0xa9')][_0x9374('0xab')]){return db[_0x9374('0x74')]['find']({'attributes':['id','name'],'where':{'id':_0x28bf3d['interaction']['UserId']}})[_0x9374('0x34')](function(_0x1f7e87){if(_0x1f7e87){_0x28bf3d[_0x9374('0x87')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1f7e87[_0x9374('0x39')]+','+(_0x28bf3d[_0x9374('0x7e')]['waitForTheAssignedAgent']||0xa),'interval':_0x9374('0xac')});}return respondWithRpcPromise(_0x9374('0xad'),_0x9374('0xae'),_0x28bf3d);});}return respondWithRpcPromise(_0x9374('0xad'),_0x9374('0xae'),_0x28bf3d);})['then'](function(_0x34c39d){if(_0x34c39d){var _0x177c06=0xc8;var _0x5930fc='receiveMessage';logger[_0x9374('0x1f')](_0x9374('0x22'),_0x5930fc,_0x177c06,'entity\x20found');logger[_0x9374('0x21')](_0x9374('0xaf'),_0x5930fc,_0x177c06,_0x9374('0xb0'),JSON['stringify'](_0x34c39d));if(_0x28bf3d[_0x9374('0x7e')][_0x9374('0x3f')]==='twilio'){return _0x16f4e4[_0x9374('0x29')](_0x177c06)[_0x9374('0x30')](_0x9374('0xb1'),_0x9374('0xb2'))['send'](_0x9374('0xb3'));}else{return _0x16f4e4[_0x9374('0x29')](_0x177c06)[_0x9374('0x2b')](_0x34c39d);}}});})['catch'](handleError(_0x16f4e4,null));};exports[_0x9374('0xb4')]=function(_0x46d455,_0x419101,_0x19f22f){var _0x128cc8,_0x290031,_0x1109c5;if(_[_0x9374('0x99')](_0x46d455['body'][_0x9374('0x5f')])||_0x46d455['body']['body']===''){throw new db[(_0x9374('0x89'))][(_0x9374('0x8a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x9374('0x99')](_0x46d455[_0x9374('0x5f')]['to'])){throw new db[(_0x9374('0x89'))]['ValidationError'](_0x9374('0xb5'));}_0x128cc8=_0x46d455[_0x9374('0x5f')]['to'];return db['WhatsappAccount'][_0x9374('0x58')]({'where':{'id':_0x46d455[_0x9374('0x56')]['id']},'include':[{'model':db[_0x9374('0x9e')],'as':'List','include':[{'model':db[_0x9374('0x9f')],'as':_0x9374('0xa0'),'where':{'mobile':_0x128cc8},'limit':0x1,'order':[[_0x9374('0x8e'),_0x9374('0xa1')]]}]}]})['then'](handleEntityNotFound(_0x419101,null))[_0x9374('0x34')](function(_0x35c388){if(_0x35c388&&_0x35c388['List']){_0x290031=_0x35c388[_0x9374('0x35')]({'plain':!![]});if(_0x290031['List']&&_0x290031[_0x9374('0xb6')][_0x9374('0xa0')][_0x9374('0x48')]){return _0x290031[_0x9374('0xb6')][_0x9374('0xa0')][0x0];}return db[_0x9374('0x9f')][_0x9374('0x59')](_['defaults'](_0x46d455['body'],{'firstName':_0x128cc8,'mobile':_0x128cc8,'phone':_0x128cc8,'ListId':_0x290031[_0x9374('0x90')]}));}})[_0x9374('0x34')](handleEntityNotFound(_0x419101,null))[_0x9374('0x34')](function(_0x22a9dd){if(_0x22a9dd){_0x1109c5=_0x22a9dd;return db[_0x9374('0xa4')][_0x9374('0x58')]({'where':{'ContactId':_0x1109c5['id'],'closed':![],'WhatsappAccountId':_0x290031['id']}})[_0x9374('0x34')](function(_0x275d28){if(_0x275d28){return[_0x275d28,![]];}return db[_0x9374('0xa4')][_0x9374('0x59')]({'UserId':_0x46d455[_0x9374('0x5a')]['id'],'ContactId':_0x1109c5['id'],'WhatsappAccountId':_0x290031['id'],'phone':_0x128cc8,'firstMsgDirection':_0x9374('0xb7'),'Messages':[_[_0x9374('0x4f')](_0x46d455[_0x9374('0x5f')],{'read':![],'body':_0x46d455[_0x9374('0x5f')]['body'],'phone':_0x128cc8,'WhatsappAccountId':_0x290031['id'],'UserId':_0x46d455[_0x9374('0x5a')]['id'],'ContactId':_0x1109c5['id']})]},{'include':[{'model':db[_0x9374('0x83')],'as':'Messages'}]})[_0x9374('0x34')](function(_0x537b8d){return[_0x537b8d,!![]];});});}})['spread'](function(_0x350a5c,_0x2f8bff){if(_0x2f8bff){return _0x350a5c;}return db[_0x9374('0x83')]['create'](_[_0x9374('0x4f')](_0x46d455[_0x9374('0x5f')],{'read':![],'body':_0x46d455[_0x9374('0x5f')]['body'],'phone':_0x128cc8,'WhatsappAccountId':_0x290031['id'],'WhatsappInteractionId':_0x350a5c['id'],'UserId':_0x46d455[_0x9374('0x5a')]['id'],'ContactId':_0x1109c5['id']}))[_0x9374('0x34')](function(_0x120b4c){_0x350a5c[_0x9374('0xb8')][_0x9374('0xb9')]=[];_0x350a5c[_0x9374('0xb8')][_0x9374('0xb9')][_0x9374('0xa7')](_0x120b4c[_0x9374('0xb8')]);return _0x350a5c;});})[_0x9374('0x34')](respondWithResult(_0x419101,null))['catch'](handleError(_0x419101,null));}; \ No newline at end of file +var _0x1c53=['error','code','message','result','catch','status','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','filter','VIRTUAL','merge','options','WhatsappAccount','includeAll','include','findAll','rows','params','Pause','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','rawAttributes','nolimit','sort','removeDispositions','addAnswer','find','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','omit','emit','removeAgents','userWhatsappAccount:remove','getAgents','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','ListId','twilio','from','From','whatsapp:','Body','messageId','notifications','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','DESC','list','Contacts','WhatsappInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','startRouting','Start','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','CmList','updatedAt','List','out','dataValues','Messages','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1c4af8,_0x3d076c){var _0x5c07ec=function(_0x1902ce){while(--_0x1902ce){_0x1c4af8['push'](_0x1c4af8['shift']());}};_0x5c07ec(++_0x3d076c);}(_0x1c53,0x9b));var _0x31c5=function(_0x222e27,_0x52e835){_0x222e27=_0x222e27-0x0;var _0xc79276=_0x1c53[_0x222e27];return _0xc79276;};'use strict';var emlformat=require(_0x31c5('0x0'));var rimraf=require(_0x31c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x31c5('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x31c5('0x3'));var Mustache=require(_0x31c5('0x4'));var util=require(_0x31c5('0x5'));var path=require(_0x31c5('0x6'));var sox=require(_0x31c5('0x7'));var csv=require(_0x31c5('0x8'));var ejs=require(_0x31c5('0x9'));var fs=require('fs');var fs_extra=require(_0x31c5('0xa'));var _=require(_0x31c5('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x31c5('0xc'));var deskjs=require(_0x31c5('0xd'));var toCsv=require(_0x31c5('0x8'));var querystring=require(_0x31c5('0xe'));var Papa=require(_0x31c5('0xf'));var Redis=require(_0x31c5('0x10'));var authService=require(_0x31c5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x31c5('0x12'));var hardwareService=require(_0x31c5('0x13'));var logger=require(_0x31c5('0x14'))('api');var utils=require(_0x31c5('0x15'));var config=require(_0x31c5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x31c5('0x17'))['db'];config[_0x31c5('0x18')]=_[_0x31c5('0x19')](config[_0x31c5('0x18')],{'host':_0x31c5('0x1a'),'port':0x18eb});var socket=require(_0x31c5('0x1b'))(new Redis(config['redis']));require(_0x31c5('0x1c'))[_0x31c5('0x1d')](socket);var jayson=require(_0x31c5('0x1e'));var client=jayson[_0x31c5('0x1f')][_0x31c5('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x1b5b19,_0x3d5fbf,_0x1fd76e,_0x307805){return new BPromise(function(_0x2841ef,_0x3a55e1){var _0x46644d=_0x307805||client;return _0x46644d[_0x31c5('0x21')](_0x1b5b19,_0x1fd76e)[_0x31c5('0x22')](function(_0x2d3128){logger['info'](_0x31c5('0x23'),_0x3d5fbf,_0x31c5('0x24'));logger[_0x31c5('0x25')](_0x31c5('0x26'),_0x3d5fbf,_0x31c5('0x24'),JSON[_0x31c5('0x27')](_0x2d3128));if(_0x2d3128[_0x31c5('0x28')]){if(_0x2d3128[_0x31c5('0x28')][_0x31c5('0x29')]===0x1f4){logger[_0x31c5('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x3d5fbf,_0x2d3128[_0x31c5('0x28')][_0x31c5('0x2a')]);return _0x3a55e1(_0x2d3128[_0x31c5('0x28')][_0x31c5('0x2a')]);}logger[_0x31c5('0x28')](_0x31c5('0x23'),_0x3d5fbf,_0x2d3128[_0x31c5('0x28')][_0x31c5('0x2a')]);return _0x2841ef(_0x2d3128['error'][_0x31c5('0x2a')]);}else{logger['info'](_0x31c5('0x23'),_0x3d5fbf,_0x31c5('0x24'));_0x2841ef(_0x2d3128[_0x31c5('0x2b')][_0x31c5('0x2a')]);}})[_0x31c5('0x2c')](function(_0x4a514f){logger[_0x31c5('0x28')](_0x31c5('0x23'),_0x3d5fbf,_0x4a514f);_0x3a55e1(_0x4a514f);});});}function respondWithStatusCode(_0x22c2f1,_0x5aa142){_0x5aa142=_0x5aa142||0xcc;return function(_0x1faabf){if(_0x1faabf){return _0x22c2f1['sendStatus'](_0x5aa142);}return _0x22c2f1[_0x31c5('0x2d')](_0x5aa142)['end']();};}function respondWithResult(_0x284d3b,_0x26349b){_0x26349b=_0x26349b||0xc8;return function(_0x248d4d){if(_0x248d4d){return _0x284d3b[_0x31c5('0x2d')](_0x26349b)[_0x31c5('0x2e')](_0x248d4d);}};}function respondWithFilteredResult(_0xd75c7e,_0x343532){return function(_0x59d752){if(_0x59d752){var _0x49ad0c=typeof _0x343532['offset']===_0x31c5('0x2f')&&typeof _0x343532[_0x31c5('0x30')]==='undefined';var _0x460d10=_0x59d752[_0x31c5('0x31')];var _0x5ce648=_0x49ad0c?0x0:_0x343532[_0x31c5('0x32')];var _0x235adb=_0x49ad0c?_0x59d752['count']:_0x343532[_0x31c5('0x32')]+_0x343532['limit'];var _0x2fb7f5;if(_0x235adb>=_0x460d10){_0x235adb=_0x460d10;_0x2fb7f5=0xc8;}else{_0x2fb7f5=0xce;}_0xd75c7e['status'](_0x2fb7f5);return _0xd75c7e[_0x31c5('0x33')]('Content-Range',_0x5ce648+'-'+_0x235adb+'/'+_0x460d10)[_0x31c5('0x2e')](_0x59d752);}return null;};}function patchUpdates(_0x2981b9){return function(_0x5cdaf1){try{jsonpatch[_0x31c5('0x34')](_0x5cdaf1,_0x2981b9,!![]);}catch(_0x3e4f86){return BPromise[_0x31c5('0x35')](_0x3e4f86);}return _0x5cdaf1[_0x31c5('0x36')]();};}function saveUpdates(_0x868a2a,_0x2595b7){return function(_0x3dd57c){if(_0x3dd57c){return _0x3dd57c[_0x31c5('0x37')](_0x868a2a)['then'](function(_0x5bc98e){return _0x5bc98e;});}return null;};}function removeEntity(_0x226d98,_0x2028d7){return function(_0x50305c){if(_0x50305c){return _0x50305c[_0x31c5('0x38')]()['then'](function(){var _0x54e60c=_0x50305c[_0x31c5('0x39')]({'plain':!![]});var _0x368941=_0x31c5('0x3a');return db[_0x31c5('0x3b')]['destroy']({'where':{'type':_0x368941,'resourceId':_0x54e60c['id']}})['then'](function(){return _0x50305c;});})[_0x31c5('0x22')](function(){_0x226d98['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2958c5,_0x39b513){return function(_0x3aae66){if(!_0x3aae66){_0x2958c5[_0x31c5('0x3c')](0x194);}return _0x3aae66;};}function handleError(_0x2a0b27,_0x19da41){_0x19da41=_0x19da41||0x1f4;return function(_0xc68844){logger[_0x31c5('0x28')](_0xc68844[_0x31c5('0x3d')]);if(_0xc68844[_0x31c5('0x3e')]){delete _0xc68844[_0x31c5('0x3e')];}_0x2a0b27[_0x31c5('0x2d')](_0x19da41)[_0x31c5('0x3f')](_0xc68844);};}exports[_0x31c5('0x40')]=function(_0x5dce37,_0x38f0c7){var _0x1a5d2e={'include':[{'model':db['Pause'],'as':_0x31c5('0x41')}]},_0x4ccaa7={},_0x1adf8a={'count':0x0,'rows':[]};var _0xe782ef=_[_0x31c5('0x42')](db['WhatsappAccount']['rawAttributes'],function(_0x100b10){return{'name':_0x100b10[_0x31c5('0x43')],'type':_0x100b10[_0x31c5('0x44')][_0x31c5('0x45')]};});_0x4ccaa7['model']=_[_0x31c5('0x42')](_0xe782ef,_0x31c5('0x3e'));_0x4ccaa7['query']=_[_0x31c5('0x46')](_0x5dce37[_0x31c5('0x47')]);_0x4ccaa7[_0x31c5('0x48')]=_['intersection'](_0x4ccaa7[_0x31c5('0x49')],_0x4ccaa7[_0x31c5('0x47')]);_0x1a5d2e[_0x31c5('0x4a')]=_[_0x31c5('0x4b')](_0x4ccaa7[_0x31c5('0x49')],qs['fields'](_0x5dce37[_0x31c5('0x47')][_0x31c5('0x4c')]));_0x1a5d2e[_0x31c5('0x4a')]=_0x1a5d2e[_0x31c5('0x4a')][_0x31c5('0x4d')]?_0x1a5d2e[_0x31c5('0x4a')]:_0x4ccaa7[_0x31c5('0x49')];if(!_0x5dce37[_0x31c5('0x47')][_0x31c5('0x4e')]('nolimit')){_0x1a5d2e[_0x31c5('0x30')]=qs[_0x31c5('0x30')](_0x5dce37[_0x31c5('0x47')][_0x31c5('0x30')]);_0x1a5d2e[_0x31c5('0x32')]=qs[_0x31c5('0x32')](_0x5dce37[_0x31c5('0x47')][_0x31c5('0x32')]);}_0x1a5d2e[_0x31c5('0x4f')]=qs['sort'](_0x5dce37[_0x31c5('0x47')]['sort']);_0x1a5d2e[_0x31c5('0x50')]=qs[_0x31c5('0x48')](_[_0x31c5('0x51')](_0x5dce37[_0x31c5('0x47')],_0x4ccaa7[_0x31c5('0x48')]),_0xe782ef);if(_0x5dce37['query'][_0x31c5('0x52')]){_0x1a5d2e[_0x31c5('0x50')]=_['merge'](_0x1a5d2e[_0x31c5('0x50')],{'$or':_[_0x31c5('0x42')](_0xe782ef,function(_0x1650e7){if(_0x1650e7[_0x31c5('0x44')]!==_0x31c5('0x53')){var _0x5934e2={};_0x5934e2[_0x1650e7[_0x31c5('0x3e')]]={'$like':'%'+_0x5dce37[_0x31c5('0x47')][_0x31c5('0x52')]+'%'};return _0x5934e2;}})});}_0x1a5d2e=_[_0x31c5('0x54')]({},_0x1a5d2e,_0x5dce37[_0x31c5('0x55')]);var _0x2b8539={'where':_0x1a5d2e[_0x31c5('0x50')]};return db[_0x31c5('0x56')][_0x31c5('0x31')](_0x2b8539)[_0x31c5('0x22')](function(_0x1168a0){_0x1adf8a['count']=_0x1168a0;if(_0x5dce37[_0x31c5('0x47')][_0x31c5('0x57')]){_0x1a5d2e[_0x31c5('0x58')]=[{'all':!![]}];}return db[_0x31c5('0x56')][_0x31c5('0x59')](_0x1a5d2e);})[_0x31c5('0x22')](function(_0xd5536f){_0x1adf8a[_0x31c5('0x5a')]=_0xd5536f;return _0x1adf8a;})['then'](respondWithFilteredResult(_0x38f0c7,_0x1a5d2e))[_0x31c5('0x2c')](handleError(_0x38f0c7,null));};exports['show']=function(_0x5bd2d5,_0xfd5a5d){var _0x36fe2a={'raw':![],'where':{'id':_0x5bd2d5[_0x31c5('0x5b')]['id']},'include':[{'model':db[_0x31c5('0x5c')],'as':_0x31c5('0x41')}]},_0x267ac8={};_0x267ac8[_0x31c5('0x49')]=_[_0x31c5('0x46')](db[_0x31c5('0x56')]['rawAttributes']);_0x267ac8[_0x31c5('0x47')]=_['keys'](_0x5bd2d5[_0x31c5('0x47')]);_0x267ac8[_0x31c5('0x48')]=_[_0x31c5('0x4b')](_0x267ac8[_0x31c5('0x49')],_0x267ac8[_0x31c5('0x47')]);_0x36fe2a[_0x31c5('0x4a')]=_[_0x31c5('0x4b')](_0x267ac8[_0x31c5('0x49')],qs[_0x31c5('0x4c')](_0x5bd2d5['query'][_0x31c5('0x4c')]));_0x36fe2a[_0x31c5('0x4a')]=_0x36fe2a[_0x31c5('0x4a')][_0x31c5('0x4d')]?_0x36fe2a[_0x31c5('0x4a')]:_0x267ac8['model'];if(_0x5bd2d5[_0x31c5('0x47')][_0x31c5('0x57')]){_0x36fe2a[_0x31c5('0x58')]=[{'all':!![]}];}_0x36fe2a=_[_0x31c5('0x54')]({},_0x36fe2a,_0x5bd2d5[_0x31c5('0x55')]);return db[_0x31c5('0x56')]['find'](_0x36fe2a)['then'](handleEntityNotFound(_0xfd5a5d,null))['then'](respondWithResult(_0xfd5a5d,null))[_0x31c5('0x2c')](handleError(_0xfd5a5d,null));};exports[_0x31c5('0x5d')]=function(_0x5d5ba7,_0x22e8d0){return db['WhatsappAccount'][_0x31c5('0x5d')](_0x5d5ba7[_0x31c5('0x5e')],{})[_0x31c5('0x22')](function(_0x24a481){var _0x3ce466=_0x5d5ba7['user'][_0x31c5('0x39')]({'plain':!![]});if(!_0x3ce466)throw new Error(_0x31c5('0x5f'));if(_0x3ce466[_0x31c5('0x60')]===_0x31c5('0x61')){var _0x1295f5=_0x24a481[_0x31c5('0x39')]({'plain':!![]});var _0x23a122=_0x31c5('0x3a');return db[_0x31c5('0x62')]['find']({'where':{'name':_0x23a122,'userProfileId':_0x3ce466['userProfileId']},'raw':!![]})[_0x31c5('0x22')](function(_0xfe2f72){if(_0xfe2f72&&_0xfe2f72[_0x31c5('0x63')]===0x0){return db['UserProfileResource'][_0x31c5('0x5d')]({'name':_0x1295f5[_0x31c5('0x3e')],'resourceId':_0x1295f5['id'],'type':_0xfe2f72[_0x31c5('0x3e')],'sectionId':_0xfe2f72['id']},{})[_0x31c5('0x22')](function(){return _0x24a481;});}else{return _0x24a481;}})[_0x31c5('0x2c')](function(_0x1ab850){logger[_0x31c5('0x28')](_0x31c5('0x64'),_0x1ab850);throw _0x1ab850;});}return _0x24a481;})[_0x31c5('0x22')](respondWithResult(_0x22e8d0,0xc9))['catch'](handleError(_0x22e8d0,null));};exports['update']=function(_0x3ecbb7,_0x39c26f){if(_0x3ecbb7[_0x31c5('0x5e')]['id']){delete _0x3ecbb7[_0x31c5('0x5e')]['id'];}return db[_0x31c5('0x56')]['find']({'where':{'id':_0x3ecbb7['params']['id']},'include':[{'model':db[_0x31c5('0x5c')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x39c26f,null))[_0x31c5('0x22')](saveUpdates(_0x3ecbb7[_0x31c5('0x5e')],null))[_0x31c5('0x22')](respondWithResult(_0x39c26f,null))[_0x31c5('0x2c')](handleError(_0x39c26f,null));};exports['destroy']=function(_0x15a86e,_0x417798){return db[_0x31c5('0x56')]['find']({'where':{'id':_0x15a86e[_0x31c5('0x5b')]['id']}})[_0x31c5('0x22')](handleEntityNotFound(_0x417798,null))[_0x31c5('0x22')](removeEntity(_0x417798,null))[_0x31c5('0x2c')](handleError(_0x417798,null));};exports[_0x31c5('0x65')]=function(_0x528b79,_0x5481be){return db['WhatsappAccount'][_0x31c5('0x65')]()[_0x31c5('0x22')](respondWithResult(_0x5481be,null))[_0x31c5('0x2c')](handleError(_0x5481be,null));};exports[_0x31c5('0x66')]=function(_0x433ca7,_0x5eafe7,_0x27f920){if(_0x433ca7[_0x31c5('0x5e')]['id']){delete _0x433ca7[_0x31c5('0x5e')]['id'];}return db[_0x31c5('0x56')]['find']({'where':{'id':_0x433ca7[_0x31c5('0x5b')]['id']}})[_0x31c5('0x22')](handleEntityNotFound(_0x5eafe7,null))[_0x31c5('0x22')](function(_0x16e2ec){if(_0x16e2ec){_0x433ca7[_0x31c5('0x5e')][_0x31c5('0x67')]=_0x16e2ec['id'];return db[_0x31c5('0x68')][_0x31c5('0x5d')](_0x433ca7[_0x31c5('0x5e')]);}})[_0x31c5('0x22')](respondWithResult(_0x5eafe7,null))[_0x31c5('0x2c')](handleError(_0x5eafe7,null));};exports[_0x31c5('0x69')]=function(_0x13a887,_0x207710,_0x5327f7){var _0x141f23={'raw':![],'where':{}};var _0x13533b={};var _0x31a44d={'count':0x0,'rows':[]};return db[_0x31c5('0x56')][_0x31c5('0x6a')]({'where':{'id':_0x13a887[_0x31c5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x207710,null))['then'](function(_0x598d01){if(_0x598d01){_0x13533b[_0x31c5('0x49')]=_[_0x31c5('0x46')](db[_0x31c5('0x68')][_0x31c5('0x6b')]);_0x13533b[_0x31c5('0x47')]=_['keys'](_0x13a887[_0x31c5('0x47')]);_0x13533b['filters']=_[_0x31c5('0x4b')](_0x13533b[_0x31c5('0x49')],_0x13533b[_0x31c5('0x47')]);_0x141f23[_0x31c5('0x4a')]=_['intersection'](_0x13533b['model'],qs[_0x31c5('0x4c')](_0x13a887[_0x31c5('0x47')][_0x31c5('0x4c')]));_0x141f23['attributes']=_0x141f23['attributes'][_0x31c5('0x4d')]?_0x141f23['attributes']:_0x13533b[_0x31c5('0x49')];if(!_0x13a887['query'][_0x31c5('0x4e')](_0x31c5('0x6c'))){_0x141f23[_0x31c5('0x30')]=qs[_0x31c5('0x30')](_0x13a887[_0x31c5('0x47')][_0x31c5('0x30')]);_0x141f23[_0x31c5('0x32')]=qs[_0x31c5('0x32')](_0x13a887[_0x31c5('0x47')][_0x31c5('0x32')]);}_0x141f23['order']=qs[_0x31c5('0x6d')](_0x13a887[_0x31c5('0x47')][_0x31c5('0x6d')]);_0x141f23[_0x31c5('0x50')]=qs[_0x31c5('0x48')](_[_0x31c5('0x51')](_0x13a887[_0x31c5('0x47')],_0x13533b[_0x31c5('0x48')]));_0x141f23['where']['WhatsappAccountId']=_0x598d01['id'];if(_0x13a887[_0x31c5('0x47')]['filter']){_0x141f23['where']=_[_0x31c5('0x54')](_0x141f23[_0x31c5('0x50')],{'$or':_[_0x31c5('0x42')](_0x141f23[_0x31c5('0x4a')],function(_0x5a696d){var _0x32c171={};_0x32c171[_0x5a696d]={'$like':'%'+_0x13a887[_0x31c5('0x47')][_0x31c5('0x52')]+'%'};return _0x32c171;})});}_0x141f23=_[_0x31c5('0x54')]({},_0x141f23,_0x13a887[_0x31c5('0x55')]);return db[_0x31c5('0x68')][_0x31c5('0x31')]({'where':_0x141f23[_0x31c5('0x50')]})[_0x31c5('0x22')](function(_0x5b29b2){_0x31a44d[_0x31c5('0x31')]=_0x5b29b2;if(_0x13a887['query'][_0x31c5('0x57')]){_0x141f23['include']=[{'all':!![]}];}return db[_0x31c5('0x68')][_0x31c5('0x59')](_0x141f23);})[_0x31c5('0x22')](function(_0x209e3d){_0x31a44d[_0x31c5('0x5a')]=_0x209e3d;return _0x31a44d;});}})[_0x31c5('0x22')](respondWithFilteredResult(_0x207710,_0x141f23))[_0x31c5('0x2c')](handleError(_0x207710,null));};exports[_0x31c5('0x6e')]=function(_0x143bb6,_0x52f797,_0x5ce0f5){return db[_0x31c5('0x56')]['find']({'where':{'id':_0x143bb6[_0x31c5('0x5b')]['id']}})[_0x31c5('0x22')](handleEntityNotFound(_0x52f797,null))[_0x31c5('0x22')](function(_0x1ff0b6){if(_0x1ff0b6){return _0x1ff0b6[_0x31c5('0x6e')](_0x143bb6[_0x31c5('0x47')]['ids']);}})[_0x31c5('0x22')](respondWithStatusCode(_0x52f797,null))[_0x31c5('0x2c')](handleError(_0x52f797,null));};exports[_0x31c5('0x6f')]=function(_0x21a515,_0x2cf39a,_0x43be80){if(_0x21a515[_0x31c5('0x5e')]['id']){delete _0x21a515['body']['id'];}return db[_0x31c5('0x56')][_0x31c5('0x70')]({'where':{'id':_0x21a515[_0x31c5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2cf39a,null))[_0x31c5('0x22')](function(_0x15bee4){if(_0x15bee4){_0x21a515[_0x31c5('0x5e')]['WhatsappAccountId']=_0x15bee4['id'];return db[_0x31c5('0x71')][_0x31c5('0x5d')](_0x21a515[_0x31c5('0x5e')]);}})[_0x31c5('0x22')](respondWithResult(_0x2cf39a,null))[_0x31c5('0x2c')](handleError(_0x2cf39a,null));};exports[_0x31c5('0x72')]=function(_0x2cc662,_0x4e1c48,_0x92d642){var _0x544721={'raw':![],'where':{}};var _0x1e162c={};var _0x495cba={'count':0x0,'rows':[]};return db[_0x31c5('0x56')][_0x31c5('0x6a')]({'where':{'id':_0x2cc662['params']['id']}})[_0x31c5('0x22')](handleEntityNotFound(_0x4e1c48,null))[_0x31c5('0x22')](function(_0x507161){if(_0x507161){_0x1e162c['model']=_[_0x31c5('0x46')](db['CannedAnswer'][_0x31c5('0x6b')]);_0x1e162c[_0x31c5('0x47')]=_[_0x31c5('0x46')](_0x2cc662[_0x31c5('0x47')]);_0x1e162c[_0x31c5('0x48')]=_[_0x31c5('0x4b')](_0x1e162c['model'],_0x1e162c[_0x31c5('0x47')]);_0x544721[_0x31c5('0x4a')]=_[_0x31c5('0x4b')](_0x1e162c[_0x31c5('0x49')],qs['fields'](_0x2cc662[_0x31c5('0x47')][_0x31c5('0x4c')]));_0x544721['attributes']=_0x544721[_0x31c5('0x4a')][_0x31c5('0x4d')]?_0x544721[_0x31c5('0x4a')]:_0x1e162c['model'];if(!_0x2cc662['query'][_0x31c5('0x4e')](_0x31c5('0x6c'))){_0x544721['limit']=qs['limit'](_0x2cc662[_0x31c5('0x47')][_0x31c5('0x30')]);_0x544721['offset']=qs[_0x31c5('0x32')](_0x2cc662['query'][_0x31c5('0x32')]);}_0x544721[_0x31c5('0x4f')]=qs[_0x31c5('0x6d')](_0x2cc662['query'][_0x31c5('0x6d')]);_0x544721[_0x31c5('0x50')]=qs[_0x31c5('0x48')](_[_0x31c5('0x51')](_0x2cc662[_0x31c5('0x47')],_0x1e162c[_0x31c5('0x48')]));_0x544721[_0x31c5('0x50')]['WhatsappAccountId']=_0x507161['id'];if(_0x2cc662[_0x31c5('0x47')][_0x31c5('0x52')]){_0x544721[_0x31c5('0x50')]=_[_0x31c5('0x54')](_0x544721[_0x31c5('0x50')],{'$or':_[_0x31c5('0x42')](_0x544721['attributes'],function(_0x57a506){var _0x93139f={};_0x93139f[_0x57a506]={'$like':'%'+_0x2cc662[_0x31c5('0x47')]['filter']+'%'};return _0x93139f;})});}_0x544721=_[_0x31c5('0x54')]({},_0x544721,_0x2cc662[_0x31c5('0x55')]);return db['CannedAnswer'][_0x31c5('0x31')]({'where':_0x544721[_0x31c5('0x50')]})[_0x31c5('0x22')](function(_0x5d5701){_0x495cba[_0x31c5('0x31')]=_0x5d5701;if(_0x2cc662[_0x31c5('0x47')][_0x31c5('0x57')]){_0x544721[_0x31c5('0x58')]=[{'all':!![]}];}return db[_0x31c5('0x71')]['findAll'](_0x544721);})['then'](function(_0x42ddeb){_0x495cba[_0x31c5('0x5a')]=_0x42ddeb;return _0x495cba;});}})[_0x31c5('0x22')](respondWithFilteredResult(_0x4e1c48,_0x544721))['catch'](handleError(_0x4e1c48,null));};exports[_0x31c5('0x73')]=function(_0x42e5be,_0x545074,_0x4677dc){return db['WhatsappAccount'][_0x31c5('0x70')]({'where':{'id':_0x42e5be['params']['id']}})['then'](handleEntityNotFound(_0x545074,null))['then'](function(_0x4eff95){if(_0x4eff95){return _0x4eff95[_0x31c5('0x73')](_0x42e5be[_0x31c5('0x47')][_0x31c5('0x74')]);}})['then'](respondWithStatusCode(_0x545074,null))[_0x31c5('0x2c')](handleError(_0x545074,null));};exports[_0x31c5('0x75')]=function(_0x533ec8,_0x10dfb7,_0x3036a7){return db['WhatsappAccount'][_0x31c5('0x70')]({'where':{'id':_0x533ec8[_0x31c5('0x5b')]['id']}})[_0x31c5('0x22')](handleEntityNotFound(_0x10dfb7,null))[_0x31c5('0x22')](function(_0x183f85){if(_0x183f85){return _0x183f85[_0x31c5('0x75')](_0x533ec8[_0x31c5('0x5e')]['ids'],_[_0x31c5('0x76')](_0x533ec8[_0x31c5('0x5e')],[_0x31c5('0x74'),'id'])||{})['spread'](function(_0x5cfd69){for(var _0x1da13b=0x0;_0x1da13b<_0x533ec8['body']['ids'][_0x31c5('0x4d')];_0x1da13b+=0x1){socket[_0x31c5('0x77')]('userWhatsappAccount:save',{'UserId':Number(_0x533ec8['body'][_0x31c5('0x74')][_0x1da13b]),'WhatsappAccountId':Number(_0x533ec8['params']['id'])});}return _0x5cfd69;});}})[_0x31c5('0x22')](respondWithResult(_0x10dfb7,null))['catch'](handleError(_0x10dfb7,null));};exports[_0x31c5('0x78')]=function(_0x37c195,_0x39438f,_0x2ffd8c){return db[_0x31c5('0x56')][_0x31c5('0x70')]({'where':{'id':_0x37c195[_0x31c5('0x5b')]['id']}})[_0x31c5('0x22')](handleEntityNotFound(_0x39438f,null))[_0x31c5('0x22')](function(_0x3118e7){if(_0x3118e7){return _0x3118e7['removeAgents'](_0x37c195[_0x31c5('0x47')][_0x31c5('0x74')])[_0x31c5('0x22')](function(){if(_['isArray'](_0x37c195[_0x31c5('0x47')][_0x31c5('0x74')])){for(var _0x1c9280=0x0;_0x1c9280<_0x37c195[_0x31c5('0x47')]['ids'][_0x31c5('0x4d')];_0x1c9280+=0x1){socket[_0x31c5('0x77')](_0x31c5('0x79'),{'UserId':Number(_0x37c195[_0x31c5('0x47')]['ids'][_0x1c9280]),'WhatsappAccountId':Number(_0x37c195['params']['id'])});}}else{socket[_0x31c5('0x77')](_0x31c5('0x79'),{'UserId':Number(_0x37c195['query'][_0x31c5('0x74')]),'WhatsappAccountId':Number(_0x37c195[_0x31c5('0x5b')]['id'])});}});}})[_0x31c5('0x22')](respondWithStatusCode(_0x39438f,null))['catch'](handleError(_0x39438f,null));};exports['getAgents']=function(_0x50cea5,_0x4bfb91,_0x2e24bf){var _0x4f85ac={};var _0x139d71={};var _0x1b88b4;var _0x5c46b3;return db[_0x31c5('0x56')][_0x31c5('0x6a')]({'where':{'id':_0x50cea5[_0x31c5('0x5b')]['id']}})[_0x31c5('0x22')](handleEntityNotFound(_0x4bfb91,null))['then'](function(_0x19d73b){if(_0x19d73b){_0x1b88b4=_0x19d73b;_0x139d71[_0x31c5('0x49')]=_[_0x31c5('0x46')](db['User'][_0x31c5('0x6b')]);_0x139d71[_0x31c5('0x47')]=_[_0x31c5('0x46')](_0x50cea5[_0x31c5('0x47')]);_0x139d71[_0x31c5('0x48')]=_[_0x31c5('0x4b')](_0x139d71[_0x31c5('0x49')],_0x139d71[_0x31c5('0x47')]);_0x4f85ac[_0x31c5('0x4a')]=_[_0x31c5('0x4b')](_0x139d71[_0x31c5('0x49')],qs[_0x31c5('0x4c')](_0x50cea5[_0x31c5('0x47')]['fields']));_0x4f85ac[_0x31c5('0x4a')]=_0x4f85ac[_0x31c5('0x4a')]['length']?_0x4f85ac[_0x31c5('0x4a')]:_0x139d71[_0x31c5('0x49')];_0x4f85ac[_0x31c5('0x4f')]=qs[_0x31c5('0x6d')](_0x50cea5[_0x31c5('0x47')]['sort']);_0x4f85ac['where']=qs['filters'](_[_0x31c5('0x51')](_0x50cea5['query'],_0x139d71['filters']));if(_0x50cea5['query'][_0x31c5('0x52')]){_0x4f85ac['where']=_[_0x31c5('0x54')](_0x4f85ac[_0x31c5('0x50')],{'$or':_['map'](_0x4f85ac[_0x31c5('0x4a')],function(_0x1ecac8){var _0x56fc0={};_0x56fc0[_0x1ecac8]={'$like':'%'+_0x50cea5['query'][_0x31c5('0x52')]+'%'};return _0x56fc0;})});}_0x4f85ac=_['merge']({},_0x4f85ac,_0x50cea5['options']);return _0x1b88b4[_0x31c5('0x7a')](_0x4f85ac);}})[_0x31c5('0x22')](function(_0x58746e){if(_0x58746e){_0x5c46b3=_0x58746e[_0x31c5('0x4d')];if(!_0x50cea5[_0x31c5('0x47')]['hasOwnProperty'](_0x31c5('0x6c'))){_0x4f85ac[_0x31c5('0x30')]=qs[_0x31c5('0x30')](_0x50cea5[_0x31c5('0x47')][_0x31c5('0x30')]);_0x4f85ac[_0x31c5('0x32')]=qs[_0x31c5('0x32')](_0x50cea5[_0x31c5('0x47')][_0x31c5('0x32')]);}return _0x1b88b4[_0x31c5('0x7a')](_0x4f85ac);}})[_0x31c5('0x22')](function(_0x3c3583){if(_0x3c3583){return _0x3c3583?{'count':_0x5c46b3,'rows':_0x3c3583}:null;}})[_0x31c5('0x22')](respondWithResult(_0x4bfb91,null))[_0x31c5('0x2c')](handleError(_0x4bfb91,null));};exports['addApplications']=function(_0x4540b1,_0x48a7e5){var _0x4199d2=_0x4540b1[_0x31c5('0x5b')]['id'];var _0x1ebf35=_0x4540b1[_0x31c5('0x5e')];var _0x57f46a=0xc8;var _0x59f13b=null;return db[_0x31c5('0x7b')][_0x31c5('0x7c')]({'isolationLevel':db[_0x31c5('0x7b')][_0x31c5('0x7d')][_0x31c5('0x7e')][_0x31c5('0x7f')]},function(_0x31361a){return db[_0x31c5('0x56')][_0x31c5('0x6a')]({'where':{'id':_0x4199d2},'transaction':_0x31361a})[_0x31c5('0x22')](function(_0x25ff32){if(_0x25ff32){return db[_0x31c5('0x80')][_0x31c5('0x38')]({'where':{'WhatsappAccountId':_0x4199d2},'transaction':_0x31361a})[_0x31c5('0x22')](function(){var _0xcd1979=_['map'](_0x1ebf35,function(_0x1a92f6){_0x1a92f6['WhatsappAccountId']=_0x4199d2;return _0x1a92f6;});return db[_0x31c5('0x80')][_0x31c5('0x81')](_0xcd1979,{'transaction':_0x31361a});});}else{_0x57f46a=0x194;_0x59f13b=[];}});})['then'](function(){if(_0x57f46a!==0x194){return db[_0x31c5('0x80')][_0x31c5('0x82')]({'where':{'WhatsappAccountId':_0x4199d2},'order':_0x31c5('0x83')})[_0x31c5('0x22')](function(_0x7b06f6){_0x59f13b=_0x7b06f6;});}})[_0x31c5('0x2c')](function(_0x8c62e4){_0x57f46a=0x1f4;logger['error'](_0x8c62e4[_0x31c5('0x3d')]);if(_0x8c62e4[_0x31c5('0x3e')]){delete _0x8c62e4[_0x31c5('0x3e')];}_0x59f13b=_0x8c62e4;})['finally'](function(){if(_0x59f13b===null){_0x48a7e5['sendStatus'](_0x57f46a);}else{if(_0x57f46a===0x1f4){_0x48a7e5[_0x31c5('0x2d')](_0x57f46a)['send'](_0x59f13b);}else{_0x48a7e5[_0x31c5('0x2d')](_0x57f46a)[_0x31c5('0x2e')](_0x59f13b);}}});};exports[_0x31c5('0x84')]=function(_0x2b5dea,_0x29424b,_0x4e6d4d){var _0x4744ef={};var _0x401475={};var _0x2167e0;var _0x333679;return db['WhatsappAccount']['findOne']({'where':{'id':_0x2b5dea[_0x31c5('0x5b')]['id']}})['then'](handleEntityNotFound(_0x29424b,null))[_0x31c5('0x22')](function(_0x27e5ce){if(_0x27e5ce){_0x2167e0=_0x27e5ce;_0x401475[_0x31c5('0x49')]=_[_0x31c5('0x46')](db['WhatsappApplication'][_0x31c5('0x6b')]);_0x401475[_0x31c5('0x47')]=_['keys'](_0x2b5dea[_0x31c5('0x47')]);_0x401475[_0x31c5('0x48')]=_[_0x31c5('0x4b')](_0x401475[_0x31c5('0x49')],_0x401475['query']);_0x4744ef[_0x31c5('0x4a')]=_[_0x31c5('0x4b')](_0x401475['model'],qs[_0x31c5('0x4c')](_0x2b5dea['query']['fields']));_0x4744ef['attributes']=_0x4744ef[_0x31c5('0x4a')][_0x31c5('0x4d')]?_0x4744ef[_0x31c5('0x4a')]:_0x401475['model'];_0x4744ef[_0x31c5('0x4f')]=qs[_0x31c5('0x6d')](_0x2b5dea['query'][_0x31c5('0x6d')]);_0x4744ef[_0x31c5('0x50')]=qs['filters'](_[_0x31c5('0x51')](_0x2b5dea[_0x31c5('0x47')],_0x401475[_0x31c5('0x48')]));if(_0x2b5dea[_0x31c5('0x47')][_0x31c5('0x52')]){_0x4744ef[_0x31c5('0x50')]=_[_0x31c5('0x54')](_0x4744ef['where'],{'$or':_[_0x31c5('0x42')](_0x4744ef[_0x31c5('0x4a')],function(_0x39d94c){var _0x16c9eb={};_0x16c9eb[_0x39d94c]={'$like':'%'+_0x2b5dea[_0x31c5('0x47')]['filter']+'%'};return _0x16c9eb;})});}_0x4744ef=_[_0x31c5('0x54')]({},_0x4744ef,_0x2b5dea['options']);return _0x2167e0[_0x31c5('0x84')](_0x4744ef);}})[_0x31c5('0x22')](function(_0x99f520){if(_0x99f520){_0x333679=_0x99f520['length'];if(!_0x2b5dea[_0x31c5('0x47')]['hasOwnProperty'](_0x31c5('0x6c'))){_0x4744ef[_0x31c5('0x30')]=qs[_0x31c5('0x30')](_0x2b5dea[_0x31c5('0x47')]['limit']);_0x4744ef['offset']=qs[_0x31c5('0x32')](_0x2b5dea['query'][_0x31c5('0x32')]);}return _0x2167e0[_0x31c5('0x84')](_0x4744ef);}})['then'](function(_0x2d2b0e){if(_0x2d2b0e){return _0x2d2b0e?{'count':_0x333679,'rows':_0x2d2b0e}:null;}})['then'](respondWithResult(_0x29424b,null))[_0x31c5('0x2c')](handleError(_0x29424b,null));};exports[_0x31c5('0x85')]=function(_0x1a0195,_0xa3d96d,_0x3a4dee){var _0x4d6e10={'channel':_0x31c5('0x86')};var _0x1a9108=[];var _0x17d3e9=[];var _0x24cfb8={};return db[_0x31c5('0x56')][_0x31c5('0x70')]({'where':{'id':_0x1a0195[_0x31c5('0x5b')]['id']},'include':[{'model':db[_0x31c5('0x80')],'as':_0x31c5('0x87')}]})[_0x31c5('0x22')](handleEntityNotFound(_0xa3d96d,null))[_0x31c5('0x22')](function(_0x4f837b){_0x4d6e10[_0x31c5('0x88')]=_0x4f837b;if(_0x4d6e10[_0x31c5('0x88')]&&_0x4d6e10['account'][_0x31c5('0x44')]===_0x31c5('0x89')&&_0x1a0195[_0x31c5('0x5e')][_0x31c5('0x8a')]){if(_0x1a0195[_0x31c5('0x5e')][_0x31c5('0x8a')][_0x31c5('0x4d')]===0x0)return;if(_0x1a0195[_0x31c5('0x5e')]['statuses'][0x0][_0x31c5('0x8b')]!==_0x31c5('0x8c'))return;return db[_0x31c5('0x8d')]['update']({'read':!![],'readAt':_0x1a0195[_0x31c5('0x5e')][_0x31c5('0x8a')][0x0][_0x31c5('0x8e')]},{'where':{'messageId':_0x1a0195['body']['statuses'][0x0][_0x31c5('0x8f')]},'individualHooks':!![]})[_0x31c5('0x22')](function(_0x5db87d){return _0xa3d96d['status'](0xc8)['json'](_0x5db87d);});}_0x4d6e10[_0x31c5('0x90')]=_[_0x31c5('0x91')](_0x4f837b[_0x31c5('0x87')],['priority'],[_0x31c5('0x92')]);if(_0x4d6e10[_0x31c5('0x88')]['Applications']){delete _0x4d6e10[_0x31c5('0x88')][_0x31c5('0x87')];}return db[_0x31c5('0x93')]['describe']()[_0x31c5('0x22')](function(_0x355372){if(!_0x355372){throw new db[(_0x31c5('0x94'))][(_0x31c5('0x95'))](_0x31c5('0x96'));}_0x1a9108=_[_0x31c5('0x97')](_['keys'](_0x355372),[_0x31c5('0x98'),'updatedAt']);_0x17d3e9=_[_0x31c5('0x97')](_[_0x31c5('0x46')](_0x355372),[_0x31c5('0x98'),'updatedAt','CompanyId',_0x31c5('0x99')]);_0x4d6e10[_0x31c5('0x5e')]={'mapKey':'mobile'};if(_0x4d6e10[_0x31c5('0x88')]&&_0x4d6e10[_0x31c5('0x88')][_0x31c5('0x44')]===_0x31c5('0x9a')){_0x4d6e10[_0x31c5('0x5e')][_0x31c5('0x9b')]=_0x1a0195[_0x31c5('0x5e')][_0x31c5('0x9c')]['replace'](_0x31c5('0x9d'),'');_0x4d6e10['body'][_0x31c5('0x5e')]=_0x1a0195[_0x31c5('0x5e')][_0x31c5('0x9e')];_0x4d6e10[_0x31c5('0x5e')][_0x31c5('0x9f')]=_0x1a0195['body']['MessageSid'];}if(_0x4d6e10[_0x31c5('0x88')]&&_0x4d6e10[_0x31c5('0x88')]['type']==='sinch'){_0x4d6e10[_0x31c5('0x5e')]['from']=_0x1a0195[_0x31c5('0x5e')]['notifications'][0x0]['from'];_0x4d6e10[_0x31c5('0x5e')][_0x31c5('0x5e')]=_0x1a0195[_0x31c5('0x5e')][_0x31c5('0xa0')][0x0][_0x31c5('0x2a')][_0x31c5('0x5e')];_0x4d6e10[_0x31c5('0x5e')][_0x31c5('0x9f')]=_0x1a0195[_0x31c5('0x5e')][_0x31c5('0xa0')][0x0][_0x31c5('0x8f')];}if(_0x4d6e10['body']['id']){delete _0x4d6e10[_0x31c5('0x5e')]['id'];}if(_['isNil'](_0x4d6e10[_0x31c5('0x5e')][_0x31c5('0x9b')])){throw new db[(_0x31c5('0x94'))][(_0x31c5('0x95'))](_0x31c5('0xa1'));}if(_[_0x31c5('0xa2')](_0x4d6e10[_0x31c5('0x5e')][_0x31c5('0x5e')])||_0x4d6e10[_0x31c5('0x5e')][_0x31c5('0x5e')]===''){throw new db[(_0x31c5('0x94'))]['ValidationError'](_0x31c5('0xa3'));}if(_['isNil'](_0x4d6e10['body'][_0x31c5('0xa4')])){throw new db['Sequelize'][(_0x31c5('0x95'))](_0x31c5('0xa5')+_0x17d3e9);}if(!_[_0x31c5('0xa6')](_0x17d3e9,_0x4d6e10[_0x31c5('0x5e')][_0x31c5('0xa4')])){throw new db[(_0x31c5('0x94'))]['ValidationError'](_0x31c5('0xa7')+_0x17d3e9);}_0x24cfb8[_0x4d6e10[_0x31c5('0x5e')][_0x31c5('0xa4')]]=_0x4d6e10[_0x31c5('0x5e')][_0x31c5('0x9b')];return db['CmList'][_0x31c5('0x70')]({'where':{'id':_0x4d6e10[_0x31c5('0x88')]['ListId']},'include':[{'model':db[_0x31c5('0x93')],'as':'Contacts','where':_0x24cfb8,'limit':0x1,'order':[['updatedAt',_0x31c5('0xa8')]]}]});})[_0x31c5('0x22')](handleEntityNotFound(_0xa3d96d,null))['then'](function(_0x158235){if(_0x158235){_0x4d6e10[_0x31c5('0xa9')]=_[_0x31c5('0x76')](_0x158235,[_0x31c5('0xaa')]);if(_0x158235[_0x31c5('0xaa')][_0x31c5('0x4d')]){return _0x158235['Contacts'][0x0];}var _0x5eb9e9=_['defaults'](_0x4d6e10['body'],{'firstName':_0x4d6e10[_0x31c5('0x5e')][_0x31c5('0x9b')],'ListId':_0x158235['id']});_0x5eb9e9[_0x4d6e10[_0x31c5('0x5e')][_0x31c5('0xa4')]]=_0x4d6e10[_0x31c5('0x5e')]['from'];return db['CmContact'][_0x31c5('0x5d')](_0x5eb9e9,{'fields':_0x1a9108,'raw':!![]});}})['then'](handleEntityNotFound(_0xa3d96d,null))[_0x31c5('0x22')](function(_0x34bee2){if(_0x34bee2){_0x4d6e10['contact']=_0x34bee2;var _0xae4c20={'ContactId':_0x34bee2['id'],'phone':_0x4d6e10[_0x31c5('0x5e')]['from'],'WhatsappAccountId':_0x1a0195[_0x31c5('0x5b')]['id']};var _0x50009a={'ContactId':_0x34bee2['id'],'WhatsappAccountId':_0x1a0195['params']['id'],'closed':![]};return db[_0x31c5('0xab')][_0x31c5('0x70')]({'where':_0x50009a})['then'](function(_0x386d5e){if(_0x386d5e){return[_0x386d5e,![]];}return db[_0x31c5('0xab')][_0x31c5('0x5d')](_0xae4c20)[_0x31c5('0x22')](function(_0x47bc2f){return[_0x47bc2f,!![]];});});}})[_0x31c5('0xac')](function(_0x1a89f1,_0x70848e){_0x4d6e10['interaction']=_0x1a89f1[_0x31c5('0x39')]({'plain':!![]});_0x4d6e10[_0x31c5('0xad')][_0x31c5('0xae')]=![];if(_0x70848e){if(_0x4d6e10['account'][_0x31c5('0xaf')]){_0x4d6e10[_0x31c5('0x90')][_0x31c5('0xb0')]({'id':0x0,'priority':_0x4d6e10[_0x31c5('0x90')][_0x31c5('0x4d')]+0x1,'app':_0x31c5('0xb1'),'appdata':_0x31c5('0xb2'),'interval':_0x31c5('0xb3')});}_0x4d6e10['interaction'][_0x31c5('0xae')]=!![];}return db[_0x31c5('0x8d')]['create']({'phone':_0x4d6e10[_0x31c5('0x5e')][_0x31c5('0x9b')],'messageId':_0x4d6e10[_0x31c5('0x5e')]['messageId'],'body':_0x4d6e10[_0x31c5('0x5e')][_0x31c5('0x5e')],'WhatsappAccountId':_0x1a0195[_0x31c5('0x5b')]['id'],'WhatsappInteractionId':_0x1a89f1['id'],'direction':'in','ContactId':_0x1a89f1['ContactId'],'AttachmentId':_0x4d6e10[_0x31c5('0x5e')][_0x31c5('0xb4')]});})[_0x31c5('0x22')](function(_0x552aa9){_0x4d6e10[_0x31c5('0x2a')]=_0x552aa9;if(_0x4d6e10[_0x31c5('0xad')][_0x31c5('0xb5')]){return db[_0x31c5('0xb6')][_0x31c5('0x70')]({'attributes':['id',_0x31c5('0x3e')],'where':{'id':_0x4d6e10[_0x31c5('0xad')]['UserId']}})[_0x31c5('0x22')](function(_0x5406f2){if(_0x5406f2){_0x4d6e10[_0x31c5('0x90')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5406f2[_0x31c5('0x3e')]+','+(_0x4d6e10['account']['waitForTheAssignedAgent']||0xa),'interval':_0x31c5('0xb3')});}return respondWithRpcPromise('Start',_0x31c5('0xb7'),_0x4d6e10);});}return respondWithRpcPromise(_0x31c5('0xb8'),_0x31c5('0xb7'),_0x4d6e10);})[_0x31c5('0x22')](function(_0x5c1023){if(_0x5c1023){var _0x3f0cc8=0xc8;var _0x188aed='receiveMessage';logger['info'](_0x31c5('0x26'),_0x188aed,_0x3f0cc8,'entity\x20found');logger['debug'](_0x31c5('0xb9'),_0x188aed,_0x3f0cc8,'entity\x20found',JSON[_0x31c5('0x27')](_0x5c1023));if(_0x4d6e10['account'][_0x31c5('0x44')]===_0x31c5('0x9a')){return _0xa3d96d[_0x31c5('0x2d')](_0x3f0cc8)[_0x31c5('0x33')](_0x31c5('0xba'),_0x31c5('0xbb'))[_0x31c5('0x3f')](_0x31c5('0xbc'));}else{return _0xa3d96d[_0x31c5('0x2d')](_0x3f0cc8)['json'](_0x5c1023);}}});})[_0x31c5('0x2c')](handleError(_0xa3d96d,null));};exports[_0x31c5('0x3f')]=function(_0x5a07c4,_0xaf5c88,_0x280c1a){var _0x36ff70,_0x3b1dbc,_0x4d32ab;if(_['isNil'](_0x5a07c4[_0x31c5('0x5e')][_0x31c5('0x5e')])||_0x5a07c4[_0x31c5('0x5e')][_0x31c5('0x5e')]===''){throw new db[(_0x31c5('0x94'))][(_0x31c5('0x95'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x31c5('0xa2')](_0x5a07c4[_0x31c5('0x5e')]['to'])){throw new db[(_0x31c5('0x94'))][(_0x31c5('0x95'))]('to\x20is\x20mandatory');}_0x36ff70=_0x5a07c4[_0x31c5('0x5e')]['to'];return db[_0x31c5('0x56')][_0x31c5('0x70')]({'where':{'id':_0x5a07c4[_0x31c5('0x5b')]['id']},'include':[{'model':db[_0x31c5('0xbd')],'as':'List','include':[{'model':db[_0x31c5('0x93')],'as':_0x31c5('0xaa'),'where':{'mobile':_0x36ff70},'limit':0x1,'order':[[_0x31c5('0xbe'),_0x31c5('0xa8')]]}]}]})[_0x31c5('0x22')](handleEntityNotFound(_0xaf5c88,null))['then'](function(_0x494a7e){if(_0x494a7e&&_0x494a7e[_0x31c5('0xbf')]){_0x3b1dbc=_0x494a7e['get']({'plain':!![]});if(_0x3b1dbc[_0x31c5('0xbf')]&&_0x3b1dbc[_0x31c5('0xbf')][_0x31c5('0xaa')]['length']){return _0x3b1dbc[_0x31c5('0xbf')]['Contacts'][0x0];}return db[_0x31c5('0x93')]['create'](_[_0x31c5('0x19')](_0x5a07c4[_0x31c5('0x5e')],{'firstName':_0x36ff70,'mobile':_0x36ff70,'phone':_0x36ff70,'ListId':_0x3b1dbc[_0x31c5('0x99')]}));}})[_0x31c5('0x22')](handleEntityNotFound(_0xaf5c88,null))[_0x31c5('0x22')](function(_0xf23b2){if(_0xf23b2){_0x4d32ab=_0xf23b2;return db[_0x31c5('0xab')][_0x31c5('0x70')]({'where':{'ContactId':_0x4d32ab['id'],'closed':![],'WhatsappAccountId':_0x3b1dbc['id']}})[_0x31c5('0x22')](function(_0x41b8f1){if(_0x41b8f1){return[_0x41b8f1,![]];}return db[_0x31c5('0xab')][_0x31c5('0x5d')]({'UserId':_0x5a07c4[_0x31c5('0x61')]['id'],'ContactId':_0x4d32ab['id'],'WhatsappAccountId':_0x3b1dbc['id'],'phone':_0x36ff70,'firstMsgDirection':_0x31c5('0xc0'),'Messages':[_[_0x31c5('0x54')](_0x5a07c4[_0x31c5('0x5e')],{'read':![],'body':_0x5a07c4[_0x31c5('0x5e')]['body'],'phone':_0x36ff70,'WhatsappAccountId':_0x3b1dbc['id'],'UserId':_0x5a07c4[_0x31c5('0x61')]['id'],'ContactId':_0x4d32ab['id']})]},{'include':[{'model':db[_0x31c5('0x8d')],'as':'Messages'}]})[_0x31c5('0x22')](function(_0x25d908){return[_0x25d908,!![]];});});}})['spread'](function(_0x5234fa,_0x2149be){if(_0x2149be){return _0x5234fa;}return db[_0x31c5('0x8d')][_0x31c5('0x5d')](_['merge'](_0x5a07c4['body'],{'read':![],'body':_0x5a07c4['body'][_0x31c5('0x5e')],'phone':_0x36ff70,'WhatsappAccountId':_0x3b1dbc['id'],'WhatsappInteractionId':_0x5234fa['id'],'UserId':_0x5a07c4[_0x31c5('0x61')]['id'],'ContactId':_0x4d32ab['id']}))[_0x31c5('0x22')](function(_0x24c6b7){_0x5234fa[_0x31c5('0xc1')][_0x31c5('0xc2')]=[];_0x5234fa['dataValues'][_0x31c5('0xc2')]['push'](_0x24c6b7[_0x31c5('0xc1')]);return _0x5234fa;});})[_0x31c5('0x22')](respondWithResult(_0xaf5c88,null))[_0x31c5('0x2c')](handleError(_0xaf5c88,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 3fbe08f..bfb1687 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 _0x1b3e=['hasOwnProperty','hook','events','WhatsappAccount','setMaxListeners','save','update','emit'];(function(_0x548ec8,_0x2dc029){var _0x754e0f=function(_0x3d125b){while(--_0x3d125b){_0x548ec8['push'](_0x548ec8['shift']());}};_0x754e0f(++_0x2dc029);}(_0x1b3e,0x1f2));var _0xe1b3=function(_0x1599bb,_0x2feedd){_0x1599bb=_0x1599bb-0x0;var _0x4f6a55=_0x1b3e[_0x1599bb];return _0x4f6a55;};'use strict';var EventEmitter=require(_0xe1b3('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0xe1b3('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xe1b3('0x2')](0x0);var events={'afterCreate':_0xe1b3('0x3'),'afterUpdate':_0xe1b3('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4da858){return function(_0x546bdb,_0x243e71,_0x4f5a25){WhatsappAccountEvents['emit'](_0x4da858+':'+_0x546bdb['id'],_0x546bdb);WhatsappAccountEvents[_0xe1b3('0x5')](_0x4da858,_0x546bdb);_0x4f5a25(null);};}for(var e in events){if(events[_0xe1b3('0x6')](e)){var event=events[e];WhatsappAccount[_0xe1b3('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x6e11=['update','remove','emit','hasOwnProperty','../../mysqldb','setMaxListeners','save'];(function(_0x8a2c4,_0x2c3606){var _0xdf55b3=function(_0x22937b){while(--_0x22937b){_0x8a2c4['push'](_0x8a2c4['shift']());}};_0xdf55b3(++_0x2c3606);}(_0x6e11,0x15b));var _0x16e1=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x6e11[_0x525c7b];return _0x27b33e;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x16e1('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x16e1('0x1')](0x0);var events={'afterCreate':_0x16e1('0x2'),'afterUpdate':_0x16e1('0x3'),'afterDestroy':_0x16e1('0x4')};function emitEvent(_0x30b9e8){return function(_0x1d5966,_0x4d6240,_0x128464){WhatsappAccountEvents[_0x16e1('0x5')](_0x30b9e8+':'+_0x1d5966['id'],_0x1d5966);WhatsappAccountEvents[_0x16e1('0x5')](_0x30b9e8,_0x1d5966);_0x128464(null);};}for(var e in events){if(events[_0x16e1('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 52f9845..26f5730 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 _0xc236=['../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','whatsapp_accounts','lodash','util'];(function(_0x2d5d38,_0xef2f2e){var _0x50f2d7=function(_0x76da78){while(--_0x76da78){_0x2d5d38['push'](_0x2d5d38['shift']());}};_0x50f2d7(++_0xef2f2e);}(_0xc236,0x1f2));var _0x6c23=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc236[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6c23('0x0'));var util=require(_0x6c23('0x1'));var logger=require(_0x6c23('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6c23('0x3'));var rp=require(_0x6c23('0x4'));var fs=require('fs');var path=require(_0x6c23('0x5'));var rimraf=require('rimraf');var config=require(_0x6c23('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0x6c23('0x7')]=function(_0x24ee40,_0x552b90){return _0x24ee40[_0x6c23('0x8')]('WhatsappAccount',attributes,{'tableName':_0x6c23('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef69=['path','rimraf','exports','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x40a3e6,_0x2c084f){var _0x55f256=function(_0x146672){while(--_0x146672){_0x40a3e6['push'](_0x40a3e6['shift']());}};_0x55f256(++_0x2c084f);}(_0xef69,0x143));var _0x9ef6=function(_0x20433b,_0x4af0eb){_0x20433b=_0x20433b-0x0;var _0x59fa94=_0xef69[_0x20433b];return _0x59fa94;};'use strict';var _=require(_0x9ef6('0x0'));var util=require(_0x9ef6('0x1'));var logger=require(_0x9ef6('0x2'))(_0x9ef6('0x3'));var moment=require(_0x9ef6('0x4'));var BPromise=require(_0x9ef6('0x5'));var rp=require(_0x9ef6('0x6'));var fs=require('fs');var path=require(_0x9ef6('0x7'));var rimraf=require(_0x9ef6('0x8'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0x9ef6('0x9')]=function(_0xd77916,_0x49bc33){return _0xd77916['define']('WhatsappAccount',attributes,{'tableName':_0x9ef6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 20761bc..1fd263c 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 _0x1d7e=['where','attributes','model','include','map','ShowWhatsappAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','WhatsappAccount','options','raw'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x1d7e,0xa2));var _0xe1d7=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x1d7e[_0x16d10f];return _0x50c823;};'use strict';var _=require(_0xe1d7('0x0'));var util=require('util');var moment=require(_0xe1d7('0x1'));var BPromise=require(_0xe1d7('0x2'));var rs=require(_0xe1d7('0x3'));var fs=require('fs');var Redis=require(_0xe1d7('0x4'));var db=require(_0xe1d7('0x5'))['db'];var utils=require(_0xe1d7('0x6'));var logger=require(_0xe1d7('0x7'))(_0xe1d7('0x8'));var config=require(_0xe1d7('0x9'));var jayson=require(_0xe1d7('0xa'));var client=jayson[_0xe1d7('0xb')][_0xe1d7('0xc')]({'port':0x232a});config[_0xe1d7('0xd')]=_[_0xe1d7('0xe')](config['redis'],{'host':_0xe1d7('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe1d7('0x10'))[_0xe1d7('0x11')](socket);function respondWithRpcPromise(_0x91cd6d,_0x47be47,_0xc8308e){return new BPromise(function(_0x29b6b9,_0x9e3c89){return client['request'](_0x91cd6d,_0xc8308e)[_0xe1d7('0x12')](function(_0xad3a6){logger[_0xe1d7('0x13')](_0xe1d7('0x14'),_0x47be47,'request\x20sent');logger[_0xe1d7('0x15')](_0xe1d7('0x16'),_0x47be47,_0xe1d7('0x17'),JSON[_0xe1d7('0x18')](_0xad3a6));if(_0xad3a6[_0xe1d7('0x19')]){if(_0xad3a6[_0xe1d7('0x19')][_0xe1d7('0x1a')]===0x1f4){logger[_0xe1d7('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x47be47,_0xad3a6['error'][_0xe1d7('0x1b')]);return _0x9e3c89(_0xad3a6[_0xe1d7('0x19')]['message']);}logger[_0xe1d7('0x19')]('WhatsappAccount,\x20%s,\x20%s',_0x47be47,_0xad3a6[_0xe1d7('0x19')]['message']);return _0x29b6b9(_0xad3a6[_0xe1d7('0x19')][_0xe1d7('0x1b')]);}else{logger[_0xe1d7('0x13')](_0xe1d7('0x14'),_0x47be47,'request\x20sent');_0x29b6b9(_0xad3a6[_0xe1d7('0x1c')][_0xe1d7('0x1b')]);}})[_0xe1d7('0x1d')](function(_0x459836){logger[_0xe1d7('0x19')](_0xe1d7('0x14'),_0x47be47,_0x459836);_0x9e3c89(_0x459836);});});}exports['ShowWhatsappAccount']=function(_0x57ada5){var _0x450dc1=this;return new Promise(function(_0x1ec730,_0x5bf331){return db[_0xe1d7('0x1e')]['find']({'raw':_0x57ada5['options']?_0x57ada5[_0xe1d7('0x1f')][_0xe1d7('0x20')]===undefined?!![]:![]:!![],'where':_0x57ada5[_0xe1d7('0x1f')]?_0x57ada5[_0xe1d7('0x1f')][_0xe1d7('0x21')]||null:null,'attributes':_0x57ada5[_0xe1d7('0x1f')]?_0x57ada5[_0xe1d7('0x1f')][_0xe1d7('0x22')]||null:null,'include':_0x57ada5[_0xe1d7('0x1f')]?_0x57ada5[_0xe1d7('0x1f')]['include']?_['map'](_0x57ada5[_0xe1d7('0x1f')]['include'],function(_0xeb1513){return{'model':db[_0xeb1513[_0xe1d7('0x23')]],'as':_0xeb1513['as'],'attributes':_0xeb1513[_0xe1d7('0x22')],'include':_0xeb1513[_0xe1d7('0x24')]?_[_0xe1d7('0x25')](_0xeb1513['include'],function(_0xcf7494){return{'model':db[_0xcf7494[_0xe1d7('0x23')]],'as':_0xcf7494['as'],'attributes':_0xcf7494['attributes'],'include':_0xcf7494['include']?_[_0xe1d7('0x25')](_0xcf7494[_0xe1d7('0x24')],function(_0x44a10e){return{'model':db[_0x44a10e[_0xe1d7('0x23')]],'as':_0x44a10e['as'],'attributes':_0x44a10e[_0xe1d7('0x22')]};}):[]};}):[]};}):[]:[]})[_0xe1d7('0x12')](function(_0x1fbebc){logger[_0xe1d7('0x13')](_0xe1d7('0x26'),_0x57ada5);logger['debug'](_0xe1d7('0x26'),_0x57ada5,JSON[_0xe1d7('0x18')](_0x1fbebc));_0x1ec730(_0x1fbebc);})['catch'](function(_0x486cc2){logger[_0xe1d7('0x19')](_0xe1d7('0x26'),_0x486cc2['message'],_0x57ada5);_0x5bf331(_0x450dc1[_0xe1d7('0x19')](0x1f4,_0x486cc2[_0xe1d7('0x1b')]));});});}; \ No newline at end of file +var _0xe5a9=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','options','raw','include','attributes','map','model','ShowWhatsappAccount','catch','util','moment'];(function(_0x17321c,_0x44cdc6){var _0x40b9ec=function(_0x5355ec){while(--_0x5355ec){_0x17321c['push'](_0x17321c['shift']());}};_0x40b9ec(++_0x44cdc6);}(_0xe5a9,0x9e));var _0x9e5a=function(_0x2cb633,_0x5caee0){_0x2cb633=_0x2cb633-0x0;var _0x4b1a20=_0xe5a9[_0x2cb633];return _0x4b1a20;};'use strict';var _=require('lodash');var util=require(_0x9e5a('0x0'));var moment=require(_0x9e5a('0x1'));var BPromise=require(_0x9e5a('0x2'));var rs=require(_0x9e5a('0x3'));var fs=require('fs');var Redis=require(_0x9e5a('0x4'));var db=require(_0x9e5a('0x5'))['db'];var utils=require(_0x9e5a('0x6'));var logger=require('../../config/logger')(_0x9e5a('0x7'));var config=require(_0x9e5a('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x9e5a('0x9')]=_[_0x9e5a('0xa')](config[_0x9e5a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e5a('0xb'))(new Redis(config[_0x9e5a('0x9')]));require(_0x9e5a('0xc'))[_0x9e5a('0xd')](socket);function respondWithRpcPromise(_0x5a4bd3,_0x14b993,_0x508247){return new BPromise(function(_0x3c3d83,_0x52ca5f){return client['request'](_0x5a4bd3,_0x508247)[_0x9e5a('0xe')](function(_0x5904fa){logger[_0x9e5a('0xf')](_0x9e5a('0x10'),_0x14b993,_0x9e5a('0x11'));logger['debug'](_0x9e5a('0x12'),_0x14b993,_0x9e5a('0x11'),JSON[_0x9e5a('0x13')](_0x5904fa));if(_0x5904fa['error']){if(_0x5904fa[_0x9e5a('0x14')][_0x9e5a('0x15')]===0x1f4){logger['error'](_0x9e5a('0x10'),_0x14b993,_0x5904fa[_0x9e5a('0x14')][_0x9e5a('0x16')]);return _0x52ca5f(_0x5904fa[_0x9e5a('0x14')][_0x9e5a('0x16')]);}logger[_0x9e5a('0x14')](_0x9e5a('0x10'),_0x14b993,_0x5904fa[_0x9e5a('0x14')][_0x9e5a('0x16')]);return _0x3c3d83(_0x5904fa[_0x9e5a('0x14')][_0x9e5a('0x16')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x14b993,_0x9e5a('0x11'));_0x3c3d83(_0x5904fa[_0x9e5a('0x17')][_0x9e5a('0x16')]);}})['catch'](function(_0x46ef03){logger[_0x9e5a('0x14')](_0x9e5a('0x10'),_0x14b993,_0x46ef03);_0x52ca5f(_0x46ef03);});});}exports['ShowWhatsappAccount']=function(_0x26518f){var _0x54e724=this;return new Promise(function(_0x422d7d,_0xf3b052){return db['WhatsappAccount']['find']({'raw':_0x26518f[_0x9e5a('0x18')]?_0x26518f[_0x9e5a('0x18')][_0x9e5a('0x19')]===undefined?!![]:![]:!![],'where':_0x26518f[_0x9e5a('0x18')]?_0x26518f[_0x9e5a('0x18')]['where']||null:null,'attributes':_0x26518f['options']?_0x26518f[_0x9e5a('0x18')]['attributes']||null:null,'include':_0x26518f[_0x9e5a('0x18')]?_0x26518f[_0x9e5a('0x18')][_0x9e5a('0x1a')]?_['map'](_0x26518f['options'][_0x9e5a('0x1a')],function(_0x219152){return{'model':db[_0x219152['model']],'as':_0x219152['as'],'attributes':_0x219152[_0x9e5a('0x1b')],'include':_0x219152[_0x9e5a('0x1a')]?_[_0x9e5a('0x1c')](_0x219152['include'],function(_0x3800ab){return{'model':db[_0x3800ab[_0x9e5a('0x1d')]],'as':_0x3800ab['as'],'attributes':_0x3800ab[_0x9e5a('0x1b')],'include':_0x3800ab['include']?_[_0x9e5a('0x1c')](_0x3800ab[_0x9e5a('0x1a')],function(_0x3e49aa){return{'model':db[_0x3e49aa['model']],'as':_0x3e49aa['as'],'attributes':_0x3e49aa['attributes']};}):[]};}):[]};}):[]:[]})[_0x9e5a('0xe')](function(_0x43da83){logger[_0x9e5a('0xf')](_0x9e5a('0x1e'),_0x26518f);logger['debug'](_0x9e5a('0x1e'),_0x26518f,JSON[_0x9e5a('0x13')](_0x43da83));_0x422d7d(_0x43da83);})[_0x9e5a('0x1f')](function(_0xb5f88d){logger[_0x9e5a('0x14')](_0x9e5a('0x1e'),_0xb5f88d['message'],_0x26518f);_0xf3b052(_0x54e724['error'](0x1f4,_0xb5f88d['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 841cbda..f8c2486 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 _0xcbaf=['register','./whatsappAccount.events','save','update','removeListener'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xcbaf,0xe7));var _0xfcba=function(_0x358eef,_0x4e271c){_0x358eef=_0x358eef-0x0;var _0x338ae0=_0xcbaf[_0x358eef];return _0x338ae0;};'use strict';var WhatsappAccountEvents=require(_0xfcba('0x0'));var events=[_0xfcba('0x1'),'remove',_0xfcba('0x2')];function createListener(_0x5220b7,_0x527379){return function(_0x106a83){_0x527379['emit'](_0x5220b7,_0x106a83);};}function removeListener(_0x406602,_0x47ed3b){return function(){WhatsappAccountEvents[_0xfcba('0x3')](_0x406602,_0x47ed3b);};}exports[_0xfcba('0x4')]=function(_0x464dc2){for(var _0x22cd96=0x0,_0x52d60f=events['length'];_0x22cd96<_0x52d60f;_0x22cd96++){var _0x5b618b=events[_0x22cd96];var _0x36b4ef=createListener('whatsappAccount:'+_0x5b618b,_0x464dc2);WhatsappAccountEvents['on'](_0x5b618b,_0x36b4ef);}}; \ No newline at end of file +var _0x9cb6=['save','remove','emit','removeListener','length','whatsappAccount:','./whatsappAccount.events'];(function(_0x512011,_0x4524ed){var _0x187259=function(_0x572dac){while(--_0x572dac){_0x512011['push'](_0x512011['shift']());}};_0x187259(++_0x4524ed);}(_0x9cb6,0x12c));var _0x69cb=function(_0x1387a0,_0x1053d6){_0x1387a0=_0x1387a0-0x0;var _0x1f8eba=_0x9cb6[_0x1387a0];return _0x1f8eba;};'use strict';var WhatsappAccountEvents=require(_0x69cb('0x0'));var events=[_0x69cb('0x1'),_0x69cb('0x2'),'update'];function createListener(_0x1b087e,_0x3a9841){return function(_0x51a162){_0x3a9841[_0x69cb('0x3')](_0x1b087e,_0x51a162);};}function removeListener(_0x424612,_0x47a202){return function(){WhatsappAccountEvents[_0x69cb('0x4')](_0x424612,_0x47a202);};}exports['register']=function(_0x4ebc65){for(var _0x50d0be=0x0,_0x3e445b=events[_0x69cb('0x5')];_0x50d0be<_0x3e445b;_0x50d0be++){var _0x1d198f=events[_0x50d0be];var _0x1c47aa=createListener(_0x69cb('0x6')+_0x1d198f,_0x4ebc65);WhatsappAccountEvents['on'](_0x1d198f,_0x1c47aa);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 44d15dc..8c6cfca 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 _0xc400=['show','post','create','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x2a9a1f,_0x22ae3e){var _0x597e54=function(_0x390f5d){while(--_0x390f5d){_0x2a9a1f['push'](_0x2a9a1f['shift']());}};_0x597e54(++_0x22ae3e);}(_0xc400,0x15a));var _0x0c40=function(_0x2eb984,_0x52cd42){_0x2eb984=_0x2eb984-0x0;var _0x9d63f3=_0xc400[_0x2eb984];return _0x9d63f3;};'use strict';var multer=require(_0x0c40('0x0'));var util=require(_0x0c40('0x1'));var path=require(_0x0c40('0x2'));var timeout=require(_0x0c40('0x3'));var express=require(_0x0c40('0x4'));var router=express[_0x0c40('0x5')]();var fs_extra=require(_0x0c40('0x6'));var auth=require(_0x0c40('0x7'));var interaction=require(_0x0c40('0x8'));var config=require(_0x0c40('0x9'));var controller=require(_0x0c40('0xa'));router[_0x0c40('0xb')]('/',auth[_0x0c40('0xc')](),controller[_0x0c40('0xd')]);router[_0x0c40('0xb')](_0x0c40('0xe'),auth[_0x0c40('0xc')](),controller[_0x0c40('0xf')]);router[_0x0c40('0x10')]('/',auth[_0x0c40('0xc')](),controller[_0x0c40('0x11')]);router['put']('/:id',auth[_0x0c40('0xc')](),controller['update']);router['delete'](_0x0c40('0xe'),auth[_0x0c40('0xc')](),controller[_0x0c40('0x12')]);module['exports']=router; \ No newline at end of file +var _0x32ad=['multer','util','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','post','create','put','delete','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x32ad,0xb0));var _0xd32a=function(_0xa5fe11,_0x5d8b01){_0xa5fe11=_0xa5fe11-0x0;var _0x2d5c1a=_0x32ad[_0xa5fe11];return _0x2d5c1a;};'use strict';var multer=require(_0xd32a('0x0'));var util=require(_0xd32a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd32a('0x2'));var router=express['Router']();var fs_extra=require(_0xd32a('0x3'));var auth=require(_0xd32a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd32a('0x5'));var controller=require(_0xd32a('0x6'));router[_0xd32a('0x7')]('/',auth[_0xd32a('0x8')](),controller[_0xd32a('0x9')]);router[_0xd32a('0x7')](_0xd32a('0xa'),auth[_0xd32a('0x8')](),controller['show']);router[_0xd32a('0xb')]('/',auth[_0xd32a('0x8')](),controller[_0xd32a('0xc')]);router[_0xd32a('0xd')](_0xd32a('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xd32a('0xe')](_0xd32a('0xa'),auth[_0xd32a('0x8')](),controller['destroy']);module[_0xd32a('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 43370e6..7748241 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 _0xa84c=['STRING','TEXT','sequelize','INTEGER'];(function(_0x4a085b,_0x401a96){var _0x38460b=function(_0x540373){while(--_0x540373){_0x4a085b['push'](_0x4a085b['shift']());}};_0x38460b(++_0x401a96);}(_0xa84c,0x156));var _0xca84=function(_0x4d031a,_0x625b5d){_0x4d031a=_0x4d031a-0x0;var _0x35a74c=_0xa84c[_0x4d031a];return _0x35a74c;};'use strict';var Sequelize=require(_0xca84('0x0'));module['exports']={'priority':{'type':Sequelize[_0xca84('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xca84('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xca84('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xba56=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x3b4418,_0x22dd7f){var _0x5d3352=function(_0x599eb5){while(--_0x599eb5){_0x3b4418['push'](_0x3b4418['shift']());}};_0x5d3352(++_0x22dd7f);}(_0xba56,0xa1));var _0x6ba5=function(_0x45c262,_0x2e3ce5){_0x45c262=_0x45c262-0x0;var _0x4f2ba6=_0xba56[_0x45c262];return _0x4f2ba6;};'use strict';var Sequelize=require(_0x6ba5('0x0'));module[_0x6ba5('0x1')]={'priority':{'type':Sequelize[_0x6ba5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6ba5('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6ba5('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6ba5('0x3')],'defaultValue':_0x6ba5('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 2412ab8..5b9915b 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 _0xc7da=['update','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','send','index','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','WhatsappApplication','includeAll','include','findAll','rows','show','params','options','find','catch','create'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xc7da,0xf2));var _0xac7d=function(_0x5467ab,_0x1b46fd){_0x5467ab=_0x5467ab-0x0;var _0x2118a1=_0xc7da[_0x5467ab];return _0x2118a1;};'use strict';var emlformat=require(_0xac7d('0x0'));var rimraf=require(_0xac7d('0x1'));var zipdir=require(_0xac7d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac7d('0x3'));var moment=require(_0xac7d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xac7d('0x5'));var util=require(_0xac7d('0x6'));var path=require('path');var sox=require(_0xac7d('0x7'));var csv=require(_0xac7d('0x8'));var ejs=require(_0xac7d('0x9'));var fs=require('fs');var fs_extra=require(_0xac7d('0xa'));var _=require(_0xac7d('0xb'));var squel=require(_0xac7d('0xc'));var crypto=require('crypto');var jsforce=require(_0xac7d('0xd'));var deskjs=require(_0xac7d('0xe'));var toCsv=require(_0xac7d('0x8'));var querystring=require(_0xac7d('0xf'));var Papa=require(_0xac7d('0x10'));var Redis=require(_0xac7d('0x11'));var authService=require(_0xac7d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xac7d('0x13'));var hardwareService=require(_0xac7d('0x14'));var logger=require(_0xac7d('0x15'))('api');var utils=require(_0xac7d('0x16'));var config=require(_0xac7d('0x17'));var licenseUtil=require(_0xac7d('0x18'));var db=require(_0xac7d('0x19'))['db'];function respondWithStatusCode(_0x5a44f6,_0xe5de7e){_0xe5de7e=_0xe5de7e||0xcc;return function(_0x2b70a4){if(_0x2b70a4){return _0x5a44f6[_0xac7d('0x1a')](_0xe5de7e);}return _0x5a44f6[_0xac7d('0x1b')](_0xe5de7e)[_0xac7d('0x1c')]();};}function respondWithResult(_0x5678d7,_0x39ba25){_0x39ba25=_0x39ba25||0xc8;return function(_0x5b94e9){if(_0x5b94e9){return _0x5678d7[_0xac7d('0x1b')](_0x39ba25)[_0xac7d('0x1d')](_0x5b94e9);}};}function respondWithFilteredResult(_0x34980f,_0x355209){return function(_0x533bac){if(_0x533bac){var _0x19e7ba=typeof _0x355209[_0xac7d('0x1e')]===_0xac7d('0x1f')&&typeof _0x355209[_0xac7d('0x20')]===_0xac7d('0x1f');var _0x48ac86=_0x533bac[_0xac7d('0x21')];var _0x3cb12d=_0x19e7ba?0x0:_0x355209['offset'];var _0x2e4790=_0x19e7ba?_0x533bac[_0xac7d('0x21')]:_0x355209[_0xac7d('0x1e')]+_0x355209[_0xac7d('0x20')];var _0x4a5325;if(_0x2e4790>=_0x48ac86){_0x2e4790=_0x48ac86;_0x4a5325=0xc8;}else{_0x4a5325=0xce;}_0x34980f[_0xac7d('0x1b')](_0x4a5325);return _0x34980f[_0xac7d('0x22')](_0xac7d('0x23'),_0x3cb12d+'-'+_0x2e4790+'/'+_0x48ac86)['json'](_0x533bac);}return null;};}function patchUpdates(_0xd42c40){return function(_0x4f4e4e){try{jsonpatch[_0xac7d('0x24')](_0x4f4e4e,_0xd42c40,!![]);}catch(_0x3eedf8){return BPromise[_0xac7d('0x25')](_0x3eedf8);}return _0x4f4e4e[_0xac7d('0x26')]();};}function saveUpdates(_0x321689,_0x365269){return function(_0x5a006e){if(_0x5a006e){return _0x5a006e['update'](_0x321689)[_0xac7d('0x27')](function(_0x6d2c50){return _0x6d2c50;});}return null;};}function removeEntity(_0x5098bb,_0x4282d7){return function(_0x3966dd){if(_0x3966dd){return _0x3966dd[_0xac7d('0x28')]()[_0xac7d('0x27')](function(){_0x5098bb[_0xac7d('0x1b')](0xcc)[_0xac7d('0x1c')]();});}};}function handleEntityNotFound(_0x200562,_0x3bb7dd){return function(_0x42e313){if(!_0x42e313){_0x200562[_0xac7d('0x1a')](0x194);}return _0x42e313;};}function handleError(_0x594d6e,_0x229ecd){_0x229ecd=_0x229ecd||0x1f4;return function(_0x3216cb){logger[_0xac7d('0x29')](_0x3216cb[_0xac7d('0x2a')]);if(_0x3216cb['name']){delete _0x3216cb['name'];}_0x594d6e['status'](_0x229ecd)[_0xac7d('0x2b')](_0x3216cb);};}exports[_0xac7d('0x2c')]=function(_0xac3f87,_0x5bd39b){var _0x51df23={},_0x506b88={},_0x4e2456={'count':0x0,'rows':[]};var _0x5e5f12=_['map'](db['WhatsappApplication'][_0xac7d('0x2d')],function(_0x1109b1){return{'name':_0x1109b1[_0xac7d('0x2e')],'type':_0x1109b1[_0xac7d('0x2f')][_0xac7d('0x30')]};});_0x506b88['model']=_['map'](_0x5e5f12,_0xac7d('0x31'));_0x506b88[_0xac7d('0x32')]=_[_0xac7d('0x33')](_0xac3f87[_0xac7d('0x32')]);_0x506b88[_0xac7d('0x34')]=_[_0xac7d('0x35')](_0x506b88[_0xac7d('0x36')],_0x506b88[_0xac7d('0x32')]);_0x51df23[_0xac7d('0x37')]=_[_0xac7d('0x35')](_0x506b88[_0xac7d('0x36')],qs[_0xac7d('0x38')](_0xac3f87[_0xac7d('0x32')][_0xac7d('0x38')]));_0x51df23[_0xac7d('0x37')]=_0x51df23[_0xac7d('0x37')]['length']?_0x51df23[_0xac7d('0x37')]:_0x506b88[_0xac7d('0x36')];if(!_0xac3f87[_0xac7d('0x32')][_0xac7d('0x39')](_0xac7d('0x3a'))){_0x51df23['limit']=qs[_0xac7d('0x20')](_0xac3f87['query']['limit']);_0x51df23[_0xac7d('0x1e')]=qs[_0xac7d('0x1e')](_0xac3f87[_0xac7d('0x32')][_0xac7d('0x1e')]);}_0x51df23[_0xac7d('0x3b')]=qs[_0xac7d('0x3c')](_0xac3f87[_0xac7d('0x32')][_0xac7d('0x3c')]);_0x51df23[_0xac7d('0x3d')]=qs[_0xac7d('0x34')](_[_0xac7d('0x3e')](_0xac3f87['query'],_0x506b88['filters']),_0x5e5f12);if(_0xac3f87[_0xac7d('0x32')]['filter']){_0x51df23[_0xac7d('0x3d')]=_[_0xac7d('0x3f')](_0x51df23[_0xac7d('0x3d')],{'$or':_[_0xac7d('0x40')](_0x5e5f12,function(_0x550b7b){if(_0x550b7b['type']!==_0xac7d('0x41')){var _0x38bcfa={};_0x38bcfa[_0x550b7b[_0xac7d('0x31')]]={'$like':'%'+_0xac3f87[_0xac7d('0x32')][_0xac7d('0x42')]+'%'};return _0x38bcfa;}})});}_0x51df23=_['merge']({},_0x51df23,_0xac3f87['options']);var _0x2fa792={'where':_0x51df23['where']};return db[_0xac7d('0x43')][_0xac7d('0x21')](_0x2fa792)[_0xac7d('0x27')](function(_0x4984bd){_0x4e2456[_0xac7d('0x21')]=_0x4984bd;if(_0xac3f87[_0xac7d('0x32')][_0xac7d('0x44')]){_0x51df23[_0xac7d('0x45')]=[{'all':!![]}];}return db[_0xac7d('0x43')][_0xac7d('0x46')](_0x51df23);})['then'](function(_0x4d4e6e){_0x4e2456[_0xac7d('0x47')]=_0x4d4e6e;return _0x4e2456;})[_0xac7d('0x27')](respondWithFilteredResult(_0x5bd39b,_0x51df23))['catch'](handleError(_0x5bd39b,null));};exports[_0xac7d('0x48')]=function(_0x14a658,_0x355647){var _0x5978ea={'raw':!![],'where':{'id':_0x14a658[_0xac7d('0x49')]['id']}},_0x5f3b48={};_0x5f3b48['model']=_[_0xac7d('0x33')](db[_0xac7d('0x43')][_0xac7d('0x2d')]);_0x5f3b48[_0xac7d('0x32')]=_[_0xac7d('0x33')](_0x14a658[_0xac7d('0x32')]);_0x5f3b48[_0xac7d('0x34')]=_[_0xac7d('0x35')](_0x5f3b48[_0xac7d('0x36')],_0x5f3b48[_0xac7d('0x32')]);_0x5978ea['attributes']=_[_0xac7d('0x35')](_0x5f3b48[_0xac7d('0x36')],qs[_0xac7d('0x38')](_0x14a658[_0xac7d('0x32')][_0xac7d('0x38')]));_0x5978ea[_0xac7d('0x37')]=_0x5978ea[_0xac7d('0x37')]['length']?_0x5978ea[_0xac7d('0x37')]:_0x5f3b48[_0xac7d('0x36')];if(_0x14a658['query'][_0xac7d('0x44')]){_0x5978ea[_0xac7d('0x45')]=[{'all':!![]}];}_0x5978ea=_[_0xac7d('0x3f')]({},_0x5978ea,_0x14a658[_0xac7d('0x4a')]);return db[_0xac7d('0x43')][_0xac7d('0x4b')](_0x5978ea)[_0xac7d('0x27')](handleEntityNotFound(_0x355647,null))['then'](respondWithResult(_0x355647,null))[_0xac7d('0x4c')](handleError(_0x355647,null));};exports[_0xac7d('0x4d')]=function(_0x59d07e,_0x2231dd){return db[_0xac7d('0x43')][_0xac7d('0x4d')](_0x59d07e['body'],{})[_0xac7d('0x27')](respondWithResult(_0x2231dd,0xc9))[_0xac7d('0x4c')](handleError(_0x2231dd,null));};exports[_0xac7d('0x4e')]=function(_0x302794,_0x57e0c2){if(_0x302794[_0xac7d('0x4f')]['id']){delete _0x302794[_0xac7d('0x4f')]['id'];}return db[_0xac7d('0x43')][_0xac7d('0x4b')]({'where':{'id':_0x302794[_0xac7d('0x49')]['id']}})['then'](handleEntityNotFound(_0x57e0c2,null))['then'](saveUpdates(_0x302794[_0xac7d('0x4f')],null))[_0xac7d('0x27')](respondWithResult(_0x57e0c2,null))[_0xac7d('0x4c')](handleError(_0x57e0c2,null));};exports['destroy']=function(_0x1c2fc0,_0x55d683){return db[_0xac7d('0x43')][_0xac7d('0x4b')]({'where':{'id':_0x1c2fc0[_0xac7d('0x49')]['id']}})[_0xac7d('0x27')](handleEntityNotFound(_0x55d683,null))[_0xac7d('0x27')](removeEntity(_0x55d683,null))[_0xac7d('0x4c')](handleError(_0x55d683,null));}; \ No newline at end of file +var _0x6afc=['rows','show','params','rawAttributes','find','catch','create','body','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','index','map','WhatsappApplication','type','key','query','intersection','model','attributes','fields','length','nolimit','sort','filters','filter','where','VIRTUAL','merge','options','includeAll','include','findAll'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x6afc,0x16b));var _0xc6af=function(_0x1aad3a,_0x594bf3){_0x1aad3a=_0x1aad3a-0x0;var _0x1b13a3=_0x6afc[_0x1aad3a];return _0x1b13a3;};'use strict';var emlformat=require(_0xc6af('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc6af('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc6af('0x2'));var moment=require(_0xc6af('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc6af('0x4'));var util=require(_0xc6af('0x5'));var path=require(_0xc6af('0x6'));var sox=require(_0xc6af('0x7'));var csv=require('to-csv');var ejs=require(_0xc6af('0x8'));var fs=require('fs');var fs_extra=require(_0xc6af('0x9'));var _=require(_0xc6af('0xa'));var squel=require(_0xc6af('0xb'));var crypto=require(_0xc6af('0xc'));var jsforce=require(_0xc6af('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc6af('0xe'));var querystring=require(_0xc6af('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc6af('0x10'));var qs=require(_0xc6af('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6af('0x12'));var logger=require(_0xc6af('0x13'))(_0xc6af('0x14'));var utils=require('../../config/utils');var config=require(_0xc6af('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6af('0x16'))['db'];function respondWithStatusCode(_0x73a18b,_0x249554){_0x249554=_0x249554||0xcc;return function(_0x34c2f8){if(_0x34c2f8){return _0x73a18b[_0xc6af('0x17')](_0x249554);}return _0x73a18b[_0xc6af('0x18')](_0x249554)[_0xc6af('0x19')]();};}function respondWithResult(_0x2c8d30,_0x48be31){_0x48be31=_0x48be31||0xc8;return function(_0xb2f967){if(_0xb2f967){return _0x2c8d30[_0xc6af('0x18')](_0x48be31)[_0xc6af('0x1a')](_0xb2f967);}};}function respondWithFilteredResult(_0x2ef663,_0x12087d){return function(_0x165fea){if(_0x165fea){var _0x2a4b88=typeof _0x12087d[_0xc6af('0x1b')]===_0xc6af('0x1c')&&typeof _0x12087d[_0xc6af('0x1d')]===_0xc6af('0x1c');var _0x22366d=_0x165fea[_0xc6af('0x1e')];var _0x5dde9d=_0x2a4b88?0x0:_0x12087d[_0xc6af('0x1b')];var _0x3d75b8=_0x2a4b88?_0x165fea['count']:_0x12087d[_0xc6af('0x1b')]+_0x12087d[_0xc6af('0x1d')];var _0x28f9a9;if(_0x3d75b8>=_0x22366d){_0x3d75b8=_0x22366d;_0x28f9a9=0xc8;}else{_0x28f9a9=0xce;}_0x2ef663['status'](_0x28f9a9);return _0x2ef663[_0xc6af('0x1f')]('Content-Range',_0x5dde9d+'-'+_0x3d75b8+'/'+_0x22366d)[_0xc6af('0x1a')](_0x165fea);}return null;};}function patchUpdates(_0x488ca4){return function(_0xdd5f5b){try{jsonpatch[_0xc6af('0x20')](_0xdd5f5b,_0x488ca4,!![]);}catch(_0x1085b2){return BPromise[_0xc6af('0x21')](_0x1085b2);}return _0xdd5f5b[_0xc6af('0x22')]();};}function saveUpdates(_0x1e1ae,_0x85cc2c){return function(_0x1e0e37){if(_0x1e0e37){return _0x1e0e37[_0xc6af('0x23')](_0x1e1ae)[_0xc6af('0x24')](function(_0x3438aa){return _0x3438aa;});}return null;};}function removeEntity(_0x4bf7bf,_0x128933){return function(_0x4b1b68){if(_0x4b1b68){return _0x4b1b68[_0xc6af('0x25')]()[_0xc6af('0x24')](function(){_0x4bf7bf[_0xc6af('0x18')](0xcc)[_0xc6af('0x19')]();});}};}function handleEntityNotFound(_0x2f24c0,_0x5c844a){return function(_0x430795){if(!_0x430795){_0x2f24c0[_0xc6af('0x17')](0x194);}return _0x430795;};}function handleError(_0x35bb97,_0x38d134){_0x38d134=_0x38d134||0x1f4;return function(_0x4f931c){logger[_0xc6af('0x26')](_0x4f931c['stack']);if(_0x4f931c[_0xc6af('0x27')]){delete _0x4f931c[_0xc6af('0x27')];}_0x35bb97[_0xc6af('0x18')](_0x38d134)[_0xc6af('0x28')](_0x4f931c);};}exports[_0xc6af('0x29')]=function(_0x16c169,_0x4b98c8){var _0x1eabaa={},_0xf09541={},_0x173abf={'count':0x0,'rows':[]};var _0x165b64=_[_0xc6af('0x2a')](db[_0xc6af('0x2b')]['rawAttributes'],function(_0x3d8f1d){return{'name':_0x3d8f1d['fieldName'],'type':_0x3d8f1d[_0xc6af('0x2c')][_0xc6af('0x2d')]};});_0xf09541['model']=_[_0xc6af('0x2a')](_0x165b64,_0xc6af('0x27'));_0xf09541[_0xc6af('0x2e')]=_['keys'](_0x16c169[_0xc6af('0x2e')]);_0xf09541['filters']=_[_0xc6af('0x2f')](_0xf09541[_0xc6af('0x30')],_0xf09541['query']);_0x1eabaa[_0xc6af('0x31')]=_[_0xc6af('0x2f')](_0xf09541[_0xc6af('0x30')],qs['fields'](_0x16c169[_0xc6af('0x2e')][_0xc6af('0x32')]));_0x1eabaa['attributes']=_0x1eabaa[_0xc6af('0x31')][_0xc6af('0x33')]?_0x1eabaa[_0xc6af('0x31')]:_0xf09541[_0xc6af('0x30')];if(!_0x16c169[_0xc6af('0x2e')]['hasOwnProperty'](_0xc6af('0x34'))){_0x1eabaa['limit']=qs[_0xc6af('0x1d')](_0x16c169[_0xc6af('0x2e')][_0xc6af('0x1d')]);_0x1eabaa[_0xc6af('0x1b')]=qs[_0xc6af('0x1b')](_0x16c169['query'][_0xc6af('0x1b')]);}_0x1eabaa['order']=qs[_0xc6af('0x35')](_0x16c169[_0xc6af('0x2e')][_0xc6af('0x35')]);_0x1eabaa['where']=qs[_0xc6af('0x36')](_['pick'](_0x16c169[_0xc6af('0x2e')],_0xf09541['filters']),_0x165b64);if(_0x16c169[_0xc6af('0x2e')][_0xc6af('0x37')]){_0x1eabaa[_0xc6af('0x38')]=_['merge'](_0x1eabaa[_0xc6af('0x38')],{'$or':_[_0xc6af('0x2a')](_0x165b64,function(_0xf683ee){if(_0xf683ee[_0xc6af('0x2c')]!==_0xc6af('0x39')){var _0x257fd4={};_0x257fd4[_0xf683ee[_0xc6af('0x27')]]={'$like':'%'+_0x16c169[_0xc6af('0x2e')][_0xc6af('0x37')]+'%'};return _0x257fd4;}})});}_0x1eabaa=_[_0xc6af('0x3a')]({},_0x1eabaa,_0x16c169[_0xc6af('0x3b')]);var _0xf6098f={'where':_0x1eabaa[_0xc6af('0x38')]};return db[_0xc6af('0x2b')]['count'](_0xf6098f)[_0xc6af('0x24')](function(_0x51d257){_0x173abf[_0xc6af('0x1e')]=_0x51d257;if(_0x16c169[_0xc6af('0x2e')][_0xc6af('0x3c')]){_0x1eabaa[_0xc6af('0x3d')]=[{'all':!![]}];}return db[_0xc6af('0x2b')][_0xc6af('0x3e')](_0x1eabaa);})[_0xc6af('0x24')](function(_0x143e39){_0x173abf[_0xc6af('0x3f')]=_0x143e39;return _0x173abf;})[_0xc6af('0x24')](respondWithFilteredResult(_0x4b98c8,_0x1eabaa))['catch'](handleError(_0x4b98c8,null));};exports[_0xc6af('0x40')]=function(_0x1057ce,_0x46897d){var _0x365b48={'raw':!![],'where':{'id':_0x1057ce[_0xc6af('0x41')]['id']}},_0xcac00f={};_0xcac00f[_0xc6af('0x30')]=_['keys'](db['WhatsappApplication'][_0xc6af('0x42')]);_0xcac00f[_0xc6af('0x2e')]=_['keys'](_0x1057ce[_0xc6af('0x2e')]);_0xcac00f[_0xc6af('0x36')]=_['intersection'](_0xcac00f[_0xc6af('0x30')],_0xcac00f[_0xc6af('0x2e')]);_0x365b48[_0xc6af('0x31')]=_['intersection'](_0xcac00f['model'],qs['fields'](_0x1057ce['query'][_0xc6af('0x32')]));_0x365b48[_0xc6af('0x31')]=_0x365b48[_0xc6af('0x31')]['length']?_0x365b48[_0xc6af('0x31')]:_0xcac00f[_0xc6af('0x30')];if(_0x1057ce[_0xc6af('0x2e')][_0xc6af('0x3c')]){_0x365b48['include']=[{'all':!![]}];}_0x365b48=_['merge']({},_0x365b48,_0x1057ce['options']);return db[_0xc6af('0x2b')][_0xc6af('0x43')](_0x365b48)[_0xc6af('0x24')](handleEntityNotFound(_0x46897d,null))[_0xc6af('0x24')](respondWithResult(_0x46897d,null))[_0xc6af('0x44')](handleError(_0x46897d,null));};exports[_0xc6af('0x45')]=function(_0x15ffb2,_0x251311){return db['WhatsappApplication'][_0xc6af('0x45')](_0x15ffb2[_0xc6af('0x46')],{})['then'](respondWithResult(_0x251311,0xc9))[_0xc6af('0x44')](handleError(_0x251311,null));};exports[_0xc6af('0x23')]=function(_0x1696b3,_0x50c1b0){if(_0x1696b3[_0xc6af('0x46')]['id']){delete _0x1696b3['body']['id'];}return db[_0xc6af('0x2b')][_0xc6af('0x43')]({'where':{'id':_0x1696b3[_0xc6af('0x41')]['id']}})[_0xc6af('0x24')](handleEntityNotFound(_0x50c1b0,null))[_0xc6af('0x24')](saveUpdates(_0x1696b3[_0xc6af('0x46')],null))[_0xc6af('0x24')](respondWithResult(_0x50c1b0,null))[_0xc6af('0x44')](handleError(_0x50c1b0,null));};exports[_0xc6af('0x25')]=function(_0x47e83c,_0xc2219f){return db[_0xc6af('0x2b')][_0xc6af('0x43')]({'where':{'id':_0x47e83c[_0xc6af('0x41')]['id']}})['then'](handleEntityNotFound(_0xc2219f,null))[_0xc6af('0x24')](removeEntity(_0xc2219f,null))[_0xc6af('0x44')](handleError(_0xc2219f,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 0238b9b..d07690f 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 _0x2494=['api','moment','bluebird','request-promise','path','./whatsappApplication.attributes','define','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x477524,_0x4f1513){var _0x6c7695=function(_0x478402){while(--_0x478402){_0x477524['push'](_0x477524['shift']());}};_0x6c7695(++_0x4f1513);}(_0x2494,0x82));var _0x4249=function(_0x517d3e,_0x540074){_0x517d3e=_0x517d3e-0x0;var _0x451801=_0x2494[_0x517d3e];return _0x451801;};'use strict';var _=require(_0x4249('0x0'));var util=require('util');var logger=require(_0x4249('0x1'))(_0x4249('0x2'));var moment=require(_0x4249('0x3'));var BPromise=require(_0x4249('0x4'));var rp=require(_0x4249('0x5'));var fs=require('fs');var path=require(_0x4249('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4249('0x7'));module['exports']=function(_0x3c2d8d,_0x1d4ca8){return _0x3c2d8d[_0x4249('0x8')]('WhatsappApplication',attributes,{'tableName':_0x4249('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4249('0xa'),'collate':_0x4249('0xb')});}; \ No newline at end of file +var _0x6737=['utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./whatsappApplication.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6737,0xe2));var _0x7673=function(_0x455c3f,_0x501539){_0x455c3f=_0x455c3f-0x0;var _0x3ea657=_0x6737[_0x455c3f];return _0x3ea657;};'use strict';var _=require('lodash');var util=require(_0x7673('0x0'));var logger=require(_0x7673('0x1'))('api');var moment=require(_0x7673('0x2'));var BPromise=require(_0x7673('0x3'));var rp=require(_0x7673('0x4'));var fs=require('fs');var path=require(_0x7673('0x5'));var rimraf=require('rimraf');var config=require(_0x7673('0x6'));var attributes=require(_0x7673('0x7'));module['exports']=function(_0x2f5edc,_0x15230f){return _0x2f5edc['define']('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7673('0x8')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index e61a54f..361aac9 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 _0x668b=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x48e0b5,_0x102895){var _0x5a71d8=function(_0x36777b){while(--_0x36777b){_0x48e0b5['push'](_0x48e0b5['shift']());}};_0x5a71d8(++_0x102895);}(_0x668b,0x140));var _0xb668=function(_0x8dc04d,_0xaa7559){_0x8dc04d=_0x8dc04d-0x0;var _0x2f5f28=_0x668b[_0x8dc04d];return _0x2f5f28;};'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});function respondWithRpcPromise(_0x3be92e,_0x2778e9,_0x20b749){return new BPromise(function(_0x3f01bc,_0x517fc5){return client[_0xb668('0xa')](_0x3be92e,_0x20b749)[_0xb668('0xb')](function(_0x128cf5){logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));logger[_0xb668('0xf')](_0xb668('0x10'),_0x2778e9,'request\x20sent',JSON[_0xb668('0x11')](_0x128cf5));if(_0x128cf5[_0xb668('0x12')]){if(_0x128cf5[_0xb668('0x12')][_0xb668('0x13')]===0x1f4){logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x517fc5(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x3f01bc(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}else{logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));_0x3f01bc(_0x128cf5[_0xb668('0x15')][_0xb668('0x14')]);}})[_0xb668('0x16')](function(_0x4ab137){logger[_0xb668('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2778e9,_0x4ab137);_0x517fc5(_0x4ab137);});});} \ No newline at end of file +var _0xa41a=['rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x34fd54,_0x379d6e){var _0x2c4008=function(_0x369846){while(--_0x369846){_0x34fd54['push'](_0x34fd54['shift']());}};_0x2c4008(++_0x379d6e);}(_0xa41a,0x6b));var _0xaa41=function(_0x2c43e9,_0x3d63ed){_0x2c43e9=_0x2c43e9-0x0;var _0x1fe61d=_0xa41a[_0x2c43e9];return _0x1fe61d;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 81f1044..b8510c7 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 _0x7c09=['whatsapp','whatsappinteraction:addtags','put','/:id','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','/describe','isAuthenticated','describe','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked'];(function(_0x513545,_0x158f2e){var _0x18b7c5=function(_0x58514c){while(--_0x58514c){_0x513545['push'](_0x513545['shift']());}};_0x18b7c5(++_0x158f2e);}(_0x7c09,0x102));var _0x97c0=function(_0x40680b,_0x301be){_0x40680b=_0x40680b-0x0;var _0x2758f6=_0x7c09[_0x40680b];return _0x2758f6;};'use strict';var multer=require('multer');var util=require(_0x97c0('0x0'));var path=require(_0x97c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x97c0('0x2'));var router=express[_0x97c0('0x3')]();var fs_extra=require(_0x97c0('0x4'));var auth=require(_0x97c0('0x5'));var interaction=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var controller=require(_0x97c0('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x97c0('0x9')](_0x97c0('0xa'),auth[_0x97c0('0xb')](),controller[_0x97c0('0xc')]);router[_0x97c0('0x9')]('/:id',auth[_0x97c0('0xb')](),controller['show']);router[_0x97c0('0x9')](_0x97c0('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0x97c0('0x9')](_0x97c0('0xe'),auth[_0x97c0('0xb')](),controller[_0x97c0('0xf')]);router[_0x97c0('0x10')]('/',auth[_0x97c0('0xb')](),controller[_0x97c0('0x11')]);router[_0x97c0('0x10')](_0x97c0('0xd'),auth[_0x97c0('0xb')](),controller[_0x97c0('0x12')]);router[_0x97c0('0x10')](_0x97c0('0x13'),auth['isAuthenticated'](),interaction[_0x97c0('0x14')](_0x97c0('0x15'),_0x97c0('0x16')),controller['addTags']);router[_0x97c0('0x17')](_0x97c0('0x18'),auth[_0x97c0('0xb')](),interaction[_0x97c0('0x14')](_0x97c0('0x15'),_0x97c0('0x19')),controller['update']);router[_0x97c0('0x1a')](_0x97c0('0x18'),auth['isAuthenticated'](),interaction[_0x97c0('0x14')](_0x97c0('0x15'),_0x97c0('0x1b')),controller[_0x97c0('0x1c')]);router[_0x97c0('0x1a')](_0x97c0('0x13'),auth[_0x97c0('0xb')](),controller[_0x97c0('0x1d')]);module[_0x97c0('0x1e')]=router; \ No newline at end of file +var _0xa46e=['get','index','isAuthenticated','describe','/:id','getMessages','/:id/download','download','create','/:id/messages','post','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x25e934,_0x4757dd){var _0x162c25=function(_0x5c8c4e){while(--_0x5c8c4e){_0x25e934['push'](_0x25e934['shift']());}};_0x162c25(++_0x4757dd);}(_0xa46e,0x8a));var _0xea46=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0xa46e[_0x420b24];return _0x4da552;};'use strict';var multer=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var path=require('path');var timeout=require(_0xea46('0x2'));var express=require(_0xea46('0x3'));var router=express[_0xea46('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xea46('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xea46('0x6'));var controller=require('./whatsappInteraction.controller');router[_0xea46('0x7')]('/',auth['isAuthenticated'](),controller[_0xea46('0x8')]);router[_0xea46('0x7')]('/describe',auth[_0xea46('0x9')](),controller[_0xea46('0xa')]);router[_0xea46('0x7')](_0xea46('0xb'),auth[_0xea46('0x9')](),controller['show']);router['get']('/:id/messages',auth[_0xea46('0x9')](),controller[_0xea46('0xc')]);router['get'](_0xea46('0xd'),auth[_0xea46('0x9')](),controller[_0xea46('0xe')]);router['post']('/',auth[_0xea46('0x9')](),controller[_0xea46('0xf')]);router['post'](_0xea46('0x10'),auth[_0xea46('0x9')](),controller['addMessage']);router[_0xea46('0x11')]('/:id/tags',auth[_0xea46('0x9')](),interaction[_0xea46('0x12')](_0xea46('0x13'),_0xea46('0x14')),controller[_0xea46('0x15')]);router[_0xea46('0x16')](_0xea46('0xb'),auth[_0xea46('0x9')](),interaction[_0xea46('0x12')]('whatsapp',_0xea46('0x17')),controller[_0xea46('0x18')]);router[_0xea46('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0xea46('0x12')](_0xea46('0x13'),'whatsappinteraction:destroy'),controller['destroy']);router[_0xea46('0x19')](_0xea46('0x1a'),auth['isAuthenticated'](),controller[_0xea46('0x1b')]);module[_0xea46('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 be01b32..274bb55 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 _0x9206=['exports','BOOLEAN','DATE','STRING','out','ENUM','sequelize','moment'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9206,0x176));var _0x6920=function(_0x901bcf,_0x45f57a){_0x901bcf=_0x901bcf-0x0;var _0x2cf3fb=_0x9206[_0x901bcf];return _0x2cf3fb;};'use strict';var Sequelize=require(_0x6920('0x0'));var moment=require(_0x6920('0x1'));module[_0x6920('0x2')]={'closed':{'type':Sequelize[_0x6920('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6920('0x4')]},'disposition':{'type':Sequelize[_0x6920('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6920('0x5')]},'phone':{'type':Sequelize[_0x6920('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6920('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6920('0x7')]('in',_0x6920('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6920('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9432=['sequelize','moment','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0x9432,0x1e3));var _0x2943=function(_0x2616d6,_0x560d27){_0x2616d6=_0x2616d6-0x0;var _0x34c8db=_0x9432[_0x2616d6];return _0x34c8db;};'use strict';var Sequelize=require(_0x2943('0x0'));var moment=require(_0x2943('0x1'));module['exports']={'closed':{'type':Sequelize[_0x2943('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2943('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2943('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x2943('0x4')]},'read1stAt':{'type':Sequelize[_0x2943('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x2943('0x5')]('in',_0x2943('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2943('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2943('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2943('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 94e167a..2af4897 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 _0x77a9=['Tags','TagIds','split','push','then','catch','waiting','talking','unmanaged','closed','UserId','answered','total','WhatsappInteraction','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','select','field','from','tools_tags','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','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','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','some','compact','isEmpty','forEach','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','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)','contactName','DESC','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','toString','sequelize','keyBy','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.phone','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','rows','show','params','includeAll','merge','options','create','body','addMessage','WhatsappMessage','ids','omit','getMessages','hasOwnProperty','pick','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','Tag','color','emit','removeTags','download','join','server','files','tmp','transcript-%d-%s.zip','User','lastName','attachments','Attachment','direction','secret','WhatsappAccount','Owner','get','mkdirSync','Account','N.A.','closedAt','disposition','Messages','basename','createReadStream','createWriteStream','out','System','firstName','root','views','downloadInteraction.ejs','transcript-','Whatsapp','log','err','unlinkSync','sendStatus','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','undefined','count','offset','limit','apply','save','update','destroy','error','name','send','Users','map','fullname'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x77a9,0x19e));var _0x977a=function(_0x5303ff,_0x173752){_0x5303ff=_0x5303ff-0x0;var _0x20e3f5=_0x77a9[_0x5303ff];return _0x20e3f5;};'use strict';var emlformat=require(_0x977a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x977a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x977a('0x2'));var moment=require(_0x977a('0x3'));var BPromise=require(_0x977a('0x4'));var Mustache=require(_0x977a('0x5'));var util=require('util');var path=require(_0x977a('0x6'));var sox=require(_0x977a('0x7'));var csv=require(_0x977a('0x8'));var ejs=require(_0x977a('0x9'));var fs=require('fs');var fs_extra=require(_0x977a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x977a('0xb'));var jsforce=require(_0x977a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x977a('0x8'));var querystring=require(_0x977a('0xd'));var Papa=require(_0x977a('0xe'));var Redis=require(_0x977a('0xf'));var authService=require(_0x977a('0x10'));var qs=require(_0x977a('0x11'));var as=require(_0x977a('0x12'));var pdf=require(_0x977a('0x13'));var hardwareService=require(_0x977a('0x14'));var logger=require(_0x977a('0x15'))('api');var utils=require(_0x977a('0x16'));var config=require(_0x977a('0x17'));var licenseUtil=require(_0x977a('0x18'));var db=require(_0x977a('0x19'))['db'];config[_0x977a('0x1a')]=_[_0x977a('0x1b')](config[_0x977a('0x1a')],{'host':_0x977a('0x1c'),'port':0x18eb});var socket=require(_0x977a('0x1d'))(new Redis(config[_0x977a('0x1a')]));require('./whatsappInteraction.socket')[_0x977a('0x1e')](socket);function respondWithStatusCode(_0x50c631,_0x1f884a){_0x1f884a=_0x1f884a||0xcc;return function(_0x237946){if(_0x237946){return _0x50c631['sendStatus'](_0x1f884a);}return _0x50c631[_0x977a('0x1f')](_0x1f884a)[_0x977a('0x20')]();};}function respondWithResult(_0x25e169,_0x1478d0){_0x1478d0=_0x1478d0||0xc8;return function(_0x5a352c){if(_0x5a352c){return _0x25e169[_0x977a('0x1f')](_0x1478d0)[_0x977a('0x21')](_0x5a352c);}};}function respondWithFilteredResult(_0x2d47a0,_0x5b57bd){return function(_0x3e7dac){if(_0x3e7dac){var _0x20b70b=typeof _0x5b57bd['offset']===_0x977a('0x22')&&typeof _0x5b57bd['limit']===_0x977a('0x22');var _0x37a2e0=_0x3e7dac[_0x977a('0x23')];var _0xcbb2df=_0x20b70b?0x0:_0x5b57bd[_0x977a('0x24')];var _0x558d1d=_0x20b70b?_0x3e7dac[_0x977a('0x23')]:_0x5b57bd[_0x977a('0x24')]+_0x5b57bd[_0x977a('0x25')];var _0x3cf5dc;if(_0x558d1d>=_0x37a2e0){_0x558d1d=_0x37a2e0;_0x3cf5dc=0xc8;}else{_0x3cf5dc=0xce;}_0x2d47a0[_0x977a('0x1f')](_0x3cf5dc);return _0x2d47a0['set']('Content-Range',_0xcbb2df+'-'+_0x558d1d+'/'+_0x37a2e0)[_0x977a('0x21')](_0x3e7dac);}return null;};}function patchUpdates(_0x36134f){return function(_0x3f99c3){try{jsonpatch[_0x977a('0x26')](_0x3f99c3,_0x36134f,!![]);}catch(_0x2f7547){return BPromise['reject'](_0x2f7547);}return _0x3f99c3[_0x977a('0x27')]();};}function saveUpdates(_0x5e9ed5,_0x35888f){return function(_0x3cc264){if(_0x3cc264){return _0x3cc264[_0x977a('0x28')](_0x5e9ed5)['then'](function(_0x3734ac){return _0x3734ac;});}return null;};}function removeEntity(_0x1efd0a,_0x1c6195){return function(_0x56eafc){if(_0x56eafc){return _0x56eafc[_0x977a('0x29')]()['then'](function(){_0x1efd0a[_0x977a('0x1f')](0xcc)[_0x977a('0x20')]();});}};}function handleEntityNotFound(_0x141e1d,_0x562dfd){return function(_0x5d98ea){if(!_0x5d98ea){_0x141e1d['sendStatus'](0x194);}return _0x5d98ea;};}function handleError(_0x4c7256,_0x49c961){_0x49c961=_0x49c961||0x1f4;return function(_0x48fa58){logger[_0x977a('0x2a')](_0x48fa58['stack']);if(_0x48fa58[_0x977a('0x2b')]){delete _0x48fa58['name'];}_0x4c7256[_0x977a('0x1f')](_0x49c961)[_0x977a('0x2c')](_0x48fa58);};}function getInteractionUsers(_0x1c1d57,_0x32a816){return new BPromise(function(_0x53aad3,_0x1f1063){try{if(_0x32a816[_0x1c1d57['id']]){_0x1c1d57[_0x977a('0x2d')]=_[_0x977a('0x2e')](_0x32a816[_0x1c1d57['id']],function(_0x2a55c6){return{'id':_0x2a55c6['id'],'fullname':_0x2a55c6[_0x977a('0x2f')]};});}}catch(_0x4f2dc4){_0x1f1063(_0x4f2dc4);}_0x53aad3(_0x1c1d57);});}function getInteractionTags(_0x4ad03b,_0x40fe6c){return new BPromise(function(_0x1a706f,_0x30c0be){try{if(_0x4ad03b['TagIds']){_0x4ad03b[_0x977a('0x30')]=[];_0x4ad03b[_0x977a('0x31')][_0x977a('0x32')](',')['forEach'](function(_0x2ee08d){_0x4ad03b[_0x977a('0x30')][_0x977a('0x33')](_0x40fe6c[_0x2ee08d]);});}delete _0x4ad03b[_0x977a('0x31')];}catch(_0xb24503){_0x30c0be(_0xb24503);}_0x1a706f(_0x4ad03b);});}function updateWhatsappInteraction(_0x4cb361,_0x2242dc,_0xe08a54){return new BPromise(function(_0x3f7eb2,_0x3ed20a){return getInteractionUsers(_0x4cb361,_0xe08a54)[_0x977a('0x34')](function(_0x1a0344){return getInteractionTags(_0x1a0344,_0x2242dc);})[_0x977a('0x34')](function(_0x6346af){return getStateInteraction(_0x6346af);})['then'](function(_0x372007){_0x3f7eb2(_0x372007);})[_0x977a('0x35')](function(_0x2f40fb){_0x3ed20a(_0x2f40fb);});});}function getStateInteraction(_0x24e3d0){return new BPromise(function(_0x3bbc63){_0x24e3d0[_0x977a('0x36')]=0x0;_0x24e3d0[_0x977a('0x37')]=0x0;_0x24e3d0['answered']=0x0;_0x24e3d0[_0x977a('0x38')]=0x0;_0x24e3d0['total']=0x0;if(!_0x24e3d0[_0x977a('0x39')]&&!_0x24e3d0['UserId']){_0x24e3d0['waiting']+=0x1;}if(!_0x24e3d0[_0x977a('0x39')]&&_0x24e3d0[_0x977a('0x3a')]){_0x24e3d0[_0x977a('0x37')]+=0x1;if(_0x24e3d0['waiting']){_0x24e3d0['waiting']-=0x1;}}if(_0x24e3d0[_0x977a('0x39')]&&_0x24e3d0[_0x977a('0x3a')]){_0x24e3d0[_0x977a('0x3b')]+=0x1;if(_0x24e3d0[_0x977a('0x37')]){_0x24e3d0['talking']-=0x1;}}if(_0x24e3d0['closed']&&!_0x24e3d0[_0x977a('0x3a')]){_0x24e3d0[_0x977a('0x38')]+=0x1;if(_0x24e3d0[_0x977a('0x36')]){_0x24e3d0['waiting']-=0x1;}}_0x24e3d0[_0x977a('0x3c')]+=0x1;_0x3bbc63(_0x24e3d0);});}exports['index']=function(_0x56063a,_0x90772f){var _0x5d397f={},_0x1f2f3f={},_0xc14fee={'count':0x0,'rows':[]};var _0x4ddef4=_[_0x977a('0x2e')](db[_0x977a('0x3d')][_0x977a('0x3e')],function(_0x375a45){return{'name':_0x375a45['fieldName'],'type':_0x375a45['type'][_0x977a('0x3f')]};});_0x1f2f3f[_0x977a('0x40')]=_[_0x977a('0x2e')](_0x4ddef4,_0x977a('0x2b'));_0x1f2f3f[_0x977a('0x41')]=_[_0x977a('0x42')](_0x56063a[_0x977a('0x41')]);_0x1f2f3f[_0x977a('0x43')]=_[_0x977a('0x44')](_0x1f2f3f['model'],_0x1f2f3f[_0x977a('0x41')]);_0x5d397f[_0x977a('0x45')]=_[_0x977a('0x44')](_0x1f2f3f[_0x977a('0x40')],qs[_0x977a('0x46')](_0x56063a[_0x977a('0x41')]['fields']));_0x5d397f[_0x977a('0x45')]=_0x5d397f[_0x977a('0x45')][_0x977a('0x47')]?_0x5d397f['attributes']:_0x1f2f3f['model'];if(!_0x56063a['query']['hasOwnProperty'](_0x977a('0x48'))){_0x5d397f[_0x977a('0x25')]=qs[_0x977a('0x25')](_0x56063a[_0x977a('0x41')][_0x977a('0x25')]);_0x5d397f[_0x977a('0x24')]=qs[_0x977a('0x24')](_0x56063a[_0x977a('0x41')][_0x977a('0x24')]);}_0x5d397f[_0x977a('0x49')]=qs[_0x977a('0x4a')](_0x56063a[_0x977a('0x41')]['sort']);_0x5d397f[_0x977a('0x4b')]=qs[_0x977a('0x43')](_['pick'](_0x56063a['query'],_0x1f2f3f[_0x977a('0x43')]),_0x4ddef4);var _0x2449d3=[];var _0x5d2651=squel[_0x977a('0x4c')]()['field']('id')[_0x977a('0x4d')](_0x977a('0x2b'))[_0x977a('0x4d')]('color')[_0x977a('0x4e')](_0x977a('0x4f'));var _0x4aeb27=squel[_0x977a('0x4c')]()['field'](_0x977a('0x50'))[_0x977a('0x4d')]('u.fullname')[_0x977a('0x4d')](_0x977a('0x51'))[_0x977a('0x4e')](_0x977a('0x52'),'ui')[_0x977a('0x53')](_0x977a('0x54'),'u',_0x977a('0x55'));var _0x902a8f=squel[_0x977a('0x4c')]()[_0x977a('0x4e')]('whatsapp_interactions','i')['left_join'](_0x977a('0x56'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x977a('0x54'),'o','o.id\x20=\x20i.UserId')['left_join']('whatsapp_accounts','a',_0x977a('0x57'))[_0x977a('0x53')]('whatsapp_messages','me','me.WhatsappInteractionId\x20=\x20i.id')[_0x977a('0x53')](_0x977a('0x58'),'it',_0x977a('0x59'))[_0x977a('0x53')](_0x977a('0x4f'),'t',_0x977a('0x5a'));var _0x1c064d=squel[_0x977a('0x5b')]();var _0x69048b=[];var _0x40c2da=squel[_0x977a('0x5b')]();var _0x4a9ed9;if(_0x56063a[_0x977a('0x41')][_0x977a('0x5c')]){_0x4a9ed9=as[_0x977a('0x5d')](_0x56063a['query'][_0x977a('0x5c')]);var _0x5598f7=_0x4a9ed9[_0x977a('0x5e')];for(var _0x1f12c5=0x0;_0x1f12c5<_0x4a9ed9[_0x977a('0x5f')]['length'];_0x1f12c5++){var _0x31bf5d=_0x4a9ed9['conditions'][_0x1f12c5];var _0x3cb168='i';var _0x2f0c36=_[_0x977a('0x60')](_0x4ddef4,[_0x977a('0x2b'),_0x31bf5d[_0x977a('0x4d')]]);if(!_0x2f0c36){switch(_0x31bf5d[_0x977a('0x4d')]){case _0x977a('0x61'):if(_0x31bf5d[_0x977a('0x62')]==0x1){_0x902a8f[_0x977a('0x63')]('`'+_0x31bf5d[_0x977a('0x4d')]+_0x977a('0x64'));}else{_0x902a8f['having']('`'+_0x31bf5d['field']+'`\x20>\x200');}break;case _0x977a('0x65'):if(_0x31bf5d[_0x977a('0x66')]===_0x977a('0x67')){if(_0x31bf5d[_0x977a('0x62')][_0x977a('0x32')]('\x20')[_0x977a('0x47')]>0x1){_0x1c064d[_0x5598f7](_0x977a('0x68'),qs[_0x977a('0x69')](_0x31bf5d[_0x977a('0x62')]),null);}else{var _0x5e4372='%'+_0x31bf5d['value']+'%';_0x1c064d[_0x5598f7](_0x977a('0x6a'),_0x5e4372,_0x5e4372,_0x5e4372);}}else{_0x2f0c36=_[_0x977a('0x60')](_0x4ddef4,['name',_0x977a('0x6b')]);_0x31bf5d['field']=_0x977a('0x6b');_0x2ad33f=as[_0x977a('0x6c')](_0x3cb168,_0x2f0c36[_0x977a('0x6d')],_0x31bf5d);_0x1c064d[_0x5598f7](_0x2ad33f[_0x977a('0x6e')],_0x2ad33f['value'][_0x977a('0x6f')],_0x2ad33f['value'][_0x977a('0x20')]);}break;case'Tag':var _0x1dbced=_0x31bf5d['value'][_0x977a('0x32')](',')[_0x977a('0x2e')](function(_0x2815ce){return Number(_0x2815ce);});_0x1dbced['forEach'](function(_0xd1d762){_0x40c2da['or'](_0x977a('0x70'),'%,'+_0xd1d762+',%');});_0x69048b=_[_0x977a('0x71')](_0x69048b,_0x1dbced);break;case'User':if(_0x31bf5d[_0x977a('0x66')]===_0x977a('0x67')){_0x1c064d[_0x5598f7](_0x977a('0x72'),'%'+_0x31bf5d['value']+'%',null);}else{_0x2f0c36=_['find'](_0x4ddef4,['name',_0x977a('0x3a')]);_0x31bf5d[_0x977a('0x4d')]=_0x977a('0x3a');_0x2ad33f=as['buildExpression'](_0x3cb168,_0x2f0c36[_0x977a('0x6d')],_0x31bf5d);_0x1c064d[_0x5598f7](_0x2ad33f[_0x977a('0x6e')],_0x2ad33f[_0x977a('0x62')][_0x977a('0x6f')],_0x2ad33f[_0x977a('0x62')][_0x977a('0x20')]);}break;case'body':_0x2ad33f=as[_0x977a('0x6c')]('me',null,_0x31bf5d);_0x1c064d[_0x5598f7](_0x2ad33f[_0x977a('0x6e')],_0x2ad33f[_0x977a('0x62')][_0x977a('0x6f')],_0x2ad33f[_0x977a('0x62')][_0x977a('0x20')]);break;}}else{var _0x2ad33f=as[_0x977a('0x6c')](_0x3cb168,_0x2f0c36[_0x977a('0x6d')],_0x31bf5d);_0x1c064d[_0x5598f7](_0x2ad33f[_0x977a('0x6e')],_0x2ad33f[_0x977a('0x62')][_0x977a('0x6f')],_0x2ad33f[_0x977a('0x62')]['end']);}}}else{var _0x1cd292=_(_0x56063a['query'])[_0x977a('0x42')]()[_0x977a('0x2e')](function(_0x873b10){return _[_0x977a('0x73')](_0x4ddef4,[_0x977a('0x2b'),_0x873b10])?_0x873b10:undefined;})[_0x977a('0x74')]()['value']();if(!_[_0x977a('0x75')](_0x1cd292)){_0x1cd292[_0x977a('0x76')](function(_0x1f8d6d){if(_0x1f8d6d===_0x977a('0x77')){_0x902a8f['where'](_0x977a('0x78'),[][_0x977a('0x79')](_0x56063a['query'][_0x1f8d6d]));}else if(_0x1f8d6d===_0x977a('0x7a')){var _0x2adc1f=JSON[_0x977a('0x7b')](_0x56063a[_0x977a('0x41')][_0x1f8d6d])[_0x977a('0x7c')];var _0x1532a5=JSON[_0x977a('0x7b')](_0x56063a[_0x977a('0x41')][_0x1f8d6d])[_0x977a('0x7d')];_0x902a8f['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2adc1f,_0x1532a5);}else{if(_0x56063a[_0x977a('0x41')][_0x1f8d6d]==='null'){_0x902a8f[_0x977a('0x4b')]('i.'+_0x1f8d6d+'\x20IS\x20NULL');}else{_0x902a8f[_0x977a('0x4b')]('i.'+_0x1f8d6d+'\x20=\x20?',_0x56063a[_0x977a('0x41')][_0x1f8d6d]);}}});}if(_0x56063a[_0x977a('0x41')][_0x977a('0x7e')]){if(_0x56063a[_0x977a('0x41')][_0x977a('0x7e')]==0x1){_0x902a8f['having'](_0x977a('0x7f'));}else{_0x902a8f['having'](_0x977a('0x80'));}}if(_0x56063a['query'][_0x977a('0x81')]){_0x69048b=_[_0x977a('0x82')](_0x56063a[_0x977a('0x41')]['tag'])?_0x56063a[_0x977a('0x41')][_0x977a('0x81')]:new Array(_0x56063a['query'][_0x977a('0x81')]);_0x69048b[_0x977a('0x76')](function(_0x4e0177){_0x40c2da['or'](_0x977a('0x70'),'%,'+_0x4e0177+',%');});}if(_0x56063a['query'][_0x977a('0x83')]){var _0x2c808b=_0x56063a[_0x977a('0x41')][_0x977a('0x83')][_0x977a('0x84')]('\x5c','\x5c\x5c')[_0x977a('0x84')](/'/g,'\x27\x27');if(qs[_0x977a('0x85')](_0x2c808b)){_0x1c064d['or']('i.id\x20LIKE\x20?',_0x2c808b+'%')['or'](_0x977a('0x86'),_0x2c808b+'%');}else{_0x1c064d['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2c808b))['or'](_0x977a('0x87'),_0x2c808b+'%');}}}_0x902a8f['where'](_0x1c064d);_0x902a8f[_0x977a('0x88')](_0x977a('0x89'));var _0x3d3b77={'type':db['Sequelize'][_0x977a('0x8a')][_0x977a('0x8b')],'raw':!![]};var _0x62f26a=_0x902a8f[_0x977a('0x8c')]();_0x62f26a[_0x977a('0x4d')](_0x977a('0x89'));_0x62f26a[_0x977a('0x4d')](_0x977a('0x8d'),_0x977a('0x61'));if(_0x5d397f['order']){_0x5d397f[_0x977a('0x49')]['forEach'](function(_0x4a8141){var _0x3f2ddf=_0x4a8141[0x0]===_0x977a('0x8e')?_0x4a8141[0x0]:'i.'+_0x4a8141[0x0];_0x902a8f['order'](_0x3f2ddf,_0x4a8141[0x1]===_0x977a('0x8f')?![]:!![]);});}if(!_['isEmpty'](_0x69048b)){_0x902a8f[_0x977a('0x63')](_0x40c2da);_0x62f26a[_0x977a('0x4b')]('t.id\x20IN\x20?',_0x69048b);}BPromise[_0x977a('0x90')]()[_0x977a('0x34')](function(){if(!_0x4a9ed9){if(_0x56063a[_0x977a('0x41')][_0x977a('0x77')])return;_0x62f26a['where'](_0x977a('0x91'));_0x902a8f[_0x977a('0x4b')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x56063a[_0x977a('0x92')]['role']!==_0x977a('0x93'))return;return _0x56063a[_0x977a('0x92')][_0x977a('0x94')]({'attributes':['id'],'raw':!![]})[_0x977a('0x34')](function(_0x241bd9){if(_[_0x977a('0x75')](_0x241bd9)){_0x62f26a[_0x977a('0x4b')](_0x977a('0x95'));_0x902a8f[_0x977a('0x4b')](_0x977a('0x95'));}else{_0x62f26a[_0x977a('0x4b')]('i.WhatsappAccountId\x20IN\x20?',_[_0x977a('0x2e')](_0x241bd9,'id'));_0x902a8f['where'](_0x977a('0x78'),_[_0x977a('0x2e')](_0x241bd9,'id'));}});})[_0x977a('0x34')](function(){if(_0x56063a[_0x977a('0x92')]['role']==='agent'&&!_0x4a9ed9&&!_0x56063a[_0x977a('0x41')][_0x977a('0x77')])return[];return db['sequelize'][_0x977a('0x41')](_0x62f26a[_0x977a('0x96')](),_0x3d3b77);})[_0x977a('0x34')](function(_0x4af643){_0xc14fee[_0x977a('0x23')]=_0x4af643[_0x977a('0x47')];if(_0xc14fee['count']===0x0)return[];return db[_0x977a('0x97')][_0x977a('0x41')](_0x5d2651[_0x977a('0x96')](),_0x3d3b77)[_0x977a('0x34')](function(_0x58577d){_0x2449d3=_[_0x977a('0x98')](_0x58577d,'id');_0x3d3b77=_['merge'](_0x3d3b77,{'model':db[_0x977a('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x56063a[_0x977a('0x41')][_0x977a('0x46')]){_0x5d397f['attributes'][_0x977a('0x76')](function(_0x5f32a4){_0x902a8f[_0x977a('0x4d')]('i.'+_0x5f32a4);});}else{_0x902a8f[_0x977a('0x4d')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x977a('0x61'));_0x902a8f[_0x977a('0x4d')](_0x977a('0x99'),_0x977a('0x9a'));_0x902a8f[_0x977a('0x4d')](_0x977a('0x9b'),'Account.mandatoryDisposition');_0x902a8f[_0x977a('0x4d')](_0x977a('0x9c'),_0x977a('0x8e'));_0x902a8f[_0x977a('0x4d')](_0x977a('0x9d'));_0x902a8f[_0x977a('0x4d')](_0x977a('0x9e'),_0x977a('0x9f'));_0x902a8f[_0x977a('0x4d')](_0x977a('0xa0'),_0x977a('0xa1'));_0x902a8f[_0x977a('0x4d')]('c.email','Contact.email');_0x902a8f[_0x977a('0x4d')](_0x977a('0xa2'),_0x977a('0xa3'));_0x902a8f['field']('c.mobile','Contact.mobile');_0x902a8f[_0x977a('0x4d')]('c.fax',_0x977a('0xa4'));_0x902a8f['field'](_0x977a('0xa5'),_0x977a('0xa6'));_0x902a8f[_0x977a('0x4d')]('o.internal',_0x977a('0xa7'));_0x902a8f['field'](_0x977a('0xa8'),_0x977a('0x31'));}if(_0x5d397f['limit'])_0x902a8f[_0x977a('0x25')](_0x5d397f[_0x977a('0x25')]);if(_0x5d397f[_0x977a('0x24')])_0x902a8f[_0x977a('0x24')](_0x5d397f[_0x977a('0x24')]);return db[_0x977a('0x97')][_0x977a('0x41')](_0x902a8f[_0x977a('0x96')](),_0x3d3b77);})[_0x977a('0x34')](function(_0xab8f7c){if(_0xab8f7c[_0x977a('0x47')]>0x0)_0x4aeb27[_0x977a('0x4b')](_0x977a('0xa9'),_[_0x977a('0x2e')](_0xab8f7c,'id'));return db[_0x977a('0x97')]['query'](_0x4aeb27[_0x977a('0x96')](),_0x3d3b77)['then'](function(_0x48ac4d){var _0x3cce56=_[_0x977a('0xaa')](_0x48ac4d,_0x977a('0xab'));var _0x13e8aa=[];_0xab8f7c['forEach'](function(_0x2c6431){_0x13e8aa[_0x977a('0x33')](updateWhatsappInteraction(_0x2c6431,_0x2449d3,_0x3cce56));});return BPromise['all'](_0x13e8aa);});});})[_0x977a('0x34')](function(_0x478ed7){_0xc14fee[_0x977a('0xac')]=_0x478ed7;return _0xc14fee;})[_0x977a('0x34')](respondWithFilteredResult(_0x90772f,_0x5d397f))['catch'](handleError(_0x90772f,null));};exports[_0x977a('0xad')]=function(_0x5eccfd,_0x2291e7){var _0xaf3344={'raw':![],'where':{'id':_0x5eccfd[_0x977a('0xae')]['id']}},_0x405898={};_0x405898[_0x977a('0x40')]=_[_0x977a('0x42')](db[_0x977a('0x3d')][_0x977a('0x3e')]);_0x405898[_0x977a('0x41')]=_['keys'](_0x5eccfd[_0x977a('0x41')]);_0x405898['filters']=_[_0x977a('0x44')](_0x405898[_0x977a('0x40')],_0x405898[_0x977a('0x41')]);_0xaf3344[_0x977a('0x45')]=_[_0x977a('0x44')](_0x405898[_0x977a('0x40')],qs[_0x977a('0x46')](_0x5eccfd[_0x977a('0x41')][_0x977a('0x46')]));_0xaf3344[_0x977a('0x45')]=_0xaf3344['attributes'][_0x977a('0x47')]?_0xaf3344[_0x977a('0x45')]:_0x405898[_0x977a('0x40')];if(_0x5eccfd[_0x977a('0x41')][_0x977a('0xaf')]){_0xaf3344['include']=[{'all':!![]}];}_0xaf3344=_[_0x977a('0xb0')]({},_0xaf3344,_0x5eccfd[_0x977a('0xb1')]);return db[_0x977a('0x3d')][_0x977a('0x60')](_0xaf3344)['then'](handleEntityNotFound(_0x2291e7,null))['then'](respondWithResult(_0x2291e7,null))['catch'](handleError(_0x2291e7,null));};exports[_0x977a('0xb2')]=function(_0x36cbb8,_0xd82c3b){return db[_0x977a('0x3d')]['create'](_0x36cbb8['body'],{})['then'](respondWithResult(_0xd82c3b,0xc9))[_0x977a('0x35')](handleError(_0xd82c3b,null));};exports[_0x977a('0x28')]=function(_0x33461b,_0x4ae462){if(_0x33461b['body']['id']){delete _0x33461b[_0x977a('0xb3')]['id'];}return db[_0x977a('0x3d')][_0x977a('0x60')]({'where':{'id':_0x33461b[_0x977a('0xae')]['id']}})['then'](handleEntityNotFound(_0x4ae462,null))[_0x977a('0x34')](saveUpdates(_0x33461b[_0x977a('0xb3')],null))[_0x977a('0x34')](respondWithResult(_0x4ae462,null))['catch'](handleError(_0x4ae462,null));};exports[_0x977a('0x29')]=function(_0x462da6,_0x5cc81f){return db[_0x977a('0x3d')][_0x977a('0x60')]({'where':{'id':_0x462da6['params']['id']}})[_0x977a('0x34')](handleEntityNotFound(_0x5cc81f,null))[_0x977a('0x34')](removeEntity(_0x5cc81f,null))[_0x977a('0x35')](handleError(_0x5cc81f,null));};exports['describe']=function(_0x4eef3e,_0x3923c8){return db[_0x977a('0x3d')]['describe']()[_0x977a('0x34')](respondWithResult(_0x3923c8,null))['catch'](handleError(_0x3923c8,null));};exports[_0x977a('0xb4')]=function(_0x56570b,_0xb82b06,_0x122f8d){return db[_0x977a('0xb5')][_0x977a('0x60')]({'where':{'id':_0x56570b[_0x977a('0xae')]['id']}})[_0x977a('0x34')](handleEntityNotFound(_0xb82b06,null))[_0x977a('0x34')](function(_0x5b98e4){if(_0x5b98e4){return _0x5b98e4['addMessage'](_0x56570b[_0x977a('0xb3')][_0x977a('0xb6')],_[_0x977a('0xb7')](_0x56570b[_0x977a('0xb3')],['ids','id'])||{});}})[_0x977a('0x34')](respondWithResult(_0xb82b06,null))['catch'](handleError(_0xb82b06,null));};exports[_0x977a('0xb8')]=function(_0x3abb7d,_0x76bb38,_0xa8a113){var _0x32d3f7={'raw':![],'where':{}};var _0x303a7b={};var _0x481043={'count':0x0,'rows':[]};return db[_0x977a('0x3d')]['findOne']({'where':{'id':_0x3abb7d[_0x977a('0xae')]['id']}})['then'](handleEntityNotFound(_0x76bb38,null))['then'](function(_0x5a4cbe){if(_0x5a4cbe){_0x303a7b[_0x977a('0x40')]=_['keys'](db[_0x977a('0xb5')]['rawAttributes']);_0x303a7b[_0x977a('0x41')]=_[_0x977a('0x42')](_0x3abb7d['query']);_0x303a7b[_0x977a('0x43')]=_['intersection'](_0x303a7b[_0x977a('0x40')],_0x303a7b['query']);_0x32d3f7[_0x977a('0x45')]=_[_0x977a('0x44')](_0x303a7b[_0x977a('0x40')],qs[_0x977a('0x46')](_0x3abb7d[_0x977a('0x41')][_0x977a('0x46')]));_0x32d3f7['attributes']=_0x32d3f7[_0x977a('0x45')]['length']?_0x32d3f7[_0x977a('0x45')]:_0x303a7b[_0x977a('0x40')];if(!_0x3abb7d[_0x977a('0x41')][_0x977a('0xb9')](_0x977a('0x48'))){_0x32d3f7['limit']=qs[_0x977a('0x25')](_0x3abb7d[_0x977a('0x41')]['limit']);_0x32d3f7[_0x977a('0x24')]=qs[_0x977a('0x24')](_0x3abb7d[_0x977a('0x41')][_0x977a('0x24')]);}_0x32d3f7[_0x977a('0x49')]=qs[_0x977a('0x4a')](_0x3abb7d[_0x977a('0x41')]['sort']);_0x32d3f7['where']=qs[_0x977a('0x43')](_[_0x977a('0xba')](_0x3abb7d[_0x977a('0x41')],_0x303a7b[_0x977a('0x43')]));_0x32d3f7[_0x977a('0x4b')][_0x977a('0xab')]=_0x5a4cbe['id'];if(_0x3abb7d[_0x977a('0x41')]['filter']){_0x32d3f7['where']=_[_0x977a('0xb0')](_0x32d3f7[_0x977a('0x4b')],{'$or':_[_0x977a('0x2e')](_0x32d3f7[_0x977a('0x45')],function(_0x4058e1){var _0x51648b={};_0x51648b[_0x4058e1]={'$like':'%'+_0x3abb7d[_0x977a('0x41')][_0x977a('0x83')]+'%'};return _0x51648b;})});}if(_0x3abb7d[_0x977a('0x41')]['$gte']){var _0x45b236=_0x3abb7d['query']['$gte'][_0x977a('0x32')](',');var _0x106572={};_0x106572[_0x45b236[0x0]]={'$gte':moment(_0x45b236[0x1])[_0x977a('0xbb')](_0x977a('0xbc'))};_0x32d3f7[_0x977a('0x4b')]=_[_0x977a('0xb0')](_0x32d3f7['where'],_0x106572);}_0x32d3f7=_[_0x977a('0xb0')]({},_0x32d3f7,_0x3abb7d[_0x977a('0xb1')]);return db['WhatsappMessage'][_0x977a('0x23')]({'where':_0x32d3f7[_0x977a('0x4b')]})[_0x977a('0x34')](function(_0x45a16f){_0x481043[_0x977a('0x23')]=_0x45a16f;if(_0x3abb7d[_0x977a('0x41')][_0x977a('0xaf')]){_0x32d3f7[_0x977a('0xbd')]=[{'all':!![]}];}return db[_0x977a('0xb5')][_0x977a('0xbe')](_0x32d3f7);})['then'](function(_0x484f3c){_0x481043[_0x977a('0xac')]=_0x484f3c;return _0x481043;});}})[_0x977a('0x34')](respondWithFilteredResult(_0x76bb38,_0x32d3f7))[_0x977a('0x35')](handleError(_0x76bb38,null));};exports['addTags']=function(_0x3703e1,_0x3e1f3e,_0x21eec7){return db[_0x977a('0x3d')][_0x977a('0x60')]({'where':{'id':_0x3703e1['params']['id']}})['then'](handleEntityNotFound(_0x3e1f3e,null))[_0x977a('0x34')](function(_0x181e55){if(_0x181e55){return _0x181e55['setTags'](_0x3703e1['body'][_0x977a('0xb6')],_['omit'](_0x3703e1[_0x977a('0xb3')],[_0x977a('0xb6'),'id'])||{})['spread'](function(){return db[_0x977a('0xbf')][_0x977a('0xbe')]({'attributes':['id','name',_0x977a('0xc0')],'where':{'id':_0x3703e1[_0x977a('0xb3')]['ids']}});})[_0x977a('0x34')](function(_0x4b36d3){socket[_0x977a('0xc1')]('whatsappInteractionTags:save',{'id':Number(_0x3703e1[_0x977a('0xae')]['id']),'tags':_0x4b36d3||[]});return{'id':Number(_0x3703e1[_0x977a('0xae')]['id']),'tags':_0x4b36d3||[]};});}})[_0x977a('0x34')](respondWithResult(_0x3e1f3e,null))[_0x977a('0x35')](handleError(_0x3e1f3e,null));};exports[_0x977a('0xc2')]=function(_0x4354d9,_0x10c9ce,_0x4be035){return db[_0x977a('0x3d')][_0x977a('0x60')]({'where':{'id':_0x4354d9[_0x977a('0xae')]['id']}})[_0x977a('0x34')](handleEntityNotFound(_0x10c9ce,null))[_0x977a('0x34')](function(_0x50fc9e){if(_0x50fc9e){return _0x50fc9e['removeTags'](_0x4354d9[_0x977a('0x41')]['ids']);}})[_0x977a('0x34')](respondWithStatusCode(_0x10c9ce,null))[_0x977a('0x35')](handleError(_0x10c9ce,null));};exports[_0x977a('0xc3')]=function(_0x4cb5a5,_0x7f1fd6){var _0xf6b4ad=moment()['unix']()[_0x977a('0x96')]();var _0x565597=path[_0x977a('0xc4')](config['root'],_0x977a('0xc5'),_0x977a('0xc6'),_0x977a('0xc7'));var _0x3b5624=path[_0x977a('0xc4')](config['root'],_0x977a('0xc5'),_0x977a('0xc6'),'attachments');var _0x11d451=path[_0x977a('0xc4')](_0x565597,_0xf6b4ad);var _0x580f29=util[_0x977a('0xbb')](_0x977a('0xc8'),_0x4cb5a5[_0x977a('0xae')]['id'],_0xf6b4ad);var _0x4971e1=path[_0x977a('0xc4')](_0x565597,_0x580f29);var _0x56cd5f=[];_0x56cd5f[_0x977a('0x33')]({'model':db[_0x977a('0xc9')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x56cd5f['push']({'model':db['CmContact'],'as':_0x977a('0x65'),'attributes':['id','firstName',_0x977a('0xca')],'raw':!![]});if(_0x4cb5a5['query'][_0x977a('0xcb')]){_0x56cd5f['push']({'model':db[_0x977a('0xcc')],'as':_0x977a('0xcc'),'raw':!![]});}var _0x133d0a=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id','body','createdAt',_0x977a('0xcd'),_0x977a('0xce'),_0x977a('0x7e')],'include':_0x56cd5f}];_0x133d0a[_0x977a('0x33')]({'model':db[_0x977a('0xcf')],'as':'Account','attributes':['id',_0x977a('0x2b')]});_0x133d0a[_0x977a('0x33')]({'model':db[_0x977a('0xc9')],'as':_0x977a('0xd0'),'attributes':['id',_0x977a('0x2f')]});return db[_0x977a('0x3d')]['find']({'where':{'id':_0x4cb5a5['params']['id']},'include':_0x133d0a})[_0x977a('0x34')](handleEntityNotFound(_0x7f1fd6,null))[_0x977a('0x34')](function(_0x1d0cbd){if(_0x1d0cbd){var _0x5cb150=_0x1d0cbd[_0x977a('0xd1')]({'plain':!![]});fs[_0x977a('0xd2')](_0x11d451);var _0x3be3e8={'channel':'Whatsapp','account':_0x5cb150[_0x977a('0xd3')]['name'],'agent':_0x5cb150[_0x977a('0xd0')]?_0x5cb150['Owner'][_0x977a('0x2f')]:_0x977a('0xd4'),'createdAt':moment(_0x5cb150[_0x977a('0x7a')])[_0x977a('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x5cb150['closed']?moment(_0x5cb150[_0x977a('0xd5')])[_0x977a('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')[_0x977a('0x96')]():'','disposition':_0x5cb150[_0x977a('0xd6')],'messages':_(_0x5cb150[_0x977a('0xd7')])[_0x977a('0x83')]({'secret':![]})['map'](function(_0xc8fc85){if(_0xc8fc85[_0x977a('0xcc')]){var _0x2d8f0f=path['join'](_0x3b5624,_0xc8fc85[_0x977a('0xcc')][_0x977a('0xd8')]);if(fs['existsSync'](_0x2d8f0f)){fs[_0x977a('0xd9')](_0x2d8f0f)['pipe'](fs[_0x977a('0xda')](path['join'](_0x11d451,_0xc8fc85[_0x977a('0xcc')][_0x977a('0xd8')])));}}return{'date':moment(_0xc8fc85[_0x977a('0x7a')])[_0x977a('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0xc8fc85[_0x977a('0xcd')]===_0x977a('0xdb')?_0xc8fc85[_0x977a('0xc9')]?_0xc8fc85[_0x977a('0xc9')][_0x977a('0x2f')]:_0x977a('0xdc'):_0xc8fc85[_0x977a('0x65')][_0x977a('0xdd')]+(_0xc8fc85[_0x977a('0x65')][_0x977a('0xca')]?'\x20'+_0xc8fc85['Contact'][_0x977a('0xca')]:''),'body':_0xc8fc85[_0x977a('0xcc')]?_0xc8fc85[_0x977a('0xcc')]['basename']:_0xc8fc85[_0x977a('0xb3')],'direction':_0xc8fc85[_0x977a('0xcd')]===_0x977a('0xdb')?'A':'C','secret':_0xc8fc85[_0x977a('0xce')],'read':_0xc8fc85['read'],'attachment':_0xc8fc85[_0x977a('0xcc')]};})['value']()};return ejs['renderFile'](path[_0x977a('0xc4')](config[_0x977a('0xde')],_0x977a('0xc5'),_0x977a('0xdf'),_0x977a('0xe0')),{'interaction':_0x3be3e8})['then'](function(_0xc17d32){var _0x119147=path[_0x977a('0xc4')](_0x11d451,_0x977a('0xe1')+_0x5cb150['id']+'-'+_0xf6b4ad+'.pdf');var _0x3ab574={'path':_0x119147,'channel':_0x977a('0xe2'),'interactionId':_0x5cb150['id']};return pdf['createPdfFromHTML'](_0xc17d32,_0x3ab574);})[_0x977a('0x34')](function(){return new BPromise(function(_0x19ed41,_0x182193){zipdir(_0x11d451,{'saveTo':_0x4971e1},function(_0x1b1c2a,_0x449342){if(_0x1b1c2a)return _0x182193(_0x1b1c2a);return _0x19ed41(_0x449342);});})[_0x977a('0x34')](function(){return new BPromise(function(_0x4beaa5,_0x42f750){rimraf(_0x11d451,function(_0x1053e4){if(_0x1053e4)_0x42f750(_0x1053e4);return _0x4beaa5();});});})[_0x977a('0x34')](function(){return _0x7f1fd6[_0x977a('0xc3')](_0x4971e1,_0x580f29,function(_0x513b50){if(_0x513b50){console[_0x977a('0xe3')](_0x977a('0xe4'),_0x513b50);}else{fs[_0x977a('0xe5')](_0x4971e1);}});});});}else{return _0x7f1fd6[_0x977a('0xe6')](0xc8);}})[_0x977a('0x35')](handleError(_0x7f1fd6,null));}; \ No newline at end of file +var _0xc274=['t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','WhatsappInteraction','a.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','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','WhatsappInteractionId','rows','show','params','include','options','create','describe','WhatsappMessage','addMessage','ids','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','fullname','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','Contact','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','sendStatus','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','destroy','error','stack','send','Users','TagIds','Tags','forEach','push','then','catch','talking','unmanaged','total','closed','UserId','waiting','answered','index','map','rawAttributes','fieldName','name','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','select','field','color','from','u.id','u.fullname','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','having','`\x20>\x200','operator','$substring','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','Tag','split','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','buildExpression','body','start','some','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','contactName','DESC'];(function(_0x47df56,_0x14356a){var _0xed4913=function(_0x3d63a5){while(--_0x3d63a5){_0x47df56['push'](_0x47df56['shift']());}};_0xed4913(++_0x14356a);}(_0xc274,0x151));var _0x4c27=function(_0x158b4b,_0x186d3e){_0x158b4b=_0x158b4b-0x0;var _0x7c6cb6=_0xc274[_0x158b4b];return _0x7c6cb6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4c27('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4c27('0x1'));var moment=require(_0x4c27('0x2'));var BPromise=require(_0x4c27('0x3'));var Mustache=require(_0x4c27('0x4'));var util=require(_0x4c27('0x5'));var path=require(_0x4c27('0x6'));var sox=require('sox');var csv=require(_0x4c27('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4c27('0x8'));var _=require(_0x4c27('0x9'));var squel=require(_0x4c27('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4c27('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4c27('0xc'));var Papa=require(_0x4c27('0xd'));var Redis=require(_0x4c27('0xe'));var authService=require(_0x4c27('0xf'));var qs=require(_0x4c27('0x10'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x4c27('0x11'));var hardwareService=require(_0x4c27('0x12'));var logger=require(_0x4c27('0x13'))(_0x4c27('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4c27('0x15'));var db=require(_0x4c27('0x16'))['db'];config['redis']=_['defaults'](config[_0x4c27('0x17')],{'host':_0x4c27('0x18'),'port':0x18eb});var socket=require(_0x4c27('0x19'))(new Redis(config['redis']));require(_0x4c27('0x1a'))[_0x4c27('0x1b')](socket);function respondWithStatusCode(_0x3879f7,_0x4a63b6){_0x4a63b6=_0x4a63b6||0xcc;return function(_0x6a1c3d){if(_0x6a1c3d){return _0x3879f7['sendStatus'](_0x4a63b6);}return _0x3879f7['status'](_0x4a63b6)[_0x4c27('0x1c')]();};}function respondWithResult(_0xaf2619,_0x117aaf){_0x117aaf=_0x117aaf||0xc8;return function(_0x4762ad){if(_0x4762ad){return _0xaf2619['status'](_0x117aaf)[_0x4c27('0x1d')](_0x4762ad);}};}function respondWithFilteredResult(_0x174204,_0x4bf2fb){return function(_0x355fde){if(_0x355fde){var _0x37eb5d=typeof _0x4bf2fb[_0x4c27('0x1e')]===_0x4c27('0x1f')&&typeof _0x4bf2fb['limit']===_0x4c27('0x1f');var _0x25aed2=_0x355fde[_0x4c27('0x20')];var _0x48e8cf=_0x37eb5d?0x0:_0x4bf2fb[_0x4c27('0x1e')];var _0x409347=_0x37eb5d?_0x355fde[_0x4c27('0x20')]:_0x4bf2fb[_0x4c27('0x1e')]+_0x4bf2fb[_0x4c27('0x21')];var _0xdff3d2;if(_0x409347>=_0x25aed2){_0x409347=_0x25aed2;_0xdff3d2=0xc8;}else{_0xdff3d2=0xce;}_0x174204[_0x4c27('0x22')](_0xdff3d2);return _0x174204[_0x4c27('0x23')](_0x4c27('0x24'),_0x48e8cf+'-'+_0x409347+'/'+_0x25aed2)[_0x4c27('0x1d')](_0x355fde);}return null;};}function patchUpdates(_0xdfb451){return function(_0x18a39a){try{jsonpatch[_0x4c27('0x25')](_0x18a39a,_0xdfb451,!![]);}catch(_0x11841c){return BPromise[_0x4c27('0x26')](_0x11841c);}return _0x18a39a[_0x4c27('0x27')]();};}function saveUpdates(_0x399d84,_0x2977b5){return function(_0x27e84a){if(_0x27e84a){return _0x27e84a[_0x4c27('0x28')](_0x399d84)['then'](function(_0x41f810){return _0x41f810;});}return null;};}function removeEntity(_0x1181d5,_0x3f4c1c){return function(_0x30a463){if(_0x30a463){return _0x30a463[_0x4c27('0x29')]()['then'](function(){_0x1181d5[_0x4c27('0x22')](0xcc)[_0x4c27('0x1c')]();});}};}function handleEntityNotFound(_0x444b23,_0x2ed090){return function(_0x404d2c){if(!_0x404d2c){_0x444b23['sendStatus'](0x194);}return _0x404d2c;};}function handleError(_0x5ae866,_0x118cd6){_0x118cd6=_0x118cd6||0x1f4;return function(_0x37d6d6){logger[_0x4c27('0x2a')](_0x37d6d6[_0x4c27('0x2b')]);if(_0x37d6d6['name']){delete _0x37d6d6['name'];}_0x5ae866[_0x4c27('0x22')](_0x118cd6)[_0x4c27('0x2c')](_0x37d6d6);};}function getInteractionUsers(_0x52c61e,_0x3b66f7){return new BPromise(function(_0x1753ab,_0x21f8e9){try{if(_0x3b66f7[_0x52c61e['id']]){_0x52c61e[_0x4c27('0x2d')]=_['map'](_0x3b66f7[_0x52c61e['id']],function(_0x12a67b){return{'id':_0x12a67b['id'],'fullname':_0x12a67b['fullname']};});}}catch(_0x9ee247){_0x21f8e9(_0x9ee247);}_0x1753ab(_0x52c61e);});}function getInteractionTags(_0x3c3c01,_0x88d972){return new BPromise(function(_0x38e781,_0x5d216b){try{if(_0x3c3c01[_0x4c27('0x2e')]){_0x3c3c01[_0x4c27('0x2f')]=[];_0x3c3c01[_0x4c27('0x2e')]['split'](',')[_0x4c27('0x30')](function(_0x8edceb){_0x3c3c01[_0x4c27('0x2f')][_0x4c27('0x31')](_0x88d972[_0x8edceb]);});}delete _0x3c3c01[_0x4c27('0x2e')];}catch(_0x3c52c8){_0x5d216b(_0x3c52c8);}_0x38e781(_0x3c3c01);});}function updateWhatsappInteraction(_0x1866bc,_0x1ac642,_0xe719e7){return new BPromise(function(_0x3ef099,_0x1de148){return getInteractionUsers(_0x1866bc,_0xe719e7)[_0x4c27('0x32')](function(_0x503fe7){return getInteractionTags(_0x503fe7,_0x1ac642);})[_0x4c27('0x32')](function(_0x5a26a4){return getStateInteraction(_0x5a26a4);})[_0x4c27('0x32')](function(_0x28babc){_0x3ef099(_0x28babc);})[_0x4c27('0x33')](function(_0x29c327){_0x1de148(_0x29c327);});});}function getStateInteraction(_0x3f52b0){return new BPromise(function(_0x27fa2){_0x3f52b0['waiting']=0x0;_0x3f52b0[_0x4c27('0x34')]=0x0;_0x3f52b0['answered']=0x0;_0x3f52b0[_0x4c27('0x35')]=0x0;_0x3f52b0[_0x4c27('0x36')]=0x0;if(!_0x3f52b0[_0x4c27('0x37')]&&!_0x3f52b0[_0x4c27('0x38')]){_0x3f52b0[_0x4c27('0x39')]+=0x1;}if(!_0x3f52b0['closed']&&_0x3f52b0[_0x4c27('0x38')]){_0x3f52b0[_0x4c27('0x34')]+=0x1;if(_0x3f52b0[_0x4c27('0x39')]){_0x3f52b0[_0x4c27('0x39')]-=0x1;}}if(_0x3f52b0[_0x4c27('0x37')]&&_0x3f52b0[_0x4c27('0x38')]){_0x3f52b0[_0x4c27('0x3a')]+=0x1;if(_0x3f52b0['talking']){_0x3f52b0[_0x4c27('0x34')]-=0x1;}}if(_0x3f52b0['closed']&&!_0x3f52b0['UserId']){_0x3f52b0[_0x4c27('0x35')]+=0x1;if(_0x3f52b0[_0x4c27('0x39')]){_0x3f52b0['waiting']-=0x1;}}_0x3f52b0['total']+=0x1;_0x27fa2(_0x3f52b0);});}exports[_0x4c27('0x3b')]=function(_0x3461ad,_0xbd7496){var _0x3dc458={},_0x345855={},_0x31fcf8={'count':0x0,'rows':[]};var _0x19b073=_[_0x4c27('0x3c')](db['WhatsappInteraction'][_0x4c27('0x3d')],function(_0x4c1498){return{'name':_0x4c1498[_0x4c27('0x3e')],'type':_0x4c1498['type']['key']};});_0x345855['model']=_[_0x4c27('0x3c')](_0x19b073,_0x4c27('0x3f'));_0x345855['query']=_[_0x4c27('0x40')](_0x3461ad[_0x4c27('0x41')]);_0x345855[_0x4c27('0x42')]=_[_0x4c27('0x43')](_0x345855[_0x4c27('0x44')],_0x345855['query']);_0x3dc458[_0x4c27('0x45')]=_['intersection'](_0x345855[_0x4c27('0x44')],qs[_0x4c27('0x46')](_0x3461ad[_0x4c27('0x41')]['fields']));_0x3dc458[_0x4c27('0x45')]=_0x3dc458['attributes'][_0x4c27('0x47')]?_0x3dc458[_0x4c27('0x45')]:_0x345855[_0x4c27('0x44')];if(!_0x3461ad[_0x4c27('0x41')][_0x4c27('0x48')](_0x4c27('0x49'))){_0x3dc458[_0x4c27('0x21')]=qs[_0x4c27('0x21')](_0x3461ad[_0x4c27('0x41')][_0x4c27('0x21')]);_0x3dc458[_0x4c27('0x1e')]=qs[_0x4c27('0x1e')](_0x3461ad[_0x4c27('0x41')][_0x4c27('0x1e')]);}_0x3dc458['order']=qs[_0x4c27('0x4a')](_0x3461ad['query'][_0x4c27('0x4a')]);_0x3dc458['where']=qs[_0x4c27('0x42')](_[_0x4c27('0x4b')](_0x3461ad['query'],_0x345855[_0x4c27('0x42')]),_0x19b073);var _0x40757e=[];var _0x1e66ed=squel[_0x4c27('0x4c')]()[_0x4c27('0x4d')]('id')[_0x4c27('0x4d')](_0x4c27('0x3f'))[_0x4c27('0x4d')](_0x4c27('0x4e'))[_0x4c27('0x4f')]('tools_tags');var _0x44b73e=squel[_0x4c27('0x4c')]()[_0x4c27('0x4d')](_0x4c27('0x50'))[_0x4c27('0x4d')](_0x4c27('0x51'))[_0x4c27('0x4d')]('ui.WhatsappInteractionId')['from'](_0x4c27('0x52'),'ui')[_0x4c27('0x53')](_0x4c27('0x54'),'u',_0x4c27('0x55'));var _0x28e8c5=squel[_0x4c27('0x4c')]()[_0x4c27('0x4f')](_0x4c27('0x56'),'i')[_0x4c27('0x53')](_0x4c27('0x57'),'c',_0x4c27('0x58'))[_0x4c27('0x53')](_0x4c27('0x54'),'o',_0x4c27('0x59'))['left_join'](_0x4c27('0x5a'),'a',_0x4c27('0x5b'))[_0x4c27('0x53')](_0x4c27('0x5c'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0x4c27('0x53')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0x4c27('0x53')](_0x4c27('0x5d'),'t',_0x4c27('0x5e'));var _0x2853ec=squel[_0x4c27('0x5f')]();var _0x47757b=[];var _0x1babeb=squel[_0x4c27('0x5f')]();var _0x3a3b68;if(_0x3461ad[_0x4c27('0x41')][_0x4c27('0x60')]){_0x3a3b68=as[_0x4c27('0x61')](_0x3461ad[_0x4c27('0x41')][_0x4c27('0x60')]);var _0x44c86d=_0x3a3b68['sqlOperator'];for(var _0x355520=0x0;_0x355520<_0x3a3b68['conditions']['length'];_0x355520++){var _0x2aa13f=_0x3a3b68[_0x4c27('0x62')][_0x355520];var _0x202fe6='i';var _0x3023ba=_[_0x4c27('0x63')](_0x19b073,[_0x4c27('0x3f'),_0x2aa13f[_0x4c27('0x4d')]]);if(!_0x3023ba){switch(_0x2aa13f[_0x4c27('0x4d')]){case'unreadMessages':if(_0x2aa13f['value']==0x1){_0x28e8c5[_0x4c27('0x64')]('`'+_0x2aa13f[_0x4c27('0x4d')]+'`\x20=\x200');}else{_0x28e8c5[_0x4c27('0x64')]('`'+_0x2aa13f[_0x4c27('0x4d')]+_0x4c27('0x65'));}break;case'Contact':if(_0x2aa13f[_0x4c27('0x66')]===_0x4c27('0x67')){if(_0x2aa13f[_0x4c27('0x68')]['split']('\x20')[_0x4c27('0x47')]>0x1){_0x2853ec[_0x44c86d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2aa13f['value']),null);}else{var _0x372d72='%'+_0x2aa13f['value']+'%';_0x2853ec[_0x44c86d](_0x4c27('0x69'),_0x372d72,_0x372d72,_0x372d72);}}else{_0x3023ba=_['find'](_0x19b073,['name',_0x4c27('0x6a')]);_0x2aa13f[_0x4c27('0x4d')]=_0x4c27('0x6a');_0x4ce12c=as['buildExpression'](_0x202fe6,_0x3023ba[_0x4c27('0x6b')],_0x2aa13f);_0x2853ec[_0x44c86d](_0x4ce12c[_0x4c27('0x6c')],_0x4ce12c[_0x4c27('0x68')]['start'],_0x4ce12c[_0x4c27('0x68')][_0x4c27('0x1c')]);}break;case _0x4c27('0x6d'):var _0x1027f7=_0x2aa13f[_0x4c27('0x68')][_0x4c27('0x6e')](',')[_0x4c27('0x3c')](function(_0x486bfa){return Number(_0x486bfa);});_0x1027f7[_0x4c27('0x30')](function(_0x33d1b7){_0x1babeb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x33d1b7+',%');});_0x47757b=_['union'](_0x47757b,_0x1027f7);break;case _0x4c27('0x6f'):if(_0x2aa13f[_0x4c27('0x66')]===_0x4c27('0x67')){_0x2853ec[_0x44c86d](_0x4c27('0x70'),'%'+_0x2aa13f[_0x4c27('0x68')]+'%',null);}else{_0x3023ba=_[_0x4c27('0x63')](_0x19b073,[_0x4c27('0x3f'),_0x4c27('0x38')]);_0x2aa13f[_0x4c27('0x4d')]=_0x4c27('0x38');_0x4ce12c=as[_0x4c27('0x71')](_0x202fe6,_0x3023ba[_0x4c27('0x6b')],_0x2aa13f);_0x2853ec[_0x44c86d](_0x4ce12c[_0x4c27('0x6c')],_0x4ce12c[_0x4c27('0x68')]['start'],_0x4ce12c['value']['end']);}break;case _0x4c27('0x72'):_0x4ce12c=as['buildExpression']('me',null,_0x2aa13f);_0x2853ec[_0x44c86d](_0x4ce12c[_0x4c27('0x6c')],_0x4ce12c['value'][_0x4c27('0x73')],_0x4ce12c['value'][_0x4c27('0x1c')]);break;}}else{var _0x4ce12c=as[_0x4c27('0x71')](_0x202fe6,_0x3023ba[_0x4c27('0x6b')],_0x2aa13f);_0x2853ec[_0x44c86d](_0x4ce12c[_0x4c27('0x6c')],_0x4ce12c[_0x4c27('0x68')][_0x4c27('0x73')],_0x4ce12c['value'][_0x4c27('0x1c')]);}}}else{var _0x2e678d=_(_0x3461ad[_0x4c27('0x41')])[_0x4c27('0x40')]()[_0x4c27('0x3c')](function(_0x237a17){return _[_0x4c27('0x74')](_0x19b073,[_0x4c27('0x3f'),_0x237a17])?_0x237a17:undefined;})['compact']()[_0x4c27('0x68')]();if(!_[_0x4c27('0x75')](_0x2e678d)){_0x2e678d[_0x4c27('0x30')](function(_0x274fa4){if(_0x274fa4===_0x4c27('0x76')){_0x28e8c5['where'](_0x4c27('0x77'),[][_0x4c27('0x78')](_0x3461ad[_0x4c27('0x41')][_0x274fa4]));}else if(_0x274fa4===_0x4c27('0x79')){var _0x13d909=JSON[_0x4c27('0x7a')](_0x3461ad[_0x4c27('0x41')][_0x274fa4])['$gte'];var _0x5d1981=JSON[_0x4c27('0x7a')](_0x3461ad[_0x4c27('0x41')][_0x274fa4])['$lte'];_0x28e8c5[_0x4c27('0x7b')](_0x4c27('0x7c'),_0x13d909,_0x5d1981);}else{if(_0x3461ad['query'][_0x274fa4]===_0x4c27('0x7d')){_0x28e8c5['where']('i.'+_0x274fa4+_0x4c27('0x7e'));}else{_0x28e8c5[_0x4c27('0x7b')]('i.'+_0x274fa4+'\x20=\x20?',_0x3461ad[_0x4c27('0x41')][_0x274fa4]);}}});}if(_0x3461ad[_0x4c27('0x41')][_0x4c27('0x7f')]){if(_0x3461ad[_0x4c27('0x41')][_0x4c27('0x7f')]==0x1){_0x28e8c5[_0x4c27('0x64')]('`unreadMessages`\x20=\x200');}else{_0x28e8c5[_0x4c27('0x64')](_0x4c27('0x80'));}}if(_0x3461ad[_0x4c27('0x41')][_0x4c27('0x81')]){_0x47757b=_[_0x4c27('0x82')](_0x3461ad['query'][_0x4c27('0x81')])?_0x3461ad[_0x4c27('0x41')]['tag']:new Array(_0x3461ad[_0x4c27('0x41')]['tag']);_0x47757b[_0x4c27('0x30')](function(_0x20eb0f){_0x1babeb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x20eb0f+',%');});}if(_0x3461ad['query'][_0x4c27('0x83')]){var _0x3834b1=_0x3461ad['query'][_0x4c27('0x83')]['replace']('\x5c','\x5c\x5c')[_0x4c27('0x84')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3834b1)){_0x2853ec['or']('i.id\x20LIKE\x20?',_0x3834b1+'%')['or']('i.phone\x20LIKE\x20?',_0x3834b1+'%');}else{_0x2853ec['or'](_0x4c27('0x85'),qs[_0x4c27('0x86')](_0x3834b1))['or'](_0x4c27('0x87'),_0x3834b1+'%');}}}_0x28e8c5['where'](_0x2853ec);_0x28e8c5[_0x4c27('0x88')]('i.id');var _0x35a9d8={'type':db[_0x4c27('0x89')][_0x4c27('0x8a')][_0x4c27('0x8b')],'raw':!![]};var _0x59b659=_0x28e8c5[_0x4c27('0x8c')]();_0x59b659['field'](_0x4c27('0x8d'));_0x59b659[_0x4c27('0x4d')](_0x4c27('0x8e'),_0x4c27('0x8f'));if(_0x3dc458[_0x4c27('0x90')]){_0x3dc458[_0x4c27('0x90')]['forEach'](function(_0x3a95c2){var _0x1f1e6c=_0x3a95c2[0x0]===_0x4c27('0x91')?_0x3a95c2[0x0]:'i.'+_0x3a95c2[0x0];_0x28e8c5['order'](_0x1f1e6c,_0x3a95c2[0x1]===_0x4c27('0x92')?![]:!![]);});}if(!_[_0x4c27('0x75')](_0x47757b)){_0x28e8c5[_0x4c27('0x64')](_0x1babeb);_0x59b659[_0x4c27('0x7b')](_0x4c27('0x93'),_0x47757b);}BPromise[_0x4c27('0x94')]()[_0x4c27('0x32')](function(){if(!_0x3a3b68){if(_0x3461ad[_0x4c27('0x41')]['WhatsappAccountId'])return;_0x59b659[_0x4c27('0x7b')](_0x4c27('0x95'));_0x28e8c5['where'](_0x4c27('0x95'));return;}if(_0x3461ad['user'][_0x4c27('0x96')]!=='agent')return;return _0x3461ad[_0x4c27('0x97')][_0x4c27('0x98')]({'attributes':['id'],'raw':!![]})[_0x4c27('0x32')](function(_0x3aeb45){if(_[_0x4c27('0x75')](_0x3aeb45)){_0x59b659[_0x4c27('0x7b')]('i.WhatsappAccountId\x20IS\x20NULL');_0x28e8c5[_0x4c27('0x7b')](_0x4c27('0x99'));}else{_0x59b659[_0x4c27('0x7b')](_0x4c27('0x77'),_[_0x4c27('0x3c')](_0x3aeb45,'id'));_0x28e8c5[_0x4c27('0x7b')](_0x4c27('0x77'),_[_0x4c27('0x3c')](_0x3aeb45,'id'));}});})[_0x4c27('0x32')](function(){if(_0x3461ad['user'][_0x4c27('0x96')]===_0x4c27('0x9a')&&!_0x3a3b68&&!_0x3461ad[_0x4c27('0x41')][_0x4c27('0x76')])return[];return db[_0x4c27('0x9b')][_0x4c27('0x41')](_0x59b659[_0x4c27('0x9c')](),_0x35a9d8);})[_0x4c27('0x32')](function(_0x131fe0){_0x31fcf8[_0x4c27('0x20')]=_0x131fe0[_0x4c27('0x47')];if(_0x31fcf8['count']===0x0)return[];return db['sequelize'][_0x4c27('0x41')](_0x1e66ed[_0x4c27('0x9c')](),_0x35a9d8)[_0x4c27('0x32')](function(_0x46b7be){_0x40757e=_[_0x4c27('0x9d')](_0x46b7be,'id');_0x35a9d8=_[_0x4c27('0x9e')](_0x35a9d8,{'model':db[_0x4c27('0x9f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3461ad[_0x4c27('0x41')][_0x4c27('0x46')]){_0x3dc458[_0x4c27('0x45')][_0x4c27('0x30')](function(_0x114bd5){_0x28e8c5['field']('i.'+_0x114bd5);});}else{_0x28e8c5['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4c27('0x8f'));_0x28e8c5['field'](_0x4c27('0xa0'),'Account.key');_0x28e8c5['field']('a.mandatoryDisposition',_0x4c27('0xa1'));_0x28e8c5[_0x4c27('0x4d')](_0x4c27('0xa2'),_0x4c27('0x91'));_0x28e8c5['field'](_0x4c27('0xa3'));_0x28e8c5[_0x4c27('0x4d')](_0x4c27('0xa4'),_0x4c27('0xa5'));_0x28e8c5[_0x4c27('0x4d')](_0x4c27('0xa6'),_0x4c27('0xa7'));_0x28e8c5[_0x4c27('0x4d')]('c.email',_0x4c27('0xa8'));_0x28e8c5[_0x4c27('0x4d')]('c.phone','Contact.phone');_0x28e8c5['field'](_0x4c27('0xa9'),_0x4c27('0xaa'));_0x28e8c5[_0x4c27('0x4d')](_0x4c27('0xab'),_0x4c27('0xac'));_0x28e8c5[_0x4c27('0x4d')](_0x4c27('0xad'),_0x4c27('0xae'));_0x28e8c5[_0x4c27('0x4d')](_0x4c27('0xaf'),_0x4c27('0xb0'));_0x28e8c5['field'](_0x4c27('0xb1'),_0x4c27('0x2e'));}if(_0x3dc458['limit'])_0x28e8c5[_0x4c27('0x21')](_0x3dc458['limit']);if(_0x3dc458[_0x4c27('0x1e')])_0x28e8c5[_0x4c27('0x1e')](_0x3dc458['offset']);return db[_0x4c27('0x9b')][_0x4c27('0x41')](_0x28e8c5[_0x4c27('0x9c')](),_0x35a9d8);})[_0x4c27('0x32')](function(_0x4710d8){if(_0x4710d8[_0x4c27('0x47')]>0x0)_0x44b73e['where']('ui.WhatsappInteractionId\x20IN\x20?',_[_0x4c27('0x3c')](_0x4710d8,'id'));return db['sequelize'][_0x4c27('0x41')](_0x44b73e[_0x4c27('0x9c')](),_0x35a9d8)[_0x4c27('0x32')](function(_0x544399){var _0x4be0b6=_[_0x4c27('0xb2')](_0x544399,_0x4c27('0xb3'));var _0x44da55=[];_0x4710d8[_0x4c27('0x30')](function(_0x593dce){_0x44da55['push'](updateWhatsappInteraction(_0x593dce,_0x40757e,_0x4be0b6));});return BPromise['all'](_0x44da55);});});})['then'](function(_0x2ce8f4){_0x31fcf8[_0x4c27('0xb4')]=_0x2ce8f4;return _0x31fcf8;})[_0x4c27('0x32')](respondWithFilteredResult(_0xbd7496,_0x3dc458))['catch'](handleError(_0xbd7496,null));};exports[_0x4c27('0xb5')]=function(_0x4691ed,_0x39b15d){var _0x322814={'raw':![],'where':{'id':_0x4691ed[_0x4c27('0xb6')]['id']}},_0x1d2e3a={};_0x1d2e3a['model']=_[_0x4c27('0x40')](db[_0x4c27('0x9f')]['rawAttributes']);_0x1d2e3a[_0x4c27('0x41')]=_['keys'](_0x4691ed[_0x4c27('0x41')]);_0x1d2e3a[_0x4c27('0x42')]=_['intersection'](_0x1d2e3a[_0x4c27('0x44')],_0x1d2e3a[_0x4c27('0x41')]);_0x322814[_0x4c27('0x45')]=_[_0x4c27('0x43')](_0x1d2e3a[_0x4c27('0x44')],qs[_0x4c27('0x46')](_0x4691ed[_0x4c27('0x41')][_0x4c27('0x46')]));_0x322814['attributes']=_0x322814[_0x4c27('0x45')][_0x4c27('0x47')]?_0x322814['attributes']:_0x1d2e3a[_0x4c27('0x44')];if(_0x4691ed[_0x4c27('0x41')]['includeAll']){_0x322814[_0x4c27('0xb7')]=[{'all':!![]}];}_0x322814=_[_0x4c27('0x9e')]({},_0x322814,_0x4691ed[_0x4c27('0xb8')]);return db[_0x4c27('0x9f')]['find'](_0x322814)[_0x4c27('0x32')](handleEntityNotFound(_0x39b15d,null))[_0x4c27('0x32')](respondWithResult(_0x39b15d,null))['catch'](handleError(_0x39b15d,null));};exports[_0x4c27('0xb9')]=function(_0x8c1875,_0x4916cd){return db[_0x4c27('0x9f')][_0x4c27('0xb9')](_0x8c1875[_0x4c27('0x72')],{})[_0x4c27('0x32')](respondWithResult(_0x4916cd,0xc9))[_0x4c27('0x33')](handleError(_0x4916cd,null));};exports['update']=function(_0x57a4e8,_0x5e1d62){if(_0x57a4e8[_0x4c27('0x72')]['id']){delete _0x57a4e8['body']['id'];}return db[_0x4c27('0x9f')][_0x4c27('0x63')]({'where':{'id':_0x57a4e8['params']['id']}})[_0x4c27('0x32')](handleEntityNotFound(_0x5e1d62,null))[_0x4c27('0x32')](saveUpdates(_0x57a4e8[_0x4c27('0x72')],null))['then'](respondWithResult(_0x5e1d62,null))[_0x4c27('0x33')](handleError(_0x5e1d62,null));};exports[_0x4c27('0x29')]=function(_0xa4de39,_0x479516){return db[_0x4c27('0x9f')][_0x4c27('0x63')]({'where':{'id':_0xa4de39[_0x4c27('0xb6')]['id']}})[_0x4c27('0x32')](handleEntityNotFound(_0x479516,null))[_0x4c27('0x32')](removeEntity(_0x479516,null))[_0x4c27('0x33')](handleError(_0x479516,null));};exports[_0x4c27('0xba')]=function(_0x20f376,_0x3f6b00){return db[_0x4c27('0x9f')][_0x4c27('0xba')]()[_0x4c27('0x32')](respondWithResult(_0x3f6b00,null))[_0x4c27('0x33')](handleError(_0x3f6b00,null));};exports['addMessage']=function(_0x5b677a,_0x3309a5,_0x356f6b){return db[_0x4c27('0xbb')][_0x4c27('0x63')]({'where':{'id':_0x5b677a[_0x4c27('0xb6')]['id']}})[_0x4c27('0x32')](handleEntityNotFound(_0x3309a5,null))[_0x4c27('0x32')](function(_0x5345e6){if(_0x5345e6){return _0x5345e6[_0x4c27('0xbc')](_0x5b677a[_0x4c27('0x72')][_0x4c27('0xbd')],_['omit'](_0x5b677a['body'],[_0x4c27('0xbd'),'id'])||{});}})[_0x4c27('0x32')](respondWithResult(_0x3309a5,null))[_0x4c27('0x33')](handleError(_0x3309a5,null));};exports[_0x4c27('0xbe')]=function(_0x5acc78,_0x3cc288,_0x116bce){var _0x205b3a={'raw':![],'where':{}};var _0x348adc={};var _0x89b805={'count':0x0,'rows':[]};return db[_0x4c27('0x9f')][_0x4c27('0xbf')]({'where':{'id':_0x5acc78[_0x4c27('0xb6')]['id']}})[_0x4c27('0x32')](handleEntityNotFound(_0x3cc288,null))[_0x4c27('0x32')](function(_0x249455){if(_0x249455){_0x348adc[_0x4c27('0x44')]=_['keys'](db[_0x4c27('0xbb')][_0x4c27('0x3d')]);_0x348adc[_0x4c27('0x41')]=_[_0x4c27('0x40')](_0x5acc78['query']);_0x348adc['filters']=_['intersection'](_0x348adc[_0x4c27('0x44')],_0x348adc[_0x4c27('0x41')]);_0x205b3a[_0x4c27('0x45')]=_[_0x4c27('0x43')](_0x348adc['model'],qs[_0x4c27('0x46')](_0x5acc78[_0x4c27('0x41')]['fields']));_0x205b3a[_0x4c27('0x45')]=_0x205b3a[_0x4c27('0x45')]['length']?_0x205b3a[_0x4c27('0x45')]:_0x348adc[_0x4c27('0x44')];if(!_0x5acc78[_0x4c27('0x41')][_0x4c27('0x48')](_0x4c27('0x49'))){_0x205b3a['limit']=qs['limit'](_0x5acc78[_0x4c27('0x41')][_0x4c27('0x21')]);_0x205b3a[_0x4c27('0x1e')]=qs[_0x4c27('0x1e')](_0x5acc78[_0x4c27('0x41')][_0x4c27('0x1e')]);}_0x205b3a['order']=qs[_0x4c27('0x4a')](_0x5acc78[_0x4c27('0x41')][_0x4c27('0x4a')]);_0x205b3a[_0x4c27('0x7b')]=qs[_0x4c27('0x42')](_[_0x4c27('0x4b')](_0x5acc78['query'],_0x348adc[_0x4c27('0x42')]));_0x205b3a[_0x4c27('0x7b')][_0x4c27('0xb3')]=_0x249455['id'];if(_0x5acc78[_0x4c27('0x41')]['filter']){_0x205b3a[_0x4c27('0x7b')]=_[_0x4c27('0x9e')](_0x205b3a[_0x4c27('0x7b')],{'$or':_[_0x4c27('0x3c')](_0x205b3a[_0x4c27('0x45')],function(_0x2092dd){var _0x3ba336={};_0x3ba336[_0x2092dd]={'$like':'%'+_0x5acc78[_0x4c27('0x41')][_0x4c27('0x83')]+'%'};return _0x3ba336;})});}if(_0x5acc78['query'][_0x4c27('0xc0')]){var _0x4b6762=_0x5acc78[_0x4c27('0x41')]['$gte'][_0x4c27('0x6e')](',');var _0x494b9a={};_0x494b9a[_0x4b6762[0x0]]={'$gte':moment(_0x4b6762[0x1])[_0x4c27('0xc1')](_0x4c27('0xc2'))};_0x205b3a[_0x4c27('0x7b')]=_[_0x4c27('0x9e')](_0x205b3a[_0x4c27('0x7b')],_0x494b9a);}_0x205b3a=_[_0x4c27('0x9e')]({},_0x205b3a,_0x5acc78[_0x4c27('0xb8')]);return db[_0x4c27('0xbb')][_0x4c27('0x20')]({'where':_0x205b3a[_0x4c27('0x7b')]})['then'](function(_0x1f1fed){_0x89b805[_0x4c27('0x20')]=_0x1f1fed;if(_0x5acc78[_0x4c27('0x41')]['includeAll']){_0x205b3a['include']=[{'all':!![]}];}return db[_0x4c27('0xbb')][_0x4c27('0xc3')](_0x205b3a);})[_0x4c27('0x32')](function(_0x941dad){_0x89b805[_0x4c27('0xb4')]=_0x941dad;return _0x89b805;});}})[_0x4c27('0x32')](respondWithFilteredResult(_0x3cc288,_0x205b3a))['catch'](handleError(_0x3cc288,null));};exports[_0x4c27('0xc4')]=function(_0x561b02,_0x32ee98,_0x2205d2){return db[_0x4c27('0x9f')][_0x4c27('0x63')]({'where':{'id':_0x561b02['params']['id']}})[_0x4c27('0x32')](handleEntityNotFound(_0x32ee98,null))['then'](function(_0x258857){if(_0x258857){return _0x258857['setTags'](_0x561b02[_0x4c27('0x72')][_0x4c27('0xbd')],_['omit'](_0x561b02[_0x4c27('0x72')],[_0x4c27('0xbd'),'id'])||{})[_0x4c27('0xc5')](function(){return db[_0x4c27('0x6d')]['findAll']({'attributes':['id',_0x4c27('0x3f'),_0x4c27('0x4e')],'where':{'id':_0x561b02[_0x4c27('0x72')][_0x4c27('0xbd')]}});})[_0x4c27('0x32')](function(_0x22541e){socket[_0x4c27('0xc6')](_0x4c27('0xc7'),{'id':Number(_0x561b02['params']['id']),'tags':_0x22541e||[]});return{'id':Number(_0x561b02['params']['id']),'tags':_0x22541e||[]};});}})['then'](respondWithResult(_0x32ee98,null))['catch'](handleError(_0x32ee98,null));};exports[_0x4c27('0xc8')]=function(_0x523946,_0x487f5b,_0xa4c038){return db['WhatsappInteraction'][_0x4c27('0x63')]({'where':{'id':_0x523946[_0x4c27('0xb6')]['id']}})[_0x4c27('0x32')](handleEntityNotFound(_0x487f5b,null))['then'](function(_0x1b782b){if(_0x1b782b){return _0x1b782b[_0x4c27('0xc8')](_0x523946[_0x4c27('0x41')][_0x4c27('0xbd')]);}})[_0x4c27('0x32')](respondWithStatusCode(_0x487f5b,null))[_0x4c27('0x33')](handleError(_0x487f5b,null));};exports[_0x4c27('0xc9')]=function(_0x1cf647,_0x596f46){var _0x11eb09=moment()[_0x4c27('0xca')]()[_0x4c27('0x9c')]();var _0x2bb735=path[_0x4c27('0xcb')](config[_0x4c27('0xcc')],'server',_0x4c27('0xcd'),_0x4c27('0xce'));var _0x5cc866=path[_0x4c27('0xcb')](config[_0x4c27('0xcc')],_0x4c27('0xcf'),'files',_0x4c27('0xd0'));var _0x1f3ef0=path['join'](_0x2bb735,_0x11eb09);var _0x2ab990=util[_0x4c27('0xc1')](_0x4c27('0xd1'),_0x1cf647[_0x4c27('0xb6')]['id'],_0x11eb09);var _0xbaf6a4=path[_0x4c27('0xcb')](_0x2bb735,_0x2ab990);var _0x18c52a=[];_0x18c52a[_0x4c27('0x31')]({'model':db[_0x4c27('0x6f')],'as':_0x4c27('0x6f'),'attributes':['id',_0x4c27('0xd2')],'raw':!![]});_0x18c52a[_0x4c27('0x31')]({'model':db[_0x4c27('0xd3')],'as':'Contact','attributes':['id',_0x4c27('0xd4'),_0x4c27('0xd5')],'raw':!![]});if(_0x1cf647[_0x4c27('0x41')][_0x4c27('0xd0')]){_0x18c52a[_0x4c27('0x31')]({'model':db[_0x4c27('0xd6')],'as':'Attachment','raw':!![]});}var _0x55088b=[{'model':db[_0x4c27('0xbb')],'as':_0x4c27('0xd7'),'attributes':['id','body',_0x4c27('0x79'),_0x4c27('0xd8'),_0x4c27('0xd9'),_0x4c27('0x7f')],'include':_0x18c52a}];_0x55088b[_0x4c27('0x31')]({'model':db[_0x4c27('0xda')],'as':_0x4c27('0xdb'),'attributes':['id',_0x4c27('0x3f')]});_0x55088b['push']({'model':db['User'],'as':_0x4c27('0xdc'),'attributes':['id',_0x4c27('0xd2')]});return db[_0x4c27('0x9f')][_0x4c27('0x63')]({'where':{'id':_0x1cf647[_0x4c27('0xb6')]['id']},'include':_0x55088b})[_0x4c27('0x32')](handleEntityNotFound(_0x596f46,null))['then'](function(_0x15b8ce){if(_0x15b8ce){var _0x1965d9=_0x15b8ce[_0x4c27('0xdd')]({'plain':!![]});fs[_0x4c27('0xde')](_0x1f3ef0);var _0x2e603c={'channel':_0x4c27('0xdf'),'account':_0x1965d9['Account'][_0x4c27('0x3f')],'agent':_0x1965d9[_0x4c27('0xdc')]?_0x1965d9[_0x4c27('0xdc')][_0x4c27('0xd2')]:_0x4c27('0xe0'),'createdAt':moment(_0x1965d9['createdAt'])['format'](_0x4c27('0xc2'))['toString'](),'closedAt':_0x1965d9[_0x4c27('0x37')]?moment(_0x1965d9[_0x4c27('0xe1')])['format'](_0x4c27('0xc2'))[_0x4c27('0x9c')]():'','disposition':_0x1965d9[_0x4c27('0xe2')],'messages':_(_0x1965d9['Messages'])['filter']({'secret':![]})['map'](function(_0x3a338d){if(_0x3a338d[_0x4c27('0xd6')]){var _0x270a8a=path['join'](_0x5cc866,_0x3a338d['Attachment'][_0x4c27('0xe3')]);if(fs[_0x4c27('0xe4')](_0x270a8a)){fs[_0x4c27('0xe5')](_0x270a8a)[_0x4c27('0xe6')](fs[_0x4c27('0xe7')](path[_0x4c27('0xcb')](_0x1f3ef0,_0x3a338d[_0x4c27('0xd6')][_0x4c27('0xe3')])));}}return{'date':moment(_0x3a338d[_0x4c27('0x79')])['format'](_0x4c27('0xc2'))['toString'](),'sender':_0x3a338d[_0x4c27('0xd8')]===_0x4c27('0xe8')?_0x3a338d['User']?_0x3a338d[_0x4c27('0x6f')][_0x4c27('0xd2')]:_0x4c27('0xe9'):_0x3a338d[_0x4c27('0xea')][_0x4c27('0xd4')]+(_0x3a338d[_0x4c27('0xea')]['lastName']?'\x20'+_0x3a338d['Contact'][_0x4c27('0xd5')]:''),'body':_0x3a338d[_0x4c27('0xd6')]?_0x3a338d[_0x4c27('0xd6')][_0x4c27('0xe3')]:_0x3a338d[_0x4c27('0x72')],'direction':_0x3a338d[_0x4c27('0xd8')]===_0x4c27('0xe8')?'A':'C','secret':_0x3a338d[_0x4c27('0xd9')],'read':_0x3a338d[_0x4c27('0x7f')],'attachment':_0x3a338d[_0x4c27('0xd6')]};})[_0x4c27('0x68')]()};return ejs['renderFile'](path[_0x4c27('0xcb')](config[_0x4c27('0xcc')],_0x4c27('0xcf'),_0x4c27('0xeb'),_0x4c27('0xec')),{'interaction':_0x2e603c})[_0x4c27('0x32')](function(_0x18c67e){var _0x3900ee=path[_0x4c27('0xcb')](_0x1f3ef0,'transcript-'+_0x1965d9['id']+'-'+_0x11eb09+_0x4c27('0xed'));var _0x3649bc={'path':_0x3900ee,'channel':_0x4c27('0xdf'),'interactionId':_0x1965d9['id']};return pdf[_0x4c27('0xee')](_0x18c67e,_0x3649bc);})[_0x4c27('0x32')](function(){return new BPromise(function(_0x5cf0ee,_0x17d61a){zipdir(_0x1f3ef0,{'saveTo':_0xbaf6a4},function(_0x233f42,_0x558337){if(_0x233f42)return _0x17d61a(_0x233f42);return _0x5cf0ee(_0x558337);});})['then'](function(){return new BPromise(function(_0x182ea8,_0x5ac6ed){rimraf(_0x1f3ef0,function(_0x1310e0){if(_0x1310e0)_0x5ac6ed(_0x1310e0);return _0x182ea8();});});})['then'](function(){return _0x596f46[_0x4c27('0xc9')](_0xbaf6a4,_0x2ab990,function(_0x1417d0){if(_0x1417d0){console[_0x4c27('0xef')](_0x4c27('0xf0'),_0x1417d0);}else{fs['unlinkSync'](_0xbaf6a4);}});});});}else{return _0x596f46[_0x4c27('0xf1')](0xc8);}})[_0x4c27('0x33')](handleError(_0x596f46,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 25e133b..2523f73 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 _0x3f59=['map','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','then','setDataValue','Users'];(function(_0x1993d6,_0x2d7ddf){var _0x52f0f7=function(_0x308d60){while(--_0x308d60){_0x1993d6['push'](_0x1993d6['shift']());}};_0x52f0f7(++_0x2d7ddf);}(_0x3f59,0x1b0));var _0x93f5=function(_0xc43ef,_0x47c48d){_0xc43ef=_0xc43ef-0x0;var _0xb260b=_0x3f59[_0xc43ef];return _0xb260b;};'use strict';var EventEmitter=require(_0x93f5('0x0'));var WhatsappInteraction=require(_0x93f5('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x93f5('0x1'))['db'][_0x93f5('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x93f5('0x3')](0x0);var events={'afterCreate':_0x93f5('0x4'),'afterUpdate':_0x93f5('0x5'),'afterDestroy':_0x93f5('0x6')};function emitEvent(_0x374022){return function(_0x333f53,_0x3de6ce,_0x4dd06b){_0x333f53['getUsers']({'attributes':['id'],'raw':!![]})[_0x93f5('0x7')](function(_0x456295){_0x333f53[_0x93f5('0x8')](_0x93f5('0x9'),_0x456295[_0x93f5('0xa')](function(_0x5325a7){return{'id':_0x5325a7['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x333f53['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4f5781){_0x333f53[_0x93f5('0x8')](_0x93f5('0xb'),_0x4f5781[_0x93f5('0xc')]);WhatsappInteractionEvents[_0x93f5('0xd')](_0x374022+':'+_0x333f53['id'],_0x333f53);WhatsappInteractionEvents['emit'](_0x374022,_0x333f53);_0x4dd06b(null);})['catch'](_0x4dd06b(null));};}for(var e in events){if(events[_0x93f5('0xe')](e)){var event=events[e];WhatsappInteraction[_0x93f5('0xf')](e,emitEvent(event));}}module[_0x93f5('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x23a8=['unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','remove','getUsers','setDataValue','map','then'];(function(_0x58cc60,_0x39f414){var _0x225ad1=function(_0x2276bc){while(--_0x2276bc){_0x58cc60['push'](_0x58cc60['shift']());}};_0x225ad1(++_0x39f414);}(_0x23a8,0x172));var _0x823a=function(_0x1b4058,_0x280199){_0x1b4058=_0x1b4058-0x0;var _0x34cc6b=_0x23a8[_0x1b4058];return _0x34cc6b;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x823a('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x823a('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x823a('0x1')](0x0);var events={'afterCreate':_0x823a('0x2'),'afterUpdate':'update','afterDestroy':_0x823a('0x3')};function emitEvent(_0x494856){return function(_0x2d8217,_0x2ad2cb,_0x1862d3){_0x2d8217[_0x823a('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x472eb5){_0x2d8217[_0x823a('0x5')]('Users',_0x472eb5[_0x823a('0x6')](function(_0x43309a){return{'id':_0x43309a['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x2d8217['id'],'direction':'in','read':![]},'raw':!![]});})[_0x823a('0x7')](function(_0x422e48){_0x2d8217[_0x823a('0x5')](_0x823a('0x8'),_0x422e48['length']);WhatsappInteractionEvents[_0x823a('0x9')](_0x494856+':'+_0x2d8217['id'],_0x2d8217);WhatsappInteractionEvents[_0x823a('0x9')](_0x494856,_0x2d8217);_0x1862d3(null);})[_0x823a('0xa')](_0x1862d3(null));};}for(var e in events){if(events[_0x823a('0xb')](e)){var event=events[e];WhatsappInteraction[_0x823a('0xc')](e,emitEvent(event));}}module[_0x823a('0xd')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 58d0845..3908a37 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 _0xfb14=['../../config/environment','./whatsappInteraction.attributes','exports','define','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0xa1a425,_0x3a4c5a){var _0x57d753=function(_0x4b90b1){while(--_0x4b90b1){_0xa1a425['push'](_0xa1a425['shift']());}};_0x57d753(++_0x3a4c5a);}(_0xfb14,0x1b9));var _0x4fb1=function(_0x172d28,_0xbdbced){_0x172d28=_0x172d28-0x0;var _0x1ad9ec=_0xfb14[_0x172d28];return _0x1ad9ec;};'use strict';var _=require('lodash');var util=require(_0x4fb1('0x0'));var logger=require(_0x4fb1('0x1'))(_0x4fb1('0x2'));var moment=require(_0x4fb1('0x3'));var BPromise=require('bluebird');var rp=require(_0x4fb1('0x4'));var fs=require('fs');var path=require(_0x4fb1('0x5'));var rimraf=require(_0x4fb1('0x6'));var config=require(_0x4fb1('0x7'));var attributes=require(_0x4fb1('0x8'));module[_0x4fb1('0x9')]=function(_0xe25c4b,_0x16fcb8){return _0xe25c4b[_0x4fb1('0xa')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4f6133,_0xeedd30,_0x258056){if(_0x4f6133[_0x4fb1('0xb')](_0x4fb1('0xc'))){_0x4f6133[_0x4fb1('0xd')]=moment()[_0x4fb1('0xe')](_0x4fb1('0xf'));}_0x258056(null,_0x4f6133);}}});}; \ No newline at end of file +var _0x28a6=['WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','util','moment','request-promise','rimraf','define'];(function(_0x5b5047,_0x228694){var _0x11680e=function(_0x406801){while(--_0x406801){_0x5b5047['push'](_0x5b5047['shift']());}};_0x11680e(++_0x228694);}(_0x28a6,0x166));var _0x628a=function(_0x5c6a78,_0x5c0503){_0x5c6a78=_0x5c6a78-0x0;var _0x236c5e=_0x28a6[_0x5c6a78];return _0x236c5e;};'use strict';var _=require('lodash');var util=require(_0x628a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x628a('0x1'));var BPromise=require('bluebird');var rp=require(_0x628a('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x628a('0x3'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x49cfbe,_0x304a93){return _0x49cfbe[_0x628a('0x4')](_0x628a('0x5'),attributes,{'tableName':_0x628a('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x251da8,_0x3f9634,_0x394801){if(_0x251da8[_0x628a('0x7')](_0x628a('0x8'))){_0x251da8[_0x628a('0x9')]=moment()[_0x628a('0xa')]('YYYY-MM-DD\x20HH:mm:ss');}_0x394801(null,_0x251da8);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 0647618..cb61d14 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 _0x42b2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','info','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','message','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','where','attributes','limit','then','find','ids','omit','spread','AddTags','stringify','lodash','util','bluebird','randomstring'];(function(_0x2df5b6,_0x35682c){var _0x9683d1=function(_0x54b5fe){while(--_0x54b5fe){_0x2df5b6['push'](_0x2df5b6['shift']());}};_0x9683d1(++_0x35682c);}(_0x42b2,0x74));var _0x242b=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x42b2[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x242b('0x0'));var util=require(_0x242b('0x1'));var moment=require('moment');var BPromise=require(_0x242b('0x2'));var rs=require(_0x242b('0x3'));var fs=require('fs');var Redis=require(_0x242b('0x4'));var db=require(_0x242b('0x5'))['db'];var utils=require(_0x242b('0x6'));var logger=require(_0x242b('0x7'))(_0x242b('0x8'));var config=require('../../config/environment');var jayson=require(_0x242b('0x9'));var client=jayson[_0x242b('0xa')][_0x242b('0xb')]({'port':0x232a});config['redis']=_[_0x242b('0xc')](config[_0x242b('0xd')],{'host':_0x242b('0xe'),'port':0x18eb});var socket=require(_0x242b('0xf'))(new Redis(config[_0x242b('0xd')]));require(_0x242b('0x10'))['register'](socket);function respondWithRpcPromise(_0x7c1b6e,_0x354219,_0x2226ec){return new BPromise(function(_0x57dcb6,_0x3dc2fb){return client['request'](_0x7c1b6e,_0x2226ec)['then'](function(_0x50d685){logger[_0x242b('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x354219,'request\x20sent');logger[_0x242b('0x12')](_0x242b('0x13'),_0x354219,'request\x20sent',JSON['stringify'](_0x50d685));if(_0x50d685[_0x242b('0x14')]){if(_0x50d685['error']['code']===0x1f4){logger[_0x242b('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0x354219,_0x50d685['error'][_0x242b('0x15')]);return _0x3dc2fb(_0x50d685[_0x242b('0x14')][_0x242b('0x15')]);}logger['error'](_0x242b('0x16'),_0x354219,_0x50d685[_0x242b('0x14')][_0x242b('0x15')]);return _0x57dcb6(_0x50d685[_0x242b('0x14')][_0x242b('0x15')]);}else{logger['info'](_0x242b('0x16'),_0x354219,_0x242b('0x17'));_0x57dcb6(_0x50d685[_0x242b('0x18')][_0x242b('0x15')]);}})[_0x242b('0x19')](function(_0x3ff308){logger[_0x242b('0x14')](_0x242b('0x16'),_0x354219,_0x3ff308);_0x3dc2fb(_0x3ff308);});});}exports[_0x242b('0x1a')]=function(_0x38355b){var _0x258a70=this;return new Promise(function(_0x308fb1,_0x28a678){return db[_0x242b('0x1b')]['update'](_0x38355b[_0x242b('0x1c')],{'raw':_0x38355b[_0x242b('0x1d')]?_0x38355b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38355b[_0x242b('0x1d')]?_0x38355b['options'][_0x242b('0x1e')]||null:null,'attributes':_0x38355b['options']?_0x38355b[_0x242b('0x1d')][_0x242b('0x1f')]||null:null,'limit':_0x38355b[_0x242b('0x1d')]?_0x38355b['options'][_0x242b('0x20')]||null:null})[_0x242b('0x21')](function(_0x2030a0){logger[_0x242b('0x11')]('UpdateWhatsappInteraction',_0x38355b);logger[_0x242b('0x12')](_0x242b('0x1a'),_0x38355b,JSON['stringify'](_0x2030a0));_0x308fb1(_0x2030a0);})[_0x242b('0x19')](function(_0x2d7fde){logger['error'](_0x242b('0x1a'),_0x2d7fde['message'],_0x38355b);_0x28a678(_0x258a70['error'](0x1f4,_0x2d7fde[_0x242b('0x15')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x3f3ce6){return new Promise(function(_0x320d62,_0x2ab97e){return db['WhatsappInteraction'][_0x242b('0x22')]({'where':_0x3f3ce6[_0x242b('0x1d')]?_0x3f3ce6['options'][_0x242b('0x1e')]||null:null})[_0x242b('0x21')](function(_0x22bfb3){if(_0x22bfb3){return _0x22bfb3['addTags'](_0x3f3ce6[_0x242b('0x1c')][_0x242b('0x23')],_[_0x242b('0x24')](_0x3f3ce6[_0x242b('0x1c')],[_0x242b('0x23'),'id'])||{});}})[_0x242b('0x25')](function(_0x1588fc){logger[_0x242b('0x11')]('AddTags',_0x3f3ce6);logger[_0x242b('0x12')](_0x242b('0x26'),_0x3f3ce6,JSON[_0x242b('0x27')](_0x1588fc));_0x320d62(_0x1588fc);})[_0x242b('0x19')](function(_0x1ce6c2){logger['error']('AddTags',_0x1ce6c2[_0x242b('0x15')],_0x3f3ce6);_0x2ab97e(_this[_0x242b('0x14')](0x1f4,_0x1ce6c2[_0x242b('0x15')]));});});}; \ No newline at end of file +var _0x0102=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','limit','AddTagsToWhatsappInteraction','find','ids','spread','AddTags','lodash','util'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x0102,0x166));var _0x2010=function(_0x10f311,_0x161b71){_0x10f311=_0x10f311-0x0;var _0x241847=_0x0102[_0x10f311];return _0x241847;};'use strict';var _=require(_0x2010('0x0'));var util=require(_0x2010('0x1'));var moment=require(_0x2010('0x2'));var BPromise=require('bluebird');var rs=require(_0x2010('0x3'));var fs=require('fs');var Redis=require(_0x2010('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2010('0x5'));var logger=require(_0x2010('0x6'))(_0x2010('0x7'));var config=require(_0x2010('0x8'));var jayson=require(_0x2010('0x9'));var client=jayson[_0x2010('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x2010('0xb')],{'host':_0x2010('0xc'),'port':0x18eb});var socket=require(_0x2010('0xd'))(new Redis(config[_0x2010('0xb')]));require(_0x2010('0xe'))[_0x2010('0xf')](socket);function respondWithRpcPromise(_0x2f9b8a,_0x1ac2d3,_0x27cac7){return new BPromise(function(_0x1d2865,_0x3fbd9c){return client['request'](_0x2f9b8a,_0x27cac7)[_0x2010('0x10')](function(_0x13047d){logger[_0x2010('0x11')](_0x2010('0x12'),_0x1ac2d3,_0x2010('0x13'));logger[_0x2010('0x14')](_0x2010('0x15'),_0x1ac2d3,'request\x20sent',JSON[_0x2010('0x16')](_0x13047d));if(_0x13047d[_0x2010('0x17')]){if(_0x13047d[_0x2010('0x17')][_0x2010('0x18')]===0x1f4){logger[_0x2010('0x17')](_0x2010('0x12'),_0x1ac2d3,_0x13047d[_0x2010('0x17')]['message']);return _0x3fbd9c(_0x13047d[_0x2010('0x17')]['message']);}logger[_0x2010('0x17')](_0x2010('0x12'),_0x1ac2d3,_0x13047d[_0x2010('0x17')][_0x2010('0x19')]);return _0x1d2865(_0x13047d[_0x2010('0x17')][_0x2010('0x19')]);}else{logger[_0x2010('0x11')](_0x2010('0x12'),_0x1ac2d3,'request\x20sent');_0x1d2865(_0x13047d[_0x2010('0x1a')]['message']);}})[_0x2010('0x1b')](function(_0x2ae680){logger[_0x2010('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x1ac2d3,_0x2ae680);_0x3fbd9c(_0x2ae680);});});}exports[_0x2010('0x1c')]=function(_0x31f785){var _0x9235fa=this;return new Promise(function(_0x307f69,_0x1bc824){return db[_0x2010('0x1d')][_0x2010('0x1e')](_0x31f785[_0x2010('0x1f')],{'raw':_0x31f785['options']?_0x31f785[_0x2010('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31f785[_0x2010('0x20')]?_0x31f785[_0x2010('0x20')][_0x2010('0x21')]||null:null,'attributes':_0x31f785[_0x2010('0x20')]?_0x31f785[_0x2010('0x20')]['attributes']||null:null,'limit':_0x31f785['options']?_0x31f785[_0x2010('0x20')][_0x2010('0x22')]||null:null})['then'](function(_0x4fc2d1){logger[_0x2010('0x11')](_0x2010('0x1c'),_0x31f785);logger['debug']('UpdateWhatsappInteraction',_0x31f785,JSON['stringify'](_0x4fc2d1));_0x307f69(_0x4fc2d1);})['catch'](function(_0x2fcc49){logger[_0x2010('0x17')](_0x2010('0x1c'),_0x2fcc49[_0x2010('0x19')],_0x31f785);_0x1bc824(_0x9235fa['error'](0x1f4,_0x2fcc49[_0x2010('0x19')]));});});};exports[_0x2010('0x23')]=function(_0x40e0b7){return new Promise(function(_0x22163c,_0x577abf){return db[_0x2010('0x1d')][_0x2010('0x24')]({'where':_0x40e0b7[_0x2010('0x20')]?_0x40e0b7[_0x2010('0x20')]['where']||null:null})[_0x2010('0x10')](function(_0x3da73c){if(_0x3da73c){return _0x3da73c['addTags'](_0x40e0b7[_0x2010('0x1f')][_0x2010('0x25')],_['omit'](_0x40e0b7[_0x2010('0x1f')],[_0x2010('0x25'),'id'])||{});}})[_0x2010('0x26')](function(_0x10cec3){logger['info'](_0x2010('0x27'),_0x40e0b7);logger['debug'](_0x2010('0x27'),_0x40e0b7,JSON['stringify'](_0x10cec3));_0x22163c(_0x10cec3);})['catch'](function(_0x33e4f3){logger[_0x2010('0x17')](_0x2010('0x27'),_0x33e4f3[_0x2010('0x19')],_0x40e0b7);_0x577abf(_this[_0x2010('0x17')](0x1f4,_0x33e4f3['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 6ca5185..0736816 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 _0x24c5=['register','length','whatsappInteraction:','remove','update','emit','removeListener'];(function(_0x3a3220,_0x35ce85){var _0x8c535c=function(_0x4f07be){while(--_0x4f07be){_0x3a3220['push'](_0x3a3220['shift']());}};_0x8c535c(++_0x35ce85);}(_0x24c5,0x1a0));var _0x524c=function(_0x441670,_0x176e0a){_0x441670=_0x441670-0x0;var _0x3a5886=_0x24c5[_0x441670];return _0x3a5886;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x524c('0x0'),_0x524c('0x1')];function createListener(_0x5a1929,_0x5ebb00){return function(_0x3eae19){_0x5ebb00[_0x524c('0x2')](_0x5a1929,_0x3eae19);};}function removeListener(_0x4d669d,_0x551d8b){return function(){WhatsappInteractionEvents[_0x524c('0x3')](_0x4d669d,_0x551d8b);};}exports[_0x524c('0x4')]=function(_0x2c36de){for(var _0x22d071=0x0,_0x2baa80=events[_0x524c('0x5')];_0x22d071<_0x2baa80;_0x22d071++){var _0x2d55c8=events[_0x22d071];var _0x101e18=createListener(_0x524c('0x6')+_0x2d55c8,_0x2c36de);WhatsappInteractionEvents['on'](_0x2d55c8,_0x101e18);}}; \ No newline at end of file +var _0xced4=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xced4,0x130));var _0x4ced=function(_0x420282,_0x1f941f){_0x420282=_0x420282-0x0;var _0x535480=_0xced4[_0x420282];return _0x535480;};'use strict';var WhatsappInteractionEvents=require(_0x4ced('0x0'));var events=[_0x4ced('0x1'),_0x4ced('0x2'),_0x4ced('0x3')];function createListener(_0x178a3a,_0x4740f8){return function(_0x40a4d1){_0x4740f8['emit'](_0x178a3a,_0x40a4d1);};}function removeListener(_0x56dc60,_0x4049bd){return function(){WhatsappInteractionEvents['removeListener'](_0x56dc60,_0x4049bd);};}exports[_0x4ced('0x4')]=function(_0x52a042){for(var _0x2ed116=0x0,_0x45b094=events[_0x4ced('0x5')];_0x2ed116<_0x45b094;_0x2ed116++){var _0x1ba9df=events[_0x2ed116];var _0x4a212f=createListener(_0x4ced('0x6')+_0x1ba9df,_0x52a042);WhatsappInteractionEvents['on'](_0x1ba9df,_0x4a212f);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index b03ce9b..def7aa2 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 _0x6462=['accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','status','put'];(function(_0x43624a,_0x44c839){var _0x20de7e=function(_0x2014d7){while(--_0x2014d7){_0x43624a['push'](_0x43624a['shift']());}};_0x20de7e(++_0x44c839);}(_0x6462,0x1c8));var _0x2646=function(_0x388cf7,_0x158793){_0x388cf7=_0x388cf7-0x0;var _0x2dfcab=_0x6462[_0x388cf7];return _0x2dfcab;};'use strict';var multer=require(_0x2646('0x0'));var util=require(_0x2646('0x1'));var path=require(_0x2646('0x2'));var timeout=require(_0x2646('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2646('0x4'));var auth=require(_0x2646('0x5'));var interaction=require(_0x2646('0x6'));var config=require('../../config/environment');var controller=require(_0x2646('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2646('0x8')]);router[_0x2646('0x9')](_0x2646('0xa'),auth[_0x2646('0xb')](),controller[_0x2646('0xc')]);router[_0x2646('0x9')](_0x2646('0xd'),auth['isAuthenticated'](),controller[_0x2646('0xe')]);router[_0x2646('0xf')]('/',auth[_0x2646('0xb')](),interaction['tracked']('whatsapp','whatsappmessage:create'),controller[_0x2646('0x10')]);router[_0x2646('0xf')]('/:id/status',controller[_0x2646('0x11')]);router[_0x2646('0x12')]('/:id',auth[_0x2646('0xb')](),controller['update']);router[_0x2646('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x2646('0x13')]);router[_0x2646('0x12')](_0x2646('0x14'),auth[_0x2646('0xb')](),controller[_0x2646('0x15')]);router[_0x2646('0x16')](_0x2646('0xd'),auth[_0x2646('0xb')](),controller[_0x2646('0x17')]);module[_0x2646('0x18')]=router; \ No newline at end of file +var _0xad45=['put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','tracked','whatsappmessage:create','create','/:id/status','status'];(function(_0x492ab1,_0x3ea032){var _0x3d88a3=function(_0x16283d){while(--_0x16283d){_0x492ab1['push'](_0x492ab1['shift']());}};_0x3d88a3(++_0x3ea032);}(_0xad45,0x10c));var _0x5ad4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xad45[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x5ad4('0x0'));var util=require('util');var path=require(_0x5ad4('0x1'));var timeout=require(_0x5ad4('0x2'));var express=require('express');var router=express[_0x5ad4('0x3')]();var fs_extra=require(_0x5ad4('0x4'));var auth=require(_0x5ad4('0x5'));var interaction=require(_0x5ad4('0x6'));var config=require(_0x5ad4('0x7'));var controller=require('./whatsappMessage.controller');router[_0x5ad4('0x8')]('/',auth[_0x5ad4('0x9')](),controller['index']);router[_0x5ad4('0x8')](_0x5ad4('0xa'),auth[_0x5ad4('0x9')](),controller['describe']);router[_0x5ad4('0x8')](_0x5ad4('0xb'),auth[_0x5ad4('0x9')](),controller[_0x5ad4('0xc')]);router['post']('/',auth[_0x5ad4('0x9')](),interaction[_0x5ad4('0xd')]('whatsapp',_0x5ad4('0xe')),controller[_0x5ad4('0xf')]);router['post'](_0x5ad4('0x10'),controller[_0x5ad4('0x11')]);router[_0x5ad4('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x5ad4('0x13')]);router[_0x5ad4('0x12')](_0x5ad4('0x14'),auth['isAuthenticated'](),controller[_0x5ad4('0x15')]);router[_0x5ad4('0x12')](_0x5ad4('0x16'),auth[_0x5ad4('0x9')](),controller[_0x5ad4('0x17')]);router['delete'](_0x5ad4('0xb'),auth[_0x5ad4('0x9')](),controller[_0x5ad4('0x18')]);module[_0x5ad4('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index f6ec214..2cbf55d 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 _0xd7fa=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xd7fa,0xfd));var _0xad7f=function(_0x4eabdf,_0x5ed32e){_0x4eabdf=_0x4eabdf-0x0;var _0x34c6e5=_0xd7fa[_0x4eabdf];return _0x34c6e5;};'use strict';var Sequelize=require(_0xad7f('0x0'));module[_0xad7f('0x1')]={'body':{'type':Sequelize[_0xad7f('0x2')](_0xad7f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xad7f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xad7f('0x5')),'defaultValue':_0xad7f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xad7f('0x6')](0xbe)},'phone':{'type':Sequelize[_0xad7f('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xad7f('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xad7f('0x2')]}}; \ No newline at end of file +var _0x064e=['STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x22813f,_0xde1faa){var _0x1abf7c=function(_0x130760){while(--_0x130760){_0x22813f['push'](_0x22813f['shift']());}};_0x1abf7c(++_0xde1faa);}(_0x064e,0xd2));var _0xe064=function(_0x3841ef,_0xcdbd4){_0x3841ef=_0x3841ef-0x0;var _0x4f56f9=_0x064e[_0x3841ef];return _0x4f56f9;};'use strict';var Sequelize=require(_0xe064('0x0'));module[_0xe064('0x1')]={'body':{'type':Sequelize[_0xe064('0x2')](_0xe064('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe064('0x4')]('in',_0xe064('0x5')),'defaultValue':_0xe064('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xe064('0x6')]},'readAt':{'type':Sequelize[_0xe064('0x7')]},'secret':{'type':Sequelize[_0xe064('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xe064('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index ec9ad56..b9d0f3d 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 _0x6072=['format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','WhatsappInteraction','isNil','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','stringify','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','agent','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','reject','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','fullname','rejectmessage','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','destroy','end','stack','name','index','map','WhatsappMessage','fieldName','type','key','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','model','keys','length','create','body','update','find','whatsapp-interactions','whatsapp','read','readAt'];(function(_0x23e4a1,_0x535a6f){var _0x5e53c9=function(_0x2bf4e5){while(--_0x2bf4e5){_0x23e4a1['push'](_0x23e4a1['shift']());}};_0x5e53c9(++_0x535a6f);}(_0x6072,0x148));var _0x2607=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x6072[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2607('0x0'));var zipdir=require(_0x2607('0x1'));var jsonpatch=require(_0x2607('0x2'));var rp=require(_0x2607('0x3'));var moment=require('moment');var BPromise=require(_0x2607('0x4'));var Mustache=require(_0x2607('0x5'));var util=require(_0x2607('0x6'));var path=require(_0x2607('0x7'));var sox=require(_0x2607('0x8'));var csv=require('to-csv');var ejs=require(_0x2607('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2607('0xa'));var squel=require(_0x2607('0xb'));var crypto=require(_0x2607('0xc'));var jsforce=require(_0x2607('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2607('0xe'));var querystring=require(_0x2607('0xf'));var Papa=require('papaparse');var Redis=require(_0x2607('0x10'));var authService=require(_0x2607('0x11'));var qs=require(_0x2607('0x12'));var as=require(_0x2607('0x13'));var hardwareService=require(_0x2607('0x14'));var logger=require(_0x2607('0x15'))(_0x2607('0x16'));var utils=require(_0x2607('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2607('0x18'));var db=require('../../mysqldb')['db'];config[_0x2607('0x19')]=_[_0x2607('0x1a')](config[_0x2607('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x2607('0x1b'))(new Redis(config[_0x2607('0x19')]));require('./whatsappMessage.socket')[_0x2607('0x1c')](socket);var jayson=require(_0x2607('0x1d'));var client=jayson[_0x2607('0x1e')][_0x2607('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30772c,_0x18b609,_0x44a134,_0x3898d6){return new BPromise(function(_0x482d45,_0xb62edd){var _0x5d70e3=_0x3898d6||client;return _0x5d70e3[_0x2607('0x20')](_0x30772c,_0x44a134)[_0x2607('0x21')](function(_0x144a37){logger['info'](_0x2607('0x22'),_0x18b609,_0x2607('0x23'));logger['debug'](_0x2607('0x24'),_0x18b609,_0x2607('0x23'),JSON['stringify'](_0x144a37));if(_0x144a37['error']){if(_0x144a37[_0x2607('0x25')][_0x2607('0x26')]===0x1f4){logger[_0x2607('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x18b609,_0x144a37[_0x2607('0x25')][_0x2607('0x27')]);return _0xb62edd(_0x144a37['error']['message']);}logger[_0x2607('0x25')](_0x2607('0x22'),_0x18b609,_0x144a37[_0x2607('0x25')][_0x2607('0x27')]);return _0x482d45(_0x144a37[_0x2607('0x25')]['message']);}else{logger[_0x2607('0x28')](_0x2607('0x22'),_0x18b609,_0x2607('0x23'));_0x482d45(_0x144a37[_0x2607('0x29')][_0x2607('0x27')]);}})[_0x2607('0x2a')](function(_0x337436){logger['error'](_0x2607('0x22'),_0x18b609,_0x337436);_0xb62edd(_0x337436);});});}function respondWithStatusCode(_0x2bbcab,_0x2e2ab2){_0x2e2ab2=_0x2e2ab2||0xcc;return function(_0x501963){if(_0x501963){return _0x2bbcab[_0x2607('0x2b')](_0x2e2ab2);}return _0x2bbcab['status'](_0x2e2ab2)['end']();};}function respondWithResult(_0x50c098,_0x2544d7){_0x2544d7=_0x2544d7||0xc8;return function(_0x4635e2){if(_0x4635e2){return _0x50c098[_0x2607('0x2c')](_0x2544d7)[_0x2607('0x2d')](_0x4635e2);}};}function respondWithFilteredResult(_0x366150,_0x43cc3c){return function(_0xd9c5b8){if(_0xd9c5b8){var _0x4f6bd3=typeof _0x43cc3c['offset']===_0x2607('0x2e')&&typeof _0x43cc3c[_0x2607('0x2f')]==='undefined';var _0x2c1be8=_0xd9c5b8['count'];var _0x11c758=_0x4f6bd3?0x0:_0x43cc3c[_0x2607('0x30')];var _0x1dda57=_0x4f6bd3?_0xd9c5b8[_0x2607('0x31')]:_0x43cc3c[_0x2607('0x30')]+_0x43cc3c[_0x2607('0x2f')];var _0x5443e6;if(_0x1dda57>=_0x2c1be8){_0x1dda57=_0x2c1be8;_0x5443e6=0xc8;}else{_0x5443e6=0xce;}_0x366150[_0x2607('0x2c')](_0x5443e6);return _0x366150[_0x2607('0x32')](_0x2607('0x33'),_0x11c758+'-'+_0x1dda57+'/'+_0x2c1be8)[_0x2607('0x2d')](_0xd9c5b8);}return null;};}function patchUpdates(_0x20eeb3){return function(_0x286257){try{jsonpatch[_0x2607('0x34')](_0x286257,_0x20eeb3,!![]);}catch(_0x47ff8f){return BPromise['reject'](_0x47ff8f);}return _0x286257[_0x2607('0x35')]();};}function saveUpdates(_0x1d1d6e,_0x16789a){return function(_0x21a8fa){if(_0x21a8fa){return _0x21a8fa['update'](_0x1d1d6e)[_0x2607('0x21')](function(_0x96f14b){return _0x96f14b;});}return null;};}function removeEntity(_0x4b7db5,_0xe57b0e){return function(_0x3dafcb){if(_0x3dafcb){return _0x3dafcb[_0x2607('0x36')]()[_0x2607('0x21')](function(){_0x4b7db5[_0x2607('0x2c')](0xcc)[_0x2607('0x37')]();});}};}function handleEntityNotFound(_0x41728f,_0x1f30e2){return function(_0x262e99){if(!_0x262e99){_0x41728f['sendStatus'](0x194);}return _0x262e99;};}function handleError(_0x3948c1,_0x3beb41){_0x3beb41=_0x3beb41||0x1f4;return function(_0x5abb31){logger[_0x2607('0x25')](_0x5abb31[_0x2607('0x38')]);if(_0x5abb31[_0x2607('0x39')]){delete _0x5abb31[_0x2607('0x39')];}_0x3948c1['status'](_0x3beb41)['send'](_0x5abb31);};}exports[_0x2607('0x3a')]=function(_0x1ad6c5,_0xd755f7){var _0x1d5f99={},_0x314f26={},_0x4eb6ba={'count':0x0,'rows':[]};var _0x19272a=_[_0x2607('0x3b')](db[_0x2607('0x3c')]['rawAttributes'],function(_0x453002){return{'name':_0x453002[_0x2607('0x3d')],'type':_0x453002[_0x2607('0x3e')][_0x2607('0x3f')]};});_0x314f26['model']=_[_0x2607('0x3b')](_0x19272a,_0x2607('0x39'));_0x314f26[_0x2607('0x40')]=_['keys'](_0x1ad6c5[_0x2607('0x40')]);_0x314f26[_0x2607('0x41')]=_[_0x2607('0x42')](_0x314f26['model'],_0x314f26[_0x2607('0x40')]);_0x1d5f99[_0x2607('0x43')]=_[_0x2607('0x42')](_0x314f26['model'],qs[_0x2607('0x44')](_0x1ad6c5[_0x2607('0x40')][_0x2607('0x44')]));_0x1d5f99['attributes']=_0x1d5f99[_0x2607('0x43')]['length']?_0x1d5f99[_0x2607('0x43')]:_0x314f26['model'];if(!_0x1ad6c5['query']['hasOwnProperty'](_0x2607('0x45'))){_0x1d5f99[_0x2607('0x2f')]=qs[_0x2607('0x2f')](_0x1ad6c5[_0x2607('0x40')]['limit']);_0x1d5f99[_0x2607('0x30')]=qs[_0x2607('0x30')](_0x1ad6c5['query']['offset']);}_0x1d5f99[_0x2607('0x46')]=qs[_0x2607('0x47')](_0x1ad6c5[_0x2607('0x40')][_0x2607('0x47')]);_0x1d5f99[_0x2607('0x48')]=qs['filters'](_[_0x2607('0x49')](_0x1ad6c5[_0x2607('0x40')],_0x314f26[_0x2607('0x41')]),_0x19272a);if(_0x1ad6c5[_0x2607('0x40')][_0x2607('0x4a')]){_0x1d5f99['where']=_['merge'](_0x1d5f99[_0x2607('0x48')],{'$or':_[_0x2607('0x3b')](_0x19272a,function(_0x3ad367){if(_0x3ad367[_0x2607('0x3e')]!==_0x2607('0x4b')){var _0x5e3277={};_0x5e3277[_0x3ad367[_0x2607('0x39')]]={'$like':'%'+_0x1ad6c5['query']['filter']+'%'};return _0x5e3277;}})});}_0x1d5f99=_[_0x2607('0x4c')]({},_0x1d5f99,_0x1ad6c5[_0x2607('0x4d')]);var _0xf19a5f={'where':_0x1d5f99[_0x2607('0x48')]};return db[_0x2607('0x3c')][_0x2607('0x31')](_0xf19a5f)[_0x2607('0x21')](function(_0x1b2099){_0x4eb6ba[_0x2607('0x31')]=_0x1b2099;if(_0x1ad6c5['query'][_0x2607('0x4e')]){_0x1d5f99[_0x2607('0x4f')]=[{'all':!![]}];}return db[_0x2607('0x3c')][_0x2607('0x50')](_0x1d5f99);})[_0x2607('0x21')](function(_0x28802d){_0x4eb6ba[_0x2607('0x51')]=_0x28802d;return _0x4eb6ba;})[_0x2607('0x21')](respondWithFilteredResult(_0xd755f7,_0x1d5f99))[_0x2607('0x2a')](handleError(_0xd755f7,null));};exports[_0x2607('0x52')]=function(_0x23e55b,_0x2eac52){var _0x16f52a={'raw':!![],'where':{'id':_0x23e55b[_0x2607('0x53')]['id']}},_0xd798a8={};_0xd798a8[_0x2607('0x54')]=_[_0x2607('0x55')](db[_0x2607('0x3c')]['rawAttributes']);_0xd798a8[_0x2607('0x40')]=_[_0x2607('0x55')](_0x23e55b[_0x2607('0x40')]);_0xd798a8[_0x2607('0x41')]=_[_0x2607('0x42')](_0xd798a8[_0x2607('0x54')],_0xd798a8[_0x2607('0x40')]);_0x16f52a[_0x2607('0x43')]=_[_0x2607('0x42')](_0xd798a8[_0x2607('0x54')],qs[_0x2607('0x44')](_0x23e55b['query'][_0x2607('0x44')]));_0x16f52a['attributes']=_0x16f52a['attributes'][_0x2607('0x56')]?_0x16f52a['attributes']:_0xd798a8[_0x2607('0x54')];if(_0x23e55b[_0x2607('0x40')][_0x2607('0x4e')]){_0x16f52a[_0x2607('0x4f')]=[{'all':!![]}];}_0x16f52a=_[_0x2607('0x4c')]({},_0x16f52a,_0x23e55b[_0x2607('0x4d')]);return db[_0x2607('0x3c')]['find'](_0x16f52a)[_0x2607('0x21')](handleEntityNotFound(_0x2eac52,null))['then'](respondWithResult(_0x2eac52,null))[_0x2607('0x2a')](handleError(_0x2eac52,null));};exports[_0x2607('0x57')]=function(_0x3682c9,_0x26abb8){return db[_0x2607('0x3c')][_0x2607('0x57')](_0x3682c9[_0x2607('0x58')],{})[_0x2607('0x21')](respondWithResult(_0x26abb8,0xc9))[_0x2607('0x2a')](handleError(_0x26abb8,null));};exports[_0x2607('0x59')]=function(_0x30706a,_0x2a65bc){if(_0x30706a['body']['id']){delete _0x30706a[_0x2607('0x58')]['id'];}return db['WhatsappMessage'][_0x2607('0x5a')]({'where':{'id':_0x30706a[_0x2607('0x53')]['id']}})['then'](handleEntityNotFound(_0x2a65bc,null))[_0x2607('0x21')](saveUpdates(_0x30706a[_0x2607('0x58')],null))[_0x2607('0x21')](respondWithResult(_0x2a65bc,null))['catch'](handleError(_0x2a65bc,null));};exports[_0x2607('0x36')]=function(_0x4b7bca,_0x3b5646){return db[_0x2607('0x3c')]['find']({'where':{'id':_0x4b7bca['params']['id']}})[_0x2607('0x21')](handleEntityNotFound(_0x3b5646,null))[_0x2607('0x21')](removeEntity(_0x3b5646,null))[_0x2607('0x2a')](handleError(_0x3b5646,null));};exports['describe']=function(_0x2938f3,_0x304dce){return db[_0x2607('0x3c')]['describe']()[_0x2607('0x21')](respondWithResult(_0x304dce,null))[_0x2607('0x2a')](handleError(_0x304dce,null));};var interaction_log=require(_0x2607('0x15'))(_0x2607('0x5b'));exports['accept']=function(_0x16a48a,_0x226ad5,_0x1edfce){var _0x1df7f0={'agent':{},'channel':_0x2607('0x5c')};if(_0x16a48a[_0x2607('0x58')]['id']){delete _0x16a48a[_0x2607('0x58')]['id'];}_0x16a48a['body'][_0x2607('0x5d')]=!![];_0x16a48a[_0x2607('0x58')][_0x2607('0x5e')]=moment()[_0x2607('0x5f')](_0x2607('0x60'));_0x16a48a[_0x2607('0x58')][_0x2607('0x61')]=_0x16a48a[_0x2607('0x58')][_0x2607('0x61')]||_0x16a48a['user']['id'];_0x1df7f0['agent']['id']=_0x16a48a[_0x2607('0x58')]['UserId'];return db[_0x2607('0x3c')][_0x2607('0x5a')]({'where':{'id':_0x16a48a[_0x2607('0x53')]['id'],'UserId':null}})[_0x2607('0x21')](handleEntityNotFound(_0x226ad5,null))[_0x2607('0x21')](saveUpdates(_0x16a48a[_0x2607('0x58')],null))[_0x2607('0x21')](function(_0x1bb8c9){if(_0x1bb8c9){_0x1df7f0[_0x2607('0x27')]=_0x1bb8c9[_0x2607('0x62')]({'plain':!![]});return db[_0x2607('0x63')][_0x2607('0x5a')]({'where':{'id':_0x1bb8c9['WhatsappInteractionId']}});}return null;})[_0x2607('0x21')](handleEntityNotFound(_0x226ad5,null))[_0x2607('0x21')](function(_0x381279){if(_0x381279){return _0x381279[_0x2607('0x59')]({'UserId':_0x16a48a[_0x2607('0x58')][_0x2607('0x61')],'read1stAt':_[_0x2607('0x64')](_0x381279['read1stAt'])?moment()[_0x2607('0x5f')](_0x2607('0x60')):undefined});}return null;})[_0x2607('0x21')](function(_0x1826cf){if(_0x1826cf){_0x1df7f0[_0x2607('0x65')]=_0x1826cf['get']({'plain':!![]});interaction_log[_0x2607('0x28')](_0x2607('0x66'),_0x16a48a['user']['id'],_0x16a48a[_0x2607('0x67')][_0x2607('0x39')],_0x16a48a[_0x2607('0x67')]['role'],_0x1df7f0[_0x2607('0x65')]['id'],_0x16a48a['body']?JSON[_0x2607('0x68')](_0x16a48a['body']):_0x2607('0x69'));return respondWithRpcPromise('AcceptMessage',_0x2607('0x6a'),_0x1df7f0);}return null;})['then'](function(_0x2e698a){var _0x20da8c=_0x2607('0x6b')+_0x2e698a[_0x2607('0x27')][_0x2607('0x6c')];return db['sequelize'][_0x2607('0x40')](_0x20da8c,{'type':db[_0x2607('0x6d')][_0x2607('0x6e')][_0x2607('0x6f')],'raw':!![]})[_0x2607('0x21')](function(_0x11f803){return _0x11f803;});})[_0x2607('0x21')](function(_0x4da776){if(_0x4da776){_0x1df7f0[_0x2607('0x27')][_0x2607('0x70')]=_0x4da776[0x0];if(!_0x16a48a['body'][_0x2607('0x61')])return;return db[_0x2607('0x71')][_0x2607('0x5a')]({'where':{'id':_0x16a48a[_0x2607('0x58')][_0x2607('0x61')],'role':_0x2607('0x72')},'attributes':['id',_0x2607('0x39'),'fullname',_0x2607('0x73'),_0x2607('0x74')],'raw':!![]});}return null;})[_0x2607('0x21')](function(_0xf8f511){if(!_0xf8f511)return null;_0x1df7f0[_0x2607('0x27')]['agent']=_0xf8f511;return _0x1df7f0;})[_0x2607('0x21')](function(_0x193687){if(_0x193687){if(_0x16a48a[_0x2607('0x58')][_0x2607('0x75')]){_0x1df7f0['message'][_0x2607('0x76')]=util[_0x2607('0x5f')](_0x2607('0x77'),_0x16a48a[_0x2607('0x67')][_0x2607('0x39')]);_0x1df7f0['message'][_0x2607('0x78')]=_0x1df7f0[_0x2607('0x78')];_0x1df7f0['message'][_0x2607('0x79')]=_0x1df7f0[_0x2607('0x78')];_0x1df7f0[_0x2607('0x27')][_0x2607('0x7a')]=_0x2607('0x7b');return respondWithRpcPromise('EventManager',_0x2607('0x7c'),{'event':_0x2607('0x7d'),'message':_0x1df7f0['message']},client9002)[_0x2607('0x21')](function(){return _0x1df7f0;});}return _0x1df7f0;}return null;})[_0x2607('0x21')](respondWithResult(_0x226ad5,null))[_0x2607('0x2a')](handleError(_0x226ad5,null));};var interaction_log=require(_0x2607('0x15'))('whatsapp-interactions');exports[_0x2607('0x7e')]=function(_0x2edd6d,_0x357719,_0x207b67){var _0x7b595e={'agent':{},'channel':_0x2607('0x5c')};if(_0x2edd6d[_0x2607('0x58')]['id']){delete _0x2edd6d[_0x2607('0x58')]['id'];}_0x2edd6d[_0x2607('0x58')][_0x2607('0x61')]=_0x2edd6d[_0x2607('0x58')][_0x2607('0x61')]||_0x2edd6d[_0x2607('0x67')]['id'];_0x7b595e[_0x2607('0x72')]['id']=_0x2edd6d[_0x2607('0x58')]['UserId'];return db[_0x2607('0x3c')][_0x2607('0x5a')]({'where':{'id':_0x2edd6d[_0x2607('0x53')]['id'],'UserId':null}})[_0x2607('0x21')](handleEntityNotFound(_0x357719,null))['then'](function(_0x1e452f){if(_0x1e452f){_0x7b595e['message']=_0x1e452f['get']({'plain':!![]});return db[_0x2607('0x63')][_0x2607('0x5a')]({'where':{'id':_0x1e452f[_0x2607('0x7f')]}});}return null;})[_0x2607('0x21')](handleEntityNotFound(_0x357719,null))[_0x2607('0x21')](function(_0x485588){if(_0x485588){_0x7b595e[_0x2607('0x65')]=_0x485588['get']({'plain':!![]});interaction_log[_0x2607('0x28')](_0x2607('0x80'),_0x2edd6d[_0x2607('0x67')]['id'],_0x2edd6d['user'][_0x2607('0x39')],_0x2edd6d[_0x2607('0x67')]['role'],_0x7b595e['interaction']['id'],_0x2edd6d[_0x2607('0x58')]?JSON['stringify'](_0x2edd6d[_0x2607('0x58')]):_0x2607('0x69'));return respondWithRpcPromise('RejectMessage',_0x2607('0x81'),_0x7b595e);}return null;})['then'](function(_0xefa919){var _0x38ace3=_0x2607('0x6b')+_0xefa919[_0x2607('0x27')][_0x2607('0x6c')];return db['sequelize'][_0x2607('0x40')](_0x38ace3,{'type':db[_0x2607('0x6d')][_0x2607('0x6e')][_0x2607('0x6f')],'raw':!![]})[_0x2607('0x21')](function(_0x5e40e9){return _0x5e40e9;});})[_0x2607('0x21')](function(_0x358390){if(_0x358390){_0x7b595e['message'][_0x2607('0x70')]=_0x358390[0x0];if(!_0x2edd6d[_0x2607('0x58')][_0x2607('0x61')])return;return db['User']['find']({'where':{'id':_0x2edd6d[_0x2607('0x58')][_0x2607('0x61')],'role':_0x2607('0x72')},'attributes':['id','name',_0x2607('0x82'),_0x2607('0x73'),_0x2607('0x74')],'raw':!![]});}return null;})['then'](function(_0x47e93c){if(!_0x47e93c)return null;_0x7b595e[_0x2607('0x27')][_0x2607('0x72')]=_0x47e93c;return _0x7b595e;})['then'](function(_0x47ef8f){if(_0x47ef8f){_0x47ef8f[_0x2607('0x27')][_0x2607('0x76')]=util[_0x2607('0x5f')]('SIP/%s',_0x2edd6d['user'][_0x2607('0x39')]);_0x47ef8f[_0x2607('0x27')][_0x2607('0x78')]=_0x7b595e[_0x2607('0x78')];_0x47ef8f[_0x2607('0x27')][_0x2607('0x79')]=_0x7b595e[_0x2607('0x78')];_0x47ef8f['message']['event']=_0x2607('0x7e');respondWithRpcPromise(_0x2607('0x7c'),_0x2607('0x7c'),{'event':_0x2607('0x83'),'message':_0x47ef8f[_0x2607('0x27')]},client9002);return _0x7b595e;}return null;})[_0x2607('0x21')](respondWithResult(_0x357719,null))['catch'](handleError(_0x357719,null));};exports[_0x2607('0x2c')]=function(_0xada05b,_0x5723af,_0xd1f192){if(_0xada05b[_0x2607('0x58')]['id']){delete _0xada05b[_0x2607('0x58')]['id'];}var _0xdae9ec;return db[_0x2607('0x3c')][_0x2607('0x5a')]({'where':{'id':_0xada05b[_0x2607('0x53')]['id']}})[_0x2607('0x21')](handleEntityNotFound(_0x5723af,null))[_0x2607('0x21')](function(_0x5daf61){if(_0x5daf61){_0xdae9ec=_0x5daf61;return db['WhatsappAccount'][_0x2607('0x5a')]({'where':{'id':_0x5daf61[_0x2607('0x84')]}});}})[_0x2607('0x21')](handleEntityNotFound(_0x5723af,null))[_0x2607('0x21')](function(_0x59b22d){if(_0x59b22d){logger[_0x2607('0x85')](_0x2607('0x86'),'status',_0x2607('0x87'),_0x59b22d[_0x2607('0x3e')],util[_0x2607('0x88')](_0xada05b['body'],{'showHidden':![],'depth':null}));switch(_0x59b22d[_0x2607('0x3e')]){case _0x2607('0x89'):if(_0xada05b['body'][_0x2607('0x8a')]&&_0xada05b['body'][_0x2607('0x8a')]===_0xdae9ec[_0x2607('0x8b')]&&_0xada05b[_0x2607('0x58')][_0x2607('0x8c')]&&_0xada05b[_0x2607('0x58')][_0x2607('0x8c')]===_0x2607('0x5d')){return _0xdae9ec[_0x2607('0x59')]({'read':!![]});}else{logger[_0x2607('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2607('0x2c'),_0x2607('0x89'),util['inspect'](_0xada05b[_0x2607('0x58')],{'showHidden':![],'depth':null}));}break;}return _0xdae9ec;}})[_0x2607('0x21')](respondWithResult(_0x5723af,null))[_0x2607('0x2a')](handleError(_0x5723af,null));}; \ No newline at end of file +var _0xd710=['acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','RejectMessage','QueryTypes','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','update','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappMessage','count','findAll','rows','show','keys','includeAll','find','create','body','params','destroy','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage'];(function(_0x402ba7,_0x34af6c){var _0x330c44=function(_0x1ab909){while(--_0x1ab909){_0x402ba7['push'](_0x402ba7['shift']());}};_0x330c44(++_0x34af6c);}(_0xd710,0xaa));var _0x0d71=function(_0x427f0a,_0x99e230){_0x427f0a=_0x427f0a-0x0;var _0x81967c=_0xd710[_0x427f0a];return _0x81967c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d71('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d71('0x1'));var rp=require(_0x0d71('0x2'));var moment=require(_0x0d71('0x3'));var BPromise=require(_0x0d71('0x4'));var Mustache=require(_0x0d71('0x5'));var util=require(_0x0d71('0x6'));var path=require('path');var sox=require(_0x0d71('0x7'));var csv=require(_0x0d71('0x8'));var ejs=require(_0x0d71('0x9'));var fs=require('fs');var fs_extra=require(_0x0d71('0xa'));var _=require('lodash');var squel=require(_0x0d71('0xb'));var crypto=require(_0x0d71('0xc'));var jsforce=require(_0x0d71('0xd'));var deskjs=require(_0x0d71('0xe'));var toCsv=require(_0x0d71('0x8'));var querystring=require('querystring');var Papa=require(_0x0d71('0xf'));var Redis=require(_0x0d71('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0d71('0x11'));var as=require(_0x0d71('0x12'));var hardwareService=require(_0x0d71('0x13'));var logger=require(_0x0d71('0x14'))(_0x0d71('0x15'));var utils=require(_0x0d71('0x16'));var config=require(_0x0d71('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d71('0x18'))['db'];config[_0x0d71('0x19')]=_[_0x0d71('0x1a')](config[_0x0d71('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0d71('0x1b'))[_0x0d71('0x1c')](socket);var jayson=require(_0x0d71('0x1d'));var client=jayson[_0x0d71('0x1e')][_0x0d71('0x1f')]({'port':0x232c});var client9002=jayson[_0x0d71('0x1e')][_0x0d71('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x13138e,_0x59ce1a,_0x4d3d62,_0x2fa210){return new BPromise(function(_0xcf9dec,_0x4e4f23){var _0x5cb228=_0x2fa210||client;return _0x5cb228[_0x0d71('0x20')](_0x13138e,_0x4d3d62)[_0x0d71('0x21')](function(_0x259d2b){logger[_0x0d71('0x22')](_0x0d71('0x23'),_0x59ce1a,_0x0d71('0x24'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x59ce1a,'request\x20sent',JSON['stringify'](_0x259d2b));if(_0x259d2b['error']){if(_0x259d2b['error'][_0x0d71('0x25')]===0x1f4){logger['error'](_0x0d71('0x23'),_0x59ce1a,_0x259d2b[_0x0d71('0x26')][_0x0d71('0x27')]);return _0x4e4f23(_0x259d2b[_0x0d71('0x26')][_0x0d71('0x27')]);}logger[_0x0d71('0x26')](_0x0d71('0x23'),_0x59ce1a,_0x259d2b['error']['message']);return _0xcf9dec(_0x259d2b[_0x0d71('0x26')][_0x0d71('0x27')]);}else{logger[_0x0d71('0x22')](_0x0d71('0x23'),_0x59ce1a,_0x0d71('0x24'));_0xcf9dec(_0x259d2b[_0x0d71('0x28')]['message']);}})[_0x0d71('0x29')](function(_0x32e9cc){logger[_0x0d71('0x26')](_0x0d71('0x23'),_0x59ce1a,_0x32e9cc);_0x4e4f23(_0x32e9cc);});});}function respondWithStatusCode(_0x3c04fa,_0x292988){_0x292988=_0x292988||0xcc;return function(_0x2409c1){if(_0x2409c1){return _0x3c04fa[_0x0d71('0x2a')](_0x292988);}return _0x3c04fa['status'](_0x292988)[_0x0d71('0x2b')]();};}function respondWithResult(_0x585b50,_0x4b8d91){_0x4b8d91=_0x4b8d91||0xc8;return function(_0x1ff963){if(_0x1ff963){return _0x585b50[_0x0d71('0x2c')](_0x4b8d91)[_0x0d71('0x2d')](_0x1ff963);}};}function respondWithFilteredResult(_0x2bfb75,_0x2d0ebe){return function(_0x1515d3){if(_0x1515d3){var _0x5af96d=typeof _0x2d0ebe[_0x0d71('0x2e')]===_0x0d71('0x2f')&&typeof _0x2d0ebe[_0x0d71('0x30')]===_0x0d71('0x2f');var _0x345d64=_0x1515d3['count'];var _0x53d794=_0x5af96d?0x0:_0x2d0ebe[_0x0d71('0x2e')];var _0x16eedd=_0x5af96d?_0x1515d3['count']:_0x2d0ebe[_0x0d71('0x2e')]+_0x2d0ebe[_0x0d71('0x30')];var _0x58478d;if(_0x16eedd>=_0x345d64){_0x16eedd=_0x345d64;_0x58478d=0xc8;}else{_0x58478d=0xce;}_0x2bfb75[_0x0d71('0x2c')](_0x58478d);return _0x2bfb75[_0x0d71('0x31')](_0x0d71('0x32'),_0x53d794+'-'+_0x16eedd+'/'+_0x345d64)[_0x0d71('0x2d')](_0x1515d3);}return null;};}function patchUpdates(_0x54759e){return function(_0x2a56d2){try{jsonpatch[_0x0d71('0x33')](_0x2a56d2,_0x54759e,!![]);}catch(_0x4d4eff){return BPromise['reject'](_0x4d4eff);}return _0x2a56d2['save']();};}function saveUpdates(_0x2e6e11,_0x481838){return function(_0x42a612){if(_0x42a612){return _0x42a612[_0x0d71('0x34')](_0x2e6e11)[_0x0d71('0x21')](function(_0x80d188){return _0x80d188;});}return null;};}function removeEntity(_0x501834,_0x56a70f){return function(_0x17d970){if(_0x17d970){return _0x17d970['destroy']()[_0x0d71('0x21')](function(){_0x501834[_0x0d71('0x2c')](0xcc)[_0x0d71('0x2b')]();});}};}function handleEntityNotFound(_0x59e5a6,_0x8a9b77){return function(_0xc228ee){if(!_0xc228ee){_0x59e5a6[_0x0d71('0x2a')](0x194);}return _0xc228ee;};}function handleError(_0x3eead2,_0x5401c4){_0x5401c4=_0x5401c4||0x1f4;return function(_0xec8cdc){logger[_0x0d71('0x26')](_0xec8cdc[_0x0d71('0x35')]);if(_0xec8cdc[_0x0d71('0x36')]){delete _0xec8cdc['name'];}_0x3eead2[_0x0d71('0x2c')](_0x5401c4)['send'](_0xec8cdc);};}exports[_0x0d71('0x37')]=function(_0x2c51ed,_0x38a9a9){var _0x53b680={},_0x27d40d={},_0x1fe358={'count':0x0,'rows':[]};var _0x3f46be=_[_0x0d71('0x38')](db['WhatsappMessage'][_0x0d71('0x39')],function(_0x2ff4e7){return{'name':_0x2ff4e7[_0x0d71('0x3a')],'type':_0x2ff4e7[_0x0d71('0x3b')][_0x0d71('0x3c')]};});_0x27d40d['model']=_[_0x0d71('0x38')](_0x3f46be,'name');_0x27d40d[_0x0d71('0x3d')]=_['keys'](_0x2c51ed['query']);_0x27d40d[_0x0d71('0x3e')]=_[_0x0d71('0x3f')](_0x27d40d[_0x0d71('0x40')],_0x27d40d[_0x0d71('0x3d')]);_0x53b680[_0x0d71('0x41')]=_[_0x0d71('0x3f')](_0x27d40d[_0x0d71('0x40')],qs['fields'](_0x2c51ed[_0x0d71('0x3d')][_0x0d71('0x42')]));_0x53b680[_0x0d71('0x41')]=_0x53b680[_0x0d71('0x41')]['length']?_0x53b680[_0x0d71('0x41')]:_0x27d40d[_0x0d71('0x40')];if(!_0x2c51ed[_0x0d71('0x3d')][_0x0d71('0x43')](_0x0d71('0x44'))){_0x53b680[_0x0d71('0x30')]=qs[_0x0d71('0x30')](_0x2c51ed[_0x0d71('0x3d')][_0x0d71('0x30')]);_0x53b680[_0x0d71('0x2e')]=qs[_0x0d71('0x2e')](_0x2c51ed['query']['offset']);}_0x53b680[_0x0d71('0x45')]=qs[_0x0d71('0x46')](_0x2c51ed[_0x0d71('0x3d')][_0x0d71('0x46')]);_0x53b680[_0x0d71('0x47')]=qs[_0x0d71('0x3e')](_[_0x0d71('0x48')](_0x2c51ed['query'],_0x27d40d[_0x0d71('0x3e')]),_0x3f46be);if(_0x2c51ed[_0x0d71('0x3d')][_0x0d71('0x49')]){_0x53b680[_0x0d71('0x47')]=_[_0x0d71('0x4a')](_0x53b680[_0x0d71('0x47')],{'$or':_[_0x0d71('0x38')](_0x3f46be,function(_0x32469d){if(_0x32469d[_0x0d71('0x3b')]!==_0x0d71('0x4b')){var _0xb1fb35={};_0xb1fb35[_0x32469d['name']]={'$like':'%'+_0x2c51ed['query'][_0x0d71('0x49')]+'%'};return _0xb1fb35;}})});}_0x53b680=_[_0x0d71('0x4a')]({},_0x53b680,_0x2c51ed[_0x0d71('0x4c')]);var _0x1102c6={'where':_0x53b680['where']};return db[_0x0d71('0x4d')][_0x0d71('0x4e')](_0x1102c6)[_0x0d71('0x21')](function(_0x30aac7){_0x1fe358[_0x0d71('0x4e')]=_0x30aac7;if(_0x2c51ed[_0x0d71('0x3d')]['includeAll']){_0x53b680['include']=[{'all':!![]}];}return db[_0x0d71('0x4d')][_0x0d71('0x4f')](_0x53b680);})[_0x0d71('0x21')](function(_0x3ea6c8){_0x1fe358[_0x0d71('0x50')]=_0x3ea6c8;return _0x1fe358;})['then'](respondWithFilteredResult(_0x38a9a9,_0x53b680))[_0x0d71('0x29')](handleError(_0x38a9a9,null));};exports[_0x0d71('0x51')]=function(_0x50569d,_0x198d17){var _0x19259e={'raw':!![],'where':{'id':_0x50569d['params']['id']}},_0x5651fd={};_0x5651fd[_0x0d71('0x40')]=_['keys'](db['WhatsappMessage'][_0x0d71('0x39')]);_0x5651fd[_0x0d71('0x3d')]=_[_0x0d71('0x52')](_0x50569d[_0x0d71('0x3d')]);_0x5651fd[_0x0d71('0x3e')]=_[_0x0d71('0x3f')](_0x5651fd['model'],_0x5651fd[_0x0d71('0x3d')]);_0x19259e[_0x0d71('0x41')]=_[_0x0d71('0x3f')](_0x5651fd[_0x0d71('0x40')],qs[_0x0d71('0x42')](_0x50569d[_0x0d71('0x3d')][_0x0d71('0x42')]));_0x19259e[_0x0d71('0x41')]=_0x19259e[_0x0d71('0x41')]['length']?_0x19259e[_0x0d71('0x41')]:_0x5651fd['model'];if(_0x50569d[_0x0d71('0x3d')][_0x0d71('0x53')]){_0x19259e['include']=[{'all':!![]}];}_0x19259e=_[_0x0d71('0x4a')]({},_0x19259e,_0x50569d['options']);return db[_0x0d71('0x4d')][_0x0d71('0x54')](_0x19259e)[_0x0d71('0x21')](handleEntityNotFound(_0x198d17,null))['then'](respondWithResult(_0x198d17,null))[_0x0d71('0x29')](handleError(_0x198d17,null));};exports[_0x0d71('0x55')]=function(_0x1bdc33,_0x3628ae){return db[_0x0d71('0x4d')][_0x0d71('0x55')](_0x1bdc33[_0x0d71('0x56')],{})[_0x0d71('0x21')](respondWithResult(_0x3628ae,0xc9))['catch'](handleError(_0x3628ae,null));};exports[_0x0d71('0x34')]=function(_0x363aa1,_0x13b286){if(_0x363aa1['body']['id']){delete _0x363aa1['body']['id'];}return db[_0x0d71('0x4d')]['find']({'where':{'id':_0x363aa1[_0x0d71('0x57')]['id']}})['then'](handleEntityNotFound(_0x13b286,null))['then'](saveUpdates(_0x363aa1['body'],null))[_0x0d71('0x21')](respondWithResult(_0x13b286,null))[_0x0d71('0x29')](handleError(_0x13b286,null));};exports[_0x0d71('0x58')]=function(_0x244385,_0xb10813){return db[_0x0d71('0x4d')][_0x0d71('0x54')]({'where':{'id':_0x244385['params']['id']}})['then'](handleEntityNotFound(_0xb10813,null))[_0x0d71('0x21')](removeEntity(_0xb10813,null))[_0x0d71('0x29')](handleError(_0xb10813,null));};exports[_0x0d71('0x59')]=function(_0x149c33,_0x31cb7b){return db['WhatsappMessage'][_0x0d71('0x59')]()['then'](respondWithResult(_0x31cb7b,null))[_0x0d71('0x29')](handleError(_0x31cb7b,null));};var interaction_log=require(_0x0d71('0x14'))(_0x0d71('0x5a'));exports[_0x0d71('0x5b')]=function(_0x39bbf5,_0x357d34,_0x3676fb){var _0x218eda={'agent':{},'channel':_0x0d71('0x5c')};if(_0x39bbf5[_0x0d71('0x56')]['id']){delete _0x39bbf5[_0x0d71('0x56')]['id'];}_0x39bbf5[_0x0d71('0x56')][_0x0d71('0x5d')]=!![];_0x39bbf5['body'][_0x0d71('0x5e')]=moment()[_0x0d71('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x39bbf5[_0x0d71('0x56')][_0x0d71('0x60')]=_0x39bbf5[_0x0d71('0x56')][_0x0d71('0x60')]||_0x39bbf5[_0x0d71('0x61')]['id'];_0x218eda[_0x0d71('0x62')]['id']=_0x39bbf5[_0x0d71('0x56')][_0x0d71('0x60')];return db[_0x0d71('0x4d')]['find']({'where':{'id':_0x39bbf5[_0x0d71('0x57')]['id'],'UserId':null}})[_0x0d71('0x21')](handleEntityNotFound(_0x357d34,null))[_0x0d71('0x21')](saveUpdates(_0x39bbf5['body'],null))[_0x0d71('0x21')](function(_0xb4d912){if(_0xb4d912){_0x218eda[_0x0d71('0x27')]=_0xb4d912[_0x0d71('0x63')]({'plain':!![]});return db[_0x0d71('0x64')]['find']({'where':{'id':_0xb4d912[_0x0d71('0x65')]}});}return null;})[_0x0d71('0x21')](handleEntityNotFound(_0x357d34,null))[_0x0d71('0x21')](function(_0x5d41b6){if(_0x5d41b6){return _0x5d41b6['update']({'UserId':_0x39bbf5['body'][_0x0d71('0x60')],'read1stAt':_[_0x0d71('0x66')](_0x5d41b6[_0x0d71('0x67')])?moment()['format'](_0x0d71('0x68')):undefined});}return null;})[_0x0d71('0x21')](function(_0x195da9){if(_0x195da9){_0x218eda[_0x0d71('0x69')]=_0x195da9[_0x0d71('0x63')]({'plain':!![]});interaction_log['info'](_0x0d71('0x6a'),_0x39bbf5[_0x0d71('0x61')]['id'],_0x39bbf5[_0x0d71('0x61')][_0x0d71('0x36')],_0x39bbf5[_0x0d71('0x61')]['role'],_0x218eda['interaction']['id'],_0x39bbf5['body']?JSON['stringify'](_0x39bbf5[_0x0d71('0x56')]):'null');return respondWithRpcPromise(_0x0d71('0x6b'),_0x0d71('0x6c'),_0x218eda);}return null;})[_0x0d71('0x21')](function(_0xaa16f7){var _0x1aeeeb=_0x0d71('0x6d')+_0xaa16f7[_0x0d71('0x27')][_0x0d71('0x6e')];return db[_0x0d71('0x6f')]['query'](_0x1aeeeb,{'type':db[_0x0d71('0x70')]['QueryTypes'][_0x0d71('0x71')],'raw':!![]})[_0x0d71('0x21')](function(_0x5f4a54){return _0x5f4a54;});})['then'](function(_0x14f6de){if(_0x14f6de){_0x218eda['message'][_0x0d71('0x72')]=_0x14f6de[0x0];if(!_0x39bbf5[_0x0d71('0x56')][_0x0d71('0x60')])return;return db[_0x0d71('0x73')][_0x0d71('0x54')]({'where':{'id':_0x39bbf5[_0x0d71('0x56')]['UserId'],'role':_0x0d71('0x62')},'attributes':['id',_0x0d71('0x36'),_0x0d71('0x74'),_0x0d71('0x75'),_0x0d71('0x76')],'raw':!![]});}return null;})[_0x0d71('0x21')](function(_0x24f897){if(!_0x24f897)return null;_0x218eda['message'][_0x0d71('0x62')]=_0x24f897;return _0x218eda;})[_0x0d71('0x21')](function(_0x49c5f7){if(_0x49c5f7){if(_0x39bbf5[_0x0d71('0x56')]['manual']){_0x218eda[_0x0d71('0x27')][_0x0d71('0x77')]=util['format'](_0x0d71('0x78'),_0x39bbf5['user'][_0x0d71('0x36')]);_0x218eda['message'][_0x0d71('0x79')]=_0x218eda['channel'];_0x218eda[_0x0d71('0x27')][_0x0d71('0x7a')]=_0x218eda[_0x0d71('0x79')];_0x218eda[_0x0d71('0x27')][_0x0d71('0x7b')]='accept';return respondWithRpcPromise(_0x0d71('0x7c'),'EventManager',{'event':_0x0d71('0x7d'),'message':_0x218eda['message']},client9002)['then'](function(){return _0x218eda;});}return _0x218eda;}return null;})[_0x0d71('0x21')](respondWithResult(_0x357d34,null))[_0x0d71('0x29')](handleError(_0x357d34,null));};var interaction_log=require(_0x0d71('0x14'))(_0x0d71('0x5a'));exports[_0x0d71('0x7e')]=function(_0x41c344,_0x3b8e6c,_0x1af5fb){var _0x1647b2={'agent':{},'channel':_0x0d71('0x5c')};if(_0x41c344['body']['id']){delete _0x41c344[_0x0d71('0x56')]['id'];}_0x41c344[_0x0d71('0x56')][_0x0d71('0x60')]=_0x41c344[_0x0d71('0x56')][_0x0d71('0x60')]||_0x41c344['user']['id'];_0x1647b2[_0x0d71('0x62')]['id']=_0x41c344['body'][_0x0d71('0x60')];return db[_0x0d71('0x4d')][_0x0d71('0x54')]({'where':{'id':_0x41c344[_0x0d71('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3b8e6c,null))[_0x0d71('0x21')](function(_0x43fc05){if(_0x43fc05){_0x1647b2[_0x0d71('0x27')]=_0x43fc05[_0x0d71('0x63')]({'plain':!![]});return db['WhatsappInteraction'][_0x0d71('0x54')]({'where':{'id':_0x43fc05['WhatsappInteractionId']}});}return null;})[_0x0d71('0x21')](handleEntityNotFound(_0x3b8e6c,null))[_0x0d71('0x21')](function(_0x244063){if(_0x244063){_0x1647b2[_0x0d71('0x69')]=_0x244063['get']({'plain':!![]});interaction_log[_0x0d71('0x22')](_0x0d71('0x7f'),_0x41c344[_0x0d71('0x61')]['id'],_0x41c344['user'][_0x0d71('0x36')],_0x41c344[_0x0d71('0x61')][_0x0d71('0x80')],_0x1647b2[_0x0d71('0x69')]['id'],_0x41c344['body']?JSON[_0x0d71('0x81')](_0x41c344[_0x0d71('0x56')]):'null');return respondWithRpcPromise(_0x0d71('0x82'),'rejectMessage',_0x1647b2);}return null;})[_0x0d71('0x21')](function(_0x2eec31){var _0x113483=_0x0d71('0x6d')+_0x2eec31[_0x0d71('0x27')][_0x0d71('0x6e')];return db[_0x0d71('0x6f')][_0x0d71('0x3d')](_0x113483,{'type':db['Sequelize'][_0x0d71('0x83')][_0x0d71('0x71')],'raw':!![]})[_0x0d71('0x21')](function(_0x5ea72b){return _0x5ea72b;});})['then'](function(_0x1b44e9){if(_0x1b44e9){_0x1647b2[_0x0d71('0x27')]['contact']=_0x1b44e9[0x0];if(!_0x41c344['body'][_0x0d71('0x60')])return;return db[_0x0d71('0x73')][_0x0d71('0x54')]({'where':{'id':_0x41c344[_0x0d71('0x56')]['UserId'],'role':'agent'},'attributes':['id',_0x0d71('0x36'),_0x0d71('0x74'),_0x0d71('0x75'),'internal'],'raw':!![]});}return null;})[_0x0d71('0x21')](function(_0x3f3cfd){if(!_0x3f3cfd)return null;_0x1647b2[_0x0d71('0x27')][_0x0d71('0x62')]=_0x3f3cfd;return _0x1647b2;})[_0x0d71('0x21')](function(_0x1ae09c){if(_0x1ae09c){_0x1ae09c[_0x0d71('0x27')][_0x0d71('0x77')]=util[_0x0d71('0x5f')](_0x0d71('0x78'),_0x41c344[_0x0d71('0x61')]['name']);_0x1ae09c[_0x0d71('0x27')][_0x0d71('0x79')]=_0x1647b2[_0x0d71('0x79')];_0x1ae09c[_0x0d71('0x27')][_0x0d71('0x7a')]=_0x1647b2[_0x0d71('0x79')];_0x1ae09c[_0x0d71('0x27')][_0x0d71('0x7b')]=_0x0d71('0x7e');respondWithRpcPromise(_0x0d71('0x7c'),'EventManager',{'event':'rejectmessage','message':_0x1ae09c[_0x0d71('0x27')]},client9002);return _0x1647b2;}return null;})[_0x0d71('0x21')](respondWithResult(_0x3b8e6c,null))[_0x0d71('0x29')](handleError(_0x3b8e6c,null));};exports[_0x0d71('0x2c')]=function(_0x191998,_0x1c68a0,_0x3df527){if(_0x191998[_0x0d71('0x56')]['id']){delete _0x191998[_0x0d71('0x56')]['id'];}var _0x1a5339;return db[_0x0d71('0x4d')][_0x0d71('0x54')]({'where':{'id':_0x191998['params']['id']}})[_0x0d71('0x21')](handleEntityNotFound(_0x1c68a0,null))[_0x0d71('0x21')](function(_0x6d4bf2){if(_0x6d4bf2){_0x1a5339=_0x6d4bf2;return db['WhatsappAccount']['find']({'where':{'id':_0x6d4bf2[_0x0d71('0x84')]}});}})['then'](handleEntityNotFound(_0x1c68a0,null))['then'](function(_0x570cfc){if(_0x570cfc){logger['debug'](_0x0d71('0x85'),'status','received\x20delivery\x20report\x20from',_0x570cfc[_0x0d71('0x3b')],util[_0x0d71('0x86')](_0x191998['body'],{'showHidden':![],'depth':null}));switch(_0x570cfc[_0x0d71('0x3b')]){case'twilio':if(_0x191998[_0x0d71('0x56')]['MessageSid']&&_0x191998[_0x0d71('0x56')][_0x0d71('0x87')]===_0x1a5339[_0x0d71('0x88')]&&_0x191998[_0x0d71('0x56')][_0x0d71('0x89')]&&_0x191998[_0x0d71('0x56')][_0x0d71('0x89')]===_0x0d71('0x5d')){return _0x1a5339[_0x0d71('0x34')]({'read':!![]});}else{logger['error'](_0x0d71('0x8a'),_0x0d71('0x2c'),'twilio',util[_0x0d71('0x86')](_0x191998[_0x0d71('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x1a5339;}})[_0x0d71('0x21')](respondWithResult(_0x1c68a0,null))[_0x0d71('0x29')](handleError(_0x1c68a0,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 89e4873..7fb16b3 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 _0x9b87=['../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x24fc10,_0x2907ec){var _0x440b9f=function(_0x19ff63){while(--_0x19ff63){_0x24fc10['push'](_0x24fc10['shift']());}};_0x440b9f(++_0x2907ec);}(_0x9b87,0x8e));var _0x79b8=function(_0x4fe0a1,_0x195a82){_0x4fe0a1=_0x4fe0a1-0x0;var _0x10ce22=_0x9b87[_0x4fe0a1];return _0x10ce22;};'use strict';var EventEmitter=require(_0x79b8('0x0'));var WhatsappMessage=require(_0x79b8('0x1'))['db'][_0x79b8('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x79b8('0x3')](0x0);var events={'afterCreate':_0x79b8('0x4'),'afterUpdate':_0x79b8('0x5'),'afterDestroy':_0x79b8('0x6')};function emitEvent(_0xb4e3e7){return function(_0xbc1e74,_0xa65bbc,_0x1f9679){WhatsappMessageEvents[_0x79b8('0x7')](_0xb4e3e7+':'+_0xbc1e74['id'],_0xbc1e74);WhatsappMessageEvents[_0x79b8('0x7')](_0xb4e3e7,_0xbc1e74);_0x1f9679(null);};}for(var e in events){if(events[_0x79b8('0x8')](e)){var event=events[e];WhatsappMessage[_0x79b8('0x9')](e,emitEvent(event));}}module[_0x79b8('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0xe511=['../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x4a4ff6,_0x2b0de3){var _0x55e8de=function(_0x284afd){while(--_0x284afd){_0x4a4ff6['push'](_0x4a4ff6['shift']());}};_0x55e8de(++_0x2b0de3);}(_0xe511,0x16f));var _0x1e51=function(_0x33f96f,_0x1680b1){_0x33f96f=_0x33f96f-0x0;var _0x3156f2=_0xe511[_0x33f96f];return _0x3156f2;};'use strict';var EventEmitter=require(_0x1e51('0x0'));var WhatsappMessage=require(_0x1e51('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x1e51('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1e51('0x3'),'afterDestroy':_0x1e51('0x4')};function emitEvent(_0x5bfa5d){return function(_0x42e242,_0x2be2b7,_0x204da7){WhatsappMessageEvents[_0x1e51('0x5')](_0x5bfa5d+':'+_0x42e242['id'],_0x42e242);WhatsappMessageEvents['emit'](_0x5bfa5d,_0x42e242);_0x204da7(null);};}for(var e in events){if(events[_0x1e51('0x6')](e)){var event=events[e];WhatsappMessage[_0x1e51('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 0cfe00d..8367193 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 _0x13ec=['moment','bluebird','request-promise','node-fetch','path','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','phone','authToken','messages','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','baseUrl','/whatsapp/v1/','POST','statuses','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger'];(function(_0x2bd211,_0x522300){var _0x5b963e=function(_0x553314){while(--_0x553314){_0x2bd211['push'](_0x2bd211['shift']());}};_0x5b963e(++_0x522300);}(_0x13ec,0x179));var _0xc13e=function(_0xb57b08,_0x1c1790){_0xb57b08=_0xb57b08-0x0;var _0x3334fb=_0x13ec[_0xb57b08];return _0x3334fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc13e('0x0'))('api');var moment=require(_0xc13e('0x1'));var BPromise=require(_0xc13e('0x2'));var rp=require(_0xc13e('0x3'));var fetch=require(_0xc13e('0x4'));var fs=require('fs');var path=require(_0xc13e('0x5'));var rimraf=require('rimraf');var config=require(_0xc13e('0x6'));var attributes=require('./whatsappMessage.attributes');module[_0xc13e('0x7')]=function(_0x1f437f,_0x47d728){return _0x1f437f[_0xc13e('0x8')](_0xc13e('0x9'),attributes,{'tableName':_0xc13e('0xa'),'paranoid':![],'indexes':[{'name':_0xc13e('0xb'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0xc13e('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x31413a,_0xf00ef1,_0x383413){var _0x2d8692=_0x1f437f[_0xc13e('0xd')];var _0x1fde1a=_0x31413a['get']({'plain':!![]});if(_0x1fde1a[_0xc13e('0xe')][_0xc13e('0xf')]()==='in'||_0x1fde1a[_0xc13e('0xe')][_0xc13e('0xf')]()===_0xc13e('0x10')&&!_0x1fde1a[_0xc13e('0x11')]&&!_[_0xc13e('0x12')](_0x1fde1a[_0xc13e('0x13')])){_0x2d8692[_0xc13e('0x14')]['findOne']({'where':{'id':_0x1fde1a[_0xc13e('0x15')]}})[_0xc13e('0x16')](function(_0x1ef793){if(_0x1ef793){_0x1ef793[_0xc13e('0x17')]({'lastMsgAt':_0x1fde1a[_0xc13e('0x18')],'lastMsgDirection':_0x1fde1a[_0xc13e('0xe')]['toLowerCase']()});}})[_0xc13e('0x19')](function(_0xcddea8){console[_0xc13e('0x1a')](_0xcddea8);});}if(_0x1fde1a[_0xc13e('0xe')]==='out'&&!_0x1fde1a[_0xc13e('0x11')]){var _0x2a2c07;_0x2d8692[_0xc13e('0x1b')][_0xc13e('0x1c')]({'where':{'id':_0x1fde1a[_0xc13e('0x1d')]},'raw':!![]})[_0xc13e('0x16')](function(_0x333fa3){_0x2a2c07=_0x333fa3;if(_0x2a2c07&&_0x2a2c07['type']){switch(_0x2a2c07[_0xc13e('0x1e')]){case _0xc13e('0x1f'):var _0x31367e=require(_0xc13e('0x1f'));if(_0x2a2c07[_0xc13e('0x20')]&&_0x2a2c07['authToken']&&_0x2a2c07[_0xc13e('0x21')]){var _0x31062a=new _0x31367e(_0x2a2c07[_0xc13e('0x20')],_0x2a2c07[_0xc13e('0x22')]);_0x31062a[_0xc13e('0x23')]['create']({'body':_0x1fde1a[_0xc13e('0x24')],'to':_0xc13e('0x25')+_0x1fde1a[_0xc13e('0x21')],'from':_0xc13e('0x25')+_0x2a2c07[_0xc13e('0x21')],'statusCallback':_0x2a2c07[_0xc13e('0x26')]+_0xc13e('0x27')+_0x1fde1a['id']+_0xc13e('0x28')+_0x2a2c07['token']})[_0xc13e('0x16')](function(_0x591ddd){if(_0x591ddd['sid']){return _0x31413a[_0xc13e('0x17')]({'messageId':_0x591ddd['sid']});}})[_0xc13e('0x19')](function(_0x4f0303){logger[_0xc13e('0x1a')](_0xc13e('0x29'),_0xc13e('0x2a'),_0xc13e('0x1f'),util[_0xc13e('0x2b')](_0x4f0303,{'showHidden':![],'depth':null}));});}else{logger[_0xc13e('0x1a')](_0xc13e('0x29'),_0xc13e('0x2a'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xc13e('0x2c'):var _0x30d92f=_0x2a2c07[_0xc13e('0x20')];var _0x4ff6ea=_0x2a2c07['authToken'];var _0x31434a=_0x2a2c07[_0xc13e('0x2d')]+_0xc13e('0x2e')+_0x30d92f+'/messages/';var _0x3ee9b3={'to':[_0x1fde1a[_0xc13e('0x21')]],'message':{'type':'text','text':_0x1fde1a['body']}};var _0x29e472={'method':_0xc13e('0x2f'),'uri':_0x31434a,'headers':{'Authorization':'Bearer\x20'+_0x4ff6ea,'Content-Type':'application/json'},'body':_0x3ee9b3,'json':!![]};rp(_0x29e472)['then'](function(_0xefba60){if(_0xefba60['statuses'][0x0]['message_id']){return _0x31413a[_0xc13e('0x17')]({'messageId':_0xefba60[_0xc13e('0x30')][0x0]['message_id']});}})[_0xc13e('0x19')](function(_0x34f15a){logger[_0xc13e('0x31')](_0xc13e('0x32'),_0x34f15a);});break;}}})[_0xc13e('0x33')](function(){_0x383413();});}else{_0x383413();}}},'charset':_0xc13e('0x34'),'collate':_0xc13e('0x35')});}; \ No newline at end of file +var _0xdd92=['authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','then','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','accountSid','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','message_id','statuses','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','WhatsappInteractionId','update','createdAt','catch','error','WhatsappAccount','find','type','twilio'];(function(_0x547890,_0x593741){var _0x2c8daa=function(_0x1b100d){while(--_0x1b100d){_0x547890['push'](_0x547890['shift']());}};_0x2c8daa(++_0x593741);}(_0xdd92,0x188));var _0x2dd9=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xdd92[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0x2dd9('0x0'));var util=require(_0x2dd9('0x1'));var logger=require(_0x2dd9('0x2'))(_0x2dd9('0x3'));var moment=require('moment');var BPromise=require(_0x2dd9('0x4'));var rp=require(_0x2dd9('0x5'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0x2dd9('0x6'));var rimraf=require('rimraf');var config=require(_0x2dd9('0x7'));var attributes=require(_0x2dd9('0x8'));module[_0x2dd9('0x9')]=function(_0x2a0348,_0x5e0eb7){return _0x2a0348[_0x2dd9('0xa')](_0x2dd9('0xb'),attributes,{'tableName':_0x2dd9('0xc'),'paranoid':![],'indexes':[{'name':_0x2dd9('0xd'),'fields':[_0x2dd9('0xd')]},{'name':_0x2dd9('0xe'),'fields':[_0x2dd9('0xf')],'type':_0x2dd9('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x37b0b7,_0x4b3e45,_0x2882ed){var _0x495861=_0x2a0348[_0x2dd9('0x11')];var _0x1c8fc5=_0x37b0b7[_0x2dd9('0x12')]({'plain':!![]});if(_0x1c8fc5[_0x2dd9('0x13')][_0x2dd9('0x14')]()==='in'||_0x1c8fc5[_0x2dd9('0x13')]['toLowerCase']()===_0x2dd9('0x15')&&!_0x1c8fc5[_0x2dd9('0x16')]&&!_[_0x2dd9('0x17')](_0x1c8fc5[_0x2dd9('0x18')])){_0x495861['WhatsappInteraction'][_0x2dd9('0x19')]({'where':{'id':_0x1c8fc5[_0x2dd9('0x1a')]}})['then'](function(_0x3bf7d1){if(_0x3bf7d1){_0x3bf7d1[_0x2dd9('0x1b')]({'lastMsgAt':_0x1c8fc5[_0x2dd9('0x1c')],'lastMsgDirection':_0x1c8fc5[_0x2dd9('0x13')][_0x2dd9('0x14')]()});}})[_0x2dd9('0x1d')](function(_0x2ca0e4){console[_0x2dd9('0x1e')](_0x2ca0e4);});}if(_0x1c8fc5[_0x2dd9('0x13')]===_0x2dd9('0x15')&&!_0x1c8fc5[_0x2dd9('0x16')]){var _0x1786a5;_0x495861[_0x2dd9('0x1f')][_0x2dd9('0x20')]({'where':{'id':_0x1c8fc5['WhatsappAccountId']},'raw':!![]})['then'](function(_0x2bb6cf){_0x1786a5=_0x2bb6cf;if(_0x1786a5&&_0x1786a5[_0x2dd9('0x21')]){switch(_0x1786a5[_0x2dd9('0x21')]){case _0x2dd9('0x22'):var _0x301d2d=require('twilio');if(_0x1786a5['accountSid']&&_0x1786a5[_0x2dd9('0x23')]&&_0x1786a5[_0x2dd9('0x24')]){var _0x1ea117=new _0x301d2d(_0x1786a5['accountSid'],_0x1786a5['authToken']);_0x1ea117[_0x2dd9('0x25')][_0x2dd9('0x26')]({'body':_0x1c8fc5[_0x2dd9('0xf')],'to':_0x2dd9('0x27')+_0x1c8fc5[_0x2dd9('0x24')],'from':_0x2dd9('0x27')+_0x1786a5[_0x2dd9('0x24')],'statusCallback':_0x1786a5[_0x2dd9('0x28')]+_0x2dd9('0x29')+_0x1c8fc5['id']+'/status?token='+_0x1786a5['token']})[_0x2dd9('0x2a')](function(_0x127172){if(_0x127172[_0x2dd9('0x2b')]){return _0x37b0b7['update']({'messageId':_0x127172[_0x2dd9('0x2b')]});}})[_0x2dd9('0x1d')](function(_0x5d10d3){logger[_0x2dd9('0x1e')](_0x2dd9('0x2c'),_0x2dd9('0x2d'),'twilio',util[_0x2dd9('0x2e')](_0x5d10d3,{'showHidden':![],'depth':null}));});}else{logger[_0x2dd9('0x1e')](_0x2dd9('0x2c'),_0x2dd9('0x2d'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x2dd9('0x2f'):var _0x2522c3=_0x1786a5[_0x2dd9('0x30')];var _0x160bd6=_0x1786a5[_0x2dd9('0x23')];var _0x51e88b=_0x1786a5['baseUrl']+_0x2dd9('0x31')+_0x2522c3+_0x2dd9('0x32');var _0x2f38f1={'to':[_0x1c8fc5[_0x2dd9('0x24')]],'message':{'type':_0x2dd9('0x33'),'text':_0x1c8fc5['body']}};var _0x5556fc={'method':_0x2dd9('0x34'),'uri':_0x51e88b,'headers':{'Authorization':_0x2dd9('0x35')+_0x160bd6,'Content-Type':_0x2dd9('0x36')},'body':_0x2f38f1,'json':!![]};rp(_0x5556fc)['then'](function(_0x8b1fb8){if(_0x8b1fb8['statuses'][0x0][_0x2dd9('0x37')]){return _0x37b0b7[_0x2dd9('0x1b')]({'messageId':_0x8b1fb8[_0x2dd9('0x38')][0x0][_0x2dd9('0x37')]});}})[_0x2dd9('0x1d')](function(_0x100002){logger[_0x2dd9('0x39')](_0x2dd9('0x3a'),_0x100002);});break;}}})[_0x2dd9('0x3b')](function(){_0x2882ed();});}else{_0x2882ed();}}},'charset':_0x2dd9('0x3c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index c759deb..3b0b90e 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 _0xc80e=['body','options','raw','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','create'];(function(_0x4cb76d,_0x217c89){var _0x145d12=function(_0x592ef0){while(--_0x592ef0){_0x4cb76d['push'](_0x4cb76d['shift']());}};_0x145d12(++_0x217c89);}(_0xc80e,0x1bd));var _0xec80=function(_0x337d93,_0x7908a5){_0x337d93=_0x337d93-0x0;var _0x52a98b=_0xc80e[_0x337d93];return _0x52a98b;};'use strict';var _=require(_0xec80('0x0'));var util=require(_0xec80('0x1'));var moment=require(_0xec80('0x2'));var BPromise=require('bluebird');var rs=require(_0xec80('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec80('0x4'))['db'];var utils=require(_0xec80('0x5'));var logger=require(_0xec80('0x6'))(_0xec80('0x7'));var config=require(_0xec80('0x8'));var jayson=require(_0xec80('0x9'));var client=jayson[_0xec80('0xa')][_0xec80('0xb')]({'port':0x232a});config[_0xec80('0xc')]=_[_0xec80('0xd')](config[_0xec80('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xec80('0xe'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0xec80('0xf')](socket);function respondWithRpcPromise(_0x5ce196,_0x577a30,_0xe326d6){return new BPromise(function(_0x2d7417,_0x40b193){return client[_0xec80('0x10')](_0x5ce196,_0xe326d6)[_0xec80('0x11')](function(_0x44acac){logger[_0xec80('0x12')](_0xec80('0x13'),_0x577a30,_0xec80('0x14'));logger[_0xec80('0x15')](_0xec80('0x16'),_0x577a30,_0xec80('0x14'),JSON[_0xec80('0x17')](_0x44acac));if(_0x44acac[_0xec80('0x18')]){if(_0x44acac[_0xec80('0x18')][_0xec80('0x19')]===0x1f4){logger[_0xec80('0x18')](_0xec80('0x13'),_0x577a30,_0x44acac[_0xec80('0x18')][_0xec80('0x1a')]);return _0x40b193(_0x44acac[_0xec80('0x18')][_0xec80('0x1a')]);}logger[_0xec80('0x18')](_0xec80('0x13'),_0x577a30,_0x44acac[_0xec80('0x18')][_0xec80('0x1a')]);return _0x2d7417(_0x44acac[_0xec80('0x18')][_0xec80('0x1a')]);}else{logger[_0xec80('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x577a30,_0xec80('0x14'));_0x2d7417(_0x44acac[_0xec80('0x1b')][_0xec80('0x1a')]);}})[_0xec80('0x1c')](function(_0x125cbb){logger[_0xec80('0x18')](_0xec80('0x13'),_0x577a30,_0x125cbb);_0x40b193(_0x125cbb);});});}exports[_0xec80('0x1d')]=function(_0x356a0c){var _0x11f771=this;return new Promise(function(_0xd2f6cc,_0x5937ff){return db['WhatsappMessage'][_0xec80('0x1e')](_0x356a0c[_0xec80('0x1f')],{'raw':_0x356a0c[_0xec80('0x20')]?_0x356a0c[_0xec80('0x20')][_0xec80('0x21')]===undefined?!![]:![]:!![]})[_0xec80('0x11')](function(_0x448d72){logger[_0xec80('0x12')](_0xec80('0x1d'),_0x356a0c);logger[_0xec80('0x15')](_0xec80('0x1d'),_0x356a0c,JSON[_0xec80('0x17')](_0x448d72));_0xd2f6cc(_0x448d72);})[_0xec80('0x1c')](function(_0x3307b1){logger[_0xec80('0x18')](_0xec80('0x1d'),_0x3307b1[_0xec80('0x1a')],_0x356a0c);_0x5937ff(_0x11f771[_0xec80('0x18')](0x1f4,_0x3307b1['message']));});});}; \ No newline at end of file +var _0x05ae=['WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','stringify','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','request','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x280ae7,_0x456fb1){var _0x418b9e=function(_0x4d730d){while(--_0x4d730d){_0x280ae7['push'](_0x280ae7['shift']());}};_0x418b9e(++_0x456fb1);}(_0x05ae,0xad));var _0xe05a=function(_0x19bfe9,_0x28c2da){_0x19bfe9=_0x19bfe9-0x0;var _0x3e4fee=_0x05ae[_0x19bfe9];return _0x3e4fee;};'use strict';var _=require(_0xe05a('0x0'));var util=require('util');var moment=require(_0xe05a('0x1'));var BPromise=require('bluebird');var rs=require(_0xe05a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe05a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xe05a('0x4'))(_0xe05a('0x5'));var config=require(_0xe05a('0x6'));var jayson=require(_0xe05a('0x7'));var client=jayson[_0xe05a('0x8')][_0xe05a('0x9')]({'port':0x232a});config[_0xe05a('0xa')]=_[_0xe05a('0xb')](config['redis'],{'host':_0xe05a('0xc'),'port':0x18eb});var socket=require(_0xe05a('0xd'))(new Redis(config['redis']));require(_0xe05a('0xe'))['register'](socket);function respondWithRpcPromise(_0x5ef9e1,_0xee151b,_0x4ab170){return new BPromise(function(_0x42f122,_0x141ff5){return client[_0xe05a('0xf')](_0x5ef9e1,_0x4ab170)['then'](function(_0x3a50e2){logger['info'](_0xe05a('0x10'),_0xee151b,_0xe05a('0x11'));logger[_0xe05a('0x12')](_0xe05a('0x13'),_0xee151b,_0xe05a('0x11'),JSON['stringify'](_0x3a50e2));if(_0x3a50e2[_0xe05a('0x14')]){if(_0x3a50e2[_0xe05a('0x14')][_0xe05a('0x15')]===0x1f4){logger[_0xe05a('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0xee151b,_0x3a50e2[_0xe05a('0x14')]['message']);return _0x141ff5(_0x3a50e2[_0xe05a('0x14')][_0xe05a('0x16')]);}logger['error'](_0xe05a('0x10'),_0xee151b,_0x3a50e2[_0xe05a('0x14')]['message']);return _0x42f122(_0x3a50e2['error']['message']);}else{logger[_0xe05a('0x17')](_0xe05a('0x10'),_0xee151b,_0xe05a('0x11'));_0x42f122(_0x3a50e2['result'][_0xe05a('0x16')]);}})[_0xe05a('0x18')](function(_0x5bed32){logger[_0xe05a('0x14')](_0xe05a('0x10'),_0xee151b,_0x5bed32);_0x141ff5(_0x5bed32);});});}exports[_0xe05a('0x19')]=function(_0x46b808){var _0x387194=this;return new Promise(function(_0x2fafe4,_0x32aaae){return db[_0xe05a('0x1a')][_0xe05a('0x1b')](_0x46b808[_0xe05a('0x1c')],{'raw':_0x46b808['options']?_0x46b808[_0xe05a('0x1d')][_0xe05a('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x51a22a){logger[_0xe05a('0x17')](_0xe05a('0x19'),_0x46b808);logger[_0xe05a('0x12')](_0xe05a('0x19'),_0x46b808,JSON[_0xe05a('0x1f')](_0x51a22a));_0x2fafe4(_0x51a22a);})[_0xe05a('0x18')](function(_0x1ddf90){logger[_0xe05a('0x14')]('CreateWhatsappMessage',_0x1ddf90[_0xe05a('0x16')],_0x46b808);_0x32aaae(_0x387194['error'](0x1f4,_0x1ddf90[_0xe05a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 37a2015..03f8e46 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 _0x0dab=['save','remove','update','emit','removeListener','register'];(function(_0x2694ae,_0x728ab2){var _0x46a212=function(_0x1f8c47){while(--_0x1f8c47){_0x2694ae['push'](_0x2694ae['shift']());}};_0x46a212(++_0x728ab2);}(_0x0dab,0x150));var _0xb0da=function(_0x3c4d8b,_0x3fffe1){_0x3c4d8b=_0x3c4d8b-0x0;var _0x2214d6=_0x0dab[_0x3c4d8b];return _0x2214d6;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xb0da('0x0'),_0xb0da('0x1'),_0xb0da('0x2')];function createListener(_0x2237ec,_0x35316d){return function(_0x1d33ce){_0x35316d[_0xb0da('0x3')](_0x2237ec,_0x1d33ce);};}function removeListener(_0x57171f,_0x1f5d39){return function(){WhatsappMessageEvents[_0xb0da('0x4')](_0x57171f,_0x1f5d39);};}exports[_0xb0da('0x5')]=function(_0x41bab2){for(var _0x3da374=0x0,_0xefc123=events['length'];_0x3da374<_0xefc123;_0x3da374++){var _0x39ffef=events[_0x3da374];var _0x31cca9=createListener('whatsappMessage:'+_0x39ffef,_0x41bab2);WhatsappMessageEvents['on'](_0x39ffef,_0x31cca9);}}; \ No newline at end of file +var _0xb677=['whatsappMessage:','./whatsappMessage.events','save','emit','removeListener','length'];(function(_0x3926ba,_0x237901){var _0x18756e=function(_0x5ca849){while(--_0x5ca849){_0x3926ba['push'](_0x3926ba['shift']());}};_0x18756e(++_0x237901);}(_0xb677,0x1cf));var _0x7b67=function(_0x1d2af2,_0x1a2a91){_0x1d2af2=_0x1d2af2-0x0;var _0x2cbcf8=_0xb677[_0x1d2af2];return _0x2cbcf8;};'use strict';var WhatsappMessageEvents=require(_0x7b67('0x0'));var events=[_0x7b67('0x1'),'remove','update'];function createListener(_0x419904,_0x55f3fa){return function(_0x3346c0){_0x55f3fa[_0x7b67('0x2')](_0x419904,_0x3346c0);};}function removeListener(_0x3036b0,_0x286cad){return function(){WhatsappMessageEvents[_0x7b67('0x3')](_0x3036b0,_0x286cad);};}exports['register']=function(_0x5929a6){for(var _0x3827e5=0x0,_0x85c20a=events[_0x7b67('0x4')];_0x3827e5<_0x85c20a;_0x3827e5++){var _0x23ac07=events[_0x3827e5];var _0x12e93d=createListener(_0x7b67('0x5')+_0x23ac07,_0x5929a6);WhatsappMessageEvents['on'](_0x23ac07,_0x12e93d);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 19f471d..5f6cd57 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 _0x57bc=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','isAuthenticated','describe','show','getMembers','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','removeAgents','multer','util','path','express','Router'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x57bc,0x1d7));var _0xc57b=function(_0x14c29a,_0x665f77){_0x14c29a=_0x14c29a-0x0;var _0x3c072d=_0x57bc[_0x14c29a];return _0x3c072d;};'use strict';var multer=require(_0xc57b('0x0'));var util=require(_0xc57b('0x1'));var path=require(_0xc57b('0x2'));var timeout=require('connect-timeout');var express=require(_0xc57b('0x3'));var router=express[_0xc57b('0x4')]();var fs_extra=require(_0xc57b('0x5'));var auth=require(_0xc57b('0x6'));var interaction=require(_0xc57b('0x7'));var config=require(_0xc57b('0x8'));var controller=require(_0xc57b('0x9'));router[_0xc57b('0xa')]('/',auth['isAuthenticated'](),controller[_0xc57b('0xb')]);router[_0xc57b('0xa')]('/describe',auth[_0xc57b('0xc')](),controller[_0xc57b('0xd')]);router['get']('/:id',auth[_0xc57b('0xc')](),controller[_0xc57b('0xe')]);router[_0xc57b('0xa')]('/:id/members',auth[_0xc57b('0xc')](),controller[_0xc57b('0xf')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get'](_0xc57b('0x10'),auth['isAuthenticated'](),controller[_0xc57b('0x11')]);router[_0xc57b('0x12')]('/',auth[_0xc57b('0xc')](),controller['create']);router['post'](_0xc57b('0x13'),auth[_0xc57b('0xc')](),controller[_0xc57b('0x14')]);router[_0xc57b('0x12')]('/:id/users',auth[_0xc57b('0xc')](),controller[_0xc57b('0x15')]);router['put'](_0xc57b('0x16'),auth[_0xc57b('0xc')](),controller[_0xc57b('0x17')]);router[_0xc57b('0x18')]('/:id',auth[_0xc57b('0xc')](),controller[_0xc57b('0x19')]);router[_0xc57b('0x18')](_0xc57b('0x13'),auth[_0xc57b('0xc')](),controller[_0xc57b('0x1a')]);router[_0xc57b('0x18')](_0xc57b('0x10'),auth[_0xc57b('0xc')](),controller[_0xc57b('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x5c01=['put','update','delete','destroy','removeTeams','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create','post'];(function(_0x50ceed,_0x2cf670){var _0x9034e2=function(_0x3a4747){while(--_0x3a4747){_0x50ceed['push'](_0x50ceed['shift']());}};_0x9034e2(++_0x2cf670);}(_0x5c01,0x9c));var _0x15c0=function(_0x3f7868,_0x4e4f5a){_0x3f7868=_0x3f7868-0x0;var _0x98d27d=_0x5c01[_0x3f7868];return _0x98d27d;};'use strict';var multer=require(_0x15c0('0x0'));var util=require('util');var path=require(_0x15c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x15c0('0x2'));var router=express['Router']();var fs_extra=require(_0x15c0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x15c0('0x4'));var config=require(_0x15c0('0x5'));var controller=require('./whatsappQueue.controller');router[_0x15c0('0x6')]('/',auth[_0x15c0('0x7')](),controller['index']);router[_0x15c0('0x6')](_0x15c0('0x8'),auth[_0x15c0('0x7')](),controller[_0x15c0('0x9')]);router['get'](_0x15c0('0xa'),auth[_0x15c0('0x7')](),controller[_0x15c0('0xb')]);router[_0x15c0('0x6')](_0x15c0('0xc'),auth[_0x15c0('0x7')](),controller[_0x15c0('0xd')]);router[_0x15c0('0x6')](_0x15c0('0xe'),auth['isAuthenticated'](),controller[_0x15c0('0xf')]);router[_0x15c0('0x6')](_0x15c0('0x10'),auth[_0x15c0('0x7')](),controller['getAgents']);router['post']('/',auth[_0x15c0('0x7')](),controller[_0x15c0('0x11')]);router[_0x15c0('0x12')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x15c0('0x12')](_0x15c0('0x10'),auth[_0x15c0('0x7')](),controller['addAgents']);router[_0x15c0('0x13')](_0x15c0('0xa'),auth['isAuthenticated'](),controller[_0x15c0('0x14')]);router[_0x15c0('0x15')](_0x15c0('0xa'),auth[_0x15c0('0x7')](),controller[_0x15c0('0x16')]);router['delete'](_0x15c0('0xe'),auth[_0x15c0('0x7')](),controller[_0x15c0('0x17')]);router[_0x15c0('0x15')](_0x15c0('0x10'),auth[_0x15c0('0x7')](),controller['removeAgents']);module[_0x15c0('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index ad642e7..92a3151 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 _0x5712=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x43c8b8,_0x5e8934){var _0x413be3=function(_0x23969c){while(--_0x23969c){_0x43c8b8['push'](_0x43c8b8['shift']());}};_0x413be3(++_0x5e8934);}(_0x5712,0x140));var _0x2571=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5712[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x2571('0x0'));module[_0x2571('0x1')]={'name':{'type':Sequelize[_0x2571('0x2')],'unique':_0x2571('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x2571('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2571('0x5')](_0x2571('0x6'),_0x2571('0x7'),_0x2571('0x8'))},'description':{'type':Sequelize[_0x2571('0x2')]}}; \ No newline at end of file +var _0x03ce=['name','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0xc596ce,_0x17ce8d){var _0x198461=function(_0x4f1d51){while(--_0x4f1d51){_0xc596ce['push'](_0xc596ce['shift']());}};_0x198461(++_0x17ce8d);}(_0x03ce,0x1a1));var _0xe03c=function(_0x5c02a8,_0x323419){_0x5c02a8=_0x5c02a8-0x0;var _0x157ea7=_0x03ce[_0x5c02a8];return _0x157ea7;};'use strict';var Sequelize=require(_0xe03c('0x0'));module[_0xe03c('0x1')]={'name':{'type':Sequelize[_0xe03c('0x2')],'unique':_0xe03c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe03c('0x4')](_0xe03c('0x5'),_0xe03c('0x6'),'roundrobin')},'description':{'type':Sequelize[_0xe03c('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index e43b20d..67d5c4e 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 _0x61da=['../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','WhatsappQueues','UserProfileResource','destroy','then','error','stack','name','send','index','map','WhatsappQueue','fieldName','type','query','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','keys','length','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','WhatsappQueueId','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','%s/%s','getTeams','Team','ids','Agents','online','interface','sequelize','transaction','addTeams','each','UserWhatsappQueue','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x4dff23,_0x2d998e){var _0x23bde3=function(_0x422f61){while(--_0x422f61){_0x4dff23['push'](_0x4dff23['shift']());}};_0x23bde3(++_0x2d998e);}(_0x61da,0x10e));var _0xa61d=function(_0x429a2d,_0x592783){_0x429a2d=_0x429a2d-0x0;var _0xba6da1=_0x61da[_0x429a2d];return _0xba6da1;};'use strict';var emlformat=require(_0xa61d('0x0'));var rimraf=require(_0xa61d('0x1'));var zipdir=require(_0xa61d('0x2'));var jsonpatch=require(_0xa61d('0x3'));var rp=require(_0xa61d('0x4'));var moment=require(_0xa61d('0x5'));var BPromise=require(_0xa61d('0x6'));var Mustache=require(_0xa61d('0x7'));var util=require(_0xa61d('0x8'));var path=require(_0xa61d('0x9'));var sox=require(_0xa61d('0xa'));var csv=require(_0xa61d('0xb'));var ejs=require(_0xa61d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa61d('0xd'));var crypto=require(_0xa61d('0xe'));var jsforce=require(_0xa61d('0xf'));var deskjs=require(_0xa61d('0x10'));var toCsv=require(_0xa61d('0xb'));var querystring=require(_0xa61d('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa61d('0x12'));var qs=require(_0xa61d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa61d('0x14'));var logger=require(_0xa61d('0x15'))(_0xa61d('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa61d('0x17'));var db=require(_0xa61d('0x18'))['db'];config[_0xa61d('0x19')]=_[_0xa61d('0x1a')](config[_0xa61d('0x19')],{'host':_0xa61d('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa61d('0x1c'))[_0xa61d('0x1d')](socket);function respondWithStatusCode(_0xf6dcc,_0x4c36c3){_0x4c36c3=_0x4c36c3||0xcc;return function(_0x4f2f98){if(_0x4f2f98){return _0xf6dcc[_0xa61d('0x1e')](_0x4c36c3);}return _0xf6dcc[_0xa61d('0x1f')](_0x4c36c3)[_0xa61d('0x20')]();};}function respondWithResult(_0x2a6204,_0x551191){_0x551191=_0x551191||0xc8;return function(_0x23791f){if(_0x23791f){return _0x2a6204[_0xa61d('0x1f')](_0x551191)[_0xa61d('0x21')](_0x23791f);}};}function respondWithFilteredResult(_0x36fbf0,_0x4d37ee){return function(_0x15ae8b){if(_0x15ae8b){var _0x3c7a00=typeof _0x4d37ee[_0xa61d('0x22')]===_0xa61d('0x23')&&typeof _0x4d37ee['limit']==='undefined';var _0xea99ae=_0x15ae8b[_0xa61d('0x24')];var _0x5f276d=_0x3c7a00?0x0:_0x4d37ee[_0xa61d('0x22')];var _0x4bb3a8=_0x3c7a00?_0x15ae8b[_0xa61d('0x24')]:_0x4d37ee[_0xa61d('0x22')]+_0x4d37ee[_0xa61d('0x25')];var _0x7c253a;if(_0x4bb3a8>=_0xea99ae){_0x4bb3a8=_0xea99ae;_0x7c253a=0xc8;}else{_0x7c253a=0xce;}_0x36fbf0[_0xa61d('0x1f')](_0x7c253a);return _0x36fbf0[_0xa61d('0x26')](_0xa61d('0x27'),_0x5f276d+'-'+_0x4bb3a8+'/'+_0xea99ae)[_0xa61d('0x21')](_0x15ae8b);}return null;};}function patchUpdates(_0xb111b3){return function(_0x880632){try{jsonpatch[_0xa61d('0x28')](_0x880632,_0xb111b3,!![]);}catch(_0x39f996){return BPromise[_0xa61d('0x29')](_0x39f996);}return _0x880632[_0xa61d('0x2a')]();};}function saveUpdates(_0x30ffbf,_0x497143){return function(_0x1b2aad){if(_0x1b2aad){return _0x1b2aad[_0xa61d('0x2b')](_0x30ffbf)['then'](function(_0x432be4){return _0x432be4;});}return null;};}function removeEntity(_0x40a621,_0x5e9dba){return function(_0x3f6603){if(_0x3f6603){return _0x3f6603['destroy']()['then'](function(){var _0x471c6f=_0x3f6603['get']({'plain':!![]});var _0x27b0d9=_0xa61d('0x2c');return db[_0xa61d('0x2d')][_0xa61d('0x2e')]({'where':{'type':_0x27b0d9,'resourceId':_0x471c6f['id']}})[_0xa61d('0x2f')](function(){return _0x3f6603;});})[_0xa61d('0x2f')](function(){_0x40a621[_0xa61d('0x1f')](0xcc)[_0xa61d('0x20')]();});}};}function handleEntityNotFound(_0x2b9925,_0x197b56){return function(_0x8b327b){if(!_0x8b327b){_0x2b9925[_0xa61d('0x1e')](0x194);}return _0x8b327b;};}function handleError(_0x5a03e4,_0x367a51){_0x367a51=_0x367a51||0x1f4;return function(_0x30fbbe){logger[_0xa61d('0x30')](_0x30fbbe[_0xa61d('0x31')]);if(_0x30fbbe[_0xa61d('0x32')]){delete _0x30fbbe[_0xa61d('0x32')];}_0x5a03e4[_0xa61d('0x1f')](_0x367a51)[_0xa61d('0x33')](_0x30fbbe);};}exports[_0xa61d('0x34')]=function(_0x1bdfc0,_0x4016e1){var _0x2a369b={},_0x208a99={},_0x39fe2c={'count':0x0,'rows':[]};var _0x175a88=_[_0xa61d('0x35')](db[_0xa61d('0x36')]['rawAttributes'],function(_0x5c08ef){return{'name':_0x5c08ef[_0xa61d('0x37')],'type':_0x5c08ef[_0xa61d('0x38')]['key']};});_0x208a99['model']=_[_0xa61d('0x35')](_0x175a88,'name');_0x208a99[_0xa61d('0x39')]=_['keys'](_0x1bdfc0['query']);_0x208a99[_0xa61d('0x3a')]=_[_0xa61d('0x3b')](_0x208a99['model'],_0x208a99[_0xa61d('0x39')]);_0x2a369b['attributes']=_[_0xa61d('0x3b')](_0x208a99[_0xa61d('0x3c')],qs[_0xa61d('0x3d')](_0x1bdfc0['query'][_0xa61d('0x3d')]));_0x2a369b[_0xa61d('0x3e')]=_0x2a369b[_0xa61d('0x3e')]['length']?_0x2a369b[_0xa61d('0x3e')]:_0x208a99[_0xa61d('0x3c')];if(!_0x1bdfc0['query']['hasOwnProperty'](_0xa61d('0x3f'))){_0x2a369b[_0xa61d('0x25')]=qs[_0xa61d('0x25')](_0x1bdfc0[_0xa61d('0x39')]['limit']);_0x2a369b[_0xa61d('0x22')]=qs[_0xa61d('0x22')](_0x1bdfc0[_0xa61d('0x39')][_0xa61d('0x22')]);}_0x2a369b[_0xa61d('0x40')]=qs[_0xa61d('0x41')](_0x1bdfc0[_0xa61d('0x39')][_0xa61d('0x41')]);_0x2a369b[_0xa61d('0x42')]=qs[_0xa61d('0x3a')](_[_0xa61d('0x43')](_0x1bdfc0[_0xa61d('0x39')],_0x208a99['filters']),_0x175a88);if(_0x1bdfc0[_0xa61d('0x39')][_0xa61d('0x44')]){_0x2a369b['where']=_[_0xa61d('0x45')](_0x2a369b['where'],{'$or':_[_0xa61d('0x35')](_0x175a88,function(_0x9a1632){if(_0x9a1632[_0xa61d('0x38')]!==_0xa61d('0x46')){var _0x550cf5={};_0x550cf5[_0x9a1632[_0xa61d('0x32')]]={'$like':'%'+_0x1bdfc0[_0xa61d('0x39')]['filter']+'%'};return _0x550cf5;}})});}_0x2a369b=_[_0xa61d('0x45')]({},_0x2a369b,_0x1bdfc0[_0xa61d('0x47')]);var _0x5e431b={'where':_0x2a369b[_0xa61d('0x42')]};return db[_0xa61d('0x36')][_0xa61d('0x24')](_0x5e431b)[_0xa61d('0x2f')](function(_0x43749e){_0x39fe2c['count']=_0x43749e;if(_0x1bdfc0['query'][_0xa61d('0x48')]){_0x2a369b['include']=[{'all':!![]}];}return db[_0xa61d('0x36')][_0xa61d('0x49')](_0x2a369b);})[_0xa61d('0x2f')](function(_0x598d2e){_0x39fe2c[_0xa61d('0x4a')]=_0x598d2e;return _0x39fe2c;})['then'](respondWithFilteredResult(_0x4016e1,_0x2a369b))[_0xa61d('0x4b')](handleError(_0x4016e1,null));};exports[_0xa61d('0x4c')]=function(_0x56bac8,_0x4aac1c){var _0x2c685a={'raw':!![],'where':{'id':_0x56bac8[_0xa61d('0x4d')]['id']}},_0x2f901d={};_0x2f901d[_0xa61d('0x3c')]=_['keys'](db[_0xa61d('0x36')][_0xa61d('0x4e')]);_0x2f901d['query']=_[_0xa61d('0x4f')](_0x56bac8[_0xa61d('0x39')]);_0x2f901d[_0xa61d('0x3a')]=_[_0xa61d('0x3b')](_0x2f901d[_0xa61d('0x3c')],_0x2f901d[_0xa61d('0x39')]);_0x2c685a[_0xa61d('0x3e')]=_[_0xa61d('0x3b')](_0x2f901d[_0xa61d('0x3c')],qs[_0xa61d('0x3d')](_0x56bac8[_0xa61d('0x39')][_0xa61d('0x3d')]));_0x2c685a[_0xa61d('0x3e')]=_0x2c685a[_0xa61d('0x3e')][_0xa61d('0x50')]?_0x2c685a[_0xa61d('0x3e')]:_0x2f901d['model'];if(_0x56bac8[_0xa61d('0x39')][_0xa61d('0x48')]){_0x2c685a[_0xa61d('0x51')]=[{'all':!![]}];}_0x2c685a=_['merge']({},_0x2c685a,_0x56bac8[_0xa61d('0x47')]);return db[_0xa61d('0x36')]['find'](_0x2c685a)[_0xa61d('0x2f')](handleEntityNotFound(_0x4aac1c,null))['then'](respondWithResult(_0x4aac1c,null))[_0xa61d('0x4b')](handleError(_0x4aac1c,null));};exports['create']=function(_0x472247,_0x471067){return db[_0xa61d('0x36')][_0xa61d('0x52')](_0x472247[_0xa61d('0x53')],{})[_0xa61d('0x2f')](function(_0x397f7a){var _0xe3844d=_0x472247[_0xa61d('0x54')][_0xa61d('0x55')]({'plain':!![]});if(!_0xe3844d)throw new Error(_0xa61d('0x56'));if(_0xe3844d['role']==='user'){var _0x3de115=_0x397f7a[_0xa61d('0x55')]({'plain':!![]});var _0x2db985=_0xa61d('0x2c');return db[_0xa61d('0x57')][_0xa61d('0x58')]({'where':{'name':_0x2db985,'userProfileId':_0xe3844d[_0xa61d('0x59')]},'raw':!![]})[_0xa61d('0x2f')](function(_0x5d2cef){if(_0x5d2cef&&_0x5d2cef[_0xa61d('0x5a')]===0x0){return db[_0xa61d('0x2d')]['create']({'name':_0x3de115[_0xa61d('0x32')],'resourceId':_0x3de115['id'],'type':_0x5d2cef['name'],'sectionId':_0x5d2cef['id']},{})[_0xa61d('0x2f')](function(){return _0x397f7a;});}else{return _0x397f7a;}})[_0xa61d('0x4b')](function(_0x22065e){logger['error'](_0xa61d('0x5b'),_0x22065e);throw _0x22065e;});}return _0x397f7a;})[_0xa61d('0x2f')](respondWithResult(_0x471067,0xc9))[_0xa61d('0x4b')](handleError(_0x471067,null));};exports[_0xa61d('0x2b')]=function(_0x2b6bb6,_0x1b095e){if(_0x2b6bb6[_0xa61d('0x53')]['id']){delete _0x2b6bb6[_0xa61d('0x53')]['id'];}return db['WhatsappQueue'][_0xa61d('0x58')]({'where':{'id':_0x2b6bb6['params']['id']}})[_0xa61d('0x2f')](handleEntityNotFound(_0x1b095e,null))[_0xa61d('0x2f')](saveUpdates(_0x2b6bb6['body'],null))[_0xa61d('0x2f')](respondWithResult(_0x1b095e,null))[_0xa61d('0x4b')](handleError(_0x1b095e,null));};exports['destroy']=function(_0x41704c,_0x34e863){return db['WhatsappQueue']['find']({'where':{'id':_0x41704c[_0xa61d('0x4d')]['id']}})[_0xa61d('0x2f')](handleEntityNotFound(_0x34e863,null))['then'](removeEntity(_0x34e863,null))['catch'](handleError(_0x34e863,null));};exports[_0xa61d('0x5c')]=function(_0x373137,_0x534283){return db[_0xa61d('0x36')][_0xa61d('0x5c')]()[_0xa61d('0x2f')](respondWithResult(_0x534283,null))['catch'](handleError(_0x534283,null));};exports[_0xa61d('0x5d')]=function(_0x1970f4,_0x52690a,_0x4b8daa){var _0x4eac67={'raw':!![],'where':{}},_0x3fd9da={},_0x2cd402;return db[_0xa61d('0x36')][_0xa61d('0x5e')]({'where':{'id':_0x1970f4[_0xa61d('0x4d')]['id']}})[_0xa61d('0x2f')](handleEntityNotFound(_0x52690a,null))['then'](function(_0x40c062){if(_0x40c062){_0x2cd402=_0x40c062[_0xa61d('0x55')]({'plain':!![]});_0x3fd9da[_0xa61d('0x3c')]=_['keys'](db['UserWhatsappQueue'][_0xa61d('0x4e')]);_0x3fd9da[_0xa61d('0x39')]=_[_0xa61d('0x4f')](_0x1970f4[_0xa61d('0x39')]);_0x3fd9da['filters']=_['intersection'](_0x3fd9da[_0xa61d('0x3c')],_0x3fd9da[_0xa61d('0x39')]);_0x4eac67[_0xa61d('0x3e')]=_[_0xa61d('0x3b')](_0x3fd9da[_0xa61d('0x3c')],qs[_0xa61d('0x3d')](_0x1970f4[_0xa61d('0x39')][_0xa61d('0x3d')]));_0x4eac67[_0xa61d('0x3e')]=_0x4eac67['attributes'][_0xa61d('0x50')]?_0x4eac67[_0xa61d('0x3e')]:_0x3fd9da[_0xa61d('0x3c')];if(!_0x1970f4['query'][_0xa61d('0x5f')]('nolimit')){_0x4eac67[_0xa61d('0x25')]=qs[_0xa61d('0x25')](_0x1970f4['query'][_0xa61d('0x25')]);_0x4eac67[_0xa61d('0x22')]=qs[_0xa61d('0x22')](_0x1970f4[_0xa61d('0x39')][_0xa61d('0x22')]);}_0x4eac67['order']=qs[_0xa61d('0x41')](_0x1970f4[_0xa61d('0x39')][_0xa61d('0x41')]);_0x4eac67['where']=qs['filters'](_[_0xa61d('0x43')](_0x1970f4[_0xa61d('0x39')],_0x3fd9da['filters']));_0x4eac67[_0xa61d('0x42')][_0xa61d('0x60')]=_0x40c062['id'];if(_0x1970f4[_0xa61d('0x39')]['filter']){_0x4eac67[_0xa61d('0x42')]=_[_0xa61d('0x45')](_0x4eac67[_0xa61d('0x42')],{'$or':_[_0xa61d('0x35')](_0x4eac67[_0xa61d('0x3e')],function(_0x3db527){var _0x11b039={};_0x11b039[_0x3db527]={'$like':'%'+_0x1970f4[_0xa61d('0x39')][_0xa61d('0x44')]+'%'};return _0x11b039;})});}_0x4eac67=_[_0xa61d('0x45')]({},_0x4eac67,_0x1970f4[_0xa61d('0x47')]);return db['UserWhatsappQueue'][_0xa61d('0x49')](_0x4eac67);}})['then'](function(_0x138c52){if(_0x138c52){return db[_0xa61d('0x61')][_0xa61d('0x62')]({'where':{'id':_[_0xa61d('0x35')](_0x138c52,'UserId'),'role':_0xa61d('0x63')},'attributes':['id','name',_0xa61d('0x64'),_0xa61d('0x65'),_0xa61d('0x66')]});}})['then'](function(_0x3713b0){if(_0x3713b0){return{'count':_0x3713b0[_0xa61d('0x24')],'rows':_[_0xa61d('0x35')](_0x3713b0[_0xa61d('0x4a')],function(_0x3e3464){return{'membername':_0x3e3464[_0xa61d('0x32')],'UserId':_0x3e3464['id'],'queue_name':_0x2cd402['name'],'WhatsappQueueId':_0x2cd402['id'],'interface':util['format'](_0xa61d('0x67'),'SIP',_0x3e3464[_0xa61d('0x32')]),'penalty':0x0,'paused':_0x3e3464[_0xa61d('0x64')],'createdAt':_0x3e3464[_0xa61d('0x66')],'updatedAt':_0x3e3464[_0xa61d('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa61d('0x2f')](respondWithFilteredResult(_0x52690a,_0x4eac67))[_0xa61d('0x4b')](handleError(_0x52690a,null));};exports[_0xa61d('0x68')]=function(_0xa38625,_0x671616,_0x1b55ff){var _0xf22f25={};var _0x282847={};var _0x4e1750;var _0x50f980;return db[_0xa61d('0x36')]['findOne']({'where':{'id':_0xa38625[_0xa61d('0x4d')]['id']}})[_0xa61d('0x2f')](handleEntityNotFound(_0x671616,null))[_0xa61d('0x2f')](function(_0x35ee84){if(_0x35ee84){_0x4e1750=_0x35ee84;_0x282847[_0xa61d('0x3c')]=_[_0xa61d('0x4f')](db[_0xa61d('0x69')][_0xa61d('0x4e')]);_0x282847['query']=_[_0xa61d('0x4f')](_0xa38625[_0xa61d('0x39')]);_0x282847[_0xa61d('0x3a')]=_[_0xa61d('0x3b')](_0x282847['model'],_0x282847['query']);_0xf22f25[_0xa61d('0x3e')]=_['intersection'](_0x282847[_0xa61d('0x3c')],qs[_0xa61d('0x3d')](_0xa38625[_0xa61d('0x39')]['fields']));_0xf22f25[_0xa61d('0x3e')]=_0xf22f25['attributes'][_0xa61d('0x50')]?_0xf22f25[_0xa61d('0x3e')]:_0x282847['model'];_0xf22f25[_0xa61d('0x40')]=qs[_0xa61d('0x41')](_0xa38625[_0xa61d('0x39')]['sort']);_0xf22f25[_0xa61d('0x42')]=qs[_0xa61d('0x3a')](_[_0xa61d('0x43')](_0xa38625[_0xa61d('0x39')],_0x282847[_0xa61d('0x3a')]));if(_0xa38625['query'][_0xa61d('0x44')]){_0xf22f25[_0xa61d('0x42')]=_[_0xa61d('0x45')](_0xf22f25[_0xa61d('0x42')],{'$or':_[_0xa61d('0x35')](_0xf22f25[_0xa61d('0x3e')],function(_0x45184c){var _0xbb1cf2={};_0xbb1cf2[_0x45184c]={'$like':'%'+_0xa38625[_0xa61d('0x39')][_0xa61d('0x44')]+'%'};return _0xbb1cf2;})});}_0xf22f25=_[_0xa61d('0x45')]({},_0xf22f25,_0xa38625[_0xa61d('0x47')]);return _0x4e1750[_0xa61d('0x68')](_0xf22f25);}})[_0xa61d('0x2f')](function(_0x2e1fbe){if(_0x2e1fbe){_0x50f980=_0x2e1fbe['length'];if(!_0xa38625[_0xa61d('0x39')][_0xa61d('0x5f')]('nolimit')){_0xf22f25[_0xa61d('0x25')]=qs[_0xa61d('0x25')](_0xa38625[_0xa61d('0x39')][_0xa61d('0x25')]);_0xf22f25[_0xa61d('0x22')]=qs[_0xa61d('0x22')](_0xa38625[_0xa61d('0x39')]['offset']);}return _0x4e1750[_0xa61d('0x68')](_0xf22f25);}})['then'](function(_0x3ba62d){if(_0x3ba62d){return _0x3ba62d?{'count':_0x50f980,'rows':_0x3ba62d}:null;}})[_0xa61d('0x2f')](respondWithResult(_0x671616,null))[_0xa61d('0x4b')](handleError(_0x671616,null));};exports['addTeams']=function(_0x419522,_0x55392c,_0x2ecb96){var _0xdcbcfd=_0x419522[_0xa61d('0x53')][_0xa61d('0x6a')];return db['Team'][_0xa61d('0x49')]({'where':{'id':_0xdcbcfd},'attributes':['id'],'include':[{'model':db[_0xa61d('0x61')],'as':_0xa61d('0x6b'),'attributes':['id','name',_0xa61d('0x6c'),'voicePause',_0xa61d('0x6d')],'raw':!![]}]})[_0xa61d('0x2f')](function(_0x20dcef){if(_0x20dcef){var _0x3797f1=_['flatMap'](_0x20dcef,function(_0x423cf6){var _0x34067a=_0x423cf6[_0xa61d('0x55')]({'plain':!![]});return _0x34067a[_0xa61d('0x6b')];});return db[_0xa61d('0x36')]['find']({'where':{'id':_0x419522[_0xa61d('0x4d')]['id']}})[_0xa61d('0x2f')](function(_0x1729c5){return db[_0xa61d('0x6e')][_0xa61d('0x6f')](function(_0x161efc){return _0x1729c5[_0xa61d('0x70')](_0xdcbcfd,{'transaction':_0x161efc})[_0xa61d('0x2f')](function(){return BPromise[_0xa61d('0x71')](_0x3797f1,function(_0x44dec4){return db[_0xa61d('0x72')][_0xa61d('0x73')]({'where':{'UserId':_0x44dec4['id'],'WhatsappQueueId':_0x419522['params']['id']},'transaction':_0x161efc});});})['then'](function(){_0x3797f1['forEach'](function(_0x52ab3d){socket[_0xa61d('0x74')](_0xa61d('0x75'),{'UserId':_0x52ab3d['id'],'WhatsappQueueId':_0x1729c5['id']});});});});});}})[_0xa61d('0x2f')](respondWithStatusCode(_0x55392c,null))[_0xa61d('0x4b')](handleError(_0x55392c,null));};exports[_0xa61d('0x76')]=function(_0x46625d,_0x40b6c5,_0x3ec4b7){return db[_0xa61d('0x69')][_0xa61d('0x49')]({'where':{'id':_0x46625d[_0xa61d('0x39')][_0xa61d('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xa61d('0x61')],'as':_0xa61d('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xa61d('0x2f')](handleEntityNotFound(_0x40b6c5,null))[_0xa61d('0x2f')](function(_0x195e0f){var _0x3a8638=_[_0xa61d('0x35')](_0x195e0f,'id');var _0x202bd6=[];var _0x234dea=[];var _0x100119=squel[_0xa61d('0x77')]();_0x100119[_0xa61d('0x78')](_0xa61d('0x79'))[_0xa61d('0x7a')]('team_has_whatsapp_queues','tq')[_0xa61d('0x7b')](_0xa61d('0x7c'),'ut',_0xa61d('0x7d'))[_0xa61d('0x42')](_0xa61d('0x7e'),_0x46625d[_0xa61d('0x4d')]['id']);for(var _0x5ca8f9=0x0;_0x5ca8f9<_0x195e0f[_0xa61d('0x50')];_0x5ca8f9+=0x1){let _0x341e3b=_0x195e0f[_0x5ca8f9];for(var _0x2d0857=0x0;_0x2d0857<_0x341e3b[_0xa61d('0x6b')]['length'];_0x2d0857+=0x1){let _0x5330f0=_0x341e3b[_0xa61d('0x6b')][_0x2d0857];var _0x239cb9=_0x100119['clone']();_0x239cb9[_0xa61d('0x42')](_0xa61d('0x7f'),_0x5330f0['id']);_0x234dea['push'](db[_0xa61d('0x6e')]['query'](_0x239cb9[_0xa61d('0x80')](),{'type':db[_0xa61d('0x6e')]['QueryTypes'][_0xa61d('0x81')]})['then'](function(_0x476358){if(_0x476358['length']===0x1){return _0x5330f0['id'];}else{var _0x16f7ee=_[_0xa61d('0x82')](_[_0xa61d('0x35')](_0x476358,_0xa61d('0x83')),function(_0xcf7040){return _[_0xa61d('0x84')](_0x3a8638,_0xcf7040);});if(_0x16f7ee){return _0x5330f0['id'];}}}));}}return BPromise[_0xa61d('0x85')](_0x234dea)['then'](function(_0x559e15){_0x202bd6=_(_0x202bd6)[_0xa61d('0x86')](_0x559e15)[_0xa61d('0x87')]()[_0xa61d('0x88')]();return db[_0xa61d('0x36')]['find']({'where':{'id':_0x46625d['params']['id']}})[_0xa61d('0x2f')](function(_0x7be564){return db['sequelize'][_0xa61d('0x6f')](function(_0x254561){return _0x7be564[_0xa61d('0x76')](_0x46625d['query'][_0xa61d('0x6a')],{'transaction':_0x254561})[_0xa61d('0x2f')](function(){if(!_[_0xa61d('0x89')](_0x202bd6)){return _0x7be564[_0xa61d('0x8a')](_0x202bd6,{'transaction':_0x254561});}})[_0xa61d('0x2f')](function(){_0x202bd6[_0xa61d('0x8b')](function(_0x3d89f5){socket['emit'](_0xa61d('0x8c'),{'UserId':_0x3d89f5,'WhatsappQueueId':_0x7be564['id']});});});});});});})[_0xa61d('0x2f')](respondWithStatusCode(_0x40b6c5,null))[_0xa61d('0x4b')](handleError(_0x40b6c5,null));};exports[_0xa61d('0x8d')]=function(_0x3b4059,_0x3361b9,_0x4610e1){return db[_0xa61d('0x36')]['find']({'where':{'id':_0x3b4059[_0xa61d('0x4d')]['id']}})[_0xa61d('0x2f')](handleEntityNotFound(_0x3361b9,null))['then'](function(_0x17334d){if(_0x17334d){return _0x17334d[_0xa61d('0x8d')](_0x3b4059[_0xa61d('0x53')]['ids'],_[_0xa61d('0x8e')](_0x3b4059[_0xa61d('0x53')],[_0xa61d('0x6a'),'id'])||{})[_0xa61d('0x8f')](function(_0x1c3ecc){for(var _0x4529e3=0x0;_0x4529e3<_0x3b4059[_0xa61d('0x53')]['ids']['length'];_0x4529e3+=0x1){socket[_0xa61d('0x74')](_0xa61d('0x75'),{'UserId':Number(_0x3b4059[_0xa61d('0x53')][_0xa61d('0x6a')][_0x4529e3]),'WhatsappQueueId':Number(_0x3b4059['params']['id'])});}return _0x1c3ecc;});}})['then'](respondWithResult(_0x3361b9,null))[_0xa61d('0x4b')](handleError(_0x3361b9,null));};exports[_0xa61d('0x8a')]=function(_0x2d35a0,_0x2ce603,_0x58f6e9){return db[_0xa61d('0x36')][_0xa61d('0x58')]({'where':{'id':_0x2d35a0[_0xa61d('0x4d')]['id']}})[_0xa61d('0x2f')](handleEntityNotFound(_0x2ce603,null))[_0xa61d('0x2f')](function(_0x4a848c){if(_0x4a848c){return _0x4a848c[_0xa61d('0x8a')](_0x2d35a0[_0xa61d('0x39')][_0xa61d('0x6a')])[_0xa61d('0x2f')](function(){if(_['isArray'](_0x2d35a0[_0xa61d('0x39')][_0xa61d('0x6a')])){for(var _0x15378a=0x0;_0x15378a<_0x2d35a0[_0xa61d('0x39')][_0xa61d('0x6a')]['length'];_0x15378a+=0x1){socket[_0xa61d('0x74')]('userWhatsappQueue:remove',{'UserId':Number(_0x2d35a0['query']['ids'][_0x15378a]),'WhatsappQueueId':Number(_0x2d35a0['params']['id'])});}}else{socket['emit'](_0xa61d('0x8c'),{'UserId':Number(_0x2d35a0['query'][_0xa61d('0x6a')]),'WhatsappQueueId':Number(_0x2d35a0['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2ce603,null))['catch'](handleError(_0x2ce603,null));};exports[_0xa61d('0x90')]=function(_0x1a740a,_0x1e20ec,_0x25c178){var _0x175e3a={};var _0x418be1={};var _0x491199;var _0x5d2b5c;return db[_0xa61d('0x36')][_0xa61d('0x5e')]({'where':{'id':_0x1a740a['params']['id']}})[_0xa61d('0x2f')](handleEntityNotFound(_0x1e20ec,null))[_0xa61d('0x2f')](function(_0x1abbb8){if(_0x1abbb8){_0x491199=_0x1abbb8;_0x418be1['model']=_[_0xa61d('0x4f')](db[_0xa61d('0x61')][_0xa61d('0x4e')]);_0x418be1[_0xa61d('0x39')]=_['keys'](_0x1a740a['query']);_0x418be1['filters']=_[_0xa61d('0x3b')](_0x418be1[_0xa61d('0x3c')],_0x418be1[_0xa61d('0x39')]);_0x175e3a[_0xa61d('0x3e')]=_[_0xa61d('0x3b')](_0x418be1[_0xa61d('0x3c')],qs[_0xa61d('0x3d')](_0x1a740a[_0xa61d('0x39')]['fields']));_0x175e3a[_0xa61d('0x3e')]=_0x175e3a[_0xa61d('0x3e')]['length']?_0x175e3a[_0xa61d('0x3e')]:_0x418be1[_0xa61d('0x3c')];_0x175e3a['order']=qs[_0xa61d('0x41')](_0x1a740a[_0xa61d('0x39')][_0xa61d('0x41')]);_0x175e3a[_0xa61d('0x42')]=qs[_0xa61d('0x3a')](_['pick'](_0x1a740a[_0xa61d('0x39')],_0x418be1['filters']));if(_0x1a740a['query']['filter']){_0x175e3a[_0xa61d('0x42')]=_[_0xa61d('0x45')](_0x175e3a['where'],{'$or':_[_0xa61d('0x35')](_0x175e3a[_0xa61d('0x3e')],function(_0x852656){var _0x259835={};_0x259835[_0x852656]={'$like':'%'+_0x1a740a[_0xa61d('0x39')][_0xa61d('0x44')]+'%'};return _0x259835;})});}_0x175e3a=_[_0xa61d('0x45')]({},_0x175e3a,_0x1a740a[_0xa61d('0x47')]);return _0x491199[_0xa61d('0x90')](_0x175e3a);}})[_0xa61d('0x2f')](function(_0x1b44fa){if(_0x1b44fa){_0x5d2b5c=_0x1b44fa[_0xa61d('0x50')];if(!_0x1a740a['query']['hasOwnProperty']('nolimit')){_0x175e3a[_0xa61d('0x25')]=qs[_0xa61d('0x25')](_0x1a740a[_0xa61d('0x39')][_0xa61d('0x25')]);_0x175e3a[_0xa61d('0x22')]=qs[_0xa61d('0x22')](_0x1a740a[_0xa61d('0x39')][_0xa61d('0x22')]);}return _0x491199[_0xa61d('0x90')](_0x175e3a);}})[_0xa61d('0x2f')](function(_0x50a2f3){if(_0x50a2f3){return _0x50a2f3?{'count':_0x5d2b5c,'rows':_0x50a2f3}:null;}})[_0xa61d('0x2f')](respondWithResult(_0x1e20ec,null))[_0xa61d('0x4b')](handleError(_0x1e20ec,null));}; \ No newline at end of file +var _0xa7a1=['isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','./whatsappQueue.socket','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','WhatsappQueues','then','error','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','model','keys','filters','query','attributes','intersection','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','WhatsappQueueId','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','whatsappPause','getTeams','Team','online','voicePause','Agents','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','ids','field','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','compact','value'];(function(_0x3c2c62,_0x2033c2){var _0x58bcb8=function(_0x25c172){while(--_0x25c172){_0x3c2c62['push'](_0x3c2c62['shift']());}};_0x58bcb8(++_0x2033c2);}(_0xa7a1,0x1a8));var _0x1a7a=function(_0x14ec75,_0x56a3d4){_0x14ec75=_0x14ec75-0x0;var _0x40b9e9=_0xa7a1[_0x14ec75];return _0x40b9e9;};'use strict';var emlformat=require(_0x1a7a('0x0'));var rimraf=require(_0x1a7a('0x1'));var zipdir=require(_0x1a7a('0x2'));var jsonpatch=require(_0x1a7a('0x3'));var rp=require(_0x1a7a('0x4'));var moment=require(_0x1a7a('0x5'));var BPromise=require(_0x1a7a('0x6'));var Mustache=require(_0x1a7a('0x7'));var util=require('util');var path=require(_0x1a7a('0x8'));var sox=require('sox');var csv=require(_0x1a7a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a7a('0xa'));var _=require(_0x1a7a('0xb'));var squel=require(_0x1a7a('0xc'));var crypto=require(_0x1a7a('0xd'));var jsforce=require(_0x1a7a('0xe'));var deskjs=require(_0x1a7a('0xf'));var toCsv=require(_0x1a7a('0x9'));var querystring=require(_0x1a7a('0x10'));var Papa=require('papaparse');var Redis=require(_0x1a7a('0x11'));var authService=require(_0x1a7a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1a7a('0x13'));var hardwareService=require(_0x1a7a('0x14'));var logger=require('../../config/logger')(_0x1a7a('0x15'));var utils=require(_0x1a7a('0x16'));var config=require(_0x1a7a('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1a7a('0x18')]=_[_0x1a7a('0x19')](config[_0x1a7a('0x18')],{'host':_0x1a7a('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a7a('0x18')]));require(_0x1a7a('0x1b'))['register'](socket);function respondWithStatusCode(_0x59a2a2,_0x593459){_0x593459=_0x593459||0xcc;return function(_0x567405){if(_0x567405){return _0x59a2a2[_0x1a7a('0x1c')](_0x593459);}return _0x59a2a2['status'](_0x593459)[_0x1a7a('0x1d')]();};}function respondWithResult(_0xf50439,_0xfa5162){_0xfa5162=_0xfa5162||0xc8;return function(_0x3181e5){if(_0x3181e5){return _0xf50439[_0x1a7a('0x1e')](_0xfa5162)['json'](_0x3181e5);}};}function respondWithFilteredResult(_0x4334b3,_0x216142){return function(_0x27aacb){if(_0x27aacb){var _0x59d5ba=typeof _0x216142[_0x1a7a('0x1f')]===_0x1a7a('0x20')&&typeof _0x216142['limit']===_0x1a7a('0x20');var _0x5e57d2=_0x27aacb[_0x1a7a('0x21')];var _0x40d1c4=_0x59d5ba?0x0:_0x216142[_0x1a7a('0x1f')];var _0x2f76dc=_0x59d5ba?_0x27aacb[_0x1a7a('0x21')]:_0x216142[_0x1a7a('0x1f')]+_0x216142['limit'];var _0x45b73f;if(_0x2f76dc>=_0x5e57d2){_0x2f76dc=_0x5e57d2;_0x45b73f=0xc8;}else{_0x45b73f=0xce;}_0x4334b3[_0x1a7a('0x1e')](_0x45b73f);return _0x4334b3[_0x1a7a('0x22')](_0x1a7a('0x23'),_0x40d1c4+'-'+_0x2f76dc+'/'+_0x5e57d2)[_0x1a7a('0x24')](_0x27aacb);}return null;};}function patchUpdates(_0x2241d6){return function(_0x5856b6){try{jsonpatch[_0x1a7a('0x25')](_0x5856b6,_0x2241d6,!![]);}catch(_0x106c96){return BPromise[_0x1a7a('0x26')](_0x106c96);}return _0x5856b6[_0x1a7a('0x27')]();};}function saveUpdates(_0x461239,_0x161ade){return function(_0x277970){if(_0x277970){return _0x277970[_0x1a7a('0x28')](_0x461239)['then'](function(_0x317763){return _0x317763;});}return null;};}function removeEntity(_0x397aef,_0x412158){return function(_0x4b5ace){if(_0x4b5ace){return _0x4b5ace[_0x1a7a('0x29')]()['then'](function(){var _0x3d7d23=_0x4b5ace[_0x1a7a('0x2a')]({'plain':!![]});var _0x188b90=_0x1a7a('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x188b90,'resourceId':_0x3d7d23['id']}})['then'](function(){return _0x4b5ace;});})[_0x1a7a('0x2c')](function(){_0x397aef[_0x1a7a('0x1e')](0xcc)[_0x1a7a('0x1d')]();});}};}function handleEntityNotFound(_0x4a939e,_0x2b1726){return function(_0x5ee7c2){if(!_0x5ee7c2){_0x4a939e[_0x1a7a('0x1c')](0x194);}return _0x5ee7c2;};}function handleError(_0x361d54,_0x2a898a){_0x2a898a=_0x2a898a||0x1f4;return function(_0x2b3034){logger[_0x1a7a('0x2d')](_0x2b3034[_0x1a7a('0x2e')]);if(_0x2b3034['name']){delete _0x2b3034[_0x1a7a('0x2f')];}_0x361d54[_0x1a7a('0x1e')](_0x2a898a)['send'](_0x2b3034);};}exports[_0x1a7a('0x30')]=function(_0x25bd43,_0x436633){var _0x342489={},_0x167502={},_0x2d9d13={'count':0x0,'rows':[]};var _0x17820f=_[_0x1a7a('0x31')](db[_0x1a7a('0x32')][_0x1a7a('0x33')],function(_0x2c99ac){return{'name':_0x2c99ac[_0x1a7a('0x34')],'type':_0x2c99ac['type']['key']};});_0x167502[_0x1a7a('0x35')]=_[_0x1a7a('0x31')](_0x17820f,_0x1a7a('0x2f'));_0x167502['query']=_[_0x1a7a('0x36')](_0x25bd43['query']);_0x167502[_0x1a7a('0x37')]=_['intersection'](_0x167502[_0x1a7a('0x35')],_0x167502[_0x1a7a('0x38')]);_0x342489[_0x1a7a('0x39')]=_[_0x1a7a('0x3a')](_0x167502['model'],qs[_0x1a7a('0x3b')](_0x25bd43[_0x1a7a('0x38')][_0x1a7a('0x3b')]));_0x342489['attributes']=_0x342489[_0x1a7a('0x39')][_0x1a7a('0x3c')]?_0x342489[_0x1a7a('0x39')]:_0x167502[_0x1a7a('0x35')];if(!_0x25bd43[_0x1a7a('0x38')]['hasOwnProperty'](_0x1a7a('0x3d'))){_0x342489[_0x1a7a('0x3e')]=qs['limit'](_0x25bd43[_0x1a7a('0x38')]['limit']);_0x342489[_0x1a7a('0x1f')]=qs[_0x1a7a('0x1f')](_0x25bd43['query'][_0x1a7a('0x1f')]);}_0x342489[_0x1a7a('0x3f')]=qs[_0x1a7a('0x40')](_0x25bd43[_0x1a7a('0x38')][_0x1a7a('0x40')]);_0x342489[_0x1a7a('0x41')]=qs[_0x1a7a('0x37')](_[_0x1a7a('0x42')](_0x25bd43[_0x1a7a('0x38')],_0x167502['filters']),_0x17820f);if(_0x25bd43[_0x1a7a('0x38')][_0x1a7a('0x43')]){_0x342489[_0x1a7a('0x41')]=_[_0x1a7a('0x44')](_0x342489['where'],{'$or':_[_0x1a7a('0x31')](_0x17820f,function(_0x4403a1){if(_0x4403a1[_0x1a7a('0x45')]!==_0x1a7a('0x46')){var _0x3d27e8={};_0x3d27e8[_0x4403a1['name']]={'$like':'%'+_0x25bd43['query'][_0x1a7a('0x43')]+'%'};return _0x3d27e8;}})});}_0x342489=_['merge']({},_0x342489,_0x25bd43[_0x1a7a('0x47')]);var _0x51bb6c={'where':_0x342489[_0x1a7a('0x41')]};return db['WhatsappQueue'][_0x1a7a('0x21')](_0x51bb6c)[_0x1a7a('0x2c')](function(_0xa8aa99){_0x2d9d13[_0x1a7a('0x21')]=_0xa8aa99;if(_0x25bd43['query']['includeAll']){_0x342489[_0x1a7a('0x48')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x1a7a('0x49')](_0x342489);})['then'](function(_0x18fc42){_0x2d9d13[_0x1a7a('0x4a')]=_0x18fc42;return _0x2d9d13;})[_0x1a7a('0x2c')](respondWithFilteredResult(_0x436633,_0x342489))[_0x1a7a('0x4b')](handleError(_0x436633,null));};exports[_0x1a7a('0x4c')]=function(_0x37c014,_0x5b7001){var _0x529d3d={'raw':!![],'where':{'id':_0x37c014[_0x1a7a('0x4d')]['id']}},_0x24b586={};_0x24b586[_0x1a7a('0x35')]=_[_0x1a7a('0x36')](db[_0x1a7a('0x32')][_0x1a7a('0x33')]);_0x24b586[_0x1a7a('0x38')]=_[_0x1a7a('0x36')](_0x37c014[_0x1a7a('0x38')]);_0x24b586[_0x1a7a('0x37')]=_[_0x1a7a('0x3a')](_0x24b586[_0x1a7a('0x35')],_0x24b586[_0x1a7a('0x38')]);_0x529d3d['attributes']=_[_0x1a7a('0x3a')](_0x24b586['model'],qs['fields'](_0x37c014[_0x1a7a('0x38')][_0x1a7a('0x3b')]));_0x529d3d[_0x1a7a('0x39')]=_0x529d3d[_0x1a7a('0x39')][_0x1a7a('0x3c')]?_0x529d3d[_0x1a7a('0x39')]:_0x24b586[_0x1a7a('0x35')];if(_0x37c014['query'][_0x1a7a('0x4e')]){_0x529d3d[_0x1a7a('0x48')]=[{'all':!![]}];}_0x529d3d=_[_0x1a7a('0x44')]({},_0x529d3d,_0x37c014['options']);return db[_0x1a7a('0x32')][_0x1a7a('0x4f')](_0x529d3d)[_0x1a7a('0x2c')](handleEntityNotFound(_0x5b7001,null))[_0x1a7a('0x2c')](respondWithResult(_0x5b7001,null))['catch'](handleError(_0x5b7001,null));};exports[_0x1a7a('0x50')]=function(_0x4279da,_0x50d7ce){return db[_0x1a7a('0x32')][_0x1a7a('0x50')](_0x4279da[_0x1a7a('0x51')],{})[_0x1a7a('0x2c')](function(_0x4242b1){var _0x41b26b=_0x4279da[_0x1a7a('0x52')][_0x1a7a('0x2a')]({'plain':!![]});if(!_0x41b26b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41b26b[_0x1a7a('0x53')]===_0x1a7a('0x52')){var _0x276ef8=_0x4242b1[_0x1a7a('0x2a')]({'plain':!![]});var _0x4bb2be=_0x1a7a('0x2b');return db['UserProfileSection'][_0x1a7a('0x4f')]({'where':{'name':_0x4bb2be,'userProfileId':_0x41b26b[_0x1a7a('0x54')]},'raw':!![]})[_0x1a7a('0x2c')](function(_0x1ffb00){if(_0x1ffb00&&_0x1ffb00[_0x1a7a('0x55')]===0x0){return db[_0x1a7a('0x56')][_0x1a7a('0x50')]({'name':_0x276ef8[_0x1a7a('0x2f')],'resourceId':_0x276ef8['id'],'type':_0x1ffb00['name'],'sectionId':_0x1ffb00['id']},{})[_0x1a7a('0x2c')](function(){return _0x4242b1;});}else{return _0x4242b1;}})['catch'](function(_0x3a35e2){logger[_0x1a7a('0x2d')](_0x1a7a('0x57'),_0x3a35e2);throw _0x3a35e2;});}return _0x4242b1;})[_0x1a7a('0x2c')](respondWithResult(_0x50d7ce,0xc9))[_0x1a7a('0x4b')](handleError(_0x50d7ce,null));};exports['update']=function(_0x472071,_0x23e604){if(_0x472071['body']['id']){delete _0x472071[_0x1a7a('0x51')]['id'];}return db[_0x1a7a('0x32')][_0x1a7a('0x4f')]({'where':{'id':_0x472071[_0x1a7a('0x4d')]['id']}})[_0x1a7a('0x2c')](handleEntityNotFound(_0x23e604,null))['then'](saveUpdates(_0x472071[_0x1a7a('0x51')],null))[_0x1a7a('0x2c')](respondWithResult(_0x23e604,null))[_0x1a7a('0x4b')](handleError(_0x23e604,null));};exports[_0x1a7a('0x29')]=function(_0x3052f7,_0x4bd91f){return db[_0x1a7a('0x32')][_0x1a7a('0x4f')]({'where':{'id':_0x3052f7[_0x1a7a('0x4d')]['id']}})[_0x1a7a('0x2c')](handleEntityNotFound(_0x4bd91f,null))['then'](removeEntity(_0x4bd91f,null))[_0x1a7a('0x4b')](handleError(_0x4bd91f,null));};exports[_0x1a7a('0x58')]=function(_0xa00f84,_0xfbc7de){return db[_0x1a7a('0x32')][_0x1a7a('0x58')]()['then'](respondWithResult(_0xfbc7de,null))[_0x1a7a('0x4b')](handleError(_0xfbc7de,null));};exports[_0x1a7a('0x59')]=function(_0x4d29dd,_0x2dc102,_0x302a56){var _0x4c260a={'raw':!![],'where':{}},_0x5c4d97={},_0x4834d3;return db[_0x1a7a('0x32')][_0x1a7a('0x5a')]({'where':{'id':_0x4d29dd[_0x1a7a('0x4d')]['id']}})[_0x1a7a('0x2c')](handleEntityNotFound(_0x2dc102,null))[_0x1a7a('0x2c')](function(_0x30e9ae){if(_0x30e9ae){_0x4834d3=_0x30e9ae['get']({'plain':!![]});_0x5c4d97[_0x1a7a('0x35')]=_[_0x1a7a('0x36')](db[_0x1a7a('0x5b')][_0x1a7a('0x33')]);_0x5c4d97['query']=_['keys'](_0x4d29dd[_0x1a7a('0x38')]);_0x5c4d97[_0x1a7a('0x37')]=_[_0x1a7a('0x3a')](_0x5c4d97[_0x1a7a('0x35')],_0x5c4d97[_0x1a7a('0x38')]);_0x4c260a[_0x1a7a('0x39')]=_[_0x1a7a('0x3a')](_0x5c4d97[_0x1a7a('0x35')],qs[_0x1a7a('0x3b')](_0x4d29dd[_0x1a7a('0x38')][_0x1a7a('0x3b')]));_0x4c260a['attributes']=_0x4c260a[_0x1a7a('0x39')][_0x1a7a('0x3c')]?_0x4c260a[_0x1a7a('0x39')]:_0x5c4d97['model'];if(!_0x4d29dd[_0x1a7a('0x38')][_0x1a7a('0x5c')]('nolimit')){_0x4c260a[_0x1a7a('0x3e')]=qs[_0x1a7a('0x3e')](_0x4d29dd[_0x1a7a('0x38')][_0x1a7a('0x3e')]);_0x4c260a[_0x1a7a('0x1f')]=qs['offset'](_0x4d29dd[_0x1a7a('0x38')]['offset']);}_0x4c260a[_0x1a7a('0x3f')]=qs[_0x1a7a('0x40')](_0x4d29dd[_0x1a7a('0x38')][_0x1a7a('0x40')]);_0x4c260a[_0x1a7a('0x41')]=qs[_0x1a7a('0x37')](_[_0x1a7a('0x42')](_0x4d29dd['query'],_0x5c4d97[_0x1a7a('0x37')]));_0x4c260a[_0x1a7a('0x41')][_0x1a7a('0x5d')]=_0x30e9ae['id'];if(_0x4d29dd['query'][_0x1a7a('0x43')]){_0x4c260a['where']=_[_0x1a7a('0x44')](_0x4c260a['where'],{'$or':_[_0x1a7a('0x31')](_0x4c260a[_0x1a7a('0x39')],function(_0x336f3d){var _0x1a5f87={};_0x1a5f87[_0x336f3d]={'$like':'%'+_0x4d29dd['query'][_0x1a7a('0x43')]+'%'};return _0x1a5f87;})});}_0x4c260a=_[_0x1a7a('0x44')]({},_0x4c260a,_0x4d29dd[_0x1a7a('0x47')]);return db['UserWhatsappQueue'][_0x1a7a('0x49')](_0x4c260a);}})['then'](function(_0x170920){if(_0x170920){return db[_0x1a7a('0x5e')][_0x1a7a('0x5f')]({'where':{'id':_[_0x1a7a('0x31')](_0x170920,_0x1a7a('0x60')),'role':'agent'},'attributes':['id',_0x1a7a('0x2f'),'whatsappPause',_0x1a7a('0x61'),_0x1a7a('0x62')]});}})[_0x1a7a('0x2c')](function(_0x34f182){if(_0x34f182){return{'count':_0x34f182['count'],'rows':_[_0x1a7a('0x31')](_0x34f182['rows'],function(_0x312263){return{'membername':_0x312263[_0x1a7a('0x2f')],'UserId':_0x312263['id'],'queue_name':_0x4834d3[_0x1a7a('0x2f')],'WhatsappQueueId':_0x4834d3['id'],'interface':util[_0x1a7a('0x63')](_0x1a7a('0x64'),_0x1a7a('0x65'),_0x312263[_0x1a7a('0x2f')]),'penalty':0x0,'paused':_0x312263[_0x1a7a('0x66')],'createdAt':_0x312263[_0x1a7a('0x62')],'updatedAt':_0x312263[_0x1a7a('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1a7a('0x2c')](respondWithFilteredResult(_0x2dc102,_0x4c260a))[_0x1a7a('0x4b')](handleError(_0x2dc102,null));};exports[_0x1a7a('0x67')]=function(_0x5b9595,_0x23c952,_0x4a5d26){var _0x6aa17f={};var _0x371267={};var _0x50f03f;var _0x5b1dff;return db[_0x1a7a('0x32')][_0x1a7a('0x5a')]({'where':{'id':_0x5b9595['params']['id']}})[_0x1a7a('0x2c')](handleEntityNotFound(_0x23c952,null))[_0x1a7a('0x2c')](function(_0x10406d){if(_0x10406d){_0x50f03f=_0x10406d;_0x371267[_0x1a7a('0x35')]=_[_0x1a7a('0x36')](db[_0x1a7a('0x68')][_0x1a7a('0x33')]);_0x371267[_0x1a7a('0x38')]=_[_0x1a7a('0x36')](_0x5b9595[_0x1a7a('0x38')]);_0x371267[_0x1a7a('0x37')]=_[_0x1a7a('0x3a')](_0x371267[_0x1a7a('0x35')],_0x371267[_0x1a7a('0x38')]);_0x6aa17f[_0x1a7a('0x39')]=_[_0x1a7a('0x3a')](_0x371267[_0x1a7a('0x35')],qs[_0x1a7a('0x3b')](_0x5b9595[_0x1a7a('0x38')][_0x1a7a('0x3b')]));_0x6aa17f['attributes']=_0x6aa17f[_0x1a7a('0x39')][_0x1a7a('0x3c')]?_0x6aa17f[_0x1a7a('0x39')]:_0x371267[_0x1a7a('0x35')];_0x6aa17f[_0x1a7a('0x3f')]=qs[_0x1a7a('0x40')](_0x5b9595[_0x1a7a('0x38')][_0x1a7a('0x40')]);_0x6aa17f[_0x1a7a('0x41')]=qs[_0x1a7a('0x37')](_[_0x1a7a('0x42')](_0x5b9595[_0x1a7a('0x38')],_0x371267['filters']));if(_0x5b9595['query']['filter']){_0x6aa17f[_0x1a7a('0x41')]=_[_0x1a7a('0x44')](_0x6aa17f[_0x1a7a('0x41')],{'$or':_[_0x1a7a('0x31')](_0x6aa17f[_0x1a7a('0x39')],function(_0x39b7e8){var _0xf1251a={};_0xf1251a[_0x39b7e8]={'$like':'%'+_0x5b9595['query'][_0x1a7a('0x43')]+'%'};return _0xf1251a;})});}_0x6aa17f=_[_0x1a7a('0x44')]({},_0x6aa17f,_0x5b9595['options']);return _0x50f03f['getTeams'](_0x6aa17f);}})['then'](function(_0x1fa6a9){if(_0x1fa6a9){_0x5b1dff=_0x1fa6a9['length'];if(!_0x5b9595['query']['hasOwnProperty'](_0x1a7a('0x3d'))){_0x6aa17f[_0x1a7a('0x3e')]=qs[_0x1a7a('0x3e')](_0x5b9595[_0x1a7a('0x38')][_0x1a7a('0x3e')]);_0x6aa17f[_0x1a7a('0x1f')]=qs[_0x1a7a('0x1f')](_0x5b9595[_0x1a7a('0x38')][_0x1a7a('0x1f')]);}return _0x50f03f['getTeams'](_0x6aa17f);}})[_0x1a7a('0x2c')](function(_0x4b6334){if(_0x4b6334){return _0x4b6334?{'count':_0x5b1dff,'rows':_0x4b6334}:null;}})['then'](respondWithResult(_0x23c952,null))[_0x1a7a('0x4b')](handleError(_0x23c952,null));};exports['addTeams']=function(_0x99fc9c,_0x589acc,_0x22f1f5){var _0x3e3ecb=_0x99fc9c['body']['ids'];return db[_0x1a7a('0x68')][_0x1a7a('0x49')]({'where':{'id':_0x3e3ecb},'attributes':['id'],'include':[{'model':db[_0x1a7a('0x5e')],'as':'Agents','attributes':['id',_0x1a7a('0x2f'),_0x1a7a('0x69'),_0x1a7a('0x6a'),'interface'],'raw':!![]}]})[_0x1a7a('0x2c')](function(_0x4da1f4){if(_0x4da1f4){var _0x4f89a4=_['flatMap'](_0x4da1f4,function(_0x16c083){var _0x4e5213=_0x16c083[_0x1a7a('0x2a')]({'plain':!![]});return _0x4e5213[_0x1a7a('0x6b')];});return db['WhatsappQueue'][_0x1a7a('0x4f')]({'where':{'id':_0x99fc9c[_0x1a7a('0x4d')]['id']}})['then'](function(_0x96434){return db[_0x1a7a('0x6c')][_0x1a7a('0x6d')](function(_0x149f1d){return _0x96434[_0x1a7a('0x6e')](_0x3e3ecb,{'transaction':_0x149f1d})[_0x1a7a('0x2c')](function(){return BPromise['each'](_0x4f89a4,function(_0x4cf07c){return db[_0x1a7a('0x5b')][_0x1a7a('0x6f')]({'where':{'UserId':_0x4cf07c['id'],'WhatsappQueueId':_0x99fc9c[_0x1a7a('0x4d')]['id']},'transaction':_0x149f1d});});})['then'](function(){_0x4f89a4[_0x1a7a('0x70')](function(_0x1cd923){socket[_0x1a7a('0x71')](_0x1a7a('0x72'),{'UserId':_0x1cd923['id'],'WhatsappQueueId':_0x96434['id']});});});});});}})[_0x1a7a('0x2c')](respondWithStatusCode(_0x589acc,null))[_0x1a7a('0x4b')](handleError(_0x589acc,null));};exports[_0x1a7a('0x73')]=function(_0x3c279c,_0x2ae069,_0x54a052){return db[_0x1a7a('0x68')][_0x1a7a('0x49')]({'where':{'id':_0x3c279c[_0x1a7a('0x38')][_0x1a7a('0x74')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x1a7a('0x2c')](handleEntityNotFound(_0x2ae069,null))[_0x1a7a('0x2c')](function(_0x2a3b26){var _0x47b50e=_['map'](_0x2a3b26,'id');var _0x1fac00=[];var _0x397828=[];var _0x5316fc=squel['select']();_0x5316fc[_0x1a7a('0x75')]('tq.TeamId')[_0x1a7a('0x76')](_0x1a7a('0x77'),'tq')[_0x1a7a('0x78')](_0x1a7a('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x1a7a('0x7a'),_0x3c279c[_0x1a7a('0x4d')]['id']);for(var _0x202db4=0x0;_0x202db4<_0x2a3b26[_0x1a7a('0x3c')];_0x202db4+=0x1){let _0x256732=_0x2a3b26[_0x202db4];for(var _0x556a87=0x0;_0x556a87<_0x256732[_0x1a7a('0x6b')][_0x1a7a('0x3c')];_0x556a87+=0x1){let _0x2c8476=_0x256732[_0x1a7a('0x6b')][_0x556a87];var _0x1d809a=_0x5316fc[_0x1a7a('0x7b')]();_0x1d809a['where'](_0x1a7a('0x7c'),_0x2c8476['id']);_0x397828['push'](db[_0x1a7a('0x6c')]['query'](_0x1d809a[_0x1a7a('0x7d')](),{'type':db['sequelize'][_0x1a7a('0x7e')]['SELECT']})['then'](function(_0x2a9d55){if(_0x2a9d55[_0x1a7a('0x3c')]===0x1){return _0x2c8476['id'];}else{var _0x37f026=_[_0x1a7a('0x7f')](_[_0x1a7a('0x31')](_0x2a9d55,_0x1a7a('0x80')),function(_0x42a54d){return _['includes'](_0x47b50e,_0x42a54d);});if(_0x37f026){return _0x2c8476['id'];}}}));}}return BPromise[_0x1a7a('0x81')](_0x397828)['then'](function(_0x460ce3){_0x1fac00=_(_0x1fac00)['union'](_0x460ce3)[_0x1a7a('0x82')]()[_0x1a7a('0x83')]();return db[_0x1a7a('0x32')][_0x1a7a('0x4f')]({'where':{'id':_0x3c279c['params']['id']}})[_0x1a7a('0x2c')](function(_0x44837c){return db[_0x1a7a('0x6c')][_0x1a7a('0x6d')](function(_0x338827){return _0x44837c['removeTeams'](_0x3c279c[_0x1a7a('0x38')][_0x1a7a('0x74')],{'transaction':_0x338827})[_0x1a7a('0x2c')](function(){if(!_[_0x1a7a('0x84')](_0x1fac00)){return _0x44837c[_0x1a7a('0x85')](_0x1fac00,{'transaction':_0x338827});}})[_0x1a7a('0x2c')](function(){_0x1fac00['forEach'](function(_0x15dc6b){socket[_0x1a7a('0x71')](_0x1a7a('0x86'),{'UserId':_0x15dc6b,'WhatsappQueueId':_0x44837c['id']});});});});});});})[_0x1a7a('0x2c')](respondWithStatusCode(_0x2ae069,null))[_0x1a7a('0x4b')](handleError(_0x2ae069,null));};exports[_0x1a7a('0x87')]=function(_0x55bcdc,_0x205b15,_0x305f3d){return db[_0x1a7a('0x32')][_0x1a7a('0x4f')]({'where':{'id':_0x55bcdc[_0x1a7a('0x4d')]['id']}})[_0x1a7a('0x2c')](handleEntityNotFound(_0x205b15,null))[_0x1a7a('0x2c')](function(_0x2fb1b8){if(_0x2fb1b8){return _0x2fb1b8[_0x1a7a('0x87')](_0x55bcdc[_0x1a7a('0x51')][_0x1a7a('0x74')],_[_0x1a7a('0x88')](_0x55bcdc['body'],[_0x1a7a('0x74'),'id'])||{})[_0x1a7a('0x89')](function(_0x2f0579){for(var _0x3d2676=0x0;_0x3d2676<_0x55bcdc[_0x1a7a('0x51')][_0x1a7a('0x74')][_0x1a7a('0x3c')];_0x3d2676+=0x1){socket[_0x1a7a('0x71')](_0x1a7a('0x72'),{'UserId':Number(_0x55bcdc[_0x1a7a('0x51')][_0x1a7a('0x74')][_0x3d2676]),'WhatsappQueueId':Number(_0x55bcdc[_0x1a7a('0x4d')]['id'])});}return _0x2f0579;});}})[_0x1a7a('0x2c')](respondWithResult(_0x205b15,null))[_0x1a7a('0x4b')](handleError(_0x205b15,null));};exports[_0x1a7a('0x85')]=function(_0x10c597,_0x390299,_0x3cb775){return db[_0x1a7a('0x32')]['find']({'where':{'id':_0x10c597[_0x1a7a('0x4d')]['id']}})[_0x1a7a('0x2c')](handleEntityNotFound(_0x390299,null))[_0x1a7a('0x2c')](function(_0x2f681d){if(_0x2f681d){return _0x2f681d['removeAgents'](_0x10c597[_0x1a7a('0x38')]['ids'])[_0x1a7a('0x2c')](function(){if(_['isArray'](_0x10c597['query'][_0x1a7a('0x74')])){for(var _0x3dd34d=0x0;_0x3dd34d<_0x10c597[_0x1a7a('0x38')][_0x1a7a('0x74')]['length'];_0x3dd34d+=0x1){socket[_0x1a7a('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x10c597['query'][_0x1a7a('0x74')][_0x3dd34d]),'WhatsappQueueId':Number(_0x10c597['params']['id'])});}}else{socket[_0x1a7a('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x10c597['query'][_0x1a7a('0x74')]),'WhatsappQueueId':Number(_0x10c597['params']['id'])});}});}})[_0x1a7a('0x2c')](respondWithStatusCode(_0x390299,null))[_0x1a7a('0x4b')](handleError(_0x390299,null));};exports[_0x1a7a('0x8a')]=function(_0x2e9f96,_0x958dc9,_0x13d3f9){var _0x3ba739={};var _0x259f01={};var _0x340c33;var _0x5c3fe4;return db['WhatsappQueue']['findOne']({'where':{'id':_0x2e9f96[_0x1a7a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x958dc9,null))['then'](function(_0x36f447){if(_0x36f447){_0x340c33=_0x36f447;_0x259f01[_0x1a7a('0x35')]=_['keys'](db['User'][_0x1a7a('0x33')]);_0x259f01[_0x1a7a('0x38')]=_[_0x1a7a('0x36')](_0x2e9f96[_0x1a7a('0x38')]);_0x259f01[_0x1a7a('0x37')]=_['intersection'](_0x259f01[_0x1a7a('0x35')],_0x259f01['query']);_0x3ba739[_0x1a7a('0x39')]=_[_0x1a7a('0x3a')](_0x259f01[_0x1a7a('0x35')],qs[_0x1a7a('0x3b')](_0x2e9f96[_0x1a7a('0x38')][_0x1a7a('0x3b')]));_0x3ba739[_0x1a7a('0x39')]=_0x3ba739[_0x1a7a('0x39')][_0x1a7a('0x3c')]?_0x3ba739[_0x1a7a('0x39')]:_0x259f01[_0x1a7a('0x35')];_0x3ba739[_0x1a7a('0x3f')]=qs['sort'](_0x2e9f96[_0x1a7a('0x38')]['sort']);_0x3ba739[_0x1a7a('0x41')]=qs[_0x1a7a('0x37')](_[_0x1a7a('0x42')](_0x2e9f96[_0x1a7a('0x38')],_0x259f01[_0x1a7a('0x37')]));if(_0x2e9f96[_0x1a7a('0x38')][_0x1a7a('0x43')]){_0x3ba739[_0x1a7a('0x41')]=_['merge'](_0x3ba739[_0x1a7a('0x41')],{'$or':_['map'](_0x3ba739[_0x1a7a('0x39')],function(_0x3674b){var _0x52b2ca={};_0x52b2ca[_0x3674b]={'$like':'%'+_0x2e9f96[_0x1a7a('0x38')][_0x1a7a('0x43')]+'%'};return _0x52b2ca;})});}_0x3ba739=_[_0x1a7a('0x44')]({},_0x3ba739,_0x2e9f96[_0x1a7a('0x47')]);return _0x340c33[_0x1a7a('0x8a')](_0x3ba739);}})[_0x1a7a('0x2c')](function(_0x34c773){if(_0x34c773){_0x5c3fe4=_0x34c773[_0x1a7a('0x3c')];if(!_0x2e9f96['query'][_0x1a7a('0x5c')](_0x1a7a('0x3d'))){_0x3ba739['limit']=qs[_0x1a7a('0x3e')](_0x2e9f96[_0x1a7a('0x38')][_0x1a7a('0x3e')]);_0x3ba739[_0x1a7a('0x1f')]=qs['offset'](_0x2e9f96[_0x1a7a('0x38')][_0x1a7a('0x1f')]);}return _0x340c33['getAgents'](_0x3ba739);}})[_0x1a7a('0x2c')](function(_0x1ff52c){if(_0x1ff52c){return _0x1ff52c?{'count':_0x5c3fe4,'rows':_0x1ff52c}:null;}})[_0x1a7a('0x2c')](respondWithResult(_0x958dc9,null))[_0x1a7a('0x4b')](handleError(_0x958dc9,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 197ffc2..c74755d 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 _0xdc89=['WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2b8b8e,_0x2b00eb){var _0x23da1d=function(_0x940f43){while(--_0x940f43){_0x2b8b8e['push'](_0x2b8b8e['shift']());}};_0x23da1d(++_0x2b00eb);}(_0xdc89,0x17f));var _0x9dc8=function(_0x34b951,_0x554a89){_0x34b951=_0x34b951-0x0;var _0x2b259f=_0xdc89[_0x34b951];return _0x2b259f;};'use strict';var EventEmitter=require(_0x9dc8('0x0'));var WhatsappQueue=require(_0x9dc8('0x1'))['db'][_0x9dc8('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x9dc8('0x3')](0x0);var events={'afterCreate':_0x9dc8('0x4'),'afterUpdate':_0x9dc8('0x5'),'afterDestroy':_0x9dc8('0x6')};function emitEvent(_0x2757a5){return function(_0x56a893,_0x5bb07a,_0x2047cc){WhatsappQueueEvents['emit'](_0x2757a5+':'+_0x56a893['id'],_0x56a893);WhatsappQueueEvents[_0x9dc8('0x7')](_0x2757a5,_0x56a893);_0x2047cc(null);};}for(var e in events){if(events[_0x9dc8('0x8')](e)){var event=events[e];WhatsappQueue[_0x9dc8('0x9')](e,emitEvent(event));}}module[_0x9dc8('0xa')]=WhatsappQueueEvents; \ No newline at end of file +var _0xa363=['hasOwnProperty','exports','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove'];(function(_0x111f99,_0x3b347f){var _0x3687c0=function(_0x4641d7){while(--_0x4641d7){_0x111f99['push'](_0x111f99['shift']());}};_0x3687c0(++_0x3b347f);}(_0xa363,0x19a));var _0x3a36=function(_0x21353a,_0xd8d9ce){_0x21353a=_0x21353a-0x0;var _0x29a565=_0xa363[_0x21353a];return _0x29a565;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x3a36('0x0'))['db'][_0x3a36('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x3a36('0x2')](0x0);var events={'afterCreate':_0x3a36('0x3'),'afterUpdate':_0x3a36('0x4'),'afterDestroy':_0x3a36('0x5')};function emitEvent(_0x231ff5){return function(_0x2b42cc,_0x5073d9,_0x50ae79){WhatsappQueueEvents['emit'](_0x231ff5+':'+_0x2b42cc['id'],_0x2b42cc);WhatsappQueueEvents['emit'](_0x231ff5,_0x2b42cc);_0x50ae79(null);};}for(var e in events){if(events[_0x3a36('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x3a36('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 91d5333..5de9fe0 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 _0x80e0=['request-promise','path','./whatsappQueue.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x490d1f,_0x3cc7ad){var _0x102606=function(_0x34022e){while(--_0x34022e){_0x490d1f['push'](_0x490d1f['shift']());}};_0x102606(++_0x3cc7ad);}(_0x80e0,0xb8));var _0x080e=function(_0x8ba5d2,_0x22debd){_0x8ba5d2=_0x8ba5d2-0x0;var _0x5d53c1=_0x80e0[_0x8ba5d2];return _0x5d53c1;};'use strict';var _=require(_0x080e('0x0'));var util=require(_0x080e('0x1'));var logger=require(_0x080e('0x2'))(_0x080e('0x3'));var moment=require(_0x080e('0x4'));var BPromise=require(_0x080e('0x5'));var rp=require(_0x080e('0x6'));var fs=require('fs');var path=require(_0x080e('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x080e('0x8'));module['exports']=function(_0x2644ad,_0x1e63d7){return _0x2644ad[_0x080e('0x9')]('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b22=['WhatsappQueue','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define'];(function(_0x49c57f,_0xf7efbe){var _0x3534c3=function(_0x191651){while(--_0x191651){_0x49c57f['push'](_0x49c57f['shift']());}};_0x3534c3(++_0xf7efbe);}(_0x8b22,0x10f));var _0x28b2=function(_0x345bab,_0x5ac9b3){_0x345bab=_0x345bab-0x0;var _0x507d14=_0x8b22[_0x345bab];return _0x507d14;};'use strict';var _=require('lodash');var util=require(_0x28b2('0x0'));var logger=require(_0x28b2('0x1'))('api');var moment=require(_0x28b2('0x2'));var BPromise=require('bluebird');var rp=require(_0x28b2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x28b2('0x4'));var config=require(_0x28b2('0x5'));var attributes=require(_0x28b2('0x6'));module[_0x28b2('0x7')]=function(_0x44b8f1,_0x352a1a){return _0x44b8f1[_0x28b2('0x8')](_0x28b2('0x9'),attributes,{'tableName':'whatsapp_queues','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 055a99c..f893dac 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 _0x6f95=['register','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','options','raw','where','attributes','limit','include','map','model','GetWhatsappQueue','catch','ShowWhatsappQueue','WhatsappQueue','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','./whatsappQueue.socket'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x6f95,0x165));var _0x56f9=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x6f95[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x56f9('0x0'));var util=require(_0x56f9('0x1'));var moment=require('moment');var BPromise=require(_0x56f9('0x2'));var rs=require(_0x56f9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x56f9('0x4'))['db'];var utils=require(_0x56f9('0x5'));var logger=require(_0x56f9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x56f9('0x7'));var client=jayson[_0x56f9('0x8')][_0x56f9('0x9')]({'port':0x232a});config[_0x56f9('0xa')]=_[_0x56f9('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x56f9('0xa')]));require(_0x56f9('0xc'))[_0x56f9('0xd')](socket);function respondWithRpcPromise(_0x2b84fb,_0x2488fe,_0x5b7f26){return new BPromise(function(_0x4fd812,_0x12a55a){return client[_0x56f9('0xe')](_0x2b84fb,_0x5b7f26)[_0x56f9('0xf')](function(_0x1e5409){logger[_0x56f9('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x2488fe,_0x56f9('0x11'));logger[_0x56f9('0x12')](_0x56f9('0x13'),_0x2488fe,_0x56f9('0x11'),JSON[_0x56f9('0x14')](_0x1e5409));if(_0x1e5409[_0x56f9('0x15')]){if(_0x1e5409[_0x56f9('0x15')][_0x56f9('0x16')]===0x1f4){logger[_0x56f9('0x15')](_0x56f9('0x17'),_0x2488fe,_0x1e5409[_0x56f9('0x15')][_0x56f9('0x18')]);return _0x12a55a(_0x1e5409[_0x56f9('0x15')]['message']);}logger[_0x56f9('0x15')](_0x56f9('0x17'),_0x2488fe,_0x1e5409[_0x56f9('0x15')]['message']);return _0x4fd812(_0x1e5409[_0x56f9('0x15')]['message']);}else{logger[_0x56f9('0x10')](_0x56f9('0x17'),_0x2488fe,'request\x20sent');_0x4fd812(_0x1e5409['result'][_0x56f9('0x18')]);}})['catch'](function(_0x4d4bd5){logger[_0x56f9('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x2488fe,_0x4d4bd5);_0x12a55a(_0x4d4bd5);});});}exports['GetWhatsappQueue']=function(_0x28d5ea){var _0x1c6d4c=this;return new Promise(function(_0x10bd62,_0x2468b0){return db['WhatsappQueue']['findAll']({'raw':_0x28d5ea[_0x56f9('0x19')]?_0x28d5ea[_0x56f9('0x19')][_0x56f9('0x1a')]===undefined?!![]:![]:!![],'where':_0x28d5ea['options']?_0x28d5ea[_0x56f9('0x19')][_0x56f9('0x1b')]||null:null,'attributes':_0x28d5ea[_0x56f9('0x19')]?_0x28d5ea[_0x56f9('0x19')][_0x56f9('0x1c')]||null:null,'limit':_0x28d5ea['options']?_0x28d5ea[_0x56f9('0x19')][_0x56f9('0x1d')]||null:null,'include':_0x28d5ea['options']?_0x28d5ea[_0x56f9('0x19')][_0x56f9('0x1e')]?_[_0x56f9('0x1f')](_0x28d5ea[_0x56f9('0x19')][_0x56f9('0x1e')],function(_0x44aeff){return{'model':db[_0x44aeff[_0x56f9('0x20')]],'as':_0x44aeff['as'],'attributes':_0x44aeff['attributes'],'include':_0x44aeff[_0x56f9('0x1e')]?_['map'](_0x44aeff[_0x56f9('0x1e')],function(_0xa4c629){return{'model':db[_0xa4c629[_0x56f9('0x20')]],'as':_0xa4c629['as'],'attributes':_0xa4c629['attributes'],'include':_0xa4c629[_0x56f9('0x1e')]?_[_0x56f9('0x1f')](_0xa4c629['include'],function(_0xa0e9cc){return{'model':db[_0xa0e9cc[_0x56f9('0x20')]],'as':_0xa0e9cc['as'],'attributes':_0xa0e9cc[_0x56f9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x56f9('0xf')](function(_0x5330cd){logger[_0x56f9('0x10')](_0x56f9('0x21'),_0x28d5ea);logger[_0x56f9('0x12')](_0x56f9('0x21'),_0x28d5ea,JSON[_0x56f9('0x14')](_0x5330cd));_0x10bd62(_0x5330cd);})[_0x56f9('0x22')](function(_0x26542e){logger['error'](_0x56f9('0x21'),_0x26542e[_0x56f9('0x18')],_0x28d5ea);_0x2468b0(_0x1c6d4c[_0x56f9('0x15')](0x1f4,_0x26542e[_0x56f9('0x18')]));});});};exports[_0x56f9('0x23')]=function(_0x29bb91){var _0x3f1c64=this;return new Promise(function(_0x986415,_0x499a2b){return db[_0x56f9('0x24')]['find']({'raw':_0x29bb91[_0x56f9('0x19')]?_0x29bb91[_0x56f9('0x19')][_0x56f9('0x1a')]===undefined?!![]:![]:!![],'where':_0x29bb91['options']?_0x29bb91[_0x56f9('0x19')]['where']||null:null,'attributes':_0x29bb91[_0x56f9('0x19')]?_0x29bb91[_0x56f9('0x19')][_0x56f9('0x1c')]||null:null,'include':_0x29bb91[_0x56f9('0x19')]?_0x29bb91[_0x56f9('0x19')][_0x56f9('0x1e')]?_[_0x56f9('0x1f')](_0x29bb91[_0x56f9('0x19')][_0x56f9('0x1e')],function(_0x166599){return{'model':db[_0x166599[_0x56f9('0x20')]],'as':_0x166599['as'],'attributes':_0x166599[_0x56f9('0x1c')],'include':_0x166599[_0x56f9('0x1e')]?_[_0x56f9('0x1f')](_0x166599[_0x56f9('0x1e')],function(_0x1c9d13){return{'model':db[_0x1c9d13[_0x56f9('0x20')]],'as':_0x1c9d13['as'],'attributes':_0x1c9d13['attributes'],'include':_0x1c9d13['include']?_[_0x56f9('0x1f')](_0x1c9d13[_0x56f9('0x1e')],function(_0x345f4a){return{'model':db[_0x345f4a[_0x56f9('0x20')]],'as':_0x345f4a['as'],'attributes':_0x345f4a['attributes']};}):[]};}):[]};}):[]:[]})[_0x56f9('0xf')](function(_0x4867bb){logger[_0x56f9('0x10')]('ShowWhatsappQueue',_0x29bb91);logger[_0x56f9('0x12')](_0x56f9('0x23'),_0x29bb91,JSON['stringify'](_0x4867bb));_0x986415(_0x4867bb);})['catch'](function(_0x3a5c75){logger[_0x56f9('0x15')](_0x56f9('0x23'),_0x3a5c75[_0x56f9('0x18')],_0x29bb91);_0x499a2b(_0x3f1c64[_0x56f9('0x15')](0x1f4,_0x3a5c75[_0x56f9('0x18')]));});});}; \ No newline at end of file +var _0xd53c=['bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','debug','request\x20sent','error','message','info','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','attributes','limit','include','model','map','ShowWhatsappQueue','stringify','lodash','moment'];(function(_0x40c09a,_0x3f02f7){var _0x3639f3=function(_0x7f0864){while(--_0x7f0864){_0x40c09a['push'](_0x40c09a['shift']());}};_0x3639f3(++_0x3f02f7);}(_0xd53c,0x174));var _0xcd53=function(_0x2a2410,_0x527d26){_0x2a2410=_0x2a2410-0x0;var _0x1cbbcc=_0xd53c[_0x2a2410];return _0x1cbbcc;};'use strict';var _=require(_0xcd53('0x0'));var util=require('util');var moment=require(_0xcd53('0x1'));var BPromise=require(_0xcd53('0x2'));var rs=require(_0xcd53('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcd53('0x4'));var logger=require('../../config/logger')(_0xcd53('0x5'));var config=require(_0xcd53('0x6'));var jayson=require(_0xcd53('0x7'));var client=jayson['client'][_0xcd53('0x8')]({'port':0x232a});config['redis']=_[_0xcd53('0x9')](config[_0xcd53('0xa')],{'host':_0xcd53('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcd53('0xa')]));require(_0xcd53('0xc'))[_0xcd53('0xd')](socket);function respondWithRpcPromise(_0x115022,_0x2b001d,_0xbd7fe7){return new BPromise(function(_0x356e08,_0x27b41c){return client[_0xcd53('0xe')](_0x115022,_0xbd7fe7)[_0xcd53('0xf')](function(_0x296c8e){logger['info'](_0xcd53('0x10'),_0x2b001d,'request\x20sent');logger[_0xcd53('0x11')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x2b001d,_0xcd53('0x12'),JSON['stringify'](_0x296c8e));if(_0x296c8e[_0xcd53('0x13')]){if(_0x296c8e['error']['code']===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x2b001d,_0x296c8e['error'][_0xcd53('0x14')]);return _0x27b41c(_0x296c8e['error'][_0xcd53('0x14')]);}logger[_0xcd53('0x13')](_0xcd53('0x10'),_0x2b001d,_0x296c8e[_0xcd53('0x13')][_0xcd53('0x14')]);return _0x356e08(_0x296c8e[_0xcd53('0x13')][_0xcd53('0x14')]);}else{logger[_0xcd53('0x15')](_0xcd53('0x10'),_0x2b001d,_0xcd53('0x12'));_0x356e08(_0x296c8e['result'][_0xcd53('0x14')]);}})[_0xcd53('0x16')](function(_0x46d2a8){logger['error'](_0xcd53('0x10'),_0x2b001d,_0x46d2a8);_0x27b41c(_0x46d2a8);});});}exports[_0xcd53('0x17')]=function(_0x55df2e){var _0x56eac3=this;return new Promise(function(_0x3feb51,_0x176940){return db[_0xcd53('0x18')][_0xcd53('0x19')]({'raw':_0x55df2e[_0xcd53('0x1a')]?_0x55df2e[_0xcd53('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x55df2e[_0xcd53('0x1a')]?_0x55df2e['options']['where']||null:null,'attributes':_0x55df2e['options']?_0x55df2e[_0xcd53('0x1a')][_0xcd53('0x1b')]||null:null,'limit':_0x55df2e[_0xcd53('0x1a')]?_0x55df2e[_0xcd53('0x1a')][_0xcd53('0x1c')]||null:null,'include':_0x55df2e[_0xcd53('0x1a')]?_0x55df2e[_0xcd53('0x1a')][_0xcd53('0x1d')]?_['map'](_0x55df2e[_0xcd53('0x1a')][_0xcd53('0x1d')],function(_0x5e0a93){return{'model':db[_0x5e0a93[_0xcd53('0x1e')]],'as':_0x5e0a93['as'],'attributes':_0x5e0a93[_0xcd53('0x1b')],'include':_0x5e0a93[_0xcd53('0x1d')]?_[_0xcd53('0x1f')](_0x5e0a93[_0xcd53('0x1d')],function(_0x3fe859){return{'model':db[_0x3fe859[_0xcd53('0x1e')]],'as':_0x3fe859['as'],'attributes':_0x3fe859[_0xcd53('0x1b')],'include':_0x3fe859[_0xcd53('0x1d')]?_['map'](_0x3fe859[_0xcd53('0x1d')],function(_0x5822f5){return{'model':db[_0x5822f5[_0xcd53('0x1e')]],'as':_0x5822f5['as'],'attributes':_0x5822f5[_0xcd53('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xcd53('0xf')](function(_0x435a28){logger[_0xcd53('0x15')](_0xcd53('0x17'),_0x55df2e);logger[_0xcd53('0x11')](_0xcd53('0x17'),_0x55df2e,JSON['stringify'](_0x435a28));_0x3feb51(_0x435a28);})[_0xcd53('0x16')](function(_0x29b080){logger[_0xcd53('0x13')](_0xcd53('0x17'),_0x29b080[_0xcd53('0x14')],_0x55df2e);_0x176940(_0x56eac3[_0xcd53('0x13')](0x1f4,_0x29b080[_0xcd53('0x14')]));});});};exports[_0xcd53('0x20')]=function(_0x38b89e){var _0x3c8c75=this;return new Promise(function(_0x33ec13,_0x61903b){return db['WhatsappQueue']['find']({'raw':_0x38b89e[_0xcd53('0x1a')]?_0x38b89e[_0xcd53('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x38b89e[_0xcd53('0x1a')]?_0x38b89e['options']['where']||null:null,'attributes':_0x38b89e[_0xcd53('0x1a')]?_0x38b89e['options'][_0xcd53('0x1b')]||null:null,'include':_0x38b89e[_0xcd53('0x1a')]?_0x38b89e[_0xcd53('0x1a')][_0xcd53('0x1d')]?_[_0xcd53('0x1f')](_0x38b89e[_0xcd53('0x1a')]['include'],function(_0x4f3d4c){return{'model':db[_0x4f3d4c[_0xcd53('0x1e')]],'as':_0x4f3d4c['as'],'attributes':_0x4f3d4c[_0xcd53('0x1b')],'include':_0x4f3d4c[_0xcd53('0x1d')]?_['map'](_0x4f3d4c[_0xcd53('0x1d')],function(_0xc9719f){return{'model':db[_0xc9719f[_0xcd53('0x1e')]],'as':_0xc9719f['as'],'attributes':_0xc9719f[_0xcd53('0x1b')],'include':_0xc9719f[_0xcd53('0x1d')]?_[_0xcd53('0x1f')](_0xc9719f[_0xcd53('0x1d')],function(_0x2d9851){return{'model':db[_0x2d9851[_0xcd53('0x1e')]],'as':_0x2d9851['as'],'attributes':_0x2d9851[_0xcd53('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x164dc7){logger[_0xcd53('0x15')](_0xcd53('0x20'),_0x38b89e);logger[_0xcd53('0x11')]('ShowWhatsappQueue',_0x38b89e,JSON[_0xcd53('0x21')](_0x164dc7));_0x33ec13(_0x164dc7);})[_0xcd53('0x16')](function(_0x33436c){logger[_0xcd53('0x13')](_0xcd53('0x20'),_0x33436c[_0xcd53('0x14')],_0x38b89e);_0x61903b(_0x3c8c75[_0xcd53('0x13')](0x1f4,_0x33436c[_0xcd53('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 9eaf0f0..d6f4545 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 _0x25c6=['removeListener','register','length','whatsappQueue:','./whatsappQueue.events','remove','update'];(function(_0xa62a6b,_0x50f390){var _0x57380b=function(_0x29be07){while(--_0x29be07){_0xa62a6b['push'](_0xa62a6b['shift']());}};_0x57380b(++_0x50f390);}(_0x25c6,0x1cb));var _0x625c=function(_0x345ac6,_0x43a5de){_0x345ac6=_0x345ac6-0x0;var _0x4c6fe6=_0x25c6[_0x345ac6];return _0x4c6fe6;};'use strict';var WhatsappQueueEvents=require(_0x625c('0x0'));var events=['save',_0x625c('0x1'),_0x625c('0x2')];function createListener(_0x426cb0,_0x266182){return function(_0x16d5ec){_0x266182['emit'](_0x426cb0,_0x16d5ec);};}function removeListener(_0x3d7d65,_0x414cea){return function(){WhatsappQueueEvents[_0x625c('0x3')](_0x3d7d65,_0x414cea);};}exports[_0x625c('0x4')]=function(_0x29d7fc){for(var _0x3e9966=0x0,_0x4b3849=events[_0x625c('0x5')];_0x3e9966<_0x4b3849;_0x3e9966++){var _0x4910f9=events[_0x3e9966];var _0x2c232f=createListener(_0x625c('0x6')+_0x4910f9,_0x29d7fc);WhatsappQueueEvents['on'](_0x4910f9,_0x2c232f);}}; \ No newline at end of file +var _0xb22c=['emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove','update'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0xb22c,0x9e));var _0xcb22=function(_0x263b5d,_0xadc8e9){_0x263b5d=_0x263b5d-0x0;var _0x17ffa6=_0xb22c[_0x263b5d];return _0x17ffa6;};'use strict';var WhatsappQueueEvents=require(_0xcb22('0x0'));var events=[_0xcb22('0x1'),_0xcb22('0x2'),_0xcb22('0x3')];function createListener(_0x174bca,_0x5d71fb){return function(_0x573e9c){_0x5d71fb[_0xcb22('0x4')](_0x174bca,_0x573e9c);};}function removeListener(_0x3fb719,_0xfd6064){return function(){WhatsappQueueEvents[_0xcb22('0x5')](_0x3fb719,_0xfd6064);};}exports[_0xcb22('0x6')]=function(_0x28374b){for(var _0x53ef26=0x0,_0xea70d4=events[_0xcb22('0x7')];_0x53ef26<_0xea70d4;_0x53ef26++){var _0x51bb03=events[_0x53ef26];var _0x1df314=createListener(_0xcb22('0x8')+_0x51bb03,_0x28374b);WhatsappQueueEvents['on'](_0x51bb03,_0x1df314);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index a60c9bc..d189c0a 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 _0x446f=['isAuthenticated','index','/describe','describe','/:id','create','put','update','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x446f,0x114));var _0xf446=function(_0x2b91f2,_0x204253){_0x2b91f2=_0x2b91f2-0x0;var _0x5262a5=_0x446f[_0x2b91f2];return _0x5262a5;};'use strict';var multer=require(_0xf446('0x0'));var util=require(_0xf446('0x1'));var path=require(_0xf446('0x2'));var timeout=require('connect-timeout');var express=require(_0xf446('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf446('0x4'));var interaction=require(_0xf446('0x5'));var config=require(_0xf446('0x6'));var controller=require(_0xf446('0x7'));router[_0xf446('0x8')]('/',auth[_0xf446('0x9')](),controller[_0xf446('0xa')]);router['get'](_0xf446('0xb'),auth[_0xf446('0x9')](),controller[_0xf446('0xc')]);router[_0xf446('0x8')](_0xf446('0xd'),auth[_0xf446('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf446('0xe')]);router[_0xf446('0xf')]('/:id',auth[_0xf446('0x9')](),controller[_0xf446('0x10')]);router['delete'](_0xf446('0xd'),auth[_0xf446('0x9')](),controller[_0xf446('0x11')]);module[_0xf446('0x12')]=router; \ No newline at end of file +var _0xe5a4=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe5a4,0x19f));var _0x4e5a=function(_0x39ce5e,_0x3aae30){_0x39ce5e=_0x39ce5e-0x0;var _0x93b4f=_0xe5a4[_0x39ce5e];return _0x93b4f;};'use strict';var multer=require('multer');var util=require(_0x4e5a('0x0'));var path=require(_0x4e5a('0x1'));var timeout=require(_0x4e5a('0x2'));var express=require(_0x4e5a('0x3'));var router=express[_0x4e5a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4e5a('0x5'));var interaction=require(_0x4e5a('0x6'));var config=require(_0x4e5a('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x4e5a('0x8')]('/',auth['isAuthenticated'](),controller[_0x4e5a('0x9')]);router[_0x4e5a('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x4e5a('0xa')]);router[_0x4e5a('0x8')](_0x4e5a('0xb'),auth[_0x4e5a('0xc')](),controller['show']);router[_0x4e5a('0xd')]('/',auth['isAuthenticated'](),controller[_0x4e5a('0xe')]);router[_0x4e5a('0xf')](_0x4e5a('0xb'),auth[_0x4e5a('0xc')](),controller[_0x4e5a('0x10')]);router[_0x4e5a('0x11')](_0x4e5a('0xb'),auth[_0x4e5a('0xc')](),controller[_0x4e5a('0x12')]);module[_0x4e5a('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 1edb761..9bea074 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 _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x61b9a6,_0x4db547){var _0x208271=function(_0x221a72){while(--_0x221a72){_0x61b9a6['push'](_0x61b9a6['shift']());}};_0x208271(++_0x4db547);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0xc5d2c6,_0x5c55cd){var _0x505218=function(_0x33d162){while(--_0x33d162){_0xc5d2c6['push'](_0xc5d2c6['shift']());}};_0x505218(++_0x5c55cd);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index cc1e49a..4c52c92 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4f4=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','error','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','type','VIRTUAL','findAll','rows','then','catch','show','params','keys','includeAll','include','merge','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x25a42a,_0x3d489b){var _0x1129b1=function(_0x4ae61b){while(--_0x4ae61b){_0x25a42a['push'](_0x25a42a['shift']());}};_0x1129b1(++_0x3d489b);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x10701e,_0x59c6e4){_0x10701e=_0x10701e-0x0;var _0x186968=_0xd4f4[_0x10701e];return _0x186968;};'use strict';var emlformat=require(_0x4d4f('0x0'));var rimraf=require(_0x4d4f('0x1'));var zipdir=require(_0x4d4f('0x2'));var jsonpatch=require(_0x4d4f('0x3'));var rp=require(_0x4d4f('0x4'));var moment=require(_0x4d4f('0x5'));var BPromise=require(_0x4d4f('0x6'));var Mustache=require(_0x4d4f('0x7'));var util=require(_0x4d4f('0x8'));var path=require(_0x4d4f('0x9'));var sox=require(_0x4d4f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d4f('0xb'));var squel=require(_0x4d4f('0xc'));var crypto=require(_0x4d4f('0xd'));var jsforce=require(_0x4d4f('0xe'));var deskjs=require(_0x4d4f('0xf'));var toCsv=require(_0x4d4f('0x10'));var querystring=require(_0x4d4f('0x11'));var Papa=require(_0x4d4f('0x12'));var Redis=require(_0x4d4f('0x13'));var authService=require(_0x4d4f('0x14'));var qs=require(_0x4d4f('0x15'));var as=require(_0x4d4f('0x16'));var hardwareService=require(_0x4d4f('0x17'));var logger=require(_0x4d4f('0x18'))(_0x4d4f('0x19'));var utils=require(_0x4d4f('0x1a'));var config=require(_0x4d4f('0x1b'));var licenseUtil=require(_0x4d4f('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551a10,_0x5b4f4e){_0x5b4f4e=_0x5b4f4e||0xcc;return function(_0x15fe6a){if(_0x15fe6a){return _0x551a10[_0x4d4f('0x1d')](_0x5b4f4e);}return _0x551a10['status'](_0x5b4f4e)[_0x4d4f('0x1e')]();};}function respondWithResult(_0x301380,_0x1878b6){_0x1878b6=_0x1878b6||0xc8;return function(_0x59252c){if(_0x59252c){return _0x301380[_0x4d4f('0x1f')](_0x1878b6)[_0x4d4f('0x20')](_0x59252c);}};}function respondWithFilteredResult(_0x1a9173,_0x4a3364){return function(_0x59bfb5){if(_0x59bfb5){var _0x5e4ff5=typeof _0x4a3364[_0x4d4f('0x21')]===_0x4d4f('0x22')&&typeof _0x4a3364[_0x4d4f('0x23')]==='undefined';var _0x30b6b1=_0x59bfb5[_0x4d4f('0x24')];var _0x51dcf1=_0x5e4ff5?0x0:_0x4a3364['offset'];var _0x519501=_0x5e4ff5?_0x59bfb5['count']:_0x4a3364['offset']+_0x4a3364[_0x4d4f('0x23')];var _0x15100a;if(_0x519501>=_0x30b6b1){_0x519501=_0x30b6b1;_0x15100a=0xc8;}else{_0x15100a=0xce;}_0x1a9173[_0x4d4f('0x1f')](_0x15100a);return _0x1a9173[_0x4d4f('0x25')]('Content-Range',_0x51dcf1+'-'+_0x519501+'/'+_0x30b6b1)['json'](_0x59bfb5);}return null;};}function patchUpdates(_0x1e1ae2){return function(_0x4dd360){try{jsonpatch[_0x4d4f('0x26')](_0x4dd360,_0x1e1ae2,!![]);}catch(_0x1e3e9a){return BPromise[_0x4d4f('0x27')](_0x1e3e9a);}return _0x4dd360[_0x4d4f('0x28')]();};}function saveUpdates(_0x3dd36a,_0x5beab4){return function(_0x570520){if(_0x570520){return _0x570520[_0x4d4f('0x29')](_0x3dd36a)['then'](function(_0x247077){return _0x247077;});}return null;};}function removeEntity(_0x3d5d93,_0x2d2fb3){return function(_0x3f4a55){if(_0x3f4a55){return _0x3f4a55[_0x4d4f('0x2a')]()['then'](function(){_0x3d5d93[_0x4d4f('0x1f')](0xcc)[_0x4d4f('0x1e')]();});}};}function handleEntityNotFound(_0x1cf365,_0x28443b){return function(_0x5cf9e7){if(!_0x5cf9e7){_0x1cf365['sendStatus'](0x194);}return _0x5cf9e7;};}function handleError(_0x141245,_0xd51604){_0xd51604=_0xd51604||0x1f4;return function(_0xa2492c){logger[_0x4d4f('0x2b')](_0xa2492c['stack']);if(_0xa2492c[_0x4d4f('0x2c')]){delete _0xa2492c[_0x4d4f('0x2c')];}_0x141245[_0x4d4f('0x1f')](_0xd51604)[_0x4d4f('0x2d')](_0xa2492c);};}exports['index']=function(_0x338ba2,_0x51cb3d){var _0x1688bb={},_0x333a40={},_0x550040={'count':0x0,'rows':[]};var _0x2768f1=_[_0x4d4f('0x2e')](db[_0x4d4f('0x2f')][_0x4d4f('0x30')],function(_0x19a502){return{'name':_0x19a502[_0x4d4f('0x31')],'type':_0x19a502['type'][_0x4d4f('0x32')]};});_0x333a40[_0x4d4f('0x33')]=_[_0x4d4f('0x2e')](_0x2768f1,_0x4d4f('0x2c'));_0x333a40[_0x4d4f('0x34')]=_['keys'](_0x338ba2[_0x4d4f('0x34')]);_0x333a40['filters']=_[_0x4d4f('0x35')](_0x333a40['model'],_0x333a40['query']);_0x1688bb['attributes']=_[_0x4d4f('0x35')](_0x333a40['model'],qs[_0x4d4f('0x36')](_0x338ba2[_0x4d4f('0x34')][_0x4d4f('0x36')]));_0x1688bb['attributes']=_0x1688bb[_0x4d4f('0x37')][_0x4d4f('0x38')]?_0x1688bb[_0x4d4f('0x37')]:_0x333a40['model'];if(!_0x338ba2[_0x4d4f('0x34')]['hasOwnProperty'](_0x4d4f('0x39'))){_0x1688bb[_0x4d4f('0x23')]=qs[_0x4d4f('0x23')](_0x338ba2[_0x4d4f('0x34')][_0x4d4f('0x23')]);_0x1688bb[_0x4d4f('0x21')]=qs[_0x4d4f('0x21')](_0x338ba2[_0x4d4f('0x34')]['offset']);}_0x1688bb['order']=qs[_0x4d4f('0x3a')](_0x338ba2['query']['sort']);_0x1688bb[_0x4d4f('0x3b')]=qs[_0x4d4f('0x3c')](_[_0x4d4f('0x3d')](_0x338ba2[_0x4d4f('0x34')],_0x333a40[_0x4d4f('0x3c')]),_0x2768f1);if(_0x338ba2['query'][_0x4d4f('0x3e')]){_0x1688bb[_0x4d4f('0x3b')]=_['merge'](_0x1688bb[_0x4d4f('0x3b')],{'$or':_[_0x4d4f('0x2e')](_0x2768f1,function(_0x336625){if(_0x336625[_0x4d4f('0x3f')]!==_0x4d4f('0x40')){var _0x19ebfe={};_0x19ebfe[_0x336625[_0x4d4f('0x2c')]]={'$like':'%'+_0x338ba2[_0x4d4f('0x34')][_0x4d4f('0x3e')]+'%'};return _0x19ebfe;}})});}_0x1688bb=_['merge']({},_0x1688bb,_0x338ba2['options']);var _0x1cb919={'where':_0x1688bb[_0x4d4f('0x3b')]};return db[_0x4d4f('0x2f')][_0x4d4f('0x24')](_0x1cb919)['then'](function(_0x5764cb){_0x550040[_0x4d4f('0x24')]=_0x5764cb;if(_0x338ba2[_0x4d4f('0x34')]['includeAll']){_0x1688bb['include']=[{'all':!![]}];}return db[_0x4d4f('0x2f')][_0x4d4f('0x41')](_0x1688bb);})['then'](function(_0x949a6d){_0x550040[_0x4d4f('0x42')]=_0x949a6d;return _0x550040;})[_0x4d4f('0x43')](respondWithFilteredResult(_0x51cb3d,_0x1688bb))[_0x4d4f('0x44')](handleError(_0x51cb3d,null));};exports[_0x4d4f('0x45')]=function(_0x587e6e,_0x2b274e){var _0x4c7c24={'raw':!![],'where':{'id':_0x587e6e[_0x4d4f('0x46')]['id']}},_0x45a0c1={};_0x45a0c1['model']=_[_0x4d4f('0x47')](db[_0x4d4f('0x2f')][_0x4d4f('0x30')]);_0x45a0c1['query']=_[_0x4d4f('0x47')](_0x587e6e['query']);_0x45a0c1[_0x4d4f('0x3c')]=_['intersection'](_0x45a0c1[_0x4d4f('0x33')],_0x45a0c1[_0x4d4f('0x34')]);_0x4c7c24[_0x4d4f('0x37')]=_[_0x4d4f('0x35')](_0x45a0c1[_0x4d4f('0x33')],qs['fields'](_0x587e6e['query'][_0x4d4f('0x36')]));_0x4c7c24[_0x4d4f('0x37')]=_0x4c7c24[_0x4d4f('0x37')][_0x4d4f('0x38')]?_0x4c7c24['attributes']:_0x45a0c1['model'];if(_0x587e6e['query'][_0x4d4f('0x48')]){_0x4c7c24[_0x4d4f('0x49')]=[{'all':!![]}];}_0x4c7c24=_[_0x4d4f('0x4a')]({},_0x4c7c24,_0x587e6e[_0x4d4f('0x4b')]);return db[_0x4d4f('0x2f')][_0x4d4f('0x4c')](_0x4c7c24)[_0x4d4f('0x43')](handleEntityNotFound(_0x2b274e,null))[_0x4d4f('0x43')](respondWithResult(_0x2b274e,null))[_0x4d4f('0x44')](handleError(_0x2b274e,null));};exports[_0x4d4f('0x4d')]=function(_0x37745d,_0x1c290b){return db['WhatsappQueueReport'][_0x4d4f('0x4d')](_0x37745d[_0x4d4f('0x4e')],{})['then'](respondWithResult(_0x1c290b,0xc9))[_0x4d4f('0x44')](handleError(_0x1c290b,null));};exports['update']=function(_0x15cf38,_0x401466){if(_0x15cf38['body']['id']){delete _0x15cf38[_0x4d4f('0x4e')]['id'];}return db[_0x4d4f('0x2f')][_0x4d4f('0x4c')]({'where':{'id':_0x15cf38[_0x4d4f('0x46')]['id']}})[_0x4d4f('0x43')](handleEntityNotFound(_0x401466,null))[_0x4d4f('0x43')](saveUpdates(_0x15cf38[_0x4d4f('0x4e')],null))[_0x4d4f('0x43')](respondWithResult(_0x401466,null))[_0x4d4f('0x44')](handleError(_0x401466,null));};exports[_0x4d4f('0x2a')]=function(_0xa6cef,_0x3a21a6){return db['WhatsappQueueReport'][_0x4d4f('0x4c')]({'where':{'id':_0xa6cef['params']['id']}})['then'](handleEntityNotFound(_0x3a21a6,null))['then'](removeEntity(_0x3a21a6,null))[_0x4d4f('0x44')](handleError(_0x3a21a6,null));};exports[_0x4d4f('0x4f')]=function(_0x487212,_0x5f3252){return db[_0x4d4f('0x2f')][_0x4d4f('0x4f')]()['then'](respondWithResult(_0x5f3252,null))[_0x4d4f('0x44')](handleError(_0x5f3252,null));}; \ No newline at end of file +var _0x1399=['rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','params','keys','find','catch','body','destroy','describe','eml-format'];(function(_0x35ae6c,_0x4183e9){var _0x49fffb=function(_0x5ecfa2){while(--_0x5ecfa2){_0x35ae6c['push'](_0x35ae6c['shift']());}};_0x49fffb(++_0x4183e9);}(_0x1399,0x16c));var _0x9139=function(_0x4fb164,_0x4c4cf5){_0x4fb164=_0x4fb164-0x0;var _0x12a90e=_0x1399[_0x4fb164];return _0x12a90e;};'use strict';var emlformat=require(_0x9139('0x0'));var rimraf=require(_0x9139('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9139('0x2'));var rp=require('request-promise');var moment=require(_0x9139('0x3'));var BPromise=require(_0x9139('0x4'));var Mustache=require(_0x9139('0x5'));var util=require(_0x9139('0x6'));var path=require(_0x9139('0x7'));var sox=require(_0x9139('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9139('0x9'));var _=require(_0x9139('0xa'));var squel=require(_0x9139('0xb'));var crypto=require('crypto');var jsforce=require(_0x9139('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9139('0xd'));var Papa=require(_0x9139('0xe'));var Redis=require('ioredis');var authService=require(_0x9139('0xf'));var qs=require(_0x9139('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9139('0x11'))(_0x9139('0x12'));var utils=require(_0x9139('0x13'));var config=require(_0x9139('0x14'));var licenseUtil=require(_0x9139('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52b32d,_0x511ec9){_0x511ec9=_0x511ec9||0xcc;return function(_0x417637){if(_0x417637){return _0x52b32d['sendStatus'](_0x511ec9);}return _0x52b32d[_0x9139('0x16')](_0x511ec9)[_0x9139('0x17')]();};}function respondWithResult(_0x375ada,_0x262009){_0x262009=_0x262009||0xc8;return function(_0x5936d2){if(_0x5936d2){return _0x375ada[_0x9139('0x16')](_0x262009)['json'](_0x5936d2);}};}function respondWithFilteredResult(_0x58307f,_0x52c57b){return function(_0x159e50){if(_0x159e50){var _0x3e2bad=typeof _0x52c57b[_0x9139('0x18')]===_0x9139('0x19')&&typeof _0x52c57b[_0x9139('0x1a')]===_0x9139('0x19');var _0x4bd957=_0x159e50['count'];var _0x13cab8=_0x3e2bad?0x0:_0x52c57b[_0x9139('0x18')];var _0x5e0a59=_0x3e2bad?_0x159e50['count']:_0x52c57b[_0x9139('0x18')]+_0x52c57b[_0x9139('0x1a')];var _0x56add4;if(_0x5e0a59>=_0x4bd957){_0x5e0a59=_0x4bd957;_0x56add4=0xc8;}else{_0x56add4=0xce;}_0x58307f[_0x9139('0x16')](_0x56add4);return _0x58307f[_0x9139('0x1b')](_0x9139('0x1c'),_0x13cab8+'-'+_0x5e0a59+'/'+_0x4bd957)[_0x9139('0x1d')](_0x159e50);}return null;};}function patchUpdates(_0xd2eb33){return function(_0x6f901b){try{jsonpatch[_0x9139('0x1e')](_0x6f901b,_0xd2eb33,!![]);}catch(_0x45fa16){return BPromise[_0x9139('0x1f')](_0x45fa16);}return _0x6f901b[_0x9139('0x20')]();};}function saveUpdates(_0x1bac18,_0x269f8a){return function(_0x5a3e2e){if(_0x5a3e2e){return _0x5a3e2e[_0x9139('0x21')](_0x1bac18)[_0x9139('0x22')](function(_0x31635a){return _0x31635a;});}return null;};}function removeEntity(_0x1aee3b,_0x934732){return function(_0x1a7350){if(_0x1a7350){return _0x1a7350['destroy']()[_0x9139('0x22')](function(){_0x1aee3b[_0x9139('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ed4da,_0x2ee4bb){return function(_0x10bfa0){if(!_0x10bfa0){_0x3ed4da['sendStatus'](0x194);}return _0x10bfa0;};}function handleError(_0x4118dc,_0xffd487){_0xffd487=_0xffd487||0x1f4;return function(_0x49d01e){logger[_0x9139('0x23')](_0x49d01e[_0x9139('0x24')]);if(_0x49d01e[_0x9139('0x25')]){delete _0x49d01e['name'];}_0x4118dc[_0x9139('0x16')](_0xffd487)[_0x9139('0x26')](_0x49d01e);};}exports[_0x9139('0x27')]=function(_0x22994c,_0x215194){var _0x16dfb4={},_0xfe6854={},_0x573a05={'count':0x0,'rows':[]};var _0x55cc6a=_[_0x9139('0x28')](db[_0x9139('0x29')][_0x9139('0x2a')],function(_0x4c1693){return{'name':_0x4c1693['fieldName'],'type':_0x4c1693[_0x9139('0x2b')][_0x9139('0x2c')]};});_0xfe6854[_0x9139('0x2d')]=_[_0x9139('0x28')](_0x55cc6a,_0x9139('0x25'));_0xfe6854['query']=_['keys'](_0x22994c[_0x9139('0x2e')]);_0xfe6854['filters']=_['intersection'](_0xfe6854[_0x9139('0x2d')],_0xfe6854[_0x9139('0x2e')]);_0x16dfb4['attributes']=_[_0x9139('0x2f')](_0xfe6854[_0x9139('0x2d')],qs['fields'](_0x22994c[_0x9139('0x2e')][_0x9139('0x30')]));_0x16dfb4[_0x9139('0x31')]=_0x16dfb4[_0x9139('0x31')][_0x9139('0x32')]?_0x16dfb4[_0x9139('0x31')]:_0xfe6854[_0x9139('0x2d')];if(!_0x22994c[_0x9139('0x2e')][_0x9139('0x33')](_0x9139('0x34'))){_0x16dfb4[_0x9139('0x1a')]=qs['limit'](_0x22994c[_0x9139('0x2e')][_0x9139('0x1a')]);_0x16dfb4['offset']=qs[_0x9139('0x18')](_0x22994c[_0x9139('0x2e')][_0x9139('0x18')]);}_0x16dfb4['order']=qs[_0x9139('0x35')](_0x22994c[_0x9139('0x2e')][_0x9139('0x35')]);_0x16dfb4[_0x9139('0x36')]=qs[_0x9139('0x37')](_[_0x9139('0x38')](_0x22994c[_0x9139('0x2e')],_0xfe6854[_0x9139('0x37')]),_0x55cc6a);if(_0x22994c[_0x9139('0x2e')][_0x9139('0x39')]){_0x16dfb4['where']=_[_0x9139('0x3a')](_0x16dfb4[_0x9139('0x36')],{'$or':_[_0x9139('0x28')](_0x55cc6a,function(_0x2cebb9){if(_0x2cebb9[_0x9139('0x2b')]!==_0x9139('0x3b')){var _0x1ea313={};_0x1ea313[_0x2cebb9['name']]={'$like':'%'+_0x22994c[_0x9139('0x2e')]['filter']+'%'};return _0x1ea313;}})});}_0x16dfb4=_[_0x9139('0x3a')]({},_0x16dfb4,_0x22994c[_0x9139('0x3c')]);var _0x3fb4db={'where':_0x16dfb4['where']};return db[_0x9139('0x29')][_0x9139('0x3d')](_0x3fb4db)[_0x9139('0x22')](function(_0x236513){_0x573a05[_0x9139('0x3d')]=_0x236513;if(_0x22994c[_0x9139('0x2e')][_0x9139('0x3e')]){_0x16dfb4[_0x9139('0x3f')]=[{'all':!![]}];}return db[_0x9139('0x29')][_0x9139('0x40')](_0x16dfb4);})['then'](function(_0xf14393){_0x573a05[_0x9139('0x41')]=_0xf14393;return _0x573a05;})[_0x9139('0x22')](respondWithFilteredResult(_0x215194,_0x16dfb4))['catch'](handleError(_0x215194,null));};exports['show']=function(_0x4d9670,_0x465f49){var _0x12ba4b={'raw':!![],'where':{'id':_0x4d9670[_0x9139('0x42')]['id']}},_0x3611b4={};_0x3611b4[_0x9139('0x2d')]=_['keys'](db[_0x9139('0x29')][_0x9139('0x2a')]);_0x3611b4[_0x9139('0x2e')]=_[_0x9139('0x43')](_0x4d9670[_0x9139('0x2e')]);_0x3611b4['filters']=_[_0x9139('0x2f')](_0x3611b4[_0x9139('0x2d')],_0x3611b4[_0x9139('0x2e')]);_0x12ba4b[_0x9139('0x31')]=_['intersection'](_0x3611b4['model'],qs[_0x9139('0x30')](_0x4d9670[_0x9139('0x2e')]['fields']));_0x12ba4b['attributes']=_0x12ba4b[_0x9139('0x31')][_0x9139('0x32')]?_0x12ba4b['attributes']:_0x3611b4[_0x9139('0x2d')];if(_0x4d9670[_0x9139('0x2e')]['includeAll']){_0x12ba4b[_0x9139('0x3f')]=[{'all':!![]}];}_0x12ba4b=_['merge']({},_0x12ba4b,_0x4d9670['options']);return db[_0x9139('0x29')][_0x9139('0x44')](_0x12ba4b)[_0x9139('0x22')](handleEntityNotFound(_0x465f49,null))[_0x9139('0x22')](respondWithResult(_0x465f49,null))[_0x9139('0x45')](handleError(_0x465f49,null));};exports['create']=function(_0x3e126c,_0xc55b16){return db[_0x9139('0x29')]['create'](_0x3e126c[_0x9139('0x46')],{})[_0x9139('0x22')](respondWithResult(_0xc55b16,0xc9))[_0x9139('0x45')](handleError(_0xc55b16,null));};exports[_0x9139('0x21')]=function(_0x215793,_0x31395f){if(_0x215793[_0x9139('0x46')]['id']){delete _0x215793[_0x9139('0x46')]['id'];}return db[_0x9139('0x29')][_0x9139('0x44')]({'where':{'id':_0x215793[_0x9139('0x42')]['id']}})['then'](handleEntityNotFound(_0x31395f,null))[_0x9139('0x22')](saveUpdates(_0x215793[_0x9139('0x46')],null))[_0x9139('0x22')](respondWithResult(_0x31395f,null))['catch'](handleError(_0x31395f,null));};exports[_0x9139('0x47')]=function(_0x46f77a,_0x557c93){return db[_0x9139('0x29')][_0x9139('0x44')]({'where':{'id':_0x46f77a[_0x9139('0x42')]['id']}})['then'](handleEntityNotFound(_0x557c93,null))[_0x9139('0x22')](removeEntity(_0x557c93,null))[_0x9139('0x45')](handleError(_0x557c93,null));};exports[_0x9139('0x48')]=function(_0x23669b,_0x51ecf6){return db[_0x9139('0x29')][_0x9139('0x48')]()[_0x9139('0x22')](respondWithResult(_0x51ecf6,null))['catch'](handleError(_0x51ecf6,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 237da77..84cf14c 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 _0xebb9=['WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports'];(function(_0x3de4f8,_0x336c7d){var _0x3d81fc=function(_0x53b9f9){while(--_0x53b9f9){_0x3de4f8['push'](_0x3de4f8['shift']());}};_0x3d81fc(++_0x336c7d);}(_0xebb9,0xed));var _0x9ebb=function(_0x29586d,_0xdb79f0){_0x29586d=_0x29586d-0x0;var _0x2dd375=_0xebb9[_0x29586d];return _0x2dd375;};'use strict';var _=require(_0x9ebb('0x0'));var util=require(_0x9ebb('0x1'));var logger=require('../../config/logger')(_0x9ebb('0x2'));var moment=require(_0x9ebb('0x3'));var BPromise=require(_0x9ebb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ebb('0x5'));var rimraf=require(_0x9ebb('0x6'));var config=require(_0x9ebb('0x7'));var attributes=require(_0x9ebb('0x8'));module[_0x9ebb('0x9')]=function(_0x2173b1,_0x10370d){return _0x2173b1['define'](_0x9ebb('0xa'),attributes,{'tableName':_0x9ebb('0xb'),'paranoid':![],'indexes':[{'name':_0x9ebb('0xc'),'fields':[_0x9ebb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfc55=['uniqueid','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue'];(function(_0x586061,_0x322fc3){var _0x8e84f6=function(_0xaf67b7){while(--_0xaf67b7){_0x586061['push'](_0x586061['shift']());}};_0x8e84f6(++_0x322fc3);}(_0xfc55,0x1da));var _0x5fc5=function(_0x4e026b,_0x1630bd){_0x4e026b=_0x4e026b-0x0;var _0x55bc23=_0xfc55[_0x4e026b];return _0x55bc23;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5fc5('0x0'))('api');var moment=require('moment');var BPromise=require(_0x5fc5('0x1'));var rp=require(_0x5fc5('0x2'));var fs=require('fs');var path=require(_0x5fc5('0x3'));var rimraf=require(_0x5fc5('0x4'));var config=require(_0x5fc5('0x5'));var attributes=require(_0x5fc5('0x6'));module[_0x5fc5('0x7')]=function(_0x574ece,_0x399a14){return _0x574ece[_0x5fc5('0x8')]('WhatsappQueueReport',attributes,{'tableName':_0x5fc5('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5fc5('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 0122b03..2ae150f 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 _0xb5d3=['body','options','raw','debug','UpdateWhatsappQueueReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create'];(function(_0x2f093e,_0x6f9c5c){var _0x592677=function(_0xac6a7a){while(--_0xac6a7a){_0x2f093e['push'](_0x2f093e['shift']());}};_0x592677(++_0x6f9c5c);}(_0xb5d3,0xce));var _0x3b5d=function(_0x419550,_0x15cdf1){_0x419550=_0x419550-0x0;var _0x55f9ef=_0xb5d3[_0x419550];return _0x55f9ef;};'use strict';var _=require(_0x3b5d('0x0'));var util=require(_0x3b5d('0x1'));var moment=require(_0x3b5d('0x2'));var BPromise=require(_0x3b5d('0x3'));var rs=require(_0x3b5d('0x4'));var fs=require('fs');var Redis=require(_0x3b5d('0x5'));var db=require(_0x3b5d('0x6'))['db'];var utils=require(_0x3b5d('0x7'));var logger=require(_0x3b5d('0x8'))(_0x3b5d('0x9'));var config=require(_0x3b5d('0xa'));var jayson=require(_0x3b5d('0xb'));var client=jayson['client'][_0x3b5d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1aad08,_0x1f0d5c,_0x567a29){return new BPromise(function(_0x103aa5,_0xd2e616){return client['request'](_0x1aad08,_0x567a29)[_0x3b5d('0xd')](function(_0x4230e5){logger[_0x3b5d('0xe')](_0x3b5d('0xf'),_0x1f0d5c,'request\x20sent');logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x1f0d5c,_0x3b5d('0x10'),JSON[_0x3b5d('0x11')](_0x4230e5));if(_0x4230e5[_0x3b5d('0x12')]){if(_0x4230e5[_0x3b5d('0x12')]['code']===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x1f0d5c,_0x4230e5[_0x3b5d('0x12')][_0x3b5d('0x13')]);return _0xd2e616(_0x4230e5['error']['message']);}logger['error'](_0x3b5d('0xf'),_0x1f0d5c,_0x4230e5[_0x3b5d('0x12')][_0x3b5d('0x13')]);return _0x103aa5(_0x4230e5[_0x3b5d('0x12')]['message']);}else{logger[_0x3b5d('0xe')](_0x3b5d('0xf'),_0x1f0d5c,_0x3b5d('0x10'));_0x103aa5(_0x4230e5[_0x3b5d('0x14')][_0x3b5d('0x13')]);}})[_0x3b5d('0x15')](function(_0x5cb306){logger[_0x3b5d('0x12')](_0x3b5d('0xf'),_0x1f0d5c,_0x5cb306);_0xd2e616(_0x5cb306);});});}exports[_0x3b5d('0x16')]=function(_0x12c7b4){var _0x4daad6=this;return new Promise(function(_0x8d1b07,_0x5ddf3c){return db[_0x3b5d('0x17')][_0x3b5d('0x18')](_0x12c7b4[_0x3b5d('0x19')],{'raw':_0x12c7b4[_0x3b5d('0x1a')]?_0x12c7b4[_0x3b5d('0x1a')][_0x3b5d('0x1b')]===undefined?!![]:![]:!![]})[_0x3b5d('0xd')](function(_0x12a6b8){logger['info'](_0x3b5d('0x16'),_0x12c7b4);logger[_0x3b5d('0x1c')]('CreateWhatsappQueueReport',_0x12c7b4,JSON[_0x3b5d('0x11')](_0x12a6b8));_0x8d1b07(_0x12a6b8);})[_0x3b5d('0x15')](function(_0x450b52){logger[_0x3b5d('0x12')](_0x3b5d('0x16'),_0x450b52[_0x3b5d('0x13')],_0x12c7b4);_0x5ddf3c(_0x4daad6[_0x3b5d('0x12')](0x1f4,_0x450b52[_0x3b5d('0x13')]));});});};exports[_0x3b5d('0x1d')]=function(_0x3898cc){var _0x51efed=this;return new Promise(function(_0x53cd4c,_0x415f5a){return db[_0x3b5d('0x17')][_0x3b5d('0x1e')](_0x3898cc[_0x3b5d('0x19')],{'raw':_0x3898cc[_0x3b5d('0x1a')]?_0x3898cc[_0x3b5d('0x1a')][_0x3b5d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3898cc[_0x3b5d('0x1a')]?_0x3898cc['options'][_0x3b5d('0x1f')]||null:null,'attributes':_0x3898cc[_0x3b5d('0x1a')]?_0x3898cc['options']['attributes']||null:null,'limit':_0x3898cc[_0x3b5d('0x1a')]?_0x3898cc['options'][_0x3b5d('0x20')]||null:null})['then'](function(_0x33abd2){logger[_0x3b5d('0xe')](_0x3b5d('0x1d'),_0x3898cc);logger[_0x3b5d('0x1c')](_0x3b5d('0x1d'),_0x3898cc,JSON[_0x3b5d('0x11')](_0x33abd2));_0x53cd4c(_0x33abd2);})[_0x3b5d('0x15')](function(_0x1a6981){logger[_0x3b5d('0x12')](_0x3b5d('0x1d'),_0x1a6981[_0x3b5d('0x13')],_0x3898cc);_0x415f5a(_0x51efed['error'](0x1f4,_0x1a6981[_0x3b5d('0x13')]));});});}; \ No newline at end of file +var _0xa4a5=['jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','WhatsappQueueReport','create','body','options','then','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x40f4cc,_0x432f55){var _0x458315=function(_0xcfda5e){while(--_0xcfda5e){_0x40f4cc['push'](_0x40f4cc['shift']());}};_0x458315(++_0x432f55);}(_0xa4a5,0xc8));var _0x5a4a=function(_0x2a0e5a,_0x227573){_0x2a0e5a=_0x2a0e5a-0x0;var _0x5b1d8f=_0xa4a5[_0x2a0e5a];return _0x5b1d8f;};'use strict';var _=require(_0x5a4a('0x0'));var util=require(_0x5a4a('0x1'));var moment=require(_0x5a4a('0x2'));var BPromise=require(_0x5a4a('0x3'));var rs=require(_0x5a4a('0x4'));var fs=require('fs');var Redis=require(_0x5a4a('0x5'));var db=require(_0x5a4a('0x6'))['db'];var utils=require(_0x5a4a('0x7'));var logger=require(_0x5a4a('0x8'))('rpc');var config=require(_0x5a4a('0x9'));var jayson=require(_0x5a4a('0xa'));var client=jayson[_0x5a4a('0xb')][_0x5a4a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x371151,_0x4293db,_0x4c2057){return new BPromise(function(_0x23d297,_0x4e141b){return client[_0x5a4a('0xd')](_0x371151,_0x4c2057)['then'](function(_0x182e73){logger[_0x5a4a('0xe')](_0x5a4a('0xf'),_0x4293db,_0x5a4a('0x10'));logger[_0x5a4a('0x11')](_0x5a4a('0x12'),_0x4293db,_0x5a4a('0x10'),JSON[_0x5a4a('0x13')](_0x182e73));if(_0x182e73[_0x5a4a('0x14')]){if(_0x182e73[_0x5a4a('0x14')][_0x5a4a('0x15')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x4293db,_0x182e73[_0x5a4a('0x14')][_0x5a4a('0x16')]);return _0x4e141b(_0x182e73[_0x5a4a('0x14')][_0x5a4a('0x16')]);}logger['error'](_0x5a4a('0xf'),_0x4293db,_0x182e73['error'][_0x5a4a('0x16')]);return _0x23d297(_0x182e73[_0x5a4a('0x14')][_0x5a4a('0x16')]);}else{logger['info'](_0x5a4a('0xf'),_0x4293db,_0x5a4a('0x10'));_0x23d297(_0x182e73['result']['message']);}})[_0x5a4a('0x17')](function(_0x4c4c99){logger[_0x5a4a('0x14')](_0x5a4a('0xf'),_0x4293db,_0x4c4c99);_0x4e141b(_0x4c4c99);});});}exports['CreateWhatsappQueueReport']=function(_0x206862){var _0x167067=this;return new Promise(function(_0x61d5cf,_0x12fda1){return db[_0x5a4a('0x18')][_0x5a4a('0x19')](_0x206862[_0x5a4a('0x1a')],{'raw':_0x206862['options']?_0x206862[_0x5a4a('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x5a4a('0x1c')](function(_0x3bde74){logger[_0x5a4a('0xe')](_0x5a4a('0x1d'),_0x206862);logger[_0x5a4a('0x11')](_0x5a4a('0x1d'),_0x206862,JSON[_0x5a4a('0x13')](_0x3bde74));_0x61d5cf(_0x3bde74);})['catch'](function(_0x356a85){logger[_0x5a4a('0x14')](_0x5a4a('0x1d'),_0x356a85[_0x5a4a('0x16')],_0x206862);_0x12fda1(_0x167067[_0x5a4a('0x14')](0x1f4,_0x356a85['message']));});});};exports[_0x5a4a('0x1e')]=function(_0x311d11){var _0x5261e8=this;return new Promise(function(_0x3bd2a1,_0x5e7c1a){return db[_0x5a4a('0x18')][_0x5a4a('0x1f')](_0x311d11['body'],{'raw':_0x311d11['options']?_0x311d11[_0x5a4a('0x1b')][_0x5a4a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x311d11[_0x5a4a('0x1b')]?_0x311d11['options'][_0x5a4a('0x21')]||null:null,'attributes':_0x311d11['options']?_0x311d11['options']['attributes']||null:null,'limit':_0x311d11[_0x5a4a('0x1b')]?_0x311d11[_0x5a4a('0x1b')][_0x5a4a('0x22')]||null:null})[_0x5a4a('0x1c')](function(_0x8c6067){logger[_0x5a4a('0xe')](_0x5a4a('0x1e'),_0x311d11);logger[_0x5a4a('0x11')](_0x5a4a('0x1e'),_0x311d11,JSON['stringify'](_0x8c6067));_0x3bd2a1(_0x8c6067);})[_0x5a4a('0x17')](function(_0x4d1ef0){logger['error']('UpdateWhatsappQueueReport',_0x4d1ef0['message'],_0x311d11);_0x5e7c1a(_0x5261e8[_0x5a4a('0x14')](0x1f4,_0x4d1ef0['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 8bb31e7..6ef9a51 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 _0x2dc3=['create','put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0xfce4d6,_0x3057b2){var _0x7189fb=function(_0x330950){while(--_0x330950){_0xfce4d6['push'](_0xfce4d6['shift']());}};_0x7189fb(++_0x3057b2);}(_0x2dc3,0x194));var _0x32dc=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x2dc3[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x32dc('0x0'));var util=require(_0x32dc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x32dc('0x2'));var router=express[_0x32dc('0x3')]();var fs_extra=require(_0x32dc('0x4'));var auth=require(_0x32dc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x32dc('0x6'));var controller=require(_0x32dc('0x7'));router[_0x32dc('0x8')]('/',auth[_0x32dc('0x9')](),controller[_0x32dc('0xa')]);router['get'](_0x32dc('0xb'),auth[_0x32dc('0x9')](),controller[_0x32dc('0xc')]);router[_0x32dc('0x8')](_0x32dc('0xd'),auth[_0x32dc('0x9')](),controller[_0x32dc('0xe')]);router[_0x32dc('0xf')]('/',auth[_0x32dc('0x9')](),controller[_0x32dc('0x10')]);router[_0x32dc('0x11')]('/:id',auth[_0x32dc('0x9')](),controller['update']);router[_0x32dc('0x12')](_0x32dc('0xd'),auth[_0x32dc('0x9')](),controller[_0x32dc('0x13')]);module[_0x32dc('0x14')]=router; \ No newline at end of file +var _0x2057=['../../components/interaction/service','./whatsappTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','post','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x32ca06,_0x45d192){var _0x3d309d=function(_0x32d6aa){while(--_0x32d6aa){_0x32ca06['push'](_0x32ca06['shift']());}};_0x3d309d(++_0x45d192);}(_0x2057,0xfd));var _0x7205=function(_0x184f61,_0x277759){_0x184f61=_0x184f61-0x0;var _0x4ef140=_0x2057[_0x184f61];return _0x4ef140;};'use strict';var multer=require(_0x7205('0x0'));var util=require(_0x7205('0x1'));var path=require('path');var timeout=require(_0x7205('0x2'));var express=require(_0x7205('0x3'));var router=express[_0x7205('0x4')]();var fs_extra=require(_0x7205('0x5'));var auth=require(_0x7205('0x6'));var interaction=require(_0x7205('0x7'));var config=require('../../config/environment');var controller=require(_0x7205('0x8'));router['get']('/',auth[_0x7205('0x9')](),controller[_0x7205('0xa')]);router[_0x7205('0xb')]('/describe',auth[_0x7205('0x9')](),controller[_0x7205('0xc')]);router[_0x7205('0xb')](_0x7205('0xd'),auth[_0x7205('0x9')](),controller[_0x7205('0xe')]);router[_0x7205('0xf')]('/',auth[_0x7205('0x9')](),controller['create']);router[_0x7205('0x10')](_0x7205('0xd'),auth[_0x7205('0x9')](),controller[_0x7205('0x11')]);router['delete'](_0x7205('0xd'),auth[_0x7205('0x9')](),controller[_0x7205('0x12')]);module[_0x7205('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index c9ee426..39722a9 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 _0x4f3c=['ENUM','account','agent','queue','DATE','sequelize','exports','STRING'];(function(_0x3f5730,_0x374aa1){var _0x116624=function(_0xba2dca){while(--_0xba2dca){_0x3f5730['push'](_0x3f5730['shift']());}};_0x116624(++_0x374aa1);}(_0x4f3c,0x15d));var _0xc4f3=function(_0xca1f0e,_0x2713d5){_0xca1f0e=_0xca1f0e-0x0;var _0x35e4ef=_0x4f3c[_0xca1f0e];return _0x35e4ef;};'use strict';var Sequelize=require(_0xc4f3('0x0'));module[_0xc4f3('0x1')]={'uniqueid':{'type':Sequelize[_0xc4f3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc4f3('0x3')](_0xc4f3('0x4'),_0xc4f3('0x5'),_0xc4f3('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xc4f3('0x7')]}}; \ No newline at end of file +var _0x7033=['DATE','sequelize','exports','STRING','ENUM','agent','queue'];(function(_0x49ed67,_0x290989){var _0x1523d5=function(_0x34a179){while(--_0x34a179){_0x49ed67['push'](_0x49ed67['shift']());}};_0x1523d5(++_0x290989);}(_0x7033,0x19e));var _0x3703=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x7033[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0x3703('0x0'));module[_0x3703('0x1')]={'uniqueid':{'type':Sequelize[_0x3703('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3703('0x3')]('account',_0x3703('0x4'),_0x3703('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x3703('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 5377f89..27ff208 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 _0x0e16=['body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','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','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','WhatsappTransferReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','keys','length','find','create'];(function(_0x4ae5d3,_0x3f65fe){var _0x38bb02=function(_0x2b12f8){while(--_0x2b12f8){_0x4ae5d3['push'](_0x4ae5d3['shift']());}};_0x38bb02(++_0x3f65fe);}(_0x0e16,0x183));var _0x60e1=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x0e16[_0x2f3848];return _0x102668;};'use strict';var emlformat=require(_0x60e1('0x0'));var rimraf=require(_0x60e1('0x1'));var zipdir=require(_0x60e1('0x2'));var jsonpatch=require(_0x60e1('0x3'));var rp=require(_0x60e1('0x4'));var moment=require(_0x60e1('0x5'));var BPromise=require(_0x60e1('0x6'));var Mustache=require(_0x60e1('0x7'));var util=require(_0x60e1('0x8'));var path=require(_0x60e1('0x9'));var sox=require(_0x60e1('0xa'));var csv=require(_0x60e1('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x60e1('0xc'));var _=require('lodash');var squel=require(_0x60e1('0xd'));var crypto=require(_0x60e1('0xe'));var jsforce=require(_0x60e1('0xf'));var deskjs=require(_0x60e1('0x10'));var toCsv=require(_0x60e1('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x60e1('0x11'));var authService=require(_0x60e1('0x12'));var qs=require(_0x60e1('0x13'));var as=require(_0x60e1('0x14'));var hardwareService=require(_0x60e1('0x15'));var logger=require(_0x60e1('0x16'))(_0x60e1('0x17'));var utils=require(_0x60e1('0x18'));var config=require(_0x60e1('0x19'));var licenseUtil=require(_0x60e1('0x1a'));var db=require(_0x60e1('0x1b'))['db'];function respondWithStatusCode(_0x28bcb0,_0x5d1b0d){_0x5d1b0d=_0x5d1b0d||0xcc;return function(_0x2e0b46){if(_0x2e0b46){return _0x28bcb0[_0x60e1('0x1c')](_0x5d1b0d);}return _0x28bcb0[_0x60e1('0x1d')](_0x5d1b0d)[_0x60e1('0x1e')]();};}function respondWithResult(_0x21d47f,_0x5ed831){_0x5ed831=_0x5ed831||0xc8;return function(_0x179941){if(_0x179941){return _0x21d47f['status'](_0x5ed831)[_0x60e1('0x1f')](_0x179941);}};}function respondWithFilteredResult(_0x5979cc,_0x43b094){return function(_0x1e782b){if(_0x1e782b){var _0x4813e1=typeof _0x43b094[_0x60e1('0x20')]===_0x60e1('0x21')&&typeof _0x43b094[_0x60e1('0x22')]===_0x60e1('0x21');var _0x360bc3=_0x1e782b['count'];var _0x47cfc2=_0x4813e1?0x0:_0x43b094[_0x60e1('0x20')];var _0x49a74a=_0x4813e1?_0x1e782b['count']:_0x43b094[_0x60e1('0x20')]+_0x43b094['limit'];var _0x52bfa0;if(_0x49a74a>=_0x360bc3){_0x49a74a=_0x360bc3;_0x52bfa0=0xc8;}else{_0x52bfa0=0xce;}_0x5979cc[_0x60e1('0x1d')](_0x52bfa0);return _0x5979cc['set'](_0x60e1('0x23'),_0x47cfc2+'-'+_0x49a74a+'/'+_0x360bc3)[_0x60e1('0x1f')](_0x1e782b);}return null;};}function patchUpdates(_0x49caf3){return function(_0x9f7502){try{jsonpatch[_0x60e1('0x24')](_0x9f7502,_0x49caf3,!![]);}catch(_0x405fba){return BPromise[_0x60e1('0x25')](_0x405fba);}return _0x9f7502[_0x60e1('0x26')]();};}function saveUpdates(_0x5cb387,_0x13bd53){return function(_0x5bccda){if(_0x5bccda){return _0x5bccda['update'](_0x5cb387)[_0x60e1('0x27')](function(_0x119ab4){return _0x119ab4;});}return null;};}function removeEntity(_0x3dbf81,_0x3e86d7){return function(_0x12d09a){if(_0x12d09a){return _0x12d09a[_0x60e1('0x28')]()[_0x60e1('0x27')](function(){_0x3dbf81[_0x60e1('0x1d')](0xcc)[_0x60e1('0x1e')]();});}};}function handleEntityNotFound(_0x3b1d86,_0x297733){return function(_0x2565a2){if(!_0x2565a2){_0x3b1d86['sendStatus'](0x194);}return _0x2565a2;};}function handleError(_0x437a92,_0x3fef77){_0x3fef77=_0x3fef77||0x1f4;return function(_0x58a907){logger[_0x60e1('0x29')](_0x58a907[_0x60e1('0x2a')]);if(_0x58a907[_0x60e1('0x2b')]){delete _0x58a907[_0x60e1('0x2b')];}_0x437a92[_0x60e1('0x1d')](_0x3fef77)[_0x60e1('0x2c')](_0x58a907);};}exports['index']=function(_0x48527d,_0x17defe){var _0x10e528={},_0x3ce477={},_0x217a83={'count':0x0,'rows':[]};var _0x52629f=_[_0x60e1('0x2d')](db[_0x60e1('0x2e')][_0x60e1('0x2f')],function(_0x1fc948){return{'name':_0x1fc948['fieldName'],'type':_0x1fc948['type'][_0x60e1('0x30')]};});_0x3ce477[_0x60e1('0x31')]=_[_0x60e1('0x2d')](_0x52629f,_0x60e1('0x2b'));_0x3ce477[_0x60e1('0x32')]=_['keys'](_0x48527d[_0x60e1('0x32')]);_0x3ce477[_0x60e1('0x33')]=_[_0x60e1('0x34')](_0x3ce477[_0x60e1('0x31')],_0x3ce477[_0x60e1('0x32')]);_0x10e528[_0x60e1('0x35')]=_[_0x60e1('0x34')](_0x3ce477[_0x60e1('0x31')],qs[_0x60e1('0x36')](_0x48527d['query'][_0x60e1('0x36')]));_0x10e528[_0x60e1('0x35')]=_0x10e528['attributes']['length']?_0x10e528[_0x60e1('0x35')]:_0x3ce477[_0x60e1('0x31')];if(!_0x48527d[_0x60e1('0x32')]['hasOwnProperty'](_0x60e1('0x37'))){_0x10e528[_0x60e1('0x22')]=qs[_0x60e1('0x22')](_0x48527d[_0x60e1('0x32')][_0x60e1('0x22')]);_0x10e528[_0x60e1('0x20')]=qs[_0x60e1('0x20')](_0x48527d[_0x60e1('0x32')][_0x60e1('0x20')]);}_0x10e528[_0x60e1('0x38')]=qs[_0x60e1('0x39')](_0x48527d[_0x60e1('0x32')][_0x60e1('0x39')]);_0x10e528[_0x60e1('0x3a')]=qs['filters'](_[_0x60e1('0x3b')](_0x48527d[_0x60e1('0x32')],_0x3ce477[_0x60e1('0x33')]),_0x52629f);if(_0x48527d[_0x60e1('0x32')][_0x60e1('0x3c')]){_0x10e528[_0x60e1('0x3a')]=_[_0x60e1('0x3d')](_0x10e528[_0x60e1('0x3a')],{'$or':_['map'](_0x52629f,function(_0x20cd9f){if(_0x20cd9f['type']!==_0x60e1('0x3e')){var _0x244c61={};_0x244c61[_0x20cd9f['name']]={'$like':'%'+_0x48527d[_0x60e1('0x32')]['filter']+'%'};return _0x244c61;}})});}_0x10e528=_[_0x60e1('0x3d')]({},_0x10e528,_0x48527d[_0x60e1('0x3f')]);var _0x26bcac={'where':_0x10e528[_0x60e1('0x3a')]};return db[_0x60e1('0x2e')][_0x60e1('0x40')](_0x26bcac)['then'](function(_0x3610f5){_0x217a83['count']=_0x3610f5;if(_0x48527d[_0x60e1('0x32')][_0x60e1('0x41')]){_0x10e528[_0x60e1('0x42')]=[{'all':!![]}];}return db[_0x60e1('0x2e')][_0x60e1('0x43')](_0x10e528);})[_0x60e1('0x27')](function(_0x401780){_0x217a83['rows']=_0x401780;return _0x217a83;})[_0x60e1('0x27')](respondWithFilteredResult(_0x17defe,_0x10e528))[_0x60e1('0x44')](handleError(_0x17defe,null));};exports[_0x60e1('0x45')]=function(_0x4692a9,_0x403ea9){var _0x4d2871={'raw':!![],'where':{'id':_0x4692a9[_0x60e1('0x46')]['id']}},_0x127ee3={};_0x127ee3[_0x60e1('0x31')]=_[_0x60e1('0x47')](db[_0x60e1('0x2e')]['rawAttributes']);_0x127ee3[_0x60e1('0x32')]=_[_0x60e1('0x47')](_0x4692a9[_0x60e1('0x32')]);_0x127ee3[_0x60e1('0x33')]=_[_0x60e1('0x34')](_0x127ee3[_0x60e1('0x31')],_0x127ee3['query']);_0x4d2871[_0x60e1('0x35')]=_[_0x60e1('0x34')](_0x127ee3[_0x60e1('0x31')],qs['fields'](_0x4692a9[_0x60e1('0x32')]['fields']));_0x4d2871[_0x60e1('0x35')]=_0x4d2871[_0x60e1('0x35')][_0x60e1('0x48')]?_0x4d2871[_0x60e1('0x35')]:_0x127ee3[_0x60e1('0x31')];if(_0x4692a9[_0x60e1('0x32')][_0x60e1('0x41')]){_0x4d2871[_0x60e1('0x42')]=[{'all':!![]}];}_0x4d2871=_[_0x60e1('0x3d')]({},_0x4d2871,_0x4692a9[_0x60e1('0x3f')]);return db[_0x60e1('0x2e')][_0x60e1('0x49')](_0x4d2871)[_0x60e1('0x27')](handleEntityNotFound(_0x403ea9,null))[_0x60e1('0x27')](respondWithResult(_0x403ea9,null))['catch'](handleError(_0x403ea9,null));};exports['create']=function(_0x224fda,_0x5b30d0){return db[_0x60e1('0x2e')][_0x60e1('0x4a')](_0x224fda['body'],{})[_0x60e1('0x27')](respondWithResult(_0x5b30d0,0xc9))[_0x60e1('0x44')](handleError(_0x5b30d0,null));};exports['update']=function(_0x2fd6b1,_0x78899a){if(_0x2fd6b1[_0x60e1('0x4b')]['id']){delete _0x2fd6b1['body']['id'];}return db[_0x60e1('0x2e')][_0x60e1('0x49')]({'where':{'id':_0x2fd6b1[_0x60e1('0x46')]['id']}})[_0x60e1('0x27')](handleEntityNotFound(_0x78899a,null))[_0x60e1('0x27')](saveUpdates(_0x2fd6b1[_0x60e1('0x4b')],null))[_0x60e1('0x27')](respondWithResult(_0x78899a,null))[_0x60e1('0x44')](handleError(_0x78899a,null));};exports['destroy']=function(_0x4a5135,_0x871b30){return db[_0x60e1('0x2e')]['find']({'where':{'id':_0x4a5135[_0x60e1('0x46')]['id']}})[_0x60e1('0x27')](handleEntityNotFound(_0x871b30,null))[_0x60e1('0x27')](removeEntity(_0x871b30,null))['catch'](handleError(_0x871b30,null));};exports['describe']=function(_0xeaeac5,_0x38abae){return db[_0x60e1('0x2e')][_0x60e1('0x4c')]()[_0x60e1('0x27')](respondWithResult(_0x38abae,null))[_0x60e1('0x44')](handleError(_0x38abae,null));}; \ No newline at end of file +var _0xb73b=['rawAttributes','filters','include','find','catch','create','body','describe','eml-format','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','update','then','destroy','end','stack','name','send','index','map','WhatsappTransferReport','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params'];(function(_0x4f0eb4,_0x3eddf1){var _0x37bc8f=function(_0x4f49db){while(--_0x4f49db){_0x4f0eb4['push'](_0x4f0eb4['shift']());}};_0x37bc8f(++_0x3eddf1);}(_0xb73b,0x1eb));var _0xbb73=function(_0x5281c2,_0xcf8747){_0x5281c2=_0x5281c2-0x0;var _0x3ab30e=_0xb73b[_0x5281c2];return _0x3ab30e;};'use strict';var emlformat=require(_0xbb73('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbb73('0x1'));var rp=require('request-promise');var moment=require(_0xbb73('0x2'));var BPromise=require(_0xbb73('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbb73('0x4'));var sox=require(_0xbb73('0x5'));var csv=require(_0xbb73('0x6'));var ejs=require(_0xbb73('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb73('0x8'));var squel=require(_0xbb73('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbb73('0xa'));var toCsv=require(_0xbb73('0x6'));var querystring=require('querystring');var Papa=require(_0xbb73('0xb'));var Redis=require(_0xbb73('0xc'));var authService=require(_0xbb73('0xd'));var qs=require(_0xbb73('0xe'));var as=require(_0xbb73('0xf'));var hardwareService=require(_0xbb73('0x10'));var logger=require(_0xbb73('0x11'))(_0xbb73('0x12'));var utils=require(_0xbb73('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbb73('0x14'))['db'];function respondWithStatusCode(_0x2a14f4,_0xc31c5a){_0xc31c5a=_0xc31c5a||0xcc;return function(_0x1f23d4){if(_0x1f23d4){return _0x2a14f4[_0xbb73('0x15')](_0xc31c5a);}return _0x2a14f4['status'](_0xc31c5a)['end']();};}function respondWithResult(_0x570efc,_0x4433f7){_0x4433f7=_0x4433f7||0xc8;return function(_0x49eba4){if(_0x49eba4){return _0x570efc[_0xbb73('0x16')](_0x4433f7)[_0xbb73('0x17')](_0x49eba4);}};}function respondWithFilteredResult(_0x3d19e3,_0xcb4f80){return function(_0xc69e0a){if(_0xc69e0a){var _0x49ac87=typeof _0xcb4f80['offset']===_0xbb73('0x18')&&typeof _0xcb4f80[_0xbb73('0x19')]===_0xbb73('0x18');var _0x11319a=_0xc69e0a[_0xbb73('0x1a')];var _0x4c5c85=_0x49ac87?0x0:_0xcb4f80['offset'];var _0x8a53d2=_0x49ac87?_0xc69e0a[_0xbb73('0x1a')]:_0xcb4f80[_0xbb73('0x1b')]+_0xcb4f80[_0xbb73('0x19')];var _0x2f005a;if(_0x8a53d2>=_0x11319a){_0x8a53d2=_0x11319a;_0x2f005a=0xc8;}else{_0x2f005a=0xce;}_0x3d19e3['status'](_0x2f005a);return _0x3d19e3['set'](_0xbb73('0x1c'),_0x4c5c85+'-'+_0x8a53d2+'/'+_0x11319a)[_0xbb73('0x17')](_0xc69e0a);}return null;};}function patchUpdates(_0x1ee141){return function(_0x27c243){try{jsonpatch[_0xbb73('0x1d')](_0x27c243,_0x1ee141,!![]);}catch(_0x3e3c28){return BPromise['reject'](_0x3e3c28);}return _0x27c243['save']();};}function saveUpdates(_0x108ce4,_0x2de2af){return function(_0x45edbf){if(_0x45edbf){return _0x45edbf[_0xbb73('0x1e')](_0x108ce4)[_0xbb73('0x1f')](function(_0x7db11b){return _0x7db11b;});}return null;};}function removeEntity(_0x10af0c,_0x3a46be){return function(_0x1622a4){if(_0x1622a4){return _0x1622a4[_0xbb73('0x20')]()[_0xbb73('0x1f')](function(){_0x10af0c['status'](0xcc)[_0xbb73('0x21')]();});}};}function handleEntityNotFound(_0x2d3577,_0x5a8f20){return function(_0x5a3cf){if(!_0x5a3cf){_0x2d3577[_0xbb73('0x15')](0x194);}return _0x5a3cf;};}function handleError(_0x962a55,_0xb4fa65){_0xb4fa65=_0xb4fa65||0x1f4;return function(_0xdd1c46){logger['error'](_0xdd1c46[_0xbb73('0x22')]);if(_0xdd1c46[_0xbb73('0x23')]){delete _0xdd1c46[_0xbb73('0x23')];}_0x962a55[_0xbb73('0x16')](_0xb4fa65)[_0xbb73('0x24')](_0xdd1c46);};}exports[_0xbb73('0x25')]=function(_0x5cdb2f,_0x25684b){var _0x2b87a1={},_0xee0b4f={},_0x522668={'count':0x0,'rows':[]};var _0x1d5cf8=_[_0xbb73('0x26')](db[_0xbb73('0x27')]['rawAttributes'],function(_0x87aa74){return{'name':_0x87aa74[_0xbb73('0x28')],'type':_0x87aa74[_0xbb73('0x29')]['key']};});_0xee0b4f[_0xbb73('0x2a')]=_['map'](_0x1d5cf8,_0xbb73('0x23'));_0xee0b4f[_0xbb73('0x2b')]=_[_0xbb73('0x2c')](_0x5cdb2f[_0xbb73('0x2b')]);_0xee0b4f['filters']=_[_0xbb73('0x2d')](_0xee0b4f[_0xbb73('0x2a')],_0xee0b4f[_0xbb73('0x2b')]);_0x2b87a1[_0xbb73('0x2e')]=_[_0xbb73('0x2d')](_0xee0b4f[_0xbb73('0x2a')],qs[_0xbb73('0x2f')](_0x5cdb2f[_0xbb73('0x2b')][_0xbb73('0x2f')]));_0x2b87a1[_0xbb73('0x2e')]=_0x2b87a1[_0xbb73('0x2e')][_0xbb73('0x30')]?_0x2b87a1['attributes']:_0xee0b4f['model'];if(!_0x5cdb2f[_0xbb73('0x2b')][_0xbb73('0x31')]('nolimit')){_0x2b87a1['limit']=qs[_0xbb73('0x19')](_0x5cdb2f['query'][_0xbb73('0x19')]);_0x2b87a1[_0xbb73('0x1b')]=qs[_0xbb73('0x1b')](_0x5cdb2f[_0xbb73('0x2b')][_0xbb73('0x1b')]);}_0x2b87a1[_0xbb73('0x32')]=qs['sort'](_0x5cdb2f[_0xbb73('0x2b')][_0xbb73('0x33')]);_0x2b87a1[_0xbb73('0x34')]=qs['filters'](_['pick'](_0x5cdb2f[_0xbb73('0x2b')],_0xee0b4f['filters']),_0x1d5cf8);if(_0x5cdb2f[_0xbb73('0x2b')][_0xbb73('0x35')]){_0x2b87a1[_0xbb73('0x34')]=_[_0xbb73('0x36')](_0x2b87a1[_0xbb73('0x34')],{'$or':_['map'](_0x1d5cf8,function(_0x4129e7){if(_0x4129e7[_0xbb73('0x29')]!==_0xbb73('0x37')){var _0x384d61={};_0x384d61[_0x4129e7['name']]={'$like':'%'+_0x5cdb2f['query'][_0xbb73('0x35')]+'%'};return _0x384d61;}})});}_0x2b87a1=_[_0xbb73('0x36')]({},_0x2b87a1,_0x5cdb2f[_0xbb73('0x38')]);var _0x1592b6={'where':_0x2b87a1[_0xbb73('0x34')]};return db[_0xbb73('0x27')][_0xbb73('0x1a')](_0x1592b6)['then'](function(_0x14db35){_0x522668['count']=_0x14db35;if(_0x5cdb2f[_0xbb73('0x2b')][_0xbb73('0x39')]){_0x2b87a1['include']=[{'all':!![]}];}return db[_0xbb73('0x27')][_0xbb73('0x3a')](_0x2b87a1);})[_0xbb73('0x1f')](function(_0x5554b4){_0x522668[_0xbb73('0x3b')]=_0x5554b4;return _0x522668;})[_0xbb73('0x1f')](respondWithFilteredResult(_0x25684b,_0x2b87a1))['catch'](handleError(_0x25684b,null));};exports['show']=function(_0x26b12a,_0x43afb6){var _0x48789f={'raw':!![],'where':{'id':_0x26b12a[_0xbb73('0x3c')]['id']}},_0x248480={};_0x248480[_0xbb73('0x2a')]=_[_0xbb73('0x2c')](db['WhatsappTransferReport'][_0xbb73('0x3d')]);_0x248480['query']=_[_0xbb73('0x2c')](_0x26b12a[_0xbb73('0x2b')]);_0x248480[_0xbb73('0x3e')]=_[_0xbb73('0x2d')](_0x248480[_0xbb73('0x2a')],_0x248480[_0xbb73('0x2b')]);_0x48789f[_0xbb73('0x2e')]=_[_0xbb73('0x2d')](_0x248480[_0xbb73('0x2a')],qs[_0xbb73('0x2f')](_0x26b12a[_0xbb73('0x2b')][_0xbb73('0x2f')]));_0x48789f['attributes']=_0x48789f[_0xbb73('0x2e')]['length']?_0x48789f['attributes']:_0x248480[_0xbb73('0x2a')];if(_0x26b12a[_0xbb73('0x2b')]['includeAll']){_0x48789f[_0xbb73('0x3f')]=[{'all':!![]}];}_0x48789f=_['merge']({},_0x48789f,_0x26b12a['options']);return db[_0xbb73('0x27')][_0xbb73('0x40')](_0x48789f)['then'](handleEntityNotFound(_0x43afb6,null))[_0xbb73('0x1f')](respondWithResult(_0x43afb6,null))[_0xbb73('0x41')](handleError(_0x43afb6,null));};exports[_0xbb73('0x42')]=function(_0xf33e9d,_0x527bd9){return db[_0xbb73('0x27')]['create'](_0xf33e9d['body'],{})[_0xbb73('0x1f')](respondWithResult(_0x527bd9,0xc9))[_0xbb73('0x41')](handleError(_0x527bd9,null));};exports['update']=function(_0x30b297,_0x249672){if(_0x30b297[_0xbb73('0x43')]['id']){delete _0x30b297['body']['id'];}return db[_0xbb73('0x27')][_0xbb73('0x40')]({'where':{'id':_0x30b297[_0xbb73('0x3c')]['id']}})[_0xbb73('0x1f')](handleEntityNotFound(_0x249672,null))['then'](saveUpdates(_0x30b297[_0xbb73('0x43')],null))[_0xbb73('0x1f')](respondWithResult(_0x249672,null))[_0xbb73('0x41')](handleError(_0x249672,null));};exports[_0xbb73('0x20')]=function(_0x36c64d,_0x44a0f7){return db['WhatsappTransferReport'][_0xbb73('0x40')]({'where':{'id':_0x36c64d[_0xbb73('0x3c')]['id']}})[_0xbb73('0x1f')](handleEntityNotFound(_0x44a0f7,null))['then'](removeEntity(_0x44a0f7,null))['catch'](handleError(_0x44a0f7,null));};exports[_0xbb73('0x44')]=function(_0x5d792b,_0x5a9bfb){return db[_0xbb73('0x27')][_0xbb73('0x44')]()[_0xbb73('0x1f')](respondWithResult(_0x5a9bfb,null))[_0xbb73('0x41')](handleError(_0x5a9bfb,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index a837d5f..c0e8c5e 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 _0xf445=['report_whatsapp_transfer','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','define'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xf445,0x176));var _0x5f44=function(_0x36d25e,_0x1a047d){_0x36d25e=_0x36d25e-0x0;var _0x4b95b8=_0xf445[_0x36d25e];return _0x4b95b8;};'use strict';var _=require('lodash');var util=require(_0x5f44('0x0'));var logger=require('../../config/logger')(_0x5f44('0x1'));var moment=require(_0x5f44('0x2'));var BPromise=require(_0x5f44('0x3'));var rp=require(_0x5f44('0x4'));var fs=require('fs');var path=require(_0x5f44('0x5'));var rimraf=require(_0x5f44('0x6'));var config=require(_0x5f44('0x7'));var attributes=require(_0x5f44('0x8'));module['exports']=function(_0x4d8258,_0x36972e){return _0x4d8258[_0x5f44('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x5f44('0xa'),'paranoid':![],'indexes':[{'name':_0x5f44('0xb'),'fields':[_0x5f44('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf3bf=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','uniqueid','lodash','util'];(function(_0x53b394,_0x48e582){var _0x1e464f=function(_0x450470){while(--_0x450470){_0x53b394['push'](_0x53b394['shift']());}};_0x1e464f(++_0x48e582);}(_0xf3bf,0xfd));var _0xff3b=function(_0x5a8ee3,_0x5576e7){_0x5a8ee3=_0x5a8ee3-0x0;var _0x5c6ce2=_0xf3bf[_0x5a8ee3];return _0x5c6ce2;};'use strict';var _=require(_0xff3b('0x0'));var util=require(_0xff3b('0x1'));var logger=require(_0xff3b('0x2'))(_0xff3b('0x3'));var moment=require(_0xff3b('0x4'));var BPromise=require(_0xff3b('0x5'));var rp=require(_0xff3b('0x6'));var fs=require('fs');var path=require(_0xff3b('0x7'));var rimraf=require(_0xff3b('0x8'));var config=require(_0xff3b('0x9'));var attributes=require(_0xff3b('0xa'));module[_0xff3b('0xb')]=function(_0x1742de,_0x450799){return _0x1742de[_0xff3b('0xc')](_0xff3b('0xd'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xff3b('0xe'),'fields':[_0xff3b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index b6fc991..91692a5 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 _0xf7f4=['message','info','result','catch','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2b4448,_0x5bcc69){var _0xb4b465=function(_0x5ac741){while(--_0x5ac741){_0x2b4448['push'](_0x2b4448['shift']());}};_0xb4b465(++_0x5bcc69);}(_0xf7f4,0x68));var _0x4f7f=function(_0x5602b9,_0x5d5592){_0x5602b9=_0x5602b9-0x0;var _0x54fbda=_0xf7f4[_0x5602b9];return _0x54fbda;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4f7f('0x0'));var rs=require(_0x4f7f('0x1'));var fs=require('fs');var Redis=require(_0x4f7f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f7f('0x3'));var logger=require('../../config/logger')(_0x4f7f('0x4'));var config=require(_0x4f7f('0x5'));var jayson=require(_0x4f7f('0x6'));var client=jayson[_0x4f7f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x459f3d,_0x3a3fd2,_0x58bc57){return new BPromise(function(_0x177923,_0x24ba8d){return client[_0x4f7f('0x8')](_0x459f3d,_0x58bc57)[_0x4f7f('0x9')](function(_0x452366){logger['info'](_0x4f7f('0xa'),_0x3a3fd2,_0x4f7f('0xb'));logger[_0x4f7f('0xc')](_0x4f7f('0xd'),_0x3a3fd2,_0x4f7f('0xb'),JSON['stringify'](_0x452366));if(_0x452366[_0x4f7f('0xe')]){if(_0x452366['error'][_0x4f7f('0xf')]===0x1f4){logger['error'](_0x4f7f('0xa'),_0x3a3fd2,_0x452366[_0x4f7f('0xe')][_0x4f7f('0x10')]);return _0x24ba8d(_0x452366[_0x4f7f('0xe')][_0x4f7f('0x10')]);}logger['error'](_0x4f7f('0xa'),_0x3a3fd2,_0x452366[_0x4f7f('0xe')]['message']);return _0x177923(_0x452366['error'][_0x4f7f('0x10')]);}else{logger[_0x4f7f('0x11')](_0x4f7f('0xa'),_0x3a3fd2,_0x4f7f('0xb'));_0x177923(_0x452366[_0x4f7f('0x12')][_0x4f7f('0x10')]);}})[_0x4f7f('0x13')](function(_0x1fa79f){logger['error'](_0x4f7f('0xa'),_0x3a3fd2,_0x1fa79f);_0x24ba8d(_0x1fa79f);});});} \ No newline at end of file +var _0xaa1b=['catch','lodash','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x1137ac,_0x353892){var _0x2ac89b=function(_0x36993a){while(--_0x36993a){_0x1137ac['push'](_0x1137ac['shift']());}};_0x2ac89b(++_0x353892);}(_0xaa1b,0x1c9));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbaa1('0x0'));var util=require('util');var moment=require(_0xbaa1('0x1'));var BPromise=require(_0xbaa1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbaa1('0x3'));var logger=require(_0xbaa1('0x4'))('rpc');var config=require(_0xbaa1('0x5'));var jayson=require(_0xbaa1('0x6'));var client=jayson[_0xbaa1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c8704,_0x35b520,_0x11eafa){return new BPromise(function(_0x24ff27,_0x985d41){return client[_0xbaa1('0x8')](_0x2c8704,_0x11eafa)[_0xbaa1('0x9')](function(_0x332faf){logger['info'](_0xbaa1('0xa'),_0x35b520,_0xbaa1('0xb'));logger[_0xbaa1('0xc')](_0xbaa1('0xd'),_0x35b520,_0xbaa1('0xb'),JSON[_0xbaa1('0xe')](_0x332faf));if(_0x332faf[_0xbaa1('0xf')]){if(_0x332faf[_0xbaa1('0xf')]['code']===0x1f4){logger[_0xbaa1('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x35b520,_0x332faf[_0xbaa1('0xf')][_0xbaa1('0x10')]);return _0x985d41(_0x332faf[_0xbaa1('0xf')][_0xbaa1('0x10')]);}logger['error'](_0xbaa1('0xa'),_0x35b520,_0x332faf[_0xbaa1('0xf')][_0xbaa1('0x10')]);return _0x24ff27(_0x332faf['error'][_0xbaa1('0x10')]);}else{logger[_0xbaa1('0x11')](_0xbaa1('0xa'),_0x35b520,_0xbaa1('0xb'));_0x24ff27(_0x332faf['result'][_0xbaa1('0x10')]);}})[_0xbaa1('0x12')](function(_0x2d4985){logger[_0xbaa1('0xf')](_0xbaa1('0xa'),_0x35b520,_0x2d4985);_0x985d41(_0x2d4985);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 5058931..b3be970 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf1c6=['exit','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','then','seedDB','default','listen','info','start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xf1c6,0x145));var _0x6f1c=function(_0x3f00ab,_0x18edd4){_0x3f00ab=_0x3f00ab-0x0;var _0x2d4f57=_0xf1c6[_0x3f00ab];return _0x2d4f57;};'use strict';var _=require('lodash');var db=require('./mysqldb')['db'];var seedDb=require(_0x6f1c('0x0'));var checkLicense=require(_0x6f1c('0x1'));var rpc=require(_0x6f1c('0x2'));var config=require(_0x6f1c('0x3'));var logger=require(_0x6f1c('0x4'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0x6f1c('0x5'));var schedule=require('./config/schedule');var chat=require(_0x6f1c('0x6'));var whatsapp=require(_0x6f1c('0x7'));var transcribe=require(_0x6f1c('0x8'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x6f1c('0x9')]['sync']()[_0x6f1c('0xa')](function(){if(config[_0x6f1c('0xb')]){return seedDb[_0x6f1c('0xc')]();}})['then'](function(){return checkLicense[_0x6f1c('0xc')]();})['then'](function(){return rpc[_0x6f1c('0xd')]();})[_0x6f1c('0xa')](function(_0x5777a0){logger[_0x6f1c('0xe')](_0x5777a0);return chat[_0x6f1c('0xf')]();})['then'](function(){return whatsapp['start']();})['then'](function(){return schedule['start']();})[_0x6f1c('0xa')](function(){return transcribe['start']();})['then'](function(){return provider['start']();})['then'](function(_0x56e776){logger[_0x6f1c('0xe')](_0x56e776);return pm2[_0x6f1c('0xf')](pm2Config);})[_0x6f1c('0xa')](function(_0x5549d1){var _0x82203a=_0x5549d1[_0x6f1c('0x10')](function(_0x4547a7){return typeof _0x4547a7['exitCode']===_0x6f1c('0x11')&&_0x4547a7[_0x6f1c('0x12')]>=0x0;});if(_0x82203a['length']>0x0){throw new Error(_0x82203a[_0x6f1c('0x13')]+_0x6f1c('0x14')+_[_0x6f1c('0x15')](_0x82203a,function(_0x6e2d39){return'\x22'+_0x6e2d39[_0x6f1c('0x16')][_0x6f1c('0x17')]+'\x22';}));}logger['info'](_0x6f1c('0x18'),_[_0x6f1c('0x15')](_[_0x6f1c('0x10')](_0x5549d1,{'status':_0x6f1c('0x19')}),_0x6f1c('0x17'))[_0x6f1c('0x1a')]());logger['info']('Offline\x20apps:',_['map'](_[_0x6f1c('0x10')](_0x5549d1,function(_0x5d5df9){return _0x5d5df9[_0x6f1c('0x1b')]!=='online';}),_0x6f1c('0x17'))[_0x6f1c('0x1a')]()||_0x6f1c('0x1c'));console[_0x6f1c('0x1d')](_0x6f1c('0x1e'));})[_0x6f1c('0x1f')](function(_0xbcd9e7){console[_0x6f1c('0x1d')](_0x6f1c('0x20'),_0xbcd9e7);logger[_0x6f1c('0x21')](_0x6f1c('0x22'),_0xbcd9e7);process[_0x6f1c('0x23')](0x1);});}main(); \ No newline at end of file +var _0xf8b2=['./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info','start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','Offline\x20apps:','online','join','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/schedule','./config/schedule/chat'];(function(_0x33e95d,_0x220962){var _0x2def25=function(_0x50fba6){while(--_0x50fba6){_0x33e95d['push'](_0x33e95d['shift']());}};_0x2def25(++_0x220962);}(_0xf8b2,0x15e));var _0x2f8b=function(_0x1ea8c0,_0x1b1409){_0x1ea8c0=_0x1ea8c0-0x0;var _0x2314ce=_0xf8b2[_0x1ea8c0];return _0x2314ce;};'use strict';var _=require(_0x2f8b('0x0'));var db=require(_0x2f8b('0x1'))['db'];var seedDb=require(_0x2f8b('0x2'));var checkLicense=require(_0x2f8b('0x3'));var rpc=require(_0x2f8b('0x4'));var config=require(_0x2f8b('0x5'));var logger=require(_0x2f8b('0x6'))(_0x2f8b('0x7'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0x2f8b('0x8'));var chat=require(_0x2f8b('0x9'));var whatsapp=require(_0x2f8b('0xa'));var transcribe=require(_0x2f8b('0xb'));var provider=require(_0x2f8b('0xc'));function main(){return db[_0x2f8b('0xd')][_0x2f8b('0xe')]()[_0x2f8b('0xf')](function(){if(config[_0x2f8b('0x10')]){return seedDb['default']();}})[_0x2f8b('0xf')](function(){return checkLicense[_0x2f8b('0x11')]();})[_0x2f8b('0xf')](function(){return rpc['listen']();})[_0x2f8b('0xf')](function(_0xed22c){logger[_0x2f8b('0x12')](_0xed22c);return chat['start']();})['then'](function(){return whatsapp[_0x2f8b('0x13')]();})[_0x2f8b('0xf')](function(){return schedule[_0x2f8b('0x13')]();})[_0x2f8b('0xf')](function(){return transcribe[_0x2f8b('0x13')]();})['then'](function(){return provider[_0x2f8b('0x13')]();})['then'](function(_0x40c097){logger[_0x2f8b('0x12')](_0x40c097);return pm2[_0x2f8b('0x13')](pm2Config);})[_0x2f8b('0xf')](function(_0xf9cbe0){var _0x19d5b3=_0xf9cbe0[_0x2f8b('0x14')](function(_0x2b6003){return typeof _0x2b6003['exitCode']===_0x2f8b('0x15')&&_0x2b6003[_0x2f8b('0x16')]>=0x0;});if(_0x19d5b3[_0x2f8b('0x17')]>0x0){throw new Error(_0x19d5b3[_0x2f8b('0x17')]+_0x2f8b('0x18')+_[_0x2f8b('0x19')](_0x19d5b3,function(_0x3d65ee){return'\x22'+_0x3d65ee[_0x2f8b('0x1a')][_0x2f8b('0x1b')]+'\x22';}));}logger['info'](_0x2f8b('0x1c'),_[_0x2f8b('0x19')](_[_0x2f8b('0x14')](_0xf9cbe0,{'status':'online'}),_0x2f8b('0x1b'))['join']());logger[_0x2f8b('0x12')](_0x2f8b('0x1d'),_[_0x2f8b('0x19')](_[_0x2f8b('0x14')](_0xf9cbe0,function(_0x3be6dc){return _0x3be6dc['status']!==_0x2f8b('0x1e');}),_0x2f8b('0x1b'))[_0x2f8b('0x1f')]()||_0x2f8b('0x20'));console[_0x2f8b('0x21')](_0x2f8b('0x22'));})[_0x2f8b('0x23')](function(_0x5cb36a){console[_0x2f8b('0x21')](_0x2f8b('0x24'),_0x5cb36a);logger[_0x2f8b('0x25')](_0x2f8b('0x26'),_0x5cb36a);process[_0x2f8b('0x27')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index c188833..05b9c62 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 _0xb43b=['headers','then','authenticate','pass','status','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','find','sub','allowedLoginAttempts','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','minutes','User\x20object\x20not\x20found.','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','apiKeyNonce','isNil','generateApiKey','apiKeyIat','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','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','unshift','encryptString','join','promisify','sign','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','crypto','moment','session','role','fullname','name','internal','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','allowmessenger','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarPrefixRequired','phoneBarRemoteControl','interface','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','whatsappAutoanswer','isChatInteractionAuthorized','use','ChatInteraction','findOne','params','closed','disposition','unmanaged','json','Forbidden.','catch','isAuthenticated','authorization','startsWith'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0xb43b,0x1b2));var _0xbb43=function(_0x40ff56,_0x5239ad){_0x40ff56=_0x40ff56-0x0;var _0x5f0cd9=_0xb43b[_0x40ff56];return _0x5f0cd9;};'use strict';var db=require(_0xbb43('0x0'))['db'];var config=require(_0xbb43('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xbb43('0x2'));var encryptor=require(_0xbb43('0x3'));var _=require(_0xbb43('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xbb43('0x5'));var compose=require(_0xbb43('0x6'));var basicAuth=require(_0xbb43('0x7'));var crypto=require(_0xbb43('0x8'));var BPromise=require('bluebird');var util=require('util');var moment=require(_0xbb43('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0xbb43('0xa')]});var userAttributes=['id',_0xbb43('0xb'),_0xbb43('0xc'),_0xbb43('0xd'),_0xbb43('0xe'),'email',_0xbb43('0xf'),_0xbb43('0x10'),'md5secret',_0xbb43('0x11'),_0xbb43('0x12'),_0xbb43('0x13'),_0xbb43('0x14'),_0xbb43('0x15'),_0xbb43('0x16'),'pauseType',_0xbb43('0x17'),_0xbb43('0x18'),'lastPauseAt','crudPermissions',_0xbb43('0x19'),'passwordResetAt','alias',_0xbb43('0x1a'),'phoneBarAutoAnswerDelay',_0xbb43('0x1b'),_0xbb43('0x1c'),'phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires',_0xbb43('0x1d'),_0xbb43('0x1e'),'phoneBarRemoteControlPort','hotdesk',_0xbb43('0x1f'),'userProfileId','privacyEnabled',_0xbb43('0x20'),_0xbb43('0x21'),_0xbb43('0x22'),'downloadOmnichannelInteractions',_0xbb43('0x23'),'ignorePauseForPreviewCalls',_0xbb43('0x24'),_0xbb43('0x25'),'chatAutoanswerDelay','emailAutoanswer',_0xbb43('0x26'),_0xbb43('0x27'),_0xbb43('0x28'),_0xbb43('0x29'),'openchannelAutoanswerDelay',_0xbb43('0x2a'),'faxAutoanswerDelay',_0xbb43('0x2b'),'whatsappAutoanswerDelay'];exports[_0xbb43('0x2c')]=function(){return this['isAuthenticated'](!![])[_0xbb43('0x2d')](function(_0x451cbd,_0x577ddd,_0x1d0768){if(_0x451cbd['user']){_0x1d0768();}else{return db[_0xbb43('0x2e')][_0xbb43('0x2f')]({'where':{'id':_0x451cbd[_0xbb43('0x30')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})['then'](function(_0x269ca5){if(_0x269ca5&&_0x269ca5[_0xbb43('0x31')]){return _0x577ddd['status'](_0x269ca5[_0xbb43('0x32')]===_0xbb43('0x33')?0x195:0x193)[_0xbb43('0x34')]({'message':_0x269ca5[_0xbb43('0x32')]==='unmanaged'?'Unmanaged.':_0xbb43('0x35')});}else{_0x1d0768();}})[_0xbb43('0x36')](function(_0xa88db0){_0x1d0768(_0xa88db0);});}});};exports[_0xbb43('0x37')]=function isAuthenticated(_0x510b05){return compose()[_0xbb43('0x2d')](function(_0x21d386,_0x473828,_0x539730){var _0x2ad6da;if(_0x21d386['headers'][_0xbb43('0x38')]){if(_[_0xbb43('0x39')](_0x21d386[_0xbb43('0x3a')][_0xbb43('0x38')],'Basic')){var _0x157d62=basicAuth(_0x21d386);db['User']['find']({'where':{'name':_0x157d62['name']}})[_0xbb43('0x3b')](function(_0x573a05){if(!_0x573a05||!_0x573a05[_0xbb43('0x3c')](_0x157d62[_0xbb43('0x3d')])){return _0x473828[_0xbb43('0x3e')](0x191)['json']({'message':_0xbb43('0x3f')});}_0x21d386[_0xbb43('0x40')]={'id':_0x573a05['id']};_0x539730();})[_0xbb43('0x36')](function(_0xd987fa){_0x539730(_0xd987fa);});}else if(_[_0xbb43('0x39')](_0x21d386[_0xbb43('0x3a')][_0xbb43('0x38')],_0xbb43('0x41'))){validateJwt(_0x21d386,_0x473828,_0x539730);}else{if(_0x510b05){_0x539730();}else{return _0x473828['status'](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x42')});}}}else if(_0x21d386[_0xbb43('0x43')][_0xbb43('0x44')]){try{var _0x4015ec={'audience':hardwareConf[_0xbb43('0x45')](),'issuer':hardwareConf[_0xbb43('0x45')]()};verifyJwt(_0x21d386[_0xbb43('0x43')][_0xbb43('0x44')],_0x4015ec)[_0xbb43('0x3b')](function(_0x21346a){return db[_0xbb43('0x46')][_0xbb43('0x47')]({'where':{'id':_0x21346a[_0xbb43('0x48')]}})[_0xbb43('0x3b')](function(_0x405f36){_0x2ad6da=_0x405f36;return db['Setting'][_0xbb43('0x2f')]({'where':{'id':0x1},'attributes':[_0xbb43('0x49'),'blockDuration'],'raw':!![]});})[_0xbb43('0x3b')](function(_0x2c9a7c){if(!_0x2ad6da||!_[_0xbb43('0x4a')](_0x2ad6da['apiKeyNonce'],_0x21346a['nonce'])){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4b')});}if(_0x2ad6da['disabled']){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4c')});}if(_0x2ad6da[_0xbb43('0x4d')]){if(_0x2c9a7c[_0xbb43('0x4e')]>0x0){if(moment(_0x2ad6da[_0xbb43('0x4f')])['add'](_0x2c9a7c[_0xbb43('0x4e')],_0xbb43('0x50'))>moment()){return _0x473828[_0xbb43('0x3e')](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4c')});}}else{return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x21d386[_0xbb43('0x40')]={'id':_0x2ad6da['id']};_0x539730();});})[_0xbb43('0x36')](function(){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1fcf64){_0x539730(_0x1fcf64);}}else if(_0x510b05){_0x539730();}else{return _0x473828[_0xbb43('0x3e')](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x42')});}})['use'](function(_0x3e0871,_0x136bd4,_0x59750b){if(_0x3e0871[_0xbb43('0x40')]){db['User'][_0xbb43('0x47')]({'where':{'id':_0x3e0871[_0xbb43('0x40')]['id']},'attributes':userAttributes})[_0xbb43('0x3b')](function(_0x14e57e){if(!_0x14e57e){return _0x136bd4[_0xbb43('0x3e')](0x194)[_0xbb43('0x34')]({'message':'User\x20not\x20found.'});}_0x3e0871[_0xbb43('0x40')]=_0x14e57e;_0x59750b();})['catch'](function(_0x307f1e){_0x59750b(_0x307f1e);});}else if(_0x510b05){_0x59750b();}else{return _0x136bd4[_0xbb43('0x3e')](0x194)[_0xbb43('0x34')]({'message':_0xbb43('0x51')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xbb43('0x2d')](function(_0x39f75f,_0x4bc351,_0x24ba15){return licenseUtil[_0xbb43('0x52')]()[_0xbb43('0x3b')](function(_0x40f519){if(_0x40f519[_0xbb43('0x53')]){_0x24ba15();}else{return _0x4bc351['status'](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x54')});}})['catch'](function(_0x1a66f0){_0x24ba15(_0x1a66f0);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x4d7034,_0x5e2e6d,_0x1c3482){return licenseUtil['getLicense']()[_0xbb43('0x3b')](function(_0x5e5c86){if(_0x5e5c86[_0xbb43('0x55')]){_0x1c3482();}else{return _0x5e2e6d[_0xbb43('0x3e')](0x193)[_0xbb43('0x34')]({'message':'Forbidden'});}})[_0xbb43('0x36')](function(_0x4d9f18){_0x1c3482(_0x4d9f18);});});};exports[_0xbb43('0x56')]=function(_0x2518bf,_0xd43d24,_0x29840e){_0x2518bf[_0xbb43('0x56')]=!![];return _0x29840e();};exports[_0xbb43('0x57')]=function signToken(_0x37d8d3){return signJwt(_0x37d8d3);};exports['setTokenCookie']=function(_0x93f6e7,_0x26ea59){if(!_0x93f6e7[_0xbb43('0x40')]){return _0x26ea59[_0xbb43('0x3e')](0x194)['json']({'message':_0xbb43('0x58')});}var _0x3233b7={'payload':{'id':_0x93f6e7[_0xbb43('0x40')]['id'],'role':_0x93f6e7[_0xbb43('0x40')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3233b7)[_0xbb43('0x3b')](function(_0x3fdb10){_0x26ea59[_0xbb43('0x59')]('motion.token',_0x3fdb10);_0x26ea59[_0xbb43('0x5a')](_0xbb43('0x5b'));})[_0xbb43('0x36')](function(_0x1dc40a){return _0x26ea59[_0xbb43('0x3e')](0x1f4)['send'](_0x1dc40a);});};exports['retrieveApiKey']=function(_0xb44557){if(_['isNil'](_0xb44557[_0xbb43('0x5c')])||_[_0xbb43('0x5d')](_0xb44557['apiKeyIat'])){return null;}else{return createJwt(_0xb44557);}};exports[_0xbb43('0x5e')]=function(_0x3719dc){_0x3719dc[_0xbb43('0x5c')]=generateNonce();_0x3719dc[_0xbb43('0x5f')]=generateIssuedAt();return createJwt(_0x3719dc);};exports[_0xbb43('0x60')]=function(_0x5cb3c6,_0x124f88){var _0x539ffc=_0x5cb3c6['query'][_0xbb43('0x44')];if(_0x539ffc){var _0x1b9307={'nonce':_0x124f88[_0xbb43('0x5c')],'iat':_0x124f88[_0xbb43('0x5f')],'audience':hardwareConf[_0xbb43('0x45')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x539ffc,_0x1b9307)['then'](function(){return generateApiKey(_0x124f88);});}else{throw{'message':_0xbb43('0x61')};}};exports[_0xbb43('0x62')]=function(_0x3a84ad){var _0x308646=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x308646[_0xbb43('0x63')](_0x3a84ad))throw new db[(_0xbb43('0x64'))][(_0xbb43('0x65'))](_0xbb43('0x66'));return;};exports[_0xbb43('0x67')]=function(_0x578b85,_0x1b6f96,_0xb996d7){var _0x432bd8=encryptor[_0xbb43('0x68')](_0x1b6f96)[_0xbb43('0x69')](',');for(var _0x1fae27=0x0;_0x1fae27<_0xb996d7;_0x1fae27++){if(!_0x432bd8[_0x1fae27])break;if(_0x578b85[_0xbb43('0x6a')]()===_0x432bd8[_0x1fae27][_0xbb43('0x6a')]()){var _0x3e01e4=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0xb996d7);if(_0xb996d7===0x1){_0x3e01e4=_0xbb43('0x6b');}throw new db[(_0xbb43('0x64'))][(_0xbb43('0x65'))](_0x3e01e4);}}return;};exports[_0xbb43('0x6c')]=function(_0x38814a,_0x19e27e){var _0x2e01fb=_0x19e27e?encryptor['decryptString'](_0x19e27e)[_0xbb43('0x69')](','):[];if(_0x2e01fb['length']===0x5){_0x2e01fb['splice'](-0x1,0x1);}_0x2e01fb[_0xbb43('0x6d')](_0x38814a);return encryptor[_0xbb43('0x6e')](_0x2e01fb[_0xbb43('0x6f')](','));};function signJwt(_0x22ce17){var _0x24393a=BPromise[_0xbb43('0x70')](jwt[_0xbb43('0x71')],{'context':jwt});var _0x341481=_0x22ce17['secret']||config['secrets'][_0xbb43('0xa')];return new BPromise(function(_0x2b96b8,_0x137e75){_0x24393a(_0x22ce17[_0xbb43('0x72')],_0x341481,_0x22ce17[_0xbb43('0x73')])[_0xbb43('0x3b')](function(_0x12717e){_0x2b96b8(_0x12717e);})[_0xbb43('0x36')](function(_0x3ca6ad){_0x137e75(_0x3ca6ad);});});}function verifyJwt(_0x555426,_0x165936,_0x392d1a){var _0x234bc7=BPromise[_0xbb43('0x70')](jwt[_0xbb43('0x74')],{'context':jwt});var _0x33a4db=_0x392d1a||config['secrets'][_0xbb43('0xa')];return new BPromise(function(_0xb48be2,_0x42e437){_0x234bc7(_0x555426,_0x33a4db,_0x165936)[_0xbb43('0x3b')](function(_0xc34a02){_0xb48be2(_0xc34a02);})['catch'](function(_0x3c260f){_0x42e437(_0x3c260f);});});}function generateNonce(){return crypto[_0xbb43('0x75')](0x10)[_0xbb43('0x76')](_0xbb43('0x77'));}function generateIssuedAt(){return Math[_0xbb43('0x78')](Date[_0xbb43('0x79')]()/0x3e8)[_0xbb43('0x76')]();}function createJwt(_0x2992ea){var _0x10fd8b={'payload':{'iat':_0x2992ea[_0xbb43('0x5f')],'nonce':_0x2992ea['apiKeyNonce']},'options':{'algorithm':_0xbb43('0x7a'),'subject':_0x2992ea['id']['toString'](),'issuer':hardwareConf[_0xbb43('0x45')](),'audience':hardwareConf[_0xbb43('0x45')]()}};return signJwt(_0x10fd8b)[_0xbb43('0x3b')](function(_0x3dbcd9){return{'iat':_0x2992ea[_0xbb43('0x5f')],'nonce':_0x2992ea['apiKeyNonce'],'token':_0x3dbcd9};});} \ No newline at end of file +var _0xedd9=['crypto','bluebird','util','moment','session','fullname','name','internal','email','permissions','voicePause','chatPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','authorization','startsWith','headers','Basic','User','find','authenticate','pass','status','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','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','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','split','unshift','join','promisify','secrets','payload','verify','hex','toString','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware'];(function(_0x51ee1c,_0x745d0b){var _0xae3914=function(_0xc8957e){while(--_0xc8957e){_0x51ee1c['push'](_0x51ee1c['shift']());}};_0xae3914(++_0x745d0b);}(_0xedd9,0xfc));var _0x9edd=function(_0x2797fa,_0x1280f9){_0x2797fa=_0x2797fa-0x0;var _0x5a8e59=_0xedd9[_0x2797fa];return _0x5a8e59;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x9edd('0x0'));var hardwareConf=require(_0x9edd('0x1'));var licenseUtil=require(_0x9edd('0x2'));var encryptor=require(_0x9edd('0x3'));var _=require(_0x9edd('0x4'));var jwt=require(_0x9edd('0x5'));var expressJwt=require(_0x9edd('0x6'));var compose=require(_0x9edd('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0x9edd('0x8'));var BPromise=require(_0x9edd('0x9'));var util=require(_0x9edd('0xa'));var moment=require(_0x9edd('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x9edd('0xc')]});var userAttributes=['id','role',_0x9edd('0xd'),_0x9edd('0xe'),_0x9edd('0xf'),_0x9edd('0x10'),'userpic',_0x9edd('0x11'),'md5secret',_0x9edd('0x12'),_0x9edd('0x13'),'mailPause',_0x9edd('0x14'),_0x9edd('0x15'),'openchannelPause',_0x9edd('0x16'),_0x9edd('0x17'),_0x9edd('0x18'),_0x9edd('0x19'),_0x9edd('0x1a'),_0x9edd('0x1b'),_0x9edd('0x1c'),_0x9edd('0x1d'),'phoneBarAutoAnswer',_0x9edd('0x1e'),_0x9edd('0x1f'),_0x9edd('0x20'),_0x9edd('0x21'),_0x9edd('0x22'),_0x9edd('0x23'),_0x9edd('0x24'),_0x9edd('0x25'),'phoneBarRemoteControlPort',_0x9edd('0x26'),_0x9edd('0x27'),_0x9edd('0x28'),'privacyEnabled',_0x9edd('0x29'),_0x9edd('0x2a'),_0x9edd('0x2b'),'downloadOmnichannelInteractions',_0x9edd('0x2c'),'ignorePauseForPreviewCalls',_0x9edd('0x2d'),_0x9edd('0x2e'),'chatAutoanswerDelay','emailAutoanswer',_0x9edd('0x2f'),'smsAutoanswer',_0x9edd('0x30'),'openchannelAutoanswer','openchannelAutoanswerDelay',_0x9edd('0x31'),_0x9edd('0x32'),'whatsappAutoanswer','whatsappAutoanswerDelay'];exports[_0x9edd('0x33')]=function(){return this[_0x9edd('0x34')](!![])[_0x9edd('0x35')](function(_0x542172,_0x3741c8,_0x1dca43){if(_0x542172[_0x9edd('0x36')]){_0x1dca43();}else{return db[_0x9edd('0x37')][_0x9edd('0x38')]({'where':{'id':_0x542172['params']['id']},'attributes':['id',_0x9edd('0x39'),_0x9edd('0x3a')],'raw':!![]})[_0x9edd('0x3b')](function(_0x2f9f86){if(_0x2f9f86&&_0x2f9f86[_0x9edd('0x39')]){return _0x3741c8['status'](_0x2f9f86['disposition']===_0x9edd('0x3c')?0x195:0x193)[_0x9edd('0x3d')]({'message':_0x2f9f86[_0x9edd('0x3a')]===_0x9edd('0x3c')?_0x9edd('0x3e'):'Forbidden.'});}else{_0x1dca43();}})['catch'](function(_0x214d0a){_0x1dca43(_0x214d0a);});}});};exports[_0x9edd('0x34')]=function isAuthenticated(_0x1c762c){return compose()['use'](function(_0x238b22,_0x28cfae,_0x2ae8dd){var _0x41af53;if(_0x238b22['headers'][_0x9edd('0x3f')]){if(_[_0x9edd('0x40')](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x42'))){var _0x42e664=basicAuth(_0x238b22);db[_0x9edd('0x43')][_0x9edd('0x44')]({'where':{'name':_0x42e664[_0x9edd('0xe')]}})[_0x9edd('0x3b')](function(_0x4fd03f){if(!_0x4fd03f||!_0x4fd03f[_0x9edd('0x45')](_0x42e664[_0x9edd('0x46')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':'Wrong\x20credentials.'});}_0x238b22[_0x9edd('0x36')]={'id':_0x4fd03f['id']};_0x2ae8dd();})[_0x9edd('0x48')](function(_0x267c74){_0x2ae8dd(_0x267c74);});}else if(_['startsWith'](_0x238b22[_0x9edd('0x41')][_0x9edd('0x3f')],_0x9edd('0x49'))){validateJwt(_0x238b22,_0x28cfae,_0x2ae8dd);}else{if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':_0x9edd('0x4a')});}}}else if(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')]){try{var _0xd0fd74={'audience':hardwareConf[_0x9edd('0x4d')](),'issuer':hardwareConf[_0x9edd('0x4d')]()};verifyJwt(_0x238b22[_0x9edd('0x4b')][_0x9edd('0x4c')],_0xd0fd74)[_0x9edd('0x3b')](function(_0x5757fc){return db[_0x9edd('0x43')]['find']({'where':{'id':_0x5757fc[_0x9edd('0x4e')]}})[_0x9edd('0x3b')](function(_0x10d6fd){_0x41af53=_0x10d6fd;return db[_0x9edd('0x4f')][_0x9edd('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9edd('0x50')],'raw':!![]});})[_0x9edd('0x3b')](function(_0x2b3469){if(!_0x41af53||!_[_0x9edd('0x51')](_0x41af53[_0x9edd('0x52')],_0x5757fc[_0x9edd('0x53')])){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x54')});}if(_0x41af53[_0x9edd('0x55')]){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x41af53[_0x9edd('0x56')]){if(_0x2b3469['blockDuration']>0x0){if(moment(_0x41af53[_0x9edd('0x57')])[_0x9edd('0x58')](_0x2b3469[_0x9edd('0x50')],'minutes')>moment()){return _0x28cfae[_0x9edd('0x47')](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});}}else{return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x238b22[_0x9edd('0x36')]={'id':_0x41af53['id']};_0x2ae8dd();});})[_0x9edd('0x48')](function(){return _0x28cfae['status'](0x191)[_0x9edd('0x3d')]({'message':_0x9edd('0x59')});});}catch(_0x389f51){_0x2ae8dd(_0x389f51);}}else if(_0x1c762c){_0x2ae8dd();}else{return _0x28cfae[_0x9edd('0x47')](0x193)['json']({'message':_0x9edd('0x4a')});}})['use'](function(_0x2bdb3f,_0xc1e657,_0x587d74){if(_0x2bdb3f[_0x9edd('0x36')]){db['User']['find']({'where':{'id':_0x2bdb3f[_0x9edd('0x36')]['id']},'attributes':userAttributes})[_0x9edd('0x3b')](function(_0x1f276b){if(!_0x1f276b){return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5a')});}_0x2bdb3f[_0x9edd('0x36')]=_0x1f276b;_0x587d74();})[_0x9edd('0x48')](function(_0x18c149){_0x587d74(_0x18c149);});}else if(_0x1c762c){_0x587d74();}else{return _0xc1e657[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x5b')});}});};exports[_0x9edd('0x5c')]=function canUpdate(){return compose()[_0x9edd('0x35')](function(_0x46e9f4,_0x5416f8,_0x13197d){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x1e5805){if(_0x1e5805[_0x9edd('0x5e')]){_0x13197d();}else{return _0x5416f8[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})['catch'](function(_0x4bc7a1){_0x13197d(_0x4bc7a1);});});};exports[_0x9edd('0x5f')]=function isWebrtcLicence(){return compose()['use'](function(_0x8b1fdb,_0x19b56b,_0x2b06d3){return licenseUtil[_0x9edd('0x5d')]()[_0x9edd('0x3b')](function(_0x53005b){if(_0x53005b[_0x9edd('0x60')]){_0x2b06d3();}else{return _0x19b56b[_0x9edd('0x47')](0x193)[_0x9edd('0x3d')]({'message':'Forbidden'});}})[_0x9edd('0x48')](function(_0xfd7bd1){_0x2b06d3(_0xfd7bd1);});});};exports[_0x9edd('0x61')]=function(_0x293b03,_0x1d78c4,_0x35bdec){_0x293b03['isMiddleware']=!![];return _0x35bdec();};exports[_0x9edd('0x62')]=function signToken(_0x237e91){return signJwt(_0x237e91);};exports['setTokenCookie']=function(_0xb93816,_0x8d8701){if(!_0xb93816['user']){return _0x8d8701[_0x9edd('0x47')](0x194)[_0x9edd('0x3d')]({'message':_0x9edd('0x63')});}var _0x5215b0={'payload':{'id':_0xb93816[_0x9edd('0x36')]['id'],'role':_0xb93816[_0x9edd('0x36')][_0x9edd('0x64')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5215b0)[_0x9edd('0x3b')](function(_0x53f6e3){_0x8d8701[_0x9edd('0x65')](_0x9edd('0x66'),_0x53f6e3);_0x8d8701[_0x9edd('0x67')]('/dashboards/general');})[_0x9edd('0x48')](function(_0x21f6ce){return _0x8d8701['status'](0x1f4)[_0x9edd('0x68')](_0x21f6ce);});};exports['retrieveApiKey']=function(_0x336494){if(_[_0x9edd('0x69')](_0x336494[_0x9edd('0x52')])||_[_0x9edd('0x69')](_0x336494[_0x9edd('0x6a')])){return null;}else{return createJwt(_0x336494);}};exports[_0x9edd('0x6b')]=function(_0x2334d4){_0x2334d4[_0x9edd('0x52')]=generateNonce();_0x2334d4[_0x9edd('0x6a')]=generateIssuedAt();return createJwt(_0x2334d4);};exports[_0x9edd('0x6c')]=function(_0x31272d,_0x5a3b1d){var _0x161bea=_0x31272d[_0x9edd('0x4b')][_0x9edd('0x4c')];if(_0x161bea){var _0x58fe29={'nonce':_0x5a3b1d[_0x9edd('0x52')],'iat':_0x5a3b1d['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x161bea,_0x58fe29)[_0x9edd('0x3b')](function(){return generateApiKey(_0x5a3b1d);});}else{throw{'message':_0x9edd('0x6d')};}};exports[_0x9edd('0x6e')]=function(_0x35ddb3){var _0x48a900=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x48a900['test'](_0x35ddb3))throw new db['Sequelize'][(_0x9edd('0x6f'))](_0x9edd('0x70'));return;};exports[_0x9edd('0x71')]=function(_0x1091ff,_0x2e2920,_0x41ec97){var _0x25906c=encryptor[_0x9edd('0x72')](_0x2e2920)['split'](',');for(var _0x16dfdc=0x0;_0x16dfdc<_0x41ec97;_0x16dfdc++){if(!_0x25906c[_0x16dfdc])break;if(_0x1091ff['toLowerCase']()===_0x25906c[_0x16dfdc][_0x9edd('0x73')]()){var _0x6a1cfc=util['format'](_0x9edd('0x74'),_0x41ec97);if(_0x41ec97===0x1){_0x6a1cfc=_0x9edd('0x75');}throw new db[(_0x9edd('0x76'))]['ValidationError'](_0x6a1cfc);}}return;};exports[_0x9edd('0x77')]=function(_0x2e1ce3,_0x430eb4){var _0x15ebfa=_0x430eb4?encryptor[_0x9edd('0x72')](_0x430eb4)[_0x9edd('0x78')](','):[];if(_0x15ebfa['length']===0x5){_0x15ebfa['splice'](-0x1,0x1);}_0x15ebfa[_0x9edd('0x79')](_0x2e1ce3);return encryptor['encryptString'](_0x15ebfa[_0x9edd('0x7a')](','));};function signJwt(_0x3e9a3e){var _0x439083=BPromise[_0x9edd('0x7b')](jwt['sign'],{'context':jwt});var _0x21ead2=_0x3e9a3e['secret']||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0xc6bde6,_0x5ca123){_0x439083(_0x3e9a3e[_0x9edd('0x7d')],_0x21ead2,_0x3e9a3e['options'])[_0x9edd('0x3b')](function(_0x4e1eda){_0xc6bde6(_0x4e1eda);})['catch'](function(_0x236b82){_0x5ca123(_0x236b82);});});}function verifyJwt(_0x4a72d0,_0x141137,_0x134c9c){var _0x307a61=BPromise['promisify'](jwt[_0x9edd('0x7e')],{'context':jwt});var _0x321485=_0x134c9c||config[_0x9edd('0x7c')][_0x9edd('0xc')];return new BPromise(function(_0x467512,_0x4d8fbb){_0x307a61(_0x4a72d0,_0x321485,_0x141137)['then'](function(_0x2e1a96){_0x467512(_0x2e1a96);})[_0x9edd('0x48')](function(_0x5516c4){_0x4d8fbb(_0x5516c4);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x9edd('0x7f'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x9edd('0x80')]();}function createJwt(_0x32ff46){var _0x589348={'payload':{'iat':_0x32ff46[_0x9edd('0x6a')],'nonce':_0x32ff46[_0x9edd('0x52')]},'options':{'algorithm':_0x9edd('0x81'),'subject':_0x32ff46['id']['toString'](),'issuer':hardwareConf[_0x9edd('0x4d')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x589348)[_0x9edd('0x3b')](function(_0x18d1a0){return{'iat':_0x32ff46['apiKeyIat'],'nonce':_0x32ff46[_0x9edd('0x52')],'token':_0x18d1a0};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 561bb8a..07b36fa 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 _0x42b1=['update','binary','write','end','final','close','decryptFile','createDecipher','data','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher'];(function(_0x384c03,_0x5a8034){var _0x1bc297=function(_0x1ace70){while(--_0x1ace70){_0x384c03['push'](_0x384c03['shift']());}};_0x1bc297(++_0x5a8034);}(_0x42b1,0x1bb));var _0x142b=function(_0x4397eb,_0x156992){_0x4397eb=_0x4397eb-0x0;var _0x22a9c5=_0x42b1[_0x4397eb];return _0x22a9c5;};'use strict';var crypto=require(_0x142b('0x0'));var fs=require('fs');var BPromise=require(_0x142b('0x1'));var _=require(_0x142b('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x142b('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x142b('0x4')]['session'],'algorithm':_0x142b('0x5')};const fileOptions={'algorithm':_0x142b('0x6')};if(config['encrypt']&&config[_0x142b('0x7')][_0x142b('0x8')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x142b('0x8')]);if(isSupported){fileOptions[_0x142b('0x8')]=config['encrypt']['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x142b('0x9')](',\x20');logger[_0x142b('0xa')](config['encrypt']['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0xe37c6f){return AES_SUPPORTED_RX[_0x142b('0xb')](_0xe37c6f);}function getSupportedCiphers(){return crypto[_0x142b('0xc')]()[_0x142b('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x2b3b4e){return getSupportedCiphers()['indexOf'](_0x2b3b4e)>-0x1;}function combineOptions(_0x193e12){var _0x45c52c={};for(var _0x2dd896 in fileOptions){if(fileOptions[_0x142b('0xe')](_0x2dd896)){_0x45c52c[_0x2dd896]=fileOptions[_0x2dd896];}}if(_0x193e12){for(var _0x4d0a2d in _0x193e12){if(_0x193e12[_0x142b('0xe')](_0x4d0a2d)){_0x45c52c[_0x4d0a2d]=_0x193e12[_0x4d0a2d];}}}return _0x45c52c;}exports[_0x142b('0xf')]=function(_0x50d345,_0x84dc5c,_0x437a45,_0x3c7938){return new BPromise(function(_0x39b842,_0x4226dd){_0x3c7938=combineOptions(_0x3c7938);var _0x1ceaa8=new Buffer(_0x437a45);var _0x2cf0bf=fs[_0x142b('0x10')](_0x50d345);var _0x4fdadb=fs[_0x142b('0x11')](_0x84dc5c);var _0x754a6f=crypto[_0x142b('0x12')](_0x3c7938[_0x142b('0x8')],_0x1ceaa8);_0x2cf0bf['on']('data',function(_0x4ed0d8){var _0x3cffc4=new Buffer(_0x754a6f[_0x142b('0x13')](_0x4ed0d8),_0x142b('0x14'));_0x4fdadb[_0x142b('0x15')](_0x3cffc4);});_0x2cf0bf['on'](_0x142b('0x16'),function(){try{var _0x473c7b=new Buffer(_0x754a6f[_0x142b('0x17')](_0x142b('0x14')),_0x142b('0x14'));_0x4fdadb['write'](_0x473c7b);_0x4fdadb[_0x142b('0x16')]();_0x4fdadb['on'](_0x142b('0x18'),function(){return _0x39b842(_0x84dc5c);});}catch(_0x34264a){fs['unlink'](_0x84dc5c);return _0x4226dd(_0x34264a);}});});};exports[_0x142b('0x19')]=function(_0xdcff96,_0x57e424,_0x46c669,_0x32c4a0){return new BPromise(function(_0x10167d,_0xcf9ec4){_0x32c4a0=combineOptions(_0x32c4a0);var _0x414f8a=new Buffer(_0x46c669);var _0x1223a8=fs[_0x142b('0x10')](_0xdcff96);var _0x38bbd7=fs[_0x142b('0x11')](_0x57e424);var _0x35fc6c=crypto[_0x142b('0x1a')](_0x32c4a0[_0x142b('0x8')],_0x414f8a);_0x1223a8['on'](_0x142b('0x1b'),function(_0x4a352d){var _0x3e3cca=new Buffer(_0x35fc6c[_0x142b('0x13')](_0x4a352d),_0x142b('0x14'));_0x38bbd7[_0x142b('0x15')](_0x3e3cca);});_0x1223a8['on'](_0x142b('0x16'),function(){try{var _0x3c0a75=new Buffer(_0x35fc6c[_0x142b('0x17')](_0x142b('0x14')),_0x142b('0x14'));_0x38bbd7[_0x142b('0x15')](_0x3c0a75);_0x38bbd7[_0x142b('0x16')]();_0x38bbd7['on']('close',function(){return _0x10167d(_0x57e424);});}catch(_0x4cd298){fs['unlink'](_0x57e424);return _0xcf9ec4(_0x4cd298);}});});};exports[_0x142b('0x1c')]=function(_0x3bd38d,_0x157958,_0x30915a){var _0x362f66=_0x30915a||stringOptions['algorithm'];var _0x5e3313=_0x157958||stringOptions[_0x142b('0x1d')];var _0x568723=crypto[_0x142b('0x12')](_0x362f66,_0x5e3313);var _0x36922d=_0x568723['update'](_0x3bd38d,_0x142b('0x1e'),_0x142b('0x1f'));_0x36922d+=_0x568723['final'](_0x142b('0x1f'));return _0x36922d;};exports[_0x142b('0x20')]=function(_0x125f95,_0x373095,_0x15ec11){var _0x2a2661=_0x15ec11||stringOptions[_0x142b('0x8')];var _0x11e55a=_0x373095||stringOptions[_0x142b('0x1d')];var _0x22f308=crypto[_0x142b('0x1a')](_0x2a2661,_0x11e55a);var _0x10fad2=_0x22f308[_0x142b('0x13')](_0x125f95,_0x142b('0x1f'),_0x142b('0x1e'));_0x10fad2+=_0x22f308[_0x142b('0x17')](_0x142b('0x1e'));return _0x10fad2;}; \ No newline at end of file +var _0xd0e1=['createDecipher','final','encryptString','secret','createCipher','utf8','base64','crypto','lodash','../../config/environment','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','createReadStream','createWriteStream','data','update','end','binary','write','close','unlink','decryptFile'];(function(_0x1cab63,_0x81ba3e){var _0x5ab705=function(_0x51c969){while(--_0x51c969){_0x1cab63['push'](_0x1cab63['shift']());}};_0x5ab705(++_0x81ba3e);}(_0xd0e1,0x188));var _0x1d0e=function(_0x323f55,_0xafd8df){_0x323f55=_0x323f55-0x0;var _0x26a15c=_0xd0e1[_0x323f55];return _0x26a15c;};'use strict';var crypto=require(_0x1d0e('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x1d0e('0x1'));var config=require(_0x1d0e('0x2'));var logger=require('../../config/logger')(_0x1d0e('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x1d0e('0x4')][_0x1d0e('0x5')],'algorithm':_0x1d0e('0x6')};const fileOptions={'algorithm':_0x1d0e('0x7')};if(config['encrypt']&&config[_0x1d0e('0x8')][_0x1d0e('0x9')]){var isSupported=isAlgorithmSupported(config[_0x1d0e('0x8')]['algorithm']);if(isSupported){fileOptions[_0x1d0e('0x9')]=config['encrypt'][_0x1d0e('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x1d0e('0xa')](',\x20');logger[_0x1d0e('0xb')](config[_0x1d0e('0x8')]['algorithm'],_0x1d0e('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x405c79){return AES_SUPPORTED_RX[_0x1d0e('0xd')](_0x405c79);}function getSupportedCiphers(){return crypto[_0x1d0e('0xe')]()[_0x1d0e('0xf')](isASupportedCipher);}function isAlgorithmSupported(_0x2f968e){return getSupportedCiphers()[_0x1d0e('0x10')](_0x2f968e)>-0x1;}function combineOptions(_0x3ae5ae){var _0xc91933={};for(var _0x31e308 in fileOptions){if(fileOptions[_0x1d0e('0x11')](_0x31e308)){_0xc91933[_0x31e308]=fileOptions[_0x31e308];}}if(_0x3ae5ae){for(var _0x2d014c in _0x3ae5ae){if(_0x3ae5ae['hasOwnProperty'](_0x2d014c)){_0xc91933[_0x2d014c]=_0x3ae5ae[_0x2d014c];}}}return _0xc91933;}exports['encryptFile']=function(_0xb6d764,_0x4aecd7,_0x44d6f2,_0x48bb89){return new BPromise(function(_0xd81b37,_0x4642d7){_0x48bb89=combineOptions(_0x48bb89);var _0x17b1ee=new Buffer(_0x44d6f2);var _0x78bff1=fs[_0x1d0e('0x12')](_0xb6d764);var _0x2ca2fd=fs[_0x1d0e('0x13')](_0x4aecd7);var _0x865774=crypto['createCipher'](_0x48bb89['algorithm'],_0x17b1ee);_0x78bff1['on'](_0x1d0e('0x14'),function(_0x47cf60){var _0x1de2a2=new Buffer(_0x865774[_0x1d0e('0x15')](_0x47cf60),'binary');_0x2ca2fd['write'](_0x1de2a2);});_0x78bff1['on'](_0x1d0e('0x16'),function(){try{var _0x3c4f08=new Buffer(_0x865774['final'](_0x1d0e('0x17')),'binary');_0x2ca2fd[_0x1d0e('0x18')](_0x3c4f08);_0x2ca2fd[_0x1d0e('0x16')]();_0x2ca2fd['on'](_0x1d0e('0x19'),function(){return _0xd81b37(_0x4aecd7);});}catch(_0x303f64){fs[_0x1d0e('0x1a')](_0x4aecd7);return _0x4642d7(_0x303f64);}});});};exports[_0x1d0e('0x1b')]=function(_0x330bca,_0x3aeb18,_0x3e75c5,_0x2d3231){return new BPromise(function(_0x9dd048,_0x53f070){_0x2d3231=combineOptions(_0x2d3231);var _0x42fdd8=new Buffer(_0x3e75c5);var _0x459800=fs['createReadStream'](_0x330bca);var _0x1e25be=fs[_0x1d0e('0x13')](_0x3aeb18);var _0x15c3c9=crypto[_0x1d0e('0x1c')](_0x2d3231[_0x1d0e('0x9')],_0x42fdd8);_0x459800['on'](_0x1d0e('0x14'),function(_0xe03b3e){var _0xb06bc3=new Buffer(_0x15c3c9[_0x1d0e('0x15')](_0xe03b3e),_0x1d0e('0x17'));_0x1e25be['write'](_0xb06bc3);});_0x459800['on'](_0x1d0e('0x16'),function(){try{var _0x4c4527=new Buffer(_0x15c3c9[_0x1d0e('0x1d')]('binary'),_0x1d0e('0x17'));_0x1e25be[_0x1d0e('0x18')](_0x4c4527);_0x1e25be[_0x1d0e('0x16')]();_0x1e25be['on'](_0x1d0e('0x19'),function(){return _0x9dd048(_0x3aeb18);});}catch(_0x2b1a63){fs[_0x1d0e('0x1a')](_0x3aeb18);return _0x53f070(_0x2b1a63);}});});};exports[_0x1d0e('0x1e')]=function(_0x2c422b,_0xedb54b,_0x18e16f){var _0x3c43e2=_0x18e16f||stringOptions[_0x1d0e('0x9')];var _0xe82c99=_0xedb54b||stringOptions[_0x1d0e('0x1f')];var _0xb3207c=crypto[_0x1d0e('0x20')](_0x3c43e2,_0xe82c99);var _0x1dd1d1=_0xb3207c[_0x1d0e('0x15')](_0x2c422b,_0x1d0e('0x21'),'base64');_0x1dd1d1+=_0xb3207c[_0x1d0e('0x1d')](_0x1d0e('0x22'));return _0x1dd1d1;};exports['decryptString']=function(_0x9d18e,_0x5b3b70,_0x2ec0ef){var _0x3c3846=_0x2ec0ef||stringOptions[_0x1d0e('0x9')];var _0x29ad07=_0x5b3b70||stringOptions['secret'];var _0x597a54=crypto[_0x1d0e('0x1c')](_0x3c3846,_0x29ad07);var _0x3f3a4f=_0x597a54[_0x1d0e('0x15')](_0x9d18e,_0x1d0e('0x22'),'utf8');_0x3f3a4f+=_0x597a54[_0x1d0e('0x1d')]('utf8');return _0x3f3a4f;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 792f9e5..a7d3d17 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 _0xd458=['zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','isInteger','forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','existsSync','mkdirSync','join','each','%s%d.%s','csv','%s.%s','zip','zip\x20finished','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','util','path','lodash','to-csv','bluebird'];(function(_0x37120e,_0x271130){var _0x3675ca=function(_0x283156){while(--_0x283156){_0x37120e['push'](_0x37120e['shift']());}};_0x3675ca(++_0x271130);}(_0xd458,0xc3));var _0x8d45=function(_0x54cffb,_0x325a67){_0x54cffb=_0x54cffb-0x0;var _0x4106e9=_0xd458[_0x54cffb];return _0x4106e9;};'use strict';var util=require(_0x8d45('0x0'));var path=require(_0x8d45('0x1'));var _=require(_0x8d45('0x2'));var csv=require(_0x8d45('0x3'));var fs=require('fs');var BPromise=require(_0x8d45('0x4'));var zipdir=require(_0x8d45('0x5'));var rimraf=require(_0x8d45('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0x8d45('0x7'))[_0x8d45('0x8')];var logger=require('../../config/logger')(_0x8d45('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x8d45('0xa')][0x2]);var QUERY=process[_0x8d45('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x529cac,_0xa051e){var _0x53cd07={'status':_0x529cac};var _0x332d6e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xa051e){_0x53cd07[_0x8d45('0xb')]=_0xa051e;}return db[_0x8d45('0xc')][_0x8d45('0xd')](_0x53cd07,_0x332d6e);}function main(){var _0x15d3ac=0x1388;var _0x10f798;logger[_0x8d45('0xe')](util['format'](_0x8d45('0xf'),EXTRACTED_REPORT_ID,_0x8d45('0x10')));return db[_0x8d45('0x11')][_0x8d45('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x8d45('0x13'),_0x8d45('0x14')]})[_0x8d45('0x15')](function(_0xee956d){if(_0xee956d){_0x10f798=_0xee956d;_0x15d3ac=_0x10f798['splitSizeCsv']||0x1388;}})[_0x8d45('0x15')](function(){return dbH[_0x8d45('0x16')]['query'](util[_0x8d45('0x17')](_0x8d45('0x18'),QUERY),{'type':dbH[_0x8d45('0x16')][_0x8d45('0x19')][_0x8d45('0x1a')]});})[_0x8d45('0x15')](function(_0x2737be){if(!_0x2737be[0x0]['num']){return analyticExtractedReport(_0x8d45('0x1b'));}var _0x4465a3=[];var _0x364eaa=0x0;if(_0x10f798[_0x8d45('0x13')]){if(_0x2737be&&_0x2737be[_0x8d45('0x1c')]){var _0x1766dc=_['range'](_0x2737be[0x0][_0x8d45('0x1d')]/_0x15d3ac);var _0x35c906=Number[_0x8d45('0x1e')](_0x2737be[0x0][_0x8d45('0x1d')]/_0x15d3ac)?_0x2737be[0x0][_0x8d45('0x1d')]%_0x15d3ac:0x0;_0x1766dc[_0x8d45('0x1f')](function(_0x43e92c){if(_0x43e92c>0x0){_0x364eaa+=_0x15d3ac;}_0x4465a3[_0x8d45('0x20')](dbH[_0x8d45('0x16')][_0x8d45('0x21')](util[_0x8d45('0x17')](_0x8d45('0x22'),QUERY,_0x15d3ac,_0x364eaa),{'type':dbH[_0x8d45('0x16')][_0x8d45('0x19')][_0x8d45('0x1a')]}));});if(_0x35c906>0x0){_0x364eaa+=_0x15d3ac;_0x4465a3[_0x8d45('0x20')](dbH[_0x8d45('0x16')]['query'](util[_0x8d45('0x17')](_0x8d45('0x22'),QUERY,_0x35c906,_0x364eaa),{'type':dbH[_0x8d45('0x16')]['QueryTypes'][_0x8d45('0x1a')]}));}}}else{_0x4465a3[_0x8d45('0x20')](dbH['sequelize'][_0x8d45('0x21')](QUERY,{'type':dbH[_0x8d45('0x16')]['QueryTypes'][_0x8d45('0x1a')]}));}var _0x406e9c=path['dirname'](PATH);var _0x1ce587=path['basename'](PATH,'.csv');var _0x5cc1f2=_0x10f798[_0x8d45('0x13')]&&_0x4465a3[_0x8d45('0x1c')]>0x1;var _0x5621af=[];if(!fs[_0x8d45('0x23')](path['join'](_0x406e9c,_0x1ce587))&&_0x5cc1f2){fs[_0x8d45('0x24')](path[_0x8d45('0x25')](_0x406e9c,_0x1ce587));}return BPromise[_0x8d45('0x26')](_0x4465a3,function(_0x83e98c){_0x5621af['push'](_0x83e98c);})['then'](function(){for(var _0xcdfd47=0x0;_0xcdfd47<_0x5621af[_0x8d45('0x1c')];_0xcdfd47+=0x1){var _0xb276d5;var _0x19a235=_0x5621af[_0xcdfd47];if(_0x5cc1f2){_0xb276d5=path[_0x8d45('0x25')](_0x406e9c,_0x1ce587,util[_0x8d45('0x17')](_0x8d45('0x27'),_0x1ce587,_0xcdfd47,'csv'));}else{_0xb276d5=path[_0x8d45('0x25')](_0x406e9c,util[_0x8d45('0x17')]('%s.%s',_0x1ce587,_0x8d45('0x28')));}fs['writeFileSync'](_0xb276d5,csv(_0x19a235));}})['then'](function(){if(_0x5cc1f2){return new Promise(function(_0x1eb027){zipdir(path[_0x8d45('0x25')](_0x406e9c,_0x1ce587),{'saveTo':path['join'](_0x406e9c,util[_0x8d45('0x17')](_0x8d45('0x29'),_0x1ce587,_0x8d45('0x2a')))},function(_0x422b27,_0x4d36e9){rimraf(path['join'](_0x406e9c,_0x1ce587),function(){});_0x1eb027(_0x8d45('0x2b'));});});}})['then'](function(){logger[_0x8d45('0xe')](util['format'](_0x8d45('0x2c'),EXTRACTED_REPORT_ID,_0x8d45('0x10')));return analyticExtractedReport(_0x8d45('0x2d'),_0x5cc1f2?util['format'](_0x8d45('0x29'),_0x1ce587,_0x5cc1f2?_0x8d45('0x2a'):_0x8d45('0x28')):null);});})[_0x8d45('0x2e')](function(_0x13a287){logger[_0x8d45('0xe')](util[_0x8d45('0x17')](_0x8d45('0x2f'),EXTRACTED_REPORT_ID,_0x8d45('0x10')),util[_0x8d45('0x30')](_0x13a287,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8d45('0x31'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x3c1c=['range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','.csv','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','zip\x20finished','CSV','catch','inspect','Failed','finally','exit','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','num','Empty','length'];(function(_0xa16cc0,_0x217e43){var _0x5b7c04=function(_0xb3e2eb){while(--_0xb3e2eb){_0xa16cc0['push'](_0xa16cc0['shift']());}};_0x5b7c04(++_0x217e43);}(_0x3c1c,0x173));var _0xc3c1=function(_0xf83277,_0x55487e){_0xf83277=_0xf83277-0x0;var _0x361e0e=_0x3c1c[_0xf83277];return _0x361e0e;};'use strict';var util=require(_0xc3c1('0x0'));var path=require('path');var _=require(_0xc3c1('0x1'));var csv=require(_0xc3c1('0x2'));var fs=require('fs');var BPromise=require(_0xc3c1('0x3'));var zipdir=require(_0xc3c1('0x4'));var rimraf=require(_0xc3c1('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xc3c1('0x6'))[_0xc3c1('0x7')];var logger=require(_0xc3c1('0x8'))(_0xc3c1('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xc3c1('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xa311c2,_0x15cb12){var _0x3850f3={'status':_0xa311c2};var _0x4bd74d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x15cb12){_0x3850f3[_0xc3c1('0xb')]=_0x15cb12;}return db[_0xc3c1('0xc')][_0xc3c1('0xd')](_0x3850f3,_0x4bd74d);}function main(){var _0x47aefb=0x1388;var _0x349112;logger[_0xc3c1('0xe')](util[_0xc3c1('0xf')](_0xc3c1('0x10'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xc3c1('0x11')][_0xc3c1('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc3c1('0x13'),_0xc3c1('0x14')]})[_0xc3c1('0x15')](function(_0x190577){if(_0x190577){_0x349112=_0x190577;_0x47aefb=_0x349112['splitSizeCsv']||0x1388;}})[_0xc3c1('0x15')](function(){return dbH[_0xc3c1('0x16')][_0xc3c1('0x17')](util['format'](_0xc3c1('0x18'),QUERY),{'type':dbH['sequelize'][_0xc3c1('0x19')]['SELECT']});})[_0xc3c1('0x15')](function(_0x4769d2){if(!_0x4769d2[0x0][_0xc3c1('0x1a')]){return analyticExtractedReport(_0xc3c1('0x1b'));}var _0x3cbe99=[];var _0xfd4f6c=0x0;if(_0x349112[_0xc3c1('0x13')]){if(_0x4769d2&&_0x4769d2[_0xc3c1('0x1c')]){var _0x5f4639=_[_0xc3c1('0x1d')](_0x4769d2[0x0][_0xc3c1('0x1a')]/_0x47aefb);var _0x355965=Number['isInteger'](_0x4769d2[0x0]['num']/_0x47aefb)?_0x4769d2[0x0][_0xc3c1('0x1a')]%_0x47aefb:0x0;_0x5f4639[_0xc3c1('0x1e')](function(_0x22ba6b){if(_0x22ba6b>0x0){_0xfd4f6c+=_0x47aefb;}_0x3cbe99[_0xc3c1('0x1f')](dbH[_0xc3c1('0x16')][_0xc3c1('0x17')](util['format'](_0xc3c1('0x20'),QUERY,_0x47aefb,_0xfd4f6c),{'type':dbH[_0xc3c1('0x16')][_0xc3c1('0x19')][_0xc3c1('0x21')]}));});if(_0x355965>0x0){_0xfd4f6c+=_0x47aefb;_0x3cbe99[_0xc3c1('0x1f')](dbH[_0xc3c1('0x16')][_0xc3c1('0x17')](util[_0xc3c1('0xf')](_0xc3c1('0x20'),QUERY,_0x355965,_0xfd4f6c),{'type':dbH[_0xc3c1('0x16')][_0xc3c1('0x19')][_0xc3c1('0x21')]}));}}}else{_0x3cbe99[_0xc3c1('0x1f')](dbH[_0xc3c1('0x16')][_0xc3c1('0x17')](QUERY,{'type':dbH[_0xc3c1('0x16')][_0xc3c1('0x19')][_0xc3c1('0x21')]}));}var _0x43dff7=path[_0xc3c1('0x22')](PATH);var _0x2aa2a0=path['basename'](PATH,_0xc3c1('0x23'));var _0x51b1c5=_0x349112['split']&&_0x3cbe99['length']>0x1;var _0x491c32=[];if(!fs['existsSync'](path[_0xc3c1('0x24')](_0x43dff7,_0x2aa2a0))&&_0x51b1c5){fs[_0xc3c1('0x25')](path['join'](_0x43dff7,_0x2aa2a0));}return BPromise[_0xc3c1('0x26')](_0x3cbe99,function(_0x1ae883){_0x491c32['push'](_0x1ae883);})[_0xc3c1('0x15')](function(){for(var _0x23faab=0x0;_0x23faab<_0x491c32['length'];_0x23faab+=0x1){var _0x531f41;var _0x1ee152=_0x491c32[_0x23faab];if(_0x51b1c5){_0x531f41=path[_0xc3c1('0x24')](_0x43dff7,_0x2aa2a0,util[_0xc3c1('0xf')](_0xc3c1('0x27'),_0x2aa2a0,_0x23faab,_0xc3c1('0x28')));}else{_0x531f41=path[_0xc3c1('0x24')](_0x43dff7,util[_0xc3c1('0xf')](_0xc3c1('0x29'),_0x2aa2a0,_0xc3c1('0x28')));}fs['writeFileSync'](_0x531f41,csv(_0x1ee152));}})[_0xc3c1('0x15')](function(){if(_0x51b1c5){return new Promise(function(_0x4760ef){zipdir(path[_0xc3c1('0x24')](_0x43dff7,_0x2aa2a0),{'saveTo':path[_0xc3c1('0x24')](_0x43dff7,util[_0xc3c1('0xf')](_0xc3c1('0x29'),_0x2aa2a0,_0xc3c1('0x2a')))},function(_0xab8cb2,_0x201609){rimraf(path[_0xc3c1('0x24')](_0x43dff7,_0x2aa2a0),function(){});_0x4760ef(_0xc3c1('0x2b'));});});}})[_0xc3c1('0x15')](function(){logger['info'](util[_0xc3c1('0xf')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xc3c1('0x2c')));return analyticExtractedReport('Completed',_0x51b1c5?util[_0xc3c1('0xf')](_0xc3c1('0x29'),_0x2aa2a0,_0x51b1c5?_0xc3c1('0x2a'):_0xc3c1('0x28')):null);});})[_0xc3c1('0x2d')](function(_0x4c7f36){logger[_0xc3c1('0xe')](util[_0xc3c1('0xf')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util[_0xc3c1('0x2e')](_0x4c7f36,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc3c1('0x2f'));})[_0xc3c1('0x30')](function(){process[_0xc3c1('0x31')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index bf5dfc1..651ae06 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 _0xfe6e=['sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','query','SELECT','.pdf','existsSync','flatten','createPdfKitDocument','join','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','findOne','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','pick','toString','value','length','auto','body','push','concat','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Setting','find','split','then','splitSizePdf','range','isInteger'];(function(_0x41626c,_0x44d95c){var _0x552185=function(_0x2b9e85){while(--_0x2b9e85){_0x41626c['push'](_0x41626c['shift']());}};_0x552185(++_0x44d95c);}(_0xfe6e,0x138));var _0xefe6=function(_0x2a3f39,_0x309507){_0x2a3f39=_0x2a3f39-0x0;var _0x52d640=_0xfe6e[_0x2a3f39];return _0x52d640;};'use strict';var _=require(_0xefe6('0x0'));var fs=require('fs');var util=require(_0xefe6('0x1'));var path=require(_0xefe6('0x2'));var moment=require(_0xefe6('0x3'));var htmlToPdfmake=require(_0xefe6('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xefe6('0x5'));var rimraf=require(_0xefe6('0x6'));var JSDOM=require(_0xefe6('0x7'))[_0xefe6('0x8')];var window=new JSDOM('')[_0xefe6('0x9')];var BPromise=require(_0xefe6('0xa'));var db=require(_0xefe6('0xb'))['db'];var dbH=require(_0xefe6('0xb'))[_0xefe6('0xc')];var logger=require('../../config/logger')(_0xefe6('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xefe6('0xe')][0x2]);var QUERY=process[_0xefe6('0xe')][0x3];var PATH=process[_0xefe6('0xe')][0x4];var NAME=process[_0xefe6('0xe')][0x5];var FORMAT=_0xefe6('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x59eacf,_0x3624d8){var _0x107f21={'status':_0x59eacf};var _0x4361bf={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3624d8){_0x107f21[_0xefe6('0x10')]=_0x3624d8;}return db['AnalyticExtractedReport'][_0xefe6('0x11')](_0x107f21,_0x4361bf);}function getHeaders(_0x1e6828){return _['map'](_0x1e6828,function(_0x115516){return{'text':_0x115516,'style':'tableHeader'};});}function getRows(_0x3714f7,_0x51644a){return _[_0xefe6('0x12')](_0x51644a,function(_0x218c09){return _(_0x218c09)[_0xefe6('0x13')](_0x3714f7)['map'](function(_0x47b85e){return _0x47b85e?_[_0xefe6('0x14')](_0x47b85e):'';})[_0xefe6('0x15')]();});}function createTable(_0x4ae626,_0x25b08b){var _0x1a23a7={'widths':_['fill'](Array(_0x4ae626[_0xefe6('0x16')]),0x91),'heights':function(_0x4e9c5c){return _0x4e9c5c===0x0?_0xefe6('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4bce33=getHeaders(_0x4ae626);_0x1a23a7[_0xefe6('0x18')][_0xefe6('0x19')](_0x4bce33);var _0x2a5b73=getRows(_0x4ae626,_0x25b08b);_0x1a23a7['body']=_0x1a23a7[_0xefe6('0x18')][_0xefe6('0x1a')](_0x2a5b73);return _0x1a23a7;}function createTables(_0x12e1d2){var _0x28fad6=[];var _0x48e45a=_['chunk'](Object[_0xefe6('0x1b')](_0x12e1d2[0x0]),0x5);_0x48e45a[_0xefe6('0x1c')](function(_0x23d8a8){_0x28fad6['push'](createTable(_0x23d8a8,_0x12e1d2));});return _0x28fad6;}function getPDFDocDefinition(_0x142d4e){var _0x2e5a51=util[_0xefe6('0x1d')](_0xefe6('0x1e'),NAME,EXTRACTED_REPORT[_0xefe6('0x1f')],moment(EXTRACTED_REPORT[_0xefe6('0x20')])[_0xefe6('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0xefe6('0x21')])[_0xefe6('0x1d')](FORMAT));var _0xcebee=[];for(var _0x4897d6=0x0;_0x4897d6<_0x142d4e['length'];_0x4897d6++){var _0x5ab8ae=[];if(_0x4897d6===0x0){_0x5ab8ae['push']({'text':_0x2e5a51,'style':_0xefe6('0x22')});}var _0x43d88c={'table':_0x142d4e[_0x4897d6]};if(_0x4897d6>0x0){_0x43d88c[_0xefe6('0x23')]=_0xefe6('0x24');_0x43d88c[_0xefe6('0x25')]=[0x0,0x46,0x0,0x0];}_0x5ab8ae[_0xefe6('0x19')](_0x43d88c);_0xcebee['push'](_0x5ab8ae);}return{'pageSize':'A4','pageOrientation':_0xefe6('0x26'),'content':_0xcebee,'footer':function(_0x3713eb,_0x38319d){return{'text':_0x3713eb[_0xefe6('0x14')]()+_0xefe6('0x27')+_0x38319d,'style':_0xefe6('0x28')};},'defaultStyle':{'font':_0xefe6('0x29')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xefe6('0x2a')},'footer':{'alignment':_0xefe6('0x2b'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x13b193){var _0x32c625=0x1388;var _0x4f9eb3;if(!_0x13b193[0x0][_0xefe6('0x2c')]){return analyticExtractedReport('Empty');}return db[_0xefe6('0x2d')][_0xefe6('0x2e')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xefe6('0x2f'),'splitSizePdf']})[_0xefe6('0x30')](function(_0x3cb6d2){if(_0x3cb6d2){_0x4f9eb3=_0x3cb6d2;_0x32c625=_0x4f9eb3[_0xefe6('0x31')]||0x3e8;}})[_0xefe6('0x30')](function(){var _0x34601d=[];var _0x3d44aa=0x0;if(_0x4f9eb3[_0xefe6('0x2f')]){if(_0x13b193&&_0x13b193['length']){var _0x3fab8a=_[_0xefe6('0x32')](_0x13b193[0x0][_0xefe6('0x2c')]/_0x32c625);var _0xea9328=Number[_0xefe6('0x33')](_0x13b193[0x0][_0xefe6('0x2c')]/_0x32c625)?_0x13b193[0x0][_0xefe6('0x2c')]%_0x32c625:0x0;_0x3fab8a[_0xefe6('0x1c')](function(_0x166382){if(_0x166382>0x0){_0x3d44aa+=_0x32c625;}_0x34601d[_0xefe6('0x19')](dbH[_0xefe6('0x34')]['query'](util[_0xefe6('0x1d')](_0xefe6('0x35'),QUERY,_0x32c625,_0x3d44aa),{'type':dbH[_0xefe6('0x34')][_0xefe6('0x36')]['SELECT']}));});if(_0xea9328>0x0){_0x3d44aa+=_0x32c625;_0x34601d[_0xefe6('0x19')](dbH[_0xefe6('0x34')][_0xefe6('0x37')](util[_0xefe6('0x1d')](_0xefe6('0x35'),QUERY,_0xea9328,_0x3d44aa),{'type':dbH[_0xefe6('0x34')][_0xefe6('0x36')][_0xefe6('0x38')]}));}}}else{_0x34601d['push'](dbH[_0xefe6('0x34')][_0xefe6('0x37')](QUERY,{'type':dbH[_0xefe6('0x34')]['QueryTypes'][_0xefe6('0x38')]}));}var _0xc76af4=path['dirname'](PATH);var _0x33d67e=path['basename'](PATH,_0xefe6('0x39'));var _0x21dcf1=_0x4f9eb3['split']&&_0x34601d[_0xefe6('0x16')]>0x1;var _0x22bc40=[];if(!fs[_0xefe6('0x3a')](path['join'](_0xc76af4,_0x33d67e))&&_0x21dcf1){fs['mkdirSync'](path['join'](_0xc76af4,_0x33d67e));}return BPromise['each'](_0x34601d,function(_0x3bdd4b){_0x22bc40[_0xefe6('0x19')](_0x3bdd4b);})['then'](function(){var _0x4fb61a=[];for(var _0x4000e1=0x0;_0x4000e1<_0x22bc40[_0xefe6('0x16')];_0x4000e1+=0x1){var _0x35eb51=_0x22bc40[_0x4000e1];var _0x4889f2=createTables(_[_0xefe6('0x3b')](_0x35eb51));var _0x4f74db;var _0x3affb8=getPDFDocDefinition(_0x4889f2);var _0x358135=getPDFPrinter();var _0x3bd81f=_0x358135[_0xefe6('0x3c')](_0x3affb8);if(_0x21dcf1){_0x4f74db=path[_0xefe6('0x3d')](_0xc76af4,_0x33d67e,util['format'](_0xefe6('0x3e'),_0x33d67e,_0x4000e1,_0xefe6('0x3f')));}else{_0x4f74db=path['join'](_0xc76af4,util['format'](_0xefe6('0x40'),_0x33d67e,_0xefe6('0x3f')));}_0x4fb61a[_0xefe6('0x19')](writePDFDocument(_0x3bd81f,_0x4f74db));}return Promise['all'](_0x4fb61a);})['then'](function(){if(_0x21dcf1){return new Promise(function(_0x4f816e){zipdir(path['join'](_0xc76af4,_0x33d67e),{'saveTo':path['join'](_0xc76af4,util[_0xefe6('0x1d')]('%s.%s',_0x33d67e,_0xefe6('0x41')))},function(){rimraf(path[_0xefe6('0x3d')](_0xc76af4,_0x33d67e),function(){});_0x4f816e(_0xefe6('0x42'));});});}})['then'](function(){if(!_0x21dcf1)return;rimraf(path['join'](_0xc76af4,_0x33d67e),function(){});})['then'](function(){logger[_0xefe6('0x43')](util[_0xefe6('0x1d')](_0xefe6('0x44'),EXTRACTED_REPORT_ID,_0xefe6('0x45')));return analyticExtractedReport(_0xefe6('0x46'),_0x21dcf1?util[_0xefe6('0x1d')](_0xefe6('0x40'),_0x33d67e,_0x21dcf1?_0xefe6('0x41'):_0xefe6('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xefe6('0x43')](util[_0xefe6('0x1d')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport'][_0xefe6('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xefe6('0x30')](function(_0x2e74b3){EXTRACTED_REPORT=_0x2e74b3;return dbH[_0xefe6('0x34')]['query'](util[_0xefe6('0x1d')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xefe6('0x36')][_0xefe6('0x38')]});})['then'](extractReport)['catch'](function(_0x58a0ce){logger[_0xefe6('0x43')](util[_0xefe6('0x1d')](_0xefe6('0x48'),EXTRACTED_REPORT_ID,_0xefe6('0x45')),util[_0xefe6('0x49')](_0x58a0ce,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xefe6('0x4a'));})[_0xefe6('0x4b')](function(){process[_0xefe6('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x461761=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xefe6('0x4d'),'italics':__dirname+_0xefe6('0x4e'),'bolditalics':__dirname+_0xefe6('0x4f')}});return _0x461761;}function getPDFDocDefinitionFromHTML(_0x366373,_0x220baa){var _0x554978=util[_0xefe6('0x1d')]('%s\x20#%d',_0x220baa['channel'],_0x220baa[_0xefe6('0x50')]);var _0x3e27b2=moment()[_0xefe6('0x1d')](_0xefe6('0x51'))[_0xefe6('0x14')]();var _0x357ed4=htmlToPdfmake(_0x366373,{'window':window,'tableAutoSize':!![]});return{'content':[_0x357ed4],'defaultStyle':{'font':_0xefe6('0x29')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xefe6('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xefe6('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xefe6('0x53'),'style':_0xefe6('0x22')}];},'footer':function(_0x409964,_0x66cc79){return[{'text':util[_0xefe6('0x1d')](_0xefe6('0x54'),_0x554978,_0x409964,_0x66cc79,_0x3e27b2),'style':_0xefe6('0x28')}];}};}function writePDFDocument(_0x5926d6,_0x40b835){return new Promise(function(_0x495c5a,_0x449589){var _0x10f61d=_0x5926d6[_0xefe6('0x55')](fs[_0xefe6('0x56')](_0x40b835));_0x10f61d['on']('finish',function(){_0x495c5a(_0xefe6('0x57'));});_0x10f61d['on'](_0xefe6('0x58'),function(_0x6e3cb8){_0x449589(_0x6e3cb8);});_0x5926d6[_0xefe6('0x59')]();});}exports[_0xefe6('0x5a')]=function(_0xdbdcec,_0x62a1ac){var _0x389de2=getPDFPrinter();var _0xe858ef=getPDFDocDefinitionFromHTML(_0xdbdcec,_0x62a1ac);var _0x407a3a=_0x389de2[_0xefe6('0x3c')](_0xe858ef);return writePDFDocument(_0x407a3a,_0x62a1ac[_0xefe6('0x2')])['catch'](function(_0x2f36ab){throw _0x2f36ab;});}; \ No newline at end of file +var _0x9a98=['finally','exit','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','finish','error','end','createPdfFromHTML','lodash','util','path','moment','pdfmake/src/printer','rimraf','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','map','tableHeader','pick','toString','value','fill','length','auto','body','concat','chunk','keys','forEach','push','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','header','pageBreak','landscape','\x20/\x20','footer','Arial','black','right','Empty','Setting','split','splitSizePdf','then','range','isInteger','num','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','mkdirSync','each','createPdfKitDocument','join','%s%d.%s','%s.%s','pdf','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect'];(function(_0x4430f3,_0x3461e3){var _0x5b19ac=function(_0x1f6299){while(--_0x1f6299){_0x4430f3['push'](_0x4430f3['shift']());}};_0x5b19ac(++_0x3461e3);}(_0x9a98,0xba));var _0x89a9=function(_0x2c3301,_0x46b99d){_0x2c3301=_0x2c3301-0x0;var _0x297f58=_0x9a98[_0x2c3301];return _0x297f58;};'use strict';var _=require(_0x89a9('0x0'));var fs=require('fs');var util=require(_0x89a9('0x1'));var path=require(_0x89a9('0x2'));var moment=require(_0x89a9('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x89a9('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x89a9('0x5'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0x89a9('0x6')];var BPromise=require(_0x89a9('0x7'));var db=require(_0x89a9('0x8'))['db'];var dbH=require(_0x89a9('0x8'))[_0x89a9('0x9')];var logger=require(_0x89a9('0xa'))(_0x89a9('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x89a9('0xc')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x89a9('0xc')][0x4];var NAME=process[_0x89a9('0xc')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x266178,_0x214e4c){var _0x4f33ce={'status':_0x266178};var _0x4ef41b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x214e4c){_0x4f33ce['savename']=_0x214e4c;}return db['AnalyticExtractedReport']['update'](_0x4f33ce,_0x4ef41b);}function getHeaders(_0x2ab637){return _[_0x89a9('0xd')](_0x2ab637,function(_0x279f18){return{'text':_0x279f18,'style':_0x89a9('0xe')};});}function getRows(_0x4e1af2,_0x22eb60){return _[_0x89a9('0xd')](_0x22eb60,function(_0x182790){return _(_0x182790)[_0x89a9('0xf')](_0x4e1af2)[_0x89a9('0xd')](function(_0x4d74e5){return _0x4d74e5?_[_0x89a9('0x10')](_0x4d74e5):'';})[_0x89a9('0x11')]();});}function createTable(_0x498016,_0x5d43de){var _0x51eef4={'widths':_[_0x89a9('0x12')](Array(_0x498016[_0x89a9('0x13')]),0x91),'heights':function(_0x52d9eb){return _0x52d9eb===0x0?_0x89a9('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xc9b2f0=getHeaders(_0x498016);_0x51eef4['body']['push'](_0xc9b2f0);var _0x507a57=getRows(_0x498016,_0x5d43de);_0x51eef4['body']=_0x51eef4[_0x89a9('0x15')][_0x89a9('0x16')](_0x507a57);return _0x51eef4;}function createTables(_0x1f06e6){var _0x3e0028=[];var _0x130fbb=_[_0x89a9('0x17')](Object[_0x89a9('0x18')](_0x1f06e6[0x0]),0x5);_0x130fbb[_0x89a9('0x19')](function(_0x3f540e){_0x3e0028[_0x89a9('0x1a')](createTable(_0x3f540e,_0x1f06e6));});return _0x3e0028;}function getPDFDocDefinition(_0x2c49e9){var _0x282aac=util['format'](_0x89a9('0x1b'),NAME,EXTRACTED_REPORT[_0x89a9('0x1c')],moment(EXTRACTED_REPORT[_0x89a9('0x1d')])[_0x89a9('0x1e')](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x259792=[];for(var _0x5d4151=0x0;_0x5d4151<_0x2c49e9[_0x89a9('0x13')];_0x5d4151++){var _0xaf1fe4=[];if(_0x5d4151===0x0){_0xaf1fe4[_0x89a9('0x1a')]({'text':_0x282aac,'style':_0x89a9('0x1f')});}var _0x587418={'table':_0x2c49e9[_0x5d4151]};if(_0x5d4151>0x0){_0x587418[_0x89a9('0x20')]='before';_0x587418['margin']=[0x0,0x46,0x0,0x0];}_0xaf1fe4[_0x89a9('0x1a')](_0x587418);_0x259792['push'](_0xaf1fe4);}return{'pageSize':'A4','pageOrientation':_0x89a9('0x21'),'content':_0x259792,'footer':function(_0x199fd3,_0x5b4ea5){return{'text':_0x199fd3[_0x89a9('0x10')]()+_0x89a9('0x22')+_0x5b4ea5,'style':_0x89a9('0x23')};},'defaultStyle':{'font':_0x89a9('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x89a9('0x25')},'footer':{'alignment':_0x89a9('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4a0570){var _0xba1cd3=0x1388;var _0xe766d7;if(!_0x4a0570[0x0]['num']){return analyticExtractedReport(_0x89a9('0x27'));}return db[_0x89a9('0x28')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x89a9('0x29'),_0x89a9('0x2a')]})[_0x89a9('0x2b')](function(_0x333789){if(_0x333789){_0xe766d7=_0x333789;_0xba1cd3=_0xe766d7[_0x89a9('0x2a')]||0x3e8;}})[_0x89a9('0x2b')](function(){var _0x5a80b8=[];var _0x544db4=0x0;if(_0xe766d7[_0x89a9('0x29')]){if(_0x4a0570&&_0x4a0570[_0x89a9('0x13')]){var _0x3119ab=_[_0x89a9('0x2c')](_0x4a0570[0x0]['num']/_0xba1cd3);var _0x103897=Number[_0x89a9('0x2d')](_0x4a0570[0x0][_0x89a9('0x2e')]/_0xba1cd3)?_0x4a0570[0x0][_0x89a9('0x2e')]%_0xba1cd3:0x0;_0x3119ab[_0x89a9('0x19')](function(_0x3ae431){if(_0x3ae431>0x0){_0x544db4+=_0xba1cd3;}_0x5a80b8['push'](dbH[_0x89a9('0x2f')][_0x89a9('0x30')](util[_0x89a9('0x1e')](_0x89a9('0x31'),QUERY,_0xba1cd3,_0x544db4),{'type':dbH[_0x89a9('0x2f')][_0x89a9('0x32')]['SELECT']}));});if(_0x103897>0x0){_0x544db4+=_0xba1cd3;_0x5a80b8['push'](dbH[_0x89a9('0x2f')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x103897,_0x544db4),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x5a80b8[_0x89a9('0x1a')](dbH[_0x89a9('0x2f')]['query'](QUERY,{'type':dbH[_0x89a9('0x2f')][_0x89a9('0x32')][_0x89a9('0x33')]}));}var _0x1b1f14=path[_0x89a9('0x34')](PATH);var _0x252c44=path[_0x89a9('0x35')](PATH,_0x89a9('0x36'));var _0x2b302a=_0xe766d7[_0x89a9('0x29')]&&_0x5a80b8[_0x89a9('0x13')]>0x1;var _0x395323=[];if(!fs['existsSync'](path['join'](_0x1b1f14,_0x252c44))&&_0x2b302a){fs[_0x89a9('0x37')](path['join'](_0x1b1f14,_0x252c44));}return BPromise[_0x89a9('0x38')](_0x5a80b8,function(_0x3b694c){_0x395323[_0x89a9('0x1a')](_0x3b694c);})['then'](function(){var _0x4fe804=[];for(var _0x146255=0x0;_0x146255<_0x395323['length'];_0x146255+=0x1){var _0x59a6ab=_0x395323[_0x146255];var _0x5d16cc=createTables(_['flatten'](_0x59a6ab));var _0x5ecba2;var _0x13435c=getPDFDocDefinition(_0x5d16cc);var _0x29a3c5=getPDFPrinter();var _0x394058=_0x29a3c5[_0x89a9('0x39')](_0x13435c);if(_0x2b302a){_0x5ecba2=path[_0x89a9('0x3a')](_0x1b1f14,_0x252c44,util[_0x89a9('0x1e')](_0x89a9('0x3b'),_0x252c44,_0x146255,'pdf'));}else{_0x5ecba2=path['join'](_0x1b1f14,util[_0x89a9('0x1e')](_0x89a9('0x3c'),_0x252c44,_0x89a9('0x3d')));}_0x4fe804[_0x89a9('0x1a')](writePDFDocument(_0x394058,_0x5ecba2));}return Promise[_0x89a9('0x3e')](_0x4fe804);})[_0x89a9('0x2b')](function(){if(_0x2b302a){return new Promise(function(_0x49d34){zipdir(path[_0x89a9('0x3a')](_0x1b1f14,_0x252c44),{'saveTo':path[_0x89a9('0x3a')](_0x1b1f14,util[_0x89a9('0x1e')](_0x89a9('0x3c'),_0x252c44,_0x89a9('0x3f')))},function(){rimraf(path[_0x89a9('0x3a')](_0x1b1f14,_0x252c44),function(){});_0x49d34(_0x89a9('0x40'));});});}})[_0x89a9('0x2b')](function(){if(!_0x2b302a)return;rimraf(path[_0x89a9('0x3a')](_0x1b1f14,_0x252c44),function(){});})[_0x89a9('0x2b')](function(){logger['info'](util[_0x89a9('0x1e')](_0x89a9('0x41'),EXTRACTED_REPORT_ID,_0x89a9('0x42')));return analyticExtractedReport(_0x89a9('0x43'),_0x2b302a?util[_0x89a9('0x1e')]('%s.%s',_0x252c44,_0x2b302a?_0x89a9('0x3f'):_0x89a9('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x89a9('0x44')](util[_0x89a9('0x1e')](_0x89a9('0x45'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x89a9('0x46')][_0x89a9('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x89a9('0x2b')](function(_0x296294){EXTRACTED_REPORT=_0x296294;return dbH['sequelize'][_0x89a9('0x30')](util[_0x89a9('0x1e')](_0x89a9('0x48'),QUERY),{'type':dbH[_0x89a9('0x2f')]['QueryTypes']['SELECT']});})[_0x89a9('0x2b')](extractReport)[_0x89a9('0x49')](function(_0x554e0b){logger[_0x89a9('0x44')](util[_0x89a9('0x1e')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x89a9('0x42')),util[_0x89a9('0x4a')](_0x554e0b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x89a9('0x4b')](function(){process[_0x89a9('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3ecec4=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x89a9('0x4d'),'bolditalics':__dirname+_0x89a9('0x4e')}});return _0x3ecec4;}function getPDFDocDefinitionFromHTML(_0x9e9233,_0x3a71c7){var _0x5651c8=util[_0x89a9('0x1e')]('%s\x20#%d',_0x3a71c7['channel'],_0x3a71c7[_0x89a9('0x4f')]);var _0x5d657e=moment()[_0x89a9('0x1e')](_0x89a9('0x50'))[_0x89a9('0x10')]();var _0x4c2f5d=htmlToPdfmake(_0x9e9233,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4c2f5d],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x89a9('0x51'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x89a9('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x89a9('0x52'),'style':_0x89a9('0x1f')}];},'footer':function(_0x5e1262,_0x5288d7){return[{'text':util[_0x89a9('0x1e')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x5651c8,_0x5e1262,_0x5288d7,_0x5d657e),'style':_0x89a9('0x23')}];}};}function writePDFDocument(_0x4e29f4,_0x7497ab){return new Promise(function(_0x23c075,_0x13ddbd){var _0x3a5b76=_0x4e29f4['pipe'](fs['createWriteStream'](_0x7497ab));_0x3a5b76['on'](_0x89a9('0x53'),function(){_0x23c075(_0x89a9('0x53'));});_0x3a5b76['on'](_0x89a9('0x54'),function(_0x37e15f){_0x13ddbd(_0x37e15f);});_0x4e29f4[_0x89a9('0x55')]();});}exports[_0x89a9('0x56')]=function(_0x1d85b4,_0x4e9d21){var _0xc28bf4=getPDFPrinter();var _0x4537a0=getPDFDocDefinitionFromHTML(_0x1d85b4,_0x4e9d21);var _0x1a6db2=_0xc28bf4[_0x89a9('0x39')](_0x4537a0);return writePDFDocument(_0x1a6db2,_0x4e9d21[_0x89a9('0x2')])[_0x89a9('0x49')](function(_0x4a797d){throw _0x4a797d;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 710b383..5070354 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 _0x294d=['forEach','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','existsSync','mkdirSync','join','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger'];(function(_0x2e24d4,_0x3cad21){var _0x4888ee=function(_0x2a5ba6){while(--_0x2a5ba6){_0x2e24d4['push'](_0x2e24d4['shift']());}};_0x4888ee(++_0x3cad21);}(_0x294d,0x7f));var _0xd294=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0x294d[_0x3b231a];return _0x18d67a;};'use strict';var util=require(_0xd294('0x0'));var path=require(_0xd294('0x1'));var _=require(_0xd294('0x2'));var fs=require('fs');var json2xls=require(_0xd294('0x3'));var BPromise=require(_0xd294('0x4'));var zipdir=require(_0xd294('0x5'));var rimraf=require(_0xd294('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0xd294('0x7'))['dbH'];var logger=require(_0xd294('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xd294('0x9')][0x3];var PATH=process[_0xd294('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3d65cf,_0x427992){var _0x5a1257={'status':_0x3d65cf};var _0x1a6558={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x427992){_0x5a1257[_0xd294('0xa')]=_0x427992;}return db[_0xd294('0xb')]['update'](_0x5a1257,_0x1a6558);}function main(){var _0x2d3e73=0x1388;var _0x467539;logger[_0xd294('0xc')](util['format'](_0xd294('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xd294('0xe')][_0xd294('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd294('0x10'),_0xd294('0x11')]})[_0xd294('0x12')](function(_0x1cef8e){if(_0x1cef8e){_0x467539=_0x1cef8e;_0x2d3e73=_0x467539[_0xd294('0x11')]||0x1388;}})[_0xd294('0x12')](function(){return dbH[_0xd294('0x13')]['query'](util[_0xd294('0x14')](_0xd294('0x15'),QUERY),{'type':dbH['sequelize'][_0xd294('0x16')][_0xd294('0x17')]});})[_0xd294('0x12')](function(_0x480de6){if(!_0x480de6[0x0][_0xd294('0x18')]){return analyticExtractedReport(_0xd294('0x19'));}var _0x58b9a3=[];var _0x44c446=0x0;if(_0x467539[_0xd294('0x10')]){if(_0x480de6&&_0x480de6[_0xd294('0x1a')]){var _0x32b80a=_[_0xd294('0x1b')](_0x480de6[0x0][_0xd294('0x18')]/_0x2d3e73);var _0x5a5954=Number[_0xd294('0x1c')](_0x480de6[0x0][_0xd294('0x18')]/_0x2d3e73)?_0x480de6[0x0][_0xd294('0x18')]%_0x2d3e73:0x0;_0x32b80a[_0xd294('0x1d')](function(_0x581afc){if(_0x581afc>0x0){_0x44c446+=_0x2d3e73;}_0x58b9a3[_0xd294('0x1e')](dbH[_0xd294('0x13')][_0xd294('0x1f')](util['format'](_0xd294('0x20'),QUERY,_0x2d3e73,_0x44c446),{'type':dbH[_0xd294('0x13')][_0xd294('0x16')][_0xd294('0x17')]}));});if(_0x5a5954>0x0){_0x44c446+=_0x2d3e73;_0x58b9a3['push'](dbH[_0xd294('0x13')][_0xd294('0x1f')](util[_0xd294('0x14')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5a5954,_0x44c446),{'type':dbH[_0xd294('0x13')][_0xd294('0x16')]['SELECT']}));}}}else{_0x58b9a3['push'](dbH[_0xd294('0x13')][_0xd294('0x1f')](QUERY,{'type':dbH[_0xd294('0x13')][_0xd294('0x16')]['SELECT']}));}var _0xf0d456=path[_0xd294('0x21')](PATH);var _0x494900=path['basename'](PATH,_0xd294('0x22'));var _0x297ddc=_0x467539[_0xd294('0x10')]&&_0x58b9a3[_0xd294('0x1a')]>0x1;var _0x58398e=[];if(!fs[_0xd294('0x23')](path['join'](_0xf0d456,_0x494900))&&_0x297ddc){fs[_0xd294('0x24')](path[_0xd294('0x25')](_0xf0d456,_0x494900));}return BPromise[_0xd294('0x26')](_0x58b9a3,function(_0x205962){_0x58398e[_0xd294('0x1e')](_0x205962);})[_0xd294('0x12')](function(){for(var _0x2575bc=0x0;_0x2575bc<_0x58398e['length'];_0x2575bc+=0x1){var _0x1075de;var _0x310df2=_0x58398e[_0x2575bc];if(_0x297ddc){_0x1075de=path['join'](_0xf0d456,_0x494900,util[_0xd294('0x14')](_0xd294('0x27'),_0x494900,_0x2575bc,_0xd294('0x28')));}else{_0x1075de=path[_0xd294('0x25')](_0xf0d456,util['format']('%s.%s',_0x494900,'xlsx'));}fs[_0xd294('0x29')](_0x1075de,json2xls(_0x310df2),_0xd294('0x2a'));}})[_0xd294('0x12')](function(){if(_0x297ddc){return new Promise(function(_0x4c0116){zipdir(path[_0xd294('0x25')](_0xf0d456,_0x494900),{'saveTo':path['join'](_0xf0d456,util[_0xd294('0x14')](_0xd294('0x2b'),_0x494900,_0xd294('0x2c')))},function(_0x392bd6,_0x518510){rimraf(path['join'](_0xf0d456,_0x494900),function(){});_0x4c0116(_0xd294('0x2d'));});});}})[_0xd294('0x12')](function(){logger[_0xd294('0xc')](util[_0xd294('0x14')](_0xd294('0x2e'),EXTRACTED_REPORT_ID,_0xd294('0x2f')));return analyticExtractedReport('Completed',_0x297ddc?util[_0xd294('0x14')](_0xd294('0x2b'),_0x494900,_0x297ddc?'zip':'xlsx'):null);});})['catch'](function(_0x16b654){logger[_0xd294('0xc')](util[_0xd294('0x14')](_0xd294('0x30'),EXTRACTED_REPORT_ID,_0xd294('0x2f')),util['inspect'](_0x16b654,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd294('0x31'));})[_0xd294('0x32')](function(){process[_0xd294('0x33')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xcefd=['Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','then','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','binary','zip','zip\x20finished','Completed','%s.%s','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info'];(function(_0x31a873,_0x1152e8){var _0x3ae25a=function(_0x354b67){while(--_0x354b67){_0x31a873['push'](_0x31a873['shift']());}};_0x3ae25a(++_0x1152e8);}(_0xcefd,0x1bd));var _0xdcef=function(_0x4f749a,_0x541f4f){_0x4f749a=_0x4f749a-0x0;var _0x1152b7=_0xcefd[_0x4f749a];return _0x1152b7;};'use strict';var util=require('util');var path=require(_0xdcef('0x0'));var _=require(_0xdcef('0x1'));var fs=require('fs');var json2xls=require(_0xdcef('0x2'));var BPromise=require(_0xdcef('0x3'));var zipdir=require(_0xdcef('0x4'));var rimraf=require(_0xdcef('0x5'));var db=require(_0xdcef('0x6'))['db'];var dbH=require('../../mysqldb')[_0xdcef('0x7')];var logger=require(_0xdcef('0x8'))(_0xdcef('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xdcef('0xa')][0x2]);var QUERY=process[_0xdcef('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3b9fec,_0x25dfd5){var _0x3dc2b0={'status':_0x3b9fec};var _0x11a5a6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x25dfd5){_0x3dc2b0['savename']=_0x25dfd5;}return db[_0xdcef('0xb')][_0xdcef('0xc')](_0x3dc2b0,_0x11a5a6);}function main(){var _0x2b6b4c=0x1388;var _0x49e6ab;logger[_0xdcef('0xd')](util['format'](_0xdcef('0xe'),EXTRACTED_REPORT_ID,_0xdcef('0xf')));return db[_0xdcef('0x10')][_0xdcef('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdcef('0x12'),'splitSizeXlsx']})[_0xdcef('0x13')](function(_0x1f4bb2){if(_0x1f4bb2){_0x49e6ab=_0x1f4bb2;_0x2b6b4c=_0x49e6ab['splitSizeXlsx']||0x1388;}})[_0xdcef('0x13')](function(){return dbH['sequelize'][_0xdcef('0x14')](util[_0xdcef('0x15')](_0xdcef('0x16'),QUERY),{'type':dbH[_0xdcef('0x17')]['QueryTypes'][_0xdcef('0x18')]});})[_0xdcef('0x13')](function(_0x518d03){if(!_0x518d03[0x0][_0xdcef('0x19')]){return analyticExtractedReport(_0xdcef('0x1a'));}var _0x20d127=[];var _0x55784f=0x0;if(_0x49e6ab['split']){if(_0x518d03&&_0x518d03[_0xdcef('0x1b')]){var _0x3ef0a0=_[_0xdcef('0x1c')](_0x518d03[0x0]['num']/_0x2b6b4c);var _0x1a79f8=Number[_0xdcef('0x1d')](_0x518d03[0x0][_0xdcef('0x19')]/_0x2b6b4c)?_0x518d03[0x0]['num']%_0x2b6b4c:0x0;_0x3ef0a0[_0xdcef('0x1e')](function(_0x5eaa3c){if(_0x5eaa3c>0x0){_0x55784f+=_0x2b6b4c;}_0x20d127[_0xdcef('0x1f')](dbH[_0xdcef('0x17')][_0xdcef('0x14')](util[_0xdcef('0x15')](_0xdcef('0x20'),QUERY,_0x2b6b4c,_0x55784f),{'type':dbH[_0xdcef('0x17')][_0xdcef('0x21')][_0xdcef('0x18')]}));});if(_0x1a79f8>0x0){_0x55784f+=_0x2b6b4c;_0x20d127[_0xdcef('0x1f')](dbH['sequelize'][_0xdcef('0x14')](util[_0xdcef('0x15')](_0xdcef('0x20'),QUERY,_0x1a79f8,_0x55784f),{'type':dbH[_0xdcef('0x17')]['QueryTypes'][_0xdcef('0x18')]}));}}}else{_0x20d127[_0xdcef('0x1f')](dbH['sequelize'][_0xdcef('0x14')](QUERY,{'type':dbH[_0xdcef('0x17')][_0xdcef('0x21')][_0xdcef('0x18')]}));}var _0x482dcd=path[_0xdcef('0x22')](PATH);var _0x4dc915=path['basename'](PATH,_0xdcef('0x23'));var _0x84beb3=_0x49e6ab[_0xdcef('0x12')]&&_0x20d127[_0xdcef('0x1b')]>0x1;var _0x27b6bb=[];if(!fs[_0xdcef('0x24')](path[_0xdcef('0x25')](_0x482dcd,_0x4dc915))&&_0x84beb3){fs[_0xdcef('0x26')](path[_0xdcef('0x25')](_0x482dcd,_0x4dc915));}return BPromise[_0xdcef('0x27')](_0x20d127,function(_0x5399f4){_0x27b6bb[_0xdcef('0x1f')](_0x5399f4);})['then'](function(){for(var _0xc8693c=0x0;_0xc8693c<_0x27b6bb['length'];_0xc8693c+=0x1){var _0x3dfcc8;var _0x565a31=_0x27b6bb[_0xc8693c];if(_0x84beb3){_0x3dfcc8=path['join'](_0x482dcd,_0x4dc915,util[_0xdcef('0x15')](_0xdcef('0x28'),_0x4dc915,_0xc8693c,_0xdcef('0x29')));}else{_0x3dfcc8=path[_0xdcef('0x25')](_0x482dcd,util[_0xdcef('0x15')]('%s.%s',_0x4dc915,'xlsx'));}fs['writeFileSync'](_0x3dfcc8,json2xls(_0x565a31),_0xdcef('0x2a'));}})[_0xdcef('0x13')](function(){if(_0x84beb3){return new Promise(function(_0x2a58f3){zipdir(path[_0xdcef('0x25')](_0x482dcd,_0x4dc915),{'saveTo':path[_0xdcef('0x25')](_0x482dcd,util[_0xdcef('0x15')]('%s.%s',_0x4dc915,_0xdcef('0x2b')))},function(_0x40ec8f,_0x33672c){rimraf(path['join'](_0x482dcd,_0x4dc915),function(){});_0x2a58f3(_0xdcef('0x2c'));});});}})[_0xdcef('0x13')](function(){logger['info'](util[_0xdcef('0x15')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xdcef('0xf')));return analyticExtractedReport(_0xdcef('0x2d'),_0x84beb3?util[_0xdcef('0x15')](_0xdcef('0x2e'),_0x4dc915,_0x84beb3?_0xdcef('0x2b'):'xlsx'):null);});})['catch'](function(_0x51d1aa){logger[_0xdcef('0xd')](util[_0xdcef('0x15')](_0xdcef('0x2f'),EXTRACTED_REPORT_ID,_0xdcef('0xf')),util['inspect'](_0x51d1aa,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xdcef('0x30'));})[_0xdcef('0x31')](function(){process[_0xdcef('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 34269c7..535f884 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 _0x9d1a=['uniq','map','CAST(priority\x20AS\x20UNSIGNED)','groupBy','exten','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','CDR(type)=%s','context','VoiceExtensionId','inbound','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','filter','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','length','answer','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','bulkCreate','sortBy','catch','error','rewrite','lodash','util','Interval','findAll','then','intervals','models','VoiceExtension','IntervalId'];(function(_0x395470,_0x2a58b3){var _0x34bd78=function(_0xdfc301){while(--_0xdfc301){_0x395470['push'](_0x395470['shift']());}};_0x34bd78(++_0x2a58b3);}(_0x9d1a,0xd5));var _0xa9d1=function(_0x1ddb21,_0x2c3404){_0x1ddb21=_0x1ddb21-0x0;var _0x547a7a=_0x9d1a[_0x1ddb21];return _0x547a7a;};'use strict';var _=require(_0xa9d1('0x0'));var util=require(_0xa9d1('0x1'));function rewrite(_0x16d5e3,_0x42c47a){var _0x11632d=this;return _0x16d5e3['models'][_0xa9d1('0x2')][_0xa9d1('0x3')]({'raw':!![]})[_0xa9d1('0x4')](function(_0x2daa9d){_0x11632d[_0xa9d1('0x5')]=_0x2daa9d;return _0x16d5e3[_0xa9d1('0x6')][_0xa9d1('0x7')][_0xa9d1('0x3')]({'where':{'IntervalId':_0x42c47a[_0xa9d1('0x8')]},'raw':!![]});})[_0xa9d1('0x4')](function(_0x54eb34){return _0x16d5e3['models'][_0xa9d1('0x7')][_0xa9d1('0x3')]({'where':{'exten':{'$in':_[_0xa9d1('0x9')](_[_0xa9d1('0xa')](_0x54eb34,'exten'))}},'order':[{'raw':_0xa9d1('0xb')}],'raw':!![]});})[_0xa9d1('0x4')](function(_0x3c3c55){var _0x2f9009=_['filter'](_0x3c3c55,{'priority':'1'});var _0x38d59b=_['filter'](_0x3c3c55,{'isApp':0x1});var _0x52709c=_[_0xa9d1('0xc')](_0x38d59b,_0xa9d1('0xd'));var _0x51e3b1=[_0xa9d1('0xe'),_0xa9d1('0xf')];var _0x9a6b10=[];var _0x256551=[];for(var _0x1e660a in _0x52709c){if(_0x52709c[_0xa9d1('0x10')](_0x1e660a)){_0x11632d[_0xa9d1('0x11')]=0x2;_0x11632d[_0xa9d1('0x12')]=[];_0x11632d[_0xa9d1('0x13')]=_[_0xa9d1('0x14')](_0x2f9009,{'exten':_0x52709c[_0x1e660a][0x0]['exten']});_0x11632d[_0xa9d1('0x12')][_0xa9d1('0x15')]({'type':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x16')],'app':_0xa9d1('0x17'),'appdata':util['format'](_0xa9d1('0x18'),_0x52709c[_0x1e660a][0x0][_0xa9d1('0x16')]),'context':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x19')],'exten':_0x52709c[_0x1e660a][0x0][_0xa9d1('0xd')],'priority':_0x11632d[_0xa9d1('0x11')]++,'VoiceExtensionId':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x1a')]});if(_0x52709c[_0x1e660a][0x0]['type']===_0xa9d1('0x1b')){_0x11632d['extensions'][_0xa9d1('0x15')]({'type':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x16')],'app':'Set','appdata':'CDR(routeid)='+_0x52709c[_0x1e660a][0x0]['VoiceExtensionId'],'context':_0x52709c[_0x1e660a][0x0]['context'],'exten':_0x52709c[_0x1e660a][0x0][_0xa9d1('0xd')],'priority':_0x11632d['priority']++,'VoiceExtensionId':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x1a')]});}else if(_0x52709c[_0x1e660a][0x0][_0xa9d1('0x16')]===_0xa9d1('0x1c')){if(_0x11632d[_0xa9d1('0x13')]){_0x11632d['extensions']['push']({'type':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x16')],'app':'Set','appdata':_0xa9d1('0x1d')+(_0x11632d[_0xa9d1('0x13')][_0xa9d1('0x1e')]?_0xa9d1('0x1f')+_0x11632d[_0xa9d1('0x13')][_0xa9d1('0x1e')]+'}':_0xa9d1('0x20')),'context':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x19')],'exten':_0x52709c[_0x1e660a][0x0][_0xa9d1('0xd')],'priority':_0x11632d[_0xa9d1('0x11')]++,'VoiceExtensionId':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x1a')]});}_0x11632d[_0xa9d1('0x12')][_0xa9d1('0x15')]({'type':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x16')],'app':_0xa9d1('0x17'),'appdata':_0xa9d1('0x21')+_0x52709c[_0x1e660a][0x0][_0xa9d1('0x1a')],'context':_0x52709c[_0x1e660a][0x0]['context'],'exten':_0x52709c[_0x1e660a][0x0][_0xa9d1('0xd')],'priority':_0x11632d[_0xa9d1('0x11')]++,'VoiceExtensionId':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x1a')]});var _0x56f098=_0x11632d[_0xa9d1('0x11')]++;_0x11632d[_0xa9d1('0x12')][_0xa9d1('0x15')]({'type':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x16')],'app':_0xa9d1('0x22'),'appdata':_0xa9d1('0x23')+(_0x56f098+0x2)+_0xa9d1('0x24')+(_0x56f098+0x1)+')','context':_0x52709c[_0x1e660a][0x0]['context'],'exten':_0x52709c[_0x1e660a][0x0][_0xa9d1('0xd')],'priority':_0x56f098,'VoiceExtensionId':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x1a')]});if(_0x11632d['extension']){_0x11632d[_0xa9d1('0x12')][_0xa9d1('0x15')]({'type':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x16')],'app':_0xa9d1('0x17'),'appdata':_0x11632d[_0xa9d1('0x13')][_0xa9d1('0x1e')]?_0xa9d1('0x25')+_0x11632d[_0xa9d1('0x13')]['cutdigits']+'}':_0xa9d1('0x26'),'context':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x19')],'exten':_0x52709c[_0x1e660a][0x0]['exten'],'priority':_0x11632d[_0xa9d1('0x11')]++,'VoiceExtensionId':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x1a')]});}_0x11632d['extensions']['push']({'type':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x16')],'app':_0xa9d1('0x17'),'appdata':'outboundrouteid='+_0x52709c[_0x1e660a][0x0][_0xa9d1('0x1a')],'context':_0x52709c[_0x1e660a][0x0]['context'],'exten':_0x52709c[_0x1e660a][0x0][_0xa9d1('0xd')],'priority':_0x11632d[_0xa9d1('0x11')]++,'VoiceExtensionId':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x1a')]});if(_0x11632d[_0xa9d1('0x13')]&&_0x11632d[_0xa9d1('0x13')][_0xa9d1('0x10')](_0xa9d1('0x27'))&&_0x11632d[_0xa9d1('0x13')][_0xa9d1('0x27')]!==_0xa9d1('0x28')){_0x11632d[_0xa9d1('0x12')][_0xa9d1('0x15')]({'type':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x16')],'app':_0xa9d1('0x17'),'appdata':_0xa9d1('0x29'),'context':_0x52709c[_0x1e660a][0x0]['context'],'exten':_0x52709c[_0x1e660a][0x0][_0xa9d1('0xd')],'priority':_0x11632d[_0xa9d1('0x11')]++,'VoiceExtensionId':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x1a')]});_0x11632d[_0xa9d1('0x12')][_0xa9d1('0x15')]({'type':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x16')],'app':_0xa9d1('0x17'),'appdata':_0xa9d1('0x2a')+_0x11632d[_0xa9d1('0x13')][_0xa9d1('0x27')]||_0xa9d1('0x2b'),'context':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x19')],'exten':_0x52709c[_0x1e660a][0x0][_0xa9d1('0xd')],'priority':_0x11632d[_0xa9d1('0x11')]++,'VoiceExtensionId':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x1a')]});}}_0x11632d[_0xa9d1('0x12')][_0xa9d1('0x15')]({'type':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x16')],'app':_0xa9d1('0x17'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x19')],'exten':_0x52709c[_0x1e660a][0x0][_0xa9d1('0xd')],'priority':_0x11632d[_0xa9d1('0x11')]++,'VoiceExtensionId':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x1a')]});_0x11632d['extensions'][_0xa9d1('0x15')]({'type':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x16')],'app':'Set','appdata':_0xa9d1('0x2c'),'context':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x19')],'exten':_0x52709c[_0x1e660a][0x0]['exten'],'priority':_0x11632d[_0xa9d1('0x11')]++,'VoiceExtensionId':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x1a')]});_0x11632d[_0xa9d1('0x12')][_0xa9d1('0x15')]({'type':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x16')],'app':_0xa9d1('0x17'),'appdata':_0xa9d1('0x2d'),'context':_0x52709c[_0x1e660a][0x0]['context'],'exten':_0x52709c[_0x1e660a][0x0]['exten'],'priority':_0x11632d[_0xa9d1('0x11')]++,'VoiceExtensionId':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x1a')]});for(var _0x127461=0x0,_0x38e472=0x0;_0x127461<_0x52709c[_0x1e660a]['length'];_0x127461+=0x1,_0x38e472=0x0){var _0x3d6fff=_0x52709c[_0x1e660a][_0x127461];if(_0x3d6fff[_0xa9d1('0x16')]){_0x3d6fff[_0xa9d1('0x16')]=_0x3d6fff[_0xa9d1('0x16')][_0xa9d1('0x2e')]();}var _0x2eb6a4=[];var _0x489b53=[];delete _0x3d6fff['id'];delete _0x3d6fff[_0xa9d1('0x2f')];delete _0x3d6fff[_0xa9d1('0x30')];var _0x192f6d=_0x3d6fff['interval']!=='*,*,*,*'?[_0x3d6fff[_0xa9d1('0x31')]]:_0x3d6fff[_0xa9d1('0x8')]?_[_0xa9d1('0xa')](_[_0xa9d1('0x32')](_0x11632d[_0xa9d1('0x5')],{'IntervalId':_0x3d6fff[_0xa9d1('0x8')]}),_0xa9d1('0x31')):[];if(_0x3d6fff['hasOwnProperty']('tag')){if(_0x3d6fff['tag']&&_0x3d6fff[_0xa9d1('0x33')]!=='--'){_0x2eb6a4[_0xa9d1('0x15')]({'type':_0x3d6fff['type'],'app':'Set','appdata':'CDR(tag)='+_0x3d6fff[_0xa9d1('0x33')],'context':_0x3d6fff[_0xa9d1('0x19')],'exten':_0x3d6fff[_0xa9d1('0xd')],'priority':_0x192f6d['length']+_0x11632d[_0xa9d1('0x11')]+_0x38e472++,'VoiceExtensionId':_0x3d6fff[_0xa9d1('0x1a')]});}}if(_0x3d6fff[_0xa9d1('0x16')]===_0xa9d1('0x1c')&&_0x3d6fff[_0xa9d1('0x10')](_0xa9d1('0x34'))){if(_0x3d6fff[_0xa9d1('0x34')]){_0x2eb6a4[_0xa9d1('0x15')]({'type':_0x3d6fff['type'],'app':'ExecIf','appdata':_0xa9d1('0x35')+_0x3d6fff[_0xa9d1('0x34')]+')','context':_0x3d6fff['context'],'exten':_0x3d6fff['exten'],'priority':_0x192f6d['length']+_0x11632d['priority']+_0x38e472++,'VoiceExtensionId':_0x3d6fff[_0xa9d1('0x1a')]});}else{_0x2eb6a4[_0xa9d1('0x15')]({'type':_0x3d6fff[_0xa9d1('0x16')],'app':'ExecIf','appdata':_0xa9d1('0x36'),'context':_0x3d6fff['context'],'exten':_0x3d6fff['exten'],'priority':_0x192f6d[_0xa9d1('0x37')]+_0x11632d['priority']+_0x38e472++,'VoiceExtensionId':_0x3d6fff['VoiceExtensionId']});}}if(_0x3d6fff[_0xa9d1('0x10')](_0xa9d1('0x38'))){if(_0x51e3b1['indexOf'](_0x3d6fff['app'][_0xa9d1('0x2e')]())>=0x0&&_0x3d6fff[_0xa9d1('0x39')]!=='custom'){if(_0x3d6fff[_0xa9d1('0x38')]){_0x2eb6a4[_0xa9d1('0x15')]({'type':_0x3d6fff[_0xa9d1('0x16')],'app':_0xa9d1('0x22'),'appdata':_0xa9d1('0x3a'),'context':_0x3d6fff[_0xa9d1('0x19')],'exten':_0x3d6fff[_0xa9d1('0xd')],'priority':_0x192f6d[_0xa9d1('0x37')]+_0x11632d[_0xa9d1('0x11')]+_0x38e472++,'VoiceExtensionId':_0x3d6fff[_0xa9d1('0x1a')]});_0x2eb6a4['push']({'type':_0x3d6fff[_0xa9d1('0x16')],'app':'Set','appdata':_0xa9d1('0x3b'),'context':_0x3d6fff['context'],'exten':_0x3d6fff['exten'],'priority':_0x192f6d['length']+_0x11632d['priority']+_0x38e472++,'VoiceExtensionId':_0x3d6fff[_0xa9d1('0x1a')]});}else{_0x2eb6a4[_0xa9d1('0x15')]({'type':_0x3d6fff['type'],'app':'ExecIf','appdata':_0xa9d1('0x3c'),'context':_0x3d6fff[_0xa9d1('0x19')],'exten':_0x3d6fff['exten'],'priority':_0x192f6d['length']+_0x11632d['priority']+_0x38e472++,'VoiceExtensionId':_0x3d6fff['VoiceExtensionId']});_0x2eb6a4[_0xa9d1('0x15')]({'type':_0x3d6fff[_0xa9d1('0x16')],'app':_0xa9d1('0x17'),'appdata':_0xa9d1('0x3d'),'context':_0x3d6fff[_0xa9d1('0x19')],'exten':_0x3d6fff['exten'],'priority':_0x192f6d[_0xa9d1('0x37')]+_0x11632d[_0xa9d1('0x11')]+_0x38e472++,'VoiceExtensionId':_0x3d6fff[_0xa9d1('0x1a')]});}}}for(var _0x1035f9=0x0;_0x1035f9<_0x192f6d['length'];_0x1035f9+=0x1){var _0x2e0918=_0x11632d[_0xa9d1('0x11')]+_0x192f6d[_0xa9d1('0x37')];var _0x5b2cac=_0x1035f9===_0x192f6d['length']-0x1?_0x11632d[_0xa9d1('0x11')]+_0x2eb6a4[_0xa9d1('0x37')]+_0x489b53[_0xa9d1('0x37')]+0x2:_0x11632d['priority']+_0x1035f9+0x1;_0x2eb6a4[_0xa9d1('0x3e')](_0x1035f9,0x0,{'type':_0x3d6fff[_0xa9d1('0x16')],'app':_0xa9d1('0x3f'),'appdata':_0x192f6d[_0x1035f9]+'?'+_0x3d6fff[_0xa9d1('0x19')]+_0xa9d1('0x40')+_0x2e0918+':'+_0x3d6fff[_0xa9d1('0x19')]+_0xa9d1('0x40')+_0x5b2cac,'exten':_0x3d6fff[_0xa9d1('0xd')],'context':_0x3d6fff[_0xa9d1('0x19')],'priority':_0x11632d[_0xa9d1('0x11')]+_0x1035f9,'VoiceExtensionId':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x1a')]});}_0x3d6fff[_0xa9d1('0x11')]=_0x2eb6a4[_0xa9d1('0x37')]?_[_0xa9d1('0x41')](_0x2eb6a4)[_0xa9d1('0x11')]+0x1:_0x11632d[_0xa9d1('0x11')];_0x11632d[_0xa9d1('0x11')]=(_0x489b53['length']?_[_0xa9d1('0x41')](_0x489b53)[_0xa9d1('0x11')]:_0x3d6fff[_0xa9d1('0x11')])+0x1;_0x11632d[_0xa9d1('0x12')]=_[_0xa9d1('0x42')](_0x11632d['extensions'],_0x2eb6a4,[_0x3d6fff],_0x489b53);}_0x11632d[_0xa9d1('0x12')]['push']({'type':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x16')],'app':_0xa9d1('0x43'),'exten':_0x52709c[_0x1e660a][0x0][_0xa9d1('0xd')],'context':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x19')],'priority':_0x11632d['priority'],'VoiceExtensionId':_0x52709c[_0x1e660a][0x0][_0xa9d1('0x1a')]});_0x9a6b10[_0xa9d1('0x15')](_0x52709c[_0x1e660a][0x0]['VoiceExtensionId']);_0x256551=_['concat'](_0x256551,_0x11632d[_0xa9d1('0x12')]);}}return _0x16d5e3[_0xa9d1('0x44')](function(_0x2489e2){return _0x16d5e3[_0xa9d1('0x6')][_0xa9d1('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x9a6b10}},'transaction':_0x2489e2})[_0xa9d1('0x4')](function(_0x121bc5){return _0x16d5e3['models'][_0xa9d1('0x7')][_0xa9d1('0x45')](_[_0xa9d1('0x46')](_0x256551,_0xa9d1('0x11')),{'transaction':_0x2489e2});});});})[_0xa9d1('0x47')](function(_0x547170){console[_0xa9d1('0x48')](_0x547170);});}exports[_0xa9d1('0x49')]=rewrite; \ No newline at end of file +var _0x54b7=['IntervalId','then','uniq','CAST(priority\x20AS\x20UNSIGNED)','filter','queue','hasOwnProperty','priority','extensions','extension','find','exten','type','Set','CDR(type)=%s','context','VoiceExtensionId','inbound','push','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','interval','*,*,*,*','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','sortBy','catch','lodash','util','models','Interval','findAll','intervals','VoiceExtension'];(function(_0x526bfd,_0x4dd3b6){var _0x2e3bee=function(_0x1f795c){while(--_0x1f795c){_0x526bfd['push'](_0x526bfd['shift']());}};_0x2e3bee(++_0x4dd3b6);}(_0x54b7,0x148));var _0x754b=function(_0x42c3d7,_0x4b378f){_0x42c3d7=_0x42c3d7-0x0;var _0x3c5c12=_0x54b7[_0x42c3d7];return _0x3c5c12;};'use strict';var _=require(_0x754b('0x0'));var util=require(_0x754b('0x1'));function rewrite(_0x5dc6ec,_0x9d0958){var _0x40f103=this;return _0x5dc6ec[_0x754b('0x2')][_0x754b('0x3')][_0x754b('0x4')]({'raw':!![]})['then'](function(_0x19ac6c){_0x40f103[_0x754b('0x5')]=_0x19ac6c;return _0x5dc6ec[_0x754b('0x2')][_0x754b('0x6')]['findAll']({'where':{'IntervalId':_0x9d0958[_0x754b('0x7')]},'raw':!![]});})[_0x754b('0x8')](function(_0x2e0866){return _0x5dc6ec['models'][_0x754b('0x6')][_0x754b('0x4')]({'where':{'exten':{'$in':_[_0x754b('0x9')](_['map'](_0x2e0866,'exten'))}},'order':[{'raw':_0x754b('0xa')}],'raw':!![]});})[_0x754b('0x8')](function(_0x28c16b){var _0x488315=_[_0x754b('0xb')](_0x28c16b,{'priority':'1'});var _0x599fa3=_[_0x754b('0xb')](_0x28c16b,{'isApp':0x1});var _0x29674d=_['groupBy'](_0x599fa3,'exten');var _0x3cb361=[_0x754b('0xc'),'playback'];var _0x4e20cc=[];var _0x18dcd5=[];for(var _0xbdc0c4 in _0x29674d){if(_0x29674d[_0x754b('0xd')](_0xbdc0c4)){_0x40f103[_0x754b('0xe')]=0x2;_0x40f103[_0x754b('0xf')]=[];_0x40f103[_0x754b('0x10')]=_[_0x754b('0x11')](_0x488315,{'exten':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x12')]});_0x40f103[_0x754b('0xf')]['push']({'type':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x13')],'app':_0x754b('0x14'),'appdata':util['format'](_0x754b('0x15'),_0x29674d[_0xbdc0c4][0x0][_0x754b('0x13')]),'context':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x16')],'exten':_0x29674d[_0xbdc0c4][0x0]['exten'],'priority':_0x40f103[_0x754b('0xe')]++,'VoiceExtensionId':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x17')]});if(_0x29674d[_0xbdc0c4][0x0]['type']===_0x754b('0x18')){_0x40f103[_0x754b('0xf')][_0x754b('0x19')]({'type':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x13')],'app':_0x754b('0x14'),'appdata':_0x754b('0x1a')+_0x29674d[_0xbdc0c4][0x0][_0x754b('0x17')],'context':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x16')],'exten':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x12')],'priority':_0x40f103[_0x754b('0xe')]++,'VoiceExtensionId':_0x29674d[_0xbdc0c4][0x0]['VoiceExtensionId']});}else if(_0x29674d[_0xbdc0c4][0x0][_0x754b('0x13')]===_0x754b('0x1b')){if(_0x40f103[_0x754b('0x10')]){_0x40f103[_0x754b('0xf')][_0x754b('0x19')]({'type':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x13')],'app':_0x754b('0x14'),'appdata':_0x754b('0x1c')+(_0x40f103[_0x754b('0x10')][_0x754b('0x1d')]?_0x754b('0x1e')+_0x40f103[_0x754b('0x10')][_0x754b('0x1d')]+'}':'${EXTEN}'),'context':_0x29674d[_0xbdc0c4][0x0]['context'],'exten':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x12')],'priority':_0x40f103[_0x754b('0xe')]++,'VoiceExtensionId':_0x29674d[_0xbdc0c4][0x0]['VoiceExtensionId']});}_0x40f103['extensions'][_0x754b('0x19')]({'type':_0x29674d[_0xbdc0c4][0x0]['type'],'app':'Set','appdata':_0x754b('0x1a')+_0x29674d[_0xbdc0c4][0x0][_0x754b('0x17')],'context':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x16')],'exten':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x12')],'priority':_0x40f103['priority']++,'VoiceExtensionId':_0x29674d[_0xbdc0c4][0x0]['VoiceExtensionId']});var _0x4ef7b6=_0x40f103[_0x754b('0xe')]++;_0x40f103[_0x754b('0xf')]['push']({'type':_0x29674d[_0xbdc0c4][0x0]['type'],'app':_0x754b('0x1f'),'appdata':_0x754b('0x20')+(_0x4ef7b6+0x2)+'):Goto('+(_0x4ef7b6+0x1)+')','context':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x16')],'exten':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x12')],'priority':_0x4ef7b6,'VoiceExtensionId':_0x29674d[_0xbdc0c4][0x0]['VoiceExtensionId']});if(_0x40f103[_0x754b('0x10')]){_0x40f103[_0x754b('0xf')]['push']({'type':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x13')],'app':'Set','appdata':_0x40f103[_0x754b('0x10')][_0x754b('0x1d')]?_0x754b('0x21')+_0x40f103[_0x754b('0x10')][_0x754b('0x1d')]+'}':'CDR(prefix)=noprefix','context':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x16')],'exten':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x12')],'priority':_0x40f103[_0x754b('0xe')]++,'VoiceExtensionId':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x17')]});}_0x40f103[_0x754b('0xf')][_0x754b('0x19')]({'type':_0x29674d[_0xbdc0c4][0x0]['type'],'app':_0x754b('0x14'),'appdata':_0x754b('0x22')+_0x29674d[_0xbdc0c4][0x0][_0x754b('0x17')],'context':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x16')],'exten':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x12')],'priority':_0x40f103[_0x754b('0xe')]++,'VoiceExtensionId':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x17')]});if(_0x40f103['extension']&&_0x40f103['extension'][_0x754b('0xd')](_0x754b('0x23'))&&_0x40f103[_0x754b('0x10')]['recordingFormat']!=='none'){_0x40f103[_0x754b('0xf')][_0x754b('0x19')]({'type':_0x29674d[_0xbdc0c4][0x0]['type'],'app':'Set','appdata':_0x754b('0x24'),'context':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x16')],'exten':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x12')],'priority':_0x40f103[_0x754b('0xe')]++,'VoiceExtensionId':_0x29674d[_0xbdc0c4][0x0]['VoiceExtensionId']});_0x40f103[_0x754b('0xf')][_0x754b('0x19')]({'type':_0x29674d[_0xbdc0c4][0x0]['type'],'app':'Set','appdata':_0x754b('0x25')+_0x40f103[_0x754b('0x10')][_0x754b('0x23')]||_0x754b('0x26'),'context':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x16')],'exten':_0x29674d[_0xbdc0c4][0x0]['exten'],'priority':_0x40f103[_0x754b('0xe')]++,'VoiceExtensionId':_0x29674d[_0xbdc0c4][0x0]['VoiceExtensionId']});}}_0x40f103[_0x754b('0xf')][_0x754b('0x19')]({'type':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x13')],'app':_0x754b('0x14'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x16')],'exten':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x12')],'priority':_0x40f103[_0x754b('0xe')]++,'VoiceExtensionId':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x17')]});_0x40f103[_0x754b('0xf')][_0x754b('0x19')]({'type':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x13')],'app':'Set','appdata':_0x754b('0x27'),'context':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x16')],'exten':_0x29674d[_0xbdc0c4][0x0]['exten'],'priority':_0x40f103[_0x754b('0xe')]++,'VoiceExtensionId':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x17')]});_0x40f103[_0x754b('0xf')][_0x754b('0x19')]({'type':_0x29674d[_0xbdc0c4][0x0]['type'],'app':'Set','appdata':_0x754b('0x28'),'context':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x16')],'exten':_0x29674d[_0xbdc0c4][0x0]['exten'],'priority':_0x40f103[_0x754b('0xe')]++,'VoiceExtensionId':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x17')]});for(var _0x174b56=0x0,_0x3f8171=0x0;_0x174b56<_0x29674d[_0xbdc0c4][_0x754b('0x29')];_0x174b56+=0x1,_0x3f8171=0x0){var _0x5aad49=_0x29674d[_0xbdc0c4][_0x174b56];if(_0x5aad49[_0x754b('0x13')]){_0x5aad49['type']=_0x5aad49['type'][_0x754b('0x2a')]();}var _0x287893=[];var _0x3d3b60=[];delete _0x5aad49['id'];delete _0x5aad49['createdAt'];delete _0x5aad49['updatedAt'];var _0x29d58d=_0x5aad49[_0x754b('0x2b')]!==_0x754b('0x2c')?[_0x5aad49[_0x754b('0x2b')]]:_0x5aad49[_0x754b('0x7')]?_[_0x754b('0x2d')](_[_0x754b('0xb')](_0x40f103['intervals'],{'IntervalId':_0x5aad49[_0x754b('0x7')]}),'interval'):[];if(_0x5aad49[_0x754b('0xd')]('tag')){if(_0x5aad49[_0x754b('0x2e')]&&_0x5aad49[_0x754b('0x2e')]!=='--'){_0x287893[_0x754b('0x19')]({'type':_0x5aad49[_0x754b('0x13')],'app':_0x754b('0x14'),'appdata':_0x754b('0x2f')+_0x5aad49['tag'],'context':_0x5aad49[_0x754b('0x16')],'exten':_0x5aad49[_0x754b('0x12')],'priority':_0x29d58d[_0x754b('0x29')]+_0x40f103[_0x754b('0xe')]+_0x3f8171++,'VoiceExtensionId':_0x5aad49[_0x754b('0x17')]});}}if(_0x5aad49[_0x754b('0x13')]===_0x754b('0x1b')&&_0x5aad49[_0x754b('0xd')](_0x754b('0x30'))){if(_0x5aad49[_0x754b('0x30')]){_0x287893[_0x754b('0x19')]({'type':_0x5aad49[_0x754b('0x13')],'app':_0x754b('0x1f'),'appdata':_0x754b('0x31')+_0x5aad49['callerID']+')','context':_0x5aad49['context'],'exten':_0x5aad49['exten'],'priority':_0x29d58d['length']+_0x40f103[_0x754b('0xe')]+_0x3f8171++,'VoiceExtensionId':_0x5aad49[_0x754b('0x17')]});}else{_0x287893[_0x754b('0x19')]({'type':_0x5aad49[_0x754b('0x13')],'app':_0x754b('0x1f'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x5aad49[_0x754b('0x16')],'exten':_0x5aad49['exten'],'priority':_0x29d58d[_0x754b('0x29')]+_0x40f103['priority']+_0x3f8171++,'VoiceExtensionId':_0x5aad49[_0x754b('0x17')]});}}if(_0x5aad49[_0x754b('0xd')](_0x754b('0x32'))){if(_0x3cb361[_0x754b('0x33')](_0x5aad49[_0x754b('0x34')][_0x754b('0x2a')]())>=0x0&&_0x5aad49[_0x754b('0x35')]!=='custom'){if(_0x5aad49[_0x754b('0x32')]){_0x287893[_0x754b('0x19')]({'type':_0x5aad49['type'],'app':'ExecIf','appdata':_0x754b('0x36'),'context':_0x5aad49[_0x754b('0x16')],'exten':_0x5aad49['exten'],'priority':_0x29d58d[_0x754b('0x29')]+_0x40f103['priority']+_0x3f8171++,'VoiceExtensionId':_0x5aad49[_0x754b('0x17')]});_0x287893[_0x754b('0x19')]({'type':_0x5aad49[_0x754b('0x13')],'app':_0x754b('0x14'),'appdata':_0x754b('0x37'),'context':_0x5aad49['context'],'exten':_0x5aad49['exten'],'priority':_0x29d58d[_0x754b('0x29')]+_0x40f103[_0x754b('0xe')]+_0x3f8171++,'VoiceExtensionId':_0x5aad49[_0x754b('0x17')]});}else{_0x287893[_0x754b('0x19')]({'type':_0x5aad49[_0x754b('0x13')],'app':_0x754b('0x1f'),'appdata':_0x754b('0x38'),'context':_0x5aad49[_0x754b('0x16')],'exten':_0x5aad49[_0x754b('0x12')],'priority':_0x29d58d[_0x754b('0x29')]+_0x40f103[_0x754b('0xe')]+_0x3f8171++,'VoiceExtensionId':_0x5aad49['VoiceExtensionId']});_0x287893[_0x754b('0x19')]({'type':_0x5aad49[_0x754b('0x13')],'app':_0x754b('0x14'),'appdata':_0x754b('0x39'),'context':_0x5aad49[_0x754b('0x16')],'exten':_0x5aad49['exten'],'priority':_0x29d58d['length']+_0x40f103['priority']+_0x3f8171++,'VoiceExtensionId':_0x5aad49[_0x754b('0x17')]});}}}for(var _0x38aa92=0x0;_0x38aa92<_0x29d58d[_0x754b('0x29')];_0x38aa92+=0x1){var _0x176e10=_0x40f103['priority']+_0x29d58d['length'];var _0x222086=_0x38aa92===_0x29d58d[_0x754b('0x29')]-0x1?_0x40f103['priority']+_0x287893[_0x754b('0x29')]+_0x3d3b60['length']+0x2:_0x40f103[_0x754b('0xe')]+_0x38aa92+0x1;_0x287893[_0x754b('0x3a')](_0x38aa92,0x0,{'type':_0x5aad49[_0x754b('0x13')],'app':_0x754b('0x3b'),'appdata':_0x29d58d[_0x38aa92]+'?'+_0x5aad49[_0x754b('0x16')]+_0x754b('0x3c')+_0x176e10+':'+_0x5aad49[_0x754b('0x16')]+_0x754b('0x3c')+_0x222086,'exten':_0x5aad49[_0x754b('0x12')],'context':_0x5aad49['context'],'priority':_0x40f103[_0x754b('0xe')]+_0x38aa92,'VoiceExtensionId':_0x29674d[_0xbdc0c4][0x0]['VoiceExtensionId']});}_0x5aad49[_0x754b('0xe')]=_0x287893[_0x754b('0x29')]?_['last'](_0x287893)[_0x754b('0xe')]+0x1:_0x40f103['priority'];_0x40f103[_0x754b('0xe')]=(_0x3d3b60[_0x754b('0x29')]?_[_0x754b('0x3d')](_0x3d3b60)[_0x754b('0xe')]:_0x5aad49[_0x754b('0xe')])+0x1;_0x40f103[_0x754b('0xf')]=_[_0x754b('0x3e')](_0x40f103[_0x754b('0xf')],_0x287893,[_0x5aad49],_0x3d3b60);}_0x40f103[_0x754b('0xf')][_0x754b('0x19')]({'type':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x13')],'app':_0x754b('0x3f'),'exten':_0x29674d[_0xbdc0c4][0x0]['exten'],'context':_0x29674d[_0xbdc0c4][0x0][_0x754b('0x16')],'priority':_0x40f103[_0x754b('0xe')],'VoiceExtensionId':_0x29674d[_0xbdc0c4][0x0]['VoiceExtensionId']});_0x4e20cc[_0x754b('0x19')](_0x29674d[_0xbdc0c4][0x0][_0x754b('0x17')]);_0x18dcd5=_[_0x754b('0x3e')](_0x18dcd5,_0x40f103[_0x754b('0xf')]);}}return _0x5dc6ec['transaction'](function(_0x40d2af){return _0x5dc6ec[_0x754b('0x2')][_0x754b('0x6')][_0x754b('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x4e20cc}},'transaction':_0x40d2af})['then'](function(_0x4d03ca){return _0x5dc6ec[_0x754b('0x2')][_0x754b('0x6')]['bulkCreate'](_[_0x754b('0x41')](_0x18dcd5,_0x754b('0xe')),{'transaction':_0x40d2af});});});})[_0x754b('0x42')](function(_0x4a4572){console['error'](_0x4a4572);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 280e46b..4ec07cf 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 _0x92ce=['errors','length','join','hasOwnProperty','data','firstName','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!','Duplicate\x20Contact','CmContact','create','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','insert','into','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','NOW()','field','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper','\x20=\x20?','str','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','ListId\x20=\x20?','id\x20IN\x20?','cm_hopper_black','VoiceQueue','CmList','Lists','get','dialCheckDuplicateType','always','push','sequelize','onlyIfOpen','query','VoiceQueueId','all','findAll','outbound','BlackLists','Campaign','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','resolve','exit','SIGINT','info','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','split','Missing\x20socket_timestamp\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!'];(function(_0x4490a2,_0x17070a){var _0x4981a8=function(_0x47c6a0){while(--_0x47c6a0){_0x4490a2['push'](_0x4490a2['shift']());}};_0x4981a8(++_0x17070a);}(_0x92ce,0x12c));var _0xe92c=function(_0x335aff,_0xb450b1){_0x335aff=_0x335aff-0x0;var _0x1e87ce=_0x92ce[_0x335aff];return _0x1e87ce;};'use strict';var BPromise=require(_0xe92c('0x0'));var util=require(_0xe92c('0x1'));var _=require(_0xe92c('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0xe92c('0x3'));var db=require(_0xe92c('0x4'))['db'];var config=require(_0xe92c('0x5'));var logger=require(_0xe92c('0x6'))(_0xe92c('0x7'));config[_0xe92c('0x8')]=_[_0xe92c('0x9')](config[_0xe92c('0x8')],{'host':_0xe92c('0xa'),'port':0x18eb});var socket=require(_0xe92c('0xb'))(new Redis(config[_0xe92c('0x8')]));require(_0xe92c('0xc'))['register'](socket);try{if(!process[_0xe92c('0xd')][0x2]||process[_0xe92c('0xd')][0x2]===_0xe92c('0xe')||process[_0xe92c('0xd')][0x2]===_0xe92c('0xf')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xe92c('0xd')][0x2];if(!process[_0xe92c('0xd')][0x3]||process[_0xe92c('0xd')][0x3]===_0xe92c('0xe')||process[_0xe92c('0xd')][0x3]===_0xe92c('0xf')||!process[_0xe92c('0xd')][0x4]||process[_0xe92c('0xd')][0x4]==='undefined'||process[_0xe92c('0xd')][0x4]===_0xe92c('0xf')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process[_0xe92c('0xd')][0x3][_0xe92c('0x10')](','),process[_0xe92c('0xd')][0x4][_0xe92c('0x10')](','));if(!process[_0xe92c('0xd')][0x5]||process[_0xe92c('0xd')][0x5]==='undefined'||process['argv'][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xe92c('0xd')][0x5];var COMPANYID=process[_0xe92c('0xd')][0x6]&&process[_0xe92c('0xd')][0x6]!=='undefined'&&process[_0xe92c('0xd')][0x6]!==_0xe92c('0xf')?process['argv'][0x6]:null;var DUPLICATES=process[_0xe92c('0xd')][0x7]&&process[_0xe92c('0xd')][0x7]!==_0xe92c('0xe')&&process['argv'][0x7]!==_0xe92c('0xf')?process[_0xe92c('0xd')][0x7]:null;if(!process[_0xe92c('0xd')][0x8]||process['argv'][0x8]===_0xe92c('0xe')||process['argv'][0x8]==='null'){throw new Error(_0xe92c('0x11'));}var SOCKET_TIMESTAMP=process[_0xe92c('0xd')][0x8];}catch(_0x2b23cd){logger['error'](_0x2b23cd);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(_0x512bda,_0x3bfed1,_0x29cb94,_0x3540b0){var _0x5f538d={'message':_0x3bfed1};_0x5f538d[_0x512bda]=!![];if(_0x29cb94){_0x5f538d[_0xe92c('0x12')]=_0x29cb94;}if(_0x3540b0){_0x5f538d[_0xe92c('0x13')]=_0x3540b0;}return _0x5f538d;}function isEmail(_0x42bbf6){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))*$/[_0xe92c('0x14')](_0x42bbf6);}function checkRow(_0x3a0992,_0x14b8d7,_0x33d6f7){return new BPromise(function(_0x2cdfaa,_0x3b2a4f){if(_[_0xe92c('0x15')](_0x3a0992)){return _0x3b2a4f(handleCheckRowError(_0xe92c('0x16'),_0xe92c('0x17'),null,_0x33d6f7));}if(_0x3a0992['errors']&&_0x3a0992[_0xe92c('0x18')][_0xe92c('0x19')]){var _0x390cd4=_['map'](_0x3a0992[_0xe92c('0x18')],'message')[_0xe92c('0x1a')](';');return _0x3b2a4f(handleCheckRowError(_0xe92c('0x16'),_0x390cd4,null,_0x33d6f7));}var _0x507599={};for(var _0x29fbb6 in FIELDS){if(FIELDS[_0xe92c('0x1b')](_0x29fbb6)&&FIELDS[_0x29fbb6]){_0x507599[_0x29fbb6]=_0x3a0992[_0xe92c('0x1c')][0x0][FIELDS[_0x29fbb6]]||_0x3a0992[_0xe92c('0x1c')][0x0]['\ufeff'+FIELDS[_0x29fbb6]];}}if(!_0x507599[_0xe92c('0x1d')]){return _0x3b2a4f(handleCheckRowError(_0xe92c('0x16'),_0xe92c('0x1e'),null,_0x33d6f7));}if(!_0x507599[_0xe92c('0x1f')]){return _0x3b2a4f(handleCheckRowError(_0xe92c('0x16'),_0xe92c('0x20'),null,_0x33d6f7));}if(_0x507599[_0xe92c('0x21')]){var _0x236024=moment(_0x507599[_0xe92c('0x21')],_0xe92c('0x22'));if(!_0x236024['isValid']()){return _0x3b2a4f(handleCheckRowError(_0xe92c('0x16'),_0xe92c('0x23'),null,_0x33d6f7));}}if(_0x507599[_0xe92c('0x24')]){if(!isEmail(_0x507599[_0xe92c('0x24')])){return _0x3b2a4f(handleCheckRowError(_0xe92c('0x16'),_0xe92c('0x25'),null,_0x33d6f7));}}_0x507599['ListId']=LISTID;_0x507599['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xe92c('0x19')]&&_0x14b8d7){var _0x473442={};for(var _0xf494b=0x0,_0x580983=DUPLICATES[_0xe92c('0x19')];_0xf494b<_0x580983;_0xf494b+=0x1){_0x473442[DUPLICATES[_0xf494b]]=_0x507599[DUPLICATES[_0xf494b]];}var _0x54809c=_['find'](_0x14b8d7,_0x473442);if(_0x54809c){return _0x3b2a4f(handleCheckRowError('duplicate',_0xe92c('0x26'),_0x54809c,_0x33d6f7));}}return db[_0xe92c('0x27')][_0xe92c('0x28')](_0x507599,{'raw':!![],'hooks':![],'fields':_[_0xe92c('0x29')](_0x507599)})[_0xe92c('0x2a')](function(_0x25f4ac){if(DUPLICATES&&DUPLICATES[_0xe92c('0x19')]&&_0x14b8d7){_0x14b8d7['push'](_[_0xe92c('0x2b')](_0x507599,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x25f4ac['id'];return _0x2cdfaa();})[_0xe92c('0x2c')](function(_0x4883db){return _0x3b2a4f(handleCheckRowError('error',_0xe92c('0x2d')+(_0x4883db[_0xe92c('0x2e')]||JSON[_0xe92c('0x2f')](_0x4883db)),null,_0x33d6f7));});});}function checkHopper(){function _0x370469(){return function(_0x1aca9d){logger[_0xe92c('0x16')](_0xe92c('0x30'),_0xe92c('0x31'),util[_0xe92c('0x32')](_0x1aca9d,{'showHidden':![],'depth':null}));};}var _0x3efcb5=function(_0x5a598a,_0x53c0ab){var _0x36aeef=squel[_0xe92c('0x33')]()[_0xe92c('0x34')]('cm_hopper')[_0xe92c('0x35')]([_0xe92c('0x1f'),_0xe92c('0x36'),_0xe92c('0x37'),_0xe92c('0x38'),_0x53c0ab,_0xe92c('0x39'),_0xe92c('0x3a')],squel[_0xe92c('0x3b')]()['field'](_0xe92c('0x1f'),'phone')['field'](_0xe92c('0x3c'),'scheduledAt')[_0xe92c('0x3d')]('id',_0xe92c('0x37'))[_0xe92c('0x3d')](LISTID['toString'](),_0xe92c('0x38'))[_0xe92c('0x3d')](_0x5a598a['id'][_0xe92c('0x3e')](),_0x53c0ab)[_0xe92c('0x3d')]('NOW()','createdAt')[_0xe92c('0x3d')](_0xe92c('0x3c'),_0xe92c('0x3a'))[_0xe92c('0x3f')](_0xe92c('0x40'))[_0xe92c('0x41')](_0xe92c('0x42'))['where']('ListId\x20=\x20?',LISTID['toString']())[_0xe92c('0x41')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xe92c('0x43'),squel[_0xe92c('0x3b')]()[_0xe92c('0x3d')](_0xe92c('0x1f'))[_0xe92c('0x3f')](_0xe92c('0x44'))[_0xe92c('0x41')](_0x53c0ab+_0xe92c('0x45'),_0x5a598a['id'][_0xe92c('0x3e')]())))[_0xe92c('0x3e')]();return _0x36aeef;};var _0x25f4a2=function(_0xd4e07c,_0x5f3b9b){var _0x1b0104=squel[_0xe92c('0x33')]()[_0xe92c('0x34')]('cm_hopper')[_0xe92c('0x35')](['phone',_0xe92c('0x36'),_0xe92c('0x37'),'ListId',_0x5f3b9b,_0xe92c('0x39'),_0xe92c('0x3a')],squel[_0xe92c('0x3b')]()[_0xe92c('0x3d')]('phone',_0xe92c('0x1f'))['field']('NOW()','scheduledAt')[_0xe92c('0x3d')]('id',_0xe92c('0x37'))['field'](LISTID[_0xe92c('0x3e')](),_0xe92c('0x38'))[_0xe92c('0x3d')](_0xd4e07c['id'][_0xe92c('0x3e')](),_0x5f3b9b)[_0xe92c('0x3d')]('NOW()',_0xe92c('0x39'))[_0xe92c('0x3d')](_0xe92c('0x3c'),_0xe92c('0x3a'))['from'](_0xe92c('0x40'))[_0xe92c('0x41')]('deletedAt\x20IS\x20NULL')[_0xe92c('0x41')]('ListId\x20=\x20?',LISTID[_0xe92c('0x3e')]())[_0xe92c('0x41')]('id\x20IN\x20?',squel[_0xe92c('0x46')](hopperContacts))['where'](_0xe92c('0x47'))['where'](_0xe92c('0x43'),squel[_0xe92c('0x3b')]()[_0xe92c('0x3d')]('calleridnum')[_0xe92c('0x3f')](_0xe92c('0x48'))[_0xe92c('0x41')](_0x5f3b9b+_0xe92c('0x45'),_0xd4e07c['id'][_0xe92c('0x3e')]()))[_0xe92c('0x41')](_0xe92c('0x43'),squel[_0xe92c('0x3b')]()[_0xe92c('0x3d')](_0xe92c('0x1f'))[_0xe92c('0x3f')](_0xe92c('0x44'))[_0xe92c('0x41')](_0x5f3b9b+_0xe92c('0x45'),_0xd4e07c['id'][_0xe92c('0x3e')]())))[_0xe92c('0x3e')]();return _0x1b0104;};function _0x564204(_0x5d9744,_0x18d3d4){var _0x742595=squel[_0xe92c('0x33')]()[_0xe92c('0x34')]('cm_hopper')[_0xe92c('0x35')]([_0xe92c('0x1f'),_0xe92c('0x36'),_0xe92c('0x37'),_0xe92c('0x38'),_0x18d3d4,_0xe92c('0x39'),_0xe92c('0x3a')],squel[_0xe92c('0x3b')]()[_0xe92c('0x3d')](_0xe92c('0x1f'),_0xe92c('0x1f'))[_0xe92c('0x3d')]('NOW()',_0xe92c('0x36'))['field']('id',_0xe92c('0x37'))[_0xe92c('0x3d')](LISTID[_0xe92c('0x3e')](),_0xe92c('0x38'))[_0xe92c('0x3d')](_0x5d9744['id'][_0xe92c('0x3e')](),_0x18d3d4)[_0xe92c('0x3d')](_0xe92c('0x3c'),_0xe92c('0x39'))[_0xe92c('0x3d')](_0xe92c('0x3c'),_0xe92c('0x3a'))[_0xe92c('0x3f')]('cm_contacts')[_0xe92c('0x41')]('deletedAt\x20IS\x20NULL')[_0xe92c('0x41')](_0xe92c('0x49'),LISTID[_0xe92c('0x3e')]())[_0xe92c('0x41')](_0xe92c('0x4a'),squel[_0xe92c('0x46')](hopperContacts))[_0xe92c('0x41')]('phone\x20IS\x20NOT\x20NULL'))[_0xe92c('0x3e')]();return _0x742595;}function _0x223fca(_0x15225c,_0xdee50){var _0x5e5559=squel[_0xe92c('0x33')]()['into'](_0xe92c('0x4b'))[_0xe92c('0x35')]([_0xe92c('0x1f'),_0xe92c('0x37'),_0xe92c('0x38'),_0xdee50,'createdAt',_0xe92c('0x3a')],squel[_0xe92c('0x3b')]()[_0xe92c('0x3d')](_0xe92c('0x1f'),_0xe92c('0x1f'))[_0xe92c('0x3d')]('id','ContactId')['field'](LISTID[_0xe92c('0x3e')](),'ListId')[_0xe92c('0x3d')](_0x15225c['id'][_0xe92c('0x3e')](),_0xdee50)[_0xe92c('0x3d')](_0xe92c('0x3c'),'createdAt')[_0xe92c('0x3d')](_0xe92c('0x3c'),'updatedAt')[_0xe92c('0x3f')](_0xe92c('0x40'))['where'](_0xe92c('0x42'))[_0xe92c('0x41')]('ListId\x20=\x20?',LISTID['toString']())[_0xe92c('0x41')]('id\x20IN\x20?',squel[_0xe92c('0x46')](hopperContacts))[_0xe92c('0x41')](_0xe92c('0x47')))[_0xe92c('0x3e')]();return _0x5e5559;}return db[_0xe92c('0x4c')]['findAll']({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xe92c('0x4d')],'as':_0xe92c('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x3d4da0){var _0x252911=[];if(_0x3d4da0){var _0x11db0c;for(var _0x3bf4d8=0x0,_0x14d1cd;_0x3bf4d8<_0x3d4da0['length'];_0x3bf4d8+=0x1){_0x14d1cd=_0x3d4da0[_0x3bf4d8][_0xe92c('0x4f')]({'plain':!![]});switch(_0x14d1cd[_0xe92c('0x50')]){case _0xe92c('0x51'):_0x252911[_0xe92c('0x52')](db[_0xe92c('0x53')]['query'](_0x25f4a2(_0x14d1cd,'VoiceQueueId'))[_0xe92c('0x2a')](function(){})[_0xe92c('0x2c')](_0x370469()));break;case _0xe92c('0x54'):_0x252911[_0xe92c('0x52')](db[_0xe92c('0x53')][_0xe92c('0x55')](_0x3efcb5(_0x14d1cd,_0xe92c('0x56')))[_0xe92c('0x2a')](function(){})[_0xe92c('0x2c')](_0x370469()));break;default:_0x252911[_0xe92c('0x52')](db[_0xe92c('0x53')][_0xe92c('0x55')](_0x564204(_0x14d1cd,_0xe92c('0x56')))[_0xe92c('0x2a')](function(){})[_0xe92c('0x2c')](_0x370469()));}}}return _0x252911;})[_0xe92c('0x57')]()[_0xe92c('0x2a')](function(){return db[_0xe92c('0x4c')][_0xe92c('0x58')]({'where':{'type':_0xe92c('0x59')},'attributes':['id'],'include':[{'model':db[_0xe92c('0x4d')],'as':_0xe92c('0x5a'),'where':{'id':LISTID}}]})['then'](function(_0x4a1b74){var _0x2531a9=[];if(_0x4a1b74){var _0x104dd0;for(var _0x5c85ca=0x0,_0xd5c34f;_0x5c85ca<_0x4a1b74[_0xe92c('0x19')];_0x5c85ca+=0x1){_0xd5c34f=_0x4a1b74[_0x5c85ca]['get']({'plain':!![]});_0x2531a9[_0xe92c('0x52')](db['sequelize'][_0xe92c('0x55')](_0x223fca(_0xd5c34f,_0xe92c('0x56')))[_0xe92c('0x2a')](function(){})[_0xe92c('0x2c')](_0x370469()));}}return _0x2531a9;})[_0xe92c('0x57')]();})['then'](function(){return db[_0xe92c('0x5b')][_0xe92c('0x58')]({'attributes':['id',_0xe92c('0x50')],'include':[{'model':db[_0xe92c('0x4d')],'as':_0xe92c('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x4c189a){var _0x11706d=[];if(_0x4c189a){for(var _0x3f0604=0x0,_0x17be8e;_0x3f0604<_0x4c189a[_0xe92c('0x19')];_0x3f0604+=0x1){_0x17be8e=_0x4c189a[_0x3f0604][_0xe92c('0x4f')]({'plain':!![]});switch(_0x17be8e[_0xe92c('0x50')]){case _0xe92c('0x51'):_0x11706d[_0xe92c('0x52')](db['sequelize']['query'](_0x25f4a2(_0x17be8e,_0xe92c('0x5c')))[_0xe92c('0x2a')](function(){})[_0xe92c('0x2c')](_0x370469()));break;case _0xe92c('0x54'):_0x11706d['push'](db[_0xe92c('0x53')][_0xe92c('0x55')](_0x3efcb5(_0x17be8e,_0xe92c('0x5c')))[_0xe92c('0x2a')](function(){})[_0xe92c('0x2c')](_0x370469()));break;default:_0x11706d[_0xe92c('0x52')](db['sequelize']['query'](_0x564204(_0x17be8e,_0xe92c('0x5c')))['then'](function(){})[_0xe92c('0x2c')](_0x370469()));}}}return _0x11706d;})[_0xe92c('0x57')]();})[_0xe92c('0x2a')](function(){return db[_0xe92c('0x5b')][_0xe92c('0x58')]({'attributes':['id'],'include':[{'model':db[_0xe92c('0x4d')],'as':_0xe92c('0x5a'),'where':{'id':LISTID}}]})['then'](function(_0x510cba){var _0x398898=[];if(_0x510cba){for(var _0x1a0c88=0x0,_0x1401e8;_0x1a0c88<_0x510cba['length'];_0x1a0c88+=0x1){_0x1401e8=_0x510cba[_0x1a0c88][_0xe92c('0x4f')]({'plain':!![]});_0x398898[_0xe92c('0x52')](db[_0xe92c('0x53')]['query'](_0x223fca(_0x1401e8,_0xe92c('0x5c')))[_0xe92c('0x2a')](function(){})['catch'](_0x370469()));}}return _0x398898;})[_0xe92c('0x57')]();})[_0xe92c('0x2c')](function(_0xed8c13){logger[_0xe92c('0x16')]('cmContact,\x20%s,\x20%s',_0xe92c('0x5d'),_0xed8c13[_0xe92c('0x2e')]);});}var processPromises=function(_0x22d6db){return BPromise[_0xe92c('0x57')](promises)['then'](function(_0x487685){})[_0xe92c('0x2c')](function(_0x16dbaf){logger['error'](_0xe92c('0x5e'),JSON[_0xe92c('0x2f')](_0x16dbaf));})['finally'](function(){socket[_0xe92c('0x5f')](_0xe92c('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x22d6db){return _0x22d6db[_0xe92c('0x61')]();}});};var endCsv=function(){return BPromise[_0xe92c('0x62')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xe92c('0x2a')](function(){socket[_0xe92c('0x5f')](_0xe92c('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x553f87){logger[_0xe92c('0x16')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xe92c('0x2f')](_0x553f87));}finally{process[_0xe92c('0x63')](0x0);}});};process['on'](_0xe92c('0x64'),function(){logger[_0xe92c('0x65')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xe92c('0x62')]()[_0xe92c('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xe92c('0x10')](',');return db[_0xe92c('0x27')][_0xe92c('0x58')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xe92c('0x2a')](function(_0x38e3aa){var _0x4d930d=fs[_0xe92c('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xe92c('0x67')](_0x4d930d,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3f9783,_0x5a386c){total+=0x1;var _0x245fc5=total;promises['push'](checkRow(_0x3f9783,_0x38e3aa,_0x245fc5)[_0xe92c('0x2a')](function(){success+=0x1;})[_0xe92c('0x2c')](function(_0x21579d){if(_0x21579d[_0xe92c('0x16')]){errors+=0x1;delete _0x21579d[_0xe92c('0x16')];}else if(_0x21579d['duplicate']){duplicates+=0x1;delete _0x21579d['duplicate'];}rows['push'](_0x21579d);}));if(total%0xc8===0x0){_0x5a386c[_0xe92c('0x68')]();return processPromises(_0x5a386c);}},'complete':function(){return processPromises()[_0xe92c('0x2a')](function(){logger[_0xe92c('0x65')](_0xe92c('0x69'));endCsv();});},'error':function(_0x1208ad,_0x41e56a){logger[_0xe92c('0x65')](_0xe92c('0x6a'),JSON[_0xe92c('0x2f')](_0x1208ad));endCsv();}});})['catch'](function(_0xf00ebf){logger['error'](_0xe92c('0x6b'),JSON[_0xe92c('0x2f')](_0xf00ebf));});}main(); \ No newline at end of file +var _0xf5e2=['pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','isNil','errors','length','map','error','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','duplicate','Duplicate\x20Contact','CmContact','keys','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','cm_hopper_final','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','then','get','always','sequelize','query','onlyIfOpen','VoiceQueueId','all','VoiceQueue','CmList','BlackLists','CampaignId','Campaign','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xf5e2,0x150));var _0x2f5e=function(_0x47556e,_0x41f32e){_0x47556e=_0x47556e-0x0;var _0x47a105=_0xf5e2[_0x47556e];return _0x47a105;};'use strict';var BPromise=require(_0x2f5e('0x0'));var util=require('util');var _=require(_0x2f5e('0x1'));var fs=require('fs');var squel=require(_0x2f5e('0x2'));var Papa=require('papaparse');var Redis=require(_0x2f5e('0x3'));var db=require(_0x2f5e('0x4'))['db'];var config=require(_0x2f5e('0x5'));var logger=require(_0x2f5e('0x6'))('api');config[_0x2f5e('0x7')]=_[_0x2f5e('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2f5e('0x9'))(new Redis(config['redis']));require(_0x2f5e('0xa'))[_0x2f5e('0xb')](socket);try{if(!process[_0x2f5e('0xc')][0x2]||process['argv'][0x2]===_0x2f5e('0xd')||process[_0x2f5e('0xc')][0x2]===_0x2f5e('0xe')){throw new Error(_0x2f5e('0xf'));}var FILEPATH=process[_0x2f5e('0xc')][0x2];if(!process[_0x2f5e('0xc')][0x3]||process[_0x2f5e('0xc')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process[_0x2f5e('0xc')][0x4]||process[_0x2f5e('0xc')][0x4]==='undefined'||process[_0x2f5e('0xc')][0x4]==='null'){throw new Error(_0x2f5e('0x10'));}var FIELDS=_[_0x2f5e('0x11')](process[_0x2f5e('0xc')][0x3][_0x2f5e('0x12')](','),process[_0x2f5e('0xc')][0x4][_0x2f5e('0x12')](','));if(!process[_0x2f5e('0xc')][0x5]||process[_0x2f5e('0xc')][0x5]==='undefined'||process[_0x2f5e('0xc')][0x5]==='null'){throw new Error(_0x2f5e('0x13'));}var LISTID=process[_0x2f5e('0xc')][0x5];var COMPANYID=process[_0x2f5e('0xc')][0x6]&&process['argv'][0x6]!==_0x2f5e('0xd')&&process['argv'][0x6]!==_0x2f5e('0xe')?process['argv'][0x6]:null;var DUPLICATES=process[_0x2f5e('0xc')][0x7]&&process[_0x2f5e('0xc')][0x7]!=='undefined'&&process[_0x2f5e('0xc')][0x7]!==_0x2f5e('0xe')?process['argv'][0x7]:null;if(!process[_0x2f5e('0xc')][0x8]||process[_0x2f5e('0xc')][0x8]==='undefined'||process['argv'][0x8]===_0x2f5e('0xe')){throw new Error(_0x2f5e('0x14'));}var SOCKET_TIMESTAMP=process[_0x2f5e('0xc')][0x8];}catch(_0x84b5e1){logger['error'](_0x84b5e1);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(_0x1ec82b,_0x2b5f25,_0x4bd04b,_0x66d485){var _0xc6b815={'message':_0x2b5f25};_0xc6b815[_0x1ec82b]=!![];if(_0x4bd04b){_0xc6b815[_0x2f5e('0x15')]=_0x4bd04b;}if(_0x66d485){_0xc6b815[_0x2f5e('0x16')]=_0x66d485;}return _0xc6b815;}function isEmail(_0x246df6){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))*$/[_0x2f5e('0x17')](_0x246df6);}function checkRow(_0xfe030a,_0x471f45,_0x50c9fc){return new BPromise(function(_0x10abbe,_0x4eeea4){if(_[_0x2f5e('0x18')](_0xfe030a)){return _0x4eeea4(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x50c9fc));}if(_0xfe030a[_0x2f5e('0x19')]&&_0xfe030a[_0x2f5e('0x19')][_0x2f5e('0x1a')]){var _0x4a97ee=_[_0x2f5e('0x1b')](_0xfe030a[_0x2f5e('0x19')],'message')['join'](';');return _0x4eeea4(handleCheckRowError(_0x2f5e('0x1c'),_0x4a97ee,null,_0x50c9fc));}var _0x59a6e3={};for(var _0x27feb6 in FIELDS){if(FIELDS[_0x2f5e('0x1d')](_0x27feb6)&&FIELDS[_0x27feb6]){_0x59a6e3[_0x27feb6]=_0xfe030a['data'][0x0][FIELDS[_0x27feb6]]||_0xfe030a[_0x2f5e('0x1e')][0x0]['\ufeff'+FIELDS[_0x27feb6]];}}if(!_0x59a6e3[_0x2f5e('0x1f')]){return _0x4eeea4(handleCheckRowError(_0x2f5e('0x1c'),_0x2f5e('0x20'),null,_0x50c9fc));}if(!_0x59a6e3[_0x2f5e('0x21')]){return _0x4eeea4(handleCheckRowError('error',_0x2f5e('0x22'),null,_0x50c9fc));}if(_0x59a6e3[_0x2f5e('0x23')]){var _0x354c81=moment(_0x59a6e3['birthDate'],_0x2f5e('0x24'));if(!_0x354c81[_0x2f5e('0x25')]()){return _0x4eeea4(handleCheckRowError(_0x2f5e('0x1c'),_0x2f5e('0x26'),null,_0x50c9fc));}}if(_0x59a6e3[_0x2f5e('0x27')]){if(!isEmail(_0x59a6e3[_0x2f5e('0x27')])){return _0x4eeea4(handleCheckRowError(_0x2f5e('0x1c'),_0x2f5e('0x28'),null,_0x50c9fc));}}_0x59a6e3['ListId']=LISTID;_0x59a6e3['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x2f5e('0x1a')]&&_0x471f45){var _0xba51b6={};for(var _0x3539f6=0x0,_0x344322=DUPLICATES[_0x2f5e('0x1a')];_0x3539f6<_0x344322;_0x3539f6+=0x1){_0xba51b6[DUPLICATES[_0x3539f6]]=_0x59a6e3[DUPLICATES[_0x3539f6]];}var _0x90e42c=_['find'](_0x471f45,_0xba51b6);if(_0x90e42c){return _0x4eeea4(handleCheckRowError(_0x2f5e('0x29'),_0x2f5e('0x2a'),_0x90e42c,_0x50c9fc));}}return db[_0x2f5e('0x2b')]['create'](_0x59a6e3,{'raw':!![],'hooks':![],'fields':_[_0x2f5e('0x2c')](_0x59a6e3)})['then'](function(_0x42c8a3){if(DUPLICATES&&DUPLICATES[_0x2f5e('0x1a')]&&_0x471f45){_0x471f45[_0x2f5e('0x2d')](_[_0x2f5e('0x2e')](_0x59a6e3,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x42c8a3['id'];return _0x10abbe();})[_0x2f5e('0x2f')](function(_0xb301ff){return _0x4eeea4(handleCheckRowError('error',_0x2f5e('0x30')+(_0xb301ff[_0x2f5e('0x31')]||JSON[_0x2f5e('0x32')](_0xb301ff)),null,_0x50c9fc));});});}function checkHopper(){function _0x54a700(){return function(_0x497d4e){logger[_0x2f5e('0x1c')](_0x2f5e('0x33'),_0x2f5e('0x34'),util[_0x2f5e('0x35')](_0x497d4e,{'showHidden':![],'depth':null}));};}var _0xb7f421=function(_0x48a9fa,_0x2322cc){var _0x2e3708=squel[_0x2f5e('0x36')]()[_0x2f5e('0x37')](_0x2f5e('0x38'))[_0x2f5e('0x39')]([_0x2f5e('0x21'),_0x2f5e('0x3a'),_0x2f5e('0x3b'),_0x2f5e('0x3c'),_0x2322cc,_0x2f5e('0x3d'),_0x2f5e('0x3e')],squel[_0x2f5e('0x3f')]()[_0x2f5e('0x40')](_0x2f5e('0x21'),_0x2f5e('0x21'))[_0x2f5e('0x40')](_0x2f5e('0x41'),_0x2f5e('0x3a'))[_0x2f5e('0x40')]('id',_0x2f5e('0x3b'))[_0x2f5e('0x40')](LISTID[_0x2f5e('0x42')](),_0x2f5e('0x3c'))[_0x2f5e('0x40')](_0x48a9fa['id'][_0x2f5e('0x42')](),_0x2322cc)['field'](_0x2f5e('0x41'),_0x2f5e('0x3d'))['field'](_0x2f5e('0x41'),_0x2f5e('0x3e'))[_0x2f5e('0x43')](_0x2f5e('0x44'))['where']('deletedAt\x20IS\x20NULL')[_0x2f5e('0x45')](_0x2f5e('0x46'),LISTID[_0x2f5e('0x42')]())['where'](_0x2f5e('0x47'))[_0x2f5e('0x45')](_0x2f5e('0x48'),squel[_0x2f5e('0x3f')]()[_0x2f5e('0x40')]('phone')[_0x2f5e('0x43')](_0x2f5e('0x38'))[_0x2f5e('0x45')](_0x2322cc+_0x2f5e('0x49'),_0x48a9fa['id'][_0x2f5e('0x42')]())))[_0x2f5e('0x42')]();return _0x2e3708;};var _0x551cba=function(_0x57cbd6,_0x57cc9a){var _0x4fa2d7=squel[_0x2f5e('0x36')]()['into'](_0x2f5e('0x38'))['fromQuery']([_0x2f5e('0x21'),_0x2f5e('0x3a'),_0x2f5e('0x3b'),'ListId',_0x57cc9a,_0x2f5e('0x3d'),'updatedAt'],squel[_0x2f5e('0x3f')]()[_0x2f5e('0x40')](_0x2f5e('0x21'),'phone')[_0x2f5e('0x40')](_0x2f5e('0x41'),_0x2f5e('0x3a'))[_0x2f5e('0x40')]('id',_0x2f5e('0x3b'))[_0x2f5e('0x40')](LISTID[_0x2f5e('0x42')](),_0x2f5e('0x3c'))['field'](_0x57cbd6['id'][_0x2f5e('0x42')](),_0x57cc9a)['field'](_0x2f5e('0x41'),_0x2f5e('0x3d'))[_0x2f5e('0x40')]('NOW()','updatedAt')[_0x2f5e('0x43')](_0x2f5e('0x44'))['where'](_0x2f5e('0x4a'))[_0x2f5e('0x45')](_0x2f5e('0x46'),LISTID[_0x2f5e('0x42')]())[_0x2f5e('0x45')](_0x2f5e('0x4b'),squel[_0x2f5e('0x4c')](hopperContacts))[_0x2f5e('0x45')](_0x2f5e('0x47'))[_0x2f5e('0x45')](_0x2f5e('0x48'),squel['select']()[_0x2f5e('0x40')]('calleridnum')[_0x2f5e('0x43')](_0x2f5e('0x4d'))[_0x2f5e('0x45')](_0x57cc9a+_0x2f5e('0x49'),_0x57cbd6['id']['toString']()))[_0x2f5e('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2f5e('0x3f')]()[_0x2f5e('0x40')](_0x2f5e('0x21'))['from'](_0x2f5e('0x38'))['where'](_0x57cc9a+_0x2f5e('0x49'),_0x57cbd6['id'][_0x2f5e('0x42')]())))['toString']();return _0x4fa2d7;};function _0x386793(_0x218e40,_0x3b0402){var _0xf9fd0b=squel[_0x2f5e('0x36')]()[_0x2f5e('0x37')](_0x2f5e('0x38'))['fromQuery']([_0x2f5e('0x21'),_0x2f5e('0x3a'),_0x2f5e('0x3b'),_0x2f5e('0x3c'),_0x3b0402,_0x2f5e('0x3d'),_0x2f5e('0x3e')],squel['select']()[_0x2f5e('0x40')](_0x2f5e('0x21'),_0x2f5e('0x21'))[_0x2f5e('0x40')](_0x2f5e('0x41'),'scheduledAt')[_0x2f5e('0x40')]('id',_0x2f5e('0x3b'))['field'](LISTID[_0x2f5e('0x42')](),_0x2f5e('0x3c'))['field'](_0x218e40['id'][_0x2f5e('0x42')](),_0x3b0402)[_0x2f5e('0x40')]('NOW()',_0x2f5e('0x3d'))[_0x2f5e('0x40')](_0x2f5e('0x41'),_0x2f5e('0x3e'))[_0x2f5e('0x43')](_0x2f5e('0x44'))[_0x2f5e('0x45')](_0x2f5e('0x4a'))[_0x2f5e('0x45')](_0x2f5e('0x46'),LISTID[_0x2f5e('0x42')]())['where'](_0x2f5e('0x4b'),squel['str'](hopperContacts))[_0x2f5e('0x45')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0xf9fd0b;}function _0x533077(_0x190b36,_0x5047c){var _0x5485ae=squel[_0x2f5e('0x36')]()[_0x2f5e('0x37')](_0x2f5e('0x4e'))[_0x2f5e('0x39')](['phone',_0x2f5e('0x3b'),_0x2f5e('0x3c'),_0x5047c,_0x2f5e('0x3d'),_0x2f5e('0x3e')],squel[_0x2f5e('0x3f')]()[_0x2f5e('0x40')](_0x2f5e('0x21'),_0x2f5e('0x21'))[_0x2f5e('0x40')]('id','ContactId')[_0x2f5e('0x40')](LISTID[_0x2f5e('0x42')](),'ListId')[_0x2f5e('0x40')](_0x190b36['id']['toString'](),_0x5047c)['field'](_0x2f5e('0x41'),_0x2f5e('0x3d'))[_0x2f5e('0x40')]('NOW()','updatedAt')[_0x2f5e('0x43')]('cm_contacts')[_0x2f5e('0x45')](_0x2f5e('0x4a'))[_0x2f5e('0x45')](_0x2f5e('0x46'),LISTID[_0x2f5e('0x42')]())[_0x2f5e('0x45')](_0x2f5e('0x4b'),squel[_0x2f5e('0x4c')](hopperContacts))[_0x2f5e('0x45')](_0x2f5e('0x47')))['toString']();return _0x5485ae;}return db['VoiceQueue'][_0x2f5e('0x4f')]({'where':{'type':_0x2f5e('0x50')},'attributes':['id',_0x2f5e('0x51')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x2f5e('0x52')](function(_0x193a3a){var _0x50631a=[];if(_0x193a3a){var _0x22aa60;for(var _0x281c32=0x0,_0x369998;_0x281c32<_0x193a3a[_0x2f5e('0x1a')];_0x281c32+=0x1){_0x369998=_0x193a3a[_0x281c32][_0x2f5e('0x53')]({'plain':!![]});switch(_0x369998[_0x2f5e('0x51')]){case _0x2f5e('0x54'):_0x50631a[_0x2f5e('0x2d')](db[_0x2f5e('0x55')][_0x2f5e('0x56')](_0x551cba(_0x369998,'VoiceQueueId'))['then'](function(){})[_0x2f5e('0x2f')](_0x54a700()));break;case _0x2f5e('0x57'):_0x50631a['push'](db[_0x2f5e('0x55')][_0x2f5e('0x56')](_0xb7f421(_0x369998,_0x2f5e('0x58')))[_0x2f5e('0x52')](function(){})[_0x2f5e('0x2f')](_0x54a700()));break;default:_0x50631a['push'](db[_0x2f5e('0x55')]['query'](_0x386793(_0x369998,_0x2f5e('0x58')))[_0x2f5e('0x52')](function(){})['catch'](_0x54a700()));}}}return _0x50631a;})[_0x2f5e('0x59')]()['then'](function(){return db[_0x2f5e('0x5a')][_0x2f5e('0x4f')]({'where':{'type':_0x2f5e('0x50')},'attributes':['id'],'include':[{'model':db[_0x2f5e('0x5b')],'as':_0x2f5e('0x5c'),'where':{'id':LISTID}}]})[_0x2f5e('0x52')](function(_0x15c53c){var _0x19b589=[];if(_0x15c53c){var _0x3866aa;for(var _0x47e51c=0x0,_0x1402ea;_0x47e51c<_0x15c53c[_0x2f5e('0x1a')];_0x47e51c+=0x1){_0x1402ea=_0x15c53c[_0x47e51c][_0x2f5e('0x53')]({'plain':!![]});_0x19b589[_0x2f5e('0x2d')](db['sequelize'][_0x2f5e('0x56')](_0x533077(_0x1402ea,_0x2f5e('0x58')))[_0x2f5e('0x52')](function(){})[_0x2f5e('0x2f')](_0x54a700()));}}return _0x19b589;})[_0x2f5e('0x59')]();})[_0x2f5e('0x52')](function(){return db['Campaign'][_0x2f5e('0x4f')]({'attributes':['id',_0x2f5e('0x51')],'include':[{'model':db[_0x2f5e('0x5b')],'as':'Lists','where':{'id':LISTID}}]})[_0x2f5e('0x52')](function(_0x41bb9c){var _0x4eec36=[];if(_0x41bb9c){for(var _0xb7ba32=0x0,_0x3b106c;_0xb7ba32<_0x41bb9c[_0x2f5e('0x1a')];_0xb7ba32+=0x1){_0x3b106c=_0x41bb9c[_0xb7ba32][_0x2f5e('0x53')]({'plain':!![]});switch(_0x3b106c['dialCheckDuplicateType']){case _0x2f5e('0x54'):_0x4eec36['push'](db['sequelize'][_0x2f5e('0x56')](_0x551cba(_0x3b106c,'CampaignId'))[_0x2f5e('0x52')](function(){})[_0x2f5e('0x2f')](_0x54a700()));break;case _0x2f5e('0x57'):_0x4eec36[_0x2f5e('0x2d')](db[_0x2f5e('0x55')][_0x2f5e('0x56')](_0xb7f421(_0x3b106c,_0x2f5e('0x5d')))[_0x2f5e('0x52')](function(){})['catch'](_0x54a700()));break;default:_0x4eec36['push'](db[_0x2f5e('0x55')]['query'](_0x386793(_0x3b106c,_0x2f5e('0x5d')))['then'](function(){})[_0x2f5e('0x2f')](_0x54a700()));}}}return _0x4eec36;})[_0x2f5e('0x59')]();})[_0x2f5e('0x52')](function(){return db[_0x2f5e('0x5e')][_0x2f5e('0x4f')]({'attributes':['id'],'include':[{'model':db[_0x2f5e('0x5b')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x2f5e('0x52')](function(_0x6e8824){var _0x24c3d0=[];if(_0x6e8824){for(var _0x2aaf14=0x0,_0xdfa2ee;_0x2aaf14<_0x6e8824[_0x2f5e('0x1a')];_0x2aaf14+=0x1){_0xdfa2ee=_0x6e8824[_0x2aaf14]['get']({'plain':!![]});_0x24c3d0['push'](db['sequelize'][_0x2f5e('0x56')](_0x533077(_0xdfa2ee,'CampaignId'))['then'](function(){})['catch'](_0x54a700()));}}return _0x24c3d0;})[_0x2f5e('0x59')]();})[_0x2f5e('0x2f')](function(_0x54e2f9){logger[_0x2f5e('0x1c')](_0x2f5e('0x5f'),'generalCheckHopper',_0x54e2f9['message']);});}var processPromises=function(_0x4e0002){return BPromise['all'](promises)[_0x2f5e('0x52')](function(_0x1c900a){})[_0x2f5e('0x2f')](function(_0x3106f2){logger[_0x2f5e('0x1c')](_0x2f5e('0x60'),JSON[_0x2f5e('0x32')](_0x3106f2));})['finally'](function(){socket[_0x2f5e('0x61')](_0x2f5e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4e0002){return _0x4e0002[_0x2f5e('0x63')]();}});};var endCsv=function(){return BPromise[_0x2f5e('0x64')]()[_0x2f5e('0x52')](function(){if(hopperContacts){return checkHopper();}})[_0x2f5e('0x52')](function(){socket[_0x2f5e('0x61')](_0x2f5e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x2f5e('0x65')](FILEPATH);}catch(_0x138c36){logger['error'](_0x2f5e('0x66'),JSON[_0x2f5e('0x32')](_0x138c36));}finally{process[_0x2f5e('0x67')](0x0);}});};process['on'](_0x2f5e('0x68'),function(){logger[_0x2f5e('0x69')](_0x2f5e('0x6a'));endCsv();});function main(){return BPromise['resolve']()[_0x2f5e('0x52')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x2f5e('0x12')](',');return db[_0x2f5e('0x2b')][_0x2f5e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x2f5e('0x52')](function(_0x3c5e48){var _0x5e1c00=fs[_0x2f5e('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x5e1c00,{'header':!![],'skipEmptyLines':!![],'step':function(_0x29df77,_0x5e127a){total+=0x1;var _0x4173c4=total;promises[_0x2f5e('0x2d')](checkRow(_0x29df77,_0x3c5e48,_0x4173c4)[_0x2f5e('0x52')](function(){success+=0x1;})['catch'](function(_0x46f59f){if(_0x46f59f[_0x2f5e('0x1c')]){errors+=0x1;delete _0x46f59f[_0x2f5e('0x1c')];}else if(_0x46f59f[_0x2f5e('0x29')]){duplicates+=0x1;delete _0x46f59f[_0x2f5e('0x29')];}rows['push'](_0x46f59f);}));if(total%0xc8===0x0){_0x5e127a[_0x2f5e('0x6c')]();return processPromises(_0x5e127a);}},'complete':function(){return processPromises()[_0x2f5e('0x52')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x273d28,_0x3f2d27){logger[_0x2f5e('0x69')](_0x2f5e('0x6d'),JSON[_0x2f5e('0x32')](_0x273d28));endCsv();}});})[_0x2f5e('0x2f')](function(_0x203b52){logger[_0x2f5e('0x1c')](_0x2f5e('0x6e'),JSON['stringify'](_0x203b52));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 9761a2d..88c9a22 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 _0x4baa=['update','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','insert','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','into','from','cm_hopper_black','ListId\x20=\x20?','\x20=\x20','cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.UserId','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','field','MIN(id)','group','info','Received\x20SIGINT','errors','code','message','sequelize','query','spread','catch','error','campaigns.id','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','isNil','utcOffset','set','offset','dialTimezone','main','send','clone','server/files/tmp','.csv','includes','header','ContactItemType','name','writeFileSync','parse','createReadStream','rows','data','find','_description','hasOwnProperty','trim','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_blacklists','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','papaparse','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','where','join','CmContact','findAll','AdditionalPhones','then','length','push','all','split','CmContactHasItem'];(function(_0x1dc130,_0x1f8090){var _0x48e316=function(_0x1f3743){while(--_0x1f3743){_0x1dc130['push'](_0x1dc130['shift']());}};_0x48e316(++_0x1f8090);}(_0x4baa,0x14f));var _0xa4ba=function(_0x2768da,_0x70cb7f){_0x2768da=_0x2768da-0x0;var _0x460640=_0x4baa[_0x2768da];return _0x460640;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0xa4ba('0x0'));var util=require('util');var BPromise=require(_0xa4ba('0x1'));var moment=require(_0xa4ba('0x2'));var squel=require(_0xa4ba('0x3'));var Redis=require(_0xa4ba('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xa4ba('0x5'));var shared=require(_0xa4ba('0x6'));var logger=require(_0xa4ba('0x7'))(_0xa4ba('0x8'));config[_0xa4ba('0x9')]=_[_0xa4ba('0xa')](config[_0xa4ba('0x9')],{'host':_0xa4ba('0xb'),'port':0x18eb});var socket=require(_0xa4ba('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xa4ba('0xd')](_0xa4ba('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0xa4ba('0xe'));function isEmail(_0x54af71){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))*$/[_0xa4ba('0xf')](_0x54af71);}function selectNotIn(_0x47980e,_0x23f1d7,_0x38180d,_0x475b9b,_0x72aa76){return squel[_0xa4ba('0x10')]()['field'](_0xa4ba('0x11'))['from'](_0x475b9b)['join'](_0x23f1d7,null,_0x23f1d7+'.id\x20=\x20'+_0x475b9b+'.'+_0x38180d)['where'](_0x475b9b+'.'+_0x38180d+'\x20=\x20'+_0x47980e+'.'+_0x38180d)[_0xa4ba('0x12')](_0x23f1d7+'.dialCheckDuplicateType\x20IN\x20('+_0x72aa76[_0xa4ba('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x11eb49,_0xb08c14){promisesAdditionalPhones=[];return db[_0xa4ba('0x14')][_0xa4ba('0x15')]({'raw':!![],'attributes':['id',_0xa4ba('0x16')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xa4ba('0x17')](function(_0x2366bc){if(_0x2366bc!==null){var _0x9a97af=[];for(var _0x3c82dd=0x0;_0x3c82dd<_0x2366bc[_0xa4ba('0x18')];_0x3c82dd++){var _0xf0000e=_0x2366bc[_0x3c82dd];_0x9a97af[_0xa4ba('0x19')](insertAdditionalPhones(_0xf0000e));}}Promise[_0xa4ba('0x1a')](_0x9a97af)['then'](function(){_0x11eb49({'val':0x1});});});});}function insertAdditionalPhones(_0x567685){return new Promise(function(_0x4bdce5,_0x2909b5){var _0x2852b1=_0x567685[_0xa4ba('0x16')];var _0x32ff72=_0x2852b1[_0xa4ba('0x1b')](';');var _0x4de920=[];orderBy=0x0;for(var _0x44e50d=0x0;_0x44e50d<_0x32ff72[_0xa4ba('0x18')];_0x44e50d++){_0x4de920['push'](splitAdditionalPhone(_0x567685['id'],_0x32ff72[_0x44e50d]));}Promise[_0xa4ba('0x1a')](_0x4de920)[_0xa4ba('0x17')](function(){_0x4bdce5({'val':_0x32ff72[_0xa4ba('0x18')]});});});}function splitAdditionalPhone(_0x4818d7,_0x51aa8f){return new Promise(function(_0x14ee18,_0x1d79e1){var _0x366712=_0x51aa8f[_0xa4ba('0x1b')](':');var _0xdcd42d=_0x366712[0x0];var _0x49e65a=_0x366712[0x1];if(!_['isNil'](_0x49e65a)){var _0x57dba5=_0x49e65a['split']('|');var _0x59071d=[];for(var _0x2aed50=0x0;_0x2aed50<_0x57dba5[_0xa4ba('0x18')];_0x2aed50++){if(_0x57dba5[_0x2aed50]!==''){var _0xb4e603=_['filter'](promisesAdditionalPhones,{'contactId':_0x4818d7,'phone':_0x57dba5[_0x2aed50]});if(_0xb4e603['length']==0x0){orderBy++;promisesAdditionalPhones[_0xa4ba('0x19')]({'contactId':_0x4818d7,'contactTypeId':_0xdcd42d,'phone':_0x57dba5[_0x2aed50],'orderBy':orderBy});}}}_0x14ee18({'ok':0x1});}else _0x14ee18({'res':0x0});});}function createAdditionalPhone(_0x1797e2,_0x45ab10,_0x2131ab,_0x32806c){var _0x27c634='';var _0x2dd259='';var _0xce01ab=_0x2131ab[_0xa4ba('0x1b')]('§');_0x27c634=_0xce01ab[0x0];if(_0xce01ab[_0xa4ba('0x18')]==0x2)_0x2dd259=_0xce01ab[0x1];return new Promise(function(_0x11506f,_0x5ca203){return db[_0xa4ba('0x1c')]['findOne']({'where':{'CmContactId':_0x1797e2,'item':_0x27c634}})[_0xa4ba('0x17')](function(_0x583183){if(_0x583183){return db[_0xa4ba('0x1c')][_0xa4ba('0x1d')]({'ItemTypeId':_0x45ab10,'description':_0x2dd259,'OrderBy':_0x32806c},{'where':{'CmContactId':_0x1797e2,'item':_0x27c634}})[_0xa4ba('0x17')](function(_0x2d5061){_0x11506f({'res':'updated'});});}else{return db[_0xa4ba('0x1c')]['create']({'CmContactId':_0x1797e2,'item':_0x27c634,'description':_0x2dd259,'ItemTypeId':_0x45ab10,'OrderBy':_0x32806c,'ItemClass':_0xa4ba('0x1e')})[_0xa4ba('0x17')](function(_0x9551d4){_0x11506f({'res':_0xa4ba('0x1f')});});}});});}function insertCmHopper(_0x212d4e,_0x5429a4,_0x23428a,_0x3bf019,_0x5e3fbb){var _0x1411a2=['cm_contacts.phone',_0xa4ba('0x20'),_0xa4ba('0x21'),_0xa4ba('0x22'),_0x5429a4+'.'+_0x3bf019,_0xa4ba('0x23'),_0xa4ba('0x24'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x5e3fbb+'\x22'];return squel[_0xa4ba('0x25')]()['into'](_0xa4ba('0x26'))[_0xa4ba('0x27')]([_0xa4ba('0x11'),'scheduledat',_0xa4ba('0x28'),_0xa4ba('0x29'),_0x3bf019,_0xa4ba('0x2a'),_0xa4ba('0x2b'),_0xa4ba('0x2c'),_0xa4ba('0x2d'),_0xa4ba('0x2e')],squel[_0xa4ba('0x10')]()[_0xa4ba('0x2f')](_0x1411a2)['from'](_0x5429a4)['join'](_0xa4ba('0x30'),null,_0xa4ba('0x31')+_0x5429a4+_0xa4ba('0x32'))[_0xa4ba('0x13')](_0x23428a,null,_0x23428a+_0xa4ba('0x33')+_0x5429a4+'.'+_0x3bf019)[_0xa4ba('0x12')](_0x5429a4+_0xa4ba('0x34'),_0x212d4e)[_0xa4ba('0x12')](_0xa4ba('0x35'),NOW)[_0xa4ba('0x12')](_0xa4ba('0x36'),selectNotIn(_0x5429a4,_0x23428a,_0x3bf019,_0xa4ba('0x26'),[_0xa4ba('0x37'),_0xa4ba('0x38')]))[_0xa4ba('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5429a4,_0x23428a,_0x3bf019,_0xa4ba('0x26'),['\x22always\x22'])))[_0xa4ba('0x39')]();}function insertCmHopperBlack(_0x4b08d4,_0x2f6953,_0x1d4db4,_0x261186){var _0x591dab=['cm_contacts.phone',_0xa4ba('0x21'),_0xa4ba('0x22'),_0x2f6953+'.'+_0x261186,'cm_contacts.createdAt',_0xa4ba('0x24')];return squel[_0xa4ba('0x25')]()[_0xa4ba('0x3a')]('cm_hopper_black')[_0xa4ba('0x27')]([_0xa4ba('0x11'),_0xa4ba('0x28'),_0xa4ba('0x29'),_0x261186,_0xa4ba('0x2a'),_0xa4ba('0x2b')],squel[_0xa4ba('0x10')]()['fields'](_0x591dab)['from'](_0x2f6953)['join'](_0xa4ba('0x30'),null,_0xa4ba('0x31')+_0x2f6953+_0xa4ba('0x32'))[_0xa4ba('0x13')](_0x1d4db4,null,_0x1d4db4+'.id\x20=\x20'+_0x2f6953+'.'+_0x261186)[_0xa4ba('0x12')](_0x2f6953+'.CmListId\x20=\x20?',_0x4b08d4)['where'](_0xa4ba('0x35'),NOW)[_0xa4ba('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xa4ba('0x11'))[_0xa4ba('0x3b')](_0xa4ba('0x3c'))[_0xa4ba('0x12')](_0xa4ba('0x3d'),_0x4b08d4)[_0xa4ba('0x12')](_0x261186+_0xa4ba('0x3e')+_0x2f6953+'.'+_0x261186)))[_0xa4ba('0x39')]();}function insertTzCmHopper(_0x13c871,_0x267749,_0xb9b9c3,_0x5b5f88,_0x1edb4c,_0x594bbd){var _0xd5726a=[_0xa4ba('0x3f'),_0xa4ba('0x40')+_0x594bbd+'.offset-cm_contacts.utcOffset\x20minute)',_0xa4ba('0x21'),_0xa4ba('0x22'),_0x267749+'.'+_0x5b5f88,_0xa4ba('0x23'),'cm_contacts.updatedAt','cm_contacts.priority',_0xa4ba('0x41'),'\x22'+_0x1edb4c+'\x22'];var _0x202f5d=squel[_0xa4ba('0x25')]()[_0xa4ba('0x3a')](_0xa4ba('0x26'))[_0xa4ba('0x27')](['phone','scheduledat','ContactId',_0xa4ba('0x29'),_0x5b5f88,_0xa4ba('0x2a'),'updatedAt','priority','UserId','recallme'],squel['select']()[_0xa4ba('0x2f')](_0xd5726a)['from'](_0x267749)[_0xa4ba('0x13')](_0xa4ba('0x30'),null,_0xa4ba('0x31')+_0x267749+_0xa4ba('0x32'))['join'](_0xb9b9c3,null,_0xb9b9c3+'.id\x20=\x20'+_0x267749+'.'+_0x5b5f88)['join'](_0x594bbd,null,_0x594bbd+_0xa4ba('0x33')+_0x267749+'.'+_0x5b5f88)[_0xa4ba('0x12')](_0x267749+_0xa4ba('0x34'),_0x13c871)[_0xa4ba('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xa4ba('0x12')](_0xa4ba('0x36'),selectNotIn(_0x267749,_0xb9b9c3,_0x5b5f88,_0xa4ba('0x26'),[_0xa4ba('0x37'),'\x22onlyIfOpen\x22']))['where'](_0xa4ba('0x36'),selectNotIn(_0x267749,_0xb9b9c3,_0x5b5f88,_0xa4ba('0x26'),[_0xa4ba('0x37')])))[_0xa4ba('0x39')]();return _0x202f5d;}function insertTzCmHopperBlack(_0xed7251,_0x235361,_0xc3f4f9,_0x224f12){var _0xf50da1=[_0xa4ba('0x3f'),_0xa4ba('0x21'),_0xa4ba('0x22'),_0x235361+'.'+_0x224f12,'cm_contacts.createdAt',_0xa4ba('0x24')];return squel[_0xa4ba('0x25')]()['into']('cm_hopper_black')['fromQuery'](['phone',_0xa4ba('0x28'),_0xa4ba('0x29'),_0x224f12,_0xa4ba('0x2a'),_0xa4ba('0x2b')],squel[_0xa4ba('0x10')]()[_0xa4ba('0x2f')](_0xf50da1)[_0xa4ba('0x3b')](_0x235361)[_0xa4ba('0x13')](_0xa4ba('0x30'),null,'cm_contacts.ListId\x20=\x20'+_0x235361+_0xa4ba('0x32'))[_0xa4ba('0x13')](_0xc3f4f9,null,_0xc3f4f9+_0xa4ba('0x33')+_0x235361+'.'+_0x224f12)[_0xa4ba('0x12')](_0x235361+_0xa4ba('0x34'),_0xed7251)[_0xa4ba('0x12')](_0xa4ba('0x35'),NOW)[_0xa4ba('0x12')](_0xa4ba('0x36'),squel[_0xa4ba('0x10')]()['field'](_0xa4ba('0x11'))['from'](_0xa4ba('0x3c'))[_0xa4ba('0x12')]('ListId\x20=\x20?',_0xed7251)[_0xa4ba('0x12')](_0x224f12+'\x20=\x20'+_0x235361+'.'+_0x224f12)))[_0xa4ba('0x39')]();}function insertCmHopperAdditionalPhones(_0x1404ef){var _0x10d8b4=[_0xa4ba('0x42'),_0xa4ba('0x43'),_0xa4ba('0x44'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel['insert']()[_0xa4ba('0x3a')](_0xa4ba('0x45'))['fromQuery']([_0xa4ba('0x46'),_0xa4ba('0x11'),_0xa4ba('0x47'),_0xa4ba('0x2a'),_0xa4ba('0x2b')],squel['select']()['fields'](_0x10d8b4)[_0xa4ba('0x3b')](_0xa4ba('0x26'))[_0xa4ba('0x13')](_0xa4ba('0x30'),null,_0xa4ba('0x48'))[_0xa4ba('0x13')](_0xa4ba('0x49'),null,_0xa4ba('0x4a'))['where']('cm_hopper.ListId\x20=\x20?',_0x1404ef)[_0xa4ba('0x12')](_0xa4ba('0x35'),NOW))[_0xa4ba('0x39')]();}function insertCmContact(_0x51d0a9,_0x34dfd6,_0x1715a9,_0x38bfd2){var _0x2a3ac2=_[_0xa4ba('0x4b')](_[_0xa4ba('0x4c')](_0x38bfd2),[_0xa4ba('0x29'),'CompanyId',_0xa4ba('0x2a'),_0xa4ba('0x2b')]);return squel[_0xa4ba('0x25')]()[_0xa4ba('0x3a')](_0xa4ba('0x30'))[_0xa4ba('0x27')](_0x2a3ac2,squel[_0xa4ba('0x10')]()[_0xa4ba('0x2f')](_0x2a3ac2)[_0xa4ba('0x3b')](_0x34dfd6)['where']('('+_0x1715a9[_0xa4ba('0x13')](',')+_0xa4ba('0x4d'),squel['select']()[_0xa4ba('0x2f')](_0x1715a9)['from'](_0xa4ba('0x30'))[_0xa4ba('0x12')](_0xa4ba('0x3d'),_0x51d0a9)['where'](_0xa4ba('0x4e')))[_0xa4ba('0x12')](_0xa4ba('0x4f'),squel[_0xa4ba('0x10')]()[_0xa4ba('0x50')](_0xa4ba('0x51'),'min_id')[_0xa4ba('0x3b')](_0x34dfd6)[_0xa4ba('0x52')](_0x1715a9[_0xa4ba('0x13')](','))))[_0xa4ba('0x39')]();}function handleStop(){logger[_0xa4ba('0x53')](_0xa4ba('0x54'));stopped=!![];}function handleUncaughtException(_0x533589){logger['error'](_0x533589['message']);process['exit'](0x1);}function handleError(_0x429f88,_0x104ae2){stats[_0xa4ba('0x55')]['push']({'name':_0x104ae2[_0xa4ba('0x56')],'message':_0x104ae2[_0xa4ba('0x57')],'row':_0x429f88});}function handleQuery(_0x119349){logger[_0xa4ba('0x53')](_0x119349);return db[_0xa4ba('0x58')][_0xa4ba('0x59')](_0x119349)[_0xa4ba('0x5a')](function(_0x56fd81){results[_0xa4ba('0x19')](_0x56fd81);})[_0xa4ba('0x5b')](function(_0x5703b8){logger[_0xa4ba('0x5c')](_0x5703b8[_0xa4ba('0x57')]);});}function updateTzCampaigns(_0x435015){return new Promise(function(_0x1938b6,_0x145a71){var _0x30d6c0=squel[_0xa4ba('0x10')]()[_0xa4ba('0x2f')]([_0xa4ba('0x5d'),'campaigns.dialTimezone'])['from'](_0xa4ba('0x5e'))[_0xa4ba('0x13')]('campaigns_has_cm_lists',null,_0xa4ba('0x5f'))[_0xa4ba('0x12')](_0xa4ba('0x60')+_0x435015);db[_0xa4ba('0x58')]['query'](_0x30d6c0[_0xa4ba('0x39')]())[_0xa4ba('0x5a')](function(_0x2ed18a){var _0x2d89dc=[];for(var _0x173ef9=0x0;_0x173ef9<_0x2ed18a[_0xa4ba('0x18')];_0x173ef9++){_0x2d89dc[_0xa4ba('0x19')](getTimezoneData(_0x2ed18a[_0x173ef9],tmp_campaigns));}BPromise[_0xa4ba('0x1a')](_0x2d89dc)[_0xa4ba('0x17')](function(){_0x1938b6({'val':0x1});});})[_0xa4ba('0x5b')](function(_0x5a670e){logger[_0xa4ba('0x5c')](_0x5a670e[_0xa4ba('0x57')]);_0x1938b6({'val':0x0});});});}function updateTzVoiceQueues(_0x3192be){return new Promise(function(_0x53949b,_0x5e4472){var _0x5e1375=squel[_0xa4ba('0x10')]()[_0xa4ba('0x2f')]([_0xa4ba('0x61'),_0xa4ba('0x62')])['from'](_0xa4ba('0x63'))['join'](_0xa4ba('0x64'),null,_0xa4ba('0x65'))[_0xa4ba('0x12')](_0xa4ba('0x66')+_0x3192be);db[_0xa4ba('0x58')][_0xa4ba('0x59')](_0x5e1375[_0xa4ba('0x39')]())[_0xa4ba('0x5a')](function(_0x2b37d3){var _0x34711e=[];for(var _0x45f28e=0x0;_0x45f28e<_0x2b37d3['length'];_0x45f28e++){_0x34711e['push'](getTimezoneData(_0x2b37d3[_0x45f28e],tmp_voice_queues));}BPromise[_0xa4ba('0x1a')](_0x34711e)[_0xa4ba('0x17')](function(){_0x53949b({'val':0x1});});})['catch'](function(_0x3081cd){logger[_0xa4ba('0x5c')](_0x3081cd[_0xa4ba('0x57')]);_0x53949b({'val':0x0});});});}function getTimezoneData(_0x3260ea,_0xd96037){return new Promise(function(_0x177445,_0x3efce7){var _0x1c0efa=shared[_0xa4ba('0x67')];var _0x4dc00a=_0x1c0efa[_0x3260ea['dialTimezone']];if(_[_0xa4ba('0x68')](_0x4dc00a)){_0x177445({'ret':0x1});}else{var _0xdd168=_0x4dc00a[_0xa4ba('0x69')];var _0x54c169=squel[_0xa4ba('0x25')]()['into'](_0xd96037)[_0xa4ba('0x6a')]('id',_0x3260ea['id'])[_0xa4ba('0x6a')](_0xa4ba('0x6b'),_0xdd168)[_0xa4ba('0x6a')](_0xa4ba('0x6c'),_0x3260ea[_0xa4ba('0x6c')])['toString']();return db['sequelize'][_0xa4ba('0x59')](_0x54c169)[_0xa4ba('0x5a')](function(_0x24362d){_0x177445({'ret':0x1});})[_0xa4ba('0x5b')](function(_0x2e6cfb){logger[_0xa4ba('0x5c')](_0x2e6cfb[_0xa4ba('0x57')]);_0x3efce7({'ret':0x1});});}});}function handleTZQuery(_0x48ce41){logger[_0xa4ba('0x53')](_0x48ce41);return db['sequelize']['query'](_0x48ce41)[_0xa4ba('0x5a')](function(_0x4b2dbb){})[_0xa4ba('0x5b')](function(_0x4f71aa){logger[_0xa4ba('0x5c')](_0x4f71aa[_0xa4ba('0x57')]);});}function main(_0x14a48d,_0x2ddcc9,_0x45fbf0,_0x13474a){logger[_0xa4ba('0x53')](_0xa4ba('0x6d'),_0x14a48d,JSON['stringify'](_0x2ddcc9));process[_0xa4ba('0x6e')]('start');var _0x29c804=_0x2ddcc9['binding'];var _0x5af748=_[_0xa4ba('0x6f')](_0x29c804);var _0x532ca8=_0x2ddcc9['socket_timestamp'];var _0x278d8a=path[_0xa4ba('0x13')](config['root'],_0xa4ba('0x70'),_0x532ca8+_0xa4ba('0x71'));hasTZ=_[_0xa4ba('0x4c')](_0x29c804)[_0xa4ba('0x72')](_0xa4ba('0x6c'));var _0x4878b=_['keys'](_0x29c804)[_0xa4ba('0x13')]();logger['info'](_0xa4ba('0x73'),_0x4878b);db[_0xa4ba('0x74')][_0xa4ba('0x15')]({'raw':!![],'attributes':['id','name']})[_0xa4ba('0x17')](function(_0xbc0e9f){for(var _0x54274c=0x0;_0x54274c<_0xbc0e9f['length'];_0x54274c++){if(_0xbc0e9f[_0x54274c][_0xa4ba('0x75')]in _0x29c804){contactItemTypes[_0xa4ba('0x19')](_0xbc0e9f[_0x54274c]);delete _0x5af748[_0xbc0e9f[_0x54274c]['name']];hasAdditionalPhones=!![];}for(var _0x2dd69b in _0x29c804){if(_0xbc0e9f[_0x54274c][_0xa4ba('0x75')]+'_description'===_0x2dd69b){phoneDescriptions[_0xa4ba('0x19')]({'itemTypeId':_0xbc0e9f[_0x54274c]['id'],'description':_0x2dd69b});delete _0x5af748[_0x2dd69b];}}}if(hasAdditionalPhones)_0x5af748['AdditionalPhones']='';var _0x278676=_[_0xa4ba('0x4c')](_0x5af748)[_0xa4ba('0x13')]();logger[_0xa4ba('0x53')](_0xa4ba('0x73'),_0x278676);fs[_0xa4ba('0x76')](_0x278d8a,_0x278676+'\x0a');Papa[_0xa4ba('0x77')](fs[_0xa4ba('0x78')](_0x14a48d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x46d84e,_0x2ad420){try{for(var _0x38c442=0x0,_0x5c9a94=[];_0x38c442<_0x46d84e['data']['length'];_0x38c442++){stats[_0xa4ba('0x79')]+=0x1;if(_0x46d84e['errors'][_0x38c442]){handleError(_0x46d84e[_0xa4ba('0x7a')][_0x38c442],_0x46d84e[_0xa4ba('0x55')][_0x38c442]);}else{var _0x4e4851=[];var _0x36ef03=[];var _0x400a73={};for(var _0x2d8068 in _0x29c804){let _0x4ade39=contactItemTypes['find'](_0x175171=>_0x175171[_0xa4ba('0x75')]===_0x2d8068);let _0x2fb89d=contactItemTypes[_0xa4ba('0x7b')](_0x30e7ee=>_0x30e7ee[_0xa4ba('0x75')]+_0xa4ba('0x7c')===_0x2d8068);if(_[_0xa4ba('0x68')](_0x4ade39)&&_[_0xa4ba('0x68')](_0x2fb89d)){if(_0x29c804[_0xa4ba('0x7d')](_0x2d8068)){if(_0x46d84e[_0xa4ba('0x7a')][_0x38c442][_0x29c804[_0x2d8068]]){var _0x5cc5ea=_[_0xa4ba('0x7e')](_0x46d84e['data'][_0x38c442][_0x29c804[_0x2d8068]][_0xa4ba('0x7f')](/"/g,'\x27'));switch(_0x2d8068){case _0xa4ba('0x80'):var _0x4da717=moment(_0x5cc5ea,_0xa4ba('0xe'),!![]);if(_0x4da717[_0xa4ba('0x81')]()){_0x5c9a94[_0xa4ba('0x19')]('\x22'+_0x5cc5ea+'\x22');}else{_0x4e4851['push'](_0xa4ba('0x82'));}break;case _0xa4ba('0x2c'):var _0x4e232a=parseInt(_0x5cc5ea);_0x5cc5ea=_['isNaN'](_0x4e232a)||_0x4e232a<0x0||_0x4e232a>0x4?_0x13474a?0x3:0x2:_0x4e232a;_0x5c9a94[_0xa4ba('0x19')]('\x22'+_0x5cc5ea+'\x22');break;case _0xa4ba('0x2d'):var _0x55aa38=parseInt(_0x5cc5ea);if(_[_0xa4ba('0x83')](_0x55aa38)&&_[_0xa4ba('0x72')](_0x45fbf0,_0x55aa38)){_0x5c9a94[_0xa4ba('0x19')]('\x22'+_0x55aa38+'\x22');}else{_0x4e4851[_0xa4ba('0x19')](_0xa4ba('0x84'));}break;case _0xa4ba('0x85'):if(isEmail(_0x5cc5ea)){_0x5c9a94['push']('\x22'+_0x5cc5ea+'\x22');}else{_0x4e4851['push']('email\x20wrong\x20format');}break;case _0xa4ba('0x86'):var _0x38ac4c=moment(_0x5cc5ea,_0xa4ba('0x87'),!![]);if(_0x38ac4c[_0xa4ba('0x81')]()){_0x5c9a94[_0xa4ba('0x19')]('\x22'+_0x5cc5ea+'\x22');}else{_0x4e4851[_0xa4ba('0x19')](_0xa4ba('0x88'));}break;case'dialTimezone':var _0x5e28a5=shared[_0xa4ba('0x67')];var _0x4b824d=_0x5e28a5[_0x5cc5ea];if(!_[_0xa4ba('0x68')](_0x4b824d)){var _0x262d54=_0x4b824d[_0xa4ba('0x69')];_0x5c9a94['push']('\x22'+_0x5cc5ea+'\x22');_0x5c9a94[_0xa4ba('0x19')]('\x22'+_0x262d54+'\x22');}break;default:_0x5c9a94[_0xa4ba('0x19')]('\x22'+_0x5cc5ea+'\x22');}}else{switch(_0x2d8068){case'firstName':case _0xa4ba('0x11'):_0x4e4851[_0xa4ba('0x19')](_0x2d8068+_0xa4ba('0x89'));break;default:_0x5c9a94['push']('\x22\x22');}}}}else{var _0x3b17d3='';if(!_[_0xa4ba('0x68')](_0x4ade39)){if(!_0x400a73['hasOwnProperty'](_0x4ade39['id'])){if(!_['isNil'](_0x46d84e['data'][_0x38c442][_0x29c804[_0x2d8068]])){var _0x5cc5ea=_[_0xa4ba('0x7e')](_0x46d84e[_0xa4ba('0x7a')][_0x38c442][_0x29c804[_0x2d8068]]['replace'](/"/g,'\x27'));var _0x1e2b9e=phoneDescriptions[_0xa4ba('0x7b')](_0x4c364d=>_0x4c364d['itemTypeId']===_0x4ade39['id']);if(!_[_0xa4ba('0x68')](_0x1e2b9e)){var _0x6f0d23=_[_0xa4ba('0x7e')](_0x46d84e[_0xa4ba('0x7a')][_0x38c442][_0x29c804[_0x1e2b9e[_0xa4ba('0x8a')]]][_0xa4ba('0x7f')](/"/g,'\x27'));if(!_[_0xa4ba('0x68')](_0x6f0d23))_0x5cc5ea=_0x5cc5ea+'§'+_0x6f0d23;}if(_0x3b17d3=='')_0x3b17d3=_0x5cc5ea;else _0x3b17d3+='|'+_0x5cc5ea;}_0x36ef03[_0xa4ba('0x19')](_0x4ade39['id']+':'+_0x3b17d3);_0x400a73[_0x4ade39['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5c9a94[_0xa4ba('0x19')]('\x22'+_0x36ef03['join'](';')+'\x22');}if(_0x4e4851[_0xa4ba('0x18')]){handleError(_0x46d84e['data'][_0x38c442],{'code':_0xa4ba('0x8b'),'message':_0x4e4851[_0xa4ba('0x13')]()});}else{fs[_0xa4ba('0x8c')](_0x278d8a,_0x5c9a94[_0xa4ba('0x13')]()+'\x0a');}_0x5c9a94=[];}if(!(stats[_0xa4ba('0x79')]%0xc8)){socket['emit'](_0xa4ba('0x8d')+_0x532ca8,stats);stats[_0xa4ba('0x55')]=[];}}if(stopped){logger[_0xa4ba('0x53')](_0xa4ba('0x8e'));_0x2ad420[_0xa4ba('0x8f')]();}}catch(_0x4113c7){handleError(_0x46d84e[_0xa4ba('0x7a')][_0x38c442],{'code':_0xa4ba('0x90'),'message':_0x4113c7[_0xa4ba('0x57')]});logger[_0xa4ba('0x5c')](_0xa4ba('0x91'),_0x4113c7[_0xa4ba('0x57')]);}},'complete':function(){try{var _0x2b340b=[];var _0xcf3983=[];var _0xb6ce0f='cm_contacts';if(_0x2ddcc9[_0xa4ba('0x92')]&&_0x2ddcc9[_0xa4ba('0x92')][_0xa4ba('0x18')]){_0xb6ce0f=_0xa4ba('0x93')+_0x532ca8;_0x2b340b[_0xa4ba('0x19')](_0xa4ba('0x94')+_0xb6ce0f+_0xa4ba('0x95'));}tmp_campaigns=_0xa4ba('0x96')+_0x532ca8;tmp_voice_queues='voice_queues_'+_0x532ca8;_0xcf3983[_0xa4ba('0x19')](_0xa4ba('0x94')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0xcf3983[_0xa4ba('0x19')](_0xa4ba('0x94')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xa4ba('0x97')](_0xcf3983,handleTZQuery)[_0xa4ba('0x17')](function(_0x47492d){updateTzCampaigns(_0x2ddcc9['ListId'])[_0xa4ba('0x17')](function(_0x1c0e68){updateTzVoiceQueues(_0x2ddcc9[_0xa4ba('0x29')])[_0xa4ba('0x17')](function(_0x4eba1f){if(hasTZ)_0x278676=_0x278676[_0xa4ba('0x7f')](_0xa4ba('0x6c'),_0xa4ba('0x98'));var _0x79748f=util['format'](_0xa4ba('0x99'),_0x278d8a,_0xb6ce0f,_0x278676,_0x2ddcc9['ListId'],_0x2ddcc9[_0xa4ba('0x9a')]||null,NOW,NOW);if(_[_0xa4ba('0x68')](_0x29c804['scheduledat'])){_0x79748f+=',\x20scheduledAt\x20=\x20NOW()';}_0x2b340b[_0xa4ba('0x19')](_0x79748f);if(_0x2ddcc9[_0xa4ba('0x92')]&&_0x2ddcc9[_0xa4ba('0x92')][_0xa4ba('0x18')]){_0x2b340b[_0xa4ba('0x19')](insertCmContact(_0x2ddcc9[_0xa4ba('0x29')],_0xb6ce0f,_0x2ddcc9[_0xa4ba('0x92')],_0x29c804));_0x2b340b[_0xa4ba('0x19')](_0xa4ba('0x9b')+_0xb6ce0f+';');}BPromise[_0xa4ba('0x97')](_0x2b340b,handleQuery)['then'](function(_0x447ff4){BPromise[_0xa4ba('0x1a')]([handleAdditionalPhones()])[_0xa4ba('0x17')](function(){_0x2b340b=[];for(var _0x2fe5d0=0x0;_0x2fe5d0\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','papaparse','util','moment','squel','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','localhost','socket.io-emitter','format','test','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','CmContact','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','findOne','CmContactHasItem','update','updated','create','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.id','into','cm_hopper_black','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','insert','recallme','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','message','exit','errors','code','sequelize','query','spread','catch','error','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','set','offset','main','stringify','binding','clone','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','utcOffset','firstName','\x20not\x20specified','trim','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;'];(function(_0x32c028,_0x2bbd77){var _0x5a0249=function(_0x440c94){while(--_0x440c94){_0x32c028['push'](_0x32c028['shift']());}};_0x5a0249(++_0x2bbd77);}(_0xa54c,0xcf));var _0xca54=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xa54c[_0x2aec52];return _0x3b8835;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0xca54('0x0'));var util=require(_0xca54('0x1'));var BPromise=require('bluebird');var moment=require(_0xca54('0x2'));var squel=require(_0xca54('0x3'));var Redis=require('ioredis');var db=require(_0xca54('0x4'))['db'];var config=require(_0xca54('0x5'));var shared=require(_0xca54('0x6'));var logger=require(_0xca54('0x7'))(_0xca54('0x8'));config[_0xca54('0x9')]=_['defaults'](config[_0xca54('0x9')],{'host':_0xca54('0xa'),'port':0x18eb});var socket=require(_0xca54('0xb'))(new Redis(config[_0xca54('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xca54('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xca54('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x78a356){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))*$/[_0xca54('0xd')](_0x78a356);}function selectNotIn(_0x4b4a16,_0x775fb3,_0x243e62,_0xf3ffc8,_0x1a2591){return squel['select']()[_0xca54('0xe')](_0xca54('0xf'))[_0xca54('0x10')](_0xf3ffc8)[_0xca54('0x11')](_0x775fb3,null,_0x775fb3+_0xca54('0x12')+_0xf3ffc8+'.'+_0x243e62)[_0xca54('0x13')](_0xf3ffc8+'.'+_0x243e62+_0xca54('0x14')+_0x4b4a16+'.'+_0x243e62)[_0xca54('0x13')](_0x775fb3+'.dialCheckDuplicateType\x20IN\x20('+_0x1a2591['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x3bf69c,_0x1f9c1a){promisesAdditionalPhones=[];return db[_0xca54('0x15')][_0xca54('0x16')]({'raw':!![],'attributes':['id',_0xca54('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xca54('0x18')](function(_0x5bf530){if(_0x5bf530!==null){var _0x18efb3=[];for(var _0x2a5752=0x0;_0x2a5752<_0x5bf530[_0xca54('0x19')];_0x2a5752++){var _0x1e41ba=_0x5bf530[_0x2a5752];_0x18efb3[_0xca54('0x1a')](insertAdditionalPhones(_0x1e41ba));}}Promise[_0xca54('0x1b')](_0x18efb3)[_0xca54('0x18')](function(){_0x3bf69c({'val':0x1});});});});}function insertAdditionalPhones(_0xf69e7d){return new Promise(function(_0x39b15f,_0x5e26b2){var _0x5726ec=_0xf69e7d['AdditionalPhones'];var _0x266026=_0x5726ec['split'](';');var _0x662d60=[];orderBy=0x0;for(var _0x2d5078=0x0;_0x2d5078<_0x266026[_0xca54('0x19')];_0x2d5078++){_0x662d60['push'](splitAdditionalPhone(_0xf69e7d['id'],_0x266026[_0x2d5078]));}Promise['all'](_0x662d60)[_0xca54('0x18')](function(){_0x39b15f({'val':_0x266026[_0xca54('0x19')]});});});}function splitAdditionalPhone(_0x54b0ee,_0x86c49d){return new Promise(function(_0x506613,_0x493a3f){var _0x34e042=_0x86c49d[_0xca54('0x1c')](':');var _0x2c7daa=_0x34e042[0x0];var _0x344062=_0x34e042[0x1];if(!_[_0xca54('0x1d')](_0x344062)){var _0x3873e4=_0x344062[_0xca54('0x1c')]('|');var _0x168c61=[];for(var _0x55f2d6=0x0;_0x55f2d6<_0x3873e4[_0xca54('0x19')];_0x55f2d6++){if(_0x3873e4[_0x55f2d6]!==''){var _0x52c5cc=_[_0xca54('0x1e')](promisesAdditionalPhones,{'contactId':_0x54b0ee,'phone':_0x3873e4[_0x55f2d6]});if(_0x52c5cc['length']==0x0){orderBy++;promisesAdditionalPhones[_0xca54('0x1a')]({'contactId':_0x54b0ee,'contactTypeId':_0x2c7daa,'phone':_0x3873e4[_0x55f2d6],'orderBy':orderBy});}}}_0x506613({'ok':0x1});}else _0x506613({'res':0x0});});}function createAdditionalPhone(_0xc70bca,_0x3fbb65,_0x46e0d0,_0x2e4071){var _0x1f9b4c='';var _0x25794a='';var _0x5ddfc1=_0x46e0d0['split']('§');_0x1f9b4c=_0x5ddfc1[0x0];if(_0x5ddfc1[_0xca54('0x19')]==0x2)_0x25794a=_0x5ddfc1[0x1];return new Promise(function(_0x267681,_0x41377b){return db['CmContactHasItem'][_0xca54('0x1f')]({'where':{'CmContactId':_0xc70bca,'item':_0x1f9b4c}})[_0xca54('0x18')](function(_0x52a68d){if(_0x52a68d){return db[_0xca54('0x20')][_0xca54('0x21')]({'ItemTypeId':_0x3fbb65,'description':_0x25794a,'OrderBy':_0x2e4071},{'where':{'CmContactId':_0xc70bca,'item':_0x1f9b4c}})[_0xca54('0x18')](function(_0x2967d6){_0x267681({'res':_0xca54('0x22')});});}else{return db[_0xca54('0x20')][_0xca54('0x23')]({'CmContactId':_0xc70bca,'item':_0x1f9b4c,'description':_0x25794a,'ItemTypeId':_0x3fbb65,'OrderBy':_0x2e4071,'ItemClass':'PHONE'})['then'](function(_0x3f4b7f){_0x267681({'res':_0xca54('0x24')});});}});});}function insertCmHopper(_0x96ab4e,_0x4f3f4c,_0x356afa,_0x3afa4e,_0x26990d){var _0xfde57c=[_0xca54('0x25'),_0xca54('0x26'),'cm_contacts.id',_0xca54('0x27'),_0x4f3f4c+'.'+_0x3afa4e,_0xca54('0x28'),_0xca54('0x29'),_0xca54('0x2a'),_0xca54('0x2b'),'\x22'+_0x26990d+'\x22'];return squel['insert']()['into'](_0xca54('0x2c'))[_0xca54('0x2d')](['phone',_0xca54('0x2e'),_0xca54('0x2f'),_0xca54('0x30'),_0x3afa4e,_0xca54('0x31'),_0xca54('0x32'),_0xca54('0x33'),_0xca54('0x34'),'recallme'],squel[_0xca54('0x35')]()[_0xca54('0x36')](_0xfde57c)[_0xca54('0x10')](_0x4f3f4c)['join'](_0xca54('0x37'),null,_0xca54('0x38')+_0x4f3f4c+_0xca54('0x39'))[_0xca54('0x11')](_0x356afa,null,_0x356afa+'.id\x20=\x20'+_0x4f3f4c+'.'+_0x3afa4e)['where'](_0x4f3f4c+_0xca54('0x3a'),_0x96ab4e)[_0xca54('0x13')](_0xca54('0x3b'),NOW)['where'](_0xca54('0x3c'),selectNotIn(_0x4f3f4c,_0x356afa,_0x3afa4e,_0xca54('0x2c'),['\x22always\x22',_0xca54('0x3d')]))[_0xca54('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4f3f4c,_0x356afa,_0x3afa4e,_0xca54('0x2c'),[_0xca54('0x3e')])))[_0xca54('0x3f')]();}function insertCmHopperBlack(_0x20815c,_0x4f9a11,_0x211517,_0x35c72f){var _0x5432bd=[_0xca54('0x25'),_0xca54('0x40'),'cm_contacts.ListId',_0x4f9a11+'.'+_0x35c72f,_0xca54('0x28'),'cm_contacts.updatedAt'];return squel['insert']()[_0xca54('0x41')]('cm_hopper_black')[_0xca54('0x2d')]([_0xca54('0xf'),_0xca54('0x2f'),_0xca54('0x30'),_0x35c72f,'createdAt','updatedAt'],squel[_0xca54('0x35')]()[_0xca54('0x36')](_0x5432bd)['from'](_0x4f9a11)['join'](_0xca54('0x37'),null,'cm_contacts.ListId\x20=\x20'+_0x4f9a11+_0xca54('0x39'))[_0xca54('0x11')](_0x211517,null,_0x211517+'.id\x20=\x20'+_0x4f9a11+'.'+_0x35c72f)['where'](_0x4f9a11+'.CmListId\x20=\x20?',_0x20815c)['where'](_0xca54('0x3b'),NOW)[_0xca54('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xca54('0x35')]()[_0xca54('0xe')](_0xca54('0xf'))[_0xca54('0x10')](_0xca54('0x42'))[_0xca54('0x13')](_0xca54('0x43'),_0x20815c)['where'](_0x35c72f+_0xca54('0x14')+_0x4f9a11+'.'+_0x35c72f)))['toString']();}function insertTzCmHopper(_0x2cbcb8,_0x302c66,_0x521b97,_0x5c6b3e,_0x426543,_0x32d7a6){var _0x365152=[_0xca54('0x25'),_0xca54('0x44')+_0x32d7a6+'.offset-cm_contacts.utcOffset\x20minute)',_0xca54('0x40'),_0xca54('0x27'),_0x302c66+'.'+_0x5c6b3e,_0xca54('0x28'),'cm_contacts.updatedAt',_0xca54('0x2a'),_0xca54('0x2b'),'\x22'+_0x426543+'\x22'];var _0x3c62e2=squel[_0xca54('0x45')]()['into']('cm_hopper')[_0xca54('0x2d')]([_0xca54('0xf'),'scheduledat',_0xca54('0x2f'),_0xca54('0x30'),_0x5c6b3e,_0xca54('0x31'),_0xca54('0x32'),_0xca54('0x33'),_0xca54('0x34'),_0xca54('0x46')],squel[_0xca54('0x35')]()[_0xca54('0x36')](_0x365152)[_0xca54('0x10')](_0x302c66)[_0xca54('0x11')](_0xca54('0x37'),null,_0xca54('0x38')+_0x302c66+'.CmListId')[_0xca54('0x11')](_0x521b97,null,_0x521b97+_0xca54('0x12')+_0x302c66+'.'+_0x5c6b3e)['join'](_0x32d7a6,null,_0x32d7a6+_0xca54('0x12')+_0x302c66+'.'+_0x5c6b3e)['where'](_0x302c66+'.CmListId\x20=\x20?',_0x2cbcb8)[_0xca54('0x13')](_0xca54('0x3b'),NOW)[_0xca54('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x302c66,_0x521b97,_0x5c6b3e,_0xca54('0x2c'),[_0xca54('0x3e'),'\x22onlyIfOpen\x22']))['where'](_0xca54('0x3c'),selectNotIn(_0x302c66,_0x521b97,_0x5c6b3e,'cm_hopper',['\x22always\x22'])))['toString']();return _0x3c62e2;}function insertTzCmHopperBlack(_0x5f4657,_0x5ab1f7,_0x2e2e2d,_0x40bdd5){var _0x1172a2=[_0xca54('0x25'),'cm_contacts.id','cm_contacts.ListId',_0x5ab1f7+'.'+_0x40bdd5,'cm_contacts.createdAt',_0xca54('0x29')];return squel['insert']()[_0xca54('0x41')](_0xca54('0x42'))[_0xca54('0x2d')]([_0xca54('0xf'),'ContactId','ListId',_0x40bdd5,_0xca54('0x31'),'updatedAt'],squel['select']()[_0xca54('0x36')](_0x1172a2)[_0xca54('0x10')](_0x5ab1f7)[_0xca54('0x11')](_0xca54('0x37'),null,_0xca54('0x38')+_0x5ab1f7+_0xca54('0x39'))['join'](_0x2e2e2d,null,_0x2e2e2d+_0xca54('0x12')+_0x5ab1f7+'.'+_0x40bdd5)[_0xca54('0x13')](_0x5ab1f7+_0xca54('0x3a'),_0x5f4657)['where'](_0xca54('0x3b'),NOW)['where'](_0xca54('0x3c'),squel[_0xca54('0x35')]()[_0xca54('0xe')](_0xca54('0xf'))[_0xca54('0x10')](_0xca54('0x42'))[_0xca54('0x13')]('ListId\x20=\x20?',_0x5f4657)['where'](_0x40bdd5+'\x20=\x20'+_0x5ab1f7+'.'+_0x40bdd5)))[_0xca54('0x3f')]();}function insertCmHopperAdditionalPhones(_0x3e5438){var _0x2b278b=[_0xca54('0x47'),_0xca54('0x48'),'cm_contact_has_items.OrderBy',_0xca54('0x49'),_0xca54('0x4a')];return squel[_0xca54('0x45')]()[_0xca54('0x41')](_0xca54('0x4b'))[_0xca54('0x2d')]([_0xca54('0x4c'),'phone',_0xca54('0x4d'),'createdAt',_0xca54('0x32')],squel[_0xca54('0x35')]()[_0xca54('0x36')](_0x2b278b)[_0xca54('0x10')]('cm_hopper')[_0xca54('0x11')](_0xca54('0x37'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xca54('0x11')](_0xca54('0x4e'),null,_0xca54('0x4f'))[_0xca54('0x13')](_0xca54('0x50'),_0x3e5438)[_0xca54('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xca54('0x3f')]();}function insertCmContact(_0x463413,_0x2490b5,_0x28a24d,_0x4d3c90){var _0x3ccb64=_[_0xca54('0x51')](_[_0xca54('0x52')](_0x4d3c90),[_0xca54('0x30'),'CompanyId','createdAt','updatedAt']);return squel['insert']()[_0xca54('0x41')]('cm_contacts')[_0xca54('0x2d')](_0x3ccb64,squel[_0xca54('0x35')]()[_0xca54('0x36')](_0x3ccb64)['from'](_0x2490b5)[_0xca54('0x13')]('('+_0x28a24d['join'](',')+_0xca54('0x53'),squel[_0xca54('0x35')]()[_0xca54('0x36')](_0x28a24d)['from'](_0xca54('0x37'))[_0xca54('0x13')](_0xca54('0x43'),_0x463413)[_0xca54('0x13')]('deletedAt\x20IS\x20NULL'))['where'](_0xca54('0x54'),squel[_0xca54('0x35')]()[_0xca54('0xe')](_0xca54('0x55'),_0xca54('0x56'))[_0xca54('0x10')](_0x2490b5)[_0xca54('0x57')](_0x28a24d[_0xca54('0x11')](','))))[_0xca54('0x3f')]();}function handleStop(){logger[_0xca54('0x58')](_0xca54('0x59'));stopped=!![];}function handleUncaughtException(_0x3f95ac){logger['error'](_0x3f95ac[_0xca54('0x5a')]);process[_0xca54('0x5b')](0x1);}function handleError(_0x40aea0,_0x5838c8){stats[_0xca54('0x5c')][_0xca54('0x1a')]({'name':_0x5838c8[_0xca54('0x5d')],'message':_0x5838c8[_0xca54('0x5a')],'row':_0x40aea0});}function handleQuery(_0x27346d){logger[_0xca54('0x58')](_0x27346d);return db[_0xca54('0x5e')][_0xca54('0x5f')](_0x27346d)[_0xca54('0x60')](function(_0x5d701c){results[_0xca54('0x1a')](_0x5d701c);})[_0xca54('0x61')](function(_0x1c6f6b){logger[_0xca54('0x62')](_0x1c6f6b[_0xca54('0x5a')]);});}function updateTzCampaigns(_0x34e35f){return new Promise(function(_0x5bb315,_0x1600d7){var _0x698f9=squel['select']()[_0xca54('0x36')](['campaigns.id','campaigns.dialTimezone'])[_0xca54('0x10')](_0xca54('0x63'))[_0xca54('0x11')](_0xca54('0x64'),null,_0xca54('0x65'))[_0xca54('0x13')]('campaigns_has_cm_lists.CmListId='+_0x34e35f);db[_0xca54('0x5e')][_0xca54('0x5f')](_0x698f9[_0xca54('0x3f')]())[_0xca54('0x60')](function(_0x3afa33){var _0x55c511=[];for(var _0x2d6808=0x0;_0x2d6808<_0x3afa33['length'];_0x2d6808++){_0x55c511[_0xca54('0x1a')](getTimezoneData(_0x3afa33[_0x2d6808],tmp_campaigns));}BPromise[_0xca54('0x1b')](_0x55c511)[_0xca54('0x18')](function(){_0x5bb315({'val':0x1});});})[_0xca54('0x61')](function(_0x529350){logger[_0xca54('0x62')](_0x529350['message']);_0x5bb315({'val':0x0});});});}function updateTzVoiceQueues(_0x2210a6){return new Promise(function(_0x323dd3,_0x239b0f){var _0x22d746=squel[_0xca54('0x35')]()[_0xca54('0x36')](['voice_queues.id',_0xca54('0x66')])[_0xca54('0x10')](_0xca54('0x67'))[_0xca54('0x11')](_0xca54('0x68'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0xca54('0x13')](_0xca54('0x69')+_0x2210a6);db['sequelize'][_0xca54('0x5f')](_0x22d746[_0xca54('0x3f')]())[_0xca54('0x60')](function(_0x2ce2b1){var _0x175c86=[];for(var _0x1f3fc8=0x0;_0x1f3fc8<_0x2ce2b1['length'];_0x1f3fc8++){_0x175c86[_0xca54('0x1a')](getTimezoneData(_0x2ce2b1[_0x1f3fc8],tmp_voice_queues));}BPromise['all'](_0x175c86)['then'](function(){_0x323dd3({'val':0x1});});})[_0xca54('0x61')](function(_0x1b51b8){logger[_0xca54('0x62')](_0x1b51b8[_0xca54('0x5a')]);_0x323dd3({'val':0x0});});});}function getTimezoneData(_0x2760bc,_0x5f7f4c){return new Promise(function(_0x21d157,_0x46df0b){var _0x14a47e=shared[_0xca54('0x6a')];var _0x8bfe8b=_0x14a47e[_0x2760bc[_0xca54('0x6b')]];if(_['isNil'](_0x8bfe8b)){_0x21d157({'ret':0x1});}else{var _0x4777a4=_0x8bfe8b['utcOffset'];var _0x3ce7c5=squel[_0xca54('0x45')]()[_0xca54('0x41')](_0x5f7f4c)[_0xca54('0x6c')]('id',_0x2760bc['id'])[_0xca54('0x6c')](_0xca54('0x6d'),_0x4777a4)['set'](_0xca54('0x6b'),_0x2760bc['dialTimezone'])[_0xca54('0x3f')]();return db['sequelize'][_0xca54('0x5f')](_0x3ce7c5)[_0xca54('0x60')](function(_0x5559df){_0x21d157({'ret':0x1});})[_0xca54('0x61')](function(_0x1d6730){logger['error'](_0x1d6730[_0xca54('0x5a')]);_0x46df0b({'ret':0x1});});}});}function handleTZQuery(_0x3a9389){logger[_0xca54('0x58')](_0x3a9389);return db['sequelize']['query'](_0x3a9389)[_0xca54('0x60')](function(_0xc570c0){})[_0xca54('0x61')](function(_0x1b4ea0){logger[_0xca54('0x62')](_0x1b4ea0[_0xca54('0x5a')]);});}function main(_0x6c17ef,_0x1abded,_0x2370ed,_0x1951f4){logger[_0xca54('0x58')](_0xca54('0x6e'),_0x6c17ef,JSON[_0xca54('0x6f')](_0x1abded));process['send']('start');var _0x3c7a95=_0x1abded[_0xca54('0x70')];var _0x562b0a=_[_0xca54('0x71')](_0x3c7a95);var _0xe89799=_0x1abded['socket_timestamp'];var _0x2e5657=path[_0xca54('0x11')](config['root'],_0xca54('0x72'),_0xe89799+_0xca54('0x73'));hasTZ=_['keys'](_0x3c7a95)[_0xca54('0x74')](_0xca54('0x6b'));var _0x4d3b0c=_[_0xca54('0x52')](_0x3c7a95)['join']();logger[_0xca54('0x58')](_0xca54('0x75'),_0x4d3b0c);db[_0xca54('0x76')][_0xca54('0x16')]({'raw':!![],'attributes':['id',_0xca54('0x77')]})[_0xca54('0x18')](function(_0x5873c7){for(var _0xc2d6a=0x0;_0xc2d6a<_0x5873c7[_0xca54('0x19')];_0xc2d6a++){if(_0x5873c7[_0xc2d6a][_0xca54('0x77')]in _0x3c7a95){contactItemTypes['push'](_0x5873c7[_0xc2d6a]);delete _0x562b0a[_0x5873c7[_0xc2d6a]['name']];hasAdditionalPhones=!![];}for(var _0x213966 in _0x3c7a95){if(_0x5873c7[_0xc2d6a][_0xca54('0x77')]+_0xca54('0x78')===_0x213966){phoneDescriptions[_0xca54('0x1a')]({'itemTypeId':_0x5873c7[_0xc2d6a]['id'],'description':_0x213966});delete _0x562b0a[_0x213966];}}}if(hasAdditionalPhones)_0x562b0a[_0xca54('0x17')]='';var _0xc474d=_[_0xca54('0x52')](_0x562b0a)[_0xca54('0x11')]();logger[_0xca54('0x58')](_0xca54('0x75'),_0xc474d);fs[_0xca54('0x79')](_0x2e5657,_0xc474d+'\x0a');Papa[_0xca54('0x7a')](fs[_0xca54('0x7b')](_0x6c17ef),{'header':!![],'skipEmptyLines':!![],'step':function(_0xed28ff,_0x363068){try{for(var _0x1a7c4b=0x0,_0x1315cf=[];_0x1a7c4b<_0xed28ff[_0xca54('0x7c')][_0xca54('0x19')];_0x1a7c4b++){stats[_0xca54('0x7d')]+=0x1;if(_0xed28ff['errors'][_0x1a7c4b]){handleError(_0xed28ff[_0xca54('0x7c')][_0x1a7c4b],_0xed28ff[_0xca54('0x5c')][_0x1a7c4b]);}else{var _0x1a719d=[];var _0x5beb2c=[];var _0x24a306={};for(var _0x2ecfbf in _0x3c7a95){let _0x3c6ba5=contactItemTypes[_0xca54('0x7e')](_0x5c6b00=>_0x5c6b00[_0xca54('0x77')]===_0x2ecfbf);let _0x5dac77=contactItemTypes[_0xca54('0x7e')](_0x75c82b=>_0x75c82b[_0xca54('0x77')]+_0xca54('0x78')===_0x2ecfbf);if(_[_0xca54('0x1d')](_0x3c6ba5)&&_[_0xca54('0x1d')](_0x5dac77)){if(_0x3c7a95[_0xca54('0x7f')](_0x2ecfbf)){if(_0xed28ff[_0xca54('0x7c')][_0x1a7c4b][_0x3c7a95[_0x2ecfbf]]){var _0x4dec49=_['trim'](_0xed28ff[_0xca54('0x7c')][_0x1a7c4b][_0x3c7a95[_0x2ecfbf]][_0xca54('0x80')](/"/g,'\x27'));switch(_0x2ecfbf){case _0xca54('0x2e'):var _0x6cf15d=moment(_0x4dec49,_0xca54('0x81'),!![]);if(_0x6cf15d[_0xca54('0x82')]()){_0x1315cf['push']('\x22'+_0x4dec49+'\x22');}else{_0x1a719d[_0xca54('0x1a')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x42dd6c=parseInt(_0x4dec49);_0x4dec49=_[_0xca54('0x83')](_0x42dd6c)||_0x42dd6c<0x0||_0x42dd6c>0x4?_0x1951f4?0x3:0x2:_0x42dd6c;_0x1315cf[_0xca54('0x1a')]('\x22'+_0x4dec49+'\x22');break;case _0xca54('0x34'):var _0x574ac0=parseInt(_0x4dec49);if(_[_0xca54('0x84')](_0x574ac0)&&_[_0xca54('0x74')](_0x2370ed,_0x574ac0)){_0x1315cf[_0xca54('0x1a')]('\x22'+_0x574ac0+'\x22');}else{_0x1a719d[_0xca54('0x1a')](_0xca54('0x85'));}break;case _0xca54('0x86'):if(isEmail(_0x4dec49)){_0x1315cf[_0xca54('0x1a')]('\x22'+_0x4dec49+'\x22');}else{_0x1a719d[_0xca54('0x1a')](_0xca54('0x87'));}break;case _0xca54('0x88'):var _0x3768c7=moment(_0x4dec49,_0xca54('0x89'),!![]);if(_0x3768c7[_0xca54('0x82')]()){_0x1315cf[_0xca54('0x1a')]('\x22'+_0x4dec49+'\x22');}else{_0x1a719d['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case _0xca54('0x6b'):var _0x4f3589=shared[_0xca54('0x6a')];var _0x13c2f6=_0x4f3589[_0x4dec49];if(!_[_0xca54('0x1d')](_0x13c2f6)){var _0x41caa6=_0x13c2f6[_0xca54('0x8a')];_0x1315cf['push']('\x22'+_0x4dec49+'\x22');_0x1315cf[_0xca54('0x1a')]('\x22'+_0x41caa6+'\x22');}break;default:_0x1315cf[_0xca54('0x1a')]('\x22'+_0x4dec49+'\x22');}}else{switch(_0x2ecfbf){case _0xca54('0x8b'):case'phone':_0x1a719d[_0xca54('0x1a')](_0x2ecfbf+_0xca54('0x8c'));break;default:_0x1315cf[_0xca54('0x1a')]('\x22\x22');}}}}else{var _0x3064dd='';if(!_[_0xca54('0x1d')](_0x3c6ba5)){if(!_0x24a306['hasOwnProperty'](_0x3c6ba5['id'])){if(!_[_0xca54('0x1d')](_0xed28ff['data'][_0x1a7c4b][_0x3c7a95[_0x2ecfbf]])){var _0x4dec49=_[_0xca54('0x8d')](_0xed28ff[_0xca54('0x7c')][_0x1a7c4b][_0x3c7a95[_0x2ecfbf]][_0xca54('0x80')](/"/g,'\x27'));var _0x5a337c=phoneDescriptions[_0xca54('0x7e')](_0x249f89=>_0x249f89[_0xca54('0x8e')]===_0x3c6ba5['id']);if(!_['isNil'](_0x5a337c)){var _0x5020d3=_[_0xca54('0x8d')](_0xed28ff[_0xca54('0x7c')][_0x1a7c4b][_0x3c7a95[_0x5a337c[_0xca54('0x8f')]]][_0xca54('0x80')](/"/g,'\x27'));if(!_[_0xca54('0x1d')](_0x5020d3))_0x4dec49=_0x4dec49+'§'+_0x5020d3;}if(_0x3064dd=='')_0x3064dd=_0x4dec49;else _0x3064dd+='|'+_0x4dec49;}_0x5beb2c[_0xca54('0x1a')](_0x3c6ba5['id']+':'+_0x3064dd);_0x24a306[_0x3c6ba5['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1315cf['push']('\x22'+_0x5beb2c[_0xca54('0x11')](';')+'\x22');}if(_0x1a719d['length']){handleError(_0xed28ff[_0xca54('0x7c')][_0x1a7c4b],{'code':_0xca54('0x90'),'message':_0x1a719d[_0xca54('0x11')]()});}else{fs[_0xca54('0x91')](_0x2e5657,_0x1315cf[_0xca54('0x11')]()+'\x0a');}_0x1315cf=[];}if(!(stats[_0xca54('0x7d')]%0xc8)){socket[_0xca54('0x92')](_0xca54('0x93')+_0xe89799,stats);stats[_0xca54('0x5c')]=[];}}if(stopped){logger[_0xca54('0x58')]('Abort\x20parser');_0x363068['abort']();}}catch(_0x5a0e49){handleError(_0xed28ff[_0xca54('0x7c')][_0x1a7c4b],{'code':_0xca54('0x94'),'message':_0x5a0e49['message']});logger[_0xca54('0x62')]('step',_0x5a0e49[_0xca54('0x5a')]);}},'complete':function(){try{var _0x26e16d=[];var _0x2cf7ef=[];var _0x3fff69=_0xca54('0x37');if(_0x1abded[_0xca54('0x95')]&&_0x1abded[_0xca54('0x95')][_0xca54('0x19')]){_0x3fff69=_0xca54('0x96')+_0xe89799;_0x26e16d[_0xca54('0x1a')](_0xca54('0x97')+_0x3fff69+_0xca54('0x98'));}tmp_campaigns=_0xca54('0x99')+_0xe89799;tmp_voice_queues='voice_queues_'+_0xe89799;_0x2cf7ef[_0xca54('0x1a')](_0xca54('0x97')+tmp_campaigns+_0xca54('0x9a'));_0x2cf7ef[_0xca54('0x1a')](_0xca54('0x97')+tmp_voice_queues+_0xca54('0x9a'));BPromise[_0xca54('0x9b')](_0x2cf7ef,handleTZQuery)[_0xca54('0x18')](function(_0x40e548){updateTzCampaigns(_0x1abded['ListId'])['then'](function(_0x5c7a77){updateTzVoiceQueues(_0x1abded['ListId'])['then'](function(_0x11d8f8){if(hasTZ)_0xc474d=_0xc474d[_0xca54('0x80')](_0xca54('0x6b'),'dialTimezone,utcOffset');var _0x5e7b3c=util['format']('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',_0x2e5657,_0x3fff69,_0xc474d,_0x1abded[_0xca54('0x30')],_0x1abded[_0xca54('0x9c')]||null,NOW,NOW);if(_[_0xca54('0x1d')](_0x3c7a95[_0xca54('0x2e')])){_0x5e7b3c+=_0xca54('0x9d');}_0x26e16d[_0xca54('0x1a')](_0x5e7b3c);if(_0x1abded[_0xca54('0x95')]&&_0x1abded[_0xca54('0x95')][_0xca54('0x19')]){_0x26e16d[_0xca54('0x1a')](insertCmContact(_0x1abded[_0xca54('0x30')],_0x3fff69,_0x1abded[_0xca54('0x95')],_0x3c7a95));_0x26e16d['push'](_0xca54('0x9e')+_0x3fff69+';');}BPromise[_0xca54('0x9b')](_0x26e16d,handleQuery)[_0xca54('0x18')](function(_0x4dcee0){BPromise[_0xca54('0x1b')]([handleAdditionalPhones()])[_0xca54('0x18')](function(){_0x26e16d=[];for(var _0x247950=0x0;_0x247950\x20\x20','server/files/tmp','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','moment','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','push','all','then','error','message','length','filter','split','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','CmContact','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','from','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x5d62d1,_0x4d8632){_0x5d62d1=_0x5d62d1-0x0;var _0xceb98d=_0x9c1d[_0x5d62d1];return _0xceb98d;};'use strict';var fs=require('fs');var path=require(_0xd9c1('0x0'));var _=require(_0xd9c1('0x1'));var Papa=require(_0xd9c1('0x2'));var util=require('util');var BPromise=require(_0xd9c1('0x3'));var moment=require(_0xd9c1('0x4'));var squel=require('squel');var Redis=require(_0xd9c1('0x5'));var db=require(_0xd9c1('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0xd9c1('0x7'))(_0xd9c1('0x8'));config[_0xd9c1('0x9')]=_[_0xd9c1('0xa')](config[_0xd9c1('0x9')],{'host':_0xd9c1('0xb'),'port':0x18eb});var socket=require(_0xd9c1('0xc'))(new Redis(config[_0xd9c1('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xd9c1('0xd')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0xd9c1('0xe')+moment()[_0xd9c1('0xd')](_0xd9c1('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x19bc13){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))*$/[_0xd9c1('0x10')](_0x19bc13);}function selectNotIn(_0x9592c8,_0x3c57e7,_0x51c217,_0x1c5ade,_0x27336b){return squel[_0xd9c1('0x11')]()['field'](_0xd9c1('0x12'))['from'](_0x1c5ade)[_0xd9c1('0x13')](_0x3c57e7,null,_0x3c57e7+_0xd9c1('0x14')+_0x1c5ade+'.'+_0x51c217)[_0xd9c1('0x15')](_0x1c5ade+'.'+_0x51c217+_0xd9c1('0x16')+_0x9592c8+'.'+_0x51c217)[_0xd9c1('0x15')](_0x3c57e7+_0xd9c1('0x17')+_0x27336b[_0xd9c1('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x13b927,_0xf95f06){promisesAdditionalPhones=[];promisesContact=[];return db[_0xd9c1('0x18')][_0xd9c1('0x19')](_0xd9c1('0x1a')+tempTableName)[_0xd9c1('0x1b')](function(_0x174ccd){if(_0x174ccd!==null){var _0xe47aa2=[];for(var _0x5e500f=0x0;_0x5e500f<_0x174ccd['length'];_0x5e500f++){var _0x11b887=_0x174ccd[_0x5e500f];if(!_[_0xd9c1('0x1c')](_0x11b887[_0xd9c1('0x12')])){if(!_[_0xd9c1('0x1c')](_0x11b887[_0xd9c1('0x1d')]))_0xe47aa2[_0xd9c1('0x1e')](insertAdditionalPhones(_0x11b887));promisesContact[_0xd9c1('0x1e')]({'contact':_0x11b887});}}}Promise[_0xd9c1('0x1f')](_0xe47aa2)[_0xd9c1('0x20')](function(){_0x13b927({'val':0x1});});})['catch'](function(_0x184c4b){logger[_0xd9c1('0x21')](_0x184c4b[_0xd9c1('0x22')]);});});}function insertAdditionalPhones(_0x2aea78){return new Promise(function(_0x4643ad,_0x36728a){var _0x509502=_0x2aea78[_0xd9c1('0x1d')];if(_[_0xd9c1('0x1c')](_0x509502))_0x36728a({'val':0x0});else{var _0x2bd0ab=_0x509502['split'](';');var _0x5b62ac=[];orderBy=0x0;for(var _0x410be7=0x0;_0x410be7<_0x2bd0ab[_0xd9c1('0x23')];_0x410be7++){_0x5b62ac[_0xd9c1('0x1e')](splitAdditionalPhone(_0x2aea78['id'],_0x2bd0ab[_0x410be7]));}Promise[_0xd9c1('0x1f')](_0x5b62ac)[_0xd9c1('0x20')](function(){_0x4643ad({'val':_0x2bd0ab[_0xd9c1('0x23')]});});}});}function splitAdditionalPhone(_0x27818f,_0x562efb){return new Promise(function(_0x26df40,_0x241cf1){var _0x4ea9ed=_0x562efb['split'](':');var _0x2245ca=_0x4ea9ed[0x0];var _0x45b15d=_0x4ea9ed[0x1];if(_0x45b15d!==''){var _0x5106e3=_0x45b15d['split']('|');var _0x36a367=[];for(var _0x282e01=0x0;_0x282e01<_0x5106e3['length'];_0x282e01++){if(_0x5106e3[_0x282e01]!==''){var _0x4dcc10=_[_0xd9c1('0x24')](promisesAdditionalPhones,{'contactId':_0x27818f,'phone':_0x5106e3[_0x282e01]});if(_0x4dcc10[_0xd9c1('0x23')]==0x0){orderBy++;promisesAdditionalPhones[_0xd9c1('0x1e')]({'contactId':_0x27818f,'contactTypeId':_0x2245ca,'phone':_0x5106e3[_0x282e01],'orderBy':orderBy});}}}_0x26df40({'ok':0x1});}else _0x26df40({'res':0x0});});}function createAdditionalPhone(_0x28bd8a,_0xc0192e,_0x7373cb,_0x146f21){var _0x5ba2fe='';var _0x250527='';var _0x223b88=_0x7373cb[_0xd9c1('0x25')]('§');_0x5ba2fe=_0x223b88[0x0];if(_0x223b88[_0xd9c1('0x23')]==0x2)_0x250527=_0x223b88[0x1];return new Promise(function(_0x44df35,_0xd6248b){return db[_0xd9c1('0x26')][_0xd9c1('0x27')]({'where':{'CmContactId':_0x28bd8a,'item':_0x5ba2fe}})['then'](function(_0x5117d6){if(_0x5117d6){return db['CmContactHasItem'][_0xd9c1('0x28')]({'ItemTypeId':_0xc0192e,'description':_0x250527,'OrderBy':_0x146f21},{'where':{'CmContactId':_0x28bd8a,'item':_0x5ba2fe}})['then'](function(_0x21a3d5){_0x44df35({'res':_0xd9c1('0x29')});});}else{return db['CmContactHasItem'][_0xd9c1('0x2a')]({'CmContactId':_0x28bd8a,'item':_0x5ba2fe,'ItemTypeId':_0xc0192e,'description':_0x250527,'OrderBy':_0x146f21,'ItemClass':_0xd9c1('0x2b')})[_0xd9c1('0x20')](function(_0x19d4d6){_0x44df35({'res':_0xd9c1('0x2c')});});}});});}function updateContact(_0xd05370){return new Promise(function(_0xa0f03e,_0x25e0e7){var _0x2c5974=_0xd05370['id'];delete _0xd05370['id'];return db[_0xd9c1('0x2d')][_0xd9c1('0x28')](_0xd05370,{'where':{'id':_0x2c5974}})[_0xd9c1('0x20')](function(_0x4fd94b){updatedRows+=0x1;return db['CmHopper'][_0xd9c1('0x28')]({'phone':_0xd05370[_0xd9c1('0x12')]},{'where':{'ContactId':_0x2c5974}})[_0xd9c1('0x20')](function(_0x4a1ae3){_0xa0f03e({'ret':'OK'});});});});}function insertCmHopper(_0x6f70be,_0x100720,_0x5905be,_0x1e5aad,_0x374f25){var _0x53477d=['cm_contacts.phone',_0xd9c1('0x2e'),_0xd9c1('0x2f'),_0xd9c1('0x30'),_0x100720+'.'+_0x1e5aad,_0xd9c1('0x31'),_0xd9c1('0x32'),_0xd9c1('0x33'),'cm_contacts.UserId','\x22'+_0x374f25+'\x22'];return squel[_0xd9c1('0x34')]()[_0xd9c1('0x35')](_0xd9c1('0x36'))['fromQuery']([_0xd9c1('0x12'),_0xd9c1('0x37'),_0xd9c1('0x38'),_0xd9c1('0x39'),_0x1e5aad,_0xd9c1('0x3a'),_0xd9c1('0x3b'),_0xd9c1('0x3c'),_0xd9c1('0x3d'),_0xd9c1('0x3e')],squel[_0xd9c1('0x11')]()['fields'](_0x53477d)[_0xd9c1('0x3f')](_0x100720)[_0xd9c1('0x13')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x100720+'.CmListId')[_0xd9c1('0x13')](_0x5905be,null,_0x5905be+_0xd9c1('0x14')+_0x100720+'.'+_0x1e5aad)[_0xd9c1('0x15')](_0x100720+_0xd9c1('0x40'),_0x6f70be)['where'](_0xd9c1('0x41'),NOW)[_0xd9c1('0x15')](_0xd9c1('0x42'),selectNotIn(_0x100720,_0x5905be,_0x1e5aad,'cm_hopper',['\x22always\x22',_0xd9c1('0x43')]))[_0xd9c1('0x15')](_0xd9c1('0x42'),selectNotIn(_0x100720,_0x5905be,_0x1e5aad,_0xd9c1('0x36'),[_0xd9c1('0x44')])))[_0xd9c1('0x45')]();}function insertCmHopperBlack(_0x179fb2,_0x12992d,_0x1f5f81,_0x4f55a3){var _0xd12d65=[_0xd9c1('0x46'),_0xd9c1('0x2f'),'cm_contacts.ListId',_0x12992d+'.'+_0x4f55a3,'cm_contacts.createdAt',_0xd9c1('0x32')];return squel['insert']()[_0xd9c1('0x35')]('cm_hopper_black')['fromQuery']([_0xd9c1('0x12'),_0xd9c1('0x38'),_0xd9c1('0x39'),_0x4f55a3,_0xd9c1('0x3a'),_0xd9c1('0x3b')],squel[_0xd9c1('0x11')]()[_0xd9c1('0x47')](_0xd12d65)[_0xd9c1('0x3f')](_0x12992d)[_0xd9c1('0x13')](_0xd9c1('0x48'),null,_0xd9c1('0x49')+_0x12992d+_0xd9c1('0x4a'))[_0xd9c1('0x13')](_0x1f5f81,null,_0x1f5f81+_0xd9c1('0x14')+_0x12992d+'.'+_0x4f55a3)[_0xd9c1('0x15')](_0x12992d+_0xd9c1('0x40'),_0x179fb2)['where'](_0xd9c1('0x41'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xd9c1('0x11')]()[_0xd9c1('0x4b')](_0xd9c1('0x12'))[_0xd9c1('0x3f')](_0xd9c1('0x4c'))[_0xd9c1('0x15')](_0xd9c1('0x4d'),_0x179fb2)[_0xd9c1('0x15')](_0x4f55a3+_0xd9c1('0x4e'),_0x12992d+'.'+_0x4f55a3)))[_0xd9c1('0x45')]();}function insertCmHopperAdditionalPhones(_0x52ce90){var _0x225fdc=['cm_hopper.id','cm_contact_has_items.item',_0xd9c1('0x4f'),_0xd9c1('0x50'),_0xd9c1('0x51')];return squel[_0xd9c1('0x34')]()[_0xd9c1('0x35')]('cm_hopper_additional_phones')[_0xd9c1('0x52')]([_0xd9c1('0x53'),'phone',_0xd9c1('0x54'),_0xd9c1('0x3a'),_0xd9c1('0x3b')],squel[_0xd9c1('0x11')]()[_0xd9c1('0x47')](_0x225fdc)['from'](_0xd9c1('0x36'))[_0xd9c1('0x13')](_0xd9c1('0x48'),null,_0xd9c1('0x55'))['join'](_0xd9c1('0x56'),null,_0xd9c1('0x57'))[_0xd9c1('0x15')](_0xd9c1('0x58'),_0x52ce90)[_0xd9c1('0x15')](_0xd9c1('0x41'),NOW))[_0xd9c1('0x45')]();}function insertCmContact(_0x765e00,_0x12fdab,_0x58d8e0,_0x209732){var _0x7cc89d=_['concat'](_[_0xd9c1('0x59')](_0x209732),[_0xd9c1('0x39'),_0xd9c1('0x5a'),_0xd9c1('0x3a'),_0xd9c1('0x3b')]);return squel[_0xd9c1('0x34')]()[_0xd9c1('0x35')](_0xd9c1('0x48'))[_0xd9c1('0x52')](_0x7cc89d,squel[_0xd9c1('0x11')]()['fields'](_0x7cc89d)[_0xd9c1('0x3f')](_0x12fdab)[_0xd9c1('0x15')]('('+_0x58d8e0[_0xd9c1('0x13')](',')+_0xd9c1('0x5b'),squel[_0xd9c1('0x11')]()[_0xd9c1('0x47')](_0x58d8e0)[_0xd9c1('0x3f')](_0xd9c1('0x48'))[_0xd9c1('0x15')](_0xd9c1('0x4d'),_0x765e00))['where'](_0xd9c1('0x5c'),squel['select']()[_0xd9c1('0x4b')](_0xd9c1('0x5d'),_0xd9c1('0x5e'))[_0xd9c1('0x3f')](_0x12fdab)['group'](_0x58d8e0[_0xd9c1('0x13')](','))))[_0xd9c1('0x45')]();}function handleStop(){logger[_0xd9c1('0x5f')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x34de0d){logger[_0xd9c1('0x21')](_0x34de0d['message']);process[_0xd9c1('0x60')](0x1);}function handleError(_0x1956ad,_0x42f5d5){stats[_0xd9c1('0x61')][_0xd9c1('0x1e')]({'name':_0x42f5d5[_0xd9c1('0x62')],'message':_0x42f5d5[_0xd9c1('0x22')],'row':_0x1956ad});}function handleQuery(_0x15bbf5){logger['info'](_0x15bbf5);return db['sequelize']['query'](_0x15bbf5)[_0xd9c1('0x1b')](function(_0xc6b41a){results[_0xd9c1('0x1e')](_0xc6b41a);})[_0xd9c1('0x63')](function(_0x5c36f2){logger[_0xd9c1('0x21')](_0x5c36f2[_0xd9c1('0x22')]);});}function main(_0x171034,_0x40acd8,_0x2f7ea5,_0x50aa22){logger[_0xd9c1('0x5f')]('main',_0x171034,JSON[_0xd9c1('0x64')](_0x40acd8));process[_0xd9c1('0x65')](_0xd9c1('0x66'));var _0x4c2720=_0x40acd8[_0xd9c1('0x67')];var _0x2eaadc=_[_0xd9c1('0x68')](_0x4c2720);var _0xaabac7=_0x40acd8[_0xd9c1('0x69')];var _0x1a4e7d=path[_0xd9c1('0x13')](config[_0xd9c1('0x6a')],'server/files/tmp',_0xaabac7+_0xd9c1('0x6b'));logger['info'](_0xd9c1('0x6c'),_0x40acd8);db[_0xd9c1('0x6d')][_0xd9c1('0x6e')]({'raw':!![],'attributes':['id',_0xd9c1('0x6f')]})[_0xd9c1('0x20')](function(_0x165dd4){for(var _0x164f61=0x0;_0x164f61<_0x165dd4[_0xd9c1('0x23')];_0x164f61++){if(_0x165dd4[_0x164f61][_0xd9c1('0x6f')]in _0x4c2720){contactItemTypes[_0xd9c1('0x1e')](_0x165dd4[_0x164f61]);delete _0x2eaadc[_0x165dd4[_0x164f61][_0xd9c1('0x6f')]];hasAdditionalPhones=!![];}for(var _0x5c8fe8 in _0x4c2720){if(_0x165dd4[_0x164f61][_0xd9c1('0x6f')]+'_description'===_0x5c8fe8){phoneDescriptions[_0xd9c1('0x1e')]({'itemTypeId':_0x165dd4[_0x164f61]['id'],'description':_0x5c8fe8});delete _0x2eaadc[_0x5c8fe8];}}}if(hasAdditionalPhones)_0x2eaadc['AdditionalPhones']='';var _0x1c99a1=_['keys'](_0x2eaadc)[_0xd9c1('0x13')]();logger[_0xd9c1('0x5f')](_0xd9c1('0x70'),_0x1c99a1);fs[_0xd9c1('0x71')](_0x1a4e7d,_0x1c99a1+'\x0a');Papa[_0xd9c1('0x72')](fs[_0xd9c1('0x73')](_0x171034),{'header':!![],'skipEmptyLines':!![],'step':function(_0xc91efc,_0x234484){try{for(var _0x227d74=0x0,_0xcf6597=[];_0x227d74<_0xc91efc[_0xd9c1('0x74')][_0xd9c1('0x23')];_0x227d74++){stats[_0xd9c1('0x75')]+=0x1;if(_0xc91efc[_0xd9c1('0x61')][_0x227d74]){handleError(_0xc91efc[_0xd9c1('0x74')][_0x227d74],_0xc91efc[_0xd9c1('0x61')][_0x227d74]);}else{var _0x5e6ba1=[];var _0x3d80b6=[];var _0x30a2b5={};for(var _0x1f0cac in _0x4c2720){let _0x2afc6c=contactItemTypes[_0xd9c1('0x76')](_0x2484fc=>_0x2484fc[_0xd9c1('0x6f')]===_0x1f0cac);let _0x3051e5=contactItemTypes[_0xd9c1('0x76')](_0x562b5b=>_0x562b5b[_0xd9c1('0x6f')]+_0xd9c1('0x77')===_0x1f0cac);if(_['isNil'](_0x2afc6c)&&_[_0xd9c1('0x1c')](_0x3051e5)){if(_0x4c2720[_0xd9c1('0x78')](_0x1f0cac)){if(_0xc91efc[_0xd9c1('0x74')][_0x227d74][_0x4c2720[_0x1f0cac]]){var _0x508fd7=_['trim'](_0xc91efc[_0xd9c1('0x74')][_0x227d74][_0x4c2720[_0x1f0cac]][_0xd9c1('0x79')](/"/g,'\x27'));switch(_0x1f0cac){case _0xd9c1('0x37'):var _0x133b29=moment(_0x508fd7,_0xd9c1('0x7a'),!![]);if(_0x133b29['isValid']()){_0xcf6597[_0xd9c1('0x1e')]('\x22'+_0x508fd7+'\x22');}else{_0x5e6ba1[_0xd9c1('0x1e')](_0xd9c1('0x7b'));}break;case _0xd9c1('0x3c'):var _0x461756=parseInt(_0x508fd7);_0x508fd7=_[_0xd9c1('0x7c')](_0x461756)||_0x461756<0x0||_0x461756>0x4?_0x50aa22?0x3:0x2:_0x461756;_0xcf6597[_0xd9c1('0x1e')]('\x22'+_0x508fd7+'\x22');break;case'UserId':var _0x719c3b=parseInt(_0x508fd7);if(_[_0xd9c1('0x7d')](_0x719c3b)&&_[_0xd9c1('0x7e')](_0x2f7ea5,_0x719c3b)){_0xcf6597[_0xd9c1('0x1e')]('\x22'+_0x719c3b+'\x22');}else{_0x5e6ba1[_0xd9c1('0x1e')](_0xd9c1('0x7f'));}break;case _0xd9c1('0x80'):if(isEmail(_0x508fd7)){_0xcf6597[_0xd9c1('0x1e')]('\x22'+_0x508fd7+'\x22');}else{_0x5e6ba1[_0xd9c1('0x1e')]('email\x20wrong\x20format');}break;case _0xd9c1('0x81'):var _0x5ccbaf=moment(_0x508fd7,'YYYY-MM-DD',!![]);if(_0x5ccbaf['isValid']()){_0xcf6597[_0xd9c1('0x1e')]('\x22'+_0x508fd7+'\x22');}else{_0x5e6ba1[_0xd9c1('0x1e')](_0xd9c1('0x82'));}break;default:_0xcf6597[_0xd9c1('0x1e')]('\x22'+_0x508fd7+'\x22');}}else{switch(_0x1f0cac){case'firstName':case _0xd9c1('0x12'):_0x5e6ba1[_0xd9c1('0x1e')](_0x1f0cac+_0xd9c1('0x83'));break;default:_0xcf6597[_0xd9c1('0x1e')]('\x22\x22');}}}}else{var _0x56ce99='';if(!_[_0xd9c1('0x1c')](_0x2afc6c)){if(!_0x30a2b5['hasOwnProperty'](_0x2afc6c['id'])){for(var _0x155dcf=0x0;_0x155dcf<_0x4c2720[_0x1f0cac][_0xd9c1('0x23')];_0x155dcf++){var _0x508fd7=_[_0xd9c1('0x84')](_0xc91efc['data'][_0x227d74][_0x4c2720[_0x1f0cac][_0x155dcf]][_0xd9c1('0x79')](/"/g,'\x27'));var _0x14ed08=phoneDescriptions[_0xd9c1('0x76')](_0x2f1d99=>_0x2f1d99[_0xd9c1('0x85')]===_0x2afc6c['id']);if(!_[_0xd9c1('0x1c')](_0x14ed08)){var _0x2760bf=_[_0xd9c1('0x84')](_0xc91efc['data'][_0x227d74][_0x4c2720[_0x14ed08[_0xd9c1('0x86')]][0x0]][_0xd9c1('0x79')](/"/g,'\x27'));if(!_['isNil'](_0x2760bf))_0x508fd7=_0x508fd7+'§'+_0x2760bf;}if(_0x56ce99=='')_0x56ce99=_0x508fd7;else _0x56ce99+='|'+_0x508fd7;}_0x3d80b6[_0xd9c1('0x1e')](_0x2afc6c['id']+':'+_0x56ce99);_0x30a2b5[_0x2afc6c['id']]=0x1;}}}}if(hasAdditionalPhones){_0xcf6597[_0xd9c1('0x1e')]('\x22'+_0x3d80b6[_0xd9c1('0x13')](';')+'\x22');}if(_0x5e6ba1[_0xd9c1('0x23')]){handleError(_0xc91efc[_0xd9c1('0x74')][_0x227d74],{'code':'SystemRow','message':_0x5e6ba1[_0xd9c1('0x13')]()});}else{fs[_0xd9c1('0x87')](_0x1a4e7d,_0xcf6597[_0xd9c1('0x13')]()+'\x0a');}_0xcf6597=[];}if(!(stats[_0xd9c1('0x75')]%0xc8)){socket['emit'](_0xd9c1('0x88')+_0xaabac7,stats);stats[_0xd9c1('0x61')]=[];}}if(stopped){logger[_0xd9c1('0x5f')](_0xd9c1('0x89'));_0x234484['abort']();}}catch(_0x520436){handleError(_0xc91efc[_0xd9c1('0x74')][_0x227d74],{'code':_0xd9c1('0x8a'),'message':_0x520436[_0xd9c1('0x22')]});logger['error'](_0xd9c1('0x8b'),_0x520436[_0xd9c1('0x22')]);}},'complete':function(){try{var _0x25aebe=[];var _0x47879a=tempTableName;_0x25aebe[_0xd9c1('0x1e')](_0xd9c1('0x8c')+_0x47879a+'\x20LIKE\x20cm_contacts;');logger[_0xd9c1('0x5f')](_0xd9c1('0x8d'),contactItemTypes['length']);var _0x47ea8=util['format'](_0xd9c1('0x8e'),_0x1a4e7d,_0x47879a,_0x1c99a1,_0x40acd8['ListId'],_0x40acd8[_0xd9c1('0x5a')]||null,NOW,NOW);if(_[_0xd9c1('0x1c')](_0x4c2720[_0xd9c1('0x37')])){_0x47ea8+=',\x20scheduledAt\x20=\x20NOW()';}_0x25aebe[_0xd9c1('0x1e')](_0x47ea8);BPromise[_0xd9c1('0x8f')](_0x25aebe,handleQuery)[_0xd9c1('0x20')](function(_0x395126){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x25aebe=[];for(var _0x4b6c0c=0x0;_0x4b6c0c\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0xaec5,0x92));var _0x5aec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaec5[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require(_0x5aec('0x0'));var _=require(_0x5aec('0x1'));var Papa=require(_0x5aec('0x2'));var util=require(_0x5aec('0x3'));var BPromise=require(_0x5aec('0x4'));var moment=require(_0x5aec('0x5'));var squel=require('squel');var Redis=require(_0x5aec('0x6'));var db=require(_0x5aec('0x7'))['db'];var config=require(_0x5aec('0x8'));var logger=require('../../../config/logger')('import');config['redis']=_['defaults'](config[_0x5aec('0x9')],{'host':_0x5aec('0xa'),'port':0x18eb});var socket=require(_0x5aec('0xb'))(new Redis(config[_0x5aec('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0x5aec('0xc'));var tempTableName=_0x5aec('0xd')+moment()['format'](_0x5aec('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x305523){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))*$/[_0x5aec('0xf')](_0x305523);}function selectNotIn(_0x402408,_0x29b092,_0xf888c3,_0x24788b,_0x5e0542){return squel['select']()[_0x5aec('0x10')](_0x5aec('0x11'))[_0x5aec('0x12')](_0x24788b)[_0x5aec('0x13')](_0x29b092,null,_0x29b092+_0x5aec('0x14')+_0x24788b+'.'+_0xf888c3)[_0x5aec('0x15')](_0x24788b+'.'+_0xf888c3+_0x5aec('0x16')+_0x402408+'.'+_0xf888c3)[_0x5aec('0x15')](_0x29b092+_0x5aec('0x17')+_0x5e0542[_0x5aec('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x229950,_0x580c44){promisesAdditionalPhones=[];promisesContact=[];return db[_0x5aec('0x18')][_0x5aec('0x19')]('select\x20*\x20from\x20'+tempTableName)[_0x5aec('0x1a')](function(_0x51cc5b){if(_0x51cc5b!==null){var _0x4218b0=[];for(var _0x1d631e=0x0;_0x1d631e<_0x51cc5b[_0x5aec('0x1b')];_0x1d631e++){var _0x39e70d=_0x51cc5b[_0x1d631e];if(!_['isNil'](_0x39e70d[_0x5aec('0x11')])){if(!_[_0x5aec('0x1c')](_0x39e70d[_0x5aec('0x1d')]))_0x4218b0[_0x5aec('0x1e')](insertAdditionalPhones(_0x39e70d));promisesContact[_0x5aec('0x1e')]({'contact':_0x39e70d});}}}Promise['all'](_0x4218b0)[_0x5aec('0x1f')](function(){_0x229950({'val':0x1});});})[_0x5aec('0x20')](function(_0x4b8a75){logger[_0x5aec('0x21')](_0x4b8a75['message']);});});}function insertAdditionalPhones(_0x29fb35){return new Promise(function(_0x24368b,_0x47785f){var _0x56f38e=_0x29fb35[_0x5aec('0x1d')];if(_['isNil'](_0x56f38e))_0x47785f({'val':0x0});else{var _0x2b4a6f=_0x56f38e['split'](';');var _0x1048e5=[];orderBy=0x0;for(var _0xb95cb3=0x0;_0xb95cb3<_0x2b4a6f[_0x5aec('0x1b')];_0xb95cb3++){_0x1048e5[_0x5aec('0x1e')](splitAdditionalPhone(_0x29fb35['id'],_0x2b4a6f[_0xb95cb3]));}Promise['all'](_0x1048e5)['then'](function(){_0x24368b({'val':_0x2b4a6f[_0x5aec('0x1b')]});});}});}function splitAdditionalPhone(_0x33269,_0x1a686d){return new Promise(function(_0x5a4f88,_0x5aee09){var _0x11fcc7=_0x1a686d['split'](':');var _0x328441=_0x11fcc7[0x0];var _0x26985f=_0x11fcc7[0x1];if(_0x26985f!==''){var _0x36f23a=_0x26985f['split']('|');var _0x30c559=[];for(var _0x653572=0x0;_0x653572<_0x36f23a[_0x5aec('0x1b')];_0x653572++){if(_0x36f23a[_0x653572]!==''){var _0x804d7=_[_0x5aec('0x22')](promisesAdditionalPhones,{'contactId':_0x33269,'phone':_0x36f23a[_0x653572]});if(_0x804d7[_0x5aec('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x5aec('0x1e')]({'contactId':_0x33269,'contactTypeId':_0x328441,'phone':_0x36f23a[_0x653572],'orderBy':orderBy});}}}_0x5a4f88({'ok':0x1});}else _0x5a4f88({'res':0x0});});}function createAdditionalPhone(_0x4fb6f1,_0x27563c,_0x3124c4,_0x501f26){var _0x4dc04e='';var _0x131428='';var _0x11a102=_0x3124c4['split']('§');_0x4dc04e=_0x11a102[0x0];if(_0x11a102['length']==0x2)_0x131428=_0x11a102[0x1];return new Promise(function(_0x311a2d,_0x5da377){return db['CmContactHasItem'][_0x5aec('0x23')]({'where':{'CmContactId':_0x4fb6f1,'item':_0x4dc04e}})[_0x5aec('0x1f')](function(_0x64f7ed){if(_0x64f7ed){return db[_0x5aec('0x24')][_0x5aec('0x25')]({'ItemTypeId':_0x27563c,'description':_0x131428,'OrderBy':_0x501f26},{'where':{'CmContactId':_0x4fb6f1,'item':_0x4dc04e}})[_0x5aec('0x1f')](function(_0x2b9715){_0x311a2d({'res':_0x5aec('0x26')});});}else{return db[_0x5aec('0x24')]['create']({'CmContactId':_0x4fb6f1,'item':_0x4dc04e,'ItemTypeId':_0x27563c,'description':_0x131428,'OrderBy':_0x501f26,'ItemClass':'PHONE'})[_0x5aec('0x1f')](function(_0x2dfdcb){_0x311a2d({'res':_0x5aec('0x27')});});}});});}function updateContact(_0x2edaac){return new Promise(function(_0x51ac9d,_0x41e015){var _0x2def0c=_0x2edaac['id'];delete _0x2edaac['id'];return db['CmContact'][_0x5aec('0x25')](_0x2edaac,{'where':{'id':_0x2def0c}})[_0x5aec('0x1f')](function(_0x55b876){updatedRows+=0x1;return db[_0x5aec('0x28')][_0x5aec('0x25')]({'phone':_0x2edaac['phone']},{'where':{'ContactId':_0x2def0c}})[_0x5aec('0x1f')](function(_0xcb6612){_0x51ac9d({'ret':'OK'});});});});}function insertCmHopper(_0x2a9162,_0xbc1ca8,_0x5ecbef,_0x31fbe7,_0x513867){var _0x59932f=['cm_contacts.phone',_0x5aec('0x29'),_0x5aec('0x2a'),_0x5aec('0x2b'),_0xbc1ca8+'.'+_0x31fbe7,_0x5aec('0x2c'),_0x5aec('0x2d'),_0x5aec('0x2e'),_0x5aec('0x2f'),'\x22'+_0x513867+'\x22'];return squel[_0x5aec('0x30')]()[_0x5aec('0x31')]('cm_hopper')['fromQuery']([_0x5aec('0x11'),_0x5aec('0x32'),'ContactId',_0x5aec('0x33'),_0x31fbe7,_0x5aec('0x34'),_0x5aec('0x35'),_0x5aec('0x36'),_0x5aec('0x37'),'recallme'],squel[_0x5aec('0x38')]()[_0x5aec('0x39')](_0x59932f)[_0x5aec('0x12')](_0xbc1ca8)['join']('cm_contacts',null,_0x5aec('0x3a')+_0xbc1ca8+_0x5aec('0x3b'))[_0x5aec('0x13')](_0x5ecbef,null,_0x5ecbef+_0x5aec('0x14')+_0xbc1ca8+'.'+_0x31fbe7)['where'](_0xbc1ca8+_0x5aec('0x3c'),_0x2a9162)[_0x5aec('0x15')](_0x5aec('0x3d'),NOW)[_0x5aec('0x15')](_0x5aec('0x3e'),selectNotIn(_0xbc1ca8,_0x5ecbef,_0x31fbe7,_0x5aec('0x3f'),['\x22always\x22',_0x5aec('0x40')]))[_0x5aec('0x15')](_0x5aec('0x3e'),selectNotIn(_0xbc1ca8,_0x5ecbef,_0x31fbe7,_0x5aec('0x3f'),[_0x5aec('0x41')])))[_0x5aec('0x42')]();}function insertCmHopperBlack(_0x3eac0c,_0x59eb97,_0x3f9d96,_0x4bde73){var _0x19a3d6=[_0x5aec('0x43'),_0x5aec('0x2a'),'cm_contacts.ListId',_0x59eb97+'.'+_0x4bde73,_0x5aec('0x2c'),_0x5aec('0x2d')];return squel[_0x5aec('0x30')]()['into'](_0x5aec('0x44'))[_0x5aec('0x45')](['phone',_0x5aec('0x46'),_0x5aec('0x33'),_0x4bde73,_0x5aec('0x34'),_0x5aec('0x35')],squel[_0x5aec('0x38')]()[_0x5aec('0x39')](_0x19a3d6)['from'](_0x59eb97)[_0x5aec('0x13')]('cm_contacts',null,_0x5aec('0x3a')+_0x59eb97+'.CmListId')[_0x5aec('0x13')](_0x3f9d96,null,_0x3f9d96+_0x5aec('0x14')+_0x59eb97+'.'+_0x4bde73)[_0x5aec('0x15')](_0x59eb97+_0x5aec('0x3c'),_0x3eac0c)[_0x5aec('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x5aec('0x15')](_0x5aec('0x3e'),squel['select']()[_0x5aec('0x10')](_0x5aec('0x11'))[_0x5aec('0x12')](_0x5aec('0x44'))[_0x5aec('0x15')](_0x5aec('0x47'),_0x3eac0c)[_0x5aec('0x15')](_0x4bde73+_0x5aec('0x48'),_0x59eb97+'.'+_0x4bde73)))[_0x5aec('0x42')]();}function insertCmHopperAdditionalPhones(_0x58b11a){var _0x5769d6=[_0x5aec('0x49'),_0x5aec('0x4a'),'cm_contact_has_items.OrderBy',_0x5aec('0x4b'),_0x5aec('0x4c')];return squel[_0x5aec('0x30')]()[_0x5aec('0x31')](_0x5aec('0x4d'))[_0x5aec('0x45')](['CmHopperId',_0x5aec('0x11'),_0x5aec('0x4e'),_0x5aec('0x34'),_0x5aec('0x35')],squel[_0x5aec('0x38')]()[_0x5aec('0x39')](_0x5769d6)[_0x5aec('0x12')](_0x5aec('0x3f'))[_0x5aec('0x13')](_0x5aec('0x4f'),null,_0x5aec('0x50'))[_0x5aec('0x13')]('cm_contact_has_items',null,_0x5aec('0x51'))[_0x5aec('0x15')](_0x5aec('0x52'),_0x58b11a)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x5aec('0x42')]();}function insertCmContact(_0x5e4071,_0x16161e,_0x379ade,_0x579e57){var _0x5cb060=_[_0x5aec('0x53')](_[_0x5aec('0x54')](_0x579e57),[_0x5aec('0x33'),_0x5aec('0x55'),_0x5aec('0x34'),_0x5aec('0x35')]);return squel[_0x5aec('0x30')]()[_0x5aec('0x31')]('cm_contacts')[_0x5aec('0x45')](_0x5cb060,squel[_0x5aec('0x38')]()[_0x5aec('0x39')](_0x5cb060)[_0x5aec('0x12')](_0x16161e)[_0x5aec('0x15')]('('+_0x379ade['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x5aec('0x38')]()[_0x5aec('0x39')](_0x379ade)['from'](_0x5aec('0x4f'))[_0x5aec('0x15')]('ListId\x20=\x20?',_0x5e4071))[_0x5aec('0x15')](_0x5aec('0x56'),squel[_0x5aec('0x38')]()['field']('MIN(id)','min_id')['from'](_0x16161e)['group'](_0x379ade['join'](','))))[_0x5aec('0x42')]();}function handleStop(){logger[_0x5aec('0x57')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x515467){logger['error'](_0x515467['message']);process[_0x5aec('0x58')](0x1);}function handleError(_0x238bd7,_0x5823a2){stats[_0x5aec('0x59')][_0x5aec('0x1e')]({'name':_0x5823a2['code'],'message':_0x5823a2[_0x5aec('0x5a')],'row':_0x238bd7});}function handleQuery(_0x32f11d){logger[_0x5aec('0x57')](_0x32f11d);return db[_0x5aec('0x18')][_0x5aec('0x19')](_0x32f11d)[_0x5aec('0x1a')](function(_0x15f52c){results[_0x5aec('0x1e')](_0x15f52c);})[_0x5aec('0x20')](function(_0x1b5c69){logger[_0x5aec('0x21')](_0x1b5c69[_0x5aec('0x5a')]);});}function main(_0x2a17c2,_0x14d943,_0x1bc74c,_0x48e64a){logger[_0x5aec('0x57')](_0x5aec('0x5b'),_0x2a17c2,JSON[_0x5aec('0x5c')](_0x14d943));process[_0x5aec('0x5d')](_0x5aec('0x5e'));var _0x3a120b=_0x14d943[_0x5aec('0x5f')];var _0x29c4b0=_[_0x5aec('0x60')](_0x3a120b);var _0x2fee74=_0x14d943[_0x5aec('0x61')];var _0x3c3c8f=path['join'](config['root'],'server/files/tmp',_0x2fee74+'.csv');logger[_0x5aec('0x57')](_0x5aec('0x62'),_0x14d943);db['ContactItemType'][_0x5aec('0x63')]({'raw':!![],'attributes':['id',_0x5aec('0x64')]})[_0x5aec('0x1f')](function(_0x385c66){for(var _0x542d27=0x0;_0x542d27<_0x385c66[_0x5aec('0x1b')];_0x542d27++){if(_0x385c66[_0x542d27][_0x5aec('0x64')]in _0x3a120b){contactItemTypes['push'](_0x385c66[_0x542d27]);delete _0x29c4b0[_0x385c66[_0x542d27][_0x5aec('0x64')]];hasAdditionalPhones=!![];}for(var _0x4068f2 in _0x3a120b){if(_0x385c66[_0x542d27][_0x5aec('0x64')]+_0x5aec('0x65')===_0x4068f2){phoneDescriptions['push']({'itemTypeId':_0x385c66[_0x542d27]['id'],'description':_0x4068f2});delete _0x29c4b0[_0x4068f2];}}}if(hasAdditionalPhones)_0x29c4b0[_0x5aec('0x1d')]='';var _0x3f702b=_['keys'](_0x29c4b0)[_0x5aec('0x13')]();logger[_0x5aec('0x57')](_0x5aec('0x66'),_0x3f702b);fs[_0x5aec('0x67')](_0x3c3c8f,_0x3f702b+'\x0a');Papa[_0x5aec('0x68')](fs[_0x5aec('0x69')](_0x2a17c2),{'header':!![],'skipEmptyLines':!![],'step':function(_0x58fc5d,_0x10e9f0){try{for(var _0x1a0c5d=0x0,_0x2671ba=[];_0x1a0c5d<_0x58fc5d[_0x5aec('0x6a')][_0x5aec('0x1b')];_0x1a0c5d++){stats[_0x5aec('0x6b')]+=0x1;if(_0x58fc5d[_0x5aec('0x59')][_0x1a0c5d]){handleError(_0x58fc5d[_0x5aec('0x6a')][_0x1a0c5d],_0x58fc5d[_0x5aec('0x59')][_0x1a0c5d]);}else{var _0x41795a=[];var _0x51dc72=[];var _0x1fe5c3={};for(var _0x56f13a in _0x3a120b){let _0x166ae8=contactItemTypes[_0x5aec('0x6c')](_0x2d9295=>_0x2d9295['name']===_0x56f13a);let _0x2835e3=contactItemTypes[_0x5aec('0x6c')](_0x20231d=>_0x20231d['name']+_0x5aec('0x65')===_0x56f13a);if(_[_0x5aec('0x1c')](_0x166ae8)&&_[_0x5aec('0x1c')](_0x2835e3)){if(_0x3a120b[_0x5aec('0x6d')](_0x56f13a)){if(_0x58fc5d[_0x5aec('0x6a')][_0x1a0c5d][_0x3a120b[_0x56f13a]]){var _0x5a9d81=_[_0x5aec('0x6e')](_0x58fc5d['data'][_0x1a0c5d][_0x3a120b[_0x56f13a]][_0x5aec('0x6f')](/"/g,'\x27'));switch(_0x56f13a){case _0x5aec('0x32'):var _0x1e8c5a=moment(_0x5a9d81,_0x5aec('0xc'),!![]);if(_0x1e8c5a[_0x5aec('0x70')]()){_0x2671ba[_0x5aec('0x1e')]('\x22'+_0x5a9d81+'\x22');}else{_0x41795a[_0x5aec('0x1e')](_0x5aec('0x71'));}break;case _0x5aec('0x36'):var _0x56eb15=parseInt(_0x5a9d81);_0x5a9d81=_['isNaN'](_0x56eb15)||_0x56eb15<0x0||_0x56eb15>0x4?_0x48e64a?0x3:0x2:_0x56eb15;_0x2671ba[_0x5aec('0x1e')]('\x22'+_0x5a9d81+'\x22');break;case _0x5aec('0x37'):var _0x15b2de=parseInt(_0x5a9d81);if(_[_0x5aec('0x72')](_0x15b2de)&&_[_0x5aec('0x73')](_0x1bc74c,_0x15b2de)){_0x2671ba[_0x5aec('0x1e')]('\x22'+_0x15b2de+'\x22');}else{_0x41795a[_0x5aec('0x1e')](_0x5aec('0x74'));}break;case _0x5aec('0x75'):if(isEmail(_0x5a9d81)){_0x2671ba[_0x5aec('0x1e')]('\x22'+_0x5a9d81+'\x22');}else{_0x41795a['push'](_0x5aec('0x76'));}break;case _0x5aec('0x77'):var _0x209bec=moment(_0x5a9d81,_0x5aec('0x78'),!![]);if(_0x209bec[_0x5aec('0x70')]()){_0x2671ba[_0x5aec('0x1e')]('\x22'+_0x5a9d81+'\x22');}else{_0x41795a[_0x5aec('0x1e')](_0x5aec('0x79'));}break;default:_0x2671ba[_0x5aec('0x1e')]('\x22'+_0x5a9d81+'\x22');}}else{switch(_0x56f13a){case _0x5aec('0x7a'):case'phone':_0x41795a[_0x5aec('0x1e')](_0x56f13a+'\x20not\x20specified');break;default:_0x2671ba[_0x5aec('0x1e')]('\x22\x22');}}}}else{var _0x396dc2='';if(!_['isNil'](_0x166ae8)){if(!_0x1fe5c3['hasOwnProperty'](_0x166ae8['id'])){for(var _0x4deff2=0x0;_0x4deff2<_0x3a120b[_0x56f13a][_0x5aec('0x1b')];_0x4deff2++){var _0x5a9d81=_[_0x5aec('0x6e')](_0x58fc5d[_0x5aec('0x6a')][_0x1a0c5d][_0x3a120b[_0x56f13a][_0x4deff2]][_0x5aec('0x6f')](/"/g,'\x27'));var _0x104b30=phoneDescriptions['find'](_0x48e733=>_0x48e733[_0x5aec('0x7b')]===_0x166ae8['id']);if(!_[_0x5aec('0x1c')](_0x104b30)){var _0x920c47=_[_0x5aec('0x6e')](_0x58fc5d[_0x5aec('0x6a')][_0x1a0c5d][_0x3a120b[_0x104b30['description']][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x5aec('0x1c')](_0x920c47))_0x5a9d81=_0x5a9d81+'§'+_0x920c47;}if(_0x396dc2=='')_0x396dc2=_0x5a9d81;else _0x396dc2+='|'+_0x5a9d81;}_0x51dc72['push'](_0x166ae8['id']+':'+_0x396dc2);_0x1fe5c3[_0x166ae8['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2671ba[_0x5aec('0x1e')]('\x22'+_0x51dc72[_0x5aec('0x13')](';')+'\x22');}if(_0x41795a[_0x5aec('0x1b')]){handleError(_0x58fc5d[_0x5aec('0x6a')][_0x1a0c5d],{'code':_0x5aec('0x7c'),'message':_0x41795a['join']()});}else{fs[_0x5aec('0x7d')](_0x3c3c8f,_0x2671ba[_0x5aec('0x13')]()+'\x0a');}_0x2671ba=[];}if(!(stats[_0x5aec('0x6b')]%0xc8)){socket[_0x5aec('0x7e')](_0x5aec('0x7f')+_0x2fee74,stats);stats[_0x5aec('0x59')]=[];}}if(stopped){logger[_0x5aec('0x57')](_0x5aec('0x80'));_0x10e9f0[_0x5aec('0x81')]();}}catch(_0x15ee1a){handleError(_0x58fc5d[_0x5aec('0x6a')][_0x1a0c5d],{'code':_0x5aec('0x82'),'message':_0x15ee1a[_0x5aec('0x5a')]});logger[_0x5aec('0x21')](_0x5aec('0x83'),_0x15ee1a[_0x5aec('0x5a')]);}},'complete':function(){try{var _0x2730ca=[];var _0x2450e6=tempTableName;_0x2730ca['push'](_0x5aec('0x84')+_0x2450e6+_0x5aec('0x85'));logger['info']('CIS\x20len',contactItemTypes['length']);var _0x893f51=util['format']('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\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x3c3c8f,_0x2450e6,_0x3f702b,_0x14d943[_0x5aec('0x33')],_0x14d943[_0x5aec('0x55')]||null,NOW,NOW);if(_[_0x5aec('0x1c')](_0x3a120b[_0x5aec('0x32')])){_0x893f51+=_0x5aec('0x86');}_0x2730ca[_0x5aec('0x1e')](_0x893f51);BPromise[_0x5aec('0x87')](_0x2730ca,handleQuery)['then'](function(_0x1ef9d6){BPromise[_0x5aec('0x88')]([handleAdditionalPhones()])[_0x5aec('0x1f')](function(){_0x2730ca=[];for(var _0x2a47dc=0x0;_0x2a47dc=_0x298da2){return _0x2e2173[_0x4d13('0x16')](0x193)[_0x4d13('0x17')]({'message':util[_0x4d13('0x9')](_0x4d13('0x18'),_0x51c4c7)});}_0x2405e1();})[_0x4d13('0x19')](function(_0x213c88){_0x2405e1(_0x213c88);});});}function isUserLimit(){return isLimit(_0x4d13('0x1a'),0x1,db[_0x4d13('0x1b')],{'where':{'$or':[{'role':_0x4d13('0x1c')},{'role':_0x4d13('0x1d')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x0bd4=['License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','user','crypto','util','composable-middleware','../../config/environment','data1','license','split','createDecipher','format','update','utf8','final','hasOwnProperty','use'];(function(_0x32002c,_0x2144b1){var _0x11412c=function(_0x7ac4dd){while(--_0x7ac4dd){_0x32002c['push'](_0x32002c['shift']());}};_0x11412c(++_0x2144b1);}(_0x0bd4,0x1d2));var _0x40bd=function(_0x3a07c1,_0x34d57f){_0x3a07c1=_0x3a07c1-0x0;var _0x2bbe15=_0x0bd4[_0x3a07c1];return _0x2bbe15;};'use strict';var crypto=require(_0x40bd('0x0'));var util=require(_0x40bd('0x1'));var compose=require(_0x40bd('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0x40bd('0x3'));function getValueFromLicense(_0x34fc35,_0xad09f4){if(_0x34fc35&&_0xad09f4){if(_0xad09f4[_0x40bd('0x4')]&&_0xad09f4['license']){var _0x4bb933=_0xad09f4['data1'];var _0x48fd87=_0xad09f4[_0x40bd('0x5')];var _0x23f667=_0x4bb933[_0x40bd('0x6')]('-')[0x4];var _0xbacf3c=_0x4bb933['split']('-')[0x0];var _0x432456=crypto[_0x40bd('0x7')]('aes-256-ctr',util[_0x40bd('0x8')]('%s:%s:%s',_0x23f667,_0x4bb933,_0xbacf3c));var _0x201463=_0x432456[_0x40bd('0x9')](_0x48fd87,'base64',_0x40bd('0xa'));_0x201463+=_0x432456[_0x40bd('0xb')]('utf8');var _0x3fee5b=JSON['parse'](_0x201463);return _0x3fee5b[_0x40bd('0xc')](_0x34fc35)?_0x3fee5b[_0x34fc35]:null;}}return null;}function isLimit(_0x33e338,_0x4c6abe,_0x378e38,_0x5261d1){var _0x1352e7=_0x4c6abe;return compose()[_0x40bd('0xd')](function(_0xd5f5e0,_0x1df7c6,_0x5a3070){return db[_0x40bd('0xe')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x40bd('0xf')](function(_0x4b45f6){var _0x120a8b=getValueFromLicense(_0x33e338,_0x4b45f6);return _0x120a8b?_0x120a8b:_0x1352e7;})[_0x40bd('0xf')](function(_0x6559ad){_0x1352e7=_0x6559ad;return _0x378e38[_0x40bd('0x10')](_0x5261d1);})[_0x40bd('0xf')](function(_0x14704a){if(_0x14704a>=_0x1352e7){return _0x1df7c6[_0x40bd('0x11')](0x193)[_0x40bd('0x12')]({'message':util[_0x40bd('0x8')](_0x40bd('0x13'),_0x33e338)});}_0x5a3070();})['catch'](function(_0x20b40a){_0x5a3070(_0x20b40a);});});}function isUserLimit(){return isLimit(_0x40bd('0x14'),0x1,db[_0x40bd('0x15')],{'where':{'$or':[{'role':_0x40bd('0x16')},{'role':_0x40bd('0x17')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index b341717..f2819e3 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 _0x6163=['format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','$in','IN\x20?','NOT\x20IN\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$lte','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','utcOffset','hours','minutes','seconds','lodash','parseSearch','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','map','conditions','push','buildExpression','DATE','operator','$eq','value','includes','$gt','add','days'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6163,0xc3));var _0x3616=function(_0x1e6f10,_0x99d3cd){_0x1e6f10=_0x1e6f10-0x0;var _0x19448d=_0x6163[_0x1e6f10];return _0x19448d;};'use strict';var _=require(_0x3616('0x0'));var moment=require('moment');exports[_0x3616('0x1')]=function(_0x2755c4){var _0x12c83f={'conditions':[]};_0x12c83f['sqlOperator']=_[_0x3616('0x2')](_0x2755c4,_0x3616('0x3'))?'or':_0x3616('0x4');var _0x19c612=_0x2755c4[_0x3616('0x5')](_0x3616('0x6'),'')[_0x3616('0x5')]('[$or]','')[_0x3616('0x7')]('||');for(var _0x3315b8=0x0;_0x3315b8<_0x19c612[_0x3616('0x8')];_0x3315b8++){var _0x45ec65=_0x19c612[_0x3315b8][_0x3616('0x7')](':=');var _0x179094=_0x45ec65[0x0];var _0x2bed15=_0x45ec65[_0x3616('0x9')](0x1);_0x2bed15[_0x3616('0xa')](function(_0x2851dd){var _0x9597f1=_0x2851dd[_0x3616('0x7')]('[')[_0x3616('0xb')]();var _0x509e49=_0x2851dd[_0x3616('0xc')](/\[(.*?)\]/g);_0x509e49[_0x3616('0xa')](function(_0xbb0205){var _0x212908=_0xbb0205[_0x3616('0x7')]('[')['filter'](function(_0x27caf4){return _0x27caf4['indexOf'](']')>-0x1;})[_0x3616('0xd')](function(_0x227a75){return _0x227a75[_0x3616('0x7')](']')[0x0];})[0x0];_0x12c83f[_0x3616('0xe')][_0x3616('0xf')]({'field':_0x179094,'operator':_0x9597f1,'value':_0x212908});});});}return _0x12c83f;};exports[_0x3616('0x10')]=function(_0x8f47d,_0x28771b,_0x3f7198){var _0x48d1f9={};if(_0x28771b===_0x3616('0x11')){if(_0x3f7198[_0x3616('0x12')]===_0x3616('0x13')){_0x3f7198[_0x3616('0x12')]='$between';_0x3f7198[_0x3616('0x14')]+=','+_0x3f7198[_0x3616('0x14')];}else if(_[_0x3616('0x15')]([_0x3616('0x16'),'$lte'],_0x3f7198[_0x3616('0x12')])){_0x3f7198['value']=moment(_0x3f7198[_0x3616('0x14')])[_0x3616('0x17')](0x1,_0x3616('0x18'))[_0x3616('0x19')](_0x3616('0x1a'));}}if(_0x3f7198[_0x3616('0x1b')]){_0x28771b=_0x3f7198[_0x3616('0x1b')];_0x48d1f9[_0x3616('0x1c')]=_0x3616('0x1d')+_0x8f47d+'.'+_0x3f7198[_0x3616('0x1e')]+_0x3616('0x1f')+_0x3f7198['castTo']+')\x20'+parseOperator(_0x3f7198[_0x3616('0x12')]);}else{_0x48d1f9[_0x3616('0x1c')]=_0x8f47d+'.'+_0x3f7198['field']+'\x20'+parseOperator(_0x3f7198[_0x3616('0x12')]);}if(_[_0x3616('0x15')]([_0x3616('0x20'),_0x3616('0x21')],_0x3f7198['operator']))_0x48d1f9['text']='('+_0x48d1f9[_0x3616('0x1c')]+'\x20OR\x20'+_0x8f47d+'.'+_0x3f7198[_0x3616('0x1e')]+'\x20IS\x20NULL)';_0x48d1f9[_0x3616('0x14')]=parseValue(_0x28771b,_0x3f7198['operator'],_0x3f7198[_0x3616('0x14')]);return _0x48d1f9;};function parseOperator(_0x4d7034){var _0x10aefb;switch(_0x4d7034){case _0x3616('0x22'):_0x10aefb=_0x3616('0x23');break;case _0x3616('0x21'):_0x10aefb=_0x3616('0x24');break;case _0x3616('0x13'):_0x10aefb='=\x20?';break;case'$ne':_0x10aefb='<>\x20?';break;case _0x3616('0x25'):case _0x3616('0x26'):case _0x3616('0x27'):_0x10aefb=_0x3616('0x28');break;case _0x3616('0x29'):_0x10aefb=_0x3616('0x2a');break;case _0x3616('0x16'):_0x10aefb=_0x3616('0x2b');break;case _0x3616('0x2c'):_0x10aefb=_0x3616('0x2d');break;case _0x3616('0x2e'):_0x10aefb=_0x3616('0x2f');break;case _0x3616('0x30'):_0x10aefb=_0x3616('0x31');break;}return _0x10aefb;}function parseValue(_0x218552,_0x4df57e,_0x432b62){var _0x589daf={'start':undefined,'end':undefined};switch(_0x4df57e){case _0x3616('0x22'):case _0x3616('0x21'):_0x589daf[_0x3616('0x32')]=_0x432b62[_0x3616('0x7')](',');break;case _0x3616('0x25'):_0x589daf['start']='%'+_0x432b62+'%';break;case _0x3616('0x26'):_0x589daf['start']=_0x432b62+'%';break;case _0x3616('0x27'):_0x589daf[_0x3616('0x32')]='%'+_0x432b62;break;case'$between':var _0x31d2d0=_0x432b62['split'](',');var _0x432b62=_0x31d2d0['shift']();var _0x4f2555=_0x31d2d0['pop']();if(_0x218552===_0x3616('0x11')){_0x432b62=moment(_0x432b62)[_0x3616('0x33')](0x0,!![])[_0x3616('0x19')]();_0x4f2555=moment(_0x4f2555)[_0x3616('0x33')](0x0,!![])[_0x3616('0x17')](0x17,_0x3616('0x34'))[_0x3616('0x17')](0x3b,_0x3616('0x35'))[_0x3616('0x17')](0x3b,_0x3616('0x36'))[_0x3616('0x19')]();}_0x589daf={'start':_0x432b62,'end':_0x4f2555};break;default:_0x589daf[_0x3616('0x32')]=_0x432b62;break;}return _0x589daf;} \ No newline at end of file +var _0x5ecc=['slice','forEach','shift','match','filter','indexOf','map','conditions','buildExpression','DATE','operator','value','includes','$lte','add','days','format','castTo','text','CAST(','$ne','$notIn','field','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','$gt','>\x20?','<=\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','utcOffset','seconds','moment','parseSearch','startsWith','[$or]','and','replace','[$and]','split'];(function(_0x39aba0,_0x5a5cf6){var _0x56dc38=function(_0x5f23a9){while(--_0x5f23a9){_0x39aba0['push'](_0x39aba0['shift']());}};_0x56dc38(++_0x5a5cf6);}(_0x5ecc,0x188));var _0xc5ec=function(_0x44eeb9,_0x1a5603){_0x44eeb9=_0x44eeb9-0x0;var _0x38738f=_0x5ecc[_0x44eeb9];return _0x38738f;};'use strict';var _=require('lodash');var moment=require(_0xc5ec('0x0'));exports[_0xc5ec('0x1')]=function(_0x3b8368){var _0x14e41c={'conditions':[]};_0x14e41c['sqlOperator']=_[_0xc5ec('0x2')](_0x3b8368,_0xc5ec('0x3'))?'or':_0xc5ec('0x4');var _0x5cf171=_0x3b8368[_0xc5ec('0x5')](_0xc5ec('0x6'),'')['replace'](_0xc5ec('0x3'),'')[_0xc5ec('0x7')]('||');for(var _0x489729=0x0;_0x489729<_0x5cf171['length'];_0x489729++){var _0x40ded5=_0x5cf171[_0x489729][_0xc5ec('0x7')](':=');var _0x1a34c1=_0x40ded5[0x0];var _0x3898bc=_0x40ded5[_0xc5ec('0x8')](0x1);_0x3898bc[_0xc5ec('0x9')](function(_0x4659f7){var _0x49ffc9=_0x4659f7[_0xc5ec('0x7')]('[')[_0xc5ec('0xa')]();var _0x34faab=_0x4659f7[_0xc5ec('0xb')](/\[(.*?)\]/g);_0x34faab[_0xc5ec('0x9')](function(_0x1c6144){var _0x40f175=_0x1c6144[_0xc5ec('0x7')]('[')[_0xc5ec('0xc')](function(_0x1f5884){return _0x1f5884[_0xc5ec('0xd')](']')>-0x1;})[_0xc5ec('0xe')](function(_0x217628){return _0x217628[_0xc5ec('0x7')](']')[0x0];})[0x0];_0x14e41c[_0xc5ec('0xf')]['push']({'field':_0x1a34c1,'operator':_0x49ffc9,'value':_0x40f175});});});}return _0x14e41c;};exports[_0xc5ec('0x10')]=function(_0x387b67,_0xca564e,_0xf975c2){var _0x58a185={};if(_0xca564e===_0xc5ec('0x11')){if(_0xf975c2[_0xc5ec('0x12')]==='$eq'){_0xf975c2[_0xc5ec('0x12')]='$between';_0xf975c2[_0xc5ec('0x13')]+=','+_0xf975c2[_0xc5ec('0x13')];}else if(_[_0xc5ec('0x14')](['$gt',_0xc5ec('0x15')],_0xf975c2[_0xc5ec('0x12')])){_0xf975c2[_0xc5ec('0x13')]=moment(_0xf975c2['value'])[_0xc5ec('0x16')](0x1,_0xc5ec('0x17'))[_0xc5ec('0x18')]('YYYY-MM-DD');}}if(_0xf975c2['castTo']){_0xca564e=_0xf975c2[_0xc5ec('0x19')];_0x58a185[_0xc5ec('0x1a')]=_0xc5ec('0x1b')+_0x387b67+'.'+_0xf975c2['field']+'\x20AS\x20'+_0xf975c2[_0xc5ec('0x19')]+')\x20'+parseOperator(_0xf975c2[_0xc5ec('0x12')]);}else{_0x58a185['text']=_0x387b67+'.'+_0xf975c2['field']+'\x20'+parseOperator(_0xf975c2['operator']);}if(_[_0xc5ec('0x14')]([_0xc5ec('0x1c'),_0xc5ec('0x1d')],_0xf975c2['operator']))_0x58a185[_0xc5ec('0x1a')]='('+_0x58a185[_0xc5ec('0x1a')]+'\x20OR\x20'+_0x387b67+'.'+_0xf975c2[_0xc5ec('0x1e')]+_0xc5ec('0x1f');_0x58a185[_0xc5ec('0x13')]=parseValue(_0xca564e,_0xf975c2[_0xc5ec('0x12')],_0xf975c2[_0xc5ec('0x13')]);return _0x58a185;};function parseOperator(_0x20776b){var _0x3477d5;switch(_0x20776b){case _0xc5ec('0x20'):_0x3477d5=_0xc5ec('0x21');break;case'$notIn':_0x3477d5=_0xc5ec('0x22');break;case'$eq':_0x3477d5='=\x20?';break;case'$ne':_0x3477d5='<>\x20?';break;case _0xc5ec('0x23'):case _0xc5ec('0x24'):case _0xc5ec('0x25'):_0x3477d5=_0xc5ec('0x26');break;case'$lt':_0x3477d5=_0xc5ec('0x27');break;case _0xc5ec('0x28'):_0x3477d5=_0xc5ec('0x29');break;case _0xc5ec('0x15'):_0x3477d5=_0xc5ec('0x2a');break;case _0xc5ec('0x2b'):_0x3477d5=_0xc5ec('0x2c');break;case _0xc5ec('0x2d'):_0x3477d5=_0xc5ec('0x2e');break;}return _0x3477d5;}function parseValue(_0x299ba5,_0x381962,_0x5bec0e){var _0x859063={'start':undefined,'end':undefined};switch(_0x381962){case _0xc5ec('0x20'):case'$notIn':_0x859063[_0xc5ec('0x2f')]=_0x5bec0e[_0xc5ec('0x7')](',');break;case'$substring':_0x859063[_0xc5ec('0x2f')]='%'+_0x5bec0e+'%';break;case _0xc5ec('0x24'):_0x859063[_0xc5ec('0x2f')]=_0x5bec0e+'%';break;case'$endsWith':_0x859063[_0xc5ec('0x2f')]='%'+_0x5bec0e;break;case'$between':var _0x3dd173=_0x5bec0e[_0xc5ec('0x7')](',');var _0x5bec0e=_0x3dd173[_0xc5ec('0xa')]();var _0x5f3810=_0x3dd173['pop']();if(_0x299ba5===_0xc5ec('0x11')){_0x5bec0e=moment(_0x5bec0e)[_0xc5ec('0x30')](0x0,!![])[_0xc5ec('0x18')]();_0x5f3810=moment(_0x5f3810)[_0xc5ec('0x30')](0x0,!![])[_0xc5ec('0x16')](0x17,'hours')[_0xc5ec('0x16')](0x3b,'minutes')[_0xc5ec('0x16')](0x3b,_0xc5ec('0x31'))[_0xc5ec('0x18')]();}_0x859063={'start':_0x5bec0e,'end':_0x5f3810};break;default:_0x859063[_0xc5ec('0x2f')]=_0x5bec0e;break;}return _0x859063;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 7a6e270..ec7b6c2 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 _0xae24=['query','$id','intersection','model','attributes','fields','nolimit','offset','order','where','pick','filter','includes','columns','value','VIRTUAL','lower','col','merge','options','lodash','moment','keys','parse','filters','isEmpty','forOwn','find','type','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','name','uniqueid','isArray','split','limit','sort','map','indexOf','cast','unsigned','substr','DESC','priority','ASC','omit','length','isObject','unset','hasOwnProperty','match','getFullTextValue','forEach','replace','push','join','getOptions'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xae24,0x182));var _0x4ae2=function(_0x352256,_0x447d72){_0x352256=_0x352256-0x0;var _0x309795=_0xae24[_0x352256];return _0x309795;};'use strict';var _=require(_0x4ae2('0x0'));var sequelize=require('sequelize');var moment=require(_0x4ae2('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4997b0){var _0xf4c45d=['ne'];try{var _0x1bf293=JSON['parse'](_0x4997b0);var _0x5b6f4d=Object[_0x4ae2('0x2')](_0x1bf293)[0x0];return _0xf4c45d['includes'](_0x5b6f4d);}catch(_0x2ed9ff){return![];}}function getOperatorValue(_0xf26f45){var _0x20c85c=JSON[_0x4ae2('0x3')](_0xf26f45);var _0x428054=Object[_0x4ae2('0x2')](_0x20c85c)[0x0];var _0x4f2e84=_0x20c85c[_0x428054];return{['$'+_0x428054]:_0x4f2e84};}exports['fields']=function(_0x41cdf1){var _0x4d3d8a=null;if(_0x41cdf1){_0x4d3d8a=_0x41cdf1['split'](',');}return _0x4d3d8a;};exports[_0x4ae2('0x4')]=function(_0xb01e8e,_0x5c32b7){var _0x3b3acc={};if(!_[_0x4ae2('0x5')](_0xb01e8e)){_[_0x4ae2('0x6')](_0xb01e8e,function(_0xb70265,_0x52458f){try{if(_0x5c32b7){var _0x19b222=_[_0x4ae2('0x7')](_0x5c32b7,{'name':_0x52458f})||{};if(hasSequelizeOperator(_0xb70265)){_0x3b3acc[_0x52458f]=getOperatorValue(_0xb70265);}else if(_0x19b222[_0x4ae2('0x8')]==='DATE'&&_[_0x4ae2('0x9')](_0xb70265)){var _0x22ac1e=JSON[_0x4ae2('0x3')](_0xb70265);var _0x3c70bd={'$gte':moment(moment(_0x22ac1e[_0x4ae2('0xa')])[_0x4ae2('0xb')](_0x4ae2('0xc')))[_0x4ae2('0xd')]()[_0x4ae2('0xb')](),'$lte':moment(moment(_0x22ac1e['$lte'])['format']('YYYY-MM-DD'))[_0x4ae2('0xd')]()[_0x4ae2('0xe')](0x1,'s')['format']()};_0x3b3acc[_0x52458f]=_0x3c70bd;}else if(_0x19b222[_0x4ae2('0xf')]===_0x4ae2('0x10')){_0x3b3acc[_0x52458f]=_0xb70265;}else{_0x3b3acc[_0x52458f]=_[_0x4ae2('0x11')](_0xb70265)?_0xb70265:JSON[_0x4ae2('0x3')](_0xb70265);}}else{_0x3b3acc[_0x52458f]=_[_0x4ae2('0x11')](_0xb70265)?_0xb70265:JSON[_0x4ae2('0x3')](_0xb70265);}}catch(_0x3d4259){_0x3b3acc[_0x52458f]=_0xb70265[_0x4ae2('0x12')](',');}});}return _0x3b3acc;};exports[_0x4ae2('0x13')]=function(_0x18936a){_0x18936a=parseInt(_0x18936a,0xa);if(!_0x18936a||_0x18936a<0x0){_0x18936a=LIMIT_VALUE;}return _0x18936a;};exports['offset']=function(_0x4a97af){_0x4a97af=parseInt(_0x4a97af,0xa);if(!_0x4a97af||_0x4a97af<0x0){_0x4a97af=0x0;}return _0x4a97af;};exports[_0x4ae2('0x14')]=function(_0x2d910c){var _0x51e20c,_0x45c1bf=null;if(_0x2d910c){_0x51e20c=_0x2d910c[_0x4ae2('0x12')](',');_0x45c1bf=_[_0x4ae2('0x15')](_0x51e20c,function(_0x2ad222){if(_0x2ad222[_0x4ae2('0x16')]('-')===0x0){return[_0x2ad222==='priority'?sequelize[_0x4ae2('0x17')](sequelize['col']('priority'),_0x4ae2('0x18')):_0x2ad222[_0x4ae2('0x19')](0x1),_0x4ae2('0x1a')];}else{return[_0x2ad222===_0x4ae2('0x1b')?sequelize[_0x4ae2('0x17')](sequelize['col'](_0x4ae2('0x1b')),'unsigned'):_0x2ad222,_0x4ae2('0x1c')];}});}return _0x45c1bf;};exports[_0x4ae2('0x1d')]=function(_0x130239,_0x57933b){if(_[_0x4ae2('0x5')](_0x130239)){return _0x130239;}if(_[_0x4ae2('0x11')](_0x130239)){for(var _0x2454b3=0x0;_0x2454b3<_0x130239[_0x4ae2('0x1e')];_0x2454b3+=0x1){_0x130239[_0x2454b3]=this[_0x4ae2('0x1d')](_0x130239[_0x2454b3],_0x57933b);}return _0x130239;}if(!_[_0x4ae2('0x1f')](_0x130239)){return _0x130239;}if(_['isString'](_0x57933b)){_0x57933b=[_0x57933b];}if(!_['isArray'](_0x57933b)){return _0x130239;}for(var _0x9508d7=0x0;_0x9508d7<_0x57933b[_0x4ae2('0x1e')];_0x9508d7+=0x1){_[_0x4ae2('0x20')](_0x130239,_0x57933b[_0x9508d7]);}for(var _0x329588 in _0x130239){if(_0x130239[_0x4ae2('0x21')](_0x329588)){_0x130239[_0x329588]=this[_0x4ae2('0x1d')](_0x130239[_0x329588],_0x57933b);}}return _0x130239;};exports['isNumeric']=function(_0x5ec1fd){return _0x5ec1fd[_0x4ae2('0x22')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x5e9f03){return _0x5e9f03[_0x4ae2('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x4ae2('0x23')]=function(_0x55fafd){var _0x883fd5=[];_0x55fafd[_0x4ae2('0x12')](/[ ,]+/)[_0x4ae2('0x24')](function(_0x146bc2){_0x146bc2=_0x146bc2[_0x4ae2('0x25')](/([^:]")"+/g,'$1');_0x146bc2='+'+_0x146bc2+'*';var _0x23f954=/[ `!@#$%^&*()_\-?~]/;if(_0x146bc2[_0x4ae2('0x22')](_0x23f954))_0x146bc2='\x22'+_0x146bc2+'\x22';_0x883fd5[_0x4ae2('0x26')](_0x146bc2);});return _0x883fd5[_0x4ae2('0x27')]('\x20');};exports[_0x4ae2('0x28')]=function(_0x386687,_0x12815f,_0x3ab303){var _0x27c6d4={},_0x548a1={};if(_0x12815f[_0x4ae2('0x29')][_0x4ae2('0x2a')]){_0x12815f['query']['id']=_0x12815f[_0x4ae2('0x29')]['$id'];delete _0x12815f[_0x4ae2('0x29')][_0x4ae2('0x2a')];}_0x27c6d4['model']=_[_0x4ae2('0x15')](_0x386687,_0x4ae2('0xf'));_0x27c6d4[_0x4ae2('0x29')]=_[_0x4ae2('0x2')](_0x12815f['query']);_0x27c6d4[_0x4ae2('0x4')]=_[_0x4ae2('0x2b')](_0x27c6d4[_0x4ae2('0x2c')],_0x27c6d4[_0x4ae2('0x29')]);_0x548a1[_0x4ae2('0x2d')]=_[_0x4ae2('0x2b')](_0x27c6d4[_0x4ae2('0x2c')],this[_0x4ae2('0x2e')](_0x12815f[_0x4ae2('0x29')]['fields']));_0x548a1[_0x4ae2('0x2d')]=_0x548a1['attributes'][_0x4ae2('0x1e')]?_0x548a1[_0x4ae2('0x2d')]:_0x27c6d4[_0x4ae2('0x2c')];if(!_0x12815f[_0x4ae2('0x29')][_0x4ae2('0x21')](_0x4ae2('0x2f'))){_0x548a1['limit']=this[_0x4ae2('0x13')](_0x12815f[_0x4ae2('0x29')][_0x4ae2('0x13')]);_0x548a1[_0x4ae2('0x30')]=this['offset'](_0x12815f[_0x4ae2('0x29')][_0x4ae2('0x30')]);}_0x548a1[_0x4ae2('0x31')]=this[_0x4ae2('0x14')](_0x12815f[_0x4ae2('0x29')][_0x4ae2('0x14')]);_0x548a1[_0x4ae2('0x32')]=this[_0x4ae2('0x4')](_[_0x4ae2('0x33')](_0x12815f[_0x4ae2('0x29')],_0x27c6d4[_0x4ae2('0x4')]),_0x386687);if(_0x12815f['query'][_0x4ae2('0x34')]){var _0x3f0b3f=_0x386687;var _0x23f120=_0x12815f[_0x4ae2('0x29')]['filter'];if(typeof _0x23f120==='object'){_0x3f0b3f=_[_0x4ae2('0x34')](_0x386687,function(_0x45527a){return _[_0x4ae2('0x35')](_0x23f120[_0x4ae2('0x36')],_0x45527a['name']);});_0x23f120=_0x23f120[_0x4ae2('0x37')];}_0x548a1[_0x4ae2('0x32')]=_['merge'](_0x548a1[_0x4ae2('0x32')],{'$or':_[_0x4ae2('0x15')](_0x3f0b3f,function(_0x11a5d9){if(_0x11a5d9['type']!==_0x4ae2('0x38')){if(_0x3ab303){return sequelize[_0x4ae2('0x32')](sequelize['fn'](_0x4ae2('0x39'),sequelize[_0x4ae2('0x3a')](_0x11a5d9[_0x4ae2('0xf')])),{'$like':sequelize['fn'](_0x4ae2('0x39'),'%'+_0x12815f[_0x4ae2('0x29')][_0x4ae2('0x34')]+'%')});}else{var _0x5cce26={};_0x5cce26[_0x11a5d9[_0x4ae2('0xf')]]={'$like':'%'+_0x12815f[_0x4ae2('0x29')]['filter']+'%'};return _0x5cce26;}}})});}_0x548a1=_[_0x4ae2('0x3b')]({},_0x548a1,_0x12815f[_0x4ae2('0x3c')]);return _0x548a1;}; \ No newline at end of file +var _0x5334=['value','merge','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','forOwn','find','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','omit','length','isObject','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','push','getOptions','query','$id','model','intersection','attributes','nolimit','limit','offset','order','where','pick','filter','object','columns'];(function(_0x238b0f,_0x1cfa5c){var _0x426a9b=function(_0x5bbcc5){while(--_0x5bbcc5){_0x238b0f['push'](_0x238b0f['shift']());}};_0x426a9b(++_0x1cfa5c);}(_0x5334,0x84));var _0x4533=function(_0x267041,_0x506dd6){_0x267041=_0x267041-0x0;var _0x3b3a2f=_0x5334[_0x267041];return _0x3b3a2f;};'use strict';var _=require(_0x4533('0x0'));var sequelize=require(_0x4533('0x1'));var moment=require(_0x4533('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x35fb80){var _0x39af56=['ne'];try{var _0x52b768=JSON[_0x4533('0x3')](_0x35fb80);var _0x5176b5=Object[_0x4533('0x4')](_0x52b768)[0x0];return _0x39af56[_0x4533('0x5')](_0x5176b5);}catch(_0x5cbca4){return![];}}function getOperatorValue(_0x4a576a){var _0x51b4ce=JSON[_0x4533('0x3')](_0x4a576a);var _0x4dea06=Object['keys'](_0x51b4ce)[0x0];var _0x487906=_0x51b4ce[_0x4dea06];return{['$'+_0x4dea06]:_0x487906};}exports[_0x4533('0x6')]=function(_0x42f94b){var _0x300877=null;if(_0x42f94b){_0x300877=_0x42f94b[_0x4533('0x7')](',');}return _0x300877;};exports[_0x4533('0x8')]=function(_0x21b22f,_0xd417){var _0x4fdbda={};if(!_[_0x4533('0x9')](_0x21b22f)){_[_0x4533('0xa')](_0x21b22f,function(_0x1b52ee,_0x12131a){try{if(_0xd417){var _0x5465bf=_[_0x4533('0xb')](_0xd417,{'name':_0x12131a})||{};if(hasSequelizeOperator(_0x1b52ee)){_0x4fdbda[_0x12131a]=getOperatorValue(_0x1b52ee);}else if(_0x5465bf['type']===_0x4533('0xc')&&_[_0x4533('0xd')](_0x1b52ee)){var _0x45ba67=JSON[_0x4533('0x3')](_0x1b52ee);var _0x57ff74={'$gte':moment(moment(_0x45ba67[_0x4533('0xe')])[_0x4533('0xf')](_0x4533('0x10')))[_0x4533('0x11')]()['format'](),'$lte':moment(moment(_0x45ba67[_0x4533('0x12')])['format']('YYYY-MM-DD'))[_0x4533('0x11')]()[_0x4533('0x13')](0x1,'s')['format']()};_0x4fdbda[_0x12131a]=_0x57ff74;}else if(_0x5465bf[_0x4533('0x14')]===_0x4533('0x15')){_0x4fdbda[_0x12131a]=_0x1b52ee;}else{_0x4fdbda[_0x12131a]=_[_0x4533('0x16')](_0x1b52ee)?_0x1b52ee:JSON['parse'](_0x1b52ee);}}else{_0x4fdbda[_0x12131a]=_[_0x4533('0x16')](_0x1b52ee)?_0x1b52ee:JSON['parse'](_0x1b52ee);}}catch(_0x3ddb36){_0x4fdbda[_0x12131a]=_0x1b52ee[_0x4533('0x7')](',');}});}return _0x4fdbda;};exports['limit']=function(_0xd10c6a){_0xd10c6a=parseInt(_0xd10c6a,0xa);if(!_0xd10c6a||_0xd10c6a<0x0){_0xd10c6a=LIMIT_VALUE;}return _0xd10c6a;};exports['offset']=function(_0x5c2c9c){_0x5c2c9c=parseInt(_0x5c2c9c,0xa);if(!_0x5c2c9c||_0x5c2c9c<0x0){_0x5c2c9c=0x0;}return _0x5c2c9c;};exports[_0x4533('0x17')]=function(_0x9740a6){var _0x49fb91,_0x53fe43=null;if(_0x9740a6){_0x49fb91=_0x9740a6[_0x4533('0x7')](',');_0x53fe43=_[_0x4533('0x18')](_0x49fb91,function(_0x3467ba){if(_0x3467ba[_0x4533('0x19')]('-')===0x0){return[_0x3467ba===_0x4533('0x1a')?sequelize[_0x4533('0x1b')](sequelize[_0x4533('0x1c')]('priority'),_0x4533('0x1d')):_0x3467ba[_0x4533('0x1e')](0x1),_0x4533('0x1f')];}else{return[_0x3467ba==='priority'?sequelize['cast'](sequelize[_0x4533('0x1c')](_0x4533('0x1a')),'unsigned'):_0x3467ba,'ASC'];}});}return _0x53fe43;};exports[_0x4533('0x20')]=function(_0x1fa8be,_0xfd9409){if(_['isEmpty'](_0x1fa8be)){return _0x1fa8be;}if(_[_0x4533('0x16')](_0x1fa8be)){for(var _0x39b261=0x0;_0x39b261<_0x1fa8be[_0x4533('0x21')];_0x39b261+=0x1){_0x1fa8be[_0x39b261]=this[_0x4533('0x20')](_0x1fa8be[_0x39b261],_0xfd9409);}return _0x1fa8be;}if(!_[_0x4533('0x22')](_0x1fa8be)){return _0x1fa8be;}if(_[_0x4533('0x23')](_0xfd9409)){_0xfd9409=[_0xfd9409];}if(!_[_0x4533('0x16')](_0xfd9409)){return _0x1fa8be;}for(var _0x27b653=0x0;_0x27b653<_0xfd9409[_0x4533('0x21')];_0x27b653+=0x1){_['unset'](_0x1fa8be,_0xfd9409[_0x27b653]);}for(var _0x5c1e24 in _0x1fa8be){if(_0x1fa8be[_0x4533('0x24')](_0x5c1e24)){_0x1fa8be[_0x5c1e24]=this['omit'](_0x1fa8be[_0x5c1e24],_0xfd9409);}}return _0x1fa8be;};exports[_0x4533('0x25')]=function(_0x4e2b80){return _0x4e2b80[_0x4533('0x26')](RegExp(_0x4533('0x27')))?!![]:![];};exports[_0x4533('0x28')]=function(_0x4300c1){return _0x4300c1[_0x4533('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x4533('0x29')]=function(_0xe584a2){var _0xa58dd1=[];_0xe584a2[_0x4533('0x7')](/[ ,]+/)[_0x4533('0x2a')](function(_0x728791){_0x728791=_0x728791[_0x4533('0x2b')](/([^:]")"+/g,'$1');_0x728791='+'+_0x728791+'*';var _0x7fc887=/[ `!@#$%^&*()_\-?~]/;if(_0x728791['match'](_0x7fc887))_0x728791='\x22'+_0x728791+'\x22';_0xa58dd1[_0x4533('0x2c')](_0x728791);});return _0xa58dd1['join']('\x20');};exports[_0x4533('0x2d')]=function(_0x3f7720,_0xb7f0b1,_0x3b89f0){var _0x24acf5={},_0x6d58aa={};if(_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x2f')]){_0xb7f0b1[_0x4533('0x2e')]['id']=_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x2f')];delete _0xb7f0b1[_0x4533('0x2e')]['$id'];}_0x24acf5[_0x4533('0x30')]=_[_0x4533('0x18')](_0x3f7720,_0x4533('0x14'));_0x24acf5[_0x4533('0x2e')]=_[_0x4533('0x4')](_0xb7f0b1['query']);_0x24acf5[_0x4533('0x8')]=_[_0x4533('0x31')](_0x24acf5[_0x4533('0x30')],_0x24acf5[_0x4533('0x2e')]);_0x6d58aa[_0x4533('0x32')]=_[_0x4533('0x31')](_0x24acf5['model'],this[_0x4533('0x6')](_0xb7f0b1[_0x4533('0x2e')]['fields']));_0x6d58aa[_0x4533('0x32')]=_0x6d58aa[_0x4533('0x32')][_0x4533('0x21')]?_0x6d58aa[_0x4533('0x32')]:_0x24acf5[_0x4533('0x30')];if(!_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x24')](_0x4533('0x33'))){_0x6d58aa[_0x4533('0x34')]=this[_0x4533('0x34')](_0xb7f0b1['query'][_0x4533('0x34')]);_0x6d58aa[_0x4533('0x35')]=this[_0x4533('0x35')](_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x35')]);}_0x6d58aa[_0x4533('0x36')]=this[_0x4533('0x17')](_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x17')]);_0x6d58aa[_0x4533('0x37')]=this[_0x4533('0x8')](_[_0x4533('0x38')](_0xb7f0b1['query'],_0x24acf5['filters']),_0x3f7720);if(_0xb7f0b1[_0x4533('0x2e')]['filter']){var _0x4260e6=_0x3f7720;var _0x97aa9e=_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x39')];if(typeof _0x97aa9e===_0x4533('0x3a')){_0x4260e6=_[_0x4533('0x39')](_0x3f7720,function(_0x2df795){return _[_0x4533('0x5')](_0x97aa9e[_0x4533('0x3b')],_0x2df795[_0x4533('0x14')]);});_0x97aa9e=_0x97aa9e[_0x4533('0x3c')];}_0x6d58aa[_0x4533('0x37')]=_[_0x4533('0x3d')](_0x6d58aa['where'],{'$or':_[_0x4533('0x18')](_0x4260e6,function(_0x556dd9){if(_0x556dd9['type']!=='VIRTUAL'){if(_0x3b89f0){return sequelize['where'](sequelize['fn'](_0x4533('0x3e'),sequelize[_0x4533('0x1c')](_0x556dd9[_0x4533('0x14')])),{'$like':sequelize['fn'](_0x4533('0x3e'),'%'+_0xb7f0b1['query'][_0x4533('0x39')]+'%')});}else{var _0x369284={};_0x369284[_0x556dd9[_0x4533('0x14')]]={'$like':'%'+_0xb7f0b1[_0x4533('0x2e')][_0x4533('0x39')]+'%'};return _0x369284;}}})});}_0x6d58aa=_[_0x4533('0x3d')]({},_0x6d58aa,_0xb7f0b1[_0x4533('0x3f')]);return _0x6d58aa;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 970a103..37ec69d 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x334651,_0x6e99f6){var _0x29657c=function(_0x420a94){while(--_0x420a94){_0x334651['push'](_0x334651['shift']());}};_0x29657c(++_0x6e99f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x1d69e5,_0x2a29af){var _0x17da11=function(_0x36c61f){while(--_0x36c61f){_0x1d69e5['push'](_0x1d69e5['shift']());}};_0x17da11(++_0x2a29af);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 6a12336..2ea764e 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 _0x1431=['getFirstInterface','cpus','map','model','join','update','digest','hex','getUuid','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','md5','substring','crypto','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1'];(function(_0x22cc16,_0x1f4fa2){var _0x399b70=function(_0x34d464){while(--_0x34d464){_0x22cc16['push'](_0x22cc16['shift']());}};_0x399b70(++_0x1f4fa2);}(_0x1431,0x1a0));var _0x1143=function(_0x578c14,_0x2f8844){_0x578c14=_0x578c14-0x0;var _0x3dd69d=_0x1431[_0x578c14];return _0x3dd69d;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x1143('0x0'));var machine=require(_0x1143('0x1'));var exec=require('child_process')[_0x1143('0x2')];var config=require(_0x1143('0x3'));function getInterfaces(){var _0x2a5a03=[];var _0x20f0e7=os[_0x1143('0x4')]();var _0x4b4c04=_[_0x1143('0x5')](_[_0x1143('0x6')](_0x20f0e7));for(var _0x59b3a4=0x0;_0x59b3a4<_0x4b4c04[_0x1143('0x7')];_0x59b3a4++){var _0x20902f=_0x20f0e7[_0x4b4c04[_0x59b3a4]][_0x1143('0x8')](function(_0x6dd586){return _0x6dd586['family']===_0x1143('0x9')&&_0x6dd586['internal']===![];});_0x2a5a03=_0x2a5a03[_0x1143('0xa')](_0x20902f);}return _0x2a5a03;}function getFirstInterface(){var _0x238495=_[_0x1143('0xb')](getInterfaces());return{'macAddress':_0x238495&&_0x238495[_0x1143('0xc')]?_0x238495[_0x1143('0xc')]:_0x1143('0xd'),'ipAddress':_0x238495&&_0x238495[_0x1143('0xe')]?_0x238495['address']:_0x1143('0xf')};}exports[_0x1143('0x10')]=getFirstInterface;function getCPUhash(){var _0x57be85=_[_0x1143('0x5')](os[_0x1143('0x11')]()[_0x1143('0x12')](function(_0x16e197){return _0x16e197[_0x1143('0x13')];}))[_0x1143('0x14')](':');return crypto['createHash']('md5')[_0x1143('0x15')](_0x57be85)[_0x1143('0x16')](_0x1143('0x17'));}exports[_0x1143('0x18')]=function(){var _0x4ac7f5=os['platform']();var _0x214b9c=/[0-9a-f-]{36}/;if(config[_0x1143('0x19')]&&_0x214b9c['test'](config[_0x1143('0x19')])){return config[_0x1143('0x19')];}else if(_0x4ac7f5===_0x1143('0x1a')){return exec(_0x1143('0x1b'),{'encoding':_0x1143('0x1c')})[_0x1143('0x1d')]('\x0d\x0a','');}else{var _0x48f1ce=getFirstInterface();var _0x19e862=getCPUhash();var _0x544943=_0x19e862+'|'+os[_0x1143('0x1e')]()+'|'+_0x48f1ce[_0x1143('0x1f')]+'|'+_0x48f1ce[_0x1143('0x20')];var _0x206114=crypto[_0x1143('0x21')](_0x1143('0x22'))[_0x1143('0x15')](_0x544943)[_0x1143('0x16')]('hex');return _0x206114[_0x1143('0x23')](0x0,0x8)+'-'+_0x206114[_0x1143('0x23')](0x8,0xc)+'-'+_0x206114[_0x1143('0x23')](0xc,0x10)+'-'+_0x206114['substring'](0x10,0x14)+'-'+_0x206114[_0x1143('0x23')](0x14);}}; \ No newline at end of file +var _0x1ff1=['platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','filter','IPv4','internal','00:00:00:00:00:00','address','127.0.0.1','cpus','map','model','join','createHash','md5','update','digest','getUuid'];(function(_0x29d736,_0x31b71d){var _0x382ba3=function(_0x37e6e8){while(--_0x37e6e8){_0x29d736['push'](_0x29d736['shift']());}};_0x382ba3(++_0x31b71d);}(_0x1ff1,0xde));var _0x11ff=function(_0x543c80,_0x173438){_0x543c80=_0x543c80-0x0;var _0x148d9a=_0x1ff1[_0x543c80];return _0x148d9a;};'use strict';var _=require(_0x11ff('0x0'));var os=require('os');var crypto=require(_0x11ff('0x1'));var machine=require(_0x11ff('0x2'));var exec=require(_0x11ff('0x3'))[_0x11ff('0x4')];var config=require('../environment');function getInterfaces(){var _0x19abb6=[];var _0x4310bc=os[_0x11ff('0x5')]();var _0x58824b=_[_0x11ff('0x6')](_[_0x11ff('0x7')](_0x4310bc));for(var _0x663a6=0x0;_0x663a6<_0x58824b['length'];_0x663a6++){var _0x3533a1=_0x4310bc[_0x58824b[_0x663a6]][_0x11ff('0x8')](function(_0x3cd1e8){return _0x3cd1e8['family']===_0x11ff('0x9')&&_0x3cd1e8[_0x11ff('0xa')]===![];});_0x19abb6=_0x19abb6['concat'](_0x3533a1);}return _0x19abb6;}function getFirstInterface(){var _0x20ae39=_['head'](getInterfaces());return{'macAddress':_0x20ae39&&_0x20ae39['mac']?_0x20ae39['mac']:_0x11ff('0xb'),'ipAddress':_0x20ae39&&_0x20ae39['address']?_0x20ae39[_0x11ff('0xc')]:_0x11ff('0xd')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x56b369=_[_0x11ff('0x6')](os[_0x11ff('0xe')]()[_0x11ff('0xf')](function(_0x41194e){return _0x41194e[_0x11ff('0x10')];}))[_0x11ff('0x11')](':');return crypto[_0x11ff('0x12')](_0x11ff('0x13'))[_0x11ff('0x14')](_0x56b369)[_0x11ff('0x15')]('hex');}exports[_0x11ff('0x16')]=function(){var _0x56d3b9=os[_0x11ff('0x17')]();var _0x14551a=/[0-9a-f-]{36}/;if(config[_0x11ff('0x18')]&&_0x14551a[_0x11ff('0x19')](config[_0x11ff('0x18')])){return config['licenseToken'];}else if(_0x56d3b9===_0x11ff('0x1a')){return exec(_0x11ff('0x1b'),{'encoding':_0x11ff('0x1c')})[_0x11ff('0x1d')]('\x0d\x0a','');}else{var _0x226176=getFirstInterface();var _0x4468df=getCPUhash();var _0x3f47d7=_0x4468df+'|'+os[_0x11ff('0x1e')]()+'|'+_0x226176[_0x11ff('0x1f')]+'|'+_0x226176[_0x11ff('0x20')];var _0x56e144=crypto[_0x11ff('0x12')](_0x11ff('0x13'))['update'](_0x3f47d7)[_0x11ff('0x15')](_0x11ff('0x21'));return _0x56e144[_0x11ff('0x22')](0x0,0x8)+'-'+_0x56e144[_0x11ff('0x22')](0x8,0xc)+'-'+_0x56e144['substring'](0xc,0x10)+'-'+_0x56e144[_0x11ff('0x22')](0x10,0x14)+'-'+_0x56e144['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 904535b..bf780c1 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 _0x613e=['default','moment','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','then','get','data1','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled','info','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','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','catch','error','message','finally','getUuid','License','spread'];(function(_0x32f672,_0x108c40){var _0x236426=function(_0x35d7a5){while(--_0x35d7a5){_0x32f672['push'](_0x32f672['shift']());}};_0x236426(++_0x108c40);}(_0x613e,0xc9));var _0xe613=function(_0x10b71d,_0x5558f8){_0x10b71d=_0x10b71d-0x0;var _0xd1044a=_0x613e[_0x10b71d];return _0xd1044a;};'use strict';var util=require('util');var moment=require(_0xe613('0x0'));var rp=require(_0xe613('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0xe613('0x2'))(module,_0xe613('0x3'));var db=require(_0xe613('0x4'))['db'];var encryptor=require(_0xe613('0x5'));var hardware=require('./hardware');var logger=require(_0xe613('0x6'))(_0xe613('0x7'));var HOST=_0xe613('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x16eeec){return new BPromise(function(_0x33c39b,_0x376f3f){var _0x3ab53a=util['format'](_0xe613('0x9'),HOST,_0x16eeec,module['exports']['version']);if(oldToken){_0x3ab53a=util[_0xe613('0xa')](_0xe613('0xb'),HOST,_0x16eeec,module[_0xe613('0xc')][_0xe613('0x3')],oldToken);}var _0x499ea1={'uri':_0x3ab53a,'method':_0xe613('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x499ea1)[_0xe613('0xe')](function(_0x181342){_0x33c39b(_0x181342);})['catch'](function(_0x2acb98){_0x376f3f(_0x2acb98);});});}function manageLicense(_0x222ea5,_0x3f909d){var _0x4c79d6=_0x3f909d[_0xe613('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x4c79d6[_0xe613('0x10')]!==_0x222ea5&&!_0x4c79d6[_0xe613('0x11')]){oldToken=_0x4c79d6[_0xe613('0x10')];}httpRequest(_0x222ea5)['then'](function(_0x2e2e57){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2e2e57['active']){isOldTokenSent=![];if(!_0x4c79d6[_0xe613('0x7')]&&_0x4c79d6['license']!=_0x2e2e57[_0xe613('0x7')]||_0x4c79d6['license']&&_0x4c79d6[_0xe613('0x11')]){logger['info'](_0xe613('0x12'));}if(_0x4c79d6[_0xe613('0x7')]&&!_0x4c79d6[_0xe613('0x11')]&&_0x4c79d6[_0xe613('0x7')]!=_0x2e2e57['license']){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x4c79d6[_0xe613('0x7')]&&!_0x4c79d6[_0xe613('0x11')]&&_0x4c79d6[_0xe613('0x7')]==_0x2e2e57[_0xe613('0x7')]){return _0x3f909d;}return _0x3f909d[_0xe613('0x13')]({'data1':_0x222ea5,'data2':null,'license':_0x2e2e57[_0xe613('0x7')]});}else{if(_0x2e2e57[_0xe613('0x7')]||_0x4c79d6[_0xe613('0x7')]){if(!_0x4c79d6[_0xe613('0x11')]){if(_0x4c79d6['data1']==_0x222ea5){GRAY_PERIOD_REASON=_0xe613('0x14');logger[_0xe613('0x15')](_0xe613('0x16'));}else{GRAY_PERIOD_REASON=_0xe613('0x17');logger[_0xe613('0x15')](_0xe613('0x18'),_0x4c79d6['data1'],_0x222ea5);}logger[_0xe613('0x15')](_0xe613('0x19'),GRAY_PERIOD_REASON[_0xe613('0x1a')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x3f909d[_0xe613('0x13')]({'data2':encryptor[_0xe613('0x1b')](moment()[_0xe613('0xa')](_0xe613('0x1c')))});}else{if(moment()[_0xe613('0x1d')](encryptor[_0xe613('0x1e')](_0x4c79d6[_0xe613('0x11')]),_0xe613('0x1f'))>DAYS){logger[_0xe613('0x15')]('DEMO\x20START\x20AT\x20%s',moment()[_0xe613('0xa')](_0xe613('0x1c')));isOldTokenSent=![];return _0x3f909d[_0xe613('0x13')]({'data1':_0x222ea5,'data2':null,'license':null});}}}else{if(_0x4c79d6[_0xe613('0x10')]!=_0x222ea5){logger[_0xe613('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4c79d6[_0xe613('0x10')],_0x222ea5);return _0x3f909d['update']({'data1':_0x222ea5,'data2':null,'license':null});}}}return _0x3f909d;})[_0xe613('0xe')](function(_0xcb7e8b){_0x3f909d=_0xcb7e8b;})[_0xe613('0x20')](function(_0x3e0429){logger[_0xe613('0x21')](_0x3e0429[_0xe613('0x22')]);})[_0xe613('0x23')](function(){setTimeout(function(){manageLicense(hardware[_0xe613('0x24')](),_0x3f909d);},TIME);});}function defaultLicense(){var _0x4d499e=hardware[_0xe613('0x24')]();if(_0x4d499e){return db[_0xe613('0x25')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x4d499e}})[_0xe613('0x26')](function(_0x39f23c,_0x3e0f0d){logger[_0xe613('0x15')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x4d499e);manageLicense(_0x4d499e,_0x39f23c);})[_0xe613('0x20')](function(_0x1aee4b){logger[_0xe613('0x21')](_0x1aee4b[_0xe613('0x22')]);});}}exports[_0xe613('0x27')]=defaultLicense; \ No newline at end of file +var _0x1fd4=['license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','get','data1','then','active','info','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','decryptString','days','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','catch','error','util','moment','request-promise','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger'];(function(_0x443c1e,_0x29ce14){var _0x53009f=function(_0x37831d){while(--_0x37831d){_0x443c1e['push'](_0x443c1e['shift']());}};_0x53009f(++_0x29ce14);}(_0x1fd4,0x168));var _0x41fd=function(_0xf9a6cf,_0x11870e){_0xf9a6cf=_0xf9a6cf-0x0;var _0x59e2bc=_0x1fd4[_0xf9a6cf];return _0x59e2bc;};'use strict';var util=require(_0x41fd('0x0'));var moment=require(_0x41fd('0x1'));var rp=require(_0x41fd('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x41fd('0x3'))(module,_0x41fd('0x4'));var db=require(_0x41fd('0x5'))['db'];var encryptor=require(_0x41fd('0x6'));var hardware=require(_0x41fd('0x7'));var logger=require(_0x41fd('0x8'))(_0x41fd('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1327a5){return new BPromise(function(_0x47bea5,_0x26cc54){var _0x506c74=util[_0x41fd('0xa')](_0x41fd('0xb'),HOST,_0x1327a5,module[_0x41fd('0xc')][_0x41fd('0x4')]);if(oldToken){_0x506c74=util['format'](_0x41fd('0xd'),HOST,_0x1327a5,module['exports'][_0x41fd('0x4')],oldToken);}var _0x1aeb14={'uri':_0x506c74,'method':_0x41fd('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x1aeb14)['then'](function(_0x58fa52){_0x47bea5(_0x58fa52);})['catch'](function(_0x2e7e6d){_0x26cc54(_0x2e7e6d);});});}function manageLicense(_0x49b089,_0x2db68f){var _0x52d8b6=_0x2db68f[_0x41fd('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x52d8b6[_0x41fd('0x10')]!==_0x49b089&&!_0x52d8b6['data2']){oldToken=_0x52d8b6[_0x41fd('0x10')];}httpRequest(_0x49b089)[_0x41fd('0x11')](function(_0x2f3507){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2f3507[_0x41fd('0x12')]){isOldTokenSent=![];if(!_0x52d8b6[_0x41fd('0x9')]&&_0x52d8b6[_0x41fd('0x9')]!=_0x2f3507[_0x41fd('0x9')]||_0x52d8b6[_0x41fd('0x9')]&&_0x52d8b6['data2']){logger[_0x41fd('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x52d8b6['license']&&!_0x52d8b6[_0x41fd('0x14')]&&_0x52d8b6['license']!=_0x2f3507['license']){logger[_0x41fd('0x13')](_0x41fd('0x15'));}if(_0x52d8b6[_0x41fd('0x9')]&&!_0x52d8b6[_0x41fd('0x14')]&&_0x52d8b6[_0x41fd('0x9')]==_0x2f3507[_0x41fd('0x9')]){return _0x2db68f;}return _0x2db68f[_0x41fd('0x16')]({'data1':_0x49b089,'data2':null,'license':_0x2f3507['license']});}else{if(_0x2f3507[_0x41fd('0x9')]||_0x52d8b6[_0x41fd('0x9')]){if(!_0x52d8b6[_0x41fd('0x14')]){if(_0x52d8b6[_0x41fd('0x10')]==_0x49b089){GRAY_PERIOD_REASON=_0x41fd('0x17');logger[_0x41fd('0x13')](_0x41fd('0x18'));}else{GRAY_PERIOD_REASON=_0x41fd('0x19');logger['info'](_0x41fd('0x1a'),_0x52d8b6[_0x41fd('0x10')],_0x49b089);}logger[_0x41fd('0x13')](_0x41fd('0x1b'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0x41fd('0x1c')));return _0x2db68f[_0x41fd('0x16')]({'data2':encryptor['encryptString'](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0x41fd('0x1d')](_0x52d8b6[_0x41fd('0x14')]),_0x41fd('0x1e'))>DAYS){logger[_0x41fd('0x13')](_0x41fd('0x1f'),moment()[_0x41fd('0xa')](_0x41fd('0x1c')));isOldTokenSent=![];return _0x2db68f[_0x41fd('0x16')]({'data1':_0x49b089,'data2':null,'license':null});}}}else{if(_0x52d8b6[_0x41fd('0x10')]!=_0x49b089){logger[_0x41fd('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x52d8b6[_0x41fd('0x10')],_0x49b089);return _0x2db68f[_0x41fd('0x16')]({'data1':_0x49b089,'data2':null,'license':null});}}}return _0x2db68f;})[_0x41fd('0x11')](function(_0x3e19cc){_0x2db68f=_0x3e19cc;})['catch'](function(_0xa06070){logger['error'](_0xa06070[_0x41fd('0x20')]);})[_0x41fd('0x21')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x2db68f);},TIME);});}function defaultLicense(){var _0x4c36f9=hardware[_0x41fd('0x22')]();if(_0x4c36f9){return db[_0x41fd('0x23')][_0x41fd('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x4c36f9}})[_0x41fd('0x25')](function(_0x2351b3,_0x4aaf83){logger['info'](_0x41fd('0x26'),_0x4c36f9);manageLicense(_0x4c36f9,_0x2351b3);})[_0x41fd('0x27')](function(_0x33784c){logger[_0x41fd('0x28')](_0x33784c['message']);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index a783dd0..5d23b65 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 _0x6a87=['parse','machineUuid','gray','deadline','add','days','format','grayReason','disabled','message','User','findAll','role','sequelize','col','count','admin','user','telephone','users','telephones','forEach','catch','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','moment','./hardware','../../components/encryptor','getUuid','2027-01-01T00:00:00.000Z','defaults','then','uuid','data1','isEmpty','data2','split','decryptString','%s:%s:%s'];(function(_0x3f4785,_0x29c128){var _0x3e89d9=function(_0x1ed305){while(--_0x1ed305){_0x3f4785['push'](_0x3f4785['shift']());}};_0x3e89d9(++_0x29c128);}(_0x6a87,0x111));var _0x76a8=function(_0x3748d1,_0x3c75a8){_0x3748d1=_0x3748d1-0x0;var _0x3aaac5=_0x6a87[_0x3748d1];return _0x3aaac5;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x76a8('0x0'));var BPromise=require('bluebird');var hardware=require(_0x76a8('0x1'));var encryptor=require(_0x76a8('0x2'));var db=require('../../mysqldb')['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':'Demo\x20license','machineUuid':hardware[_0x76a8('0x3')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x76a8('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x76a8('0x3')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x546ce4){return new BPromise(function(_0x4411f7,_0x4fdad3){return db['License']['find'](_[_0x76a8('0x5')](_0x546ce4,{'raw':!![],'where':{'id':0x1}}))[_0x76a8('0x6')](function(_0x1bf6c4){return checkLicense(_0x1bf6c4,null);})[_0x76a8('0x6')](function(_0x5f477a){_0x4411f7(_0x5f477a);return;})['catch'](function(_0x3e34c4){_0x4fdad3(_0x3e34c4);});});}function checkLicense(_0x44fa25,_0x5821a5){if(!_0x44fa25){demoLicense[_0x76a8('0x7')]=_0x44fa25[_0x76a8('0x8')];return demoLicense;}try{var _0x4c3361=_0x5821a5||_0x44fa25['license'];if(_[_0x76a8('0x9')](_0x4c3361)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x579e01=_0x44fa25[_0x76a8('0x8')];var _0xa5ede5=_0x44fa25[_0x76a8('0xa')];var _0x1758f4=_0x579e01['split']('-')[0x4];var _0x34887e=_0x579e01[_0x76a8('0xb')]('-')[0x0];var _0x2d4993=encryptor[_0x76a8('0xc')](_0x4c3361,util['format'](_0x76a8('0xd'),_0x1758f4,_0x579e01,_0x34887e));var _0x145c39=JSON[_0x76a8('0xe')](_0x2d4993);_0x145c39['demo']=![];_0x145c39[_0x76a8('0x7')]=_0x579e01;_0x145c39[_0x76a8('0xf')]=hardware[_0x76a8('0x3')]();if(_0xa5ede5){var _0xbe085c=encryptor[_0x76a8('0xc')](_0xa5ede5);_0x145c39[_0x76a8('0x10')]=_0xbe085c;_0x145c39[_0x76a8('0x11')]=moment(_0xbe085c)[_0x76a8('0x12')](0x7,_0x76a8('0x13'))[_0x76a8('0x14')]();_0x145c39[_0x76a8('0x15')]=_0x145c39[_0x76a8('0x7')]!=_0x145c39['machineUuid']?'changed':_0x76a8('0x16');}return _0x145c39;}catch(_0x329019){breakingLicense['uuid']=_0x44fa25[_0x76a8('0x8')];breakingLicense[_0x76a8('0x17')]=_0x329019['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x6f2e57,_0xc1e6fa){getLicense()[_0x76a8('0x6')](function(_0x5113f4){return db[_0x76a8('0x18')][_0x76a8('0x19')]({'attributes':[_0x76a8('0x1a'),[db['sequelize']['fn']('COUNT',db[_0x76a8('0x1b')][_0x76a8('0x1c')](_0x76a8('0x1a'))),_0x76a8('0x1d')]],'group':'role','where':{'role':{'$or':[_0x76a8('0x1e'),_0x76a8('0x1f'),_0x76a8('0x20')]}},'raw':!![]})[_0x76a8('0x6')](function(_0x78429d){var _0x512a76={'user':_0x5113f4[_0x76a8('0x21')]||0x0,'telephone':_0x5113f4[_0x76a8('0x22')]||0x0};_0x78429d[_0x76a8('0x23')](function(_0x2262df){var _0xb46c5=_0x2262df[_0x76a8('0x1a')]===_0x76a8('0x1e')?_0x76a8('0x1f'):_0x2262df[_0x76a8('0x1a')];_0x512a76[_0xb46c5]-=_0x2262df['count'];if(_0x512a76[_0xb46c5]<0x0)_0x512a76[_0xb46c5]=0x0;});_0x6f2e57(_0x512a76);return;});})[_0x76a8('0x24')](function(_0x4fad75){_0xc1e6fa(_0x4fad75);});});}function checkUserLimits(_0xc003b3){return new BPromise(function(_0x111377,_0x566928){getLimits()[_0x76a8('0x6')](function(_0x383607){var _0xd134cf=_['pick'](_[_0x76a8('0x25')](_0xc003b3,'role'),[_0x76a8('0x1e'),_0x76a8('0x1f'),_0x76a8('0x20')]);var _0x1c9154=(_0xd134cf['admin']||0x0)+(_0xd134cf[_0x76a8('0x1f')]||0x0);var _0x2b126b=_0xd134cf[_0x76a8('0x20')]||0x0;if(_0x1c9154>_0x383607[_0x76a8('0x1f')])return _0x566928(_0x76a8('0x26'));if(_0x2b126b>_0x383607[_0x76a8('0x20')])return _0x566928(_0x76a8('0x27'));return _0x111377();})[_0x76a8('0x24')](function(_0x297b5d){_0x566928(_0x297b5d);});});}module[_0x76a8('0x28')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x641c=['format','%s:%s:%s','parse','uuid','machineUuid','gray','deadline','add','grayReason','changed','disabled','message','User','findAll','role','sequelize','count','admin','user','telephone','users','telephones','forEach','pick','countBy','util','lodash','bluebird','./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','then','catch','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','decryptString'];(function(_0x57492e,_0x4b40f1){var _0x3539b5=function(_0x4fd8c6){while(--_0x4fd8c6){_0x57492e['push'](_0x57492e['shift']());}};_0x3539b5(++_0x4b40f1);}(_0x641c,0x1ae));var _0xc641=function(_0x505983,_0x3500dc){_0x505983=_0x505983-0x0;var _0x4d1918=_0x641c[_0x505983];return _0x4d1918;};'use strict';var util=require(_0xc641('0x0'));var _=require(_0xc641('0x1'));var moment=require('moment');var BPromise=require(_0xc641('0x2'));var hardware=require(_0xc641('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0xc641('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc641('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xc641('0x6'),'machineUuid':hardware[_0xc641('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc641('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xc641('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4283c5){return new BPromise(function(_0x1269f8,_0x452690){return db[_0xc641('0x8')][_0xc641('0x9')](_[_0xc641('0xa')](_0x4283c5,{'raw':!![],'where':{'id':0x1}}))[_0xc641('0xb')](function(_0x421d53){return checkLicense(_0x421d53,null);})[_0xc641('0xb')](function(_0x1c57d2){_0x1269f8(_0x1c57d2);return;})[_0xc641('0xc')](function(_0x3f6290){_0x452690(_0x3f6290);});});}function checkLicense(_0x4c96e4,_0x33135c){if(!_0x4c96e4){demoLicense['uuid']=_0x4c96e4['data1'];return demoLicense;}try{var _0x5b1b79=_0x33135c||_0x4c96e4[_0xc641('0xd')];if(_[_0xc641('0xe')](_0x5b1b79)){throw new Error(_0xc641('0xf'));}var _0x2d7184=_0x4c96e4[_0xc641('0x10')];var _0x1b7ad2=_0x4c96e4[_0xc641('0x11')];var _0x51e1c6=_0x2d7184[_0xc641('0x12')]('-')[0x4];var _0x1bb776=_0x2d7184[_0xc641('0x12')]('-')[0x0];var _0x103254=encryptor[_0xc641('0x13')](_0x5b1b79,util[_0xc641('0x14')](_0xc641('0x15'),_0x51e1c6,_0x2d7184,_0x1bb776));var _0x4f7f74=JSON[_0xc641('0x16')](_0x103254);_0x4f7f74['demo']=![];_0x4f7f74[_0xc641('0x17')]=_0x2d7184;_0x4f7f74[_0xc641('0x18')]=hardware[_0xc641('0x7')]();if(_0x1b7ad2){var _0x245523=encryptor['decryptString'](_0x1b7ad2);_0x4f7f74[_0xc641('0x19')]=_0x245523;_0x4f7f74[_0xc641('0x1a')]=moment(_0x245523)[_0xc641('0x1b')](0x7,'days')[_0xc641('0x14')]();_0x4f7f74[_0xc641('0x1c')]=_0x4f7f74[_0xc641('0x17')]!=_0x4f7f74[_0xc641('0x18')]?_0xc641('0x1d'):_0xc641('0x1e');}return _0x4f7f74;}catch(_0x12e13e){breakingLicense[_0xc641('0x17')]=_0x4c96e4['data1'];breakingLicense[_0xc641('0x1f')]=_0x12e13e['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x88a5da,_0x2b2e32){getLicense()['then'](function(_0xf2f663){return db[_0xc641('0x20')][_0xc641('0x21')]({'attributes':[_0xc641('0x22'),[db[_0xc641('0x23')]['fn']('COUNT',db[_0xc641('0x23')]['col'](_0xc641('0x22'))),_0xc641('0x24')]],'group':_0xc641('0x22'),'where':{'role':{'$or':[_0xc641('0x25'),_0xc641('0x26'),_0xc641('0x27')]}},'raw':!![]})[_0xc641('0xb')](function(_0x47cf69){var _0x25999a={'user':_0xf2f663[_0xc641('0x28')]||0x0,'telephone':_0xf2f663[_0xc641('0x29')]||0x0};_0x47cf69[_0xc641('0x2a')](function(_0x51336e){var _0xaa43ed=_0x51336e[_0xc641('0x22')]===_0xc641('0x25')?'user':_0x51336e[_0xc641('0x22')];_0x25999a[_0xaa43ed]-=_0x51336e[_0xc641('0x24')];if(_0x25999a[_0xaa43ed]<0x0)_0x25999a[_0xaa43ed]=0x0;});_0x88a5da(_0x25999a);return;});})['catch'](function(_0x3d2480){_0x2b2e32(_0x3d2480);});});}function checkUserLimits(_0x5a8edf){return new BPromise(function(_0x57582a,_0x3fd194){getLimits()[_0xc641('0xb')](function(_0x5b1e11){var _0x13a7c2=_[_0xc641('0x2b')](_[_0xc641('0x2c')](_0x5a8edf,'role'),[_0xc641('0x25'),'user',_0xc641('0x27')]);var _0x24cdcb=(_0x13a7c2[_0xc641('0x25')]||0x0)+(_0x13a7c2[_0xc641('0x26')]||0x0);var _0x1afbae=_0x13a7c2[_0xc641('0x27')]||0x0;if(_0x24cdcb>_0x5b1e11['user'])return _0x3fd194('License\x20limit\x20reached\x20for\x20users');if(_0x1afbae>_0x5b1e11[_0xc641('0x27')])return _0x3fd194('License\x20limit\x20reached\x20for\x20telephones');return _0x57582a();})['catch'](function(_0xb698c6){_0x3fd194(_0xb698c6);});});}module['exports']={'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 143be91..5cf7693 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 _0xb574=['app-id','secret','exports','http://localhost:9000'];(function(_0x22f65c,_0x36523f){var _0x548688=function(_0x37ea7b){while(--_0x37ea7b){_0x22f65c['push'](_0x22f65c['shift']());}};_0x548688(++_0x36523f);}(_0xb574,0x106));var _0x4b57=function(_0xba29db,_0x11bd07){_0xba29db=_0xba29db-0x0;var _0x11ee94=_0xb574[_0xba29db];return _0x11ee94;};'use strict';module[_0x4b57('0x0')]={'DOMAIN':_0x4b57('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x4b57('0x2'),'GOOGLE_SECRET':_0x4b57('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x1a85=['secret','myappanuglar-secret','app-id'];(function(_0x1a4a03,_0x4dafff){var _0x337545=function(_0xe9a7f2){while(--_0xe9a7f2){_0x1a4a03['push'](_0x1a4a03['shift']());}};_0x337545(++_0x4dafff);}(_0x1a85,0x178));var _0x51a8=function(_0x19e206,_0x3e945d){_0x19e206=_0x19e206-0x0;var _0x531b21=_0x1a85[_0x19e206];return _0x531b21;};'use strict';module['exports']={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x51a8('0x0'),'GOOGLE_ID':_0x51a8('0x1'),'GOOGLE_SECRET':_0x51a8('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index aca30e2..e62f5ce 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5039=['exports','../utils/loggers','fileLogger'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5039,0xa6));var _0x9503=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0x5039[_0x11ca63];return _0x41f1f6;};'use strict';var fileLogger=require(_0x9503('0x0'))[_0x9503('0x1')];module[_0x9503('0x2')]=fileLogger; \ No newline at end of file +var _0x2037=['exports','../utils/loggers','fileLogger'];(function(_0x454e6d,_0x1e1f38){var _0x4bc294=function(_0x2c803a){while(--_0x2c803a){_0x454e6d['push'](_0x454e6d['shift']());}};_0x4bc294(++_0x1e1f38);}(_0x2037,0x1a8));var _0x7203=function(_0x57ee8c,_0xe42849){_0x57ee8c=_0x57ee8c-0x0;var _0x3a2322=_0x2037[_0x57ee8c];return _0x3a2322;};'use strict';var fileLogger=require(_0x7203('0x0'))[_0x7203('0x1')];module[_0x7203('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 3ee0c94..49249a9 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 _0xceb0=['agi','../../services/agi/index.js','../../services/email/index.js','xdr','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js'];(function(_0x5a1670,_0x44f196){var _0x297f64=function(_0x19659f){while(--_0x19659f){_0x5a1670['push'](_0x5a1670['shift']());}};_0x297f64(++_0x44f196);}(_0xceb0,0x15a));var _0x0ceb=function(_0x4c4d5e,_0x3f730c){_0x4c4d5e=_0x4c4d5e-0x0;var _0x375bf9=_0xceb0[_0x4c4d5e];return _0x375bf9;};'use strict';var path=require(_0x0ceb('0x0'));var os=require('os');var config={'apps':[{'name':_0x0ceb('0x1'),'script':path[_0x0ceb('0x2')](__dirname,_0x0ceb('0x3'))},{'name':_0x0ceb('0x4'),'script':path['join'](__dirname,_0x0ceb('0x5'))},{'name':_0x0ceb('0x6'),'script':path[_0x0ceb('0x2')](__dirname,_0x0ceb('0x7'))},{'name':'email','script':path[_0x0ceb('0x2')](__dirname,_0x0ceb('0x8'))},{'name':'routing','script':path[_0x0ceb('0x2')](__dirname,'../../services/routing/index.js')},{'name':_0x0ceb('0x9'),'script':path[_0x0ceb('0x2')](__dirname,'../../services/xdr/index.js')}]};module[_0x0ceb('0xa')]=config; \ No newline at end of file +var _0x003f=['express','join','../../services/express/index.js','ami','../../services/ami/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports'];(function(_0xbcab50,_0x54e518){var _0x4fe571=function(_0x4d40c1){while(--_0x4d40c1){_0xbcab50['push'](_0xbcab50['shift']());}};_0x4fe571(++_0x54e518);}(_0x003f,0x1a4));var _0xf003=function(_0x4b933f,_0x2666b0){_0x4b933f=_0x4b933f-0x0;var _0x27584d=_0x003f[_0x4b933f];return _0x27584d;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0xf003('0x0'),'script':path[_0xf003('0x1')](__dirname,_0xf003('0x2'))},{'name':_0xf003('0x3'),'script':path[_0xf003('0x1')](__dirname,_0xf003('0x4'))},{'name':'agi','script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0xf003('0x5'),'script':path['join'](__dirname,_0xf003('0x6'))},{'name':_0xf003('0x7'),'script':path[_0xf003('0x1')](__dirname,_0xf003('0x8'))},{'name':_0xf003('0x9'),'script':path[_0xf003('0x1')](__dirname,_0xf003('0xa'))}]};module[_0xf003('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 6ad5235..8ec7a28 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 _0x2861=['dump','saved','pm2','bluebird','./config','connect','connected','start','then','disconnect','stop','restart','list','describe','delete'];(function(_0x4c8283,_0x52f82e){var _0x428ac1=function(_0x10e6f9){while(--_0x10e6f9){_0x4c8283['push'](_0x4c8283['shift']());}};_0x428ac1(++_0x52f82e);}(_0x2861,0xe3));var _0x1286=function(_0x2dd752,_0x59b4fc){_0x2dd752=_0x2dd752-0x0;var _0x297823=_0x2861[_0x2dd752];return _0x297823;};'use strict';var pm2=require(_0x1286('0x0'));var BPromise=require(_0x1286('0x1'));var config=require(_0x1286('0x2'));function connect(){return new BPromise(function(_0x748807,_0x1a4bb9){return pm2[_0x1286('0x3')](function(_0x3e39c8){if(_0x3e39c8){return _0x1a4bb9(_0x3e39c8);}return _0x748807(_0x1286('0x4'));});});};exports[_0x1286('0x5')]=function(_0x334d17){return connect()[_0x1286('0x6')](function(){return new BPromise(function(_0x8b08f,_0x41d929){return pm2[_0x1286('0x5')](_0x334d17,function(_0x5488a9,_0x5a54ab){if(_0x5488a9){return _0x41d929(_0x5488a9);}pm2[_0x1286('0x7')]();return _0x8b08f(_0x5a54ab);});});});};exports[_0x1286('0x8')]=function(_0x62455e){return connect()[_0x1286('0x6')](function(){return new BPromise(function(_0x267248,_0x14cf1e){return pm2[_0x1286('0x8')](_0x62455e,function(_0x1df0a4,_0x8ac17b){if(_0x1df0a4){return _0x14cf1e(_0x1df0a4);}pm2[_0x1286('0x7')]();return _0x267248(_0x8ac17b);});});});};exports['restart']=function(_0x3036c5){return connect()[_0x1286('0x6')](function(){return new BPromise(function(_0x52487f,_0x2373c2){return pm2[_0x1286('0x9')](_0x3036c5,function(_0x4798e4,_0x536129){if(_0x4798e4){return _0x2373c2(_0x4798e4);}pm2[_0x1286('0x7')]();return _0x52487f(_0x536129);});});});};exports[_0x1286('0xa')]=function(){return connect()[_0x1286('0x6')](function(){return new BPromise(function(_0x5a95e3,_0x10721e){return pm2[_0x1286('0xa')](function(_0x282f70,_0x1ecf8f){if(_0x282f70){return _0x10721e(_0x282f70);}pm2['disconnect']();return _0x5a95e3(_0x1ecf8f);});});});};exports['describe']=function(_0x464f82){return connect()[_0x1286('0x6')](function(){return new BPromise(function(_0x54405f,_0x1fde30){return pm2[_0x1286('0xb')](_0x464f82,function(_0x508bf7,_0x1a6aac){if(_0x508bf7){return _0x1fde30(_0x508bf7);}pm2['disconnect']();return _0x54405f(_0x1a6aac);});});});};exports[_0x1286('0xc')]=function(_0x5aa020){return connect()[_0x1286('0x6')](function(){return new BPromise(function(_0x26ccb3,_0x4c2fbd){return pm2[_0x1286('0xc')](_0x5aa020,function(_0x331ced,_0x4c070d){if(_0x331ced){return _0x4c2fbd(_0x331ced);}pm2[_0x1286('0x7')]();return _0x26ccb3(_0x4c070d);});});});};exports[_0x1286('0xd')]=function(){return connect()[_0x1286('0x6')](function(){return new BPromise(function(_0x59c69c,_0x327e0a){return pm2[_0x1286('0xd')](function(_0x492674){if(_0x492674){return _0x327e0a(_0x492674);}return _0x59c69c(_0x1286('0xe'));});});});}; \ No newline at end of file +var _0x8db9=['bluebird','./config','connect','connected','start','then','disconnect','stop','restart','list','delete','pm2'];(function(_0x313830,_0x2102b8){var _0x234fcb=function(_0xa79da2){while(--_0xa79da2){_0x313830['push'](_0x313830['shift']());}};_0x234fcb(++_0x2102b8);}(_0x8db9,0x14f));var _0x98db=function(_0x2e200c,_0x48ecf0){_0x2e200c=_0x2e200c-0x0;var _0x5a1e2e=_0x8db9[_0x2e200c];return _0x5a1e2e;};'use strict';var pm2=require(_0x98db('0x0'));var BPromise=require(_0x98db('0x1'));var config=require(_0x98db('0x2'));function connect(){return new BPromise(function(_0x474074,_0x3abd0c){return pm2[_0x98db('0x3')](function(_0x3ffb04){if(_0x3ffb04){return _0x3abd0c(_0x3ffb04);}return _0x474074(_0x98db('0x4'));});});};exports[_0x98db('0x5')]=function(_0x358f02){return connect()[_0x98db('0x6')](function(){return new BPromise(function(_0x300017,_0x16cc32){return pm2['start'](_0x358f02,function(_0x145062,_0x2e0890){if(_0x145062){return _0x16cc32(_0x145062);}pm2[_0x98db('0x7')]();return _0x300017(_0x2e0890);});});});};exports[_0x98db('0x8')]=function(_0x518726){return connect()['then'](function(){return new BPromise(function(_0x407908,_0x49bab8){return pm2[_0x98db('0x8')](_0x518726,function(_0x517a6c,_0x5d8d49){if(_0x517a6c){return _0x49bab8(_0x517a6c);}pm2['disconnect']();return _0x407908(_0x5d8d49);});});});};exports[_0x98db('0x9')]=function(_0x3bdf91){return connect()[_0x98db('0x6')](function(){return new BPromise(function(_0x2b97dd,_0x4a0874){return pm2['restart'](_0x3bdf91,function(_0x22a953,_0x43c1a5){if(_0x22a953){return _0x4a0874(_0x22a953);}pm2['disconnect']();return _0x2b97dd(_0x43c1a5);});});});};exports[_0x98db('0xa')]=function(){return connect()[_0x98db('0x6')](function(){return new BPromise(function(_0x326747,_0x45b168){return pm2[_0x98db('0xa')](function(_0x3d3ea8,_0x342fff){if(_0x3d3ea8){return _0x45b168(_0x3d3ea8);}pm2[_0x98db('0x7')]();return _0x326747(_0x342fff);});});});};exports['describe']=function(_0x5f57d7){return connect()[_0x98db('0x6')](function(){return new BPromise(function(_0x4d21da,_0x29b126){return pm2['describe'](_0x5f57d7,function(_0x26ffb5,_0x473508){if(_0x26ffb5){return _0x29b126(_0x26ffb5);}pm2[_0x98db('0x7')]();return _0x4d21da(_0x473508);});});});};exports[_0x98db('0xb')]=function(_0x273e80){return connect()[_0x98db('0x6')](function(){return new BPromise(function(_0x5e652e,_0x1be314){return pm2['delete'](_0x273e80,function(_0x3c0045,_0xadc652){if(_0x3c0045){return _0x1be314(_0x3c0045);}pm2['disconnect']();return _0x5e652e(_0xadc652);});});});};exports['dump']=function(){return connect()[_0x98db('0x6')](function(){return new BPromise(function(_0x476170,_0x1884fe){return pm2['dump'](function(_0x44d0d7){if(_0x44d0d7){return _0x1884fe(_0x44d0d7);}return _0x476170('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index df333d4..e4d6296 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 _0x607f=['chatInteraction:update','error','inspect','start','lodash','moment','ioredis','util','../logger','schedule','redis','defaults','localhost','Setting','find','chatTimeout','then','findAll','subtract','minutes','length','map','info','join','ChatInteraction','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x607f,0x1b6));var _0xf607=function(_0x10a985,_0x2c5252){_0x10a985=_0x10a985-0x0;var _0x46f374=_0x607f[_0x10a985];return _0x46f374;};'use strict';var _=require(_0xf607('0x0'));var moment=require(_0xf607('0x1'));var Redis=require(_0xf607('0x2'));var util=require(_0xf607('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0xf607('0x4'))(_0xf607('0x5'));config[_0xf607('0x6')]=_[_0xf607('0x7')](config[_0xf607('0x6')],{'host':_0xf607('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf607('0x6')]));function closeInteractions(){var _0x52e541=0x0;var _0x4b16ba=[];return db[_0xf607('0x9')][_0xf607('0xa')]({'raw':!![],'attributes':['id',_0xf607('0xb')],'where':{'id':0x1}})[_0xf607('0xc')](function(_0x13c564){_0x52e541=_0x13c564[_0xf607('0xb')];if(_0x52e541){return db['ChatInteraction'][_0xf607('0xd')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xf607('0xe')](_0x13c564[_0xf607('0xb')],_0xf607('0xf'))}}});}else{return[];}})[_0xf607('0xc')](function(_0x405750){if(_0x405750&&_0x405750[_0xf607('0x10')]){_0x4b16ba=_[_0xf607('0x11')](_0x405750||[],'id');logger[_0xf607('0x12')]('[CHAT]\x20Interactions\x20to\x20close:',_0x4b16ba[_0xf607('0x13')]());return db[_0xf607('0x14')][_0xf607('0x15')]({'closeReason':'system','disposition':_0xf607('0x16'),'closed':!![],'closedAt':moment()[_0xf607('0x17')](_0xf607('0x18'))},{'where':{'id':_0x4b16ba}});}})[_0xf607('0xc')](function(){if(_0x4b16ba&&_0x4b16ba['length']){logger[_0xf607('0x12')](_0xf607('0x19'),_0x4b16ba[_0xf607('0x13')]());for(var _0x397747=0x0;_0x397747<_0x4b16ba['length'];_0x397747++){io[_0xf607('0x1a')](_0xf607('0x1b'),{'id':_0x4b16ba[_0x397747],'closed':!![]});}}})['catch'](function(_0x101497){logger[_0xf607('0x1c')]('[CHAT]\x20Error\x20closing\x20interactions',_0x101497?util[_0xf607('0x1d')](_0x101497,{'showHidden':![],'depth':null}):'');});}exports[_0xf607('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5aa4=['../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','emit','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','moment','util'];(function(_0x973570,_0x479eab){var _0x11091d=function(_0x3b0135){while(--_0x3b0135){_0x973570['push'](_0x973570['shift']());}};_0x11091d(++_0x479eab);}(_0x5aa4,0x1eb));var _0x45aa=function(_0xb0de07,_0x3ca2a0){_0xb0de07=_0xb0de07-0x0;var _0x4633d8=_0x5aa4[_0xb0de07];return _0x4633d8;};'use strict';var _=require('lodash');var moment=require(_0x45aa('0x0'));var Redis=require('ioredis');var util=require(_0x45aa('0x1'));var config=require(_0x45aa('0x2'));var db=require(_0x45aa('0x3'))['db'];var logger=require(_0x45aa('0x4'))(_0x45aa('0x5'));config[_0x45aa('0x6')]=_[_0x45aa('0x7')](config[_0x45aa('0x6')],{'host':_0x45aa('0x8'),'port':0x18eb});var io=require(_0x45aa('0x9'))(new Redis(config[_0x45aa('0x6')]));function closeInteractions(){var _0x45704e=0x0;var _0x49206f=[];return db['Setting'][_0x45aa('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x54c0fd){_0x45704e=_0x54c0fd[_0x45aa('0xb')];if(_0x45704e){return db[_0x45aa('0xc')][_0x45aa('0xd')]({'raw':!![],'attributes':['id',_0x45aa('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x45aa('0xf')](_0x54c0fd[_0x45aa('0xb')],_0x45aa('0x10'))}}});}else{return[];}})['then'](function(_0x3af569){if(_0x3af569&&_0x3af569[_0x45aa('0x11')]){_0x49206f=_[_0x45aa('0x12')](_0x3af569||[],'id');logger['info']('[CHAT]\x20Interactions\x20to\x20close:',_0x49206f[_0x45aa('0x13')]());return db[_0x45aa('0xc')]['update']({'closeReason':_0x45aa('0x14'),'disposition':_0x45aa('0x15'),'closed':!![],'closedAt':moment()[_0x45aa('0x16')](_0x45aa('0x17'))},{'where':{'id':_0x49206f}});}})['then'](function(){if(_0x49206f&&_0x49206f[_0x45aa('0x11')]){logger[_0x45aa('0x18')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x49206f['join']());for(var _0x863c69=0x0;_0x863c69<_0x49206f['length'];_0x863c69++){io[_0x45aa('0x19')]('chatInteraction:update',{'id':_0x49206f[_0x863c69],'closed':!![]});}}})['catch'](function(_0x5c7e6b){logger[_0x45aa('0x1a')](_0x45aa('0x1b'),_0x5c7e6b?util[_0x45aa('0x1c')](_0x5c7e6b,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index c0e680d..3c3e64a 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3205=['../../api/cloudProvider/cloudProvider.oauth.js','exports'];(function(_0x1a5719,_0x5eeb09){var _0x296934=function(_0x570557){while(--_0x570557){_0x1a5719['push'](_0x1a5719['shift']());}};_0x296934(++_0x5eeb09);}(_0x3205,0x82));var _0x5320=function(_0x4c3cf9,_0xb95b0e){_0x4c3cf9=_0x4c3cf9-0x0;var _0x203764=_0x3205[_0x4c3cf9];return _0x203764;};'use strict';function start(){var _0x406e77=require(_0x5320('0x0'));return _0x406e77['startAllRefreshIntervals']();}module[_0x5320('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x4e5b=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x361c6d,_0x496cc2){var _0x1df288=function(_0x42fec8){while(--_0x42fec8){_0x361c6d['push'](_0x361c6d['shift']());}};_0x1df288(++_0x496cc2);}(_0x4e5b,0x9d));var _0xb4e5=function(_0x20adb6,_0x5bb9ba){_0x20adb6=_0x20adb6-0x0;var _0x488e6a=_0x4e5b[_0x20adb6];return _0x488e6a;};'use strict';function start(){var _0x330af3=require(_0xb4e5('0x0'));return _0x330af3['startAllRefreshIntervals']();}module[_0xb4e5('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 483e062..9605a33 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 _0x5efa=['Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','then','CustomReportId','no\x20report\x20id','findAll','CloudProvider','keys','jobs','map','toString','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','my\x20id','resolve','run\x20job','active','isBetween','startAt','endAt','start','add\x20cron','cron','stop\x20cron','update','update\x20cron','run','util','path','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','email','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','format','subtractNumber','subtractUnit','savename','%s.%s','basename','extname','zip','join','status','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync'];(function(_0x22c402,_0x1fd8d8){var _0x1d3710=function(_0x466c0e){while(--_0x466c0e){_0x22c402['push'](_0x22c402['shift']());}};_0x1d3710(++_0x1fd8d8);}(_0x5efa,0xe1));var _0xa5ef=function(_0x25e321,_0x5d68a0){_0x25e321=_0x25e321-0x0;var _0x467fc0=_0x5efa[_0x25e321];return _0x467fc0;};'use strict';var fs=require('fs');var util=require(_0xa5ef('0x0'));var path=require(_0xa5ef('0x1'));var _=require('lodash');var moment=require(_0xa5ef('0x2'));var CronJobManager=require(_0xa5ef('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0xa5ef('0x4'));var logger=require(_0xa5ef('0x5'))(_0xa5ef('0x6'));var db=require(_0xa5ef('0x7'))['db'];var analyticCustomReportController=require(_0xa5ef('0x8'));var analyticDefaultReportController=require(_0xa5ef('0x9'));var client=jayson[_0xa5ef('0xa')][_0xa5ef('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xd9542c,_0x56ac0f){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0xd9542c[_0xa5ef('0xc')]);var _0x525e1a=!![];var _0x5468a6=_0xd9542c[_0xa5ef('0xd')][_0xa5ef('0xe')]();var _0x577ca6={'account':_0x5468a6,'message':{'from':util['format'](_0xa5ef('0xf'),_0xd9542c[_0xa5ef('0xd')][_0xa5ef('0x10')],_0xd9542c['MailAccount']['email']||_0xd9542c[_0xa5ef('0xd')][_0xa5ef('0x11')][_0xa5ef('0x12')]),'to':_0xd9542c[_0xa5ef('0xc')],'cc':_0xd9542c['cc'],'bcc':_0xd9542c[_0xa5ef('0x13')],'subject':util[_0xa5ef('0x14')]('Report\x20%s\x20last\x20%s\x20%s',_0x56ac0f[_0xa5ef('0x10')],_0xd9542c[_0xa5ef('0x15')],_0xd9542c[_0xa5ef('0x16')])}};var _0x5ae454=path['join'](__dirname,'../../files/reports');var _0x317383=_0x56ac0f[_0xa5ef('0x17')];var _0x466994=util[_0xa5ef('0x14')](_0xa5ef('0x18'),path[_0xa5ef('0x19')](_0x56ac0f['savename'],path[_0xa5ef('0x1a')](_0x56ac0f[_0xa5ef('0x17')])),_0xa5ef('0x1b'));var _0x360e1c=path[_0xa5ef('0x1c')](_0x5ae454,_0x317383);var _0x54626a=path['join'](_0x5ae454,_0x466994);if(fs['existsSync'](_0x360e1c)){_0x56ac0f[_0xa5ef('0x1d')]='Sent';_0x577ca6[_0xa5ef('0x1e')][_0xa5ef('0x1f')]=[{'filename':_0x317383,'path':_0x360e1c}];_0x577ca6[_0xa5ef('0x1e')][_0xa5ef('0x20')]=util[_0xa5ef('0x14')](_0xa5ef('0x21'),JSON[_0xa5ef('0x22')](_0x56ac0f,null,0x2));}else if(fs[_0xa5ef('0x23')](_0x54626a)){_0x56ac0f[_0xa5ef('0x1d')]='Sent';_0x577ca6['message'][_0xa5ef('0x1f')]=[{'filename':_0x466994,'path':_0x54626a}];}else{_0x577ca6[_0xa5ef('0x1e')][_0xa5ef('0x20')]=_0xa5ef('0x24');if(!_0xd9542c[_0xa5ef('0x25')]){_0x525e1a=![];logger[_0xa5ef('0x26')](_0xa5ef('0x27'));}}if(_0x525e1a){return client[_0xa5ef('0x28')](_0xa5ef('0x29'),_0x577ca6)['then'](function(_0x5b4c45){if(_0x5b4c45[_0xa5ef('0x2a')]){return logger['error'](_0xa5ef('0x2b'),JSON[_0xa5ef('0x22')](_0x5b4c45));}return logger[_0xa5ef('0x26')](_0xa5ef('0x2c'));})[_0xa5ef('0x2d')](function(_0x1cfd8b){return logger[_0xa5ef('0x2a')]('error\x20mail',JSON[_0xa5ef('0x22')](_0x1cfd8b));});}};}function handleError(){return function(_0x82d3f0){return logger[_0xa5ef('0x2a')](JSON[_0xa5ef('0x22')](_0x82d3f0));};}function handleResult(_0x620681){return function(_0x6bff6){logger[_0xa5ef('0x26')](_0xa5ef('0x2e'),JSON[_0xa5ef('0x22')](_0x6bff6));if(_0x620681['MailAccount']&&_0x620681[_0xa5ef('0xd')][_0xa5ef('0x11')]&&!_[_0xa5ef('0x2f')](_0x620681[_0xa5ef('0xc')])){setTimeout(handleSendEmail(_0x620681,_0x6bff6),0x3c*0x3e8);}};}function handleJob(_0x40b8ac){return function(){try{if(_[_0xa5ef('0x2f')](_0x40b8ac[_0xa5ef('0x15')])){return logger[_0xa5ef('0x26')](_0xa5ef('0x30'));}if(_['isNil'](_0x40b8ac[_0xa5ef('0x16')])){return logger['info'](_0xa5ef('0x31'));}var _0x3d9ed5={'startDate':moment()[_0xa5ef('0x32')](_0x40b8ac[_0xa5ef('0x15')],_0x40b8ac[_0xa5ef('0x16')])[_0xa5ef('0x14')](_0xa5ef('0x33')),'endDate':moment()[_0xa5ef('0x14')](_0xa5ef('0x33')),'type':'scheduled','output':_0x40b8ac[_0xa5ef('0x34')],'name':_0x40b8ac[_0xa5ef('0x10')]};if(!_['isNil'](_0x40b8ac[_0xa5ef('0x35')])){logger[_0xa5ef('0x26')](_0xa5ef('0x36'),_0x40b8ac['DefaultReportId']);return analyticDefaultReportController[_0xa5ef('0x37')]({'id':_0x40b8ac[_0xa5ef('0x35')]},_0x3d9ed5)[_0xa5ef('0x38')](handleResult(_0x40b8ac))['catch'](handleError());}if(!_[_0xa5ef('0x2f')](_0x40b8ac[_0xa5ef('0x39')])){logger[_0xa5ef('0x26')]('exec\x20custom\x20report\x20id:%s',_0x40b8ac[_0xa5ef('0x39')]);return analyticCustomReportController[_0xa5ef('0x37')]({'id':_0x40b8ac[_0xa5ef('0x39')]},_0x3d9ed5)['then'](handleResult(_0x40b8ac))[_0xa5ef('0x2d')](handleError());}}catch(_0x123b34){logger[_0xa5ef('0x2a')](JSON[_0xa5ef('0x22')](_0x123b34));}return logger[_0xa5ef('0x26')](_0xa5ef('0x3a'));};}function getJobs(_0x5f2831){var _0x3023ff={};if(_0x5f2831){_0x3023ff['id']=_0x5f2831;}return db['Schedule'][_0xa5ef('0x3b')]({'where':_0x3023ff,'include':[{'model':db[_0xa5ef('0xd')],'attributes':['id','name',_0xa5ef('0xc')],'include':[{'model':db['MailServerOut'],'as':_0xa5ef('0x11'),'include':[{'model':db[_0xa5ef('0x3c')],'as':_0xa5ef('0x3c')}]}]}]})['then'](function(_0x17cac1){var _0x5cdf53=_[_0xa5ef('0x3d')](manager[_0xa5ef('0x3e')]);var _0x245abb=_[_0xa5ef('0x3f')](_0x17cac1,function(_0x2fa921){return _0x2fa921['id'][_0xa5ef('0x40')]();});var _0xf1a357=_['keyBy'](_0x17cac1,function(_0x174fb2){return _0x174fb2['id'][_0xa5ef('0x40')]();});var _0x2ccf74=_0x5f2831?_0x245abb:_[_0xa5ef('0x41')](_0x245abb,_0x5cdf53);var _0x5851b9=_[_0xa5ef('0x42')](_0x245abb,_0x5cdf53);var _0x437d83=_[_0xa5ef('0x41')](_0x5cdf53,_0x245abb);var _0x5ca910;var _0x18642f;for(_0x5ca910=0x0;_0x5ca910<_0x437d83[_0xa5ef('0x43')]&&!_0x5f2831;_0x5ca910+=0x1){_0x18642f=_0x437d83[_0x5ca910][_0xa5ef('0x40')]();if(manager[_0xa5ef('0x44')](_0x18642f)){manager[_0xa5ef('0x45')](_0x18642f);manager[_0xa5ef('0x46')](_0x18642f);logger[_0xa5ef('0x26')](_0xa5ef('0x47'),_0x18642f);}}logger[_0xa5ef('0x26')](_0xa5ef('0x48'),JSON['stringify'](_0x2ccf74));for(_0x5ca910=0x0;_0x5ca910<_0x2ccf74[_0xa5ef('0x43')];_0x5ca910+=0x1){_0x18642f=_0x2ccf74[_0x5ca910][_0xa5ef('0x40')]();logger[_0xa5ef('0x26')]('index',_0x18642f);if(_0x5f2831){logger['info'](_0xa5ef('0x49'),_0x5f2831);logger[_0xa5ef('0x26')](JSON[_0xa5ef('0x22')](_0xf1a357[_0x18642f]));BPromise[_0xa5ef('0x4a')]()[_0xa5ef('0x38')](handleJob(_0xf1a357[_0x18642f]));logger[_0xa5ef('0x26')](_0xa5ef('0x4b'),_0xf1a357[_0x18642f][_0xa5ef('0x10')],_0xf1a357[_0x18642f]['cron']);}else if(_0xf1a357[_0x18642f]['cron']&&_0xf1a357[_0x18642f][_0xa5ef('0x4c')]&&moment()[_0xa5ef('0x4d')](_0xf1a357[_0x18642f][_0xa5ef('0x4e')],_0xf1a357[_0x18642f][_0xa5ef('0x4f')])){manager['add'](_0x18642f,_0xf1a357[_0x18642f]['cron'],handleJob(_0xf1a357[_0x18642f]));manager[_0xa5ef('0x50')](_0x18642f);logger['info'](_0xa5ef('0x51'),_0xf1a357[_0x18642f][_0xa5ef('0x10')],_0xf1a357[_0x18642f][_0xa5ef('0x52')]);}else if(manager[_0xa5ef('0x44')](_0x18642f)){manager[_0xa5ef('0x45')](_0x18642f);manager['deleteJob'](_0x18642f);logger[_0xa5ef('0x26')](_0xa5ef('0x53'),_0xf1a357[_0x18642f][_0xa5ef('0x10')],_0xf1a357[_0x18642f][_0xa5ef('0x52')]);}}for(_0x5ca910=0x0,_0x18642f;_0x5ca910<_0x5851b9[_0xa5ef('0x43')]&&!_0x5f2831;_0x5ca910+=0x1){_0x18642f=_0x5851b9[_0x5ca910][_0xa5ef('0x40')]();if(manager['exists'](_0x18642f)){if(_0xf1a357[_0x18642f][_0xa5ef('0x52')]&&_0xf1a357[_0x18642f][_0xa5ef('0x4c')]&&moment()['isBetween'](_0xf1a357[_0x18642f][_0xa5ef('0x4e')],_0xf1a357[_0x18642f][_0xa5ef('0x4f')])){manager[_0xa5ef('0x54')](_0x18642f,_0xf1a357[_0x18642f][_0xa5ef('0x52')],handleJob(_0xf1a357[_0x18642f]));logger[_0xa5ef('0x26')](_0xa5ef('0x55'),_0xf1a357[_0x18642f]['name'],_0xf1a357[_0x18642f]['cron']);}else{manager[_0xa5ef('0x45')](_0x18642f);manager[_0xa5ef('0x46')](_0x18642f);logger[_0xa5ef('0x26')](_0xa5ef('0x53'),_0xf1a357[_0x18642f][_0xa5ef('0x10')],_0xf1a357[_0x18642f][_0xa5ef('0x52')]);}}}})[_0xa5ef('0x2d')](function(_0xd21ee4){logger[_0xa5ef('0x2a')](JSON[_0xa5ef('0x22')](_0xd21ee4));});}exports[_0xa5ef('0x56')]=function(_0x2e8bba){return getJobs(_0x2e8bba);};exports[_0xa5ef('0x50')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x9b09=['../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','email','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','savename','%s.%s','basename','extname','zip','join','existsSync','status','Sent','message','attachments','text','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','CloudProvider','map','toString','keyBy','difference','intersection','deleteJob','delete\x20cron','toRun','length','index','resolve','run\x20job','cron','isBetween','startAt','endAt','start','add\x20cron','stop','stop\x20cron','exists','active','update','update\x20cron','run','util','path','moment','jayson/promise','bluebird','schedule'];(function(_0x3778d8,_0x5ce417){var _0x45a1b3=function(_0x28488a){while(--_0x28488a){_0x3778d8['push'](_0x3778d8['shift']());}};_0x45a1b3(++_0x5ce417);}(_0x9b09,0x19e));var _0x99b0=function(_0x6bb814,_0x17196b){_0x6bb814=_0x6bb814-0x0;var _0x3c4bf6=_0x9b09[_0x6bb814];return _0x3c4bf6;};'use strict';var fs=require('fs');var util=require(_0x99b0('0x0'));var path=require(_0x99b0('0x1'));var _=require('lodash');var moment=require(_0x99b0('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x99b0('0x3'));var BPromise=require(_0x99b0('0x4'));var logger=require('../logger')(_0x99b0('0x5'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x99b0('0x6'));var analyticDefaultReportController=require(_0x99b0('0x7'));var client=jayson[_0x99b0('0x8')][_0x99b0('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x7dde75,_0x1c5975){return function(){logger[_0x99b0('0xa')](_0x99b0('0xb'),_0x7dde75['email']);var _0x4ac8ad=!![];var _0x550ca8=_0x7dde75[_0x99b0('0xc')][_0x99b0('0xd')]();var _0x4a9ac3={'account':_0x550ca8,'message':{'from':util[_0x99b0('0xe')](_0x99b0('0xf'),_0x7dde75[_0x99b0('0xc')][_0x99b0('0x10')],_0x7dde75['MailAccount'][_0x99b0('0x11')]||_0x7dde75[_0x99b0('0xc')][_0x99b0('0x12')][_0x99b0('0x13')]),'to':_0x7dde75[_0x99b0('0x11')],'cc':_0x7dde75['cc'],'bcc':_0x7dde75[_0x99b0('0x14')],'subject':util['format'](_0x99b0('0x15'),_0x1c5975[_0x99b0('0x10')],_0x7dde75[_0x99b0('0x16')],_0x7dde75[_0x99b0('0x17')])}};var _0x11a994=path['join'](__dirname,'../../files/reports');var _0x351bfc=_0x1c5975[_0x99b0('0x18')];var _0x17c6d8=util[_0x99b0('0xe')](_0x99b0('0x19'),path[_0x99b0('0x1a')](_0x1c5975[_0x99b0('0x18')],path[_0x99b0('0x1b')](_0x1c5975[_0x99b0('0x18')])),_0x99b0('0x1c'));var _0x5dc5be=path['join'](_0x11a994,_0x351bfc);var _0x2f8940=path[_0x99b0('0x1d')](_0x11a994,_0x17c6d8);if(fs[_0x99b0('0x1e')](_0x5dc5be)){_0x1c5975[_0x99b0('0x1f')]=_0x99b0('0x20');_0x4a9ac3[_0x99b0('0x21')][_0x99b0('0x22')]=[{'filename':_0x351bfc,'path':_0x5dc5be}];_0x4a9ac3['message'][_0x99b0('0x23')]=util['format']('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x99b0('0x24')](_0x1c5975,null,0x2));}else if(fs[_0x99b0('0x1e')](_0x2f8940)){_0x1c5975[_0x99b0('0x1f')]='Sent';_0x4a9ac3[_0x99b0('0x21')][_0x99b0('0x22')]=[{'filename':_0x17c6d8,'path':_0x2f8940}];}else{_0x4a9ac3['message'][_0x99b0('0x23')]=_0x99b0('0x25');if(!_0x7dde75[_0x99b0('0x26')]){_0x4ac8ad=![];logger[_0x99b0('0xa')](_0x99b0('0x27'));}}if(_0x4ac8ad){return client[_0x99b0('0x28')]('SendMail',_0x4a9ac3)[_0x99b0('0x29')](function(_0x5c8192){if(_0x5c8192['error']){return logger[_0x99b0('0x2a')](_0x99b0('0x2b'),JSON[_0x99b0('0x24')](_0x5c8192));}return logger[_0x99b0('0xa')]('email\x20sent');})[_0x99b0('0x2c')](function(_0x2bfa6a){return logger[_0x99b0('0x2a')]('error\x20mail',JSON[_0x99b0('0x24')](_0x2bfa6a));});}};}function handleError(){return function(_0x1a8ccd){return logger[_0x99b0('0x2a')](JSON['stringify'](_0x1a8ccd));};}function handleResult(_0x456038){return function(_0x2abcd9){logger[_0x99b0('0xa')](_0x99b0('0x2d'),JSON['stringify'](_0x2abcd9));if(_0x456038[_0x99b0('0xc')]&&_0x456038[_0x99b0('0xc')]['Smtp']&&!_[_0x99b0('0x2e')](_0x456038[_0x99b0('0x11')])){setTimeout(handleSendEmail(_0x456038,_0x2abcd9),0x3c*0x3e8);}};}function handleJob(_0x3f5920){return function(){try{if(_[_0x99b0('0x2e')](_0x3f5920[_0x99b0('0x16')])){return logger['info'](_0x99b0('0x2f'));}if(_['isNil'](_0x3f5920['subtractUnit'])){return logger[_0x99b0('0xa')]('subtractUnit\x20null\x20or\x20undefined');}var _0x4e9af5={'startDate':moment()[_0x99b0('0x30')](_0x3f5920[_0x99b0('0x16')],_0x3f5920['subtractUnit'])[_0x99b0('0xe')](_0x99b0('0x31')),'endDate':moment()[_0x99b0('0xe')](_0x99b0('0x31')),'type':_0x99b0('0x32'),'output':_0x3f5920[_0x99b0('0x33')],'name':_0x3f5920[_0x99b0('0x10')]};if(!_[_0x99b0('0x2e')](_0x3f5920[_0x99b0('0x34')])){logger[_0x99b0('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x3f5920[_0x99b0('0x34')]);return analyticDefaultReportController[_0x99b0('0x35')]({'id':_0x3f5920[_0x99b0('0x34')]},_0x4e9af5)[_0x99b0('0x29')](handleResult(_0x3f5920))[_0x99b0('0x2c')](handleError());}if(!_['isNil'](_0x3f5920[_0x99b0('0x36')])){logger[_0x99b0('0xa')](_0x99b0('0x37'),_0x3f5920[_0x99b0('0x36')]);return analyticCustomReportController[_0x99b0('0x35')]({'id':_0x3f5920[_0x99b0('0x36')]},_0x4e9af5)[_0x99b0('0x29')](handleResult(_0x3f5920))[_0x99b0('0x2c')](handleError());}}catch(_0xdf0758){logger[_0x99b0('0x2a')](JSON[_0x99b0('0x24')](_0xdf0758));}return logger[_0x99b0('0xa')]('no\x20report\x20id');};}function getJobs(_0x3385fc){var _0x425939={};if(_0x3385fc){_0x425939['id']=_0x3385fc;}return db[_0x99b0('0x38')][_0x99b0('0x39')]({'where':_0x425939,'include':[{'model':db['MailAccount'],'attributes':['id',_0x99b0('0x10'),_0x99b0('0x11')],'include':[{'model':db['MailServerOut'],'as':_0x99b0('0x12'),'include':[{'model':db[_0x99b0('0x3a')],'as':_0x99b0('0x3a')}]}]}]})[_0x99b0('0x29')](function(_0xf12830){var _0x35134e=_['keys'](manager['jobs']);var _0x39b307=_[_0x99b0('0x3b')](_0xf12830,function(_0x3ad76a){return _0x3ad76a['id'][_0x99b0('0x3c')]();});var _0x56ae04=_[_0x99b0('0x3d')](_0xf12830,function(_0x11476d){return _0x11476d['id'][_0x99b0('0x3c')]();});var _0x3e8685=_0x3385fc?_0x39b307:_[_0x99b0('0x3e')](_0x39b307,_0x35134e);var _0x13236f=_[_0x99b0('0x3f')](_0x39b307,_0x35134e);var _0x30d51b=_[_0x99b0('0x3e')](_0x35134e,_0x39b307);var _0x3d02c0;var _0x4d98c2;for(_0x3d02c0=0x0;_0x3d02c0<_0x30d51b['length']&&!_0x3385fc;_0x3d02c0+=0x1){_0x4d98c2=_0x30d51b[_0x3d02c0][_0x99b0('0x3c')]();if(manager['exists'](_0x4d98c2)){manager['stop'](_0x4d98c2);manager[_0x99b0('0x40')](_0x4d98c2);logger[_0x99b0('0xa')](_0x99b0('0x41'),_0x4d98c2);}}logger[_0x99b0('0xa')](_0x99b0('0x42'),JSON[_0x99b0('0x24')](_0x3e8685));for(_0x3d02c0=0x0;_0x3d02c0<_0x3e8685[_0x99b0('0x43')];_0x3d02c0+=0x1){_0x4d98c2=_0x3e8685[_0x3d02c0][_0x99b0('0x3c')]();logger[_0x99b0('0xa')](_0x99b0('0x44'),_0x4d98c2);if(_0x3385fc){logger['info']('my\x20id',_0x3385fc);logger['info'](JSON[_0x99b0('0x24')](_0x56ae04[_0x4d98c2]));BPromise[_0x99b0('0x45')]()['then'](handleJob(_0x56ae04[_0x4d98c2]));logger[_0x99b0('0xa')](_0x99b0('0x46'),_0x56ae04[_0x4d98c2][_0x99b0('0x10')],_0x56ae04[_0x4d98c2][_0x99b0('0x47')]);}else if(_0x56ae04[_0x4d98c2][_0x99b0('0x47')]&&_0x56ae04[_0x4d98c2]['active']&&moment()[_0x99b0('0x48')](_0x56ae04[_0x4d98c2][_0x99b0('0x49')],_0x56ae04[_0x4d98c2][_0x99b0('0x4a')])){manager['add'](_0x4d98c2,_0x56ae04[_0x4d98c2][_0x99b0('0x47')],handleJob(_0x56ae04[_0x4d98c2]));manager[_0x99b0('0x4b')](_0x4d98c2);logger[_0x99b0('0xa')](_0x99b0('0x4c'),_0x56ae04[_0x4d98c2]['name'],_0x56ae04[_0x4d98c2]['cron']);}else if(manager['exists'](_0x4d98c2)){manager[_0x99b0('0x4d')](_0x4d98c2);manager[_0x99b0('0x40')](_0x4d98c2);logger[_0x99b0('0xa')](_0x99b0('0x4e'),_0x56ae04[_0x4d98c2][_0x99b0('0x10')],_0x56ae04[_0x4d98c2][_0x99b0('0x47')]);}}for(_0x3d02c0=0x0,_0x4d98c2;_0x3d02c0<_0x13236f[_0x99b0('0x43')]&&!_0x3385fc;_0x3d02c0+=0x1){_0x4d98c2=_0x13236f[_0x3d02c0][_0x99b0('0x3c')]();if(manager[_0x99b0('0x4f')](_0x4d98c2)){if(_0x56ae04[_0x4d98c2][_0x99b0('0x47')]&&_0x56ae04[_0x4d98c2][_0x99b0('0x50')]&&moment()[_0x99b0('0x48')](_0x56ae04[_0x4d98c2][_0x99b0('0x49')],_0x56ae04[_0x4d98c2][_0x99b0('0x4a')])){manager[_0x99b0('0x51')](_0x4d98c2,_0x56ae04[_0x4d98c2][_0x99b0('0x47')],handleJob(_0x56ae04[_0x4d98c2]));logger[_0x99b0('0xa')](_0x99b0('0x52'),_0x56ae04[_0x4d98c2][_0x99b0('0x10')],_0x56ae04[_0x4d98c2][_0x99b0('0x47')]);}else{manager[_0x99b0('0x4d')](_0x4d98c2);manager['deleteJob'](_0x4d98c2);logger[_0x99b0('0xa')]('stop\x20cron',_0x56ae04[_0x4d98c2][_0x99b0('0x10')],_0x56ae04[_0x4d98c2][_0x99b0('0x47')]);}}}})['catch'](function(_0x1c7791){logger['error'](JSON[_0x99b0('0x24')](_0x1c7791));});}exports[_0x99b0('0x53')]=function(_0x457a10){return getJobs(_0x457a10);};exports['start']=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 08678a1..6146876 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 _0x0fd9=['resolve','tempSentiment','bucket','Transcript\x20not\x20available','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','forEach','all','inspect','start','aws-sdk','request-promise','util','bluebird','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','Sequelize','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed'];(function(_0x1ca890,_0x21d0d3){var _0x3f8e01=function(_0x4ff2e2){while(--_0x4ff2e2){_0x1ca890['push'](_0x1ca890['shift']());}};_0x3f8e01(++_0x21d0d3);}(_0x0fd9,0xa3));var _0x90fd=function(_0x4a209a,_0x575ff9){_0x4a209a=_0x4a209a-0x0;var _0x4b3c20=_0x0fd9[_0x4a209a];return _0x4b3c20;};var _=require('lodash');var AWS=require(_0x90fd('0x0'));var rp=require(_0x90fd('0x1'));var util=require(_0x90fd('0x2'));var BPromise=require(_0x90fd('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x90fd('0x4'));function getTranscriptionJob(_0x2a5f76,_0xb7cf6,_0x37a8be,_0x254547){return new Promise(function(_0x23e11b,_0x5e2107){var _0x4ff2d4=new AWS[(_0x90fd('0x5'))]({'accessKeyId':_0xb7cf6,'secretAccessKey':_0x2a5f76,'region':_0x37a8be});_0x4ff2d4['getTranscriptionJob']({'TranscriptionJobName':_0x254547},function(_0x5a604a,_0x2acef7){if(_0x5a604a){return _0x5e2107(_0x5a604a);}else{return _0x23e11b(_0x2acef7);}});});}function sentiment(_0x1becf2,_0x5e66f0,_0x234ba9,_0x464236,_0x3c0592){return new Promise(function(_0x3262f6,_0x289693){var _0x3be346=new AWS[(_0x90fd('0x6'))]({'accessKeyId':_0x5e66f0,'secretAccessKey':_0x1becf2,'region':_0x234ba9});_0x3be346[_0x90fd('0x7')]({'Text':_0x464236,'LanguageCode':_0x3c0592[_0x90fd('0x8')](0x0,0x2)},function(_0x48943e,_0x23c417){if(_0x48943e){return _0x289693(_0x48943e);}else{return _0x3262f6(_0x23c417);}});});}function checkTranscribeJob(_0x328c1b,_0x4e8b99,_0x1439ed){var _0x37a0f8;return new BPromise(function(_0x19a594,_0x5f28ab){logger[_0x90fd('0x9')](util['format'](_0x90fd('0xa'),_0x328c1b['id'],_0x328c1b[_0x90fd('0xb')]));return getTranscriptionJob(_0x1439ed[_0x90fd('0xc')],_0x1439ed[_0x90fd('0xd')],_0x4e8b99[_0x90fd('0xe')],_0x328c1b[_0x90fd('0xb')])[_0x90fd('0xf')](function(_0x4eb953){logger['info'](util[_0x90fd('0x10')](_0x90fd('0x11'),_0x328c1b['id'],_0x328c1b['transcribeName'],_0x4eb953[_0x90fd('0x12')][_0x90fd('0x13')]));if(!_0x328c1b[_0x90fd('0x14')]){switch(_0x4eb953['TranscriptionJob'][_0x90fd('0x13')]){case _0x90fd('0x15'):var _0x16d8a7={'transcribeStatus':_0x4eb953[_0x90fd('0x12')][_0x90fd('0x13')],'fileUri':_0x4eb953[_0x90fd('0x12')][_0x90fd('0x16')][_0x90fd('0x17')]};logger[_0x90fd('0x9')](util[_0x90fd('0x10')](_0x90fd('0x18'),_0x328c1b['id']));return rp({'uri':_0x4eb953[_0x90fd('0x12')][_0x90fd('0x16')][_0x90fd('0x17')],'json':!![]})[_0x90fd('0xf')](function(_0x493c26){logger[_0x90fd('0x9')](util[_0x90fd('0x10')](_0x90fd('0x19'),_0x328c1b['id']));if(_0x493c26&&_0x493c26[_0x90fd('0x1a')]&&_0x493c26[_0x90fd('0x1a')][_0x90fd('0x1b')]&&_0x493c26[_0x90fd('0x1a')][_0x90fd('0x1b')]['length']){_0x16d8a7[_0x90fd('0x14')]='';for(var _0x52b066=0x0;_0x52b066<_0x493c26[_0x90fd('0x1a')][_0x90fd('0x1b')][_0x90fd('0x1c')];_0x52b066++){_0x16d8a7[_0x90fd('0x14')]+=_0x493c26[_0x90fd('0x1a')]['transcripts'][_0x52b066][_0x90fd('0x1d')]+'';}}return _0x328c1b[_0x90fd('0x1e')](_0x16d8a7);})[_0x90fd('0xf')](function(){logger[_0x90fd('0x9')](util[_0x90fd('0x10')](_0x90fd('0x1f'),_0x328c1b['id']));if(!_0x328c1b['tempSentiment']){throw new db['Sequelize'][(_0x90fd('0x20'))](_0x90fd('0x21'));}if(!_0x4e8b99[_0x90fd('0x22')]||!_0x4e8b99[_0x90fd('0x23')]||!_0x4e8b99[_0x90fd('0x24')]||!_0x4e8b99['language']||!_0x4e8b99['bucket']){throw new db[(_0x90fd('0x25'))][(_0x90fd('0x20'))](_0x90fd('0x26'));}if(!_0x16d8a7[_0x90fd('0x14')]){throw new Error('Transcript\x20not\x20available');}if(_0x4e8b99['sentimentAccountId']===_0x1439ed['id']){return _0x1439ed;}else{return db[_0x90fd('0x27')][_0x90fd('0x28')]({'where':{'id':_settings[_0x90fd('0x23')]}});}})[_0x90fd('0xf')](function(_0x5b64ec){if(!_0x5b64ec){throw new db[(_0x90fd('0x25'))][(_0x90fd('0x20'))](_0x90fd('0x29'));}if(!_0x5b64ec[_0x90fd('0xc')]||!_0x5b64ec[_0x90fd('0xd')]){throw new db[(_0x90fd('0x25'))][(_0x90fd('0x20'))](_0x90fd('0x2a'));}_0x37a0f8=_0x5b64ec;logger[_0x90fd('0x9')](util[_0x90fd('0x10')](_0x90fd('0x2b'),_0x328c1b['id']));return sentiment(_0x37a0f8[_0x90fd('0xc')],_0x37a0f8[_0x90fd('0xd')],_0x4e8b99[_0x90fd('0x24')],_0x16d8a7[_0x90fd('0x14')],_0x4e8b99[_0x90fd('0x2c')]);})['then'](function(_0x13c019){logger[_0x90fd('0x9')](util[_0x90fd('0x10')](_0x90fd('0x2d'),_0x328c1b['id']));return _0x328c1b[_0x90fd('0x1e')]({'sentiment':_0x13c019[_0x90fd('0x2e')],'sPositive':_0x13c019[_0x90fd('0x2f')][_0x90fd('0x30')],'sNegative':_0x13c019[_0x90fd('0x2f')][_0x90fd('0x31')],'sMixed':_0x13c019[_0x90fd('0x2f')][_0x90fd('0x32')],'sNeutral':_0x13c019[_0x90fd('0x2f')]['Neutral']});})[_0x90fd('0xf')](function(){logger[_0x90fd('0x9')](util[_0x90fd('0x10')](_0x90fd('0x1f'),_0x328c1b['id']));_0x19a594();});case'FAILED':return _0x328c1b[_0x90fd('0x1e')]({'transcribeStatus':_0x90fd('0x33'),'failureReason':_0x4eb953[_0x90fd('0x12')]['FailureReason']})['then'](function(){logger[_0x90fd('0x9')](util[_0x90fd('0x10')](_0x90fd('0x1f'),_0x328c1b['id']));_0x19a594();});default:logger[_0x90fd('0x9')](util[_0x90fd('0x10')](_0x90fd('0x34'),_0x328c1b['id']));break;}}else{return BPromise[_0x90fd('0x35')]()[_0x90fd('0xf')](function(){if(!_0x328c1b[_0x90fd('0x36')]){throw new db[(_0x90fd('0x25'))][(_0x90fd('0x20'))](_0x90fd('0x21'));}if(!_0x4e8b99[_0x90fd('0x22')]||!_0x4e8b99[_0x90fd('0x23')]||!_0x4e8b99[_0x90fd('0x24')]||!_0x4e8b99[_0x90fd('0x2c')]||!_0x4e8b99[_0x90fd('0x37')]){throw new db[(_0x90fd('0x25'))]['ValidationError'](_0x90fd('0x26'));}if(!_0x328c1b[_0x90fd('0x14')]){throw new Error(_0x90fd('0x38'));}if(_0x4e8b99['sentimentAccountId']===_0x1439ed['id']){return _0x1439ed;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0x90fd('0x23')]}});}})[_0x90fd('0xf')](function(_0x3e2ed6){if(!_0x3e2ed6){throw new db[(_0x90fd('0x25'))][(_0x90fd('0x20'))](_0x90fd('0x29'));}if(!_0x3e2ed6[_0x90fd('0xc')]||!_0x3e2ed6[_0x90fd('0xd')]){throw new db[(_0x90fd('0x25'))][(_0x90fd('0x20'))](_0x90fd('0x2a'));}_0x37a0f8=_0x3e2ed6;logger[_0x90fd('0x9')](util[_0x90fd('0x10')](_0x90fd('0x2b'),_0x328c1b['id']));return sentiment(_0x37a0f8[_0x90fd('0xc')],_0x37a0f8['data2'],_0x4e8b99['sentimentRegion'],_0x328c1b[_0x90fd('0x14')],_0x4e8b99[_0x90fd('0x2c')]);})[_0x90fd('0xf')](function(_0x587bd8){logger['info'](util[_0x90fd('0x10')](_0x90fd('0x2d'),_0x328c1b['id']));return _0x328c1b['update']({'sentiment':_0x587bd8['Sentiment'],'sPositive':_0x587bd8[_0x90fd('0x2f')][_0x90fd('0x30')],'sNegative':_0x587bd8['SentimentScore']['Negative'],'sMixed':_0x587bd8[_0x90fd('0x2f')][_0x90fd('0x32')],'sNeutral':_0x587bd8[_0x90fd('0x2f')]['Neutral'],'transcribeStatus':_0x90fd('0x15')});})[_0x90fd('0xf')](function(){logger['info'](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x328c1b['id']));_0x19a594();});}})[_0x90fd('0x39')](function(_0x2159b1){if(_0x2159b1){if(!_0x2159b1['name']||_0x2159b1[_0x90fd('0x3a')]!==_0x90fd('0x3b')){logger[_0x90fd('0x3c')](util[_0x90fd('0x10')](_0x90fd('0x3d'),_0x328c1b['id']),util['inspect'](_0x2159b1,{'showHidden':![],'depth':null}));}}_0x19a594();});});}function checkTranscribe(){var _0x4fe48a;var _0x376a69;var _0x326e4d;return db[_0x90fd('0x3e')][_0x90fd('0x3f')]({'where':{'transcribeStatus':_0x90fd('0x40')}})[_0x90fd('0xf')](function(_0x23807c){if(!_0x23807c||!_0x23807c[_0x90fd('0x1c')]){throw new db[(_0x90fd('0x25'))][(_0x90fd('0x20'))]('No\x20transcribe\x20job\x20to\x20check');}_0x4fe48a=_0x23807c;return db[_0x90fd('0x41')][_0x90fd('0x28')]({'where':{'id':0x1}});})[_0x90fd('0xf')](function(_0x38021b){if(!_0x38021b){throw new db['Sequelize']['ValidationError'](_0x90fd('0x42'));}_0x376a69=_0x38021b;if(!_0x376a69['transcribe']||!_0x376a69['transcribeAccountId']||!_0x376a69[_0x90fd('0xe')]||!_0x376a69[_0x90fd('0x2c')]||!_0x376a69[_0x90fd('0x37')]){throw new db[(_0x90fd('0x25'))][(_0x90fd('0x20'))](_0x90fd('0x43'));}return db[_0x90fd('0x27')]['findOne']({'where':{'id':_0x376a69['transcribeAccountId']}});})[_0x90fd('0xf')](function(_0x43d076){if(!_0x43d076){throw new db[(_0x90fd('0x25'))]['ValidationError'](_0x90fd('0x29'));}if(!_0x43d076[_0x90fd('0xc')]||!_0x43d076[_0x90fd('0xd')]){throw new db[(_0x90fd('0x25'))][(_0x90fd('0x20'))](_0x90fd('0x2a'));}_0x326e4d=_0x43d076;var _0x12d9f3=[];_0x4fe48a[_0x90fd('0x44')](function(_0x4ec476){_0x12d9f3['push'](checkTranscribeJob(_0x4ec476,_0x376a69,_0x326e4d));});return BPromise[_0x90fd('0x45')](_0x12d9f3);})[_0x90fd('0x39')](function(_0xce4dd){if(_0xce4dd){if(!_0xce4dd['name']||_0xce4dd[_0x90fd('0x3a')]!==_0x90fd('0x3b')){logger[_0x90fd('0x3c')](util[_0x90fd('0x46')](_0xce4dd,{'showHidden':![],'depth':null}));}}});}exports[_0x90fd('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x5eb8=['Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','resolve','Sentiment\x20Analysis\x20not\x20requested','CloudProvider','language','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','all','start','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','sentiment','sentimentRegion','bucket','ValidationError'];(function(_0x4d1744,_0x4171ea){var _0x115232=function(_0x559a55){while(--_0x559a55){_0x4d1744['push'](_0x4d1744['shift']());}};_0x115232(++_0x4171ea);}(_0x5eb8,0xb0));var _0x85eb=function(_0x256cc1,_0x568424){_0x256cc1=_0x256cc1-0x0;var _0x330d0a=_0x5eb8[_0x256cc1];return _0x330d0a;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x85eb('0x0'));var util=require(_0x85eb('0x1'));var BPromise=require(_0x85eb('0x2'));var db=require(_0x85eb('0x3'))['db'];var logger=require(_0x85eb('0x4'))(_0x85eb('0x5'));function getTranscriptionJob(_0x13b1df,_0x44e313,_0x3c5798,_0x1fde1a){return new Promise(function(_0x2bf83c,_0x1ba1d8){var _0x4a8814=new AWS[(_0x85eb('0x6'))]({'accessKeyId':_0x44e313,'secretAccessKey':_0x13b1df,'region':_0x3c5798});_0x4a8814[_0x85eb('0x7')]({'TranscriptionJobName':_0x1fde1a},function(_0x448345,_0x5cd4ec){if(_0x448345){return _0x1ba1d8(_0x448345);}else{return _0x2bf83c(_0x5cd4ec);}});});}function sentiment(_0x2da3b0,_0x50ea77,_0x1f0036,_0x40d6b6,_0x673228){return new Promise(function(_0x29030b,_0x1dacf2){var _0x73e6d0=new AWS[(_0x85eb('0x8'))]({'accessKeyId':_0x50ea77,'secretAccessKey':_0x2da3b0,'region':_0x1f0036});_0x73e6d0['detectSentiment']({'Text':_0x40d6b6,'LanguageCode':_0x673228[_0x85eb('0x9')](0x0,0x2)},function(_0x478710,_0x5c52a4){if(_0x478710){return _0x1dacf2(_0x478710);}else{return _0x29030b(_0x5c52a4);}});});}function checkTranscribeJob(_0x2af376,_0x784583,_0x2f42ba){var _0x259f72;return new BPromise(function(_0x4db167,_0x548628){logger[_0x85eb('0xa')](util['format'](_0x85eb('0xb'),_0x2af376['id'],_0x2af376[_0x85eb('0xc')]));return getTranscriptionJob(_0x2f42ba[_0x85eb('0xd')],_0x2f42ba[_0x85eb('0xe')],_0x784583[_0x85eb('0xf')],_0x2af376['transcribeName'])[_0x85eb('0x10')](function(_0x59237b){logger[_0x85eb('0xa')](util[_0x85eb('0x11')](_0x85eb('0x12'),_0x2af376['id'],_0x2af376[_0x85eb('0xc')],_0x59237b['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x2af376['fileText']){switch(_0x59237b[_0x85eb('0x13')][_0x85eb('0x14')]){case _0x85eb('0x15'):var _0x2e986c={'transcribeStatus':_0x59237b[_0x85eb('0x13')][_0x85eb('0x14')],'fileUri':_0x59237b['TranscriptionJob'][_0x85eb('0x16')][_0x85eb('0x17')]};logger[_0x85eb('0xa')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x2af376['id']));return rp({'uri':_0x59237b['TranscriptionJob']['Transcript'][_0x85eb('0x17')],'json':!![]})[_0x85eb('0x10')](function(_0x329fc5){logger[_0x85eb('0xa')](util[_0x85eb('0x11')](_0x85eb('0x18'),_0x2af376['id']));if(_0x329fc5&&_0x329fc5['results']&&_0x329fc5['results']['transcripts']&&_0x329fc5[_0x85eb('0x19')][_0x85eb('0x1a')][_0x85eb('0x1b')]){_0x2e986c[_0x85eb('0x1c')]='';for(var _0x312b3e=0x0;_0x312b3e<_0x329fc5[_0x85eb('0x19')]['transcripts'][_0x85eb('0x1b')];_0x312b3e++){_0x2e986c[_0x85eb('0x1c')]+=_0x329fc5[_0x85eb('0x19')][_0x85eb('0x1a')][_0x312b3e][_0x85eb('0x1d')]+'';}}return _0x2af376['update'](_0x2e986c);})[_0x85eb('0x10')](function(){logger[_0x85eb('0xa')](util[_0x85eb('0x11')](_0x85eb('0x1e'),_0x2af376['id']));if(!_0x2af376[_0x85eb('0x1f')]){throw new db[(_0x85eb('0x20'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x784583[_0x85eb('0x21')]||!_0x784583['sentimentAccountId']||!_0x784583[_0x85eb('0x22')]||!_0x784583['language']||!_0x784583[_0x85eb('0x23')]){throw new db[(_0x85eb('0x20'))][(_0x85eb('0x24'))](_0x85eb('0x25'));}if(!_0x2e986c[_0x85eb('0x1c')]){throw new Error(_0x85eb('0x26'));}if(_0x784583[_0x85eb('0x27')]===_0x2f42ba['id']){return _0x2f42ba;}else{return db['CloudProvider'][_0x85eb('0x28')]({'where':{'id':_settings[_0x85eb('0x27')]}});}})['then'](function(_0x197898){if(!_0x197898){throw new db['Sequelize']['ValidationError'](_0x85eb('0x29'));}if(!_0x197898[_0x85eb('0xd')]||!_0x197898[_0x85eb('0xe')]){throw new db[(_0x85eb('0x20'))][(_0x85eb('0x24'))](_0x85eb('0x2a'));}_0x259f72=_0x197898;logger[_0x85eb('0xa')](util[_0x85eb('0x11')](_0x85eb('0x2b'),_0x2af376['id']));return sentiment(_0x259f72[_0x85eb('0xd')],_0x259f72['data2'],_0x784583[_0x85eb('0x22')],_0x2e986c[_0x85eb('0x1c')],_0x784583['language']);})['then'](function(_0x340745){logger[_0x85eb('0xa')](util[_0x85eb('0x11')](_0x85eb('0x2c'),_0x2af376['id']));return _0x2af376[_0x85eb('0x2d')]({'sentiment':_0x340745[_0x85eb('0x2e')],'sPositive':_0x340745[_0x85eb('0x2f')][_0x85eb('0x30')],'sNegative':_0x340745[_0x85eb('0x2f')][_0x85eb('0x31')],'sMixed':_0x340745[_0x85eb('0x2f')][_0x85eb('0x32')],'sNeutral':_0x340745[_0x85eb('0x2f')][_0x85eb('0x33')]});})['then'](function(){logger[_0x85eb('0xa')](util[_0x85eb('0x11')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2af376['id']));_0x4db167();});case'FAILED':return _0x2af376[_0x85eb('0x2d')]({'transcribeStatus':_0x85eb('0x34'),'failureReason':_0x59237b['TranscriptionJob'][_0x85eb('0x35')]})['then'](function(){logger[_0x85eb('0xa')](util['format'](_0x85eb('0x1e'),_0x2af376['id']));_0x4db167();});default:logger['info'](util[_0x85eb('0x11')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x2af376['id']));break;}}else{return BPromise[_0x85eb('0x36')]()[_0x85eb('0x10')](function(){if(!_0x2af376['tempSentiment']){throw new db[(_0x85eb('0x20'))]['ValidationError'](_0x85eb('0x37'));}if(!_0x784583[_0x85eb('0x21')]||!_0x784583['sentimentAccountId']||!_0x784583[_0x85eb('0x22')]||!_0x784583['language']||!_0x784583['bucket']){throw new db[(_0x85eb('0x20'))]['ValidationError'](_0x85eb('0x25'));}if(!_0x2af376[_0x85eb('0x1c')]){throw new Error('Transcript\x20not\x20available');}if(_0x784583['sentimentAccountId']===_0x2f42ba['id']){return _0x2f42ba;}else{return db[_0x85eb('0x38')][_0x85eb('0x28')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x2864e2){if(!_0x2864e2){throw new db[(_0x85eb('0x20'))][(_0x85eb('0x24'))](_0x85eb('0x29'));}if(!_0x2864e2[_0x85eb('0xd')]||!_0x2864e2['data2']){throw new db[(_0x85eb('0x20'))][(_0x85eb('0x24'))](_0x85eb('0x2a'));}_0x259f72=_0x2864e2;logger[_0x85eb('0xa')](util[_0x85eb('0x11')](_0x85eb('0x2b'),_0x2af376['id']));return sentiment(_0x259f72[_0x85eb('0xd')],_0x259f72[_0x85eb('0xe')],_0x784583[_0x85eb('0x22')],_0x2af376['fileText'],_0x784583[_0x85eb('0x39')]);})[_0x85eb('0x10')](function(_0x5d90cc){logger[_0x85eb('0xa')](util[_0x85eb('0x11')](_0x85eb('0x2c'),_0x2af376['id']));return _0x2af376[_0x85eb('0x2d')]({'sentiment':_0x5d90cc[_0x85eb('0x2e')],'sPositive':_0x5d90cc[_0x85eb('0x2f')]['Positive'],'sNegative':_0x5d90cc[_0x85eb('0x2f')][_0x85eb('0x31')],'sMixed':_0x5d90cc[_0x85eb('0x2f')][_0x85eb('0x32')],'sNeutral':_0x5d90cc[_0x85eb('0x2f')][_0x85eb('0x33')],'transcribeStatus':_0x85eb('0x15')});})[_0x85eb('0x10')](function(){logger['info'](util[_0x85eb('0x11')](_0x85eb('0x1e'),_0x2af376['id']));_0x4db167();});}})[_0x85eb('0x3a')](function(_0x3d5322){if(_0x3d5322){if(!_0x3d5322[_0x85eb('0x3b')]||_0x3d5322[_0x85eb('0x3b')]!==_0x85eb('0x3c')){logger[_0x85eb('0x3d')](util[_0x85eb('0x11')](_0x85eb('0x3e'),_0x2af376['id']),util[_0x85eb('0x3f')](_0x3d5322,{'showHidden':![],'depth':null}));}}_0x4db167();});});}function checkTranscribe(){var _0x11c682;var _0x528f2b;var _0x11da79;return db[_0x85eb('0x40')][_0x85eb('0x41')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x85eb('0x10')](function(_0x30f921){if(!_0x30f921||!_0x30f921[_0x85eb('0x1b')]){throw new db[(_0x85eb('0x20'))][(_0x85eb('0x24'))]('No\x20transcribe\x20job\x20to\x20check');}_0x11c682=_0x30f921;return db[_0x85eb('0x42')][_0x85eb('0x28')]({'where':{'id':0x1}});})[_0x85eb('0x10')](function(_0x50e264){if(!_0x50e264){throw new db[(_0x85eb('0x20'))][(_0x85eb('0x24'))](_0x85eb('0x43'));}_0x528f2b=_0x50e264;if(!_0x528f2b['transcribe']||!_0x528f2b['transcribeAccountId']||!_0x528f2b[_0x85eb('0xf')]||!_0x528f2b['language']||!_0x528f2b['bucket']){throw new db[(_0x85eb('0x20'))]['ValidationError'](_0x85eb('0x44'));}return db[_0x85eb('0x38')]['findOne']({'where':{'id':_0x528f2b['transcribeAccountId']}});})[_0x85eb('0x10')](function(_0x249511){if(!_0x249511){throw new db[(_0x85eb('0x20'))][(_0x85eb('0x24'))](_0x85eb('0x29'));}if(!_0x249511['data1']||!_0x249511[_0x85eb('0xe')]){throw new db[(_0x85eb('0x20'))][(_0x85eb('0x24'))](_0x85eb('0x2a'));}_0x11da79=_0x249511;var _0x1614dd=[];_0x11c682['forEach'](function(_0x140919){_0x1614dd['push'](checkTranscribeJob(_0x140919,_0x528f2b,_0x11da79));});return BPromise[_0x85eb('0x45')](_0x1614dd);})[_0x85eb('0x3a')](function(_0x4ee529){if(_0x4ee529){if(!_0x4ee529[_0x85eb('0x3b')]||_0x4ee529[_0x85eb('0x3b')]!==_0x85eb('0x3c')){logger[_0x85eb('0x3d')](util[_0x85eb('0x3f')](_0x4ee529,{'showHidden':![],'depth':null}));}}});}exports[_0x85eb('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 257ccd7..8e69d96 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 _0xbe48=['join','WhatsappInteraction','update','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','util','../../config/environment','schedule','redis','socket.io-emitter','lastMsgAt','subtract','hours','then','length','map','info'];(function(_0x4cfe61,_0x51a101){var _0xd9bfef=function(_0x4c5b16){while(--_0x4c5b16){_0x4cfe61['push'](_0x4cfe61['shift']());}};_0xd9bfef(++_0x51a101);}(_0xbe48,0x82));var _0x8be4=function(_0x5c5c4a,_0x242209){_0x5c5c4a=_0x5c5c4a-0x0;var _0x15f3e9=_0xbe48[_0x5c5c4a];return _0x15f3e9;};'use strict';var _=require(_0x8be4('0x0'));var moment=require(_0x8be4('0x1'));var Redis=require('ioredis');var util=require(_0x8be4('0x2'));var config=require(_0x8be4('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x8be4('0x4'));config[_0x8be4('0x5')]=_['defaults'](config[_0x8be4('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x8be4('0x6'))(new Redis(config[_0x8be4('0x5')]));function closeInteractions(){var _0x1eeee9=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0x8be4('0x7')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8be4('0x8')](0x18,_0x8be4('0x9'))}}})[_0x8be4('0xa')](function(_0x98457b){if(_0x98457b&&_0x98457b[_0x8be4('0xb')]){_0x1eeee9=_[_0x8be4('0xc')](_0x98457b||[],'id');logger[_0x8be4('0xd')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x1eeee9[_0x8be4('0xe')]());return db[_0x8be4('0xf')][_0x8be4('0x10')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0x8be4('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1eeee9}});}})[_0x8be4('0xa')](function(){if(_0x1eeee9&&_0x1eeee9['length']){logger['info'](_0x8be4('0x12'),_0x1eeee9[_0x8be4('0xe')]());for(var _0x167d1c=0x0;_0x167d1c<_0x1eeee9[_0x8be4('0xb')];_0x167d1c++){io[_0x8be4('0x13')]('whatsappInteraction:update',{'id':_0x1eeee9[_0x167d1c],'closed':!![]});}}})[_0x8be4('0x14')](function(_0x4687a3){logger[_0x8be4('0x15')](_0x8be4('0x16'),_0x4687a3?util[_0x8be4('0x17')](_0x4687a3,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x7353=['[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','localhost','findAll','lastMsgAt','hours','then','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length'];(function(_0x3adb8e,_0x247ca2){var _0x3eacdb=function(_0x127ddf){while(--_0x127ddf){_0x3adb8e['push'](_0x3adb8e['shift']());}};_0x3eacdb(++_0x247ca2);}(_0x7353,0x1f2));var _0x3735=function(_0x1921cf,_0x4bcf0e){_0x1921cf=_0x1921cf-0x0;var _0x255aae=_0x7353[_0x1921cf];return _0x255aae;};'use strict';var _=require('lodash');var moment=require(_0x3735('0x0'));var Redis=require(_0x3735('0x1'));var util=require(_0x3735('0x2'));var config=require(_0x3735('0x3'));var db=require(_0x3735('0x4'))['db'];var logger=require('../logger')(_0x3735('0x5'));config['redis']=_['defaults'](config[_0x3735('0x6')],{'host':_0x3735('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3735('0x6')]));function closeInteractions(){var _0x242efe=[];return db['WhatsappInteraction'][_0x3735('0x8')]({'raw':!![],'attributes':['id',_0x3735('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x3735('0xa'))}}})[_0x3735('0xb')](function(_0x25ebda){if(_0x25ebda&&_0x25ebda['length']){_0x242efe=_[_0x3735('0xc')](_0x25ebda||[],'id');logger[_0x3735('0xd')](_0x3735('0xe'),_0x242efe[_0x3735('0xf')]());return db[_0x3735('0x10')][_0x3735('0x11')]({'closeReason':'system','disposition':_0x3735('0x12'),'closed':!![],'closedAt':moment()[_0x3735('0x13')](_0x3735('0x14'))},{'where':{'id':_0x242efe}});}})[_0x3735('0xb')](function(){if(_0x242efe&&_0x242efe[_0x3735('0x15')]){logger['info'](_0x3735('0x16'),_0x242efe[_0x3735('0xf')]());for(var _0x414240=0x0;_0x414240<_0x242efe[_0x3735('0x15')];_0x414240++){io['emit']('whatsappInteraction:update',{'id':_0x242efe[_0x414240],'closed':!![]});}}})['catch'](function(_0x35fc8b){logger[_0x3735('0x17')](_0x3735('0x18'),_0x35fc8b?util[_0x3735('0x19')](_0x35fc8b,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 7546b29..e77489e 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5391=['now','Innocenzo','innocenzo.biondo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','util','../mysqldb','push','Biondo','@xcally.com'];(function(_0x45be0e,_0x1da894){var _0x241f6c=function(_0x35832c){while(--_0x35832c){_0x45be0e['push'](_0x45be0e['shift']());}};_0x241f6c(++_0x1da894);}(_0x5391,0xe9));var _0x1539=function(_0x3d5fca,_0xe65f24){_0x3d5fca=_0x3d5fca-0x0;var _0x4d3f82=_0x5391[_0x3d5fca];return _0x4d3f82;};'use strict';var util=require(_0x1539('0x0'));var db=require(_0x1539('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x1539('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x1539('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x1539('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x1539('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x1539('0x5')](),'updatedAt':Date[_0x1539('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x1539('0x2')]({'id':i,'firstName':_0x1539('0x6')+i,'lastName':_0x1539('0x3')+i,'phone':0xf879fb460+i,'email':_0x1539('0x7')+i+_0x1539('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x1539('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x1539('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x1539('0x5')]()});}db[_0x1539('0x8')][_0x1539('0x9')]({'where':{}})[_0x1539('0xa')](function(){return db[_0x1539('0x8')][_0x1539('0xb')](contacts);})[_0x1539('0xa')](function(){console[_0x1539('0xc')](_0x1539('0xd'),_0x1539('0xe'));return db[_0x1539('0xf')][_0x1539('0x9')]({'where':{}});})[_0x1539('0xa')](function(){return db['CmHopper'][_0x1539('0xb')](hopper);})[_0x1539('0xa')](function(){console[_0x1539('0xc')](_0x1539('0xd'),_0x1539('0x10'));return db[_0x1539('0x8')]['bulkCreate'](contacts2);})['then'](function(){console['log'](_0x1539('0xd'),'contacts2');return db['CmHopper']['bulkCreate'](hopper2);})['then'](function(){console[_0x1539('0xc')](_0x1539('0xd'),'hopper2');})['catch'](function(_0x1fc43f){console[_0x1539('0xc')](_0x1fc43f);}); \ No newline at end of file +var _0x24ef=['push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','then','CmContact','bulkCreate','log','contacts1','CmHopper','destroy','finished\x20populating','hopper1','hopper2','catch','../mysqldb'];(function(_0x3f4581,_0x1f8b54){var _0x100399=function(_0x176a7a){while(--_0x176a7a){_0x3f4581['push'](_0x3f4581['shift']());}};_0x100399(++_0x1f8b54);}(_0x24ef,0x18b));var _0xf24e=function(_0x5c2c35,_0x3ecfbf){_0x5c2c35=_0x5c2c35-0x0;var _0x224b43=_0x24ef[_0x5c2c35];return _0x224b43;};'use strict';var util=require('util');var db=require(_0xf24e('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xf24e('0x1')]({'id':i,'firstName':_0xf24e('0x2')+i,'lastName':_0xf24e('0x3')+i,'phone':0xf879fb460+i,'email':_0xf24e('0x4')+i+_0xf24e('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xf24e('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xf24e('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf24e('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xf24e('0x1')]({'id':i,'firstName':_0xf24e('0x2')+i,'lastName':_0xf24e('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xf24e('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xf24e('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xf24e('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf24e('0x6')](),'updatedAt':Date['now']()});}db['CmContact']['destroy']({'where':{}})[_0xf24e('0x7')](function(){return db[_0xf24e('0x8')][_0xf24e('0x9')](contacts);})[_0xf24e('0x7')](function(){console[_0xf24e('0xa')]('finished\x20populating',_0xf24e('0xb'));return db[_0xf24e('0xc')][_0xf24e('0xd')]({'where':{}});})[_0xf24e('0x7')](function(){return db[_0xf24e('0xc')][_0xf24e('0x9')](hopper);})[_0xf24e('0x7')](function(){console[_0xf24e('0xa')](_0xf24e('0xe'),_0xf24e('0xf'));return db['CmContact'][_0xf24e('0x9')](contacts2);})[_0xf24e('0x7')](function(){console[_0xf24e('0xa')](_0xf24e('0xe'),'contacts2');return db['CmHopper']['bulkCreate'](hopper2);})[_0xf24e('0x7')](function(){console[_0xf24e('0xa')](_0xf24e('0xe'),_0xf24e('0x10'));})[_0xf24e('0x11')](function(_0x4c2bd9){console['log'](_0x4c2bd9);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 98934f7..5b86b6e 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b32=['agent','%s%s@xcally.com','friend','udp','all','ulaw','yes','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','format','%s%s'];(function(_0x2e25cf,_0x2439e5){var _0x49fc2d=function(_0x1dfec3){while(--_0x1dfec3){_0x2e25cf['push'](_0x2e25cf['shift']());}};_0x49fc2d(++_0x2439e5);}(_0x1b32,0xeb));var _0x21b3=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x1b32[_0x40220a];return _0x3903cc;};'use strict';var util=require(_0x21b3('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x21b3('0x1')](_0x21b3('0x2'),_0x21b3('0x3'),i),'fullname':util[_0x21b3('0x1')](_0x21b3('0x2'),'agent',i),'email':util[_0x21b3('0x1')](_0x21b3('0x4'),'agent',i),'role':'agent','password':'password','internal':0xfa0+i,'type':_0x21b3('0x5'),'transport':[_0x21b3('0x6'),'ws','wss'],'disallow':[_0x21b3('0x7')],'allow':[_0x21b3('0x8')],'defaultuser':util[_0x21b3('0x1')](_0x21b3('0x2'),_0x21b3('0x3'),i),'encryption':_0x21b3('0x9'),'avpf':_0x21b3('0x9'),'force_avp':_0x21b3('0x9'),'icesupport':'yes','dtlsenable':_0x21b3('0x9'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util[_0x21b3('0x1')](_0x21b3('0xa'),util['format'](_0x21b3('0x2'),'agent',i),0xfa0+i)});}db[_0x21b3('0xb')][_0x21b3('0xc')](users)[_0x21b3('0xd')](function(){console[_0x21b3('0xe')](_0x21b3('0xf'));})[_0x21b3('0x10')](function(_0x16b09b){console['log'](_0x16b09b);}); \ No newline at end of file +var _0xfec5=['log','add\x20user','catch','../mysqldb','%s%s','agent','format','%s%s@xcally.com','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate'];(function(_0x19a550,_0x30df50){var _0x18ecef=function(_0x40768b){while(--_0x40768b){_0x19a550['push'](_0x19a550['shift']());}};_0x18ecef(++_0x30df50);}(_0xfec5,0x8f));var _0x5fec=function(_0x179991,_0x403d01){_0x179991=_0x179991-0x0;var _0x4074be=_0xfec5[_0x179991];return _0x4074be;};'use strict';var util=require('util');var db=require(_0x5fec('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0x5fec('0x1'),_0x5fec('0x2'),i),'fullname':util[_0x5fec('0x3')](_0x5fec('0x1'),_0x5fec('0x2'),i),'email':util[_0x5fec('0x3')](_0x5fec('0x4'),_0x5fec('0x2'),i),'role':'agent','password':_0x5fec('0x5'),'internal':0xfa0+i,'type':_0x5fec('0x6'),'transport':[_0x5fec('0x7'),'ws',_0x5fec('0x8')],'disallow':['all'],'allow':[_0x5fec('0x9')],'defaultuser':util['format'](_0x5fec('0x1'),_0x5fec('0x2'),i),'encryption':_0x5fec('0xa'),'avpf':_0x5fec('0xa'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0x5fec('0xa'),'dtlsverify':'no','dtlscertfile':_0x5fec('0xb'),'dtlsprivatekey':_0x5fec('0xc'),'dtlssetup':_0x5fec('0xd'),'callerid':util[_0x5fec('0x3')](_0x5fec('0xe'),util[_0x5fec('0x3')](_0x5fec('0x1'),_0x5fec('0x2'),i),0xfa0+i)});}db[_0x5fec('0xf')][_0x5fec('0x10')](users)['then'](function(){console[_0x5fec('0x11')](_0x5fec('0x12'));})[_0x5fec('0x13')](function(_0x416564){console['log'](_0x416564);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 4476b2a..41e0a45 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4bc7=['name','role','agent','telephone','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId','map','where','type','format','length','user:%s','handshake','find','userProfileId','query','ChatInteraction','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Campaign','SmsQueue','WhatsappQueues','Trunk','getVoiceQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','removeChatInteractions','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','bluebird','../mysqldb','Agents','User'];(function(_0x616fb8,_0x177e11){var _0x739e20=function(_0xfe27e9){while(--_0xfe27e9){_0x616fb8['push'](_0x616fb8['shift']());}};_0x739e20(++_0x177e11);}(_0x4bc7,0x188));var _0x74bc=function(_0xe7d655,_0x184955){_0xe7d655=_0xe7d655-0x0;var _0x3e4804=_0x4bc7[_0xe7d655];return _0x3e4804;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0x74bc('0x0'));var db=require(_0x74bc('0x1'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0x74bc('0x2'),'model':db[_0x74bc('0x3')],'attributes':['id',_0x74bc('0x4'),_0x74bc('0x5')],'raw':!![],'where':{'role':_0x74bc('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x74bc('0x7')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x74bc('0x4')],'where':{'role':_0x74bc('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x74bc('0x4'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0x35a61e,_0x3c514f,_0x5cfa2e){return db[_0x74bc('0x8')][_0x74bc('0x9')]({'where':{'name':_0x35a61e,'userProfileId':_0x3c514f},'raw':!![]})[_0x74bc('0xa')](function(_0x40ba4f){if(_0x40ba4f){if(_0x40ba4f[_0x74bc('0xb')]){switch(_0x35a61e){case _0x74bc('0xc'):case _0x74bc('0xd'):case _0x74bc('0xe'):case _0x74bc('0xf'):case _0x74bc('0x10'):case _0x74bc('0x11'):case'WhatsappQueues':return db[_0x5cfa2e][_0x74bc('0x12')](queryQueues);case _0x74bc('0x13'):return db[_0x5cfa2e][_0x74bc('0x12')](queryTelephones);case'Trunks':return db[_0x5cfa2e]['findAll'](queryTrunks);case _0x74bc('0x14'):return db[_0x5cfa2e][_0x74bc('0x12')](queryCampaigns);}}else{return db[_0x74bc('0x15')][_0x74bc('0x12')]({'attributes':[_0x74bc('0x16')],'where':{'sectionId':_0x40ba4f['id']},'raw':!![]})['then'](function(_0x2dc5aa){if(_0x2dc5aa){var _0x22167d={'where':{'id':_[_0x74bc('0x17')](_0x2dc5aa,_0x74bc('0x16'))},'raw':!![]};switch(_0x5cfa2e){case _0x74bc('0x3'):_0x22167d[_0x74bc('0x18')]['role']='telephone';break;case'Campaign':_0x22167d[_0x74bc('0x18')][_0x74bc('0x19')]='ivr';break;}return db[_0x5cfa2e][_0x74bc('0x12')](_0x22167d);}else{return[];}});}}else{return[];}})['then'](function(_0x165eef){return _0x165eef;});}function joinOrLeaveQueues(_0x5592d2,_0x20e0c9,_0x2c3a15,_0x1b2708){_0x5592d2[_0x20e0c9](util[_0x74bc('0x1a')]('%s:queue:%s',_0x2c3a15,_0x1b2708[_0x74bc('0x4')]));if(_0x1b2708[_0x74bc('0x2')]){for(var _0x29b4eb=0x0;_0x29b4eb<_0x1b2708[_0x74bc('0x2')][_0x74bc('0x1b')];_0x29b4eb+=0x1){_0x5592d2[_0x20e0c9](util[_0x74bc('0x1a')](_0x74bc('0x1c'),_0x1b2708[_0x74bc('0x2')][_0x29b4eb][_0x74bc('0x4')]));}}}function joinOrLeave(_0x230ceb,_0x4af99a,_0x5cb165){var _0x213fb5;if(_0x230ceb[_0x74bc('0x1d')]['query']['id']){db[_0x74bc('0x3')][_0x74bc('0x1e')]({'attributes':['id','name','role',_0x74bc('0x1f')],'where':{'id':_0x230ceb[_0x74bc('0x1d')][_0x74bc('0x20')]['id']},'include':[{'model':db[_0x74bc('0x21')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x74bc('0x22')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x74bc('0x23')],'as':_0x74bc('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x74bc('0x25')],'as':_0x74bc('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x74bc('0x27')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x74bc('0x28')],'as':_0x74bc('0x29'),'attributes':['id'],'raw':!![]}]})[_0x74bc('0xa')](function(_0x48761f){if(_0x48761f){_0x213fb5=_0x48761f;_0x230ceb[_0x4af99a](util[_0x74bc('0x1a')](_0x74bc('0x1c'),_0x48761f[_0x74bc('0x4')]));var _0x2783ef=[];switch(_0x48761f['role']){case _0x74bc('0x2a'):_0x230ceb[_0x4af99a](_0x74bc('0x2b'));_0x230ceb[_0x4af99a](_0x74bc('0x2c'));if(queryQueues[_0x74bc('0x2d')]('include')){delete queryQueues[_0x74bc('0x2e')];}_0x2783ef[_0x74bc('0x2f')](db[_0x74bc('0x30')]['findAll'](queryQueues));_0x2783ef[_0x74bc('0x2f')](db[_0x74bc('0x31')][_0x74bc('0x12')](queryQueues));_0x2783ef[_0x74bc('0x2f')](db[_0x74bc('0x32')][_0x74bc('0x12')](queryQueues));_0x2783ef[_0x74bc('0x2f')](db['SmsQueue']['findAll'](queryQueues));_0x2783ef[_0x74bc('0x2f')](db[_0x74bc('0x33')][_0x74bc('0x12')](queryQueues));_0x2783ef[_0x74bc('0x2f')](db[_0x74bc('0x34')][_0x74bc('0x12')](queryQueues));_0x2783ef[_0x74bc('0x2f')](db[_0x74bc('0x35')][_0x74bc('0x12')](queryQueues));_0x2783ef[_0x74bc('0x2f')](db[_0x74bc('0x3')]['findAll'](queryTelephones));_0x2783ef['push'](db['Trunk']['findAll'](queryTrunks));_0x2783ef['push'](db[_0x74bc('0x36')][_0x74bc('0x12')](queryCampaigns));_0x2783ef[_0x74bc('0x2f')](db[_0x74bc('0x3')]['findAll'](queryAgents));break;case'user':_0x230ceb[_0x4af99a](_0x74bc('0x2b'));_0x230ceb[_0x4af99a](_0x74bc('0x2c'));_0x2783ef[_0x74bc('0x2f')](getAssociatedResources(_0x74bc('0xc'),_0x48761f[_0x74bc('0x1f')],_0x74bc('0x30')));_0x2783ef[_0x74bc('0x2f')](getAssociatedResources(_0x74bc('0xd'),_0x48761f[_0x74bc('0x1f')],_0x74bc('0x31')));_0x2783ef[_0x74bc('0x2f')](getAssociatedResources(_0x74bc('0xe'),_0x48761f[_0x74bc('0x1f')],_0x74bc('0x32')));_0x2783ef[_0x74bc('0x2f')](getAssociatedResources(_0x74bc('0xf'),_0x48761f['userProfileId'],_0x74bc('0x37')));_0x2783ef['push'](getAssociatedResources('MailQueues',_0x48761f[_0x74bc('0x1f')],_0x74bc('0x33')));_0x2783ef[_0x74bc('0x2f')](getAssociatedResources(_0x74bc('0x11'),_0x48761f[_0x74bc('0x1f')],'OpenchannelQueue'));_0x2783ef[_0x74bc('0x2f')](getAssociatedResources(_0x74bc('0x38'),_0x48761f[_0x74bc('0x1f')],_0x74bc('0x35')));_0x2783ef[_0x74bc('0x2f')](getAssociatedResources(_0x74bc('0x13'),_0x48761f[_0x74bc('0x1f')],_0x74bc('0x3')));_0x2783ef[_0x74bc('0x2f')](getAssociatedResources('Trunks',_0x48761f[_0x74bc('0x1f')],_0x74bc('0x39')));_0x2783ef[_0x74bc('0x2f')](getAssociatedResources(_0x74bc('0x14'),_0x48761f[_0x74bc('0x1f')],'Campaign'));_0x2783ef[_0x74bc('0x2f')](db['User'][_0x74bc('0x12')](queryAgents));break;case _0x74bc('0x6'):_0x230ceb[_0x4af99a](_0x74bc('0x2b'));_0x230ceb[_0x4af99a](_0x74bc('0x2c'));_0x2783ef[_0x74bc('0x2f')](_0x48761f[_0x74bc('0x3a')]({'attributes':['id','name']}));_0x2783ef['push'](_0x48761f['getChatQueues']({'attributes':['id',_0x74bc('0x4')]}));_0x2783ef[_0x74bc('0x2f')](_0x48761f[_0x74bc('0x3b')]({'attributes':['id',_0x74bc('0x4')]}));_0x2783ef[_0x74bc('0x2f')](_0x48761f['getSmsQueues']({'attributes':['id',_0x74bc('0x4')]}));_0x2783ef[_0x74bc('0x2f')](_0x48761f[_0x74bc('0x3c')]({'attributes':['id',_0x74bc('0x4')]}));_0x2783ef[_0x74bc('0x2f')](_0x48761f[_0x74bc('0x3d')]({'attributes':['id',_0x74bc('0x4')]}));_0x2783ef[_0x74bc('0x2f')](_0x48761f[_0x74bc('0x3e')]({'attributes':['id',_0x74bc('0x4')]}));break;}return BPromise[_0x74bc('0x3f')](_0x2783ef);}})[_0x74bc('0xa')](function(_0x48db69){if(_0x48db69&&_0x48db69['length']){for(var _0xb0ebf=0x0;_0xb0ebf<_0x48db69['length'];_0xb0ebf+=0x1){for(var _0x50e6eb=0x0;_0x50e6eb<_0x48db69[_0xb0ebf][_0x74bc('0x1b')];_0x50e6eb+=0x1){switch(_0xb0ebf){case 0x0:joinOrLeaveQueues(_0x230ceb,_0x4af99a,'voice',_0x48db69[_0xb0ebf][_0x50e6eb]);break;case 0x1:joinOrLeaveQueues(_0x230ceb,_0x4af99a,'chat',_0x48db69[_0xb0ebf][_0x50e6eb]);break;case 0x2:joinOrLeaveQueues(_0x230ceb,_0x4af99a,_0x74bc('0x40'),_0x48db69[_0xb0ebf][_0x50e6eb]);break;case 0x3:joinOrLeaveQueues(_0x230ceb,_0x4af99a,_0x74bc('0x41'),_0x48db69[_0xb0ebf][_0x50e6eb]);break;case 0x4:joinOrLeaveQueues(_0x230ceb,_0x4af99a,_0x74bc('0x42'),_0x48db69[_0xb0ebf][_0x50e6eb]);break;case 0x5:joinOrLeaveQueues(_0x230ceb,_0x4af99a,_0x74bc('0x43'),_0x48db69[_0xb0ebf][_0x50e6eb]);break;case 0x6:joinOrLeaveQueues(_0x230ceb,_0x4af99a,_0x74bc('0x44'),_0x48db69[_0xb0ebf][_0x50e6eb]);break;case 0x7:if(_0x213fb5[_0x74bc('0x5')]!=='agent')_0x230ceb[_0x4af99a](util[_0x74bc('0x1a')](_0x74bc('0x45'),_0x48db69[_0xb0ebf][_0x50e6eb]['name']));break;case 0x8:if(_0x213fb5[_0x74bc('0x5')]!==_0x74bc('0x6'))_0x230ceb[_0x4af99a](util[_0x74bc('0x1a')](_0x74bc('0x46'),_0x48db69[_0xb0ebf][_0x50e6eb][_0x74bc('0x4')]));break;case 0x9:if(_0x213fb5[_0x74bc('0x5')]!==_0x74bc('0x6'))_0x230ceb[_0x4af99a](util[_0x74bc('0x1a')]('campaign:%s:%s',_0x48db69[_0xb0ebf][_0x50e6eb][_0x74bc('0x19')],_0x48db69[_0xb0ebf][_0x50e6eb][_0x74bc('0x4')]));break;case 0xa:_0x230ceb[_0x4af99a](util[_0x74bc('0x1a')](_0x74bc('0x1c'),_0x48db69[_0xb0ebf][_0x50e6eb][_0x74bc('0x4')]));break;}}}}})[_0x74bc('0xa')](function(){if(_0x4af99a==='leave'){var _0x4f5269=_[_0x74bc('0x17')](_0x213fb5['ChatInteractions'],'id');return _0x213fb5[_0x74bc('0x47')](_0x4f5269)['then'](function(){for(var _0x27c2fd=0x0;_0x27c2fd<_0x4f5269['length'];_0x27c2fd+=0x1){_0x5cb165[_0x74bc('0x48')](_0x74bc('0x49'),{'ChatInteractionId':Number(_0x4f5269[_0x27c2fd]),'UserId':Number(_0x213fb5['id'])});}});}})['then'](function(){if(_0x4af99a===_0x74bc('0x4a')){var _0x492641=_[_0x74bc('0x17')](_0x213fb5['MailInteractions'],'id');return _0x213fb5[_0x74bc('0x4b')](_0x492641)['then'](function(){for(var _0x2414e3=0x0;_0x2414e3<_0x492641[_0x74bc('0x1b')];_0x2414e3+=0x1){_0x5cb165['emit'](_0x74bc('0x4c'),{'MailInteractionId':Number(_0x492641[_0x2414e3]),'UserId':Number(_0x213fb5['id'])});}});}})[_0x74bc('0xa')](function(){if(_0x4af99a===_0x74bc('0x4a')){var _0x241c8b=_[_0x74bc('0x17')](_0x213fb5['FaxInteractions'],'id');return _0x213fb5[_0x74bc('0x4d')](_0x241c8b)['then'](function(){for(var _0x5e8bad=0x0;_0x5e8bad<_0x241c8b[_0x74bc('0x1b')];_0x5e8bad+=0x1){_0x5cb165['emit'](_0x74bc('0x4e'),{'FaxInteractionId':Number(_0x241c8b[_0x5e8bad]),'UserId':Number(_0x213fb5['id'])});}});}})['then'](function(){if(_0x4af99a===_0x74bc('0x4a')){var _0x3803f3=_[_0x74bc('0x17')](_0x213fb5['SmsInteractions'],'id');return _0x213fb5[_0x74bc('0x4f')](_0x3803f3)[_0x74bc('0xa')](function(){for(var _0xe9a03b=0x0;_0xe9a03b<_0x3803f3[_0x74bc('0x1b')];_0xe9a03b+=0x1){_0x5cb165[_0x74bc('0x48')](_0x74bc('0x50'),{'SmsInteractionId':Number(_0x3803f3[_0xe9a03b]),'UserId':Number(_0x213fb5['id'])});}});}})[_0x74bc('0xa')](function(){if(_0x4af99a===_0x74bc('0x4a')){var _0x1d1c7b=_['map'](_0x213fb5[_0x74bc('0x51')],'id');return _0x213fb5[_0x74bc('0x52')](_0x1d1c7b)['then'](function(){for(var _0x3e2795=0x0;_0x3e2795<_0x1d1c7b['length'];_0x3e2795+=0x1){_0x5cb165[_0x74bc('0x48')](_0x74bc('0x53'),{'OpenchannelInteractionId':Number(_0x1d1c7b[_0x3e2795]),'UserId':Number(_0x213fb5['id'])});}});}})[_0x74bc('0xa')](function(){if(_0x4af99a===_0x74bc('0x4a')){var _0x12d8c2=_[_0x74bc('0x17')](_0x213fb5['WhatsappInteractions'],'id');return _0x213fb5[_0x74bc('0x54')](_0x12d8c2)[_0x74bc('0xa')](function(){for(var _0x5d9560=0x0;_0x5d9560<_0x12d8c2[_0x74bc('0x1b')];_0x5d9560+=0x1){_0x5cb165[_0x74bc('0x48')](_0x74bc('0x55'),{'WhatsappInteractionId':Number(_0x12d8c2[_0x5d9560]),'UserId':Number(_0x213fb5['id'])});}});}})[_0x74bc('0x56')](function(_0x413fc0){_0x230ceb[_0x74bc('0x57')](_0x413fc0);});}}function onDisconnect(_0x42f809,_0x4a32a6){joinOrLeave(_0x42f809,_0x74bc('0x4a'),_0x4a32a6);}function onConnect(_0x1ac581){joinOrLeave(_0x1ac581,_0x74bc('0x58'));}exports[_0x74bc('0x59')]=function(_0x3dadfa){_0x3dadfa['on']('connection',function(_0x1fb917){_0x1fb917[_0x74bc('0x5a')](0x0);_0x1fb917[_0x74bc('0x5b')]=_0x1fb917[_0x74bc('0x5c')]['connection'][_0x74bc('0x5d')]+':'+_0x1fb917[_0x74bc('0x5c')]['connection'][_0x74bc('0x5e')];_0x1fb917[_0x74bc('0x5f')]=new Date();_0x1fb917['log']=function(_0x417799){console[_0x74bc('0x57')]('SocketIO\x20'+_0x1fb917[_0x74bc('0x60')][_0x74bc('0x4')]+'['+_0x1fb917['address']+']',_0x417799);};_0x1fb917['on'](_0x74bc('0x61'),function(){onDisconnect(_0x1fb917,_0x3dadfa);_0x1fb917[_0x74bc('0x57')](_0x74bc('0x62'));});onConnect(_0x1fb917);_0x1fb917[_0x74bc('0x57')]('CONNECTED');});}; \ No newline at end of file +var _0xc48d=['then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','push','ChatQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','voice:outbound','VoiceQueue','MailQueues','OpenchannelQueue','WhatsappQueues','Telephones','getVoiceQueues','getChatQueues','getSmsQueues','getOpenchannelQueues','all','chat','fax','sms','mail','openchannel','trunk:%s','ChatInteractions','removeChatInteractions','leave','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','emit','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','./environment','name','Agents','User','role','agent','telephone','type','UserProfileSection','findOne'];(function(_0x14f1e0,_0x34363d){var _0x55de8d=function(_0x4a6ba2){while(--_0x4a6ba2){_0x14f1e0['push'](_0x14f1e0['shift']());}};_0x55de8d(++_0x34363d);}(_0xc48d,0x11a));var _0xdc48=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0xc48d[_0x5d4f12];return _0x4eb577;};'use strict';var _=require(_0xdc48('0x0'));var util=require(_0xdc48('0x1'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require(_0xdc48('0x2'));var queryQueues={'attributes':['id',_0xdc48('0x3')],'include':[{'as':_0xdc48('0x4'),'model':db[_0xdc48('0x5')],'attributes':['id',_0xdc48('0x3'),_0xdc48('0x6')],'raw':!![],'where':{'role':_0xdc48('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xdc48('0x3')],'where':{'role':_0xdc48('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xdc48('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0xdc48('0x3')],'where':{'role':_0xdc48('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xdc48('0x3'),_0xdc48('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x1e6657,_0x2439ad,_0x44d7b8){return db[_0xdc48('0xa')][_0xdc48('0xb')]({'where':{'name':_0x1e6657,'userProfileId':_0x2439ad},'raw':!![]})[_0xdc48('0xc')](function(_0xfb6101){if(_0xfb6101){if(_0xfb6101[_0xdc48('0xd')]){switch(_0x1e6657){case _0xdc48('0xe'):case _0xdc48('0xf'):case _0xdc48('0x10'):case _0xdc48('0x11'):case'MailQueues':case _0xdc48('0x12'):case'WhatsappQueues':return db[_0x44d7b8][_0xdc48('0x13')](queryQueues);case'Telephones':return db[_0x44d7b8][_0xdc48('0x13')](queryTelephones);case _0xdc48('0x14'):return db[_0x44d7b8][_0xdc48('0x13')](queryTrunks);case _0xdc48('0x15'):return db[_0x44d7b8]['findAll'](queryCampaigns);}}else{return db[_0xdc48('0x16')][_0xdc48('0x13')]({'attributes':[_0xdc48('0x17')],'where':{'sectionId':_0xfb6101['id']},'raw':!![]})[_0xdc48('0xc')](function(_0x10ce35){if(_0x10ce35){var _0x2418ae={'where':{'id':_[_0xdc48('0x18')](_0x10ce35,_0xdc48('0x17'))},'raw':!![]};switch(_0x44d7b8){case _0xdc48('0x5'):_0x2418ae[_0xdc48('0x19')][_0xdc48('0x6')]=_0xdc48('0x8');break;case _0xdc48('0x1a'):_0x2418ae[_0xdc48('0x19')][_0xdc48('0x9')]='ivr';break;}return db[_0x44d7b8]['findAll'](_0x2418ae);}else{return[];}});}}else{return[];}})['then'](function(_0x2b1e2c){return _0x2b1e2c;});}function joinOrLeaveQueues(_0x4b9ef1,_0x76077e,_0x504d24,_0x35c20c){_0x4b9ef1[_0x76077e](util[_0xdc48('0x1b')](_0xdc48('0x1c'),_0x504d24,_0x35c20c[_0xdc48('0x3')]));if(_0x35c20c[_0xdc48('0x4')]){for(var _0x53eeaf=0x0;_0x53eeaf<_0x35c20c[_0xdc48('0x4')][_0xdc48('0x1d')];_0x53eeaf+=0x1){_0x4b9ef1[_0x76077e](util[_0xdc48('0x1b')](_0xdc48('0x1e'),_0x35c20c[_0xdc48('0x4')][_0x53eeaf][_0xdc48('0x3')]));}}}function joinOrLeave(_0x33f038,_0x2e2f08,_0x41b83d){var _0x384581;if(_0x33f038[_0xdc48('0x1f')][_0xdc48('0x20')]['id']){db[_0xdc48('0x5')]['find']({'attributes':['id',_0xdc48('0x3'),_0xdc48('0x6'),_0xdc48('0x21')],'where':{'id':_0x33f038[_0xdc48('0x1f')][_0xdc48('0x20')]['id']},'include':[{'model':db[_0xdc48('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xdc48('0x23')],'as':_0xdc48('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xdc48('0x25')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xdc48('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xdc48('0x27')],'as':_0xdc48('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xdc48('0x29')],'as':_0xdc48('0x2a'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x38d36e){if(_0x38d36e){_0x384581=_0x38d36e;_0x33f038[_0x2e2f08](util[_0xdc48('0x1b')]('user:%s',_0x38d36e[_0xdc48('0x3')]));var _0x12d8ce=[];switch(_0x38d36e[_0xdc48('0x6')]){case _0xdc48('0x2b'):_0x33f038[_0x2e2f08](_0xdc48('0x2c'));_0x33f038[_0x2e2f08]('voice:outbound');if(queryQueues[_0xdc48('0x2d')](_0xdc48('0x2e'))){delete queryQueues[_0xdc48('0x2e')];}_0x12d8ce[_0xdc48('0x2f')](db['VoiceQueue']['findAll'](queryQueues));_0x12d8ce[_0xdc48('0x2f')](db[_0xdc48('0x30')]['findAll'](queryQueues));_0x12d8ce[_0xdc48('0x2f')](db['FaxQueue'][_0xdc48('0x13')](queryQueues));_0x12d8ce['push'](db[_0xdc48('0x31')]['findAll'](queryQueues));_0x12d8ce[_0xdc48('0x2f')](db[_0xdc48('0x32')][_0xdc48('0x13')](queryQueues));_0x12d8ce['push'](db['OpenchannelQueue'][_0xdc48('0x13')](queryQueues));_0x12d8ce[_0xdc48('0x2f')](db[_0xdc48('0x33')]['findAll'](queryQueues));_0x12d8ce['push'](db[_0xdc48('0x5')][_0xdc48('0x13')](queryTelephones));_0x12d8ce[_0xdc48('0x2f')](db[_0xdc48('0x34')][_0xdc48('0x13')](queryTrunks));_0x12d8ce['push'](db[_0xdc48('0x1a')]['findAll'](queryCampaigns));_0x12d8ce[_0xdc48('0x2f')](db['User'][_0xdc48('0x13')](queryAgents));break;case'user':_0x33f038[_0x2e2f08]('voice:inbound');_0x33f038[_0x2e2f08](_0xdc48('0x35'));_0x12d8ce[_0xdc48('0x2f')](getAssociatedResources(_0xdc48('0xe'),_0x38d36e['userProfileId'],_0xdc48('0x36')));_0x12d8ce[_0xdc48('0x2f')](getAssociatedResources(_0xdc48('0xf'),_0x38d36e[_0xdc48('0x21')],_0xdc48('0x30')));_0x12d8ce[_0xdc48('0x2f')](getAssociatedResources('FaxQueues',_0x38d36e[_0xdc48('0x21')],'FaxQueue'));_0x12d8ce[_0xdc48('0x2f')](getAssociatedResources(_0xdc48('0x11'),_0x38d36e[_0xdc48('0x21')],'SmsQueue'));_0x12d8ce['push'](getAssociatedResources(_0xdc48('0x37'),_0x38d36e[_0xdc48('0x21')],_0xdc48('0x32')));_0x12d8ce[_0xdc48('0x2f')](getAssociatedResources(_0xdc48('0x12'),_0x38d36e[_0xdc48('0x21')],_0xdc48('0x38')));_0x12d8ce['push'](getAssociatedResources(_0xdc48('0x39'),_0x38d36e[_0xdc48('0x21')],_0xdc48('0x33')));_0x12d8ce[_0xdc48('0x2f')](getAssociatedResources(_0xdc48('0x3a'),_0x38d36e[_0xdc48('0x21')],'User'));_0x12d8ce['push'](getAssociatedResources(_0xdc48('0x14'),_0x38d36e[_0xdc48('0x21')],_0xdc48('0x34')));_0x12d8ce[_0xdc48('0x2f')](getAssociatedResources('IvrCampaigns',_0x38d36e[_0xdc48('0x21')],_0xdc48('0x1a')));_0x12d8ce[_0xdc48('0x2f')](db[_0xdc48('0x5')][_0xdc48('0x13')](queryAgents));break;case _0xdc48('0x7'):_0x33f038[_0x2e2f08](_0xdc48('0x2c'));_0x33f038[_0x2e2f08]('voice:outbound');_0x12d8ce[_0xdc48('0x2f')](_0x38d36e[_0xdc48('0x3b')]({'attributes':['id',_0xdc48('0x3')]}));_0x12d8ce[_0xdc48('0x2f')](_0x38d36e[_0xdc48('0x3c')]({'attributes':['id',_0xdc48('0x3')]}));_0x12d8ce[_0xdc48('0x2f')](_0x38d36e['getFaxQueues']({'attributes':['id',_0xdc48('0x3')]}));_0x12d8ce[_0xdc48('0x2f')](_0x38d36e[_0xdc48('0x3d')]({'attributes':['id',_0xdc48('0x3')]}));_0x12d8ce[_0xdc48('0x2f')](_0x38d36e['getMailQueues']({'attributes':['id',_0xdc48('0x3')]}));_0x12d8ce[_0xdc48('0x2f')](_0x38d36e[_0xdc48('0x3e')]({'attributes':['id',_0xdc48('0x3')]}));_0x12d8ce[_0xdc48('0x2f')](_0x38d36e['getWhatsappQueues']({'attributes':['id',_0xdc48('0x3')]}));break;}return BPromise[_0xdc48('0x3f')](_0x12d8ce);}})['then'](function(_0x5c0f74){if(_0x5c0f74&&_0x5c0f74[_0xdc48('0x1d')]){for(var _0x5951e1=0x0;_0x5951e1<_0x5c0f74['length'];_0x5951e1+=0x1){for(var _0x43b79b=0x0;_0x43b79b<_0x5c0f74[_0x5951e1][_0xdc48('0x1d')];_0x43b79b+=0x1){switch(_0x5951e1){case 0x0:joinOrLeaveQueues(_0x33f038,_0x2e2f08,'voice',_0x5c0f74[_0x5951e1][_0x43b79b]);break;case 0x1:joinOrLeaveQueues(_0x33f038,_0x2e2f08,_0xdc48('0x40'),_0x5c0f74[_0x5951e1][_0x43b79b]);break;case 0x2:joinOrLeaveQueues(_0x33f038,_0x2e2f08,_0xdc48('0x41'),_0x5c0f74[_0x5951e1][_0x43b79b]);break;case 0x3:joinOrLeaveQueues(_0x33f038,_0x2e2f08,_0xdc48('0x42'),_0x5c0f74[_0x5951e1][_0x43b79b]);break;case 0x4:joinOrLeaveQueues(_0x33f038,_0x2e2f08,_0xdc48('0x43'),_0x5c0f74[_0x5951e1][_0x43b79b]);break;case 0x5:joinOrLeaveQueues(_0x33f038,_0x2e2f08,_0xdc48('0x44'),_0x5c0f74[_0x5951e1][_0x43b79b]);break;case 0x6:joinOrLeaveQueues(_0x33f038,_0x2e2f08,'whatsapp',_0x5c0f74[_0x5951e1][_0x43b79b]);break;case 0x7:if(_0x384581['role']!==_0xdc48('0x7'))_0x33f038[_0x2e2f08](util[_0xdc48('0x1b')]('telephone:%s',_0x5c0f74[_0x5951e1][_0x43b79b][_0xdc48('0x3')]));break;case 0x8:if(_0x384581[_0xdc48('0x6')]!=='agent')_0x33f038[_0x2e2f08](util[_0xdc48('0x1b')](_0xdc48('0x45'),_0x5c0f74[_0x5951e1][_0x43b79b][_0xdc48('0x3')]));break;case 0x9:if(_0x384581[_0xdc48('0x6')]!==_0xdc48('0x7'))_0x33f038[_0x2e2f08](util['format']('campaign:%s:%s',_0x5c0f74[_0x5951e1][_0x43b79b]['type'],_0x5c0f74[_0x5951e1][_0x43b79b][_0xdc48('0x3')]));break;case 0xa:_0x33f038[_0x2e2f08](util['format'](_0xdc48('0x1e'),_0x5c0f74[_0x5951e1][_0x43b79b][_0xdc48('0x3')]));break;}}}}})[_0xdc48('0xc')](function(){if(_0x2e2f08==='leave'){var _0x8a71c2=_[_0xdc48('0x18')](_0x384581[_0xdc48('0x46')],'id');return _0x384581[_0xdc48('0x47')](_0x8a71c2)[_0xdc48('0xc')](function(){for(var _0x5d141b=0x0;_0x5d141b<_0x8a71c2[_0xdc48('0x1d')];_0x5d141b+=0x1){_0x41b83d['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x8a71c2[_0x5d141b]),'UserId':Number(_0x384581['id'])});}});}})[_0xdc48('0xc')](function(){if(_0x2e2f08===_0xdc48('0x48')){var _0x493cdd=_[_0xdc48('0x18')](_0x384581[_0xdc48('0x24')],'id');return _0x384581[_0xdc48('0x49')](_0x493cdd)[_0xdc48('0xc')](function(){for(var _0x56b8fd=0x0;_0x56b8fd<_0x493cdd[_0xdc48('0x1d')];_0x56b8fd+=0x1){_0x41b83d['emit'](_0xdc48('0x4a'),{'MailInteractionId':Number(_0x493cdd[_0x56b8fd]),'UserId':Number(_0x384581['id'])});}});}})[_0xdc48('0xc')](function(){if(_0x2e2f08===_0xdc48('0x48')){var _0x41cf4f=_[_0xdc48('0x18')](_0x384581[_0xdc48('0x4b')],'id');return _0x384581[_0xdc48('0x4c')](_0x41cf4f)[_0xdc48('0xc')](function(){for(var _0x51d184=0x0;_0x51d184<_0x41cf4f['length'];_0x51d184+=0x1){_0x41b83d[_0xdc48('0x4d')](_0xdc48('0x4e'),{'FaxInteractionId':Number(_0x41cf4f[_0x51d184]),'UserId':Number(_0x384581['id'])});}});}})[_0xdc48('0xc')](function(){if(_0x2e2f08===_0xdc48('0x48')){var _0x20c626=_[_0xdc48('0x18')](_0x384581['SmsInteractions'],'id');return _0x384581[_0xdc48('0x4f')](_0x20c626)[_0xdc48('0xc')](function(){for(var _0x26734c=0x0;_0x26734c<_0x20c626[_0xdc48('0x1d')];_0x26734c+=0x1){_0x41b83d[_0xdc48('0x4d')](_0xdc48('0x50'),{'SmsInteractionId':Number(_0x20c626[_0x26734c]),'UserId':Number(_0x384581['id'])});}});}})[_0xdc48('0xc')](function(){if(_0x2e2f08==='leave'){var _0x49fb6c=_[_0xdc48('0x18')](_0x384581['OpenchannelInteractions'],'id');return _0x384581[_0xdc48('0x51')](_0x49fb6c)[_0xdc48('0xc')](function(){for(var _0x49ca88=0x0;_0x49ca88<_0x49fb6c[_0xdc48('0x1d')];_0x49ca88+=0x1){_0x41b83d[_0xdc48('0x4d')](_0xdc48('0x52'),{'OpenchannelInteractionId':Number(_0x49fb6c[_0x49ca88]),'UserId':Number(_0x384581['id'])});}});}})[_0xdc48('0xc')](function(){if(_0x2e2f08==='leave'){var _0x3da22b=_[_0xdc48('0x18')](_0x384581[_0xdc48('0x2a')],'id');return _0x384581['removeWhatsappInteractions'](_0x3da22b)[_0xdc48('0xc')](function(){for(var _0x4c7869=0x0;_0x4c7869<_0x3da22b[_0xdc48('0x1d')];_0x4c7869+=0x1){_0x41b83d['emit'](_0xdc48('0x53'),{'WhatsappInteractionId':Number(_0x3da22b[_0x4c7869]),'UserId':Number(_0x384581['id'])});}});}})[_0xdc48('0x54')](function(_0x4f8363){_0x33f038[_0xdc48('0x55')](_0x4f8363);});}}function onDisconnect(_0x3ec17b,_0x3dfa72){joinOrLeave(_0x3ec17b,_0xdc48('0x48'),_0x3dfa72);}function onConnect(_0x20606e){joinOrLeave(_0x20606e,_0xdc48('0x56'));}exports['default']=function(_0x1be842){_0x1be842['on'](_0xdc48('0x57'),function(_0x491597){_0x491597[_0xdc48('0x58')](0x0);_0x491597[_0xdc48('0x59')]=_0x491597[_0xdc48('0x5a')][_0xdc48('0x57')][_0xdc48('0x5b')]+':'+_0x491597[_0xdc48('0x5a')][_0xdc48('0x57')]['remotePort'];_0x491597[_0xdc48('0x5c')]=new Date();_0x491597['log']=function(_0x46fc8f){console[_0xdc48('0x55')](_0xdc48('0x5d')+_0x491597[_0xdc48('0x5e')]['name']+'['+_0x491597[_0xdc48('0x59')]+']',_0x46fc8f);};_0x491597['on'](_0xdc48('0x5f'),function(){onDisconnect(_0x491597,_0x1be842);_0x491597[_0xdc48('0x55')](_0xdc48('0x60'));});onConnect(_0x491597);_0x491597[_0xdc48('0x55')](_0xdc48('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 20660e7..ebb9b20 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 _0x0f8d=['find','fullname','email','internal','default','length','hasOwnProperty','model','callback','util','../../mysqldb','jayson/promise','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','WhatsappInteraction','Whatsapp','afterUpdate','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','channel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','QueryTypes','contact','UserId','interface','format','SIP/%s','agent','outgoingmessage','AfterCreateMessage','get','motionChannel','opened','name','AfterCreate','changed','closed','substatus','SELECT','AfterUpdate'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x0f8d,0x1b9));var _0xd0f8=function(_0x53a31b,_0x541c91){_0x53a31b=_0x53a31b-0x0;var _0x54fbd1=_0x0f8d[_0x53a31b];return _0x54fbd1;};'use strict';var util=require(_0xd0f8('0x0'));var db=require(_0xd0f8('0x1'))['db'];var jayson=require(_0xd0f8('0x2'));var logger=require('../logger')(_0xd0f8('0x3'));var client=jayson[_0xd0f8('0x4')][_0xd0f8('0x5')]({'port':0x232a});var triggers=[{'channel':_0xd0f8('0x6'),'model':_0xd0f8('0x7'),'event':_0xd0f8('0x8'),'condition':_0xd0f8('0x9'),'callback':afterCreate},{'channel':_0xd0f8('0x6'),'model':_0xd0f8('0x7'),'event':'afterUpdate','condition':_0xd0f8('0xa'),'callback':afterUpdate},{'channel':'Chat','model':_0xd0f8('0xb'),'event':'afterCreate','condition':_0xd0f8('0xc'),'callback':afterCreateMessage},{'channel':'Chat','model':_0xd0f8('0xd'),'event':_0xd0f8('0x8'),'condition':_0xd0f8('0xc'),'callback':afterCreateOfflineMessage},{'channel':'Sms','model':'SmsInteraction','event':_0xd0f8('0x8'),'condition':_0xd0f8('0x9'),'callback':afterCreate},{'channel':_0xd0f8('0xe'),'model':_0xd0f8('0xf'),'event':'afterUpdate','condition':_0xd0f8('0xa'),'callback':afterUpdate},{'channel':_0xd0f8('0xe'),'model':_0xd0f8('0x10'),'event':_0xd0f8('0x8'),'condition':_0xd0f8('0xc'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0xd0f8('0x11'),'event':'afterCreate','condition':_0xd0f8('0x9'),'callback':afterCreate},{'channel':_0xd0f8('0x12'),'model':_0xd0f8('0x11'),'event':_0xd0f8('0x13'),'condition':_0xd0f8('0xa'),'callback':afterUpdate},{'channel':_0xd0f8('0x12'),'model':_0xd0f8('0x14'),'event':_0xd0f8('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xd0f8('0x15'),'model':'FaxInteraction','event':'afterCreate','condition':_0xd0f8('0x9'),'callback':afterCreate},{'channel':_0xd0f8('0x15'),'model':_0xd0f8('0x16'),'event':'afterUpdate','condition':_0xd0f8('0xa'),'callback':afterUpdate},{'channel':_0xd0f8('0x15'),'model':'FaxMessage','event':_0xd0f8('0x8'),'condition':_0xd0f8('0xc'),'callback':afterCreateMessage},{'channel':_0xd0f8('0x17'),'model':_0xd0f8('0x18'),'event':_0xd0f8('0x8'),'condition':_0xd0f8('0x9'),'callback':afterCreate},{'channel':_0xd0f8('0x17'),'model':_0xd0f8('0x18'),'event':_0xd0f8('0x13'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':_0xd0f8('0x19'),'event':_0xd0f8('0x8'),'condition':_0xd0f8('0xc'),'callback':afterCreateMessage},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0xd0f8('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0xd0f8('0x13'),'condition':_0xd0f8('0xa'),'callback':afterUpdate},{'channel':'Openchannel','model':'OpenchannelMessage','event':_0xd0f8('0x8'),'condition':_0xd0f8('0xc'),'callback':afterCreateMessage}];function request(_0x503029){return client[_0xd0f8('0x1a')](_0xd0f8('0x1b'),_0x503029)[_0xd0f8('0x1c')](function(_0x4f283d){logger[_0xd0f8('0x1d')](_0xd0f8('0x1e'),_0xd0f8('0x1b'),_0x4f283d);if(_0x4f283d[_0xd0f8('0x1f')]){if(_0x4f283d[_0xd0f8('0x1f')][_0xd0f8('0x20')]===0x1f4){logger['error'](_0xd0f8('0x1e'),_0xd0f8('0x1b'),_0x4f283d[_0xd0f8('0x1f')]);}}})[_0xd0f8('0x21')](function(_0xbc5249){logger[_0xd0f8('0x1f')]('Trigger,\x20%s',_0xd0f8('0x1b'),_0xbc5249);});}function afterCreateMessage(_0x46a32e){return function(_0x1d0798){_0x1d0798=_0x1d0798['get']({'plain':!![]});_0x1d0798[_0xd0f8('0x22')]=_0x46a32e;_0x1d0798['motionChannel']=_0x46a32e;_0x1d0798[_0xd0f8('0x23')]=_0x1d0798[_0xd0f8('0x24')];Promise[_0xd0f8('0x25')]()[_0xd0f8('0x1c')](function(){if(typeof _0x1d0798[_0xd0f8('0x26')]===_0xd0f8('0x27'))return null;var _0x252b42=_0xd0f8('0x28')+_0x1d0798[_0xd0f8('0x26')];return db[_0xd0f8('0x29')][_0xd0f8('0x2a')](_0x252b42,{'type':db[_0xd0f8('0x2b')][_0xd0f8('0x2c')]['SELECT'],'raw':!![]});})[_0xd0f8('0x1c')](function(_0x5076bb){if(_0x5076bb){_0x1d0798[_0xd0f8('0x2d')]=_0x5076bb[0x0];}if(typeof _0x1d0798[_0xd0f8('0x2e')]==='undefined')return;return getAgent(_0x1d0798[_0xd0f8('0x2e')]);})[_0xd0f8('0x1c')](function(_0x2311a2){if(_0x2311a2){_0x1d0798[_0xd0f8('0x2f')]=util[_0xd0f8('0x30')](_0xd0f8('0x31'),_0x2311a2['name']);_0x1d0798[_0xd0f8('0x32')]=_0x2311a2;_0x1d0798[_0xd0f8('0x22')]=_0x46a32e;return request({'event':'incomingmessage','message':_0x1d0798});}else{return request({'event':_0xd0f8('0x33'),'message':_0x1d0798});}})[_0xd0f8('0x21')](function(_0x47fb83){logger['error'](_0xd0f8('0x1e'),_0xd0f8('0x34'),_0x47fb83);});};}function afterCreateOfflineMessage(_0x6ce9c5){return function(_0x4c0bb8){_0x4c0bb8=_0x4c0bb8[_0xd0f8('0x35')]({'plain':!![]});_0x4c0bb8[_0xd0f8('0x22')]=_0x6ce9c5;_0x4c0bb8[_0xd0f8('0x36')]=_0x6ce9c5;_0x4c0bb8[_0xd0f8('0x23')]='offlineMessage';return request({'event':_0x4c0bb8[_0xd0f8('0x23')],'message':_0x4c0bb8});};}function afterCreate(_0x1de8dc,_0x108ffe){return function(_0x49f61d){_0x49f61d=_0x49f61d[_0xd0f8('0x35')]({'plain':!![]});_0x49f61d[_0xd0f8('0x22')]=_0x1de8dc;_0x49f61d['motionChannel']=_0x1de8dc;_0x49f61d[_0xd0f8('0x23')]=_0xd0f8('0x37');Promise[_0xd0f8('0x25')]()[_0xd0f8('0x1c')](function(){var _0x17ad36=_0xd0f8('0x28')+_0x49f61d[_0xd0f8('0x26')];return db[_0xd0f8('0x29')][_0xd0f8('0x2a')](_0x17ad36,{'type':db[_0xd0f8('0x2b')]['QueryTypes']['SELECT'],'raw':!![]});})[_0xd0f8('0x1c')](function(_0x4aa852){if(_0x4aa852){_0x49f61d[_0xd0f8('0x2d')]=_0x4aa852[0x0];}if(typeof _0x49f61d[_0xd0f8('0x2e')]===_0xd0f8('0x27'))return;return getAgent(_0x49f61d[_0xd0f8('0x2e')]);})[_0xd0f8('0x1c')](function(_0x198085){if(_0x198085){_0x49f61d[_0xd0f8('0x2f')]=util[_0xd0f8('0x30')](_0xd0f8('0x31'),_0x198085[_0xd0f8('0x38')]);_0x49f61d[_0xd0f8('0x32')]=_0x198085;}return request({'event':_0x108ffe,'message':_0x49f61d});})['catch'](function(_0x1e93a3){logger[_0xd0f8('0x1f')](_0xd0f8('0x1e'),_0xd0f8('0x39'),_0x1e93a3);});};}function afterUpdate(_0xcb88e3){return function(_0x534c09){var _0x4073f2=_0x534c09[_0xd0f8('0x3a')](_0xd0f8('0x3b'))&&_0x534c09[_0xd0f8('0x3b')];var _0x10244e=_0x534c09[_0xd0f8('0x3a')](_0xd0f8('0x3c'));if(_0x4073f2||_0x10244e){var _0x77e48d=_0x4073f2?_0xd0f8('0xa'):_0xd0f8('0x3c');var _0x2b90ee=_0x534c09[_0xd0f8('0x35')]({'plain':!![]});_0x2b90ee[_0xd0f8('0x22')]=_0xcb88e3;_0x2b90ee[_0xd0f8('0x36')]=_0xcb88e3;_0x2b90ee[_0xd0f8('0x23')]=_0x4073f2?_0xd0f8('0x3b'):_0xd0f8('0x3c');var _0x4a9405=_0xd0f8('0x28')+_0x2b90ee['ContactId'];return db['sequelize']['query'](_0x4a9405,{'type':db[_0xd0f8('0x2b')][_0xd0f8('0x2c')][_0xd0f8('0x3d')],'raw':!![]})['then'](function(_0x3fdcd1){if(_0x3fdcd1){_0x2b90ee['contact']=_0x3fdcd1[0x0];}if(typeof _0x2b90ee[_0xd0f8('0x2e')]===_0xd0f8('0x27'))return;return getAgent(_0x2b90ee[_0xd0f8('0x2e')]);})['then'](function(_0x13ee3e){if(_0x13ee3e){_0x2b90ee[_0xd0f8('0x2f')]=util['format'](_0xd0f8('0x31'),_0x13ee3e['name']);_0x2b90ee[_0xd0f8('0x32')]=_0x13ee3e;}return request({'event':_0x77e48d,'message':_0x2b90ee});})['catch'](function(_0x162cd5){logger[_0xd0f8('0x1f')]('Trigger,\x20%s',_0xd0f8('0x3e'),_0x162cd5);});}};}function getAgent(_0x12e84d){return db['User'][_0xd0f8('0x3f')]({'where':{'id':_0x12e84d},'attributes':['id','name',_0xd0f8('0x40'),_0xd0f8('0x41'),_0xd0f8('0x42')],'raw':!![]})['then'](function(_0x582b45){return _0x582b45;});}exports[_0xd0f8('0x43')]=function(){for(var _0x3f13c4=0x0;_0x3f13c4=_0x313517[_0x3aa9('0x16')]){throw Error(_0x3aa9('0x17'));}_0x38d3ce(_0x5c06d2);})[_0x3aa9('0x18')](function(_0x13f561){_0xfc198f(_0x13f561);});});}; \ No newline at end of file +var _0xaccb=['isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','User','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','mail','chat','fax','sms','whatsapp','openchannel','getChannels'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xaccb,0x133));var _0xbacc=function(_0x134fc8,_0x5aa100){_0x134fc8=_0x134fc8-0x0;var _0x3031bf=_0xaccb[_0x134fc8];return _0x3031bf;};'use strict';var _=require(_0xbacc('0x0'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var util=require('./license/util');var channels=['voice',_0xbacc('0x1'),_0xbacc('0x2'),_0xbacc('0x3'),_0xbacc('0x4'),_0xbacc('0x5'),_0xbacc('0x6')];exports[_0xbacc('0x7')]=function(){return channels;};exports[_0xbacc('0x8')]=function(_0x2966d9){_0x2966d9=_0x2966d9[_0xbacc('0x9')]();return _[_0xbacc('0xa')](channels,_0x2966d9);};exports[_0xbacc('0xb')]=function(_0x4e63da,_0x263f31,_0x12233e,_0xd20396){var _0x2e7c25={'loginAttempts':_0x263f31,'blocked':_0x12233e};if(!_[_0xbacc('0xc')](_0xd20396)){_0x2e7c25[_0xbacc('0xd')]=_0xd20396;}return _0x4e63da[_0xbacc('0xe')](_0x2e7c25);};exports[_0xbacc('0xf')]=function(_0x56b66c){return new BPromise(function(_0x2dffca,_0x4b08bd){var _0x51f44e=0x0;if(_0x56b66c[_0xbacc('0x10')]!=='agent'){_0x2dffca(_0x56b66c);}db[_0xbacc('0x11')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x56b66c['id']}}})[_0xbacc('0x12')](function(_0x3a4465){_0x51f44e=_0x3a4465;return util['getLicense']();})[_0xbacc('0x12')](function(_0x2336e0){if(_0x2336e0&&_0x2336e0[_0xbacc('0x13')]&&_0x51f44e>=_0x2336e0['agents']){throw Error(_0xbacc('0x14'));}_0x2dffca(_0x56b66c);})['catch'](function(_0x173cb3){_0x4b08bd(_0x173cb3);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 2fac91e..d2fa2ad 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Forbidden','OutOfInterval','Not\x20Found','status','send','util','../config/logger','api'];(function(_0x599c45,_0x16d500){var _0x14afeb=function(_0x21a867){while(--_0x21a867){_0x599c45['push'](_0x599c45['shift']());}};_0x14afeb(++_0x16d500);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var util=require(_0x0a9e('0x0'));var logger=require(_0x0a9e('0x1'))(_0x0a9e('0x2'));var APIError=function(_0x5dd881,_0x550fbc){this[_0x0a9e('0x3')]=_0x5dd881||'Internal\x20Server\x20Error';this[_0x0a9e('0x4')]=_0x550fbc||_0x0a9e('0x5');util[_0x0a9e('0x6')](APIError,Error);};var APIBadRequestError=function(_0x991246){this[_0x0a9e('0x3')]=_0x991246||'Bad\x20Request';this[_0x0a9e('0x4')]=_0x0a9e('0x7');util[_0x0a9e('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x5f41ea){this['message']=_0x5f41ea||_0x0a9e('0x8');this['name']='Not\x20Found';util[_0x0a9e('0x6')](APINotFoundError,APIError);};function getStatusCode(_0xf81284){switch(_0xf81284){case _0x0a9e('0x7'):return 0x190;case _0x0a9e('0x9'),_0x0a9e('0xa'):return 0x193;case _0x0a9e('0xb'):return 0x194;default:return 0x1f4;}}function handleError(_0x4a4c56){return function(_0x50dfb2){logger['error'](_0x50dfb2['stack']);var _0x273d4d=getStatusCode(_0x50dfb2[_0x0a9e('0x4')]);if(_0x50dfb2[_0x0a9e('0x4')])delete _0x50dfb2[_0x0a9e('0x4')];return _0x4a4c56[_0x0a9e('0xc')](_0x273d4d)[_0x0a9e('0xd')](_0x50dfb2);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xdace=['send','exports','util','api','Internal\x20Server\x20Error','name','Error','inherits','message','Bad\x20Request','Not\x20Found','Forbidden','OutOfInterval','error','status'];(function(_0x1f70e6,_0x3de5b1){var _0xe43b01=function(_0x462771){while(--_0x462771){_0x1f70e6['push'](_0x1f70e6['shift']());}};_0xe43b01(++_0x3de5b1);}(_0xdace,0xc5));var _0xedac=function(_0x1e081a,_0x482d6b){_0x1e081a=_0x1e081a-0x0;var _0x428209=_0xdace[_0x1e081a];return _0x428209;};'use strict';var util=require(_0xedac('0x0'));var logger=require('../config/logger')(_0xedac('0x1'));var APIError=function(_0x13adb5,_0x46eba0){this['message']=_0x13adb5||_0xedac('0x2');this[_0xedac('0x3')]=_0x46eba0||_0xedac('0x4');util[_0xedac('0x5')](APIError,Error);};var APIBadRequestError=function(_0x5a97c0){this[_0xedac('0x6')]=_0x5a97c0||_0xedac('0x7');this[_0xedac('0x3')]='Bad\x20Request';util[_0xedac('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x21440e){this[_0xedac('0x6')]=_0x21440e||'Entity\x20not\x20found';this[_0xedac('0x3')]=_0xedac('0x8');util[_0xedac('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x4af030){switch(_0x4af030){case'Bad\x20Request':return 0x190;case _0xedac('0x9'),_0xedac('0xa'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x4d6a29){return function(_0x4db2ad){logger[_0xedac('0xb')](_0x4db2ad['stack']);var _0x261401=getStatusCode(_0x4db2ad['name']);if(_0x4db2ad[_0xedac('0x3')])delete _0x4db2ad[_0xedac('0x3')];return _0x4d6a29[_0xedac('0xc')](_0x261401)[_0xedac('0xd')](_0x4db2ad);};}module[_0xedac('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index e343a5a..90cb158 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc901=['json','send','exports','status','render'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xc901,0x142));var _0x1c90=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xc901[_0x57b54c];return _0x59cc19;};'use strict';module[_0x1c90('0x0')][0x194]=function pageNotFound(_0x5e03fb,_0x5ac4c7){var _0x5d3178='404';var _0x21d387=0x194;var _0x4386c8={'status':_0x21d387};_0x5ac4c7['status'](_0x4386c8[_0x1c90('0x1')]);_0x5ac4c7[_0x1c90('0x2')](_0x5d3178,{},function(_0x3dcf02,_0x2eff92){if(_0x3dcf02){return _0x5ac4c7[_0x1c90('0x1')](_0x4386c8[_0x1c90('0x1')])[_0x1c90('0x3')](_0x4386c8);}_0x5ac4c7[_0x1c90('0x4')](_0x2eff92);});}; \ No newline at end of file +var _0x6efe=['send','404','status','render'];(function(_0x3c6654,_0x18e7bb){var _0x17dce5=function(_0x1f762d){while(--_0x1f762d){_0x3c6654['push'](_0x3c6654['shift']());}};_0x17dce5(++_0x18e7bb);}(_0x6efe,0x1a5));var _0xe6ef=function(_0xeaf983,_0xa1d33b){_0xeaf983=_0xeaf983-0x0;var _0x1adecd=_0x6efe[_0xeaf983];return _0x1adecd;};'use strict';module['exports'][0x194]=function pageNotFound(_0x1de10d,_0x4f49ca){var _0x203008=_0xe6ef('0x0');var _0x328802=0x194;var _0x4b6d49={'status':_0x328802};_0x4f49ca['status'](_0x4b6d49[_0xe6ef('0x1')]);_0x4f49ca[_0xe6ef('0x2')](_0x203008,{},function(_0x4b91f8,_0x501b43){if(_0x4b91f8){return _0x4f49ca['status'](_0x4b6d49['status'])['json'](_0x4b6d49);}_0x4f49ca[_0xe6ef('0x3')](_0x501b43);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 4737cbb..a1f4ca4 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1aa7=['MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','user_has_teams','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','ChatWebsite','ChatWebsites','user_has_fax_accounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','ChanSpyId','Members','VoiceQueueId','CmHopper','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','Trunk','mandatoryDispositionPause','Lists','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','mailboxuser','mailbox','QueueCalls','VoiceAgentReport','AgentReports','uniqueid','Contact','ContactId','MailAccount','MailAccountId','CloudProvider','restrict','MailServerOut','CloudProviderId','Imap','Smtp','Dispositions','Answers','MailMessage','Messages','Interactions','List','ListId','Template','mandatoryDispositionPauseId','team_has_mail_queues','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','MailInteractionId','ChatWebsiteId','ChatOfflineMessage','IntervalId','Dashboard','DashboardItem','Items','FaxAccountId','Applications','TagId','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelQueueId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','user_has_chat_websites','OpenchannelQueueReport','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CompanyId','Phones','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OwnerId','Condition','All','OneAll','AutomationAllId','Any','AutomationAnyId','Action','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','Schedule','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','DefaultReportId','MetricId','AccountId','SalesforceConfiguration','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Field','Variable','VariableId','SugarcrmAccount','SugarcrmConfiguration','Configurations','int_desk_configuration_has_tags','Description','ZendeskField','int_zendesk_configuration_has_tags','VtigerConfiguration','VtigerField','VtigerAccount','ServicenowConfiguration','ServicenowField','ChatQueueReport','FromId','SessionId','ProjectId','team_has_whatsapp_queues','Hoppers','TrunkId','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','userProfileId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','WhatsappTransferReport','ToWhatsappAccountId','ToQueueId','user','exports','../config/environment','sequelize','lodash','determine','defaultsDeep','motion2','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xcall','xC@LL1234','database','username','password','options','User','../api/user/user.model','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','userSetting','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','CmHopperHistory','HopperHistory','ChatInteractions','SmsInteractions','FaxInteractions'];(function(_0x14324c,_0x4f5ac5){var _0xcc9fca=function(_0x54213e){while(--_0x54213e){_0x14324c['push'](_0x14324c['shift']());}};_0xcc9fca(++_0x4f5ac5);}(_0x1aa7,0xeb));var _0x71aa=function(_0x27c310,_0x2e218e){_0x27c310=_0x27c310-0x0;var _0x31fd03=_0x1aa7[_0x27c310];return _0x31fd03;};'use strict';var config=require(_0x71aa('0x0'));var Sequelize=require(_0x71aa('0x1'));var _=require(_0x71aa('0x2'));var jstz=require('jstz');var timezone=jstz[_0x71aa('0x3')]();config[_0x71aa('0x1')]=_[_0x71aa('0x4')](config[_0x71aa('0x1')],{'database':_0x71aa('0x5'),'username':'xcall','password':'xC@LL1234','options':{'host':_0x71aa('0x6'),'port':0xcea,'dialect':_0x71aa('0x7'),'dialectOptions':{'charset':_0x71aa('0x8')},'logging':![],'timezone':timezone[_0x71aa('0x9')](),'define':{'charset':_0x71aa('0xa'),'collate':_0x71aa('0xb')}}});config[_0x71aa('0xc')]=_['defaultsDeep'](config[_0x71aa('0xc')],{'database':'motion2','username':_0x71aa('0xd'),'password':_0x71aa('0xe'),'options':{'host':_0x71aa('0x6'),'port':0xcea,'dialect':_0x71aa('0x7'),'dialectOptions':{'charset':_0x71aa('0x8')},'logging':![],'timezone':timezone[_0x71aa('0x9')](),'define':{'charset':_0x71aa('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x71aa('0x1')][_0x71aa('0xf')],config['sequelize'][_0x71aa('0x10')],config[_0x71aa('0x1')][_0x71aa('0x11')],config[_0x71aa('0x1')][_0x71aa('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x71aa('0xc')][_0x71aa('0xf')],config[_0x71aa('0xc')][_0x71aa('0x10')],config[_0x71aa('0xc')][_0x71aa('0x11')],config['sequelizeHistory'][_0x71aa('0x12')])};db[_0x71aa('0x13')]=db[_0x71aa('0x1')]['import'](_0x71aa('0x14'));db['VoiceChanSpy']=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x16'));db[_0x71aa('0x17')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x18'));db[_0x71aa('0x19')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0x1a'));db[_0x71aa('0x1b')]=db[_0x71aa('0x1')][_0x71aa('0x15')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x71aa('0x1c')]=db['sequelize']['import']('../api/voiceQueue/voiceQueue.model');db[_0x71aa('0x1d')]=db['sequelize']['import'](_0x71aa('0x1e'));db[_0x71aa('0x1f')]=db[_0x71aa('0x1')][_0x71aa('0x15')]('../api/screenRecording/screenRecording.model');db[_0x71aa('0x20')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x21'));db['VoiceMailMessage']=db['sequelize']['import'](_0x71aa('0x22'));db[_0x71aa('0x23')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x24'));db[_0x71aa('0x25')]=db[_0x71aa('0x1')]['import'](_0x71aa('0x26'));db['VoiceAgentReport']=db[_0x71aa('0x1')][_0x71aa('0x15')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x71aa('0x27')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x28'));db['MemberReport']=db['sequelize'][_0x71aa('0x15')](_0x71aa('0x29'));db['Trunk']=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x2a'));db[_0x71aa('0x2b')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x2c'));db[_0x71aa('0x2d')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x2e'));db['UserVoiceQueue']=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x2f'));db[_0x71aa('0x30')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0x31'));db[_0x71aa('0x32')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0x33'));db[_0x71aa('0x34')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x35'));db['UserSmsQueue']=db[_0x71aa('0x1')]['import'](_0x71aa('0x36'));db[_0x71aa('0x37')]=db['sequelize']['import'](_0x71aa('0x38'));db[_0x71aa('0x39')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x3a'));db[_0x71aa('0x3b')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x3c'));db['MailServerOut']=db[_0x71aa('0x1')][_0x71aa('0x15')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db['sequelize'][_0x71aa('0x15')](_0x71aa('0x3d'));db[_0x71aa('0x3e')]=db['sequelize']['import'](_0x71aa('0x3f'));db[_0x71aa('0x40')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x41'));db[_0x71aa('0x42')]=db[_0x71aa('0x1')][_0x71aa('0x15')]('../api/mailInteraction/mailInteraction.model');db['MailMessage']=db[_0x71aa('0x1')]['import'](_0x71aa('0x43'));db[_0x71aa('0x44')]=db[_0x71aa('0x1')][_0x71aa('0x15')]('../api/mailApplication/mailApplication.model');db[_0x71aa('0x45')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0x46'));db['Dashboard']=db['sequelize'][_0x71aa('0x15')](_0x71aa('0x47'));db['DashboardItem']=db['sequelize']['import'](_0x71aa('0x48'));db[_0x71aa('0x49')]=db[_0x71aa('0x1')]['import']('../api/faxAccount/faxAccount.model');db[_0x71aa('0x4a')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x4b'));db[_0x71aa('0x4c')]=db[_0x71aa('0x1')]['import'](_0x71aa('0x4d'));db[_0x71aa('0x4e')]=db['sequelize'][_0x71aa('0x15')]('../api/faxMessage/faxMessage.model');db[_0x71aa('0x4f')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0x50'));db['FaxQueueReport']=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x51'));db[_0x71aa('0x52')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0x53'));db[_0x71aa('0x54')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0x55'));db[_0x71aa('0x56')]=db[_0x71aa('0x1')][_0x71aa('0x15')]('../api/smsInteraction/smsInteraction.model');db[_0x71aa('0x57')]=db[_0x71aa('0x1')]['import']('../api/smsMessage/smsMessage.model');db[_0x71aa('0x58')]=db[_0x71aa('0x1')]['import']('../api/smsQueue/smsQueue.model');db[_0x71aa('0x59')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x5a'));db[_0x71aa('0x5b')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x5c'));db[_0x71aa('0x5d')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x5e'));db[_0x71aa('0x5f')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x60'));db[_0x71aa('0x61')]=db['sequelize'][_0x71aa('0x15')]('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x62'));db['OpenchannelQueueReport']=db['sequelize'][_0x71aa('0x15')](_0x71aa('0x63'));db[_0x71aa('0x64')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x65'));db[_0x71aa('0x66')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x67'));db[_0x71aa('0x68')]=db[_0x71aa('0x1')]['import']('../api/chatMessage/chatMessage.model');db['ChatOfflineMessage']=db['sequelize']['import'](_0x71aa('0x69'));db[_0x71aa('0x6a')]=db['sequelize'][_0x71aa('0x15')]('../api/chatQueue/chatQueue.model');db[_0x71aa('0x6b')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0x6c'));db['ChatProactiveAction']=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x6d'));db[_0x71aa('0x6e')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x6f'));db[_0x71aa('0x70')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x71'));db['CmHopper']=db['sequelize']['import'](_0x71aa('0x72'));db[_0x71aa('0x73')]=db[_0x71aa('0x1')][_0x71aa('0x15')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x71aa('0x74')]=db[_0x71aa('0x1')]['import'](_0x71aa('0x75'));db['CmHopperHistory']=db['sequelize']['import'](_0x71aa('0x76'));db[_0x71aa('0x77')]=db['sequelize'][_0x71aa('0x15')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x71aa('0x78')]=db[_0x71aa('0x1')]['import'](_0x71aa('0x79'));db['Action']=db['sequelize'][_0x71aa('0x15')](_0x71aa('0x7a'));db[_0x71aa('0x7b')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x7c'));db[_0x71aa('0x7d')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x7e'));db[_0x71aa('0x7f')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0x80'));db['Condition']=db['sequelize'][_0x71aa('0x15')](_0x71aa('0x81'));db[_0x71aa('0x82')]=db['sequelize']['import']('../api/interval/interval.model');db[_0x71aa('0x83')]=db[_0x71aa('0x1')][_0x71aa('0x15')]('../api/pause/pause.model');db[_0x71aa('0x84')]=db[_0x71aa('0x1')]['import'](_0x71aa('0x85'));db[_0x71aa('0x86')]=db[_0x71aa('0x1')][_0x71aa('0x15')]('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db['sequelize'][_0x71aa('0x15')]('../api/schedule/schedule.model');db[_0x71aa('0x87')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0x88'));db[_0x71aa('0x89')]=db[_0x71aa('0x1')]['import'](_0x71aa('0x8a'));db[_0x71aa('0x8b')]=db[_0x71aa('0x1')][_0x71aa('0x15')]('../api/contactItemType/contactItemType.model');db[_0x71aa('0x8c')]=db['sequelize']['import'](_0x71aa('0x8d'));db[_0x71aa('0x8e')]=db[_0x71aa('0x1')]['import']('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db['Template']=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x8f'));db[_0x71aa('0x90')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x91'));db['Variable']=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x92'));db[_0x71aa('0x93')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x94'));db[_0x71aa('0x95')]=db['sequelize']['import'](_0x71aa('0x96'));db[_0x71aa('0x97')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x98'));db[_0x71aa('0x99')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0x9a'));db[_0x71aa('0x9b')]=db[_0x71aa('0x1')]['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x71aa('0x9c')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x9d'));db[_0x71aa('0x9e')]=db['sequelize']['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0x71aa('0x9f')]=db[_0x71aa('0x1')][_0x71aa('0x15')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x71aa('0xa0')]=db[_0x71aa('0x1')]['import'](_0x71aa('0xa1'));db['SalesforceConfiguration']=db['sequelize'][_0x71aa('0x15')](_0x71aa('0xa2'));db[_0x71aa('0xa3')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0xa4'));db['SugarcrmAccount']=db['sequelize']['import'](_0x71aa('0xa5'));db['SugarcrmConfiguration']=db[_0x71aa('0x1')][_0x71aa('0x15')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x71aa('0xa6')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xa7'));db[_0x71aa('0xa8')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xa9'));db[_0x71aa('0xaa')]=db['sequelize']['import']('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x71aa('0xab')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xac'));db[_0x71aa('0xad')]=db[_0x71aa('0x1')][_0x71aa('0x15')]('../api/intZohoAccount/intZohoAccount.model');db[_0x71aa('0xae')]=db[_0x71aa('0x1')]['import'](_0x71aa('0xaf'));db[_0x71aa('0xb0')]=db[_0x71aa('0x1')][_0x71aa('0x15')]('../api/intZohoField/intZohoField.model');db[_0x71aa('0xb1')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xb2'));db[_0x71aa('0xb3')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xb4'));db['ZendeskField']=db['sequelize'][_0x71aa('0x15')](_0x71aa('0xb5'));db[_0x71aa('0xb6')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xb7'));db[_0x71aa('0xb8')]=db['sequelize'][_0x71aa('0x15')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x71aa('0xb9')]=db['sequelize']['import'](_0x71aa('0xba'));db['VtigerAccount']=db['sequelize'][_0x71aa('0x15')](_0x71aa('0xbb'));db['VtigerConfiguration']=db[_0x71aa('0x1')][_0x71aa('0x15')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xbc'));db[_0x71aa('0xbd')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xbe'));db['ServicenowConfiguration']=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xbf'));db['ServicenowField']=db['sequelize'][_0x71aa('0x15')](_0x71aa('0xc0'));db[_0x71aa('0xc1')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xc2'));db[_0x71aa('0xc3')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xc4'));db[_0x71aa('0xc5')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0xc6'));db[_0x71aa('0xc7')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0xc8'));db[_0x71aa('0xc9')]=db[_0x71aa('0x1')][_0x71aa('0x15')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x71aa('0xca')]=db['sequelize']['import'](_0x71aa('0xcb'));db[_0x71aa('0x93')]=db['sequelize']['import']('../api/integration/integration.model');db[_0x71aa('0xcc')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xcd'));db['ChatQueueReport']=db['sequelize'][_0x71aa('0x15')](_0x71aa('0xce'));db[_0x71aa('0xcf')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xd0'));db[_0x71aa('0xd1')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xd2'));db[_0x71aa('0xd3')]=db[_0x71aa('0x1')]['import'](_0x71aa('0xd4'));db[_0x71aa('0xd5')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0xd6'));db[_0x71aa('0xd7')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0xd8'));db['SquareReport']=db[_0x71aa('0x1')]['import'](_0x71aa('0xd9'));db[_0x71aa('0xda')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0xdb'));db[_0x71aa('0xdc')]=db['sequelize']['import']('../api/jscriptyProject/jscriptyProject.model');db[_0x71aa('0xdd')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0xde'));db[_0x71aa('0xdf')]=db[_0x71aa('0x1')][_0x71aa('0x15')]('../api/squareOdbc/squareOdbc.model');db[_0x71aa('0xe0')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xe1'));db[_0x71aa('0xe2')]=db['sequelize']['import'](_0x71aa('0xe3'));db[_0x71aa('0xe4')]=db[_0x71aa('0x1')]['import'](_0x71aa('0xe5'));db[_0x71aa('0xe6')]=db['sequelize'][_0x71aa('0x15')]('../api/team/team.model');db[_0x71aa('0xe7')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xe8'));db[_0x71aa('0xe9')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0xea'));db[_0x71aa('0xeb')]=db[_0x71aa('0x1')]['import'](_0x71aa('0xec'));db[_0x71aa('0xed')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0xee'));db[_0x71aa('0xef')]=db[_0x71aa('0x1')]['import'](_0x71aa('0xf0'));db[_0x71aa('0xf1')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xf2'));db[_0x71aa('0xf3')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xf4'));db['FaxTransferReport']=db[_0x71aa('0x1')][_0x71aa('0x15')]('../api/faxTransferReport/faxTransferReport.model');db[_0x71aa('0xf5')]=db[_0x71aa('0x1')][_0x71aa('0x15')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x71aa('0xf6')]=db[_0x71aa('0x1')]['import'](_0x71aa('0xf7'));db[_0x71aa('0xf8')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xf9'));db[_0x71aa('0xfa')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xfb'));db[_0x71aa('0xfc')]=db[_0x71aa('0x1')]['import']('../api/userProfile/userProfile.model');db[_0x71aa('0xfd')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0xfe'));db[_0x71aa('0xff')]=db[_0x71aa('0x1')]['import'](_0x71aa('0x100'));db[_0x71aa('0x101')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x102'));db[_0x71aa('0x103')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x104'));db['WhatsappApplication']=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x105'));db[_0x71aa('0x106')]=db['sequelize'][_0x71aa('0x15')](_0x71aa('0x107'));db[_0x71aa('0x108')]=db['sequelize']['import'](_0x71aa('0x109'));db[_0x71aa('0x10a')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x10b'));db['WhatsappTransferReport']=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x10c'));db[_0x71aa('0x10d')]=db['sequelize']['import'](_0x71aa('0x10e'));db['CloudProvider']=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x10f'));db['TeamVoiceQueue']=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x110'));db[_0x71aa('0x111')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x112'));db[_0x71aa('0x113')]=db[_0x71aa('0x1')]['import'](_0x71aa('0x114'));db[_0x71aa('0x115')]=db[_0x71aa('0x1')][_0x71aa('0x15')](_0x71aa('0x116'));db[_0x71aa('0x13')][_0x71aa('0x117')](db[_0x71aa('0x20')],{'as':'VoiceMail','onDelete':_0x71aa('0x118'),'foreignKey':'UserId'});db[_0x71aa('0x13')][_0x71aa('0x117')](db[_0x71aa('0x115')],{'as':_0x71aa('0x119'),'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x11a')});db[_0x71aa('0x13')][_0x71aa('0x11b')](db[_0x71aa('0x1d')],{'as':_0x71aa('0x11c'),'foreignKey':_0x71aa('0x11a')});db[_0x71aa('0x13')][_0x71aa('0x11b')](db[_0x71aa('0x2d')],{'as':_0x71aa('0x11d'),'foreignKey':_0x71aa('0x11a')});db[_0x71aa('0x13')][_0x71aa('0x11b')](db[_0x71aa('0x19')],{'as':_0x71aa('0x11e'),'onDelete':_0x71aa('0x118'),'hooks':!![]});db[_0x71aa('0x13')][_0x71aa('0x11b')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x71aa('0x11a')});db[_0x71aa('0x13')][_0x71aa('0x11b')](db[_0x71aa('0x11f')],{'as':_0x71aa('0x120'),'foreignKey':_0x71aa('0x11a')});db[_0x71aa('0x13')][_0x71aa('0x11b')](db[_0x71aa('0x77')],{'as':'ReportAgentPreview','foreignKey':_0x71aa('0x11a')});db['User'][_0x71aa('0x11b')](db[_0x71aa('0x5d')],{'as':'OpenchannelInteractions','foreignKey':_0x71aa('0x11a')});db[_0x71aa('0x13')][_0x71aa('0x11b')](db['ChatInteraction'],{'as':_0x71aa('0x121'),'foreignKey':_0x71aa('0x11a')});db['User'][_0x71aa('0x11b')](db[_0x71aa('0x56')],{'as':_0x71aa('0x122'),'foreignKey':_0x71aa('0x11a')});db[_0x71aa('0x13')]['hasMany'](db[_0x71aa('0x4c')],{'as':_0x71aa('0x123'),'foreignKey':_0x71aa('0x11a')});db[_0x71aa('0x13')][_0x71aa('0x11b')](db[_0x71aa('0x42')],{'as':_0x71aa('0x124'),'foreignKey':'UserId'});db[_0x71aa('0x13')][_0x71aa('0x11b')](db['WhatsappInteraction'],{'as':_0x71aa('0x125'),'foreignKey':_0x71aa('0x11a')});db[_0x71aa('0x13')]['hasMany'](db['UserNotification'],{'as':_0x71aa('0x126'),'foreignKey':_0x71aa('0x127')});db['User'][_0x71aa('0x128')](db[_0x71aa('0xfc')],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0x71aa('0x13')][_0x71aa('0x129')](db[_0x71aa('0x6b')],{'as':_0x71aa('0x12a'),'through':_0x71aa('0x12b')});db['User'][_0x71aa('0x129')](db['CmContact'],{'as':_0x71aa('0x12c'),'through':_0x71aa('0x12d')});db[_0x71aa('0x13')][_0x71aa('0x129')](db[_0x71aa('0xf8')],{'as':'Lists','through':'cm_user_has_lists'});db[_0x71aa('0x13')][_0x71aa('0x129')](db[_0x71aa('0xe6')],{'through':_0x71aa('0x12e')});db['User'][_0x71aa('0x129')](db[_0x71aa('0x42')],{'as':_0x71aa('0x124'),'through':'user_has_mail_interactions'});db[_0x71aa('0x13')][_0x71aa('0x129')](db[_0x71aa('0x66')],{'as':_0x71aa('0x121'),'through':_0x71aa('0x12f')});db[_0x71aa('0x13')][_0x71aa('0x129')](db[_0x71aa('0x4c')],{'as':_0x71aa('0x123'),'through':_0x71aa('0x130')});db['User'][_0x71aa('0x129')](db[_0x71aa('0x56')],{'as':_0x71aa('0x122'),'through':_0x71aa('0x131')});db[_0x71aa('0x13')]['belongsToMany'](db[_0x71aa('0x5d')],{'as':_0x71aa('0x132'),'through':'user_has_openchannel_interactions'});db[_0x71aa('0x13')][_0x71aa('0x129')](db[_0x71aa('0x106')],{'as':_0x71aa('0x125'),'through':_0x71aa('0x133')});db[_0x71aa('0x13')][_0x71aa('0x129')](db[_0x71aa('0x1c')],{'as':_0x71aa('0x134'),'through':_0x71aa('0x135'),'required':![]});db[_0x71aa('0x13')][_0x71aa('0x129')](db['VoicePrefix'],{'as':_0x71aa('0x136'),'through':'UserVoicePrefix','required':![]});db[_0x71aa('0x13')][_0x71aa('0x129')](db[_0x71aa('0x3e')],{'as':_0x71aa('0x137'),'through':_0x71aa('0x32'),'required':![]});db[_0x71aa('0x13')]['belongsToMany'](db[_0x71aa('0x6a')],{'as':_0x71aa('0x138'),'through':_0x71aa('0x30'),'required':![],'hooks':!![]});db[_0x71aa('0x13')][_0x71aa('0x129')](db['FaxQueue'],{'as':_0x71aa('0x139'),'through':_0x71aa('0x34'),'required':![]});db[_0x71aa('0x13')][_0x71aa('0x129')](db[_0x71aa('0x58')],{'as':_0x71aa('0x13a'),'through':_0x71aa('0x13b'),'required':![]});db[_0x71aa('0x13')]['belongsToMany'](db[_0x71aa('0x61')],{'as':_0x71aa('0x13c'),'through':_0x71aa('0x37'),'required':![]});db[_0x71aa('0x13')][_0x71aa('0x129')](db[_0x71aa('0x10d')],{'as':_0x71aa('0x13d'),'through':_0x71aa('0x39'),'required':![]});db[_0x71aa('0x13')][_0x71aa('0x129')](db[_0x71aa('0xf8')],{'through':_0x71aa('0x13e')});db[_0x71aa('0x13')][_0x71aa('0x129')](db[_0x71aa('0x13f')],{'as':_0x71aa('0x140'),'through':'user_has_chat_websites'});db[_0x71aa('0x13')][_0x71aa('0x129')](db[_0x71aa('0x49')],{'as':'FaxAccounts','through':_0x71aa('0x141')});db[_0x71aa('0x13')][_0x71aa('0x129')](db['MailAccount'],{'as':'MailAccounts','through':_0x71aa('0x142')});db['User'][_0x71aa('0x129')](db[_0x71aa('0x59')],{'as':'OpenchannelAccounts','through':_0x71aa('0x143')});db[_0x71aa('0x13')]['belongsToMany'](db[_0x71aa('0x52')],{'as':_0x71aa('0x144'),'through':_0x71aa('0x145')});db[_0x71aa('0x13')][_0x71aa('0x129')](db['WhatsappAccount'],{'as':_0x71aa('0x146'),'through':_0x71aa('0x147')});db[_0x71aa('0x13')][_0x71aa('0x129')](db[_0x71aa('0xe0')],{'as':_0x71aa('0x148'),'through':_0x71aa('0x149')});db[_0x71aa('0x14a')][_0x71aa('0x11b')](db[_0x71aa('0x19')],{'as':_0x71aa('0x14b'),'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x14c')});db[_0x71aa('0x17')][_0x71aa('0x11b')](db[_0x71aa('0x19')],{'onDelete':_0x71aa('0x118')});db[_0x71aa('0x19')][_0x71aa('0x11b')](db['VoiceExtension'],{'as':'Applications','onDelete':_0x71aa('0x118')});db[_0x71aa('0x1b')][_0x71aa('0x129')](db['Sound'],{'as':'Sounds','through':'moh_has_sounds'});db['VoiceQueue'][_0x71aa('0x11b')](db[_0x71aa('0x2d')],{'as':_0x71aa('0x14d'),'foreignKey':_0x71aa('0x14e')});db['VoiceQueue'][_0x71aa('0x11b')](db[_0x71aa('0x14f')],{'as':'Hoppers','foreignKey':_0x71aa('0x14e')});db['VoiceQueue'][_0x71aa('0x11b')](db[_0x71aa('0x74')],{'as':_0x71aa('0x150'),'foreignKey':_0x71aa('0x14e')});db[_0x71aa('0x1c')]['hasMany'](db['CmHopperHistory'],{'as':_0x71aa('0x151'),'foreignKey':'VoiceQueueId'});db[_0x71aa('0x1c')]['hasMany'](db[_0x71aa('0x77')],{'as':'ReportAgentPreview','foreignKey':_0x71aa('0x14e')});db[_0x71aa('0x1c')][_0x71aa('0x11b')](db[_0x71aa('0x73')],{'as':_0x71aa('0x152'),'foreignKey':_0x71aa('0x14e')});db[_0x71aa('0x1c')]['hasMany'](db[_0x71aa('0xd5')],{'as':_0x71aa('0x153'),'foreignKey':_0x71aa('0x14e')});db['VoiceQueue'][_0x71aa('0x128')](db[_0x71aa('0x154')],{'as':'Trunk','foreignKey':'TrunkId'});db['VoiceQueue'][_0x71aa('0x128')](db[_0x71aa('0x154')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db[_0x71aa('0x1c')][_0x71aa('0x128')](db[_0x71aa('0x82')],{'as':'Interval','foreignKey':'IntervalId'});db[_0x71aa('0x1c')][_0x71aa('0x128')](db['Pause'],{'as':_0x71aa('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x71aa('0x1c')][_0x71aa('0x129')](db['CmList'],{'as':_0x71aa('0x156'),'through':_0x71aa('0x157')});db[_0x71aa('0x1c')][_0x71aa('0x129')](db[_0x71aa('0x13')],{'as':_0x71aa('0x158'),'through':_0x71aa('0x135')});db['VoiceQueue']['belongsToMany'](db[_0x71aa('0xe6')],{'as':_0x71aa('0x159'),'through':_0x71aa('0x15a')});db[_0x71aa('0x1c')][_0x71aa('0x129')](db[_0x71aa('0xf8')],{'as':_0x71aa('0x15b'),'through':_0x71aa('0x15c')});db[_0x71aa('0x1d')][_0x71aa('0x128')](db['User'],{'as':_0x71aa('0x13'),'foreignKey':'UserId'});db['ScreenRecording'][_0x71aa('0x128')](db[_0x71aa('0x13')],{'as':_0x71aa('0x13'),'foreignKey':_0x71aa('0x11a')});db[_0x71aa('0x20')][_0x71aa('0x11b')](db[_0x71aa('0x15d')],{'as':'Messages','onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x15e'),'sourceKey':_0x71aa('0x15f')});db['VoiceMailMessage'][_0x71aa('0x128')](db['VoiceMail'],{'foreignKey':_0x71aa('0x15e'),'targetKey':_0x71aa('0x15f')});db['VoiceCallReport']['hasMany'](db['VoiceQueueReport'],{'as':_0x71aa('0x160'),'foreignKey':'uniqueid','constraints':![]});db[_0x71aa('0x23')][_0x71aa('0x11b')](db[_0x71aa('0x161')],{'as':_0x71aa('0x162'),'foreignKey':_0x71aa('0x163'),'constraints':![]});db[_0x71aa('0x23')][_0x71aa('0x128')](db['User'],{'as':_0x71aa('0x13'),'foreignKey':'UserId'});db[_0x71aa('0x23')]['belongsTo'](db[_0x71aa('0x70')],{'as':_0x71aa('0x164'),'foreignKey':_0x71aa('0x165')});db[_0x71aa('0x3b')][_0x71aa('0x128')](db[_0x71aa('0x166')],{'as':_0x71aa('0x166'),'foreignKey':_0x71aa('0x167')});db['MailServerIn'][_0x71aa('0x128')](db[_0x71aa('0x168')],{'as':_0x71aa('0x168'),'foreignKey':'CloudProviderId','onDelete':_0x71aa('0x169')});db[_0x71aa('0x16a')][_0x71aa('0x128')](db[_0x71aa('0x166')],{'as':_0x71aa('0x166'),'foreignKey':_0x71aa('0x167')});db['MailServerOut']['belongsTo'](db[_0x71aa('0x168')],{'as':_0x71aa('0x168'),'foreignKey':_0x71aa('0x16b'),'onDelete':'restrict'});db['MailAccount']['hasOne'](db[_0x71aa('0x3b')],{'as':_0x71aa('0x16c'),'onDelete':_0x71aa('0x118')});db[_0x71aa('0x166')][_0x71aa('0x117')](db[_0x71aa('0x16a')],{'as':_0x71aa('0x16d'),'onDelete':_0x71aa('0x118')});db[_0x71aa('0x166')]['hasMany'](db[_0x71aa('0x7f')],{'as':_0x71aa('0x16e'),'foreignKey':'MailAccountId','onDelete':_0x71aa('0x118')});db['MailAccount'][_0x71aa('0x11b')](db[_0x71aa('0x7d')],{'as':_0x71aa('0x16f'),'foreignKey':_0x71aa('0x167')});db['MailAccount']['hasMany'](db[_0x71aa('0x170')],{'as':_0x71aa('0x171'),'foreignKey':'MailAccountId'});db[_0x71aa('0x166')][_0x71aa('0x11b')](db['MailInteraction'],{'as':_0x71aa('0x172')});db[_0x71aa('0x166')]['hasMany'](db[_0x71aa('0x44')],{'as':'Applications'});db['MailAccount'][_0x71aa('0x128')](db[_0x71aa('0xf8')],{'as':_0x71aa('0x173'),'foreignKey':_0x71aa('0x174')});db[_0x71aa('0x166')][_0x71aa('0x128')](db['Template'],{'as':_0x71aa('0x175'),'foreignKey':'TemplateId'});db[_0x71aa('0x166')]['belongsTo'](db[_0x71aa('0x83')],{'as':_0x71aa('0x155'),'foreignKey':_0x71aa('0x176')});db[_0x71aa('0x166')][_0x71aa('0x129')](db[_0x71aa('0x13')],{'as':'Agents','through':_0x71aa('0x142')});db['MailQueue']['belongsToMany'](db['User'],{'as':'Agents','through':'UserMailQueue'});db[_0x71aa('0x3e')][_0x71aa('0x129')](db[_0x71aa('0xe6')],{'through':_0x71aa('0x177'),'as':_0x71aa('0x159')});db['MailInteraction'][_0x71aa('0x11b')](db[_0x71aa('0x170')],{'as':_0x71aa('0x171'),'onDelete':_0x71aa('0x118'),'foreignKey':'MailInteractionId'});db['MailInteraction'][_0x71aa('0x128')](db[_0x71aa('0x166')],{'as':_0x71aa('0x178'),'foreignKey':'MailAccountId'});db['MailInteraction'][_0x71aa('0x128')](db['CmContact'],{'as':_0x71aa('0x164'),'foreignKey':'ContactId'});db[_0x71aa('0x42')][_0x71aa('0x128')](db[_0x71aa('0x13')],{'as':_0x71aa('0x179'),'foreignKey':_0x71aa('0x11a')});db['MailInteraction'][_0x71aa('0x129')](db['Tag'],{'through':_0x71aa('0x17a'),'as':_0x71aa('0x17b')});db[_0x71aa('0x42')]['belongsToMany'](db[_0x71aa('0x89')],{'through':_0x71aa('0x17a'),'as':_0x71aa('0x17c')});db[_0x71aa('0x42')][_0x71aa('0x129')](db['User'],{'as':_0x71aa('0x17d'),'through':_0x71aa('0x17e'),'foreignKey':'MailInteractionId'});db[_0x71aa('0x170')]['hasMany'](db[_0x71aa('0xed')],{'as':_0x71aa('0x17f'),'onDelete':_0x71aa('0x118')});db[_0x71aa('0x170')][_0x71aa('0x128')](db[_0x71aa('0x13')],{'as':_0x71aa('0x13')});db[_0x71aa('0x170')][_0x71aa('0x128')](db['CmContact'],{'onDelete':'cascade','as':_0x71aa('0x164')});db[_0x71aa('0x170')][_0x71aa('0x128')](db[_0x71aa('0x42')],{'as':_0x71aa('0x180'),'foreignKey':_0x71aa('0x181')});db['MailMessage'][_0x71aa('0x128')](db[_0x71aa('0x166')],{'as':'Account','foreignKey':_0x71aa('0x167')});db[_0x71aa('0x170')]['belongsTo'](db[_0x71aa('0x13f')],{'as':'ChatWebsite','foreignKey':_0x71aa('0x182')});db[_0x71aa('0x170')][_0x71aa('0x128')](db[_0x71aa('0x183')],{'as':_0x71aa('0x183'),'foreignKey':'ChatOfflineMessageId'});db[_0x71aa('0x44')][_0x71aa('0x128')](db[_0x71aa('0x13')],{'onDelete':'restrict'});db[_0x71aa('0x44')][_0x71aa('0x128')](db[_0x71aa('0x3e')],{'onDelete':_0x71aa('0x169')});db[_0x71aa('0x44')][_0x71aa('0x128')](db[_0x71aa('0x166')],{'onDelete':'restrict'});db[_0x71aa('0x44')][_0x71aa('0x128')](db[_0x71aa('0x82')],{'onDelete':_0x71aa('0x169'),'foreignKey':_0x71aa('0x184')});db['MailApplication'][_0x71aa('0x128')](db['Tag'],{'onDelete':_0x71aa('0x169'),'foreignKey':'TagId'});db[_0x71aa('0x45')][_0x71aa('0x128')](db[_0x71aa('0x166')],{});db['MailQueueReport'][_0x71aa('0x128')](db[_0x71aa('0xf8')],{'as':_0x71aa('0x173'),'foreignKey':_0x71aa('0x174')});db[_0x71aa('0x45')][_0x71aa('0x128')](db[_0x71aa('0x70')],{'as':_0x71aa('0x164'),'foreignKey':_0x71aa('0x165')});db['MailQueueReport'][_0x71aa('0x128')](db['MailInteraction'],{});db['MailQueueReport'][_0x71aa('0x128')](db[_0x71aa('0x170')],{});db[_0x71aa('0x45')][_0x71aa('0x128')](db['User'],{});db[_0x71aa('0x45')][_0x71aa('0x128')](db['MailQueue'],{});db[_0x71aa('0x185')]['hasMany'](db[_0x71aa('0x186')],{'as':_0x71aa('0x187'),'onDelete':'cascade'});db[_0x71aa('0x49')]['hasMany'](db[_0x71aa('0x7f')],{'as':_0x71aa('0x16e'),'foreignKey':'FaxAccountId','onDelete':_0x71aa('0x118')});db[_0x71aa('0x49')][_0x71aa('0x11b')](db[_0x71aa('0x7d')],{'as':'Answers','foreignKey':_0x71aa('0x188')});db[_0x71aa('0x49')][_0x71aa('0x11b')](db[_0x71aa('0x4c')],{'as':_0x71aa('0x172')});db[_0x71aa('0x49')][_0x71aa('0x11b')](db[_0x71aa('0x4a')],{'as':_0x71aa('0x189')});db[_0x71aa('0x49')][_0x71aa('0x11b')](db[_0x71aa('0x19')],{'as':'Exntensions','onDelete':_0x71aa('0x118')});db['FaxAccount'][_0x71aa('0x11b')](db['FaxMessage'],{'as':_0x71aa('0x171')});db[_0x71aa('0x49')]['belongsTo'](db['Trunk'],{'as':_0x71aa('0x154')});db[_0x71aa('0x49')]['belongsTo'](db[_0x71aa('0xf8')],{'as':_0x71aa('0x173'),'foreignKey':_0x71aa('0x174')});db[_0x71aa('0x49')][_0x71aa('0x128')](db[_0x71aa('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0x71aa('0x176')});db[_0x71aa('0x49')][_0x71aa('0x129')](db['User'],{'as':_0x71aa('0x158'),'through':_0x71aa('0x141')});db[_0x71aa('0x4a')]['belongsTo'](db['User'],{'onDelete':_0x71aa('0x169')});db[_0x71aa('0x4a')]['belongsTo'](db['FaxQueue'],{'onDelete':'restrict'});db[_0x71aa('0x4a')][_0x71aa('0x128')](db[_0x71aa('0x49')],{'onDelete':_0x71aa('0x169')});db[_0x71aa('0x4a')][_0x71aa('0x128')](db[_0x71aa('0x89')],{'onDelete':'restrict','foreignKey':_0x71aa('0x18a')});db['FaxInteraction'][_0x71aa('0x11b')](db[_0x71aa('0x4e')],{'as':_0x71aa('0x171'),'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x18b')});db[_0x71aa('0x4c')][_0x71aa('0x128')](db[_0x71aa('0x49')],{'as':'Account','foreignKey':_0x71aa('0x188')});db['FaxInteraction'][_0x71aa('0x128')](db['CmContact'],{'as':'Contact','foreignKey':_0x71aa('0x165')});db[_0x71aa('0x4c')]['belongsTo'](db[_0x71aa('0x13')],{'as':_0x71aa('0x179'),'foreignKey':_0x71aa('0x11a')});db[_0x71aa('0x4c')][_0x71aa('0x129')](db['Tag'],{'through':'fax_interaction_has_tags','as':'Tags'});db[_0x71aa('0x4c')][_0x71aa('0x129')](db[_0x71aa('0x89')],{'through':_0x71aa('0x18c'),'as':_0x71aa('0x17c')});db[_0x71aa('0x4c')][_0x71aa('0x129')](db['User'],{'as':_0x71aa('0x17d'),'through':_0x71aa('0x130'),'foreignKey':_0x71aa('0x18b')});db[_0x71aa('0x4e')][_0x71aa('0x128')](db['User'],{'onDelete':'cascade','as':_0x71aa('0x13')});db[_0x71aa('0x4e')]['belongsTo'](db[_0x71aa('0x4c')],{'as':_0x71aa('0x180'),'foreignKey':_0x71aa('0x18b')});db[_0x71aa('0x4e')][_0x71aa('0x128')](db[_0x71aa('0x70')],{'onDelete':'cascade','as':_0x71aa('0x164')});db[_0x71aa('0x4e')]['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':_0x71aa('0x18d')});db['FaxMessage'][_0x71aa('0x128')](db[_0x71aa('0x49')],{'as':_0x71aa('0x178'),'foreignKey':_0x71aa('0x188')});db[_0x71aa('0x4f')][_0x71aa('0x129')](db[_0x71aa('0x13')],{'as':_0x71aa('0x158'),'through':_0x71aa('0x34')});db['FaxQueue'][_0x71aa('0x129')](db[_0x71aa('0xe6')],{'through':_0x71aa('0x18e'),'as':_0x71aa('0x159')});db[_0x71aa('0x18f')][_0x71aa('0x128')](db[_0x71aa('0x49')],{});db['FaxQueueReport'][_0x71aa('0x128')](db['CmList'],{'as':_0x71aa('0x173'),'foreignKey':_0x71aa('0x174')});db['FaxQueueReport'][_0x71aa('0x128')](db[_0x71aa('0x70')],{'as':_0x71aa('0x164'),'foreignKey':_0x71aa('0x165')});db[_0x71aa('0x18f')][_0x71aa('0x128')](db[_0x71aa('0x4c')],{});db['FaxQueueReport']['belongsTo'](db['FaxMessage'],{});db['FaxQueueReport'][_0x71aa('0x128')](db['User'],{});db['FaxQueueReport'][_0x71aa('0x128')](db[_0x71aa('0x4f')],{});db[_0x71aa('0x52')][_0x71aa('0x11b')](db['Disposition'],{'as':_0x71aa('0x16e'),'foreignKey':_0x71aa('0x190'),'onDelete':_0x71aa('0x118')});db[_0x71aa('0x52')][_0x71aa('0x11b')](db['CannedAnswer'],{'as':_0x71aa('0x16f'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x71aa('0x11b')](db[_0x71aa('0x57')],{'as':_0x71aa('0x171'),'foreignKey':_0x71aa('0x190')});db[_0x71aa('0x52')][_0x71aa('0x11b')](db['SmsInteraction'],{'as':_0x71aa('0x172')});db[_0x71aa('0x52')][_0x71aa('0x11b')](db[_0x71aa('0x54')],{'as':_0x71aa('0x189')});db[_0x71aa('0x52')][_0x71aa('0x128')](db['CmList'],{'as':_0x71aa('0x173'),'foreignKey':_0x71aa('0x174')});db[_0x71aa('0x52')][_0x71aa('0x128')](db[_0x71aa('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0x71aa('0x176')});db[_0x71aa('0x52')][_0x71aa('0x129')](db['User'],{'as':_0x71aa('0x158'),'through':_0x71aa('0x145')});db[_0x71aa('0x54')][_0x71aa('0x128')](db[_0x71aa('0x13')],{'onDelete':_0x71aa('0x169')});db['SmsApplication']['belongsTo'](db[_0x71aa('0x58')],{'onDelete':_0x71aa('0x169')});db[_0x71aa('0x54')][_0x71aa('0x128')](db[_0x71aa('0x52')],{'onDelete':'restrict'});db[_0x71aa('0x54')][_0x71aa('0x128')](db[_0x71aa('0x82')],{'onDelete':'restrict','foreignKey':_0x71aa('0x184')});db['SmsApplication'][_0x71aa('0x128')](db[_0x71aa('0x89')],{'onDelete':_0x71aa('0x169'),'foreignKey':'TagId'});db[_0x71aa('0x56')][_0x71aa('0x11b')](db[_0x71aa('0x57')],{'as':'Messages','onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x191')});db[_0x71aa('0x56')][_0x71aa('0x128')](db[_0x71aa('0x52')],{'as':'Account','foreignKey':_0x71aa('0x190')});db[_0x71aa('0x56')][_0x71aa('0x128')](db[_0x71aa('0x70')],{'as':_0x71aa('0x164'),'foreignKey':'ContactId'});db['SmsInteraction'][_0x71aa('0x128')](db['User'],{'as':_0x71aa('0x179'),'foreignKey':_0x71aa('0x11a')});db['SmsInteraction']['belongsToMany'](db[_0x71aa('0x89')],{'through':_0x71aa('0x192'),'as':'Tags'});db[_0x71aa('0x56')]['belongsToMany'](db[_0x71aa('0x89')],{'through':_0x71aa('0x192'),'as':'ThroughTags'});db[_0x71aa('0x56')][_0x71aa('0x129')](db[_0x71aa('0x13')],{'as':_0x71aa('0x17d'),'through':_0x71aa('0x131'),'foreignKey':_0x71aa('0x191')});db[_0x71aa('0x57')][_0x71aa('0x128')](db['User'],{'as':'User'});db['SmsMessage'][_0x71aa('0x128')](db[_0x71aa('0x70')],{'onDelete':_0x71aa('0x118'),'as':_0x71aa('0x164')});db['SmsMessage'][_0x71aa('0x128')](db['SmsInteraction'],{'onDelete':_0x71aa('0x118'),'as':'Interaction','foreignKey':_0x71aa('0x191')});db[_0x71aa('0x57')][_0x71aa('0x128')](db[_0x71aa('0x52')],{'as':_0x71aa('0x178'),'foreignKey':'SmsAccountId'});db[_0x71aa('0x58')][_0x71aa('0x129')](db[_0x71aa('0x13')],{'as':_0x71aa('0x158'),'through':'UserSmsQueue','foreignKey':_0x71aa('0x193')});db[_0x71aa('0x58')][_0x71aa('0x129')](db[_0x71aa('0xe6')],{'through':_0x71aa('0x194'),'as':'Teams'});db[_0x71aa('0x59')][_0x71aa('0x11b')](db[_0x71aa('0x7f')],{'as':_0x71aa('0x16e'),'foreignKey':_0x71aa('0x195'),'onDelete':'cascade'});db[_0x71aa('0x59')][_0x71aa('0x11b')](db['CannedAnswer'],{'as':_0x71aa('0x16f'),'foreignKey':_0x71aa('0x195')});db[_0x71aa('0x59')][_0x71aa('0x11b')](db['OpenchannelInteraction'],{'as':_0x71aa('0x172'),'foreignKey':_0x71aa('0x195')});db[_0x71aa('0x59')]['hasMany'](db[_0x71aa('0x5f')],{'as':_0x71aa('0x171'),'foreignKey':_0x71aa('0x195')});db[_0x71aa('0x59')][_0x71aa('0x11b')](db[_0x71aa('0x5b')],{'as':'Applications','foreignKey':_0x71aa('0x195')});db['OpenchannelAccount'][_0x71aa('0x128')](db[_0x71aa('0xf8')],{'as':_0x71aa('0x173'),'foreignKey':_0x71aa('0x174')});db['OpenchannelAccount'][_0x71aa('0x128')](db['Pause'],{'as':_0x71aa('0x155'),'foreignKey':_0x71aa('0x176')});db[_0x71aa('0x59')][_0x71aa('0x129')](db[_0x71aa('0x13')],{'as':_0x71aa('0x158'),'through':_0x71aa('0x143')});db[_0x71aa('0x5b')][_0x71aa('0x128')](db[_0x71aa('0x13')],{'onDelete':_0x71aa('0x169')});db[_0x71aa('0x5b')][_0x71aa('0x128')](db[_0x71aa('0x61')],{'onDelete':_0x71aa('0x169'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelApplication'][_0x71aa('0x128')](db[_0x71aa('0x59')],{'onDelete':_0x71aa('0x169'),'foreignKey':_0x71aa('0x195')});db[_0x71aa('0x5b')][_0x71aa('0x128')](db[_0x71aa('0x82')],{'onDelete':_0x71aa('0x169'),'foreignKey':_0x71aa('0x184')});db[_0x71aa('0x5b')][_0x71aa('0x128')](db[_0x71aa('0x89')],{'onDelete':'restrict','foreignKey':_0x71aa('0x18a')});db[_0x71aa('0x5d')]['hasMany'](db[_0x71aa('0x5f')],{'as':_0x71aa('0x171'),'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x196')});db[_0x71aa('0x5d')][_0x71aa('0x128')](db['OpenchannelAccount'],{'as':_0x71aa('0x178'),'foreignKey':_0x71aa('0x195')});db[_0x71aa('0x5d')]['belongsTo'](db[_0x71aa('0x70')],{'as':_0x71aa('0x164'),'foreignKey':'ContactId'});db[_0x71aa('0x5d')]['belongsTo'](db[_0x71aa('0x13')],{'as':_0x71aa('0x179'),'foreignKey':_0x71aa('0x11a')});db[_0x71aa('0x5d')]['belongsToMany'](db[_0x71aa('0x89')],{'through':_0x71aa('0x197'),'as':_0x71aa('0x17b')});db[_0x71aa('0x5d')]['belongsToMany'](db[_0x71aa('0x89')],{'through':'openchannel_interaction_has_tags','as':'ThroughTags'});db[_0x71aa('0x5d')][_0x71aa('0x129')](db[_0x71aa('0x13')],{'as':_0x71aa('0x17d'),'through':_0x71aa('0x198'),'foreignKey':_0x71aa('0x196')});db['OpenchannelMessage'][_0x71aa('0x128')](db[_0x71aa('0x13')],{'onDelete':_0x71aa('0x118'),'as':_0x71aa('0x13')});db[_0x71aa('0x5f')][_0x71aa('0x128')](db['CmContact'],{'onDelete':_0x71aa('0x118'),'as':'Contact'});db['OpenchannelMessage'][_0x71aa('0x128')](db[_0x71aa('0x5d')],{'onDelete':_0x71aa('0x118'),'as':'Interaction','foreignKey':_0x71aa('0x196')});db[_0x71aa('0x5f')][_0x71aa('0x128')](db[_0x71aa('0xed')],{'as':_0x71aa('0xed'),'foreignKey':_0x71aa('0x18d')});db[_0x71aa('0x5f')][_0x71aa('0x128')](db[_0x71aa('0x59')],{'as':_0x71aa('0x178'),'foreignKey':_0x71aa('0x195')});db[_0x71aa('0x61')][_0x71aa('0x129')](db[_0x71aa('0x13')],{'as':_0x71aa('0x158'),'through':_0x71aa('0x37'),'foreignKey':_0x71aa('0x199')});db[_0x71aa('0x61')][_0x71aa('0x129')](db[_0x71aa('0xe6')],{'through':_0x71aa('0x19a'),'as':_0x71aa('0x159')});db['ChatWebsite'][_0x71aa('0x11b')](db['Disposition'],{'as':_0x71aa('0x16e'),'foreignKey':'ChatWebsiteId','onDelete':_0x71aa('0x118')});db[_0x71aa('0x13f')][_0x71aa('0x11b')](db[_0x71aa('0x7d')],{'as':_0x71aa('0x16f'),'foreignKey':_0x71aa('0x182')});db['ChatWebsite']['hasMany'](db[_0x71aa('0x19b')],{'as':_0x71aa('0x19c')});db[_0x71aa('0x13f')]['hasMany'](db[_0x71aa('0x66')],{'as':'Interactions'});db[_0x71aa('0x13f')][_0x71aa('0x11b')](db['ChatApplication'],{'as':_0x71aa('0x189')});db[_0x71aa('0x13f')][_0x71aa('0x11b')](db['ChatMessage'],{'as':_0x71aa('0x171')});db[_0x71aa('0x13f')][_0x71aa('0x128')](db[_0x71aa('0xf8')],{'as':_0x71aa('0x173'),'foreignKey':_0x71aa('0x174')});db[_0x71aa('0x13f')][_0x71aa('0x128')](db[_0x71aa('0x82')],{'as':_0x71aa('0x82'),'foreignKey':'IntervalId'});db[_0x71aa('0x13f')][_0x71aa('0x128')](db['MailAccount'],{'as':_0x71aa('0x166'),'foreignKey':_0x71aa('0x167')});db[_0x71aa('0x13f')]['belongsTo'](db[_0x71aa('0x83')],{'as':_0x71aa('0x155'),'foreignKey':_0x71aa('0x176')});db[_0x71aa('0x13f')]['belongsToMany'](db[_0x71aa('0x13')],{'as':_0x71aa('0x158'),'through':_0x71aa('0x19d')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x71aa('0x19e')][_0x71aa('0x128')](db[_0x71aa('0xf8')],{'as':'List','foreignKey':'ListId'});db[_0x71aa('0x19e')][_0x71aa('0x128')](db['CmContact'],{'as':_0x71aa('0x164'),'foreignKey':_0x71aa('0x165')});db[_0x71aa('0x19e')][_0x71aa('0x128')](db[_0x71aa('0x5d')],{});db[_0x71aa('0x19e')][_0x71aa('0x128')](db['OpenchannelMessage'],{});db[_0x71aa('0x19e')]['belongsTo'](db[_0x71aa('0x13')],{});db['OpenchannelQueueReport'][_0x71aa('0x128')](db[_0x71aa('0x61')],{});db[_0x71aa('0x64')][_0x71aa('0x128')](db['User'],{'as':_0x71aa('0x19f'),'foreignKey':_0x71aa('0x11a'),'onDelete':_0x71aa('0x169')});db[_0x71aa('0x64')][_0x71aa('0x128')](db[_0x71aa('0x6a')],{'as':_0x71aa('0x1a0'),'foreignKey':_0x71aa('0x1a1'),'onDelete':_0x71aa('0x169')});db[_0x71aa('0x64')][_0x71aa('0x128')](db[_0x71aa('0x13f')],{'as':_0x71aa('0x1a2'),'foreignKey':_0x71aa('0x182'),'onDelete':_0x71aa('0x169')});db[_0x71aa('0x64')][_0x71aa('0x128')](db[_0x71aa('0x89')],{'onDelete':'restrict','foreignKey':'TagId'});db['ChatInteraction']['hasMany'](db[_0x71aa('0x68')],{'as':_0x71aa('0x171'),'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x1a3')});db['ChatInteraction'][_0x71aa('0x128')](db[_0x71aa('0x13f')],{'as':_0x71aa('0x178'),'foreignKey':'ChatWebsiteId'});db[_0x71aa('0x66')]['belongsTo'](db['CmContact'],{'as':_0x71aa('0x164'),'foreignKey':_0x71aa('0x165')});db[_0x71aa('0x66')]['belongsTo'](db[_0x71aa('0x13')],{'as':'Owner','foreignKey':_0x71aa('0x11a')});db['ChatInteraction'][_0x71aa('0x129')](db[_0x71aa('0x89')],{'through':_0x71aa('0x1a4'),'as':_0x71aa('0x17b')});db['ChatInteraction'][_0x71aa('0x129')](db[_0x71aa('0x89')],{'through':_0x71aa('0x1a4'),'as':_0x71aa('0x17c')});db[_0x71aa('0x66')]['belongsToMany'](db['User'],{'as':'Users','through':_0x71aa('0x12f'),'foreignKey':_0x71aa('0x1a3')});db[_0x71aa('0x68')][_0x71aa('0x128')](db[_0x71aa('0x13')],{'onDelete':'cascade','as':'User'});db[_0x71aa('0x68')][_0x71aa('0x128')](db[_0x71aa('0x70')],{'onDelete':_0x71aa('0x118'),'as':_0x71aa('0x164'),'foreignKey':_0x71aa('0x165')});db[_0x71aa('0x68')][_0x71aa('0x128')](db[_0x71aa('0x66')],{'onDelete':_0x71aa('0x118'),'as':_0x71aa('0x180'),'foreignKey':_0x71aa('0x1a3')});db[_0x71aa('0x68')][_0x71aa('0x128')](db[_0x71aa('0xed')],{'as':_0x71aa('0xed'),'foreignKey':'AttachmentId'});db[_0x71aa('0x68')][_0x71aa('0x128')](db[_0x71aa('0x13f')],{'as':'Account','foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage'][_0x71aa('0x11b')](db[_0x71aa('0xed')],{'as':_0x71aa('0x17f'),'foreignKey':_0x71aa('0x1a5'),'onDelete':_0x71aa('0x118'),'hooks':!![]});db[_0x71aa('0x183')][_0x71aa('0x128')](db[_0x71aa('0x70')],{'onDelete':'cascade','as':_0x71aa('0x164'),'foreignKey':_0x71aa('0x165')});db[_0x71aa('0x183')][_0x71aa('0x128')](db[_0x71aa('0x13f')],{'as':_0x71aa('0x178'),'foreignKey':_0x71aa('0x182')});db[_0x71aa('0x6a')][_0x71aa('0x129')](db[_0x71aa('0x13')],{'as':_0x71aa('0x158'),'through':_0x71aa('0x30'),'hooks':!![]});db[_0x71aa('0x6a')][_0x71aa('0x129')](db[_0x71aa('0xe6')],{'through':_0x71aa('0x1a6'),'as':_0x71aa('0x159')});db['ChatGroup'][_0x71aa('0x11b')](db[_0x71aa('0xcf')],{'as':_0x71aa('0x171'),'foreignKey':_0x71aa('0x1a7'),'onDelete':_0x71aa('0x118')});db[_0x71aa('0x6b')][_0x71aa('0x129')](db[_0x71aa('0x13')],{'as':_0x71aa('0x14d'),'through':_0x71aa('0x12b')});db[_0x71aa('0x19b')][_0x71aa('0x128')](db[_0x71aa('0x13f')],{'as':_0x71aa('0x1a2'),'foreignKey':_0x71aa('0x182')});db[_0x71aa('0x6e')][_0x71aa('0x11b')](db[_0x71aa('0x70')],{'as':_0x71aa('0x12c'),'foreignKey':_0x71aa('0x1a8')});db[_0x71aa('0x70')][_0x71aa('0x11b')](db[_0x71aa('0x8c')],{'as':_0x71aa('0x1a9'),'foreignKey':_0x71aa('0x1aa')});db[_0x71aa('0x70')]['hasMany'](db[_0x71aa('0x14f')],{'as':'Hoppers','foreignKey':_0x71aa('0x165')});db[_0x71aa('0x70')]['hasMany'](db['CmHopperFinal'],{'as':_0x71aa('0x150'),'foreignKey':'ContactId'});db[_0x71aa('0x70')][_0x71aa('0x11b')](db[_0x71aa('0x11f')],{'as':_0x71aa('0x151'),'foreignKey':'ContactId'});db[_0x71aa('0x70')][_0x71aa('0x11b')](db['ReportAgentPreview'],{'as':_0x71aa('0x77'),'foreignKey':'ContactId'});db[_0x71aa('0x70')][_0x71aa('0x11b')](db['JscriptySessionReport'],{'as':_0x71aa('0x153'),'foreignKey':_0x71aa('0x165')});db[_0x71aa('0x70')][_0x71aa('0x11b')](db[_0x71aa('0x5d')],{'as':_0x71aa('0x132'),'foreignKey':_0x71aa('0x165'),'onDelete':_0x71aa('0x169')});db['CmContact'][_0x71aa('0x11b')](db[_0x71aa('0x66')],{'as':_0x71aa('0x121'),'foreignKey':'ContactId','onDelete':_0x71aa('0x169')});db[_0x71aa('0x70')][_0x71aa('0x11b')](db['SmsInteraction'],{'as':_0x71aa('0x122'),'foreignKey':_0x71aa('0x165'),'onDelete':_0x71aa('0x169')});db[_0x71aa('0x70')]['hasMany'](db[_0x71aa('0x4c')],{'as':_0x71aa('0x123'),'foreignKey':_0x71aa('0x165'),'onDelete':_0x71aa('0x169')});db[_0x71aa('0x70')]['hasMany'](db['MailInteraction'],{'as':_0x71aa('0x124'),'foreignKey':_0x71aa('0x165'),'onDelete':_0x71aa('0x169')});db['CmContact'][_0x71aa('0x128')](db[_0x71aa('0x6e')],{'as':_0x71aa('0x1ab'),'foreignKey':_0x71aa('0x1a8')});db[_0x71aa('0x70')][_0x71aa('0x128')](db[_0x71aa('0xf8')],{'as':_0x71aa('0x173'),'foreignKey':_0x71aa('0x174'),'onDelete':_0x71aa('0x118')});db['CmContact']['belongsToMany'](db[_0x71aa('0x13')],{'as':_0x71aa('0x17d'),'through':_0x71aa('0x12d')});db[_0x71aa('0x70')]['belongsToMany'](db[_0x71aa('0x89')],{'as':_0x71aa('0x17b'),'through':'cm_contact_has_tags'});db[_0x71aa('0x70')][_0x71aa('0x129')](db[_0x71aa('0x89')],{'through':_0x71aa('0x1ac'),'as':_0x71aa('0x17c')});db[_0x71aa('0x14f')]['hasMany'](db[_0x71aa('0x8e')],{'as':_0x71aa('0x1ad'),'foreignKey':_0x71aa('0x1ae')});db['CmHopper'][_0x71aa('0x128')](db[_0x71aa('0x70')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x71aa('0x118')});db['CmHopper'][_0x71aa('0x128')](db[_0x71aa('0xf8')],{'as':_0x71aa('0x173'),'foreignKey':_0x71aa('0x174'),'onDelete':_0x71aa('0x118')});db['CmHopper']['belongsTo'](db[_0x71aa('0x13')],{'as':_0x71aa('0x19f'),'foreignKey':_0x71aa('0x11a')});db[_0x71aa('0x14f')][_0x71aa('0x128')](db[_0x71aa('0x1c')],{'as':_0x71aa('0x1a0'),'foreignKey':_0x71aa('0x14e'),'onDelete':_0x71aa('0x118')});db[_0x71aa('0x14f')][_0x71aa('0x128')](db['Campaign'],{'as':_0x71aa('0xe9'),'foreignKey':_0x71aa('0x1af'),'onDelete':_0x71aa('0x118')});db[_0x71aa('0x14f')]['belongsTo'](db[_0x71aa('0x13')],{'as':_0x71aa('0x179'),'foreignKey':_0x71aa('0x1b0')});db[_0x71aa('0x73')][_0x71aa('0x128')](db['CmContact'],{'as':_0x71aa('0x164'),'foreignKey':'ContactId','onDelete':_0x71aa('0x118')});db[_0x71aa('0x73')][_0x71aa('0x128')](db[_0x71aa('0xf8')],{'as':_0x71aa('0x173'),'foreignKey':_0x71aa('0x174'),'onDelete':_0x71aa('0x118')});db[_0x71aa('0x73')]['belongsTo'](db[_0x71aa('0x1c')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x71aa('0x118')});db['CmHopperBlack']['belongsTo'](db['Campaign'],{'as':_0x71aa('0xe9'),'foreignKey':_0x71aa('0x1af'),'onDelete':_0x71aa('0x118')});db[_0x71aa('0x7b')]['hasMany'](db[_0x71aa('0x1b1')],{'as':{'plural':_0x71aa('0x1b2'),'singular':_0x71aa('0x1b3')},'foreignKey':_0x71aa('0x1b4'),'onDelete':_0x71aa('0x118'),'hooks':!![]});db[_0x71aa('0x7b')][_0x71aa('0x11b')](db[_0x71aa('0x1b1')],{'as':{'plural':_0x71aa('0x1b5'),'singular':'OneAny'},'foreignKey':_0x71aa('0x1b6'),'onDelete':_0x71aa('0x118'),'hooks':!![]});db[_0x71aa('0x7b')][_0x71aa('0x11b')](db[_0x71aa('0x1b7')],{'as':_0x71aa('0x1b8'),'foreignKey':_0x71aa('0x1b9'),'onDelete':_0x71aa('0x118'),'hooks':!![]});db[_0x71aa('0x7f')]['hasMany'](db[_0x71aa('0x7f')],{'as':_0x71aa('0x16e'),'foreignKey':_0x71aa('0x1ba'),'onDelete':_0x71aa('0x118')});db[_0x71aa('0x82')][_0x71aa('0x11b')](db[_0x71aa('0x82')],{'as':_0x71aa('0x1bb'),'foreignKey':_0x71aa('0x184'),'onDelete':_0x71aa('0x118'),'hooks':!![],'required':![]});db[_0x71aa('0x82')][_0x71aa('0x11b')](db[_0x71aa('0x19')],{'as':_0x71aa('0x11e'),'foreignKey':_0x71aa('0x184'),'onDelete':_0x71aa('0x169')});db[_0x71aa('0x82')][_0x71aa('0x11b')](db[_0x71aa('0x44')],{'as':_0x71aa('0x1bc'),'foreignKey':_0x71aa('0x184')});db['Interval'][_0x71aa('0x11b')](db[_0x71aa('0x64')],{'as':_0x71aa('0x1bd'),'foreignKey':'IntervalId'});db[_0x71aa('0x82')][_0x71aa('0x11b')](db[_0x71aa('0x4a')],{'as':'FaxApplications','foreignKey':_0x71aa('0x184')});db[_0x71aa('0x82')]['hasMany'](db[_0x71aa('0x54')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0x71aa('0x1be')][_0x71aa('0x128')](db[_0x71aa('0x166')],{});db['Schedule']['belongsTo'](db[_0x71aa('0x99')],{'foreignKey':'DefaultReportId'});db[_0x71aa('0x1be')][_0x71aa('0x128')](db[_0x71aa('0x97')],{'foreignKey':_0x71aa('0x1bf')});db['Sound'][_0x71aa('0x129')](db[_0x71aa('0x1b')],{'as':_0x71aa('0x1c0'),'through':'moh_has_sounds','onDelete':'restrict'});db['Tag'][_0x71aa('0x129')](db[_0x71aa('0x70')],{'through':_0x71aa('0x1ac')});db[_0x71aa('0x89')]['belongsToMany'](db[_0x71aa('0x66')],{'through':_0x71aa('0x1a4')});db[_0x71aa('0x89')][_0x71aa('0x129')](db[_0x71aa('0x42')],{'through':_0x71aa('0x17a')});db['Tag']['belongsToMany'](db[_0x71aa('0x56')],{'through':_0x71aa('0x192')});db[_0x71aa('0x89')][_0x71aa('0x129')](db[_0x71aa('0x4c')],{'through':'fax_interaction_has_tags'});db[_0x71aa('0x89')][_0x71aa('0x129')](db['OpenchannelInteraction'],{'through':_0x71aa('0x197')});db['Tag']['belongsToMany'](db[_0x71aa('0x106')],{'through':_0x71aa('0x1c1')});db[_0x71aa('0x8c')]['belongsTo'](db['ContactItemType'],{'as':_0x71aa('0x1c2'),'foreignKey':_0x71aa('0x1c3')});db[_0x71aa('0x8e')]['belongsTo'](db[_0x71aa('0x14f')],{'as':_0x71aa('0x1c4'),'foreignKey':_0x71aa('0x1ae')});db[_0x71aa('0x8c')][_0x71aa('0x128')](db[_0x71aa('0x70')],{'as':'Contact','foreignKey':'CmContactId'});db[_0x71aa('0x90')][_0x71aa('0x11b')](db['Condition'],{'as':{'plural':'AllConditions','singular':_0x71aa('0x1c5')},'foreignKey':_0x71aa('0x1c6'),'onDelete':'cascade','hooks':!![]});db[_0x71aa('0x90')][_0x71aa('0x11b')](db['Condition'],{'as':{'plural':_0x71aa('0x1c7'),'singular':_0x71aa('0x1c8')},'foreignKey':_0x71aa('0x1c9'),'onDelete':'cascade','hooks':!![]});db[_0x71aa('0x90')][_0x71aa('0x11b')](db[_0x71aa('0x1b7')],{'as':'Actions','foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db[_0x71aa('0x97')][_0x71aa('0x11b')](db[_0x71aa('0x9e')],{'as':_0x71aa('0x1ca'),'onDelete':_0x71aa('0x118'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x71aa('0x11b')](db['AnalyticFieldReport'],{'as':_0x71aa('0x1ca'),'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x1cb')});db[_0x71aa('0x9c')][_0x71aa('0x11b')](db[_0x71aa('0x9e')],{'as':_0x71aa('0x1ca'),'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x1cc')});db[_0x71aa('0x9e')][_0x71aa('0x128')](db[_0x71aa('0x9c')],{'foreignKey':_0x71aa('0x1cc')});db['SalesforceAccount']['hasMany'](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x71aa('0x1cd')});db[_0x71aa('0x1ce')][_0x71aa('0x11b')](db['SalesforceField'],{'as':_0x71aa('0x1cf'),'onDelete':_0x71aa('0x118'),'foreignKey':'SubjectId'});db['SalesforceConfiguration']['hasMany'](db[_0x71aa('0xa3')],{'as':_0x71aa('0x1d0'),'onDelete':'cascade','foreignKey':_0x71aa('0x1d1')});db[_0x71aa('0x1ce')][_0x71aa('0x11b')](db[_0x71aa('0xa3')],{'as':_0x71aa('0x1ca'),'onDelete':'cascade','foreignKey':_0x71aa('0x1d2')});db[_0x71aa('0x1ce')][_0x71aa('0x128')](db[_0x71aa('0xa0')],{'as':_0x71aa('0x178'),'foreignKey':'AccountId'});db[_0x71aa('0xa3')][_0x71aa('0x11b')](db['SalesforceField'],{'as':_0x71aa('0x1d3'),'foreignKey':_0x71aa('0x1d4')});db[_0x71aa('0xa3')][_0x71aa('0x11b')](db[_0x71aa('0xa3')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x71aa('0xa3')][_0x71aa('0x11b')](db[_0x71aa('0xa3')],{'as':_0x71aa('0x1d5'),'foreignKey':_0x71aa('0x1d2')});db[_0x71aa('0xa3')][_0x71aa('0x128')](db[_0x71aa('0x1d6')],{'as':_0x71aa('0x1d6'),'foreignKey':_0x71aa('0x1d7')});db[_0x71aa('0x1d8')][_0x71aa('0x11b')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x1cd')});db['SugarcrmConfiguration'][_0x71aa('0x11b')](db[_0x71aa('0xa6')],{'as':_0x71aa('0x1cf'),'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x1d4')});db[_0x71aa('0x1d9')][_0x71aa('0x11b')](db[_0x71aa('0xa6')],{'as':_0x71aa('0x1d0'),'onDelete':_0x71aa('0x118'),'foreignKey':'DescriptionId'});db[_0x71aa('0x1d9')][_0x71aa('0x11b')](db[_0x71aa('0xa6')],{'as':_0x71aa('0x1ca'),'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x1d2')});db[_0x71aa('0x1d9')][_0x71aa('0x128')](db[_0x71aa('0x1d8')],{'as':'Account','foreignKey':_0x71aa('0x1cd')});db[_0x71aa('0xa6')][_0x71aa('0x11b')](db[_0x71aa('0xa6')],{'as':_0x71aa('0x1d3'),'foreignKey':_0x71aa('0x1d4')});db[_0x71aa('0xa6')][_0x71aa('0x11b')](db[_0x71aa('0xa6')],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField'][_0x71aa('0x11b')](db[_0x71aa('0xa6')],{'as':_0x71aa('0x1d5'),'foreignKey':'FieldId'});db['SugarcrmField']['belongsTo'](db[_0x71aa('0x1d6')],{'as':_0x71aa('0x1d6'),'foreignKey':_0x71aa('0x1d7')});db[_0x71aa('0xa8')][_0x71aa('0x11b')](db[_0x71aa('0xaa')],{'as':_0x71aa('0x1da'),'onDelete':'cascade','foreignKey':_0x71aa('0x1cd')});db[_0x71aa('0xaa')][_0x71aa('0x11b')](db['DeskField'],{'as':_0x71aa('0x1cf'),'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x1d4')});db[_0x71aa('0xaa')][_0x71aa('0x11b')](db[_0x71aa('0xab')],{'as':_0x71aa('0x1d0'),'onDelete':'cascade','foreignKey':_0x71aa('0x1d1')});db[_0x71aa('0xaa')][_0x71aa('0x11b')](db[_0x71aa('0xab')],{'as':_0x71aa('0x1ca'),'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x1d2')});db[_0x71aa('0xaa')]['belongsTo'](db['DeskAccount'],{'as':_0x71aa('0x178'),'foreignKey':'AccountId'});db[_0x71aa('0xaa')]['belongsToMany'](db['Tag'],{'through':_0x71aa('0x1db')});db[_0x71aa('0xab')][_0x71aa('0x11b')](db[_0x71aa('0xab')],{'as':'Subject','foreignKey':_0x71aa('0x1d4')});db['DeskField'][_0x71aa('0x11b')](db[_0x71aa('0xab')],{'as':_0x71aa('0x1dc'),'foreignKey':_0x71aa('0x1d1')});db[_0x71aa('0xab')][_0x71aa('0x11b')](db['DeskField'],{'as':_0x71aa('0x1d5'),'foreignKey':_0x71aa('0x1d2')});db[_0x71aa('0xab')][_0x71aa('0x128')](db[_0x71aa('0x1d6')],{'as':'Variable','foreignKey':_0x71aa('0x1d7')});db[_0x71aa('0xad')][_0x71aa('0x11b')](db[_0x71aa('0xae')],{'as':_0x71aa('0x1da'),'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x1cd')});db[_0x71aa('0xae')][_0x71aa('0x11b')](db[_0x71aa('0xb0')],{'as':_0x71aa('0x1cf'),'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x1d4')});db[_0x71aa('0xae')][_0x71aa('0x11b')](db['ZohoField'],{'as':'Descriptions','onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x1d1')});db[_0x71aa('0xae')]['hasMany'](db['ZohoField'],{'as':_0x71aa('0x1ca'),'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x1d2')});db[_0x71aa('0xae')]['belongsTo'](db[_0x71aa('0xad')],{'as':_0x71aa('0x178'),'foreignKey':_0x71aa('0x1cd')});db[_0x71aa('0xb0')][_0x71aa('0x11b')](db[_0x71aa('0xb0')],{'as':_0x71aa('0x1d3'),'foreignKey':_0x71aa('0x1d4')});db[_0x71aa('0xb0')]['hasMany'](db['ZohoField'],{'as':_0x71aa('0x1dc'),'foreignKey':_0x71aa('0x1d1')});db[_0x71aa('0xb0')][_0x71aa('0x11b')](db['ZohoField'],{'as':_0x71aa('0x1d5'),'foreignKey':'FieldId'});db[_0x71aa('0xb0')][_0x71aa('0x128')](db[_0x71aa('0x1d6')],{'as':_0x71aa('0x1d6'),'foreignKey':_0x71aa('0x1d7')});db[_0x71aa('0xb1')][_0x71aa('0x11b')](db[_0x71aa('0xb3')],{'as':_0x71aa('0x1da'),'onDelete':'cascade','foreignKey':_0x71aa('0x1cd')});db['ZendeskConfiguration']['hasMany'](db[_0x71aa('0x1dd')],{'as':_0x71aa('0x1cf'),'foreignKey':'SubjectId'});db[_0x71aa('0xb3')]['hasMany'](db[_0x71aa('0x1dd')],{'as':_0x71aa('0x1d0'),'foreignKey':_0x71aa('0x1d1')});db[_0x71aa('0xb3')]['hasMany'](db['ZendeskField'],{'as':_0x71aa('0x1ca'),'foreignKey':_0x71aa('0x1d2')});db[_0x71aa('0xb3')][_0x71aa('0x128')](db['ZendeskAccount'],{'as':'Account','foreignKey':_0x71aa('0x1cd')});db['ZendeskConfiguration'][_0x71aa('0x129')](db[_0x71aa('0x89')],{'through':_0x71aa('0x1de')});db[_0x71aa('0x1dd')]['hasMany'](db[_0x71aa('0x1dd')],{'as':_0x71aa('0x1d3'),'foreignKey':_0x71aa('0x1d4')});db[_0x71aa('0x1dd')][_0x71aa('0x11b')](db[_0x71aa('0x1dd')],{'as':_0x71aa('0x1dc'),'foreignKey':_0x71aa('0x1d1')});db[_0x71aa('0x1dd')]['hasMany'](db[_0x71aa('0x1dd')],{'as':'Field','foreignKey':_0x71aa('0x1d2')});db['ZendeskField'][_0x71aa('0x128')](db[_0x71aa('0x1d6')],{'as':_0x71aa('0x1d6'),'foreignKey':_0x71aa('0x1d7')});db[_0x71aa('0xb6')][_0x71aa('0x11b')](db[_0x71aa('0xb8')],{'as':_0x71aa('0x1da'),'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x1cd')});db[_0x71aa('0xb8')][_0x71aa('0x11b')](db[_0x71aa('0xb9')],{'as':'Subjects','onDelete':_0x71aa('0x118'),'foreignKey':'SubjectId'});db[_0x71aa('0xb8')][_0x71aa('0x11b')](db[_0x71aa('0xb9')],{'as':_0x71aa('0x1d0'),'onDelete':_0x71aa('0x118'),'foreignKey':'DescriptionId'});db[_0x71aa('0xb8')][_0x71aa('0x11b')](db[_0x71aa('0xb9')],{'as':_0x71aa('0x1ca'),'onDelete':'cascade','foreignKey':_0x71aa('0x1d2')});db[_0x71aa('0xb8')][_0x71aa('0x128')](db[_0x71aa('0xb6')],{'as':_0x71aa('0x178'),'foreignKey':_0x71aa('0x1cd')});db[_0x71aa('0xb8')][_0x71aa('0x129')](db[_0x71aa('0x89')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x71aa('0xb9')][_0x71aa('0x11b')](db[_0x71aa('0xb9')],{'as':'Subject','foreignKey':_0x71aa('0x1d4')});db[_0x71aa('0xb9')]['hasMany'](db[_0x71aa('0xb9')],{'as':_0x71aa('0x1dc'),'foreignKey':_0x71aa('0x1d1')});db[_0x71aa('0xb9')][_0x71aa('0x11b')](db[_0x71aa('0xb9')],{'as':_0x71aa('0x1d5'),'foreignKey':'FieldId'});db['FreshdeskField']['belongsTo'](db[_0x71aa('0x1d6')],{'as':'Variable','foreignKey':'VariableId'});db['VtigerAccount']['hasMany'](db[_0x71aa('0x1df')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x71aa('0x1cd')});db[_0x71aa('0x1df')][_0x71aa('0x11b')](db[_0x71aa('0x1e0')],{'as':_0x71aa('0x1cf'),'foreignKey':_0x71aa('0x1d4')});db[_0x71aa('0x1df')]['hasMany'](db[_0x71aa('0x1e0')],{'as':_0x71aa('0x1d0'),'foreignKey':_0x71aa('0x1d1')});db[_0x71aa('0x1df')][_0x71aa('0x11b')](db[_0x71aa('0x1e0')],{'as':'Fields','foreignKey':_0x71aa('0x1d2')});db[_0x71aa('0x1df')]['belongsTo'](db[_0x71aa('0x1e1')],{'as':_0x71aa('0x178'),'foreignKey':_0x71aa('0x1cd')});db[_0x71aa('0x1e0')][_0x71aa('0x11b')](db['VtigerField'],{'as':_0x71aa('0x1d3'),'foreignKey':'SubjectId'});db['VtigerField'][_0x71aa('0x11b')](db[_0x71aa('0x1e0')],{'as':'Description','foreignKey':_0x71aa('0x1d1')});db['VtigerField'][_0x71aa('0x11b')](db[_0x71aa('0x1e0')],{'as':'Field','foreignKey':_0x71aa('0x1d2')});db[_0x71aa('0x1e0')][_0x71aa('0x128')](db[_0x71aa('0x1d6')],{'as':_0x71aa('0x1d6'),'foreignKey':_0x71aa('0x1d7')});db[_0x71aa('0xbd')][_0x71aa('0x11b')](db[_0x71aa('0x1e2')],{'as':_0x71aa('0x1da'),'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x1cd')});db[_0x71aa('0x1e2')][_0x71aa('0x11b')](db[_0x71aa('0x1e3')],{'as':_0x71aa('0x1cf'),'foreignKey':'SubjectId'});db[_0x71aa('0x1e2')]['hasMany'](db['ServicenowField'],{'as':'Descriptions','foreignKey':_0x71aa('0x1d1')});db['ServicenowConfiguration'][_0x71aa('0x11b')](db['ServicenowField'],{'as':_0x71aa('0x1ca'),'foreignKey':'FieldId'});db[_0x71aa('0x1e2')][_0x71aa('0x128')](db[_0x71aa('0xbd')],{'as':_0x71aa('0x178'),'foreignKey':_0x71aa('0x1cd')});db[_0x71aa('0x1e3')][_0x71aa('0x11b')](db[_0x71aa('0x1e3')],{'as':_0x71aa('0x1d3'),'foreignKey':_0x71aa('0x1d4')});db[_0x71aa('0x1e3')]['hasMany'](db[_0x71aa('0x1e3')],{'as':_0x71aa('0x1dc'),'foreignKey':'DescriptionId'});db[_0x71aa('0x1e3')][_0x71aa('0x11b')](db[_0x71aa('0x1e3')],{'as':_0x71aa('0x1d5'),'foreignKey':_0x71aa('0x1d2')});db[_0x71aa('0x1e3')][_0x71aa('0x128')](db['Variable'],{'as':'Variable','foreignKey':_0x71aa('0x1d7')});db[_0x71aa('0xc1')]['hasMany'](db[_0x71aa('0xc3')],{'as':_0x71aa('0x1da'),'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x1cd')});db[_0x71aa('0xc1')][_0x71aa('0x128')](db[_0x71aa('0x168')],{'as':'CloudProvider','foreignKey':_0x71aa('0x16b')});db['Dynamics365Configuration'][_0x71aa('0x11b')](db[_0x71aa('0xc5')],{'as':_0x71aa('0x1cf'),'onDelete':_0x71aa('0x118'),'foreignKey':'SubjectId'});db['Dynamics365Configuration'][_0x71aa('0x11b')](db[_0x71aa('0xc5')],{'as':_0x71aa('0x1d0'),'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x1d1')});db[_0x71aa('0xc3')][_0x71aa('0x11b')](db[_0x71aa('0xc5')],{'as':_0x71aa('0x1ca'),'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x1d2')});db[_0x71aa('0xc3')]['belongsTo'](db[_0x71aa('0xc1')],{'as':_0x71aa('0x178'),'foreignKey':_0x71aa('0x1cd')});db['Dynamics365Field'][_0x71aa('0x11b')](db['Dynamics365Field'],{'as':_0x71aa('0x1d3'),'foreignKey':'SubjectId'});db['Dynamics365Field']['hasMany'](db[_0x71aa('0xc5')],{'as':_0x71aa('0x1dc'),'foreignKey':_0x71aa('0x1d1')});db[_0x71aa('0xc5')][_0x71aa('0x11b')](db['Dynamics365Field'],{'as':_0x71aa('0x1d5'),'foreignKey':_0x71aa('0x1d2')});db[_0x71aa('0xc5')][_0x71aa('0x128')](db['Variable'],{'as':'Variable','foreignKey':_0x71aa('0x1d7')});db[_0x71aa('0xc7')][_0x71aa('0x11b')](db[_0x71aa('0xc9')],{'as':'Configurations','onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x1cd')});db[_0x71aa('0xc9')][_0x71aa('0x11b')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x71aa('0x1d4')});db[_0x71aa('0xc9')]['hasMany'](db['FreshsalesField'],{'as':_0x71aa('0x1d0'),'foreignKey':_0x71aa('0x1d1')});db[_0x71aa('0xc9')][_0x71aa('0x11b')](db[_0x71aa('0xca')],{'as':_0x71aa('0x1ca'),'foreignKey':_0x71aa('0x1d2')});db['FreshsalesConfiguration']['belongsTo'](db[_0x71aa('0xc7')],{'as':_0x71aa('0x178'),'foreignKey':'AccountId'});db[_0x71aa('0xca')][_0x71aa('0x11b')](db['FreshsalesField'],{'as':_0x71aa('0x1d3'),'foreignKey':_0x71aa('0x1d4')});db['FreshsalesField'][_0x71aa('0x11b')](db['FreshsalesField'],{'as':_0x71aa('0x1dc'),'foreignKey':_0x71aa('0x1d1')});db[_0x71aa('0xca')][_0x71aa('0x11b')](db[_0x71aa('0xca')],{'as':_0x71aa('0x1d5'),'foreignKey':_0x71aa('0x1d2')});db['FreshsalesField'][_0x71aa('0x128')](db[_0x71aa('0x1d6')],{'as':'Variable','foreignKey':_0x71aa('0x1d7')});db[_0x71aa('0x1e4')][_0x71aa('0x128')](db[_0x71aa('0x13f')],{});db['ChatQueueReport'][_0x71aa('0x128')](db[_0x71aa('0xf8')],{'as':_0x71aa('0x173'),'foreignKey':_0x71aa('0x174')});db['ChatQueueReport']['belongsTo'](db['CmContact'],{'as':_0x71aa('0x164'),'foreignKey':_0x71aa('0x165')});db['ChatQueueReport'][_0x71aa('0x128')](db[_0x71aa('0x66')],{});db[_0x71aa('0x1e4')][_0x71aa('0x128')](db['ChatMessage'],{});db[_0x71aa('0x1e4')][_0x71aa('0x128')](db['User'],{});db[_0x71aa('0x1e4')][_0x71aa('0x128')](db[_0x71aa('0x6a')],{});db['ChatInternalMessage'][_0x71aa('0x128')](db[_0x71aa('0x13')],{'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x1e5')});db[_0x71aa('0xcf')][_0x71aa('0x128')](db['User'],{'onDelete':'cascade','foreignKey':'ToId'});db[_0x71aa('0xd5')][_0x71aa('0x11b')](db[_0x71aa('0xd3')],{'foreignKey':_0x71aa('0x1e6'),'onDelete':_0x71aa('0x118')});db[_0x71aa('0xd5')][_0x71aa('0x11b')](db['JscriptyAnswerReport'],{'foreignKey':_0x71aa('0x1e6'),'onDelete':_0x71aa('0x118')});db[_0x71aa('0xd7')]['belongsTo'](db[_0x71aa('0x52')],{});db[_0x71aa('0xd7')][_0x71aa('0x128')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x71aa('0xd7')][_0x71aa('0x128')](db[_0x71aa('0x70')],{'as':_0x71aa('0x164'),'foreignKey':'ContactId'});db[_0x71aa('0xd7')]['belongsTo'](db[_0x71aa('0x56')],{});db[_0x71aa('0xd7')][_0x71aa('0x128')](db['SmsMessage'],{});db[_0x71aa('0xd7')][_0x71aa('0x128')](db[_0x71aa('0x13')],{});db['SmsQueueReport'][_0x71aa('0x128')](db[_0x71aa('0x58')],{});db[_0x71aa('0xdc')][_0x71aa('0x11b')](db[_0x71aa('0xd5')],{'foreignKey':_0x71aa('0x1e7')});db[_0x71aa('0xdc')][_0x71aa('0x11b')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db['JscriptyProject']['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0x71aa('0x1e7')});db[_0x71aa('0xe0')][_0x71aa('0x129')](db[_0x71aa('0x13')],{'as':_0x71aa('0x17d'),'through':_0x71aa('0x149')});db['Team'][_0x71aa('0x129')](db['User'],{'as':_0x71aa('0x158'),'through':_0x71aa('0x12e')});db['Team'][_0x71aa('0x129')](db['VoiceQueue'],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db[_0x71aa('0xe6')]['belongsToMany'](db['MailQueue'],{'through':_0x71aa('0x177'),'as':'MailQueues'});db['Team']['belongsToMany'](db[_0x71aa('0x6a')],{'through':_0x71aa('0x1a6'),'as':_0x71aa('0x138')});db[_0x71aa('0xe6')][_0x71aa('0x129')](db['FaxQueue'],{'through':_0x71aa('0x18e'),'as':'FaxQueues'});db[_0x71aa('0xe6')][_0x71aa('0x129')](db[_0x71aa('0x58')],{'through':_0x71aa('0x194'),'as':_0x71aa('0x13a')});db[_0x71aa('0xe6')]['belongsToMany'](db[_0x71aa('0x61')],{'through':_0x71aa('0x19a'),'as':'OpenchannelQueues'});db[_0x71aa('0xe6')][_0x71aa('0x129')](db['WhatsappQueue'],{'through':_0x71aa('0x1e8'),'as':_0x71aa('0x13d')});db[_0x71aa('0xe6')][_0x71aa('0x129')](db[_0x71aa('0xfa')],{'through':_0x71aa('0x111'),'as':_0x71aa('0x136')});db[_0x71aa('0xe9')][_0x71aa('0x11b')](db[_0x71aa('0x14f')],{'as':_0x71aa('0x1e9'),'foreignKey':_0x71aa('0x1af')});db[_0x71aa('0xe9')]['hasMany'](db['CmHopperFinal'],{'as':_0x71aa('0x150'),'foreignKey':_0x71aa('0x1af')});db[_0x71aa('0xe9')]['hasMany'](db[_0x71aa('0x11f')],{'as':_0x71aa('0x151'),'foreignKey':_0x71aa('0x1af')});db[_0x71aa('0xe9')][_0x71aa('0x11b')](db['CmHopperBlack'],{'as':_0x71aa('0x152'),'foreignKey':'CampaignId'});db[_0x71aa('0xe9')]['belongsTo'](db['Trunk'],{'as':_0x71aa('0x154'),'foreignKey':_0x71aa('0x1ea')});db[_0x71aa('0xe9')][_0x71aa('0x128')](db[_0x71aa('0x154')],{'as':'TrunkBackup','foreignKey':_0x71aa('0x1eb')});db['Campaign'][_0x71aa('0x128')](db['Interval'],{'as':_0x71aa('0x82'),'foreignKey':_0x71aa('0x184')});db[_0x71aa('0xe9')][_0x71aa('0x128')](db['SquareProject'],{'as':_0x71aa('0xe0'),'foreignKey':_0x71aa('0x1ec')});db[_0x71aa('0xe9')][_0x71aa('0x129')](db[_0x71aa('0xf8')],{'as':'Lists','through':_0x71aa('0x1ed')});db['Campaign'][_0x71aa('0x129')](db[_0x71aa('0xf8')],{'as':_0x71aa('0x15b'),'through':_0x71aa('0x1ee')});db[_0x71aa('0xed')][_0x71aa('0x128')](db[_0x71aa('0x183')],{'as':'ChatOfflineMessage','foreignKey':_0x71aa('0x1a5')});db[_0x71aa('0xf1')]['belongsTo'](db[_0x71aa('0x170')],{});db[_0x71aa('0xf1')][_0x71aa('0x128')](db[_0x71aa('0x42')],{});db[_0x71aa('0xf1')][_0x71aa('0x128')](db['MailAccount'],{'foreignKey':_0x71aa('0x1ef'),'as':_0x71aa('0x1f0')});db['MailTransferReport'][_0x71aa('0x128')](db[_0x71aa('0x13')],{'foreignKey':_0x71aa('0x1f1'),'as':_0x71aa('0x1f2')});db[_0x71aa('0xf1')][_0x71aa('0x128')](db[_0x71aa('0x13')],{'foreignKey':_0x71aa('0x1f3'),'as':_0x71aa('0x1f4')});db[_0x71aa('0xf1')][_0x71aa('0x128')](db[_0x71aa('0x3e')],{'foreignKey':_0x71aa('0x1f5'),'as':_0x71aa('0x1f6')});db[_0x71aa('0xf1')][_0x71aa('0x128')](db['MailAccount'],{'foreignKey':_0x71aa('0x1f7'),'as':_0x71aa('0x1f8')});db[_0x71aa('0xf3')][_0x71aa('0x128')](db[_0x71aa('0x68')],{});db[_0x71aa('0xf3')][_0x71aa('0x128')](db[_0x71aa('0x66')],{});db[_0x71aa('0xf3')][_0x71aa('0x128')](db[_0x71aa('0x13f')],{'foreignKey':_0x71aa('0x1f9'),'as':_0x71aa('0x1f0')});db[_0x71aa('0xf3')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x71aa('0xf3')][_0x71aa('0x128')](db[_0x71aa('0x13')],{'foreignKey':_0x71aa('0x1f3'),'as':_0x71aa('0x1f4')});db[_0x71aa('0xf3')]['belongsTo'](db[_0x71aa('0x6a')],{'foreignKey':_0x71aa('0x1fa'),'as':_0x71aa('0x1f6')});db['ChatTransferReport'][_0x71aa('0x128')](db['ChatWebsite'],{'foreignKey':_0x71aa('0x1fb'),'as':_0x71aa('0x1f8')});db[_0x71aa('0x1fc')]['belongsTo'](db[_0x71aa('0x4e')],{});db[_0x71aa('0x1fc')][_0x71aa('0x128')](db[_0x71aa('0x4c')],{});db['FaxTransferReport']['belongsTo'](db[_0x71aa('0x49')],{'foreignKey':_0x71aa('0x1fd'),'as':'FromAccount'});db['FaxTransferReport'][_0x71aa('0x128')](db['User'],{'foreignKey':_0x71aa('0x1f1'),'as':_0x71aa('0x1f2')});db[_0x71aa('0x1fc')]['belongsTo'](db[_0x71aa('0x13')],{'foreignKey':_0x71aa('0x1f3'),'as':'ToAgent'});db['FaxTransferReport'][_0x71aa('0x128')](db[_0x71aa('0x4f')],{'foreignKey':_0x71aa('0x1fe'),'as':_0x71aa('0x1f6')});db[_0x71aa('0x1fc')][_0x71aa('0x128')](db[_0x71aa('0x49')],{'foreignKey':'ToFaxAccountId','as':_0x71aa('0x1f8')});db[_0x71aa('0xf5')][_0x71aa('0x128')](db['OpenchannelMessage'],{});db[_0x71aa('0xf5')]['belongsTo'](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport']['belongsTo'](db[_0x71aa('0x59')],{'foreignKey':_0x71aa('0x1ff'),'as':_0x71aa('0x1f0')});db[_0x71aa('0xf5')][_0x71aa('0x128')](db['User'],{'foreignKey':_0x71aa('0x1f1'),'as':_0x71aa('0x1f2')});db['OpenchannelTransferReport'][_0x71aa('0x128')](db['User'],{'foreignKey':'ToUserId','as':_0x71aa('0x1f4')});db[_0x71aa('0xf5')][_0x71aa('0x128')](db[_0x71aa('0x61')],{'foreignKey':_0x71aa('0x200'),'as':_0x71aa('0x1f6')});db[_0x71aa('0xf5')][_0x71aa('0x128')](db[_0x71aa('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':_0x71aa('0x1f8')});db[_0x71aa('0xf6')][_0x71aa('0x128')](db[_0x71aa('0x57')],{});db[_0x71aa('0xf6')]['belongsTo'](db[_0x71aa('0x56')],{});db['SmsTransferReport'][_0x71aa('0x128')](db[_0x71aa('0x52')],{'foreignKey':_0x71aa('0x201'),'as':'FromAccount'});db[_0x71aa('0xf6')][_0x71aa('0x128')](db[_0x71aa('0x13')],{'foreignKey':_0x71aa('0x1f1'),'as':'FromAgent'});db[_0x71aa('0xf6')][_0x71aa('0x128')](db[_0x71aa('0x13')],{'foreignKey':'ToUserId','as':_0x71aa('0x1f4')});db[_0x71aa('0xf6')]['belongsTo'](db[_0x71aa('0x58')],{'foreignKey':_0x71aa('0x202'),'as':_0x71aa('0x1f6')});db[_0x71aa('0xf6')][_0x71aa('0x128')](db[_0x71aa('0x52')],{'foreignKey':_0x71aa('0x203'),'as':'ToAccount'});db['CmList'][_0x71aa('0x11b')](db[_0x71aa('0x7f')],{'as':_0x71aa('0x16e'),'foreignKey':_0x71aa('0x174'),'onDelete':_0x71aa('0x118')});db[_0x71aa('0xf8')][_0x71aa('0x11b')](db['CmCustomField'],{'as':_0x71aa('0x204'),'foreignKey':'ListId'});db[_0x71aa('0xf8')]['hasMany'](db[_0x71aa('0x70')],{'as':_0x71aa('0x12c'),'onDelete':_0x71aa('0x118'),'foreignKey':'ListId'});db[_0x71aa('0xf8')][_0x71aa('0x11b')](db[_0x71aa('0x74')],{'as':_0x71aa('0x150'),'foreignKey':_0x71aa('0x174')});db['CmList']['hasMany'](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0x71aa('0x174')});db[_0x71aa('0xf8')][_0x71aa('0x11b')](db[_0x71aa('0x77')],{'as':_0x71aa('0x77'),'foreignKey':'ListId'});db['CmList'][_0x71aa('0x129')](db[_0x71aa('0x1c')],{'as':_0x71aa('0x205'),'through':_0x71aa('0x157')});db[_0x71aa('0xf8')]['belongsToMany'](db[_0x71aa('0x13')],{'as':_0x71aa('0x158'),'through':_0x71aa('0x13e')});db[_0x71aa('0xfa')][_0x71aa('0x11b')](db['VoiceExtension'],{'as':_0x71aa('0x11e'),'onDelete':'cascade'});db[_0x71aa('0xfa')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x71aa('0x113')});db[_0x71aa('0xfa')][_0x71aa('0x129')](db['Team'],{'through':'TeamVoicePrefix','as':_0x71aa('0x159')});db[_0x71aa('0xfc')]['hasMany'](db[_0x71aa('0x13')],{'as':_0x71aa('0x17d'),'foreignKey':_0x71aa('0x206')});db['UserProfile']['hasMany'](db[_0x71aa('0xfd')],{'as':'UserProfileSections','foreignKey':'userProfileId','onDelete':_0x71aa('0x118')});db['UserProfileSection'][_0x71aa('0x11b')](db['UserProfileResource'],{'as':'Resources','foreignKey':'sectionId','onDelete':_0x71aa('0x118')});db[_0x71aa('0x103')][_0x71aa('0x11b')](db[_0x71aa('0x7f')],{'as':_0x71aa('0x16e'),'foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0x71aa('0x103')][_0x71aa('0x11b')](db[_0x71aa('0x7d')],{'as':_0x71aa('0x16f'),'foreignKey':_0x71aa('0x207')});db[_0x71aa('0x103')][_0x71aa('0x11b')](db['WhatsappMessage'],{'as':_0x71aa('0x171'),'foreignKey':_0x71aa('0x207')});db['WhatsappAccount']['hasMany'](db[_0x71aa('0x106')],{'as':_0x71aa('0x172')});db['WhatsappAccount'][_0x71aa('0x11b')](db[_0x71aa('0x208')],{'as':'Applications'});db[_0x71aa('0x103')][_0x71aa('0x128')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['WhatsappAccount'][_0x71aa('0x128')](db['Pause'],{'as':_0x71aa('0x155'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount'][_0x71aa('0x129')](db['User'],{'as':_0x71aa('0x158'),'through':_0x71aa('0x147')});db[_0x71aa('0x208')][_0x71aa('0x128')](db[_0x71aa('0x13')],{'onDelete':_0x71aa('0x169')});db[_0x71aa('0x208')][_0x71aa('0x128')](db[_0x71aa('0x10d')],{'onDelete':'restrict'});db[_0x71aa('0x208')][_0x71aa('0x128')](db[_0x71aa('0x103')],{'onDelete':_0x71aa('0x169')});db['WhatsappApplication'][_0x71aa('0x128')](db[_0x71aa('0x82')],{'onDelete':'restrict','foreignKey':_0x71aa('0x184')});db['WhatsappApplication']['belongsTo'](db[_0x71aa('0x89')],{'onDelete':_0x71aa('0x169'),'foreignKey':_0x71aa('0x18a')});db[_0x71aa('0x106')][_0x71aa('0x11b')](db[_0x71aa('0x108')],{'as':_0x71aa('0x171'),'onDelete':_0x71aa('0x118'),'foreignKey':_0x71aa('0x209')});db[_0x71aa('0x106')][_0x71aa('0x128')](db[_0x71aa('0x103')],{'as':_0x71aa('0x178'),'foreignKey':_0x71aa('0x207')});db[_0x71aa('0x106')][_0x71aa('0x128')](db[_0x71aa('0x70')],{'as':'Contact','foreignKey':'ContactId'});db['WhatsappInteraction'][_0x71aa('0x128')](db[_0x71aa('0x13')],{'as':_0x71aa('0x179'),'foreignKey':_0x71aa('0x11a')});db[_0x71aa('0x106')][_0x71aa('0x129')](db[_0x71aa('0x89')],{'through':'whatsapp_interaction_has_tags','as':_0x71aa('0x17b')});db[_0x71aa('0x106')][_0x71aa('0x129')](db[_0x71aa('0x89')],{'through':_0x71aa('0x1c1'),'as':_0x71aa('0x17c')});db[_0x71aa('0x106')]['belongsToMany'](db[_0x71aa('0x13')],{'as':_0x71aa('0x17d'),'through':_0x71aa('0x133'),'foreignKey':_0x71aa('0x209')});db[_0x71aa('0x108')][_0x71aa('0x128')](db[_0x71aa('0x13')],{'as':_0x71aa('0x13')});db[_0x71aa('0x108')][_0x71aa('0x128')](db[_0x71aa('0x70')],{'onDelete':'cascade','as':_0x71aa('0x164')});db[_0x71aa('0x108')][_0x71aa('0x128')](db[_0x71aa('0x106')],{'onDelete':_0x71aa('0x118'),'as':_0x71aa('0x180'),'foreignKey':_0x71aa('0x209')});db[_0x71aa('0x108')][_0x71aa('0x128')](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x71aa('0x207')});db['WhatsappQueueReport'][_0x71aa('0x128')](db[_0x71aa('0x103')],{});db[_0x71aa('0x10a')][_0x71aa('0x128')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x71aa('0x10a')][_0x71aa('0x128')](db[_0x71aa('0x70')],{'as':_0x71aa('0x164'),'foreignKey':'ContactId'});db[_0x71aa('0x10a')]['belongsTo'](db[_0x71aa('0x106')],{});db['WhatsappQueueReport'][_0x71aa('0x128')](db[_0x71aa('0x10d')],{});db[_0x71aa('0x10a')]['belongsTo'](db[_0x71aa('0x108')],{});db['WhatsappQueueReport'][_0x71aa('0x128')](db[_0x71aa('0x13')],{});db[_0x71aa('0x20a')][_0x71aa('0x128')](db['WhatsappMessage'],{});db['WhatsappTransferReport'][_0x71aa('0x128')](db[_0x71aa('0x106')],{});db[_0x71aa('0x20a')]['belongsTo'](db[_0x71aa('0x103')],{'foreignKey':'FromWhatsappAccountId','as':_0x71aa('0x1f0')});db[_0x71aa('0x20a')][_0x71aa('0x128')](db[_0x71aa('0x103')],{'foreignKey':_0x71aa('0x20b'),'as':_0x71aa('0x1f8')});db['WhatsappTransferReport'][_0x71aa('0x128')](db[_0x71aa('0x10d')],{'foreignKey':_0x71aa('0x20c'),'as':_0x71aa('0x1f6')});db[_0x71aa('0x20a')]['belongsTo'](db[_0x71aa('0x13')],{'foreignKey':_0x71aa('0x1f1'),'as':_0x71aa('0x1f2')});db[_0x71aa('0x20a')][_0x71aa('0x128')](db[_0x71aa('0x13')],{'foreignKey':_0x71aa('0x1f3'),'as':_0x71aa('0x1f4')});db['WhatsappQueue']['belongsToMany'](db[_0x71aa('0x13')],{'as':_0x71aa('0x158'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0x71aa('0x10d')]['belongsToMany'](db[_0x71aa('0xe6')],{'through':'team_has_whatsapp_queues','as':_0x71aa('0x159')});db['UserSetting'][_0x71aa('0x128')](db[_0x71aa('0x13')],{'as':_0x71aa('0x20d'),'foreignKey':_0x71aa('0x11a'),'onDelete':_0x71aa('0x118'),'hooks':!![]});db['CloudProvider'][_0x71aa('0x117')](db[_0x71aa('0xc1')],{'as':_0x71aa('0xc1'),'onDelete':_0x71aa('0x169')});db[_0x71aa('0x168')]['hasOne'](db['MailServerIn'],{'as':_0x71aa('0x16c'),'onDelete':_0x71aa('0x169')});db[_0x71aa('0x168')][_0x71aa('0x117')](db[_0x71aa('0x16a')],{'as':_0x71aa('0x16d'),'onDelete':'restrict'});module[_0x71aa('0x20e')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x4ec5=['CloudProvider','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Interactions','List','ListId','Template','TemplateId','mandatoryDispositionPause','team_has_mail_queues','MailInteractionId','Owner','mail_interaction_has_tags','Users','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','IntervalId','MailQueueReport','Items','FaxAccountId','CannedAnswer','Applications','Exntensions','FaxApplication','TagId','FaxInteractionId','fax_interaction_has_tags','Tags','ThroughTags','user_has_fax_interactions','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','team_has_sms_queues','OpenchannelAccount','OpenchannelAccountId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','Teams','Queue','ChatQueueId','Website','ChatMessage','chat_interaction_has_tags','ChatInteractionId','Attachments','team_has_chat_queues','ChatGroupId','Members','CompanyId','Phones','CmContactId','HopperHistories','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Agent','Campaign','CampaignId','OwnerId','Automation','Any','OneAny','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Trigger','AllConditions','AllCondition','AnyConditions','AnyCondition','Actions','TriggerId','Fields','MetricId','AnalyticMetric','AccountId','SubjectId','Descriptions','DescriptionId','FieldId','Description','Field','VariableId','Configurations','Subject','Subjects','int_desk_configuration_has_tags','ZohoConfiguration','ZohoField','ZohoAccount','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowConfiguration','ServicenowField','ChatInternalMessage','ToId','JscriptyProject','ProjectId','SquareProject','SmsQueues','OpenchannelQueues','team_has_whatsapp_queues','WhatsappQueues','HopperBlacks','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','ChatTransferReport','FromChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','userProfileId','UserProfileSections','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','lodash','jstz','determine','sequelize','motion2','xcall','utf8mb4','name','utf8','utf8_general_ci','defaultsDeep','mysql','database','password','options','sequelizeHistory','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareRecording','SquareMessage','Team','License','Migration','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','UserId','userSetting','cascade','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','CmHopperFinal','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','belongsToMany','ChatGroup','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefix','VoicePrefixes','UserVoicePrefix','MailQueues','FaxQueues','OpenchannelQueue','UserOpenchannelQueue','ChatWebsites','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_square_projects','SpiedAgents','VoiceContext','Sounds','moh_has_sounds','VoiceQueueId','Hoppers','JscriptySessions','TrunkId','TrunkBackup','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceQueueReport','uniqueid','VoiceAgentReport','AgentReports','CmContact','Contact','ContactId','MailAccountId'];(function(_0x346937,_0x336553){var _0x3e32ac=function(_0x160947){while(--_0x160947){_0x346937['push'](_0x346937['shift']());}};_0x3e32ac(++_0x336553);}(_0x4ec5,0xa8));var _0x54ec=function(_0x13d641,_0x333d30){_0x13d641=_0x13d641-0x0;var _0x16bc56=_0x4ec5[_0x13d641];return _0x16bc56;};'use strict';var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0x54ec('0x0'));var jstz=require(_0x54ec('0x1'));var timezone=jstz[_0x54ec('0x2')]();config[_0x54ec('0x3')]=_['defaultsDeep'](config[_0x54ec('0x3')],{'database':_0x54ec('0x4'),'username':_0x54ec('0x5'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x54ec('0x6')},'logging':![],'timezone':timezone[_0x54ec('0x7')](),'define':{'charset':_0x54ec('0x8'),'collate':_0x54ec('0x9')}}});config['sequelizeHistory']=_[_0x54ec('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x54ec('0x5'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x54ec('0xb'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x54ec('0x7')](),'define':{'charset':_0x54ec('0x8'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x54ec('0x3')][_0x54ec('0xc')],config[_0x54ec('0x3')]['username'],config[_0x54ec('0x3')][_0x54ec('0xd')],config[_0x54ec('0x3')][_0x54ec('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x54ec('0xf')]['database'],config[_0x54ec('0xf')]['username'],config[_0x54ec('0xf')][_0x54ec('0xd')],config[_0x54ec('0xf')][_0x54ec('0xe')])};db[_0x54ec('0x10')]=db['sequelize'][_0x54ec('0x11')](_0x54ec('0x12'));db[_0x54ec('0x13')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x14'));db['VoiceContext']=db[_0x54ec('0x3')][_0x54ec('0x11')]('../api/voiceContext/voiceContext.model');db[_0x54ec('0x15')]=db[_0x54ec('0x3')]['import'](_0x54ec('0x16'));db[_0x54ec('0x17')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x18'));db[_0x54ec('0x19')]=db['sequelize'][_0x54ec('0x11')](_0x54ec('0x1a'));db['VoiceRecording']=db[_0x54ec('0x3')][_0x54ec('0x11')]('../api/voiceRecording/voiceRecording.model');db[_0x54ec('0x1b')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x1c'));db[_0x54ec('0x1d')]=db['sequelize']['import'](_0x54ec('0x1e'));db[_0x54ec('0x1f')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x20'));db[_0x54ec('0x21')]=db[_0x54ec('0x3')][_0x54ec('0x11')]('../api/voiceCallReport/voiceCallReport.model');db['VoiceDialReport']=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x22'));db['VoiceAgentReport']=db[_0x54ec('0x3')]['import'](_0x54ec('0x23'));db['VoiceQueueReport']=db[_0x54ec('0x3')][_0x54ec('0x11')]('../api/voiceQueueReport/voiceQueueReport.model');db['MemberReport']=db['sequelize'][_0x54ec('0x11')](_0x54ec('0x24'));db[_0x54ec('0x25')]=db[_0x54ec('0x3')]['import']('../api/trunk/trunk.model');db[_0x54ec('0x26')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x27'));db[_0x54ec('0x28')]=db['sequelize'][_0x54ec('0x11')](_0x54ec('0x29'));db[_0x54ec('0x2a')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x2b'));db[_0x54ec('0x2c')]=db[_0x54ec('0x3')]['import'](_0x54ec('0x2d'));db[_0x54ec('0x2e')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x2f'));db[_0x54ec('0x30')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x31'));db[_0x54ec('0x32')]=db['sequelize'][_0x54ec('0x11')]('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x33'));db[_0x54ec('0x34')]=db[_0x54ec('0x3')]['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x54ec('0x35')]=db[_0x54ec('0x3')]['import'](_0x54ec('0x36'));db[_0x54ec('0x37')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x38'));db[_0x54ec('0x39')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x3a'));db[_0x54ec('0x3b')]=db[_0x54ec('0x3')][_0x54ec('0x11')]('../api/mailQueue/mailQueue.model');db[_0x54ec('0x3c')]=db['sequelize'][_0x54ec('0x11')](_0x54ec('0x3d'));db['MailInteraction']=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x3e'));db[_0x54ec('0x3f')]=db[_0x54ec('0x3')]['import'](_0x54ec('0x40'));db[_0x54ec('0x41')]=db['sequelize'][_0x54ec('0x11')](_0x54ec('0x42'));db['MailQueueReport']=db['sequelize'][_0x54ec('0x11')](_0x54ec('0x43'));db[_0x54ec('0x44')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x45'));db[_0x54ec('0x46')]=db['sequelize'][_0x54ec('0x11')](_0x54ec('0x47'));db[_0x54ec('0x48')]=db[_0x54ec('0x3')]['import']('../api/faxAccount/faxAccount.model');db['FaxApplication']=db[_0x54ec('0x3')]['import'](_0x54ec('0x49'));db[_0x54ec('0x4a')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x4b'));db[_0x54ec('0x4c')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x4d'));db[_0x54ec('0x4e')]=db[_0x54ec('0x3')][_0x54ec('0x11')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x4f'));db[_0x54ec('0x50')]=db['sequelize'][_0x54ec('0x11')](_0x54ec('0x51'));db['SmsApplication']=db['sequelize'][_0x54ec('0x11')](_0x54ec('0x52'));db[_0x54ec('0x53')]=db[_0x54ec('0x3')]['import'](_0x54ec('0x54'));db[_0x54ec('0x55')]=db['sequelize'][_0x54ec('0x11')](_0x54ec('0x56'));db[_0x54ec('0x57')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x58'));db['OpenchannelAccount']=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x59'));db[_0x54ec('0x5a')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x5b'));db[_0x54ec('0x5c')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x5d'));db[_0x54ec('0x5e')]=db['sequelize'][_0x54ec('0x11')](_0x54ec('0x5f'));db['OpenchannelQueue']=db[_0x54ec('0x3')][_0x54ec('0x11')]('../api/openchannelQueue/openchannelQueue.model');db[_0x54ec('0x60')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x61'));db[_0x54ec('0x62')]=db['sequelize'][_0x54ec('0x11')](_0x54ec('0x63'));db[_0x54ec('0x64')]=db[_0x54ec('0x3')]['import'](_0x54ec('0x65'));db[_0x54ec('0x66')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x67'));db['ChatMessage']=db[_0x54ec('0x3')]['import'](_0x54ec('0x68'));db[_0x54ec('0x69')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x6a'));db[_0x54ec('0x6b')]=db[_0x54ec('0x3')][_0x54ec('0x11')]('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0x54ec('0x3')]['import'](_0x54ec('0x6c'));db[_0x54ec('0x6d')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x6e'));db[_0x54ec('0x6f')]=db[_0x54ec('0x3')]['import'](_0x54ec('0x70'));db['CmContact']=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x71'));db[_0x54ec('0x72')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x73'));db[_0x54ec('0x74')]=db[_0x54ec('0x3')][_0x54ec('0x11')]('../api/cmHopperBlack/cmHopperBlack.model');db['CmHopperFinal']=db[_0x54ec('0x3')][_0x54ec('0x11')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x54ec('0x75')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x76'));db[_0x54ec('0x77')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x78'));db[_0x54ec('0x79')]=db['sequelize'][_0x54ec('0x11')]('../api/cmCustomField/cmCustomField.model');db[_0x54ec('0x7a')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x7b'));db['Automation']=db[_0x54ec('0x3')]['import']('../api/automation/automation.model');db['CannedAnswer']=db[_0x54ec('0x3')]['import']('../api/cannedAnswer/cannedAnswer.model');db[_0x54ec('0x7c')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x7d'));db[_0x54ec('0x7e')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x7f'));db[_0x54ec('0x80')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x81'));db[_0x54ec('0x82')]=db['sequelize']['import'](_0x54ec('0x83'));db['Cdr']=db['sequelize'][_0x54ec('0x11')](_0x54ec('0x84'));db[_0x54ec('0x85')]=db[_0x54ec('0x3')][_0x54ec('0x11')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x54ec('0x86')]=db[_0x54ec('0x3')]['import'](_0x54ec('0x87'));db[_0x54ec('0x88')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x89'));db[_0x54ec('0x8a')]=db[_0x54ec('0x3')]['import']('../api/tag/tag.model');db[_0x54ec('0x8b')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x8c'));db[_0x54ec('0x8d')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x8e'));db[_0x54ec('0x8f')]=db[_0x54ec('0x3')]['import'](_0x54ec('0x90'));db['Template']=db['sequelize']['import'](_0x54ec('0x91'));db['Trigger']=db[_0x54ec('0x3')]['import']('../api/trigger/trigger.model');db[_0x54ec('0x92')]=db['sequelize'][_0x54ec('0x11')]('../api/variable/variable.model');db[_0x54ec('0x93')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x94'));db[_0x54ec('0x95')]=db['sequelize'][_0x54ec('0x11')](_0x54ec('0x96'));db[_0x54ec('0x97')]=db[_0x54ec('0x3')]['import'](_0x54ec('0x98'));db['AnalyticDefaultReport']=db['sequelize'][_0x54ec('0x11')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x99'));db['AnalyticMetric']=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x9a'));db[_0x54ec('0x9b')]=db['sequelize'][_0x54ec('0x11')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0x54ec('0x3')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x54ec('0x9c')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x9d'));db[_0x54ec('0x9e')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x9f'));db[_0x54ec('0xa0')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0xa1'));db[_0x54ec('0xa2')]=db[_0x54ec('0x3')]['import']('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x54ec('0xa3')]=db[_0x54ec('0x3')]['import'](_0x54ec('0xa4'));db[_0x54ec('0xa5')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0xa6'));db[_0x54ec('0xa7')]=db['sequelize']['import'](_0x54ec('0xa8'));db[_0x54ec('0xa9')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0xaa'));db[_0x54ec('0xab')]=db[_0x54ec('0x3')]['import'](_0x54ec('0xac'));db['ZohoAccount']=db['sequelize'][_0x54ec('0x11')]('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db[_0x54ec('0x3')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0xad'));db[_0x54ec('0xae')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0xaf'));db[_0x54ec('0xb0')]=db[_0x54ec('0x3')]['import'](_0x54ec('0xb1'));db[_0x54ec('0xb2')]=db[_0x54ec('0x3')]['import'](_0x54ec('0xb3'));db['FreshdeskAccount']=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0xb4'));db[_0x54ec('0xb5')]=db[_0x54ec('0x3')]['import'](_0x54ec('0xb6'));db[_0x54ec('0xb7')]=db['sequelize'][_0x54ec('0x11')](_0x54ec('0xb8'));db['VtigerAccount']=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0xb9'));db[_0x54ec('0xba')]=db[_0x54ec('0x3')]['import'](_0x54ec('0xbb'));db[_0x54ec('0xbc')]=db[_0x54ec('0x3')]['import'](_0x54ec('0xbd'));db[_0x54ec('0xbe')]=db['sequelize'][_0x54ec('0x11')]('../api/intServicenowAccount/intServicenowAccount.model');db['ServicenowConfiguration']=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0xbf'));db['ServicenowField']=db['sequelize']['import'](_0x54ec('0xc0'));db[_0x54ec('0xc1')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0xc2'));db[_0x54ec('0xc3')]=db['sequelize'][_0x54ec('0x11')](_0x54ec('0xc4'));db[_0x54ec('0xc5')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0xc6'));db[_0x54ec('0xc7')]=db['sequelize'][_0x54ec('0x11')](_0x54ec('0xc8'));db[_0x54ec('0xc9')]=db[_0x54ec('0x3')]['import'](_0x54ec('0xca'));db[_0x54ec('0xcb')]=db['sequelize'][_0x54ec('0x11')]('../api/intFreshsalesField/intFreshsalesField.model');db[_0x54ec('0x93')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x94'));db['Network']=db['sequelize']['import'](_0x54ec('0xcc'));db[_0x54ec('0xcd')]=db['sequelize']['import'](_0x54ec('0xce'));db['ChatInternalMessage']=db[_0x54ec('0x3')][_0x54ec('0x11')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x54ec('0xcf')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0xd0'));db[_0x54ec('0xd1')]=db['sequelize'][_0x54ec('0x11')](_0x54ec('0xd2'));db[_0x54ec('0xd3')]=db[_0x54ec('0x3')][_0x54ec('0x11')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x54ec('0xd4')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0xd5'));db[_0x54ec('0xd6')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0xd7'));db[_0x54ec('0xd8')]=db[_0x54ec('0x3')][_0x54ec('0x11')]('../api/squareReportDetail/squareReportDetail.model');db['JscriptyProject']=db[_0x54ec('0x3')]['import'](_0x54ec('0xd9'));db[_0x54ec('0xda')]=db[_0x54ec('0x3')]['import'](_0x54ec('0xdb'));db[_0x54ec('0xdc')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0xdd'));db['SquareProject']=db[_0x54ec('0x3')]['import']('../api/squareProject/squareProject.model');db[_0x54ec('0xde')]=db[_0x54ec('0x3')][_0x54ec('0x11')]('../api/squareRecording/squareRecording.model');db[_0x54ec('0xdf')]=db['sequelize'][_0x54ec('0x11')]('../api/squareMessage/squareMessage.model');db[_0x54ec('0xe0')]=db[_0x54ec('0x3')][_0x54ec('0x11')]('../api/team/team.model');db[_0x54ec('0xe1')]=db['sequelize']['import']('../api/license/license.model');db['Campaign']=db[_0x54ec('0x3')][_0x54ec('0x11')]('../api/campaign/campaign.model');db[_0x54ec('0xe2')]=db[_0x54ec('0x3')]['import']('../api/migration/migration.model');db[_0x54ec('0xe3')]=db[_0x54ec('0x3')]['import'](_0x54ec('0xe4'));db[_0x54ec('0xe5')]=db['sequelize'][_0x54ec('0x11')]('../api/plugin/plugin.model');db[_0x54ec('0xe6')]=db['sequelize']['import'](_0x54ec('0xe7'));db['ChatTransferReport']=db['sequelize'][_0x54ec('0x11')](_0x54ec('0xe8'));db[_0x54ec('0xe9')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0xea'));db[_0x54ec('0xeb')]=db['sequelize'][_0x54ec('0x11')]('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0x54ec('0xec')]=db[_0x54ec('0x3')]['import'](_0x54ec('0xed'));db[_0x54ec('0xee')]=db['sequelize'][_0x54ec('0x11')](_0x54ec('0xef'));db['VoicePrefix']=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0xf0'));db[_0x54ec('0xf1')]=db['sequelize'][_0x54ec('0x11')]('../api/userProfile/userProfile.model');db[_0x54ec('0xf2')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0xf3'));db[_0x54ec('0xf4')]=db['sequelize']['import']('../api/userProfileResource/userProfileResource.model');db[_0x54ec('0xf5')]=db['sequelize'][_0x54ec('0x11')]('../api/userNotification/userNotification.model');db['WhatsappAccount']=db['sequelize']['import']('../api/whatsappAccount/whatsappAccount.model');db[_0x54ec('0xf6')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0xf7'));db[_0x54ec('0xf8')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0xf9'));db[_0x54ec('0xfa')]=db[_0x54ec('0x3')][_0x54ec('0x11')]('../api/whatsappMessage/whatsappMessage.model');db[_0x54ec('0xfb')]=db[_0x54ec('0x3')]['import'](_0x54ec('0xfc'));db[_0x54ec('0xfd')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0xfe'));db[_0x54ec('0xff')]=db[_0x54ec('0x3')]['import']('../api/whatsappQueue/whatsappQueue.model');db['CloudProvider']=db[_0x54ec('0x3')]['import']('../api/cloudProvider/cloudProvider.model');db[_0x54ec('0x100')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x101'));db[_0x54ec('0x102')]=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x103'));db['UserVoicePrefix']=db[_0x54ec('0x3')][_0x54ec('0x11')](_0x54ec('0x104'));db[_0x54ec('0x105')]=db[_0x54ec('0x3')]['import'](_0x54ec('0x106'));db[_0x54ec('0x10')][_0x54ec('0x107')](db[_0x54ec('0x1d')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':_0x54ec('0x108')});db[_0x54ec('0x10')][_0x54ec('0x107')](db[_0x54ec('0x105')],{'as':_0x54ec('0x109'),'onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x108')});db[_0x54ec('0x10')][_0x54ec('0x10b')](db[_0x54ec('0x10c')],{'as':_0x54ec('0x10d'),'foreignKey':_0x54ec('0x108')});db[_0x54ec('0x10')]['hasMany'](db[_0x54ec('0x28')],{'as':_0x54ec('0x10e'),'foreignKey':'UserId'});db['User'][_0x54ec('0x10b')](db['VoiceExtension'],{'as':_0x54ec('0x10f'),'onDelete':_0x54ec('0x10a'),'hooks':!![]});db[_0x54ec('0x10')][_0x54ec('0x10b')](db[_0x54ec('0x110')],{'as':_0x54ec('0x111'),'foreignKey':_0x54ec('0x108')});db[_0x54ec('0x10')][_0x54ec('0x10b')](db[_0x54ec('0x75')],{'as':_0x54ec('0x112'),'foreignKey':'UserId'});db[_0x54ec('0x10')][_0x54ec('0x10b')](db[_0x54ec('0x77')],{'as':'ReportAgentPreview','foreignKey':_0x54ec('0x108')});db[_0x54ec('0x10')][_0x54ec('0x10b')](db[_0x54ec('0x5c')],{'as':_0x54ec('0x113'),'foreignKey':_0x54ec('0x108')});db['User'][_0x54ec('0x10b')](db[_0x54ec('0x66')],{'as':_0x54ec('0x114'),'foreignKey':_0x54ec('0x108')});db['User'][_0x54ec('0x10b')](db[_0x54ec('0x53')],{'as':_0x54ec('0x115'),'foreignKey':_0x54ec('0x108')});db[_0x54ec('0x10')][_0x54ec('0x10b')](db[_0x54ec('0x4a')],{'as':_0x54ec('0x116'),'foreignKey':_0x54ec('0x108')});db[_0x54ec('0x10')]['hasMany'](db[_0x54ec('0x117')],{'as':_0x54ec('0x118'),'foreignKey':_0x54ec('0x108')});db[_0x54ec('0x10')][_0x54ec('0x10b')](db[_0x54ec('0xf8')],{'as':_0x54ec('0x119'),'foreignKey':'UserId'});db[_0x54ec('0x10')][_0x54ec('0x10b')](db[_0x54ec('0xf5')],{'as':_0x54ec('0x11a'),'foreignKey':_0x54ec('0x11b')});db[_0x54ec('0x10')][_0x54ec('0x11c')](db[_0x54ec('0xf1')],{'as':_0x54ec('0xf1'),'foreignKey':'userProfileId'});db[_0x54ec('0x10')][_0x54ec('0x11d')](db[_0x54ec('0x11e')],{'as':'Groups','through':_0x54ec('0x11f')});db[_0x54ec('0x10')][_0x54ec('0x11d')](db['CmContact'],{'as':_0x54ec('0x120'),'through':_0x54ec('0x121')});db['User'][_0x54ec('0x11d')](db[_0x54ec('0xee')],{'as':_0x54ec('0x122'),'through':_0x54ec('0x123')});db[_0x54ec('0x10')][_0x54ec('0x11d')](db[_0x54ec('0xe0')],{'through':_0x54ec('0x124')});db['User'][_0x54ec('0x11d')](db[_0x54ec('0x117')],{'as':_0x54ec('0x118'),'through':_0x54ec('0x125')});db[_0x54ec('0x10')]['belongsToMany'](db[_0x54ec('0x66')],{'as':_0x54ec('0x114'),'through':_0x54ec('0x126')});db[_0x54ec('0x10')][_0x54ec('0x11d')](db[_0x54ec('0x4a')],{'as':_0x54ec('0x116'),'through':'user_has_fax_interactions'});db['User'][_0x54ec('0x11d')](db['SmsInteraction'],{'as':'SmsInteractions','through':_0x54ec('0x127')});db[_0x54ec('0x10')][_0x54ec('0x11d')](db[_0x54ec('0x5c')],{'as':_0x54ec('0x113'),'through':_0x54ec('0x128')});db[_0x54ec('0x10')][_0x54ec('0x11d')](db[_0x54ec('0xf8')],{'as':'WhatsappInteractions','through':_0x54ec('0x129')});db[_0x54ec('0x10')][_0x54ec('0x11d')](db[_0x54ec('0x19')],{'as':_0x54ec('0x12a'),'through':_0x54ec('0x2a'),'required':![]});db[_0x54ec('0x10')][_0x54ec('0x11d')](db[_0x54ec('0x12b')],{'as':_0x54ec('0x12c'),'through':_0x54ec('0x12d'),'required':![]});db[_0x54ec('0x10')][_0x54ec('0x11d')](db['MailQueue'],{'as':_0x54ec('0x12e'),'through':'UserMailQueue','required':![]});db[_0x54ec('0x10')][_0x54ec('0x11d')](db['ChatQueue'],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db['User'][_0x54ec('0x11d')](db[_0x54ec('0x4e')],{'as':_0x54ec('0x12f'),'through':'UserFaxQueue','required':![]});db[_0x54ec('0x10')][_0x54ec('0x11d')](db[_0x54ec('0x57')],{'as':'SmsQueues','through':_0x54ec('0x32'),'required':![]});db[_0x54ec('0x10')][_0x54ec('0x11d')](db[_0x54ec('0x130')],{'as':'OpenchannelQueues','through':_0x54ec('0x131'),'required':![]});db['User']['belongsToMany'](db[_0x54ec('0xff')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db['User']['belongsToMany'](db[_0x54ec('0xee')],{'through':_0x54ec('0x123')});db[_0x54ec('0x10')][_0x54ec('0x11d')](db[_0x54ec('0x60')],{'as':_0x54ec('0x132'),'through':'user_has_chat_websites'});db[_0x54ec('0x10')]['belongsToMany'](db['FaxAccount'],{'as':'FaxAccounts','through':_0x54ec('0x133')});db[_0x54ec('0x10')]['belongsToMany'](db[_0x54ec('0x39')],{'as':'MailAccounts','through':_0x54ec('0x134')});db[_0x54ec('0x10')][_0x54ec('0x11d')](db['OpenchannelAccount'],{'as':_0x54ec('0x135'),'through':_0x54ec('0x136')});db[_0x54ec('0x10')]['belongsToMany'](db[_0x54ec('0x50')],{'as':_0x54ec('0x137'),'through':_0x54ec('0x138')});db['User'][_0x54ec('0x11d')](db[_0x54ec('0x139')],{'as':_0x54ec('0x13a'),'through':'user_has_whatsapp_accounts'});db[_0x54ec('0x10')]['belongsToMany'](db['SquareProject'],{'as':'SquareProjects','through':_0x54ec('0x13b')});db[_0x54ec('0x13')][_0x54ec('0x10b')](db[_0x54ec('0x15')],{'as':_0x54ec('0x13c'),'onDelete':_0x54ec('0x10a'),'foreignKey':'ChanSpyId'});db[_0x54ec('0x13d')][_0x54ec('0x10b')](db['VoiceExtension'],{'onDelete':'cascade'});db[_0x54ec('0x15')][_0x54ec('0x10b')](db[_0x54ec('0x15')],{'as':'Applications','onDelete':'cascade'});db[_0x54ec('0x17')][_0x54ec('0x11d')](db[_0x54ec('0x88')],{'as':_0x54ec('0x13e'),'through':_0x54ec('0x13f')});db[_0x54ec('0x19')][_0x54ec('0x10b')](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':_0x54ec('0x140')});db[_0x54ec('0x19')][_0x54ec('0x10b')](db[_0x54ec('0x72')],{'as':_0x54ec('0x141'),'foreignKey':_0x54ec('0x140')});db[_0x54ec('0x19')][_0x54ec('0x10b')](db[_0x54ec('0x110')],{'as':_0x54ec('0x111'),'foreignKey':'VoiceQueueId'});db[_0x54ec('0x19')][_0x54ec('0x10b')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x54ec('0x140')});db[_0x54ec('0x19')][_0x54ec('0x10b')](db[_0x54ec('0x77')],{'as':'ReportAgentPreview','foreignKey':_0x54ec('0x140')});db[_0x54ec('0x19')][_0x54ec('0x10b')](db[_0x54ec('0x74')],{'as':'HopperBlacks','foreignKey':_0x54ec('0x140')});db[_0x54ec('0x19')][_0x54ec('0x10b')](db[_0x54ec('0xd3')],{'as':_0x54ec('0x142'),'foreignKey':'VoiceQueueId'});db[_0x54ec('0x19')]['belongsTo'](db[_0x54ec('0x25')],{'as':_0x54ec('0x25'),'foreignKey':_0x54ec('0x143')});db[_0x54ec('0x19')][_0x54ec('0x11c')](db['Trunk'],{'as':_0x54ec('0x144'),'foreignKey':'TrunkBackupId'});db[_0x54ec('0x19')][_0x54ec('0x11c')](db[_0x54ec('0x80')],{'as':_0x54ec('0x80'),'foreignKey':'IntervalId'});db[_0x54ec('0x19')][_0x54ec('0x11c')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x54ec('0x145')});db[_0x54ec('0x19')]['belongsToMany'](db[_0x54ec('0xee')],{'as':_0x54ec('0x122'),'through':_0x54ec('0x146')});db[_0x54ec('0x19')]['belongsToMany'](db[_0x54ec('0x10')],{'as':_0x54ec('0x147'),'through':_0x54ec('0x2a')});db[_0x54ec('0x19')][_0x54ec('0x11d')](db[_0x54ec('0xe0')],{'as':'Teams','through':_0x54ec('0x100')});db['VoiceQueue'][_0x54ec('0x11d')](db[_0x54ec('0xee')],{'as':_0x54ec('0x148'),'through':_0x54ec('0x149')});db['VoiceRecording'][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'as':'User','foreignKey':'UserId'});db[_0x54ec('0x1b')][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'as':_0x54ec('0x10'),'foreignKey':_0x54ec('0x108')});db[_0x54ec('0x1d')][_0x54ec('0x10b')](db[_0x54ec('0x1f')],{'as':_0x54ec('0x14a'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':_0x54ec('0x14b')});db[_0x54ec('0x1f')][_0x54ec('0x11c')](db[_0x54ec('0x1d')],{'foreignKey':_0x54ec('0x14c'),'targetKey':'mailbox'});db[_0x54ec('0x21')][_0x54ec('0x10b')](db[_0x54ec('0x14d')],{'as':'QueueCalls','foreignKey':_0x54ec('0x14e'),'constraints':![]});db[_0x54ec('0x21')][_0x54ec('0x10b')](db[_0x54ec('0x14f')],{'as':_0x54ec('0x150'),'foreignKey':_0x54ec('0x14e'),'constraints':![]});db[_0x54ec('0x21')]['belongsTo'](db[_0x54ec('0x10')],{'as':'User','foreignKey':_0x54ec('0x108')});db[_0x54ec('0x21')][_0x54ec('0x11c')](db[_0x54ec('0x151')],{'as':_0x54ec('0x152'),'foreignKey':_0x54ec('0x153')});db['MailServerIn']['belongsTo'](db[_0x54ec('0x39')],{'as':_0x54ec('0x39'),'foreignKey':_0x54ec('0x154')});db[_0x54ec('0x35')]['belongsTo'](db[_0x54ec('0x155')],{'as':'CloudProvider','foreignKey':'CloudProviderId','onDelete':'restrict'});db['MailServerOut'][_0x54ec('0x11c')](db[_0x54ec('0x39')],{'as':_0x54ec('0x39'),'foreignKey':'MailAccountId'});db[_0x54ec('0x37')][_0x54ec('0x11c')](db[_0x54ec('0x155')],{'as':_0x54ec('0x155'),'foreignKey':_0x54ec('0x156'),'onDelete':_0x54ec('0x157')});db[_0x54ec('0x39')][_0x54ec('0x107')](db[_0x54ec('0x35')],{'as':_0x54ec('0x158'),'onDelete':'cascade'});db[_0x54ec('0x39')]['hasOne'](db[_0x54ec('0x37')],{'as':_0x54ec('0x159'),'onDelete':_0x54ec('0x10a')});db[_0x54ec('0x39')]['hasMany'](db['Disposition'],{'as':_0x54ec('0x15a'),'foreignKey':_0x54ec('0x154'),'onDelete':'cascade'});db[_0x54ec('0x39')][_0x54ec('0x10b')](db['CannedAnswer'],{'as':_0x54ec('0x15b'),'foreignKey':_0x54ec('0x154')});db['MailAccount']['hasMany'](db['MailMessage'],{'as':_0x54ec('0x14a'),'foreignKey':_0x54ec('0x154')});db[_0x54ec('0x39')][_0x54ec('0x10b')](db[_0x54ec('0x117')],{'as':_0x54ec('0x15c')});db[_0x54ec('0x39')][_0x54ec('0x10b')](db['MailApplication'],{'as':'Applications'});db['MailAccount'][_0x54ec('0x11c')](db[_0x54ec('0xee')],{'as':_0x54ec('0x15d'),'foreignKey':_0x54ec('0x15e')});db[_0x54ec('0x39')]['belongsTo'](db[_0x54ec('0x15f')],{'as':_0x54ec('0x15f'),'foreignKey':_0x54ec('0x160')});db[_0x54ec('0x39')][_0x54ec('0x11c')](db[_0x54ec('0x82')],{'as':_0x54ec('0x161'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x54ec('0x39')]['belongsToMany'](db[_0x54ec('0x10')],{'as':_0x54ec('0x147'),'through':_0x54ec('0x134')});db[_0x54ec('0x3b')]['belongsToMany'](db[_0x54ec('0x10')],{'as':_0x54ec('0x147'),'through':_0x54ec('0x2e')});db[_0x54ec('0x3b')][_0x54ec('0x11d')](db[_0x54ec('0xe0')],{'through':_0x54ec('0x162'),'as':'Teams'});db['MailInteraction'][_0x54ec('0x10b')](db[_0x54ec('0x3f')],{'as':'Messages','onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x163')});db[_0x54ec('0x117')][_0x54ec('0x11c')](db[_0x54ec('0x39')],{'as':'Account','foreignKey':_0x54ec('0x154')});db[_0x54ec('0x117')][_0x54ec('0x11c')](db[_0x54ec('0x151')],{'as':_0x54ec('0x152'),'foreignKey':'ContactId'});db[_0x54ec('0x117')][_0x54ec('0x11c')](db['User'],{'as':_0x54ec('0x164'),'foreignKey':_0x54ec('0x108')});db['MailInteraction']['belongsToMany'](db['Tag'],{'through':'mail_interaction_has_tags','as':'Tags'});db[_0x54ec('0x117')]['belongsToMany'](db[_0x54ec('0x8a')],{'through':_0x54ec('0x165'),'as':'ThroughTags'});db[_0x54ec('0x117')][_0x54ec('0x11d')](db[_0x54ec('0x10')],{'as':_0x54ec('0x166'),'through':_0x54ec('0x125'),'foreignKey':_0x54ec('0x163')});db[_0x54ec('0x3f')][_0x54ec('0x10b')](db[_0x54ec('0xe3')],{'as':'Attachments','onDelete':_0x54ec('0x10a')});db[_0x54ec('0x3f')][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'as':_0x54ec('0x10')});db[_0x54ec('0x3f')][_0x54ec('0x11c')](db['CmContact'],{'onDelete':_0x54ec('0x10a'),'as':_0x54ec('0x152')});db[_0x54ec('0x3f')][_0x54ec('0x11c')](db[_0x54ec('0x117')],{'as':_0x54ec('0x167'),'foreignKey':_0x54ec('0x163')});db[_0x54ec('0x3f')][_0x54ec('0x11c')](db[_0x54ec('0x39')],{'as':_0x54ec('0x168'),'foreignKey':_0x54ec('0x154')});db[_0x54ec('0x3f')][_0x54ec('0x11c')](db[_0x54ec('0x60')],{'as':_0x54ec('0x60'),'foreignKey':_0x54ec('0x169')});db[_0x54ec('0x3f')][_0x54ec('0x11c')](db[_0x54ec('0x69')],{'as':_0x54ec('0x69'),'foreignKey':_0x54ec('0x16a')});db['MailApplication']['belongsTo'](db['User'],{'onDelete':_0x54ec('0x157')});db['MailApplication'][_0x54ec('0x11c')](db['MailQueue'],{'onDelete':_0x54ec('0x157')});db[_0x54ec('0x41')][_0x54ec('0x11c')](db[_0x54ec('0x39')],{'onDelete':_0x54ec('0x157')});db['MailApplication'][_0x54ec('0x11c')](db[_0x54ec('0x80')],{'onDelete':'restrict','foreignKey':_0x54ec('0x16b')});db['MailApplication'][_0x54ec('0x11c')](db[_0x54ec('0x8a')],{'onDelete':_0x54ec('0x157'),'foreignKey':'TagId'});db[_0x54ec('0x16c')][_0x54ec('0x11c')](db['MailAccount'],{});db[_0x54ec('0x16c')][_0x54ec('0x11c')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x54ec('0x16c')]['belongsTo'](db[_0x54ec('0x151')],{'as':'Contact','foreignKey':_0x54ec('0x153')});db[_0x54ec('0x16c')][_0x54ec('0x11c')](db[_0x54ec('0x117')],{});db[_0x54ec('0x16c')][_0x54ec('0x11c')](db['MailMessage'],{});db[_0x54ec('0x16c')]['belongsTo'](db[_0x54ec('0x10')],{});db[_0x54ec('0x16c')][_0x54ec('0x11c')](db[_0x54ec('0x3b')],{});db[_0x54ec('0x44')][_0x54ec('0x10b')](db['DashboardItem'],{'as':_0x54ec('0x16d'),'onDelete':_0x54ec('0x10a')});db['FaxAccount'][_0x54ec('0x10b')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x54ec('0x16e'),'onDelete':_0x54ec('0x10a')});db[_0x54ec('0x48')][_0x54ec('0x10b')](db[_0x54ec('0x16f')],{'as':_0x54ec('0x15b'),'foreignKey':'FaxAccountId'});db[_0x54ec('0x48')][_0x54ec('0x10b')](db[_0x54ec('0x4a')],{'as':'Interactions'});db['FaxAccount'][_0x54ec('0x10b')](db['FaxApplication'],{'as':_0x54ec('0x170')});db[_0x54ec('0x48')]['hasMany'](db[_0x54ec('0x15')],{'as':_0x54ec('0x171'),'onDelete':_0x54ec('0x10a')});db[_0x54ec('0x48')][_0x54ec('0x10b')](db[_0x54ec('0x4c')],{'as':_0x54ec('0x14a')});db['FaxAccount'][_0x54ec('0x11c')](db[_0x54ec('0x25')],{'as':_0x54ec('0x25')});db[_0x54ec('0x48')]['belongsTo'](db['CmList'],{'as':_0x54ec('0x15d'),'foreignKey':_0x54ec('0x15e')});db[_0x54ec('0x48')][_0x54ec('0x11c')](db[_0x54ec('0x82')],{'as':_0x54ec('0x161'),'foreignKey':_0x54ec('0x145')});db['FaxAccount']['belongsToMany'](db[_0x54ec('0x10')],{'as':_0x54ec('0x147'),'through':_0x54ec('0x133')});db[_0x54ec('0x172')][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'onDelete':_0x54ec('0x157')});db[_0x54ec('0x172')][_0x54ec('0x11c')](db[_0x54ec('0x4e')],{'onDelete':_0x54ec('0x157')});db[_0x54ec('0x172')]['belongsTo'](db['FaxAccount'],{'onDelete':_0x54ec('0x157')});db[_0x54ec('0x172')][_0x54ec('0x11c')](db[_0x54ec('0x8a')],{'onDelete':_0x54ec('0x157'),'foreignKey':_0x54ec('0x173')});db[_0x54ec('0x4a')][_0x54ec('0x10b')](db[_0x54ec('0x4c')],{'as':'Messages','onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x174')});db['FaxInteraction'][_0x54ec('0x11c')](db[_0x54ec('0x48')],{'as':_0x54ec('0x168'),'foreignKey':_0x54ec('0x16e')});db[_0x54ec('0x4a')]['belongsTo'](db['CmContact'],{'as':_0x54ec('0x152'),'foreignKey':_0x54ec('0x153')});db['FaxInteraction'][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'as':_0x54ec('0x164'),'foreignKey':_0x54ec('0x108')});db[_0x54ec('0x4a')][_0x54ec('0x11d')](db[_0x54ec('0x8a')],{'through':_0x54ec('0x175'),'as':_0x54ec('0x176')});db[_0x54ec('0x4a')][_0x54ec('0x11d')](db[_0x54ec('0x8a')],{'through':_0x54ec('0x175'),'as':_0x54ec('0x177')});db[_0x54ec('0x4a')][_0x54ec('0x11d')](db[_0x54ec('0x10')],{'as':_0x54ec('0x166'),'through':_0x54ec('0x178'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x54ec('0x11c')](db['User'],{'onDelete':_0x54ec('0x10a'),'as':_0x54ec('0x10')});db[_0x54ec('0x4c')][_0x54ec('0x11c')](db['FaxInteraction'],{'as':'Interaction','foreignKey':_0x54ec('0x174')});db['FaxMessage'][_0x54ec('0x11c')](db['CmContact'],{'onDelete':'cascade','as':_0x54ec('0x152')});db[_0x54ec('0x4c')][_0x54ec('0x11c')](db[_0x54ec('0xe3')],{'as':'Attachment','foreignKey':_0x54ec('0x179')});db[_0x54ec('0x4c')][_0x54ec('0x11c')](db[_0x54ec('0x48')],{'as':_0x54ec('0x168'),'foreignKey':_0x54ec('0x16e')});db[_0x54ec('0x4e')][_0x54ec('0x11d')](db[_0x54ec('0x10')],{'as':_0x54ec('0x147'),'through':'UserFaxQueue'});db[_0x54ec('0x4e')][_0x54ec('0x11d')](db[_0x54ec('0xe0')],{'through':_0x54ec('0x17a'),'as':'Teams'});db['FaxQueueReport'][_0x54ec('0x11c')](db['FaxAccount'],{});db['FaxQueueReport'][_0x54ec('0x11c')](db[_0x54ec('0xee')],{'as':_0x54ec('0x15d'),'foreignKey':_0x54ec('0x15e')});db[_0x54ec('0x17b')][_0x54ec('0x11c')](db[_0x54ec('0x151')],{'as':_0x54ec('0x152'),'foreignKey':_0x54ec('0x153')});db['FaxQueueReport'][_0x54ec('0x11c')](db[_0x54ec('0x4a')],{});db[_0x54ec('0x17b')]['belongsTo'](db[_0x54ec('0x4c')],{});db[_0x54ec('0x17b')][_0x54ec('0x11c')](db['User'],{});db[_0x54ec('0x17b')]['belongsTo'](db[_0x54ec('0x4e')],{});db[_0x54ec('0x50')][_0x54ec('0x10b')](db[_0x54ec('0x7c')],{'as':_0x54ec('0x15a'),'foreignKey':_0x54ec('0x17c'),'onDelete':_0x54ec('0x10a')});db[_0x54ec('0x50')]['hasMany'](db['CannedAnswer'],{'as':_0x54ec('0x15b'),'foreignKey':_0x54ec('0x17c')});db['SmsAccount'][_0x54ec('0x10b')](db[_0x54ec('0x55')],{'as':_0x54ec('0x14a'),'foreignKey':_0x54ec('0x17c')});db[_0x54ec('0x50')][_0x54ec('0x10b')](db[_0x54ec('0x53')],{'as':_0x54ec('0x15c')});db['SmsAccount'][_0x54ec('0x10b')](db[_0x54ec('0x17d')],{'as':_0x54ec('0x170')});db[_0x54ec('0x50')]['belongsTo'](db['CmList'],{'as':_0x54ec('0x15d'),'foreignKey':_0x54ec('0x15e')});db[_0x54ec('0x50')][_0x54ec('0x11c')](db[_0x54ec('0x82')],{'as':'mandatoryDispositionPause','foreignKey':_0x54ec('0x145')});db[_0x54ec('0x50')][_0x54ec('0x11d')](db['User'],{'as':_0x54ec('0x147'),'through':_0x54ec('0x138')});db[_0x54ec('0x17d')][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'onDelete':_0x54ec('0x157')});db[_0x54ec('0x17d')]['belongsTo'](db[_0x54ec('0x57')],{'onDelete':_0x54ec('0x157')});db[_0x54ec('0x17d')][_0x54ec('0x11c')](db[_0x54ec('0x50')],{'onDelete':_0x54ec('0x157')});db[_0x54ec('0x17d')][_0x54ec('0x11c')](db[_0x54ec('0x80')],{'onDelete':'restrict','foreignKey':_0x54ec('0x16b')});db[_0x54ec('0x17d')][_0x54ec('0x11c')](db[_0x54ec('0x8a')],{'onDelete':'restrict','foreignKey':_0x54ec('0x173')});db['SmsInteraction']['hasMany'](db[_0x54ec('0x55')],{'as':_0x54ec('0x14a'),'onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x17e')});db[_0x54ec('0x53')]['belongsTo'](db[_0x54ec('0x50')],{'as':_0x54ec('0x168'),'foreignKey':_0x54ec('0x17c')});db[_0x54ec('0x53')][_0x54ec('0x11c')](db[_0x54ec('0x151')],{'as':'Contact','foreignKey':_0x54ec('0x153')});db['SmsInteraction'][_0x54ec('0x11c')](db['User'],{'as':_0x54ec('0x164'),'foreignKey':_0x54ec('0x108')});db[_0x54ec('0x53')][_0x54ec('0x11d')](db[_0x54ec('0x8a')],{'through':_0x54ec('0x17f'),'as':_0x54ec('0x176')});db[_0x54ec('0x53')]['belongsToMany'](db[_0x54ec('0x8a')],{'through':_0x54ec('0x17f'),'as':'ThroughTags'});db[_0x54ec('0x53')][_0x54ec('0x11d')](db[_0x54ec('0x10')],{'as':'Users','through':_0x54ec('0x127'),'foreignKey':'SmsInteractionId'});db[_0x54ec('0x55')][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'as':'User'});db['SmsMessage'][_0x54ec('0x11c')](db['CmContact'],{'onDelete':_0x54ec('0x10a'),'as':_0x54ec('0x152')});db['SmsMessage'][_0x54ec('0x11c')](db['SmsInteraction'],{'onDelete':_0x54ec('0x10a'),'as':'Interaction','foreignKey':_0x54ec('0x17e')});db[_0x54ec('0x55')][_0x54ec('0x11c')](db[_0x54ec('0x50')],{'as':_0x54ec('0x168'),'foreignKey':'SmsAccountId'});db[_0x54ec('0x57')][_0x54ec('0x11d')](db['User'],{'as':_0x54ec('0x147'),'through':_0x54ec('0x32'),'foreignKey':'SmsQueueId'});db[_0x54ec('0x57')][_0x54ec('0x11d')](db[_0x54ec('0xe0')],{'through':_0x54ec('0x180'),'as':'Teams'});db[_0x54ec('0x181')][_0x54ec('0x10b')](db[_0x54ec('0x7c')],{'as':'Dispositions','foreignKey':'OpenchannelAccountId','onDelete':_0x54ec('0x10a')});db['OpenchannelAccount'][_0x54ec('0x10b')](db['CannedAnswer'],{'as':_0x54ec('0x15b'),'foreignKey':_0x54ec('0x182')});db[_0x54ec('0x181')][_0x54ec('0x10b')](db['OpenchannelInteraction'],{'as':_0x54ec('0x15c'),'foreignKey':_0x54ec('0x182')});db['OpenchannelAccount'][_0x54ec('0x10b')](db[_0x54ec('0x5e')],{'as':_0x54ec('0x14a'),'foreignKey':_0x54ec('0x182')});db['OpenchannelAccount'][_0x54ec('0x10b')](db[_0x54ec('0x5a')],{'as':_0x54ec('0x170'),'foreignKey':_0x54ec('0x182')});db[_0x54ec('0x181')]['belongsTo'](db[_0x54ec('0xee')],{'as':'List','foreignKey':_0x54ec('0x15e')});db[_0x54ec('0x181')][_0x54ec('0x11c')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x54ec('0x145')});db[_0x54ec('0x181')][_0x54ec('0x11d')](db[_0x54ec('0x10')],{'as':_0x54ec('0x147'),'through':_0x54ec('0x136')});db[_0x54ec('0x5a')]['belongsTo'](db[_0x54ec('0x10')],{'onDelete':_0x54ec('0x157')});db[_0x54ec('0x5a')]['belongsTo'](db[_0x54ec('0x130')],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0x54ec('0x5a')]['belongsTo'](db[_0x54ec('0x181')],{'onDelete':_0x54ec('0x157'),'foreignKey':_0x54ec('0x182')});db['OpenchannelApplication']['belongsTo'](db[_0x54ec('0x80')],{'onDelete':_0x54ec('0x157'),'foreignKey':_0x54ec('0x16b')});db[_0x54ec('0x5a')][_0x54ec('0x11c')](db[_0x54ec('0x8a')],{'onDelete':_0x54ec('0x157'),'foreignKey':'TagId'});db['OpenchannelInteraction'][_0x54ec('0x10b')](db['OpenchannelMessage'],{'as':_0x54ec('0x14a'),'onDelete':'cascade','foreignKey':_0x54ec('0x183')});db[_0x54ec('0x5c')]['belongsTo'](db['OpenchannelAccount'],{'as':_0x54ec('0x168'),'foreignKey':'OpenchannelAccountId'});db[_0x54ec('0x5c')][_0x54ec('0x11c')](db[_0x54ec('0x151')],{'as':'Contact','foreignKey':'ContactId'});db[_0x54ec('0x5c')][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'as':_0x54ec('0x164'),'foreignKey':_0x54ec('0x108')});db[_0x54ec('0x5c')][_0x54ec('0x11d')](db[_0x54ec('0x8a')],{'through':_0x54ec('0x184'),'as':_0x54ec('0x176')});db[_0x54ec('0x5c')]['belongsToMany'](db[_0x54ec('0x8a')],{'through':_0x54ec('0x184'),'as':_0x54ec('0x177')});db[_0x54ec('0x5c')][_0x54ec('0x11d')](db[_0x54ec('0x10')],{'as':_0x54ec('0x166'),'through':_0x54ec('0x128'),'foreignKey':_0x54ec('0x183')});db['OpenchannelMessage'][_0x54ec('0x11c')](db['User'],{'onDelete':_0x54ec('0x10a'),'as':'User'});db[_0x54ec('0x5e')][_0x54ec('0x11c')](db[_0x54ec('0x151')],{'onDelete':_0x54ec('0x10a'),'as':_0x54ec('0x152')});db['OpenchannelMessage'][_0x54ec('0x11c')](db['OpenchannelInteraction'],{'onDelete':_0x54ec('0x10a'),'as':_0x54ec('0x167'),'foreignKey':_0x54ec('0x183')});db[_0x54ec('0x5e')]['belongsTo'](db['Attachment'],{'as':_0x54ec('0xe3'),'foreignKey':_0x54ec('0x179')});db[_0x54ec('0x5e')][_0x54ec('0x11c')](db[_0x54ec('0x181')],{'as':_0x54ec('0x168'),'foreignKey':'OpenchannelAccountId'});db[_0x54ec('0x130')][_0x54ec('0x11d')](db[_0x54ec('0x10')],{'as':_0x54ec('0x147'),'through':_0x54ec('0x131'),'foreignKey':_0x54ec('0x185')});db['OpenchannelQueue'][_0x54ec('0x11d')](db[_0x54ec('0xe0')],{'through':_0x54ec('0x186'),'as':_0x54ec('0x187')});db[_0x54ec('0x60')]['hasMany'](db[_0x54ec('0x7c')],{'as':'Dispositions','foreignKey':'ChatWebsiteId','onDelete':'cascade'});db[_0x54ec('0x60')][_0x54ec('0x10b')](db[_0x54ec('0x16f')],{'as':_0x54ec('0x15b'),'foreignKey':'ChatWebsiteId'});db[_0x54ec('0x60')][_0x54ec('0x10b')](db[_0x54ec('0x6d')],{'as':'ProactiveActions'});db['ChatWebsite'][_0x54ec('0x10b')](db[_0x54ec('0x66')],{'as':'Interactions'});db[_0x54ec('0x60')]['hasMany'](db[_0x54ec('0x64')],{'as':_0x54ec('0x170')});db[_0x54ec('0x60')][_0x54ec('0x10b')](db['ChatMessage'],{'as':'Messages'});db['ChatWebsite']['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x54ec('0x15e')});db[_0x54ec('0x60')]['belongsTo'](db[_0x54ec('0x80')],{'as':_0x54ec('0x80'),'foreignKey':_0x54ec('0x16b')});db[_0x54ec('0x60')][_0x54ec('0x11c')](db['MailAccount'],{'as':_0x54ec('0x39'),'foreignKey':'MailAccountId'});db['ChatWebsite']['belongsTo'](db[_0x54ec('0x82')],{'as':_0x54ec('0x161'),'foreignKey':_0x54ec('0x145')});db[_0x54ec('0x60')][_0x54ec('0x11d')](db['User'],{'as':_0x54ec('0x147'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0x54ec('0x11c')](db[_0x54ec('0x181')],{});db['OpenchannelQueueReport'][_0x54ec('0x11c')](db['CmList'],{'as':_0x54ec('0x15d'),'foreignKey':_0x54ec('0x15e')});db[_0x54ec('0x62')][_0x54ec('0x11c')](db[_0x54ec('0x151')],{'as':_0x54ec('0x152'),'foreignKey':_0x54ec('0x153')});db[_0x54ec('0x62')][_0x54ec('0x11c')](db[_0x54ec('0x5c')],{});db['OpenchannelQueueReport'][_0x54ec('0x11c')](db[_0x54ec('0x5e')],{});db[_0x54ec('0x62')][_0x54ec('0x11c')](db[_0x54ec('0x10')],{});db[_0x54ec('0x62')][_0x54ec('0x11c')](db[_0x54ec('0x130')],{});db[_0x54ec('0x64')][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'as':'Agent','foreignKey':_0x54ec('0x108'),'onDelete':_0x54ec('0x157')});db[_0x54ec('0x64')][_0x54ec('0x11c')](db['ChatQueue'],{'as':_0x54ec('0x188'),'foreignKey':_0x54ec('0x189'),'onDelete':_0x54ec('0x157')});db['ChatApplication'][_0x54ec('0x11c')](db[_0x54ec('0x60')],{'as':_0x54ec('0x18a'),'foreignKey':_0x54ec('0x169'),'onDelete':_0x54ec('0x157')});db[_0x54ec('0x64')][_0x54ec('0x11c')](db[_0x54ec('0x8a')],{'onDelete':_0x54ec('0x157'),'foreignKey':_0x54ec('0x173')});db['ChatInteraction']['hasMany'](db[_0x54ec('0x18b')],{'as':'Messages','onDelete':_0x54ec('0x10a'),'foreignKey':'ChatInteractionId'});db[_0x54ec('0x66')][_0x54ec('0x11c')](db[_0x54ec('0x60')],{'as':'Account','foreignKey':_0x54ec('0x169')});db[_0x54ec('0x66')][_0x54ec('0x11c')](db['CmContact'],{'as':_0x54ec('0x152'),'foreignKey':_0x54ec('0x153')});db[_0x54ec('0x66')][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'as':_0x54ec('0x164'),'foreignKey':_0x54ec('0x108')});db[_0x54ec('0x66')]['belongsToMany'](db[_0x54ec('0x8a')],{'through':_0x54ec('0x18c'),'as':'Tags'});db[_0x54ec('0x66')][_0x54ec('0x11d')](db[_0x54ec('0x8a')],{'through':_0x54ec('0x18c'),'as':'ThroughTags'});db['ChatInteraction'][_0x54ec('0x11d')](db[_0x54ec('0x10')],{'as':_0x54ec('0x166'),'through':'user_has_chat_interactions','foreignKey':_0x54ec('0x18d')});db[_0x54ec('0x18b')][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'onDelete':'cascade','as':_0x54ec('0x10')});db[_0x54ec('0x18b')][_0x54ec('0x11c')](db[_0x54ec('0x151')],{'onDelete':_0x54ec('0x10a'),'as':'Contact','foreignKey':_0x54ec('0x153')});db[_0x54ec('0x18b')][_0x54ec('0x11c')](db[_0x54ec('0x66')],{'onDelete':_0x54ec('0x10a'),'as':'Interaction','foreignKey':_0x54ec('0x18d')});db['ChatMessage']['belongsTo'](db[_0x54ec('0xe3')],{'as':_0x54ec('0xe3'),'foreignKey':_0x54ec('0x179')});db[_0x54ec('0x18b')]['belongsTo'](db['ChatWebsite'],{'as':_0x54ec('0x168'),'foreignKey':_0x54ec('0x169')});db[_0x54ec('0x69')][_0x54ec('0x10b')](db[_0x54ec('0xe3')],{'as':_0x54ec('0x18e'),'foreignKey':_0x54ec('0x16a'),'onDelete':_0x54ec('0x10a'),'hooks':!![]});db['ChatOfflineMessage'][_0x54ec('0x11c')](db[_0x54ec('0x151')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x54ec('0x153')});db[_0x54ec('0x69')][_0x54ec('0x11c')](db[_0x54ec('0x60')],{'as':'Account','foreignKey':_0x54ec('0x169')});db['ChatQueue'][_0x54ec('0x11d')](db['User'],{'as':_0x54ec('0x147'),'through':_0x54ec('0x2c'),'hooks':!![]});db[_0x54ec('0x6b')]['belongsToMany'](db['Team'],{'through':_0x54ec('0x18f'),'as':_0x54ec('0x187')});db['ChatGroup']['hasMany'](db['ChatInternalMessage'],{'as':'Messages','foreignKey':_0x54ec('0x190'),'onDelete':_0x54ec('0x10a')});db['ChatGroup'][_0x54ec('0x11d')](db[_0x54ec('0x10')],{'as':_0x54ec('0x191'),'through':_0x54ec('0x11f')});db['ChatProactiveAction'][_0x54ec('0x11c')](db[_0x54ec('0x60')],{'as':_0x54ec('0x18a'),'foreignKey':_0x54ec('0x169')});db[_0x54ec('0x6f')]['hasMany'](db[_0x54ec('0x151')],{'as':_0x54ec('0x120'),'foreignKey':_0x54ec('0x192')});db[_0x54ec('0x151')][_0x54ec('0x10b')](db[_0x54ec('0x8d')],{'as':_0x54ec('0x193'),'foreignKey':_0x54ec('0x194')});db[_0x54ec('0x151')][_0x54ec('0x10b')](db[_0x54ec('0x72')],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x54ec('0x151')][_0x54ec('0x10b')](db[_0x54ec('0x110')],{'as':'HopperFinals','foreignKey':_0x54ec('0x153')});db['CmContact'][_0x54ec('0x10b')](db[_0x54ec('0x75')],{'as':_0x54ec('0x195'),'foreignKey':'ContactId'});db[_0x54ec('0x151')][_0x54ec('0x10b')](db['ReportAgentPreview'],{'as':_0x54ec('0x77'),'foreignKey':_0x54ec('0x153')});db['CmContact'][_0x54ec('0x10b')](db[_0x54ec('0xd3')],{'as':'JscriptySessions','foreignKey':'ContactId'});db[_0x54ec('0x151')][_0x54ec('0x10b')](db['OpenchannelInteraction'],{'as':_0x54ec('0x113'),'foreignKey':_0x54ec('0x153'),'onDelete':'restrict'});db[_0x54ec('0x151')][_0x54ec('0x10b')](db[_0x54ec('0x66')],{'as':_0x54ec('0x114'),'foreignKey':_0x54ec('0x153'),'onDelete':_0x54ec('0x157')});db[_0x54ec('0x151')][_0x54ec('0x10b')](db['SmsInteraction'],{'as':_0x54ec('0x115'),'foreignKey':_0x54ec('0x153'),'onDelete':_0x54ec('0x157')});db[_0x54ec('0x151')][_0x54ec('0x10b')](db[_0x54ec('0x4a')],{'as':'FaxInteractions','foreignKey':_0x54ec('0x153'),'onDelete':_0x54ec('0x157')});db[_0x54ec('0x151')][_0x54ec('0x10b')](db['MailInteraction'],{'as':_0x54ec('0x118'),'foreignKey':_0x54ec('0x153'),'onDelete':_0x54ec('0x157')});db[_0x54ec('0x151')][_0x54ec('0x11c')](db[_0x54ec('0x6f')],{'as':_0x54ec('0x196'),'foreignKey':_0x54ec('0x192')});db[_0x54ec('0x151')][_0x54ec('0x11c')](db[_0x54ec('0xee')],{'as':'List','foreignKey':'ListId','onDelete':_0x54ec('0x10a')});db['CmContact']['belongsToMany'](db[_0x54ec('0x10')],{'as':_0x54ec('0x166'),'through':_0x54ec('0x121')});db[_0x54ec('0x151')][_0x54ec('0x11d')](db[_0x54ec('0x8a')],{'as':_0x54ec('0x176'),'through':_0x54ec('0x197')});db[_0x54ec('0x151')][_0x54ec('0x11d')](db[_0x54ec('0x8a')],{'through':'cm_contact_has_tags','as':_0x54ec('0x177')});db[_0x54ec('0x72')]['hasMany'](db[_0x54ec('0x8f')],{'as':_0x54ec('0x198'),'foreignKey':_0x54ec('0x199')});db[_0x54ec('0x72')][_0x54ec('0x11c')](db['CmContact'],{'as':_0x54ec('0x152'),'foreignKey':_0x54ec('0x153'),'onDelete':_0x54ec('0x10a')});db['CmHopper']['belongsTo'](db['CmList'],{'as':_0x54ec('0x15d'),'foreignKey':_0x54ec('0x15e'),'onDelete':'cascade'});db[_0x54ec('0x72')]['belongsTo'](db['User'],{'as':_0x54ec('0x19a'),'foreignKey':_0x54ec('0x108')});db[_0x54ec('0x72')]['belongsTo'](db['VoiceQueue'],{'as':_0x54ec('0x188'),'foreignKey':_0x54ec('0x140'),'onDelete':'cascade'});db[_0x54ec('0x72')][_0x54ec('0x11c')](db[_0x54ec('0x19b')],{'as':_0x54ec('0x19b'),'foreignKey':_0x54ec('0x19c'),'onDelete':'cascade'});db['CmHopper'][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'as':_0x54ec('0x164'),'foreignKey':_0x54ec('0x19d')});db[_0x54ec('0x74')]['belongsTo'](db[_0x54ec('0x151')],{'as':'Contact','foreignKey':_0x54ec('0x153'),'onDelete':'cascade'});db['CmHopperBlack'][_0x54ec('0x11c')](db[_0x54ec('0xee')],{'as':_0x54ec('0x15d'),'foreignKey':'ListId','onDelete':_0x54ec('0x10a')});db[_0x54ec('0x74')][_0x54ec('0x11c')](db[_0x54ec('0x19')],{'as':_0x54ec('0x188'),'foreignKey':_0x54ec('0x140'),'onDelete':_0x54ec('0x10a')});db['CmHopperBlack']['belongsTo'](db[_0x54ec('0x19b')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':'cascade'});db['Automation'][_0x54ec('0x10b')](db[_0x54ec('0x7e')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':_0x54ec('0x10a'),'hooks':!![]});db[_0x54ec('0x19e')][_0x54ec('0x10b')](db[_0x54ec('0x7e')],{'as':{'plural':_0x54ec('0x19f'),'singular':_0x54ec('0x1a0')},'foreignKey':'AutomationAnyId','onDelete':_0x54ec('0x10a'),'hooks':!![]});db['Automation']['hasMany'](db['Action'],{'as':'Actions','foreignKey':_0x54ec('0x1a1'),'onDelete':'cascade','hooks':!![]});db[_0x54ec('0x7c')]['hasMany'](db['Disposition'],{'as':_0x54ec('0x15a'),'foreignKey':_0x54ec('0x1a2'),'onDelete':_0x54ec('0x10a')});db[_0x54ec('0x80')][_0x54ec('0x10b')](db[_0x54ec('0x80')],{'as':_0x54ec('0x1a3'),'foreignKey':_0x54ec('0x16b'),'onDelete':_0x54ec('0x10a'),'hooks':!![],'required':![]});db[_0x54ec('0x80')]['hasMany'](db['VoiceExtension'],{'as':_0x54ec('0x10f'),'foreignKey':_0x54ec('0x16b'),'onDelete':_0x54ec('0x157')});db['Interval']['hasMany'](db[_0x54ec('0x41')],{'as':_0x54ec('0x1a4'),'foreignKey':_0x54ec('0x16b')});db[_0x54ec('0x80')][_0x54ec('0x10b')](db['ChatApplication'],{'as':_0x54ec('0x1a5'),'foreignKey':'IntervalId'});db[_0x54ec('0x80')]['hasMany'](db[_0x54ec('0x172')],{'as':_0x54ec('0x1a6'),'foreignKey':_0x54ec('0x16b')});db[_0x54ec('0x80')][_0x54ec('0x10b')](db[_0x54ec('0x17d')],{'as':_0x54ec('0x1a7'),'foreignKey':_0x54ec('0x16b')});db[_0x54ec('0x86')]['belongsTo'](db[_0x54ec('0x39')],{});db[_0x54ec('0x86')]['belongsTo'](db[_0x54ec('0x1a8')],{'foreignKey':_0x54ec('0x1a9')});db['Schedule']['belongsTo'](db[_0x54ec('0x97')],{'foreignKey':_0x54ec('0x1aa')});db[_0x54ec('0x88')][_0x54ec('0x11d')](db[_0x54ec('0x17')],{'as':'Mohs','through':_0x54ec('0x13f'),'onDelete':_0x54ec('0x157')});db[_0x54ec('0x8a')]['belongsToMany'](db[_0x54ec('0x151')],{'through':_0x54ec('0x197')});db[_0x54ec('0x8a')][_0x54ec('0x11d')](db[_0x54ec('0x66')],{'through':_0x54ec('0x18c')});db[_0x54ec('0x8a')][_0x54ec('0x11d')](db[_0x54ec('0x117')],{'through':_0x54ec('0x165')});db[_0x54ec('0x8a')][_0x54ec('0x11d')](db['SmsInteraction'],{'through':_0x54ec('0x17f')});db[_0x54ec('0x8a')][_0x54ec('0x11d')](db[_0x54ec('0x4a')],{'through':_0x54ec('0x175')});db['Tag'][_0x54ec('0x11d')](db[_0x54ec('0x5c')],{'through':_0x54ec('0x184')});db['Tag'][_0x54ec('0x11d')](db[_0x54ec('0xf8')],{'through':_0x54ec('0x1ab')});db[_0x54ec('0x8d')][_0x54ec('0x11c')](db['ContactItemType'],{'as':_0x54ec('0x1ac'),'foreignKey':_0x54ec('0x1ad')});db['CmHopperAdditionalPhone'][_0x54ec('0x11c')](db[_0x54ec('0x72')],{'as':'Hopper','foreignKey':_0x54ec('0x199')});db[_0x54ec('0x8d')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x54ec('0x194')});db[_0x54ec('0x1ae')][_0x54ec('0x10b')](db[_0x54ec('0x7e')],{'as':{'plural':_0x54ec('0x1af'),'singular':_0x54ec('0x1b0')},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db['Trigger'][_0x54ec('0x10b')](db['Condition'],{'as':{'plural':_0x54ec('0x1b1'),'singular':_0x54ec('0x1b2')},'foreignKey':'TriggerAnyId','onDelete':_0x54ec('0x10a'),'hooks':!![]});db[_0x54ec('0x1ae')][_0x54ec('0x10b')](db[_0x54ec('0x7a')],{'as':_0x54ec('0x1b3'),'foreignKey':_0x54ec('0x1b4'),'onDelete':'cascade','hooks':!![]});db[_0x54ec('0x97')][_0x54ec('0x10b')](db[_0x54ec('0x9b')],{'as':_0x54ec('0x1b5'),'onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x1aa'),'hooks':!![]});db[_0x54ec('0x1a8')][_0x54ec('0x10b')](db[_0x54ec('0x9b')],{'as':_0x54ec('0x1b5'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db['AnalyticMetric'][_0x54ec('0x10b')](db['AnalyticFieldReport'],{'as':_0x54ec('0x1b5'),'onDelete':'cascade','foreignKey':_0x54ec('0x1b6')});db[_0x54ec('0x9b')][_0x54ec('0x11c')](db[_0x54ec('0x1b7')],{'foreignKey':_0x54ec('0x1b6')});db[_0x54ec('0x9c')]['hasMany'](db[_0x54ec('0x9e')],{'as':'Configurations','onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x1b8')});db['SalesforceConfiguration'][_0x54ec('0x10b')](db[_0x54ec('0xa0')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x54ec('0x1b9')});db[_0x54ec('0x9e')][_0x54ec('0x10b')](db[_0x54ec('0xa0')],{'as':_0x54ec('0x1ba'),'onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x1bb')});db[_0x54ec('0x9e')][_0x54ec('0x10b')](db['SalesforceField'],{'as':_0x54ec('0x1b5'),'onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x1bc')});db[_0x54ec('0x9e')][_0x54ec('0x11c')](db[_0x54ec('0x9c')],{'as':'Account','foreignKey':_0x54ec('0x1b8')});db[_0x54ec('0xa0')][_0x54ec('0x10b')](db[_0x54ec('0xa0')],{'as':'Subject','foreignKey':_0x54ec('0x1b9')});db[_0x54ec('0xa0')][_0x54ec('0x10b')](db[_0x54ec('0xa0')],{'as':_0x54ec('0x1bd'),'foreignKey':'DescriptionId'});db['SalesforceField']['hasMany'](db[_0x54ec('0xa0')],{'as':_0x54ec('0x1be'),'foreignKey':'FieldId'});db[_0x54ec('0xa0')]['belongsTo'](db[_0x54ec('0x92')],{'as':_0x54ec('0x92'),'foreignKey':_0x54ec('0x1bf')});db['SugarcrmAccount'][_0x54ec('0x10b')](db[_0x54ec('0xa3')],{'as':_0x54ec('0x1c0'),'onDelete':'cascade','foreignKey':_0x54ec('0x1b8')});db[_0x54ec('0xa3')][_0x54ec('0x10b')](db[_0x54ec('0xa5')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x54ec('0xa3')]['hasMany'](db[_0x54ec('0xa5')],{'as':_0x54ec('0x1ba'),'onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x1bb')});db[_0x54ec('0xa3')][_0x54ec('0x10b')](db[_0x54ec('0xa5')],{'as':'Fields','onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x1bc')});db[_0x54ec('0xa3')]['belongsTo'](db[_0x54ec('0xa2')],{'as':_0x54ec('0x168'),'foreignKey':'AccountId'});db[_0x54ec('0xa5')][_0x54ec('0x10b')](db[_0x54ec('0xa5')],{'as':_0x54ec('0x1c1'),'foreignKey':_0x54ec('0x1b9')});db[_0x54ec('0xa5')][_0x54ec('0x10b')](db[_0x54ec('0xa5')],{'as':_0x54ec('0x1bd'),'foreignKey':'DescriptionId'});db[_0x54ec('0xa5')][_0x54ec('0x10b')](db[_0x54ec('0xa5')],{'as':_0x54ec('0x1be'),'foreignKey':_0x54ec('0x1bc')});db[_0x54ec('0xa5')][_0x54ec('0x11c')](db[_0x54ec('0x92')],{'as':'Variable','foreignKey':_0x54ec('0x1bf')});db[_0x54ec('0xa7')][_0x54ec('0x10b')](db[_0x54ec('0xa9')],{'as':_0x54ec('0x1c0'),'onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x1b8')});db[_0x54ec('0xa9')][_0x54ec('0x10b')](db[_0x54ec('0xab')],{'as':_0x54ec('0x1c2'),'onDelete':'cascade','foreignKey':_0x54ec('0x1b9')});db[_0x54ec('0xa9')][_0x54ec('0x10b')](db[_0x54ec('0xab')],{'as':'Descriptions','onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x1bb')});db[_0x54ec('0xa9')][_0x54ec('0x10b')](db['DeskField'],{'as':_0x54ec('0x1b5'),'onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x1bc')});db[_0x54ec('0xa9')]['belongsTo'](db['DeskAccount'],{'as':'Account','foreignKey':_0x54ec('0x1b8')});db[_0x54ec('0xa9')]['belongsToMany'](db[_0x54ec('0x8a')],{'through':_0x54ec('0x1c3')});db['DeskField'][_0x54ec('0x10b')](db[_0x54ec('0xab')],{'as':_0x54ec('0x1c1'),'foreignKey':'SubjectId'});db[_0x54ec('0xab')][_0x54ec('0x10b')](db[_0x54ec('0xab')],{'as':_0x54ec('0x1bd'),'foreignKey':_0x54ec('0x1bb')});db[_0x54ec('0xab')][_0x54ec('0x10b')](db[_0x54ec('0xab')],{'as':_0x54ec('0x1be'),'foreignKey':_0x54ec('0x1bc')});db['DeskField'][_0x54ec('0x11c')](db[_0x54ec('0x92')],{'as':'Variable','foreignKey':_0x54ec('0x1bf')});db['ZohoAccount']['hasMany'](db['ZohoConfiguration'],{'as':_0x54ec('0x1c0'),'onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x1b8')});db[_0x54ec('0x1c4')]['hasMany'](db[_0x54ec('0x1c5')],{'as':_0x54ec('0x1c2'),'onDelete':'cascade','foreignKey':_0x54ec('0x1b9')});db[_0x54ec('0x1c4')][_0x54ec('0x10b')](db[_0x54ec('0x1c5')],{'as':_0x54ec('0x1ba'),'onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x1bb')});db[_0x54ec('0x1c4')]['hasMany'](db[_0x54ec('0x1c5')],{'as':_0x54ec('0x1b5'),'onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x1bc')});db[_0x54ec('0x1c4')][_0x54ec('0x11c')](db[_0x54ec('0x1c6')],{'as':'Account','foreignKey':_0x54ec('0x1b8')});db[_0x54ec('0x1c5')]['hasMany'](db['ZohoField'],{'as':_0x54ec('0x1c1'),'foreignKey':'SubjectId'});db['ZohoField'][_0x54ec('0x10b')](db[_0x54ec('0x1c5')],{'as':_0x54ec('0x1bd'),'foreignKey':_0x54ec('0x1bb')});db[_0x54ec('0x1c5')][_0x54ec('0x10b')](db[_0x54ec('0x1c5')],{'as':'Field','foreignKey':_0x54ec('0x1bc')});db[_0x54ec('0x1c5')][_0x54ec('0x11c')](db[_0x54ec('0x92')],{'as':'Variable','foreignKey':_0x54ec('0x1bf')});db[_0x54ec('0xae')][_0x54ec('0x10b')](db[_0x54ec('0xb0')],{'as':_0x54ec('0x1c0'),'onDelete':_0x54ec('0x10a'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x54ec('0x10b')](db[_0x54ec('0xb2')],{'as':_0x54ec('0x1c2'),'foreignKey':_0x54ec('0x1b9')});db[_0x54ec('0xb0')][_0x54ec('0x10b')](db['ZendeskField'],{'as':_0x54ec('0x1ba'),'foreignKey':'DescriptionId'});db[_0x54ec('0xb0')][_0x54ec('0x10b')](db[_0x54ec('0xb2')],{'as':_0x54ec('0x1b5'),'foreignKey':_0x54ec('0x1bc')});db[_0x54ec('0xb0')][_0x54ec('0x11c')](db[_0x54ec('0xae')],{'as':_0x54ec('0x168'),'foreignKey':_0x54ec('0x1b8')});db[_0x54ec('0xb0')][_0x54ec('0x11d')](db['Tag'],{'through':_0x54ec('0x1c7')});db['ZendeskField'][_0x54ec('0x10b')](db[_0x54ec('0xb2')],{'as':_0x54ec('0x1c1'),'foreignKey':'SubjectId'});db[_0x54ec('0xb2')][_0x54ec('0x10b')](db[_0x54ec('0xb2')],{'as':_0x54ec('0x1bd'),'foreignKey':_0x54ec('0x1bb')});db[_0x54ec('0xb2')][_0x54ec('0x10b')](db['ZendeskField'],{'as':_0x54ec('0x1be'),'foreignKey':_0x54ec('0x1bc')});db[_0x54ec('0xb2')][_0x54ec('0x11c')](db['Variable'],{'as':_0x54ec('0x92'),'foreignKey':_0x54ec('0x1bf')});db[_0x54ec('0x1c8')][_0x54ec('0x10b')](db[_0x54ec('0xb5')],{'as':_0x54ec('0x1c0'),'onDelete':_0x54ec('0x10a'),'foreignKey':'AccountId'});db[_0x54ec('0xb5')]['hasMany'](db[_0x54ec('0xb7')],{'as':_0x54ec('0x1c2'),'onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x1b9')});db[_0x54ec('0xb5')][_0x54ec('0x10b')](db[_0x54ec('0xb7')],{'as':_0x54ec('0x1ba'),'onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x1bb')});db[_0x54ec('0xb5')][_0x54ec('0x10b')](db[_0x54ec('0xb7')],{'as':_0x54ec('0x1b5'),'onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x1bc')});db[_0x54ec('0xb5')]['belongsTo'](db[_0x54ec('0x1c8')],{'as':'Account','foreignKey':_0x54ec('0x1b8')});db[_0x54ec('0xb5')]['belongsToMany'](db[_0x54ec('0x8a')],{'through':_0x54ec('0x1c9')});db[_0x54ec('0xb7')][_0x54ec('0x10b')](db[_0x54ec('0xb7')],{'as':_0x54ec('0x1c1'),'foreignKey':_0x54ec('0x1b9')});db['FreshdeskField']['hasMany'](db[_0x54ec('0xb7')],{'as':_0x54ec('0x1bd'),'foreignKey':_0x54ec('0x1bb')});db[_0x54ec('0xb7')][_0x54ec('0x10b')](db[_0x54ec('0xb7')],{'as':_0x54ec('0x1be'),'foreignKey':_0x54ec('0x1bc')});db[_0x54ec('0xb7')][_0x54ec('0x11c')](db['Variable'],{'as':_0x54ec('0x92'),'foreignKey':'VariableId'});db[_0x54ec('0x1ca')][_0x54ec('0x10b')](db[_0x54ec('0xba')],{'as':'Configurations','onDelete':_0x54ec('0x10a'),'foreignKey':'AccountId'});db[_0x54ec('0xba')]['hasMany'](db['VtigerField'],{'as':_0x54ec('0x1c2'),'foreignKey':_0x54ec('0x1b9')});db[_0x54ec('0xba')]['hasMany'](db[_0x54ec('0xbc')],{'as':_0x54ec('0x1ba'),'foreignKey':_0x54ec('0x1bb')});db['VtigerConfiguration'][_0x54ec('0x10b')](db[_0x54ec('0xbc')],{'as':_0x54ec('0x1b5'),'foreignKey':'FieldId'});db['VtigerConfiguration']['belongsTo'](db[_0x54ec('0x1ca')],{'as':_0x54ec('0x168'),'foreignKey':_0x54ec('0x1b8')});db['VtigerField'][_0x54ec('0x10b')](db[_0x54ec('0xbc')],{'as':_0x54ec('0x1c1'),'foreignKey':_0x54ec('0x1b9')});db['VtigerField'][_0x54ec('0x10b')](db[_0x54ec('0xbc')],{'as':_0x54ec('0x1bd'),'foreignKey':_0x54ec('0x1bb')});db[_0x54ec('0xbc')][_0x54ec('0x10b')](db[_0x54ec('0xbc')],{'as':_0x54ec('0x1be'),'foreignKey':_0x54ec('0x1bc')});db['VtigerField'][_0x54ec('0x11c')](db[_0x54ec('0x92')],{'as':_0x54ec('0x92'),'foreignKey':_0x54ec('0x1bf')});db[_0x54ec('0xbe')][_0x54ec('0x10b')](db['ServicenowConfiguration'],{'as':_0x54ec('0x1c0'),'onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x1b8')});db[_0x54ec('0x1cb')][_0x54ec('0x10b')](db[_0x54ec('0x1cc')],{'as':_0x54ec('0x1c2'),'foreignKey':_0x54ec('0x1b9')});db[_0x54ec('0x1cb')][_0x54ec('0x10b')](db[_0x54ec('0x1cc')],{'as':_0x54ec('0x1ba'),'foreignKey':_0x54ec('0x1bb')});db['ServicenowConfiguration']['hasMany'](db[_0x54ec('0x1cc')],{'as':_0x54ec('0x1b5'),'foreignKey':_0x54ec('0x1bc')});db[_0x54ec('0x1cb')][_0x54ec('0x11c')](db['ServicenowAccount'],{'as':'Account','foreignKey':_0x54ec('0x1b8')});db['ServicenowField'][_0x54ec('0x10b')](db[_0x54ec('0x1cc')],{'as':'Subject','foreignKey':_0x54ec('0x1b9')});db[_0x54ec('0x1cc')][_0x54ec('0x10b')](db['ServicenowField'],{'as':_0x54ec('0x1bd'),'foreignKey':_0x54ec('0x1bb')});db['ServicenowField']['hasMany'](db[_0x54ec('0x1cc')],{'as':'Field','foreignKey':'FieldId'});db[_0x54ec('0x1cc')][_0x54ec('0x11c')](db['Variable'],{'as':_0x54ec('0x92'),'foreignKey':'VariableId'});db[_0x54ec('0xc1')][_0x54ec('0x10b')](db['Dynamics365Configuration'],{'as':_0x54ec('0x1c0'),'onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x1b8')});db[_0x54ec('0xc1')][_0x54ec('0x11c')](db[_0x54ec('0x155')],{'as':_0x54ec('0x155'),'foreignKey':_0x54ec('0x156')});db[_0x54ec('0xc3')][_0x54ec('0x10b')](db[_0x54ec('0xc5')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x54ec('0x1b9')});db['Dynamics365Configuration']['hasMany'](db[_0x54ec('0xc5')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x54ec('0xc3')]['hasMany'](db[_0x54ec('0xc5')],{'as':'Fields','onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x1bc')});db['Dynamics365Configuration']['belongsTo'](db[_0x54ec('0xc1')],{'as':_0x54ec('0x168'),'foreignKey':_0x54ec('0x1b8')});db['Dynamics365Field'][_0x54ec('0x10b')](db[_0x54ec('0xc5')],{'as':'Subject','foreignKey':_0x54ec('0x1b9')});db[_0x54ec('0xc5')]['hasMany'](db[_0x54ec('0xc5')],{'as':_0x54ec('0x1bd'),'foreignKey':'DescriptionId'});db[_0x54ec('0xc5')][_0x54ec('0x10b')](db[_0x54ec('0xc5')],{'as':'Field','foreignKey':_0x54ec('0x1bc')});db[_0x54ec('0xc5')]['belongsTo'](db[_0x54ec('0x92')],{'as':_0x54ec('0x92'),'foreignKey':_0x54ec('0x1bf')});db[_0x54ec('0xc7')][_0x54ec('0x10b')](db[_0x54ec('0xc9')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x54ec('0x1b8')});db[_0x54ec('0xc9')]['hasMany'](db['FreshsalesField'],{'as':_0x54ec('0x1c2'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0x54ec('0x10b')](db[_0x54ec('0xcb')],{'as':_0x54ec('0x1ba'),'foreignKey':_0x54ec('0x1bb')});db[_0x54ec('0xc9')][_0x54ec('0x10b')](db[_0x54ec('0xcb')],{'as':_0x54ec('0x1b5'),'foreignKey':_0x54ec('0x1bc')});db[_0x54ec('0xc9')][_0x54ec('0x11c')](db[_0x54ec('0xc7')],{'as':_0x54ec('0x168'),'foreignKey':_0x54ec('0x1b8')});db['FreshsalesField']['hasMany'](db[_0x54ec('0xcb')],{'as':_0x54ec('0x1c1'),'foreignKey':_0x54ec('0x1b9')});db[_0x54ec('0xcb')]['hasMany'](db[_0x54ec('0xcb')],{'as':'Description','foreignKey':'DescriptionId'});db['FreshsalesField'][_0x54ec('0x10b')](db[_0x54ec('0xcb')],{'as':_0x54ec('0x1be'),'foreignKey':_0x54ec('0x1bc')});db[_0x54ec('0xcb')][_0x54ec('0x11c')](db[_0x54ec('0x92')],{'as':_0x54ec('0x92'),'foreignKey':_0x54ec('0x1bf')});db[_0x54ec('0xcd')][_0x54ec('0x11c')](db[_0x54ec('0x60')],{});db[_0x54ec('0xcd')][_0x54ec('0x11c')](db['CmList'],{'as':'List','foreignKey':_0x54ec('0x15e')});db[_0x54ec('0xcd')][_0x54ec('0x11c')](db['CmContact'],{'as':_0x54ec('0x152'),'foreignKey':_0x54ec('0x153')});db[_0x54ec('0xcd')]['belongsTo'](db[_0x54ec('0x66')],{});db['ChatQueueReport'][_0x54ec('0x11c')](db['ChatMessage'],{});db['ChatQueueReport'][_0x54ec('0x11c')](db[_0x54ec('0x10')],{});db[_0x54ec('0xcd')][_0x54ec('0x11c')](db['ChatQueue'],{});db[_0x54ec('0x1cd')]['belongsTo'](db[_0x54ec('0x10')],{'onDelete':_0x54ec('0x10a'),'foreignKey':'FromId'});db[_0x54ec('0x1cd')][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x1ce')});db['JscriptySessionReport'][_0x54ec('0x10b')](db['JscriptyQuestionReport'],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x54ec('0xd3')]['hasMany'](db[_0x54ec('0xcf')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x54ec('0xd4')]['belongsTo'](db[_0x54ec('0x50')],{});db[_0x54ec('0xd4')]['belongsTo'](db['CmList'],{'as':_0x54ec('0x15d'),'foreignKey':_0x54ec('0x15e')});db[_0x54ec('0xd4')][_0x54ec('0x11c')](db[_0x54ec('0x151')],{'as':_0x54ec('0x152'),'foreignKey':_0x54ec('0x153')});db['SmsQueueReport']['belongsTo'](db[_0x54ec('0x53')],{});db[_0x54ec('0xd4')][_0x54ec('0x11c')](db[_0x54ec('0x55')],{});db['SmsQueueReport'][_0x54ec('0x11c')](db[_0x54ec('0x10')],{});db[_0x54ec('0xd4')][_0x54ec('0x11c')](db[_0x54ec('0x57')],{});db[_0x54ec('0x1cf')][_0x54ec('0x10b')](db[_0x54ec('0xd3')],{'foreignKey':_0x54ec('0x1d0')});db[_0x54ec('0x1cf')][_0x54ec('0x10b')](db[_0x54ec('0xd1')],{'foreignKey':'ProjectId'});db[_0x54ec('0x1cf')][_0x54ec('0x10b')](db[_0x54ec('0xcf')],{'foreignKey':_0x54ec('0x1d0')});db[_0x54ec('0x1d1')][_0x54ec('0x11d')](db['User'],{'as':_0x54ec('0x166'),'through':'user_has_square_projects'});db[_0x54ec('0xe0')][_0x54ec('0x11d')](db[_0x54ec('0x10')],{'as':'Agents','through':_0x54ec('0x124')});db[_0x54ec('0xe0')][_0x54ec('0x11d')](db['VoiceQueue'],{'through':'TeamVoiceQueue','as':_0x54ec('0x12a')});db['Team']['belongsToMany'](db['MailQueue'],{'through':_0x54ec('0x162'),'as':'MailQueues'});db[_0x54ec('0xe0')][_0x54ec('0x11d')](db['ChatQueue'],{'through':'team_has_chat_queues','as':'ChatQueues'});db['Team'][_0x54ec('0x11d')](db[_0x54ec('0x4e')],{'through':'team_has_fax_queues','as':_0x54ec('0x12f')});db[_0x54ec('0xe0')]['belongsToMany'](db[_0x54ec('0x57')],{'through':'team_has_sms_queues','as':_0x54ec('0x1d2')});db['Team'][_0x54ec('0x11d')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':_0x54ec('0x1d3')});db[_0x54ec('0xe0')][_0x54ec('0x11d')](db[_0x54ec('0xff')],{'through':_0x54ec('0x1d4'),'as':_0x54ec('0x1d5')});db['Team']['belongsToMany'](db['VoicePrefix'],{'through':_0x54ec('0x102'),'as':_0x54ec('0x12c')});db[_0x54ec('0x19b')]['hasMany'](db[_0x54ec('0x72')],{'as':_0x54ec('0x141'),'foreignKey':_0x54ec('0x19c')});db['Campaign']['hasMany'](db[_0x54ec('0x110')],{'as':_0x54ec('0x111'),'foreignKey':_0x54ec('0x19c')});db['Campaign'][_0x54ec('0x10b')](db[_0x54ec('0x75')],{'as':_0x54ec('0x195'),'foreignKey':_0x54ec('0x19c')});db[_0x54ec('0x19b')]['hasMany'](db['CmHopperBlack'],{'as':_0x54ec('0x1d6'),'foreignKey':_0x54ec('0x19c')});db[_0x54ec('0x19b')][_0x54ec('0x11c')](db[_0x54ec('0x25')],{'as':_0x54ec('0x25'),'foreignKey':_0x54ec('0x143')});db[_0x54ec('0x19b')][_0x54ec('0x11c')](db[_0x54ec('0x25')],{'as':'TrunkBackup','foreignKey':_0x54ec('0x1d7')});db[_0x54ec('0x19b')][_0x54ec('0x11c')](db[_0x54ec('0x80')],{'as':_0x54ec('0x80'),'foreignKey':_0x54ec('0x16b')});db['Campaign'][_0x54ec('0x11c')](db['SquareProject'],{'as':_0x54ec('0x1d1'),'foreignKey':_0x54ec('0x1d8')});db[_0x54ec('0x19b')][_0x54ec('0x11d')](db[_0x54ec('0xee')],{'as':_0x54ec('0x122'),'through':_0x54ec('0x1d9')});db[_0x54ec('0x19b')][_0x54ec('0x11d')](db[_0x54ec('0xee')],{'as':'BlackLists','through':_0x54ec('0x1da')});db[_0x54ec('0xe3')][_0x54ec('0x11c')](db[_0x54ec('0x69')],{'as':_0x54ec('0x69'),'foreignKey':_0x54ec('0x16a')});db[_0x54ec('0xe6')][_0x54ec('0x11c')](db['MailMessage'],{});db['MailTransferReport'][_0x54ec('0x11c')](db['MailInteraction'],{});db[_0x54ec('0xe6')]['belongsTo'](db['MailAccount'],{'foreignKey':_0x54ec('0x1db'),'as':_0x54ec('0x1dc')});db[_0x54ec('0xe6')][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'foreignKey':_0x54ec('0x1dd'),'as':_0x54ec('0x1de')});db[_0x54ec('0xe6')][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'foreignKey':_0x54ec('0x1df'),'as':_0x54ec('0x1e0')});db[_0x54ec('0xe6')]['belongsTo'](db[_0x54ec('0x3b')],{'foreignKey':_0x54ec('0x1e1'),'as':_0x54ec('0x1e2')});db[_0x54ec('0xe6')][_0x54ec('0x11c')](db[_0x54ec('0x39')],{'foreignKey':'ToMailAccountId','as':_0x54ec('0x1e3')});db[_0x54ec('0x1e4')][_0x54ec('0x11c')](db[_0x54ec('0x18b')],{});db[_0x54ec('0x1e4')][_0x54ec('0x11c')](db[_0x54ec('0x66')],{});db[_0x54ec('0x1e4')][_0x54ec('0x11c')](db[_0x54ec('0x60')],{'foreignKey':_0x54ec('0x1e5'),'as':_0x54ec('0x1dc')});db['ChatTransferReport']['belongsTo'](db[_0x54ec('0x10')],{'foreignKey':_0x54ec('0x1dd'),'as':_0x54ec('0x1de')});db['ChatTransferReport'][_0x54ec('0x11c')](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db['ChatTransferReport'][_0x54ec('0x11c')](db[_0x54ec('0x6b')],{'foreignKey':'ToChatQueueId','as':_0x54ec('0x1e2')});db[_0x54ec('0x1e4')][_0x54ec('0x11c')](db[_0x54ec('0x60')],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db[_0x54ec('0xe9')][_0x54ec('0x11c')](db['FaxMessage'],{});db[_0x54ec('0xe9')][_0x54ec('0x11c')](db[_0x54ec('0x4a')],{});db[_0x54ec('0xe9')][_0x54ec('0x11c')](db['FaxAccount'],{'foreignKey':_0x54ec('0x1e6'),'as':_0x54ec('0x1dc')});db[_0x54ec('0xe9')]['belongsTo'](db['User'],{'foreignKey':_0x54ec('0x1dd'),'as':'FromAgent'});db[_0x54ec('0xe9')][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'foreignKey':_0x54ec('0x1df'),'as':_0x54ec('0x1e0')});db[_0x54ec('0xe9')][_0x54ec('0x11c')](db[_0x54ec('0x4e')],{'foreignKey':_0x54ec('0x1e7'),'as':_0x54ec('0x1e2')});db['FaxTransferReport']['belongsTo'](db['FaxAccount'],{'foreignKey':_0x54ec('0x1e8'),'as':_0x54ec('0x1e3')});db['OpenchannelTransferReport'][_0x54ec('0x11c')](db['OpenchannelMessage'],{});db['OpenchannelTransferReport'][_0x54ec('0x11c')](db[_0x54ec('0x5c')],{});db[_0x54ec('0xeb')][_0x54ec('0x11c')](db[_0x54ec('0x181')],{'foreignKey':_0x54ec('0x1e9'),'as':_0x54ec('0x1dc')});db[_0x54ec('0xeb')]['belongsTo'](db['User'],{'foreignKey':_0x54ec('0x1dd'),'as':_0x54ec('0x1de')});db[_0x54ec('0xeb')][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'foreignKey':_0x54ec('0x1df'),'as':_0x54ec('0x1e0')});db[_0x54ec('0xeb')][_0x54ec('0x11c')](db['OpenchannelQueue'],{'foreignKey':_0x54ec('0x1ea'),'as':_0x54ec('0x1e2')});db['OpenchannelTransferReport'][_0x54ec('0x11c')](db['OpenchannelAccount'],{'foreignKey':_0x54ec('0x1eb'),'as':'ToAccount'});db['SmsTransferReport'][_0x54ec('0x11c')](db['SmsMessage'],{});db[_0x54ec('0xec')][_0x54ec('0x11c')](db[_0x54ec('0x53')],{});db['SmsTransferReport'][_0x54ec('0x11c')](db[_0x54ec('0x50')],{'foreignKey':_0x54ec('0x1ec'),'as':_0x54ec('0x1dc')});db[_0x54ec('0xec')]['belongsTo'](db[_0x54ec('0x10')],{'foreignKey':_0x54ec('0x1dd'),'as':_0x54ec('0x1de')});db[_0x54ec('0xec')]['belongsTo'](db[_0x54ec('0x10')],{'foreignKey':_0x54ec('0x1df'),'as':_0x54ec('0x1e0')});db[_0x54ec('0xec')]['belongsTo'](db[_0x54ec('0x57')],{'foreignKey':_0x54ec('0x1ed'),'as':_0x54ec('0x1e2')});db[_0x54ec('0xec')][_0x54ec('0x11c')](db[_0x54ec('0x50')],{'foreignKey':_0x54ec('0x1ee'),'as':_0x54ec('0x1e3')});db[_0x54ec('0xee')][_0x54ec('0x10b')](db[_0x54ec('0x7c')],{'as':'Dispositions','foreignKey':_0x54ec('0x15e'),'onDelete':_0x54ec('0x10a')});db[_0x54ec('0xee')][_0x54ec('0x10b')](db[_0x54ec('0x79')],{'as':_0x54ec('0x1ef'),'foreignKey':_0x54ec('0x15e')});db[_0x54ec('0xee')][_0x54ec('0x10b')](db[_0x54ec('0x151')],{'as':_0x54ec('0x120'),'onDelete':_0x54ec('0x10a'),'foreignKey':'ListId'});db['CmList'][_0x54ec('0x10b')](db[_0x54ec('0x110')],{'as':_0x54ec('0x111'),'foreignKey':_0x54ec('0x15e')});db[_0x54ec('0xee')][_0x54ec('0x10b')](db[_0x54ec('0x75')],{'as':'HopperHistory','foreignKey':'ListId'});db[_0x54ec('0xee')][_0x54ec('0x10b')](db[_0x54ec('0x77')],{'as':_0x54ec('0x77'),'foreignKey':_0x54ec('0x15e')});db[_0x54ec('0xee')][_0x54ec('0x11d')](db[_0x54ec('0x19')],{'as':_0x54ec('0x1f0'),'through':_0x54ec('0x146')});db['CmList'][_0x54ec('0x11d')](db[_0x54ec('0x10')],{'as':'Agents','through':_0x54ec('0x123')});db['VoicePrefix'][_0x54ec('0x10b')](db[_0x54ec('0x15')],{'as':'Extensions','onDelete':_0x54ec('0x10a')});db[_0x54ec('0x12b')][_0x54ec('0x11d')](db[_0x54ec('0x10')],{'as':'Agents','through':_0x54ec('0x12d')});db[_0x54ec('0x12b')][_0x54ec('0x11d')](db[_0x54ec('0xe0')],{'through':'TeamVoicePrefix','as':_0x54ec('0x187')});db[_0x54ec('0xf1')][_0x54ec('0x10b')](db[_0x54ec('0x10')],{'as':_0x54ec('0x166'),'foreignKey':_0x54ec('0x1f1')});db['UserProfile'][_0x54ec('0x10b')](db[_0x54ec('0xf2')],{'as':_0x54ec('0x1f2'),'foreignKey':_0x54ec('0x1f1'),'onDelete':_0x54ec('0x10a')});db[_0x54ec('0xf2')][_0x54ec('0x10b')](db[_0x54ec('0xf4')],{'as':'Resources','foreignKey':_0x54ec('0x1f3'),'onDelete':_0x54ec('0x10a')});db['WhatsappAccount'][_0x54ec('0x10b')](db[_0x54ec('0x7c')],{'as':'Dispositions','foreignKey':_0x54ec('0x1f4'),'onDelete':_0x54ec('0x10a')});db[_0x54ec('0x139')]['hasMany'](db[_0x54ec('0x16f')],{'as':_0x54ec('0x15b'),'foreignKey':_0x54ec('0x1f4')});db[_0x54ec('0x139')][_0x54ec('0x10b')](db[_0x54ec('0xfa')],{'as':_0x54ec('0x14a'),'foreignKey':'WhatsappAccountId'});db[_0x54ec('0x139')][_0x54ec('0x10b')](db[_0x54ec('0xf8')],{'as':_0x54ec('0x15c')});db[_0x54ec('0x139')][_0x54ec('0x10b')](db[_0x54ec('0xf6')],{'as':_0x54ec('0x170')});db[_0x54ec('0x139')][_0x54ec('0x11c')](db[_0x54ec('0xee')],{'as':_0x54ec('0x15d'),'foreignKey':_0x54ec('0x15e')});db[_0x54ec('0x139')][_0x54ec('0x11c')](db['Pause'],{'as':_0x54ec('0x161'),'foreignKey':_0x54ec('0x145')});db[_0x54ec('0x139')][_0x54ec('0x11d')](db['User'],{'as':_0x54ec('0x147'),'through':_0x54ec('0x1f5')});db[_0x54ec('0xf6')][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'onDelete':_0x54ec('0x157')});db['WhatsappApplication']['belongsTo'](db[_0x54ec('0xff')],{'onDelete':_0x54ec('0x157')});db['WhatsappApplication'][_0x54ec('0x11c')](db[_0x54ec('0x139')],{'onDelete':_0x54ec('0x157')});db['WhatsappApplication'][_0x54ec('0x11c')](db[_0x54ec('0x80')],{'onDelete':_0x54ec('0x157'),'foreignKey':'IntervalId'});db[_0x54ec('0xf6')][_0x54ec('0x11c')](db['Tag'],{'onDelete':_0x54ec('0x157'),'foreignKey':_0x54ec('0x173')});db[_0x54ec('0xf8')][_0x54ec('0x10b')](db[_0x54ec('0xfa')],{'as':_0x54ec('0x14a'),'onDelete':_0x54ec('0x10a'),'foreignKey':_0x54ec('0x1f6')});db[_0x54ec('0xf8')]['belongsTo'](db[_0x54ec('0x139')],{'as':_0x54ec('0x168'),'foreignKey':_0x54ec('0x1f4')});db[_0x54ec('0xf8')][_0x54ec('0x11c')](db[_0x54ec('0x151')],{'as':'Contact','foreignKey':_0x54ec('0x153')});db[_0x54ec('0xf8')]['belongsTo'](db[_0x54ec('0x10')],{'as':_0x54ec('0x164'),'foreignKey':_0x54ec('0x108')});db[_0x54ec('0xf8')][_0x54ec('0x11d')](db[_0x54ec('0x8a')],{'through':'whatsapp_interaction_has_tags','as':_0x54ec('0x176')});db['WhatsappInteraction'][_0x54ec('0x11d')](db[_0x54ec('0x8a')],{'through':_0x54ec('0x1ab'),'as':_0x54ec('0x177')});db['WhatsappInteraction'][_0x54ec('0x11d')](db['User'],{'as':_0x54ec('0x166'),'through':_0x54ec('0x129'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'as':_0x54ec('0x10')});db[_0x54ec('0xfa')]['belongsTo'](db[_0x54ec('0x151')],{'onDelete':_0x54ec('0x10a'),'as':'Contact'});db['WhatsappMessage'][_0x54ec('0x11c')](db[_0x54ec('0xf8')],{'onDelete':_0x54ec('0x10a'),'as':_0x54ec('0x167'),'foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x54ec('0x11c')](db[_0x54ec('0x139')],{'as':_0x54ec('0x168'),'foreignKey':_0x54ec('0x1f4')});db[_0x54ec('0xfb')][_0x54ec('0x11c')](db[_0x54ec('0x139')],{});db[_0x54ec('0xfb')]['belongsTo'](db[_0x54ec('0xee')],{'as':_0x54ec('0x15d'),'foreignKey':_0x54ec('0x15e')});db['WhatsappQueueReport'][_0x54ec('0x11c')](db[_0x54ec('0x151')],{'as':_0x54ec('0x152'),'foreignKey':_0x54ec('0x153')});db['WhatsappQueueReport'][_0x54ec('0x11c')](db[_0x54ec('0xf8')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x54ec('0xff')],{});db[_0x54ec('0xfb')][_0x54ec('0x11c')](db['WhatsappMessage'],{});db[_0x54ec('0xfb')][_0x54ec('0x11c')](db['User'],{});db[_0x54ec('0xfd')][_0x54ec('0x11c')](db[_0x54ec('0xfa')],{});db[_0x54ec('0xfd')][_0x54ec('0x11c')](db[_0x54ec('0xf8')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x54ec('0x139')],{'foreignKey':_0x54ec('0x1f7'),'as':_0x54ec('0x1dc')});db[_0x54ec('0xfd')][_0x54ec('0x11c')](db['WhatsappAccount'],{'foreignKey':_0x54ec('0x1f8'),'as':_0x54ec('0x1e3')});db[_0x54ec('0xfd')][_0x54ec('0x11c')](db[_0x54ec('0xff')],{'foreignKey':_0x54ec('0x1f9'),'as':_0x54ec('0x1e2')});db[_0x54ec('0xfd')][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'foreignKey':_0x54ec('0x1dd'),'as':_0x54ec('0x1de')});db[_0x54ec('0xfd')][_0x54ec('0x11c')](db['User'],{'foreignKey':_0x54ec('0x1df'),'as':'ToAgent'});db[_0x54ec('0xff')][_0x54ec('0x11d')](db[_0x54ec('0x10')],{'as':_0x54ec('0x147'),'through':_0x54ec('0x34'),'foreignKey':_0x54ec('0x1fa')});db[_0x54ec('0xff')][_0x54ec('0x11d')](db[_0x54ec('0xe0')],{'through':_0x54ec('0x1d4'),'as':'Teams'});db['UserSetting'][_0x54ec('0x11c')](db[_0x54ec('0x10')],{'as':_0x54ec('0x1fb'),'foreignKey':_0x54ec('0x108'),'onDelete':'cascade','hooks':!![]});db[_0x54ec('0x155')][_0x54ec('0x107')](db[_0x54ec('0xc1')],{'as':_0x54ec('0xc1'),'onDelete':_0x54ec('0x157')});db[_0x54ec('0x155')]['hasOne'](db[_0x54ec('0x35')],{'as':_0x54ec('0x158'),'onDelete':_0x54ec('0x157')});db[_0x54ec('0x155')][_0x54ec('0x107')](db['MailServerOut'],{'as':_0x54ec('0x159'),'onDelete':_0x54ec('0x157')});module[_0x54ec('0x1fc')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 8448cef..58adabe 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa25a=['/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/applications','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','path','./errors','./config/environment','./utils/client-side-logger','./api/client-side-logs','default','use','/api/users','./api/user','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/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/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/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/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField'];(function(_0x1bb1eb,_0x540019){var _0x568b3e=function(_0x12a666){while(--_0x12a666){_0x1bb1eb['push'](_0x1bb1eb['shift']());}};_0x568b3e(++_0x540019);}(_0xa25a,0x6e));var _0xaa25=function(_0x1b4cdf,_0xb74587){_0x1b4cdf=_0x1b4cdf-0x0;var _0x53c9da=_0xa25a[_0x1b4cdf];return _0x53c9da;};'use strict';var path=require(_0xaa25('0x0'));var express=require('express');var errors=require(_0xaa25('0x1'));var config=require(_0xaa25('0x2'));var setupLoggers=require(_0xaa25('0x3'))['setupLoggers'];var clientSideLogs=require(_0xaa25('0x4'));exports[_0xaa25('0x5')]=function(_0xe617ce){return setupLoggers(_0xe617ce)['then'](function(){_0xe617ce[_0xaa25('0x6')](_0xaa25('0x7'),require(_0xaa25('0x8')));_0xe617ce[_0xaa25('0x6')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x9'),require(_0xaa25('0xa')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xb'),require(_0xaa25('0xc')));_0xe617ce[_0xaa25('0x6')]('/api/voice/mohs',require(_0xaa25('0xd')));_0xe617ce['use'](_0xaa25('0xe'),require('./api/voiceQueue'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xf'),require(_0xaa25('0x10')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x11'),require(_0xaa25('0x12')));_0xe617ce['use'](_0xaa25('0x13'),require(_0xaa25('0x14')));_0xe617ce[_0xaa25('0x6')]('/api/voice/mails/messages',require(_0xaa25('0x15')));_0xe617ce['use']('/api/voice/calls/reports',require(_0xaa25('0x16')));_0xe617ce[_0xaa25('0x6')]('/api/voice/dials/reports',require(_0xaa25('0x17')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x18'),require('./api/voiceAgentReport'));_0xe617ce[_0xaa25('0x6')]('/api/voice/queues/reports',require(_0xaa25('0x19')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x1a'),require(_0xaa25('0x1b')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x1c'),require('./api/trunk'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x1d'),require('./api/voiceTransferReport'));_0xe617ce[_0xaa25('0x6')]('/api/mail/out_servers',require(_0xaa25('0x1e')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x1f'),require(_0xaa25('0x20')));_0xe617ce[_0xaa25('0x6')]('/api/mail/queues',require(_0xaa25('0x21')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x22'),require(_0xaa25('0x23')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x24'),require(_0xaa25('0x25')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x26'),require(_0xaa25('0x27')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x28'),require('./api/mailApplication'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x29'),require('./api/mailQueueReport'));_0xe617ce[_0xaa25('0x6')]('/api/dashboards',require(_0xaa25('0x2a')));_0xe617ce['use'](_0xaa25('0x2b'),require(_0xaa25('0x2c')));_0xe617ce['use'](_0xaa25('0x2d'),require(_0xaa25('0x2e')));_0xe617ce[_0xaa25('0x6')]('/api/fax/applications',require(_0xaa25('0x2f')));_0xe617ce['use'](_0xaa25('0x30'),require(_0xaa25('0x31')));_0xe617ce['use'](_0xaa25('0x32'),require(_0xaa25('0x33')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x34'),require('./api/faxQueue'));_0xe617ce[_0xaa25('0x6')]('/api/fax/reports/queue',require(_0xaa25('0x35')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x36'),require(_0xaa25('0x37')));_0xe617ce['use'](_0xaa25('0x38'),require('./api/smsApplication'));_0xe617ce['use'](_0xaa25('0x39'),require(_0xaa25('0x3a')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x3b'),require(_0xaa25('0x3c')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x3d'),require(_0xaa25('0x3e')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x3f'),require(_0xaa25('0x40')));_0xe617ce['use'](_0xaa25('0x41'),require(_0xaa25('0x42')));_0xe617ce['use'](_0xaa25('0x43'),require('./api/openchannelInteraction'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x44'),require(_0xaa25('0x45')));_0xe617ce[_0xaa25('0x6')]('/api/openchannel/queues',require(_0xaa25('0x46')));_0xe617ce['use'](_0xaa25('0x47'),require(_0xaa25('0x48')));_0xe617ce[_0xaa25('0x6')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x49'),require(_0xaa25('0x4a')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x4b'),require(_0xaa25('0x4c')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x4d'),require(_0xaa25('0x4e')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x4f'),require(_0xaa25('0x50')));_0xe617ce[_0xaa25('0x6')]('/api/chat/queues',require(_0xaa25('0x51')));_0xe617ce['use'](_0xaa25('0x52'),require(_0xaa25('0x53')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x54'),require('./api/chatProactiveAction'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x55'),require('./api/cmCompany'));_0xe617ce['use']('/api/cm/contacts',require(_0xaa25('0x56')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x57'),require(_0xaa25('0x58')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x59'),require('./api/cmHopperBlack'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x5a'),require(_0xaa25('0x5b')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x5c'),require('./api/cmHopperHistory'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x5d'),require(_0xaa25('0x5e')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x5f'),require(_0xaa25('0x60')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x61'),require('./api/automation'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x62'),require(_0xaa25('0x63')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x64'),require(_0xaa25('0x65')));_0xe617ce['use']('/api/conditions',require(_0xaa25('0x66')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x67'),require(_0xaa25('0x68')));_0xe617ce[_0xaa25('0x6')]('/api/pauses',require(_0xaa25('0x69')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x6a'),require(_0xaa25('0x6b')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x6c'),require(_0xaa25('0x6d')));_0xe617ce['use']('/api/schedules',require(_0xaa25('0x6e')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x6f'),require(_0xaa25('0x70')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x71'),require(_0xaa25('0x72')));_0xe617ce['use'](_0xaa25('0x73'),require(_0xaa25('0x74')));_0xe617ce[_0xaa25('0x6')]('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0xe617ce['use'](_0xaa25('0x75'),require(_0xaa25('0x76')));_0xe617ce['use'](_0xaa25('0x77'),require(_0xaa25('0x78')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x79'),require(_0xaa25('0x7a')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x7b'),require(_0xaa25('0x7c')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x7d'),require('./api/integration'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x7e'),require(_0xaa25('0x7f')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x80'),require(_0xaa25('0x81')));_0xe617ce['use'](_0xaa25('0x82'),require(_0xaa25('0x83')));_0xe617ce['use'](_0xaa25('0x84'),require(_0xaa25('0x85')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x86'),require('./api/analyticMetric'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x87'),require(_0xaa25('0x88')));_0xe617ce['use']('/api/analytics/tree_reports',require(_0xaa25('0x89')));_0xe617ce['use']('/api/integrations/salesforce/accounts',require(_0xaa25('0x8a')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x8b'),require(_0xaa25('0x8c')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x8d'),require('./api/intSalesforceField'));_0xe617ce[_0xaa25('0x6')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x8e'),require('./api/intSugarcrmConfiguration'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x8f'),require('./api/intSugarcrmField'));_0xe617ce['use'](_0xaa25('0x90'),require(_0xaa25('0x91')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x92'),require(_0xaa25('0x93')));_0xe617ce[_0xaa25('0x6')]('/api/integrations/desk/fields',require(_0xaa25('0x94')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x95'),require(_0xaa25('0x96')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x97'),require(_0xaa25('0x98')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x99'),require(_0xaa25('0x9a')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x9b'),require(_0xaa25('0x9c')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x9d'),require(_0xaa25('0x9e')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x9f'),require(_0xaa25('0xa0')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xa1'),require(_0xaa25('0xa2')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xa3'),require(_0xaa25('0xa4')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xa5'),require('./api/intFreshdeskField'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xa6'),require('./api/intVtigerAccount'));_0xe617ce['use'](_0xaa25('0xa7'),require(_0xaa25('0xa8')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xa9'),require(_0xaa25('0xaa')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xab'),require(_0xaa25('0xac')));_0xe617ce[_0xaa25('0x6')]('/api/integrations/servicenow/configurations',require(_0xaa25('0xad')));_0xe617ce['use'](_0xaa25('0xae'),require('./api/intServicenowField'));_0xe617ce['use'](_0xaa25('0xaf'),require(_0xaa25('0xb0')));_0xe617ce['use'](_0xaa25('0xb1'),require('./api/intDynamics365Configuration'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xb2'),require('./api/intDynamics365Field'));_0xe617ce['use']('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xb3'),require('./api/intFreshsalesConfiguration'));_0xe617ce['use'](_0xaa25('0xb4'),require(_0xaa25('0xb5')));_0xe617ce['use'](_0xaa25('0xb6'),require(_0xaa25('0xb7')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xb8'),require(_0xaa25('0xb9')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xba'),require('./api/chatInternalMessage'));_0xe617ce[_0xaa25('0x6')]('/api/jscripty/answers/reports',require(_0xaa25('0xbb')));_0xe617ce[_0xaa25('0x6')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xbc'),require(_0xaa25('0xbd')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xbe'),require(_0xaa25('0xbf')));_0xe617ce['use'](_0xaa25('0xc0'),require(_0xaa25('0xc1')));_0xe617ce['use'](_0xaa25('0xc2'),require(_0xaa25('0xc3')));_0xe617ce[_0xaa25('0x6')]('/api/jscripty/projects',require(_0xaa25('0xc4')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xc5'),require(_0xaa25('0xc6')));_0xe617ce[_0xaa25('0x6')]('/api/square/odbc',require(_0xaa25('0xc7')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xc8'),require(_0xaa25('0xc9')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xca'),require(_0xaa25('0xcb')));_0xe617ce['use']('/api/square/messages',require(_0xaa25('0xcc')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xcd'),require(_0xaa25('0xce')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xcf'),require(_0xaa25('0xd0')));_0xe617ce['use'](_0xaa25('0xd1'),require(_0xaa25('0xd2')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xd3'),require(_0xaa25('0xd4')));_0xe617ce['use'](_0xaa25('0xd5'),require(_0xaa25('0xd6')));_0xe617ce[_0xaa25('0x6')]('/api/plugins',require(_0xaa25('0xd7')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xd8'),require('./api/mailTransferReport'));_0xe617ce['use']('/api/chat/reports/transfer',require(_0xaa25('0xd9')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xda'),require(_0xaa25('0xdb')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xdc'),require(_0xaa25('0xdd')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xde'),require(_0xaa25('0xdf')));_0xe617ce['use']('/api/cm/lists',require(_0xaa25('0xe0')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xe1'),require(_0xaa25('0xe2')));_0xe617ce['use']('/api/userProfiles',require(_0xaa25('0xe3')));_0xe617ce['use'](_0xaa25('0xe4'),require(_0xaa25('0xe5')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xe6'),require(_0xaa25('0xe7')));_0xe617ce['use'](_0xaa25('0xe8'),require(_0xaa25('0xe9')));_0xe617ce[_0xaa25('0x6')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xea'),require('./api/whatsappApplication'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xeb'),require('./api/whatsappInteraction'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xec'),require(_0xaa25('0xed')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xee'),require('./api/whatsappQueueReport'));_0xe617ce['use'](_0xaa25('0xef'),require(_0xaa25('0xf0')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xf1'),require(_0xaa25('0xf2')));_0xe617ce['use'](_0xaa25('0xf3'),require('./api/cloudProvider'));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xf4'),require(_0xaa25('0xf5')));_0xe617ce['use'](_0xaa25('0xf6'),require(_0xaa25('0xf7')));_0xe617ce[_0xaa25('0x6')]('/api/auth/local',require(_0xaa25('0xf8')));_0xe617ce[_0xaa25('0x6')]('/api/auth/google',require(_0xaa25('0xf9')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xfa'),require(_0xaa25('0xfb')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xfc'),require(_0xaa25('0xfd')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0xfe'),require(_0xaa25('0xff')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x100'),require(_0xaa25('0x101')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x102'),require(_0xaa25('0x103')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x104'),require(_0xaa25('0x105')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x106'),require(_0xaa25('0x107')));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x108'),clientSideLogs);_0xe617ce[_0xaa25('0x6')](_0xaa25('0x109'),express[_0xaa25('0x10a')](path[_0xaa25('0x10b')](config['root'],'/apidoc')));_0xe617ce[_0xaa25('0x6')]('/www',express[_0xaa25('0x10a')](path[_0xaa25('0x10b')](config[_0xaa25('0x10c')],_0xaa25('0x10d'))));_0xe617ce[_0xaa25('0x6')](_0xaa25('0x10e'),express[_0xaa25('0x10a')](path['join'](config['root'],_0xaa25('0x10e'))));_0xe617ce['use'](_0xaa25('0x10f'),express[_0xaa25('0x10a')](path['join'](config[_0xaa25('0x10c')],_0xaa25('0x110'),_0xaa25('0x111'))));_0xe617ce['use']('/plugins',express[_0xaa25('0x10a')](path[_0xaa25('0x10b')](config[_0xaa25('0x10c')],_0xaa25('0x112'))));_0xe617ce[_0xaa25('0x113')](_0xaa25('0x114'))[_0xaa25('0x115')](errors[0x194]);_0xe617ce[_0xaa25('0x113')]('/*')[_0xaa25('0x115')](function(_0x192e1c,_0x217ac2){_0x217ac2[_0xaa25('0x116')](path[_0xaa25('0x117')](_0xe617ce['get']('appPath')+_0xaa25('0x118')));});return _0xe617ce;});}; \ No newline at end of file +var _0xfc96=['./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','/api/settings','/api/square/odbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/openchannel/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileResource','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/rpc','./api/rpc','/api/version','./api/version','/api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','3.0.0','route','get','resolve','appPath','express','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/smsAccount','/api/sms/applications','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','./api/chatMessage','/api/chat/offline_messages','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount'];(function(_0x5a152d,_0x52c417){var _0x5d4687=function(_0x4ecf8f){while(--_0x4ecf8f){_0x5a152d['push'](_0x5a152d['shift']());}};_0x5d4687(++_0x52c417);}(_0xfc96,0x175));var _0x6fc9=function(_0x17b94e,_0x1b2f59){_0x17b94e=_0x17b94e-0x0;var _0x14ab53=_0xfc96[_0x17b94e];return _0x14ab53;};'use strict';var path=require('path');var express=require(_0x6fc9('0x0'));var errors=require(_0x6fc9('0x1'));var config=require('./config/environment');var setupLoggers=require(_0x6fc9('0x2'))[_0x6fc9('0x3')];var clientSideLogs=require(_0x6fc9('0x4'));exports[_0x6fc9('0x5')]=function(_0x51bd96){return setupLoggers(_0x51bd96)[_0x6fc9('0x6')](function(){_0x51bd96[_0x6fc9('0x7')]('/api/users',require('./api/user'));_0x51bd96['use']('/api/voice/chanspy',require(_0x6fc9('0x8')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x9'),require(_0x6fc9('0xa')));_0x51bd96['use'](_0x6fc9('0xb'),require(_0x6fc9('0xc')));_0x51bd96['use']('/api/voice/mohs',require(_0x6fc9('0xd')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xe'),require(_0x6fc9('0xf')));_0x51bd96[_0x6fc9('0x7')]('/api/voice/recordings',require(_0x6fc9('0x10')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x11'),require(_0x6fc9('0x12')));_0x51bd96['use'](_0x6fc9('0x13'),require(_0x6fc9('0x14')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x15'),require(_0x6fc9('0x16')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x17'),require(_0x6fc9('0x18')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x19'),require(_0x6fc9('0x1a')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x1b'),require(_0x6fc9('0x1c')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x1d'),require(_0x6fc9('0x1e')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x1f'),require(_0x6fc9('0x20')));_0x51bd96['use']('/api/trunks',require(_0x6fc9('0x21')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x22'),require(_0x6fc9('0x23')));_0x51bd96['use'](_0x6fc9('0x24'),require('./api/mailServerOut'));_0x51bd96[_0x6fc9('0x7')]('/api/mail/accounts',require(_0x6fc9('0x25')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x26'),require(_0x6fc9('0x27')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x28'),require(_0x6fc9('0x29')));_0x51bd96['use'](_0x6fc9('0x2a'),require('./api/mailInteraction'));_0x51bd96[_0x6fc9('0x7')]('/api/mail/messages',require(_0x6fc9('0x2b')));_0x51bd96['use'](_0x6fc9('0x2c'),require(_0x6fc9('0x2d')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x2e'),require('./api/mailQueueReport'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x2f'),require(_0x6fc9('0x30')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x31'),require('./api/dashboardItem'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x32'),require('./api/faxAccount'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x33'),require(_0x6fc9('0x34')));_0x51bd96['use'](_0x6fc9('0x35'),require(_0x6fc9('0x36')));_0x51bd96['use']('/api/fax/messages',require(_0x6fc9('0x37')));_0x51bd96['use'](_0x6fc9('0x38'),require(_0x6fc9('0x39')));_0x51bd96[_0x6fc9('0x7')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x51bd96[_0x6fc9('0x7')]('/api/sms/accounts',require(_0x6fc9('0x3a')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x3b'),require('./api/smsApplication'));_0x51bd96['use'](_0x6fc9('0x3c'),require('./api/smsInteraction'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x3d'),require(_0x6fc9('0x3e')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x3f'),require(_0x6fc9('0x40')));_0x51bd96[_0x6fc9('0x7')]('/api/openchannel/accounts',require(_0x6fc9('0x41')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x42'),require(_0x6fc9('0x43')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x44'),require(_0x6fc9('0x45')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x46'),require(_0x6fc9('0x47')));_0x51bd96[_0x6fc9('0x7')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x48'),require(_0x6fc9('0x49')));_0x51bd96['use'](_0x6fc9('0x4a'),require(_0x6fc9('0x4b')));_0x51bd96['use'](_0x6fc9('0x4c'),require(_0x6fc9('0x4d')));_0x51bd96[_0x6fc9('0x7')]('/api/chat/interactions',require(_0x6fc9('0x4e')));_0x51bd96[_0x6fc9('0x7')]('/api/chat/messages',require(_0x6fc9('0x4f')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x50'),require('./api/chatOfflineMessage'));_0x51bd96[_0x6fc9('0x7')]('/api/chat/queues',require(_0x6fc9('0x51')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x52'),require(_0x6fc9('0x53')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x54'),require(_0x6fc9('0x55')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x56'),require(_0x6fc9('0x57')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x58'),require(_0x6fc9('0x59')));_0x51bd96[_0x6fc9('0x7')]('/api/cm/hopper',require(_0x6fc9('0x5a')));_0x51bd96[_0x6fc9('0x7')]('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0x51bd96[_0x6fc9('0x7')]('/api/cm/hopper_final',require(_0x6fc9('0x5b')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x5c'),require(_0x6fc9('0x5d')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x5e'),require('./api/cmCustomField'));_0x51bd96[_0x6fc9('0x7')]('/api/actions',require(_0x6fc9('0x5f')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x60'),require(_0x6fc9('0x61')));_0x51bd96[_0x6fc9('0x7')]('/api/canned_answers',require(_0x6fc9('0x62')));_0x51bd96['use'](_0x6fc9('0x63'),require('./api/disposition'));_0x51bd96[_0x6fc9('0x7')]('/api/conditions',require(_0x6fc9('0x64')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x65'),require(_0x6fc9('0x66')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x67'),require('./api/pause'));_0x51bd96['use'](_0x6fc9('0x68'),require(_0x6fc9('0x69')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x6a'),require(_0x6fc9('0x6b')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x6c'),require(_0x6fc9('0x6d')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x6e'),require(_0x6fc9('0x6f')));_0x51bd96[_0x6fc9('0x7')]('/api/tags',require(_0x6fc9('0x70')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x71'),require(_0x6fc9('0x72')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x73'),require('./api/cmContactHasItem'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x74'),require(_0x6fc9('0x75')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x76'),require(_0x6fc9('0x77')));_0x51bd96[_0x6fc9('0x7')]('/api/triggers',require(_0x6fc9('0x78')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x79'),require(_0x6fc9('0x7a')));_0x51bd96['use']('/api/integrations',require(_0x6fc9('0x7b')));_0x51bd96['use'](_0x6fc9('0x7c'),require(_0x6fc9('0x7d')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x7e'),require('./api/analyticCustomReport'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x7f'),require('./api/analyticDefaultReport'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x80'),require(_0x6fc9('0x81')));_0x51bd96['use'](_0x6fc9('0x82'),require(_0x6fc9('0x83')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x84'),require(_0x6fc9('0x85')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x86'),require(_0x6fc9('0x87')));_0x51bd96['use']('/api/integrations/salesforce/accounts',require(_0x6fc9('0x88')));_0x51bd96['use'](_0x6fc9('0x89'),require('./api/intSalesforceConfiguration'));_0x51bd96[_0x6fc9('0x7')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x8a'),require(_0x6fc9('0x8b')));_0x51bd96[_0x6fc9('0x7')]('/api/integrations/sugarcrm/configurations',require(_0x6fc9('0x8c')));_0x51bd96['use'](_0x6fc9('0x8d'),require(_0x6fc9('0x8e')));_0x51bd96[_0x6fc9('0x7')]('/api/integrations/desk/accounts',require(_0x6fc9('0x8f')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x90'),require('./api/intDeskConfiguration'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x91'),require(_0x6fc9('0x92')));_0x51bd96['use'](_0x6fc9('0x93'),require(_0x6fc9('0x94')));_0x51bd96[_0x6fc9('0x7')]('/api/integrations/zoho/configurations',require(_0x6fc9('0x95')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x96'),require(_0x6fc9('0x97')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x98'),require(_0x6fc9('0x99')));_0x51bd96[_0x6fc9('0x7')]('/api/integrations/zendesk/configurations',require(_0x6fc9('0x9a')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x9b'),require(_0x6fc9('0x9c')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x9d'),require(_0x6fc9('0x9e')));_0x51bd96[_0x6fc9('0x7')]('/api/integrations/freshdesk/configurations',require('./api/intFreshdeskConfiguration'));_0x51bd96[_0x6fc9('0x7')]('/api/integrations/freshdesk/fields',require(_0x6fc9('0x9f')));_0x51bd96[_0x6fc9('0x7')]('/api/integrations/vtiger/accounts',require(_0x6fc9('0xa0')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xa1'),require(_0x6fc9('0xa2')));_0x51bd96['use'](_0x6fc9('0xa3'),require(_0x6fc9('0xa4')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xa5'),require(_0x6fc9('0xa6')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xa7'),require(_0x6fc9('0xa8')));_0x51bd96['use'](_0x6fc9('0xa9'),require(_0x6fc9('0xaa')));_0x51bd96['use']('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xab'),require(_0x6fc9('0xac')));_0x51bd96['use']('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xad'),require(_0x6fc9('0xae')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xaf'),require(_0x6fc9('0xb0')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xb1'),require(_0x6fc9('0xb2')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xb3'),require(_0x6fc9('0xb4')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xb5'),require('./api/chatQueueReport'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xb6'),require(_0x6fc9('0xb7')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xb8'),require(_0x6fc9('0xb9')));_0x51bd96['use'](_0x6fc9('0xba'),require(_0x6fc9('0xbb')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xbc'),require(_0x6fc9('0xbd')));_0x51bd96['use'](_0x6fc9('0xbe'),require(_0x6fc9('0xbf')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xc0'),require(_0x6fc9('0xc1')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xc2'),require('./api/squareReportDetail'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xc3'),require('./api/jscriptyProject'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xc4'),require('./api/setting'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xc5'),require('./api/squareOdbc'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xc6'),require('./api/squareProject'));_0x51bd96['use'](_0x6fc9('0xc7'),require(_0x6fc9('0xc8')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xc9'),require(_0x6fc9('0xca')));_0x51bd96['use'](_0x6fc9('0xcb'),require(_0x6fc9('0xcc')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xcd'),require(_0x6fc9('0xce')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xcf'),require(_0x6fc9('0xd0')));_0x51bd96[_0x6fc9('0x7')]('/api/migrations',require(_0x6fc9('0xd1')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xd2'),require('./api/attachment'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xd3'),require(_0x6fc9('0xd4')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xd5'),require('./api/mailTransferReport'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xd6'),require(_0x6fc9('0xd7')));_0x51bd96['use']('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x51bd96['use'](_0x6fc9('0xd8'),require('./api/openchannelTransferReport'));_0x51bd96[_0x6fc9('0x7')]('/api/sms/reports/transfer',require(_0x6fc9('0xd9')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xda'),require(_0x6fc9('0xdb')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xdc'),require(_0x6fc9('0xdd')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xde'),require('./api/userProfile'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xdf'),require('./api/userProfileSection'));_0x51bd96[_0x6fc9('0x7')]('/api/userProfile/resources',require(_0x6fc9('0xe0')));_0x51bd96[_0x6fc9('0x7')]('/api/userNotifications',require('./api/userNotification'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xe1'),require(_0x6fc9('0xe2')));_0x51bd96['use'](_0x6fc9('0xe3'),require(_0x6fc9('0xe4')));_0x51bd96[_0x6fc9('0x7')]('/api/whatsapp/interactions',require(_0x6fc9('0xe5')));_0x51bd96[_0x6fc9('0x7')]('/api/whatsapp/messages',require(_0x6fc9('0xe6')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xe7'),require('./api/whatsappQueueReport'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xe8'),require(_0x6fc9('0xe9')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xea'),require(_0x6fc9('0xeb')));_0x51bd96['use'](_0x6fc9('0xec'),require('./api/cloudProvider'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xed'),require(_0x6fc9('0xee')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xef'),require(_0x6fc9('0xf0')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xf1'),require('./api/authLocal'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xf2'),require(_0x6fc9('0xf3')));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xf4'),require(_0x6fc9('0xf5')));_0x51bd96[_0x6fc9('0x7')]('/api/jira',require('./api/jira'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xf6'),require(_0x6fc9('0xf7')));_0x51bd96['use'](_0x6fc9('0xf8'),require(_0x6fc9('0xf9')));_0x51bd96[_0x6fc9('0x7')]('/api/system',require('./api/system'));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xfa'),require('./api/pm2'));_0x51bd96['use'](_0x6fc9('0xfb'),require(_0x6fc9('0xfc')));_0x51bd96['use'](_0x6fc9('0xfd'),clientSideLogs);_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0xfe'),express[_0x6fc9('0xff')](path[_0x6fc9('0x100')](config[_0x6fc9('0x101')],_0x6fc9('0xfe'))));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x102'),express[_0x6fc9('0xff')](path[_0x6fc9('0x100')](config[_0x6fc9('0x101')],_0x6fc9('0x102'))));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x103'),express['static'](path['join'](config['root'],_0x6fc9('0x103'))));_0x51bd96[_0x6fc9('0x7')](_0x6fc9('0x104'),express[_0x6fc9('0xff')](path[_0x6fc9('0x100')](config[_0x6fc9('0x101')],'snippet',_0x6fc9('0x105'))));_0x51bd96[_0x6fc9('0x7')]('/plugins',express[_0x6fc9('0xff')](path[_0x6fc9('0x100')](config[_0x6fc9('0x101')],'/server/files/plugins')));_0x51bd96[_0x6fc9('0x106')]('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x51bd96[_0x6fc9('0x106')]('/*')[_0x6fc9('0x107')](function(_0x1dff52,_0x270d01){_0x270d01['sendFile'](path[_0x6fc9('0x108')](_0x51bd96[_0x6fc9('0x107')](_0x6fc9('0x109'))+'/index.html'));});return _0x51bd96;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index abf474e..b0ba4ec 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3fe9=['../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','port','rpc','localhost','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc'];(function(_0x5203a9,_0x34263a){var _0x1cdb66=function(_0x2ab707){while(--_0x2ab707){_0x5203a9['push'](_0x5203a9['shift']());}};_0x1cdb66(++_0x34263a);}(_0x3fe9,0x106));var _0x93fe=function(_0x48b3c3,_0x396e40){_0x48b3c3=_0x48b3c3-0x0;var _0x2b2c27=_0x3fe9[_0x48b3c3];return _0x2b2c27;};'use strict';var jayson=require(_0x93fe('0x0'));var _=require(_0x93fe('0x1'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x363bc1,_0x607ebc){var _0x8232f3={};_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require('../api/user/user.rpc'));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x3')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x4')));_0x8232f3=_['merge'](_0x8232f3,require(_0x93fe('0x5')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x6')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x8232f3=_['merge'](_0x8232f3,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x7')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x8')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x9')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0xa')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require('../api/mailAccount/mailAccount.rpc'));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0xb')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0xc')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require('../api/mailMessage/mailMessage.rpc'));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require('../api/mailApplication/mailApplication.rpc'));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0xd')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require('../api/faxAccount/faxAccount.rpc'));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0xe')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0xf')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require('../api/faxMessage/faxMessage.rpc'));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x10')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x11')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x12')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x13')));_0x8232f3=_['merge'](_0x8232f3,require(_0x93fe('0x14')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x15')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x16')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x17')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x18')));_0x8232f3=_['merge'](_0x8232f3,require(_0x93fe('0x19')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x1a')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x1b')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x1c')));_0x8232f3=_['merge'](_0x8232f3,require(_0x93fe('0x1d')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x1e')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x1f')));_0x8232f3=_['merge'](_0x8232f3,require(_0x93fe('0x20')));_0x8232f3=_['merge'](_0x8232f3,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x21')));_0x8232f3=_['merge'](_0x8232f3,require('../api/interval/interval.rpc'));_0x8232f3=_['merge'](_0x8232f3,require(_0x93fe('0x22')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x23')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x8232f3=_['merge'](_0x8232f3,require('../api/template/template.rpc'));_0x8232f3=_['merge'](_0x8232f3,require(_0x93fe('0x24')));_0x8232f3=_['merge'](_0x8232f3,require(_0x93fe('0x25')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x26')));_0x8232f3=_['merge'](_0x8232f3,require(_0x93fe('0x27')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x28')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x29')));_0x8232f3=_['merge'](_0x8232f3,require(_0x93fe('0x2a')));_0x8232f3=_['merge'](_0x8232f3,require(_0x93fe('0x2b')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x8232f3=_['merge'](_0x8232f3,require(_0x93fe('0x2c')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x2d')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x2e')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x2f')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require('../api/squareReport/squareReport.rpc'));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x30')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x31')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x32')));_0x8232f3=_['merge'](_0x8232f3,require(_0x93fe('0x33')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x34')));_0x8232f3=_['merge'](_0x8232f3,require('../api/squareMessage/squareMessage.rpc'));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x35')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x36')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x37')));_0x8232f3=_['merge'](_0x8232f3,require(_0x93fe('0x38')));_0x8232f3=_['merge'](_0x8232f3,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x39')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x3a')));_0x8232f3=_[_0x93fe('0x2')](_0x8232f3,require(_0x93fe('0x3b')));var _0x15db50=jayson['server'](_0x8232f3)[_0x93fe('0x3c')]();var _0x18c3d3=config['rpc'][_0x93fe('0x3d')]||config[_0x93fe('0x3d')]+0x1;var _0x2ea197=config[_0x93fe('0x3e')]['ip']||_0x93fe('0x3f');_0x15db50['on']('error',function(_0x5f9d0a){return _0x607ebc(_0x5f9d0a);});_0x15db50[_0x93fe('0x40')](_0x18c3d3,_0x2ea197,function(){console[_0x93fe('0x41')](_0x93fe('0x42'),_0x2ea197,_0x18c3d3);require(_0x93fe('0x43'))[_0x93fe('0x44')]();return _0x363bc1(_0x93fe('0x45')+_0x2ea197+':'+_0x18c3d3);});});}; \ No newline at end of file +var _0x3c3e=['../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc'];(function(_0x3399de,_0x2aea1e){var _0x21b135=function(_0x3237c2){while(--_0x3237c2){_0x3399de['push'](_0x3399de['shift']());}};_0x21b135(++_0x2aea1e);}(_0x3c3e,0x86));var _0xe3c3=function(_0x2c0e6e,_0x2d2edf){_0x2c0e6e=_0x2c0e6e-0x0;var _0x3362c6=_0x3c3e[_0x2c0e6e];return _0x3362c6;};'use strict';var jayson=require(_0xe3c3('0x0'));var _=require(_0xe3c3('0x1'));var config=require(_0xe3c3('0x2'));exports['listen']=function(){return new Promise(function(_0x12a9ba,_0x516f92){var _0x2a3a29={};_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x4')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x5')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x6')));_0x2a3a29=_['merge'](_0x2a3a29,require(_0xe3c3('0x7')));_0x2a3a29=_['merge'](_0x2a3a29,require(_0xe3c3('0x8')));_0x2a3a29=_['merge'](_0x2a3a29,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x9')));_0x2a3a29=_['merge'](_0x2a3a29,require(_0xe3c3('0xa')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0xb')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0xc')));_0x2a3a29=_['merge'](_0x2a3a29,require(_0xe3c3('0xd')));_0x2a3a29=_['merge'](_0x2a3a29,require(_0xe3c3('0xe')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0xf')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require('../api/mailQueue/mailQueue.rpc'));_0x2a3a29=_['merge'](_0x2a3a29,require(_0xe3c3('0x10')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x11')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x12')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x13')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require('../api/faxAccount/faxAccount.rpc'));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x14')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x15')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x16')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x17')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x18')));_0x2a3a29=_['merge'](_0x2a3a29,require(_0xe3c3('0x19')));_0x2a3a29=_['merge'](_0x2a3a29,require(_0xe3c3('0x1a')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require('../api/smsMessage/smsMessage.rpc'));_0x2a3a29=_['merge'](_0x2a3a29,require(_0xe3c3('0x1b')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x1c')));_0x2a3a29=_['merge'](_0x2a3a29,require(_0xe3c3('0x1d')));_0x2a3a29=_['merge'](_0x2a3a29,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x1e')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x1f')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x20')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x21')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x22')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x23')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x24')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x25')));_0x2a3a29=_['merge'](_0x2a3a29,require(_0xe3c3('0x26')));_0x2a3a29=_['merge'](_0x2a3a29,require(_0xe3c3('0x27')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x28')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x29')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x2a')));_0x2a3a29=_['merge'](_0x2a3a29,require(_0xe3c3('0x2b')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x2c')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x2d')));_0x2a3a29=_['merge'](_0x2a3a29,require(_0xe3c3('0x2e')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require('../api/variable/variable.rpc'));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x2f')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x30')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x31')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x32')));_0x2a3a29=_['merge'](_0x2a3a29,require(_0xe3c3('0x33')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x34')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x35')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x36')));_0x2a3a29=_['merge'](_0x2a3a29,require(_0xe3c3('0x37')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require('../api/squareReport/squareReport.rpc'));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x38')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require('../api/setting/setting.rpc'));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require('../api/squareOdbc/squareOdbc.rpc'));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x39')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require('../api/squareRecording/squareRecording.rpc'));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x3a')));_0x2a3a29=_['merge'](_0x2a3a29,require(_0xe3c3('0x3b')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x3c')));_0x2a3a29=_['merge'](_0x2a3a29,require(_0xe3c3('0x3d')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x3e')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require(_0xe3c3('0x3f')));_0x2a3a29=_[_0xe3c3('0x3')](_0x2a3a29,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x2a3a29=_['merge'](_0x2a3a29,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x2a3a29=_['merge'](_0x2a3a29,require(_0xe3c3('0x40')));var _0x22232a=jayson[_0xe3c3('0x41')](_0x2a3a29)['http']();var _0xd7ef4b=config[_0xe3c3('0x42')][_0xe3c3('0x43')]||config[_0xe3c3('0x43')]+0x1;var _0x35454e=config[_0xe3c3('0x42')]['ip']||_0xe3c3('0x44');_0x22232a['on'](_0xe3c3('0x45'),function(_0x2895a3){return _0x516f92(_0x2895a3);});_0x22232a[_0xe3c3('0x46')](_0xd7ef4b,_0x35454e,function(){console[_0xe3c3('0x47')](_0xe3c3('0x48'),_0x35454e,_0xd7ef4b);require(_0xe3c3('0x49'))[_0xe3c3('0x4a')]();return _0x12a9ba(_0xe3c3('0x4b')+_0x35454e+':'+_0xd7ef4b);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 225f3e1..c5a3e1f 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 _0x5668=['recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','replace','indexOf','substr','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','function','inherits','prototype','sync','answer','sendRequest','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable'];(function(_0x11720a,_0x54d15f){var _0x2b970c=function(_0x48cdc4){while(--_0x48cdc4){_0x11720a['push'](_0x11720a['shift']());}};_0x2b970c(++_0x54d15f);}(_0x5668,0xff));var _0x8566=function(_0x546624,_0x36946f){_0x546624=_0x546624-0x0;var _0x2db887=_0x5668[_0x546624];return _0x2db887;};'use strict';var util=require(_0x8566('0x0'));var _=require(_0x8566('0x1'));var EventEmitter=require(_0x8566('0x2'))[_0x8566('0x3')];var AGIReply=require(_0x8566('0x4'));var AGIError=require(_0x8566('0x5'));function AGIChannel(_0x5b1846){var _0x5e1f4e=this,_0x18b563=new AGIReply(),_0x392d41=![],_0xb8f886={};EventEmitter[_0x8566('0x6')](_0x5e1f4e);_0x5b1846[_0x8566('0x7')](_0x8566('0x8'));_0x5b1846[_0x8566('0x9')](0x8*0x3c*0x3c*0x3e8);_0x18b563[_0x8566('0x7')](_0x8566('0x8'));_0x18b563['on'](_0x8566('0xa'),function(_0x378e5a){for(var _0x541460 in _0x378e5a){_0x5e1f4e[_0x541460]=_0x378e5a[_0x541460];}_0x5e1f4e[_0x8566('0xb')](_0x8566('0xc'));});_0x18b563['on'](_0x8566('0xd'),function(_0x3a29bf){if(_0x3a29bf[_0x8566('0xe')]()==_0x8566('0xf')){_0x5e1f4e[_0x8566('0xb')](_0x8566('0xf'));return;}if(_0x3a29bf[_0x8566('0x10')](0x0,0xb)==_0x8566('0x11')){_0x392d41=!![];}if(_0x392d41){_0xb8f886['rx']+=_0x3a29bf+'\x0a';if(_0x3a29bf[_0x8566('0x12')](_0x8566('0x13'))!=-0x1){_0x392d41=![];}}else{_0xb8f886['rx']=_0x3a29bf;}if(_0x392d41){return;}if(typeof _0xb8f886['cb']=='function'){var _0x30b4e8=_0xb8f886['rx'][_0x8566('0x10')](0x0,0x3),_0x584f1a=null,_0xeaaf1d=null;_0x30b4e8=parseInt(_0x30b4e8);if(isNaN(_0x30b4e8)){_0xb8f886['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x30b4e8!=0xc8){_0xb8f886['cb'](null,{'code':_0x30b4e8,'result':-0x1,'extra':'KO'});return;}_0x584f1a=_0xb8f886['rx'][_0x8566('0x10')](0x4)[_0x8566('0x14')]('result=','');if(_0x584f1a[_0x8566('0x15')]('\x20')!=-0x1){_0x584f1a=_0x584f1a[_0x8566('0x16')](0x0,_0x584f1a['indexOf']('\x20'));}if(_['startsWith'](_0x584f1a,'-1')){_0x584f1a=parseInt(_0x584f1a);}_0xeaaf1d=_0xb8f886['rx'][_0x8566('0x17')]('\x20');if(_0xeaaf1d['length']==0x3){_0xeaaf1d=_0xeaaf1d[0x2][_0x8566('0x10')](0x1,_0xeaaf1d[0x2]['length']-0x1);}else if(_0xeaaf1d[_0x8566('0x18')]>0x3){var _0x492908=/\((.+)\)/;var _0xce3f62=_0xb8f886['rx']['match'](_0x492908);if(_0xce3f62){_0xeaaf1d=_0xce3f62[0x1];}else{_0xeaaf1d=null;}}else{_0xeaaf1d=null;}_0xb8f886['cb'](null,{'code':_0x30b4e8,'result':_0x584f1a,'extra':_0xeaaf1d});}});_0x5b1846['on'](_0x8566('0x19'),function(_0x297c06){_0x5e1f4e[_0x8566('0xb')]('error',new AGIError(_0x8566('0x1a'),_0x297c06[_0x8566('0x1b')]));});_0x5b1846['on'](_0x8566('0x1c'),function(){_0x5e1f4e[_0x8566('0xb')](_0x8566('0x1c'),new AGIError(_0x8566('0x1d')));});_0x5b1846['on']('timeout',function(){_0x5e1f4e['emit'](_0x8566('0x1e'),new AGIError(_0x8566('0x1f')));_0x5b1846[_0x8566('0x20')]();});_0x5b1846['pipe'](_0x18b563);this[_0x8566('0x21')]=function(_0x57ba4f,_0x2276ea){var _0x57ba4f=_0x57ba4f||'',_0x2276ea=typeof _0x2276ea==_0x8566('0x22')?_0x2276ea:new Function();_0xb8f886={'tx':_0x57ba4f,'rx':'','cb':_0x2276ea};_0x5b1846['write'](_0x57ba4f+'\x0a');},this[_0x8566('0x1c')]=function(){_0x5b1846[_0x8566('0x20')]();};}util[_0x8566('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x8566('0x24')]['sendRequest']=function(_0x5c5138){return this['command'][_0x8566('0x25')](this,_0x5c5138);};AGIChannel['prototype'][_0x8566('0x26')]=function(){return this[_0x8566('0x27')](_0x8566('0x28'));};AGIChannel[_0x8566('0x24')][_0x8566('0x29')]=function(_0x67b51f,_0x338fd9,_0x5ce98d){_0x67b51f=_0x67b51f===undefined?'beep':_0x67b51f;_0x338fd9=_0x338fd9===undefined?'5':_0x338fd9;_0x5ce98d=_0x5ce98d===undefined?'1':_0x5ce98d;return this[_0x8566('0x27')](util[_0x8566('0x2a')](_0x8566('0x2b'),_0x67b51f,_0x338fd9*0x3e8,_0x5ce98d));};AGIChannel[_0x8566('0x24')][_0x8566('0x2c')]=function(_0x2f941b){_0x2f941b=_0x2f941b||_0x8566('0x2d');return this[_0x8566('0x27')](util[_0x8566('0x2a')](_0x8566('0x2e'),_0x2f941b));};AGIChannel[_0x8566('0x24')][_0x8566('0x2f')]=function(_0x1d38ab,_0x541b0d){if(_[_0x8566('0x30')](_0x541b0d)){return this[_0x8566('0x27')](util[_0x8566('0x2a')](_0x8566('0x31'),_0x1d38ab,_0x541b0d[_0x8566('0x32')](',')));}return this[_0x8566('0x27')](util[_0x8566('0x2a')](_0x8566('0x31'),_0x1d38ab,_0x541b0d));};AGIChannel[_0x8566('0x24')][_0x8566('0x33')]=function(_0x353cfe){return this[_0x8566('0x27')](util['format'](_0x8566('0x34'),_0x353cfe));};AGIChannel[_0x8566('0x24')][_0x8566('0x35')]=function(_0x2d38ca){return this[_0x8566('0x27')](util[_0x8566('0x2a')]('SET\x20EXTENSION\x20%s',_0x2d38ca));};AGIChannel['prototype'][_0x8566('0x36')]=function(_0x5d2875){return this[_0x8566('0x27')](util[_0x8566('0x2a')](_0x8566('0x37'),_0x5d2875));};AGIChannel[_0x8566('0x24')]['hangup']=function(){return this[_0x8566('0x27')](_0x8566('0x38'));};AGIChannel['prototype'][_0x8566('0x39')]=function(_0x20634e,_0x531854){var _0x21f1fd=_['isBoolean'](_0x531854)||_[_0x8566('0x3a')](_0x531854)?_0x531854[_0x8566('0x3b')]():_0x531854;return this['sendRequest'](util['format'](_0x8566('0x3c'),_0x20634e,_0x21f1fd?_0x21f1fd[_0x8566('0x3b')]()[_0x8566('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x8566('0x24')]['sayNumber']=function(_0x2e19b1,_0x239af3){return this[_0x8566('0x27')](util['format'](_0x8566('0x3d'),_0x2e19b1,_0x239af3));};AGIChannel[_0x8566('0x24')]['sayDigits']=function(_0x46f669,_0x5d520a){return this[_0x8566('0x27')](util[_0x8566('0x2a')](_0x8566('0x3e'),_0x46f669,_0x5d520a));};AGIChannel[_0x8566('0x24')][_0x8566('0x3f')]=function(_0x3eef46,_0x274c71){return this[_0x8566('0x27')](util['format'](_0x8566('0x40'),_0x3eef46,_0x274c71));};AGIChannel[_0x8566('0x24')][_0x8566('0x41')]=function(_0x37a6ad,_0x165cec,_0x24a430){_0x165cec=_0x165cec||this[_0x8566('0x42')];_0x24a430=_0x24a430||0x1;this[_0x8566('0x33')](_0x37a6ad);this[_0x8566('0x35')](_0x165cec);this[_0x8566('0x36')](_0x24a430);return this[_0x8566('0x2c')](util[_0x8566('0x2a')](_0x8566('0x43'),_0x37a6ad,_0x165cec,_0x24a430));};AGIChannel[_0x8566('0x24')][_0x8566('0x44')]=function(_0x30b229){return this[_0x8566('0x27')](util['format']('GET\x20VARIABLE\x20\x22%s\x22',_0x30b229));};AGIChannel[_0x8566('0x24')][_0x8566('0x45')]=function(_0x2a6278,_0x5e660c,_0x3bf47f,_0x520fd8,_0x4b3888,_0x8ae429){_0x5e660c=_0x5e660c||_0x8566('0x46');_0x3bf47f=_0x3bf47f||'';_0x520fd8=_0x520fd8===undefined?-0x1:_0x520fd8==='-1'?-0x1:_0x520fd8*0x3e8;_0x4b3888=_0x4b3888===undefined?'':'s='+_0x4b3888;_0x8ae429=_0x8ae429?_0x8566('0x47'):'';return this[_0x8566('0x27')](util[_0x8566('0x2a')](_0x8566('0x48'),_0x2a6278,_0x5e660c,_0x3bf47f,_0x520fd8,_0x8ae429,_0x4b3888));};AGIChannel[_0x8566('0x24')][_0x8566('0x49')]=function(_0xbac110,_0x58cc37){_0x58cc37=_0x58cc37||'';return this[_0x8566('0x27')](util[_0x8566('0x2a')](_0x8566('0x4a'),_0xbac110,_0x58cc37));};AGIChannel[_0x8566('0x24')][_0x8566('0x4b')]=function(_0x211b9f){return this[_0x8566('0x2f')]('AGI',_0x211b9f);};AGIChannel[_0x8566('0x24')][_0x8566('0x4c')]=function(_0x25eaef){return this[_0x8566('0x2f')](_0x8566('0x4d'),_0x25eaef);};AGIChannel[_0x8566('0x24')][_0x8566('0x19')]=function(_0x1fa9d1,_0x74e22e){this[_0x8566('0x2c')](util['format'](_0x8566('0x4e'),_0x1fa9d1['id'],_0x1fa9d1[_0x8566('0x4f')],_0x74e22e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x8566('0x50')]=AGIChannel; \ No newline at end of file +var _0x8683=['RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','exports','lodash','events','EventEmitter','./error','setEncoding','utf8','setTimeout','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','sync','ANSWER','prototype','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','sendRequest','VERBOSE\x20\x22%s\x22','exec','isArray','format','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','getVariable','recordFile'];(function(_0xdca881,_0x42d78c){var _0x1708e5=function(_0x3fd127){while(--_0x3fd127){_0xdca881['push'](_0xdca881['shift']());}};_0x1708e5(++_0x42d78c);}(_0x8683,0xec));var _0x3868=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x8683[_0x297fd3];return _0x2af381;};'use strict';var util=require('util');var _=require(_0x3868('0x0'));var EventEmitter=require(_0x3868('0x1'))[_0x3868('0x2')];var AGIReply=require('./reply');var AGIError=require(_0x3868('0x3'));function AGIChannel(_0x2ce894){var _0x59424e=this,_0x2da7e5=new AGIReply(),_0xec26c4=![],_0x2be7fe={};EventEmitter['call'](_0x59424e);_0x2ce894[_0x3868('0x4')](_0x3868('0x5'));_0x2ce894[_0x3868('0x6')](0x8*0x3c*0x3c*0x3e8);_0x2da7e5['setEncoding']('utf8');_0x2da7e5['on']('headers',function(_0x451d23){for(var _0x54774c in _0x451d23){_0x59424e[_0x54774c]=_0x451d23[_0x54774c];}_0x59424e[_0x3868('0x7')](_0x3868('0x8'));});_0x2da7e5['on'](_0x3868('0x9'),function(_0x1d4fb6){if(_0x1d4fb6[_0x3868('0xa')]()==_0x3868('0xb')){_0x59424e['emit'](_0x3868('0xb'));return;}if(_0x1d4fb6[_0x3868('0xc')](0x0,0xb)==_0x3868('0xd')){_0xec26c4=!![];}if(_0xec26c4){_0x2be7fe['rx']+=_0x1d4fb6+'\x0a';if(_0x1d4fb6['search'](_0x3868('0xe'))!=-0x1){_0xec26c4=![];}}else{_0x2be7fe['rx']=_0x1d4fb6;}if(_0xec26c4){return;}if(typeof _0x2be7fe['cb']==_0x3868('0xf')){var _0x2f018f=_0x2be7fe['rx'][_0x3868('0xc')](0x0,0x3),_0x5b9ec0=null,_0x17929f=null;_0x2f018f=parseInt(_0x2f018f);if(isNaN(_0x2f018f)){_0x2be7fe['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x3868('0x10')});return;}if(_0x2f018f!=0xc8){_0x2be7fe['cb'](null,{'code':_0x2f018f,'result':-0x1,'extra':'KO'});return;}_0x5b9ec0=_0x2be7fe['rx'][_0x3868('0xc')](0x4)[_0x3868('0x11')](_0x3868('0x12'),'');if(_0x5b9ec0[_0x3868('0x13')]('\x20')!=-0x1){_0x5b9ec0=_0x5b9ec0['substr'](0x0,_0x5b9ec0[_0x3868('0x13')]('\x20'));}if(_[_0x3868('0x14')](_0x5b9ec0,'-1')){_0x5b9ec0=parseInt(_0x5b9ec0);}_0x17929f=_0x2be7fe['rx'][_0x3868('0x15')]('\x20');if(_0x17929f['length']==0x3){_0x17929f=_0x17929f[0x2]['substring'](0x1,_0x17929f[0x2][_0x3868('0x16')]-0x1);}else if(_0x17929f[_0x3868('0x16')]>0x3){var _0xf1e117=/\((.+)\)/;var _0x44f2df=_0x2be7fe['rx']['match'](_0xf1e117);if(_0x44f2df){_0x17929f=_0x44f2df[0x1];}else{_0x17929f=null;}}else{_0x17929f=null;}_0x2be7fe['cb'](null,{'code':_0x2f018f,'result':_0x5b9ec0,'extra':_0x17929f});}});_0x2ce894['on'](_0x3868('0x17'),function(_0xdc5cde){_0x59424e['emit'](_0x3868('0x17'),new AGIError(_0x3868('0x18'),_0xdc5cde[_0x3868('0x19')]));});_0x2ce894['on'](_0x3868('0x1a'),function(){_0x59424e['emit'](_0x3868('0x1a'),new AGIError(_0x3868('0x1b')));});_0x2ce894['on']('timeout',function(){_0x59424e[_0x3868('0x7')](_0x3868('0x1c'),new AGIError(_0x3868('0x1d')));_0x2ce894[_0x3868('0x1e')]();});_0x2ce894[_0x3868('0x1f')](_0x2da7e5);this[_0x3868('0x20')]=function(_0x4a9860,_0x2e629b){var _0x4a9860=_0x4a9860||'',_0x2e629b=typeof _0x2e629b==_0x3868('0xf')?_0x2e629b:new Function();_0x2be7fe={'tx':_0x4a9860,'rx':'','cb':_0x2e629b};_0x2ce894[_0x3868('0x21')](_0x4a9860+'\x0a');},this[_0x3868('0x1a')]=function(){_0x2ce894[_0x3868('0x1e')]();};}util[_0x3868('0x22')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x1091d){return this[_0x3868('0x20')][_0x3868('0x23')](this,_0x1091d);};AGIChannel['prototype']['answer']=function(){return this['sendRequest'](_0x3868('0x24'));};AGIChannel[_0x3868('0x25')][_0x3868('0x26')]=function(_0x3bf16b,_0x1aad78,_0x512a71){_0x3bf16b=_0x3bf16b===undefined?_0x3868('0x27'):_0x3bf16b;_0x1aad78=_0x1aad78===undefined?'5':_0x1aad78;_0x512a71=_0x512a71===undefined?'1':_0x512a71;return this['sendRequest'](util['format'](_0x3868('0x28'),_0x3bf16b,_0x1aad78*0x3e8,_0x512a71));};AGIChannel[_0x3868('0x25')][_0x3868('0x29')]=function(_0x2750c4){_0x2750c4=_0x2750c4||_0x3868('0x2a');return this[_0x3868('0x2b')](util['format'](_0x3868('0x2c'),_0x2750c4));};AGIChannel[_0x3868('0x25')][_0x3868('0x2d')]=function(_0x510bd0,_0x17bb4e){if(_[_0x3868('0x2e')](_0x17bb4e)){return this[_0x3868('0x2b')](util[_0x3868('0x2f')](_0x3868('0x30'),_0x510bd0,_0x17bb4e[_0x3868('0x31')](',')));}return this[_0x3868('0x2b')](util[_0x3868('0x2f')]('EXEC\x20%s\x20%s',_0x510bd0,_0x17bb4e));};AGIChannel[_0x3868('0x25')][_0x3868('0x32')]=function(_0x18fa95){return this[_0x3868('0x2b')](util[_0x3868('0x2f')](_0x3868('0x33'),_0x18fa95));};AGIChannel[_0x3868('0x25')]['setExtension']=function(_0x293c8e){return this[_0x3868('0x2b')](util[_0x3868('0x2f')](_0x3868('0x34'),_0x293c8e));};AGIChannel[_0x3868('0x25')][_0x3868('0x35')]=function(_0x5ce9ef){return this[_0x3868('0x2b')](util[_0x3868('0x2f')]('SET\x20PRIORITY\x20%s',_0x5ce9ef));};AGIChannel['prototype'][_0x3868('0xb')]=function(){return this[_0x3868('0x2b')](_0x3868('0x36'));};AGIChannel[_0x3868('0x25')][_0x3868('0x37')]=function(_0x382235,_0x5c49e0){var _0x1fbf3b=_[_0x3868('0x38')](_0x5c49e0)||_[_0x3868('0x39')](_0x5c49e0)?_0x5c49e0['toString']():_0x5c49e0;return this['sendRequest'](util[_0x3868('0x2f')](_0x3868('0x3a'),_0x382235,_0x1fbf3b?_0x1fbf3b['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x3868('0x3b')]=function(_0x20beee,_0x17d389){return this[_0x3868('0x2b')](util[_0x3868('0x2f')](_0x3868('0x3c'),_0x20beee,_0x17d389));};AGIChannel[_0x3868('0x25')]['sayDigits']=function(_0x143c9e,_0x171a2d){return this[_0x3868('0x2b')](util[_0x3868('0x2f')](_0x3868('0x3d'),_0x143c9e,_0x171a2d));};AGIChannel['prototype']['sayPhonetic']=function(_0x5e8b0a,_0x36d58e){return this['sendRequest'](util[_0x3868('0x2f')](_0x3868('0x3e'),_0x5e8b0a,_0x36d58e));};AGIChannel[_0x3868('0x25')][_0x3868('0x3f')]=function(_0x4ecfa9,_0x47c338,_0x1255a6){_0x47c338=_0x47c338||this[_0x3868('0x40')];_0x1255a6=_0x1255a6||0x1;this[_0x3868('0x32')](_0x4ecfa9);this[_0x3868('0x41')](_0x47c338);this['setPriority'](_0x1255a6);return this[_0x3868('0x29')](util['format']('GOTO\x20%s\x20%s\x20%s',_0x4ecfa9,_0x47c338,_0x1255a6));};AGIChannel[_0x3868('0x25')][_0x3868('0x42')]=function(_0x40e1e0){return this[_0x3868('0x2b')](util[_0x3868('0x2f')]('GET\x20VARIABLE\x20\x22%s\x22',_0x40e1e0));};AGIChannel[_0x3868('0x25')][_0x3868('0x43')]=function(_0x11b01d,_0x135868,_0x228fa7,_0x24cc8a,_0x77abea,_0x14a1f8){_0x135868=_0x135868||'wav';_0x228fa7=_0x228fa7||'';_0x24cc8a=_0x24cc8a===undefined?-0x1:_0x24cc8a==='-1'?-0x1:_0x24cc8a*0x3e8;_0x77abea=_0x77abea===undefined?'':'s='+_0x77abea;_0x14a1f8=_0x14a1f8?'BEEP':'';return this[_0x3868('0x2b')](util['format'](_0x3868('0x44'),_0x11b01d,_0x135868,_0x228fa7,_0x24cc8a,_0x14a1f8,_0x77abea));};AGIChannel[_0x3868('0x25')][_0x3868('0x45')]=function(_0x25fbc8,_0x1710c4){_0x1710c4=_0x1710c4||'';return this['sendRequest'](util[_0x3868('0x2f')](_0x3868('0x46'),_0x25fbc8,_0x1710c4));};AGIChannel[_0x3868('0x25')][_0x3868('0x47')]=function(_0x446e8b){return this['exec'](_0x3868('0x48'),_0x446e8b);};AGIChannel[_0x3868('0x25')][_0x3868('0x49')]=function(_0x85b63a){return this['exec'](_0x3868('0x4a'),_0x85b63a);};AGIChannel[_0x3868('0x25')][_0x3868('0x17')]=function(_0x4b281f,_0x55f2e5){this['noop'](util[_0x3868('0x2f')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x4b281f['id'],_0x4b281f['label'],_0x55f2e5));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3868('0x4b')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 6c9dd20..444bdf1 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 _0xf3cb=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','message','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x27d74c,_0x239124){var _0x8be7dc=function(_0xa4ca2d){while(--_0xa4ca2d){_0x27d74c['push'](_0x27d74c['shift']());}};_0x8be7dc(++_0x239124);}(_0xf3cb,0x16d));var _0xbf3c=function(_0x4e5a81,_0x4db090){_0x4e5a81=_0x4e5a81-0x0;var _0x5884bc=_0xf3cb[_0x4e5a81];return _0x5884bc;};'use strict';var util=require(_0xbf3c('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xbf3c('0x1'),'E_AGI_SERVER_ERROR':_0xbf3c('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xbf3c('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xbf3c('0x4'),'E_AGI_SOCKET_ERROR':_0xbf3c('0x5'),'E_AGI_SOCKET_CLOSE':_0xbf3c('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xbf3c('0x7'),'E_AGI_COMMAND_EMPTY':_0xbf3c('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xbf3c('0x9'),'E_AGI_IVR_ENTRY':_0xbf3c('0xa')};function AGIError(_0x4b9f31){var _0x4b9f31=_0x4b9f31||null,_0x2ea74b=_0x2ea74b||[],_0x5ac368=0x1,_0x394e0e='';if(!error[_0x4b9f31]){_0x4b9f31=_0xbf3c('0xb');}_0x2ea74b[_0xbf3c('0xc')](error[_0x4b9f31]);while(arguments[_0x5ac368]){_0x2ea74b[_0xbf3c('0xc')](arguments[_0x5ac368]);_0x5ac368++;}_0x394e0e=util['format']['apply'](util,_0x2ea74b);this[_0xbf3c('0xd')]=_0x394e0e;this[_0xbf3c('0xe')]=_0x4b9f31;}module[_0xbf3c('0xf')]=AGIError; \ No newline at end of file +var _0x9345=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x9345,0x115));var _0x5934=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0x9345[_0x30bd4d];return _0x306915;};'use strict';var util=require(_0x5934('0x0'));var error={'E_AGI_UNDEFINED':_0x5934('0x1'),'E_AGI_ARGUMENT_PORT':_0x5934('0x2'),'E_AGI_SERVER_ERROR':_0x5934('0x3'),'E_AGI_SERVER_CLOSE':_0x5934('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x5934('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x5934('0x6'),'E_AGI_SOCKET_ERROR':_0x5934('0x7'),'E_AGI_SOCKET_CLOSE':_0x5934('0x8'),'E_AGI_SOCKET_TIMEOUT':_0x5934('0x9'),'E_AGI_COMMAND_EMPTY':_0x5934('0xa'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x5934('0xb')};function AGIError(_0x475774){var _0x475774=_0x475774||null,_0x177a37=_0x177a37||[],_0x252c77=0x1,_0x31b072='';if(!error[_0x475774]){_0x475774=_0x5934('0xc');}_0x177a37[_0x5934('0xd')](error[_0x475774]);while(arguments[_0x252c77]){_0x177a37[_0x5934('0xd')](arguments[_0x252c77]);_0x252c77++;}_0x31b072=util[_0x5934('0xe')][_0x5934('0xf')](util,_0x177a37);this[_0x5934('0x10')]=_0x31b072;this['name']=_0x475774;}module[_0x5934('0x11')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index e4074fb..7d58733 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x470c=['ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe','emit','agi','projectUpdate','error','E_AGI_SERVER_ERROR','exports','events','EventEmitter'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x470c,0x1b1));var _0xc470=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x470c[_0x1b5aea];return _0x15cfc6;};'use strict';var _=require('lodash');var EventEmitter=require(_0xc470('0x0'))[_0xc470('0x1')];var Redis=require(_0xc470('0x2'));var AGIError=require(_0xc470('0x3'));var config=require(_0xc470('0x4'));config[_0xc470('0x5')]=_[_0xc470('0x6')](config['redis'],{'host':_0xc470('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0xc470('0x8')]('agi',function(_0x387f75){if(_0x387f75)return eventEmitter[_0xc470('0x9')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x387f75));});sub['on']('message',function(_0xf699d8,_0x2e2750){if(_0xf699d8!==_0xc470('0xa'))return;try{var _0x1757ba=JSON['parse'](_0x2e2750);eventEmitter[_0xc470('0x9')](_0xc470('0xb'),_0x1757ba);}catch(_0x588a7c){eventEmitter[_0xc470('0x9')](_0xc470('0xc'),new AGIError(_0xc470('0xd'),_0x588a7c));}});module[_0xc470('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xdb78=['E_AGI_SERVER_ERROR','parse','projectUpdate','emit','lodash','ioredis','../../config/environment','redis','defaults','localhost','agi','error'];(function(_0x49e210,_0x3b241f){var _0xd863cf=function(_0x15f983){while(--_0x15f983){_0x49e210['push'](_0x49e210['shift']());}};_0xd863cf(++_0x3b241f);}(_0xdb78,0x1a8));var _0x8db7=function(_0x5cefab,_0x194395){_0x5cefab=_0x5cefab-0x0;var _0x28608d=_0xdb78[_0x5cefab];return _0x28608d;};'use strict';var _=require(_0x8db7('0x0'));var EventEmitter=require('events')['EventEmitter'];var Redis=require(_0x8db7('0x1'));var AGIError=require('./error');var config=require(_0x8db7('0x2'));config[_0x8db7('0x3')]=_[_0x8db7('0x4')](config['redis'],{'host':_0x8db7('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x8db7('0x3')]);sub['subscribe'](_0x8db7('0x6'),function(_0x1e3933){if(_0x1e3933)return eventEmitter['emit'](_0x8db7('0x7'),new AGIError(_0x8db7('0x8'),_0x1e3933));});sub['on']('message',function(_0x4f13bb,_0x47d117){if(_0x4f13bb!==_0x8db7('0x6'))return;try{var _0xee8b67=JSON[_0x8db7('0x9')](_0x47d117);eventEmitter['emit'](_0x8db7('0xa'),_0xee8b67);}catch(_0x437d99){eventEmitter[_0x8db7('0xb')](_0x8db7('0x7'),new AGIError('E_AGI_SERVER_ERROR',_0x437d99));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 2d9ebc4..5063214 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 _0xc224=['getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex','addEdge','push','size','relations','info','no\x20vertex\x20found','stop\x20traverse','length','condition','agicommand','vswitch','target','default','menu','invalid','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi'];(function(_0x5052df,_0x5f232e){var _0x51fd2f=function(_0x488f1a){while(--_0x488f1a){_0x5052df['push'](_0x5052df['shift']());}};_0x51fd2f(++_0x5f232e);}(_0xc224,0x1af));var _0x4c22=function(_0x16a882,_0x39b911){_0x16a882=_0x16a882-0x0;var _0x282761=_0xc224[_0x16a882];return _0x282761;};'use strict';var _=require(_0x4c22('0x0'));var logger=require(_0x4c22('0x1'))(_0x4c22('0x2'));var verticesWithRetry=['menu',_0x4c22('0x3'),_0x4c22('0x4')];var Graph=function(){this[_0x4c22('0x5')]={};this[_0x4c22('0x6')]={};this[_0x4c22('0x7')]=0x0;};Graph[_0x4c22('0x8')][_0x4c22('0x9')]=function(_0xcfd79b){this['vertices'][_0xcfd79b['id']]=_0xcfd79b;this['edges'][_0xcfd79b['id']]=[];};Graph['prototype'][_0x4c22('0xa')]=function(_0x3a6191,_0x45397c,_0x309dad){this[_0x4c22('0x6')][_0x3a6191][_0x4c22('0xb')]({'target':_0x45397c,'condition':_0x309dad});this[_0x4c22('0x7')]+=0x1;};Graph['prototype'][_0x4c22('0xc')]=function(){return _[_0x4c22('0xc')](this['vertices']);};Graph['prototype'][_0x4c22('0xd')]=function(){return this[_0x4c22('0x7')];};Graph[_0x4c22('0x8')]['getVertex']=function(_0x3ac69a){return this['vertices'][_0x3ac69a];};Graph['prototype']['traverseBFS']=function(_0x535c47,_0xe8a6e3){if(!this[_0x4c22('0x5')][_0x535c47]){return logger[_0x4c22('0xe')](_0x4c22('0xf'));}var _0x480d97=_0xe8a6e3(this[_0x4c22('0x5')][_0x535c47]);if(!_0x480d97){return logger[_0x4c22('0xe')](_0x4c22('0x10'));}if(this[_0x4c22('0x6')][_0x535c47][_0x4c22('0x11')]===0x0){return logger['info']('no\x20edge/s\x20available');}for(var _0xf562f8=0x0,_0x3617b2=[],_0x46aaaa=![];_0xf562f8\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','callerid','evtHangup','createSquareReport','then','hasOwnProperty','agi_','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','find','handleNotFound','production','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','catch','[LICENSE]','finally','./server','connection','lodash','syncho','util','agi','../../config/license/util','./rpc','./events','EventEmitter','defaults','projectUpdate','nextTick','error','stack','findIndex','deleted','splice','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info'];(function(_0x5cc949,_0x9de31c){var _0x67afa9=function(_0x1c32e9){while(--_0x1c32e9){_0x5cc949['push'](_0x5cc949['shift']());}};_0x67afa9(++_0x9de31c);}(_0x0af6,0x1d3));var _0x60af=function(_0x11e03f,_0x20b967){_0x11e03f=_0x11e03f-0x0;var _0x5666fe=_0x0af6[_0x11e03f];return _0x5666fe;};'use strict';var _=require(_0x60af('0x0'));var syncho=require(_0x60af('0x1'));var util=require(_0x60af('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x60af('0x3'));var utilLicense=require(_0x60af('0x4'));var rpc=require(_0x60af('0x5'));var Project=require('./project');var AGIEmitter=require(_0x60af('0x6'))[_0x60af('0x7')];var projects=[];config[_0x60af('0x3')]=_[_0x60af('0x8')](config[_0x60af('0x3')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x60af('0x9'),projectUpdateHandler);function connectionHandler(_0x51e404){process[_0x60af('0xa')](function(){syncho(function(){try{setChannelVariables(_0x51e404);agiHandler(_0x51e404);}catch(_0x14985b){logger[_0x60af('0xb')](_0x14985b[_0x60af('0xc')]);}});});}function projectUpdateHandler(_0x81248d){try{var _0xa205f8=_[_0x60af('0xd')](projects,['id',_0x81248d['id']]);if(_0xa205f8>-0x1){if(_0x81248d[_0x60af('0xe')]===!![]){projects[_0x60af('0xf')](_0xa205f8,0x1);}else{projects[_0xa205f8]=_0x81248d;}}else{projects['push'](_0x81248d);}}catch(_0x349a01){logger[_0x60af('0xb')](_0x349a01[_0x60af('0xc')]);}}function listeningHandler(){console['log'](_0x60af('0x10'),config[_0x60af('0x3')][_0x60af('0x11')]);logger[_0x60af('0x12')](util['format'](_0x60af('0x13'),config[_0x60af('0x3')]['ip'],config[_0x60af('0x3')]['port']));}function errorHandler(_0x211a25){if(_0x211a25&&_0x211a25[_0x60af('0x14')]&&_0x211a25[_0x60af('0x15')]){logger[_0x60af('0xb')](util['format'](_0x60af('0x16'),_0x211a25['name'],_0x211a25['message']));}else{logger[_0x60af('0xb')](util[_0x60af('0x17')](_0x60af('0x18'),_0x211a25[_0x60af('0xc')]));}}function closeHandler(){logger['info'](util[_0x60af('0x17')](_0x60af('0x19'),this[_0x60af('0x1a')],this[_0x60af('0x1b')],this['callerid'],this[_0x60af('0x1c')],this[_0x60af('0x1d')]));try{createSquareReport(this);}catch(_0xbecfb7){logger[_0x60af('0xb')](_0xbecfb7[_0x60af('0xc')]);}}function timeoutHandler(){logger[_0x60af('0x12')](util[_0x60af('0x17')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x60af('0x1b')],this[_0x60af('0x1e')],this[_0x60af('0x1c')],this[_0x60af('0x1d')]));}function hangupHandler(){logger['info'](util[_0x60af('0x17')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x60af('0x1a')],this[_0x60af('0x1b')],this[_0x60af('0x1e')],this['dnid'],this['uniqueid']));this[_0x60af('0x1f')]=!![];}function createSquareReport(_0x3ae00a,_0x23ef20){rpc[_0x60af('0x20')](_0x3ae00a)[_0x60af('0x21')](function(_0x3f04b2){if(_0x23ef20){_0x23ef20(null,_0x3f04b2);}})['catch'](function(_0x5ac814){if(_0x23ef20){_0x23ef20(null,_0x5ac814);}});}function setChannelVariables(_0x52f31e){for(var _0x1185d7 in _0x52f31e){if(_0x52f31e[_0x60af('0x22')](_0x1185d7)){if(_0x1185d7['indexOf'](_0x60af('0x23'))===0x0){_0x52f31e[_0x1185d7['substring'](0x4)]=_0x52f31e[_0x1185d7];delete _0x52f31e[_0x1185d7];}}}}function agiHandler(_0xe6dc74){logger['debug'](_0x60af('0x24'),JSON[_0x60af('0x25')](_0xe6dc74,null,0x2));logger[_0x60af('0x12')](util[_0x60af('0x17')](_0x60af('0x26'),_0xe6dc74[_0x60af('0x1a')],_0xe6dc74[_0x60af('0x1b')],_0xe6dc74[_0x60af('0x1e')],_0xe6dc74[_0x60af('0x1c')],_0xe6dc74['uniqueid']));_0xe6dc74['on']('error',errorHandler);_0xe6dc74['on']('close',closeHandler);_0xe6dc74['on']('timeout',timeoutHandler);_0xe6dc74[_0x60af('0x1f')]=![];_0xe6dc74['on']('hangup',hangupHandler);var _0x4cf24d=_[_0x60af('0x27')](projects,[_0x60af('0x14'),_0xe6dc74[_0x60af('0x1a')]]);if(!_0x4cf24d)return Project[_0x60af('0x28')](_0xe6dc74);if(!_0x4cf24d[_0x60af('0x29')])return Project['handleUnpublished'](_0xe6dc74);return Project[_0x60af('0x2a')](_0x4cf24d,_0xe6dc74);}function main(){var _0x373c8c;return utilLicense[_0x60af('0x2b')]()[_0x60af('0x21')](function(_0x20da7a){if(!_0x20da7a)return;if(_0x20da7a['voice']){if(_0x20da7a[_0x60af('0x2c')]&&_0x20da7a['callysquare']>0x0){logger[_0x60af('0x12')](util[_0x60af('0x17')](_0x60af('0x2d'),_0x20da7a[_0x60af('0x2c')]));_0x373c8c=_0x20da7a[_0x60af('0x2c')];}else{logger['info'](_0x60af('0x2e'));}}else{logger['info'](_0x60af('0x2f'));_0x373c8c=-0x1;}})['then'](function(){return Project[_0x60af('0x30')]();})[_0x60af('0x21')](function(_0x591ca7){projects=_0x591ca7;return;})[_0x60af('0x31')](function(_0x2f7724){logger[_0x60af('0xb')](_0x60af('0x32'),_0x2f7724['stack']);})[_0x60af('0x33')](function(){var _0x354f1e=require(_0x60af('0x34'))(config['agi']['port'],config[_0x60af('0x3')]['ip'],_0x373c8c);_0x354f1e['on'](_0x60af('0xb'),errorHandler);_0x354f1e['on']('listening',listeningHandler);_0x354f1e['on'](_0x60af('0x35'),connectionHandler);_0x354f1e['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x93f5=['syncho','util','../../config/environment','agi','./rpc','127.0.0.1','nextTick','error','findIndex','deleted','splice','stack','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','then','catch','hasOwnProperty','indexOf','agi_','substring','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','production','handleUnpublished','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','[LICENSE]','finally','./server','listening'];(function(_0x35ef0c,_0x1f5fad){var _0x1bfa69=function(_0x90e3c1){while(--_0x90e3c1){_0x35ef0c['push'](_0x35ef0c['shift']());}};_0x1bfa69(++_0x1f5fad);}(_0x93f5,0x157));var _0x593f=function(_0x4a32a7,_0x463dd1){_0x4a32a7=_0x4a32a7-0x0;var _0x1fbd39=_0x93f5[_0x4a32a7];return _0x1fbd39;};'use strict';var _=require('lodash');var syncho=require(_0x593f('0x0'));var util=require(_0x593f('0x1'));var config=require(_0x593f('0x2'));var logger=require('../../config/logger')(_0x593f('0x3'));var utilLicense=require('../../config/license/util');var rpc=require(_0x593f('0x4'));var Project=require('./project');var AGIEmitter=require('./events')['EventEmitter'];var projects=[];config[_0x593f('0x3')]=_['defaults'](config[_0x593f('0x3')],{'ip':_0x593f('0x5'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x72d483){process[_0x593f('0x6')](function(){syncho(function(){try{setChannelVariables(_0x72d483);agiHandler(_0x72d483);}catch(_0x354bd0){logger[_0x593f('0x7')](_0x354bd0['stack']);}});});}function projectUpdateHandler(_0x2c1821){try{var _0x2fc4fd=_[_0x593f('0x8')](projects,['id',_0x2c1821['id']]);if(_0x2fc4fd>-0x1){if(_0x2c1821[_0x593f('0x9')]===!![]){projects[_0x593f('0xa')](_0x2fc4fd,0x1);}else{projects[_0x2fc4fd]=_0x2c1821;}}else{projects['push'](_0x2c1821);}}catch(_0x57d0c9){logger[_0x593f('0x7')](_0x57d0c9[_0x593f('0xb')]);}}function listeningHandler(){console[_0x593f('0xc')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x593f('0x3')][_0x593f('0xd')]);logger[_0x593f('0xe')](util[_0x593f('0xf')](_0x593f('0x10'),config['agi']['ip'],config[_0x593f('0x3')]['port']));}function errorHandler(_0x2e6989){if(_0x2e6989&&_0x2e6989[_0x593f('0x11')]&&_0x2e6989[_0x593f('0x12')]){logger['error'](util[_0x593f('0xf')](_0x593f('0x13'),_0x2e6989['name'],_0x2e6989['message']));}else{logger[_0x593f('0x7')](util[_0x593f('0xf')](_0x593f('0x14'),_0x2e6989['stack']));}}function closeHandler(){logger[_0x593f('0xe')](util[_0x593f('0xf')](_0x593f('0x15'),this[_0x593f('0x16')],this[_0x593f('0x17')],this[_0x593f('0x18')],this[_0x593f('0x19')],this[_0x593f('0x1a')]));try{createSquareReport(this);}catch(_0x3bdc19){logger[_0x593f('0x7')](_0x3bdc19[_0x593f('0xb')]);}}function timeoutHandler(){logger[_0x593f('0xe')](util['format'](_0x593f('0x1b'),this['arg_1'],this[_0x593f('0x17')],this[_0x593f('0x18')],this[_0x593f('0x19')],this[_0x593f('0x1a')]));}function hangupHandler(){logger['info'](util[_0x593f('0xf')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x593f('0x16')],this['calleridname'],this['callerid'],this[_0x593f('0x19')],this[_0x593f('0x1a')]));this[_0x593f('0x1c')]=!![];}function createSquareReport(_0x40fec0,_0x13f9f5){rpc['createSquareReport'](_0x40fec0)[_0x593f('0x1d')](function(_0x3d0e35){if(_0x13f9f5){_0x13f9f5(null,_0x3d0e35);}})[_0x593f('0x1e')](function(_0x2231ed){if(_0x13f9f5){_0x13f9f5(null,_0x2231ed);}});}function setChannelVariables(_0x595e20){for(var _0x1510c2 in _0x595e20){if(_0x595e20[_0x593f('0x1f')](_0x1510c2)){if(_0x1510c2[_0x593f('0x20')](_0x593f('0x21'))===0x0){_0x595e20[_0x1510c2[_0x593f('0x22')](0x4)]=_0x595e20[_0x1510c2];delete _0x595e20[_0x1510c2];}}}}function agiHandler(_0x400975){logger['debug']('variables',JSON[_0x593f('0x23')](_0x400975,null,0x2));logger['info'](util[_0x593f('0xf')](_0x593f('0x24'),_0x400975[_0x593f('0x16')],_0x400975[_0x593f('0x17')],_0x400975[_0x593f('0x18')],_0x400975['dnid'],_0x400975[_0x593f('0x1a')]));_0x400975['on']('error',errorHandler);_0x400975['on'](_0x593f('0x25'),closeHandler);_0x400975['on'](_0x593f('0x26'),timeoutHandler);_0x400975[_0x593f('0x1c')]=![];_0x400975['on']('hangup',hangupHandler);var _0x46614b=_['find'](projects,[_0x593f('0x11'),_0x400975[_0x593f('0x16')]]);if(!_0x46614b)return Project['handleNotFound'](_0x400975);if(!_0x46614b[_0x593f('0x27')])return Project[_0x593f('0x28')](_0x400975);return Project['initialize'](_0x46614b,_0x400975);}function main(){var _0x3f279b;return utilLicense[_0x593f('0x29')]()['then'](function(_0x31a295){if(!_0x31a295)return;if(_0x31a295['voice']){if(_0x31a295['callysquare']&&_0x31a295[_0x593f('0x2a')]>0x0){logger['info'](util[_0x593f('0xf')]('[LICENSE]\x20CHANNELS:\x20%s',_0x31a295['callysquare']));_0x3f279b=_0x31a295[_0x593f('0x2a')];}else{logger[_0x593f('0xe')](_0x593f('0x2b'));}}else{logger[_0x593f('0xe')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x3f279b=-0x1;}})['then'](function(){return Project[_0x593f('0x2c')]();})[_0x593f('0x1d')](function(_0x2d33fc){projects=_0x2d33fc;return;})['catch'](function(_0x53e2a4){logger['error'](_0x593f('0x2d'),_0x53e2a4[_0x593f('0xb')]);})[_0x593f('0x2e')](function(){var _0x25a180=require(_0x593f('0x2f'))(config[_0x593f('0x3')][_0x593f('0xd')],config[_0x593f('0x3')]['ip'],_0x3f279b);_0x25a180['on']('error',errorHandler);_0x25a180['on'](_0x593f('0x30'),listeningHandler);_0x25a180['on']('connection',connectionHandler);_0x25a180['on'](_0x593f('0x25'),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 f7bd3df..d2a3668 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 _0xd951=['client','request','then','error','message','jayson/promise'];(function(_0x5396f6,_0x94d1ce){var _0x3047a0=function(_0x4787dc){while(--_0x4787dc){_0x5396f6['push'](_0x5396f6['shift']());}};_0x3047a0(++_0x94d1ce);}(_0xd951,0x19d));var _0x1d95=function(_0x2cebd7,_0x535e4f){_0x2cebd7=_0x2cebd7-0x0;var _0x2a6796=_0xd951[_0x2cebd7];return _0x2a6796;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x1d95('0x0'));var client=jayson[_0x1d95('0x1')]['http']({'port':0x232b});function request(_0xfa60f8,_0x293f89){return new BPromise(function(_0x76e83b,_0x4e2491){return client[_0x1d95('0x2')](_0xfa60f8,_0x293f89)[_0x1d95('0x3')](function(_0x44c670){if(_0x44c670[_0x1d95('0x4')]){return _0x4e2491(_0x44c670[_0x1d95('0x4')][_0x1d95('0x5')]);}else{return _0x76e83b(_0x44c670['result']);}})['catch'](function(_0x1cb78c){return _0x4e2491(_0x1cb78c);});});}exports['sendMailMessage']=function(_0xa726e3,_0x46ab5d){return request('SendMail',{'account':_0xa726e3,'message':_0x46ab5d});}; \ No newline at end of file +var _0xeb2b=['then','error','message','result','sendMailMessage','SendMail','bluebird','jayson/promise','http','request'];(function(_0x4442ff,_0x5e93e5){var _0x3bb5e2=function(_0xed83c0){while(--_0xed83c0){_0x4442ff['push'](_0x4442ff['shift']());}};_0x3bb5e2(++_0x5e93e5);}(_0xeb2b,0x1dc));var _0xbeb2=function(_0x2ea581,_0x230440){_0x2ea581=_0x2ea581-0x0;var _0x2f5ecf=_0xeb2b[_0x2ea581];return _0x2f5ecf;};'use strict';var BPromise=require(_0xbeb2('0x0'));var jayson=require(_0xbeb2('0x1'));var client=jayson['client'][_0xbeb2('0x2')]({'port':0x232b});function request(_0x143083,_0x3d200d){return new BPromise(function(_0x1e1afe,_0x3f89d3){return client[_0xbeb2('0x3')](_0x143083,_0x3d200d)[_0xbeb2('0x4')](function(_0x5345ab){if(_0x5345ab[_0xbeb2('0x5')]){return _0x3f89d3(_0x5345ab[_0xbeb2('0x5')][_0xbeb2('0x6')]);}else{return _0x1e1afe(_0x5345ab[_0xbeb2('0x7')]);}})['catch'](function(_0x180414){return _0x3f89d3(_0x180414);});});}exports[_0xbeb2('0x8')]=function(_0x1ea6fd,_0x2d6089){return request(_0xbeb2('0x9'),{'account':_0x1ea6fd,'message':_0x2d6089});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 85c1ebb..d623f76 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008e=['context','extension','priority','agicommand','response','code','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','finally','info','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','stack','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','moment','util','../../config/logger','agi','./rpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','hasOwnProperty','retry','maxRetry','addVertex','mxCell','isArray','length','source','addEdge','target','toJson','root','inspect','production','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','vertex','gotoc'];(function(_0xb41bb8,_0x46ca53){var _0x492f81=function(_0x43a5b8){while(--_0x43a5b8){_0xb41bb8['push'](_0xb41bb8['shift']());}};_0x492f81(++_0x46ca53);}(_0x008e,0xd9));var _0xe008=function(_0x41230b,_0x2bb04e){_0x41230b=_0x41230b-0x0;var _0x56c075=_0x008e[_0x41230b];return _0x56c075;};'use strict';var _=require(_0xe008('0x0'));var moment=require(_0xe008('0x1'));var parser=require('xml2json');var util=require(_0xe008('0x2'));var logger=require(_0xe008('0x3'))(_0xe008('0x4'));var rpc=require(_0xe008('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0xe008('0x6'));var Vertices=require(_0xe008('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xe008('0x8')]()[_0xe008('0x9')](function(_0x13828){logger[_0xe008('0xa')](_0xe008('0xb'),_0x13828['stack']);return[];});}function addVertex(_0x4cc22f,_0x507cba,_0x2c0221){_0x507cba['agicommand']=_0x2c0221;if(_0x507cba[_0xe008('0xc')](_0xe008('0xd'))){_0x507cba[_0xe008('0xe')]=parseInt(_0x507cba[_0xe008('0xd')],0xa);}_0x4cc22f[_0xe008('0xf')](_['omit'](_0x507cba,_0xe008('0x10')));}function initGraph(_0x3c2dd8,_0x6294be){var _0x22e044=new Graph();for(var _0x4c7c68 in _0x3c2dd8){if(_0x3c2dd8[_0xe008('0xc')](_0x4c7c68)){if(_[_0xe008('0x11')](_0x3c2dd8[_0x4c7c68])){for(var _0x143f54=0x0;_0x143f54<_0x3c2dd8[_0x4c7c68]['length'];_0x143f54+=0x1){addVertex(_0x22e044,_0x3c2dd8[_0x4c7c68][_0x143f54],_0x4c7c68);}}else{addVertex(_0x22e044,_0x3c2dd8[_0x4c7c68],_0x4c7c68);}}}for(var _0x14c0a1=0x0;_0x14c0a1<_0x6294be[_0xe008('0x12')];_0x14c0a1+=0x1){if(_0x6294be[_0x14c0a1][_0xe008('0x13')]&&_0x6294be[_0x14c0a1]['target']){_0x22e044[_0xe008('0x14')](_0x6294be[_0x14c0a1][_0xe008('0x13')],_0x6294be[_0x14c0a1][_0xe008('0x15')],_0x6294be[_0x14c0a1]['value']);}}return _0x22e044;}function getRoot(_0x3e04f5){return parser[_0xe008('0x16')](_0x3e04f5,{'object':!![]})['mxGraphModel'][_0xe008('0x17')];}function inspect(_0x137469){return util[_0xe008('0x18')](_0x137469,{'showHidden':![],'depth':null});}function initialize(_0x13db98,_0x5c878e){var _0x3f8d7a=getRoot(_0x13db98[_0xe008('0x19')]);if(!_0x3f8d7a||!_0x3f8d7a[_0xe008('0x1a')])return;var _0x4d63c1,_0xb065f5,_0x545338;logger[_0xe008('0x1b')](_0xe008('0x17'),JSON[_0xe008('0x1c')](_0x3f8d7a,null,0x2));_0x5c878e[_0xe008('0x1d')]=moment()[_0xe008('0x1e')](_0xe008('0x1f'));_0x4d63c1=initGraph(_[_0xe008('0x20')](_0x3f8d7a,_0xe008('0x10')),_0x3f8d7a[_0xe008('0x10')]);_0xb065f5=new Vertices(_0x5c878e,rpc,mailRpc);logger['info'](util[_0xe008('0x1e')](_0xe008('0x21'),_0x5c878e[_0xe008('0x22')],_0x5c878e[_0xe008('0x23')],_0x5c878e[_0xe008('0x24')],_0x5c878e[_0xe008('0x25')],_0x5c878e[_0xe008('0x26')]));_0x4d63c1[_0xe008('0x27')](_0x3f8d7a[_0xe008('0x1a')]['id'],function(_0x204b73){try{_0x204b73=_0xb065f5[_0xe008('0x28')](_0x204b73);logger[_0xe008('0x1b')](_0xe008('0x29'),JSON[_0xe008('0x1c')](_0x204b73,null,0x2));if(_0x204b73['agicommand']===_0xe008('0x2a')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x5c878e['context']=_0x204b73[_0xe008('0x2b')]||_0x5c878e[_0xe008('0x2b')];_0x5c878e['extension']=_0x204b73[_0xe008('0x2c')];_0x5c878e[_0xe008('0x2d')]=_0x204b73[_0xe008('0x2d')]?_0x204b73['priority']-0x1:0x1;return null;}else if(_0x204b73&&_0xb065f5[_0x204b73[_0xe008('0x2e')]]){_0x545338=_0xb065f5[_0x204b73[_0xe008('0x2e')]](_0x204b73);logger['info'](_0xe008('0x2f'),JSON[_0xe008('0x1c')](_0x545338,null,0x2));if(_0x545338&&_0x545338[_0xe008('0x30')]===AGI_CODE_SUCCESS&&_0x545338[_0xe008('0x31')]!==AGI_RESULT_ERROR&&!_0x5c878e[_0xe008('0x32')]){logger[_0xe008('0x1b')]('response',inspect(_0x545338));return _[_0xe008('0x33')](_0x545338[_0xe008('0x31')])?null:_0x545338[_0xe008('0x31')][_0xe008('0x34')]();}else{logger[_0xe008('0xa')](_0xe008('0x2f'),inspect(_0x545338));return null;}}else{logger['error'](_0xe008('0x35'));return null;}}catch(_0x40c2ba){logger[_0xe008('0xa')](_0x40c2ba['stack']);return null;}});if(_0x3f8d7a[_0xe008('0x36')]){logger[_0xe008('0x37')](util['format'](_0xe008('0x38'),_0x5c878e[_0xe008('0x22')],_0x5c878e[_0xe008('0x23')],_0x5c878e[_0xe008('0x24')],_0x5c878e[_0xe008('0x25')],_0x5c878e[_0xe008('0x26')]));_0x4d63c1['traverseBFS'](_0x3f8d7a['finally']['id'],function(_0xc45bc5){try{_0xc45bc5=_0xb065f5[_0xe008('0x28')](_0xc45bc5);logger['debug'](_0xe008('0x29'),JSON[_0xe008('0x1c')](_0xc45bc5,null,0x2));if(_0xc45bc5&&_0xb065f5[_0xc45bc5['agicommand']]){_0x545338=_0xb065f5[_0xc45bc5[_0xe008('0x2e')]](_0xc45bc5);if(_0x545338){logger[_0xe008('0x1b')](_0xe008('0x2f'),inspect(_0x545338));return _['isUndefined'](_0x545338[_0xe008('0x31')])?null:_0x545338[_0xe008('0x31')][_0xe008('0x34')]();}else{logger['error']('response',inspect(_0x545338));return null;}}else{logger[_0xe008('0xa')](_0xe008('0x35'));return null;}}catch(_0xe84f4d){logger['error'](_0xe84f4d[_0xe008('0x39')]);return null;}});}logger[_0xe008('0x37')](util[_0xe008('0x1e')](_0xe008('0x3a'),_0x5c878e[_0xe008('0x22')],_0x5c878e[_0xe008('0x23')],_0x5c878e[_0xe008('0x24')],_0x5c878e[_0xe008('0x25')],_0x5c878e['uniqueid']));logger[_0xe008('0x37')](util[_0xe008('0x1e')](_0xe008('0x3b'),_0x5c878e['context'],_0x5c878e[_0xe008('0x2c')],parseInt(_0x5c878e[_0xe008('0x2d')],0xa)+0x1));_0x5c878e[_0xe008('0x3c')](_0x5c878e[_0xe008('0x2b')],_0x5c878e[_0xe008('0x2c')],parseInt(_0x5c878e[_0xe008('0x2d')],0xa)+0x1);_0x5c878e[_0xe008('0x3d')]();}function handleNotFound(_0xa9b171){logger[_0xe008('0xa')](util[_0xe008('0x1e')](_0xe008('0x3e'),_0xa9b171[_0xe008('0x22')]));_0xa9b171['continueAt'](_0xa9b171[_0xe008('0x2b')],_0xa9b171[_0xe008('0x2c')],parseInt(_0xa9b171[_0xe008('0x2d')],0xa)+0x1);_0xa9b171[_0xe008('0x3d')]();}function handleUnpublished(_0x52b721){logger['error'](util[_0xe008('0x1e')](_0xe008('0x3f'),_0x52b721[_0xe008('0x22')]));_0x52b721['continueAt'](_0x52b721['context'],_0x52b721[_0xe008('0x2c')],parseInt(_0x52b721[_0xe008('0x2d')],0xa)+0x1);_0x52b721[_0xe008('0x3d')]();}module[_0xe008('0x40')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x900a=['error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','retry','maxRetry','addVertex','omit','length','source','addEdge','target','mxGraphModel','production','start','debug','root','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','vertex','agicommand','gotoc','context','extension','priority','response','code','evtHangup','isUndefined','result','toString','agicommand\x20not\x20found','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash','xml2json','util','../../config/logger','agi','./vertices','catch'];(function(_0x59585a,_0x5b2242){var _0x472755=function(_0x5996e4){while(--_0x5996e4){_0x59585a['push'](_0x59585a['shift']());}};_0x472755(++_0x5b2242);}(_0x900a,0x155));var _0xa900=function(_0x44506a,_0x2a5fcf){_0x44506a=_0x44506a-0x0;var _0x46cfde=_0x900a[_0x44506a];return _0x46cfde;};'use strict';var _=require(_0xa900('0x0'));var moment=require('moment');var parser=require(_0xa900('0x1'));var util=require(_0xa900('0x2'));var logger=require(_0xa900('0x3'))(_0xa900('0x4'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0xa900('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xa900('0x6')](function(_0x383b21){logger[_0xa900('0x7')](_0xa900('0x8'),_0x383b21[_0xa900('0x9')]);return[];});}function addVertex(_0xab044,_0x555a94,_0x2378b3){_0x555a94['agicommand']=_0x2378b3;if(_0x555a94[_0xa900('0xa')](_0xa900('0xb'))){_0x555a94[_0xa900('0xc')]=parseInt(_0x555a94[_0xa900('0xb')],0xa);}_0xab044[_0xa900('0xd')](_[_0xa900('0xe')](_0x555a94,'mxCell'));}function initGraph(_0x2f63b9,_0x59db9d){var _0x13e370=new Graph();for(var _0x3ad023 in _0x2f63b9){if(_0x2f63b9[_0xa900('0xa')](_0x3ad023)){if(_['isArray'](_0x2f63b9[_0x3ad023])){for(var _0x2f7bb4=0x0;_0x2f7bb4<_0x2f63b9[_0x3ad023][_0xa900('0xf')];_0x2f7bb4+=0x1){addVertex(_0x13e370,_0x2f63b9[_0x3ad023][_0x2f7bb4],_0x3ad023);}}else{addVertex(_0x13e370,_0x2f63b9[_0x3ad023],_0x3ad023);}}}for(var _0x1aca06=0x0;_0x1aca06<_0x59db9d['length'];_0x1aca06+=0x1){if(_0x59db9d[_0x1aca06][_0xa900('0x10')]&&_0x59db9d[_0x1aca06]['target']){_0x13e370[_0xa900('0x11')](_0x59db9d[_0x1aca06][_0xa900('0x10')],_0x59db9d[_0x1aca06][_0xa900('0x12')],_0x59db9d[_0x1aca06]['value']);}}return _0x13e370;}function getRoot(_0x811d0a){return parser['toJson'](_0x811d0a,{'object':!![]})[_0xa900('0x13')]['root'];}function inspect(_0x46f613){return util['inspect'](_0x46f613,{'showHidden':![],'depth':null});}function initialize(_0x504380,_0x4dcc40){var _0x24256b=getRoot(_0x504380[_0xa900('0x14')]);if(!_0x24256b||!_0x24256b[_0xa900('0x15')])return;var _0x417c4c,_0x96d8ec,_0x489833;logger[_0xa900('0x16')](_0xa900('0x17'),JSON[_0xa900('0x18')](_0x24256b,null,0x2));_0x4dcc40[_0xa900('0x19')]=moment()[_0xa900('0x1a')](_0xa900('0x1b'));_0x417c4c=initGraph(_[_0xa900('0xe')](_0x24256b,_0xa900('0x1c')),_0x24256b['mxCell']);_0x96d8ec=new Vertices(_0x4dcc40,rpc,mailRpc);logger[_0xa900('0x1d')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4dcc40[_0xa900('0x1e')],_0x4dcc40[_0xa900('0x1f')],_0x4dcc40[_0xa900('0x20')],_0x4dcc40[_0xa900('0x21')],_0x4dcc40[_0xa900('0x22')]));_0x417c4c[_0xa900('0x23')](_0x24256b['start']['id'],function(_0x252666){try{_0x252666=_0x96d8ec[_0xa900('0x24')](_0x252666);logger[_0xa900('0x16')](_0xa900('0x25'),JSON[_0xa900('0x18')](_0x252666,null,0x2));if(_0x252666[_0xa900('0x26')]===_0xa900('0x27')){logger[_0xa900('0x1d')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x4dcc40[_0xa900('0x28')]=_0x252666[_0xa900('0x28')]||_0x4dcc40[_0xa900('0x28')];_0x4dcc40[_0xa900('0x29')]=_0x252666[_0xa900('0x29')];_0x4dcc40['priority']=_0x252666[_0xa900('0x2a')]?_0x252666[_0xa900('0x2a')]-0x1:0x1;return null;}else if(_0x252666&&_0x96d8ec[_0x252666[_0xa900('0x26')]]){_0x489833=_0x96d8ec[_0x252666[_0xa900('0x26')]](_0x252666);logger[_0xa900('0x1d')](_0xa900('0x2b'),JSON[_0xa900('0x18')](_0x489833,null,0x2));if(_0x489833&&_0x489833[_0xa900('0x2c')]===AGI_CODE_SUCCESS&&_0x489833['result']!==AGI_RESULT_ERROR&&!_0x4dcc40[_0xa900('0x2d')]){logger[_0xa900('0x16')](_0xa900('0x2b'),inspect(_0x489833));return _[_0xa900('0x2e')](_0x489833[_0xa900('0x2f')])?null:_0x489833[_0xa900('0x2f')][_0xa900('0x30')]();}else{logger[_0xa900('0x7')](_0xa900('0x2b'),inspect(_0x489833));return null;}}else{logger['error'](_0xa900('0x31'));return null;}}catch(_0x1d0843){logger['error'](_0x1d0843[_0xa900('0x9')]);return null;}});if(_0x24256b['finally']){logger['info'](util[_0xa900('0x1a')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4dcc40[_0xa900('0x1e')],_0x4dcc40['calleridname'],_0x4dcc40[_0xa900('0x20')],_0x4dcc40[_0xa900('0x21')],_0x4dcc40['uniqueid']));_0x417c4c[_0xa900('0x23')](_0x24256b[_0xa900('0x32')]['id'],function(_0x144bbc){try{_0x144bbc=_0x96d8ec['clear'](_0x144bbc);logger[_0xa900('0x16')]('vertex',JSON['stringify'](_0x144bbc,null,0x2));if(_0x144bbc&&_0x96d8ec[_0x144bbc[_0xa900('0x26')]]){_0x489833=_0x96d8ec[_0x144bbc[_0xa900('0x26')]](_0x144bbc);if(_0x489833){logger[_0xa900('0x16')]('response',inspect(_0x489833));return _[_0xa900('0x2e')](_0x489833[_0xa900('0x2f')])?null:_0x489833[_0xa900('0x2f')][_0xa900('0x30')]();}else{logger[_0xa900('0x7')](_0xa900('0x2b'),inspect(_0x489833));return null;}}else{logger['error'](_0xa900('0x31'));return null;}}catch(_0x45d9e5){logger[_0xa900('0x7')](_0x45d9e5['stack']);return null;}});}logger['info'](util[_0xa900('0x1a')](_0xa900('0x33'),_0x4dcc40[_0xa900('0x1e')],_0x4dcc40[_0xa900('0x1f')],_0x4dcc40[_0xa900('0x20')],_0x4dcc40[_0xa900('0x21')],_0x4dcc40['uniqueid']));logger[_0xa900('0x1d')](util[_0xa900('0x1a')](_0xa900('0x34'),_0x4dcc40[_0xa900('0x28')],_0x4dcc40[_0xa900('0x29')],parseInt(_0x4dcc40['priority'],0xa)+0x1));_0x4dcc40[_0xa900('0x35')](_0x4dcc40[_0xa900('0x28')],_0x4dcc40[_0xa900('0x29')],parseInt(_0x4dcc40[_0xa900('0x2a')],0xa)+0x1);_0x4dcc40[_0xa900('0x36')]();}function handleNotFound(_0x1101e0){logger[_0xa900('0x7')](util[_0xa900('0x1a')](_0xa900('0x37'),_0x1101e0[_0xa900('0x1e')]));_0x1101e0['continueAt'](_0x1101e0[_0xa900('0x28')],_0x1101e0[_0xa900('0x29')],parseInt(_0x1101e0['priority'],0xa)+0x1);_0x1101e0['close']();}function handleUnpublished(_0x57b8e5){logger[_0xa900('0x7')](util[_0xa900('0x1a')](_0xa900('0x38'),_0x57b8e5[_0xa900('0x1e')]));_0x57b8e5[_0xa900('0x35')](_0x57b8e5[_0xa900('0x28')],_0x57b8e5['extension'],parseInt(_0x57b8e5['priority'],0xa)+0x1);_0x57b8e5['close']();}module[_0xa900('0x39')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 85eae8c..56126fb 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 _0x8f3b=['trim','headers','emit','line','exports','util','Transform','call','_localBuffer','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0x8f3b,0x1d9));var _0xb8f3=function(_0x5bec22,_0x5cd534){_0x5bec22=_0x5bec22-0x0;var _0x42828c=_0x8f3b[_0x5bec22];return _0x42828c;};'use strict';var util=require(_0xb8f3('0x0'));var Transform=require('stream')[_0xb8f3('0x1')];function AGIReply(_0x4e34cb){Transform[_0xb8f3('0x2')](this,_0x4e34cb);this[_0xb8f3('0x3')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xb8f3('0x4')][_0xb8f3('0x5')]=function(_0x5b7db6,_0x196358,_0x566d29){var _0x3c4250='\x0a',_0x4cb9e8=['\x0a\x0a',_0xb8f3('0x6')],_0x2dec4e=-0x1,_0x581845=-0x1,_0x2f375f='',_0x45238e=0x0,_0x11db41='',_0x5257b8='';this['_localBuffer']+=_0x5b7db6[_0xb8f3('0x7')]();_0x11db41=this[_0xb8f3('0x3')];if(!this['_inBody']){_0x45238e=0x0;while(_0x4cb9e8[_0x45238e]){while((_0x581845=_0x11db41[_0xb8f3('0x8')](_0x4cb9e8[_0x45238e]))!=-0x1){_0x2f375f=_0x4cb9e8[_0x45238e];_0x5257b8=_0x11db41[_0xb8f3('0x9')](0x0,_0x581845);_0x11db41=_0x11db41['substring'](_0x581845+_0x2f375f[_0xb8f3('0xa')]);var _0x4b0906=_0x5257b8[_0xb8f3('0xb')](_0x3c4250),_0x2d86fa=0x0,_0x499f0e={},_0x39a375='',_0x22588d='',_0x539cec=-0x1;while(_0x4b0906[_0x2d86fa]){_0x539cec=_0x4b0906[_0x2d86fa]['indexOf'](':');if(_0x539cec!=-0x1){_0x39a375=_0x4b0906[_0x2d86fa][_0xb8f3('0xc')](0x0,_0x539cec)[_0xb8f3('0xd')]();_0x22588d=_0x4b0906[_0x2d86fa][_0xb8f3('0xc')](_0x539cec+0x1)[_0xb8f3('0xd')]();if(_0x39a375[_0xb8f3('0xa')]>0x0){_0x499f0e[_0x39a375]=_0x22588d;}}else{}_0x2d86fa++;}this['emit'](_0xb8f3('0xe'),_0x499f0e);this['_inBody']=!![];}_0x45238e++;}this[_0xb8f3('0x3')]=_0x11db41;}else{while((_0x2dec4e=_0x11db41['indexOf'](_0x3c4250))!=-0x1){_0x5257b8=_0x11db41[_0xb8f3('0x9')](0x0,_0x2dec4e);this[_0xb8f3('0xf')](_0xb8f3('0x10'),_0x5257b8);_0x11db41=_0x11db41[_0xb8f3('0x9')](_0x2dec4e+_0x3c4250[_0xb8f3('0xa')]);}this[_0xb8f3('0x3')]=_0x11db41;}_0x566d29();};module[_0xb8f3('0x11')]=AGIReply; \ No newline at end of file +var _0x10c7=['inherits','prototype','_transform','\x0d\x0a\x0d\x0a','indexOf','substring','length','slice','trim','emit','headers','line','util','Transform','call','_localBuffer','_inBody'];(function(_0x103887,_0x5697b3){var _0x39b0bc=function(_0x4a181c){while(--_0x4a181c){_0x103887['push'](_0x103887['shift']());}};_0x39b0bc(++_0x5697b3);}(_0x10c7,0xd8));var _0x710c=function(_0x378380,_0x31dba0){_0x378380=_0x378380-0x0;var _0x2a4744=_0x10c7[_0x378380];return _0x2a4744;};'use strict';var util=require(_0x710c('0x0'));var Transform=require('stream')[_0x710c('0x1')];function AGIReply(_0x1ba1e6){Transform[_0x710c('0x2')](this,_0x1ba1e6);this[_0x710c('0x3')]='';this[_0x710c('0x4')]=![];}util[_0x710c('0x5')](AGIReply,Transform);AGIReply[_0x710c('0x6')][_0x710c('0x7')]=function(_0x2ca9c2,_0x7d90b8,_0x2d10db){var _0x265f83='\x0a',_0xc91831=['\x0a\x0a',_0x710c('0x8')],_0x4fd15b=-0x1,_0x25489d=-0x1,_0x48045a='',_0x1795c6=0x0,_0x124f79='',_0xad67c='';this[_0x710c('0x3')]+=_0x2ca9c2['toString']();_0x124f79=this['_localBuffer'];if(!this['_inBody']){_0x1795c6=0x0;while(_0xc91831[_0x1795c6]){while((_0x25489d=_0x124f79[_0x710c('0x9')](_0xc91831[_0x1795c6]))!=-0x1){_0x48045a=_0xc91831[_0x1795c6];_0xad67c=_0x124f79[_0x710c('0xa')](0x0,_0x25489d);_0x124f79=_0x124f79[_0x710c('0xa')](_0x25489d+_0x48045a[_0x710c('0xb')]);var _0x17eab2=_0xad67c['split'](_0x265f83),_0x4dcb43=0x0,_0x3e77cc={},_0x443042='',_0x5c7b40='',_0x2029a6=-0x1;while(_0x17eab2[_0x4dcb43]){_0x2029a6=_0x17eab2[_0x4dcb43][_0x710c('0x9')](':');if(_0x2029a6!=-0x1){_0x443042=_0x17eab2[_0x4dcb43][_0x710c('0xc')](0x0,_0x2029a6)['trim']();_0x5c7b40=_0x17eab2[_0x4dcb43][_0x710c('0xc')](_0x2029a6+0x1)[_0x710c('0xd')]();if(_0x443042[_0x710c('0xb')]>0x0){_0x3e77cc[_0x443042]=_0x5c7b40;}}else{}_0x4dcb43++;}this[_0x710c('0xe')](_0x710c('0xf'),_0x3e77cc);this[_0x710c('0x4')]=!![];}_0x1795c6++;}this[_0x710c('0x3')]=_0x124f79;}else{while((_0x4fd15b=_0x124f79[_0x710c('0x9')](_0x265f83))!=-0x1){_0xad67c=_0x124f79['substring'](0x0,_0x4fd15b);this[_0x710c('0xe')](_0x710c('0x10'),_0xad67c);_0x124f79=_0x124f79['substring'](_0x4fd15b+_0x265f83['length']);}this[_0x710c('0x3')]=_0x124f79;}_0x2d10db();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 6caea71..aaa287b 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 _0xae53=['lodash','jayson/promise','client','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','getVoiceQueueById','ShowVoiceQueue','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser'];(function(_0x1b620a,_0x47a266){var _0x414d1d=function(_0xd4b4ba){while(--_0xd4b4ba){_0x1b620a['push'](_0x1b620a['shift']());}};_0x414d1d(++_0x47a266);}(_0xae53,0x16e));var _0x3ae5=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xae53[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x3ae5('0x0'));var moment=require('moment');var jayson=require(_0x3ae5('0x1'));var client=jayson[_0x3ae5('0x2')][_0x3ae5('0x3')]({'port':0x2329});function request(_0x564f59,_0x393f55){return new Promise(function(_0x2d4c0b,_0x293589){return client[_0x3ae5('0x4')](_0x564f59,_0x393f55)[_0x3ae5('0x5')](function(_0x4e4218){if(_0x4e4218[_0x3ae5('0x6')]){return _0x293589(_0x4e4218['error'][_0x3ae5('0x7')]);}else{return _0x2d4c0b(_0x4e4218[_0x3ae5('0x8')]);}})[_0x3ae5('0x9')](function(_0x3fdf89){return _0x293589(_0x3fdf89);});});}exports[_0x3ae5('0xa')]=function(){return request(_0x3ae5('0xb'),{'options':{'raw':![],'attributes':['id',_0x3ae5('0xc'),_0x3ae5('0xd')]}});};exports['getSquareProject']=function(_0xbd3c3e){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0xbd3c3e},'attributes':[_0x3ae5('0xd')]}});};exports[_0x3ae5('0xe')]=function(_0x315476){return request(_0x3ae5('0xf'),{'options':{'raw':![],'where':{'id':_0x315476},'include':[{'model':_0x3ae5('0x10'),'as':'Smtp','include':[{'model':_0x3ae5('0x11'),'as':_0x3ae5('0x11')}]}],'attributes':['id',_0x3ae5('0xc'),'email'],'smtp':!![]}});};exports['getSquareProjectById']=function(_0xaa3ce9){return request('ShowSquareProject',{'options':{'where':{'id':_0xaa3ce9},'attributes':[_0x3ae5('0xc')]}});};exports[_0x3ae5('0x12')]=function(_0x3b9122){return request(_0x3ae5('0x13'),{'options':{'where':{'id':_0x3b9122},'attributes':[_0x3ae5('0xc')]}});};exports['getVariableById']=function(_0x216c62){return request(_0x3ae5('0x14'),{'options':{'where':{'id':_0x216c62},'attributes':[_0x3ae5('0xc')]}});};exports['getSquareOdbcById']=function(_0x521a29){return request(_0x3ae5('0x15'),{'options':{'where':{'id':_0x521a29},'attributes':[_0x3ae5('0x16')]}});};exports[_0x3ae5('0x17')]=function(_0x445a31){return request(_0x3ae5('0x18'),{'options':{'where':{'id':_0x445a31},'attributes':[_0x3ae5('0xc')]}});};exports[_0x3ae5('0x19')]=function(_0x5360a3){return request('GetContactByPhone',{'options':{'where':{'phone':_0x5360a3['phone']},'attributes':['id']}});};exports[_0x3ae5('0x1a')]=function(_0x3f43ca){return request(_0x3ae5('0x1b'),{'options':{'where':{'id':_0x3f43ca},'attributes':[_0x3ae5('0xc')]}});};exports[_0x3ae5('0x1c')]=function(_0x211dff){return request(_0x3ae5('0x1d'),{'options':{'where':{'id':_0x211dff},'attributes':['save_name']}});};exports[_0x3ae5('0x1e')]=function(_0x1078a0){return request(_0x3ae5('0x1f'),{'options':{'raw':![],'where':{'id':_0x1078a0},'include':[{'model':_0x3ae5('0x20'),'as':_0x3ae5('0x21')}]}});};exports[_0x3ae5('0x22')]=function(_0x502671){return request('ShowSmsAccount',{'options':{'where':{'id':_0x502671},'attributes':['id',_0x3ae5('0xc')]}});};exports[_0x3ae5('0x23')]=function(_0x32da8c){return request(_0x3ae5('0x24'),{'body':_0x32da8c});};exports[_0x3ae5('0x25')]=function(_0x9a9714){return request(_0x3ae5('0x26'),{'body':_0x9a9714});};exports[_0x3ae5('0x27')]=function(_0x4a17d8){return request('CreateSquareReport',{'body':_[_0x3ae5('0x28')](_0x4a17d8,{'project_name':_0x4a17d8[_0x3ae5('0x29')],'prev_project_name':_0x4a17d8[_0x3ae5('0x2a')]||'','is_subproject':_0x4a17d8['arg_2']?!![]:![],'leaveAt':moment()[_0x3ae5('0x2b')](_0x3ae5('0x2c'))})});};exports[_0x3ae5('0x2d')]=function(_0x2ba130){return request(_0x3ae5('0x2e'),{'body':_0x2ba130});};exports['createSquareMessage']=function(_0x1705c5){return request(_0x3ae5('0x2f'),{'body':_0x1705c5});};exports[_0x3ae5('0x30')]=function(_0x41ba36){return request(_0x3ae5('0x31'),{'options':{'raw':![],'where':{'phone':_0x41ba36[_0x3ae5('0x32')],'ListId':_0x41ba36[_0x3ae5('0x33')]}}})['then'](function(_0x35847e){if(_0x35847e){return _0x35847e;}return request(_0x3ae5('0x34'),{'body':_0x41ba36});});};exports[_0x3ae5('0x35')]=function(_0x5d7072){return request(_0x3ae5('0x36'),{'options':{'where':{'id':_0x5d7072},'attributes':[_0x3ae5('0xc')]}});};exports[_0x3ae5('0x37')]=function(_0x2993a5,_0x4492a){return request(_0x3ae5('0x38'),{'body':{'interface':_0x4492a},'options':{'where':_0x2993a5}});};exports[_0x3ae5('0x39')]=function(_0x2ca128,_0x47954f,_0x3d4e62){return request(_0x3ae5('0x3a'),{'body':{'type':_0x47954f,'uniqueid':_0x3d4e62},'options':{'where':_0x2ca128}});};exports[_0x3ae5('0x3b')]=function(_0x597d91){return request(_0x3ae5('0x3c'),{'body':{},'options':{'where':_0x597d91}});};exports['agentLogout']=function(_0x53f716){return request('LogoutUser',{'body':{},'options':{'where':_0x53f716}});}; \ No newline at end of file +var _0x7266=['production','getSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','getSquareProjectById','ShowSquareProject','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','GetContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createCmContact','ShowCmHopper','then','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','error','message','result','catch','getSquareProjects','GetSquareProjects','name'];(function(_0x3718b7,_0x2da677){var _0xf8c91e=function(_0x2519b4){while(--_0x2519b4){_0x3718b7['push'](_0x3718b7['shift']());}};_0xf8c91e(++_0x2da677);}(_0x7266,0xec));var _0x6726=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x7266[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x6726('0x0'));var moment=require(_0x6726('0x1'));var jayson=require(_0x6726('0x2'));var client=jayson[_0x6726('0x3')][_0x6726('0x4')]({'port':0x2329});function request(_0x51d674,_0x5dd7a7){return new Promise(function(_0x47093e,_0x4e215d){return client['request'](_0x51d674,_0x5dd7a7)['then'](function(_0x2d9162){if(_0x2d9162[_0x6726('0x5')]){return _0x4e215d(_0x2d9162[_0x6726('0x5')][_0x6726('0x6')]);}else{return _0x47093e(_0x2d9162[_0x6726('0x7')]);}})[_0x6726('0x8')](function(_0x126ba7){return _0x4e215d(_0x126ba7);});});}exports[_0x6726('0x9')]=function(){return request(_0x6726('0xa'),{'options':{'raw':![],'attributes':['id',_0x6726('0xb'),_0x6726('0xc')]}});};exports[_0x6726('0xd')]=function(_0xdda3e6){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0xdda3e6},'attributes':[_0x6726('0xc')]}});};exports[_0x6726('0xe')]=function(_0x1c6377){return request(_0x6726('0xf'),{'options':{'raw':![],'where':{'id':_0x1c6377},'include':[{'model':'MailServerOut','as':_0x6726('0x10'),'include':[{'model':'CloudProvider','as':_0x6726('0x11')}]}],'attributes':['id',_0x6726('0xb'),'email'],'smtp':!![]}});};exports[_0x6726('0x12')]=function(_0x2b7fb8){return request(_0x6726('0x13'),{'options':{'where':{'id':_0x2b7fb8},'attributes':[_0x6726('0xb')]}});};exports['getVoiceQueueById']=function(_0x33b6d7){return request(_0x6726('0x14'),{'options':{'where':{'id':_0x33b6d7},'attributes':['name']}});};exports[_0x6726('0x15')]=function(_0x5d3458){return request(_0x6726('0x16'),{'options':{'where':{'id':_0x5d3458},'attributes':[_0x6726('0xb')]}});};exports[_0x6726('0x17')]=function(_0x3a3b6a){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x3a3b6a},'attributes':[_0x6726('0x18')]}});};exports[_0x6726('0x19')]=function(_0x4adb51){return request(_0x6726('0x1a'),{'options':{'where':{'id':_0x4adb51},'attributes':['name']}});};exports['getContactByPhone']=function(_0x5f1677){return request(_0x6726('0x1b'),{'options':{'where':{'phone':_0x5f1677[_0x6726('0x1c')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x3a27d2){return request(_0x6726('0x1d'),{'options':{'where':{'id':_0x3a27d2},'attributes':[_0x6726('0xb')]}});};exports[_0x6726('0x1e')]=function(_0x472795){return request(_0x6726('0x1f'),{'options':{'where':{'id':_0x472795},'attributes':['save_name']}});};exports[_0x6726('0x20')]=function(_0x559f07){return request(_0x6726('0x21'),{'options':{'raw':![],'where':{'id':_0x559f07},'include':[{'model':_0x6726('0x22'),'as':_0x6726('0x23')}]}});};exports[_0x6726('0x24')]=function(_0xd10662){return request(_0x6726('0x25'),{'options':{'where':{'id':_0xd10662},'attributes':['id','name']}});};exports[_0x6726('0x26')]=function(_0x454b4d){return request(_0x6726('0x27'),{'body':_0x454b4d});};exports[_0x6726('0x28')]=function(_0x544b2b){return request(_0x6726('0x29'),{'body':_0x544b2b});};exports['createSquareReport']=function(_0x497d49){return request(_0x6726('0x2a'),{'body':_[_0x6726('0x2b')](_0x497d49,{'project_name':_0x497d49[_0x6726('0x2c')],'prev_project_name':_0x497d49[_0x6726('0x2d')]||'','is_subproject':_0x497d49['arg_2']?!![]:![],'leaveAt':moment()[_0x6726('0x2e')](_0x6726('0x2f'))})});};exports[_0x6726('0x30')]=function(_0x4947f2){return request(_0x6726('0x31'),{'body':_0x4947f2});};exports['createSquareMessage']=function(_0x4fd2fd){return request('CreateSquareMessage',{'body':_0x4fd2fd});};exports[_0x6726('0x32')]=function(_0x24b355){return request(_0x6726('0x33'),{'options':{'raw':![],'where':{'phone':_0x24b355[_0x6726('0x1c')],'ListId':_0x24b355['ListId']}}})[_0x6726('0x34')](function(_0x119cb0){if(_0x119cb0){return _0x119cb0;}return request(_0x6726('0x35'),{'body':_0x24b355});});};exports['getPauseById']=function(_0x4196e7){return request(_0x6726('0x36'),{'options':{'where':{'id':_0x4196e7},'attributes':['name']}});};exports[_0x6726('0x37')]=function(_0x1d2eeb,_0x385bda){return request(_0x6726('0x38'),{'body':{'interface':_0x385bda},'options':{'where':_0x1d2eeb}});};exports[_0x6726('0x39')]=function(_0x1b498a,_0x1a0453,_0x4a3cf){return request('PauseUser',{'body':{'type':_0x1a0453,'uniqueid':_0x4a3cf},'options':{'where':_0x1b498a}});};exports[_0x6726('0x3a')]=function(_0x12c705){return request(_0x6726('0x3b'),{'body':{},'options':{'where':_0x12c705}});};exports[_0x6726('0x3c')]=function(_0x3af1e0){return request(_0x6726('0x3d'),{'body':{},'options':{'where':_0x3af1e0}});}; \ 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 801e1ff..c5b4c0f 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 _0x522b=['./lex','./polly'];(function(_0x34a7ac,_0x149f34){var _0x495131=function(_0x2d6646){while(--_0x2d6646){_0x34a7ac['push'](_0x34a7ac['shift']());}};_0x495131(++_0x149f34);}(_0x522b,0x1c3));var _0xb522=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0x522b[_0x3042c5];return _0x7cd140;};var polly=require(_0xb522('0x0'));var lex=require(_0xb522('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x9f7a=['exports','./polly','./lex'];(function(_0x23ba2e,_0x52664b){var _0x30ffd6=function(_0x5e1a60){while(--_0x5e1a60){_0x23ba2e['push'](_0x23ba2e['shift']());}};_0x30ffd6(++_0x52664b);}(_0x9f7a,0xf1));var _0xa9f7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9f7a[_0x20a584];return _0x4b41a8;};var polly=require(_0xa9f7('0x0'));var lex=require(_0xa9f7('0x1'));module[_0xa9f7('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 3ab5abf..1273693 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 _0x3c81=['./lib/api','exports'];(function(_0x3e2112,_0x5162f4){var _0x7739f0=function(_0x5bd737){while(--_0x5bd737){_0x3e2112['push'](_0x3e2112['shift']());}};_0x7739f0(++_0x5162f4);}(_0x3c81,0x102));var _0x13c8=function(_0x490b72,_0x16cf52){_0x490b72=_0x490b72-0x0;var _0x5bfae2=_0x3c81[_0x490b72];return _0x5bfae2;};'use strict';var lex=require(_0x13c8('0x0'));module[_0x13c8('0x1')]=function(_0x48c35b,_0x252f26,_0x131d0b,_0x4954c2,_0x5913e9,_0x5c3ba4){return lex(_0x48c35b,_0x252f26,_0x131d0b,_0x4954c2,_0x5913e9,_0x5c3ba4);}; \ No newline at end of file +'use strict';var lex=require('./lib/api');module['exports']=function(_0x3d5d4e,_0x33a55d,_0x5527b3,_0x175deb,_0xd002ca,_0x200b2a){return lex(_0x3d5d4e,_0x33a55d,_0x5527b3,_0x175deb,_0xd002ca,_0x200b2a);}; \ 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 e97802d..dcda20b 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(_0x570b1e,_0x13b520){var _0x5c68e8=function(_0xecaeb2){while(--_0xecaeb2){_0x570b1e['push'](_0x570b1e['shift']());}};_0x5c68e8(++_0x13b520);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x465da3,_0x41a4fd){var _0x4433a7=function(_0xb51bdb){while(--_0xb51bdb){_0x465da3['push'](_0x465da3['shift']());}};_0x4433a7(++_0x41a4fd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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 74f628c..d641ee4 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 _0xead6=['exports','./lib/api'];(function(_0x1f9000,_0x38d4fa){var _0x278cc0=function(_0x5f0471){while(--_0x5f0471){_0x1f9000['push'](_0x1f9000['shift']());}};_0x278cc0(++_0x38d4fa);}(_0xead6,0x1bf));var _0x6ead=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xead6[_0x167cc1];return _0x10bc4b;};'use strict';var polly=require(_0x6ead('0x0'));module[_0x6ead('0x1')]=function(_0x41dad1,_0x58a053,_0x4ecb9b,_0x43c531,_0x9f5966,_0x2f7f24,_0x1ce6a2){return polly(_0x41dad1,_0x58a053,_0x4ecb9b,_0x43c531,_0x9f5966,_0x2f7f24,_0x1ce6a2);}; \ No newline at end of file +var _0xf735=['exports'];(function(_0x5e6b1a,_0x51c018){var _0x3f4685=function(_0x16314f){while(--_0x16314f){_0x5e6b1a['push'](_0x5e6b1a['shift']());}};_0x3f4685(++_0x51c018);}(_0xf735,0x16b));var _0x5f73=function(_0x574377,_0x31b73c){_0x574377=_0x574377-0x0;var _0x2da9f7=_0xf735[_0x574377];return _0x2da9f7;};'use strict';var polly=require('./lib/api');module[_0x5f73('0x0')]=function(_0xcbb9e7,_0x22c825,_0x29312c,_0x37eedd,_0x418bd9,_0x55a94a,_0x30f5f7){return polly(_0xcbb9e7,_0x22c825,_0x29312c,_0x37eedd,_0x418bd9,_0x55a94a,_0x30f5f7);}; \ 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 46c6674..45607ce 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 _0x5261=['path','bluebird','aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3'];(function(_0x1912d1,_0x7a9271){var _0x1abee7=function(_0x5649cb){while(--_0x5649cb){_0x1912d1['push'](_0x1912d1['shift']());}};_0x1abee7(++_0x7a9271);}(_0x5261,0x122));var _0x1526=function(_0x2a6c96,_0x5cfd87){_0x2a6c96=_0x2a6c96-0x0;var _0x5531c6=_0x5261[_0x2a6c96];return _0x5531c6;};'use strict';var fs=require('fs');var path=require(_0x1526('0x0'));var BPromise=require(_0x1526('0x1'));var rs=require('randomstring');var AWS=require(_0x1526('0x2'));function pollyResult(_0x406dcb,_0x3c1a00,_0x5017e6){return new BPromise(function(_0x467cd4,_0x34141d){_0x406dcb[_0x1526('0x3')](_0x3c1a00,function(_0x237784,_0x380afe){if(_0x237784){_0x34141d(_0x237784);}else if(_0x380afe){if(_0x380afe['AudioStream']instanceof Buffer){fs[_0x1526('0x4')](_0x5017e6,_0x380afe[_0x1526('0x5')],function(_0x57cf66){if(_0x57cf66){_0x34141d(_0x57cf66);}else{_0x467cd4();}});}else{_0x34141d(new Error(_0x1526('0x6')));}}else{_0x34141d(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0x54211c,_0x5a5836,_0x11cf7b,_0x3f7067,_0xb917b7,_0xbb8736,_0x50e0f4){var _0x329b37=new AWS[(_0x1526('0x7'))]({'accessKeyId':_0x54211c,'secretAccessKey':_0x5a5836,'region':_0x11cf7b});var _0x3e078b={'Text':_0xb917b7,'TextType':_0xbb8736||_0x1526('0x8'),'OutputFormat':_0x1526('0x9'),'VoiceId':_0x3f7067};return pollyResult(_0x329b37,_0x3e078b,_0x50e0f4);}; \ No newline at end of file +var _0x9c28=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x37a9b0,_0x2d24b2){var _0x286c4e=function(_0x24051c){while(--_0x24051c){_0x37a9b0['push'](_0x37a9b0['shift']());}};_0x286c4e(++_0x2d24b2);}(_0x9c28,0x1f1));var _0x89c2=function(_0x117b72,_0x29ca62){_0x117b72=_0x117b72-0x0;var _0x4b2b75=_0x9c28[_0x117b72];return _0x4b2b75;};'use strict';var fs=require('fs');var path=require(_0x89c2('0x0'));var BPromise=require(_0x89c2('0x1'));var rs=require(_0x89c2('0x2'));var AWS=require(_0x89c2('0x3'));function pollyResult(_0x182e87,_0x2c6405,_0x5975db){return new BPromise(function(_0x1cf1e1,_0xa2e58){_0x182e87[_0x89c2('0x4')](_0x2c6405,function(_0x2a1b62,_0x1af10a){if(_0x2a1b62){_0xa2e58(_0x2a1b62);}else if(_0x1af10a){if(_0x1af10a[_0x89c2('0x5')]instanceof Buffer){fs['writeFile'](_0x5975db,_0x1af10a[_0x89c2('0x5')],function(_0x23c479){if(_0x23c479){_0xa2e58(_0x23c479);}else{_0x1cf1e1();}});}else{_0xa2e58(new Error(_0x89c2('0x6')));}}else{_0xa2e58(new Error(_0x89c2('0x7')));}});});}module[_0x89c2('0x8')]=function(_0x3650e1,_0x27bee6,_0x3928e0,_0x48dbcc,_0x1a8215,_0x1371ef,_0x5264c2){var _0x5d7f13=new AWS[(_0x89c2('0x9'))]({'accessKeyId':_0x3650e1,'secretAccessKey':_0x27bee6,'region':_0x3928e0});var _0x4639c0={'Text':_0x1a8215,'TextType':_0x1371ef||_0x89c2('0xa'),'OutputFormat':_0x89c2('0xb'),'VoiceId':_0x48dbcc};return pollyResult(_0x5d7f13,_0x4639c0,_0x5264c2);}; \ 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 d560a06..5ef7862 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 _0xf5f2=['./lib/api','exports'];(function(_0x2804e9,_0xb73a2f){var _0x28fa14=function(_0x2fbe97){while(--_0x2fbe97){_0x2804e9['push'](_0x2804e9['shift']());}};_0x28fa14(++_0xb73a2f);}(_0xf5f2,0x1a6));var _0x2f5f=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xf5f2[_0x13b02f];return _0x12e9a6;};'use strict';var asr=require(_0x2f5f('0x0'));module[_0x2f5f('0x1')]=function(_0x2cd894,_0x46875f,_0x1a3365,_0x4782e0){return asr(_0x2cd894,_0x46875f,_0x1a3365);}; \ No newline at end of file +var _0xde0f=['./lib/api'];(function(_0x249a69,_0xf19c86){var _0x701c8c=function(_0x462153){while(--_0x462153){_0x249a69['push'](_0x249a69['shift']());}};_0x701c8c(++_0xf19c86);}(_0xde0f,0x1eb));var _0xfde0=function(_0x1d0a12,_0x549890){_0x1d0a12=_0x1d0a12-0x0;var _0x1d5c77=_0xde0f[_0x1d0a12];return _0x1d5c77;};'use strict';var asr=require(_0xfde0('0x0'));module['exports']=function(_0x2959c9,_0x165e52,_0x1a71d6,_0x7ec296){return asr(_0x2959c9,_0x165e52,_0x1a71d6);}; \ 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 e48a9cd..fdcfbcf 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 _0x87ae=['toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','https://speech.googleapis.com','string','length','key\x20should\x20be\x20a\x20string','readFileSync'];(function(_0x442c61,_0x10fcba){var _0x449111=function(_0x2923c6){while(--_0x2923c6){_0x442c61['push'](_0x442c61['shift']());}};_0x449111(++_0x10fcba);}(_0x87ae,0xf5));var _0xe87a=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x87ae[_0xc0a3d3];return _0x3386e8;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0xe87a('0x0');module['exports']=function(_0x4ab66a,_0x2241d2,_0x44fc79){return new BPromise(function(_0x404a0a,_0x5a55b8){var _0x28899c;if(typeof _0x4ab66a!==_0xe87a('0x1')||_0x4ab66a[_0xe87a('0x2')]===0x0){return _0x5a55b8('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x2241d2!=='string'||_0x2241d2[_0xe87a('0x2')]===0x0){return _0x5a55b8(_0xe87a('0x3'));}if(typeof _0x44fc79!=='undefined'&&(typeof _0x44fc79!==_0xe87a('0x1')||_0x44fc79[_0xe87a('0x2')]===0x0)){return _0x5a55b8('lang\x20should\x20be\x20a\x20string');}try{_0x28899c=fs[_0xe87a('0x4')](_0x4ab66a)[_0xe87a('0x5')]('base64');}catch(_0x18cf9d){return _0x5a55b8(_0x18cf9d);}return _0x404a0a({'method':_0xe87a('0x6'),'uri':host+_0xe87a('0x7')+_0x2241d2,'body':{'config':{'encoding':_0xe87a('0x8'),'sampleRateHertz':_0xe87a('0x9'),'languageCode':_0x44fc79},'audio':{'content':_0x28899c}},'json':!![]});});}; \ No newline at end of file +var _0xa1fd=['key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string'];(function(_0x5e2cb4,_0x592c64){var _0x282902=function(_0x1c1836){while(--_0x1c1836){_0x5e2cb4['push'](_0x5e2cb4['shift']());}};_0x282902(++_0x592c64);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x430205,_0x328c94){_0x430205=_0x430205-0x0;var _0x3f5146=_0xa1fd[_0x430205];return _0x3f5146;};'use strict';var url=require(_0xda1f('0x0'));var BPromise=require(_0xda1f('0x1'));var fs=require('fs');var host=_0xda1f('0x2');module[_0xda1f('0x3')]=function(_0x595195,_0x221036,_0xafa72c){return new BPromise(function(_0x2ce9f4,_0x46b451){var _0x3f58af;if(typeof _0x595195!=='string'||_0x595195[_0xda1f('0x4')]===0x0){return _0x46b451(_0xda1f('0x5'));}if(typeof _0x221036!==_0xda1f('0x6')||_0x221036['length']===0x0){return _0x46b451(_0xda1f('0x7'));}if(typeof _0xafa72c!==_0xda1f('0x8')&&(typeof _0xafa72c!==_0xda1f('0x6')||_0xafa72c[_0xda1f('0x4')]===0x0)){return _0x46b451(_0xda1f('0x9'));}try{_0x3f58af=fs[_0xda1f('0xa')](_0x595195)[_0xda1f('0xb')](_0xda1f('0xc'));}catch(_0x13467c){return _0x46b451(_0x13467c);}return _0x2ce9f4({'method':'POST','uri':host+_0xda1f('0xd')+_0x221036,'body':{'config':{'encoding':_0xda1f('0xe'),'sampleRateHertz':_0xda1f('0xf'),'languageCode':_0xafa72c},'audio':{'content':_0x3f58af}},'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 30db066..64c8aad 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 _0x3393=['./asr','exports'];(function(_0x305cd9,_0x1df90a){var _0x2a20a9=function(_0x37cf24){while(--_0x37cf24){_0x305cd9['push'](_0x305cd9['shift']());}};_0x2a20a9(++_0x1df90a);}(_0x3393,0x1ca));var _0x3339=function(_0x2d8fc4,_0x2a3a7c){_0x2d8fc4=_0x2d8fc4-0x0;var _0xbbe642=_0x3393[_0x2d8fc4];return _0xbbe642;};var asr=require(_0x3339('0x0'));module[_0x3339('0x1')]={'asr':asr}; \ No newline at end of file +var _0xbeca=['./asr','exports'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xbeca,0xc6));var _0xabec=function(_0x3a2225,_0xb6600){_0x3a2225=_0x3a2225-0x0;var _0x5c8040=_0xbeca[_0x3a2225];return _0x5c8040;};var asr=require(_0xabec('0x0'));module[_0xabec('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index c8e20a9..7c85d92 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 _0x618d=['actionIncomplete','fulfillment','speech','score','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','queryText','asr','Tilde\x20ASR\x20transcription','transcript','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','format','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','querystring','request-promise','randomstring','sox','google-tts-api','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','error','download\x20error','pipe','end','data','transcode','wav','info','start','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','toString','googleCloudTTS','?key=','input','audioConfig','MP3','text:synthesize','POST','resolve','from','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','slice','length','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','.mp3','unlink','goggleTTS\x20path','googleASR','results','map','alternatives','join','confidence','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source'];(function(_0x347471,_0x1c9a02){var _0x422b6a=function(_0x2b6f88){while(--_0x2b6f88){_0x347471['push'](_0x347471['shift']());}};_0x422b6a(++_0x1c9a02);}(_0x618d,0x13b));var _0xd618=function(_0x526fb1,_0x429960){_0x526fb1=_0x526fb1-0x0;var _0x167b6a=_0x618d[_0x526fb1];return _0x167b6a;};'use strict';var apiai=require(_0xd618('0x0'));var BPromise=require(_0xd618('0x1'));var dialogflow=require(_0xd618('0x2'));var fs=require('fs');var http=require(_0xd618('0x3'));var https=require(_0xd618('0x4'));var md5=require(_0xd618('0x5'));var path=require('path');var querystring=require(_0xd618('0x6'));var rp=require(_0xd618('0x7'));var rs=require(_0xd618('0x8'));var sox=require(_0xd618('0x9'));var tts=require(_0xd618('0xa'));var urlParse=require('url')['parse'];var util=require(_0xd618('0xb'));var aws=require(_0xd618('0xc'));var google=require(_0xd618('0xd'));var sestek=require(_0xd618('0xe'));var tilde=require('./tilde');var logger=require(_0xd618('0xf'))(_0xd618('0x10'));var ISPEECH_API=_0xd618('0x11');function downloadFile(_0x148231,_0x387a42){return new BPromise(function(_0xac0ed5,_0x1f23ba){var _0x52bb89=urlParse(_0x148231);var _0x44c970=_0x52bb89[_0xd618('0x12')]===_0xd618('0x13')?https:http;var _0xd886fb={'host':_0x52bb89[_0xd618('0x14')],'path':_0x52bb89[_0xd618('0x15')],'headers':{'user-agent':_0xd618('0x16')}};_0x44c970[_0xd618('0x17')](_0xd886fb,function(_0x48d226){if(_0x48d226[_0xd618('0x18')]!==0xc8){logger['error'](_0xd618('0x19')+_0x148231+_0xd618('0x1a')+_0x48d226[_0xd618('0x18')]+'\x20('+_0x48d226['statusMessage']+')');_0x1f23ba(new Error(_0xd618('0x19')+_0x148231+'\x20failed,\x20status\x20code\x20=\x20'+_0x48d226[_0xd618('0x18')]+'\x20('+_0x48d226[_0xd618('0x1b')]+')'));return;}var _0x3eb002=fs[_0xd618('0x1c')](_0x387a42);_0x3eb002['on'](_0xd618('0x1d'),function(){logger['info'](_0xd618('0x1e'));_0x3eb002[_0xd618('0x1f')](_0xac0ed5);});_0x3eb002['on'](_0xd618('0x20'),function(_0x18813f){fs['unlink'](_0x387a42);logger[_0xd618('0x20')](_0xd618('0x21'),_0x18813f);_0x1f23ba(_0x18813f);});_0x48d226[_0xd618('0x22')](_0x3eb002);})['on'](_0xd618('0x20'),function(_0x3843ed){logger['error'](_0x3843ed);_0x1f23ba(_0x3843ed);})[_0xd618('0x23')]();});}function uploadFile(_0x34a328){return new BPromise(function(_0x2813ee,_0x435ada){var _0xb5b756=urlParse(_0x34a328);var _0x2ba1fd=_0xb5b756[_0xd618('0x12')]===_0xd618('0x13')?https:http;var _0x33b994={'host':_0xb5b756[_0xd618('0x14')],'path':_0xb5b756[_0xd618('0x15')],'headers':{'user-agent':_0xd618('0x16')}};_0x2ba1fd[_0xd618('0x17')](_0x33b994,function(_0x4fa79a){if(_0x4fa79a['statusCode']!==0xc8){_0x435ada(new Error(_0xd618('0x19')+_0x34a328+_0xd618('0x1a')+_0x4fa79a[_0xd618('0x18')]+'\x20('+_0x4fa79a[_0xd618('0x1b')]+')'));return;}var _0x4ec416='';_0x4fa79a['on'](_0xd618('0x24'),function(_0x2ffd00){_0x4ec416+=_0x2ffd00;});_0x4fa79a['on']('end',function(){_0x2813ee(_0x4ec416);});})['on'](_0xd618('0x20'),function(_0x3dbaa5){_0x435ada(_0x3dbaa5);})[_0xd618('0x23')]();});}function convertFile(_0x17f71d,_0x39486a){return new BPromise(function(_0x1feac7,_0x2a7aa3){var _0x51479b=sox[_0xd618('0x25')](_0x17f71d,_0x39486a,{'sampleRate':0x1f40,'format':_0xd618('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x51479b['on']('error',function(_0x784298){logger['error']('error\x20convert',_0x784298);_0x2a7aa3(_0x784298);});_0x51479b['on']('end',function(){logger[_0xd618('0x27')]('finish\x20to\x20convert');_0x1feac7();});_0x51479b[_0xd618('0x28')]();});}function base64Decode(_0x52bb9e,_0x567f69){var _0x2288e1=path['resolve'](__dirname,_0xd618('0x29'),rs[_0xd618('0x2a')](0x4)+_0xd618('0x2b'));fs[_0xd618('0x2c')](_0x2288e1,_0x52bb9e,_0xd618('0x2d'));return convertFile(_0x2288e1,_0x567f69)[_0xd618('0x2e')](function(){try{fs['unlink'](_0x2288e1);fs[_0xd618('0x2f')](_0x567f69,_0xd618('0x30'));}catch(_0x47893d){logger[_0xd618('0x20')](_0x47893d);}return _0x567f69[_0xd618('0x31')]('.')[0x0];});}function base64Encode(_0x41bd40){var _0x1b70c9=fs['readFileSync'](_0x41bd40);return new Buffer(_0x1b70c9)[_0xd618('0x32')](_0xd618('0x2d'));}exports[_0xd618('0x33')]=function(_0x13e72c,_0xb8d406,_0x420805,_0x26f21a,_0x2dda8b,_0x291c75){var _0x438087,_0x332820;var _0x6d7ef9='https://texttospeech.googleapis.com/v1/';var _0x2e19ef=_0xd618('0x34')+_0x13e72c;var _0x113776={};if(_0xb8d406==='ssml'){_0x113776[_0xd618('0x35')]={'ssml':_0x420805};}else{_0x113776[_0xd618('0x35')]={'text':_0x420805};};_0x113776['voice']={'languageCode':_0x26f21a,'ssmlGender':_0x2dda8b};_0x113776[_0xd618('0x36')]={'audioEncoding':_0xd618('0x37'),'sampleRateHertz':0x1f40};var _0x2967ac={'url':_0x6d7ef9+_0xd618('0x38')+_0x2e19ef,'method':_0xd618('0x39'),'json':!![],'body':_0x113776};return rp(_0x2967ac)['then'](function(_0x10a587){return new BPromise(function(_0x4df0b1,_0x3f3b2c){_0x438087=path[_0xd618('0x3a')](__dirname,'tmp',rs[_0xd618('0x2a')](0x4)+'.mp3');var _0x179d7c=Buffer[_0xd618('0x3b')](_0x10a587['audioContent'],'base64');return fs['writeFile'](_0x438087,_0x179d7c,function(_0x4e9dc4){_0x3f3b2c(_0x4e9dc4);},function(_0x1ef28f){fs[_0xd618('0x2f')](_0x438087,_0xd618('0x30'));_0x4df0b1(_0x1ef28f);});});})[_0xd618('0x2e')](function(_0x586e02){_0x332820=path[_0xd618('0x3a')](__dirname,_0xd618('0x29'),rs[_0xd618('0x2a')](0x4)+_0xd618('0x2b'));return convertFile(_0x438087,_0x332820);})['then'](function(){try{fs['unlink'](_0x438087);fs[_0xd618('0x2f')](_0x332820,_0xd618('0x30'));}catch(_0x501187){logger[_0xd618('0x20')](_0x501187);}logger['info'](_0xd618('0x3c'),_0x332820[_0xd618('0x31')]('.')[0x0]);return _0x332820[_0xd618('0x31')]('.')[0x0];});};exports['googleTTS']=function(_0x2f438a,_0x5a5715){var _0x3c5064=_0xd618('0x3d');var _0x496016,_0x52c4e1;var _0x5b857d;var _0x2cf48f={'encoding':'utf8','method':_0xd618('0x39'),'timeout':0x2710,'url':_0x3c5064,'headers':{'Content-Type':_0xd618('0x3e')},'body':_0xd618('0x3f')+encodeURIComponent(JSON[_0xd618('0x40')]([[[_0xd618('0x41'),JSON['stringify']([_0x2f438a,_0x5a5715||'en',![],_0xd618('0x42')]),null,'generic']]]))};return rp(_0x2cf48f)[_0xd618('0x2e')](function(_0x38e0fb){try{_0x5b857d=eval(_0x38e0fb[_0xd618('0x43')](0x5))[0x0][0x2];}catch(_0x3b8292){throw new Error('parse\x20response\x20failed:\x0a'+_0x38e0fb[_0xd618('0x24')]);}if(!_0x5b857d){if(_0x2f438a[_0xd618('0x44')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xd618('0x45')+_0x5a5715+_0xd618('0x46'));}}try{_0x5b857d=eval(_0x5b857d)[0x0];}catch(_0x1a447a){throw new Error(_0xd618('0x47')+res[_0xd618('0x24')]);}const _0x41fc39=_0x5b857d;_0x496016=path['resolve'](__dirname,_0xd618('0x29'),rs[_0xd618('0x2a')](0x4)+_0xd618('0x48'));fs[_0xd618('0x2c')](_0x496016,_0x5b857d,{'encoding':_0xd618('0x2d')});_0x52c4e1=path['resolve'](__dirname,_0xd618('0x29'),rs[_0xd618('0x2a')](0x4)+'.wav');return convertFile(_0x496016,_0x52c4e1);})[_0xd618('0x2e')](function(){try{fs[_0xd618('0x49')](_0x496016);fs[_0xd618('0x2f')](_0x52c4e1,_0xd618('0x30'));}catch(_0x1f6aa8){logger[_0xd618('0x20')](_0x1f6aa8);}logger[_0xd618('0x27')](_0xd618('0x4a'),_0x52c4e1[_0xd618('0x31')]('.')[0x0]);return _0x52c4e1[_0xd618('0x31')]('.')[0x0];});};exports[_0xd618('0x4b')]=function(_0x205aad,_0x223818,_0x19aa80){return google['asr'](_0x205aad,_0x223818,_0x19aa80)[_0xd618('0x2e')](function(_0xf24b63){logger[_0xd618('0x27')](_0xf24b63['uri']);return rp(_0xf24b63);})[_0xd618('0x2e')](function(_0x21893e){var _0x25b03d='';var _0x46f6a2=0x0;try{fs[_0xd618('0x49')](_0x205aad);}catch(_0x4ad40e){logger[_0xd618('0x20')](_0x4ad40e);}if(_0x21893e&&_0x21893e[_0xd618('0x4c')]){_0x25b03d=_0x21893e['results'][_0xd618('0x4d')](function(_0x399444){return _0x399444&&_0x399444[_0xd618('0x4e')][0x0]&&_0x399444[_0xd618('0x4e')][0x0]['transcript']?_0x399444[_0xd618('0x4e')][0x0]['transcript']:'';})[_0xd618('0x4f')]('\x0a');_0x46f6a2=_0x21893e[_0xd618('0x4c')][_0xd618('0x4d')](function(_0x43a335){return _0x43a335&&_0x43a335['alternatives'][0x0]&&_0x43a335[_0xd618('0x4e')][0x0][_0xd618('0x50')]?_0x43a335[_0xd618('0x4e')][0x0]['confidence']:0x0;})[_0xd618('0x4f')]('\x0a');}logger[_0xd618('0x27')](_0xd618('0x51'),_0x25b03d);logger[_0xd618('0x27')](_0xd618('0x52'),_0x46f6a2);return{'transcript':_0x25b03d,'confidence':_0x46f6a2};})['catch'](function(_0xa86f1a){logger[_0xd618('0x20')](_0xd618('0x53'),_0xa86f1a[_0xd618('0x18')],_0xa86f1a[_0xd618('0x54')],_0xa86f1a[_0xd618('0x55')]);});};exports[_0xd618('0x56')]=function(_0x2758d3,_0x46cda1,_0x4fc82d,_0x942e85){var _0x5c7776=apiai(_0x46cda1,{'language':_0x942e85||'en'});return _0x5c7776[_0xd618('0x57')](_0x4fc82d,{'sessionId':md5(_0x2758d3)})[_0xd618('0x2e')](function(_0x2a649a){logger[_0xd618('0x27')](JSON['stringify'](_0x2a649a));return{'source':_0x2a649a[_0xd618('0x58')][_0xd618('0x59')],'resolvedQuery':_0x2a649a[_0xd618('0x58')]['resolvedQuery'],'action':_0x2a649a['result']['action'],'actionIncomplete':_0x2a649a['result'][_0xd618('0x5a')],'speech':_0x2a649a[_0xd618('0x58')][_0xd618('0x5b')][_0xd618('0x5c')],'score':_0x2a649a[_0xd618('0x58')][_0xd618('0x5d')],'statusCode':_0x2a649a[_0xd618('0x5e')]['code'],'endConversation':_0x2a649a[_0xd618('0x58')][_0xd618('0x5f')][_0xd618('0x60')]||![],'isFallbackIntent':_0x2a649a[_0xd618('0x58')]['metadata'][_0xd618('0x61')]};});};exports[_0xd618('0x62')]=function(_0x6372e3,_0x3afca7,_0x1dc47d,_0x3dd44d,_0x2887f0,_0x1c04a4){var _0x351cc1=_0x3dd44d[_0xd618('0x63')](/\\n/g,'\x0a');var _0x4bc6f8={'credentials':{'private_key':_0x351cc1,'client_email':_0x1dc47d}};var _0x5414aa=new dialogflow[(_0xd618('0x64'))](_0x4bc6f8);var _0x16c1ac=_0x5414aa[_0xd618('0x65')](_0x3afca7,md5(_0x6372e3));var _0x45381a={'session':_0x16c1ac,'queryInput':{'text':{'text':_0x2887f0,'languageCode':_0x1c04a4}}};return _0x5414aa['detectIntent'](_0x45381a)[_0xd618('0x2e')](function(_0x137204){if(_0x137204&&_0x137204[_0xd618('0x44')]){logger[_0xd618('0x27')](_0xd618('0x66'),JSON[_0xd618('0x40')](_0x137204));var _0x3249bb=_0x137204[0x0];if(_0x3249bb){var _0x13c861={'action':_0x3249bb[_0xd618('0x67')]['action'],'allRequiredParamsPresent':_0x3249bb[_0xd618('0x67')]['allRequiredParamsPresent'],'endConversation':_0x3249bb[_0xd618('0x67')][_0xd618('0x68')]&&_0x3249bb[_0xd618('0x67')][_0xd618('0x68')]['fields']?_0x3249bb[_0xd618('0x67')][_0xd618('0x68')][_0xd618('0x69')][_0xd618('0x6a')][_0xd618('0x6b')]:![],'fulfillmentText':_0x3249bb[_0xd618('0x67')][_0xd618('0x6c')],'intentName':_0x3249bb[_0xd618('0x67')][_0xd618('0x6d')][_0xd618('0x54')],'intentDisplayName':_0x3249bb[_0xd618('0x67')][_0xd618('0x6d')][_0xd618('0x6e')],'isFallbackIntent':_0x3249bb[_0xd618('0x67')][_0xd618('0x6d')]['isFallback'],'languageCode':_0x3249bb[_0xd618('0x67')]['languageCode'],'queryText':_0x3249bb[_0xd618('0x67')][_0xd618('0x6f')],'responseId':_0x3249bb['responseId'],'score':_0x3249bb[_0xd618('0x67')]['intentDetectionConfidence'],'speech':_0x3249bb[_0xd618('0x67')][_0xd618('0x6c')],'providerResponse':JSON[_0xd618('0x40')](_0x137204)};return _0x13c861;}}});};exports['tildeASR']=function(_0x297b5a,_0x396107,_0x53ba47,_0x5b05bb){return tilde[_0xd618('0x70')](_0x297b5a,_0x396107,_0x53ba47,_0x5b05bb)[_0xd618('0x2e')](function(_0x393c81){try{fs[_0xd618('0x49')](_0x297b5a);}catch(_0x2922e9){logger[_0xd618('0x20')](_0x2922e9);}logger['info'](_0xd618('0x71'),_0x393c81[_0xd618('0x72')]);logger[_0xd618('0x27')](_0xd618('0x73'),_0x393c81['confidence']);return _0x393c81;});};exports['awsPolly']=function(_0x4e98b5,_0xb06150,_0x53591f,_0x183ad2,_0x247491,_0x16da58){var _0x10a82e=path[_0xd618('0x3a')](__dirname,_0xd618('0x29'),rs[_0xd618('0x2a')](0x4)+_0xd618('0x48'));var _0x542d29;return aws[_0xd618('0x74')](_0x4e98b5,_0xb06150,_0x53591f,_0x183ad2,_0x247491,_0x16da58,_0x10a82e)[_0xd618('0x2e')](function(){_0x542d29=path[_0xd618('0x3a')](__dirname,_0xd618('0x29'),rs[_0xd618('0x2a')](0x4)+_0xd618('0x2b'));return convertFile(_0x10a82e,_0x542d29);})['then'](function(){try{fs[_0xd618('0x49')](_0x10a82e);fs[_0xd618('0x2f')](_0x542d29,_0xd618('0x30'));}catch(_0x421699){logger[_0xd618('0x20')](_0x421699);}return _0x542d29['split']('.')[0x0];});};exports[_0xd618('0x75')]=function(_0x2449e4,_0x547bc4,_0x318366,_0x21f55a,_0x1207f8,_0x5181a4){return aws[_0xd618('0x76')](_0x2449e4,_0x547bc4,_0x318366,_0x21f55a,_0x1207f8,_0x5181a4)[_0xd618('0x2e')](function(_0x27f222){logger[_0xd618('0x27')](JSON[_0xd618('0x40')](_0x27f222));return _0x27f222;});};exports[_0xd618('0x77')]=function(_0x270851,_0x36135e,_0x5eae71,_0x50e157){var _0x4f42b2=util['format'](_0xd618('0x78'),ISPEECH_API,_0x270851,encodeURIComponent(_0x36135e),_0x5eae71,_0x50e157);var _0x5e2c36=path[_0xd618('0x3a')](__dirname,_0xd618('0x29'),rs[_0xd618('0x2a')](0x4)+_0xd618('0x48'));var _0x557fca;return downloadFile(_0x4f42b2,_0x5e2c36)[_0xd618('0x2e')](function(){_0x557fca=path['resolve'](__dirname,_0xd618('0x29'),rs[_0xd618('0x2a')](0x4)+_0xd618('0x2b'));return convertFile(_0x5e2c36,_0x557fca);})[_0xd618('0x2e')](function(){try{fs[_0xd618('0x49')](_0x5e2c36);fs[_0xd618('0x2f')](_0x557fca,_0xd618('0x30'));}catch(_0x5cc20e){logger[_0xd618('0x20')](_0x5cc20e);}return _0x557fca[_0xd618('0x31')]('.')[0x0];});};exports['ispeechASR']=function(_0x155e3e,_0x5aa750,_0x13bfee,_0x2989ea){var _0x21a44d=util[_0xd618('0x79')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x5aa750,_0x13bfee,base64Encode(_0x155e3e),_0x2989ea?util[_0xd618('0x79')](_0xd618('0x7a'),encodeURIComponent(_0x2989ea)):_0xd618('0x7b'));return uploadFile(_0x21a44d)[_0xd618('0x2e')](function(_0x5d4fb7){return querystring[_0xd618('0x7c')](_0x5d4fb7);});};exports[_0xd618('0x7d')]=function(_0x19925b,_0x3cc854){return sestek[_0xd618('0x7e')](_0x19925b,_0x3cc854)['then'](function(_0xaac804){logger['info'](JSON[_0xd618('0x40')](_0xaac804));var _0x2044b5={'speech':_0xaac804[_0xd618('0x7f')],'action':_0xaac804[_0xd618('0x80')]?_0xaac804[_0xd618('0x80')][_0xd618('0x81')]:undefined,'actiondata':_0xaac804[_0xd618('0x80')]?_0xaac804['channelData'][_0xd618('0x82')]:undefined};if(_0xaac804[_0xd618('0x80')]&&_0xaac804[_0xd618('0x80')][_0xd618('0x83')]){return base64Decode(_0xaac804['channelData']['AudioFromTts'][_0xd618('0x84')],path[_0xd618('0x3a')](__dirname,_0xd618('0x29'),rs[_0xd618('0x2a')](0x4)+_0xd618('0x2b')))['then'](function(_0x5046d7){_0x2044b5[_0xd618('0x85')]=_0x5046d7;return _0x2044b5;});}return _0x2044b5;});};exports[_0xd618('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0x7136=['https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','generate','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','POST','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','writeFileSync','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','result','source','action','actionIncomplete','speech','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','dirName','apiai-promise','bluebird','dialogflow','http','https','path','querystring','request-promise','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','https:','WHAT_EVER','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','unlink','pipe','end','protocol','host','get','data','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','.wav','then','chmodSync','777','split','readFileSync','toString','base64','googleCloudTTS'];(function(_0x175964,_0x10ee4d){var _0x197cdb=function(_0x388369){while(--_0x388369){_0x175964['push'](_0x175964['shift']());}};_0x197cdb(++_0x10ee4d);}(_0x7136,0x1f2));var _0x6713=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0x7136[_0x40dd56];return _0x4f850f;};'use strict';var apiai=require(_0x6713('0x0'));var BPromise=require(_0x6713('0x1'));var dialogflow=require(_0x6713('0x2'));var fs=require('fs');var http=require(_0x6713('0x3'));var https=require(_0x6713('0x4'));var md5=require('md5');var path=require(_0x6713('0x5'));var querystring=require(_0x6713('0x6'));var rp=require(_0x6713('0x7'));var rs=require('randomstring');var sox=require('sox');var tts=require(_0x6713('0x8'));var urlParse=require(_0x6713('0x9'))[_0x6713('0xa')];var util=require(_0x6713('0xb'));var aws=require(_0x6713('0xc'));var google=require(_0x6713('0xd'));var sestek=require(_0x6713('0xe'));var tilde=require(_0x6713('0xf'));var logger=require(_0x6713('0x10'))('agi');var ISPEECH_API=_0x6713('0x11');function downloadFile(_0x23fef8,_0x284af5){return new BPromise(function(_0x4d4896,_0x1f72f3){var _0xc95056=urlParse(_0x23fef8);var _0x2aa716=_0xc95056['protocol']===_0x6713('0x12')?https:http;var _0x531e8b={'host':_0xc95056['host'],'path':_0xc95056['path'],'headers':{'user-agent':_0x6713('0x13')}};_0x2aa716['get'](_0x531e8b,function(_0x2b6854){if(_0x2b6854[_0x6713('0x14')]!==0xc8){logger[_0x6713('0x15')](_0x6713('0x16')+_0x23fef8+_0x6713('0x17')+_0x2b6854['statusCode']+'\x20('+_0x2b6854[_0x6713('0x18')]+')');_0x1f72f3(new Error(_0x6713('0x16')+_0x23fef8+_0x6713('0x17')+_0x2b6854[_0x6713('0x14')]+'\x20('+_0x2b6854[_0x6713('0x18')]+')'));return;}var _0x547ee8=fs['createWriteStream'](_0x284af5);_0x547ee8['on'](_0x6713('0x19'),function(){logger[_0x6713('0x1a')](_0x6713('0x1b'));_0x547ee8['close'](_0x4d4896);});_0x547ee8['on']('error',function(_0x4bf3d2){fs[_0x6713('0x1c')](_0x284af5);logger[_0x6713('0x15')]('download\x20error',_0x4bf3d2);_0x1f72f3(_0x4bf3d2);});_0x2b6854[_0x6713('0x1d')](_0x547ee8);})['on'](_0x6713('0x15'),function(_0x115e4b){logger['error'](_0x115e4b);_0x1f72f3(_0x115e4b);})[_0x6713('0x1e')]();});}function uploadFile(_0x285ba4){return new BPromise(function(_0x403b7d,_0x583427){var _0x4b4a68=urlParse(_0x285ba4);var _0x46853b=_0x4b4a68[_0x6713('0x1f')]==='https:'?https:http;var _0x49ac40={'host':_0x4b4a68[_0x6713('0x20')],'path':_0x4b4a68[_0x6713('0x5')],'headers':{'user-agent':_0x6713('0x13')}};_0x46853b[_0x6713('0x21')](_0x49ac40,function(_0x334a07){if(_0x334a07['statusCode']!==0xc8){_0x583427(new Error(_0x6713('0x16')+_0x285ba4+_0x6713('0x17')+_0x334a07['statusCode']+'\x20('+_0x334a07['statusMessage']+')'));return;}var _0x3ce26c='';_0x334a07['on'](_0x6713('0x22'),function(_0x3db7db){_0x3ce26c+=_0x3db7db;});_0x334a07['on'](_0x6713('0x1e'),function(){_0x403b7d(_0x3ce26c);});})['on']('error',function(_0x3e4e16){_0x583427(_0x3e4e16);})[_0x6713('0x1e')]();});}function convertFile(_0x1b94b1,_0x5e83e2){return new BPromise(function(_0x27057e,_0x1f2467){var _0x52fcdb=sox['transcode'](_0x1b94b1,_0x5e83e2,{'sampleRate':0x1f40,'format':_0x6713('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x52fcdb['on']('error',function(_0x5ef571){logger['error'](_0x6713('0x24'),_0x5ef571);_0x1f2467(_0x5ef571);});_0x52fcdb['on'](_0x6713('0x1e'),function(){logger[_0x6713('0x1a')](_0x6713('0x25'));_0x27057e();});_0x52fcdb[_0x6713('0x26')]();});}function base64Decode(_0x22953a,_0x2815ec){var _0x25528c=path[_0x6713('0x27')](__dirname,_0x6713('0x28'),rs['generate'](0x4)+_0x6713('0x29'));fs['writeFileSync'](_0x25528c,_0x22953a,'base64');return convertFile(_0x25528c,_0x2815ec)[_0x6713('0x2a')](function(){try{fs['unlink'](_0x25528c);fs[_0x6713('0x2b')](_0x2815ec,_0x6713('0x2c'));}catch(_0x52174c){logger[_0x6713('0x15')](_0x52174c);}return _0x2815ec[_0x6713('0x2d')]('.')[0x0];});}function base64Encode(_0x590c44){var _0x43fc68=fs[_0x6713('0x2e')](_0x590c44);return new Buffer(_0x43fc68)[_0x6713('0x2f')](_0x6713('0x30'));}exports[_0x6713('0x31')]=function(_0x45c81a,_0x1b9c35,_0x4472a4,_0x3941b8,_0x3699f5,_0x1e11a6){var _0x489538,_0x2027dc;var _0x282d1e=_0x6713('0x32');var _0x23421b=_0x6713('0x33')+_0x45c81a;var _0xaa09d1={};if(_0x1b9c35==='ssml'){_0xaa09d1[_0x6713('0x34')]={'ssml':_0x4472a4};}else{_0xaa09d1[_0x6713('0x34')]={'text':_0x4472a4};};_0xaa09d1[_0x6713('0x35')]={'languageCode':_0x3941b8,'ssmlGender':_0x3699f5};_0xaa09d1[_0x6713('0x36')]={'audioEncoding':_0x6713('0x37'),'sampleRateHertz':0x1f40};var _0x29ab5c={'url':_0x282d1e+_0x6713('0x38')+_0x23421b,'method':'POST','json':!![],'body':_0xaa09d1};return rp(_0x29ab5c)[_0x6713('0x2a')](function(_0x1d12f0){return new BPromise(function(_0x5d2304,_0x17e42d){_0x489538=path['resolve'](__dirname,'tmp',rs[_0x6713('0x39')](0x4)+_0x6713('0x3a'));var _0x1626f2=Buffer[_0x6713('0x3b')](_0x1d12f0[_0x6713('0x3c')],_0x6713('0x30'));return fs[_0x6713('0x3d')](_0x489538,_0x1626f2,function(_0xfc0ea7){_0x17e42d(_0xfc0ea7);},function(_0x549dcb){fs[_0x6713('0x2b')](_0x489538,_0x6713('0x2c'));_0x5d2304(_0x549dcb);});});})[_0x6713('0x2a')](function(_0x623752){_0x2027dc=path[_0x6713('0x27')](__dirname,'tmp',rs[_0x6713('0x39')](0x4)+_0x6713('0x29'));return convertFile(_0x489538,_0x2027dc);})[_0x6713('0x2a')](function(){try{fs[_0x6713('0x1c')](_0x489538);fs[_0x6713('0x2b')](_0x2027dc,_0x6713('0x2c'));}catch(_0xe68a4c){logger[_0x6713('0x15')](_0xe68a4c);}logger[_0x6713('0x1a')](_0x6713('0x3e'),_0x2027dc[_0x6713('0x2d')]('.')[0x0]);return _0x2027dc[_0x6713('0x2d')]('.')[0x0];});};exports[_0x6713('0x3f')]=function(_0x272a48,_0x5981f5){var _0x19460f='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x4995fa,_0x56dd5c;var _0x5274f0;var _0x49c3e7={'encoding':'utf8','method':_0x6713('0x40'),'timeout':0x2710,'url':_0x19460f,'headers':{'Content-Type':_0x6713('0x41')},'body':_0x6713('0x42')+encodeURIComponent(JSON[_0x6713('0x43')]([[['jQ1olc',JSON[_0x6713('0x43')]([_0x272a48,_0x5981f5||'en',![],_0x6713('0x44')]),null,_0x6713('0x45')]]]))};return rp(_0x49c3e7)[_0x6713('0x2a')](function(_0x2f91f9){try{_0x5274f0=eval(_0x2f91f9[_0x6713('0x46')](0x5))[0x0][0x2];}catch(_0x1c1ee0){throw new Error('parse\x20response\x20failed:\x0a'+_0x2f91f9[_0x6713('0x22')]);}if(!_0x5274f0){if(_0x272a48['length']>0xc8){throw new Error(_0x6713('0x47'));}else{throw new Error(_0x6713('0x48')+_0x5981f5+_0x6713('0x49'));}}try{_0x5274f0=eval(_0x5274f0)[0x0];}catch(_0x160773){throw new Error(_0x6713('0x4a')+res['data']);}const _0x566cc0=_0x5274f0;_0x4995fa=path[_0x6713('0x27')](__dirname,'tmp',rs[_0x6713('0x39')](0x4)+_0x6713('0x3a'));fs[_0x6713('0x4b')](_0x4995fa,_0x5274f0,{'encoding':_0x6713('0x30')});_0x56dd5c=path['resolve'](__dirname,_0x6713('0x28'),rs['generate'](0x4)+'.wav');return convertFile(_0x4995fa,_0x56dd5c);})[_0x6713('0x2a')](function(){try{fs[_0x6713('0x1c')](_0x4995fa);fs['chmodSync'](_0x56dd5c,_0x6713('0x2c'));}catch(_0x32da25){logger[_0x6713('0x15')](_0x32da25);}logger[_0x6713('0x1a')](_0x6713('0x4c'),_0x56dd5c[_0x6713('0x2d')]('.')[0x0]);return _0x56dd5c[_0x6713('0x2d')]('.')[0x0];});};exports[_0x6713('0x4d')]=function(_0x1af7e0,_0x19274b,_0x468c17){return google[_0x6713('0x4e')](_0x1af7e0,_0x19274b,_0x468c17)[_0x6713('0x2a')](function(_0x15da4b){logger['info'](_0x15da4b[_0x6713('0x4f')]);return rp(_0x15da4b);})[_0x6713('0x2a')](function(_0xe03929){var _0x4cdcb1='';var _0x5e8bf9=0x0;try{fs[_0x6713('0x1c')](_0x1af7e0);}catch(_0x2bdd32){logger['error'](_0x2bdd32);}if(_0xe03929&&_0xe03929[_0x6713('0x50')]){_0x4cdcb1=_0xe03929[_0x6713('0x50')][_0x6713('0x51')](function(_0x496b9d){return _0x496b9d&&_0x496b9d[_0x6713('0x52')][0x0]&&_0x496b9d[_0x6713('0x52')][0x0][_0x6713('0x53')]?_0x496b9d[_0x6713('0x52')][0x0][_0x6713('0x53')]:'';})[_0x6713('0x54')]('\x0a');_0x5e8bf9=_0xe03929[_0x6713('0x50')][_0x6713('0x51')](function(_0x38c19d){return _0x38c19d&&_0x38c19d[_0x6713('0x52')][0x0]&&_0x38c19d[_0x6713('0x52')][0x0][_0x6713('0x55')]?_0x38c19d[_0x6713('0x52')][0x0][_0x6713('0x55')]:0x0;})[_0x6713('0x54')]('\x0a');}logger[_0x6713('0x1a')]('googleASR\x20transcription',_0x4cdcb1);logger[_0x6713('0x1a')](_0x6713('0x56'),_0x5e8bf9);return{'transcript':_0x4cdcb1,'confidence':_0x5e8bf9};})[_0x6713('0x57')](function(_0x5bad55){logger['error'](_0x6713('0x58'),_0x5bad55[_0x6713('0x14')],_0x5bad55[_0x6713('0x59')],_0x5bad55[_0x6713('0x5a')]);});};exports['googleDialogflow']=function(_0x364c96,_0xa6c0e7,_0x1d12ef,_0x4b07de){var _0x26de69=apiai(_0xa6c0e7,{'language':_0x4b07de||'en'});return _0x26de69[_0x6713('0x5b')](_0x1d12ef,{'sessionId':md5(_0x364c96)})[_0x6713('0x2a')](function(_0x3acc4a){logger[_0x6713('0x1a')](JSON['stringify'](_0x3acc4a));return{'source':_0x3acc4a[_0x6713('0x5c')][_0x6713('0x5d')],'resolvedQuery':_0x3acc4a[_0x6713('0x5c')]['resolvedQuery'],'action':_0x3acc4a['result'][_0x6713('0x5e')],'actionIncomplete':_0x3acc4a[_0x6713('0x5c')][_0x6713('0x5f')],'speech':_0x3acc4a[_0x6713('0x5c')]['fulfillment'][_0x6713('0x60')],'score':_0x3acc4a['result']['score'],'statusCode':_0x3acc4a['status'][_0x6713('0x61')],'endConversation':_0x3acc4a[_0x6713('0x5c')][_0x6713('0x62')][_0x6713('0x63')]||![],'isFallbackIntent':_0x3acc4a['result'][_0x6713('0x62')][_0x6713('0x64')]};});};exports[_0x6713('0x65')]=function(_0x2007fb,_0x6acc07,_0x340573,_0x1841ba,_0x15b9d3,_0x341718){var _0x140cee=_0x1841ba[_0x6713('0x66')](/\\n/g,'\x0a');var _0x38b0c0={'credentials':{'private_key':_0x140cee,'client_email':_0x340573}};var _0x402f4d=new dialogflow['SessionsClient'](_0x38b0c0);var _0x527dba=_0x402f4d['sessionPath'](_0x6acc07,md5(_0x2007fb));var _0x1b84e8={'session':_0x527dba,'queryInput':{'text':{'text':_0x15b9d3,'languageCode':_0x341718}}};return _0x402f4d[_0x6713('0x67')](_0x1b84e8)[_0x6713('0x2a')](function(_0x4731d6){if(_0x4731d6&&_0x4731d6[_0x6713('0x68')]){logger[_0x6713('0x1a')](_0x6713('0x69'),JSON['stringify'](_0x4731d6));var _0x39ca07=_0x4731d6[0x0];if(_0x39ca07){var _0x25a403={'action':_0x39ca07[_0x6713('0x6a')]['action'],'allRequiredParamsPresent':_0x39ca07[_0x6713('0x6a')][_0x6713('0x6b')],'endConversation':_0x39ca07[_0x6713('0x6a')][_0x6713('0x6c')]&&_0x39ca07[_0x6713('0x6a')][_0x6713('0x6c')][_0x6713('0x6d')]?_0x39ca07[_0x6713('0x6a')][_0x6713('0x6c')][_0x6713('0x6d')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x39ca07['queryResult'][_0x6713('0x6e')],'intentName':_0x39ca07[_0x6713('0x6a')]['intent']['name'],'intentDisplayName':_0x39ca07[_0x6713('0x6a')][_0x6713('0x6f')][_0x6713('0x70')],'isFallbackIntent':_0x39ca07[_0x6713('0x6a')][_0x6713('0x6f')][_0x6713('0x71')],'languageCode':_0x39ca07[_0x6713('0x6a')][_0x6713('0x72')],'queryText':_0x39ca07[_0x6713('0x6a')]['queryText'],'responseId':_0x39ca07[_0x6713('0x73')],'score':_0x39ca07['queryResult'][_0x6713('0x74')],'speech':_0x39ca07[_0x6713('0x6a')][_0x6713('0x6e')],'providerResponse':JSON[_0x6713('0x43')](_0x4731d6)};return _0x25a403;}}});};exports[_0x6713('0x75')]=function(_0x139511,_0x36fbc5,_0x2b6121,_0x4c584d){return tilde['asr'](_0x139511,_0x36fbc5,_0x2b6121,_0x4c584d)[_0x6713('0x2a')](function(_0x20a382){try{fs['unlink'](_0x139511);}catch(_0x1fb132){logger[_0x6713('0x15')](_0x1fb132);}logger[_0x6713('0x1a')](_0x6713('0x76'),_0x20a382['transcript']);logger[_0x6713('0x1a')](_0x6713('0x77'),_0x20a382[_0x6713('0x55')]);return _0x20a382;});};exports[_0x6713('0x78')]=function(_0x17d83d,_0x1ee779,_0x3448b8,_0x3b22c6,_0x3df7c8,_0x177f69){var _0x43a28d=path[_0x6713('0x27')](__dirname,'tmp',rs[_0x6713('0x39')](0x4)+_0x6713('0x3a'));var _0x1cac14;return aws[_0x6713('0x79')](_0x17d83d,_0x1ee779,_0x3448b8,_0x3b22c6,_0x3df7c8,_0x177f69,_0x43a28d)[_0x6713('0x2a')](function(){_0x1cac14=path['resolve'](__dirname,_0x6713('0x28'),rs[_0x6713('0x39')](0x4)+_0x6713('0x29'));return convertFile(_0x43a28d,_0x1cac14);})['then'](function(){try{fs[_0x6713('0x1c')](_0x43a28d);fs[_0x6713('0x2b')](_0x1cac14,'777');}catch(_0x369c41){logger[_0x6713('0x15')](_0x369c41);}return _0x1cac14[_0x6713('0x2d')]('.')[0x0];});};exports[_0x6713('0x7a')]=function(_0x5cbb0a,_0x115d06,_0x1659b0,_0x284327,_0x13f77e,_0x3c788f){return aws[_0x6713('0x7b')](_0x5cbb0a,_0x115d06,_0x1659b0,_0x284327,_0x13f77e,_0x3c788f)['then'](function(_0x3c3f07){logger[_0x6713('0x1a')](JSON[_0x6713('0x43')](_0x3c3f07));return _0x3c3f07;});};exports[_0x6713('0x7c')]=function(_0xbc7a6,_0x31da5d,_0x488e0a,_0x383f8f){var _0x219835=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0xbc7a6,encodeURIComponent(_0x31da5d),_0x488e0a,_0x383f8f);var _0x573bb6=path[_0x6713('0x27')](__dirname,_0x6713('0x28'),rs[_0x6713('0x39')](0x4)+_0x6713('0x3a'));var _0x5f4a93;return downloadFile(_0x219835,_0x573bb6)[_0x6713('0x2a')](function(){_0x5f4a93=path[_0x6713('0x27')](__dirname,_0x6713('0x28'),rs[_0x6713('0x39')](0x4)+_0x6713('0x29'));return convertFile(_0x573bb6,_0x5f4a93);})[_0x6713('0x2a')](function(){try{fs[_0x6713('0x1c')](_0x573bb6);fs[_0x6713('0x2b')](_0x5f4a93,'777');}catch(_0x133f85){logger['error'](_0x133f85);}return _0x5f4a93['split']('.')[0x0];});};exports['ispeechASR']=function(_0x1ae111,_0x8d5d,_0x208627,_0x336ac2){var _0x5dbe4f=util[_0x6713('0x7d')](_0x6713('0x7e'),ISPEECH_API,_0x8d5d,_0x208627,base64Encode(_0x1ae111),_0x336ac2?util['format'](_0x6713('0x7f'),encodeURIComponent(_0x336ac2)):_0x6713('0x80'));return uploadFile(_0x5dbe4f)[_0x6713('0x2a')](function(_0x1f4186){return querystring[_0x6713('0xa')](_0x1f4186);});};exports['sestekNDA']=function(_0x21da33,_0x3cd42d){return sestek[_0x6713('0x81')](_0x21da33,_0x3cd42d)[_0x6713('0x2a')](function(_0x4befeb){logger[_0x6713('0x1a')](JSON['stringify'](_0x4befeb));var _0x54d669={'speech':_0x4befeb[_0x6713('0x82')],'action':_0x4befeb[_0x6713('0x83')]?_0x4befeb[_0x6713('0x83')][_0x6713('0x84')]:undefined,'actiondata':_0x4befeb['channelData']?_0x4befeb[_0x6713('0x83')][_0x6713('0x85')]:undefined};if(_0x4befeb['channelData']&&_0x4befeb[_0x6713('0x83')][_0x6713('0x86')]){return base64Decode(_0x4befeb[_0x6713('0x83')]['AudioFromTts'][_0x6713('0x87')],path[_0x6713('0x27')](__dirname,_0x6713('0x28'),rs[_0x6713('0x39')](0x4)+'.wav'))[_0x6713('0x2a')](function(_0x11f4aa){_0x54d669['audiofile']=_0x11f4aa;return _0x54d669;});}return _0x54d669;});};exports[_0x6713('0x88')]=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 ca074e9..a92df5e 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 _0x402c=['exports','./nda'];(function(_0x453980,_0x34d6a2){var _0x4f9f31=function(_0xe0b3d8){while(--_0xe0b3d8){_0x453980['push'](_0x453980['shift']());}};_0x4f9f31(++_0x34d6a2);}(_0x402c,0x8d));var _0xc402=function(_0x4c00ea,_0x1cf606){_0x4c00ea=_0x4c00ea-0x0;var _0x2754b6=_0x402c[_0x4c00ea];return _0x2754b6;};var nda=require(_0xc402('0x0'));module[_0xc402('0x1')]={'nda':nda}; \ No newline at end of file +var _0x1921=['./nda'];(function(_0x105911,_0x2f43f8){var _0x1f0076=function(_0x666f06){while(--_0x666f06){_0x105911['push'](_0x105911['shift']());}};_0x1f0076(++_0x2f43f8);}(_0x1921,0x15c));var _0x1192=function(_0x55806d,_0x3d3d76){_0x55806d=_0x55806d-0x0;var _0xe76663=_0x1921[_0x55806d];return _0xe76663;};var nda=require(_0x1192('0x0'));module['exports']={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 428de34..d83d926 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 _0x5eb1=['channelData','ProjectName','project','AudioOutputSettings','audio/wav','custom_action','custom_action_data','stringify','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','username','password','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','text','body'];(function(_0x43b08,_0x15f967){var _0x5e05f4=function(_0x4bb0cb){while(--_0x4bb0cb){_0x43b08['push'](_0x43b08['shift']());}};_0x5e05f4(++_0x15f967);}(_0x5eb1,0x7c));var _0x15eb=function(_0x11a383,_0x4e05ae){_0x11a383=_0x11a383-0x0;var _0x49f2bb=_0x5eb1[_0x11a383];return _0x49f2bb;};'use strict';var rp=require('request-promise');var url=require(_0x15eb('0x0'));var logger=require(_0x15eb('0x1'))(_0x15eb('0x2'));module[_0x15eb('0x3')]=function(_0x2b9937,_0x1c2f32){var _0x5e1142={'method':_0x15eb('0x4'),'uri':url[_0x15eb('0x5')](_0x1c2f32[_0x15eb('0x6')],_0x15eb('0x7')),'form':{'grant_type':'password','username':_0x1c2f32[_0x15eb('0x8')],'password':_0x1c2f32[_0x15eb('0x9')]},'json':!![]};return rp(_0x5e1142)['then'](function(_0xe4d8ce){var _0x160879={'method':_0x15eb('0x4'),'uri':url[_0x15eb('0x5')](_0x1c2f32[_0x15eb('0xa')],_0x15eb('0xb')),'body':{'type':_0x1c2f32[_0x15eb('0xc')]||_0x15eb('0xd'),'channelId':_0x15eb('0xe'),'conversation':{'id':_0x2b9937[_0x15eb('0xf')]},'from':{'id':_0x2b9937[_0x15eb('0x10')],'name':_0x2b9937[_0x15eb('0x11')]},'recipient':{'id':_0x2b9937[_0x15eb('0x12')],'name':_0x2b9937['extension']},'text':_0x1c2f32[_0x15eb('0x13')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0xe4d8ce['access_token']},'json':!![]};if(_0x1c2f32['project']){_0x160879[_0x15eb('0x14')][_0x15eb('0x15')][_0x15eb('0x16')]=_0x1c2f32[_0x15eb('0x17')];}if(_0x1c2f32['ndagenerate_audio']=='1'){_0x160879[_0x15eb('0x14')][_0x15eb('0x15')][_0x15eb('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x15eb('0x19')};}if(_0x1c2f32['custom_action']){_0x160879['body']['channelData']['CustomAction']=_0x1c2f32[_0x15eb('0x1a')];if(_0x1c2f32['custom_action_data']){_0x160879['body'][_0x15eb('0x15')]['CustomActionData']=_0x1c2f32[_0x15eb('0x1b')];}}logger['info'](JSON[_0x15eb('0x1c')](_0x160879));return rp(_0x160879);});}; \ No newline at end of file +var _0x9b00=['ndauth_url','password','then','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','custom_action','CustomAction','CustomActionData','info','request-promise','url','../../../../../config/logger','exports','POST','resolve'];(function(_0x4ac8b3,_0x2792fd){var _0x32742c=function(_0xe8d15a){while(--_0xe8d15a){_0x4ac8b3['push'](_0x4ac8b3['shift']());}};_0x32742c(++_0x2792fd);}(_0x9b00,0xcc));var _0x09b0=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x9b00[_0x2b4411];return _0x8e41ef;};'use strict';var rp=require(_0x09b0('0x0'));var url=require(_0x09b0('0x1'));var logger=require(_0x09b0('0x2'))('agi');module[_0x09b0('0x3')]=function(_0x2bf951,_0x18bb45){var _0x21e010={'method':_0x09b0('0x4'),'uri':url[_0x09b0('0x5')](_0x18bb45[_0x09b0('0x6')],'/token'),'form':{'grant_type':_0x09b0('0x7'),'username':_0x18bb45['username'],'password':_0x18bb45[_0x09b0('0x7')]},'json':!![]};return rp(_0x21e010)[_0x09b0('0x8')](function(_0x396bd6){var _0x4290c7={'method':_0x09b0('0x4'),'uri':url[_0x09b0('0x5')](_0x18bb45[_0x09b0('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x18bb45[_0x09b0('0xa')]||_0x09b0('0xb'),'channelId':_0x09b0('0xc'),'conversation':{'id':_0x2bf951[_0x09b0('0xd')]},'from':{'id':_0x2bf951[_0x09b0('0xe')],'name':_0x2bf951[_0x09b0('0xf')]},'recipient':{'id':_0x2bf951[_0x09b0('0x10')],'name':_0x2bf951[_0x09b0('0x11')]},'text':_0x18bb45[_0x09b0('0x12')],'channelData':{}},'headers':{'Authorization':_0x09b0('0x13')+_0x396bd6[_0x09b0('0x14')]},'json':!![]};if(_0x18bb45['project']){_0x4290c7[_0x09b0('0x15')][_0x09b0('0x16')][_0x09b0('0x17')]=_0x18bb45['project'];}if(_0x18bb45[_0x09b0('0x18')]=='1'){_0x4290c7[_0x09b0('0x15')]['channelData'][_0x09b0('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x18bb45[_0x09b0('0x1a')]){_0x4290c7[_0x09b0('0x15')][_0x09b0('0x16')][_0x09b0('0x1b')]=_0x18bb45['custom_action'];if(_0x18bb45['custom_action_data']){_0x4290c7['body'][_0x09b0('0x16')][_0x09b0('0x1c')]=_0x18bb45['custom_action_data'];}}logger[_0x09b0('0x1d')](JSON['stringify'](_0x4290c7));return rp(_0x4290c7);});}; \ 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 f4d6693..8dc555a 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x4f49cd,_0x60779c,_0x28a337,_0x5c4b22){return asr(_0x4f49cd,_0x60779c,_0x28a337,_0x5c4b22);}; \ No newline at end of file +var _0x8056=['./lib/api'];(function(_0x3c7f1d,_0x44b37b){var _0xd7ab0c=function(_0x1dd6b2){while(--_0x1dd6b2){_0x3c7f1d['push'](_0x3c7f1d['shift']());}};_0xd7ab0c(++_0x44b37b);}(_0x8056,0xf9));var _0x6805=function(_0x5846b6,_0x299729){_0x5846b6=_0x5846b6-0x0;var _0x5b4ba4=_0x8056[_0x5846b6];return _0x5b4ba4;};'use strict';var asr=require(_0x6805('0x0'));module['exports']=function(_0x39d2c1,_0x32ad1a,_0x274062,_0x2c80e5){return asr(_0x39d2c1,_0x32ad1a,_0x274062,_0x2c80e5);}; \ 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 1e22da3..f4b01bd 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 _0xd480=['exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','hex','unix','createReadStream','data','close','send','EOS','status','result','final','Tilde\x20ASR\x20hypoteses','stringify','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','terminate','Close\x20Tilde\x20ASR\x20socket','error','isNil','open','bluebird','lodash','moment','crypto','agi'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xd480,0x177));var _0x0d48=function(_0x22ce0e,_0x2f1695){_0x22ce0e=_0x22ce0e-0x0;var _0x3a6ded=_0xd480[_0x22ce0e];return _0x3a6ded;};'use strict';var BPromise=require(_0x0d48('0x0'));var _=require(_0x0d48('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0d48('0x2'));var crypto=require(_0x0d48('0x3'));var logger=require('../../../../../../config/logger')(_0x0d48('0x4'));module[_0x0d48('0x5')]=function(_0x3a147b,_0x225d36,_0x1ea87a,_0x4e7e9a){return new BPromise(function(_0x1d1302,_0x394da0){logger[_0x0d48('0x6')](_0x0d48('0x7'),_0x4e7e9a||_0x0d48('0x8'));var _0x3c0381=new WebSocket(_0x4e7e9a||_0x0d48('0x8'),{'perMessageDeflate':![]});var _0x32ed43='';var _0x590540='0';var _0x3d7b93='1';var _0x5b44ba=_0x0d48('0x9');function _0x4b9a74(_0x203785){var _0x59b450=crypto[_0x0d48('0xa')](_0x0d48('0xb'));_0x59b450['update'](_0x203785);return _0x59b450[_0x0d48('0xc')](_0x0d48('0xd'));}function _0xbfc647(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0xb51dcd=moment()[_0x0d48('0xe')]();var _0x5c8c5a=_0x4b9a74(_0xb51dcd+_0x225d36+_0x1ea87a);_0x3c0381['send'](JSON['stringify']({'appID':_0x225d36,'timestamp':_0xb51dcd,'appKey':_0x5c8c5a}));var _0x507f8e=fs[_0x0d48('0xf')](_0x3a147b);_0x507f8e['on'](_0x0d48('0x10'),function(_0x58ac2a){_0x3c0381['send'](_0x58ac2a);});_0x507f8e['on'](_0x0d48('0x11'),function(){_0x3c0381[_0x0d48('0x12')](_0x0d48('0x13'));});}catch(_0x5b238c){logger['error']('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x5b238c));_0x3c0381['terminate']();}}function _0x9ea15a(_0x3107b5){try{if(_0x3107b5){var _0x181898=JSON['parse'](_0x3107b5);switch(_0x181898[_0x0d48('0x14')]){case 0x0:if(_0x181898[_0x0d48('0x15')]){if(_0x181898[_0x0d48('0x15')][_0x0d48('0x16')]){logger[_0x0d48('0x6')](_0x0d48('0x17'),JSON[_0x0d48('0x18')](_0x181898[_0x0d48('0x15')][_0x0d48('0x19')]));_0x32ed43=_0x181898[_0x0d48('0x15')][_0x0d48('0x19')][0x0]['transcript'];_0x590540=_0x181898[_0x0d48('0x15')]['hypotheses'][0x0][_0x0d48('0x1a')];_0x3d7b93='0';_0x5b44ba=_0x0d48('0x1b');_0x3c0381['terminate']();}}break;case 0x1:logger[_0x0d48('0x6')](_0x0d48('0x9'));_0x3d7b93='1';_0x5b44ba=_0x0d48('0x9');break;case 0x2:logger[_0x0d48('0x6')](_0x0d48('0x1c'));_0x3d7b93='2';_0x5b44ba='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0x0d48('0x1d'));_0x3d7b93='9';_0x5b44ba='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x0d48('0x6')](_0x0d48('0x1e'));_0x3d7b93='10';_0x5b44ba=_0x0d48('0x1e');break;case 0xb:logger[_0x0d48('0x6')](_0x0d48('0x1f'));_0x3d7b93='11';_0x5b44ba=_0x0d48('0x1f');}}}catch(_0xb6c6ff){logger['error'](_0x0d48('0x20'),JSON[_0x0d48('0x18')](_0xb6c6ff));_0x3c0381[_0x0d48('0x21')]();}}function _0x4f476e(){logger[_0x0d48('0x6')](_0x0d48('0x22'));_0x1d1302({'transcript':_0x32ed43,'confidence':_0x590540,'status':_0x3d7b93,'status_message':_0x5b44ba});}function _0x367473(_0x334c02){logger[_0x0d48('0x23')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x0d48('0x24')](_0x334c02)){logger[_0x0d48('0x23')](_['isObject'](_0x334c02)?JSON[_0x0d48('0x18')](_0x334c02):_0x334c02);}}_0x3c0381['on'](_0x0d48('0x25'),_0xbfc647);_0x3c0381['on']('message',_0x9ea15a);_0x3c0381['on'](_0x0d48('0x11'),_0x4f476e);_0x3c0381['on']('error',_0x367473);});}; \ No newline at end of file +var _0x601f=['info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','message','bluebird','lodash','crypto','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x601f,0x1a3));var _0xf601=function(_0xc59cd4,_0xf4b659){_0xc59cd4=_0xc59cd4-0x0;var _0x506a48=_0x601f[_0xc59cd4];return _0x506a48;};'use strict';var BPromise=require(_0xf601('0x0'));var _=require(_0xf601('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xf601('0x2'));var logger=require('../../../../../../config/logger')(_0xf601('0x3'));module[_0xf601('0x4')]=function(_0x4df831,_0x52532e,_0x37f424,_0x2711e5){return new BPromise(function(_0x122312,_0x5e46bc){logger['info'](_0xf601('0x5'),_0x2711e5||_0xf601('0x6'));var _0x1d4bdb=new WebSocket(_0x2711e5||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x1dd050='';var _0x5c9c8b='0';var _0x590187='1';var _0x3b18a6=_0xf601('0x7');function _0x5bfe65(_0x2cd16e){var _0x3a1081=crypto[_0xf601('0x8')](_0xf601('0x9'));_0x3a1081[_0xf601('0xa')](_0x2cd16e);return _0x3a1081[_0xf601('0xb')](_0xf601('0xc'));}function _0x900728(){try{logger[_0xf601('0xd')](_0xf601('0xe'));var _0x15012d=moment()[_0xf601('0xf')]();var _0x1cf723=_0x5bfe65(_0x15012d+_0x52532e+_0x37f424);_0x1d4bdb[_0xf601('0x10')](JSON[_0xf601('0x11')]({'appID':_0x52532e,'timestamp':_0x15012d,'appKey':_0x1cf723}));var _0x1dbbcf=fs[_0xf601('0x12')](_0x4df831);_0x1dbbcf['on'](_0xf601('0x13'),function(_0xce215){_0x1d4bdb['send'](_0xce215);});_0x1dbbcf['on'](_0xf601('0x14'),function(){_0x1d4bdb[_0xf601('0x10')](_0xf601('0x15'));});}catch(_0x4f072a){logger['error'](_0xf601('0x16'),JSON['stringify'](_0x4f072a));_0x1d4bdb[_0xf601('0x17')]();}}function _0x4a7523(_0x1d51b5){try{if(_0x1d51b5){var _0x31e3d3=JSON['parse'](_0x1d51b5);switch(_0x31e3d3[_0xf601('0x18')]){case 0x0:if(_0x31e3d3[_0xf601('0x19')]){if(_0x31e3d3[_0xf601('0x19')]['final']){logger[_0xf601('0xd')](_0xf601('0x1a'),JSON['stringify'](_0x31e3d3[_0xf601('0x19')][_0xf601('0x1b')]));_0x1dd050=_0x31e3d3[_0xf601('0x19')][_0xf601('0x1b')][0x0][_0xf601('0x1c')];_0x5c9c8b=_0x31e3d3['result'][_0xf601('0x1b')][0x0]['likelihood'];_0x590187='0';_0x3b18a6='Success.';_0x1d4bdb[_0xf601('0x17')]();}}break;case 0x1:logger[_0xf601('0xd')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x590187='1';_0x3b18a6=_0xf601('0x7');break;case 0x2:logger['info'](_0xf601('0x1d'));_0x590187='2';_0x3b18a6='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xf601('0xd')](_0xf601('0x1e'));_0x590187='9';_0x3b18a6=_0xf601('0x1e');break;case 0xa:logger[_0xf601('0xd')]('Authentication\x20failed.');_0x590187='10';_0x3b18a6='Authentication\x20failed.';break;case 0xb:logger[_0xf601('0xd')](_0xf601('0x1f'));_0x590187='11';_0x3b18a6=_0xf601('0x1f');}}}catch(_0x290307){logger[_0xf601('0x20')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xf601('0x11')](_0x290307));_0x1d4bdb[_0xf601('0x17')]();}}function _0x48ef46(){logger[_0xf601('0xd')](_0xf601('0x21'));_0x122312({'transcript':_0x1dd050,'confidence':_0x5c9c8b,'status':_0x590187,'status_message':_0x3b18a6});}function _0x2144bb(_0x2b13ca){logger['error'](_0xf601('0x22'));if(!_['isNil'](_0x2b13ca)){logger[_0xf601('0x20')](_['isObject'](_0x2b13ca)?JSON[_0xf601('0x11')](_0x2b13ca):_0x2b13ca);}}_0x1d4bdb['on']('open',_0x900728);_0x1d4bdb['on'](_0xf601('0x23'),_0x4a7523);_0x1d4bdb['on'](_0xf601('0x14'),_0x48ef46);_0x1d4bdb['on'](_0xf601('0x20'),_0x2144bb);});}; \ 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 52624b7..7ff9d47 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 _0x82f0=['exports','./asr'];(function(_0x1e2343,_0x25de8d){var _0x505a4b=function(_0xe631d6){while(--_0xe631d6){_0x1e2343['push'](_0x1e2343['shift']());}};_0x505a4b(++_0x25de8d);}(_0x82f0,0x113));var _0x082f=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x82f0[_0x5ddb1c];return _0x354adc;};var asr=require(_0x082f('0x0'));module[_0x082f('0x1')]={'asr':asr}; \ No newline at end of file +var _0xafb2=['./asr','exports'];(function(_0x3e4346,_0x4c9fc8){var _0x39fe54=function(_0x58ed12){while(--_0x58ed12){_0x3e4346['push'](_0x3e4346['shift']());}};_0x39fe54(++_0x4c9fc8);}(_0xafb2,0x12c));var _0x2afb=function(_0xe3a062,_0x29d0f7){_0xe3a062=_0xe3a062-0x0;var _0x544f83=_0xafb2[_0xe3a062];return _0x544f83;};var asr=require(_0x2afb('0x0'));module[_0x2afb('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 9992979..653ac22 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 _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x24106c,_0x367a6f){var _0xbaeb73=function(_0x483603){while(--_0x483603){_0x24106c['push'](_0x24106c['shift']());}};_0xbaeb73(++_0x367a6f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 0cff55c..1b7aa1b 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 _0x99cd=['Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','/var/opt/motion2/server/files','rawBody','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','clear','isString','replaceObjectAllVariables','replaceAllVariables','hasOwnProperty','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','toString','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','getAndSetVariable','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20query\x20configured','query','query:\x20%s','variable_id','no\x20variable\x20found','keys','forEach','%s[%s][%s]','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','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','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','getTrunk','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20variable\x20selected\x20for\x20the\x20result','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','getdigits','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','getData','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','getPause','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','QUEUE','macro','gosub','position','record','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','saynumber','sayNumber','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','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','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','replace','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s'];(function(_0x35b50f,_0x2ccee7){var _0x23d1d5=function(_0x3b761f){while(--_0x3b761f){_0x35b50f['push'](_0x35b50f['shift']());}};_0x23d1d5(++_0x2ccee7);}(_0x99cd,0x1df));var _0xd99c=function(_0x8ddd3,_0x45dc37){_0x8ddd3=_0x8ddd3-0x0;var _0x4363e6=_0x99cd[_0x8ddd3];return _0x4363e6;};'use strict';var fs=require('fs');var util=require(_0xd99c('0x0'));var _=require('lodash');var sh=require(_0xd99c('0x1'));var odbc=require(_0xd99c('0x2'))();var rs=require(_0xd99c('0x3'));var moment=require(_0xd99c('0x4'));var Mustache=require(_0xd99c('0x5'));var rp=require(_0xd99c('0x6'));var logger=require(_0xd99c('0x7'))(_0xd99c('0x8'));var config=require(_0xd99c('0x9'));var shared=require(_0xd99c('0xa'));var scripts=require('./scripts');var FILES_PATH=_0xd99c('0xb');var recursiveMapAttributes=['rawHeaders',_0xd99c('0xc')];var verticesWithRetry=['menu','getdigits',_0xd99c('0xd')];var AGIVertices=function(_0x44fa1e,_0x2d5e7e,_0x2bcd16){this[_0xd99c('0xe')]=_0x44fa1e;this[_0xd99c('0xf')]=_0x2d5e7e;this[_0xd99c('0x10')]=_0x2bcd16;};AGIVertices[_0xd99c('0x11')][_0xd99c('0x12')]=function(_0x296950,_0x36887a){this[_0xd99c('0xf')][_0xd99c('0x13')](_0x296950)[_0xd99c('0x14')](function(_0x557692){_0x36887a(null,_0x557692?_0x557692[_0xd99c('0x15')]:![]);})[_0xd99c('0x16')](function(_0x41042a){_0x36887a(_0x41042a);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x17')]=function(_0x58c49f,_0x9c9edd){this[_0xd99c('0xf')][_0xd99c('0x18')](_0x58c49f)[_0xd99c('0x14')](function(_0x478679){_0x9c9edd(null,_0x478679?_0x478679['name']:![]);})[_0xd99c('0x16')](function(_0x31d5d6){_0x9c9edd(_0x31d5d6);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x19')]=function(_0x2247b5,_0x41936e){this[_0xd99c('0xf')][_0xd99c('0x1a')](_0x2247b5)['then'](function(_0x486607){_0x41936e(null,_0x486607?_0x486607[_0xd99c('0x15')]:![]);})[_0xd99c('0x16')](function(_0xeb2165){_0x41936e(_0xeb2165);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x1b')]=function(_0x134aac,_0x50b0fd){this['rpc'][_0xd99c('0x1c')](_0x134aac)[_0xd99c('0x14')](function(_0x271a35){_0x50b0fd(null,_0x271a35?_0x271a35[_0xd99c('0x1d')]:![]);})[_0xd99c('0x16')](function(_0x44009a){_0x50b0fd(_0x44009a);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x1e')]=function(_0x39c705,_0x1d84bb){this[_0xd99c('0xf')][_0xd99c('0x1f')](_0x39c705)['then'](function(_0x11cdd6){_0x1d84bb(null,_0x11cdd6?_0x11cdd6['name']:![]);})['catch'](function(_0x14ffb8){_0x1d84bb(_0x14ffb8);});};AGIVertices[_0xd99c('0x11')]['getTrunk']=function(_0x4af932,_0x54ff0c){this[_0xd99c('0xf')]['getTrunkById'](_0x4af932)[_0xd99c('0x14')](function(_0x820cc0){_0x54ff0c(null,_0x820cc0?_0x820cc0[_0xd99c('0x15')]:![]);})['catch'](function(_0x22c83f){_0x54ff0c(_0x22c83f);});};AGIVertices['prototype'][_0xd99c('0x20')]=function(_0x3c041b,_0x1ae635){var _0x4f7b81=this;this['rpc'][_0xd99c('0x21')](_0x3c041b)[_0xd99c('0x14')](function(_0x20ce01){_0x1ae635(null,_0x20ce01?_0x4f7b81[_0xd99c('0x22')](_0x20ce01[_0xd99c('0x23')]):![]);})[_0xd99c('0x16')](function(_0x52dbed){_0x1ae635(_0x52dbed);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x24')]=function(_0x4dbbc,_0x4aff4d){this[_0xd99c('0xf')][_0xd99c('0x25')](_0x4dbbc)['then'](function(_0x3cdab0){_0x4aff4d(null,_0x3cdab0?_0x3cdab0:![]);})['catch'](function(_0xc0ad42){_0x4aff4d(_0xc0ad42);});};AGIVertices['prototype']['sendMailMessage']=function(_0x4a5bb0,_0x1b4db9,_0x321dff){this['mailRpc'][_0xd99c('0x26')](_0x4a5bb0,_0x1b4db9)[_0xd99c('0x14')](function(){_0x321dff(null);})['catch'](function(_0x380594){_0x321dff(_0x380594);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x27')]=function(_0x494e0b,_0xf2f2ea){this[_0xd99c('0xf')][_0xd99c('0x28')](_0x494e0b)[_0xd99c('0x14')](function(_0x5556f4){if(_0x5556f4){if(_0x5556f4[_0xd99c('0x29')]){_0xf2f2ea(null,[_0x5556f4[_0xd99c('0x2a')]]);}else{_0xf2f2ea(null,_[_0xd99c('0x2b')](_0x5556f4[_0xd99c('0x2c')],'interval'));}}else{_0xf2f2ea(null,![]);}})['catch'](function(_0x57af5e){_0xf2f2ea(_0x57af5e);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x22')]=function(_0x1f3111){return util[_0xd99c('0x2d')](_0xd99c('0x2e'),FILES_PATH,_0x1f3111);};AGIVertices['prototype'][_0xd99c('0x2f')]=function(_0x4b67f2,_0x831b46,_0x3b9f91){odbc[_0xd99c('0x30')](_0x4b67f2,function(_0x3610f5){if(_0x3610f5){logger['error'](_0xd99c('0x31'),_0x3610f5);_0x3b9f91(_0x3610f5);}else{logger[_0xd99c('0x32')](_0xd99c('0x33'));odbc['query'](_0x831b46,function(_0x1f8e53,_0x106af6){if(_0x1f8e53){logger[_0xd99c('0x32')](_0xd99c('0x34'),_0x831b46);_0x3b9f91(_0x1f8e53);}else{logger[_0xd99c('0x32')](_0xd99c('0x35'),_0x831b46);odbc['close'](function(_0x354772){if(_0x354772){logger[_0xd99c('0x36')](_0xd99c('0x37'),_0x354772);}_0x3b9f91(null,_0x106af6);});}});}});};AGIVertices[_0xd99c('0x11')]['getSmsAccount']=function(_0xa40935,_0x39e419){this[_0xd99c('0xf')][_0xd99c('0x38')](_0xa40935)[_0xd99c('0x14')](function(_0x1a7e1d){_0x39e419(null,_0x1a7e1d?_0x1a7e1d:![]);})[_0xd99c('0x16')](function(_0x5b172e){_0x39e419(_0x5b172e);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x39')]=function(_0x50f19e,_0x16794c){this[_0xd99c('0xf')][_0xd99c('0x39')](_0x50f19e)[_0xd99c('0x14')](function(_0x17c189){_0x16794c(null,_0x17c189);})[_0xd99c('0x16')](function(_0x1ed026){_0x16794c(_0x1ed026);});};AGIVertices['prototype'][_0xd99c('0x3a')]=function(_0x399ab7,_0x1d8727,_0x45bf6f){this[_0xd99c('0xf')][_0xd99c('0x3a')]({'uniqueid':this[_0xd99c('0xe')][_0xd99c('0x3b')],'node':_0x399ab7[_0xd99c('0x3c')],'application':_0x399ab7[_0xd99c('0x3d')],'data':_0x1d8727||null,'project_name':this[_0xd99c('0xe')][_0xd99c('0x3e')],'callerid':this[_0xd99c('0xe')][_0xd99c('0x3f')]})[_0xd99c('0x14')](function(_0x1d69cf){if(_0x45bf6f){_0x45bf6f(null,_0x1d69cf);}})[_0xd99c('0x16')](function(_0x25ff49){if(_0x45bf6f){_0x45bf6f(_0x25ff49);}});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x40')]=function(_0x546807,_0x3d8f7e,_0x19433d,_0x3159d8){this[_0xd99c('0xf')][_0xd99c('0x40')]({'uniqueid':this[_0xd99c('0xe')]['uniqueid'],'callerid':this[_0xd99c('0xe')][_0xd99c('0x3f')],'calleridname':this['channel']['calleridname'],'context':this[_0xd99c('0xe')][_0xd99c('0x41')],'extension':this['channel'][_0xd99c('0x42')],'priority':this[_0xd99c('0xe')][_0xd99c('0x43')],'accountcode':this[_0xd99c('0xe')][_0xd99c('0x44')],'dnid':this['channel'][_0xd99c('0x45')],'projectName':this[_0xd99c('0xe')]['arg_1'],'saveName':_0x3d8f7e,'filename':_0x546807[_0xd99c('0x46')]||_0x3d8f7e,'savePath':_0x19433d})['then'](function(_0x473783){_0x3159d8(null,_0x473783);})[_0xd99c('0x16')](function(_0x363e23){_0x3159d8(_0x363e23);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x47')]=function(_0x5c8dd7,_0x49daa5,_0x33bad7,_0x501b34,_0x1eb1b5){this[_0xd99c('0xf')][_0xd99c('0x47')]({'uniqueid':this[_0xd99c('0xe')][_0xd99c('0x3b')],'body':_0x5c8dd7,'direction':_0x49daa5,'providerName':_0x33bad7,'providerResponse':_0x501b34})[_0xd99c('0x14')](function(_0x48ec2b){if(_0x1eb1b5){_0x1eb1b5(null,_0x48ec2b);}})[_0xd99c('0x16')](function(_0x4e7de8){if(_0x1eb1b5){_0x1eb1b5(_0x4e7de8);}});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x48')]=function(_0x1c5ec0,_0x29acae){this[_0xd99c('0xf')]['createCmContact']({'firstName':_[_0xd99c('0x49')](_0x1c5ec0[_0xd99c('0x15')])||_[_0xd99c('0x4a')](_0x1c5ec0[_0xd99c('0x15')])?_0xd99c('0x4b')+Math[_0xd99c('0x4c')]():_0x1c5ec0[_0xd99c('0x15')],'lastName':_[_0xd99c('0x49')](_0x1c5ec0[_0xd99c('0x4d')])||_['isNil'](_0x1c5ec0[_0xd99c('0x4d')])?null:_0x1c5ec0['lastName'],'phone':_0x1c5ec0[_0xd99c('0x4e')],'ListId':_0x1c5ec0[_0xd99c('0x4f')],'scheduledat':_0x1c5ec0[_0xd99c('0x50')],'callbackUniqueid':this[_0xd99c('0xe')][_0xd99c('0x3b')],'tags':_0xd99c('0x51'),'description':'Callback\x20scheduled\x20at\x20'+_0x1c5ec0['scheduledAt']['toString'](),'priority':_0x1c5ec0[_0xd99c('0x52')]})[_0xd99c('0x14')](function(_0x1a9f81){_0x29acae(null,_0x1a9f81);})[_0xd99c('0x16')](function(_0x47ee5a){_0x29acae(_0x47ee5a);});};AGIVertices[_0xd99c('0x11')]['getPause']=function(_0x2ba7cb,_0x521d8b){this[_0xd99c('0xf')][_0xd99c('0x53')](_0x2ba7cb)[_0xd99c('0x14')](function(_0x4e853e){_0x521d8b(null,_0x4e853e?_0x4e853e[_0xd99c('0x15')]:![]);})[_0xd99c('0x16')](function(_0x3fe608){_0x521d8b(_0x3fe608);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x54')]=function(_0x283b16,_0x264490,_0x508bcc){var _0x22f154={'role':_0xd99c('0x55')};_0x22f154[_0x283b16]=this['channel'][_0xd99c('0x3f')];this[_0xd99c('0xf')][_0xd99c('0x54')](_0x22f154,_0x264490,this[_0xd99c('0xe')][_0xd99c('0x3b')])['then'](function(_0x6926e4){_0x508bcc(null,_[_0xd99c('0x4a')](_0x6926e4)?![]:!![]);})[_0xd99c('0x16')](function(_0x4c3e1b){logger[_0xd99c('0x36')](_0x4c3e1b);_0x508bcc(null,![]);});};AGIVertices['prototype'][_0xd99c('0x56')]=function(_0x710358,_0x196d73){var _0x1b071b={'role':_0xd99c('0x55')};_0x1b071b[_0x710358]=this[_0xd99c('0xe')][_0xd99c('0x3f')];this[_0xd99c('0xf')][_0xd99c('0x56')](_0x1b071b)[_0xd99c('0x14')](function(_0x4458b2){_0x196d73(null,_[_0xd99c('0x4a')](_0x4458b2)?![]:!![]);})['catch'](function(_0x310a9c){logger['error'](_0x310a9c);_0x196d73(null,![]);});};AGIVertices['prototype'][_0xd99c('0x57')]=function(_0x5d385e,_0x55e3f3){var _0x4bcd0b={'role':_0xd99c('0x55')};_0x4bcd0b[_0x5d385e]=this[_0xd99c('0xe')][_0xd99c('0x3f')];this['rpc']['agentLogout'](_0x4bcd0b)[_0xd99c('0x14')](function(_0x4e2c7e){_0x55e3f3(null,_[_0xd99c('0x4a')](_0x4e2c7e)?![]:!![]);})[_0xd99c('0x16')](function(_0x523582){logger[_0xd99c('0x36')](_0x523582);_0x55e3f3(null,![]);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x58')]=function(_0x4f8e66,_0x548b34){var _0x31095d={'role':_0xd99c('0x55')};_0x31095d[_0x4f8e66]=this[_0xd99c('0xe')][_0xd99c('0x3f')];var _0x4965f2=_0x4f8e66!=_0xd99c('0x59')?util[_0xd99c('0x2d')](_0xd99c('0x5a'),_0xd99c('0x5b'),this[_0xd99c('0xe')][_0xd99c('0x3f')]):undefined;this[_0xd99c('0xf')][_0xd99c('0x58')](_0x31095d,_0x4965f2)[_0xd99c('0x14')](function(_0x3a2e66){_0x548b34(null,_['isNil'](_0x3a2e66)?![]:!![]);})[_0xd99c('0x16')](function(_0x48b2e4){logger[_0xd99c('0x36')](_0x48b2e4);_0x548b34(null,![]);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x5c')]=function(_0x3ceaa7,_0x1b4f6c){sh[_0xd99c('0x5d')](_[_0xd99c('0x5e')](_0x3ceaa7),function(_0x1a9126,_0x3d90c3){var _0x5995d8=_0x3d90c3['replace'](/(\r\n|\n|\r)/gm,'');_0x1b4f6c(null,_0x5995d8);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x5f')]=function(_0x16f796,_0x1aa66c){scripts[_0xd99c('0x5f')](_0x16f796[_0xd99c('0x60')],_0x16f796[_0xd99c('0x61')]||_0xd99c('0x62'),_0x16f796[_0xd99c('0x62')],_0x16f796[_0xd99c('0x63')]||_0xd99c('0x64'),_0x16f796[_0xd99c('0x65')]||_0xd99c('0x66'),_0x16f796[_0xd99c('0x67')]||_0xd99c('0x68'))[_0xd99c('0x14')](function(_0xeea174){_0x1aa66c(null,_0xeea174);})[_0xd99c('0x16')](function(_0x3a25c3){_0x1aa66c(_0x3a25c3);});};AGIVertices[_0xd99c('0x11')]['googleTTS']=function(_0x200628,_0x535787){scripts[_0xd99c('0x69')](_0x200628[_0xd99c('0x62')],_0x200628['google_tts_language']||'en',0x1)[_0xd99c('0x14')](function(_0x40acec){_0x535787(null,_0x40acec);})[_0xd99c('0x16')](function(_0x3dab1a){_0x535787(_0x3dab1a);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x6a')]=function(_0x49ff7c,_0x2f7ca9){var _0x57770b={'uri':_0x49ff7c[_0xd99c('0x6b')],'method':_0x49ff7c[_0xd99c('0x6c')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x49ff7c[_0xd99c('0x6d')])===_0xd99c('0x6e')&&parseInt(_0x49ff7c[_0xd99c('0x6d')])>=0x1?parseInt(_0x49ff7c['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xd99c('0x6f')]([_0xd99c('0x70'),_0xd99c('0x71')],_0x57770b['method'][_0xd99c('0x72')]())){try{_0x57770b[_0xd99c('0x73')]=_0x49ff7c[_0xd99c('0xc')]?JSON[_0xd99c('0x74')](_0x49ff7c['rawBody']):{};}catch(_0x35091a){logger[_0xd99c('0x36')](_0xd99c('0x75'),_0x35091a);}}try{_0x57770b[_0xd99c('0x76')]=_0x49ff7c[_0xd99c('0x77')]?JSON[_0xd99c('0x74')](_0x49ff7c[_0xd99c('0x77')]):{};}catch(_0x250318){logger[_0xd99c('0x36')](_0xd99c('0x78'),_0x250318);}if(_0x49ff7c[_0xd99c('0x79')]){try{var _0xb30a1f=require(_0x49ff7c[_0xd99c('0x79')])[_0xd99c('0x7a')](this,_0x57770b);_0x57770b[_0xd99c('0x7b')]=Mustache[_0xd99c('0x7c')](_0x49ff7c[_0xd99c('0x6b')],_0xb30a1f,{},['$$','$$']);if(_0x57770b['headers']){_0x57770b[_0xd99c('0x76')]=JSON['parse'](Mustache[_0xd99c('0x7c')](JSON[_0xd99c('0x7d')](_0x57770b[_0xd99c('0x76')]),_0xb30a1f,{},['$$','$$']));}if(_0x57770b[_0xd99c('0x73')]){_0x57770b[_0xd99c('0x73')]=JSON['parse'](Mustache[_0xd99c('0x7c')](JSON[_0xd99c('0x7d')](_0x57770b[_0xd99c('0x73')]),_0xb30a1f,{},['$$','$$']));}}catch(_0xd6d48c){logger['error'](_0xd99c('0x7e'),_0xd6d48c);}}rp(_0x57770b)[_0xd99c('0x14')](function(_0x1d8cc0){var _0x3df182={'statusCode':_0x1d8cc0[_0xd99c('0x7f')]||0xc8,'statusMessage':_0x1d8cc0[_0xd99c('0x80')]||'OK','headers':_0x1d8cc0[_0xd99c('0x76')]||{},'body':_0x1d8cc0[_0xd99c('0x73')]||{}};_0x2f7ca9(null,_0x3df182);})[_0xd99c('0x16')](function(_0x37aedc){var _0x159a5a={'statusCode':_0x37aedc[_0xd99c('0x7f')]||0x1f4,'statusMessage':_0x37aedc[_0xd99c('0x81')]||_0xd99c('0x82'),'headers':_0x37aedc[_0xd99c('0x83')][_0xd99c('0x76')]||{},'body':_0x37aedc[_0xd99c('0x83')][_0xd99c('0x73')]||{}};_0x2f7ca9(null,_0x159a5a);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x84')]=function(_0x1a1cba,_0x22dcdf){scripts[_0xd99c('0x84')](this['channel'][_0xd99c('0x3b')],_0x1a1cba['key'],_0x1a1cba[_0xd99c('0x62')],_0x1a1cba[_0xd99c('0x85')]||'en')[_0xd99c('0x14')](function(_0x20028b){_0x22dcdf(null,_0x20028b);})[_0xd99c('0x16')](function(_0x292d1f){_0x22dcdf(_0x292d1f);});};AGIVertices[_0xd99c('0x11')]['googleDialogflowV2']=function(_0x138c18,_0x18efff){scripts['googleDialogflowV2'](this['channel']['uniqueid'],_0x138c18[_0xd99c('0x86')],_0x138c18[_0xd99c('0x87')],_0x138c18[_0xd99c('0x88')],_0x138c18[_0xd99c('0x62')],_0x138c18[_0xd99c('0x89')]||'en')[_0xd99c('0x14')](function(_0x2c3819){_0x18efff(null,_0x2c3819);})[_0xd99c('0x16')](function(_0x5e3676){_0x18efff(_0x5e3676);});};AGIVertices['prototype']['sestekNDA']=function(_0x4a9967,_0x369a1a){scripts[_0xd99c('0x8a')](this[_0xd99c('0xe')],_0x4a9967)[_0xd99c('0x14')](function(_0x195346){_0x369a1a(null,_0x195346);})['catch'](function(_0x5ade1f){_0x369a1a(_0x5ade1f);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x8b')]=function(_0x5265cd,_0x1a022a){scripts[_0xd99c('0x8b')](_0x5265cd[_0xd99c('0x8c')],_0x5265cd[_0xd99c('0x62')],_0x5265cd['ispeech_tts_language']||_0xd99c('0x64'),_0x5265cd['speed'])[_0xd99c('0x14')](function(_0x53ae04){_0x1a022a(null,_0x53ae04);})[_0xd99c('0x16')](function(_0x68789){_0x1a022a(_0x68789);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x8d')]=function(_0x10ccb8,_0x9e5aa2,_0x46df14){scripts[_0xd99c('0x8d')](_0x9e5aa2,_0x10ccb8[_0xd99c('0x8c')],_0x10ccb8[_0xd99c('0x8e')]||_0xd99c('0x64'),this[_0xd99c('0x8f')](_0x10ccb8[_0xd99c('0x90')])?_0x10ccb8[_0xd99c('0x90')]:undefined)[_0xd99c('0x14')](function(_0x205399){_0x46df14(null,_0x205399);})[_0xd99c('0x16')](function(_0x3283eb){_0x46df14(_0x3283eb);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x91')]=function(_0x53de92,_0x447fa0){scripts['awsPolly'](_0x53de92[_0xd99c('0x92')],_0x53de92[_0xd99c('0x93')],_0x53de92[_0xd99c('0x94')],_0x53de92[_0xd99c('0x95')]||'Amy',_0x53de92[_0xd99c('0x62')],_0x53de92[_0xd99c('0x96')]||_0xd99c('0x62'))[_0xd99c('0x14')](function(_0x24f404){_0x447fa0(null,_0x24f404);})[_0xd99c('0x16')](function(_0x26d950){_0x447fa0(_0x26d950);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x97')]=function(_0x3763c8,_0x322f40){scripts['awsLex'](this[_0xd99c('0xe')][_0xd99c('0x3b')],_0x3763c8[_0xd99c('0x92')],_0x3763c8[_0xd99c('0x93')],_0x3763c8[_0xd99c('0x98')],_0x3763c8[_0xd99c('0x62')],_0x3763c8[_0xd99c('0x99')])[_0xd99c('0x14')](function(_0x4fd424){_0x322f40(null,_0x4fd424);})[_0xd99c('0x16')](function(_0x261278){_0x322f40(_0x261278);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x9a')]=function(_0x2eeb8e,_0x3dc415,_0x4ef61a){scripts[_0xd99c('0x9a')](_0x3dc415,_0x2eeb8e[_0xd99c('0x8c')],_0x2eeb8e['google_asr_language']||'en-US')['then'](function(_0x4297df){_0x4ef61a(null,_0x4297df);})['catch'](function(_0xd0e03b){_0x4ef61a(_0xd0e03b);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x9b')]=function(_0x3ea616,_0x5b8ae0,_0x261c1c){scripts[_0xd99c('0x9b')](_0x5b8ae0,_0x3ea616['appid'],_0x3ea616['appsecret'],_0x3ea616['uri'])['then'](function(_0xfdb381){_0x261c1c(null,_0xfdb381);})[_0xd99c('0x16')](function(_0x21c035){_0x261c1c(_0x21c035);});};AGIVertices[_0xd99c('0x11')][_0xd99c('0x9c')]=function(_0x558d35){var _0x10db38=_[_0xd99c('0x6f')](verticesWithRetry,_0x558d35[_0xd99c('0x3d')])?_0x558d35:_['clone'](_0x558d35);for(var _0x4dba69 in _0x10db38){if(_0x10db38['hasOwnProperty'](_0x4dba69)){if(_0x10db38[_0x4dba69]&&_[_0xd99c('0x9d')](_0x10db38[_0x4dba69])){if(_[_0xd99c('0x6f')](recursiveMapAttributes,_0x4dba69)){_0x10db38[_0x4dba69]=this[_0xd99c('0x9e')](_0x10db38[_0x4dba69]);}else{_0x10db38[_0x4dba69]=this[_0xd99c('0x9f')](_0x10db38[_0x4dba69]);}}}}return _0x10db38;};AGIVertices[_0xd99c('0x11')]['recursiveNodeIndex']=function(_0x332cff){for(var _0x219596 in _0x332cff){if(_0x332cff[_0xd99c('0xa0')](_0x219596)){if(_[_0xd99c('0xa1')](_0x332cff[_0x219596])){this[_0xd99c('0xa2')](_0x332cff[_0x219596]);}else if(_[_0xd99c('0xa3')](_0x332cff[_0x219596])){for(var _0x11de47=0x0;_0x11de47<_0x332cff[_0x219596][_0xd99c('0xa4')];_0x11de47++){this[_0xd99c('0xa2')](_0x332cff[_0x219596][_0x11de47]);}}else if(_['isString'](_0x332cff[_0x219596])){_0x332cff[_0x219596]=this[_0xd99c('0x9f')](_0x332cff[_0x219596]);}}}};AGIVertices[_0xd99c('0x11')][_0xd99c('0xa5')]=function(_0x51b98d,_0x51b9f8){for(var _0xc339e9 in _0x51b98d){if(_0x51b98d[_0xd99c('0xa0')](_0xc339e9)){if(_['isPlainObject'](_0x51b98d[_0xc339e9])){if(!_['isEmpty'](_0x51b98d[_0xc339e9])){this[_0xd99c('0xa5')](_0x51b98d[_0xc339e9],util[_0xd99c('0x2d')](_0xd99c('0xa6'),_0x51b9f8,_0xc339e9));}}else if(_[_0xd99c('0xa3')](_0x51b98d[_0xc339e9])){for(var _0x2fbb20=0x0;_0x2fbb20<_0x51b98d[_0xc339e9][_0xd99c('0xa4')];_0x2fbb20++){this['saveRestApiResult'](_0x51b98d[_0xc339e9][_0x2fbb20],util[_0xd99c('0x2d')](_0xd99c('0xa6'),_0x51b9f8,_0xc339e9+'['+_0x2fbb20+']'));}}else{if(!_[_0xd99c('0x4a')](_0x51b98d[_0xc339e9])){this[_0xd99c('0xe')][_0xd99c('0xa7')](util['format'](_0xd99c('0xa6'),_0x51b9f8,_0xc339e9),_0x51b98d[_0xc339e9]);}}}}};AGIVertices[_0xd99c('0x11')]['replaceObjectAllVariables']=function(_0x14c603){try{var _0x164a8b=JSON[_0xd99c('0x74')](_0x14c603);this[_0xd99c('0xa2')](_0x164a8b);return JSON[_0xd99c('0x7d')](_0x164a8b);}catch(_0x5b514e){return this[_0xd99c('0x9f')](_0x14c603);}};AGIVertices[_0xd99c('0x11')][_0xd99c('0x9f')]=function(_0xa90040){var _0x431b08=_0xa90040[_0xd99c('0xa8')]('{');for(var _0x45b5eb=0x1;_0x45b5eb<_0x431b08[_0xd99c('0xa4')];_0x45b5eb+=0x1){var _0x331512=_0x431b08[_0x45b5eb]['split']('}');if(_0x331512[_0xd99c('0xa4')]>0x1){_0xa90040=_0xa90040[_0xd99c('0xa9')]('{'+_0x331512[0x0]+'}',this['channel'][_0xd99c('0x12')](_0x331512[0x0])[_0xd99c('0xaa')]||_0x331512[0x0]);}}if(_0x431b08[_0xd99c('0xa4')]===0x1){return _0xa90040[_0xd99c('0xab')]();}return this['replaceAllVariables'](_0xa90040);};AGIVertices['prototype']['getAndSetVariable']=function(_0x45d786,_0x483a8d){var _0xadb9ed=this['channel'][_0xd99c('0x12')](_0x45d786);if(_0xadb9ed[_0xd99c('0xac')]===-0x1){return _0xadb9ed;}logger['info'](util[_0xd99c('0x2d')](_0xd99c('0xad'),_0x483a8d,_0xadb9ed[_0xd99c('0xaa')]));return this[_0xd99c('0xe')][_0xd99c('0xa7')](_0x483a8d,_0xadb9ed[_0xd99c('0xaa')]);};AGIVertices[_0xd99c('0x11')][_0xd99c('0x8f')]=function(_0x109bb8){return _0x109bb8&&_0x109bb8!=='0'&&_0x109bb8!=='-1'&&_0x109bb8!=='';};AGIVertices[_0xd99c('0x11')]['maxRetry']=function(_0x368683){this[_0xd99c('0x3a')][_0xd99c('0x7a')](this,_0x368683,'-');_0x368683['retry']=_0x368683[_0xd99c('0xae')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x70f542){logger['info'](util[_0xd99c('0x2d')](_0xd99c('0xaf'),_0x70f542['label']));if(!this[_0xd99c('0x8f')](_0x70f542['text'])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0xb1'));}var _0x1f3945='\x22'+_0x70f542[_0xd99c('0x62')]+'\x22';if(this['isConfigured'](_0x70f542[_0xd99c('0x83')])){_0x1f3945+=','+_0x70f542[_0xd99c('0x83')];}var _0x5b22ea=this['channel'][_0xd99c('0x5d')](_0xd99c('0xb2'),_0x1f3945);if(_0x5b22ea[_0xd99c('0xac')]===-0x1){return _0x5b22ea;}return this[_0xd99c('0xe')][_0xd99c('0xb0')](util['format'](_0xd99c('0xb3'),_0x1f3945));};AGIVertices['prototype'][_0xd99c('0xb4')]=function(_0x282a8f){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x282a8f[_0xd99c('0x3c')]));if(!this[_0xd99c('0x8f')](_0x282a8f['grammar'])){return this['channel'][_0xd99c('0xb0')](_0xd99c('0xb5'));}var _0x476979=_0x282a8f[_0xd99c('0xb6')];if(this[_0xd99c('0x8f')](_0x282a8f[_0xd99c('0x83')])){_0x476979+=','+_0x282a8f['options'];}var _0x4f87d3=this[_0xd99c('0xe')][_0xd99c('0x5d')](_0xd99c('0xb7'),_0x476979);if(_0x4f87d3[_0xd99c('0xac')]===-0x1){return _0x4f87d3;}var _0x5caaa4=this['getAndSetVariable'](_0xd99c('0xb8'),_0xd99c('0xb9'));if(_0x5caaa4['result']===-0x1){return _0x5caaa4;}var _0x22c81d=this[_0xd99c('0xba')](_0xd99c('0xbb'),'MRCP_RECOG_TRANSCRIPT');if(_0x22c81d['result']===-0x1){return _0x22c81d;}var _0x4d762a=this['getAndSetVariable'](_0xd99c('0xbc'),_0xd99c('0xbd'));if(_0x4d762a[_0xd99c('0xac')]===-0x1){return _0x4d762a;}return this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')]('Executed\x20command\x20MRCPRecog\x20%s',_0x476979));};AGIVertices[_0xd99c('0x11')][_0xd99c('0x8')]=function(_0x369def){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0xbe'),_0x369def['label']));return this[_0xd99c('0xe')][_0xd99c('0x8')]([_0x369def[_0xd99c('0xbf')],_0x369def['args']]);};AGIVertices[_0xd99c('0x11')][_0xd99c('0xc0')]=function(_0x1ecc8a){logger['info'](util[_0xd99c('0x2d')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x1ecc8a[_0xd99c('0x3c')]));if(this[_0xd99c('0x8f')](_0x1ecc8a[_0xd99c('0x6d')])){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0xc1'),_0x1ecc8a[_0xd99c('0x6d')]));var _0x1e3dbd=this[_0xd99c('0xe')][_0xd99c('0xc2')](_0x1ecc8a[_0xd99c('0x6d')]);if(_0x1e3dbd[_0xd99c('0xac')]===-0x1){return _0x1e3dbd;}}return this[_0xd99c('0xe')]['answer']();};AGIVertices[_0xd99c('0x11')][_0xd99c('0x51')]=function(_0x1e7eab){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0xc3'),_0x1e7eab[_0xd99c('0x3c')]));if(!this['isConfigured'](_0x1e7eab['list_id'])){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x1e7eab,_0xd99c('0xc4'));}_0x1e7eab[_0xd99c('0x50')]=moment();if(this['isConfigured'](_0x1e7eab[_0xd99c('0xc5')])){_0x1e7eab[_0xd99c('0x50')]=moment()[_0xd99c('0xc6')](_0x1e7eab[_0xd99c('0xc5')],_0xd99c('0xc7'));}if(!this[_0xd99c('0x8f')](_0x1e7eab[_0xd99c('0x52')])){_0x1e7eab[_0xd99c('0x52')]=0x2;}this[_0xd99c('0x48')][_0xd99c('0x7a')](this,_0x1e7eab);return this['channel'][_0xd99c('0xb0')](util['format'](_0xd99c('0xc8'),_0x1e7eab['phone'],_0x1e7eab[_0xd99c('0x4f')],_0x1e7eab[_0xd99c('0x50')]));};AGIVertices[_0xd99c('0x11')][_0xd99c('0xc9')]=function(_0x346772){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0xca'),_0x346772[_0xd99c('0x3c')]));var _0x515ee0=this['channel'][_0xd99c('0x5d')](_0x346772['application'],_0x346772['options']);if(_0x515ee0['result']===-0x1){return _0x515ee0;}return this[_0xd99c('0xe')][_0xd99c('0xb0')](util['format'](_0xd99c('0xcb'),_0x346772[_0xd99c('0xcc')],_0x346772[_0xd99c('0x83')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x438bce){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0xcd'),_0x438bce[_0xd99c('0x3c')]));if(!this['isConfigured'](_0x438bce[_0xd99c('0x62')])){return this['channel'][_0xd99c('0xb0')](_0xd99c('0xb1'));}var _0x13e089='\x22'+_0x438bce[_0xd99c('0x62')]+'\x22';if(this['isConfigured'](_0x438bce['options'])){_0x13e089+=','+_0x438bce[_0xd99c('0x83')];}var _0x1f84bf=this[_0xd99c('0xe')][_0xd99c('0x5d')](_0xd99c('0xb2'),_0x13e089);if(_0x1f84bf[_0xd99c('0xac')]===-0x1){return _0x1f84bf;}return this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')]('Executed\x20command\x20MRCPSynth\x20%s',_0x13e089));};AGIVertices[_0xd99c('0x11')]['sestektts']=function(_0x4fa5ba){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x4fa5ba[_0xd99c('0x3c')]));if(!this[_0xd99c('0x8f')](_0x4fa5ba[_0xd99c('0x62')])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0xb1'));}var _0x22009d='\x22'+_0x4fa5ba[_0xd99c('0x62')]+'\x22';if(this[_0xd99c('0x8f')](_0x4fa5ba[_0xd99c('0x83')])){_0x22009d+=','+_0x4fa5ba['options'];}var _0x447dbe=this['channel'][_0xd99c('0x5d')](_0xd99c('0xb2'),_0x22009d);if(_0x447dbe[_0xd99c('0xac')]===-0x1){return _0x447dbe;}return this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0xb3'),_0x22009d));};AGIVertices[_0xd99c('0x11')]['lumenvoxasr']=function(_0x373fb8){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x373fb8[_0xd99c('0x3c')]));if(!this[_0xd99c('0x8f')](_0x373fb8[_0xd99c('0xb6')])){return this['channel']['noop'](_0xd99c('0xb5'));}var _0x44d017=_0x373fb8[_0xd99c('0xb6')];if(this[_0xd99c('0x8f')](_0x373fb8['options'])){_0x44d017+=','+_0x373fb8['options'];}var _0x2cc082=this[_0xd99c('0xe')][_0xd99c('0x5d')](_0xd99c('0xb7'),_0x44d017);if(_0x2cc082['result']===-0x1){return _0x2cc082;}var _0x576a21=this[_0xd99c('0xba')](_0xd99c('0xb8'),_0xd99c('0xce'));if(_0x576a21[_0xd99c('0xac')]===-0x1){return _0x576a21;}var _0x52c06c=this['getAndSetVariable'](_0xd99c('0xbb'),_0xd99c('0xcf'));if(_0x52c06c[_0xd99c('0xac')]===-0x1){return _0x52c06c;}var _0x10dd96=this['getAndSetVariable'](_0xd99c('0xbc'),'LUMENVOX_ASR_INSTANCE');if(_0x10dd96[_0xd99c('0xac')]===-0x1){return _0x10dd96;}return this['channel'][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0xd0'),_0x44d017));};AGIVertices['prototype'][_0xd99c('0xd1')]=function(_0x205526){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x205526[_0xd99c('0x3c')]));if(!this[_0xd99c('0x8f')](_0x205526['grammar'])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0xb5'));}var _0x5c4456=_0x205526[_0xd99c('0xb6')];if(this[_0xd99c('0x8f')](_0x205526[_0xd99c('0x83')])){_0x5c4456+=','+_0x205526['options'];}var _0x523cd4=this[_0xd99c('0xe')][_0xd99c('0x5d')](_0xd99c('0xb7'),_0x5c4456);if(_0x523cd4[_0xd99c('0xac')]===-0x1){return _0x523cd4;}var _0x36a976=this[_0xd99c('0xba')]('RECOG_CONFIDENCE()',_0xd99c('0xd2'));if(_0x36a976[_0xd99c('0xac')]===-0x1){return _0x36a976;}var _0x55a30d=this['getAndSetVariable'](_0xd99c('0xbb'),_0xd99c('0xd3'));if(_0x55a30d['result']===-0x1){return _0x55a30d;}var _0x90acd5=this[_0xd99c('0xba')](_0xd99c('0xbc'),_0xd99c('0xd4'));if(_0x90acd5['result']===-0x1){return _0x90acd5;}return this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5c4456));};AGIVertices[_0xd99c('0x11')][_0xd99c('0xd5')]=function(_0x17990d){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x17990d[_0xd99c('0x3c')]));if(!this[_0xd99c('0x8f')](_0x17990d[_0xd99c('0xd6')])){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x17990d,'no\x20database\x20selected');}var _0xcd41dc=this[_0xd99c('0x1b')][_0xd99c('0x7a')](this,_0x17990d['odbc_id']);if(!_0xcd41dc){return this[_0xd99c('0xe')]['error'](_0x17990d,'no\x20odbc\x20database\x20found');}if(!this[_0xd99c('0x8f')](_0x17990d['query'])){return this['channel']['error'](_0x17990d,_0xd99c('0xd7'));}var _0x351059=_0x17990d[_0xd99c('0xd8')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util[_0xd99c('0x2d')](_0xd99c('0xd9'),_0x351059));var _0x9c1a70=this[_0xd99c('0x2f')][_0xd99c('0x7a')](this,_0xcd41dc,_0x351059);this[_0xd99c('0x3a')]['sync'](this,_0x17990d,_0x351059);if(!this[_0xd99c('0x8f')](_0x17990d[_0xd99c('0xda')])){return this[_0xd99c('0xe')][_0xd99c('0xb0')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x163df2=this[_0xd99c('0x12')][_0xd99c('0x7a')](this,_0x17990d[_0xd99c('0xda')]);if(!_0x163df2){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x17990d,_0xd99c('0xdb'));}var _0x5a5e34=this;_0x9c1a70['forEach'](function(_0x3ed2c7,_0x3869e4){Object[_0xd99c('0xdc')](_0x3ed2c7)[_0xd99c('0xdd')](function(_0x2f92c4){_0x5a5e34[_0xd99c('0xe')][_0xd99c('0xa7')](util['format'](_0xd99c('0xde'),_0x163df2,_0x3869e4,_0x2f92c4),_0x3ed2c7[_0x2f92c4]);});});this[_0xd99c('0xe')]['setVariable'](util[_0xd99c('0x2d')]('%s_ROWS_COUNT',_0x163df2),_0x9c1a70['length']);return this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0xdf'),_0x163df2));};AGIVertices[_0xd99c('0x11')][_0xd99c('0xe0')]=function(_0x596908){logger[_0xd99c('0xe1')](util[_0xd99c('0x2d')](_0xd99c('0xe2'),_0x596908['label']));if(!this['isConfigured'](_0x596908[_0xd99c('0xe3')])){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x596908,_0xd99c('0xe4'));}var _0x5dcb72=this[_0xd99c('0x1e')]['sync'](this,_0x596908['sip_id']);if(!_0x5dcb72){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x596908,_0xd99c('0xe5'));}var _0x6d3341=this[_0xd99c('0xe')][_0xd99c('0x5d')](_0xd99c('0xe6'),[util[_0xd99c('0x2d')](_0xd99c('0xe7'),_0x5dcb72),_0x596908[_0xd99c('0x6d')],_0x596908['opts'],_0x596908[_0xd99c('0x6b')]]);if(_0x6d3341[_0xd99c('0xac')]===-0x1){return _0x6d3341;}return this['channel'][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0xe8'),_0xd99c('0xe6')));};AGIVertices[_0xd99c('0x11')]['dialogflow']=function(_0x1b4952){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0xe9'),_0x1b4952['label']));if(!this[_0xd99c('0x8f')](_0x1b4952[_0xd99c('0x8c')])){return this[_0xd99c('0xe')][_0xd99c('0xb0')]('no\x20key\x20configured');}if(!this[_0xd99c('0x8f')](_0x1b4952[_0xd99c('0x62')])){return this['channel']['noop']('no\x20text\x20configured');}this['channel'][_0xd99c('0xea')]=!![];this['createSquareDetailsReport'](_0x1b4952);this[_0xd99c('0x47')](_0x1b4952[_0xd99c('0x62')],'in','','');this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')]('Trying\x20Dialogflow:\x20%s',_0x1b4952['text']));var _0x56555a=this[_0xd99c('0x84')]['sync'](this,_0x1b4952);if(_0x56555a){for(var _0x5494d0 in _0x56555a){if(_0x56555a['hasOwnProperty'](_0x5494d0)){this['channel'][_0xd99c('0xa7')](util['format'](_0xd99c('0xeb'),_0x5494d0['toUpperCase']()),_0x56555a[_0x5494d0]);}}this[_0xd99c('0x47')](_0x56555a[_0xd99c('0xec')],_0xd99c('0xed'),_0xd99c('0xee'),'');return this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0xef'),_0x56555a[_0xd99c('0xec')]));}return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x1b4952,_0xd99c('0xf0'));};AGIVertices[_0xd99c('0x11')][_0xd99c('0xf1')]=function(_0x1993b9){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0xf2'),_0x1993b9['label']));if(!this['isConfigured'](_0x1993b9['dialogflowV2_project_id'])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0xf3'));}if(!this[_0xd99c('0x8f')](_0x1993b9[_0xd99c('0x87')])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0xf4'));}if(!this[_0xd99c('0x8f')](_0x1993b9[_0xd99c('0x88')])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0xf5'));}if(!this[_0xd99c('0x8f')](_0x1993b9[_0xd99c('0x89')])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0xf6'));}if(!this[_0xd99c('0x8f')](_0x1993b9[_0xd99c('0x62')])){return this['channel'][_0xd99c('0xb0')](_0xd99c('0xb1'));}this[_0xd99c('0xe')][_0xd99c('0xea')]=!![];this[_0xd99c('0x3a')](_0x1993b9);this[_0xd99c('0x47')](_0x1993b9[_0xd99c('0x62')],'in','','');this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0xf7'),_0x1993b9['text']));var _0x5a32e0=this[_0xd99c('0xf8')][_0xd99c('0x7a')](this,_0x1993b9);if(_0x5a32e0){for(var _0x5ccbdb in _0x5a32e0){if(_0x5a32e0[_0xd99c('0xa0')](_0x5ccbdb)){if(_0x5ccbdb!==_0xd99c('0xf9')){this[_0xd99c('0xe')][_0xd99c('0xa7')](util['format'](_0xd99c('0xeb'),_0x5ccbdb[_0xd99c('0x72')]()),_0x5a32e0[_0x5ccbdb]);}}}this[_0xd99c('0x47')](_0x5a32e0[_0xd99c('0xec')],_0xd99c('0xed'),_0xd99c('0xf1'),_0x5a32e0[_0xd99c('0xf9')]);return this[_0xd99c('0xe')][_0xd99c('0xb0')](util['format'](_0xd99c('0xfa'),_0x5a32e0[_0xd99c('0xec')]));}return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x1993b9,_0xd99c('0xfb'));};AGIVertices['prototype'][_0xd99c('0xfc')]=function(_0x22778b){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0xfd'),_0x22778b['label']));if(!this[_0xd99c('0x8f')](_0x22778b[_0xd99c('0xfe')])){return this[_0xd99c('0xe')]['noop'](_0xd99c('0xff'));}if(!this[_0xd99c('0x8f')](_0x22778b[_0xd99c('0x100')])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0x101'));}if(!this[_0xd99c('0x8f')](_0x22778b[_0xd99c('0x102')])){return this[_0xd99c('0xe')][_0xd99c('0xb0')]('no\x20password\x20configured');}if(!this[_0xd99c('0x8f')](_0x22778b[_0xd99c('0x103')])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0xb1'));}this['channel'][_0xd99c('0xea')]=!![];this[_0xd99c('0x3a')](_0x22778b);this[_0xd99c('0x47')](_0x22778b[_0xd99c('0x62')],'in','','');this['channel'][_0xd99c('0xb0')](util['format'](_0xd99c('0x104'),_0x22778b['text']));var _0x3b347b=this[_0xd99c('0x8a')][_0xd99c('0x7a')](this,_0x22778b);if(_0x3b347b){for(var _0x5a08b2 in _0x3b347b){if(_0x3b347b['hasOwnProperty'](_0x5a08b2)){this[_0xd99c('0xe')][_0xd99c('0xa7')](util['format'](_0xd99c('0x105'),_0x5a08b2[_0xd99c('0x72')]()),_0x3b347b[_0x5a08b2]);}}this['createSquareMessage'](_0x3b347b['speech'],_0xd99c('0xed'),_0xd99c('0xfc'),'');if(_0x3b347b[_0xd99c('0x106')]){this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0x107'),_0x3b347b['audiofile']));var _0x77b668=this[_0xd99c('0xe')][_0xd99c('0x108')](_0x3b347b[_0xd99c('0x106')]);try{fs[_0xd99c('0x109')](_0x3b347b[_0xd99c('0x106')]+_0xd99c('0x10a'));}catch(_0x599048){logger[_0xd99c('0x36')](_0x599048);}return _0x77b668;}else{return this[_0xd99c('0xe')][_0xd99c('0xb0')](util['format']('SestekNDA\x20Result\x20%s',_0x3b347b['speech']));}}return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x22778b,_0xd99c('0x10b'));};AGIVertices[_0xd99c('0x11')][_0xd99c('0x10c')]=function(_0x4aceab){logger[_0xd99c('0x32')](util['format'](_0xd99c('0x10d'),_0x4aceab[_0xd99c('0x3c')]));return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0x10c'));};AGIVertices[_0xd99c('0x11')][_0xd99c('0x10e')]=function(_0x1464ac){logger['info'](util[_0xd99c('0x2d')](_0xd99c('0x10f'),_0x1464ac[_0xd99c('0x3c')]));var _0x1b2ab8='';if(_0x1464ac[_0xd99c('0x110')]){if(!this['isConfigured'](_0x1464ac[_0xd99c('0x110')])){return this[_0xd99c('0xe')]['error'](_0x1464ac,'no\x20trunk\x20selected');}else{var _0x2d7e89=parseInt(_0x1464ac['trunk_id'],0xa);if(isNaN(_0x2d7e89)){_0x1b2ab8=_0x1464ac['trunk_id'];}else{_0x1b2ab8=this[_0xd99c('0x111')][_0xd99c('0x7a')](this,_0x1464ac[_0xd99c('0x110')]);if(!_0x1b2ab8){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x1464ac,'no\x20trunk\x20found');}}}}else if(_0x1464ac[_0xd99c('0x112')]){_0x1b2ab8=_0x1464ac[_0xd99c('0x112')];}else{return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x1464ac,'no\x20trunk\x20selected');}var _0x4ff8ce=this[_0xd99c('0xe')][_0xd99c('0x5d')](_0xd99c('0xe6'),[util[_0xd99c('0x2d')](_0xd99c('0x113'),_0x1b2ab8,_0x1464ac[_0xd99c('0x4e')]),_0x1464ac['timeout'],_0x1464ac[_0xd99c('0x114')],_0x1464ac[_0xd99c('0x6b')]]);if(_0x4ff8ce[_0xd99c('0xac')]===-0x1){return _0x4ff8ce;}return this['channel'][_0xd99c('0xb0')](util[_0xd99c('0x2d')]('Executed\x20command\x20%s',_0xd99c('0xe6')));};AGIVertices[_0xd99c('0x11')][_0xd99c('0x115')]=function(_0x2a014a){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x2a014a[_0xd99c('0x3c')]));return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0x115'));};AGIVertices[_0xd99c('0x11')]['getdigits']=function(_0x129dda){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0x116'),_0x129dda['label']));if(_0x129dda[_0xd99c('0x117')]===0x0){return this[_0xd99c('0xae')](_0x129dda);}_0x129dda[_0xd99c('0x117')]-=0x1;if(!this[_0xd99c('0x8f')](_0x129dda[_0xd99c('0x118')])){return this[_0xd99c('0xe')]['error'](_0x129dda,_0xd99c('0x119'));}var _0x47f682=this['getSound'][_0xd99c('0x7a')](this,_0x129dda[_0xd99c('0x118')]);if(!_0x47f682){return this['channel'][_0xd99c('0x36')](_0x129dda,'no\x20file\x20audio\x20found');}if(!this[_0xd99c('0x8f')](_0x129dda[_0xd99c('0xda')])){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0xd99c('0x11a'));}var _0x37f042=this['channel']['getData'](_0x47f682,_0x129dda[_0xd99c('0x11b')],_0x129dda[_0xd99c('0x11c')]);var _0x59d827=_0x37f042['result']?_0x37f042['result'][_0xd99c('0xab')]():'';logger[_0xd99c('0x32')](_0xd99c('0x11d'),JSON[_0xd99c('0x7d')](_0x37f042));if(_0x37f042[_0xd99c('0xac')]===-0x1){this['createSquareDetailsReport'][_0xd99c('0x7a')](this,_0x129dda,_0x59d827);return _0x37f042;}else if(_0x37f042[_0xd99c('0xaa')]===_0xd99c('0x6d')){_0x37f042['result']=_0x59d827[_0xd99c('0xa4')]>=parseInt(_0x129dda[_0xd99c('0x11e')])?'x':'i';}else{_0x37f042[_0xd99c('0xac')]=_0x59d827[_0xd99c('0xa4')]>=parseInt(_0x129dda[_0xd99c('0x11e')])&&_0x59d827['length']<=parseInt(_0x129dda[_0xd99c('0x11c')])?'x':'i';}var _0xccc7=this[_0xd99c('0x12')][_0xd99c('0x7a')](this,_0x129dda[_0xd99c('0xda')]);if(!_0xccc7){return this['channel']['error'](_0x129dda,_0xd99c('0xdb'));}this[_0xd99c('0xe')]['setVariable'](_0xccc7,_0x59d827);if(this['isConfigured'](_0x129dda[_0xd99c('0x11f')])){var _0x1122a1=parseInt(_0x129dda['hiddendigitsnum'],0xa);var _0x4db066=rs[_0xd99c('0x120')]({'charset':'*','length':_0x1122a1});var _0x3fb201=_0x59d827[_0xd99c('0xa4')];if(_0x3fb201>0x0){if(_0x3fb201>_0x1122a1){this[_0xd99c('0x3a')]['sync'](this,_0x129dda,_0x129dda[_0xd99c('0x121')]===_0xd99c('0x122')?_0x4db066+_0x59d827['substr'](_0x1122a1):_0x59d827[_0xd99c('0x123')](0x0,_0x3fb201-_0x1122a1)+_0x4db066);}else{this[_0xd99c('0x3a')][_0xd99c('0x7a')](this,_0x129dda,rs[_0xd99c('0x120')]({'charset':'*','length':_0x3fb201}));}}else{this[_0xd99c('0x3a')]['sync'](this,_0x129dda,'');}}else{this['createSquareDetailsReport'][_0xd99c('0x7a')](this,_0x129dda,_0x59d827);}return _0x37f042;};AGIVertices[_0xd99c('0x11')][_0xd99c('0xd')]=function(_0x416929){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0x124'),_0x416929['label']));return this[_0xd99c('0x125')](_0x416929);};AGIVertices['prototype'][_0xd99c('0x126')]=function(_0xb8e2fe){logger['info'](util[_0xd99c('0x2d')](_0xd99c('0x127'),_0xb8e2fe[_0xd99c('0x3c')]));this[_0xd99c('0x3a')][_0xd99c('0x7a')](this,_0xb8e2fe,_0xb8e2fe[_0xd99c('0x128')]);return this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0x129'),_0xb8e2fe[_0xd99c('0x128')]));};AGIVertices[_0xd99c('0x11')][_0xd99c('0x12a')]=function(_0x4ae71f){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x4ae71f['label']));if(!this[_0xd99c('0x8f')](_0x4ae71f['aws_access_key_id'])||!this[_0xd99c('0x8f')](_0x4ae71f['aws_secret_access_key'])){return this[_0xd99c('0xe')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0xd99c('0x8f')](_0x4ae71f[_0xd99c('0x62')])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0xb1'));}this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')]('Trying\x20aws\x20Polly\x20%s',_0x4ae71f[_0xd99c('0x62')]));var _0xcfc812=this[_0xd99c('0x91')][_0xd99c('0x7a')](this,_0x4ae71f);if(_0xcfc812){this['channel'][_0xd99c('0xb0')](util['format'](_0xd99c('0x12b'),_0xcfc812));var _0x549be0=this[_0xd99c('0xe')]['streamFile'](_0xcfc812);try{fs['unlink'](_0xcfc812+_0xd99c('0x10a'));}catch(_0x19a12a){logger[_0xd99c('0x36')](_0x19a12a);}return _0x549be0;}return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x4ae71f,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0xd99c('0x12c')]=function(_0x3da37b){logger[_0xd99c('0x32')](util['format'](_0xd99c('0x12d'),_0x3da37b['label']));if(!this[_0xd99c('0x8f')](_0x3da37b[_0xd99c('0x92')])||!this['isConfigured'](_0x3da37b['aws_secret_access_key'])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0x12e'));}if(!this[_0xd99c('0x8f')](_0x3da37b[_0xd99c('0x99')])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0x12f'));}if(!this[_0xd99c('0x8f')](_0x3da37b['text'])){return this[_0xd99c('0xe')][_0xd99c('0xb0')]('no\x20text\x20configured');}this[_0xd99c('0xe')][_0xd99c('0xea')]=!![];this['createSquareDetailsReport'](_0x3da37b);this[_0xd99c('0x47')](_0x3da37b['text'],'in','','');this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0x130'),_0x3da37b['text']));var _0x2241d5=this[_0xd99c('0x97')][_0xd99c('0x7a')](this,_0x3da37b);if(_0x2241d5){for(var _0x12e6c2 in _0x2241d5){if(_0x2241d5['hasOwnProperty'](_0x12e6c2)&&_['isString'](_0x2241d5[_0x12e6c2])){this[_0xd99c('0xe')]['setVariable'](util[_0xd99c('0x2d')](_0xd99c('0x131'),_0x12e6c2[_0xd99c('0x72')]()),_0x2241d5[_0x12e6c2]);}}if(_[_0xd99c('0x4a')](_0x2241d5['message'])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0x132'));}else{this[_0xd99c('0x47')](_0x2241d5[_0xd99c('0x81')],_0xd99c('0xed'),_0xd99c('0x133'),'');return this['channel'][_0xd99c('0xb0')](util[_0xd99c('0x2d')]('Amazon\x20Lex\x20Result\x20%s',_0x2241d5['message']));}}return this['channel']['error'](_0x3da37b,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices['prototype']['googleasr']=function(_0x5a7c50){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0x134'),_0x5a7c50[_0xd99c('0x3c')],_0x5a7c50[_0xd99c('0x6d')]));if(!this[_0xd99c('0x8f')](_0x5a7c50['key'])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0x135'));}var _0x2eef4b=_0xd99c('0x136');var _0x46edc6=util[_0xd99c('0x2d')](_0xd99c('0x137'),FILES_PATH,rs[_0xd99c('0x120')](0x4));var _0x1a2f90=util[_0xd99c('0x2d')](_0xd99c('0xa6'),_0x46edc6,_0x2eef4b);var _0x5c56cf=!![];if(_0x5a7c50[_0xd99c('0x138')]===_0xd99c('0x139')){_0x5c56cf=![];}var _0x1c2d11=this[_0xd99c('0xe')][_0xd99c('0x13a')](_0x46edc6,_0x2eef4b,_0x5a7c50[_0xd99c('0x13b')],_0x5a7c50[_0xd99c('0x6d')],undefined,_0x5c56cf);if(_0x1c2d11[_0xd99c('0xac')]!==-0x1){this[_0xd99c('0xe')][_0xd99c('0xb0')](util['format'](_0xd99c('0x13c'),_0x1a2f90));var _0x379e00=this['googleASR']['sync'](this,_0x5a7c50,_0x1a2f90);if(_0x379e00){for(var _0x74ec in _0x379e00){if(_0x379e00[_0xd99c('0xa0')](_0x74ec)){this[_0xd99c('0xe')][_0xd99c('0xa7')](util['format'](_0xd99c('0x13d'),_0x74ec[_0xd99c('0x72')]()),_0x379e00[_0x74ec]);}}return this['channel'][_0xd99c('0xb0')](util[_0xd99c('0x2d')]('GoogleASR\x20Result\x20%s',JSON['stringify'](_0x379e00)));}}return _0x1c2d11;};AGIVertices[_0xd99c('0x11')]['tildeasr']=function(_0x439d81){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x439d81['label']));if(!this[_0xd99c('0x8f')](_0x439d81['appid'])){return this[_0xd99c('0xe')][_0xd99c('0xb0')]('no\x20appid\x20configured');}if(!this[_0xd99c('0x8f')](_0x439d81['appsecret'])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0x13e'));}var _0x17d346=_0xd99c('0x136');var _0x44c789=util[_0xd99c('0x2d')](_0xd99c('0x137'),FILES_PATH,rs[_0xd99c('0x120')](0x4));var _0x4636af=util[_0xd99c('0x2d')](_0xd99c('0xa6'),_0x44c789,_0x17d346);var _0x217b4e=!![];if(_0x439d81[_0xd99c('0x138')]===_0xd99c('0x139')){_0x217b4e=![];}var _0x211f5c=this[_0xd99c('0xe')]['recordFile'](_0x44c789,_0x17d346,_0x439d81['intKey'],_0x439d81[_0xd99c('0x6d')],undefined,_0x217b4e);if(_0x211f5c[_0xd99c('0xac')]!==-0x1){this[_0xd99c('0xe')]['noop'](util['format'](_0xd99c('0x13f'),_0x4636af));var _0x47cc4b=this[_0xd99c('0x9b')][_0xd99c('0x7a')](this,_0x439d81,_0x4636af);if(_0x47cc4b){for(var _0x33deee in _0x47cc4b){if(_0x47cc4b['hasOwnProperty'](_0x33deee)){this[_0xd99c('0xe')][_0xd99c('0xa7')](util[_0xd99c('0x2d')](_0xd99c('0x140'),_0x33deee['toUpperCase']()),_0x47cc4b[_0x33deee]);}}return this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')]('TildeASR\x20Result\x20%s',JSON['stringify'](_0x47cc4b)));}}return _0x211f5c;};AGIVertices[_0xd99c('0x11')][_0xd99c('0x141')]=function(_0x38cb7d){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0x142'),_0x38cb7d[_0xd99c('0x3c')]));return this['channel'][_0xd99c('0x143')](_0x38cb7d['context'],_0x38cb7d[_0xd99c('0x42')],_0x38cb7d[_0xd99c('0x43')]);};AGIVertices[_0xd99c('0x11')][_0xd99c('0x144')]=function(_0x304e48){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0x145'),_0x304e48[_0xd99c('0x3c')]));if(!this[_0xd99c('0x8f')](_0x304e48[_0xd99c('0x146')])){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x304e48,_0xd99c('0x147'));}try{var _0x28ec82=eval(_0x304e48['condition'])?_0xd99c('0x148'):_0xd99c('0x149');this[_0xd99c('0xe')][_0xd99c('0xb0')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x304e48[_0xd99c('0x146')],_0x28ec82));return{'code':0xc8,'result':_0x28ec82};}catch(_0x3f5b32){return{'code':0xc8,'result':_0xd99c('0x149')};}};AGIVertices[_0xd99c('0x11')][_0xd99c('0x14a')]=function(_0x5d4ab9){logger[_0xd99c('0x32')](util['format'](_0xd99c('0x14b'),_0x5d4ab9['label']));if(!this[_0xd99c('0x8f')](_0x5d4ab9[_0xd99c('0x14c')])){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x5d4ab9,'no\x20interval\x20configured');}var _0x3a8aa7=this['getIntervals'][_0xd99c('0x7a')](this,_0x5d4ab9[_0xd99c('0x14c')]);if(!_0x3a8aa7){return this['channel'][_0xd99c('0x36')](_0x5d4ab9,_0xd99c('0x14d'));}for(var _0x3eb0fa=0x0;_0x3eb0fa<_0x3a8aa7[_0xd99c('0xa4')];_0x3eb0fa+=0x1){var _0x386cb2=this['channel'][_0xd99c('0x12')](util[_0xd99c('0x2d')](_0xd99c('0x14e'),_0x3a8aa7[_0x3eb0fa]));if(_0x386cb2[_0xd99c('0xac')]===-0x1){return _0x386cb2;}logger['info'](util[_0xd99c('0x2d')](_0xd99c('0x14f'),_0x3a8aa7[_0x3eb0fa],_0x386cb2['extra']));if(_0x386cb2['extra']===_0xd99c('0x148')){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0x14f'),_0x3a8aa7[_0x3eb0fa],'true'));this[_0xd99c('0xe')]['noop'](util[_0xd99c('0x2d')](_0xd99c('0x14f'),_0x3a8aa7[_0x3eb0fa],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0x14f'),_0x3a8aa7[_0x3eb0fa],_0xd99c('0x149')));this[_0xd99c('0xe')][_0xd99c('0xb0')](util['format'](_0xd99c('0x14f'),_0x3a8aa7[_0x3eb0fa],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xd99c('0x11')][_0xd99c('0x150')]=function(_0x5b48a3){logger['info'](util['format'](_0xd99c('0x151'),_0x5b48a3[_0xd99c('0x3c')]));return this['channel'][_0xd99c('0x150')]();};AGIVertices['prototype'][_0xd99c('0x152')]=function(_0x391d26){logger[_0xd99c('0x32')](util['format'](_0xd99c('0x153'),_0x391d26['label']));if(!this['isConfigured'](_0x391d26[_0xd99c('0x8c')])){return this['channel'][_0xd99c('0xb0')](_0xd99c('0x135'));}var _0x520a48='wav';var _0x1ff352=util['format'](_0xd99c('0x137'),FILES_PATH,rs[_0xd99c('0x120')](0x4));var _0x59a241=util[_0xd99c('0x2d')]('%s.%s',_0x1ff352,_0x520a48);var _0x4281f1=!![];if(_0x391d26[_0xd99c('0x138')]===_0xd99c('0x139')){_0x4281f1=![];}var _0x495010=this[_0xd99c('0xe')]['recordFile'](_0x1ff352,_0x520a48,_0x391d26[_0xd99c('0x13b')],_0x391d26[_0xd99c('0x6d')],undefined,_0x4281f1);if(_0x495010[_0xd99c('0xac')]!==-0x1){this['channel'][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0x154'),_0x59a241));var _0x3ad362=this['ispeechASR'][_0xd99c('0x7a')](this,_0x391d26,_0x59a241);if(_0x3ad362){for(var _0x3a6752 in _0x3ad362){if(_0x3ad362[_0xd99c('0xa0')](_0x3a6752)){this[_0xd99c('0xe')][_0xd99c('0xa7')](util[_0xd99c('0x2d')](_0xd99c('0x155'),_0x3a6752[_0xd99c('0x72')]()),_0x3ad362[_0x3a6752]);}}return this[_0xd99c('0xe')]['noop'](util[_0xd99c('0x2d')](_0xd99c('0x156'),JSON[_0xd99c('0x7d')](_0x3ad362)));}}return _0x495010;};AGIVertices[_0xd99c('0x11')]['ispeechtts']=function(_0x69dbaa){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0x157'),_0x69dbaa[_0xd99c('0x3c')]));if(!this[_0xd99c('0x8f')](_0x69dbaa[_0xd99c('0x8c')])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0x135'));}if(!this['isConfigured'](_0x69dbaa[_0xd99c('0x62')])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0xb1'));}this['channel'][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0x158'),_0x69dbaa[_0xd99c('0x62')]));var _0x371290=this[_0xd99c('0x8b')][_0xd99c('0x7a')](this,_0x69dbaa);if(_0x371290){this[_0xd99c('0xe')]['noop'](util['format'](_0xd99c('0x154'),_0x371290));var _0x53ba62=this[_0xd99c('0xe')][_0xd99c('0x108')](_0x371290,_0x69dbaa[_0xd99c('0x13b')]);try{fs['unlink'](_0x371290+_0xd99c('0x10a'));}catch(_0xc5df75){logger[_0xd99c('0x36')](_0xc5df75);}return _0x53ba62;}return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x69dbaa,_0xd99c('0x159'));};AGIVertices[_0xd99c('0x11')][_0xd99c('0x15a')]=function(_0x505af4){logger[_0xd99c('0x32')](util['format'](_0xd99c('0x15b'),_0x505af4['label']));if(!this[_0xd99c('0x8f')](_0x505af4[_0xd99c('0x15c')])){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x505af4,_0xd99c('0x15d'));}logger[_0xd99c('0x32')](util['format'](_0xd99c('0x15e'),this[_0xd99c('0xe')][_0xd99c('0x3f')],_0x505af4[_0xd99c('0x15c')]));var _0x5e5d8a=this[_0xd99c('0x58')][_0xd99c('0x7a')](this,_0x505af4[_0xd99c('0x15c')]);if(_0x5e5d8a){logger[_0xd99c('0x32')](util['format'](_0xd99c('0x15f'),this[_0xd99c('0xe')][_0xd99c('0x3f')],_0x505af4[_0xd99c('0x15c')]));this['channel']['noop'](util[_0xd99c('0x2d')](_0xd99c('0x15f'),this[_0xd99c('0xe')]['callerid'],_0x505af4[_0xd99c('0x15c')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0xd99c('0x160'),this['channel'][_0xd99c('0x3f')],_0x505af4['findBy']));this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0x160'),this[_0xd99c('0xe')][_0xd99c('0x3f')],_0x505af4['findBy']));return{'code':0xc8,'result':_0xd99c('0x161')};}};AGIVertices[_0xd99c('0x11')][_0xd99c('0x162')]=function(_0x2dbf6f){logger[_0xd99c('0x32')](util['format'](_0xd99c('0x163'),_0x2dbf6f['label']));if(!this[_0xd99c('0x8f')](_0x2dbf6f[_0xd99c('0x15c')])){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x2dbf6f,_0xd99c('0x15d'));}logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0x15e'),this[_0xd99c('0xe')][_0xd99c('0x3f')],_0x2dbf6f[_0xd99c('0x15c')]));var _0x3f6180=this[_0xd99c('0x57')][_0xd99c('0x7a')](this,_0x2dbf6f[_0xd99c('0x15c')]);if(_0x3f6180){logger['info'](util['format'](_0xd99c('0x15f'),this['channel'][_0xd99c('0x3f')],_0x2dbf6f[_0xd99c('0x15c')]));this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0x15f'),this['channel'][_0xd99c('0x3f')],_0x2dbf6f[_0xd99c('0x15c')]));return{'code':0xc8,'result':_0xd99c('0x164')};}else{logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0x160'),this['channel']['callerid'],_0x2dbf6f[_0xd99c('0x15c')]));this[_0xd99c('0xe')]['noop'](util['format'](_0xd99c('0x160'),this[_0xd99c('0xe')][_0xd99c('0x3f')],_0x2dbf6f[_0xd99c('0x15c')]));return{'code':0xc8,'result':_0xd99c('0x161')};}};AGIVertices[_0xd99c('0x11')][_0xd99c('0x165')]=function(_0x151dc1){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0x166'),_0x151dc1[_0xd99c('0x3c')]));if(!this[_0xd99c('0x8f')](_0x151dc1[_0xd99c('0x167')])){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x151dc1,_0xd99c('0x168'));}this['channel'][_0xd99c('0xb0')](util['format']('math\x20%s',_0x151dc1[_0xd99c('0x167')]));var _0x1374f2=eval(_0x151dc1[_0xd99c('0x167')]);if(!this[_0xd99c('0x8f')](_0x151dc1['variable_id'])){return this['channel'][_0xd99c('0xb0')](_0xd99c('0x11a'));}var _0x4ecb34=this[_0xd99c('0x12')][_0xd99c('0x7a')](this,_0x151dc1[_0xd99c('0xda')]);if(!_0x4ecb34){return this[_0xd99c('0xe')]['error'](_0x151dc1,_0xd99c('0xdb'));}if(_[_0xd99c('0xa3')](_0x1374f2)){var _0x251874=this;_0x1374f2[_0xd99c('0xdd')](function(_0x1ffb99,_0x56b281){_0x251874[_0xd99c('0xe')][_0xd99c('0xa7')](util[_0xd99c('0x2d')](_0xd99c('0x169'),_0x4ecb34,_0x56b281),_0x1ffb99);});return this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0x16a'),_0x4ecb34));}else{return this[_0xd99c('0xe')][_0xd99c('0xa7')](_0x4ecb34,_0x1374f2);}};AGIVertices[_0xd99c('0x11')][_0xd99c('0x16b')]=function(_0x1f848a){logger['info'](util[_0xd99c('0x2d')](_0xd99c('0x16c'),_0x1f848a[_0xd99c('0x3c')]));if(_0x1f848a[_0xd99c('0x117')]===0x0){return this[_0xd99c('0xae')](_0x1f848a);}_0x1f848a['retry']-=0x1;if(!this[_0xd99c('0x8f')](_0x1f848a[_0xd99c('0x118')])){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x1f848a,'no\x20file\x20audio\x20selected');}var _0x36d3d0=this[_0xd99c('0x20')][_0xd99c('0x7a')](this,_0x1f848a['file_id']);if(!_0x36d3d0){return this[_0xd99c('0xe')]['error'](_0x1f848a,_0xd99c('0x16d'));}var _0x1ae55c=this['channel'][_0xd99c('0x16e')](_0x36d3d0,_0x1f848a[_0xd99c('0x11b')],_0x1f848a['digit']);var _0x25fb66=_0x1ae55c[_0xd99c('0xac')];if(_0x1ae55c['result']===-0x1){this[_0xd99c('0x3a')][_0xd99c('0x7a')](this,_0x1f848a,'-1');return _0x1ae55c;}else if(_0x1ae55c[_0xd99c('0xaa')]===_0xd99c('0x6d')){_0x1ae55c[_0xd99c('0xac')]=_0x1ae55c[_0xd99c('0xac')][_0xd99c('0xa4')]>0x0?_0x1ae55c[_0xd99c('0xac')]:'t';}else if(_['isEmpty'](_0x1ae55c[_0xd99c('0xac')])){_0x1ae55c[_0xd99c('0xac')]='#';_0x25fb66='#';}if(!this['isConfigured'](_0x1f848a[_0xd99c('0xda')])){this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0x11a'));}else{var _0x10c830=this[_0xd99c('0x12')][_0xd99c('0x7a')](this,_0x1f848a[_0xd99c('0xda')]);if(!_0x10c830){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x1f848a,'no\x20variable\x20found');}this['channel'][_0xd99c('0xa7')](_0x10c830,_0x25fb66);}this[_0xd99c('0x3a')][_0xd99c('0x7a')](this,_0x1f848a,_0x25fb66);return _0x1ae55c;};AGIVertices['prototype'][_0xd99c('0xb0')]=function(_0x5bab7b){logger['info'](util[_0xd99c('0x2d')](_0xd99c('0x16f'),_0x5bab7b[_0xd99c('0x3c')]));return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0x5bab7b[_0xd99c('0x170')]||_0x5bab7b['label']);};AGIVertices['prototype'][_0xd99c('0x171')]=function(_0x38290d){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x38290d[_0xd99c('0x3c')]));if(!this[_0xd99c('0x8f')](_0x38290d[_0xd99c('0x15c')])){return this['channel'][_0xd99c('0x36')](_0x38290d,'no\x20find\x20by\x20configured');}logger[_0xd99c('0x32')](util[_0xd99c('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xd99c('0xe')]['callerid'],_0x38290d[_0xd99c('0x15c')]));var _0x4352a0=this[_0xd99c('0x172')][_0xd99c('0x7a')](this,_0x38290d[_0xd99c('0x173')]);var _0xacf1ab=this[_0xd99c('0x54')][_0xd99c('0x7a')](this,_0x38290d[_0xd99c('0x15c')],_0x4352a0);if(_0xacf1ab){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0x15f'),this[_0xd99c('0xe')][_0xd99c('0x3f')],_0x38290d[_0xd99c('0x15c')]));this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0x15f'),this[_0xd99c('0xe')]['callerid'],_0x38290d[_0xd99c('0x15c')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0x160'),this[_0xd99c('0xe')][_0xd99c('0x3f')],_0x38290d['findBy']));this[_0xd99c('0xe')]['noop'](util[_0xd99c('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd99c('0xe')][_0xd99c('0x3f')],_0x38290d[_0xd99c('0x15c')]));return{'code':0xc8,'result':_0xd99c('0x161')};}};AGIVertices[_0xd99c('0x11')][_0xd99c('0x174')]=function(_0x3fee35){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x3fee35[_0xd99c('0x3c')]));if(!this['isConfigured'](_0x3fee35[_0xd99c('0x118')])){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x3fee35,_0xd99c('0x119'));}var _0x309b4b=this[_0xd99c('0x20')][_0xd99c('0x7a')](this,_0x3fee35[_0xd99c('0x118')]);if(!_0x309b4b){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x3fee35,_0xd99c('0x16d'));}var _0x572df2=this[_0xd99c('0xe')]['exec'](_0xd99c('0x175'),[_0x309b4b,_0x3fee35[_0xd99c('0x114')]]);if(_0x572df2[_0xd99c('0xac')]===-0x1){return _0x572df2;}return this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0xcb'),_0xd99c('0x175'),_0x309b4b));};AGIVertices['prototype'][_0xd99c('0x176')]=function(_0x4f42b7){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0x177'),_0x4f42b7[_0xd99c('0x3c')]));if(!this[_0xd99c('0x8f')](_0x4f42b7[_0xd99c('0x178')])){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x4f42b7,'no\x20queue\x20selected');}var _0x3e841a='';var _0x5b4454=parseInt(_0x4f42b7[_0xd99c('0x178')],0xa);if(isNaN(_0x5b4454)){_0x3e841a=_0x4f42b7['queue_id'];}else{_0x3e841a=this[_0xd99c('0x17')][_0xd99c('0x7a')](this,_0x4f42b7['queue_id']);if(!_0x3e841a){return this['channel'][_0xd99c('0x36')](_0x4f42b7,_0xd99c('0x179'));}}var _0xb61841='';if(this['isConfigured'](_0x4f42b7[_0xd99c('0x118')])){var _0x577e86=this[_0xd99c('0x20')]['sync'](this,_0x4f42b7['file_id']);if(_0x577e86){_0xb61841=_0x577e86;}}this[_0xd99c('0x3a')]['sync'](this,_0x4f42b7,_0x3e841a);if(_0x4f42b7[_0xd99c('0x114')][_0xd99c('0x17a')]('x')<0x0){_0x4f42b7['opts']+='x';}if(_0x4f42b7['opts'][_0xd99c('0x17a')]('X')<0x0){_0x4f42b7[_0xd99c('0x114')]+='X';}this['channel'][_0xd99c('0xa7')]('XMCS-QUEUE',_0x3e841a?_0x3e841a['toLowerCase']():'');var _0x31afa2=this[_0xd99c('0xe')]['exec'](_0xd99c('0x17b'),[_0x3e841a,_0x4f42b7[_0xd99c('0x114')],_0x4f42b7[_0xd99c('0x6b')],_0xb61841,_0x4f42b7[_0xd99c('0x6d')],_0x4f42b7[_0xd99c('0x8')],_0x4f42b7[_0xd99c('0x17c')],_0x4f42b7[_0xd99c('0x17d')],'',_0x4f42b7[_0xd99c('0x17e')]]);if(_0x31afa2[_0xd99c('0xac')]===-0x1){return _0x31afa2;}return this[_0xd99c('0xe')]['noop'](util['format'](_0xd99c('0xcb'),_0xd99c('0x17b'),_0x3e841a));};AGIVertices['prototype'][_0xd99c('0x17f')]=function(_0x15b267){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x15b267[_0xd99c('0x3c')]));var _0x351de0=_0x15b267['recordingFormat']||'wav';var _0x15dd44=util[_0xd99c('0x2d')](_0xd99c('0x180'),this['channel'][_0xd99c('0x3b')],rs[_0xd99c('0x120')](0x5));var _0xe13ae6=util[_0xd99c('0x2d')](_0xd99c('0x181'),FILES_PATH,_0x15dd44,_0x351de0);var _0x2f09be=util[_0xd99c('0x2d')](_0xd99c('0x137'),FILES_PATH,_0x15dd44);this[_0xd99c('0x40')][_0xd99c('0x7a')](this,_0x15b267,_0x15dd44,_0xe13ae6);this[_0xd99c('0xe')]['setVariable'](_0xd99c('0x182'),_0x15dd44);logger[_0xd99c('0x32')](_0xd99c('0x183'),_0x2f09be,_0x351de0,_0x15b267[_0xd99c('0x184')],_0x15b267[_0xd99c('0x6d')]);return this[_0xd99c('0xe')][_0xd99c('0x13a')](_0x2f09be,_0x351de0,_0x15b267[_0xd99c('0x184')],_0x15b267[_0xd99c('0x6d')],undefined,!![]);};AGIVertices[_0xd99c('0x11')][_0xd99c('0x185')]=function(_0x5dde23){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0x186'),_0x5dde23[_0xd99c('0x3c')]));if(!this[_0xd99c('0x8f')](_0x5dde23[_0xd99c('0x6b')])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0x187'));}var _0x568f1b=this[_0xd99c('0x6a')][_0xd99c('0x7a')](this,_0x5dde23);logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0x188'),util['inspect'](_0x568f1b,{'showHidden':![],'depth':null})));if(!this[_0xd99c('0x8f')](_0x5dde23[_0xd99c('0xda')])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0x189'));}var _0x245f77=this[_0xd99c('0x12')]['sync'](this,_0x5dde23[_0xd99c('0xda')]);if(!_0x245f77){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x5dde23,_0xd99c('0xdb'));}this[_0xd99c('0xe')]['setVariable'](util['format'](_0xd99c('0x18a'),_0x245f77),_0x568f1b[_0xd99c('0x7f')]?_0x568f1b[_0xd99c('0x7f')]:_0xd99c('0x18b'));this[_0xd99c('0xe')]['setVariable'](util[_0xd99c('0x2d')](_0xd99c('0x18c'),_0x245f77),_0x568f1b['statusMessage']?_0x568f1b[_0xd99c('0x80')]:'OK');if(_0x568f1b[_0xd99c('0x73')]){try{this[_0xd99c('0xa5')](_0x568f1b[_0xd99c('0x73')],_0x245f77);}catch(_0x3d93d4){logger[_0xd99c('0x36')](util[_0xd99c('0x2d')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x245f77));}}return this[_0xd99c('0xe')]['noop'](util['format']('variable\x20%s\x20set',_0x245f77));};AGIVertices[_0xd99c('0x11')][_0xd99c('0x18d')]=function(_0x49530c){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0x18e'),_0x49530c[_0xd99c('0x3c')]));return this['channel']['sayDigits'](_0x49530c['digits']['replace'](/\s+/g,''),_0x49530c[_0xd99c('0x184')]);};AGIVertices['prototype'][_0xd99c('0x18f')]=function(_0x3dd656){logger['info'](util[_0xd99c('0x2d')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x3dd656[_0xd99c('0x3c')]));return this['channel'][_0xd99c('0x190')](_0x3dd656['number']['replace'](/\s+/g,''),_0x3dd656[_0xd99c('0x184')]);};AGIVertices[_0xd99c('0x11')]['sayphonetic']=function(_0x359b6c){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x359b6c['label']));return this[_0xd99c('0xe')][_0xd99c('0x191')](_0x359b6c['text'],_0x359b6c['escape_digits']);};AGIVertices[_0xd99c('0x11')]['sendMail']=function(_0x45d958){logger['info'](util[_0xd99c('0x2d')](_0xd99c('0x192'),_0x45d958[_0xd99c('0x3c')]));if(!this['isConfigured'](_0x45d958[_0xd99c('0x193')])){return this[_0xd99c('0xe')][_0xd99c('0xb0')]('no\x20mail\x20account\x20configured');}var _0x431c21=this['getMailAccount'][_0xd99c('0x7a')](this,_0x45d958[_0xd99c('0x193')]);if(!_0x431c21||!_0x431c21[_0xd99c('0x194')]){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x45d958,_0xd99c('0x195'));}var _0x3a76a1={'from':util[_0xd99c('0x2d')](_0xd99c('0x196'),_0x431c21['name'],_0x431c21[_0xd99c('0x197')]||_0x431c21[_0xd99c('0x194')][_0xd99c('0x198')]),'to':_0x45d958['to']||'','cc':_0x45d958['cc']||'','bcc':_0x45d958[_0xd99c('0x199')]||'','subject':_0x45d958[_0xd99c('0x19a')],'html':_0x45d958[_0xd99c('0x62')],'text':_0x45d958[_0xd99c('0x62')]};if(this[_0xd99c('0x8f')](_0x45d958['template_id'])){}logger[_0xd99c('0xe1')](_0xd99c('0x19b'),JSON[_0xd99c('0x7d')](_0x3a76a1));this['createSquareDetailsReport'][_0xd99c('0x7a')](this,_0x45d958,_0x45d958['account_id']);this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0x19c'),_0x431c21['name']));this['sendMailMessage']['sync'](this,_0x431c21[_0xd99c('0x19d')],_0x3a76a1);return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0x19e'));};AGIVertices[_0xd99c('0x11')][_0xd99c('0x19f')]=function(_0x3efbbd){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0x1a0'),_0x3efbbd[_0xd99c('0x3c')]));return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0x1a1'));};AGIVertices[_0xd99c('0x11')][_0xd99c('0x1a2')]=function(_0x2b3dab){logger[_0xd99c('0x32')](util['format'](_0xd99c('0x1a3'),_0x2b3dab[_0xd99c('0x3c')]));if(!this[_0xd99c('0x8f')](_0x2b3dab[_0xd99c('0x1a4')])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0x1a5'));}var _0x2c818d=this[_0xd99c('0x1a6')][_0xd99c('0x7a')](this,_0x2b3dab[_0xd99c('0x1a4')]);if(!_0x2c818d){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x2b3dab,_0xd99c('0x1a7'));}var _0x17cd16={'body':_0x2b3dab[_0xd99c('0x1a8')],'phone':_0x2b3dab['to']||'','SmsAccountId':_0x2c818d['id']};logger['debug'](_0xd99c('0x1a9'),JSON[_0xd99c('0x7d')](_0x17cd16));this[_0xd99c('0x3a')][_0xd99c('0x7a')](this,_0x2b3dab,_0x2b3dab[_0xd99c('0x1a4')]);this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0x1aa'),_0x2c818d[_0xd99c('0x15')]));this[_0xd99c('0x39')][_0xd99c('0x7a')](this,_0x17cd16);return this['channel'][_0xd99c('0xb0')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xd99c('0x11')][_0xd99c('0x1ab')]=function(_0x31628a){logger[_0xd99c('0x32')](util['format'](_0xd99c('0x1ac'),_0x31628a[_0xd99c('0x3c')]));if(!this[_0xd99c('0x8f')](_0x31628a[_0xd99c('0xda')])){return this['channel'][_0xd99c('0x36')](_0x31628a,_0xd99c('0x1ad'));}var _0x9a40c8=this[_0xd99c('0x12')][_0xd99c('0x7a')](this,_0x31628a[_0xd99c('0xda')]);if(!_0x9a40c8){return this['channel'][_0xd99c('0x36')](_0x31628a,'no\x20variable\x20found');}return this[_0xd99c('0xe')][_0xd99c('0xa7')](_0x9a40c8,_0x31628a['variable_value']);};AGIVertices[_0xd99c('0x11')][_0xd99c('0x1ae')]=function(_0x163038){logger['info'](util[_0xd99c('0x2d')](_0xd99c('0x1af'),_0x163038[_0xd99c('0x3c')]));this[_0xd99c('0xe')]['noop'](_0xd99c('0x1b0'));if(_0x163038[_0xd99c('0xc0')]===_0xd99c('0x1b1')){this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0x1b2'));return this[_0xd99c('0xe')][_0xd99c('0xc0')]();}return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0x1b3'));};AGIVertices[_0xd99c('0x11')][_0xd99c('0x1b4')]=function(_0x54c8e7){logger[_0xd99c('0x32')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x54c8e7['label']));if(!this[_0xd99c('0x8f')](_0x54c8e7[_0xd99c('0x1b5')])){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x54c8e7,_0xd99c('0x1b6'));}var _0x23a164=this[_0xd99c('0x19')]['sync'](this,_0x54c8e7['project_id']);if(!this['isConfigured'](_0x23a164)){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x54c8e7,util[_0xd99c('0x2d')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x54c8e7[_0xd99c('0x1b5')]));}if(_0x23a164===this[_0xd99c('0xe')][_0xd99c('0x3e')]){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x54c8e7,_0xd99c('0x1b7'));}this['createSquareDetailsReport']['sync'](this,_0x54c8e7,_0x23a164);var _0xf68f83=this['channel'][_0xd99c('0x5d')](_0xd99c('0x1b8'),util['format'](_0xd99c('0x1b9'),config[_0xd99c('0x8')]['host']||_0xd99c('0x1ba'),_0x23a164,this['channel'][_0xd99c('0x3e')]));if(_0xf68f83[_0xd99c('0xac')]===-0x1){return _0xf68f83;}return this['channel'][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0xcb'),'AGI',_0x23a164));};AGIVertices['prototype'][_0xd99c('0x1bb')]=function(_0x58e800){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x58e800['label']));var _0xa8f4bc=this[_0xd99c('0x5c')][_0xd99c('0x7a')](this,_0x58e800[_0xd99c('0xbf')]);this[_0xd99c('0x3a')][_0xd99c('0x7a')](this,_0x58e800,_0x58e800[_0xd99c('0xbf')]);if(this[_0xd99c('0x8f')](_0x58e800[_0xd99c('0xda')])){var _0x3b5724=this[_0xd99c('0x12')]['sync'](this,_0x58e800[_0xd99c('0xda')]);if(_0x3b5724){this['channel'][_0xd99c('0xa7')](_0x3b5724,_0xa8f4bc);return this[_0xd99c('0xe')]['noop'](util[_0xd99c('0x2d')](_0xd99c('0x1bc'),_0x58e800[_0xd99c('0xbf')],_0x3b5724));}}return this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x58e800[_0xd99c('0xbf')]));};AGIVertices[_0xd99c('0x11')][_0xd99c('0x1bd')]=function(_0x47ece4){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x47ece4[_0xd99c('0x3c')]));_0x47ece4[_0xd99c('0x62')]=_0x47ece4[_0xd99c('0x62')][_0xd99c('0x1be')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd99c('0x8f')](_0x47ece4['apiKey'])){return this['channel'][_0xd99c('0xb0')](_0xd99c('0x1bf'));}if(!this[_0xd99c('0x8f')](_0x47ece4[_0xd99c('0x62')])){return this[_0xd99c('0xe')][_0xd99c('0xb0')](_0xd99c('0xb1'));}this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0x1c0'),_0x47ece4['text']));var _0x30da60=this[_0xd99c('0x5f')][_0xd99c('0x7a')](this,_0x47ece4);if(_0x30da60){this['channel'][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0x1c1'),_0x30da60));var _0x14e86c=this[_0xd99c('0xe')][_0xd99c('0x108')](_0x30da60);try{fs[_0xd99c('0x109')](_0x30da60+_0xd99c('0x10a'));}catch(_0x2db33e){logger['error'](_0x2db33e);}return _0x14e86c;}return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x47ece4,_0xd99c('0x1c2'));};AGIVertices['prototype'][_0xd99c('0x1c3')]=function(_0x476bd0){logger['info'](util[_0xd99c('0x2d')](_0xd99c('0x1c4'),_0x476bd0[_0xd99c('0x3c')]));_0x476bd0[_0xd99c('0x62')]=_0x476bd0[_0xd99c('0x62')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd99c('0x8f')](_0x476bd0[_0xd99c('0x62')])){return this[_0xd99c('0xe')]['noop']('no\x20text\x20configured');}this[_0xd99c('0xe')][_0xd99c('0xb0')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x476bd0[_0xd99c('0x62')]));var _0x10aa89=this[_0xd99c('0x69')][_0xd99c('0x7a')](this,_0x476bd0);if(_0x10aa89){this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0x1c5'),_0x10aa89));var _0x405f78=this[_0xd99c('0xe')][_0xd99c('0x108')](_0x10aa89);try{fs[_0xd99c('0x109')](_0x10aa89+'.wav');}catch(_0x1f4f10){logger[_0xd99c('0x36')](_0x1f4f10);}return _0x405f78;}return this['channel'][_0xd99c('0x36')](_0x476bd0,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xd99c('0x1c6')]=function(_0x28e8ee){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0x1c7'),_0x28e8ee[_0xd99c('0x3c')]));if(!this[_0xd99c('0x8f')](_0x28e8ee[_0xd99c('0x15c')])){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x28e8ee,_0xd99c('0x15d'));}logger['info'](util['format'](_0xd99c('0x15e'),this['channel'][_0xd99c('0x3f')],_0x28e8ee['findBy']));var _0x56a41a=this[_0xd99c('0x56')][_0xd99c('0x7a')](this,_0x28e8ee[_0xd99c('0x15c')]);if(_0x56a41a){logger[_0xd99c('0x32')](util['format'](_0xd99c('0x15f'),this[_0xd99c('0xe')][_0xd99c('0x3f')],_0x28e8ee[_0xd99c('0x15c')]));this[_0xd99c('0xe')][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0x15f'),this[_0xd99c('0xe')][_0xd99c('0x3f')],_0x28e8ee[_0xd99c('0x15c')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd99c('0x32')](util[_0xd99c('0x2d')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xd99c('0x3f')],_0x28e8ee[_0xd99c('0x15c')]));this['channel'][_0xd99c('0xb0')](util[_0xd99c('0x2d')](_0xd99c('0x160'),this[_0xd99c('0xe')][_0xd99c('0x3f')],_0x28e8ee[_0xd99c('0x15c')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xd99c('0x11')][_0xd99c('0x1c8')]=function(_0x18672c){logger[_0xd99c('0x32')](util[_0xd99c('0x2d')](_0xd99c('0x1c9'),_0x18672c[_0xd99c('0x3c')]));var _0x35f16f=this[_0xd99c('0xe')][_0xd99c('0x5d')](_0xd99c('0x1ca'),[_0x18672c[_0xd99c('0x1cb')],_0x18672c['options']]);if(_0x35f16f[_0xd99c('0xac')]===-0x1){return _0x35f16f;}return this[_0xd99c('0xe')]['noop'](util[_0xd99c('0x2d')]('Executed\x20command\x20%s\x20%s',_0xd99c('0x1ca'),_0x18672c['mailbox']));};AGIVertices[_0xd99c('0x11')][_0xd99c('0x1cc')]=function(_0x5c3b66){logger[_0xd99c('0x32')](util['format'](_0xd99c('0x1cd'),_0x5c3b66[_0xd99c('0x3c')]));if(!this['isConfigured'](_0x5c3b66[_0xd99c('0xda')])){return this[_0xd99c('0xe')][_0xd99c('0x36')](_0x5c3b66,'no\x20variable\x20selected');}var _0x22cd62=this[_0xd99c('0x12')][_0xd99c('0x7a')](this,_0x5c3b66[_0xd99c('0xda')]);if(!_0x22cd62){return this['channel'][_0xd99c('0x36')](_0x5c3b66,'no\x20variable\x20found');}var _0x3cc895=this[_0xd99c('0xe')][_0xd99c('0x12')](_0x22cd62);return{'code':0xc8,'result':_0x3cc895[_0xd99c('0xaa')]?_0x3cc895[_0xd99c('0xaa')]:'-'};};String[_0xd99c('0x11')][_0xd99c('0xa9')]=function(_0x3ccfda,_0x19a6a4){return this[_0xd99c('0xa8')](_0x3ccfda)[_0xd99c('0x1ce')](_0x19a6a4);};module[_0xd99c('0x1cf')]=AGIVertices; \ No newline at end of file +var _0x803f=['no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','Enter\x20in\x20MENU\x20(%s)\x20block','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','position','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','no\x20mail\x20account\x20found','email','Smtp','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','sms_text','debug','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','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','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','Enter\x20in\x20SYSTEM\x20(%s)\x20block','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','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','shelljs','odbc','moment','mustache','request-promise','../../config/logger','agi','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawBody','menu','getsecretdigits','channel','mailRpc','prototype','rpc','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareOdbc','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','agentPause','isNil','agentUnpause','agent','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','number','timeout','POST','PUT','method','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','%s.%s','saveRestApiResult','format','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_INPUT()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','Dialogflow\x20Result\x20%s','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','out','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','password','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.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','no\x20trunk\x20found','trunk_name','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','no\x20variable\x20found','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','unlink','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Amazon\x20Lex\x20ready\x20for\x20fulfillment','message','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','context','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20intervals\x20found','true','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block'];(function(_0x770f7,_0x3af003){var _0xe797c6=function(_0x47d92a){while(--_0x47d92a){_0x770f7['push'](_0x770f7['shift']());}};_0xe797c6(++_0x3af003);}(_0x803f,0x64));var _0xf803=function(_0x2fabb3,_0xc34c5d){_0x2fabb3=_0x2fabb3-0x0;var _0x2b2051=_0x803f[_0x2fabb3];return _0x2b2051;};'use strict';var fs=require('fs');var util=require(_0xf803('0x0'));var _=require('lodash');var sh=require(_0xf803('0x1'));var odbc=require(_0xf803('0x2'))();var rs=require('randomstring');var moment=require(_0xf803('0x3'));var Mustache=require(_0xf803('0x4'));var rp=require(_0xf803('0x5'));var logger=require(_0xf803('0x6'))(_0xf803('0x7'));var config=require('../../config/environment');var shared=require(_0xf803('0x8'));var scripts=require(_0xf803('0x9'));var FILES_PATH=_0xf803('0xa');var recursiveMapAttributes=['rawHeaders',_0xf803('0xb')];var verticesWithRetry=[_0xf803('0xc'),'getdigits',_0xf803('0xd')];var AGIVertices=function(_0xf7a481,_0x20ea41,_0x4c95cb){this[_0xf803('0xe')]=_0xf7a481;this['rpc']=_0x20ea41;this[_0xf803('0xf')]=_0x4c95cb;};AGIVertices[_0xf803('0x10')]['getVariable']=function(_0x174b31,_0x4779c6){this[_0xf803('0x11')][_0xf803('0x12')](_0x174b31)[_0xf803('0x13')](function(_0x50d9ef){_0x4779c6(null,_0x50d9ef?_0x50d9ef['name']:![]);})[_0xf803('0x14')](function(_0x2a6ed9){_0x4779c6(_0x2a6ed9);});};AGIVertices['prototype'][_0xf803('0x15')]=function(_0x48fc69,_0x272b96){this[_0xf803('0x11')][_0xf803('0x16')](_0x48fc69)[_0xf803('0x13')](function(_0x58a80b){_0x272b96(null,_0x58a80b?_0x58a80b[_0xf803('0x17')]:![]);})[_0xf803('0x14')](function(_0x3d07ca){_0x272b96(_0x3d07ca);});};AGIVertices[_0xf803('0x10')][_0xf803('0x18')]=function(_0xd170bc,_0xbd7728){this['rpc']['getSquareProjectById'](_0xd170bc)[_0xf803('0x13')](function(_0x292179){_0xbd7728(null,_0x292179?_0x292179[_0xf803('0x17')]:![]);})[_0xf803('0x14')](function(_0x29e28f){_0xbd7728(_0x29e28f);});};AGIVertices[_0xf803('0x10')][_0xf803('0x19')]=function(_0x246364,_0x790499){this[_0xf803('0x11')]['getSquareOdbcById'](_0x246364)[_0xf803('0x13')](function(_0x252421){_0x790499(null,_0x252421?_0x252421[_0xf803('0x1a')]:![]);})[_0xf803('0x14')](function(_0x38aa68){_0x790499(_0x38aa68);});};AGIVertices['prototype'][_0xf803('0x1b')]=function(_0x1a7879,_0x4a5299){this[_0xf803('0x11')][_0xf803('0x1c')](_0x1a7879)[_0xf803('0x13')](function(_0x23c46b){_0x4a5299(null,_0x23c46b?_0x23c46b[_0xf803('0x17')]:![]);})[_0xf803('0x14')](function(_0x3d8cc9){_0x4a5299(_0x3d8cc9);});};AGIVertices[_0xf803('0x10')][_0xf803('0x1d')]=function(_0x1e5a2a,_0x5f0642){this['rpc'][_0xf803('0x1e')](_0x1e5a2a)[_0xf803('0x13')](function(_0x145691){_0x5f0642(null,_0x145691?_0x145691[_0xf803('0x17')]:![]);})['catch'](function(_0x483890){_0x5f0642(_0x483890);});};AGIVertices[_0xf803('0x10')][_0xf803('0x1f')]=function(_0x1c8937,_0x4cc98b){var _0x8a1ab=this;this[_0xf803('0x11')]['getSoundById'](_0x1c8937)['then'](function(_0x2b8727){_0x4cc98b(null,_0x2b8727?_0x8a1ab[_0xf803('0x20')](_0x2b8727['save_name']):![]);})[_0xf803('0x14')](function(_0x13835d){_0x4cc98b(_0x13835d);});};AGIVertices[_0xf803('0x10')]['getMailAccount']=function(_0x73852c,_0x27c32f){this[_0xf803('0x11')][_0xf803('0x21')](_0x73852c)[_0xf803('0x13')](function(_0xd1545){_0x27c32f(null,_0xd1545?_0xd1545:![]);})[_0xf803('0x14')](function(_0x2ebd22){_0x27c32f(_0x2ebd22);});};AGIVertices[_0xf803('0x10')][_0xf803('0x22')]=function(_0x50185b,_0x46a3f8,_0x5bc426){this[_0xf803('0xf')]['sendMailMessage'](_0x50185b,_0x46a3f8)[_0xf803('0x13')](function(){_0x5bc426(null);})[_0xf803('0x14')](function(_0x466e41){_0x5bc426(_0x466e41);});};AGIVertices[_0xf803('0x10')][_0xf803('0x23')]=function(_0x2cd564,_0x1436d7){this['rpc'][_0xf803('0x24')](_0x2cd564)[_0xf803('0x13')](function(_0x6d4f36){if(_0x6d4f36){if(_0x6d4f36[_0xf803('0x25')]){_0x1436d7(null,[_0x6d4f36[_0xf803('0x26')]]);}else{_0x1436d7(null,_[_0xf803('0x27')](_0x6d4f36[_0xf803('0x28')],_0xf803('0x26')));}}else{_0x1436d7(null,![]);}})[_0xf803('0x14')](function(_0x3879d7){_0x1436d7(_0x3879d7);});};AGIVertices['prototype']['getSoundPath']=function(_0x3e8399){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x3e8399);};AGIVertices[_0xf803('0x10')]['getQueryOdbc']=function(_0x188a82,_0x27b064,_0x2cae0c){odbc[_0xf803('0x29')](_0x188a82,function(_0x2a2193){if(_0x2a2193){logger[_0xf803('0x2a')](_0xf803('0x2b'),_0x2a2193);_0x2cae0c(_0x2a2193);}else{logger[_0xf803('0x2c')](_0xf803('0x2d'));odbc[_0xf803('0x2e')](_0x27b064,function(_0x479289,_0x45f81d){if(_0x479289){logger[_0xf803('0x2c')](_0xf803('0x2f'),_0x27b064);_0x2cae0c(_0x479289);}else{logger[_0xf803('0x2c')](_0xf803('0x30'),_0x27b064);odbc['close'](function(_0x490175){if(_0x490175){logger[_0xf803('0x2a')](_0xf803('0x31'),_0x490175);}_0x2cae0c(null,_0x45f81d);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x54c896,_0x427bca){this[_0xf803('0x11')]['getSmsAccountById'](_0x54c896)[_0xf803('0x13')](function(_0x5079cc){_0x427bca(null,_0x5079cc?_0x5079cc:![]);})[_0xf803('0x14')](function(_0x14ee21){_0x427bca(_0x14ee21);});};AGIVertices[_0xf803('0x10')][_0xf803('0x32')]=function(_0x20db17,_0x123a9f){this[_0xf803('0x11')][_0xf803('0x32')](_0x20db17)[_0xf803('0x13')](function(_0x575c23){_0x123a9f(null,_0x575c23);})[_0xf803('0x14')](function(_0x48960c){_0x123a9f(_0x48960c);});};AGIVertices[_0xf803('0x10')][_0xf803('0x33')]=function(_0x2af94f,_0x57cea8,_0x401fc2){this['rpc'][_0xf803('0x33')]({'uniqueid':this['channel'][_0xf803('0x34')],'node':_0x2af94f[_0xf803('0x35')],'application':_0x2af94f['agicommand'],'data':_0x57cea8||null,'project_name':this[_0xf803('0xe')][_0xf803('0x36')],'callerid':this[_0xf803('0xe')][_0xf803('0x37')]})[_0xf803('0x13')](function(_0x23457c){if(_0x401fc2){_0x401fc2(null,_0x23457c);}})[_0xf803('0x14')](function(_0x3e24c6){if(_0x401fc2){_0x401fc2(_0x3e24c6);}});};AGIVertices[_0xf803('0x10')][_0xf803('0x38')]=function(_0x3a100a,_0x35aeb7,_0x3f2921,_0x528faf){this[_0xf803('0x11')]['createSquareRecording']({'uniqueid':this[_0xf803('0xe')][_0xf803('0x34')],'callerid':this['channel'][_0xf803('0x37')],'calleridname':this['channel'][_0xf803('0x39')],'context':this[_0xf803('0xe')]['context'],'extension':this[_0xf803('0xe')][_0xf803('0x3a')],'priority':this[_0xf803('0xe')][_0xf803('0x3b')],'accountcode':this[_0xf803('0xe')][_0xf803('0x3c')],'dnid':this[_0xf803('0xe')][_0xf803('0x3d')],'projectName':this['channel'][_0xf803('0x36')],'saveName':_0x35aeb7,'filename':_0x3a100a['file']||_0x35aeb7,'savePath':_0x3f2921})[_0xf803('0x13')](function(_0x482fb6){_0x528faf(null,_0x482fb6);})['catch'](function(_0x5982af){_0x528faf(_0x5982af);});};AGIVertices[_0xf803('0x10')]['createSquareMessage']=function(_0x10dc65,_0x4035de,_0x3b96a2,_0x40674f,_0x5df3a2){this[_0xf803('0x11')][_0xf803('0x3e')]({'uniqueid':this[_0xf803('0xe')][_0xf803('0x34')],'body':_0x10dc65,'direction':_0x4035de,'providerName':_0x3b96a2,'providerResponse':_0x40674f})[_0xf803('0x13')](function(_0x24d8f1){if(_0x5df3a2){_0x5df3a2(null,_0x24d8f1);}})[_0xf803('0x14')](function(_0x523832){if(_0x5df3a2){_0x5df3a2(_0x523832);}});};AGIVertices['prototype'][_0xf803('0x3f')]=function(_0x249e3d,_0x5dbeeb){this['rpc'][_0xf803('0x3f')]({'firstName':_[_0xf803('0x40')](_0x249e3d[_0xf803('0x17')])||_['isNil'](_0x249e3d['name'])?_0xf803('0x41')+Math[_0xf803('0x42')]():_0x249e3d['name'],'lastName':_['isEmpty'](_0x249e3d[_0xf803('0x43')])||_['isNil'](_0x249e3d[_0xf803('0x43')])?null:_0x249e3d['lastName'],'phone':_0x249e3d[_0xf803('0x44')],'ListId':_0x249e3d[_0xf803('0x45')],'scheduledat':_0x249e3d[_0xf803('0x46')],'callbackUniqueid':this[_0xf803('0xe')][_0xf803('0x34')],'tags':_0xf803('0x47'),'description':'Callback\x20scheduled\x20at\x20'+_0x249e3d[_0xf803('0x46')][_0xf803('0x48')](),'priority':_0x249e3d[_0xf803('0x49')]})['then'](function(_0x5e71d3){_0x5dbeeb(null,_0x5e71d3);})[_0xf803('0x14')](function(_0xa6b73f){_0x5dbeeb(_0xa6b73f);});};AGIVertices[_0xf803('0x10')][_0xf803('0x4a')]=function(_0x2e0f52,_0x2e7514){this[_0xf803('0x11')]['getPauseById'](_0x2e0f52)[_0xf803('0x13')](function(_0x32b2d0){_0x2e7514(null,_0x32b2d0?_0x32b2d0[_0xf803('0x17')]:![]);})[_0xf803('0x14')](function(_0x5cdc28){_0x2e7514(_0x5cdc28);});};AGIVertices['prototype'][_0xf803('0x4b')]=function(_0x19f0fb,_0x30c61e,_0x2e48d9){var _0x268849={'role':'agent'};_0x268849[_0x19f0fb]=this[_0xf803('0xe')][_0xf803('0x37')];this['rpc'][_0xf803('0x4b')](_0x268849,_0x30c61e,this[_0xf803('0xe')][_0xf803('0x34')])[_0xf803('0x13')](function(_0x49e7d1){_0x2e48d9(null,_[_0xf803('0x4c')](_0x49e7d1)?![]:!![]);})[_0xf803('0x14')](function(_0x12d0da){logger[_0xf803('0x2a')](_0x12d0da);_0x2e48d9(null,![]);});};AGIVertices[_0xf803('0x10')][_0xf803('0x4d')]=function(_0x135976,_0x2a30ad){var _0x3617c4={'role':'agent'};_0x3617c4[_0x135976]=this[_0xf803('0xe')]['callerid'];this[_0xf803('0x11')][_0xf803('0x4d')](_0x3617c4)[_0xf803('0x13')](function(_0x47164a){_0x2a30ad(null,_['isNil'](_0x47164a)?![]:!![]);})['catch'](function(_0x413b19){logger[_0xf803('0x2a')](_0x413b19);_0x2a30ad(null,![]);});};AGIVertices[_0xf803('0x10')]['agentLogout']=function(_0x2ef418,_0x4b1542){var _0x28e30d={'role':_0xf803('0x4e')};_0x28e30d[_0x2ef418]=this[_0xf803('0xe')][_0xf803('0x37')];this[_0xf803('0x11')][_0xf803('0x4f')](_0x28e30d)[_0xf803('0x13')](function(_0x3c6a55){_0x4b1542(null,_['isNil'](_0x3c6a55)?![]:!![]);})[_0xf803('0x14')](function(_0x58544e){logger['error'](_0x58544e);_0x4b1542(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x2d4234,_0x5036a3){var _0x2a603e={'role':_0xf803('0x4e')};_0x2a603e[_0x2d4234]=this[_0xf803('0xe')][_0xf803('0x37')];var _0x571fb4=_0x2d4234!=_0xf803('0x50')?util['format'](_0xf803('0x51'),_0xf803('0x52'),this[_0xf803('0xe')][_0xf803('0x37')]):undefined;this[_0xf803('0x11')][_0xf803('0x53')](_0x2a603e,_0x571fb4)['then'](function(_0x39216c){_0x5036a3(null,_[_0xf803('0x4c')](_0x39216c)?![]:!![]);})['catch'](function(_0x805577){logger[_0xf803('0x2a')](_0x805577);_0x5036a3(null,![]);});};AGIVertices[_0xf803('0x10')][_0xf803('0x54')]=function(_0x21b09f,_0x1280c2){sh[_0xf803('0x55')](_[_0xf803('0x56')](_0x21b09f),function(_0x309843,_0x3f9c2c){var _0x4081a0=_0x3f9c2c[_0xf803('0x57')](/(\r\n|\n|\r)/gm,'');_0x1280c2(null,_0x4081a0);});};AGIVertices['prototype'][_0xf803('0x58')]=function(_0x454f41,_0x4a2805){scripts[_0xf803('0x58')](_0x454f41[_0xf803('0x59')],_0x454f41[_0xf803('0x5a')]||_0xf803('0x5b'),_0x454f41['text'],_0x454f41[_0xf803('0x5c')]||_0xf803('0x5d'),_0x454f41[_0xf803('0x5e')]||_0xf803('0x5f'),_0x454f41[_0xf803('0x60')]||_0xf803('0x61'))[_0xf803('0x13')](function(_0x423473){_0x4a2805(null,_0x423473);})['catch'](function(_0x1f207b){_0x4a2805(_0x1f207b);});};AGIVertices['prototype']['googleTTS']=function(_0x3863ec,_0x402021){scripts[_0xf803('0x62')](_0x3863ec[_0xf803('0x5b')],_0x3863ec[_0xf803('0x63')]||'en',0x1)[_0xf803('0x13')](function(_0x3cf463){_0x402021(null,_0x3cf463);})[_0xf803('0x14')](function(_0x268d97){_0x402021(_0x268d97);});};AGIVertices[_0xf803('0x10')][_0xf803('0x64')]=function(_0x21333c,_0x12cf5e){var _0x3fbaa4={'uri':_0x21333c[_0xf803('0x65')],'method':_0x21333c['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x21333c['timeout'])===_0xf803('0x66')&&parseInt(_0x21333c['timeout'])>=0x1?parseInt(_0x21333c[_0xf803('0x67')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xf803('0x68'),_0xf803('0x69')],_0x3fbaa4[_0xf803('0x6a')][_0xf803('0x6b')]())){try{_0x3fbaa4[_0xf803('0x6c')]=_0x21333c['rawBody']?JSON['parse'](_0x21333c[_0xf803('0xb')]):{};}catch(_0x12166f){logger[_0xf803('0x2a')](_0xf803('0x6d'),_0x12166f);}}try{_0x3fbaa4[_0xf803('0x6e')]=_0x21333c[_0xf803('0x6f')]?JSON[_0xf803('0x70')](_0x21333c[_0xf803('0x6f')]):{};}catch(_0xb68254){logger[_0xf803('0x2a')](_0xf803('0x71'),_0xb68254);}if(_0x21333c[_0xf803('0x72')]){try{var _0x316c39=require(_0x21333c[_0xf803('0x72')])[_0xf803('0x73')](this,_0x3fbaa4);_0x3fbaa4[_0xf803('0x74')]=Mustache['render'](_0x21333c[_0xf803('0x65')],_0x316c39,{},['$$','$$']);if(_0x3fbaa4['headers']){_0x3fbaa4[_0xf803('0x6e')]=JSON[_0xf803('0x70')](Mustache[_0xf803('0x75')](JSON[_0xf803('0x76')](_0x3fbaa4['headers']),_0x316c39,{},['$$','$$']));}if(_0x3fbaa4[_0xf803('0x6c')]){_0x3fbaa4[_0xf803('0x6c')]=JSON[_0xf803('0x70')](Mustache[_0xf803('0x75')](JSON[_0xf803('0x76')](_0x3fbaa4[_0xf803('0x6c')]),_0x316c39,{},['$$','$$']));}}catch(_0x1b11cc){logger[_0xf803('0x2a')](_0xf803('0x77'),_0x1b11cc);}}rp(_0x3fbaa4)['then'](function(_0x3f7a63){var _0x411db1={'statusCode':_0x3f7a63[_0xf803('0x78')]||0xc8,'statusMessage':_0x3f7a63[_0xf803('0x79')]||'OK','headers':_0x3f7a63[_0xf803('0x6e')]||{},'body':_0x3f7a63[_0xf803('0x6c')]||{}};_0x12cf5e(null,_0x411db1);})['catch'](function(_0x19afeb){var _0x1cc113={'statusCode':_0x19afeb[_0xf803('0x78')]||0x1f4,'statusMessage':_0x19afeb['message']||_0xf803('0x7a'),'headers':_0x19afeb['options'][_0xf803('0x6e')]||{},'body':_0x19afeb[_0xf803('0x7b')][_0xf803('0x6c')]||{}};_0x12cf5e(null,_0x1cc113);});};AGIVertices[_0xf803('0x10')][_0xf803('0x7c')]=function(_0x8753e,_0x26ce6e){scripts['googleDialogflow'](this[_0xf803('0xe')][_0xf803('0x34')],_0x8753e[_0xf803('0x7d')],_0x8753e['text'],_0x8753e[_0xf803('0x7e')]||'en')[_0xf803('0x13')](function(_0x15428f){_0x26ce6e(null,_0x15428f);})[_0xf803('0x14')](function(_0xc6742){_0x26ce6e(_0xc6742);});};AGIVertices['prototype'][_0xf803('0x7f')]=function(_0x37a69f,_0x57348b){scripts['googleDialogflowV2'](this[_0xf803('0xe')][_0xf803('0x34')],_0x37a69f[_0xf803('0x80')],_0x37a69f[_0xf803('0x81')],_0x37a69f[_0xf803('0x82')],_0x37a69f[_0xf803('0x5b')],_0x37a69f[_0xf803('0x83')]||'en')[_0xf803('0x13')](function(_0x4c86c9){_0x57348b(null,_0x4c86c9);})[_0xf803('0x14')](function(_0x3d8816){_0x57348b(_0x3d8816);});};AGIVertices[_0xf803('0x10')]['sestekNDA']=function(_0x3ce038,_0x415d81){scripts[_0xf803('0x84')](this[_0xf803('0xe')],_0x3ce038)['then'](function(_0x1a0861){_0x415d81(null,_0x1a0861);})[_0xf803('0x14')](function(_0x3a1df6){_0x415d81(_0x3a1df6);});};AGIVertices[_0xf803('0x10')][_0xf803('0x85')]=function(_0x4d4cfd,_0x121ccf){scripts['ispeechTTS'](_0x4d4cfd['key'],_0x4d4cfd[_0xf803('0x5b')],_0x4d4cfd[_0xf803('0x86')]||'en-US',_0x4d4cfd[_0xf803('0x87')])['then'](function(_0x5c1421){_0x121ccf(null,_0x5c1421);})[_0xf803('0x14')](function(_0x36442b){_0x121ccf(_0x36442b);});};AGIVertices[_0xf803('0x10')]['ispeechASR']=function(_0x44d7da,_0x386fe1,_0x47404b){scripts[_0xf803('0x88')](_0x386fe1,_0x44d7da[_0xf803('0x7d')],_0x44d7da[_0xf803('0x89')]||_0xf803('0x5d'),this[_0xf803('0x8a')](_0x44d7da[_0xf803('0x8b')])?_0x44d7da[_0xf803('0x8b')]:undefined)[_0xf803('0x13')](function(_0x69bdd0){_0x47404b(null,_0x69bdd0);})['catch'](function(_0x44fd67){_0x47404b(_0x44fd67);});};AGIVertices[_0xf803('0x10')][_0xf803('0x8c')]=function(_0x2b9a9d,_0x3ffb68){scripts[_0xf803('0x8c')](_0x2b9a9d['aws_access_key_id'],_0x2b9a9d[_0xf803('0x8d')],_0x2b9a9d[_0xf803('0x8e')],_0x2b9a9d['aws_polly_voice']||_0xf803('0x8f'),_0x2b9a9d[_0xf803('0x5b')],_0x2b9a9d[_0xf803('0x90')]||_0xf803('0x5b'))[_0xf803('0x13')](function(_0x38d67a){_0x3ffb68(null,_0x38d67a);})[_0xf803('0x14')](function(_0x3d2aa5){_0x3ffb68(_0x3d2aa5);});};AGIVertices[_0xf803('0x10')][_0xf803('0x91')]=function(_0x3e98f5,_0x47470f){scripts[_0xf803('0x91')](this['channel'][_0xf803('0x34')],_0x3e98f5['aws_access_key_id'],_0x3e98f5['aws_secret_access_key'],_0x3e98f5[_0xf803('0x92')],_0x3e98f5[_0xf803('0x5b')],_0x3e98f5[_0xf803('0x93')])[_0xf803('0x13')](function(_0x5eb8ef){_0x47470f(null,_0x5eb8ef);})[_0xf803('0x14')](function(_0x19ccd3){_0x47470f(_0x19ccd3);});};AGIVertices[_0xf803('0x10')][_0xf803('0x94')]=function(_0x342a8b,_0x2124c1,_0x589450){scripts[_0xf803('0x94')](_0x2124c1,_0x342a8b['key'],_0x342a8b['google_asr_language']||_0xf803('0x5d'))[_0xf803('0x13')](function(_0x15236b){_0x589450(null,_0x15236b);})[_0xf803('0x14')](function(_0x2ed67c){_0x589450(_0x2ed67c);});};AGIVertices['prototype'][_0xf803('0x95')]=function(_0x3dd0dd,_0x6d5b02,_0x1b8fc9){scripts['tildeASR'](_0x6d5b02,_0x3dd0dd[_0xf803('0x96')],_0x3dd0dd['appsecret'],_0x3dd0dd[_0xf803('0x74')])[_0xf803('0x13')](function(_0x379efb){_0x1b8fc9(null,_0x379efb);})[_0xf803('0x14')](function(_0x36a457){_0x1b8fc9(_0x36a457);});};AGIVertices[_0xf803('0x10')][_0xf803('0x97')]=function(_0x2b6edf){var _0x408af9=_[_0xf803('0x98')](verticesWithRetry,_0x2b6edf['agicommand'])?_0x2b6edf:_[_0xf803('0x99')](_0x2b6edf);for(var _0x5e53d5 in _0x408af9){if(_0x408af9[_0xf803('0x9a')](_0x5e53d5)){if(_0x408af9[_0x5e53d5]&&_[_0xf803('0x9b')](_0x408af9[_0x5e53d5])){if(_['includes'](recursiveMapAttributes,_0x5e53d5)){_0x408af9[_0x5e53d5]=this[_0xf803('0x9c')](_0x408af9[_0x5e53d5]);}else{_0x408af9[_0x5e53d5]=this[_0xf803('0x9d')](_0x408af9[_0x5e53d5]);}}}}return _0x408af9;};AGIVertices['prototype'][_0xf803('0x9e')]=function(_0x4b9737){for(var _0x12dd3e in _0x4b9737){if(_0x4b9737[_0xf803('0x9a')](_0x12dd3e)){if(_[_0xf803('0x9f')](_0x4b9737[_0x12dd3e])){this[_0xf803('0x9e')](_0x4b9737[_0x12dd3e]);}else if(_[_0xf803('0xa0')](_0x4b9737[_0x12dd3e])){for(var _0x5c7636=0x0;_0x5c7636<_0x4b9737[_0x12dd3e][_0xf803('0xa1')];_0x5c7636++){this[_0xf803('0x9e')](_0x4b9737[_0x12dd3e][_0x5c7636]);}}else if(_['isString'](_0x4b9737[_0x12dd3e])){_0x4b9737[_0x12dd3e]=this[_0xf803('0x9d')](_0x4b9737[_0x12dd3e]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x18cb3d,_0x16375a){for(var _0x7850c in _0x18cb3d){if(_0x18cb3d[_0xf803('0x9a')](_0x7850c)){if(_[_0xf803('0x9f')](_0x18cb3d[_0x7850c])){if(!_[_0xf803('0x40')](_0x18cb3d[_0x7850c])){this['saveRestApiResult'](_0x18cb3d[_0x7850c],util['format'](_0xf803('0xa2'),_0x16375a,_0x7850c));}}else if(_[_0xf803('0xa0')](_0x18cb3d[_0x7850c])){for(var _0x564c3a=0x0;_0x564c3a<_0x18cb3d[_0x7850c]['length'];_0x564c3a++){this[_0xf803('0xa3')](_0x18cb3d[_0x7850c][_0x564c3a],util[_0xf803('0xa4')]('%s.%s',_0x16375a,_0x7850c+'['+_0x564c3a+']'));}}else{if(!_[_0xf803('0x4c')](_0x18cb3d[_0x7850c])){this[_0xf803('0xe')][_0xf803('0xa5')](util[_0xf803('0xa4')](_0xf803('0xa2'),_0x16375a,_0x7850c),_0x18cb3d[_0x7850c]);}}}}};AGIVertices[_0xf803('0x10')][_0xf803('0x9c')]=function(_0x4b225b){try{var _0x745f68=JSON['parse'](_0x4b225b);this['recursiveNodeIndex'](_0x745f68);return JSON[_0xf803('0x76')](_0x745f68);}catch(_0x5814f8){return this[_0xf803('0x9d')](_0x4b225b);}};AGIVertices['prototype'][_0xf803('0x9d')]=function(_0x2a9c63){var _0x22621b=_0x2a9c63[_0xf803('0xa6')]('{');for(var _0x23c574=0x1;_0x23c574<_0x22621b[_0xf803('0xa1')];_0x23c574+=0x1){var _0x5afed7=_0x22621b[_0x23c574]['split']('}');if(_0x5afed7[_0xf803('0xa1')]>0x1){_0x2a9c63=_0x2a9c63[_0xf803('0xa7')]('{'+_0x5afed7[0x0]+'}',this[_0xf803('0xe')][_0xf803('0xa8')](_0x5afed7[0x0])[_0xf803('0xa9')]||_0x5afed7[0x0]);}}if(_0x22621b[_0xf803('0xa1')]===0x1){return _0x2a9c63[_0xf803('0x48')]();}return this[_0xf803('0x9d')](_0x2a9c63);};AGIVertices[_0xf803('0x10')][_0xf803('0xaa')]=function(_0x2c868f,_0x3fc71b){var _0x19f05d=this[_0xf803('0xe')][_0xf803('0xa8')](_0x2c868f);if(_0x19f05d[_0xf803('0xab')]===-0x1){return _0x19f05d;}logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0xac'),_0x3fc71b,_0x19f05d[_0xf803('0xa9')]));return this[_0xf803('0xe')][_0xf803('0xa5')](_0x3fc71b,_0x19f05d[_0xf803('0xa9')]);};AGIVertices[_0xf803('0x10')]['isConfigured']=function(_0x6f72f8){return _0x6f72f8&&_0x6f72f8!=='0'&&_0x6f72f8!=='-1'&&_0x6f72f8!=='';};AGIVertices[_0xf803('0x10')]['maxRetry']=function(_0xae7433){this[_0xf803('0x33')][_0xf803('0x73')](this,_0xae7433,'-');_0xae7433['retry']=_0xae7433[_0xf803('0xad')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xf803('0xae')]=function(_0x13c9e0){logger[_0xf803('0x2c')](util[_0xf803('0xa4')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x13c9e0[_0xf803('0x35')]));if(!this['isConfigured'](_0x13c9e0[_0xf803('0x5b')])){return this['channel'][_0xf803('0xaf')](_0xf803('0xb0'));}var _0x54edf4='\x22'+_0x13c9e0['text']+'\x22';if(this[_0xf803('0x8a')](_0x13c9e0[_0xf803('0x7b')])){_0x54edf4+=','+_0x13c9e0['options'];}var _0x1ea82b=this['channel'][_0xf803('0x55')]('MRCPSynth',_0x54edf4);if(_0x1ea82b['result']===-0x1){return _0x1ea82b;}return this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0xb1'),_0x54edf4));};AGIVertices[_0xf803('0x10')][_0xf803('0xb2')]=function(_0xdececb){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0xb3'),_0xdececb[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0xdececb['grammar'])){return this['channel'][_0xf803('0xaf')](_0xf803('0xb4'));}var _0x46b966=_0xdececb[_0xf803('0xb5')];if(this[_0xf803('0x8a')](_0xdececb['options'])){_0x46b966+=','+_0xdececb[_0xf803('0x7b')];}var _0x12a487=this[_0xf803('0xe')]['exec'](_0xf803('0xb6'),_0x46b966);if(_0x12a487['result']===-0x1){return _0x12a487;}var _0x44a736=this[_0xf803('0xaa')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x44a736['result']===-0x1){return _0x44a736;}var _0x413d03=this[_0xf803('0xaa')](_0xf803('0xb7'),'MRCP_RECOG_TRANSCRIPT');if(_0x413d03[_0xf803('0xab')]===-0x1){return _0x413d03;}var _0x4e4634=this[_0xf803('0xaa')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x4e4634[_0xf803('0xab')]===-0x1){return _0x4e4634;}return this['channel'][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0xb8'),_0x46b966));};AGIVertices['prototype'][_0xf803('0x7')]=function(_0xceec36){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0xb9'),_0xceec36['label']));return this[_0xf803('0xe')][_0xf803('0x7')]([_0xceec36[_0xf803('0xba')],_0xceec36[_0xf803('0xbb')]]);};AGIVertices[_0xf803('0x10')]['answer']=function(_0x49bbec){logger[_0xf803('0x2c')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x49bbec[_0xf803('0x35')]));if(this[_0xf803('0x8a')](_0x49bbec[_0xf803('0x67')])){logger['info'](util['format']('Wait\x20%s\x20seconds\x20before\x20answer',_0x49bbec[_0xf803('0x67')]));var _0x380cae=this[_0xf803('0xe')][_0xf803('0xbc')](_0x49bbec[_0xf803('0x67')]);if(_0x380cae['result']===-0x1){return _0x380cae;}}return this['channel'][_0xf803('0xbd')]();};AGIVertices['prototype'][_0xf803('0x47')]=function(_0x1bb67d){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0xbe'),_0x1bb67d[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x1bb67d['list_id'])){return this['channel'][_0xf803('0x2a')](_0x1bb67d,_0xf803('0xbf'));}_0x1bb67d[_0xf803('0x46')]=moment();if(this[_0xf803('0x8a')](_0x1bb67d[_0xf803('0xc0')])){_0x1bb67d[_0xf803('0x46')]=moment()[_0xf803('0xc1')](_0x1bb67d['delay'],_0xf803('0xc2'));}if(!this['isConfigured'](_0x1bb67d[_0xf803('0x49')])){_0x1bb67d[_0xf803('0x49')]=0x2;}this[_0xf803('0x3f')]['sync'](this,_0x1bb67d);return this['channel'][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0xc3'),_0x1bb67d[_0xf803('0x44')],_0x1bb67d[_0xf803('0x45')],_0x1bb67d[_0xf803('0x46')]));};AGIVertices[_0xf803('0x10')][_0xf803('0xc4')]=function(_0xdafc48){logger[_0xf803('0x2c')](util['format'](_0xf803('0xc5'),_0xdafc48['label']));var _0x5708c5=this[_0xf803('0xe')][_0xf803('0x55')](_0xdafc48[_0xf803('0xc6')],_0xdafc48['options']);if(_0x5708c5[_0xf803('0xab')]===-0x1){return _0x5708c5;}return this['channel']['noop'](util[_0xf803('0xa4')](_0xf803('0xc7'),_0xdafc48['application'],_0xdafc48[_0xf803('0x7b')]));};AGIVertices[_0xf803('0x10')][_0xf803('0xc8')]=function(_0x278581){logger[_0xf803('0x2c')](util['format'](_0xf803('0xc9'),_0x278581[_0xf803('0x35')]));if(!this['isConfigured'](_0x278581[_0xf803('0x5b')])){return this['channel'][_0xf803('0xaf')]('no\x20text\x20configured');}var _0x239fd8='\x22'+_0x278581[_0xf803('0x5b')]+'\x22';if(this[_0xf803('0x8a')](_0x278581[_0xf803('0x7b')])){_0x239fd8+=','+_0x278581[_0xf803('0x7b')];}var _0x5ac43a=this['channel'][_0xf803('0x55')](_0xf803('0xca'),_0x239fd8);if(_0x5ac43a['result']===-0x1){return _0x5ac43a;}return this['channel'][_0xf803('0xaf')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x239fd8));};AGIVertices['prototype'][_0xf803('0xcb')]=function(_0x14acc6){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0xcc'),_0x14acc6[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x14acc6['text'])){return this['channel'][_0xf803('0xaf')](_0xf803('0xb0'));}var _0xfc4c98='\x22'+_0x14acc6[_0xf803('0x5b')]+'\x22';if(this['isConfigured'](_0x14acc6['options'])){_0xfc4c98+=','+_0x14acc6['options'];}var _0x5477a0=this[_0xf803('0xe')][_0xf803('0x55')]('MRCPSynth',_0xfc4c98);if(_0x5477a0[_0xf803('0xab')]===-0x1){return _0x5477a0;}return this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0xb1'),_0xfc4c98));};AGIVertices['prototype'][_0xf803('0xcd')]=function(_0x2bfae0){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0xce'),_0x2bfae0[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x2bfae0[_0xf803('0xb5')])){return this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0xb4'));}var _0x5aab5e=_0x2bfae0[_0xf803('0xb5')];if(this[_0xf803('0x8a')](_0x2bfae0['options'])){_0x5aab5e+=','+_0x2bfae0[_0xf803('0x7b')];}var _0x189160=this[_0xf803('0xe')][_0xf803('0x55')](_0xf803('0xb6'),_0x5aab5e);if(_0x189160[_0xf803('0xab')]===-0x1){return _0x189160;}var _0x3850e8=this[_0xf803('0xaa')](_0xf803('0xcf'),'LUMENVOX_ASR_CONFIDENCE');if(_0x3850e8[_0xf803('0xab')]===-0x1){return _0x3850e8;}var _0x157fce=this[_0xf803('0xaa')](_0xf803('0xb7'),_0xf803('0xd0'));if(_0x157fce[_0xf803('0xab')]===-0x1){return _0x157fce;}var _0x349d76=this[_0xf803('0xaa')]('RECOG_INSTANCE()',_0xf803('0xd1'));if(_0x349d76[_0xf803('0xab')]===-0x1){return _0x349d76;}return this['channel'][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0xb8'),_0x5aab5e));};AGIVertices[_0xf803('0x10')][_0xf803('0xd2')]=function(_0x55c8cf){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0xd3'),_0x55c8cf[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x55c8cf[_0xf803('0xb5')])){return this['channel'][_0xf803('0xaf')](_0xf803('0xb4'));}var _0x235e1=_0x55c8cf[_0xf803('0xb5')];if(this['isConfigured'](_0x55c8cf[_0xf803('0x7b')])){_0x235e1+=','+_0x55c8cf[_0xf803('0x7b')];}var _0xb5b41f=this[_0xf803('0xe')][_0xf803('0x55')](_0xf803('0xb6'),_0x235e1);if(_0xb5b41f[_0xf803('0xab')]===-0x1){return _0xb5b41f;}var _0x344e72=this[_0xf803('0xaa')](_0xf803('0xcf'),_0xf803('0xd4'));if(_0x344e72['result']===-0x1){return _0x344e72;}var _0x1a1111=this[_0xf803('0xaa')](_0xf803('0xb7'),_0xf803('0xd5'));if(_0x1a1111[_0xf803('0xab')]===-0x1){return _0x1a1111;}var _0x4e2306=this['getAndSetVariable'](_0xf803('0xd6'),_0xf803('0xd7'));if(_0x4e2306[_0xf803('0xab')]===-0x1){return _0x4e2306;}return this[_0xf803('0xe')]['noop'](util[_0xf803('0xa4')](_0xf803('0xb8'),_0x235e1));};AGIVertices['prototype']['database']=function(_0x59c765){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0xd8'),_0x59c765[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x59c765[_0xf803('0xd9')])){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x59c765,_0xf803('0xda'));}var _0x5c3e7b=this[_0xf803('0x19')][_0xf803('0x73')](this,_0x59c765['odbc_id']);if(!_0x5c3e7b){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x59c765,_0xf803('0xdb'));}if(!this[_0xf803('0x8a')](_0x59c765[_0xf803('0x2e')])){return this[_0xf803('0xe')]['error'](_0x59c765,_0xf803('0xdc'));}var _0x410c55=_0x59c765[_0xf803('0x2e')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0xdd'),_0x410c55));var _0x4cd443=this[_0xf803('0xde')][_0xf803('0x73')](this,_0x5c3e7b,_0x410c55);this['createSquareDetailsReport'][_0xf803('0x73')](this,_0x59c765,_0x410c55);if(!this[_0xf803('0x8a')](_0x59c765[_0xf803('0xdf')])){return this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0xe0'));}var _0x78de78=this['getVariable'][_0xf803('0x73')](this,_0x59c765['variable_id']);if(!_0x78de78){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x59c765,'no\x20variable\x20found');}var _0xc6413=this;_0x4cd443[_0xf803('0xe1')](function(_0x4e04b8,_0x12504b){Object[_0xf803('0xe2')](_0x4e04b8)[_0xf803('0xe1')](function(_0x4de44f){_0xc6413[_0xf803('0xe')][_0xf803('0xa5')](util['format'](_0xf803('0xe3'),_0x78de78,_0x12504b,_0x4de44f),_0x4e04b8[_0x4de44f]);});});this['channel'][_0xf803('0xa5')](util[_0xf803('0xa4')](_0xf803('0xe4'),_0x78de78),_0x4cd443['length']);return this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0xe5'),_0x78de78));};AGIVertices[_0xf803('0x10')][_0xf803('0xe6')]=function(_0x1be4b8){logger['debug'](util[_0xf803('0xa4')](_0xf803('0xe7'),_0x1be4b8[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x1be4b8[_0xf803('0xe8')])){return this['channel']['error'](_0x1be4b8,'no\x20user\x20selected');}var _0x2d55b6=this[_0xf803('0x1b')][_0xf803('0x73')](this,_0x1be4b8[_0xf803('0xe8')]);if(!_0x2d55b6){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x1be4b8,'no\x20user\x20found');}var _0x2c99d3=this[_0xf803('0xe')]['exec'](_0xf803('0xe9'),[util[_0xf803('0xa4')](_0xf803('0xea'),_0x2d55b6),_0x1be4b8[_0xf803('0x67')],_0x1be4b8[_0xf803('0xeb')],_0x1be4b8['url']]);if(_0x2c99d3[_0xf803('0xab')]===-0x1){return _0x2c99d3;}return this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0xec'),_0xf803('0xe9')));};AGIVertices[_0xf803('0x10')][_0xf803('0xed')]=function(_0x3d7f36){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0xee'),_0x3d7f36[_0xf803('0x35')]));if(!this['isConfigured'](_0x3d7f36[_0xf803('0x7d')])){return this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0xef'));}if(!this[_0xf803('0x8a')](_0x3d7f36[_0xf803('0x5b')])){return this['channel'][_0xf803('0xaf')](_0xf803('0xb0'));}this['channel'][_0xf803('0xf0')]=!![];this['createSquareDetailsReport'](_0x3d7f36);this[_0xf803('0x3e')](_0x3d7f36[_0xf803('0x5b')],'in','','');this[_0xf803('0xe')]['noop'](util[_0xf803('0xa4')](_0xf803('0xf1'),_0x3d7f36[_0xf803('0x5b')]));var _0x5ab091=this[_0xf803('0x7c')][_0xf803('0x73')](this,_0x3d7f36);if(_0x5ab091){for(var _0xb826ad in _0x5ab091){if(_0x5ab091[_0xf803('0x9a')](_0xb826ad)){this[_0xf803('0xe')]['setVariable'](util['format']('DIALOGFLOW_%s',_0xb826ad[_0xf803('0x6b')]()),_0x5ab091[_0xb826ad]);}}this[_0xf803('0x3e')](_0x5ab091[_0xf803('0xf2')],'out','dialogflow','');return this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0xf3'),_0x5ab091['speech']));}return this[_0xf803('0xe')][_0xf803('0x2a')](_0x3d7f36,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xf803('0x10')][_0xf803('0xf4')]=function(_0x3a77b0){logger[_0xf803('0x2c')](util[_0xf803('0xa4')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x3a77b0['label']));if(!this[_0xf803('0x8a')](_0x3a77b0[_0xf803('0x80')])){return this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0xf5'));}if(!this[_0xf803('0x8a')](_0x3a77b0[_0xf803('0x81')])){return this['channel'][_0xf803('0xaf')](_0xf803('0xf6'));}if(!this[_0xf803('0x8a')](_0x3a77b0[_0xf803('0x82')])){return this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0xf7'));}if(!this[_0xf803('0x8a')](_0x3a77b0['dialogflowV2_language'])){return this['channel'][_0xf803('0xaf')](_0xf803('0xf8'));}if(!this['isConfigured'](_0x3a77b0[_0xf803('0x5b')])){return this[_0xf803('0xe')][_0xf803('0xaf')]('no\x20text\x20configured');}this['channel'][_0xf803('0xf0')]=!![];this[_0xf803('0x33')](_0x3a77b0);this[_0xf803('0x3e')](_0x3a77b0['text'],'in','','');this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0xf9'),_0x3a77b0['text']));var _0x7f14ad=this[_0xf803('0x7f')][_0xf803('0x73')](this,_0x3a77b0);if(_0x7f14ad){for(var _0x5e0ca9 in _0x7f14ad){if(_0x7f14ad[_0xf803('0x9a')](_0x5e0ca9)){if(_0x5e0ca9!=='providerResponse'){this[_0xf803('0xe')][_0xf803('0xa5')](util['format'](_0xf803('0xfa'),_0x5e0ca9[_0xf803('0x6b')]()),_0x7f14ad[_0x5e0ca9]);}}}this[_0xf803('0x3e')](_0x7f14ad[_0xf803('0xf2')],_0xf803('0xfb'),_0xf803('0xf4'),_0x7f14ad[_0xf803('0xfc')]);return this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0xfd'),_0x7f14ad[_0xf803('0xf2')]));}return this[_0xf803('0xe')][_0xf803('0x2a')](_0x3a77b0,_0xf803('0xfe'));};AGIVertices[_0xf803('0x10')][_0xf803('0xff')]=function(_0x4fc2eb){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x100'),_0x4fc2eb[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x4fc2eb[_0xf803('0x101')])){return this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0x102'));}if(!this[_0xf803('0x8a')](_0x4fc2eb[_0xf803('0x103')])){return this[_0xf803('0xe')]['noop'](_0xf803('0x104'));}if(!this['isConfigured'](_0x4fc2eb[_0xf803('0x105')])){return this[_0xf803('0xe')]['noop']('no\x20password\x20configured');}if(!this['isConfigured'](_0x4fc2eb[_0xf803('0x106')])){return this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0xb0'));}this[_0xf803('0xe')][_0xf803('0xf0')]=!![];this[_0xf803('0x33')](_0x4fc2eb);this['createSquareMessage'](_0x4fc2eb[_0xf803('0x5b')],'in','','');this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0x107'),_0x4fc2eb[_0xf803('0x5b')]));var _0xc2e5f8=this[_0xf803('0x84')][_0xf803('0x73')](this,_0x4fc2eb);if(_0xc2e5f8){for(var _0x455989 in _0xc2e5f8){if(_0xc2e5f8['hasOwnProperty'](_0x455989)){this[_0xf803('0xe')][_0xf803('0xa5')](util[_0xf803('0xa4')]('SESTEK_NDA_%s',_0x455989['toUpperCase']()),_0xc2e5f8[_0x455989]);}}this[_0xf803('0x3e')](_0xc2e5f8['speech'],_0xf803('0xfb'),_0xf803('0xff'),'');if(_0xc2e5f8[_0xf803('0x108')]){this[_0xf803('0xe')]['noop'](util[_0xf803('0xa4')](_0xf803('0x109'),_0xc2e5f8['audiofile']));var _0x4525d9=this[_0xf803('0xe')][_0xf803('0x10a')](_0xc2e5f8[_0xf803('0x108')]);try{fs['unlink'](_0xc2e5f8[_0xf803('0x108')]+_0xf803('0x10b'));}catch(_0x190163){logger['error'](_0x190163);}return _0x4525d9;}else{return this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0x10c'),_0xc2e5f8['speech']));}}return this[_0xf803('0xe')]['error'](_0x4fc2eb,_0xf803('0x10d'));};AGIVertices['prototype'][_0xf803('0x10e')]=function(_0xbc06b1){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x10f'),_0xbc06b1[_0xf803('0x35')]));return this[_0xf803('0xe')]['noop'](_0xf803('0x10e'));};AGIVertices[_0xf803('0x10')]['ext_dial']=function(_0x3c8fd9){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x110'),_0x3c8fd9[_0xf803('0x35')]));var _0x3a35f2='';if(_0x3c8fd9[_0xf803('0x111')]){if(!this[_0xf803('0x8a')](_0x3c8fd9[_0xf803('0x111')])){return this['channel'][_0xf803('0x2a')](_0x3c8fd9,_0xf803('0x112'));}else{var _0x30c7fb=parseInt(_0x3c8fd9[_0xf803('0x111')],0xa);if(isNaN(_0x30c7fb)){_0x3a35f2=_0x3c8fd9[_0xf803('0x111')];}else{_0x3a35f2=this['getTrunk']['sync'](this,_0x3c8fd9[_0xf803('0x111')]);if(!_0x3a35f2){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x3c8fd9,_0xf803('0x113'));}}}}else if(_0x3c8fd9['trunk_name']){_0x3a35f2=_0x3c8fd9[_0xf803('0x114')];}else{return this[_0xf803('0xe')][_0xf803('0x2a')](_0x3c8fd9,_0xf803('0x112'));}var _0x2ef4ed=this[_0xf803('0xe')]['exec'](_0xf803('0xe9'),[util['format']('SIP/%s/%s',_0x3a35f2,_0x3c8fd9[_0xf803('0x44')]),_0x3c8fd9[_0xf803('0x67')],_0x3c8fd9['opts'],_0x3c8fd9[_0xf803('0x65')]]);if(_0x2ef4ed['result']===-0x1){return _0x2ef4ed;}return this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0xec'),_0xf803('0xe9')));};AGIVertices['prototype']['finally']=function(_0x4ff0d5){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x115'),_0x4ff0d5['label']));return this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0x116'));};AGIVertices[_0xf803('0x10')][_0xf803('0x117')]=function(_0x466ea6){logger['info'](util[_0xf803('0xa4')](_0xf803('0x118'),_0x466ea6[_0xf803('0x35')]));if(_0x466ea6[_0xf803('0x119')]===0x0){return this[_0xf803('0xad')](_0x466ea6);}_0x466ea6[_0xf803('0x119')]-=0x1;if(!this[_0xf803('0x8a')](_0x466ea6[_0xf803('0x11a')])){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x466ea6,_0xf803('0x11b'));}var _0x30e007=this[_0xf803('0x1f')][_0xf803('0x73')](this,_0x466ea6[_0xf803('0x11a')]);if(!_0x30e007){return this[_0xf803('0xe')]['error'](_0x466ea6,_0xf803('0x11c'));}if(!this['isConfigured'](_0x466ea6[_0xf803('0xdf')])){return this[_0xf803('0xe')][_0xf803('0x2a')](_0xf803('0xe0'));}var _0x187e0c=this[_0xf803('0xe')][_0xf803('0x11d')](_0x30e007,_0x466ea6['response'],_0x466ea6['maxdigit']);var _0xeb03f=_0x187e0c[_0xf803('0xab')]?_0x187e0c[_0xf803('0xab')]['toString']():'';logger[_0xf803('0x2c')]('test',JSON[_0xf803('0x76')](_0x187e0c));if(_0x187e0c['result']===-0x1){this[_0xf803('0x33')][_0xf803('0x73')](this,_0x466ea6,_0xeb03f);return _0x187e0c;}else if(_0x187e0c[_0xf803('0xa9')]===_0xf803('0x67')){_0x187e0c[_0xf803('0xab')]=_0xeb03f[_0xf803('0xa1')]>=parseInt(_0x466ea6['mindigit'])?'x':'i';}else{_0x187e0c[_0xf803('0xab')]=_0xeb03f[_0xf803('0xa1')]>=parseInt(_0x466ea6['mindigit'])&&_0xeb03f[_0xf803('0xa1')]<=parseInt(_0x466ea6[_0xf803('0x11e')])?'x':'i';}var _0x3521e5=this[_0xf803('0xa8')][_0xf803('0x73')](this,_0x466ea6['variable_id']);if(!_0x3521e5){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x466ea6,_0xf803('0x11f'));}this[_0xf803('0xe')][_0xf803('0xa5')](_0x3521e5,_0xeb03f);if(this[_0xf803('0x8a')](_0x466ea6['hiddendigitsnum'])){var _0x4525f8=parseInt(_0x466ea6['hiddendigitsnum'],0xa);var _0x4df7e2=rs[_0xf803('0x120')]({'charset':'*','length':_0x4525f8});var _0x576d24=_0xeb03f['length'];if(_0x576d24>0x0){if(_0x576d24>_0x4525f8){this[_0xf803('0x33')]['sync'](this,_0x466ea6,_0x466ea6[_0xf803('0x121')]===_0xf803('0x122')?_0x4df7e2+_0xeb03f[_0xf803('0x123')](_0x4525f8):_0xeb03f[_0xf803('0x123')](0x0,_0x576d24-_0x4525f8)+_0x4df7e2);}else{this['createSquareDetailsReport'][_0xf803('0x73')](this,_0x466ea6,rs[_0xf803('0x120')]({'charset':'*','length':_0x576d24}));}}else{this['createSquareDetailsReport'][_0xf803('0x73')](this,_0x466ea6,'');}}else{this[_0xf803('0x33')][_0xf803('0x73')](this,_0x466ea6,_0xeb03f);}return _0x187e0c;};AGIVertices['prototype']['getsecretdigits']=function(_0x4802c5){logger[_0xf803('0x2c')](util['format'](_0xf803('0x124'),_0x4802c5[_0xf803('0x35')]));return this['getdigits'](_0x4802c5);};AGIVertices[_0xf803('0x10')][_0xf803('0x125')]=function(_0x4a1715){logger['info'](util[_0xf803('0xa4')](_0xf803('0x126'),_0x4a1715[_0xf803('0x35')]));this[_0xf803('0x33')]['sync'](this,_0x4a1715,_0x4a1715[_0xf803('0x127')]);return this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0x128'),_0x4a1715[_0xf803('0x127')]));};AGIVertices['prototype'][_0xf803('0x129')]=function(_0x365b3f){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x12a'),_0x365b3f[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x365b3f[_0xf803('0x12b')])||!this['isConfigured'](_0x365b3f[_0xf803('0x8d')])){return this['channel']['noop'](_0xf803('0x12c'));}if(!this[_0xf803('0x8a')](_0x365b3f['text'])){return this[_0xf803('0xe')]['noop']('no\x20text\x20configured');}this[_0xf803('0xe')]['noop'](util['format'](_0xf803('0x12d'),_0x365b3f[_0xf803('0x5b')]));var _0x88fff=this[_0xf803('0x8c')]['sync'](this,_0x365b3f);if(_0x88fff){this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')]('aws\x20Polly\x20%s\x20file\x20created',_0x88fff));var _0x34820d=this['channel'][_0xf803('0x10a')](_0x88fff);try{fs[_0xf803('0x12e')](_0x88fff+_0xf803('0x10b'));}catch(_0x3fe0cc){logger[_0xf803('0x2a')](_0x3fe0cc);}return _0x34820d;}return this[_0xf803('0xe')][_0xf803('0x2a')](_0x365b3f,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xf803('0x10')][_0xf803('0x12f')]=function(_0x3d5cd6){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x130'),_0x3d5cd6[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x3d5cd6[_0xf803('0x12b')])||!this[_0xf803('0x8a')](_0x3d5cd6[_0xf803('0x8d')])){return this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0x12c'));}if(!this[_0xf803('0x8a')](_0x3d5cd6[_0xf803('0x93')])){return this['channel']['noop'](_0xf803('0x131'));}if(!this[_0xf803('0x8a')](_0x3d5cd6[_0xf803('0x5b')])){return this[_0xf803('0xe')][_0xf803('0xaf')]('no\x20text\x20configured');}this['channel'][_0xf803('0xf0')]=!![];this[_0xf803('0x33')](_0x3d5cd6);this[_0xf803('0x3e')](_0x3d5cd6[_0xf803('0x5b')],'in','','');this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')]('Trying\x20Amazon\x20Lex:\x20%s',_0x3d5cd6[_0xf803('0x5b')]));var _0x2e5cb5=this[_0xf803('0x91')][_0xf803('0x73')](this,_0x3d5cd6);if(_0x2e5cb5){for(var _0x256c45 in _0x2e5cb5){if(_0x2e5cb5[_0xf803('0x9a')](_0x256c45)&&_[_0xf803('0x9b')](_0x2e5cb5[_0x256c45])){this['channel'][_0xf803('0xa5')](util[_0xf803('0xa4')]('AWS_LEX_%s',_0x256c45['toUpperCase']()),_0x2e5cb5[_0x256c45]);}}if(_[_0xf803('0x4c')](_0x2e5cb5['message'])){return this[_0xf803('0xe')]['noop'](_0xf803('0x132'));}else{this[_0xf803('0x3e')](_0x2e5cb5[_0xf803('0x133')],_0xf803('0xfb'),_0xf803('0x134'),'');return this[_0xf803('0xe')]['noop'](util[_0xf803('0xa4')](_0xf803('0x135'),_0x2e5cb5[_0xf803('0x133')]));}}return this['channel']['error'](_0x3d5cd6,_0xf803('0x136'));};AGIVertices['prototype']['googleasr']=function(_0xe31aab){logger[_0xf803('0x2c')](util['format']('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0xe31aab['label'],_0xe31aab[_0xf803('0x67')]));if(!this[_0xf803('0x8a')](_0xe31aab[_0xf803('0x7d')])){return this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0xef'));}var _0x5245c6=_0xf803('0x137');var _0x132863=util[_0xf803('0xa4')](_0xf803('0x138'),FILES_PATH,rs[_0xf803('0x120')](0x4));var _0x4023fb=util[_0xf803('0xa4')](_0xf803('0xa2'),_0x132863,_0x5245c6);var _0x13b043=!![];if(_0xe31aab[_0xf803('0x139')]===_0xf803('0x13a')){_0x13b043=![];}var _0x23beb9=this[_0xf803('0xe')][_0xf803('0x13b')](_0x132863,_0x5245c6,_0xe31aab[_0xf803('0x13c')],_0xe31aab[_0xf803('0x67')],undefined,_0x13b043);if(_0x23beb9[_0xf803('0xab')]!==-0x1){this[_0xf803('0xe')]['noop'](util[_0xf803('0xa4')]('google\x20%s\x20file\x20created',_0x4023fb));var _0x13967e=this[_0xf803('0x94')][_0xf803('0x73')](this,_0xe31aab,_0x4023fb);if(_0x13967e){for(var _0x136b31 in _0x13967e){if(_0x13967e[_0xf803('0x9a')](_0x136b31)){this[_0xf803('0xe')][_0xf803('0xa5')](util['format'](_0xf803('0x13d'),_0x136b31[_0xf803('0x6b')]()),_0x13967e[_0x136b31]);}}return this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0x13e'),JSON['stringify'](_0x13967e)));}}return _0x23beb9;};AGIVertices[_0xf803('0x10')][_0xf803('0x13f')]=function(_0x56b981){logger[_0xf803('0x2c')](util[_0xf803('0xa4')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x56b981['label']));if(!this[_0xf803('0x8a')](_0x56b981[_0xf803('0x96')])){return this['channel'][_0xf803('0xaf')](_0xf803('0x140'));}if(!this[_0xf803('0x8a')](_0x56b981[_0xf803('0x141')])){return this['channel'][_0xf803('0xaf')](_0xf803('0x142'));}var _0x22dfe3='wav';var _0x5ab63f=util['format'](_0xf803('0x138'),FILES_PATH,rs[_0xf803('0x120')](0x4));var _0x27c458=util['format'](_0xf803('0xa2'),_0x5ab63f,_0x22dfe3);var _0x1e0102=!![];if(_0x56b981['beep']===_0xf803('0x13a')){_0x1e0102=![];}var _0x5b814f=this[_0xf803('0xe')][_0xf803('0x13b')](_0x5ab63f,_0x22dfe3,_0x56b981[_0xf803('0x13c')],_0x56b981[_0xf803('0x67')],undefined,_0x1e0102);if(_0x5b814f['result']!==-0x1){this['channel']['noop'](util[_0xf803('0xa4')]('tilde\x20%s\x20file\x20created',_0x27c458));var _0x454fd3=this['tildeASR'][_0xf803('0x73')](this,_0x56b981,_0x27c458);if(_0x454fd3){for(var _0x43a98f in _0x454fd3){if(_0x454fd3[_0xf803('0x9a')](_0x43a98f)){this[_0xf803('0xe')][_0xf803('0xa5')](util[_0xf803('0xa4')](_0xf803('0x143'),_0x43a98f['toUpperCase']()),_0x454fd3[_0x43a98f]);}}return this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')]('TildeASR\x20Result\x20%s',JSON['stringify'](_0x454fd3)));}}return _0x5b814f;};AGIVertices[_0xf803('0x10')][_0xf803('0x144')]=function(_0x460c38){logger[_0xf803('0x2c')](util['format'](_0xf803('0x145'),_0x460c38[_0xf803('0x35')]));return this[_0xf803('0xe')]['continueAt'](_0x460c38[_0xf803('0x146')],_0x460c38[_0xf803('0x3a')],_0x460c38[_0xf803('0x3b')]);};AGIVertices['prototype']['gotoif']=function(_0x31d1ab){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x147'),_0x31d1ab[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x31d1ab['condition'])){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x31d1ab,'no\x20condition\x20configured');}try{var _0x204d6e=eval(_0x31d1ab[_0xf803('0x148')])?'true':_0xf803('0x149');this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0x14a'),_0x31d1ab['condition'],_0x204d6e));return{'code':0xc8,'result':_0x204d6e};}catch(_0x21242b){return{'code':0xc8,'result':_0xf803('0x149')};}};AGIVertices[_0xf803('0x10')][_0xf803('0x14b')]=function(_0x272eb9){logger['info'](util[_0xf803('0xa4')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x272eb9[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x272eb9['interval_id'])){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x272eb9,'no\x20interval\x20configured');}var _0x35a1b0=this['getIntervals'][_0xf803('0x73')](this,_0x272eb9[_0xf803('0x14c')]);if(!_0x35a1b0){return this[_0xf803('0xe')]['error'](_0x272eb9,_0xf803('0x14d'));}for(var _0x14264d=0x0;_0x14264d<_0x35a1b0[_0xf803('0xa1')];_0x14264d+=0x1){var _0x2ea4e2=this[_0xf803('0xe')][_0xf803('0xa8')](util['format']('IFTIME(%s?true:false)',_0x35a1b0[_0x14264d]));if(_0x2ea4e2['result']===-0x1){return _0x2ea4e2;}logger['info'](util[_0xf803('0xa4')]('IFTIME\x20%s\x20%s',_0x35a1b0[_0x14264d],_0x2ea4e2['extra']));if(_0x2ea4e2[_0xf803('0xa9')]===_0xf803('0x14e')){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x14f'),_0x35a1b0[_0x14264d],_0xf803('0x14e')));this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')]('IFTIME\x20%s\x20%s',_0x35a1b0[_0x14264d],_0xf803('0x14e')));return{'code':0xc8,'result':_0xf803('0x14e')};}else{logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x35a1b0[_0x14264d],_0xf803('0x149')));this[_0xf803('0xe')]['noop'](util[_0xf803('0xa4')]('IFTIME\x20%s\x20%s',_0x35a1b0[_0x14264d],_0xf803('0x149')));}}return{'code':0xc8,'result':_0xf803('0x149')};};AGIVertices['prototype']['hangup']=function(_0x3a7024){logger['info'](util[_0xf803('0xa4')](_0xf803('0x150'),_0x3a7024[_0xf803('0x35')]));return this[_0xf803('0xe')][_0xf803('0x151')]();};AGIVertices[_0xf803('0x10')]['ispeechasr']=function(_0x493410){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x152'),_0x493410[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x493410[_0xf803('0x7d')])){return this[_0xf803('0xe')]['noop'](_0xf803('0xef'));}var _0x3bd9ec=_0xf803('0x137');var _0x9c5282=util[_0xf803('0xa4')](_0xf803('0x138'),FILES_PATH,rs[_0xf803('0x120')](0x4));var _0x2ebd06=util[_0xf803('0xa4')](_0xf803('0xa2'),_0x9c5282,_0x3bd9ec);var _0x3226bd=!![];if(_0x493410[_0xf803('0x139')]===_0xf803('0x13a')){_0x3226bd=![];}var _0x4c1b27=this['channel']['recordFile'](_0x9c5282,_0x3bd9ec,_0x493410[_0xf803('0x13c')],_0x493410[_0xf803('0x67')],undefined,_0x3226bd);if(_0x4c1b27[_0xf803('0xab')]!==-0x1){this['channel'][_0xf803('0xaf')](util[_0xf803('0xa4')]('ispeech\x20%s\x20file\x20created',_0x2ebd06));var _0x5c33b3=this[_0xf803('0x88')]['sync'](this,_0x493410,_0x2ebd06);if(_0x5c33b3){for(var _0x25547f in _0x5c33b3){if(_0x5c33b3[_0xf803('0x9a')](_0x25547f)){this[_0xf803('0xe')]['setVariable'](util['format'](_0xf803('0x153'),_0x25547f['toUpperCase']()),_0x5c33b3[_0x25547f]);}}return this['channel'][_0xf803('0xaf')](util['format'](_0xf803('0x154'),JSON['stringify'](_0x5c33b3)));}}return _0x4c1b27;};AGIVertices[_0xf803('0x10')]['ispeechtts']=function(_0x2d9348){logger['info'](util[_0xf803('0xa4')](_0xf803('0x155'),_0x2d9348[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x2d9348[_0xf803('0x7d')])){return this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0xef'));}if(!this[_0xf803('0x8a')](_0x2d9348[_0xf803('0x5b')])){return this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0xb0'));}this[_0xf803('0xe')]['noop'](util[_0xf803('0xa4')](_0xf803('0x156'),_0x2d9348[_0xf803('0x5b')]));var _0x56494d=this[_0xf803('0x85')][_0xf803('0x73')](this,_0x2d9348);if(_0x56494d){this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')]('ispeech\x20%s\x20file\x20created',_0x56494d));var _0x3a04a3=this[_0xf803('0xe')][_0xf803('0x10a')](_0x56494d,_0x2d9348['intKey']);try{fs[_0xf803('0x12e')](_0x56494d+_0xf803('0x10b'));}catch(_0x17ea80){logger[_0xf803('0x2a')](_0x17ea80);}return _0x3a04a3;}return this[_0xf803('0xe')]['error'](_0x2d9348,_0xf803('0x157'));};AGIVertices[_0xf803('0x10')][_0xf803('0x158')]=function(_0x53d958){logger[_0xf803('0x2c')](util['format'](_0xf803('0x159'),_0x53d958[_0xf803('0x35')]));if(!this['isConfigured'](_0x53d958[_0xf803('0x15a')])){return this[_0xf803('0xe')]['error'](_0x53d958,'no\x20find\x20by\x20configured');}logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x15b'),this[_0xf803('0xe')][_0xf803('0x37')],_0x53d958[_0xf803('0x15a')]));var _0x520a7a=this[_0xf803('0x53')]['sync'](this,_0x53d958['findBy']);if(_0x520a7a){logger[_0xf803('0x2c')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xf803('0xe')][_0xf803('0x37')],_0x53d958['findBy']));this[_0xf803('0xe')][_0xf803('0xaf')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xf803('0xe')][_0xf803('0x37')],_0x53d958[_0xf803('0x15a')]));return{'code':0xc8,'result':_0xf803('0x15c')};}else{logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x15d'),this[_0xf803('0xe')][_0xf803('0x37')],_0x53d958[_0xf803('0x15a')]));this[_0xf803('0xe')]['noop'](util[_0xf803('0xa4')](_0xf803('0x15d'),this[_0xf803('0xe')][_0xf803('0x37')],_0x53d958[_0xf803('0x15a')]));return{'code':0xc8,'result':_0xf803('0x15e')};}};AGIVertices[_0xf803('0x10')][_0xf803('0x15f')]=function(_0xa5d18){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x160'),_0xa5d18[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0xa5d18[_0xf803('0x15a')])){return this['channel']['error'](_0xa5d18,_0xf803('0x161'));}logger[_0xf803('0x2c')](util[_0xf803('0xa4')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xf803('0xe')][_0xf803('0x37')],_0xa5d18[_0xf803('0x15a')]));var _0x49565f=this[_0xf803('0x4f')]['sync'](this,_0xa5d18[_0xf803('0x15a')]);if(_0x49565f){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x162'),this[_0xf803('0xe')][_0xf803('0x37')],_0xa5d18[_0xf803('0x15a')]));this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0x162'),this['channel'][_0xf803('0x37')],_0xa5d18[_0xf803('0x15a')]));return{'code':0xc8,'result':'success'};}else{logger[_0xf803('0x2c')](util['format'](_0xf803('0x15d'),this['channel'][_0xf803('0x37')],_0xa5d18[_0xf803('0x15a')]));this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf803('0xe')][_0xf803('0x37')],_0xa5d18[_0xf803('0x15a')]));return{'code':0xc8,'result':_0xf803('0x15e')};}};AGIVertices[_0xf803('0x10')]['math']=function(_0x5cfd02){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x163'),_0x5cfd02[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x5cfd02[_0xf803('0x164')])){return this[_0xf803('0xe')]['error'](_0x5cfd02,'no\x20operation\x20configured');}this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0x165'),_0x5cfd02['operation']));var _0x5f3cbc=eval(_0x5cfd02[_0xf803('0x164')]);if(!this['isConfigured'](_0x5cfd02[_0xf803('0xdf')])){return this[_0xf803('0xe')]['noop'](_0xf803('0xe0'));}var _0x2966db=this[_0xf803('0xa8')]['sync'](this,_0x5cfd02[_0xf803('0xdf')]);if(!_0x2966db){return this[_0xf803('0xe')]['error'](_0x5cfd02,'no\x20variable\x20found');}if(_['isArray'](_0x5f3cbc)){var _0x25d40b=this;_0x5f3cbc['forEach'](function(_0x1e4586,_0x50c54d){_0x25d40b['channel'][_0xf803('0xa5')](util['format']('%s[%s]',_0x2966db,_0x50c54d),_0x1e4586);});return this[_0xf803('0xe')][_0xf803('0xaf')](util['format']('variable\x20%s[key]\x20set',_0x2966db));}else{return this['channel'][_0xf803('0xa5')](_0x2966db,_0x5f3cbc);}};AGIVertices[_0xf803('0x10')]['menu']=function(_0x13df90){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x166'),_0x13df90[_0xf803('0x35')]));if(_0x13df90[_0xf803('0x119')]===0x0){return this[_0xf803('0xad')](_0x13df90);}_0x13df90[_0xf803('0x119')]-=0x1;if(!this[_0xf803('0x8a')](_0x13df90[_0xf803('0x11a')])){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x13df90,'no\x20file\x20audio\x20selected');}var _0x1190f4=this[_0xf803('0x1f')][_0xf803('0x73')](this,_0x13df90['file_id']);if(!_0x1190f4){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x13df90,_0xf803('0x11c'));}var _0x2294e2=this[_0xf803('0xe')][_0xf803('0x11d')](_0x1190f4,_0x13df90[_0xf803('0x167')],_0x13df90['digit']);var _0x1e8ac6=_0x2294e2[_0xf803('0xab')];if(_0x2294e2[_0xf803('0xab')]===-0x1){this[_0xf803('0x33')][_0xf803('0x73')](this,_0x13df90,'-1');return _0x2294e2;}else if(_0x2294e2[_0xf803('0xa9')]===_0xf803('0x67')){_0x2294e2['result']=_0x2294e2[_0xf803('0xab')][_0xf803('0xa1')]>0x0?_0x2294e2[_0xf803('0xab')]:'t';}else if(_['isEmpty'](_0x2294e2[_0xf803('0xab')])){_0x2294e2['result']='#';_0x1e8ac6='#';}if(!this[_0xf803('0x8a')](_0x13df90[_0xf803('0xdf')])){this[_0xf803('0xe')]['noop'](_0xf803('0xe0'));}else{var _0x22968f=this['getVariable']['sync'](this,_0x13df90['variable_id']);if(!_0x22968f){return this['channel']['error'](_0x13df90,_0xf803('0x11f'));}this[_0xf803('0xe')][_0xf803('0xa5')](_0x22968f,_0x1e8ac6);}this['createSquareDetailsReport'][_0xf803('0x73')](this,_0x13df90,_0x1e8ac6);return _0x2294e2;};AGIVertices[_0xf803('0x10')][_0xf803('0xaf')]=function(_0x233e80){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x168'),_0x233e80[_0xf803('0x35')]));return this['channel'][_0xf803('0xaf')](_0x233e80[_0xf803('0x169')]||_0x233e80[_0xf803('0x35')]);};AGIVertices[_0xf803('0x10')]['pause']=function(_0x585a81){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x16a'),_0x585a81['label']));if(!this[_0xf803('0x8a')](_0x585a81[_0xf803('0x15a')])){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x585a81,_0xf803('0x161'));}logger['info'](util[_0xf803('0xa4')](_0xf803('0x15b'),this[_0xf803('0xe')]['callerid'],_0x585a81[_0xf803('0x15a')]));var _0xf25ad5=this[_0xf803('0x4a')][_0xf803('0x73')](this,_0x585a81[_0xf803('0x16b')]);var _0x16dee8=this[_0xf803('0x4b')][_0xf803('0x73')](this,_0x585a81['findBy'],_0xf25ad5);if(_0x16dee8){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x162'),this[_0xf803('0xe')][_0xf803('0x37')],_0x585a81[_0xf803('0x15a')]));this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0x162'),this['channel'][_0xf803('0x37')],_0x585a81[_0xf803('0x15a')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xf803('0xa4')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xf803('0xe')][_0xf803('0x37')],_0x585a81[_0xf803('0x15a')]));this['channel'][_0xf803('0xaf')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xf803('0xe')][_0xf803('0x37')],_0x585a81['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xf803('0x16c')]=function(_0x1d97e6){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x16d'),_0x1d97e6[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x1d97e6[_0xf803('0x11a')])){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x1d97e6,_0xf803('0x11b'));}var _0x3d88e5=this['getSound'][_0xf803('0x73')](this,_0x1d97e6[_0xf803('0x11a')]);if(!_0x3d88e5){return this['channel'][_0xf803('0x2a')](_0x1d97e6,'no\x20file\x20audio\x20found');}var _0x3bf769=this['channel'][_0xf803('0x55')](_0xf803('0x16e'),[_0x3d88e5,_0x1d97e6['opts']]);if(_0x3bf769[_0xf803('0xab')]===-0x1){return _0x3bf769;}return this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0xc7'),_0xf803('0x16e'),_0x3d88e5));};AGIVertices[_0xf803('0x10')][_0xf803('0x16f')]=function(_0x447c52){logger[_0xf803('0x2c')](util[_0xf803('0xa4')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x447c52[_0xf803('0x35')]));if(!this['isConfigured'](_0x447c52['queue_id'])){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x447c52,_0xf803('0x170'));}var _0x422ad6='';var _0x484a8b=parseInt(_0x447c52[_0xf803('0x171')],0xa);if(isNaN(_0x484a8b)){_0x422ad6=_0x447c52[_0xf803('0x171')];}else{_0x422ad6=this[_0xf803('0x15')][_0xf803('0x73')](this,_0x447c52[_0xf803('0x171')]);if(!_0x422ad6){return this['channel'][_0xf803('0x2a')](_0x447c52,_0xf803('0x172'));}}var _0x163d47='';if(this['isConfigured'](_0x447c52['file_id'])){var _0x26ff1a=this[_0xf803('0x1f')][_0xf803('0x73')](this,_0x447c52['file_id']);if(_0x26ff1a){_0x163d47=_0x26ff1a;}}this[_0xf803('0x33')][_0xf803('0x73')](this,_0x447c52,_0x422ad6);if(_0x447c52[_0xf803('0xeb')]['indexOf']('x')<0x0){_0x447c52['opts']+='x';}if(_0x447c52[_0xf803('0xeb')][_0xf803('0x173')]('X')<0x0){_0x447c52[_0xf803('0xeb')]+='X';}this[_0xf803('0xe')][_0xf803('0xa5')](_0xf803('0x174'),_0x422ad6?_0x422ad6[_0xf803('0x175')]():'');var _0x113f5d=this[_0xf803('0xe')][_0xf803('0x55')]('QUEUE',[_0x422ad6,_0x447c52[_0xf803('0xeb')],_0x447c52[_0xf803('0x65')],_0x163d47,_0x447c52[_0xf803('0x67')],_0x447c52[_0xf803('0x7')],_0x447c52[_0xf803('0x176')],_0x447c52['gosub'],'',_0x447c52[_0xf803('0x177')]]);if(_0x113f5d['result']===-0x1){return _0x113f5d;}return this[_0xf803('0xe')]['noop'](util[_0xf803('0xa4')](_0xf803('0xc7'),_0xf803('0x178'),_0x422ad6));};AGIVertices[_0xf803('0x10')]['record']=function(_0x54f470){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x179'),_0x54f470[_0xf803('0x35')]));var _0x19d2a0=_0x54f470[_0xf803('0x17a')]||_0xf803('0x137');var _0x579cf5=util['format'](_0xf803('0x17b'),this[_0xf803('0xe')]['uniqueid'],rs[_0xf803('0x120')](0x5));var _0x159a5a=util[_0xf803('0xa4')](_0xf803('0x17c'),FILES_PATH,_0x579cf5,_0x19d2a0);var _0x16dee0=util[_0xf803('0xa4')](_0xf803('0x138'),FILES_PATH,_0x579cf5);this[_0xf803('0x38')]['sync'](this,_0x54f470,_0x579cf5,_0x159a5a);this['channel'][_0xf803('0xa5')]('RECORDING_SAVENAME',_0x579cf5);logger[_0xf803('0x2c')](_0xf803('0x17d'),_0x16dee0,_0x19d2a0,_0x54f470['escape_digits'],_0x54f470[_0xf803('0x67')]);return this['channel'][_0xf803('0x13b')](_0x16dee0,_0x19d2a0,_0x54f470[_0xf803('0x17e')],_0x54f470['timeout'],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x9c896c){logger['info'](util[_0xf803('0xa4')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x9c896c[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x9c896c['url'])){return this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0x17f'));}var _0xb959e3=this['restAPI'][_0xf803('0x73')](this,_0x9c896c);logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x180'),util[_0xf803('0x181')](_0xb959e3,{'showHidden':![],'depth':null})));if(!this[_0xf803('0x8a')](_0x9c896c[_0xf803('0xdf')])){return this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0x182'));}var _0x3844d2=this[_0xf803('0xa8')]['sync'](this,_0x9c896c[_0xf803('0xdf')]);if(!_0x3844d2){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x9c896c,_0xf803('0x11f'));}this[_0xf803('0xe')][_0xf803('0xa5')](util[_0xf803('0xa4')]('%s_STATUS_CODE',_0x3844d2),_0xb959e3[_0xf803('0x78')]?_0xb959e3['statusCode']:_0xf803('0x183'));this[_0xf803('0xe')]['setVariable'](util['format'](_0xf803('0x184'),_0x3844d2),_0xb959e3[_0xf803('0x79')]?_0xb959e3[_0xf803('0x79')]:'OK');if(_0xb959e3['body']){try{this[_0xf803('0xa3')](_0xb959e3[_0xf803('0x6c')],_0x3844d2);}catch(_0x4520cb){logger[_0xf803('0x2a')](util[_0xf803('0xa4')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x3844d2));}}return this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')]('variable\x20%s\x20set',_0x3844d2));};AGIVertices[_0xf803('0x10')]['saydigits']=function(_0x1a5ec3){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x185'),_0x1a5ec3[_0xf803('0x35')]));return this['channel']['sayDigits'](_0x1a5ec3[_0xf803('0x186')][_0xf803('0x57')](/\s+/g,''),_0x1a5ec3[_0xf803('0x17e')]);};AGIVertices[_0xf803('0x10')][_0xf803('0x187')]=function(_0x342c55){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x188'),_0x342c55['label']));return this[_0xf803('0xe')]['sayNumber'](_0x342c55['number']['replace'](/\s+/g,''),_0x342c55[_0xf803('0x17e')]);};AGIVertices[_0xf803('0x10')][_0xf803('0x189')]=function(_0x4182b1){logger['info'](util[_0xf803('0xa4')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x4182b1['label']));return this['channel'][_0xf803('0x18a')](_0x4182b1[_0xf803('0x5b')],_0x4182b1[_0xf803('0x17e')]);};AGIVertices[_0xf803('0x10')][_0xf803('0x18b')]=function(_0x531773){logger[_0xf803('0x2c')](util['format'](_0xf803('0x18c'),_0x531773['label']));if(!this[_0xf803('0x8a')](_0x531773[_0xf803('0x18d')])){return this[_0xf803('0xe')]['noop'](_0xf803('0x18e'));}var _0x4c170f=this[_0xf803('0x18f')]['sync'](this,_0x531773[_0xf803('0x18d')]);if(!_0x4c170f||!_0x4c170f['Smtp']){return this['channel']['error'](_0x531773,_0xf803('0x190'));}var _0x3914e6={'from':util['format']('\x22%s\x22\x20<%s>',_0x4c170f[_0xf803('0x17')],_0x4c170f[_0xf803('0x191')]||_0x4c170f[_0xf803('0x192')]['user']),'to':_0x531773['to']||'','cc':_0x531773['cc']||'','bcc':_0x531773[_0xf803('0x193')]||'','subject':_0x531773[_0xf803('0x194')],'html':_0x531773[_0xf803('0x5b')],'text':_0x531773[_0xf803('0x5b')]};if(this['isConfigured'](_0x531773[_0xf803('0x195')])){}logger['debug'](_0xf803('0x196'),JSON[_0xf803('0x76')](_0x3914e6));this[_0xf803('0x33')][_0xf803('0x73')](this,_0x531773,_0x531773[_0xf803('0x18d')]);this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0x197'),_0x4c170f[_0xf803('0x17')]));this['sendMailMessage']['sync'](this,_0x4c170f[_0xf803('0x198')],_0x3914e6);return this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0x199'));};AGIVertices[_0xf803('0x10')][_0xf803('0x19a')]=function(_0x20b8e3){logger['info'](util[_0xf803('0xa4')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x20b8e3[_0xf803('0x35')]));return this['channel'][_0xf803('0xaf')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype'][_0xf803('0x19b')]=function(_0x24ca5d){logger[_0xf803('0x2c')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x24ca5d[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x24ca5d[_0xf803('0x19c')])){return this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0x19d'));}var _0x5c31c7=this[_0xf803('0x19e')][_0xf803('0x73')](this,_0x24ca5d[_0xf803('0x19c')]);if(!_0x5c31c7){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x24ca5d,'no\x20sms\x20account\x20found');}var _0x37b832={'body':_0x24ca5d[_0xf803('0x19f')],'phone':_0x24ca5d['to']||'','SmsAccountId':_0x5c31c7['id']};logger[_0xf803('0x1a0')](_0xf803('0x1a1'),JSON['stringify'](_0x37b832));this['createSquareDetailsReport'][_0xf803('0x73')](this,_0x24ca5d,_0x24ca5d[_0xf803('0x19c')]);this[_0xf803('0xe')][_0xf803('0xaf')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x5c31c7[_0xf803('0x17')]));this[_0xf803('0x32')][_0xf803('0x73')](this,_0x37b832);return this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0x1a2'));};AGIVertices[_0xf803('0x10')][_0xf803('0x1a3')]=function(_0x62ed15){logger['info'](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x62ed15[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x62ed15[_0xf803('0xdf')])){return this[_0xf803('0xe')]['error'](_0x62ed15,_0xf803('0x1a4'));}var _0x5ab5de=this['getVariable'][_0xf803('0x73')](this,_0x62ed15['variable_id']);if(!_0x5ab5de){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x62ed15,_0xf803('0x11f'));}return this[_0xf803('0xe')][_0xf803('0xa5')](_0x5ab5de,_0x62ed15['variable_value']);};AGIVertices[_0xf803('0x10')][_0xf803('0x1a5')]=function(_0x2cd839){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x1a6'),_0x2cd839['label']));this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0x1a7'));if(_0x2cd839['answer']===_0xf803('0x1a8')){this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0x1a9'));return this[_0xf803('0xe')][_0xf803('0xbd')]();}return this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0x1aa'));};AGIVertices[_0xf803('0x10')][_0xf803('0x1ab')]=function(_0x330a35){logger['info'](util[_0xf803('0xa4')](_0xf803('0x1ac'),_0x330a35[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x330a35[_0xf803('0x1ad')])){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x330a35,_0xf803('0x1ae'));}var _0x3b1f89=this[_0xf803('0x18')]['sync'](this,_0x330a35['project_id']);if(!this['isConfigured'](_0x3b1f89)){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x330a35,util[_0xf803('0xa4')](_0xf803('0x1af'),_0x330a35[_0xf803('0x1ad')]));}if(_0x3b1f89===this[_0xf803('0xe')]['arg_1']){return this['channel']['error'](_0x330a35,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xf803('0x33')][_0xf803('0x73')](this,_0x330a35,_0x3b1f89);var _0x1fac7a=this[_0xf803('0xe')][_0xf803('0x55')](_0xf803('0x1b0'),util[_0xf803('0xa4')](_0xf803('0x1b1'),config[_0xf803('0x7')]['host']||_0xf803('0x1b2'),_0x3b1f89,this['channel'][_0xf803('0x36')]));if(_0x1fac7a[_0xf803('0xab')]===-0x1){return _0x1fac7a;}return this['channel'][_0xf803('0xaf')](util['format'](_0xf803('0xc7'),_0xf803('0x1b0'),_0x3b1f89));};AGIVertices[_0xf803('0x10')]['system']=function(_0x2b28c2){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x1b3'),_0x2b28c2[_0xf803('0x35')]));var _0x48d336=this[_0xf803('0x54')][_0xf803('0x73')](this,_0x2b28c2[_0xf803('0xba')]);this['createSquareDetailsReport'][_0xf803('0x73')](this,_0x2b28c2,_0x2b28c2[_0xf803('0xba')]);if(this[_0xf803('0x8a')](_0x2b28c2[_0xf803('0xdf')])){var _0xdc16cf=this[_0xf803('0xa8')][_0xf803('0x73')](this,_0x2b28c2[_0xf803('0xdf')]);if(_0xdc16cf){this[_0xf803('0xe')][_0xf803('0xa5')](_0xdc16cf,_0x48d336);return this['channel']['noop'](util[_0xf803('0xa4')](_0xf803('0x1b4'),_0x2b28c2[_0xf803('0xba')],_0xdc16cf));}}return this['channel'][_0xf803('0xaf')](util[_0xf803('0xa4')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x2b28c2['command']));};AGIVertices[_0xf803('0x10')][_0xf803('0x1b5')]=function(_0x45d961){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x1b6'),_0x45d961['label']));_0x45d961[_0xf803('0x5b')]=_0x45d961[_0xf803('0x5b')][_0xf803('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xf803('0x8a')](_0x45d961[_0xf803('0x59')])){return this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0x1b7'));}if(!this[_0xf803('0x8a')](_0x45d961[_0xf803('0x5b')])){return this[_0xf803('0xe')][_0xf803('0xaf')](_0xf803('0xb0'));}this[_0xf803('0xe')]['noop'](util[_0xf803('0xa4')](_0xf803('0x1b8'),_0x45d961[_0xf803('0x5b')]));var _0xb919ee=this['googleCloudTTS'][_0xf803('0x73')](this,_0x45d961);if(_0xb919ee){this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0x1b9'),_0xb919ee));var _0x8ff1e=this['channel'][_0xf803('0x10a')](_0xb919ee);try{fs[_0xf803('0x12e')](_0xb919ee+_0xf803('0x10b'));}catch(_0x2c2ff0){logger['error'](_0x2c2ff0);}return _0x8ff1e;}return this[_0xf803('0xe')][_0xf803('0x2a')](_0x45d961,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['tts']=function(_0x4ca9e6){logger[_0xf803('0x2c')](util['format'](_0xf803('0x1ba'),_0x4ca9e6['label']));_0x4ca9e6[_0xf803('0x5b')]=_0x4ca9e6[_0xf803('0x5b')][_0xf803('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xf803('0x8a')](_0x4ca9e6[_0xf803('0x5b')])){return this[_0xf803('0xe')][_0xf803('0xaf')]('no\x20text\x20configured');}this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')]('Trying\x20Google\x20TTS\x20%s',_0x4ca9e6[_0xf803('0x5b')]));var _0x1e26cd=this[_0xf803('0x62')][_0xf803('0x73')](this,_0x4ca9e6);if(_0x1e26cd){this['channel']['noop'](util['format'](_0xf803('0x1bb'),_0x1e26cd));var _0x84b166=this[_0xf803('0xe')][_0xf803('0x10a')](_0x1e26cd);try{fs['unlink'](_0x1e26cd+_0xf803('0x10b'));}catch(_0x5a2a78){logger[_0xf803('0x2a')](_0x5a2a78);}return _0x84b166;}return this[_0xf803('0xe')]['error'](_0x4ca9e6,_0xf803('0x1bc'));};AGIVertices[_0xf803('0x10')][_0xf803('0x1bd')]=function(_0x11ae8e){logger[_0xf803('0x2c')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x11ae8e[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x11ae8e['findBy'])){return this['channel']['error'](_0x11ae8e,'no\x20find\x20by\x20configured');}logger['info'](util[_0xf803('0xa4')](_0xf803('0x15b'),this[_0xf803('0xe')]['callerid'],_0x11ae8e[_0xf803('0x15a')]));var _0x5318b5=this['agentUnpause']['sync'](this,_0x11ae8e[_0xf803('0x15a')]);if(_0x5318b5){logger[_0xf803('0x2c')](util['format'](_0xf803('0x162'),this[_0xf803('0xe')]['callerid'],_0x11ae8e[_0xf803('0x15a')]));this[_0xf803('0xe')][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0x162'),this['channel']['callerid'],_0x11ae8e['findBy']));return{'code':0xc8,'result':_0xf803('0x15c')};}else{logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x15d'),this[_0xf803('0xe')][_0xf803('0x37')],_0x11ae8e[_0xf803('0x15a')]));this['channel'][_0xf803('0xaf')](util[_0xf803('0xa4')](_0xf803('0x15d'),this['channel'][_0xf803('0x37')],_0x11ae8e[_0xf803('0x15a')]));return{'code':0xc8,'result':_0xf803('0x15e')};}};AGIVertices[_0xf803('0x10')][_0xf803('0x1be')]=function(_0x2dd63b){logger[_0xf803('0x2c')](util[_0xf803('0xa4')](_0xf803('0x1bf'),_0x2dd63b[_0xf803('0x35')]));var _0x14fae7=this[_0xf803('0xe')]['exec']('VOICEMAIL',[_0x2dd63b[_0xf803('0x1c0')],_0x2dd63b['options']]);if(_0x14fae7[_0xf803('0xab')]===-0x1){return _0x14fae7;}return this[_0xf803('0xe')][_0xf803('0xaf')](util['format'](_0xf803('0xc7'),'VOICEMAIL',_0x2dd63b[_0xf803('0x1c0')]));};AGIVertices[_0xf803('0x10')][_0xf803('0x1c1')]=function(_0x12d490){logger['info'](util['format'](_0xf803('0x1c2'),_0x12d490[_0xf803('0x35')]));if(!this[_0xf803('0x8a')](_0x12d490[_0xf803('0xdf')])){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x12d490,_0xf803('0x1a4'));}var _0xd9e08a=this[_0xf803('0xa8')][_0xf803('0x73')](this,_0x12d490[_0xf803('0xdf')]);if(!_0xd9e08a){return this[_0xf803('0xe')][_0xf803('0x2a')](_0x12d490,_0xf803('0x11f'));}var _0x25b2b2=this[_0xf803('0xe')]['getVariable'](_0xd9e08a);return{'code':0xc8,'result':_0x25b2b2[_0xf803('0xa9')]?_0x25b2b2[_0xf803('0xa9')]:'-'};};String[_0xf803('0x10')][_0xf803('0xa7')]=function(_0x353af9,_0x33bf16){return this[_0xf803('0xa6')](_0x353af9)[_0xf803('0x1c3')](_0x33bf16);};module[_0xf803('0x1c4')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 30a8fb6..4a339bd 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 _0x0309=['transfererlinkedid','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','ACW','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','lastPauseAt','update','error','[%s][UPDATE][ERRORS:%s]','catch','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','queue','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','mandatoryDisposition','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0x0309,0xb4));var _0x9030=function(_0x2409d7,_0x4b9e11){_0x2409d7=_0x2409d7-0x0;var _0x35aa2a=_0x0309[_0x2409d7];return _0x35aa2a;};'use strict';var util=require(_0x9030('0x0'));var _=require(_0x9030('0x1'));var moment=require('moment');var ami=require(_0x9030('0x2'));var logger=require(_0x9030('0x3'))(_0x9030('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x9030('0x5'));function Acw(_0x558b4e){this[_0x9030('0x6')]=_0x558b4e[_0x9030('0x6')];this[_0x9030('0x7')]=_0x558b4e['agents'];this[_0x9030('0x8')]=_0x558b4e[_0x9030('0x8')];this[_0x9030('0x9')]={};ami['on']('agentconnect',this[_0x9030('0xa')][_0x9030('0xb')](this));ami['on'](_0x9030('0xc'),this['syncHangupRequest'][_0x9030('0xb')](this));ami['on'](_0x9030('0xd'),this[_0x9030('0xe')][_0x9030('0xb')](this));ami['on'](_0x9030('0xf'),this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0x9030('0x10'),this[_0x9030('0x11')][_0x9030('0xb')](this));ami['on'](_0x9030('0x12'),this[_0x9030('0x13')][_0x9030('0xb')](this));ami['on'](_0x9030('0x14'),this['syncAgentConnectPreview'][_0x9030('0xb')](this));}function getDiff(_0x400c2b){var _0x1c2410=moment()[_0x9030('0x15')](0x0);var _0x4a6203=moment(_0x400c2b)[_0x9030('0x15')](0x0);return _0x1c2410[_0x9030('0x16')](_0x4a6203,_0x9030('0x17'));}Acw[_0x9030('0x18')][_0x9030('0x19')]=function(_0x23e981){try{var _0x3ccf5a=this;var _0x2f6e95=this[_0x9030('0x9')][_0x23e981][_0x9030('0x1a')];var _0x42bdfd=this['channels'][_0x23e981]['queue'];var _0x7898c2=this['voiceQueues'][_0x42bdfd];var _0x5eae52=![];var _0x56846a=_0x9030('0x1b');if(_0x7898c2['mandatoryDisposition']){if(_0x7898c2[_0x9030('0x1c')][_0x9030('0x1d')]){_0x5eae52=!![];_0x56846a=_0x7898c2[_0x9030('0x1c')]['name'];}}ami[_0x9030('0x1e')]({'action':_0x9030('0x1f'),'interface':_0x2f6e95,'paused':!![],'reason':_0x56846a})[_0x9030('0x20')](function(_0x40d7e2){if(_0x3ccf5a['agents'][_0x2f6e95]){return RpcUser[_0x9030('0x21')](_0x3ccf5a[_0x9030('0x7')][_0x2f6e95]['id'])[_0x9030('0x20')](function(_0x4a6c78){if(_0x4a6c78&&!_0x4a6c78[_0x9030('0x22')]){logger[_0x9030('0x23')](_0x9030('0x24'),_0x23e981,_0x2f6e95,_0x42bdfd);var _0x469036=_0x3ccf5a['channels'][_0x23e981][_0x9030('0x25')]&&_0x3ccf5a[_0x9030('0x9')][_0x23e981][_0x9030('0x26')]?_0x3ccf5a[_0x9030('0x9')][_0x23e981][_0x9030('0x26')]:_0x23e981;return RpcUser[_0x9030('0x27')](_0x3ccf5a[_0x9030('0x7')][_0x2f6e95],_0x56846a,_0x469036)[_0x9030('0x20')](function(_0x4af2e7){if(!_0x5eae52){_0x3ccf5a[_0x9030('0x8')][_0x2f6e95]={};logger[_0x9030('0x23')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x23e981,_0x3ccf5a[_0x9030('0x6')][_0x42bdfd][_0x9030('0x28')],_0x2f6e95,_0x42bdfd);_0x3ccf5a[_0x9030('0x8')][_0x2f6e95][_0x9030('0x29')]=setTimeout(_0x3ccf5a[_0x9030('0x2a')][_0x9030('0xb')](_0x3ccf5a,_0x2f6e95),_0x3ccf5a[_0x9030('0x6')][_0x42bdfd]['acwTimeout']*0x3e8);_0x3ccf5a[_0x9030('0x8')][_0x2f6e95]['lastPauseAt']=moment()[_0x9030('0x2b')](_0x9030('0x2c'));_0x3ccf5a['timers'][_0x2f6e95][_0x9030('0x2d')]=_0x23e981;_0x3ccf5a[_0x9030('0x8')][_0x2f6e95]['queue']=_0x42bdfd;_0x3ccf5a['timers'][_0x2f6e95][_0x9030('0x2e')]=function(){var _0x1e7260=getDiff(_0x3ccf5a[_0x9030('0x8')][_0x2f6e95][_0x9030('0x2f')]);clearTimeout(_0x3ccf5a[_0x9030('0x8')][_0x2f6e95]['timer']);_0x3ccf5a[_0x9030('0x8')][_0x2f6e95][_0x9030('0x29')]=![];RpcVoiceAgentReport[_0x9030('0x30')]({'acwtime':_0x1e7260},_0x3ccf5a['timers'][_0x2f6e95][_0x9030('0x2d')],_0x2f6e95)[_0x9030('0x20')](function(_0x37c866){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x23e981,_0x1e7260,_0x37c866);})['catch'](function(_0x477fe8){logger[_0x9030('0x31')](_0x9030('0x32'),_0x23e981,_0x477fe8);});delete _0x3ccf5a[_0x9030('0x8')][_0x2f6e95];};}});}else{logger[_0x9030('0x23')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x23e981,_0x2f6e95,_0x42bdfd);}});}})[_0x9030('0x33')](function(_0x2623c2){logger[_0x9030('0x31')](_0x9030('0x34'),_0x23e981,_0x3ccf5a[_0x9030('0x6')][_0x42bdfd][_0x9030('0x28')],_0x2f6e95,_0x42bdfd);})[_0x9030('0x35')](function(){delete _0x3ccf5a[_0x9030('0x9')][_0x23e981];});}catch(_0x3d5bc1){logger[_0x9030('0x31')](_0x9030('0x36'),_0x3d5bc1[_0x9030('0x37')]);}};Acw[_0x9030('0x18')][_0x9030('0x2a')]=function(_0x12d465){try{var _0x42c4db=this;if(_0x42c4db['timers'][_0x12d465]){_0x42c4db[_0x9030('0x8')][_0x12d465][_0x9030('0x29')]=![];var _0x32551d=_0x42c4db[_0x9030('0x8')][_0x12d465][_0x9030('0x2d')];var _0x231594=_0x42c4db[_0x9030('0x8')][_0x12d465][_0x9030('0x38')];var _0x29806e=_0x42c4db[_0x9030('0x6')][_0x231594][_0x9030('0x28')];logger[_0x9030('0x23')](_0x9030('0x39'),_0x32551d,_0x12d465);RpcUser[_0x9030('0x3a')](this[_0x9030('0x7')][_0x12d465]);RpcVoiceAgentReport[_0x9030('0x30')]({'acwtime':_0x29806e,'agentacw':!![]},_0x32551d,_0x12d465)[_0x9030('0x20')](function(_0x40a85b){logger[_0x9030('0x23')](_0x9030('0x3b'),_0x32551d,_0x29806e,_0x40a85b);})['catch'](function(_0x3911e1){logger[_0x9030('0x31')](_0x9030('0x32'),_0x32551d,_0x3911e1);});}else{logger[_0x9030('0x31')](_0x9030('0x3c'),_0x12d465);if(_0x42c4db['timers']){logger[_0x9030('0x23')](_0x9030('0x3d'),JSON[_0x9030('0x3e')](_0x42c4db['timers']));}}}catch(_0x3868d2){logger['error'](_0x9030('0x3f'),_0x3868d2['message']);}};Acw['prototype'][_0x9030('0xa')]=function(_0x1effa2){try{if(this[_0x9030('0x6')][_0x1effa2[_0x9030('0x38')]]&&(this['voiceQueues'][_0x1effa2['queue']][_0x9030('0x4')]||this['voiceQueues'][_0x1effa2[_0x9030('0x38')]]['mandatoryDisposition'])){if(this[_0x9030('0x7')][_0x1effa2['interface']]){this[_0x9030('0x9')][_0x1effa2[_0x9030('0x2d')]]={'queue':_0x1effa2['queue'],'interface':_0x1effa2[_0x9030('0x1a')],'destlinkedid':_0x1effa2[_0x9030('0x26')]};}}}catch(_0x2f1c5e){logger['error'](_0x9030('0x40'),_0x2f1c5e[_0x9030('0x37')]);}};Acw[_0x9030('0x18')]['syncAgentConnectPreview']=function(_0x30c559){try{if(this[_0x9030('0x6')][_0x30c559[_0x9030('0x38')]]&&(this['voiceQueues'][_0x30c559[_0x9030('0x38')]][_0x9030('0x4')]||this[_0x9030('0x6')][_0x30c559[_0x9030('0x38')]][_0x9030('0x41')])){if(this[_0x9030('0x7')][_0x30c559[_0x9030('0x1a')]]){this[_0x9030('0x9')][_0x30c559[_0x9030('0x2d')]]={'queue':_0x30c559['queue'],'interface':_0x30c559[_0x9030('0x1a')]};}}}catch(_0x16e747){logger[_0x9030('0x31')]('[ACW][syncAgentConnectPreview]\x20%s',_0x16e747['message']);}};Acw[_0x9030('0x18')]['syncHangupRequest']=function(_0x2ffa77){try{if(this['channels'][_0x2ffa77['uniqueid']]&&_[_0x9030('0x42')](this[_0x9030('0x9')][_0x2ffa77[_0x9030('0x2d')]][_0x9030('0x25')])){logger['info'](_0x9030('0x43'),_0x2ffa77[_0x9030('0x2d')]);this[_0x9030('0x19')](_0x2ffa77[_0x9030('0x2d')]);}else if(this[_0x9030('0x9')][_0x2ffa77[_0x9030('0x44')]]&&_[_0x9030('0x42')](this[_0x9030('0x9')][_0x2ffa77[_0x9030('0x44')]]['attended'])){logger['info'](_0x9030('0x45'),_0x2ffa77['linkedid']);this[_0x9030('0x19')](_0x2ffa77[_0x9030('0x44')]);}}catch(_0x2fa4d1){logger[_0x9030('0x31')]('[ACW][syncHangupRequest]\x20%s',_0x2fa4d1[_0x9030('0x37')]);}};Acw[_0x9030('0x18')][_0x9030('0xe')]=function(_0x43dc6d){try{if(this[_0x9030('0x9')][_0x43dc6d[_0x9030('0x2d')]]&&this[_0x9030('0x9')][_0x43dc6d[_0x9030('0x2d')]]['attended']){logger['info'](_0x9030('0x46'),_0x43dc6d['uniqueid']);this[_0x9030('0x19')](_0x43dc6d[_0x9030('0x2d')]);}else if(this[_0x9030('0x9')][_0x43dc6d[_0x9030('0x44')]]&&this['channels'][_0x43dc6d[_0x9030('0x44')]][_0x9030('0x25')]){logger['info'](_0x9030('0x47'),_0x43dc6d['linkedid']);this[_0x9030('0x19')](_0x43dc6d[_0x9030('0x44')]);}}catch(_0x58ed9c){logger[_0x9030('0x31')]('[ACW][syncHangup]\x20%s',_0x58ed9c['message']);}};Acw['prototype'][_0x9030('0x11')]=function(_0x220329){try{if(!_[_0x9030('0x48')](this[_0x9030('0x9')][_0x220329[_0x9030('0x49')]])){this[_0x9030('0x19')](_0x220329[_0x9030('0x49')]);if(this[_0x9030('0x9')][_0x220329[_0x9030('0x4a')]]){this[_0x9030('0x9')][_0x220329[_0x9030('0x4a')]]['attended']=!![];this[_0x9030('0x9')][_0x220329[_0x9030('0x4b')]]=this[_0x9030('0x9')][_0x220329[_0x9030('0x4a')]];delete this[_0x9030('0x9')][_0x220329[_0x9030('0x4a')]];}}else if(!_[_0x9030('0x48')](this[_0x9030('0x9')][_0x220329[_0x9030('0x4b')]])){this[_0x9030('0x19')](_0x220329['transfertargetuniqueid']);if(this['channels'][_0x220329[_0x9030('0x4c')]]){this[_0x9030('0x9')][_0x220329[_0x9030('0x4c')]][_0x9030('0x25')]=!![];this['channels'][_0x220329[_0x9030('0x49')]]=this[_0x9030('0x9')][_0x220329[_0x9030('0x4c')]];delete this['channels'][_0x220329[_0x9030('0x4c')]];}}}catch(_0x35b4a8){logger[_0x9030('0x31')](_0x9030('0x4d'),_0x35b4a8[_0x9030('0x37')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x447043){try{if(this[_0x9030('0x9')][_0x447043[_0x9030('0x4e')]]){logger[_0x9030('0x23')](_0x9030('0x4f'),JSON[_0x9030('0x3e')](_0x447043[_0x9030('0x4e')]));this['startAcw'](_0x447043[_0x9030('0x4e')]);}else if(this[_0x9030('0x9')][_0x447043['transfererlinkedid']]){logger[_0x9030('0x23')](_0x9030('0x50'),JSON[_0x9030('0x3e')](_0x447043[_0x9030('0x51')]));this[_0x9030('0x19')](_0x447043['transfererlinkedid']);}}catch(_0x4c9fb4){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x4c9fb4[_0x9030('0x37')]);}};Acw[_0x9030('0x18')]['syncAgentRingNoAnswer']=function(_0x2176b2){try{if(this[_0x9030('0x6')][_0x2176b2[_0x9030('0x38')]]&&this[_0x9030('0x6')][_0x2176b2[_0x9030('0x38')]][_0x9030('0x52')]===_0x9030('0x53')){if(this[_0x9030('0x7')][_0x2176b2[_0x9030('0x1a')]]){logger[_0x9030('0x23')](_0x9030('0x54'),_0x2176b2[_0x9030('0x2d')],_0x2176b2[_0x9030('0x1a')],_0x2176b2[_0x9030('0x38')]);return RpcUser[_0x9030('0x27')](this[_0x9030('0x7')][_0x2176b2[_0x9030('0x1a')]],'Auto-Pause',_0x2176b2[_0x9030('0x2d')]);}}}catch(_0x6605c6){logger[_0x9030('0x31')](_0x9030('0x55'),_0x6605c6[_0x9030('0x37')]);}};module[_0x9030('0x56')]=Acw; \ No newline at end of file +var _0x78c9=['[ACW][syncAgentRingNoAnswer]\x20%s','util','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','hanguprequest','bind','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','diff','seconds','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','attended','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20%s','message','acw','[ACW][syncAgentConnect]\x20%s','syncHangupRequest','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x78c9,0x1aa));var _0x978c=function(_0x375662,_0x3386ca){_0x375662=_0x375662-0x0;var _0xa3e6d=_0x78c9[_0x375662];return _0xa3e6d;};'use strict';var util=require(_0x978c('0x0'));var _=require('lodash');var moment=require(_0x978c('0x1'));var ami=require(_0x978c('0x2'));var logger=require(_0x978c('0x3'))('acw');var RpcUser=require(_0x978c('0x4'));var RpcVoiceAgentReport=require(_0x978c('0x5'));function Acw(_0x4a4ee0){this['voiceQueues']=_0x4a4ee0[_0x978c('0x6')];this[_0x978c('0x7')]=_0x4a4ee0[_0x978c('0x7')];this[_0x978c('0x8')]=_0x4a4ee0[_0x978c('0x8')];this[_0x978c('0x9')]={};ami['on'](_0x978c('0xa'),this[_0x978c('0xb')]['bind'](this));ami['on'](_0x978c('0xc'),this['syncHangupRequest'][_0x978c('0xd')](this));ami['on']('hangup',this[_0x978c('0xe')][_0x978c('0xd')](this));ami['on'](_0x978c('0xf'),this[_0x978c('0x10')]['bind'](this));ami['on'](_0x978c('0x11'),this[_0x978c('0x12')][_0x978c('0xd')](this));ami['on'](_0x978c('0x13'),this[_0x978c('0x14')]['bind'](this));ami['on']('custom:agentConnectPreview',this[_0x978c('0x15')][_0x978c('0xd')](this));}function getDiff(_0x10a5df){var _0x44eef9=moment()[_0x978c('0x16')](0x0);var _0x16aabc=moment(_0x10a5df)[_0x978c('0x16')](0x0);return _0x44eef9[_0x978c('0x17')](_0x16aabc,_0x978c('0x18'));}Acw['prototype'][_0x978c('0x19')]=function(_0x2b5a27){try{var _0x508265=this;var _0x33f523=this[_0x978c('0x9')][_0x2b5a27][_0x978c('0x1a')];var _0x39dbf0=this[_0x978c('0x9')][_0x2b5a27][_0x978c('0x1b')];var _0x4fbe13=this['voiceQueues'][_0x39dbf0];var _0x1d744b=![];var _0x1b3180=_0x978c('0x1c');if(_0x4fbe13[_0x978c('0x1d')]){if(_0x4fbe13[_0x978c('0x1e')]['name']){_0x1d744b=!![];_0x1b3180=_0x4fbe13[_0x978c('0x1e')][_0x978c('0x1f')];}}ami['Action']({'action':_0x978c('0x20'),'interface':_0x33f523,'paused':!![],'reason':_0x1b3180})[_0x978c('0x21')](function(_0x2b25d9){if(_0x508265['agents'][_0x33f523]){return RpcUser[_0x978c('0x22')](_0x508265[_0x978c('0x7')][_0x33f523]['id'])[_0x978c('0x21')](function(_0x3159f7){if(_0x3159f7&&!_0x3159f7['voicePause']){logger['info']('[%s][START][AGENT:%s][QUEUE:%s]',_0x2b5a27,_0x33f523,_0x39dbf0);var _0x14087a=_0x508265[_0x978c('0x9')][_0x2b5a27][_0x978c('0x23')]&&_0x508265[_0x978c('0x9')][_0x2b5a27][_0x978c('0x24')]?_0x508265[_0x978c('0x9')][_0x2b5a27][_0x978c('0x24')]:_0x2b5a27;return RpcUser[_0x978c('0x25')](_0x508265[_0x978c('0x7')][_0x33f523],_0x1b3180,_0x14087a)[_0x978c('0x21')](function(_0x34bcef){if(!_0x1d744b){_0x508265['timers'][_0x33f523]={};logger[_0x978c('0x26')](_0x978c('0x27'),_0x2b5a27,_0x508265[_0x978c('0x6')][_0x39dbf0][_0x978c('0x28')],_0x33f523,_0x39dbf0);_0x508265[_0x978c('0x8')][_0x33f523][_0x978c('0x29')]=setTimeout(_0x508265[_0x978c('0x2a')]['bind'](_0x508265,_0x33f523),_0x508265['voiceQueues'][_0x39dbf0]['acwTimeout']*0x3e8);_0x508265['timers'][_0x33f523][_0x978c('0x2b')]=moment()[_0x978c('0x2c')](_0x978c('0x2d'));_0x508265[_0x978c('0x8')][_0x33f523][_0x978c('0x2e')]=_0x2b5a27;_0x508265[_0x978c('0x8')][_0x33f523]['queue']=_0x39dbf0;_0x508265['timers'][_0x33f523][_0x978c('0x2f')]=function(){var _0x4f93d6=getDiff(_0x508265['timers'][_0x33f523][_0x978c('0x2b')]);clearTimeout(_0x508265[_0x978c('0x8')][_0x33f523]['timer']);_0x508265['timers'][_0x33f523][_0x978c('0x29')]=![];RpcVoiceAgentReport[_0x978c('0x30')]({'acwtime':_0x4f93d6},_0x508265['timers'][_0x33f523][_0x978c('0x2e')],_0x33f523)['then'](function(_0x1e73c0){logger[_0x978c('0x26')](_0x978c('0x31'),_0x2b5a27,_0x4f93d6,_0x1e73c0);})[_0x978c('0x32')](function(_0x24d865){logger[_0x978c('0x33')](_0x978c('0x34'),_0x2b5a27,_0x24d865);});delete _0x508265['timers'][_0x33f523];};}});}else{logger[_0x978c('0x26')](_0x978c('0x35'),_0x2b5a27,_0x33f523,_0x39dbf0);}});}})[_0x978c('0x32')](function(_0x2fcab3){logger['error'](_0x978c('0x27'),_0x2b5a27,_0x508265['voiceQueues'][_0x39dbf0][_0x978c('0x28')],_0x33f523,_0x39dbf0);})[_0x978c('0x36')](function(){delete _0x508265[_0x978c('0x9')][_0x2b5a27];});}catch(_0xbf0ee0){logger[_0x978c('0x33')](_0x978c('0x37'),_0xbf0ee0['message']);}};Acw[_0x978c('0x38')][_0x978c('0x2a')]=function(_0x5a8b89){try{var _0x87136b=this;if(_0x87136b['timers'][_0x5a8b89]){_0x87136b['timers'][_0x5a8b89][_0x978c('0x29')]=![];var _0x584196=_0x87136b[_0x978c('0x8')][_0x5a8b89][_0x978c('0x2e')];var _0x8e1832=_0x87136b[_0x978c('0x8')][_0x5a8b89][_0x978c('0x1b')];var _0x3b9e31=_0x87136b[_0x978c('0x6')][_0x8e1832][_0x978c('0x28')];logger[_0x978c('0x26')](_0x978c('0x39'),_0x584196,_0x5a8b89);RpcUser[_0x978c('0x3a')](this[_0x978c('0x7')][_0x5a8b89]);RpcVoiceAgentReport[_0x978c('0x30')]({'acwtime':_0x3b9e31,'agentacw':!![]},_0x584196,_0x5a8b89)[_0x978c('0x21')](function(_0x11f597){logger[_0x978c('0x26')](_0x978c('0x31'),_0x584196,_0x3b9e31,_0x11f597);})[_0x978c('0x32')](function(_0x2fc519){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x584196,_0x2fc519);});}else{logger[_0x978c('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x5a8b89);if(_0x87136b[_0x978c('0x8')]){logger[_0x978c('0x26')]('[ACW][TIMERS]',JSON['stringify'](_0x87136b[_0x978c('0x8')]));}}}catch(_0x3b7ca9){logger['error'](_0x978c('0x3b'),_0x3b7ca9[_0x978c('0x3c')]);}};Acw[_0x978c('0x38')][_0x978c('0xb')]=function(_0x24762d){try{if(this[_0x978c('0x6')][_0x24762d[_0x978c('0x1b')]]&&(this[_0x978c('0x6')][_0x24762d['queue']][_0x978c('0x3d')]||this[_0x978c('0x6')][_0x24762d[_0x978c('0x1b')]]['mandatoryDisposition'])){if(this[_0x978c('0x7')][_0x24762d[_0x978c('0x1a')]]){this[_0x978c('0x9')][_0x24762d[_0x978c('0x2e')]]={'queue':_0x24762d[_0x978c('0x1b')],'interface':_0x24762d[_0x978c('0x1a')],'destlinkedid':_0x24762d['destlinkedid']};}}}catch(_0x5d879e){logger['error'](_0x978c('0x3e'),_0x5d879e[_0x978c('0x3c')]);}};Acw[_0x978c('0x38')][_0x978c('0x15')]=function(_0x308b65){try{if(this['voiceQueues'][_0x308b65[_0x978c('0x1b')]]&&(this[_0x978c('0x6')][_0x308b65[_0x978c('0x1b')]][_0x978c('0x3d')]||this[_0x978c('0x6')][_0x308b65[_0x978c('0x1b')]]['mandatoryDisposition'])){if(this['agents'][_0x308b65['interface']]){this[_0x978c('0x9')][_0x308b65[_0x978c('0x2e')]]={'queue':_0x308b65[_0x978c('0x1b')],'interface':_0x308b65[_0x978c('0x1a')]};}}}catch(_0x4a8c47){logger[_0x978c('0x33')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4a8c47['message']);}};Acw[_0x978c('0x38')][_0x978c('0x3f')]=function(_0x2ba125){try{if(this[_0x978c('0x9')][_0x2ba125[_0x978c('0x2e')]]&&_[_0x978c('0x40')](this[_0x978c('0x9')][_0x2ba125[_0x978c('0x2e')]][_0x978c('0x23')])){logger[_0x978c('0x26')]('[%s][HANGUP:UNIQUEID]',_0x2ba125['uniqueid']);this[_0x978c('0x19')](_0x2ba125['uniqueid']);}else if(this[_0x978c('0x9')][_0x2ba125[_0x978c('0x41')]]&&_[_0x978c('0x40')](this['channels'][_0x2ba125[_0x978c('0x41')]][_0x978c('0x23')])){logger[_0x978c('0x26')](_0x978c('0x42'),_0x2ba125[_0x978c('0x41')]);this[_0x978c('0x19')](_0x2ba125[_0x978c('0x41')]);}}catch(_0x28e5b7){logger[_0x978c('0x33')](_0x978c('0x43'),_0x28e5b7['message']);}};Acw[_0x978c('0x38')]['syncHangup']=function(_0x43744c){try{if(this['channels'][_0x43744c[_0x978c('0x2e')]]&&this[_0x978c('0x9')][_0x43744c[_0x978c('0x2e')]][_0x978c('0x23')]){logger[_0x978c('0x26')](_0x978c('0x44'),_0x43744c[_0x978c('0x2e')]);this['startAcw'](_0x43744c[_0x978c('0x2e')]);}else if(this[_0x978c('0x9')][_0x43744c[_0x978c('0x41')]]&&this[_0x978c('0x9')][_0x43744c['linkedid']][_0x978c('0x23')]){logger[_0x978c('0x26')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x43744c['linkedid']);this[_0x978c('0x19')](_0x43744c[_0x978c('0x41')]);}}catch(_0x3d29d5){logger[_0x978c('0x33')](_0x978c('0x45'),_0x3d29d5[_0x978c('0x3c')]);}};Acw[_0x978c('0x38')][_0x978c('0x12')]=function(_0xb481ab){try{if(!_[_0x978c('0x46')](this[_0x978c('0x9')][_0xb481ab[_0x978c('0x47')]])){this[_0x978c('0x19')](_0xb481ab['transfereeuniqueid']);if(this[_0x978c('0x9')][_0xb481ab[_0x978c('0x48')]]){this[_0x978c('0x9')][_0xb481ab[_0x978c('0x48')]][_0x978c('0x23')]=!![];this[_0x978c('0x9')][_0xb481ab[_0x978c('0x49')]]=this[_0x978c('0x9')][_0xb481ab[_0x978c('0x48')]];delete this[_0x978c('0x9')][_0xb481ab[_0x978c('0x48')]];}}else if(!_['isNil'](this['channels'][_0xb481ab[_0x978c('0x49')]])){this['startAcw'](_0xb481ab[_0x978c('0x49')]);if(this[_0x978c('0x9')][_0xb481ab[_0x978c('0x4a')]]){this[_0x978c('0x9')][_0xb481ab[_0x978c('0x4a')]][_0x978c('0x23')]=!![];this[_0x978c('0x9')][_0xb481ab[_0x978c('0x47')]]=this[_0x978c('0x9')][_0xb481ab[_0x978c('0x4a')]];delete this['channels'][_0xb481ab[_0x978c('0x4a')]];}}}catch(_0x359fe5){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x359fe5[_0x978c('0x3c')]);}};Acw[_0x978c('0x38')][_0x978c('0x14')]=function(_0x541be5){try{if(this[_0x978c('0x9')][_0x541be5[_0x978c('0x4b')]]){logger[_0x978c('0x26')](_0x978c('0x4c'),JSON[_0x978c('0x4d')](_0x541be5['transfereruniqueid']));this[_0x978c('0x19')](_0x541be5[_0x978c('0x4b')]);}else if(this[_0x978c('0x9')][_0x541be5[_0x978c('0x4e')]]){logger[_0x978c('0x26')](_0x978c('0x4f'),JSON['stringify'](_0x541be5['transfererlinkedid']));this['startAcw'](_0x541be5['transfererlinkedid']);}}catch(_0x4429e8){logger['error'](_0x978c('0x50'),_0x4429e8['message']);}};Acw[_0x978c('0x38')]['syncAgentRingNoAnswer']=function(_0x363220){try{if(this[_0x978c('0x6')][_0x363220[_0x978c('0x1b')]]&&this[_0x978c('0x6')][_0x363220['queue']][_0x978c('0x51')]===_0x978c('0x52')){if(this[_0x978c('0x7')][_0x363220['interface']]){logger['info'](_0x978c('0x53'),_0x363220[_0x978c('0x2e')],_0x363220[_0x978c('0x1a')],_0x363220[_0x978c('0x1b')]);return RpcUser[_0x978c('0x25')](this[_0x978c('0x7')][_0x363220[_0x978c('0x1a')]],'Auto-Pause',_0x363220[_0x978c('0x2e')]);}}}catch(_0x5c26b9){logger[_0x978c('0x33')](_0x978c('0x54'),_0x5c26b9[_0x978c('0x3c')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 79c6d6b..ddbb7fd 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 _0xd8b0=['actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','../../config/logger','ami','../../config/environment','asterisk','port','username','password','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus'];(function(_0x4e686c,_0x477389){var _0x1541e6=function(_0x220b92){while(--_0x220b92){_0x4e686c['push'](_0x4e686c['shift']());}};_0x1541e6(++_0x477389);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Manager=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var moment=require('moment');var util=require('util');var _=require('lodash');var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var ami=new Manager(config[_0x0d8b('0x5')][_0x0d8b('0x6')],config['asterisk']['ip'],config['asterisk'][_0x0d8b('0x7')],config[_0x0d8b('0x5')][_0x0d8b('0x8')],!![]);ami['keepConnected']();ami[_0x0d8b('0x9')]=BPromise[_0x0d8b('0xa')](ami['action']);function error(_0x129310){logger[_0x0d8b('0xb')](util[_0x0d8b('0xc')](_0x0d8b('0xd'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port'],util[_0x0d8b('0xe')](_0x129310,![],null)));}function close(){logger['error'](util[_0x0d8b('0xc')](_0x0d8b('0xf'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')]));}ami[_0x0d8b('0x10')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x11')});};};ami[_0x0d8b('0x12')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x13')});};};ami[_0x0d8b('0x14')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x15')});};};ami[_0x0d8b('0x16')]=function(){return function(){return ami[_0x0d8b('0x9')]({'action':_0x0d8b('0x17')});};};ami[_0x0d8b('0x18')]=function(){return function(){return ami['Action']({'action':_0x0d8b('0x19')});};};function connect(_0x4586c2){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x1b'),config[_0x0d8b('0x5')][_0x0d8b('0x7')],config[_0x0d8b('0x5')]['ip'],config['asterisk'][_0x0d8b('0x6')]));ami[_0x0d8b('0x1c')](_0x0d8b('0xb'),error);ami[_0x0d8b('0x1c')](_0x0d8b('0x1d'),close);}ami['on'](_0x0d8b('0x1e'),connect);ami['on'](_0x0d8b('0x1f'),function(_0x352c17){logger['info'](util['format'](_0x0d8b('0x20'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x0d8b('0x5')][_0x0d8b('0x6')],util[_0x0d8b('0xe')](_0x352c17,![],null)));});ami['on'](_0x0d8b('0x21'),function(_0x221071){logger[_0x0d8b('0x1a')](util[_0x0d8b('0xc')](_0x0d8b('0x22'),config[_0x0d8b('0x5')]['username'],config[_0x0d8b('0x5')]['ip'],config[_0x0d8b('0x5')]['port']));return BPromise[_0x0d8b('0x23')]()['then'](ami[_0x0d8b('0x10')]())[_0x0d8b('0x24')](ami[_0x0d8b('0x12')]())['then'](ami['actionSipPeerStatus']())[_0x0d8b('0x24')](ami[_0x0d8b('0x16')]())['then'](ami[_0x0d8b('0x18')]())['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x25'),util['inspect'](_0x1b2b59,{'showHidden':![],'depth':null}));});});ami[_0x0d8b('0x1c')]('error',error);ami[_0x0d8b('0x1c')]('close',close);module[_0x0d8b('0x26')]=ami; \ No newline at end of file +var _0xb10b=['asterisk','port','password','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','username','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionCoreShowChannels','[ami.js][fullybooted]','asterisk-manager','moment','util','lodash','ami','../../config/environment'];(function(_0x2feddd,_0x31bd5f){var _0xe795cc=function(_0x65f8b){while(--_0x65f8b){_0x2feddd['push'](_0x2feddd['shift']());}};_0xe795cc(++_0x31bd5f);}(_0xb10b,0x12a));var _0xbb10=function(_0x4dcb47,_0x50ef92){_0x4dcb47=_0x4dcb47-0x0;var _0x352b40=_0xb10b[_0x4dcb47];return _0x352b40;};'use strict';var Manager=require(_0xbb10('0x0'));var BPromise=require('bluebird');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var _=require(_0xbb10('0x3'));var logger=require('../../config/logger')(_0xbb10('0x4'));var config=require(_0xbb10('0x5'));var ami=new Manager(config[_0xbb10('0x6')][_0xbb10('0x7')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['username'],config[_0xbb10('0x6')][_0xbb10('0x8')],!![]);ami['keepConnected']();ami[_0xbb10('0x9')]=BPromise[_0xbb10('0xa')](ami[_0xbb10('0xb')]);function error(_0x1c3ee5){logger[_0xbb10('0xc')](util[_0xbb10('0xd')](_0xbb10('0xe'),config[_0xbb10('0x6')]['username'],config['asterisk']['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x1c3ee5,![],null)));}function close(){logger['error'](util[_0xbb10('0xd')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')]));}ami[_0xbb10('0x11')]=function(){return function(){return ami['Action']({'action':_0xbb10('0x12')});};};ami[_0xbb10('0x13')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x14')});};};ami[_0xbb10('0x15')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x16')});};};ami[_0xbb10('0x17')]=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x18')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xbb10('0x9')]({'action':_0xbb10('0x19')});};};function connect(_0x133ac2){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x1b'),config[_0xbb10('0x6')][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')]['port']));ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami[_0xbb10('0x1c')](_0xbb10('0x1d'),close);}ami['on'](_0xbb10('0x1e'),connect);ami['on'](_0xbb10('0x1f'),function(_0x4deb49){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xbb10('0x10')],config[_0xbb10('0x6')]['ip'],config[_0xbb10('0x6')][_0xbb10('0x7')],util[_0xbb10('0xf')](_0x4deb49,![],null)));});ami['on'](_0xbb10('0x20'),function(_0x407cb4){logger[_0xbb10('0x1a')](util[_0xbb10('0xd')](_0xbb10('0x21'),config[_0xbb10('0x6')][_0xbb10('0x10')],config['asterisk']['ip'],config['asterisk']['port']));return BPromise[_0xbb10('0x22')]()[_0xbb10('0x23')](ami[_0xbb10('0x11')]())['then'](ami[_0xbb10('0x13')]())[_0xbb10('0x23')](ami[_0xbb10('0x15')]())[_0xbb10('0x23')](ami[_0xbb10('0x17')]())[_0xbb10('0x23')](ami[_0xbb10('0x24')]())['catch'](function(_0x3796c7){logger[_0xbb10('0xc')](_0xbb10('0x25'),util[_0xbb10('0xf')](_0x3796c7,{'showHidden':![],'depth':null}));});});ami[_0xbb10('0x1c')](_0xbb10('0xc'),error);ami['once'](_0xbb10('0x1d'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 6187f35..bf52ebf 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 _0x9c44=['ami','client','http','Request','then','debug','rpc','memberReport','error','message','result','exports','../../config/logger'];(function(_0x5f0de1,_0x285d01){var _0x1b9f66=function(_0x330213){while(--_0x330213){_0x5f0de1['push'](_0x5f0de1['shift']());}};_0x1b9f66(++_0x285d01);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var client=jayson[_0x49c4('0x2')][_0x49c4('0x3')]({'port':0x2329});client[_0x49c4('0x4')]=function(_0x2ad237,_0x4e0313){return new BPromise(function(_0x4941f1,_0x41a183){return client['request'](_0x2ad237,_0x4e0313)[_0x49c4('0x5')](function(_0x6030ae){logger[_0x49c4('0x6')](_0x49c4('0x7'),_0x49c4('0x8'),_0x2ad237,_0x4e0313,_0x6030ae);if(_0x6030ae['error']){logger[_0x49c4('0x9')](_0x49c4('0x7'),_0x49c4('0x8'),_0x2ad237,_0x6030ae[_0x49c4('0x9')]['message'],_0x4e0313);return _0x41a183(_0x6030ae['error'][_0x49c4('0xa')]);}else{return _0x4941f1(_0x6030ae[_0x49c4('0xb')]);}})['catch'](function(_0xb611a1){logger[_0x49c4('0x9')]('rpc','memberReport',_0x2ad237,_0xb611a1,_0x4e0313);return _0x41a183(_0xb611a1);});});};module[_0x49c4('0xc')]=client; \ No newline at end of file +var _0x9ffd=['catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','then','debug','rpc','memberReport','error','result'];(function(_0x16e967,_0x373b33){var _0x59a637=function(_0x5e1b60){while(--_0x5e1b60){_0x16e967['push'](_0x16e967['shift']());}};_0x59a637(++_0x373b33);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4641d2,_0x1e7dd3){_0x4641d2=_0x4641d2-0x0;var _0x15bafa=_0x9ffd[_0x4641d2];return _0x15bafa;};'use strict';var jayson=require(_0xd9ff('0x0'));var BPromise=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('ami');var client=jayson[_0xd9ff('0x3')][_0xd9ff('0x4')]({'port':0x2329});client[_0xd9ff('0x5')]=function(_0x5493ae,_0x53e962){return new BPromise(function(_0x1c9460,_0x111697){return client['request'](_0x5493ae,_0x53e962)[_0xd9ff('0x6')](function(_0x2982c3){logger[_0xd9ff('0x7')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x53e962,_0x2982c3);if(_0x2982c3[_0xd9ff('0xa')]){logger[_0xd9ff('0xa')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x2982c3['error']['message'],_0x53e962);return _0x111697(_0x2982c3['error']['message']);}else{return _0x1c9460(_0x2982c3[_0xd9ff('0xb')]);}})[_0xd9ff('0xc')](function(_0x193537){logger[_0xd9ff('0xa')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x193537,_0x53e962);return _0x111697(_0x193537);});});};module[_0xd9ff('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 8998992..36eef47 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 _0xae7f=['util','lodash','moment','string','isNil','voiceQueue','uniqueid','name','phone','Contact','firstName','lastName','number','queue','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports'];(function(_0x44af93,_0x45fa15){var _0x22eef3=function(_0x53dc6f){while(--_0x53dc6f){_0x44af93['push'](_0x44af93['shift']());}};_0x22eef3(++_0x45fa15);}(_0xae7f,0xe1));var _0xfae7=function(_0x4aa2e4,_0x586ab4){_0x4aa2e4=_0x4aa2e4-0x0;var _0x1a07fd=_0xae7f[_0x4aa2e4];return _0x1a07fd;};'use strict';var util=require(_0xfae7('0x0'));var _=require(_0xfae7('0x1'));var moment=require(_0xfae7('0x2'));function checkNameSurname(_0x45a4a5,_0x3db9ab,_0x2847f6){var _0x45f6de='';if(!_['isNil'](_0x3db9ab)&&_0xfae7('0x3')===typeof _0x3db9ab){_0x45f6de+=_0x3db9ab;}if(!_[_0xfae7('0x4')](_0x2847f6)&&_0xfae7('0x3')===typeof _0x2847f6){_0x45f6de+='\x20'+_0x2847f6;}if(_0x45f6de!==''){return _0x45f6de;}return _0x45a4a5;}function Action(_0x45f3d3,_0x167b37,_0x504b38){this[_0xfae7('0x5')]=_0x45f3d3;this[_0xfae7('0x6')]=_0x504b38||undefined;this[_0xfae7('0x7')]=checkNameSurname(_0x167b37['Contact'][_0xfae7('0x8')],_0x167b37[_0xfae7('0x9')][_0xfae7('0xa')],_0x167b37[_0xfae7('0x9')][_0xfae7('0xb')]);this[_0xfae7('0xc')]=_0x167b37[_0xfae7('0x8')];this[_0xfae7('0xd')]=_0x45f3d3[_0xfae7('0x7')];this[_0xfae7('0xe')]=_0x167b37['active']||![];this['type']=_0x45f3d3['type'];this[_0xfae7('0xf')]=_0x45f3d3[_0xfae7('0xf')]||0x3;this['scheduledat']=_0x167b37[_0xfae7('0x10')];this[_0xfae7('0x11')]=_0x167b37[_0xfae7('0x11')];this['countcongestionretry']=_0x167b37[_0xfae7('0x12')];this[_0xfae7('0x13')]=_0x167b37[_0xfae7('0x13')];this['countnosuchnumberretry']=_0x167b37[_0xfae7('0x14')];this[_0xfae7('0x15')]=_0x167b37[_0xfae7('0x15')];this[_0xfae7('0x16')]=_0x167b37['countabandonedretry'];this[_0xfae7('0x17')]=_0x167b37[_0xfae7('0x17')];this[_0xfae7('0x18')]=_0x167b37[_0xfae7('0x18')];this[_0xfae7('0x19')]=_0x167b37[_0xfae7('0x19')];this[_0xfae7('0x1a')]=_0x167b37[_0xfae7('0x1a')];this[_0xfae7('0x1b')]=_0x167b37[_0xfae7('0x1b')];this['VoiceQueueId']=_0x167b37[_0xfae7('0x1c')];this[_0xfae7('0x1d')]=_0x167b37['CampaignId'];this['idHopper']=_0x167b37['id'];this['ContactFirstName']=_0x167b37[_0xfae7('0x9')][_0xfae7('0xa')]||'';this[_0xfae7('0x1e')]=moment()[_0xfae7('0x1f')](_0xfae7('0x20'));this[_0xfae7('0x21')]=_0x167b37[_0xfae7('0x21')];this[_0xfae7('0x22')]=_0x167b37[_0xfae7('0x22')];this['callbackat']=_0x167b37['callbackat'];this[_0xfae7('0x23')]=_0x167b37['recallme'];this[_0xfae7('0x24')]='';this[_0xfae7('0x25')]='';}Action[_0xfae7('0x26')][_0xfae7('0x27')]=function(){return util[_0xfae7('0x1f')](_0xfae7('0x28'),this[_0xfae7('0x7')],this['voiceQueue'][_0xfae7('0x29')]>0x0?this[_0xfae7('0xc')][_0xfae7('0x2a')](this[_0xfae7('0x5')][_0xfae7('0x29')]):this[_0xfae7('0xc')]);};Action[_0xfae7('0x26')][_0xfae7('0x2b')]=function(){return this['queue'];};module[_0xfae7('0x2c')]=Action; \ No newline at end of file +var _0x6df4=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','dialCutDigit','number','getQueue','exports','util','lodash','moment','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x36f6fb,_0x249aa3){var _0x39c006=function(_0x2ba353){while(--_0x2ba353){_0x36f6fb['push'](_0x36f6fb['shift']());}};_0x39c006(++_0x249aa3);}(_0x6df4,0x128));var _0x46df=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0x6df4[_0x207811];return _0x170d56;};'use strict';var util=require(_0x46df('0x0'));var _=require(_0x46df('0x1'));var moment=require(_0x46df('0x2'));function checkNameSurname(_0x554a97,_0x468454,_0x5cc8cd){var _0x4b6040='';if(!_['isNil'](_0x468454)&&_0x46df('0x3')===typeof _0x468454){_0x4b6040+=_0x468454;}if(!_['isNil'](_0x5cc8cd)&&_0x46df('0x3')===typeof _0x5cc8cd){_0x4b6040+='\x20'+_0x5cc8cd;}if(_0x4b6040!==''){return _0x4b6040;}return _0x554a97;}function Action(_0x195ce4,_0x1568d3,_0x3abeca){this[_0x46df('0x4')]=_0x195ce4;this[_0x46df('0x5')]=_0x3abeca||undefined;this[_0x46df('0x6')]=checkNameSurname(_0x1568d3[_0x46df('0x7')][_0x46df('0x8')],_0x1568d3[_0x46df('0x7')][_0x46df('0x9')],_0x1568d3[_0x46df('0x7')][_0x46df('0xa')]);this['number']=_0x1568d3[_0x46df('0x8')];this[_0x46df('0xb')]=_0x195ce4[_0x46df('0x6')];this[_0x46df('0xc')]=_0x1568d3[_0x46df('0xc')]||![];this[_0x46df('0xd')]=_0x195ce4['type'];this[_0x46df('0xe')]=_0x195ce4[_0x46df('0xe')]||0x3;this['scheduledat']=_0x1568d3[_0x46df('0xf')];this[_0x46df('0x10')]=_0x1568d3['countbusyretry'];this[_0x46df('0x11')]=_0x1568d3[_0x46df('0x11')];this[_0x46df('0x12')]=_0x1568d3[_0x46df('0x12')];this['countnosuchnumberretry']=_0x1568d3[_0x46df('0x13')];this[_0x46df('0x14')]=_0x1568d3[_0x46df('0x14')];this[_0x46df('0x15')]=_0x1568d3['countabandonedretry'];this[_0x46df('0x16')]=_0x1568d3[_0x46df('0x16')];this['countagentrejectretry']=_0x1568d3[_0x46df('0x17')];this[_0x46df('0x18')]=_0x1568d3[_0x46df('0x18')];this[_0x46df('0x19')]=_0x1568d3[_0x46df('0x19')];this[_0x46df('0x1a')]=_0x1568d3[_0x46df('0x1a')];this[_0x46df('0x1b')]=_0x1568d3[_0x46df('0x1b')];this[_0x46df('0x1c')]=_0x1568d3[_0x46df('0x1c')];this[_0x46df('0x1d')]=_0x1568d3['id'];this[_0x46df('0x1e')]=_0x1568d3[_0x46df('0x7')][_0x46df('0x9')]||'';this[_0x46df('0x1f')]=moment()[_0x46df('0x20')](_0x46df('0x21'));this[_0x46df('0x22')]=_0x1568d3[_0x46df('0x22')];this[_0x46df('0x23')]=_0x1568d3['callbackuniqueid'];this[_0x46df('0x24')]=_0x1568d3['callbackat'];this[_0x46df('0x25')]=_0x1568d3['recallme'];this[_0x46df('0x26')]='';this[_0x46df('0x27')]='';}Action[_0x46df('0x28')]['getCaller']=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x46df('0x6')],this[_0x46df('0x4')][_0x46df('0x29')]>0x0?this[_0x46df('0x2a')]['substring'](this[_0x46df('0x4')][_0x46df('0x29')]):this[_0x46df('0x2a')]);};Action[_0x46df('0x28')][_0x46df('0x2b')]=function(){return this[_0x46df('0xb')];};module[_0x46df('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 6f612e6..dc2c6b6 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 _0xad81=['holdtime','talktime','queue','membername','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','state','statedesc','Answer','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime'];(function(_0x1da826,_0x4ad86d){var _0x266202=function(_0x577cf1){while(--_0x577cf1){_0x1da826['push'](_0x1da826['shift']());}};_0x266202(++_0x4ad86d);}(_0xad81,0x168));var _0x1ad8=function(_0x12a137,_0x321f09){_0x12a137=_0x12a137-0x0;var _0x5a3c07=_0xad81[_0x12a137];return _0x5a3c07;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x1ad8('0x0'));function getSeconds(_0x86f98e,_0x2cc8d2){var _0x180d49=moment(_0x86f98e)[_0x1ad8('0x1')](0x0);var _0x494874=moment(_0x2cc8d2)[_0x1ad8('0x1')](0x0);return _0x180d49[_0x1ad8('0x2')](_0x494874,'seconds');}function AgentComplete(_0x3250f1,_0x2e0f1f){this[_0x1ad8('0x3')]=0x4;this[_0x1ad8('0x4')]=_0x1ad8('0x5');this[_0x1ad8('0x6')]=_0x3250f1[_0x1ad8('0x6')];this[_0x1ad8('0x7')]=_0x3250f1['type'];this['campaigntype']=_0x3250f1[_0x1ad8('0x7')]===_0x1ad8('0x8')?'queue':_0x3250f1[_0x1ad8('0x7')];this[_0x1ad8('0x9')]=_0x3250f1[_0x1ad8('0x9')];this[_0x1ad8('0xa')]=_0x3250f1[_0x1ad8('0xa')];this[_0x1ad8('0xb')]=_0x3250f1['countnoanswerretry'];this[_0x1ad8('0xc')]=_0x3250f1[_0x1ad8('0x9')]+_0x3250f1[_0x1ad8('0xa')]+_0x3250f1['countnoanswerretry']+_0x3250f1['countnosuchnumberretry']+_0x3250f1[_0x1ad8('0xd')]+_0x3250f1[_0x1ad8('0xe')]+_0x3250f1['countmachineretry']+_0x3250f1['countagentrejectretry'];this['countnosuchnumberretry']=_0x3250f1['countnosuchnumberretry'];this[_0x1ad8('0xd')]=_0x3250f1[_0x1ad8('0xd')];this[_0x1ad8('0xe')]=_0x3250f1[_0x1ad8('0xe')];this[_0x1ad8('0xf')]=_0x3250f1[_0x1ad8('0xf')];this[_0x1ad8('0x10')]=_0x3250f1['countagentrejectretry'];this['uniqueid']=_0x2e0f1f['uniqueid'];this[_0x1ad8('0x11')]=_0x3250f1['name'];this[_0x1ad8('0x12')]=_0x3250f1[_0x1ad8('0x13')];this[_0x1ad8('0x14')]=_0x3250f1[_0x1ad8('0x14')];this[_0x1ad8('0x15')]=_0x3250f1['responsetime'];this[_0x1ad8('0x16')]=_0x3250f1[_0x1ad8('0x16')];this[_0x1ad8('0x17')]=moment()[_0x1ad8('0x18')](_0x1ad8('0x19'));this[_0x1ad8('0x1a')]=getSeconds(_0x3250f1['responsetime'],_0x3250f1[_0x1ad8('0x14')]);this[_0x1ad8('0x1b')]=getSeconds(_0x3250f1['answertime'],_0x3250f1[_0x1ad8('0x15')]);this[_0x1ad8('0x1c')]=getSeconds(this[_0x1ad8('0x17')],_0x3250f1[_0x1ad8('0x16')]);this[_0x1ad8('0x1d')]=_0x2e0f1f['queue'];this['membername']=_0x2e0f1f[_0x1ad8('0x1e')];this['reason']=_0x2e0f1f['reason'];this[_0x1ad8('0x1f')]=_0x3250f1[_0x1ad8('0x1f')];this[_0x1ad8('0x20')]=_0x3250f1[_0x1ad8('0x20')];this[_0x1ad8('0x21')]=_0x3250f1[_0x1ad8('0x21')];this[_0x1ad8('0x22')]=_0x3250f1[_0x1ad8('0x22')];this[_0x1ad8('0x23')]=_0x3250f1[_0x1ad8('0x23')];this[_0x1ad8('0x24')]=_0x3250f1[_0x1ad8('0x24')];this[_0x1ad8('0x25')]=_0x3250f1[_0x1ad8('0x25')];this[_0x1ad8('0x26')]=_0x3250f1['VoiceQueueId'];this[_0x1ad8('0x27')]=_0x3250f1['CampaignId'];this[_0x1ad8('0x28')]=_0x3250f1['originatecalleridnum']||'';this['originatecalleridname']=_0x3250f1[_0x1ad8('0x29')]||'';}module[_0x1ad8('0x2a')]=AgentComplete; \ No newline at end of file +var _0x9ca5=['recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','campaigntype','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','answertime','ringtime','responsetime','holdtime','membername','reason','callback','callbackuniqueid','callbackat'];(function(_0x267c36,_0x51c1fa){var _0x533770=function(_0xcff0f3){while(--_0xcff0f3){_0x267c36['push'](_0x267c36['shift']());}};_0x533770(++_0x51c1fa);}(_0x9ca5,0x1ec));var _0x59ca=function(_0x33554b,_0x48162b){_0x33554b=_0x33554b-0x0;var _0x256954=_0x9ca5[_0x33554b];return _0x256954;};'use strict';var util=require(_0x59ca('0x0'));var _=require(_0x59ca('0x1'));var moment=require(_0x59ca('0x2'));function getSeconds(_0x4f60f6,_0x446aa4){var _0x3dfca0=moment(_0x4f60f6)[_0x59ca('0x3')](0x0);var _0x4f7d51=moment(_0x446aa4)['milliseconds'](0x0);return _0x3dfca0[_0x59ca('0x4')](_0x4f7d51,_0x59ca('0x5'));}function AgentComplete(_0x19e30d,_0x543e83){this[_0x59ca('0x6')]=0x4;this[_0x59ca('0x7')]='Answer';this[_0x59ca('0x8')]=_0x19e30d[_0x59ca('0x8')];this['type']=_0x19e30d[_0x59ca('0x9')];this[_0x59ca('0xa')]=_0x19e30d[_0x59ca('0x9')]==='outbound'?_0x59ca('0xb'):_0x19e30d[_0x59ca('0x9')];this['countbusyretry']=_0x19e30d['countbusyretry'];this['countcongestionretry']=_0x19e30d[_0x59ca('0xc')];this[_0x59ca('0xd')]=_0x19e30d[_0x59ca('0xd')];this[_0x59ca('0xe')]=_0x19e30d[_0x59ca('0xf')]+_0x19e30d[_0x59ca('0xc')]+_0x19e30d['countnoanswerretry']+_0x19e30d[_0x59ca('0x10')]+_0x19e30d[_0x59ca('0x11')]+_0x19e30d['countabandonedretry']+_0x19e30d['countmachineretry']+_0x19e30d[_0x59ca('0x12')];this[_0x59ca('0x10')]=_0x19e30d[_0x59ca('0x10')];this['countdropretry']=_0x19e30d[_0x59ca('0x11')];this[_0x59ca('0x13')]=_0x19e30d['countabandonedretry'];this[_0x59ca('0x14')]=_0x19e30d[_0x59ca('0x14')];this[_0x59ca('0x12')]=_0x19e30d[_0x59ca('0x12')];this[_0x59ca('0x15')]=_0x543e83[_0x59ca('0x15')];this[_0x59ca('0x16')]=_0x19e30d[_0x59ca('0x17')];this[_0x59ca('0x18')]=_0x19e30d[_0x59ca('0x19')];this[_0x59ca('0x1a')]=_0x19e30d[_0x59ca('0x1a')];this['responsetime']=_0x19e30d['responsetime'];this['answertime']=_0x19e30d[_0x59ca('0x1b')];this['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x59ca('0x1c')]=getSeconds(_0x19e30d[_0x59ca('0x1d')],_0x19e30d[_0x59ca('0x1a')]);this[_0x59ca('0x1e')]=getSeconds(_0x19e30d[_0x59ca('0x1b')],_0x19e30d[_0x59ca('0x1d')]);this['talktime']=getSeconds(this['endtime'],_0x19e30d[_0x59ca('0x1b')]);this[_0x59ca('0xb')]=_0x543e83[_0x59ca('0xb')];this[_0x59ca('0x1f')]=_0x543e83[_0x59ca('0x1f')];this[_0x59ca('0x20')]=_0x543e83[_0x59ca('0x20')];this['callback']=_0x19e30d[_0x59ca('0x21')];this[_0x59ca('0x22')]=_0x19e30d[_0x59ca('0x22')];this[_0x59ca('0x23')]=_0x19e30d[_0x59ca('0x23')];this[_0x59ca('0x24')]=_0x19e30d[_0x59ca('0x24')];this[_0x59ca('0x25')]=_0x19e30d[_0x59ca('0x25')];this['ListId']=_0x19e30d['ListId'];this[_0x59ca('0x26')]=_0x19e30d['UserId'];this[_0x59ca('0x27')]=_0x19e30d[_0x59ca('0x27')];this[_0x59ca('0x28')]=_0x19e30d['CampaignId'];this['originatecalleridnum']=_0x19e30d[_0x59ca('0x29')]||'';this[_0x59ca('0x2a')]=_0x19e30d['originatecalleridname']||'';}module[_0x59ca('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 4bfa92e..885d39e 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 _0xd6d6=['util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports'];(function(_0x555ebb,_0x4b1b68){var _0x3c0a4a=function(_0x312e2f){while(--_0x312e2f){_0x555ebb['push'](_0x555ebb['shift']());}};_0x3c0a4a(++_0x4b1b68);}(_0xd6d6,0xbe));var _0x6d6d=function(_0xead06d,_0x286d5c){_0xead06d=_0xead06d-0x0;var _0xcdae3b=_0xd6d6[_0xead06d];return _0xcdae3b;};'use strict';var util=require(_0x6d6d('0x0'));var _=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));function getSeconds(_0x33226e,_0x536523){var _0x2e1aed=moment(_0x33226e)[_0x6d6d('0x3')](0x0);var _0x1b8610=moment(_0x536523)[_0x6d6d('0x3')](0x0);return _0x2e1aed[_0x6d6d('0x4')](_0x1b8610,_0x6d6d('0x5'));}function Final(_0x35a813){this['uniqueid']=_0x35a813[_0x6d6d('0x6')];this[_0x6d6d('0x7')]=_0x35a813[_0x6d6d('0x7')];this[_0x6d6d('0x8')]=_0x35a813[_0x6d6d('0x8')];this[_0x6d6d('0x9')]=_0x35a813[_0x6d6d('0x8')]==='outbound'?'queue':_0x35a813[_0x6d6d('0x8')];this[_0x6d6d('0xa')]=_0x35a813[_0x6d6d('0xa')];this[_0x6d6d('0xb')]=_0x35a813[_0x6d6d('0xb')];this['countnoanswerretry']=_0x35a813[_0x6d6d('0xc')];this[_0x6d6d('0xd')]=_0x35a813['countbusyretry']+_0x35a813['countcongestionretry']+_0x35a813[_0x6d6d('0xc')]+_0x35a813[_0x6d6d('0xe')]+_0x35a813[_0x6d6d('0xf')]+_0x35a813[_0x6d6d('0x10')]+_0x35a813[_0x6d6d('0x11')]+_0x35a813[_0x6d6d('0x12')];this[_0x6d6d('0xe')]=_0x35a813[_0x6d6d('0xe')];this['countdropretry']=_0x35a813[_0x6d6d('0xf')];this[_0x6d6d('0x10')]=_0x35a813[_0x6d6d('0x10')];this[_0x6d6d('0x11')]=_0x35a813[_0x6d6d('0x11')];this['countagentrejectretry']=_0x35a813[_0x6d6d('0x12')];this['queue']=_0x35a813[_0x6d6d('0x13')];this[_0x6d6d('0x14')]=_0x35a813[_0x6d6d('0x14')];this['calleridnum']=_0x35a813['calleridnum'];this[_0x6d6d('0x15')]=_0x35a813[_0x6d6d('0x15')];this[_0x6d6d('0x16')]=_0x35a813[_0x6d6d('0x16')];this['endtime']=_0x35a813['responsetime'];this[_0x6d6d('0x17')]=_0x35a813['ringtime']||0x0;this[_0x6d6d('0x18')]=_0x35a813[_0x6d6d('0x18')]||0x0;this[_0x6d6d('0x19')]=_0x35a813[_0x6d6d('0x19')]||0x0;this[_0x6d6d('0x1a')]=_0x35a813[_0x6d6d('0x1a')];this[_0x6d6d('0x1b')]=_0x35a813[_0x6d6d('0x1b')];this[_0x6d6d('0x1c')]=_0x35a813[_0x6d6d('0x1c')];this[_0x6d6d('0x1d')]=_0x35a813[_0x6d6d('0x1d')];this[_0x6d6d('0x1e')]=_0x35a813[_0x6d6d('0x1e')];this[_0x6d6d('0x1f')]=_0x35a813[_0x6d6d('0x1f')];this[_0x6d6d('0x20')]=_0x35a813['UserId'];this[_0x6d6d('0x21')]=_0x35a813[_0x6d6d('0x21')];this[_0x6d6d('0x22')]=_0x35a813[_0x6d6d('0x22')];this[_0x6d6d('0x23')]=_0x35a813[_0x6d6d('0x23')]||'';this['originatecalleridname']=_0x35a813[_0x6d6d('0x24')]||'';}module[_0x6d6d('0x25')]=Final; \ No newline at end of file +var _0xcb66=['scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds'];(function(_0x1db84c,_0x34be42){var _0x590bd9=function(_0x3a5a8d){while(--_0x3a5a8d){_0x1db84c['push'](_0x1db84c['shift']());}};_0x590bd9(++_0x34be42);}(_0xcb66,0x19f));var _0x6cb6=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0xcb66[_0x2e04ef];return _0x5722b0;};'use strict';var util=require('util');var _=require(_0x6cb6('0x0'));var moment=require(_0x6cb6('0x1'));function getSeconds(_0x1066ea,_0x3f607b){var _0x205243=moment(_0x1066ea)['milliseconds'](0x0);var _0xe996ed=moment(_0x3f607b)[_0x6cb6('0x2')](0x0);return _0x205243[_0x6cb6('0x3')](_0xe996ed,_0x6cb6('0x4'));}function Final(_0x16bb9d){this['uniqueid']=_0x16bb9d['uniqueid'];this[_0x6cb6('0x5')]=_0x16bb9d[_0x6cb6('0x5')];this[_0x6cb6('0x6')]=_0x16bb9d[_0x6cb6('0x6')];this[_0x6cb6('0x7')]=_0x16bb9d[_0x6cb6('0x6')]===_0x6cb6('0x8')?_0x6cb6('0x9'):_0x16bb9d[_0x6cb6('0x6')];this[_0x6cb6('0xa')]=_0x16bb9d[_0x6cb6('0xa')];this[_0x6cb6('0xb')]=_0x16bb9d[_0x6cb6('0xb')];this['countnoanswerretry']=_0x16bb9d['countnoanswerretry'];this['countglobal']=_0x16bb9d['countbusyretry']+_0x16bb9d[_0x6cb6('0xb')]+_0x16bb9d[_0x6cb6('0xc')]+_0x16bb9d[_0x6cb6('0xd')]+_0x16bb9d[_0x6cb6('0xe')]+_0x16bb9d['countabandonedretry']+_0x16bb9d[_0x6cb6('0xf')]+_0x16bb9d[_0x6cb6('0x10')];this['countnosuchnumberretry']=_0x16bb9d[_0x6cb6('0xd')];this[_0x6cb6('0xe')]=_0x16bb9d['countdropretry'];this[_0x6cb6('0x11')]=_0x16bb9d[_0x6cb6('0x11')];this['countmachineretry']=_0x16bb9d['countmachineretry'];this['countagentrejectretry']=_0x16bb9d['countagentrejectretry'];this[_0x6cb6('0x9')]=_0x16bb9d[_0x6cb6('0x9')];this[_0x6cb6('0x12')]=_0x16bb9d[_0x6cb6('0x12')];this[_0x6cb6('0x13')]=_0x16bb9d[_0x6cb6('0x13')];this['starttime']=_0x16bb9d[_0x6cb6('0x14')];this[_0x6cb6('0x15')]=_0x16bb9d['responsetime'];this['endtime']=_0x16bb9d['responsetime'];this['ringtime']=_0x16bb9d['ringtime']||0x0;this['holdtime']=_0x16bb9d[_0x6cb6('0x16')]||0x0;this[_0x6cb6('0x17')]=_0x16bb9d[_0x6cb6('0x17')]||0x0;this[_0x6cb6('0x18')]=_0x16bb9d[_0x6cb6('0x18')];this['callbackuniqueid']=_0x16bb9d['callbackuniqueid'];this[_0x6cb6('0x19')]=_0x16bb9d[_0x6cb6('0x19')];this[_0x6cb6('0x1a')]=_0x16bb9d[_0x6cb6('0x1a')];this['ContactId']=_0x16bb9d[_0x6cb6('0x1b')];this[_0x6cb6('0x1c')]=_0x16bb9d['ListId'];this['UserId']=_0x16bb9d[_0x6cb6('0x1d')];this['VoiceQueueId']=_0x16bb9d[_0x6cb6('0x1e')];this[_0x6cb6('0x1f')]=_0x16bb9d[_0x6cb6('0x1f')];this[_0x6cb6('0x20')]=_0x16bb9d[_0x6cb6('0x20')]||'';this[_0x6cb6('0x21')]=_0x16bb9d[_0x6cb6('0x21')]||'';}module[_0x6cb6('0x22')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index e7a8f09..dd22821 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 _0x0d22=['CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countmachineretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','calleridname','name','calleridnum','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','holdtime','talktime','endtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','recallme','ContactId','ListId','UserId'];(function(_0x1a0c59,_0x3b4dcc){var _0xed67c9=function(_0x247698){while(--_0x247698){_0x1a0c59['push'](_0x1a0c59['shift']());}};_0xed67c9(++_0x3b4dcc);}(_0x0d22,0x8c));var _0x20d2=function(_0x13f980,_0x1e1c56){_0x13f980=_0x13f980-0x0;var _0x27153c=_0x0d22[_0x13f980];return _0x27153c;};'use strict';var util=require(_0x20d2('0x0'));var _=require(_0x20d2('0x1'));var moment=require(_0x20d2('0x2'));function getSeconds(_0x1e24c7,_0x266326){var _0x2fea87=moment(_0x1e24c7)[_0x20d2('0x3')](0x0);var _0x1463d9=moment(_0x266326)[_0x20d2('0x3')](0x0);return _0x2fea87[_0x20d2('0x4')](_0x1463d9,_0x20d2('0x5'));}function Hangup(_0x3f5d16,_0x5a6530){this[_0x20d2('0x6')]=0x4;this[_0x20d2('0x7')]=_0x20d2('0x8');this[_0x20d2('0x9')]=_0x3f5d16['scheduledat'];this['type']=_0x3f5d16[_0x20d2('0xa')];this[_0x20d2('0xb')]=_0x3f5d16[_0x20d2('0xa')]===_0x20d2('0xc')?_0x20d2('0xd'):_0x3f5d16[_0x20d2('0xa')];this['countbusyretry']=_0x3f5d16[_0x20d2('0xe')];this[_0x20d2('0xf')]=_0x3f5d16[_0x20d2('0xf')];this[_0x20d2('0x10')]=_0x3f5d16[_0x20d2('0x10')];this[_0x20d2('0x11')]=_0x3f5d16[_0x20d2('0xe')]+_0x3f5d16[_0x20d2('0xf')]+_0x3f5d16[_0x20d2('0x10')]+_0x3f5d16['countnosuchnumberretry']+_0x3f5d16['countdropretry']+_0x3f5d16['countabandonedretry']+_0x3f5d16[_0x20d2('0x12')]+_0x3f5d16['countagentrejectretry'];this[_0x20d2('0x13')]=_0x3f5d16['countnosuchnumberretry'];this[_0x20d2('0x14')]=_0x3f5d16[_0x20d2('0x14')];this[_0x20d2('0x15')]=_0x3f5d16[_0x20d2('0x15')];this[_0x20d2('0x12')]=_0x3f5d16[_0x20d2('0x12')];this[_0x20d2('0x16')]=_0x3f5d16[_0x20d2('0x16')];this['uniqueid']=_0x5a6530['uniqueid'];this[_0x20d2('0x17')]=_0x3f5d16[_0x20d2('0x18')];this[_0x20d2('0x19')]=_0x3f5d16['number'];this['starttime']=_0x3f5d16['starttime'];this[_0x20d2('0x1a')]=_0x3f5d16['responsetime'];this['endtime']=moment()[_0x20d2('0x1b')](_0x20d2('0x1c'));this[_0x20d2('0x1d')]=getSeconds(_0x3f5d16['responsetime'],_0x3f5d16[_0x20d2('0x1e')]);this[_0x20d2('0x1f')]=0x0;this[_0x20d2('0x20')]=getSeconds(this[_0x20d2('0x21')],_0x3f5d16[_0x20d2('0x1a')]);this[_0x20d2('0xd')]=_0x3f5d16[_0x20d2('0xd')];this[_0x20d2('0x22')]=_0x20d2('0x23');this[_0x20d2('0x24')]=_0x5a6530[_0x20d2('0x25')];this[_0x20d2('0x26')]=_0x3f5d16[_0x20d2('0x26')];this[_0x20d2('0x27')]=_0x3f5d16[_0x20d2('0x27')];this['callbackat']=_0x3f5d16['callbackat'];this[_0x20d2('0x28')]=_0x3f5d16[_0x20d2('0x28')];this[_0x20d2('0x29')]=_0x3f5d16[_0x20d2('0x29')];this[_0x20d2('0x2a')]=_0x3f5d16[_0x20d2('0x2a')];this[_0x20d2('0x2b')]=_0x3f5d16[_0x20d2('0x2b')];this['VoiceQueueId']=_0x3f5d16['VoiceQueueId'];this[_0x20d2('0x2c')]=_0x3f5d16['CampaignId'];}module[_0x20d2('0x2d')]=Hangup; \ No newline at end of file +var _0xc387=['type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','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','lodash','moment','milliseconds','state','Answer','scheduledat','campaigntype'];(function(_0x230cd9,_0x52918b){var _0x3d9e08=function(_0x3fb6ce){while(--_0x3fb6ce){_0x230cd9['push'](_0x230cd9['shift']());}};_0x3d9e08(++_0x52918b);}(_0xc387,0x12d));var _0x7c38=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc387[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x7c38('0x0'));var moment=require(_0x7c38('0x1'));function getSeconds(_0x25cf8a,_0x4f0769){var _0x5138f0=moment(_0x25cf8a)['milliseconds'](0x0);var _0x45b2bb=moment(_0x4f0769)[_0x7c38('0x2')](0x0);return _0x5138f0['diff'](_0x45b2bb,'seconds');}function Hangup(_0x4b5b7c,_0x38ce32){this[_0x7c38('0x3')]=0x4;this['statedesc']=_0x7c38('0x4');this['scheduledat']=_0x4b5b7c[_0x7c38('0x5')];this['type']=_0x4b5b7c['type'];this[_0x7c38('0x6')]=_0x4b5b7c[_0x7c38('0x7')]==='outbound'?_0x7c38('0x8'):_0x4b5b7c[_0x7c38('0x7')];this['countbusyretry']=_0x4b5b7c[_0x7c38('0x9')];this['countcongestionretry']=_0x4b5b7c[_0x7c38('0xa')];this[_0x7c38('0xb')]=_0x4b5b7c['countnoanswerretry'];this[_0x7c38('0xc')]=_0x4b5b7c[_0x7c38('0x9')]+_0x4b5b7c[_0x7c38('0xa')]+_0x4b5b7c[_0x7c38('0xb')]+_0x4b5b7c['countnosuchnumberretry']+_0x4b5b7c[_0x7c38('0xd')]+_0x4b5b7c[_0x7c38('0xe')]+_0x4b5b7c[_0x7c38('0xf')]+_0x4b5b7c['countagentrejectretry'];this[_0x7c38('0x10')]=_0x4b5b7c[_0x7c38('0x10')];this['countdropretry']=_0x4b5b7c[_0x7c38('0xd')];this['countabandonedretry']=_0x4b5b7c['countabandonedretry'];this[_0x7c38('0xf')]=_0x4b5b7c[_0x7c38('0xf')];this['countagentrejectretry']=_0x4b5b7c[_0x7c38('0x11')];this[_0x7c38('0x12')]=_0x38ce32[_0x7c38('0x12')];this[_0x7c38('0x13')]=_0x4b5b7c[_0x7c38('0x14')];this[_0x7c38('0x15')]=_0x4b5b7c[_0x7c38('0x16')];this[_0x7c38('0x17')]=_0x4b5b7c[_0x7c38('0x17')];this[_0x7c38('0x18')]=_0x4b5b7c['responsetime'];this[_0x7c38('0x19')]=moment()[_0x7c38('0x1a')](_0x7c38('0x1b'));this[_0x7c38('0x1c')]=getSeconds(_0x4b5b7c[_0x7c38('0x18')],_0x4b5b7c['starttime']);this[_0x7c38('0x1d')]=0x0;this[_0x7c38('0x1e')]=getSeconds(this['endtime'],_0x4b5b7c['responsetime']);this[_0x7c38('0x8')]=_0x4b5b7c[_0x7c38('0x8')];this[_0x7c38('0x1f')]=_0x7c38('0x20');this[_0x7c38('0x21')]=_0x38ce32[_0x7c38('0x22')];this[_0x7c38('0x23')]=_0x4b5b7c[_0x7c38('0x23')];this['callbackuniqueid']=_0x4b5b7c[_0x7c38('0x24')];this[_0x7c38('0x25')]=_0x4b5b7c[_0x7c38('0x25')];this[_0x7c38('0x26')]=_0x4b5b7c[_0x7c38('0x26')];this[_0x7c38('0x27')]=_0x4b5b7c[_0x7c38('0x27')];this[_0x7c38('0x28')]=_0x4b5b7c[_0x7c38('0x28')];this[_0x7c38('0x29')]=_0x4b5b7c[_0x7c38('0x29')];this[_0x7c38('0x2a')]=_0x4b5b7c[_0x7c38('0x2a')];this[_0x7c38('0x2b')]=_0x4b5b7c[_0x7c38('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 3a82715..a76c68d 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 _0x7583=['queue','calleridname','name','calleridnum','number','starttime','responsetime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry'];(function(_0x34c0be,_0x2d8e36){var _0x6d016f=function(_0x19f51a){while(--_0x19f51a){_0x34c0be['push'](_0x34c0be['shift']());}};_0x6d016f(++_0x2d8e36);}(_0x7583,0x144));var _0x3758=function(_0x2a0ab3,_0xcdddf1){_0x2a0ab3=_0x2a0ab3-0x0;var _0x73f2ad=_0x7583[_0x2a0ab3];return _0x73f2ad;};'use strict';var util=require('util');var _=require(_0x3758('0x0'));var moment=require(_0x3758('0x1'));function getSeconds(_0x15d971,_0x3b9bf5){var _0x29b0fc=moment(_0x15d971)[_0x3758('0x2')](0x0);var _0xc362e6=moment(_0x3b9bf5)[_0x3758('0x2')](0x0);return _0x29b0fc[_0x3758('0x3')](_0xc362e6,_0x3758('0x4'));}function History(_0x5a86bc){this[_0x3758('0x5')]=_0x5a86bc[_0x3758('0x5')];this[_0x3758('0x6')]=_0x5a86bc[_0x3758('0x6')]||undefined;this['type']=_0x5a86bc[_0x3758('0x7')];this[_0x3758('0x8')]=_0x5a86bc['type']==='outbound'?'queue':_0x5a86bc['type'];this[_0x3758('0x9')]=_0x5a86bc[_0x3758('0x9')];this[_0x3758('0xa')]=_0x5a86bc['countcongestionretry'];this[_0x3758('0xb')]=_0x5a86bc[_0x3758('0xb')];this[_0x3758('0xc')]=_0x5a86bc[_0x3758('0x9')]+_0x5a86bc[_0x3758('0xa')]+_0x5a86bc[_0x3758('0xb')]+_0x5a86bc['countnosuchnumberretry']+_0x5a86bc[_0x3758('0xd')]+_0x5a86bc['countabandonedretry']+_0x5a86bc[_0x3758('0xe')]+_0x5a86bc['countagentrejectretry'];this[_0x3758('0xf')]=_0x5a86bc['countnosuchnumberretry'];this['countdropretry']=_0x5a86bc['countdropretry'];this['countabandonedretry']=_0x5a86bc[_0x3758('0x10')];this['countmachineretry']=_0x5a86bc[_0x3758('0xe')];this[_0x3758('0x11')]=_0x5a86bc[_0x3758('0x11')];this['queue']=_0x5a86bc[_0x3758('0x12')];this[_0x3758('0x13')]=_0x5a86bc[_0x3758('0x14')];this[_0x3758('0x15')]=_0x5a86bc[_0x3758('0x16')];this[_0x3758('0x17')]=_0x5a86bc[_0x3758('0x17')];this['responsetime']=_0x5a86bc[_0x3758('0x18')];this['endtime']=_0x5a86bc[_0x3758('0x18')];this['ringtime']=getSeconds(_0x5a86bc[_0x3758('0x18')],_0x5a86bc[_0x3758('0x17')]);this['holdtime']=0x0;this[_0x3758('0x19')]=0x0;this[_0x3758('0x1a')]=_0x5a86bc[_0x3758('0x1a')];this[_0x3758('0x1b')]=_0x5a86bc['callbackuniqueid'];this[_0x3758('0x1c')]=_0x5a86bc[_0x3758('0x1c')];this['recallme']=_0x5a86bc[_0x3758('0x1d')];this[_0x3758('0x1e')]=_0x5a86bc['ContactId'];this[_0x3758('0x1f')]=_0x5a86bc[_0x3758('0x1f')];this[_0x3758('0x20')]=_0x5a86bc[_0x3758('0x20')];this[_0x3758('0x21')]=_0x5a86bc['VoiceQueueId'];this[_0x3758('0x22')]=_0x5a86bc[_0x3758('0x22')];this[_0x3758('0x23')]=_0x5a86bc[_0x3758('0x23')]||'';this[_0x3758('0x24')]=_0x5a86bc[_0x3758('0x24')]||'';}module[_0x3758('0x25')]=History; \ No newline at end of file +var _0xa34e=['originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x48b810,_0x173a5e){var _0x23c17d=function(_0x38531e){while(--_0x38531e){_0x48b810['push'](_0x48b810['shift']());}};_0x23c17d(++_0x173a5e);}(_0xa34e,0xe1));var _0xea34=function(_0x20f96d,_0x23e67f){_0x20f96d=_0x20f96d-0x0;var _0x9a7524=_0xa34e[_0x20f96d];return _0x9a7524;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xea34('0x0'));function getSeconds(_0x532061,_0xc92829){var _0x5d8fff=moment(_0x532061)[_0xea34('0x1')](0x0);var _0x3abb91=moment(_0xc92829)[_0xea34('0x1')](0x0);return _0x5d8fff[_0xea34('0x2')](_0x3abb91,_0xea34('0x3'));}function History(_0x368d7b){this[_0xea34('0x4')]=_0x368d7b['uniqueid'];this['scheduledat']=_0x368d7b[_0xea34('0x5')]||undefined;this[_0xea34('0x6')]=_0x368d7b[_0xea34('0x6')];this['campaigntype']=_0x368d7b[_0xea34('0x6')]==='outbound'?_0xea34('0x7'):_0x368d7b[_0xea34('0x6')];this[_0xea34('0x8')]=_0x368d7b['countbusyretry'];this[_0xea34('0x9')]=_0x368d7b[_0xea34('0x9')];this['countnoanswerretry']=_0x368d7b['countnoanswerretry'];this[_0xea34('0xa')]=_0x368d7b[_0xea34('0x8')]+_0x368d7b[_0xea34('0x9')]+_0x368d7b[_0xea34('0xb')]+_0x368d7b['countnosuchnumberretry']+_0x368d7b[_0xea34('0xc')]+_0x368d7b[_0xea34('0xd')]+_0x368d7b[_0xea34('0xe')]+_0x368d7b[_0xea34('0xf')];this['countnosuchnumberretry']=_0x368d7b['countnosuchnumberretry'];this[_0xea34('0xc')]=_0x368d7b[_0xea34('0xc')];this[_0xea34('0xd')]=_0x368d7b[_0xea34('0xd')];this[_0xea34('0xe')]=_0x368d7b['countmachineretry'];this[_0xea34('0xf')]=_0x368d7b['countagentrejectretry'];this['queue']=_0x368d7b['queue'];this[_0xea34('0x10')]=_0x368d7b['name'];this[_0xea34('0x11')]=_0x368d7b[_0xea34('0x12')];this[_0xea34('0x13')]=_0x368d7b[_0xea34('0x13')];this[_0xea34('0x14')]=_0x368d7b[_0xea34('0x14')];this[_0xea34('0x15')]=_0x368d7b['responsetime'];this[_0xea34('0x16')]=getSeconds(_0x368d7b[_0xea34('0x14')],_0x368d7b[_0xea34('0x13')]);this[_0xea34('0x17')]=0x0;this[_0xea34('0x18')]=0x0;this[_0xea34('0x19')]=_0x368d7b['callback'];this['callbackuniqueid']=_0x368d7b[_0xea34('0x1a')];this[_0xea34('0x1b')]=_0x368d7b[_0xea34('0x1b')];this[_0xea34('0x1c')]=_0x368d7b[_0xea34('0x1c')];this[_0xea34('0x1d')]=_0x368d7b[_0xea34('0x1d')];this[_0xea34('0x1e')]=_0x368d7b['ListId'];this[_0xea34('0x1f')]=_0x368d7b[_0xea34('0x1f')];this['VoiceQueueId']=_0x368d7b[_0xea34('0x20')];this[_0xea34('0x21')]=_0x368d7b[_0xea34('0x21')];this[_0xea34('0x22')]=_0x368d7b[_0xea34('0x22')]||'';this['originatecalleridname']=_0x368d7b[_0xea34('0x23')]||'';}module[_0xea34('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 1225dd8..5e7411b 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 _0x235a=['hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\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','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','IS_DISACTIVED','debug','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','actions','sequence','enqueue','isNil','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','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','saveInDb','pick','ContactId','ListId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','uniqueid','HangupInAMD','membername','AMD','buildObj','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','amd','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','HANGUP','state','[syncHangupInAMDIvr][createHistory]','countdropretry','stateGlobal','reason19\x20machine....','[rescheduleContact][Machine]','ivrAnswerCallsDay','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','[syncHangupIvr]','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','Drop','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','[rescheduleContact][Drop]','calleridnum','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','calleridname','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','isArray','Action','command','iftime\x20%s,%s','indexOf','true','content','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','throttle','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkIsTrunkReachable','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','dialQueueTimeout','NONE','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','updatedAt','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','originatecalleridname','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','OriginateError','[originate][error]','responsetime','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','reason\x205\x20busy','Congestion','congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','erlangCalls','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','started\x20in\x20predictive\x20at','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','getDataPredictive','abandonmentRate','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','RUNNING','emptyContact','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','moment','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','redis','localhost','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummaryComplete'];(function(_0x38c6e1,_0x1b2cf3){var _0x337bbb=function(_0x270f10){while(--_0x270f10){_0x38c6e1['push'](_0x38c6e1['shift']());}};_0x337bbb(++_0x1b2cf3);}(_0x235a,0x1ef));var _0xa235=function(_0x24dff1,_0x3328aa){_0x24dff1=_0x24dff1-0x0;var _0x10809f=_0x235a[_0x24dff1];return _0x10809f;};'use strict';var util=require(_0xa235('0x0'));var _=require(_0xa235('0x1'));var BPromise=require(_0xa235('0x2'));var uuid=require('uuid');var moment=require(_0xa235('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require(_0xa235('0x4'));var ut=require(_0xa235('0x5'));var config=require(_0xa235('0x6'));var logger=require(_0xa235('0x7'))(_0xa235('0x8'));var loggerBooked=require(_0xa235('0x7'))(_0xa235('0x9'));var loggerPredictive=require(_0xa235('0x7'))('predictive');var loggerPredictiveCalls=require(_0xa235('0x7'))(_0xa235('0xa'));var loggerSyncQueueSummary=require(_0xa235('0x7'))(_0xa235('0xb'));var ami=require('../ami');config[_0xa235('0xc')]=_['defaults'](config['redis'],{'host':_0xa235('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa235('0xc')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperAdditionalPhone=require(_0xa235('0xe'));var cmHopperBlack=require(_0xa235('0xf'));var voiceQueueRt=require(_0xa235('0x10'));var RpcSetting=require(_0xa235('0x11'));var Action=require('./action');var History=require('./history');var Final=require('./final');var AgentComplete=require(_0xa235('0x12'));var QueueCallerAbandon=require(_0xa235('0x13'));var Hangup=require(_0xa235('0x14'));var ipAgi=process[_0xa235('0x15')][_0xa235('0x16')]||_0xa235('0x17');var strategy={'rrmemory':_0xa235('0x18'),'roundrobin':_0xa235('0x19')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xa235('0x1a')]['enqueue']=function(_0x352463){this[_0xa235('0x1b')]=this[_0xa235('0x1b')]?this[_0xa235('0x1b')][_0xa235('0x1c')](_0x352463):_0x352463();};function Dialer(_0x2a1496,_0x5c6e95){this['sequence']=new Sequence();this[_0xa235('0x1d')]=_0x5c6e95;this[_0xa235('0x1e')]=_0x2a1496[_0xa235('0x1e')];this['campaigns']=_0x2a1496[_0xa235('0x1f')];this[_0xa235('0x20')]=_0x2a1496[_0xa235('0x20')];this[_0xa235('0x21')]=_0x2a1496[_0xa235('0x21')];this[_0xa235('0x22')]=config[_0xa235('0x22')]||0x2;this['channels']={};this['actions']={};this[_0xa235('0x23')]={};this[_0xa235('0x24')]={};this[_0xa235('0x25')]={};this[_0xa235('0x26')]={};this[_0xa235('0x27')]={};this[_0xa235('0x28')]={};this[_0xa235('0x29')]={};this[_0xa235('0x2a')]={};ami['on'](_0xa235('0x2b'),this[_0xa235('0x2c')][_0xa235('0x2d')](this));ami['on'](_0xa235('0x2e'),this[_0xa235('0x2f')][_0xa235('0x2d')](this));ami['on'](_0xa235('0x30'),this[_0xa235('0x31')][_0xa235('0x2d')](this));ami['on'](_0xa235('0x32'),this[_0xa235('0x33')][_0xa235('0x2d')](this));ami['on'](_0xa235('0x34'),this['syncQueueSummary'][_0xa235('0x2d')](this));ami['on']('custom:queuesummarycomplete',this[_0xa235('0x35')]['bind'](this));ami['on'](_0xa235('0x36'),this[_0xa235('0x37')][_0xa235('0x2d')](this));ami['on'](_0xa235('0x38'),this[_0xa235('0x39')]['bind'](this));ami['on'](_0xa235('0x3a'),this[_0xa235('0x3b')]['bind'](this));ami['on']('queuemember',this['syncQueueMember']['bind'](this));ami['on'](_0xa235('0x3c'),this[_0xa235('0x3d')][_0xa235('0x2d')](this));this[_0xa235('0x3e')]();this[_0xa235('0x3f')]();RpcSetting[_0xa235('0x40')]()[_0xa235('0x41')](function(_0x5955b4){previewRecallmeReminderInterval=_0x5955b4['previewRecallmeReminderInterval'];});}function isNotNull(_0x2832be){return _0x2832be!==null&&!_[_0xa235('0x42')](_0x2832be);}function checkIsLoggedIn(_0x57a2b0,_0x365a76){return function(){if(_0x365a76<=0x0){_0x57a2b0[_0xa235('0x43')]=_0xa235('0x44');throw _0x57a2b0[_0xa235('0x45')]+_0xa235('0x46');}};}function isActive(_0x188d74){return _0x188d74;}function checkIsActive(_0x37d783,_0x193d3a){return function(){if(!isActive(_0x193d3a)){_0x37d783['message']=_0xa235('0x47');throw _0x37d783['name']+_0xa235('0x48');}};}function checkInterval(_0xb8a147){return function(){if(!isNotNull(_0xb8a147[_0xa235('0x49')])){_0xb8a147[_0xa235('0x43')]=_0xa235('0x4a');throw _0xb8a147[_0xa235('0x45')]+_0xa235('0x4b');}if(!isNotNull(_0xb8a147[_0xa235('0x49')][_0xa235('0x4c')])){_0xb8a147[_0xa235('0x43')]=_0xa235('0x4a');throw _0xb8a147[_0xa235('0x45')]+_0xa235('0x4b');}if(!isNotNull(_['isEmpty'](_0xb8a147['Interval']['Intervals']))){_0xb8a147[_0xa235('0x43')]='INTERVAL_IS_NULL';throw _0xb8a147[_0xa235('0x45')]+_0xa235('0x4b');}};}function msgResponse(_0x27ac63,_0x21a835,_0x473af7){return{'action':_0x27ac63,'response':_0x21a835,'message':_0x473af7,'stack':_0x473af7};}function myreject(_0x94471f){return function(_0xb819eb){return _0x94471f(msgResponse('[ifTime][Action]',_0xa235('0x4d'),JSON[_0xa235('0x4e')](_0xb819eb)));};}function getSeconds(_0x594511,_0x380665){var _0x3fa927=moment(_0x594511)[_0xa235('0x4f')](0x0);var _0x1e466b=moment(_0x380665)[_0xa235('0x4f')](0x0);return _0x3fa927[_0xa235('0x50')](_0x1e466b,_0xa235('0x51'));}function emit(_0xddc1cd,_0xf8b898,_0x4d3254){io['to'](_0xddc1cd)[_0xa235('0x52')](_0xf8b898,_0x4d3254);}function emitVoiceQueueSummary(_0x3ab9f2){if(_0x3ab9f2[_0xa235('0x53')]===_0xa235('0x54')){var _0x4322c3={'id':_0x3ab9f2['id'],'name':_0x3ab9f2['name'],'strategy':_0x3ab9f2[_0xa235('0x55')],'answered':_0x3ab9f2[_0xa235('0x56')],'available':_0x3ab9f2[_0xa235('0x57')],'loggedIn':_0x3ab9f2[_0xa235('0x58')],'pTalking':_0x3ab9f2['pTalking'],'sumBillable':_0x3ab9f2[_0xa235('0x59')],'sumDuration':_0x3ab9f2[_0xa235('0x5a')],'sumHoldTime':_0x3ab9f2[_0xa235('0x5b')]||0x0,'talking':_0x3ab9f2[_0xa235('0x5c')],'total':_0x3ab9f2[_0xa235('0x5d')],'type':_0x3ab9f2[_0xa235('0x53')],'unmanaged':_0x3ab9f2[_0xa235('0x5e')],'abandoned':_0x3ab9f2['abandoned'],'waiting':_0x3ab9f2[_0xa235('0x5f')],'loggedInDb':_0x3ab9f2[_0xa235('0x60')],'dialActive':_0x3ab9f2[_0xa235('0x61')],'dialMethod':_0x3ab9f2[_0xa235('0x62')],'dialOriginateCallerIdName':_0x3ab9f2[_0xa235('0x63')],'dialOriginateCallerIdNumber':_0x3ab9f2['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3ab9f2[_0xa235('0x64')],'dialPrefix':_0x3ab9f2[_0xa235('0x65')],'outboundAnswerAgiCallsDay':_0x3ab9f2[_0xa235('0x66')],'outboundAnswerCallsDay':_0x3ab9f2[_0xa235('0x67')],'outboundBlacklistCallsDay':_0x3ab9f2[_0xa235('0x68')],'outboundBusyCallsDay':_0x3ab9f2['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x3ab9f2[_0xa235('0x69')],'outboundDropCallsDayACS':_0x3ab9f2[_0xa235('0x6a')],'outboundDropCallsDayCallersExit':_0x3ab9f2[_0xa235('0x6b')],'outboundDropCallsDayTimeout':_0x3ab9f2[_0xa235('0x6c')],'outboundNoAnswerCallsDay':_0x3ab9f2[_0xa235('0x6d')],'outboundNoSuchCallsDay':_0x3ab9f2[_0xa235('0x6e')],'outboundOriginateFailureCallsDay':_0x3ab9f2[_0xa235('0x6f')],'outboundReCallsDay':_0x3ab9f2[_0xa235('0x70')],'outboundRejectCallsDay':_0x3ab9f2['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x3ab9f2[_0xa235('0x71')],'predictiveIntervalAnsweredCalls':_0x3ab9f2[_0xa235('0x72')],'predictiveIntervalAvgHoldtime':_0x3ab9f2[_0xa235('0x73')],'predictiveIntervalAvgTalktime':_0x3ab9f2[_0xa235('0x74')],'predictiveIntervalDroppedCallsCallersExit':_0x3ab9f2[_0xa235('0x75')],'predictiveIntervalDroppedCallsTimeout':_0x3ab9f2[_0xa235('0x76')],'predictiveIntervalErlangCalls':_0x3ab9f2[_0xa235('0x77')],'predictiveIntervalErlangCallsDroppedCalls':_0x3ab9f2[_0xa235('0x78')],'predictiveIntervalHitRate':_0x3ab9f2[_0xa235('0x79')],'predictiveIntervalMultiplicativeFactor':_0x3ab9f2['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x3ab9f2[_0xa235('0x7a')],'predictiveIntervalAvailable':_0x3ab9f2[_0xa235('0x7b')],'predictiveIntervalTotalCalls':_0x3ab9f2[_0xa235('0x7c')],'message':_0x3ab9f2[_0xa235('0x43')],'originated':_0x3ab9f2[_0xa235('0x7d')],'erlangCalls':_0x3ab9f2['erlangCalls'],'erlangCallToSecond':_0x3ab9f2[_0xa235('0x7e')],'erlangAbandonmentRate':_0x3ab9f2[_0xa235('0x7f')],'erlangBusyFactor':_0x3ab9f2['erlangBusyFactor'],'startPredictive':_0x3ab9f2[_0xa235('0x26')],'startProgressive':_0x3ab9f2[_0xa235('0x27')]};if(_0x3ab9f2[_0xa235('0x80')]){_0x4322c3[_0xa235('0x80')]={'id':_0x3ab9f2['Trunk']['id'],'name':_0x3ab9f2[_0xa235('0x80')]['name'],'active':_0x3ab9f2[_0xa235('0x80')][_0xa235('0x81')],'callerid':_0x3ab9f2['Trunk'][_0xa235('0x82')]};}if(_0x3ab9f2[_0xa235('0x49')]){_0x4322c3[_0xa235('0x49')]={'id':_0x3ab9f2[_0xa235('0x49')]['id'],'name':_0x3ab9f2[_0xa235('0x49')][_0xa235('0x45')]};}var _0x16105c=md5(JSON[_0xa235('0x4e')](_0x4322c3));if(_0x3ab9f2['md5']!==_0x16105c){_0x3ab9f2['md5']=_0x16105c;emit(util['format'](_0xa235('0x83'),_0x4322c3[_0xa235('0x45')]),_0xa235('0x84'),_0x4322c3);}}}function emitCampaignSummary(_0x3b5255){if(_0x3b5255['type']===_0xa235('0x85')){emit(util['format'](_0xa235('0x86'),_0x3b5255[_0xa235('0x45')]),_0xa235('0x87'),_0x3b5255);}}function checkGetDataPredictive(_0x1c9f2b){if(isNotNull(_0x1c9f2b)&&!_['isEmpty'](_0x1c9f2b)){loggerPredictive[_0xa235('0x88')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0xa235('0x88')](_0xa235('0x89'),_0x1c9f2b['predictiveIntervalTotalCalls']);loggerPredictive[_0xa235('0x88')](_0xa235('0x8a'),_0x1c9f2b[_0xa235('0x72')]);loggerPredictive[_0xa235('0x88')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c9f2b['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0xa235('0x8b'),_0x1c9f2b[_0xa235('0x75')]);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c9f2b[_0xa235('0x73')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c9f2b[_0xa235('0x74')]);loggerPredictive[_0xa235('0x88')](_0xa235('0x8c'));if(_0x1c9f2b[_0xa235('0x7c')]>0x0){if(!_['isUndefined'](_0x1c9f2b[_0xa235('0x74')])&&_0x1c9f2b[_0xa235('0x74')]>0x0){return!![];}loggerPredictive[_0xa235('0x88')](_0xa235('0x8d'));if(!_[_0xa235('0x42')](_0x1c9f2b[_0xa235('0x73')])&&_0x1c9f2b[_0xa235('0x73')]>0x0){return!![];}loggerPredictive[_0xa235('0x88')](_0xa235('0x8e'));}else{loggerPredictive[_0xa235('0x88')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xa235('0x88')](_0xa235('0x8f'));}return![];}function mergeDataErlangB(_0x9604a5){return function(_0x175431){loggerPredictive[_0xa235('0x88')]('---------\x20ErlangB\x20---------');loggerPredictive[_0xa235('0x88')](_0xa235('0x90'),_0x175431['erlangCalls']);loggerPredictive[_0xa235('0x88')](_0xa235('0x91'),_0x175431['erlangCallToSecond']);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x175431[_0xa235('0x7f')]);loggerPredictive[_0xa235('0x88')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x175431[_0xa235('0x92')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x175431[_0xa235('0x7f')]);loggerPredictive['info'](_0xa235('0x8c'));_[_0xa235('0x93')](_0x9604a5,_0x175431);};}function getDiff(_0x40ea0e){var _0x234cd9=moment()[_0xa235('0x4f')](0x0);var _0x4453ea=moment(_0x40ea0e)[_0xa235('0x4f')](0x0);return _0x234cd9[_0xa235('0x50')](_0x4453ea,_0xa235('0x51'));}function ifInterval(_0xa7749a,_0x1b19f2){if(_[_0xa235('0x42')](_0x1b19f2)){return![];}return getDiff(_0x1b19f2)<_0xa7749a*0x3c;}function freeVariablesPredictive(_0x972dba){if(isNotNull(_0x972dba)){if(!_[_0xa235('0x42')](_0x972dba[_0xa235('0x27')])){_0x972dba[_0xa235('0x27')]=undefined;loggerPredictive[_0xa235('0x88')](_0x972dba['name'],_0xa235('0x94'));}if(!_[_0xa235('0x42')](_0x972dba[_0xa235('0x26')])){_0x972dba['startPredictive']=undefined;loggerPredictive['info'](_0x972dba[_0xa235('0x45')],_0xa235('0x95'));}if(!_[_0xa235('0x42')](_0x972dba['handlePredictive'])){clearInterval(_0x972dba[_0xa235('0x96')]);_0x972dba['handlePredictive']=undefined;loggerPredictive[_0xa235('0x88')](_0x972dba['name'],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x413436,_0x5ea30f){if(_0x5ea30f===0x0){return 0x0;}var _0x52298e=0x1;for(var _0x53cbbb=0x1;_0x53cbbb<=_0x5ea30f;_0x53cbbb+=0x1){_0x52298e=0x1+_0x52298e*_0x53cbbb/_0x413436;}return 0x1/_0x52298e;}function isVoiceQueueOutbound(_0x532353){return _0x532353==='outbound';}function isNotPreview(_0x30003c){return _0x30003c!==_0xa235('0x1d');}function isCampaignIvr(_0xd7cf56){return _0xd7cf56==='ivr';}function getCallerId(_0x3adc13,_0x2a426b,_0x2ad01a){if(!_[_0xa235('0x42')](_0x2ad01a)&&typeof _0x2ad01a===_0xa235('0x97')&&!_['isEmpty'](_0x2ad01a)){if(!_[_0xa235('0x42')](_0x2a426b)&&typeof _0x2a426b===_0xa235('0x97')&&!_[_0xa235('0x98')](_0x2a426b)){return util[_0xa235('0x99')](_0xa235('0x9a'),_0x2a426b,_0x2ad01a);}return util[_0xa235('0x99')](_0xa235('0x9a'),_0x2ad01a,_0x2ad01a);}if(!_['isUndefined'](_0x3adc13)&&typeof _0x3adc13==='string'&&!_[_0xa235('0x98')](_0x3adc13)){return _0x3adc13;}return _0xa235('0x9b');}function loggerCatchQueueSummary(_0x39837e,_0x51ee05){return function(_0x3af05a){freeVariablesPredictive(_0x51ee05);emitVoiceQueueSummary(_0x51ee05);emitCampaignSummary(_0x51ee05);loggerSyncQueueSummary['debug'](_0x39837e,util[_0xa235('0x9c')](_0x3af05a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0xd5758c,_0x5aaf43){return function(_0x21cfac){loggerPredictive[_0xa235('0x9d')](_0x5aaf43[_0xa235('0x45')],_0xd5758c);loggerPredictive[_0xa235('0x9d')](_0x21cfac[_0xa235('0x9e')]);freeVariablesPredictive(_0x5aaf43);};}function loggerCatch(_0x3bf214){return function(_0x4f1576){logger[_0xa235('0x9d')](_0x3bf214,util[_0xa235('0x9c')](_0x4f1576,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2f9889){return _0x2f9889&&!_[_0xa235('0x42')](_0x2f9889)&&_0x2f9889[_0xa235('0x9f')]>0x0;}function decremetOriginate(_0x541d3e){if(!_[_0xa235('0x42')](_0x541d3e)&&_0x541d3e!==null){if(typeof _0x541d3e[_0xa235('0x7d')]!==_0xa235('0xa0')){if(_0x541d3e[_0xa235('0x7d')]>0x0){_0x541d3e[_0xa235('0x7d')]-=0x1;}else{logger['error'](_0xa235('0xa1'));}}}else{logger[_0xa235('0x9d')](_0xa235('0xa2'));}}function checkContactLowerLimitOriginate(_0x11df6f,_0x3620bb,_0xcd7efd){if(_0x3620bb>_0xcd7efd){for(var _0x5dc85e=0x0;_0x5dc85e<_0x3620bb-_0xcd7efd;_0x5dc85e+=0x1){decremetOriginate(_0x11df6f);}}}function loggerGetContactDialer(_0x1af3bc,_0x1e3c0f,_0x4b7b04){return function(_0x15ff8a){checkContactLowerLimitOriginate(_0x1e3c0f,_0x4b7b04,0x0);logger['error'](_0x1af3bc,util[_0xa235('0x9c')](_0x15ff8a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x33ad4b){return function(_0x5603e8){if(isNotNull(_0x5603e8)&&isNotNull(_0x5603e8[0x0])){if(_0x5603e8[0x0][_0xa235('0xa3')]>0x0){_0x33ad4b['message']='RESCHEDULED_CONTACTS';logger[_0xa235('0x88')](_0xa235('0xa4')+_0x33ad4b[_0xa235('0x45')],_0x5603e8[0x0][_0xa235('0xa3')],_0xa235('0xa5'));}else{_0x33ad4b[_0xa235('0x43')]=_0xa235('0xa6');logger[_0xa235('0x88')](_0xa235('0xa7')+_0x33ad4b['name']);}}};}function notSendMessagesQueue(_0x2845a0){if(_0x2845a0['sendMessageOneNotActive']){freeVariablesPredictive(_0x2845a0);if(_0x2845a0[_0xa235('0x7d')]===0x0&&_0x2845a0[_0xa235('0x5c')]===0x0&&_0x2845a0[_0xa235('0x5f')]===0x0&&(_0x2845a0['pTalking']||0x0)===0x0){_0x2845a0[_0xa235('0xa8')]=![];_0x2845a0[_0xa235('0x57')]=0x0;_0x2845a0[_0xa235('0x43')]=_0xa235('0x47');loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x2845a0[_0xa235('0x45')],'is\x20not\x20active');}else{_0x2845a0[_0xa235('0x43')]=_0xa235('0xa9');loggerSyncQueueSummary[_0xa235('0xaa')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x2845a0[_0xa235('0x45')],_0xa235('0xab'));}emitVoiceQueueSummary(_0x2845a0);}}function notSendMessagesCampaign(_0xc862f3){if(_0xc862f3[_0xa235('0xa8')]){if(_0xc862f3[_0xa235('0x7d')]===0x0){_0xc862f3[_0xa235('0xa8')]=![];_0xc862f3['message']=_0xa235('0x47');loggerSyncQueueSummary[_0xa235('0xaa')](_0xa235('0xac'),_0xc862f3[_0xa235('0x45')],_0xa235('0xad'));}else{_0xc862f3[_0xa235('0x43')]=_0xa235('0xa9');loggerSyncQueueSummary[_0xa235('0xaa')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0xc862f3['name'],_0xa235('0xab'));}emitCampaignSummary(_0xc862f3);}}function createObjHistory(_0xa69d4d,_0x1d7f39,_0x158c84,_0x4cecb9,_0x462398){_0xa69d4d[_0xa235('0x43')]=_0x158c84;var _0x353b14=new Action(_0xa69d4d,_0x1d7f39);var _0x3de1b3=new History(_0x353b14);_0x3de1b3['state']=_0x4cecb9;_0x3de1b3[_0xa235('0xae')]=_0x462398;_0x3de1b3[_0xa235('0xaf')]=_0x353b14[_0xa235('0xb0')];return _0x3de1b3;}Dialer[_0xa235('0x1a')][_0xa235('0x3f')]=function(){var _0x2c43d4=this;setInterval(function(){_0x2c43d4[_0xa235('0xb1')](_0x2c43d4[_0xa235('0x24')],_0xa235('0xb2'));_0x2c43d4['clearZombieChannels'](_0x2c43d4[_0xa235('0xb3')],'[actions]');},0x32c8);};Dialer[_0xa235('0x1a')][_0xa235('0xb1')]=function(_0x25e863,_0xd6d448){var _0x31bbf6=this;for(var _0x520a12 in _0x25e863){if(typeof _0x25e863[_0x520a12]!==_0xa235('0xa0')){this[_0xa235('0xb4')][_0xa235('0xb5')](function(){if(!_[_0xa235('0xb6')](_0x25e863[_0x520a12])){return ami['Action']({'action':_0xa235('0xb7'),'channel':_0x25e863[_0x520a12][_0xa235('0xb8')]})[_0xa235('0xb9')](function(_0x812d17){if(_0x812d17[_0xa235('0x43')]===_0xa235('0xba')){setTimeout(function(){if(_0x25e863[_0x520a12]&&_0x25e863[_0x520a12][_0xa235('0x53')]!=='ivr'){_0x31bbf6['updateOriginated'](_0x31bbf6[_0xa235('0x1e')][_0x25e863[_0x520a12]['queue']]);logger['error']('[Dialer][checkChannel]',_0xd6d448,_0x520a12,_0x25e863[_0x520a12]['queue']);delete _0x25e863[_0x520a12];}if(_0x25e863[_0x520a12]&&_0x25e863[_0x520a12][_0xa235('0x53')]===_0xa235('0x85')){_0x31bbf6[_0xa235('0xbb')](_0x31bbf6[_0xa235('0x1f')][_0x25e863[_0x520a12][_0xa235('0xbc')]]);logger[_0xa235('0x9d')]('[Dialer][checkChannel][ivr]',_0xd6d448,_0x520a12,_0x25e863[_0x520a12][_0xa235('0xbc')]);delete _0x25e863[_0x520a12];}},0x2328);}});}});}}};Dialer[_0xa235('0x1a')][_0xa235('0xbd')]=function(_0x2a7802){return BPromise[_0xa235('0xbe')]()[_0xa235('0x41')](cmHopper[_0xa235('0xbd')](_0x2a7802))['catch'](loggerCatch(_0xa235('0xbf')));};Dialer[_0xa235('0x1a')][_0xa235('0xc0')]=function(_0x150d55){return BPromise[_0xa235('0xbe')]()[_0xa235('0x41')](cmHopperBlack[_0xa235('0xc0')](_0x150d55))[_0xa235('0xb9')](loggerCatch(_0xa235('0xc1')));};Dialer[_0xa235('0x1a')]['verifyAdditionalPhones']=function(_0x51d99e,_0x553627,_0xc7e49c){return BPromise[_0xa235('0xbe')]()[_0xa235('0x41')](cmHopperAdditionalPhone[_0xa235('0xc2')](_0x51d99e,_0x553627,_0xc7e49c))[_0xa235('0xb9')](loggerCatch(_0xa235('0xc3')));};Dialer['prototype'][_0xa235('0xc4')]=function(_0x1dd41b,_0x5d7ebe,_0xfd2d72){return BPromise[_0xa235('0xbe')]()['then'](cmHopperAdditionalPhone[_0xa235('0xc4')](_0x1dd41b,_0x5d7ebe,_0xfd2d72))[_0xa235('0xb9')](loggerCatch(_0xa235('0xc5')));};Dialer[_0xa235('0x1a')][_0xa235('0xc6')]=function(_0x1acc38){return BPromise['resolve']()['then'](cmHopperBlack[_0xa235('0xc6')](_0x1acc38))[_0xa235('0xb9')](loggerCatch(_0xa235('0xc7')));};Dialer['prototype'][_0xa235('0xc8')]=function(_0x159955){return BPromise[_0xa235('0xbe')]()[_0xa235('0x41')](cmHopperHistory[_0xa235('0xc9')](_0x159955))[_0xa235('0xb9')](loggerCatch(_0xa235('0xca')));};Dialer[_0xa235('0x1a')][_0xa235('0xcb')]=function(_0x559f25){return BPromise[_0xa235('0xbe')]()[_0xa235('0x41')](cmHopper[_0xa235('0xcb')](_0x559f25))[_0xa235('0xb9')](loggerCatch(_0xa235('0xcc')));};Dialer[_0xa235('0x1a')][_0xa235('0xcd')]=function(_0x2d17b1,_0x48349a,_0x3c3af0){return BPromise[_0xa235('0xbe')]()[_0xa235('0x41')](cmHopper[_0xa235('0xcd')](_0x2d17b1,_0x48349a,_0x3c3af0))[_0xa235('0xb9')](loggerCatch(_0xa235('0xce')));};Dialer['prototype']['getContactDialer']=function(_0x508cbc,_0x385ceb,_0x178c2e,_0x26aef2,_0x31f564){return BPromise[_0xa235('0xbe')]()[_0xa235('0x41')](cmHopper[_0xa235('0xcf')](_0x508cbc,_0x385ceb,_0x178c2e,_0x26aef2))['catch'](function(_0x4aea52){_0x31f564[_0xa235('0xd0')]-=_0x178c2e;_0x31f564[_0xa235('0xd0')]=_0x31f564[_0xa235('0xd0')]>0x0?_0x31f564[_0xa235('0xd0')]:0x0;loggerCatch(_0xa235('0xd1'))(_0x4aea52);});};Dialer[_0xa235('0x1a')][_0xa235('0xd2')]=function(_0x36406f,_0x1c2f8e,_0x9c3bee,_0x3ab545){return BPromise['resolve']()[_0xa235('0x41')](cmHopper[_0xa235('0xd2')](_0x36406f,_0x1c2f8e,_0x9c3bee))[_0xa235('0xb9')](function(_0x5a55f7){_0x3ab545[_0xa235('0xd0')]-=_0x1c2f8e;_0x3ab545['temp']=_0x3ab545['temp']>0x0?_0x3ab545[_0xa235('0xd0')]:0x0;loggerCatch(_0xa235('0xd3'))(_0x5a55f7);});};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x38a7d7){return BPromise[_0xa235('0xbe')]()['then'](voiceQueueRt[_0xa235('0xd4')](_0x38a7d7))[_0xa235('0xb9')](loggerCatch(_0xa235('0xd5')));};Dialer[_0xa235('0x1a')]['moveContactManagedDialer']=function(_0x7d72ae){return BPromise[_0xa235('0xbe')]()[_0xa235('0x41')](cmHopper[_0xa235('0xd6')](_0x7d72ae))[_0xa235('0xb9')](loggerCatch(_0xa235('0xd7')));};Dialer[_0xa235('0x1a')][_0xa235('0xd8')]=function(_0x552a2e){return BPromise[_0xa235('0xbe')]()[_0xa235('0x41')](cmHopperHistory[_0xa235('0xd8')](_0x552a2e))[_0xa235('0xb9')](loggerCatch(_0xa235('0xd9')));};Dialer[_0xa235('0x1a')][_0xa235('0xbb')]=function(_0x54ad34){if(!_[_0xa235('0x42')](_0x54ad34)&&_0x54ad34!==null){if(typeof _0x54ad34[_0xa235('0x7d')]!=='undefined'){if(_0x54ad34[_0xa235('0x7d')]>0x0){_0x54ad34[_0xa235('0x7d')]-=0x1;}else{logger[_0xa235('0x9d')](_0xa235('0xda'));}}}else{logger[_0xa235('0x9d')](_0xa235('0xdb'));}};Dialer[_0xa235('0x1a')][_0xa235('0xdc')]=function(_0x882450,_0xa39f61){var _0x41da04=this;return function(_0x62f05e){_0x41da04[_0xa235('0xbb')](_0xa39f61);logger[_0xa235('0x9d')](_0x882450,util[_0xa235('0x9c')](_0x62f05e,{'showHidden':![],'depth':null}));};};Dialer[_0xa235('0x1a')]['emptyContact']=function(_0x2efbfb,_0x59c581,_0x959ec5){var _0x1b8b9e={'state':0x19,'statedesc':'notFound'};this[_0xa235('0xbb')](_0x59c581);this[_0xa235('0xdd')](_[_0xa235('0x93')](_0x1b8b9e,_[_0xa235('0xde')](_0x959ec5,[_0xa235('0xdf'),_0xa235('0xe0'),'UserId','VoiceQueueId',_0xa235('0xe1')])),_0xa235('0xe2'),'[emptyContact]');logger['error'](_0x2efbfb);};Dialer[_0xa235('0x1a')][_0xa235('0xe3')]=function(_0x5b419c){return _0x5b419c===_0xa235('0xe4');};Dialer[_0xa235('0x1a')][_0xa235('0xe5')]=function(_0x343d2e){return!_[_0xa235('0x42')](_0x343d2e)&&_0x343d2e&&!_[_0xa235('0x42')](_0x343d2e[_0xa235('0x45')])&&!_[_0xa235('0x42')](_0x343d2e[_0xa235('0x81')])&&_0x343d2e[_0xa235('0x81')]&&(this[_0xa235('0x21')][util['format'](_0xa235('0xe6'),_0x343d2e[_0xa235('0x45')])]['status']===_0xa235('0xe7')||this['trunks'][util[_0xa235('0x99')]('SIP/%s',_0x343d2e[_0xa235('0x45')])][_0xa235('0xb7')]===_0xa235('0xe8'));};Dialer[_0xa235('0x1a')][_0xa235('0xdd')]=function(_0x4f3730,_0xb31eae,_0x2e86f8){this['createHistory'](_0x4f3730)[_0xa235('0xb9')](loggerCatch(_0xb31eae));this[_0xa235('0xd6')](_0x4f3730)[_0xa235('0xb9')](loggerCatch(_0x2e86f8));};Dialer[_0xa235('0x1a')][_0xa235('0x3b')]=function(_0x3214af){var _0x59c372=this[_0xa235('0x24')][_0x3214af['uniqueid']];var _0x50d0a9;if(!_[_0xa235('0xb6')](_0x3214af)&&!_['isNil'](_0x3214af['variable'])&&!_[_0xa235('0xb6')](_0x3214af['variable'][_0xa235('0xe9')])&&_0x3214af[_0xa235('0xea')]===_0xa235('0xeb')&&_0x59c372){if(_0x59c372[_0xa235('0x53')]!==_0xa235('0x85')&&this[_0xa235('0x1e')][_0x59c372['queue']][_0xa235('0xec')]&&_0x3214af[_0xa235('0xed')]==='HANGUP'){delete this[_0xa235('0x24')][_0x3214af[_0xa235('0xee')]];this[_0xa235('0xbb')](this[_0xa235('0x1e')][_0x59c372[_0xa235('0xbc')]]);this[_0xa235('0x1e')][_0x59c372[_0xa235('0xbc')]][_0xa235('0x67')]+=0x1;this[_0xa235('0x1e')][_0x59c372[_0xa235('0xbc')]][_0xa235('0x66')]+=0x1;_0x50d0a9=new Hangup(_0x59c372,_0x3214af);_0x50d0a9['state']=0x12;_0x50d0a9[_0xa235('0xae')]=_0xa235('0xef');_0x50d0a9[_0xa235('0xf0')]=_0xa235('0xf1');ami[_0xa235('0x52')]('custom:amd',ut[_0xa235('0xf2')](_0x50d0a9,'amd'));this['saveInDb'](_0x50d0a9,_0xa235('0xf3'),_0xa235('0xf4'));}if(_0x59c372['type']!=='ivr'&&this['voiceQueues'][_0x59c372[_0xa235('0xbc')]][_0xa235('0xec')]&&_0x3214af[_0xa235('0xed')]===_0xa235('0xf5')){var _0x18adec=this;return new BPromise(function(_0xd00566,_0x4e45d4){delete _0x18adec['uniqueId'][_0x3214af[_0xa235('0xee')]];_0x18adec[_0xa235('0xbb')](_0x18adec[_0xa235('0x1e')][_0x59c372['queue']]);_0x18adec[_0xa235('0x1e')][_0x59c372[_0xa235('0xbc')]]['outboundAnswerCallsDay']+=0x1;_0x18adec['voiceQueues'][_0x59c372[_0xa235('0xbc')]][_0xa235('0x66')]+=0x1;var _0x2d4314=_0x18adec[_0xa235('0x1e')][_0x59c372[_0xa235('0xbc')]];var _0x1479ec=new Hangup(_0x59c372,_0x3214af);_0x1479ec['state']=0x13;_0x1479ec[_0xa235('0xae')]=_0xa235('0xf6');_0x1479ec[_0xa235('0xf0')]=_0xa235('0xf1');_0x1479ec[_0xa235('0xf7')]+=0x1;_0x1479ec[_0xa235('0xf8')]+=0x1;_0x1479ec[_0xa235('0xf9')]=!![];ami[_0xa235('0x52')](_0xa235('0xfa'),ut[_0xa235('0xf2')](_0x1479ec,'amd'));_0x18adec[_0xa235('0xd8')](_0x1479ec)[_0xa235('0xb9')](loggerCatch(_0xa235('0xfb')));if(_0x1479ec[_0xa235('0xfc')]+_0x1479ec[_0xa235('0xfd')]+_0x1479ec[_0xa235('0xfe')]+_0x1479ec[_0xa235('0xff')]+_0x1479ec['countdropretry']+_0x1479ec[_0xa235('0x100')]+_0x1479ec[_0xa235('0xf7')]+_0x1479ec[_0xa235('0x101')]>=_0x2d4314[_0xa235('0x102')]){_0x18adec['stateGlobal'](_0x1479ec,_0xd00566,_0x4e45d4,'reason19\x20machine....');}else{if(_0x1479ec[_0xa235('0xf7')]>=_0x2d4314[_0xa235('0x103')]){_0x18adec[_0xa235('0x104')](_0x1479ec,_0xd00566,_0x4e45d4,_0xa235('0x105'));}else{_0x18adec[_0xa235('0xcb')]({'active':![],'countmachineretry':_0x1479ec[_0xa235('0xf7')],'scheduledat':moment()[_0xa235('0x106')](_0x2d4314[_0xa235('0x107')],_0xa235('0x108'))[_0xa235('0x99')](_0xa235('0x109')),'ContactId':_0x1479ec[_0xa235('0xdf')],'ListId':_0x1479ec[_0xa235('0xe0')],'VoiceQueueId':_0x1479ec[_0xa235('0x10a')]||undefined,'CampaignId':_0x1479ec[_0xa235('0xe1')]||undefined})[_0xa235('0xb9')](loggerCatch('[rescheduleContact][Machine]'));_0xd00566({'reschedule':0x1});}}});}if(_0x59c372[_0xa235('0x53')]==='ivr'&&this[_0xa235('0x1f')][_0x59c372[_0xa235('0xbc')]][_0xa235('0xec')]&&_0x3214af[_0xa235('0xed')]===_0xa235('0x10b')){delete this[_0xa235('0x24')][_0x3214af[_0xa235('0xee')]];this[_0xa235('0xbb')](this[_0xa235('0x1f')][_0x59c372[_0xa235('0xbc')]]);_0x50d0a9=new Hangup(_0x59c372,_0x3214af);_0x50d0a9[_0xa235('0x10c')]=0x12;_0x50d0a9[_0xa235('0xae')]=_0xa235('0xef');_0x50d0a9[_0xa235('0xf0')]=_0xa235('0xf1');ami[_0xa235('0x52')](_0xa235('0xfa'),ut['buildObj'](_0x50d0a9,_0xa235('0xf9')));this[_0xa235('0xdd')](_0x50d0a9,_0xa235('0x10d'),'[syncHangupInAMDIvr]');}if(_0x59c372['type']===_0xa235('0x85')&&this['campaigns'][_0x59c372[_0xa235('0xbc')]][_0xa235('0xec')]&&_0x3214af[_0xa235('0xed')]===_0xa235('0xf5')){var _0x18adec=this;return new BPromise(function(_0x12d729,_0xebe34){delete _0x18adec[_0xa235('0x24')][_0x3214af[_0xa235('0xee')]];_0x18adec[_0xa235('0xbb')](_0x18adec[_0xa235('0x1f')][_0x59c372['queue']]);_0x18adec['campaigns'][_0x59c372[_0xa235('0xbc')]][_0xa235('0x67')]+=0x1;_0x18adec[_0xa235('0x1f')][_0x59c372[_0xa235('0xbc')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x21cb58=_0x18adec['campaigns'][_0x59c372[_0xa235('0xbc')]];var _0x28c471=new Hangup(_0x59c372,_0x3214af);_0x28c471[_0xa235('0x10c')]=0x13;_0x28c471[_0xa235('0xae')]='Machine';_0x28c471['membername']=_0xa235('0xf1');_0x28c471[_0xa235('0xf7')]+=0x1;_0x28c471['countglobal']+=0x1;_0x28c471[_0xa235('0xf9')]=!![];ami[_0xa235('0x52')](_0xa235('0xfa'),ut[_0xa235('0xf2')](_0x28c471,_0xa235('0xf9')));_0x18adec[_0xa235('0xd8')](_0x28c471)[_0xa235('0xb9')](loggerCatch(_0xa235('0xfb')));if(_0x28c471[_0xa235('0xfc')]+_0x28c471[_0xa235('0xfd')]+_0x28c471[_0xa235('0xfe')]+_0x28c471[_0xa235('0xff')]+_0x28c471[_0xa235('0x10e')]+_0x28c471['countabandonedretry']+_0x28c471[_0xa235('0xf7')]+_0x28c471[_0xa235('0x101')]>=_0x21cb58[_0xa235('0x102')]){_0x18adec[_0xa235('0x10f')](_0x28c471,_0x12d729,_0xebe34,_0xa235('0x110'));}else{if(_0x28c471[_0xa235('0xf7')]>=_0x21cb58[_0xa235('0x103')]){_0x18adec['createStateFinal'](_0x28c471,_0x12d729,_0xebe34,'reason\x2019\x20machine....');}else{_0x18adec[_0xa235('0xcb')]({'active':![],'countmachineretry':_0x28c471[_0xa235('0xf7')],'scheduledat':moment()['add'](_0x21cb58[_0xa235('0x107')],_0xa235('0x108'))[_0xa235('0x99')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x28c471[_0xa235('0xdf')],'ListId':_0x28c471[_0xa235('0xe0')],'VoiceQueueId':_0x28c471[_0xa235('0x10a')]||undefined,'CampaignId':_0x28c471[_0xa235('0xe1')]||undefined})[_0xa235('0xb9')](loggerCatch(_0xa235('0x111')));_0x12d729({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x4e6f56){var _0x342714=this[_0xa235('0x24')][_0x4e6f56[_0xa235('0xee')]];var _0x5c909e=this;var _0x4cd11f;if(_0x342714&&_0x342714[_0xa235('0x53')]===_0xa235('0x85')){delete this['uniqueId'][_0x4e6f56[_0xa235('0xee')]];this[_0xa235('0xbb')](this[_0xa235('0x1f')][_0x342714[_0xa235('0xbc')]]);this[_0xa235('0x1f')][_0x342714[_0xa235('0xbc')]][_0xa235('0x112')]+=0x1;_0x4cd11f=new Hangup(_0x342714,_0x4e6f56);this[_0xa235('0xd8')](_0x4cd11f)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xa235('0xd6')](_0x4cd11f)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x342714&&_0x342714[_0xa235('0x53')]!==_0xa235('0x85')&&isNotNull(this['voiceQueues'][_0x342714[_0xa235('0xbc')]][_0xa235('0x113')])){delete this['uniqueId'][_0x4e6f56[_0xa235('0xee')]];this[_0xa235('0xbb')](this[_0xa235('0x1e')][_0x342714['queue']]);this[_0xa235('0x1e')][_0x342714[_0xa235('0xbc')]][_0xa235('0x67')]+=0x1;this[_0xa235('0x1e')][_0x342714[_0xa235('0xbc')]]['outboundAnswerAgiCallsDay']+=0x1;_0x4cd11f=new Hangup(_0x342714,_0x4e6f56);_0x4cd11f[_0xa235('0x10c')]=0x10;_0x4cd11f['statedesc']=_0xa235('0x114');_0x4cd11f['membername']=_0xa235('0x115');this['createHistory'](_0x4cd11f)[_0xa235('0xb9')](loggerCatch(_0xa235('0x116')));this[_0xa235('0xd6')](_0x4cd11f)[_0xa235('0xb9')](loggerCatch(_0xa235('0x117')));}if(_0x342714&&_0x342714[_0xa235('0x53')]!==_0xa235('0x85')&&!isNotNull(this[_0xa235('0x1e')][_0x342714[_0xa235('0xbc')]][_0xa235('0x113')])){delete this['uniqueId'][_0x4e6f56[_0xa235('0xee')]];this[_0xa235('0xbb')](this[_0xa235('0x1e')][_0x342714[_0xa235('0xbc')]]);this[_0xa235('0x1e')][_0x342714['queue']][_0xa235('0x71')]+=0x1;_0x4cd11f=new Hangup(_0x342714,_0x4e6f56);_0x4cd11f[_0xa235('0x10c')]=0xc;_0x4cd11f[_0xa235('0xae')]=_0x4e6f56[_0xa235('0x118')];_0x4cd11f['membername']=_0xa235('0x119');this['createHistory'](_0x4cd11f)[_0xa235('0xb9')](loggerCatch(_0xa235('0x116')));this[_0xa235('0xd6')](_0x4cd11f)['catch'](loggerCatch(_0xa235('0x117')));}};Dialer['prototype'][_0xa235('0x33')]=function(_0x2a02d4){var _0x14a64c=this[_0xa235('0x24')][_0x2a02d4[_0xa235('0xee')]];var _0x288f89=this;if(this[_0xa235('0x1e')][_0x2a02d4['queue']]){if(_0x14a64c&&_0x14a64c[_0xa235('0x53')]!==_0xa235('0x85')){delete this[_0xa235('0x24')][_0x2a02d4[_0xa235('0xee')]];this[_0xa235('0x1e')][_0x2a02d4[_0xa235('0xbc')]]['outboundAnswerCallsDay']+=0x1;var _0x14d13f=new AgentComplete(_0x14a64c,_0x2a02d4);if(_0x2a02d4[_0xa235('0x11a')]===_0xa235('0x11b')){_0x14d13f[_0xa235('0x11c')]=this[_0xa235('0x1e')][_0x2a02d4['queue']][_0xa235('0x11d')]&&this['voiceQueues'][_0x2a02d4['queue']]['dialAgiAfterHangupAgent']?moment()[_0xa235('0x99')](_0xa235('0x109')):undefined;}this[_0xa235('0xd8')](_0x14d13f)[_0xa235('0xb9')](loggerCatch(_0xa235('0x11e')));this['moveContactManagedDialer'](_0x14d13f)['catch'](loggerCatch(_0xa235('0x11f')));}}};Dialer['prototype'][_0xa235('0x2c')]=function(_0x43c8f6){if(this[_0xa235('0x1e')][_0x43c8f6[_0xa235('0xbc')]]){if(this[_0xa235('0x24')][_0x43c8f6['uniqueid']]&&this[_0xa235('0x24')][_0x43c8f6[_0xa235('0xee')]][_0xa235('0x53')]!==_0xa235('0x85')){this['updateOriginated'](this[_0xa235('0x1e')][_0x43c8f6[_0xa235('0xbc')]]);this[_0xa235('0x24')][_0x43c8f6[_0xa235('0xee')]][_0xa235('0x120')]=moment()[_0xa235('0x99')](_0xa235('0x109'));}}};Dialer[_0xa235('0x1a')]['queueCallerAbandonCreateState']=function(_0x497eed,_0x51c744){this['createHistory'](_0x497eed)['catch'](loggerCatch(_0xa235('0x11e')));if(_0x51c744==0x0){this[_0xa235('0xd6')](_0x497eed)[_0xa235('0xb9')](loggerCatch(_0xa235('0x121')));}};Dialer['prototype'][_0xa235('0x2f')]=function(_0x1dec5c){var _0x4fcd19=this['uniqueId'][_0x1dec5c[_0xa235('0xee')]];var _0x4a6a35=this;var _0x1bd997=![];var _0x3e621c;var _0x3b0f0a;if(this[_0xa235('0x1e')][_0x1dec5c[_0xa235('0xbc')]]){if(_0x4fcd19&&_0x4fcd19[_0xa235('0x53')]!==_0xa235('0x85')){delete this[_0xa235('0x24')][_0x1dec5c['uniqueid']];this[_0xa235('0xbb')](this['voiceQueues'][_0x1dec5c['queue']]);_0x4fcd19[_0xa235('0x122')]=moment()[_0xa235('0x99')]('YYYY-MM-DD\x20HH:mm:ss');var _0x164182=new QueueCallerAbandon(_0x4fcd19,_0x1dec5c);if(getSeconds(_0x4fcd19[_0xa235('0x122')],_0x4fcd19['responsetime'])>=_0x4fcd19['dialQueueTimeout']){this[_0xa235('0x1e')][_0x1dec5c['queue']][_0xa235('0x76')]+=0x1;this['voiceQueues'][_0x1dec5c['queue']][_0xa235('0x6c')]+=0x1;this[_0xa235('0x1e')][_0x1dec5c[_0xa235('0xbc')]][_0xa235('0x78')]+=0x1;_0x164182[_0xa235('0x10c')]=0xa;_0x164182[_0xa235('0xae')]=_0xa235('0x123');_0x164182['dropreason']=_0xa235('0x124');_0x164182['agiafterat']=this[_0xa235('0x1e')][_0x1dec5c[_0xa235('0xbc')]][_0xa235('0x11d')]?moment()[_0xa235('0x99')](_0xa235('0x109')):undefined;_0x164182[_0xa235('0x10e')]+=0x1;_0x164182[_0xa235('0xf8')]+=0x1;_0x3e621c=this[_0xa235('0x1e')][_0x1dec5c[_0xa235('0xbc')]][_0xa235('0x125')];_0x3b0f0a=this[_0xa235('0x1e')][_0x1dec5c[_0xa235('0xbc')]][_0xa235('0x126')];_0x4a6a35[_0xa235('0xc2')](_0x164182,_0x164182[_0xa235('0x10c')],_0x4fcd19[_0xa235('0x127')])[_0xa235('0x41')](function(_0x3a9615){_0x1bd997=_0x3a9615[_0xa235('0x128')]==0x1;if(_0x164182[_0xa235('0x10e')]>=_0x4a6a35[_0xa235('0x1e')][_0x1dec5c[_0xa235('0xbc')]][_0xa235('0x129')]){_0x4a6a35[_0xa235('0x12a')](_0x164182,_0x3a9615[_0xa235('0x128')]);}else{_0x4a6a35['rescheduleContact']({'active':![],'countdropretry':_0x164182[_0xa235('0x10e')],'scheduledat':moment()['add'](_0x4a6a35[_0xa235('0x1e')][_0x1dec5c[_0xa235('0xbc')]][_0xa235('0x125')],_0xa235('0x108'))[_0xa235('0x99')](_0xa235('0x109')),'ContactId':_0x4fcd19['ContactId'],'ListId':_0x4fcd19['ListId'],'VoiceQueueId':_0x4fcd19[_0xa235('0x10a')]||undefined,'CampaignId':_0x4fcd19[_0xa235('0xe1')]||undefined})[_0xa235('0xb9')](loggerCatch(_0xa235('0x12b')));var _0x3ac9b1=new History(_0x164182);_0x3ac9b1['state']=0xa;_0x3ac9b1[_0xa235('0xae')]=_0xa235('0x123');_0x3ac9b1[_0xa235('0xb0')]=moment()[_0xa235('0x99')]('YYYY-MM-DD\x20HH:mm:ss');_0x3ac9b1[_0xa235('0xaf')]=_0x3ac9b1['starttime'];_0x3ac9b1['calleridname']=_0x164182['calleridname'];_0x3ac9b1[_0xa235('0x12c')]=_0x164182['calleridnum'];_0x4a6a35[_0xa235('0xd8')](_0x3ac9b1)[_0xa235('0xb9')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0xa235('0x41')](function(_0x2a88d0){if(_0x1bd997)_0x4a6a35[_0xa235('0xc4')](_0x164182,_0x3e621c,_0x3b0f0a)[_0xa235('0x41')](function(_0x5f29f0){return 0x1;});});}else{this['voiceQueues'][_0x1dec5c[_0xa235('0xbc')]][_0xa235('0x75')]+=0x1;this['voiceQueues'][_0x1dec5c['queue']][_0xa235('0x6b')]+=0x1;_0x164182['state']=0xb;_0x164182[_0xa235('0xae')]=_0xa235('0x12d');_0x164182['dropreason']=_0xa235('0x12e');_0x164182['countabandonedretry']+=0x1;_0x164182[_0xa235('0xf8')]+=0x1;_0x3e621c=this[_0xa235('0x1e')][_0x1dec5c[_0xa235('0xbc')]][_0xa235('0x12f')];_0x3b0f0a=this['voiceQueues'][_0x1dec5c[_0xa235('0xbc')]]['callAdditionalPhoneAfterMin'];_0x4a6a35[_0xa235('0xc2')](_0x164182,_0x164182[_0xa235('0x10c')],_0x4fcd19[_0xa235('0x127')])[_0xa235('0x41')](function(_0x34e74a){if(_0x164182['countabandonedretry']>=_0x4a6a35['voiceQueues'][_0x1dec5c[_0xa235('0xbc')]][_0xa235('0x130')]){_0x4a6a35['queueCallerAbandonCreateState'](_0x164182,_0x34e74a['additional']);}else{_0x4a6a35[_0xa235('0xcb')]({'active':![],'countabandonedretry':_0x164182['countabandonedretry'],'scheduledat':moment()['add'](_0x4a6a35[_0xa235('0x1e')][_0x1dec5c['queue']][_0xa235('0x12f')],'minutes')[_0xa235('0x99')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4fcd19[_0xa235('0xdf')],'ListId':_0x4fcd19['ListId'],'VoiceQueueId':_0x4fcd19['VoiceQueueId']||undefined,'CampaignId':_0x4fcd19[_0xa235('0xe1')]||undefined})[_0xa235('0xb9')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x1aedaa=new History(_0x164182);_0x1aedaa['state']=0xb;_0x1aedaa[_0xa235('0xae')]='Abandoned';_0x1aedaa[_0xa235('0xb0')]=moment()[_0xa235('0x99')]('YYYY-MM-DD\x20HH:mm:ss');_0x1aedaa[_0xa235('0xaf')]=_0x1aedaa['starttime'];_0x1aedaa[_0xa235('0x131')]=_0x164182[_0xa235('0x131')];_0x1aedaa[_0xa235('0x12c')]=_0x164182[_0xa235('0x12c')];_0x4a6a35[_0xa235('0xd8')](_0x1aedaa)['catch'](loggerCatch(_0xa235('0x132')));}})['then'](function(_0x39147f){if(_0x1bd997)_0x4a6a35[_0xa235('0xc4')](_0x164182,_0x3e621c,_0x3b0f0a)[_0xa235('0x41')](function(_0x4f7170){return 0x1;});});}}}};Dialer[_0xa235('0x1a')][_0xa235('0x39')]=function(_0x3a4900){if(this[_0xa235('0xb3')][_0x3a4900['uniqueid']]){this['actions'][_0x3a4900[_0xa235('0xee')]]['channel']=_0x3a4900[_0xa235('0xb8')];}if(this[_0xa235('0x24')][_0x3a4900['uniqueid']]){this[_0xa235('0x24')][_0x3a4900['uniqueid']]['channel']=_0x3a4900[_0xa235('0xb8')];}};Dialer['prototype']['syncQueueMember']=function(_0x1582d1){if(strategy[this[_0xa235('0x1e')][this[_0xa235('0xb3')][_0x1582d1[_0xa235('0x133')]][_0xa235('0xbc')]][_0xa235('0x55')]]==='roundrobin'){if(this[_0xa235('0xb3')][_0x1582d1[_0xa235('0x133')]]&&_[_0xa235('0xb6')](this[_0xa235('0xb3')][_0x1582d1['actionid']][_0xa235('0x134')])&&_0x1582d1['status']==='1'&&_0x1582d1[_0xa235('0x135')]==='0'){if(this[_0xa235('0x20')][_0x1582d1[_0xa235('0x136')]]){if(!this[_0xa235('0x20')][_0x1582d1[_0xa235('0x136')]][_0xa235('0x134')]){this[_0xa235('0x20')][_0x1582d1[_0xa235('0x136')]][_0xa235('0x134')]=!![];this[_0xa235('0xb3')][_0x1582d1[_0xa235('0x133')]][_0xa235('0x134')]=!![];this[_0xa235('0xb3')][_0x1582d1[_0xa235('0x133')]]['stateinterface']=_0x1582d1[_0xa235('0x136')];}}}}else if((strategy[this['voiceQueues'][this[_0xa235('0xb3')][_0x1582d1['actionid']][_0xa235('0xbc')]][_0xa235('0x55')]]||_0xa235('0x18'))===_0xa235('0x18')){if(this[_0xa235('0xb3')][_0x1582d1[_0xa235('0x133')]]){if(this[_0xa235('0x20')][_0x1582d1[_0xa235('0x136')]]){this[_0xa235('0xb3')][_0x1582d1['actionid']][_0xa235('0x136')]=_0x1582d1[_0xa235('0x136')];if(_[_0xa235('0xb6')](this[_0xa235('0x29')][this[_0xa235('0xb3')][_0x1582d1[_0xa235('0x133')]][_0xa235('0xbc')]])){this[_0xa235('0x29')][this[_0xa235('0xb3')][_0x1582d1[_0xa235('0x133')]][_0xa235('0xbc')]]=[];}this[_0xa235('0x29')][this[_0xa235('0xb3')][_0x1582d1[_0xa235('0x133')]][_0xa235('0xbc')]][_0xa235('0x137')](_[_0xa235('0x93')](_['pick'](this[_0xa235('0xb3')][_0x1582d1[_0xa235('0x133')]],[_0xa235('0x138'),'stateinterface']),{'status':_0x1582d1[_0xa235('0xb7')],'paused':_0x1582d1['paused']}));}}}};function unlockQueueStatus(_0x3d5149,_0x4aa8a6){setTimeout(function(){if(_[_0xa235('0x42')](_0x3d5149[_0xa235('0x139')])){loggerBooked[_0xa235('0x9d')]('[unlockQueueStatus][undefined]',_0x4aa8a6);}_0x3d5149[_0xa235('0x139')]=!![];loggerBooked[_0xa235('0x88')](_0xa235('0x13a'),_0x4aa8a6,JSON[_0xa235('0x4e')](_[_0xa235('0xde')](_0x3d5149,[_0xa235('0x45'),_0xa235('0x139')])));},0x1f3);}Dialer[_0xa235('0x1a')][_0xa235('0x3d')]=function(_0xf3ab0d){var _0x3d7595=this;var _0x15d104=_0x3d7595[_0xa235('0x1e')][_0x3d7595[_0xa235('0xb3')][_0xf3ab0d[_0xa235('0x133')]][_0xa235('0xbc')]];if(strategy[this[_0xa235('0x1e')][this[_0xa235('0xb3')][_0xf3ab0d[_0xa235('0x133')]][_0xa235('0xbc')]][_0xa235('0x55')]]===_0xa235('0x19')){if(this['actions'][_0xf3ab0d[_0xa235('0x133')]]&&this[_0xa235('0xb3')][_0xf3ab0d[_0xa235('0x133')]]['stateinterface']){this[_0xa235('0x1d')]['run'](this[_0xa235('0xb3')][_0xf3ab0d[_0xa235('0x133')]][_0xa235('0x138')],this['actions'][_0xf3ab0d[_0xa235('0x133')]][_0xa235('0x136')])[_0xa235('0xb9')](function(_0x2ab114){logger[_0xa235('0x9d')](_0xa235('0x13b'),util[_0xa235('0x9c')](_0x2ab114,{'showHidden':![],'depth':null}));})[_0xa235('0x1c')](function(){_0x3d7595[_0xa235('0xbb')](_0x3d7595['voiceQueues'][_0x3d7595[_0xa235('0xb3')][_0xf3ab0d[_0xa235('0x133')]][_0xa235('0xbc')]]);_0x3d7595[_0xa235('0x20')][_0x3d7595[_0xa235('0xb3')][_0xf3ab0d['actionid']][_0xa235('0x136')]][_0xa235('0x134')]=![];delete _0x3d7595[_0xa235('0xb3')][_0xf3ab0d[_0xa235('0x133')]];unlockQueueStatus(_0x15d104);});}else{this['updateOriginated'](this[_0xa235('0x1e')][this[_0xa235('0xb3')][_0xf3ab0d[_0xa235('0x133')]][_0xa235('0xbc')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0xa235('0xb3')][_0xf3ab0d[_0xa235('0x133')]][_0xa235('0xdf')],'ListId':this[_0xa235('0xb3')][_0xf3ab0d[_0xa235('0x133')]][_0xa235('0xe0')],'VoiceQueueId':this['actions'][_0xf3ab0d['actionid']][_0xa235('0x10a')]||undefined,'CampaignId':this[_0xa235('0xb3')][_0xf3ab0d[_0xa235('0x133')]][_0xa235('0xe1')]||undefined})[_0xa235('0xb9')](loggerCatch(_0xa235('0x13c')));delete this[_0xa235('0xb3')][_0xf3ab0d[_0xa235('0x133')]];unlockQueueStatus(_0x15d104);}}else if((strategy[this['voiceQueues'][this[_0xa235('0xb3')][_0xf3ab0d['actionid']]['queue']]['strategy']]||_0xa235('0x18'))==='rrmemory'){var _0x358671;if(this['actions'][_0xf3ab0d[_0xa235('0x133')]]&&!_[_0xa235('0x98')](this[_0xa235('0x29')][this[_0xa235('0xb3')][_0xf3ab0d[_0xa235('0x133')]][_0xa235('0xbc')]])){if(this[_0xa235('0x2a')][_0x3d7595[_0xa235('0xb3')][_0xf3ab0d[_0xa235('0x133')]][_0xa235('0xbc')]]){this[_0xa235('0x2a')][_0x3d7595[_0xa235('0xb3')][_0xf3ab0d[_0xa235('0x133')]][_0xa235('0xbc')]]=this[_0xa235('0x2a')][this[_0xa235('0xb3')][_0xf3ab0d[_0xa235('0x133')]][_0xa235('0xbc')]]?this[_0xa235('0x2a')][this['actions'][_0xf3ab0d['actionid']][_0xa235('0xbc')]]:this[_0xa235('0x29')][this[_0xa235('0xb3')][_0xf3ab0d[_0xa235('0x133')]]['queue']]?this[_0xa235('0x29')][this[_0xa235('0xb3')][_0xf3ab0d[_0xa235('0x133')]][_0xa235('0xbc')]][_0xa235('0x13d')]||0x0:0x0;}this['queueBooked'][this[_0xa235('0xb3')][_0xf3ab0d[_0xa235('0x133')]][_0xa235('0xbc')]][_0xa235('0x13d')]=this[_0xa235('0x2a')][this[_0xa235('0xb3')][_0xf3ab0d[_0xa235('0x133')]][_0xa235('0xbc')]];for(var _0x20e926=0x0;_0x20e926=0x0;})['catch'](myreject(_0x208d2b)));}}else{_0x1d75fe[_0xa235('0x137')](ami[_0xa235('0x158')]({'action':_0xa235('0x159'),'command':util[_0xa235('0x99')]('iftime\x20%s,%s',_0xcd28f1,!_[_0xa235('0x42')](config['timezones'][_0x18ba65])?_0x18ba65:'')})[_0xa235('0x41')](function(_0x4dbd88){return _0x4dbd88[_0xa235('0x15d')][_0xa235('0x15b')](_0xa235('0x15c'))>=0x0;})[_0xa235('0xb9')](myreject(_0x208d2b)));}BPromise['all'](_0x1d75fe)[_0xa235('0x41')](function(_0x46a5ed){var _0x2b5063=_['some'](_0x46a5ed);if(_0x2b5063){return _0x5d7511(_0x2b5063);}else{_0x2e4ea2[_0xa235('0x43')]=_0x42f2c4?_0xa235('0x15e'):_0xa235('0x15f');return _0x208d2b(msgResponse(_0xa235('0x160'),_0xa235('0x151'),_0xa235('0x161')+_0x42f2c4+'\x20'+_0x159e21+'\x20Interval\x20is\x20overtime:\x20'+util[_0xa235('0x9c')](_0xcd28f1,{'showHidden':![],'depth':null})+_0xa235('0x162')+_0x18ba65));}})[_0xa235('0xb9')](function(_0x122826){return _0x208d2b(msgResponse(_0xa235('0x14f'),'Failure',JSON['stringify'](_0x122826)));});});};Dialer[_0xa235('0x1a')][_0xa235('0x163')]=function(_0x429247){var _0x18902b=this;return function(){switch(_0x429247[_0xa235('0x62')]){case _0xa235('0x164'):freeVariablesPredictive(_0x429247);_0x18902b[_0xa235('0x165')](_0x429247,0x1);break;case _0xa235('0x166'):freeVariablesPredictive(_0x429247);_0x18902b[_0xa235('0x165')](_0x429247,_0x429247[_0xa235('0x167')]);break;case _0xa235('0x168'):_0x18902b[_0xa235('0x168')](_0x429247);break;case'booked':freeVariablesPredictive(_0x429247);_0x18902b[_0xa235('0x165')](_0x429247,0x1);break;default:freeVariablesPredictive(_0x429247);logger['error'](_0xa235('0x169'),_0x429247[_0xa235('0x45')],_0xa235('0x16a'));}};};Dialer[_0xa235('0x1a')][_0xa235('0x16b')]=function(_0x465eeb){var _0x2d6ee8=this;return function(){_0x2d6ee8[_0xa235('0x16c')](_0x465eeb);};};Dialer[_0xa235('0x1a')][_0xa235('0xb')]=function(_0x13fe83){var _0x51d450=this;if(isNotPreview(_0x13fe83[_0xa235('0x62')])){if(isVoiceQueueOutbound(_0x13fe83[_0xa235('0x53')])&&isActive(_0x13fe83['dialActive'])){_0x13fe83[_0xa235('0xa8')]=!![];BPromise['resolve']()[_0xa235('0x41')](checkIsLoggedIn(_0x13fe83,_0x13fe83[_0xa235('0x58')]))[_0xa235('0x41')](checkIsActive(_0x13fe83,_0x13fe83[_0xa235('0x61')]))[_0xa235('0x41')](checkInterval(_0x13fe83))['then'](_0x51d450['checkIsTrunkReachable'](_0x13fe83))[_0xa235('0x41')](_0x51d450['checkIfTime'](_0x13fe83[_0xa235('0x16d')],_0x13fe83[_0xa235('0x16e')],_0x13fe83[_0xa235('0x45')],_0x13fe83))[_0xa235('0x41')](_0x51d450[_0xa235('0x150')](_0x13fe83['Interval'],_0x13fe83[_0xa235('0x16e')],_0x13fe83['name'],_0x13fe83))['then'](_0x51d450['checkDialMethod'](_0x13fe83))[_0xa235('0xb9')](loggerCatchQueueSummary(_0xa235('0x16f'),_0x13fe83));}else{notSendMessagesQueue(_0x13fe83);}}else{freeVariablesPredictive(_0x13fe83);}};Dialer[_0xa235('0x1a')][_0xa235('0x35')]=_[_0xa235('0x170')](function(){var _0x36dbbc=_['filter'](this[_0xa235('0x1e')],function(_0x341264){return _0x341264[_0xa235('0x171')];});var _0x5a545b=_['filter'](this[_0xa235('0x20')],function(_0x15ac46){return _0x15ac46[_0xa235('0x172')]&&_0x15ac46[_0xa235('0xb7')]===_0xa235('0xe7');});if(_0x36dbbc[_0xa235('0x9f')]>0x0&&_0x5a545b[_0xa235('0x9f')]>0x0){return BPromise['resolve']()[_0xa235('0x41')](cmHopper[_0xa235('0x173')](_[_0xa235('0x174')](_0x36dbbc,'id'),previewRecallmeReminderInterval,_['map'](_0x5a545b,'id')))['then'](function(_0x5d4a9f){for(var _0x2566b9=0x0;_0x2566b9<_0x5d4a9f['length'];_0x2566b9++){var _0x112f2f=_0x5d4a9f[_0x2566b9][_0xa235('0x175')][_0xa235('0x45')];if(_0x112f2f)io['to'](util[_0xa235('0x99')](_0xa235('0x176'),_0x112f2f))[_0xa235('0x52')](_0xa235('0x177'),{'hopper':_0x5d4a9f[_0x2566b9]});}})[_0xa235('0xb9')](function(_0x35803c){logger[_0xa235('0x9d')]('checkPreviewRecallReminder',_0x35803c);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype']['syncCampaigns']=function(){var _0x2de9dc=this;var _0x1d953c;for(var _0x23c4ff in this['campaigns']){if(typeof this[_0xa235('0x1f')][_0x23c4ff]!==_0xa235('0xa0')){_0x1d953c=this[_0xa235('0x1f')][_0x23c4ff];if(isCampaignIvr(_0x1d953c['type'])&&isActive(_0x1d953c[_0xa235('0x81')])){_0x1d953c[_0xa235('0xa8')]=!![];BPromise[_0xa235('0xbe')]()[_0xa235('0x41')](checkIsActive(_0x1d953c,_0x1d953c[_0xa235('0x81')]))['then'](checkInterval(_0x1d953c))['then'](_0x2de9dc[_0xa235('0x178')](_0x1d953c))[_0xa235('0x41')](_0x2de9dc[_0xa235('0x14e')](_0x1d953c[_0xa235('0x16d')],_0x1d953c[_0xa235('0x16e')],_0x1d953c[_0xa235('0x45')],_0x1d953c))[_0xa235('0x41')](_0x2de9dc['checkIfTimeIntervals'](_0x1d953c['Interval'],_0x1d953c[_0xa235('0x16e')],_0x1d953c[_0xa235('0x45')],_0x1d953c))[_0xa235('0x41')](_0x2de9dc[_0xa235('0x16b')](_0x1d953c))[_0xa235('0xb9')](loggerCatchQueueSummary(_0xa235('0x179'),_0x1d953c));}else{notSendMessagesCampaign(_0x1d953c);}}}};function getCallerIdRandom(_0x3b9fa6,_0x1575a7){var _0x1e8394;var _0x2f7e23;var _0x412e81;if(_0x1575a7<=0x0){_0x1575a7=0x1;}_0x1e8394=new RegExp(_0xa235('0x17a')+_0x1575a7+'}$');_0x2f7e23=Math[_0xa235('0x17b')](0xa,_0x1575a7-0x1);_0x412e81=Math[_0xa235('0x17b')](0xa,_0x1575a7)-0x1;return util[_0xa235('0x99')]('%s',_[_0xa235('0x17c')](_0x3b9fa6,_0x1e8394,_[_0xa235('0x17d')](_0x2f7e23,_0x412e81)));}function extractCalleridName(_0x74d9f5){var _0x3b7212=_0x74d9f5[_0xa235('0x17e')](/"(.*?)"/);return _0x3b7212?_0x3b7212[0x1]:_0x74d9f5;}function extractCalleridNumber(_0x302457){var _0x1676b3=_0x302457[_0xa235('0x17e')](/<(.*?)>/);return _0x1676b3?_0x1676b3[0x1]:_0x302457;}Dialer[_0xa235('0x1a')][_0xa235('0x17f')]=function(_0x235984,_0x3b7be4){var _0x42e074=this;var _0x31fb59=uuid['v4']();this['actions'][_0x31fb59]=new Action(_0x235984,_0x3b7be4,_0x31fb59);return new BPromise(function(_0xd63aca,_0x94b4b5){if(_[_0xa235('0x42')](_0x235984)&&typeof _0x235984!=='object'){return _0x94b4b5(msgResponse(_0xa235('0x180'),_0xa235('0x151'),_0xa235('0x181')));}if(_[_0xa235('0x42')](_0x3b7be4[_0xa235('0x182')])||_0x3b7be4[_0xa235('0x182')]===null){return _0x94b4b5(msgResponse(_0xa235('0x180'),_0xa235('0x151'),_0xa235('0x183')));}var _0x2d723c={'XMD-CALLERID':_0x42e074[_0xa235('0xb3')][_0x31fb59][_0xa235('0x184')](),'XMD-AGI':_0x235984['dialQueueProject']?util['format'](_0xa235('0x185'),ipAgi,_0x235984[_0xa235('0x113')]):'NONE','XMD-AGIAFTER':_0x235984[_0xa235('0x11d')]?util[_0xa235('0x99')](_0xa235('0x185'),ipAgi,_0x235984[_0xa235('0x11d')]):'NONE','XMD-QUEUE':_0x235984['type']===_0xa235('0x54')?util[_0xa235('0x99')]('\x22%s,%s%s,,,%s\x22',_0x235984[_0xa235('0x45')],_0x235984[_0xa235('0x186')]||'',_0x235984[_0xa235('0x187')]?'c':'',_0x235984[_0xa235('0x188')]||0x3):_0xa235('0x189'),'XMD-CONTACTID':_0x3b7be4[_0xa235('0xdf')],'XMD-CDRTYPE':_0xa235('0x8'),'CALLERID(all)':_0x42e074[_0xa235('0xb3')][_0x31fb59]['getCaller'](),'XMD-AMD':_0x235984[_0xa235('0xec')]?_0xa235('0x18a'):_0xa235('0x189'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x235984['dialAMDActive']){_0x2d723c[_0xa235('0x18b')]=_0x235984[_0xa235('0x18c')]||0x9c4;_0x2d723c[_0xa235('0x18d')]=_0x235984['dialAMDGreeting']||0x5dc;_0x2d723c[_0xa235('0x18e')]=_0x235984[_0xa235('0x18f')]||0x320;_0x2d723c[_0xa235('0x190')]=_0x235984[_0xa235('0x191')]||0x1388;_0x2d723c[_0xa235('0x192')]=_0x235984['dialAMDMinWordLength']||0x64;_0x2d723c[_0xa235('0x193')]=_0x235984[_0xa235('0x194')]||0x32;_0x2d723c[_0xa235('0x195')]=_0x235984[_0xa235('0x196')]||0x3;_0x2d723c[_0xa235('0x197')]=_0x235984[_0xa235('0x198')]||0x100;_0x2d723c[_0xa235('0x199')]=_0x235984['dialAMDMaximumWordLength']||0x1388;}if(_0x235984[_0xa235('0x53')]===_0xa235('0x54')){_0x2d723c[_0xa235('0x19a')]=_0x3b7be4[_0xa235('0x10a')];}else{_0x2d723c[_0xa235('0x19b')]=_0x3b7be4[_0xa235('0xe1')];}for(var _0x964147 in _0x3b7be4['Contact']){if(typeof _0x3b7be4[_0xa235('0x19c')][_0x964147]!=='undefined'){if(isNotNull(_0x3b7be4[_0xa235('0x19c')][_0x964147])&&_0x964147!=='id'&&_0x964147!==_0xa235('0x19d')&&_0x964147!=='createdAt'&&_0x964147!==_0xa235('0x19e')){_0x2d723c[util['format']('%s%s','XMD-',_['toUpper'](_0x964147))]=_0x3b7be4[_0xa235('0x19c')][_0x964147];}}}var _0x2b8422=_0x42e074[_0xa235('0xe5')](_0x235984['Trunk'])?getCallerId(_0x235984['Trunk'][_0xa235('0x82')],_0x235984[_0xa235('0x63')],_0x235984[_0xa235('0x19f')]>0x0?getCallerIdRandom(_0x235984[_0xa235('0x1a0')],_0x235984[_0xa235('0x19f')]):_0x235984[_0xa235('0x1a0')]):getCallerId(_[_0xa235('0xb6')](_0x235984[_0xa235('0x14b')])?_0x235984[_0xa235('0x80')][_0xa235('0x82')]:_0x235984[_0xa235('0x14b')]['callerid'],_0x235984[_0xa235('0x63')],_0x235984[_0xa235('0x19f')]>0x0?getCallerIdRandom(_0x235984[_0xa235('0x1a0')],_0x235984[_0xa235('0x19f')]):_0x235984[_0xa235('0x1a0')]);if(_0x2b8422){_0x2d723c['XMD-ORIGINATECALLERIDNAME']=_0x42e074[_0xa235('0xb3')][_0x31fb59][_0xa235('0x1a1')]=extractCalleridName(_0x2b8422);_0x2d723c['XMD-ORIGINATECALLERIDNUM']=_0x3b7be4[_0xa235('0x182')];}return ami[_0xa235('0x158')]({'actionid':_0x31fb59,'action':_0xa235('0x180'),'channel':_0x42e074[_0xa235('0xe5')](_0x235984[_0xa235('0x80')])?util['format'](_0xa235('0x1a2'),_0x235984[_0xa235('0x80')][_0xa235('0x45')],isNotNull(_0x235984[_0xa235('0x65')])?_0x235984['dialPrefix'][_0xa235('0x1a3')]()||'':'',_0x235984['dialCutDigit']>0x0?_0x3b7be4[_0xa235('0x182')]['substring'](_0x235984['dialCutDigit']):_0x3b7be4['phone']):util[_0xa235('0x99')](_0xa235('0x1a2'),_[_0xa235('0xb6')](_0x235984[_0xa235('0x14b')])?_0x235984['Trunk'][_0xa235('0x45')]:_0x235984['TrunkBackup'][_0xa235('0x45')],isNotNull(_0x235984[_0xa235('0x65')])?_0x235984['dialPrefix'][_0xa235('0x1a3')]()||'':'',_0x235984[_0xa235('0x1a4')]>0x0?_0x3b7be4[_0xa235('0x182')][_0xa235('0x1a5')](_0x235984['dialCutDigit']):_0x3b7be4[_0xa235('0x182')]),'callerid':_0x2b8422,'Exten':'xcally-motion-dialer','Context':_0xa235('0x1a6'),'Priority':'1','variable':_0x2d723c,'timeout':(_0x235984[_0xa235('0x64')]||0x1e)*0x3e8,'async':!![],'channelid':_0x31fb59})['then'](function(_0x5e8dac){return _0xd63aca(_0x5e8dac);})[_0xa235('0xb9')](function(_0x587a6b){_0x235984[_0xa235('0x6f')]+=0x1;var _0x33b31e=new History(_0x42e074['actions'][_0x31fb59]);logger[_0xa235('0x9d')](util[_0xa235('0x99')]('[originateError]:\x20%s',JSON[_0xa235('0x4e')](_0x587a6b)));_0x33b31e['state']=0xe;_0x33b31e[_0xa235('0xae')]=_0xa235('0x1a7');_0x33b31e['starttime']=moment()[_0xa235('0x99')](_0xa235('0x109'));_0x33b31e[_0xa235('0xaf')]=_0x33b31e[_0xa235('0xb0')];_0x42e074[_0xa235('0xd8')](_0x33b31e)['catch'](loggerCatch('[originate][error]'));_0x42e074[_0xa235('0xd6')](_0x33b31e)[_0xa235('0xb9')](loggerCatch(_0xa235('0x1a8')))[_0xa235('0x1c')](function(){delete _0x42e074['actions'][_0x31fb59];return _0x94b4b5(msgResponse(_0xa235('0x180'),_0xa235('0x4d'),'originate\x20action\x20Error'));});});});};Dialer[_0xa235('0x1a')]['syncOriginateResponse']=function(_0x579767){var _0x286593=this[_0xa235('0xb3')][_0x579767[_0xa235('0x133')]];if(_0x286593){delete this[_0xa235('0xb3')][_0x579767[_0xa235('0x133')]];_0x286593[_0xa235('0x1a9')]=moment()['format'](_0xa235('0x109'));var _0x25f1ff=_0x286593[_0xa235('0x53')]===_0xa235('0x85')?this[_0xa235('0x1f')][_0x286593[_0xa235('0xbc')]]:this[_0xa235('0x1e')][_0x286593[_0xa235('0x1aa')]()];if(!this[_0xa235('0xe3')](_0x579767[_0xa235('0x1ab')])){this[_0xa235('0xbb')](_0x25f1ff);return this[_0xa235('0x1ac')](_0x286593,_0x25f1ff,_0x579767)[_0xa235('0xb9')](loggerCatch(_0xa235('0x1ad')));}this[_0xa235('0x24')][_0x579767[_0xa235('0xee')]]=_0x286593;}};Dialer[_0xa235('0x1a')][_0xa235('0x1ae')]=function(_0x14e58c,_0x124225,_0x24c9ad){var _0x438a5d=new History(_0x124225);if(_0x438a5d[_0xa235('0xfc')]+_0x438a5d[_0xa235('0xfd')]+_0x438a5d[_0xa235('0xfe')]+_0x438a5d[_0xa235('0xff')]+_0x438a5d[_0xa235('0x10e')]+_0x438a5d['countabandonedretry']+_0x438a5d[_0xa235('0xf7')]+_0x438a5d[_0xa235('0x101')]>=_0x24c9ad[_0xa235('0x102')]-0x1){return!![];}switch(_0x14e58c){case 0x3:if(_0x438a5d[_0xa235('0xfe')]>=_0x24c9ad['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0xa235('0xcb')]({'active':![],'countnoanswerretry':_0x438a5d[_0xa235('0xfe')]+=0x1,'scheduledat':moment()[_0xa235('0x106')](_0x24c9ad[_0xa235('0x1af')],_0xa235('0x108'))[_0xa235('0x99')](_0xa235('0x109')),'ContactId':_0x438a5d[_0xa235('0xdf')],'ListId':_0x438a5d[_0xa235('0xe0')],'VoiceQueueId':_0x438a5d['VoiceQueueId']||undefined,'CampaignId':_0x438a5d[_0xa235('0xe1')]||undefined})[_0xa235('0xb9')](loggerCatch(_0xa235('0x1b0')));break;case 0x5:if(_0x438a5d[_0xa235('0xfc')]>=_0x24c9ad[_0xa235('0x1b1')]-0x1){return!![];}this[_0xa235('0xcb')]({'active':![],'countbusyretry':_0x438a5d[_0xa235('0xfc')]+=0x1,'scheduledat':moment()[_0xa235('0x106')](_0x24c9ad[_0xa235('0x1b2')],'minutes')['format'](_0xa235('0x109')),'ContactId':_0x438a5d['ContactId'],'ListId':_0x438a5d[_0xa235('0xe0')],'VoiceQueueId':_0x438a5d['VoiceQueueId']||undefined,'CampaignId':_0x438a5d[_0xa235('0xe1')]||undefined})[_0xa235('0xb9')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x438a5d[_0xa235('0xfd')]>=_0x24c9ad[_0xa235('0x1b3')]-0x1){return!![];}this[_0xa235('0xcb')]({'active':![],'countcongestionretry':_0x438a5d['countcongestionretry']+=0x1,'scheduledat':moment()[_0xa235('0x106')](_0x24c9ad[_0xa235('0x1b4')],'minutes')[_0xa235('0x99')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x438a5d[_0xa235('0xdf')],'ListId':_0x438a5d['ListId'],'VoiceQueueId':_0x438a5d[_0xa235('0x10a')]||undefined,'CampaignId':_0x438a5d['CampaignId']||undefined})[_0xa235('0xb9')](loggerCatch(_0xa235('0x1b5')));break;case 0x0:if(_0x438a5d['countnosuchnumberretry']>=_0x24c9ad[_0xa235('0x1b6')]-0x1){return!![];}else{this[_0xa235('0xcb')]({'active':![],'countnosuchnumberretry':_0x438a5d[_0xa235('0xff')]+=0x1,'scheduledat':moment()[_0xa235('0x106')](_0x24c9ad[_0xa235('0x1b7')],_0xa235('0x108'))[_0xa235('0x99')](_0xa235('0x109')),'ContactId':_0x438a5d[_0xa235('0xdf')],'ListId':_0x438a5d[_0xa235('0xe0')],'VoiceQueueId':_0x438a5d['VoiceQueueId']||undefined,'CampaignId':_0x438a5d[_0xa235('0xe1')]||undefined})[_0xa235('0xb9')](loggerCatch(_0xa235('0x1b8')));}break;case 0xa:if(_0x438a5d[_0xa235('0x10e')]>=_0x24c9ad[_0xa235('0x129')]-0x1){return!![];}this[_0xa235('0xcb')]({'active':![],'countdropretry':_0x438a5d[_0xa235('0x10e')]+=0x1,'scheduledat':moment()[_0xa235('0x106')](_0x24c9ad[_0xa235('0x125')],_0xa235('0x108'))['format'](_0xa235('0x109')),'ContactId':_0x438a5d[_0xa235('0xdf')],'ListId':_0x438a5d[_0xa235('0xe0')],'VoiceQueueId':_0x438a5d['VoiceQueueId']||undefined,'CampaignId':_0x438a5d[_0xa235('0xe1')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x438a5d[_0xa235('0x100')]>=_0x24c9ad['dialAbandonedMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x438a5d[_0xa235('0x100')]+=0x1,'scheduledat':moment()[_0xa235('0x106')](_0x24c9ad[_0xa235('0x12f')],_0xa235('0x108'))[_0xa235('0x99')](_0xa235('0x109')),'ContactId':_0x438a5d[_0xa235('0xdf')],'ListId':_0x438a5d['ListId'],'VoiceQueueId':_0x438a5d[_0xa235('0x10a')]||undefined,'CampaignId':_0x438a5d[_0xa235('0xe1')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x438a5d['countmachineretry']>=_0x24c9ad[_0xa235('0x103')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x438a5d[_0xa235('0xf7')]+=0x1,'scheduledat':moment()[_0xa235('0x106')](_0x24c9ad['dialMachineRetryFrequency'],'minutes')[_0xa235('0x99')](_0xa235('0x109')),'ContactId':_0x438a5d[_0xa235('0xdf')],'ListId':_0x438a5d[_0xa235('0xe0')],'VoiceQueueId':_0x438a5d[_0xa235('0x10a')]||undefined,'CampaignId':_0x438a5d[_0xa235('0xe1')]||undefined})['catch'](loggerCatch(_0xa235('0x111')));break;case 0x14:if(_0x438a5d[_0xa235('0x101')]>=_0x24c9ad[_0xa235('0x1b9')]-0x1){return!![];}this[_0xa235('0xcb')]({'active':![],'countagentrejectretry':_0x438a5d[_0xa235('0x101')]+=0x1,'scheduledat':moment()['add'](_0x24c9ad[_0xa235('0x1ba')],'minutes')[_0xa235('0x99')](_0xa235('0x109')),'ContactId':_0x438a5d[_0xa235('0xdf')],'ListId':_0x438a5d[_0xa235('0xe0')],'VoiceQueueId':_0x438a5d[_0xa235('0x10a')]||undefined,'CampaignId':_0x438a5d['CampaignId']||undefined})[_0xa235('0xb9')](loggerCatch(_0xa235('0x1bb')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x4bdfb8,_0x23fd21,_0x4c7bbf){var _0x5eff10=this;var _0x3f05b6=new History(_0x4bdfb8);var _0x5a7fb=![];var _0x2f96cf;var _0x3f2fa4;return new BPromise(function(_0x5df4e9,_0x50ca6d){if(_[_0xa235('0x42')](_0x23fd21)&&typeof _0x23fd21!==_0xa235('0x1bc')){return _0x50ca6d(msgResponse(_0xa235('0x1bd'),_0xa235('0x151'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x4c7bbf)&&typeof _0x4c7bbf!==_0xa235('0x1bc')){return _0x50ca6d(msgResponse(_0xa235('0x1bd'),_0xa235('0x151'),_0xa235('0x1be')));}_0x5eff10[_0xa235('0xc2')](_0x3f05b6,_0x4c7bbf['reason'],_0x23fd21)['then'](function(_0x3785d2){if(_0x3785d2['additional']==0x1)_0x5a7fb=!![];switch(_0x4c7bbf[_0xa235('0x11a')]){case'0':_0x23fd21['outboundNoSuchCallsDay']+=0x1;_0x3f05b6[_0xa235('0x10c')]=0x0;_0x3f05b6[_0xa235('0xae')]=_0xa235('0x1bf');_0x3f05b6[_0xa235('0xff')]+=0x1;_0x3f05b6[_0xa235('0xf8')]+=0x1;ami[_0xa235('0x52')]('custom:agentnosuchnumber',ut[_0xa235('0xf2')](_0x4bdfb8,'nosuchnumber'));_0x2f96cf=_0x23fd21[_0xa235('0x1b7')];_0x3f2fa4=_0x23fd21[_0xa235('0x126')];_0x5eff10['createHistory'](_0x3f05b6)[_0xa235('0xb9')](loggerCatch(_0xa235('0xfb')));if(_0x5eff10['checkRetriveMax'](0x0,_0x4bdfb8,_0x23fd21)&&!_0x5a7fb){if(_0x3f05b6[_0xa235('0xff')]>=_0x23fd21[_0xa235('0x1b6')]){_0x5eff10['createStateFinal'](_0x3f05b6,_0x5df4e9,_0x50ca6d,_0xa235('0x1c0'));}else{_0x5eff10['stateGlobal'](_0x3f05b6,_0x5df4e9,_0x50ca6d,_0xa235('0x1c0'));}}break;case'3':_0x23fd21[_0xa235('0x6d')]+=0x1;_0x3f05b6[_0xa235('0x10c')]=0x3;_0x3f05b6[_0xa235('0xae')]=_0xa235('0x1c1');_0x3f05b6[_0xa235('0xfe')]+=0x1;_0x3f05b6[_0xa235('0xf8')]+=0x1;ami['emit'](_0xa235('0x1c2'),ut['buildObj'](_0x4bdfb8,'noanswer'));_0x2f96cf=_0x23fd21['dialNoAnswerRetryFrequency'];_0x3f2fa4=_0x23fd21[_0xa235('0x126')];_0x5eff10[_0xa235('0xd8')](_0x3f05b6)['catch'](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x5eff10[_0xa235('0x1ae')](0x3,_0x4bdfb8,_0x23fd21)&&!_0x5a7fb){if(_0x3f05b6['countnoanswerretry']>=_0x23fd21[_0xa235('0x1c3')]){_0x5eff10[_0xa235('0x104')](_0x3f05b6,_0x5df4e9,_0x50ca6d,_0xa235('0x1c4'));}else{_0x5eff10['stateGlobal'](_0x3f05b6,_0x5df4e9,_0x50ca6d,_0xa235('0x1c4'));}}break;case'5':_0x23fd21[_0xa235('0x1c5')]+=0x1;_0x3f05b6['state']=0x5;_0x3f05b6['statedesc']=_0xa235('0x1c6');_0x3f05b6[_0xa235('0xfc')]+=0x1;_0x3f05b6[_0xa235('0xf8')]+=0x1;ami['emit'](_0xa235('0x1c7'),ut['buildObj'](_0x4bdfb8,_0xa235('0x1c8')));_0x2f96cf=_0x23fd21[_0xa235('0x1b2')];_0x3f2fa4=_0x23fd21[_0xa235('0x126')];_0x5eff10[_0xa235('0xd8')](_0x3f05b6)[_0xa235('0xb9')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x5eff10[_0xa235('0x1ae')](0x5,_0x4bdfb8,_0x23fd21)&&!_0x5a7fb){if(_0x3f05b6[_0xa235('0xfc')]>=_0x23fd21['dialBusyMaxRetry']){_0x5eff10[_0xa235('0x104')](_0x3f05b6,_0x5df4e9,_0x50ca6d,_0xa235('0x1c9'));}else{_0x5eff10[_0xa235('0x10f')](_0x3f05b6,_0x5df4e9,_0x50ca6d,_0xa235('0x1c9'));}}break;case'8':_0x23fd21[_0xa235('0x69')]+=0x1;_0x3f05b6['state']=0x8;_0x3f05b6[_0xa235('0xae')]=_0xa235('0x1ca');_0x3f05b6[_0xa235('0xfd')]+=0x1;_0x3f05b6[_0xa235('0xf8')]+=0x1;_0x2f96cf=_0x23fd21[_0xa235('0x1b4')];_0x3f2fa4=_0x23fd21[_0xa235('0x126')];ami[_0xa235('0x52')]('custom:agentcongestion',ut[_0xa235('0xf2')](_0x4bdfb8,_0xa235('0x1cb')));_0x5eff10['createHistory'](_0x3f05b6)[_0xa235('0xb9')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x5eff10[_0xa235('0x1ae')](0x8,_0x4bdfb8,_0x23fd21)&&!_0x5a7fb){if(_0x3f05b6['countcongestionretry']>=_0x23fd21[_0xa235('0x1b3')]){_0x5eff10[_0xa235('0x104')](_0x3f05b6,_0x5df4e9,_0x50ca6d,_0xa235('0x1cc'));}else{_0x5eff10[_0xa235('0x10f')](_0x3f05b6,_0x5df4e9,_0x50ca6d,_0xa235('0x1cc'));}}break;case'11':_0x23fd21['outboundAbandonedCallsDay']+=0x1;_0x3f05b6[_0xa235('0x10c')]=0xb;_0x3f05b6[_0xa235('0xae')]=_0xa235('0x12d');_0x3f05b6[_0xa235('0x100')]+=0x1;_0x3f05b6['countglobal']+=0x1;_0x2f96cf=_0x23fd21[_0xa235('0x12f')];_0x3f2fa4=_0x23fd21['callAdditionalPhoneAfterMin'];_0x5eff10[_0xa235('0xd8')](_0x3f05b6)[_0xa235('0xb9')](loggerCatch(_0xa235('0x132')));if(_0x5eff10['checkRetriveMax'](0xb,_0x4bdfb8,_0x23fd21)&&!_0x5a7fb){if(_0x3f05b6['countabandonedretry']>=_0x23fd21[_0xa235('0x130')]){_0x5eff10[_0xa235('0x104')](_0x3f05b6,_0x5df4e9,_0x50ca6d,_0xa235('0x1cd'));}else{_0x5eff10['stateGlobal'](_0x3f05b6,_0x5df4e9,_0x50ca6d,'reason\x2011\x20abandoned');}}break;case'20':_0x23fd21[_0xa235('0x1ce')]+=0x1;_0x3f05b6['state']=0x14;_0x3f05b6[_0xa235('0xae')]='AgentReject';_0x3f05b6[_0xa235('0x101')]+=0x1;_0x3f05b6[_0xa235('0xf8')]+=0x1;_0x2f96cf=_0x23fd21[_0xa235('0x1ba')];_0x3f2fa4=_0x23fd21['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentreject',ut[_0xa235('0xf2')](_0x4bdfb8,_0xa235('0x1cf')));_0x5eff10[_0xa235('0xd8')](_0x3f05b6)['catch'](loggerCatch(_0xa235('0x1d0')));if(_0x5eff10[_0xa235('0x1ae')](0x14,_0x4bdfb8,_0x23fd21)&&!_0x5a7fb){if(_0x3f05b6['countagentrejectretry']>=_0x23fd21[_0xa235('0x1b9')]){_0x5eff10[_0xa235('0x104')](_0x3f05b6,_0x5df4e9,_0x50ca6d,'reason\x2020\x20agentreject');}else{_0x5eff10['stateGlobal'](_0x3f05b6,_0x5df4e9,_0x50ca6d,_0xa235('0x1d1'));}}break;default:_0x23fd21['outboundUnknownCallsDay']+=0x1;_0x3f05b6[_0xa235('0x10c')]=0xc;_0x3f05b6[_0xa235('0xae')]=_0x4c7bbf[_0xa235('0x11a')];_0x2f96cf=_0x23fd21['dialAgentRejectRetryFrequency'];_0x3f2fa4=_0x23fd21['callAdditionalPhoneAfterMin'];_0x5eff10[_0xa235('0xd8')](_0x3f05b6)[_0xa235('0xb9')](loggerCatch(_0xa235('0x1d2')));if(_0x5eff10[_0xa235('0x1ae')](_0x4c7bbf['reason'],_0x4bdfb8,_0x23fd21)&&!_0x5a7fb){if(_0x3f05b6['countbusyretry']+_0x3f05b6[_0xa235('0xfd')]+_0x3f05b6[_0xa235('0xfe')]+_0x3f05b6['countnosuchnumberretry']+_0x3f05b6[_0xa235('0x10e')]+_0x3f05b6[_0xa235('0x100')]+_0x3f05b6[_0xa235('0xf7')]+_0x3f05b6['countagentrejectretry']>=_0x23fd21['dialGlobalMaxRetry']){_0x5eff10[_0xa235('0x10f')](_0x3f05b6,_0x5df4e9,_0x50ca6d,_0x4c7bbf['reason']);}else{_0x5eff10[_0xa235('0x104')](_0x3f05b6,_0x5df4e9,_0x50ca6d,_0x4c7bbf['reason']);}}}})['then'](function(_0x5548f6){if(_0x5a7fb){_0x5eff10[_0xa235('0xc4')](_0x3f05b6,_0x2f96cf,_0x3f2fa4)[_0xa235('0x41')](function(_0x35302a){return _0x5df4e9(0x1);});}});});};Dialer[_0xa235('0x1a')][_0xa235('0x10f')]=function(_0x82f2cd,_0x226a7b,_0xb1baa8,_0x1e2b66){var _0x58df04=new Final(_0x82f2cd);_0x58df04[_0xa235('0x10c')]=0xf;_0x58df04[_0xa235('0xae')]=_0xa235('0x1d3');this[_0xa235('0x104')](_0x58df04,_0x226a7b,_0xb1baa8,_0x1e2b66);};Dialer[_0xa235('0x1a')][_0xa235('0x104')]=function(_0x3e4333,_0x116397,_0x61d650,_0x567be3){this['moveContactManagedDialer'](_0x3e4333)[_0xa235('0x41')](function(){return _0x116397(msgResponse(_0xa235('0x1bd'),_0xa235('0xe4'),_0x567be3));})[_0xa235('0xb9')](function(){return _0x61d650(msgResponse(_0xa235('0x1d4'),_0xa235('0x151'),'contact\x20not\x20moved'));});};Dialer[_0xa235('0x1a')][_0xa235('0x168')]=function(_0x377401){var _0x11a61c=_0x377401[_0xa235('0x1d5')]/0x64;var _0x130a6d=_0x377401[_0xa235('0x6c')]/(_0x377401[_0xa235('0x6c')]+_0x377401[_0xa235('0x67')]);var _0x16d5e0=Math['round'](_0x377401[_0xa235('0x7b')]*(_0x377401[_0xa235('0x1d6')]/0x64));var _0x3c91fa=Math['round'](_0x377401[_0xa235('0x7b')]*(_0x377401[_0xa235('0x1d7')]/0x64));var _0xa9b431=_0x377401[_0xa235('0x57')]+_0x377401['talking'];var _0x803243=Math[_0xa235('0x1d8')](_0x377401[_0xa235('0x1d9')]*_0x377401[_0xa235('0x7f')]*_0x377401[_0xa235('0x79')]*_0x377401[_0xa235('0x1da')]);if(_['isUndefined'](_0x377401[_0xa235('0x27')])){if(!_[_0xa235('0x42')](_0x377401[_0xa235('0x26')])){_0x377401[_0xa235('0x26')]=undefined;loggerPredictive['error'](_0xa235('0x1db'),_0xa235('0x1dc'));}if(!_[_0xa235('0x42')](_0x377401[_0xa235('0x96')])){loggerPredictive[_0xa235('0x9d')]('[startMethodPredictive][StartProgressive]',_0xa235('0x1dd'));clearInterval(_0x377401['handlePredictive']);_0x377401[_0xa235('0x96')]=undefined;}_0x377401[_0xa235('0x27')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x377401[_0xa235('0x45')],_0xa235('0x1de'),_0x377401[_0xa235('0x27')]);this['handlePower'](_0x377401,0x1);}else if(ifInterval(_0x377401[_0xa235('0x1df')],_0x377401['startProgressive'])){this[_0xa235('0x165')](_0x377401,0x1);loggerPredictiveCalls[_0xa235('0x88')](_0xa235('0x1e0'),_0x377401[_0xa235('0x27')],_0x377401[_0xa235('0x45')]);_0x377401[_0xa235('0x1d9')]=0x0;_0x377401[_0xa235('0x78')]=0x0;}else if(_0x11a61c<_0x130a6d&&_0x377401[_0xa235('0x1e1')]===_0xa235('0x1e2')){freeVariablesPredictive(_0x377401);loggerPredictive[_0xa235('0x88')](_0xa235('0x1e3'),_0xa235('0x1e4'),_0x130a6d,_0xa235('0x27'),_0x377401['name']);}else if(_0x803243<_0x377401[_0xa235('0x78')]&&_0x377401[_0xa235('0x1e1')]===_0xa235('0x1e2')){freeVariablesPredictive(_0x377401);loggerPredictive['info'](_0xa235('0x1e5'),'Max\x20Drop\x20',_0x803243,'Drop\x20in\x20this\x20interval',_0x377401[_0xa235('0x78')],_0xa235('0x27'),_0x377401[_0xa235('0x45')]);}else if(!ifInterval(_0x377401['dialPredictiveInterval'],_0x377401['startProgressive'])&&_[_0xa235('0x42')](_0x377401[_0xa235('0x26')])&&!_['isUndefined'](_0x377401[_0xa235('0x27')])){_0x377401[_0xa235('0x26')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xa235('0x88')](_0x377401['name'],_0xa235('0x1e6'),_0x377401[_0xa235('0x26')]);this[_0xa235('0xc8')](_0x377401[_0xa235('0x1df')])[_0xa235('0x41')](this['getDataPredictive'](_0x377401))[_0xa235('0x41')](mergeDataErlangB(_0x377401))[_0xa235('0x41')](this[_0xa235('0x1e7')](_0x377401))[_0xa235('0xb9')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x377401));}else if(!ifInterval(_0x377401[_0xa235('0x1df')],_0x377401[_0xa235('0x26')])){_0x377401[_0xa235('0x78')]=0x0;_0x377401[_0xa235('0x26')]=moment()[_0xa235('0x99')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xa235('0x88')](_0x377401[_0xa235('0x45')],_0xa235('0x1e8'),_0x377401[_0xa235('0x26')]);clearInterval(_0x377401[_0xa235('0x96')]);_0x377401['handlePredictive']=undefined;this['averageHandleTime'](_0x377401[_0xa235('0x1df')])['then'](this['getDataPredictive'](_0x377401))[_0xa235('0x41')](mergeDataErlangB(_0x377401))[_0xa235('0x41')](this[_0xa235('0x1e7')](_0x377401))[_0xa235('0xb9')](loggerCatchPredictive(_0xa235('0x1e9'),_0x377401));}else if(_0x377401['predictiveIntervalAvailable']&&_0xa9b431<_0x377401[_0xa235('0x7b')]-_0x3c91fa){freeVariablesPredictive(_0x377401);loggerPredictive[_0xa235('0x88')](_0x377401['name'],_0xa235('0x1ea'),_0xa9b431,_0xa235('0x1eb'),_0x377401['predictiveIntervalAvailable'],'-',_0x3c91fa,'=',_0x377401[_0xa235('0x7b')]-_0x3c91fa,')');}else if(_0x377401[_0xa235('0x7b')]&&_0xa9b431>_0x377401[_0xa235('0x7b')]+_0x16d5e0){freeVariablesPredictive(_0x377401);loggerPredictive['info'](_0x377401[_0xa235('0x45')],_0xa235('0x1ea'),_0xa9b431,')\x20are\x20more\x20than\x20threshold\x20(',_0x377401[_0xa235('0x7b')],'+',_0x16d5e0,'=',_0x377401[_0xa235('0x7b')]+_0x16d5e0,')');}};Dialer[_0xa235('0x1a')][_0xa235('0x1ec')]=function(_0x576aee){var _0x25e303=this;return function(_0x403207){return new BPromise(function(_0x50ad77,_0x55a019){_[_0xa235('0x93')](_0x576aee,_0x403207[0x0]);if(checkGetDataPredictive(_0x403207[0x0])){var _0x442777=_0x576aee[_0xa235('0x7b')]=_0x576aee[_0xa235('0x5c')]+_0x576aee[_0xa235('0x57')];var _0x26be28=_0x576aee[_0xa235('0x1df')]*0x3c;var _0xcf6507=_0x403207[0x0]['predictiveIntervalAvgTalktime']+_0x403207[0x0]['predictiveIntervalAvgHoldtime'];var _0x1a5e8e=(_0x403207[0x0][_0xa235('0x72')]+_0x403207[0x0][_0xa235('0x76')]+_0x403207[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x403207[0x0][_0xa235('0x7c')];_0x576aee[_0xa235('0x79')]=_0x1a5e8e>0x0?_0x1a5e8e:0x1;switch(_0x576aee['dialPredictiveOptimization']){case'dropRate':var _0x1ec8e6=_0x576aee['dialPredictiveOptimizationPercentage']/0x64;return _0x25e303[_0xa235('0x1ed')](_0x442777,_0x26be28,_0xcf6507,_0x1a5e8e,_0x1ec8e6)[_0xa235('0x41')](function(_0x167ffb){return _0x50ad77(_0x167ffb);});case'agentBusyFactor':var _0x4f2aa1=_0x576aee[_0xa235('0x1d5')]/0x64;return _0x25e303[_0xa235('0x1ee')](_0x442777,_0x26be28,_0xcf6507,_0x1a5e8e,_0x4f2aa1)[_0xa235('0x41')](function(_0xbca17c){return _0x50ad77(_0xbca17c);});default:return _0x55a019(msgResponse('[getDataPredictive]','Failure','Unknown\x20Predictive'));}}else{return _0x55a019(msgResponse(_0xa235('0x1ef'),'Failure',_0xa235('0x1f0')));}});};};Dialer[_0xa235('0x1a')][_0xa235('0x1f1')]=function(_0x1b31ff){var _0x5e6c72=this;return function(_0x52a628){return new BPromise(function(_0x25de88,_0x484331){_['merge'](_0x1b31ff,_0x52a628[0x0]);if(checkGetDataPredictive(_0x52a628[0x0])){loggerPredictive['info'](JSON[_0xa235('0x4e')](_0x52a628[0x0]));if(_0x1b31ff['dialPredictiveOptimization']===_0xa235('0x1e2')){return _0x5e6c72[_0xa235('0xd4')](_0x1b31ff['id'])[_0xa235('0x41')](function(_0x1a9010){var _0x47a3f6=_0x1b31ff[_0xa235('0x58')]-_0x1a9010[0x0][_0xa235('0x1f2')];var _0x18912e=_0x1b31ff[_0xa235('0x1df')]*0x3c;var _0x30ea6c=_0x52a628[0x0][_0xa235('0x74')]+_0x52a628[0x0][_0xa235('0x73')];var _0x3529f0=(_0x52a628[0x0][_0xa235('0x72')]+_0x52a628[0x0][_0xa235('0x76')]+_0x52a628[0x0][_0xa235('0x75')])/_0x52a628[0x0]['predictiveIntervalTotalCalls'];var _0x2f184d=_0x1b31ff[_0xa235('0x1d5')]/0x64;_0x1b31ff[_0xa235('0x7a')]=_0x1a9010[0x0]['outboundQueuePauses']||0x0;_0x1b31ff[_0xa235('0x79')]=_0x3529f0>0x0?_0x3529f0:0x1;return _0x5e6c72['abandonmentRate'](_0x47a3f6,_0x18912e,_0x30ea6c,_0x3529f0,_0x2f184d);})[_0xa235('0x41')](function(_0x554836){return _0x25de88(_0x554836);})['catch'](function(_0x3377ba){return _0x484331(msgResponse(_0xa235('0x1f3'),_0xa235('0x151'),JSON[_0xa235('0x4e')](_0x3377ba)));});}if(_0x1b31ff[_0xa235('0x1e1')]==='agentBusyFactor'){return _0x5e6c72[_0xa235('0xd4')](_0x1b31ff['id'])[_0xa235('0x41')](function(_0x1e433e){var _0x5d4e47=_0x1b31ff[_0xa235('0x58')]-_0x1e433e[0x0][_0xa235('0x1f2')];var _0x256717=_0x1b31ff[_0xa235('0x1df')]*0x3c;var _0x3432fc=_0x52a628[0x0][_0xa235('0x74')]+_0x52a628[0x0][_0xa235('0x73')];var _0x2f4804=(_0x52a628[0x0][_0xa235('0x72')]+_0x52a628[0x0][_0xa235('0x76')]+_0x52a628[0x0][_0xa235('0x75')])/_0x52a628[0x0][_0xa235('0x7c')];var _0x499d8f=_0x1b31ff[_0xa235('0x1d5')]/0x64;_0x1b31ff[_0xa235('0x7a')]=_0x1e433e[0x0]['outboundQueuePauses']||0x0;_0x1b31ff[_0xa235('0x79')]=_0x2f4804>0x0?_0x2f4804:0x1;return _0x5e6c72[_0xa235('0x1ee')](_0x5d4e47,_0x256717,_0x3432fc,_0x2f4804,_0x499d8f);})[_0xa235('0x41')](function(_0x1f6987){return _0x25de88(_0x1f6987);})['catch'](function(_0x34c8c2){return _0x484331(msgResponse('[CatchErlangB]',_0xa235('0x151'),JSON[_0xa235('0x4e')](_0x34c8c2)));});}}else{return _0x484331(msgResponse(_0xa235('0x1ef'),_0xa235('0x151'),'check\x20failure'));}});};};Dialer[_0xa235('0x1a')]['startMethodPredictive']=function(_0x4c6320){var _0x3a760e=this;return function(){var _0x45d721=0x0;var _0x64af2a=Math[_0xa235('0x1d8')](_0x4c6320[_0xa235('0x7e')]*0x3e8);if(_0x64af2a>0x0){_0x64af2a=_0x64af2a<0x64?0x64:_0x64af2a;loggerPredictive[_0xa235('0x88')](_0x4c6320[_0xa235('0x45')],_0xa235('0x1f4'),_0x64af2a,'milliseconds');_0x4c6320['handlePredictive']=setInterval(function(){_0x3a760e[_0xa235('0x96')](_0x4c6320);loggerPredictiveCalls['info']('[handlePredictive]',_0x45d721+=0x1);},_0x64af2a);}else{loggerPredictive[_0xa235('0x88')](_0x4c6320[_0xa235('0x45')],_0xa235('0x1f5'));}};};Dialer['prototype'][_0xa235('0x1f6')]=function(_0x52751a,_0x56f21f){var _0x3c6729=this;return function(_0x205fff){if(_[_0xa235('0x98')](_0x205fff)){if(_[_0xa235('0xb6')](_0x56f21f['UserId'])||!_0x56f21f['recallme']){if(_0x52751a[_0xa235('0x62')]==='booked'){_0x52751a[_0xa235('0x139')]=_[_0xa235('0x42')](_0x52751a[_0xa235('0x139')])?!![]:_0x52751a['queueStatusComplete'];var _0x3eec86=uuid['v4']();_0x3c6729['actions'][_0x3eec86]=new Action(_0x52751a,_0x56f21f,_0x3eec86);loggerBooked[_0xa235('0x88')]('[booked][checkContactBlack]',_0x3eec86,'queueStatusComplete:\x20',JSON[_0xa235('0x4e')](_0x52751a[_0xa235('0x139')]),'Queue:\x20',_0x52751a[_0xa235('0x45')]);if(_0x52751a[_0xa235('0x139')]){_0x52751a[_0xa235('0x139')]=![];_0x3c6729[_0xa235('0x29')][_0x3c6729['actions'][_0x3eec86]['queue']]=[];ami[_0xa235('0x158')]({'actionid':_0x3eec86,'action':_0xa235('0x1f7'),'queue':_0x52751a[_0xa235('0x45')]})[_0xa235('0xb9')](function(){_0x3c6729[_0xa235('0xbb')](_0x52751a);_0x3c6729['rescheduleContact']({'active':![],'ContactId':_0x3c6729[_0xa235('0xb3')][_0x3eec86]['ContactId'],'ListId':_0x3c6729[_0xa235('0xb3')][_0x3eec86]['ListId'],'VoiceQueueId':_0x3c6729[_0xa235('0xb3')][_0x3eec86][_0xa235('0x10a')]||undefined,'CampaignId':_0x3c6729[_0xa235('0xb3')][_0x3eec86][_0xa235('0xe1')]||undefined})[_0xa235('0xb9')](loggerCatch(_0xa235('0x1f8')));delete _0x3c6729[_0xa235('0xb3')][_0x3eec86];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0xa235('0x4e')](_0x52751a[_0xa235('0x139')]),'Queue:\x20',_0x52751a['name']);_0x3c6729[_0xa235('0xbb')](_0x52751a);_0x3c6729[_0xa235('0xcb')]({'active':![],'ContactId':_0x3c6729[_0xa235('0xb3')][_0x3eec86]['ContactId'],'ListId':_0x3c6729[_0xa235('0xb3')][_0x3eec86]['ListId'],'VoiceQueueId':_0x3c6729[_0xa235('0xb3')][_0x3eec86][_0xa235('0x10a')]||undefined,'CampaignId':_0x3c6729['actions'][_0x3eec86]['CampaignId']||undefined})['catch'](loggerCatch(_0xa235('0x1f8')));delete _0x3c6729['actions'][_0x3eec86];}}else{return _0x3c6729[_0xa235('0x17f')](_0x52751a,_0x56f21f);}}else{if(getDiff(_0x56f21f[_0xa235('0x1f9')])<_0x52751a['dialRecallMeTimeout']*0x3c){if(_0x56f21f[_0xa235('0x175')]&&!_0x56f21f[_0xa235('0x175')][_0xa235('0x1fa')]){_0x3c6729[_0xa235('0x1d')][_0xa235('0x142')](_0x56f21f['id'])[_0xa235('0x1c')](function(){_0x3c6729[_0xa235('0xbb')](_0x52751a);});}else{_0x3c6729[_0xa235('0xcd')]({'active':![]},_0x56f21f['id'],0x1)[_0xa235('0x1c')](function(){_0x3c6729[_0xa235('0xbb')](_0x52751a);});}}else{_0x52751a[_0xa235('0x70')]+=0x1;_0x3c6729[_0xa235('0xbb')](_0x52751a);if(_0x52751a[_0xa235('0x1fb')]){_0x3c6729[_0xa235('0xcb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x56f21f[_0xa235('0xdf')],'ListId':_0x56f21f[_0xa235('0xe0')],'VoiceQueueId':_0x56f21f['VoiceQueueId']||undefined,'CampaignId':_0x56f21f[_0xa235('0xe1')]||undefined})[_0xa235('0xb9')](loggerCatch(_0xa235('0x1fc')));_0x3c6729[_0xa235('0xd8')](createObjHistory(_0x52751a,_0x56f21f,_0xa235('0x1fd'),0x17,_0xa235('0x1fe')))['catch'](loggerCatch(_0xa235('0x1ff')));}else{_0x3c6729[_0xa235('0xdd')](createObjHistory(_0x52751a,_0x56f21f,_0xa235('0x200'),0x16,_0xa235('0x201')),_0xa235('0x202'),_0xa235('0x203'));}}}}else{_0x52751a[_0xa235('0x68')]+=0x1;_0x3c6729[_0xa235('0xdd')](createObjHistory(_0x52751a,_0x56f21f,_0xa235('0x204'),0xd,_0xa235('0x205')),_0xa235('0x206'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer[_0xa235('0x1a')][_0xa235('0x16c')]=function(_0x183c7f){var _0x30dae9=this;var _0x31c202=_0x183c7f[_0xa235('0x207')]-_0x183c7f['originated']-_0x183c7f[_0xa235('0xd0')];emitCampaignSummary(_0x183c7f);if(_0x31c202>0x0){if(_0x31c202>this[_0xa235('0x22')]){_0x31c202=this[_0xa235('0x22')];}_0x183c7f[_0xa235('0xd0')]+=_0x31c202;this[_0xa235('0xd2')](_0x183c7f['id'],_0x31c202,_0x183c7f[_0xa235('0x208')],_0x183c7f)[_0xa235('0x41')](function(_0x108c82){_0x183c7f[_0xa235('0xd0')]-=_0x31c202;_0x183c7f[_0xa235('0xd0')]=_0x183c7f[_0xa235('0xd0')]>0x0?_0x183c7f['temp']:0x0;if(!checkContactEmpty(_0x108c82)){_0x183c7f[_0xa235('0x43')]=_0xa235('0xa6');logger[_0xa235('0x88')](_0xa235('0x209')+_0x183c7f['name']);}else{_0x183c7f[_0xa235('0x7d')]+=_0x108c82[_0xa235('0x9f')];_0x183c7f[_0xa235('0x43')]='RUNNING';for(var _0x3bee14=0x0;_0x3bee14<_0x108c82[_0xa235('0x9f')];_0x3bee14+=0x1){_0x183c7f['ivrTotalCallsDays']+=0x1;if(_[_0xa235('0xb6')](_0x108c82[_0x3bee14])||_[_0xa235('0xb6')](_0x108c82[_0x3bee14][_0xa235('0x19c')])||_['isNil'](_0x108c82[_0x3bee14][_0xa235('0x182')])){_0x30dae9['emptyContact'](_0xa235('0x20a'),_0x183c7f,_0x108c82[_0x3bee14]);}else{_0x30dae9[_0xa235('0xc6')](_['pick'](_0x108c82[_0x3bee14],['CampaignId',_0xa235('0x20b')]))[_0xa235('0x41')](_0x30dae9[_0xa235('0x1f6')](_0x183c7f,_0x108c82[_0x3bee14]))[_0xa235('0xb9')](_0x30dae9[_0xa235('0xdc')](_0xa235('0x20c'),_0x183c7f));}}}})[_0xa235('0xb9')](loggerGetContactDialer(_0xa235('0x20d'),_0x183c7f,_0x31c202));}};Dialer[_0xa235('0x1a')][_0xa235('0x165')]=function(_0xef6a81,_0xa4ced3){var _0x3db778=this;var _0x3151b3=[];var _0x1c0e01=_0xa4ced3>=0x1?_0xa4ced3:0x1;if(_0xef6a81[_0xa235('0x62')]===_0xa235('0x9')){_0x1c0e01=0x1;}var _0x2f55c4=Math['floor'](_0xef6a81[_0xa235('0x57')]*_0x1c0e01)-_0xef6a81['originated']-_0xef6a81[_0xa235('0xd0')];emitVoiceQueueSummary(_0xef6a81);if(_0xef6a81[_0xa235('0x20e')]>0x0){var _0x520132=_0xef6a81[_0xa235('0x20e')]-_0xef6a81[_0xa235('0x7d')]-_0xef6a81[_0xa235('0x5c')]-_0xef6a81[_0xa235('0xd0')]-_0xef6a81[_0xa235('0x20f')];if(_0x2f55c4>_0x520132){_0x2f55c4=_0x520132;}}if(_0x2f55c4>0x0){if(_0xef6a81[_0xa235('0x62')]==='booked'){_0x2f55c4=0x1;}if(_0x2f55c4>this[_0xa235('0x22')]){_0x2f55c4=this[_0xa235('0x22')];}_0xef6a81[_0xa235('0xd0')]+=_0x2f55c4;for(var _0x47d1d4 in this[_0xa235('0x20')]){if(typeof this['agents'][_0x47d1d4]!==_0xa235('0xa0')){if(this[_0xa235('0x20')][_0x47d1d4]['state']==='not_inuse'&&this[_0xa235('0x20')][_0x47d1d4][_0xa235('0xb7')]===_0xa235('0xe7')){_0x3151b3['push'](this['agents'][_0x47d1d4]['id']);}}}this[_0xa235('0xcf')](_0xef6a81['id'],_0x3151b3,_0x2f55c4,_0xef6a81['dialOrderByScheduledAt'],_0xef6a81)[_0xa235('0x41')](function(_0x5ad66e){_0xef6a81[_0xa235('0xd0')]-=_0x2f55c4;_0xef6a81['temp']=_0xef6a81[_0xa235('0xd0')]>0x0?_0xef6a81[_0xa235('0xd0')]:0x0;if(!checkContactEmpty(_0x5ad66e)){_0x3db778[_0xa235('0xbd')](_0xef6a81)[_0xa235('0x41')](sendMessageReschedule(_0xef6a81))[_0xa235('0xb9')](loggerCatch(_0xa235('0xbf')));}else{_0xef6a81['originated']+=_0x5ad66e[_0xa235('0x9f')];_0xef6a81[_0xa235('0x43')]=_0xef6a81[_0xa235('0x62')]==='booked'?_0xa235('0x18a'):_0xa235('0x210');for(var _0x48540e=0x0;_0x48540e<_0x5ad66e['length'];_0x48540e+=0x1){if(_['isNil'](_0x5ad66e[_0x48540e])||_[_0xa235('0xb6')](_0x5ad66e[_0x48540e][_0xa235('0x19c')])||_[_0xa235('0xb6')](_0x5ad66e[_0x48540e][_0xa235('0x182')])){_0x3db778[_0xa235('0x211')]('[actionOriginate]\x20',_0xef6a81,_0x5ad66e[_0x48540e]);}else{_0x3db778['checkIsBlackList'](_[_0xa235('0xde')](_0x5ad66e[_0x48540e],['VoiceQueueId',_0xa235('0x20b')]))[_0xa235('0x41')](_0x3db778[_0xa235('0x1f6')](_0xef6a81,_0x5ad66e[_0x48540e]))['catch'](_0x3db778[_0xa235('0xdc')](_0xa235('0x20a'),_0xef6a81));}}}})[_0xa235('0xb9')](loggerGetContactDialer(_0xa235('0x212'),_0xef6a81,_0x2f55c4));}};Dialer['prototype'][_0xa235('0x96')]=function(_0x2300aa){if(_0x2300aa['dialLimitQueue']>0x0){var _0x25befe=_0x2300aa[_0xa235('0x20e')]-_0x2300aa[_0xa235('0x7d')]-_0x2300aa['talking'];if(_0x25befe>0x0){this[_0xa235('0x213')](_0x2300aa);}else{loggerPredictiveCalls[_0xa235('0x88')](_0xa235('0x214'));}}else{this[_0xa235('0x213')](_0x2300aa);}};Dialer[_0xa235('0x1a')][_0xa235('0x213')]=function(_0x1aed30){var _0x129d08=this;var _0x2f482d=[];_0x1aed30['originated']+=0x1;for(var _0x4b934b in this[_0xa235('0x20')]){if(typeof this[_0xa235('0x20')][_0x4b934b]!==_0xa235('0xa0')){if(this['agents'][_0x4b934b][_0xa235('0x10c')]===_0xa235('0x215')&&this['agents'][_0x4b934b][_0xa235('0xb7')]===_0xa235('0xe7')){_0x2f482d[_0xa235('0x137')](this[_0xa235('0x20')][_0x4b934b]['id']);}}}this[_0xa235('0xcf')](_0x1aed30['id'],_0x2f482d,0x1,_0x1aed30[_0xa235('0x208')],_0x1aed30)[_0xa235('0x41')](function(_0x6a5927){if(!checkContactEmpty(_0x6a5927)){checkContactLowerLimitOriginate(_0x1aed30,0x1,0x0);_0x129d08[_0xa235('0xbd')](_0x1aed30)[_0xa235('0x41')](sendMessageReschedule(_0x1aed30))[_0xa235('0xb9')](loggerCatch(_0xa235('0xbf')));}else{_0x1aed30[_0xa235('0x43')]=_0xa235('0x210');if(_[_0xa235('0xb6')](_0x6a5927[0x0])||_['isNil'](_0x6a5927[0x0][_0xa235('0x19c')])||_[_0xa235('0xb6')](_0x6a5927[0x0][_0xa235('0x182')])){_0x129d08[_0xa235('0x211')](_0xa235('0x20a'),_0x1aed30,_0x6a5927[0x0]);}else{_0x129d08[_0xa235('0xc0')](_[_0xa235('0xde')](_0x6a5927[0x0],[_0xa235('0x10a'),_0xa235('0x20b')]))['then'](_0x129d08[_0xa235('0x1f6')](_0x1aed30,_0x6a5927[0x0]))[_0xa235('0xb9')](_0x129d08[_0xa235('0xdc')]('[actionOriginatePredictive]\x20',_0x1aed30));}}})['catch'](loggerGetContactDialer(_0xa235('0x216'),_0x1aed30,0x1));emitVoiceQueueSummary(_0x1aed30);};Dialer[_0xa235('0x1a')][_0xa235('0x1ed')]=function(_0x63d7bb,_0x1cba5e,_0x22f1b5,_0x34d5c3,_0x513088,_0x36bcb9){loggerPredictive['info'](_0xa235('0x217'));loggerPredictive['info'](_0xa235('0x218'),_0x63d7bb);loggerPredictive[_0xa235('0x88')](_0xa235('0x219'),_0x1cba5e);loggerPredictive[_0xa235('0x88')](_0xa235('0x21a'),_0x22f1b5);loggerPredictive[_0xa235('0x88')](_0xa235('0x21b'),_0x34d5c3);loggerPredictive['info'](_0xa235('0x21c'),_0x513088);loggerPredictive[_0xa235('0x88')](_0xa235('0x8c'));return new BPromise(function(_0x164692,_0x450ad5){if(_0x63d7bb<=0x0||isNaN(_0x63d7bb)){return _0x450ad5(msgResponse(_0xa235('0x21d'),_0xa235('0x4d'),_0xa235('0x21e')+_0x63d7bb));}if(_0x22f1b5<=0x0||isNaN(_0x22f1b5)){return _0x450ad5(msgResponse(_0xa235('0x21d'),_0xa235('0x4d'),_0xa235('0x21f')+_0x22f1b5));}if(_0x34d5c3<=0x0||isNaN(_0x34d5c3)){return _0x450ad5(msgResponse(_0xa235('0x21d'),'Error',_0xa235('0x220')+_0x34d5c3));}if(_0x1cba5e<=0x0||isNaN(_0x1cba5e)){return _0x450ad5(msgResponse(_0xa235('0x21d'),'Error',_0xa235('0x221')+_0x1cba5e));}if(_0x513088<=0x0||isNaN(_0x513088)){return _0x450ad5(msgResponse(_0xa235('0x21d'),_0xa235('0x4d'),'Amax\x20=\x20'+_0x513088));}_0x36bcb9=_0x36bcb9||0x0;var _0x12ab33=0x1/_0x22f1b5;var _0x2f43a3=0x0;var _0x151700=0x0;var _0x2b093b=0x0;var _0x50b2f=0x0;for(var _0x183f46=0x0;_0x2b093b<_0x513088;_0x183f46+=0x1){_0x151700=_0x183f46/_0x1cba5e;_0x2f43a3=(_0x34d5c3*_0x151700+_0x36bcb9)/_0x12ab33;_0x2b093b=erlangb(_0x2f43a3,_0x63d7bb);_0x50b2f=_0x2f43a3/_0x63d7bb*(0x1-erlangb(_0x2f43a3,_0x63d7bb));}return _0x164692({'erlangCalls':_0x183f46,'erlangCallToSecond':_0x1cba5e/_0x183f46,'erlangAbandonmentRate':_0x2b093b,'erlangBusyFactor':_0x50b2f});});};Dialer[_0xa235('0x1a')]['busyFactor']=function(_0x15ee66,_0x41f69d,_0x239045,_0x7b755f,_0x4e4cb3,_0x2f93ba){loggerPredictive[_0xa235('0x88')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info']('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x15ee66);loggerPredictive['info'](_0xa235('0x219'),_0x41f69d);loggerPredictive[_0xa235('0x88')](_0xa235('0x21a'),_0x239045);loggerPredictive[_0xa235('0x88')](_0xa235('0x21b'),_0x7b755f);loggerPredictive[_0xa235('0x88')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4e4cb3);loggerPredictive[_0xa235('0x88')](_0xa235('0x8c'));return new BPromise(function(_0x338a53,_0x32b50b){if(_0x15ee66<=0x0||isNaN(_0x15ee66)){return _0x32b50b(msgResponse(_0xa235('0x222'),_0xa235('0x4d'),'m\x20=\x20'+_0x15ee66));}if(_0x239045<=0x0||isNaN(_0x239045)){return _0x32b50b(msgResponse(_0xa235('0x222'),_0xa235('0x4d'),_0xa235('0x21f')+_0x239045));}if(_0x7b755f<=0x0||isNaN(_0x7b755f)){return _0x32b50b(msgResponse(_0xa235('0x222'),_0xa235('0x4d'),_0xa235('0x220')+_0x7b755f));}if(_0x41f69d<=0x0||isNaN(_0x41f69d)){return _0x32b50b(msgResponse('[busyFactor]',_0xa235('0x4d'),'interval\x20=\x20'+_0x41f69d));}if(_0x4e4cb3<=0x0||isNaN(_0x4e4cb3)){return _0x32b50b(msgResponse(_0xa235('0x222'),_0xa235('0x4d'),_0xa235('0x223')+_0x4e4cb3));}_0x2f93ba=_0x2f93ba||0x0;var _0x257fa8=0x1/_0x239045;var _0x532322=0x0;var _0x145d31=0x0;var _0x335cd1=0x0;var _0xc11d1e=0x0;for(var _0x4c9afe=0x0;_0xc11d1e<_0x4e4cb3;_0x4c9afe+=0x1){_0x145d31=_0x4c9afe/_0x41f69d;_0x532322=(_0x7b755f*_0x145d31+_0x2f93ba)/_0x257fa8;_0x335cd1=erlangb(_0x532322,_0x15ee66);_0xc11d1e=_0x532322/_0x15ee66*(0x1-erlangb(_0x532322,_0x15ee66));}return _0x338a53({'erlangCalls':_0x4c9afe,'erlangCallToSecond':_0x41f69d/_0x4c9afe,'erlangAbandonmentRate':_0x335cd1,'erlangBusyFactor':_0xc11d1e});});};module[_0xa235('0x224')]=Dialer; \ No newline at end of file +var _0xda55=['NoSuchNumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','round','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','recalculate\x20predictive\x20at','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','floor','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','dialOrderByScheduledAt','[getContactCampaign2][Empty]','[actionOriginate]\x20','[actionOriginateIvr]\x20','dialLimitQueue','pTalking','RUNNING','[getContactDialer2]','tryOriginatePredictive','not_inuse','Contact.phone','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','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','Umin\x20=\x20','exports','util','lodash','moment','md5','ioredis','../preview/util/util','../../../config/environment/','dialer','booked','predictive','../../../config/logger','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperAdditionalPhone','../rpc/voiceQueueRt','../rpc/setting','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','roundrobin','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncQueueSummaryComplete','syncHangup','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','getSettings','then','previewRecallmeReminderInterval','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','message','NOT_ACTIVE','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','loggedIn','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk','active','format','voice:queue:%s','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','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','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','erlangAbandonmentRate','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','inspect','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','isNil','Action','status','channel','catch','[Dialer][checkChannel]','queue','updateOriginated','resolve','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','pick','ContactId','ListId','UserId','[emptyContact]','isSuccess','Success','isTrunkReachable','reachable','SIP/%s','unmonitored','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','uniqueid','HangupInAMD','membername','AMD','custom:amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','amd','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','VoiceQueueId','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countabandonedretry','stateGlobal','CampaignId','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','moveContactManagedDialer','cause-txt','syncAgentComplete','reason','agent','agiafterat','dialQueueProject2','answertime','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','dropreason','CALLEREXIT','callAdditionalPhoneAfterMin','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','actionid','paused','stateinterface','locked','rrmemory','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','run','[Catch][Preview][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','finally','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[booked][unlock3]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','content','indexOf','true','all','some','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','throttle','dialPreviewRecallmeReminder','filter','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','originatecalleridname','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine'];(function(_0x16043b,_0x199752){var _0x48c508=function(_0x8aea1d){while(--_0x8aea1d){_0x16043b['push'](_0x16043b['shift']());}};_0x48c508(++_0x199752);}(_0xda55,0x6d));var _0x5da5=function(_0x5d1d6c,_0x8c94ff){_0x5d1d6c=_0x5d1d6c-0x0;var _0x3f4b02=_0xda55[_0x5d1d6c];return _0x3f4b02;};'use strict';var util=require(_0x5da5('0x0'));var _=require(_0x5da5('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x5da5('0x2'));var rr=require('rr');var md5=require(_0x5da5('0x3'));var Redis=require(_0x5da5('0x4'));var ut=require(_0x5da5('0x5'));var config=require(_0x5da5('0x6'));var logger=require('../../../config/logger')(_0x5da5('0x7'));var loggerBooked=require('../../../config/logger')(_0x5da5('0x8'));var loggerPredictive=require('../../../config/logger')(_0x5da5('0x9'));var loggerPredictiveCalls=require(_0x5da5('0xa'))(_0x5da5('0xb'));var loggerSyncQueueSummary=require(_0x5da5('0xa'))(_0x5da5('0xc'));var ami=require(_0x5da5('0xd'));config[_0x5da5('0xe')]=_[_0x5da5('0xf')](config['redis'],{'host':_0x5da5('0x10'),'port':0x18eb});var io=require(_0x5da5('0x11'))(new Redis(config[_0x5da5('0xe')]));var cmHopper=require(_0x5da5('0x12'));var cmHopperHistory=require(_0x5da5('0x13'));var cmHopperFinal=require(_0x5da5('0x14'));var cmHopperAdditionalPhone=require(_0x5da5('0x15'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x5da5('0x16'));var RpcSetting=require(_0x5da5('0x17'));var Action=require('./action');var History=require(_0x5da5('0x18'));var Final=require(_0x5da5('0x19'));var AgentComplete=require(_0x5da5('0x1a'));var QueueCallerAbandon=require(_0x5da5('0x1b'));var Hangup=require(_0x5da5('0x1c'));var ipAgi=process[_0x5da5('0x1d')]['XCALLY_IP_AGI']||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0x5da5('0x1e')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x5da5('0x1f')][_0x5da5('0x20')]=function(_0x665ce8){this[_0x5da5('0x21')]=this[_0x5da5('0x21')]?this[_0x5da5('0x21')]['finally'](_0x665ce8):_0x665ce8();};function Dialer(_0x124dc5,_0x290136){this[_0x5da5('0x22')]=new Sequence();this[_0x5da5('0x23')]=_0x290136;this[_0x5da5('0x24')]=_0x124dc5[_0x5da5('0x24')];this['campaigns']=_0x124dc5[_0x5da5('0x25')];this[_0x5da5('0x26')]=_0x124dc5[_0x5da5('0x26')];this[_0x5da5('0x27')]=_0x124dc5[_0x5da5('0x27')];this['maxNumberOriginate']=config[_0x5da5('0x28')]||0x2;this[_0x5da5('0x29')]={};this[_0x5da5('0x2a')]={};this['contactsId']={};this[_0x5da5('0x2b')]={};this[_0x5da5('0x2c')]={};this[_0x5da5('0x2d')]={};this[_0x5da5('0x2e')]={};this[_0x5da5('0x2f')]={};this[_0x5da5('0x30')]={};this['queueBookedRR']={};ami['on'](_0x5da5('0x31'),this['syncAgentConnect'][_0x5da5('0x32')](this));ami['on'](_0x5da5('0x33'),this[_0x5da5('0x34')]['bind'](this));ami['on'](_0x5da5('0x35'),this[_0x5da5('0x36')][_0x5da5('0x32')](this));ami['on'](_0x5da5('0x37'),this['syncAgentComplete']['bind'](this));ami['on']('custom:queuesummary',this[_0x5da5('0xc')]['bind'](this));ami['on']('custom:queuesummarycomplete',this[_0x5da5('0x38')][_0x5da5('0x32')](this));ami['on']('hangup',this[_0x5da5('0x39')][_0x5da5('0x32')](this));ami['on']('newexten',this[_0x5da5('0x3a')][_0x5da5('0x32')](this));ami['on'](_0x5da5('0x3b'),this[_0x5da5('0x3c')][_0x5da5('0x32')](this));ami['on']('queuemember',this[_0x5da5('0x3d')][_0x5da5('0x32')](this));ami['on'](_0x5da5('0x3e'),this[_0x5da5('0x3f')]['bind'](this));this['loopCampaigns']();this['loopClearZombieChannels']();RpcSetting[_0x5da5('0x40')]()[_0x5da5('0x41')](function(_0x15344b){previewRecallmeReminderInterval=_0x15344b[_0x5da5('0x42')];});}function isNotNull(_0x51b712){return _0x51b712!==null&&!_['isUndefined'](_0x51b712);}function checkIsLoggedIn(_0x24e115,_0x4afb58){return function(){if(_0x4afb58<=0x0){_0x24e115['message']=_0x5da5('0x43');throw _0x24e115['name']+_0x5da5('0x44');}};}function isActive(_0x59fba9){return _0x59fba9;}function checkIsActive(_0x33f138,_0x20475c){return function(){if(!isActive(_0x20475c)){_0x33f138[_0x5da5('0x45')]=_0x5da5('0x46');throw _0x33f138[_0x5da5('0x47')]+_0x5da5('0x48');}};}function checkInterval(_0x52ce3c){return function(){if(!isNotNull(_0x52ce3c[_0x5da5('0x49')])){_0x52ce3c['message']=_0x5da5('0x4a');throw _0x52ce3c[_0x5da5('0x47')]+_0x5da5('0x4b');}if(!isNotNull(_0x52ce3c[_0x5da5('0x49')][_0x5da5('0x4c')])){_0x52ce3c[_0x5da5('0x45')]=_0x5da5('0x4a');throw _0x52ce3c[_0x5da5('0x47')]+_0x5da5('0x4b');}if(!isNotNull(_[_0x5da5('0x4d')](_0x52ce3c[_0x5da5('0x49')][_0x5da5('0x4c')]))){_0x52ce3c[_0x5da5('0x45')]='INTERVAL_IS_NULL';throw _0x52ce3c[_0x5da5('0x47')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x2d6280,_0x40f6c6,_0x29d6aa){return{'action':_0x2d6280,'response':_0x40f6c6,'message':_0x29d6aa,'stack':_0x29d6aa};}function myreject(_0x24842c){return function(_0x59c92e){return _0x24842c(msgResponse(_0x5da5('0x4e'),_0x5da5('0x4f'),JSON[_0x5da5('0x50')](_0x59c92e)));};}function getSeconds(_0x56fd57,_0xaff58d){var _0x2e5107=moment(_0x56fd57)['milliseconds'](0x0);var _0x18d00b=moment(_0xaff58d)[_0x5da5('0x51')](0x0);return _0x2e5107[_0x5da5('0x52')](_0x18d00b,_0x5da5('0x53'));}function emit(_0x2c9b00,_0x664a8d,_0x52a902){io['to'](_0x2c9b00)[_0x5da5('0x54')](_0x664a8d,_0x52a902);}function emitVoiceQueueSummary(_0x91d336){if(_0x91d336[_0x5da5('0x55')]===_0x5da5('0x56')){var _0x4466b2={'id':_0x91d336['id'],'name':_0x91d336['name'],'strategy':_0x91d336[_0x5da5('0x57')],'answered':_0x91d336[_0x5da5('0x58')],'available':_0x91d336['available'],'loggedIn':_0x91d336[_0x5da5('0x59')],'pTalking':_0x91d336['pTalking'],'sumBillable':_0x91d336['sumBillable'],'sumDuration':_0x91d336[_0x5da5('0x5a')],'sumHoldTime':_0x91d336[_0x5da5('0x5b')]||0x0,'talking':_0x91d336[_0x5da5('0x5c')],'total':_0x91d336[_0x5da5('0x5d')],'type':_0x91d336[_0x5da5('0x55')],'unmanaged':_0x91d336[_0x5da5('0x5e')],'abandoned':_0x91d336[_0x5da5('0x5f')],'waiting':_0x91d336[_0x5da5('0x60')],'loggedInDb':_0x91d336[_0x5da5('0x61')],'dialActive':_0x91d336[_0x5da5('0x62')],'dialMethod':_0x91d336[_0x5da5('0x63')],'dialOriginateCallerIdName':_0x91d336[_0x5da5('0x64')],'dialOriginateCallerIdNumber':_0x91d336[_0x5da5('0x65')],'dialOriginateTimeout':_0x91d336[_0x5da5('0x66')],'dialPrefix':_0x91d336[_0x5da5('0x67')],'outboundAnswerAgiCallsDay':_0x91d336[_0x5da5('0x68')],'outboundAnswerCallsDay':_0x91d336[_0x5da5('0x69')],'outboundBlacklistCallsDay':_0x91d336[_0x5da5('0x6a')],'outboundBusyCallsDay':_0x91d336[_0x5da5('0x6b')],'outboundCongestionCallsDay':_0x91d336[_0x5da5('0x6c')],'outboundDropCallsDayACS':_0x91d336['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x91d336['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x91d336[_0x5da5('0x6d')],'outboundNoAnswerCallsDay':_0x91d336[_0x5da5('0x6e')],'outboundNoSuchCallsDay':_0x91d336['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x91d336[_0x5da5('0x6f')],'outboundReCallsDay':_0x91d336[_0x5da5('0x70')],'outboundRejectCallsDay':_0x91d336[_0x5da5('0x71')],'outboundUnknownCallsDay':_0x91d336[_0x5da5('0x72')],'predictiveIntervalAnsweredCalls':_0x91d336[_0x5da5('0x73')],'predictiveIntervalAvgHoldtime':_0x91d336[_0x5da5('0x74')],'predictiveIntervalAvgTalktime':_0x91d336[_0x5da5('0x75')],'predictiveIntervalDroppedCallsCallersExit':_0x91d336[_0x5da5('0x76')],'predictiveIntervalDroppedCallsTimeout':_0x91d336[_0x5da5('0x77')],'predictiveIntervalErlangCalls':_0x91d336[_0x5da5('0x78')],'predictiveIntervalErlangCallsDroppedCalls':_0x91d336['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x91d336[_0x5da5('0x79')],'predictiveIntervalMultiplicativeFactor':_0x91d336['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x91d336['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x91d336[_0x5da5('0x7a')],'predictiveIntervalTotalCalls':_0x91d336[_0x5da5('0x7b')],'message':_0x91d336[_0x5da5('0x45')],'originated':_0x91d336[_0x5da5('0x7c')],'erlangCalls':_0x91d336[_0x5da5('0x7d')],'erlangCallToSecond':_0x91d336[_0x5da5('0x7e')],'erlangAbandonmentRate':_0x91d336['erlangAbandonmentRate'],'erlangBusyFactor':_0x91d336[_0x5da5('0x7f')],'startPredictive':_0x91d336['startPredictive'],'startProgressive':_0x91d336['startProgressive']};if(_0x91d336[_0x5da5('0x80')]){_0x4466b2[_0x5da5('0x80')]={'id':_0x91d336['Trunk']['id'],'name':_0x91d336[_0x5da5('0x80')][_0x5da5('0x47')],'active':_0x91d336[_0x5da5('0x80')][_0x5da5('0x81')],'callerid':_0x91d336[_0x5da5('0x80')]['callerid']};}if(_0x91d336[_0x5da5('0x49')]){_0x4466b2['Interval']={'id':_0x91d336['Interval']['id'],'name':_0x91d336[_0x5da5('0x49')]['name']};}var _0x3dd067=md5(JSON[_0x5da5('0x50')](_0x4466b2));if(_0x91d336[_0x5da5('0x3')]!==_0x3dd067){_0x91d336[_0x5da5('0x3')]=_0x3dd067;emit(util[_0x5da5('0x82')](_0x5da5('0x83'),_0x4466b2['name']),'voice_queue:save',_0x4466b2);}}}function emitCampaignSummary(_0x1ab197){if(_0x1ab197[_0x5da5('0x55')]==='ivr'){emit(util['format'](_0x5da5('0x84'),_0x1ab197['name']),_0x5da5('0x85'),_0x1ab197);}}function checkGetDataPredictive(_0x59a53f){if(isNotNull(_0x59a53f)&&!_['isEmpty'](_0x59a53f)){loggerPredictive[_0x5da5('0x86')](_0x5da5('0x87'));loggerPredictive[_0x5da5('0x86')](_0x5da5('0x88'),_0x59a53f['predictiveIntervalTotalCalls']);loggerPredictive[_0x5da5('0x86')](_0x5da5('0x89'),_0x59a53f[_0x5da5('0x73')]);loggerPredictive['info'](_0x5da5('0x8a'),_0x59a53f[_0x5da5('0x77')]);loggerPredictive[_0x5da5('0x86')](_0x5da5('0x8b'),_0x59a53f[_0x5da5('0x76')]);loggerPredictive[_0x5da5('0x86')](_0x5da5('0x8c'),_0x59a53f[_0x5da5('0x74')]);loggerPredictive[_0x5da5('0x86')](_0x5da5('0x8d'),_0x59a53f[_0x5da5('0x75')]);loggerPredictive[_0x5da5('0x86')](_0x5da5('0x8e'));if(_0x59a53f[_0x5da5('0x7b')]>0x0){if(!_[_0x5da5('0x8f')](_0x59a53f[_0x5da5('0x75')])&&_0x59a53f[_0x5da5('0x75')]>0x0){return!![];}loggerPredictive[_0x5da5('0x86')](_0x5da5('0x90'));if(!_[_0x5da5('0x8f')](_0x59a53f[_0x5da5('0x74')])&&_0x59a53f['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x5da5('0x86')](_0x5da5('0x91'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x5da5('0x92'));}return![];}function mergeDataErlangB(_0x469907){return function(_0x20c269){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x5da5('0x86')](_0x5da5('0x93'),_0x20c269[_0x5da5('0x7d')]);loggerPredictive[_0x5da5('0x86')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x20c269[_0x5da5('0x7e')]);loggerPredictive[_0x5da5('0x86')](_0x5da5('0x94'),_0x20c269['erlangAbandonmentRate']);loggerPredictive[_0x5da5('0x86')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x20c269[_0x5da5('0x7f')]);loggerPredictive[_0x5da5('0x86')](_0x5da5('0x94'),_0x20c269[_0x5da5('0x95')]);loggerPredictive[_0x5da5('0x86')](_0x5da5('0x8e'));_[_0x5da5('0x96')](_0x469907,_0x20c269);};}function getDiff(_0x2c13f1){var _0x1252b4=moment()[_0x5da5('0x51')](0x0);var _0x2f9f72=moment(_0x2c13f1)[_0x5da5('0x51')](0x0);return _0x1252b4[_0x5da5('0x52')](_0x2f9f72,_0x5da5('0x53'));}function ifInterval(_0x72c640,_0xd7f04d){if(_[_0x5da5('0x8f')](_0xd7f04d)){return![];}return getDiff(_0xd7f04d)<_0x72c640*0x3c;}function freeVariablesPredictive(_0x47019e){if(isNotNull(_0x47019e)){if(!_[_0x5da5('0x8f')](_0x47019e[_0x5da5('0x2e')])){_0x47019e[_0x5da5('0x2e')]=undefined;loggerPredictive['info'](_0x47019e['name'],_0x5da5('0x97'));}if(!_[_0x5da5('0x8f')](_0x47019e[_0x5da5('0x2d')])){_0x47019e['startPredictive']=undefined;loggerPredictive[_0x5da5('0x86')](_0x47019e[_0x5da5('0x47')],_0x5da5('0x98'));}if(!_[_0x5da5('0x8f')](_0x47019e['handlePredictive'])){clearInterval(_0x47019e[_0x5da5('0x99')]);_0x47019e['handlePredictive']=undefined;loggerPredictive[_0x5da5('0x86')](_0x47019e[_0x5da5('0x47')],_0x5da5('0x9a'));}}}function erlangb(_0x53cb6a,_0x57966d){if(_0x57966d===0x0){return 0x0;}var _0x41e3a6=0x1;for(var _0x28cd6a=0x1;_0x28cd6a<=_0x57966d;_0x28cd6a+=0x1){_0x41e3a6=0x1+_0x41e3a6*_0x28cd6a/_0x53cb6a;}return 0x1/_0x41e3a6;}function isVoiceQueueOutbound(_0x512f01){return _0x512f01==='outbound';}function isNotPreview(_0x5658a0){return _0x5658a0!==_0x5da5('0x23');}function isCampaignIvr(_0x446241){return _0x446241===_0x5da5('0x9b');}function getCallerId(_0x152b61,_0x3e0904,_0x283efe){if(!_[_0x5da5('0x8f')](_0x283efe)&&typeof _0x283efe===_0x5da5('0x9c')&&!_['isEmpty'](_0x283efe)){if(!_[_0x5da5('0x8f')](_0x3e0904)&&typeof _0x3e0904===_0x5da5('0x9c')&&!_['isEmpty'](_0x3e0904)){return util['format'](_0x5da5('0x9d'),_0x3e0904,_0x283efe);}return util['format'](_0x5da5('0x9d'),_0x283efe,_0x283efe);}if(!_['isUndefined'](_0x152b61)&&typeof _0x152b61===_0x5da5('0x9c')&&!_[_0x5da5('0x4d')](_0x152b61)){return _0x152b61;}return _0x5da5('0x9e');}function loggerCatchQueueSummary(_0x1160a9,_0x3724a2){return function(_0x9f6467){freeVariablesPredictive(_0x3724a2);emitVoiceQueueSummary(_0x3724a2);emitCampaignSummary(_0x3724a2);loggerSyncQueueSummary[_0x5da5('0x9f')](_0x1160a9,util[_0x5da5('0xa0')](_0x9f6467,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x12ef38,_0x20c1e7){return function(_0xa9c406){loggerPredictive[_0x5da5('0xa1')](_0x20c1e7['name'],_0x12ef38);loggerPredictive['error'](_0xa9c406[_0x5da5('0xa2')]);freeVariablesPredictive(_0x20c1e7);};}function loggerCatch(_0xd9fc2f){return function(_0x34ee4f){logger[_0x5da5('0xa1')](_0xd9fc2f,util['inspect'](_0x34ee4f,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x487282){return _0x487282&&!_['isUndefined'](_0x487282)&&_0x487282[_0x5da5('0xa3')]>0x0;}function decremetOriginate(_0x3833ac){if(!_[_0x5da5('0x8f')](_0x3833ac)&&_0x3833ac!==null){if(typeof _0x3833ac[_0x5da5('0x7c')]!==_0x5da5('0xa4')){if(_0x3833ac[_0x5da5('0x7c')]>0x0){_0x3833ac[_0x5da5('0x7c')]-=0x1;}else{logger[_0x5da5('0xa1')](_0x5da5('0xa5'));}}}else{logger[_0x5da5('0xa1')](_0x5da5('0xa6'));}}function checkContactLowerLimitOriginate(_0x11055a,_0xcdf5bc,_0x3852bf){if(_0xcdf5bc>_0x3852bf){for(var _0x2d032c=0x0;_0x2d032c<_0xcdf5bc-_0x3852bf;_0x2d032c+=0x1){decremetOriginate(_0x11055a);}}}function loggerGetContactDialer(_0x259b5b,_0x1d7747,_0x242ca9){return function(_0x362ddc){checkContactLowerLimitOriginate(_0x1d7747,_0x242ca9,0x0);logger[_0x5da5('0xa1')](_0x259b5b,util[_0x5da5('0xa0')](_0x362ddc,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5a7f21){return function(_0xe65ec){if(isNotNull(_0xe65ec)&&isNotNull(_0xe65ec[0x0])){if(_0xe65ec[0x0][_0x5da5('0xa7')]>0x0){_0x5a7f21[_0x5da5('0x45')]=_0x5da5('0xa8');logger['info']('[getContactDialer2][ReScheduled]'+_0x5a7f21[_0x5da5('0x47')],_0xe65ec[0x0]['contactsRescheduled'],_0x5da5('0xa9'));}else{_0x5a7f21[_0x5da5('0x45')]=_0x5da5('0xaa');logger[_0x5da5('0x86')](_0x5da5('0xab')+_0x5a7f21[_0x5da5('0x47')]);}}};}function notSendMessagesQueue(_0xc5894){if(_0xc5894[_0x5da5('0xac')]){freeVariablesPredictive(_0xc5894);if(_0xc5894[_0x5da5('0x7c')]===0x0&&_0xc5894['talking']===0x0&&_0xc5894[_0x5da5('0x60')]===0x0&&(_0xc5894['pTalking']||0x0)===0x0){_0xc5894[_0x5da5('0xac')]=![];_0xc5894[_0x5da5('0xad')]=0x0;_0xc5894['message']=_0x5da5('0x46');loggerSyncQueueSummary['debug'](_0x5da5('0xae'),_0xc5894['name'],_0x5da5('0xaf'));}else{_0xc5894[_0x5da5('0x45')]=_0x5da5('0xb0');loggerSyncQueueSummary[_0x5da5('0x9f')](_0x5da5('0xae'),_0xc5894[_0x5da5('0x47')],_0x5da5('0xb1'));}emitVoiceQueueSummary(_0xc5894);}}function notSendMessagesCampaign(_0x7aea94){if(_0x7aea94[_0x5da5('0xac')]){if(_0x7aea94['originated']===0x0){_0x7aea94[_0x5da5('0xac')]=![];_0x7aea94[_0x5da5('0x45')]='NOT_ACTIVE';loggerSyncQueueSummary['debug'](_0x5da5('0xb2'),_0x7aea94[_0x5da5('0x47')],_0x5da5('0xaf'));}else{_0x7aea94[_0x5da5('0x45')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x5da5('0x9f')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x7aea94[_0x5da5('0x47')],'is\x20disactive');}emitCampaignSummary(_0x7aea94);}}function createObjHistory(_0x5eb2a1,_0x276fde,_0x5372f2,_0x54ad39,_0x156e7f){_0x5eb2a1[_0x5da5('0x45')]=_0x5372f2;var _0x44cff9=new Action(_0x5eb2a1,_0x276fde);var _0x142aa7=new History(_0x44cff9);_0x142aa7[_0x5da5('0xb3')]=_0x54ad39;_0x142aa7[_0x5da5('0xb4')]=_0x156e7f;_0x142aa7[_0x5da5('0xb5')]=_0x44cff9[_0x5da5('0xb6')];return _0x142aa7;}Dialer['prototype'][_0x5da5('0xb7')]=function(){var _0x308e64=this;setInterval(function(){_0x308e64[_0x5da5('0xb8')](_0x308e64[_0x5da5('0x2b')],_0x5da5('0xb9'));_0x308e64[_0x5da5('0xb8')](_0x308e64[_0x5da5('0x2a')],_0x5da5('0xba'));},0x32c8);};Dialer[_0x5da5('0x1f')][_0x5da5('0xb8')]=function(_0x3f4eee,_0x1dc66e){var _0x104ae6=this;for(var _0xed45a1 in _0x3f4eee){if(typeof _0x3f4eee[_0xed45a1]!==_0x5da5('0xa4')){this[_0x5da5('0x22')][_0x5da5('0x20')](function(){if(!_[_0x5da5('0xbb')](_0x3f4eee[_0xed45a1])){return ami[_0x5da5('0xbc')]({'action':_0x5da5('0xbd'),'channel':_0x3f4eee[_0xed45a1][_0x5da5('0xbe')]})[_0x5da5('0xbf')](function(_0x27d704){if(_0x27d704[_0x5da5('0x45')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x3f4eee[_0xed45a1]&&_0x3f4eee[_0xed45a1][_0x5da5('0x55')]!==_0x5da5('0x9b')){_0x104ae6['updateOriginated'](_0x104ae6[_0x5da5('0x24')][_0x3f4eee[_0xed45a1]['queue']]);logger[_0x5da5('0xa1')](_0x5da5('0xc0'),_0x1dc66e,_0xed45a1,_0x3f4eee[_0xed45a1][_0x5da5('0xc1')]);delete _0x3f4eee[_0xed45a1];}if(_0x3f4eee[_0xed45a1]&&_0x3f4eee[_0xed45a1][_0x5da5('0x55')]===_0x5da5('0x9b')){_0x104ae6[_0x5da5('0xc2')](_0x104ae6['campaigns'][_0x3f4eee[_0xed45a1][_0x5da5('0xc1')]]);logger[_0x5da5('0xa1')]('[Dialer][checkChannel][ivr]',_0x1dc66e,_0xed45a1,_0x3f4eee[_0xed45a1][_0x5da5('0xc1')]);delete _0x3f4eee[_0xed45a1];}},0x2328);}});}});}}};Dialer[_0x5da5('0x1f')]['countReScheduled']=function(_0x207a13){return BPromise[_0x5da5('0xc3')]()[_0x5da5('0x41')](cmHopper[_0x5da5('0xc4')](_0x207a13))[_0x5da5('0xbf')](loggerCatch(_0x5da5('0xc5')));};Dialer[_0x5da5('0x1f')][_0x5da5('0xc6')]=function(_0x263f18){return BPromise[_0x5da5('0xc3')]()['then'](cmHopperBlack[_0x5da5('0xc6')](_0x263f18))[_0x5da5('0xbf')](loggerCatch(_0x5da5('0xc7')));};Dialer[_0x5da5('0x1f')][_0x5da5('0xc8')]=function(_0x423cfc,_0x35748b,_0x4aecfd){return BPromise['resolve']()[_0x5da5('0x41')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x423cfc,_0x35748b,_0x4aecfd))['catch'](loggerCatch(_0x5da5('0xc9')));};Dialer['prototype'][_0x5da5('0xca')]=function(_0x59295f,_0xdc3a74,_0x2bb795){return BPromise[_0x5da5('0xc3')]()[_0x5da5('0x41')](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x59295f,_0xdc3a74,_0x2bb795))[_0x5da5('0xbf')](loggerCatch(_0x5da5('0xcb')));};Dialer[_0x5da5('0x1f')][_0x5da5('0xcc')]=function(_0xf7c7ab){return BPromise[_0x5da5('0xc3')]()[_0x5da5('0x41')](cmHopperBlack[_0x5da5('0xcc')](_0xf7c7ab))['catch'](loggerCatch(_0x5da5('0xcd')));};Dialer[_0x5da5('0x1f')]['averageHandleTime']=function(_0x375612){return BPromise[_0x5da5('0xc3')]()[_0x5da5('0x41')](cmHopperHistory[_0x5da5('0xce')](_0x375612))['catch'](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x5da5('0x1f')][_0x5da5('0xcf')]=function(_0x327853){return BPromise[_0x5da5('0xc3')]()[_0x5da5('0x41')](cmHopper['rescheduleContact'](_0x327853))[_0x5da5('0xbf')](loggerCatch(_0x5da5('0xd0')));};Dialer[_0x5da5('0x1f')][_0x5da5('0xd1')]=function(_0x4e0ef7,_0x5f2099,_0x1edfc6){return BPromise[_0x5da5('0xc3')]()[_0x5da5('0x41')](cmHopper[_0x5da5('0xd1')](_0x4e0ef7,_0x5f2099,_0x1edfc6))[_0x5da5('0xbf')](loggerCatch(_0x5da5('0xd2')));};Dialer[_0x5da5('0x1f')][_0x5da5('0xd3')]=function(_0x3028a7,_0x34bdd4,_0x28da21,_0x2004ab,_0x3d63ed){return BPromise['resolve']()[_0x5da5('0x41')](cmHopper['getContactDialer'](_0x3028a7,_0x34bdd4,_0x28da21,_0x2004ab))[_0x5da5('0xbf')](function(_0x44cf3b){_0x3d63ed[_0x5da5('0xd4')]-=_0x28da21;_0x3d63ed[_0x5da5('0xd4')]=_0x3d63ed[_0x5da5('0xd4')]>0x0?_0x3d63ed['temp']:0x0;loggerCatch(_0x5da5('0xd5'))(_0x44cf3b);});};Dialer[_0x5da5('0x1f')]['getContactDialerIvr']=function(_0x5d8717,_0x34a740,_0x50cd17,_0x23e2c0){return BPromise[_0x5da5('0xc3')]()[_0x5da5('0x41')](cmHopper[_0x5da5('0xd6')](_0x5d8717,_0x34a740,_0x50cd17))[_0x5da5('0xbf')](function(_0x3611f7){_0x23e2c0[_0x5da5('0xd4')]-=_0x34a740;_0x23e2c0['temp']=_0x23e2c0['temp']>0x0?_0x23e2c0['temp']:0x0;loggerCatch(_0x5da5('0xd7'))(_0x3611f7);});};Dialer[_0x5da5('0x1f')][_0x5da5('0xd8')]=function(_0x4c62f4){return BPromise[_0x5da5('0xc3')]()[_0x5da5('0x41')](voiceQueueRt[_0x5da5('0xd8')](_0x4c62f4))[_0x5da5('0xbf')](loggerCatch(_0x5da5('0xd9')));};Dialer[_0x5da5('0x1f')]['moveContactManagedDialer']=function(_0x1e092d){return BPromise[_0x5da5('0xc3')]()[_0x5da5('0x41')](cmHopper['moveContactManagedDialer'](_0x1e092d))['catch'](loggerCatch(_0x5da5('0xda')));};Dialer[_0x5da5('0x1f')]['createHistory']=function(_0x3bd227){return BPromise[_0x5da5('0xc3')]()['then'](cmHopperHistory[_0x5da5('0xdb')](_0x3bd227))['catch'](loggerCatch('[createHistory]\x20'));};Dialer[_0x5da5('0x1f')]['updateOriginated']=function(_0x1b088d){if(!_['isUndefined'](_0x1b088d)&&_0x1b088d!==null){if(typeof _0x1b088d[_0x5da5('0x7c')]!==_0x5da5('0xa4')){if(_0x1b088d['originated']>0x0){_0x1b088d[_0x5da5('0x7c')]-=0x1;}else{logger[_0x5da5('0xa1')](_0x5da5('0xdc'));}}}else{logger[_0x5da5('0xa1')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype'][_0x5da5('0xdd')]=function(_0x7c38e7,_0x7a0604){var _0x416ddd=this;return function(_0x12ed7a){_0x416ddd[_0x5da5('0xc2')](_0x7a0604);logger['error'](_0x7c38e7,util[_0x5da5('0xa0')](_0x12ed7a,{'showHidden':![],'depth':null}));};};Dialer[_0x5da5('0x1f')][_0x5da5('0xde')]=function(_0x29dc0a,_0x502d47,_0x53e7ee){var _0x35fdce={'state':0x19,'statedesc':_0x5da5('0xdf')};this[_0x5da5('0xc2')](_0x502d47);this['saveInDb'](_['merge'](_0x35fdce,_[_0x5da5('0xe0')](_0x53e7ee,[_0x5da5('0xe1'),_0x5da5('0xe2'),_0x5da5('0xe3'),'VoiceQueueId','CampaignId'])),'[emptyContact][createHistory]',_0x5da5('0xe4'));logger['error'](_0x29dc0a);};Dialer[_0x5da5('0x1f')][_0x5da5('0xe5')]=function(_0x24c565){return _0x24c565===_0x5da5('0xe6');};Dialer[_0x5da5('0x1f')][_0x5da5('0xe7')]=function(_0x480e3c){return!_[_0x5da5('0x8f')](_0x480e3c)&&_0x480e3c&&!_[_0x5da5('0x8f')](_0x480e3c[_0x5da5('0x47')])&&!_[_0x5da5('0x8f')](_0x480e3c[_0x5da5('0x81')])&&_0x480e3c['active']&&(this[_0x5da5('0x27')][util[_0x5da5('0x82')]('SIP/%s',_0x480e3c[_0x5da5('0x47')])][_0x5da5('0xbd')]===_0x5da5('0xe8')||this[_0x5da5('0x27')][util[_0x5da5('0x82')](_0x5da5('0xe9'),_0x480e3c[_0x5da5('0x47')])][_0x5da5('0xbd')]===_0x5da5('0xea'));};Dialer[_0x5da5('0x1f')]['saveInDb']=function(_0x3514b3,_0x327c1f,_0x33e78f){this['createHistory'](_0x3514b3)[_0x5da5('0xbf')](loggerCatch(_0x327c1f));this['moveContactManagedDialer'](_0x3514b3)['catch'](loggerCatch(_0x33e78f));};Dialer['prototype'][_0x5da5('0x3c')]=function(_0x30b0f3){var _0x1f06ad=this[_0x5da5('0x2b')][_0x30b0f3['uniqueid']];var _0x2e341c;if(!_[_0x5da5('0xbb')](_0x30b0f3)&&!_[_0x5da5('0xbb')](_0x30b0f3[_0x5da5('0xeb')])&&!_[_0x5da5('0xbb')](_0x30b0f3[_0x5da5('0xeb')][_0x5da5('0xec')])&&_0x30b0f3['exten']===_0x5da5('0xed')&&_0x1f06ad){if(_0x1f06ad[_0x5da5('0x55')]!==_0x5da5('0x9b')&&this[_0x5da5('0x24')][_0x1f06ad['queue']][_0x5da5('0xee')]&&_0x30b0f3[_0x5da5('0xef')]==='HANGUP'){delete this[_0x5da5('0x2b')][_0x30b0f3[_0x5da5('0xf0')]];this[_0x5da5('0xc2')](this[_0x5da5('0x24')][_0x1f06ad['queue']]);this['voiceQueues'][_0x1f06ad[_0x5da5('0xc1')]][_0x5da5('0x69')]+=0x1;this[_0x5da5('0x24')][_0x1f06ad['queue']][_0x5da5('0x68')]+=0x1;_0x2e341c=new Hangup(_0x1f06ad,_0x30b0f3);_0x2e341c['state']=0x12;_0x2e341c['statedesc']=_0x5da5('0xf1');_0x2e341c[_0x5da5('0xf2')]=_0x5da5('0xf3');ami['emit'](_0x5da5('0xf4'),ut['buildObj'](_0x2e341c,'amd'));this[_0x5da5('0xf5')](_0x2e341c,_0x5da5('0xf6'),_0x5da5('0xf7'));}if(_0x1f06ad['type']!=='ivr'&&this[_0x5da5('0x24')][_0x1f06ad[_0x5da5('0xc1')]]['dialAMDActive']&&_0x30b0f3['value']===_0x5da5('0xf8')){var _0x4c7107=this;return new BPromise(function(_0x20b172,_0xd88d3b){delete _0x4c7107[_0x5da5('0x2b')][_0x30b0f3[_0x5da5('0xf0')]];_0x4c7107[_0x5da5('0xc2')](_0x4c7107[_0x5da5('0x24')][_0x1f06ad[_0x5da5('0xc1')]]);_0x4c7107[_0x5da5('0x24')][_0x1f06ad[_0x5da5('0xc1')]][_0x5da5('0x69')]+=0x1;_0x4c7107[_0x5da5('0x24')][_0x1f06ad[_0x5da5('0xc1')]][_0x5da5('0x68')]+=0x1;var _0x46d16b=_0x4c7107['voiceQueues'][_0x1f06ad['queue']];var _0x4486b8=new Hangup(_0x1f06ad,_0x30b0f3);_0x4486b8[_0x5da5('0xb3')]=0x13;_0x4486b8[_0x5da5('0xb4')]=_0x5da5('0xf9');_0x4486b8[_0x5da5('0xf2')]='AMD';_0x4486b8[_0x5da5('0xfa')]+=0x1;_0x4486b8[_0x5da5('0xfb')]+=0x1;_0x4486b8[_0x5da5('0xfc')]=!![];ami['emit'](_0x5da5('0xf4'),ut[_0x5da5('0xfd')](_0x4486b8,_0x5da5('0xfc')));_0x4c7107[_0x5da5('0xdb')](_0x4486b8)[_0x5da5('0xbf')](loggerCatch(_0x5da5('0xfe')));if(_0x4486b8[_0x5da5('0xff')]+_0x4486b8[_0x5da5('0x100')]+_0x4486b8[_0x5da5('0x101')]+_0x4486b8[_0x5da5('0x102')]+_0x4486b8[_0x5da5('0x103')]+_0x4486b8['countabandonedretry']+_0x4486b8[_0x5da5('0xfa')]+_0x4486b8[_0x5da5('0x104')]>=_0x46d16b[_0x5da5('0x105')]){_0x4c7107['stateGlobal'](_0x4486b8,_0x20b172,_0xd88d3b,_0x5da5('0x106'));}else{if(_0x4486b8['countmachineretry']>=_0x46d16b[_0x5da5('0x107')]){_0x4c7107[_0x5da5('0x108')](_0x4486b8,_0x20b172,_0xd88d3b,_0x5da5('0x109'));}else{_0x4c7107['rescheduleContact']({'active':![],'countmachineretry':_0x4486b8['countmachineretry'],'scheduledat':moment()[_0x5da5('0x10a')](_0x46d16b[_0x5da5('0x10b')],_0x5da5('0x10c'))[_0x5da5('0x82')](_0x5da5('0x10d')),'ContactId':_0x4486b8[_0x5da5('0xe1')],'ListId':_0x4486b8['ListId'],'VoiceQueueId':_0x4486b8[_0x5da5('0x10e')]||undefined,'CampaignId':_0x4486b8['CampaignId']||undefined})[_0x5da5('0xbf')](loggerCatch(_0x5da5('0x10f')));_0x20b172({'reschedule':0x1});}}});}if(_0x1f06ad[_0x5da5('0x55')]==='ivr'&&this['campaigns'][_0x1f06ad[_0x5da5('0xc1')]][_0x5da5('0xee')]&&_0x30b0f3[_0x5da5('0xef')]===_0x5da5('0x110')){delete this[_0x5da5('0x2b')][_0x30b0f3['uniqueid']];this['updateOriginated'](this[_0x5da5('0x25')][_0x1f06ad['queue']]);_0x2e341c=new Hangup(_0x1f06ad,_0x30b0f3);_0x2e341c[_0x5da5('0xb3')]=0x12;_0x2e341c[_0x5da5('0xb4')]=_0x5da5('0xf1');_0x2e341c[_0x5da5('0xf2')]=_0x5da5('0xf3');ami[_0x5da5('0x54')](_0x5da5('0xf4'),ut['buildObj'](_0x2e341c,_0x5da5('0xfc')));this[_0x5da5('0xf5')](_0x2e341c,_0x5da5('0x111'),_0x5da5('0x112'));}if(_0x1f06ad[_0x5da5('0x55')]==='ivr'&&this[_0x5da5('0x25')][_0x1f06ad[_0x5da5('0xc1')]][_0x5da5('0xee')]&&_0x30b0f3[_0x5da5('0xef')]===_0x5da5('0xf8')){var _0x4c7107=this;return new BPromise(function(_0x430940,_0x2b0d5){delete _0x4c7107['uniqueId'][_0x30b0f3['uniqueid']];_0x4c7107['updateOriginated'](_0x4c7107[_0x5da5('0x25')][_0x1f06ad[_0x5da5('0xc1')]]);_0x4c7107[_0x5da5('0x25')][_0x1f06ad['queue']][_0x5da5('0x69')]+=0x1;_0x4c7107[_0x5da5('0x25')][_0x1f06ad['queue']][_0x5da5('0x68')]+=0x1;var _0xcba1bc=_0x4c7107[_0x5da5('0x25')][_0x1f06ad[_0x5da5('0xc1')]];var _0x5f2d23=new Hangup(_0x1f06ad,_0x30b0f3);_0x5f2d23[_0x5da5('0xb3')]=0x13;_0x5f2d23['statedesc']=_0x5da5('0xf9');_0x5f2d23[_0x5da5('0xf2')]='AMD';_0x5f2d23[_0x5da5('0xfa')]+=0x1;_0x5f2d23[_0x5da5('0xfb')]+=0x1;_0x5f2d23[_0x5da5('0xfc')]=!![];ami[_0x5da5('0x54')](_0x5da5('0xf4'),ut[_0x5da5('0xfd')](_0x5f2d23,_0x5da5('0xfc')));_0x4c7107[_0x5da5('0xdb')](_0x5f2d23)[_0x5da5('0xbf')](loggerCatch(_0x5da5('0xfe')));if(_0x5f2d23[_0x5da5('0xff')]+_0x5f2d23[_0x5da5('0x100')]+_0x5f2d23[_0x5da5('0x101')]+_0x5f2d23[_0x5da5('0x102')]+_0x5f2d23[_0x5da5('0x103')]+_0x5f2d23[_0x5da5('0x113')]+_0x5f2d23[_0x5da5('0xfa')]+_0x5f2d23[_0x5da5('0x104')]>=_0xcba1bc[_0x5da5('0x105')]){_0x4c7107[_0x5da5('0x114')](_0x5f2d23,_0x430940,_0x2b0d5,_0x5da5('0x106'));}else{if(_0x5f2d23[_0x5da5('0xfa')]>=_0xcba1bc[_0x5da5('0x107')]){_0x4c7107[_0x5da5('0x108')](_0x5f2d23,_0x430940,_0x2b0d5,_0x5da5('0x109'));}else{_0x4c7107[_0x5da5('0xcf')]({'active':![],'countmachineretry':_0x5f2d23[_0x5da5('0xfa')],'scheduledat':moment()[_0x5da5('0x10a')](_0xcba1bc[_0x5da5('0x10b')],_0x5da5('0x10c'))[_0x5da5('0x82')](_0x5da5('0x10d')),'ContactId':_0x5f2d23[_0x5da5('0xe1')],'ListId':_0x5f2d23[_0x5da5('0xe2')],'VoiceQueueId':_0x5f2d23[_0x5da5('0x10e')]||undefined,'CampaignId':_0x5f2d23[_0x5da5('0x115')]||undefined})[_0x5da5('0xbf')](loggerCatch(_0x5da5('0x10f')));_0x430940({'reschedule':0x1});}}});}}};Dialer[_0x5da5('0x1f')][_0x5da5('0x39')]=function(_0x4ae286){var _0x484f7f=this[_0x5da5('0x2b')][_0x4ae286[_0x5da5('0xf0')]];var _0x5c79ce=this;var _0x56f661;if(_0x484f7f&&_0x484f7f[_0x5da5('0x55')]===_0x5da5('0x9b')){delete this[_0x5da5('0x2b')][_0x4ae286[_0x5da5('0xf0')]];this[_0x5da5('0xc2')](this[_0x5da5('0x25')][_0x484f7f[_0x5da5('0xc1')]]);this['campaigns'][_0x484f7f[_0x5da5('0xc1')]][_0x5da5('0x116')]+=0x1;_0x56f661=new Hangup(_0x484f7f,_0x4ae286);this[_0x5da5('0xdb')](_0x56f661)[_0x5da5('0xbf')](loggerCatch(_0x5da5('0x117')));this['moveContactManagedDialer'](_0x56f661)['catch'](loggerCatch(_0x5da5('0x118')));}if(_0x484f7f&&_0x484f7f[_0x5da5('0x55')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x484f7f[_0x5da5('0xc1')]][_0x5da5('0x119')])){delete this[_0x5da5('0x2b')][_0x4ae286['uniqueid']];this[_0x5da5('0xc2')](this[_0x5da5('0x24')][_0x484f7f['queue']]);this['voiceQueues'][_0x484f7f[_0x5da5('0xc1')]][_0x5da5('0x69')]+=0x1;this[_0x5da5('0x24')][_0x484f7f[_0x5da5('0xc1')]][_0x5da5('0x68')]+=0x1;_0x56f661=new Hangup(_0x484f7f,_0x4ae286);_0x56f661[_0x5da5('0xb3')]=0x10;_0x56f661[_0x5da5('0xb4')]='AnswerAGI';_0x56f661[_0x5da5('0xf2')]='AGI';this[_0x5da5('0xdb')](_0x56f661)[_0x5da5('0xbf')](loggerCatch(_0x5da5('0x117')));this[_0x5da5('0x11a')](_0x56f661)[_0x5da5('0xbf')](loggerCatch(_0x5da5('0x118')));}if(_0x484f7f&&_0x484f7f[_0x5da5('0x55')]!==_0x5da5('0x9b')&&!isNotNull(this[_0x5da5('0x24')][_0x484f7f[_0x5da5('0xc1')]][_0x5da5('0x119')])){delete this['uniqueId'][_0x4ae286[_0x5da5('0xf0')]];this[_0x5da5('0xc2')](this[_0x5da5('0x24')][_0x484f7f['queue']]);this[_0x5da5('0x24')][_0x484f7f[_0x5da5('0xc1')]][_0x5da5('0x72')]+=0x1;_0x56f661=new Hangup(_0x484f7f,_0x4ae286);_0x56f661[_0x5da5('0xb3')]=0xc;_0x56f661[_0x5da5('0xb4')]=_0x4ae286[_0x5da5('0x11b')];_0x56f661[_0x5da5('0xf2')]='Unknow';this['createHistory'](_0x56f661)[_0x5da5('0xbf')](loggerCatch(_0x5da5('0x117')));this[_0x5da5('0x11a')](_0x56f661)[_0x5da5('0xbf')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x5da5('0x1f')][_0x5da5('0x11c')]=function(_0x5705ab){var _0x406667=this[_0x5da5('0x2b')][_0x5705ab[_0x5da5('0xf0')]];var _0x5c2ae8=this;if(this[_0x5da5('0x24')][_0x5705ab[_0x5da5('0xc1')]]){if(_0x406667&&_0x406667['type']!==_0x5da5('0x9b')){delete this[_0x5da5('0x2b')][_0x5705ab[_0x5da5('0xf0')]];this[_0x5da5('0x24')][_0x5705ab[_0x5da5('0xc1')]]['outboundAnswerCallsDay']+=0x1;var _0x13b785=new AgentComplete(_0x406667,_0x5705ab);if(_0x5705ab[_0x5da5('0x11d')]===_0x5da5('0x11e')){_0x13b785[_0x5da5('0x11f')]=this[_0x5da5('0x24')][_0x5705ab[_0x5da5('0xc1')]][_0x5da5('0x120')]&&this['voiceQueues'][_0x5705ab['queue']]['dialAgiAfterHangupAgent']?moment()[_0x5da5('0x82')](_0x5da5('0x10d')):undefined;}this['createHistory'](_0x13b785)[_0x5da5('0xbf')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x13b785)[_0x5da5('0xbf')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x5da5('0x1f')]['syncAgentConnect']=function(_0xb96df1){if(this[_0x5da5('0x24')][_0xb96df1['queue']]){if(this[_0x5da5('0x2b')][_0xb96df1[_0x5da5('0xf0')]]&&this[_0x5da5('0x2b')][_0xb96df1[_0x5da5('0xf0')]][_0x5da5('0x55')]!==_0x5da5('0x9b')){this['updateOriginated'](this['voiceQueues'][_0xb96df1[_0x5da5('0xc1')]]);this[_0x5da5('0x2b')][_0xb96df1['uniqueid']][_0x5da5('0x121')]=moment()[_0x5da5('0x82')](_0x5da5('0x10d'));}}};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x5ba5ec,_0x2a7a0a){this[_0x5da5('0xdb')](_0x5ba5ec)[_0x5da5('0xbf')](loggerCatch(_0x5da5('0x122')));if(_0x2a7a0a==0x0){this['moveContactManagedDialer'](_0x5ba5ec)[_0x5da5('0xbf')](loggerCatch(_0x5da5('0x123')));}};Dialer[_0x5da5('0x1f')][_0x5da5('0x34')]=function(_0x508dc0){var _0x48bc3e=this[_0x5da5('0x2b')][_0x508dc0[_0x5da5('0xf0')]];var _0x43cfb6=this;var _0x4eca61=![];var _0x179f00;var _0x207fb7;if(this['voiceQueues'][_0x508dc0['queue']]){if(_0x48bc3e&&_0x48bc3e[_0x5da5('0x55')]!=='ivr'){delete this[_0x5da5('0x2b')][_0x508dc0[_0x5da5('0xf0')]];this[_0x5da5('0xc2')](this[_0x5da5('0x24')][_0x508dc0['queue']]);_0x48bc3e['droptime']=moment()[_0x5da5('0x82')](_0x5da5('0x10d'));var _0x206b3b=new QueueCallerAbandon(_0x48bc3e,_0x508dc0);if(getSeconds(_0x48bc3e[_0x5da5('0x124')],_0x48bc3e[_0x5da5('0x125')])>=_0x48bc3e[_0x5da5('0x126')]){this[_0x5da5('0x24')][_0x508dc0[_0x5da5('0xc1')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x5da5('0x24')][_0x508dc0[_0x5da5('0xc1')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x508dc0[_0x5da5('0xc1')]][_0x5da5('0x127')]+=0x1;_0x206b3b['state']=0xa;_0x206b3b[_0x5da5('0xb4')]=_0x5da5('0x128');_0x206b3b['dropreason']=_0x5da5('0x129');_0x206b3b['agiafterat']=this[_0x5da5('0x24')][_0x508dc0[_0x5da5('0xc1')]][_0x5da5('0x120')]?moment()[_0x5da5('0x82')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x206b3b[_0x5da5('0x103')]+=0x1;_0x206b3b[_0x5da5('0xfb')]+=0x1;_0x179f00=this[_0x5da5('0x24')][_0x508dc0[_0x5da5('0xc1')]]['dialDropRetryFrequency'];_0x207fb7=this[_0x5da5('0x24')][_0x508dc0[_0x5da5('0xc1')]]['callAdditionalPhoneAfterMin'];_0x43cfb6[_0x5da5('0xc8')](_0x206b3b,_0x206b3b[_0x5da5('0xb3')],_0x48bc3e[_0x5da5('0x12a')])[_0x5da5('0x41')](function(_0x2372ce){_0x4eca61=_0x2372ce[_0x5da5('0x12b')]==0x1;if(_0x206b3b[_0x5da5('0x103')]>=_0x43cfb6[_0x5da5('0x24')][_0x508dc0[_0x5da5('0xc1')]][_0x5da5('0x12c')]){_0x43cfb6[_0x5da5('0x12d')](_0x206b3b,_0x2372ce[_0x5da5('0x12b')]);}else{_0x43cfb6[_0x5da5('0xcf')]({'active':![],'countdropretry':_0x206b3b['countdropretry'],'scheduledat':moment()['add'](_0x43cfb6['voiceQueues'][_0x508dc0['queue']][_0x5da5('0x12e')],_0x5da5('0x10c'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x48bc3e[_0x5da5('0xe1')],'ListId':_0x48bc3e['ListId'],'VoiceQueueId':_0x48bc3e[_0x5da5('0x10e')]||undefined,'CampaignId':_0x48bc3e[_0x5da5('0x115')]||undefined})['catch'](loggerCatch(_0x5da5('0x12f')));var _0x573b74=new History(_0x206b3b);_0x573b74[_0x5da5('0xb3')]=0xa;_0x573b74[_0x5da5('0xb4')]=_0x5da5('0x128');_0x573b74['starttime']=moment()['format'](_0x5da5('0x10d'));_0x573b74[_0x5da5('0xb5')]=_0x573b74[_0x5da5('0xb6')];_0x573b74[_0x5da5('0x130')]=_0x206b3b[_0x5da5('0x130')];_0x573b74[_0x5da5('0x131')]=_0x206b3b[_0x5da5('0x131')];_0x43cfb6[_0x5da5('0xdb')](_0x573b74)[_0x5da5('0xbf')](loggerCatch(_0x5da5('0x132')));}})['then'](function(_0x7ae1ed){if(_0x4eca61)_0x43cfb6[_0x5da5('0xca')](_0x206b3b,_0x179f00,_0x207fb7)[_0x5da5('0x41')](function(_0x5c84dc){return 0x1;});});}else{this[_0x5da5('0x24')][_0x508dc0[_0x5da5('0xc1')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x5da5('0x24')][_0x508dc0['queue']][_0x5da5('0x133')]+=0x1;_0x206b3b[_0x5da5('0xb3')]=0xb;_0x206b3b[_0x5da5('0xb4')]=_0x5da5('0x134');_0x206b3b[_0x5da5('0x135')]=_0x5da5('0x136');_0x206b3b['countabandonedretry']+=0x1;_0x206b3b['countglobal']+=0x1;_0x179f00=this[_0x5da5('0x24')][_0x508dc0[_0x5da5('0xc1')]]['dialAbandonedRetryFrequency'];_0x207fb7=this[_0x5da5('0x24')][_0x508dc0[_0x5da5('0xc1')]][_0x5da5('0x137')];_0x43cfb6['verifyAdditionalPhones'](_0x206b3b,_0x206b3b[_0x5da5('0xb3')],_0x48bc3e['voiceQueue'])['then'](function(_0x2ab148){if(_0x206b3b[_0x5da5('0x113')]>=_0x43cfb6['voiceQueues'][_0x508dc0[_0x5da5('0xc1')]]['dialAbandonedMaxRetry']){_0x43cfb6[_0x5da5('0x12d')](_0x206b3b,_0x2ab148[_0x5da5('0x12b')]);}else{_0x43cfb6[_0x5da5('0xcf')]({'active':![],'countabandonedretry':_0x206b3b[_0x5da5('0x113')],'scheduledat':moment()['add'](_0x43cfb6[_0x5da5('0x24')][_0x508dc0[_0x5da5('0xc1')]][_0x5da5('0x138')],_0x5da5('0x10c'))[_0x5da5('0x82')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x48bc3e[_0x5da5('0xe1')],'ListId':_0x48bc3e[_0x5da5('0xe2')],'VoiceQueueId':_0x48bc3e[_0x5da5('0x10e')]||undefined,'CampaignId':_0x48bc3e[_0x5da5('0x115')]||undefined})[_0x5da5('0xbf')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x18a719=new History(_0x206b3b);_0x18a719['state']=0xb;_0x18a719['statedesc']=_0x5da5('0x134');_0x18a719['starttime']=moment()[_0x5da5('0x82')](_0x5da5('0x10d'));_0x18a719[_0x5da5('0xb5')]=_0x18a719[_0x5da5('0xb6')];_0x18a719[_0x5da5('0x130')]=_0x206b3b[_0x5da5('0x130')];_0x18a719[_0x5da5('0x131')]=_0x206b3b[_0x5da5('0x131')];_0x43cfb6[_0x5da5('0xdb')](_0x18a719)[_0x5da5('0xbf')](loggerCatch(_0x5da5('0x139')));}})[_0x5da5('0x41')](function(_0x41e2e5){if(_0x4eca61)_0x43cfb6['swapAdditionalPhones'](_0x206b3b,_0x179f00,_0x207fb7)['then'](function(_0x5f4410){return 0x1;});});}}}};Dialer[_0x5da5('0x1f')][_0x5da5('0x3a')]=function(_0x296302){if(this[_0x5da5('0x2a')][_0x296302[_0x5da5('0xf0')]]){this['actions'][_0x296302[_0x5da5('0xf0')]][_0x5da5('0xbe')]=_0x296302[_0x5da5('0xbe')];}if(this[_0x5da5('0x2b')][_0x296302[_0x5da5('0xf0')]]){this['uniqueId'][_0x296302[_0x5da5('0xf0')]][_0x5da5('0xbe')]=_0x296302[_0x5da5('0xbe')];}};Dialer[_0x5da5('0x1f')]['syncQueueMember']=function(_0x1ca547){if(strategy[this[_0x5da5('0x24')][this[_0x5da5('0x2a')][_0x1ca547[_0x5da5('0x13a')]]['queue']][_0x5da5('0x57')]]===_0x5da5('0x1e')){if(this['actions'][_0x1ca547[_0x5da5('0x13a')]]&&_[_0x5da5('0xbb')](this[_0x5da5('0x2a')][_0x1ca547[_0x5da5('0x13a')]]['locked'])&&_0x1ca547[_0x5da5('0xbd')]==='1'&&_0x1ca547[_0x5da5('0x13b')]==='0'){if(this[_0x5da5('0x26')][_0x1ca547[_0x5da5('0x13c')]]){if(!this[_0x5da5('0x26')][_0x1ca547[_0x5da5('0x13c')]][_0x5da5('0x13d')]){this[_0x5da5('0x26')][_0x1ca547[_0x5da5('0x13c')]][_0x5da5('0x13d')]=!![];this[_0x5da5('0x2a')][_0x1ca547[_0x5da5('0x13a')]][_0x5da5('0x13d')]=!![];this['actions'][_0x1ca547[_0x5da5('0x13a')]][_0x5da5('0x13c')]=_0x1ca547[_0x5da5('0x13c')];}}}}else if((strategy[this[_0x5da5('0x24')][this[_0x5da5('0x2a')][_0x1ca547[_0x5da5('0x13a')]][_0x5da5('0xc1')]][_0x5da5('0x57')]]||_0x5da5('0x13e'))===_0x5da5('0x13e')){if(this[_0x5da5('0x2a')][_0x1ca547[_0x5da5('0x13a')]]){if(this[_0x5da5('0x26')][_0x1ca547[_0x5da5('0x13c')]]){this[_0x5da5('0x2a')][_0x1ca547[_0x5da5('0x13a')]][_0x5da5('0x13c')]=_0x1ca547[_0x5da5('0x13c')];if(_[_0x5da5('0xbb')](this[_0x5da5('0x30')][this[_0x5da5('0x2a')][_0x1ca547[_0x5da5('0x13a')]][_0x5da5('0xc1')]])){this[_0x5da5('0x30')][this[_0x5da5('0x2a')][_0x1ca547[_0x5da5('0x13a')]][_0x5da5('0xc1')]]=[];}this[_0x5da5('0x30')][this[_0x5da5('0x2a')][_0x1ca547[_0x5da5('0x13a')]]['queue']][_0x5da5('0x13f')](_[_0x5da5('0x96')](_[_0x5da5('0xe0')](this['actions'][_0x1ca547[_0x5da5('0x13a')]],[_0x5da5('0x140'),_0x5da5('0x13c')]),{'status':_0x1ca547['status'],'paused':_0x1ca547[_0x5da5('0x13b')]}));}}}};function unlockQueueStatus(_0x80e8d2,_0x418e54){setTimeout(function(){if(_[_0x5da5('0x8f')](_0x80e8d2[_0x5da5('0x141')])){loggerBooked[_0x5da5('0xa1')](_0x5da5('0x142'),_0x418e54);}_0x80e8d2[_0x5da5('0x141')]=!![];loggerBooked[_0x5da5('0x86')]('[booked][unlockQueueStatus]',_0x418e54,JSON[_0x5da5('0x50')](_[_0x5da5('0xe0')](_0x80e8d2,[_0x5da5('0x47'),_0x5da5('0x141')])));},0x1f3);}Dialer['prototype'][_0x5da5('0x3f')]=function(_0x2cbe2e){var _0xa41f22=this;var _0x182053=_0xa41f22[_0x5da5('0x24')][_0xa41f22[_0x5da5('0x2a')][_0x2cbe2e['actionid']]['queue']];if(strategy[this[_0x5da5('0x24')][this[_0x5da5('0x2a')][_0x2cbe2e[_0x5da5('0x13a')]]['queue']][_0x5da5('0x57')]]===_0x5da5('0x1e')){if(this[_0x5da5('0x2a')][_0x2cbe2e[_0x5da5('0x13a')]]&&this[_0x5da5('0x2a')][_0x2cbe2e[_0x5da5('0x13a')]][_0x5da5('0x13c')]){this[_0x5da5('0x23')][_0x5da5('0x143')](this[_0x5da5('0x2a')][_0x2cbe2e[_0x5da5('0x13a')]][_0x5da5('0x140')],this[_0x5da5('0x2a')][_0x2cbe2e[_0x5da5('0x13a')]][_0x5da5('0x13c')])['catch'](function(_0xc81d6f){logger[_0x5da5('0xa1')](_0x5da5('0x144'),util[_0x5da5('0xa0')](_0xc81d6f,{'showHidden':![],'depth':null}));})['finally'](function(){_0xa41f22[_0x5da5('0xc2')](_0xa41f22[_0x5da5('0x24')][_0xa41f22[_0x5da5('0x2a')][_0x2cbe2e['actionid']][_0x5da5('0xc1')]]);_0xa41f22[_0x5da5('0x26')][_0xa41f22[_0x5da5('0x2a')][_0x2cbe2e['actionid']][_0x5da5('0x13c')]]['locked']=![];delete _0xa41f22[_0x5da5('0x2a')][_0x2cbe2e[_0x5da5('0x13a')]];unlockQueueStatus(_0x182053);});}else{this[_0x5da5('0xc2')](this[_0x5da5('0x24')][this['actions'][_0x2cbe2e[_0x5da5('0x13a')]][_0x5da5('0xc1')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x5da5('0x2a')][_0x2cbe2e[_0x5da5('0x13a')]][_0x5da5('0xe1')],'ListId':this[_0x5da5('0x2a')][_0x2cbe2e[_0x5da5('0x13a')]][_0x5da5('0xe2')],'VoiceQueueId':this[_0x5da5('0x2a')][_0x2cbe2e[_0x5da5('0x13a')]][_0x5da5('0x10e')]||undefined,'CampaignId':this[_0x5da5('0x2a')][_0x2cbe2e['actionid']][_0x5da5('0x115')]||undefined})[_0x5da5('0xbf')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x5da5('0x2a')][_0x2cbe2e[_0x5da5('0x13a')]];unlockQueueStatus(_0x182053);}}else if((strategy[this[_0x5da5('0x24')][this[_0x5da5('0x2a')][_0x2cbe2e['actionid']][_0x5da5('0xc1')]]['strategy']]||_0x5da5('0x13e'))==='rrmemory'){var _0xf575cd;if(this[_0x5da5('0x2a')][_0x2cbe2e['actionid']]&&!_[_0x5da5('0x4d')](this['queueBooked'][this[_0x5da5('0x2a')][_0x2cbe2e['actionid']][_0x5da5('0xc1')]])){if(this['queueBookedRR'][_0xa41f22['actions'][_0x2cbe2e[_0x5da5('0x13a')]][_0x5da5('0xc1')]]){this[_0x5da5('0x145')][_0xa41f22[_0x5da5('0x2a')][_0x2cbe2e[_0x5da5('0x13a')]][_0x5da5('0xc1')]]=this[_0x5da5('0x145')][this[_0x5da5('0x2a')][_0x2cbe2e[_0x5da5('0x13a')]][_0x5da5('0xc1')]]?this[_0x5da5('0x145')][this[_0x5da5('0x2a')][_0x2cbe2e['actionid']]['queue']]:this[_0x5da5('0x30')][this['actions'][_0x2cbe2e[_0x5da5('0x13a')]][_0x5da5('0xc1')]]?this[_0x5da5('0x30')][this[_0x5da5('0x2a')][_0x2cbe2e[_0x5da5('0x13a')]][_0x5da5('0xc1')]][_0x5da5('0x146')]||0x0:0x0;}this[_0x5da5('0x30')][this[_0x5da5('0x2a')][_0x2cbe2e[_0x5da5('0x13a')]][_0x5da5('0xc1')]][_0x5da5('0x146')]=this[_0x5da5('0x145')][this['actions'][_0x2cbe2e[_0x5da5('0x13a')]][_0x5da5('0xc1')]];for(var _0x591e93=0x0;_0x591e93=0x0;})[_0x5da5('0xbf')](myreject(_0x1df80b)));}}else{_0x5c4113[_0x5da5('0x13f')](ami[_0x5da5('0xbc')]({'action':_0x5da5('0x15e'),'command':util[_0x5da5('0x82')](_0x5da5('0x15f'),_0x45c508,!_['isUndefined'](config['timezones'][_0x3cd2be])?_0x3cd2be:'')})[_0x5da5('0x41')](function(_0x21c9a3){return _0x21c9a3[_0x5da5('0x160')][_0x5da5('0x161')](_0x5da5('0x162'))>=0x0;})[_0x5da5('0xbf')](myreject(_0x1df80b)));}BPromise[_0x5da5('0x163')](_0x5c4113)[_0x5da5('0x41')](function(_0x3c5d7a){var _0xc65edc=_[_0x5da5('0x164')](_0x3c5d7a);if(_0xc65edc){return _0x5b2f21(_0xc65edc);}else{_0x11aa7d[_0x5da5('0x45')]=_0x123e68?'GLOBAL_INTERVAL_IS_OVERTIME':'INTERVAL_IS_OVERTIME';return _0x1df80b(msgResponse(_0x5da5('0x165'),'Failure',_0x5da5('0x166')+_0x123e68+'\x20'+_0x4b26ec+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x45c508,{'showHidden':![],'depth':null})+_0x5da5('0x167')+_0x3cd2be));}})[_0x5da5('0xbf')](function(_0x8eb7e9){return _0x1df80b(msgResponse(_0x5da5('0x156'),_0x5da5('0x157'),JSON[_0x5da5('0x50')](_0x8eb7e9)));});});};Dialer[_0x5da5('0x1f')][_0x5da5('0x168')]=function(_0x45a53b){var _0x14d173=this;return function(){switch(_0x45a53b[_0x5da5('0x63')]){case _0x5da5('0x169'):freeVariablesPredictive(_0x45a53b);_0x14d173[_0x5da5('0x16a')](_0x45a53b,0x1);break;case _0x5da5('0x16b'):freeVariablesPredictive(_0x45a53b);_0x14d173[_0x5da5('0x16a')](_0x45a53b,_0x45a53b[_0x5da5('0x16c')]);break;case _0x5da5('0x9'):_0x14d173[_0x5da5('0x9')](_0x45a53b);break;case _0x5da5('0x8'):freeVariablesPredictive(_0x45a53b);_0x14d173[_0x5da5('0x16a')](_0x45a53b,0x1);break;default:freeVariablesPredictive(_0x45a53b);logger[_0x5da5('0xa1')](_0x5da5('0x16d'),_0x45a53b[_0x5da5('0x47')],_0x5da5('0x16e'));}};};Dialer[_0x5da5('0x1f')][_0x5da5('0x16f')]=function(_0x218df7){var _0x170c5c=this;return function(){_0x170c5c[_0x5da5('0x170')](_0x218df7);};};Dialer[_0x5da5('0x1f')][_0x5da5('0xc')]=function(_0x5efd3d){var _0x58f1cd=this;if(isNotPreview(_0x5efd3d[_0x5da5('0x63')])){if(isVoiceQueueOutbound(_0x5efd3d[_0x5da5('0x55')])&&isActive(_0x5efd3d[_0x5da5('0x62')])){_0x5efd3d[_0x5da5('0xac')]=!![];BPromise[_0x5da5('0xc3')]()['then'](checkIsLoggedIn(_0x5efd3d,_0x5efd3d['loggedIn']))[_0x5da5('0x41')](checkIsActive(_0x5efd3d,_0x5efd3d[_0x5da5('0x62')]))[_0x5da5('0x41')](checkInterval(_0x5efd3d))[_0x5da5('0x41')](_0x58f1cd[_0x5da5('0x151')](_0x5efd3d))[_0x5da5('0x41')](_0x58f1cd[_0x5da5('0x155')](_0x5efd3d[_0x5da5('0x171')],_0x5efd3d[_0x5da5('0x172')],_0x5efd3d['name'],_0x5efd3d))[_0x5da5('0x41')](_0x58f1cd[_0x5da5('0x173')](_0x5efd3d[_0x5da5('0x49')],_0x5efd3d['dialTimezone'],_0x5efd3d['name'],_0x5efd3d))[_0x5da5('0x41')](_0x58f1cd[_0x5da5('0x168')](_0x5efd3d))[_0x5da5('0xbf')](loggerCatchQueueSummary(_0x5da5('0x174'),_0x5efd3d));}else{notSendMessagesQueue(_0x5efd3d);}}else{freeVariablesPredictive(_0x5efd3d);}};Dialer[_0x5da5('0x1f')][_0x5da5('0x38')]=_[_0x5da5('0x175')](function(){var _0x3c8554=_['filter'](this['voiceQueues'],function(_0x8a4e2d){return _0x8a4e2d[_0x5da5('0x176')];});var _0x5c9b59=_[_0x5da5('0x177')](this['agents'],function(_0x2f342c){return _0x2f342c['online']&&_0x2f342c[_0x5da5('0xbd')]===_0x5da5('0xe8');});if(_0x3c8554[_0x5da5('0xa3')]>0x0&&_0x5c9b59['length']>0x0){return BPromise['resolve']()[_0x5da5('0x41')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x3c8554,'id'),previewRecallmeReminderInterval,_['map'](_0x5c9b59,'id')))[_0x5da5('0x41')](function(_0xe1adb8){for(var _0x3f9c70=0x0;_0x3f9c70<_0xe1adb8[_0x5da5('0xa3')];_0x3f9c70++){var _0xfb85ae=_0xe1adb8[_0x3f9c70]['Agent'][_0x5da5('0x47')];if(_0xfb85ae)io['to'](util[_0x5da5('0x82')](_0x5da5('0x178'),_0xfb85ae))[_0x5da5('0x54')](_0x5da5('0x179'),{'hopper':_0xe1adb8[_0x3f9c70]});}})[_0x5da5('0xbf')](function(_0x4cdb94){logger[_0x5da5('0xa1')](_0x5da5('0x17a'),_0x4cdb94);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x5da5('0x1f')][_0x5da5('0x150')]=function(){var _0x42ce04=this;var _0x391fce;for(var _0x1d7713 in this[_0x5da5('0x25')]){if(typeof this[_0x5da5('0x25')][_0x1d7713]!==_0x5da5('0xa4')){_0x391fce=this[_0x5da5('0x25')][_0x1d7713];if(isCampaignIvr(_0x391fce[_0x5da5('0x55')])&&isActive(_0x391fce['active'])){_0x391fce['sendMessageOneNotActive']=!![];BPromise[_0x5da5('0xc3')]()['then'](checkIsActive(_0x391fce,_0x391fce[_0x5da5('0x81')]))[_0x5da5('0x41')](checkInterval(_0x391fce))[_0x5da5('0x41')](_0x42ce04['checkIsTrunkReachable'](_0x391fce))['then'](_0x42ce04[_0x5da5('0x155')](_0x391fce[_0x5da5('0x171')],_0x391fce[_0x5da5('0x172')],_0x391fce[_0x5da5('0x47')],_0x391fce))[_0x5da5('0x41')](_0x42ce04['checkIfTimeIntervals'](_0x391fce[_0x5da5('0x49')],_0x391fce[_0x5da5('0x172')],_0x391fce[_0x5da5('0x47')],_0x391fce))['then'](_0x42ce04[_0x5da5('0x16f')](_0x391fce))[_0x5da5('0xbf')](loggerCatchQueueSummary(_0x5da5('0x17b'),_0x391fce));}else{notSendMessagesCampaign(_0x391fce);}}}};function getCallerIdRandom(_0x13d8e5,_0x105b87){var _0x528d2a;var _0x156a27;var _0x335db8;if(_0x105b87<=0x0){_0x105b87=0x1;}_0x528d2a=new RegExp(_0x5da5('0x17c')+_0x105b87+'}$');_0x156a27=Math[_0x5da5('0x17d')](0xa,_0x105b87-0x1);_0x335db8=Math[_0x5da5('0x17d')](0xa,_0x105b87)-0x1;return util[_0x5da5('0x82')]('%s',_[_0x5da5('0x17e')](_0x13d8e5,_0x528d2a,_[_0x5da5('0x17f')](_0x156a27,_0x335db8)));}function extractCalleridName(_0x4a5cb0){var _0x54aa9e=_0x4a5cb0[_0x5da5('0x180')](/"(.*?)"/);return _0x54aa9e?_0x54aa9e[0x1]:_0x4a5cb0;}function extractCalleridNumber(_0x207b1d){var _0x51986a=_0x207b1d[_0x5da5('0x180')](/<(.*?)>/);return _0x51986a?_0x51986a[0x1]:_0x207b1d;}Dialer[_0x5da5('0x1f')][_0x5da5('0x181')]=function(_0x147a2f,_0x330011){var _0x18d398=this;var _0x571f3f=uuid['v4']();this['actions'][_0x571f3f]=new Action(_0x147a2f,_0x330011,_0x571f3f);return new BPromise(function(_0x1e7509,_0xeb93b0){if(_['isUndefined'](_0x147a2f)&&typeof _0x147a2f!=='object'){return _0xeb93b0(msgResponse(_0x5da5('0x182'),'Failure',_0x5da5('0x183')));}if(_['isUndefined'](_0x330011[_0x5da5('0x184')])||_0x330011[_0x5da5('0x184')]===null){return _0xeb93b0(msgResponse('originate',_0x5da5('0x157'),_0x5da5('0x185')));}var _0x5cfbc3={'XMD-CALLERID':_0x18d398[_0x5da5('0x2a')][_0x571f3f][_0x5da5('0x186')](),'XMD-AGI':_0x147a2f[_0x5da5('0x119')]?util[_0x5da5('0x82')](_0x5da5('0x187'),ipAgi,_0x147a2f[_0x5da5('0x119')]):'NONE','XMD-AGIAFTER':_0x147a2f[_0x5da5('0x120')]?util[_0x5da5('0x82')](_0x5da5('0x187'),ipAgi,_0x147a2f['dialQueueProject2']):_0x5da5('0x188'),'XMD-QUEUE':_0x147a2f[_0x5da5('0x55')]==='outbound'?util[_0x5da5('0x82')](_0x5da5('0x189'),_0x147a2f[_0x5da5('0x47')],_0x147a2f[_0x5da5('0x18a')]||'',_0x147a2f[_0x5da5('0x18b')]?'c':'',_0x147a2f[_0x5da5('0x126')]||0x3):_0x5da5('0x188'),'XMD-CONTACTID':_0x330011[_0x5da5('0xe1')],'XMD-CDRTYPE':_0x5da5('0x7'),'CALLERID(all)':_0x18d398[_0x5da5('0x2a')][_0x571f3f]['getCaller'](),'XMD-AMD':_0x147a2f[_0x5da5('0xee')]?'ACTIVE':_0x5da5('0x188'),'XMD-DESTINATION':_0x5da5('0xed')};if(_0x147a2f[_0x5da5('0xee')]){_0x5cfbc3['XMD-AMDINITIALSILENCE']=_0x147a2f['dialAMDInitialSilence']||0x9c4;_0x5cfbc3[_0x5da5('0x18c')]=_0x147a2f[_0x5da5('0x18d')]||0x5dc;_0x5cfbc3[_0x5da5('0x18e')]=_0x147a2f[_0x5da5('0x18f')]||0x320;_0x5cfbc3[_0x5da5('0x190')]=_0x147a2f[_0x5da5('0x191')]||0x1388;_0x5cfbc3['XMD-AMDMINWORDLENGTH']=_0x147a2f['dialAMDMinWordLength']||0x64;_0x5cfbc3['XMD-AMDBETWEENWORDSSILENCE']=_0x147a2f['dialAMDBetweenWordsSilence']||0x32;_0x5cfbc3[_0x5da5('0x192')]=_0x147a2f[_0x5da5('0x193')]||0x3;_0x5cfbc3[_0x5da5('0x194')]=_0x147a2f[_0x5da5('0x195')]||0x100;_0x5cfbc3[_0x5da5('0x196')]=_0x147a2f[_0x5da5('0x197')]||0x1388;}if(_0x147a2f['type']===_0x5da5('0x56')){_0x5cfbc3[_0x5da5('0x198')]=_0x330011[_0x5da5('0x10e')];}else{_0x5cfbc3[_0x5da5('0x199')]=_0x330011[_0x5da5('0x115')];}for(var _0x4eb44d in _0x330011[_0x5da5('0x19a')]){if(typeof _0x330011[_0x5da5('0x19a')][_0x4eb44d]!==_0x5da5('0xa4')){if(isNotNull(_0x330011['Contact'][_0x4eb44d])&&_0x4eb44d!=='id'&&_0x4eb44d!==_0x5da5('0x19b')&&_0x4eb44d!==_0x5da5('0x19c')&&_0x4eb44d!==_0x5da5('0x19d')){_0x5cfbc3[util[_0x5da5('0x82')](_0x5da5('0x19e'),_0x5da5('0x19f'),_[_0x5da5('0x1a0')](_0x4eb44d))]=_0x330011['Contact'][_0x4eb44d];}}}var _0xe8e8c9=_0x18d398[_0x5da5('0xe7')](_0x147a2f[_0x5da5('0x80')])?getCallerId(_0x147a2f[_0x5da5('0x80')]['callerid'],_0x147a2f[_0x5da5('0x64')],_0x147a2f[_0x5da5('0x1a1')]>0x0?getCallerIdRandom(_0x147a2f[_0x5da5('0x65')],_0x147a2f['dialRandomLastDigitCallerIdNumber']):_0x147a2f[_0x5da5('0x65')]):getCallerId(_[_0x5da5('0xbb')](_0x147a2f['TrunkBackup'])?_0x147a2f[_0x5da5('0x80')]['callerid']:_0x147a2f['TrunkBackup']['callerid'],_0x147a2f[_0x5da5('0x64')],_0x147a2f[_0x5da5('0x1a1')]>0x0?getCallerIdRandom(_0x147a2f[_0x5da5('0x65')],_0x147a2f['dialRandomLastDigitCallerIdNumber']):_0x147a2f['dialOriginateCallerIdNumber']);if(_0xe8e8c9){_0x5cfbc3['XMD-ORIGINATECALLERIDNAME']=_0x18d398['actions'][_0x571f3f][_0x5da5('0x1a2')]=extractCalleridName(_0xe8e8c9);_0x5cfbc3['XMD-ORIGINATECALLERIDNUM']=_0x330011[_0x5da5('0x184')];}return ami[_0x5da5('0xbc')]({'actionid':_0x571f3f,'action':_0x5da5('0x182'),'channel':_0x18d398[_0x5da5('0xe7')](_0x147a2f[_0x5da5('0x80')])?util[_0x5da5('0x82')](_0x5da5('0x1a3'),_0x147a2f[_0x5da5('0x80')][_0x5da5('0x47')],isNotNull(_0x147a2f[_0x5da5('0x67')])?_0x147a2f[_0x5da5('0x67')][_0x5da5('0x1a4')]()||'':'',_0x147a2f['dialCutDigit']>0x0?_0x330011[_0x5da5('0x184')]['substring'](_0x147a2f[_0x5da5('0x1a5')]):_0x330011[_0x5da5('0x184')]):util[_0x5da5('0x82')](_0x5da5('0x1a3'),_[_0x5da5('0xbb')](_0x147a2f['TrunkBackup'])?_0x147a2f[_0x5da5('0x80')][_0x5da5('0x47')]:_0x147a2f[_0x5da5('0x152')][_0x5da5('0x47')],isNotNull(_0x147a2f[_0x5da5('0x67')])?_0x147a2f[_0x5da5('0x67')]['trim']()||'':'',_0x147a2f[_0x5da5('0x1a5')]>0x0?_0x330011['phone'][_0x5da5('0x1a6')](_0x147a2f[_0x5da5('0x1a5')]):_0x330011[_0x5da5('0x184')]),'callerid':_0xe8e8c9,'Exten':_0x5da5('0xed'),'Context':_0x5da5('0x1a7'),'Priority':'1','variable':_0x5cfbc3,'timeout':(_0x147a2f['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x571f3f})[_0x5da5('0x41')](function(_0xc4ad97){return _0x1e7509(_0xc4ad97);})[_0x5da5('0xbf')](function(_0x3a266c){_0x147a2f['outboundOriginateFailureCallsDay']+=0x1;var _0x53e6c6=new History(_0x18d398[_0x5da5('0x2a')][_0x571f3f]);logger[_0x5da5('0xa1')](util[_0x5da5('0x82')](_0x5da5('0x1a8'),JSON['stringify'](_0x3a266c)));_0x53e6c6[_0x5da5('0xb3')]=0xe;_0x53e6c6['statedesc']=_0x5da5('0x1a9');_0x53e6c6[_0x5da5('0xb6')]=moment()[_0x5da5('0x82')](_0x5da5('0x10d'));_0x53e6c6[_0x5da5('0xb5')]=_0x53e6c6[_0x5da5('0xb6')];_0x18d398[_0x5da5('0xdb')](_0x53e6c6)['catch'](loggerCatch(_0x5da5('0x1aa')));_0x18d398[_0x5da5('0x11a')](_0x53e6c6)['catch'](loggerCatch(_0x5da5('0x1aa')))[_0x5da5('0x14a')](function(){delete _0x18d398[_0x5da5('0x2a')][_0x571f3f];return _0xeb93b0(msgResponse(_0x5da5('0x182'),_0x5da5('0x4f'),'originate\x20action\x20Error'));});});});};Dialer[_0x5da5('0x1f')][_0x5da5('0x36')]=function(_0x6e6b39){var _0x5caa09=this['actions'][_0x6e6b39['actionid']];if(_0x5caa09){delete this[_0x5da5('0x2a')][_0x6e6b39[_0x5da5('0x13a')]];_0x5caa09['responsetime']=moment()[_0x5da5('0x82')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1934b8=_0x5caa09['type']===_0x5da5('0x9b')?this[_0x5da5('0x25')][_0x5caa09[_0x5da5('0xc1')]]:this[_0x5da5('0x24')][_0x5caa09[_0x5da5('0x1ab')]()];if(!this[_0x5da5('0xe5')](_0x6e6b39[_0x5da5('0x1ac')])){this['updateOriginated'](_0x1934b8);return this[_0x5da5('0x1ad')](_0x5caa09,_0x1934b8,_0x6e6b39)[_0x5da5('0xbf')](loggerCatch(_0x5da5('0x1ae')));}this[_0x5da5('0x2b')][_0x6e6b39[_0x5da5('0xf0')]]=_0x5caa09;}};Dialer[_0x5da5('0x1f')]['checkRetriveMax']=function(_0x490865,_0x390160,_0x3fb9bd){var _0x4f1e4=new History(_0x390160);if(_0x4f1e4[_0x5da5('0xff')]+_0x4f1e4[_0x5da5('0x100')]+_0x4f1e4[_0x5da5('0x101')]+_0x4f1e4[_0x5da5('0x102')]+_0x4f1e4['countdropretry']+_0x4f1e4[_0x5da5('0x113')]+_0x4f1e4[_0x5da5('0xfa')]+_0x4f1e4[_0x5da5('0x104')]>=_0x3fb9bd[_0x5da5('0x105')]-0x1){return!![];}switch(_0x490865){case 0x3:if(_0x4f1e4[_0x5da5('0x101')]>=_0x3fb9bd[_0x5da5('0x1af')]-0x1){return!![];}this[_0x5da5('0xcf')]({'active':![],'countnoanswerretry':_0x4f1e4[_0x5da5('0x101')]+=0x1,'scheduledat':moment()[_0x5da5('0x10a')](_0x3fb9bd[_0x5da5('0x1b0')],_0x5da5('0x10c'))[_0x5da5('0x82')](_0x5da5('0x10d')),'ContactId':_0x4f1e4[_0x5da5('0xe1')],'ListId':_0x4f1e4[_0x5da5('0xe2')],'VoiceQueueId':_0x4f1e4['VoiceQueueId']||undefined,'CampaignId':_0x4f1e4[_0x5da5('0x115')]||undefined})[_0x5da5('0xbf')](loggerCatch(_0x5da5('0x1b1')));break;case 0x5:if(_0x4f1e4[_0x5da5('0xff')]>=_0x3fb9bd[_0x5da5('0x1b2')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x4f1e4['countbusyretry']+=0x1,'scheduledat':moment()[_0x5da5('0x10a')](_0x3fb9bd[_0x5da5('0x1b3')],_0x5da5('0x10c'))[_0x5da5('0x82')](_0x5da5('0x10d')),'ContactId':_0x4f1e4[_0x5da5('0xe1')],'ListId':_0x4f1e4['ListId'],'VoiceQueueId':_0x4f1e4[_0x5da5('0x10e')]||undefined,'CampaignId':_0x4f1e4['CampaignId']||undefined})[_0x5da5('0xbf')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x4f1e4[_0x5da5('0x100')]>=_0x3fb9bd[_0x5da5('0x1b4')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x4f1e4[_0x5da5('0x100')]+=0x1,'scheduledat':moment()['add'](_0x3fb9bd[_0x5da5('0x1b5')],_0x5da5('0x10c'))['format'](_0x5da5('0x10d')),'ContactId':_0x4f1e4[_0x5da5('0xe1')],'ListId':_0x4f1e4[_0x5da5('0xe2')],'VoiceQueueId':_0x4f1e4[_0x5da5('0x10e')]||undefined,'CampaignId':_0x4f1e4[_0x5da5('0x115')]||undefined})[_0x5da5('0xbf')](loggerCatch(_0x5da5('0x1b6')));break;case 0x0:if(_0x4f1e4['countnosuchnumberretry']>=_0x3fb9bd[_0x5da5('0x1b7')]-0x1){return!![];}else{this[_0x5da5('0xcf')]({'active':![],'countnosuchnumberretry':_0x4f1e4[_0x5da5('0x102')]+=0x1,'scheduledat':moment()['add'](_0x3fb9bd[_0x5da5('0x1b8')],_0x5da5('0x10c'))[_0x5da5('0x82')](_0x5da5('0x10d')),'ContactId':_0x4f1e4[_0x5da5('0xe1')],'ListId':_0x4f1e4[_0x5da5('0xe2')],'VoiceQueueId':_0x4f1e4[_0x5da5('0x10e')]||undefined,'CampaignId':_0x4f1e4[_0x5da5('0x115')]||undefined})[_0x5da5('0xbf')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x4f1e4['countdropretry']>=_0x3fb9bd[_0x5da5('0x12c')]-0x1){return!![];}this[_0x5da5('0xcf')]({'active':![],'countdropretry':_0x4f1e4[_0x5da5('0x103')]+=0x1,'scheduledat':moment()[_0x5da5('0x10a')](_0x3fb9bd['dialDropRetryFrequency'],_0x5da5('0x10c'))[_0x5da5('0x82')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4f1e4[_0x5da5('0xe1')],'ListId':_0x4f1e4[_0x5da5('0xe2')],'VoiceQueueId':_0x4f1e4[_0x5da5('0x10e')]||undefined,'CampaignId':_0x4f1e4[_0x5da5('0x115')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x4f1e4[_0x5da5('0x113')]>=_0x3fb9bd[_0x5da5('0x1b9')]-0x1){return!![];}this[_0x5da5('0xcf')]({'active':![],'countabandonedretry':_0x4f1e4[_0x5da5('0x113')]+=0x1,'scheduledat':moment()[_0x5da5('0x10a')](_0x3fb9bd[_0x5da5('0x138')],_0x5da5('0x10c'))[_0x5da5('0x82')](_0x5da5('0x10d')),'ContactId':_0x4f1e4['ContactId'],'ListId':_0x4f1e4['ListId'],'VoiceQueueId':_0x4f1e4[_0x5da5('0x10e')]||undefined,'CampaignId':_0x4f1e4[_0x5da5('0x115')]||undefined})[_0x5da5('0xbf')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x4f1e4['countmachineretry']>=_0x3fb9bd['dialMachineMaxRetry']-0x1){return!![];}this[_0x5da5('0xcf')]({'active':![],'countmachineretry':_0x4f1e4[_0x5da5('0xfa')]+=0x1,'scheduledat':moment()[_0x5da5('0x10a')](_0x3fb9bd[_0x5da5('0x10b')],'minutes')[_0x5da5('0x82')](_0x5da5('0x10d')),'ContactId':_0x4f1e4[_0x5da5('0xe1')],'ListId':_0x4f1e4[_0x5da5('0xe2')],'VoiceQueueId':_0x4f1e4[_0x5da5('0x10e')]||undefined,'CampaignId':_0x4f1e4[_0x5da5('0x115')]||undefined})[_0x5da5('0xbf')](loggerCatch(_0x5da5('0x10f')));break;case 0x14:if(_0x4f1e4[_0x5da5('0x104')]>=_0x3fb9bd[_0x5da5('0x1ba')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x4f1e4['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x3fb9bd[_0x5da5('0x1bb')],_0x5da5('0x10c'))['format'](_0x5da5('0x10d')),'ContactId':_0x4f1e4['ContactId'],'ListId':_0x4f1e4[_0x5da5('0xe2')],'VoiceQueueId':_0x4f1e4[_0x5da5('0x10e')]||undefined,'CampaignId':_0x4f1e4[_0x5da5('0x115')]||undefined})[_0x5da5('0xbf')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x5da5('0x1f')][_0x5da5('0x1ad')]=function(_0x2d0043,_0x1c2186,_0x13257e){var _0x372939=this;var _0x3e9546=new History(_0x2d0043);var _0x2c2257=![];var _0x3d70e4;var _0x902cb5;return new BPromise(function(_0x1ee0db,_0x2b18e1){if(_[_0x5da5('0x8f')](_0x1c2186)&&typeof _0x1c2186!==_0x5da5('0x1bc')){return _0x2b18e1(msgResponse(_0x5da5('0x1bd'),_0x5da5('0x157'),_0x5da5('0x1be')));}if(_[_0x5da5('0x8f')](_0x13257e)&&typeof _0x13257e!==_0x5da5('0x1bc')){return _0x2b18e1(msgResponse(_0x5da5('0x1bd'),_0x5da5('0x157'),_0x5da5('0x1bf')));}_0x372939['verifyAdditionalPhones'](_0x3e9546,_0x13257e[_0x5da5('0x11d')],_0x1c2186)['then'](function(_0x3a0b6d){if(_0x3a0b6d[_0x5da5('0x12b')]==0x1)_0x2c2257=!![];switch(_0x13257e['reason']){case'0':_0x1c2186['outboundNoSuchCallsDay']+=0x1;_0x3e9546['state']=0x0;_0x3e9546[_0x5da5('0xb4')]=_0x5da5('0x1c0');_0x3e9546['countnosuchnumberretry']+=0x1;_0x3e9546[_0x5da5('0xfb')]+=0x1;ami[_0x5da5('0x54')]('custom:agentnosuchnumber',ut[_0x5da5('0xfd')](_0x2d0043,_0x5da5('0x1c1')));_0x3d70e4=_0x1c2186[_0x5da5('0x1b8')];_0x902cb5=_0x1c2186['callAdditionalPhoneAfterMin'];_0x372939[_0x5da5('0xdb')](_0x3e9546)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x372939[_0x5da5('0x1c2')](0x0,_0x2d0043,_0x1c2186)&&!_0x2c2257){if(_0x3e9546['countnosuchnumberretry']>=_0x1c2186[_0x5da5('0x1b7')]){_0x372939[_0x5da5('0x108')](_0x3e9546,_0x1ee0db,_0x2b18e1,_0x5da5('0x1c3'));}else{_0x372939[_0x5da5('0x114')](_0x3e9546,_0x1ee0db,_0x2b18e1,_0x5da5('0x1c3'));}}break;case'3':_0x1c2186[_0x5da5('0x6e')]+=0x1;_0x3e9546['state']=0x3;_0x3e9546[_0x5da5('0xb4')]=_0x5da5('0x1c4');_0x3e9546[_0x5da5('0x101')]+=0x1;_0x3e9546[_0x5da5('0xfb')]+=0x1;ami[_0x5da5('0x54')](_0x5da5('0x1c5'),ut[_0x5da5('0xfd')](_0x2d0043,_0x5da5('0x1c6')));_0x3d70e4=_0x1c2186['dialNoAnswerRetryFrequency'];_0x902cb5=_0x1c2186[_0x5da5('0x137')];_0x372939[_0x5da5('0xdb')](_0x3e9546)[_0x5da5('0xbf')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x372939['checkRetriveMax'](0x3,_0x2d0043,_0x1c2186)&&!_0x2c2257){if(_0x3e9546[_0x5da5('0x101')]>=_0x1c2186[_0x5da5('0x1af')]){_0x372939['createStateFinal'](_0x3e9546,_0x1ee0db,_0x2b18e1,_0x5da5('0x1c7'));}else{_0x372939[_0x5da5('0x114')](_0x3e9546,_0x1ee0db,_0x2b18e1,_0x5da5('0x1c7'));}}break;case'5':_0x1c2186[_0x5da5('0x6b')]+=0x1;_0x3e9546[_0x5da5('0xb3')]=0x5;_0x3e9546[_0x5da5('0xb4')]=_0x5da5('0x1c8');_0x3e9546['countbusyretry']+=0x1;_0x3e9546[_0x5da5('0xfb')]+=0x1;ami[_0x5da5('0x54')](_0x5da5('0x1c9'),ut[_0x5da5('0xfd')](_0x2d0043,'busy'));_0x3d70e4=_0x1c2186[_0x5da5('0x1b3')];_0x902cb5=_0x1c2186['callAdditionalPhoneAfterMin'];_0x372939[_0x5da5('0xdb')](_0x3e9546)[_0x5da5('0xbf')](loggerCatch(_0x5da5('0x1ca')));if(_0x372939[_0x5da5('0x1c2')](0x5,_0x2d0043,_0x1c2186)&&!_0x2c2257){if(_0x3e9546[_0x5da5('0xff')]>=_0x1c2186[_0x5da5('0x1b2')]){_0x372939['createStateFinal'](_0x3e9546,_0x1ee0db,_0x2b18e1,_0x5da5('0x1cb'));}else{_0x372939[_0x5da5('0x114')](_0x3e9546,_0x1ee0db,_0x2b18e1,_0x5da5('0x1cb'));}}break;case'8':_0x1c2186['outboundCongestionCallsDay']+=0x1;_0x3e9546[_0x5da5('0xb3')]=0x8;_0x3e9546[_0x5da5('0xb4')]=_0x5da5('0x1cc');_0x3e9546[_0x5da5('0x100')]+=0x1;_0x3e9546[_0x5da5('0xfb')]+=0x1;_0x3d70e4=_0x1c2186[_0x5da5('0x1b5')];_0x902cb5=_0x1c2186[_0x5da5('0x137')];ami['emit']('custom:agentcongestion',ut[_0x5da5('0xfd')](_0x2d0043,_0x5da5('0x1cd')));_0x372939[_0x5da5('0xdb')](_0x3e9546)[_0x5da5('0xbf')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x372939[_0x5da5('0x1c2')](0x8,_0x2d0043,_0x1c2186)&&!_0x2c2257){if(_0x3e9546['countcongestionretry']>=_0x1c2186[_0x5da5('0x1b4')]){_0x372939[_0x5da5('0x108')](_0x3e9546,_0x1ee0db,_0x2b18e1,_0x5da5('0x1ce'));}else{_0x372939[_0x5da5('0x114')](_0x3e9546,_0x1ee0db,_0x2b18e1,_0x5da5('0x1ce'));}}break;case'11':_0x1c2186[_0x5da5('0x1cf')]+=0x1;_0x3e9546[_0x5da5('0xb3')]=0xb;_0x3e9546['statedesc']='Abandoned';_0x3e9546[_0x5da5('0x113')]+=0x1;_0x3e9546[_0x5da5('0xfb')]+=0x1;_0x3d70e4=_0x1c2186['dialAbandonedRetryFrequency'];_0x902cb5=_0x1c2186[_0x5da5('0x137')];_0x372939[_0x5da5('0xdb')](_0x3e9546)[_0x5da5('0xbf')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x372939[_0x5da5('0x1c2')](0xb,_0x2d0043,_0x1c2186)&&!_0x2c2257){if(_0x3e9546[_0x5da5('0x113')]>=_0x1c2186['dialAbandonedMaxRetry']){_0x372939['createStateFinal'](_0x3e9546,_0x1ee0db,_0x2b18e1,_0x5da5('0x1d0'));}else{_0x372939[_0x5da5('0x114')](_0x3e9546,_0x1ee0db,_0x2b18e1,'reason\x2011\x20abandoned');}}break;case'20':_0x1c2186[_0x5da5('0x71')]+=0x1;_0x3e9546[_0x5da5('0xb3')]=0x14;_0x3e9546[_0x5da5('0xb4')]=_0x5da5('0x1d1');_0x3e9546['countagentrejectretry']+=0x1;_0x3e9546[_0x5da5('0xfb')]+=0x1;_0x3d70e4=_0x1c2186['dialAgentRejectRetryFrequency'];_0x902cb5=_0x1c2186[_0x5da5('0x137')];ami['emit'](_0x5da5('0x1d2'),ut[_0x5da5('0xfd')](_0x2d0043,_0x5da5('0x1d3')));_0x372939['createHistory'](_0x3e9546)[_0x5da5('0xbf')](loggerCatch(_0x5da5('0x1d4')));if(_0x372939['checkRetriveMax'](0x14,_0x2d0043,_0x1c2186)&&!_0x2c2257){if(_0x3e9546[_0x5da5('0x104')]>=_0x1c2186[_0x5da5('0x1ba')]){_0x372939[_0x5da5('0x108')](_0x3e9546,_0x1ee0db,_0x2b18e1,_0x5da5('0x1d5'));}else{_0x372939[_0x5da5('0x114')](_0x3e9546,_0x1ee0db,_0x2b18e1,_0x5da5('0x1d5'));}}break;default:_0x1c2186['outboundUnknownCallsDay']+=0x1;_0x3e9546[_0x5da5('0xb3')]=0xc;_0x3e9546[_0x5da5('0xb4')]=_0x13257e['reason'];_0x3d70e4=_0x1c2186[_0x5da5('0x1bb')];_0x902cb5=_0x1c2186[_0x5da5('0x137')];_0x372939[_0x5da5('0xdb')](_0x3e9546)[_0x5da5('0xbf')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x372939[_0x5da5('0x1c2')](_0x13257e[_0x5da5('0x11d')],_0x2d0043,_0x1c2186)&&!_0x2c2257){if(_0x3e9546[_0x5da5('0xff')]+_0x3e9546[_0x5da5('0x100')]+_0x3e9546['countnoanswerretry']+_0x3e9546[_0x5da5('0x102')]+_0x3e9546[_0x5da5('0x103')]+_0x3e9546[_0x5da5('0x113')]+_0x3e9546['countmachineretry']+_0x3e9546[_0x5da5('0x104')]>=_0x1c2186[_0x5da5('0x105')]){_0x372939[_0x5da5('0x114')](_0x3e9546,_0x1ee0db,_0x2b18e1,_0x13257e[_0x5da5('0x11d')]);}else{_0x372939[_0x5da5('0x108')](_0x3e9546,_0x1ee0db,_0x2b18e1,_0x13257e[_0x5da5('0x11d')]);}}}})[_0x5da5('0x41')](function(_0x3e1327){if(_0x2c2257){_0x372939[_0x5da5('0xca')](_0x3e9546,_0x3d70e4,_0x902cb5)['then'](function(_0x9e6093){return _0x1ee0db(0x1);});}});});};Dialer[_0x5da5('0x1f')]['stateGlobal']=function(_0x5ba814,_0x2489b1,_0x10a73d,_0x47bc7a){var _0x1825c7=new Final(_0x5ba814);_0x1825c7['state']=0xf;_0x1825c7[_0x5da5('0xb4')]='Global';this['createStateFinal'](_0x1825c7,_0x2489b1,_0x10a73d,_0x47bc7a);};Dialer['prototype']['createStateFinal']=function(_0x27ef3f,_0x3a43e4,_0x4f64b4,_0x1614d8){this[_0x5da5('0x11a')](_0x27ef3f)['then'](function(){return _0x3a43e4(msgResponse(_0x5da5('0x1bd'),'Success',_0x1614d8));})[_0x5da5('0xbf')](function(){return _0x4f64b4(msgResponse(_0x5da5('0x1d6'),_0x5da5('0x157'),'contact\x20not\x20moved'));});};Dialer[_0x5da5('0x1f')][_0x5da5('0x9')]=function(_0x383a50){var _0x1a464a=_0x383a50[_0x5da5('0x1d7')]/0x64;var _0x1f8ce8=_0x383a50['outboundDropCallsDayTimeout']/(_0x383a50[_0x5da5('0x6d')]+_0x383a50[_0x5da5('0x69')]);var _0x52805e=Math['round'](_0x383a50[_0x5da5('0x7a')]*(_0x383a50[_0x5da5('0x1d8')]/0x64));var _0x33f51a=Math[_0x5da5('0x1d9')](_0x383a50['predictiveIntervalAvailable']*(_0x383a50['predictiveIntervalMinThreshold']/0x64));var _0x2fe2a4=_0x383a50[_0x5da5('0xad')]+_0x383a50[_0x5da5('0x5c')];var _0x2d7d85=Math['floor'](_0x383a50[_0x5da5('0x7d')]*_0x383a50[_0x5da5('0x95')]*_0x383a50[_0x5da5('0x79')]*_0x383a50[_0x5da5('0x1da')]);if(_['isUndefined'](_0x383a50['startProgressive'])){if(!_[_0x5da5('0x8f')](_0x383a50[_0x5da5('0x2d')])){_0x383a50['startPredictive']=undefined;loggerPredictive[_0x5da5('0xa1')](_0x5da5('0x1db'),_0x5da5('0x1dc'));}if(!_[_0x5da5('0x8f')](_0x383a50['handlePredictive'])){loggerPredictive[_0x5da5('0xa1')](_0x5da5('0x1db'),_0x5da5('0x1dd'));clearInterval(_0x383a50['handlePredictive']);_0x383a50[_0x5da5('0x99')]=undefined;}_0x383a50[_0x5da5('0x2e')]=moment()[_0x5da5('0x82')](_0x5da5('0x10d'));loggerPredictive[_0x5da5('0x86')](_0x383a50['name'],_0x5da5('0x1de'),_0x383a50[_0x5da5('0x2e')]);this[_0x5da5('0x16a')](_0x383a50,0x1);}else if(ifInterval(_0x383a50[_0x5da5('0x1df')],_0x383a50[_0x5da5('0x2e')])){this[_0x5da5('0x16a')](_0x383a50,0x1);loggerPredictiveCalls[_0x5da5('0x86')](_0x5da5('0x1e0'),_0x383a50[_0x5da5('0x2e')],_0x383a50[_0x5da5('0x47')]);_0x383a50[_0x5da5('0x7d')]=0x0;_0x383a50[_0x5da5('0x127')]=0x0;}else if(_0x1a464a<_0x1f8ce8&&_0x383a50[_0x5da5('0x1e1')]===_0x5da5('0x1e2')){freeVariablesPredictive(_0x383a50);loggerPredictive[_0x5da5('0x86')](_0x5da5('0x1e3'),'Dropped\x20calls\x20day',_0x1f8ce8,_0x5da5('0x2e'),_0x383a50[_0x5da5('0x47')]);}else if(_0x2d7d85<_0x383a50[_0x5da5('0x127')]&&_0x383a50[_0x5da5('0x1e1')]===_0x5da5('0x1e2')){freeVariablesPredictive(_0x383a50);loggerPredictive[_0x5da5('0x86')](_0x5da5('0x1e4'),'Max\x20Drop\x20',_0x2d7d85,_0x5da5('0x1e5'),_0x383a50[_0x5da5('0x127')],_0x5da5('0x2e'),_0x383a50[_0x5da5('0x47')]);}else if(!ifInterval(_0x383a50[_0x5da5('0x1df')],_0x383a50[_0x5da5('0x2e')])&&_['isUndefined'](_0x383a50[_0x5da5('0x2d')])&&!_[_0x5da5('0x8f')](_0x383a50[_0x5da5('0x2e')])){_0x383a50[_0x5da5('0x2d')]=moment()['format'](_0x5da5('0x10d'));loggerPredictive[_0x5da5('0x86')](_0x383a50[_0x5da5('0x47')],_0x5da5('0x1e6'),_0x383a50[_0x5da5('0x2d')]);this['averageHandleTime'](_0x383a50[_0x5da5('0x1df')])[_0x5da5('0x41')](this['getDataPredictive'](_0x383a50))[_0x5da5('0x41')](mergeDataErlangB(_0x383a50))['then'](this['startMethodPredictive'](_0x383a50))[_0x5da5('0xbf')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x383a50));}else if(!ifInterval(_0x383a50[_0x5da5('0x1df')],_0x383a50[_0x5da5('0x2d')])){_0x383a50[_0x5da5('0x127')]=0x0;_0x383a50[_0x5da5('0x2d')]=moment()['format'](_0x5da5('0x10d'));loggerPredictive[_0x5da5('0x86')](_0x383a50[_0x5da5('0x47')],_0x5da5('0x1e7'),_0x383a50[_0x5da5('0x2d')]);clearInterval(_0x383a50[_0x5da5('0x99')]);_0x383a50[_0x5da5('0x99')]=undefined;this[_0x5da5('0x1e8')](_0x383a50[_0x5da5('0x1df')])[_0x5da5('0x41')](this[_0x5da5('0x1e9')](_0x383a50))['then'](mergeDataErlangB(_0x383a50))[_0x5da5('0x41')](this[_0x5da5('0x1ea')](_0x383a50))[_0x5da5('0xbf')](loggerCatchPredictive(_0x5da5('0x1eb'),_0x383a50));}else if(_0x383a50[_0x5da5('0x7a')]&&_0x2fe2a4<_0x383a50[_0x5da5('0x7a')]-_0x33f51a){freeVariablesPredictive(_0x383a50);loggerPredictive['info'](_0x383a50[_0x5da5('0x47')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x2fe2a4,_0x5da5('0x1ec'),_0x383a50['predictiveIntervalAvailable'],'-',_0x33f51a,'=',_0x383a50[_0x5da5('0x7a')]-_0x33f51a,')');}else if(_0x383a50['predictiveIntervalAvailable']&&_0x2fe2a4>_0x383a50['predictiveIntervalAvailable']+_0x52805e){freeVariablesPredictive(_0x383a50);loggerPredictive[_0x5da5('0x86')](_0x383a50[_0x5da5('0x47')],_0x5da5('0x1ed'),_0x2fe2a4,_0x5da5('0x1ee'),_0x383a50[_0x5da5('0x7a')],'+',_0x52805e,'=',_0x383a50[_0x5da5('0x7a')]+_0x52805e,')');}};Dialer[_0x5da5('0x1f')][_0x5da5('0x1e9')]=function(_0x503a19){var _0x3e0f89=this;return function(_0xcc6611){return new BPromise(function(_0x4b043e,_0x4b122e){_[_0x5da5('0x96')](_0x503a19,_0xcc6611[0x0]);if(checkGetDataPredictive(_0xcc6611[0x0])){var _0x1587e0=_0x503a19['predictiveIntervalAvailable']=_0x503a19[_0x5da5('0x5c')]+_0x503a19[_0x5da5('0xad')];var _0x21e7e6=_0x503a19[_0x5da5('0x1df')]*0x3c;var _0x5431b1=_0xcc6611[0x0]['predictiveIntervalAvgTalktime']+_0xcc6611[0x0][_0x5da5('0x74')];var _0x24f937=(_0xcc6611[0x0][_0x5da5('0x73')]+_0xcc6611[0x0][_0x5da5('0x77')]+_0xcc6611[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xcc6611[0x0][_0x5da5('0x7b')];_0x503a19['predictiveIntervalHitRate']=_0x24f937>0x0?_0x24f937:0x1;switch(_0x503a19[_0x5da5('0x1e1')]){case'dropRate':var _0x3986b9=_0x503a19[_0x5da5('0x1d7')]/0x64;return _0x3e0f89[_0x5da5('0x1ef')](_0x1587e0,_0x21e7e6,_0x5431b1,_0x24f937,_0x3986b9)[_0x5da5('0x41')](function(_0x21017c){return _0x4b043e(_0x21017c);});case _0x5da5('0x1f0'):var _0x521073=_0x503a19[_0x5da5('0x1d7')]/0x64;return _0x3e0f89[_0x5da5('0x1f1')](_0x1587e0,_0x21e7e6,_0x5431b1,_0x24f937,_0x521073)[_0x5da5('0x41')](function(_0xedef2c){return _0x4b043e(_0xedef2c);});default:return _0x4b122e(msgResponse(_0x5da5('0x1f2'),_0x5da5('0x157'),_0x5da5('0x1f3')));}}else{return _0x4b122e(msgResponse('[getDataPredictive]','Failure',_0x5da5('0x1f4')));}});};};Dialer[_0x5da5('0x1f')][_0x5da5('0x1f5')]=function(_0x25a45d){var _0x4d2a51=this;return function(_0x1ab356){return new BPromise(function(_0x560c12,_0x139c33){_[_0x5da5('0x96')](_0x25a45d,_0x1ab356[0x0]);if(checkGetDataPredictive(_0x1ab356[0x0])){loggerPredictive[_0x5da5('0x86')](JSON['stringify'](_0x1ab356[0x0]));if(_0x25a45d[_0x5da5('0x1e1')]===_0x5da5('0x1e2')){return _0x4d2a51[_0x5da5('0xd8')](_0x25a45d['id'])['then'](function(_0x23772a){var _0x1cf5e5=_0x25a45d[_0x5da5('0x59')]-_0x23772a[0x0][_0x5da5('0x1f6')];var _0x35082e=_0x25a45d[_0x5da5('0x1df')]*0x3c;var _0x495dfa=_0x1ab356[0x0][_0x5da5('0x75')]+_0x1ab356[0x0]['predictiveIntervalAvgHoldtime'];var _0x1c66b5=(_0x1ab356[0x0][_0x5da5('0x73')]+_0x1ab356[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1ab356[0x0][_0x5da5('0x76')])/_0x1ab356[0x0][_0x5da5('0x7b')];var _0x3af469=_0x25a45d[_0x5da5('0x1d7')]/0x64;_0x25a45d[_0x5da5('0x1f7')]=_0x23772a[0x0][_0x5da5('0x1f6')]||0x0;_0x25a45d['predictiveIntervalHitRate']=_0x1c66b5>0x0?_0x1c66b5:0x1;return _0x4d2a51[_0x5da5('0x1ef')](_0x1cf5e5,_0x35082e,_0x495dfa,_0x1c66b5,_0x3af469);})[_0x5da5('0x41')](function(_0x8ff17){return _0x560c12(_0x8ff17);})[_0x5da5('0xbf')](function(_0x4d9ac4){return _0x139c33(msgResponse(_0x5da5('0x1f8'),_0x5da5('0x157'),JSON[_0x5da5('0x50')](_0x4d9ac4)));});}if(_0x25a45d[_0x5da5('0x1e1')]==='agentBusyFactor'){return _0x4d2a51[_0x5da5('0xd8')](_0x25a45d['id'])[_0x5da5('0x41')](function(_0x4d229a){var _0x3aee8a=_0x25a45d[_0x5da5('0x59')]-_0x4d229a[0x0]['outboundQueuePauses'];var _0x991645=_0x25a45d[_0x5da5('0x1df')]*0x3c;var _0x6fb082=_0x1ab356[0x0][_0x5da5('0x75')]+_0x1ab356[0x0][_0x5da5('0x74')];var _0x41c227=(_0x1ab356[0x0][_0x5da5('0x73')]+_0x1ab356[0x0][_0x5da5('0x77')]+_0x1ab356[0x0][_0x5da5('0x76')])/_0x1ab356[0x0][_0x5da5('0x7b')];var _0x9b6984=_0x25a45d[_0x5da5('0x1d7')]/0x64;_0x25a45d[_0x5da5('0x1f7')]=_0x4d229a[0x0][_0x5da5('0x1f6')]||0x0;_0x25a45d[_0x5da5('0x79')]=_0x41c227>0x0?_0x41c227:0x1;return _0x4d2a51['busyFactor'](_0x3aee8a,_0x991645,_0x6fb082,_0x41c227,_0x9b6984);})['then'](function(_0x31d5c2){return _0x560c12(_0x31d5c2);})[_0x5da5('0xbf')](function(_0x4607bb){return _0x139c33(msgResponse('[CatchErlangB]',_0x5da5('0x157'),JSON[_0x5da5('0x50')](_0x4607bb)));});}}else{return _0x139c33(msgResponse('[getDataPredictive]',_0x5da5('0x157'),_0x5da5('0x1f4')));}});};};Dialer[_0x5da5('0x1f')]['startMethodPredictive']=function(_0x4de0c4){var _0x1817da=this;return function(){var _0x1a48ba=0x0;var _0x297d12=Math[_0x5da5('0x1f9')](_0x4de0c4[_0x5da5('0x7e')]*0x3e8);if(_0x297d12>0x0){_0x297d12=_0x297d12<0x64?0x64:_0x297d12;loggerPredictive[_0x5da5('0x86')](_0x4de0c4['name'],'one\x20call\x20every:',_0x297d12,_0x5da5('0x51'));_0x4de0c4[_0x5da5('0x99')]=setInterval(function(){_0x1817da[_0x5da5('0x99')](_0x4de0c4);loggerPredictiveCalls[_0x5da5('0x86')](_0x5da5('0x1fa'),_0x1a48ba+=0x1);},_0x297d12);}else{loggerPredictive[_0x5da5('0x86')](_0x4de0c4[_0x5da5('0x47')],_0x5da5('0x1fb'));}};};Dialer[_0x5da5('0x1f')][_0x5da5('0x1fc')]=function(_0x3cb7b4,_0x3e3a3a){var _0x126950=this;return function(_0x51ba10){if(_[_0x5da5('0x4d')](_0x51ba10)){if(_[_0x5da5('0xbb')](_0x3e3a3a[_0x5da5('0xe3')])||!_0x3e3a3a[_0x5da5('0x1fd')]){if(_0x3cb7b4[_0x5da5('0x63')]===_0x5da5('0x8')){_0x3cb7b4['queueStatusComplete']=_['isUndefined'](_0x3cb7b4[_0x5da5('0x141')])?!![]:_0x3cb7b4[_0x5da5('0x141')];var _0x47832d=uuid['v4']();_0x126950['actions'][_0x47832d]=new Action(_0x3cb7b4,_0x3e3a3a,_0x47832d);loggerBooked[_0x5da5('0x86')]('[booked][checkContactBlack]',_0x47832d,_0x5da5('0x1fe'),JSON['stringify'](_0x3cb7b4[_0x5da5('0x141')]),_0x5da5('0x1ff'),_0x3cb7b4['name']);if(_0x3cb7b4[_0x5da5('0x141')]){_0x3cb7b4[_0x5da5('0x141')]=![];_0x126950[_0x5da5('0x30')][_0x126950[_0x5da5('0x2a')][_0x47832d][_0x5da5('0xc1')]]=[];ami[_0x5da5('0xbc')]({'actionid':_0x47832d,'action':_0x5da5('0x200'),'queue':_0x3cb7b4[_0x5da5('0x47')]})[_0x5da5('0xbf')](function(){_0x126950[_0x5da5('0xc2')](_0x3cb7b4);_0x126950['rescheduleContact']({'active':![],'ContactId':_0x126950[_0x5da5('0x2a')][_0x47832d][_0x5da5('0xe1')],'ListId':_0x126950[_0x5da5('0x2a')][_0x47832d]['ListId'],'VoiceQueueId':_0x126950[_0x5da5('0x2a')][_0x47832d]['VoiceQueueId']||undefined,'CampaignId':_0x126950[_0x5da5('0x2a')][_0x47832d]['CampaignId']||undefined})[_0x5da5('0xbf')](loggerCatch(_0x5da5('0x201')));delete _0x126950[_0x5da5('0x2a')][_0x47832d];});}else{loggerBooked[_0x5da5('0x86')](_0x5da5('0x202'),JSON['stringify'](_0x3cb7b4['queueStatusComplete']),_0x5da5('0x1ff'),_0x3cb7b4[_0x5da5('0x47')]);_0x126950[_0x5da5('0xc2')](_0x3cb7b4);_0x126950[_0x5da5('0xcf')]({'active':![],'ContactId':_0x126950[_0x5da5('0x2a')][_0x47832d][_0x5da5('0xe1')],'ListId':_0x126950[_0x5da5('0x2a')][_0x47832d]['ListId'],'VoiceQueueId':_0x126950[_0x5da5('0x2a')][_0x47832d][_0x5da5('0x10e')]||undefined,'CampaignId':_0x126950[_0x5da5('0x2a')][_0x47832d][_0x5da5('0x115')]||undefined})['catch'](loggerCatch(_0x5da5('0x201')));delete _0x126950['actions'][_0x47832d];}}else{return _0x126950[_0x5da5('0x181')](_0x3cb7b4,_0x3e3a3a);}}else{if(getDiff(_0x3e3a3a[_0x5da5('0x203')])<_0x3cb7b4['dialRecallMeTimeout']*0x3c){if(_0x3e3a3a['Agent']&&!_0x3e3a3a['Agent']['voicePause']){_0x126950[_0x5da5('0x23')][_0x5da5('0x143')](_0x3e3a3a['id'])['finally'](function(){_0x126950[_0x5da5('0xc2')](_0x3cb7b4);});}else{_0x126950['unlockContact']({'active':![]},_0x3e3a3a['id'],0x1)[_0x5da5('0x14a')](function(){_0x126950[_0x5da5('0xc2')](_0x3cb7b4);});}}else{_0x3cb7b4['outboundReCallsDay']+=0x1;_0x126950['updateOriginated'](_0x3cb7b4);if(_0x3cb7b4['dialRecallInQueue']){_0x126950['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3e3a3a[_0x5da5('0xe1')],'ListId':_0x3e3a3a[_0x5da5('0xe2')],'VoiceQueueId':_0x3e3a3a[_0x5da5('0x10e')]||undefined,'CampaignId':_0x3e3a3a[_0x5da5('0x115')]||undefined})[_0x5da5('0xbf')](loggerCatch(_0x5da5('0x204')));_0x126950[_0x5da5('0xdb')](createObjHistory(_0x3cb7b4,_0x3e3a3a,'RECALLINQUEUE',0x17,_0x5da5('0x205')))[_0x5da5('0xbf')](loggerCatch(_0x5da5('0x206')));}else{_0x126950[_0x5da5('0xf5')](createObjHistory(_0x3cb7b4,_0x3e3a3a,_0x5da5('0x207'),0x16,_0x5da5('0x208')),'[Originate][HistoryRecallClose][historyCatch]',_0x5da5('0x209'));}}}}else{_0x3cb7b4[_0x5da5('0x6a')]+=0x1;_0x126950[_0x5da5('0xf5')](createObjHistory(_0x3cb7b4,_0x3e3a3a,_0x5da5('0x20a'),0xd,_0x5da5('0x20b')),_0x5da5('0x20c'),_0x5da5('0x20d'));throw _0x5da5('0x20e');}};};Dialer[_0x5da5('0x1f')]['handleIvr']=function(_0x28300b){var _0x1dde4f=this;var _0x4d04a4=_0x28300b['limitCalls']-_0x28300b['originated']-_0x28300b['temp'];emitCampaignSummary(_0x28300b);if(_0x4d04a4>0x0){if(_0x4d04a4>this[_0x5da5('0x28')]){_0x4d04a4=this[_0x5da5('0x28')];}_0x28300b[_0x5da5('0xd4')]+=_0x4d04a4;this[_0x5da5('0xd6')](_0x28300b['id'],_0x4d04a4,_0x28300b[_0x5da5('0x20f')],_0x28300b)[_0x5da5('0x41')](function(_0x4cea02){_0x28300b[_0x5da5('0xd4')]-=_0x4d04a4;_0x28300b[_0x5da5('0xd4')]=_0x28300b[_0x5da5('0xd4')]>0x0?_0x28300b[_0x5da5('0xd4')]:0x0;if(!checkContactEmpty(_0x4cea02)){_0x28300b['message']=_0x5da5('0xaa');logger[_0x5da5('0x86')](_0x5da5('0x210')+_0x28300b[_0x5da5('0x47')]);}else{_0x28300b['originated']+=_0x4cea02[_0x5da5('0xa3')];_0x28300b[_0x5da5('0x45')]='RUNNING';for(var _0x3bfe11=0x0;_0x3bfe11<_0x4cea02['length'];_0x3bfe11+=0x1){_0x28300b['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x4cea02[_0x3bfe11])||_[_0x5da5('0xbb')](_0x4cea02[_0x3bfe11][_0x5da5('0x19a')])||_[_0x5da5('0xbb')](_0x4cea02[_0x3bfe11][_0x5da5('0x184')])){_0x1dde4f[_0x5da5('0xde')](_0x5da5('0x211'),_0x28300b,_0x4cea02[_0x3bfe11]);}else{_0x1dde4f[_0x5da5('0xcc')](_[_0x5da5('0xe0')](_0x4cea02[_0x3bfe11],[_0x5da5('0x115'),'Contact.phone']))['then'](_0x1dde4f[_0x5da5('0x1fc')](_0x28300b,_0x4cea02[_0x3bfe11]))[_0x5da5('0xbf')](_0x1dde4f['loggerHandler'](_0x5da5('0x212'),_0x28300b));}}}})[_0x5da5('0xbf')](loggerGetContactDialer('[getContactCampaign2]',_0x28300b,_0x4d04a4));}};Dialer[_0x5da5('0x1f')][_0x5da5('0x16a')]=function(_0x52d33d,_0x571a16){var _0x10dbca=this;var _0x58d5b6=[];var _0x43d211=_0x571a16>=0x1?_0x571a16:0x1;if(_0x52d33d[_0x5da5('0x63')]===_0x5da5('0x8')){_0x43d211=0x1;}var _0x36eb5c=Math['floor'](_0x52d33d['available']*_0x43d211)-_0x52d33d[_0x5da5('0x7c')]-_0x52d33d[_0x5da5('0xd4')];emitVoiceQueueSummary(_0x52d33d);if(_0x52d33d[_0x5da5('0x213')]>0x0){var _0x2b9522=_0x52d33d[_0x5da5('0x213')]-_0x52d33d['originated']-_0x52d33d[_0x5da5('0x5c')]-_0x52d33d[_0x5da5('0xd4')]-_0x52d33d[_0x5da5('0x214')];if(_0x36eb5c>_0x2b9522){_0x36eb5c=_0x2b9522;}}if(_0x36eb5c>0x0){if(_0x52d33d[_0x5da5('0x63')]===_0x5da5('0x8')){_0x36eb5c=0x1;}if(_0x36eb5c>this[_0x5da5('0x28')]){_0x36eb5c=this[_0x5da5('0x28')];}_0x52d33d[_0x5da5('0xd4')]+=_0x36eb5c;for(var _0x859fd9 in this[_0x5da5('0x26')]){if(typeof this[_0x5da5('0x26')][_0x859fd9]!==_0x5da5('0xa4')){if(this[_0x5da5('0x26')][_0x859fd9][_0x5da5('0xb3')]==='not_inuse'&&this[_0x5da5('0x26')][_0x859fd9][_0x5da5('0xbd')]===_0x5da5('0xe8')){_0x58d5b6[_0x5da5('0x13f')](this[_0x5da5('0x26')][_0x859fd9]['id']);}}}this['getContactDialer'](_0x52d33d['id'],_0x58d5b6,_0x36eb5c,_0x52d33d['dialOrderByScheduledAt'],_0x52d33d)[_0x5da5('0x41')](function(_0x5908ee){_0x52d33d[_0x5da5('0xd4')]-=_0x36eb5c;_0x52d33d[_0x5da5('0xd4')]=_0x52d33d[_0x5da5('0xd4')]>0x0?_0x52d33d[_0x5da5('0xd4')]:0x0;if(!checkContactEmpty(_0x5908ee)){_0x10dbca[_0x5da5('0xc4')](_0x52d33d)[_0x5da5('0x41')](sendMessageReschedule(_0x52d33d))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x52d33d[_0x5da5('0x7c')]+=_0x5908ee[_0x5da5('0xa3')];_0x52d33d[_0x5da5('0x45')]=_0x52d33d[_0x5da5('0x63')]===_0x5da5('0x8')?'ACTIVE':_0x5da5('0x215');for(var _0xf0c3f4=0x0;_0xf0c3f4<_0x5908ee[_0x5da5('0xa3')];_0xf0c3f4+=0x1){if(_[_0x5da5('0xbb')](_0x5908ee[_0xf0c3f4])||_[_0x5da5('0xbb')](_0x5908ee[_0xf0c3f4]['Contact'])||_[_0x5da5('0xbb')](_0x5908ee[_0xf0c3f4]['phone'])){_0x10dbca[_0x5da5('0xde')](_0x5da5('0x211'),_0x52d33d,_0x5908ee[_0xf0c3f4]);}else{_0x10dbca[_0x5da5('0xc6')](_[_0x5da5('0xe0')](_0x5908ee[_0xf0c3f4],[_0x5da5('0x10e'),'Contact.phone']))[_0x5da5('0x41')](_0x10dbca[_0x5da5('0x1fc')](_0x52d33d,_0x5908ee[_0xf0c3f4]))[_0x5da5('0xbf')](_0x10dbca[_0x5da5('0xdd')]('[actionOriginate]\x20',_0x52d33d));}}}})[_0x5da5('0xbf')](loggerGetContactDialer(_0x5da5('0x216'),_0x52d33d,_0x36eb5c));}};Dialer[_0x5da5('0x1f')]['handlePredictive']=function(_0x34d4fb){if(_0x34d4fb[_0x5da5('0x213')]>0x0){var _0x93263=_0x34d4fb[_0x5da5('0x213')]-_0x34d4fb[_0x5da5('0x7c')]-_0x34d4fb[_0x5da5('0x5c')];if(_0x93263>0x0){this[_0x5da5('0x217')](_0x34d4fb);}else{loggerPredictiveCalls[_0x5da5('0x86')]('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x34d4fb);}};Dialer[_0x5da5('0x1f')][_0x5da5('0x217')]=function(_0x1dba4e){var _0x29b683=this;var _0x466ea0=[];_0x1dba4e[_0x5da5('0x7c')]+=0x1;for(var _0x14c0ca in this[_0x5da5('0x26')]){if(typeof this[_0x5da5('0x26')][_0x14c0ca]!==_0x5da5('0xa4')){if(this[_0x5da5('0x26')][_0x14c0ca][_0x5da5('0xb3')]===_0x5da5('0x218')&&this[_0x5da5('0x26')][_0x14c0ca][_0x5da5('0xbd')]===_0x5da5('0xe8')){_0x466ea0[_0x5da5('0x13f')](this['agents'][_0x14c0ca]['id']);}}}this[_0x5da5('0xd3')](_0x1dba4e['id'],_0x466ea0,0x1,_0x1dba4e[_0x5da5('0x20f')],_0x1dba4e)[_0x5da5('0x41')](function(_0x443102){if(!checkContactEmpty(_0x443102)){checkContactLowerLimitOriginate(_0x1dba4e,0x1,0x0);_0x29b683[_0x5da5('0xc4')](_0x1dba4e)[_0x5da5('0x41')](sendMessageReschedule(_0x1dba4e))[_0x5da5('0xbf')](loggerCatch(_0x5da5('0xc5')));}else{_0x1dba4e[_0x5da5('0x45')]=_0x5da5('0x215');if(_[_0x5da5('0xbb')](_0x443102[0x0])||_[_0x5da5('0xbb')](_0x443102[0x0]['Contact'])||_[_0x5da5('0xbb')](_0x443102[0x0][_0x5da5('0x184')])){_0x29b683[_0x5da5('0xde')](_0x5da5('0x211'),_0x1dba4e,_0x443102[0x0]);}else{_0x29b683[_0x5da5('0xc6')](_[_0x5da5('0xe0')](_0x443102[0x0],['VoiceQueueId',_0x5da5('0x219')]))['then'](_0x29b683[_0x5da5('0x1fc')](_0x1dba4e,_0x443102[0x0]))[_0x5da5('0xbf')](_0x29b683[_0x5da5('0xdd')](_0x5da5('0x21a'),_0x1dba4e));}}})[_0x5da5('0xbf')](loggerGetContactDialer(_0x5da5('0x21b'),_0x1dba4e,0x1));emitVoiceQueueSummary(_0x1dba4e);};Dialer['prototype'][_0x5da5('0x1ef')]=function(_0xa03098,_0x276d7e,_0x1203e6,_0x4e9401,_0x2d826b,_0x511794){loggerPredictive[_0x5da5('0x86')](_0x5da5('0x21c'));loggerPredictive[_0x5da5('0x86')](_0x5da5('0x21d'),_0xa03098);loggerPredictive['info'](_0x5da5('0x21e'),_0x276d7e);loggerPredictive[_0x5da5('0x86')](_0x5da5('0x21f'),_0x1203e6);loggerPredictive['info'](_0x5da5('0x220'),_0x4e9401);loggerPredictive['info'](_0x5da5('0x221'),_0x2d826b);loggerPredictive[_0x5da5('0x86')](_0x5da5('0x8e'));return new BPromise(function(_0x2402bf,_0x3c525c){if(_0xa03098<=0x0||isNaN(_0xa03098)){return _0x3c525c(msgResponse(_0x5da5('0x222'),_0x5da5('0x4f'),_0x5da5('0x223')+_0xa03098));}if(_0x1203e6<=0x0||isNaN(_0x1203e6)){return _0x3c525c(msgResponse(_0x5da5('0x222'),_0x5da5('0x4f'),_0x5da5('0x224')+_0x1203e6));}if(_0x4e9401<=0x0||isNaN(_0x4e9401)){return _0x3c525c(msgResponse(_0x5da5('0x222'),_0x5da5('0x4f'),_0x5da5('0x225')+_0x4e9401));}if(_0x276d7e<=0x0||isNaN(_0x276d7e)){return _0x3c525c(msgResponse('[abandonmentRate]',_0x5da5('0x4f'),'interval\x20=\x20'+_0x276d7e));}if(_0x2d826b<=0x0||isNaN(_0x2d826b)){return _0x3c525c(msgResponse(_0x5da5('0x222'),_0x5da5('0x4f'),_0x5da5('0x226')+_0x2d826b));}_0x511794=_0x511794||0x0;var _0x43591e=0x1/_0x1203e6;var _0x534cb3=0x0;var _0x2176a6=0x0;var _0x59a036=0x0;var _0xe4e675=0x0;for(var _0x578fe6=0x0;_0x59a036<_0x2d826b;_0x578fe6+=0x1){_0x2176a6=_0x578fe6/_0x276d7e;_0x534cb3=(_0x4e9401*_0x2176a6+_0x511794)/_0x43591e;_0x59a036=erlangb(_0x534cb3,_0xa03098);_0xe4e675=_0x534cb3/_0xa03098*(0x1-erlangb(_0x534cb3,_0xa03098));}return _0x2402bf({'erlangCalls':_0x578fe6,'erlangCallToSecond':_0x276d7e/_0x578fe6,'erlangAbandonmentRate':_0x59a036,'erlangBusyFactor':_0xe4e675});});};Dialer[_0x5da5('0x1f')][_0x5da5('0x1f1')]=function(_0xad369e,_0x717144,_0x225335,_0x2333e4,_0x57819e,_0x294e73){loggerPredictive['info'](_0x5da5('0x227'));loggerPredictive[_0x5da5('0x86')](_0x5da5('0x21d'),_0xad369e);loggerPredictive[_0x5da5('0x86')](_0x5da5('0x21e'),_0x717144);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x225335);loggerPredictive[_0x5da5('0x86')](_0x5da5('0x220'),_0x2333e4);loggerPredictive[_0x5da5('0x86')](_0x5da5('0x228'),_0x57819e);loggerPredictive[_0x5da5('0x86')](_0x5da5('0x8e'));return new BPromise(function(_0x19d0c0,_0x24e670){if(_0xad369e<=0x0||isNaN(_0xad369e)){return _0x24e670(msgResponse('[busyFactor]',_0x5da5('0x4f'),_0x5da5('0x223')+_0xad369e));}if(_0x225335<=0x0||isNaN(_0x225335)){return _0x24e670(msgResponse(_0x5da5('0x229'),_0x5da5('0x4f'),'Ts\x20=\x20'+_0x225335));}if(_0x2333e4<=0x0||isNaN(_0x2333e4)){return _0x24e670(msgResponse(_0x5da5('0x229'),_0x5da5('0x4f'),_0x5da5('0x225')+_0x2333e4));}if(_0x717144<=0x0||isNaN(_0x717144)){return _0x24e670(msgResponse(_0x5da5('0x229'),'Error',_0x5da5('0x22a')+_0x717144));}if(_0x57819e<=0x0||isNaN(_0x57819e)){return _0x24e670(msgResponse(_0x5da5('0x229'),_0x5da5('0x4f'),_0x5da5('0x22b')+_0x57819e));}_0x294e73=_0x294e73||0x0;var _0x18c7ba=0x1/_0x225335;var _0x2e8328=0x0;var _0x550de1=0x0;var _0x12ef1=0x0;var _0x147e1a=0x0;for(var _0x139073=0x0;_0x147e1a<_0x57819e;_0x139073+=0x1){_0x550de1=_0x139073/_0x717144;_0x2e8328=(_0x2333e4*_0x550de1+_0x294e73)/_0x18c7ba;_0x12ef1=erlangb(_0x2e8328,_0xad369e);_0x147e1a=_0x2e8328/_0xad369e*(0x1-erlangb(_0x2e8328,_0xad369e));}return _0x19d0c0({'erlangCalls':_0x139073,'erlangCallToSecond':_0x717144/_0x139073,'erlangAbandonmentRate':_0x12ef1,'erlangBusyFactor':_0x147e1a});});};module[_0x5da5('0x22c')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 8e3869c..4452261 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 _0x0adf=['holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','responsetime','droptime','endtime','ringtime'];(function(_0x5be4ff,_0x6f452d){var _0x18ea31=function(_0x399a62){while(--_0x399a62){_0x5be4ff['push'](_0x5be4ff['shift']());}};_0x18ea31(++_0x6f452d);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x346e02,_0x25e309){_0x346e02=_0x346e02-0x0;var _0x5dec4c=_0x0adf[_0x346e02];return _0x5dec4c;};'use strict';var util=require(_0xf0ad('0x0'));var _=require(_0xf0ad('0x1'));var moment=require(_0xf0ad('0x2'));function getSeconds(_0x559f06,_0x4a97fd){var _0x10cf5b=moment(_0x559f06)[_0xf0ad('0x3')](0x0);var _0x187aa4=moment(_0x4a97fd)[_0xf0ad('0x3')](0x0);return _0x10cf5b[_0xf0ad('0x4')](_0x187aa4,_0xf0ad('0x5'));}function QueueCallerAbandon(_0x59a588,_0x3bbf85){this['scheduledat']=_0x59a588[_0xf0ad('0x6')];this[_0xf0ad('0x7')]=_0x59a588[_0xf0ad('0x7')];this[_0xf0ad('0x8')]=_0x59a588[_0xf0ad('0x7')]===_0xf0ad('0x9')?_0xf0ad('0xa'):_0x59a588['type'];this[_0xf0ad('0xb')]=_0x59a588['countbusyretry'];this[_0xf0ad('0xc')]=_0x59a588[_0xf0ad('0xc')];this[_0xf0ad('0xd')]=_0x59a588[_0xf0ad('0xd')];this[_0xf0ad('0xe')]=_0x59a588['countbusyretry']+_0x59a588['countcongestionretry']+_0x59a588[_0xf0ad('0xd')]+_0x59a588[_0xf0ad('0xf')]+_0x59a588[_0xf0ad('0x10')]+_0x59a588[_0xf0ad('0x11')]+_0x59a588['countmachineretry']+_0x59a588[_0xf0ad('0x12')];this[_0xf0ad('0xf')]=_0x59a588['countnosuchnumberretry'];this['countdropretry']=_0x59a588['countdropretry'];this[_0xf0ad('0x11')]=_0x59a588['countabandonedretry'];this[_0xf0ad('0x13')]=_0x59a588[_0xf0ad('0x13')];this[_0xf0ad('0x12')]=_0x59a588[_0xf0ad('0x12')];this[_0xf0ad('0x14')]=_0x3bbf85['uniqueid'];this[_0xf0ad('0x15')]=_0x59a588[_0xf0ad('0x16')];this[_0xf0ad('0x17')]=_0x59a588[_0xf0ad('0x18')];this['starttime']=_0x59a588['starttime'];this[_0xf0ad('0x19')]=_0x59a588[_0xf0ad('0x19')];this['droptime']=_0x59a588[_0xf0ad('0x1a')];this[_0xf0ad('0x1b')]=this[_0xf0ad('0x1a')];this[_0xf0ad('0x1c')]=getSeconds(_0x59a588['responsetime'],_0x59a588['starttime']);this[_0xf0ad('0x1d')]=getSeconds(this[_0xf0ad('0x1a')],_0x59a588[_0xf0ad('0x19')]);this[_0xf0ad('0x1e')]=0x0;this[_0xf0ad('0xa')]=_0x3bbf85[_0xf0ad('0xa')];this['membername']=_0x3bbf85[_0xf0ad('0x1f')];this[_0xf0ad('0x20')]=_0x3bbf85[_0xf0ad('0x20')];this[_0xf0ad('0x21')]=_0x59a588[_0xf0ad('0x21')];this[_0xf0ad('0x22')]=_0x59a588[_0xf0ad('0x22')];this[_0xf0ad('0x23')]=_0x59a588[_0xf0ad('0x23')];this[_0xf0ad('0x24')]=_0x59a588[_0xf0ad('0x24')];this[_0xf0ad('0x25')]=_0x59a588[_0xf0ad('0x25')];this[_0xf0ad('0x26')]=_0x59a588[_0xf0ad('0x26')];this['UserId']=_0x59a588[_0xf0ad('0x27')];this[_0xf0ad('0x28')]=_0x59a588[_0xf0ad('0x28')];this[_0xf0ad('0x29')]=_0x59a588[_0xf0ad('0x29')];this[_0xf0ad('0x2a')]=_0x59a588['originatecalleridnum']||'';this[_0xf0ad('0x2b')]=_0x59a588[_0xf0ad('0x2b')]||'';}module[_0xf0ad('0x2c')]=QueueCallerAbandon; \ No newline at end of file +var _0xebc7=['lodash','moment','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','starttime','responsetime','droptime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xebc7,0x1b7));var _0x7ebc=function(_0x2e1907,_0x229a70){_0x2e1907=_0x2e1907-0x0;var _0x401555=_0xebc7[_0x2e1907];return _0x401555;};'use strict';var util=require(_0x7ebc('0x0'));var _=require(_0x7ebc('0x1'));var moment=require(_0x7ebc('0x2'));function getSeconds(_0x36872f,_0x3aa2c8){var _0x1f4cb1=moment(_0x36872f)['milliseconds'](0x0);var _0x4326fc=moment(_0x3aa2c8)['milliseconds'](0x0);return _0x1f4cb1[_0x7ebc('0x3')](_0x4326fc,_0x7ebc('0x4'));}function QueueCallerAbandon(_0x16f2fb,_0x3ce1c3){this[_0x7ebc('0x5')]=_0x16f2fb[_0x7ebc('0x5')];this['type']=_0x16f2fb[_0x7ebc('0x6')];this[_0x7ebc('0x7')]=_0x16f2fb[_0x7ebc('0x6')]===_0x7ebc('0x8')?_0x7ebc('0x9'):_0x16f2fb['type'];this[_0x7ebc('0xa')]=_0x16f2fb['countbusyretry'];this[_0x7ebc('0xb')]=_0x16f2fb[_0x7ebc('0xb')];this[_0x7ebc('0xc')]=_0x16f2fb[_0x7ebc('0xc')];this[_0x7ebc('0xd')]=_0x16f2fb[_0x7ebc('0xa')]+_0x16f2fb[_0x7ebc('0xb')]+_0x16f2fb[_0x7ebc('0xc')]+_0x16f2fb[_0x7ebc('0xe')]+_0x16f2fb[_0x7ebc('0xf')]+_0x16f2fb['countabandonedretry']+_0x16f2fb['countmachineretry']+_0x16f2fb[_0x7ebc('0x10')];this[_0x7ebc('0xe')]=_0x16f2fb[_0x7ebc('0xe')];this['countdropretry']=_0x16f2fb[_0x7ebc('0xf')];this[_0x7ebc('0x11')]=_0x16f2fb[_0x7ebc('0x11')];this[_0x7ebc('0x12')]=_0x16f2fb['countmachineretry'];this[_0x7ebc('0x10')]=_0x16f2fb[_0x7ebc('0x10')];this['uniqueid']=_0x3ce1c3[_0x7ebc('0x13')];this[_0x7ebc('0x14')]=_0x16f2fb['name'];this['calleridnum']=_0x16f2fb['number'];this[_0x7ebc('0x15')]=_0x16f2fb[_0x7ebc('0x15')];this['responsetime']=_0x16f2fb[_0x7ebc('0x16')];this[_0x7ebc('0x17')]=_0x16f2fb[_0x7ebc('0x17')];this['endtime']=this[_0x7ebc('0x17')];this[_0x7ebc('0x18')]=getSeconds(_0x16f2fb[_0x7ebc('0x16')],_0x16f2fb[_0x7ebc('0x15')]);this[_0x7ebc('0x19')]=getSeconds(this[_0x7ebc('0x17')],_0x16f2fb['responsetime']);this[_0x7ebc('0x1a')]=0x0;this[_0x7ebc('0x9')]=_0x3ce1c3['queue'];this[_0x7ebc('0x1b')]=_0x3ce1c3[_0x7ebc('0x1c')];this[_0x7ebc('0x1d')]=_0x3ce1c3[_0x7ebc('0x1d')];this[_0x7ebc('0x1e')]=_0x16f2fb[_0x7ebc('0x1e')];this[_0x7ebc('0x1f')]=_0x16f2fb['callbackuniqueid'];this[_0x7ebc('0x20')]=_0x16f2fb[_0x7ebc('0x20')];this[_0x7ebc('0x21')]=_0x16f2fb[_0x7ebc('0x21')];this['ContactId']=_0x16f2fb[_0x7ebc('0x22')];this['ListId']=_0x16f2fb['ListId'];this[_0x7ebc('0x23')]=_0x16f2fb[_0x7ebc('0x23')];this[_0x7ebc('0x24')]=_0x16f2fb[_0x7ebc('0x24')];this[_0x7ebc('0x25')]=_0x16f2fb[_0x7ebc('0x25')];this[_0x7ebc('0x26')]=_0x16f2fb['originatecalleridnum']||'';this['originatecalleridname']=_0x16f2fb['originatecalleridname']||'';}module[_0x7ebc('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index b035ab2..3e410a5 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(_0x226ec7,_0x49c044){var _0x365169=function(_0x3dd385){while(--_0x3dd385){_0x226ec7['push'](_0x226ec7['shift']());}};_0x365169(++_0x49c044);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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(_0x4da9db,_0x504864){var _0x8f6f3d=function(_0x435ea5){while(--_0x435ea5){_0x4da9db['push'](_0x4da9db['shift']());}};_0x8f6f3d(++_0x504864);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 28461ce..ff257ab 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 _0xfeb3=['fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','updateStatus','SENDING\x20FAILED:\x20','faxstatusstring','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','format','dir','XMF-PATH','Action','variablesAction','execOriginate','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','util','lodash','bluebird','uuid','moment','tiff2pdf','./util/gs','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','syncNewchannel','varset','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','localstationid','channel','channels','uniqueid','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then'];(function(_0x3423b1,_0x43ea3a){var _0x16fdc6=function(_0x2bb14f){while(--_0x2bb14f){_0x3423b1['push'](_0x3423b1['shift']());}};_0x16fdc6(++_0x43ea3a);}(_0xfeb3,0x19b));var _0x3feb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfeb3[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0x3feb('0x0'));var _=require(_0x3feb('0x1'));var BPromise=require(_0x3feb('0x2'));var uuid=require(_0x3feb('0x3'));var moment=require(_0x3feb('0x4'));var path=require('path');var tiff2pdf=require(_0x3feb('0x5'));var gs=require(_0x3feb('0x6'));var logger=require('../../../config/logger')('fax');var ami=require('../ami');var rpcDb=require(_0x3feb('0x7'));var Channel=require('./channel');var ut=require(_0x3feb('0x8'));var Action=require(_0x3feb('0x9'));var faxAccount=require(_0x3feb('0xa'));var attachment=require(_0x3feb('0xb'));var faxMessage=require(_0x3feb('0xc'));function Fax(_0xca7265){this['channels']={};this[_0x3feb('0xd')]=_0xca7265['faxAccounts'];this[_0x3feb('0xe')]=_0xca7265[_0x3feb('0xe')];this[_0x3feb('0xf')]={};ami['on']('newchannel',this[_0x3feb('0x10')]['bind'](this));ami['on'](_0x3feb('0x11'),this['syncVarSet'][_0x3feb('0x12')](this));ami['on'](_0x3feb('0x13'),this[_0x3feb('0x14')]['bind'](this));ami['on'](_0x3feb('0x15'),this[_0x3feb('0x16')][_0x3feb('0x12')](this));ami['on'](_0x3feb('0x17'),this['syncFaxStatus'][_0x3feb('0x12')](this));ami['on'](_0x3feb('0x18'),this['syncReceiveFax'][_0x3feb('0x12')](this));ami['on'](_0x3feb('0x19'),this[_0x3feb('0x1a')][_0x3feb('0x12')](this));ami['on'](_0x3feb('0x1b'),this[_0x3feb('0x1c')]['bind'](this));}Fax[_0x3feb('0x1d')][_0x3feb('0x10')]=function(_0xeda8cf){if(_0xeda8cf[_0x3feb('0x1e')]==='from-voip-provider'){for(var _0xe0a614 in this[_0x3feb('0xd')]){if(this[_0x3feb('0xd')][_0x3feb('0x1f')](_0xe0a614)){if(_0xeda8cf['exten']===this[_0x3feb('0xd')][_0xe0a614][_0x3feb('0x20')]){this['channels'][_0xeda8cf['uniqueid']]={};this['channels'][_0xeda8cf['uniqueid']][_0x3feb('0x21')]=_0xeda8cf['channel'];this[_0x3feb('0x22')][_0xeda8cf['uniqueid']]['id']=this[_0x3feb('0xd')][_0xe0a614]['id'];this[_0x3feb('0x22')][_0xeda8cf[_0x3feb('0x23')]][_0x3feb('0x24')]=this[_0x3feb('0xd')][_0xe0a614][_0x3feb('0x24')];logger[_0x3feb('0x25')](_0xeda8cf['uniqueid'],_0x3feb('0x26'));}}}}if(this['actions'][_0xeda8cf['uniqueid']]){this[_0x3feb('0x22')][_0xeda8cf[_0x3feb('0x23')]]={};this['channels'][_0xeda8cf['uniqueid']][_0x3feb('0x21')]=_0xeda8cf[_0x3feb('0x21')];logger['info'](_0xeda8cf['uniqueid'],_0x3feb('0x26'));}};Fax[_0x3feb('0x1d')][_0x3feb('0x27')]=function(_0x415589){if(this[_0x3feb('0x22')][_0x415589[_0x3feb('0x23')]]){for(var _0x2b34ee in _0x415589['variable']){if(_0x415589[_0x3feb('0x28')][_0x3feb('0x1f')](_0x2b34ee)){this[_0x3feb('0x22')][_0x415589[_0x3feb('0x23')]][_0x2b34ee]=_0x415589[_0x3feb('0x29')];}}}};Fax[_0x3feb('0x1d')]['syncNewState']=function(_0x178b3d){if(this[_0x3feb('0x22')][_0x178b3d[_0x3feb('0x23')]]){this[_0x3feb('0x22')][_0x178b3d['uniqueid']]['channelstate']=_0x178b3d[_0x3feb('0x2a')];this[_0x3feb('0x22')][_0x178b3d[_0x3feb('0x23')]][_0x3feb('0x2b')]=_0x178b3d[_0x3feb('0x2b')];}};Fax['prototype'][_0x3feb('0x16')]=function(_0x16a929){if(this['channels'][_0x16a929[_0x3feb('0x23')]]){for(var _0x59f6a0 in _0x16a929[_0x3feb('0x28')]){if(_0x16a929[_0x3feb('0x28')][_0x3feb('0x1f')](_0x59f6a0)){this['channels'][_0x16a929[_0x3feb('0x23')]][_0x59f6a0]=_0x16a929['value'];}}}};Fax[_0x3feb('0x1d')]['syncFaxStatus']=function(_0x1325bb){if(this['channels'][_0x1325bb[_0x3feb('0x23')]]){this[_0x3feb('0x22')][_0x1325bb[_0x3feb('0x23')]][_0x3feb('0x2c')]=_0x1325bb[_0x3feb('0x2c')];this[_0x3feb('0x22')][_0x1325bb[_0x3feb('0x23')]][_0x3feb('0x2d')]=_0x1325bb[_0x3feb('0x2d')];this[_0x3feb('0x22')][_0x1325bb['uniqueid']][_0x3feb('0x20')]=_0x1325bb['localstationid'];this[_0x3feb('0x22')][_0x1325bb[_0x3feb('0x23')]][_0x3feb('0x2e')]=_0x1325bb[_0x3feb('0x2e')];logger[_0x3feb('0x25')](_0x1325bb[_0x3feb('0x23')],_0x3feb('0x2f'));}};Fax[_0x3feb('0x1d')]['syncReceiveFax']=function(_0x4a4fb6){var _0x329e42=this;if(this[_0x3feb('0x22')][_0x4a4fb6[_0x3feb('0x23')]]){var _0xf96d82=this[_0x3feb('0x22')][_0x4a4fb6[_0x3feb('0x23')]]['id'];this[_0x3feb('0x22')][_0x4a4fb6[_0x3feb('0x23')]][_0x3feb('0x30')]=_0x4a4fb6['remotestationid'];this['channels'][_0x4a4fb6[_0x3feb('0x23')]][_0x3feb('0x31')]=_0x4a4fb6[_0x3feb('0x31')];this[_0x3feb('0x22')][_0x4a4fb6[_0x3feb('0x23')]][_0x3feb('0x20')]=_0x4a4fb6[_0x3feb('0x20')];this[_0x3feb('0x22')][_0x4a4fb6[_0x3feb('0x23')]][_0x3feb('0x32')]=_0x4a4fb6[_0x3feb('0x32')];this[_0x3feb('0x22')][_0x4a4fb6['uniqueid']][_0x3feb('0x33')]=_0x4a4fb6[_0x3feb('0x33')];this[_0x3feb('0x22')][_0x4a4fb6[_0x3feb('0x23')]][_0x3feb('0x2e')]=_0x4a4fb6[_0x3feb('0x2e')];this[_0x3feb('0x22')][_0x4a4fb6[_0x3feb('0x23')]]['calleridnum']=_0x4a4fb6[_0x3feb('0x34')];if(this[_0x3feb('0x22')][_0x4a4fb6[_0x3feb('0x23')]]['pagestransferred']>0x0){tiff2pdf(_0x4a4fb6[_0x3feb('0x2e')],_0x3feb('0x35'),function(_0xdc58df){logger[_0x3feb('0x25')](_0x4a4fb6[_0x3feb('0x23')],_0x3feb('0x36'),_0xdc58df[_0x3feb('0x37')]);attachment[_0x3feb('0x38')]({'name':path[_0x3feb('0x39')](_0x4a4fb6[_0x3feb('0x2e')])['name'],'basename':path[_0x3feb('0x39')](_0x4a4fb6[_0x3feb('0x2e')])[_0x3feb('0x24')]+_0x3feb('0x3a'),'type':_0x3feb('0x3b')})[_0x3feb('0x3c')](function(_0x35cb8f){faxAccount['notify'](_0xf96d82,{'from':_0x4a4fb6[_0x3feb('0x34')],'mapKey':_0x3feb('0x3d'),'body':path['parse'](_0x4a4fb6[_0x3feb('0x2e')])['name']+_0x3feb('0x3a'),'AttachmentId':_0x35cb8f['id']})[_0x3feb('0x3e')](function(_0x169ccb){logger[_0x3feb('0x3f')](_0x4a4fb6[_0x3feb('0x23')],_0x3feb('0x40'),JSON[_0x3feb('0x41')](_0x169ccb));});})[_0x3feb('0x3e')](function(_0x1ccd2f){logger[_0x3feb('0x3f')](_0x4a4fb6[_0x3feb('0x23')],'\x20receiveFax\x20',JSON['stringify'](_0x1ccd2f));});});}logger['info'](_0x4a4fb6['uniqueid'],_0x3feb('0x42'));}};Fax['prototype'][_0x3feb('0x1c')]=function(_0x3cde26){if(this[_0x3feb('0xf')][_0x3cde26[_0x3feb('0x23')]]){_[_0x3feb('0x43')](this[_0x3feb('0x22')][_0x3cde26[_0x3feb('0x23')]],_[_0x3feb('0x44')](_0x3cde26,[_0x3feb('0x45'),_0x3feb('0x46')]));}};function updateStatus(_0x17d709){if(_0x17d709['AttachmentId']){faxMessage[_0x3feb('0x47')](_0x17d709[_0x3feb('0x48')],{'failMessage':_0x3feb('0x49')})[_0x3feb('0x3c')](function(_0x1d9a5f){ut[_0x3feb('0x4a')](_0x3feb('0x4b'),_0x1d9a5f);})[_0x3feb('0x3e')](function(_0x4dc8fb){ut[_0x3feb('0x4a')](_0x3feb('0x4c'),_0x4dc8fb);});}else{ut[_0x3feb('0x4a')](_0x3feb('0x4d'));}}Fax[_0x3feb('0x1d')]['updateStatus']=function(_0x4e6ed6,_0x487419,_0x2dd7ad){var _0x2a8e13=this;var _0x48b95c={};if(_0x487419){_0x48b95c={'read':_0x487419};}else{_0x48b95c={'failMessage':_0x2dd7ad};}if(this[_0x3feb('0xf')][_0x4e6ed6][_0x3feb('0x48')]){faxMessage[_0x3feb('0x47')](this['actions'][_0x4e6ed6][_0x3feb('0x48')],_0x48b95c)[_0x3feb('0x3c')](function(_0x3b3a3c){ut[_0x3feb('0x4a')]('[Fax][Message][Updated]',_0x3b3a3c);})['catch'](function(_0x38e252){ut[_0x3feb('0x4a')]('[Fax][Message][NoUpdate1]',_0x38e252);})[_0x3feb('0x4e')](function(){delete _0x2a8e13[_0x3feb('0x22')][_0x4e6ed6];delete _0x2a8e13[_0x3feb('0xf')][_0x4e6ed6];});}else{ut[_0x3feb('0x4a')](_0x3feb('0x4f'));delete this[_0x3feb('0x22')][_0x4e6ed6];delete this['actions'][_0x4e6ed6];}};Fax[_0x3feb('0x1d')][_0x3feb('0x1a')]=function(_0x917183){var _0x5a09ad=this;if(this[_0x3feb('0x22')][_0x917183[_0x3feb('0x23')]]){if(this['actions'][_0x917183[_0x3feb('0x23')]]){this[_0x3feb('0x22')][_0x917183[_0x3feb('0x23')]]['id']=this[_0x3feb('0xf')][_0x917183[_0x3feb('0x23')]]['id'];this[_0x3feb('0x22')][_0x917183[_0x3feb('0x23')]][_0x3feb('0x24')]=this[_0x3feb('0xf')][_0x917183[_0x3feb('0x23')]][_0x3feb('0x24')];}logger[_0x3feb('0x25')](_0x917183[_0x3feb('0x23')],this['actions'][_0x917183[_0x3feb('0x23')]]?_0x3feb('0x50'):_0x3feb('0x51'),JSON[_0x3feb('0x41')](this['channels'][_0x917183[_0x3feb('0x23')]]));if(this[_0x3feb('0xf')][_0x917183[_0x3feb('0x23')]]){if(this['channels'][_0x917183[_0x3feb('0x23')]][_0x3feb('0x52')]>0x0&&this[_0x3feb('0x22')][_0x917183[_0x3feb('0x23')]][_0x3feb('0x17')]==='SUCCESS'){this[_0x3feb('0x53')](_0x917183[_0x3feb('0x23')],!![]);}else{this[_0x3feb('0x53')](_0x917183[_0x3feb('0x23')],![],this['channels'][_0x917183['uniqueid']]['faxstatusstring']?_0x3feb('0x54')+this['channels'][_0x917183['uniqueid']][_0x3feb('0x55')]:'SENDING\x20FAILED');}}}};Fax[_0x3feb('0x1d')][_0x3feb('0x56')]=function(_0xd0c91){var _0x50eb0a=this;return new BPromise(function(_0x55f784,_0x43da9c){_0x50eb0a['execOriginate'](_0xd0c91,_0x50eb0a[_0x3feb('0xd')][_0xd0c91[_0x3feb('0x57')]])[_0x3feb('0x3c')](function(_0x485961){ut[_0x3feb('0x4a')](_0x3feb('0x58'),_0x485961);_0x55f784(ut['message'](_0x3feb('0x59')));})[_0x3feb('0x3e')](function(_0x5a9e10){ut[_0x3feb('0x4a')](_0x3feb('0x5a'),_0x5a9e10);updateStatus(_0xd0c91);_0x43da9c(ut['message'](_0x3feb('0x5b')));});});};Fax[_0x3feb('0x1d')]['checkAfterSend']=function(_0x358b76){var _0x5f4e50=this;return new BPromise(function(_0x209227,_0x4019da){var _0x766412=_0x5f4e50[_0x3feb('0x5c')](_0x5f4e50[_0x3feb('0xd')][_0x358b76[_0x3feb('0x57')]][_0x3feb('0x5d')],_0x358b76);if(_0x766412[_0x3feb('0x5e')]){_0x209227(ut[_0x3feb('0x37')](_0x3feb('0x5f')));}else{_0x4019da(ut['message'](_0x766412[_0x3feb('0x37')]));}});};function originate(_0xf46af6,_0x88027c,_0x4c663e){return new BPromise(function(_0x21c12a,_0x3f34f0){if(_0x4c663e){var _0xfef98d=util['format'](_0x3feb('0x60'),path[_0x3feb('0x39')](_0xf46af6[_0x3feb('0x61')])[_0x3feb('0x24')],_0xf46af6['path']);gs[_0x3feb('0x62')](_0xfef98d)['then'](function(){_0xf46af6[_0x3feb('0x61')]=util[_0x3feb('0x63')]('%s/%s.tif',path['parse'](_0xf46af6[_0x3feb('0x61')])[_0x3feb('0x64')],path[_0x3feb('0x39')](_0xf46af6[_0x3feb('0x61')])[_0x3feb('0x24')]);_0x88027c[_0x3feb('0x65')]=_0xf46af6[_0x3feb('0x61')];ut[_0x3feb('0x4a')]('Convert\x20pdf\x20to\x20tif','');ami[_0x3feb('0x66')](ut[_0x3feb('0x67')](_0xf46af6,_0x88027c))[_0x3feb('0x3c')](function(_0x4ec42b){_0x21c12a(_0x4ec42b);})[_0x3feb('0x3e')](function(_0x1ba06a){_0x3f34f0(_0x1ba06a);});})[_0x3feb('0x3e')](function(_0x2ef347){_0x3f34f0(_0x2ef347);});}else{ami[_0x3feb('0x66')](ut[_0x3feb('0x67')](_0xf46af6,_0x88027c))['then'](function(_0x188057){_0x21c12a(_0x188057);})[_0x3feb('0x3e')](function(_0x5ae1a7){_0x3f34f0(_0x5ae1a7);});}});}Fax[_0x3feb('0x1d')][_0x3feb('0x68')]=function(_0x114b0d,_0x274180){var _0x57e243=this;return new BPromise(function(_0x3b993e,_0xb1c139){var _0x2e4734=uuid['v4']();var _0x31a4b4=ut[_0x3feb('0x69')](_0x114b0d,_0x274180);_0x57e243['actions'][_0x2e4734]=new Action(_0x2e4734,_0x274180,_0x114b0d);var _0x4a0e74=_0x57e243['actions'][_0x2e4734];if(path[_0x3feb('0x39')](_0x114b0d['path'])['ext']===_0x3feb('0x3a')){originate(_0x4a0e74,_0x31a4b4,!![])['then'](function(_0x53c6db){_0x3b993e(_0x53c6db);})[_0x3feb('0x3e')](function(_0x4fe7ff){_0xb1c139(_0x4fe7ff);});}else{originate(_0x4a0e74,_0x31a4b4,![])[_0x3feb('0x3c')](function(_0x599a89){_0x3b993e(_0x599a89);})[_0x3feb('0x3e')](function(_0x241840){_0xb1c139(_0x241840);});}});};Fax[_0x3feb('0x1d')][_0x3feb('0x6a')]=function(_0x2b13d2){return!_[_0x3feb('0x6b')](_0x2b13d2)&&!_[_0x3feb('0x6b')](_0x2b13d2['name'])&&!_['isNil'](_0x2b13d2[_0x3feb('0x6c')])&&_0x2b13d2['active']&&!_[_0x3feb('0x6b')](this['trunks'][util[_0x3feb('0x63')](_0x3feb('0x6d'),_0x2b13d2[_0x3feb('0x24')])])&&!_[_0x3feb('0x6b')](this['trunks'][util[_0x3feb('0x63')](_0x3feb('0x6d'),_0x2b13d2[_0x3feb('0x24')])][_0x3feb('0x2d')])&&(this[_0x3feb('0xe')][util[_0x3feb('0x63')](_0x3feb('0x6d'),_0x2b13d2[_0x3feb('0x24')])]['status']===_0x3feb('0x6e')||this[_0x3feb('0xe')][util[_0x3feb('0x63')](_0x3feb('0x6d'),_0x2b13d2['name'])][_0x3feb('0x2d')]===_0x3feb('0x6f'));};Fax[_0x3feb('0x1d')][_0x3feb('0x5c')]=function(_0x2f15e0,_0x53c662){if(!this[_0x3feb('0x6a')](_0x2f15e0)){ut['logger'](_0x3feb('0x70'),_['isNil'](_0x2f15e0)?'':_0x2f15e0[_0x3feb('0x24')]+_0x3feb('0x71'));return{'isValid':![],'message':_0x3feb('0x72')};}if(_['isNil'](_0x53c662[_0x3feb('0x3d')])){ut['logger'](_0x3feb('0x73'),JSON[_0x3feb('0x41')](_0x53c662));return{'isValid':![],'message':_0x3feb('0x74')};}if(_[_0x3feb('0x6b')](_0x53c662[_0x3feb('0x61')])){ut['logger'](_0x3feb('0x75'),JSON[_0x3feb('0x41')](_0x53c662));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module['exports']=Fax; \ No newline at end of file +var _0xd6ee=['actions','newchannel','varset','syncVarSet','newstate','bind','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','prototype','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','hasOwnProperty','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','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','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Is\x20Valid','exports','util','lodash','uuid','moment','path','../../../config/logger','fax','../ami','./rpcDb','./channel','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd6ee,0x1c5));var _0xed6e=function(_0x535ad6,_0x22b56c){_0x535ad6=_0x535ad6-0x0;var _0x12d4f6=_0xd6ee[_0x535ad6];return _0x12d4f6;};'use strict';var util=require(_0xed6e('0x0'));var _=require(_0xed6e('0x1'));var BPromise=require('bluebird');var uuid=require(_0xed6e('0x2'));var moment=require(_0xed6e('0x3'));var path=require(_0xed6e('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require('./util/gs');var logger=require(_0xed6e('0x5'))(_0xed6e('0x6'));var ami=require(_0xed6e('0x7'));var rpcDb=require(_0xed6e('0x8'));var Channel=require(_0xed6e('0x9'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xed6e('0xa'));var faxMessage=require(_0xed6e('0xb'));function Fax(_0x5e6ddd){this[_0xed6e('0xc')]={};this[_0xed6e('0xd')]=_0x5e6ddd[_0xed6e('0xd')];this[_0xed6e('0xe')]=_0x5e6ddd[_0xed6e('0xe')];this[_0xed6e('0xf')]={};ami['on'](_0xed6e('0x10'),this['syncNewchannel']['bind'](this));ami['on'](_0xed6e('0x11'),this[_0xed6e('0x12')]['bind'](this));ami['on'](_0xed6e('0x13'),this['syncNewState'][_0xed6e('0x14')](this));ami['on'](_0xed6e('0x15'),this[_0xed6e('0x16')][_0xed6e('0x14')](this));ami['on'](_0xed6e('0x17'),this[_0xed6e('0x18')][_0xed6e('0x14')](this));ami['on'](_0xed6e('0x19'),this[_0xed6e('0x1a')][_0xed6e('0x14')](this));ami['on'](_0xed6e('0x1b'),this[_0xed6e('0x1c')][_0xed6e('0x14')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0xed6e('0x14')](this));}Fax[_0xed6e('0x1d')]['syncNewchannel']=function(_0x2b7fee){if(_0x2b7fee['context']===_0xed6e('0x1e')){for(var _0x3a0c4e in this[_0xed6e('0xd')]){if(this[_0xed6e('0xd')]['hasOwnProperty'](_0x3a0c4e)){if(_0x2b7fee[_0xed6e('0x1f')]===this[_0xed6e('0xd')][_0x3a0c4e][_0xed6e('0x20')]){this[_0xed6e('0xc')][_0x2b7fee[_0xed6e('0x21')]]={};this[_0xed6e('0xc')][_0x2b7fee[_0xed6e('0x21')]][_0xed6e('0x22')]=_0x2b7fee[_0xed6e('0x22')];this[_0xed6e('0xc')][_0x2b7fee['uniqueid']]['id']=this['faxAccounts'][_0x3a0c4e]['id'];this[_0xed6e('0xc')][_0x2b7fee['uniqueid']][_0xed6e('0x23')]=this['faxAccounts'][_0x3a0c4e][_0xed6e('0x23')];logger[_0xed6e('0x24')](_0x2b7fee[_0xed6e('0x21')],'\x20syncNewchannel\x20');}}}}if(this[_0xed6e('0xf')][_0x2b7fee[_0xed6e('0x21')]]){this[_0xed6e('0xc')][_0x2b7fee[_0xed6e('0x21')]]={};this['channels'][_0x2b7fee['uniqueid']][_0xed6e('0x22')]=_0x2b7fee['channel'];logger[_0xed6e('0x24')](_0x2b7fee['uniqueid'],_0xed6e('0x25'));}};Fax['prototype'][_0xed6e('0x12')]=function(_0x12a334){if(this[_0xed6e('0xc')][_0x12a334['uniqueid']]){for(var _0x7bd4c0 in _0x12a334[_0xed6e('0x26')]){if(_0x12a334['variable']['hasOwnProperty'](_0x7bd4c0)){this[_0xed6e('0xc')][_0x12a334['uniqueid']][_0x7bd4c0]=_0x12a334[_0xed6e('0x27')];}}}};Fax[_0xed6e('0x1d')][_0xed6e('0x28')]=function(_0x198767){if(this[_0xed6e('0xc')][_0x198767['uniqueid']]){this['channels'][_0x198767['uniqueid']][_0xed6e('0x29')]=_0x198767[_0xed6e('0x29')];this[_0xed6e('0xc')][_0x198767[_0xed6e('0x21')]][_0xed6e('0x2a')]=_0x198767[_0xed6e('0x2a')];}};Fax['prototype']['syncNewExten']=function(_0x445457){if(this[_0xed6e('0xc')][_0x445457[_0xed6e('0x21')]]){for(var _0x3eb824 in _0x445457[_0xed6e('0x26')]){if(_0x445457[_0xed6e('0x26')][_0xed6e('0x2b')](_0x3eb824)){this['channels'][_0x445457[_0xed6e('0x21')]][_0x3eb824]=_0x445457['value'];}}}};Fax[_0xed6e('0x1d')]['syncFaxStatus']=function(_0x563ec3){if(this[_0xed6e('0xc')][_0x563ec3[_0xed6e('0x21')]]){this[_0xed6e('0xc')][_0x563ec3['uniqueid']][_0xed6e('0x2c')]=_0x563ec3[_0xed6e('0x2c')];this['channels'][_0x563ec3[_0xed6e('0x21')]][_0xed6e('0x2d')]=_0x563ec3[_0xed6e('0x2d')];this[_0xed6e('0xc')][_0x563ec3['uniqueid']]['localstationid']=_0x563ec3[_0xed6e('0x20')];this[_0xed6e('0xc')][_0x563ec3[_0xed6e('0x21')]][_0xed6e('0x2e')]=_0x563ec3[_0xed6e('0x2e')];logger[_0xed6e('0x24')](_0x563ec3[_0xed6e('0x21')],_0xed6e('0x2f'));}};Fax[_0xed6e('0x1d')][_0xed6e('0x1a')]=function(_0x4f5542){var _0x27430f=this;if(this[_0xed6e('0xc')][_0x4f5542[_0xed6e('0x21')]]){var _0x3b16cd=this[_0xed6e('0xc')][_0x4f5542['uniqueid']]['id'];this['channels'][_0x4f5542[_0xed6e('0x21')]]['remotestationid']=_0x4f5542[_0xed6e('0x30')];this[_0xed6e('0xc')][_0x4f5542[_0xed6e('0x21')]][_0xed6e('0x31')]=_0x4f5542[_0xed6e('0x31')];this[_0xed6e('0xc')][_0x4f5542[_0xed6e('0x21')]][_0xed6e('0x20')]=_0x4f5542[_0xed6e('0x20')];this[_0xed6e('0xc')][_0x4f5542[_0xed6e('0x21')]][_0xed6e('0x32')]=_0x4f5542[_0xed6e('0x32')];this[_0xed6e('0xc')][_0x4f5542[_0xed6e('0x21')]]['transferrate']=_0x4f5542[_0xed6e('0x33')];this[_0xed6e('0xc')][_0x4f5542[_0xed6e('0x21')]][_0xed6e('0x2e')]=_0x4f5542['filename'];this[_0xed6e('0xc')][_0x4f5542['uniqueid']][_0xed6e('0x34')]=_0x4f5542[_0xed6e('0x34')];if(this[_0xed6e('0xc')][_0x4f5542[_0xed6e('0x21')]][_0xed6e('0x31')]>0x0){tiff2pdf(_0x4f5542[_0xed6e('0x2e')],'/var/opt/motion2/server/files/attachments/',function(_0x309ad5){logger[_0xed6e('0x24')](_0x4f5542[_0xed6e('0x21')],_0xed6e('0x35'),_0x309ad5[_0xed6e('0x36')]);attachment[_0xed6e('0x37')]({'name':path[_0xed6e('0x38')](_0x4f5542[_0xed6e('0x2e')])[_0xed6e('0x23')],'basename':path['parse'](_0x4f5542[_0xed6e('0x2e')])[_0xed6e('0x23')]+_0xed6e('0x39'),'type':_0xed6e('0x3a')})[_0xed6e('0x3b')](function(_0x387268){faxAccount[_0xed6e('0x3c')](_0x3b16cd,{'from':_0x4f5542[_0xed6e('0x34')],'mapKey':_0xed6e('0x6'),'body':path['parse'](_0x4f5542['filename'])[_0xed6e('0x23')]+_0xed6e('0x39'),'AttachmentId':_0x387268['id']})[_0xed6e('0x3d')](function(_0x1e5561){logger['error'](_0x4f5542['uniqueid'],_0xed6e('0x3e'),JSON[_0xed6e('0x3f')](_0x1e5561));});})[_0xed6e('0x3d')](function(_0x4da099){logger['error'](_0x4f5542[_0xed6e('0x21')],_0xed6e('0x40'),JSON[_0xed6e('0x3f')](_0x4da099));});});}logger[_0xed6e('0x24')](_0x4f5542['uniqueid'],_0xed6e('0x40'));}};Fax[_0xed6e('0x1d')][_0xed6e('0x41')]=function(_0x43eb50){if(this['actions'][_0x43eb50[_0xed6e('0x21')]]){_[_0xed6e('0x42')](this[_0xed6e('0xc')][_0x43eb50[_0xed6e('0x21')]],_[_0xed6e('0x43')](_0x43eb50,[_0xed6e('0x44'),_0xed6e('0x45')]));}};function updateStatus(_0x1ae397){if(_0x1ae397[_0xed6e('0x46')]){faxMessage['update'](_0x1ae397[_0xed6e('0x46')],{'failMessage':_0xed6e('0x47')})[_0xed6e('0x3b')](function(_0xccdaeb){ut['logger'](_0xed6e('0x48'),_0xccdaeb);})[_0xed6e('0x3d')](function(_0x463008){ut[_0xed6e('0x49')](_0xed6e('0x4a'),_0x463008);});}else{ut[_0xed6e('0x49')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xed6e('0x1d')][_0xed6e('0x4b')]=function(_0x215c5c,_0x38c33b,_0x3fc929){var _0xad4522=this;var _0x11dbab={};if(_0x38c33b){_0x11dbab={'read':_0x38c33b};}else{_0x11dbab={'failMessage':_0x3fc929};}if(this[_0xed6e('0xf')][_0x215c5c]['AttachmentId']){faxMessage[_0xed6e('0x4c')](this[_0xed6e('0xf')][_0x215c5c]['AttachmentId'],_0x11dbab)[_0xed6e('0x3b')](function(_0xa41714){ut[_0xed6e('0x49')](_0xed6e('0x4d'),_0xa41714);})[_0xed6e('0x3d')](function(_0x591a7b){ut['logger'](_0xed6e('0x4e'),_0x591a7b);})['finally'](function(){delete _0xad4522[_0xed6e('0xc')][_0x215c5c];delete _0xad4522[_0xed6e('0xf')][_0x215c5c];});}else{ut[_0xed6e('0x49')](_0xed6e('0x4f'));delete this[_0xed6e('0xc')][_0x215c5c];delete this['actions'][_0x215c5c];}};Fax['prototype'][_0xed6e('0x1c')]=function(_0x29ce91){var _0x24ce7b=this;if(this[_0xed6e('0xc')][_0x29ce91[_0xed6e('0x21')]]){if(this[_0xed6e('0xf')][_0x29ce91[_0xed6e('0x21')]]){this[_0xed6e('0xc')][_0x29ce91[_0xed6e('0x21')]]['id']=this[_0xed6e('0xf')][_0x29ce91[_0xed6e('0x21')]]['id'];this['channels'][_0x29ce91[_0xed6e('0x21')]][_0xed6e('0x23')]=this[_0xed6e('0xf')][_0x29ce91[_0xed6e('0x21')]][_0xed6e('0x23')];}logger[_0xed6e('0x24')](_0x29ce91['uniqueid'],this[_0xed6e('0xf')][_0x29ce91[_0xed6e('0x21')]]?_0xed6e('0x50'):_0xed6e('0x51'),JSON['stringify'](this['channels'][_0x29ce91[_0xed6e('0x21')]]));if(this[_0xed6e('0xf')][_0x29ce91['uniqueid']]){if(this['channels'][_0x29ce91[_0xed6e('0x21')]][_0xed6e('0x52')]>0x0&&this['channels'][_0x29ce91[_0xed6e('0x21')]][_0xed6e('0x17')]==='SUCCESS'){this['updateStatus'](_0x29ce91[_0xed6e('0x21')],!![]);}else{this['updateStatus'](_0x29ce91[_0xed6e('0x21')],![],this[_0xed6e('0xc')][_0x29ce91['uniqueid']][_0xed6e('0x53')]?_0xed6e('0x54')+this[_0xed6e('0xc')][_0x29ce91[_0xed6e('0x21')]]['faxstatusstring']:_0xed6e('0x55'));}}}};Fax[_0xed6e('0x1d')]['send']=function(_0x3fa83f){var _0x4e98a8=this;return new BPromise(function(_0x34fd6e,_0x1b9fd6){_0x4e98a8[_0xed6e('0x56')](_0x3fa83f,_0x4e98a8[_0xed6e('0xd')][_0x3fa83f['FaxAccountId']])[_0xed6e('0x3b')](function(_0x160552){ut[_0xed6e('0x49')](_0xed6e('0x57'),_0x160552);_0x34fd6e(ut['message'](_0xed6e('0x58')));})[_0xed6e('0x3d')](function(_0x157e2e){ut['logger'](_0xed6e('0x59'),_0x157e2e);updateStatus(_0x3fa83f);_0x1b9fd6(ut['message'](_0xed6e('0x5a')));});});};Fax[_0xed6e('0x1d')][_0xed6e('0x5b')]=function(_0x441be5){var _0x35c317=this;return new BPromise(function(_0x4cc175,_0x3d00d8){var _0x130a67=_0x35c317[_0xed6e('0x5c')](_0x35c317[_0xed6e('0xd')][_0x441be5[_0xed6e('0x5d')]]['Trunk'],_0x441be5);if(_0x130a67['isValid']){_0x4cc175(ut[_0xed6e('0x36')](_0xed6e('0x5e')));}else{_0x3d00d8(ut[_0xed6e('0x36')](_0x130a67['message']));}});};function originate(_0x5d6bbd,_0x13764a,_0x4800fe){return new BPromise(function(_0x3a867d,_0x415b37){if(_0x4800fe){var _0x1983c1=util[_0xed6e('0x5f')](_0xed6e('0x60'),path[_0xed6e('0x38')](_0x5d6bbd['path'])['name'],_0x5d6bbd['path']);gs[_0xed6e('0x61')](_0x1983c1)['then'](function(){_0x5d6bbd[_0xed6e('0x4')]=util[_0xed6e('0x5f')](_0xed6e('0x62'),path[_0xed6e('0x38')](_0x5d6bbd[_0xed6e('0x4')])[_0xed6e('0x63')],path[_0xed6e('0x38')](_0x5d6bbd[_0xed6e('0x4')])[_0xed6e('0x23')]);_0x13764a['XMF-PATH']=_0x5d6bbd[_0xed6e('0x4')];ut[_0xed6e('0x49')](_0xed6e('0x64'),'');ami['Action'](ut[_0xed6e('0x65')](_0x5d6bbd,_0x13764a))[_0xed6e('0x3b')](function(_0xef25d7){_0x3a867d(_0xef25d7);})['catch'](function(_0x4ebe5a){_0x415b37(_0x4ebe5a);});})[_0xed6e('0x3d')](function(_0x27f9ef){_0x415b37(_0x27f9ef);});}else{ami[_0xed6e('0x66')](ut['variablesAction'](_0x5d6bbd,_0x13764a))['then'](function(_0x5e8460){_0x3a867d(_0x5e8460);})[_0xed6e('0x3d')](function(_0x2c8574){_0x415b37(_0x2c8574);});}});}Fax[_0xed6e('0x1d')][_0xed6e('0x56')]=function(_0x41bcf9,_0x38aafe){var _0x32583a=this;return new BPromise(function(_0x19b665,_0x2cdf20){var _0x30dccf=uuid['v4']();var _0x2e5562=ut[_0xed6e('0x67')](_0x41bcf9,_0x38aafe);_0x32583a[_0xed6e('0xf')][_0x30dccf]=new Action(_0x30dccf,_0x38aafe,_0x41bcf9);var _0xeae415=_0x32583a[_0xed6e('0xf')][_0x30dccf];if(path[_0xed6e('0x38')](_0x41bcf9[_0xed6e('0x4')])[_0xed6e('0x68')]===_0xed6e('0x39')){originate(_0xeae415,_0x2e5562,!![])['then'](function(_0x432b2e){_0x19b665(_0x432b2e);})[_0xed6e('0x3d')](function(_0x52727e){_0x2cdf20(_0x52727e);});}else{originate(_0xeae415,_0x2e5562,![])[_0xed6e('0x3b')](function(_0x4af760){_0x19b665(_0x4af760);})[_0xed6e('0x3d')](function(_0x2f31f4){_0x2cdf20(_0x2f31f4);});}});};Fax['prototype'][_0xed6e('0x69')]=function(_0x41d2c0){return!_[_0xed6e('0x6a')](_0x41d2c0)&&!_[_0xed6e('0x6a')](_0x41d2c0[_0xed6e('0x23')])&&!_[_0xed6e('0x6a')](_0x41d2c0['active'])&&_0x41d2c0[_0xed6e('0x6b')]&&!_[_0xed6e('0x6a')](this[_0xed6e('0xe')][util[_0xed6e('0x5f')](_0xed6e('0x6c'),_0x41d2c0['name'])])&&!_[_0xed6e('0x6a')](this['trunks'][util[_0xed6e('0x5f')](_0xed6e('0x6c'),_0x41d2c0[_0xed6e('0x23')])][_0xed6e('0x2d')])&&(this[_0xed6e('0xe')][util[_0xed6e('0x5f')](_0xed6e('0x6c'),_0x41d2c0[_0xed6e('0x23')])]['status']===_0xed6e('0x6d')||this['trunks'][util[_0xed6e('0x5f')]('SIP/%s',_0x41d2c0[_0xed6e('0x23')])][_0xed6e('0x2d')]===_0xed6e('0x6e'));};Fax[_0xed6e('0x1d')][_0xed6e('0x5c')]=function(_0x845d38,_0x2f498f){if(!this[_0xed6e('0x69')](_0x845d38)){ut[_0xed6e('0x49')](_0xed6e('0x6f'),_[_0xed6e('0x6a')](_0x845d38)?'':_0x845d38[_0xed6e('0x23')]+_0xed6e('0x70'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_['isNil'](_0x2f498f[_0xed6e('0x6')])){ut['logger'](_0xed6e('0x71'),JSON[_0xed6e('0x3f')](_0x2f498f));return{'isValid':![],'message':_0xed6e('0x72')};}if(_[_0xed6e('0x6a')](_0x2f498f['path'])){ut[_0xed6e('0x49')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xed6e('0x3f')](_0x2f498f));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xed6e('0x73')};};module[_0xed6e('0x74')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index e01c42f..88bcd45 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 _0x8e02=['catch','[Notify]\x20','util','bluebird','../../../config/logger','lodash','../rpc/faxAccount','inspect','then','notify'];(function(_0x1f9c40,_0x373095){var _0x116690=function(_0x263562){while(--_0x263562){_0x1f9c40['push'](_0x1f9c40['shift']());}};_0x116690(++_0x373095);}(_0x8e02,0xac));var _0x28e0=function(_0x5e6f3f,_0x58e92d){_0x5e6f3f=_0x5e6f3f-0x0;var _0x2cf741=_0x8e02[_0x5e6f3f];return _0x2cf741;};'use strict';var util=require(_0x28e0('0x0'));var BPromise=require(_0x28e0('0x1'));var logger=require(_0x28e0('0x2'))('preview');var _=require(_0x28e0('0x3'));var faxAccount=require(_0x28e0('0x4'));function loggerCatch(_0x4991f2){return function(_0x8dff77){logger['error'](_0x4991f2,util[_0x28e0('0x5')](_0x8dff77,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x51e5df,_0x11a5f3){return BPromise['resolve']()[_0x28e0('0x6')](faxAccount[_0x28e0('0x7')](_0x51e5df,_0x11a5f3))[_0x28e0('0x8')](loggerCatch(_0x28e0('0x9')));}; \ No newline at end of file +var _0x144e=['notify','then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount'];(function(_0x248fc8,_0x121ebf){var _0x1ec5d1=function(_0x4784fc){while(--_0x4784fc){_0x248fc8['push'](_0x248fc8['shift']());}};_0x1ec5d1(++_0x121ebf);}(_0x144e,0x1a8));var _0xe144=function(_0x54bd77,_0xe53bd1){_0x54bd77=_0x54bd77-0x0;var _0x305e47=_0x144e[_0x54bd77];return _0x305e47;};'use strict';var util=require(_0xe144('0x0'));var BPromise=require(_0xe144('0x1'));var logger=require(_0xe144('0x2'))(_0xe144('0x3'));var _=require(_0xe144('0x4'));var faxAccount=require(_0xe144('0x5'));function loggerCatch(_0x4f225e){return function(_0x5c1d3b){logger['error'](_0x4f225e,util['inspect'](_0x5c1d3b,{'showHidden':![],'depth':null}));};}exports[_0xe144('0x6')]=function(_0x36d0d1,_0x161cf5){return BPromise['resolve']()[_0xe144('0x7')](faxAccount['notify'](_0x36d0d1,_0x161cf5))[_0xe144('0x8')](loggerCatch(_0xe144('0x9')));}; \ 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 4735365..2f6ee6f 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 _0xaa5a=['exec','execute','Exec\x20gs','inspect','util','../../../../config/logger','fax','child_process'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xaa5a,0x1b4));var _0xaaa5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa5a[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xaaa5('0x0'));var logger=require(_0xaaa5('0x1'))(_0xaaa5('0x2'));var BPromise=require('bluebird');var exec=require(_0xaaa5('0x3'))[_0xaaa5('0x4')];exports[_0xaaa5('0x5')]=function(_0x34314d){return new BPromise(function(_0x3a84f2,_0xfb84de){exec(_0x34314d,function(_0x36da23,_0x2ba590,_0x3117c7){logger['info']('Exec\x20gs',_0x2ba590);if(_0x36da23){logger['info'](_0xaaa5('0x6'),'\x20Error\x20:',util[_0xaaa5('0x7')](_0x36da23,{'showHidden':![],'depth':null}),_0x2ba590,_0x3117c7);_0xfb84de(_0x36da23);}_0x3a84f2(_0x2ba590);});});}; \ No newline at end of file +var _0x115d=['fax','child_process','exec','execute','Exec\x20gs','info','inspect'];(function(_0x5bba11,_0xe514ce){var _0xfb4bb1=function(_0x26e319){while(--_0x26e319){_0x5bba11['push'](_0x5bba11['shift']());}};_0xfb4bb1(++_0xe514ce);}(_0x115d,0x10a));var _0xd115=function(_0x1db2be,_0x6153f9){_0x1db2be=_0x1db2be-0x0;var _0x15d481=_0x115d[_0x1db2be];return _0x15d481;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0xd115('0x0'));var BPromise=require('bluebird');var exec=require(_0xd115('0x1'))[_0xd115('0x2')];exports[_0xd115('0x3')]=function(_0x3cc9ae){return new BPromise(function(_0xfd146a,_0x3ddfce){exec(_0x3cc9ae,function(_0x451d3b,_0x5f4b9c,_0x45d5c9){logger['info'](_0xd115('0x4'),_0x5f4b9c);if(_0x451d3b){logger[_0xd115('0x5')]('Exec\x20gs','\x20Error\x20:',util[_0xd115('0x6')](_0x451d3b,{'showHidden':![],'depth':null}),_0x5f4b9c,_0x45d5c9);_0x3ddfce(_0x451d3b);}_0xfd146a(_0x5f4b9c);});});}; \ 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 9895856..20e6797 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 _0x7115=['\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip'];(function(_0xcb1d68,_0xa012e3){var _0xf2e1cd=function(_0x23e747){while(--_0x23e747){_0xcb1d68['push'](_0xcb1d68['shift']());}};_0xf2e1cd(++_0xa012e3);}(_0x7115,0x17b));var _0x5711=function(_0x376dba,_0x481693){_0x376dba=_0x376dba-0x0;var _0x3b1b75=_0x7115[_0x376dba];return _0x3b1b75;};'use strict';var util=require(_0x5711('0x0'));var _=require(_0x5711('0x1'));var moment=require(_0x5711('0x2'));var logger=require(_0x5711('0x3'))(_0x5711('0x4'));exports[_0x5711('0x5')]=function(_0x1280cf){return{'message':_0x1280cf};};exports[_0x5711('0x6')]=function(_0x4bfe9c,_0x48fda4){logger[_0x5711('0x7')](_0x4bfe9c,util[_0x5711('0x8')](_0x48fda4,{'showHidden':![],'depth':null}));};exports[_0x5711('0x9')]=function(_0x5d3689,_0x3d01ec){var _0x329c1f={'XMF-ECM':_0x3d01ec[_0x5711('0xa')],'XMF-HEADERINFO':_0x3d01ec[_0x5711('0xb')],'XMF-MINRATE':_0x3d01ec[_0x5711('0xc')],'XMF-MAXRATE':_0x3d01ec[_0x5711('0xd')],'XMF-MODEM':util[_0x5711('0xe')](_0x5711('0xf'),_0x3d01ec['modem']),'XMF-GATEWAY':_0x3d01ec[_0x5711('0x10')],'XMF-FAXDETECT':_0x3d01ec[_0x5711('0x11')],'XMF-T38TIMEOUT':_0x3d01ec[_0x5711('0x12')],'XMF-LOCALSTATIONID':_0x3d01ec[_0x5711('0x13')],'XMF-PATH':_0x5d3689[_0x5711('0x14')]};return _0x329c1f;};exports[_0x5711('0x15')]=function(_0x564a0c,_0x5bd729){return{'actionid':_0x564a0c[_0x5711('0x16')],'action':'originate','channel':_0x564a0c[_0x5711('0x17')],'Exten':_0x5711('0x18'),'Context':_0x5711('0x19'),'Priority':'1','callerid':util[_0x5711('0xe')](_0x5711('0x1a'),_0x564a0c[_0x5711('0xb')]?_0x564a0c[_0x5711('0xb')]:'',_0x564a0c[_0x5711('0x13')]),'variable':_0x5bd729,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x564a0c[_0x5711('0x16')]};}; \ No newline at end of file +var _0x5562=['logger','info','inspect','headerinfo','minrate','maxrate','\x22%s\x22','faxdetect','t38timeout','path','originate','xcally-motion-fax','from-sip','format','localstationid','lodash','../../../../config/logger'];(function(_0x845505,_0x19e5f3){var _0x2513b9=function(_0x10e7af){while(--_0x10e7af){_0x845505['push'](_0x845505['shift']());}};_0x2513b9(++_0x19e5f3);}(_0x5562,0x185));var _0x2556=function(_0x1f7120,_0x53456a){_0x1f7120=_0x1f7120-0x0;var _0x512142=_0x5562[_0x1f7120];return _0x512142;};'use strict';var util=require('util');var _=require(_0x2556('0x0'));var moment=require('moment');var logger=require(_0x2556('0x1'))('fax');exports['message']=function(_0x4837ea){return{'message':_0x4837ea};};exports[_0x2556('0x2')]=function(_0x20b2a6,_0x166f96){logger[_0x2556('0x3')](_0x20b2a6,util[_0x2556('0x4')](_0x166f96,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x400b8f,_0x40d9b7){var _0x166f16={'XMF-ECM':_0x40d9b7['ecm'],'XMF-HEADERINFO':_0x40d9b7[_0x2556('0x5')],'XMF-MINRATE':_0x40d9b7[_0x2556('0x6')],'XMF-MAXRATE':_0x40d9b7[_0x2556('0x7')],'XMF-MODEM':util['format'](_0x2556('0x8'),_0x40d9b7['modem']),'XMF-GATEWAY':_0x40d9b7['gateway'],'XMF-FAXDETECT':_0x40d9b7[_0x2556('0x9')],'XMF-T38TIMEOUT':_0x40d9b7[_0x2556('0xa')],'XMF-LOCALSTATIONID':_0x40d9b7['localstationid'],'XMF-PATH':_0x400b8f[_0x2556('0xb')]};return _0x166f16;};exports['variablesAction']=function(_0x2aa413,_0x1f142d){return{'actionid':_0x2aa413['uniqueid'],'action':_0x2556('0xc'),'channel':_0x2aa413['channel'],'Exten':_0x2556('0xd'),'Context':_0x2556('0xe'),'Priority':'1','callerid':util[_0x2556('0xf')]('\x22%s\x22\x20<%s>',_0x2aa413[_0x2556('0x5')]?_0x2aa413['headerinfo']:'',_0x2aa413[_0x2556('0x10')]),'variable':_0x1f142d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2aa413['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 895c4a5..dae9c99 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 _0xfa1e=['./rpc/integrations/freshsales','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','error','[index.js][initParams]','inspect','sync','catch','bluebird','util','moment','./server','./acw','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger'];(function(_0x2b5168,_0x472fdd){var _0x3a9268=function(_0x390283){while(--_0x390283){_0x2b5168['push'](_0x2b5168['shift']());}};_0x3a9268(++_0x472fdd);}(_0xfa1e,0x102));var _0xefa1=function(_0x50fda9,_0x5ee44b){_0x50fda9=_0x50fda9-0x0;var _0x36b92b=_0xfa1e[_0x50fda9];return _0x36b92b;};'use strict';var BPromise=require(_0xefa1('0x0'));var util=require(_0xefa1('0x1'));var moment=require(_0xefa1('0x2'));var server=require(_0xefa1('0x3'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0xefa1('0x4'));var Trigger=require('./trigger');var Dialer=require(_0xefa1('0x5'));var Preview=require(_0xefa1('0x6'));var Fax=require(_0xefa1('0x7'));var user=require(_0xefa1('0x8'));var voiceQueue=require(_0xefa1('0x9'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xefa1('0xa'));var trigger=require(_0xefa1('0xb'));var template=require(_0xefa1('0xc'));var cmHopperHistory=require(_0xefa1('0xd'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xefa1('0xe'));var zendesk=require(_0xefa1('0xf'));var salesforce=require(_0xefa1('0x10'));var sugarcrm=require(_0xefa1('0x11'));var freshdesk=require(_0xefa1('0x12'));var desk=require(_0xefa1('0x13'));var zoho=require(_0xefa1('0x14'));var vtiger=require(_0xefa1('0x15'));var freshsales=require(_0xefa1('0x16'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xefa1('0x17'))(_0xefa1('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xefa1('0x19')](_0xefa1('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xefa1('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xefa1('0x1b')]()[_0xefa1('0x1c')](user[_0xefa1('0x1d')]())[_0xefa1('0x1c')](realtime[_0xefa1('0x1e')]())['then'](user[_0xefa1('0x1f')]())[_0xefa1('0x1c')](realtime[_0xefa1('0x20')]())['then'](trunk[_0xefa1('0x21')]())[_0xefa1('0x1c')](realtime[_0xefa1('0x22')]())[_0xefa1('0x1c')](voiceQueue[_0xefa1('0x23')]())[_0xefa1('0x1c')](realtime[_0xefa1('0x24')]())[_0xefa1('0x1c')](trigger[_0xefa1('0x25')]())[_0xefa1('0x1c')](realtime[_0xefa1('0x26')]())[_0xefa1('0x1c')](template[_0xefa1('0x27')]())[_0xefa1('0x1c')](realtime[_0xefa1('0x28')]())[_0xefa1('0x1c')](zendesk[_0xefa1('0x29')]())['then'](realtime['initZendeskAccounts']())[_0xefa1('0x1c')](salesforce[_0xefa1('0x2a')]())[_0xefa1('0x1c')](realtime[_0xefa1('0x2b')]())[_0xefa1('0x1c')](sugarcrm[_0xefa1('0x2c')]())[_0xefa1('0x1c')](realtime['initSugarcrmAccounts']())[_0xefa1('0x1c')](freshdesk['getFreshdeskAccounts']())[_0xefa1('0x1c')](realtime['initFreshdeskAccounts']())[_0xefa1('0x1c')](desk[_0xefa1('0x2d')]())[_0xefa1('0x1c')](realtime[_0xefa1('0x2e')]())['then'](zoho[_0xefa1('0x2f')]())[_0xefa1('0x1c')](realtime['initZohoAccounts']())[_0xefa1('0x1c')](vtiger['getVtigerAccounts']())[_0xefa1('0x1c')](realtime[_0xefa1('0x30')]())[_0xefa1('0x1c')](freshsales[_0xefa1('0x31')]())[_0xefa1('0x1c')](realtime[_0xefa1('0x32')]())[_0xefa1('0x1c')](servicenow['getServicenowAccounts']())['then'](realtime[_0xefa1('0x33')]())[_0xefa1('0x1c')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0xefa1('0x34')]())['then'](campaign[_0xefa1('0x35')]())['then'](realtime[_0xefa1('0x36')]())[_0xefa1('0x1c')](voiceExtension[_0xefa1('0x37')]())[_0xefa1('0x1c')](realtime[_0xefa1('0x38')]())[_0xefa1('0x1c')](faxAccount[_0xefa1('0x39')]())['then'](realtime[_0xefa1('0x3a')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xefa1('0x1b')]()[_0xefa1('0x1c')](voiceQueueReport[_0xefa1('0x3b')]())['then'](realtime[_0xefa1('0x3c')]())['then'](cmHopperHistory[_0xefa1('0x3d')]())[_0xefa1('0x1c')](realtime[_0xefa1('0x3e')]())[_0xefa1('0x1c')](cmHopperHistory[_0xefa1('0x3f')]())['then'](realtime[_0xefa1('0x40')]())[_0xefa1('0x1c')](voiceCallReport['getVoiceCallReports']())['then'](realtime['initVoiceCallReports']())['catch'](function(_0x3a0695){logger[_0xefa1('0x41')](_0xefa1('0x42'),util[_0xefa1('0x43')](_0x3a0695,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xefa1('0x1c')](function(_0x58af3f){return initRealtime();})[_0xefa1('0x1c')](function(){return initParams();})[_0xefa1('0x1c')](function(){report[_0xefa1('0x44')]();setInterval(initRealtime,0x1388);})[_0xefa1('0x45')](function(_0x256d3e){logger['error']('[index.js][main]',util['inspect'](_0x256d3e,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xd6dc=['getTelephones','initTelephones','getTrunks','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]','inspect','listen','bluebird','util','./server','./realtime','./report','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','hour','get','resolve','getAgents','then','initAgents'];(function(_0x1d967b,_0x55f1e7){var _0x328724=function(_0x35d2aa){while(--_0x35d2aa){_0x1d967b['push'](_0x1d967b['shift']());}};_0x328724(++_0x55f1e7);}(_0xd6dc,0x184));var _0xcd6d=function(_0x5ca107,_0x4c6b72){_0x5ca107=_0x5ca107-0x0;var _0x213a12=_0xd6dc[_0x5ca107];return _0x213a12;};'use strict';var BPromise=require(_0xcd6d('0x0'));var util=require(_0xcd6d('0x1'));var moment=require('moment');var server=require(_0xcd6d('0x2'));var Realtime=require(_0xcd6d('0x3'));var Report=require(_0xcd6d('0x4'));var Acw=require('./acw');var Trigger=require(_0xcd6d('0x5'));var Dialer=require(_0xcd6d('0x6'));var Preview=require('./preview');var Fax=require(_0xcd6d('0x7'));var user=require(_0xcd6d('0x8'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xcd6d('0x9'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xcd6d('0xa'));var trigger=require(_0xcd6d('0xb'));var template=require('./rpc/template');var cmHopperHistory=require(_0xcd6d('0xc'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xcd6d('0xd'));var faxAccount=require(_0xcd6d('0xe'));var zendesk=require(_0xcd6d('0xf'));var salesforce=require(_0xcd6d('0x10'));var sugarcrm=require(_0xcd6d('0x11'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xcd6d('0x12'));var zoho=require(_0xcd6d('0x13'));var vtiger=require(_0xcd6d('0x14'));var freshsales=require(_0xcd6d('0x15'));var servicenow=require(_0xcd6d('0x16'));var dynamics365=require(_0xcd6d('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xcd6d('0x18'))(_0xcd6d('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xcd6d('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xcd6d('0x1b')](_0xcd6d('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xcd6d('0x1c')]()['then'](user[_0xcd6d('0x1d')]())[_0xcd6d('0x1e')](realtime[_0xcd6d('0x1f')]())[_0xcd6d('0x1e')](user[_0xcd6d('0x20')]())[_0xcd6d('0x1e')](realtime[_0xcd6d('0x21')]())[_0xcd6d('0x1e')](trunk[_0xcd6d('0x22')]())[_0xcd6d('0x1e')](realtime['initTrunks']())['then'](voiceQueue['getVoiceQueues']())[_0xcd6d('0x1e')](realtime[_0xcd6d('0x23')]())[_0xcd6d('0x1e')](trigger['getTriggers']())[_0xcd6d('0x1e')](realtime[_0xcd6d('0x24')]())[_0xcd6d('0x1e')](template[_0xcd6d('0x25')]())['then'](realtime[_0xcd6d('0x26')]())['then'](zendesk[_0xcd6d('0x27')]())[_0xcd6d('0x1e')](realtime[_0xcd6d('0x28')]())[_0xcd6d('0x1e')](salesforce[_0xcd6d('0x29')]())[_0xcd6d('0x1e')](realtime[_0xcd6d('0x2a')]())[_0xcd6d('0x1e')](sugarcrm[_0xcd6d('0x2b')]())[_0xcd6d('0x1e')](realtime[_0xcd6d('0x2c')]())['then'](freshdesk['getFreshdeskAccounts']())[_0xcd6d('0x1e')](realtime[_0xcd6d('0x2d')]())[_0xcd6d('0x1e')](desk[_0xcd6d('0x2e')]())['then'](realtime[_0xcd6d('0x2f')]())[_0xcd6d('0x1e')](zoho[_0xcd6d('0x30')]())[_0xcd6d('0x1e')](realtime[_0xcd6d('0x31')]())[_0xcd6d('0x1e')](vtiger['getVtigerAccounts']())[_0xcd6d('0x1e')](realtime[_0xcd6d('0x32')]())[_0xcd6d('0x1e')](freshsales[_0xcd6d('0x33')]())[_0xcd6d('0x1e')](realtime[_0xcd6d('0x34')]())[_0xcd6d('0x1e')](servicenow[_0xcd6d('0x35')]())['then'](realtime['initServicenowAccounts']())[_0xcd6d('0x1e')](dynamics365[_0xcd6d('0x36')]())[_0xcd6d('0x1e')](realtime['initDynamics365Accounts']())[_0xcd6d('0x1e')](campaign[_0xcd6d('0x37')]())['then'](realtime[_0xcd6d('0x38')]())[_0xcd6d('0x1e')](voiceExtension['getVoiceExtensions']())[_0xcd6d('0x1e')](realtime[_0xcd6d('0x39')]())[_0xcd6d('0x1e')](faxAccount[_0xcd6d('0x3a')]())[_0xcd6d('0x1e')](realtime['initFaxAccounts']())[_0xcd6d('0x1e')](function(){return realtime;});}function initParams(){return BPromise[_0xcd6d('0x1c')]()[_0xcd6d('0x1e')](voiceQueueReport[_0xcd6d('0x3b')]())[_0xcd6d('0x1e')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0xcd6d('0x3c')]())[_0xcd6d('0x1e')](realtime[_0xcd6d('0x3d')]())[_0xcd6d('0x1e')](cmHopperHistory[_0xcd6d('0x3e')]())[_0xcd6d('0x1e')](realtime[_0xcd6d('0x3f')]())[_0xcd6d('0x1e')](voiceCallReport[_0xcd6d('0x40')]())[_0xcd6d('0x1e')](realtime[_0xcd6d('0x41')]())['catch'](function(_0x42e19e){logger[_0xcd6d('0x42')](_0xcd6d('0x43'),util[_0xcd6d('0x44')](_0x42e19e,{'showHidden':![],'depth':null}));});}function main(){return server[_0xcd6d('0x45')](realtime,preview,fax)[_0xcd6d('0x1e')](function(_0x5add2d){return initRealtime();})[_0xcd6d('0x1e')](function(){return initParams();})[_0xcd6d('0x1e')](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x131cf3){logger[_0xcd6d('0x42')]('[index.js][main]',util[_0xcd6d('0x44')](_0x131cf3,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 3d707ca..cec5457 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 _0x70e0=['name','voiceStatusQueue','onhold','stringify','md5','user:%s','user:save','emit','user:presence','lodash','util','moment','../../../config/environment','redis','defaults','socket.io-emitter','email','accountcode','fullname','state','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format'];(function(_0x2316d4,_0x59ef92){var _0xcead33=function(_0x4f2528){while(--_0x4f2528){_0x2316d4['push'](_0x2316d4['shift']());}};_0xcead33(++_0x59ef92);}(_0x70e0,0x17b));var _0x070e=function(_0x5378e6,_0x536920){_0x5378e6=_0x5378e6-0x0;var _0x119041=_0x70e0[_0x5378e6];return _0x119041;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x070e('0x3'));config[_0x070e('0x4')]=_[_0x070e('0x5')](config[_0x070e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x6'))(new Redis(config['redis']));function Agent(_0x46fe68){this['id']=_0x46fe68['id']||0x0;this['name']=_0x46fe68['name']||'';this['email']=_0x46fe68[_0x070e('0x7')]||'';this[_0x070e('0x8')]=_0x46fe68[_0x070e('0x8')]||'';this[_0x070e('0x9')]=_0x46fe68[_0x070e('0x9')]||'';this[_0x070e('0xa')]=_0x070e('0xb');this['stateTime']=0x0;this['status']=_0x070e('0xb');this[_0x070e('0xc')]='';this[_0x070e('0xd')]='';this[_0x070e('0xe')]='';this[_0x070e('0xf')]='';this[_0x070e('0x10')]=_0x46fe68[_0x070e('0x10')]||![];this[_0x070e('0x11')]=_0x070e('0xb');this[_0x070e('0x12')]=0x0;this[_0x070e('0x13')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x070e('0x14')]=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x11d2ce){var _0x14c3fd;if(_0x11d2ce&&_0x11d2ce['state']){_0x14c3fd=_0x11d2ce['state'][_0x070e('0x15')]();switch(_0x14c3fd){case _0x070e('0x16'):_0x14c3fd=_0x070e('0x17');break;case _0x070e('0x18'):_0x14c3fd='talking';break;}}if(_0x14c3fd&&this['voiceStatus']!==_0x14c3fd||_0x11d2ce[_0x070e('0x19')]){this[_0x070e('0x12')]=_[_0x070e('0x1a')](moment()[_0x070e('0x1b')]('x'));}if(_0x14c3fd){this[_0x070e('0x11')]=_0x14c3fd;}var _0x5037eb={'id':this['id'],'name':this[_0x070e('0x1c')],'email':this[_0x070e('0x7')],'accountcode':this[_0x070e('0x8')],'fullname':this[_0x070e('0x9')],'state':this[_0x070e('0xa')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x070e('0x10')],'voiceStatus':this[_0x070e('0x11')],'voiceStatusTime':this[_0x070e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x070e('0x1d')],'interface':this['interface'],'onhold':this[_0x070e('0x1e')]};var _0x3f6985=md5(JSON[_0x070e('0x1f')](_0x5037eb));if(this[_0x070e('0x20')]!==_0x3f6985){this[_0x070e('0x20')]=_0x3f6985;io['to'](util[_0x070e('0x1b')](_0x070e('0x21'),_0x5037eb[_0x070e('0x1c')]))['emit'](_0x070e('0x22'),_0x5037eb);io[_0x070e('0x23')](_0x070e('0x24'),_0x5037eb);}};module['exports']=Agent; \ No newline at end of file +var _0xedd9=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','statePause','toNumber','interface','format','user:%s','user:save','emit','user:presence','exports','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','status'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xedd9,0xfc));var _0x9edd=function(_0xd72b11,_0x19086d){_0xd72b11=_0xd72b11-0x0;var _0x5a3ec7=_0xedd9[_0xd72b11];return _0x5a3ec7;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var md5=require(_0x9edd('0x2'));var Redis=require(_0x9edd('0x3'));var config=require(_0x9edd('0x4'));config[_0x9edd('0x5')]=_[_0x9edd('0x6')](config[_0x9edd('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9edd('0x7'))(new Redis(config[_0x9edd('0x5')]));function Agent(_0x268f9e){this['id']=_0x268f9e['id']||0x0;this[_0x9edd('0x8')]=_0x268f9e['name']||'';this[_0x9edd('0x9')]=_0x268f9e['email']||'';this[_0x9edd('0xa')]=_0x268f9e[_0x9edd('0xa')]||'';this[_0x9edd('0xb')]=_0x268f9e[_0x9edd('0xb')]||'';this['state']=_0x9edd('0xc');this['stateTime']=0x0;this[_0x9edd('0xd')]=_0x9edd('0xc');this['address']='';this[_0x9edd('0xe')]='';this[_0x9edd('0xf')]='';this['interface']='';this[_0x9edd('0x10')]=_0x268f9e[_0x9edd('0x10')]||![];this[_0x9edd('0x11')]=_0x9edd('0xc');this[_0x9edd('0x12')]=0x0;this[_0x9edd('0x13')]='';this[_0x9edd('0x14')]='';this[_0x9edd('0x15')]=![];this['local']=![];this[_0x9edd('0x2')]='';}Agent[_0x9edd('0x16')][_0x9edd('0x17')]=function(_0x4d9a7){var _0x13b6b6;if(_0x4d9a7&&_0x4d9a7[_0x9edd('0x18')]){_0x13b6b6=_0x4d9a7[_0x9edd('0x18')][_0x9edd('0x19')]();switch(_0x13b6b6){case'not_inuse':_0x13b6b6=_0x9edd('0x1a');break;case _0x9edd('0x1b'):_0x13b6b6=_0x9edd('0x1c');break;}}if(_0x13b6b6&&this['voiceStatus']!==_0x13b6b6||_0x4d9a7[_0x9edd('0x1d')]){this[_0x9edd('0x12')]=_[_0x9edd('0x1e')](moment()['format']('x'));}if(_0x13b6b6){this[_0x9edd('0x11')]=_0x13b6b6;}var _0x5d879c={'id':this['id'],'name':this[_0x9edd('0x8')],'email':this[_0x9edd('0x9')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x9edd('0x18')],'stateTime':this['stateTime'],'status':this[_0x9edd('0xd')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x9edd('0x11')],'voiceStatusTime':this[_0x9edd('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x9edd('0x1f')],'onhold':this[_0x9edd('0x15')]};var _0x477878=md5(JSON['stringify'](_0x5d879c));if(this[_0x9edd('0x2')]!==_0x477878){this[_0x9edd('0x2')]=_0x477878;io['to'](util[_0x9edd('0x20')](_0x9edd('0x21'),_0x5d879c[_0x9edd('0x8')]))['emit'](_0x9edd('0x22'),_0x5d879c);io[_0x9edd('0x23')](_0x9edd('0x24'),_0x5d879c);}};module[_0x9edd('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index b2387cf..55987ed 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 _0x7e3b=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0x426d6d,_0x154f98){var _0x4bd333=function(_0x4ae931){while(--_0x4ae931){_0x426d6d['push'](_0x426d6d['shift']());}};_0x4bd333(++_0x154f98);}(_0x7e3b,0x7e));var _0xb7e3=function(_0x54e087,_0x424ce1){_0x54e087=_0x54e087-0x0;var _0x1c2d54=_0x7e3b[_0x54e087];return _0x1c2d54;};'use strict';function Campaign(_0x218458){this['id']=_0x218458['id']||0x0;this['name']=_0x218458[_0xb7e3('0x0')]||'';this[_0xb7e3('0x1')]=_0x218458[_0xb7e3('0x1')]||_0xb7e3('0x2');this[_0xb7e3('0x3')]=0x0;this[_0xb7e3('0x4')]=0x0;this[_0xb7e3('0x5')]=0x0;this[_0xb7e3('0x6')]=0x0;this[_0xb7e3('0x7')]='';this[_0xb7e3('0x8')]=!![];this[_0xb7e3('0x9')]=_0x218458[_0xb7e3('0x9')];this[_0xb7e3('0xa')]=_0x218458['limitCalls'];this[_0xb7e3('0xb')]=_0x218458[_0xb7e3('0xb')]||null;this[_0xb7e3('0xc')]=_0x218458[_0xb7e3('0xc')]?_0x218458[_0xb7e3('0xc')]:null;this[_0xb7e3('0xd')]=_0x218458['dialOriginateCallerIdName'];this[_0xb7e3('0xe')]=_0x218458[_0xb7e3('0xe')];this[_0xb7e3('0xf')]=_0x218458[_0xb7e3('0xf')]||0x1e;this['dialCongestionMaxRetry']=_0x218458['dialCongestionMaxRetry'];this[_0xb7e3('0x10')]=_0x218458[_0xb7e3('0x10')];this[_0xb7e3('0x11')]=_0x218458[_0xb7e3('0x11')];this[_0xb7e3('0x12')]=_0x218458[_0xb7e3('0x12')];this['dialNoAnswerMaxRetry']=_0x218458[_0xb7e3('0x13')];this[_0xb7e3('0x14')]=_0x218458[_0xb7e3('0x14')];this[_0xb7e3('0x15')]=_0x218458[_0xb7e3('0x15')];this[_0xb7e3('0x16')]=_0x218458[_0xb7e3('0x16')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x218458[_0xb7e3('0x17')]||0x96;this[_0xb7e3('0x18')]=_0x218458['dialDropMaxRetry']||0x3;this[_0xb7e3('0x19')]=_0x218458[_0xb7e3('0x19')]||0x96;this[_0xb7e3('0x1a')]=_0x218458[_0xb7e3('0x1a')]||0x3;this[_0xb7e3('0x1b')]=_0x218458['dialAbandonedRetryFrequency']||0x96;this[_0xb7e3('0x1c')]=_0x218458['dialMachineMaxRetry']||0x3;this[_0xb7e3('0x1d')]=_0x218458[_0xb7e3('0x1d')]||0x96;this[_0xb7e3('0x1e')]=_0x218458[_0xb7e3('0x1e')]||0x3;this['dialAgentRejectRetryFrequency']=_0x218458[_0xb7e3('0x1f')]||0x96;this[_0xb7e3('0x20')]=_0x218458[_0xb7e3('0x20')]||_0xb7e3('0x21');this['dialPrefix']=_0x218458['dialPrefix']||undefined;this[_0xb7e3('0x22')]=_0x218458[_0xb7e3('0x22')]||undefined;this[_0xb7e3('0x23')]=_0x218458[_0xb7e3('0x23')]||undefined;this[_0xb7e3('0x24')]=_0x218458[_0xb7e3('0x24')]?_0x218458[_0xb7e3('0x24')]:undefined;this[_0xb7e3('0x25')]=_0x218458[_0xb7e3('0x25')]?_0x218458[_0xb7e3('0x25')]:undefined;this[_0xb7e3('0x26')]=_0x218458[_0xb7e3('0x26')]?_0x218458[_0xb7e3('0x26')]:undefined;this['SquareProject']=_0x218458[_0xb7e3('0x27')]?_0x218458[_0xb7e3('0x27')]:undefined;this[_0xb7e3('0x28')]=_0x218458[_0xb7e3('0x27')]?_0x218458[_0xb7e3('0x27')]['name']:undefined;this[_0xb7e3('0x29')]=_0x218458[_0xb7e3('0x29')]||![];this['dialAMDInitialSilence']=_0x218458[_0xb7e3('0x2a')];this[_0xb7e3('0x2b')]=_0x218458[_0xb7e3('0x2b')];this[_0xb7e3('0x2c')]=_0x218458[_0xb7e3('0x2c')];this[_0xb7e3('0x2d')]=_0x218458['dialAMDTotalAnalysisTime'];this[_0xb7e3('0x2e')]=_0x218458[_0xb7e3('0x2e')];this[_0xb7e3('0x2f')]=_0x218458[_0xb7e3('0x2f')];this[_0xb7e3('0x30')]=_0x218458[_0xb7e3('0x30')];this[_0xb7e3('0x31')]=_0x218458[_0xb7e3('0x31')];this[_0xb7e3('0x32')]=_0x218458[_0xb7e3('0x32')];}module[_0xb7e3('0x33')]=Campaign; \ No newline at end of file +var _0x09de=['dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x09de,0x18b));var _0xe09d=function(_0x40ddc0,_0x41c082){_0x40ddc0=_0x40ddc0-0x0;var _0x1aebf1=_0x09de[_0x40ddc0];return _0x1aebf1;};'use strict';function Campaign(_0x5dbdb3){this['id']=_0x5dbdb3['id']||0x0;this[_0xe09d('0x0')]=_0x5dbdb3[_0xe09d('0x0')]||'';this['type']=_0x5dbdb3[_0xe09d('0x1')]||_0xe09d('0x2');this[_0xe09d('0x3')]=0x0;this[_0xe09d('0x4')]=0x0;this[_0xe09d('0x5')]=0x0;this[_0xe09d('0x6')]=0x0;this[_0xe09d('0x7')]='';this[_0xe09d('0x8')]=!![];this[_0xe09d('0x9')]=_0x5dbdb3[_0xe09d('0x9')];this[_0xe09d('0xa')]=_0x5dbdb3[_0xe09d('0xa')];this[_0xe09d('0xb')]=_0x5dbdb3['dialTimezone']||null;this[_0xe09d('0xc')]=_0x5dbdb3['dialGlobalInterval']?_0x5dbdb3[_0xe09d('0xc')]:null;this[_0xe09d('0xd')]=_0x5dbdb3[_0xe09d('0xd')];this[_0xe09d('0xe')]=_0x5dbdb3[_0xe09d('0xe')];this[_0xe09d('0xf')]=_0x5dbdb3[_0xe09d('0xf')]||0x1e;this[_0xe09d('0x10')]=_0x5dbdb3[_0xe09d('0x10')];this[_0xe09d('0x11')]=_0x5dbdb3[_0xe09d('0x11')];this[_0xe09d('0x12')]=_0x5dbdb3['dialBusyMaxRetry'];this[_0xe09d('0x13')]=_0x5dbdb3[_0xe09d('0x13')];this[_0xe09d('0x14')]=_0x5dbdb3[_0xe09d('0x14')];this[_0xe09d('0x15')]=_0x5dbdb3[_0xe09d('0x15')];this[_0xe09d('0x16')]=_0x5dbdb3[_0xe09d('0x16')];this[_0xe09d('0x17')]=_0x5dbdb3['dialNoSuchNumberMaxRetry']||0x3;this[_0xe09d('0x18')]=_0x5dbdb3['dialNoSuchNumberRetryFrequency']||0x96;this[_0xe09d('0x19')]=_0x5dbdb3[_0xe09d('0x19')]||0x3;this[_0xe09d('0x1a')]=_0x5dbdb3[_0xe09d('0x1a')]||0x96;this[_0xe09d('0x1b')]=_0x5dbdb3[_0xe09d('0x1b')]||0x3;this[_0xe09d('0x1c')]=_0x5dbdb3['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x5dbdb3['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x5dbdb3[_0xe09d('0x1d')]||0x96;this[_0xe09d('0x1e')]=_0x5dbdb3['dialAgentRejectMaxRetry']||0x3;this[_0xe09d('0x1f')]=_0x5dbdb3[_0xe09d('0x1f')]||0x96;this[_0xe09d('0x20')]=_0x5dbdb3[_0xe09d('0x20')]||'DESC';this[_0xe09d('0x21')]=_0x5dbdb3['dialPrefix']||undefined;this[_0xe09d('0x22')]=_0x5dbdb3[_0xe09d('0x22')]||undefined;this[_0xe09d('0x23')]=_0x5dbdb3[_0xe09d('0x23')]||undefined;this[_0xe09d('0x24')]=_0x5dbdb3['TrunkBackup']?_0x5dbdb3['TrunkBackup']:undefined;this[_0xe09d('0x25')]=_0x5dbdb3[_0xe09d('0x25')]?_0x5dbdb3['Trunk']:undefined;this[_0xe09d('0x26')]=_0x5dbdb3[_0xe09d('0x26')]?_0x5dbdb3[_0xe09d('0x26')]:undefined;this[_0xe09d('0x27')]=_0x5dbdb3['SquareProject']?_0x5dbdb3[_0xe09d('0x27')]:undefined;this[_0xe09d('0x28')]=_0x5dbdb3['SquareProject']?_0x5dbdb3[_0xe09d('0x27')][_0xe09d('0x0')]:undefined;this['dialAMDActive']=_0x5dbdb3[_0xe09d('0x29')]||![];this['dialAMDInitialSilence']=_0x5dbdb3[_0xe09d('0x2a')];this[_0xe09d('0x2b')]=_0x5dbdb3['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x5dbdb3[_0xe09d('0x2c')];this[_0xe09d('0x2d')]=_0x5dbdb3[_0xe09d('0x2d')];this['dialAMDMinWordLength']=_0x5dbdb3[_0xe09d('0x2e')];this[_0xe09d('0x2f')]=_0x5dbdb3['dialAMDBetweenWordsSilence'];this[_0xe09d('0x30')]=_0x5dbdb3[_0xe09d('0x30')];this[_0xe09d('0x31')]=_0x5dbdb3[_0xe09d('0x31')];this[_0xe09d('0x32')]=_0x5dbdb3['dialAMDMaximumWordLength'];}module[_0xe09d('0x33')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index d337f0e..cae1509 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 _0x1893=['monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','duration','holdtime','tag','disposition','monitor'];(function(_0x1aa55d,_0x4820b9){var _0xba55e7=function(_0x1322b5){while(--_0x1322b5){_0x1aa55d['push'](_0x1aa55d['shift']());}};_0xba55e7(++_0x4820b9);}(_0x1893,0xa2));var _0x3189=function(_0x1496c1,_0x23cf40){_0x1496c1=_0x1496c1-0x0;var _0x48abc0=_0x1893[_0x1496c1];return _0x48abc0;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0x3189('0x0')]='';this[_0x3189('0x1')]=0x0;this[_0x3189('0x2')]='';this[_0x3189('0x3')]=undefined;this[_0x3189('0x4')]=undefined;this[_0x3189('0x5')]=0x0;this[_0x3189('0x6')]='';this['uniqueid']=0x0;this[_0x3189('0x7')]=0x0;this[_0x3189('0x8')]=0x0;this[_0x3189('0x9')]=![];this[_0x3189('0xa')]=null;this[_0x3189('0xb')]=null;this[_0x3189('0xc')]=![];this[_0x3189('0xd')]=![];this[_0x3189('0xe')]='';this['lastdata']='';this[_0x3189('0xf')]=0x0;this['billableseconds']=0x0;this[_0x3189('0x10')]=0x0;this['type']=null;this[_0x3189('0x11')]=null;this[_0x3189('0x12')]=null;this[_0x3189('0x13')]=![];this[_0x3189('0x14')]=null;this['queue']=null;this[_0x3189('0x15')]=[];this[_0x3189('0x16')]=undefined;this[_0x3189('0x17')]=undefined;this[_0x3189('0x18')]=undefined;this[_0x3189('0x19')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x5352=['disposition','monitors','transfercalleridnum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','uniqueid','linkedid','answered','endtime','lastapplication','duration','billableseconds','type','tag'];(function(_0x1c156e,_0x3263a6){var _0x58fc22=function(_0x42f1eb){while(--_0x42f1eb){_0x1c156e['push'](_0x1c156e['shift']());}};_0x58fc22(++_0x3263a6);}(_0x5352,0x1ea));var _0x2535=function(_0x1c37f4,_0x3a9610){_0x1c37f4=_0x1c37f4-0x0;var _0xc0552e=_0x5352[_0x1c37f4];return _0xc0552e;};'use strict';function Channel(){this[_0x2535('0x0')]=null;this[_0x2535('0x1')]='';this[_0x2535('0x2')]='';this[_0x2535('0x3')]=0x0;this[_0x2535('0x4')]='';this[_0x2535('0x5')]=undefined;this['connectedlinename']=undefined;this[_0x2535('0x6')]=0x0;this['context']='';this[_0x2535('0x7')]=0x0;this[_0x2535('0x8')]=0x0;this['exten']=0x0;this[_0x2535('0x9')]=![];this['answertime']=null;this[_0x2535('0xa')]=null;this['unmanaged']=![];this['abandoned']=![];this[_0x2535('0xb')]='';this['lastdata']='';this[_0x2535('0xc')]=0x0;this[_0x2535('0xd')]=0x0;this['holdtime']=0x0;this[_0x2535('0xe')]=null;this[_0x2535('0xf')]=null;this[_0x2535('0x10')]=null;this['monitor']=![];this['monitorFilename']=null;this['queue']=null;this[_0x2535('0x11')]=[];this[_0x2535('0x12')]=undefined;this['transferconnectedlinenum']=undefined;this[_0x2535('0x13')]=undefined;this[_0x2535('0x14')]=0x0;}module[_0x2535('0x15')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 9a2a287..ed3ac5e 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 _0xeb5c=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xeb5c,0x136));var _0xceb5=function(_0x4bc589,_0x5c038b){_0x4bc589=_0x4bc589-0x0;var _0x36b948=_0xeb5c[_0x4bc589];return _0x36b948;};'use strict';function DeskAccount(_0x4aff12){this['id']=_0x4aff12['id']||0x0;this[_0xceb5('0x0')]=_0x4aff12[_0xceb5('0x0')]||'';this['username']=_0x4aff12[_0xceb5('0x1')]||'';this['remoteUri']=_0x4aff12[_0xceb5('0x2')]||'';this[_0xceb5('0x3')]=_0x4aff12[_0xceb5('0x3')]||'';this[_0xceb5('0x4')]=_0x4aff12[_0xceb5('0x4')]||'';this[_0xceb5('0x5')]=_0x4aff12['consumerKey']||'';this[_0xceb5('0x6')]=_0x4aff12['consumerSecret']||'';this[_0xceb5('0x7')]=_0x4aff12[_0xceb5('0x7')]||'';this['tokenSecret']=_0x4aff12[_0xceb5('0x8')]||'';this[_0xceb5('0x9')]=_0x4aff12[_0xceb5('0x9')]||'';this[_0xceb5('0xa')]=_0x4aff12[_0xceb5('0xa')]||'';this[_0xceb5('0xb')]=_0x4aff12['Configurations']||{};}module[_0xceb5('0xc')]=DeskAccount; \ No newline at end of file +var _0x19cb=['exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x1b69a4,_0x3e9f5f){var _0x4ab6a6=function(_0x33697){while(--_0x33697){_0x1b69a4['push'](_0x1b69a4['shift']());}};_0x4ab6a6(++_0x3e9f5f);}(_0x19cb,0x105));var _0xb19c=function(_0x2802ae,_0x63f05f){_0x2802ae=_0x2802ae-0x0;var _0x205b50=_0x19cb[_0x2802ae];return _0x205b50;};'use strict';function DeskAccount(_0x240d96){this['id']=_0x240d96['id']||0x0;this[_0xb19c('0x0')]=_0x240d96[_0xb19c('0x0')]||'';this[_0xb19c('0x1')]=_0x240d96[_0xb19c('0x1')]||'';this[_0xb19c('0x2')]=_0x240d96[_0xb19c('0x2')]||'';this[_0xb19c('0x3')]=_0x240d96[_0xb19c('0x3')]||'';this[_0xb19c('0x4')]=_0x240d96['password']||'';this['consumerKey']=_0x240d96[_0xb19c('0x5')]||'';this[_0xb19c('0x6')]=_0x240d96[_0xb19c('0x6')]||'';this[_0xb19c('0x7')]=_0x240d96[_0xb19c('0x7')]||'';this[_0xb19c('0x8')]=_0x240d96[_0xb19c('0x8')]||'';this[_0xb19c('0x9')]=_0x240d96[_0xb19c('0x9')]||'';this[_0xb19c('0xa')]=_0x240d96['serverUrl']||'';this[_0xb19c('0xb')]=_0x240d96[_0xb19c('0xb')]||{};}module[_0xb19c('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 308a59c..a6b0bc5 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 _0xfd49=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports'];(function(_0x14d871,_0x338701){var _0x129af5=function(_0xa0fb1e){while(--_0xa0fb1e){_0x14d871['push'](_0x14d871['shift']());}};_0x129af5(++_0x338701);}(_0xfd49,0x108));var _0x9fd4=function(_0x324eab,_0x2ed898){_0x324eab=_0x324eab-0x0;var _0x1af397=_0xfd49[_0x324eab];return _0x1af397;};'use strict';function Dynamics365Account(_0x5c63c7){this['id']=_0x5c63c7['id']||0x0;this[_0x9fd4('0x0')]=_0x5c63c7[_0x9fd4('0x0')]||'';this[_0x9fd4('0x1')]=_0x5c63c7[_0x9fd4('0x1')]||'';this[_0x9fd4('0x2')]=_0x5c63c7[_0x9fd4('0x2')]||'';this['remoteUri']=_0x5c63c7[_0x9fd4('0x3')]||'';this[_0x9fd4('0x4')]=_0x5c63c7['tenantId']||'';this[_0x9fd4('0x5')]=_0x5c63c7[_0x9fd4('0x5')]||'';this[_0x9fd4('0x6')]=_0x5c63c7[_0x9fd4('0x6')]||{};this[_0x9fd4('0x7')]=_0x5c63c7[_0x9fd4('0x7')]||'';this[_0x9fd4('0x8')]=_0x5c63c7[_0x9fd4('0x8')]||![];this[_0x9fd4('0x9')]=_0x5c63c7[_0x9fd4('0x9')]||{};this[_0x9fd4('0xa')]=_0x5c63c7[_0x9fd4('0xa')]||{};}module[_0x9fd4('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x8c69=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c69,0x1ed));var _0x98c6=function(_0x315ff4,_0x5ddec1){_0x315ff4=_0x315ff4-0x0;var _0x4ec6f0=_0x8c69[_0x315ff4];return _0x4ec6f0;};'use strict';function Dynamics365Account(_0x3826f1){this['id']=_0x3826f1['id']||0x0;this[_0x98c6('0x0')]=_0x3826f1[_0x98c6('0x0')]||'';this[_0x98c6('0x1')]=_0x3826f1[_0x98c6('0x1')]||'';this['password']=_0x3826f1[_0x98c6('0x2')]||'';this[_0x98c6('0x3')]=_0x3826f1[_0x98c6('0x3')]||'';this['tenantId']=_0x3826f1[_0x98c6('0x4')]||'';this[_0x98c6('0x5')]=_0x3826f1[_0x98c6('0x5')]||'';this[_0x98c6('0x6')]=_0x3826f1['clientSecret']||{};this[_0x98c6('0x7')]=_0x3826f1['serverUrl']||'';this[_0x98c6('0x8')]=_0x3826f1[_0x98c6('0x8')]||![];this[_0x98c6('0x9')]=_0x3826f1['Configurations']||{};this[_0x98c6('0xa')]=_0x3826f1[_0x98c6('0xa')]||{};}module[_0x98c6('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 6e515f2..6de0575 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 _0x0c82=['v17,v27,v29','gateway','faxdetect','tech','SIP','Trunk','ListId','exports','name','description','ecm','localstationid','minrate','maxrate','modem'];(function(_0x234de3,_0x2271c2){var _0x95defd=function(_0x207e8a){while(--_0x207e8a){_0x234de3['push'](_0x234de3['shift']());}};_0x95defd(++_0x2271c2);}(_0x0c82,0x1ac));var _0x20c8=function(_0x5062da,_0x4400d2){_0x5062da=_0x5062da-0x0;var _0x46d327=_0x0c82[_0x5062da];return _0x46d327;};'use strict';function FaxAccount(_0x1e8ea0){this['id']=_0x1e8ea0['id']||0x0;this[_0x20c8('0x0')]=_0x1e8ea0[_0x20c8('0x0')]||'';this[_0x20c8('0x1')]=_0x1e8ea0[_0x20c8('0x1')];this['ecm']=_0x1e8ea0[_0x20c8('0x2')];this['headerinfo']=_0x1e8ea0['headerinfo'];this['localstationid']=_0x1e8ea0[_0x20c8('0x3')];this[_0x20c8('0x4')]=_0x1e8ea0[_0x20c8('0x4')]||0x960;this['maxrate']=_0x1e8ea0[_0x20c8('0x5')]||0x3840;this[_0x20c8('0x6')]=_0x1e8ea0[_0x20c8('0x6')]||_0x20c8('0x7');this['gateway']=_0x1e8ea0[_0x20c8('0x8')]||'no';this[_0x20c8('0x9')]=_0x1e8ea0[_0x20c8('0x9')]||'no';this['t38timeout']=_0x1e8ea0['t38timeout']||0x1388;this[_0x20c8('0xa')]=_0x1e8ea0[_0x20c8('0xa')]||_0x20c8('0xb');this[_0x20c8('0xc')]=_0x1e8ea0['Trunk']?_0x1e8ea0[_0x20c8('0xc')]:undefined;this[_0x20c8('0xd')]=_0x1e8ea0[_0x20c8('0xd')];this['key']=_0x1e8ea0['key'];}module[_0x20c8('0xe')]=FaxAccount; \ No newline at end of file +var _0x7513=['tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x5247b5,_0x4086f4){var _0x2f177f=function(_0x4e9e63){while(--_0x4e9e63){_0x5247b5['push'](_0x5247b5['shift']());}};_0x2f177f(++_0x4086f4);}(_0x7513,0x1e1));var _0x3751=function(_0x10b465,_0x2cccb8){_0x10b465=_0x10b465-0x0;var _0x550ddc=_0x7513[_0x10b465];return _0x550ddc;};'use strict';function FaxAccount(_0x44e5e5){this['id']=_0x44e5e5['id']||0x0;this[_0x3751('0x0')]=_0x44e5e5['name']||'';this[_0x3751('0x1')]=_0x44e5e5[_0x3751('0x1')];this[_0x3751('0x2')]=_0x44e5e5['ecm'];this[_0x3751('0x3')]=_0x44e5e5['headerinfo'];this[_0x3751('0x4')]=_0x44e5e5[_0x3751('0x4')];this[_0x3751('0x5')]=_0x44e5e5[_0x3751('0x5')]||0x960;this[_0x3751('0x6')]=_0x44e5e5[_0x3751('0x6')]||0x3840;this[_0x3751('0x7')]=_0x44e5e5[_0x3751('0x7')]||_0x3751('0x8');this[_0x3751('0x9')]=_0x44e5e5[_0x3751('0x9')]||'no';this[_0x3751('0xa')]=_0x44e5e5['faxdetect']||'no';this['t38timeout']=_0x44e5e5[_0x3751('0xb')]||0x1388;this['tech']=_0x44e5e5[_0x3751('0xc')]||_0x3751('0xd');this[_0x3751('0xe')]=_0x44e5e5[_0x3751('0xe')]?_0x44e5e5[_0x3751('0xe')]:undefined;this[_0x3751('0xf')]=_0x44e5e5[_0x3751('0xf')];this[_0x3751('0x10')]=_0x44e5e5[_0x3751('0x10')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 140a8a4..909c9f7 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 _0xa93f=['username','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x1ffa52,_0x4365cd){var _0x3ccaf9=function(_0x3c110f){while(--_0x3c110f){_0x1ffa52['push'](_0x1ffa52['shift']());}};_0x3ccaf9(++_0x4365cd);}(_0xa93f,0xb5));var _0xfa93=function(_0x2c9573,_0xd245ae){_0x2c9573=_0x2c9573-0x0;var _0x383377=_0xa93f[_0x2c9573];return _0x383377;};'use strict';function FreshdeskAccount(_0x5d80b6){this['id']=_0x5d80b6['id']||0x0;this[_0xfa93('0x0')]=_0x5d80b6[_0xfa93('0x0')]||'';this[_0xfa93('0x1')]=_0x5d80b6[_0xfa93('0x1')]||'';this['apiKey']=_0x5d80b6[_0xfa93('0x2')]||'';this['remoteUri']=_0x5d80b6[_0xfa93('0x3')]||'';this[_0xfa93('0x4')]=_0x5d80b6[_0xfa93('0x4')]||'';this[_0xfa93('0x5')]=_0x5d80b6[_0xfa93('0x5')]||{};}module[_0xfa93('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xd970=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x25df80,_0xa2aec5){var _0x17b6d0=function(_0x446155){while(--_0x446155){_0x25df80['push'](_0x25df80['shift']());}};_0x17b6d0(++_0xa2aec5);}(_0xd970,0xaa));var _0x0d97=function(_0x4c7597,_0x1adb2e){_0x4c7597=_0x4c7597-0x0;var _0x1241fa=_0xd970[_0x4c7597];return _0x1241fa;};'use strict';function FreshdeskAccount(_0x3b17fa){this['id']=_0x3b17fa['id']||0x0;this['name']=_0x3b17fa[_0x0d97('0x0')]||'';this[_0x0d97('0x1')]=_0x3b17fa[_0x0d97('0x1')]||'';this[_0x0d97('0x2')]=_0x3b17fa[_0x0d97('0x3')]||'';this[_0x0d97('0x4')]=_0x3b17fa[_0x0d97('0x4')]||'';this['serverUrl']=_0x3b17fa[_0x0d97('0x5')]||'';this[_0x0d97('0x6')]=_0x3b17fa['Configurations']||{};}module[_0x0d97('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index a217ec5..e47b499 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 _0x5334=['name','username','token','remoteUri','serverUrl','exports'];(function(_0x599f11,_0x2f21d3){var _0x48c0f5=function(_0x310240){while(--_0x310240){_0x599f11['push'](_0x599f11['shift']());}};_0x48c0f5(++_0x2f21d3);}(_0x5334,0x84));var _0x4533=function(_0x1c4ed8,_0x360931){_0x1c4ed8=_0x1c4ed8-0x0;var _0x33665a=_0x5334[_0x1c4ed8];return _0x33665a;};'use strict';function FreshsalesAccount(_0x108d0d){this['id']=_0x108d0d['id']||0x0;this[_0x4533('0x0')]=_0x108d0d[_0x4533('0x0')]||'';this[_0x4533('0x1')]=_0x108d0d[_0x4533('0x1')]||'';this['apiKey']=_0x108d0d[_0x4533('0x2')]||'';this['remoteUri']=_0x108d0d[_0x4533('0x3')]||'';this[_0x4533('0x4')]=_0x108d0d['serverUrl']||'';this['Configurations']=_0x108d0d['Configurations']||{};}module[_0x4533('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0x8585=['name','username','apiKey','serverUrl','exports'];(function(_0x39cffc,_0x5390f4){var _0x26603d=function(_0x421471){while(--_0x421471){_0x39cffc['push'](_0x39cffc['shift']());}};_0x26603d(++_0x5390f4);}(_0x8585,0x64));var _0x5858=function(_0x3edaa8,_0x2393e7){_0x3edaa8=_0x3edaa8-0x0;var _0x5132d2=_0x8585[_0x3edaa8];return _0x5132d2;};'use strict';function FreshsalesAccount(_0x2c6ce6){this['id']=_0x2c6ce6['id']||0x0;this[_0x5858('0x0')]=_0x2c6ce6[_0x5858('0x0')]||'';this['username']=_0x2c6ce6[_0x5858('0x1')]||'';this[_0x5858('0x2')]=_0x2c6ce6['token']||'';this['remoteUri']=_0x2c6ce6['remoteUri']||'';this[_0x5858('0x3')]=_0x2c6ce6[_0x5858('0x3')]||'';this['Configurations']=_0x2c6ce6['Configurations']||{};}module[_0x5858('0x4')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 89da667..bf8bfe6 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 _0x2b3a=['exten','priority','assigned','lastAssignedTo','motionChannel','voice','mohtime','variables','exports','type','inbound','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename'];(function(_0x28dd8b,_0x37e536){var _0x1f282e=function(_0x4df2c6){while(--_0x4df2c6){_0x28dd8b['push'](_0x28dd8b['shift']());}};_0x1f282e(++_0x37e536);}(_0x2b3a,0xf3));var _0xa2b3=function(_0x30690b,_0x4147c9){_0x30690b=_0x30690b-0x0;var _0xf921b0=_0x2b3a[_0x30690b];return _0xf921b0;};'use strict';function QueueReport(){this[_0xa2b3('0x0')]=_0xa2b3('0x1');this['uniqueid']='';this[_0xa2b3('0x2')]='';this[_0xa2b3('0x3')]='';this[_0xa2b3('0x4')]='';this[_0xa2b3('0x5')]=null;this[_0xa2b3('0x6')]=null;this['position']=0x1;this[_0xa2b3('0x7')]=0x1;this[_0xa2b3('0x8')]=![];this[_0xa2b3('0x9')]=null;this[_0xa2b3('0xa')]=![];this[_0xa2b3('0xb')]=null;this[_0xa2b3('0xc')]=![];this[_0xa2b3('0xd')]=null;this['originalposition']=0x1;this[_0xa2b3('0xe')]='';this[_0xa2b3('0xf')]='';this[_0xa2b3('0x10')]='';this['accountcode']='';this['context']='';this[_0xa2b3('0x11')]='';this[_0xa2b3('0x12')]='';this['holdtime']=0x0;this[_0xa2b3('0x13')]=![];this[_0xa2b3('0x14')]='';this[_0xa2b3('0x15')]=_0xa2b3('0x16');this[_0xa2b3('0x17')]=0x0;this[_0xa2b3('0x18')]={};}module[_0xa2b3('0x19')]=QueueReport; \ No newline at end of file +var _0xb5d4=['queuecallerexitAt','originalposition','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','motionChannel','voice','variables','exports','type','inbound','uniqueid','calleridnum','queue','position','queuecallercomplete','queuecallercompleteAt'];(function(_0x5a71d6,_0x336422){var _0x18bff6=function(_0x23dd5b){while(--_0x23dd5b){_0x5a71d6['push'](_0x5a71d6['shift']());}};_0x18bff6(++_0x336422);}(_0xb5d4,0x76));var _0x4b5d=function(_0x3f9a07,_0x241689){_0x3f9a07=_0x3f9a07-0x0;var _0xe535d9=_0xb5d4[_0x3f9a07];return _0xe535d9;};'use strict';function QueueReport(){this[_0x4b5d('0x0')]=_0x4b5d('0x1');this[_0x4b5d('0x2')]='';this[_0x4b5d('0x3')]='';this['calleridname']='';this[_0x4b5d('0x4')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0x4b5d('0x5')]=0x1;this['count']=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0x4b5d('0x6')]=![];this[_0x4b5d('0x7')]=null;this['queuecallerexit']=![];this[_0x4b5d('0x8')]=null;this[_0x4b5d('0x9')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0x4b5d('0xa')]='';this[_0x4b5d('0xb')]='';this[_0x4b5d('0xc')]='';this[_0x4b5d('0xd')]='';this[_0x4b5d('0xe')]='';this[_0x4b5d('0xf')]=0x0;this[_0x4b5d('0x10')]=![];this['lastAssignedTo']='';this[_0x4b5d('0x11')]=_0x4b5d('0x12');this['mohtime']=0x0;this[_0x4b5d('0x13')]={};}module[_0x4b5d('0x14')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index c2a65dd..b1ea814 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 _0x6b5e=['integrationTab','serverUrl','Configurations','exports','name','username','password','clientId','securityToken','type'];(function(_0x3c76d3,_0x3152da){var _0x4e653e=function(_0x4eef02){while(--_0x4eef02){_0x3c76d3['push'](_0x3c76d3['shift']());}};_0x4e653e(++_0x3152da);}(_0x6b5e,0x90));var _0xe6b5=function(_0x490dde,_0x40e44e){_0x490dde=_0x490dde-0x0;var _0x375f63=_0x6b5e[_0x490dde];return _0x375f63;};'use strict';function SalesforceAccount(_0x5a4047){this['id']=_0x5a4047['id']||0x0;this[_0xe6b5('0x0')]=_0x5a4047['name']||'';this[_0xe6b5('0x1')]=_0x5a4047[_0xe6b5('0x1')]||'';this['remoteUri']=_0x5a4047['remoteUri']||'';this[_0xe6b5('0x2')]=_0x5a4047[_0xe6b5('0x2')]||'';this[_0xe6b5('0x3')]=_0x5a4047[_0xe6b5('0x3')]||'';this['clientSecret']=_0x5a4047['clientSecret']||'';this[_0xe6b5('0x4')]=_0x5a4047[_0xe6b5('0x4')]||'';this['type']=_0x5a4047[_0xe6b5('0x5')]||_0xe6b5('0x6');this[_0xe6b5('0x7')]=_0x5a4047[_0xe6b5('0x7')]||'';this[_0xe6b5('0x8')]=_0x5a4047[_0xe6b5('0x8')]||{};}module[_0xe6b5('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x5360=['serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','securityToken','type'];(function(_0x11869a,_0x1ccf31){var _0x403e45=function(_0x447c08){while(--_0x447c08){_0x11869a['push'](_0x11869a['shift']());}};_0x403e45(++_0x1ccf31);}(_0x5360,0x157));var _0x0536=function(_0x455f4d,_0x171349){_0x455f4d=_0x455f4d-0x0;var _0x5cc906=_0x5360[_0x455f4d];return _0x5cc906;};'use strict';function SalesforceAccount(_0x1920b0){this['id']=_0x1920b0['id']||0x0;this[_0x0536('0x0')]=_0x1920b0[_0x0536('0x0')]||'';this[_0x0536('0x1')]=_0x1920b0['username']||'';this['remoteUri']=_0x1920b0[_0x0536('0x2')]||'';this['password']=_0x1920b0[_0x0536('0x3')]||'';this[_0x0536('0x4')]=_0x1920b0['clientId']||'';this['clientSecret']=_0x1920b0['clientSecret']||'';this[_0x0536('0x5')]=_0x1920b0[_0x0536('0x5')]||'';this[_0x0536('0x6')]=_0x1920b0[_0x0536('0x6')]||'integrationTab';this[_0x0536('0x7')]=_0x1920b0[_0x0536('0x7')]||'';this[_0x0536('0x8')]=_0x1920b0['Configurations']||{};}module[_0x0536('0x9')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 8da5bc9..79b89f4 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 _0x485b=['name','username','password','remoteUri','Configurations','exports'];(function(_0x41c760,_0x2b35ef){var _0x542b73=function(_0xcbccc8){while(--_0xcbccc8){_0x41c760['push'](_0x41c760['shift']());}};_0x542b73(++_0x2b35ef);}(_0x485b,0x78));var _0xb485=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0x485b[_0x43b584];return _0x48f27b;};'use strict';function ServicenowAccount(_0x2f56c2){this['id']=_0x2f56c2['id']||0x0;this['name']=_0x2f56c2[_0xb485('0x0')]||'';this[_0xb485('0x1')]=_0x2f56c2[_0xb485('0x1')]||'';this[_0xb485('0x2')]=_0x2f56c2[_0xb485('0x2')]||'';this[_0xb485('0x3')]=_0x2f56c2['remoteUri']||'';this['serverUrl']=_0x2f56c2['serverUrl']||'';this[_0xb485('0x4')]=_0x2f56c2[_0xb485('0x4')]||{};}module[_0xb485('0x5')]=ServicenowAccount; \ No newline at end of file +var _0x2106=['password','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3ebcab,_0x482df2){var _0x4074d3=function(_0x43ec1a){while(--_0x43ec1a){_0x3ebcab['push'](_0x3ebcab['shift']());}};_0x4074d3(++_0x482df2);}(_0x2106,0x1c5));var _0x6210=function(_0x884df3,_0x6e60d4){_0x884df3=_0x884df3-0x0;var _0x3d6f22=_0x2106[_0x884df3];return _0x3d6f22;};'use strict';function ServicenowAccount(_0x804361){this['id']=_0x804361['id']||0x0;this[_0x6210('0x0')]=_0x804361[_0x6210('0x0')]||'';this['username']=_0x804361[_0x6210('0x1')]||'';this[_0x6210('0x2')]=_0x804361[_0x6210('0x2')]||'';this['remoteUri']=_0x804361[_0x6210('0x3')]||'';this[_0x6210('0x4')]=_0x804361['serverUrl']||'';this[_0x6210('0x5')]=_0x804361['Configurations']||{};}module[_0x6210('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 344e92b..4eaf50a 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 _0x7e2d=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x5e9aa4,_0x25d2df){var _0x150302=function(_0x557c83){while(--_0x557c83){_0x5e9aa4['push'](_0x5e9aa4['shift']());}};_0x150302(++_0x25d2df);}(_0x7e2d,0x109));var _0xd7e2=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x7e2d[_0x1e7b16];return _0x37fadc;};'use strict';function SugarcrmAccount(_0x6877cf){this['id']=_0x6877cf['id']||0x0;this[_0xd7e2('0x0')]=_0x6877cf[_0xd7e2('0x0')]||'';this[_0xd7e2('0x1')]=_0x6877cf['username']||'';this[_0xd7e2('0x2')]=_0x6877cf[_0xd7e2('0x2')]||'';this[_0xd7e2('0x3')]=_0x6877cf[_0xd7e2('0x3')]||'';this[_0xd7e2('0x4')]=_0x6877cf[_0xd7e2('0x4')]||'';this[_0xd7e2('0x5')]=_0x6877cf[_0xd7e2('0x5')]||{};}module[_0xd7e2('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x8c9f=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x8c9f,0x142));var _0xf8c9=function(_0xdec8e6,_0x38f377){_0xdec8e6=_0xdec8e6-0x0;var _0x2a749c=_0x8c9f[_0xdec8e6];return _0x2a749c;};'use strict';function SugarcrmAccount(_0x45f81b){this['id']=_0x45f81b['id']||0x0;this[_0xf8c9('0x0')]=_0x45f81b['name']||'';this['username']=_0x45f81b[_0xf8c9('0x1')]||'';this[_0xf8c9('0x2')]=_0x45f81b[_0xf8c9('0x2')]||'';this[_0xf8c9('0x3')]=_0x45f81b[_0xf8c9('0x3')]||'';this[_0xf8c9('0x4')]=_0x45f81b[_0xf8c9('0x4')]||'';this[_0xf8c9('0x5')]=_0x45f81b[_0xf8c9('0x5')]||{};}module[_0xf8c9('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index bffbd5f..4c35a25 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 _0xd9b6=['exports','name','state','unknown','stateTime','status','address'];(function(_0x431bcd,_0x5b2ff8){var _0x4f30dc=function(_0x546b4d){while(--_0x546b4d){_0x431bcd['push'](_0x431bcd['shift']());}};_0x4f30dc(++_0x5b2ff8);}(_0xd9b6,0x17b));var _0x6d9b=function(_0x54d2fb,_0x31fd9e){_0x54d2fb=_0x54d2fb-0x0;var _0x10cb87=_0xd9b6[_0x54d2fb];return _0x10cb87;};'use strict';function Telephone(_0x35f669){this['id']=_0x35f669['id']||0x0;this[_0x6d9b('0x0')]=_0x35f669[_0x6d9b('0x0')]||'';this['accountcode']=_0x35f669['accountcode']||'';this[_0x6d9b('0x1')]=_0x6d9b('0x2');this[_0x6d9b('0x3')]=0x0;this[_0x6d9b('0x4')]=_0x6d9b('0x2');this[_0x6d9b('0x5')]='';}module[_0x6d9b('0x6')]=Telephone; \ No newline at end of file +var _0x2d6e=['state','stateTime','unknown','address','exports','name','accountcode'];(function(_0x19ef01,_0x3b2a55){var _0x28e20a=function(_0x35915d){while(--_0x35915d){_0x19ef01['push'](_0x19ef01['shift']());}};_0x28e20a(++_0x3b2a55);}(_0x2d6e,0x163));var _0xe2d6=function(_0x3c0964,_0x18b7e1){_0x3c0964=_0x3c0964-0x0;var _0x1b11f=_0x2d6e[_0x3c0964];return _0x1b11f;};'use strict';function Telephone(_0x99520e){this['id']=_0x99520e['id']||0x0;this['name']=_0x99520e[_0xe2d6('0x0')]||'';this[_0xe2d6('0x1')]=_0x99520e[_0xe2d6('0x1')]||'';this[_0xe2d6('0x2')]='unknown';this[_0xe2d6('0x3')]=0x0;this['status']=_0xe2d6('0x4');this[_0xe2d6('0x5')]='';}module[_0xe2d6('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 30bc1d0..ac89c07 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(_0x48926e,_0x38585a){var _0x29098c=function(_0xbd5f35){while(--_0xbd5f35){_0x48926e['push'](_0x48926e['shift']());}};_0x29098c(++_0x38585a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x8afa04,_0xe15816){var _0x17bfc9=function(_0x47b2fc){while(--_0x47b2fc){_0x8afa04['push'](_0x8afa04['shift']());}};_0x17bfc9(++_0xe15816);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 ca68de4..0300e5e 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(_0x2bbbfe,_0x3f8d0d){var _0x1fe553=function(_0x37f34e){while(--_0x37f34e){_0x2bbbfe['push'](_0x2bbbfe['shift']());}};_0x1fe553(++_0x3f8d0d);}(_0x8603,0x190));var _0x3860=function(_0x15b184,_0x2755fc){_0x15b184=_0x15b184-0x0;var _0x2b9049=_0x8603[_0x15b184];return _0x2b9049;};'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 _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x533b69,_0x147cd3){var _0x57e146=function(_0x25dbdc){while(--_0x25dbdc){_0x533b69['push'](_0x533b69['shift']());}};_0x57e146(++_0x147cd3);}(_0x757a,0xde));var _0xa757=function(_0x3269ad,_0x2b020d){_0x3269ad=_0x3269ad-0x0;var _0x413aa8=_0x757a[_0x3269ad];return _0x413aa8;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 7c6d2d4..0e2ed28 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 _0xacd0=['stateTime','status','registry','host','port','domain','domainport','refresh','stateRegistry','registrationtime','defaultuser','exports','active','name','unknown'];(function(_0x4defd6,_0x37bbd3){var _0x4c9276=function(_0x1d7a3d){while(--_0x1d7a3d){_0x4defd6['push'](_0x4defd6['shift']());}};_0x4c9276(++_0x37bbd3);}(_0xacd0,0x192));var _0x0acd=function(_0x2842b4,_0x2b1b7b){_0x2842b4=_0x2842b4-0x0;var _0x2b9521=_0xacd0[_0x2842b4];return _0x2b9521;};'use strict';function Trunk(_0x990f34){this['id']=_0x990f34['id']||0x0;this[_0x0acd('0x0')]=_0x990f34[_0x0acd('0x0')]||![];this[_0x0acd('0x1')]=_0x990f34['name']||'';this['state']=_0x0acd('0x2');this[_0x0acd('0x3')]=0x0;this[_0x0acd('0x4')]=_0x0acd('0x2');this['registry']=_0x990f34[_0x0acd('0x5')]&&_0x990f34[_0x0acd('0x5')]['indexOf'](':')?_0x990f34[_0x0acd('0x5')]['split'](':')[0x0]:'';this[_0x0acd('0x6')]='';this[_0x0acd('0x7')]='';this[_0x0acd('0x8')]='';this[_0x0acd('0x9')]='';this[_0x0acd('0xa')]='';this[_0x0acd('0xb')]=_0x0acd('0x2');this[_0x0acd('0xc')]='';this['address']='';this[_0x0acd('0xd')]=_0x990f34['defaultuser']||'';}module[_0x0acd('0xe')]=Trunk; \ No newline at end of file +var _0x97b8=['name','state','unknown','stateTime','registry','indexOf','host','port','domainport','refresh','registrationtime','address','defaultuser'];(function(_0x393787,_0x597076){var _0x473805=function(_0x2a2c80){while(--_0x2a2c80){_0x393787['push'](_0x393787['shift']());}};_0x473805(++_0x597076);}(_0x97b8,0x1ad));var _0x897b=function(_0x5290c4,_0x59c2a6){_0x5290c4=_0x5290c4-0x0;var _0x1a0af1=_0x97b8[_0x5290c4];return _0x1a0af1;};'use strict';function Trunk(_0x403e54){this['id']=_0x403e54['id']||0x0;this['active']=_0x403e54['active']||![];this[_0x897b('0x0')]=_0x403e54['name']||'';this[_0x897b('0x1')]=_0x897b('0x2');this[_0x897b('0x3')]=0x0;this['status']=_0x897b('0x2');this[_0x897b('0x4')]=_0x403e54[_0x897b('0x4')]&&_0x403e54[_0x897b('0x4')][_0x897b('0x5')](':')?_0x403e54[_0x897b('0x4')]['split'](':')[0x0]:'';this[_0x897b('0x6')]='';this[_0x897b('0x7')]='';this['domain']='';this[_0x897b('0x8')]='';this[_0x897b('0x9')]='';this['stateRegistry']=_0x897b('0x2');this[_0x897b('0xa')]='';this[_0x897b('0xb')]='';this[_0x897b('0xc')]=_0x403e54[_0x897b('0xc')]||'';}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 091a255..b842018 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 _0x15a5=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x4eb1f4,_0x2d541d){var _0x95f868=function(_0x38e4e0){while(--_0x38e4e0){_0x4eb1f4['push'](_0x4eb1f4['shift']());}};_0x95f868(++_0x2d541d);}(_0x15a5,0xf4));var _0x515a=function(_0x1cd391,_0x6fc13e){_0x1cd391=_0x1cd391-0x0;var _0x2936ad=_0x15a5[_0x1cd391];return _0x2936ad;};'use strict';function voiceExtension(_0x3bc7b5){this['id']=_0x3bc7b5['id']||0x0;this[_0x515a('0x0')]=_0x3bc7b5[_0x515a('0x0')]||'';this[_0x515a('0x1')]=_0x3bc7b5[_0x515a('0x1')]||_0x515a('0x2');this[_0x515a('0x3')]=_0x3bc7b5[_0x515a('0x3')]||![];}module[_0x515a('0x4')]=voiceExtension; \ No newline at end of file +var _0xf921=['exten','recordingFormat','none','mandatoryDisposition'];(function(_0x527365,_0x36fb3a){var _0x5de073=function(_0x52a251){while(--_0x52a251){_0x527365['push'](_0x527365['shift']());}};_0x5de073(++_0x36fb3a);}(_0xf921,0x128));var _0x1f92=function(_0x22fefb,_0x105065){_0x22fefb=_0x22fefb-0x0;var _0x49a5e0=_0xf921[_0x22fefb];return _0x49a5e0;};'use strict';function voiceExtension(_0x2b51f4){this['id']=_0x2b51f4['id']||0x0;this[_0x1f92('0x0')]=_0x2b51f4[_0x1f92('0x0')]||'';this[_0x1f92('0x1')]=_0x2b51f4[_0x1f92('0x1')]||_0x1f92('0x2');this[_0x1f92('0x3')]=_0x2b51f4[_0x1f92('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 2b12d2a..f24a6b4 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 _0x1a4e=['message','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','type','talking','total','answered','sumHoldTime','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause'];(function(_0x1d33a7,_0x4830e5){var _0x4ee733=function(_0x34f32f){while(--_0x34f32f){_0x1d33a7['push'](_0x1d33a7['shift']());}};_0x4ee733(++_0x4830e5);}(_0x1a4e,0xda));var _0xe1a4=function(_0x1739e3,_0x31f4bf){_0x1739e3=_0x1739e3-0x0;var _0x238d44=_0x1a4e[_0x1739e3];return _0x238d44;};'use strict';var statusDesc=[_0xe1a4('0x0'),_0xe1a4('0x1'),_0xe1a4('0x2'),'busy',_0xe1a4('0x3'),_0xe1a4('0x4'),_0xe1a4('0x5'),_0xe1a4('0x6'),_0xe1a4('0x7')];var monitorFormat={'wav':_0xe1a4('0x8'),'wav49':_0xe1a4('0x9'),'gsm':_0xe1a4('0xa')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xe1a4('0xb')};function VoiceQueue(_0x3b348e){this['id']=_0x3b348e['id']||0x0;this[_0xe1a4('0xc')]=_0x3b348e[_0xe1a4('0xc')]||'';this[_0xe1a4('0xd')]=_0x3b348e[_0xe1a4('0xd')]||'';this[_0xe1a4('0xe')]=_0x3b348e[_0xe1a4('0xe')]||'inbound';this['waiting']=0x0;this[_0xe1a4('0xf')]=0x0;this[_0xe1a4('0x10')]=0x0;this[_0xe1a4('0x11')]=0x0;this['sumDuration']=0x0;this[_0xe1a4('0x12')]=0x0;this[_0xe1a4('0x13')]=0x0;this[_0xe1a4('0x14')]=0x0;this['abandoned']=0x0;this[_0xe1a4('0x15')]=0x0;this[_0xe1a4('0x16')]=0x0;this[_0xe1a4('0x17')]=_0x3b348e[_0xe1a4('0x17')]||![];this[_0xe1a4('0x18')]=_0x3b348e[_0xe1a4('0x18')]||0xa;this['autopause']=_0x3b348e[_0xe1a4('0x19')]||'no';this['sendMessageOneNotActive']=!![];this[_0xe1a4('0x1a')]='';this[_0xe1a4('0x1b')]=0x0;this['temp']=0x0;this[_0xe1a4('0x1c')]=_0x3b348e['dialTimezone']||null;this[_0xe1a4('0x1d')]=_0x3b348e[_0xe1a4('0x1d')]?_0x3b348e[_0xe1a4('0x1d')]:null;this['dialActive']=_0x3b348e[_0xe1a4('0x1e')];this[_0xe1a4('0x1f')]=_0x3b348e['dialMethod']||_0xe1a4('0x20');this[_0xe1a4('0x21')]=_0x3b348e[_0xe1a4('0x21')]||0x0;this[_0xe1a4('0x22')]=_0x3b348e[_0xe1a4('0x22')]||0x0;this[_0xe1a4('0x23')]=_0x3b348e[_0xe1a4('0x23')]||0x1;this[_0xe1a4('0x24')]=_0x3b348e['dialPredictiveOptimization']||_0xe1a4('0x25');this[_0xe1a4('0x26')]=_0x3b348e[_0xe1a4('0x26')]||0.03;this['dialPredictiveInterval']=_0x3b348e['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x3b348e[_0xe1a4('0x27')]||'anonymous';this[_0xe1a4('0x28')]=_0x3b348e[_0xe1a4('0x28')]||'anonymous';this['dialOriginateTimeout']=_0x3b348e[_0xe1a4('0x29')]||0x1e;this['dialQueueOptions']=_0x3b348e['dialQueueOptions']||'tTxX';this[_0xe1a4('0x2a')]=_0x3b348e['dialQueueTimeout']||0x3;this[_0xe1a4('0x2b')]=_0x3b348e[_0xe1a4('0x2b')]||undefined;this['dialCongestionMaxRetry']=_0x3b348e[_0xe1a4('0x2c')]||0x3;this['dialCongestionRetryFrequency']=_0x3b348e[_0xe1a4('0x2d')]||0x96;this[_0xe1a4('0x2e')]=_0x3b348e[_0xe1a4('0x2e')]||0x3;this[_0xe1a4('0x2f')]=_0x3b348e[_0xe1a4('0x2f')]||0x96;this[_0xe1a4('0x30')]=_0x3b348e[_0xe1a4('0x30')]||0x3;this[_0xe1a4('0x31')]=_0x3b348e[_0xe1a4('0x31')]||0x96;this[_0xe1a4('0x32')]=_0x3b348e[_0xe1a4('0x32')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x3b348e[_0xe1a4('0x33')]||0x96;this[_0xe1a4('0x34')]=_0x3b348e['dialDropMaxRetry']||0x3;this[_0xe1a4('0x35')]=_0x3b348e[_0xe1a4('0x35')]||0x96;this[_0xe1a4('0x36')]=_0x3b348e[_0xe1a4('0x36')]||0x3;this[_0xe1a4('0x37')]=_0x3b348e[_0xe1a4('0x37')]||0x96;this[_0xe1a4('0x38')]=_0x3b348e[_0xe1a4('0x38')]||0x3;this[_0xe1a4('0x39')]=_0x3b348e[_0xe1a4('0x39')]||0x96;this[_0xe1a4('0x3a')]=_0x3b348e[_0xe1a4('0x3a')]||0x3;this[_0xe1a4('0x3b')]=_0x3b348e[_0xe1a4('0x3b')]||0x96;this['callAdditionalPhoneAfterMin']=_0x3b348e[_0xe1a4('0x3c')]||0x3;this['dialGlobalMaxRetry']=_0x3b348e[_0xe1a4('0x3d')]||0x4;this['Trunk']=_0x3b348e[_0xe1a4('0x3e')]?_0x3b348e[_0xe1a4('0x3e')]:undefined;this[_0xe1a4('0x3f')]=_0x3b348e[_0xe1a4('0x3f')]?_0x3b348e[_0xe1a4('0x3f')]:undefined;this[_0xe1a4('0x40')]=_0x3b348e[_0xe1a4('0x40')]||undefined;this[_0xe1a4('0x41')]=_0x3b348e[_0xe1a4('0x41')]?_0x3b348e['Interval']:undefined;this[_0xe1a4('0x42')]=_0x3b348e[_0xe1a4('0x42')]||_0xe1a4('0x43');this[_0xe1a4('0x44')]=_0x3b348e[_0xe1a4('0x44')]||undefined;this['dialCutDigit']=_0x3b348e[_0xe1a4('0x45')]||undefined;this['strategy']=strategy[_0x3b348e[_0xe1a4('0x46')]]||_0xe1a4('0x47');this[_0xe1a4('0x48')]=!![];this[_0xe1a4('0x49')]=_0x3b348e[_0xe1a4('0x49')]||![];this[_0xe1a4('0x4a')]=_0x3b348e[_0xe1a4('0x4a')];this['dialAMDGreeting']=_0x3b348e[_0xe1a4('0x4b')];this[_0xe1a4('0x4c')]=_0x3b348e[_0xe1a4('0x4c')];this[_0xe1a4('0x4d')]=_0x3b348e[_0xe1a4('0x4d')];this[_0xe1a4('0x4e')]=_0x3b348e['dialAMDMinWordLength'];this[_0xe1a4('0x4f')]=_0x3b348e[_0xe1a4('0x4f')];this[_0xe1a4('0x50')]=_0x3b348e['dialAMDMaximumNumberOfWords'];this[_0xe1a4('0x51')]=_0x3b348e[_0xe1a4('0x51')];this[_0xe1a4('0x52')]=_0x3b348e['dialAMDMaximumWordLength'];this[_0xe1a4('0x53')]=0x0;this[_0xe1a4('0x54')]=0x0;this[_0xe1a4('0x55')]=_0x3b348e[_0xe1a4('0x55')];this[_0xe1a4('0x56')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xe1a4('0x57')]=0x0;this[_0xe1a4('0x58')]=0x0;this[_0xe1a4('0x59')]=0x0;this[_0xe1a4('0x5a')]=0x0;this[_0xe1a4('0x5b')]=0x0;this[_0xe1a4('0x5c')]=0x0;this[_0xe1a4('0x5d')]=0x0;this[_0xe1a4('0x5e')]=0x0;this[_0xe1a4('0x5f')]=0x0;this[_0xe1a4('0x60')]=0x0;this[_0xe1a4('0x61')]=0x0;this['outboundAbandonedDay']=0x0;this[_0xe1a4('0x62')]=undefined;this['startPredictive']=undefined;this[_0xe1a4('0x63')]=undefined;this[_0xe1a4('0x64')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xe1a4('0x65')]=0x0;this[_0xe1a4('0x66')]=0x0;this[_0xe1a4('0x67')]=0x0;this[_0xe1a4('0x68')]=0x0;this[_0xe1a4('0x69')]=0x0;this[_0xe1a4('0x6a')]=0x0;this['predictiveIntervalMaxThreshold']=_0x3b348e['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xe1a4('0x6b')]=_0x3b348e[_0xe1a4('0x6c')]||0xa;this[_0xe1a4('0x6d')]=0x0;this[_0xe1a4('0x6e')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0xe1a4('0x6f')]=0x0;this[_0xe1a4('0x70')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x3b348e[_0xe1a4('0x71')]||0x1e;this[_0xe1a4('0x72')]=_0x3b348e[_0xe1a4('0x72')]||![];this[_0xe1a4('0x73')]=!!_0x3b348e[_0xe1a4('0x73')]||![];this[_0xe1a4('0x74')]=!!_0x3b348e[_0xe1a4('0x74')]||![];this[_0xe1a4('0x75')]=_0x3b348e[_0xe1a4('0x75')]||undefined;this[_0xe1a4('0x76')]=_0x3b348e[_0xe1a4('0x76')]||![];this[_0xe1a4('0x77')]=_0x3b348e[_0xe1a4('0x77')]||![];this['monitor_format']=monitorFormat[_0x3b348e[_0xe1a4('0xd')]]?monitorFormat[_0x3b348e[_0xe1a4('0xd')]]:undefined;this[_0xe1a4('0x78')]=_0x3b348e[_0xe1a4('0x78')]||![];this[_0xe1a4('0x79')]=_0x3b348e[_0xe1a4('0x79')]?_0x3b348e[_0xe1a4('0x79')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0x6bd8=['startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','busy','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','inbound','talking','sumDuration','sumHoldTime','sumBillable','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialCutDigit','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive'];(function(_0x4f6f84,_0x31e197){var _0x20d989=function(_0x34db70){while(--_0x34db70){_0x4f6f84['push'](_0x4f6f84['shift']());}};_0x20d989(++_0x31e197);}(_0x6bd8,0x180));var _0x86bd=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x6bd8[_0x1969a7];return _0x3d665f;};'use strict';var statusDesc=['unknown',_0x86bd('0x0'),_0x86bd('0x1'),_0x86bd('0x2'),'invalid',_0x86bd('0x3'),_0x86bd('0x4'),_0x86bd('0x5'),_0x86bd('0x6')];var monitorFormat={'wav':_0x86bd('0x7'),'wav49':_0x86bd('0x8'),'gsm':_0x86bd('0x9')};var strategy={'rrmemory':_0x86bd('0xa'),'roundrobin':_0x86bd('0xb')};function VoiceQueue(_0x5eec22){this['id']=_0x5eec22['id']||0x0;this[_0x86bd('0xc')]=_0x5eec22[_0x86bd('0xc')]||'';this[_0x86bd('0xd')]=_0x5eec22[_0x86bd('0xd')]||'';this['type']=_0x5eec22['type']||_0x86bd('0xe');this['waiting']=0x0;this[_0x86bd('0xf')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0x86bd('0x10')]=0x0;this[_0x86bd('0x11')]=0x0;this[_0x86bd('0x12')]=0x0;this['unmanaged']=0x0;this[_0x86bd('0x13')]=0x0;this[_0x86bd('0x14')]=0x0;this[_0x86bd('0x15')]=0x0;this[_0x86bd('0x16')]=_0x5eec22[_0x86bd('0x16')]||![];this[_0x86bd('0x17')]=_0x5eec22[_0x86bd('0x17')]||0xa;this[_0x86bd('0x18')]=_0x5eec22[_0x86bd('0x18')]||'no';this[_0x86bd('0x19')]=!![];this[_0x86bd('0x1a')]='';this[_0x86bd('0x1b')]=0x0;this[_0x86bd('0x1c')]=0x0;this['dialTimezone']=_0x5eec22[_0x86bd('0x1d')]||null;this[_0x86bd('0x1e')]=_0x5eec22[_0x86bd('0x1e')]?_0x5eec22[_0x86bd('0x1e')]:null;this[_0x86bd('0x1f')]=_0x5eec22[_0x86bd('0x1f')];this['dialMethod']=_0x5eec22[_0x86bd('0x20')]||_0x86bd('0x21');this[_0x86bd('0x22')]=_0x5eec22[_0x86bd('0x22')]||0x0;this[_0x86bd('0x23')]=_0x5eec22['dialLimitQueue']||0x0;this[_0x86bd('0x24')]=_0x5eec22['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x5eec22[_0x86bd('0x25')]||_0x86bd('0x26');this[_0x86bd('0x27')]=_0x5eec22[_0x86bd('0x27')]||0.03;this[_0x86bd('0x28')]=_0x5eec22[_0x86bd('0x28')]||0x258;this[_0x86bd('0x29')]=_0x5eec22[_0x86bd('0x29')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x5eec22[_0x86bd('0x2a')]||'anonymous';this['dialOriginateTimeout']=_0x5eec22['dialOriginateTimeout']||0x1e;this[_0x86bd('0x2b')]=_0x5eec22[_0x86bd('0x2b')]||_0x86bd('0x2c');this['dialQueueTimeout']=_0x5eec22[_0x86bd('0x2d')]||0x3;this[_0x86bd('0x2e')]=_0x5eec22[_0x86bd('0x2e')]||undefined;this[_0x86bd('0x2f')]=_0x5eec22['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x5eec22[_0x86bd('0x30')]||0x96;this[_0x86bd('0x31')]=_0x5eec22['dialBusyMaxRetry']||0x3;this[_0x86bd('0x32')]=_0x5eec22[_0x86bd('0x32')]||0x96;this[_0x86bd('0x33')]=_0x5eec22['dialNoAnswerMaxRetry']||0x3;this[_0x86bd('0x34')]=_0x5eec22[_0x86bd('0x34')]||0x96;this[_0x86bd('0x35')]=_0x5eec22[_0x86bd('0x35')]||0x3;this[_0x86bd('0x36')]=_0x5eec22[_0x86bd('0x36')]||0x96;this[_0x86bd('0x37')]=_0x5eec22[_0x86bd('0x37')]||0x3;this[_0x86bd('0x38')]=_0x5eec22[_0x86bd('0x38')]||0x96;this['dialAbandonedMaxRetry']=_0x5eec22[_0x86bd('0x39')]||0x3;this[_0x86bd('0x3a')]=_0x5eec22['dialAbandonedRetryFrequency']||0x96;this[_0x86bd('0x3b')]=_0x5eec22[_0x86bd('0x3b')]||0x3;this[_0x86bd('0x3c')]=_0x5eec22['dialMachineRetryFrequency']||0x96;this[_0x86bd('0x3d')]=_0x5eec22['dialAgentRejectMaxRetry']||0x3;this[_0x86bd('0x3e')]=_0x5eec22[_0x86bd('0x3e')]||0x96;this[_0x86bd('0x3f')]=_0x5eec22[_0x86bd('0x3f')]||0x3;this[_0x86bd('0x40')]=_0x5eec22['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x5eec22['Trunk']?_0x5eec22[_0x86bd('0x41')]:undefined;this[_0x86bd('0x42')]=_0x5eec22[_0x86bd('0x42')]?_0x5eec22[_0x86bd('0x42')]:undefined;this['dialPrefix']=_0x5eec22[_0x86bd('0x43')]||undefined;this[_0x86bd('0x44')]=_0x5eec22['Interval']?_0x5eec22[_0x86bd('0x44')]:undefined;this[_0x86bd('0x45')]=_0x5eec22[_0x86bd('0x45')]||_0x86bd('0x46');this['dialRandomLastDigitCallerIdNumber']=_0x5eec22['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x5eec22[_0x86bd('0x47')]||undefined;this['strategy']=strategy[_0x5eec22['strategy']]||_0x86bd('0xa');this[_0x86bd('0x48')]=!![];this[_0x86bd('0x49')]=_0x5eec22[_0x86bd('0x49')]||![];this['dialAMDInitialSilence']=_0x5eec22[_0x86bd('0x4a')];this[_0x86bd('0x4b')]=_0x5eec22['dialAMDGreeting'];this[_0x86bd('0x4c')]=_0x5eec22[_0x86bd('0x4c')];this['dialAMDTotalAnalysisTime']=_0x5eec22['dialAMDTotalAnalysisTime'];this[_0x86bd('0x4d')]=_0x5eec22[_0x86bd('0x4d')];this[_0x86bd('0x4e')]=_0x5eec22['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x5eec22[_0x86bd('0x4f')];this[_0x86bd('0x50')]=_0x5eec22['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x5eec22[_0x86bd('0x51')];this[_0x86bd('0x52')]=0x0;this['pTalking']=0x0;this['timeout']=_0x5eec22[_0x86bd('0x53')];this[_0x86bd('0x54')]=0x0;this[_0x86bd('0x55')]=0x0;this[_0x86bd('0x56')]=0x0;this[_0x86bd('0x57')]=0x0;this[_0x86bd('0x58')]=0x0;this[_0x86bd('0x59')]=0x0;this[_0x86bd('0x5a')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x86bd('0x5b')]=0x0;this[_0x86bd('0x5c')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x86bd('0x5d')]=0x0;this[_0x86bd('0x5e')]=0x0;this[_0x86bd('0x5f')]=undefined;this[_0x86bd('0x60')]=undefined;this['handlePredictive']=undefined;this[_0x86bd('0x61')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x86bd('0x62')]=0x0;this[_0x86bd('0x63')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x86bd('0x64')]=0x0;this[_0x86bd('0x65')]=0x0;this[_0x86bd('0x66')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x86bd('0x67')]=_0x5eec22[_0x86bd('0x68')]||0x14;this[_0x86bd('0x69')]=_0x5eec22[_0x86bd('0x68')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x86bd('0x6a')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x86bd('0x6b')]=0x0;this[_0x86bd('0x6c')]=0x0;this[_0x86bd('0x6d')]=0x0;this[_0x86bd('0x6e')]=0x0;this['dialRecallMeTimeout']=_0x5eec22['dialRecallMeTimeout']||0x1e;this[_0x86bd('0x6f')]=_0x5eec22[_0x86bd('0x6f')]||![];this[_0x86bd('0x70')]=!!_0x5eec22[_0x86bd('0x70')]||![];this[_0x86bd('0x71')]=!!_0x5eec22[_0x86bd('0x71')]||![];this[_0x86bd('0x72')]=_0x5eec22[_0x86bd('0x72')]||undefined;this[_0x86bd('0x73')]=_0x5eec22[_0x86bd('0x73')]||![];this[_0x86bd('0x74')]=_0x5eec22['dialAgiAfterHangupAgent']||![];this[_0x86bd('0xd')]=monitorFormat[_0x5eec22[_0x86bd('0xd')]]?monitorFormat[_0x5eec22[_0x86bd('0xd')]]:undefined;this[_0x86bd('0x75')]=_0x5eec22[_0x86bd('0x75')]||![];this['mandatoryDispositionPause']=_0x5eec22[_0x86bd('0x76')]?_0x5eec22[_0x86bd('0x76')]:undefined;}module[_0x86bd('0x77')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 1f130e5..8e6c7ba 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 _0xc40a=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x51f6ff,_0x42773d){var _0x5c09ee=function(_0x14af99){while(--_0x14af99){_0x51f6ff['push'](_0x51f6ff['shift']());}};_0x5c09ee(++_0x42773d);}(_0xc40a,0x1bc));var _0xac40=function(_0x43b90e,_0x2c64e6){_0x43b90e=_0x43b90e-0x0;var _0x4ec563=_0xc40a[_0x43b90e];return _0x4ec563;};'use strict';function VtigerAccount(_0x38305a){this['id']=_0x38305a['id']||0x0;this[_0xac40('0x0')]=_0x38305a[_0xac40('0x0')]||'';this[_0xac40('0x1')]=_0x38305a[_0xac40('0x1')]||'';this[_0xac40('0x2')]=_0x38305a[_0xac40('0x2')]||'';this[_0xac40('0x3')]=_0x38305a[_0xac40('0x3')]||'';this[_0xac40('0x4')]=_0x38305a[_0xac40('0x4')]||'';this[_0xac40('0x5')]=_0x38305a[_0xac40('0x5')]||{};}module[_0xac40('0x6')]=VtigerAccount; \ No newline at end of file +var _0x6483=['serverUrl','Configurations','exports','name','accessKey','remoteUri'];(function(_0x18ebf5,_0x5889ea){var _0x302a3e=function(_0x3b725a){while(--_0x3b725a){_0x18ebf5['push'](_0x18ebf5['shift']());}};_0x302a3e(++_0x5889ea);}(_0x6483,0xa5));var _0x3648=function(_0x3360cb,_0x49ce75){_0x3360cb=_0x3360cb-0x0;var _0x1dfaed=_0x6483[_0x3360cb];return _0x1dfaed;};'use strict';function VtigerAccount(_0x560e2c){this['id']=_0x560e2c['id']||0x0;this[_0x3648('0x0')]=_0x560e2c['name']||'';this['username']=_0x560e2c['username']||'';this['accessKey']=_0x560e2c[_0x3648('0x1')]||'';this[_0x3648('0x2')]=_0x560e2c[_0x3648('0x2')]||'';this[_0x3648('0x3')]=_0x560e2c[_0x3648('0x3')]||'';this[_0x3648('0x4')]=_0x560e2c[_0x3648('0x4')]||{};}module[_0x3648('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index c9cbd93..36280e9 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 _0x8075=['remoteUri','authType','type','serverUrl','Configurations','name','username','password','token'];(function(_0x434d49,_0x4b6a93){var _0x4900ae=function(_0x103624){while(--_0x103624){_0x434d49['push'](_0x434d49['shift']());}};_0x4900ae(++_0x4b6a93);}(_0x8075,0x164));var _0x5807=function(_0xc4ace5,_0x3b5eda){_0xc4ace5=_0xc4ace5-0x0;var _0x207157=_0x8075[_0xc4ace5];return _0x207157;};'use strict';function ZendeskAccount(_0x1e5201){this['id']=_0x1e5201['id']||0x0;this['name']=_0x1e5201[_0x5807('0x0')]||'';this[_0x5807('0x1')]=_0x1e5201[_0x5807('0x1')]||'';this[_0x5807('0x2')]=_0x1e5201[_0x5807('0x2')]||'';this[_0x5807('0x3')]=_0x1e5201[_0x5807('0x3')]||'';this['remoteUri']=_0x1e5201[_0x5807('0x4')]||'';this[_0x5807('0x5')]=_0x1e5201['authType']||'';this['type']=_0x1e5201[_0x5807('0x6')]||'integrationTab';this[_0x5807('0x7')]=_0x1e5201[_0x5807('0x7')]||'';this[_0x5807('0x8')]=_0x1e5201['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x96e0=['authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri'];(function(_0x25110a,_0x3b3852){var _0xe42822=function(_0x283a82){while(--_0x283a82){_0x25110a['push'](_0x25110a['shift']());}};_0xe42822(++_0x3b3852);}(_0x96e0,0x1be));var _0x096e=function(_0x2de4e6,_0x591f86){_0x2de4e6=_0x2de4e6-0x0;var _0x21e2f0=_0x96e0[_0x2de4e6];return _0x21e2f0;};'use strict';function ZendeskAccount(_0x4f10c7){this['id']=_0x4f10c7['id']||0x0;this[_0x096e('0x0')]=_0x4f10c7[_0x096e('0x0')]||'';this[_0x096e('0x1')]=_0x4f10c7['username']||'';this[_0x096e('0x2')]=_0x4f10c7[_0x096e('0x2')]||'';this[_0x096e('0x3')]=_0x4f10c7[_0x096e('0x3')]||'';this[_0x096e('0x4')]=_0x4f10c7[_0x096e('0x4')]||'';this[_0x096e('0x5')]=_0x4f10c7['authType']||'';this[_0x096e('0x6')]=_0x4f10c7[_0x096e('0x6')]||_0x096e('0x7');this[_0x096e('0x8')]=_0x4f10c7[_0x096e('0x8')]||'';this[_0x096e('0x9')]=_0x4f10c7['Configurations']||{};}module[_0x096e('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 0db7461..c76d980 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 _0xa242=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa242,0x19f));var _0x2a24=function(_0x86c1ac,_0x13802a){_0x86c1ac=_0x86c1ac-0x0;var _0x54d20d=_0xa242[_0x86c1ac];return _0x54d20d;};'use strict';function ZohoAccount(_0x5eaf6a){this['id']=_0x5eaf6a['id']||0x0;this[_0x2a24('0x0')]=_0x5eaf6a[_0x2a24('0x0')]||'';this[_0x2a24('0x1')]=_0x5eaf6a[_0x2a24('0x1')]||'';this['host']=_0x5eaf6a[_0x2a24('0x2')]||'';this[_0x2a24('0x3')]=_0x5eaf6a[_0x2a24('0x3')]||'';this[_0x2a24('0x4')]=_0x5eaf6a[_0x2a24('0x4')]||'';this['clientSecret']=_0x5eaf6a[_0x2a24('0x5')]||'';this[_0x2a24('0x6')]=_0x5eaf6a[_0x2a24('0x6')]||'';this['code']=_0x5eaf6a[_0x2a24('0x7')]||'';this['refreshToken']=_0x5eaf6a[_0x2a24('0x8')]||'';this['Configurations']=_0x5eaf6a[_0x2a24('0x9')]||{};}module[_0x2a24('0xa')]=ZohoAccount; \ No newline at end of file +var _0x88a8=['name','description','host','zone','clientId','clientSecret','serverUrl','code','Configurations','exports'];(function(_0x445225,_0x286bf1){var _0x15bb27=function(_0x27f2bd){while(--_0x27f2bd){_0x445225['push'](_0x445225['shift']());}};_0x15bb27(++_0x286bf1);}(_0x88a8,0x6e));var _0x888a=function(_0x7fcd8c,_0x1e9a06){_0x7fcd8c=_0x7fcd8c-0x0;var _0x437b90=_0x88a8[_0x7fcd8c];return _0x437b90;};'use strict';function ZohoAccount(_0x4e0b54){this['id']=_0x4e0b54['id']||0x0;this['name']=_0x4e0b54[_0x888a('0x0')]||'';this['description']=_0x4e0b54[_0x888a('0x1')]||'';this[_0x888a('0x2')]=_0x4e0b54[_0x888a('0x2')]||'';this[_0x888a('0x3')]=_0x4e0b54[_0x888a('0x3')]||'';this[_0x888a('0x4')]=_0x4e0b54[_0x888a('0x4')]||'';this[_0x888a('0x5')]=_0x4e0b54[_0x888a('0x5')]||'';this['serverUrl']=_0x4e0b54[_0x888a('0x6')]||'';this[_0x888a('0x7')]=_0x4e0b54[_0x888a('0x7')]||'';this['refreshToken']=_0x4e0b54['refreshToken']||'';this[_0x888a('0x8')]=_0x4e0b54['Configurations']||{};}module[_0x888a('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index b9e6c24..189ed5d 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 _0x7334=['scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','lastName','active','calleridnum','phone'];(function(_0x1d69ba,_0x4090c9){var _0x8bab8c=function(_0x33ce38){while(--_0x33ce38){_0x1d69ba['push'](_0x1d69ba['shift']());}};_0x8bab8c(++_0x4090c9);}(_0x7334,0x184));var _0x4733=function(_0x2ca24d,_0x521f1c){_0x2ca24d=_0x2ca24d-0x0;var _0x44d503=_0x7334[_0x2ca24d];return _0x44d503;};'use strict';var util=require(_0x4733('0x0'));var _=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));function checkNameSurname(_0x5016ad,_0x59882e,_0x26b8f3){var _0x4b8b5a='';if(!_[_0x4733('0x3')](_0x59882e)&&_0x4733('0x4')===typeof _0x59882e){_0x4b8b5a+=_0x59882e;}if(!_[_0x4733('0x3')](_0x26b8f3)&&_0x4733('0x4')===typeof _0x26b8f3){_0x4b8b5a+='\x20'+_0x26b8f3;}if(_0x4b8b5a!==''){return _0x4b8b5a;}return _0x5016ad;}function Action(_0x2b146d,_0x449ead,_0x16d7cc,_0x283754,_0x12cafa){this[_0x4733('0x5')]=_0x16d7cc||undefined;this[_0x4733('0x6')]=_0x2b146d['id'];this[_0x4733('0x7')]=_0x449ead[_0x4733('0x8')];this[_0x4733('0x9')]=_0x449ead[_0x4733('0x9')];this[_0x4733('0xa')]=_0x4733('0x7');this['dialAnswer']=![];this[_0x4733('0xb')]=_[_0x4733('0x3')](_0x2b146d['Agent'])?undefined:_0x2b146d[_0x4733('0xc')]['name'];this[_0x4733('0xd')]=this[_0x4733('0xb')]?util[_0x4733('0xe')](_0x4733('0xf'),this[_0x4733('0xb')]):_0x283754||undefined;this[_0x4733('0x10')]=checkNameSurname(_0x2b146d[_0x4733('0x11')]['phone'],_0x2b146d[_0x4733('0x11')]['firstName'],_0x2b146d[_0x4733('0x11')][_0x4733('0x12')]);this[_0x4733('0x13')]=_0x2b146d[_0x4733('0x13')]||![];this[_0x4733('0x14')]=_0x2b146d[_0x4733('0x15')];this[_0x4733('0x16')]=_0x2b146d[_0x4733('0x16')];this[_0x4733('0x17')]=_0x2b146d['countbusyretry']||0x0;this[_0x4733('0x18')]=_0x2b146d[_0x4733('0x18')]||0x0;this['countnoanswerretry']=_0x2b146d[_0x4733('0x19')]||0x0;this[_0x4733('0x1a')]=(_0x2b146d[_0x4733('0x17')]||0x0)+(_0x2b146d[_0x4733('0x18')]||0x0)+(_0x2b146d['countnoanswerretry']||0x0)+(_0x2b146d['countnosuchnumberretry']||0x0)+(_0x2b146d[_0x4733('0x1b')]||0x0)+(_0x2b146d[_0x4733('0x1c')]||0x0)+(_0x2b146d['countmachineretry']||0x0)+(_0x2b146d[_0x4733('0x1d')]||0x0);this[_0x4733('0x1e')]=_0x2b146d[_0x4733('0x1e')]||0x0;this[_0x4733('0x1b')]=_0x2b146d['countdropretry']||0x0;this[_0x4733('0x1c')]=_0x2b146d[_0x4733('0x1c')]||0x0;this['countmachineretry']=_0x2b146d[_0x4733('0x1f')]||0x0;this[_0x4733('0x1d')]=_0x2b146d['countagentrejectretry']||0x0;this[_0x4733('0x20')]=_0x2b146d[_0x4733('0x20')];this[_0x4733('0x21')]=_0x2b146d[_0x4733('0x21')];this[_0x4733('0x22')]=_0x2b146d[_0x4733('0x22')];this[_0x4733('0x23')]=_0x2b146d[_0x4733('0x23')];this['ContactId']=_0x2b146d[_0x4733('0x24')];this[_0x4733('0x25')]=_0x2b146d[_0x4733('0x25')];this[_0x4733('0x26')]=_[_0x4733('0x3')](_0x2b146d[_0x4733('0xc')])?_0x2b146d[_0x4733('0x26')]:_0x2b146d[_0x4733('0xc')]['id'];this[_0x4733('0x27')]=_0x2b146d[_0x4733('0x27')];this['originatecalleridnum']='';this[_0x4733('0x28')]='';}Action['prototype']['getCaller']=function(){return util[_0x4733('0xe')]('\x22%s\x22\x20<%s>',this[_0x4733('0x10')],this['number']);};module['exports']=Action; \ No newline at end of file +var _0x0b0e=['prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','moment','isNil','string','idContact','queue','name','type','campaigntype','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname'];(function(_0x332580,_0x234166){var _0x5145e3=function(_0x2feec8){while(--_0x2feec8){_0x332580['push'](_0x332580['shift']());}};_0x5145e3(++_0x234166);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0x0b0e[_0x1bc0ae];return _0x501104;};'use strict';var util=require(_0xe0b0('0x0'));var _=require('lodash');var moment=require(_0xe0b0('0x1'));function checkNameSurname(_0x536e9b,_0x7e5a8a,_0xdf715e){var _0x3b5e2b='';if(!_[_0xe0b0('0x2')](_0x7e5a8a)&&_0xe0b0('0x3')===typeof _0x7e5a8a){_0x3b5e2b+=_0x7e5a8a;}if(!_[_0xe0b0('0x2')](_0xdf715e)&&_0xe0b0('0x3')===typeof _0xdf715e){_0x3b5e2b+='\x20'+_0xdf715e;}if(_0x3b5e2b!==''){return _0x3b5e2b;}return _0x536e9b;}function Action(_0x185efa,_0x30e20d,_0x28e40f,_0x219b1c,_0x5cf9cc){this['uniqueid']=_0x28e40f||undefined;this[_0xe0b0('0x4')]=_0x185efa['id'];this[_0xe0b0('0x5')]=_0x30e20d[_0xe0b0('0x6')];this[_0xe0b0('0x7')]=_0x30e20d['type'];this[_0xe0b0('0x8')]=_0xe0b0('0x5');this['dialAnswer']=![];this[_0xe0b0('0x9')]=_[_0xe0b0('0x2')](_0x185efa['Agent'])?undefined:_0x185efa[_0xe0b0('0xa')][_0xe0b0('0x6')];this[_0xe0b0('0xb')]=this['membername']?util[_0xe0b0('0xc')](_0xe0b0('0xd'),this[_0xe0b0('0x9')]):_0x219b1c||undefined;this[_0xe0b0('0xe')]=checkNameSurname(_0x185efa[_0xe0b0('0xf')]['phone'],_0x185efa[_0xe0b0('0xf')][_0xe0b0('0x10')],_0x185efa[_0xe0b0('0xf')][_0xe0b0('0x11')]);this[_0xe0b0('0x12')]=_0x185efa['active']||![];this[_0xe0b0('0x13')]=_0x185efa['phone'];this[_0xe0b0('0x14')]=_0x185efa[_0xe0b0('0x14')];this['countbusyretry']=_0x185efa[_0xe0b0('0x15')]||0x0;this['countcongestionretry']=_0x185efa[_0xe0b0('0x16')]||0x0;this[_0xe0b0('0x17')]=_0x185efa['countnoanswerretry']||0x0;this['countglobal']=(_0x185efa[_0xe0b0('0x15')]||0x0)+(_0x185efa['countcongestionretry']||0x0)+(_0x185efa['countnoanswerretry']||0x0)+(_0x185efa['countnosuchnumberretry']||0x0)+(_0x185efa[_0xe0b0('0x18')]||0x0)+(_0x185efa['countabandonedretry']||0x0)+(_0x185efa['countmachineretry']||0x0)+(_0x185efa[_0xe0b0('0x19')]||0x0);this['countnosuchnumberretry']=_0x185efa[_0xe0b0('0x1a')]||0x0;this['countdropretry']=_0x185efa[_0xe0b0('0x18')]||0x0;this[_0xe0b0('0x1b')]=_0x185efa[_0xe0b0('0x1b')]||0x0;this[_0xe0b0('0x1c')]=_0x185efa[_0xe0b0('0x1c')]||0x0;this['countagentrejectretry']=_0x185efa['countagentrejectretry']||0x0;this[_0xe0b0('0x1d')]=_0x185efa['callback'];this[_0xe0b0('0x1e')]=_0x185efa[_0xe0b0('0x1e')];this['callbackat']=_0x185efa[_0xe0b0('0x1f')];this['recallme']=_0x185efa[_0xe0b0('0x20')];this['ContactId']=_0x185efa[_0xe0b0('0x21')];this['ListId']=_0x185efa[_0xe0b0('0x22')];this['UserId']=_[_0xe0b0('0x2')](_0x185efa['Agent'])?_0x185efa[_0xe0b0('0x23')]:_0x185efa['Agent']['id'];this[_0xe0b0('0x24')]=_0x185efa[_0xe0b0('0x24')];this[_0xe0b0('0x25')]='';this[_0xe0b0('0x26')]='';}Action[_0xe0b0('0x27')][_0xe0b0('0x28')]=function(){return util['format'](_0xe0b0('0x29'),this[_0xe0b0('0xe')],this['number']);};module[_0xe0b0('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 0149338..80aea30 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 _0x0fda=['Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','status','unmonitored','run','unlock','unlockContact','execRun','recallme','validateContact','isValid','phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','Action','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','addVariable','variables','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','syncAttendedTransfer','transfertargetlinkedid','exports','util','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','actionPreview','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','localhost','socket.io-emitter','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','syncNewExten','varset','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','talking','unmanaged','loggedInDb','dialActive','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','Interval','stringify','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','prototype','dialMethod','preview','booked','clearZombieChannels','hasOwnProperty','setMessage','dialPreviewAutoRecallMe','recallMe','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','dialAnswer','pick','contactId','UserId','channel','catch','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','then','getDiff','scheduledat','Agent','voicePause','[RecallMe]','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','callAdditionalPhoneAfterMin','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','pTalking:\x20','custom:agentconnect','acw','custom:agentConnectPreview','custom:agentcomplete','complete','total','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','\x20Queue','BUSY','countbusyretry','dialBusyRetryFrequency','busy','[callProgressDetectingCustomer][logBusyGlobal]','[callProgressDetectingCustomer][logBusy]','countnoanswerretry','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','dialGlobalMaxRetry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','cause-txt','dialstatus','amd','[callProgressDetectingCustomer][hangupInAMD]','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','Busy','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20'];(function(_0x3541a0,_0x13a60b){var _0x439ccb=function(_0x485c8a){while(--_0x485c8a){_0x3541a0['push'](_0x3541a0['shift']());}};_0x439ccb(++_0x13a60b);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x267037,_0x20b7e3){_0x267037=_0x267037-0x0;var _0x54f84f=_0x0fda[_0x267037];return _0x54f84f;};'use strict';var util=require(_0xa0fd('0x0'));var _=require('lodash');var BPromise=require(_0xa0fd('0x1'));var uuid=require(_0xa0fd('0x2'));var moment=require(_0xa0fd('0x3'));var md5=require(_0xa0fd('0x4'));var Redis=require(_0xa0fd('0x5'));var config=require(_0xa0fd('0x6'));var logger=require(_0xa0fd('0x7'))('preview');var loggerAction=require('../../../config/logger')(_0xa0fd('0x8'));var ami=require('../ami');var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xa0fd('0x9'));var Action=require(_0xa0fd('0xa'));var ut=require(_0xa0fd('0xb'));config[_0xa0fd('0xc')]=_['defaults'](config[_0xa0fd('0xc')],{'host':_0xa0fd('0xd'),'port':0x18eb});var io=require(_0xa0fd('0xe'))(new Redis(config[_0xa0fd('0xc')]));var Sequence=function(){};Sequence['prototype'][_0xa0fd('0xf')]=function(_0x423616){this[_0xa0fd('0x10')]=this['tail']?this[_0xa0fd('0x10')][_0xa0fd('0x11')](_0x423616):_0x423616();};function Preview(_0x40a050){this[_0xa0fd('0x12')]=new Sequence();this[_0xa0fd('0x13')]=_0x40a050['voiceQueues'];this['trunks']=_0x40a050[_0xa0fd('0x14')];this[_0xa0fd('0x15')]={};this['agents']=_0x40a050[_0xa0fd('0x16')];this[_0xa0fd('0x17')]=0x0;ami['on'](_0xa0fd('0x18'),this[_0xa0fd('0x19')][_0xa0fd('0x1a')](this));ami['on'](_0xa0fd('0x1b'),this[_0xa0fd('0x1c')]['bind'](this));ami['on'](_0xa0fd('0x1d'),this[_0xa0fd('0x1e')]['bind'](this));ami['on']('dialend',this[_0xa0fd('0x1f')][_0xa0fd('0x1a')](this));ami['on']('newexten',this[_0xa0fd('0x20')][_0xa0fd('0x1a')](this));ami['on'](_0xa0fd('0x21'),this['syncVarSet']['bind'](this));ami['on'](_0xa0fd('0x22'),this['syncAttendedTransfer'][_0xa0fd('0x1a')](this));ami['on'](_0xa0fd('0x23'),this[_0xa0fd('0x24')][_0xa0fd('0x1a')](this));this[_0xa0fd('0x25')](this[_0xa0fd('0x13')]);}function emit(_0x113059,_0x515b0d,_0x166934){io['to'](_0x113059)[_0xa0fd('0x26')](_0x515b0d,_0x166934);}function emitCampaignPreview(_0x701d7){if(_0x701d7[_0xa0fd('0x27')]===_0xa0fd('0x28')){var _0x3af329={'id':_0x701d7['id'],'name':_0x701d7[_0xa0fd('0x29')],'strategy':_0x701d7[_0xa0fd('0x2a')],'answered':_0x701d7[_0xa0fd('0x2b')],'available':_0x701d7[_0xa0fd('0x2c')],'loggedIn':_0x701d7[_0xa0fd('0x2d')],'pTalking':_0x701d7[_0xa0fd('0x2e')],'sumBillable':_0x701d7[_0xa0fd('0x2f')],'sumDuration':_0x701d7['sumDuration'],'sumHoldTime':_0x701d7[_0xa0fd('0x30')]||0x0,'talking':_0x701d7[_0xa0fd('0x31')],'total':_0x701d7['total'],'type':_0x701d7[_0xa0fd('0x27')],'unmanaged':_0x701d7[_0xa0fd('0x32')],'abandoned':_0x701d7['abandoned'],'waiting':_0x701d7['waiting'],'loggedInDb':_0x701d7[_0xa0fd('0x33')],'dialActive':_0x701d7[_0xa0fd('0x34')],'dialMethod':_0x701d7['dialMethod'],'dialOriginateCallerIdName':_0x701d7['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x701d7['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x701d7['dialOriginateTimeout'],'dialPrefix':_0x701d7[_0xa0fd('0x35')],'outboundAnswerAgiCallsDay':_0x701d7['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x701d7[_0xa0fd('0x36')],'outboundBlacklistCallsDay':_0x701d7[_0xa0fd('0x37')],'outboundBusyCallsDay':_0x701d7[_0xa0fd('0x38')],'outboundCongestionCallsDay':_0x701d7['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x701d7[_0xa0fd('0x39')],'outboundDropCallsDayCallersExit':_0x701d7[_0xa0fd('0x3a')],'outboundDropCallsDayTimeout':_0x701d7[_0xa0fd('0x3b')],'outboundNoAnswerCallsDay':_0x701d7[_0xa0fd('0x3c')],'outboundNoSuchCallsDay':_0x701d7[_0xa0fd('0x3d')],'outboundOriginateFailureCallsDay':_0x701d7['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x701d7[_0xa0fd('0x3e')],'outboundRejectCallsDay':_0x701d7[_0xa0fd('0x3f')],'outboundUnknownCallsDay':_0x701d7[_0xa0fd('0x40')],'outboundAbandonedCallsDay':_0x701d7[_0xa0fd('0x41')],'predictiveIntervalAnsweredCalls':_0x701d7['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x701d7[_0xa0fd('0x42')],'predictiveIntervalAvgTalktime':_0x701d7[_0xa0fd('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x701d7['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x701d7['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x701d7['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x701d7[_0xa0fd('0x44')],'predictiveIntervalHitRate':_0x701d7['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x701d7['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x701d7[_0xa0fd('0x45')],'predictiveIntervalAvailable':_0x701d7['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x701d7[_0xa0fd('0x46')],'message':_0x701d7[_0xa0fd('0x47')],'originated':_0x701d7[_0xa0fd('0x48')],'erlangCalls':_0x701d7[_0xa0fd('0x49')],'erlangCallToSecond':_0x701d7[_0xa0fd('0x4a')],'erlangAbandonmentRate':_0x701d7[_0xa0fd('0x4b')],'erlangBusyFactor':_0x701d7[_0xa0fd('0x4c')],'startPredictive':_0x701d7[_0xa0fd('0x4d')],'startProgressive':_0x701d7['startProgressive']};if(_0x701d7[_0xa0fd('0x4e')]){_0x3af329['Trunk']={'id':_0x701d7[_0xa0fd('0x4e')]['id'],'name':_0x701d7['Trunk']['name'],'active':_0x701d7[_0xa0fd('0x4e')]['active'],'callerid':_0x701d7[_0xa0fd('0x4e')][_0xa0fd('0x4f')]};}if(_0x701d7[_0xa0fd('0x50')]){_0x3af329[_0xa0fd('0x50')]={'id':_0x701d7['Interval']['id'],'name':_0x701d7[_0xa0fd('0x50')][_0xa0fd('0x29')]};}var _0x3b06ef=md5(JSON[_0xa0fd('0x51')](_0x3af329));if(_0x701d7[_0xa0fd('0x4')]!==_0x3b06ef){_0x701d7[_0xa0fd('0x4')]=_0x3b06ef;emit(util[_0xa0fd('0x52')]('voice:queue:%s',_0x3af329['name']),_0xa0fd('0x53'),_0x3af329);}}}function emitVoiceQueueChannelRemove(_0x4f5c75){logger[_0xa0fd('0x54')](_0xa0fd('0x55'),JSON['stringify'](_0x4f5c75));emit(util[_0xa0fd('0x52')](_0xa0fd('0x56'),_0x4f5c75[_0xa0fd('0x29')]),_0xa0fd('0x57'),_0x4f5c75);io[_0xa0fd('0x26')]('voice_queue_presence:remove',_0x4f5c75);}function notSendMessagesQueue(_0x26e0e6){if(_0x26e0e6[_0xa0fd('0x58')]){if(_0x26e0e6['originated']===0x0&&_0x26e0e6['pTalking']===0x0){_0x26e0e6[_0xa0fd('0x58')]=![];_0x26e0e6[_0xa0fd('0x2c')]=0x0;_0x26e0e6[_0xa0fd('0x59')]=0x0;_0x26e0e6[_0xa0fd('0x47')]=_0xa0fd('0x5a');ut[_0xa0fd('0x5b')](_0xa0fd('0x5c'),_0x26e0e6[_0xa0fd('0x29')]+_0xa0fd('0x5d'));}else{_0x26e0e6[_0xa0fd('0x47')]=_0xa0fd('0x5e');ut[_0xa0fd('0x5b')](_0xa0fd('0x5c'),_0x26e0e6[_0xa0fd('0x29')]+_0xa0fd('0x5f'));}emitCampaignPreview(_0x26e0e6);}}Preview['prototype']['loopCampaigns']=function(){var _0x4dd042=this;setInterval(function(){_0x4dd042[_0xa0fd('0x60')]();},0x7cf);};Preview[_0xa0fd('0x61')][_0xa0fd('0x60')]=function(){var _0x54fb8c=this[_0xa0fd('0x13')];this[_0xa0fd('0x17')]+=0x1;for(var _0x3187b0 in _0x54fb8c){if(_0x54fb8c['hasOwnProperty'](_0x3187b0)&&(_0x54fb8c[_0x3187b0][_0xa0fd('0x62')]===_0xa0fd('0x63')||_0x54fb8c[_0x3187b0][_0xa0fd('0x62')]===_0xa0fd('0x64'))&&_0x54fb8c[_0x3187b0][_0xa0fd('0x27')]===_0xa0fd('0x28')){if(this['clockClearZombieChannels']>0x7){this[_0xa0fd('0x17')]=0x0;this[_0xa0fd('0x65')]();}}if(_0x54fb8c[_0xa0fd('0x66')](_0x3187b0)&&_0x54fb8c[_0x3187b0][_0xa0fd('0x62')]===_0xa0fd('0x63')&&_0x54fb8c[_0x3187b0][_0xa0fd('0x27')]==='outbound'){if(_0x54fb8c[_0x3187b0][_0xa0fd('0x34')]){this[_0xa0fd('0x67')](_0x54fb8c[_0x3187b0]);if(_0x54fb8c[_0x3187b0][_0xa0fd('0x68')])this[_0xa0fd('0x69')](_0x54fb8c[_0x3187b0]);}else{notSendMessagesQueue(_0x54fb8c[_0x3187b0]);}}}};Preview[_0xa0fd('0x61')]['clearZombieChannel']=function(_0x5a6824){var _0x147b17=this;this[_0xa0fd('0x12')][_0xa0fd('0xf')](function(){if(!_[_0xa0fd('0x6a')](_0x147b17[_0xa0fd('0x15')][_0x5a6824])){loggerAction['info'](_0xa0fd('0x6b'),_0x5a6824,_0xa0fd('0x6c'),_0x147b17[_0xa0fd('0x15')][_0x5a6824][_0xa0fd('0x6d')],_0xa0fd('0x6e'),JSON[_0xa0fd('0x51')](_0x147b17['campaignsPreview'][_0x147b17['actions'][_0x5a6824]['queue']][_0xa0fd('0x48')]),'pTalking:\x20',JSON['stringify'](_0x147b17[_0xa0fd('0x13')][_0x147b17['actions'][_0x5a6824][_0xa0fd('0x6d')]][_0xa0fd('0x2e')]),JSON['stringify'](_0x147b17['actions'][_0x5a6824][_0xa0fd('0x6f')]),JSON[_0xa0fd('0x51')](_[_0xa0fd('0x70')](_0x147b17[_0xa0fd('0x15')][_0x5a6824],[_0xa0fd('0x71'),_0xa0fd('0x72'),'VoiceQueueId','ListId'])));return ami['Action']({'action':'status','channel':_0x147b17[_0xa0fd('0x15')][_0x5a6824][_0xa0fd('0x73')]})[_0xa0fd('0x74')](function(_0x214c66){if(_0x214c66[_0xa0fd('0x47')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x147b17['actions'][_0x5a6824]){ut['updateOriginated'](_0x147b17['campaignsPreview'][_0x147b17['actions'][_0x5a6824][_0xa0fd('0x6d')]],_0xa0fd('0x75'));if(_0x147b17[_0xa0fd('0x15')][_0x5a6824][_0xa0fd('0x6f')]===!![]){ut[_0xa0fd('0x76')](_0x147b17[_0xa0fd('0x13')][_0x147b17[_0xa0fd('0x15')][_0x5a6824][_0xa0fd('0x6d')]],_0xa0fd('0x75'));ut[_0xa0fd('0x77')]('[Dialer][checkChannel][pTalking][Preview]'+_0x5a6824,_0x147b17['actions'][_0x5a6824][_0xa0fd('0x6d')]);}ut[_0xa0fd('0x77')](_0xa0fd('0x78')+_0x5a6824,_0x147b17[_0xa0fd('0x15')][_0x5a6824]['queue']);delete _0x147b17[_0xa0fd('0x15')][_0x5a6824];}},0x2328);}});}});};Preview[_0xa0fd('0x61')]['clearZombieChannels']=function(){var _0x920e0f=this;loggerAction['info'](_0xa0fd('0x79'),_[_0xa0fd('0x7a')](this['actions']));for(var _0x191992 in this[_0xa0fd('0x15')]){if(_0x920e0f[_0xa0fd('0x15')][_0xa0fd('0x66')](_0x191992)){_0x920e0f[_0xa0fd('0x7b')](_0x191992);}}};Preview[_0xa0fd('0x61')][_0xa0fd('0x69')]=function(_0x21edc7){var _0x5e0440=this;rpcDb[_0xa0fd('0x7c')](_0x21edc7['id'],ut['agentReadyId'](this[_0xa0fd('0x16')]))[_0xa0fd('0x7d')](function(_0x2e3344){if(!_[_0xa0fd('0x6a')](_0x2e3344)){for(var _0xa37ca9=0x0;_0xa37ca9<_0x2e3344['length'];_0xa37ca9+=0x1){if(ut[_0xa0fd('0x7e')](_0x2e3344[_0xa37ca9][_0xa0fd('0x7f')])<_0x21edc7['dialRecallMeTimeout']*0x3c){if(_0x2e3344[_0xa37ca9][_0xa0fd('0x80')]&&!_0x2e3344[_0xa37ca9][_0xa0fd('0x80')][_0xa0fd('0x81')]){_0x5e0440['run'](_0x2e3344[_0xa37ca9]['id'])[_0xa0fd('0x7d')](ut['logger2'](_0xa0fd('0x82')))['catch'](ut[_0xa0fd('0x83')]('[RecallMe]'));}else{rpcDb[_0xa0fd('0x84')](_0x2e3344[_0xa37ca9]['id']);}}else{var _0x62c3e7=new Action(_0x2e3344[_0xa37ca9],_0x21edc7);_0x62c3e7[_0xa0fd('0x85')]=moment()[_0xa0fd('0x52')](_0xa0fd('0x86'));_0x21edc7[_0xa0fd('0x3e')]+=0x1;ut[_0xa0fd('0x87')](_0x62c3e7,0x17,'RecallInQueue');if(_0x21edc7[_0xa0fd('0x88')]){rpcDb[_0xa0fd('0x89')](ut[_0xa0fd('0x8a')](_0x2e3344[_0xa37ca9]));rpcDb[_0xa0fd('0x8b')](_0x62c3e7,_0xa0fd('0x8c'));}else{ut['logCustomer'](_0x62c3e7,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x62c3e7,_0xa0fd('0x8d'));rpcDb['createCustomerFinal'](_0x62c3e7,_0xa0fd('0x8d'));}}}}})['catch'](ut[_0xa0fd('0x83')](_0xa0fd('0x8e')));};Preview[_0xa0fd('0x61')][_0xa0fd('0x67')]=function(_0x411815){_0x411815[_0xa0fd('0x58')]=!![];if(ut[_0xa0fd('0x8f')](_0x411815[_0xa0fd('0x2d')])){_0x411815[_0xa0fd('0x47')]=_0xa0fd('0x90');}else if(!ut[_0xa0fd('0x91')](_0x411815[_0xa0fd('0x34')])){_0x411815['message']='NOT_ACTIVE';}else if(!this[_0xa0fd('0x92')](_0x411815[_0xa0fd('0x4e')])){if(!this[_0xa0fd('0x92')](_0x411815[_0xa0fd('0x93')])){_0x411815[_0xa0fd('0x47')]=_0xa0fd('0x94');}else{_0x411815[_0xa0fd('0x47')]=_0xa0fd('0x95');}}else{_0x411815['message']=_0xa0fd('0x95');}emitCampaignPreview(_0x411815);};Preview[_0xa0fd('0x61')][_0xa0fd('0x96')]=function(_0x392322,_0xe41454,_0xe3d82c){var _0x45f7df=this;var _0x2b5490=this[_0xa0fd('0x15')][_0xe41454];var _0x1bc5db=this[_0xa0fd('0x13')][_0x2b5490[_0xa0fd('0x6d')]];var _0x520597;var _0x436f4f=![];var _0x3cd5a5=0x2;var _0x1194fe=0x3;if(_0x1bc5db){switch(_0xe3d82c){case'1':_0x1bc5db[_0xa0fd('0x3d')]+=0x1;_0x2b5490[_0xa0fd('0x97')]+=0x1;_0x2b5490[_0xa0fd('0x98')]=ut[_0xa0fd('0x99')](_0x2b5490);ut[_0xa0fd('0x87')](_0x2b5490,0x0,_0xa0fd('0x9a'));ami[_0xa0fd('0x26')]('custom:agentnosuchnumber',ut[_0xa0fd('0x9b')](_0x2b5490,_0xa0fd('0x9c')));rpcDb[_0xa0fd('0x8b')](_0x2b5490,_0xa0fd('0x9d'));_0x45f7df[_0xa0fd('0x9e')](_0x2b5490,'0',_0x1bc5db)[_0xa0fd('0x7d')](function(_0x15c756){_0x436f4f=_0x15c756[_0xa0fd('0x9f')]==0x1;_0x3cd5a5=_0x1bc5db['dialNoSuchNumberRetryFrequency'];_0x1194fe=_0x1bc5db[_0xa0fd('0xa0')];if(!_0x436f4f){if(ut[_0xa0fd('0x99')](_0x2b5490)>=_0x1bc5db['dialGlobalMaxRetry']){_0x520597=ut[_0xa0fd('0xa1')](_0x2b5490,0xf,_0xa0fd('0xa2'));rpcDb[_0xa0fd('0xa3')](_0x520597,_0xa0fd('0xa4'));}else{if(_0x2b5490[_0xa0fd('0x97')]>=_0x1bc5db['dialNoSuchNumberMaxRetry']){rpcDb[_0xa0fd('0xa3')](_0x2b5490,_0xa0fd('0xa4'));}else{rpcDb[_0xa0fd('0xa5')](ut[_0xa0fd('0xa6')](_0x2b5490,_0xa0fd('0x97'),_0x1bc5db[_0xa0fd('0xa7')]),_0x2b5490[_0xa0fd('0xa8')],_0x2b5490[_0xa0fd('0xa9')]);}}delete this[_0xa0fd('0x15')][_0x392322[_0xa0fd('0xaa')]];}else{_0x2b5490[_0xa0fd('0x97')]++;logger[_0xa0fd('0x54')](_0xa0fd('0xab'),_0x2b5490[_0xa0fd('0x97')]);logger[_0xa0fd('0x54')]('id',_0x2b5490[_0xa0fd('0xac')]);_0x45f7df[_0xa0fd('0xad')]({'id':_0x2b5490[_0xa0fd('0xac')],'field':{'countnosuchnumberretry':_0x2b5490[_0xa0fd('0x97')]}})['then'](function(){_0x45f7df[_0xa0fd('0xae')](_0x2b5490,_0x3cd5a5,_0x1194fe)[_0xa0fd('0x7d')](function(){});});}});break;case _0xa0fd('0xaf'):var _0x349bbe=moment()['format'](_0xa0fd('0x86'));_0x2b5490[_0xa0fd('0xb0')]=_0x349bbe;_0x2b5490[_0xa0fd('0xb1')]=_0x349bbe;_0x2b5490[_0xa0fd('0x6f')]=!![];_0x1bc5db[_0xa0fd('0x2e')]+=0x1;logger['info'](_0xa0fd('0xb2'),_0x2b5490[_0xa0fd('0xb3')],'\x20Queue',_0x1bc5db['name'],_0xa0fd('0xb4'),_0x1bc5db['pTalking']);ami['emit'](_0xa0fd('0xb5'),ut[_0xa0fd('0x9b')](_0x2b5490,'connect',this[_0xa0fd('0x13')][_0x2b5490[_0xa0fd('0x6d')]]));if(_0x1bc5db[_0xa0fd('0xb6')]){ami[_0xa0fd('0x26')](_0xa0fd('0xb7'),ut['buildAcw'](_0x2b5490));}break;case'16':ami[_0xa0fd('0x26')](_0xa0fd('0xb8'),ut['buildObj'](_0x2b5490,_0xa0fd('0xb9'),this[_0xa0fd('0x13')][_0x2b5490[_0xa0fd('0x6d')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2b5490,_0xa0fd('0xb9')));_0x1bc5db['outboundAnswerCallsDay']+=0x1;_0x1bc5db[_0xa0fd('0xba')]+=0x1;_0x1bc5db[_0xa0fd('0x2b')]+=0x1;ut[_0xa0fd('0x76')](_0x1bc5db,_0xa0fd('0xbb'));_0x2b5490['countglobal']=ut[_0xa0fd('0x99')](_0x2b5490);ut[_0xa0fd('0x87')](_0x2b5490,0x4,_0xa0fd('0xbc'));rpcDb[_0xa0fd('0x8b')](_0x2b5490,_0xa0fd('0xbd'));rpcDb[_0xa0fd('0xa3')](_0x2b5490,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xa0fd('0xbe')](_0x2b5490);_0x1bc5db[_0xa0fd('0xbf')]+=_0x2b5490[_0xa0fd('0xc0')];_0x1bc5db[_0xa0fd('0x2f')]+=_0x2b5490[_0xa0fd('0xc0')];logger[_0xa0fd('0x54')]('[syncHangup][talking][decrement]',_0x2b5490['uniqueid'],_0xa0fd('0xc1'),_0x1bc5db[_0xa0fd('0x29')],'pTalking:\x20',_0x1bc5db[_0xa0fd('0x2e')]);delete this[_0xa0fd('0x15')][_0x392322[_0xa0fd('0xaa')]];break;case _0xa0fd('0xc2'):_0x1bc5db[_0xa0fd('0x38')]+=0x1;_0x2b5490[_0xa0fd('0xc3')]+=0x1;_0x2b5490[_0xa0fd('0x98')]=ut[_0xa0fd('0x99')](_0x2b5490);ut[_0xa0fd('0x87')](_0x2b5490,0x5,'Busy');_0x3cd5a5=_0x1bc5db[_0xa0fd('0xc4')];_0x1194fe=_0x1bc5db[_0xa0fd('0xa0')];ami[_0xa0fd('0x26')]('custom:agentbusy',ut[_0xa0fd('0x9b')](_0x2b5490,_0xa0fd('0xc5')));rpcDb['createCustomerHistory'](_0x2b5490,'[callProgressDetectingCustomer][logBusy]');_0x45f7df[_0xa0fd('0x9e')](_0x2b5490,'5',_0x1bc5db)[_0xa0fd('0x7d')](function(_0x1bd927){_0x436f4f=_0x1bd927[_0xa0fd('0x9f')]==0x1;if(!_0x436f4f){if(ut['totalGlobal'](_0x2b5490)>=_0x1bc5db['dialGlobalMaxRetry']){_0x520597=ut[_0xa0fd('0xa1')](_0x2b5490,0xf,_0xa0fd('0xa2'));rpcDb[_0xa0fd('0xa3')](_0x520597,_0xa0fd('0xc6'));}else{if(_0x2b5490[_0xa0fd('0xc3')]>=_0x1bc5db['dialBusyMaxRetry']){rpcDb['createCustomerFinal'](_0x2b5490,_0xa0fd('0xc7'));}else{rpcDb[_0xa0fd('0xa5')](ut[_0xa0fd('0xa6')](_0x2b5490,_0xa0fd('0xc3'),_0x1bc5db[_0xa0fd('0xc4')]),_0x2b5490[_0xa0fd('0xa8')],_0x2b5490[_0xa0fd('0xa9')]);}}}else{_0x2b5490[_0xa0fd('0xc3')]++;_0x45f7df[_0xa0fd('0xad')]({'id':_0x2b5490[_0xa0fd('0xac')],'field':{'countbusyretry':_0x2b5490[_0xa0fd('0xc3')]}})[_0xa0fd('0x7d')](function(){_0x45f7df[_0xa0fd('0xae')](_0x2b5490,_0x3cd5a5,_0x1194fe)[_0xa0fd('0x7d')](function(){});});}});break;case'NOANSWER':_0x1bc5db[_0xa0fd('0x3c')]+=0x1;_0x2b5490[_0xa0fd('0xc8')]+=0x1;_0x2b5490[_0xa0fd('0x98')]=ut[_0xa0fd('0x99')](_0x2b5490);ut['logCustomer'](_0x2b5490,0x3,'NoAnswer');_0x3cd5a5=_0x1bc5db[_0xa0fd('0xc9')];_0x1194fe=_0x1bc5db['callAdditionalPhoneAfterMin'];ami[_0xa0fd('0x26')](_0xa0fd('0xca'),ut[_0xa0fd('0x9b')](_0x2b5490,_0xa0fd('0xcb')));rpcDb['createCustomerHistory'](_0x2b5490,'[callProgressDetectingCustomer][logNoAnswer]');_0x45f7df['verifyAdditionalPhones'](_0x2b5490,'3',_0x1bc5db)['then'](function(_0x5d8ead){_0x436f4f=_0x5d8ead['additional']==0x1;if(!_0x436f4f){if(ut[_0xa0fd('0x99')](_0x2b5490)>=_0x1bc5db[_0xa0fd('0xcc')]){_0x520597=ut[_0xa0fd('0xa1')](_0x2b5490,0xf,'Global');rpcDb[_0xa0fd('0xa3')](_0x520597,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x2b5490[_0xa0fd('0xc8')]>=_0x1bc5db[_0xa0fd('0xcd')]){rpcDb[_0xa0fd('0xa3')](_0x2b5490,_0xa0fd('0xce'));}else{rpcDb['rescheduleContact'](ut[_0xa0fd('0xa6')](_0x2b5490,_0xa0fd('0xc8'),_0x1bc5db[_0xa0fd('0xc9')]),_0x2b5490[_0xa0fd('0xa8')],_0x2b5490[_0xa0fd('0xa9')]);}}}else{_0x2b5490[_0xa0fd('0xc8')]++;_0x45f7df['incrementPreviewCounters']({'id':_0x2b5490[_0xa0fd('0xac')],'field':{'countnoanswerretry':_0x2b5490[_0xa0fd('0xc8')]}})[_0xa0fd('0x7d')](function(){_0x45f7df[_0xa0fd('0xae')](_0x2b5490,_0x3cd5a5,_0x1194fe)[_0xa0fd('0x7d')](function(){});});}});break;case _0xa0fd('0xcf'):_0x1bc5db[_0xa0fd('0xd0')]+=0x1;_0x2b5490[_0xa0fd('0xd1')]+=0x1;_0x2b5490['countglobal']=ut[_0xa0fd('0x99')](_0x2b5490);ut['logCustomer'](_0x2b5490,0x8,_0xa0fd('0xd2'));_0x3cd5a5=_0x1bc5db[_0xa0fd('0xd3')];_0x1194fe=_0x1bc5db[_0xa0fd('0xa0')];ami['emit'](_0xa0fd('0xd4'),ut[_0xa0fd('0x9b')](_0x2b5490,_0xa0fd('0xd5')));rpcDb[_0xa0fd('0x8b')](_0x2b5490,'[callProgressDetectingCustomer][logCongestion]');_0x45f7df['verifyAdditionalPhones'](_0x2b5490,'8',_0x1bc5db)[_0xa0fd('0x7d')](function(_0x50503e){_0x436f4f=_0x50503e[_0xa0fd('0x9f')]==0x1;if(!_0x436f4f){if(ut[_0xa0fd('0x99')](_0x2b5490)>=_0x1bc5db[_0xa0fd('0xcc')]){_0x520597=ut['cloneAction'](_0x2b5490,0xf,_0xa0fd('0xa2'));rpcDb[_0xa0fd('0xa3')](_0x520597,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x2b5490[_0xa0fd('0xd1')]>=_0x1bc5db['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x2b5490,_0xa0fd('0xd6'));}else{rpcDb[_0xa0fd('0xa5')](ut[_0xa0fd('0xa6')](_0x2b5490,'countcongestionretry',_0x1bc5db[_0xa0fd('0xc4')]),_0x2b5490['unlockAgent'],_0x2b5490[_0xa0fd('0xa9')]);}}}else{_0x2b5490[_0xa0fd('0xd1')]++;_0x45f7df[_0xa0fd('0xad')]({'id':_0x2b5490[_0xa0fd('0xac')],'field':{'countcongestionretry':_0x2b5490[_0xa0fd('0xd1')]}})['then'](function(){_0x45f7df[_0xa0fd('0xae')](_0x2b5490,_0x3cd5a5,_0x1194fe)[_0xa0fd('0x7d')](function(){});});}});break;case _0xa0fd('0xd7'):_0x1bc5db[_0xa0fd('0x3f')]+=0x1;_0x2b5490[_0xa0fd('0xd8')]+=0x1;_0x2b5490[_0xa0fd('0x98')]=ut[_0xa0fd('0x99')](_0x2b5490);ut['logCustomer'](_0x2b5490,0x14,_0xa0fd('0xd9'));_0x3cd5a5=_0x1bc5db[_0xa0fd('0xda')];_0x1194fe=_0x1bc5db[_0xa0fd('0xa0')];ami[_0xa0fd('0x26')](_0xa0fd('0xdb'),ut['buildObj'](_0x2b5490,_0xa0fd('0xdc')));rpcDb[_0xa0fd('0x8b')](_0x2b5490,_0xa0fd('0xdd'));_0x45f7df[_0xa0fd('0x9e')](_0x2b5490,'20',_0x1bc5db)['then'](function(_0x550d8c){_0x436f4f=_0x550d8c[_0xa0fd('0x9f')]==0x1;if(!_0x436f4f){if(ut['totalGlobal'](_0x2b5490)>=_0x1bc5db[_0xa0fd('0xcc')]){_0x520597=ut[_0xa0fd('0xa1')](_0x2b5490,0x14,'AgentReject');rpcDb[_0xa0fd('0xa3')](_0x520597,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x2b5490[_0xa0fd('0xd8')]>=_0x1bc5db[_0xa0fd('0xde')]){rpcDb['createCustomerFinal'](_0x2b5490,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xa0fd('0xa5')](ut['scheduledAt'](_0x2b5490,_0xa0fd('0xd8'),_0x1bc5db['dialAgentRejectRetryFrequency']),_0x2b5490[_0xa0fd('0xa8')],_0x2b5490['activeContact']);}}}else{_0x2b5490[_0xa0fd('0xc8')]++;_0x45f7df[_0xa0fd('0xad')]({'id':_0x2b5490[_0xa0fd('0xac')],'field':{'countnoanswerretry':_0x2b5490[_0xa0fd('0xc8')]}})['then'](function(){_0x45f7df[_0xa0fd('0xae')](_0x2b5490,_0x3cd5a5,_0x1194fe)[_0xa0fd('0x7d')](function(){});});}});break;case'ABANDONED':_0x1bc5db[_0xa0fd('0x41')]+=0x1;_0x2b5490[_0xa0fd('0xdf')]+=0x1;_0x2b5490['countglobal']=ut[_0xa0fd('0x99')](_0x2b5490);ut[_0xa0fd('0x87')](_0x2b5490,0xb,'Abandoned');rpcDb[_0xa0fd('0x8b')](_0x2b5490,_0xa0fd('0xe0'));_0x45f7df[_0xa0fd('0x9e')](_0x2b5490,'11',_0x1bc5db)[_0xa0fd('0x7d')](function(_0x28c0fb){_0x436f4f=_0x28c0fb[_0xa0fd('0x9f')]==0x1;if(!_0x436f4f){if(ut[_0xa0fd('0x99')](_0x2b5490)>=_0x1bc5db[_0xa0fd('0xcc')]){_0x520597=ut[_0xa0fd('0xa1')](_0x2b5490,0xf,'Global');rpcDb[_0xa0fd('0xa3')](_0x520597,_0xa0fd('0xe0'));}else{if(_0x2b5490['countabandonedetry']>=_0x1bc5db['dialAbandonedMaxRety']){rpcDb[_0xa0fd('0xa3')](_0x2b5490,_0xa0fd('0xe0'));}else{rpcDb[_0xa0fd('0xa5')](ut[_0xa0fd('0xa6')](_0x2b5490,_0xa0fd('0xdf'),_0x1bc5db['dialAbandonedRetryFrequency']),_0x2b5490[_0xa0fd('0xa8')],_0x2b5490[_0xa0fd('0xa9')]);}}}else{_0x2b5490[_0xa0fd('0xc8')]++;_0x45f7df['incrementPreviewCounters']({'id':_0x2b5490['idContact'],'field':{'countnoanswerretry':_0x2b5490[_0xa0fd('0xc8')]}})[_0xa0fd('0x7d')](function(){_0x45f7df[_0xa0fd('0xae')](_0x2b5490,_0x3cd5a5,_0x1194fe)[_0xa0fd('0x7d')](function(){});});}});break;case'18':_0x1bc5db[_0xa0fd('0x40')]+=0x1;_0x2b5490['countmachineretry']+=0x1;_0x2b5490[_0xa0fd('0x98')]=ut[_0xa0fd('0x99')](_0x2b5490);ut[_0xa0fd('0x87')](_0x2b5490,0x12,_0x392322[_0xa0fd('0xe1')]||_0x392322[_0xa0fd('0xe2')]);ami[_0xa0fd('0x26')]('custom:amd',ut[_0xa0fd('0x9b')](_0x2b5490,_0xa0fd('0xe3')));rpcDb[_0xa0fd('0x8b')](_0x2b5490,_0xa0fd('0xe4'));_0x45f7df[_0xa0fd('0x9e')](_0x2b5490,'18',_0x1bc5db)[_0xa0fd('0x7d')](function(_0x294b03){_0x436f4f=_0x294b03['additional']==0x1;if(!_0x436f4f){if(ut[_0xa0fd('0x99')](_0x2b5490)>=_0x1bc5db['dialGlobalMaxRetry']){_0x520597=ut['cloneAction'](_0x2b5490,0x12,'Global');rpcDb['createCustomerFinal'](_0x520597,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x2b5490,_0xa0fd('0xe4'));}}else{_0x2b5490[_0xa0fd('0xc8')]++;_0x45f7df['incrementPreviewCounters']({'id':_0x2b5490[_0xa0fd('0xac')],'field':{'countnoanswerretry':_0x2b5490[_0xa0fd('0xc8')]}})[_0xa0fd('0x7d')](function(){_0x45f7df[_0xa0fd('0xae')](_0x2b5490,_0x3cd5a5,_0x1194fe)['then'](function(){});});}});delete this[_0xa0fd('0x15')][_0x392322[_0xa0fd('0xaa')]];break;case'19':_0x1bc5db[_0xa0fd('0x40')]+=0x1;_0x2b5490[_0xa0fd('0x98')]=ut[_0xa0fd('0x99')](_0x2b5490);ut[_0xa0fd('0x87')](_0x2b5490,0x13,_0x392322['cause-txt']||_0x392322[_0xa0fd('0xe2')]);ami[_0xa0fd('0x26')](_0xa0fd('0xe5'),ut[_0xa0fd('0x9b')](_0x2b5490,_0xa0fd('0xe3')));rpcDb[_0xa0fd('0x8b')](_0x2b5490,'[callProgressDetectingCustomer][machine]');_0x45f7df[_0xa0fd('0x9e')](_0x2b5490,'18',_0x1bc5db)[_0xa0fd('0x7d')](function(_0x4bbe91){_0x436f4f=_0x4bbe91[_0xa0fd('0x9f')]==0x1;if(!_0x436f4f){if(ut['totalGlobal'](_0x2b5490)>=_0x1bc5db[_0xa0fd('0xcc')]){_0x520597=ut['cloneAction'](_0x2b5490,0xf,'Global');rpcDb[_0xa0fd('0xa3')](_0x520597,_0xa0fd('0xe6'));}else{rpcDb[_0xa0fd('0xa3')](_0x2b5490,_0xa0fd('0xe6'));}}else{_0x2b5490[_0xa0fd('0xc8')]++;_0x45f7df[_0xa0fd('0xad')]({'id':_0x2b5490[_0xa0fd('0xac')],'field':{'countnoanswerretry':_0x2b5490['countnoanswerretry']}})[_0xa0fd('0x7d')](function(){_0x45f7df['swapAdditionalPhones'](_0x2b5490,_0x3cd5a5,_0x1194fe)[_0xa0fd('0x7d')](function(){});});}});delete this['actions'][_0x392322[_0xa0fd('0xaa')]];break;default:if(_0x2b5490[_0xa0fd('0x6f')]){ut[_0xa0fd('0x76')](_0x1bc5db,_0xa0fd('0xe7'));ut[_0xa0fd('0x77')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x1bc5db[_0xa0fd('0x29')],_0x392322);}_0x1bc5db['outboundUnknownCallsDay']+=0x1;_0x2b5490[_0xa0fd('0x98')]=ut['totalGlobal'](_0x2b5490);ut[_0xa0fd('0x87')](_0x2b5490,0xc,_0x392322['cause-txt']||_0x392322[_0xa0fd('0xe2')]);_0x3cd5a5=_0x1bc5db['dialAgentRejectRetryFrequency'];_0x1194fe=_0x1bc5db[_0xa0fd('0xa0')];rpcDb['createCustomerHistory'](_0x2b5490,_0xa0fd('0xe8'));_0x45f7df['verifyAdditionalPhones'](_0x2b5490,'20',_0x1bc5db)['then'](function(_0x2f22d4){_0x436f4f=_0x2f22d4[_0xa0fd('0x9f')]==0x1;if(!_0x436f4f){if(ut['totalGlobal'](_0x2b5490)>=_0x1bc5db[_0xa0fd('0xcc')]){_0x520597=ut[_0xa0fd('0xa1')](_0x2b5490,0xf,'Global');rpcDb['createCustomerFinal'](_0x520597,_0xa0fd('0xe9'));}else{rpcDb['createCustomerFinal'](_0x2b5490,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xa0fd('0x15')][_0x392322['linkedid']];}else{_0x45f7df[_0xa0fd('0xae')](_0x2b5490,_0x3cd5a5,_0x1194fe)[_0xa0fd('0x7d')](function(_0x2e88cf){});}});}if(!(_0x2b5490['dialAnswer']&&_0xe3d82c==='16')){ut[_0xa0fd('0xea')](_0x1bc5db,_0xa0fd('0xeb'));logger[_0xa0fd('0x54')](_0xa0fd('0xec'),_0x2b5490[_0xa0fd('0xb3')],_0xa0fd('0xc1'),_0x1bc5db[_0xa0fd('0x29')],_0xa0fd('0x6e'),_0x1bc5db[_0xa0fd('0x48')]);}if(_0xe3d82c!==_0xa0fd('0xaf')){delete this['actions'][_0x392322[_0xa0fd('0xaa')]];delete this[_0xa0fd('0x15')][_0x392322[_0xa0fd('0xed')]];}}};Preview['prototype'][_0xa0fd('0xee')]=function(_0x5750cd,_0x447070,_0x181bbc){if(_[_0xa0fd('0xef')](_0x447070)&&_0xa0fd('0xf0')!==typeof _0x447070){return;}if(_['isUndefined'](_0x181bbc)&&_0xa0fd('0xf0')!==typeof _0x181bbc){return;}switch(_0x181bbc[_0xa0fd('0xf1')]){case'0':ut[_0xa0fd('0xf2')](_0x5750cd,0x0,_0xa0fd('0x9a'));rpcDb['createAgentHistory'](_0x5750cd,_0xa0fd('0xf3'));break;case'3':ut[_0xa0fd('0xf2')](_0x5750cd,0x3,_0xa0fd('0xf4'));rpcDb['createAgentHistory'](_0x5750cd,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xa0fd('0xf2')](_0x5750cd,0x5,_0xa0fd('0xf5'));rpcDb[_0xa0fd('0xf6')](_0x5750cd,_0xa0fd('0xf7'));break;case'8':ut[_0xa0fd('0xf2')](_0x5750cd,0x8,_0xa0fd('0xd2'));rpcDb[_0xa0fd('0xf6')](_0x5750cd,_0xa0fd('0xf8'));break;case'22':ut[_0xa0fd('0xf2')](_0x5750cd,0x16,_0xa0fd('0xf9'));rpcDb[_0xa0fd('0xf6')](_0x5750cd,_0xa0fd('0xfa'));break;default:ut[_0xa0fd('0xf2')](_0x5750cd,0xc,_0x181bbc[_0xa0fd('0xf1')]);rpcDb['createAgentHistory'](_0x5750cd,_0xa0fd('0xf8'));}ut[_0xa0fd('0xea')](_0x447070,_0xa0fd('0xfb'));logger[_0xa0fd('0x54')](_0xa0fd('0xfc'),_0x5750cd['uniqueid'],_0xa0fd('0xc1'),_0x447070[_0xa0fd('0x29')],_0xa0fd('0x6e'),_0x447070[_0xa0fd('0x48')]);delete this[_0xa0fd('0x15')][_0x5750cd[_0xa0fd('0xb3')]];};Preview[_0xa0fd('0x61')][_0xa0fd('0x9e')]=function(_0x33380e,_0xa1cc7,_0x3fab51){return BPromise[_0xa0fd('0xfd')]()[_0xa0fd('0x7d')](cmHopperAdditionalPhone[_0xa0fd('0x9e')](_0x33380e,_0xa1cc7,_0x3fab51))[_0xa0fd('0x74')](logger['info']('[verifyAdditionalPhone]\x20'));};Preview[_0xa0fd('0x61')][_0xa0fd('0xae')]=function(_0x3d5af0,_0x4c398f,_0x4d1b53){return BPromise['resolve']()[_0xa0fd('0x7d')](cmHopperAdditionalPhone[_0xa0fd('0xae')](_0x3d5af0,_0x4c398f,_0x4d1b53))['catch'](logger[_0xa0fd('0x54')](_0xa0fd('0xfe')));};Preview[_0xa0fd('0x61')][_0xa0fd('0xad')]=function(_0x69c1f1){return BPromise[_0xa0fd('0xfd')]()[_0xa0fd('0x7d')](cmHopperAdditionalPhone[_0xa0fd('0xad')](_0x69c1f1))[_0xa0fd('0x74')](logger[_0xa0fd('0x54')](_0xa0fd('0xff')));};Preview[_0xa0fd('0x61')]['checkInBlack']=function(_0x37c664,_0x286d78,_0x2c773e,_0x827eed,_0xff8796){var _0x44a3a3=this;return new BPromise(function(_0x41f3b9,_0x436bda){if(_[_0xa0fd('0x6a')](_0x286d78)||_[_0xa0fd('0x6a')](_0x286d78['Contact'])||_[_0xa0fd('0x6a')](_0x286d78['phone'])||_['isNil'](_0x286d78['VoiceQueueId'])){_0x436bda(ut[_0xa0fd('0x47')](_0xa0fd('0x100'),_0x827eed,_0xff8796));return;}var _0x943155=uuid['v4']();var _0x51ec05=_0x44a3a3['campaignsPreview'][_0x286d78[_0xa0fd('0x6c')][_0xa0fd('0x29')]];var _0x2aae1d=_0x2c773e?_0x44a3a3['agents'][_0x2c773e]['id']:undefined;_0x44a3a3[_0xa0fd('0x15')][_0x943155]=new Action(_0x286d78,_0x51ec05,_0x943155,_0x2c773e,_0x2aae1d);var _0x26606e=_0x44a3a3[_0xa0fd('0x15')][_0x943155];_0x26606e[_0xa0fd('0xa8')]=_0x827eed;_0x26606e[_0xa0fd('0xa9')]=_0xff8796;_0x26606e[_0xa0fd('0x101')]=_0x2c773e;if(_[_0xa0fd('0x102')](_0x37c664)){_0x44a3a3['execCall'](_0x26606e,_0x51ec05,_0x286d78,_0x2c773e)['then'](function(_0x16c36d){logger[_0xa0fd('0x54')](_0xa0fd('0x103'),'Queue:\x20'+_0x26606e['queue']+'\x20IdHopper:\x20'+_0x26606e[_0xa0fd('0xac')],JSON['stringify'](_0x16c36d));ami[_0xa0fd('0x26')](_0xa0fd('0x104'),ut['buildObj'](_0x26606e,_0xa0fd('0x105'),_0x44a3a3[_0xa0fd('0x13')][_0x26606e[_0xa0fd('0x6d')]]));_0x41f3b9(ut[_0xa0fd('0x47')](_0xa0fd('0x106')));})['catch'](function(_0x39a98b){ut[_0xa0fd('0x5b')](_0xa0fd('0x107'),_0x39a98b);_0x436bda(ut[_0xa0fd('0x47')]('Call\x20failed',_0x827eed,_0xff8796));});}else{_0x51ec05[_0xa0fd('0x37')]+=0x1;ut[_0xa0fd('0x108')](_0x26606e);rpcDb[_0xa0fd('0x109')](_0x26606e,_0xa0fd('0x10a'));delete _0x44a3a3[_0xa0fd('0x15')][_0x943155];_0x436bda(ut[_0xa0fd('0x47')]('Contact\x20in\x20black\x20List',_0x827eed,_0xff8796));}});};Preview[_0xa0fd('0x61')][_0xa0fd('0x92')]=function(_0x54c8cb){return!_[_0xa0fd('0x6a')](_0x54c8cb)&&!_['isNil'](_0x54c8cb[_0xa0fd('0x29')])&&!_[_0xa0fd('0x6a')](_0x54c8cb[_0xa0fd('0x10b')])&&_0x54c8cb[_0xa0fd('0x10b')]&&!_['isNil'](this[_0xa0fd('0x14')][util[_0xa0fd('0x52')](_0xa0fd('0x10c'),_0x54c8cb[_0xa0fd('0x29')])])&&!_['isNil'](this['trunks'][util[_0xa0fd('0x52')]('SIP/%s',_0x54c8cb[_0xa0fd('0x29')])][_0xa0fd('0x10d')])&&(this[_0xa0fd('0x14')][util[_0xa0fd('0x52')](_0xa0fd('0x10c'),_0x54c8cb[_0xa0fd('0x29')])][_0xa0fd('0x10d')]==='reachable'||this[_0xa0fd('0x14')][util[_0xa0fd('0x52')](_0xa0fd('0x10c'),_0x54c8cb[_0xa0fd('0x29')])]['status']===_0xa0fd('0x10e'));};Preview[_0xa0fd('0x61')][_0xa0fd('0x10f')]=function(_0x3d9464,_0x16b293){var _0x2e9948=this;return new BPromise(function(_0x257635,_0x39c4c4){_0x2e9948['execRun'](_0x3d9464,_0x16b293)[_0xa0fd('0x7d')](function(_0x8f35e4){_0x257635(_[_0xa0fd('0x70')](_0x8f35e4,[_0xa0fd('0x47')]));})[_0xa0fd('0x74')](function(_0x53c25c){if(_0x53c25c[_0xa0fd('0x110')]){rpcDb[_0xa0fd('0x111')](_0x3d9464);}if(_0x53c25c[_0xa0fd('0x10b')]){rpcDb['disableContact'](_0x3d9464);}_0x39c4c4(_['pick'](_0x53c25c,['message']));});});};Preview[_0xa0fd('0x61')][_0xa0fd('0x112')]=function(_0x1d90ac,_0x5eb755){var _0x2bfe3f=this;return new BPromise(function(_0x4869e3,_0x4cc919){var _0x5d506d,_0x5e092b;rpcDb['getContactPreview'](_0x1d90ac)['then'](function(_0x4e4c2d){if(!_[_0xa0fd('0x6a')](_0x4e4c2d[0x0])){_0x5e092b=_0x4e4c2d[0x0][_0xa0fd('0x113')]?![]:!![];_0x5d506d=_0x4e4c2d[0x0][_0xa0fd('0x113')]?!![]:![];_0x5d506d=_0x5eb755?!![]:_0x5d506d;}var _0x4e5e6a=_0x2bfe3f[_0xa0fd('0x114')](_0x4e4c2d);if(_0x4e5e6a[_0xa0fd('0x115')]){rpcDb['checkIsBlackList'](_[_0xa0fd('0x70')](_0x4e4c2d[0x0],['VoiceQueueId',_0xa0fd('0x116')]))['then'](function(_0x44f067){_0x2bfe3f['checkInBlack'](_0x44f067,_0x4e4c2d[0x0],_0x5eb755,_0x5e092b,_0x5d506d)[_0xa0fd('0x7d')](function(_0x5ca26c){_0x4869e3(_0x5ca26c);})[_0xa0fd('0x74')](function(_0x195fe5){_0x4cc919(_0x195fe5);});})[_0xa0fd('0x74')](function(_0x3c4ffb){ut['logger'](_0xa0fd('0x117'),_0x3c4ffb);_0x4cc919(ut[_0xa0fd('0x47')](_0xa0fd('0x118'),_0x5e092b,_0x5d506d));});}else{_0x4cc919(ut[_0xa0fd('0x47')](_0x4e5e6a[_0xa0fd('0x47')],_0x5e092b,_0x5d506d));}})[_0xa0fd('0x74')](function(_0x3d6f78){ut['logger'](_0xa0fd('0x119'),_0x3d6f78);_0x4cc919(ut[_0xa0fd('0x47')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0xa0fd('0x61')][_0xa0fd('0x114')]=function(_0x34bb25){if(_[_0xa0fd('0x6a')](_0x34bb25)||_['isEmpty'](_0x34bb25)||!_[_0xa0fd('0x6a')](_0x34bb25[0x0][_0xa0fd('0x80')])&&_[_0xa0fd('0x6a')](_0x34bb25[0x0][_0xa0fd('0x80')][_0xa0fd('0x29')])){ut[_0xa0fd('0x5b')](_0xa0fd('0x11a'),_0x34bb25);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2b0a63=this['campaignsPreview'][_0x34bb25[0x0][_0xa0fd('0x6c')]['name']];_0x2b0a63['message']='ACTIVE';if(_[_0xa0fd('0x6a')](_0x2b0a63)){ut['logger'](_0xa0fd('0x11b'),_0x2b0a63);return{'isValid':![],'message':_0xa0fd('0x11c')};}if(!this[_0xa0fd('0x92')](_0x2b0a63[_0xa0fd('0x4e')])){ut[_0xa0fd('0x5b')](_0xa0fd('0x11d'),'campaign\x20Name:\x20'+_0x2b0a63['name']+_0xa0fd('0x11e'));if(!this[_0xa0fd('0x92')](_0x2b0a63[_0xa0fd('0x93')])){ut['logger'](_0xa0fd('0x11d'),_0x2b0a63['name']+_0xa0fd('0x11f'));return{'isValid':![],'message':_0xa0fd('0x120')};}}if(!ut[_0xa0fd('0x91')](_0x2b0a63[_0xa0fd('0x34')])){ut[_0xa0fd('0x5b')](_0xa0fd('0x121'),_0x2b0a63[_0xa0fd('0x29')]+_0xa0fd('0x122'));return{'isValid':![],'message':_0xa0fd('0x123')+_0x2b0a63[_0xa0fd('0x29')]+_0xa0fd('0x122')};}return{'isValid':!![],'message':_0xa0fd('0x124')};};Preview[_0xa0fd('0x61')]['execCall']=function(_0x5db0c4,_0x33d601,_0x1680ad,_0x164e9b){var _0x2765fb=this;return new BPromise(function(_0x1d2aa2,_0x19515b){var _0x4c4e40=_0x5db0c4[_0xa0fd('0xb3')];var _0x324deb=_0x2765fb['isTrunkReachable'](_0x33d601[_0xa0fd('0x4e')])?util[_0xa0fd('0x52')](_0xa0fd('0x125'),_0x33d601[_0xa0fd('0x4e')][_0xa0fd('0x29')],_[_0xa0fd('0x6a')](_0x33d601[_0xa0fd('0x35')])?'':_0x33d601[_0xa0fd('0x35')][_0xa0fd('0x126')]()||'',_0x33d601[_0xa0fd('0x127')]>0x0?_0x1680ad[_0xa0fd('0x116')][_0xa0fd('0x128')](_0x33d601[_0xa0fd('0x127')]):_0x1680ad[_0xa0fd('0x116')]):util[_0xa0fd('0x52')]('SIP/%s/%s%s',_['isNil'](_0x33d601[_0xa0fd('0x93')])?_0x33d601[_0xa0fd('0x4e')][_0xa0fd('0x29')]:_0x33d601[_0xa0fd('0x93')]['name'],_['isNil'](_0x33d601[_0xa0fd('0x35')])?'':_0x33d601[_0xa0fd('0x35')][_0xa0fd('0x126')]()||'',_0x33d601[_0xa0fd('0x127')]>0x0?_0x1680ad['phone'][_0xa0fd('0x128')](_0x33d601[_0xa0fd('0x127')]):_0x1680ad[_0xa0fd('0x116')]);var _0x23282d=_0x2765fb[_0xa0fd('0x92')](_0x33d601['Trunk'])?ut[_0xa0fd('0x129')](_0x33d601['Trunk'][_0xa0fd('0x4f')],_0x33d601['dialOriginateCallerIdName'],_0x33d601[_0xa0fd('0x12a')]>0x0?ut[_0xa0fd('0x12b')](_0x33d601[_0xa0fd('0x12c')],_0x33d601['dialRandomLastDigitCallerIdNumber']):_0x33d601[_0xa0fd('0x12c')]):ut[_0xa0fd('0x129')](_[_0xa0fd('0x6a')](_0x33d601[_0xa0fd('0x93')])?_0x33d601[_0xa0fd('0x4e')][_0xa0fd('0x4f')]:_0x33d601[_0xa0fd('0x93')][_0xa0fd('0x4f')],_0x33d601['dialOriginateCallerIdName'],_0x33d601[_0xa0fd('0x12a')]>0x0?ut[_0xa0fd('0x12b')](_0x33d601['dialOriginateCallerIdNumber'],_0x33d601[_0xa0fd('0x12a')]):_0x33d601[_0xa0fd('0x12c')]);if(_0x23282d){_0x5db0c4[_0xa0fd('0x12d')]=ut[_0xa0fd('0x12e')](_0x23282d);_0x5db0c4[_0xa0fd('0x12f')]=ut[_0xa0fd('0x130')](_0x23282d);}var _0x383e51=ut[_0xa0fd('0x131')](_0x33d601,_0x1680ad,_0x324deb,_0x23282d,_0x4c4e40,_0x5db0c4);_[_0xa0fd('0x132')](_0x5db0c4,ut[_0xa0fd('0x133')](_0x383e51));_0x5db0c4['starttime']=moment()[_0xa0fd('0x52')](_0xa0fd('0x86'));ami[_0xa0fd('0x134')](ut[_0xa0fd('0x135')](_0x5db0c4,_0x33d601,_0x383e51,_0x5db0c4[_0xa0fd('0xa9')],_0x164e9b))[_0xa0fd('0x7d')](function(_0x56ec24){_0x33d601[_0xa0fd('0x48')]+=0x1;logger[_0xa0fd('0x54')]('[originated][increment]',_0x4c4e40,_0xa0fd('0xc1'),_0x33d601['name'],_0xa0fd('0x6e'),_0x33d601[_0xa0fd('0x48')]);_0x1d2aa2(_0x56ec24);})[_0xa0fd('0x74')](function(_0x1f0013){ut[_0xa0fd('0xf2')](_0x5db0c4,0xe,_0xa0fd('0x136'));rpcDb[_0xa0fd('0xf6')](_0x5db0c4,_0xa0fd('0x137'));_0x19515b(_0x1f0013);});});};Preview[_0xa0fd('0x61')][_0xa0fd('0x20')]=function(_0x31d06){if(this[_0xa0fd('0x15')][_0x31d06[_0xa0fd('0xaa')]]){this[_0xa0fd('0x15')][_0x31d06['linkedid']]['channel']=_0x31d06[_0xa0fd('0x73')];}};Preview[_0xa0fd('0x61')][_0xa0fd('0x19')]=function(_0x4fbc59){var _0x1659f8=this;var _0x4223f4=this['actions'][_0x4fbc59[_0xa0fd('0x138')]];if(_0x4223f4){if(_0x4223f4['lookAgent']&&this[_0xa0fd('0x16')][_0x4223f4[_0xa0fd('0x101')]]){ut[_0xa0fd('0x139')](_0x4223f4,this[_0xa0fd('0x16')][_0x4223f4[_0xa0fd('0x101')]][_0xa0fd('0x29')],this[_0xa0fd('0x16')][_0x4223f4[_0xa0fd('0x101')]]['id']);}var _0x2c0e6d=_['clone'](_0x4223f4);_0x2c0e6d['responsetime']=moment()['format'](_0xa0fd('0x86'));var _0x2d9f86=_0x1659f8[_0xa0fd('0x13')][_0x4223f4[_0xa0fd('0x6d')]];if(ut['isFailure'](_0x4fbc59['response'])){if(_0x4223f4['unlockAgent']){rpcDb[_0xa0fd('0x111')](_0x4223f4[_0xa0fd('0xac')]);}if(_0x4223f4[_0xa0fd('0xa9')]){rpcDb[_0xa0fd('0x84')](_0x4223f4[_0xa0fd('0xac')]);}ami['emit'](_0xa0fd('0x13a'),ut['buildObj'](_0x4223f4,_0xa0fd('0x13b'),this['campaignsPreview'][_0x4223f4[_0xa0fd('0x6d')]]));this[_0xa0fd('0xee')](_0x2c0e6d,_0x2d9f86,_0x4fbc59);}else{_0x4223f4[_0xa0fd('0x85')]=moment()['format'](_0xa0fd('0x86'));ut['logAgent'](_0x2c0e6d,0x4,_0xa0fd('0xbc'));rpcDb['createAgentHistory'](_0x2c0e6d,_0xa0fd('0x13c'));}}};Preview[_0xa0fd('0x61')]['syncHangup']=function(_0x162bc2){var _0xf20388=this;var _0x37cc78=this[_0xa0fd('0x15')][_0x162bc2[_0xa0fd('0xaa')]];var _0x1894a9;if(_0x37cc78){_0x1894a9=this[_0xa0fd('0x13')][_0x37cc78[_0xa0fd('0x6d')]];logger[_0xa0fd('0x54')](_0xa0fd('0x13d'),_0x162bc2[_0xa0fd('0xaa')],_0xa0fd('0xc1'),_0x1894a9['name'],'pTalking:\x20',_0x1894a9[_0xa0fd('0x2e')]);}if(this[_0xa0fd('0x15')][_0x162bc2['linkedid']]&&_0x162bc2[_0xa0fd('0xaa')]!==_0x162bc2[_0xa0fd('0xb3')]){if(_0x162bc2['cause']==='16'&&this[_0xa0fd('0x15')][_0x162bc2[_0xa0fd('0xaa')]][_0xa0fd('0x6f')]){this[_0xa0fd('0x96')](_0x162bc2,_0x162bc2[_0xa0fd('0xaa')],_0x162bc2[_0xa0fd('0x13e')]);}else if(this[_0xa0fd('0x15')][_0x162bc2[_0xa0fd('0xaa')]][_0xa0fd('0x6f')]){logger[_0xa0fd('0x54')](_0xa0fd('0x13f'),_0x162bc2[_0xa0fd('0xaa')],_0x162bc2[_0xa0fd('0x13e')],'\x20Queue',_0x1894a9[_0xa0fd('0x29')],_0xa0fd('0xb4'),_0x1894a9[_0xa0fd('0x2e')]);this[_0xa0fd('0x96')](_0x162bc2,_0x162bc2['linkedid'],_0x162bc2[_0xa0fd('0x13e')]);}}else if(_0x37cc78&&_[_0xa0fd('0x6a')](_0x37cc78[_0xa0fd('0x140')])&&_0x1894a9[_0xa0fd('0x141')]&&_0x162bc2['linkedid']===_0x162bc2['uniqueid']&&_[_0xa0fd('0x6a')](_0x162bc2[_0xa0fd('0xf1')])&&_0x162bc2['cause']==='16'&&_0x162bc2['channelstate']==='6'&&_[_0xa0fd('0xef')](_0x37cc78[_0xa0fd('0x142')])){if(_0x37cc78['unlockAgent']){rpcDb['unlockContact'](_0x37cc78[_0xa0fd('0xac')]);}if(_0x37cc78[_0xa0fd('0xa9')]){rpcDb[_0xa0fd('0x84')](_0x37cc78[_0xa0fd('0xac')]);}_0x162bc2[_0xa0fd('0xf1')]='22';this[_0xa0fd('0xee')](_0x37cc78,_0x1894a9,_0x162bc2);}else if(_0x37cc78&&_0x37cc78[_0xa0fd('0x142')]){if(_0x162bc2[_0xa0fd('0x13e')]==='16'&&this['actions'][_0x162bc2[_0xa0fd('0xaa')]][_0xa0fd('0x6f')]){logger[_0xa0fd('0x54')](_0xa0fd('0x143'),_0x162bc2[_0xa0fd('0xaa')],_0x162bc2[_0xa0fd('0x13e')],'\x20Queue',_0x1894a9[_0xa0fd('0x29')],_0xa0fd('0xb4'),_0x1894a9[_0xa0fd('0x2e')]);this[_0xa0fd('0x96')](_0x162bc2,_0x162bc2['linkedid'],_0x162bc2['cause']);}else if(this[_0xa0fd('0x15')][_0x162bc2[_0xa0fd('0xaa')]]['dialAnswer']){logger[_0xa0fd('0x54')](_0xa0fd('0x13f'),_0x162bc2[_0xa0fd('0xaa')],_0x162bc2[_0xa0fd('0x13e')],_0xa0fd('0xc1'),_0x1894a9[_0xa0fd('0x29')],_0xa0fd('0xb4'),_0x1894a9[_0xa0fd('0x2e')]);this[_0xa0fd('0x96')](_0x162bc2,_0x162bc2[_0xa0fd('0xaa')],_0x162bc2['cause']);}}};Preview['prototype'][_0xa0fd('0x1f')]=function(_0x471f8e){if(this[_0xa0fd('0x15')][_0x471f8e[_0xa0fd('0xed')]]&&_0x471f8e[_0xa0fd('0xed')]!==_0x471f8e['destuniqueid']){this['callProgressDetectingCustomer'](_0x471f8e,_0x471f8e[_0xa0fd('0xed')],_0x471f8e[_0xa0fd('0xe2')]);}};Preview['prototype'][_0xa0fd('0x1e')]=function(_0x97e17a){if(this['actions'][_0x97e17a['linkedid']]&&_0x97e17a[_0xa0fd('0xaa')]!==_0x97e17a[_0xa0fd('0xb3')]&&!this[_0xa0fd('0x15')][_0x97e17a[_0xa0fd('0xaa')]]['dialAnswer']){if(_0x97e17a[_0xa0fd('0x13e')]==='1'){this[_0xa0fd('0x96')](_0x97e17a,_0x97e17a[_0xa0fd('0xaa')],_0x97e17a[_0xa0fd('0x13e')]);}}};Preview[_0xa0fd('0x61')][_0xa0fd('0x144')]=function(_0x108811,_0x1b5223,_0x180281){if(this['actions'][_0x108811]){if(_[_0xa0fd('0x6a')](this[_0xa0fd('0x15')][_0x108811]['variables'])){this[_0xa0fd('0x15')][_0x108811]['variables']={};}this[_0xa0fd('0x15')][_0x108811][_0xa0fd('0x145')][_0x1b5223]=_0x180281;}};Preview['prototype'][_0xa0fd('0x146')]=function(_0x2e2e8a){try{if(!_[_0xa0fd('0x6a')](_0x2e2e8a)){if(ut[_0xa0fd('0x147')](_[_0xa0fd('0x148')](_0x2e2e8a['variable'])[0x0])){this['addVariable'](_0x2e2e8a[_0xa0fd('0xb3')],_[_0xa0fd('0x148')](_0x2e2e8a[_0xa0fd('0x149')])[0x0],_0x2e2e8a[_0xa0fd('0x14a')]);}}}catch(_0x44dde7){logger[_0xa0fd('0x14b')](_0xa0fd('0x14c'),util['inspect'](_0x44dde7,{'showHidden':![],'depth':null}));}};Preview[_0xa0fd('0x61')][_0xa0fd('0x14d')]=function(_0x22c11c){if(_0x22c11c){if(this[_0xa0fd('0x15')][_0x22c11c[_0xa0fd('0x14e')]]){this['actions'][_0x22c11c[_0xa0fd('0x14e')]][_0xa0fd('0x142')]=!![];}}};Preview[_0xa0fd('0x61')][_0xa0fd('0x24')]=function(_0x12a9f2){if(_0x12a9f2){if(this[_0xa0fd('0x15')][_0x12a9f2['transfererlinkedid']]){this[_0xa0fd('0x15')][_0x12a9f2['transfererlinkedid']]['transfer']=!![];}}};module[_0xa0fd('0x14f')]=Preview; \ No newline at end of file +var _0x207c=['dialBusyMaxRetry','rescheduleContact','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','incrementPreviewCounters','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][machine]','decrementTalkink','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','object','isUndefined','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','run','unlock','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','trim','dialCutDigit','substring','getCallerId','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdName','getCallerIdRandom','originatecalleridnum','toLowerVariables','Action','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','variables','filterKey','keys','variable','addVariable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','preview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','redis','defaults','socket.io-emitter','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','dialend','syncDialEnd','syncNewExten','varset','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','name','stringify','format','info','voice:queue:%s','voice_queue_presence:remove','sendMessageOneNotActive','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','outbound','dialActive','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','sequence','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','setMessage','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','verifyAdditionalPhones','additional','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','scheduledAt','countnosuchnumberretry','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','responsetime','answertime','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','Answer','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','[callProgressDetectingCustomer][logBusyGlobal]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x207c,0x1e8));var _0xc207=function(_0x48f2b7,_0x40f214){_0x48f2b7=_0x48f2b7-0x0;var _0x54506f=_0x207c[_0x48f2b7];return _0x54506f;};'use strict';var util=require('util');var _=require(_0xc207('0x0'));var BPromise=require(_0xc207('0x1'));var uuid=require(_0xc207('0x2'));var moment=require(_0xc207('0x3'));var md5=require(_0xc207('0x4'));var Redis=require(_0xc207('0x5'));var config=require(_0xc207('0x6'));var logger=require('../../../config/logger')(_0xc207('0x7'));var loggerAction=require('../../../config/logger')('actionPreview');var ami=require('../ami');var rpcDb=require(_0xc207('0x8'));var cmHopperAdditionalPhone=require(_0xc207('0x9'));var Action=require(_0xc207('0xa'));var ut=require('./util/util');config[_0xc207('0xb')]=_[_0xc207('0xc')](config[_0xc207('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xc207('0xd'))(new Redis(config[_0xc207('0xb')]));var Sequence=function(){};Sequence[_0xc207('0xe')][_0xc207('0xf')]=function(_0x201162){this[_0xc207('0x10')]=this['tail']?this['tail']['finally'](_0x201162):_0x201162();};function Preview(_0x19b297){this['sequence']=new Sequence();this[_0xc207('0x11')]=_0x19b297[_0xc207('0x12')];this['trunks']=_0x19b297[_0xc207('0x13')];this[_0xc207('0x14')]={};this[_0xc207('0x15')]=_0x19b297[_0xc207('0x15')];this[_0xc207('0x16')]=0x0;ami['on']('originateresponse',this[_0xc207('0x17')][_0xc207('0x18')](this));ami['on'](_0xc207('0x19'),this[_0xc207('0x1a')]['bind'](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0xc207('0x18')](this));ami['on'](_0xc207('0x1b'),this[_0xc207('0x1c')][_0xc207('0x18')](this));ami['on']('newexten',this[_0xc207('0x1d')][_0xc207('0x18')](this));ami['on'](_0xc207('0x1e'),this['syncVarSet'][_0xc207('0x18')](this));ami['on']('attendedtransfer',this[_0xc207('0x1f')][_0xc207('0x18')](this));ami['on'](_0xc207('0x20'),this[_0xc207('0x21')][_0xc207('0x18')](this));this[_0xc207('0x22')](this[_0xc207('0x11')]);}function emit(_0x464dea,_0x212005,_0x2bd2eb){io['to'](_0x464dea)[_0xc207('0x23')](_0x212005,_0x2bd2eb);}function emitCampaignPreview(_0xe227a){if(_0xe227a[_0xc207('0x24')]==='outbound'){var _0x163b36={'id':_0xe227a['id'],'name':_0xe227a['name'],'strategy':_0xe227a[_0xc207('0x25')],'answered':_0xe227a[_0xc207('0x26')],'available':_0xe227a[_0xc207('0x27')],'loggedIn':_0xe227a[_0xc207('0x28')],'pTalking':_0xe227a[_0xc207('0x29')],'sumBillable':_0xe227a[_0xc207('0x2a')],'sumDuration':_0xe227a[_0xc207('0x2b')],'sumHoldTime':_0xe227a[_0xc207('0x2c')]||0x0,'talking':_0xe227a[_0xc207('0x2d')],'total':_0xe227a[_0xc207('0x2e')],'type':_0xe227a[_0xc207('0x24')],'unmanaged':_0xe227a[_0xc207('0x2f')],'abandoned':_0xe227a[_0xc207('0x30')],'waiting':_0xe227a[_0xc207('0x31')],'loggedInDb':_0xe227a[_0xc207('0x32')],'dialActive':_0xe227a['dialActive'],'dialMethod':_0xe227a[_0xc207('0x33')],'dialOriginateCallerIdName':_0xe227a['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0xe227a['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0xe227a[_0xc207('0x34')],'dialPrefix':_0xe227a[_0xc207('0x35')],'outboundAnswerAgiCallsDay':_0xe227a[_0xc207('0x36')],'outboundAnswerCallsDay':_0xe227a[_0xc207('0x37')],'outboundBlacklistCallsDay':_0xe227a[_0xc207('0x38')],'outboundBusyCallsDay':_0xe227a['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0xe227a[_0xc207('0x39')],'outboundDropCallsDayACS':_0xe227a[_0xc207('0x3a')],'outboundDropCallsDayCallersExit':_0xe227a[_0xc207('0x3b')],'outboundDropCallsDayTimeout':_0xe227a[_0xc207('0x3c')],'outboundNoAnswerCallsDay':_0xe227a[_0xc207('0x3d')],'outboundNoSuchCallsDay':_0xe227a[_0xc207('0x3e')],'outboundOriginateFailureCallsDay':_0xe227a[_0xc207('0x3f')],'outboundReCallsDay':_0xe227a[_0xc207('0x40')],'outboundRejectCallsDay':_0xe227a[_0xc207('0x41')],'outboundUnknownCallsDay':_0xe227a[_0xc207('0x42')],'outboundAbandonedCallsDay':_0xe227a[_0xc207('0x43')],'predictiveIntervalAnsweredCalls':_0xe227a[_0xc207('0x44')],'predictiveIntervalAvgHoldtime':_0xe227a[_0xc207('0x45')],'predictiveIntervalAvgTalktime':_0xe227a['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0xe227a[_0xc207('0x46')],'predictiveIntervalDroppedCallsTimeout':_0xe227a[_0xc207('0x47')],'predictiveIntervalErlangCalls':_0xe227a[_0xc207('0x48')],'predictiveIntervalErlangCallsDroppedCalls':_0xe227a[_0xc207('0x49')],'predictiveIntervalHitRate':_0xe227a[_0xc207('0x4a')],'predictiveIntervalMultiplicativeFactor':_0xe227a[_0xc207('0x4b')],'predictiveIntervalPauses':_0xe227a['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0xe227a[_0xc207('0x4c')],'predictiveIntervalTotalCalls':_0xe227a[_0xc207('0x4d')],'message':_0xe227a[_0xc207('0x4e')],'originated':_0xe227a[_0xc207('0x4f')],'erlangCalls':_0xe227a['erlangCalls'],'erlangCallToSecond':_0xe227a[_0xc207('0x50')],'erlangAbandonmentRate':_0xe227a[_0xc207('0x51')],'erlangBusyFactor':_0xe227a[_0xc207('0x52')],'startPredictive':_0xe227a[_0xc207('0x53')],'startProgressive':_0xe227a[_0xc207('0x54')]};if(_0xe227a[_0xc207('0x55')]){_0x163b36[_0xc207('0x55')]={'id':_0xe227a[_0xc207('0x55')]['id'],'name':_0xe227a[_0xc207('0x55')]['name'],'active':_0xe227a['Trunk'][_0xc207('0x56')],'callerid':_0xe227a[_0xc207('0x55')][_0xc207('0x57')]};}if(_0xe227a[_0xc207('0x58')]){_0x163b36['Interval']={'id':_0xe227a[_0xc207('0x58')]['id'],'name':_0xe227a[_0xc207('0x58')][_0xc207('0x59')]};}var _0x2a1c60=md5(JSON[_0xc207('0x5a')](_0x163b36));if(_0xe227a['md5']!==_0x2a1c60){_0xe227a[_0xc207('0x4')]=_0x2a1c60;emit(util[_0xc207('0x5b')]('voice:queue:%s',_0x163b36[_0xc207('0x59')]),'voice_queue:save',_0x163b36);}}}function emitVoiceQueueChannelRemove(_0x297c84){logger[_0xc207('0x5c')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0xc207('0x5a')](_0x297c84));emit(util[_0xc207('0x5b')](_0xc207('0x5d'),_0x297c84['name']),'voice_queue_channel:remove',_0x297c84);io[_0xc207('0x23')](_0xc207('0x5e'),_0x297c84);}function notSendMessagesQueue(_0x41d66c){if(_0x41d66c[_0xc207('0x5f')]){if(_0x41d66c['originated']===0x0&&_0x41d66c[_0xc207('0x29')]===0x0){_0x41d66c['sendMessageOneNotActive']=![];_0x41d66c['available']=0x0;_0x41d66c['paused']=0x0;_0x41d66c['message']=_0xc207('0x60');ut[_0xc207('0x61')](_0xc207('0x62'),_0x41d66c['name']+_0xc207('0x63'));}else{_0x41d66c[_0xc207('0x4e')]=_0xc207('0x64');ut[_0xc207('0x61')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x41d66c[_0xc207('0x59')]+_0xc207('0x65'));}emitCampaignPreview(_0x41d66c);}}Preview[_0xc207('0xe')][_0xc207('0x22')]=function(){var _0x2d6d8b=this;setInterval(function(){_0x2d6d8b['syncCampaigns']();},0x7cf);};Preview[_0xc207('0xe')][_0xc207('0x66')]=function(){var _0x3a935a=this[_0xc207('0x11')];this[_0xc207('0x16')]+=0x1;for(var _0x477c22 in _0x3a935a){if(_0x3a935a[_0xc207('0x67')](_0x477c22)&&(_0x3a935a[_0x477c22][_0xc207('0x33')]===_0xc207('0x7')||_0x3a935a[_0x477c22]['dialMethod']===_0xc207('0x68'))&&_0x3a935a[_0x477c22][_0xc207('0x24')]==='outbound'){if(this[_0xc207('0x16')]>0x7){this[_0xc207('0x16')]=0x0;this[_0xc207('0x69')]();}}if(_0x3a935a[_0xc207('0x67')](_0x477c22)&&_0x3a935a[_0x477c22][_0xc207('0x33')]==='preview'&&_0x3a935a[_0x477c22][_0xc207('0x24')]===_0xc207('0x6a')){if(_0x3a935a[_0x477c22][_0xc207('0x6b')]){this['setMessage'](_0x3a935a[_0x477c22]);if(_0x3a935a[_0x477c22][_0xc207('0x6c')])this[_0xc207('0x6d')](_0x3a935a[_0x477c22]);}else{notSendMessagesQueue(_0x3a935a[_0x477c22]);}}}};Preview[_0xc207('0xe')][_0xc207('0x6e')]=function(_0x593326){var _0x4ebccf=this;this[_0xc207('0x6f')][_0xc207('0xf')](function(){if(!_[_0xc207('0x70')](_0x4ebccf[_0xc207('0x14')][_0x593326])){loggerAction[_0xc207('0x5c')](_0xc207('0x71'),_0x593326,_0xc207('0x72'),_0x4ebccf[_0xc207('0x14')][_0x593326][_0xc207('0x73')],_0xc207('0x74'),JSON[_0xc207('0x5a')](_0x4ebccf[_0xc207('0x11')][_0x4ebccf['actions'][_0x593326]['queue']][_0xc207('0x4f')]),_0xc207('0x75'),JSON[_0xc207('0x5a')](_0x4ebccf['campaignsPreview'][_0x4ebccf[_0xc207('0x14')][_0x593326][_0xc207('0x73')]][_0xc207('0x29')]),JSON[_0xc207('0x5a')](_0x4ebccf['actions'][_0x593326][_0xc207('0x76')]),JSON['stringify'](_[_0xc207('0x77')](_0x4ebccf['actions'][_0x593326],['contactId',_0xc207('0x78'),_0xc207('0x79'),'ListId'])));return ami['Action']({'action':'status','channel':_0x4ebccf[_0xc207('0x14')][_0x593326][_0xc207('0x7a')]})[_0xc207('0x7b')](function(_0x1acc33){if(_0x1acc33[_0xc207('0x4e')]===_0xc207('0x7c')){setTimeout(function(){if(_0x4ebccf[_0xc207('0x14')][_0x593326]){ut[_0xc207('0x7d')](_0x4ebccf['campaignsPreview'][_0x4ebccf[_0xc207('0x14')][_0x593326][_0xc207('0x73')]],'[clearZombieChannel]');if(_0x4ebccf['actions'][_0x593326][_0xc207('0x76')]===!![]){ut['decrementTalkink'](_0x4ebccf['campaignsPreview'][_0x4ebccf[_0xc207('0x14')][_0x593326][_0xc207('0x73')]],_0xc207('0x7e'));ut[_0xc207('0x7f')](_0xc207('0x80')+_0x593326,_0x4ebccf[_0xc207('0x14')][_0x593326][_0xc207('0x73')]);}ut[_0xc207('0x7f')](_0xc207('0x81')+_0x593326,_0x4ebccf[_0xc207('0x14')][_0x593326][_0xc207('0x73')]);delete _0x4ebccf['actions'][_0x593326];}},0x2328);}});}});};Preview['prototype'][_0xc207('0x69')]=function(){var _0x246f5b=this;loggerAction[_0xc207('0x5c')](_0xc207('0x82'),_[_0xc207('0x83')](this[_0xc207('0x14')]));for(var _0x1fc073 in this[_0xc207('0x14')]){if(_0x246f5b[_0xc207('0x14')]['hasOwnProperty'](_0x1fc073)){_0x246f5b[_0xc207('0x6e')](_0x1fc073);}}};Preview[_0xc207('0xe')][_0xc207('0x6d')]=function(_0x6d387e){var _0x569c85=this;rpcDb[_0xc207('0x84')](_0x6d387e['id'],ut[_0xc207('0x85')](this[_0xc207('0x15')]))[_0xc207('0x86')](function(_0x464263){if(!_[_0xc207('0x70')](_0x464263)){for(var _0x3eb832=0x0;_0x3eb832<_0x464263['length'];_0x3eb832+=0x1){if(ut[_0xc207('0x87')](_0x464263[_0x3eb832][_0xc207('0x88')])<_0x6d387e[_0xc207('0x89')]*0x3c){if(_0x464263[_0x3eb832][_0xc207('0x8a')]&&!_0x464263[_0x3eb832]['Agent'][_0xc207('0x8b')]){_0x569c85['run'](_0x464263[_0x3eb832]['id'])['then'](ut[_0xc207('0x8c')](_0xc207('0x8d')))[_0xc207('0x7b')](ut[_0xc207('0x8c')](_0xc207('0x8d')));}else{rpcDb[_0xc207('0x8e')](_0x464263[_0x3eb832]['id']);}}else{var _0x35a0d8=new Action(_0x464263[_0x3eb832],_0x6d387e);_0x35a0d8[_0xc207('0x8f')]=moment()[_0xc207('0x5b')](_0xc207('0x90'));_0x6d387e[_0xc207('0x40')]+=0x1;ut[_0xc207('0x91')](_0x35a0d8,0x17,_0xc207('0x92'));if(_0x6d387e[_0xc207('0x93')]){rpcDb[_0xc207('0x94')](ut['createBody'](_0x464263[_0x3eb832]));rpcDb[_0xc207('0x95')](_0x35a0d8,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xc207('0x91')](_0x35a0d8,0x16,_0xc207('0x96'));rpcDb[_0xc207('0x95')](_0x35a0d8,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x35a0d8,_0xc207('0x97'));}}}}})[_0xc207('0x7b')](ut[_0xc207('0x8c')]('[getContactRecallMe]'));};Preview[_0xc207('0xe')][_0xc207('0x98')]=function(_0x3509d8){_0x3509d8['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x3509d8[_0xc207('0x28')])){_0x3509d8['message']=_0xc207('0x99');}else if(!ut[_0xc207('0x9a')](_0x3509d8[_0xc207('0x6b')])){_0x3509d8[_0xc207('0x4e')]=_0xc207('0x60');}else if(!this[_0xc207('0x9b')](_0x3509d8[_0xc207('0x55')])){if(!this[_0xc207('0x9b')](_0x3509d8['TrunkBackup'])){_0x3509d8[_0xc207('0x4e')]=_0xc207('0x9c');}else{_0x3509d8[_0xc207('0x4e')]=_0xc207('0x9d');}}else{_0x3509d8[_0xc207('0x4e')]=_0xc207('0x9d');}emitCampaignPreview(_0x3509d8);};Preview[_0xc207('0xe')][_0xc207('0x9e')]=function(_0x28a45d,_0x28f467,_0x203686){var _0x53a210=this;var _0x20e130=this[_0xc207('0x14')][_0x28f467];var _0x45b4fb=this[_0xc207('0x11')][_0x20e130['queue']];var _0x586c41;var _0x416a72=![];var _0x375518=0x2;var _0x34f784=0x3;if(_0x45b4fb){switch(_0x203686){case'1':_0x45b4fb[_0xc207('0x3e')]+=0x1;_0x20e130['countnosuchnumberretry']+=0x1;_0x20e130[_0xc207('0x9f')]=ut[_0xc207('0xa0')](_0x20e130);ut[_0xc207('0x91')](_0x20e130,0x0,'NoSuchNumber');ami[_0xc207('0x23')](_0xc207('0xa1'),ut[_0xc207('0xa2')](_0x20e130,'nosuchnumber'));rpcDb[_0xc207('0x95')](_0x20e130,'[callProgressDetectingCustomer][logNoSuch]');_0x53a210[_0xc207('0xa3')](_0x20e130,'0',_0x45b4fb)['then'](function(_0xf68aae){_0x416a72=_0xf68aae[_0xc207('0xa4')]==0x1;_0x375518=_0x45b4fb['dialNoSuchNumberRetryFrequency'];_0x34f784=_0x45b4fb[_0xc207('0xa5')];if(!_0x416a72){if(ut['totalGlobal'](_0x20e130)>=_0x45b4fb[_0xc207('0xa6')]){_0x586c41=ut[_0xc207('0xa7')](_0x20e130,0xf,_0xc207('0xa8'));rpcDb[_0xc207('0xa9')](_0x586c41,_0xc207('0xaa'));}else{if(_0x20e130['countnosuchnumberretry']>=_0x45b4fb['dialNoSuchNumberMaxRetry']){rpcDb[_0xc207('0xa9')](_0x20e130,_0xc207('0xaa'));}else{rpcDb['rescheduleContact'](ut[_0xc207('0xab')](_0x20e130,_0xc207('0xac'),_0x45b4fb['dialNoSuchNumberRetryFrequency']),_0x20e130[_0xc207('0xad')],_0x20e130[_0xc207('0xae')]);}}delete this['actions'][_0x28a45d[_0xc207('0xaf')]];}else{_0x20e130[_0xc207('0xac')]++;logger[_0xc207('0x5c')](_0xc207('0xb0'),_0x20e130[_0xc207('0xac')]);logger[_0xc207('0x5c')]('id',_0x20e130['idContact']);_0x53a210['incrementPreviewCounters']({'id':_0x20e130[_0xc207('0xb1')],'field':{'countnosuchnumberretry':_0x20e130[_0xc207('0xac')]}})[_0xc207('0x86')](function(){_0x53a210[_0xc207('0xb2')](_0x20e130,_0x375518,_0x34f784)[_0xc207('0x86')](function(){});});}});break;case'ANSWER':var _0x32e092=moment()['format'](_0xc207('0x90'));_0x20e130[_0xc207('0xb3')]=_0x32e092;_0x20e130[_0xc207('0xb4')]=_0x32e092;_0x20e130[_0xc207('0x76')]=!![];_0x45b4fb[_0xc207('0x29')]+=0x1;logger[_0xc207('0x5c')]('[syncHangup][talking][increment]',_0x20e130[_0xc207('0xb5')],_0xc207('0xb6'),_0x45b4fb['name'],_0xc207('0x75'),_0x45b4fb[_0xc207('0x29')]);ami[_0xc207('0x23')](_0xc207('0xb7'),ut[_0xc207('0xa2')](_0x20e130,_0xc207('0xb8'),this[_0xc207('0x11')][_0x20e130[_0xc207('0x73')]]));if(_0x45b4fb[_0xc207('0xb9')]){ami[_0xc207('0x23')](_0xc207('0xba'),ut[_0xc207('0xbb')](_0x20e130));}break;case'16':ami[_0xc207('0x23')]('custom:agentcomplete',ut[_0xc207('0xa2')](_0x20e130,_0xc207('0xbc'),this[_0xc207('0x11')][_0x20e130[_0xc207('0x73')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x20e130,_0xc207('0xbc')));_0x45b4fb['outboundAnswerCallsDay']+=0x1;_0x45b4fb[_0xc207('0x2e')]+=0x1;_0x45b4fb['answered']+=0x1;ut['decrementTalkink'](_0x45b4fb,_0xc207('0xbd'));_0x20e130[_0xc207('0x9f')]=ut[_0xc207('0xa0')](_0x20e130);ut[_0xc207('0x91')](_0x20e130,0x4,_0xc207('0xbe'));rpcDb[_0xc207('0x95')](_0x20e130,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xc207('0xa9')](_0x20e130,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xc207('0xbf')](_0x20e130);_0x45b4fb[_0xc207('0x2b')]+=_0x20e130[_0xc207('0xc0')];_0x45b4fb[_0xc207('0x2a')]+=_0x20e130['talktime'];logger[_0xc207('0x5c')](_0xc207('0xc1'),_0x20e130['uniqueid'],_0xc207('0xb6'),_0x45b4fb[_0xc207('0x59')],_0xc207('0x75'),_0x45b4fb[_0xc207('0x29')]);delete this['actions'][_0x28a45d[_0xc207('0xaf')]];break;case _0xc207('0xc2'):_0x45b4fb[_0xc207('0xc3')]+=0x1;_0x20e130[_0xc207('0xc4')]+=0x1;_0x20e130['countglobal']=ut['totalGlobal'](_0x20e130);ut['logCustomer'](_0x20e130,0x5,'Busy');_0x375518=_0x45b4fb[_0xc207('0xc5')];_0x34f784=_0x45b4fb[_0xc207('0xa5')];ami[_0xc207('0x23')](_0xc207('0xc6'),ut['buildObj'](_0x20e130,'busy'));rpcDb[_0xc207('0x95')](_0x20e130,'[callProgressDetectingCustomer][logBusy]');_0x53a210['verifyAdditionalPhones'](_0x20e130,'5',_0x45b4fb)[_0xc207('0x86')](function(_0x4167bc){_0x416a72=_0x4167bc[_0xc207('0xa4')]==0x1;if(!_0x416a72){if(ut[_0xc207('0xa0')](_0x20e130)>=_0x45b4fb[_0xc207('0xa6')]){_0x586c41=ut['cloneAction'](_0x20e130,0xf,_0xc207('0xa8'));rpcDb['createCustomerFinal'](_0x586c41,_0xc207('0xc7'));}else{if(_0x20e130[_0xc207('0xc4')]>=_0x45b4fb[_0xc207('0xc8')]){rpcDb['createCustomerFinal'](_0x20e130,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xc207('0xc9')](ut[_0xc207('0xab')](_0x20e130,_0xc207('0xc4'),_0x45b4fb[_0xc207('0xc5')]),_0x20e130['unlockAgent'],_0x20e130['activeContact']);}}}else{_0x20e130[_0xc207('0xc4')]++;_0x53a210['incrementPreviewCounters']({'id':_0x20e130[_0xc207('0xb1')],'field':{'countbusyretry':_0x20e130[_0xc207('0xc4')]}})[_0xc207('0x86')](function(){_0x53a210[_0xc207('0xb2')](_0x20e130,_0x375518,_0x34f784)[_0xc207('0x86')](function(){});});}});break;case'NOANSWER':_0x45b4fb[_0xc207('0x3d')]+=0x1;_0x20e130[_0xc207('0xca')]+=0x1;_0x20e130[_0xc207('0x9f')]=ut[_0xc207('0xa0')](_0x20e130);ut[_0xc207('0x91')](_0x20e130,0x3,_0xc207('0xcb'));_0x375518=_0x45b4fb[_0xc207('0xcc')];_0x34f784=_0x45b4fb[_0xc207('0xa5')];ami[_0xc207('0x23')](_0xc207('0xcd'),ut['buildObj'](_0x20e130,_0xc207('0xce')));rpcDb['createCustomerHistory'](_0x20e130,'[callProgressDetectingCustomer][logNoAnswer]');_0x53a210[_0xc207('0xa3')](_0x20e130,'3',_0x45b4fb)[_0xc207('0x86')](function(_0x5df85d){_0x416a72=_0x5df85d['additional']==0x1;if(!_0x416a72){if(ut[_0xc207('0xa0')](_0x20e130)>=_0x45b4fb[_0xc207('0xa6')]){_0x586c41=ut[_0xc207('0xa7')](_0x20e130,0xf,_0xc207('0xa8'));rpcDb['createCustomerFinal'](_0x586c41,_0xc207('0xcf'));}else{if(_0x20e130['countnoanswerretry']>=_0x45b4fb[_0xc207('0xd0')]){rpcDb[_0xc207('0xa9')](_0x20e130,_0xc207('0xd1'));}else{rpcDb[_0xc207('0xc9')](ut[_0xc207('0xab')](_0x20e130,_0xc207('0xca'),_0x45b4fb['dialNoAnswerRetryFrequency']),_0x20e130[_0xc207('0xad')],_0x20e130[_0xc207('0xae')]);}}}else{_0x20e130['countnoanswerretry']++;_0x53a210['incrementPreviewCounters']({'id':_0x20e130['idContact'],'field':{'countnoanswerretry':_0x20e130['countnoanswerretry']}})['then'](function(){_0x53a210[_0xc207('0xb2')](_0x20e130,_0x375518,_0x34f784)[_0xc207('0x86')](function(){});});}});break;case _0xc207('0xd2'):_0x45b4fb['outboundCongestionCallsDay']+=0x1;_0x20e130[_0xc207('0xd3')]+=0x1;_0x20e130['countglobal']=ut[_0xc207('0xa0')](_0x20e130);ut[_0xc207('0x91')](_0x20e130,0x8,_0xc207('0xd4'));_0x375518=_0x45b4fb['dialCongestionRetryFrequency'];_0x34f784=_0x45b4fb[_0xc207('0xa5')];ami[_0xc207('0x23')]('custom:agentcongestion',ut[_0xc207('0xa2')](_0x20e130,'congestion'));rpcDb[_0xc207('0x95')](_0x20e130,'[callProgressDetectingCustomer][logCongestion]');_0x53a210[_0xc207('0xa3')](_0x20e130,'8',_0x45b4fb)['then'](function(_0x24efae){_0x416a72=_0x24efae[_0xc207('0xa4')]==0x1;if(!_0x416a72){if(ut[_0xc207('0xa0')](_0x20e130)>=_0x45b4fb[_0xc207('0xa6')]){_0x586c41=ut[_0xc207('0xa7')](_0x20e130,0xf,_0xc207('0xa8'));rpcDb['createCustomerFinal'](_0x586c41,_0xc207('0xd5'));}else{if(_0x20e130[_0xc207('0xd3')]>=_0x45b4fb[_0xc207('0xd6')]){rpcDb[_0xc207('0xa9')](_0x20e130,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xc207('0xc9')](ut[_0xc207('0xab')](_0x20e130,'countcongestionretry',_0x45b4fb[_0xc207('0xc5')]),_0x20e130[_0xc207('0xad')],_0x20e130[_0xc207('0xae')]);}}}else{_0x20e130[_0xc207('0xd3')]++;_0x53a210['incrementPreviewCounters']({'id':_0x20e130[_0xc207('0xb1')],'field':{'countcongestionretry':_0x20e130[_0xc207('0xd3')]}})[_0xc207('0x86')](function(){_0x53a210[_0xc207('0xb2')](_0x20e130,_0x375518,_0x34f784)['then'](function(){});});}});break;case _0xc207('0xd7'):_0x45b4fb['outboundRejectCallsDay']+=0x1;_0x20e130[_0xc207('0xd8')]+=0x1;_0x20e130[_0xc207('0x9f')]=ut[_0xc207('0xa0')](_0x20e130);ut['logCustomer'](_0x20e130,0x14,_0xc207('0xd9'));_0x375518=_0x45b4fb[_0xc207('0xda')];_0x34f784=_0x45b4fb[_0xc207('0xa5')];ami[_0xc207('0x23')](_0xc207('0xdb'),ut[_0xc207('0xa2')](_0x20e130,_0xc207('0xdc')));rpcDb[_0xc207('0x95')](_0x20e130,'[syncHangupRequest][logAgentReject]');_0x53a210[_0xc207('0xa3')](_0x20e130,'20',_0x45b4fb)[_0xc207('0x86')](function(_0x5022f5){_0x416a72=_0x5022f5[_0xc207('0xa4')]==0x1;if(!_0x416a72){if(ut[_0xc207('0xa0')](_0x20e130)>=_0x45b4fb[_0xc207('0xa6')]){_0x586c41=ut[_0xc207('0xa7')](_0x20e130,0x14,_0xc207('0xd9'));rpcDb[_0xc207('0xa9')](_0x586c41,_0xc207('0xdd'));}else{if(_0x20e130['countagentrejectretry']>=_0x45b4fb[_0xc207('0xde')]){rpcDb[_0xc207('0xa9')](_0x20e130,_0xc207('0xdd'));}else{rpcDb[_0xc207('0xc9')](ut[_0xc207('0xab')](_0x20e130,_0xc207('0xd8'),_0x45b4fb[_0xc207('0xda')]),_0x20e130[_0xc207('0xad')],_0x20e130[_0xc207('0xae')]);}}}else{_0x20e130[_0xc207('0xca')]++;_0x53a210[_0xc207('0xdf')]({'id':_0x20e130[_0xc207('0xb1')],'field':{'countnoanswerretry':_0x20e130[_0xc207('0xca')]}})['then'](function(){_0x53a210[_0xc207('0xb2')](_0x20e130,_0x375518,_0x34f784)['then'](function(){});});}});break;case'ABANDONED':_0x45b4fb[_0xc207('0x43')]+=0x1;_0x20e130[_0xc207('0xe0')]+=0x1;_0x20e130['countglobal']=ut[_0xc207('0xa0')](_0x20e130);ut[_0xc207('0x91')](_0x20e130,0xb,'Abandoned');rpcDb[_0xc207('0x95')](_0x20e130,_0xc207('0xe1'));_0x53a210['verifyAdditionalPhones'](_0x20e130,'11',_0x45b4fb)['then'](function(_0x3fa014){_0x416a72=_0x3fa014[_0xc207('0xa4')]==0x1;if(!_0x416a72){if(ut[_0xc207('0xa0')](_0x20e130)>=_0x45b4fb[_0xc207('0xa6')]){_0x586c41=ut[_0xc207('0xa7')](_0x20e130,0xf,_0xc207('0xa8'));rpcDb[_0xc207('0xa9')](_0x586c41,_0xc207('0xe1'));}else{if(_0x20e130['countabandonedetry']>=_0x45b4fb[_0xc207('0xe2')]){rpcDb[_0xc207('0xa9')](_0x20e130,_0xc207('0xe1'));}else{rpcDb[_0xc207('0xc9')](ut[_0xc207('0xab')](_0x20e130,_0xc207('0xe0'),_0x45b4fb[_0xc207('0xe3')]),_0x20e130[_0xc207('0xad')],_0x20e130[_0xc207('0xae')]);}}}else{_0x20e130['countnoanswerretry']++;_0x53a210[_0xc207('0xdf')]({'id':_0x20e130['idContact'],'field':{'countnoanswerretry':_0x20e130['countnoanswerretry']}})[_0xc207('0x86')](function(){_0x53a210[_0xc207('0xb2')](_0x20e130,_0x375518,_0x34f784)[_0xc207('0x86')](function(){});});}});break;case'18':_0x45b4fb[_0xc207('0x42')]+=0x1;_0x20e130[_0xc207('0xe4')]+=0x1;_0x20e130['countglobal']=ut[_0xc207('0xa0')](_0x20e130);ut[_0xc207('0x91')](_0x20e130,0x12,_0x28a45d['cause-txt']||_0x28a45d['dialstatus']);ami[_0xc207('0x23')]('custom:amd',ut[_0xc207('0xa2')](_0x20e130,_0xc207('0xe5')));rpcDb[_0xc207('0x95')](_0x20e130,'[callProgressDetectingCustomer][hangupInAMD]');_0x53a210[_0xc207('0xa3')](_0x20e130,'18',_0x45b4fb)[_0xc207('0x86')](function(_0x28900f){_0x416a72=_0x28900f[_0xc207('0xa4')]==0x1;if(!_0x416a72){if(ut['totalGlobal'](_0x20e130)>=_0x45b4fb[_0xc207('0xa6')]){_0x586c41=ut[_0xc207('0xa7')](_0x20e130,0x12,'Global');rpcDb[_0xc207('0xa9')](_0x586c41,_0xc207('0xe6'));}else{rpcDb['createCustomerFinal'](_0x20e130,_0xc207('0xe6'));}}else{_0x20e130[_0xc207('0xca')]++;_0x53a210[_0xc207('0xdf')]({'id':_0x20e130[_0xc207('0xb1')],'field':{'countnoanswerretry':_0x20e130[_0xc207('0xca')]}})[_0xc207('0x86')](function(){_0x53a210[_0xc207('0xb2')](_0x20e130,_0x375518,_0x34f784)[_0xc207('0x86')](function(){});});}});delete this[_0xc207('0x14')][_0x28a45d['linkedid']];break;case'19':_0x45b4fb[_0xc207('0x42')]+=0x1;_0x20e130[_0xc207('0x9f')]=ut[_0xc207('0xa0')](_0x20e130);ut[_0xc207('0x91')](_0x20e130,0x13,_0x28a45d[_0xc207('0xe7')]||_0x28a45d[_0xc207('0xe8')]);ami[_0xc207('0x23')](_0xc207('0xe9'),ut[_0xc207('0xa2')](_0x20e130,_0xc207('0xe5')));rpcDb[_0xc207('0x95')](_0x20e130,'[callProgressDetectingCustomer][machine]');_0x53a210[_0xc207('0xa3')](_0x20e130,'18',_0x45b4fb)['then'](function(_0x2414cc){_0x416a72=_0x2414cc[_0xc207('0xa4')]==0x1;if(!_0x416a72){if(ut[_0xc207('0xa0')](_0x20e130)>=_0x45b4fb[_0xc207('0xa6')]){_0x586c41=ut['cloneAction'](_0x20e130,0xf,'Global');rpcDb[_0xc207('0xa9')](_0x586c41,_0xc207('0xea'));}else{rpcDb[_0xc207('0xa9')](_0x20e130,_0xc207('0xea'));}}else{_0x20e130[_0xc207('0xca')]++;_0x53a210[_0xc207('0xdf')]({'id':_0x20e130[_0xc207('0xb1')],'field':{'countnoanswerretry':_0x20e130[_0xc207('0xca')]}})[_0xc207('0x86')](function(){_0x53a210[_0xc207('0xb2')](_0x20e130,_0x375518,_0x34f784)[_0xc207('0x86')](function(){});});}});delete this[_0xc207('0x14')][_0x28a45d[_0xc207('0xaf')]];break;default:if(_0x20e130[_0xc207('0x76')]){ut[_0xc207('0xeb')](_0x45b4fb,_0xc207('0xec'));ut[_0xc207('0x7f')](_0xc207('0xed')+_0x45b4fb[_0xc207('0x59')],_0x28a45d);}_0x45b4fb[_0xc207('0x42')]+=0x1;_0x20e130[_0xc207('0x9f')]=ut[_0xc207('0xa0')](_0x20e130);ut['logCustomer'](_0x20e130,0xc,_0x28a45d[_0xc207('0xe7')]||_0x28a45d[_0xc207('0xe8')]);_0x375518=_0x45b4fb['dialAgentRejectRetryFrequency'];_0x34f784=_0x45b4fb[_0xc207('0xa5')];rpcDb[_0xc207('0x95')](_0x20e130,_0xc207('0xee'));_0x53a210['verifyAdditionalPhones'](_0x20e130,'20',_0x45b4fb)[_0xc207('0x86')](function(_0x35d275){_0x416a72=_0x35d275[_0xc207('0xa4')]==0x1;if(!_0x416a72){if(ut[_0xc207('0xa0')](_0x20e130)>=_0x45b4fb[_0xc207('0xa6')]){_0x586c41=ut[_0xc207('0xa7')](_0x20e130,0xf,_0xc207('0xa8'));rpcDb[_0xc207('0xa9')](_0x586c41,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xc207('0xa9')](_0x20e130,_0xc207('0xef'));}delete this[_0xc207('0x14')][_0x28a45d[_0xc207('0xaf')]];}else{_0x53a210['swapAdditionalPhones'](_0x20e130,_0x375518,_0x34f784)[_0xc207('0x86')](function(_0x54165d){});}});}if(!(_0x20e130[_0xc207('0x76')]&&_0x203686==='16')){ut[_0xc207('0x7d')](_0x45b4fb,_0xc207('0xf0'));logger['info'](_0xc207('0xf1'),_0x20e130[_0xc207('0xb5')],_0xc207('0xb6'),_0x45b4fb[_0xc207('0x59')],_0xc207('0x74'),_0x45b4fb[_0xc207('0x4f')]);}if(_0x203686!==_0xc207('0xf2')){delete this[_0xc207('0x14')][_0x28a45d[_0xc207('0xaf')]];delete this[_0xc207('0x14')][_0x28a45d[_0xc207('0xf3')]];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x6aec02,_0x2a3af7,_0x331e0f){if(_['isUndefined'](_0x2a3af7)&&_0xc207('0xf4')!==typeof _0x2a3af7){return;}if(_[_0xc207('0xf5')](_0x331e0f)&&_0xc207('0xf4')!==typeof _0x331e0f){return;}switch(_0x331e0f[_0xc207('0xf6')]){case'0':ut[_0xc207('0xf7')](_0x6aec02,0x0,_0xc207('0xf8'));rpcDb[_0xc207('0xf9')](_0x6aec02,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xc207('0xf7')](_0x6aec02,0x3,_0xc207('0xcb'));rpcDb['createAgentHistory'](_0x6aec02,_0xc207('0xfa'));break;case'5':ut['logAgent'](_0x6aec02,0x5,_0xc207('0xfb'));rpcDb['createAgentHistory'](_0x6aec02,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x6aec02,0x8,'Congestion');rpcDb[_0xc207('0xf9')](_0x6aec02,_0xc207('0xfc'));break;case'22':ut[_0xc207('0xf7')](_0x6aec02,0x16,'AnswerAGI');rpcDb[_0xc207('0xf9')](_0x6aec02,_0xc207('0xfd'));break;default:ut['logAgent'](_0x6aec02,0xc,_0x331e0f[_0xc207('0xf6')]);rpcDb[_0xc207('0xf9')](_0x6aec02,_0xc207('0xfc'));}ut['updateOriginated'](_0x2a3af7,_0xc207('0xfe'));logger['info'](_0xc207('0xff'),_0x6aec02[_0xc207('0xb5')],'\x20Queue',_0x2a3af7[_0xc207('0x59')],'originated:\x20',_0x2a3af7[_0xc207('0x4f')]);delete this['actions'][_0x6aec02['uniqueid']];};Preview[_0xc207('0xe')][_0xc207('0xa3')]=function(_0x1e2d78,_0xd6227d,_0x48cf60){return BPromise['resolve']()[_0xc207('0x86')](cmHopperAdditionalPhone[_0xc207('0xa3')](_0x1e2d78,_0xd6227d,_0x48cf60))[_0xc207('0x7b')](logger[_0xc207('0x5c')](_0xc207('0x100')));};Preview['prototype'][_0xc207('0xb2')]=function(_0x5b461d,_0x503b3a,_0x387476){return BPromise[_0xc207('0x101')]()['then'](cmHopperAdditionalPhone['swapAdditionalPhones'](_0x5b461d,_0x503b3a,_0x387476))['catch'](logger[_0xc207('0x5c')](_0xc207('0x102')));};Preview[_0xc207('0xe')][_0xc207('0xdf')]=function(_0x57eff2){return BPromise[_0xc207('0x101')]()[_0xc207('0x86')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x57eff2))[_0xc207('0x7b')](logger[_0xc207('0x5c')](_0xc207('0x103')));};Preview[_0xc207('0xe')][_0xc207('0x104')]=function(_0x40b692,_0x24338a,_0x1756eb,_0x3e0480,_0x533e84){var _0x4cee5a=this;return new BPromise(function(_0x11f4e1,_0x1f9a6d){if(_['isNil'](_0x24338a)||_['isNil'](_0x24338a[_0xc207('0x105')])||_['isNil'](_0x24338a[_0xc207('0x106')])||_[_0xc207('0x70')](_0x24338a['VoiceQueueId'])){_0x1f9a6d(ut[_0xc207('0x4e')](_0xc207('0x107'),_0x3e0480,_0x533e84));return;}var _0x4fd753=uuid['v4']();var _0x581d54=_0x4cee5a[_0xc207('0x11')][_0x24338a[_0xc207('0x72')][_0xc207('0x59')]];var _0x552239=_0x1756eb?_0x4cee5a[_0xc207('0x15')][_0x1756eb]['id']:undefined;_0x4cee5a[_0xc207('0x14')][_0x4fd753]=new Action(_0x24338a,_0x581d54,_0x4fd753,_0x1756eb,_0x552239);var _0x1e2238=_0x4cee5a[_0xc207('0x14')][_0x4fd753];_0x1e2238['unlockAgent']=_0x3e0480;_0x1e2238[_0xc207('0xae')]=_0x533e84;_0x1e2238[_0xc207('0x108')]=_0x1756eb;if(_[_0xc207('0x109')](_0x40b692)){_0x4cee5a[_0xc207('0x10a')](_0x1e2238,_0x581d54,_0x24338a,_0x1756eb)[_0xc207('0x86')](function(_0x3dcc0e){logger[_0xc207('0x5c')](_0xc207('0x10b'),'Queue:\x20'+_0x1e2238[_0xc207('0x73')]+'\x20IdHopper:\x20'+_0x1e2238[_0xc207('0xb1')],JSON[_0xc207('0x5a')](_0x3dcc0e));ami[_0xc207('0x23')]('custom:agentcalled',ut[_0xc207('0xa2')](_0x1e2238,_0xc207('0x10c'),_0x4cee5a['campaignsPreview'][_0x1e2238['queue']]));_0x11f4e1(ut['message'](_0xc207('0x10d')));})[_0xc207('0x7b')](function(_0x32947f){ut[_0xc207('0x61')](_0xc207('0x10e'),_0x32947f);_0x1f9a6d(ut[_0xc207('0x4e')](_0xc207('0x10f'),_0x3e0480,_0x533e84));});}else{_0x581d54[_0xc207('0x38')]+=0x1;ut[_0xc207('0x110')](_0x1e2238);rpcDb[_0xc207('0x111')](_0x1e2238,_0xc207('0x112'));delete _0x4cee5a[_0xc207('0x14')][_0x4fd753];_0x1f9a6d(ut[_0xc207('0x4e')](_0xc207('0x113'),_0x3e0480,_0x533e84));}});};Preview[_0xc207('0xe')][_0xc207('0x9b')]=function(_0xaebd6f){return!_[_0xc207('0x70')](_0xaebd6f)&&!_[_0xc207('0x70')](_0xaebd6f[_0xc207('0x59')])&&!_['isNil'](_0xaebd6f[_0xc207('0x56')])&&_0xaebd6f[_0xc207('0x56')]&&!_[_0xc207('0x70')](this['trunks'][util[_0xc207('0x5b')]('SIP/%s',_0xaebd6f[_0xc207('0x59')])])&&!_[_0xc207('0x70')](this[_0xc207('0x13')][util[_0xc207('0x5b')](_0xc207('0x114'),_0xaebd6f['name'])][_0xc207('0x115')])&&(this[_0xc207('0x13')][util[_0xc207('0x5b')](_0xc207('0x114'),_0xaebd6f['name'])]['status']===_0xc207('0x116')||this[_0xc207('0x13')][util[_0xc207('0x5b')](_0xc207('0x114'),_0xaebd6f[_0xc207('0x59')])][_0xc207('0x115')]===_0xc207('0x117'));};Preview[_0xc207('0xe')][_0xc207('0x118')]=function(_0x370e6b,_0xc25d88){var _0x474d33=this;return new BPromise(function(_0x2d7130,_0x101510){_0x474d33['execRun'](_0x370e6b,_0xc25d88)['then'](function(_0x172d6d){_0x2d7130(_[_0xc207('0x77')](_0x172d6d,[_0xc207('0x4e')]));})[_0xc207('0x7b')](function(_0x407819){if(_0x407819[_0xc207('0x119')]){rpcDb['unlockContact'](_0x370e6b);}if(_0x407819['active']){rpcDb['disableContact'](_0x370e6b);}_0x101510(_['pick'](_0x407819,[_0xc207('0x4e')]));});});};Preview['prototype'][_0xc207('0x11a')]=function(_0x36f913,_0x217a60){var _0x32b03f=this;return new BPromise(function(_0x2b3c50,_0x2fff10){var _0x896bba,_0x46dbdb;rpcDb[_0xc207('0x11b')](_0x36f913)['then'](function(_0x49a49c){if(!_[_0xc207('0x70')](_0x49a49c[0x0])){_0x46dbdb=_0x49a49c[0x0]['recallme']?![]:!![];_0x896bba=_0x49a49c[0x0][_0xc207('0x11c')]?!![]:![];_0x896bba=_0x217a60?!![]:_0x896bba;}var _0x4b9828=_0x32b03f[_0xc207('0x11d')](_0x49a49c);if(_0x4b9828[_0xc207('0x11e')]){rpcDb[_0xc207('0x11f')](_[_0xc207('0x77')](_0x49a49c[0x0],['VoiceQueueId','phone']))[_0xc207('0x86')](function(_0x391a3c){_0x32b03f['checkInBlack'](_0x391a3c,_0x49a49c[0x0],_0x217a60,_0x46dbdb,_0x896bba)[_0xc207('0x86')](function(_0x2158c8){_0x2b3c50(_0x2158c8);})[_0xc207('0x7b')](function(_0x51b38b){_0x2fff10(_0x51b38b);});})[_0xc207('0x7b')](function(_0x1a4916){ut[_0xc207('0x61')](_0xc207('0x120'),_0x1a4916);_0x2fff10(ut['message'](_0xc207('0x121'),_0x46dbdb,_0x896bba));});}else{_0x2fff10(ut[_0xc207('0x4e')](_0x4b9828[_0xc207('0x4e')],_0x46dbdb,_0x896bba));}})[_0xc207('0x7b')](function(_0x199b24){ut['logger'](_0xc207('0x122'),_0x199b24);_0x2fff10(ut[_0xc207('0x4e')](_0xc207('0x121'),![],!![]));});});};Preview[_0xc207('0xe')]['validateContact']=function(_0x31c419){if(_['isNil'](_0x31c419)||_[_0xc207('0x109')](_0x31c419)||!_[_0xc207('0x70')](_0x31c419[0x0]['Agent'])&&_[_0xc207('0x70')](_0x31c419[0x0][_0xc207('0x8a')][_0xc207('0x59')])){ut['logger'](_0xc207('0x123'),_0x31c419);return{'isValid':![],'message':_0xc207('0x124')};}var _0x5d7fb4=this['campaignsPreview'][_0x31c419[0x0]['Queue']['name']];_0x5d7fb4[_0xc207('0x4e')]=_0xc207('0x9d');if(_[_0xc207('0x70')](_0x5d7fb4)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x5d7fb4);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xc207('0x9b')](_0x5d7fb4['Trunk'])){ut[_0xc207('0x61')](_0xc207('0x125'),_0xc207('0x126')+_0x5d7fb4['name']+_0xc207('0x127'));if(!this[_0xc207('0x9b')](_0x5d7fb4[_0xc207('0x128')])){ut[_0xc207('0x61')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x5d7fb4[_0xc207('0x59')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0xc207('0x9a')](_0x5d7fb4[_0xc207('0x6b')])){ut[_0xc207('0x61')](_0xc207('0x129'),_0x5d7fb4[_0xc207('0x59')]+_0xc207('0x12a'));return{'isValid':![],'message':_0xc207('0x126')+_0x5d7fb4[_0xc207('0x59')]+_0xc207('0x12a')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xc207('0xe')]['execCall']=function(_0x4252c4,_0x50bfed,_0x18c08b,_0x444b35){var _0x121fd8=this;return new BPromise(function(_0x3334a2,_0x3a48c1){var _0x3be7b1=_0x4252c4[_0xc207('0xb5')];var _0x2d0941=_0x121fd8['isTrunkReachable'](_0x50bfed['Trunk'])?util[_0xc207('0x5b')]('SIP/%s/%s%s',_0x50bfed[_0xc207('0x55')]['name'],_[_0xc207('0x70')](_0x50bfed[_0xc207('0x35')])?'':_0x50bfed['dialPrefix'][_0xc207('0x12b')]()||'',_0x50bfed[_0xc207('0x12c')]>0x0?_0x18c08b['phone'][_0xc207('0x12d')](_0x50bfed[_0xc207('0x12c')]):_0x18c08b['phone']):util[_0xc207('0x5b')]('SIP/%s/%s%s',_[_0xc207('0x70')](_0x50bfed[_0xc207('0x128')])?_0x50bfed[_0xc207('0x55')]['name']:_0x50bfed[_0xc207('0x128')][_0xc207('0x59')],_[_0xc207('0x70')](_0x50bfed[_0xc207('0x35')])?'':_0x50bfed[_0xc207('0x35')]['trim']()||'',_0x50bfed[_0xc207('0x12c')]>0x0?_0x18c08b['phone'][_0xc207('0x12d')](_0x50bfed['dialCutDigit']):_0x18c08b[_0xc207('0x106')]);var _0x3ee952=_0x121fd8[_0xc207('0x9b')](_0x50bfed[_0xc207('0x55')])?ut[_0xc207('0x12e')](_0x50bfed['Trunk'][_0xc207('0x57')],_0x50bfed['dialOriginateCallerIdName'],_0x50bfed['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x50bfed[_0xc207('0x12f')],_0x50bfed[_0xc207('0x130')]):_0x50bfed[_0xc207('0x12f')]):ut[_0xc207('0x12e')](_[_0xc207('0x70')](_0x50bfed[_0xc207('0x128')])?_0x50bfed['Trunk'][_0xc207('0x57')]:_0x50bfed[_0xc207('0x128')][_0xc207('0x57')],_0x50bfed[_0xc207('0x131')],_0x50bfed[_0xc207('0x130')]>0x0?ut[_0xc207('0x132')](_0x50bfed[_0xc207('0x12f')],_0x50bfed['dialRandomLastDigitCallerIdNumber']):_0x50bfed['dialOriginateCallerIdNumber']);if(_0x3ee952){_0x4252c4['originatecalleridname']=ut['extractCalleridName'](_0x3ee952);_0x4252c4[_0xc207('0x133')]=ut['extractCalleridNumber'](_0x3ee952);}var _0x1be191=ut['addVariables'](_0x50bfed,_0x18c08b,_0x2d0941,_0x3ee952,_0x3be7b1,_0x4252c4);_['merge'](_0x4252c4,ut[_0xc207('0x134')](_0x1be191));_0x4252c4['starttime']=moment()[_0xc207('0x5b')](_0xc207('0x90'));ami[_0xc207('0x135')](ut[_0xc207('0x136')](_0x4252c4,_0x50bfed,_0x1be191,_0x4252c4[_0xc207('0xae')],_0x444b35))[_0xc207('0x86')](function(_0x2dd537){_0x50bfed[_0xc207('0x4f')]+=0x1;logger['info'](_0xc207('0x137'),_0x3be7b1,_0xc207('0xb6'),_0x50bfed[_0xc207('0x59')],'originated:\x20',_0x50bfed[_0xc207('0x4f')]);_0x3334a2(_0x2dd537);})[_0xc207('0x7b')](function(_0x6f0d50){ut['logAgent'](_0x4252c4,0xe,_0xc207('0x138'));rpcDb[_0xc207('0xf9')](_0x4252c4,_0xc207('0x139'));_0x3a48c1(_0x6f0d50);});});};Preview[_0xc207('0xe')]['syncNewExten']=function(_0x2f1069){if(this['actions'][_0x2f1069[_0xc207('0xaf')]]){this[_0xc207('0x14')][_0x2f1069['linkedid']][_0xc207('0x7a')]=_0x2f1069[_0xc207('0x7a')];}};Preview[_0xc207('0xe')][_0xc207('0x17')]=function(_0x267ec0){var _0x3a1b5f=this;var _0xa49cc6=this[_0xc207('0x14')][_0x267ec0[_0xc207('0x13a')]];if(_0xa49cc6){if(_0xa49cc6['lookAgent']&&this[_0xc207('0x15')][_0xa49cc6['lookAgent']]){ut[_0xc207('0x13b')](_0xa49cc6,this[_0xc207('0x15')][_0xa49cc6[_0xc207('0x108')]][_0xc207('0x59')],this[_0xc207('0x15')][_0xa49cc6[_0xc207('0x108')]]['id']);}var _0x28193e=_[_0xc207('0x13c')](_0xa49cc6);_0x28193e[_0xc207('0xb3')]=moment()['format'](_0xc207('0x90'));var _0x2212a0=_0x3a1b5f[_0xc207('0x11')][_0xa49cc6[_0xc207('0x73')]];if(ut[_0xc207('0x13d')](_0x267ec0[_0xc207('0x13e')])){if(_0xa49cc6['unlockAgent']){rpcDb[_0xc207('0x13f')](_0xa49cc6[_0xc207('0xb1')]);}if(_0xa49cc6['activeContact']){rpcDb[_0xc207('0x8e')](_0xa49cc6[_0xc207('0xb1')]);}ami[_0xc207('0x23')](_0xc207('0x140'),ut[_0xc207('0xa2')](_0xa49cc6,_0xc207('0x141'),this[_0xc207('0x11')][_0xa49cc6['queue']]));this[_0xc207('0x142')](_0x28193e,_0x2212a0,_0x267ec0);}else{_0xa49cc6['starttime']=moment()[_0xc207('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x28193e,0x4,_0xc207('0xbe'));rpcDb[_0xc207('0xf9')](_0x28193e,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype']['syncHangup']=function(_0x5f4e49){var _0x501053=this;var _0x46ba65=this[_0xc207('0x14')][_0x5f4e49[_0xc207('0xaf')]];var _0x306201;if(_0x46ba65){_0x306201=this[_0xc207('0x11')][_0x46ba65[_0xc207('0x73')]];logger[_0xc207('0x5c')](_0xc207('0x143'),_0x5f4e49[_0xc207('0xaf')],_0xc207('0xb6'),_0x306201['name'],_0xc207('0x75'),_0x306201[_0xc207('0x29')]);}if(this[_0xc207('0x14')][_0x5f4e49[_0xc207('0xaf')]]&&_0x5f4e49['linkedid']!==_0x5f4e49['uniqueid']){if(_0x5f4e49[_0xc207('0x144')]==='16'&&this[_0xc207('0x14')][_0x5f4e49[_0xc207('0xaf')]][_0xc207('0x76')]){this[_0xc207('0x9e')](_0x5f4e49,_0x5f4e49[_0xc207('0xaf')],_0x5f4e49[_0xc207('0x144')]);}else if(this[_0xc207('0x14')][_0x5f4e49[_0xc207('0xaf')]][_0xc207('0x76')]){logger[_0xc207('0x5c')](_0xc207('0x145'),_0x5f4e49['linkedid'],_0x5f4e49[_0xc207('0x144')],_0xc207('0xb6'),_0x306201[_0xc207('0x59')],'pTalking:\x20',_0x306201[_0xc207('0x29')]);this[_0xc207('0x9e')](_0x5f4e49,_0x5f4e49['linkedid'],_0x5f4e49['cause']);}}else if(_0x46ba65&&_[_0xc207('0x70')](_0x46ba65[_0xc207('0x146')])&&_0x306201[_0xc207('0x147')]&&_0x5f4e49[_0xc207('0xaf')]===_0x5f4e49[_0xc207('0xb5')]&&_[_0xc207('0x70')](_0x5f4e49[_0xc207('0xf6')])&&_0x5f4e49['cause']==='16'&&_0x5f4e49[_0xc207('0x148')]==='6'&&_['isUndefined'](_0x46ba65[_0xc207('0x149')])){if(_0x46ba65[_0xc207('0xad')]){rpcDb[_0xc207('0x13f')](_0x46ba65[_0xc207('0xb1')]);}if(_0x46ba65[_0xc207('0xae')]){rpcDb['disableContact'](_0x46ba65[_0xc207('0xb1')]);}_0x5f4e49['reason']='22';this[_0xc207('0x142')](_0x46ba65,_0x306201,_0x5f4e49);}else if(_0x46ba65&&_0x46ba65[_0xc207('0x149')]){if(_0x5f4e49[_0xc207('0x144')]==='16'&&this['actions'][_0x5f4e49['linkedid']][_0xc207('0x76')]){logger[_0xc207('0x5c')](_0xc207('0x14a'),_0x5f4e49[_0xc207('0xaf')],_0x5f4e49['cause'],_0xc207('0xb6'),_0x306201[_0xc207('0x59')],_0xc207('0x75'),_0x306201[_0xc207('0x29')]);this[_0xc207('0x9e')](_0x5f4e49,_0x5f4e49[_0xc207('0xaf')],_0x5f4e49[_0xc207('0x144')]);}else if(this[_0xc207('0x14')][_0x5f4e49[_0xc207('0xaf')]][_0xc207('0x76')]){logger[_0xc207('0x5c')]('[syncHangup][talking][cause]',_0x5f4e49[_0xc207('0xaf')],_0x5f4e49[_0xc207('0x144')],_0xc207('0xb6'),_0x306201[_0xc207('0x59')],_0xc207('0x75'),_0x306201['pTalking']);this[_0xc207('0x9e')](_0x5f4e49,_0x5f4e49['linkedid'],_0x5f4e49[_0xc207('0x144')]);}}};Preview[_0xc207('0xe')][_0xc207('0x1c')]=function(_0x1009a8){if(this[_0xc207('0x14')][_0x1009a8[_0xc207('0xf3')]]&&_0x1009a8['destlinkedid']!==_0x1009a8[_0xc207('0x14b')]){this[_0xc207('0x9e')](_0x1009a8,_0x1009a8['destlinkedid'],_0x1009a8[_0xc207('0xe8')]);}};Preview[_0xc207('0xe')][_0xc207('0x14c')]=function(_0x3b3045){if(this[_0xc207('0x14')][_0x3b3045[_0xc207('0xaf')]]&&_0x3b3045[_0xc207('0xaf')]!==_0x3b3045[_0xc207('0xb5')]&&!this[_0xc207('0x14')][_0x3b3045[_0xc207('0xaf')]][_0xc207('0x76')]){if(_0x3b3045[_0xc207('0x144')]==='1'){this[_0xc207('0x9e')](_0x3b3045,_0x3b3045['linkedid'],_0x3b3045[_0xc207('0x144')]);}}};Preview[_0xc207('0xe')]['addVariable']=function(_0x31e461,_0x31e79a,_0x65304b){if(this[_0xc207('0x14')][_0x31e461]){if(_[_0xc207('0x70')](this['actions'][_0x31e461][_0xc207('0x14d')])){this['actions'][_0x31e461][_0xc207('0x14d')]={};}this[_0xc207('0x14')][_0x31e461]['variables'][_0x31e79a]=_0x65304b;}};Preview[_0xc207('0xe')]['syncVarSet']=function(_0x383360){try{if(!_['isNil'](_0x383360)){if(ut[_0xc207('0x14e')](_[_0xc207('0x14f')](_0x383360[_0xc207('0x150')])[0x0])){this[_0xc207('0x151')](_0x383360[_0xc207('0xb5')],_[_0xc207('0x14f')](_0x383360[_0xc207('0x150')])[0x0],_0x383360[_0xc207('0x152')]);}}}catch(_0x4f3dc3){logger[_0xc207('0x153')](_0xc207('0x154'),util[_0xc207('0x155')](_0x4f3dc3,{'showHidden':![],'depth':null}));}};Preview[_0xc207('0xe')][_0xc207('0x1f')]=function(_0x478c39){if(_0x478c39){if(this[_0xc207('0x14')][_0x478c39[_0xc207('0x156')]]){this['actions'][_0x478c39[_0xc207('0x156')]][_0xc207('0x149')]=!![];}}};Preview[_0xc207('0xe')][_0xc207('0x21')]=function(_0x172161){if(_0x172161){if(this[_0xc207('0x14')][_0x172161[_0xc207('0x157')]]){this[_0xc207('0x14')][_0x172161[_0xc207('0x157')]][_0xc207('0x149')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 09b3ec7..7a046c4 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 _0xbf40=['[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','bluebird','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','inspect','resolve','catch','[createHistory]\x20','then','createHistory','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','COMPLETED'];(function(_0x2e4e42,_0x13a9fe){var _0x2d1cb0=function(_0x7c1cfb){while(--_0x7c1cfb){_0x2e4e42['push'](_0x2e4e42['shift']());}};_0x2d1cb0(++_0x13a9fe);}(_0xbf40,0x1bc));var _0x0bf4=function(_0x2e0443,_0x7e5974){_0x2e0443=_0x2e0443-0x0;var _0x52d450=_0xbf40[_0x2e0443];return _0x52d450;};'use strict';var util=require('util');var BPromise=require(_0x0bf4('0x0'));var logger=require('../../../config/logger')(_0x0bf4('0x1'));var _=require(_0x0bf4('0x2'));var cmHopper=require(_0x0bf4('0x3'));var cmHopperFinal=require(_0x0bf4('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x0bf4('0x5'));var voiceQueueRt=require(_0x0bf4('0x6'));var agentReportPreview=require(_0x0bf4('0x7'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x3a88fc){return function(_0x1d2b12){logger['error'](_0x3a88fc,util[_0x0bf4('0x8')](_0x1d2b12,{'showHidden':![],'depth':null}));};}function create(_0x57accd){return BPromise[_0x0bf4('0x9')]()['then'](cmHopperHistory['createHistory'](_0x57accd))[_0x0bf4('0xa')](loggerCatch(_0x0bf4('0xb')));}function createAgent(_0x41ca20){return BPromise[_0x0bf4('0x9')]()[_0x0bf4('0xc')](agentReportPreview[_0x0bf4('0xd')](_0x41ca20))[_0x0bf4('0xa')](loggerCatch(_0x0bf4('0xb')));}function moveContact(_0xda176){return BPromise[_0x0bf4('0x9')]()['then'](cmHopper[_0x0bf4('0xe')](_0xda176,!![]))[_0x0bf4('0xa')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x0bf4('0xf')]=function(_0x19a598){return BPromise[_0x0bf4('0x9')]()[_0x0bf4('0xc')](cmHopperBlack[_0x0bf4('0xf')](_0x19a598))[_0x0bf4('0xa')](loggerCatch(_0x0bf4('0x10')));};exports[_0x0bf4('0x11')]=function(_0x31f071){return BPromise[_0x0bf4('0x9')]()[_0x0bf4('0xc')](cmHopper[_0x0bf4('0x11')](_0x31f071))[_0x0bf4('0xa')](loggerCatch(_0x0bf4('0x12')));};exports[_0x0bf4('0xd')]=function(_0x4edeb9,_0x3dd845){create(_0x4edeb9)[_0x0bf4('0xa')](loggerCatch(_0x3dd845));moveContact(_0x4edeb9)[_0x0bf4('0xa')](loggerCatch(_0x3dd845));};exports[_0x0bf4('0x13')]=function(_0x38d710,_0x2bf924){createAgent(_0x38d710)[_0x0bf4('0xa')](loggerCatch(_0x2bf924));};exports[_0x0bf4('0x14')]=function(_0x552a58,_0x5d3265){create(_0x552a58)[_0x0bf4('0xa')](loggerCatch(_0x5d3265));};exports[_0x0bf4('0x15')]=function(_0xf46f28,_0x32d908){moveContact(_0xf46f28)[_0x0bf4('0xa')](loggerCatch(_0x32d908));};exports[_0x0bf4('0x16')]=function(_0x412f8a,_0x214b43,_0xd82b3c){if(_0x214b43){_0x412f8a[_0x0bf4('0x17')]=null;}if(_0xd82b3c){_0x412f8a['active']=![];}return BPromise['resolve']()[_0x0bf4('0xc')](cmHopper[_0x0bf4('0x16')](_0x412f8a))['catch'](loggerCatch(_0x0bf4('0x18')));};exports['countReScheduled']=function(_0x16ae28){return BPromise['resolve']()[_0x0bf4('0xc')](cmHopper[_0x0bf4('0x19')](_0x16ae28))[_0x0bf4('0xa')](loggerCatch('[countReScheduled]\x20'));};exports[_0x0bf4('0x1a')]=function(_0x51d738){return BPromise[_0x0bf4('0x9')]()[_0x0bf4('0xc')](cmHopper[_0x0bf4('0x1a')]({'UserId':null},_0x51d738,0x1))[_0x0bf4('0xa')](loggerCatch('[unlockContact]\x20'));};exports[_0x0bf4('0x1b')]=function(_0xdee615){return BPromise['resolve']()[_0x0bf4('0xc')](cmHopper['unlockContact']({'active':![]},_0xdee615,0x1))['catch'](loggerCatch(_0x0bf4('0x1c')));};exports[_0x0bf4('0x1d')]=function(_0x1fe8d5){var _0x3e4f2c={};_0x3e4f2c[_0x0bf4('0x1e')]=_0x1fe8d5['type'];_0x3e4f2c[_0x0bf4('0x1f')]=_0x1fe8d5[_0x0bf4('0x1f')];_0x3e4f2c[_0x0bf4('0x20')]=_0x1fe8d5[_0x0bf4('0x20')];_0x3e4f2c[_0x0bf4('0x21')]=_0x1fe8d5[_0x0bf4('0x21')];_0x3e4f2c[_0x0bf4('0x22')]=_0x1fe8d5[_0x0bf4('0x22')];_0x3e4f2c[_0x0bf4('0x23')]=_0x1fe8d5['answertime'];_0x3e4f2c[_0x0bf4('0x24')]=_0x1fe8d5[_0x0bf4('0x25')];_0x3e4f2c[_0x0bf4('0x26')]=0x1;_0x3e4f2c[_0x0bf4('0x27')]=_0x1fe8d5[_0x0bf4('0x28')];_0x3e4f2c[_0x0bf4('0x29')]=_0x1fe8d5['membername'];_0x3e4f2c[_0x0bf4('0x2a')]=_0x0bf4('0x2b');_0x3e4f2c[_0x0bf4('0x2c')]=_0x0bf4('0x2d');_0x3e4f2c[_0x0bf4('0x2e')]=0x0;_0x3e4f2c[_0x0bf4('0x2f')]=0x1;_0x3e4f2c[_0x0bf4('0x30')]=_0x1fe8d5[_0x0bf4('0x31')];_0x3e4f2c['queuecallerexitreason']=_0x0bf4('0x32');return BPromise[_0x0bf4('0x9')]()[_0x0bf4('0xc')](voiceQueueReport['create'](_0x3e4f2c))[_0x0bf4('0xa')](loggerCatch(_0x0bf4('0x33')));};exports[_0x0bf4('0x34')]=function(_0x10d7cd,_0x48457f){return BPromise[_0x0bf4('0x9')]()['then'](cmHopper[_0x0bf4('0x34')](_0x10d7cd,_0x48457f))[_0x0bf4('0xa')](loggerCatch(_0x0bf4('0x35')));};exports[_0x0bf4('0x36')]=function(_0x196814){return BPromise[_0x0bf4('0x9')]()[_0x0bf4('0xc')](cmHopper[_0x0bf4('0x16')](_0x196814,!![],!![]))[_0x0bf4('0xa')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xd50d=['unlockContact','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','then','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20'];(function(_0x4472df,_0x4a4bda){var _0x342e27=function(_0xb140c2){while(--_0xb140c2){_0x4472df['push'](_0x4472df['shift']());}};_0x342e27(++_0x4a4bda);}(_0xd50d,0xc0));var _0xdd50=function(_0x241da6,_0x18f150){_0x241da6=_0x241da6-0x0;var _0x477ddd=_0xd50d[_0x241da6];return _0x477ddd;};'use strict';var util=require(_0xdd50('0x0'));var BPromise=require(_0xdd50('0x1'));var logger=require(_0xdd50('0x2'))(_0xdd50('0x3'));var _=require('lodash');var cmHopper=require(_0xdd50('0x4'));var cmHopperFinal=require(_0xdd50('0x5'));var cmHopperHistory=require(_0xdd50('0x6'));var cmHopperBlack=require(_0xdd50('0x7'));var voiceQueueRt=require(_0xdd50('0x8'));var agentReportPreview=require(_0xdd50('0x9'));var voiceQueueReport=require(_0xdd50('0xa'));function loggerCatch(_0x37c6f4){return function(_0x16689a){logger[_0xdd50('0xb')](_0x37c6f4,util[_0xdd50('0xc')](_0x16689a,{'showHidden':![],'depth':null}));};}function create(_0x1c78fc){return BPromise['resolve']()[_0xdd50('0xd')](cmHopperHistory[_0xdd50('0xe')](_0x1c78fc))[_0xdd50('0xf')](loggerCatch(_0xdd50('0x10')));}function createAgent(_0x2dab73){return BPromise[_0xdd50('0x11')]()[_0xdd50('0xd')](agentReportPreview[_0xdd50('0xe')](_0x2dab73))[_0xdd50('0xf')](loggerCatch(_0xdd50('0x10')));}function moveContact(_0x489fa6){return BPromise[_0xdd50('0x11')]()[_0xdd50('0xd')](cmHopper[_0xdd50('0x12')](_0x489fa6,!![]))[_0xdd50('0xf')](loggerCatch(_0xdd50('0x13')));}exports[_0xdd50('0x14')]=function(_0x1bedd4){return BPromise[_0xdd50('0x11')]()[_0xdd50('0xd')](cmHopperBlack[_0xdd50('0x14')](_0x1bedd4))[_0xdd50('0xf')](loggerCatch(_0xdd50('0x15')));};exports[_0xdd50('0x16')]=function(_0x583a1c){return BPromise['resolve']()[_0xdd50('0xd')](cmHopper[_0xdd50('0x16')](_0x583a1c))[_0xdd50('0xf')](loggerCatch(_0xdd50('0x17')));};exports['createHistory']=function(_0x4f671a,_0x25434f){create(_0x4f671a)[_0xdd50('0xf')](loggerCatch(_0x25434f));moveContact(_0x4f671a)[_0xdd50('0xf')](loggerCatch(_0x25434f));};exports[_0xdd50('0x18')]=function(_0x57149d,_0x2f2c34){createAgent(_0x57149d)[_0xdd50('0xf')](loggerCatch(_0x2f2c34));};exports[_0xdd50('0x19')]=function(_0x52cadb,_0x507368){create(_0x52cadb)[_0xdd50('0xf')](loggerCatch(_0x507368));};exports['createCustomerFinal']=function(_0x3c43cf,_0x129522){moveContact(_0x3c43cf)['catch'](loggerCatch(_0x129522));};exports[_0xdd50('0x1a')]=function(_0x575998,_0x6c93be,_0x5bd1ec){if(_0x6c93be){_0x575998[_0xdd50('0x1b')]=null;}if(_0x5bd1ec){_0x575998[_0xdd50('0x1c')]=![];}return BPromise[_0xdd50('0x11')]()['then'](cmHopper[_0xdd50('0x1a')](_0x575998))[_0xdd50('0xf')](loggerCatch(_0xdd50('0x1d')));};exports[_0xdd50('0x1e')]=function(_0x55fc22){return BPromise[_0xdd50('0x11')]()[_0xdd50('0xd')](cmHopper['countReScheduled'](_0x55fc22))['catch'](loggerCatch(_0xdd50('0x1f')));};exports['unlockContact']=function(_0x1947b0){return BPromise[_0xdd50('0x11')]()[_0xdd50('0xd')](cmHopper[_0xdd50('0x20')]({'UserId':null},_0x1947b0,0x1))[_0xdd50('0xf')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x3a9ab2){return BPromise[_0xdd50('0x11')]()['then'](cmHopper['unlockContact']({'active':![]},_0x3a9ab2,0x1))['catch'](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0xc8e065){var _0xa6fef3={};_0xa6fef3[_0xdd50('0x21')]=_0xc8e065['type'];_0xa6fef3[_0xdd50('0x22')]=_0xc8e065[_0xdd50('0x22')];_0xa6fef3[_0xdd50('0x23')]=_0xc8e065[_0xdd50('0x23')];_0xa6fef3[_0xdd50('0x24')]=_0xc8e065[_0xdd50('0x24')];_0xa6fef3['queue']=_0xc8e065[_0xdd50('0x25')];_0xa6fef3['queuecallerjoinAt']=_0xc8e065['answertime'];_0xa6fef3[_0xdd50('0x26')]=_0xc8e065[_0xdd50('0x27')];_0xa6fef3[_0xdd50('0x28')]=0x1;_0xa6fef3[_0xdd50('0x29')]=_0xc8e065[_0xdd50('0x2a')];_0xa6fef3[_0xdd50('0x2b')]=_0xc8e065[_0xdd50('0x2c')];_0xa6fef3[_0xdd50('0x2d')]=_0xdd50('0x2e');_0xa6fef3[_0xdd50('0x2f')]='xcally-motion-preview';_0xa6fef3[_0xdd50('0x30')]=0x0;_0xa6fef3[_0xdd50('0x31')]=0x1;_0xa6fef3['lastAssignedTo']=_0xc8e065['membername'];_0xa6fef3[_0xdd50('0x32')]=_0xdd50('0x33');return BPromise[_0xdd50('0x11')]()[_0xdd50('0xd')](voiceQueueReport[_0xdd50('0x34')](_0xa6fef3))[_0xdd50('0xf')](loggerCatch(_0xdd50('0x35')));};exports[_0xdd50('0x36')]=function(_0x3fc1b4,_0x2a17b5){return BPromise[_0xdd50('0x11')]()['then'](cmHopper[_0xdd50('0x36')](_0x3fc1b4,_0x2a17b5))[_0xdd50('0xf')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xdd50('0x37')]=function(_0x1510a7){return BPromise[_0xdd50('0x11')]()[_0xdd50('0xd')](cmHopper['rescheduleContact'](_0x1510a7,!![],!![]))[_0xdd50('0xf')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 1ffc314..1b19760 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 _0xd3cc=['Contact','tags','updatedAt','%s%s','XMD-','toUpper','toLower','updateOriginated','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','responsetime','endtime','logAgent','statedesc','ringtime','starttime','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','scheduledat','add','minutes','ContactId','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','channelAgent','motionChannel','voice','mandatoryDisposition','buildAcw','not_inuse','status','reachable','push','getDiff','diff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','bridgepeer','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','error','inspect','loggerError','logger2','info','getCallerId','isEmpty','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID'];(function(_0x27e995,_0xf51bb2){var _0x209491=function(_0x3f1358){while(--_0x3f1358){_0x27e995['push'](_0x27e995['shift']());}};_0x209491(++_0xf51bb2);}(_0xd3cc,0x6a));var _0xcd3c=function(_0xd369de,_0x4a0b1e){_0xd369de=_0xd369de-0x0;var _0x68c737=_0xd3cc[_0xd369de];return _0x68c737;};'use strict';var util=require(_0xcd3c('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0xcd3c('0x1'))(_0xcd3c('0x2'));var ipAgi=process[_0xcd3c('0x3')][_0xcd3c('0x4')]||_0xcd3c('0x5');function getSeconds(_0x380efc,_0x13d01f){var _0x27a8d2=moment(_0x380efc)[_0xcd3c('0x6')](0x0);var _0x2c70c5=moment(_0x13d01f)[_0xcd3c('0x6')](0x0);return _0x27a8d2['diff'](_0x2c70c5,_0xcd3c('0x7'));}exports['loggerCatch']=function(_0x4f4562){return function(_0x5d4f78){logger[_0xcd3c('0x8')](_0x4f4562,util[_0xcd3c('0x9')](_0x5d4f78,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x1b376e,_0x55c62f){logger['info'](_0x1b376e,util[_0xcd3c('0x9')](_0x55c62f,{'showHidden':![],'depth':null}));};exports[_0xcd3c('0xa')]=function(_0x4fbb63,_0x3dd63d){logger[_0xcd3c('0x8')](_0x4fbb63,util[_0xcd3c('0x9')](_0x3dd63d,{'showHidden':![],'depth':null}));};exports[_0xcd3c('0xb')]=function(_0x3de53c){return function(_0x40e694){logger[_0xcd3c('0xc')](_0x3de53c,util[_0xcd3c('0x9')](_0x40e694,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x2a2e13,_0xce5b68,_0x46a559){return{'message':_0x2a2e13,'unlock':_0xce5b68,'active':_0x46a559};};exports[_0xcd3c('0xd')]=function(_0x5844dd,_0x47e76f,_0x1ce8e8){if(!_['isUndefined'](_0x1ce8e8)&&'string'===typeof _0x1ce8e8&&!_[_0xcd3c('0xe')](_0x1ce8e8)){if(!_[_0xcd3c('0xf')](_0x47e76f)&&_0xcd3c('0x10')===typeof _0x47e76f&&!_[_0xcd3c('0xe')](_0x47e76f)){return util[_0xcd3c('0x11')]('\x22%s\x22\x20<%s>',_0x47e76f,_0x1ce8e8);}return util[_0xcd3c('0x11')](_0xcd3c('0x12'),_0x1ce8e8,_0x1ce8e8);}if(!_[_0xcd3c('0xf')](_0x5844dd)&&_0xcd3c('0x10')===typeof _0x5844dd&&!_[_0xcd3c('0xe')](_0x5844dd)){return _0x5844dd;}return _0xcd3c('0x13');};exports['isActive']=function(_0x50951c){if(_[_0xcd3c('0x14')](_0x50951c)){return![];}return _0x50951c;};exports[_0xcd3c('0x15')]=function(_0x5dc16b,_0x3e541a,_0x4db1e1,_0x4187dc,_0xdfbc90,_0x3997a9){var _0x1ca247={'XMD-QUEUE':_0x3e541a['Queue']?_0x3e541a[_0xcd3c('0x16')][_0xcd3c('0x17')]:'','XMD-CALLERID':_0x4187dc,'XMD-CALLERID-PREVIEW':_0x3997a9?util[_0xcd3c('0x11')](_0xcd3c('0x12'),_0x3997a9[_0xcd3c('0x18')],_0x3997a9[_0xcd3c('0x19')]):_0x4187dc,'XMD-DIALID':_0xdfbc90,'XMD-CONTACTID':_0x3e541a['ContactId'],'XMD-CDRTYPE':_0xcd3c('0x1a'),'CALLERID(all)':_0x4187dc,'XMD-VOICEQUEUEID':_0x3e541a['VoiceQueueId'],'XMD-DIALCHANNEL':_0x4db1e1,'XMD-DIALTIMEOUT':_0x5dc16b[_0xcd3c('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0xcd3c('0x11')](_0xcd3c('0x1c'),_0x5dc16b[_0xcd3c('0x1d')]?'g':'',_[_0xcd3c('0xe')](_0x5dc16b[_0xcd3c('0x1e')])?'':_0xcd3c('0x1f')),'XMD-DIALURL':_0x5dc16b[_0xcd3c('0x20')]||'','XMD-AGI':_0x5dc16b[_0xcd3c('0x21')]?util['format'](_0xcd3c('0x22'),ipAgi,_0x5dc16b[_0xcd3c('0x21')]):'NONE','XMD-AGIAFTER':_0x5dc16b[_0xcd3c('0x1d')]?util[_0xcd3c('0x11')](_0xcd3c('0x22'),ipAgi,_0x5dc16b[_0xcd3c('0x1d')]):_0xcd3c('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x3997a9?_0x3997a9[_0xcd3c('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x3997a9?_0x3997a9[_0xcd3c('0x25')]:'','XMD-DESTINATION':_0xcd3c('0x26'),'SIPADDHEADER':_0xcd3c('0x27')};if(!_[_0xcd3c('0xe')](_0x5dc16b[_0xcd3c('0x1e')])){_0x1ca247[util['format']('%s',_0xcd3c('0x28'))]=_0x5dc16b[_0xcd3c('0x1e')];_0x1ca247[util[_0xcd3c('0x11')]('%s',_0xcd3c('0x29'))]=_0xdfbc90;}if(_0x3e541a&&_0x3e541a[_0xcd3c('0x2a')]){for(var _0x493fcf in _0x3e541a[_0xcd3c('0x2a')]){if(_0x3e541a[_0xcd3c('0x2a')]['hasOwnProperty'](_0x493fcf)){if(!_[_0xcd3c('0x14')](_0x3e541a['Contact'][_0x493fcf])&&_0x493fcf!=='id'&&_0x493fcf!==_0xcd3c('0x2b')&&_0x493fcf!=='createdAt'&&_0x493fcf!==_0xcd3c('0x2c')){_0x1ca247[util[_0xcd3c('0x11')](_0xcd3c('0x2d'),_0xcd3c('0x2e'),_[_0xcd3c('0x2f')](_0x493fcf))]=_0x3e541a[_0xcd3c('0x2a')][_0x493fcf];}}}}return _0x1ca247;};exports['toLowerVariables']=function(_0x91b9cf){var _0x20a186={};for(var _0x1771f4 in _0x91b9cf){if(_0x91b9cf['hasOwnProperty'](_0x1771f4)){_0x20a186[util[_0xcd3c('0x11')]('%s',_[_0xcd3c('0x30')](_0x1771f4))]=_0x91b9cf[_0x1771f4];}}return{'variables':_0x20a186};};exports[_0xcd3c('0x31')]=function(_0x4904e2,_0x19dc07){if(!_['isNil'](_0x4904e2)){if(_0x4904e2[_0xcd3c('0x32')](_0xcd3c('0x33'))){if(_0x4904e2[_0xcd3c('0x33')]>0x0){_0x4904e2[_0xcd3c('0x33')]-=0x1;}else{logger['error'](_0xcd3c('0x34'),_0x19dc07);}}}else{logger[_0xcd3c('0x8')](_0xcd3c('0x35'),_0x19dc07);}};exports[_0xcd3c('0x36')]=function(_0x338696){var _0x3bf5c5=moment()['format'](_0xcd3c('0x37'));_0x338696[_0xcd3c('0x38')]=0xd;_0x338696['statedesc']='Blacklist';_0x338696['starttime']=_0x3bf5c5;_0x338696[_0xcd3c('0x39')]=_0x3bf5c5;_0x338696[_0xcd3c('0x3a')]=_0x3bf5c5;};exports[_0xcd3c('0x3b')]=function(_0x47cd30,_0x3efb17,_0x2c63c0){var _0x5cd890=moment()[_0xcd3c('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x47cd30[_0xcd3c('0x38')]=_0x3efb17;_0x47cd30[_0xcd3c('0x3c')]=_0x2c63c0;_0x47cd30[_0xcd3c('0x39')]=_0x5cd890;_0x47cd30[_0xcd3c('0x3d')]=getSeconds(_0x47cd30['responsetime'],_0x47cd30[_0xcd3c('0x3e')]);};exports['logLookAgent']=function(_0x2d3d00,_0x5a1833,_0x1d0759){_0x2d3d00[_0xcd3c('0x3f')]=_0x5a1833;_0x2d3d00[_0xcd3c('0x40')]=_0x1d0759;};exports[_0xcd3c('0x41')]=function(_0x36fc0a,_0x4c6137,_0x8eb623){var _0x33cd44=moment()[_0xcd3c('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x36fc0a['state']=_0x4c6137;_0x36fc0a['statedesc']=_0x8eb623;_0x36fc0a[_0xcd3c('0x39')]=_0x36fc0a[_0xcd3c('0x39')]?_0x36fc0a[_0xcd3c('0x39')]:_0x33cd44;_0x36fc0a['endtime']=_0x36fc0a[_0xcd3c('0x3a')]?_0x36fc0a[_0xcd3c('0x3a')]:_0x33cd44;_0x36fc0a[_0xcd3c('0x3d')]=getSeconds(_0x36fc0a[_0xcd3c('0x39')]||0x0,_0x36fc0a[_0xcd3c('0x3e')]||0x0);_0x36fc0a[_0xcd3c('0x42')]=_0x36fc0a[_0xcd3c('0x43')]?getSeconds(_0x36fc0a[_0xcd3c('0x3a')],_0x36fc0a['answertime']):0x0;};exports[_0xcd3c('0x44')]=function(_0x3ee1c3){return _0x3ee1c3===_0xcd3c('0x45');};exports[_0xcd3c('0x46')]=function(_0x5ca9f1,_0x33d33a,_0x440bbc,_0x20d641,_0x7ee49c){var _0x49434b=_0x20d641?'RECALL':_0x5ca9f1[_0xcd3c('0x18')];_0x49434b=_0x7ee49c?_0xcd3c('0x47'):_0x49434b;return{'actionid':_0x5ca9f1[_0xcd3c('0x48')],'action':_0xcd3c('0x49'),'channel':_0x5ca9f1['channelAgent'],'callerid':util[_0xcd3c('0x11')]('\x22%s\x22\x20<%s>',_0x49434b,_0x5ca9f1['calleridnum']),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x440bbc,'timeout':(_0x33d33a['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5ca9f1[_0xcd3c('0x48')]};};exports[_0xcd3c('0x4a')]=function(_0x5aff1a){return _0x5aff1a[_0xcd3c('0x4b')]+_0x5aff1a[_0xcd3c('0x4c')]+_0x5aff1a[_0xcd3c('0x4d')]+_0x5aff1a[_0xcd3c('0x4e')]+_0x5aff1a[_0xcd3c('0x4f')];};exports[_0xcd3c('0x50')]=function(_0x3ec623){var _0x470b6b=_[_0xcd3c('0x51')](_0x3ec623);_0x470b6b['state']=0xf;_0x470b6b[_0xcd3c('0x3c')]=_0xcd3c('0x52');return _0x470b6b;};exports['scheduledAt']=function(_0x9a85ab,_0x4c9092,_0x5742ba){var _0x4bc03b={};_0x4bc03b[_0x4c9092]=_0x9a85ab[_0x4c9092];_0x4bc03b[_0xcd3c('0x53')]=![];_0x4bc03b[_0xcd3c('0x54')]=moment()[_0xcd3c('0x55')](_0x5742ba,_0xcd3c('0x56'))[_0xcd3c('0x11')](_0xcd3c('0x37'));_0x4bc03b[_0xcd3c('0x57')]=_0x9a85ab[_0xcd3c('0x57')];_0x4bc03b[_0xcd3c('0x58')]=_0x9a85ab[_0xcd3c('0x58')];_0x4bc03b[_0xcd3c('0x59')]=_0x9a85ab[_0xcd3c('0x59')]||undefined;return _0x4bc03b;};exports[_0xcd3c('0x5a')]=function(_0x3bc060,_0x58f55c){if(!_['isNil'](_0x3bc060)){if(_0x3bc060[_0xcd3c('0x5b')]>0x0){_0x3bc060['pTalking']-=0x1;}else{logger[_0xcd3c('0x8')](_0x58f55c,_0xcd3c('0x5c'));}}else{logger[_0xcd3c('0x8')](_0x58f55c,_0xcd3c('0x5d'));}};exports[_0xcd3c('0x5e')]=function(_0xe96cdd){if(_0xe96cdd<=0x0){return!![];}return![];};exports[_0xcd3c('0x5f')]=function(_0x2c2b7e,_0x2a1bd9,_0x14959e){_0x2c2b7e[_0xcd3c('0x60')]=_0x2a1bd9;_0x2c2b7e[_0xcd3c('0x17')]=_0x2c2b7e[_0xcd3c('0x61')];_0x2c2b7e[_0xcd3c('0x62')]=_0x2c2b7e[_0xcd3c('0x63')];_0x2c2b7e[_0xcd3c('0x64')]=_0xcd3c('0x65');if(_0x14959e){_0x2c2b7e[_0xcd3c('0x66')]=_0x14959e[_0xcd3c('0x66')];}return _0x2c2b7e;};exports[_0xcd3c('0x67')]=function(_0x799de2){var _0x50f342={};_0x50f342[_0xcd3c('0x61')]=_0x799de2[_0xcd3c('0x61')];_0x50f342[_0xcd3c('0x62')]=_0x799de2[_0xcd3c('0x63')];_0x50f342[_0xcd3c('0x48')]=_0x799de2[_0xcd3c('0x48')];return _0x50f342;};exports['agentReadyId']=function(_0x26e562){var _0x5e89d6=[];for(var _0x512554 in _0x26e562){if(_0x26e562[_0xcd3c('0x32')](_0x512554)){if(!_[_0xcd3c('0x14')](_0x26e562[_0x512554])&&_0x26e562[_0x512554]['state']===_0xcd3c('0x68')&&_0x26e562[_0x512554][_0xcd3c('0x69')]===_0xcd3c('0x6a')){_0x5e89d6[_0xcd3c('0x6b')](_0x26e562[_0x512554]['id']);}}}return _0x5e89d6;};exports[_0xcd3c('0x6c')]=function(_0xf1b661){var _0x1ad684=moment()[_0xcd3c('0x6')](0x0);var _0x243a20=moment(_0xf1b661)['milliseconds'](0x0);return _0x1ad684[_0xcd3c('0x6d')](_0x243a20,_0xcd3c('0x7'));};exports[_0xcd3c('0x6e')]=function(_0xe90db5){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xe90db5[_0xcd3c('0x57')],'ListId':_0xe90db5['ListId'],'VoiceQueueId':_0xe90db5[_0xcd3c('0x59')]||undefined,'CampaignId':_0xe90db5[_0xcd3c('0x6f')]||undefined};};exports[_0xcd3c('0x70')]=function(_0x2b8f5b){if(_0x2b8f5b===_0xcd3c('0x48')||_0x2b8f5b===_0xcd3c('0x71')||_0x2b8f5b===_0xcd3c('0x61')||_0x2b8f5b===_0xcd3c('0x72')||_0x2b8f5b===_0xcd3c('0x73')||_0x2b8f5b===_0xcd3c('0x74')||_0x2b8f5b===_0xcd3c('0x3f')||_0x2b8f5b===_0xcd3c('0x63')||_0x2b8f5b===_0xcd3c('0x18')||_0x2b8f5b===_0xcd3c('0x53')||_0x2b8f5b===_0xcd3c('0x19')||_0x2b8f5b===_0xcd3c('0x54')||_0x2b8f5b==='countbusyretry'||_0x2b8f5b===_0xcd3c('0x4c')||_0x2b8f5b===_0xcd3c('0x4d')||_0x2b8f5b===_0xcd3c('0x75')||_0x2b8f5b==='callback'||_0x2b8f5b==='callbackuniqueid'||_0x2b8f5b===_0xcd3c('0x76')||_0x2b8f5b===_0xcd3c('0x77')||_0x2b8f5b===_0xcd3c('0x57')||_0x2b8f5b===_0xcd3c('0x58')||_0x2b8f5b==='UserId'||_0x2b8f5b==='VoiceQueueId'||_0x2b8f5b===_0xcd3c('0x78')||_0x2b8f5b===_0xcd3c('0x79')||_0x2b8f5b===_0xcd3c('0x7a')||_0x2b8f5b==='xmd-phone'||_0x2b8f5b==='xmd-listid'||_0x2b8f5b===_0xcd3c('0x7b')||_0x2b8f5b===_0xcd3c('0x7c')||_0x2b8f5b===_0xcd3c('0x7d')||_0x2b8f5b===_0xcd3c('0x7e')||_0x2b8f5b===_0xcd3c('0x7f')||_0x2b8f5b===_0xcd3c('0x80')||_0x2b8f5b===_0xcd3c('0x81')||_0x2b8f5b==='xmd-callerid'||_0x2b8f5b===_0xcd3c('0x82')||_0x2b8f5b===_0xcd3c('0x83')||_0x2b8f5b==='rtpaudioqos'||_0x2b8f5b===_0xcd3c('0x84')||_0x2b8f5b===_0xcd3c('0x85')||_0x2b8f5b===_0xcd3c('0x86')||_0x2b8f5b===_0xcd3c('0x87')||_0x2b8f5b===_0xcd3c('0x88')||_0x2b8f5b===_0xcd3c('0x89')||_0x2b8f5b===_0xcd3c('0x8a')||_0x2b8f5b===_0xcd3c('0x8b')||_0x2b8f5b===_0xcd3c('0x84')||_0x2b8f5b===_0xcd3c('0x85')||_0x2b8f5b===_0xcd3c('0x86')||_0x2b8f5b==='rtpaudioqosloss'||_0x2b8f5b===_0xcd3c('0x88')||_0x2b8f5b==='rtpaudioqosrtt'||_0x2b8f5b==='rtpaudioqosrttbridged'||_0x2b8f5b===_0xcd3c('0x8c')||_0x2b8f5b==='bridgepvtcallid'||_0x2b8f5b===_0xcd3c('0x38')||_0x2b8f5b===_0xcd3c('0x3c')){return![];}return!![];};exports[_0xcd3c('0x8d')]=function(_0x114a3b,_0x5cd3cf){var _0x4e098f,_0x3c846c,_0x597996;if(_0x5cd3cf<=0x0){_0x5cd3cf=0x1;}_0x4e098f=new RegExp('\x5cw{0,'+_0x5cd3cf+'}$');_0x3c846c=Math['pow'](0xa,_0x5cd3cf-0x1);_0x597996=Math[_0xcd3c('0x8e')](0xa,_0x5cd3cf)-0x1;return util[_0xcd3c('0x11')]('%s',_[_0xcd3c('0x8f')](_0x114a3b,_0x4e098f,_[_0xcd3c('0x90')](_0x3c846c,_0x597996)));};exports[_0xcd3c('0x91')]=function(_0x13cf79){var _0x349694=_0x13cf79[_0xcd3c('0x92')](/"(.*?)"/);return _0x349694?_0x349694[0x1]:_0x13cf79;};exports[_0xcd3c('0x93')]=function(_0x5a9909){var _0x2354f0=_0x5a9909[_0xcd3c('0x92')](/<(.*?)>/);return _0x2354f0?_0x2354f0[0x1]:_0x5a9909;}; \ No newline at end of file +var _0x8d71=['XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','error','inspect','logger','info','loggerError','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','addVariables','Queue','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','updatedAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','endtime','responsetime','ringtime','logLookAgent','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','calleridname','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','active','scheduledat','add','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','name','queue','voice','mandatoryDisposition','interface','agentReadyId','status','getDiff','ListId','CampaignId','filterKey','idContact','type','campaigntype','callbackuniqueid','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','util','lodash','moment','../../../../config/logger','preview','env'];(function(_0x309d93,_0x157662){var _0x2dd61d=function(_0x25ff34){while(--_0x25ff34){_0x309d93['push'](_0x309d93['shift']());}};_0x2dd61d(++_0x157662);}(_0x8d71,0x18c));var _0x18d7=function(_0x308fd1,_0x6e2629){_0x308fd1=_0x308fd1-0x0;var _0x27784f=_0x8d71[_0x308fd1];return _0x27784f;};'use strict';var util=require(_0x18d7('0x0'));var _=require(_0x18d7('0x1'));var moment=require(_0x18d7('0x2'));var logger=require(_0x18d7('0x3'))(_0x18d7('0x4'));var ipAgi=process[_0x18d7('0x5')][_0x18d7('0x6')]||_0x18d7('0x7');function getSeconds(_0x331822,_0x36ae83){var _0x2ea267=moment(_0x331822)['milliseconds'](0x0);var _0x1c44be=moment(_0x36ae83)[_0x18d7('0x8')](0x0);return _0x2ea267[_0x18d7('0x9')](_0x1c44be,_0x18d7('0xa'));}exports['loggerCatch']=function(_0x2ca125){return function(_0x13a382){logger[_0x18d7('0xb')](_0x2ca125,util[_0x18d7('0xc')](_0x13a382,{'showHidden':![],'depth':null}));};};exports[_0x18d7('0xd')]=function(_0x5bc43d,_0x1379df){logger[_0x18d7('0xe')](_0x5bc43d,util[_0x18d7('0xc')](_0x1379df,{'showHidden':![],'depth':null}));};exports[_0x18d7('0xf')]=function(_0x57a204,_0x49008e){logger[_0x18d7('0xb')](_0x57a204,util[_0x18d7('0xc')](_0x49008e,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x24b8e0){return function(_0x47e004){logger['info'](_0x24b8e0,util[_0x18d7('0xc')](_0x47e004,{'showHidden':![],'depth':null}));};};exports[_0x18d7('0x10')]=function(_0x447f84,_0x5337be,_0x30630a){return{'message':_0x447f84,'unlock':_0x5337be,'active':_0x30630a};};exports[_0x18d7('0x11')]=function(_0x1fedad,_0x1566b2,_0x22a63b){if(!_[_0x18d7('0x12')](_0x22a63b)&&_0x18d7('0x13')===typeof _0x22a63b&&!_[_0x18d7('0x14')](_0x22a63b)){if(!_['isUndefined'](_0x1566b2)&&_0x18d7('0x13')===typeof _0x1566b2&&!_[_0x18d7('0x14')](_0x1566b2)){return util[_0x18d7('0x15')]('\x22%s\x22\x20<%s>',_0x1566b2,_0x22a63b);}return util[_0x18d7('0x15')](_0x18d7('0x16'),_0x22a63b,_0x22a63b);}if(!_[_0x18d7('0x12')](_0x1fedad)&&'string'===typeof _0x1fedad&&!_['isEmpty'](_0x1fedad)){return _0x1fedad;}return _0x18d7('0x17');};exports['isActive']=function(_0x166d18){if(_['isNil'](_0x166d18)){return![];}return _0x166d18;};exports[_0x18d7('0x18')]=function(_0x4c53fa,_0x1c29f8,_0x451897,_0x3c8e2b,_0x21a10a,_0x58beeb){var _0xd75f6f={'XMD-QUEUE':_0x1c29f8[_0x18d7('0x19')]?_0x1c29f8['Queue']['name']:'','XMD-CALLERID':_0x3c8e2b,'XMD-CALLERID-PREVIEW':_0x58beeb?util[_0x18d7('0x15')]('\x22%s\x22\x20<%s>',_0x58beeb['calleridname'],_0x58beeb[_0x18d7('0x1a')]):_0x3c8e2b,'XMD-DIALID':_0x21a10a,'XMD-CONTACTID':_0x1c29f8[_0x18d7('0x1b')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x3c8e2b,'XMD-VOICEQUEUEID':_0x1c29f8[_0x18d7('0x1c')],'XMD-DIALCHANNEL':_0x451897,'XMD-DIALTIMEOUT':_0x4c53fa[_0x18d7('0x1d')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x18d7('0x1e'),_0x4c53fa[_0x18d7('0x1f')]?'g':'',_[_0x18d7('0x14')](_0x4c53fa['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x4c53fa['dialPreviewUrl']||'','XMD-AGI':_0x4c53fa[_0x18d7('0x20')]?util['format'](_0x18d7('0x21'),ipAgi,_0x4c53fa['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x4c53fa[_0x18d7('0x1f')]?util[_0x18d7('0x15')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4c53fa[_0x18d7('0x1f')]):_0x18d7('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x58beeb?_0x58beeb[_0x18d7('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x58beeb?_0x58beeb[_0x18d7('0x24')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x18d7('0x25')};if(!_[_0x18d7('0x14')](_0x4c53fa['monitor_format'])){_0xd75f6f[util[_0x18d7('0x15')]('%s',_0x18d7('0x26'))]=_0x4c53fa[_0x18d7('0x27')];_0xd75f6f[util[_0x18d7('0x15')]('%s',_0x18d7('0x28'))]=_0x21a10a;}if(_0x1c29f8&&_0x1c29f8['Contact']){for(var _0x1ab69d in _0x1c29f8[_0x18d7('0x29')]){if(_0x1c29f8['Contact'][_0x18d7('0x2a')](_0x1ab69d)){if(!_[_0x18d7('0x2b')](_0x1c29f8[_0x18d7('0x29')][_0x1ab69d])&&_0x1ab69d!=='id'&&_0x1ab69d!=='tags'&&_0x1ab69d!=='createdAt'&&_0x1ab69d!==_0x18d7('0x2c')){_0xd75f6f[util[_0x18d7('0x15')](_0x18d7('0x2d'),_0x18d7('0x2e'),_[_0x18d7('0x2f')](_0x1ab69d))]=_0x1c29f8[_0x18d7('0x29')][_0x1ab69d];}}}}return _0xd75f6f;};exports[_0x18d7('0x30')]=function(_0x3e728d){var _0x5d4c97={};for(var _0x265eb5 in _0x3e728d){if(_0x3e728d[_0x18d7('0x2a')](_0x265eb5)){_0x5d4c97[util[_0x18d7('0x15')]('%s',_['toLower'](_0x265eb5))]=_0x3e728d[_0x265eb5];}}return{'variables':_0x5d4c97};};exports[_0x18d7('0x31')]=function(_0x542b1f,_0x14655a){if(!_[_0x18d7('0x2b')](_0x542b1f)){if(_0x542b1f[_0x18d7('0x2a')](_0x18d7('0x32'))){if(_0x542b1f[_0x18d7('0x32')]>0x0){_0x542b1f[_0x18d7('0x32')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x14655a);}}}else{logger[_0x18d7('0xb')](_0x18d7('0x33'),_0x14655a);}};exports['logBlacklist']=function(_0x453e67){var _0x416030=moment()[_0x18d7('0x15')](_0x18d7('0x34'));_0x453e67[_0x18d7('0x35')]=0xd;_0x453e67[_0x18d7('0x36')]=_0x18d7('0x37');_0x453e67[_0x18d7('0x38')]=_0x416030;_0x453e67['responsetime']=_0x416030;_0x453e67[_0x18d7('0x39')]=_0x416030;};exports['logAgent']=function(_0x5175c2,_0xafd3b3,_0x5a462a){var _0x5e4a3e=moment()['format'](_0x18d7('0x34'));_0x5175c2[_0x18d7('0x35')]=_0xafd3b3;_0x5175c2[_0x18d7('0x36')]=_0x5a462a;_0x5175c2[_0x18d7('0x3a')]=_0x5e4a3e;_0x5175c2[_0x18d7('0x3b')]=getSeconds(_0x5175c2['responsetime'],_0x5175c2[_0x18d7('0x38')]);};exports[_0x18d7('0x3c')]=function(_0x25895e,_0x2b472b,_0x55e158){_0x25895e['membername']=_0x2b472b;_0x25895e[_0x18d7('0x3d')]=_0x55e158;};exports[_0x18d7('0x3e')]=function(_0x4b98fd,_0x29b98e,_0x2dde1a){var _0x40ced1=moment()[_0x18d7('0x15')](_0x18d7('0x34'));_0x4b98fd[_0x18d7('0x35')]=_0x29b98e;_0x4b98fd['statedesc']=_0x2dde1a;_0x4b98fd['responsetime']=_0x4b98fd['responsetime']?_0x4b98fd[_0x18d7('0x3a')]:_0x40ced1;_0x4b98fd[_0x18d7('0x39')]=_0x4b98fd[_0x18d7('0x39')]?_0x4b98fd[_0x18d7('0x39')]:_0x40ced1;_0x4b98fd[_0x18d7('0x3b')]=getSeconds(_0x4b98fd[_0x18d7('0x3a')]||0x0,_0x4b98fd['starttime']||0x0);_0x4b98fd[_0x18d7('0x3f')]=_0x4b98fd[_0x18d7('0x40')]?getSeconds(_0x4b98fd[_0x18d7('0x39')],_0x4b98fd[_0x18d7('0x40')]):0x0;};exports[_0x18d7('0x41')]=function(_0x110fd8){return _0x110fd8===_0x18d7('0x42');};exports[_0x18d7('0x43')]=function(_0x17aeef,_0x59b36f,_0x161913,_0x586aaf,_0x338bea){var _0x26803a=_0x586aaf?_0x18d7('0x44'):_0x17aeef[_0x18d7('0x45')];_0x26803a=_0x338bea?_0x18d7('0x46'):_0x26803a;return{'actionid':_0x17aeef[_0x18d7('0x47')],'action':_0x18d7('0x48'),'channel':_0x17aeef[_0x18d7('0x49')],'callerid':util['format'](_0x18d7('0x16'),_0x26803a,_0x17aeef['calleridnum']),'Exten':_0x18d7('0x4a'),'Context':_0x18d7('0x4b'),'Priority':'1','variable':_0x161913,'timeout':(_0x59b36f[_0x18d7('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x17aeef[_0x18d7('0x47')]};};exports['totalGlobal']=function(_0xc34998){return _0xc34998[_0x18d7('0x4d')]+_0xc34998[_0x18d7('0x4e')]+_0xc34998[_0x18d7('0x4f')]+_0xc34998[_0x18d7('0x50')]+_0xc34998[_0x18d7('0x51')];};exports[_0x18d7('0x52')]=function(_0x40b2f8){var _0x4a9c89=_['clone'](_0x40b2f8);_0x4a9c89[_0x18d7('0x35')]=0xf;_0x4a9c89[_0x18d7('0x36')]=_0x18d7('0x53');return _0x4a9c89;};exports['scheduledAt']=function(_0x27b4df,_0x124d17,_0x54cdb5){var _0xa6936c={};_0xa6936c[_0x124d17]=_0x27b4df[_0x124d17];_0xa6936c[_0x18d7('0x54')]=![];_0xa6936c[_0x18d7('0x55')]=moment()[_0x18d7('0x56')](_0x54cdb5,'minutes')[_0x18d7('0x15')](_0x18d7('0x34'));_0xa6936c[_0x18d7('0x1b')]=_0x27b4df[_0x18d7('0x1b')];_0xa6936c['ListId']=_0x27b4df['ListId'];_0xa6936c[_0x18d7('0x1c')]=_0x27b4df[_0x18d7('0x1c')]||undefined;return _0xa6936c;};exports['decrementTalkink']=function(_0x2bb78b,_0x58efe5){if(!_[_0x18d7('0x2b')](_0x2bb78b)){if(_0x2bb78b[_0x18d7('0x57')]>0x0){_0x2bb78b[_0x18d7('0x57')]-=0x1;}else{logger['error'](_0x58efe5,_0x18d7('0x58'));}}else{logger[_0x18d7('0xb')](_0x58efe5,_0x18d7('0x59'));}};exports['IsNotLoggedIn']=function(_0x49daf8){if(_0x49daf8<=0x0){return!![];}return![];};exports[_0x18d7('0x5a')]=function(_0x3c21b1,_0xe52087,_0x2c9a33){_0x3c21b1[_0x18d7('0x5b')]=_0xe52087;_0x3c21b1[_0x18d7('0x5c')]=_0x3c21b1[_0x18d7('0x5d')];_0x3c21b1['interface']=_0x3c21b1[_0x18d7('0x49')];_0x3c21b1['motionChannel']=_0x18d7('0x5e');if(_0x2c9a33){_0x3c21b1['mandatoryDisposition']=_0x2c9a33[_0x18d7('0x5f')];}return _0x3c21b1;};exports['buildAcw']=function(_0x559f49){var _0x47ac86={};_0x47ac86[_0x18d7('0x5d')]=_0x559f49[_0x18d7('0x5d')];_0x47ac86[_0x18d7('0x60')]=_0x559f49['channelAgent'];_0x47ac86[_0x18d7('0x47')]=_0x559f49[_0x18d7('0x47')];return _0x47ac86;};exports[_0x18d7('0x61')]=function(_0x2e7dfb){var _0x168522=[];for(var _0x1febee in _0x2e7dfb){if(_0x2e7dfb['hasOwnProperty'](_0x1febee)){if(!_[_0x18d7('0x2b')](_0x2e7dfb[_0x1febee])&&_0x2e7dfb[_0x1febee][_0x18d7('0x35')]==='not_inuse'&&_0x2e7dfb[_0x1febee][_0x18d7('0x62')]==='reachable'){_0x168522['push'](_0x2e7dfb[_0x1febee]['id']);}}}return _0x168522;};exports[_0x18d7('0x63')]=function(_0x457420){var _0x2bae02=moment()[_0x18d7('0x8')](0x0);var _0x566432=moment(_0x457420)[_0x18d7('0x8')](0x0);return _0x2bae02[_0x18d7('0x9')](_0x566432,'seconds');};exports['createBody']=function(_0xf3d231){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xf3d231[_0x18d7('0x1b')],'ListId':_0xf3d231[_0x18d7('0x64')],'VoiceQueueId':_0xf3d231[_0x18d7('0x1c')]||undefined,'CampaignId':_0xf3d231[_0x18d7('0x65')]||undefined};};exports[_0x18d7('0x66')]=function(_0x55120b){if(_0x55120b===_0x18d7('0x47')||_0x55120b===_0x18d7('0x67')||_0x55120b===_0x18d7('0x5d')||_0x55120b===_0x18d7('0x68')||_0x55120b===_0x18d7('0x69')||_0x55120b==='dialAnswer'||_0x55120b==='membername'||_0x55120b===_0x18d7('0x49')||_0x55120b===_0x18d7('0x45')||_0x55120b===_0x18d7('0x54')||_0x55120b==='calleridnum'||_0x55120b===_0x18d7('0x55')||_0x55120b===_0x18d7('0x4d')||_0x55120b===_0x18d7('0x4e')||_0x55120b===_0x18d7('0x4f')||_0x55120b==='countglobal'||_0x55120b==='callback'||_0x55120b===_0x18d7('0x6a')||_0x55120b===_0x18d7('0x6b')||_0x55120b===_0x18d7('0x6c')||_0x55120b===_0x18d7('0x1b')||_0x55120b===_0x18d7('0x64')||_0x55120b===_0x18d7('0x3d')||_0x55120b===_0x18d7('0x1c')||_0x55120b==='sipcallid'||_0x55120b===_0x18d7('0x6d')||_0x55120b===_0x18d7('0x6e')||_0x55120b===_0x18d7('0x6f')||_0x55120b==='xmd-listid'||_0x55120b===_0x18d7('0x70')||_0x55120b===_0x18d7('0x71')||_0x55120b==='xmd-dialoptions'||_0x55120b===_0x18d7('0x72')||_0x55120b==='xmd-dialchannel'||_0x55120b===_0x18d7('0x73')||_0x55120b===_0x18d7('0x74')||_0x55120b===_0x18d7('0x75')||_0x55120b==='xmd-agiafter'||_0x55120b===_0x18d7('0x76')||_0x55120b==='rtpaudioqos'||_0x55120b===_0x18d7('0x77')||_0x55120b===_0x18d7('0x78')||_0x55120b===_0x18d7('0x79')||_0x55120b===_0x18d7('0x7a')||_0x55120b===_0x18d7('0x7b')||_0x55120b===_0x18d7('0x7c')||_0x55120b===_0x18d7('0x7d')||_0x55120b===_0x18d7('0x7e')||_0x55120b==='rtpaudioqosbridged'||_0x55120b===_0x18d7('0x78')||_0x55120b==='rtpaudioqosjitterbridged'||_0x55120b==='rtpaudioqosloss'||_0x55120b===_0x18d7('0x7b')||_0x55120b===_0x18d7('0x7c')||_0x55120b===_0x18d7('0x7d')||_0x55120b===_0x18d7('0x7f')||_0x55120b==='bridgepvtcallid'||_0x55120b===_0x18d7('0x35')||_0x55120b===_0x18d7('0x36')){return![];}return!![];};exports[_0x18d7('0x80')]=function(_0x16ccd8,_0x395d7d){var _0x4a04aa,_0x2db768,_0x195abc;if(_0x395d7d<=0x0){_0x395d7d=0x1;}_0x4a04aa=new RegExp(_0x18d7('0x81')+_0x395d7d+'}$');_0x2db768=Math[_0x18d7('0x82')](0xa,_0x395d7d-0x1);_0x195abc=Math[_0x18d7('0x82')](0xa,_0x395d7d)-0x1;return util[_0x18d7('0x15')]('%s',_['replace'](_0x16ccd8,_0x4a04aa,_[_0x18d7('0x83')](_0x2db768,_0x195abc)));};exports[_0x18d7('0x84')]=function(_0x35ad9a){var _0x833a51=_0x35ad9a[_0x18d7('0x85')](/"(.*?)"/);return _0x833a51?_0x833a51[0x1]:_0x35ad9a;};exports['extractCalleridNumber']=function(_0x3224b7){var _0x16a644=_0x3224b7[_0x18d7('0x85')](/<(.*?)>/);return _0x16a644?_0x16a644[0x1]:_0x3224b7;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 012d345..885ff01 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 _0x6265=['queueadd','string','number','boolean','queueremove','queuepause','reload','voicechannel','voicequeuechannelredirect'];(function(_0x38ce4c,_0xfdbe8c){var _0x5d4544=function(_0x503537){while(--_0x503537){_0x38ce4c['push'](_0x38ce4c['shift']());}};_0x5d4544(++_0xfdbe8c);}(_0x6265,0x14d));var _0x5626=function(_0x4bbab5,_0x2956f9){_0x4bbab5=_0x4bbab5-0x0;var _0x5045da=_0x6265[_0x4bbab5];return _0x5045da;};'use strict';exports[_0x5626('0x0')]={'queue':{'type':_0x5626('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x5626('0x2'),'required':![]},'paused':{'type':_0x5626('0x3'),'required':![]}};exports[_0x5626('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x5626('0x1'),'required':!![]}};exports[_0x5626('0x5')]={'interface':{'type':_0x5626('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports[_0x5626('0x6')]={'module':{'type':_0x5626('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x5626('0x1'),'required':!![]}};exports[_0x5626('0x7')]={'uniqueid':{'type':_0x5626('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x5626('0x1')},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x5626('0x1'),'required':!![]}};exports[_0x5626('0x8')]={'uniqueid':{'type':_0x5626('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x3887=['number','boolean','queueremove','voicequeuechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string'];(function(_0x114490,_0x85dde8){var _0x548a27=function(_0x4742bc){while(--_0x4742bc){_0x114490['push'](_0x114490['shift']());}};_0x548a27(++_0x85dde8);}(_0x3887,0x1be));var _0x7388=function(_0x22ba54,_0x3c105b){_0x22ba54=_0x22ba54-0x0;var _0x17af5b=_0x3887[_0x22ba54];return _0x17af5b;};'use strict';exports[_0x7388('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x7388('0x1'),'required':!![]},'penalty':{'type':_0x7388('0x2'),'required':![]},'paused':{'type':_0x7388('0x3'),'required':![]}};exports[_0x7388('0x4')]={'queue':{'type':_0x7388('0x1'),'required':!![]},'interface':{'type':_0x7388('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x7388('0x1'),'required':!![]},'paused':{'type':_0x7388('0x3')},'reason':{'type':_0x7388('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x7388('0x1'),'required':![]}};exports[_0x7388('0x5')]={'uniqueid':{'type':_0x7388('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x7388('0x1'),'required':!![]},'filename':{'type':_0x7388('0x1')},'format':{'type':_0x7388('0x1')},'mixmonitorid':{'type':_0x7388('0x1')}};exports[_0x7388('0x6')]={'uniqueid':{'type':_0x7388('0x1'),'required':!![]}};exports[_0x7388('0x7')]={'uniqueid':{'type':_0x7388('0x1'),'required':!![]},'exten':{'type':_0x7388('0x1'),'required':!![]},'context':{'type':_0x7388('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index f2c7e9f..310656c 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 _0xeca5=['sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','sumBillable','queuecallerleaveAt','outbound','ANSWERED','duration','billableseconds','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','util','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','triggers','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','zohoAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','interface','total','sumHoldTime','sumDuration','isEmpty','answered','unmanaged','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','length','isNil','isUndefined','agents','initVoiceQueues','initTriggers','initTemplates','freshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts'];(function(_0x504f7b,_0x1ac4e0){var _0x2b0904=function(_0x28e51d){while(--_0x28e51d){_0x504f7b['push'](_0x504f7b['shift']());}};_0x2b0904(++_0x1ac4e0);}(_0xeca5,0x1be));var _0x5eca=function(_0x3605ea,_0x19944e){_0x3605ea=_0x3605ea-0x0;var _0x1fcb2f=_0xeca5[_0x3605ea];return _0x1fcb2f;};'use strict';var BPromise=require('bluebird');var util=require(_0x5eca('0x0'));var _=require('lodash');var moment=require(_0x5eca('0x1'));var Agent=require('../model/agent');var Telephone=require(_0x5eca('0x2'));var Trunk=require(_0x5eca('0x3'));var VoiceQueue=require(_0x5eca('0x4'));var Trigger=require(_0x5eca('0x5'));var Template=require(_0x5eca('0x6'));var Campaign=require(_0x5eca('0x7'));var VoiceExtension=require(_0x5eca('0x8'));var ZendeskAccount=require(_0x5eca('0x9'));var SalesforceAccount=require(_0x5eca('0xa'));var FreshdeskAccount=require(_0x5eca('0xb'));var SugarcrmAccount=require(_0x5eca('0xc'));var ZohoAccount=require(_0x5eca('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x5eca('0xe'));var ServicenowAccount=require(_0x5eca('0xf'));var Dynamics365Account=require(_0x5eca('0x10'));var FreshsalesAccount=require(_0x5eca('0x11'));var FaxAccount=require(_0x5eca('0x12'));var Realtime=function(){this['agents']={};this[_0x5eca('0x13')]={};this[_0x5eca('0x14')]={};this[_0x5eca('0x15')]={};this[_0x5eca('0x16')]={};this[_0x5eca('0x17')]={};this[_0x5eca('0x18')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x5eca('0x19')]={};this[_0x5eca('0x1a')]={};this[_0x5eca('0x1b')]={};this[_0x5eca('0x1c')]={};this[_0x5eca('0x1d')]={};this[_0x5eca('0x1e')]={};this[_0x5eca('0x1f')]={};this[_0x5eca('0x20')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0x5eca('0x21')]={};this['deskAccounts']={};this[_0x5eca('0x22')]={};this[_0x5eca('0x23')]={};this[_0x5eca('0x24')]={};this['freshsalesAccounts']={};this[_0x5eca('0x25')]={};};function freeIsNotKey(_0xb2afe4,_0x1553ff,_0x43b2d2){var _0x431c01=_[_0x5eca('0x26')](_0xb2afe4,function(_0x544213,_0x5d1bff){return _0x544213[_0x43b2d2];});for(var _0xcc7ede in _0x1553ff){if(_0x1553ff[_0x5eca('0x27')](_0xcc7ede)){if(!_0x431c01[_0xcc7ede]){delete _0x1553ff[_0xcc7ede];}}}}function freeIsNotKeySip(_0x10d5fc,_0xd7d2bc){var _0x516361=_[_0x5eca('0x26')](_0x10d5fc,function(_0x16c3f5,_0x3faf5f){return util[_0x5eca('0x28')](_0x5eca('0x29'),_0x16c3f5[_0x5eca('0x2a')]);});for(var _0x1b04b3 in _0xd7d2bc){if(_0xd7d2bc[_0x5eca('0x27')](_0x1b04b3)){if(!_0x516361[_0x1b04b3]){delete _0xd7d2bc[_0x1b04b3];}}}}function freeIsNotKeyAgent(_0x53bc37,_0x3dc0e2){var _0x510d40=_[_0x5eca('0x26')](_0x53bc37,function(_0x1b62f9,_0x286c21){var _0x5856e8=_['isNil'](_0x1b62f9[_0x5eca('0x2b')])?util[_0x5eca('0x28')](_0x5eca('0x29'),_0x1b62f9['name']):_0x1b62f9[_0x5eca('0x2b')];return _0x5856e8;});for(var _0x156992 in _0x3dc0e2){if(_0x3dc0e2[_0x5eca('0x27')](_0x156992)){if(!_0x510d40[_0x156992]){delete _0x3dc0e2[_0x156992];}}}}function clearVoiceCallReports(_0x301f01){_0x301f01[_0x5eca('0x2c')]=0x0;_0x301f01['answered']=0x0;_0x301f01[_0x5eca('0x2d')]=0x0;_0x301f01[_0x5eca('0x2e')]=0x0;_0x301f01['sumBillable']=0x0;}function clearCampaigns(_0x197d0c){if(!_[_0x5eca('0x2f')](_0x197d0c)){for(var _0x273a74 in _0x197d0c){if(_0x197d0c[_0x5eca('0x27')](_0x273a74)){_0x197d0c[_0x273a74]['ivrTotalCallsDays']=0x0;_0x197d0c[_0x273a74]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x1d7a5d){if(!_['isEmpty'](_0x1d7a5d)){for(var _0x213e4b in _0x1d7a5d){if(_0x1d7a5d[_0x5eca('0x27')](_0x213e4b)){_0x1d7a5d[_0x213e4b][_0x5eca('0x2c')]=0x0;_0x1d7a5d[_0x213e4b][_0x5eca('0x30')]=0x0;_0x1d7a5d[_0x213e4b][_0x5eca('0x31')]=0x0;_0x1d7a5d[_0x213e4b]['abandoned']=0x0;_0x1d7a5d[_0x213e4b][_0x5eca('0x2d')]=0x0;_0x1d7a5d[_0x213e4b][_0x5eca('0x2e')]=0x0;_0x1d7a5d[_0x213e4b]['sumBillable']=0x0;_0x1d7a5d[_0x213e4b][_0x5eca('0x32')]=0x0;_0x1d7a5d[_0x213e4b][_0x5eca('0x33')]=0x0;_0x1d7a5d[_0x213e4b][_0x5eca('0x34')]=0x0;_0x1d7a5d[_0x213e4b][_0x5eca('0x35')]=0x0;_0x1d7a5d[_0x213e4b][_0x5eca('0x36')]=0x0;_0x1d7a5d[_0x213e4b][_0x5eca('0x37')]=0x0;_0x1d7a5d[_0x213e4b]['outboundDropCallsDayTimeout']=0x0;_0x1d7a5d[_0x213e4b][_0x5eca('0x38')]=0x0;_0x1d7a5d[_0x213e4b]['outboundBlacklistCallsDay']=0x0;_0x1d7a5d[_0x213e4b]['outboundOriginateFailureCallsDay']=0x0;_0x1d7a5d[_0x213e4b][_0x5eca('0x39')]=0x0;_0x1d7a5d[_0x213e4b][_0x5eca('0x3a')]=0x0;_0x1d7a5d[_0x213e4b]['outboundAnswerAgiCallsDay']=0x0;_0x1d7a5d[_0x213e4b][_0x5eca('0x3b')]=0x0;_0x1d7a5d[_0x213e4b][_0x5eca('0x3c')]=!![];}}}}Realtime[_0x5eca('0x3d')][_0x5eca('0x3e')]=function(_0x3d732e,_0x1ac9a5){for(var _0x4298c6 in _0x1ac9a5){if(_0x3d732e[_0x5eca('0x27')](_0x4298c6)){_0x3d732e[_0x4298c6]=_0x1ac9a5[_0x4298c6];}}};Realtime['prototype']['initAgents']=function(){var _0x5b9a40=this;return function(_0x59ba99){if(_0x59ba99){freeIsNotKeyAgent(_0x59ba99,_0x5b9a40['agents']);for(var _0x4cdf6c=0x0,_0x458f11={},_0x398ace={};_0x4cdf6c<_0x59ba99[_0x5eca('0x3f')];_0x4cdf6c+=0x1){_0x458f11=_0x59ba99[_0x4cdf6c];var _0x56cdec=_[_0x5eca('0x40')](_0x458f11['interface'])?util[_0x5eca('0x28')](_0x5eca('0x29'),_0x458f11[_0x5eca('0x2a')]):_0x458f11[_0x5eca('0x2b')];if(_[_0x5eca('0x41')](_0x5b9a40[_0x5eca('0x42')][_0x56cdec])){_0x5b9a40[_0x5eca('0x42')][_0x56cdec]=new Agent(_0x458f11);}else{_0x5b9a40[_0x5eca('0x3e')](_0x5b9a40[_0x5eca('0x42')][_0x56cdec],_0x458f11);}}}return _0x5b9a40['agents'];};};Realtime['prototype']['initTelephones']=function(){var _0x1fc735=this;return function(_0x591ce7){if(_0x591ce7){freeIsNotKeySip(_0x591ce7,_0x1fc735[_0x5eca('0x13')]);for(var _0x541a2d=0x0,_0x26a957={},_0x5a819e={};_0x541a2d<_0x591ce7[_0x5eca('0x3f')];_0x541a2d+=0x1){_0x26a957=_0x591ce7[_0x541a2d];if(_['isUndefined'](_0x1fc735[_0x5eca('0x13')][util[_0x5eca('0x28')](_0x5eca('0x29'),_0x26a957[_0x5eca('0x2a')])])){_0x1fc735[_0x5eca('0x13')][util[_0x5eca('0x28')]('SIP/%s',_0x26a957[_0x5eca('0x2a')])]=new Telephone(_0x26a957);}else{_0x1fc735[_0x5eca('0x3e')](_0x1fc735['telephones'][util[_0x5eca('0x28')]('SIP/%s',_0x26a957[_0x5eca('0x2a')])],_0x26a957);}}}return _0x1fc735[_0x5eca('0x13')];};};Realtime[_0x5eca('0x3d')]['initTrunks']=function(){var _0x5715f3=this;return function(_0x4844e1){if(_0x4844e1){freeIsNotKeySip(_0x4844e1,_0x5715f3[_0x5eca('0x14')]);for(var _0x5772ba=0x0,_0x510e5a={},_0x17534e={};_0x5772ba<_0x4844e1[_0x5eca('0x3f')];_0x5772ba+=0x1){_0x510e5a=_0x4844e1[_0x5772ba];if(_[_0x5eca('0x41')](_0x5715f3['trunks'][util[_0x5eca('0x28')](_0x5eca('0x29'),_0x510e5a[_0x5eca('0x2a')])])){_0x5715f3['trunks'][util[_0x5eca('0x28')]('SIP/%s',_0x510e5a[_0x5eca('0x2a')])]=new Trunk(_0x510e5a);}else{_0x5715f3[_0x5eca('0x3e')](_0x5715f3['trunks'][util['format'](_0x5eca('0x29'),_0x510e5a['name'])],_0x510e5a);}}}return _0x5715f3[_0x5eca('0x14')];};};Realtime['prototype'][_0x5eca('0x43')]=function(){var _0x118332=this;return function(_0x5819fc){if(_0x5819fc){freeIsNotKey(_0x5819fc,_0x118332[_0x5eca('0x15')],_0x5eca('0x2a'));for(var _0xdb078f=0x0,_0x596ff7={},_0x5840ca={};_0xdb078f<_0x5819fc['length'];_0xdb078f+=0x1){_0x596ff7=_0x5819fc[_0xdb078f];if(_[_0x5eca('0x41')](_0x118332[_0x5eca('0x15')][_0x596ff7[_0x5eca('0x2a')]])){_0x118332[_0x5eca('0x15')][_0x596ff7['name']]=new VoiceQueue(_0x596ff7);}else{_0x118332[_0x5eca('0x3e')](_0x118332[_0x5eca('0x15')][_0x596ff7[_0x5eca('0x2a')]],_0x596ff7);}}}return _0x118332[_0x5eca('0x15')];};};Realtime[_0x5eca('0x3d')][_0x5eca('0x44')]=function(){var _0x58523e=this;return function(_0x50d44d){if(_0x50d44d){freeIsNotKey(_0x50d44d,_0x58523e[_0x5eca('0x16')],'id');for(var _0x992a2d=0x0,_0x1c0fb2={},_0x5551dc={};_0x992a2d<_0x50d44d['length'];_0x992a2d+=0x1){_0x1c0fb2=_0x50d44d[_0x992a2d];if(_['isUndefined'](_0x58523e['triggers'][_0x1c0fb2['id']])){_0x58523e[_0x5eca('0x16')][_0x1c0fb2['id']]=new Trigger(_0x1c0fb2);}else{_0x58523e[_0x5eca('0x3e')](_0x58523e[_0x5eca('0x16')][_0x1c0fb2['id']],_0x1c0fb2);}}}return _0x58523e[_0x5eca('0x16')];};};Realtime['prototype'][_0x5eca('0x45')]=function(){var _0x3aad01=this;return function(_0xc8212a){if(_0xc8212a){freeIsNotKey(_0xc8212a,_0x3aad01['templates'],'id');for(var _0x2c782e=0x0,_0x42a3da={},_0x2d10d9={};_0x2c782e<_0xc8212a[_0x5eca('0x3f')];_0x2c782e+=0x1){_0x42a3da=_0xc8212a[_0x2c782e];if(_[_0x5eca('0x41')](_0x3aad01['templates'][_0x42a3da['id']])){_0x3aad01[_0x5eca('0x18')][_0x42a3da['id']]=new Template(_0x42a3da);}else{_0x3aad01[_0x5eca('0x3e')](_0x3aad01[_0x5eca('0x18')][_0x42a3da['id']],_0x42a3da);}}}return _0x3aad01[_0x5eca('0x18')];};};Realtime[_0x5eca('0x3d')]['initZendeskAccounts']=function(){var _0x293160=this;return function(_0x360069){if(_0x360069){freeIsNotKey(_0x360069,_0x293160[_0x5eca('0x1f')],'id');for(var _0x320b40=0x0,_0x55c50f={},_0x3f770={};_0x320b40<_0x360069[_0x5eca('0x3f')];_0x320b40+=0x1){_0x55c50f=_0x360069[_0x320b40];if(_[_0x5eca('0x41')](_0x293160[_0x5eca('0x1f')][_0x55c50f['id']])){_0x293160[_0x5eca('0x1f')][_0x55c50f['id']]=new ZendeskAccount(_0x55c50f);}else{_0x293160[_0x5eca('0x3e')](_0x293160[_0x5eca('0x1f')][_0x55c50f['id']],_0x55c50f);}}}return _0x293160[_0x5eca('0x1f')];};};Realtime[_0x5eca('0x3d')]['initSalesforceAccounts']=function(){var _0x47b581=this;return function(_0x3fe7a9){if(_0x3fe7a9){freeIsNotKey(_0x3fe7a9,_0x47b581[_0x5eca('0x20')],'id');for(var _0x3fc585=0x0,_0x41b3ef={},_0x4dd4ee={};_0x3fc585<_0x3fe7a9[_0x5eca('0x3f')];_0x3fc585+=0x1){_0x41b3ef=_0x3fe7a9[_0x3fc585];if(_['isUndefined'](_0x47b581[_0x5eca('0x20')][_0x41b3ef['id']])){_0x47b581['salesforceAccounts'][_0x41b3ef['id']]=new SalesforceAccount(_0x41b3ef);}else{_0x47b581[_0x5eca('0x3e')](_0x47b581['salesforceAccounts'][_0x41b3ef['id']],_0x41b3ef);}}}return _0x47b581[_0x5eca('0x20')];};};Realtime[_0x5eca('0x3d')]['initFreshdeskAccounts']=function(){var _0x5932a3=this;return function(_0x33195e){if(_0x33195e){freeIsNotKey(_0x33195e,_0x5932a3['freshdeskAccounts'],'id');for(var _0x114b47=0x0,_0x48a3d3={},_0x7492a0={};_0x114b47<_0x33195e[_0x5eca('0x3f')];_0x114b47+=0x1){_0x48a3d3=_0x33195e[_0x114b47];if(_['isUndefined'](_0x5932a3[_0x5eca('0x46')][_0x48a3d3['id']])){_0x5932a3[_0x5eca('0x46')][_0x48a3d3['id']]=new FreshdeskAccount(_0x48a3d3);}else{_0x5932a3[_0x5eca('0x3e')](_0x5932a3[_0x5eca('0x46')][_0x48a3d3['id']],_0x48a3d3);}}}return _0x5932a3[_0x5eca('0x46')];};};Realtime[_0x5eca('0x3d')][_0x5eca('0x47')]=function(){var _0x55c92a=this;return function(_0x1152ac){if(_0x1152ac){freeIsNotKey(_0x1152ac,_0x55c92a['zohoAccounts'],'id');for(var _0x4359ce=0x0,_0x30f394={},_0x4464d4={};_0x4359ce<_0x1152ac['length'];_0x4359ce+=0x1){_0x30f394=_0x1152ac[_0x4359ce];if(_[_0x5eca('0x41')](_0x55c92a[_0x5eca('0x21')][_0x30f394['id']])){_0x55c92a[_0x5eca('0x21')][_0x30f394['id']]=new ZohoAccount(_0x30f394);}else{_0x55c92a['mergeFromDatabase'](_0x55c92a[_0x5eca('0x21')][_0x30f394['id']],_0x30f394);}}}return _0x55c92a[_0x5eca('0x21')];};};Realtime['prototype'][_0x5eca('0x48')]=function(){var _0x30aa58=this;return function(_0xd4ae13){if(_0xd4ae13){freeIsNotKey(_0xd4ae13,_0x30aa58[_0x5eca('0x49')],'id');for(var _0x2ef9ca=0x0,_0x7ebb0b={},_0x38cd6b={};_0x2ef9ca<_0xd4ae13[_0x5eca('0x3f')];_0x2ef9ca+=0x1){_0x7ebb0b=_0xd4ae13[_0x2ef9ca];if(_[_0x5eca('0x41')](_0x30aa58[_0x5eca('0x49')][_0x7ebb0b['id']])){_0x30aa58['deskAccounts'][_0x7ebb0b['id']]=new DeskAccount(_0x7ebb0b);}else{_0x30aa58[_0x5eca('0x3e')](_0x30aa58[_0x5eca('0x49')][_0x7ebb0b['id']],_0x7ebb0b);}}}return _0x30aa58[_0x5eca('0x49')];};};Realtime[_0x5eca('0x3d')]['initSugarcrmAccounts']=function(){var _0x44c2b4=this;return function(_0x46fa81){if(_0x46fa81){freeIsNotKey(_0x46fa81,_0x44c2b4[_0x5eca('0x4a')],'id');for(var _0x75b13d=0x0,_0x4af640={},_0x201baa={};_0x75b13d<_0x46fa81[_0x5eca('0x3f')];_0x75b13d+=0x1){_0x4af640=_0x46fa81[_0x75b13d];if(_['isUndefined'](_0x44c2b4['sugarcrmAccounts'][_0x4af640['id']])){_0x44c2b4[_0x5eca('0x4a')][_0x4af640['id']]=new SugarcrmAccount(_0x4af640);}else{_0x44c2b4[_0x5eca('0x3e')](_0x44c2b4[_0x5eca('0x4a')][_0x4af640['id']],_0x4af640);}}}return _0x44c2b4['sugarcrmAccounts'];};};Realtime[_0x5eca('0x3d')][_0x5eca('0x4b')]=function(){var _0x4a3443=this;return function(_0x2f36a4){if(_0x2f36a4){freeIsNotKey(_0x2f36a4,_0x4a3443[_0x5eca('0x22')],'id');for(var _0x3b6e87=0x0,_0x53d873={},_0x1e56ab={};_0x3b6e87<_0x2f36a4['length'];_0x3b6e87+=0x1){_0x53d873=_0x2f36a4[_0x3b6e87];if(_[_0x5eca('0x41')](_0x4a3443['vtigerAccounts'][_0x53d873['id']])){_0x4a3443[_0x5eca('0x22')][_0x53d873['id']]=new VtigerAccount(_0x53d873);}else{_0x4a3443[_0x5eca('0x3e')](_0x4a3443['vtigerAccounts'][_0x53d873['id']],_0x53d873);}}}return _0x4a3443[_0x5eca('0x22')];};};Realtime[_0x5eca('0x3d')][_0x5eca('0x4c')]=function(){var _0x3214ac=this;return function(_0x50ebbf){if(_0x50ebbf){freeIsNotKey(_0x50ebbf,_0x3214ac['servicenowAccounts'],'id');for(var _0x249036=0x0,_0x549fe2={},_0x38c15f={};_0x249036<_0x50ebbf[_0x5eca('0x3f')];_0x249036+=0x1){_0x549fe2=_0x50ebbf[_0x249036];if(_[_0x5eca('0x41')](_0x3214ac[_0x5eca('0x23')][_0x549fe2['id']])){_0x3214ac[_0x5eca('0x23')][_0x549fe2['id']]=new ServicenowAccount(_0x549fe2);}else{_0x3214ac[_0x5eca('0x3e')](_0x3214ac[_0x5eca('0x23')][_0x549fe2['id']],_0x549fe2);}}}return _0x3214ac[_0x5eca('0x23')];};};Realtime[_0x5eca('0x3d')][_0x5eca('0x4d')]=function(){var _0x4cf280=this;return function(_0x53e319){if(_0x53e319){freeIsNotKey(_0x53e319,_0x4cf280[_0x5eca('0x24')],'id');for(var _0x57963d=0x0,_0x36d63e={},_0x3a1b50={};_0x57963d<_0x53e319[_0x5eca('0x3f')];_0x57963d+=0x1){_0x36d63e=_0x53e319[_0x57963d];if(_[_0x5eca('0x41')](_0x4cf280[_0x5eca('0x24')][_0x36d63e['id']])){_0x4cf280['dynamics365Accounts'][_0x36d63e['id']]=new Dynamics365Account(_0x36d63e);}else{_0x4cf280[_0x5eca('0x3e')](_0x4cf280[_0x5eca('0x24')][_0x36d63e['id']],_0x36d63e);}}}return _0x4cf280[_0x5eca('0x24')];};};Realtime['prototype']['initFreshsalesAccounts']=function(){var _0x2df250=this;return function(_0x3b8549){if(_0x3b8549){freeIsNotKey(_0x3b8549,_0x2df250[_0x5eca('0x4e')],'id');for(var _0xb3d5ed=0x0,_0x249206={},_0x539e5a={};_0xb3d5ed<_0x3b8549[_0x5eca('0x3f')];_0xb3d5ed+=0x1){_0x249206=_0x3b8549[_0xb3d5ed];if(_[_0x5eca('0x41')](_0x2df250[_0x5eca('0x4e')][_0x249206['id']])){_0x2df250[_0x5eca('0x4e')][_0x249206['id']]=new FreshsalesAccount(_0x249206);}else{_0x2df250[_0x5eca('0x3e')](_0x2df250[_0x5eca('0x4e')][_0x249206['id']],_0x249206);}}}return _0x2df250['freshsalesAccounts'];};};Realtime['prototype'][_0x5eca('0x4f')]=function(){var _0xb79f9f=this;return function(_0x108f13){for(var _0x42b63b=0x0;_0x42b63b<_0x108f13['length'];_0x42b63b+=0x1){_[_0x5eca('0x50')](_0xb79f9f['voiceQueues'][_0x108f13[_0x42b63b][_0x5eca('0x2a')]],_0x108f13[_0x42b63b]);}return _0xb79f9f[_0x5eca('0x15')];};};Realtime['prototype'][_0x5eca('0x51')]=function(){var _0x2b6d08=this;return function(_0x2b63e4){clearVoiceQueues(_0x2b6d08['voiceQueues']);if(_0x2b63e4){_0x2b63e4=_[_0x5eca('0x52')](_0x2b63e4,_0x5eca('0x53'));for(var _0x44b985 in _0x2b63e4){if(_0x2b63e4[_0x5eca('0x27')](_0x44b985)){var _0x282bdf={};for(var _0x26add5=0x0;_0x26add5<_0x2b63e4[_0x44b985][_0x5eca('0x3f')];_0x26add5+=0x1){var _0x107257=_0x2b63e4[_0x44b985][_0x26add5][_0x5eca('0x54')];if(_0x2b6d08[_0x5eca('0x15')][_0x107257]){if(_0x2b63e4[_0x44b985][_0x26add5][_0x5eca('0x55')]){_0x2b6d08['voiceQueues'][_0x107257][_0x5eca('0x31')]+=0x1;}if(_0x2b63e4[_0x44b985][_0x26add5][_0x5eca('0x56')]){_0x2b6d08['voiceQueues'][_0x107257][_0x5eca('0x57')]+=0x1;}_0x2b6d08[_0x5eca('0x15')][_0x107257][_0x5eca('0x2d')]+=moment(_0x2b63e4[_0x44b985][_0x26add5]['queuecallerleaveAt'])['diff'](moment(_0x2b63e4[_0x44b985][_0x26add5][_0x5eca('0x58')]),_0x5eca('0x59'))||0x0;if(_0x26add5===_0x2b63e4[_0x44b985][_0x5eca('0x3f')]-0x1){_0x2b6d08['voiceQueues'][_0x107257]['sumDuration']+=moment(_0x2b63e4[_0x44b985][_0x26add5][_0x5eca('0x5a')]||_0x2b63e4[_0x44b985][_0x26add5][_0x5eca('0x5b')]||_0x2b63e4[_0x44b985][_0x26add5][_0x5eca('0x5c')])[_0x5eca('0x5d')](moment(_0x2b63e4[_0x44b985][_0x26add5][_0x5eca('0x58')]),_0x5eca('0x59'))||0x0;_0x2b6d08[_0x5eca('0x15')][_0x107257][_0x5eca('0x2c')]+=0x1;if(_0x2b63e4[_0x44b985][_0x26add5]['queuecallercomplete']){_0x2b6d08[_0x5eca('0x15')][_0x107257]['answered']+=0x1;_0x2b6d08[_0x5eca('0x15')][_0x107257][_0x5eca('0x5e')]+=moment(_0x2b63e4[_0x44b985][_0x26add5]['queuecallercompleteAt'])['diff'](moment(_0x2b63e4[_0x44b985][_0x26add5][_0x5eca('0x5f')]),'seconds')||0x0;}}else{_0x2b6d08[_0x5eca('0x15')][_0x107257][_0x5eca('0x2e')]+=_0x2b6d08[_0x5eca('0x15')][_0x107257][_0x5eca('0x2d')]||0x0;}}}}}}return _0x2b6d08[_0x5eca('0x15')];};};Realtime[_0x5eca('0x3d')]['initVoiceCallReports']=function(){var _0x4e0da4=this;return function(_0x29e2c5){clearVoiceCallReports(_0x4e0da4[_0x5eca('0x60')]);if(_0x29e2c5){for(var _0x3de4ef=0x0;_0x3de4ef<_0x29e2c5['length'];_0x3de4ef+=0x1){_0x4e0da4[_0x5eca('0x60')][_0x5eca('0x2c')]+=0x1;_0x4e0da4[_0x5eca('0x60')]['sumDuration']+=_0x29e2c5[_0x3de4ef]['duration'];if(_0x29e2c5[_0x3de4ef]['disposition']===_0x5eca('0x61')){_0x4e0da4[_0x5eca('0x60')][_0x5eca('0x30')]+=0x1;_0x4e0da4[_0x5eca('0x60')][_0x5eca('0x2d')]+=_0x29e2c5[_0x3de4ef][_0x5eca('0x62')]-_0x29e2c5[_0x3de4ef]['billableseconds']||0x0;_0x4e0da4[_0x5eca('0x60')]['sumBillable']+=_0x29e2c5[_0x3de4ef][_0x5eca('0x63')];}}}return _0x4e0da4[_0x5eca('0x60')];};};Realtime[_0x5eca('0x3d')]['initCampaigns']=function(){var _0xbc3ba6=this;return function(_0x293877){if(_0x293877){freeIsNotKey(_0x293877,_0xbc3ba6['campaigns'],_0x5eca('0x2a'));for(var _0x40ea04=0x0,_0x4131d5={};_0x40ea04<_0x293877[_0x5eca('0x3f')];_0x40ea04+=0x1){_0x4131d5=_0x293877[_0x40ea04];if(_[_0x5eca('0x41')](_0xbc3ba6['campaigns'][_0x4131d5[_0x5eca('0x2a')]])){_0xbc3ba6[_0x5eca('0x17')][_0x4131d5[_0x5eca('0x2a')]]=new Campaign(_0x4131d5);}else{_0xbc3ba6[_0x5eca('0x3e')](_0xbc3ba6[_0x5eca('0x17')][_0x4131d5[_0x5eca('0x2a')]],_0x4131d5);_0xbc3ba6[_0x5eca('0x17')][_0x4131d5['name']]['dialQueueProject']=_0x4131d5[_0x5eca('0x64')]?_0x4131d5[_0x5eca('0x64')]['name']:undefined;}}}return _0xbc3ba6[_0x5eca('0x17')];};};Realtime[_0x5eca('0x3d')][_0x5eca('0x65')]=function(){var _0x518225=this;return function(_0x30d125){if(_0x30d125){freeIsNotKey(_0x30d125,_0x518225[_0x5eca('0x19')],'id');for(var _0xfdf686=0x0,_0x346778={};_0xfdf686<_0x30d125[_0x5eca('0x3f')];_0xfdf686+=0x1){_0x346778=_0x30d125[_0xfdf686];if(_[_0x5eca('0x41')](_0x518225[_0x5eca('0x19')][_0x346778['id']])){_0x518225[_0x5eca('0x19')][_0x346778['id']]=new VoiceExtension(_0x346778);}else{_0x518225[_0x5eca('0x3e')](_0x518225['voiceExtensions'][_0x346778['id']],_0x346778);}}}return _0x518225['voiceExtensions'];};};Realtime[_0x5eca('0x3d')][_0x5eca('0x66')]=function(){var _0x4d8ead=this;return function(_0xcf8399){clearCampaigns(_0x4d8ead[_0x5eca('0x17')]);for(var _0x5712c0=0x0;_0x5712c0<_0xcf8399['length'];_0x5712c0+=0x1){_[_0x5eca('0x50')](_0x4d8ead[_0x5eca('0x17')][_0xcf8399[_0x5712c0][_0x5eca('0x2a')]],_0xcf8399[_0x5712c0]);}return _0x4d8ead['campaigns'];};};Realtime[_0x5eca('0x3d')][_0x5eca('0x67')]=function(){var _0x2950e8=this;return function(_0x3a0c9f){if(_0x3a0c9f){freeIsNotKey(_0x3a0c9f,_0x2950e8[_0x5eca('0x25')],'id');for(var _0xac2b97=0x0,_0x13303f={},_0x579c1c={};_0xac2b97<_0x3a0c9f[_0x5eca('0x3f')];_0xac2b97+=0x1){_0x13303f=_0x3a0c9f[_0xac2b97];if(_['isUndefined'](_0x2950e8[_0x5eca('0x25')][_0x13303f['id']])){_0x2950e8[_0x5eca('0x25')][_0x13303f['id']]=new FaxAccount(_0x13303f);}else{_0x2950e8[_0x5eca('0x3e')](_0x2950e8[_0x5eca('0x25')][_0x13303f['id']],_0x13303f);}}}return _0x2950e8['faxAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0xb7b9=['../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','trunks','voiceQueues','triggers','campaigns','templates','outbound','voiceExtensions','channels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','sumHoldTime','sumDuration','sumBillable','ivrAnswerCallsDay','isEmpty','answered','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isUndefined','prototype','initTelephones','telephones','initTemplates','initZendeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','queue','queuecallerexit','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','bluebird','util','lodash','../model/agent','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount'];(function(_0x401ccd,_0x140815){var _0x5a57ad=function(_0x8ad698){while(--_0x8ad698){_0x401ccd['push'](_0x401ccd['shift']());}};_0x5a57ad(++_0x140815);}(_0xb7b9,0xcd));var _0x9b7b=function(_0x4261ca,_0x40a67c){_0x4261ca=_0x4261ca-0x0;var _0x38805b=_0xb7b9[_0x4261ca];return _0x38805b;};'use strict';var BPromise=require(_0x9b7b('0x0'));var util=require(_0x9b7b('0x1'));var _=require(_0x9b7b('0x2'));var moment=require('moment');var Agent=require(_0x9b7b('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x9b7b('0x4'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x9b7b('0x5'));var Template=require(_0x9b7b('0x6'));var Campaign=require(_0x9b7b('0x7'));var VoiceExtension=require(_0x9b7b('0x8'));var ZendeskAccount=require(_0x9b7b('0x9'));var SalesforceAccount=require(_0x9b7b('0xa'));var FreshdeskAccount=require(_0x9b7b('0xb'));var SugarcrmAccount=require(_0x9b7b('0xc'));var ZohoAccount=require(_0x9b7b('0xd'));var DeskAccount=require(_0x9b7b('0xe'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x9b7b('0xf'));var Dynamics365Account=require(_0x9b7b('0x10'));var FreshsalesAccount=require(_0x9b7b('0x11'));var FaxAccount=require(_0x9b7b('0x12'));var Realtime=function(){this[_0x9b7b('0x13')]={};this['telephones']={};this[_0x9b7b('0x14')]={};this[_0x9b7b('0x15')]={};this[_0x9b7b('0x16')]={};this[_0x9b7b('0x17')]={};this[_0x9b7b('0x18')]={};this[_0x9b7b('0x19')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x9b7b('0x1a')]={};this[_0x9b7b('0x1b')]={};this['queueChannels']={};this['outboundChannels']={};this[_0x9b7b('0x1c')]={};this[_0x9b7b('0x1d')]={};this[_0x9b7b('0x1e')]={};this[_0x9b7b('0x1f')]={};this[_0x9b7b('0x20')]={};this[_0x9b7b('0x21')]={};this['zohoAccounts']={};this[_0x9b7b('0x22')]={};this['vtigerAccounts']={};this[_0x9b7b('0x23')]={};this[_0x9b7b('0x24')]={};this[_0x9b7b('0x25')]={};this[_0x9b7b('0x26')]={};};function freeIsNotKey(_0x147376,_0x438697,_0x37f1e6){var _0x504403=_[_0x9b7b('0x27')](_0x147376,function(_0x5095ad,_0x349865){return _0x5095ad[_0x37f1e6];});for(var _0x444ed6 in _0x438697){if(_0x438697[_0x9b7b('0x28')](_0x444ed6)){if(!_0x504403[_0x444ed6]){delete _0x438697[_0x444ed6];}}}}function freeIsNotKeySip(_0x2f9075,_0x207351){var _0x1dcab8=_[_0x9b7b('0x27')](_0x2f9075,function(_0x51af09,_0x4cc82e){return util[_0x9b7b('0x29')](_0x9b7b('0x2a'),_0x51af09[_0x9b7b('0x2b')]);});for(var _0x19be59 in _0x207351){if(_0x207351[_0x9b7b('0x28')](_0x19be59)){if(!_0x1dcab8[_0x19be59]){delete _0x207351[_0x19be59];}}}}function freeIsNotKeyAgent(_0x31467e,_0x30057b){var _0x7122be=_[_0x9b7b('0x27')](_0x31467e,function(_0x32ecf5,_0x3f0b51){var _0x33c519=_[_0x9b7b('0x2c')](_0x32ecf5[_0x9b7b('0x2d')])?util[_0x9b7b('0x29')](_0x9b7b('0x2a'),_0x32ecf5[_0x9b7b('0x2b')]):_0x32ecf5[_0x9b7b('0x2d')];return _0x33c519;});for(var _0x58dcef in _0x30057b){if(_0x30057b[_0x9b7b('0x28')](_0x58dcef)){if(!_0x7122be[_0x58dcef]){delete _0x30057b[_0x58dcef];}}}}function clearVoiceCallReports(_0x3c7fff){_0x3c7fff[_0x9b7b('0x2e')]=0x0;_0x3c7fff['answered']=0x0;_0x3c7fff[_0x9b7b('0x2f')]=0x0;_0x3c7fff[_0x9b7b('0x30')]=0x0;_0x3c7fff[_0x9b7b('0x31')]=0x0;}function clearCampaigns(_0xb98131){if(!_['isEmpty'](_0xb98131)){for(var _0x4b87d1 in _0xb98131){if(_0xb98131['hasOwnProperty'](_0x4b87d1)){_0xb98131[_0x4b87d1]['ivrTotalCallsDays']=0x0;_0xb98131[_0x4b87d1][_0x9b7b('0x32')]=0x0;}}}}function clearVoiceQueues(_0x535dc0){if(!_[_0x9b7b('0x33')](_0x535dc0)){for(var _0x36e3a3 in _0x535dc0){if(_0x535dc0[_0x9b7b('0x28')](_0x36e3a3)){_0x535dc0[_0x36e3a3][_0x9b7b('0x2e')]=0x0;_0x535dc0[_0x36e3a3][_0x9b7b('0x34')]=0x0;_0x535dc0[_0x36e3a3][_0x9b7b('0x35')]=0x0;_0x535dc0[_0x36e3a3][_0x9b7b('0x36')]=0x0;_0x535dc0[_0x36e3a3][_0x9b7b('0x2f')]=0x0;_0x535dc0[_0x36e3a3][_0x9b7b('0x30')]=0x0;_0x535dc0[_0x36e3a3][_0x9b7b('0x31')]=0x0;_0x535dc0[_0x36e3a3][_0x9b7b('0x37')]=0x0;_0x535dc0[_0x36e3a3][_0x9b7b('0x38')]=0x0;_0x535dc0[_0x36e3a3][_0x9b7b('0x39')]=0x0;_0x535dc0[_0x36e3a3][_0x9b7b('0x3a')]=0x0;_0x535dc0[_0x36e3a3][_0x9b7b('0x3b')]=0x0;_0x535dc0[_0x36e3a3][_0x9b7b('0x3c')]=0x0;_0x535dc0[_0x36e3a3][_0x9b7b('0x3d')]=0x0;_0x535dc0[_0x36e3a3]['outboundDropCallsDayCallersExit']=0x0;_0x535dc0[_0x36e3a3][_0x9b7b('0x3e')]=0x0;_0x535dc0[_0x36e3a3][_0x9b7b('0x3f')]=0x0;_0x535dc0[_0x36e3a3][_0x9b7b('0x40')]=0x0;_0x535dc0[_0x36e3a3][_0x9b7b('0x41')]=0x0;_0x535dc0[_0x36e3a3][_0x9b7b('0x37')]=0x0;_0x535dc0[_0x36e3a3][_0x9b7b('0x42')]=0x0;_0x535dc0[_0x36e3a3][_0x9b7b('0x43')]=!![];}}}}Realtime['prototype'][_0x9b7b('0x44')]=function(_0x2552c9,_0x5791f1){for(var _0x136679 in _0x5791f1){if(_0x2552c9[_0x9b7b('0x28')](_0x136679)){_0x2552c9[_0x136679]=_0x5791f1[_0x136679];}}};Realtime['prototype'][_0x9b7b('0x45')]=function(){var _0x3772ad=this;return function(_0x515ec9){if(_0x515ec9){freeIsNotKeyAgent(_0x515ec9,_0x3772ad['agents']);for(var _0x13b7e2=0x0,_0x1d1371={},_0x3cf728={};_0x13b7e2<_0x515ec9[_0x9b7b('0x46')];_0x13b7e2+=0x1){_0x1d1371=_0x515ec9[_0x13b7e2];var _0x4ec731=_[_0x9b7b('0x2c')](_0x1d1371[_0x9b7b('0x2d')])?util[_0x9b7b('0x29')]('SIP/%s',_0x1d1371[_0x9b7b('0x2b')]):_0x1d1371['interface'];if(_[_0x9b7b('0x47')](_0x3772ad[_0x9b7b('0x13')][_0x4ec731])){_0x3772ad[_0x9b7b('0x13')][_0x4ec731]=new Agent(_0x1d1371);}else{_0x3772ad[_0x9b7b('0x44')](_0x3772ad[_0x9b7b('0x13')][_0x4ec731],_0x1d1371);}}}return _0x3772ad[_0x9b7b('0x13')];};};Realtime[_0x9b7b('0x48')][_0x9b7b('0x49')]=function(){var _0x5bdded=this;return function(_0x282c06){if(_0x282c06){freeIsNotKeySip(_0x282c06,_0x5bdded[_0x9b7b('0x4a')]);for(var _0x5f21cd=0x0,_0x26dc1f={},_0x2e27a5={};_0x5f21cd<_0x282c06['length'];_0x5f21cd+=0x1){_0x26dc1f=_0x282c06[_0x5f21cd];if(_[_0x9b7b('0x47')](_0x5bdded[_0x9b7b('0x4a')][util[_0x9b7b('0x29')](_0x9b7b('0x2a'),_0x26dc1f[_0x9b7b('0x2b')])])){_0x5bdded['telephones'][util['format'](_0x9b7b('0x2a'),_0x26dc1f['name'])]=new Telephone(_0x26dc1f);}else{_0x5bdded[_0x9b7b('0x44')](_0x5bdded[_0x9b7b('0x4a')][util['format'](_0x9b7b('0x2a'),_0x26dc1f[_0x9b7b('0x2b')])],_0x26dc1f);}}}return _0x5bdded[_0x9b7b('0x4a')];};};Realtime[_0x9b7b('0x48')]['initTrunks']=function(){var _0x51ed64=this;return function(_0x59cfbb){if(_0x59cfbb){freeIsNotKeySip(_0x59cfbb,_0x51ed64[_0x9b7b('0x14')]);for(var _0x5c226b=0x0,_0x21e061={},_0x2a37ac={};_0x5c226b<_0x59cfbb['length'];_0x5c226b+=0x1){_0x21e061=_0x59cfbb[_0x5c226b];if(_['isUndefined'](_0x51ed64[_0x9b7b('0x14')][util[_0x9b7b('0x29')](_0x9b7b('0x2a'),_0x21e061[_0x9b7b('0x2b')])])){_0x51ed64[_0x9b7b('0x14')][util['format'](_0x9b7b('0x2a'),_0x21e061['name'])]=new Trunk(_0x21e061);}else{_0x51ed64[_0x9b7b('0x44')](_0x51ed64['trunks'][util[_0x9b7b('0x29')](_0x9b7b('0x2a'),_0x21e061[_0x9b7b('0x2b')])],_0x21e061);}}}return _0x51ed64['trunks'];};};Realtime[_0x9b7b('0x48')]['initVoiceQueues']=function(){var _0x4c4bc8=this;return function(_0x332b0c){if(_0x332b0c){freeIsNotKey(_0x332b0c,_0x4c4bc8[_0x9b7b('0x15')],'name');for(var _0x2ff4e0=0x0,_0x522d51={},_0x14533d={};_0x2ff4e0<_0x332b0c[_0x9b7b('0x46')];_0x2ff4e0+=0x1){_0x522d51=_0x332b0c[_0x2ff4e0];if(_[_0x9b7b('0x47')](_0x4c4bc8[_0x9b7b('0x15')][_0x522d51[_0x9b7b('0x2b')]])){_0x4c4bc8[_0x9b7b('0x15')][_0x522d51[_0x9b7b('0x2b')]]=new VoiceQueue(_0x522d51);}else{_0x4c4bc8[_0x9b7b('0x44')](_0x4c4bc8[_0x9b7b('0x15')][_0x522d51[_0x9b7b('0x2b')]],_0x522d51);}}}return _0x4c4bc8[_0x9b7b('0x15')];};};Realtime[_0x9b7b('0x48')]['initTriggers']=function(){var _0x5c114b=this;return function(_0x5cc31f){if(_0x5cc31f){freeIsNotKey(_0x5cc31f,_0x5c114b[_0x9b7b('0x16')],'id');for(var _0x5e0025=0x0,_0x4bc19f={},_0x37cec5={};_0x5e0025<_0x5cc31f[_0x9b7b('0x46')];_0x5e0025+=0x1){_0x4bc19f=_0x5cc31f[_0x5e0025];if(_[_0x9b7b('0x47')](_0x5c114b[_0x9b7b('0x16')][_0x4bc19f['id']])){_0x5c114b[_0x9b7b('0x16')][_0x4bc19f['id']]=new Trigger(_0x4bc19f);}else{_0x5c114b['mergeFromDatabase'](_0x5c114b[_0x9b7b('0x16')][_0x4bc19f['id']],_0x4bc19f);}}}return _0x5c114b[_0x9b7b('0x16')];};};Realtime[_0x9b7b('0x48')][_0x9b7b('0x4b')]=function(){var _0x372c86=this;return function(_0x1eecb4){if(_0x1eecb4){freeIsNotKey(_0x1eecb4,_0x372c86[_0x9b7b('0x18')],'id');for(var _0x33ffa6=0x0,_0x43f65c={},_0x4b3a6f={};_0x33ffa6<_0x1eecb4['length'];_0x33ffa6+=0x1){_0x43f65c=_0x1eecb4[_0x33ffa6];if(_['isUndefined'](_0x372c86[_0x9b7b('0x18')][_0x43f65c['id']])){_0x372c86[_0x9b7b('0x18')][_0x43f65c['id']]=new Template(_0x43f65c);}else{_0x372c86[_0x9b7b('0x44')](_0x372c86['templates'][_0x43f65c['id']],_0x43f65c);}}}return _0x372c86['templates'];};};Realtime[_0x9b7b('0x48')][_0x9b7b('0x4c')]=function(){var _0x486fa6=this;return function(_0x4400b9){if(_0x4400b9){freeIsNotKey(_0x4400b9,_0x486fa6['zendeskAccounts'],'id');for(var _0x26ffab=0x0,_0x5f583f={},_0x3c0c0d={};_0x26ffab<_0x4400b9[_0x9b7b('0x46')];_0x26ffab+=0x1){_0x5f583f=_0x4400b9[_0x26ffab];if(_[_0x9b7b('0x47')](_0x486fa6[_0x9b7b('0x1e')][_0x5f583f['id']])){_0x486fa6[_0x9b7b('0x1e')][_0x5f583f['id']]=new ZendeskAccount(_0x5f583f);}else{_0x486fa6['mergeFromDatabase'](_0x486fa6[_0x9b7b('0x1e')][_0x5f583f['id']],_0x5f583f);}}}return _0x486fa6[_0x9b7b('0x1e')];};};Realtime[_0x9b7b('0x48')]['initSalesforceAccounts']=function(){var _0x2817c3=this;return function(_0xff9b19){if(_0xff9b19){freeIsNotKey(_0xff9b19,_0x2817c3[_0x9b7b('0x1f')],'id');for(var _0x2ee980=0x0,_0x140e9a={},_0xd1795c={};_0x2ee980<_0xff9b19['length'];_0x2ee980+=0x1){_0x140e9a=_0xff9b19[_0x2ee980];if(_[_0x9b7b('0x47')](_0x2817c3['salesforceAccounts'][_0x140e9a['id']])){_0x2817c3['salesforceAccounts'][_0x140e9a['id']]=new SalesforceAccount(_0x140e9a);}else{_0x2817c3[_0x9b7b('0x44')](_0x2817c3[_0x9b7b('0x1f')][_0x140e9a['id']],_0x140e9a);}}}return _0x2817c3['salesforceAccounts'];};};Realtime[_0x9b7b('0x48')]['initFreshdeskAccounts']=function(){var _0x239bac=this;return function(_0x1e7214){if(_0x1e7214){freeIsNotKey(_0x1e7214,_0x239bac[_0x9b7b('0x21')],'id');for(var _0x51a051=0x0,_0x46087c={},_0x451ec0={};_0x51a051<_0x1e7214[_0x9b7b('0x46')];_0x51a051+=0x1){_0x46087c=_0x1e7214[_0x51a051];if(_[_0x9b7b('0x47')](_0x239bac[_0x9b7b('0x21')][_0x46087c['id']])){_0x239bac[_0x9b7b('0x21')][_0x46087c['id']]=new FreshdeskAccount(_0x46087c);}else{_0x239bac[_0x9b7b('0x44')](_0x239bac[_0x9b7b('0x21')][_0x46087c['id']],_0x46087c);}}}return _0x239bac[_0x9b7b('0x21')];};};Realtime[_0x9b7b('0x48')][_0x9b7b('0x4d')]=function(){var _0x39642c=this;return function(_0x1809eb){if(_0x1809eb){freeIsNotKey(_0x1809eb,_0x39642c['zohoAccounts'],'id');for(var _0x2c663d=0x0,_0x377727={},_0x3a7aa7={};_0x2c663d<_0x1809eb[_0x9b7b('0x46')];_0x2c663d+=0x1){_0x377727=_0x1809eb[_0x2c663d];if(_[_0x9b7b('0x47')](_0x39642c['zohoAccounts'][_0x377727['id']])){_0x39642c[_0x9b7b('0x4e')][_0x377727['id']]=new ZohoAccount(_0x377727);}else{_0x39642c[_0x9b7b('0x44')](_0x39642c[_0x9b7b('0x4e')][_0x377727['id']],_0x377727);}}}return _0x39642c[_0x9b7b('0x4e')];};};Realtime[_0x9b7b('0x48')][_0x9b7b('0x4f')]=function(){var _0x3c54cc=this;return function(_0x3da3f2){if(_0x3da3f2){freeIsNotKey(_0x3da3f2,_0x3c54cc[_0x9b7b('0x22')],'id');for(var _0x57b383=0x0,_0x452939={},_0x5b277b={};_0x57b383<_0x3da3f2[_0x9b7b('0x46')];_0x57b383+=0x1){_0x452939=_0x3da3f2[_0x57b383];if(_[_0x9b7b('0x47')](_0x3c54cc['deskAccounts'][_0x452939['id']])){_0x3c54cc['deskAccounts'][_0x452939['id']]=new DeskAccount(_0x452939);}else{_0x3c54cc[_0x9b7b('0x44')](_0x3c54cc[_0x9b7b('0x22')][_0x452939['id']],_0x452939);}}}return _0x3c54cc[_0x9b7b('0x22')];};};Realtime[_0x9b7b('0x48')][_0x9b7b('0x50')]=function(){var _0x55b18b=this;return function(_0x41686c){if(_0x41686c){freeIsNotKey(_0x41686c,_0x55b18b[_0x9b7b('0x20')],'id');for(var _0x2b66dd=0x0,_0x2df9f2={},_0x57b5c2={};_0x2b66dd<_0x41686c[_0x9b7b('0x46')];_0x2b66dd+=0x1){_0x2df9f2=_0x41686c[_0x2b66dd];if(_[_0x9b7b('0x47')](_0x55b18b[_0x9b7b('0x20')][_0x2df9f2['id']])){_0x55b18b[_0x9b7b('0x20')][_0x2df9f2['id']]=new SugarcrmAccount(_0x2df9f2);}else{_0x55b18b[_0x9b7b('0x44')](_0x55b18b[_0x9b7b('0x20')][_0x2df9f2['id']],_0x2df9f2);}}}return _0x55b18b[_0x9b7b('0x20')];};};Realtime[_0x9b7b('0x48')][_0x9b7b('0x51')]=function(){var _0x33e1f=this;return function(_0x4e3cf8){if(_0x4e3cf8){freeIsNotKey(_0x4e3cf8,_0x33e1f[_0x9b7b('0x52')],'id');for(var _0x45b2d2=0x0,_0x1bbc90={},_0x363507={};_0x45b2d2<_0x4e3cf8[_0x9b7b('0x46')];_0x45b2d2+=0x1){_0x1bbc90=_0x4e3cf8[_0x45b2d2];if(_[_0x9b7b('0x47')](_0x33e1f[_0x9b7b('0x52')][_0x1bbc90['id']])){_0x33e1f[_0x9b7b('0x52')][_0x1bbc90['id']]=new VtigerAccount(_0x1bbc90);}else{_0x33e1f['mergeFromDatabase'](_0x33e1f[_0x9b7b('0x52')][_0x1bbc90['id']],_0x1bbc90);}}}return _0x33e1f[_0x9b7b('0x52')];};};Realtime[_0x9b7b('0x48')]['initServicenowAccounts']=function(){var _0x4e3e5a=this;return function(_0xac0d6b){if(_0xac0d6b){freeIsNotKey(_0xac0d6b,_0x4e3e5a['servicenowAccounts'],'id');for(var _0x12829b=0x0,_0x50be49={},_0x495df4={};_0x12829b<_0xac0d6b['length'];_0x12829b+=0x1){_0x50be49=_0xac0d6b[_0x12829b];if(_[_0x9b7b('0x47')](_0x4e3e5a[_0x9b7b('0x23')][_0x50be49['id']])){_0x4e3e5a['servicenowAccounts'][_0x50be49['id']]=new ServicenowAccount(_0x50be49);}else{_0x4e3e5a[_0x9b7b('0x44')](_0x4e3e5a[_0x9b7b('0x23')][_0x50be49['id']],_0x50be49);}}}return _0x4e3e5a[_0x9b7b('0x23')];};};Realtime[_0x9b7b('0x48')][_0x9b7b('0x53')]=function(){var _0x23e80d=this;return function(_0x2298d1){if(_0x2298d1){freeIsNotKey(_0x2298d1,_0x23e80d[_0x9b7b('0x24')],'id');for(var _0x56a2db=0x0,_0x357fe6={},_0xf0bb7={};_0x56a2db<_0x2298d1['length'];_0x56a2db+=0x1){_0x357fe6=_0x2298d1[_0x56a2db];if(_[_0x9b7b('0x47')](_0x23e80d['dynamics365Accounts'][_0x357fe6['id']])){_0x23e80d[_0x9b7b('0x24')][_0x357fe6['id']]=new Dynamics365Account(_0x357fe6);}else{_0x23e80d[_0x9b7b('0x44')](_0x23e80d[_0x9b7b('0x24')][_0x357fe6['id']],_0x357fe6);}}}return _0x23e80d[_0x9b7b('0x24')];};};Realtime[_0x9b7b('0x48')][_0x9b7b('0x54')]=function(){var _0x1d5856=this;return function(_0x540166){if(_0x540166){freeIsNotKey(_0x540166,_0x1d5856[_0x9b7b('0x25')],'id');for(var _0x5cf752=0x0,_0x4bc53c={},_0x21580e={};_0x5cf752<_0x540166['length'];_0x5cf752+=0x1){_0x4bc53c=_0x540166[_0x5cf752];if(_[_0x9b7b('0x47')](_0x1d5856[_0x9b7b('0x25')][_0x4bc53c['id']])){_0x1d5856[_0x9b7b('0x25')][_0x4bc53c['id']]=new FreshsalesAccount(_0x4bc53c);}else{_0x1d5856[_0x9b7b('0x44')](_0x1d5856['freshsalesAccounts'][_0x4bc53c['id']],_0x4bc53c);}}}return _0x1d5856[_0x9b7b('0x25')];};};Realtime[_0x9b7b('0x48')][_0x9b7b('0x55')]=function(){var _0x52dc70=this;return function(_0x4d0349){for(var _0x4e5b18=0x0;_0x4e5b18<_0x4d0349[_0x9b7b('0x46')];_0x4e5b18+=0x1){_[_0x9b7b('0x56')](_0x52dc70[_0x9b7b('0x15')][_0x4d0349[_0x4e5b18][_0x9b7b('0x2b')]],_0x4d0349[_0x4e5b18]);}return _0x52dc70['voiceQueues'];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x13fea7=this;return function(_0x8c1e5){clearVoiceQueues(_0x13fea7[_0x9b7b('0x15')]);if(_0x8c1e5){_0x8c1e5=_[_0x9b7b('0x57')](_0x8c1e5,'uniqueid');for(var _0x2acbb3 in _0x8c1e5){if(_0x8c1e5[_0x9b7b('0x28')](_0x2acbb3)){var _0x3b81db={};for(var _0xdd1118=0x0;_0xdd1118<_0x8c1e5[_0x2acbb3][_0x9b7b('0x46')];_0xdd1118+=0x1){var _0x2ae9ca=_0x8c1e5[_0x2acbb3][_0xdd1118][_0x9b7b('0x58')];if(_0x13fea7[_0x9b7b('0x15')][_0x2ae9ca]){if(_0x8c1e5[_0x2acbb3][_0xdd1118][_0x9b7b('0x59')]){_0x13fea7[_0x9b7b('0x15')][_0x2ae9ca][_0x9b7b('0x35')]+=0x1;}if(_0x8c1e5[_0x2acbb3][_0xdd1118]['queuecallerabandon']){_0x13fea7[_0x9b7b('0x15')][_0x2ae9ca][_0x9b7b('0x36')]+=0x1;}_0x13fea7[_0x9b7b('0x15')][_0x2ae9ca][_0x9b7b('0x2f')]+=moment(_0x8c1e5[_0x2acbb3][_0xdd1118][_0x9b7b('0x5a')])[_0x9b7b('0x5b')](moment(_0x8c1e5[_0x2acbb3][_0xdd1118]['queuecallerjoinAt']),_0x9b7b('0x5c'))||0x0;if(_0xdd1118===_0x8c1e5[_0x2acbb3][_0x9b7b('0x46')]-0x1){_0x13fea7[_0x9b7b('0x15')][_0x2ae9ca][_0x9b7b('0x30')]+=moment(_0x8c1e5[_0x2acbb3][_0xdd1118][_0x9b7b('0x5d')]||_0x8c1e5[_0x2acbb3][_0xdd1118][_0x9b7b('0x5e')]||_0x8c1e5[_0x2acbb3][_0xdd1118][_0x9b7b('0x5f')])[_0x9b7b('0x5b')](moment(_0x8c1e5[_0x2acbb3][_0xdd1118][_0x9b7b('0x60')]),_0x9b7b('0x5c'))||0x0;_0x13fea7[_0x9b7b('0x15')][_0x2ae9ca][_0x9b7b('0x2e')]+=0x1;if(_0x8c1e5[_0x2acbb3][_0xdd1118][_0x9b7b('0x61')]){_0x13fea7[_0x9b7b('0x15')][_0x2ae9ca][_0x9b7b('0x34')]+=0x1;_0x13fea7['voiceQueues'][_0x2ae9ca][_0x9b7b('0x31')]+=moment(_0x8c1e5[_0x2acbb3][_0xdd1118][_0x9b7b('0x5d')])[_0x9b7b('0x5b')](moment(_0x8c1e5[_0x2acbb3][_0xdd1118][_0x9b7b('0x5a')]),_0x9b7b('0x5c'))||0x0;}}else{_0x13fea7[_0x9b7b('0x15')][_0x2ae9ca][_0x9b7b('0x30')]+=_0x13fea7['voiceQueues'][_0x2ae9ca][_0x9b7b('0x2f')]||0x0;}}}}}}return _0x13fea7[_0x9b7b('0x15')];};};Realtime[_0x9b7b('0x48')][_0x9b7b('0x62')]=function(){var _0x21e4cb=this;return function(_0x352d7f){clearVoiceCallReports(_0x21e4cb['outbound']);if(_0x352d7f){for(var _0x495b7e=0x0;_0x495b7e<_0x352d7f[_0x9b7b('0x46')];_0x495b7e+=0x1){_0x21e4cb[_0x9b7b('0x19')][_0x9b7b('0x2e')]+=0x1;_0x21e4cb[_0x9b7b('0x19')][_0x9b7b('0x30')]+=_0x352d7f[_0x495b7e][_0x9b7b('0x63')];if(_0x352d7f[_0x495b7e][_0x9b7b('0x64')]===_0x9b7b('0x65')){_0x21e4cb[_0x9b7b('0x19')]['answered']+=0x1;_0x21e4cb[_0x9b7b('0x19')][_0x9b7b('0x2f')]+=_0x352d7f[_0x495b7e][_0x9b7b('0x63')]-_0x352d7f[_0x495b7e][_0x9b7b('0x66')]||0x0;_0x21e4cb[_0x9b7b('0x19')][_0x9b7b('0x31')]+=_0x352d7f[_0x495b7e]['billableseconds'];}}}return _0x21e4cb[_0x9b7b('0x19')];};};Realtime[_0x9b7b('0x48')]['initCampaigns']=function(){var _0x375547=this;return function(_0x59eed6){if(_0x59eed6){freeIsNotKey(_0x59eed6,_0x375547[_0x9b7b('0x17')],_0x9b7b('0x2b'));for(var _0x83ff42=0x0,_0x370e21={};_0x83ff42<_0x59eed6[_0x9b7b('0x46')];_0x83ff42+=0x1){_0x370e21=_0x59eed6[_0x83ff42];if(_[_0x9b7b('0x47')](_0x375547[_0x9b7b('0x17')][_0x370e21[_0x9b7b('0x2b')]])){_0x375547[_0x9b7b('0x17')][_0x370e21['name']]=new Campaign(_0x370e21);}else{_0x375547[_0x9b7b('0x44')](_0x375547[_0x9b7b('0x17')][_0x370e21['name']],_0x370e21);_0x375547['campaigns'][_0x370e21['name']][_0x9b7b('0x67')]=_0x370e21[_0x9b7b('0x68')]?_0x370e21[_0x9b7b('0x68')][_0x9b7b('0x2b')]:undefined;}}}return _0x375547[_0x9b7b('0x17')];};};Realtime[_0x9b7b('0x48')][_0x9b7b('0x69')]=function(){var _0x314685=this;return function(_0x199199){if(_0x199199){freeIsNotKey(_0x199199,_0x314685[_0x9b7b('0x1a')],'id');for(var _0x5ad410=0x0,_0x55aee1={};_0x5ad410<_0x199199[_0x9b7b('0x46')];_0x5ad410+=0x1){_0x55aee1=_0x199199[_0x5ad410];if(_[_0x9b7b('0x47')](_0x314685['voiceExtensions'][_0x55aee1['id']])){_0x314685[_0x9b7b('0x1a')][_0x55aee1['id']]=new VoiceExtension(_0x55aee1);}else{_0x314685[_0x9b7b('0x44')](_0x314685['voiceExtensions'][_0x55aee1['id']],_0x55aee1);}}}return _0x314685[_0x9b7b('0x1a')];};};Realtime[_0x9b7b('0x48')][_0x9b7b('0x6a')]=function(){var _0x2e081d=this;return function(_0xa24081){clearCampaigns(_0x2e081d['campaigns']);for(var _0x24e186=0x0;_0x24e186<_0xa24081['length'];_0x24e186+=0x1){_['merge'](_0x2e081d['campaigns'][_0xa24081[_0x24e186][_0x9b7b('0x2b')]],_0xa24081[_0x24e186]);}return _0x2e081d[_0x9b7b('0x17')];};};Realtime['prototype'][_0x9b7b('0x6b')]=function(){var _0x693d1e=this;return function(_0x48ba81){if(_0x48ba81){freeIsNotKey(_0x48ba81,_0x693d1e[_0x9b7b('0x26')],'id');for(var _0xac4efd=0x0,_0x3e45ed={},_0x591d35={};_0xac4efd<_0x48ba81[_0x9b7b('0x46')];_0xac4efd+=0x1){_0x3e45ed=_0x48ba81[_0xac4efd];if(_[_0x9b7b('0x47')](_0x693d1e[_0x9b7b('0x26')][_0x3e45ed['id']])){_0x693d1e[_0x9b7b('0x26')][_0x3e45ed['id']]=new FaxAccount(_0x3e45ed);}else{_0x693d1e[_0x9b7b('0x44')](_0x693d1e[_0x9b7b('0x26')][_0x3e45ed['id']],_0x3e45ed);}}}return _0x693d1e[_0x9b7b('0x26')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 5cf2400..c0df96f 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 _0xffe0=['./voiceCallReport','./userReport','realtime','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','agents','accountcode','name','isNil','format','SIP/%s','connectedlinenum','assigned','interface','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','getAgentByInternal','keys','length','channel','split','calleridnum','outbound','internal','destination','exten','dialer','lastdata','context','callerid','calleridpreview','originatecalleridnum','destinationchannel','disposition','transfers','linkedid','transfereelinkedid','uniqueid','type','getCallType','UserId','monitor','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','calleridname','connectedlinename','membername','isArray','forEach','substring','indexOf','mobile','phone','lastIndexOf','exports','lodash','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport'];(function(_0x34d13c,_0x198b7a){var _0x333979=function(_0x141146){while(--_0x141146){_0x34d13c['push'](_0x34d13c['shift']());}};_0x333979(++_0x198b7a);}(_0xffe0,0x161));var _0x0ffe=function(_0x41b84e,_0x20ed28){_0x41b84e=_0x41b84e-0x0;var _0x4668d0=_0xffe0[_0x41b84e];return _0x4668d0;};'use strict';var _=require(_0x0ffe('0x0'));var moment=require('moment');var util=require(_0x0ffe('0x1'));var config=require('../../../config/environment');var ami=require(_0x0ffe('0x2'));var RpcVoiceAgentReport=require(_0x0ffe('0x3'));var RpcVoiceCallReport=require(_0x0ffe('0x4'));var RpcVoiceDialReport=require(_0x0ffe('0x5'));var RpcMemberReport=require(_0x0ffe('0x6'));var RpcVoiceQueueReport=require(_0x0ffe('0x7'));var RpcVoiceRecording=require(_0x0ffe('0x8'));var RpcVoiceTransferReport=require(_0x0ffe('0x9'));var VoiceQueueReport=require(_0x0ffe('0xa'));var VoiceCallReport=require(_0x0ffe('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x0ffe('0xc'));function Report(_0x1594ab){this[_0x0ffe('0xd')]=_0x1594ab;this['agents']=_0x1594ab['agents'];this[_0x0ffe('0xe')]=_0x1594ab[_0x0ffe('0xe')];}Report[_0x0ffe('0xf')][_0x0ffe('0x10')]=function(_0x48eb63){var _0x214aa9=new VoiceQueueReport(this[_0x0ffe('0xd')]);var _0x51180d=new VoiceAgentReport(this[_0x0ffe('0xd')]);var _0x5c05c9=new VoiceDialReport(this['realtime']);var _0x3f5535=new VoiceCallReport(this[_0x0ffe('0xd')]);var _0x5e77ef=new UserReport(this[_0x0ffe('0xd')]);if(config[_0x0ffe('0x11')]&&config['xdr'][_0x0ffe('0x12')]){ami['on'](_0x0ffe('0x13'),this[_0x0ffe('0x14')][_0x0ffe('0x15')](this));ami['on'](_0x0ffe('0x16'),this[_0x0ffe('0x17')][_0x0ffe('0x15')](this));ami['on'](_0x0ffe('0x18'),this[_0x0ffe('0x19')][_0x0ffe('0x15')](this));ami['on'](_0x0ffe('0x1a'),this[_0x0ffe('0x1b')]['bind'](this));ami['on'](_0x0ffe('0x1c'),this[_0x0ffe('0x1d')]['bind'](this));ami['on'](_0x0ffe('0x1e'),this[_0x0ffe('0x1f')]['bind'](this));}};Report[_0x0ffe('0xf')][_0x0ffe('0x20')]=function(_0x3951b4){var _0x43ce69;_0x43ce69=_[_0x0ffe('0x21')](this[_0x0ffe('0x22')],function(_0x38c070){return _0x38c070[_0x0ffe('0x23')]==_0x3951b4||_0x38c070[_0x0ffe('0x24')]==_0x3951b4;});if(_[_0x0ffe('0x25')](_0x43ce69)){var _0x2c96b1=_['find'](this[_0x0ffe('0xe')],function(_0x38e5a5){return _0x38e5a5[_0x0ffe('0x23')]==_0x3951b4||_0x38e5a5[_0x0ffe('0x24')]==_0x3951b4;});if(_0x2c96b1){_0x43ce69=_['find'](this['agents'],function(_0x55f22d){return _0x55f22d['interface']==util[_0x0ffe('0x26')](_0x0ffe('0x27'),_0x2c96b1[_0x0ffe('0x24')]);});}}return _0x43ce69;};Report[_0x0ffe('0xf')][_0x0ffe('0x14')]=function(_0x3c4f5a){for(var _0x1dc56f=0x0;_0x1dc56f<_0x3c4f5a['length'];_0x1dc56f+=0x1){var _0xce2b28=this[_0x0ffe('0x20')](_0x3c4f5a[_0x1dc56f][_0x0ffe('0x28')]);if(_0xce2b28){_0x3c4f5a[_0x1dc56f][_0x0ffe('0x23')]=_0xce2b28[_0x0ffe('0x23')];_0x3c4f5a[_0x1dc56f][_0x0ffe('0x29')]=!![];_0x3c4f5a[_0x1dc56f]['lastAssignedTo']=_0xce2b28[_0x0ffe('0x24')];_0x3c4f5a[_0x1dc56f][_0x0ffe('0x2a')]=_['isNil'](_0xce2b28[_0x0ffe('0x2a')])?util[_0x0ffe('0x26')](_0x0ffe('0x27'),_0xce2b28['name']):_0xce2b28[_0x0ffe('0x2a')];if(_0x3c4f5a[_0x1dc56f][_0x0ffe('0x2b')]){_0x3c4f5a[_0x1dc56f][_0x0ffe('0x2c')]=moment()['format'](_0x0ffe('0x2d'));}if(_0x3c4f5a[_0x1dc56f][_0x0ffe('0x2e')]){_0x3c4f5a[_0x1dc56f]['queuecallerexitAt']=moment()[_0x0ffe('0x26')](_0x0ffe('0x2d'));}RpcMemberReport[_0x0ffe('0x14')](_0x3c4f5a[_0x1dc56f]);}RpcVoiceQueueReport[_0x0ffe('0x2f')](_0x3c4f5a[_0x1dc56f]);}};function extractCalleridNumber(_0x3c5006){var _0x47fe16=_0x3c5006[_0x0ffe('0x30')](/<(.*?)>/);return _0x47fe16?_0x47fe16[0x1]:_0x3c5006;}Report[_0x0ffe('0xf')][_0x0ffe('0x31')]=function(_0x1a1b17){for(var _0x4e2cdc=0x0;_0x4e2cdc',_0x3b3c9d['calleridname'],_0x3b3c9d['calleridnum']);}if(RpcVoiceTransferReport[_0x0ffe('0x43')][_0x3b3c9d[_0x0ffe('0x44')]]){var _0xa676e5=RpcVoiceTransferReport[_0x0ffe('0x43')][_0x3b3c9d[_0x0ffe('0x44')]];_0xa676e5[_0x0ffe('0x45')]=_0x3b3c9d[_0x0ffe('0x46')];RpcVoiceTransferReport[_0x0ffe('0x1d')](_0xa676e5);delete RpcVoiceTransferReport[_0x0ffe('0x43')][_0x3b3c9d['linkedid']];}if(_[_0x0ffe('0x25')](_0x3b3c9d[_0x0ffe('0x47')])){_0x3b3c9d['type']=this[_0x0ffe('0x48')](_0x3b3c9d);}if(_[_0x0ffe('0x25')](_0x3b3c9d[_0x0ffe('0x49')])){var _0x5a2ca9=_0x3b3c9d[_0x0ffe('0x34')]['split']('-')[0x0];var _0x54297b=this[_0x0ffe('0x22')][_0x5a2ca9];if(!_0x54297b)_0x54297b=this[_0x0ffe('0x31')](_0x3b3c9d['accountcode']);if(_0x54297b){_0x3b3c9d['UserId']=_0x54297b['id'];_0x3b3c9d['membername']=_0x54297b['name'];}}RpcVoiceCallReport[_0x0ffe('0x2f')](_0x3b3c9d);if(_0x3b3c9d[_0x0ffe('0x4a')]){for(var _0xfc6d39=0x0;_0xfc6d39<_0x3b3c9d[_0x0ffe('0x4b')][_0x0ffe('0x33')];_0xfc6d39+=0x1){_0x3b3c9d[_0x0ffe('0x4c')]=_0x3b3c9d[_0x0ffe('0x4b')][_0xfc6d39][_0x0ffe('0x4d')];_0x3b3c9d[_0x0ffe('0x4e')]=_0x3b3c9d[_0x0ffe('0x4b')][_0xfc6d39]['createdAt'];if(_0x3b3c9d[_0x0ffe('0x3a')]==_0x0ffe('0x4f')){_0x3b3c9d[_0x0ffe('0x36')]=_0x3b3c9d['connectedlinenum'];_0x3b3c9d[_0x0ffe('0x50')]=_0x3b3c9d['connectedlinename'];_0x3b3c9d[_0x0ffe('0x28')]=_0x3b3c9d[_0x0ffe('0x23')];_0x3b3c9d[_0x0ffe('0x51')]=_0x3b3c9d[_0x0ffe('0x52')];_0x3b3c9d[_0x0ffe('0x3a')]=_0x3b3c9d[_0x0ffe('0x40')];}else if(_0x3b3c9d[_0x0ffe('0x3a')]=='xcally-motion-dialer'){_0x3b3c9d[_0x0ffe('0x36')]=_0x3b3c9d[_0x0ffe('0x39')];_0x3b3c9d[_0x0ffe('0x3a')]=_0x3b3c9d[_0x0ffe('0x40')];}RpcVoiceRecording[_0x0ffe('0x2f')](_0x3b3c9d);}}};Report['prototype'][_0x0ffe('0x19')]=function(_0x158ef0){if(_[_0x0ffe('0x53')](_0x158ef0)){_0x158ef0[_0x0ffe('0x54')](function(_0x27b438){RpcVoiceAgentReport[_0x0ffe('0x2f')](_0x27b438);});}else{RpcVoiceAgentReport[_0x0ffe('0x2f')](_0x158ef0);}};Report['prototype'][_0x0ffe('0x1b')]=function(_0x4fb8f6){RpcVoiceDialReport[_0x0ffe('0x2f')](_0x4fb8f6);var _0x744c71;var _0x14fae6;var _0x3bc1c6=_0x4fb8f6[_0x0ffe('0x34')];if(_['startsWith'](_0x3bc1c6,'Local')){_0x14fae6=_0x3bc1c6[_0x0ffe('0x55')](_0x3bc1c6[_0x0ffe('0x56')]('/')+0x1,_0x3bc1c6[_0x0ffe('0x56')]('@'));_0x744c71=_[_0x0ffe('0x21')](this[_0x0ffe('0x22')],function(_0x1f516f){return _0x1f516f[_0x0ffe('0x57')]==_0x14fae6||_0x1f516f[_0x0ffe('0x58')]==_0x14fae6||_0x1f516f[_0x0ffe('0x23')]==_0x14fae6;});}else{_0x14fae6=_0x3bc1c6[_0x0ffe('0x55')](_0x3bc1c6[_0x0ffe('0x56')]('/')+0x1,_0x3bc1c6[_0x0ffe('0x59')]('-'));_0x744c71=this['findAgent'](_0x14fae6);}if(_0x744c71){_0x4fb8f6[_0x0ffe('0x2a')]=_[_0x0ffe('0x25')](_0x744c71[_0x0ffe('0x2a')])?util[_0x0ffe('0x26')](_0x0ffe('0x27'),_0x744c71[_0x0ffe('0x24')]):_0x744c71[_0x0ffe('0x2a')];_0x4fb8f6[_0x0ffe('0x52')]=_0x744c71[_0x0ffe('0x24')];_0x4fb8f6[_0x0ffe('0x23')]=_0x744c71[_0x0ffe('0x23')];RpcMemberReport['voiceDialReport'](_0x4fb8f6);}};Report[_0x0ffe('0xf')][_0x0ffe('0x1d')]=function(_0x259fe2){RpcVoiceTransferReport['transfers'][_0x259fe2['transfererlinkedid']]=_0x259fe2;};Report[_0x0ffe('0xf')][_0x0ffe('0x1f')]=function(_0x4a0bb5){RpcVoiceTransferReport['attendedTransfer'](_0x4a0bb5);};module[_0x0ffe('0x5a')]=Report; \ No newline at end of file +var _0x677a=['internal','destination','exten','queue','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','callerid','disposition','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','linkedid','transfereelinkedid','uniqueid','transfers','type','UserId','membername','create','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','name','isNil','accountcode','interface','format','SIP/%s','assigned','YYYY-MM-DD\x20HH:mm:ss','match','keys','length','getCallType','channel','split','calleridnum'];(function(_0x491082,_0x28f78b){var _0x5797d9=function(_0x20d0ba){while(--_0x20d0ba){_0x491082['push'](_0x491082['shift']());}};_0x5797d9(++_0x28f78b);}(_0x677a,0x7b));var _0xa677=function(_0x3ba5d7,_0x561296){_0x3ba5d7=_0x3ba5d7-0x0;var _0x569302=_0x677a[_0x3ba5d7];return _0x569302;};'use strict';var _=require('lodash');var moment=require(_0xa677('0x0'));var util=require('util');var config=require(_0xa677('0x1'));var ami=require(_0xa677('0x2'));var RpcVoiceAgentReport=require(_0xa677('0x3'));var RpcVoiceCallReport=require(_0xa677('0x4'));var RpcVoiceDialReport=require(_0xa677('0x5'));var RpcMemberReport=require(_0xa677('0x6'));var RpcVoiceQueueReport=require(_0xa677('0x7'));var RpcVoiceRecording=require(_0xa677('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xa677('0x9'));var VoiceAgentReport=require(_0xa677('0xa'));var VoiceDialReport=require(_0xa677('0xb'));var UserReport=require('./userReport');function Report(_0x4751a2){this[_0xa677('0xc')]=_0x4751a2;this[_0xa677('0xd')]=_0x4751a2['agents'];this[_0xa677('0xe')]=_0x4751a2[_0xa677('0xe')];}Report[_0xa677('0xf')][_0xa677('0x10')]=function(_0x21c3e3){var _0x23a647=new VoiceQueueReport(this[_0xa677('0xc')]);var _0x46604f=new VoiceAgentReport(this['realtime']);var _0x1868ac=new VoiceDialReport(this[_0xa677('0xc')]);var _0x32b1a2=new VoiceCallReport(this[_0xa677('0xc')]);var _0xd4f049=new UserReport(this['realtime']);if(config[_0xa677('0x11')]&&config[_0xa677('0x11')][_0xa677('0x12')]){ami['on'](_0xa677('0x13'),this[_0xa677('0x14')][_0xa677('0x15')](this));ami['on']('custom:voiceCallReport',this[_0xa677('0x16')][_0xa677('0x15')](this));ami['on'](_0xa677('0x17'),this[_0xa677('0x18')][_0xa677('0x15')](this));ami['on'](_0xa677('0x19'),this[_0xa677('0x1a')][_0xa677('0x15')](this));ami['on'](_0xa677('0x1b'),this[_0xa677('0x1c')][_0xa677('0x15')](this));ami['on']('attendedtransfer',this[_0xa677('0x1d')][_0xa677('0x15')](this));}};Report[_0xa677('0xf')][_0xa677('0x1e')]=function(_0x19e32f){var _0xd02862;_0xd02862=_[_0xa677('0x1f')](this[_0xa677('0xd')],function(_0x59c67a){return _0x59c67a['accountcode']==_0x19e32f||_0x59c67a[_0xa677('0x20')]==_0x19e32f;});if(_[_0xa677('0x21')](_0xd02862)){var _0x72ae62=_[_0xa677('0x1f')](this[_0xa677('0xe')],function(_0x25a6b3){return _0x25a6b3[_0xa677('0x22')]==_0x19e32f||_0x25a6b3[_0xa677('0x20')]==_0x19e32f;});if(_0x72ae62){_0xd02862=_[_0xa677('0x1f')](this[_0xa677('0xd')],function(_0x214e53){return _0x214e53[_0xa677('0x23')]==util[_0xa677('0x24')](_0xa677('0x25'),_0x72ae62[_0xa677('0x20')]);});}}return _0xd02862;};Report[_0xa677('0xf')][_0xa677('0x14')]=function(_0x45fb36){for(var _0x3c8b08=0x0;_0x3c8b08<_0x45fb36['length'];_0x3c8b08+=0x1){var _0x592b86=this[_0xa677('0x1e')](_0x45fb36[_0x3c8b08]['connectedlinenum']);if(_0x592b86){_0x45fb36[_0x3c8b08][_0xa677('0x22')]=_0x592b86['accountcode'];_0x45fb36[_0x3c8b08][_0xa677('0x26')]=!![];_0x45fb36[_0x3c8b08]['lastAssignedTo']=_0x592b86[_0xa677('0x20')];_0x45fb36[_0x3c8b08][_0xa677('0x23')]=_[_0xa677('0x21')](_0x592b86[_0xa677('0x23')])?util['format'](_0xa677('0x25'),_0x592b86['name']):_0x592b86[_0xa677('0x23')];if(_0x45fb36[_0x3c8b08]['queuecallercomplete']){_0x45fb36[_0x3c8b08]['queuecallercompleteAt']=moment()[_0xa677('0x24')](_0xa677('0x27'));}if(_0x45fb36[_0x3c8b08]['queuecallerexit']){_0x45fb36[_0x3c8b08]['queuecallerexitAt']=moment()[_0xa677('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xa677('0x14')](_0x45fb36[_0x3c8b08]);}RpcVoiceQueueReport['create'](_0x45fb36[_0x3c8b08]);}};function extractCalleridNumber(_0x585d7c){var _0x5c3f98=_0x585d7c[_0xa677('0x28')](/<(.*?)>/);return _0x5c3f98?_0x5c3f98[0x1]:_0x585d7c;}Report[_0xa677('0xf')]['getAgentByInternal']=function(_0x54a64a){for(var _0x3af732=0x0;_0x3af7320x0?_0x441d3e:0x0;this[_0xd626('0x11')][_0x1424c7[_0xd626('0x72')]]['talking']=this[_0xd626('0x11')][_0x1424c7[_0xd626('0x72')]][_0xd626('0x35')]>_[_0xd626('0x77')](_0x1424c7[_0xd626('0x78')])?_[_0xd626('0x77')](_0x1424c7[_0xd626('0x78')]):this[_0xd626('0x11')][_0x1424c7[_0xd626('0x72')]][_0xd626('0x35')];this[_0xd626('0x5a')](this[_0xd626('0x11')][_0x1424c7['queue']],_0xd626('0x6e'));}logger[_0xd626('0x4e')](_0xd626('0x79'),util['inspect'](this[_0xd626('0x11')][_0x1424c7['queue']],{'showHidden':![],'depth':null}));ami['emit'](_0xd626('0x7a'),this[_0xd626('0x11')][_0x1424c7[_0xd626('0x72')]]);}}}catch(_0x55fb81){logger[_0xd626('0x44')](_0xd626('0x70'),util[_0xd626('0x42')](_0x55fb81,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd626('0xa')][_0xd626('0x18')]=function(_0x89ad21){logger[_0xd626('0x4e')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xd626('0x42')](_0x89ad21,{'showHidden':![],'depth':null}));ami[_0xd626('0x4c')](_0xd626('0x7b'),{});this[_0xd626('0x12')]=!![];};VoiceQueueReport[_0xd626('0xa')][_0xd626('0x1a')]=function(_0x3d3b87){try{if(this[_0xd626('0x71')](_0x3d3b87)){logger['debug'](_0xd626('0x7c'),_0x3d3b87[_0xd626('0x54')],util[_0xd626('0x42')](_0x3d3b87,{'showHidden':![],'depth':null}));if(_[_0xd626('0x6c')](this[_0xd626('0x43')][_0x3d3b87['uniqueid']]))this[_0xd626('0x43')][_0x3d3b87[_0xd626('0x54')]]=[];if(_[_0xd626('0x6c')](this['channels'][_0x3d3b87[_0xd626('0x54')]]))this[_0xd626('0xf')][_0x3d3b87[_0xd626('0x54')]]={};var _0x209b26=new QueueReport();_0x209b26['name']=_0x3d3b87[_0xd626('0x72')];_0x209b26['type']=this[_0xd626('0x11')][_0x209b26[_0xd626('0x51')]]&&this['voiceQueues'][_0x209b26[_0xd626('0x51')]][_0xd626('0x63')]?this['voiceQueues'][_0x209b26[_0xd626('0x51')]][_0xd626('0x63')]||_0xd626('0x5b'):_0xd626('0x5b');_0x209b26[_0xd626('0x72')]=_0x3d3b87[_0xd626('0x72')];_0x209b26[_0xd626('0x7d')]=moment()[_0xd626('0x50')](_0xd626('0x7e'));_0x209b26[_0xd626('0x7f')]=_0x3d3b87['position'];_0x209b26['count']=_0x3d3b87[_0xd626('0x80')];_0x209b26[_0xd626('0x54')]=_0x3d3b87['uniqueid'];_0x209b26[_0xd626('0x81')]=this['channels'][_0x3d3b87[_0xd626('0x54')]][_0xd626('0x81')];logger[_0xd626('0x82')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x209b26['name'],_0x209b26[_0xd626('0x63')]);_[_0xd626('0x83')](_0x209b26,_[_0xd626('0x84')](_0x3d3b87,_['keys'](_0x209b26)));this[_0xd626('0x43')][_0x3d3b87[_0xd626('0x54')]][_0xd626('0x85')](_0x209b26);this['channels'][_0x3d3b87['uniqueid']]=_0x209b26;this[_0xd626('0x4d')](_0x209b26,_0xd626('0x19'));}}catch(_0x3b92a5){logger[_0xd626('0x44')](_0xd626('0x7c'),_0x3d3b87[_0xd626('0x54')],util[_0xd626('0x42')](_0x3b92a5,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd626('0x1c')]=function(_0x1dfae0){try{if(this[_0xd626('0x71')](_0x1dfae0)){logger[_0xd626('0x4e')](_0xd626('0x86'),_0x1dfae0[_0xd626('0x54')],util[_0xd626('0x42')](_0x1dfae0,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x1dfae0[_0xd626('0x54')]]){var _0x1f723e=_[_0xd626('0x87')](this['queueReports'][_0x1dfae0[_0xd626('0x54')]]);_0x1f723e[_0xd626('0x88')]=![];_0x1f723e['queuecallercompleteAt']=null;_0x1f723e[_0xd626('0x89')]=_0x1dfae0[_0xd626('0x89')];_0x1f723e['originalposition']=_0x1dfae0[_0xd626('0x8a')];_0x1f723e[_0xd626('0x1b')]=!![];_0x1f723e[_0xd626('0x8b')]=moment()[_0xd626('0x50')](_0xd626('0x7e'));_0x1f723e[_0xd626('0x55')]=_0xd626('0x8c');_0x1f723e[_0xd626('0x8d')]=null;logger[_0xd626('0x82')](_0xd626('0x8e'),_0x1f723e[_0xd626('0x51')],_0x1f723e[_0xd626('0x63')]);this[_0xd626('0xf')][_0x1dfae0[_0xd626('0x54')]]=_0x1f723e;this[_0xd626('0x4a')](_0x1f723e,_0xd626('0x1b'));}}}catch(_0x5c1ecf){logger['error'](_0xd626('0x86'),_0x1dfae0[_0xd626('0x54')],util['inspect'](_0x5c1ecf,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd626('0xa')][_0xd626('0x1e')]=function(_0x50953b){try{if(this[_0xd626('0x71')](_0x50953b)){logger[_0xd626('0x4e')](_0xd626('0x8f'),_0x50953b[_0xd626('0x54')],util[_0xd626('0x42')](_0x50953b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x50953b['uniqueid']]){var _0x12b541=_[_0xd626('0x87')](this[_0xd626('0x43')][_0x50953b[_0xd626('0x54')]]);_0x12b541['queuecallerleaveAt']=moment()['format'](_0xd626('0x7e'));_0x12b541[_0xd626('0x90')]=_0x50953b['connectedlinenum'];_0x12b541[_0xd626('0x91')]=_0x50953b['connectedlinename'];logger[_0xd626('0x82')](_0xd626('0x92'),_0x12b541['name'],_0x12b541[_0xd626('0x63')],_0x50953b[_0xd626('0x90')],_0x50953b[_0xd626('0x91')]);this[_0xd626('0xf')][_0x50953b['uniqueid']]=_0x12b541;this[_0xd626('0x4d')](_0x12b541,_0xd626('0x1d'));}}}catch(_0x4e05e1){logger[_0xd626('0x44')](_0xd626('0x8f'),_0x50953b[_0xd626('0x54')],util[_0xd626('0x42')](_0x4e05e1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd626('0xa')][_0xd626('0x22')]=function(_0x305f1d){try{if(this[_0xd626('0x71')](_0x305f1d)){logger[_0xd626('0x4e')](_0xd626('0x93'),_0x305f1d['uniqueid'],util[_0xd626('0x42')](_0x305f1d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x305f1d[_0xd626('0x54')]]){var _0x70994c=_['last'](this[_0xd626('0x43')][_0x305f1d['uniqueid']]);_0x70994c[_0xd626('0x88')]=!![];_0x70994c[_0xd626('0x55')]=_0xd626('0x94');logger[_0xd626('0x82')](_0xd626('0x95'),_0x70994c['name'],_0x70994c[_0xd626('0x63')]);}}}catch(_0x51174e){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x305f1d[_0xd626('0x54')],util[_0xd626('0x42')](_0x51174e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd626('0xa')]['syncAgentComplete']=function(_0xfbd84f){try{if(this[_0xd626('0x71')](_0xfbd84f)){logger[_0xd626('0x4e')](_0xd626('0x96'),_0xfbd84f['uniqueid'],util[_0xd626('0x42')](_0xfbd84f,{'showHidden':![],'depth':null}));if(this[_0xd626('0x43')][_0xfbd84f['uniqueid']]){var _0x1196f1=_[_0xd626('0x87')](this['queueReports'][_0xfbd84f[_0xd626('0x54')]]);_0x1196f1[_0xd626('0x1b')]=![];_0x1196f1[_0xd626('0x8b')]=null;_0x1196f1[_0xd626('0x97')]=!![];_0x1196f1[_0xd626('0x8d')]=_0xfbd84f['membername'];_0x1196f1[_0xd626('0x89')]=_0xfbd84f[_0xd626('0x89')];_0x1196f1[_0xd626('0x88')]=!![];_0x1196f1['queuecallerexit']=![];_0x1196f1[_0xd626('0x98')]=null;if(!_0x1196f1[_0xd626('0x99')]){if(_0xfbd84f[_0xd626('0x9a')]==_0xd626('0x99')){_0x1196f1[_0xd626('0x55')]=_0xd626('0x9b');logger[_0xd626('0x82')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x1196f1[_0xd626('0x51')],_0x1196f1[_0xd626('0x63')]);}else{if(_[_0xd626('0x9c')](_0xfbd84f[_0xd626('0x9d')][_0xd626('0x9e')](),_0xd626('0x9f'))){if(this['queueReports'][_0xfbd84f[_0xd626('0xa0')]]){var _0x1c7507=_[_0xd626('0x87')](this[_0xd626('0x43')][_0xfbd84f[_0xd626('0xa0')]]);_0x1c7507[_0xd626('0x88')]=![];_0x1c7507[_0xd626('0xa1')]=!![];_0x1c7507['queuecallerexitAt']=moment(_0x1196f1[_0xd626('0x7d')])['add'](_0xfbd84f['holdtime'],_0xd626('0xa2'))[_0xd626('0x50')](_0xd626('0x7e'));_0x1c7507[_0xd626('0x55')]=_0xd626('0xa3');_0x1c7507[_0xd626('0x99')]=!![];_0x1c7507[_0xd626('0xa4')]=_0xd626('0xa5');_0x1c7507[_0xd626('0xa6')]=_0xfbd84f['destexten'];_0x1c7507[_0xd626('0xa7')]=_0xfbd84f[_0xd626('0x54')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x1c7507[_0xd626('0x51')],_0x1c7507[_0xd626('0x63')]);var _0x4f709e=this[_0xd626('0x43')][_0xfbd84f[_0xd626('0xa0')]];this[_0xd626('0x43')][_0xfbd84f[_0xd626('0xa0')]]=this[_0xd626('0x43')][_0xfbd84f[_0xd626('0x54')]];this[_0xd626('0x43')][_0xfbd84f[_0xd626('0x54')]]=_0x4f709e;}}else{_0x1196f1[_0xd626('0x55')]='COMPLETEDBY'+_0xfbd84f[_0xd626('0x9a')][_0xd626('0xa8')]();logger[_0xd626('0x82')](_0xd626('0xa9'),_0x1196f1[_0xd626('0x51')],_0x1196f1[_0xd626('0x63')],_0x1196f1[_0xd626('0x55')]);}}}this[_0xd626('0xf')][_0xfbd84f[_0xd626('0x54')]]=_0x1196f1;this['emitVoiceQueueChannelRemove'](_0x1196f1,_0xd626('0x1f'));}}}catch(_0x3a1464){logger['error'](_0xd626('0x96'),_0xfbd84f[_0xd626('0x54')],util[_0xd626('0x42')](_0x3a1464,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd626('0xa')][_0xd626('0x24')]=function(_0x25f515){try{if(this['isNotNull'](_0x25f515)){logger['debug'](_0xd626('0xaa'),_0x25f515[_0xd626('0x54')],util['inspect'](_0x25f515,{'showHidden':![],'depth':null}));this[_0xd626('0xab')](_0x25f515[_0xd626('0x54')],_[_0xd626('0xac')](_0x25f515[_0xd626('0xad')])[0x0],_0x25f515[_0xd626('0xae')]);if(this[_0xd626('0x43')][_0x25f515[_0xd626('0x54')]]){var _0x4d8d53=_[_0xd626('0x87')](this[_0xd626('0x43')][_0x25f515[_0xd626('0x54')]]);if(_0x4d8d53){if(this[_0xd626('0x71')](_0x25f515[_0xd626('0xad')])&&this['isNotNull'](_0x25f515[_0xd626('0xad')][_0xd626('0xaf')])){switch(_0x25f515['value']){case _0xd626('0xb0'):_0x4d8d53['queuecallerexit']=![];_0x4d8d53[_0xd626('0x98')]=null;break;case'TIMEOUT':_0x4d8d53[_0xd626('0xb1')]=_0xd626('0xb2');_0x4d8d53[_0xd626('0xa1')]=!![];_0x4d8d53[_0xd626('0x98')]=moment()[_0xd626('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x4d8d53[_0xd626('0xb3')]=moment()[_0xd626('0x50')](_0xd626('0x7e'));logger[_0xd626('0x4e')](_0xd626('0xb4'),_0x25f515['uniqueid'],util[_0xd626('0x42')](_0x4d8d53,{'showHidden':![],'depth':null}));ami['emit'](_0xd626('0xb5'),_0x4d8d53);break;default:_0x4d8d53['queuecallerexit']=!![];_0x4d8d53[_0xd626('0x98')]=moment()['format'](_0xd626('0x7e'));_0x4d8d53[_0xd626('0xb3')]=moment()[_0xd626('0x50')](_0xd626('0x7e'));}_0x4d8d53['queuecallerabandon']=![];_0x4d8d53[_0xd626('0x8b')]=null;_0x4d8d53[_0xd626('0x55')]=_0x25f515['value'];this[_0xd626('0xf')][_0x25f515[_0xd626('0x54')]]=_0x4d8d53;this[_0xd626('0x4a')](_0x4d8d53,_0xd626('0x23'));}else if(this[_0xd626('0x71')](_0x25f515[_0xd626('0xad')])&&this[_0xd626('0x71')](_0x25f515[_0xd626('0xad')]['queueposition'])){if(!_0x4d8d53[_0xd626('0x1b')]){_0x4d8d53['queuecallerexit']=!![];_0x4d8d53[_0xd626('0x98')]=moment()[_0xd626('0x50')](_0xd626('0x7e'));_0x4d8d53[_0xd626('0x55')]=_0xd626('0xb6');_0x4d8d53['queuecallerleaveAt']=moment()['format'](_0xd626('0x7e'));this['channels'][_0x25f515[_0xd626('0x54')]]=_0x4d8d53;}}logger[_0xd626('0x82')](_0xd626('0xb7'),_0x25f515[_0xd626('0x54')],_0x4d8d53[_0xd626('0x51')],_0x4d8d53[_0xd626('0x63')],_['keys'](_0x25f515[_0xd626('0xad')])[0x0],_0x25f515[_0xd626('0xae')]);_0x4d8d53[_0xd626('0x14')]=this[_0xd626('0x14')][_0x25f515[_0xd626('0x54')]];}}}}catch(_0x5bc9af){logger[_0xd626('0x44')](_0xd626('0xaa'),_0x25f515['uniqueid'],util['inspect'](_0x5bc9af,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd626('0xa')][_0xd626('0xab')]=function(_0x5d555e,_0x459551,_0x10ec4c){var _0xc8b45b=['rtpaudioqos',_0xd626('0xb8'),_0xd626('0xb9'),'rtpaudioqosjitterbridged',_0xd626('0xba'),'rtpaudioqoslossbridged',_0xd626('0xbb'),_0xd626('0xbc'),_0xd626('0xbd'),_0xd626('0xbe'),'bridgepeer','bridgepvtcallid',_0xd626('0xbf'),_0xd626('0xc0'),_0xd626('0xc1'),_0xd626('0xc2'),_0xd626('0xc3'),_0xd626('0xc4'),'memberrealtime'];if(!_[_0xd626('0x3b')](_0x459551)&&!_[_0xd626('0xc5')](_0xc8b45b,_0x459551)){if(_['isUndefined'](this[_0xd626('0x14')][_0x5d555e])){this['variables'][_0x5d555e]={};}this[_0xd626('0x14')][_0x5d555e][_0x459551]=_0x10ec4c;}};VoiceQueueReport[_0xd626('0xa')][_0xd626('0xc6')]=function(_0x45cf78,_0x5d85b1,_0x3df9fb){var _0x209e9a={};for(var _0x38b704=0x0;_0x38b7040x0?_0x3002b1:0x0;this[_0x6412('0xb')][_0x3a5f95[_0x6412('0x69')]][_0x6412('0x2d')]=this['voiceQueues'][_0x3a5f95[_0x6412('0x69')]]['talking']>_[_0x6412('0x6e')](_0x3a5f95[_0x6412('0x6f')])?_[_0x6412('0x6e')](_0x3a5f95[_0x6412('0x6f')]):this['voiceQueues'][_0x3a5f95['queue']]['talking'];this[_0x6412('0x50')](this[_0x6412('0xb')][_0x3a5f95[_0x6412('0x69')]],_0x6412('0xf'));}logger[_0x6412('0x4d')](_0x6412('0x71'),util['inspect'](this[_0x6412('0xb')][_0x3a5f95[_0x6412('0x69')]],{'showHidden':![],'depth':null}));ami['emit'](_0x6412('0x72'),this['voiceQueues'][_0x3a5f95[_0x6412('0x69')]]);}}}catch(_0x5b2a70){logger['error'](_0x6412('0x67'),util[_0x6412('0x46')](_0x5b2a70,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6412('0x12')]=function(_0x1984fe){logger[_0x6412('0x4d')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x6412('0x46')](_0x1984fe,{'showHidden':![],'depth':null}));ami['emit'](_0x6412('0x73'),{});this['flagQueueSummary']=!![];};VoiceQueueReport[_0x6412('0x30')]['syncQueueCallerJoin']=function(_0x203eaa){try{if(this[_0x6412('0x63')](_0x203eaa)){logger[_0x6412('0x4d')](_0x6412('0x74'),_0x203eaa[_0x6412('0x45')],util[_0x6412('0x46')](_0x203eaa,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x6412('0x3c')][_0x203eaa[_0x6412('0x45')]]))this['queueReports'][_0x203eaa[_0x6412('0x45')]]=[];if(_[_0x6412('0x64')](this[_0x6412('0xa')][_0x203eaa[_0x6412('0x45')]]))this[_0x6412('0xa')][_0x203eaa['uniqueid']]={};var _0xa7b70=new QueueReport();_0xa7b70[_0x6412('0x49')]=_0x203eaa[_0x6412('0x69')];_0xa7b70[_0x6412('0x51')]=this['voiceQueues'][_0xa7b70[_0x6412('0x49')]]&&this['voiceQueues'][_0xa7b70['name']][_0x6412('0x51')]?this[_0x6412('0xb')][_0xa7b70['name']][_0x6412('0x51')]||_0x6412('0x52'):_0x6412('0x52');_0xa7b70[_0x6412('0x69')]=_0x203eaa[_0x6412('0x69')];_0xa7b70[_0x6412('0x75')]=moment()[_0x6412('0x47')](_0x6412('0x76'));_0xa7b70['position']=_0x203eaa[_0x6412('0x77')];_0xa7b70[_0x6412('0x78')]=_0x203eaa['count'];_0xa7b70[_0x6412('0x45')]=_0x203eaa[_0x6412('0x45')];_0xa7b70[_0x6412('0x79')]=this['channels'][_0x203eaa[_0x6412('0x45')]][_0x6412('0x79')];logger['info'](_0x6412('0x7a'),_0xa7b70['name'],_0xa7b70[_0x6412('0x51')]);_[_0x6412('0x7b')](_0xa7b70,_[_0x6412('0x7c')](_0x203eaa,_[_0x6412('0x7d')](_0xa7b70)));this[_0x6412('0x3c')][_0x203eaa[_0x6412('0x45')]][_0x6412('0x7e')](_0xa7b70);this[_0x6412('0xa')][_0x203eaa[_0x6412('0x45')]]=_0xa7b70;this[_0x6412('0x7f')](_0xa7b70,_0x6412('0x14'));}}catch(_0x4f60ef){logger['error'](_0x6412('0x74'),_0x203eaa[_0x6412('0x45')],util['inspect'](_0x4f60ef,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6412('0x30')][_0x6412('0x16')]=function(_0x3469c1){try{if(this[_0x6412('0x63')](_0x3469c1)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x3469c1[_0x6412('0x45')],util['inspect'](_0x3469c1,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3469c1[_0x6412('0x45')]]){var _0x282976=_[_0x6412('0x80')](this['queueReports'][_0x3469c1['uniqueid']]);_0x282976[_0x6412('0x81')]=![];_0x282976[_0x6412('0x82')]=null;_0x282976[_0x6412('0x83')]=_0x3469c1[_0x6412('0x83')];_0x282976[_0x6412('0x84')]=_0x3469c1['originalposition'];_0x282976[_0x6412('0x85')]=!![];_0x282976[_0x6412('0x86')]=moment()[_0x6412('0x47')](_0x6412('0x76'));_0x282976['queuecallerexitreason']=_0x6412('0x87');_0x282976[_0x6412('0x88')]=null;logger[_0x6412('0x6a')](_0x6412('0x89'),_0x282976[_0x6412('0x49')],_0x282976['type']);this['channels'][_0x3469c1[_0x6412('0x45')]]=_0x282976;this[_0x6412('0x4c')](_0x282976,_0x6412('0x85'));}}}catch(_0x31ef67){logger['error'](_0x6412('0x8a'),_0x3469c1['uniqueid'],util['inspect'](_0x31ef67,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6412('0x17')]=function(_0x4aeb7f){try{if(this[_0x6412('0x63')](_0x4aeb7f)){logger[_0x6412('0x4d')](_0x6412('0x8b'),_0x4aeb7f[_0x6412('0x45')],util['inspect'](_0x4aeb7f,{'showHidden':![],'depth':null}));if(this[_0x6412('0x3c')][_0x4aeb7f[_0x6412('0x45')]]){var _0x354eb3=_[_0x6412('0x80')](this[_0x6412('0x3c')][_0x4aeb7f[_0x6412('0x45')]]);_0x354eb3['queuecallerleaveAt']=moment()[_0x6412('0x47')](_0x6412('0x76'));_0x354eb3[_0x6412('0x8c')]=_0x4aeb7f[_0x6412('0x8c')];_0x354eb3[_0x6412('0x8d')]=_0x4aeb7f[_0x6412('0x8d')];logger[_0x6412('0x6a')](_0x6412('0x8e'),_0x354eb3[_0x6412('0x49')],_0x354eb3[_0x6412('0x51')],_0x4aeb7f[_0x6412('0x8c')],_0x4aeb7f[_0x6412('0x8d')]);this[_0x6412('0xa')][_0x4aeb7f['uniqueid']]=_0x354eb3;this[_0x6412('0x7f')](_0x354eb3,_0x6412('0x8f'));}}}catch(_0x19b19b){logger[_0x6412('0x3d')](_0x6412('0x8b'),_0x4aeb7f[_0x6412('0x45')],util[_0x6412('0x46')](_0x19b19b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6412('0x90')]=function(_0x4097d4){try{if(this[_0x6412('0x63')](_0x4097d4)){logger['debug'](_0x6412('0x91'),_0x4097d4['uniqueid'],util[_0x6412('0x46')](_0x4097d4,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4097d4[_0x6412('0x45')]]){var _0x271915=_['last'](this[_0x6412('0x3c')][_0x4097d4[_0x6412('0x45')]]);_0x271915[_0x6412('0x81')]=!![];_0x271915['queuecallerexitreason']=_0x6412('0x92');logger[_0x6412('0x6a')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x271915[_0x6412('0x49')],_0x271915[_0x6412('0x51')]);}}}catch(_0x2f1a49){logger[_0x6412('0x3d')](_0x6412('0x91'),_0x4097d4['uniqueid'],util[_0x6412('0x46')](_0x2f1a49,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6412('0x19')]=function(_0x23fc7d){try{if(this['isNotNull'](_0x23fc7d)){logger[_0x6412('0x4d')]('[%s][voiceQueueReport][agentcomplete]',_0x23fc7d[_0x6412('0x45')],util[_0x6412('0x46')](_0x23fc7d,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x23fc7d[_0x6412('0x45')]]){var _0x4ddd22=_[_0x6412('0x80')](this['queueReports'][_0x23fc7d[_0x6412('0x45')]]);_0x4ddd22['queuecallerabandon']=![];_0x4ddd22['queuecallerabandonAt']=null;_0x4ddd22['assigned']=!![];_0x4ddd22[_0x6412('0x88')]=_0x23fc7d[_0x6412('0x93')];_0x4ddd22['holdtime']=_0x23fc7d[_0x6412('0x83')];_0x4ddd22['queuecallercomplete']=!![];_0x4ddd22[_0x6412('0x94')]=![];_0x4ddd22['queuecallerexitAt']=null;if(!_0x4ddd22[_0x6412('0x95')]){if(_0x23fc7d[_0x6412('0x96')]==_0x6412('0x95')){_0x4ddd22['queuecallerexitreason']=_0x6412('0x97');logger[_0x6412('0x6a')](_0x6412('0x98'),_0x4ddd22[_0x6412('0x49')],_0x4ddd22[_0x6412('0x51')]);}else{if(_[_0x6412('0x99')](_0x23fc7d[_0x6412('0x38')][_0x6412('0x9a')](),_0x6412('0x9b'))){if(this['queueReports'][_0x23fc7d['linkedid']]){var _0x210972=_['last'](this[_0x6412('0x3c')][_0x23fc7d[_0x6412('0x9c')]]);_0x210972[_0x6412('0x81')]=![];_0x210972[_0x6412('0x94')]=!![];_0x210972[_0x6412('0x9d')]=moment(_0x4ddd22[_0x6412('0x75')])['add'](_0x23fc7d[_0x6412('0x83')],_0x6412('0x9e'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x210972[_0x6412('0x9f')]=_0x6412('0xa0');_0x210972[_0x6412('0x95')]=!![];_0x210972[_0x6412('0xa1')]='FORWARD';_0x210972[_0x6412('0xa2')]=_0x23fc7d[_0x6412('0xa3')];_0x210972[_0x6412('0xa4')]=_0x23fc7d[_0x6412('0x45')];logger['info'](_0x6412('0xa5'),_0x210972['name'],_0x210972['type']);var _0x274c52=this[_0x6412('0x3c')][_0x23fc7d['linkedid']];this[_0x6412('0x3c')][_0x23fc7d[_0x6412('0x9c')]]=this[_0x6412('0x3c')][_0x23fc7d[_0x6412('0x45')]];this[_0x6412('0x3c')][_0x23fc7d[_0x6412('0x45')]]=_0x274c52;}}else{_0x4ddd22[_0x6412('0x9f')]=_0x6412('0xa6')+_0x23fc7d[_0x6412('0x96')][_0x6412('0xa7')]();logger['info'](_0x6412('0xa8'),_0x4ddd22[_0x6412('0x49')],_0x4ddd22[_0x6412('0x51')],_0x4ddd22['queuecallerexitreason']);}}}this[_0x6412('0xa')][_0x23fc7d[_0x6412('0x45')]]=_0x4ddd22;this[_0x6412('0x4c')](_0x4ddd22,'agentcomplete');}}}catch(_0x160fb8){logger[_0x6412('0x3d')](_0x6412('0xa9'),_0x23fc7d[_0x6412('0x45')],util[_0x6412('0x46')](_0x160fb8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6412('0x30')][_0x6412('0x1c')]=function(_0x104fb6){try{if(this[_0x6412('0x63')](_0x104fb6)){logger[_0x6412('0x4d')](_0x6412('0xaa'),_0x104fb6['uniqueid'],util[_0x6412('0x46')](_0x104fb6,{'showHidden':![],'depth':null}));this[_0x6412('0xab')](_0x104fb6[_0x6412('0x45')],_[_0x6412('0x7d')](_0x104fb6[_0x6412('0xac')])[0x0],_0x104fb6[_0x6412('0xad')]);if(this[_0x6412('0x3c')][_0x104fb6[_0x6412('0x45')]]){var _0x4e11c0=_[_0x6412('0x80')](this[_0x6412('0x3c')][_0x104fb6[_0x6412('0x45')]]);if(_0x4e11c0){if(this['isNotNull'](_0x104fb6[_0x6412('0xac')])&&this[_0x6412('0x63')](_0x104fb6['variable']['queuestatus'])){switch(_0x104fb6[_0x6412('0xad')]){case _0x6412('0xae'):_0x4e11c0[_0x6412('0x94')]=![];_0x4e11c0[_0x6412('0x9d')]=null;break;case'TIMEOUT':_0x4e11c0[_0x6412('0xaf')]=_0x6412('0xb0');_0x4e11c0[_0x6412('0x94')]=!![];_0x4e11c0[_0x6412('0x9d')]=moment()[_0x6412('0x47')](_0x6412('0x76'));_0x4e11c0[_0x6412('0xb1')]=moment()[_0x6412('0x47')](_0x6412('0x76'));logger[_0x6412('0x4d')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x104fb6[_0x6412('0x45')],util[_0x6412('0x46')](_0x4e11c0,{'showHidden':![],'depth':null}));ami[_0x6412('0x42')](_0x6412('0xb2'),_0x4e11c0);break;default:_0x4e11c0['queuecallerexit']=!![];_0x4e11c0[_0x6412('0x9d')]=moment()[_0x6412('0x47')](_0x6412('0x76'));_0x4e11c0[_0x6412('0xb1')]=moment()[_0x6412('0x47')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4e11c0[_0x6412('0x85')]=![];_0x4e11c0[_0x6412('0x86')]=null;_0x4e11c0['queuecallerexitreason']=_0x104fb6['value'];this[_0x6412('0xa')][_0x104fb6[_0x6412('0x45')]]=_0x4e11c0;this[_0x6412('0x4c')](_0x4e11c0,_0x6412('0x1b'));}else if(this[_0x6412('0x63')](_0x104fb6[_0x6412('0xac')])&&this[_0x6412('0x63')](_0x104fb6['variable']['queueposition'])){if(!_0x4e11c0[_0x6412('0x85')]){_0x4e11c0['queuecallerexit']=!![];_0x4e11c0[_0x6412('0x9d')]=moment()[_0x6412('0x47')](_0x6412('0x76'));_0x4e11c0['queuecallerexitreason']='EXITWITHKEY';_0x4e11c0[_0x6412('0xb1')]=moment()[_0x6412('0x47')](_0x6412('0x76'));this['channels'][_0x104fb6['uniqueid']]=_0x4e11c0;}}logger[_0x6412('0x6a')](_0x6412('0xb3'),_0x104fb6['uniqueid'],_0x4e11c0['name'],_0x4e11c0[_0x6412('0x51')],_['keys'](_0x104fb6[_0x6412('0xac')])[0x0],_0x104fb6[_0x6412('0xad')]);_0x4e11c0[_0x6412('0xe')]=this[_0x6412('0xe')][_0x104fb6['uniqueid']];}}}}catch(_0x48626b){logger[_0x6412('0x3d')](_0x6412('0xaa'),_0x104fb6[_0x6412('0x45')],util['inspect'](_0x48626b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6412('0xab')]=function(_0xfd2017,_0x1c4fe5,_0xbedbaf){var _0x26eecb=[_0x6412('0xb4'),_0x6412('0xb5'),_0x6412('0xb6'),_0x6412('0xb7'),_0x6412('0xb8'),'rtpaudioqoslossbridged',_0x6412('0xb9'),_0x6412('0xba'),'sipcallid',_0x6412('0xbb'),'bridgepeer',_0x6412('0xbc'),_0x6412('0xbd'),_0x6412('0xbe'),_0x6412('0xbf'),_0x6412('0xc0'),_0x6412('0x93'),_0x6412('0xc1'),_0x6412('0xc2')];if(!_[_0x6412('0x35')](_0x1c4fe5)&&!_['includes'](_0x26eecb,_0x1c4fe5)){if(_[_0x6412('0x64')](this[_0x6412('0xe')][_0xfd2017])){this[_0x6412('0xe')][_0xfd2017]={};}this['variables'][_0xfd2017][_0x1c4fe5]=_0xbedbaf;}};VoiceQueueReport[_0x6412('0x30')][_0x6412('0xc3')]=function(_0x4e2fd0,_0x4bd464,_0x5e3d15){var _0x14cfb3={};for(var _0xac6ccc=0x0;_0xac6ccc=0x0?moment(_0xca3ed4[_0xcbeb('0x16')])[_0xcbeb('0xb')](_0xca3ed4[_0xcbeb('0x15')],_0xcbeb('0xc')):null,'data1':_0xcbeb('0x17'),'data2':_0xca3ed4[_0xcbeb('0x10')],'data3':_0xca3ed4['exten'],'data4':_0xca3ed4[_0xcbeb('0x18')]||null,'role':'agent','internal':_0xca3ed4['accountcode']?_['toNumber'](_0xca3ed4['accountcode']):undefined,'uniqueid':_0xca3ed4['uniqueid']},'log':_0xcbeb('0x12')});}; \ No newline at end of file +var _0xc7a3=['calleridnum','agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','starttime','endtime','exten','dialstring','moment','lodash','util','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','lastAssignedTo','isNil','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound'];(function(_0x58cc40,_0x183602){var _0x19f72b=function(_0x26cc96){while(--_0x26cc96){_0x58cc40['push'](_0x58cc40['shift']());}};_0x19f72b(++_0x183602);}(_0xc7a3,0xad));var _0x3c7a=function(_0x331672,_0x321df8){_0x331672=_0x331672-0x0;var _0x5133d1=_0xc7a3[_0x331672];return _0x5133d1;};'use strict';var moment=require(_0x3c7a('0x0'));var _=require(_0x3c7a('0x1'));var util=require(_0x3c7a('0x2'));var client=require('../client');exports['voiceQueueReport']=function(_0x157786){var _0x50a7e5=_0x157786[_0x3c7a('0x3')]||_0x157786[_0x3c7a('0x4')];return client[_0x3c7a('0x5')](_0x3c7a('0x6'),{'body':{'channel':'voice','membername':_0x157786[_0x3c7a('0x7')],'interface':_[_0x3c7a('0x8')](_0x157786['interface'])?util[_0x3c7a('0x9')](_0x3c7a('0xa'),_0x157786[_0x3c7a('0x7')]):_0x157786['interface'],'type':_0x3c7a('0xb'),'enterAt':_0x157786[_0x3c7a('0xc')],'exitAt':_0x50a7e5,'duration':moment(_0x50a7e5)[_0x3c7a('0xd')](_0x157786[_0x3c7a('0xc')],_0x3c7a('0xe')),'data1':_0x3c7a('0xf'),'data2':_0x157786[_0x3c7a('0x10')],'data3':_0x157786['exten'],'data4':null,'data5':_0x157786['queue'],'role':_0x3c7a('0x11'),'internal':_0x157786[_0x3c7a('0x12')]?_[_0x3c7a('0x13')](_0x157786[_0x3c7a('0x12')]):undefined,'uniqueid':_0x157786[_0x3c7a('0x14')]},'log':_0x3c7a('0x6')});};exports[_0x3c7a('0x15')]=function(_0x3ed84d){return client[_0x3c7a('0x5')](_0x3c7a('0x6'),{'body':{'channel':'voice','membername':_0x3ed84d[_0x3c7a('0x16')],'interface':_0x3ed84d['interface'],'type':_0x3c7a('0xb'),'enterAt':_0x3ed84d[_0x3c7a('0x17')],'exitAt':_0x3ed84d[_0x3c7a('0x18')],'duration':moment(_0x3ed84d['endtime'])[_0x3c7a('0xd')](_0x3ed84d[_0x3c7a('0x17')],_0x3c7a('0xe'))>=0x0?moment(_0x3ed84d['endtime'])[_0x3c7a('0xd')](_0x3ed84d['starttime'],_0x3c7a('0xe')):null,'data1':'outbound','data2':_0x3ed84d[_0x3c7a('0x12')],'data3':_0x3ed84d[_0x3c7a('0x19')],'data4':_0x3ed84d[_0x3c7a('0x1a')]||null,'role':_0x3c7a('0x11'),'internal':_0x3ed84d[_0x3c7a('0x12')]?_['toNumber'](_0x3ed84d[_0x3c7a('0x12')]):undefined,'uniqueid':_0x3ed84d['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 1953466..9947207 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 _0x867f=['Request','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings'];(function(_0x7538c5,_0xa5d8ac){var _0x8b56be=function(_0x2036c0){while(--_0x2036c0){_0x7538c5['push'](_0x7538c5['shift']());}};_0x8b56be(++_0xa5d8ac);}(_0x867f,0xdc));var _0xf867=function(_0x5383f1,_0x327fb3){_0x5383f1=_0x5383f1-0x0;var _0xa23930=_0x867f[_0x5383f1];return _0xa23930;};'use strict';var client=require(_0xf867('0x0'));exports[_0xf867('0x1')]=function(){return client[_0xf867('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xf867('0x3'),_0xf867('0x4')]},'log':_0xf867('0x5')});}; \ No newline at end of file +var _0xbdfb=['Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','getSettings'];(function(_0x4692dd,_0x1389d9){var _0x2dd1ab=function(_0x3375c2){while(--_0x3375c2){_0x4692dd['push'](_0x4692dd['shift']());}};_0x2dd1ab(++_0x1389d9);}(_0xbdfb,0x1ef));var _0xbbdf=function(_0x512661,_0x4b4012){_0x512661=_0x512661-0x0;var _0x1debde=_0xbdfb[_0x512661];return _0x1debde;};'use strict';var client=require(_0xbbdf('0x0'));exports[_0xbbdf('0x1')]=function(){return client[_0xbbdf('0x2')](_0xbbdf('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbbdf('0x4'),_0xbbdf('0x5')]},'log':_0xbbdf('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index f3ff769..ad0a6e3 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 _0xc859=['Request','GetTemplate','name','html','getTemplates'];(function(_0x572fa4,_0x2ddac9){var _0x21f131=function(_0x17c14a){while(--_0x17c14a){_0x572fa4['push'](_0x572fa4['shift']());}};_0x21f131(++_0x2ddac9);}(_0xc859,0x17b));var _0x9c85=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xc859[_0x334841];return _0x5beb4b;};'use strict';var client=require('../client');exports[_0x9c85('0x0')]=function(_0x4088d4){return function(_0x128e24){return client[_0x9c85('0x1')](_0x9c85('0x2'),{'options':{'raw':!![],'attributes':['id',_0x9c85('0x3'),_0x9c85('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xd027=['name','html','getTemplates','Request','GetTemplate'];(function(_0x2b9920,_0xbfb27f){var _0x4a27c6=function(_0x8f2635){while(--_0x8f2635){_0x2b9920['push'](_0x2b9920['shift']());}};_0x4a27c6(++_0xbfb27f);}(_0xd027,0x197));var _0x7d02=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd027[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0x7d02('0x0')]=function(_0x4b0f9c){return function(_0x59fc17){return client[_0x7d02('0x1')](_0x7d02('0x2'),{'options':{'raw':!![],'attributes':['id',_0x7d02('0x3'),_0x7d02('0x4')]},'log':_0x7d02('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 8811526..fdb8eb9 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 _0xa68c=['name','channel','status','Condition','field','operator','value','Action','Actions','data1','data2','data3','data4','data6','data7','GetTrigger','getTriggers','Request'];(function(_0xea7461,_0x357cdb){var _0x48a33b=function(_0xb714d7){while(--_0xb714d7){_0xea7461['push'](_0xea7461['shift']());}};_0x48a33b(++_0x357cdb);}(_0xa68c,0xfa));var _0xca68=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa68c[_0x2b10c6];return _0x3789d2;};'use strict';var client=require('../client');exports[_0xca68('0x0')]=function(_0x382a9a){return function(_0x4ecebc){return client[_0xca68('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xca68('0x2'),_0xca68('0x3'),_0xca68('0x4')],'include':[{'model':_0xca68('0x5'),'as':'AllConditions','attributes':['id',_0xca68('0x6'),_0xca68('0x7'),_0xca68('0x8')]},{'model':_0xca68('0x5'),'as':'AnyConditions','attributes':['id',_0xca68('0x6'),_0xca68('0x7'),_0xca68('0x8')]},{'model':_0xca68('0x9'),'as':_0xca68('0xa'),'attributes':['id','action',_0xca68('0xb'),_0xca68('0xc'),_0xca68('0xd'),_0xca68('0xe'),'data5',_0xca68('0xf'),_0xca68('0x10')]}]},'log':_0xca68('0x11')});};}; \ No newline at end of file +var _0x80d7=['getTriggers','Request','GetTrigger','channel','status','Condition','field','operator','value','AnyConditions','Action','Actions','action','data1','data2','data4','data5','data6','data7'];(function(_0x53edc5,_0x5a8e84){var _0x272bdd=function(_0x3b30f6){while(--_0x3b30f6){_0x53edc5['push'](_0x53edc5['shift']());}};_0x272bdd(++_0x5a8e84);}(_0x80d7,0x1ee));var _0x780d=function(_0x1ac6ec,_0x1f81fc){_0x1ac6ec=_0x1ac6ec-0x0;var _0x48a489=_0x80d7[_0x1ac6ec];return _0x48a489;};'use strict';var client=require('../client');exports[_0x780d('0x0')]=function(_0x230817){return function(_0x473393){return client[_0x780d('0x1')](_0x780d('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x780d('0x3'),_0x780d('0x4')],'include':[{'model':_0x780d('0x5'),'as':'AllConditions','attributes':['id',_0x780d('0x6'),_0x780d('0x7'),_0x780d('0x8')]},{'model':_0x780d('0x5'),'as':_0x780d('0x9'),'attributes':['id','field','operator',_0x780d('0x8')]},{'model':_0x780d('0xa'),'as':_0x780d('0xb'),'attributes':['id',_0x780d('0xc'),_0x780d('0xd'),_0x780d('0xe'),'data3',_0x780d('0xf'),_0x780d('0x10'),_0x780d('0x11'),_0x780d('0x12')]}]},'log':_0x780d('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 3bfc618..0694f35 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 _0x853b=['getTrunks','GetTrunk','name','registry','defaultuser','../client'];(function(_0x5c0e61,_0x111c67){var _0x3af9c7=function(_0x59315d){while(--_0x59315d){_0x5c0e61['push'](_0x5c0e61['shift']());}};_0x3af9c7(++_0x111c67);}(_0x853b,0x161));var _0xb853=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x853b[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0xb853('0x0'));exports[_0xb853('0x1')]=function(_0x1555d3){return function(_0x36e8b4){return client['Request'](_0xb853('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xb853('0x3'),_0xb853('0x4'),_0xb853('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xf5b7=['name','defaultuser','getTrunks','Request','GetTrunk'];(function(_0x249d51,_0x1953cc){var _0x21e36f=function(_0x132671){while(--_0x132671){_0x249d51['push'](_0x249d51['shift']());}};_0x21e36f(++_0x1953cc);}(_0xf5b7,0xf7));var _0x7f5b=function(_0x570e1,_0x5579e1){_0x570e1=_0x570e1-0x0;var _0x4b9f83=_0xf5b7[_0x570e1];return _0x4b9f83;};'use strict';var client=require('../client');exports[_0x7f5b('0x0')]=function(_0x1e7acd){return function(_0x2331b9){return client[_0x7f5b('0x1')](_0x7f5b('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x7f5b('0x3'),'registry',_0x7f5b('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 9504c75..e6559ef 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x1144b7,_0x295689){var _0x965e35=function(_0x3fac16){while(--_0x3fac16){_0x1144b7['push'](_0x1144b7['shift']());}};_0x965e35(++_0x295689);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xaf025d,_0x586d7a){_0xaf025d=_0xaf025d-0x0;var _0x1c77cb=_0xcb91[_0xaf025d];return _0x1c77cb;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file +var _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe706,0xa3));var _0x6e70=function(_0x39c8f2,_0x23df6c){_0x39c8f2=_0x39c8f2-0x0;var _0x445526=_0xe706[_0x39c8f2];return _0x445526;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 0ea7d3d..68f53fe 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 _0x30f5=['CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x4927aa,_0x371bd1){var _0x205523=function(_0x2de249){while(--_0x2de249){_0x4927aa['push'](_0x4927aa['shift']());}};_0x205523(++_0x371bd1);}(_0x30f5,0xde));var _0x530f=function(_0x1b5fff,_0x4a7dad){_0x1b5fff=_0x1b5fff-0x0;var _0x31cc64=_0x30f5[_0x1b5fff];return _0x31cc64;};'use strict';var client=require(_0x530f('0x0'));exports[_0x530f('0x1')]=function(_0x42a91b){return client[_0x530f('0x2')](_0x530f('0x3'),{'body':_0x42a91b,'log':_0x530f('0x3')});};exports['update']=function(_0x176b51,_0x5ba196,_0x532d98){return client['Request'](_0x530f('0x4'),{'body':_0x176b51,'options':{'where':{'uniqueid':_0x5ba196,'interface':_0x532d98,'agentcomplete':!![]}},'log':_0x530f('0x4')});}; \ No newline at end of file +var _0xcc16=['CreateVoiceAgentReport','update','../client','create','Request'];(function(_0x2fa1d1,_0xa39427){var _0x4d7512=function(_0xb0289){while(--_0xb0289){_0x2fa1d1['push'](_0x2fa1d1['shift']());}};_0x4d7512(++_0xa39427);}(_0xcc16,0xf2));var _0x6cc1=function(_0x9b5da6,_0x3e119c){_0x9b5da6=_0x9b5da6-0x0;var _0x4328e9=_0xcc16[_0x9b5da6];return _0x4328e9;};'use strict';var client=require(_0x6cc1('0x0'));exports[_0x6cc1('0x1')]=function(_0x7a9885){return client[_0x6cc1('0x2')](_0x6cc1('0x3'),{'body':_0x7a9885,'log':_0x6cc1('0x3')});};exports[_0x6cc1('0x4')]=function(_0x3824f0,_0x1e6bee,_0x165335){return client[_0x6cc1('0x2')]('UpdateVoiceAgentReport',{'body':_0x3824f0,'options':{'where':{'uniqueid':_0x1e6bee,'interface':_0x165335,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 7abfaab..5de138e 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 _0x8929=['outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','util','lodash','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports'];(function(_0x54e7c1,_0x327459){var _0xcbf95c=function(_0x344dbc){while(--_0x344dbc){_0x54e7c1['push'](_0x54e7c1['shift']());}};_0xcbf95c(++_0x327459);}(_0x8929,0x1af));var _0x9892=function(_0x15f8ad,_0x5275c3){_0x15f8ad=_0x15f8ad-0x0;var _0xc0238a=_0x8929[_0x15f8ad];return _0xc0238a;};'use strict';var moment=require('moment');var util=require(_0x9892('0x0'));var _=require(_0x9892('0x1'));var client=require('../client');exports['create']=function(_0x46d16c){return client[_0x9892('0x2')](_0x9892('0x3'),{'body':_[_0x9892('0x4')](_0x46d16c,{'source':_0x46d16c[_0x9892('0x5')],'destinationcontext':_0x46d16c[_0x9892('0x6')],'callerid':_0x46d16c[_0x9892('0x7')],'amaflags':_0x9892('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0x9892('0x9')]=function(){return function(){return client[_0x9892('0x2')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x9892('0xa')],'createdAt':{'$between':[moment()[_0x9892('0xb')](_0x9892('0xc'))[_0x9892('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x9892('0xe')](_0x9892('0xc'))[_0x9892('0xd')](_0x9892('0xf'))]}},'attributes':[_0x9892('0x10'),_0x9892('0x11'),_0x9892('0x12'),_0x9892('0x13')]},'log':_0x9892('0x14')});};}; \ No newline at end of file +var _0xa523=['DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','type','GetVoiceCallReports','moment','util','../client','create','Request','merge','calleridnum'];(function(_0x106214,_0x454b8d){var _0x5f5cea=function(_0x247841){while(--_0x247841){_0x106214['push'](_0x106214['shift']());}};_0x5f5cea(++_0x454b8d);}(_0xa523,0x77));var _0x3a52=function(_0x15e23a,_0x526634){_0x15e23a=_0x15e23a-0x0;var _0x2b4494=_0xa523[_0x15e23a];return _0x2b4494;};'use strict';var moment=require(_0x3a52('0x0'));var util=require(_0x3a52('0x1'));var _=require('lodash');var client=require(_0x3a52('0x2'));exports[_0x3a52('0x3')]=function(_0x243924){return client[_0x3a52('0x4')]('CreateVoiceCallReport',{'body':_[_0x3a52('0x5')](_0x243924,{'source':_0x243924[_0x3a52('0x6')],'destinationcontext':_0x243924['context'],'callerid':_0x243924['callerid'],'amaflags':_0x3a52('0x7')}),'log':'CreateVoiceCallReport'});};exports[_0x3a52('0x8')]=function(){return function(){return client[_0x3a52('0x4')](_0x3a52('0x9'),{'options':{'where':{'type':[_0x3a52('0xa')],'createdAt':{'$between':[moment()[_0x3a52('0xb')](_0x3a52('0xc'))[_0x3a52('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x3a52('0xe')](_0x3a52('0xc'))['format'](_0x3a52('0xf'))]}},'attributes':[_0x3a52('0x10'),'disposition','duration','billableseconds']},'log':_0x3a52('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 538c68b..4e16050 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 _0x31e4=['Request','CreateVoiceDialReport','create'];(function(_0x40b423,_0x5826b6){var _0xe8d02=function(_0x21904a){while(--_0x21904a){_0x40b423['push'](_0x40b423['shift']());}};_0xe8d02(++_0x5826b6);}(_0x31e4,0x158));var _0x431e=function(_0x12c7e3,_0x417a84){_0x12c7e3=_0x12c7e3-0x0;var _0x348f08=_0x31e4[_0x12c7e3];return _0x348f08;};'use strict';var client=require('../client');exports[_0x431e('0x0')]=function(_0x30563f){return client[_0x431e('0x1')](_0x431e('0x2'),{'body':_0x30563f,'log':_0x431e('0x2')});}; \ No newline at end of file +var _0x6ec5=['../client','create','Request','CreateVoiceDialReport'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6ec5,0x1a8));var _0x56ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ec5[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x56ec('0x0'));exports[_0x56ec('0x1')]=function(_0x22d44){return client[_0x56ec('0x2')](_0x56ec('0x3'),{'body':_0x22d44,'log':_0x56ec('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 7c4f057..54ac466 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 _0x1491=['Request','GetVoiceExtension','recordingFormat','../client','getVoiceExtensions'];(function(_0x4c3ffe,_0x457374){var _0x28d3eb=function(_0x3ae2a3){while(--_0x3ae2a3){_0x4c3ffe['push'](_0x4c3ffe['shift']());}};_0x28d3eb(++_0x457374);}(_0x1491,0x1b1));var _0x1149=function(_0x14722f,_0xdc7b08){_0x14722f=_0x14722f-0x0;var _0x5cc3d9=_0x1491[_0x14722f];return _0x5cc3d9;};'use strict';var client=require(_0x1149('0x0'));exports[_0x1149('0x1')]=function(){return function(){return client[_0x1149('0x2')](_0x1149('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0x1149('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x1149('0x1')});};}; \ No newline at end of file +var _0x1bd1=['getVoiceExtensions','Request','exten','../client'];(function(_0x54422c,_0xaca111){var _0x294b88=function(_0x46d887){while(--_0x46d887){_0x54422c['push'](_0x54422c['shift']());}};_0x294b88(++_0xaca111);}(_0x1bd1,0x123));var _0x11bd=function(_0x2f1114,_0x4561f1){_0x2f1114=_0x2f1114-0x0;var _0x2fe856=_0x1bd1[_0x2f1114];return _0x2fe856;};'use strict';var client=require(_0x11bd('0x0'));exports[_0x11bd('0x1')]=function(){return function(){return client[_0x11bd('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x11bd('0x3'),'recordingFormat'],'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 239d0a4..d74b735 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 _0x73cf=['dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','callAdditionalPhoneAfterMin','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence'];(function(_0x23bd3a,_0x58df4e){var _0x1d35b5=function(_0x97279b){while(--_0x97279b){_0x23bd3a['push'](_0x23bd3a['shift']());}};_0x1d35b5(++_0x58df4e);}(_0x73cf,0x1ac));var _0xf73c=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x73cf[_0x4243a3];return _0x1b2a33;};'use strict';var client=require(_0xf73c('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0xf73c('0x1'),{'options':{'raw':![],'attributes':['id',_0xf73c('0x2'),_0xf73c('0x3'),_0xf73c('0x4'),_0xf73c('0x5'),_0xf73c('0x6'),_0xf73c('0x7'),_0xf73c('0x8'),_0xf73c('0x9'),_0xf73c('0xa'),'dialLimitQueue','dialPowerLevel','dialPredictiveOptimization',_0xf73c('0xb'),_0xf73c('0xc'),'dialOriginateCallerIdName',_0xf73c('0xd'),_0xf73c('0xe'),_0xf73c('0xf'),_0xf73c('0x10'),_0xf73c('0x11'),'dialCongestionMaxRetry',_0xf73c('0x12'),'dialBusyMaxRetry',_0xf73c('0x13'),_0xf73c('0x14'),'dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone',_0xf73c('0x15'),_0xf73c('0x16'),_0xf73c('0x17'),_0xf73c('0x18'),'dialAMDInitialSilence','dialAMDGreeting',_0xf73c('0x19'),'dialAMDTotalAnalysisTime',_0xf73c('0x1a'),_0xf73c('0x1b'),_0xf73c('0x1c'),'dialAMDSilenceThreshold',_0xf73c('0x1d'),'timeout',_0xf73c('0x1e'),_0xf73c('0x1f'),_0xf73c('0x20'),'dialAgiAfterHangupAgent',_0xf73c('0x21'),_0xf73c('0x22'),_0xf73c('0x6'),_0xf73c('0x23'),_0xf73c('0x24'),_0xf73c('0x25'),_0xf73c('0x26'),'dialNoSuchNumberRetryFrequency',_0xf73c('0x27'),'dialDropRetryFrequency',_0xf73c('0x28'),'dialAbandonedRetryFrequency',_0xf73c('0x29'),_0xf73c('0x2a'),'dialAgentRejectMaxRetry',_0xf73c('0x2b'),'mandatoryDisposition',_0xf73c('0x2c'),'dialPredictiveIntervalMinThreshold',_0xf73c('0x2d'),_0xf73c('0x2e'),_0xf73c('0x2f')],'include':[{'model':_0xf73c('0x30'),'as':'Trunk','attributes':['id',_0xf73c('0x2'),_0xf73c('0x31'),_0xf73c('0x32')]},{'model':_0xf73c('0x33'),'as':_0xf73c('0x34'),'attributes':['id','name']},{'model':_0xf73c('0x30'),'as':_0xf73c('0x35'),'attributes':['id',_0xf73c('0x2'),'callerid',_0xf73c('0x32')]},{'model':'Interval','as':_0xf73c('0x36'),'attributes':['id',_0xf73c('0x2')],'include':[{'model':'Interval','as':_0xf73c('0x37'),'attributes':['id',_0xf73c('0x2'),_0xf73c('0x38')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0xe458=['dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','callAdditionalPhoneAfterMin','Trunk','name','callerid','active','Pause','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','autopause','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy'];(function(_0x58aff0,_0xa2968c){var _0x2bedca=function(_0x130103){while(--_0x130103){_0x58aff0['push'](_0x58aff0['shift']());}};_0x2bedca(++_0xa2968c);}(_0xe458,0x8d));var _0x8e45=function(_0x38bcd4,_0x499fd8){_0x38bcd4=_0x38bcd4-0x0;var _0x96b295=_0xe458[_0x38bcd4];return _0x96b295;};'use strict';var client=require('../client');exports[_0x8e45('0x0')]=function(){return function(){return client[_0x8e45('0x1')](_0x8e45('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x8e45('0x3'),_0x8e45('0x4'),_0x8e45('0x5'),'monitor_format',_0x8e45('0x6'),_0x8e45('0x7'),_0x8e45('0x8'),_0x8e45('0x9'),_0x8e45('0xa'),_0x8e45('0xb'),_0x8e45('0xc'),'dialPredictiveOptimizationPercentage',_0x8e45('0xd'),_0x8e45('0xe'),_0x8e45('0xf'),_0x8e45('0x10'),'dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency',_0x8e45('0x11'),'dialNoAnswerRetryFrequency',_0x8e45('0x12'),_0x8e45('0x13'),_0x8e45('0x14'),_0x8e45('0x15'),_0x8e45('0x16'),_0x8e45('0x17'),_0x8e45('0x18'),_0x8e45('0x19'),_0x8e45('0x1a'),_0x8e45('0x1b'),_0x8e45('0x1c'),_0x8e45('0x1d'),'dialAMDMaximumNumberOfWords',_0x8e45('0x1e'),'dialAMDMaximumWordLength',_0x8e45('0x1f'),_0x8e45('0x20'),_0x8e45('0x21'),'dialOrderByScheduledAt',_0x8e45('0x22'),_0x8e45('0x23'),_0x8e45('0x24'),_0x8e45('0x25'),_0x8e45('0x26'),_0x8e45('0x27'),_0x8e45('0x28'),_0x8e45('0x29'),'dialNoSuchNumberRetryFrequency',_0x8e45('0x2a'),_0x8e45('0x2b'),'dialAbandonedMaxRetry',_0x8e45('0x2c'),_0x8e45('0x2d'),_0x8e45('0x2e'),'dialAgentRejectMaxRetry',_0x8e45('0x2f'),_0x8e45('0x30'),_0x8e45('0x31'),'dialPredictiveIntervalMinThreshold',_0x8e45('0x32'),'dialPreviewRecallmeReminder',_0x8e45('0x33')],'include':[{'model':_0x8e45('0x34'),'as':_0x8e45('0x34'),'attributes':['id',_0x8e45('0x35'),_0x8e45('0x36'),_0x8e45('0x37')]},{'model':_0x8e45('0x38'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x8e45('0x34'),'as':'TrunkBackup','attributes':['id',_0x8e45('0x35'),_0x8e45('0x36'),'active']},{'model':_0x8e45('0x39'),'as':_0x8e45('0x39'),'attributes':['id',_0x8e45('0x35')],'include':[{'model':'Interval','as':_0x8e45('0x3a'),'attributes':['id',_0x8e45('0x35'),_0x8e45('0x3b')]}]}]},'log':_0x8e45('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 090fea0..0bd2d23 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(_0x2642b5,_0x512095){var _0x2eb112=function(_0x42a5ce){while(--_0x42a5ce){_0x2642b5['push'](_0x2642b5['shift']());}};_0x2eb112(++_0x512095);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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(_0x114294,_0x14e0a3){var _0x907d61=function(_0x4401ba){while(--_0x4401ba){_0x114294['push'](_0x114294['shift']());}};_0x907d61(++_0x14e0a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index bf63c1d..cb1126e 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 _0x66ec=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client','Request'];(function(_0x14a48e,_0x2c7898){var _0x353c19=function(_0x374612){while(--_0x374612){_0x14a48e['push'](_0x14a48e['shift']());}};_0x353c19(++_0x2c7898);}(_0x66ec,0x92));var _0xc66e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x66ec[_0x4e1d03];return _0x362d4b;};'use strict';var client=require(_0xc66e('0x0'));exports['getVoiceQueueRtPauses']=function(_0x3f1577){return function(){return client[_0xc66e('0x1')](_0xc66e('0x2'),{'options':{'where':{'VoiceQueueId':_0x3f1577,'paused':!![]},'raw':!![]},'log':_0xc66e('0x3')});};}; \ No newline at end of file +var _0xe05e=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x818b0f,_0xaf6fa5){var _0x4220a9=function(_0x3252a8){while(--_0x3252a8){_0x818b0f['push'](_0x818b0f['shift']());}};_0x4220a9(++_0xaf6fa5);}(_0xe05e,0x19f));var _0xee05=function(_0xc7348b,_0x145880){_0xc7348b=_0xc7348b-0x0;var _0x307cec=_0xe05e[_0xc7348b];return _0x307cec;};'use strict';var client=require('../client');exports[_0xee05('0x0')]=function(_0x2c663f){return function(){return client[_0xee05('0x1')](_0xee05('0x2'),{'options':{'where':{'VoiceQueueId':_0x2c663f,'paused':!![]},'raw':!![]},'log':_0xee05('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index e043af1..f7b857a 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x25e193,_0x3c2379){var _0x509cc5=function(_0x58db57){while(--_0x58db57){_0x25e193['push'](_0x25e193['shift']());}};_0x509cc5(++_0x3c2379);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x18704c,_0x58e72a){var _0x397379=function(_0xb3218){while(--_0xb3218){_0x18704c['push'](_0x18704c['shift']());}};_0x397379(++_0x58e72a);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index ee475c2..939a523 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 _0x6676=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','isexternal','context','extension','blind','attendedTransfer','Request','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum'];(function(_0x1a983d,_0x3ddf78){var _0x2bf819=function(_0x527161){while(--_0x527161){_0x1a983d['push'](_0x1a983d['shift']());}};_0x2bf819(++_0x3ddf78);}(_0x6676,0xcc));var _0x6667=function(_0x22f341,_0x402263){_0x22f341=_0x22f341-0x0;var _0x121cc2=_0x6676[_0x22f341];return _0x121cc2;};'use strict';var client=require(_0x6667('0x0'));exports[_0x6667('0x1')]={};exports[_0x6667('0x2')]=function(_0x554f90){return client['Request'](_0x6667('0x3'),{'body':{'result':_0x554f90[_0x6667('0x4')],'transfererchannel':_0x554f90['transfererchannel'],'transferercalleridnum':_0x554f90[_0x6667('0x5')],'transferercalleridname':_0x554f90[_0x6667('0x6')],'transfererconnectedlinenum':_0x554f90[_0x6667('0x7')],'transfererconnectedlinename':_0x554f90[_0x6667('0x8')],'transfereraccountcode':_0x554f90[_0x6667('0x9')],'transferercontext':_0x554f90[_0x6667('0xa')],'transfererexten':_0x554f90[_0x6667('0xb')],'transfererlinkedid':_0x554f90['transfererlinkedid'],'transfereechannel':_0x554f90[_0x6667('0xc')],'transfereecalleridnum':_0x554f90[_0x6667('0xd')],'transfereecalleridname':_0x554f90[_0x6667('0xe')],'transfereeconnectedlinenum':_0x554f90['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x554f90['transfereeconnectedlinename'],'transfereeaccountcode':_0x554f90['transfereeaccountcode'],'transfereecontext':_0x554f90['transfereecontext'],'transfereeexten':_0x554f90['transfereeexten'],'transfereelinkedid':_0x554f90['transfereelinkedid'],'isexternal':_0x554f90[_0x6667('0xf')],'context':_0x554f90[_0x6667('0x10')],'extension':_0x554f90[_0x6667('0x11')],'type':_0x6667('0x12')},'log':'CreateVoiceTransferReport'});};exports[_0x6667('0x13')]=function(_0x2b7e0d){return client[_0x6667('0x14')](_0x6667('0x3'),{'body':{'result':_0x2b7e0d[_0x6667('0x4')],'transfererchannel':_0x2b7e0d['origtransfererchannel'],'transferercalleridnum':_0x2b7e0d[_0x6667('0x15')],'transferercalleridname':_0x2b7e0d[_0x6667('0x16')],'transfererconnectedlinenum':_0x2b7e0d[_0x6667('0x17')],'transfererconnectedlinename':_0x2b7e0d[_0x6667('0x18')],'transfereraccountcode':_0x2b7e0d[_0x6667('0x19')],'transferercontext':_0x2b7e0d[_0x6667('0x1a')],'transfererexten':_0x2b7e0d[_0x6667('0x1b')],'transfererlinkedid':_0x2b7e0d[_0x6667('0x1c')],'transfereechannel':_0x2b7e0d[_0x6667('0x1d')],'transfereecalleridnum':_0x2b7e0d['transfertargetcalleridnum'],'transfereecalleridname':_0x2b7e0d[_0x6667('0x1e')],'transfereeconnectedlinenum':_0x2b7e0d[_0x6667('0x1f')],'transfereeconnectedlinename':_0x2b7e0d[_0x6667('0x20')],'transfereeaccountcode':_0x2b7e0d['transfertargetaccountcode'],'transfereecontext':_0x2b7e0d[_0x6667('0x21')],'transfereeexten':_0x2b7e0d[_0x6667('0x22')],'transfereelinkedid':_0x2b7e0d[_0x6667('0x23')],'isexternal':_0x2b7e0d[_0x6667('0xf')],'context':_0x2b7e0d[_0x6667('0x24')],'extension':_0x2b7e0d['origtransfererexten'],'type':_0x6667('0x25')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0xfe3a=['transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridname','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','result','origtransfererchannel','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid'];(function(_0x32355d,_0xa6b12e){var _0x995a4f=function(_0xf240ac){while(--_0xf240ac){_0x32355d['push'](_0x32355d['shift']());}};_0x995a4f(++_0xa6b12e);}(_0xfe3a,0x186));var _0xafe3=function(_0x8c948d,_0x3f53a){_0x8c948d=_0x8c948d-0x0;var _0x378da4=_0xfe3a[_0x8c948d];return _0x378da4;};'use strict';var client=require(_0xafe3('0x0'));exports[_0xafe3('0x1')]={};exports['blindTransfer']=function(_0x51de9d){return client[_0xafe3('0x2')](_0xafe3('0x3'),{'body':{'result':_0x51de9d['result'],'transfererchannel':_0x51de9d[_0xafe3('0x4')],'transferercalleridnum':_0x51de9d['transferercalleridnum'],'transferercalleridname':_0x51de9d[_0xafe3('0x5')],'transfererconnectedlinenum':_0x51de9d['transfererconnectedlinenum'],'transfererconnectedlinename':_0x51de9d['transfererconnectedlinename'],'transfereraccountcode':_0x51de9d[_0xafe3('0x6')],'transferercontext':_0x51de9d[_0xafe3('0x7')],'transfererexten':_0x51de9d[_0xafe3('0x8')],'transfererlinkedid':_0x51de9d[_0xafe3('0x9')],'transfereechannel':_0x51de9d['transfereechannel'],'transfereecalleridnum':_0x51de9d[_0xafe3('0xa')],'transfereecalleridname':_0x51de9d[_0xafe3('0xb')],'transfereeconnectedlinenum':_0x51de9d[_0xafe3('0xc')],'transfereeconnectedlinename':_0x51de9d[_0xafe3('0xd')],'transfereeaccountcode':_0x51de9d[_0xafe3('0xe')],'transfereecontext':_0x51de9d[_0xafe3('0xf')],'transfereeexten':_0x51de9d[_0xafe3('0x10')],'transfereelinkedid':_0x51de9d[_0xafe3('0x11')],'isexternal':_0x51de9d[_0xafe3('0x12')],'context':_0x51de9d[_0xafe3('0x13')],'extension':_0x51de9d[_0xafe3('0x14')],'type':_0xafe3('0x15')},'log':_0xafe3('0x3')});};exports['attendedTransfer']=function(_0x3c1054){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x3c1054[_0xafe3('0x16')],'transfererchannel':_0x3c1054[_0xafe3('0x17')],'transferercalleridnum':_0x3c1054['origtransferercalleridnum'],'transferercalleridname':_0x3c1054['origtransferercalleridname'],'transfererconnectedlinenum':_0x3c1054['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x3c1054['secondtransfererconnectedlinename'],'transfereraccountcode':_0x3c1054[_0xafe3('0x18')],'transferercontext':_0x3c1054[_0xafe3('0x19')],'transfererexten':_0x3c1054[_0xafe3('0x1a')],'transfererlinkedid':_0x3c1054[_0xafe3('0x1b')],'transfereechannel':_0x3c1054['transfertargetchannel'],'transfereecalleridnum':_0x3c1054[_0xafe3('0x1c')],'transfereecalleridname':_0x3c1054['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3c1054[_0xafe3('0x1d')],'transfereeconnectedlinename':_0x3c1054[_0xafe3('0x1e')],'transfereeaccountcode':_0x3c1054[_0xafe3('0x1f')],'transfereecontext':_0x3c1054[_0xafe3('0x20')],'transfereeexten':_0x3c1054[_0xafe3('0x21')],'transfereelinkedid':_0x3c1054[_0xafe3('0x22')],'isexternal':_0x3c1054[_0xafe3('0x12')],'context':_0x3c1054[_0xafe3('0x23')],'extension':_0x3c1054[_0xafe3('0x24')],'type':_0xafe3('0x25')},'log':_0xafe3('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index d2e96e8..f6d6f2d 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 _0x126e=['validate','bluebird','moment','../../../config/environment','../ami','listen','format','SIP','name','timers','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','username','ami\x20disconnected','join','pick','module','action','Reload','then','message','catch','isConnected','Command','Action','voiceQueues','strategy','answered','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','type','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','omit','undefined','values','channels','length','map','find','channel','filename','wav','MixMonitor','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','uniqueid','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','destinationchannel','StopMixMonitor','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','Hangup','exten','context','trunks','outbound','campaigns','run','emit','event','faxAccounts','send','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise'];(function(_0x145396,_0x4acdf0){var _0x1e8bd1=function(_0x232731){while(--_0x232731){_0x145396['push'](_0x145396['shift']());}};_0x1e8bd1(++_0x4acdf0);}(_0x126e,0x108));var _0xe126=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x126e[_0x2b10c6];return _0x3789d2;};'use strict';var _=require('lodash');var util=require(_0xe126('0x0'));var jayson=require(_0xe126('0x1'));var schema=require(_0xe126('0x2'));var BPromise=require(_0xe126('0x3'));var moment=require(_0xe126('0x4'));var config=require(_0xe126('0x5'));var properties=require('../properties');var ami=require(_0xe126('0x6'));exports[_0xe126('0x7')]=function(_0x8cb81d,_0x34d705,_0x2f75a4){return new BPromise(function(_0x2162bd,_0x10210f){var _0x47ae76={'QueuePause':function(_0x316be0){return new Promise(function(_0x19f94e,_0x437fd0){var _0x308b01=util[_0xe126('0x8')]('%s/%s',_0xe126('0x9'),_0x316be0[_0xe126('0xa')]);if(_0x8cb81d['timers']&&_0x8cb81d[_0xe126('0xb')][_0x308b01]&&_0x8cb81d[_0xe126('0xb')][_0x308b01]['timer']){_0x8cb81d[_0xe126('0xb')][_0x308b01]['updateAcw']();}if(_0x8cb81d[_0xe126('0xc')][_0x308b01]){_0x8cb81d['agents'][_0x308b01][_0xe126('0xd')]({'statePause':_0x316be0[_0xe126('0xe')]?!![]:![]});}_0x19f94e({'code':0xc8,'message':_0xe126('0xf')});});},'Reload':function(_0x38b8c3){var _0x197c91=this;return new Promise(function(_0x1a57c4,_0x25f232){if(ami['isConnected']()==![]){return _0x25f232(_0x197c91[_0xe126('0x10')](0x1f4,[config[_0xe126('0x11')]['ip'],config['asterisk'][_0xe126('0x12')],_0xe126('0x13')][_0xe126('0x14')]('\x20')));}_0x38b8c3=_[_0xe126('0x15')](_0x38b8c3,_['keys'](properties[_0xe126('0x16')]));_0x38b8c3[_0xe126('0x17')]=_0xe126('0x18');return ami['Action'](_0x38b8c3)[_0xe126('0x19')](function(_0x553e29){_0x1a57c4({'code':0xc8,'message':_0x553e29[_0xe126('0x1a')]});})[_0xe126('0x1b')](function(_0x19b0a3){_0x25f232(_0x197c91[_0xe126('0x10')](0x1f5,_0x19b0a3[_0xe126('0x1a')]));});});},'Command':function(_0x2efb73){var _0x20874b=this;return new Promise(function(_0x397d26,_0x5cc73b){if(ami[_0xe126('0x1c')]()==![]){return _0x5cc73b(_0x20874b[_0xe126('0x10')](0x1f4,[config[_0xe126('0x11')]['ip'],config[_0xe126('0x11')][_0xe126('0x12')],_0xe126('0x13')][_0xe126('0x14')]('\x20')));}_0x2efb73=_[_0xe126('0x15')](_0x2efb73,'command');_0x2efb73['action']=_0xe126('0x1d');return ami[_0xe126('0x1e')](_0x2efb73)[_0xe126('0x19')](function(_0x5f1ce1){_0x397d26({'code':0xc8,'message':_0x5f1ce1['content']});})['catch'](function(_0x4807d3){_0x5cc73b(_0x20874b[_0xe126('0x10')](0x1f5,_0x4807d3['message']));});});},'VoiceQueues':function(_0x264082){return new Promise(function(_0x2f05ec,_0x4157ed){var _0x1674c9=[];for(var _0x532409 in _0x8cb81d['voiceQueues']){if(_0x8cb81d[_0xe126('0x1f')]['hasOwnProperty'](_0x532409)){var _0x3f5de5=_0x8cb81d[_0xe126('0x1f')][_0x532409];var _0x630bcc={'id':_0x3f5de5['id'],'name':_0x3f5de5['name'],'strategy':_0x3f5de5[_0xe126('0x20')],'answered':_0x3f5de5[_0xe126('0x21')],'available':_0x3f5de5['available'],'loggedIn':_0x3f5de5[_0xe126('0x22')],'pTalking':_0x3f5de5[_0xe126('0x23')],'sumBillable':_0x3f5de5['sumBillable'],'sumDuration':_0x3f5de5[_0xe126('0x24')],'sumHoldTime':_0x3f5de5[_0xe126('0x25')]||0x0,'talking':_0x3f5de5[_0xe126('0x26')],'total':_0x3f5de5[_0xe126('0x27')],'type':_0x3f5de5['type'],'unmanaged':_0x3f5de5[_0xe126('0x28')],'abandoned':_0x3f5de5[_0xe126('0x29')],'waiting':_0x3f5de5['waiting'],'loggedInDb':_0x3f5de5['loggedInDb']};if(_0x3f5de5[_0xe126('0x2a')]==='outbound'){_0x630bcc[_0xe126('0x2b')]=_0x3f5de5[_0xe126('0x2b')];_0x630bcc[_0xe126('0x2c')]=_0x3f5de5['dialMethod'];_0x630bcc[_0xe126('0x2d')]=_0x3f5de5[_0xe126('0x2d')];_0x630bcc[_0xe126('0x2e')]=_0x3f5de5['dialOriginateCallerIdNumber'];_0x630bcc[_0xe126('0x2f')]=_0x3f5de5[_0xe126('0x2f')];_0x630bcc['dialPrefix']=_0x3f5de5['dialPrefix'];_0x630bcc[_0xe126('0x30')]=_0x3f5de5[_0xe126('0x30')];_0x630bcc[_0xe126('0x31')]=_0x3f5de5[_0xe126('0x31')];_0x630bcc[_0xe126('0x32')]=_0x3f5de5[_0xe126('0x32')];_0x630bcc[_0xe126('0x33')]=_0x3f5de5[_0xe126('0x33')];_0x630bcc['outboundBusyCallsDay']=_0x3f5de5[_0xe126('0x34')];_0x630bcc[_0xe126('0x35')]=_0x3f5de5[_0xe126('0x35')];_0x630bcc[_0xe126('0x36')]=_0x3f5de5[_0xe126('0x36')];_0x630bcc[_0xe126('0x37')]=_0x3f5de5['outboundDropCallsDayCallersExit'];_0x630bcc[_0xe126('0x38')]=_0x3f5de5[_0xe126('0x38')];_0x630bcc[_0xe126('0x39')]=_0x3f5de5[_0xe126('0x39')];_0x630bcc[_0xe126('0x3a')]=_0x3f5de5['outboundNoSuchCallsDay'];_0x630bcc[_0xe126('0x3b')]=_0x3f5de5[_0xe126('0x3b')];_0x630bcc[_0xe126('0x3c')]=_0x3f5de5[_0xe126('0x3c')];_0x630bcc['outboundRejectCallsDay']=_0x3f5de5[_0xe126('0x3d')];_0x630bcc[_0xe126('0x3e')]=_0x3f5de5[_0xe126('0x3e')];_0x630bcc[_0xe126('0x3f')]=_0x3f5de5[_0xe126('0x3f')];_0x630bcc[_0xe126('0x40')]=_0x3f5de5['predictiveIntervalAvgHoldtime'];_0x630bcc[_0xe126('0x41')]=_0x3f5de5[_0xe126('0x41')];_0x630bcc[_0xe126('0x42')]=_0x3f5de5['predictiveIntervalDroppedCallsCallersExit'];_0x630bcc['predictiveIntervalDroppedCallsTimeout']=_0x3f5de5[_0xe126('0x43')];_0x630bcc[_0xe126('0x44')]=_0x3f5de5[_0xe126('0x44')];_0x630bcc[_0xe126('0x45')]=_0x3f5de5[_0xe126('0x45')];_0x630bcc[_0xe126('0x46')]=_0x3f5de5['predictiveIntervalHitRate'];_0x630bcc[_0xe126('0x47')]=_0x3f5de5[_0xe126('0x47')];_0x630bcc['predictiveIntervalPauses']=_0x3f5de5[_0xe126('0x48')];_0x630bcc[_0xe126('0x49')]=_0x3f5de5[_0xe126('0x49')];_0x630bcc['predictiveIntervalTotalCalls']=_0x3f5de5[_0xe126('0x4a')];_0x630bcc[_0xe126('0x1a')]=_0x3f5de5['message'];_0x630bcc[_0xe126('0x4b')]=_0x3f5de5[_0xe126('0x4b')];_0x630bcc['erlangCalls']=_0x3f5de5[_0xe126('0x4c')];_0x630bcc['erlangCallToSecond']=_0x3f5de5[_0xe126('0x4d')];_0x630bcc[_0xe126('0x4e')]=_0x3f5de5['erlangAbandonmentRate'];_0x630bcc[_0xe126('0x4f')]=_0x3f5de5[_0xe126('0x4f')];_0x630bcc[_0xe126('0x50')]=_0x3f5de5['startPredictive'];_0x630bcc[_0xe126('0x51')]=_0x3f5de5['startProgressive'];}if(_0x3f5de5[_0xe126('0x52')]){_0x630bcc[_0xe126('0x52')]={'id':_0x3f5de5[_0xe126('0x52')]['id'],'name':_0x3f5de5[_0xe126('0x52')][_0xe126('0xa')],'active':_0x3f5de5[_0xe126('0x52')][_0xe126('0x53')],'callerid':_0x3f5de5[_0xe126('0x52')][_0xe126('0x54')]};}if(_0x3f5de5[_0xe126('0x55')]){_0x630bcc[_0xe126('0x55')]={'id':_0x3f5de5['Interval']['id'],'name':_0x3f5de5['Interval'][_0xe126('0xa')]};}_0x1674c9[_0xe126('0x56')](_0x630bcc);}}_0x2f05ec({'count':_0x1674c9['length'],'rows':_0x1674c9});});},'UpdateVoiceQueue':function(_0x47217b){return new Promise(function(_0x1d5fcc,_0x1cae28){var _0x3d318a=_['find'](_0x8cb81d[_0xe126('0x1f')],{'id':parseInt(_0x47217b['id'])});var _0x132ef9=_[_0xe126('0x57')](_0x47217b,['id']);if(_0x3d318a){for(var _0x45ac4a in _0x132ef9){if(typeof _0x132ef9[_0x45ac4a]!==_0xe126('0x58')&&typeof _0x3d318a[_0x45ac4a]!==_0xe126('0x58')){_0x3d318a[_0x45ac4a]=_0x132ef9[_0x45ac4a];}}_0x1d5fcc(_0x3d318a);}else{_0x1cae28();}});},'VoiceChannels':function(_0x23fca2){return new Promise(function(_0xa8eae6,_0x23179a){var _0xccc25d=_[_0xe126('0x59')](_0x8cb81d[_0xe126('0x5a')]);_0xa8eae6({'count':_0xccc25d[_0xe126('0x5b')],'rows':_0xccc25d});});},'VoiceChannelMixMonitor':function(_0x4d30f6){var _0x581b4a=this;return new Promise(function(_0x589321,_0x4e34fc){if(ami[_0xe126('0x1c')]()==![]){return _0x4e34fc(_0x581b4a[_0xe126('0x10')](0x1f4,[config[_0xe126('0x11')]['ip'],config[_0xe126('0x11')][_0xe126('0x12')],_0xe126('0x13')][_0xe126('0x14')]('\x20')));}var _0x5ece85=schema(properties['voicechannel'])[_0xe126('0x2')](_0x4d30f6);if(_0x5ece85[_0xe126('0x5b')]>0x0){return _0x4e34fc(_0x581b4a['error'](0x1f4,_[_0xe126('0x5c')](_0x5ece85,_0xe126('0x1a'))['join'](',\x20')));}var _0x20d263=_[_0xe126('0x5d')](_0x8cb81d['channels'],{'uniqueid':_0x4d30f6['uniqueid']});if(_0x20d263&&_0x20d263[_0xe126('0x5e')]){var _0x1a9e13=util[_0xe126('0x8')]('%s.%s',_0x4d30f6[_0xe126('0x5f')]||_0x4d30f6['uniqueid'],_0x4d30f6[_0xe126('0x8')]||_0xe126('0x60'));return ami['Action']({'action':_0xe126('0x61'),'channel':_0x20d263[_0xe126('0x5e')],'file':_0x1a9e13,'options':'ai(mixmonitorid)'})['then'](function(_0x59c977){var _0x325a24=_[_0xe126('0x5d')](_0x20d263[_0xe126('0x62')],{'filename':_0xe126('0x63')+_0x1a9e13['toLowerCase']()});if(_[_0xe126('0x64')](_0x325a24)){_0x20d263[_0xe126('0x62')][_0xe126('0x56')]({'filename':_0xe126('0x63')+_0x1a9e13[_0xe126('0x65')](),'createdAt':moment()[_0xe126('0x8')](_0xe126('0x66')),'mixmonitorid':_0x59c977[_0xe126('0x67')],'status':_0xe126('0x68')});}else{_0x325a24[_0xe126('0x67')]=_0x59c977[_0xe126('0x67')];_0x325a24[_0xe126('0x69')]=_0xe126('0x68');}_0x589321({'code':0xc8,'message':[_0x4d30f6[_0xe126('0x6a')],_0xe126('0x6b'),_0x59c977[_0xe126('0x67')]][_0xe126('0x14')]('\x20'),'mixmonitorid':_0x59c977[_0xe126('0x67')]});})[_0xe126('0x1b')](function(_0xc7618f){_0x4e34fc(_0x581b4a[_0xe126('0x10')](0x1f5,[_0x4d30f6[_0xe126('0x6a')],_0xc7618f[_0xe126('0x1a')][_0xe126('0x65')]()][_0xe126('0x14')]('\x20')));});}else{return _0x4e34fc(_0x581b4a[_0xe126('0x10')](0x1f5,_0xe126('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x4f9db8){var _0x222443=this;return new Promise(function(_0x20e5ba,_0xa4f1e5){if(ami[_0xe126('0x1c')]()==![]){return _0xa4f1e5(_0x222443[_0xe126('0x10')](0x1f4,[config['asterisk']['ip'],config[_0xe126('0x11')][_0xe126('0x12')],'ami\x20disconnected'][_0xe126('0x14')]('\x20')));}var _0x3ed82a=schema(properties['voicechannel'])[_0xe126('0x2')](_0x4f9db8);if(_0x3ed82a[_0xe126('0x5b')]>0x0){return _0xa4f1e5(_0x222443[_0xe126('0x10')](0x1f4,_[_0xe126('0x5c')](_0x3ed82a,_0xe126('0x1a'))[_0xe126('0x14')](',\x20')));}var _0x32d937=_['find'](_0x8cb81d[_0xe126('0x5a')],{'uniqueid':_0x4f9db8[_0xe126('0x6a')]});if(_0x32d937){return BPromise['resolve']()[_0xe126('0x19')](function(){if(_0x32d937[_0xe126('0x5e')]){return ami[_0xe126('0x1e')]({'action':'StopMixMonitor','channel':_0x32d937[_0xe126('0x5e')],'mixmonitorid':_0x4f9db8[_0xe126('0x67')]})[_0xe126('0x1b')](function(_0x349380){});}})[_0xe126('0x19')](function(){if(_0x32d937[_0xe126('0x6d')]){return ami[_0xe126('0x1e')]({'action':_0xe126('0x6e'),'channel':_0x32d937[_0xe126('0x6d')],'mixmonitorid':_0x4f9db8[_0xe126('0x67')]})[_0xe126('0x1b')](function(_0x2694cd){});}})[_0xe126('0x19')](function(_0x773bed){var _0x17be73=_[_0xe126('0x5d')](_0x32d937[_0xe126('0x62')],{'mixmonitorid':_0x4f9db8[_0xe126('0x67')]});if(_0x17be73){_0x17be73[_0xe126('0x69')]=_0xe126('0x6f');}})[_0xe126('0x19')](function(){var _0x2abfa0=util['format'](_0xe126('0x70'),_0x4f9db8[_0xe126('0x5f')]||_0x4f9db8[_0xe126('0x6a')],_0x4f9db8[_0xe126('0x8')]||_0xe126('0x60'));var _0x1f8891=_[_0xe126('0x5d')](_0x32d937[_0xe126('0x62')],{'filename':_0xe126('0x63')+_0x2abfa0[_0xe126('0x65')]()});if(_0x1f8891){_0x1f8891['status']=_0xe126('0x6f');}})[_0xe126('0x19')](function(){_0x20e5ba({'code':0xc8,'message':[_0x4f9db8[_0xe126('0x6a')],_0xe126('0x71')][_0xe126('0x14')]('\x20')});})[_0xe126('0x1b')](function(_0x13e742){_0xa4f1e5(_0x222443[_0xe126('0x10')](0x1f5,[_0x4f9db8[_0xe126('0x6a')],_0x13e742[_0xe126('0x1a')][_0xe126('0x65')]()][_0xe126('0x14')]('\x20')));});}else{return _0xa4f1e5(_0x222443[_0xe126('0x10')](0x1f5,_0xe126('0x6c')));}});},'VoiceQueuesChannels':function(_0x354da2){return new Promise(function(_0x250502,_0x900d93){var _0xe6ad99=_[_0xe126('0x59')](_0x8cb81d[_0xe126('0x72')]);_0x250502({'count':_0xe6ad99[_0xe126('0x5b')],'rows':_0xe6ad99});});},'VoiceQueuesChannel':function(_0x1ff7e8){var _0x3369c1=this;return new Promise(function(_0x284f1e,_0x540bc3){var _0x23b814=schema(properties['voicequeuechannel'])[_0xe126('0x2')](_0x1ff7e8);if(_0x23b814[_0xe126('0x5b')]>0x0){return _0x540bc3(_0x3369c1[_0xe126('0x10')](0x1f4,_[_0xe126('0x5c')](_0x23b814,_0xe126('0x1a'))[_0xe126('0x14')](',\x20')));}var _0x57a2d0=_[_0xe126('0x5d')](_0x8cb81d['queueChannels'],{'uniqueid':_0x1ff7e8[_0xe126('0x6a')]});if(_0x57a2d0){_0x284f1e(_0x57a2d0);}else{return _0x540bc3(_0x3369c1[_0xe126('0x10')](0x1f5,_0xe126('0x6c')));}});},'VoiceQueuesChannelHangup':function(_0x4d8504){var _0x107cb1=this;return new Promise(function(_0x33bc47,_0x3a4b05){if(ami[_0xe126('0x1c')]()==![]){return _0x3a4b05(_0x107cb1[_0xe126('0x10')](0x1f4,[config[_0xe126('0x11')]['ip'],config['asterisk'][_0xe126('0x12')],'ami\x20disconnected']['join']('\x20')));}var _0x4f072a=schema(properties[_0xe126('0x73')])[_0xe126('0x2')](_0x4d8504);if(_0x4f072a['length']>0x0){return _0x3a4b05(_0x107cb1[_0xe126('0x10')](0x1f4,_[_0xe126('0x5c')](_0x4f072a,_0xe126('0x1a'))[_0xe126('0x14')](',\x20')));}var _0x5aaa27=_[_0xe126('0x5d')](_0x8cb81d[_0xe126('0x72')],{'uniqueid':_0x4d8504[_0xe126('0x6a')]});if(_0x5aaa27&&_0x5aaa27[_0xe126('0x5e')]){return ami[_0xe126('0x1e')]({'action':_0xe126('0x74'),'channel':_0x5aaa27[_0xe126('0x5e')]})[_0xe126('0x19')](function(_0x29b60d){_0x33bc47({'code':0xc8,'message':[_0x4d8504['uniqueid'],_0x29b60d[_0xe126('0x1a')][_0xe126('0x65')]()]['join']('\x20')});})[_0xe126('0x1b')](function(_0x60a009){_0x3a4b05(_0x107cb1[_0xe126('0x10')](0x1f5,[_0x4d8504[_0xe126('0x6a')],_0x60a009[_0xe126('0x1a')][_0xe126('0x65')]()][_0xe126('0x14')]('\x20')));});}else{return _0x3a4b05(_0x107cb1[_0xe126('0x10')](0x1f5,_0xe126('0x6c')));}});},'VoiceQueuesChannelRedirect':function(_0x208ba2){var _0x1c473a=this;return new Promise(function(_0x4cf2d9,_0x1fde6a){if(ami[_0xe126('0x1c')]()==![]){return _0x1fde6a(_0x1c473a['error'](0x1f4,[config[_0xe126('0x11')]['ip'],config[_0xe126('0x11')][_0xe126('0x12')],'ami\x20disconnected'][_0xe126('0x14')]('\x20')));}var _0x53316f=schema(properties['voicequeuechannelredirect'])[_0xe126('0x2')](_0x208ba2);if(_0x53316f[_0xe126('0x5b')]>0x0){return _0x1fde6a(_0x1c473a['error'](0x1f4,_[_0xe126('0x5c')](_0x53316f,_0xe126('0x1a'))['join'](',\x20')));}var _0x3b6081=_[_0xe126('0x5d')](_0x8cb81d[_0xe126('0x72')],{'uniqueid':_0x208ba2['uniqueid']});if(_0x3b6081&&_0x3b6081[_0xe126('0x5e')]){return ami[_0xe126('0x1e')]({'action':'Redirect','channel':_0x3b6081[_0xe126('0x5e')],'exten':_0x208ba2[_0xe126('0x75')],'context':_0x208ba2['context']||_0x3b6081[_0xe126('0x76')],'priority':0x1})[_0xe126('0x19')](function(_0x1cb650){_0x4cf2d9({'code':0xc8,'message':[_0x208ba2['uniqueid'],_0x1cb650['message'][_0xe126('0x65')]()][_0xe126('0x14')]('\x20')});})['catch'](function(_0x818507){_0x1fde6a(_0x1c473a[_0xe126('0x10')](0x1f5,[_0x208ba2[_0xe126('0x6a')],_0x818507[_0xe126('0x1a')]['toLowerCase']()][_0xe126('0x14')]('\x20')));});}else{return _0x1fde6a(_0x1c473a[_0xe126('0x10')](0x1f5,_0xe126('0x6c')));}});},'Agents':function(_0x2afd51){return new Promise(function(_0x48df24,_0x15da1b){var _0x459ad2=_[_0xe126('0x59')](_0x8cb81d[_0xe126('0xc')]);_0x48df24({'count':_0x459ad2[_0xe126('0x5b')],'rows':_0x459ad2});});},'Telephones':function(_0x3eb441){return new Promise(function(_0xf3bc99,_0x17c4e1){var _0x39cd21=_['values'](_0x8cb81d['telephones']);_0xf3bc99({'count':_0x39cd21[_0xe126('0x5b')],'rows':_0x39cd21});});},'Trunks':function(_0x1baa43){return new Promise(function(_0x1c760c,_0x5878d1){var _0x58d681=_['values'](_0x8cb81d[_0xe126('0x77')]);_0x1c760c({'count':_0x58d681[_0xe126('0x5b')],'rows':_0x58d681});});},'OutboundChannels':function(_0x3cbd56){return new Promise(function(_0x1f52b0,_0x84d769){var _0x3b8ccb=_[_0xe126('0x59')](_0x8cb81d['outboundChannels']);_0x1f52b0({'count':_0x3b8ccb[_0xe126('0x5b')],'rows':_0x3b8ccb});});},'Outbound':function(_0x3d10fd){return new Promise(function(_0x5a2fb4,_0x306765){_0x5a2fb4(_0x8cb81d[_0xe126('0x78')]);});},'Campaigns':function(_0x1cb1a4){return new Promise(function(_0x498b43,_0x55b77b){var _0x3c691b=_[_0xe126('0x59')](_0x8cb81d[_0xe126('0x79')]);_0x498b43({'count':_0x3c691b[_0xe126('0x5b')],'rows':_0x3c691b});});},'VoiceQueuesPreview':function(_0x497667){var _0x55b686=this;return new Promise(function(_0x572e20,_0x253d2a){_0x34d705[_0xe126('0x7a')](_0x497667['id'])['then'](function(_0x481994){_0x572e20({'code':0xc8,'message':_0x481994[_0xe126('0x1a')]});})[_0xe126('0x1b')](function(_0x2dace4){_0x253d2a(_0x55b686['error'](0x1f4,_0x2dace4[_0xe126('0x1a')]));});});},'EventManager':function(_0x39a9fe){var _0x219a6d=this;return new Promise(function(_0x5e3493,_0x4917c0){if(!_0x39a9fe['event']){return _0x4917c0(_0x219a6d['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xe126('0x7b')]('custom:'+_0x39a9fe[_0xe126('0x7c')],_0x39a9fe[_0xe126('0x1a')]);_0x5e3493({'code':0xc8,'message':_0x39a9fe});});},'FaxAccounts':function(_0x163cbc){return new Promise(function(_0x5ddfa2,_0x34c87d){var _0x42b0b5=_[_0xe126('0x59')](_0x8cb81d[_0xe126('0x7d')]);_0x5ddfa2({'count':_0x42b0b5[_0xe126('0x5b')],'rows':_0x42b0b5});});},'SendFax':function(_0x431ce6){var _0x11d287=this;return new Promise(function(_0x3588f2,_0x581003){_0x2f75a4[_0xe126('0x7e')](_0x431ce6)['then'](function(_0x2c28b2){_0x3588f2({'code':0xc8,'message':_0x2c28b2[_0xe126('0x1a')]});})['catch'](function(_0x2ff5e8){_0x581003(_0x11d287[_0xe126('0x10')](0x1f4,_0x2ff5e8[_0xe126('0x1a')]));});});},'CheckAfterSend':function(_0x4e5c0f){var _0x5ad1dd=this;return new Promise(function(_0x2c1115,_0x236dcc){_0x2f75a4['checkAfterSend'](_0x4e5c0f)[_0xe126('0x19')](function(_0x2bfffe){_0x2c1115({'code':0xc8,'message':_0x2bfffe[_0xe126('0x1a')]});})['catch'](function(_0x2877e4){_0x236dcc(_0x5ad1dd['error'](0x1f4,_0x2877e4[_0xe126('0x1a')]));});});}};var _0x1fe77c=jayson[_0xe126('0x7f')](_0x47ae76)[_0xe126('0x80')]();_0x1fe77c['on']('error',function(_0x380606){return _0x10210f(_0x380606);});_0x1fe77c['listen'](0x232a,_0xe126('0x81'),function(){console[_0xe126('0x82')](_0xe126('0x83'),0x232a);return _0x2162bd(_0xe126('0x84')+0x232a);});});}; \ No newline at end of file +var _0x4137=['error','asterisk','username','join','module','Reload','then','message','catch','ami\x20disconnected','pick','command','Action','content','voiceQueues','hasOwnProperty','name','strategy','answered','available','loggedIn','pTalking','sumDuration','talking','total','type','unmanaged','abandoned','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','voicechannel','map','channel','format','%s.%s','monitors','/var/spool/asterisk/monitor/','toLowerCase','rec','mixmonitorid','status','uniqueid','Channel\x20doesn\x27t\x20exist','channels','destinationchannel','StopMixMonitor','stop','filename','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','campaigns','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','%s/%s','SIP','timers','timer','agents','pause','QueuePause','isConnected'];(function(_0x376dc4,_0x45f48d){var _0x3146d6=function(_0x3c9f1c){while(--_0x3c9f1c){_0x376dc4['push'](_0x376dc4['shift']());}};_0x3146d6(++_0x45f48d);}(_0x4137,0xf8));var _0x7413=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4137[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var jayson=require(_0x7413('0x2'));var schema=require(_0x7413('0x3'));var BPromise=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var config=require(_0x7413('0x6'));var properties=require(_0x7413('0x7'));var ami=require(_0x7413('0x8'));exports[_0x7413('0x9')]=function(_0x451a96,_0x3bb181,_0x4fbade){return new BPromise(function(_0xc808cd,_0x188d89){var _0x5b39ac={'QueuePause':function(_0x15af0d){return new Promise(function(_0x5f4cd0,_0x3236ec){var _0x120dc2=util['format'](_0x7413('0xa'),_0x7413('0xb'),_0x15af0d['name']);if(_0x451a96[_0x7413('0xc')]&&_0x451a96[_0x7413('0xc')][_0x120dc2]&&_0x451a96[_0x7413('0xc')][_0x120dc2][_0x7413('0xd')]){_0x451a96[_0x7413('0xc')][_0x120dc2]['updateAcw']();}if(_0x451a96[_0x7413('0xe')][_0x120dc2]){_0x451a96[_0x7413('0xe')][_0x120dc2]['updateStatusRealtime']({'statePause':_0x15af0d[_0x7413('0xf')]?!![]:![]});}_0x5f4cd0({'code':0xc8,'message':_0x7413('0x10')});});},'Reload':function(_0x13e6bd){var _0x52c354=this;return new Promise(function(_0x5956b0,_0x55ef69){if(ami[_0x7413('0x11')]()==![]){return _0x55ef69(_0x52c354[_0x7413('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x7413('0x13')][_0x7413('0x14')],'ami\x20disconnected'][_0x7413('0x15')]('\x20')));}_0x13e6bd=_['pick'](_0x13e6bd,_['keys'](properties[_0x7413('0x16')]));_0x13e6bd['action']=_0x7413('0x17');return ami['Action'](_0x13e6bd)[_0x7413('0x18')](function(_0x3230d8){_0x5956b0({'code':0xc8,'message':_0x3230d8[_0x7413('0x19')]});})[_0x7413('0x1a')](function(_0x2a3417){_0x55ef69(_0x52c354[_0x7413('0x12')](0x1f5,_0x2a3417['message']));});});},'Command':function(_0xecc3e){var _0x17c062=this;return new Promise(function(_0x11f8a1,_0xfe5b8c){if(ami['isConnected']()==![]){return _0xfe5b8c(_0x17c062[_0x7413('0x12')](0x1f4,[config[_0x7413('0x13')]['ip'],config[_0x7413('0x13')][_0x7413('0x14')],_0x7413('0x1b')][_0x7413('0x15')]('\x20')));}_0xecc3e=_[_0x7413('0x1c')](_0xecc3e,_0x7413('0x1d'));_0xecc3e['action']='Command';return ami[_0x7413('0x1e')](_0xecc3e)['then'](function(_0x1585ba){_0x11f8a1({'code':0xc8,'message':_0x1585ba[_0x7413('0x1f')]});})[_0x7413('0x1a')](function(_0x2fc0f4){_0xfe5b8c(_0x17c062[_0x7413('0x12')](0x1f5,_0x2fc0f4[_0x7413('0x19')]));});});},'VoiceQueues':function(_0x1d97fd){return new Promise(function(_0x41cb5d,_0x1d455b){var _0x5a8329=[];for(var _0x5cb15f in _0x451a96[_0x7413('0x20')]){if(_0x451a96['voiceQueues'][_0x7413('0x21')](_0x5cb15f)){var _0x71cbb4=_0x451a96[_0x7413('0x20')][_0x5cb15f];var _0x4c2e90={'id':_0x71cbb4['id'],'name':_0x71cbb4[_0x7413('0x22')],'strategy':_0x71cbb4[_0x7413('0x23')],'answered':_0x71cbb4[_0x7413('0x24')],'available':_0x71cbb4[_0x7413('0x25')],'loggedIn':_0x71cbb4[_0x7413('0x26')],'pTalking':_0x71cbb4[_0x7413('0x27')],'sumBillable':_0x71cbb4['sumBillable'],'sumDuration':_0x71cbb4[_0x7413('0x28')],'sumHoldTime':_0x71cbb4['sumHoldTime']||0x0,'talking':_0x71cbb4[_0x7413('0x29')],'total':_0x71cbb4[_0x7413('0x2a')],'type':_0x71cbb4[_0x7413('0x2b')],'unmanaged':_0x71cbb4[_0x7413('0x2c')],'abandoned':_0x71cbb4[_0x7413('0x2d')],'waiting':_0x71cbb4[_0x7413('0x2e')],'loggedInDb':_0x71cbb4['loggedInDb']};if(_0x71cbb4[_0x7413('0x2b')]===_0x7413('0x2f')){_0x4c2e90[_0x7413('0x30')]=_0x71cbb4[_0x7413('0x30')];_0x4c2e90[_0x7413('0x31')]=_0x71cbb4[_0x7413('0x31')];_0x4c2e90[_0x7413('0x32')]=_0x71cbb4['dialOriginateCallerIdName'];_0x4c2e90[_0x7413('0x33')]=_0x71cbb4[_0x7413('0x33')];_0x4c2e90[_0x7413('0x34')]=_0x71cbb4[_0x7413('0x34')];_0x4c2e90[_0x7413('0x35')]=_0x71cbb4['dialPrefix'];_0x4c2e90[_0x7413('0x36')]=_0x71cbb4['temp'];_0x4c2e90[_0x7413('0x37')]=_0x71cbb4[_0x7413('0x37')];_0x4c2e90[_0x7413('0x38')]=_0x71cbb4['outboundAnswerCallsDay'];_0x4c2e90[_0x7413('0x39')]=_0x71cbb4['outboundBlacklistCallsDay'];_0x4c2e90[_0x7413('0x3a')]=_0x71cbb4[_0x7413('0x3a')];_0x4c2e90['outboundCongestionCallsDay']=_0x71cbb4['outboundCongestionCallsDay'];_0x4c2e90[_0x7413('0x3b')]=_0x71cbb4[_0x7413('0x3b')];_0x4c2e90[_0x7413('0x3c')]=_0x71cbb4['outboundDropCallsDayCallersExit'];_0x4c2e90['outboundDropCallsDayTimeout']=_0x71cbb4[_0x7413('0x3d')];_0x4c2e90['outboundNoAnswerCallsDay']=_0x71cbb4['outboundNoAnswerCallsDay'];_0x4c2e90[_0x7413('0x3e')]=_0x71cbb4['outboundNoSuchCallsDay'];_0x4c2e90[_0x7413('0x3f')]=_0x71cbb4[_0x7413('0x3f')];_0x4c2e90[_0x7413('0x40')]=_0x71cbb4[_0x7413('0x40')];_0x4c2e90[_0x7413('0x41')]=_0x71cbb4['outboundRejectCallsDay'];_0x4c2e90[_0x7413('0x42')]=_0x71cbb4[_0x7413('0x42')];_0x4c2e90[_0x7413('0x43')]=_0x71cbb4[_0x7413('0x43')];_0x4c2e90[_0x7413('0x44')]=_0x71cbb4[_0x7413('0x44')];_0x4c2e90[_0x7413('0x45')]=_0x71cbb4[_0x7413('0x45')];_0x4c2e90[_0x7413('0x46')]=_0x71cbb4[_0x7413('0x46')];_0x4c2e90[_0x7413('0x47')]=_0x71cbb4[_0x7413('0x47')];_0x4c2e90['predictiveIntervalErlangCalls']=_0x71cbb4[_0x7413('0x48')];_0x4c2e90['predictiveIntervalErlangCallsDroppedCalls']=_0x71cbb4['predictiveIntervalErlangCallsDroppedCalls'];_0x4c2e90['predictiveIntervalHitRate']=_0x71cbb4['predictiveIntervalHitRate'];_0x4c2e90['predictiveIntervalMultiplicativeFactor']=_0x71cbb4[_0x7413('0x49')];_0x4c2e90['predictiveIntervalPauses']=_0x71cbb4['predictiveIntervalPauses'];_0x4c2e90[_0x7413('0x4a')]=_0x71cbb4['predictiveIntervalAvailable'];_0x4c2e90['predictiveIntervalTotalCalls']=_0x71cbb4[_0x7413('0x4b')];_0x4c2e90[_0x7413('0x19')]=_0x71cbb4[_0x7413('0x19')];_0x4c2e90[_0x7413('0x4c')]=_0x71cbb4[_0x7413('0x4c')];_0x4c2e90['erlangCalls']=_0x71cbb4[_0x7413('0x4d')];_0x4c2e90['erlangCallToSecond']=_0x71cbb4[_0x7413('0x4e')];_0x4c2e90[_0x7413('0x4f')]=_0x71cbb4[_0x7413('0x4f')];_0x4c2e90[_0x7413('0x50')]=_0x71cbb4[_0x7413('0x50')];_0x4c2e90[_0x7413('0x51')]=_0x71cbb4[_0x7413('0x51')];_0x4c2e90[_0x7413('0x52')]=_0x71cbb4[_0x7413('0x52')];}if(_0x71cbb4[_0x7413('0x53')]){_0x4c2e90[_0x7413('0x53')]={'id':_0x71cbb4[_0x7413('0x53')]['id'],'name':_0x71cbb4[_0x7413('0x53')]['name'],'active':_0x71cbb4[_0x7413('0x53')][_0x7413('0x54')],'callerid':_0x71cbb4[_0x7413('0x53')][_0x7413('0x55')]};}if(_0x71cbb4[_0x7413('0x56')]){_0x4c2e90[_0x7413('0x56')]={'id':_0x71cbb4[_0x7413('0x56')]['id'],'name':_0x71cbb4[_0x7413('0x56')][_0x7413('0x22')]};}_0x5a8329[_0x7413('0x57')](_0x4c2e90);}}_0x41cb5d({'count':_0x5a8329[_0x7413('0x58')],'rows':_0x5a8329});});},'UpdateVoiceQueue':function(_0x51b1d3){return new Promise(function(_0x2c5d1b,_0x52a088){var _0x3f7fa3=_[_0x7413('0x59')](_0x451a96[_0x7413('0x20')],{'id':parseInt(_0x51b1d3['id'])});var _0xb2d135=_[_0x7413('0x5a')](_0x51b1d3,['id']);if(_0x3f7fa3){for(var _0x148b69 in _0xb2d135){if(typeof _0xb2d135[_0x148b69]!==_0x7413('0x5b')&&typeof _0x3f7fa3[_0x148b69]!==_0x7413('0x5b')){_0x3f7fa3[_0x148b69]=_0xb2d135[_0x148b69];}}_0x2c5d1b(_0x3f7fa3);}else{_0x52a088();}});},'VoiceChannels':function(_0xcb1f11){return new Promise(function(_0x3b4742,_0x521f5e){var _0x513657=_[_0x7413('0x5c')](_0x451a96['channels']);_0x3b4742({'count':_0x513657['length'],'rows':_0x513657});});},'VoiceChannelMixMonitor':function(_0x27d2b6){var _0x208338=this;return new Promise(function(_0x5cb3bb,_0x2aa12c){if(ami['isConnected']()==![]){return _0x2aa12c(_0x208338['error'](0x1f4,[config[_0x7413('0x13')]['ip'],config['asterisk'][_0x7413('0x14')],_0x7413('0x1b')][_0x7413('0x15')]('\x20')));}var _0x5fe361=schema(properties[_0x7413('0x5d')])[_0x7413('0x3')](_0x27d2b6);if(_0x5fe361[_0x7413('0x58')]>0x0){return _0x2aa12c(_0x208338[_0x7413('0x12')](0x1f4,_[_0x7413('0x5e')](_0x5fe361,_0x7413('0x19'))['join'](',\x20')));}var _0x369891=_['find'](_0x451a96['channels'],{'uniqueid':_0x27d2b6['uniqueid']});if(_0x369891&&_0x369891[_0x7413('0x5f')]){var _0x4299a3=util[_0x7413('0x60')](_0x7413('0x61'),_0x27d2b6['filename']||_0x27d2b6['uniqueid'],_0x27d2b6[_0x7413('0x60')]||'wav');return ami[_0x7413('0x1e')]({'action':'MixMonitor','channel':_0x369891['channel'],'file':_0x4299a3,'options':'ai(mixmonitorid)'})['then'](function(_0x53c9d0){var _0x6734e4=_[_0x7413('0x59')](_0x369891[_0x7413('0x62')],{'filename':_0x7413('0x63')+_0x4299a3[_0x7413('0x64')]()});if(_['isNil'](_0x6734e4)){_0x369891[_0x7413('0x62')][_0x7413('0x57')]({'filename':_0x7413('0x63')+_0x4299a3['toLowerCase'](),'createdAt':moment()[_0x7413('0x60')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x53c9d0['mixmonitorid'],'status':_0x7413('0x65')});}else{_0x6734e4[_0x7413('0x66')]=_0x53c9d0[_0x7413('0x66')];_0x6734e4[_0x7413('0x67')]=_0x7413('0x65');}_0x5cb3bb({'code':0xc8,'message':[_0x27d2b6[_0x7413('0x68')],'MixMonitor\x20Success',_0x53c9d0[_0x7413('0x66')]]['join']('\x20'),'mixmonitorid':_0x53c9d0[_0x7413('0x66')]});})['catch'](function(_0x1ea50f){_0x2aa12c(_0x208338['error'](0x1f5,[_0x27d2b6[_0x7413('0x68')],_0x1ea50f[_0x7413('0x19')]['toLowerCase']()][_0x7413('0x15')]('\x20')));});}else{return _0x2aa12c(_0x208338['error'](0x1f5,_0x7413('0x69')));}});},'VoiceChannelStopMixMonitor':function(_0x2a5db6){var _0x5163ca=this;return new Promise(function(_0x3ea2d9,_0x12048c){if(ami['isConnected']()==![]){return _0x12048c(_0x5163ca[_0x7413('0x12')](0x1f4,[config[_0x7413('0x13')]['ip'],config['asterisk'][_0x7413('0x14')],_0x7413('0x1b')][_0x7413('0x15')]('\x20')));}var _0x395e3b=schema(properties[_0x7413('0x5d')])[_0x7413('0x3')](_0x2a5db6);if(_0x395e3b[_0x7413('0x58')]>0x0){return _0x12048c(_0x5163ca[_0x7413('0x12')](0x1f4,_['map'](_0x395e3b,_0x7413('0x19'))['join'](',\x20')));}var _0x3808d3=_[_0x7413('0x59')](_0x451a96[_0x7413('0x6a')],{'uniqueid':_0x2a5db6[_0x7413('0x68')]});if(_0x3808d3){return BPromise['resolve']()['then'](function(){if(_0x3808d3['channel']){return ami['Action']({'action':'StopMixMonitor','channel':_0x3808d3[_0x7413('0x5f')],'mixmonitorid':_0x2a5db6[_0x7413('0x66')]})[_0x7413('0x1a')](function(_0x5de03e){});}})[_0x7413('0x18')](function(){if(_0x3808d3[_0x7413('0x6b')]){return ami[_0x7413('0x1e')]({'action':_0x7413('0x6c'),'channel':_0x3808d3[_0x7413('0x6b')],'mixmonitorid':_0x2a5db6[_0x7413('0x66')]})[_0x7413('0x1a')](function(_0x295a0a){});}})[_0x7413('0x18')](function(_0x47512d){var _0x3f9cfd=_[_0x7413('0x59')](_0x3808d3[_0x7413('0x62')],{'mixmonitorid':_0x2a5db6['mixmonitorid']});if(_0x3f9cfd){_0x3f9cfd[_0x7413('0x67')]=_0x7413('0x6d');}})['then'](function(){var _0x3d4d23=util[_0x7413('0x60')](_0x7413('0x61'),_0x2a5db6[_0x7413('0x6e')]||_0x2a5db6[_0x7413('0x68')],_0x2a5db6[_0x7413('0x60')]||'wav');var _0x61e533=_[_0x7413('0x59')](_0x3808d3['monitors'],{'filename':_0x7413('0x63')+_0x3d4d23['toLowerCase']()});if(_0x61e533){_0x61e533['status']=_0x7413('0x6d');}})[_0x7413('0x18')](function(){_0x3ea2d9({'code':0xc8,'message':[_0x2a5db6[_0x7413('0x68')],_0x7413('0x6f')][_0x7413('0x15')]('\x20')});})[_0x7413('0x1a')](function(_0x6171a9){_0x12048c(_0x5163ca[_0x7413('0x12')](0x1f5,[_0x2a5db6['uniqueid'],_0x6171a9[_0x7413('0x19')]['toLowerCase']()][_0x7413('0x15')]('\x20')));});}else{return _0x12048c(_0x5163ca[_0x7413('0x12')](0x1f5,_0x7413('0x69')));}});},'VoiceQueuesChannels':function(_0x3054f5){return new Promise(function(_0x2c4664,_0x29d919){var _0x1d4ef5=_[_0x7413('0x5c')](_0x451a96[_0x7413('0x70')]);_0x2c4664({'count':_0x1d4ef5['length'],'rows':_0x1d4ef5});});},'VoiceQueuesChannel':function(_0x5988bd){var _0x41875d=this;return new Promise(function(_0x53354b,_0x3ba8a8){var _0x639d33=schema(properties['voicequeuechannel'])[_0x7413('0x3')](_0x5988bd);if(_0x639d33['length']>0x0){return _0x3ba8a8(_0x41875d[_0x7413('0x12')](0x1f4,_[_0x7413('0x5e')](_0x639d33,'message')['join'](',\x20')));}var _0x227a66=_[_0x7413('0x59')](_0x451a96[_0x7413('0x70')],{'uniqueid':_0x5988bd['uniqueid']});if(_0x227a66){_0x53354b(_0x227a66);}else{return _0x3ba8a8(_0x41875d[_0x7413('0x12')](0x1f5,_0x7413('0x69')));}});},'VoiceQueuesChannelHangup':function(_0x25c93a){var _0x1d1d2=this;return new Promise(function(_0x2e6178,_0x3e91ad){if(ami['isConnected']()==![]){return _0x3e91ad(_0x1d1d2[_0x7413('0x12')](0x1f4,[config[_0x7413('0x13')]['ip'],config[_0x7413('0x13')]['username'],_0x7413('0x1b')][_0x7413('0x15')]('\x20')));}var _0x82869a=schema(properties[_0x7413('0x71')])[_0x7413('0x3')](_0x25c93a);if(_0x82869a[_0x7413('0x58')]>0x0){return _0x3e91ad(_0x1d1d2[_0x7413('0x12')](0x1f4,_[_0x7413('0x5e')](_0x82869a,_0x7413('0x19'))['join'](',\x20')));}var _0x1edcba=_[_0x7413('0x59')](_0x451a96[_0x7413('0x70')],{'uniqueid':_0x25c93a[_0x7413('0x68')]});if(_0x1edcba&&_0x1edcba[_0x7413('0x5f')]){return ami[_0x7413('0x1e')]({'action':'Hangup','channel':_0x1edcba[_0x7413('0x5f')]})['then'](function(_0x4af607){_0x2e6178({'code':0xc8,'message':[_0x25c93a[_0x7413('0x68')],_0x4af607[_0x7413('0x19')]['toLowerCase']()][_0x7413('0x15')]('\x20')});})[_0x7413('0x1a')](function(_0x127bdc){_0x3e91ad(_0x1d1d2[_0x7413('0x12')](0x1f5,[_0x25c93a[_0x7413('0x68')],_0x127bdc[_0x7413('0x19')][_0x7413('0x64')]()][_0x7413('0x15')]('\x20')));});}else{return _0x3e91ad(_0x1d1d2['error'](0x1f5,_0x7413('0x69')));}});},'VoiceQueuesChannelRedirect':function(_0x528d19){var _0xeaf166=this;return new Promise(function(_0x3ad956,_0x516030){if(ami[_0x7413('0x11')]()==![]){return _0x516030(_0xeaf166[_0x7413('0x12')](0x1f4,[config[_0x7413('0x13')]['ip'],config[_0x7413('0x13')][_0x7413('0x14')],_0x7413('0x1b')][_0x7413('0x15')]('\x20')));}var _0x12fbb2=schema(properties[_0x7413('0x72')])[_0x7413('0x3')](_0x528d19);if(_0x12fbb2['length']>0x0){return _0x516030(_0xeaf166[_0x7413('0x12')](0x1f4,_[_0x7413('0x5e')](_0x12fbb2,'message')['join'](',\x20')));}var _0x544fa2=_[_0x7413('0x59')](_0x451a96['queueChannels'],{'uniqueid':_0x528d19[_0x7413('0x68')]});if(_0x544fa2&&_0x544fa2[_0x7413('0x5f')]){return ami[_0x7413('0x1e')]({'action':_0x7413('0x73'),'channel':_0x544fa2[_0x7413('0x5f')],'exten':_0x528d19[_0x7413('0x74')],'context':_0x528d19[_0x7413('0x75')]||_0x544fa2[_0x7413('0x75')],'priority':0x1})[_0x7413('0x18')](function(_0x5b0e45){_0x3ad956({'code':0xc8,'message':[_0x528d19[_0x7413('0x68')],_0x5b0e45[_0x7413('0x19')][_0x7413('0x64')]()]['join']('\x20')});})[_0x7413('0x1a')](function(_0x3c3676){_0x516030(_0xeaf166[_0x7413('0x12')](0x1f5,[_0x528d19[_0x7413('0x68')],_0x3c3676[_0x7413('0x19')][_0x7413('0x64')]()][_0x7413('0x15')]('\x20')));});}else{return _0x516030(_0xeaf166[_0x7413('0x12')](0x1f5,_0x7413('0x69')));}});},'Agents':function(_0xa31bf1){return new Promise(function(_0x4f998b,_0x30997b){var _0x122748=_['values'](_0x451a96[_0x7413('0xe')]);_0x4f998b({'count':_0x122748[_0x7413('0x58')],'rows':_0x122748});});},'Telephones':function(_0x4d4fec){return new Promise(function(_0x33232d,_0x193d54){var _0x230191=_['values'](_0x451a96[_0x7413('0x76')]);_0x33232d({'count':_0x230191['length'],'rows':_0x230191});});},'Trunks':function(_0x466ec8){return new Promise(function(_0x35f721,_0x4537b5){var _0x20ba75=_[_0x7413('0x5c')](_0x451a96[_0x7413('0x77')]);_0x35f721({'count':_0x20ba75['length'],'rows':_0x20ba75});});},'OutboundChannels':function(_0x4ece1){return new Promise(function(_0x40e10d,_0x17ccd4){var _0x43991d=_[_0x7413('0x5c')](_0x451a96['outboundChannels']);_0x40e10d({'count':_0x43991d[_0x7413('0x58')],'rows':_0x43991d});});},'Outbound':function(_0x566ee0){return new Promise(function(_0x191fa2,_0x3c4661){_0x191fa2(_0x451a96[_0x7413('0x2f')]);});},'Campaigns':function(_0x49e310){return new Promise(function(_0x517b6e,_0x36500b){var _0x2e672d=_[_0x7413('0x5c')](_0x451a96[_0x7413('0x78')]);_0x517b6e({'count':_0x2e672d['length'],'rows':_0x2e672d});});},'VoiceQueuesPreview':function(_0x4c7787){var _0x41bb34=this;return new Promise(function(_0x35611b,_0x32c96f){_0x3bb181['run'](_0x4c7787['id'])['then'](function(_0x2d71c8){_0x35611b({'code':0xc8,'message':_0x2d71c8[_0x7413('0x19')]});})[_0x7413('0x1a')](function(_0x41615c){_0x32c96f(_0x41bb34[_0x7413('0x12')](0x1f4,_0x41615c[_0x7413('0x19')]));});});},'EventManager':function(_0x5fd045){var _0x4b2b7c=this;return new Promise(function(_0x4e0a26,_0x396a6a){if(!_0x5fd045[_0x7413('0x79')]){return _0x396a6a(_0x4b2b7c['error'](0x1f4,_0x7413('0x7a')));}ami[_0x7413('0x7b')](_0x7413('0x7c')+_0x5fd045[_0x7413('0x79')],_0x5fd045[_0x7413('0x19')]);_0x4e0a26({'code':0xc8,'message':_0x5fd045});});},'FaxAccounts':function(_0x1b22e7){return new Promise(function(_0x1826d6,_0x2939b6){var _0x3cffbb=_['values'](_0x451a96[_0x7413('0x7d')]);_0x1826d6({'count':_0x3cffbb[_0x7413('0x58')],'rows':_0x3cffbb});});},'SendFax':function(_0x59d665){var _0x1f3e26=this;return new Promise(function(_0xccd480,_0x20ffaf){_0x4fbade['send'](_0x59d665)['then'](function(_0x58e0d8){_0xccd480({'code':0xc8,'message':_0x58e0d8[_0x7413('0x19')]});})[_0x7413('0x1a')](function(_0x999109){_0x20ffaf(_0x1f3e26[_0x7413('0x12')](0x1f4,_0x999109[_0x7413('0x19')]));});});},'CheckAfterSend':function(_0xbac7e8){var _0x207293=this;return new Promise(function(_0x12ec35,_0x4e872e){_0x4fbade[_0x7413('0x7e')](_0xbac7e8)['then'](function(_0x459c24){_0x12ec35({'code':0xc8,'message':_0x459c24[_0x7413('0x19')]});})[_0x7413('0x1a')](function(_0x266f8b){_0x4e872e(_0x207293[_0x7413('0x12')](0x1f4,_0x266f8b['message']));});});}};var _0x21b700=jayson[_0x7413('0x7f')](_0x5b39ac)[_0x7413('0x80')]();_0x21b700['on'](_0x7413('0x12'),function(_0xf11f9b){return _0x188d89(_0xf11f9b);});_0x21b700[_0x7413('0x9')](0x232a,_0x7413('0x81'),function(){console[_0x7413('0x82')](_0x7413('0x83'),0x232a);return _0xc808cd(_0x7413('0x84')+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 e61c5d6..e876a7c 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 _0xa875=['emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','phone','mobile','fax','scheduledAt','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','destcalleridname','','Unknown','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','action','merge','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info'];(function(_0x21057f,_0x4e3b82){var _0x1e2c77=function(_0x211e64){while(--_0x211e64){_0x21057f['push'](_0x21057f['shift']());}};_0x1e2c77(++_0x4e3b82);}(_0xa875,0x176));var _0x5a87=function(_0xe39824,_0xbdf61f){_0xe39824=_0xe39824-0x0;var _0x4bc31e=_0xa875[_0xe39824];return _0x4bc31e;};'use strict';var _=require('lodash');var BPromise=require(_0x5a87('0x0'));var Redis=require(_0x5a87('0x1'));var util=require(_0x5a87('0x2'));var config=require(_0x5a87('0x3'));var logger=require(_0x5a87('0x4'))(_0x5a87('0x5'));var cmContactRpc=require(_0x5a87('0x6'));config[_0x5a87('0x7')]=_['defaults'](config[_0x5a87('0x7')],{'host':_0x5a87('0x8'),'port':0x18eb});var io=require(_0x5a87('0x9'))(new Redis(config[_0x5a87('0x7')]));function emit(_0x5042b5,_0x428b34,_0x4ff305,_0x162a61,_0xcd96f5){logger[_0x5a87('0xa')]('[CM][%s][%s]',_0x5042b5,_0x428b34['id'],_0x4ff305,_0x162a61,JSON['stringify'](_0xcd96f5));io['to'](_0x4ff305)[_0x5a87('0xb')](_0x162a61,_0xcd96f5);}exports[_0x5a87('0xc')]=function(_0x3233a8,_0x62beaf,_0xdb89a4,_0x53a97a){var _0x17d6f2,_0x91b1b0;var _0x4ac530={};var _0x5cc12d;var _0x2acf17=Number(_0xdb89a4[_0x5a87('0xd')]);var _0x7cbdbc=_0xdb89a4['data2']?Boolean(Number(_0xdb89a4[_0x5a87('0xe')])):![];var _0x5348b4;var _0x16ee15=![];if(!_[_0x5a87('0xf')](_0xdb89a4['data5'])){if(_0xdb89a4[_0x5a87('0x10')]=='1')_0x16ee15=!![];}if(!_0x16ee15){if(_0x53a97a['xmd-contactid']){_0x4ac530['id']=_0x53a97a[_0x5a87('0x11')];}}if(!_0x4ac530['id']){_0x4ac530[_0x5a87('0x12')]=_0x2acf17;_0x5348b4=_0xdb89a4[_0x5a87('0x13')]&&_0xdb89a4[_0x5a87('0x13')]!=='0'?_0xdb89a4[_0x5a87('0x13')][_0x5a87('0x14')](','):['phone'];_0x4ac530[_0x5a87('0x15')]=_['map'](_0x5348b4,function(_0x181667){var _0x30ec78={};_0x30ec78[_0x181667]=_0x53a97a[_0x5a87('0x16')]?_0x53a97a[_0x5a87('0x17')]:_0x53a97a[_0x5a87('0x18')];return _0x30ec78;});_0x5cc12d=_0x53a97a[_0x5a87('0x16')]?_0x53a97a[_0x5a87('0x17')]:_0x53a97a[_0x5a87('0x18')];}var _0x32be01=['id',_0x5a87('0x19'),_0x5a87('0x1a'),_0x5a87('0x1b'),_0x5a87('0x1c'),_0x5a87('0x1d'),_0x5a87('0x12'),'createdAt',_0x5a87('0x1e'),_0x5a87('0x1f')];var _0x1a8ed2=_[_0x5a87('0x20')](_0x32be01,_0x5348b4);BPromise[_0x5a87('0x21')]()['then'](cmContactRpc['getContacts']({'attributes':_0x1a8ed2,'where':_0x4ac530,'phone':_0x5cc12d}))[_0x5a87('0x22')](function(_0xa5a2c2){_0x91b1b0=_0xa5a2c2;if(!_[_0x5a87('0x23')](_0x91b1b0)){if(_0x91b1b0[_0x5a87('0x24')]===0x1){_0x17d6f2=_0x91b1b0[0x0];logger[_0x5a87('0xa')](_0x5a87('0x25'),_0x53a97a[_0x5a87('0x26')],_0x62beaf['id'],_0x17d6f2['id']);}else{logger[_0x5a87('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x53a97a['uniqueid'],_0x62beaf['id'],_[_0x5a87('0x27')](_0x91b1b0,'id')[_0x5a87('0x28')](','));}return;}else{logger[_0x5a87('0xa')](_0x5a87('0x29'),_0x53a97a['uniqueid'],_0x62beaf['id']);var _0xe75508={'ListId':_0x2acf17};var _0x4b0ff0=_0xdb89a4[_0x5a87('0x2a')]&&_0xdb89a4[_0x5a87('0x2a')]!=='0'?_0xdb89a4['data4']:'phone';if(_0x7cbdbc){logger['info'](_0x5a87('0x2b'),_0x53a97a[_0x5a87('0x26')],_0x62beaf['id']);_0xe75508[_0x4b0ff0]=_[_0x5a87('0xf')](_0x53a97a[_0x5a87('0x16')])?_0x53a97a[_0x5a87('0x18')]:_0x53a97a[_0x5a87('0x17')];if(_[_0x5a87('0xf')](_0x53a97a[_0x5a87('0x16')])){_0xe75508['firstName']=_0x53a97a['calleridname']&&_0x53a97a[_0x5a87('0x2c')]!==''?_0x53a97a[_0x5a87('0x2c')]:'Unknown';}else{_0xe75508['firstName']=_0x53a97a['destcalleridname']&&_0x53a97a[_0x5a87('0x2d')]!==_0x5a87('0x2e')?_0x53a97a[_0x5a87('0x2d')]:_0x5a87('0x2f');}return BPromise[_0x5a87('0x21')]()[_0x5a87('0x22')](cmContactRpc[_0x5a87('0x30')](_0xe75508))['then'](function(_0x14e684){_0x17d6f2=_0x14e684;_0x91b1b0[_0x5a87('0x31')](_0x14e684);if(_0x17d6f2){logger['info']('[CM][%s][%s]\x20Contact\x20created:%s',_0x53a97a[_0x5a87('0x26')],_0x62beaf['id'],_0x17d6f2['id']);}return;});}else{logger[_0x5a87('0xa')](_0x5a87('0x32'),_0x53a97a[_0x5a87('0x26')],_0x62beaf['id']);_0xe75508[_0x4b0ff0]=_[_0x5a87('0xf')](_0x53a97a[_0x5a87('0x16')])?_0x53a97a['calleridnum']:_0x53a97a['destcalleridnum'];if(_[_0x5a87('0xf')](_0x53a97a[_0x5a87('0x16')])){_0xe75508[_0x5a87('0x19')]=_0x53a97a['calleridname']&&_0x53a97a[_0x5a87('0x2c')]!==_0x5a87('0x2e')?_0x53a97a[_0x5a87('0x2c')]:_0x5a87('0x2f');}else{_0xe75508[_0x5a87('0x19')]=_0x53a97a['destcalleridname']&&_0x53a97a[_0x5a87('0x2d')]!==_0x5a87('0x2e')?_0x53a97a['destcalleridname']:_0x5a87('0x2f');}_0x17d6f2=_0xe75508;_0x91b1b0[_0x5a87('0x31')](_0xe75508);return;}}})[_0x5a87('0x22')](function(){if(_0x3233a8){emit(_0x53a97a['uniqueid'],_0x62beaf,util[_0x5a87('0x33')](_0x5a87('0x34'),_0x3233a8['name']),util[_0x5a87('0x33')]('trigger:%s',_0xdb89a4[_0x5a87('0x35')]['toLowerCase']()),{'evt':_[_0x5a87('0x36')](_0x53a97a,{'autoCreate':_0x7cbdbc}),'contact':_0x17d6f2===undefined?{}:_0x17d6f2,'contacts':_0x91b1b0[_0x5a87('0x24')]===0x0?undefined:_0x91b1b0});}});}; \ No newline at end of file +var _0xce2e=['defaults','localhost','info','[CM][%s][%s]','emit','data1','data2','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','uniqueid','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis'];(function(_0x5a21d4,_0x14b5d3){var _0x3c4620=function(_0x44e7d2){while(--_0x44e7d2){_0x5a21d4['push'](_0x5a21d4['shift']());}};_0x3c4620(++_0x14b5d3);}(_0xce2e,0x1d8));var _0xece2=function(_0xf36f94,_0x4131ea){_0xf36f94=_0xf36f94-0x0;var _0x165ef7=_0xce2e[_0xf36f94];return _0x165ef7;};'use strict';var _=require(_0xece2('0x0'));var BPromise=require(_0xece2('0x1'));var Redis=require(_0xece2('0x2'));var util=require(_0xece2('0x3'));var config=require(_0xece2('0x4'));var logger=require(_0xece2('0x5'))(_0xece2('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0xece2('0x7')]=_[_0xece2('0x8')](config[_0xece2('0x7')],{'host':_0xece2('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x365255,_0x4631b3,_0x502c57,_0x47a168,_0x20c3ef){logger[_0xece2('0xa')](_0xece2('0xb'),_0x365255,_0x4631b3['id'],_0x502c57,_0x47a168,JSON['stringify'](_0x20c3ef));io['to'](_0x502c57)[_0xece2('0xc')](_0x47a168,_0x20c3ef);}exports['exec']=function(_0x5e2f2a,_0x11c133,_0x34e72c,_0x5ea2d6){var _0x229d2f,_0x333afa;var _0x1041e9={};var _0x553aec;var _0x5888b1=Number(_0x34e72c[_0xece2('0xd')]);var _0x3d327d=_0x34e72c[_0xece2('0xe')]?Boolean(Number(_0x34e72c[_0xece2('0xe')])):![];var _0x592d24;var _0x48e380=![];if(!_['isNil'](_0x34e72c[_0xece2('0xf')])){if(_0x34e72c[_0xece2('0xf')]=='1')_0x48e380=!![];}if(!_0x48e380){if(_0x5ea2d6[_0xece2('0x10')]){_0x1041e9['id']=_0x5ea2d6[_0xece2('0x10')];}}if(!_0x1041e9['id']){_0x1041e9[_0xece2('0x11')]=_0x5888b1;_0x592d24=_0x34e72c['data3']&&_0x34e72c[_0xece2('0x12')]!=='0'?_0x34e72c[_0xece2('0x12')][_0xece2('0x13')](','):[_0xece2('0x14')];_0x1041e9[_0xece2('0x15')]=_[_0xece2('0x16')](_0x592d24,function(_0x5d281b){var _0x373d99={};_0x373d99[_0x5d281b]=_0x5ea2d6[_0xece2('0x17')]?_0x5ea2d6[_0xece2('0x18')]:_0x5ea2d6[_0xece2('0x19')];return _0x373d99;});_0x553aec=_0x5ea2d6[_0xece2('0x17')]?_0x5ea2d6[_0xece2('0x18')]:_0x5ea2d6[_0xece2('0x19')];}var _0x252140=['id',_0xece2('0x1a'),_0xece2('0x1b'),_0xece2('0x14'),_0xece2('0x1c'),_0xece2('0x1d'),_0xece2('0x11'),_0xece2('0x1e'),_0xece2('0x1f'),_0xece2('0x20')];var _0x5438b3=_['union'](_0x252140,_0x592d24);BPromise[_0xece2('0x21')]()[_0xece2('0x22')](cmContactRpc[_0xece2('0x23')]({'attributes':_0x5438b3,'where':_0x1041e9,'phone':_0x553aec}))[_0xece2('0x22')](function(_0x44975e){_0x333afa=_0x44975e;if(!_[_0xece2('0x24')](_0x333afa)){if(_0x333afa[_0xece2('0x25')]===0x1){_0x229d2f=_0x333afa[0x0];logger[_0xece2('0xa')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x5ea2d6['uniqueid'],_0x11c133['id'],_0x229d2f['id']);}else{logger[_0xece2('0xa')](_0xece2('0x26'),_0x5ea2d6['uniqueid'],_0x11c133['id'],_[_0xece2('0x16')](_0x333afa,'id')[_0xece2('0x27')](','));}return;}else{logger['info'](_0xece2('0x28'),_0x5ea2d6[_0xece2('0x29')],_0x11c133['id']);var _0x26756f={'ListId':_0x5888b1};var _0x4a8f61=_0x34e72c['data4']&&_0x34e72c[_0xece2('0x2a')]!=='0'?_0x34e72c['data4']:_0xece2('0x14');if(_0x3d327d){logger[_0xece2('0xa')](_0xece2('0x2b'),_0x5ea2d6['uniqueid'],_0x11c133['id']);_0x26756f[_0x4a8f61]=_[_0xece2('0x2c')](_0x5ea2d6[_0xece2('0x17')])?_0x5ea2d6['calleridnum']:_0x5ea2d6[_0xece2('0x18')];if(_['isNil'](_0x5ea2d6[_0xece2('0x17')])){_0x26756f[_0xece2('0x1a')]=_0x5ea2d6[_0xece2('0x2d')]&&_0x5ea2d6['calleridname']!==_0xece2('0x2e')?_0x5ea2d6[_0xece2('0x2d')]:_0xece2('0x2f');}else{_0x26756f[_0xece2('0x1a')]=_0x5ea2d6[_0xece2('0x30')]&&_0x5ea2d6[_0xece2('0x30')]!==''?_0x5ea2d6[_0xece2('0x30')]:_0xece2('0x2f');}return BPromise['resolve']()[_0xece2('0x22')](cmContactRpc[_0xece2('0x31')](_0x26756f))['then'](function(_0x38e4a3){_0x229d2f=_0x38e4a3;_0x333afa[_0xece2('0x32')](_0x38e4a3);if(_0x229d2f){logger[_0xece2('0xa')](_0xece2('0x33'),_0x5ea2d6[_0xece2('0x29')],_0x11c133['id'],_0x229d2f['id']);}return;});}else{logger[_0xece2('0xa')](_0xece2('0x34'),_0x5ea2d6['uniqueid'],_0x11c133['id']);_0x26756f[_0x4a8f61]=_[_0xece2('0x2c')](_0x5ea2d6[_0xece2('0x17')])?_0x5ea2d6[_0xece2('0x19')]:_0x5ea2d6[_0xece2('0x18')];if(_['isNil'](_0x5ea2d6[_0xece2('0x17')])){_0x26756f[_0xece2('0x1a')]=_0x5ea2d6[_0xece2('0x2d')]&&_0x5ea2d6['calleridname']!==''?_0x5ea2d6[_0xece2('0x2d')]:_0xece2('0x2f');}else{_0x26756f['firstName']=_0x5ea2d6[_0xece2('0x30')]&&_0x5ea2d6['destcalleridname']!==_0xece2('0x2e')?_0x5ea2d6['destcalleridname']:_0xece2('0x2f');}_0x229d2f=_0x26756f;_0x333afa['push'](_0x26756f);return;}}})[_0xece2('0x22')](function(){if(_0x5e2f2a){emit(_0x5ea2d6[_0xece2('0x29')],_0x11c133,util[_0xece2('0x35')](_0xece2('0x36'),_0x5e2f2a[_0xece2('0x37')]),util[_0xece2('0x35')](_0xece2('0x38'),_0x34e72c[_0xece2('0x39')][_0xece2('0x3a')]()),{'evt':_[_0xece2('0x3b')](_0x5ea2d6,{'autoCreate':_0x3d327d}),'contact':_0x229d2f===undefined?{}:_0x229d2f,'contacts':_0x333afa[_0xece2('0x25')]===0x0?undefined:_0x333afa});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 12947d8..945e587 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 _0x7a12=['servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','salesforceAccounts','custom:agentcalled','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','syncCustomEvent','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:amd','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialconnect','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:acceptmessage','custom:rejectmessage','prototype','emit','stringify','clone','motionChannel','voice','checkTriggers','interface','hasOwnProperty','status','checkTrigger','variables','Actions','length','toLowerCase','browser','data1','TemplateId','data2','render','html','template\x20not\x20found','uri','buildUri','isNil','data4','uriLocation','data5','800','windowHeight','data6','600','winApplication','winArguments','data3','format','user:%s','trigger:%s:%s','merge','name','trigger:%s','action','contactmanager','exec','queue','routeId','urlforward','parse','query','search','replace','channel','AllConditions','every','checkConditions','AnyConditions','some','account','chat','ChatWebsiteId','value','upperFirst','AccountId','operator','interaction','message','event','agent','membername','lastevent','mailSubstatus','null','undefined','substatus','offlineMessage','created','equals','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts'];(function(_0x1a2434,_0x263c2f){var _0x265e7e=function(_0xe7742c){while(--_0xe7742c){_0x1a2434['push'](_0x1a2434['shift']());}};_0x265e7e(++_0x263c2f);}(_0x7a12,0xe8));var _0x27a1=function(_0x453c5b,_0x3003f9){_0x453c5b=_0x453c5b-0x0;var _0x5b043e=_0x7a12[_0x453c5b];return _0x5b043e;};'use strict';var util=require(_0x27a1('0x0'));var _=require(_0x27a1('0x1'));var url=require(_0x27a1('0x2'));var Mustache=require(_0x27a1('0x3'));var Redis=require(_0x27a1('0x4'));var urlforward=require(_0x27a1('0x5'));var integration=require(_0x27a1('0x6'));var cmContact=require(_0x27a1('0x7'));var script=require('./script');var config=require(_0x27a1('0x8'));var logger=require(_0x27a1('0x9'))(_0x27a1('0xa'));var ami=require(_0x27a1('0xb'));config[_0x27a1('0xc')]=_[_0x27a1('0xd')](config['redis'],{'host':_0x27a1('0xe'),'port':0x18eb});var io=require(_0x27a1('0xf'))(new Redis(config['redis']));var operators={'equals':function(_0x6872f5,_0x7b6a99){return _0x6872f5==_0x7b6a99;},'not_equals':function(_0x586984,_0x468277){return _0x586984!=_0x468277;}};var barAndWebActions=[_0x27a1('0x10'),_0x27a1('0x2'),'winapp'];function Trigger(_0x2cb05d){this[_0x27a1('0x11')]=_0x2cb05d[_0x27a1('0x11')];this[_0x27a1('0x12')]=_0x2cb05d[_0x27a1('0x12')];this[_0x27a1('0x13')]=_0x2cb05d[_0x27a1('0x13')];this['templates']=_0x2cb05d[_0x27a1('0x14')];this[_0x27a1('0x15')]=_0x2cb05d[_0x27a1('0x15')];this[_0x27a1('0x16')]=_0x2cb05d['zendeskAccounts'];this[_0x27a1('0x17')]=_0x2cb05d[_0x27a1('0x17')];this['salesforceAccounts']=_0x2cb05d['salesforceAccounts'];this[_0x27a1('0x18')]=_0x2cb05d[_0x27a1('0x18')];this['zohoAccounts']=_0x2cb05d[_0x27a1('0x19')];this[_0x27a1('0x1a')]=_0x2cb05d['deskAccounts'];this[_0x27a1('0x1b')]=_0x2cb05d[_0x27a1('0x1b')];this[_0x27a1('0x1c')]=_0x2cb05d[_0x27a1('0x1c')];this['dynamics365Accounts']=_0x2cb05d[_0x27a1('0x1d')];this['freshsalesAccounts']=_0x2cb05d[_0x27a1('0x1e')];this[_0x27a1('0x1f')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x27a1('0x20')],'freshdesk':this[_0x27a1('0x17')],'sugarcrm':this[_0x27a1('0x18')],'zoho':this[_0x27a1('0x19')],'desk':this['deskAccounts'],'vtiger':this[_0x27a1('0x1b')],'dynamics365':this[_0x27a1('0x1d')],'freshsales':this[_0x27a1('0x1e')],'servicenow':this[_0x27a1('0x1c')]};ami['on'](_0x27a1('0x21'),this['syncCustomEvent'][_0x27a1('0x22')](this));ami['on'](_0x27a1('0x23'),this['syncCustomEvent']['bind'](this));ami['on'](_0x27a1('0x24'),this['syncCustomEvent'][_0x27a1('0x22')](this));ami['on'](_0x27a1('0x25'),this[_0x27a1('0x26')][_0x27a1('0x22')](this));ami['on'](_0x27a1('0x27'),this[_0x27a1('0x26')]['bind'](this));ami['on'](_0x27a1('0x28'),this[_0x27a1('0x26')]['bind'](this));ami['on'](_0x27a1('0x29'),this['syncCustomEvent'][_0x27a1('0x22')](this));ami['on']('custom:agentcongestion',this[_0x27a1('0x26')][_0x27a1('0x22')](this));ami['on']('custom:agentreject',this[_0x27a1('0x26')][_0x27a1('0x22')](this));ami['on'](_0x27a1('0x2a'),this[_0x27a1('0x26')]['bind'](this));ami['on'](_0x27a1('0x2b'),this['syncCustomEvent'][_0x27a1('0x22')](this));ami['on'](_0x27a1('0x2c'),this[_0x27a1('0x26')][_0x27a1('0x22')](this));ami['on']('custom:dialbegin',this[_0x27a1('0x2d')][_0x27a1('0x22')](this));ami['on'](_0x27a1('0x2e'),this[_0x27a1('0x2d')][_0x27a1('0x22')](this));ami['on']('custom:dialend',this[_0x27a1('0x2d')]['bind'](this));ami['on'](_0x27a1('0x2f'),this[_0x27a1('0x26')]['bind'](this));ami['on'](_0x27a1('0x30'),this['syncCustomEvent'][_0x27a1('0x22')](this));ami['on'](_0x27a1('0x31'),this[_0x27a1('0x26')]['bind'](this));ami['on']('custom:incomingmessage',this[_0x27a1('0x26')]['bind'](this));ami['on']('custom:outgoingmessage',this[_0x27a1('0x26')][_0x27a1('0x22')](this));ami['on'](_0x27a1('0x32'),this[_0x27a1('0x26')][_0x27a1('0x22')](this));ami['on'](_0x27a1('0x33'),this[_0x27a1('0x26')][_0x27a1('0x22')](this));ami['on']('custom:offlineMessage',this['syncCustomEvent']['bind'](this));}Trigger[_0x27a1('0x34')][_0x27a1('0x35')]=function(_0x3ccd4c,_0x39ffad,_0x59b6fa){logger['info'](_0x3ccd4c,_0x39ffad,JSON[_0x27a1('0x36')](_0x59b6fa));io['to'](_0x3ccd4c)[_0x27a1('0x35')](_0x39ffad,_0x59b6fa);};Trigger[_0x27a1('0x34')][_0x27a1('0x26')]=function(_0xc5368f){var _0x6fe6c0=_[_0x27a1('0x37')](_0xc5368f);if(typeof _0x6fe6c0['motionChannel']==='undefined'){_0x6fe6c0[_0x27a1('0x38')]=_0x27a1('0x39');}this[_0x27a1('0x3a')](_0x6fe6c0);};Trigger['prototype'][_0x27a1('0x2d')]=function(_0x3114fd){if(this[_0x27a1('0x12')][_0x3114fd[_0x27a1('0x3b')]]){this['syncCustomEvent'](_0x3114fd);}};Trigger[_0x27a1('0x34')][_0x27a1('0x3a')]=function(_0x396020){var _0x10a2f5;for(var _0xe9707 in this[_0x27a1('0x11')]){if(this[_0x27a1('0x11')][_0x27a1('0x3c')](_0xe9707)){if(this[_0x27a1('0x11')][_0xe9707][_0x27a1('0x3d')]){_0x10a2f5=this[_0x27a1('0x3e')](this[_0x27a1('0x11')][_0xe9707],_0x396020);if(_0x10a2f5){_['merge'](_0x396020,_0x396020[_0x27a1('0x3f')]);for(var _0xdd65cf=0x0,_0x3252f8,_0x589258,_0x31763b;_0xdd65cf0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ No newline at end of file +var _0x814b=['calleridname','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','desk','redis','defaults','localhost','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','[HTTP]','%s:%s','authType','token','username','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','type','variableName','customVariable','Variable','name','priority','merge','getString','Subjects','xCALLY','CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','unmanaged','lastevent'];(function(_0x58eec4,_0x3da82c){var _0x596bd1=function(_0x590919){while(--_0x590919){_0x58eec4['push'](_0x58eec4['shift']());}};_0x596bd1(++_0x3da82c);}(_0x814b,0x1a2));var _0xb814=function(_0x33c70e,_0xd8cb0b){_0x33c70e=_0x33c70e-0x0;var _0x5a33e5=_0x814b[_0x33c70e];return _0x5a33e5;};'use strict';var _=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var md5=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var Redis=require(_0xb814('0x4'));var intUtil=require(_0xb814('0x5'));var config=require('../../../../config/environment');var logger=require(_0xb814('0x6'))(_0xb814('0x7'));config[_0xb814('0x8')]=_[_0xb814('0x9')](config[_0xb814('0x8')],{'host':_0xb814('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb814('0x8')]));function emit(_0x2e6272,_0x5c8539,_0x271af9){io['to'](_0x2e6272)[_0xb814('0xb')](_0x5c8539,_0x271af9);}var headers={'Content-Type':_0xb814('0xc'),'Accept':_0xb814('0xc')};function getUser(_0x1fea33,_0x21d4a5){if(intUtil[_0xb814('0xd')](_0x21d4a5)===!![]){logger[_0xb814('0xe')](_0xb814('0xf'),_0x21d4a5);return request({'uri':util[_0xb814('0x10')](_0xb814('0x11'),_0x1fea33['remoteUri'])})[_0xb814('0x12')](function(_0x56278f){if(_0x56278f[_0xb814('0x13')]){return _[_0xb814('0x14')](_0x56278f[_0xb814('0x15')][_0xb814('0x16')],{'email':_0x21d4a5});}})[_0xb814('0x12')](function(_0x3bde14){if(_0x3bde14){logger[_0xb814('0xe')](_0xb814('0x17'));return _0x3bde14;}else{logger[_0xb814('0xe')](_0xb814('0x18'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}});}else{logger[_0xb814('0xe')](_0xb814('0x1b'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x19'),_0x1fea33[_0xb814('0x1a')])});}}function request(_0x125ce2){logger[_0xb814('0x1c')](_0xb814('0x1d'),JSON['stringify'](_0x125ce2));return rp(_[_0xb814('0x9')](_0x125ce2,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x270598){var _0xfac75b;if(_0x270598['authType']==='basic'){_0xfac75b=util['format'](_0xb814('0x1e'),_0x270598['username'],_0x270598['password']);}else if(_0x270598[_0xb814('0x1f')]===_0xb814('0x20')){_0xfac75b=util[_0xb814('0x10')]('%s/token:%s',_0x270598[_0xb814('0x21')],_0x270598['token']);}return util[_0xb814('0x10')](_0xb814('0x22'),new Buffer(_0xfac75b)[_0xb814('0x23')](_0xb814('0x24')));}function getEndUser(_0x27352e,_0x2bd039,_0x1f5d40){logger['info'](_0xb814('0x25'),_0x1f5d40);return request({'uri':util['format'](_0xb814('0x26'),_0x27352e[_0xb814('0x1a')]),'qs':{'phone':_0x1f5d40}})[_0xb814('0x12')](function(_0x208927){if(_0x208927[_0xb814('0x13')]){logger[_0xb814('0xe')](_0xb814('0x27'));return _0x208927['_embedded'][_0xb814('0x16')][0x0];}else{logger[_0xb814('0xe')](_0xb814('0x28'));return request({'uri':util[_0xb814('0x10')](_0xb814('0x29'),_0x27352e[_0xb814('0x1a')]),'method':_0xb814('0x2a'),'body':{'first_name':_0x2bd039,'title':_0x2bd039,'phone_numbers':[{'type':_0xb814('0x2b'),'value':_0x1f5d40}]}});}});}function getTags(_0x5a6291,_0x271aa8){var _0x328a08=[];if(_0x5a6291&&_0x5a6291['length']>0x0){_0x328a08=_[_0xb814('0x2c')](_0x5a6291,_0x271aa8);}return _0x328a08;}function getCustomFields(_0x37d24d,_0x530744){var _0x499f22=[];var _0x20577b={'custom_fields':{}};if(_0x37d24d[_0xb814('0x2d')]>0x0){_['forEach'](_0x37d24d,function(_0x338a28){if(_['includes']([_0xb814('0x2e'),'picklist'],_0x338a28['type'])&&_0x338a28[_0xb814('0x2f')]&&!_0x338a28['customField']){_0x20577b[_0x338a28[_0xb814('0x2f')][_0xb814('0x30')]()]=_0x338a28[_0xb814('0x31')]['toString']();}else if(_['includes']([_0xb814('0x2e'),_0xb814('0x32')],_0x338a28['type'])&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x338a28[_0xb814('0x31')][_0xb814('0x23')]();}else if(_0x338a28[_0xb814('0x36')]==='variable'&&_0x338a28[_0xb814('0x37')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28[_0xb814('0x34')]){_0x530744[_0x338a28[_0xb814('0x37')]]&&(_0x20577b[_0xb814('0x35')][_0x338a28['idField']]=_0x530744[_0x338a28[_0xb814('0x37')]]['toString']());}else if(_0x338a28[_0xb814('0x36')]===_0xb814('0x38')&&_0x338a28[_0xb814('0x39')]&&_0x338a28['Variable'][_0xb814('0x3a')]&&_0x338a28[_0xb814('0x33')]&&_0x338a28['customField']){_0x530744[_0x338a28[_0xb814('0x39')][_0xb814('0x3a')][_0xb814('0x30')]()]&&(_0x20577b[_0xb814('0x35')][_0x338a28[_0xb814('0x33')]]=_0x530744[_0x338a28[_0xb814('0x39')]['name'][_0xb814('0x30')]()]['toString']());}});}if(_0x20577b[_0xb814('0x3b')]){_0x20577b['priority']=Number(_0x20577b[_0xb814('0x3b')]);}return _0x20577b;}function getTicket(_0x4b9233,_0x2f8a2e,_0x26675a,_0x54a7fb,_0x4d308a){logger['info']('Creating\x20new\x20ticket...');var _0x17549e=_[_0xb814('0x3c')]({'subject':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x3e')],_0x4d308a,'\x20'),'type':'phone','status':'new','labels':[_0xb814('0x3f'),'Motion',_0xb814('0x40')][_0xb814('0x41')](getTags(_0x54a7fb[_0xb814('0x42')],_0xb814('0x3a'))),'description':intUtil[_0xb814('0x3d')](_0x54a7fb[_0xb814('0x43')],_0x4d308a,'\x0a'),'_links':{'assigned_user':{'href':util[_0xb814('0x10')](_0xb814('0x44'),_0x2f8a2e['id']),'class':_0xb814('0x45')}},'message':{'direction':'in','body':intUtil['getString'](_0x54a7fb['Descriptions'],_0x4d308a,'\x0a')}},getCustomFields(_0x54a7fb['Fields'],_0x4d308a));return request({'uri':util[_0xb814('0x10')]('%s/customers/%d/cases',_0x4b9233[_0xb814('0x1a')],_0x26675a['id']),'method':'POST','body':_0x17549e});}exports[_0xb814('0x46')]=function(_0x44ff56,_0x9ef639,_0x2e97cc,_0x4fae23,_0x30fc57,_0x15f01a){var _0x2b23c7,_0x22cf27;_0x15f01a[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x15f01a['remoteUri']);_0x15f01a[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x15f01a[_0xb814('0x48')]);if(_0x30fc57&&_0x30fc57[_0xb814('0x49')]){logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x4b'));_0x9ef639['recordingURL']=util['format'](_0xb814('0x4c'),_0x15f01a[_0xb814('0x48')],_0x9ef639[_0xb814('0x4d')],md5(_0x9ef639[_0xb814('0x4d')]));}else{_0x9ef639[_0xb814('0x4e')]='';}headers[_0xb814('0x4f')]=getAuth(_0x15f01a);return getUser(_0x15f01a,_0x4fae23[_0xb814('0x50')])[_0xb814('0x12')](function(_0x2eb9b6){_0x2b23c7=_0x2eb9b6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x2b23c7['id']);return getEndUser(_0x15f01a,_0x9ef639['calleridname'],_0x9ef639[_0xb814('0x52')]);})[_0xb814('0x12')](function(_0x4a76bb){_0x22cf27=_0x4a76bb;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x22cf27['id']);return getTicket(_0x15f01a,_0x2b23c7,_0x22cf27,_0x2e97cc,_0x9ef639);})[_0xb814('0x12')](function(_0x37866f){if(_0x37866f){logger[_0xb814('0xe')](_0xb814('0x53'));logger[_0xb814('0xe')](_0xb814('0x54'),_0x37866f['id']);switch(_0x15f01a[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0x37866f['id']});break;case _0xb814('0x58'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util['format'](_0xb814('0x56'),_0x4fae23[_0xb814('0x3a')]),_0xb814('0x5a'),{'uri':util['format'](_0xb814('0x5b'),_0x37866f['id'])});break;default:logger['error'](_0xb814('0x4a'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x3cf8f8){console['error'](_0x3cf8f8);logger[_0xb814('0x5d')](_0xb814('0x4a'),JSON[_0xb814('0x5e')](_0x3cf8f8));});};exports['outbound']=function(_0x3da050,_0x5f0e58,_0x13bdcf,_0x158893,_0x4aed78,_0x39952d,_0x4a3f84){var _0x539be7,_0x3b9709;_0x39952d[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x39952d['remoteUri']);_0x39952d[_0xb814('0x48')]=intUtil['stripTrailingSlash'](_0x39952d[_0xb814('0x48')]);if(_0x4a3f84&&_0x4a3f84[_0xb814('0x5f')]&&_0x4a3f84['recordingFormat']!==_0xb814('0x60')){logger['info'](_0xb814('0x61'),_0xb814('0x4b'));_0x5f0e58[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x39952d[_0xb814('0x48')],_0x5f0e58[_0xb814('0x4d')],md5(_0x5f0e58[_0xb814('0x4d')]));}headers['Authorization']=getAuth(_0x39952d);return getUser(_0x39952d,_0x158893[_0xb814('0x50')])[_0xb814('0x12')](function(_0x5d71d5){_0x539be7=_0x5d71d5;logger[_0xb814('0xe')](_0xb814('0x51'),_0x539be7['id']);return getEndUser(_0x39952d,_0x5f0e58['destcalleridname'],_0x5f0e58[_0xb814('0x62')]);})['then'](function(_0x48362c){_0x3b9709=_0x48362c;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x3b9709['id']);return getTicket(_0x39952d,_0x539be7,_0x3b9709,_0x13bdcf,_0x5f0e58);})[_0xb814('0x12')](function(_0xd1cd8b){if(_0xd1cd8b){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')]('The\x20Ticket\x20ID\x20is:',_0xd1cd8b['id']);switch(_0x39952d[_0xb814('0x36')]){case _0xb814('0x55'):logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x63'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),_0xb814('0x57'),{'recordId':_0xd1cd8b['id']});break;case'newTab':logger[_0xb814('0xe')](_0xb814('0x4a'),_0xb814('0x59'));emit(util[_0xb814('0x10')](_0xb814('0x56'),_0x158893[_0xb814('0x3a')]),'trigger:browser:url',{'uri':util[_0xb814('0x10')]('%s/agent/tickets/%s',_0x39952d[_0xb814('0x1a')],_0xd1cd8b['id'])});break;default:logger[_0xb814('0x5d')](_0xb814('0x61'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xb814('0x5c')](function(_0x579351){logger[_0xb814('0x5d')]('[OUTBOUND]',JSON[_0xb814('0x5e')](_0x579351));});};exports[_0xb814('0x64')]=function(_0xa03cd2,_0x1b024f,_0x3377d4,_0x167d82,_0x143518,_0x4d44e3){var _0x44088d,_0x51ca51;_0x4d44e3[_0xb814('0x1a')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x1a')]);_0x4d44e3[_0xb814('0x48')]=intUtil[_0xb814('0x47')](_0x4d44e3[_0xb814('0x48')]);if(_0x143518&&_0x143518['monitor_format']){logger[_0xb814('0xe')]('['+_0x1b024f[_0xb814('0x65')]['toUpperCase']()+']',_0xb814('0x4b'));_0x1b024f[_0xb814('0x4e')]=util[_0xb814('0x10')](_0xb814('0x4c'),_0x4d44e3[_0xb814('0x48')],_0x1b024f['uniqueid'],md5(_0x1b024f[_0xb814('0x4d')]));}else{_0x1b024f['recordingURL']='';}headers[_0xb814('0x4f')]=getAuth(_0x4d44e3);return getUser(_0x4d44e3)[_0xb814('0x12')](function(_0x2645f6){_0x44088d=_0x2645f6;logger[_0xb814('0xe')](_0xb814('0x51'),_0x44088d['id']);return getEndUser(_0x4d44e3,_0x1b024f[_0xb814('0x66')],_0x1b024f['calleridnum']);})['then'](function(_0x5d064b){_0x51ca51=_0x5d064b;logger[_0xb814('0xe')]('The\x20Enduser\x20ID\x20is:',_0x51ca51['id']);return getTicket(_0x4d44e3,_0x44088d,_0x51ca51,_0x3377d4,_0x1b024f);})[_0xb814('0x12')](function(_0x1d3954){if(_0x1d3954){logger[_0xb814('0xe')]('Ticket\x20created!');logger[_0xb814('0xe')](_0xb814('0x54'),_0x1d3954['id']);}})[_0xb814('0x5c')](function(_0x5aabbe){logger[_0xb814('0x5d')]('['+_0x1b024f[_0xb814('0x65')][_0xb814('0x67')]()+']',JSON[_0xb814('0x5e')](_0x5aabbe));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 47286b2..2d966ff 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 _0x1b61=['uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','tenantId','data2','resolve','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','value','isNil','email','userEmail','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','userId','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','POST','contacts','headers','odata-entityid','substring','lastIndexOf','enduserId','calleridnum','telephone1','\x20eq\x20\x27','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','type','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','/contacts(','Fields','phonecall','/systemusers(','queue','callDirection','Descriptions','format','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token'];(function(_0x228bc1,_0x166057){var _0x2a1bf9=function(_0x4bf923){while(--_0x4bf923){_0x228bc1['push'](_0x228bc1['shift']());}};_0x2a1bf9(++_0x166057);}(_0x1b61,0x1bf));var _0x11b6=function(_0x3a7c58,_0x5ac5c3){_0x3a7c58=_0x3a7c58-0x0;var _0x351369=_0x1b61[_0x3a7c58];return _0x351369;};'use strict';var _=require(_0x11b6('0x0'));var rp=require('request-promise');var util=require(_0x11b6('0x1'));var intUtil=require(_0x11b6('0x2'));var md5=require(_0x11b6('0x3'));var Redis=require(_0x11b6('0x4'));var logger=require(_0x11b6('0x5'))('dynamics365');var config=require(_0x11b6('0x6'));config[_0x11b6('0x7')]=_[_0x11b6('0x8')](config[_0x11b6('0x7')],{'host':_0x11b6('0x9'),'port':0x18eb});var io=require(_0x11b6('0xa'))(new Redis(config[_0x11b6('0x7')]));function getAuthToken(_0x1b5ed1,_0x1b3412,_0x5816db){if(_0x1b5ed1[_0x11b6('0xb')]){_0x1b5ed1['remoteUri']=_0x1b5ed1[_0x11b6('0xc')][_0x11b6('0xd')];_0x1b5ed1[_0x11b6('0xe')]=_0x1b5ed1[_0x11b6('0xc')][_0x11b6('0xf')];return Promise[_0x11b6('0x10')](_0x1b5ed1[_0x11b6('0xc')]['data5']);}var _0x2933c7={'method':'POST','uri':_0x1b3412,'form':{'client_id':_0x1b5ed1[_0x11b6('0x11')],'resource':_0x1b5ed1[_0x11b6('0x12')],'username':_0x1b5ed1[_0x11b6('0x13')],'password':_0x1b5ed1[_0x11b6('0x14')],'grant_type':_0x11b6('0x14'),'client_secret':_0x1b5ed1[_0x11b6('0x15')]},'json':!![]};return rp(_0x2933c7)[_0x11b6('0x16')](function(_0xdbaf53){return _0xdbaf53[_0x11b6('0x17')];})[_0x11b6('0x18')](function(_0x1ed1f6){logger[_0x11b6('0x19')]('['+[_0x5816db[_0x11b6('0x1a')]()]+_0x11b6('0x1b'));return _0x1ed1f6[_0x11b6('0x1c')];});}function getUser(_0x11b25c,_0x117b30,_0x62eb8,_0x495b40,_0x55897b,_0x559390){return new Promise(function(_0x11cae1,_0x3011c0){return getAuthToken(_0x117b30,_0x495b40,_0x559390)[_0x11b6('0x16')](function(_0x3d31d4){var _0x404781={'method':_0x11b6('0x1d'),'uri':_0x55897b+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x11b6('0x1e')+_0x3d31d4,'OData-Version':_0x11b6('0x1f')},'json':!![]};return rp(_0x404781);})['then'](function(_0x2b77c1){var _0x1712d1=_0x2b77c1[_0x11b6('0x20')];var _0x2d7c23=![];var _0x5c1303=null;if(!_[_0x11b6('0x21')](_0x62eb8)){if(intUtil['validateEmail'](_0x62eb8[_0x11b6('0x22')])){_0x11b25c[_0x11b6('0x23')]=_0x62eb8[_0x11b6('0x22')];for(_0x5c1303=0x0;_0x5c1303<_0x1712d1[_0x11b6('0x24')];_0x5c1303++){if(_0x1712d1[_0x5c1303][_0x11b6('0x25')]===_0x62eb8[_0x11b6('0x22')]&&!_0x1712d1[_0x5c1303][_0x11b6('0x26')]){_0x2d7c23=!![];logger['info']('['+[_0x559390[_0x11b6('0x1a')]()]+_0x11b6('0x27')+_0x1712d1[_0x5c1303]['systemuserid']+'!');_0x11b25c[_0x11b6('0x28')]=_0x1712d1[_0x5c1303][_0x11b6('0x29')];}}}}if(!_0x2d7c23){logger[_0x11b6('0x2a')]('['+[_0x559390['toUpperCase']()]+_0x11b6('0x2b'));_0x11b25c[_0x11b6('0x23')]=_0x117b30[_0x11b6('0x13')];for(_0x5c1303=0x0;_0x5c1303<_0x1712d1[_0x11b6('0x24')];_0x5c1303++){if(_0x1712d1[_0x5c1303]['internalemailaddress']===_0x117b30[_0x11b6('0x13')]){_0x11b25c[_0x11b6('0x28')]=_0x1712d1[_0x5c1303][_0x11b6('0x29')];}}}_0x11cae1(_0x11b25c);})[_0x11b6('0x18')](function(_0x5145aa){_0x3011c0(_0x5145aa['message']);});});}function createEndUser(_0x32c55c,_0x583f7c,_0x4ed014,_0x41963c,_0x2587a7,_0x44a99f,_0x467b36){return new Promise(function(_0x37b12d,_0x4710b7){return getAuthToken(_0x583f7c,_0x4ed014,_0x44a99f)[_0x11b6('0x16')](function(_0xe0b546){var _0x42fdc4=_0x44a99f[_0x11b6('0x2c')]()===_0x11b6('0x2d')?_0x2587a7['destcalleridnum']:_0x2587a7['calleridnum'];var _0x4cf360={'method':_0x11b6('0x2e'),'uri':_0x41963c+_0x11b6('0x2f'),'body':{'fullname':_0x42fdc4,'firstname':_0x42fdc4,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x32c55c[_0x11b6('0x28')]+')'},'headers':{'Authorization':_0x11b6('0x1e')+_0xe0b546,'OData-Version':_0x11b6('0x1f')},'json':!![],'resolveWithFullResponse':!![]};_0x4cf360['body'][_0x467b36]=_0x42fdc4;return rp(_0x4cf360);})[_0x11b6('0x16')](function(_0x45a0fd){var _0x13e683=_0x45a0fd[_0x11b6('0x30')][_0x11b6('0x31')];var _0xeb5f62=_0x13e683[_0x11b6('0x32')](_0x13e683['lastIndexOf']('(')+0x1,_0x13e683[_0x11b6('0x33')](')'));_0x32c55c[_0x11b6('0x34')]=_0xeb5f62;_0x37b12d(_0x32c55c);})['catch'](function(_0xa340f9){_0x4710b7(_0xa340f9[_0x11b6('0x1c')]);});});}function getEndUser(_0x34b060,_0x2e28d1,_0x3d64a8,_0x509729,_0x541197,_0x156454,_0x528fdd,_0x3c854b){var _0x229fcd=_0x156454[_0x11b6('0x2c')]()==='outbound'?_0x541197['destcalleridnum']:_0x541197[_0x11b6('0x35')];return getAuthToken(_0x2e28d1,_0x3d64a8,_0x156454)[_0x11b6('0x16')](function(_0x5b0cd4){_0x3c854b=_0x3c854b?_0x3c854b:_0x11b6('0x36');var _0x10b26c={'method':_0x11b6('0x1d'),'uri':_0x509729+'contacts?$select='+_0x3c854b+'&$filter='+_0x3c854b+_0x11b6('0x37')+_0x229fcd['replace']('+',_0x11b6('0x38'))+'\x27','headers':{'Authorization':_0x11b6('0x1e')+_0x5b0cd4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x10b26c);})[_0x11b6('0x16')](function(_0x6e5be9){var _0x54436d=![];if(!_0x6e5be9)return _0x54436d;var _0x21520d=_0x6e5be9[_0x11b6('0x20')];for(var _0x44d300=0x0;_0x44d300<_0x21520d[_0x11b6('0x24')];_0x44d300++){if(_0x21520d[_0x44d300][_0x3c854b]===_0x229fcd){_0x54436d=!![];_0x34b060[_0x11b6('0x34')]=_0x21520d[_0x44d300][_0x11b6('0x39')];}}return _0x54436d;})['then'](function(_0x5b7f62){if(_0x5b7f62)return _0x34b060;if(_0x528fdd===_0x11b6('0x3a')){logger['info']('['+[_0x156454[_0x11b6('0x1a')]()]+_0x11b6('0x3b'));return _0x34b060;}return createEndUser(_0x34b060,_0x2e28d1,_0x3d64a8,_0x509729,_0x541197,_0x156454,_0x3c854b)[_0x11b6('0x16')](function(_0x810c1a){logger['info']('['+[_0x156454[_0x11b6('0x1a')]()]+_0x11b6('0x3c'),_0x810c1a[_0x11b6('0x34')]);return _0x810c1a;});});}function getCustomFields(_0x2255ff,_0x5a4dc8,_0x312810){var _0x227330={};if(_0x2255ff[_0x11b6('0x24')]>0x0){_[_0x11b6('0x3d')](_0x2255ff,function(_0x3871de){if(_['includes']([_0x11b6('0x3e'),'picklist'],_0x3871de[_0x11b6('0x3f')])&&_0x3871de['nameField']&&!_0x3871de['customField']){var _0x15aa9a=_0x3871de[_0x11b6('0x40')][_0x11b6('0x2c')]();var _0x35fde9=_0x15aa9a[_0x11b6('0x32')](0x0,_0x15aa9a[_0x11b6('0x41')]('_'));var _0x4260be=_0x15aa9a[_0x11b6('0x32')](_0x15aa9a[_0x11b6('0x41')]('_')+0x1);if(_0x35fde9===_0x312810){_0x227330[_0x4260be]=_0x3871de[_0x11b6('0x42')];}}});}return _0x227330;}function getTicket(_0x4cadb1,_0x5a819c,_0x2f241a,_0x44e67e,_0x87b541,_0x51e5d2,_0x5f102c){return new Promise(function(_0x4d26e1,_0x496231){var _0x221e1c;return getAuthToken(_0x5a819c,_0x2f241a,_0x5f102c)[_0x11b6('0x16')](function(_0x4fbe82){if(_0x51e5d2[_0x11b6('0x43')]===_0x11b6('0x44')){_0x221e1c={'method':_0x11b6('0x2e'),'uri':_0x44e67e+_0x11b6('0x45'),'body':Object[_0x11b6('0x46')]({},{'title':intUtil[_0x11b6('0x47')](_0x51e5d2[_0x11b6('0x48')],_0x87b541,'\x20'),'description':intUtil['getString'](_0x51e5d2['Descriptions'],_0x87b541,'\x0a'),'customerid_contact@odata.bind':_0x4cadb1[_0x11b6('0x34')]?_0x11b6('0x49')+_0x4cadb1[_0x11b6('0x34')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x4cadb1[_0x11b6('0x28')]+')','caseorigincode':'1'},getCustomFields(_0x51e5d2[_0x11b6('0x4a')],_0x87b541,_0x51e5d2['ticketType'])),'headers':{'Authorization':_0x11b6('0x1e')+_0x4fbe82,'OData-Version':_0x11b6('0x1f')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x51e5d2['ticketType']===_0x11b6('0x4b')){var _0x455019=_0x4cadb1['enduserId']?[{'partyid_systemuser@odata.bind':_0x11b6('0x4c')+_0x4cadb1['userId']+')','participationtypemask':_0x4cadb1['callDirection']===_0x11b6('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x4cadb1[_0x11b6('0x34')]+')','participationtypemask':_0x4cadb1[_0x11b6('0x4e')]===_0x11b6('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x11b6('0x4c')+_0x4cadb1[_0x11b6('0x28')]+')','participationtypemask':_0x4cadb1[_0x11b6('0x4e')]===_0x11b6('0x4d')?0x2:0x1}];_0x221e1c={'method':_0x11b6('0x2e'),'uri':_0x44e67e+'phonecalls','body':Object[_0x11b6('0x46')]({},{'subject':intUtil[_0x11b6('0x47')](_0x51e5d2[_0x11b6('0x48')],_0x87b541,'\x20'),'phonenumber':String(_0x87b541[_0x11b6('0x35')]),'description':intUtil[_0x11b6('0x47')](_0x51e5d2[_0x11b6('0x4f')],_0x87b541,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4cadb1[_0x11b6('0x34')]?_0x11b6('0x49')+_0x4cadb1[_0x11b6('0x34')]+')':undefined,'ownerid@odata.bind':_0x11b6('0x4c')+_0x4cadb1[_0x11b6('0x28')]+')','directioncode':_0x4cadb1['callDirection']===_0x11b6('0x4d')?![]:!![],'phonecall_activity_parties':_0x455019},getCustomFields(_0x51e5d2[_0x11b6('0x4a')],_0x87b541,_0x51e5d2[_0x11b6('0x43')])),'headers':{'Authorization':_0x11b6('0x1e')+_0x4fbe82,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x221e1c);})[_0x11b6('0x16')](function(_0x5209c9){var _0x5d9869=_0x5209c9[_0x11b6('0x30')][_0x11b6('0x31')];var _0x3f1c66=_0x5d9869[_0x11b6('0x32')](_0x5d9869[_0x11b6('0x33')]('(')+0x1,_0x5d9869[_0x11b6('0x33')](')'));_0x4cadb1['ticketId']=_0x3f1c66;_0x4d26e1(_0x4cadb1);})[_0x11b6('0x18')](function(_0x270d8e){_0x496231(_0x270d8e[_0x11b6('0x1c')]);});});}function emit(_0x30b2c7,_0x3f7a68,_0x1cdb37,_0x37a9b2){var _0x10717a={'uri':util[_0x11b6('0x50')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x30b2c7,_0x1cdb37,_0x37a9b2)};io['to'](util[_0x11b6('0x50')](_0x11b6('0x51'),_0x3f7a68))['emit'](_0x11b6('0x52'),_0x10717a);}exports['cs']=function(_0x23957f,_0x7fc244,_0x387394,_0x513d52,_0x243d1b,_0x7a365e,_0x36c610,_0x138102){var _0x4b0ef0={};_0x7a365e[_0x11b6('0x12')]=_0x7a365e[_0x11b6('0xb')]?intUtil[_0x11b6('0x53')](_0x7a365e[_0x11b6('0xc')][_0x11b6('0xd')]):intUtil[_0x11b6('0x53')](_0x7a365e[_0x11b6('0x12')]);_0x7a365e[_0x11b6('0x54')]=intUtil[_0x11b6('0x53')](_0x7a365e[_0x11b6('0x54')]);_0x4b0ef0[_0x11b6('0x4e')]=_0x138102===_0x11b6('0x4d')||_0x138102===_0x11b6('0x55')?_0x11b6('0x4d'):'outbound';var _0x8622b1=_0x7a365e[_0x11b6('0xb')]?util[_0x11b6('0x50')](_0x11b6('0x56'),_0x7a365e[_0x11b6('0xc')][_0x11b6('0xd')]):util[_0x11b6('0x50')](_0x11b6('0x56'),_0x7a365e[_0x11b6('0x12')]);var _0x4d5614=util['format'](_0x11b6('0x57'),_0x7a365e[_0x11b6('0xe')]);var _0x5872a2=util[_0x11b6('0x50')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x7a365e[_0x11b6('0x54')],_0x7fc244['uniqueid'],md5(_0x7fc244[_0x11b6('0x58')]));if(_0x243d1b&&_0x243d1b[_0x11b6('0x59')]){logger['info']('[QUEUE]',_0x11b6('0x5a'));_0x7fc244[_0x11b6('0x5b')]=_0x5872a2;}else if(_0x36c610&&_0x36c610[_0x11b6('0x5c')]&&_0x36c610['recordingFormat']!==_0x11b6('0x5d')){logger[_0x11b6('0x2a')](_0x11b6('0x5e'),_0x11b6('0x5a'));_0x7fc244['recordingURL']=_0x5872a2;}else{_0x7fc244[_0x11b6('0x5b')]='';}return getUser(_0x4b0ef0,_0x7a365e,_0x513d52,_0x4d5614,_0x8622b1,_0x138102)['then'](function(_0x223e90){logger[_0x11b6('0x2a')]('['+_0x138102[_0x11b6('0x1a')]()+_0x11b6('0x5f'),_0x223e90[_0x11b6('0x28')]);logger[_0x11b6('0x2a')]('['+_0x138102['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x223e90[_0x11b6('0x23')]);return getEndUser(_0x223e90,_0x7a365e,_0x4d5614,_0x8622b1,_0x7fc244,_0x138102,_0x387394[_0x11b6('0x60')],_0x387394[_0x11b6('0x61')]);})[_0x11b6('0x16')](function(_0x2d6b08){logger[_0x11b6('0x2a')]('['+_0x138102[_0x11b6('0x1a')]()+_0x11b6('0x62'),_0x2d6b08[_0x11b6('0x34')]);logger[_0x11b6('0x2a')]('['+_0x138102[_0x11b6('0x1a')]()+_0x11b6('0x63'),_0x7fc244['calleridnum']);return getTicket(_0x2d6b08,_0x7a365e,_0x4d5614,_0x8622b1,_0x7fc244,_0x387394,_0x138102);})['then'](function(_0x2005c0){logger[_0x11b6('0x2a')](util[_0x11b6('0x50')]('['+_0x138102[_0x11b6('0x1a')]()+_0x11b6('0x64'),_0x387394[_0x11b6('0x43')],_0x2005c0[_0x11b6('0x65')]));logger[_0x11b6('0x2a')](util[_0x11b6('0x50')]('['+_0x138102[_0x11b6('0x1a')]()+_0x11b6('0x66'),_0x138102));if(_0x138102!==_0x11b6('0x55')&&_0x387394[_0x11b6('0x67')]){logger[_0x11b6('0x2a')]('['+_0x138102[_0x11b6('0x1a')]()+']',_0x11b6('0x68'));emit(_0x7a365e[_0x11b6('0x12')],_0x513d52['name'],_0x387394[_0x11b6('0x43')],_0x2005c0[_0x11b6('0x65')]);}})[_0x11b6('0x18')](function(_0x1c3f8a){logger[_0x11b6('0x19')]('['+_0x138102[_0x11b6('0x1a')]()+_0x11b6('0x69'),_0x1c3f8a[_0x11b6('0x1c')]);console[_0x11b6('0x19')](_0x11b6('0x6a'),_0x1c3f8a);});}; \ No newline at end of file +var _0x51b2=['monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','util','md5','dynamics365','../../../../config/environment','defaults','redis','socket.io-emitter','remoteUri','data7','tenantId','CloudProvider','data2','resolve','data5','clientId','username','then','access_token','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','email','userEmail','length','internalemailaddress','isdisabled','info','systemuserid','userId','toUpperCase',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','body','headers','odata-entityid','substring','lastIndexOf','telephone1','contacts?$select=','&$filter=','replace','%2b','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','type','nameField','customField','idField','indexOf','incident','POST','incidents','assign','Subjects','Descriptions','/contacts(','/systemusers(','Fields','ticketType','callDirection','queue','phonecalls','getString','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','modernAuthentication','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0xff2477,_0x57e159){var _0x6b0931=function(_0x5731ff){while(--_0x5731ff){_0xff2477['push'](_0xff2477['shift']());}};_0x6b0931(++_0x57e159);}(_0x51b2,0xec));var _0x251b=function(_0x22490e,_0x4935bd){_0x22490e=_0x22490e-0x0;var _0x5b6459=_0x51b2[_0x22490e];return _0x5b6459;};'use strict';var _=require(_0x251b('0x0'));var rp=require('request-promise');var util=require(_0x251b('0x1'));var intUtil=require('./util');var md5=require(_0x251b('0x2'));var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0x251b('0x3'));var config=require(_0x251b('0x4'));config['redis']=_[_0x251b('0x5')](config[_0x251b('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x251b('0x7'))(new Redis(config[_0x251b('0x6')]));function getAuthToken(_0x5588d2,_0x2789f5,_0xbc21a4){if(_0x5588d2['modernAuthentication']){_0x5588d2[_0x251b('0x8')]=_0x5588d2['CloudProvider'][_0x251b('0x9')];_0x5588d2[_0x251b('0xa')]=_0x5588d2[_0x251b('0xb')][_0x251b('0xc')];return Promise[_0x251b('0xd')](_0x5588d2[_0x251b('0xb')][_0x251b('0xe')]);}var _0x1f5b04={'method':'POST','uri':_0x2789f5,'form':{'client_id':_0x5588d2[_0x251b('0xf')],'resource':_0x5588d2[_0x251b('0x8')],'username':_0x5588d2[_0x251b('0x10')],'password':_0x5588d2['password'],'grant_type':'password','client_secret':_0x5588d2['clientSecret']},'json':!![]};return rp(_0x1f5b04)[_0x251b('0x11')](function(_0x5eb80f){return _0x5eb80f[_0x251b('0x12')];})['catch'](function(_0x51d73c){logger[_0x251b('0x13')]('['+[_0xbc21a4['toUpperCase']()]+_0x251b('0x14'));return _0x51d73c[_0x251b('0x15')];});}function getUser(_0x15a6f3,_0x6028,_0x244f39,_0x1174a8,_0x19db13,_0x19080d){return new Promise(function(_0x1f43bd,_0x513a8e){return getAuthToken(_0x6028,_0x1174a8,_0x19080d)[_0x251b('0x11')](function(_0x58712c){var _0x5e41e9={'method':_0x251b('0x16'),'uri':_0x19db13+_0x251b('0x17'),'headers':{'Authorization':_0x251b('0x18')+_0x58712c,'OData-Version':_0x251b('0x19')},'json':!![]};return rp(_0x5e41e9);})[_0x251b('0x11')](function(_0x2e0e8f){var _0x262528=_0x2e0e8f[_0x251b('0x1a')];var _0x47a450=![];var _0x483a57=null;if(!_['isNil'](_0x244f39)){if(intUtil['validateEmail'](_0x244f39[_0x251b('0x1b')])){_0x15a6f3[_0x251b('0x1c')]=_0x244f39[_0x251b('0x1b')];for(_0x483a57=0x0;_0x483a57<_0x262528[_0x251b('0x1d')];_0x483a57++){if(_0x262528[_0x483a57][_0x251b('0x1e')]===_0x244f39[_0x251b('0x1b')]&&!_0x262528[_0x483a57][_0x251b('0x1f')]){_0x47a450=!![];logger[_0x251b('0x20')]('['+[_0x19080d['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x262528[_0x483a57][_0x251b('0x21')]+'!');_0x15a6f3[_0x251b('0x22')]=_0x262528[_0x483a57]['systemuserid'];}}}}if(!_0x47a450){logger[_0x251b('0x20')]('['+[_0x19080d[_0x251b('0x23')]()]+_0x251b('0x24'));_0x15a6f3[_0x251b('0x1c')]=_0x6028[_0x251b('0x10')];for(_0x483a57=0x0;_0x483a57<_0x262528[_0x251b('0x1d')];_0x483a57++){if(_0x262528[_0x483a57][_0x251b('0x1e')]===_0x6028['username']){_0x15a6f3[_0x251b('0x22')]=_0x262528[_0x483a57]['systemuserid'];}}}_0x1f43bd(_0x15a6f3);})[_0x251b('0x25')](function(_0x571336){_0x513a8e(_0x571336[_0x251b('0x15')]);});});}function createEndUser(_0x28926b,_0x1ac872,_0x198447,_0xb8b4f1,_0x3b245f,_0x4c1f87,_0x1fd793){return new Promise(function(_0x56d82f,_0x501407){return getAuthToken(_0x1ac872,_0x198447,_0x4c1f87)[_0x251b('0x11')](function(_0x188aee){var _0x46b7d9=_0x4c1f87[_0x251b('0x26')]()===_0x251b('0x27')?_0x3b245f[_0x251b('0x28')]:_0x3b245f[_0x251b('0x29')];var _0x5e4b70={'method':'POST','uri':_0xb8b4f1+_0x251b('0x2a'),'body':{'fullname':_0x46b7d9,'firstname':_0x46b7d9,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x28926b['userId']+')'},'headers':{'Authorization':_0x251b('0x18')+_0x188aee,'OData-Version':_0x251b('0x19')},'json':!![],'resolveWithFullResponse':!![]};_0x5e4b70[_0x251b('0x2b')][_0x1fd793]=_0x46b7d9;return rp(_0x5e4b70);})[_0x251b('0x11')](function(_0x536946){var _0x2b83ab=_0x536946[_0x251b('0x2c')][_0x251b('0x2d')];var _0x3738fc=_0x2b83ab[_0x251b('0x2e')](_0x2b83ab['lastIndexOf']('(')+0x1,_0x2b83ab[_0x251b('0x2f')](')'));_0x28926b['enduserId']=_0x3738fc;_0x56d82f(_0x28926b);})[_0x251b('0x25')](function(_0x58c00f){_0x501407(_0x58c00f[_0x251b('0x15')]);});});}function getEndUser(_0x48616f,_0x3dc99f,_0x19a1e1,_0x437c34,_0x3e09de,_0x1f8c74,_0xf7baeb,_0x469a8a){var _0x4e17ad=_0x1f8c74[_0x251b('0x26')]()===_0x251b('0x27')?_0x3e09de[_0x251b('0x28')]:_0x3e09de[_0x251b('0x29')];return getAuthToken(_0x3dc99f,_0x19a1e1,_0x1f8c74)[_0x251b('0x11')](function(_0x99c667){_0x469a8a=_0x469a8a?_0x469a8a:_0x251b('0x30');var _0x18c01f={'method':_0x251b('0x16'),'uri':_0x437c34+_0x251b('0x31')+_0x469a8a+_0x251b('0x32')+_0x469a8a+'\x20eq\x20\x27'+_0x4e17ad[_0x251b('0x33')]('+',_0x251b('0x34'))+'\x27','headers':{'Authorization':_0x251b('0x18')+_0x99c667,'If-None-Match':null,'OData-Version':_0x251b('0x19')},'json':!![]};return rp(_0x18c01f);})[_0x251b('0x11')](function(_0x26029c){var _0x21e95c=![];if(!_0x26029c)return _0x21e95c;var _0x37e34c=_0x26029c[_0x251b('0x1a')];for(var _0x36ef9d=0x0;_0x36ef9d<_0x37e34c[_0x251b('0x1d')];_0x36ef9d++){if(_0x37e34c[_0x36ef9d][_0x469a8a]===_0x4e17ad){_0x21e95c=!![];_0x48616f[_0x251b('0x35')]=_0x37e34c[_0x36ef9d][_0x251b('0x36')];}}return _0x21e95c;})[_0x251b('0x11')](function(_0x487e93){if(_0x487e93)return _0x48616f;if(_0xf7baeb===_0x251b('0x37')){logger['info']('['+[_0x1f8c74['toUpperCase']()]+_0x251b('0x38'));return _0x48616f;}return createEndUser(_0x48616f,_0x3dc99f,_0x19a1e1,_0x437c34,_0x3e09de,_0x1f8c74,_0x469a8a)[_0x251b('0x11')](function(_0x50b7d5){logger['info']('['+[_0x1f8c74[_0x251b('0x23')]()]+_0x251b('0x39'),_0x50b7d5['enduserId']);return _0x50b7d5;});});}function getCustomFields(_0x297b53,_0x3b8652,_0x581f29){var _0x1d08bc={};if(_0x297b53['length']>0x0){_[_0x251b('0x3a')](_0x297b53,function(_0x4ff41e){if(_[_0x251b('0x3b')]([_0x251b('0x3c'),'picklist'],_0x4ff41e[_0x251b('0x3d')])&&_0x4ff41e[_0x251b('0x3e')]&&!_0x4ff41e[_0x251b('0x3f')]){var _0xf57f9a=_0x4ff41e[_0x251b('0x40')][_0x251b('0x26')]();var _0x4f3ef5=_0xf57f9a['substring'](0x0,_0xf57f9a[_0x251b('0x41')]('_'));var _0x21d233=_0xf57f9a[_0x251b('0x2e')](_0xf57f9a['indexOf']('_')+0x1);if(_0x4f3ef5===_0x581f29){_0x1d08bc[_0x21d233]=_0x4ff41e['content'];}}});}return _0x1d08bc;}function getTicket(_0x5eda10,_0x32bc87,_0x4273fc,_0x3b3da5,_0x533076,_0x19ef8,_0x55d8ec){return new Promise(function(_0x143834,_0x4d3e66){var _0x3c41b6;return getAuthToken(_0x32bc87,_0x4273fc,_0x55d8ec)[_0x251b('0x11')](function(_0x2e1266){if(_0x19ef8['ticketType']===_0x251b('0x42')){_0x3c41b6={'method':_0x251b('0x43'),'uri':_0x3b3da5+_0x251b('0x44'),'body':Object[_0x251b('0x45')]({},{'title':intUtil['getString'](_0x19ef8[_0x251b('0x46')],_0x533076,'\x20'),'description':intUtil['getString'](_0x19ef8[_0x251b('0x47')],_0x533076,'\x0a'),'customerid_contact@odata.bind':_0x5eda10[_0x251b('0x35')]?_0x251b('0x48')+_0x5eda10['enduserId']+')':undefined,'ownerid@odata.bind':_0x251b('0x49')+_0x5eda10['userId']+')','caseorigincode':'1'},getCustomFields(_0x19ef8[_0x251b('0x4a')],_0x533076,_0x19ef8['ticketType'])),'headers':{'Authorization':_0x251b('0x18')+_0x2e1266,'OData-Version':_0x251b('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x19ef8[_0x251b('0x4b')]==='phonecall'){var _0x124e89=_0x5eda10[_0x251b('0x35')]?[{'partyid_systemuser@odata.bind':_0x251b('0x49')+_0x5eda10[_0x251b('0x22')]+')','participationtypemask':_0x5eda10[_0x251b('0x4c')]===_0x251b('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0x251b('0x48')+_0x5eda10['enduserId']+')','participationtypemask':_0x5eda10['callDirection']===_0x251b('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x251b('0x49')+_0x5eda10[_0x251b('0x22')]+')','participationtypemask':_0x5eda10[_0x251b('0x4c')]==='queue'?0x2:0x1}];_0x3c41b6={'method':_0x251b('0x43'),'uri':_0x3b3da5+_0x251b('0x4e'),'body':Object[_0x251b('0x45')]({},{'subject':intUtil[_0x251b('0x4f')](_0x19ef8['Subjects'],_0x533076,'\x20'),'phonenumber':String(_0x533076[_0x251b('0x29')]),'description':intUtil[_0x251b('0x4f')](_0x19ef8[_0x251b('0x47')],_0x533076,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5eda10[_0x251b('0x35')]?_0x251b('0x48')+_0x5eda10[_0x251b('0x35')]+')':undefined,'ownerid@odata.bind':_0x251b('0x49')+_0x5eda10['userId']+')','directioncode':_0x5eda10[_0x251b('0x4c')]===_0x251b('0x4d')?![]:!![],'phonecall_activity_parties':_0x124e89},getCustomFields(_0x19ef8['Fields'],_0x533076,_0x19ef8[_0x251b('0x4b')])),'headers':{'Authorization':_0x251b('0x18')+_0x2e1266,'OData-Version':_0x251b('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3c41b6);})['then'](function(_0x45c97d){var _0x2ede36=_0x45c97d['headers'][_0x251b('0x2d')];var _0x3351ac=_0x2ede36[_0x251b('0x2e')](_0x2ede36[_0x251b('0x2f')]('(')+0x1,_0x2ede36['lastIndexOf'](')'));_0x5eda10[_0x251b('0x50')]=_0x3351ac;_0x143834(_0x5eda10);})[_0x251b('0x25')](function(_0x3e8938){_0x4d3e66(_0x3e8938[_0x251b('0x15')]);});});}function emit(_0x30019a,_0x360f9d,_0x2aa290,_0x36b9a7){var _0x53e15f={'uri':util['format'](_0x251b('0x51'),_0x30019a,_0x2aa290,_0x36b9a7)};io['to'](util[_0x251b('0x52')](_0x251b('0x53'),_0x360f9d))[_0x251b('0x54')](_0x251b('0x55'),_0x53e15f);}exports['cs']=function(_0xa7563a,_0x5b954f,_0x195a10,_0x54bd08,_0x11bb30,_0x7efc0c,_0x2b084,_0x3d0276){var _0x5ac765={};_0x7efc0c['remoteUri']=_0x7efc0c['modernAuthentication']?intUtil[_0x251b('0x56')](_0x7efc0c['CloudProvider'][_0x251b('0x9')]):intUtil[_0x251b('0x56')](_0x7efc0c[_0x251b('0x8')]);_0x7efc0c['serverUrl']=intUtil[_0x251b('0x56')](_0x7efc0c[_0x251b('0x57')]);_0x5ac765['callDirection']=_0x3d0276===_0x251b('0x4d')||_0x3d0276===_0x251b('0x58')?_0x251b('0x4d'):_0x251b('0x27');var _0x3f0deb=_0x7efc0c[_0x251b('0x59')]?util[_0x251b('0x52')](_0x251b('0x5a'),_0x7efc0c['CloudProvider'][_0x251b('0x9')]):util[_0x251b('0x52')](_0x251b('0x5a'),_0x7efc0c[_0x251b('0x8')]);var _0x2816cb=util['format'](_0x251b('0x5b'),_0x7efc0c['tenantId']);var _0x2bd2c3=util[_0x251b('0x52')](_0x251b('0x5c'),_0x7efc0c['serverUrl'],_0x5b954f[_0x251b('0x5d')],md5(_0x5b954f[_0x251b('0x5d')]));if(_0x11bb30&&_0x11bb30[_0x251b('0x5e')]){logger[_0x251b('0x20')](_0x251b('0x5f'),_0x251b('0x60'));_0x5b954f[_0x251b('0x61')]=_0x2bd2c3;}else if(_0x2b084&&_0x2b084['recordingFormat']&&_0x2b084[_0x251b('0x62')]!==_0x251b('0x63')){logger[_0x251b('0x20')](_0x251b('0x64'),'Recording\x20is\x20enabled!');_0x5b954f[_0x251b('0x61')]=_0x2bd2c3;}else{_0x5b954f[_0x251b('0x61')]='';}return getUser(_0x5ac765,_0x7efc0c,_0x54bd08,_0x2816cb,_0x3f0deb,_0x3d0276)[_0x251b('0x11')](function(_0x13e2b4){logger['info']('['+_0x3d0276[_0x251b('0x23')]()+_0x251b('0x65'),_0x13e2b4[_0x251b('0x22')]);logger[_0x251b('0x20')]('['+_0x3d0276[_0x251b('0x23')]()+']\x20The\x20User\x20email\x20is:',_0x13e2b4[_0x251b('0x1c')]);return getEndUser(_0x13e2b4,_0x7efc0c,_0x2816cb,_0x3f0deb,_0x5b954f,_0x3d0276,_0x195a10['moduleCreate'],_0x195a10['additionalSearchContact']);})[_0x251b('0x11')](function(_0x3e34bb){logger[_0x251b('0x20')]('['+_0x3d0276[_0x251b('0x23')]()+_0x251b('0x66'),_0x3e34bb[_0x251b('0x35')]);logger['info']('['+_0x3d0276[_0x251b('0x23')]()+_0x251b('0x67'),_0x5b954f['calleridnum']);return getTicket(_0x3e34bb,_0x7efc0c,_0x2816cb,_0x3f0deb,_0x5b954f,_0x195a10,_0x3d0276);})[_0x251b('0x11')](function(_0x198d28){logger[_0x251b('0x20')](util[_0x251b('0x52')]('['+_0x3d0276[_0x251b('0x23')]()+_0x251b('0x68'),_0x195a10[_0x251b('0x4b')],_0x198d28[_0x251b('0x50')]));logger['info'](util[_0x251b('0x52')]('['+_0x3d0276[_0x251b('0x23')]()+_0x251b('0x69'),_0x3d0276));if(_0x3d0276!==_0x251b('0x58')&&_0x195a10[_0x251b('0x6a')]){logger[_0x251b('0x20')]('['+_0x3d0276['toUpperCase']()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x7efc0c[_0x251b('0x8')],_0x54bd08[_0x251b('0x6b')],_0x195a10[_0x251b('0x4b')],_0x198d28[_0x251b('0x50')]);}})['catch'](function(_0x50fb03){logger[_0x251b('0x13')]('['+_0x3d0276[_0x251b('0x23')]()+_0x251b('0x6c'),_0x50fb03[_0x251b('0x15')]);console[_0x251b('0x13')](_0x251b('0x6d'),_0x50fb03);});}; \ 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 69da103..4b46f03 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 _0x02f6=['localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','[HTTP]','stringify','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','idField','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lodash','md5','util','./util','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis'];(function(_0x288f5e,_0x205edd){var _0x476cc9=function(_0x796f53){while(--_0x796f53){_0x288f5e['push'](_0x288f5e['shift']());}};_0x476cc9(++_0x205edd);}(_0x02f6,0x11a));var _0x602f=function(_0x53ad58,_0x3fb489){_0x53ad58=_0x53ad58-0x0;var _0x554b03=_0x02f6[_0x53ad58];return _0x554b03;};'use strict';var _=require(_0x602f('0x0'));var rp=require('request-promise');var md5=require(_0x602f('0x1'));var util=require(_0x602f('0x2'));var Redis=require('ioredis');var intUtil=require(_0x602f('0x3'));var config=require(_0x602f('0x4'));var logger=require(_0x602f('0x5'))(_0x602f('0x6'));config['redis']=_[_0x602f('0x7')](config[_0x602f('0x8')],{'host':_0x602f('0x9'),'port':0x18eb});var io=require(_0x602f('0xa'))(new Redis(config[_0x602f('0x8')]));var headers={'Content-Type':_0x602f('0xb'),'Accept':'application/json'};function emit(_0x34e3e1,_0x544f0e,_0x1e5ea3){io['to'](_0x34e3e1)[_0x602f('0xc')](_0x544f0e,_0x1e5ea3);}function getTicket(_0x15c3f5,_0xbeda8,_0x127f0e,_0x1db466,_0x25e74f){logger[_0x602f('0xd')](_0x602f('0xe'));var _0x1c5f16=_[_0x602f('0xf')]({'responder_id':_0xbeda8['id'],'requester_id':_0x127f0e['id'],'name':util[_0x602f('0x10')](_0x602f('0x11'),_0x25e74f[_0x602f('0x12')]),'phone':_0x25e74f[_0x602f('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x602f('0x14')](_0x1db466[_0x602f('0x15')],_0x25e74f,'\x20'),'description':intUtil[_0x602f('0x14')](_0x1db466[_0x602f('0x16')],_0x25e74f,_0x602f('0x17')),'tags':getTags(_0x1db466[_0x602f('0x18')],_0x602f('0x19'))},getCustomFields(_0x1db466['Fields'],_0x25e74f));_0x1c5f16['custom_fields']=_[_0x602f('0x1a')](_[_0x602f('0x1b')](_0x1c5f16[_0x602f('0x1c')],'id'),_0x602f('0x1d'));return request({'uri':util[_0x602f('0x10')](_0x602f('0x1e'),_0x15c3f5['remoteUri']),'method':'POST','body':_0x1c5f16})[_0x602f('0x1f')](function(_0x39b893){logger['info'](_0x602f('0x20'));return _0x39b893;});}function getUser(_0x3d6f1e,_0x35499f){if(intUtil[_0x602f('0x21')](_0x35499f)){return request({'uri':util['format'](_0x602f('0x22'),_0x3d6f1e[_0x602f('0x23')]),'qs':{'email':_0x35499f}})[_0x602f('0x1f')](function(_0x248e41){if(_0x248e41[_0x602f('0x24')]){logger[_0x602f('0xd')](_0x602f('0x25'));return _[_0x602f('0x26')](_0x248e41,function(_0x217c20){return _0x217c20['contact']['email']===_0x35499f;});}else{logger[_0x602f('0xd')](_0x602f('0x27'));return request({'uri':util[_0x602f('0x10')](_0x602f('0x28'),_0x3d6f1e[_0x602f('0x23')])})['then'](function(_0x2398a7){logger[_0x602f('0xd')](_0x602f('0x29'));return _0x2398a7;});}});}else{logger['info'](_0x602f('0x2a'));return request({'uri':util[_0x602f('0x10')](_0x602f('0x28'),_0x3d6f1e[_0x602f('0x23')])})[_0x602f('0x1f')](function(_0x387070){logger['info']('Admin\x20account\x20selected.');return _0x387070;});}}function getEndUser(_0x1f74b4,_0x23ea6b,_0x19c62b){logger[_0x602f('0xd')](_0x602f('0x2b'),_0x19c62b);return request({'uri':util['format'](_0x602f('0x2c'),_0x1f74b4[_0x602f('0x23')]),'qs':{'phone':_0x19c62b}})[_0x602f('0x1f')](function(_0x5a15bc){if(_0x5a15bc[_0x602f('0x24')]){logger[_0x602f('0xd')](_0x602f('0x2d'));return _[_0x602f('0x26')](_0x5a15bc,{'phone':_0x19c62b});}else{logger[_0x602f('0xd')](_0x602f('0x2e'));return request({'uri':util['format']('%s/api/v2/contacts',_0x1f74b4[_0x602f('0x23')]),'method':_0x602f('0x2f'),'body':{'name':_0x23ea6b,'phone':_0x19c62b}})[_0x602f('0x1f')](function(_0x126243){logger['info'](_0x602f('0x30'));return _0x126243;});}});}function getAuth(_0x3237bc){return util[_0x602f('0x10')](_0x602f('0x31'),new Buffer(_0x3237bc[_0x602f('0x32')]+':X')[_0x602f('0x33')](_0x602f('0x34')));}function request(_0x99ead0){logger['debug'](_0x602f('0x35'),JSON[_0x602f('0x36')](_0x99ead0));return rp(_[_0x602f('0x7')](_0x99ead0,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5b7485,_0x5df2c0){var _0x199373=[];if(_0x5b7485&&_0x5b7485[_0x602f('0x24')]>0x0){_0x199373=_['map'](_0x5b7485,_0x5df2c0);}return _0x199373;}function getCustomFields(_0x2d5420,_0x28f1c9){var _0x1d74a7=[];var _0x4cc218={'custom_fields':[]};if(_0x2d5420[_0x602f('0x24')]>0x0){_[_0x602f('0x37')](_0x2d5420,function(_0x53bf82){if(_[_0x602f('0x38')]([_0x602f('0x39'),_0x602f('0x3a')],_0x53bf82['type'])&&_0x53bf82[_0x602f('0x3b')]&&!_0x53bf82[_0x602f('0x3c')]){_0x4cc218[_0x53bf82[_0x602f('0x3b')][_0x602f('0x3d')]()]=_0x53bf82[_0x602f('0x3e')][_0x602f('0x33')]();}else if(_[_0x602f('0x38')]([_0x602f('0x39'),_0x602f('0x3a')],_0x53bf82[_0x602f('0x3f')])&&_0x53bf82[_0x602f('0x40')]&&_0x53bf82[_0x602f('0x3c')]){_0x4cc218[_0x602f('0x1c')][_0x602f('0x41')]({'id':_0x53bf82[_0x602f('0x40')],'value':_0x53bf82[_0x602f('0x3e')][_0x602f('0x33')]()});}else if(_0x53bf82[_0x602f('0x3f')]===_0x602f('0x42')&&_0x53bf82['variableName']&&_0x53bf82[_0x602f('0x40')]&&_0x53bf82[_0x602f('0x3c')]){_0x28f1c9[_0x53bf82[_0x602f('0x43')]]&&_0x4cc218[_0x602f('0x1c')][_0x602f('0x41')]({'id':_0x53bf82[_0x602f('0x40')],'value':_0x28f1c9[_0x53bf82[_0x602f('0x43')]][_0x602f('0x33')]()});}else if(_0x53bf82['type']===_0x602f('0x44')&&_0x53bf82[_0x602f('0x45')]&&_0x53bf82[_0x602f('0x45')][_0x602f('0x19')]&&_0x53bf82[_0x602f('0x40')]&&_0x53bf82[_0x602f('0x3c')]){_0x28f1c9[_0x53bf82[_0x602f('0x45')]['name'][_0x602f('0x3d')]()]&&_0x4cc218['custom_fields'][_0x602f('0x41')]({'id':_0x53bf82['idField'],'value':_0x28f1c9[_0x53bf82[_0x602f('0x45')][_0x602f('0x19')][_0x602f('0x3d')]()][_0x602f('0x33')]()});}});}return _0x4cc218;}exports[_0x602f('0x46')]=function(_0x3ad054,_0x36f336,_0x1e46c3,_0x95c5ec,_0x4491be,_0x55e973){var _0x4aa36b,_0x3eb149;_0x55e973[_0x602f('0x23')]=intUtil[_0x602f('0x47')](_0x55e973[_0x602f('0x23')]);_0x55e973[_0x602f('0x48')]=intUtil['stripTrailingSlash'](_0x55e973[_0x602f('0x48')]);if(_0x4491be&&_0x4491be[_0x602f('0x49')]){logger[_0x602f('0xd')]('[QUEUE]',_0x602f('0x4a'));_0x36f336[_0x602f('0x4b')]=util[_0x602f('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x55e973[_0x602f('0x48')],_0x36f336[_0x602f('0x4c')],md5(_0x36f336['uniqueid']));}else{_0x36f336[_0x602f('0x4b')]='';}headers[_0x602f('0x4d')]=getAuth(_0x55e973);return getUser(_0x55e973,_0x95c5ec[_0x602f('0x4e')])[_0x602f('0x1f')](function(_0x110530){_0x4aa36b=_0x110530;logger[_0x602f('0xd')](_0x602f('0x4f'),_0x4aa36b['id']);return getEndUser(_0x55e973,_0x36f336[_0x602f('0x12')],_0x36f336[_0x602f('0x13')]);})['then'](function(_0xb9caa7){_0x3eb149=_0xb9caa7;logger[_0x602f('0xd')](_0x602f('0x50'),_0x3eb149['id']);return getTicket(_0x55e973,_0x4aa36b,_0x3eb149,_0x1e46c3,_0x36f336);})['then'](function(_0x5efab0){if(_0x5efab0&&_0x5efab0['id']){logger[_0x602f('0xd')](_0x602f('0x20'));logger[_0x602f('0xd')](_0x602f('0x51'),_0x5efab0['id']);logger['info'](_0x602f('0x52'),_0x602f('0x53'));emit(util[_0x602f('0x10')]('user:%s',_0x95c5ec[_0x602f('0x19')]),_0x602f('0x54'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x55e973[_0x602f('0x23')],_0x5efab0['id'])});}})[_0x602f('0x55')](function(_0xb27539){logger[_0x602f('0x56')]('[QUEUE]',JSON[_0x602f('0x36')](_0xb27539));});};exports[_0x602f('0x57')]=function(_0x193ace,_0x451218,_0x1e09de,_0x103cca,_0x1c70b9,_0x480e31,_0x353849){var _0x305506,_0x4cc97c;_0x480e31[_0x602f('0x23')]=intUtil[_0x602f('0x47')](_0x480e31[_0x602f('0x23')]);_0x480e31['serverUrl']=intUtil[_0x602f('0x47')](_0x480e31['serverUrl']);if(_0x353849&&_0x353849[_0x602f('0x58')]&&_0x353849[_0x602f('0x58')]!==_0x602f('0x59')){logger[_0x602f('0xd')]('[OUTBOUND]',_0x602f('0x4a'));_0x451218[_0x602f('0x4b')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x480e31['serverUrl'],_0x451218[_0x602f('0x4c')],md5(_0x451218[_0x602f('0x4c')]));}headers['Authorization']=getAuth(_0x480e31);return getUser(_0x480e31,_0x103cca[_0x602f('0x4e')])[_0x602f('0x1f')](function(_0xc718cd){_0x305506=_0xc718cd;logger[_0x602f('0xd')](_0x602f('0x4f'),_0x305506['id']);return getEndUser(_0x480e31,_0x451218[_0x602f('0x5a')],_0x451218[_0x602f('0x5b')]);})[_0x602f('0x1f')](function(_0x16b582){_0x4cc97c=_0x16b582;logger[_0x602f('0xd')](_0x602f('0x50'),_0x4cc97c['id']);return getTicket(_0x480e31,_0x305506,_0x4cc97c,_0x1e09de,_0x451218);})[_0x602f('0x1f')](function(_0x3425c3){if(_0x3425c3&&_0x3425c3['id']){logger[_0x602f('0xd')](_0x602f('0x20'));logger[_0x602f('0xd')](_0x602f('0x51'),_0x3425c3['id']);logger[_0x602f('0xd')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x602f('0x10')]('user:%s',_0x103cca[_0x602f('0x19')]),_0x602f('0x54'),{'uri':util[_0x602f('0x10')]('%s/helpdesk/tickets/%d',_0x480e31[_0x602f('0x23')],_0x3425c3['id'])});}})['catch'](function(_0x2ccd86){logger[_0x602f('0x56')](_0x602f('0x5c'),JSON['stringify'](_0x2ccd86));});};exports[_0x602f('0x5d')]=function(_0x922faa,_0xf6d5da,_0x227c30,_0x10d5e8,_0x2f3a3d,_0x446477){var _0x15597f,_0x516d03;_0x446477[_0x602f('0x23')]=intUtil['stripTrailingSlash'](_0x446477[_0x602f('0x23')]);_0x446477['serverUrl']=intUtil[_0x602f('0x47')](_0x446477[_0x602f('0x48')]);if(_0x2f3a3d&&_0x2f3a3d[_0x602f('0x49')]){logger['info']('['+_0xf6d5da[_0x602f('0x5e')][_0x602f('0x5f')]()+']',_0x602f('0x4a'));_0xf6d5da['recordingURL']=util[_0x602f('0x10')](_0x602f('0x60'),_0x446477[_0x602f('0x48')],_0xf6d5da['uniqueid'],md5(_0xf6d5da[_0x602f('0x4c')]));}else{_0xf6d5da[_0x602f('0x4b')]='';}headers['Authorization']=getAuth(_0x446477);return getUser(_0x446477,'')[_0x602f('0x1f')](function(_0x5930b5){_0x15597f=_0x5930b5;logger[_0x602f('0xd')](_0x602f('0x4f'),_0x15597f['id']);return getEndUser(_0x446477,_0xf6d5da[_0x602f('0x12')],_0xf6d5da[_0x602f('0x13')]);})['then'](function(_0xc29e0a){_0x516d03=_0xc29e0a;logger[_0x602f('0xd')](_0x602f('0x50'),_0x516d03['id']);return getTicket(_0x446477,_0x15597f,_0x516d03,_0x227c30,_0xf6d5da);})[_0x602f('0x1f')](function(_0x13b79c){if(_0x13b79c){logger[_0x602f('0xd')](_0x602f('0x20'));logger[_0x602f('0xd')](_0x602f('0x51'),_0x13b79c['id']);}})[_0x602f('0x55')](function(_0x3b8695){logger['error']('['+_0xf6d5da[_0x602f('0x5e')]['toUpperCase']()+']',JSON[_0x602f('0x36')](_0x3b8695));});}; \ No newline at end of file +var _0x1ce2=['emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','name','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','GET','map','forEach','includes','picklist','type','nameField','customField','content','string','idField','push','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','user:%s','trigger:browser:url','unmanaged','lastevent','calleridname','toUpperCase','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json'];(function(_0x48f577,_0x41dfde){var _0x5ccb82=function(_0x2cfc17){while(--_0x2cfc17){_0x48f577['push'](_0x48f577['shift']());}};_0x5ccb82(++_0x41dfde);}(_0x1ce2,0x180));var _0x21ce=function(_0x413920,_0x38f67f){_0x413920=_0x413920-0x0;var _0x295964=_0x1ce2[_0x413920];return _0x295964;};'use strict';var _=require('lodash');var rp=require(_0x21ce('0x0'));var md5=require(_0x21ce('0x1'));var util=require('util');var Redis=require(_0x21ce('0x2'));var intUtil=require(_0x21ce('0x3'));var config=require(_0x21ce('0x4'));var logger=require(_0x21ce('0x5'))(_0x21ce('0x6'));config[_0x21ce('0x7')]=_[_0x21ce('0x8')](config[_0x21ce('0x7')],{'host':_0x21ce('0x9'),'port':0x18eb});var io=require(_0x21ce('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0x21ce('0xb'),'Accept':_0x21ce('0xb')};function emit(_0x467d56,_0x449aaf,_0x5ecaf5){io['to'](_0x467d56)[_0x21ce('0xc')](_0x449aaf,_0x5ecaf5);}function getTicket(_0x11cb50,_0xe859fe,_0xecd0a7,_0x978c8,_0x2e9776){logger[_0x21ce('0xd')](_0x21ce('0xe'));var _0x4d7846=_[_0x21ce('0xf')]({'responder_id':_0xe859fe['id'],'requester_id':_0xecd0a7['id'],'name':util['format'](_0x21ce('0x10'),_0x2e9776['calleridname']),'phone':_0x2e9776[_0x21ce('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x21ce('0x12')](_0x978c8[_0x21ce('0x13')],_0x2e9776,'\x20'),'description':intUtil[_0x21ce('0x12')](_0x978c8[_0x21ce('0x14')],_0x2e9776,_0x21ce('0x15')),'tags':getTags(_0x978c8['Tags'],_0x21ce('0x16'))},getCustomFields(_0x978c8['Fields'],_0x2e9776));_0x4d7846[_0x21ce('0x17')]=_[_0x21ce('0x18')](_[_0x21ce('0x19')](_0x4d7846[_0x21ce('0x17')],'id'),_0x21ce('0x1a'));return request({'uri':util[_0x21ce('0x1b')](_0x21ce('0x1c'),_0x11cb50[_0x21ce('0x1d')]),'method':_0x21ce('0x1e'),'body':_0x4d7846})[_0x21ce('0x1f')](function(_0x4d9e70){logger[_0x21ce('0xd')](_0x21ce('0x20'));return _0x4d9e70;});}function getUser(_0x15cb9b,_0x2201cb){if(intUtil[_0x21ce('0x21')](_0x2201cb)){return request({'uri':util[_0x21ce('0x1b')](_0x21ce('0x22'),_0x15cb9b[_0x21ce('0x1d')]),'qs':{'email':_0x2201cb}})['then'](function(_0x400435){if(_0x400435[_0x21ce('0x23')]){logger[_0x21ce('0xd')](_0x21ce('0x24'));return _['find'](_0x400435,function(_0x3b15a7){return _0x3b15a7[_0x21ce('0x25')][_0x21ce('0x26')]===_0x2201cb;});}else{logger[_0x21ce('0xd')](_0x21ce('0x27'));return request({'uri':util[_0x21ce('0x1b')](_0x21ce('0x28'),_0x15cb9b[_0x21ce('0x1d')])})[_0x21ce('0x1f')](function(_0x4c8aae){logger[_0x21ce('0xd')](_0x21ce('0x29'));return _0x4c8aae;});}});}else{logger[_0x21ce('0xd')](_0x21ce('0x2a'));return request({'uri':util['format'](_0x21ce('0x28'),_0x15cb9b['remoteUri'])})[_0x21ce('0x1f')](function(_0x3846c4){logger['info'](_0x21ce('0x29'));return _0x3846c4;});}}function getEndUser(_0x105ab1,_0x3d7d2d,_0x1c4ef1){logger[_0x21ce('0xd')](_0x21ce('0x2b'),_0x1c4ef1);return request({'uri':util[_0x21ce('0x1b')](_0x21ce('0x2c'),_0x105ab1[_0x21ce('0x1d')]),'qs':{'phone':_0x1c4ef1}})['then'](function(_0xafe722){if(_0xafe722['length']){logger[_0x21ce('0xd')](_0x21ce('0x2d'));return _[_0x21ce('0x2e')](_0xafe722,{'phone':_0x1c4ef1});}else{logger[_0x21ce('0xd')](_0x21ce('0x2f'));return request({'uri':util[_0x21ce('0x1b')](_0x21ce('0x2c'),_0x105ab1['remoteUri']),'method':_0x21ce('0x1e'),'body':{'name':_0x3d7d2d,'phone':_0x1c4ef1}})['then'](function(_0x9140ae){logger[_0x21ce('0xd')](_0x21ce('0x30'));return _0x9140ae;});}});}function getAuth(_0xc53f52){return util[_0x21ce('0x1b')](_0x21ce('0x31'),new Buffer(_0xc53f52[_0x21ce('0x32')]+':X')[_0x21ce('0x33')]('base64'));}function request(_0x3a5a4c){logger[_0x21ce('0x34')](_0x21ce('0x35'),JSON['stringify'](_0x3a5a4c));return rp(_[_0x21ce('0x8')](_0x3a5a4c,{'method':_0x21ce('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x2a07ce,_0x5f3cbd){var _0x23b5c2=[];if(_0x2a07ce&&_0x2a07ce[_0x21ce('0x23')]>0x0){_0x23b5c2=_[_0x21ce('0x37')](_0x2a07ce,_0x5f3cbd);}return _0x23b5c2;}function getCustomFields(_0x5ed77d,_0x480280){var _0x3879fe=[];var _0x27dbf9={'custom_fields':[]};if(_0x5ed77d['length']>0x0){_[_0x21ce('0x38')](_0x5ed77d,function(_0x2019f6){if(_[_0x21ce('0x39')](['string',_0x21ce('0x3a')],_0x2019f6[_0x21ce('0x3b')])&&_0x2019f6[_0x21ce('0x3c')]&&!_0x2019f6[_0x21ce('0x3d')]){_0x27dbf9[_0x2019f6[_0x21ce('0x3c')]['toLowerCase']()]=_0x2019f6[_0x21ce('0x3e')][_0x21ce('0x33')]();}else if(_[_0x21ce('0x39')]([_0x21ce('0x3f'),_0x21ce('0x3a')],_0x2019f6['type'])&&_0x2019f6[_0x21ce('0x40')]&&_0x2019f6['customField']){_0x27dbf9[_0x21ce('0x17')][_0x21ce('0x41')]({'id':_0x2019f6['idField'],'value':_0x2019f6[_0x21ce('0x3e')][_0x21ce('0x33')]()});}else if(_0x2019f6[_0x21ce('0x3b')]==='variable'&&_0x2019f6['variableName']&&_0x2019f6[_0x21ce('0x40')]&&_0x2019f6[_0x21ce('0x3d')]){_0x480280[_0x2019f6[_0x21ce('0x42')]]&&_0x27dbf9[_0x21ce('0x17')][_0x21ce('0x41')]({'id':_0x2019f6[_0x21ce('0x40')],'value':_0x480280[_0x2019f6[_0x21ce('0x42')]][_0x21ce('0x33')]()});}else if(_0x2019f6[_0x21ce('0x3b')]===_0x21ce('0x43')&&_0x2019f6[_0x21ce('0x44')]&&_0x2019f6[_0x21ce('0x44')][_0x21ce('0x16')]&&_0x2019f6[_0x21ce('0x40')]&&_0x2019f6[_0x21ce('0x3d')]){_0x480280[_0x2019f6[_0x21ce('0x44')]['name'][_0x21ce('0x45')]()]&&_0x27dbf9[_0x21ce('0x17')]['push']({'id':_0x2019f6[_0x21ce('0x40')],'value':_0x480280[_0x2019f6[_0x21ce('0x44')]['name'][_0x21ce('0x45')]()][_0x21ce('0x33')]()});}});}return _0x27dbf9;}exports[_0x21ce('0x46')]=function(_0x5b11bf,_0x3f9216,_0x59bc3e,_0x442798,_0xc574af,_0x3da4c){var _0x274b55,_0x5d9b82;_0x3da4c[_0x21ce('0x1d')]=intUtil[_0x21ce('0x47')](_0x3da4c['remoteUri']);_0x3da4c['serverUrl']=intUtil[_0x21ce('0x47')](_0x3da4c['serverUrl']);if(_0xc574af&&_0xc574af[_0x21ce('0x48')]){logger['info'](_0x21ce('0x49'),_0x21ce('0x4a'));_0x3f9216[_0x21ce('0x4b')]=util[_0x21ce('0x1b')](_0x21ce('0x4c'),_0x3da4c[_0x21ce('0x4d')],_0x3f9216['uniqueid'],md5(_0x3f9216['uniqueid']));}else{_0x3f9216['recordingURL']='';}headers[_0x21ce('0x4e')]=getAuth(_0x3da4c);return getUser(_0x3da4c,_0x442798[_0x21ce('0x26')])[_0x21ce('0x1f')](function(_0x230a62){_0x274b55=_0x230a62;logger[_0x21ce('0xd')]('The\x20User\x20ID\x20is:',_0x274b55['id']);return getEndUser(_0x3da4c,_0x3f9216['calleridname'],_0x3f9216[_0x21ce('0x11')]);})[_0x21ce('0x1f')](function(_0x31a92d){_0x5d9b82=_0x31a92d;logger[_0x21ce('0xd')](_0x21ce('0x4f'),_0x5d9b82['id']);return getTicket(_0x3da4c,_0x274b55,_0x5d9b82,_0x59bc3e,_0x3f9216);})['then'](function(_0x3c1f07){if(_0x3c1f07&&_0x3c1f07['id']){logger['info'](_0x21ce('0x20'));logger[_0x21ce('0xd')](_0x21ce('0x50'),_0x3c1f07['id']);logger[_0x21ce('0xd')](_0x21ce('0x49'),_0x21ce('0x51'));emit(util[_0x21ce('0x1b')]('user:%s',_0x442798[_0x21ce('0x16')]),'trigger:browser:url',{'uri':util[_0x21ce('0x1b')](_0x21ce('0x52'),_0x3da4c[_0x21ce('0x1d')],_0x3c1f07['id'])});}})[_0x21ce('0x53')](function(_0x3d2ed5){logger[_0x21ce('0x54')](_0x21ce('0x49'),JSON[_0x21ce('0x55')](_0x3d2ed5));});};exports[_0x21ce('0x56')]=function(_0x937c2e,_0x215c3e,_0x3e0c6a,_0x3ab8b2,_0x274a60,_0x3eb293,_0x391310){var _0x160260,_0x106c15;_0x3eb293['remoteUri']=intUtil[_0x21ce('0x47')](_0x3eb293['remoteUri']);_0x3eb293['serverUrl']=intUtil[_0x21ce('0x47')](_0x3eb293[_0x21ce('0x4d')]);if(_0x391310&&_0x391310[_0x21ce('0x57')]&&_0x391310[_0x21ce('0x57')]!==_0x21ce('0x58')){logger[_0x21ce('0xd')](_0x21ce('0x59'),_0x21ce('0x4a'));_0x215c3e[_0x21ce('0x4b')]=util[_0x21ce('0x1b')](_0x21ce('0x4c'),_0x3eb293[_0x21ce('0x4d')],_0x215c3e[_0x21ce('0x5a')],md5(_0x215c3e['uniqueid']));}headers[_0x21ce('0x4e')]=getAuth(_0x3eb293);return getUser(_0x3eb293,_0x3ab8b2[_0x21ce('0x26')])[_0x21ce('0x1f')](function(_0x360f38){_0x160260=_0x360f38;logger[_0x21ce('0xd')](_0x21ce('0x5b'),_0x160260['id']);return getEndUser(_0x3eb293,_0x215c3e[_0x21ce('0x5c')],_0x215c3e['destcalleridnum']);})[_0x21ce('0x1f')](function(_0x52ca57){_0x106c15=_0x52ca57;logger[_0x21ce('0xd')]('The\x20Enduser\x20ID\x20is:',_0x106c15['id']);return getTicket(_0x3eb293,_0x160260,_0x106c15,_0x3e0c6a,_0x215c3e);})['then'](function(_0x5c587e){if(_0x5c587e&&_0x5c587e['id']){logger[_0x21ce('0xd')](_0x21ce('0x20'));logger['info'](_0x21ce('0x50'),_0x5c587e['id']);logger[_0x21ce('0xd')](_0x21ce('0x59'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x21ce('0x5d'),_0x3ab8b2[_0x21ce('0x16')]),_0x21ce('0x5e'),{'uri':util[_0x21ce('0x1b')](_0x21ce('0x52'),_0x3eb293[_0x21ce('0x1d')],_0x5c587e['id'])});}})['catch'](function(_0x47a283){logger[_0x21ce('0x54')](_0x21ce('0x59'),JSON[_0x21ce('0x55')](_0x47a283));});};exports[_0x21ce('0x5f')]=function(_0x3256e4,_0x5ec3af,_0x54fd94,_0x15dc9d,_0x1b8c24,_0x1dc370){var _0x550fad,_0x236348;_0x1dc370[_0x21ce('0x1d')]=intUtil[_0x21ce('0x47')](_0x1dc370[_0x21ce('0x1d')]);_0x1dc370[_0x21ce('0x4d')]=intUtil[_0x21ce('0x47')](_0x1dc370[_0x21ce('0x4d')]);if(_0x1b8c24&&_0x1b8c24['monitor_format']){logger[_0x21ce('0xd')]('['+_0x5ec3af[_0x21ce('0x60')]['toUpperCase']()+']',_0x21ce('0x4a'));_0x5ec3af['recordingURL']=util[_0x21ce('0x1b')](_0x21ce('0x4c'),_0x1dc370[_0x21ce('0x4d')],_0x5ec3af[_0x21ce('0x5a')],md5(_0x5ec3af[_0x21ce('0x5a')]));}else{_0x5ec3af[_0x21ce('0x4b')]='';}headers[_0x21ce('0x4e')]=getAuth(_0x1dc370);return getUser(_0x1dc370,'')[_0x21ce('0x1f')](function(_0x2710aa){_0x550fad=_0x2710aa;logger['info']('The\x20User\x20ID\x20is:',_0x550fad['id']);return getEndUser(_0x1dc370,_0x5ec3af[_0x21ce('0x61')],_0x5ec3af[_0x21ce('0x11')]);})[_0x21ce('0x1f')](function(_0x270ab2){_0x236348=_0x270ab2;logger[_0x21ce('0xd')](_0x21ce('0x4f'),_0x236348['id']);return getTicket(_0x1dc370,_0x550fad,_0x236348,_0x54fd94,_0x5ec3af);})[_0x21ce('0x1f')](function(_0x4e4a2c){if(_0x4e4a2c){logger[_0x21ce('0xd')](_0x21ce('0x20'));logger[_0x21ce('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4e4a2c['id']);}})[_0x21ce('0x53')](function(_0x2fb1b5){logger[_0x21ce('0x54')]('['+_0x5ec3af[_0x21ce('0x60')][_0x21ce('0x62')]()+']',JSON[_0x21ce('0x55')](_0x2fb1b5));});}; \ 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 35a1a61..975a1a0 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 _0x168d=['emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','bluebird','ioredis','./util','../../../../config/environment','freshsales','defaults','redis','localhost','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','task','ticketId','user:%s'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x168d,0x10e));var _0xd168=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x168d[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xd168('0x0'));var rp=require(_0xd168('0x1'));var md5=require('md5');var util=require('util');var moment=require('moment');var Promise=require(_0xd168('0x2'));var Redis=require(_0xd168('0x3'));var intUtil=require(_0xd168('0x4'));var config=require(_0xd168('0x5'));var logger=require('../../../../config/logger')(_0xd168('0x6'));config['redis']=_[_0xd168('0x7')](config[_0xd168('0x8')],{'host':_0xd168('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd168('0x8')]));function getAdminId(_0x54dfbe,_0x5ca8e9,_0x2739f3,_0x456e93){return new Promise(function(_0x24ef3e,_0x46698f){var _0x45a040=![];var _0x284a72={'method':_0xd168('0xa'),'uri':_0x456e93+_0xd168('0xb'),'json':!![]};_0x284a72[_0xd168('0xc')]=_0x2739f3;logger[_0xd168('0xd')](_0xd168('0xe'));return rp(_0x284a72)[_0xd168('0xf')](function(_0x1d3bcb){if(_0x1d3bcb){var _0x2c3387=_0x1d3bcb[_0xd168('0x10')];var _0xeea25e=null;for(_0xeea25e=0x0;_0xeea25e<_0x2c3387[_0xd168('0x11')];_0xeea25e++){if(_0x2c3387[_0xeea25e]['email']===_0x54dfbe[_0xd168('0x12')]){_0x54dfbe[_0xd168('0x13')]=_0x2c3387[_0xeea25e]['id'];_0x45a040=!![];}}if(_0x45a040){logger[_0xd168('0xd')]('Admin\x20found:',_0x54dfbe[_0xd168('0x13')]);_0x24ef3e(_0x54dfbe);}else{_0x46698f({'statusCode':0x194,'message':_0xd168('0x14')});}}else{_0x46698f({'statusCode':0x194,'message':_0xd168('0x14')});}})[_0xd168('0x15')](function(_0xb3c16f){logger[_0xd168('0x16')]('['+[_0x5ca8e9[_0xd168('0x17')]()]+']',_0xb3c16f[_0xd168('0x18')]);_0x46698f(_0xb3c16f);});});}function getUser(_0x305ce7,_0x11a78e,_0x2369af){return function(_0x32f174){return new Promise(function(_0x45efdc,_0x4825b4){var _0x44f797={'method':_0xd168('0xa'),'uri':_0x2369af+_0xd168('0xb'),'json':!![]};_0x44f797[_0xd168('0xc')]=_0x11a78e;logger[_0xd168('0xd')](_0xd168('0x19'));return rp(_0x44f797)[_0xd168('0xf')](function(_0x55badf){if(_0x55badf){var _0x15e9fe=_0x55badf[_0xd168('0x10')];var _0x5ab545=![];var _0x34c054=null;if(_0x32f174[_0xd168('0x1a')]!==null){logger['info'](_0xd168('0x1b'),_0x32f174['agentEmail']);_0x32f174[_0xd168('0x1c')]=_0x32f174[_0xd168('0x1a')];for(_0x34c054=0x0;_0x34c054<_0x15e9fe[_0xd168('0x11')];_0x34c054++){if(_0x15e9fe[_0x34c054]['email']===_0x32f174[_0xd168('0x1a')]){_0x5ab545=!![];_0x32f174[_0xd168('0x1d')]=_0x15e9fe[_0x34c054]['id'];logger[_0xd168('0xd')](_0xd168('0x1e'),_0x32f174[_0xd168('0x1d')]);}}}if(!_0x5ab545){logger[_0xd168('0xd')](_0xd168('0x1f'));_0x32f174[_0xd168('0x1c')]=_0x32f174[_0xd168('0x12')];_0x32f174[_0xd168('0x1d')]=_0x32f174[_0xd168('0x13')];_0x5ab545=!![];}if(_0x5ab545){_0x45efdc(_0x32f174);}else{_0x4825b4({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x4825b4({'statusCode':0x194,'message':_0xd168('0x14')});}})[_0xd168('0x15')](function(_0x5ba456){logger[_0xd168('0x16')]('['+[_0x305ce7[_0xd168('0x17')]()]+']',_0x5ba456['message']);_0x4825b4(_0x5ba456);});});};}function searchContact(_0x1b39c5,_0x426573,_0x47d4cb,_0x2d3a91){return new Promise(function(_0x439244,_0x50f635){var _0x3348bd={'method':_0xd168('0xa'),'headers':_0x426573,'uri':_0x1b39c5+'/api/lookup?q='+_0x2d3a91+'&f='+_0x47d4cb+_0xd168('0x20'),'json':!![]};rp(_0x3348bd)['then'](function(_0x21b585){var _0x55176e=_[_0xd168('0x21')](_0x21b585[_0xd168('0x22')][_0xd168('0x22')],[_0x47d4cb,_0x2d3a91]);_0x439244(_0x55176e);})[_0xd168('0x15')](function(_0x4fd6a0){_0x50f635(_0x4fd6a0);});});}function getEndUser(_0x135df1,_0x51b063,_0x5e3895){return function(_0x287fe3){return new Promise(function(_0x1fef72,_0x53d46c){logger['info'](util['format'](_0xd168('0x23'),_0x287fe3[_0xd168('0x24')]));searchContact(_0x5e3895,_0x51b063,_0xd168('0x25'),_0x287fe3[_0xd168('0x24')])[_0xd168('0xf')](function(_0x476fa9){if(_0x476fa9){_0x287fe3[_0xd168('0x26')]=_0x476fa9['id'];logger[_0xd168('0xd')](_0xd168('0x27'),_0x287fe3[_0xd168('0x26')]);return _0x1fef72(_0x287fe3);}searchContact(_0x5e3895,_0x51b063,_0xd168('0x28'),_0x287fe3[_0xd168('0x24')])['then'](function(_0x379c7f){if(_0x379c7f){_0x287fe3['endUserId']=_0x379c7f['id'];logger[_0xd168('0xd')](_0xd168('0x29'),_0x287fe3[_0xd168('0x26')]);return _0x1fef72(_0x287fe3);}createEndUser(_0x287fe3,_0x135df1,_0x51b063,_0x5e3895)[_0xd168('0xf')](function(_0x2bc8e6){logger['info'](_0xd168('0x2a'),_0x2bc8e6[_0xd168('0x26')]);return _0x1fef72(_0x2bc8e6);});});})[_0xd168('0x15')](function(_0x23a972){_0x53d46c(_0x23a972);});});};}function createEndUser(_0x1ef8f1,_0x344492,_0x131292,_0xcf1514){return new Promise(function(_0x50ac84,_0x2591b0){var _0x3f371d=moment();var _0x48b16a={'method':_0xd168('0x2b'),'uri':_0xcf1514+'/api/contacts','body':{'contact':{'last_name':_0x1ef8f1['contactNumber'],'work_number':_0x1ef8f1[_0xd168('0x24')],'mobile_number':_0x1ef8f1['contactNumber'],'owner_id':_0x1ef8f1['userId'],'created_at':_0x3f371d[_0xd168('0x2c')](_0xd168('0x2d'))}},'json':!![]};_0x48b16a[_0xd168('0xc')]=_0x131292;logger[_0xd168('0xd')](_0xd168('0x2e'));return rp(_0x48b16a)[_0xd168('0xf')](function(_0xae6a57){_0x1ef8f1[_0xd168('0x26')]=_0xae6a57[_0xd168('0x2f')]['id'];_0x50ac84(_0x1ef8f1);})[_0xd168('0x15')](function(_0x17c5e2){logger[_0xd168('0x16')]('['+[_0x344492[_0xd168('0x17')]()]+']',_0x17c5e2[_0xd168('0x18')]);_0x2591b0(_0x17c5e2['message']);});});}function getTicket(_0xf6d435,_0x3ae6b8,_0x30e4d4,_0x2d9403,_0x482e14){return function(_0x2c94e0){logger[_0xd168('0xd')](_0xd168('0x30'));return new Promise(function(_0x402b20,_0xdeea2a){var _0x3f8e1b=moment();var _0x2e6fd9={'method':_0xd168('0x2b'),'uri':_0x30e4d4+_0xd168('0x31'),'body':{'title':intUtil[_0xd168('0x32')](_0x2d9403[_0xd168('0x33')],_0x482e14,'\x20'),'description':intUtil['getString'](_0x2d9403[_0xd168('0x34')],_0x482e14,'\x0a'),'owner_id':_0x2c94e0[_0xd168('0x1d')],'creater_id':_0x2c94e0['adminId'],'targetable_id':_0x2c94e0[_0xd168('0x26')],'targetable_type':_0xd168('0x35'),'created_at':_0x3f8e1b[_0xd168('0x2c')](_0xd168('0x2d')),'due_date':_0x3f8e1b[_0xd168('0x36')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x2e6fd9[_0xd168('0xc')]=_0x3ae6b8;return rp(_0x2e6fd9)[_0xd168('0xf')](function(_0x4ab3ba){_0x2c94e0['ticketId']=_0x4ab3ba[_0xd168('0x37')]['id'];logger[_0xd168('0xd')]('Task\x20created:',_0x2c94e0[_0xd168('0x38')]);_0x402b20(_0x2c94e0);})[_0xd168('0x15')](function(_0x364949){logger[_0xd168('0x16')]('['+[_0xf6d435['toUpperCase']()]+']',_0x364949['message']);_0xdeea2a(_0x364949[_0xd168('0x18')]);});});};}function emit(_0x17a500,_0x136c50,_0x46e7f2){var _0x1fa2bb={'uri':_0x17a500+'/contacts/'+_0x46e7f2};io['to'](util[_0xd168('0x2c')](_0xd168('0x39'),_0x136c50))[_0xd168('0x3a')]('trigger:browser:url',_0x1fa2bb);}exports['cs']=function(_0x27a7fc,_0x431287,_0x224679,_0xea5eb1,_0x2b55ae,_0xcf117,_0x2dacd2,_0x3a803b){var _0x3f9cb3={};var _0x546acd={'Authorization':_0xd168('0x3b')+_0xcf117[_0xd168('0x3c')]};_0xcf117[_0xd168('0x3d')]=intUtil[_0xd168('0x3e')](_0xcf117[_0xd168('0x3d')]);_0xcf117[_0xd168('0x3f')]=intUtil[_0xd168('0x3e')](_0xcf117[_0xd168('0x3f')]);var _0x2f6831=_0xcf117[_0xd168('0x3d')];_0x3f9cb3[_0xd168('0x12')]=_0xcf117[_0xd168('0x40')];_0x3f9cb3[_0xd168('0x24')]=_0x3a803b[_0xd168('0x41')]()===_0xd168('0x42')?_0x431287[_0xd168('0x43')]:_0x431287[_0xd168('0x44')];_0x3f9cb3[_0xd168('0x45')]=_0x3a803b==='queue'||_0x3a803b==='unmanaged'?_0xd168('0x46'):'outbound';if(_0xea5eb1){_0x3f9cb3[_0xd168('0x1a')]=_0xea5eb1['email'];}var _0x1e1c02=util[_0xd168('0x2c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xcf117['serverUrl'],_0x431287[_0xd168('0x47')],md5(_0x431287[_0xd168('0x47')]));if(_0x2b55ae&&_0x2b55ae[_0xd168('0x48')]){logger[_0xd168('0xd')](_0xd168('0x49'),_0xd168('0x4a'));_0x431287[_0xd168('0x4b')]=_0x1e1c02;}else if(_0x2dacd2&&_0x2dacd2[_0xd168('0x4c')]&&_0x2dacd2[_0xd168('0x4c')]!==_0xd168('0x4d')){logger[_0xd168('0xd')](_0xd168('0x4e'),_0xd168('0x4a'));_0x431287['recordingURL']=_0x1e1c02;}else{_0x431287[_0xd168('0x4b')]='';}return getAdminId(_0x3f9cb3,_0x3a803b,_0x546acd,_0x2f6831)['then'](getUser(_0x3a803b,_0x546acd,_0x2f6831))[_0xd168('0xf')](getEndUser(_0x3a803b,_0x546acd,_0x2f6831))[_0xd168('0xf')](getTicket(_0x3a803b,_0x546acd,_0x2f6831,_0x224679,_0x431287))[_0xd168('0xf')](function(_0x5ef21e){logger['info'](util[_0xd168('0x2c')](_0xd168('0x4f'),_0x5ef21e[_0xd168('0x38')]));if(_0x3a803b!=='unmanaged'){logger[_0xd168('0xd')]('['+[_0x3a803b[_0xd168('0x17')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x2f6831,_0xea5eb1['name'],_0x5ef21e[_0xd168('0x26')]);}})[_0xd168('0x15')](function(_0x36ed20){logger[_0xd168('0x16')]('['+[_0x3a803b[_0xd168('0x17')]()]+_0xd168('0x50'),util[_0xd168('0x51')](_0x36ed20,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5c9b=['ticketId','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','outbound','calleridnum','callDirection','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','util','moment','bluebird','ioredis','freshsales','defaults','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','info','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','userEmail','userId','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','Contact','add','YYYY-MM-DDTHH:mm:ss','task','Task\x20created:'];(function(_0x4eab9a,_0x5bbc9a){var _0x147dc5=function(_0x4f2a48){while(--_0x4f2a48){_0x4eab9a['push'](_0x4eab9a['shift']());}};_0x147dc5(++_0x5bbc9a);}(_0x5c9b,0x10b));var _0xb5c9=function(_0x2dd204,_0x428dd2){_0x2dd204=_0x2dd204-0x0;var _0x311dcb=_0x5c9b[_0x2dd204];return _0x311dcb;};'use strict';var _=require(_0xb5c9('0x0'));var rp=require(_0xb5c9('0x1'));var md5=require('md5');var util=require(_0xb5c9('0x2'));var moment=require(_0xb5c9('0x3'));var Promise=require(_0xb5c9('0x4'));var Redis=require(_0xb5c9('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xb5c9('0x6'));config['redis']=_[_0xb5c9('0x7')](config[_0xb5c9('0x8')],{'host':_0xb5c9('0x9'),'port':0x18eb});var io=require(_0xb5c9('0xa'))(new Redis(config[_0xb5c9('0x8')]));function getAdminId(_0x257ef9,_0xd48346,_0x43b4c3,_0x5c103c){return new Promise(function(_0x1ed4f1,_0x7834b0){var _0x318c94=![];var _0x47ac42={'method':_0xb5c9('0xb'),'uri':_0x5c103c+_0xb5c9('0xc'),'json':!![]};_0x47ac42[_0xb5c9('0xd')]=_0x43b4c3;logger['info'](_0xb5c9('0xe'));return rp(_0x47ac42)[_0xb5c9('0xf')](function(_0x571328){if(_0x571328){var _0x3028d9=_0x571328[_0xb5c9('0x10')];var _0x5ac0c7=null;for(_0x5ac0c7=0x0;_0x5ac0c7<_0x3028d9[_0xb5c9('0x11')];_0x5ac0c7++){if(_0x3028d9[_0x5ac0c7][_0xb5c9('0x12')]===_0x257ef9[_0xb5c9('0x13')]){_0x257ef9[_0xb5c9('0x14')]=_0x3028d9[_0x5ac0c7]['id'];_0x318c94=!![];}}if(_0x318c94){logger[_0xb5c9('0x15')]('Admin\x20found:',_0x257ef9['adminId']);_0x1ed4f1(_0x257ef9);}else{_0x7834b0({'statusCode':0x194,'message':_0xb5c9('0x16')});}}else{_0x7834b0({'statusCode':0x194,'message':_0xb5c9('0x16')});}})[_0xb5c9('0x17')](function(_0x4dacca){logger[_0xb5c9('0x18')]('['+[_0xd48346[_0xb5c9('0x19')]()]+']',_0x4dacca[_0xb5c9('0x1a')]);_0x7834b0(_0x4dacca);});});}function getUser(_0x52bc48,_0x16c640,_0x355567){return function(_0x4f60eb){return new Promise(function(_0x48fe2b,_0x3ced17){var _0x1054b3={'method':_0xb5c9('0xb'),'uri':_0x355567+_0xb5c9('0xc'),'json':!![]};_0x1054b3[_0xb5c9('0xd')]=_0x16c640;logger[_0xb5c9('0x15')](_0xb5c9('0x1b'));return rp(_0x1054b3)[_0xb5c9('0xf')](function(_0x45e1ee){if(_0x45e1ee){var _0x5d36ee=_0x45e1ee[_0xb5c9('0x10')];var _0x4aea4a=![];var _0x457f46=null;if(_0x4f60eb['agentEmail']!==null){logger[_0xb5c9('0x15')]('Getting\x20user\x20with\x20email',_0x4f60eb[_0xb5c9('0x1c')]);_0x4f60eb[_0xb5c9('0x1d')]=_0x4f60eb['agentEmail'];for(_0x457f46=0x0;_0x457f46<_0x5d36ee[_0xb5c9('0x11')];_0x457f46++){if(_0x5d36ee[_0x457f46][_0xb5c9('0x12')]===_0x4f60eb[_0xb5c9('0x1c')]){_0x4aea4a=!![];_0x4f60eb[_0xb5c9('0x1e')]=_0x5d36ee[_0x457f46]['id'];logger[_0xb5c9('0x15')]('User\x20found:',_0x4f60eb[_0xb5c9('0x1e')]);}}}if(!_0x4aea4a){logger['info'](_0xb5c9('0x1f'));_0x4f60eb[_0xb5c9('0x1d')]=_0x4f60eb[_0xb5c9('0x13')];_0x4f60eb[_0xb5c9('0x1e')]=_0x4f60eb['adminId'];_0x4aea4a=!![];}if(_0x4aea4a){_0x48fe2b(_0x4f60eb);}else{_0x3ced17({'statusCode':0x194,'message':_0xb5c9('0x16')});}}else{_0x3ced17({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xb5c9('0x17')](function(_0x2cd14a){logger['error']('['+[_0x52bc48[_0xb5c9('0x19')]()]+']',_0x2cd14a['message']);_0x3ced17(_0x2cd14a);});});};}function searchContact(_0xeabb92,_0x2cfa9d,_0x693050,_0x250657){return new Promise(function(_0x559a9f,_0x5ebb9f){var _0x6edc62={'method':_0xb5c9('0xb'),'headers':_0x2cfa9d,'uri':_0xeabb92+_0xb5c9('0x20')+_0x250657+_0xb5c9('0x21')+_0x693050+_0xb5c9('0x22'),'json':!![]};rp(_0x6edc62)[_0xb5c9('0xf')](function(_0x515286){var _0xb23e0c=_[_0xb5c9('0x23')](_0x515286[_0xb5c9('0x24')]['contacts'],[_0x693050,_0x250657]);_0x559a9f(_0xb23e0c);})[_0xb5c9('0x17')](function(_0x5cbab0){_0x5ebb9f(_0x5cbab0);});});}function getEndUser(_0x3715e7,_0x1f95d6,_0x263443){return function(_0x34710c){return new Promise(function(_0x3ac6e8,_0x105f69){logger[_0xb5c9('0x15')](util[_0xb5c9('0x25')](_0xb5c9('0x26'),_0x34710c[_0xb5c9('0x27')]));searchContact(_0x263443,_0x1f95d6,_0xb5c9('0x28'),_0x34710c['contactNumber'])['then'](function(_0x3d98e2){if(_0x3d98e2){_0x34710c[_0xb5c9('0x29')]=_0x3d98e2['id'];logger['info']('Contact\x20found\x20mobile_number:',_0x34710c[_0xb5c9('0x29')]);return _0x3ac6e8(_0x34710c);}searchContact(_0x263443,_0x1f95d6,_0xb5c9('0x2a'),_0x34710c['contactNumber'])[_0xb5c9('0xf')](function(_0x2fd257){if(_0x2fd257){_0x34710c[_0xb5c9('0x29')]=_0x2fd257['id'];logger[_0xb5c9('0x15')](_0xb5c9('0x2b'),_0x34710c[_0xb5c9('0x29')]);return _0x3ac6e8(_0x34710c);}createEndUser(_0x34710c,_0x3715e7,_0x1f95d6,_0x263443)[_0xb5c9('0xf')](function(_0x296571){logger[_0xb5c9('0x15')]('Contact\x20created:',_0x296571['endUserId']);return _0x3ac6e8(_0x296571);});});})[_0xb5c9('0x17')](function(_0x2ac294){_0x105f69(_0x2ac294);});});};}function createEndUser(_0xd122f3,_0x47f25b,_0x57d2f1,_0x362a66){return new Promise(function(_0x4f3ecf,_0x4caf4a){var _0x3adb29=moment();var _0x3488dd={'method':'POST','uri':_0x362a66+'/api/contacts','body':{'contact':{'last_name':_0xd122f3[_0xb5c9('0x27')],'work_number':_0xd122f3[_0xb5c9('0x27')],'mobile_number':_0xd122f3[_0xb5c9('0x27')],'owner_id':_0xd122f3['userId'],'created_at':_0x3adb29[_0xb5c9('0x25')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x3488dd[_0xb5c9('0xd')]=_0x57d2f1;logger[_0xb5c9('0x15')](_0xb5c9('0x2c'));return rp(_0x3488dd)['then'](function(_0x17e041){_0xd122f3[_0xb5c9('0x29')]=_0x17e041[_0xb5c9('0x2d')]['id'];_0x4f3ecf(_0xd122f3);})[_0xb5c9('0x17')](function(_0x36f243){logger['error']('['+[_0x47f25b[_0xb5c9('0x19')]()]+']',_0x36f243['message']);_0x4caf4a(_0x36f243[_0xb5c9('0x1a')]);});});}function getTicket(_0x4d2195,_0x4fc1b9,_0x93a7f6,_0x1c3baa,_0x5a6597){return function(_0x287c2c){logger[_0xb5c9('0x15')](_0xb5c9('0x2e'));return new Promise(function(_0x498060,_0x33fbd3){var _0x5a384f=moment();var _0xed06df={'method':_0xb5c9('0x2f'),'uri':_0x93a7f6+_0xb5c9('0x30'),'body':{'title':intUtil[_0xb5c9('0x31')](_0x1c3baa[_0xb5c9('0x32')],_0x5a6597,'\x20'),'description':intUtil[_0xb5c9('0x31')](_0x1c3baa[_0xb5c9('0x33')],_0x5a6597,'\x0a'),'owner_id':_0x287c2c[_0xb5c9('0x1e')],'creater_id':_0x287c2c[_0xb5c9('0x14')],'targetable_id':_0x287c2c[_0xb5c9('0x29')],'targetable_type':_0xb5c9('0x34'),'created_at':_0x5a384f[_0xb5c9('0x25')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x5a384f[_0xb5c9('0x35')](0x1e,'m')[_0xb5c9('0x25')](_0xb5c9('0x36'))},'json':!![]};_0xed06df[_0xb5c9('0xd')]=_0x4fc1b9;return rp(_0xed06df)[_0xb5c9('0xf')](function(_0x709167){_0x287c2c['ticketId']=_0x709167[_0xb5c9('0x37')]['id'];logger['info'](_0xb5c9('0x38'),_0x287c2c[_0xb5c9('0x39')]);_0x498060(_0x287c2c);})[_0xb5c9('0x17')](function(_0x44faa0){logger[_0xb5c9('0x18')]('['+[_0x4d2195[_0xb5c9('0x19')]()]+']',_0x44faa0[_0xb5c9('0x1a')]);_0x33fbd3(_0x44faa0['message']);});});};}function emit(_0x26835b,_0x559ef7,_0x4aff38){var _0x902620={'uri':_0x26835b+'/contacts/'+_0x4aff38};io['to'](util['format'](_0xb5c9('0x3a'),_0x559ef7))['emit'](_0xb5c9('0x3b'),_0x902620);}exports['cs']=function(_0x5cf8c8,_0x27c18a,_0x41bbd6,_0x422fbb,_0x9b3b1b,_0x401ec4,_0x5e0ed9,_0x30ef6d){var _0x4072ad={};var _0x5b46f2={'Authorization':_0xb5c9('0x3c')+_0x401ec4[_0xb5c9('0x3d')]};_0x401ec4[_0xb5c9('0x3e')]=intUtil[_0xb5c9('0x3f')](_0x401ec4[_0xb5c9('0x3e')]);_0x401ec4[_0xb5c9('0x40')]=intUtil[_0xb5c9('0x3f')](_0x401ec4[_0xb5c9('0x40')]);var _0x558545=_0x401ec4[_0xb5c9('0x3e')];_0x4072ad[_0xb5c9('0x13')]=_0x401ec4['username'];_0x4072ad[_0xb5c9('0x27')]=_0x30ef6d['toLowerCase']()===_0xb5c9('0x41')?_0x27c18a['destcalleridnum']:_0x27c18a[_0xb5c9('0x42')];_0x4072ad[_0xb5c9('0x43')]=_0x30ef6d==='queue'||_0x30ef6d===_0xb5c9('0x44')?'queue':_0xb5c9('0x41');if(_0x422fbb){_0x4072ad['agentEmail']=_0x422fbb[_0xb5c9('0x12')];}var _0x489ce0=util[_0xb5c9('0x25')](_0xb5c9('0x45'),_0x401ec4['serverUrl'],_0x27c18a[_0xb5c9('0x46')],md5(_0x27c18a[_0xb5c9('0x46')]));if(_0x9b3b1b&&_0x9b3b1b['monitor_format']){logger[_0xb5c9('0x15')](_0xb5c9('0x47'),_0xb5c9('0x48'));_0x27c18a[_0xb5c9('0x49')]=_0x489ce0;}else if(_0x5e0ed9&&_0x5e0ed9[_0xb5c9('0x4a')]&&_0x5e0ed9['recordingFormat']!==_0xb5c9('0x4b')){logger[_0xb5c9('0x15')](_0xb5c9('0x4c'),_0xb5c9('0x48'));_0x27c18a[_0xb5c9('0x49')]=_0x489ce0;}else{_0x27c18a['recordingURL']='';}return getAdminId(_0x4072ad,_0x30ef6d,_0x5b46f2,_0x558545)[_0xb5c9('0xf')](getUser(_0x30ef6d,_0x5b46f2,_0x558545))[_0xb5c9('0xf')](getEndUser(_0x30ef6d,_0x5b46f2,_0x558545))['then'](getTicket(_0x30ef6d,_0x5b46f2,_0x558545,_0x41bbd6,_0x27c18a))['then'](function(_0x2abc09){logger[_0xb5c9('0x15')](util[_0xb5c9('0x25')](_0xb5c9('0x4d'),_0x2abc09[_0xb5c9('0x39')]));if(_0x30ef6d!=='unmanaged'){logger['info']('['+[_0x30ef6d['toUpperCase']()]+']',_0xb5c9('0x4e'));emit(_0x558545,_0x422fbb[_0xb5c9('0x4f')],_0x2abc09[_0xb5c9('0x29')]);}})[_0xb5c9('0x17')](function(_0x131cfb){logger[_0xb5c9('0x18')]('['+[_0x30ef6d[_0xb5c9('0x19')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xb5c9('0x50')](_0x131cfb,{'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 40d7dbd..df2ee0e 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 _0x7875=['desk','vtiger','dynamics365','freshsales','servicenow','includes','data1','toLowerCase','data2','find','data3','routeId','outbound','log','zendesk','unknown\x20integration','../../../../config/logger','error','format','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./freshsales','salesforce','sugarcrm','freshdesk','zoho'];(function(_0x15e895,_0x40230f){var _0x411ae4=function(_0x39056b){while(--_0x39056b){_0x15e895['push'](_0x15e895['shift']());}};_0x411ae4(++_0x40230f);}(_0x7875,0xa5));var _0x5787=function(_0x31ded1,_0x5c631c){_0x31ded1=_0x31ded1-0x0;var _0x55b22d=_0x7875[_0x31ded1];return _0x55b22d;};'use strict';var _=require(_0x5787('0x0'));var util=require(_0x5787('0x1'));var zendesk=require(_0x5787('0x2'));var salesforce=require(_0x5787('0x3'));var sugarcrm=require(_0x5787('0x4'));var freshdesk=require(_0x5787('0x5'));var zoho=require(_0x5787('0x6'));var desk=require(_0x5787('0x7'));var vtiger=require(_0x5787('0x8'));var servicenow=require(_0x5787('0x9'));var dynamics365=require('./dynamics365');var freshsales=require(_0x5787('0xa'));var integrations=['zendesk',_0x5787('0xb'),_0x5787('0xc'),_0x5787('0xd'),_0x5787('0xe'),_0x5787('0xf'),_0x5787('0x10'),_0x5787('0x11'),_0x5787('0x12'),_0x5787('0x13')];exports['exec']=function(_0x1211cf,_0x493975,_0x233f29,_0x1ea016,_0x5d3611,_0x25f70){if(_0x233f29){if(_[_0x5787('0x14')](integrations,_0x1211cf[_0x5787('0x15')][_0x5787('0x16')]())){try{var _0x3d4e2c=null;var _0x97852a='';var _0x4ac615=_0x233f29[_0x1211cf['data1'][_0x5787('0x16')]()];if(_0x4ac615){var _0x51d5b9=_0x4ac615[_0x1211cf[_0x5787('0x17')]];if(_0x51d5b9){var _0x3b1ef4=_[_0x5787('0x18')](_0x51d5b9['Configurations'],{'id':parseInt(_0x1211cf[_0x5787('0x19')],0xa)});if(_0x3b1ef4){if(_0x1ea016){if(_0x5d3611&&_0x493975['queue']){_0x97852a='queue';}else if(_0x493975[_0x5787('0x1a')]){_0x97852a=_0x5787('0x1b');}else{console[_0x5787('0x1c')]('EVENT\x20UNKNOWN',_0x493975);}}else{_0x97852a='unmanaged';}switch(_0x1211cf[_0x5787('0x15')]['toLowerCase']()){case _0x5787('0x1d'):zendesk[_0x97852a](_0x1211cf,_0x493975,_0x3b1ef4,_0x1ea016,_0x5d3611,_0x51d5b9,_0x25f70);break;case _0x5787('0xb'):salesforce[_0x97852a](_0x1211cf,_0x493975,_0x3b1ef4,_0x1ea016,_0x5d3611,_0x51d5b9,_0x25f70);break;case _0x5787('0xc'):sugarcrm[_0x97852a](_0x1211cf,_0x493975,_0x3b1ef4,_0x1ea016,_0x5d3611,_0x51d5b9,_0x25f70);break;case _0x5787('0xd'):freshdesk[_0x97852a](_0x1211cf,_0x493975,_0x3b1ef4,_0x1ea016,_0x5d3611,_0x51d5b9,_0x25f70);break;case _0x5787('0xe'):zoho[_0x97852a](_0x1211cf,_0x493975,_0x3b1ef4,_0x1ea016,_0x5d3611,_0x51d5b9,_0x25f70);break;case _0x5787('0xf'):desk[_0x97852a](_0x1211cf,_0x493975,_0x3b1ef4,_0x1ea016,_0x5d3611,_0x51d5b9,_0x25f70);break;case _0x5787('0x10'):vtiger[_0x97852a](_0x1211cf,_0x493975,_0x3b1ef4,_0x1ea016,_0x5d3611,_0x51d5b9,_0x25f70);break;case _0x5787('0x12'):freshsales['cs'](_0x1211cf,_0x493975,_0x3b1ef4,_0x1ea016,_0x5d3611,_0x51d5b9,_0x25f70,_0x97852a);break;case _0x5787('0x13'):servicenow['cs'](_0x1211cf,_0x493975,_0x3b1ef4,_0x1ea016,_0x5d3611,_0x51d5b9,_0x25f70,_0x97852a);break;case _0x5787('0x11'):dynamics365['cs'](_0x1211cf,_0x493975,_0x3b1ef4,_0x1ea016,_0x5d3611,_0x51d5b9,_0x25f70,_0x97852a);break;default:console[_0x5787('0x1c')](_0x5787('0x1e'));}}else{_0x3d4e2c=require(_0x5787('0x1f'))(_0x1211cf[_0x5787('0x15')][_0x5787('0x16')]());_0x3d4e2c[_0x5787('0x20')]('[EXEC]',util[_0x5787('0x21')]('%s\x20configuration\x20#%s\x20not\x20found',_0x1211cf[_0x5787('0x15')][_0x5787('0x16')](),_0x1211cf[_0x5787('0x19')]));}}else{_0x3d4e2c=require('../../../../config/logger')(_0x1211cf['data1'][_0x5787('0x16')]());_0x3d4e2c[_0x5787('0x20')](_0x5787('0x22'),util[_0x5787('0x21')](_0x5787('0x23'),_0x1211cf[_0x5787('0x15')][_0x5787('0x16')](),_0x1211cf[_0x5787('0x17')]));}}else{}}catch(_0x3800d2){console[_0x5787('0x20')](_0x3800d2);}}}}; \ No newline at end of file +var _0x369c=['data2','find','Configurations','data3','outbound','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','includes','data1','toLowerCase'];(function(_0x4e429b,_0x21d28d){var _0x456f0e=function(_0x549afc){while(--_0x549afc){_0x4e429b['push'](_0x4e429b['shift']());}};_0x456f0e(++_0x21d28d);}(_0x369c,0x151));var _0xc369=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x369c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc369('0x0'));var util=require(_0xc369('0x1'));var zendesk=require(_0xc369('0x2'));var salesforce=require(_0xc369('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xc369('0x4'));var zoho=require(_0xc369('0x5'));var desk=require(_0xc369('0x6'));var vtiger=require(_0xc369('0x7'));var servicenow=require(_0xc369('0x8'));var dynamics365=require('./dynamics365');var freshsales=require(_0xc369('0x9'));var integrations=[_0xc369('0xa'),_0xc369('0xb'),_0xc369('0xc'),_0xc369('0xd'),_0xc369('0xe'),_0xc369('0xf'),_0xc369('0x10'),_0xc369('0x11'),_0xc369('0x12'),_0xc369('0x13')];exports['exec']=function(_0xcb8699,_0x587db0,_0x21fe13,_0x25aad2,_0x4264d9,_0x457b5a){if(_0x21fe13){if(_[_0xc369('0x14')](integrations,_0xcb8699[_0xc369('0x15')][_0xc369('0x16')]())){try{var _0x23ff2f=null;var _0x35f2d0='';var _0x329f11=_0x21fe13[_0xcb8699[_0xc369('0x15')][_0xc369('0x16')]()];if(_0x329f11){var _0x444faf=_0x329f11[_0xcb8699[_0xc369('0x17')]];if(_0x444faf){var _0x2e1681=_[_0xc369('0x18')](_0x444faf[_0xc369('0x19')],{'id':parseInt(_0xcb8699[_0xc369('0x1a')],0xa)});if(_0x2e1681){if(_0x25aad2){if(_0x4264d9&&_0x587db0['queue']){_0x35f2d0='queue';}else if(_0x587db0['routeId']){_0x35f2d0=_0xc369('0x1b');}else{console[_0xc369('0x1c')]('EVENT\x20UNKNOWN',_0x587db0);}}else{_0x35f2d0='unmanaged';}switch(_0xcb8699[_0xc369('0x15')][_0xc369('0x16')]()){case'zendesk':zendesk[_0x35f2d0](_0xcb8699,_0x587db0,_0x2e1681,_0x25aad2,_0x4264d9,_0x444faf,_0x457b5a);break;case _0xc369('0xb'):salesforce[_0x35f2d0](_0xcb8699,_0x587db0,_0x2e1681,_0x25aad2,_0x4264d9,_0x444faf,_0x457b5a);break;case _0xc369('0xc'):sugarcrm[_0x35f2d0](_0xcb8699,_0x587db0,_0x2e1681,_0x25aad2,_0x4264d9,_0x444faf,_0x457b5a);break;case _0xc369('0xd'):freshdesk[_0x35f2d0](_0xcb8699,_0x587db0,_0x2e1681,_0x25aad2,_0x4264d9,_0x444faf,_0x457b5a);break;case _0xc369('0xe'):zoho[_0x35f2d0](_0xcb8699,_0x587db0,_0x2e1681,_0x25aad2,_0x4264d9,_0x444faf,_0x457b5a);break;case'desk':desk[_0x35f2d0](_0xcb8699,_0x587db0,_0x2e1681,_0x25aad2,_0x4264d9,_0x444faf,_0x457b5a);break;case _0xc369('0x10'):vtiger[_0x35f2d0](_0xcb8699,_0x587db0,_0x2e1681,_0x25aad2,_0x4264d9,_0x444faf,_0x457b5a);break;case _0xc369('0x12'):freshsales['cs'](_0xcb8699,_0x587db0,_0x2e1681,_0x25aad2,_0x4264d9,_0x444faf,_0x457b5a,_0x35f2d0);break;case'servicenow':servicenow['cs'](_0xcb8699,_0x587db0,_0x2e1681,_0x25aad2,_0x4264d9,_0x444faf,_0x457b5a,_0x35f2d0);break;case _0xc369('0x11'):dynamics365['cs'](_0xcb8699,_0x587db0,_0x2e1681,_0x25aad2,_0x4264d9,_0x444faf,_0x457b5a,_0x35f2d0);break;default:console[_0xc369('0x1c')](_0xc369('0x1d'));}}else{_0x23ff2f=require(_0xc369('0x1e'))(_0xcb8699[_0xc369('0x15')][_0xc369('0x16')]());_0x23ff2f[_0xc369('0x1f')](_0xc369('0x20'),util[_0xc369('0x21')](_0xc369('0x22'),_0xcb8699[_0xc369('0x15')][_0xc369('0x16')](),_0xcb8699[_0xc369('0x1a')]));}}else{_0x23ff2f=require('../../../../config/logger')(_0xcb8699[_0xc369('0x15')][_0xc369('0x16')]());_0x23ff2f[_0xc369('0x1f')](_0xc369('0x20'),util['format'](_0xc369('0x23'),_0xcb8699[_0xc369('0x15')][_0xc369('0x16')](),_0xcb8699[_0xc369('0x17')]));}}else{}}catch(_0x2a4d06){console['error'](_0x2a4d06);}}}}; \ 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 8fcda9e..d7b8abd 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 _0x6afb=['[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','none','destcalleridname','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','[OUTBOUND]','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','util','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','contact','endUserType','account','WhatId','Case','AccountId','leadId','info','sobject','create','isNil','validateEmail','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','lead','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','LastName','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','error'];(function(_0x67fb07,_0xa7e0c2){var _0x11206a=function(_0x5b691d){while(--_0x5b691d){_0x67fb07['push'](_0x67fb07['shift']());}};_0x11206a(++_0xa7e0c2);}(_0x6afb,0x119));var _0xb6af=function(_0x266dab,_0x211142){_0x266dab=_0x266dab-0x0;var _0x2acc69=_0x6afb[_0x266dab];return _0x2acc69;};'use strict';var _=require(_0xb6af('0x0'));var rp=require(_0xb6af('0x1'));var moment=require(_0xb6af('0x2'));var BPromise=require(_0xb6af('0x3'));var md5=require('md5');var jsforce=require(_0xb6af('0x4'));var util=require(_0xb6af('0x5'));var Redis=require(_0xb6af('0x6'));var intUtil=require(_0xb6af('0x7'));var config=require('../../../../config/environment');var logger=require(_0xb6af('0x8'))(_0xb6af('0x9'));config[_0xb6af('0xa')]=_[_0xb6af('0xb')](config[_0xb6af('0xa')],{'host':_0xb6af('0xc'),'port':0x18eb});var io=require(_0xb6af('0xd'))(new Redis(config['redis']));function emit(_0x24e638,_0x562ffe,_0x286e43){io['to'](_0x24e638)[_0xb6af('0xe')](_0x562ffe,_0x286e43);}function getTicket(_0x4fed26,_0x52a183,_0x323c9d,_0x184b33,_0x19f4d9,_0x4dbb78,_0xc6466b,_0x2b0bd1){var _0x1cda31=Object['assign']({},{'OwnerId':_0x52a183['id'],'Subject':intUtil[_0xb6af('0xf')](_0x184b33[_0xb6af('0x10')],_0x19f4d9,'\x20'),'Description':intUtil[_0xb6af('0xf')](_0x184b33[_0xb6af('0x11')],_0x19f4d9,'\x0a')},getCustomFields(_0x4dbb78,_0x19f4d9));if(_0x323c9d){if(_0x184b33[_0xb6af('0x12')]===_0xb6af('0x13')){_0x1cda31[_0xb6af('0x14')]=moment[_0xb6af('0x15')]();_0x1cda31['IsReminderSet']=![];_0x1cda31[_0xb6af('0x16')]=![];if(_0x323c9d['endUserType']===_0xb6af('0x17')||_0x323c9d[_0xb6af('0x18')]==='lead'){_0x1cda31['WhoId']=_0x323c9d['id'];}else if(_0x323c9d[_0xb6af('0x18')]===_0xb6af('0x19')){_0x1cda31[_0xb6af('0x1a')]=_0x323c9d['id'];}}else if(_0x184b33['ticketType']===_0xb6af('0x1b')){if(_0x323c9d[_0xb6af('0x18')]===_0xb6af('0x17')){_0x1cda31['ContactId']=_0x323c9d['id'];}else if(_0x323c9d[_0xb6af('0x18')]===_0xb6af('0x19')){_0x1cda31[_0xb6af('0x1c')]=_0x323c9d['id'];}else if(_0x323c9d[_0xb6af('0x18')]==='lead'&&_0x184b33[_0xb6af('0x1d')]){_0x1cda31[_0x184b33[_0xb6af('0x1d')]]=_0x323c9d['id'];}else{logger[_0xb6af('0x1e')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0xc6466b[_0xb6af('0x1f')](_0x184b33[_0xb6af('0x12')])[_0xb6af('0x20')](_0x1cda31);}function getUser(_0x2a53da,_0x4806b1,_0x1b75b3){if(!_[_0xb6af('0x21')](_0x4806b1)&&intUtil[_0xb6af('0x22')](_0x4806b1)){var _0xc70fe={'Email':_0x4806b1};var _0x5d8e95={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1b75b3['sobject']('User')[_0xb6af('0x23')](_0xc70fe,_0x5d8e95)[_0xb6af('0x24')]()[_0xb6af('0x25')](function(_0x4bb3cf){if(_0x4bb3cf[_0xb6af('0x26')]){var _0x565650=_[_0xb6af('0x23')](_0x4bb3cf,function(_0x5495b3){return _0x5495b3[_0xb6af('0x27')]===_0x4806b1;});if(_0x565650){logger[_0xb6af('0x1e')](_0xb6af('0x28'),_0x4806b1);return BPromise[_0xb6af('0x29')]({'id':_0x565650['Id'],'name':_0x565650[_0xb6af('0x2a')]});}}else{logger[_0xb6af('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x4806b1);return _0x1b75b3[_0xb6af('0x2b')]()[_0xb6af('0x25')](function(_0x2da2ed){return BPromise[_0xb6af('0x29')]({'id':_0x2da2ed[_0xb6af('0x2c')],'name':_0x2da2ed[_0xb6af('0x2d')]});});}});}else{logger[_0xb6af('0x1e')](_0xb6af('0x2e'),_0x4806b1);return _0x1b75b3[_0xb6af('0x2b')]()[_0xb6af('0x25')](function(_0xa7a28f){return BPromise['resolve']({'id':_0xa7a28f[_0xb6af('0x2c')],'name':_0xa7a28f[_0xb6af('0x2d')]});});}}function getEndUser(_0x29d2f2,_0x27e4b4,_0x5074bb,_0x1dd913,_0x4e2b87){var _0x463bd3={'$or':{'Phone':_0x1dd913}};var _0x100244={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xb6af('0x29')]()[_0xb6af('0x25')](function(){logger['info'](_0xb6af('0x2f'),_0x1dd913,_0x27e4b4[_0xb6af('0x30')]);switch(_0x27e4b4[_0xb6af('0x30')]){case _0xb6af('0x31'):var _0x426497=_[_0xb6af('0x32')](_0x463bd3);if(_0x27e4b4[_0xb6af('0x33')]){var _0x33387f={};_0x33387f[_0x27e4b4[_0xb6af('0x33')]]=_0x1dd913;_[_0xb6af('0x34')](_0x426497['$or'],_0x33387f);}return _0x4e2b87[_0xb6af('0x1f')]('Contact')[_0xb6af('0x23')](_0x426497,_0x100244)['execute']()[_0xb6af('0x25')](function(_0x28c451){if(_0x28c451&&_0x28c451[_0xb6af('0x26')]){return _0x28c451;}else{var _0x43ce04=_[_0xb6af('0x32')](_0x463bd3);if(_0x27e4b4[_0xb6af('0x35')]){var _0x3c5434={};_0x3c5434[_0x27e4b4[_0xb6af('0x35')]]=_0x1dd913;_[_0xb6af('0x34')](_0x43ce04[_0xb6af('0x36')],_0x3c5434);}return _0x4e2b87['sobject'](_0xb6af('0x37'))[_0xb6af('0x23')](_0x43ce04,_0x100244);}});case _0xb6af('0x38'):var _0x31dfcb=_['cloneDeep'](_0x463bd3);if(_0x27e4b4['additionalSearchAccount']){var _0x33387f={};_0x33387f[_0x27e4b4[_0xb6af('0x39')]]=_0x1dd913;_[_0xb6af('0x34')](_0x31dfcb['$or'],_0x33387f);}return _0x4e2b87[_0xb6af('0x1f')](_0xb6af('0x3a'))[_0xb6af('0x23')](_0x31dfcb,_0x100244)['execute']()[_0xb6af('0x25')](function(_0x20bef3){if(_0x20bef3&&_0x20bef3[_0xb6af('0x26')]){return _0x20bef3;}else{var _0x24e757=_[_0xb6af('0x32')](_0x463bd3);if(_0x27e4b4['additionalSearchContact']){var _0x152bf8={};_0x152bf8[_0x27e4b4[_0xb6af('0x33')]]=_0x1dd913;_[_0xb6af('0x34')](_0x24e757[_0xb6af('0x36')],_0x152bf8);}return _0x4e2b87['sobject'](_0xb6af('0x3b'))[_0xb6af('0x23')](_0x24e757,_0x100244)[_0xb6af('0x25')](function(_0xca5941){if(_0xca5941&&_0xca5941[_0xb6af('0x26')]){return _0xca5941;}else{var _0x1045c8=_[_0xb6af('0x32')](_0x463bd3);if(_0x27e4b4[_0xb6af('0x35')]){var _0x594c01={};_0x594c01[_0x27e4b4['additionalSearchLead']]=_0x1dd913;_[_0xb6af('0x34')](_0x1045c8[_0xb6af('0x36')],_0x594c01);}return _0x4e2b87[_0xb6af('0x1f')](_0xb6af('0x37'))['find'](_0x1045c8,_0x100244);}});}});case _0xb6af('0x17'):var _0x426497=_[_0xb6af('0x32')](_0x463bd3);if(_0x27e4b4[_0xb6af('0x33')]){var _0x33387f={};_0x33387f[_0x27e4b4[_0xb6af('0x33')]]=_0x1dd913;_[_0xb6af('0x34')](_0x426497[_0xb6af('0x36')],_0x33387f);}return _0x4e2b87['sobject'](_0xb6af('0x3b'))[_0xb6af('0x23')](_0x426497,_0x100244)[_0xb6af('0x24')]();case _0xb6af('0x3c'):var _0x157416=_[_0xb6af('0x32')](_0x463bd3);if(_0x27e4b4['additionalSearchLead']){var _0x33387f={};_0x33387f[_0x27e4b4['additionalSearchLead']]=_0x1dd913;_[_0xb6af('0x34')](_0x157416[_0xb6af('0x36')],_0x33387f);}return _0x4e2b87[_0xb6af('0x1f')](_0xb6af('0x37'))['find'](_0x157416,_0x100244);case _0xb6af('0x19'):var _0x31dfcb=_[_0xb6af('0x32')](_0x463bd3);if(_0x27e4b4[_0xb6af('0x39')]){var _0x33387f={};_0x33387f[_0x27e4b4[_0xb6af('0x39')]]=_0x1dd913;_['merge'](_0x31dfcb[_0xb6af('0x36')],_0x33387f);}return _0x4e2b87['sobject'](_0xb6af('0x3a'))[_0xb6af('0x23')](_0x31dfcb,_0x100244);default:return null;}})[_0xb6af('0x25')](function(_0x47f4d2){if(_0x47f4d2&&_0x47f4d2[_0xb6af('0x26')]){var _0x2819d9=_[_0xb6af('0x3d')](_0x47f4d2);if(_0x2819d9){return BPromise['resolve']({'id':_0x2819d9['Id'],'name':_0x2819d9[_0xb6af('0x2a')],'phone':_0x2819d9[_0xb6af('0x3e')],'endUserType':_0x2819d9[_0xb6af('0x3f')][_0xb6af('0x40')][_0xb6af('0x41')]()});}}})[_0xb6af('0x25')](function(_0x2946bd){if(_0x2946bd){logger[_0xb6af('0x1e')](_0xb6af('0x42'),_0x2946bd['endUserType'],_0x1dd913);return BPromise[_0xb6af('0x29')](_0x2946bd);}else{logger[_0xb6af('0x1e')](_0xb6af('0x43'),_0x1dd913);var _0x4768e5={'Phone':_0x1dd913};if(_0x27e4b4[_0xb6af('0x44')]){if(_0x27e4b4[_0xb6af('0x44')]==='contact'){logger[_0xb6af('0x1e')](_0xb6af('0x45'),_0x1dd913,_0x27e4b4[_0xb6af('0x44')]);_0x4768e5['LastName']=_0x5074bb!==_0xb6af('0x46')?_0x5074bb:util[_0xb6af('0x47')](_0xb6af('0x48'),_0x1dd913);}else if(_0x27e4b4[_0xb6af('0x44')]===_0xb6af('0x3c')){logger[_0xb6af('0x1e')](_0xb6af('0x45'),_0x1dd913,_0x27e4b4[_0xb6af('0x44')]);_0x4768e5[_0xb6af('0x49')]=_0x5074bb!==_0xb6af('0x46')?_0x5074bb:util[_0xb6af('0x47')](_0xb6af('0x48'),_0x1dd913);_0x4768e5[_0xb6af('0x4a')]=_0xb6af('0x4b');}else if(_0x27e4b4[_0xb6af('0x44')]===_0xb6af('0x19')){logger[_0xb6af('0x1e')](_0xb6af('0x45'),_0x1dd913,_0x27e4b4[_0xb6af('0x44')]);_0x4768e5[_0xb6af('0x2a')]=_0x5074bb!==''?_0x5074bb:util[_0xb6af('0x47')](_0xb6af('0x48'),_0x1dd913);}else{return null;}}return _0x4e2b87[_0xb6af('0x1f')](_[_0xb6af('0x4c')](_0x27e4b4[_0xb6af('0x44')]))[_0xb6af('0x20')](_0x4768e5)[_0xb6af('0x25')](function(_0x2edc2c){return BPromise['resolve']({'id':_0x2edc2c['id'],'endUserType':_0x27e4b4[_0xb6af('0x44')]});});}});}function getCustomFields(_0x2faf74,_0x583abc){var _0x77fb34={};if(_0x2faf74[_0xb6af('0x26')]>0x0){_[_0xb6af('0x4d')](_0x2faf74,function(_0x1bb91c){if(_[_0xb6af('0x4e')]([_0xb6af('0x4f'),_0xb6af('0x50')],_0x1bb91c[_0xb6af('0x40')])&&_0x1bb91c[_0xb6af('0x51')]){_0x77fb34[_0x1bb91c['idField']]=_0x1bb91c[_0xb6af('0x52')][_0xb6af('0x53')]();}else if(_0x1bb91c[_0xb6af('0x40')]===_0xb6af('0x54')&&_0x1bb91c[_0xb6af('0x55')]&&_0x1bb91c[_0xb6af('0x51')]){_0x583abc[_0x1bb91c['variableName']]&&(_0x77fb34[_0x1bb91c[_0xb6af('0x51')]]=_0x583abc[_0x1bb91c[_0xb6af('0x55')]]['toString']());}else if(_0x1bb91c[_0xb6af('0x40')]==='customVariable'&&_0x1bb91c[_0xb6af('0x56')]&&_0x1bb91c[_0xb6af('0x56')][_0xb6af('0x57')]&&_0x1bb91c['idField']){_0x583abc[_0x1bb91c[_0xb6af('0x56')]['name'][_0xb6af('0x41')]()]&&(_0x77fb34[_0x1bb91c[_0xb6af('0x51')]]=_0x583abc[_0x1bb91c[_0xb6af('0x56')]['name'][_0xb6af('0x41')]()][_0xb6af('0x53')]());}});}return _0x77fb34;}function getConnection(_0x2ad46c){var _0x1a4d67=_0x2ad46c[_0xb6af('0x58')][_0xb6af('0x59')](_0x2ad46c[_0xb6af('0x5a')]);var _0x2298be=new jsforce[(_0xb6af('0x5b'))]({'oauth2':{'loginUrl':_0x2ad46c[_0xb6af('0x5c')]||_0xb6af('0x5d'),'clientId':_0x2ad46c[_0xb6af('0x5e')],'clientSecret':_0x2ad46c['clientSecret']}});return _0x2298be[_0xb6af('0x5f')](_0x2ad46c[_0xb6af('0x60')],_0x1a4d67)['then'](function(){logger['info'](_0xb6af('0x61'));return _0x2298be;});}exports[_0xb6af('0x62')]=function(_0x230dbb,_0x454320,_0x1eea75,_0x3cbe79,_0x398938,_0x4a2333){var _0x28491f,_0x58ac4d,_0x592e53,_0x4a82e3;_0x4a2333['serverUrl']=intUtil[_0xb6af('0x63')](_0x4a2333[_0xb6af('0x64')]);_0x4a2333[_0xb6af('0x5c')]=intUtil[_0xb6af('0x63')](_0x4a2333['remoteUri']);if(_0x398938&&_0x398938[_0xb6af('0x65')]){logger[_0xb6af('0x1e')]('[QUEUE]',_0xb6af('0x66'));_0x454320[_0xb6af('0x67')]=util['format'](_0xb6af('0x68'),_0x4a2333['serverUrl'],_0x454320[_0xb6af('0x69')],md5(_0x454320['uniqueid']));}else{_0x454320['recordingURL']='';}return getConnection(_0x4a2333)['then'](function(_0x53cf96){_0x4a82e3=_0x53cf96;return getUser(_0x4a2333,_0x3cbe79[_0xb6af('0x6a')],_0x4a82e3);})[_0xb6af('0x25')](function(_0x429032){_0x28491f=_0x429032;return getEndUser(_0x4a2333,_0x1eea75,_0x454320[_0xb6af('0x6b')],_0x454320[_0xb6af('0x6c')],_0x4a82e3);})['then'](function(_0x4e5e80){_0x58ac4d=_0x4e5e80;return getTicket(_0x4a2333,_0x28491f,_0x58ac4d,_0x1eea75,_0x454320,_0x1eea75[_0xb6af('0x6d')],_0x4a82e3,_0xb6af('0x62'));})['then'](function(_0xbec5fb){_0x592e53=_0xbec5fb;logger[_0xb6af('0x1e')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x592e53['id']);logger['info'](_0xb6af('0x6e'),_0x592e53['id'],_0x3cbe79[_0xb6af('0x57')],_0x4a2333[_0xb6af('0x40')]);switch(_0x4a2333['type']){case _0xb6af('0x6f'):emit(util['format'](_0xb6af('0x70'),_0x3cbe79[_0xb6af('0x57')]),_0xb6af('0x71'),{'recordId':_0x592e53['id']});break;case _0xb6af('0x72'):emit(util[_0xb6af('0x47')](_0xb6af('0x70'),_0x3cbe79[_0xb6af('0x57')]),_0xb6af('0x73'),{'uri':util[_0xb6af('0x47')](_0xb6af('0x74'),_0x4a82e3['instanceUrl'],_0x592e53['id'])});break;default:logger[_0xb6af('0x75')](_0xb6af('0x76'));}})[_0xb6af('0x77')](function(_0x545343){logger['error'](_0xb6af('0x78'),_0x545343);});};exports[_0xb6af('0x79')]=function(_0x4df875,_0x19369f,_0x1edaf9,_0x1318e0,_0xf45bd1,_0x6761cf,_0xa96a7){var _0x40174f,_0x4b70e2,_0x26e9da,_0x5b6849;_0x6761cf['serverUrl']=intUtil[_0xb6af('0x63')](_0x6761cf[_0xb6af('0x64')]);_0x6761cf['remoteUri']=intUtil[_0xb6af('0x63')](_0x6761cf[_0xb6af('0x5c')]);if(_0xa96a7&&_0xa96a7['recordingFormat']&&_0xa96a7[_0xb6af('0x7a')]!==_0xb6af('0x7b')){logger[_0xb6af('0x1e')]('[OUTBOUND]',_0xb6af('0x66'));_0x19369f[_0xb6af('0x67')]=util['format'](_0xb6af('0x68'),_0x6761cf[_0xb6af('0x64')],_0x19369f['uniqueid'],md5(_0x19369f['uniqueid']));}return getConnection(_0x6761cf)[_0xb6af('0x25')](function(_0x2e5f0a){_0x5b6849=_0x2e5f0a;return getUser(_0x6761cf,_0x1318e0['email'],_0x5b6849);})[_0xb6af('0x25')](function(_0x283f69){_0x40174f=_0x283f69;return getEndUser(_0x6761cf,_0x1edaf9,_0x19369f[_0xb6af('0x7c')],_0x19369f['destcalleridnum'],_0x5b6849);})[_0xb6af('0x25')](function(_0x173082){_0x4b70e2=_0x173082;return getTicket(_0x6761cf,_0x40174f,_0x4b70e2,_0x1edaf9,_0x19369f,_0x1edaf9[_0xb6af('0x6d')],_0x5b6849,_0xb6af('0x79'));})['then'](function(_0xb8d5d0){_0x26e9da=_0xb8d5d0;logger[_0xb6af('0x1e')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x26e9da['id']);logger[_0xb6af('0x1e')](_0xb6af('0x7d'),_0x26e9da['id'],_0x1318e0[_0xb6af('0x57')],_0x6761cf[_0xb6af('0x40')]);switch(_0x6761cf[_0xb6af('0x40')]){case _0xb6af('0x6f'):emit(util[_0xb6af('0x47')](_0xb6af('0x70'),_0x1318e0['name']),'trigger:salesforce:display',{'recordId':_0x26e9da['id']});break;case _0xb6af('0x72'):emit(util['format'](_0xb6af('0x70'),_0x1318e0['name']),'trigger:browser:url',{'uri':util[_0xb6af('0x47')]('%s/%s/e',_0x5b6849[_0xb6af('0x7e')],_0x26e9da['id'])});break;default:logger[_0xb6af('0x75')](_0xb6af('0x7f'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0xb6af('0x77')](function(_0x41d911){logger[_0xb6af('0x75')](_0xb6af('0x7f'),_0x41d911);});};exports[_0xb6af('0x80')]=function(_0x336b59,_0x3b420c,_0x303c50,_0x3e9108,_0x19c935,_0x40a9ce){var _0x719660,_0x2e8abb,_0x2e30d2,_0x5c1109;_0x40a9ce[_0xb6af('0x64')]=intUtil[_0xb6af('0x63')](_0x40a9ce['serverUrl']);_0x40a9ce[_0xb6af('0x5c')]=intUtil[_0xb6af('0x63')](_0x40a9ce[_0xb6af('0x5c')]);if(_0x19c935&&_0x19c935[_0xb6af('0x65')]){logger[_0xb6af('0x1e')]('['+_0x3b420c[_0xb6af('0x81')][_0xb6af('0x82')]()+']',_0xb6af('0x66'));_0x3b420c[_0xb6af('0x67')]=util[_0xb6af('0x47')](_0xb6af('0x68'),_0x40a9ce[_0xb6af('0x64')],_0x3b420c['uniqueid'],md5(_0x3b420c[_0xb6af('0x69')]));}else{_0x3b420c[_0xb6af('0x67')]='';}return getConnection(_0x40a9ce)[_0xb6af('0x25')](function(_0xed2269){_0x5c1109=_0xed2269;if(!_[_0xb6af('0x21')](_0x3e9108)){return getUser(_0x40a9ce,_0x3e9108[_0xb6af('0x57')],_0x5c1109);}else{return getUser(_0x40a9ce,null,_0x5c1109);}})[_0xb6af('0x25')](function(_0x3c2c16){_0x719660=_0x3c2c16;return getEndUser(_0x40a9ce,_0x303c50,_0x3b420c[_0xb6af('0x6b')],_0x3b420c[_0xb6af('0x6c')],_0x5c1109);})[_0xb6af('0x25')](function(_0x134c62){_0x2e8abb=_0x134c62;return getTicket(_0x40a9ce,_0x719660,_0x2e8abb,_0x303c50,_0x3b420c,_0x303c50[_0xb6af('0x6d')],_0x5c1109);})[_0xb6af('0x25')](function(_0x49a1e3){_0x2e30d2=_0x49a1e3;logger[_0xb6af('0x1e')]('['+_0x3b420c[_0xb6af('0x81')][_0xb6af('0x82')]()+_0xb6af('0x83'),_0x2e30d2['id']);logger[_0xb6af('0x1e')]('['+_0x3b420c[_0xb6af('0x81')][_0xb6af('0x82')]()+_0xb6af('0x84'),_0x40a9ce[_0xb6af('0x40')]);})[_0xb6af('0x77')](function(_0x4e7c6f){logger[_0xb6af('0x75')]('['+_0x3b420c[_0xb6af('0x81')]['toUpperCase']()+']',_0x4e7c6f);});}; \ No newline at end of file +var _0x25ff=['md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','sobject','create','validateEmail','User','find','then','length','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','moduleSearch','additionalSearchContact','merge','Contact','cloneDeep','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','execute','Account','first','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','format','Caller\x20-\x20%s','moduleCreate','','Company','Name','upperFirst','includes','string','picklist','type','idField','content','variable','variableName','customVariable','Variable','name','toString','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','Fields','queue','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','error','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','toUpperCase','isNil','calleridname','calleridnum','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment'];(function(_0x354564,_0x301fb8){var _0x3f8e43=function(_0x49de9e){while(--_0x49de9e){_0x354564['push'](_0x354564['shift']());}};_0x3f8e43(++_0x301fb8);}(_0x25ff,0x7d));var _0xf25f=function(_0x11494f,_0x1185b1){_0x11494f=_0x11494f-0x0;var _0x351f07=_0x25ff[_0x11494f];return _0x351f07;};'use strict';var _=require(_0xf25f('0x0'));var rp=require(_0xf25f('0x1'));var moment=require(_0xf25f('0x2'));var BPromise=require('bluebird');var md5=require(_0xf25f('0x3'));var jsforce=require(_0xf25f('0x4'));var util=require(_0xf25f('0x5'));var Redis=require(_0xf25f('0x6'));var intUtil=require(_0xf25f('0x7'));var config=require(_0xf25f('0x8'));var logger=require(_0xf25f('0x9'))('salesforce');config[_0xf25f('0xa')]=_[_0xf25f('0xb')](config['redis'],{'host':_0xf25f('0xc'),'port':0x18eb});var io=require(_0xf25f('0xd'))(new Redis(config[_0xf25f('0xa')]));function emit(_0x1bcadc,_0x42a9ea,_0x299ac7){io['to'](_0x1bcadc)[_0xf25f('0xe')](_0x42a9ea,_0x299ac7);}function getTicket(_0x3547d7,_0x110be8,_0x59fec1,_0x134cd8,_0x5aaccf,_0x24e3f4,_0x47843a,_0xa74c5d){var _0x2949f7=Object[_0xf25f('0xf')]({},{'OwnerId':_0x110be8['id'],'Subject':intUtil[_0xf25f('0x10')](_0x134cd8['Subjects'],_0x5aaccf,'\x20'),'Description':intUtil[_0xf25f('0x10')](_0x134cd8[_0xf25f('0x11')],_0x5aaccf,'\x0a')},getCustomFields(_0x24e3f4,_0x5aaccf));if(_0x59fec1){if(_0x134cd8[_0xf25f('0x12')]==='Task'){_0x2949f7[_0xf25f('0x13')]=moment[_0xf25f('0x14')]();_0x2949f7[_0xf25f('0x15')]=![];_0x2949f7[_0xf25f('0x16')]=![];if(_0x59fec1[_0xf25f('0x17')]===_0xf25f('0x18')||_0x59fec1[_0xf25f('0x17')]===_0xf25f('0x19')){_0x2949f7[_0xf25f('0x1a')]=_0x59fec1['id'];}else if(_0x59fec1[_0xf25f('0x17')]===_0xf25f('0x1b')){_0x2949f7[_0xf25f('0x1c')]=_0x59fec1['id'];}}else if(_0x134cd8[_0xf25f('0x12')]===_0xf25f('0x1d')){if(_0x59fec1[_0xf25f('0x17')]==='contact'){_0x2949f7[_0xf25f('0x1e')]=_0x59fec1['id'];}else if(_0x59fec1[_0xf25f('0x17')]===_0xf25f('0x1b')){_0x2949f7[_0xf25f('0x1f')]=_0x59fec1['id'];}else if(_0x59fec1[_0xf25f('0x17')]===_0xf25f('0x19')&&_0x134cd8[_0xf25f('0x20')]){_0x2949f7[_0x134cd8[_0xf25f('0x20')]]=_0x59fec1['id'];}else{logger[_0xf25f('0x21')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x47843a[_0xf25f('0x22')](_0x134cd8[_0xf25f('0x12')])[_0xf25f('0x23')](_0x2949f7);}function getUser(_0x4c592e,_0x47065c,_0x22cd82){if(!_['isNil'](_0x47065c)&&intUtil[_0xf25f('0x24')](_0x47065c)){var _0x1f36bd={'Email':_0x47065c};var _0x3f6920={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x22cd82[_0xf25f('0x22')](_0xf25f('0x25'))[_0xf25f('0x26')](_0x1f36bd,_0x3f6920)['execute']()[_0xf25f('0x27')](function(_0x4e5c18){if(_0x4e5c18[_0xf25f('0x28')]){var _0x4eab95=_['find'](_0x4e5c18,function(_0x40ff83){return _0x40ff83['Email']===_0x47065c;});if(_0x4eab95){logger[_0xf25f('0x21')](_0xf25f('0x29'),_0x47065c);return BPromise[_0xf25f('0x2a')]({'id':_0x4eab95['Id'],'name':_0x4eab95['Name']});}}else{logger['info'](_0xf25f('0x2b'),_0x47065c);return _0x22cd82[_0xf25f('0x2c')]()['then'](function(_0x2a208d){return BPromise[_0xf25f('0x2a')]({'id':_0x2a208d['user_id'],'name':_0x2a208d['display_name']});});}});}else{logger[_0xf25f('0x21')](_0xf25f('0x2b'),_0x47065c);return _0x22cd82[_0xf25f('0x2c')]()[_0xf25f('0x27')](function(_0x607226){return BPromise['resolve']({'id':_0x607226['user_id'],'name':_0x607226[_0xf25f('0x2d')]});});}}function getEndUser(_0x2e2e66,_0x11753c,_0x243380,_0x2f7365,_0x266f1d){var _0x21b0fe={'$or':{'Phone':_0x2f7365}};var _0x2c575d={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xf25f('0x27')](function(){logger[_0xf25f('0x21')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x2f7365,_0x11753c[_0xf25f('0x2e')]);switch(_0x11753c[_0xf25f('0x2e')]){case'contact_lead':var _0x5ee2c6=_['cloneDeep'](_0x21b0fe);if(_0x11753c[_0xf25f('0x2f')]){var _0x11880c={};_0x11880c[_0x11753c['additionalSearchContact']]=_0x2f7365;_[_0xf25f('0x30')](_0x5ee2c6['$or'],_0x11880c);}return _0x266f1d[_0xf25f('0x22')](_0xf25f('0x31'))['find'](_0x5ee2c6,_0x2c575d)['execute']()['then'](function(_0x40cda5){if(_0x40cda5&&_0x40cda5[_0xf25f('0x28')]){return _0x40cda5;}else{var _0x5330e2=_[_0xf25f('0x32')](_0x21b0fe);if(_0x11753c[_0xf25f('0x33')]){var _0x454855={};_0x454855[_0x11753c[_0xf25f('0x33')]]=_0x2f7365;_['merge'](_0x5330e2[_0xf25f('0x34')],_0x454855);}return _0x266f1d['sobject'](_0xf25f('0x35'))[_0xf25f('0x26')](_0x5330e2,_0x2c575d);}});case _0xf25f('0x36'):var _0x1579c6=_[_0xf25f('0x32')](_0x21b0fe);if(_0x11753c[_0xf25f('0x37')]){var _0x11880c={};_0x11880c[_0x11753c[_0xf25f('0x37')]]=_0x2f7365;_[_0xf25f('0x30')](_0x1579c6[_0xf25f('0x34')],_0x11880c);}return _0x266f1d['sobject']('Account')[_0xf25f('0x26')](_0x1579c6,_0x2c575d)['execute']()['then'](function(_0x1ce04b){if(_0x1ce04b&&_0x1ce04b[_0xf25f('0x28')]){return _0x1ce04b;}else{var _0x2638cb=_[_0xf25f('0x32')](_0x21b0fe);if(_0x11753c[_0xf25f('0x2f')]){var _0x5ab537={};_0x5ab537[_0x11753c[_0xf25f('0x2f')]]=_0x2f7365;_[_0xf25f('0x30')](_0x2638cb[_0xf25f('0x34')],_0x5ab537);}return _0x266f1d[_0xf25f('0x22')](_0xf25f('0x31'))['find'](_0x2638cb,_0x2c575d)[_0xf25f('0x27')](function(_0x27f6e0){if(_0x27f6e0&&_0x27f6e0['length']){return _0x27f6e0;}else{var _0x49b3c9=_[_0xf25f('0x32')](_0x21b0fe);if(_0x11753c[_0xf25f('0x33')]){var _0x2be475={};_0x2be475[_0x11753c[_0xf25f('0x33')]]=_0x2f7365;_[_0xf25f('0x30')](_0x49b3c9[_0xf25f('0x34')],_0x2be475);}return _0x266f1d[_0xf25f('0x22')](_0xf25f('0x35'))[_0xf25f('0x26')](_0x49b3c9,_0x2c575d);}});}});case _0xf25f('0x18'):var _0x5ee2c6=_[_0xf25f('0x32')](_0x21b0fe);if(_0x11753c[_0xf25f('0x2f')]){var _0x11880c={};_0x11880c[_0x11753c[_0xf25f('0x2f')]]=_0x2f7365;_[_0xf25f('0x30')](_0x5ee2c6[_0xf25f('0x34')],_0x11880c);}return _0x266f1d[_0xf25f('0x22')](_0xf25f('0x31'))[_0xf25f('0x26')](_0x5ee2c6,_0x2c575d)[_0xf25f('0x38')]();case'lead':var _0x1a9787=_[_0xf25f('0x32')](_0x21b0fe);if(_0x11753c[_0xf25f('0x33')]){var _0x11880c={};_0x11880c[_0x11753c[_0xf25f('0x33')]]=_0x2f7365;_[_0xf25f('0x30')](_0x1a9787['$or'],_0x11880c);}return _0x266f1d[_0xf25f('0x22')]('Lead')[_0xf25f('0x26')](_0x1a9787,_0x2c575d);case'account':var _0x1579c6=_[_0xf25f('0x32')](_0x21b0fe);if(_0x11753c[_0xf25f('0x37')]){var _0x11880c={};_0x11880c[_0x11753c['additionalSearchAccount']]=_0x2f7365;_[_0xf25f('0x30')](_0x1579c6['$or'],_0x11880c);}return _0x266f1d[_0xf25f('0x22')](_0xf25f('0x39'))[_0xf25f('0x26')](_0x1579c6,_0x2c575d);default:return null;}})[_0xf25f('0x27')](function(_0x24d796){if(_0x24d796&&_0x24d796['length']){var _0x13b098=_[_0xf25f('0x3a')](_0x24d796);if(_0x13b098){return BPromise[_0xf25f('0x2a')]({'id':_0x13b098['Id'],'name':_0x13b098['Name'],'phone':_0x13b098['Phone'],'endUserType':_0x13b098[_0xf25f('0x3b')]['type'][_0xf25f('0x3c')]()});}}})[_0xf25f('0x27')](function(_0x26aea9){if(_0x26aea9){logger['info'](_0xf25f('0x3d'),_0x26aea9[_0xf25f('0x17')],_0x2f7365);return BPromise[_0xf25f('0x2a')](_0x26aea9);}else{logger[_0xf25f('0x21')](_0xf25f('0x3e'),_0x2f7365);var _0x2e75ce={'Phone':_0x2f7365};if(_0x11753c['moduleCreate']){if(_0x11753c['moduleCreate']==='contact'){logger[_0xf25f('0x21')](_0xf25f('0x3f'),_0x2f7365,_0x11753c['moduleCreate']);_0x2e75ce['LastName']=_0x243380!==''?_0x243380:util[_0xf25f('0x40')](_0xf25f('0x41'),_0x2f7365);}else if(_0x11753c[_0xf25f('0x42')]===_0xf25f('0x19')){logger[_0xf25f('0x21')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2f7365,_0x11753c[_0xf25f('0x42')]);_0x2e75ce['LastName']=_0x243380!==_0xf25f('0x43')?_0x243380:util[_0xf25f('0x40')]('Caller\x20-\x20%s',_0x2f7365);_0x2e75ce[_0xf25f('0x44')]='No\x20Company';}else if(_0x11753c[_0xf25f('0x42')]===_0xf25f('0x1b')){logger[_0xf25f('0x21')](_0xf25f('0x3f'),_0x2f7365,_0x11753c[_0xf25f('0x42')]);_0x2e75ce[_0xf25f('0x45')]=_0x243380!==''?_0x243380:util[_0xf25f('0x40')](_0xf25f('0x41'),_0x2f7365);}else{return null;}}return _0x266f1d[_0xf25f('0x22')](_[_0xf25f('0x46')](_0x11753c['moduleCreate']))[_0xf25f('0x23')](_0x2e75ce)[_0xf25f('0x27')](function(_0x345643){return BPromise[_0xf25f('0x2a')]({'id':_0x345643['id'],'endUserType':_0x11753c[_0xf25f('0x42')]});});}});}function getCustomFields(_0x1202aa,_0x11e034){var _0x41b24e={};if(_0x1202aa[_0xf25f('0x28')]>0x0){_['forEach'](_0x1202aa,function(_0x1e1936){if(_[_0xf25f('0x47')]([_0xf25f('0x48'),_0xf25f('0x49')],_0x1e1936[_0xf25f('0x4a')])&&_0x1e1936[_0xf25f('0x4b')]){_0x41b24e[_0x1e1936[_0xf25f('0x4b')]]=_0x1e1936[_0xf25f('0x4c')]['toString']();}else if(_0x1e1936[_0xf25f('0x4a')]===_0xf25f('0x4d')&&_0x1e1936['variableName']&&_0x1e1936[_0xf25f('0x4b')]){_0x11e034[_0x1e1936['variableName']]&&(_0x41b24e[_0x1e1936[_0xf25f('0x4b')]]=_0x11e034[_0x1e1936[_0xf25f('0x4e')]]['toString']());}else if(_0x1e1936[_0xf25f('0x4a')]===_0xf25f('0x4f')&&_0x1e1936[_0xf25f('0x50')]&&_0x1e1936[_0xf25f('0x50')]['name']&&_0x1e1936[_0xf25f('0x4b')]){_0x11e034[_0x1e1936['Variable'][_0xf25f('0x51')]['toLowerCase']()]&&(_0x41b24e[_0x1e1936['idField']]=_0x11e034[_0x1e1936[_0xf25f('0x50')]['name']['toLowerCase']()][_0xf25f('0x52')]());}});}return _0x41b24e;}function getConnection(_0x484a32){var _0x378fad=_0x484a32[_0xf25f('0x53')]['concat'](_0x484a32[_0xf25f('0x54')]);var _0x205d39=new jsforce[(_0xf25f('0x55'))]({'oauth2':{'loginUrl':_0x484a32[_0xf25f('0x56')]||_0xf25f('0x57'),'clientId':_0x484a32[_0xf25f('0x58')],'clientSecret':_0x484a32['clientSecret']}});return _0x205d39[_0xf25f('0x59')](_0x484a32[_0xf25f('0x5a')],_0x378fad)[_0xf25f('0x27')](function(){logger[_0xf25f('0x21')]('Connection\x20established.');return _0x205d39;});}exports['queue']=function(_0x473197,_0x59f707,_0x2a0a07,_0x168ffc,_0x4efe39,_0x13eae0){var _0x4102c8,_0x14cf4a,_0x60b5a,_0x5e1f64;_0x13eae0['serverUrl']=intUtil[_0xf25f('0x5b')](_0x13eae0[_0xf25f('0x5c')]);_0x13eae0[_0xf25f('0x56')]=intUtil[_0xf25f('0x5b')](_0x13eae0[_0xf25f('0x56')]);if(_0x4efe39&&_0x4efe39[_0xf25f('0x5d')]){logger[_0xf25f('0x21')](_0xf25f('0x5e'),_0xf25f('0x5f'));_0x59f707['recordingURL']=util[_0xf25f('0x40')](_0xf25f('0x60'),_0x13eae0[_0xf25f('0x5c')],_0x59f707[_0xf25f('0x61')],md5(_0x59f707[_0xf25f('0x61')]));}else{_0x59f707[_0xf25f('0x62')]='';}return getConnection(_0x13eae0)[_0xf25f('0x27')](function(_0x332311){_0x5e1f64=_0x332311;return getUser(_0x13eae0,_0x168ffc[_0xf25f('0x63')],_0x5e1f64);})[_0xf25f('0x27')](function(_0xd6bc46){_0x4102c8=_0xd6bc46;return getEndUser(_0x13eae0,_0x2a0a07,_0x59f707['calleridname'],_0x59f707['calleridnum'],_0x5e1f64);})[_0xf25f('0x27')](function(_0x2ee4dd){_0x14cf4a=_0x2ee4dd;return getTicket(_0x13eae0,_0x4102c8,_0x14cf4a,_0x2a0a07,_0x59f707,_0x2a0a07[_0xf25f('0x64')],_0x5e1f64,_0xf25f('0x65'));})[_0xf25f('0x27')](function(_0x1c28fc){_0x60b5a=_0x1c28fc;logger[_0xf25f('0x21')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x60b5a['id']);logger[_0xf25f('0x21')](_0xf25f('0x66'),_0x60b5a['id'],_0x168ffc[_0xf25f('0x51')],_0x13eae0[_0xf25f('0x4a')]);switch(_0x13eae0['type']){case _0xf25f('0x67'):emit(util[_0xf25f('0x40')](_0xf25f('0x68'),_0x168ffc['name']),_0xf25f('0x69'),{'recordId':_0x60b5a['id']});break;case _0xf25f('0x6a'):emit(util['format']('user:%s',_0x168ffc['name']),'trigger:browser:url',{'uri':util[_0xf25f('0x40')](_0xf25f('0x6b'),_0x5e1f64['instanceUrl'],_0x60b5a['id'])});break;default:logger[_0xf25f('0x6c')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x1177e5){logger[_0xf25f('0x6c')](_0xf25f('0x5e'),_0x1177e5);});};exports['outbound']=function(_0x5aff18,_0x1ff9ed,_0x59cc78,_0x2be66f,_0x10341a,_0x516731,_0x4fd992){var _0x277d53,_0x40858f,_0x5c120f,_0x52a694;_0x516731[_0xf25f('0x5c')]=intUtil[_0xf25f('0x5b')](_0x516731['serverUrl']);_0x516731[_0xf25f('0x56')]=intUtil[_0xf25f('0x5b')](_0x516731[_0xf25f('0x56')]);if(_0x4fd992&&_0x4fd992['recordingFormat']&&_0x4fd992[_0xf25f('0x6d')]!==_0xf25f('0x6e')){logger['info'](_0xf25f('0x6f'),_0xf25f('0x5f'));_0x1ff9ed[_0xf25f('0x62')]=util[_0xf25f('0x40')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x516731[_0xf25f('0x5c')],_0x1ff9ed[_0xf25f('0x61')],md5(_0x1ff9ed['uniqueid']));}return getConnection(_0x516731)[_0xf25f('0x27')](function(_0x250e4f){_0x52a694=_0x250e4f;return getUser(_0x516731,_0x2be66f[_0xf25f('0x63')],_0x52a694);})[_0xf25f('0x27')](function(_0x481e52){_0x277d53=_0x481e52;return getEndUser(_0x516731,_0x59cc78,_0x1ff9ed[_0xf25f('0x70')],_0x1ff9ed[_0xf25f('0x71')],_0x52a694);})['then'](function(_0x52884b){_0x40858f=_0x52884b;return getTicket(_0x516731,_0x277d53,_0x40858f,_0x59cc78,_0x1ff9ed,_0x59cc78[_0xf25f('0x64')],_0x52a694,_0xf25f('0x72'));})[_0xf25f('0x27')](function(_0x167652){_0x5c120f=_0x167652;logger[_0xf25f('0x21')](_0xf25f('0x73'),_0x5c120f['id']);logger[_0xf25f('0x21')](_0xf25f('0x74'),_0x5c120f['id'],_0x2be66f[_0xf25f('0x51')],_0x516731[_0xf25f('0x4a')]);switch(_0x516731['type']){case _0xf25f('0x67'):emit(util[_0xf25f('0x40')](_0xf25f('0x68'),_0x2be66f[_0xf25f('0x51')]),_0xf25f('0x69'),{'recordId':_0x5c120f['id']});break;case _0xf25f('0x6a'):emit(util[_0xf25f('0x40')](_0xf25f('0x68'),_0x2be66f[_0xf25f('0x51')]),_0xf25f('0x75'),{'uri':util[_0xf25f('0x40')]('%s/%s/e',_0x52a694['instanceUrl'],_0x5c120f['id'])});break;default:logger[_0xf25f('0x6c')](_0xf25f('0x6f'),_0xf25f('0x76'));}})[_0xf25f('0x77')](function(_0x3194ab){logger[_0xf25f('0x6c')](_0xf25f('0x6f'),_0x3194ab);});};exports[_0xf25f('0x78')]=function(_0x40271e,_0x4bf539,_0x49d500,_0x374cd9,_0x218574,_0x19db32){var _0x13beac,_0x247f47,_0x3ace07,_0x4d6a66;_0x19db32[_0xf25f('0x5c')]=intUtil[_0xf25f('0x5b')](_0x19db32[_0xf25f('0x5c')]);_0x19db32['remoteUri']=intUtil[_0xf25f('0x5b')](_0x19db32[_0xf25f('0x56')]);if(_0x218574&&_0x218574[_0xf25f('0x5d')]){logger[_0xf25f('0x21')]('['+_0x4bf539['lastevent'][_0xf25f('0x79')]()+']',_0xf25f('0x5f'));_0x4bf539[_0xf25f('0x62')]=util[_0xf25f('0x40')](_0xf25f('0x60'),_0x19db32[_0xf25f('0x5c')],_0x4bf539[_0xf25f('0x61')],md5(_0x4bf539[_0xf25f('0x61')]));}else{_0x4bf539[_0xf25f('0x62')]='';}return getConnection(_0x19db32)['then'](function(_0x31720e){_0x4d6a66=_0x31720e;if(!_[_0xf25f('0x7a')](_0x374cd9)){return getUser(_0x19db32,_0x374cd9[_0xf25f('0x51')],_0x4d6a66);}else{return getUser(_0x19db32,null,_0x4d6a66);}})[_0xf25f('0x27')](function(_0x243d00){_0x13beac=_0x243d00;return getEndUser(_0x19db32,_0x49d500,_0x4bf539[_0xf25f('0x7b')],_0x4bf539[_0xf25f('0x7c')],_0x4d6a66);})[_0xf25f('0x27')](function(_0x1fa99f){_0x247f47=_0x1fa99f;return getTicket(_0x19db32,_0x13beac,_0x247f47,_0x49d500,_0x4bf539,_0x49d500[_0xf25f('0x64')],_0x4d6a66);})[_0xf25f('0x27')](function(_0x52f783){_0x3ace07=_0x52f783;logger[_0xf25f('0x21')]('['+_0x4bf539[_0xf25f('0x7d')][_0xf25f('0x79')]()+_0xf25f('0x7e'),_0x3ace07['id']);logger['info']('['+_0x4bf539[_0xf25f('0x7d')][_0xf25f('0x79')]()+_0xf25f('0x7f'),_0x19db32[_0xf25f('0x4a')]);})['catch'](function(_0x15f8c8){logger[_0xf25f('0x6c')]('['+_0x4bf539[_0xf25f('0x7d')][_0xf25f('0x79')]()+']',_0x15f8c8);});}; \ 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 674142d..a1d10a2 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 _0x51aa=['includes','string','picklist','nameField','customField','content','toString','type','idField','toLowerCase','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','adminEmail','destcalleridnum','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','md5','ioredis','./util','../../../../config/logger','servicenow','defaults','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','length','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','userId','adminId','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20createEndUser\x20crm','forEach'];(function(_0x2c26ca,_0x25473f){var _0x83b1b9=function(_0x3e3164){while(--_0x3e3164){_0x2c26ca['push'](_0x2c26ca['shift']());}};_0x83b1b9(++_0x25473f);}(_0x51aa,0x1a2));var _0xa51a=function(_0xd22437,_0x1344b4){_0xd22437=_0xd22437-0x0;var _0x5a4878=_0x51aa[_0xd22437];return _0x5a4878;};'use strict';var _=require(_0xa51a('0x0'));var Promise=require('bluebird');var rp=require(_0xa51a('0x1'));var util=require(_0xa51a('0x2'));var md5=require(_0xa51a('0x3'));var Redis=require(_0xa51a('0x4'));var intUtil=require(_0xa51a('0x5'));var config=require('../../../../config/environment');var logger=require(_0xa51a('0x6'))(_0xa51a('0x7'));config['redis']=_[_0xa51a('0x8')](config[_0xa51a('0x9')],{'host':_0xa51a('0xa'),'port':0x18eb});var io=require(_0xa51a('0xb'))(new Redis(config[_0xa51a('0x9')]));function getAdminUser(_0x270f14,_0x50df42,_0x46d7b4,_0x153910,_0x56a852,_0x171aa1){return new Promise(function(_0x3834ee,_0x7a9c7b){var _0x494265={'method':'GET','uri':_0x153910+_0xa51a('0xc')+'&'+_0x56a852+'&'+_0x171aa1,'auth':_0x50df42,'json':!![]};return rp(_0x494265)[_0xa51a('0xd')](function(_0x19885a){if(_0x19885a['result'][_0xa51a('0xe')]>0x0){_0x46d7b4['adminId']=_0x19885a[_0xa51a('0xf')][0x0][_0xa51a('0x10')];}logger[_0xa51a('0x11')]('['+[_0x270f14[_0xa51a('0x12')]()]+_0xa51a('0x13'),_0x46d7b4);_0x3834ee(_0x46d7b4);})[_0xa51a('0x14')](function(_0x5a7e3e){logger[_0xa51a('0x15')]('['+[_0x270f14['toUpperCase']()]+']',_0x5a7e3e[_0xa51a('0x16')]);_0x7a9c7b(_0x5a7e3e[_0xa51a('0x16')]);});});}function getUser(_0x1b4d4c,_0x227abc,_0x2b2c62,_0x2c3cbb,_0x365418){return function(_0x5cb68b){logger['info']('['+[_0x1b4d4c[_0xa51a('0x12')]()]+_0xa51a('0x17'),_0x5cb68b);return new Promise(function(_0x56f11a,_0x4bb452){if(intUtil[_0xa51a('0x18')](_0x5cb68b[_0xa51a('0x19')])){var _0x349119={'method':_0xa51a('0x1a'),'uri':_0x2b2c62+_0xa51a('0x1b')+_0x5cb68b['userEmail']+'&'+_0x2c3cbb+'&'+_0x365418,'auth':_0x227abc,'json':!![]};logger[_0xa51a('0x11')]('['+[_0x1b4d4c[_0xa51a('0x12')]()]+_0xa51a('0x1c'),_0x349119);return rp(_0x349119)[_0xa51a('0xd')](function(_0x12efcf){logger[_0xa51a('0x11')]('['+[_0x1b4d4c['toUpperCase']()]+_0xa51a('0x1d'),_0x12efcf);if(_0x12efcf['result'][_0xa51a('0xe')]>0x0&&String(_0x12efcf[_0xa51a('0xf')][0x0][_0xa51a('0x1e')])==='true'){_0x5cb68b['userId']=_0x12efcf[_0xa51a('0xf')][0x0][_0xa51a('0x10')];}else{_0x5cb68b[_0xa51a('0x1f')]=_0x5cb68b[_0xa51a('0x20')];_0x5cb68b[_0xa51a('0x19')]=_0x5cb68b['adminEmail'];}logger[_0xa51a('0x11')]('['+[_0x1b4d4c[_0xa51a('0x12')]()]+_0xa51a('0x21'),_0x5cb68b);_0x56f11a(_0x5cb68b);})['catch'](function(_0x3cb2d4){logger[_0xa51a('0x15')]('['+[_0x1b4d4c[_0xa51a('0x12')]()]+']',_0x3cb2d4[_0xa51a('0x16')]);_0x4bb452(_0x3cb2d4[_0xa51a('0x16')]);});}else{logger[_0xa51a('0x11')]('['+[_0x1b4d4c[_0xa51a('0x12')]()]+']\x20using\x20admin\x20profile');_0x5cb68b[_0xa51a('0x1f')]=_0x5cb68b[_0xa51a('0x20')];_0x5cb68b[_0xa51a('0x19')]=_0x5cb68b['adminEmail'];_0x56f11a(_0x5cb68b);}});};}function createEndUser(_0x51c9c8,_0x2b55cc,_0x5ac28b,_0x438641,_0xb5bbe8){logger[_0xa51a('0x11')]('['+[_0x51c9c8[_0xa51a('0x12')]()]+_0xa51a('0x22'),_0x5ac28b);return new Promise(function(_0x18b203,_0xa8491f){var _0x280b24={'method':_0xa51a('0x23'),'uri':_0x438641+_0xa51a('0x24')+_0xb5bbe8,'body':{'user_name':_0x5ac28b[_0xa51a('0x25')],'roles':_0xa51a('0x26'),'first_name':_0x5ac28b['endUserNumber'],'active':_0xa51a('0x27'),'date_format':_0xa51a('0x28'),'phone':_0x5ac28b[_0xa51a('0x25')]},'auth':_0x2b55cc,'json':!![]};return rp(_0x280b24)[_0xa51a('0xd')](function(_0x208ad2){logger[_0xa51a('0x11')]('['+[_0x51c9c8['toUpperCase']()]+'],\x20EndUser\x20schema',_0x208ad2[_0xa51a('0xf')]);_0x5ac28b['endUserId']=_0x208ad2['result']['sys_id'];_0x18b203(_0x5ac28b);})[_0xa51a('0x14')](function(_0x3cb2f7){logger['error']('['+[_0x51c9c8[_0xa51a('0x12')]()]+']',_0x3cb2f7['message']);_0xa8491f(_0x3cb2f7[_0xa51a('0x16')]);});});}function getEndUser(_0x5a80d4,_0x21cccb,_0x2ef974,_0x96ffbf,_0x111475){return function(_0x591967){logger[_0xa51a('0x11')]('['+[_0x5a80d4[_0xa51a('0x12')]()]+_0xa51a('0x29'),_0x591967);return new Promise(function(_0x4157cd,_0x2f44ff){var _0x3d1be7={'method':'GET','uri':_0x2ef974+_0xa51a('0x2a')+_0x591967[_0xa51a('0x25')]+'&'+_0x96ffbf+'&'+_0x111475,'auth':_0x21cccb,'json':!![]};return rp(_0x3d1be7)[_0xa51a('0xd')](function(_0x2744f3){if(_0x2744f3[_0xa51a('0xf')][_0xa51a('0xe')]>0x0){_0x591967[_0xa51a('0x2b')]=_0x2744f3[_0xa51a('0xf')][0x0][_0xa51a('0x10')];logger['info']('['+[_0x5a80d4[_0xa51a('0x12')]()]+'],\x20getEndUser\x20crm',_0x591967);_0x4157cd(_0x591967);}else{return createEndUser(_0x5a80d4,_0x21cccb,_0x591967,_0x2ef974,_0x96ffbf)[_0xa51a('0xd')](function(_0x15a876){logger[_0xa51a('0x11')]('['+[_0x5a80d4[_0xa51a('0x12')]()]+_0xa51a('0x2c'),_0x15a876);_0x4157cd(_0x15a876);});}})['catch'](function(_0x477f9d){logger[_0xa51a('0x15')]('['+[_0x5a80d4[_0xa51a('0x12')]()]+']',_0x477f9d['message']);_0x2f44ff(_0x477f9d[_0xa51a('0x16')]);});});};}function getCustomFields(_0x5745f4,_0x4d2954){var _0x1618a4={};if(_0x5745f4[_0xa51a('0xe')]>0x0){_[_0xa51a('0x2d')](_0x5745f4,function(_0x1fc4ea){if(_[_0xa51a('0x2e')]([_0xa51a('0x2f'),_0xa51a('0x30')],_0x1fc4ea['type'])&&_0x1fc4ea[_0xa51a('0x31')]&&!_0x1fc4ea[_0xa51a('0x32')]){_0x1618a4[_0x1fc4ea[_0xa51a('0x31')]['toLowerCase']()]=_0x1fc4ea[_0xa51a('0x33')][_0xa51a('0x34')]();}else if(_[_0xa51a('0x2e')]([_0xa51a('0x2f'),_0xa51a('0x30')],_0x1fc4ea[_0xa51a('0x35')])&&_0x1fc4ea[_0xa51a('0x36')]&&_0x1fc4ea['customField']){_0x1618a4[_0x1fc4ea[_0xa51a('0x36')][_0xa51a('0x37')]()]=_0x1fc4ea[_0xa51a('0x33')][_0xa51a('0x34')]();}else if(_0x1fc4ea['type']===_0xa51a('0x38')&&_0x1fc4ea[_0xa51a('0x39')]&&_0x1fc4ea[_0xa51a('0x36')]&&_0x1fc4ea[_0xa51a('0x32')]){_0x1618a4[_0x1fc4ea['idField']['toLowerCase']()]=_0x4d2954[_0x1fc4ea[_0xa51a('0x39')]][_0xa51a('0x34')]();}else if(_0x1fc4ea[_0xa51a('0x35')]===_0xa51a('0x3a')&&_0x1fc4ea[_0xa51a('0x3b')]&&_0x1fc4ea['Variable'][_0xa51a('0x3c')]&&_0x1fc4ea['idField']&&_0x1fc4ea[_0xa51a('0x32')]){_0x1618a4[_0x1fc4ea[_0xa51a('0x36')][_0xa51a('0x37')]()]=_0x4d2954[_0x1fc4ea[_0xa51a('0x3b')]['name'][_0xa51a('0x37')]()]['toString']();}});}return _0x1618a4;}function getTicket(_0x52dcf5,_0x3e57d4,_0x40e21d,_0x11d3ca,_0x4fba67,_0x2a0fc2){return function(_0x29d3f8){logger[_0xa51a('0x11')]('['+[_0x52dcf5[_0xa51a('0x12')]()]+_0xa51a('0x3d'),_0x29d3f8);return new Promise(function(_0x69932e,_0x2c8c37){var _0x3cbc7e=_0x52dcf5[_0xa51a('0x37')]()===_0xa51a('0x3e')?_0x29d3f8[_0xa51a('0x1f')]:_0x29d3f8[_0xa51a('0x2b')];var _0x59afda={'method':_0xa51a('0x23'),'uri':_0x40e21d+_0xa51a('0x3f')+'?'+_0x2a0fc2,'body':Object[_0xa51a('0x40')]({},{'active':_0xa51a('0x27'),'caller_id':_0x3cbc7e,'assigned_to':_0x29d3f8[_0xa51a('0x1f')],'short_description':intUtil[_0xa51a('0x41')](_0x11d3ca[_0xa51a('0x42')],_0x4fba67,'\x20'),'description':intUtil['getString'](_0x11d3ca[_0xa51a('0x43')],_0x4fba67,'\x0a')},getCustomFields(_0x11d3ca[_0xa51a('0x44')],_0x4fba67)),'auth':_0x3e57d4,'json':!![]};return rp(_0x59afda)[_0xa51a('0xd')](function(_0x3fcc94){logger['info']('['+[_0x52dcf5[_0xa51a('0x12')]()]+_0xa51a('0x45'),_0x3fcc94['result']);_0x29d3f8[_0xa51a('0x46')]=_0x3fcc94[_0xa51a('0xf')]['sys_id'];_0x29d3f8[_0xa51a('0x47')]=_0x3fcc94[_0xa51a('0xf')][_0xa51a('0x48')];logger['info']('['+[_0x52dcf5[_0xa51a('0x12')]()]+_0xa51a('0x49'),_0x29d3f8);_0x69932e(_0x29d3f8);})[_0xa51a('0x14')](function(_0x1b6572){logger[_0xa51a('0x15')]('['+[_0x52dcf5[_0xa51a('0x12')]()]+']',_0x1b6572[_0xa51a('0x16')]);_0x2c8c37(_0x1b6572[_0xa51a('0x16')]);});});};}function createRemoteTag(_0x114454,_0x159e13,_0x16a636,_0x1f0333){return new Promise(function(_0x1f5362,_0x10c460){var _0x1d4814={'method':_0xa51a('0x23'),'uri':_0x16a636+_0xa51a('0x4a')+'?'+_0x1f0333,'body':{'short_description':_0x114454,'global':!![],'active':!![],'name':_0x114454},'auth':_0x159e13,'json':!![]};return rp(_0x1d4814)[_0xa51a('0xd')](function(_0x2f0df7){var _0x211db1=_0x2f0df7['result'][_0xa51a('0x10')];_0x1f5362(_0x211db1);});});}function getRemoteTag(_0xd71f22,_0x36f651,_0x54dd76,_0x4dd021,_0x2cdb32){return new Promise(function(_0x529e89,_0x544bc3){var _0x52fa2c={'method':_0xa51a('0x1a'),'uri':_0x54dd76+_0xa51a('0x4a')+_0xa51a('0x4b')+_0xd71f22+'&'+_0x4dd021,'auth':_0x36f651,'json':!![]};return rp(_0x52fa2c)[_0xa51a('0xd')](function(_0x2e24fc){if(_0x2e24fc[_0xa51a('0xf')][_0xa51a('0xe')]>0x0){var _0x2c657d=_0x2e24fc[_0xa51a('0xf')][0x0]['sys_id'];_0x529e89(_0x2c657d);}else{return createRemoteTag(_0xd71f22,_0x36f651,_0x54dd76,_0x4dd021)[_0xa51a('0xd')](function(_0x4d04b7){_0x529e89(_0x4d04b7);});}});});}function assignTagToIncident(_0x41b046,_0x4f57c4,_0x396dac,_0x4f3cd2,_0x4cea1c){return new Promise(function(_0x52ca6f,_0x206a42){var _0x1006d0={'method':_0xa51a('0x23'),'uri':_0x396dac+_0xa51a('0x4c')+'?'+_0x4cea1c,'body':{'label':_0x41b046,'table':'incident','id_type':_0xa51a('0x4d'),'table_key':_0x4f3cd2[_0xa51a('0x46')],'title':_0xa51a('0x4e')+_0x4f3cd2['ticketNumber'],'id_display':_0x4f3cd2[_0xa51a('0x47')]},'auth':_0x4f57c4,'json':!![]};return rp(_0x1006d0)[_0xa51a('0xd')](function(_0x1125f2){_0x52ca6f();})[_0xa51a('0x14')](function(){_0x52ca6f();});});}function manageTags(_0x2a08b6,_0x1127f0,_0x4fd73a,_0x4190c6,_0x316a36,_0x160a0,_0x445d34){return new Promise(function(_0x379e61,_0x3f2ab8){var _0x4e23ae=[];_0x1127f0[_0xa51a('0x2d')](function(_0x482b0f){_0x4e23ae[_0xa51a('0x4f')](getRemoteTag(_0x482b0f,_0x4fd73a,_0x4190c6,_0x160a0,_0x445d34));});return Promise[_0xa51a('0x50')](_0x4e23ae)[_0xa51a('0xd')](function(_0x5d4a79){if(_0x5d4a79[_0xa51a('0xe')]){logger[_0xa51a('0x11')]('['+[_0x2a08b6[_0xa51a('0x12')]()]+_0xa51a('0x51'),_0x5d4a79);var _0x2f3219=[];_0x5d4a79[_0xa51a('0x2d')](function(_0xc33b2b){_0x2f3219[_0xa51a('0x4f')](assignTagToIncident(_0xc33b2b,_0x4fd73a,_0x4190c6,_0x316a36,_0x160a0));});return Promise['all'](_0x2f3219)[_0xa51a('0xd')](function(){_0x379e61();})[_0xa51a('0x14')](function(){_0x379e61();});}else{_0x379e61();}});});}function getTags(_0x31c177,_0x33c67e,_0x385986,_0x308b5f,_0x48edcf,_0x3fd207){return function(_0x43a5a2){return new Promise(function(_0x93fd18,_0x2b8a87){var _0xe700c=[];var _0x174c18=_0x308b5f['Tags'];if(_0x174c18&&_0x174c18['length']>0x0){_0xe700c=_[_0xa51a('0x52')](_0x174c18,_0xa51a('0x3c'));}if(_0xe700c[_0xa51a('0xe')]>0x0){return manageTags(_0x31c177,_0xe700c,_0x33c67e,_0x385986,_0x43a5a2,_0x48edcf,_0x3fd207)[_0xa51a('0xd')](function(){_0x93fd18(_0x43a5a2);});}else{_0x93fd18(_0x43a5a2);}});};}function emit(_0x401b63,_0x1ee36d,_0x575891){var _0x53daf1='%26sysparm_record_target%3Dincident'+_0xa51a('0x53')+_0xa51a('0x54')+_0xa51a('0x55');var _0x2804ca={'uri':_0x401b63+_0xa51a('0x56')+_0x575891+_0x53daf1};io['to'](util[_0xa51a('0x57')]('user:%s',_0x1ee36d))['emit'](_0xa51a('0x58'),_0x2804ca);}exports['cs']=function(_0x2e3527,_0x511f49,_0x2ccebb,_0x6d95c3,_0x468a28,_0x920013,_0xf167b1,_0x43d957){var _0x593e2e={};var _0x22bc2d={'user':_0x920013[_0xa51a('0x59')],'pass':_0x920013[_0xa51a('0x5a')]};var _0x3905a4='sysparm_limit=1';var _0x3cb388=_0xa51a('0x5b');_0x920013[_0xa51a('0x5c')]=intUtil[_0xa51a('0x5d')](_0x920013[_0xa51a('0x5c')]);_0x920013['serverUrl']=intUtil[_0xa51a('0x5d')](_0x920013[_0xa51a('0x5e')]);var _0x2564f4=util['format'](_0xa51a('0x5f'),_0x920013[_0xa51a('0x5c')]);_0x593e2e['userEmail']=!_[_0xa51a('0x60')](_0x6d95c3)?_0x6d95c3[_0xa51a('0x61')]:null;_0x593e2e[_0xa51a('0x62')]=_0x920013[_0xa51a('0x61')];_0x593e2e[_0xa51a('0x25')]=_0x43d957[_0xa51a('0x37')]()===_0xa51a('0x3e')?_0x511f49[_0xa51a('0x63')]:_0x511f49[_0xa51a('0x64')];_0x593e2e[_0xa51a('0x65')]=_0x43d957==='queue'||_0x43d957===_0xa51a('0x66')?_0xa51a('0x67'):_0xa51a('0x3e');var _0x25f13d=util[_0xa51a('0x57')](_0xa51a('0x68'),_0x920013[_0xa51a('0x5e')],_0x511f49[_0xa51a('0x69')],md5(_0x511f49[_0xa51a('0x69')]));if(_0x468a28&&_0x468a28[_0xa51a('0x6a')]){logger[_0xa51a('0x11')](_0xa51a('0x6b'),'Recording\x20is\x20enabled!');_0x511f49[_0xa51a('0x6c')]=_0x25f13d;}else if(_0xf167b1&&_0xf167b1['recordingFormat']&&_0xf167b1[_0xa51a('0x6d')]!==_0xa51a('0x6e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x511f49[_0xa51a('0x6c')]=_0x25f13d;}else{_0x511f49['recordingURL']='';}return getAdminUser(_0x43d957,_0x22bc2d,_0x593e2e,_0x2564f4,_0x3cb388,_0x3905a4)[_0xa51a('0xd')](getUser(_0x43d957,_0x22bc2d,_0x2564f4,_0x3cb388,_0x3905a4))[_0xa51a('0xd')](getEndUser(_0x43d957,_0x22bc2d,_0x2564f4,_0x3cb388,_0x3905a4))[_0xa51a('0xd')](getTicket(_0x43d957,_0x22bc2d,_0x2564f4,_0x2ccebb,_0x511f49,_0x3cb388))[_0xa51a('0xd')](function(_0xf928e8){logger[_0xa51a('0x11')](util[_0xa51a('0x57')](_0xa51a('0x6f'),_0xf928e8[_0xa51a('0x46')]));logger[_0xa51a('0x11')](util[_0xa51a('0x57')](_0xa51a('0x70'),_0x43d957));if(_0x43d957!==_0xa51a('0x66')){logger[_0xa51a('0x11')]('['+[_0x43d957[_0xa51a('0x12')]()]+']',_0xa51a('0x71'));emit(_0x920013[_0xa51a('0x5c')],_0x6d95c3['name'],_0xf928e8['ticketId']);}})[_0xa51a('0x14')](function(_0x40af9b){logger[_0xa51a('0x15')]('['+[_0x43d957[_0xa51a('0x12')]()]+_0xa51a('0x72'),util[_0xa51a('0x73')](_0x40af9b,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x23b5=['],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','picklist','type','nameField','customField','content','toString','includes','idField','variable','variableName','toLowerCase','customVariable','Variable','name','POST','incident','getString','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20','ticketNumber','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','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','util','md5','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x23b5,0xb6));var _0x523b=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x23b5[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x523b('0x0'));var Promise=require(_0x523b('0x1'));var rp=require(_0x523b('0x2'));var util=require(_0x523b('0x3'));var md5=require(_0x523b('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x523b('0x5'));var logger=require(_0x523b('0x6'))(_0x523b('0x7'));config[_0x523b('0x8')]=_[_0x523b('0x9')](config['redis'],{'host':_0x523b('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x523b('0x8')]));function getAdminUser(_0x2ae940,_0x5a5d4e,_0x177ae6,_0x52cd3a,_0x3396d7,_0x20fd59){return new Promise(function(_0x48ccb3,_0x43e715){var _0x37f8c1={'method':_0x523b('0xb'),'uri':_0x52cd3a+_0x523b('0xc')+'&'+_0x3396d7+'&'+_0x20fd59,'auth':_0x5a5d4e,'json':!![]};return rp(_0x37f8c1)[_0x523b('0xd')](function(_0xaf8852){if(_0xaf8852[_0x523b('0xe')][_0x523b('0xf')]>0x0){_0x177ae6[_0x523b('0x10')]=_0xaf8852[_0x523b('0xe')][0x0][_0x523b('0x11')];}logger[_0x523b('0x12')]('['+[_0x2ae940[_0x523b('0x13')]()]+'],\x20getAdminUser\x20crm',_0x177ae6);_0x48ccb3(_0x177ae6);})[_0x523b('0x14')](function(_0x45a148){logger[_0x523b('0x15')]('['+[_0x2ae940[_0x523b('0x13')]()]+']',_0x45a148[_0x523b('0x16')]);_0x43e715(_0x45a148[_0x523b('0x16')]);});});}function getUser(_0x13de55,_0x218ec7,_0x45a393,_0x18e5b0,_0x5efa97){return function(_0x344272){logger[_0x523b('0x12')]('['+[_0x13de55[_0x523b('0x13')]()]+_0x523b('0x17'),_0x344272);return new Promise(function(_0x15fcd3,_0x31d4c4){if(intUtil['validateEmail'](_0x344272[_0x523b('0x18')])){var _0x349946={'method':_0x523b('0xb'),'uri':_0x45a393+_0x523b('0x19')+_0x344272[_0x523b('0x18')]+'&'+_0x18e5b0+'&'+_0x5efa97,'auth':_0x218ec7,'json':!![]};logger['info']('['+[_0x13de55[_0x523b('0x13')]()]+_0x523b('0x1a'),_0x349946);return rp(_0x349946)[_0x523b('0xd')](function(_0x3cf4dc){logger[_0x523b('0x12')]('['+[_0x13de55[_0x523b('0x13')]()]+'],\x20getUser\x20entity',_0x3cf4dc);if(_0x3cf4dc[_0x523b('0xe')][_0x523b('0xf')]>0x0&&String(_0x3cf4dc[_0x523b('0xe')][0x0][_0x523b('0x1b')])===_0x523b('0x1c')){_0x344272[_0x523b('0x1d')]=_0x3cf4dc[_0x523b('0xe')][0x0]['sys_id'];}else{_0x344272[_0x523b('0x1d')]=_0x344272[_0x523b('0x10')];_0x344272[_0x523b('0x18')]=_0x344272[_0x523b('0x1e')];}logger[_0x523b('0x12')]('['+[_0x13de55[_0x523b('0x13')]()]+_0x523b('0x1f'),_0x344272);_0x15fcd3(_0x344272);})[_0x523b('0x14')](function(_0x23097e){logger[_0x523b('0x15')]('['+[_0x13de55[_0x523b('0x13')]()]+']',_0x23097e[_0x523b('0x16')]);_0x31d4c4(_0x23097e[_0x523b('0x16')]);});}else{logger['info']('['+[_0x13de55[_0x523b('0x13')]()]+_0x523b('0x20'));_0x344272['userId']=_0x344272['adminId'];_0x344272['userEmail']=_0x344272[_0x523b('0x1e')];_0x15fcd3(_0x344272);}});};}function createEndUser(_0x2a7d5e,_0x14e110,_0x71b7d8,_0x38c88c,_0x4dceb3){logger[_0x523b('0x12')]('['+[_0x2a7d5e['toUpperCase']()]+_0x523b('0x21'),_0x71b7d8);return new Promise(function(_0x35c031,_0x3d62b0){var _0x45304a={'method':'POST','uri':_0x38c88c+_0x523b('0x22')+_0x4dceb3,'body':{'user_name':_0x71b7d8[_0x523b('0x23')],'roles':_0x523b('0x24'),'first_name':_0x71b7d8[_0x523b('0x23')],'active':_0x523b('0x1c'),'date_format':_0x523b('0x25'),'phone':_0x71b7d8['endUserNumber']},'auth':_0x14e110,'json':!![]};return rp(_0x45304a)[_0x523b('0xd')](function(_0x43a982){logger[_0x523b('0x12')]('['+[_0x2a7d5e[_0x523b('0x13')]()]+_0x523b('0x26'),_0x43a982['result']);_0x71b7d8[_0x523b('0x27')]=_0x43a982[_0x523b('0xe')][_0x523b('0x11')];_0x35c031(_0x71b7d8);})[_0x523b('0x14')](function(_0x17c1b9){logger['error']('['+[_0x2a7d5e[_0x523b('0x13')]()]+']',_0x17c1b9[_0x523b('0x16')]);_0x3d62b0(_0x17c1b9[_0x523b('0x16')]);});});}function getEndUser(_0xd8d427,_0xa8a15,_0x125eba,_0x15ae2f,_0x295cc4){return function(_0x2b24e6){logger[_0x523b('0x12')]('['+[_0xd8d427[_0x523b('0x13')]()]+_0x523b('0x28'),_0x2b24e6);return new Promise(function(_0x1a8fd8,_0x4833ad){var _0x136ecb={'method':_0x523b('0xb'),'uri':_0x125eba+_0x523b('0x29')+_0x2b24e6[_0x523b('0x23')]+'&'+_0x15ae2f+'&'+_0x295cc4,'auth':_0xa8a15,'json':!![]};return rp(_0x136ecb)[_0x523b('0xd')](function(_0x3ebb84){if(_0x3ebb84[_0x523b('0xe')][_0x523b('0xf')]>0x0){_0x2b24e6[_0x523b('0x27')]=_0x3ebb84[_0x523b('0xe')][0x0][_0x523b('0x11')];logger[_0x523b('0x12')]('['+[_0xd8d427[_0x523b('0x13')]()]+_0x523b('0x2a'),_0x2b24e6);_0x1a8fd8(_0x2b24e6);}else{return createEndUser(_0xd8d427,_0xa8a15,_0x2b24e6,_0x125eba,_0x15ae2f)[_0x523b('0xd')](function(_0x522ce6){logger[_0x523b('0x12')]('['+[_0xd8d427[_0x523b('0x13')]()]+'],\x20createEndUser\x20crm',_0x522ce6);_0x1a8fd8(_0x522ce6);});}})[_0x523b('0x14')](function(_0x4d94a2){logger['error']('['+[_0xd8d427[_0x523b('0x13')]()]+']',_0x4d94a2[_0x523b('0x16')]);_0x4833ad(_0x4d94a2[_0x523b('0x16')]);});});};}function getCustomFields(_0x3762c6,_0x1e9889){var _0x3ee73f={};if(_0x3762c6[_0x523b('0xf')]>0x0){_[_0x523b('0x2b')](_0x3762c6,function(_0x5ee200){if(_['includes'](['string',_0x523b('0x2c')],_0x5ee200[_0x523b('0x2d')])&&_0x5ee200[_0x523b('0x2e')]&&!_0x5ee200[_0x523b('0x2f')]){_0x3ee73f[_0x5ee200['nameField']['toLowerCase']()]=_0x5ee200[_0x523b('0x30')][_0x523b('0x31')]();}else if(_[_0x523b('0x32')](['string',_0x523b('0x2c')],_0x5ee200[_0x523b('0x2d')])&&_0x5ee200[_0x523b('0x33')]&&_0x5ee200[_0x523b('0x2f')]){_0x3ee73f[_0x5ee200[_0x523b('0x33')]['toLowerCase']()]=_0x5ee200[_0x523b('0x30')][_0x523b('0x31')]();}else if(_0x5ee200['type']===_0x523b('0x34')&&_0x5ee200[_0x523b('0x35')]&&_0x5ee200[_0x523b('0x33')]&&_0x5ee200[_0x523b('0x2f')]){_0x3ee73f[_0x5ee200[_0x523b('0x33')][_0x523b('0x36')]()]=_0x1e9889[_0x5ee200[_0x523b('0x35')]]['toString']();}else if(_0x5ee200['type']===_0x523b('0x37')&&_0x5ee200[_0x523b('0x38')]&&_0x5ee200[_0x523b('0x38')][_0x523b('0x39')]&&_0x5ee200[_0x523b('0x33')]&&_0x5ee200[_0x523b('0x2f')]){_0x3ee73f[_0x5ee200[_0x523b('0x33')][_0x523b('0x36')]()]=_0x1e9889[_0x5ee200[_0x523b('0x38')][_0x523b('0x39')][_0x523b('0x36')]()][_0x523b('0x31')]();}});}return _0x3ee73f;}function getTicket(_0x24c2d4,_0x1a8197,_0x4406fe,_0x56ba92,_0x1ae025,_0x559361){return function(_0x6bf039){logger[_0x523b('0x12')]('['+[_0x24c2d4[_0x523b('0x13')]()]+']\x20getTicket\x20input\x20crm',_0x6bf039);return new Promise(function(_0x3fe526,_0x176b86){var _0xaa242=_0x24c2d4[_0x523b('0x36')]()==='outbound'?_0x6bf039['userId']:_0x6bf039[_0x523b('0x27')];var _0x3cd3df={'method':_0x523b('0x3a'),'uri':_0x4406fe+_0x523b('0x3b')+'?'+_0x559361,'body':Object['assign']({},{'active':'true','caller_id':_0xaa242,'assigned_to':_0x6bf039[_0x523b('0x1d')],'short_description':intUtil[_0x523b('0x3c')](_0x56ba92['Subjects'],_0x1ae025,'\x20'),'description':intUtil[_0x523b('0x3c')](_0x56ba92['Descriptions'],_0x1ae025,'\x0a')},getCustomFields(_0x56ba92[_0x523b('0x3d')],_0x1ae025)),'auth':_0x1a8197,'json':!![]};return rp(_0x3cd3df)[_0x523b('0xd')](function(_0x1529e2){logger[_0x523b('0x12')]('['+[_0x24c2d4[_0x523b('0x13')]()]+_0x523b('0x3e'),_0x1529e2['result']);_0x6bf039[_0x523b('0x3f')]=_0x1529e2[_0x523b('0xe')][_0x523b('0x11')];_0x6bf039['ticketNumber']=_0x1529e2[_0x523b('0xe')][_0x523b('0x40')];logger[_0x523b('0x12')]('['+[_0x24c2d4[_0x523b('0x13')]()]+_0x523b('0x41'),_0x6bf039);_0x3fe526(_0x6bf039);})[_0x523b('0x14')](function(_0x4d2fae){logger[_0x523b('0x15')]('['+[_0x24c2d4[_0x523b('0x13')]()]+']',_0x4d2fae[_0x523b('0x16')]);_0x176b86(_0x4d2fae['message']);});});};}function createRemoteTag(_0x2e520b,_0x2f7dd2,_0x541692,_0x259c36){return new Promise(function(_0x41db69,_0x572bc9){var _0x5f1920={'method':_0x523b('0x3a'),'uri':_0x541692+_0x523b('0x42')+'?'+_0x259c36,'body':{'short_description':_0x2e520b,'global':!![],'active':!![],'name':_0x2e520b},'auth':_0x2f7dd2,'json':!![]};return rp(_0x5f1920)[_0x523b('0xd')](function(_0x1560cf){var _0x35269f=_0x1560cf[_0x523b('0xe')][_0x523b('0x11')];_0x41db69(_0x35269f);});});}function getRemoteTag(_0x2e50da,_0x1d8247,_0x3b2bd5,_0x37e6fe,_0x5971a0){return new Promise(function(_0x2d5436,_0x4b47fc){var _0x119e7a={'method':'GET','uri':_0x3b2bd5+_0x523b('0x42')+_0x523b('0x43')+_0x2e50da+'&'+_0x37e6fe,'auth':_0x1d8247,'json':!![]};return rp(_0x119e7a)[_0x523b('0xd')](function(_0x4184bc){if(_0x4184bc[_0x523b('0xe')][_0x523b('0xf')]>0x0){var _0x1ab0ce=_0x4184bc['result'][0x0]['sys_id'];_0x2d5436(_0x1ab0ce);}else{return createRemoteTag(_0x2e50da,_0x1d8247,_0x3b2bd5,_0x37e6fe)['then'](function(_0xa59bfa){_0x2d5436(_0xa59bfa);});}});});}function assignTagToIncident(_0xf1233,_0x496819,_0x267cbf,_0x36719b,_0x3d1c3d){return new Promise(function(_0x3b26e4,_0x206b26){var _0x601c73={'method':'POST','uri':_0x267cbf+'label_entry'+'?'+_0x3d1c3d,'body':{'label':_0xf1233,'table':_0x523b('0x3b'),'id_type':'Incident','table_key':_0x36719b[_0x523b('0x3f')],'title':_0x523b('0x44')+_0x36719b[_0x523b('0x45')],'id_display':_0x36719b[_0x523b('0x45')]},'auth':_0x496819,'json':!![]};return rp(_0x601c73)[_0x523b('0xd')](function(_0x95d256){_0x3b26e4();})['catch'](function(){_0x3b26e4();});});}function manageTags(_0x398756,_0x4d27d4,_0x216a82,_0x3dba5b,_0x5370ab,_0x255ace,_0x302400){return new Promise(function(_0x25753f,_0x16f5e1){var _0x35b4a4=[];_0x4d27d4[_0x523b('0x2b')](function(_0x58646f){_0x35b4a4[_0x523b('0x46')](getRemoteTag(_0x58646f,_0x216a82,_0x3dba5b,_0x255ace,_0x302400));});return Promise[_0x523b('0x47')](_0x35b4a4)[_0x523b('0xd')](function(_0x448012){if(_0x448012[_0x523b('0xf')]){logger[_0x523b('0x12')]('['+[_0x398756[_0x523b('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x448012);var _0x28ced9=[];_0x448012[_0x523b('0x2b')](function(_0x12d6bb){_0x28ced9[_0x523b('0x46')](assignTagToIncident(_0x12d6bb,_0x216a82,_0x3dba5b,_0x5370ab,_0x255ace));});return Promise[_0x523b('0x47')](_0x28ced9)[_0x523b('0xd')](function(){_0x25753f();})['catch'](function(){_0x25753f();});}else{_0x25753f();}});});}function getTags(_0xe0e3da,_0x5d2f0b,_0x27d6a7,_0xd76dd,_0x92f7b4,_0x207126){return function(_0x1c0d13){return new Promise(function(_0x3e5cb1,_0x23748a){var _0x18ea6f=[];var _0x3968bd=_0xd76dd[_0x523b('0x48')];if(_0x3968bd&&_0x3968bd[_0x523b('0xf')]>0x0){_0x18ea6f=_[_0x523b('0x49')](_0x3968bd,'name');}if(_0x18ea6f['length']>0x0){return manageTags(_0xe0e3da,_0x18ea6f,_0x5d2f0b,_0x27d6a7,_0x1c0d13,_0x92f7b4,_0x207126)[_0x523b('0xd')](function(){_0x3e5cb1(_0x1c0d13);});}else{_0x3e5cb1(_0x1c0d13);}});};}function emit(_0x5d8fe0,_0x425794,_0x4ce843){var _0x20d3e3=_0x523b('0x4a')+_0x523b('0x4b')+_0x523b('0x4c')+'%255EORDERBYDESCnumber';var _0x3debca={'uri':_0x5d8fe0+_0x523b('0x4d')+_0x4ce843+_0x20d3e3};io['to'](util[_0x523b('0x4e')](_0x523b('0x4f'),_0x425794))[_0x523b('0x50')](_0x523b('0x51'),_0x3debca);}exports['cs']=function(_0x1ec888,_0x45d5f2,_0x50a9c9,_0x5cff60,_0x1ec50a,_0x44b971,_0x244c93,_0x33a9e4){var _0x247c14={};var _0x20f6ac={'user':_0x44b971[_0x523b('0x52')],'pass':_0x44b971[_0x523b('0x53')]};var _0x329746=_0x523b('0x54');var _0x18a4ce=_0x523b('0x55');_0x44b971[_0x523b('0x56')]=intUtil['stripTrailingSlash'](_0x44b971[_0x523b('0x56')]);_0x44b971['serverUrl']=intUtil[_0x523b('0x57')](_0x44b971[_0x523b('0x58')]);var _0x5d40be=util[_0x523b('0x4e')](_0x523b('0x59'),_0x44b971[_0x523b('0x56')]);_0x247c14['userEmail']=!_[_0x523b('0x5a')](_0x5cff60)?_0x5cff60[_0x523b('0x5b')]:null;_0x247c14['adminEmail']=_0x44b971[_0x523b('0x5b')];_0x247c14['endUserNumber']=_0x33a9e4[_0x523b('0x36')]()===_0x523b('0x5c')?_0x45d5f2[_0x523b('0x5d')]:_0x45d5f2[_0x523b('0x5e')];_0x247c14[_0x523b('0x5f')]=_0x33a9e4===_0x523b('0x60')||_0x33a9e4===_0x523b('0x61')?_0x523b('0x60'):_0x523b('0x5c');var _0x57eada=util[_0x523b('0x4e')](_0x523b('0x62'),_0x44b971[_0x523b('0x58')],_0x45d5f2[_0x523b('0x63')],md5(_0x45d5f2[_0x523b('0x63')]));if(_0x1ec50a&&_0x1ec50a[_0x523b('0x64')]){logger[_0x523b('0x12')]('[QUEUE]',_0x523b('0x65'));_0x45d5f2['recordingURL']=_0x57eada;}else if(_0x244c93&&_0x244c93[_0x523b('0x66')]&&_0x244c93[_0x523b('0x66')]!=='none'){logger[_0x523b('0x12')](_0x523b('0x67'),'Recording\x20is\x20enabled!');_0x45d5f2[_0x523b('0x68')]=_0x57eada;}else{_0x45d5f2[_0x523b('0x68')]='';}return getAdminUser(_0x33a9e4,_0x20f6ac,_0x247c14,_0x5d40be,_0x18a4ce,_0x329746)[_0x523b('0xd')](getUser(_0x33a9e4,_0x20f6ac,_0x5d40be,_0x18a4ce,_0x329746))[_0x523b('0xd')](getEndUser(_0x33a9e4,_0x20f6ac,_0x5d40be,_0x18a4ce,_0x329746))['then'](getTicket(_0x33a9e4,_0x20f6ac,_0x5d40be,_0x50a9c9,_0x45d5f2,_0x18a4ce))[_0x523b('0xd')](function(_0x1bde82){logger[_0x523b('0x12')](util[_0x523b('0x4e')](_0x523b('0x69'),_0x1bde82[_0x523b('0x3f')]));logger['info'](util[_0x523b('0x4e')](_0x523b('0x6a'),_0x33a9e4));if(_0x33a9e4!==_0x523b('0x61')){logger[_0x523b('0x12')]('['+[_0x33a9e4[_0x523b('0x13')]()]+']',_0x523b('0x6b'));emit(_0x44b971[_0x523b('0x56')],_0x5cff60[_0x523b('0x39')],_0x1bde82[_0x523b('0x3f')]);}})[_0x523b('0x14')](function(_0x228b7a){logger['error']('['+[_0x33a9e4[_0x523b('0x13')]()]+_0x523b('0x6c'),util[_0x523b('0x6d')](_0x228b7a,{'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 1c237ec..df75579 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 _0x7142=['Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','users','contacts','catch','error','calleridnum','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','getString','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','Contacts','parent_name','name','forEach','variableName','push','idField','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','get_entry_list','stringify','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','value','Agent\x20found!','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Searching\x20enduser\x20with\x20phone','phone_home','then','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','customField','nameField','content','custom_fields','variable'];(function(_0x161be3,_0x3ed9ab){var _0x1fa6cd=function(_0x1d367f){while(--_0x1d367f){_0x161be3['push'](_0x161be3['shift']());}};_0x1fa6cd(++_0x3ed9ab);}(_0x7142,0x125));var _0x2714=function(_0x6c257e,_0x247108){_0x6c257e=_0x6c257e-0x0;var _0x1574e2=_0x7142[_0x6c257e];return _0x1574e2;};'use strict';var _=require(_0x2714('0x0'));var rp=require(_0x2714('0x1'));var BPromise=require(_0x2714('0x2'));var md5=require(_0x2714('0x3'));var util=require('util');var Redis=require(_0x2714('0x4'));var intUtil=require(_0x2714('0x5'));var config=require(_0x2714('0x6'));var logger=require(_0x2714('0x7'))(_0x2714('0x8'));config[_0x2714('0x9')]=_[_0x2714('0xa')](config[_0x2714('0x9')],{'host':_0x2714('0xb'),'port':0x18eb});var io=require(_0x2714('0xc'))(new Redis(config[_0x2714('0x9')]));var def={'method':_0x2714('0xd'),'json':!![]};function emit(_0x491dbe,_0x456de4,_0x257072){io['to'](_0x491dbe)[_0x2714('0xe')](_0x456de4,_0x257072);}function getTicket(_0x214601,_0x1d1aa2,_0x489f20,_0x3f47c7,_0x103eed,_0x3e367d,_0x36b0c2,_0x50c908){logger[_0x2714('0xf')]('Creating\x20new\x20ticket...');var _0x1718fa=new Date();var _0x5705f4=[{'name':'name','value':intUtil[_0x2714('0x10')](_0x3f47c7['Subjects'],_0x103eed,'\x20')},{'name':_0x2714('0x11'),'value':_0x1d1aa2['id']},{'name':_0x2714('0x12'),'value':_0x1d1aa2['id']},{'name':_0x2714('0x13'),'value':intUtil['getString'](_0x3f47c7[_0x2714('0x14')],_0x103eed,'\x0a')},{'name':_0x2714('0x15'),'value':_0x1718fa[_0x2714('0x16')]()[_0x2714('0x17')](0x0,0x13)[_0x2714('0x18')]('T','\x20')},{'name':_0x2714('0x19'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x2714('0x1a'),'value':_0x489f20['id']},{'name':'parent_type','value':_0x2714('0x1b')},{'name':_0x2714('0x1c'),'value':_0x489f20[_0x2714('0x1d')]},{'name':'direction','value':_0x50c908}];if(_0x3e367d['length']){_[_0x2714('0x1e')](_0x3e367d,function(_0x4d9abf){if(_0x103eed[_0x4d9abf[_0x2714('0x1f')]]){_0x5705f4[_0x2714('0x20')]({'name':_0x4d9abf[_0x2714('0x21')],'value':_0x103eed[_0x4d9abf[_0x2714('0x1f')]]});}});}return request({'form':{'method':_0x2714('0x22'),'input_type':_0x2714('0x23'),'response_type':_0x2714('0x23'),'rest_data':JSON['stringify']({'session':_0x36b0c2['id'],'module_name':_0x2714('0x24'),'name_value_list':_0x5705f4})}});}function getAuth(_0x4f7e32){return util[_0x2714('0x25')](_0x2714('0x26'),new Buffer(_0x4f7e32[_0x2714('0x27')]+':X')[_0x2714('0x28')](_0x2714('0x29')));}function getServerInfo(_0x4ea1be){return request({'form':{'method':_0x2714('0x2a'),'input_type':_0x2714('0x23'),'response_type':_0x2714('0x23'),'rest_data':JSON['stringify']({'session':_0x4ea1be['id']})}});}function getUser(_0x5efbe0,_0x2d75a3,_0xa20e9e){if(!_[_0x2714('0x2b')](_0x2d75a3)){logger[_0x2714('0xf')]('Getting\x20agent\x20with\x20name',_0x2d75a3);return request({'form':{'method':_0x2714('0x2c'),'input_type':_0x2714('0x23'),'response_type':'JSON','rest_data':JSON[_0x2714('0x2d')]({'session':_0xa20e9e['id'],'module_name':_0x2714('0x2e'),'query':util[_0x2714('0x25')](_0x2714('0x2f'),_0x2d75a3),'order_by':'','offset':'0','select_fields':['id',_0x2714('0x1d'),_0x2714('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3115fb){if(_0x3115fb[_0x2714('0x31')]['length']){var _0x32aa60=_[_0x2714('0x32')](_0x3115fb[_0x2714('0x31')],function(_0x46b06d){return _0x46b06d['name_value_list'][_0x2714('0x30')][_0x2714('0x33')]===_0x2d75a3;});if(_0x32aa60){logger[_0x2714('0xf')](_0x2714('0x34'));return BPromise['resolve']({'id':_0x32aa60[_0x2714('0x35')]['id'][_0x2714('0x33')],'name':_0x32aa60['name_value_list']['name']['value']});}}logger[_0x2714('0xf')](_0x2714('0x36'));return BPromise[_0x2714('0x37')]({'id':_0xa20e9e[_0x2714('0x35')][_0x2714('0x38')]['value'],'name':_0xa20e9e['name_value_list'][_0x2714('0x30')][_0x2714('0x33')]});});}else{logger[_0x2714('0xf')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0xa20e9e['name_value_list']['user_id']['value'],'name':_0xa20e9e[_0x2714('0x35')][_0x2714('0x30')][_0x2714('0x33')]});}}function getEndUser(_0x38f331,_0x2fb55c,_0x1cba53,_0x1e42e3){logger[_0x2714('0xf')](_0x2714('0x39'),_0x1cba53);return request({'form':{'method':_0x2714('0x2c'),'input_type':_0x2714('0x23'),'response_type':_0x2714('0x23'),'rest_data':JSON['stringify']({'session':_0x1e42e3['id'],'module_name':_0x2714('0x1b'),'query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x1cba53),'order_by':'','offset':'0','select_fields':['id',_0x2714('0x1d'),_0x2714('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2714('0x3b')](function(_0xc07fb0){if(_0xc07fb0['entry_list'][_0x2714('0x3c')]){var _0x504927=_['find'](_0xc07fb0[_0x2714('0x31')],function(_0x1ca6de){return _0x1ca6de[_0x2714('0x35')][_0x2714('0x3a')][_0x2714('0x33')]===_0x1cba53;});if(_0x504927){logger['info']('Enduser\x20found!');return BPromise['resolve']({'id':_0x504927[_0x2714('0x35')]['id'][_0x2714('0x33')],'name':_0x504927['name_value_list'][_0x2714('0x1d')][_0x2714('0x33')],'phone':_0x504927['name_value_list'][_0x2714('0x3a')][_0x2714('0x33')]});}}else{logger[_0x2714('0xf')](_0x2714('0x3d'));return request({'form':{'method':_0x2714('0x22'),'input_type':_0x2714('0x23'),'response_type':_0x2714('0x23'),'rest_data':JSON['stringify']({'session':_0x1e42e3['id'],'module_name':'Contacts','name_value_list':[{'name':_0x2714('0x3e'),'value':_0x2fb55c!==_0x2714('0x3f')?_0x2fb55c:util[_0x2714('0x25')]('Caller\x20-\x20%s',_0x1cba53)},{'name':_0x2714('0x3a'),'value':_0x1cba53}]})}})[_0x2714('0x3b')](function(_0x36c0e8){logger[_0x2714('0xf')](_0x2714('0x40'));return BPromise[_0x2714('0x37')]({'id':_0x36c0e8['id'],'name':_0x36c0e8[_0x2714('0x31')][_0x2714('0x3e')][_0x2714('0x33')],'phone':_0x36c0e8[_0x2714('0x31')]['phone_home'][_0x2714('0x33')]});});}});}function request(_0x240fdd){logger[_0x2714('0x41')](_0x2714('0x42'),JSON[_0x2714('0x2d')](_0x240fdd));return rp(_[_0x2714('0x43')](def,_0x240fdd));}function getTags(_0x19e526,_0x5dd3f3){var _0x457c60=[];if(_0x19e526&&_0x19e526[_0x2714('0x3c')]>0x0){_0x457c60=_[_0x2714('0x44')](_0x19e526,_0x5dd3f3);}return _0x457c60;}function getCustomFields(_0x197141,_0x16c394){var _0x6b5105=[];var _0x5eb8bd={'custom_fields':[]};if(_0x197141[_0x2714('0x3c')]>0x0){_[_0x2714('0x1e')](_0x197141,function(_0x4aae5a){if(_0x4aae5a[_0x2714('0x45')]===_0x2714('0x46')&&_0x4aae5a['nameField']&&!_0x4aae5a[_0x2714('0x47')]){_0x5eb8bd[_0x4aae5a[_0x2714('0x48')]['toLowerCase']()]=_0x4aae5a[_0x2714('0x49')]['toString']();}else if(_0x4aae5a['type']===_0x2714('0x46')&&_0x4aae5a[_0x2714('0x21')]&&_0x4aae5a[_0x2714('0x47')]){_0x5eb8bd[_0x2714('0x4a')][_0x2714('0x20')]({'id':_0x4aae5a['idField'],'value':_0x4aae5a['content']['toString']()});}else if(_0x4aae5a['type']===_0x2714('0x4b')&&_0x4aae5a[_0x2714('0x1f')]&&_0x4aae5a[_0x2714('0x21')]&&_0x4aae5a[_0x2714('0x47')]){_0x16c394[_0x4aae5a[_0x2714('0x1f')]]&&_0x5eb8bd[_0x2714('0x4a')]['push']({'id':_0x4aae5a[_0x2714('0x21')],'value':_0x16c394[_0x4aae5a[_0x2714('0x1f')]][_0x2714('0x28')]()});}else if(_0x4aae5a[_0x2714('0x45')]==='customVariable'&&_0x4aae5a['Variable']&&_0x4aae5a[_0x2714('0x4c')][_0x2714('0x1d')]&&_0x4aae5a[_0x2714('0x21')]&&_0x4aae5a[_0x2714('0x47')]){_0x16c394[_0x4aae5a['Variable'][_0x2714('0x1d')][_0x2714('0x4d')]()]&&_0x5eb8bd[_0x2714('0x4a')][_0x2714('0x20')]({'id':_0x4aae5a[_0x2714('0x21')],'value':_0x16c394[_0x4aae5a[_0x2714('0x4c')][_0x2714('0x1d')][_0x2714('0x4d')]()][_0x2714('0x28')]()});}});}return _0x5eb8bd;}function getConnection(_0x1e328e){return request({'method':_0x2714('0xd'),'form':{'method':_0x2714('0x4e'),'input_type':_0x2714('0x23'),'response_type':'JSON','rest_data':JSON[_0x2714('0x2d')]({'user_auth':{'user_name':_0x1e328e[_0x2714('0x4f')],'password':_0x1e328e[_0x2714('0x50')],'encryption':_0x2714('0x51')},'application':_0x2714('0x52')})}})[_0x2714('0x3b')](function(_0x3258a2){var _0x31c30c=_0x3258a2;if(_0x31c30c['id']){def[_0x2714('0x53')]=_0x31c30c['id'];return BPromise[_0x2714('0x37')](_0x31c30c);}else{throw new Error(util[_0x2714('0x25')]('Account\x20%d\x20is\x20not\x20valid',_0x1e328e['id']));}});}function setRelationship(_0x2b507b,_0x67f0f3,_0xca7a9b,_0x4eee05){return request({'form':{'method':_0x2714('0x54'),'input_type':_0x2714('0x23'),'response_type':_0x2714('0x23'),'rest_data':JSON[_0x2714('0x2d')]({'session':_0x2b507b['id'],'module_name':_0x2714('0x24'),'module_id':_0xca7a9b['id'],'link_field_name':_0x4eee05,'related_ids':[_0x67f0f3['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x2714('0x55')]=function(_0x356c6b,_0x1c90b5,_0x956d30,_0xaae79,_0x317e63,_0x4fd14f){var _0x2e2aa6,_0x394292,_0x5b32d2,_0x5e23c9;_0x4fd14f[_0x2714('0x56')]=intUtil[_0x2714('0x57')](_0x4fd14f[_0x2714('0x56')]);_0x4fd14f['serverUrl']=intUtil['stripTrailingSlash'](_0x4fd14f[_0x2714('0x58')]);def[_0x2714('0x59')]=util[_0x2714('0x25')](_0x2714('0x5a'),_0x4fd14f['remoteUri']);if(_0x317e63&&_0x317e63[_0x2714('0x5b')]){logger[_0x2714('0xf')](_0x2714('0x5c'),_0x2714('0x5d'));_0x1c90b5[_0x2714('0x5e')]=util[_0x2714('0x25')](_0x2714('0x5f'),_0x4fd14f['serverUrl'],_0x1c90b5[_0x2714('0x60')],md5(_0x1c90b5[_0x2714('0x60')]));}else{_0x1c90b5[_0x2714('0x5e')]='';}return getConnection(_0x4fd14f)[_0x2714('0x3b')](function(_0x1f768f){_0x5e23c9=_0x1f768f;return getUser(_0x4fd14f,_0xaae79[_0x2714('0x1d')],_0x5e23c9);})[_0x2714('0x3b')](function(_0x2c6415){_0x2e2aa6=_0x2c6415;logger[_0x2714('0xf')](_0x2714('0x61'),_0x2e2aa6['id']);return getEndUser(_0x4fd14f,_0x1c90b5[_0x2714('0x62')],_0x1c90b5['calleridnum'],_0x5e23c9);})['then'](function(_0x2177e0){_0x394292=_0x2177e0;logger['info'](_0x2714('0x63'),_0x394292['id']);return getTicket(_0x4fd14f,_0x2e2aa6,_0x394292,_0x956d30,_0x1c90b5,_0x956d30[_0x2714('0x64')],_0x5e23c9,_0x2714('0x65'));})[_0x2714('0x3b')](function(_0x4c3212){_0x5b32d2=_0x4c3212;logger[_0x2714('0xf')](_0x2714('0x66'));logger['info'](_0x2714('0x67'),_0x5b32d2['id']);return setRelationship(_0x5e23c9,_0x2e2aa6,_0x5b32d2,'users');})[_0x2714('0x3b')](function(){return setRelationship(_0x5e23c9,_0x394292,_0x5b32d2,'contacts');})[_0x2714('0x3b')](function(){return getServerInfo(_0x5e23c9);})[_0x2714('0x3b')](function(_0x46765c){var _0x58893a=parseInt(_0x46765c[_0x2714('0x68')][_0x2714('0x69')](0x0));var _0x4ed7c9=util['format'](_0x2714('0x6a'),_0x4fd14f[_0x2714('0x56')],_0x5b32d2['id']);if(_0x58893a>0x6){_0x4ed7c9=util[_0x2714('0x25')](_0x2714('0x6b'),_0x4fd14f['remoteUri'],_0x5b32d2['id']);}logger[_0x2714('0xf')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2714('0x25')](_0x2714('0x6c'),_0xaae79[_0x2714('0x1d')]),_0x2714('0x6d'),{'uri':_0x4ed7c9});})['catch'](function(_0x19b717){logger['error']('[QUEUE]',JSON[_0x2714('0x2d')](_0x19b717));});};exports['outbound']=function(_0x2d2633,_0x2e4a34,_0xfcb4f5,_0x234bc3,_0x40cba2,_0x222fcb,_0x13f8bc){var _0x869cdc,_0x307d2e,_0x2701ae,_0x44bb66;_0x222fcb[_0x2714('0x56')]=intUtil['stripTrailingSlash'](_0x222fcb['remoteUri']);_0x222fcb['serverUrl']=intUtil['stripTrailingSlash'](_0x222fcb[_0x2714('0x58')]);def[_0x2714('0x59')]=util[_0x2714('0x25')](_0x2714('0x5a'),_0x222fcb['remoteUri']);if(_0x13f8bc&&_0x13f8bc[_0x2714('0x6e')]&&_0x13f8bc[_0x2714('0x6e')]!==_0x2714('0x6f')){logger[_0x2714('0xf')](_0x2714('0x70'),_0x2714('0x5d'));_0x2e4a34[_0x2714('0x5e')]=util['format'](_0x2714('0x5f'),_0x222fcb[_0x2714('0x58')],_0x2e4a34['uniqueid'],md5(_0x2e4a34[_0x2714('0x60')]));}return getConnection(_0x222fcb)[_0x2714('0x3b')](function(_0x3d38bd){_0x44bb66=_0x3d38bd;return getUser(_0x222fcb,_0x234bc3['name'],_0x44bb66);})[_0x2714('0x3b')](function(_0x3e6ea9){_0x869cdc=_0x3e6ea9;logger['info'](_0x2714('0x61'),_0x869cdc['id']);return getEndUser(_0x222fcb,_0x2e4a34[_0x2714('0x71')],_0x2e4a34[_0x2714('0x72')],_0x44bb66);})[_0x2714('0x3b')](function(_0x55b1b1){_0x307d2e=_0x55b1b1;logger[_0x2714('0xf')](_0x2714('0x63'),_0x307d2e['id']);return getTicket(_0x222fcb,_0x869cdc,_0x307d2e,_0xfcb4f5,_0x2e4a34,_0xfcb4f5['Fields'],_0x44bb66,_0x2714('0x73'));})[_0x2714('0x3b')](function(_0x1f6279){_0x2701ae=_0x1f6279;logger[_0x2714('0xf')](_0x2714('0x66'));logger[_0x2714('0xf')]('The\x20Ticket\x20ID\x20is:',_0x2701ae['id']);return setRelationship(_0x44bb66,_0x869cdc,_0x2701ae,_0x2714('0x74'));})['then'](function(){return setRelationship(_0x44bb66,_0x307d2e,_0x2701ae,_0x2714('0x75'));})['then'](function(){return getServerInfo(_0x44bb66);})[_0x2714('0x3b')](function(_0x2a9ac8){var _0x5e38c7=parseInt(_0x2a9ac8['version'][_0x2714('0x69')](0x0));var _0x2ec97e=util[_0x2714('0x25')](_0x2714('0x6a'),_0x222fcb[_0x2714('0x56')],_0x2701ae['id']);if(_0x5e38c7>0x6){_0x2ec97e=util[_0x2714('0x25')](_0x2714('0x6b'),_0x222fcb['remoteUri'],_0x2701ae['id']);}logger[_0x2714('0xf')](_0x2714('0x70'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2714('0x25')](_0x2714('0x6c'),_0x234bc3['name']),'trigger:browser:url',{'uri':_0x2ec97e});})[_0x2714('0x76')](function(_0x25386a){logger[_0x2714('0x77')]('[OUTBOUND]',JSON[_0x2714('0x2d')](_0x25386a));});};exports['unmanaged']=function(_0x2ecd72,_0xcaf563,_0x4fd4ea,_0x3e9191,_0x2ac880,_0x423dcb){var _0x37beb3,_0x5d1432,_0x4cc924,_0x12aeca;_0x423dcb[_0x2714('0x56')]=intUtil[_0x2714('0x57')](_0x423dcb[_0x2714('0x56')]);_0x423dcb[_0x2714('0x58')]=intUtil['stripTrailingSlash'](_0x423dcb['serverUrl']);def[_0x2714('0x59')]=util[_0x2714('0x25')]('%s/service/v4_1/rest.php',_0x423dcb['remoteUri']);if(_0x2ac880&&_0x2ac880['monitor_format']){logger[_0x2714('0xf')]('['+_0xcaf563['lastevent']['toUpperCase']()+']',_0x2714('0x5d'));_0xcaf563[_0x2714('0x5e')]=util[_0x2714('0x25')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x423dcb[_0x2714('0x58')],_0xcaf563[_0x2714('0x60')],md5(_0xcaf563[_0x2714('0x60')]));}else{_0xcaf563['recordingURL']='';}return getConnection(_0x423dcb)[_0x2714('0x3b')](function(_0x2b2135){_0x12aeca=_0x2b2135;if(!_[_0x2714('0x2b')](_0x3e9191)){return getUser(_0x423dcb,_0x3e9191[_0x2714('0x1d')],_0x12aeca);}else{return getUser(_0x423dcb,null,_0x12aeca);}})[_0x2714('0x3b')](function(_0x2056cd){_0x37beb3=_0x2056cd;logger[_0x2714('0xf')](_0x2714('0x61'),_0x37beb3['id']);return getEndUser(_0x423dcb,_0xcaf563['calleridname'],_0xcaf563[_0x2714('0x78')],_0x12aeca);})['then'](function(_0x399638){_0x5d1432=_0x399638;logger[_0x2714('0xf')](_0x2714('0x63'),_0x5d1432['id']);return getTicket(_0x423dcb,_0x37beb3,_0x5d1432,_0x4fd4ea,_0xcaf563,_0x4fd4ea[_0x2714('0x64')],_0x12aeca,_0x2714('0x65'));})[_0x2714('0x3b')](function(_0x41af4b){_0x4cc924=_0x41af4b;logger[_0x2714('0xf')](_0x2714('0x66'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x4cc924['id']);return setRelationship(_0x12aeca,_0x37beb3,_0x4cc924,'users');})[_0x2714('0x3b')](function(){return setRelationship(_0x12aeca,_0x5d1432,_0x4cc924,_0x2714('0x75'));})[_0x2714('0x3b')](function(){return getServerInfo(_0x12aeca);})[_0x2714('0x76')](function(_0x50da48){logger[_0x2714('0x77')]('['+_0xcaf563[_0x2714('0x79')][_0x2714('0x7a')]()+']',JSON[_0x2714('0x2d')](_0x50da48));});}; \ No newline at end of file +var _0x968d=['set_relationship','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','catch','outbound','recordingFormat','none','destcalleridname','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','unmanaged','uri','monitor_format','lastevent','toUpperCase','calleridname','error','request-promise','bluebird','util','ioredis','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','name','getString','Subjects','description','Descriptions','toISOString','slice','replace','duration_hours','parent_type','parent_name','direction','length','forEach','variableName','push','idField','JSON','stringify','Calls','format','toString','base64','get_server_info','info','Getting\x20agent\x20with\x20name','get_entry_list','user_name','find','entry_list','name_value_list','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','then','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.','[HTTP]','merge','map','string','nameField','customField','content','type','custom_fields','customVariable','Variable','toLowerCase','POST','login','password','PLAIN','xCALLY\x20Motion\x20integration'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x968d,0x176));var _0xd968=function(_0x15fce8,_0x7612b7){_0x15fce8=_0x15fce8-0x0;var _0x3f54aa=_0x968d[_0x15fce8];return _0x3f54aa;};'use strict';var _=require('lodash');var rp=require(_0xd968('0x0'));var BPromise=require(_0xd968('0x1'));var md5=require('md5');var util=require(_0xd968('0x2'));var Redis=require(_0xd968('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xd968('0x4'))(_0xd968('0x5'));config[_0xd968('0x6')]=_[_0xd968('0x7')](config[_0xd968('0x6')],{'host':_0xd968('0x8'),'port':0x18eb});var io=require(_0xd968('0x9'))(new Redis(config[_0xd968('0x6')]));var def={'method':'POST','json':!![]};function emit(_0x4a0526,_0x1ce105,_0x4900a1){io['to'](_0x4a0526)[_0xd968('0xa')](_0x1ce105,_0x4900a1);}function getTicket(_0x5d0822,_0x19d821,_0xef066a,_0x4d7031,_0x1d9a5a,_0x1d2a6d,_0x444d33,_0x2b35e4){logger['info']('Creating\x20new\x20ticket...');var _0x23e7dd=new Date();var _0xdc232f=[{'name':_0xd968('0xb'),'value':intUtil[_0xd968('0xc')](_0x4d7031[_0xd968('0xd')],_0x1d9a5a,'\x20')},{'name':'assigned_user_id','value':_0x19d821['id']},{'name':'created_by','value':_0x19d821['id']},{'name':_0xd968('0xe'),'value':intUtil[_0xd968('0xc')](_0x4d7031[_0xd968('0xf')],_0x1d9a5a,'\x0a')},{'name':'date_start','value':_0x23e7dd[_0xd968('0x10')]()[_0xd968('0x11')](0x0,0x13)[_0xd968('0x12')]('T','\x20')},{'name':_0xd968('0x13'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0xef066a['id']},{'name':_0xd968('0x14'),'value':'Contacts'},{'name':_0xd968('0x15'),'value':_0xef066a[_0xd968('0xb')]},{'name':_0xd968('0x16'),'value':_0x2b35e4}];if(_0x1d2a6d[_0xd968('0x17')]){_[_0xd968('0x18')](_0x1d2a6d,function(_0x49d4b4){if(_0x1d9a5a[_0x49d4b4[_0xd968('0x19')]]){_0xdc232f[_0xd968('0x1a')]({'name':_0x49d4b4[_0xd968('0x1b')],'value':_0x1d9a5a[_0x49d4b4[_0xd968('0x19')]]});}});}return request({'form':{'method':'set_entry','input_type':_0xd968('0x1c'),'response_type':'JSON','rest_data':JSON[_0xd968('0x1d')]({'session':_0x444d33['id'],'module_name':_0xd968('0x1e'),'name_value_list':_0xdc232f})}});}function getAuth(_0x47108e){return util[_0xd968('0x1f')]('Basic\x20%s',new Buffer(_0x47108e['apiKey']+':X')[_0xd968('0x20')](_0xd968('0x21')));}function getServerInfo(_0x40825c){return request({'form':{'method':_0xd968('0x22'),'input_type':_0xd968('0x1c'),'response_type':'JSON','rest_data':JSON[_0xd968('0x1d')]({'session':_0x40825c['id']})}});}function getUser(_0x53ce86,_0x848884,_0x3a68ed){if(!_['isNil'](_0x848884)){logger[_0xd968('0x23')](_0xd968('0x24'),_0x848884);return request({'form':{'method':_0xd968('0x25'),'input_type':_0xd968('0x1c'),'response_type':_0xd968('0x1c'),'rest_data':JSON['stringify']({'session':_0x3a68ed['id'],'module_name':'Employees','query':util['format']('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x848884),'order_by':'','offset':'0','select_fields':['id',_0xd968('0xb'),_0xd968('0x26')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x15c22d){if(_0x15c22d['entry_list']['length']){var _0x5eac74=_[_0xd968('0x27')](_0x15c22d[_0xd968('0x28')],function(_0x43e3bd){return _0x43e3bd[_0xd968('0x29')][_0xd968('0x26')][_0xd968('0x2a')]===_0x848884;});if(_0x5eac74){logger[_0xd968('0x23')](_0xd968('0x2b'));return BPromise[_0xd968('0x2c')]({'id':_0x5eac74[_0xd968('0x29')]['id'][_0xd968('0x2a')],'name':_0x5eac74['name_value_list']['name'][_0xd968('0x2a')]});}}logger[_0xd968('0x23')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xd968('0x2c')]({'id':_0x3a68ed['name_value_list'][_0xd968('0x2d')]['value'],'name':_0x3a68ed[_0xd968('0x29')][_0xd968('0x26')][_0xd968('0x2a')]});});}else{logger['info'](_0xd968('0x2e'));return BPromise['resolve']({'id':_0x3a68ed[_0xd968('0x29')]['user_id'][_0xd968('0x2a')],'name':_0x3a68ed['name_value_list'][_0xd968('0x26')]['value']});}}function getEndUser(_0x4a147e,_0x5a1ea7,_0x4b4930,_0x5d32d8){logger['info'](_0xd968('0x2f'),_0x4b4930);return request({'form':{'method':_0xd968('0x25'),'input_type':_0xd968('0x1c'),'response_type':_0xd968('0x1c'),'rest_data':JSON[_0xd968('0x1d')]({'session':_0x5d32d8['id'],'module_name':_0xd968('0x30'),'query':util['format'](_0xd968('0x31'),_0x4b4930),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd968('0x32')](function(_0x3e2b7d){if(_0x3e2b7d['entry_list'][_0xd968('0x17')]){var _0x58b939=_[_0xd968('0x27')](_0x3e2b7d[_0xd968('0x28')],function(_0x315ace){return _0x315ace[_0xd968('0x29')][_0xd968('0x33')][_0xd968('0x2a')]===_0x4b4930;});if(_0x58b939){logger['info'](_0xd968('0x34'));return BPromise[_0xd968('0x2c')]({'id':_0x58b939[_0xd968('0x29')]['id']['value'],'name':_0x58b939[_0xd968('0x29')]['name'][_0xd968('0x2a')],'phone':_0x58b939[_0xd968('0x29')]['phone_home'][_0xd968('0x2a')]});}}else{logger[_0xd968('0x23')](_0xd968('0x35'));return request({'form':{'method':'set_entry','input_type':_0xd968('0x1c'),'response_type':'JSON','rest_data':JSON[_0xd968('0x1d')]({'session':_0x5d32d8['id'],'module_name':_0xd968('0x30'),'name_value_list':[{'name':_0xd968('0x36'),'value':_0x5a1ea7!==_0xd968('0x37')?_0x5a1ea7:util[_0xd968('0x1f')]('Caller\x20-\x20%s',_0x4b4930)},{'name':_0xd968('0x33'),'value':_0x4b4930}]})}})[_0xd968('0x32')](function(_0x475100){logger['info'](_0xd968('0x38'));return BPromise[_0xd968('0x2c')]({'id':_0x475100['id'],'name':_0x475100[_0xd968('0x28')][_0xd968('0x36')][_0xd968('0x2a')],'phone':_0x475100[_0xd968('0x28')][_0xd968('0x33')][_0xd968('0x2a')]});});}});}function request(_0x3f81d8){logger['debug'](_0xd968('0x39'),JSON[_0xd968('0x1d')](_0x3f81d8));return rp(_[_0xd968('0x3a')](def,_0x3f81d8));}function getTags(_0x201470,_0x24169c){var _0x7a60c6=[];if(_0x201470&&_0x201470[_0xd968('0x17')]>0x0){_0x7a60c6=_[_0xd968('0x3b')](_0x201470,_0x24169c);}return _0x7a60c6;}function getCustomFields(_0x58ca24,_0xb37c7b){var _0x5aecd8=[];var _0x3029fa={'custom_fields':[]};if(_0x58ca24[_0xd968('0x17')]>0x0){_[_0xd968('0x18')](_0x58ca24,function(_0x28fc93){if(_0x28fc93['type']===_0xd968('0x3c')&&_0x28fc93[_0xd968('0x3d')]&&!_0x28fc93[_0xd968('0x3e')]){_0x3029fa[_0x28fc93[_0xd968('0x3d')]['toLowerCase']()]=_0x28fc93[_0xd968('0x3f')][_0xd968('0x20')]();}else if(_0x28fc93[_0xd968('0x40')]===_0xd968('0x3c')&&_0x28fc93[_0xd968('0x1b')]&&_0x28fc93[_0xd968('0x3e')]){_0x3029fa['custom_fields']['push']({'id':_0x28fc93[_0xd968('0x1b')],'value':_0x28fc93[_0xd968('0x3f')][_0xd968('0x20')]()});}else if(_0x28fc93[_0xd968('0x40')]==='variable'&&_0x28fc93[_0xd968('0x19')]&&_0x28fc93[_0xd968('0x1b')]&&_0x28fc93[_0xd968('0x3e')]){_0xb37c7b[_0x28fc93['variableName']]&&_0x3029fa[_0xd968('0x41')][_0xd968('0x1a')]({'id':_0x28fc93[_0xd968('0x1b')],'value':_0xb37c7b[_0x28fc93[_0xd968('0x19')]][_0xd968('0x20')]()});}else if(_0x28fc93[_0xd968('0x40')]===_0xd968('0x42')&&_0x28fc93['Variable']&&_0x28fc93[_0xd968('0x43')]['name']&&_0x28fc93[_0xd968('0x1b')]&&_0x28fc93['customField']){_0xb37c7b[_0x28fc93['Variable'][_0xd968('0xb')][_0xd968('0x44')]()]&&_0x3029fa[_0xd968('0x41')]['push']({'id':_0x28fc93['idField'],'value':_0xb37c7b[_0x28fc93['Variable'][_0xd968('0xb')][_0xd968('0x44')]()]['toString']()});}});}return _0x3029fa;}function getConnection(_0x1ee892){return request({'method':_0xd968('0x45'),'form':{'method':_0xd968('0x46'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xd968('0x1d')]({'user_auth':{'user_name':_0x1ee892['username'],'password':_0x1ee892[_0xd968('0x47')],'encryption':_0xd968('0x48')},'application':_0xd968('0x49')})}})[_0xd968('0x32')](function(_0x34ad6b){var _0x25c018=_0x34ad6b;if(_0x25c018['id']){def['sessionID']=_0x25c018['id'];return BPromise[_0xd968('0x2c')](_0x25c018);}else{throw new Error(util[_0xd968('0x1f')]('Account\x20%d\x20is\x20not\x20valid',_0x1ee892['id']));}});}function setRelationship(_0x2bdd99,_0x4cafa4,_0x5f0ebf,_0x446994){return request({'form':{'method':_0xd968('0x4a'),'input_type':_0xd968('0x1c'),'response_type':_0xd968('0x1c'),'rest_data':JSON[_0xd968('0x1d')]({'session':_0x2bdd99['id'],'module_name':'Calls','module_id':_0x5f0ebf['id'],'link_field_name':_0x446994,'related_ids':[_0x4cafa4['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x1c245a,_0x196658,_0x27ad5d,_0x434bd5,_0x8e1c07,_0x24195c){var _0x32c9d1,_0x33a453,_0x3a01ca,_0x1eb00d;_0x24195c[_0xd968('0x4b')]=intUtil[_0xd968('0x4c')](_0x24195c[_0xd968('0x4b')]);_0x24195c[_0xd968('0x4d')]=intUtil['stripTrailingSlash'](_0x24195c['serverUrl']);def['uri']=util[_0xd968('0x1f')](_0xd968('0x4e'),_0x24195c['remoteUri']);if(_0x8e1c07&&_0x8e1c07['monitor_format']){logger[_0xd968('0x23')](_0xd968('0x4f'),_0xd968('0x50'));_0x196658['recordingURL']=util[_0xd968('0x1f')](_0xd968('0x51'),_0x24195c['serverUrl'],_0x196658[_0xd968('0x52')],md5(_0x196658[_0xd968('0x52')]));}else{_0x196658[_0xd968('0x53')]='';}return getConnection(_0x24195c)['then'](function(_0x151ed9){_0x1eb00d=_0x151ed9;return getUser(_0x24195c,_0x434bd5['name'],_0x1eb00d);})['then'](function(_0x7cccd4){_0x32c9d1=_0x7cccd4;logger[_0xd968('0x23')](_0xd968('0x54'),_0x32c9d1['id']);return getEndUser(_0x24195c,_0x196658['calleridname'],_0x196658[_0xd968('0x55')],_0x1eb00d);})[_0xd968('0x32')](function(_0x42d116){_0x33a453=_0x42d116;logger['info'](_0xd968('0x56'),_0x33a453['id']);return getTicket(_0x24195c,_0x32c9d1,_0x33a453,_0x27ad5d,_0x196658,_0x27ad5d[_0xd968('0x57')],_0x1eb00d,'Inbound');})[_0xd968('0x32')](function(_0x18724b){_0x3a01ca=_0x18724b;logger[_0xd968('0x23')](_0xd968('0x58'));logger[_0xd968('0x23')](_0xd968('0x59'),_0x3a01ca['id']);return setRelationship(_0x1eb00d,_0x32c9d1,_0x3a01ca,_0xd968('0x5a'));})[_0xd968('0x32')](function(){return setRelationship(_0x1eb00d,_0x33a453,_0x3a01ca,_0xd968('0x5b'));})['then'](function(){return getServerInfo(_0x1eb00d);})[_0xd968('0x32')](function(_0x18d162){var _0x216ca9=parseInt(_0x18d162[_0xd968('0x5c')][_0xd968('0x5d')](0x0));var _0x3f536c=util[_0xd968('0x1f')](_0xd968('0x5e'),_0x24195c[_0xd968('0x4b')],_0x3a01ca['id']);if(_0x216ca9>0x6){_0x3f536c=util[_0xd968('0x1f')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x24195c['remoteUri'],_0x3a01ca['id']);}logger['info'](_0xd968('0x4f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd968('0x1f')](_0xd968('0x5f'),_0x434bd5[_0xd968('0xb')]),'trigger:browser:url',{'uri':_0x3f536c});})[_0xd968('0x60')](function(_0x4464f2){logger['error'](_0xd968('0x4f'),JSON[_0xd968('0x1d')](_0x4464f2));});};exports[_0xd968('0x61')]=function(_0xbe9668,_0x4776f0,_0x3c93dc,_0x5b6609,_0x39773b,_0x11f315,_0xe3cd84){var _0x181ac4,_0x396890,_0x2213d6,_0xa66cd3;_0x11f315[_0xd968('0x4b')]=intUtil[_0xd968('0x4c')](_0x11f315['remoteUri']);_0x11f315[_0xd968('0x4d')]=intUtil['stripTrailingSlash'](_0x11f315[_0xd968('0x4d')]);def['uri']=util[_0xd968('0x1f')]('%s/service/v4_1/rest.php',_0x11f315[_0xd968('0x4b')]);if(_0xe3cd84&&_0xe3cd84[_0xd968('0x62')]&&_0xe3cd84[_0xd968('0x62')]!==_0xd968('0x63')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4776f0[_0xd968('0x53')]=util['format'](_0xd968('0x51'),_0x11f315['serverUrl'],_0x4776f0[_0xd968('0x52')],md5(_0x4776f0['uniqueid']));}return getConnection(_0x11f315)[_0xd968('0x32')](function(_0x4183b7){_0xa66cd3=_0x4183b7;return getUser(_0x11f315,_0x5b6609[_0xd968('0xb')],_0xa66cd3);})[_0xd968('0x32')](function(_0x315c76){_0x181ac4=_0x315c76;logger[_0xd968('0x23')](_0xd968('0x54'),_0x181ac4['id']);return getEndUser(_0x11f315,_0x4776f0[_0xd968('0x64')],_0x4776f0['destcalleridnum'],_0xa66cd3);})['then'](function(_0x18f7d3){_0x396890=_0x18f7d3;logger[_0xd968('0x23')](_0xd968('0x56'),_0x396890['id']);return getTicket(_0x11f315,_0x181ac4,_0x396890,_0x3c93dc,_0x4776f0,_0x3c93dc[_0xd968('0x57')],_0xa66cd3,'Outbound');})[_0xd968('0x32')](function(_0x4d4677){_0x2213d6=_0x4d4677;logger[_0xd968('0x23')]('Ticket\x20created!');logger[_0xd968('0x23')]('The\x20Ticket\x20ID\x20is:',_0x2213d6['id']);return setRelationship(_0xa66cd3,_0x181ac4,_0x2213d6,_0xd968('0x5a'));})[_0xd968('0x32')](function(){return setRelationship(_0xa66cd3,_0x396890,_0x2213d6,_0xd968('0x5b'));})[_0xd968('0x32')](function(){return getServerInfo(_0xa66cd3);})[_0xd968('0x32')](function(_0x11ded7){var _0x2fc5e1=parseInt(_0x11ded7[_0xd968('0x5c')][_0xd968('0x5d')](0x0));var _0x3c3829=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x11f315['remoteUri'],_0x2213d6['id']);if(_0x2fc5e1>0x6){_0x3c3829=util[_0xd968('0x1f')](_0xd968('0x65'),_0x11f315[_0xd968('0x4b')],_0x2213d6['id']);}logger[_0xd968('0x23')](_0xd968('0x66'),_0xd968('0x67'));emit(util[_0xd968('0x1f')]('user:%s',_0x5b6609['name']),_0xd968('0x68'),{'uri':_0x3c3829});})[_0xd968('0x60')](function(_0x40ef83){logger['error']('[OUTBOUND]',JSON[_0xd968('0x1d')](_0x40ef83));});};exports[_0xd968('0x69')]=function(_0x9f3601,_0x2db738,_0x54215a,_0x17da7b,_0xd6a226,_0xc1e41c){var _0x1b49a6,_0x37518a,_0x3973d8,_0x33173d;_0xc1e41c[_0xd968('0x4b')]=intUtil[_0xd968('0x4c')](_0xc1e41c[_0xd968('0x4b')]);_0xc1e41c[_0xd968('0x4d')]=intUtil[_0xd968('0x4c')](_0xc1e41c[_0xd968('0x4d')]);def[_0xd968('0x6a')]=util[_0xd968('0x1f')](_0xd968('0x4e'),_0xc1e41c['remoteUri']);if(_0xd6a226&&_0xd6a226[_0xd968('0x6b')]){logger[_0xd968('0x23')]('['+_0x2db738[_0xd968('0x6c')][_0xd968('0x6d')]()+']','Recording\x20is\x20enabled!');_0x2db738[_0xd968('0x53')]=util[_0xd968('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xc1e41c[_0xd968('0x4d')],_0x2db738[_0xd968('0x52')],md5(_0x2db738[_0xd968('0x52')]));}else{_0x2db738[_0xd968('0x53')]='';}return getConnection(_0xc1e41c)[_0xd968('0x32')](function(_0x2fdbde){_0x33173d=_0x2fdbde;if(!_['isNil'](_0x17da7b)){return getUser(_0xc1e41c,_0x17da7b['name'],_0x33173d);}else{return getUser(_0xc1e41c,null,_0x33173d);}})['then'](function(_0x428d46){_0x1b49a6=_0x428d46;logger[_0xd968('0x23')]('The\x20User\x20ID\x20is:',_0x1b49a6['id']);return getEndUser(_0xc1e41c,_0x2db738[_0xd968('0x6e')],_0x2db738[_0xd968('0x55')],_0x33173d);})['then'](function(_0x3f62ca){_0x37518a=_0x3f62ca;logger['info'](_0xd968('0x56'),_0x37518a['id']);return getTicket(_0xc1e41c,_0x1b49a6,_0x37518a,_0x54215a,_0x2db738,_0x54215a[_0xd968('0x57')],_0x33173d,'Inbound');})[_0xd968('0x32')](function(_0x199963){_0x3973d8=_0x199963;logger[_0xd968('0x23')](_0xd968('0x58'));logger[_0xd968('0x23')](_0xd968('0x59'),_0x3973d8['id']);return setRelationship(_0x33173d,_0x1b49a6,_0x3973d8,_0xd968('0x5a'));})[_0xd968('0x32')](function(){return setRelationship(_0x33173d,_0x37518a,_0x3973d8,_0xd968('0x5b'));})['then'](function(){return getServerInfo(_0x33173d);})[_0xd968('0x60')](function(_0x1f9d2a){logger[_0xd968('0x6f')]('['+_0x2db738[_0xd968('0x6c')][_0xd968('0x6d')]()+']',JSON[_0xd968('0x1d')](_0x1f9d2a));});}; \ 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 76081eb..ce84288 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 _0xcdc4=['sortBy','type','string','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','format','%s:\x20%s','key','keyContent','join','stripTrailingSlash','slice','substring','validateEmail','isNil','lodash','util','getString','length'];(function(_0x451f88,_0x5c061a){var _0x2cc2b7=function(_0x5bb6ce){while(--_0x5bb6ce){_0x451f88['push'](_0x451f88['shift']());}};_0x2cc2b7(++_0x5c061a);}(_0xcdc4,0x168));var _0x4cdc=function(_0x55f47b,_0x58b84b){_0x55f47b=_0x55f47b-0x0;var _0x163c2e=_0xcdc4[_0x55f47b];return _0x163c2e;};'use strict';var _=require(_0x4cdc('0x0'));var util=require(_0x4cdc('0x1'));exports[_0x4cdc('0x2')]=function(_0x369e23,_0x26c4b3,_0x5d341e){var _0x229757=[];if(_0x369e23[_0x4cdc('0x3')]>0x0){var _0x2bc58c=_[_0x4cdc('0x4')](_0x369e23,['id']);for(var _0x528ce8=0x0;_0x528ce8<_0x2bc58c[_0x4cdc('0x3')];_0x528ce8++){var _0x47e640=_0x2bc58c[_0x528ce8];if(_0x47e640[_0x4cdc('0x5')]===_0x4cdc('0x6')){_0x229757[_0x4cdc('0x7')](_0x47e640[_0x4cdc('0x8')]);}else if(_0x47e640['type']===_0x4cdc('0x9')&&_0x47e640[_0x4cdc('0xa')]){_0x26c4b3[_0x47e640['variableName']]&&_0x229757['push'](_0x26c4b3[_0x47e640[_0x4cdc('0xa')]][_0x4cdc('0xb')]());}else if(_0x47e640['type']===_0x4cdc('0xc')&&_0x47e640[_0x4cdc('0xd')]&&_0x47e640[_0x4cdc('0xd')][_0x4cdc('0xe')]){_0x26c4b3[_0x47e640['Variable'][_0x4cdc('0xe')][_0x4cdc('0xf')]()]&&_0x229757[_0x4cdc('0x7')](_0x26c4b3[_0x47e640[_0x4cdc('0xd')]['name'][_0x4cdc('0xf')]()][_0x4cdc('0xb')]());}else if(_0x47e640['type']===_0x4cdc('0x10')){if(_0x47e640[_0x4cdc('0x11')]===_0x4cdc('0x6')&&_0x47e640['key']){_0x229757[_0x4cdc('0x7')](util[_0x4cdc('0x12')](_0x4cdc('0x13'),_0x47e640[_0x4cdc('0x14')],_0x47e640[_0x4cdc('0x15')]));}else if(_0x47e640[_0x4cdc('0x11')]==='variable'&&_0x47e640[_0x4cdc('0xa')]&&_0x47e640[_0x4cdc('0x14')]){_0x26c4b3[_0x47e640[_0x4cdc('0xa')]]&&_0x229757[_0x4cdc('0x7')](util[_0x4cdc('0x12')](_0x4cdc('0x13'),_0x47e640[_0x4cdc('0x14')],_0x26c4b3[_0x47e640['variableName']]));}else if(_0x47e640[_0x4cdc('0x11')]===_0x4cdc('0xc')&&_0x47e640[_0x4cdc('0xd')]&&_0x47e640[_0x4cdc('0xd')]['name']&&_0x47e640[_0x4cdc('0x14')]){_0x26c4b3[_0x47e640[_0x4cdc('0xd')][_0x4cdc('0xe')][_0x4cdc('0xf')]()]&&_0x229757[_0x4cdc('0x7')](util[_0x4cdc('0x12')]('%s:\x20%s',_0x47e640['key'],_0x26c4b3[_0x47e640[_0x4cdc('0xd')][_0x4cdc('0xe')]['toLowerCase']()]));}}}}return _0x229757[_0x4cdc('0x16')](_0x5d341e);};exports[_0x4cdc('0x17')]=function(_0xc9424a){var _0x45c9c3=_0xc9424a[_0x4cdc('0x18')](-0x1);if(_0x45c9c3==='/'){_0xc9424a=_0xc9424a[_0x4cdc('0x19')](0x0,_0xc9424a['lastIndexOf'](_0x45c9c3));}return _0xc9424a;};exports[_0x4cdc('0x1a')]=function(_0x50bd1a){if(!_[_0x4cdc('0x1b')](_0x50bd1a)&&_0x50bd1a!==''){var _0x3cc375=/^(([^<>()\[\]\\.,;:\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 _0x3cc375['test'](String(_0x50bd1a)[_0x4cdc('0xf')]());}else{return![];}}; \ No newline at end of file +var _0x4842=['content','variable','variableName','push','toString','type','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','lodash','util','getString','length','string'];(function(_0x49a6e3,_0x44653c){var _0x137dba=function(_0x59d1ff){while(--_0x59d1ff){_0x49a6e3['push'](_0x49a6e3['shift']());}};_0x137dba(++_0x44653c);}(_0x4842,0x1bd));var _0x2484=function(_0x4d709a,_0x27183f){_0x4d709a=_0x4d709a-0x0;var _0x45f034=_0x4842[_0x4d709a];return _0x45f034;};'use strict';var _=require(_0x2484('0x0'));var util=require(_0x2484('0x1'));exports[_0x2484('0x2')]=function(_0x271721,_0x282ac8,_0x4575c7){var _0x226fa6=[];if(_0x271721[_0x2484('0x3')]>0x0){var _0x523f6c=_['sortBy'](_0x271721,['id']);for(var _0x3e5391=0x0;_0x3e5391<_0x523f6c[_0x2484('0x3')];_0x3e5391++){var _0x29d753=_0x523f6c[_0x3e5391];if(_0x29d753['type']===_0x2484('0x4')){_0x226fa6['push'](_0x29d753[_0x2484('0x5')]);}else if(_0x29d753['type']===_0x2484('0x6')&&_0x29d753[_0x2484('0x7')]){_0x282ac8[_0x29d753[_0x2484('0x7')]]&&_0x226fa6[_0x2484('0x8')](_0x282ac8[_0x29d753[_0x2484('0x7')]][_0x2484('0x9')]());}else if(_0x29d753[_0x2484('0xa')]===_0x2484('0xb')&&_0x29d753[_0x2484('0xc')]&&_0x29d753[_0x2484('0xc')][_0x2484('0xd')]){_0x282ac8[_0x29d753[_0x2484('0xc')][_0x2484('0xd')][_0x2484('0xe')]()]&&_0x226fa6[_0x2484('0x8')](_0x282ac8[_0x29d753[_0x2484('0xc')][_0x2484('0xd')][_0x2484('0xe')]()][_0x2484('0x9')]());}else if(_0x29d753[_0x2484('0xa')]===_0x2484('0xf')){if(_0x29d753[_0x2484('0x10')]===_0x2484('0x4')&&_0x29d753[_0x2484('0x11')]){_0x226fa6[_0x2484('0x8')](util[_0x2484('0x12')](_0x2484('0x13'),_0x29d753['key'],_0x29d753['keyContent']));}else if(_0x29d753[_0x2484('0x10')]===_0x2484('0x6')&&_0x29d753['variableName']&&_0x29d753[_0x2484('0x11')]){_0x282ac8[_0x29d753[_0x2484('0x7')]]&&_0x226fa6[_0x2484('0x8')](util[_0x2484('0x12')]('%s:\x20%s',_0x29d753[_0x2484('0x11')],_0x282ac8[_0x29d753[_0x2484('0x7')]]));}else if(_0x29d753['keyType']===_0x2484('0xb')&&_0x29d753[_0x2484('0xc')]&&_0x29d753[_0x2484('0xc')]['name']&&_0x29d753['key']){_0x282ac8[_0x29d753[_0x2484('0xc')][_0x2484('0xd')][_0x2484('0xe')]()]&&_0x226fa6[_0x2484('0x8')](util[_0x2484('0x12')](_0x2484('0x13'),_0x29d753[_0x2484('0x11')],_0x282ac8[_0x29d753[_0x2484('0xc')][_0x2484('0xd')][_0x2484('0xe')]()]));}}}}return _0x226fa6[_0x2484('0x14')](_0x4575c7);};exports[_0x2484('0x15')]=function(_0x343a56){var _0x40e883=_0x343a56['slice'](-0x1);if(_0x40e883==='/'){_0x343a56=_0x343a56[_0x2484('0x16')](0x0,_0x343a56[_0x2484('0x17')](_0x40e883));}return _0x343a56;};exports[_0x2484('0x18')]=function(_0x4d1e3f){if(!_['isNil'](_0x4d1e3f)&&_0x4d1e3f!==''){var _0x421e26=/^(([^<>()\[\]\\.,;:\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 _0x421e26['test'](String(_0x4d1e3f)[_0x2484('0xe')]());}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 fbe6cf3..c1508be 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 _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x122e6b,_0x20919d){var _0x38e5e1=function(_0x58d20a){while(--_0x58d20a){_0x122e6b['push'](_0x122e6b['shift']());}};_0x38e5e1(++_0x20919d);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x57a06a,_0x58d2e6){var _0x5a4b86=function(_0x2272b0){while(--_0x2272b0){_0x57a06a['push'](_0x57a06a['shift']());}};_0x5a4b86(++_0x58d2e6);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index bf82f27..0f374b9 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 _0xe2c7=['Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','filter','Enduser\x20found!','end-user','Enduser\x20created.','authType','username','password','token','%s/token:%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','push','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:browser:url','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','catch','lastevent','lodash','request-promise','util','./util','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Fields','then','info','ticket','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user'];(function(_0x488ca1,_0xf6858e){var _0x4dd0a4=function(_0x40fb65){while(--_0x40fb65){_0x488ca1['push'](_0x488ca1['shift']());}};_0x4dd0a4(++_0xf6858e);}(_0xe2c7,0x18e));var _0x7e2c=function(_0x18af13,_0x1a0693){_0x18af13=_0x18af13-0x0;var _0x37a567=_0xe2c7[_0x18af13];return _0x37a567;};'use strict';var _=require(_0x7e2c('0x0'));var rp=require(_0x7e2c('0x1'));var md5=require('md5');var util=require(_0x7e2c('0x2'));var Redis=require('ioredis');var intUtil=require(_0x7e2c('0x3'));var config=require('../../../../config/environment');var logger=require(_0x7e2c('0x4'))(_0x7e2c('0x5'));config[_0x7e2c('0x6')]=_[_0x7e2c('0x7')](config['redis'],{'host':_0x7e2c('0x8'),'port':0x18eb});var io=require(_0x7e2c('0x9'))(new Redis(config[_0x7e2c('0x6')]));function emit(_0x32f434,_0x1d1e9e,_0x1342f5){io['to'](_0x32f434)[_0x7e2c('0xa')](_0x1d1e9e,_0x1342f5);}var headers={'Content-Type':_0x7e2c('0xb'),'Accept':'application/json'};function getTicket(_0x32255c,_0x11f8b5,_0x2019d6,_0x23368d,_0x181f02){logger['info'](_0x7e2c('0xc'));return request({'uri':util[_0x7e2c('0xd')](_0x7e2c('0xe'),_0x32255c[_0x7e2c('0xf')]),'method':_0x7e2c('0x10'),'body':{'ticket':_[_0x7e2c('0x11')]({'requester_id':_0x2019d6['id'],'submitter_id':_0x11f8b5?_0x11f8b5['id']:undefined,'assignee_id':_0x11f8b5?_0x11f8b5['id']:undefined,'tags':getTags(_0x23368d[_0x7e2c('0x12')],'name'),'subject':intUtil[_0x7e2c('0x13')](_0x23368d['Subjects'],_0x181f02,'\x20'),'description':intUtil[_0x7e2c('0x13')](_0x23368d['Descriptions'],_0x181f02,'\x0a'),'comment':{'public':![],'body':intUtil[_0x7e2c('0x13')](_0x23368d['Descriptions'],_0x181f02,'\x0a')}},getCustomFields(_0x23368d[_0x7e2c('0x14')],_0x181f02))}})[_0x7e2c('0x15')](function(_0x1997bf){logger[_0x7e2c('0x16')]('Ticket\x20created!');return _0x1997bf[_0x7e2c('0x17')];});}function getUser(_0x137dff,_0x1b56a8){if(intUtil['validateEmail'](_0x1b56a8)){logger[_0x7e2c('0x16')](_0x7e2c('0x18'),_0x1b56a8);return request({'uri':util['format']('%s/search.json',_0x137dff[_0x7e2c('0xf')]),'qs':{'query':util[_0x7e2c('0xd')](_0x7e2c('0x19'),_0x1b56a8)}})[_0x7e2c('0x15')](function(_0xa4fd6d){if(_0xa4fd6d[_0x7e2c('0x1a')]){logger['info'](_0x7e2c('0x1b'));return _[_0x7e2c('0x1c')](_0xa4fd6d[_0x7e2c('0x1d')],{'email':_0x1b56a8,'role':'agent'});}else{logger[_0x7e2c('0x16')](_0x7e2c('0x1e'));return request({'uri':util[_0x7e2c('0xd')](_0x7e2c('0x1f'),_0x137dff[_0x7e2c('0xf')])})[_0x7e2c('0x15')](function(_0x1b2eef){logger[_0x7e2c('0x16')](_0x7e2c('0x20'));return _0x1b2eef[_0x7e2c('0x21')];});}});}else{logger[_0x7e2c('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x7e2c('0xd')](_0x7e2c('0x1f'),_0x137dff[_0x7e2c('0xf')])})['then'](function(_0x458d8e){logger[_0x7e2c('0x16')](_0x7e2c('0x20'));return _0x458d8e[_0x7e2c('0x21')];});}}function getEndUser(_0x2bff48,_0x12ab64,_0x403ffa){logger[_0x7e2c('0x16')](_0x7e2c('0x22'),_0x403ffa);return request({'uri':util['format'](_0x7e2c('0x23'),_0x2bff48[_0x7e2c('0xf')]),'qs':{'query':util[_0x7e2c('0xd')](_0x7e2c('0x24'),_0x403ffa)}})[_0x7e2c('0x15')](function(_0x4f1112){var _0xdf4e6;if(_0x4f1112[_0x7e2c('0x1d')][_0x7e2c('0x25')]){_0x4f1112['results']=_[_0x7e2c('0x26')](_0x4f1112[_0x7e2c('0x1d')],{'suspended':![],'role':'end-user'});if(_0x4f1112[_0x7e2c('0x1d')][_0x7e2c('0x25')]){_0xdf4e6=_['first'](_0x4f1112[_0x7e2c('0x1d')]);}}if(_0xdf4e6){logger[_0x7e2c('0x16')](_0x7e2c('0x27'));return _0xdf4e6;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x7e2c('0xd')]('%s/users.json',_0x2bff48[_0x7e2c('0xf')]),'method':_0x7e2c('0x10'),'body':{'user':{'role':_0x7e2c('0x28'),'name':util[_0x7e2c('0xd')]('Caller\x20-\x20%s',_0x12ab64||_0x403ffa),'phone':_0x403ffa}}})[_0x7e2c('0x15')](function(_0x3af927){logger[_0x7e2c('0x16')](_0x7e2c('0x29'));return _0x3af927[_0x7e2c('0x21')];});}});}function getAuth(_0x2ec906){var _0xbedd7a;if(_0x2ec906[_0x7e2c('0x2a')]==='password'){_0xbedd7a=util[_0x7e2c('0xd')]('%s:%s',_0x2ec906[_0x7e2c('0x2b')],_0x2ec906[_0x7e2c('0x2c')]);}else if(_0x2ec906[_0x7e2c('0x2a')]===_0x7e2c('0x2d')){_0xbedd7a=util[_0x7e2c('0xd')](_0x7e2c('0x2e'),_0x2ec906[_0x7e2c('0x2b')],_0x2ec906[_0x7e2c('0x2d')]);}return util[_0x7e2c('0xd')]('Basic\x20%s',new Buffer(_0xbedd7a)[_0x7e2c('0x2f')](_0x7e2c('0x30')));}function request(_0x2c3f1a){logger[_0x7e2c('0x31')](_0x7e2c('0x32'),JSON[_0x7e2c('0x33')](_0x2c3f1a));return rp(_[_0x7e2c('0x7')](_0x2c3f1a,{'method':_0x7e2c('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x2df6f6,_0x5ea107){var _0x1281d3=[];if(_0x2df6f6&&_0x2df6f6[_0x7e2c('0x25')]>0x0){_0x1281d3=_[_0x7e2c('0x35')](_0x2df6f6,_0x5ea107);}return _0x1281d3;}function getCustomFields(_0x2a835c,_0x550a33){var _0x3471a1=[];var _0x3743dd={'custom_fields':[]};if(_0x2a835c['length']>0x0){_[_0x7e2c('0x36')](_0x2a835c,function(_0x341d69){if(_[_0x7e2c('0x37')]([_0x7e2c('0x38'),_0x7e2c('0x39')],_0x341d69['type'])&&_0x341d69[_0x7e2c('0x3a')]&&!_0x341d69[_0x7e2c('0x3b')]){_0x3743dd[_0x341d69[_0x7e2c('0x3a')][_0x7e2c('0x3c')]()]=_0x341d69[_0x7e2c('0x3d')][_0x7e2c('0x2f')]();}else if(_[_0x7e2c('0x37')]([_0x7e2c('0x38'),_0x7e2c('0x39')],_0x341d69[_0x7e2c('0x3e')])&&_0x341d69['idField']&&_0x341d69[_0x7e2c('0x3b')]){_0x3743dd[_0x7e2c('0x3f')]['push']({'id':_0x341d69['idField'],'value':_0x341d69[_0x7e2c('0x3d')][_0x7e2c('0x2f')]()});}else if(_0x341d69[_0x7e2c('0x3e')]===_0x7e2c('0x40')&&_0x341d69[_0x7e2c('0x41')]&&_0x341d69[_0x7e2c('0x42')]&&_0x341d69[_0x7e2c('0x3b')]){_0x550a33[_0x341d69['variableName']]&&_0x3743dd[_0x7e2c('0x3f')][_0x7e2c('0x43')]({'id':_0x341d69[_0x7e2c('0x42')],'value':_0x550a33[_0x341d69[_0x7e2c('0x41')]][_0x7e2c('0x2f')]()});}else if(_0x341d69['type']===_0x7e2c('0x44')&&_0x341d69[_0x7e2c('0x45')]&&_0x341d69[_0x7e2c('0x45')][_0x7e2c('0x46')]&&_0x341d69[_0x7e2c('0x42')]&&_0x341d69[_0x7e2c('0x3b')]){_0x550a33[_0x341d69[_0x7e2c('0x45')]['name'][_0x7e2c('0x3c')]()]&&_0x3743dd[_0x7e2c('0x3f')]['push']({'id':_0x341d69[_0x7e2c('0x42')],'value':_0x550a33[_0x341d69['Variable'][_0x7e2c('0x46')][_0x7e2c('0x3c')]()]['toString']()});}});}return _0x3743dd;}exports[_0x7e2c('0x47')]=function(_0x20a0fa,_0x1077ae,_0x50677f,_0x46984a,_0x138718,_0x17d28e){var _0x353f0a,_0x29df81;_0x17d28e[_0x7e2c('0xf')]=intUtil[_0x7e2c('0x48')](_0x17d28e[_0x7e2c('0xf')]);_0x17d28e[_0x7e2c('0x49')]=intUtil[_0x7e2c('0x48')](_0x17d28e[_0x7e2c('0x49')]);if(_0x138718&&_0x138718[_0x7e2c('0x4a')]){logger[_0x7e2c('0x16')](_0x7e2c('0x4b'),_0x7e2c('0x4c'));_0x1077ae['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x17d28e[_0x7e2c('0x49')],_0x1077ae['uniqueid'],md5(_0x1077ae[_0x7e2c('0x4d')]));}else{_0x1077ae[_0x7e2c('0x4e')]='';}headers[_0x7e2c('0x4f')]=getAuth(_0x17d28e);return getUser(_0x17d28e,_0x46984a[_0x7e2c('0x50')])[_0x7e2c('0x15')](function(_0x24332d){_0x353f0a=_0x24332d;logger[_0x7e2c('0x16')](_0x7e2c('0x51'),_0x353f0a['id']);return getEndUser(_0x17d28e,_0x1077ae[_0x7e2c('0x52')],_0x1077ae[_0x7e2c('0x53')]);})[_0x7e2c('0x15')](function(_0x4c2f48){_0x29df81=_0x4c2f48;logger[_0x7e2c('0x16')]('The\x20Enduser\x20ID\x20is:',_0x29df81['id']);return getTicket(_0x17d28e,_0x353f0a,_0x29df81,_0x50677f,_0x1077ae);})[_0x7e2c('0x15')](function(_0x87230c){if(_0x87230c){logger[_0x7e2c('0x16')](_0x7e2c('0x54'),_0x87230c['id']);switch(_0x17d28e[_0x7e2c('0x3e')]){case _0x7e2c('0x55'):logger[_0x7e2c('0x16')]('[QUEUE]',_0x7e2c('0x56'));return request({'uri':util[_0x7e2c('0xd')](_0x7e2c('0x57'),_0x17d28e[_0x7e2c('0xf')],_0x353f0a['id'],_0x87230c['id']),'method':_0x7e2c('0x10')});case'newTab':logger['info'](_0x7e2c('0x4b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7e2c('0xd')](_0x7e2c('0x58'),_0x46984a['name']),'trigger:browser:url',{'uri':util[_0x7e2c('0xd')](_0x7e2c('0x59'),_0x17d28e[_0x7e2c('0xf')][_0x7e2c('0x5a')](_0x7e2c('0x5b'),''),_0x87230c['id'])});break;default:logger['error']('[QUEUE]',_0x7e2c('0x5c'));}}})['catch'](function(_0x11e5cd){logger[_0x7e2c('0x5d')](_0x7e2c('0x5e'),util[_0x7e2c('0x5f')](_0x11e5cd,{'showHidden':!![],'depth':null}));});};exports[_0x7e2c('0x60')]=function(_0x5a4131,_0x451dfe,_0x17233c,_0x20b7e0,_0xf9c053,_0x1366d7,_0x25b894){var _0xbdb8f6,_0x48daf2;_0x1366d7['remoteUri']=intUtil['stripTrailingSlash'](_0x1366d7[_0x7e2c('0xf')]);_0x1366d7[_0x7e2c('0x49')]=intUtil[_0x7e2c('0x48')](_0x1366d7[_0x7e2c('0x49')]);if(_0x25b894&&_0x25b894[_0x7e2c('0x61')]&&_0x25b894[_0x7e2c('0x61')]!==_0x7e2c('0x62')){logger[_0x7e2c('0x16')](_0x7e2c('0x63'),'Recording\x20is\x20enabled!');_0x451dfe[_0x7e2c('0x4e')]=util[_0x7e2c('0xd')](_0x7e2c('0x64'),_0x1366d7[_0x7e2c('0x49')],_0x451dfe['uniqueid'],md5(_0x451dfe[_0x7e2c('0x4d')]));}headers[_0x7e2c('0x4f')]=getAuth(_0x1366d7);return getUser(_0x1366d7,_0x20b7e0[_0x7e2c('0x50')])[_0x7e2c('0x15')](function(_0x197e8f){_0xbdb8f6=_0x197e8f;logger[_0x7e2c('0x16')](_0x7e2c('0x51'),_0xbdb8f6['id']);return getEndUser(_0x1366d7,_0x451dfe[_0x7e2c('0x65')],_0x451dfe[_0x7e2c('0x66')]);})[_0x7e2c('0x15')](function(_0x2c33b4){_0x48daf2=_0x2c33b4;logger[_0x7e2c('0x16')](_0x7e2c('0x67'),_0x48daf2['id']);return getTicket(_0x1366d7,_0xbdb8f6,_0x48daf2,_0x17233c,_0x451dfe);})[_0x7e2c('0x15')](function(_0x7d1aaf){if(_0x7d1aaf){logger[_0x7e2c('0x16')](_0x7e2c('0x54'),_0x7d1aaf['id']);switch(_0x1366d7[_0x7e2c('0x3e')]){case _0x7e2c('0x55'):logger[_0x7e2c('0x16')](_0x7e2c('0x63'),_0x7e2c('0x56'));return request({'uri':util[_0x7e2c('0xd')](_0x7e2c('0x57'),_0x1366d7[_0x7e2c('0xf')],_0xbdb8f6['id'],_0x7d1aaf['id']),'method':'POST'});case'newTab':logger[_0x7e2c('0x16')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x7e2c('0x58'),_0x20b7e0[_0x7e2c('0x46')]),_0x7e2c('0x68'),{'uri':util[_0x7e2c('0xd')](_0x7e2c('0x59'),_0x1366d7['remoteUri'][_0x7e2c('0x5a')]('/api/v2',''),_0x7d1aaf['id'])});break;default:logger[_0x7e2c('0x5d')]('[OUTBOUND]',_0x7e2c('0x5c'));}}})['catch'](function(_0x22c749){logger['error'](_0x7e2c('0x69'),util[_0x7e2c('0x5f')](_0x22c749,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x96c800,_0x413089,_0xa72b84,_0x136c13,_0x5821fc,_0x8238c3){var _0x47887f,_0x382875;_0x8238c3[_0x7e2c('0xf')]=intUtil[_0x7e2c('0x48')](_0x8238c3[_0x7e2c('0xf')]);_0x8238c3[_0x7e2c('0x49')]=intUtil['stripTrailingSlash'](_0x8238c3['serverUrl']);if(_0x5821fc&&_0x5821fc[_0x7e2c('0x4a')]){logger[_0x7e2c('0x16')]('['+_0x413089['lastevent']['toUpperCase']()+']',_0x7e2c('0x4c'));_0x413089['recordingURL']=util[_0x7e2c('0xd')](_0x7e2c('0x64'),_0x8238c3['serverUrl'],_0x413089[_0x7e2c('0x4d')],md5(_0x413089[_0x7e2c('0x4d')]));}else{_0x413089[_0x7e2c('0x4e')]='';}headers[_0x7e2c('0x4f')]=getAuth(_0x8238c3);return getUser(_0x8238c3)[_0x7e2c('0x15')](function(_0x29943a){_0x47887f=_0x29943a;logger[_0x7e2c('0x16')](_0x7e2c('0x51'),_0x47887f['id']);return getEndUser(_0x8238c3,_0x413089[_0x7e2c('0x52')],_0x413089[_0x7e2c('0x53')]);})[_0x7e2c('0x15')](function(_0x5f12f8){_0x382875=_0x5f12f8;logger[_0x7e2c('0x16')](_0x7e2c('0x67'),_0x382875['id']);return getTicket(_0x8238c3,_0x47887f,_0x382875,_0xa72b84,_0x413089);})['then'](function(_0x40896e){if(_0x40896e){logger[_0x7e2c('0x16')](_0x7e2c('0x54'),_0x40896e['id']);}})[_0x7e2c('0x6a')](function(_0x3b03cd){logger[_0x7e2c('0x5d')]('['+_0x413089[_0x7e2c('0x6b')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x7e2c('0x5f')](_0x3b03cd,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa6c4=['length','filter','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','stringify','forEach','includes','type','nameField','customField','toLowerCase','content','picklist','idField','push','variable','variableName','custom_fields','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Displaying\x20ticket\x20to\x20agent...','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','name','getString','Subjects','Descriptions','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','find','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results'];(function(_0x4ac858,_0x2c17e9){var _0x3818da=function(_0x26c604){while(--_0x26c604){_0x4ac858['push'](_0x4ac858['shift']());}};_0x3818da(++_0x2c17e9);}(_0xa6c4,0x186));var _0x4a6c=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0xa6c4[_0x2f48cd];return _0x193ae2;};'use strict';var _=require(_0x4a6c('0x0'));var rp=require(_0x4a6c('0x1'));var md5=require(_0x4a6c('0x2'));var util=require(_0x4a6c('0x3'));var Redis=require(_0x4a6c('0x4'));var intUtil=require(_0x4a6c('0x5'));var config=require('../../../../config/environment');var logger=require(_0x4a6c('0x6'))(_0x4a6c('0x7'));config['redis']=_[_0x4a6c('0x8')](config[_0x4a6c('0x9')],{'host':_0x4a6c('0xa'),'port':0x18eb});var io=require(_0x4a6c('0xb'))(new Redis(config[_0x4a6c('0x9')]));function emit(_0x4ba63e,_0x5b1b0a,_0x46bca7){io['to'](_0x4ba63e)['emit'](_0x5b1b0a,_0x46bca7);}var headers={'Content-Type':_0x4a6c('0xc'),'Accept':_0x4a6c('0xc')};function getTicket(_0x50af8b,_0x451667,_0x53fadb,_0xe62563,_0x852772){logger['info'](_0x4a6c('0xd'));return request({'uri':util[_0x4a6c('0xe')](_0x4a6c('0xf'),_0x50af8b[_0x4a6c('0x10')]),'method':_0x4a6c('0x11'),'body':{'ticket':_[_0x4a6c('0x12')]({'requester_id':_0x53fadb['id'],'submitter_id':_0x451667?_0x451667['id']:undefined,'assignee_id':_0x451667?_0x451667['id']:undefined,'tags':getTags(_0xe62563['Tags'],_0x4a6c('0x13')),'subject':intUtil[_0x4a6c('0x14')](_0xe62563[_0x4a6c('0x15')],_0x852772,'\x20'),'description':intUtil[_0x4a6c('0x14')](_0xe62563['Descriptions'],_0x852772,'\x0a'),'comment':{'public':![],'body':intUtil[_0x4a6c('0x14')](_0xe62563[_0x4a6c('0x16')],_0x852772,'\x0a')}},getCustomFields(_0xe62563[_0x4a6c('0x17')],_0x852772))}})[_0x4a6c('0x18')](function(_0x13184b){logger[_0x4a6c('0x19')](_0x4a6c('0x1a'));return _0x13184b[_0x4a6c('0x1b')];});}function getUser(_0x4232de,_0x558df8){if(intUtil[_0x4a6c('0x1c')](_0x558df8)){logger[_0x4a6c('0x19')](_0x4a6c('0x1d'),_0x558df8);return request({'uri':util[_0x4a6c('0xe')](_0x4a6c('0x1e'),_0x4232de[_0x4a6c('0x10')]),'qs':{'query':util[_0x4a6c('0xe')]('type:user\x20role:agent\x20email:%s',_0x558df8)}})[_0x4a6c('0x18')](function(_0x2c62f8){if(_0x2c62f8[_0x4a6c('0x1f')]){logger[_0x4a6c('0x19')]('Agent\x20found!');return _[_0x4a6c('0x20')](_0x2c62f8['results'],{'email':_0x558df8,'role':'agent'});}else{logger[_0x4a6c('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x4a6c('0x21'),_0x4232de[_0x4a6c('0x10')])})[_0x4a6c('0x18')](function(_0xd8fb){logger[_0x4a6c('0x19')]('Admin\x20account\x20selected.');return _0xd8fb[_0x4a6c('0x22')];});}});}else{logger[_0x4a6c('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x4a6c('0xe')]('%s/users/me.json',_0x4232de[_0x4a6c('0x10')])})[_0x4a6c('0x18')](function(_0x8806f9){logger[_0x4a6c('0x19')]('Admin\x20account\x20selected.');return _0x8806f9[_0x4a6c('0x22')];});}}function getEndUser(_0x47fca7,_0x417c08,_0x2433be){logger[_0x4a6c('0x19')](_0x4a6c('0x23'),_0x2433be);return request({'uri':util['format'](_0x4a6c('0x1e'),_0x47fca7[_0x4a6c('0x10')]),'qs':{'query':util['format'](_0x4a6c('0x24'),_0x2433be)}})[_0x4a6c('0x18')](function(_0x38bad9){var _0xe30d15;if(_0x38bad9[_0x4a6c('0x25')][_0x4a6c('0x26')]){_0x38bad9['results']=_[_0x4a6c('0x27')](_0x38bad9[_0x4a6c('0x25')],{'suspended':![],'role':'end-user'});if(_0x38bad9['results']['length']){_0xe30d15=_[_0x4a6c('0x28')](_0x38bad9[_0x4a6c('0x25')]);}}if(_0xe30d15){logger[_0x4a6c('0x19')]('Enduser\x20found!');return _0xe30d15;}else{logger[_0x4a6c('0x19')](_0x4a6c('0x29'));return request({'uri':util[_0x4a6c('0xe')](_0x4a6c('0x2a'),_0x47fca7[_0x4a6c('0x10')]),'method':_0x4a6c('0x11'),'body':{'user':{'role':_0x4a6c('0x2b'),'name':util[_0x4a6c('0xe')]('Caller\x20-\x20%s',_0x417c08||_0x2433be),'phone':_0x2433be}}})[_0x4a6c('0x18')](function(_0x268470){logger[_0x4a6c('0x19')](_0x4a6c('0x2c'));return _0x268470['user'];});}});}function getAuth(_0x283a78){var _0x4c2855;if(_0x283a78[_0x4a6c('0x2d')]===_0x4a6c('0x2e')){_0x4c2855=util[_0x4a6c('0xe')](_0x4a6c('0x2f'),_0x283a78[_0x4a6c('0x30')],_0x283a78[_0x4a6c('0x2e')]);}else if(_0x283a78[_0x4a6c('0x2d')]===_0x4a6c('0x31')){_0x4c2855=util[_0x4a6c('0xe')](_0x4a6c('0x32'),_0x283a78[_0x4a6c('0x30')],_0x283a78[_0x4a6c('0x31')]);}return util[_0x4a6c('0xe')](_0x4a6c('0x33'),new Buffer(_0x4c2855)[_0x4a6c('0x34')](_0x4a6c('0x35')));}function request(_0x26a7f9){logger[_0x4a6c('0x36')]('[HTTP]',JSON[_0x4a6c('0x37')](_0x26a7f9));return rp(_[_0x4a6c('0x8')](_0x26a7f9,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0xffa88b,_0xacce67){var _0x291b27=[];if(_0xffa88b&&_0xffa88b['length']>0x0){_0x291b27=_['map'](_0xffa88b,_0xacce67);}return _0x291b27;}function getCustomFields(_0x4596a4,_0x486e95){var _0x5b5796=[];var _0x34dfe9={'custom_fields':[]};if(_0x4596a4[_0x4a6c('0x26')]>0x0){_[_0x4a6c('0x38')](_0x4596a4,function(_0x5d4afd){if(_[_0x4a6c('0x39')](['string','picklist'],_0x5d4afd[_0x4a6c('0x3a')])&&_0x5d4afd[_0x4a6c('0x3b')]&&!_0x5d4afd[_0x4a6c('0x3c')]){_0x34dfe9[_0x5d4afd[_0x4a6c('0x3b')][_0x4a6c('0x3d')]()]=_0x5d4afd[_0x4a6c('0x3e')][_0x4a6c('0x34')]();}else if(_[_0x4a6c('0x39')](['string',_0x4a6c('0x3f')],_0x5d4afd['type'])&&_0x5d4afd[_0x4a6c('0x40')]&&_0x5d4afd[_0x4a6c('0x3c')]){_0x34dfe9['custom_fields'][_0x4a6c('0x41')]({'id':_0x5d4afd[_0x4a6c('0x40')],'value':_0x5d4afd['content'][_0x4a6c('0x34')]()});}else if(_0x5d4afd['type']===_0x4a6c('0x42')&&_0x5d4afd['variableName']&&_0x5d4afd[_0x4a6c('0x40')]&&_0x5d4afd[_0x4a6c('0x3c')]){_0x486e95[_0x5d4afd[_0x4a6c('0x43')]]&&_0x34dfe9['custom_fields'][_0x4a6c('0x41')]({'id':_0x5d4afd[_0x4a6c('0x40')],'value':_0x486e95[_0x5d4afd['variableName']][_0x4a6c('0x34')]()});}else if(_0x5d4afd[_0x4a6c('0x3a')]==='customVariable'&&_0x5d4afd['Variable']&&_0x5d4afd['Variable'][_0x4a6c('0x13')]&&_0x5d4afd['idField']&&_0x5d4afd[_0x4a6c('0x3c')]){_0x486e95[_0x5d4afd['Variable'][_0x4a6c('0x13')][_0x4a6c('0x3d')]()]&&_0x34dfe9[_0x4a6c('0x44')][_0x4a6c('0x41')]({'id':_0x5d4afd[_0x4a6c('0x40')],'value':_0x486e95[_0x5d4afd[_0x4a6c('0x45')][_0x4a6c('0x13')][_0x4a6c('0x3d')]()][_0x4a6c('0x34')]()});}});}return _0x34dfe9;}exports['queue']=function(_0x1131c8,_0x4b9b09,_0x18f61c,_0x539d84,_0x288379,_0x7dfd4c){var _0x39a457,_0x38e2e3;_0x7dfd4c['remoteUri']=intUtil[_0x4a6c('0x46')](_0x7dfd4c[_0x4a6c('0x10')]);_0x7dfd4c[_0x4a6c('0x47')]=intUtil[_0x4a6c('0x46')](_0x7dfd4c['serverUrl']);if(_0x288379&&_0x288379[_0x4a6c('0x48')]){logger[_0x4a6c('0x19')](_0x4a6c('0x49'),_0x4a6c('0x4a'));_0x4b9b09['recordingURL']=util[_0x4a6c('0xe')](_0x4a6c('0x4b'),_0x7dfd4c[_0x4a6c('0x47')],_0x4b9b09[_0x4a6c('0x4c')],md5(_0x4b9b09[_0x4a6c('0x4c')]));}else{_0x4b9b09[_0x4a6c('0x4d')]='';}headers[_0x4a6c('0x4e')]=getAuth(_0x7dfd4c);return getUser(_0x7dfd4c,_0x539d84[_0x4a6c('0x4f')])[_0x4a6c('0x18')](function(_0x419c90){_0x39a457=_0x419c90;logger[_0x4a6c('0x19')](_0x4a6c('0x50'),_0x39a457['id']);return getEndUser(_0x7dfd4c,_0x4b9b09[_0x4a6c('0x51')],_0x4b9b09[_0x4a6c('0x52')]);})[_0x4a6c('0x18')](function(_0x818258){_0x38e2e3=_0x818258;logger[_0x4a6c('0x19')](_0x4a6c('0x53'),_0x38e2e3['id']);return getTicket(_0x7dfd4c,_0x39a457,_0x38e2e3,_0x18f61c,_0x4b9b09);})[_0x4a6c('0x18')](function(_0x4f33c7){if(_0x4f33c7){logger[_0x4a6c('0x19')](_0x4a6c('0x54'),_0x4f33c7['id']);switch(_0x7dfd4c[_0x4a6c('0x3a')]){case _0x4a6c('0x55'):logger['info'](_0x4a6c('0x49'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x4a6c('0xe')](_0x4a6c('0x56'),_0x7dfd4c['remoteUri'],_0x39a457['id'],_0x4f33c7['id']),'method':_0x4a6c('0x11')});case _0x4a6c('0x57'):logger[_0x4a6c('0x19')](_0x4a6c('0x49'),_0x4a6c('0x58'));emit(util[_0x4a6c('0xe')](_0x4a6c('0x59'),_0x539d84[_0x4a6c('0x13')]),_0x4a6c('0x5a'),{'uri':util[_0x4a6c('0xe')](_0x4a6c('0x5b'),_0x7dfd4c['remoteUri'][_0x4a6c('0x5c')](_0x4a6c('0x5d'),''),_0x4f33c7['id'])});break;default:logger[_0x4a6c('0x5e')](_0x4a6c('0x49'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x4a6c('0x5f')](function(_0x3534d7){logger[_0x4a6c('0x5e')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x4a6c('0x60')](_0x3534d7,{'showHidden':!![],'depth':null}));});};exports[_0x4a6c('0x61')]=function(_0x42ee76,_0xd86b45,_0x39b3ab,_0x2cb080,_0x47d001,_0x56ede5,_0x1d6c15){var _0x54c0fd,_0x193f20;_0x56ede5[_0x4a6c('0x10')]=intUtil[_0x4a6c('0x46')](_0x56ede5[_0x4a6c('0x10')]);_0x56ede5[_0x4a6c('0x47')]=intUtil[_0x4a6c('0x46')](_0x56ede5['serverUrl']);if(_0x1d6c15&&_0x1d6c15['recordingFormat']&&_0x1d6c15[_0x4a6c('0x62')]!==_0x4a6c('0x63')){logger[_0x4a6c('0x19')](_0x4a6c('0x64'),_0x4a6c('0x4a'));_0xd86b45[_0x4a6c('0x4d')]=util['format'](_0x4a6c('0x4b'),_0x56ede5[_0x4a6c('0x47')],_0xd86b45[_0x4a6c('0x4c')],md5(_0xd86b45[_0x4a6c('0x4c')]));}headers[_0x4a6c('0x4e')]=getAuth(_0x56ede5);return getUser(_0x56ede5,_0x2cb080[_0x4a6c('0x4f')])[_0x4a6c('0x18')](function(_0x2bda36){_0x54c0fd=_0x2bda36;logger[_0x4a6c('0x19')](_0x4a6c('0x50'),_0x54c0fd['id']);return getEndUser(_0x56ede5,_0xd86b45[_0x4a6c('0x65')],_0xd86b45['destcalleridnum']);})[_0x4a6c('0x18')](function(_0x44e70b){_0x193f20=_0x44e70b;logger[_0x4a6c('0x19')](_0x4a6c('0x53'),_0x193f20['id']);return getTicket(_0x56ede5,_0x54c0fd,_0x193f20,_0x39b3ab,_0xd86b45);})[_0x4a6c('0x18')](function(_0x22f926){if(_0x22f926){logger[_0x4a6c('0x19')]('The\x20Ticket\x20ID\x20is:',_0x22f926['id']);switch(_0x56ede5[_0x4a6c('0x3a')]){case'integrationTab':logger[_0x4a6c('0x19')](_0x4a6c('0x64'),_0x4a6c('0x66'));return request({'uri':util[_0x4a6c('0xe')](_0x4a6c('0x56'),_0x56ede5[_0x4a6c('0x10')],_0x54c0fd['id'],_0x22f926['id']),'method':_0x4a6c('0x11')});case _0x4a6c('0x57'):logger[_0x4a6c('0x19')](_0x4a6c('0x64'),_0x4a6c('0x58'));emit(util[_0x4a6c('0xe')]('user:%s',_0x2cb080[_0x4a6c('0x13')]),_0x4a6c('0x5a'),{'uri':util[_0x4a6c('0xe')]('%s/agent/tickets/%s',_0x56ede5[_0x4a6c('0x10')][_0x4a6c('0x5c')](_0x4a6c('0x5d'),''),_0x22f926['id'])});break;default:logger[_0x4a6c('0x5e')](_0x4a6c('0x64'),_0x4a6c('0x67'));}}})['catch'](function(_0x467fc5){logger[_0x4a6c('0x5e')](_0x4a6c('0x68'),util[_0x4a6c('0x60')](_0x467fc5,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x1b1d9c,_0x1a1e6b,_0x742ddf,_0x2f77eb,_0x1a80cd,_0x350286){var _0x4de984,_0x49d16e;_0x350286[_0x4a6c('0x10')]=intUtil[_0x4a6c('0x46')](_0x350286[_0x4a6c('0x10')]);_0x350286[_0x4a6c('0x47')]=intUtil[_0x4a6c('0x46')](_0x350286[_0x4a6c('0x47')]);if(_0x1a80cd&&_0x1a80cd[_0x4a6c('0x48')]){logger[_0x4a6c('0x19')]('['+_0x1a1e6b[_0x4a6c('0x69')][_0x4a6c('0x6a')]()+']','Recording\x20is\x20enabled!');_0x1a1e6b[_0x4a6c('0x4d')]=util['format'](_0x4a6c('0x4b'),_0x350286['serverUrl'],_0x1a1e6b[_0x4a6c('0x4c')],md5(_0x1a1e6b[_0x4a6c('0x4c')]));}else{_0x1a1e6b[_0x4a6c('0x4d')]='';}headers[_0x4a6c('0x4e')]=getAuth(_0x350286);return getUser(_0x350286)['then'](function(_0x253588){_0x4de984=_0x253588;logger[_0x4a6c('0x19')]('The\x20User\x20ID\x20is:',_0x4de984['id']);return getEndUser(_0x350286,_0x1a1e6b['calleridname'],_0x1a1e6b[_0x4a6c('0x52')]);})[_0x4a6c('0x18')](function(_0x24696e){_0x49d16e=_0x24696e;logger[_0x4a6c('0x19')]('The\x20Enduser\x20ID\x20is:',_0x49d16e['id']);return getTicket(_0x350286,_0x4de984,_0x49d16e,_0x742ddf,_0x1a1e6b);})['then'](function(_0x5183de){if(_0x5183de){logger[_0x4a6c('0x19')](_0x4a6c('0x54'),_0x5183de['id']);}})[_0x4a6c('0x5f')](function(_0x5a94e6){logger[_0x4a6c('0x5e')]('['+_0x1a1e6b[_0x4a6c('0x69')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x4a6c('0x60')](_0x5a94e6,{'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 b548014..b21fa87 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 _0x1c2a=['stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','Outbound','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','forEach','string','type','idField','toString','variableName','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','isArrayLikeObject','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','profile','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Subject','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','log','err','queue','host'];(function(_0x280f4a,_0x2ed8d6){var _0x1bb157=function(_0x37de94){while(--_0x37de94){_0x280f4a['push'](_0x280f4a['shift']());}};_0x1bb157(++_0x2ed8d6);}(_0x1c2a,0xb6));var _0xa1c2=function(_0x207af9,_0x2130d4){_0x207af9=_0x207af9-0x0;var _0x52b2f3=_0x1c2a[_0x207af9];return _0x52b2f3;};'use strict';var _=require(_0xa1c2('0x0'));var rp=require(_0xa1c2('0x1'));var md5=require(_0xa1c2('0x2'));var util=require(_0xa1c2('0x3'));var intUtil=require(_0xa1c2('0x4'));var moment=require(_0xa1c2('0x5'));var Redis=require(_0xa1c2('0x6'));var BPromise=require(_0xa1c2('0x7'));var config=require(_0xa1c2('0x8'));var logger=require(_0xa1c2('0x9'))(_0xa1c2('0xa'));config[_0xa1c2('0xb')]=_[_0xa1c2('0xc')](config[_0xa1c2('0xb')],{'host':_0xa1c2('0xd'),'port':0x18eb});var io=require(_0xa1c2('0xe'))(new Redis(config[_0xa1c2('0xb')]));function emit(_0x381a13,_0x5b9be4,_0x437e39){io['to'](_0x381a13)[_0xa1c2('0xf')](_0x5b9be4,_0x437e39);}function request(_0x4103d6){logger['debug']('[HTTP]',JSON['stringify'](_0x4103d6));return rp(_0x4103d6);}function getCustomFields(_0x510229,_0x239ca8){var _0x374410={};if(_0x510229['length']>0x0){_[_0xa1c2('0x10')](_0x510229,function(_0x45b8a1){if(_['includes']([_0xa1c2('0x11'),'picklist'],_0x45b8a1[_0xa1c2('0x12')])&&_0x45b8a1[_0xa1c2('0x13')]){_0x374410[_0x45b8a1['idField']]=_0x45b8a1['content'][_0xa1c2('0x14')]();}else if(_0x45b8a1[_0xa1c2('0x12')]==='variable'&&_0x45b8a1[_0xa1c2('0x15')]&&_0x45b8a1[_0xa1c2('0x13')]&&_0x239ca8[_0x45b8a1['variableName']]){_0x374410[_0x45b8a1[_0xa1c2('0x13')]]=_0x239ca8[_0x45b8a1[_0xa1c2('0x15')]][_0xa1c2('0x14')]();}else if(_0x45b8a1[_0xa1c2('0x12')]==='customVariable'&&_0x45b8a1[_0xa1c2('0x16')]&&_0x45b8a1[_0xa1c2('0x16')][_0xa1c2('0x17')]&&_0x45b8a1[_0xa1c2('0x13')]&&_0x239ca8[_0x45b8a1[_0xa1c2('0x16')][_0xa1c2('0x17')][_0xa1c2('0x18')]()]){_0x374410[_0x45b8a1[_0xa1c2('0x13')]]=_0x239ca8[_0x45b8a1[_0xa1c2('0x16')][_0xa1c2('0x17')]['toLowerCase']()][_0xa1c2('0x14')]();}});}return _0x374410;}function getName(_0x20d500){if(_0x20d500['indexOf']('\x20')>0x0){var _0x47fe0d=_0x20d500[_0xa1c2('0x19')](/ (.+)/);if(_0x47fe0d[0x1]){return _0x47fe0d;}}return[_0x20d500,_0x20d500];}var accountsTokens={};function getAccessToken(_0x107d02){return new Promise(function(_0x106c58,_0x48d96e){if(!_[_0xa1c2('0x1a')](accountsTokens[_0x107d02['id']])&&!_[_0xa1c2('0x1a')](accountsTokens[_0x107d02['id']][_0xa1c2('0x1b')])){if(moment()[_0xa1c2('0x1c')](accountsTokens[_0x107d02['id']][_0xa1c2('0x1d')])){_0x106c58(accountsTokens[_0x107d02['id']]['access_token']);}}var _0xd43f53;switch(_0x107d02[_0xa1c2('0x1e')]){case'US':_0xd43f53=_0xa1c2('0x1f');break;case'AU':_0xd43f53='https://accounts.zoho.com.au';break;case'EU':_0xd43f53=_0xa1c2('0x20');break;case'IN':_0xd43f53=_0xa1c2('0x21');break;case'CN':_0xd43f53=_0xa1c2('0x22');break;default:_0xd43f53=_0xa1c2('0x20');break;}var _0xd22dff={'method':_0xa1c2('0x23'),'uri':_0xd43f53+_0xa1c2('0x24'),'qs':{'refresh_token':_0x107d02[_0xa1c2('0x25')],'client_id':_0x107d02[_0xa1c2('0x26')],'client_secret':_0x107d02['clientSecret'],'grant_type':_0xa1c2('0x27')},'json':!![]};return rp(_0xd22dff)['then'](function(_0x101ee9){accountsTokens[_0x107d02['id']]={'access_token':_0x101ee9[_0xa1c2('0x1b')],'expires_in':moment()['add'](_0x101ee9[_0xa1c2('0x1d')],_0xa1c2('0x28'))};_0x106c58(_0x101ee9[_0xa1c2('0x1b')]);})[_0xa1c2('0x29')](function(_0x45ea0f){logger[_0xa1c2('0x2a')](_0xa1c2('0x2b'),_0x45ea0f[_0xa1c2('0x2c')]);_0x48d96e(_0x45ea0f);});});}function getUser(_0x228ff7,_0x1fb445,_0x2a8310,_0xf4b08b){logger[_0xa1c2('0x2d')](_0xa1c2('0x2e'));return request({'method':_0xa1c2('0x2f'),'uri':util[_0xa1c2('0x30')](_0xa1c2('0x31'),_0x1fb445),'qs':{'type':_0xa1c2('0x32')},'headers':{'Authorization':_0xa1c2('0x33')+_0x228ff7},'json':!![]})[_0xa1c2('0x34')](function(_0x4c703a){if(_0x4c703a['users']){var _0x31199c=-0x1;if(_[_0xa1c2('0x35')](_0x4c703a[_0xa1c2('0x36')])){if(!_[_0xa1c2('0x1a')](_0xf4b08b)){_0x31199c=_[_0xa1c2('0x37')](_0x4c703a[_0xa1c2('0x36')],function(_0x3f0f39){return _0x3f0f39[_0xa1c2('0x38')]===_0xf4b08b;});}if(_0x31199c>=0x0){logger[_0xa1c2('0x2d')](_0xa1c2('0x39'));}else{logger['info'](_0xa1c2('0x3a'));_0x31199c=_['findIndex'](_0x4c703a[_0xa1c2('0x36')],function(_0x486afa){return _0x486afa['profile'][_0xa1c2('0x17')]===_0xa1c2('0x3b');});}return _0x4c703a[_0xa1c2('0x36')][_0x31199c];}else{if(_0x4c703a['user'][_0xa1c2('0x3c')]['name']===_0xa1c2('0x3b')){logger[_0xa1c2('0x2d')](_0xa1c2('0x3a'));user=_0x4c703a[_0xa1c2('0x3d')];return user;}else{logger[_0xa1c2('0x2a')](_0xa1c2('0x3e'),JSON[_0xa1c2('0x3f')](_0x4c703a));throw new Error(_0xa1c2('0x40')+JSON[_0xa1c2('0x3f')](_0x4c703a));}}}else{logger['error'](_0xa1c2('0x3e'),JSON['stringify'](_0x4c703a));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xa1c2('0x3f')](_0x4c703a));}})[_0xa1c2('0x29')](function(_0xe029ce){console['error'](_0xe029ce);});}function getZohoUser(_0x5daf68,_0xbe78a5){return new BPromise(function(_0x17358b,_0x34c9b6){request(_0x5daf68)['then'](function(_0x89c385){var _0x187821=null;if(_0x89c385){_0x187821=_0x89c385[_0xa1c2('0x41')][0x0];_0x187821[_0xa1c2('0x42')]=_0xbe78a5;}_0x17358b(_0x187821);})[_0xa1c2('0x29')](function(_0x58bb6c){_0x34c9b6(_0x58bb6c);});});}function createEndUser(_0x56acd7,_0x2c0b14,_0x5827f4,_0x4b315b,_0x50dda0,_0x117081){var _0x5827f4=getName(_0x5827f4);return request({'method':_0xa1c2('0x23'),'uri':'https://www.zohoapis.'+_0x2c0b14+_0xa1c2('0x43')+_[_0xa1c2('0x44')](_0x117081[_0xa1c2('0x45')])+'s','body':{'data':[{'Last_Name':_0x5827f4[0x1],'First_Name':_0x5827f4[0x0],'Phone':_0x4b315b,'Owner':{'name':!_[_0xa1c2('0x1a')](_0x50dda0[_0xa1c2('0x46')]['name'])?_0x50dda0[_0xa1c2('0x46')][_0xa1c2('0x17')]:!_[_0xa1c2('0x1a')](_0x50dda0['first_name'])?_0x50dda0[_0xa1c2('0x47')]+'\x20'+_0x50dda0[_0xa1c2('0x48')]:_0x50dda0[_0xa1c2('0x48')],'id':_0x50dda0['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x56acd7},'json':!![]})[_0xa1c2('0x34')](function(_0x7f623){if(_0x7f623&&_0x7f623[_0xa1c2('0x41')][0x0][_0xa1c2('0x49')]===_0xa1c2('0x4a')){var _0x5bead2=_0x7f623[_0xa1c2('0x41')][0x0][_0xa1c2('0x4b')];_0x5bead2[_0xa1c2('0x42')]=_[_0xa1c2('0x44')](_0x117081[_0xa1c2('0x45')])+'s';return _0x5bead2;}logger[_0xa1c2('0x2a')](_0xa1c2('0x3e'),JSON[_0xa1c2('0x3f')](data));throw new Error('Error:\x20'+JSON[_0xa1c2('0x3f')](data));})[_0xa1c2('0x29')](function(_0x461c5a){console['log'](_0xa1c2('0x4c'),_0x461c5a);});}function getEndUser(_0x5d7df2,_0x44dcb3,_0xa11225,_0x1f71f8,_0x2feae6,_0x5cd740,_0x1d3c6f){var _0x2d598e={'method':_0xa1c2('0x2f'),'uri':'','headers':{'Authorization':_0xa1c2('0x33')+_0x5d7df2},'json':!![]};switch(_0x1d3c6f[_0xa1c2('0x4d')]){case _0xa1c2('0x4e'):_0x2d598e[_0xa1c2('0x4f')]=_0xa1c2('0x50')+_0x44dcb3+_0xa1c2('0x51')+_0x2feae6+'))';return getZohoUser(_0x2d598e,_0xa1c2('0x52'))[_0xa1c2('0x34')](function(_0xb3b086){if(_0xb3b086)return _0xb3b086;_0x2d598e['uri']=_0xa1c2('0x50')+_0x44dcb3+_0xa1c2('0x53')+_0x2feae6+'))';return getZohoUser(_0x2d598e,_0xa1c2('0x54'))[_0xa1c2('0x34')](function(_0x2d5794){if(_0x2d5794)return _0x2d5794;if(_0x1d3c6f[_0xa1c2('0x45')]!=_0xa1c2('0x55')){return createEndUser(_0x5d7df2,_0x44dcb3,_0x1f71f8,_0x2feae6,_0x5cd740,_0x1d3c6f);}else{return{};}});});break;case _0xa1c2('0x56'):_0x2d598e['uri']=_0xa1c2('0x50')+_0x44dcb3+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x2feae6+'))';return getZohoUser(_0x2d598e,_0xa1c2('0x52'))[_0xa1c2('0x34')](function(_0x500591){if(_0x500591)return _0x500591;if(_0x1d3c6f['moduleCreate']!=_0xa1c2('0x55')){return createEndUser(_0x5d7df2,_0x44dcb3,_0x1f71f8,_0x2feae6,_0x5cd740,_0x1d3c6f);}else{return{};}});break;case _0xa1c2('0x57'):_0x2d598e['uri']='https://www.zohoapis.'+_0x44dcb3+_0xa1c2('0x53')+_0x2feae6+'))';return getZohoUser(_0x2d598e,_0xa1c2('0x54'))[_0xa1c2('0x34')](function(_0x548f87){if(_0x548f87)return _0x548f87;if(_0x1d3c6f[_0xa1c2('0x45')]!=_0xa1c2('0x55')){return createEndUser(_0x5d7df2,_0x44dcb3,_0x1f71f8,_0x2feae6,_0x5cd740,_0x1d3c6f);}else{return{};}});break;}}function getCall(_0x4c80cb,_0x306cf6,_0x490a69,_0x2c03c5,_0x3f7ace,_0x1491be,_0x2dffb3,_0x47cc71){logger[_0xa1c2('0x2d')](_0xa1c2('0x58'));var _0x463eda={};_0x463eda['Owner']={'name':!_[_0xa1c2('0x1a')](_0x2c03c5[_0xa1c2('0x46')][_0xa1c2('0x17')])&&!_[_0xa1c2('0x1a')](_0x2c03c5[_0xa1c2('0x3c')][_0xa1c2('0x17')])&&_0x2c03c5[_0xa1c2('0x3c')][_0xa1c2('0x17')]==='administrator'?_0x2c03c5['role']['name']:!_['isNil'](_0x2c03c5['first_name'])?_0x2c03c5['first_name']+'\x20'+_0x2c03c5[_0xa1c2('0x48')]:_0x2c03c5[_0xa1c2('0x48')],'id':_0x2c03c5['id']};_0x463eda[_0xa1c2('0x59')]=intUtil['getString'](_0x1491be[_0xa1c2('0x5a')],_0x2dffb3,'\x20');_0x463eda[_0xa1c2('0x5b')]=intUtil['getString'](_0x1491be[_0xa1c2('0x5c')],_0x2dffb3,'\x0a');if(_0x3f7ace[_0xa1c2('0x42')]===_0xa1c2('0x52')){_0x463eda[_0xa1c2('0x5d')]={'name':!_[_0xa1c2('0x1a')](_0x3f7ace['Full_Name'])?_0x3f7ace[_0xa1c2('0x5e')]:!_[_0xa1c2('0x1a')](_0x3f7ace[_0xa1c2('0x5f')])?_0x3f7ace[_0xa1c2('0x5f')]+'\x20'+_0x3f7ace[_0xa1c2('0x60')]:_0x3f7ace[_0xa1c2('0x60')],'id':_0x3f7ace['id']};}if(_0x3f7ace[_0xa1c2('0x42')]===_0xa1c2('0x54')){_0x463eda[_0xa1c2('0x61')]={'name':!_['isNil'](_0x3f7ace[_0xa1c2('0x5e')])?_0x3f7ace[_0xa1c2('0x5e')]:!_['isNil'](_0x3f7ace['First_Name'])?_0x3f7ace['First_Name']+'\x20'+_0x3f7ace[_0xa1c2('0x60')]:_0x3f7ace['Last_Name'],'id':_0x3f7ace['id']};_0x463eda[_0xa1c2('0x62')]=_[_0xa1c2('0x44')](_0x3f7ace['enduserType']);}if(_0x2dffb3[_0xa1c2('0x63')]){_0x463eda[_0xa1c2('0x64')]=moment[_0xa1c2('0x65')](parseInt(_0x2dffb3['talktime'])*0x3e8)[_0xa1c2('0x30')]('mm:ss');}else if(_0x2dffb3['answertime']&&_0x2dffb3[_0xa1c2('0x66')]){_0x463eda[_0xa1c2('0x64')]=moment[_0xa1c2('0x65')](moment(_0x2dffb3[_0xa1c2('0x66')],_0xa1c2('0x67'))[_0xa1c2('0x68')](moment(_0x2dffb3[_0xa1c2('0x69')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0xa1c2('0x6a'));}switch(_0x2dffb3['lastevent']){case'called':_0x463eda[_0xa1c2('0x6b')]=_0xa1c2('0x6c');break;case _0xa1c2('0x6d'):case _0xa1c2('0x6e'):_0x463eda['Call_Result']=_0xa1c2('0x6f');break;case _0xa1c2('0x70'):_0x463eda[_0xa1c2('0x6b')]=_0xa1c2('0x71');break;case _0xa1c2('0x72'):_0x463eda[_0xa1c2('0x6b')]='Abandoned';break;case'timeout':_0x463eda[_0xa1c2('0x6b')]=_0xa1c2('0x73');default:}_0x463eda['Call_Start_Time']=(_0x47cc71===_0xa1c2('0x74')?moment(_0x2dffb3['starttime'])[_0xa1c2('0x30')](_0xa1c2('0x67')):moment(_0x2dffb3[_0xa1c2('0x75')])[_0xa1c2('0x30')](_0xa1c2('0x67')))||moment()[_0xa1c2('0x30')]('YYYY-MM-DDTHH:mm:ss');_0x463eda[_0xa1c2('0x76')]=_0x47cc71||_0xa1c2('0x77');_0x463eda=_[_0xa1c2('0x78')](_0x463eda,getCustomFields(_0x1491be[_0xa1c2('0x79')],_0x2dffb3));return request({'method':_0xa1c2('0x23'),'uri':_0xa1c2('0x50')+_0x306cf6+_0xa1c2('0x7a'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4c80cb},'body':{'data':[_0x463eda]},'json':!![]})[_0xa1c2('0x34')](function(_0x5c3695){if(_0x5c3695&&_0x5c3695['data'][0x0][_0xa1c2('0x49')]===_0xa1c2('0x4a')){logger[_0xa1c2('0x2d')](_0xa1c2('0x7b'));return{'id':_0x5c3695[_0xa1c2('0x41')][0x0][_0xa1c2('0x4b')]['id']};}})['catch'](function(_0x8e8d90){logger[_0xa1c2('0x2d')]('err',_0x8e8d90[_0xa1c2('0x2c')]);console[_0xa1c2('0x7c')](_0xa1c2('0x7d'),_0x8e8d90);});}exports[_0xa1c2('0x7e')]=function(_0x2eafb2,_0x40db32,_0x1d5cc9,_0x26a758,_0x21abe8,_0x5cd516){var _0x3170d5,_0x4fcbee,_0x3f2b2e;_0x5cd516[_0xa1c2('0x7f')]=intUtil[_0xa1c2('0x80')](_0x5cd516[_0xa1c2('0x7f')]);_0x5cd516[_0xa1c2('0x81')]=intUtil[_0xa1c2('0x80')](_0x5cd516[_0xa1c2('0x81')]);if(_0x21abe8&&_0x21abe8[_0xa1c2('0x82')]){logger[_0xa1c2('0x2d')](_0xa1c2('0x83'),_0xa1c2('0x84'));_0x40db32[_0xa1c2('0x85')]=_0x5cd516[_0xa1c2('0x81')]+_0xa1c2('0x86')+_0x40db32[_0xa1c2('0x87')]+_0xa1c2('0x88')+md5(_0x40db32['uniqueid']);}else{_0x40db32['recordingURL']='';}var _0xf4278=_0x5cd516[_0xa1c2('0x7f')]===_0xa1c2('0x89')?'eu':_0xa1c2('0x8a');return getAccessToken(_0x5cd516)[_0xa1c2('0x34')](function(_0x3d14a2){_0x3f2b2e=_0x3d14a2;return getUser(_0x3f2b2e,_0xf4278,_0x5cd516,_0x26a758['email']);})[_0xa1c2('0x34')](function(_0x4aa387){_0x3170d5=_0x4aa387;logger['info']('The\x20User\x20ID\x20is:',_0x3170d5['id']);return getEndUser(_0x3f2b2e,_0xf4278,_0x5cd516,_0x40db32[_0xa1c2('0x8b')],_0x40db32[_0xa1c2('0x8c')],_0x3170d5,_0x1d5cc9);})[_0xa1c2('0x34')](function(_0x27ad6d){_0x4fcbee=_0x27ad6d;return getCall(_0x3f2b2e,_0xf4278,_0x5cd516,_0x3170d5,_0x4fcbee,_0x1d5cc9,_0x40db32,_0xa1c2('0x77'));})[_0xa1c2('0x34')](function(_0x52c0ef){if(_0x52c0ef){logger[_0xa1c2('0x2d')](_0xa1c2('0x8d'),_0x52c0ef['id']);logger['info'](_0xa1c2('0x83'),_0xa1c2('0x8e'));emit(util['format'](_0xa1c2('0x8f'),_0x26a758[_0xa1c2('0x17')]),_0xa1c2('0x90'),{'uri':_0xa1c2('0x91')+_0x5cd516[_0xa1c2('0x7f')]+_0xa1c2('0x92')+_0x52c0ef['id']});}})['catch'](function(_0x3ce1a7){logger['error'](_0xa1c2('0x83'),JSON['stringify'](_0x3ce1a7));});};exports[_0xa1c2('0x74')]=function(_0x2f9884,_0x21cce7,_0x318f51,_0x16bc8d,_0x2ab157,_0x3db1ed,_0x3d311b){var _0x5ebca1,_0x466eae,_0x39bf81;_0x3db1ed['host']=intUtil[_0xa1c2('0x80')](_0x3db1ed[_0xa1c2('0x7f')]);_0x3db1ed[_0xa1c2('0x81')]=intUtil[_0xa1c2('0x80')](_0x3db1ed[_0xa1c2('0x81')]);if(_0x3d311b&&_0x3d311b[_0xa1c2('0x93')]&&_0x3d311b[_0xa1c2('0x93')]!=='none'){logger[_0xa1c2('0x2d')](_0xa1c2('0x94'),'Recording\x20is\x20enabled!');_0x21cce7[_0xa1c2('0x85')]=_0x3db1ed[_0xa1c2('0x81')]+_0xa1c2('0x86')+_0x21cce7[_0xa1c2('0x87')]+_0xa1c2('0x88')+md5(_0x21cce7[_0xa1c2('0x87')]);}var _0x4f8825=_0x3db1ed[_0xa1c2('0x7f')]===_0xa1c2('0x89')?'eu':_0xa1c2('0x8a');return getAccessToken(_0x3db1ed)[_0xa1c2('0x34')](function(_0x4bff22){_0x39bf81=_0x4bff22;return getUser(_0x39bf81,_0x4f8825,_0x3db1ed,_0x16bc8d[_0xa1c2('0x38')]);})['then'](function(_0x378c37){_0x5ebca1=_0x378c37;logger[_0xa1c2('0x2d')](_0xa1c2('0x95'),_0x5ebca1['id']);return getEndUser(_0x39bf81,_0x4f8825,_0x3db1ed,_0x21cce7[_0xa1c2('0x96')],_0x21cce7['destcalleridnum'],_0x5ebca1,_0x318f51);})[_0xa1c2('0x34')](function(_0x588658){_0x466eae=_0x588658;return getCall(_0x39bf81,_0x4f8825,_0x3db1ed,_0x5ebca1,_0x466eae,_0x318f51,_0x21cce7,_0xa1c2('0x97'));})[_0xa1c2('0x34')](function(_0x320fe6){if(_0x320fe6){logger[_0xa1c2('0x2d')]('The\x20Call\x20ID\x20is:',_0x320fe6['id']);logger['info']('[OUTBOUND]',_0xa1c2('0x8e'));emit(util[_0xa1c2('0x30')](_0xa1c2('0x8f'),_0x16bc8d[_0xa1c2('0x17')]),_0xa1c2('0x90'),{'uri':_0xa1c2('0x91')+_0x3db1ed[_0xa1c2('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x320fe6['id']});}})['catch'](function(_0xc54994){logger[_0xa1c2('0x2a')](_0xa1c2('0x94'),JSON['stringify'](_0xc54994));});};exports[_0xa1c2('0x98')]=function(_0x2bb2e7,_0x108474,_0x17c01c,_0x53debc,_0x232f4c,_0x33850d){var _0x4c58b4,_0x32092d,_0x117ed7;_0x33850d['host']=intUtil[_0xa1c2('0x80')](_0x33850d[_0xa1c2('0x7f')]);_0x33850d['serverUrl']=intUtil['stripTrailingSlash'](_0x33850d['serverUrl']);if(_0x232f4c&&_0x232f4c['monitor_format']){logger[_0xa1c2('0x2d')]('['+_0x108474[_0xa1c2('0x99')][_0xa1c2('0x9a')]()+']',_0xa1c2('0x84'));_0x108474[_0xa1c2('0x85')]=_0x33850d[_0xa1c2('0x81')]+_0xa1c2('0x86')+_0x108474[_0xa1c2('0x87')]+_0xa1c2('0x88')+md5(_0x108474['uniqueid']);}else{_0x108474[_0xa1c2('0x85')]='';}var _0x2fc640=_0x33850d[_0xa1c2('0x7f')]===_0xa1c2('0x89')?'eu':_0xa1c2('0x8a');return getAccessToken(_0x33850d)[_0xa1c2('0x34')](function(_0x54cf5a){_0x117ed7=_0x54cf5a;return getUser(_0x117ed7,_0x2fc640,_0x33850d);})[_0xa1c2('0x34')](function(_0xd74a05){_0x4c58b4=_0xd74a05;logger[_0xa1c2('0x2d')](_0xa1c2('0x95'),_0x4c58b4['id']);return getEndUser(_0x117ed7,_0x2fc640,_0x33850d,_0x108474[_0xa1c2('0x8b')],_0x108474[_0xa1c2('0x8c')],_0x4c58b4,_0x17c01c);})['then'](function(_0x116a88){_0x32092d=_0x116a88;return getCall(_0x117ed7,_0x2fc640,_0x33850d,_0x4c58b4,_0x32092d,_0x17c01c,_0x108474,'Inbound');})['then'](function(_0x4713b4){if(_0x4713b4){logger[_0xa1c2('0x2d')]('The\x20Call\x20ID\x20is:',_0x4713b4['id']);}})['catch'](function(_0x3e014b){logger[_0xa1c2('0x2a')]('['+_0x108474[_0xa1c2('0x99')][_0xa1c2('0x9a')]()+']',JSON[_0xa1c2('0x3f')](_0x3e014b));});}; \ No newline at end of file +var _0xd770=['user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','[OUTBOUND]','/api/voice/recordings/','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','monitor_format','calleridname','toUpperCase','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','emit','debug','stringify','length','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isBefore','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','isNil','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','then','data','startCase','role','first_name','last_name','code','SUCCESS','enduserType','moduleCreate','Error:\x20','log','CREATE\x20ERROR','GET','contact_lead','uri','https://www.zohoapis.','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Owner','administrator','Subjects','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','Leads','$se_module','talktime','utc','answertime','Call_Duration','endtime','YYYY-MM-DDTHH:mm:ss','starttime','mm:ss','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','abandoned','Abandoned','timeout','Timeout','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','details','err','queue','stripTrailingSlash','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd770,0x1e5));var _0x0d77=function(_0xabc570,_0x5036a0){_0xabc570=_0xabc570-0x0;var _0x5447ad=_0xd770[_0xabc570];return _0x5447ad;};'use strict';var _=require('lodash');var rp=require(_0x0d77('0x0'));var md5=require(_0x0d77('0x1'));var util=require(_0x0d77('0x2'));var intUtil=require('./util');var moment=require(_0x0d77('0x3'));var Redis=require(_0x0d77('0x4'));var BPromise=require(_0x0d77('0x5'));var config=require(_0x0d77('0x6'));var logger=require(_0x0d77('0x7'))('zoho');config[_0x0d77('0x8')]=_[_0x0d77('0x9')](config[_0x0d77('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0d77('0x8')]));function emit(_0x3cede5,_0x60076b,_0x38f424){io['to'](_0x3cede5)[_0x0d77('0xa')](_0x60076b,_0x38f424);}function request(_0x26668d){logger[_0x0d77('0xb')]('[HTTP]',JSON[_0x0d77('0xc')](_0x26668d));return rp(_0x26668d);}function getCustomFields(_0x49e635,_0x387065){var _0x5d8606={};if(_0x49e635[_0x0d77('0xd')]>0x0){_['forEach'](_0x49e635,function(_0x46ceab){if(_['includes']([_0x0d77('0xe'),_0x0d77('0xf')],_0x46ceab[_0x0d77('0x10')])&&_0x46ceab[_0x0d77('0x11')]){_0x5d8606[_0x46ceab[_0x0d77('0x11')]]=_0x46ceab[_0x0d77('0x12')][_0x0d77('0x13')]();}else if(_0x46ceab[_0x0d77('0x10')]===_0x0d77('0x14')&&_0x46ceab[_0x0d77('0x15')]&&_0x46ceab['idField']&&_0x387065[_0x46ceab['variableName']]){_0x5d8606[_0x46ceab['idField']]=_0x387065[_0x46ceab['variableName']][_0x0d77('0x13')]();}else if(_0x46ceab[_0x0d77('0x10')]===_0x0d77('0x16')&&_0x46ceab['Variable']&&_0x46ceab[_0x0d77('0x17')][_0x0d77('0x18')]&&_0x46ceab[_0x0d77('0x11')]&&_0x387065[_0x46ceab['Variable'][_0x0d77('0x18')][_0x0d77('0x19')]()]){_0x5d8606[_0x46ceab[_0x0d77('0x11')]]=_0x387065[_0x46ceab[_0x0d77('0x17')][_0x0d77('0x18')][_0x0d77('0x19')]()][_0x0d77('0x13')]();}});}return _0x5d8606;}function getName(_0x4bd47e){if(_0x4bd47e[_0x0d77('0x1a')]('\x20')>0x0){var _0x1cfacb=_0x4bd47e[_0x0d77('0x1b')](/ (.+)/);if(_0x1cfacb[0x1]){return _0x1cfacb;}}return[_0x4bd47e,_0x4bd47e];}var accountsTokens={};function getAccessToken(_0x52c0c5){return new Promise(function(_0x30e83b,_0x598bae){if(!_['isNil'](accountsTokens[_0x52c0c5['id']])&&!_['isNil'](accountsTokens[_0x52c0c5['id']]['access_token'])){if(moment()[_0x0d77('0x1c')](accountsTokens[_0x52c0c5['id']]['expires_in'])){_0x30e83b(accountsTokens[_0x52c0c5['id']][_0x0d77('0x1d')]);}}var _0x1aba51;switch(_0x52c0c5[_0x0d77('0x1e')]){case'US':_0x1aba51='https://accounts.zoho.com';break;case'AU':_0x1aba51=_0x0d77('0x1f');break;case'EU':_0x1aba51=_0x0d77('0x20');break;case'IN':_0x1aba51='https://accounts.zoho.in';break;case'CN':_0x1aba51=_0x0d77('0x21');break;default:_0x1aba51='https://accounts.zoho.eu';break;}var _0x47e25a={'method':_0x0d77('0x22'),'uri':_0x1aba51+_0x0d77('0x23'),'qs':{'refresh_token':_0x52c0c5[_0x0d77('0x24')],'client_id':_0x52c0c5[_0x0d77('0x25')],'client_secret':_0x52c0c5['clientSecret'],'grant_type':_0x0d77('0x26')},'json':!![]};return rp(_0x47e25a)['then'](function(_0x5beb7e){accountsTokens[_0x52c0c5['id']]={'access_token':_0x5beb7e['access_token'],'expires_in':moment()[_0x0d77('0x27')](_0x5beb7e['expires_in'],_0x0d77('0x28'))};_0x30e83b(_0x5beb7e[_0x0d77('0x1d')]);})[_0x0d77('0x29')](function(_0x243c03){logger[_0x0d77('0x2a')](_0x0d77('0x2b'),_0x243c03[_0x0d77('0x2c')]);_0x598bae(_0x243c03);});});}function getUser(_0x27b508,_0xec58c3,_0x1b12ca,_0x1b3a83){logger[_0x0d77('0x2d')](_0x0d77('0x2e'));return request({'method':'GET','uri':util[_0x0d77('0x2f')](_0x0d77('0x30'),_0xec58c3),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x0d77('0x31')+_0x27b508},'json':!![]})['then'](function(_0x3aabf8){if(_0x3aabf8[_0x0d77('0x32')]){var _0x45f665=-0x1;if(_[_0x0d77('0x33')](_0x3aabf8['users'])){if(!_[_0x0d77('0x34')](_0x1b3a83)){_0x45f665=_['findIndex'](_0x3aabf8[_0x0d77('0x32')],function(_0x220b12){return _0x220b12[_0x0d77('0x35')]===_0x1b3a83;});}if(_0x45f665>=0x0){logger[_0x0d77('0x2d')](_0x0d77('0x36'));}else{logger[_0x0d77('0x2d')](_0x0d77('0x37'));_0x45f665=_[_0x0d77('0x38')](_0x3aabf8['users'],function(_0x350417){return _0x350417[_0x0d77('0x39')]['name']===_0x0d77('0x3a');});}return _0x3aabf8['users'][_0x45f665];}else{if(_0x3aabf8[_0x0d77('0x3b')]['profile'][_0x0d77('0x18')]==='Administrator'){logger[_0x0d77('0x2d')](_0x0d77('0x37'));user=_0x3aabf8['user'];return user;}else{logger[_0x0d77('0x2a')](_0x0d77('0x3c'),JSON['stringify'](_0x3aabf8));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x0d77('0xc')](_0x3aabf8));}}}else{logger[_0x0d77('0x2a')](_0x0d77('0x3c'),JSON[_0x0d77('0xc')](_0x3aabf8));throw new Error(_0x0d77('0x3d')+JSON['stringify'](_0x3aabf8));}})[_0x0d77('0x29')](function(_0x443916){console[_0x0d77('0x2a')](_0x443916);});}function getZohoUser(_0x1ffbc9,_0x2a8b15){return new BPromise(function(_0x3326da,_0x4fb0e5){request(_0x1ffbc9)[_0x0d77('0x3e')](function(_0x32b67e){var _0xd56a33=null;if(_0x32b67e){_0xd56a33=_0x32b67e[_0x0d77('0x3f')][0x0];_0xd56a33['enduserType']=_0x2a8b15;}_0x3326da(_0xd56a33);})[_0x0d77('0x29')](function(_0x365b4f){_0x4fb0e5(_0x365b4f);});});}function createEndUser(_0x230647,_0x1d11cb,_0x4791e4,_0x3eee51,_0x556d6a,_0x55ea16){var _0x4791e4=getName(_0x4791e4);return request({'method':_0x0d77('0x22'),'uri':'https://www.zohoapis.'+_0x1d11cb+'/crm/v2/'+_[_0x0d77('0x40')](_0x55ea16['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4791e4[0x1],'First_Name':_0x4791e4[0x0],'Phone':_0x3eee51,'Owner':{'name':!_['isNil'](_0x556d6a[_0x0d77('0x41')][_0x0d77('0x18')])?_0x556d6a[_0x0d77('0x41')][_0x0d77('0x18')]:!_[_0x0d77('0x34')](_0x556d6a[_0x0d77('0x42')])?_0x556d6a[_0x0d77('0x42')]+'\x20'+_0x556d6a[_0x0d77('0x43')]:_0x556d6a['last_name'],'id':_0x556d6a['id']}}]},'headers':{'Authorization':_0x0d77('0x31')+_0x230647},'json':!![]})[_0x0d77('0x3e')](function(_0x39d943){if(_0x39d943&&_0x39d943[_0x0d77('0x3f')][0x0][_0x0d77('0x44')]===_0x0d77('0x45')){var _0x58013e=_0x39d943[_0x0d77('0x3f')][0x0]['details'];_0x58013e[_0x0d77('0x46')]=_['startCase'](_0x55ea16[_0x0d77('0x47')])+'s';return _0x58013e;}logger['error'](_0x0d77('0x3c'),JSON[_0x0d77('0xc')](data));throw new Error(_0x0d77('0x48')+JSON[_0x0d77('0xc')](data));})['catch'](function(_0x3fc99a){console[_0x0d77('0x49')](_0x0d77('0x4a'),_0x3fc99a);});}function getEndUser(_0x56e399,_0x207707,_0x38ada0,_0x2e6425,_0x44ec83,_0x112d18,_0x29955d){var _0x5bb1ad={'method':_0x0d77('0x4b'),'uri':'','headers':{'Authorization':_0x0d77('0x31')+_0x56e399},'json':!![]};switch(_0x29955d['moduleSearch']){case _0x0d77('0x4c'):_0x5bb1ad[_0x0d77('0x4d')]=_0x0d77('0x4e')+_0x207707+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x44ec83+'))';return getZohoUser(_0x5bb1ad,_0x0d77('0x4f'))[_0x0d77('0x3e')](function(_0x8771e5){if(_0x8771e5)return _0x8771e5;_0x5bb1ad[_0x0d77('0x4d')]=_0x0d77('0x4e')+_0x207707+_0x0d77('0x50')+_0x44ec83+'))';return getZohoUser(_0x5bb1ad,'Leads')[_0x0d77('0x3e')](function(_0x195bd9){if(_0x195bd9)return _0x195bd9;if(_0x29955d[_0x0d77('0x47')]!=_0x0d77('0x51')){return createEndUser(_0x56e399,_0x207707,_0x2e6425,_0x44ec83,_0x112d18,_0x29955d);}else{return{};}});});break;case _0x0d77('0x52'):_0x5bb1ad[_0x0d77('0x4d')]=_0x0d77('0x4e')+_0x207707+_0x0d77('0x53')+_0x44ec83+'))';return getZohoUser(_0x5bb1ad,_0x0d77('0x4f'))['then'](function(_0x1ea7e0){if(_0x1ea7e0)return _0x1ea7e0;if(_0x29955d[_0x0d77('0x47')]!=_0x0d77('0x51')){return createEndUser(_0x56e399,_0x207707,_0x2e6425,_0x44ec83,_0x112d18,_0x29955d);}else{return{};}});break;case _0x0d77('0x54'):_0x5bb1ad['uri']=_0x0d77('0x4e')+_0x207707+_0x0d77('0x50')+_0x44ec83+'))';return getZohoUser(_0x5bb1ad,'Leads')[_0x0d77('0x3e')](function(_0x486a08){if(_0x486a08)return _0x486a08;if(_0x29955d['moduleCreate']!=_0x0d77('0x51')){return createEndUser(_0x56e399,_0x207707,_0x2e6425,_0x44ec83,_0x112d18,_0x29955d);}else{return{};}});break;}}function getCall(_0x5af361,_0x289e01,_0x4a70ff,_0x5dc8df,_0x5e7f69,_0x5a8914,_0x2176c9,_0x40c184){logger['info'](_0x0d77('0x55'));var _0x21924f={};_0x21924f[_0x0d77('0x56')]={'name':!_['isNil'](_0x5dc8df[_0x0d77('0x41')][_0x0d77('0x18')])&&!_[_0x0d77('0x34')](_0x5dc8df[_0x0d77('0x39')]['name'])&&_0x5dc8df[_0x0d77('0x39')][_0x0d77('0x18')]===_0x0d77('0x57')?_0x5dc8df[_0x0d77('0x41')][_0x0d77('0x18')]:!_[_0x0d77('0x34')](_0x5dc8df['first_name'])?_0x5dc8df[_0x0d77('0x42')]+'\x20'+_0x5dc8df[_0x0d77('0x43')]:_0x5dc8df['last_name'],'id':_0x5dc8df['id']};_0x21924f['Subject']=intUtil['getString'](_0x5a8914[_0x0d77('0x58')],_0x2176c9,'\x20');_0x21924f['Description']=intUtil[_0x0d77('0x59')](_0x5a8914[_0x0d77('0x5a')],_0x2176c9,'\x0a');if(_0x5e7f69[_0x0d77('0x46')]===_0x0d77('0x4f')){_0x21924f[_0x0d77('0x5b')]={'name':!_['isNil'](_0x5e7f69[_0x0d77('0x5c')])?_0x5e7f69['Full_Name']:!_[_0x0d77('0x34')](_0x5e7f69['First_Name'])?_0x5e7f69[_0x0d77('0x5d')]+'\x20'+_0x5e7f69[_0x0d77('0x5e')]:_0x5e7f69['Last_Name'],'id':_0x5e7f69['id']};}if(_0x5e7f69['enduserType']===_0x0d77('0x5f')){_0x21924f['What_Id']={'name':!_[_0x0d77('0x34')](_0x5e7f69['Full_Name'])?_0x5e7f69[_0x0d77('0x5c')]:!_['isNil'](_0x5e7f69[_0x0d77('0x5d')])?_0x5e7f69[_0x0d77('0x5d')]+'\x20'+_0x5e7f69[_0x0d77('0x5e')]:_0x5e7f69[_0x0d77('0x5e')],'id':_0x5e7f69['id']};_0x21924f[_0x0d77('0x60')]=_['startCase'](_0x5e7f69[_0x0d77('0x46')]);}if(_0x2176c9[_0x0d77('0x61')]){_0x21924f['Call_Duration']=moment[_0x0d77('0x62')](parseInt(_0x2176c9[_0x0d77('0x61')])*0x3e8)['format']('mm:ss');}else if(_0x2176c9[_0x0d77('0x63')]&&_0x2176c9['endtime']){_0x21924f[_0x0d77('0x64')]=moment['utc'](moment(_0x2176c9[_0x0d77('0x65')],_0x0d77('0x66'))['diff'](moment(_0x2176c9[_0x0d77('0x67')],_0x0d77('0x66'))))[_0x0d77('0x2f')](_0x0d77('0x68'));}switch(_0x2176c9[_0x0d77('0x69')]){case _0x0d77('0x6a'):_0x21924f[_0x0d77('0x6b')]=_0x0d77('0x6c');break;case _0x0d77('0x6d'):case _0x0d77('0x6e'):_0x21924f[_0x0d77('0x6b')]=_0x0d77('0x6f');break;case _0x0d77('0x70'):_0x21924f[_0x0d77('0x6b')]='Rejected';break;case _0x0d77('0x71'):_0x21924f[_0x0d77('0x6b')]=_0x0d77('0x72');break;case _0x0d77('0x73'):_0x21924f[_0x0d77('0x6b')]=_0x0d77('0x74');default:}_0x21924f['Call_Start_Time']=(_0x40c184==='outbound'?moment(_0x2176c9[_0x0d77('0x67')])[_0x0d77('0x2f')](_0x0d77('0x66')):moment(_0x2176c9[_0x0d77('0x75')])[_0x0d77('0x2f')](_0x0d77('0x66')))||moment()[_0x0d77('0x2f')]('YYYY-MM-DDTHH:mm:ss');_0x21924f[_0x0d77('0x76')]=_0x40c184||_0x0d77('0x77');_0x21924f=_[_0x0d77('0x78')](_0x21924f,getCustomFields(_0x5a8914[_0x0d77('0x79')],_0x2176c9));return request({'method':_0x0d77('0x22'),'uri':_0x0d77('0x4e')+_0x289e01+_0x0d77('0x7a'),'headers':{'Authorization':_0x0d77('0x31')+_0x5af361},'body':{'data':[_0x21924f]},'json':!![]})[_0x0d77('0x3e')](function(_0x1da2bd){if(_0x1da2bd&&_0x1da2bd['data'][0x0][_0x0d77('0x44')]===_0x0d77('0x45')){logger[_0x0d77('0x2d')](_0x0d77('0x7b'));return{'id':_0x1da2bd[_0x0d77('0x3f')][0x0][_0x0d77('0x7c')]['id']};}})[_0x0d77('0x29')](function(_0x2c5dcc){logger['info'](_0x0d77('0x7d'),_0x2c5dcc['stack']);console[_0x0d77('0x49')](_0x0d77('0x7d'),_0x2c5dcc);});}exports[_0x0d77('0x7e')]=function(_0x29a9df,_0x48e036,_0x3f93d1,_0xb6376b,_0x4ac653,_0x383660){var _0x3d207b,_0x402326,_0x39b2be;_0x383660['host']=intUtil[_0x0d77('0x7f')](_0x383660[_0x0d77('0x80')]);_0x383660[_0x0d77('0x81')]=intUtil['stripTrailingSlash'](_0x383660[_0x0d77('0x81')]);if(_0x4ac653&&_0x4ac653['monitor_format']){logger['info'](_0x0d77('0x82'),_0x0d77('0x83'));_0x48e036[_0x0d77('0x84')]=_0x383660[_0x0d77('0x81')]+'/api/voice/recordings/'+_0x48e036[_0x0d77('0x85')]+'/downloads?type=uniqueid&token='+md5(_0x48e036['uniqueid']);}else{_0x48e036[_0x0d77('0x84')]='';}var _0x10d170=_0x383660[_0x0d77('0x80')]===_0x0d77('0x86')?'eu':_0x0d77('0x87');return getAccessToken(_0x383660)[_0x0d77('0x3e')](function(_0x27e749){_0x39b2be=_0x27e749;return getUser(_0x39b2be,_0x10d170,_0x383660,_0xb6376b[_0x0d77('0x35')]);})[_0x0d77('0x3e')](function(_0x2ba0eb){_0x3d207b=_0x2ba0eb;logger[_0x0d77('0x2d')](_0x0d77('0x88'),_0x3d207b['id']);return getEndUser(_0x39b2be,_0x10d170,_0x383660,_0x48e036['calleridname'],_0x48e036[_0x0d77('0x89')],_0x3d207b,_0x3f93d1);})[_0x0d77('0x3e')](function(_0x342c34){_0x402326=_0x342c34;return getCall(_0x39b2be,_0x10d170,_0x383660,_0x3d207b,_0x402326,_0x3f93d1,_0x48e036,'Inbound');})[_0x0d77('0x3e')](function(_0x2badfa){if(_0x2badfa){logger['info'](_0x0d77('0x8a'),_0x2badfa['id']);logger[_0x0d77('0x2d')](_0x0d77('0x82'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0d77('0x2f')](_0x0d77('0x8b'),_0xb6376b['name']),_0x0d77('0x8c'),{'uri':_0x0d77('0x8d')+_0x383660[_0x0d77('0x80')]+_0x0d77('0x8e')+_0x2badfa['id']});}})[_0x0d77('0x29')](function(_0x22a85b){logger[_0x0d77('0x2a')]('[QUEUE]',JSON[_0x0d77('0xc')](_0x22a85b));});};exports[_0x0d77('0x8f')]=function(_0xf26de,_0x43107f,_0x81128c,_0x2f8af6,_0x2b1736,_0x4c4bc6,_0x5524d0){var _0x359204,_0x36768d,_0x4d46e4;_0x4c4bc6[_0x0d77('0x80')]=intUtil[_0x0d77('0x7f')](_0x4c4bc6['host']);_0x4c4bc6['serverUrl']=intUtil[_0x0d77('0x7f')](_0x4c4bc6['serverUrl']);if(_0x5524d0&&_0x5524d0[_0x0d77('0x90')]&&_0x5524d0[_0x0d77('0x90')]!=='none'){logger[_0x0d77('0x2d')](_0x0d77('0x91'),'Recording\x20is\x20enabled!');_0x43107f[_0x0d77('0x84')]=_0x4c4bc6['serverUrl']+_0x0d77('0x92')+_0x43107f[_0x0d77('0x85')]+_0x0d77('0x93')+md5(_0x43107f[_0x0d77('0x85')]);}var _0x46127a=_0x4c4bc6[_0x0d77('0x80')]===_0x0d77('0x86')?'eu':'com';return getAccessToken(_0x4c4bc6)[_0x0d77('0x3e')](function(_0xb310b3){_0x4d46e4=_0xb310b3;return getUser(_0x4d46e4,_0x46127a,_0x4c4bc6,_0x2f8af6[_0x0d77('0x35')]);})[_0x0d77('0x3e')](function(_0x87cfa9){_0x359204=_0x87cfa9;logger[_0x0d77('0x2d')](_0x0d77('0x88'),_0x359204['id']);return getEndUser(_0x4d46e4,_0x46127a,_0x4c4bc6,_0x43107f[_0x0d77('0x94')],_0x43107f[_0x0d77('0x95')],_0x359204,_0x81128c);})[_0x0d77('0x3e')](function(_0x1701f0){_0x36768d=_0x1701f0;return getCall(_0x4d46e4,_0x46127a,_0x4c4bc6,_0x359204,_0x36768d,_0x81128c,_0x43107f,_0x0d77('0x96'));})['then'](function(_0x166f32){if(_0x166f32){logger[_0x0d77('0x2d')](_0x0d77('0x8a'),_0x166f32['id']);logger[_0x0d77('0x2d')](_0x0d77('0x91'),_0x0d77('0x97'));emit(util[_0x0d77('0x2f')](_0x0d77('0x8b'),_0x2f8af6[_0x0d77('0x18')]),_0x0d77('0x8c'),{'uri':'https://crm.'+_0x4c4bc6[_0x0d77('0x80')]+_0x0d77('0x8e')+_0x166f32['id']});}})[_0x0d77('0x29')](function(_0xebfe9c){logger[_0x0d77('0x2a')](_0x0d77('0x91'),JSON[_0x0d77('0xc')](_0xebfe9c));});};exports[_0x0d77('0x98')]=function(_0x3cb809,_0x1380dd,_0x2e6acf,_0xa5eee1,_0x10d0c2,_0x5c7002){var _0x591d19,_0x45382e,_0x3fe6fe;_0x5c7002[_0x0d77('0x80')]=intUtil[_0x0d77('0x7f')](_0x5c7002[_0x0d77('0x80')]);_0x5c7002['serverUrl']=intUtil['stripTrailingSlash'](_0x5c7002[_0x0d77('0x81')]);if(_0x10d0c2&&_0x10d0c2[_0x0d77('0x99')]){logger[_0x0d77('0x2d')]('['+_0x1380dd[_0x0d77('0x69')]['toUpperCase']()+']',_0x0d77('0x83'));_0x1380dd[_0x0d77('0x84')]=_0x5c7002['serverUrl']+_0x0d77('0x92')+_0x1380dd['uniqueid']+_0x0d77('0x93')+md5(_0x1380dd[_0x0d77('0x85')]);}else{_0x1380dd[_0x0d77('0x84')]='';}var _0xcf617b=_0x5c7002[_0x0d77('0x80')]===_0x0d77('0x86')?'eu':'com';return getAccessToken(_0x5c7002)[_0x0d77('0x3e')](function(_0xfff559){_0x3fe6fe=_0xfff559;return getUser(_0x3fe6fe,_0xcf617b,_0x5c7002);})[_0x0d77('0x3e')](function(_0x745a7c){_0x591d19=_0x745a7c;logger[_0x0d77('0x2d')](_0x0d77('0x88'),_0x591d19['id']);return getEndUser(_0x3fe6fe,_0xcf617b,_0x5c7002,_0x1380dd[_0x0d77('0x9a')],_0x1380dd[_0x0d77('0x89')],_0x591d19,_0x2e6acf);})[_0x0d77('0x3e')](function(_0x51745a){_0x45382e=_0x51745a;return getCall(_0x3fe6fe,_0xcf617b,_0x5c7002,_0x591d19,_0x45382e,_0x2e6acf,_0x1380dd,_0x0d77('0x77'));})[_0x0d77('0x3e')](function(_0x27198f){if(_0x27198f){logger[_0x0d77('0x2d')]('The\x20Call\x20ID\x20is:',_0x27198f['id']);}})[_0x0d77('0x29')](function(_0x526260){logger[_0x0d77('0x2a')]('['+_0x1380dd['lastevent'][_0x0d77('0x9b')]()+']',JSON[_0x0d77('0xc')](_0x526260));});}; \ 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 f36272d..2be59e0 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 _0x22a0=['trigger','exec','data2','Script','render','data3','error','format','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache'];(function(_0x1e1370,_0x41310b){var _0x53f72a=function(_0x4bfc6b){while(--_0x4bfc6b){_0x1e1370['push'](_0x1e1370['shift']());}};_0x53f72a(++_0x41310b);}(_0x22a0,0x82));var _0x022a=function(_0x516ede,_0x1d2435){_0x516ede=_0x516ede-0x0;var _0x4696aa=_0x22a0[_0x516ede];return _0x4696aa;};'use strict';var util=require(_0x022a('0x0'));var sh=require('shelljs');var Mustache=require(_0x022a('0x1'));var logger=require('../../../../config/logger')(_0x022a('0x2'));exports[_0x022a('0x3')]=function(_0x1420f7,_0x3db740){var _0x288478=_0x1420f7['data2']?_0x1420f7[_0x022a('0x4')]:_0x022a('0x5');var _0x5c9ba6=_0x1420f7['data3']?Mustache[_0x022a('0x6')](_0x1420f7[_0x022a('0x7')],_0x3db740):_0x3db740;sh[_0x022a('0x3')](_0x5c9ba6,function(_0x31eed0,_0x246f2f,_0x49490e){if(_0x31eed0!==0x0){logger[_0x022a('0x8')](util[_0x022a('0x9')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x288478,_0x5c9ba6,_0x31eed0,_0x49490e));}else{logger[_0x022a('0xa')](util[_0x022a('0x9')](_0x022a('0xb'),_0x288478,_0x5c9ba6,_0x246f2f));}});}; \ No newline at end of file +var _0xafa5=['mustache','../../../../config/logger','trigger','exec','data2','Script','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'];(function(_0x27b7be,_0x538e2d){var _0x1aa77e=function(_0x52a210){while(--_0x52a210){_0x27b7be['push'](_0x27b7be['shift']());}};_0x1aa77e(++_0x538e2d);}(_0xafa5,0x1c6));var _0x5afa=function(_0x1a3654,_0x255e1d){_0x1a3654=_0x1a3654-0x0;var _0x5e2c47=_0xafa5[_0x1a3654];return _0x5e2c47;};'use strict';var util=require(_0x5afa('0x0'));var sh=require('shelljs');var Mustache=require(_0x5afa('0x1'));var logger=require(_0x5afa('0x2'))(_0x5afa('0x3'));exports[_0x5afa('0x4')]=function(_0x141f8b,_0x2f56cf){var _0x24b003=_0x141f8b['data2']?_0x141f8b[_0x5afa('0x5')]:_0x5afa('0x6');var _0x1e8387=_0x141f8b[_0x5afa('0x7')]?Mustache[_0x5afa('0x8')](_0x141f8b['data3'],_0x2f56cf):_0x2f56cf;sh['exec'](_0x1e8387,function(_0x1cfd9f,_0x537d35,_0x4ed40e){if(_0x1cfd9f!==0x0){logger['error'](util[_0x5afa('0x9')](_0x5afa('0xa'),_0x24b003,_0x1e8387,_0x1cfd9f,_0x4ed40e));}else{logger[_0x5afa('0xb')](util[_0x5afa('0x9')](_0x5afa('0xc'),_0x24b003,_0x1e8387,_0x537d35));}});}; \ 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 5079ada..e495e7b 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 _0x345c=['GET','DELETE','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','statusCode','name','request-promise','lodash','mustache','../../../../config/logger','trigger','exec','render','data2','number','data5','headers','data6','parse','error','stack','data1','toUpperCase'];(function(_0x2592c7,_0x51f50e){var _0x34f726=function(_0x16c05b){while(--_0x16c05b){_0x2592c7['push'](_0x2592c7['shift']());}};_0x34f726(++_0x51f50e);}(_0x345c,0x19c));var _0xc345=function(_0x5e7138,_0x59a381){_0x5e7138=_0x5e7138-0x0;var _0x224eff=_0x345c[_0x5e7138];return _0x224eff;};'use strict';var rp=require(_0xc345('0x0'));var util=require('util');var _=require(_0xc345('0x1'));var Mustache=require(_0xc345('0x2'));var logger=require(_0xc345('0x3'))(_0xc345('0x4'));exports[_0xc345('0x5')]=function(_0x508737,_0x4dd2aa){var _0xd579e5,_0x57a193;var _0x179c90={'method':_0x508737['data1']['toUpperCase'](),'uri':Mustache[_0xc345('0x6')](_0x508737[_0xc345('0x7')],_0x4dd2aa),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x508737['data5'])===_0xc345('0x8')&&parseInt(_0x508737[_0xc345('0x9')])>=0x1&&parseInt(_0x508737[_0xc345('0x9')])<=0xa?parseInt(_0x508737[_0xc345('0x9')])*0x3e8:0x5*0x3e8};try{_0x179c90[_0xc345('0xa')]=_0x508737[_0xc345('0xb')]?JSON[_0xc345('0xc')](Mustache[_0xc345('0x6')](_0x508737['data6'],_0x4dd2aa)):{};}catch(_0x3e91b5){logger[_0xc345('0xd')](_0x3e91b5[_0xc345('0xe')]);}switch(_0x508737[_0xc345('0xf')][_0xc345('0x10')]()){case _0xc345('0x11'):case _0xc345('0x12'):_0xd579e5=null;_0x179c90['qs']=_0x4dd2aa;break;case'POST':case _0xc345('0x13'):if(_0x508737[_0xc345('0x14')]){try{_0xd579e5=JSON[_0xc345('0xc')](Mustache[_0xc345('0x6')](_0x508737[_0xc345('0x14')],_0x4dd2aa));_0x179c90[_0xc345('0x15')]=_0xd579e5;}catch(_0xc1c4f6){logger[_0xc345('0xd')](_0xc1c4f6['stack']);logger['error'](_0xc345('0x16'));}}else{_0xd579e5=_0x4dd2aa;_0x179c90['body']=_0xd579e5;}break;}logger[_0xc345('0x17')](util[_0xc345('0x18')](_0xc345('0x19'),_0x508737['data1'],_0x508737[_0xc345('0x7')],JSON[_0xc345('0x1a')](_0x179c90)));rp(_0x179c90)[_0xc345('0x1b')](function(_0x49c20c){_0xd579e5=!_[_0xc345('0x1c')](_0xd579e5)?_0xc345('0x1d')+_0xd579e5:'';_0x57a193=typeof _0x49c20c[_0xc345('0x15')]===_0xc345('0x1e')?JSON[_0xc345('0x1a')](_0x49c20c[_0xc345('0x15')]):_0x49c20c[_0xc345('0x15')];logger[_0xc345('0x17')](util['format']('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x508737[_0xc345('0xf')],_0x508737[_0xc345('0x7')],_0x49c20c[_0xc345('0x1f')],_0x57a193));})['catch'](function(_0x4edfd7){logger['error'](util[_0xc345('0x18')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x508737[_0xc345('0xf')],_0x508737[_0xc345('0x7')],_0x4edfd7['statusCode'],_0x4edfd7[_0xc345('0x20')],_0x4edfd7['message']));});}; \ No newline at end of file +var _0x9a57=['POST','PUT','data7','parse','body','error','info','format','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','util','lodash','mustache','trigger','exec','render','data2','data5','number','headers','data6','stack','data1','toUpperCase','GET'];(function(_0x3ca835,_0x2426b5){var _0x430f12=function(_0x143364){while(--_0x143364){_0x3ca835['push'](_0x3ca835['shift']());}};_0x430f12(++_0x2426b5);}(_0x9a57,0x1e0));var _0x79a5=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x9a57[_0x1d50f2];return _0x3769b8;};'use strict';var rp=require('request-promise');var util=require(_0x79a5('0x0'));var _=require(_0x79a5('0x1'));var Mustache=require(_0x79a5('0x2'));var logger=require('../../../../config/logger')(_0x79a5('0x3'));exports[_0x79a5('0x4')]=function(_0x3ff676,_0x478a7b){var _0x29a6fd,_0x467a82;var _0x303eac={'method':_0x3ff676['data1']['toUpperCase'](),'uri':Mustache[_0x79a5('0x5')](_0x3ff676[_0x79a5('0x6')],_0x478a7b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3ff676[_0x79a5('0x7')])===_0x79a5('0x8')&&parseInt(_0x3ff676['data5'])>=0x1&&parseInt(_0x3ff676[_0x79a5('0x7')])<=0xa?parseInt(_0x3ff676[_0x79a5('0x7')])*0x3e8:0x5*0x3e8};try{_0x303eac[_0x79a5('0x9')]=_0x3ff676[_0x79a5('0xa')]?JSON['parse'](Mustache[_0x79a5('0x5')](_0x3ff676[_0x79a5('0xa')],_0x478a7b)):{};}catch(_0x3c0f7b){logger['error'](_0x3c0f7b[_0x79a5('0xb')]);}switch(_0x3ff676[_0x79a5('0xc')][_0x79a5('0xd')]()){case _0x79a5('0xe'):case'DELETE':_0x29a6fd=null;_0x303eac['qs']=_0x478a7b;break;case _0x79a5('0xf'):case _0x79a5('0x10'):if(_0x3ff676[_0x79a5('0x11')]){try{_0x29a6fd=JSON[_0x79a5('0x12')](Mustache[_0x79a5('0x5')](_0x3ff676[_0x79a5('0x11')],_0x478a7b));_0x303eac[_0x79a5('0x13')]=_0x29a6fd;}catch(_0xc68161){logger[_0x79a5('0x14')](_0xc68161['stack']);logger[_0x79a5('0x14')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x29a6fd=_0x478a7b;_0x303eac[_0x79a5('0x13')]=_0x29a6fd;}break;}logger[_0x79a5('0x15')](util[_0x79a5('0x16')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x3ff676[_0x79a5('0xc')],_0x3ff676[_0x79a5('0x6')],JSON[_0x79a5('0x17')](_0x303eac)));rp(_0x303eac)[_0x79a5('0x18')](function(_0x2fb5e0){_0x29a6fd=!_[_0x79a5('0x19')](_0x29a6fd)?_0x79a5('0x1a')+_0x29a6fd:'';_0x467a82=typeof _0x2fb5e0[_0x79a5('0x13')]===_0x79a5('0x1b')?JSON[_0x79a5('0x17')](_0x2fb5e0[_0x79a5('0x13')]):_0x2fb5e0[_0x79a5('0x13')];logger[_0x79a5('0x15')](util['format'](_0x79a5('0x1c'),_0x3ff676[_0x79a5('0xc')],_0x3ff676[_0x79a5('0x6')],_0x2fb5e0[_0x79a5('0x1d')],_0x467a82));})[_0x79a5('0x1e')](function(_0x5c146f){logger['error'](util[_0x79a5('0x16')](_0x79a5('0x1f'),_0x3ff676[_0x79a5('0xc')],_0x3ff676[_0x79a5('0x6')],_0x5c146f[_0x79a5('0x1d')],_0x5c146f['name'],_0x5c146f[_0x79a5('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index c22b700..1106612 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 _0x2b87=['request','then','debug','rpc','routing','error','message','exports','jayson/promise','../../config/logger','client','http'];(function(_0x5f3c93,_0x18f6ae){var _0x39b341=function(_0x107a15){while(--_0x107a15){_0x5f3c93['push'](_0x5f3c93['shift']());}};_0x39b341(++_0x18f6ae);}(_0x2b87,0xc8));var _0x72b8=function(_0x1fc06f,_0x544a30){_0x1fc06f=_0x1fc06f-0x0;var _0x4f1879=_0x2b87[_0x1fc06f];return _0x4f1879;};'use strict';var jayson=require(_0x72b8('0x0'));var BPromise=require('bluebird');var logger=require(_0x72b8('0x1'))('routing');var client=jayson[_0x72b8('0x2')][_0x72b8('0x3')]({'port':0x2329});client['Request']=function(_0x162feb,_0x5215ba){return new BPromise(function(_0x4d3845,_0x2608ac){return client[_0x72b8('0x4')](_0x162feb,_0x5215ba)[_0x72b8('0x5')](function(_0x24e93c){logger[_0x72b8('0x6')](_0x72b8('0x7'),_0x72b8('0x8'),_0x162feb,_0x5215ba,_0x24e93c);if(_0x24e93c[_0x72b8('0x9')]){logger['error'](_0x72b8('0x7'),_0x72b8('0x8'),_0x162feb,_0x24e93c[_0x72b8('0x9')][_0x72b8('0xa')],_0x5215ba);return _0x2608ac(_0x24e93c[_0x72b8('0x9')][_0x72b8('0xa')]);}else{return _0x4d3845(_0x24e93c['result']);}})['catch'](function(_0x30610c){logger['error'](_0x72b8('0x7'),_0x72b8('0x8'),_0x162feb,_0x30610c,_0x5215ba);return _0x2608ac(_0x30610c);});});};module[_0x72b8('0xb')]=client; \ No newline at end of file +var _0x6657=['error','message','result','catch','bluebird','../../config/logger','routing','request','then','rpc'];(function(_0x23c84b,_0x427f9e){var _0x3730b3=function(_0x1f237f){while(--_0x1f237f){_0x23c84b['push'](_0x23c84b['shift']());}};_0x3730b3(++_0x427f9e);}(_0x6657,0xa4));var _0x7665=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0x6657[_0x1e4f2d];return _0xd05ce5;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x7665('0x0'));var logger=require(_0x7665('0x1'))(_0x7665('0x2'));var client=jayson['client']['http']({'port':0x2329});client['Request']=function(_0x1fe51e,_0x2bc0b6){return new BPromise(function(_0x223306,_0x408ac0){return client[_0x7665('0x3')](_0x1fe51e,_0x2bc0b6)[_0x7665('0x4')](function(_0xe40354){logger['debug'](_0x7665('0x5'),_0x7665('0x2'),_0x1fe51e,_0x2bc0b6,_0xe40354);if(_0xe40354[_0x7665('0x6')]){logger[_0x7665('0x6')](_0x7665('0x5'),_0x7665('0x2'),_0x1fe51e,_0xe40354['error'][_0x7665('0x7')],_0x2bc0b6);return _0x408ac0(_0xe40354[_0x7665('0x6')]['message']);}else{return _0x223306(_0xe40354[_0x7665('0x8')]);}})[_0x7665('0x9')](function(_0x59d72b){logger[_0x7665('0x6')](_0x7665('0x5'),'routing',_0x1fe51e,_0x59d72b,_0x2bc0b6);return _0x408ac0(_0x59d72b);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 387024b..c3e020d 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 _0xfb0f=['error','./server','./realtime','./lib/email','../../config/logger','then','initMailAccounts','refresh','mailAccounts','listen','getSettings','catch'];(function(_0x5304a3,_0x5519b3){var _0x4e5a61=function(_0x488ab3){while(--_0x488ab3){_0x5304a3['push'](_0x5304a3['shift']());}};_0x4e5a61(++_0x5519b3);}(_0xfb0f,0x15d));var _0xffb0=function(_0x11ccde,_0x42546d){_0x11ccde=_0x11ccde-0x0;var _0x2fac73=_0xfb0f[_0x11ccde];return _0x2fac73;};'use strict';var server=require(_0xffb0('0x0'));var Realtime=require(_0xffb0('0x1'));var EmailChannel=require(_0xffb0('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0xffb0('0x3'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0xffb0('0x4')](mailAccount['getMailAccounts']())['then'](realtime[_0xffb0('0x5')]())[_0xffb0('0x4')](function(){email[_0xffb0('0x6')](realtime[_0xffb0('0x7')]);return realtime;});}function main(){return server[_0xffb0('0x8')](realtime,email)['then'](function(){return initRealtime();})[_0xffb0('0x4')](function(){return setting[_0xffb0('0x9')]();})['then'](function(_0x877aa3){return setInterval(initRealtime,_0x877aa3['loginMailFrequency']*0x3e8);})[_0xffb0('0xa')](function(_0x18b13d){logger[_0xffb0('0xb')]('Email\x20service\x20initialization',_0x18b13d);});}main(); \ No newline at end of file +var _0x8ce4=['Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','getSettings','loginMailFrequency','catch'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x8ce4,0x79));var _0x48ce=function(_0x146ef3,_0x1c7bb0){_0x146ef3=_0x146ef3-0x0;var _0x5d9bae=_0x8ce4[_0x146ef3];return _0x5d9bae;};'use strict';var server=require(_0x48ce('0x0'));var Realtime=require(_0x48ce('0x1'));var EmailChannel=require(_0x48ce('0x2'));var mailAccount=require(_0x48ce('0x3'));var setting=require('./rpc/setting');var logger=require(_0x48ce('0x4'))(_0x48ce('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x48ce('0x6')]()[_0x48ce('0x7')](mailAccount[_0x48ce('0x8')]())[_0x48ce('0x7')](realtime[_0x48ce('0x9')]())[_0x48ce('0x7')](function(){email['refresh'](realtime[_0x48ce('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x48ce('0x7')](function(){return initRealtime();})[_0x48ce('0x7')](function(){return setting[_0x48ce('0xb')]();})['then'](function(_0x455a87){return setInterval(initRealtime,_0x455a87[_0x48ce('0xc')]*0x3e8);})[_0x48ce('0xd')](function(_0x2e387a){logger['error'](_0x48ce('0xe'),_0x2e387a);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index fe795e4..bd7e2b3 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 _0xf0a1=['handleImapEnd','handleImapError','disabled','messageStatus','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','isNil','Smtp','then','verified','catch','verify','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','./smtp','info','mailAccounts','smtp','emit','name','key','active','Imap','status','total','stringify','md5','mailAccount:update','prototype','refresh','hasOwnProperty','provider','imapAccounts','email','box','handleImapBox','bind','handleImapEmail','end'];(function(_0xad4fb7,_0x1a9e71){var _0x14828b=function(_0x101885){while(--_0x101885){_0xad4fb7['push'](_0xad4fb7['shift']());}};_0x14828b(++_0x1a9e71);}(_0xf0a1,0x121));var _0x1f0a=function(_0x25db0c,_0x562278){_0x25db0c=_0x25db0c-0x0;var _0xa5a994=_0xf0a1[_0x25db0c];return _0xa5a994;};'use strict';var _=require(_0x1f0a('0x0'));var moment=require(_0x1f0a('0x1'));var BPromise=require(_0x1f0a('0x2'));var md5=require('md5');var Redis=require(_0x1f0a('0x3'));var config=require(_0x1f0a('0x4'));var logger=require(_0x1f0a('0x5'))('email');config['redis']=_[_0x1f0a('0x6')](config[_0x1f0a('0x7')],{'host':_0x1f0a('0x8'),'port':0x18eb});var io=require(_0x1f0a('0x9'))(new Redis(config[_0x1f0a('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x1f0a('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x18486c){logger[_0x1f0a('0xb')]('start\x20email\x20channel');this['mailAccounts']=_0x18486c[_0x1f0a('0xc')];this['imapAccounts']={};this[_0x1f0a('0xd')]=new EmailSmtp();}EmailChannel['prototype'][_0x1f0a('0xe')]=function(_0x36f0fc){var _0x56e450=this[_0x1f0a('0xc')][_0x36f0fc];var _0x237ac4={'id':_0x56e450['id'],'name':_0x56e450[_0x1f0a('0xf')],'key':_0x56e450[_0x1f0a('0x10')],'active':_0x56e450[_0x1f0a('0x11')],'Imap':{'status':_0x56e450[_0x1f0a('0x12')][_0x1f0a('0x13')],'messageStatus':_0x56e450[_0x1f0a('0x12')]['messageStatus'],'total':_0x56e450[_0x1f0a('0x12')][_0x1f0a('0x14')]}};if(_['isNil'](md5Accounts[_0x36f0fc])){md5Accounts[_0x36f0fc]={};}var _0x22598b=md5(JSON[_0x1f0a('0x15')](_0x237ac4));if(md5Accounts[_0x36f0fc]['md5']!==_0x22598b){md5Accounts[_0x36f0fc][_0x1f0a('0x16')]=_0x22598b;io[_0x1f0a('0xe')](_0x1f0a('0x17'),_0x237ac4);}};EmailChannel[_0x1f0a('0x18')][_0x1f0a('0x19')]=function(_0x37fe2a){for(var _0x4e7e61 in _0x37fe2a){if(_0x37fe2a[_0x1f0a('0x1a')](_0x4e7e61)){if(_0x37fe2a[_0x4e7e61][_0x1f0a('0x12')]&&_0x37fe2a[_0x4e7e61][_0x1f0a('0x11')]){var _0x52c1c8=_0x37fe2a[_0x4e7e61]['Imap'];if(!_0x52c1c8['service']&&_0x37fe2a[_0x4e7e61]['provider']!=='custom')_0x52c1c8['service']=_0x37fe2a[_0x4e7e61][_0x1f0a('0x1b')];if(!this[_0x1f0a('0x1c')]['hasOwnProperty'](_0x52c1c8['id'])){this[_0x1f0a('0x1c')][_0x52c1c8['id']]=new EmailImap(_0x52c1c8,_0x37fe2a[_0x4e7e61][_0x1f0a('0x1d')]);this[_0x1f0a('0x1c')][_0x52c1c8['id']]['on'](_0x1f0a('0x1e'),this[_0x1f0a('0x1f')][_0x1f0a('0x20')](this,_0x4e7e61));this[_0x1f0a('0x1c')][_0x52c1c8['id']]['on'](_0x1f0a('0x1d'),this[_0x1f0a('0x21')]['bind'](this,_0x4e7e61));this[_0x1f0a('0x1c')][_0x52c1c8['id']]['on'](_0x1f0a('0x22'),this[_0x1f0a('0x23')]['bind'](this,_0x4e7e61));this['imapAccounts'][_0x52c1c8['id']]['on']('error',this[_0x1f0a('0x24')]['bind'](this,_0x4e7e61));}}else{if(_['isNil'](this['mailAccounts'][_0x4e7e61]['Imap'])){this[_0x1f0a('0xc')][_0x4e7e61][_0x1f0a('0x12')]={};}this[_0x1f0a('0xc')][_0x4e7e61][_0x1f0a('0x12')][_0x1f0a('0x13')]=_0x1f0a('0x25');this['mailAccounts'][_0x4e7e61][_0x1f0a('0x12')][_0x1f0a('0x26')]='';this[_0x1f0a('0xe')](_0x4e7e61);}}}};EmailChannel[_0x1f0a('0x18')][_0x1f0a('0x1f')]=function(_0x30f7e1,_0x3c8917){if(this[_0x1f0a('0xc')][_0x30f7e1]){this[_0x1f0a('0xc')][_0x30f7e1]['Imap'][_0x1f0a('0x13')]='connected';this['mailAccounts'][_0x30f7e1]['Imap'][_0x1f0a('0x26')]=_0x3c8917[_0x1f0a('0xf')];if(_0x3c8917[_0x1f0a('0x27')]){this['mailAccounts'][_0x30f7e1][_0x1f0a('0x12')]['total']=_0x3c8917[_0x1f0a('0x27')][_0x1f0a('0x14')];}return this[_0x1f0a('0xe')](_0x30f7e1);}};EmailChannel[_0x1f0a('0x18')]['handleImapEmail']=function(_0x310166,_0x2ee2e2){logger[_0x1f0a('0xb')](_0x1f0a('0x28'),_0x2ee2e2['firstName'],_0x2ee2e2['lastName'],_0x2ee2e2[_0x1f0a('0x29')],_0x310166);if(this[_0x1f0a('0xc')][_0x310166]){return mailAccount['notify'](_0x310166,_0x2ee2e2)['then'](function(_0x888d4d){if(_0x888d4d){logger[_0x1f0a('0xb')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0xa4d353){logger[_0x1f0a('0x2a')](_0x1f0a('0x2b'),JSON[_0x1f0a('0x15')](_0xa4d353));});}};EmailChannel[_0x1f0a('0x18')]['handleImapEnd']=function(_0xe11003){if(this['mailAccounts'][_0xe11003]&&this[_0x1f0a('0xc')][_0xe11003][_0x1f0a('0x12')]){if(this[_0x1f0a('0x1c')][this[_0x1f0a('0xc')][_0xe11003][_0x1f0a('0x12')]['id']]){delete this[_0x1f0a('0x1c')][this['mailAccounts'][_0xe11003]['Imap']['id']];}this[_0x1f0a('0xc')][_0xe11003]['Imap'][_0x1f0a('0x2c')]=moment();this[_0x1f0a('0xe')](_0xe11003);}};EmailChannel[_0x1f0a('0x18')][_0x1f0a('0x24')]=function(_0x4a639d,_0x17bfb8){if(this['mailAccounts'][_0x4a639d]){this[_0x1f0a('0xc')][_0x4a639d][_0x1f0a('0x12')]['status']=_0x1f0a('0x2a');this['mailAccounts'][_0x4a639d][_0x1f0a('0x12')][_0x1f0a('0x26')]=_0x17bfb8;return this[_0x1f0a('0xe')](_0x4a639d);}};EmailChannel['prototype'][_0x1f0a('0x2d')]=function(_0x500741,_0x5d8392){return this[_0x1f0a('0xd')][_0x1f0a('0x2e')](_0x500741,_0x5d8392);};EmailChannel[_0x1f0a('0x18')][_0x1f0a('0x2f')]=function(_0x39d240){var _0x93e955=this;if(this[_0x1f0a('0xc')][_0x39d240['id']]){if(_[_0x1f0a('0x30')](this[_0x1f0a('0xc')][_0x39d240['id']][_0x1f0a('0x31')])){this[_0x1f0a('0xc')][_0x39d240['id']][_0x1f0a('0x31')]={};}this[_0x1f0a('0xc')][_0x39d240['id']][_0x1f0a('0x31')][_0x1f0a('0x2c')]=moment();return new BPromise(function(_0x1a8ab5,_0x312052){return _0x93e955[_0x1f0a('0xd')]['verify'](_0x39d240)[_0x1f0a('0x32')](function(_0x498021){_0x93e955['mailAccounts'][_0x39d240['id']][_0x1f0a('0x31')][_0x1f0a('0x13')]=_0x1f0a('0x33');_0x93e955['mailAccounts'][_0x39d240['id']]['Smtp']['messageStatus']='';_0x93e955[_0x1f0a('0xe')](_0x39d240['id']);_0x1a8ab5(_0x498021);})[_0x1f0a('0x34')](function(_0x3ff44c){_0x93e955[_0x1f0a('0xc')][_0x39d240['id']][_0x1f0a('0x31')][_0x1f0a('0x13')]=_0x1f0a('0x2a');_0x93e955['mailAccounts'][_0x39d240['id']][_0x1f0a('0x31')][_0x1f0a('0x26')]=_0x3ff44c;_0x93e955[_0x1f0a('0xe')](_0x39d240['id']);_0x312052(_0x3ff44c);});});}return this[_0x1f0a('0xd')][_0x1f0a('0x35')](_0x39d240);};module['exports']=EmailChannel; \ No newline at end of file +var _0xecbc=['name','key','Imap','status','messageStatus','total','isNil','stringify','refresh','hasOwnProperty','active','service','custom','email','box','handleImapBox','bind','end','handleImapEnd','error','handleImapError','connected','messages','handleImapEmail','firstName','notify','then','catch','lastSync','send','verifySmtp','Smtp','verify','verified','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','defaults','redis','socket.io-emitter','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit'];(function(_0x3642e7,_0x16358e){var _0x31e3dd=function(_0x188ec6){while(--_0x188ec6){_0x3642e7['push'](_0x3642e7['shift']());}};_0x31e3dd(++_0x16358e);}(_0xecbc,0x8a));var _0xcecb=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xecbc[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var moment=require(_0xcecb('0x0'));var BPromise=require(_0xcecb('0x1'));var md5=require(_0xcecb('0x2'));var Redis=require(_0xcecb('0x3'));var config=require(_0xcecb('0x4'));var logger=require(_0xcecb('0x5'))('email');config['redis']=_[_0xcecb('0x6')](config[_0xcecb('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xcecb('0x8'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0xcecb('0x9'));var mailAccount=require(_0xcecb('0xa'));var md5Accounts={};function EmailChannel(_0x5a7ac5){logger[_0xcecb('0xb')](_0xcecb('0xc'));this[_0xcecb('0xd')]=_0x5a7ac5[_0xcecb('0xd')];this[_0xcecb('0xe')]={};this[_0xcecb('0xf')]=new EmailSmtp();}EmailChannel[_0xcecb('0x10')][_0xcecb('0x11')]=function(_0x128ba8){var _0x24d1a9=this[_0xcecb('0xd')][_0x128ba8];var _0x59ec43={'id':_0x24d1a9['id'],'name':_0x24d1a9[_0xcecb('0x12')],'key':_0x24d1a9[_0xcecb('0x13')],'active':_0x24d1a9['active'],'Imap':{'status':_0x24d1a9[_0xcecb('0x14')][_0xcecb('0x15')],'messageStatus':_0x24d1a9[_0xcecb('0x14')][_0xcecb('0x16')],'total':_0x24d1a9[_0xcecb('0x14')][_0xcecb('0x17')]}};if(_[_0xcecb('0x18')](md5Accounts[_0x128ba8])){md5Accounts[_0x128ba8]={};}var _0x4572ae=md5(JSON[_0xcecb('0x19')](_0x59ec43));if(md5Accounts[_0x128ba8][_0xcecb('0x2')]!==_0x4572ae){md5Accounts[_0x128ba8][_0xcecb('0x2')]=_0x4572ae;io[_0xcecb('0x11')]('mailAccount:update',_0x59ec43);}};EmailChannel[_0xcecb('0x10')][_0xcecb('0x1a')]=function(_0x20d574){for(var _0x1ab768 in _0x20d574){if(_0x20d574[_0xcecb('0x1b')](_0x1ab768)){if(_0x20d574[_0x1ab768][_0xcecb('0x14')]&&_0x20d574[_0x1ab768][_0xcecb('0x1c')]){var _0x123c49=_0x20d574[_0x1ab768][_0xcecb('0x14')];if(!_0x123c49[_0xcecb('0x1d')]&&_0x20d574[_0x1ab768]['provider']!==_0xcecb('0x1e'))_0x123c49[_0xcecb('0x1d')]=_0x20d574[_0x1ab768]['provider'];if(!this[_0xcecb('0xe')][_0xcecb('0x1b')](_0x123c49['id'])){this[_0xcecb('0xe')][_0x123c49['id']]=new EmailImap(_0x123c49,_0x20d574[_0x1ab768][_0xcecb('0x1f')]);this[_0xcecb('0xe')][_0x123c49['id']]['on'](_0xcecb('0x20'),this[_0xcecb('0x21')][_0xcecb('0x22')](this,_0x1ab768));this[_0xcecb('0xe')][_0x123c49['id']]['on'](_0xcecb('0x1f'),this['handleImapEmail']['bind'](this,_0x1ab768));this[_0xcecb('0xe')][_0x123c49['id']]['on'](_0xcecb('0x23'),this[_0xcecb('0x24')]['bind'](this,_0x1ab768));this[_0xcecb('0xe')][_0x123c49['id']]['on'](_0xcecb('0x25'),this[_0xcecb('0x26')][_0xcecb('0x22')](this,_0x1ab768));}}else{if(_['isNil'](this[_0xcecb('0xd')][_0x1ab768][_0xcecb('0x14')])){this[_0xcecb('0xd')][_0x1ab768][_0xcecb('0x14')]={};}this[_0xcecb('0xd')][_0x1ab768]['Imap']['status']='disabled';this['mailAccounts'][_0x1ab768]['Imap'][_0xcecb('0x16')]='';this[_0xcecb('0x11')](_0x1ab768);}}}};EmailChannel['prototype'][_0xcecb('0x21')]=function(_0x1084b2,_0x4a12e0){if(this[_0xcecb('0xd')][_0x1084b2]){this[_0xcecb('0xd')][_0x1084b2][_0xcecb('0x14')][_0xcecb('0x15')]=_0xcecb('0x27');this['mailAccounts'][_0x1084b2][_0xcecb('0x14')][_0xcecb('0x16')]=_0x4a12e0['name'];if(_0x4a12e0[_0xcecb('0x28')]){this['mailAccounts'][_0x1084b2][_0xcecb('0x14')]['total']=_0x4a12e0[_0xcecb('0x28')][_0xcecb('0x17')];}return this[_0xcecb('0x11')](_0x1084b2);}};EmailChannel['prototype'][_0xcecb('0x29')]=function(_0x252d6d,_0x27f916){logger[_0xcecb('0xb')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x27f916[_0xcecb('0x2a')],_0x27f916['lastName'],_0x27f916['from'],_0x252d6d);if(this[_0xcecb('0xd')][_0x252d6d]){return mailAccount[_0xcecb('0x2b')](_0x252d6d,_0x27f916)[_0xcecb('0x2c')](function(_0x55d3e5){if(_0x55d3e5){logger[_0xcecb('0xb')]('Mail\x20accepted\x20from\x20routing');}})[_0xcecb('0x2d')](function(_0x198fe7){logger[_0xcecb('0x25')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x198fe7));});}};EmailChannel[_0xcecb('0x10')][_0xcecb('0x24')]=function(_0x4b33e0){if(this['mailAccounts'][_0x4b33e0]&&this['mailAccounts'][_0x4b33e0][_0xcecb('0x14')]){if(this[_0xcecb('0xe')][this['mailAccounts'][_0x4b33e0][_0xcecb('0x14')]['id']]){delete this[_0xcecb('0xe')][this[_0xcecb('0xd')][_0x4b33e0][_0xcecb('0x14')]['id']];}this[_0xcecb('0xd')][_0x4b33e0]['Imap'][_0xcecb('0x2e')]=moment();this['emit'](_0x4b33e0);}};EmailChannel[_0xcecb('0x10')][_0xcecb('0x26')]=function(_0xf25447,_0x17e96f){if(this[_0xcecb('0xd')][_0xf25447]){this[_0xcecb('0xd')][_0xf25447][_0xcecb('0x14')][_0xcecb('0x15')]=_0xcecb('0x25');this['mailAccounts'][_0xf25447][_0xcecb('0x14')][_0xcecb('0x16')]=_0x17e96f;return this[_0xcecb('0x11')](_0xf25447);}};EmailChannel[_0xcecb('0x10')]['sendMail']=function(_0x1966b2,_0x4d9a1d){return this[_0xcecb('0xf')][_0xcecb('0x2f')](_0x1966b2,_0x4d9a1d);};EmailChannel['prototype'][_0xcecb('0x30')]=function(_0x21ba07){var _0x3f15b7=this;if(this[_0xcecb('0xd')][_0x21ba07['id']]){if(_[_0xcecb('0x18')](this[_0xcecb('0xd')][_0x21ba07['id']]['Smtp'])){this['mailAccounts'][_0x21ba07['id']][_0xcecb('0x31')]={};}this[_0xcecb('0xd')][_0x21ba07['id']][_0xcecb('0x31')][_0xcecb('0x2e')]=moment();return new BPromise(function(_0x32c611,_0x4dbf3d){return _0x3f15b7['smtp'][_0xcecb('0x32')](_0x21ba07)[_0xcecb('0x2c')](function(_0x17c926){_0x3f15b7[_0xcecb('0xd')][_0x21ba07['id']]['Smtp'][_0xcecb('0x15')]=_0xcecb('0x33');_0x3f15b7[_0xcecb('0xd')][_0x21ba07['id']]['Smtp'][_0xcecb('0x16')]='';_0x3f15b7[_0xcecb('0x11')](_0x21ba07['id']);_0x32c611(_0x17c926);})[_0xcecb('0x2d')](function(_0x28da15){_0x3f15b7[_0xcecb('0xd')][_0x21ba07['id']][_0xcecb('0x31')][_0xcecb('0x15')]=_0xcecb('0x25');_0x3f15b7[_0xcecb('0xd')][_0x21ba07['id']][_0xcecb('0x31')][_0xcecb('0x16')]=_0x28da15;_0x3f15b7[_0xcecb('0x11')](_0x21ba07['id']);_0x4dbf3d(_0x28da15);});});}return this[_0xcecb('0xf')][_0xcecb('0x32')](_0x21ba07);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 466c41b..eebf711 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 _0x39e6=['prototype','connTimeout','authTimeout','service','user','anonymous@xcally.com','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','autotls','openBox','handleOpenBox','box','readUnseen','handleCloseBox','end','search','handleReadUnseen','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','emit','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','imap','iconv','Iconv','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind','handleEnd','error','handleError'];(function(_0x25f7a9,_0x2a0153){var _0x23bbe0=function(_0x4f5f05){while(--_0x4f5f05){_0x25f7a9['push'](_0x25f7a9['shift']());}};_0x23bbe0(++_0x2a0153);}(_0x39e6,0x9e));var _0x639e=function(_0x15cf78,_0x49779b){_0x15cf78=_0x15cf78-0x0;var _0xdc656c=_0x39e6[_0x15cf78];return _0xdc656c;};'use strict';var _=require(_0x639e('0x0'));var util=require('util');var Imap=require(_0x639e('0x1'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require(_0x639e('0x2'))[_0x639e('0x3')];var EventEmitter=require('events')[_0x639e('0x4')];var utils=require(_0x639e('0x5'));var logger=require(_0x639e('0x6'))(_0x639e('0x7'));function EmailImap(_0x15e5df,_0x320448){this[_0x639e('0x8')]=_0x639e('0x9');this[_0x639e('0xa')]=this[_0x639e('0xb')](_0x15e5df,_0x320448);this[_0x639e('0x1')]=new Imap(this[_0x639e('0xa')]);this[_0x639e('0x1')][_0x639e('0xc')](_0x639e('0xd'),this[_0x639e('0xe')][_0x639e('0xf')](this));this[_0x639e('0x1')]['once']('end',this[_0x639e('0x10')][_0x639e('0xf')](this));this[_0x639e('0x1')]['on'](_0x639e('0x11'),this[_0x639e('0x12')][_0x639e('0xf')](this));this[_0x639e('0x1')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x639e('0x13')][_0x639e('0xb')]=function(_0x89302c,_0x199fb5){var _0x37b8e2={'connTimeout':_0x89302c[_0x639e('0x14')]?_0x89302c['connTimeout']*0x3e8:0x2710,'authTimeout':_0x89302c[_0x639e('0x15')]?_0x89302c[_0x639e('0x15')]*0x3e8:0x1388};if(_0x89302c[_0x639e('0x16')]){_0x37b8e2[_0x639e('0x17')]=_0x89302c['user'];_0x37b8e2[_0x639e('0x7')]=_0x199fb5||_0x89302c['user']||_0x639e('0x18');if(_0x89302c[_0x639e('0x19')]){_0x37b8e2[_0x639e('0x1a')]=utils[_0x639e('0x1b')](_0x89302c[_0x639e('0x1c')][_0x639e('0x1d')],_0x89302c['user']);}else{_0x37b8e2[_0x639e('0x1e')]=_0x89302c[_0x639e('0x1e')];}}else{if(_0x89302c[_0x639e('0x1f')]){_0x37b8e2[_0x639e('0x17')]=_0x89302c['user'];_0x37b8e2[_0x639e('0x1e')]=_0x89302c[_0x639e('0x1e')];}}_0x37b8e2[_0x639e('0x20')]=_0x89302c[_0x639e('0x20')];_0x37b8e2[_0x639e('0x21')]=_0x89302c['port']||0x3e1;if(_0x89302c[_0x639e('0x22')]){_0x37b8e2[_0x639e('0x22')]=!![];}else{_0x37b8e2['tls']=![];_0x37b8e2[_0x639e('0x23')]='required';}return _0x37b8e2;};EmailImap['prototype'][_0x639e('0xe')]=function(){this[_0x639e('0x1')][_0x639e('0x24')](this[_0x639e('0x8')],![],this[_0x639e('0x25')]['bind'](this));};EmailImap[_0x639e('0x13')][_0x639e('0x25')]=function(_0x39b44f,_0x2da264){if(_0x39b44f){this[_0x639e('0x12')](_0x39b44f,!![]);}else{this['emit'](_0x639e('0x26'),_0x2da264);this[_0x639e('0x27')]();}};EmailImap[_0x639e('0x13')][_0x639e('0x28')]=function(_0x5b5b8c){if(_0x5b5b8c){this[_0x639e('0x12')](_0x5b5b8c,!![]);}else{this[_0x639e('0x1')][_0x639e('0x29')]();}};EmailImap['prototype'][_0x639e('0x27')]=function(){this['imap'][_0x639e('0x2a')](['UNSEEN'],this['handleReadUnseen'][_0x639e('0xf')](this));};EmailImap[_0x639e('0x13')][_0x639e('0x2b')]=function(_0x124954,_0x412176){if(_0x124954){this[_0x639e('0x12')](_0x124954,!![]);}else{if(_0x412176['length']){try{var _0x213b7e=this[_0x639e('0x1')]['fetch'](_0x412176,{'bodies':'','markSeen':!![]});_0x213b7e['on']('message',this[_0x639e('0x2c')][_0x639e('0xf')](this));_0x213b7e[_0x639e('0xc')]('error',this[_0x639e('0x2d')]['bind'](this));_0x213b7e[_0x639e('0xc')](_0x639e('0x29'),this[_0x639e('0x2e')]['bind'](this));}catch(_0x157d07){logger['error'](_0x157d07);}}else{this[_0x639e('0x1')][_0x639e('0x2f')](!![],this[_0x639e('0x28')]['bind'](this));}}};EmailImap[_0x639e('0x13')][_0x639e('0x2c')]=function(_0x2d5add){_0x2d5add['on']('body',this[_0x639e('0x30')]['bind'](this));_0x2d5add[_0x639e('0xc')](_0x639e('0x31'),this[_0x639e('0x32')][_0x639e('0xf')](this));_0x2d5add[_0x639e('0xc')]('end',this[_0x639e('0x33')][_0x639e('0xf')](this));};EmailImap[_0x639e('0x13')][_0x639e('0x30')]=function(_0x4b8a3e){simpleParser(_0x4b8a3e,{'Iconv':Iconv},this[_0x639e('0x34')][_0x639e('0xf')](this));};EmailImap[_0x639e('0x13')]['handleMessageAttributes']=function(){};EmailImap[_0x639e('0x13')]['handleMessageEnd']=function(){};EmailImap[_0x639e('0x13')][_0x639e('0x34')]=function(_0x2a347e,_0x4541cc){if(_0x2a347e){logger[_0x639e('0x11')](_0x2a347e);}else{var _0x13606b=this;utils['parser'](this[_0x639e('0xa')],_0x4541cc,function(_0x1d37a0){_0x13606b['emit'](_0x639e('0x7'),_0x1d37a0);});}};EmailImap['prototype'][_0x639e('0x2e')]=function(){this[_0x639e('0x1')][_0x639e('0x2f')](!![],this[_0x639e('0x28')][_0x639e('0xf')](this));};EmailImap[_0x639e('0x13')][_0x639e('0x2d')]=function(_0x4103e2){this['handleError'](_0x4103e2);this['imap']['closeBox'](!![],this['handleCloseBox'][_0x639e('0xf')](this));};EmailImap[_0x639e('0x13')]['handleEnd']=function(){this[_0x639e('0x35')](_0x639e('0x29'));};EmailImap[_0x639e('0x13')]['handleError']=function(_0x179f82,_0x4103fc){logger[_0x639e('0x11')](_0x639e('0x12'),this[_0x639e('0xa')][_0x639e('0x7')],JSON[_0x639e('0x36')](_0x179f82));var _0x201312='';if(_0x179f82){if(_0x179f82[_0x639e('0x37')]){_0x201312=_0x179f82['textCode'];}else{for(var _0x417dd6 in _0x179f82){if(_0x179f82[_0x639e('0x38')](_0x417dd6)){_0x201312+=_[_0x639e('0x39')](_0x417dd6)+':\x20'+_0x179f82[_0x417dd6]+'\x0a';}}}}if(_0x4103fc){this[_0x639e('0x1')][_0x639e('0x29')]();}else{this[_0x639e('0x35')]('error',_0x201312);this[_0x639e('0x35')](_0x639e('0x29'));}};module[_0x639e('0x3a')]=EmailImap; \ No newline at end of file +var _0x6ac2=['handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','emit','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','imap','mailparser','simpleParser','iconv','Iconv','events','./utils','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind','end','handleEnd','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','anonymous@xcally.com','xoauth2','generateXOAuth2Token','password','authentication','host','port','tls','autotls','required','openBox','handleOpenBox','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','message'];(function(_0x464d46,_0x15fc0a){var _0x1bfc4e=function(_0x5e269e){while(--_0x5e269e){_0x464d46['push'](_0x464d46['shift']());}};_0x1bfc4e(++_0x15fc0a);}(_0x6ac2,0x184));var _0x26ac=function(_0x52ba21,_0x47a0a2){_0x52ba21=_0x52ba21-0x0;var _0x4c1c63=_0x6ac2[_0x52ba21];return _0x4c1c63;};'use strict';var _=require(_0x26ac('0x0'));var util=require('util');var Imap=require(_0x26ac('0x1'));var simpleParser=require(_0x26ac('0x2'))[_0x26ac('0x3')];var Iconv=require(_0x26ac('0x4'))[_0x26ac('0x5')];var EventEmitter=require(_0x26ac('0x6'))['EventEmitter'];var utils=require(_0x26ac('0x7'));var logger=require('../../../config/logger')(_0x26ac('0x8'));function EmailImap(_0x4168ff,_0x1cc988){this[_0x26ac('0x9')]=_0x26ac('0xa');this[_0x26ac('0xb')]=this[_0x26ac('0xc')](_0x4168ff,_0x1cc988);this[_0x26ac('0x1')]=new Imap(this['account']);this['imap'][_0x26ac('0xd')](_0x26ac('0xe'),this[_0x26ac('0xf')][_0x26ac('0x10')](this));this['imap'][_0x26ac('0xd')](_0x26ac('0x11'),this[_0x26ac('0x12')][_0x26ac('0x10')](this));this['imap']['on']('error',this[_0x26ac('0x13')][_0x26ac('0x10')](this));this[_0x26ac('0x1')][_0x26ac('0x14')]();}util[_0x26ac('0x15')](EmailImap,EventEmitter);EmailImap[_0x26ac('0x16')][_0x26ac('0xc')]=function(_0x518cf8,_0x2f68ad){var _0x3ec6e6={'connTimeout':_0x518cf8[_0x26ac('0x17')]?_0x518cf8[_0x26ac('0x17')]*0x3e8:0x2710,'authTimeout':_0x518cf8['authTimeout']?_0x518cf8[_0x26ac('0x18')]*0x3e8:0x1388};if(_0x518cf8[_0x26ac('0x19')]){_0x3ec6e6['user']=_0x518cf8[_0x26ac('0x1a')];_0x3ec6e6[_0x26ac('0x8')]=_0x2f68ad||_0x518cf8[_0x26ac('0x1a')]||_0x26ac('0x1b');if(_0x518cf8['modernAuthentication']){_0x3ec6e6[_0x26ac('0x1c')]=utils[_0x26ac('0x1d')](_0x518cf8['CloudProvider']['data5'],_0x518cf8[_0x26ac('0x1a')]);}else{_0x3ec6e6[_0x26ac('0x1e')]=_0x518cf8['password'];}}else{if(_0x518cf8[_0x26ac('0x1f')]){_0x3ec6e6['user']=_0x518cf8['user'];_0x3ec6e6['password']=_0x518cf8[_0x26ac('0x1e')];}}_0x3ec6e6['host']=_0x518cf8[_0x26ac('0x20')];_0x3ec6e6[_0x26ac('0x21')]=_0x518cf8[_0x26ac('0x21')]||0x3e1;if(_0x518cf8[_0x26ac('0x22')]){_0x3ec6e6[_0x26ac('0x22')]=!![];}else{_0x3ec6e6[_0x26ac('0x22')]=![];_0x3ec6e6[_0x26ac('0x23')]=_0x26ac('0x24');}return _0x3ec6e6;};EmailImap[_0x26ac('0x16')]['handleReady']=function(){this[_0x26ac('0x1')][_0x26ac('0x25')](this[_0x26ac('0x9')],![],this[_0x26ac('0x26')][_0x26ac('0x10')](this));};EmailImap[_0x26ac('0x16')][_0x26ac('0x26')]=function(_0x414777,_0x4172c2){if(_0x414777){this[_0x26ac('0x13')](_0x414777,!![]);}else{this['emit']('box',_0x4172c2);this[_0x26ac('0x27')]();}};EmailImap['prototype'][_0x26ac('0x28')]=function(_0x11b8de){if(_0x11b8de){this[_0x26ac('0x13')](_0x11b8de,!![]);}else{this[_0x26ac('0x1')][_0x26ac('0x11')]();}};EmailImap[_0x26ac('0x16')]['readUnseen']=function(){this['imap'][_0x26ac('0x29')]([_0x26ac('0x2a')],this[_0x26ac('0x2b')]['bind'](this));};EmailImap['prototype'][_0x26ac('0x2b')]=function(_0x3aaa16,_0x387970){if(_0x3aaa16){this[_0x26ac('0x13')](_0x3aaa16,!![]);}else{if(_0x387970['length']){try{var _0x5e1cbc=this[_0x26ac('0x1')][_0x26ac('0x2c')](_0x387970,{'bodies':'','markSeen':!![]});_0x5e1cbc['on'](_0x26ac('0x2d'),this[_0x26ac('0x2e')][_0x26ac('0x10')](this));_0x5e1cbc[_0x26ac('0xd')](_0x26ac('0x2f'),this[_0x26ac('0x30')][_0x26ac('0x10')](this));_0x5e1cbc[_0x26ac('0xd')]('end',this[_0x26ac('0x31')][_0x26ac('0x10')](this));}catch(_0x5d0534){logger[_0x26ac('0x2f')](_0x5d0534);}}else{this[_0x26ac('0x1')][_0x26ac('0x32')](!![],this[_0x26ac('0x28')][_0x26ac('0x10')](this));}}};EmailImap[_0x26ac('0x16')][_0x26ac('0x2e')]=function(_0xeda527){_0xeda527['on'](_0x26ac('0x33'),this[_0x26ac('0x34')][_0x26ac('0x10')](this));_0xeda527[_0x26ac('0xd')]('attributes',this[_0x26ac('0x35')][_0x26ac('0x10')](this));_0xeda527[_0x26ac('0xd')]('end',this[_0x26ac('0x36')]['bind'](this));};EmailImap[_0x26ac('0x16')][_0x26ac('0x34')]=function(_0x4b7499){simpleParser(_0x4b7499,{'Iconv':Iconv},this[_0x26ac('0x37')][_0x26ac('0x10')](this));};EmailImap[_0x26ac('0x16')][_0x26ac('0x35')]=function(){};EmailImap[_0x26ac('0x16')][_0x26ac('0x36')]=function(){};EmailImap['prototype'][_0x26ac('0x37')]=function(_0x567116,_0xd115f7){if(_0x567116){logger['error'](_0x567116);}else{var _0x2260ae=this;utils['parser'](this['account'],_0xd115f7,function(_0x287937){_0x2260ae[_0x26ac('0x38')](_0x26ac('0x8'),_0x287937);});}};EmailImap[_0x26ac('0x16')][_0x26ac('0x31')]=function(){this[_0x26ac('0x1')]['closeBox'](!![],this['handleCloseBox'][_0x26ac('0x10')](this));};EmailImap[_0x26ac('0x16')][_0x26ac('0x30')]=function(_0x511cb2){this['handleError'](_0x511cb2);this[_0x26ac('0x1')][_0x26ac('0x32')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x26ac('0x16')][_0x26ac('0x12')]=function(){this[_0x26ac('0x38')]('end');};EmailImap['prototype']['handleError']=function(_0x4e01ac,_0x31107a){logger[_0x26ac('0x2f')](_0x26ac('0x13'),this[_0x26ac('0xb')][_0x26ac('0x8')],JSON[_0x26ac('0x39')](_0x4e01ac));var _0x26d29e='';if(_0x4e01ac){if(_0x4e01ac[_0x26ac('0x3a')]){_0x26d29e=_0x4e01ac[_0x26ac('0x3a')];}else{for(var _0x5b6034 in _0x4e01ac){if(_0x4e01ac[_0x26ac('0x3b')](_0x5b6034)){_0x26d29e+=_[_0x26ac('0x3c')](_0x5b6034)+':\x20'+_0x4e01ac[_0x5b6034]+'\x0a';}}}}if(_0x31107a){this[_0x26ac('0x1')][_0x26ac('0x11')]();}else{this[_0x26ac('0x38')](_0x26ac('0x2f'),_0x26d29e);this[_0x26ac('0x38')](_0x26ac('0x11'));}};module[_0x26ac('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 2bb4cb4..4105a61 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 _0xf32e=['createTransport','use','compile','verify','toString','Not\x20verifired','exports','nodemailer'];(function(_0x4d22f4,_0x1b5bd6){var _0x4047be=function(_0x3501a1){while(--_0x3501a1){_0x4d22f4['push'](_0x4d22f4['shift']());}};_0x4047be(++_0x1b5bd6);}(_0xf32e,0x177));var _0xef32=function(_0x11a3cd,_0x548a39){_0x11a3cd=_0x11a3cd-0x0;var _0x3c4ea3=_0xf32e[_0x11a3cd];return _0x3c4ea3;};'use strict';var nodemailer=require(_0xef32('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x3722b3,_0x5cd016){return new Promise(function(_0x48995e,_0x15eee4){var _0x3e4484=nodemailer[_0xef32('0x1')](_0x3722b3);_0x3e4484[_0xef32('0x2')](_0xef32('0x3'),inlineBase64());_0x3e4484['sendMail'](_0x5cd016,function(_0x335420,_0x15c68f){if(_0x335420){_0x15eee4(_0x335420['toString']());}else{_0x48995e(_0x15c68f);}});});};EmailSmtp['prototype'][_0xef32('0x4')]=function(_0x1889e8){return new Promise(function(_0x156598,_0x1cf27f){var _0x369206=nodemailer['createTransport'](_0x1889e8);_0x369206['verify'](function(_0x5efaea,_0x170db6){if(_0x5efaea){_0x1cf27f(_0x5efaea[_0xef32('0x5')]());}else{if(_0x170db6){_0x156598(_0x170db6);}else{_0x1cf27f(_0xef32('0x6'));}}});});};module[_0xef32('0x7')]=EmailSmtp; \ No newline at end of file +var _0x8aa9=['createTransport','use','compile','Not\x20verifired','exports','nodemailer','prototype'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0x8aa9,0x75));var _0x98aa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8aa9[_0x20a584];return _0x4b41a8;};'use strict';var nodemailer=require(_0x98aa('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x98aa('0x1')]['send']=function(_0x576472,_0xbf760f){return new Promise(function(_0x5a698d,_0x5bc4e9){var _0x5eafdb=nodemailer[_0x98aa('0x2')](_0x576472);_0x5eafdb[_0x98aa('0x3')](_0x98aa('0x4'),inlineBase64());_0x5eafdb['sendMail'](_0xbf760f,function(_0x507125,_0x3c03b6){if(_0x507125){_0x5bc4e9(_0x507125['toString']());}else{_0x5a698d(_0x3c03b6);}});});};EmailSmtp['prototype']['verify']=function(_0x906de6){return new Promise(function(_0x47bb5f,_0x1903de){var _0xf3ff8b=nodemailer['createTransport'](_0x906de6);_0xf3ff8b['verify'](function(_0x179133,_0x19cb73){if(_0x179133){_0x1903de(_0x179133['toString']());}else{if(_0x19cb73){_0x47bb5f(_0x19cb73);}else{_0x1903de(_0x98aa('0x5'));}}});});};module[_0x98aa('0x6')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index d193fc1..dff0fe8 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 _0xa7c1=['Anonymous','isEmpty','html','includes','Empty\x20message

','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','base64','lodash','moment','randomstring','path','node-tnef','email','../../../config/environment','head','value','address','generate','@xcally.com','name','substring','split','length','slice'];(function(_0x439ea1,_0x49faaa){var _0x173e09=function(_0x4be1f9){while(--_0x4be1f9){_0x439ea1['push'](_0x439ea1['shift']());}};_0x173e09(++_0x49faaa);}(_0xa7c1,0x7b));var _0x1a7c=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xa7c1[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x1a7c('0x0'));var moment=require(_0x1a7c('0x1'));var random=require(_0x1a7c('0x2'));var fs=require('fs');var path=require(_0x1a7c('0x3'));var util=require('util');var tnef=require(_0x1a7c('0x4'));var logger=require('../../../config/logger')(_0x1a7c('0x5'));var config=require(_0x1a7c('0x6'));function getAddress(_0x42ee27){var _0x5d37bc=_[_0x1a7c('0x7')](_0x42ee27[_0x1a7c('0x8')]);return _0x5d37bc&&_0x5d37bc[_0x1a7c('0x9')]?_0x5d37bc['address']:'anonymous'+random[_0x1a7c('0xa')](0x6)+_0x1a7c('0xb');}function getFirstName(_0x28f5c7){var _0x28efb1=_[_0x1a7c('0x7')](_0x28f5c7['value']);if(_0x28efb1&&_0x28efb1[_0x1a7c('0xc')]){if(_0x28efb1[_0x1a7c('0xc')]==_0x28efb1['address']){return _0x28efb1[_0x1a7c('0xc')][_0x1a7c('0xd')](0x0,_0x28efb1[_0x1a7c('0xc')]['indexOf']('@'));}var _0x5cece2=_0x28efb1[_0x1a7c('0xc')][_0x1a7c('0xe')](/\s+/);return _0x5cece2[_0x1a7c('0xf')]>0x1?_0x5cece2[_0x1a7c('0x10')](0x0,-0x1)['join']('\x20'):_0x28efb1[_0x1a7c('0xc')];}return _0x1a7c('0x11');}function getLastName(_0x4b82a6){var _0x388455=_[_0x1a7c('0x7')](_0x4b82a6[_0x1a7c('0x8')]);if(_0x388455&&_0x388455[_0x1a7c('0xc')]){var _0x2ce4f1=_0x388455[_0x1a7c('0xc')][_0x1a7c('0xe')](/\s+/);return _0x2ce4f1['length']>0x1?_0x2ce4f1['pop']():'';}return'';}function getMails(_0x51c694,_0x40e11f){var _0x59fd26='';for(var _0x365340=0x0;_0x365340<_0x40e11f[_0x1a7c('0x8')][_0x1a7c('0xf')];_0x365340+=0x1){if(_0x40e11f[_0x1a7c('0x8')][_0x365340][_0x1a7c('0x9')]!==_0x51c694){if(!_[_0x1a7c('0x12')](_0x59fd26)){_0x59fd26+=',';}_0x59fd26+=_0x40e11f[_0x1a7c('0x8')][_0x365340][_0x1a7c('0xc')]||_0x40e11f[_0x1a7c('0x8')][_0x365340][_0x1a7c('0x9')]||'';_0x59fd26+='\x20<';_0x59fd26+=_0x40e11f[_0x1a7c('0x8')][_0x365340][_0x1a7c('0x9')]?_0x40e11f['value'][_0x365340]['address']:'anonymous'+random[_0x1a7c('0xa')](0x6)+'@xcally.com';_0x59fd26+='>';}}return _0x59fd26;}function parseEmail(_0x240e6c,_0x141bcb,_0xfc547e){if(_0x141bcb[_0x1a7c('0x13')]){var _0x28c2df=/)<[^<]*)*<\/script>/gi;while(_0x28c2df['test'](_0x141bcb[_0x1a7c('0x13')])){_0x141bcb['html']=_0x141bcb['html']['replace'](_0x28c2df,'');}if(_0x141bcb[_0x1a7c('0x13')][_0x1a7c('0x14')](_0x1a7c('0x15'))){var _0x51ccd9=[];_0x141bcb['attachments'][_0x1a7c('0x16')](_0x449c57=>{_0x51ccd9[_0x1a7c('0x17')](_0x449c57[_0x1a7c('0x18')]);});var _0x2e7f57=/]+>/g;var _0x5da687=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4320ca=_0x141bcb['html'][_0x1a7c('0x19')](_0x5da687,_0x1a7c('0x1a'));var _0x513532=_0x4320ca[_0x1a7c('0x19')](_0x2e7f57,_0x1a7c('0x1b'));for(let _0x236237=0x0;_0x236237<_0x51ccd9[_0x1a7c('0xf')];_0x236237++){var _0x4a6eb2=_0x513532[_0x1a7c('0x19')](_0x1a7c('0x1b'),'\x20[Attachment:\x20'+_0x51ccd9[_0x236237]+'\x20]');_0x513532=_0x4a6eb2;}_0x141bcb[_0x1a7c('0x13')]=_0x513532;}_0xfc547e['body']=_0x141bcb[_0x1a7c('0x13')];}else{_0xfc547e[_0x1a7c('0x1c')]=_0x141bcb[_0x1a7c('0x1d')];}if(_0xfc547e[_0x1a7c('0x1c')]){_0xfc547e[_0x1a7c('0x1c')]=_0xfc547e['body'][_0x1a7c('0x19')](/0x0){var _0x47702b=[_0x1a7c('0x2c'),_0x1a7c('0x2d'),_0x1a7c('0x2e')];for(var _0x2ad691=0x0;_0x2ad691<_0x141bcb[_0x1a7c('0x2b')][_0x1a7c('0xf')];_0x2ad691++){var _0x7a039d=_[_0x1a7c('0x2f')](_0x47702b,_0x141bcb[_0x1a7c('0x2b')][_0x2ad691]['line']);if(_0x7a039d>=0x0){_0xfc547e[_0x1a7c('0x30')]=!![];}}}return _0xfc547e;}exports['parser']=function(_0x592822,_0xae0ffc,_0x520eb1){var _0x102a3b={'from':getAddress(_0xae0ffc['from']),'firstName':getFirstName(_0xae0ffc[_0x1a7c('0x31')]),'lastName':getLastName(_0xae0ffc[_0x1a7c('0x31')]),'mapKey':_0x1a7c('0x5'),'message':{'from':getMails(_0x592822[_0x1a7c('0x5')],_0xae0ffc['from']),'to':_0x592822[_0x1a7c('0x5')],'cc':'','subject':_0xae0ffc[_0x1a7c('0x32')]||'','messageId':_0xae0ffc['messageId'],'inReplyTo':_0xae0ffc[_0x1a7c('0x33')],'sentAt':moment(_0xae0ffc[_0x1a7c('0x34')])['format'](_0x1a7c('0x35')),'attach':![],'attachments':[]}};if(!_0xae0ffc[_0x1a7c('0x13')]&&!_0xae0ffc[_0x1a7c('0x1d')]){var _0x3bc9e4=_[_0x1a7c('0x36')](_0xae0ffc[_0x1a7c('0x23')],{'contentType':_0x1a7c('0x37')});if(_0x3bc9e4[_0x1a7c('0xf')]){logger[_0x1a7c('0x38')](util['format'](_0x1a7c('0x39'),_0xae0ffc[_0x1a7c('0x3a')]));tnef[_0x1a7c('0x3b')](_[_0x1a7c('0x3c')](_0x3bc9e4)[_0x1a7c('0x3d')],function(_0x159725,_0x3e66fb){if(_0x3e66fb){_0xae0ffc[_0x1a7c('0x13')]=_0x3e66fb['BodyHTML']||_0x1a7c('0x3e');if(_0x3e66fb['Attachments']){for(var _0x464adf=0x0;_0x464adf<_0x3e66fb['Attachments'][_0x1a7c('0xf')];_0x464adf++){var _0xe8d60a=_0x3e66fb['Attachments'][_0x464adf];_0x102a3b[_0x1a7c('0x1f')][_0x1a7c('0x23')]['push']({'filename':_0xe8d60a[_0x1a7c('0x3f')],'content':Buffer[_0x1a7c('0x31')](_0xe8d60a[_0x1a7c('0x40')])});}}}_0x520eb1(parseEmail(_0x592822,_0xae0ffc,_0x102a3b));});}else{_0xae0ffc[_0x1a7c('0x13')]=_0x1a7c('0x3e');_0x520eb1(parseEmail(_0x592822,_0xae0ffc,_0x102a3b));}}else{_0x520eb1(parseEmail(_0x592822,_0xae0ffc,_0x102a3b));}};exports[_0x1a7c('0x41')]=function(_0x22d74d,_0x318d6a){var _0x2dabf6=[_0x1a7c('0x42')+(_0x318d6a||''),_0x1a7c('0x43')+_0x22d74d,'',''];return Buffer[_0x1a7c('0x31')](_0x2dabf6[_0x1a7c('0x28')](''),_0x1a7c('0x44'))['toString'](_0x1a7c('0x45'));}; \ No newline at end of file +var _0xf044=['parser','from','subject','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','lodash','moment','randomstring','util','node-tnef','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','isEmpty','html','replace','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originCc','includes','originTo','bcc','attach','type','attachment','format','%s-%s','root','content','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','isAutoreply'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf044,0x1bf));var _0x4f04=function(_0x58efcb,_0x574097){_0x58efcb=_0x58efcb-0x0;var _0x4ac499=_0xf044[_0x58efcb];return _0x4ac499;};'use strict';var _=require(_0x4f04('0x0'));var moment=require(_0x4f04('0x1'));var random=require(_0x4f04('0x2'));var fs=require('fs');var path=require('path');var util=require(_0x4f04('0x3'));var tnef=require(_0x4f04('0x4'));var logger=require('../../../config/logger')(_0x4f04('0x5'));var config=require(_0x4f04('0x6'));function getAddress(_0x536230){var _0x47a5ce=_[_0x4f04('0x7')](_0x536230[_0x4f04('0x8')]);return _0x47a5ce&&_0x47a5ce[_0x4f04('0x9')]?_0x47a5ce[_0x4f04('0x9')]:_0x4f04('0xa')+random[_0x4f04('0xb')](0x6)+_0x4f04('0xc');}function getFirstName(_0x5101b3){var _0x5d998f=_[_0x4f04('0x7')](_0x5101b3[_0x4f04('0x8')]);if(_0x5d998f&&_0x5d998f[_0x4f04('0xd')]){if(_0x5d998f[_0x4f04('0xd')]==_0x5d998f[_0x4f04('0x9')]){return _0x5d998f[_0x4f04('0xd')][_0x4f04('0xe')](0x0,_0x5d998f['name'][_0x4f04('0xf')]('@'));}var _0x1861e8=_0x5d998f['name'][_0x4f04('0x10')](/\s+/);return _0x1861e8[_0x4f04('0x11')]>0x1?_0x1861e8[_0x4f04('0x12')](0x0,-0x1)[_0x4f04('0x13')]('\x20'):_0x5d998f[_0x4f04('0xd')];}return _0x4f04('0x14');}function getLastName(_0x4fc24d){var _0x852315=_[_0x4f04('0x7')](_0x4fc24d[_0x4f04('0x8')]);if(_0x852315&&_0x852315['name']){var _0x3b00b2=_0x852315[_0x4f04('0xd')][_0x4f04('0x10')](/\s+/);return _0x3b00b2[_0x4f04('0x11')]>0x1?_0x3b00b2['pop']():'';}return'';}function getMails(_0x16ba52,_0x146abe){var _0x1aa0c3='';for(var _0x3ab2cb=0x0;_0x3ab2cb<_0x146abe[_0x4f04('0x8')][_0x4f04('0x11')];_0x3ab2cb+=0x1){if(_0x146abe[_0x4f04('0x8')][_0x3ab2cb][_0x4f04('0x9')]!==_0x16ba52){if(!_[_0x4f04('0x15')](_0x1aa0c3)){_0x1aa0c3+=',';}_0x1aa0c3+=_0x146abe[_0x4f04('0x8')][_0x3ab2cb][_0x4f04('0xd')]||_0x146abe[_0x4f04('0x8')][_0x3ab2cb][_0x4f04('0x9')]||'';_0x1aa0c3+='\x20<';_0x1aa0c3+=_0x146abe[_0x4f04('0x8')][_0x3ab2cb][_0x4f04('0x9')]?_0x146abe[_0x4f04('0x8')][_0x3ab2cb][_0x4f04('0x9')]:_0x4f04('0xa')+random[_0x4f04('0xb')](0x6)+'@xcally.com';_0x1aa0c3+='>';}}return _0x1aa0c3;}function parseEmail(_0x7c3ade,_0x187c4a,_0x41cafc){if(_0x187c4a['html']){var _0x2ca0a2=/)<[^<]*)*<\/script>/gi;while(_0x2ca0a2['test'](_0x187c4a[_0x4f04('0x16')])){_0x187c4a[_0x4f04('0x16')]=_0x187c4a[_0x4f04('0x16')][_0x4f04('0x17')](_0x2ca0a2,'');}if(_0x187c4a[_0x4f04('0x16')]['includes'](_0x4f04('0x18'))){var _0x3e3fb1=[];_0x187c4a[_0x4f04('0x19')]['forEach'](_0x23ed68=>{_0x3e3fb1[_0x4f04('0x1a')](_0x23ed68[_0x4f04('0x1b')]);});var _0x36d205=/]+>/g;var _0x68d373=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1b282b=_0x187c4a[_0x4f04('0x16')][_0x4f04('0x17')](_0x68d373,'_SRC');var _0x146e35=_0x1b282b[_0x4f04('0x17')](_0x36d205,_0x4f04('0x1c'));for(let _0x54baa1=0x0;_0x54baa1<_0x3e3fb1[_0x4f04('0x11')];_0x54baa1++){var _0x20252d=_0x146e35[_0x4f04('0x17')](_0x4f04('0x1c'),_0x4f04('0x1d')+_0x3e3fb1[_0x54baa1]+_0x4f04('0x1e'));_0x146e35=_0x20252d;}_0x187c4a['html']=_0x146e35;}_0x41cafc[_0x4f04('0x1f')]=_0x187c4a['html'];}else{_0x41cafc[_0x4f04('0x1f')]=_0x187c4a[_0x4f04('0x20')];}if(_0x41cafc[_0x4f04('0x1f')]){_0x41cafc[_0x4f04('0x1f')]=_0x41cafc[_0x4f04('0x1f')][_0x4f04('0x17')](/0x0){var _0x35a5b1=[_0x4f04('0x2e'),_0x4f04('0x2f'),_0x4f04('0x30')];for(var _0x57da18=0x0;_0x57da18<_0x187c4a['headerLines'][_0x4f04('0x11')];_0x57da18++){var _0x1a63eb=_[_0x4f04('0xf')](_0x35a5b1,_0x187c4a['headerLines'][_0x57da18]['line']);if(_0x1a63eb>=0x0){_0x41cafc[_0x4f04('0x31')]=!![];}}}return _0x41cafc;}exports[_0x4f04('0x32')]=function(_0x15f18b,_0x5b623e,_0x2ac7ae){var _0x44c01c={'from':getAddress(_0x5b623e[_0x4f04('0x33')]),'firstName':getFirstName(_0x5b623e['from']),'lastName':getLastName(_0x5b623e[_0x4f04('0x33')]),'mapKey':_0x4f04('0x5'),'message':{'from':getMails(_0x15f18b['email'],_0x5b623e[_0x4f04('0x33')]),'to':_0x15f18b['email'],'cc':'','subject':_0x5b623e[_0x4f04('0x34')]||'','messageId':_0x5b623e['messageId'],'inReplyTo':_0x5b623e['inReplyTo'],'sentAt':moment(_0x5b623e[_0x4f04('0x35')])['format'](_0x4f04('0x36')),'attach':![],'attachments':[]}};if(!_0x5b623e[_0x4f04('0x16')]&&!_0x5b623e[_0x4f04('0x20')]){var _0x56283e=_[_0x4f04('0x37')](_0x5b623e['attachments'],{'contentType':_0x4f04('0x38')});if(_0x56283e['length']){logger[_0x4f04('0x39')](util[_0x4f04('0x29')](_0x4f04('0x3a'),_0x5b623e['messageId']));tnef[_0x4f04('0x3b')](_[_0x4f04('0x3c')](_0x56283e)[_0x4f04('0x2c')],function(_0x49bfc7,_0x37fcf4){if(_0x37fcf4){_0x5b623e['html']=_0x37fcf4[_0x4f04('0x3d')]||_0x4f04('0x3e');if(_0x37fcf4['Attachments']){for(var _0x715af3=0x0;_0x715af3<_0x37fcf4[_0x4f04('0x3f')][_0x4f04('0x11')];_0x715af3++){var _0xad7b32=_0x37fcf4[_0x4f04('0x3f')][_0x715af3];_0x44c01c[_0x4f04('0x21')][_0x4f04('0x19')][_0x4f04('0x1a')]({'filename':_0xad7b32[_0x4f04('0x40')],'content':Buffer[_0x4f04('0x33')](_0xad7b32[_0x4f04('0x41')])});}}}_0x2ac7ae(parseEmail(_0x15f18b,_0x5b623e,_0x44c01c));});}else{_0x5b623e[_0x4f04('0x16')]=_0x4f04('0x3e');_0x2ac7ae(parseEmail(_0x15f18b,_0x5b623e,_0x44c01c));}}else{_0x2ac7ae(parseEmail(_0x15f18b,_0x5b623e,_0x44c01c));}};exports[_0x4f04('0x42')]=function(_0x1d8667,_0x9b6694){var _0x2e8696=[_0x4f04('0x43')+(_0x9b6694||''),_0x4f04('0x44')+_0x1d8667,'',''];return Buffer[_0x4f04('0x33')](_0x2e8696[_0x4f04('0x13')](''),_0x4f04('0x45'))[_0x4f04('0x46')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 97e59d6..1a3e20e 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 _0x81ce=['active','Imap','Smtp','lodash','name','Service','key','SERV'];(function(_0x5391e2,_0x17da32){var _0x212a5d=function(_0x519a33){while(--_0x519a33){_0x5391e2['push'](_0x5391e2['shift']());}};_0x212a5d(++_0x17da32);}(_0x81ce,0x173));var _0xe81c=function(_0x53bc16,_0x545e65){_0x53bc16=_0x53bc16-0x0;var _0x181402=_0x81ce[_0x53bc16];return _0x181402;};'use strict';var _=require(_0xe81c('0x0'));function MailAccount(_0x142bf1){this['id']=_0x142bf1['id']||0x0;this[_0xe81c('0x1')]=_0x142bf1[_0xe81c('0x1')]||_0xe81c('0x2');this[_0xe81c('0x3')]=_0x142bf1[_0xe81c('0x3')]||_0xe81c('0x4');this[_0xe81c('0x5')]=_0x142bf1[_0xe81c('0x5')]||![];this[_0xe81c('0x6')]=_0x142bf1[_0xe81c('0x6')]||[];this[_0xe81c('0x7')]=_0x142bf1[_0xe81c('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x65d6=['key','SERV','active','Imap','Smtp','exports','name','Service'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0x65d6,0x1ee));var _0x665d=function(_0x2daf14,_0x1b7c53){_0x2daf14=_0x2daf14-0x0;var _0x2f9473=_0x65d6[_0x2daf14];return _0x2f9473;};'use strict';var _=require('lodash');function MailAccount(_0x562e50){this['id']=_0x562e50['id']||0x0;this[_0x665d('0x0')]=_0x562e50[_0x665d('0x0')]||_0x665d('0x1');this[_0x665d('0x2')]=_0x562e50[_0x665d('0x2')]||_0x665d('0x3');this['active']=_0x562e50[_0x665d('0x4')]||![];this['Imap']=_0x562e50[_0x665d('0x5')]||[];this[_0x665d('0x6')]=_0x562e50[_0x665d('0x6')]||[];}module[_0x665d('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 5b9a8e4..a3d1ee2 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 _0xcfc2=['mapKeys','hasOwnProperty','prototype','initMailAccounts','length','merge','exports','lodash','../model/mailAccount','mailAccounts'];(function(_0x5a27e8,_0x492a2f){var _0x4e38f7=function(_0x2a4048){while(--_0x2a4048){_0x5a27e8['push'](_0x5a27e8['shift']());}};_0x4e38f7(++_0x492a2f);}(_0xcfc2,0x133));var _0x2cfc=function(_0x3587ad,_0x58fb16){_0x3587ad=_0x3587ad-0x0;var _0x5d1afa=_0xcfc2[_0x3587ad];return _0x5d1afa;};'use strict';var _=require(_0x2cfc('0x0'));var MailAccount=require(_0x2cfc('0x1'));var Realtime=function(){this[_0x2cfc('0x2')]={};};function freeIsNotKey(_0x5b3ff,_0x5d8d7b,_0x5a0bd2){var _0xb59a21=_[_0x2cfc('0x3')](_0x5b3ff,function(_0x139990,_0x13b486){return _0x139990[_0x5a0bd2];});for(var _0x3f9ccd in _0x5d8d7b){if(_0x5d8d7b[_0x2cfc('0x4')](_0x3f9ccd)){if(!_0xb59a21[_0x3f9ccd]){delete _0x5d8d7b[_0x3f9ccd];}}}}Realtime[_0x2cfc('0x5')]['mergeFromDatabase']=function(_0x4ac12e,_0x8844a9){for(var _0xe39979 in _0x8844a9){if(_0x4ac12e[_0x2cfc('0x4')](_0xe39979)){_0x4ac12e[_0xe39979]=_0x8844a9[_0xe39979];}}};Realtime['prototype'][_0x2cfc('0x6')]=function(){var _0x421ff2=this;return function(_0x336bb7){if(_0x336bb7){freeIsNotKey(_0x336bb7,_0x421ff2[_0x2cfc('0x2')],'id');for(var _0x24585a=0x0,_0x3c5028={},_0xfc7879={};_0x24585a<_0x336bb7[_0x2cfc('0x7')];_0x24585a+=0x1){_0x3c5028=_0x336bb7[_0x24585a];if(_['isUndefined'](_0x421ff2['mailAccounts'][_0x3c5028['id']])){_0x421ff2[_0x2cfc('0x2')][_0x3c5028['id']]=new MailAccount(_0x3c5028);}else{_[_0x2cfc('0x8')](_0x421ff2[_0x2cfc('0x2')][_0x3c5028['id']],_0x3c5028);}}}return _0x421ff2[_0x2cfc('0x2')];};};module[_0x2cfc('0x9')]=Realtime; \ No newline at end of file +var _0x1878=['../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','length','merge','exports','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1878,0x1cb));var _0x8187=function(_0x4f3327,_0x578c4f){_0x4f3327=_0x4f3327-0x0;var _0x56f9ff=_0x1878[_0x4f3327];return _0x56f9ff;};'use strict';var _=require(_0x8187('0x0'));var MailAccount=require(_0x8187('0x1'));var Realtime=function(){this[_0x8187('0x2')]={};};function freeIsNotKey(_0x68bc37,_0x1af832,_0x2fd384){var _0x5f4735=_[_0x8187('0x3')](_0x68bc37,function(_0x11eeb9,_0xcabfa4){return _0x11eeb9[_0x2fd384];});for(var _0x442636 in _0x1af832){if(_0x1af832[_0x8187('0x4')](_0x442636)){if(!_0x5f4735[_0x442636]){delete _0x1af832[_0x442636];}}}}Realtime[_0x8187('0x5')][_0x8187('0x6')]=function(_0x5a5759,_0xc3970b){for(var _0x26af7b in _0xc3970b){if(_0x5a5759['hasOwnProperty'](_0x26af7b)){_0x5a5759[_0x26af7b]=_0xc3970b[_0x26af7b];}}};Realtime[_0x8187('0x5')]['initMailAccounts']=function(){var _0x788569=this;return function(_0x51e74f){if(_0x51e74f){freeIsNotKey(_0x51e74f,_0x788569[_0x8187('0x2')],'id');for(var _0x3a0c3b=0x0,_0x331352={},_0x567b76={};_0x3a0c3b<_0x51e74f[_0x8187('0x7')];_0x3a0c3b+=0x1){_0x331352=_0x51e74f[_0x3a0c3b];if(_['isUndefined'](_0x788569['mailAccounts'][_0x331352['id']])){_0x788569[_0x8187('0x2')][_0x331352['id']]=new MailAccount(_0x331352);}else{_[_0x8187('0x8')](_0x788569[_0x8187('0x2')][_0x331352['id']],_0x331352);}}}return _0x788569[_0x8187('0x2')];};};module[_0x8187('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 1ead14a..ee2faec 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 _0x5c84=['notify','NotifyMailAccount','../client','Request','GetMailAccount','provider','service','active','ListId','TemplateId','MailServerIn','Imap','CloudProvider','name','type','data5','MailServerOut','Smtp','getMailAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c84,0x1ca));var _0x45c8=function(_0x4f041d,_0x6dab4c){_0x4f041d=_0x4f041d-0x0;var _0x2c08f4=_0x5c84[_0x4f041d];return _0x2c08f4;};'use strict';var client=require(_0x45c8('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0x45c8('0x1')](_0x45c8('0x2'),{'options':{'attributes':['id','name',_0x45c8('0x3'),_0x45c8('0x4'),'email',_0x45c8('0x5'),'key',_0x45c8('0x6'),_0x45c8('0x7')],'raw':![],'include':[{'model':_0x45c8('0x8'),'as':_0x45c8('0x9'),'include':[{'model':_0x45c8('0xa'),'attributes':['id',_0x45c8('0xb'),_0x45c8('0x4'),_0x45c8('0xc'),_0x45c8('0xd')],'as':_0x45c8('0xa')}]},{'model':_0x45c8('0xe'),'as':_0x45c8('0xf'),'include':[{'model':'CloudProvider','attributes':['id','name',_0x45c8('0x4'),_0x45c8('0xc'),_0x45c8('0xd')],'as':_0x45c8('0xa')}]}]},'log':_0x45c8('0x10')});};};exports[_0x45c8('0x11')]=function(_0x3d6c2f,_0x2da758){return client[_0x45c8('0x1')](_0x45c8('0x12'),{'account':{'id':_0x3d6c2f},'body':_0x2da758,'log':_0x45c8('0x12')});}; \ No newline at end of file +var _0xbb3e=['Imap','CloudProvider','name','service','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','provider','email','active','key','ListId','TemplateId','MailServerIn'];(function(_0x3e0f20,_0x4c1204){var _0x4dc50e=function(_0x4a91d0){while(--_0x4a91d0){_0x3e0f20['push'](_0x3e0f20['shift']());}};_0x4dc50e(++_0x4c1204);}(_0xbb3e,0x181));var _0xebb3=function(_0x4b9665,_0x51f1b6){_0x4b9665=_0x4b9665-0x0;var _0xf53b66=_0xbb3e[_0x4b9665];return _0xf53b66;};'use strict';var client=require(_0xebb3('0x0'));exports[_0xebb3('0x1')]=function(){return function(){return client[_0xebb3('0x2')](_0xebb3('0x3'),{'options':{'attributes':['id','name',_0xebb3('0x4'),'service',_0xebb3('0x5'),_0xebb3('0x6'),_0xebb3('0x7'),_0xebb3('0x8'),_0xebb3('0x9')],'raw':![],'include':[{'model':_0xebb3('0xa'),'as':_0xebb3('0xb'),'include':[{'model':_0xebb3('0xc'),'attributes':['id',_0xebb3('0xd'),_0xebb3('0xe'),_0xebb3('0xf'),_0xebb3('0x10')],'as':_0xebb3('0xc')}]},{'model':_0xebb3('0x11'),'as':_0xebb3('0x12'),'include':[{'model':_0xebb3('0xc'),'attributes':['id',_0xebb3('0xd'),'service',_0xebb3('0xf'),_0xebb3('0x10')],'as':'CloudProvider'}]}]},'log':_0xebb3('0x13')});};};exports[_0xebb3('0x14')]=function(_0x26d312,_0x4f74dd){return client['Request'](_0xebb3('0x15'),{'account':{'id':_0x26d312},'body':_0x4f74dd,'log':_0xebb3('0x15')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 6cfb90f..4d85fc5 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 _0x350c=['getSettings','ShowSetting','loginMailFrequency','../client'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0x350c,0x6f));var _0xc350=function(_0x2dcc9c,_0x4e1c87){_0x2dcc9c=_0x2dcc9c-0x0;var _0x214cf9=_0x350c[_0x2dcc9c];return _0x214cf9;};'use strict';var client=require(_0xc350('0x0'));exports[_0xc350('0x1')]=function(){return client['Request'](_0xc350('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc350('0x3')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x0f09=['Request','ShowSetting','loginMailFrequency','GetSettings','../client','getSettings'];(function(_0x5e67a7,_0x282972){var _0xe780a6=function(_0x51dc4c){while(--_0x51dc4c){_0x5e67a7['push'](_0x5e67a7['shift']());}};_0xe780a6(++_0x282972);}(_0x0f09,0xca));var _0x90f0=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x0f09[_0x422905];return _0x33dc6c;};'use strict';var client=require(_0x90f0('0x0'));exports[_0x90f0('0x1')]=function(){return client[_0x90f0('0x2')](_0x90f0('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x90f0('0x4')]},'log':_0x90f0('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 4e07ba3..2b7b6f8 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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 ff24960..80bcdd7 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 _0x65f5=['exports','lodash','express','sticky-session','ioredis','../../config/environment','timeout','listen','port','socket.io','websocket','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x4780a5,_0x2a180f){var _0x4783ae=function(_0x313929){while(--_0x313929){_0x4780a5['push'](_0x4780a5['shift']());}};_0x4783ae(++_0x2a180f);}(_0x65f5,0x1dc));var _0x565f=function(_0x495441,_0x4e2c57){_0x495441=_0x495441-0x0;var _0x1b1e72=_0x65f5[_0x495441];return _0x1b1e72;};'use strict';var _=require(_0x565f('0x0'));var http=require('http');var express=require(_0x565f('0x1'));var sticky=require(_0x565f('0x2'));var Redis=require(_0x565f('0x3'));var config=require(_0x565f('0x4'));var app=express();var server=http['createServer'](app);server[_0x565f('0x5')]=0xdbba0;if(sticky[_0x565f('0x6')](server,config[_0x565f('0x7')])){var socketio=require(_0x565f('0x8'))(server,{'transports':[_0x565f('0x9'),_0x565f('0xa')]});config[_0x565f('0xb')]=_['defaults'](config[_0x565f('0xb')],{'host':_0x565f('0xc'),'port':0x18eb});socketio[_0x565f('0xd')](require(_0x565f('0xe'))({'pubClient':new Redis(config[_0x565f('0xb')]),'subClient':new Redis(config['redis'])}));require(_0x565f('0xf'))[_0x565f('0x10')]();require(_0x565f('0x11'))[_0x565f('0x10')](socketio);require(_0x565f('0x12'))['default'](app);require(_0x565f('0x13'))['default'](app);}else{server[_0x565f('0x14')](_0x565f('0x15'),function(){console[_0x565f('0x16')](_0x565f('0x17'),config[_0x565f('0x7')]);});}exports=module[_0x565f('0x18')]=app; \ No newline at end of file +var _0xb3d7=['../../config/triggers','default','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express','sticky-session','ioredis','../../config/environment','timeout','listen','port','websocket','redis','defaults','localhost','socket.io-redis'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xb3d7,0x169));var _0x7b3d=function(_0x1929d7,_0x112d6d){_0x1929d7=_0x1929d7-0x0;var _0x437beb=_0xb3d7[_0x1929d7];return _0x437beb;};'use strict';var _=require(_0x7b3d('0x0'));var http=require('http');var express=require(_0x7b3d('0x1'));var sticky=require(_0x7b3d('0x2'));var Redis=require(_0x7b3d('0x3'));var config=require(_0x7b3d('0x4'));var app=express();var server=http['createServer'](app);server[_0x7b3d('0x5')]=0xdbba0;if(sticky[_0x7b3d('0x6')](server,config[_0x7b3d('0x7')])){var socketio=require('socket.io')(server,{'transports':[_0x7b3d('0x8'),'polling']});config[_0x7b3d('0x9')]=_[_0x7b3d('0xa')](config['redis'],{'host':_0x7b3d('0xb'),'port':0x18eb});socketio['adapter'](require(_0x7b3d('0xc'))({'pubClient':new Redis(config[_0x7b3d('0x9')]),'subClient':new Redis(config[_0x7b3d('0x9')])}));require(_0x7b3d('0xd'))[_0x7b3d('0xe')]();require('../../config/socketio')[_0x7b3d('0xe')](socketio);require(_0x7b3d('0xf'))[_0x7b3d('0xe')](app);require(_0x7b3d('0x10'))[_0x7b3d('0xe')](app);}else{server[_0x7b3d('0x11')](_0x7b3d('0x12'),function(){console[_0x7b3d('0x13')](_0x7b3d('0x14'),config[_0x7b3d('0x7')]);});}exports=module[_0x7b3d('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index d4402db..312cdcd 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 _0x4668=['bluebird','../../config/logger','routing','client','http','request','then','debug','error','rpc','message','result','catch','exports','jayson/promise'];(function(_0x45455c,_0x59acb2){var _0x133ce2=function(_0x7c54f){while(--_0x7c54f){_0x45455c['push'](_0x45455c['shift']());}};_0x133ce2(++_0x59acb2);}(_0x4668,0xd1));var _0x8466=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4668[_0x321bb2];return _0x9c12ed;};'use strict';var jayson=require(_0x8466('0x0'));var BPromise=require(_0x8466('0x1'));var logger=require(_0x8466('0x2'))(_0x8466('0x3'));var client=jayson[_0x8466('0x4')][_0x8466('0x5')]({'port':0x2329});client['Request']=function(_0x424fb3,_0x43765d){return new BPromise(function(_0x3f1761,_0x2ff8d1){return client[_0x8466('0x6')](_0x424fb3,_0x43765d)[_0x8466('0x7')](function(_0x897105){logger[_0x8466('0x8')]('rpc',_0x8466('0x3'),_0x424fb3,_0x43765d,_0x897105);if(_0x897105['error']){logger[_0x8466('0x9')](_0x8466('0xa'),_0x8466('0x3'),_0x424fb3,_0x897105[_0x8466('0x9')][_0x8466('0xb')],_0x43765d);return _0x2ff8d1(_0x897105[_0x8466('0x9')]['message']);}else{return _0x3f1761(_0x897105[_0x8466('0xc')]);}})[_0x8466('0xd')](function(_0x2d2d20){logger['error']('rpc',_0x8466('0x3'),_0x424fb3,_0x2d2d20,_0x43765d);return _0x2ff8d1(_0x2d2d20);});});};module[_0x8466('0xe')]=client; \ No newline at end of file +var _0x730b=['message','result','catch','exports','bluebird','routing','client','http','Request','then','rpc','error'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x730b,0x154));var _0xb730=function(_0xefc2ac,_0x80bff6){_0xefc2ac=_0xefc2ac-0x0;var _0x45516b=_0x730b[_0xefc2ac];return _0x45516b;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xb730('0x0'));var logger=require('../../config/logger')(_0xb730('0x1'));var client=jayson[_0xb730('0x2')][_0xb730('0x3')]({'port':0x2329});client[_0xb730('0x4')]=function(_0x41646d,_0x636e1){return new BPromise(function(_0xd3bb22,_0x11b2e3){return client['request'](_0x41646d,_0x636e1)[_0xb730('0x5')](function(_0x4a09b7){logger['debug'](_0xb730('0x6'),'routing',_0x41646d,_0x636e1,_0x4a09b7);if(_0x4a09b7[_0xb730('0x7')]){logger['error'](_0xb730('0x6'),_0xb730('0x1'),_0x41646d,_0x4a09b7[_0xb730('0x7')][_0xb730('0x8')],_0x636e1);return _0x11b2e3(_0x4a09b7[_0xb730('0x7')][_0xb730('0x8')]);}else{return _0xd3bb22(_0x4a09b7[_0xb730('0x9')]);}})[_0xb730('0xa')](function(_0x5bba87){logger[_0xb730('0x7')](_0xb730('0x6'),_0xb730('0x1'),_0x41646d,_0x5bba87,_0x636e1);return _0x11b2e3(_0x5bba87);});});};module[_0xb730('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 33ac510..aaab749 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 _0xfc3f=['./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','getAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','listen','catch','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue'];(function(_0x280f4a,_0x2ed8d6){var _0x1bb157=function(_0x37de94){while(--_0x37de94){_0x280f4a['push'](_0x280f4a['shift']());}};_0x1bb157(++_0x2ed8d6);}(_0xfc3f,0x156));var _0xffc3=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xfc3f[_0x521929];return _0x632436;};'use strict';var BPromise=require(_0xffc3('0x0'));var server=require(_0xffc3('0x1'));var Realtime=require(_0xffc3('0x2'));var user=require(_0xffc3('0x3'));var interval=require(_0xffc3('0x4'));var openchannelQueue=require(_0xffc3('0x5'));var chatQueue=require(_0xffc3('0x6'));var smsQueue=require(_0xffc3('0x7'));var mailQueue=require(_0xffc3('0x8'));var faxQueue=require(_0xffc3('0x9'));var whatsappQueue=require(_0xffc3('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xffc3('0xb')](user[_0xffc3('0xc')]())[_0xffc3('0xb')](realtime['initAgents']())[_0xffc3('0xb')](interval['getIntervals']())['then'](realtime[_0xffc3('0xd')]())[_0xffc3('0xb')](openchannelQueue[_0xffc3('0xe')]())[_0xffc3('0xb')](realtime[_0xffc3('0xf')]())[_0xffc3('0xb')](chatQueue[_0xffc3('0x10')]())[_0xffc3('0xb')](realtime[_0xffc3('0x11')]())[_0xffc3('0xb')](smsQueue[_0xffc3('0x12')]())[_0xffc3('0xb')](realtime[_0xffc3('0x13')]())[_0xffc3('0xb')](mailQueue['getMailQueues']())['then'](realtime['initMailQueues']())[_0xffc3('0xb')](faxQueue[_0xffc3('0x14')]())[_0xffc3('0xb')](realtime[_0xffc3('0x15')]())[_0xffc3('0xb')](whatsappQueue['getWhatsappQueues']())[_0xffc3('0xb')](realtime[_0xffc3('0x16')]())[_0xffc3('0xb')](function(){return realtime;});}function main(){return server[_0xffc3('0x17')](realtime)[_0xffc3('0xb')](function(_0x2a3fc1){return initRealtime();})['then'](function(_0x2cc395){return setInterval(initRealtime,0x1388);})[_0xffc3('0x18')](function(_0x43eef8){console['log'](_0x43eef8);});}main(); \ No newline at end of file +var _0x7e12=['./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','listen','catch','bluebird','./server','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x7e12,0x1c3));var _0x27e1=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x7e12[_0x50007c];return _0x5c1ec7;};'use strict';var BPromise=require(_0x27e1('0x0'));var server=require(_0x27e1('0x1'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0x27e1('0x2'));var openchannelQueue=require(_0x27e1('0x3'));var chatQueue=require(_0x27e1('0x4'));var smsQueue=require(_0x27e1('0x5'));var mailQueue=require(_0x27e1('0x6'));var faxQueue=require(_0x27e1('0x7'));var whatsappQueue=require(_0x27e1('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x27e1('0x9')]()[_0x27e1('0xa')](user[_0x27e1('0xb')]())[_0x27e1('0xa')](realtime['initAgents']())[_0x27e1('0xa')](interval['getIntervals']())['then'](realtime[_0x27e1('0xc')]())[_0x27e1('0xa')](openchannelQueue[_0x27e1('0xd')]())[_0x27e1('0xa')](realtime[_0x27e1('0xe')]())['then'](chatQueue[_0x27e1('0xf')]())[_0x27e1('0xa')](realtime['initChatQueues']())[_0x27e1('0xa')](smsQueue[_0x27e1('0x10')]())[_0x27e1('0xa')](realtime[_0x27e1('0x11')]())[_0x27e1('0xa')](mailQueue[_0x27e1('0x12')]())[_0x27e1('0xa')](realtime[_0x27e1('0x13')]())['then'](faxQueue[_0x27e1('0x14')]())[_0x27e1('0xa')](realtime[_0x27e1('0x15')]())[_0x27e1('0xa')](whatsappQueue['getWhatsappQueues']())[_0x27e1('0xa')](realtime['initWhatsappQueues']())['then'](function(){return realtime;});}function main(){return server[_0x27e1('0x16')](realtime)[_0x27e1('0xa')](function(_0xbdaca2){return initRealtime();})[_0x27e1('0xa')](function(_0x57ee78){return setInterval(initRealtime,0x1388);})[_0x27e1('0x17')](function(_0x4e17bc){console['log'](_0x4e17bc);});}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 17466b8..b2c74d9 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1261,0x144));var _0x1126=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0x1261[_0x2ff238];return _0x204a56;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1261,0x144));var _0x1126=function(_0x54da5b,_0x12fd71){_0x54da5b=_0x54da5b-0x0;var _0x285d3b=_0x1261[_0x54da5b];return _0x285d3b;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index cb67f5c..1a8002d 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 _0x554f=['catch','sendMailMessage','SendMail','jayson/promise','client','http','request','then','error','message'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x554f,0xa3));var _0xf554=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x554f[_0x17406a];return _0x1501ff;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xf554('0x0'));var client=jayson[_0xf554('0x1')][_0xf554('0x2')]({'port':0x232b});function request(_0x494428,_0x4a786a){return new BPromise(function(_0x4ec096,_0x24125e){return client[_0xf554('0x3')](_0x494428,_0x4a786a)[_0xf554('0x4')](function(_0x333f1b){if(_0x333f1b['error']){return _0x24125e(_0x333f1b[_0xf554('0x5')][_0xf554('0x6')]);}else{return _0x4ec096(_0x333f1b['result']);}})[_0xf554('0x7')](function(_0x51c8a9){return _0x24125e(_0x51c8a9);});});}exports[_0xf554('0x8')]=function(_0xf9d324,_0xc93ee1){return request(_0xf554('0x9'),{'account':_0xf9d324,'message':_0xc93ee1});}; \ No newline at end of file +var _0x61fd=['SendMail','bluebird','client','http','then','error','message','result','catch'];(function(_0x5a71d8,_0x1c3c92){var _0x1d5223=function(_0x4ee6ed){while(--_0x4ee6ed){_0x5a71d8['push'](_0x5a71d8['shift']());}};_0x1d5223(++_0x1c3c92);}(_0x61fd,0x1a8));var _0xd61f=function(_0x5899b9,_0x3c4477){_0x5899b9=_0x5899b9-0x0;var _0x2c766d=_0x61fd[_0x5899b9];return _0x2c766d;};'use strict';var BPromise=require(_0xd61f('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xd61f('0x1')][_0xd61f('0x2')]({'port':0x232b});function request(_0x1985d5,_0x3eefc0){return new BPromise(function(_0x26f475,_0x6b46a4){return client['request'](_0x1985d5,_0x3eefc0)[_0xd61f('0x3')](function(_0xb4a83f){if(_0xb4a83f[_0xd61f('0x4')]){return _0x6b46a4(_0xb4a83f[_0xd61f('0x4')][_0xd61f('0x5')]);}else{return _0x26f475(_0xb4a83f[_0xd61f('0x6')]);}})[_0xd61f('0x7')](function(_0x593811){return _0x6b46a4(_0x593811);});});}exports['sendMailMessage']=function(_0x3300ee,_0x4b4d5b){return request(_0xd61f('0x8'),{'account':_0x3300ee,'message':_0x4b4d5b});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 2e17ede..a0647cc 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 _0x8a17=['stringify','emit','user:save','exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','md5','prototype','Capacity','maxcapacity','working','idle','chat','sms','whatsapp','length','getChannelStatus','StatusTime','toNumber','format','Status','chatStatusTime','chatCurrentCapacity','openchannelStatusTime','busyQueue'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8a17,0x135));var _0x78a1=function(_0x1e4f2f,_0x35edfa){_0x1e4f2f=_0x1e4f2f-0x0;var _0xccea89=_0x8a17[_0x1e4f2f];return _0xccea89;};'use strict';var _=require(_0x78a1('0x0'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x78a1('0x1'));var config=require(_0x78a1('0x2'));config[_0x78a1('0x3')]=_[_0x78a1('0x4')](config['redis'],{'host':_0x78a1('0x5'),'port':0x18eb});var io=require(_0x78a1('0x6'))(new Redis(config[_0x78a1('0x3')]));function Agent(_0x471d20){this['id']=_0x471d20['id']||0x0;this[_0x78a1('0x7')]=_0x471d20[_0x78a1('0x7')]||'';this[_0x78a1('0x8')]=_0x471d20[_0x78a1('0x8')]||!![];this['voicePause']=_0x471d20[_0x78a1('0x9')]||![];this[_0x78a1('0xa')]=_0x471d20[_0x78a1('0xa')]||![];this[_0x78a1('0xb')]=_0x471d20['mailPause']||![];this[_0x78a1('0xc')]=_0x471d20[_0x78a1('0xc')]||![];this[_0x78a1('0xd')]=_0x471d20[_0x78a1('0xd')]||![];this[_0x78a1('0xe')]=_0x471d20[_0x78a1('0xe')]||![];this[_0x78a1('0xf')]=_0x78a1('0x10');this['chatStatusTime']=0x0;this[_0x78a1('0x11')]=_0x471d20[_0x78a1('0x11')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x78a1('0x12')]='unknown';this[_0x78a1('0x13')]=0x0;this[_0x78a1('0x14')]=_0x471d20['mailCapacity']||0x0;this[_0x78a1('0x15')]=0x0;this[_0x78a1('0x16')]=_0x78a1('0x10');this[_0x78a1('0x17')]=0x0;this[_0x78a1('0x18')]=_0x471d20[_0x78a1('0x18')]||0x0;this[_0x78a1('0x19')]=0x0;this[_0x78a1('0x1a')]=_0x78a1('0x10');this[_0x78a1('0x1b')]=0x0;this[_0x78a1('0x1c')]=_0x471d20[_0x78a1('0x1c')]||0x0;this[_0x78a1('0x1d')]=0x0;this[_0x78a1('0x1e')]='unknown';this[_0x78a1('0x1f')]=0x0;this[_0x78a1('0x20')]=_0x471d20[_0x78a1('0x20')]||0x0;this[_0x78a1('0x21')]=0x0;this[_0x78a1('0x22')]=_0x78a1('0x10');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x471d20[_0x78a1('0x23')]||0x0;this[_0x78a1('0x24')]=0x0;this[_0x78a1('0x25')]=![];this['busyQueue']=undefined;this[_0x78a1('0x26')]='';this['updateRealtime']();}Agent[_0x78a1('0x27')]['getChannelStatus']=function(_0x261961){if(this[_0x261961+'CurrentCapacity']>0x0){if(this[_0x261961+_0x78a1('0x28')]>0x0&&this[_0x261961+'CurrentCapacity']>=this[_0x261961+_0x78a1('0x28')]){return _0x78a1('0x29');}else{return _0x78a1('0x2a');}}else{return _0x78a1('0x2b');}};Agent[_0x78a1('0x27')]['updateRealtime']=function(){var _0x4d5f52=['mail',_0x78a1('0x2c'),'openchannel','fax',_0x78a1('0x2d'),_0x78a1('0x2e')];for(var _0x37aec5=0x0;_0x37aec5<_0x4d5f52[_0x78a1('0x2f')];_0x37aec5+=0x1){var _0x5c8eb8=this[_0x78a1('0x30')](_0x4d5f52[_0x37aec5]);if(this[_0x4d5f52[_0x37aec5]+'Status']!==_0x5c8eb8){this[_0x4d5f52[_0x37aec5]+_0x78a1('0x31')]=_[_0x78a1('0x32')](moment()[_0x78a1('0x33')]('x'));}this[_0x4d5f52[_0x37aec5]+_0x78a1('0x34')]=_0x5c8eb8;}var _0x4125a4={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x78a1('0x9')],'chatPause':this[_0x78a1('0xa')],'mailPause':this[_0x78a1('0xb')],'smsPause':this[_0x78a1('0xd')],'faxPause':this[_0x78a1('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x78a1('0xf')],'chatStatusTime':this[_0x78a1('0x35')],'chatCapacity':this[_0x78a1('0x11')],'chatCurrentCapacity':this[_0x78a1('0x36')],'mailStatus':this[_0x78a1('0x12')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x78a1('0x14')],'mailCurrentCapacity':this[_0x78a1('0x15')],'faxStatus':this[_0x78a1('0x16')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x78a1('0x18')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x78a1('0x1a')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x78a1('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x78a1('0x1f')],'whatsappCapacity':this[_0x78a1('0x20')],'whatsappCurrentCapacity':this[_0x78a1('0x21')],'openchannelStatus':this[_0x78a1('0x22')],'openchannelStatusTime':this[_0x78a1('0x37')],'openchannelCapacity':this[_0x78a1('0x23')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x78a1('0x25')],'busyQueue':this[_0x78a1('0x38')]};var _0x23d3c4=md5(JSON[_0x78a1('0x39')](_0x4125a4));if(this['md5']!==_0x23d3c4){this[_0x78a1('0x26')]=_0x23d3c4;io[_0x78a1('0x3a')](_0x78a1('0x3b'),_0x4125a4);}};module[_0x78a1('0x3c')]=Agent; \ No newline at end of file +var _0x280b=['openchannel','whatsapp','length','Status','StatusTime','toNumber','format','chatStatus','chatStatusTime','whatsappStatusTime','busyQueue','stringify','emit','user:save','exports','moment','md5','redis','defaults','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat'];(function(_0x441380,_0x73cd00){var _0x3cc38b=function(_0xc54411){while(--_0xc54411){_0x441380['push'](_0x441380['shift']());}};_0x3cc38b(++_0x73cd00);}(_0x280b,0x1bf));var _0xb280=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x280b[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var moment=require(_0xb280('0x0'));var md5=require(_0xb280('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xb280('0x2')]=_[_0xb280('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb280('0x2')]));function Agent(_0x1565bd){this['id']=_0x1565bd['id']||0x0;this['name']=_0x1565bd[_0xb280('0x4')]||'';this['online']=_0x1565bd['online']||!![];this['voicePause']=_0x1565bd[_0xb280('0x5')]||![];this['chatPause']=_0x1565bd[_0xb280('0x6')]||![];this['mailPause']=_0x1565bd[_0xb280('0x7')]||![];this[_0xb280('0x8')]=_0x1565bd['faxPause']||![];this['smsPause']=_0x1565bd[_0xb280('0x9')]||![];this['openchannelPause']=_0x1565bd[_0xb280('0xa')]||![];this['chatStatus']=_0xb280('0xb');this['chatStatusTime']=0x0;this[_0xb280('0xc')]=_0x1565bd[_0xb280('0xc')]||0x0;this[_0xb280('0xd')]=0x0;this[_0xb280('0xe')]='unknown';this['mailStatusTime']=0x0;this[_0xb280('0xf')]=_0x1565bd[_0xb280('0xf')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xb280('0x10')]=_0xb280('0xb');this[_0xb280('0x11')]=0x0;this[_0xb280('0x12')]=_0x1565bd[_0xb280('0x12')]||0x0;this[_0xb280('0x13')]=0x0;this[_0xb280('0x14')]=_0xb280('0xb');this['smsStatusTime']=0x0;this[_0xb280('0x15')]=_0x1565bd[_0xb280('0x15')]||0x0;this[_0xb280('0x16')]=0x0;this['whatsappStatus']='unknown';this['whatsappStatusTime']=0x0;this[_0xb280('0x17')]=_0x1565bd[_0xb280('0x17')]||0x0;this[_0xb280('0x18')]=0x0;this[_0xb280('0x19')]=_0xb280('0xb');this[_0xb280('0x1a')]=0x0;this[_0xb280('0x1b')]=_0x1565bd[_0xb280('0x1b')]||0x0;this[_0xb280('0x1c')]=0x0;this[_0xb280('0x1d')]=![];this['busyQueue']=undefined;this[_0xb280('0x1')]='';this[_0xb280('0x1e')]();}Agent[_0xb280('0x1f')]['getChannelStatus']=function(_0x27fd83){if(this[_0x27fd83+_0xb280('0x20')]>0x0){if(this[_0x27fd83+_0xb280('0x21')]>0x0&&this[_0x27fd83+_0xb280('0x20')]>=this[_0x27fd83+_0xb280('0x21')]){return _0xb280('0x22');}else{return _0xb280('0x23');}}else{return _0xb280('0x24');}};Agent[_0xb280('0x1f')][_0xb280('0x1e')]=function(){var _0xe3f1e3=[_0xb280('0x25'),_0xb280('0x26'),_0xb280('0x27'),'fax','sms',_0xb280('0x28')];for(var _0x273f8a=0x0;_0x273f8a<_0xe3f1e3[_0xb280('0x29')];_0x273f8a+=0x1){var _0x5012ce=this['getChannelStatus'](_0xe3f1e3[_0x273f8a]);if(this[_0xe3f1e3[_0x273f8a]+_0xb280('0x2a')]!==_0x5012ce){this[_0xe3f1e3[_0x273f8a]+_0xb280('0x2b')]=_[_0xb280('0x2c')](moment()[_0xb280('0x2d')]('x'));}this[_0xe3f1e3[_0x273f8a]+_0xb280('0x2a')]=_0x5012ce;}var _0x1efb1a={'id':this['id'],'name':this[_0xb280('0x4')],'online':this['online'],'voicePause':this[_0xb280('0x5')],'chatPause':this[_0xb280('0x6')],'mailPause':this[_0xb280('0x7')],'smsPause':this[_0xb280('0x9')],'faxPause':this[_0xb280('0x8')],'openchannelPause':this[_0xb280('0xa')],'chatStatus':this[_0xb280('0x2e')],'chatStatusTime':this[_0xb280('0x2f')],'chatCapacity':this[_0xb280('0xc')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xb280('0xe')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xb280('0x10')],'faxStatusTime':this[_0xb280('0x11')],'faxCapacity':this[_0xb280('0x12')],'faxCurrentCapacity':this[_0xb280('0x13')],'smsStatus':this[_0xb280('0x14')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xb280('0x30')],'whatsappCapacity':this[_0xb280('0x17')],'whatsappCurrentCapacity':this[_0xb280('0x18')],'openchannelStatus':this[_0xb280('0x19')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xb280('0x1d')],'busyQueue':this[_0xb280('0x31')]};var _0x5167ee=md5(JSON[_0xb280('0x32')](_0x1efb1a));if(this[_0xb280('0x1')]!==_0x5167ee){this[_0xb280('0x1')]=_0x5167ee;io[_0xb280('0x33')](_0xb280('0x34'),_0x1efb1a);}};module[_0xb280('0x35')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 17e7830..291380d 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 _0x43fb=['length','online','chatPause','available','stringify','chat:queue:%s','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','updateRealtime','loggedIn','paused'];(function(_0x35f526,_0x19b256){var _0x2e817a=function(_0x2129b2){while(--_0x2129b2){_0x35f526['push'](_0x35f526['shift']());}};_0x2e817a(++_0x19b256);}(_0x43fb,0x147));var _0xb43f=function(_0x4b8a20,_0x2dcc85){_0x4b8a20=_0x4b8a20-0x0;var _0x103ac6=_0x43fb[_0x4b8a20];return _0x103ac6;};'use strict';var _=require('lodash');var md5=require(_0xb43f('0x0'));var util=require(_0xb43f('0x1'));var Redis=require(_0xb43f('0x2'));var config=require(_0xb43f('0x3'));config['redis']=_[_0xb43f('0x4')](config[_0xb43f('0x5')],{'host':_0xb43f('0x6'),'port':0x18eb});var io=require(_0xb43f('0x7'))(new Redis(config[_0xb43f('0x5')]));function ChatQueue(_0x498b62){this['id']=_0x498b62['id']||0x0;this[_0xb43f('0x8')]=_0x498b62[_0xb43f('0x8')]||'';this[_0xb43f('0x9')]=_0x498b62[_0xb43f('0x9')]||0xa;this[_0xb43f('0xa')]=_0x498b62[_0xb43f('0xa')]||_0xb43f('0xb');this[_0xb43f('0xc')]=_0x498b62[_0xb43f('0xc')];this['mapAgentsId']={};this[_0xb43f('0xd')]=0x0;this[_0xb43f('0x0')]='';this[_0xb43f('0xe')]();this['updateRealtime']();}ChatQueue[_0xb43f('0xf')]['updateRouting']=function(){var _0x4f9e76=this[_0xb43f('0x10')][_0xb43f('0x11')];this[_0xb43f('0x10')]=_['map'](this[_0xb43f('0xc')],'id');this[_0xb43f('0x10')][_0xb43f('0x11')]=_0x4f9e76;};ChatQueue[_0xb43f('0xf')][_0xb43f('0x12')]=function(){this[_0xb43f('0x13')]=0x0;this[_0xb43f('0x14')]=0x0;for(var _0x219002=0x0;_0x219002=0x0?this[_0xb43f('0x18')]:0x0;var _0x145821={'id':this['id'],'available':this['available'],'loggedIn':this[_0xb43f('0x13')],'name':this[_0xb43f('0x8')],'paused':this[_0xb43f('0x14')],'waiting':this[_0xb43f('0xd')]};var _0x289937=md5(JSON[_0xb43f('0x19')](_0x145821));if(this[_0xb43f('0x0')]!==_0x289937){this[_0xb43f('0x0')]=_0x289937;io['to'](util['format'](_0xb43f('0x1a'),_0x145821['name']))['emit'](_0xb43f('0x1b'),_0x145821);}};module[_0xb43f('0x1c')]=ChatQueue; \ No newline at end of file +var _0x8300=['paused','available','stringify','format','chat_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','loggedIn','length','online','chatPause'];(function(_0x2ee6af,_0x54eb6b){var _0x1ce8bc=function(_0x298242){while(--_0x298242){_0x2ee6af['push'](_0x2ee6af['shift']());}};_0x1ce8bc(++_0x54eb6b);}(_0x8300,0x1eb));var _0x0830=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0x8300[_0x10f6e8];return _0x35bb3c;};'use strict';var _=require(_0x0830('0x0'));var md5=require(_0x0830('0x1'));var util=require(_0x0830('0x2'));var Redis=require(_0x0830('0x3'));var config=require(_0x0830('0x4'));config['redis']=_['defaults'](config[_0x0830('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x0830('0x6'))(new Redis(config[_0x0830('0x5')]));function ChatQueue(_0xf56d3c){this['id']=_0xf56d3c['id']||0x0;this[_0x0830('0x7')]=_0xf56d3c['name']||'';this[_0x0830('0x8')]=_0xf56d3c[_0x0830('0x8')]||0xa;this['strategy']=_0xf56d3c[_0x0830('0x9')]||_0x0830('0xa');this[_0x0830('0xb')]=_0xf56d3c[_0x0830('0xb')];this[_0x0830('0xc')]={};this[_0x0830('0xd')]=0x0;this['md5']='';this[_0x0830('0xe')]();this['updateRealtime']();}ChatQueue['prototype'][_0x0830('0xe')]=function(){var _0x15b861=this[_0x0830('0xc')][_0x0830('0xf')];this[_0x0830('0xc')]=_['map'](this[_0x0830('0xb')],'id');this[_0x0830('0xc')][_0x0830('0xf')]=_0x15b861;};ChatQueue[_0x0830('0x10')][_0x0830('0x11')]=function(){this[_0x0830('0x12')]=0x0;this['paused']=0x0;for(var _0x58d279=0x0;_0x58d279=0x0?this[_0x0830('0x17')]:0x0;var _0x228349={'id':this['id'],'available':this[_0x0830('0x17')],'loggedIn':this[_0x0830('0x12')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x0830('0xd')]};var _0x491e96=md5(JSON[_0x0830('0x18')](_0x228349));if(this[_0x0830('0x1')]!==_0x491e96){this[_0x0830('0x1')]=_0x491e96;io['to'](util[_0x0830('0x19')]('chat:queue:%s',_0x228349[_0x0830('0x7')]))['emit'](_0x0830('0x1a'),_0x228349);}};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 af44e8d..5a5d0ec 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 _0xd845=['timeout','strategy','beepall','Agents','waiting','prototype','updateRouting','mapAgentsId','_rr','map','updateRealtime','loggedIn','paused','length','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name'];(function(_0x26a4ab,_0x3701bb){var _0x45cf21=function(_0x18e56b){while(--_0x18e56b){_0x26a4ab['push'](_0x26a4ab['shift']());}};_0x45cf21(++_0x3701bb);}(_0xd845,0x89));var _0x5d84=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xd845[_0x4b7b62];return _0x2280df;};'use strict';var _=require('lodash');var md5=require(_0x5d84('0x0'));var util=require(_0x5d84('0x1'));var Redis=require(_0x5d84('0x2'));var config=require(_0x5d84('0x3'));config[_0x5d84('0x4')]=_[_0x5d84('0x5')](config[_0x5d84('0x4')],{'host':_0x5d84('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x157393){this['id']=_0x157393['id']||0x0;this[_0x5d84('0x7')]=_0x157393[_0x5d84('0x7')]||'';this['timeout']=_0x157393[_0x5d84('0x8')]||0xa;this[_0x5d84('0x9')]=_0x157393[_0x5d84('0x9')]||_0x5d84('0xa');this[_0x5d84('0xb')]=_0x157393[_0x5d84('0xb')];this['mapAgentsId']={};this[_0x5d84('0xc')]=0x0;this[_0x5d84('0x0')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0x5d84('0xd')][_0x5d84('0xe')]=function(){var _0x23d51d=this[_0x5d84('0xf')][_0x5d84('0x10')];this['mapAgentsId']=_[_0x5d84('0x11')](this['Agents'],'id');this[_0x5d84('0xf')][_0x5d84('0x10')]=_0x23d51d;};FaxQueue['prototype'][_0x5d84('0x12')]=function(){this[_0x5d84('0x13')]=0x0;this[_0x5d84('0x14')]=0x0;for(var _0x4b5f6a=0x0;_0x4b5f6a=0x0?this[_0x5d84('0x16')]:0x0;var _0x5832be={'id':this['id'],'available':this[_0x5d84('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x5d84('0x14')],'waiting':this['waiting']};var _0x1fb45c=md5(JSON[_0x5d84('0x17')](_0x5832be));if(this[_0x5d84('0x0')]!==_0x1fb45c){this['md5']=_0x1fb45c;io['to'](util[_0x5d84('0x18')](_0x5d84('0x19'),_0x5832be[_0x5d84('0x7')]))[_0x5d84('0x1a')](_0x5d84('0x1b'),_0x5832be);}};module[_0x5d84('0x1c')]=FaxQueue; \ No newline at end of file +var _0x0b44=['prototype','_rr','loggedIn','paused','length','online','faxPause','available','waiting','stringify','format','fax:queue:%s','emit','fax_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime'];(function(_0x240280,_0x207991){var _0x33487a=function(_0x37109a){while(--_0x37109a){_0x240280['push'](_0x240280['shift']());}};_0x33487a(++_0x207991);}(_0x0b44,0x176));var _0x40b4=function(_0x2fdf69,_0x190004){_0x2fdf69=_0x2fdf69-0x0;var _0x4f21f3=_0x0b44[_0x2fdf69];return _0x4f21f3;};'use strict';var _=require(_0x40b4('0x0'));var md5=require(_0x40b4('0x1'));var util=require(_0x40b4('0x2'));var Redis=require(_0x40b4('0x3'));var config=require(_0x40b4('0x4'));config[_0x40b4('0x5')]=_[_0x40b4('0x6')](config[_0x40b4('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x40b4('0x7'))(new Redis(config['redis']));function FaxQueue(_0x5aa60e){this['id']=_0x5aa60e['id']||0x0;this['name']=_0x5aa60e[_0x40b4('0x8')]||'';this[_0x40b4('0x9')]=_0x5aa60e[_0x40b4('0x9')]||0xa;this[_0x40b4('0xa')]=_0x5aa60e[_0x40b4('0xa')]||_0x40b4('0xb');this[_0x40b4('0xc')]=_0x5aa60e[_0x40b4('0xc')];this[_0x40b4('0xd')]={};this['waiting']=0x0;this['md5']='';this[_0x40b4('0xe')]();this[_0x40b4('0xf')]();}FaxQueue[_0x40b4('0x10')][_0x40b4('0xe')]=function(){var _0x17e5fe=this[_0x40b4('0xd')][_0x40b4('0x11')];this[_0x40b4('0xd')]=_['map'](this[_0x40b4('0xc')],'id');this[_0x40b4('0xd')][_0x40b4('0x11')]=_0x17e5fe;};FaxQueue['prototype'][_0x40b4('0xf')]=function(){this[_0x40b4('0x12')]=0x0;this[_0x40b4('0x13')]=0x0;for(var _0x3143b0=0x0;_0x3143b0=0x0?this[_0x40b4('0x17')]:0x0;var _0x397482={'id':this['id'],'available':this[_0x40b4('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x40b4('0x8')],'paused':this[_0x40b4('0x13')],'waiting':this[_0x40b4('0x18')]};var _0x214d59=md5(JSON[_0x40b4('0x19')](_0x397482));if(this[_0x40b4('0x1')]!==_0x214d59){this[_0x40b4('0x1')]=_0x214d59;io['to'](util[_0x40b4('0x1a')](_0x40b4('0x1b'),_0x397482[_0x40b4('0x8')]))[_0x40b4('0x1c')](_0x40b4('0x1d'),_0x397482);}};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 86d083d..7f30722 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 _0x3d2d=['exports','name','Intervals'];(function(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0x3d2d,0x1ea));var _0xd3d2=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0x3d2d[_0x2c9b79];return _0x265032;};'use strict';function Interval(_0x584f37){this['id']=_0x584f37['id']||0x0;this[_0xd3d2('0x0')]=_0x584f37['name']||'';this[_0xd3d2('0x1')]=_0x584f37[_0xd3d2('0x1')]||{};}module[_0xd3d2('0x2')]=Interval; \ No newline at end of file +var _0x9593=['name','Intervals','exports'];(function(_0x5e4fb6,_0x40f288){var _0x27c66f=function(_0x5252d9){while(--_0x5252d9){_0x5e4fb6['push'](_0x5e4fb6['shift']());}};_0x27c66f(++_0x40f288);}(_0x9593,0x12c));var _0x3959=function(_0x457b64,_0x49a219){_0x457b64=_0x457b64-0x0;var _0x437111=_0x9593[_0x457b64];return _0x437111;};'use strict';function Interval(_0x471e00){this['id']=_0x471e00['id']||0x0;this[_0x3959('0x0')]=_0x471e00[_0x3959('0x0')]||'';this[_0x3959('0x1')]=_0x471e00[_0x3959('0x1')]||{};}module[_0x3959('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 a727cdf..7965a94 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 _0x52d3=['emit','mail_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','_rr','map','loggedIn','paused','online','mailPause','available','format'];(function(_0xb7bf7b,_0x1db845){var _0x14b427=function(_0x1d04bb){while(--_0x1d04bb){_0xb7bf7b['push'](_0xb7bf7b['shift']());}};_0x14b427(++_0x1db845);}(_0x52d3,0xbf));var _0x352d=function(_0x1ed9c6,_0x1d1d61){_0x1ed9c6=_0x1ed9c6-0x0;var _0x47f78a=_0x52d3[_0x1ed9c6];return _0x47f78a;};'use strict';var _=require(_0x352d('0x0'));var md5=require('md5');var util=require(_0x352d('0x1'));var Redis=require(_0x352d('0x2'));var config=require(_0x352d('0x3'));config['redis']=_[_0x352d('0x4')](config[_0x352d('0x5')],{'host':_0x352d('0x6'),'port':0x18eb});var io=require(_0x352d('0x7'))(new Redis(config[_0x352d('0x5')]));function MailQueue(_0x527ef1){this['id']=_0x527ef1['id']||0x0;this[_0x352d('0x8')]=_0x527ef1['name']||'';this[_0x352d('0x9')]=_0x527ef1[_0x352d('0x9')]||0xa;this[_0x352d('0xa')]=_0x527ef1[_0x352d('0xa')]||_0x352d('0xb');this['Agents']=_0x527ef1[_0x352d('0xc')];this[_0x352d('0xd')]={};this['waiting']=0x0;this[_0x352d('0xe')]='';this[_0x352d('0xf')]();this[_0x352d('0x10')]();}MailQueue['prototype'][_0x352d('0xf')]=function(){var _0x39750e=this[_0x352d('0xd')][_0x352d('0x11')];this[_0x352d('0xd')]=_[_0x352d('0x12')](this[_0x352d('0xc')],'id');this[_0x352d('0xd')][_0x352d('0x11')]=_0x39750e;};MailQueue['prototype']['updateRealtime']=function(){this[_0x352d('0x13')]=0x0;this[_0x352d('0x14')]=0x0;for(var _0x47d74c=0x0;_0x47d74c=0x0?this[_0x352d('0x17')]:0x0;var _0x4a560c={'id':this['id'],'available':this[_0x352d('0x17')],'loggedIn':this[_0x352d('0x13')],'name':this[_0x352d('0x8')],'paused':this[_0x352d('0x14')],'waiting':this['waiting']};var _0x406af1=md5(JSON['stringify'](_0x4a560c));if(this[_0x352d('0xe')]!==_0x406af1){this[_0x352d('0xe')]=_0x406af1;io['to'](util[_0x352d('0x18')]('mail:queue:%s',_0x4a560c[_0x352d('0x8')]))[_0x352d('0x19')](_0x352d('0x1a'),_0x4a560c);}};module['exports']=MailQueue; \ No newline at end of file +var _0xa568=['defaults','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','map','_rr','paused','Agents','length','online','loggedIn','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','util','ioredis','redis'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa568,0xf4));var _0x8a56=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xa568[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x8a56('0x0'));var md5=require('md5');var util=require(_0x8a56('0x1'));var Redis=require(_0x8a56('0x2'));var config=require('../../../config/environment');config[_0x8a56('0x3')]=_[_0x8a56('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8a56('0x5'))(new Redis(config['redis']));function MailQueue(_0x30cb42){this['id']=_0x30cb42['id']||0x0;this[_0x8a56('0x6')]=_0x30cb42[_0x8a56('0x6')]||'';this[_0x8a56('0x7')]=_0x30cb42['timeout']||0xa;this[_0x8a56('0x8')]=_0x30cb42[_0x8a56('0x8')]||_0x8a56('0x9');this['Agents']=_0x30cb42['Agents'];this[_0x8a56('0xa')]={};this[_0x8a56('0xb')]=0x0;this[_0x8a56('0xc')]='';this[_0x8a56('0xd')]();this[_0x8a56('0xe')]();}MailQueue[_0x8a56('0xf')][_0x8a56('0xd')]=function(){var _0x1dfc68=this[_0x8a56('0xa')]['_rr'];this[_0x8a56('0xa')]=_[_0x8a56('0x10')](this['Agents'],'id');this[_0x8a56('0xa')][_0x8a56('0x11')]=_0x1dfc68;};MailQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x8a56('0x12')]=0x0;for(var _0x9d6edf=0x0;_0x9d6edf=0x0?this[_0x8a56('0x18')]:0x0;var _0x5030e7={'id':this['id'],'available':this[_0x8a56('0x18')],'loggedIn':this[_0x8a56('0x16')],'name':this['name'],'paused':this[_0x8a56('0x12')],'waiting':this[_0x8a56('0xb')]};var _0x5c17c5=md5(JSON[_0x8a56('0x19')](_0x5030e7));if(this[_0x8a56('0xc')]!==_0x5c17c5){this[_0x8a56('0xc')]=_0x5c17c5;io['to'](util[_0x8a56('0x1a')](_0x8a56('0x1b'),_0x5030e7['name']))[_0x8a56('0x1c')](_0x8a56('0x1d'),_0x5030e7);}};module[_0x8a56('0x1e')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 8d1dc21..751077a 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x259d17,_0x220710){var _0x407535=function(_0x49bc38){while(--_0x49bc38){_0x259d17['push'](_0x259d17['shift']());}};_0x407535(++_0x220710);}(_0xadb5,0xad));var _0x5adb=function(_0x1f0f71,_0x4a868d){_0x1f0f71=_0x1f0f71-0x0;var _0x44b992=_0xadb5[_0x1f0f71];return _0x44b992;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0x1261,0x144));var _0x1126=function(_0x2c32fb,_0x45b9a8){_0x2c32fb=_0x2c32fb-0x0;var _0x1f2836=_0x1261[_0x2c32fb];return _0x1f2836;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('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 f7405ef..b994c27 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 _0x6308=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','length','available','paused','stringify','sms:queue:%s','emit','lodash','util'];(function(_0x49beea,_0x47add1){var _0x27693a=function(_0x192ed8){while(--_0x192ed8){_0x49beea['push'](_0x49beea['shift']());}};_0x27693a(++_0x47add1);}(_0x6308,0x1f2));var _0x8630=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x6308[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x8630('0x0'));var md5=require('md5');var util=require(_0x8630('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x8630('0x2')]=_[_0x8630('0x3')](config[_0x8630('0x2')],{'host':_0x8630('0x4'),'port':0x18eb});var io=require(_0x8630('0x5'))(new Redis(config['redis']));function SmsQueue(_0x4b2cfb){this['id']=_0x4b2cfb['id']||0x0;this[_0x8630('0x6')]=_0x4b2cfb['name']||'';this[_0x8630('0x7')]=_0x4b2cfb[_0x8630('0x7')]||0xa;this[_0x8630('0x8')]=_0x4b2cfb[_0x8630('0x8')]||_0x8630('0x9');this[_0x8630('0xa')]=_0x4b2cfb['Agents'];this[_0x8630('0xb')]={};this['waiting']=0x0;this[_0x8630('0xc')]='';this[_0x8630('0xd')]();this[_0x8630('0xe')]();}SmsQueue['prototype'][_0x8630('0xd')]=function(){var _0x2ab523=this[_0x8630('0xb')]['_rr'];this[_0x8630('0xb')]=_[_0x8630('0xf')](this['Agents'],'id');this['mapAgentsId'][_0x8630('0x10')]=_0x2ab523;};SmsQueue[_0x8630('0x11')]['updateRealtime']=function(){this[_0x8630('0x12')]=0x0;this['paused']=0x0;for(var _0xf31c17=0x0;_0xf31c17=0x0?this[_0x8630('0x14')]:0x0;var _0x1304b9={'id':this['id'],'available':this[_0x8630('0x14')],'loggedIn':this[_0x8630('0x12')],'name':this[_0x8630('0x6')],'paused':this[_0x8630('0x15')],'waiting':this['waiting']};var _0x59bda7=md5(JSON[_0x8630('0x16')](_0x1304b9));if(this[_0x8630('0xc')]!==_0x59bda7){this['md5']=_0x59bda7;io['to'](util['format'](_0x8630('0x17'),_0x1304b9[_0x8630('0x6')]))[_0x8630('0x18')]('sms_queue:save',_0x1304b9);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x0506=['mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','smsPause','available','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x273421,_0x1e3e53){var _0x56c6d2=function(_0x14a733){while(--_0x14a733){_0x273421['push'](_0x273421['shift']());}};_0x56c6d2(++_0x1e3e53);}(_0x0506,0x1d1));var _0x6050=function(_0x4feb0b,_0x3fe2ab){_0x4feb0b=_0x4feb0b-0x0;var _0x6319c4=_0x0506[_0x4feb0b];return _0x6319c4;};'use strict';var _=require(_0x6050('0x0'));var md5=require(_0x6050('0x1'));var util=require(_0x6050('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x6050('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x6050('0x4'))(new Redis(config['redis']));function SmsQueue(_0x57de09){this['id']=_0x57de09['id']||0x0;this[_0x6050('0x5')]=_0x57de09[_0x6050('0x5')]||'';this[_0x6050('0x6')]=_0x57de09[_0x6050('0x6')]||0xa;this[_0x6050('0x7')]=_0x57de09[_0x6050('0x7')]||_0x6050('0x8');this[_0x6050('0x9')]=_0x57de09['Agents'];this[_0x6050('0xa')]={};this['waiting']=0x0;this[_0x6050('0x1')]='';this[_0x6050('0xb')]();this[_0x6050('0xc')]();}SmsQueue[_0x6050('0xd')][_0x6050('0xb')]=function(){var _0x1b8d24=this[_0x6050('0xa')][_0x6050('0xe')];this[_0x6050('0xa')]=_[_0x6050('0xf')](this['Agents'],'id');this[_0x6050('0xa')]['_rr']=_0x1b8d24;};SmsQueue[_0x6050('0xd')][_0x6050('0xc')]=function(){this[_0x6050('0x10')]=0x0;this[_0x6050('0x11')]=0x0;for(var _0x4b5503=0x0;_0x4b5503=0x0?this[_0x6050('0x14')]:0x0;var _0x47f33f={'id':this['id'],'available':this[_0x6050('0x14')],'loggedIn':this[_0x6050('0x10')],'name':this[_0x6050('0x5')],'paused':this['paused'],'waiting':this['waiting']};var _0x51b5ea=md5(JSON['stringify'](_0x47f33f));if(this[_0x6050('0x1')]!==_0x51b5ea){this[_0x6050('0x1')]=_0x51b5ea;io['to'](util['format'](_0x6050('0x15'),_0x47f33f[_0x6050('0x5')]))[_0x6050('0x16')](_0x6050('0x17'),_0x47f33f);}};module[_0x6050('0x18')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 02fe4de..de32a77 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 _0x301d=['redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','ioredis','../../../config/environment'];(function(_0x2b12d9,_0x37f8d4){var _0x4eb2bf=function(_0x169e6a){while(--_0x169e6a){_0x2b12d9['push'](_0x2b12d9['shift']());}};_0x4eb2bf(++_0x37f8d4);}(_0x301d,0xaa));var _0xd301=function(_0x1f5630,_0x207b18){_0x1f5630=_0x1f5630-0x0;var _0x56df5a=_0x301d[_0x1f5630];return _0x56df5a;};'use strict';var _=require(_0xd301('0x0'));var md5=require(_0xd301('0x1'));var util=require('util');var Redis=require(_0xd301('0x2'));var config=require(_0xd301('0x3'));config[_0xd301('0x4')]=_[_0xd301('0x5')](config[_0xd301('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xd301('0x6'))(new Redis(config[_0xd301('0x4')]));function WhatsappQueue(_0x2c5374){this['id']=_0x2c5374['id']||0x0;this[_0xd301('0x7')]=_0x2c5374[_0xd301('0x7')]||'';this['timeout']=_0x2c5374[_0xd301('0x8')]||0xa;this['strategy']=_0x2c5374[_0xd301('0x9')]||_0xd301('0xa');this['Agents']=_0x2c5374[_0xd301('0xb')];this['mapAgentsId']={};this[_0xd301('0xc')]=0x0;this[_0xd301('0x1')]='';this[_0xd301('0xd')]();this[_0xd301('0xe')]();}WhatsappQueue[_0xd301('0xf')][_0xd301('0xd')]=function(){var _0x569532=this[_0xd301('0x10')][_0xd301('0x11')];this[_0xd301('0x10')]=_['map'](this[_0xd301('0xb')],'id');this[_0xd301('0x10')]['_rr']=_0x569532;};WhatsappQueue[_0xd301('0xf')][_0xd301('0xe')]=function(){this[_0xd301('0x12')]=0x0;this[_0xd301('0x13')]=0x0;for(var _0x28cc65=0x0;_0x28cc65=0x0?this[_0xd301('0x16')]:0x0;var _0x494149={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd301('0x12')],'name':this[_0xd301('0x7')],'paused':this[_0xd301('0x13')],'waiting':this[_0xd301('0xc')]};var _0x2aac44=md5(JSON[_0xd301('0x17')](_0x494149));if(this['md5']!==_0x2aac44){this[_0xd301('0x1')]=_0x2aac44;io['to'](util[_0xd301('0x18')](_0xd301('0x19'),_0x494149[_0xd301('0x7')]))[_0xd301('0x1a')](_0xd301('0x1b'),_0x494149);}};module[_0xd301('0x1c')]=WhatsappQueue; \ No newline at end of file +var _0x0207=['updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','whatsappPause','paused','available','format','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','md5'];(function(_0x30ef07,_0x129d7d){var _0x104991=function(_0x268f9c){while(--_0x268f9c){_0x30ef07['push'](_0x30ef07['shift']());}};_0x104991(++_0x129d7d);}(_0x0207,0x11c));var _0x7020=function(_0x561e73,_0x13a224){_0x561e73=_0x561e73-0x0;var _0x2dc60d=_0x0207[_0x561e73];return _0x2dc60d;};'use strict';var _=require(_0x7020('0x0'));var md5=require('md5');var util=require(_0x7020('0x1'));var Redis=require('ioredis');var config=require(_0x7020('0x2'));config[_0x7020('0x3')]=_[_0x7020('0x4')](config[_0x7020('0x3')],{'host':_0x7020('0x5'),'port':0x18eb});var io=require(_0x7020('0x6'))(new Redis(config[_0x7020('0x3')]));function WhatsappQueue(_0xc456f6){this['id']=_0xc456f6['id']||0x0;this[_0x7020('0x7')]=_0xc456f6[_0x7020('0x7')]||'';this[_0x7020('0x8')]=_0xc456f6[_0x7020('0x8')]||0xa;this[_0x7020('0x9')]=_0xc456f6['strategy']||'beepall';this[_0x7020('0xa')]=_0xc456f6['Agents'];this['mapAgentsId']={};this[_0x7020('0xb')]=0x0;this[_0x7020('0xc')]='';this[_0x7020('0xd')]();this[_0x7020('0xe')]();}WhatsappQueue[_0x7020('0xf')][_0x7020('0xd')]=function(){var _0x5b5bc8=this[_0x7020('0x10')][_0x7020('0x11')];this['mapAgentsId']=_[_0x7020('0x12')](this[_0x7020('0xa')],'id');this['mapAgentsId'][_0x7020('0x11')]=_0x5b5bc8;};WhatsappQueue[_0x7020('0xf')][_0x7020('0xe')]=function(){this[_0x7020('0x13')]=0x0;this['paused']=0x0;for(var _0x27827f=0x0;_0x27827f=0x0?this['available']:0x0;var _0x1e2cd4={'id':this['id'],'available':this[_0x7020('0x16')],'loggedIn':this[_0x7020('0x13')],'name':this[_0x7020('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x4d42e3=md5(JSON['stringify'](_0x1e2cd4));if(this['md5']!==_0x4d42e3){this[_0x7020('0xc')]=_0x4d42e3;io['to'](util[_0x7020('0x17')](_0x7020('0x18'),_0x1e2cd4['name']))['emit'](_0x7020('0x19'),_0x1e2cd4);}};module[_0x7020('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index a217247..9cfba10 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index cf13046..994b469 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 _0x9f9b=['addTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x361cf8,_0x2d61b1){var _0x3e13aa=function(_0x258c58){while(--_0x258c58){_0x361cf8['push'](_0x361cf8['shift']());}};_0x3e13aa(++_0x2d61b1);}(_0x9f9b,0x1d7));var _0xb9f9=function(_0x1ed873,_0xb1b8e4){_0x1ed873=_0x1ed873-0x0;var _0x19acf8=_0x9f9b[_0x1ed873];return _0x19acf8;};'use strict';var client=require(_0xb9f9('0x0'));exports['update']=function(_0x522229,_0x15c564){return client[_0xb9f9('0x1')](_0xb9f9('0x2'),{'body':_0x15c564,'options':{'where':{'id':_0x522229}},'log':_0xb9f9('0x3')});};exports['addTags']=function(_0x29e1f4,_0x52589e){return client[_0xb9f9('0x1')]('AddTagsToChatInteraction',{'body':_0x52589e,'options':{'where':{'id':_0x29e1f4}},'log':_0xb9f9('0x4')});}; \ No newline at end of file +var _0x6700=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','updateChatInteraction','addTags'];(function(_0x57ffa3,_0x4674fd){var _0xcb184b=function(_0x67884a){while(--_0x67884a){_0x57ffa3['push'](_0x57ffa3['shift']());}};_0xcb184b(++_0x4674fd);}(_0x6700,0x9c));var _0x0670=function(_0x143cc5,_0x351b79){_0x143cc5=_0x143cc5-0x0;var _0x3f7ee3=_0x6700[_0x143cc5];return _0x3f7ee3;};'use strict';var client=require(_0x0670('0x0'));exports[_0x0670('0x1')]=function(_0x1fd1bb,_0x5862af){return client[_0x0670('0x2')]('UpdateChatInteraction',{'body':_0x5862af,'options':{'where':{'id':_0x1fd1bb}},'log':_0x0670('0x3')});};exports[_0x0670('0x4')]=function(_0x568bb3,_0x127acd){return client[_0x0670('0x2')](_0x0670('0x5'),{'body':_0x127acd,'options':{'where':{'id':_0x568bb3}},'log':_0x0670('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 6692323..9d3a980 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 _0x9d5d=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x3b90ab,_0x174a22){var _0x206e92=function(_0x21fbd3){while(--_0x21fbd3){_0x3b90ab['push'](_0x3b90ab['shift']());}};_0x206e92(++_0x174a22);}(_0x9d5d,0x8e));var _0xd9d5=function(_0x13f10f,_0x54f409){_0x13f10f=_0x13f10f-0x0;var _0x2a9eda=_0x9d5d[_0x13f10f];return _0x2a9eda;};'use strict';var client=require(_0xd9d5('0x0'));exports[_0xd9d5('0x1')]=function(_0x3c245a){return client[_0xd9d5('0x2')](_0xd9d5('0x3'),{'body':_0x3c245a,'log':_0xd9d5('0x4')});}; \ No newline at end of file +var _0xef0c=['createChatMessage','../client','Request','CreateChatMessage'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0xef0c,0xf9));var _0xcef0=function(_0xcf65e5,_0x3f3bb8){_0xcf65e5=_0xcf65e5-0x0;var _0x2d00d5=_0xef0c[_0xcf65e5];return _0x2d00d5;};'use strict';var client=require(_0xcef0('0x0'));exports['create']=function(_0x4793ad){return client[_0xcef0('0x1')](_0xcef0('0x2'),{'body':_0x4793ad,'log':_0xcef0('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 876367f..df8df55 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 _0x24ca=['User','name','online','chatPause','../client','GetChatQueue','timeout','strategy'];(function(_0xadde88,_0x58ad47){var _0x3b8eb6=function(_0x15535a){while(--_0x15535a){_0xadde88['push'](_0xadde88['shift']());}};_0x3b8eb6(++_0x58ad47);}(_0x24ca,0x8c));var _0xa24c=function(_0x5e9d35,_0x382c91){_0x5e9d35=_0x5e9d35-0x0;var _0x3beb2e=_0x24ca[_0x5e9d35];return _0x3beb2e;};'use strict';var client=require(_0xa24c('0x0'));exports['getChatQueues']=function(){return function(){return client['Request'](_0xa24c('0x1'),{'options':{'raw':![],'attributes':['id','name',_0xa24c('0x2'),_0xa24c('0x3')],'include':[{'model':_0xa24c('0x4'),'as':'Agents','attributes':['id',_0xa24c('0x5'),_0xa24c('0x6'),_0xa24c('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xb13b=['chatPause','../client','getChatQueues','Request','GetChatQueue','name','strategy','User','online'];(function(_0x1d03eb,_0x4a43fe){var _0x4285e4=function(_0x2899d1){while(--_0x2899d1){_0x1d03eb['push'](_0x1d03eb['shift']());}};_0x4285e4(++_0x4a43fe);}(_0xb13b,0x1de));var _0xbb13=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xb13b[_0x4c12ec];return _0x3ae42c;};'use strict';var client=require(_0xbb13('0x0'));exports[_0xbb13('0x1')]=function(){return function(){return client[_0xbb13('0x2')](_0xbb13('0x3'),{'options':{'raw':![],'attributes':['id',_0xbb13('0x4'),'timeout',_0xbb13('0x5')],'include':[{'model':_0xbb13('0x6'),'as':'Agents','attributes':['id',_0xbb13('0x4'),_0xbb13('0x7'),_0xbb13('0x8')]}]},'log':_0xbb13('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 2e91193..3154aff 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 _0xdfcc=['UpdateChatQueueReport','../client','create','CreateChatQueueReport','update'];(function(_0x4bf1e7,_0x31069d){var _0x29c5e5=function(_0x5abbd0){while(--_0x5abbd0){_0x4bf1e7['push'](_0x4bf1e7['shift']());}};_0x29c5e5(++_0x31069d);}(_0xdfcc,0x8d));var _0xcdfc=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0xdfcc[_0x421cf8];return _0x145c48;};'use strict';var client=require(_0xcdfc('0x0'));exports[_0xcdfc('0x1')]=function(_0x17f69b){return client['Request'](_0xcdfc('0x2'),{'body':_0x17f69b,'log':_0xcdfc('0x2')});};exports[_0xcdfc('0x3')]=function(_0x4aef49,_0x468275){return client['Request']('UpdateChatQueueReport',{'body':_0x468275,'options':{'where':{'uniqueid':_0x4aef49},'order':[['id','DESC']],'limit':0x1},'log':_0xcdfc('0x4')});}; \ No newline at end of file +var _0x0487=['create','Request','CreateChatQueueReport','UpdateChatQueueReport','DESC','../client'];(function(_0x1e7581,_0x25526e){var _0x51ad01=function(_0x19be2c){while(--_0x19be2c){_0x1e7581['push'](_0x1e7581['shift']());}};_0x51ad01(++_0x25526e);}(_0x0487,0x14f));var _0x7048=function(_0x7a3247,_0x15cb12){_0x7a3247=_0x7a3247-0x0;var _0x1bfde5=_0x0487[_0x7a3247];return _0x1bfde5;};'use strict';var client=require(_0x7048('0x0'));exports[_0x7048('0x1')]=function(_0x438ba4){return client[_0x7048('0x2')](_0x7048('0x3'),{'body':_0x438ba4,'log':_0x7048('0x3')});};exports['update']=function(_0x2adc11,_0x4e8f94){return client[_0x7048('0x2')](_0x7048('0x4'),{'body':_0x4e8f94,'options':{'where':{'uniqueid':_0x2adc11},'order':[['id',_0x7048('0x5')]],'limit':0x1},'log':_0x7048('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index aedaab8..bce80c3 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(_0x3ace8,_0x4bf514){var _0x4968d3=function(_0x2c7386){while(--_0x2c7386){_0x3ace8['push'](_0x3ace8['shift']());}};_0x4968d3(++_0x4bf514);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x1ee7e4,_0x4ba132){var _0x4a99aa=function(_0x115d2d){while(--_0x115d2d){_0x1ee7e4['push'](_0x1ee7e4['shift']());}};_0x4a99aa(++_0x4ba132);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 4fd9575..4777723 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 _0x810a=['Request','CreateFaxMessage','create'];(function(_0x3b9b15,_0x25c082){var _0x70ac5e=function(_0x41681f){while(--_0x41681f){_0x3b9b15['push'](_0x3b9b15['shift']());}};_0x70ac5e(++_0x25c082);}(_0x810a,0xe3));var _0xa810=function(_0x194a96,_0x2a4317){_0x194a96=_0x194a96-0x0;var _0x5474cc=_0x810a[_0x194a96];return _0x5474cc;};'use strict';var client=require('../client');exports[_0xa810('0x0')]=function(_0x1bb608){return client[_0xa810('0x1')](_0xa810('0x2'),{'body':_0x1bb608,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x9594=['create','Request','CreateFaxMessage','../client'];(function(_0x28094e,_0x177dea){var _0x391994=function(_0x5a9b1a){while(--_0x5a9b1a){_0x28094e['push'](_0x28094e['shift']());}};_0x391994(++_0x177dea);}(_0x9594,0x16b));var _0x4959=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9594[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0x4959('0x0'));exports[_0x4959('0x1')]=function(_0xeaec5e){return client[_0x4959('0x2')](_0x4959('0x3'),{'body':_0xeaec5e,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 2ef6349..3202770 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 _0xe09c=['strategy','User','Agents','faxPause','getFaxQueues','../client','Request','name'];(function(_0x556bca,_0x573fb9){var _0x16c8fd=function(_0x469625){while(--_0x469625){_0x556bca['push'](_0x556bca['shift']());}};_0x16c8fd(++_0x573fb9);}(_0xe09c,0xc5));var _0xce09=function(_0x353650,_0x317a8b){_0x353650=_0x353650-0x0;var _0x23c59b=_0xe09c[_0x353650];return _0x23c59b;};'use strict';var client=require(_0xce09('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xce09('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xce09('0x2'),'timeout',_0xce09('0x3')],'include':[{'model':_0xce09('0x4'),'as':_0xce09('0x5'),'attributes':['id',_0xce09('0x2'),'online',_0xce09('0x6')]}]},'log':_0xce09('0x7')});};}; \ No newline at end of file +var _0xcd78=['GetFaxQueue','name','timeout','strategy','online','faxPause','../client'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xcd78,0xd1));var _0x8cd7=function(_0x1ac052,_0x3f8942){_0x1ac052=_0x1ac052-0x0;var _0x17dfe7=_0xcd78[_0x1ac052];return _0x17dfe7;};'use strict';var client=require(_0x8cd7('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request'](_0x8cd7('0x1'),{'options':{'raw':![],'attributes':['id',_0x8cd7('0x2'),_0x8cd7('0x3'),_0x8cd7('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x8cd7('0x2'),_0x8cd7('0x5'),_0x8cd7('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 2e7c890..e2c5474 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 _0x5dca=['CreateFaxQueueReport','update','Request','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x4cebba,_0x53404b){var _0x5f2ff4=function(_0x47124f){while(--_0x47124f){_0x4cebba['push'](_0x4cebba['shift']());}};_0x5f2ff4(++_0x53404b);}(_0x5dca,0x91));var _0xa5dc=function(_0x1b3909,_0xda87a0){_0x1b3909=_0x1b3909-0x0;var _0x3587a3=_0x5dca[_0x1b3909];return _0x3587a3;};'use strict';var client=require(_0xa5dc('0x0'));exports[_0xa5dc('0x1')]=function(_0x33c32b){return client['Request'](_0xa5dc('0x2'),{'body':_0x33c32b,'log':_0xa5dc('0x2')});};exports[_0xa5dc('0x3')]=function(_0x5b23bf,_0x57c9ad){return client[_0xa5dc('0x4')](_0xa5dc('0x5'),{'body':_0x57c9ad,'options':{'where':{'uniqueid':_0x5b23bf},'order':[['id',_0xa5dc('0x6')]],'limit':0x1},'log':_0xa5dc('0x5')});}; \ No newline at end of file +var _0x45b2=['DESC','../client','Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x45b2,0x74));var _0x245b=function(_0x44b8a3,_0x368322){_0x44b8a3=_0x44b8a3-0x0;var _0x16d299=_0x45b2[_0x44b8a3];return _0x16d299;};'use strict';var client=require(_0x245b('0x0'));exports['create']=function(_0x1788cc){return client[_0x245b('0x1')](_0x245b('0x2'),{'body':_0x1788cc,'log':_0x245b('0x2')});};exports['update']=function(_0x592412,_0x34db89){return client[_0x245b('0x1')](_0x245b('0x3'),{'body':_0x34db89,'options':{'where':{'uniqueid':_0x592412},'order':[['id',_0x245b('0x4')]],'limit':0x1},'log':_0x245b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 2571297..38f5386 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 _0xc813=['interval','../client','getIntervals','Request','GetInterval','name','Interval'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc813,0x151));var _0x3c81=function(_0xd034c8,_0x4b5fbe){_0xd034c8=_0xd034c8-0x0;var _0x37c283=_0xc813[_0xd034c8];return _0x37c283;};'use strict';var client=require(_0x3c81('0x0'));exports[_0x3c81('0x1')]=function(){return function(){return client[_0x3c81('0x2')](_0x3c81('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x3c81('0x4')],'include':[{'model':_0x3c81('0x5'),'as':'Intervals','attributes':['id',_0x3c81('0x4'),_0x3c81('0x6')]}]},'log':_0x3c81('0x1')});};}; \ No newline at end of file +var _0xd627=['Intervals','name','interval','../client','getIntervals','Request','Interval'];(function(_0x5c33ed,_0x4ae91e){var _0x51adfb=function(_0x3f7c90){while(--_0x3f7c90){_0x5c33ed['push'](_0x5c33ed['shift']());}};_0x51adfb(++_0x4ae91e);}(_0xd627,0x9d));var _0x7d62=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xd627[_0x38a7ac];return _0x53061a;};'use strict';var client=require(_0x7d62('0x0'));exports[_0x7d62('0x1')]=function(){return function(){return client[_0x7d62('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x7d62('0x3'),'as':_0x7d62('0x4'),'attributes':['id',_0x7d62('0x5'),_0x7d62('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 3660501..b00bbab 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 _0xb03e=['addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x97be08,_0x2fd4a5){var _0x89f1ac=function(_0x575795){while(--_0x575795){_0x97be08['push'](_0x97be08['shift']());}};_0x89f1ac(++_0x2fd4a5);}(_0xb03e,0x1eb));var _0xeb03=function(_0x16cabd,_0x5ca4f7){_0x16cabd=_0x16cabd-0x0;var _0x74ede5=_0xb03e[_0x16cabd];return _0x74ede5;};'use strict';var client=require('../client');exports[_0xeb03('0x0')]=function(_0x399504,_0x868905){return client[_0xeb03('0x1')](_0xeb03('0x2'),{'body':_0x868905,'options':{'where':{'id':_0x399504}},'log':_0xeb03('0x3')});};exports[_0xeb03('0x4')]=function(_0x1fe650,_0x474450){return client[_0xeb03('0x1')](_0xeb03('0x5'),{'body':_0x474450,'options':{'where':{'id':_0x1fe650}},'log':_0xeb03('0x6')});}; \ No newline at end of file +var _0xb10b=['updateMailInteraction','addTags','AddTagsToMailInteraction','../client','Request'];(function(_0x390d52,_0x2163ca){var _0x7b6925=function(_0x412d47){while(--_0x412d47){_0x390d52['push'](_0x390d52['shift']());}};_0x7b6925(++_0x2163ca);}(_0xb10b,0x12a));var _0xbb10=function(_0x4fb930,_0x4141c4){_0x4fb930=_0x4fb930-0x0;var _0x59adc4=_0xb10b[_0x4fb930];return _0x59adc4;};'use strict';var client=require(_0xbb10('0x0'));exports['update']=function(_0x390ae2,_0x35bc5f){return client[_0xbb10('0x1')]('UpdateMailInteraction',{'body':_0x35bc5f,'options':{'where':{'id':_0x390ae2}},'log':_0xbb10('0x2')});};exports[_0xbb10('0x3')]=function(_0x460981,_0x22320e){return client[_0xbb10('0x1')](_0xbb10('0x4'),{'body':_0x22320e,'options':{'where':{'id':_0x460981}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 1c2291d..66fddbb 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 _0x6b95=['CreateMailMessage','createMailMessage','create','Request'];(function(_0x3fc0b2,_0x5466d6){var _0x43aaef=function(_0x147b3e){while(--_0x147b3e){_0x3fc0b2['push'](_0x3fc0b2['shift']());}};_0x43aaef(++_0x5466d6);}(_0x6b95,0x12a));var _0x56b9=function(_0x263688,_0x176660){_0x263688=_0x263688-0x0;var _0x567b80=_0x6b95[_0x263688];return _0x567b80;};'use strict';var client=require('../client');exports[_0x56b9('0x0')]=function(_0x3ab631){return client[_0x56b9('0x1')](_0x56b9('0x2'),{'body':_0x3ab631,'log':_0x56b9('0x3')});}; \ No newline at end of file +var _0xb214=['createMailMessage','CreateMailMessage'];(function(_0x4cd21c,_0x35fa45){var _0x5d8e5e=function(_0x3af223){while(--_0x3af223){_0x4cd21c['push'](_0x4cd21c['shift']());}};_0x5d8e5e(++_0x35fa45);}(_0xb214,0xa1));var _0x4b21=function(_0x1dd42c,_0x1dd8e6){_0x1dd42c=_0x1dd42c-0x0;var _0x540a79=_0xb214[_0x1dd42c];return _0x540a79;};'use strict';var client=require('../client');exports['create']=function(_0x50bf60){return client['Request'](_0x4b21('0x0'),{'body':_0x50bf60,'log':_0x4b21('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 8586fe9..f96008b 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 _0x34b6=['online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','strategy','User'];(function(_0x501191,_0x3b2369){var _0x45d372=function(_0x45ac66){while(--_0x45ac66){_0x501191['push'](_0x501191['shift']());}};_0x45d372(++_0x3b2369);}(_0x34b6,0x1e8));var _0x634b=function(_0xfe475c,_0x2edb32){_0xfe475c=_0xfe475c-0x0;var _0x5283b1=_0x34b6[_0xfe475c];return _0x5283b1;};'use strict';var client=require(_0x634b('0x0'));exports[_0x634b('0x1')]=function(){return function(){return client[_0x634b('0x2')](_0x634b('0x3'),{'options':{'raw':![],'attributes':['id',_0x634b('0x4'),'timeout',_0x634b('0x5')],'include':[{'model':_0x634b('0x6'),'as':'Agents','attributes':['id',_0x634b('0x4'),_0x634b('0x7'),_0x634b('0x8')]}]},'log':_0x634b('0x1')});};}; \ No newline at end of file +var _0xff75=['Agents','mailPause','../client','getMailQueues','Request','name','User'];(function(_0x361e80,_0x21c8dd){var _0x3c2f1f=function(_0x10df70){while(--_0x10df70){_0x361e80['push'](_0x361e80['shift']());}};_0x3c2f1f(++_0x21c8dd);}(_0xff75,0xbf));var _0x5ff7=function(_0x1b38ae,_0x34ab64){_0x1b38ae=_0x1b38ae-0x0;var _0x43a0c4=_0xff75[_0x1b38ae];return _0x43a0c4;};'use strict';var client=require(_0x5ff7('0x0'));exports[_0x5ff7('0x1')]=function(){return function(){return client[_0x5ff7('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x5ff7('0x3'),'timeout','strategy'],'include':[{'model':_0x5ff7('0x4'),'as':_0x5ff7('0x5'),'attributes':['id',_0x5ff7('0x3'),'online',_0x5ff7('0x6')]}]},'log':_0x5ff7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index b417c78..86be430 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 _0xa158=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x8b6d38,_0x431b05){var _0x21bf33=function(_0x12baa1){while(--_0x12baa1){_0x8b6d38['push'](_0x8b6d38['shift']());}};_0x21bf33(++_0x431b05);}(_0xa158,0x1ab));var _0x8a15=function(_0x414e24,_0xdc503b){_0x414e24=_0x414e24-0x0;var _0x26d31d=_0xa158[_0x414e24];return _0x26d31d;};'use strict';var client=require(_0x8a15('0x0'));exports[_0x8a15('0x1')]=function(_0x389e22){return client[_0x8a15('0x2')](_0x8a15('0x3'),{'body':_0x389e22,'log':'CreateMailQueueReport'});};exports[_0x8a15('0x4')]=function(_0x9ada5d,_0x597b0a){return client[_0x8a15('0x2')](_0x8a15('0x5'),{'body':_0x597b0a,'options':{'where':{'uniqueid':_0x9ada5d},'order':[['id',_0x8a15('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0xc4ef=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','create','Request'];(function(_0x195376,_0x171aff){var _0x44480e=function(_0x2b4eb1){while(--_0x2b4eb1){_0x195376['push'](_0x195376['shift']());}};_0x44480e(++_0x171aff);}(_0xc4ef,0x19c));var _0xfc4e=function(_0x680821,_0x23e67f){_0x680821=_0x680821-0x0;var _0x3f132c=_0xc4ef[_0x680821];return _0x3f132c;};'use strict';var client=require('../client');exports[_0xfc4e('0x0')]=function(_0x33b3b3){return client[_0xfc4e('0x1')]('CreateMailQueueReport',{'body':_0x33b3b3,'log':_0xfc4e('0x2')});};exports[_0xfc4e('0x3')]=function(_0x2b24db,_0x1ca279){return client[_0xfc4e('0x1')](_0xfc4e('0x4'),{'body':_0x1ca279,'options':{'where':{'uniqueid':_0x2b24db},'order':[['id',_0xfc4e('0x5')]],'limit':0x1},'log':_0xfc4e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 6dc8ad7..1da3992 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 _0x33dd=['UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x2d32bf,_0x58f912){var _0x6c40e7=function(_0x2ead6c){while(--_0x2ead6c){_0x2d32bf['push'](_0x2d32bf['shift']());}};_0x6c40e7(++_0x58f912);}(_0x33dd,0x17d));var _0xd33d=function(_0x2e51c8,_0x2cadc0){_0x2e51c8=_0x2e51c8-0x0;var _0x1692fd=_0x33dd[_0x2e51c8];return _0x1692fd;};'use strict';var client=require(_0xd33d('0x0'));exports[_0xd33d('0x1')]=function(_0xac8d92,_0x5f21e5){return client[_0xd33d('0x2')](_0xd33d('0x3'),{'body':_0x5f21e5,'options':{'where':{'id':_0xac8d92}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x2f1c5a,_0x310fa8){return client[_0xd33d('0x2')](_0xd33d('0x4'),{'body':_0x310fa8,'options':{'where':{'id':_0x2f1c5a}},'log':_0xd33d('0x5')});}; \ No newline at end of file +var _0x7486=['AddTagsToOpenchannelInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x142ae8,_0x2c93d0){var _0x4379bd=function(_0x2ddcbf){while(--_0x2ddcbf){_0x142ae8['push'](_0x142ae8['shift']());}};_0x4379bd(++_0x2c93d0);}(_0x7486,0x166));var _0x6748=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7486[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x6748('0x0'));exports[_0x6748('0x1')]=function(_0x41fdb3,_0x3c85d5){return client[_0x6748('0x2')](_0x6748('0x3'),{'body':_0x3c85d5,'options':{'where':{'id':_0x41fdb3}},'log':_0x6748('0x4')});};exports[_0x6748('0x5')]=function(_0x51824c,_0x26d93b){return client[_0x6748('0x2')](_0x6748('0x6'),{'body':_0x26d93b,'options':{'where':{'id':_0x51824c}},'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 13a033c..b9f55bd 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 _0x3b02=['Request','createOpenchannelMessage','../client','create'];(function(_0x15558f,_0x195496){var _0x535be9=function(_0x3a8302){while(--_0x3a8302){_0x15558f['push'](_0x15558f['shift']());}};_0x535be9(++_0x195496);}(_0x3b02,0x8a));var _0x23b0=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x3b02[_0x110c3d];return _0x226d67;};'use strict';var client=require(_0x23b0('0x0'));exports[_0x23b0('0x1')]=function(_0x5068c6){return client[_0x23b0('0x2')]('CreateOpenchannelMessage',{'body':_0x5068c6,'log':_0x23b0('0x3')});}; \ No newline at end of file +var _0x5832=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0x5832,0x1d2));var _0x2583=function(_0x33fcbb,_0x291d0f){_0x33fcbb=_0x33fcbb-0x0;var _0x2efe40=_0x5832[_0x33fcbb];return _0x2efe40;};'use strict';var client=require(_0x2583('0x0'));exports[_0x2583('0x1')]=function(_0x28dfa8){return client[_0x2583('0x2')](_0x2583('0x3'),{'body':_0x28dfa8,'log':_0x2583('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index d445cc6..f004830 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 _0xc7ff=['GetOpenchannelQueue','name','Agents','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x486a95,_0x18bed7){var _0x1cc0ec=function(_0x53a230){while(--_0x53a230){_0x486a95['push'](_0x486a95['shift']());}};_0x1cc0ec(++_0x18bed7);}(_0xc7ff,0x15c));var _0xfc7f=function(_0x51708f,_0x511834){_0x51708f=_0x51708f-0x0;var _0x5c60a3=_0xc7ff[_0x51708f];return _0x5c60a3;};'use strict';var client=require(_0xfc7f('0x0'));exports[_0xfc7f('0x1')]=function(){return function(){return client['Request'](_0xfc7f('0x2'),{'options':{'raw':![],'attributes':['id',_0xfc7f('0x3'),'timeout','strategy'],'include':[{'model':'User','as':_0xfc7f('0x4'),'attributes':['id',_0xfc7f('0x3'),_0xfc7f('0x5'),_0xfc7f('0x6')]}]},'log':_0xfc7f('0x1')});};}; \ No newline at end of file +var _0xc7b1=['../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','Agents','online','openchannelPause'];(function(_0x48d867,_0x9da3f6){var _0x299b6d=function(_0x16e73d){while(--_0x16e73d){_0x48d867['push'](_0x48d867['shift']());}};_0x299b6d(++_0x9da3f6);}(_0xc7b1,0x154));var _0x1c7b=function(_0x5c6022,_0x5cd10b){_0x5c6022=_0x5c6022-0x0;var _0x4ab5af=_0xc7b1[_0x5c6022];return _0x4ab5af;};'use strict';var client=require(_0x1c7b('0x0'));exports[_0x1c7b('0x1')]=function(){return function(){return client[_0x1c7b('0x2')](_0x1c7b('0x3'),{'options':{'raw':![],'attributes':['id',_0x1c7b('0x4'),_0x1c7b('0x5'),_0x1c7b('0x6')],'include':[{'model':'User','as':_0x1c7b('0x7'),'attributes':['id',_0x1c7b('0x4'),_0x1c7b('0x8'),_0x1c7b('0x9')]}]},'log':_0x1c7b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index aa87181..b0afc8d 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 _0x0047=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x0047,0x197));var _0x7004=function(_0x1551af,_0x5223c3){_0x1551af=_0x1551af-0x0;var _0xd8eb82=_0x0047[_0x1551af];return _0xd8eb82;};'use strict';var client=require(_0x7004('0x0'));exports[_0x7004('0x1')]=function(_0xe16f51){return client[_0x7004('0x2')](_0x7004('0x3'),{'body':_0xe16f51,'log':_0x7004('0x3')});};exports[_0x7004('0x4')]=function(_0x5defe7,_0x14b99c){return client['Request'](_0x7004('0x5'),{'body':_0x14b99c,'options':{'where':{'uniqueid':_0x5defe7},'order':[['id','DESC']],'limit':0x1},'log':_0x7004('0x5')});}; \ No newline at end of file +var _0x6a6f=['update','UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x33aa90,_0xfcb0d6){var _0xbe389b=function(_0x5d649d){while(--_0x5d649d){_0x33aa90['push'](_0x33aa90['shift']());}};_0xbe389b(++_0xfcb0d6);}(_0x6a6f,0x129));var _0xf6a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a6f[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xf6a6('0x0'));exports[_0xf6a6('0x1')]=function(_0x51ac51){return client[_0xf6a6('0x2')](_0xf6a6('0x3'),{'body':_0x51ac51,'log':_0xf6a6('0x3')});};exports[_0xf6a6('0x4')]=function(_0x2517bf,_0x16650c){return client[_0xf6a6('0x2')](_0xf6a6('0x5'),{'body':_0x16650c,'options':{'where':{'uniqueid':_0x2517bf},'order':[['id',_0xf6a6('0x6')]],'limit':0x1},'log':_0xf6a6('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 3c7296a..4a36dbd 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 _0xf725=['Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf725,0x7e));var _0x5f72=function(_0x27ef8b,_0x5d1198){_0x27ef8b=_0x27ef8b-0x0;var _0x393fab=_0xf725[_0x27ef8b];return _0x393fab;};'use strict';var client=require(_0x5f72('0x0'));exports[_0x5f72('0x1')]=function(_0x3fb132,_0x3ccab6){return client[_0x5f72('0x2')](_0x5f72('0x3'),{'body':_0x3ccab6,'options':{'where':{'id':_0x3fb132}},'log':_0x5f72('0x4')});};exports[_0x5f72('0x5')]=function(_0x4200ff,_0x17a5bc){return client['Request'](_0x5f72('0x6'),{'body':_0x17a5bc,'options':{'where':{'id':_0x4200ff}},'log':_0x5f72('0x7')});}; \ No newline at end of file +var _0xf569=['UpdateSmsInteraction','updateSmsInteraction','addTags','addTagsToSmsInteraction','update','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf569,0xd0));var _0x9f56=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf569[_0xfae23b];return _0x200640;};'use strict';var client=require('../client');exports[_0x9f56('0x0')]=function(_0x301a18,_0x156de2){return client[_0x9f56('0x1')](_0x9f56('0x2'),{'body':_0x156de2,'options':{'where':{'id':_0x301a18}},'log':_0x9f56('0x3')});};exports[_0x9f56('0x4')]=function(_0x6d506b,_0x5bc3e8){return client[_0x9f56('0x1')]('AddTagsToSmsInteraction',{'body':_0x5bc3e8,'options':{'where':{'id':_0x6d506b}},'log':_0x9f56('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index d4897a0..ef29106 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 _0x87c7=['Request','CreateSmsMessage'];(function(_0x1ee3e0,_0x275a58){var _0x5ac3f3=function(_0x541001){while(--_0x541001){_0x1ee3e0['push'](_0x1ee3e0['shift']());}};_0x5ac3f3(++_0x275a58);}(_0x87c7,0x17c));var _0x787c=function(_0x29243c,_0x2650e6){_0x29243c=_0x29243c-0x0;var _0x563a85=_0x87c7[_0x29243c];return _0x563a85;};'use strict';var client=require('../client');exports['create']=function(_0xfc590b){return client[_0x787c('0x0')](_0x787c('0x1'),{'body':_0xfc590b,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x200a=['../client','Request','createSmsMessage'];(function(_0x549b29,_0x2e2b00){var _0x2b813f=function(_0x43234f){while(--_0x43234f){_0x549b29['push'](_0x549b29['shift']());}};_0x2b813f(++_0x2e2b00);}(_0x200a,0x1cb));var _0xa200=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x200a[_0x4b2436];return _0x4f5ab2;};'use strict';var client=require(_0xa200('0x0'));exports['create']=function(_0x4c250b){return client[_0xa200('0x1')]('CreateSmsMessage',{'body':_0x4c250b,'log':_0xa200('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 1d0257e..72bc7d3 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['smsPause','Request','GetSmsQueue','name','timeout','User','Agents','online'];(function(_0x2fb182,_0x37fa01){var _0x4cb6e5=function(_0x2cc557){while(--_0x2cc557){_0x2fb182['push'](_0x2fb182['shift']());}};_0x4cb6e5(++_0x37fa01);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0xcb91[_0x25701b];return _0x3a8a2c;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'attributes':['id',_0x1cb9('0x2'),_0x1cb9('0x3'),'strategy'],'include':[{'model':_0x1cb9('0x4'),'as':_0x1cb9('0x5'),'attributes':['id','name',_0x1cb9('0x6'),_0x1cb9('0x7')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x3ad737,_0x300131){var _0x16c1e2=function(_0x4c64fe){while(--_0x4c64fe){_0x3ad737['push'](_0x3ad737['shift']());}};_0x16c1e2(++_0x300131);}(_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 13769ed..e80cebd 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 _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x3211fe,_0x61867f){var _0x20b1db=function(_0x21ee72){while(--_0x21ee72){_0x3211fe['push'](_0x3211fe['shift']());}};_0x20b1db(++_0x61867f);}(_0x70e0,0x17b));var _0x070e=function(_0x486d0d,_0x316819){_0x486d0d=_0x486d0d-0x0;var _0x2d4ab6=_0x70e0[_0x486d0d];return _0x2d4ab6;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x125e90,_0x3c35e6){var _0xa92a7a=function(_0x450c51){while(--_0x450c51){_0x125e90['push'](_0x125e90['shift']());}};_0xa92a7a(++_0x3c35e6);}(_0x55ca,0x126));var _0xa55c=function(_0x47e3f8,_0x517bcd){_0x47e3f8=_0x47e3f8-0x0;var _0x4742d5=_0x55ca[_0x47e3f8];return _0x4742d5;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index e8c3825..9ed72ee 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(_0x5222b8,_0x43abbb){var _0xa43611=function(_0x1a5d3f){while(--_0x1a5d3f){_0x5222b8['push'](_0x5222b8['shift']());}};_0xa43611(++_0x43abbb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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(_0x836efa,_0x57e325){var _0x4c7a83=function(_0x53f7e7){while(--_0x53f7e7){_0x836efa['push'](_0x836efa['shift']());}};_0x4c7a83(++_0x57e325);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 808b1b9..17d78fc 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 _0x1298=['addTagsToWhatsappInteraction','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x30caa8,_0x5d1091){var _0x3f13a5=function(_0x7b4034){while(--_0x7b4034){_0x30caa8['push'](_0x30caa8['shift']());}};_0x3f13a5(++_0x5d1091);}(_0x1298,0x19e));var _0x8129=function(_0x4758b5,_0x36820f){_0x4758b5=_0x4758b5-0x0;var _0x3e16b9=_0x1298[_0x4758b5];return _0x3e16b9;};'use strict';var client=require('../client');exports[_0x8129('0x0')]=function(_0x58aec7,_0x2a138c){return client[_0x8129('0x1')](_0x8129('0x2'),{'body':_0x2a138c,'options':{'where':{'id':_0x58aec7}},'log':_0x8129('0x3')});};exports[_0x8129('0x4')]=function(_0x31d02a,_0x39e214){return client['Request'](_0x8129('0x5'),{'body':_0x39e214,'options':{'where':{'id':_0x31d02a}},'log':_0x8129('0x6')});}; \ No newline at end of file +var _0xcf71=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request'];(function(_0x30625d,_0xf3fac8){var _0x5845b4=function(_0x3091bb){while(--_0x3091bb){_0x30625d['push'](_0x30625d['shift']());}};_0x5845b4(++_0xf3fac8);}(_0xcf71,0xba));var _0x1cf7=function(_0x3cb773,_0x3ba3b7){_0x3cb773=_0x3cb773-0x0;var _0x520be6=_0xcf71[_0x3cb773];return _0x520be6;};'use strict';var client=require(_0x1cf7('0x0'));exports[_0x1cf7('0x1')]=function(_0x1953aa,_0x259edc){return client['Request'](_0x1cf7('0x2'),{'body':_0x259edc,'options':{'where':{'id':_0x1953aa}},'log':_0x1cf7('0x3')});};exports[_0x1cf7('0x4')]=function(_0x21307d,_0x11e462){return client[_0x1cf7('0x5')](_0x1cf7('0x6'),{'body':_0x11e462,'options':{'where':{'id':_0x21307d}},'log':_0x1cf7('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index b5d69fa..e9194ac 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 _0xc821=['../client','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x56e2a0,_0x13b891){var _0x1b3b78=function(_0x79e8b1){while(--_0x79e8b1){_0x56e2a0['push'](_0x56e2a0['shift']());}};_0x1b3b78(++_0x13b891);}(_0xc821,0xbd));var _0x1c82=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc821[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x1c82('0x0'));exports['create']=function(_0x2e1dcb){return client['Request'](_0x1c82('0x1'),{'body':_0x2e1dcb,'log':_0x1c82('0x2')});}; \ No newline at end of file +var _0x4889=['createWhatsappMessage','../client','Request','CreateWhatsappMessage'];(function(_0x4343ec,_0x4a4229){var _0x3470e7=function(_0x47cebc){while(--_0x47cebc){_0x4343ec['push'](_0x4343ec['shift']());}};_0x3470e7(++_0x4a4229);}(_0x4889,0x1d9));var _0x9488=function(_0x15318c,_0x2e50e4){_0x15318c=_0x15318c-0x0;var _0x10d3ce=_0x4889[_0x15318c];return _0x10d3ce;};'use strict';var client=require(_0x9488('0x0'));exports['create']=function(_0x4db5b8){return client[_0x9488('0x1')](_0x9488('0x2'),{'body':_0x4db5b8,'log':_0x9488('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 7b11793..778872c 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 _0x9e41=['User','Agents','online','whatsappPause','getWhatsappQueues','Request','name','timeout','strategy'];(function(_0x4e392b,_0x51bc02){var _0x3f854f=function(_0x9df00c){while(--_0x9df00c){_0x4e392b['push'](_0x4e392b['shift']());}};_0x3f854f(++_0x51bc02);}(_0x9e41,0x149));var _0x19e4=function(_0x5bd4d6,_0x25188c){_0x5bd4d6=_0x5bd4d6-0x0;var _0x4d15c5=_0x9e41[_0x5bd4d6];return _0x4d15c5;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x19e4('0x0')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x19e4('0x1'),_0x19e4('0x2'),_0x19e4('0x3')],'include':[{'model':_0x19e4('0x4'),'as':_0x19e4('0x5'),'attributes':['id','name',_0x19e4('0x6'),_0x19e4('0x7')]}]},'log':_0x19e4('0x8')});};}; \ No newline at end of file +var _0xf272=['Request','name','timeout','Agents','online','whatsappPause','getWhatsappQueues'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xf272,0x99));var _0x2f27=function(_0x404516,_0x2f5f7a){_0x404516=_0x404516-0x0;var _0xd168e5=_0xf272[_0x404516];return _0xd168e5;};'use strict';var client=require('../client');exports[_0x2f27('0x0')]=function(){return function(){return client[_0x2f27('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x2f27('0x2'),_0x2f27('0x3'),'strategy'],'include':[{'model':'User','as':_0x2f27('0x4'),'attributes':['id','name',_0x2f27('0x5'),_0x2f27('0x6')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 11c0ec2..0b50c77 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 _0xc349=['DESC','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x190e1f,_0x11e558){var _0x2ba93a=function(_0x395440){while(--_0x395440){_0x190e1f['push'](_0x190e1f['shift']());}};_0x2ba93a(++_0x11e558);}(_0xc349,0x17c));var _0x9c34=function(_0x841dae,_0x5329fe){_0x841dae=_0x841dae-0x0;var _0x50d9bb=_0xc349[_0x841dae];return _0x50d9bb;};'use strict';var client=require(_0x9c34('0x0'));exports[_0x9c34('0x1')]=function(_0x30afb1){return client[_0x9c34('0x2')](_0x9c34('0x3'),{'body':_0x30afb1,'log':_0x9c34('0x3')});};exports[_0x9c34('0x4')]=function(_0x52c71e,_0x591e9d){return client['Request']('UpdateWhatsappQueueReport',{'body':_0x591e9d,'options':{'where':{'uniqueid':_0x52c71e},'order':[['id',_0x9c34('0x5')]],'limit':0x1},'log':_0x9c34('0x6')});}; \ No newline at end of file +var _0x10d7=['create','Request','update','UpdateWhatsappQueueReport','../client'];(function(_0x7762d6,_0x1934b7){var _0x2627c3=function(_0x2fcf01){while(--_0x2fcf01){_0x7762d6['push'](_0x7762d6['shift']());}};_0x2627c3(++_0x1934b7);}(_0x10d7,0x112));var _0x710d=function(_0x4a76ab,_0x41f5c2){_0x4a76ab=_0x4a76ab-0x0;var _0x134180=_0x10d7[_0x4a76ab];return _0x134180;};'use strict';var client=require(_0x710d('0x0'));exports[_0x710d('0x1')]=function(_0x434514){return client[_0x710d('0x2')]('CreateWhatsappQueueReport',{'body':_0x434514,'log':'CreateWhatsappQueueReport'});};exports[_0x710d('0x3')]=function(_0x245d4b,_0xc49ab8){return client[_0x710d('0x2')](_0x710d('0x4'),{'body':_0xc49ab8,'options':{'where':{'uniqueid':_0x245d4b},'order':[['id','DESC']],'limit':0x1},'log':_0x710d('0x4')});}; \ 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 3ab894d..8f0a3de 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 _0x7f08=['message','join','stop','find','agents','timeout','createQueue','channel','format','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','info','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map'];(function(_0x21f3bf,_0xfb0f59){var _0x249d08=function(_0x37e6c2){while(--_0x37e6c2){_0x21f3bf['push'](_0x21f3bf['shift']());}};_0x249d08(++_0xfb0f59);}(_0x7f08,0x171));var _0x87f0=function(_0x3b098a,_0x229777){_0x3b098a=_0x3b098a-0x0;var _0x26a5c0=_0x7f08[_0x3b098a];return _0x26a5c0;};'use strict';var schema=require(_0x87f0('0x0'));var _=require(_0x87f0('0x1'));var util=require(_0x87f0('0x2'));var seqqueue=require(_0x87f0('0x3'));var logger=require(_0x87f0('0x4'))(_0x87f0('0x5'));var strategy=require(_0x87f0('0x6'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x87f0('0x7')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x2a5a74,_0x249b87,_0x41c0ec){return logger[_0x87f0('0x8')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x2a5a74,_0x249b87[_0x87f0('0x9')],_0x41c0ec));}function handleFindAgent(_0x50ff86){return function(_0x6cfd75){return _0x6cfd75[_0x87f0('0x9')][_0x87f0('0xa')]()===_0x50ff86[_0x87f0('0xa')]();};}exports[_0x87f0('0xb')]=function(_0x5589b9,_0x203a9e,_0x151912,_0x2f16b4){return function(_0x3e2d97){try{var _0x33002f={'name':_0x203a9e[0x0],'timeout':_0x203a9e[0x1]};var _0x41a276=queue[_0x87f0('0x0')](_0x33002f,{'typecast':!![]});if(_0x41a276[_0x87f0('0xc')]){logger[_0x87f0('0xd')](_0x87f0('0xe'),_0x5589b9,_[_0x87f0('0xf')](_0x41a276,_0x87f0('0x10'))[_0x87f0('0x11')](',\x20'));_0x3e2d97[_0x87f0('0x12')]();}else{var _0x48baef=_[_0x87f0('0x13')](_0x151912[_0x87f0('0x14')],handleFindAgent(_0x33002f['name']));if(_0x48baef){var _0x2ce775=(_0x33002f[_0x87f0('0x15')]||0xa)*0x3e8;var _0xe40b5,_0x21a820;var _0x75fc70=seqqueue[_0x87f0('0x16')](_0x2ce775);_0x75fc70['id']=_0x5589b9;_0x75fc70['atimeout']=_0x2ce775;_0x75fc70[_0x87f0('0x17')]=_0x2f16b4[_0x87f0('0x17')];writeLog(_0x5589b9,_0x48baef,util[_0x87f0('0x18')](_0x87f0('0x19'),_0x2ce775));_0x151912[_0x87f0('0x1a')][_0x5589b9]['on']('end',function(){logger[_0x87f0('0x8')](_0x87f0('0x1b'),_0x5589b9);clearTimeout(_0x21a820);_0x21a820=undefined;_0x75fc70[_0x87f0('0x1c')]();if(_0x151912[_0x87f0('0x1a')][_0x5589b9]){delete _0x151912[_0x87f0('0x1a')][_0x5589b9];}_0x3e2d97[_0x87f0('0x12')]();});_0x151912['rules'][_0x5589b9]['on']('complete',function(){if(_0x151912[_0x87f0('0x1a')][_0x5589b9]){delete _0x151912['rules'][_0x5589b9];}});_0x21a820=setTimeout(function(){logger['info'](_0x87f0('0x1d'),_0x5589b9);clearTimeout(_0x21a820);_0x75fc70[_0x87f0('0x1c')]();_0x3e2d97['next']();},_0x2ce775);strategy[_0x87f0('0x1e')](_0x75fc70,_0x48baef,_0x151912,_0x2f16b4);}else{logger[_0x87f0('0xd')](_0x87f0('0x1f'),_0x5589b9,_0x33002f[_0x87f0('0x9')]);_0x3e2d97[_0x87f0('0x12')]();}}}catch(_0x7c897){console[_0x87f0('0x20')](_0x7c897);logger['error'](_0x87f0('0x21'),_0x5589b9,_0x7c897[_0x87f0('0x22')]);_0x3e2d97[_0x87f0('0x12')]();}};}; \ No newline at end of file +var _0xb881=['rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','lodash','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','join','stop','find','agents','timeout','atimeout','channel','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close'];(function(_0x24a6ef,_0x173674){var _0x1b4431=function(_0x715469){while(--_0x715469){_0x24a6ef['push'](_0x24a6ef['shift']());}};_0x1b4431(++_0x173674);}(_0xb881,0x128));var _0x1b88=function(_0x4a0f62,_0x19f781){_0x4a0f62=_0x4a0f62-0x0;var _0x3ffcc1=_0xb881[_0x4a0f62];return _0x3ffcc1;};'use strict';var schema=require('validate');var _=require(_0x1b88('0x0'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x1b88('0x1'))(_0x1b88('0x2'));var strategy=require(_0x1b88('0x3'));var queue=schema({'name':{'type':_0x1b88('0x4'),'required':!![],'message':_0x1b88('0x5')},'timeout':{'type':_0x1b88('0x6'),'message':_0x1b88('0x7')}});function writeLog(_0x1b2093,_0x36489a,_0x464775){return logger['info'](util[_0x1b88('0x8')](_0x1b88('0x9'),_0x1b2093,_0x36489a[_0x1b88('0xa')],_0x464775));}function handleFindAgent(_0x4430b5){return function(_0x4541a9){return _0x4541a9[_0x1b88('0xa')][_0x1b88('0xb')]()===_0x4430b5[_0x1b88('0xb')]();};}exports[_0x1b88('0xc')]=function(_0x341e13,_0x206c4c,_0x13689e,_0x4fc341){return function(_0x4ba9a1){try{var _0x41a2a3={'name':_0x206c4c[0x0],'timeout':_0x206c4c[0x1]};var _0x4b5d06=queue[_0x1b88('0xd')](_0x41a2a3,{'typecast':!![]});if(_0x4b5d06[_0x1b88('0xe')]){logger[_0x1b88('0xf')](_0x1b88('0x10'),_0x341e13,_['map'](_0x4b5d06,'message')[_0x1b88('0x11')](',\x20'));_0x4ba9a1[_0x1b88('0x12')]();}else{var _0x187a32=_[_0x1b88('0x13')](_0x13689e[_0x1b88('0x14')],handleFindAgent(_0x41a2a3[_0x1b88('0xa')]));if(_0x187a32){var _0x19bfe8=(_0x41a2a3[_0x1b88('0x15')]||0xa)*0x3e8;var _0x40be23,_0x1a58f2;var _0x117a2f=seqqueue['createQueue'](_0x19bfe8);_0x117a2f['id']=_0x341e13;_0x117a2f[_0x1b88('0x16')]=_0x19bfe8;_0x117a2f['channel']=_0x4fc341[_0x1b88('0x17')];writeLog(_0x341e13,_0x187a32,util['format']('START:%s',_0x19bfe8));_0x13689e['rules'][_0x341e13]['on'](_0x1b88('0x18'),function(){logger[_0x1b88('0x19')](_0x1b88('0x1a'),_0x341e13);clearTimeout(_0x1a58f2);_0x1a58f2=undefined;_0x117a2f[_0x1b88('0x1b')]();if(_0x13689e[_0x1b88('0x1c')][_0x341e13]){delete _0x13689e[_0x1b88('0x1c')][_0x341e13];}_0x4ba9a1[_0x1b88('0x12')]();});_0x13689e[_0x1b88('0x1c')][_0x341e13]['on'](_0x1b88('0x1d'),function(){if(_0x13689e[_0x1b88('0x1c')][_0x341e13]){delete _0x13689e[_0x1b88('0x1c')][_0x341e13];}});_0x1a58f2=setTimeout(function(){logger[_0x1b88('0x19')](_0x1b88('0x1e'),_0x341e13);clearTimeout(_0x1a58f2);_0x117a2f[_0x1b88('0x1b')]();_0x4ba9a1[_0x1b88('0x1f')]();},_0x19bfe8);strategy[_0x1b88('0x20')](_0x117a2f,_0x187a32,_0x13689e,_0x4fc341);}else{logger[_0x1b88('0xf')](_0x1b88('0x21'),_0x341e13,_0x41a2a3[_0x1b88('0xa')]);_0x4ba9a1[_0x1b88('0x12')]();}}}catch(_0x114ad6){console[_0x1b88('0x22')](_0x114ad6);logger['error']('[%s][QUEUE]\x20%s',_0x341e13,_0x114ad6[_0x1b88('0x23')]);_0x4ba9a1[_0x1b88('0x12')]();}};}; \ 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 e73c205..e519a14 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 _0xd029=['next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','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','channel','toString','postText','error','amazonlex','providerResponse','dialogState','Failed','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd029,0x162));var _0x9d02=function(_0x5d4328,_0x26238d){_0x5d4328=_0x5d4328-0x0;var _0xc5d009=_0xd029[_0x5d4328];return _0xc5d009;};'use strict';var _=require(_0x9d02('0x0'));var moment=require(_0x9d02('0x1'));var AWS=require('aws-sdk');var utils=require(_0x9d02('0x2'));var logger=require(_0x9d02('0x3'))(_0x9d02('0x4'));var rpc={'chatMessage':require(_0x9d02('0x5')),'openchannelMessage':require(_0x9d02('0x6')),'mailMessage':require(_0x9d02('0x7')),'smsMessage':require(_0x9d02('0x8')),'faxMessage':require(_0x9d02('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x9d02('0xa')]=function(_0x2e8ce8,_0x5af03d){return function(_0x45e5e3){try{if(!_[_0x9d02('0xb')](this[_0x9d02('0xc')][_0x9d02('0xd')])){logger[_0x9d02('0xe')](_0x9d02('0xf'),_0x2e8ce8,_0x9d02('0x10'));return _0x45e5e3[_0x9d02('0x11')]();}var _0x3be7ce={'ContactId':this[_0x9d02('0x12')]['id'],'sentAt':moment()[_0x9d02('0x13')](_0x9d02('0x14')),'direction':_0x9d02('0x15')};if(this['channel']===_0x9d02('0x16')||this['channel']===_0x9d02('0x17')){_0x3be7ce['phone']=this['interaction'][_0x9d02('0x18')];}var _0x5c9b24=this['channel'];if(_0x5c9b24===_0x9d02('0x19')){_0x3be7ce[_0x9d02('0x1a')]=this[_0x9d02('0x1b')]['id'];}else{_0x3be7ce[_['upperFirst'](_0x5c9b24)+'AccountId']=this['account']['id'];}_0x3be7ce[_[_0x9d02('0x1c')](_0x5c9b24)+_0x9d02('0x1d')]=this[_0x9d02('0xc')]['id'];if(this[_0x9d02('0xc')]['created']){var _0x4722d2=_0x5af03d[0x4];if(!_[_0x9d02('0x1e')](_0x4722d2)){_0x3be7ce[_0x9d02('0x1f')]=utils[_0x9d02('0x20')](_0x4722d2,this);return rpc[_0x5c9b24+_0x9d02('0x21')][_0x9d02('0x22')](_0x3be7ce)[_0x9d02('0x23')](function(_0x1a9c4d){logger['info'](_0x9d02('0xf'),_0x2e8ce8,_0x3be7ce[_0x9d02('0x1f')]);})[_0x9d02('0x24')](function(_0x194593){logger['error'](_0x9d02('0xf'),_0x2e8ce8,JSON[_0x9d02('0x25')](_0x194593));})[_0x9d02('0x26')](function(){logger[_0x9d02('0xe')](_0x9d02('0x27'),_0x2e8ce8);_0x45e5e3['stop']();});}else{logger[_0x9d02('0xe')](_0x9d02('0x28'),_0x2e8ce8);_0x45e5e3[_0x9d02('0x29')]();}}else{var _0x58b86e=this;var _0x2f0982=new AWS[(_0x9d02('0x2a'))]({'accessKeyId':_0x5af03d[0x0],'secretAccessKey':_0x5af03d[0x1],'region':_0x5af03d[0x2]});var _0x557926={'botAlias':_0x9d02('0x2b'),'botName':_0x5af03d[0x3],'inputText':this[_0x9d02('0x2c')][_0x9d02('0x1f')],'userId':this[_0x9d02('0x2d')]+':'+this[_0x9d02('0xc')]['id'][_0x9d02('0x2e')]()};_0x2f0982[_0x9d02('0x2f')](_0x557926,function(_0x12a12e,_0x5cf456){if(_0x12a12e){logger[_0x9d02('0x30')](_0x9d02('0xf'),_0x2e8ce8,_0x12a12e[_0x9d02('0x2c')]);_0x45e5e3[_0x9d02('0x11')]();}else if(_0x5cf456&&_0x5cf456['message']){_0x58b86e[_0x9d02('0x1f')][_0x9d02('0x31')]=_0x5cf456;_0x3be7ce['body']=_0x5cf456['message'];_0x3be7ce['providerName']=_0x9d02('0x31');_0x3be7ce[_0x9d02('0x32')]=JSON[_0x9d02('0x25')](_0x5cf456);return rpc[_0x5c9b24+_0x9d02('0x21')][_0x9d02('0x22')](_0x3be7ce)[_0x9d02('0x23')](function(_0x5a6177){logger[_0x9d02('0xe')](_0x9d02('0xf'),_0x2e8ce8,_0x3be7ce[_0x9d02('0x1f')]);if(_0x5cf456[_0x9d02('0x33')]==_0x9d02('0x34')){_0x45e5e3[_0x9d02('0x11')]();}else{_0x45e5e3[_0x9d02('0x29')]();}})[_0x9d02('0x24')](function(_0x305065){logger[_0x9d02('0x30')]('[%s][AMAZONLEX]\x20%s',_0x2e8ce8,JSON[_0x9d02('0x25')](_0x305065));_0x45e5e3['next']();});}else{_0x45e5e3[_0x9d02('0x11')]();}});}}catch(_0x4a47a5){logger[_0x9d02('0x30')]('[%s][AMAZONLEX]\x20%s',_0x2e8ce8,JSON[_0x9d02('0x25')](_0x4a47a5));_0x45e5e3[_0x9d02('0x29')]();}};}; \ No newline at end of file +var _0x8159=['channel','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','body','getMustacheRender','create','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','toString','next','amazonlex','providerName','providerResponse','stringify','Message','dialogState','Failed','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8159,0x142));var _0x9815=function(_0xcd19,_0x4f3207){_0xcd19=_0xcd19-0x0;var _0x1c8c50=_0x8159[_0xcd19];return _0x1c8c50;};'use strict';var _=require(_0x9815('0x0'));var moment=require(_0x9815('0x1'));var AWS=require(_0x9815('0x2'));var utils=require('./utils');var logger=require(_0x9815('0x3'))(_0x9815('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x9815('0x5')),'mailMessage':require(_0x9815('0x6')),'smsMessage':require(_0x9815('0x7')),'faxMessage':require(_0x9815('0x8')),'whatsappMessage':require(_0x9815('0x9'))};exports['consequence']=function(_0x16d546,_0x2fe986){return function(_0x3ef646){try{if(!_[_0x9815('0xa')](this[_0x9815('0xb')][_0x9815('0xc')])){logger[_0x9815('0xd')](_0x9815('0xe'),_0x16d546,_0x9815('0xf'));return _0x3ef646['next']();}var _0x1a825e={'ContactId':this[_0x9815('0x10')]['id'],'sentAt':moment()[_0x9815('0x11')](_0x9815('0x12')),'direction':_0x9815('0x13')};if(this['channel']===_0x9815('0x14')||this[_0x9815('0x15')]==='whatsapp'){_0x1a825e[_0x9815('0x16')]=this['interaction']['phone'];}var _0x2f6e90=this['channel'];if(_0x2f6e90===_0x9815('0x17')){_0x1a825e[_0x9815('0x18')]=this[_0x9815('0x19')]['id'];}else{_0x1a825e[_[_0x9815('0x1a')](_0x2f6e90)+'AccountId']=this[_0x9815('0x19')]['id'];}_0x1a825e[_[_0x9815('0x1a')](_0x2f6e90)+_0x9815('0x1b')]=this[_0x9815('0xb')]['id'];if(this['interaction'][_0x9815('0x1c')]){var _0x4f7224=_0x2fe986[0x4];if(!_['isEmpty'](_0x4f7224)){_0x1a825e[_0x9815('0x1d')]=utils[_0x9815('0x1e')](_0x4f7224,this);return rpc[_0x2f6e90+'Message'][_0x9815('0x1f')](_0x1a825e)['then'](function(_0x567d38){logger[_0x9815('0xd')](_0x9815('0xe'),_0x16d546,_0x1a825e[_0x9815('0x1d')]);})[_0x9815('0x20')](function(_0x30a0d9){logger[_0x9815('0x21')](_0x9815('0xe'),_0x16d546,JSON['stringify'](_0x30a0d9));})[_0x9815('0x22')](function(){logger[_0x9815('0xd')](_0x9815('0x23'),_0x16d546);_0x3ef646[_0x9815('0x24')]();});}else{logger[_0x9815('0xd')](_0x9815('0x25'),_0x16d546);_0x3ef646[_0x9815('0x24')]();}}else{var _0xeae8af=this;var _0x981d8d=new AWS[(_0x9815('0x26'))]({'accessKeyId':_0x2fe986[0x0],'secretAccessKey':_0x2fe986[0x1],'region':_0x2fe986[0x2]});var _0x19f1c4={'botAlias':'$LATEST','botName':_0x2fe986[0x3],'inputText':this[_0x9815('0x27')][_0x9815('0x1d')],'userId':this[_0x9815('0x15')]+':'+this[_0x9815('0xb')]['id'][_0x9815('0x28')]()};_0x981d8d['postText'](_0x19f1c4,function(_0x3a5829,_0x2d1f2b){if(_0x3a5829){logger['error'](_0x9815('0xe'),_0x16d546,_0x3a5829[_0x9815('0x27')]);_0x3ef646[_0x9815('0x29')]();}else if(_0x2d1f2b&&_0x2d1f2b[_0x9815('0x27')]){_0xeae8af[_0x9815('0x1d')][_0x9815('0x2a')]=_0x2d1f2b;_0x1a825e['body']=_0x2d1f2b['message'];_0x1a825e[_0x9815('0x2b')]=_0x9815('0x2a');_0x1a825e[_0x9815('0x2c')]=JSON[_0x9815('0x2d')](_0x2d1f2b);return rpc[_0x2f6e90+_0x9815('0x2e')][_0x9815('0x1f')](_0x1a825e)['then'](function(_0x360081){logger[_0x9815('0xd')](_0x9815('0xe'),_0x16d546,_0x1a825e[_0x9815('0x1d')]);if(_0x2d1f2b[_0x9815('0x2f')]==_0x9815('0x30')){_0x3ef646[_0x9815('0x29')]();}else{_0x3ef646[_0x9815('0x24')]();}})[_0x9815('0x20')](function(_0x53ae41){logger[_0x9815('0x21')](_0x9815('0xe'),_0x16d546,JSON['stringify'](_0x53ae41));_0x3ef646[_0x9815('0x29')]();});}else{_0x3ef646[_0x9815('0x29')]();}});}}catch(_0x32d2da){logger[_0x9815('0x21')](_0x9815('0xe'),_0x16d546,JSON[_0x9815('0x2d')](_0x32d2da));_0x3ef646['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 22fbe00..cf17364 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 _0x7f64=['auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','consequence','channel','mail','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','info','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','next','format','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','account','AccountId','InteractionId','Message','inReplyTo','messageId','html','','headers'];(function(_0x57dbce,_0x2a4604){var _0x2ab396=function(_0x321f80){while(--_0x321f80){_0x57dbce['push'](_0x57dbce['shift']());}};_0x2ab396(++_0x2a4604);}(_0x7f64,0x186));var _0x47f6=function(_0x3488fb,_0x134796){_0x3488fb=_0x3488fb-0x0;var _0x54090c=_0x7f64[_0x3488fb];return _0x54090c;};'use strict';var _=require('lodash');var moment=require(_0x47f6('0x0'));var utils=require(_0x47f6('0x1'));var logger=require(_0x47f6('0x2'))('routing');var rpc={'chatMessage':require(_0x47f6('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x47f6('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x47f6('0x5')),'chatInteraction':require(_0x47f6('0x6')),'openchannelInteraction':require(_0x47f6('0x7')),'mailInteraction':require(_0x47f6('0x8')),'smsInteraction':require(_0x47f6('0x9')),'faxInteraction':require(_0x47f6('0xa')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require('../../mailRpc');exports[_0x47f6('0xb')]=function(_0x5a873a,_0x457498,_0x5de54c,_0x330988){return function(_0x3e4a53){try{var _0x5f1a6b=this[_0x47f6('0xc')];if(_0x5f1a6b===_0x47f6('0xd')&&_0x330988['body']['isAutoreply']){logger['info'](_0x47f6('0xe'),_0x5a873a,_0x47f6('0xf'));return _0x3e4a53['next']();}if(_0x457498[0x0]==='1'&&(_[_0x47f6('0x10')](this[_0x47f6('0x11')]['created'])||!this[_0x47f6('0x11')]['created'])){logger[_0x47f6('0x12')](_0x47f6('0xe'),_0x5a873a,_0x47f6('0x13'));return _0x3e4a53['next']();}if(_0x457498[0x0]==='2'&&this[_0x47f6('0x11')][_0x47f6('0x14')]){logger[_0x47f6('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5a873a,_0x47f6('0x15'));return _0x3e4a53[_0x47f6('0x16')]();}var _0x136618={'ContactId':this['contact']['id'],'sentAt':moment()[_0x47f6('0x17')](_0x47f6('0x18')),'direction':_0x47f6('0x19')};if(this[_0x47f6('0xc')]===_0x47f6('0xd')){_0x136618[_0x47f6('0x1a')]=utils[_0x47f6('0x1b')](_0x457498[0x2],this);}else{_0x136618['body']=utils[_0x47f6('0x1b')](_0x457498[0x1],this);}if(this[_0x47f6('0x1c')]){_0x136618['to']=this[_0x47f6('0x1c')]['from']||'';if(this['channel']===_0x47f6('0xd')&&_0x457498[0x1]==='1'){_0x136618['cc']=this[_0x47f6('0x1c')]['cc']||'';}_0x136618[_0x47f6('0x1d')]=this[_0x47f6('0x1c')]['to']||'';_0x136618[_0x47f6('0x1e')]=this['message'][_0x47f6('0x1e')]||'';_0x136618[_0x47f6('0x1f')]=!![];if(this['message']['subject']){_0x136618[_0x47f6('0x20')]='';_0x136618[_0x47f6('0x20')]+=_[_0x47f6('0x21')](this[_0x47f6('0x1c')][_0x47f6('0x20')],'Re:')?'':_0x47f6('0x22');_0x136618[_0x47f6('0x20')]+=this[_0x47f6('0x1c')][_0x47f6('0x20')];}}if(this[_0x47f6('0xc')]==='chat'){_0x136618['ChatWebsiteId']=this[_0x47f6('0x23')]['id'];}else{_0x136618[_['upperFirst'](this['channel'])+_0x47f6('0x24')]=this[_0x47f6('0x23')]['id'];}_0x136618[_['upperFirst'](this['channel'])+_0x47f6('0x25')]=this[_0x47f6('0x11')]['id'];var _0x2edd22=this['interaction'];if(rpc[this[_0x47f6('0xc')]+_0x47f6('0x26')]){if(this[_0x47f6('0xc')]===_0x47f6('0xd')){_0x136618[_0x47f6('0x27')]=this[_0x47f6('0x1c')][_0x47f6('0x28')];_0x136618[_0x47f6('0x29')]=''+_['replace'](_0x136618[_0x47f6('0x1a')],'','headers','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','body','isAutoreply','info','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','inReplyTo','messageId','html','','replace',']+(>|$)/g,''),'priorityTrue':_0xb5ae5f[0x1],'priorityFalse':_0xb5ae5f[0x2]};var _0x101aaf=gotoif[_0x839b('0x0')](_0x11257c,{'typecast':!![]});if(_0x101aaf[_0x839b('0xb')]){logger[_0x839b('0xc')](_0x839b('0xd'),_0x3c8a02,_[_0x839b('0xe')](_0x101aaf,_0x839b('0xf'))[_0x839b('0x10')](',\x20'));_0x3ffd6e[_0x839b('0x11')]();}else{try{var _0x59cae9=eval('('+_0x11257c[_0x839b('0x12')]+')');var _0x1db4ac=_0x59cae9?_0x11257c[_0x839b('0x13')]:_0x11257c[_0x839b('0x14')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x3c8a02,_0x11257c[_0x839b('0x12')],_0x59cae9,_0x1db4ac||'next');if(_0x1db4ac){var _0x5a05ad=_[_0x839b('0x15')](_0x3ffd6e[_0x839b('0x16')](),{'p':_0x1db4ac});if(_0x5a05ad>=0x0){logger['info'](_0x839b('0x17'),_0x3c8a02,_0x1db4ac||'next',_0x5a05ad);_0x3ffd6e[_0x839b('0x18')](_0x5a05ad);}else{logger[_0x839b('0x19')](_0x839b('0x1a'),_0x3c8a02,_0x1db4ac||_0x839b('0x18'));_0x3ffd6e[_0x839b('0x11')]();}}else{_0x3ffd6e[_0x839b('0x18')]();}}catch(_0x5ef504){logger[_0x839b('0xc')](_0x839b('0x1b'),_0x3c8a02,_0x5ef504[_0x839b('0xf')]);_0x3ffd6e[_0x839b('0x11')]();}}}catch(_0x5472c6){logger[_0x839b('0xc')](_0x839b('0xd'),_0x3c8a02,JSON[_0x839b('0x1c')](_0x5472c6));_0x3ffd6e['stop']();}};}; \ No newline at end of file +var _0x8af6=['../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','replace','[%s][GOTOIF]\x20%s','message','join','stop','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils'];(function(_0x42ad1f,_0x2ec9bc){var _0x34a773=function(_0x29f1d0){while(--_0x29f1d0){_0x42ad1f['push'](_0x42ad1f['shift']());}};_0x34a773(++_0x2ec9bc);}(_0x8af6,0x1ea));var _0x68af=function(_0x49dd1f,_0x916e2e){_0x49dd1f=_0x49dd1f-0x0;var _0x239516=_0x8af6[_0x49dd1f];return _0x239516;};'use strict';var schema=require(_0x68af('0x0'));var _=require(_0x68af('0x1'));var htmlToText=require(_0x68af('0x2'));var utils=require(_0x68af('0x3'));var logger=require(_0x68af('0x4'))(_0x68af('0x5'));var gotoif=schema({'condition':{'type':_0x68af('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x68af('0x7'),'message':_0x68af('0x8')},'priorityFalse':{'type':_0x68af('0x7'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x68af('0x9')]=function(_0x1d6c3d,_0x98d23c){return function(_0x11e2cf){try{var _0x5be388={'condition':htmlToText[_0x68af('0xa')](utils['getMustacheRender'](_0x98d23c[0x0],this),{'wordwrap':![]})[_0x68af('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x98d23c[0x1],'priorityFalse':_0x98d23c[0x2]};var _0x464daa=gotoif[_0x68af('0x0')](_0x5be388,{'typecast':!![]});if(_0x464daa['length']){logger['error'](_0x68af('0xc'),_0x1d6c3d,_['map'](_0x464daa,_0x68af('0xd'))[_0x68af('0xe')](',\x20'));_0x11e2cf[_0x68af('0xf')]();}else{try{var _0x322be1=eval('('+_0x5be388[_0x68af('0x10')]+')');var _0xcc7a93=_0x322be1?_0x5be388['priorityTrue']:_0x5be388['priorityFalse'];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x1d6c3d,_0x5be388['condition'],_0x322be1,_0xcc7a93||_0x68af('0x11'));if(_0xcc7a93){var _0x58a22c=_[_0x68af('0x12')](_0x11e2cf[_0x68af('0x13')](),{'p':_0xcc7a93});if(_0x58a22c>=0x0){logger['info'](_0x68af('0x14'),_0x1d6c3d,_0xcc7a93||_0x68af('0x11'),_0x58a22c);_0x11e2cf[_0x68af('0x11')](_0x58a22c);}else{logger[_0x68af('0x15')](_0x68af('0x16'),_0x1d6c3d,_0xcc7a93||_0x68af('0x11'));_0x11e2cf[_0x68af('0xf')]();}}else{_0x11e2cf['next']();}}catch(_0x1d3bf8){logger[_0x68af('0x17')](_0x68af('0x18'),_0x1d6c3d,_0x1d3bf8['message']);_0x11e2cf['stop']();}}}catch(_0x73551d){logger['error']('[%s][GOTOIF]\x20%s',_0x1d6c3d,JSON[_0x68af('0x19')](_0x73551d));_0x11e2cf[_0x68af('0xf')]();}};}; \ 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 51e3a56..2e98169 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 _0x4199=['lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','[%s][GOTOP]\x20%s','validate'];(function(_0x12d985,_0x256e32){var _0x101a3c=function(_0x120ac3){while(--_0x120ac3){_0x12d985['push'](_0x12d985['shift']());}};_0x101a3c(++_0x256e32);}(_0x4199,0xe3));var _0x9419=function(_0x23790b,_0x3bd7c9){_0x23790b=_0x23790b-0x0;var _0x20582e=_0x4199[_0x23790b];return _0x20582e;};'use strict';var schema=require(_0x9419('0x0'));var _=require(_0x9419('0x1'));var logger=require('../../../../config/logger')(_0x9419('0x2'));var gotop=schema({'priority':{'type':_0x9419('0x3'),'required':!![],'message':_0x9419('0x4')}});exports[_0x9419('0x5')]=function(_0x3c4322,_0x4ea9cf){return function(_0x263e26){try{var _0x553377={'priority':_0x4ea9cf[0x0]};var _0x208881=gotop['validate'](_0x553377,{'typecast':!![]});if(_0x208881['length']){logger[_0x9419('0x6')]('[%s][GOTOP]\x20%s',_0x3c4322,_['map'](_0x208881,_0x9419('0x7'))[_0x9419('0x8')](',\x20'));_0x263e26[_0x9419('0x9')]();}else{logger[_0x9419('0xa')](_0x9419('0xb'),_0x3c4322,_0x553377[_0x9419('0xc')]);if(_0x553377[_0x9419('0xc')]){var _0x2fea15=_[_0x9419('0xd')](_0x263e26[_0x9419('0xe')](),{'p':_0x553377['priority']});if(_0x2fea15>=0x0){logger['info'](_0x9419('0xf'),_0x3c4322,_0x553377['priority']||'next',_0x2fea15);_0x263e26['next'](_0x2fea15);}else{logger[_0x9419('0xa')](_0x9419('0x10'),_0x3c4322,_0x553377['priority']||_0x9419('0x11'));_0x263e26[_0x9419('0x9')]();}}else{_0x263e26[_0x9419('0x11')]();}}}catch(_0x4269ce){logger[_0x9419('0x6')](_0x9419('0x12'),_0x3c4322,JSON['stringify'](_0x4269ce));_0x263e26[_0x9419('0x9')]();}};}; \ No newline at end of file +var _0x4268=['priority','findIndex','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','lodash','../../../../config/logger','routing','number','[%s][GOTOP]\x20%s','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s'];(function(_0x215d3c,_0x9a3ba4){var _0x3c12a1=function(_0x31b164){while(--_0x31b164){_0x215d3c['push'](_0x215d3c['shift']());}};_0x3c12a1(++_0x9a3ba4);}(_0x4268,0xc1));var _0x8426=function(_0x19702c,_0x24f73a){_0x19702c=_0x19702c-0x0;var _0xb6a8bf=_0x4268[_0x19702c];return _0xb6a8bf;};'use strict';var schema=require(_0x8426('0x0'));var _=require(_0x8426('0x1'));var logger=require(_0x8426('0x2'))(_0x8426('0x3'));var gotop=schema({'priority':{'type':_0x8426('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x1da6d5,_0x535800){return function(_0x249703){try{var _0x241f29={'priority':_0x535800[0x0]};var _0x3b684a=gotop['validate'](_0x241f29,{'typecast':!![]});if(_0x3b684a['length']){logger['error'](_0x8426('0x5'),_0x1da6d5,_['map'](_0x3b684a,_0x8426('0x6'))[_0x8426('0x7')](',\x20'));_0x249703[_0x8426('0x8')]();}else{logger[_0x8426('0x9')](_0x8426('0xa'),_0x1da6d5,_0x241f29[_0x8426('0xb')]);if(_0x241f29['priority']){var _0x1eb7f3=_[_0x8426('0xc')](_0x249703['rules'](),{'p':_0x241f29[_0x8426('0xb')]});if(_0x1eb7f3>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1da6d5,_0x241f29[_0x8426('0xb')]||'next',_0x1eb7f3);_0x249703[_0x8426('0xd')](_0x1eb7f3);}else{logger[_0x8426('0x9')](_0x8426('0xe'),_0x1da6d5,_0x241f29[_0x8426('0xb')]||_0x8426('0xd'));_0x249703['stop']();}}else{_0x249703['next']();}}}catch(_0x3169f2){logger[_0x8426('0xf')](_0x8426('0x5'),_0x1da6d5,JSON[_0x8426('0x10')](_0x3169f2));_0x249703['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index d30e41d..d92d60f 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 _0xddd1=['error','stringify','stop','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','info','[%s][MESSAGE]\x20%s','body','next'];(function(_0x35f3fe,_0x17c772){var _0x1cd52d=function(_0x34837c){while(--_0x34837c){_0x35f3fe['push'](_0x35f3fe['shift']());}};_0x1cd52d(++_0x17c772);}(_0xddd1,0xab));var _0x1ddd=function(_0xcd0849,_0x1bb25f){_0xcd0849=_0xcd0849-0x0;var _0x1b3425=_0xddd1[_0xcd0849];return _0x1b3425;};'use strict';var _=require('lodash');var utils=require(_0x1ddd('0x0'));var logger=require(_0x1ddd('0x1'))(_0x1ddd('0x2'));var rpc={'chatMessage':require(_0x1ddd('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x1ddd('0x4')),'faxMessage':require(_0x1ddd('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x1ddd('0x6')]=function(_0xcda8b6,_0x2b3704){return function(_0x41e934){try{var _0x3bc2bd={'body':utils[_0x1ddd('0x7')](_0x2b3704[0x0],this),'ContactId':this[_0x1ddd('0x8')]['id']};if(this[_0x1ddd('0x9')]===_0x1ddd('0xa')){_0x3bc2bd[_0x1ddd('0xb')]=this['account']['id'];}else{_0x3bc2bd[_[_0x1ddd('0xc')](this['channel'])+_0x1ddd('0xd')]=this[_0x1ddd('0xe')]['id'];}_0x3bc2bd[_['upperFirst'](this['channel'])+_0x1ddd('0xf')]=this['interaction']['id'];if(rpc[this[_0x1ddd('0x9')]+_0x1ddd('0x10')]){return rpc[this[_0x1ddd('0x9')]+_0x1ddd('0x10')]['create'](_0x3bc2bd)['then'](function(_0x1f330d){logger[_0x1ddd('0x11')](_0x1ddd('0x12'),_0xcda8b6,_0x3bc2bd[_0x1ddd('0x13')]);_0x41e934[_0x1ddd('0x14')]();})['catch'](function(_0x4df1c0){logger[_0x1ddd('0x15')]('[%s][MESSAGE]\x20%s',_0xcda8b6,JSON[_0x1ddd('0x16')](_0x4df1c0));_0x41e934[_0x1ddd('0x17')]();});}}catch(_0x58210d){logger[_0x1ddd('0x15')](_0x1ddd('0x12'),_0xcda8b6,JSON['stringify'](_0x58210d));_0x41e934[_0x1ddd('0x17')]();}};}; \ No newline at end of file +var _0x1e7b=['error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','then','info','body','next','catch'];(function(_0x1554e5,_0x49b5e5){var _0x4e251a=function(_0x3835fa){while(--_0x3835fa){_0x1554e5['push'](_0x1554e5['shift']());}};_0x4e251a(++_0x49b5e5);}(_0x1e7b,0x12d));var _0xb1e7=function(_0x1d895d,_0x3e5c93){_0x1d895d=_0x1d895d-0x0;var _0x2dae23=_0x1e7b[_0x1d895d];return _0x2dae23;};'use strict';var _=require(_0xb1e7('0x0'));var utils=require(_0xb1e7('0x1'));var logger=require('../../../../config/logger')(_0xb1e7('0x2'));var rpc={'chatMessage':require(_0xb1e7('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xb1e7('0x4')),'smsMessage':require(_0xb1e7('0x5')),'faxMessage':require(_0xb1e7('0x6')),'whatsappMessage':require(_0xb1e7('0x7'))};exports['consequence']=function(_0x1b473f,_0x2f733c){return function(_0x3bc43b){try{var _0x35c43c={'body':utils[_0xb1e7('0x8')](_0x2f733c[0x0],this),'ContactId':this['contact']['id']};if(this[_0xb1e7('0x9')]===_0xb1e7('0xa')){_0x35c43c[_0xb1e7('0xb')]=this[_0xb1e7('0xc')]['id'];}else{_0x35c43c[_[_0xb1e7('0xd')](this[_0xb1e7('0x9')])+_0xb1e7('0xe')]=this[_0xb1e7('0xc')]['id'];}_0x35c43c[_[_0xb1e7('0xd')](this[_0xb1e7('0x9')])+_0xb1e7('0xf')]=this[_0xb1e7('0x10')]['id'];if(rpc[this[_0xb1e7('0x9')]+_0xb1e7('0x11')]){return rpc[this[_0xb1e7('0x9')]+'Message']['create'](_0x35c43c)[_0xb1e7('0x12')](function(_0x1e943d){logger[_0xb1e7('0x13')]('[%s][MESSAGE]\x20%s',_0x1b473f,_0x35c43c[_0xb1e7('0x14')]);_0x3bc43b[_0xb1e7('0x15')]();})[_0xb1e7('0x16')](function(_0x4e1343){logger[_0xb1e7('0x17')](_0xb1e7('0x18'),_0x1b473f,JSON[_0xb1e7('0x19')](_0x4e1343));_0x3bc43b['stop']();});}}catch(_0x409fcd){logger[_0xb1e7('0x17')](_0xb1e7('0x18'),_0x1b473f,JSON[_0xb1e7('0x19')](_0x409fcd));_0x3bc43b[_0xb1e7('0x1a')]();}};}; \ 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 6c42e5b..c501aba 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 _0xbf98=['stringify','stop','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x24e1b7,_0x530081){var _0x1cbbab=function(_0x1516d5){while(--_0x1516d5){_0x24e1b7['push'](_0x24e1b7['shift']());}};_0x1cbbab(++_0x530081);}(_0xbf98,0x1ea));var _0x8bf9=function(_0xebe7a0,_0x120a4f){_0xebe7a0=_0xebe7a0-0x0;var _0x199b57=_0xbf98[_0xebe7a0];return _0x199b57;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')('routing');exports[_0x8bf9('0x0')]=function(_0x474b93,_0x5d5ca7){return function(_0x251454){try{logger[_0x8bf9('0x1')](_0x8bf9('0x2'),_0x474b93,utils[_0x8bf9('0x3')](_0x5d5ca7[0x0],this));_0x251454[_0x8bf9('0x4')]();}catch(_0x29426c){logger[_0x8bf9('0x5')](_0x8bf9('0x2'),_0x474b93,JSON[_0x8bf9('0x6')](_0x29426c));_0x251454[_0x8bf9('0x7')]();}};}; \ No newline at end of file +var _0x148b=['[%s][NOOP]\x20%s','stringify','stop','./utils','routing','next'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x148b,0xe1));var _0xb148=function(_0x5b2f14,_0x25303e){_0x5b2f14=_0x5b2f14-0x0;var _0x2d3c9f=_0x148b[_0x5b2f14];return _0x2d3c9f;};'use strict';var utils=require(_0xb148('0x0'));var logger=require('../../../../config/logger')(_0xb148('0x1'));exports['consequence']=function(_0xafaabf,_0x28b591){return function(_0x38d3e2){try{logger['info']('[%s][NOOP]\x20%s',_0xafaabf,utils['getMustacheRender'](_0x28b591[0x0],this));_0x38d3e2[_0xb148('0x2')]();}catch(_0x24ce39){logger['error'](_0xb148('0x3'),_0xafaabf,JSON[_0xb148('0x4')](_0x24ce39));_0x38d3e2[_0xb148('0x5')]();}};}; \ 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 68b833a..9ec1f62 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 _0x9cbe=['createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','from','joinAt','emit','clone','queue','account','capitalize','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','waiting','accepted','update','timeout','update\x20queue\x20report','toLowerCase','consequence','length','map','stop','Queues'];(function(_0x1e1294,_0x93a69){var _0x276383=function(_0x24bccd){while(--_0x24bccd){_0x1e1294['push'](_0x1e1294['shift']());}};_0x276383(++_0x93a69);}(_0x9cbe,0xb1));var _0xe9cb=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x9cbe[_0x2f45ea];return _0x485a84;};'use strict';var schema=require(_0xe9cb('0x0'));var _=require('lodash');var util=require(_0xe9cb('0x1'));var seqqueue=require('seq-queue');var moment=require(_0xe9cb('0x2'));var Redis=require(_0xe9cb('0x3'));var config=require(_0xe9cb('0x4'));var logger=require(_0xe9cb('0x5'))(_0xe9cb('0x6'));var strategy=require(_0xe9cb('0x7'));config[_0xe9cb('0x8')]=_[_0xe9cb('0x9')](config[_0xe9cb('0x8')],{'host':_0xe9cb('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe9cb('0x8')]));var attributes=['id',_0xe9cb('0xb'),'account','queue',_0xe9cb('0xc'),_0xe9cb('0xd')];function emit(_0x534a8c,_0x4deca4,_0x142f14){io['to'](_0x534a8c)[_0xe9cb('0xe')](_0x4deca4,_0x142f14);}function emitChannelQueueInteraction(_0x17238d,_0x1effb5,_0x4b308e,_0x36280b,_0x181aa1,_0x23553a,_0x109c2d,_0x41dc7e){var _0x432de4=_[_0xe9cb('0xf')](_0x4b308e);_0x432de4[_0xe9cb('0xb')]=_0x41dc7e;_0x432de4[_0xe9cb('0x10')]=_0x1effb5;_0x432de4[_0xe9cb('0x11')]=_0x36280b;_0x432de4['id']=_0x181aa1;if(_0x23553a){attributes['push'](_[_0xe9cb('0x12')](_0x17238d)+'InteractionId');_0x109c2d[util[_0xe9cb('0x13')](_0xe9cb('0x14'),_0x17238d)][_0x181aa1]=_[_0xe9cb('0x15')](_0x432de4,attributes);}else{delete _0x109c2d[util['format'](_0xe9cb('0x14'),_0x17238d)][_0x181aa1];}emit(util[_0xe9cb('0x13')](_0xe9cb('0x16'),_0x17238d,_0x1effb5),util[_0xe9cb('0x13')](_0xe9cb('0x17'),_0x17238d,_0x23553a?_0xe9cb('0x18'):'remove'),_[_0xe9cb('0x15')](_0x432de4,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xe9cb('0x19')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xe9cb('0x1a')),'whatsappQueueReport':require(_0xe9cb('0x1b'))};var queue=schema({'name':{'type':_0xe9cb('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xe9cb('0x1d'),'message':_0xe9cb('0x1e')}});function startRouting(_0x36ba8f,_0x508585,_0x4ddcf6,_0x5590a1){if(_0x36ba8f&&_0x508585&&_0x4ddcf6){_0x508585['waiting']+=0x1;var _0x31ac49={'uniqueid':_0x36ba8f,'from':_0x4ddcf6[_0xe9cb('0x1f')]?_0x4ddcf6[_0xe9cb('0x1f')]['from']:'','joinAt':moment()[_0xe9cb('0x13')](_0xe9cb('0x20')),'ContactId':_0x4ddcf6['contact']?_0x4ddcf6['contact']['id']:null,'ListId':_0x4ddcf6[_0xe9cb('0x21')]?_0x4ddcf6['list']['id']:null};_0x31ac49[_[_0xe9cb('0x22')](_0x4ddcf6[_0xe9cb('0x23')])+_0xe9cb('0x24')]=_0x508585['id']||null;_0x31ac49[_['upperFirst'](_0x4ddcf6[_0xe9cb('0x23')])+_0xe9cb('0x25')]=_0x4ddcf6[_0xe9cb('0x26')]?_0x4ddcf6[_0xe9cb('0x26')]['id']:null;_0x31ac49[_['upperFirst'](_0x4ddcf6[_0xe9cb('0x23')])+_0xe9cb('0x27')]=_0x4ddcf6['message']?_0x4ddcf6[_0xe9cb('0x28')]['id']:null;_0x31ac49[_['upperFirst'](_0x4ddcf6['channel'])+(_0x4ddcf6[_0xe9cb('0x23')]!==_0xe9cb('0x29')?_0xe9cb('0x2a'):_0xe9cb('0x2b'))]=_0x4ddcf6[_0xe9cb('0x11')]?_0x4ddcf6['account']['id']:null;logger[_0xe9cb('0x2c')](util[_0xe9cb('0x13')](_0xe9cb('0x2d'),_0x36ba8f,_0x508585[_0xe9cb('0x2e')]));emitChannelQueueInteraction(_0x4ddcf6['channel'],_0x508585['name'],_0x31ac49,_0x4ddcf6[_0xe9cb('0x11')][_0xe9cb('0x2e')],_0x4ddcf6[_0xe9cb('0x28')]['id'],!![],_0x5590a1,_0x508585['id']);if(rpc[_0x4ddcf6[_0xe9cb('0x23')]+_0xe9cb('0x2f')]){return rpc[_0x4ddcf6[_0xe9cb('0x23')]+_0xe9cb('0x2f')][_0xe9cb('0x30')](_0x31ac49)[_0xe9cb('0x31')](function(_0x514a0d){logger[_0xe9cb('0x32')](_0xe9cb('0x33'));});}}}function stopRouting(_0x2e3bca,_0x2e3f6a,_0x22c3eb,_0x3a13e2){if(_0x2e3bca&&_0x2e3f6a){_0x2e3f6a[_0xe9cb('0x34')]-=0x1;var _0x3e93d8={'leaveAt':moment()[_0xe9cb('0x13')](_0xe9cb('0x20')),'acceptAt':moment()[_0xe9cb('0x13')](_0xe9cb('0x20')),'reason':_0xe9cb('0x35')};logger['info'](util[_0xe9cb('0x13')]('[%s][STOP:QUEUE][NAME:%s]',_0x2e3bca,_0x2e3f6a[_0xe9cb('0x2e')]));emitChannelQueueInteraction(_0x22c3eb[_0xe9cb('0x23')],_0x2e3f6a[_0xe9cb('0x2e')],_0x22c3eb['body'],_0x22c3eb['account'][_0xe9cb('0x2e')],_0x22c3eb[_0xe9cb('0x28')]['id'],![],_0x3a13e2,_0x2e3f6a['id']);if(rpc[_0x22c3eb[_0xe9cb('0x23')]+'QueueReport']){return rpc[_0x22c3eb['channel']+_0xe9cb('0x2f')][_0xe9cb('0x36')](_0x2e3bca,_0x3e93d8)[_0xe9cb('0x31')](function(_0x809ffd){logger[_0xe9cb('0x32')]('update\x20queue\x20report');});}}}function endRouting(_0x470ead,_0x7fc9ba,_0x46554c,_0xec6b84){if(_0x470ead&&_0x7fc9ba){_0x7fc9ba[_0xe9cb('0x34')]-=0x1;var _0x284485={'leaveAt':moment()[_0xe9cb('0x13')](_0xe9cb('0x20')),'exitAt':moment()[_0xe9cb('0x13')](_0xe9cb('0x20')),'reason':_0xe9cb('0x37')};logger[_0xe9cb('0x2c')](util['format']('[%s][END:QUEUE][NAME:%s]',_0x470ead,_0x7fc9ba[_0xe9cb('0x2e')]));emitChannelQueueInteraction(_0x46554c[_0xe9cb('0x23')],_0x7fc9ba[_0xe9cb('0x2e')],_0x46554c[_0xe9cb('0x1f')],_0x46554c[_0xe9cb('0x11')][_0xe9cb('0x2e')],_0x46554c[_0xe9cb('0x28')]['id'],![],_0xec6b84);if(rpc[_0x46554c[_0xe9cb('0x23')]+_0xe9cb('0x2f')]){return rpc[_0x46554c[_0xe9cb('0x23')]+_0xe9cb('0x2f')][_0xe9cb('0x36')](_0x470ead,_0x284485)[_0xe9cb('0x31')](function(_0x13b64f){logger[_0xe9cb('0x32')](_0xe9cb('0x38'));});}}}function handleFindQueue(_0x2320ef){return function(_0x304781){return _0x304781[_0xe9cb('0x2e')]['toLowerCase']()===_0x2320ef[_0xe9cb('0x39')]();};}exports[_0xe9cb('0x3a')]=function(_0x1c192d,_0x210d95,_0xd29acc,_0x36db68){return function(_0x2be0e4){try{var _0x6460f0={'name':_0x210d95[0x0],'timeout':_0x210d95[0x1]};var _0x4d7331=queue[_0xe9cb('0x0')](_0x6460f0,{'typecast':!![]});if(_0x4d7331[_0xe9cb('0x3b')]){logger['error']('[%s][QUEUE]\x20%s',_0x1c192d,_[_0xe9cb('0x3c')](_0x4d7331,_0xe9cb('0x28'))['join'](',\x20'));_0x2be0e4[_0xe9cb('0x3d')]();}else{var _0x2f30d6=_['find'](_0xd29acc[_0x36db68[_0xe9cb('0x23')]+_0xe9cb('0x3e')],handleFindQueue(_0x6460f0[_0xe9cb('0x2e')]));if(_0x2f30d6){startRouting(_0x1c192d,_0x2f30d6,_0x36db68,_0xd29acc);var _0x415d3a=(_0x2f30d6[_0xe9cb('0x37')]||0xa)*0x3e8;var _0x1e9010=(_0x6460f0[_0xe9cb('0x37')]||0x14)*0x3e8;var _0x539c19;if(_0x415d3a>_0x1e9010){_0x1e9010=_0x415d3a;}var _0xe8e78b=seqqueue[_0xe9cb('0x3f')](_0x415d3a);_0xe8e78b['id']=_0x1c192d;_0xe8e78b[_0xe9cb('0x40')]=_0x415d3a;_0xe8e78b[_0xe9cb('0x41')]=_0x1e9010;_0xe8e78b['channel']=_0x36db68[_0xe9cb('0x23')];_0xd29acc[_0xe9cb('0x42')][_0x1c192d]['on'](_0xe9cb('0x43'),function(){logger[_0xe9cb('0x2c')](_0xe9cb('0x44'),_0x1c192d);stopRouting(_0x1c192d,_0x2f30d6,_0x36db68,_0xd29acc);clearTimeout(_0x539c19);_0x539c19=undefined;_0xe8e78b['close'](!![]);if(_0xd29acc[_0xe9cb('0x42')][_0x1c192d]){delete _0xd29acc[_0xe9cb('0x42')][_0x1c192d];}_0x2be0e4[_0xe9cb('0x3d')]();});_0xd29acc[_0xe9cb('0x42')][_0x1c192d]['on'](_0xe9cb('0x45'),function(){if(_0xd29acc[_0xe9cb('0x42')][_0x1c192d]){delete _0xd29acc[_0xe9cb('0x42')][_0x1c192d];}});_0x539c19=setTimeout(function(){logger[_0xe9cb('0x2c')](_0xe9cb('0x46'),_0x1c192d);endRouting(_0x1c192d,_0x2f30d6,_0x36db68,_0xd29acc);clearTimeout(_0x539c19);_0xe8e78b[_0xe9cb('0x47')](!![]);_0x2be0e4[_0xe9cb('0x48')]();},_0x1e9010);switch(_0x2f30d6[_0xe9cb('0x49')]){case _0xe9cb('0x4a'):strategy[_0xe9cb('0x4a')](_0xe8e78b,_0x2f30d6,_0xd29acc,_0x36db68);break;default:strategy[_0xe9cb('0x4b')](_0xe8e78b,_0x2f30d6,_0xd29acc,_0x36db68);}}else{logger['error'](_0xe9cb('0x4c'),_0x1c192d,_0x6460f0[_0xe9cb('0x2e')]);_0x2be0e4[_0xe9cb('0x3d')]();}}}catch(_0x41f2cd){console[_0xe9cb('0x4d')](_0x41f2cd);logger['error'](_0xe9cb('0x4e'),_0x1c192d,_0x41f2cd[_0xe9cb('0x4f')]);_0x2be0e4[_0xe9cb('0x3d')]();}};}; \ No newline at end of file +var _0x565f=['create\x20queue\x20report','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','qtimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','localhost','socket.io-emitter','redis','from','emit','clone','queue_id','account','push','capitalize','InteractionId','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','interaction','MessageId','message','chat','name','QueueReport','error'];(function(_0x7c539b,_0x1d6ece){var _0x414235=function(_0x12bb7f){while(--_0x12bb7f){_0x7c539b['push'](_0x7c539b['shift']());}};_0x414235(++_0x1d6ece);}(_0x565f,0x1a5));var _0xf565=function(_0x1e7903,_0x2c0ccd){_0x1e7903=_0x1e7903-0x0;var _0x215f92=_0x565f[_0x1e7903];return _0x215f92;};'use strict';var schema=require(_0xf565('0x0'));var _=require(_0xf565('0x1'));var util=require(_0xf565('0x2'));var seqqueue=require('seq-queue');var moment=require('moment');var Redis=require('ioredis');var config=require(_0xf565('0x3'));var logger=require(_0xf565('0x4'))(_0xf565('0x5'));var strategy=require(_0xf565('0x6'));config['redis']=_[_0xf565('0x7')](config['redis'],{'host':_0xf565('0x8'),'port':0x18eb});var io=require(_0xf565('0x9'))(new Redis(config[_0xf565('0xa')]));var attributes=['id','queue_id','account','queue',_0xf565('0xb'),'joinAt'];function emit(_0x3e24f5,_0x51cd55,_0x13a93b){io['to'](_0x3e24f5)[_0xf565('0xc')](_0x51cd55,_0x13a93b);}function emitChannelQueueInteraction(_0x1a48e0,_0x199979,_0x26dead,_0x326e55,_0x139b08,_0x29e9b1,_0x323e90,_0x2ece38){var _0x781328=_[_0xf565('0xd')](_0x26dead);_0x781328[_0xf565('0xe')]=_0x2ece38;_0x781328['queue']=_0x199979;_0x781328[_0xf565('0xf')]=_0x326e55;_0x781328['id']=_0x139b08;if(_0x29e9b1){attributes[_0xf565('0x10')](_[_0xf565('0x11')](_0x1a48e0)+_0xf565('0x12'));_0x323e90[util[_0xf565('0x13')]('%sQueuesWaitingInteractions',_0x1a48e0)][_0x139b08]=_[_0xf565('0x14')](_0x781328,attributes);}else{delete _0x323e90[util[_0xf565('0x13')](_0xf565('0x15'),_0x1a48e0)][_0x139b08];}emit(util[_0xf565('0x13')](_0xf565('0x16'),_0x1a48e0,_0x199979),util[_0xf565('0x13')](_0xf565('0x17'),_0x1a48e0,_0x29e9b1?_0xf565('0x18'):_0xf565('0x19')),_[_0xf565('0x14')](_0x781328,attributes));}var rpc={'openchannelQueueReport':require(_0xf565('0x1a')),'mailQueueReport':require(_0xf565('0x1b')),'chatQueueReport':require(_0xf565('0x1c')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xf565('0x1d')),'whatsappQueueReport':require(_0xf565('0x1e'))};var queue=schema({'name':{'type':_0xf565('0x1f'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xf565('0x20')}});function startRouting(_0x4fab11,_0x1ce7e2,_0x30dfff,_0x554995){if(_0x4fab11&&_0x1ce7e2&&_0x30dfff){_0x1ce7e2[_0xf565('0x21')]+=0x1;var _0x133190={'uniqueid':_0x4fab11,'from':_0x30dfff[_0xf565('0x22')]?_0x30dfff['body'][_0xf565('0xb')]:'','joinAt':moment()[_0xf565('0x13')](_0xf565('0x23')),'ContactId':_0x30dfff[_0xf565('0x24')]?_0x30dfff[_0xf565('0x24')]['id']:null,'ListId':_0x30dfff[_0xf565('0x25')]?_0x30dfff[_0xf565('0x25')]['id']:null};_0x133190[_[_0xf565('0x26')](_0x30dfff[_0xf565('0x27')])+'QueueId']=_0x1ce7e2['id']||null;_0x133190[_[_0xf565('0x26')](_0x30dfff['channel'])+'InteractionId']=_0x30dfff[_0xf565('0x28')]?_0x30dfff[_0xf565('0x28')]['id']:null;_0x133190[_['upperFirst'](_0x30dfff[_0xf565('0x27')])+_0xf565('0x29')]=_0x30dfff[_0xf565('0x2a')]?_0x30dfff[_0xf565('0x2a')]['id']:null;_0x133190[_['upperFirst'](_0x30dfff[_0xf565('0x27')])+(_0x30dfff[_0xf565('0x27')]!==_0xf565('0x2b')?'AccountId':'WebsiteId')]=_0x30dfff[_0xf565('0xf')]?_0x30dfff[_0xf565('0xf')]['id']:null;logger['info'](util[_0xf565('0x13')]('[%s][START:QUEUE][NAME:%s]',_0x4fab11,_0x1ce7e2[_0xf565('0x2c')]));emitChannelQueueInteraction(_0x30dfff[_0xf565('0x27')],_0x1ce7e2[_0xf565('0x2c')],_0x133190,_0x30dfff[_0xf565('0xf')]['name'],_0x30dfff['message']['id'],!![],_0x554995,_0x1ce7e2['id']);if(rpc[_0x30dfff['channel']+_0xf565('0x2d')]){return rpc[_0x30dfff[_0xf565('0x27')]+_0xf565('0x2d')]['create'](_0x133190)['catch'](function(_0x308459){logger[_0xf565('0x2e')](_0xf565('0x2f'));});}}}function stopRouting(_0x12344c,_0x2001cd,_0x190526,_0x1e8be5){if(_0x12344c&&_0x2001cd){_0x2001cd[_0xf565('0x21')]-=0x1;var _0x178906={'leaveAt':moment()['format'](_0xf565('0x23')),'acceptAt':moment()[_0xf565('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xf565('0x30')};logger[_0xf565('0x31')](util[_0xf565('0x13')](_0xf565('0x32'),_0x12344c,_0x2001cd[_0xf565('0x2c')]));emitChannelQueueInteraction(_0x190526['channel'],_0x2001cd['name'],_0x190526[_0xf565('0x22')],_0x190526['account']['name'],_0x190526[_0xf565('0x2a')]['id'],![],_0x1e8be5,_0x2001cd['id']);if(rpc[_0x190526[_0xf565('0x27')]+_0xf565('0x2d')]){return rpc[_0x190526[_0xf565('0x27')]+_0xf565('0x2d')][_0xf565('0x33')](_0x12344c,_0x178906)[_0xf565('0x34')](function(_0x1ef341){logger[_0xf565('0x2e')](_0xf565('0x35'));});}}}function endRouting(_0x154bde,_0x8408d8,_0x13fcc0,_0x4d5360){if(_0x154bde&&_0x8408d8){_0x8408d8['waiting']-=0x1;var _0x1a1b79={'leaveAt':moment()['format'](_0xf565('0x23')),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xf565('0x36')};logger['info'](util[_0xf565('0x13')](_0xf565('0x37'),_0x154bde,_0x8408d8[_0xf565('0x2c')]));emitChannelQueueInteraction(_0x13fcc0[_0xf565('0x27')],_0x8408d8['name'],_0x13fcc0[_0xf565('0x22')],_0x13fcc0[_0xf565('0xf')]['name'],_0x13fcc0[_0xf565('0x2a')]['id'],![],_0x4d5360);if(rpc[_0x13fcc0[_0xf565('0x27')]+_0xf565('0x2d')]){return rpc[_0x13fcc0['channel']+_0xf565('0x2d')][_0xf565('0x33')](_0x154bde,_0x1a1b79)[_0xf565('0x34')](function(_0x55fe30){logger[_0xf565('0x2e')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x191cb0){return function(_0x4fd06a){return _0x4fd06a['name']['toLowerCase']()===_0x191cb0[_0xf565('0x38')]();};}exports[_0xf565('0x39')]=function(_0x2cf8de,_0x3e67bf,_0x4e76bb,_0x3ff76c){return function(_0x1b7ec3){try{var _0xa88592={'name':_0x3e67bf[0x0],'timeout':_0x3e67bf[0x1]};var _0x99f21f=queue[_0xf565('0x0')](_0xa88592,{'typecast':!![]});if(_0x99f21f[_0xf565('0x3a')]){logger[_0xf565('0x2e')](_0xf565('0x3b'),_0x2cf8de,_[_0xf565('0x3c')](_0x99f21f,_0xf565('0x2a'))[_0xf565('0x3d')](',\x20'));_0x1b7ec3[_0xf565('0x3e')]();}else{var _0x6948f3=_[_0xf565('0x3f')](_0x4e76bb[_0x3ff76c[_0xf565('0x27')]+_0xf565('0x40')],handleFindQueue(_0xa88592[_0xf565('0x2c')]));if(_0x6948f3){startRouting(_0x2cf8de,_0x6948f3,_0x3ff76c,_0x4e76bb);var _0x31c7c8=(_0x6948f3[_0xf565('0x36')]||0xa)*0x3e8;var _0x4a8f87=(_0xa88592[_0xf565('0x36')]||0x14)*0x3e8;var _0x452e75;if(_0x31c7c8>_0x4a8f87){_0x4a8f87=_0x31c7c8;}var _0x1f45c4=seqqueue[_0xf565('0x41')](_0x31c7c8);_0x1f45c4['id']=_0x2cf8de;_0x1f45c4['atimeout']=_0x31c7c8;_0x1f45c4[_0xf565('0x42')]=_0x4a8f87;_0x1f45c4[_0xf565('0x27')]=_0x3ff76c[_0xf565('0x27')];_0x4e76bb[_0xf565('0x43')][_0x2cf8de]['on'](_0xf565('0x44'),function(){logger[_0xf565('0x31')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x2cf8de);stopRouting(_0x2cf8de,_0x6948f3,_0x3ff76c,_0x4e76bb);clearTimeout(_0x452e75);_0x452e75=undefined;_0x1f45c4[_0xf565('0x45')](!![]);if(_0x4e76bb[_0xf565('0x43')][_0x2cf8de]){delete _0x4e76bb['rules'][_0x2cf8de];}_0x1b7ec3['stop']();});_0x4e76bb[_0xf565('0x43')][_0x2cf8de]['on'](_0xf565('0x46'),function(){if(_0x4e76bb['rules'][_0x2cf8de]){delete _0x4e76bb['rules'][_0x2cf8de];}});_0x452e75=setTimeout(function(){logger[_0xf565('0x31')](_0xf565('0x47'),_0x2cf8de);endRouting(_0x2cf8de,_0x6948f3,_0x3ff76c,_0x4e76bb);clearTimeout(_0x452e75);_0x1f45c4['close'](!![]);_0x1b7ec3[_0xf565('0x48')]();},_0x4a8f87);switch(_0x6948f3[_0xf565('0x49')]){case _0xf565('0x4a'):strategy[_0xf565('0x4a')](_0x1f45c4,_0x6948f3,_0x4e76bb,_0x3ff76c);break;default:strategy[_0xf565('0x4b')](_0x1f45c4,_0x6948f3,_0x4e76bb,_0x3ff76c);}}else{logger[_0xf565('0x2e')](_0xf565('0x4c'),_0x2cf8de,_0xa88592['name']);_0x1b7ec3[_0xf565('0x3e')]();}}}catch(_0x2b7d6a){console['log'](_0x2b7d6a);logger[_0xf565('0x2e')](_0xf565('0x3b'),_0x2cf8de,_0x2b7d6a[_0xf565('0x4d')]);_0x1b7ec3[_0xf565('0x3e')]();}};}; \ 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 a3841b3..a856c3c 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 _0xb844=['busyQueue','TIMEOUT','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','debug','isNil','realtime','agents','forcedOwnership','channel','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','busy'];(function(_0x3e676b,_0x294c9c){var _0x1b6dc3=function(_0x1a9b9d){while(--_0x1a9b9d){_0x3e676b['push'](_0x3e676b['shift']());}};_0x1b6dc3(++_0x294c9c);}(_0xb844,0x146));var _0x4b84=function(_0x8b62a9,_0x17b817){_0x8b62a9=_0x8b62a9-0x0;var _0x1a9082=_0xb844[_0x8b62a9];return _0x1a9082;};'use strict';var _=require('lodash');var uuid=require(_0x4b84('0x0'));var util=require('./util');var logger=require(_0x4b84('0x1'))(_0x4b84('0x2'));var Agent=function(_0x267048,_0x1cda16,_0x5a23cb,_0x19f69e){this[_0x4b84('0x3')]=uuid['v4']();this[_0x4b84('0x4')]=_0x267048;this[_0x4b84('0x5')]=_0x1cda16;this['realtime']=_0x5a23cb;this[_0x4b84('0x2')]=_0x19f69e;this['squeue'][_0x4b84('0x6')](this[_0x4b84('0x7')][_0x4b84('0x8')](this),this[_0x4b84('0x9')][_0x4b84('0x8')](this));this[_0x4b84('0x4')]['on'](_0x4b84('0xa'),this[_0x4b84('0x9')][_0x4b84('0x8')](this));this[_0x4b84('0x4')]['on']('drained',this[_0x4b84('0xb')][_0x4b84('0x8')](this));};Agent[_0x4b84('0xc')][_0x4b84('0x6')]=function(){this[_0x4b84('0x4')][_0x4b84('0x6')](this[_0x4b84('0x7')]['bind'](this),this[_0x4b84('0x9')][_0x4b84('0x8')](this));};Agent[_0x4b84('0xc')][_0x4b84('0xb')]=function(){this[_0x4b84('0x9')](!![]);};Agent[_0x4b84('0xc')]['handleRun']=function(){logger[_0x4b84('0xd')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x4b84('0x4')]['id'],this['agent']['id']);if(_[_0x4b84('0xe')](this[_0x4b84('0xf')][_0x4b84('0x10')][this[_0x4b84('0x5')]['id']])){logger[_0x4b84('0xd')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x4b84('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x4b84('0x6')][_0x4b84('0x8')](this),0x3e8);}else{if(this['routing'][_0x4b84('0x11')]||util['isAgentAvailable'](this[_0x4b84('0x4')]['id'],this[_0x4b84('0xf')][_0x4b84('0x10')][this[_0x4b84('0x5')]['id']],this['squeue'][_0x4b84('0x12')],![])){this[_0x4b84('0xf')][_0x4b84('0x10')][this[_0x4b84('0x5')]['id']]['busy']=!![];this[_0x4b84('0xf')][_0x4b84('0x10')][this[_0x4b84('0x5')]['id']]['busyQueue']=undefined;util[_0x4b84('0x13')](this['notificationId'],this[_0x4b84('0x4')]['id'],this[_0x4b84('0xf')][_0x4b84('0x10')][this[_0x4b84('0x5')]['id']],null,this[_0x4b84('0x2')]);util[_0x4b84('0x14')](this[_0x4b84('0x4')]['id'],this[_0x4b84('0xf')][_0x4b84('0x10')][this[_0x4b84('0x5')]['id']],'RINGING'+(this[_0x4b84('0x2')]['forcedOwnership']?_0x4b84('0x15'):''));}else{logger['debug'](_0x4b84('0x16'),this[_0x4b84('0x4')]['id'],this[_0x4b84('0x5')]['id']);setTimeout(this[_0x4b84('0x6')][_0x4b84('0x8')](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x10c98c){if(_['isNil'](this[_0x4b84('0xf')]['agents'][this[_0x4b84('0x5')]['id']])){return logger[_0x4b84('0xd')](_0x4b84('0x17'),this[_0x4b84('0x4')]['id'],this[_0x4b84('0x5')]['id']);}else{logger[_0x4b84('0xd')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this['agent']['id']);util['hideNotification'](this[_0x4b84('0x3')],this[_0x4b84('0x4')]['id'],this[_0x4b84('0xf')][_0x4b84('0x10')][this[_0x4b84('0x5')]['id']],null,this[_0x4b84('0x2')]);this['realtime'][_0x4b84('0x10')][this[_0x4b84('0x5')]['id']][_0x4b84('0x18')]=![];this['realtime']['agents'][this[_0x4b84('0x5')]['id']][_0x4b84('0x19')]=undefined;util[_0x4b84('0x14')](this[_0x4b84('0x4')]['id'],this['realtime'][_0x4b84('0x10')][this[_0x4b84('0x5')]['id']],_0x10c98c?'STOP':_0x4b84('0x1a'));}if(!_0x10c98c){setTimeout(this[_0x4b84('0x6')]['bind'](this),0x3e8);}};function agent(_0x3cbbfe,_0x6a65ec,_0x2434ab,_0x4a7807){return new Agent(_0x3cbbfe,_0x6a65ec,_0x2434ab,_0x4a7807);}module['exports']=agent; \ No newline at end of file +var _0x5f58=['[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','prototype','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','forcedOwnership','isAgentAvailable','agents','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x5f58,0x162));var _0x85f5=function(_0x48f392,_0x4bbef4){_0x48f392=_0x48f392-0x0;var _0x19c1e3=_0x5f58[_0x48f392];return _0x19c1e3;};'use strict';var _=require('lodash');var uuid=require(_0x85f5('0x0'));var util=require(_0x85f5('0x1'));var logger=require(_0x85f5('0x2'))(_0x85f5('0x3'));var Agent=function(_0x3785f7,_0x429d36,_0x23b80c,_0x5ce58b){this[_0x85f5('0x4')]=uuid['v4']();this[_0x85f5('0x5')]=_0x3785f7;this['agent']=_0x429d36;this[_0x85f5('0x6')]=_0x23b80c;this[_0x85f5('0x3')]=_0x5ce58b;this[_0x85f5('0x5')][_0x85f5('0x7')](this[_0x85f5('0x8')][_0x85f5('0x9')](this),this[_0x85f5('0xa')][_0x85f5('0x9')](this));this['squeue']['on'](_0x85f5('0xb'),this[_0x85f5('0xa')][_0x85f5('0x9')](this));this[_0x85f5('0x5')]['on'](_0x85f5('0xc'),this['handleDrained'][_0x85f5('0x9')](this));};Agent['prototype']['push']=function(){this[_0x85f5('0x5')][_0x85f5('0x7')](this[_0x85f5('0x8')][_0x85f5('0x9')](this),this[_0x85f5('0xa')][_0x85f5('0x9')](this));};Agent[_0x85f5('0xd')][_0x85f5('0xe')]=function(){this[_0x85f5('0xa')](!![]);};Agent[_0x85f5('0xd')][_0x85f5('0x8')]=function(){logger[_0x85f5('0xf')](_0x85f5('0x10'),this[_0x85f5('0x5')]['id'],this[_0x85f5('0x11')]['id']);if(_[_0x85f5('0x12')](this['realtime']['agents'][this[_0x85f5('0x11')]['id']])){logger[_0x85f5('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x85f5('0x5')]['id'],this[_0x85f5('0x11')]['id']);setTimeout(this[_0x85f5('0x7')][_0x85f5('0x9')](this),0x3e8);}else{if(this[_0x85f5('0x3')][_0x85f5('0x13')]||util[_0x85f5('0x14')](this['squeue']['id'],this[_0x85f5('0x6')][_0x85f5('0x15')][this['agent']['id']],this['squeue'][_0x85f5('0x16')],![])){this[_0x85f5('0x6')][_0x85f5('0x15')][this['agent']['id']][_0x85f5('0x17')]=!![];this[_0x85f5('0x6')]['agents'][this[_0x85f5('0x11')]['id']][_0x85f5('0x18')]=undefined;util[_0x85f5('0x19')](this[_0x85f5('0x4')],this[_0x85f5('0x5')]['id'],this[_0x85f5('0x6')][_0x85f5('0x15')][this[_0x85f5('0x11')]['id']],null,this['routing']);util[_0x85f5('0x1a')](this[_0x85f5('0x5')]['id'],this[_0x85f5('0x6')][_0x85f5('0x15')][this['agent']['id']],_0x85f5('0x1b')+(this[_0x85f5('0x3')]['forcedOwnership']?_0x85f5('0x1c'):''));}else{logger[_0x85f5('0xf')](_0x85f5('0x1d'),this[_0x85f5('0x5')]['id'],this[_0x85f5('0x11')]['id']);setTimeout(this[_0x85f5('0x7')][_0x85f5('0x9')](this),0x3e8);}}};Agent[_0x85f5('0xd')][_0x85f5('0xa')]=function(_0x300c56){if(_[_0x85f5('0x12')](this[_0x85f5('0x6')]['agents'][this['agent']['id']])){return logger[_0x85f5('0xf')](_0x85f5('0x1e'),this[_0x85f5('0x5')]['id'],this[_0x85f5('0x11')]['id']);}else{logger[_0x85f5('0xf')](_0x85f5('0x1f'),this[_0x85f5('0x5')]['id'],this[_0x85f5('0x11')]['id']);util[_0x85f5('0x20')](this[_0x85f5('0x4')],this[_0x85f5('0x5')]['id'],this[_0x85f5('0x6')][_0x85f5('0x15')][this['agent']['id']],null,this['routing']);this['realtime'][_0x85f5('0x15')][this[_0x85f5('0x11')]['id']][_0x85f5('0x17')]=![];this[_0x85f5('0x6')][_0x85f5('0x15')][this[_0x85f5('0x11')]['id']]['busyQueue']=undefined;util['writeLog'](this['squeue']['id'],this['realtime'][_0x85f5('0x15')][this['agent']['id']],_0x300c56?_0x85f5('0x21'):_0x85f5('0x22'));}if(!_0x300c56){setTimeout(this[_0x85f5('0x7')][_0x85f5('0x9')](this),0x3e8);}};function agent(_0x3657bf,_0x2fbead,_0x2437cb,_0x18a938){return new Agent(_0x3657bf,_0x2fbead,_0x2437cb,_0x18a938);}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 f66b3c2..059d40e 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 _0xb11e=['realtime','push','handleTimeout','bind','drained','handleDrained','prototype','handleRun','isNil','queue','Agents','length','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','agents','RINGING','busy','busyQueue','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','writeLog','STOP','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue'];(function(_0x555890,_0xd516c8){var _0x3e574b=function(_0x4fa027){while(--_0x4fa027){_0x555890['push'](_0x555890['shift']());}};_0x3e574b(++_0xd516c8);}(_0xb11e,0x7d));var _0xeb11=function(_0x484d51,_0x5123aa){_0x484d51=_0x484d51-0x0;var _0x5a2f8e=_0xb11e[_0x484d51];return _0x5a2f8e;};'use strict';var _=require(_0xeb11('0x0'));var uuid=require(_0xeb11('0x1'));var util=require(_0xeb11('0x2'));var logger=require(_0xeb11('0x3'))(_0xeb11('0x4'));var Beepall=function(_0x47e4c3,_0x5753d5,_0x3a68aa,_0x12aded){this[_0xeb11('0x5')]=uuid['v4']();this[_0xeb11('0x6')]=_0x47e4c3;this['queue']=_0x5753d5;this[_0xeb11('0x7')]=_0x3a68aa;this['routing']=_0x12aded;this['squeue'][_0xeb11('0x8')](this['handleRun']['bind'](this),this[_0xeb11('0x9')][_0xeb11('0xa')](this));this[_0xeb11('0x6')]['on']('timeout',this[_0xeb11('0x9')][_0xeb11('0xa')](this));this[_0xeb11('0x6')]['on'](_0xeb11('0xb'),this[_0xeb11('0xc')][_0xeb11('0xa')](this));};Beepall[_0xeb11('0xd')][_0xeb11('0x8')]=function(){this['squeue'][_0xeb11('0x8')](this[_0xeb11('0xe')][_0xeb11('0xa')](this),this['handleTimeout'][_0xeb11('0xa')](this));};Beepall['prototype'][_0xeb11('0xc')]=function(){this['handleTimeout'](!![]);};Beepall['prototype'][_0xeb11('0xe')]=function(){var _0x2e0d2c=!![];if(!_[_0xeb11('0xf')](this[_0xeb11('0x10')])&&!_['isNil'](this['queue'][_0xeb11('0x11')])&&this[_0xeb11('0x10')][_0xeb11('0x11')]['length']>0x0){for(var _0x23acb4=0x0,_0x5152f4;_0x23acb40x0){for(var _0x128004=0x0,_0x99f4dd;_0x1280040x0&&_0x5b85cc[_0x585243+_0x72d1('0x21')]>=_0x5b85cc[_0x585243+_0x72d1('0x22')]){writeLog(_0x506062,_0x5b85cc,_0x585243[_0x72d1('0x23')]()+_0x72d1('0x24'));return![];}}return!![];};exports[_0x72d1('0x25')]=function(_0x589f7c,_0x57ec9e,_0x1ba258,_0x482cb8,_0x18ca85){return sendNotification(!![],_0x589f7c,_0x57ec9e,_0x1ba258,_0x482cb8,_0x18ca85);};exports[_0x72d1('0x26')]=function(_0x2c113d,_0x4da489,_0x1c4b21,_0x4c4c41,_0x707cd0){return sendNotification(![],_0x2c113d,_0x4da489,_0x1c4b21,_0x4c4c41,_0x707cd0);};exports[_0x72d1('0x27')]=writeLog; \ No newline at end of file +var _0x33c5=['notificationSound','body','queue','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','debug','busy','BUSY','online','OFFLINE','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','writeLog','util','../utils','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','format','user:%s','name','emit','user:save','\x20interaction','account'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0x33c5,0xe6));var _0x533c=function(_0xf80b3,_0x25d5f3){_0xf80b3=_0xf80b3-0x0;var _0x10c489=_0x33c5[_0xf80b3];return _0x10c489;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var utils=require(_0x533c('0x1'));var Redis=require('ioredis');var config=require(_0x533c('0x2'));var logger=require(_0x533c('0x3'))(_0x533c('0x4'));config[_0x533c('0x5')]=_[_0x533c('0x6')](config['redis'],{'host':_0x533c('0x7'),'port':0x18eb});var io=require(_0x533c('0x8'))(new Redis(config[_0x533c('0x5')]));function sendNotification(_0x151732,_0x34ca89,_0x1699d5,_0x3a009b,_0x36d74e,_0x2c297c){io['to'](util[_0x533c('0x9')](_0x533c('0xa'),_0x3a009b[_0x533c('0xb')]))[_0x533c('0xc')](_0x533c('0xd'),_0x3a009b);var _0x430c51=_0x2c297c||{};var _0x1b312e=_0x1699d5['split']('.');var _0x6eeb6d={'uniqueid':_0x34ca89,'channel':_0x1b312e[0x0],'id':_0x1b312e[0x1],'title':_0x1b312e[0x0]+_0x533c('0xe'),'interactionId':_0x1b312e[0x2],'queue':_0x36d74e?_0x36d74e[_0x533c('0xb')]:null,'sound':_0x430c51[_0x533c('0xf')][_0x533c('0x10')],'shake':_0x430c51[_0x533c('0xf')]['notificationShake']};try{if(!_0x430c51[_0x533c('0x11')]){_0x430c51[_0x533c('0x11')]={};}if(_0x36d74e){_0x430c51[_0x533c('0x11')][_0x533c('0x12')]=_0x36d74e;}else if(_0x430c51[_0x533c('0x11')][_0x533c('0x12')]){delete _0x430c51[_0x533c('0x11')][_0x533c('0x12')];}_0x6eeb6d['msg']=utils[_0x533c('0x13')](_0x430c51[_0x533c('0xf')][_0x533c('0x14')],_0x430c51);}catch(_0x3e544f){_0x6eeb6d['msg']=_0x533c('0x15');logger[_0x533c('0x16')](util[_0x533c('0x9')](_0x533c('0x17'),_0x34ca89,_0x3e544f[_0x533c('0x18')]));}io['to'](util[_0x533c('0x9')](_0x533c('0xa'),_0x3a009b[_0x533c('0xb')]))[_0x533c('0xc')](util[_0x533c('0x9')](_0x533c('0x19'),_0x151732?_0x533c('0x1a'):_0x533c('0x1b')),_0x6eeb6d);}function writeLog(_0x23f970,_0x2f21db,_0x3de9fa){return logger[_0x533c('0x1c')](util[_0x533c('0x9')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x23f970,_0x2f21db[_0x533c('0xb')],_0x3de9fa));}exports['isAgentAvailable']=function(_0x57f5aa,_0x44ff98,_0x36d4e4,_0x5f5090){if(_0x44ff98[_0x533c('0x1d')]){writeLog(_0x57f5aa,_0x44ff98,_0x533c('0x1e'));return![];}if(!_0x44ff98[_0x533c('0x1f')]){writeLog(_0x57f5aa,_0x44ff98,_0x533c('0x20'));return![];}if(_0x44ff98[_0x36d4e4+'Pause']){writeLog(_0x57f5aa,_0x44ff98,_0x533c('0x21'));return![];}if(_0x5f5090&&_0x44ff98[_0x533c('0x22')](_0x36d4e4+_0x533c('0x23'))&&_0x44ff98[_0x533c('0x22')](_0x36d4e4+_0x533c('0x24'))){if(_0x44ff98[_0x36d4e4+_0x533c('0x23')]>0x0&&_0x44ff98[_0x36d4e4+_0x533c('0x24')]>=_0x44ff98[_0x36d4e4+_0x533c('0x23')]){writeLog(_0x57f5aa,_0x44ff98,_0x36d4e4[_0x533c('0x25')]()+_0x533c('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x11d775,_0xfab4da,_0x503c2e,_0x3caaa5,_0x4f9f4a){return sendNotification(!![],_0x11d775,_0xfab4da,_0x503c2e,_0x3caaa5,_0x4f9f4a);};exports[_0x533c('0x27')]=function(_0x14d783,_0x4a0e86,_0x8dd7f1,_0x425f60,_0x146a8e){return sendNotification(![],_0x14d783,_0x4a0e86,_0x8dd7f1,_0x425f60,_0x146a8e);};exports[_0x533c('0x28')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index cccbd43..59bd8e4 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 _0x6d4f=['replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','info','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s'];(function(_0x41f7cd,_0x2d7b0f){var _0x205138=function(_0x4b52b7){while(--_0x4b52b7){_0x41f7cd['push'](_0x41f7cd['shift']());}};_0x205138(++_0x2d7b0f);}(_0x6d4f,0xee));var _0xf6d4=function(_0x57d4c4,_0x1eb1c7){_0x57d4c4=_0x57d4c4-0x0;var _0x551561=_0x6d4f[_0x57d4c4];return _0x551561;};'use strict';var schema=require(_0xf6d4('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require('./utils');var logger=require(_0xf6d4('0x1'))(_0xf6d4('0x2'));var system=schema({'command':{'type':_0xf6d4('0x3'),'required':!![],'message':_0xf6d4('0x4')}});exports[_0xf6d4('0x5')]=function(_0x3168d3,_0x1c75a1){return function(_0x2047f9){try{var _0xac0926={'command':_0x1c75a1[0x0]};var _0x40088e=system[_0xf6d4('0x0')](_0xac0926,{'typecast':!![]});if(_0x40088e[_0xf6d4('0x6')]){logger[_0xf6d4('0x7')](_0xf6d4('0x8'),_0x3168d3,_[_0xf6d4('0x9')](_0x40088e,_0xf6d4('0xa'))['join'](',\x20'));logger[_0xf6d4('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3168d3);_0x2047f9['next']();}else{var _0x5cea17=this;var _0x3d9db5=utils['getMustacheRender'](_0x1c75a1[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x3168d3,_0x3d9db5);sh[_0xf6d4('0xc')](_[_0xf6d4('0xd')](_0x3d9db5),function(_0x57b53a,_0x42fdbb){logger[_0xf6d4('0xb')](_0xf6d4('0xe'),_0x3168d3,_0x57b53a);if(_0x57b53a==0x0){var _0x2e5a37=_0x42fdbb[_0xf6d4('0xf')](/(\r\n|\n|\r)/gm,'');if(_[_0xf6d4('0x10')](_0x1c75a1[0x1])||_['isEmpty'](_0x1c75a1[0x1])){logger['info'](_0xf6d4('0x11'),_0x3168d3);_0x5cea17[_0xf6d4('0x12')][_0x1c75a1[0x1]]=_0x2e5a37;}else{logger[_0xf6d4('0xb')](_0xf6d4('0x13'),_0x3168d3,_0x1c75a1[0x1],_0x2e5a37);_0x5cea17[_0xf6d4('0x12')][_0x1c75a1[0x1]]=_0x2e5a37;}}_0x2047f9['next']();});}}catch(_0x459897){logger[_0xf6d4('0x7')](_0xf6d4('0x8'),_0x3168d3,_[_0xf6d4('0x14')](_0x459897)?JSON[_0xf6d4('0x15')](_0x459897):_0x459897);logger['info'](_0xf6d4('0x16'),_0x3168d3);_0x2047f9['next']();}};}; \ No newline at end of file +var _0xef33=['length','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','replace','isNil','isEmpty','body','isObject','lodash','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate'];(function(_0x1b8f91,_0xcf62ea){var _0x39dbd0=function(_0x4dddc0){while(--_0x4dddc0){_0x1b8f91['push'](_0x1b8f91['shift']());}};_0x39dbd0(++_0xcf62ea);}(_0xef33,0x1af));var _0x3ef3=function(_0x322f90,_0x5b36d0){_0x322f90=_0x322f90-0x0;var _0x3c3f93=_0xef33[_0x322f90];return _0x3c3f93;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0x3ef3('0x0'));var utils=require('./utils');var logger=require(_0x3ef3('0x1'))(_0x3ef3('0x2'));var system=schema({'command':{'type':'string','required':!![],'message':_0x3ef3('0x3')}});exports[_0x3ef3('0x4')]=function(_0x2e9103,_0x3965b2){return function(_0x5064bd){try{var _0x3f0cb9={'command':_0x3965b2[0x0]};var _0x2e546d=system[_0x3ef3('0x5')](_0x3f0cb9,{'typecast':!![]});if(_0x2e546d[_0x3ef3('0x6')]){logger[_0x3ef3('0x7')](_0x3ef3('0x8'),_0x2e9103,_[_0x3ef3('0x9')](_0x2e546d,_0x3ef3('0xa'))[_0x3ef3('0xb')](',\x20'));logger['info'](_0x3ef3('0xc'),_0x2e9103);_0x5064bd[_0x3ef3('0xd')]();}else{var _0x3d5aa2=this;var _0x342c05=utils[_0x3ef3('0xe')](_0x3965b2[0x0],this);logger[_0x3ef3('0xf')](_0x3ef3('0x10'),_0x2e9103,_0x342c05);sh[_0x3ef3('0x11')](_['trim'](_0x342c05),function(_0x3e6c7c,_0x22c851){logger[_0x3ef3('0xf')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x2e9103,_0x3e6c7c);if(_0x3e6c7c==0x0){var _0x1fd1df=_0x22c851[_0x3ef3('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x3ef3('0x13')](_0x3965b2[0x1])||_[_0x3ef3('0x14')](_0x3965b2[0x1])){logger[_0x3ef3('0xf')]('[%s][SYSTEM]\x20no\x20variable',_0x2e9103);_0x3d5aa2[_0x3ef3('0x15')][_0x3965b2[0x1]]=_0x1fd1df;}else{logger[_0x3ef3('0xf')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x2e9103,_0x3965b2[0x1],_0x1fd1df);_0x3d5aa2[_0x3ef3('0x15')][_0x3965b2[0x1]]=_0x1fd1df;}}_0x5064bd[_0x3ef3('0xd')]();});}}catch(_0x18d577){logger[_0x3ef3('0x7')]('[%s][SYSTEM]\x20%s',_0x2e9103,_[_0x3ef3('0x16')](_0x18d577)?JSON['stringify'](_0x18d577):_0x18d577);logger['info'](_0x3ef3('0xc'),_0x2e9103);_0x5064bd[_0x3ef3('0xd')]();}};}; \ 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 e5757ff..0652799 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 _0xf375=['info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','next','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','validate','length','error','[%s][TAG]\x20%s','map','message'];(function(_0x32e093,_0x35ac32){var _0x3c5ff6=function(_0x1afdd0){while(--_0x1afdd0){_0x32e093['push'](_0x32e093['shift']());}};_0x3c5ff6(++_0x35ac32);}(_0xf375,0x7c));var _0x5f37=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf375[_0x21a9d9];return _0x46adce;};'use strict';var schema=require('validate');var _=require(_0x5f37('0x0'));var rpc={'chatInteraction':require(_0x5f37('0x1')),'openchannelInteraction':require(_0x5f37('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x5f37('0x3')),'faxInteraction':require(_0x5f37('0x4')),'whatsappInteraction':require(_0x5f37('0x5'))};var logger=require(_0x5f37('0x6'))(_0x5f37('0x7'));var tag=schema({'tag':{'type':_0x5f37('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x5f37('0x9')]=function(_0x20c83a,_0x53443a,_0x1bedc4,_0x5375e6){return function(_0x156cec){try{var _0x57e4e5={'tag':_0x53443a[0x0]};var _0x539e5c=tag[_0x5f37('0xa')](_0x57e4e5,{'typecast':!![]});if(_0x539e5c[_0x5f37('0xb')]){logger[_0x5f37('0xc')](_0x5f37('0xd'),_0x20c83a,_[_0x5f37('0xe')](_0x539e5c,_0x5f37('0xf'))['join'](',\x20'));logger[_0x5f37('0x10')](_0x5f37('0x11'),_0x20c83a);_0x156cec['next']();}else{var _0x2e8634={'ids':[_0x53443a[0x0]]};if(rpc[_0x5375e6[_0x5f37('0x12')]+_0x5f37('0x13')]){rpc[_0x5375e6[_0x5f37('0x12')]+_0x5f37('0x13')][_0x5f37('0x14')](_0x5375e6[_0x5f37('0x15')]['id'],_0x2e8634)[_0x5f37('0x16')](function(_0xf1f6b){logger['info'](_0x5f37('0x17'),_0x20c83a,_0x53443a[0x1],_0x5375e6[_0x5f37('0x12')],_0x5375e6['interaction']['id']);})[_0x5f37('0x18')](function(_0x371bbd){logger[_0x5f37('0xc')]('[%s][TAG]\x20%s',_0x20c83a,JSON[_0x5f37('0x19')](_0x371bbd));logger[_0x5f37('0x10')](_0x5f37('0x11'),_0x20c83a);})[_0x5f37('0x1a')](function(){_0x156cec[_0x5f37('0x1b')]();});}}}catch(_0x10b03a){logger[_0x5f37('0xc')](_0x5f37('0xd'),_0x20c83a,_['isObject'](_0x10b03a)?JSON[_0x5f37('0x19')](_0x10b03a):_0x10b03a);logger[_0x5f37('0x10')](_0x5f37('0x11'),_0x20c83a);_0x156cec[_0x5f37('0x1b')]();}};}; \ No newline at end of file +var _0xaf2d=['length','map','message','join','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','[%s][TAG]\x20%s','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','validate'];(function(_0x3861d7,_0x592edf){var _0xf6408d=function(_0x152753){while(--_0x152753){_0x3861d7['push'](_0x3861d7['shift']());}};_0xf6408d(++_0x592edf);}(_0xaf2d,0xb4));var _0xdaf2=function(_0x4c72b8,_0x57c61d){_0x4c72b8=_0x4c72b8-0x0;var _0x3def43=_0xaf2d[_0x4c72b8];return _0x3def43;};'use strict';var schema=require('validate');var _=require(_0xdaf2('0x0'));var rpc={'chatInteraction':require(_0xdaf2('0x1')),'openchannelInteraction':require(_0xdaf2('0x2')),'smsInteraction':require(_0xdaf2('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xdaf2('0x4'))};var logger=require('../../../../config/logger')(_0xdaf2('0x5'));var tag=schema({'tag':{'type':_0xdaf2('0x6'),'required':!![],'message':_0xdaf2('0x7')}});exports['consequence']=function(_0x2e2416,_0x405a61,_0x237191,_0xd490df){return function(_0x8005d0){try{var _0x27c848={'tag':_0x405a61[0x0]};var _0x1fd151=tag[_0xdaf2('0x8')](_0x27c848,{'typecast':!![]});if(_0x1fd151[_0xdaf2('0x9')]){logger['error']('[%s][TAG]\x20%s',_0x2e2416,_[_0xdaf2('0xa')](_0x1fd151,_0xdaf2('0xb'))[_0xdaf2('0xc')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x2e2416);_0x8005d0[_0xdaf2('0xd')]();}else{var _0x185362={'ids':[_0x405a61[0x0]]};if(rpc[_0xd490df[_0xdaf2('0xe')]+_0xdaf2('0xf')]){rpc[_0xd490df[_0xdaf2('0xe')]+_0xdaf2('0xf')][_0xdaf2('0x10')](_0xd490df[_0xdaf2('0x11')]['id'],_0x185362)[_0xdaf2('0x12')](function(_0x30d2c1){logger['info'](_0xdaf2('0x13'),_0x2e2416,_0x405a61[0x1],_0xd490df[_0xdaf2('0xe')],_0xd490df['interaction']['id']);})[_0xdaf2('0x14')](function(_0x29438a){logger[_0xdaf2('0x15')]('[%s][TAG]\x20%s',_0x2e2416,JSON[_0xdaf2('0x16')](_0x29438a));logger[_0xdaf2('0x17')](_0xdaf2('0x18'),_0x2e2416);})[_0xdaf2('0x19')](function(){_0x8005d0[_0xdaf2('0xd')]();});}}}catch(_0x1cc63a){logger[_0xdaf2('0x15')](_0xdaf2('0x1a'),_0x2e2416,_['isObject'](_0x1cc63a)?JSON[_0xdaf2('0x16')](_0x1cc63a):_0x1cc63a);logger[_0xdaf2('0x17')](_0xdaf2('0x18'),_0x2e2416);_0x8005d0[_0xdaf2('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 3728bba..7068a98 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x493d=['urlOnRing','?params=','jsonrpc','2.0','method','login','params','stringify','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&sessionId=','&data=','stop','catch','error','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','replace','includes','push','urlOnAnswer'];(function(_0x4af1e5,_0x3054b6){var _0x10c8dd=function(_0x2f9875){while(--_0x2f9875){_0x4af1e5['push'](_0x4af1e5['shift']());}};_0x10c8dd(++_0x3054b6);}(_0x493d,0x138));var _0xd493=function(_0x451353,_0x19710b){_0x451353=_0x451353-0x0;var _0x102315=_0x493d[_0x451353];return _0x102315;};'use strict';var rp=require(_0xd493('0x0'));var logger=require(_0xd493('0x1'))(_0xd493('0x2'));var _=require(_0xd493('0x3'));var arr=[];exports['consequence']=function(_0x4e0670,_0x196a52){return function(_0x13cc00){var _0x357f84=_0x196a52[0xa];var _0x2bab6e=_0x196a52[0xb];var _0x252bab=_0x196a52[0xc];var _0x6fd804=_0x196a52[0xd];var _0x2cc0a1=_0x196a52[0xe];var _0x4e242f=_0x196a52[0xf][_0xd493('0x4')](/\n/g,'\x20-\x20');var _0x46ed95=_0x196a52[0x10][_0xd493('0x4')](/\n/g,'\x20');if(!arr[_0xd493('0x5')](_0x2bab6e)){arr[_0xd493('0x6')](_0x2bab6e);var _0x315255=_0x196a52[0x3];var _0x36f242=_0x196a52[0x4];var _0x116cd9=_0x196a52[0x1];var _0x179dc0=_0x196a52[0x0];var _0x670b8={};_0x670b8[_0xd493('0x7')]=_0x196a52[0x8]+'?params='+_0x252bab+'|'+_0x357f84+'|'+_0x6fd804+'|'+_0x2bab6e+'|'+_0x2cc0a1;_0x670b8[_0xd493('0x8')]=_0x196a52[0x7]+_0xd493('0x9')+_0x252bab+'|'+_0x357f84+'|'+_0x6fd804+'|'+_0x2bab6e+'|'+_0x2cc0a1+'|'+_0x4e242f+'|'+_0x46ed95;_0x670b8['title']=_0x196a52[0x9];var _0x574429={};_0x574429[_0xd493('0xa')]=_0xd493('0xb');_0x574429[_0xd493('0xc')]=_0xd493('0xd');var _0x2e8ce7=[];_0x2e8ce7[_0xd493('0x6')](_0x196a52[0x2]);_0x2e8ce7[_0xd493('0x6')](_0x196a52[0x5]);_0x2e8ce7['push'](_0x196a52[0x6]);_0x574429[_0xd493('0xe')]=_0x2e8ce7;_0x574429['id']=0x1;var _0x45bd68=JSON[_0xd493('0xf')](_0x574429);var _0x11577e={'encoding':'utf8','method':_0xd493('0x10'),'timeout':0x2710,'url':_0x315255,'headers':{'Content-Type':_0xd493('0x11')},'body':_0x45bd68};return rp(_0x11577e)[_0xd493('0x12')](function(_0x499905){const _0x50e709=JSON[_0xd493('0x13')](_0x499905);if(!_0x50e709[_0xd493('0x14')][_0xd493('0x15')]){throw new Error(_0xd493('0x16'));}var _0x19ecb1=_0x2bab6e;var _0x56d92e='channelId='+_0x116cd9+'&serviceId='+_0x179dc0+_0xd493('0x17')+_0x19ecb1+_0xd493('0x18')+JSON[_0xd493('0xf')](_0x670b8);var _0x12766f=_0x36f242+'?'+_0x56d92e;return rp(_0x12766f);})[_0xd493('0x12')](function(_0x279cce){logger['info']('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x4e0670,_0x279cce);_0x13cc00[_0xd493('0x19')]();})[_0xd493('0x1a')](function(_0x1f073f){logger[_0xd493('0x1b')]('[%s][TVOX]\x20%s',_0x4e0670,_[_0xd493('0x1c')](_0x1f073f)?JSON[_0xd493('0xf')](_0x1f073f):_0x1f073f);_0x13cc00[_0xd493('0x19')]();});}else{logger[_0xd493('0x1d')](_0xd493('0x1e'),_0x4e0670);_0x13cc00[_0xd493('0x1f')]();}};}; \ No newline at end of file +var _0x1f36=['&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','next','request-promise','../../../../config/logger','routing','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','method','login','params','stringify','utf8','POST','application/json-rpc','then','result','channelId=','&serviceId='];(function(_0x16b291,_0x4b2b88){var _0x504f23=function(_0x5d1be6){while(--_0x5d1be6){_0x16b291['push'](_0x16b291['shift']());}};_0x504f23(++_0x4b2b88);}(_0x1f36,0x180));var _0x61f3=function(_0x155eb8,_0x5aca30){_0x155eb8=_0x155eb8-0x0;var _0x159589=_0x1f36[_0x155eb8];return _0x159589;};'use strict';var rp=require(_0x61f3('0x0'));var logger=require(_0x61f3('0x1'))(_0x61f3('0x2'));var _=require('lodash');var arr=[];exports[_0x61f3('0x3')]=function(_0xafefd1,_0x5e149a){return function(_0x5ccba2){var _0x2b9548=_0x5e149a[0xa];var _0xc37ba5=_0x5e149a[0xb];var _0x1481eb=_0x5e149a[0xc];var _0x46dd9d=_0x5e149a[0xd];var _0x26bada=_0x5e149a[0xe];var _0x4a7e80=_0x5e149a[0xf][_0x61f3('0x4')](/\n/g,_0x61f3('0x5'));var _0x36a8ee=_0x5e149a[0x10][_0x61f3('0x4')](/\n/g,'\x20');if(!arr[_0x61f3('0x6')](_0xc37ba5)){arr[_0x61f3('0x7')](_0xc37ba5);var _0x2f1685=_0x5e149a[0x3];var _0x502c0d=_0x5e149a[0x4];var _0x35f8aa=_0x5e149a[0x1];var _0x1e96a3=_0x5e149a[0x0];var _0x25995={};_0x25995[_0x61f3('0x8')]=_0x5e149a[0x8]+_0x61f3('0x9')+_0x1481eb+'|'+_0x2b9548+'|'+_0x46dd9d+'|'+_0xc37ba5+'|'+_0x26bada;_0x25995[_0x61f3('0xa')]=_0x5e149a[0x7]+_0x61f3('0x9')+_0x1481eb+'|'+_0x2b9548+'|'+_0x46dd9d+'|'+_0xc37ba5+'|'+_0x26bada+'|'+_0x4a7e80+'|'+_0x36a8ee;_0x25995['title']=_0x5e149a[0x9];var _0x3635d9={};_0x3635d9[_0x61f3('0xb')]=_0x61f3('0xc');_0x3635d9[_0x61f3('0xd')]=_0x61f3('0xe');var _0x40515c=[];_0x40515c[_0x61f3('0x7')](_0x5e149a[0x2]);_0x40515c[_0x61f3('0x7')](_0x5e149a[0x5]);_0x40515c['push'](_0x5e149a[0x6]);_0x3635d9[_0x61f3('0xf')]=_0x40515c;_0x3635d9['id']=0x1;var _0x395ae7=JSON[_0x61f3('0x10')](_0x3635d9);var _0xe6e3b3={'encoding':_0x61f3('0x11'),'method':_0x61f3('0x12'),'timeout':0x2710,'url':_0x2f1685,'headers':{'Content-Type':_0x61f3('0x13')},'body':_0x395ae7};return rp(_0xe6e3b3)[_0x61f3('0x14')](function(_0x225ccb){const _0x5d7e71=JSON['parse'](_0x225ccb);if(!_0x5d7e71[_0x61f3('0x15')]['logged']){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x559aad=_0xc37ba5;var _0x2dea13=_0x61f3('0x16')+_0x35f8aa+_0x61f3('0x17')+_0x1e96a3+_0x61f3('0x18')+_0x559aad+_0x61f3('0x19')+JSON[_0x61f3('0x10')](_0x25995);var _0xfc0a5c=_0x502c0d+'?'+_0x2dea13;return rp(_0xfc0a5c);})[_0x61f3('0x14')](function(_0x463ecf){logger[_0x61f3('0x1a')](_0x61f3('0x1b'),_0xafefd1,_0x463ecf);_0x5ccba2[_0x61f3('0x1c')]();})[_0x61f3('0x1d')](function(_0x5f478e){logger[_0x61f3('0x1e')](_0x61f3('0x1f'),_0xafefd1,_[_0x61f3('0x20')](_0x5f478e)?JSON['stringify'](_0x5f478e):_0x5f478e);_0x5ccba2[_0x61f3('0x1c')]();});}else{logger[_0x61f3('0x1a')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0xafefd1);_0x5ccba2[_0x61f3('0x21')]();}};}; \ 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 1848a22..1de9213 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 _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x1be17a,_0x3b3121){var _0x370b63=function(_0x17c25f){while(--_0x17c25f){_0x1be17a['push'](_0x1be17a['shift']());}};_0x370b63(++_0x3b3121);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'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 +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x54d62e,_0x236178){var _0x46dd25=function(_0x884b68){while(--_0x884b68){_0x54d62e['push'](_0x54d62e['shift']());}};_0x46dd25(++_0x236178);}(_0xe706,0xa3));var _0x6e70=function(_0x584308,_0x1379b3){_0x584308=_0x584308-0x0;var _0x45865b=_0xe706[_0x584308];return _0x45865b;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 14e6157..8acd8a5 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 _0xc01b=['RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','uuid','./applications/utils','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','some','capitalize','InteractionId','applications','length','existsSync','.js','app','autoreply','split','mail','push','slice','join','dialogflow','appdata','amazonlex','tag','TagId','tvox','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','intervals','priority','info','Push\x20new\x20rule','on\x20interval','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','end','QueueReport','update','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log'];(function(_0x1726ca,_0x33cdc0){var _0x1f2eaf=function(_0x9723d9){while(--_0x9723d9){_0x1726ca['push'](_0x1726ca['shift']());}};_0x1f2eaf(++_0x33cdc0);}(_0xc01b,0x65));var _0xbc01=function(_0x78992,_0x46a3a8){_0x78992=_0x78992-0x0;var _0x2f1067=_0xc01b[_0x78992];return _0x2f1067;};'use strict';var _=require(_0xbc01('0x0'));var util=require(_0xbc01('0x1'));var path=require(_0xbc01('0x2'));var fs=require('fs');var jayson=require(_0xbc01('0x3'));var BPromise=require('bluebird');var uuid=require(_0xbc01('0x4'));var utils=require(_0xbc01('0x5'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require(_0xbc01('0x6')),'mailQueueReport':require(_0xbc01('0x7')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xbc01('0x8')),'whatsappQueueReport':require(_0xbc01('0x9'))};var RuleEngine=require(_0xbc01('0xa'));function getId(_0xdedc4e,_0x1f7900,_0x5a8e1){return util[_0xbc01('0xb')]('%s.%s.%s',_0xdedc4e,_0x1f7900||0x0,_0x5a8e1||0x0);}function getIntervals(_0x46f01c,_0x3cc11e){var _0x3b7f4d=[];if(!_[_0xbc01('0xc')](_0x3cc11e[_0xbc01('0xd')])&&!_[_0xbc01('0xc')](_0x46f01c[_0x3cc11e[_0xbc01('0xd')]])&&!_[_0xbc01('0xc')](_0x46f01c[_0x3cc11e[_0xbc01('0xd')]][_0xbc01('0xe')])){_0x3b7f4d=_[_0xbc01('0xf')](_0x46f01c[_0x3cc11e[_0xbc01('0xd')]][_0xbc01('0xe')],_0xbc01('0x10'));}else if(!_['isNil'](_0x3cc11e[_0xbc01('0x10')])){_0x3b7f4d=[_0x3cc11e[_0xbc01('0x10')]];}return _0x3b7f4d;}exports[_0xbc01('0x11')]=function(_0x5de273){_0x5de273[_0xbc01('0x12')]={};return new BPromise(function(_0x3edee7,_0x545c01){var _0x3d3fe6={'Start':function(_0x30a0fe){var _0x45736c=this;return new Promise(function(_0xf61d88,_0x539ae6){if(_0x30a0fe){try{var _0x532438=[];var _0x3f3172=getId(_0x30a0fe[_0xbc01('0x13')],_0x30a0fe['message']?_0x30a0fe[_0xbc01('0x14')]['id']:0x0,_0x30a0fe['interaction']?_0x30a0fe[_0xbc01('0x15')]['id']:0x0);var _0x21821a=_[_0xbc01('0x16')](_0x5de273[_0x30a0fe[_0xbc01('0x13')]+'QueuesWaitingInteractions'],function(_0x17cc53){var _0x3c4a2e=_[_0xbc01('0x17')](_0x30a0fe['channel'])+_0xbc01('0x18');return _0x17cc53[_0x3c4a2e]===_0x30a0fe[_0xbc01('0x15')]['id'];});if(!_0x21821a&&_0x30a0fe['applications']&&_['isArray'](_0x30a0fe['applications'])&&_0x30a0fe[_0xbc01('0x19')][_0xbc01('0x1a')]){for(var _0x3ae9d6=0x0;_0x3ae9d6<_0x30a0fe[_0xbc01('0x19')][_0xbc01('0x1a')];_0x3ae9d6+=0x1){var _0x243c0a=_0x30a0fe['applications'][_0x3ae9d6];if(fs[_0xbc01('0x1b')](path['join'](__dirname,_0xbc01('0x19'),_0x243c0a['app']+_0xbc01('0x1c')))){var _0x18661d=[];switch(_0x243c0a[_0xbc01('0x1d')]['toLowerCase']()){case _0xbc01('0x1e'):var _0xd90813=_0x243c0a['appdata'][_0xbc01('0x1f')](',');if(_0x30a0fe[_0xbc01('0x13')]===_0xbc01('0x20')){_0x18661d[_0xbc01('0x21')](_0xd90813[0x0]);_0x18661d[_0xbc01('0x21')](_0xd90813[0x1]);_0x18661d[_0xbc01('0x21')](_0xd90813[_0xbc01('0x22')](0x2,_0xd90813[_0xbc01('0x1a')])[_0xbc01('0x23')](','));}else{_0x18661d[_0xbc01('0x21')](_0xd90813[0x0]);_0x18661d[_0xbc01('0x21')](_0xd90813['slice'](0x1,_0xd90813[_0xbc01('0x1a')])[_0xbc01('0x23')](','));}break;case _0xbc01('0x24'):var _0xc51dea=_0x243c0a[_0xbc01('0x25')][_0xbc01('0x1f')](',');_0x18661d[_0xbc01('0x21')](_0xc51dea[0x0]);_0x18661d['push'](_0xc51dea[0x1]);_0x18661d[_0xbc01('0x21')](_0xc51dea['slice'](0x2,_0xc51dea[_0xbc01('0x1a')])[_0xbc01('0x23')](','));break;case'dialogflowv2':var _0x2b8423=_0x243c0a[_0xbc01('0x25')]['split'](',');_0x18661d[_0xbc01('0x21')](_0x2b8423[0x0]);_0x18661d[_0xbc01('0x21')](_0x2b8423[0x1]);_0x18661d[_0xbc01('0x21')](_0x2b8423[0x2]);_0x18661d['push'](_0x2b8423[0x3]);_0x18661d[_0xbc01('0x21')](_0x2b8423[_0xbc01('0x22')](0x4,_0x2b8423[_0xbc01('0x1a')])[_0xbc01('0x23')](','));break;case _0xbc01('0x26'):var _0x5dda59=_0x243c0a[_0xbc01('0x25')][_0xbc01('0x1f')](',');_0x18661d['push'](_0x5dda59[0x0]);_0x18661d[_0xbc01('0x21')](_0x5dda59[0x1]);_0x18661d[_0xbc01('0x21')](_0x5dda59[0x2]);_0x18661d[_0xbc01('0x21')](_0x5dda59[0x3]);_0x18661d[_0xbc01('0x21')](_0x5dda59[_0xbc01('0x22')](0x4,_0x5dda59[_0xbc01('0x1a')])[_0xbc01('0x23')](','));break;case _0xbc01('0x14'):_0x18661d[_0xbc01('0x21')](_0x243c0a[_0xbc01('0x25')]);break;case _0xbc01('0x27'):_0x18661d['push'](_0x243c0a[_0xbc01('0x28')]);_0x18661d[_0xbc01('0x21')](_0x243c0a['appdata']);break;case _0xbc01('0x29'):var _0x308503=utils['getMustacheRender'](_0x30a0fe[_0xbc01('0x2a')][_0xbc01('0x2b')],_0x30a0fe);var _0xfbbdb7=_0x243c0a[_0xbc01('0x25')][_0xbc01('0x1f')](',');_0x18661d[_0xbc01('0x21')](_0xfbbdb7[0x0]);_0x18661d[_0xbc01('0x21')](_0xfbbdb7[0x1]);_0x18661d[_0xbc01('0x21')](_0xfbbdb7[0x2]);_0x18661d[_0xbc01('0x21')](_0xfbbdb7[0x3]);_0x18661d[_0xbc01('0x21')](_0xfbbdb7[0x4]);_0x18661d[_0xbc01('0x21')](_0xfbbdb7[0x5]);_0x18661d['push'](_0xfbbdb7[0x6]);_0x18661d[_0xbc01('0x21')](_0xfbbdb7[0x7]);_0x18661d['push'](_0xfbbdb7[0x8]);_0x18661d[_0xbc01('0x21')](_0xfbbdb7[0x9]);_0x18661d[_0xbc01('0x21')](_0xfbbdb7[0xa]);_0x18661d[_0xbc01('0x21')](_0x30a0fe[_0xbc01('0x15')]['id']);_0x18661d[_0xbc01('0x21')](_0x30a0fe['message']['id']);_0x18661d[_0xbc01('0x21')](_0x243c0a[_0xbc01('0x2c')]);_0x18661d[_0xbc01('0x21')](_0x30a0fe['interaction'][_0xbc01('0x2d')]);_0x18661d['push'](_0x30a0fe[_0xbc01('0x2e')]['body']);_0x18661d[_0xbc01('0x21')](_0x308503);break;default:_0x18661d=_[_0xbc01('0xc')](_0x243c0a['appdata'])?[]:_0x243c0a[_0xbc01('0x25')][_0xbc01('0x1f')](',');}var _0x33c4ce={'id':util['format'](_0xbc01('0x2f'),_0x3f3172,_0x243c0a['id'],_0x243c0a[_0xbc01('0x1d')]),'condition':require(_0xbc01('0x30'))['condition'](_0x3f3172,getIntervals(_0x5de273[_0xbc01('0x31')],_0x243c0a),_0x5de273),'consequence':require('./applications/'+_0x243c0a[_0xbc01('0x1d')])['consequence'](_0x3f3172,_0x18661d,_0x5de273,_0x30a0fe),'p':_0x243c0a[_0xbc01('0x32')]||0x0};logger[_0xbc01('0x33')](_0xbc01('0x34'),_0x33c4ce['id'],_0xbc01('0x35'),getIntervals(_0x5de273[_0xbc01('0x31')],_0x243c0a)[_0xbc01('0x23')]('\x20|\x20'));_0x532438['push'](_0x33c4ce);}else{logger[_0xbc01('0x36')](_0xbc01('0x37'),path[_0xbc01('0x23')](__dirname,_0xbc01('0x19'),_0x243c0a['app']+'.js'));}}_0x5de273[_0xbc01('0x12')][_0x3f3172]=new RuleEngine(_0x532438);_0x5de273[_0xbc01('0x12')][_0x3f3172][_0xbc01('0x38')](_0x30a0fe,function(_0x13139b){logger[_0xbc01('0x33')](_0xbc01('0x39'),JSON[_0xbc01('0x3a')](_0x13139b['matchPath']));if(_0x5de273['rules'][_0x3f3172]){_0x5de273[_0xbc01('0x12')][_0x3f3172][_0xbc01('0x3b')](_0xbc01('0x3c'));}});return _0xf61d88({'code':0xc8,'message':_0x30a0fe});}else{if(_0x21821a){logger['info'](util[_0xbc01('0xb')](_0xbc01('0x3d'),_0x3f3172));}else{logger[_0xbc01('0x33')](_0xbc01('0x3e'));}return _0xf61d88({'code':0xc8,'message':_0x30a0fe});}}catch(_0xf51b77){logger[_0xbc01('0x36')](_0xf51b77[_0xbc01('0x3f')]);return _0x539ae6(_0x45736c[_0xbc01('0x36')](0x1f4,_0xf51b77));}}return _0x539ae6(_0xbc01('0x40'));});},'AcceptMessage':function(_0x491dfc){var _0x2338fb=this;return new Promise(function(_0x396fb6,_0xc970b5){if(_0x491dfc['agent']&&_0x491dfc[_0xbc01('0x41')]['id']){if(_0x5de273[_0xbc01('0x42')][_0x491dfc[_0xbc01('0x41')]['id']]){_0x5de273[_0xbc01('0x42')][_0x491dfc['agent']['id']]['busy']=![];_0x5de273[_0xbc01('0x42')][_0x491dfc[_0xbc01('0x41')]['id']]['busyQueue']=undefined;}}if(_0x491dfc['message']&&_0x491dfc['message']['id']){try{var _0x48cd71=getId(_0x491dfc[_0xbc01('0x13')],_0x491dfc['message']?_0x491dfc['message']['id']:0x0,_0x491dfc[_0xbc01('0x15')]?_0x491dfc[_0xbc01('0x15')]['id']:0x0);if(_0x5de273[_0xbc01('0x12')][_0x48cd71]){_0x5de273[_0xbc01('0x12')][_0x48cd71][_0xbc01('0x3b')](_0xbc01('0x43'));if(rpc[_0x491dfc[_0xbc01('0x13')]+_0xbc01('0x44')]){rpc[_0x491dfc[_0xbc01('0x13')]+'QueueReport'][_0xbc01('0x45')](_0x48cd71,{'UserId':_0x491dfc['message']['UserId']})['catch'](function(_0x13126f){logger[_0xbc01('0x36')](_0xbc01('0x46'));});}}return _0x396fb6({'code':0xc8,'message':_0x491dfc});}catch(_0x6eb3c){logger['error'](_0x6eb3c[_0xbc01('0x3f')]);return _0xc970b5(_0x2338fb['error'](0x1f4,_0x6eb3c));}}logger[_0xbc01('0x36')](_0xbc01('0x47'));return _0xc970b5(_0x2338fb[_0xbc01('0x36')](0x1f4,_0xbc01('0x47')));});},'RejectMessage':function(_0x46bfba){var _0x405184=this;return new Promise(function(_0x578a2e,_0x2d548e){if(_0x46bfba[_0xbc01('0x41')]&&_0x46bfba[_0xbc01('0x41')]['id']){try{if(_0x5de273['agents'][_0x46bfba[_0xbc01('0x41')]['id']]){_0x5de273[_0xbc01('0x42')][_0x46bfba['agent']['id']][_0xbc01('0x48')]=![];_0x5de273[_0xbc01('0x42')][_0x46bfba[_0xbc01('0x41')]['id']]['busyQueue']=undefined;}return _0x578a2e({'code':0xc8,'message':_0x46bfba});}catch(_0x4b5159){logger[_0xbc01('0x36')](_0x4b5159[_0xbc01('0x3f')]);return _0x2d548e(_0x405184[_0xbc01('0x36')](0x1f4,_0x4b5159));}}logger['error'](_0xbc01('0x47'));return _0x2d548e(_0x405184['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x33aa5d){var _0x28258b=this;return new Promise(function(_0x450a48,_0x3f8da3){if(_0x33aa5d['channel']&&_0x33aa5d[_0xbc01('0x15')]&&_0x33aa5d[_0xbc01('0x15')]['id']){try{var _0x559a16=getId(_0x33aa5d[_0xbc01('0x13')],_0x33aa5d[_0xbc01('0x14')]?_0x33aa5d['message']['id']:0x0,_0x33aa5d[_0xbc01('0x15')]?_0x33aa5d[_0xbc01('0x15')]['id']:0x0);if(_0x5de273['rules'][_0x559a16]){_0x5de273['rules'][_0x559a16]['emit']('end');}return _0x450a48({'code':0xc8,'message':_0x33aa5d});}catch(_0x407b13){logger[_0xbc01('0x36')](_0x407b13[_0xbc01('0x3f')]);return _0x3f8da3(_0x28258b[_0xbc01('0x36')](0x1f4,_0x407b13));}}logger[_0xbc01('0x36')]('message\x20is\x20empty');return _0x3f8da3(_0x28258b[_0xbc01('0x36')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x1a9182){var _0x2a603e=this;return new Promise(function(_0x4a57e0,_0x12dfc2){if(_0x5de273[_0xbc01('0x42')][_0xbc01('0x49')](_0x1a9182['id'])){for(var _0x42c4fe in _0x1a9182['capacity']){if(_0x1a9182[_0xbc01('0x4a')][_0xbc01('0x49')](_0x42c4fe)){if(_0x5de273[_0xbc01('0x42')][_0x1a9182['id']][_0xbc01('0x49')](_0x42c4fe+_0xbc01('0x4b'))){_0x5de273[_0xbc01('0x42')][_0x1a9182['id']][_0x42c4fe+'CurrentCapacity']=parseInt(_0x1a9182[_0xbc01('0x4a')][_0x42c4fe],0xa);}}}_0x5de273[_0xbc01('0x42')][_0x1a9182['id']][_0xbc01('0x4c')]();return _0x4a57e0({'code':0xc8,'message':_0x5de273[_0xbc01('0x42')][_0x1a9182['id']]});}else{return _0x12dfc2(_0x2a603e[_0xbc01('0x36')](0x1f4,_0xbc01('0x4d')));}});},'Agents':function(_0x353881){return new Promise(function(_0x260551,_0x5d67db){var _0x21d180=_[_0xbc01('0x4e')](_0x5de273[_0xbc01('0x42')]);_0x260551({'count':_0x21d180[_0xbc01('0x1a')],'rows':_0x21d180});});},'ChatQueues':function(_0xc3791f){return new Promise(function(_0x5b3b53,_0x4f9028){var _0x41715e=[];for(var _0x45cc69 in _0x5de273[_0xbc01('0x4f')]){if(_0x5de273[_0xbc01('0x4f')][_0xbc01('0x49')](_0x45cc69)){var _0x3679de=_0x5de273[_0xbc01('0x4f')][_0x45cc69];var _0x1fd50c={'id':_0x3679de['id'],'available':_0x3679de[_0xbc01('0x50')],'loggedIn':_0x3679de[_0xbc01('0x51')],'name':_0x3679de[_0xbc01('0x52')],'paused':_0x3679de[_0xbc01('0x53')],'waiting':_0x3679de[_0xbc01('0x54')]};_0x41715e['push'](_0x1fd50c);}}_0x5b3b53({'count':_0x41715e[_0xbc01('0x1a')],'rows':_0x41715e});});},'MailQueues':function(_0x35b693){return new Promise(function(_0x24d77d,_0x445c35){var _0x42bdd3=[];for(var _0x56991a in _0x5de273[_0xbc01('0x55')]){if(_0x5de273[_0xbc01('0x55')][_0xbc01('0x49')](_0x56991a)){var _0x1245de=_0x5de273[_0xbc01('0x55')][_0x56991a];var _0x86e00={'id':_0x1245de['id'],'available':_0x1245de['available'],'loggedIn':_0x1245de[_0xbc01('0x51')],'name':_0x1245de[_0xbc01('0x52')],'paused':_0x1245de[_0xbc01('0x53')],'waiting':_0x1245de[_0xbc01('0x54')]};_0x42bdd3[_0xbc01('0x21')](_0x86e00);}}_0x24d77d({'count':_0x42bdd3[_0xbc01('0x1a')],'rows':_0x42bdd3});});},'OpenchannelQueues':function(_0x3e0dd2){return new Promise(function(_0x470a06,_0x364ffc){var _0x1681e9=[];for(var _0x45bc04 in _0x5de273[_0xbc01('0x56')]){if(_0x5de273['openchannelQueues'][_0xbc01('0x49')](_0x45bc04)){var _0x5cf617=_0x5de273[_0xbc01('0x56')][_0x45bc04];var _0x1448c8={'id':_0x5cf617['id'],'available':_0x5cf617[_0xbc01('0x50')],'loggedIn':_0x5cf617[_0xbc01('0x51')],'name':_0x5cf617[_0xbc01('0x52')],'paused':_0x5cf617[_0xbc01('0x53')],'waiting':_0x5cf617[_0xbc01('0x54')]};_0x1681e9[_0xbc01('0x21')](_0x1448c8);}}_0x470a06({'count':_0x1681e9[_0xbc01('0x1a')],'rows':_0x1681e9});});},'SmsQueues':function(_0x201a1f){return new Promise(function(_0x36589a,_0x582bf6){var _0x137aa3=[];for(var _0x4d8056 in _0x5de273['smsQueues']){if(_0x5de273[_0xbc01('0x57')]['hasOwnProperty'](_0x4d8056)){var _0x4d21e2=_0x5de273[_0xbc01('0x57')][_0x4d8056];var _0x3d590a={'id':_0x4d21e2['id'],'available':_0x4d21e2['available'],'loggedIn':_0x4d21e2[_0xbc01('0x51')],'name':_0x4d21e2[_0xbc01('0x52')],'paused':_0x4d21e2[_0xbc01('0x53')],'waiting':_0x4d21e2['waiting']};_0x137aa3[_0xbc01('0x21')](_0x3d590a);}}_0x36589a({'count':_0x137aa3[_0xbc01('0x1a')],'rows':_0x137aa3});});},'FaxQueues':function(_0x1bcd21){return new Promise(function(_0x4efe48,_0x50be4b){var _0x4c8b79=[];for(var _0x276fc4 in _0x5de273[_0xbc01('0x58')]){if(_0x5de273['faxQueues']['hasOwnProperty'](_0x276fc4)){var _0x5a9e00=_0x5de273['faxQueues'][_0x276fc4];var _0x4c0977={'id':_0x5a9e00['id'],'available':_0x5a9e00['available'],'loggedIn':_0x5a9e00[_0xbc01('0x51')],'name':_0x5a9e00[_0xbc01('0x52')],'paused':_0x5a9e00[_0xbc01('0x53')],'waiting':_0x5a9e00[_0xbc01('0x54')]};_0x4c8b79[_0xbc01('0x21')](_0x4c0977);}}_0x4efe48({'count':_0x4c8b79[_0xbc01('0x1a')],'rows':_0x4c8b79});});},'WhatsappQueues':function(_0x3e1e4f){return new Promise(function(_0x21a810,_0x1fa6c9){var _0x3d2abd=[];for(var _0x15fa92 in _0x5de273[_0xbc01('0x59')]){if(_0x5de273[_0xbc01('0x59')]['hasOwnProperty'](_0x15fa92)){var _0x5e10ec=_0x5de273[_0xbc01('0x59')][_0x15fa92];var _0x46a880={'id':_0x5e10ec['id'],'available':_0x5e10ec['available'],'loggedIn':_0x5e10ec['loggedIn'],'name':_0x5e10ec[_0xbc01('0x52')],'paused':_0x5e10ec['paused'],'waiting':_0x5e10ec['waiting']};_0x3d2abd['push'](_0x46a880);}}_0x21a810({'count':_0x3d2abd['length'],'rows':_0x3d2abd});});},'ChatQueuesWaitingInteractions':function(_0x1df74e){return new Promise(function(_0x29db46,_0x3aa01f){var _0x2e445e=_['values'](_0x5de273[_0xbc01('0x5a')]);_0x29db46({'count':_0x2e445e[_0xbc01('0x1a')],'rows':_0x2e445e});});},'MailQueuesWaitingInteractions':function(_0x554d83){return new Promise(function(_0x1f4b5e,_0x29327f){var _0x20d071=_['values'](_0x5de273[_0xbc01('0x5b')]);_0x1f4b5e({'count':_0x20d071['length'],'rows':_0x20d071});});},'OpenchannelQueuesWaitingInteractions':function(_0x4d821b){return new Promise(function(_0x388e90,_0x18dc75){var _0x8dd5c6=_[_0xbc01('0x4e')](_0x5de273[_0xbc01('0x5c')]);_0x388e90({'count':_0x8dd5c6[_0xbc01('0x1a')],'rows':_0x8dd5c6});});},'SmsQueuesWaitingInteractions':function(_0x150faa){return new Promise(function(_0xde78cd,_0x23546a){var _0x8d50bd=_[_0xbc01('0x4e')](_0x5de273[_0xbc01('0x5d')]);_0xde78cd({'count':_0x8d50bd['length'],'rows':_0x8d50bd});});},'FaxQueuesWaitingInteractions':function(_0x26e1ba){return new Promise(function(_0x36c88e,_0x2c03aa){var _0x53bb95=_[_0xbc01('0x4e')](_0x5de273[_0xbc01('0x5e')]);_0x36c88e({'count':_0x53bb95['length'],'rows':_0x53bb95});});},'WhatsappQueuesWaitingInteractions':function(_0x3667e5){return new Promise(function(_0x408316,_0x1b57b7){var _0x388754=_[_0xbc01('0x4e')](_0x5de273[_0xbc01('0x5f')]);_0x408316({'count':_0x388754[_0xbc01('0x1a')],'rows':_0x388754});});}};var _0x832f92=jayson['server'](_0x3d3fe6)[_0xbc01('0x60')]();_0x832f92['on']('error',function(_0x331eaf){logger[_0xbc01('0x36')](JSON[_0xbc01('0x3a')](_0x331eaf));return _0x545c01(_0x331eaf);});_0x832f92[_0xbc01('0x11')](0x232c,_0xbc01('0x61'),function(){console[_0xbc01('0x62')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x3edee7(_0xbc01('0x63')+0x232c);});});}; \ No newline at end of file +var _0xb5bb=['applications','length','existsSync','app','.js','autoreply','appdata','split','push','slice','join','amazonlex','TagId','tvox','account','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','info','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','stringify','matchPath','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','catch','message\x20is\x20empty','emit','end','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','uuid','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','some','capitalize'];(function(_0x261b08,_0x563d91){var _0xeeaf84=function(_0x5aeb4b){while(--_0x5aeb4b){_0x261b08['push'](_0x261b08['shift']());}};_0xeeaf84(++_0x563d91);}(_0xb5bb,0x1ba));var _0xbb5b=function(_0x50f889,_0x451877){_0x50f889=_0x50f889-0x0;var _0x56ad34=_0xb5bb[_0x50f889];return _0x56ad34;};'use strict';var _=require(_0xbb5b('0x0'));var util=require(_0xbb5b('0x1'));var path=require(_0xbb5b('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xbb5b('0x3'));var uuid=require(_0xbb5b('0x4'));var utils=require('./applications/utils');var config=require('../../../config/environment');var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xbb5b('0x5')),'smsQueueReport':require(_0xbb5b('0x6')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xbb5b('0x7'))};var RuleEngine=require(_0xbb5b('0x8'));function getId(_0x31eaa6,_0x11cc7e,_0x3eca21){return util[_0xbb5b('0x9')](_0xbb5b('0xa'),_0x31eaa6,_0x11cc7e||0x0,_0x3eca21||0x0);}function getIntervals(_0x2d9bf7,_0x3e497a){var _0x218eca=[];if(!_[_0xbb5b('0xb')](_0x3e497a[_0xbb5b('0xc')])&&!_[_0xbb5b('0xb')](_0x2d9bf7[_0x3e497a[_0xbb5b('0xc')]])&&!_[_0xbb5b('0xb')](_0x2d9bf7[_0x3e497a[_0xbb5b('0xc')]][_0xbb5b('0xd')])){_0x218eca=_[_0xbb5b('0xe')](_0x2d9bf7[_0x3e497a[_0xbb5b('0xc')]][_0xbb5b('0xd')],'interval');}else if(!_[_0xbb5b('0xb')](_0x3e497a['interval'])){_0x218eca=[_0x3e497a[_0xbb5b('0xf')]];}return _0x218eca;}exports[_0xbb5b('0x10')]=function(_0x8f9833){_0x8f9833[_0xbb5b('0x11')]={};return new BPromise(function(_0x5b026b,_0x39262f){var _0x117f6d={'Start':function(_0x2aecf7){var _0x60f86d=this;return new Promise(function(_0x3b2edb,_0x5ee29e){if(_0x2aecf7){try{var _0x43f396=[];var _0x380044=getId(_0x2aecf7[_0xbb5b('0x12')],_0x2aecf7['message']?_0x2aecf7[_0xbb5b('0x13')]['id']:0x0,_0x2aecf7[_0xbb5b('0x14')]?_0x2aecf7[_0xbb5b('0x14')]['id']:0x0);var _0x1e84fc=_[_0xbb5b('0x15')](_0x8f9833[_0x2aecf7[_0xbb5b('0x12')]+'QueuesWaitingInteractions'],function(_0x1667f1){var _0x14a56f=_[_0xbb5b('0x16')](_0x2aecf7['channel'])+'InteractionId';return _0x1667f1[_0x14a56f]===_0x2aecf7[_0xbb5b('0x14')]['id'];});if(!_0x1e84fc&&_0x2aecf7[_0xbb5b('0x17')]&&_['isArray'](_0x2aecf7[_0xbb5b('0x17')])&&_0x2aecf7[_0xbb5b('0x17')][_0xbb5b('0x18')]){for(var _0x265944=0x0;_0x265944<_0x2aecf7['applications'][_0xbb5b('0x18')];_0x265944+=0x1){var _0x1ea3b2=_0x2aecf7[_0xbb5b('0x17')][_0x265944];if(fs[_0xbb5b('0x19')](path['join'](__dirname,'applications',_0x1ea3b2[_0xbb5b('0x1a')]+_0xbb5b('0x1b')))){var _0x5a10eb=[];switch(_0x1ea3b2[_0xbb5b('0x1a')]['toLowerCase']()){case _0xbb5b('0x1c'):var _0xda7b47=_0x1ea3b2[_0xbb5b('0x1d')][_0xbb5b('0x1e')](',');if(_0x2aecf7['channel']==='mail'){_0x5a10eb['push'](_0xda7b47[0x0]);_0x5a10eb[_0xbb5b('0x1f')](_0xda7b47[0x1]);_0x5a10eb[_0xbb5b('0x1f')](_0xda7b47[_0xbb5b('0x20')](0x2,_0xda7b47['length'])['join'](','));}else{_0x5a10eb[_0xbb5b('0x1f')](_0xda7b47[0x0]);_0x5a10eb['push'](_0xda7b47[_0xbb5b('0x20')](0x1,_0xda7b47['length'])[_0xbb5b('0x21')](','));}break;case'dialogflow':var _0x5e58c8=_0x1ea3b2[_0xbb5b('0x1d')][_0xbb5b('0x1e')](',');_0x5a10eb['push'](_0x5e58c8[0x0]);_0x5a10eb[_0xbb5b('0x1f')](_0x5e58c8[0x1]);_0x5a10eb[_0xbb5b('0x1f')](_0x5e58c8[_0xbb5b('0x20')](0x2,_0x5e58c8[_0xbb5b('0x18')])['join'](','));break;case'dialogflowv2':var _0xa087d5=_0x1ea3b2[_0xbb5b('0x1d')]['split'](',');_0x5a10eb[_0xbb5b('0x1f')](_0xa087d5[0x0]);_0x5a10eb['push'](_0xa087d5[0x1]);_0x5a10eb[_0xbb5b('0x1f')](_0xa087d5[0x2]);_0x5a10eb[_0xbb5b('0x1f')](_0xa087d5[0x3]);_0x5a10eb[_0xbb5b('0x1f')](_0xa087d5['slice'](0x4,_0xa087d5[_0xbb5b('0x18')])[_0xbb5b('0x21')](','));break;case _0xbb5b('0x22'):var _0x52adab=_0x1ea3b2['appdata'][_0xbb5b('0x1e')](',');_0x5a10eb[_0xbb5b('0x1f')](_0x52adab[0x0]);_0x5a10eb[_0xbb5b('0x1f')](_0x52adab[0x1]);_0x5a10eb[_0xbb5b('0x1f')](_0x52adab[0x2]);_0x5a10eb['push'](_0x52adab[0x3]);_0x5a10eb[_0xbb5b('0x1f')](_0x52adab[_0xbb5b('0x20')](0x4,_0x52adab[_0xbb5b('0x18')])['join'](','));break;case'message':_0x5a10eb['push'](_0x1ea3b2[_0xbb5b('0x1d')]);break;case'tag':_0x5a10eb[_0xbb5b('0x1f')](_0x1ea3b2[_0xbb5b('0x23')]);_0x5a10eb[_0xbb5b('0x1f')](_0x1ea3b2[_0xbb5b('0x1d')]);break;case _0xbb5b('0x24'):var _0x5a81bb=utils['getMustacheRender'](_0x2aecf7[_0xbb5b('0x25')]['notificationTemplate'],_0x2aecf7);var _0x4c4d47=_0x1ea3b2[_0xbb5b('0x1d')][_0xbb5b('0x1e')](',');_0x5a10eb[_0xbb5b('0x1f')](_0x4c4d47[0x0]);_0x5a10eb[_0xbb5b('0x1f')](_0x4c4d47[0x1]);_0x5a10eb['push'](_0x4c4d47[0x2]);_0x5a10eb[_0xbb5b('0x1f')](_0x4c4d47[0x3]);_0x5a10eb[_0xbb5b('0x1f')](_0x4c4d47[0x4]);_0x5a10eb['push'](_0x4c4d47[0x5]);_0x5a10eb['push'](_0x4c4d47[0x6]);_0x5a10eb[_0xbb5b('0x1f')](_0x4c4d47[0x7]);_0x5a10eb['push'](_0x4c4d47[0x8]);_0x5a10eb['push'](_0x4c4d47[0x9]);_0x5a10eb['push'](_0x4c4d47[0xa]);_0x5a10eb['push'](_0x2aecf7[_0xbb5b('0x14')]['id']);_0x5a10eb[_0xbb5b('0x1f')](_0x2aecf7[_0xbb5b('0x13')]['id']);_0x5a10eb[_0xbb5b('0x1f')](_0x1ea3b2[_0xbb5b('0x26')]);_0x5a10eb[_0xbb5b('0x1f')](_0x2aecf7['interaction'][_0xbb5b('0x27')]);_0x5a10eb['push'](_0x2aecf7['body'][_0xbb5b('0x28')]);_0x5a10eb[_0xbb5b('0x1f')](_0x5a81bb);break;default:_0x5a10eb=_['isNil'](_0x1ea3b2[_0xbb5b('0x1d')])?[]:_0x1ea3b2[_0xbb5b('0x1d')][_0xbb5b('0x1e')](',');}var _0x6bc7de={'id':util[_0xbb5b('0x9')](_0xbb5b('0x29'),_0x380044,_0x1ea3b2['id'],_0x1ea3b2[_0xbb5b('0x1a')]),'condition':require(_0xbb5b('0x2a'))[_0xbb5b('0x2b')](_0x380044,getIntervals(_0x8f9833[_0xbb5b('0x2c')],_0x1ea3b2),_0x8f9833),'consequence':require(_0xbb5b('0x2d')+_0x1ea3b2[_0xbb5b('0x1a')])['consequence'](_0x380044,_0x5a10eb,_0x8f9833,_0x2aecf7),'p':_0x1ea3b2['priority']||0x0};logger[_0xbb5b('0x2e')]('Push\x20new\x20rule',_0x6bc7de['id'],_0xbb5b('0x2f'),getIntervals(_0x8f9833[_0xbb5b('0x2c')],_0x1ea3b2)[_0xbb5b('0x21')](_0xbb5b('0x30')));_0x43f396[_0xbb5b('0x1f')](_0x6bc7de);}else{logger['error'](_0xbb5b('0x31'),path[_0xbb5b('0x21')](__dirname,_0xbb5b('0x17'),_0x1ea3b2[_0xbb5b('0x1a')]+_0xbb5b('0x1b')));}}_0x8f9833[_0xbb5b('0x11')][_0x380044]=new RuleEngine(_0x43f396);_0x8f9833[_0xbb5b('0x11')][_0x380044]['execute'](_0x2aecf7,function(_0x2d505f){logger[_0xbb5b('0x2e')]('Applications\x20executed',JSON[_0xbb5b('0x32')](_0x2d505f[_0xbb5b('0x33')]));if(_0x8f9833[_0xbb5b('0x11')][_0x380044]){_0x8f9833[_0xbb5b('0x11')][_0x380044]['emit'](_0xbb5b('0x34'));}});return _0x3b2edb({'code':0xc8,'message':_0x2aecf7});}else{if(_0x1e84fc){logger[_0xbb5b('0x2e')](util['format'](_0xbb5b('0x35'),_0x380044));}else{logger['info'](_0xbb5b('0x36'));}return _0x3b2edb({'code':0xc8,'message':_0x2aecf7});}}catch(_0x121cc9){logger[_0xbb5b('0x37')](_0x121cc9[_0xbb5b('0x38')]);return _0x5ee29e(_0x60f86d['error'](0x1f4,_0x121cc9));}}return _0x5ee29e(_0xbb5b('0x39'));});},'AcceptMessage':function(_0x43969a){var _0x3fa4d7=this;return new Promise(function(_0x25c15c,_0x431514){if(_0x43969a[_0xbb5b('0x3a')]&&_0x43969a['agent']['id']){if(_0x8f9833['agents'][_0x43969a[_0xbb5b('0x3a')]['id']]){_0x8f9833[_0xbb5b('0x3b')][_0x43969a[_0xbb5b('0x3a')]['id']][_0xbb5b('0x3c')]=![];_0x8f9833[_0xbb5b('0x3b')][_0x43969a[_0xbb5b('0x3a')]['id']][_0xbb5b('0x3d')]=undefined;}}if(_0x43969a[_0xbb5b('0x13')]&&_0x43969a[_0xbb5b('0x13')]['id']){try{var _0x5634f4=getId(_0x43969a[_0xbb5b('0x12')],_0x43969a[_0xbb5b('0x13')]?_0x43969a[_0xbb5b('0x13')]['id']:0x0,_0x43969a[_0xbb5b('0x14')]?_0x43969a[_0xbb5b('0x14')]['id']:0x0);if(_0x8f9833[_0xbb5b('0x11')][_0x5634f4]){_0x8f9833[_0xbb5b('0x11')][_0x5634f4]['emit']('end');if(rpc[_0x43969a['channel']+_0xbb5b('0x3e')]){rpc[_0x43969a[_0xbb5b('0x12')]+_0xbb5b('0x3e')]['update'](_0x5634f4,{'UserId':_0x43969a[_0xbb5b('0x13')]['UserId']})[_0xbb5b('0x3f')](function(_0x3377e1){logger[_0xbb5b('0x37')]('error\x20update\x20queue\x20report');});}}return _0x25c15c({'code':0xc8,'message':_0x43969a});}catch(_0xd26f71){logger[_0xbb5b('0x37')](_0xd26f71[_0xbb5b('0x38')]);return _0x431514(_0x3fa4d7[_0xbb5b('0x37')](0x1f4,_0xd26f71));}}logger[_0xbb5b('0x37')](_0xbb5b('0x40'));return _0x431514(_0x3fa4d7[_0xbb5b('0x37')](0x1f4,_0xbb5b('0x40')));});},'RejectMessage':function(_0x40c624){var _0x5b472b=this;return new Promise(function(_0x270b5c,_0x25bd47){if(_0x40c624[_0xbb5b('0x3a')]&&_0x40c624['agent']['id']){try{if(_0x8f9833[_0xbb5b('0x3b')][_0x40c624['agent']['id']]){_0x8f9833['agents'][_0x40c624[_0xbb5b('0x3a')]['id']][_0xbb5b('0x3c')]=![];_0x8f9833[_0xbb5b('0x3b')][_0x40c624[_0xbb5b('0x3a')]['id']][_0xbb5b('0x3d')]=undefined;}return _0x270b5c({'code':0xc8,'message':_0x40c624});}catch(_0x4b87ff){logger[_0xbb5b('0x37')](_0x4b87ff[_0xbb5b('0x38')]);return _0x25bd47(_0x5b472b['error'](0x1f4,_0x4b87ff));}}logger[_0xbb5b('0x37')]('message\x20is\x20empty');return _0x25bd47(_0x5b472b[_0xbb5b('0x37')](0x1f4,_0xbb5b('0x40')));});},'AbandonInteraction':function(_0x5aff35){var _0x459139=this;return new Promise(function(_0x5306e,_0x385c84){if(_0x5aff35[_0xbb5b('0x12')]&&_0x5aff35['interaction']&&_0x5aff35[_0xbb5b('0x14')]['id']){try{var _0x1f57f2=getId(_0x5aff35[_0xbb5b('0x12')],_0x5aff35[_0xbb5b('0x13')]?_0x5aff35[_0xbb5b('0x13')]['id']:0x0,_0x5aff35['interaction']?_0x5aff35['interaction']['id']:0x0);if(_0x8f9833[_0xbb5b('0x11')][_0x1f57f2]){_0x8f9833[_0xbb5b('0x11')][_0x1f57f2][_0xbb5b('0x41')](_0xbb5b('0x42'));}return _0x5306e({'code':0xc8,'message':_0x5aff35});}catch(_0xa34c78){logger['error'](_0xa34c78[_0xbb5b('0x38')]);return _0x385c84(_0x459139[_0xbb5b('0x37')](0x1f4,_0xa34c78));}}logger[_0xbb5b('0x37')](_0xbb5b('0x40'));return _0x385c84(_0x459139[_0xbb5b('0x37')](0x1f4,_0xbb5b('0x40')));});},'AgentCapacity':function(_0x5e37e8){var _0x19a9d5=this;return new Promise(function(_0x2b23bf,_0x2111c0){if(_0x8f9833[_0xbb5b('0x3b')]['hasOwnProperty'](_0x5e37e8['id'])){for(var _0x47cf2f in _0x5e37e8['capacity']){if(_0x5e37e8['capacity'][_0xbb5b('0x43')](_0x47cf2f)){if(_0x8f9833['agents'][_0x5e37e8['id']][_0xbb5b('0x43')](_0x47cf2f+_0xbb5b('0x44'))){_0x8f9833['agents'][_0x5e37e8['id']][_0x47cf2f+_0xbb5b('0x44')]=parseInt(_0x5e37e8[_0xbb5b('0x45')][_0x47cf2f],0xa);}}}_0x8f9833[_0xbb5b('0x3b')][_0x5e37e8['id']][_0xbb5b('0x46')]();return _0x2b23bf({'code':0xc8,'message':_0x8f9833[_0xbb5b('0x3b')][_0x5e37e8['id']]});}else{return _0x2111c0(_0x19a9d5['error'](0x1f4,_0xbb5b('0x47')));}});},'Agents':function(_0x25383a){return new Promise(function(_0x1219af,_0x2a05b5){var _0x18b8dc=_[_0xbb5b('0x48')](_0x8f9833[_0xbb5b('0x3b')]);_0x1219af({'count':_0x18b8dc[_0xbb5b('0x18')],'rows':_0x18b8dc});});},'ChatQueues':function(_0x2ea00e){return new Promise(function(_0x41a130,_0x28e243){var _0x41fc18=[];for(var _0x279f62 in _0x8f9833['chatQueues']){if(_0x8f9833[_0xbb5b('0x49')]['hasOwnProperty'](_0x279f62)){var _0x413396=_0x8f9833['chatQueues'][_0x279f62];var _0x37a6b4={'id':_0x413396['id'],'available':_0x413396[_0xbb5b('0x4a')],'loggedIn':_0x413396[_0xbb5b('0x4b')],'name':_0x413396[_0xbb5b('0x4c')],'paused':_0x413396['paused'],'waiting':_0x413396[_0xbb5b('0x4d')]};_0x41fc18[_0xbb5b('0x1f')](_0x37a6b4);}}_0x41a130({'count':_0x41fc18[_0xbb5b('0x18')],'rows':_0x41fc18});});},'MailQueues':function(_0xd9f64f){return new Promise(function(_0x364b98,_0x433ba1){var _0x15d825=[];for(var _0x17901a in _0x8f9833['mailQueues']){if(_0x8f9833[_0xbb5b('0x4e')]['hasOwnProperty'](_0x17901a)){var _0x3a1634=_0x8f9833['mailQueues'][_0x17901a];var _0x215230={'id':_0x3a1634['id'],'available':_0x3a1634['available'],'loggedIn':_0x3a1634[_0xbb5b('0x4b')],'name':_0x3a1634[_0xbb5b('0x4c')],'paused':_0x3a1634[_0xbb5b('0x4f')],'waiting':_0x3a1634['waiting']};_0x15d825[_0xbb5b('0x1f')](_0x215230);}}_0x364b98({'count':_0x15d825[_0xbb5b('0x18')],'rows':_0x15d825});});},'OpenchannelQueues':function(_0x40d2e1){return new Promise(function(_0x14dbfb,_0x56f459){var _0x4cb116=[];for(var _0x1c3226 in _0x8f9833['openchannelQueues']){if(_0x8f9833[_0xbb5b('0x50')]['hasOwnProperty'](_0x1c3226)){var _0x3d09a8=_0x8f9833[_0xbb5b('0x50')][_0x1c3226];var _0x11d90a={'id':_0x3d09a8['id'],'available':_0x3d09a8[_0xbb5b('0x4a')],'loggedIn':_0x3d09a8[_0xbb5b('0x4b')],'name':_0x3d09a8[_0xbb5b('0x4c')],'paused':_0x3d09a8[_0xbb5b('0x4f')],'waiting':_0x3d09a8[_0xbb5b('0x4d')]};_0x4cb116[_0xbb5b('0x1f')](_0x11d90a);}}_0x14dbfb({'count':_0x4cb116[_0xbb5b('0x18')],'rows':_0x4cb116});});},'SmsQueues':function(_0x1ce83a){return new Promise(function(_0x24e263,_0x52a668){var _0x10ace9=[];for(var _0x239a51 in _0x8f9833[_0xbb5b('0x51')]){if(_0x8f9833[_0xbb5b('0x51')][_0xbb5b('0x43')](_0x239a51)){var _0x3394f9=_0x8f9833[_0xbb5b('0x51')][_0x239a51];var _0x3bef7d={'id':_0x3394f9['id'],'available':_0x3394f9['available'],'loggedIn':_0x3394f9['loggedIn'],'name':_0x3394f9['name'],'paused':_0x3394f9['paused'],'waiting':_0x3394f9[_0xbb5b('0x4d')]};_0x10ace9[_0xbb5b('0x1f')](_0x3bef7d);}}_0x24e263({'count':_0x10ace9[_0xbb5b('0x18')],'rows':_0x10ace9});});},'FaxQueues':function(_0x3d600d){return new Promise(function(_0x5ad188,_0xb2852e){var _0x30dba0=[];for(var _0x16992f in _0x8f9833[_0xbb5b('0x52')]){if(_0x8f9833[_0xbb5b('0x52')][_0xbb5b('0x43')](_0x16992f)){var _0x267d06=_0x8f9833[_0xbb5b('0x52')][_0x16992f];var _0x5a09c8={'id':_0x267d06['id'],'available':_0x267d06[_0xbb5b('0x4a')],'loggedIn':_0x267d06['loggedIn'],'name':_0x267d06[_0xbb5b('0x4c')],'paused':_0x267d06['paused'],'waiting':_0x267d06[_0xbb5b('0x4d')]};_0x30dba0[_0xbb5b('0x1f')](_0x5a09c8);}}_0x5ad188({'count':_0x30dba0[_0xbb5b('0x18')],'rows':_0x30dba0});});},'WhatsappQueues':function(_0x18043f){return new Promise(function(_0x4a2699,_0x1a2593){var _0x34cc69=[];for(var _0x323dbd in _0x8f9833[_0xbb5b('0x53')]){if(_0x8f9833['whatsappQueues'][_0xbb5b('0x43')](_0x323dbd)){var _0x4dab92=_0x8f9833[_0xbb5b('0x53')][_0x323dbd];var _0x53648e={'id':_0x4dab92['id'],'available':_0x4dab92[_0xbb5b('0x4a')],'loggedIn':_0x4dab92[_0xbb5b('0x4b')],'name':_0x4dab92['name'],'paused':_0x4dab92['paused'],'waiting':_0x4dab92['waiting']};_0x34cc69[_0xbb5b('0x1f')](_0x53648e);}}_0x4a2699({'count':_0x34cc69['length'],'rows':_0x34cc69});});},'ChatQueuesWaitingInteractions':function(_0x12fd47){return new Promise(function(_0x3a3ec1,_0x2f5c43){var _0xaa562c=_[_0xbb5b('0x48')](_0x8f9833[_0xbb5b('0x54')]);_0x3a3ec1({'count':_0xaa562c[_0xbb5b('0x18')],'rows':_0xaa562c});});},'MailQueuesWaitingInteractions':function(_0x35ee98){return new Promise(function(_0x5c9b91,_0xd00d95){var _0x330d9b=_[_0xbb5b('0x48')](_0x8f9833[_0xbb5b('0x55')]);_0x5c9b91({'count':_0x330d9b[_0xbb5b('0x18')],'rows':_0x330d9b});});},'OpenchannelQueuesWaitingInteractions':function(_0x51876f){return new Promise(function(_0x328278,_0x384ce2){var _0x3c9743=_[_0xbb5b('0x48')](_0x8f9833[_0xbb5b('0x56')]);_0x328278({'count':_0x3c9743['length'],'rows':_0x3c9743});});},'SmsQueuesWaitingInteractions':function(_0xb12d07){return new Promise(function(_0x5d52f3,_0x86b994){var _0x3f7745=_[_0xbb5b('0x48')](_0x8f9833[_0xbb5b('0x57')]);_0x5d52f3({'count':_0x3f7745['length'],'rows':_0x3f7745});});},'FaxQueuesWaitingInteractions':function(_0x1713b9){return new Promise(function(_0x190b1d,_0x21cdbd){var _0x4e1ea0=_['values'](_0x8f9833[_0xbb5b('0x58')]);_0x190b1d({'count':_0x4e1ea0[_0xbb5b('0x18')],'rows':_0x4e1ea0});});},'WhatsappQueuesWaitingInteractions':function(_0x2fc6f8){return new Promise(function(_0x119acf,_0x1b0a04){var _0x2e5152=_[_0xbb5b('0x48')](_0x8f9833['whatsappQueuesWaitingInteractions']);_0x119acf({'count':_0x2e5152[_0xbb5b('0x18')],'rows':_0x2e5152});});}};var _0x3eebba=jayson['server'](_0x117f6d)['http']();_0x3eebba['on'](_0xbb5b('0x37'),function(_0x3a9fb2){logger['error'](JSON[_0xbb5b('0x32')](_0x3a9fb2));return _0x39262f(_0x3a9fb2);});_0x3eebba[_0xbb5b('0x10')](0x232c,_0xbb5b('0x59'),function(){console[_0xbb5b('0x5a')](_0xbb5b('0x5b'),0x232c);return _0x5b026b(_0xbb5b('0x5c')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 15784c7..b767d0e 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 _0x8e47=['condition','info','push','Command','format','indexOf','catch','[%s][INTERVAL]\x20%s','all','some','join','\x20|\x20','log','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','result'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8e47,0x188));var _0x78e4=function(_0x51ee24,_0xa976d1){_0x51ee24=_0x51ee24-0x0;var _0x97ce62=_0x8e47[_0x51ee24];return _0x97ce62;};'use strict';var util=require(_0x78e4('0x0'));var BPromise=require(_0x78e4('0x1'));var jayson=require(_0x78e4('0x2'));var _=require(_0x78e4('0x3'));var logger=require(_0x78e4('0x4'))(_0x78e4('0x5'));var client=jayson[_0x78e4('0x6')][_0x78e4('0x7')]({'port':0x232a});function request(_0x44ce79,_0x3a28ae){return new BPromise(function(_0x495167,_0x545ab7){return client[_0x78e4('0x8')](_0x44ce79,_0x3a28ae)[_0x78e4('0x9')](function(_0x38806f){if(_0x38806f[_0x78e4('0xa')]){return _0x545ab7(_0x38806f[_0x78e4('0xa')][_0x78e4('0xb')]);}else{return _0x495167(_0x38806f[_0x78e4('0xc')]);}})['catch'](function(_0x5ac9d7){return _0x545ab7(_0x5ac9d7);});});}exports[_0x78e4('0xd')]=function(_0x8203b9,_0x1da1ee,_0x1c78c2){return function(_0x433000){if(_0x1c78c2['rules']&&!_0x1c78c2['rules'][_0x8203b9]){logger[_0x78e4('0xe')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x8203b9);return _0x433000['stop']();}var _0x438f39=[];for(var _0x2a0f44=0x0;_0x2a0f44<_0x1da1ee['length'];_0x2a0f44+=0x1){_0x438f39[_0x78e4('0xf')](request(_0x78e4('0x10'),{'command':util[_0x78e4('0x11')]('iftime\x20%s',_0x1da1ee[_0x2a0f44])})['then'](function(_0x3202d4){return _0x3202d4&&_0x3202d4['message']&&_0x3202d4[_0x78e4('0xb')][_0x78e4('0x12')]('true')>=0x0?!![]:![];})[_0x78e4('0x13')](function(_0x226c1c){logger['error'](_0x78e4('0x14'),_0x8203b9,_0x1da1ee[_0x2a0f44]);}));}BPromise[_0x78e4('0x15')](_0x438f39)[_0x78e4('0x9')](function(_0x564dab){var _0x1e7fe2=_[_0x78e4('0x16')](_0x564dab);logger[_0x78e4('0xe')]('[%s][INTERVAL]\x20%s\x20%s',_0x8203b9,_0x1da1ee[_0x78e4('0x17')](_0x78e4('0x18')),_0x1e7fe2);_0x433000['when'](_0x1e7fe2);})['catch'](function(_0x51dccf){console[_0x78e4('0x19')](_0x51dccf);logger[_0x78e4('0xa')]('[%s][INTERVAL]\x20%s\x20%s',_0x8203b9,_0x1da1ee['join'](_0x78e4('0x18')),_0x51dccf[_0x78e4('0x1a')]);_0x433000['stop']();});};}; \ No newline at end of file +var _0x3b4a=['all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','client','http','request','then','error','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s'];(function(_0x12f513,_0x4d00c0){var _0x2582fa=function(_0x14304a){while(--_0x14304a){_0x12f513['push'](_0x12f513['shift']());}};_0x2582fa(++_0x4d00c0);}(_0x3b4a,0xef));var _0xa3b4=function(_0x4ad37c,_0x2e7490){_0x4ad37c=_0x4ad37c-0x0;var _0x288919=_0x3b4a[_0x4ad37c];return _0x288919;};'use strict';var util=require(_0xa3b4('0x0'));var BPromise=require(_0xa3b4('0x1'));var jayson=require(_0xa3b4('0x2'));var _=require(_0xa3b4('0x3'));var logger=require(_0xa3b4('0x4'))('routing');var client=jayson[_0xa3b4('0x5')][_0xa3b4('0x6')]({'port':0x232a});function request(_0x22cac1,_0x267647){return new BPromise(function(_0x1e41df,_0xf34207){return client[_0xa3b4('0x7')](_0x22cac1,_0x267647)[_0xa3b4('0x8')](function(_0x530881){if(_0x530881[_0xa3b4('0x9')]){return _0xf34207(_0x530881['error']['message']);}else{return _0x1e41df(_0x530881['result']);}})[_0xa3b4('0xa')](function(_0x112175){return _0xf34207(_0x112175);});});}exports[_0xa3b4('0xb')]=function(_0xaf557b,_0x3a11f8,_0x55aac6){return function(_0x119bff){if(_0x55aac6[_0xa3b4('0xc')]&&!_0x55aac6[_0xa3b4('0xc')][_0xaf557b]){logger[_0xa3b4('0xd')](_0xa3b4('0xe'),_0xaf557b);return _0x119bff[_0xa3b4('0xf')]();}var _0x128550=[];for(var _0xe4a3dd=0x0;_0xe4a3dd<_0x3a11f8['length'];_0xe4a3dd+=0x1){_0x128550[_0xa3b4('0x10')](request('Command',{'command':util['format'](_0xa3b4('0x11'),_0x3a11f8[_0xe4a3dd])})[_0xa3b4('0x8')](function(_0x2b80d4){return _0x2b80d4&&_0x2b80d4[_0xa3b4('0x12')]&&_0x2b80d4[_0xa3b4('0x12')][_0xa3b4('0x13')](_0xa3b4('0x14'))>=0x0?!![]:![];})['catch'](function(_0x1a39b4){logger['error'](_0xa3b4('0x15'),_0xaf557b,_0x3a11f8[_0xe4a3dd]);}));}BPromise[_0xa3b4('0x16')](_0x128550)[_0xa3b4('0x8')](function(_0x1e5738){var _0x5f53c4=_[_0xa3b4('0x17')](_0x1e5738);logger[_0xa3b4('0xd')](_0xa3b4('0x18'),_0xaf557b,_0x3a11f8['join'](_0xa3b4('0x19')),_0x5f53c4);_0x119bff[_0xa3b4('0x1a')](_0x5f53c4);})['catch'](function(_0x32f3fe){console[_0xa3b4('0x1b')](_0x32f3fe);logger['error'](_0xa3b4('0x18'),_0xaf557b,_0x3a11f8['join']('\x20|\x20'),_0x32f3fe[_0xa3b4('0x1c')]);_0x119bff['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 0b07145..71d7c59 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 _0x0fd9=['agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','format','agentcalledAt','now','connectedlinenum','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','holdtime','ringtime','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','reason','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connect','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','transfer','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','calleridnum','hangup','cause','rejected','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','[%s][agents][hangup]','util','./utils','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','lastevent','then','type'];(function(_0x2529a8,_0x116eca){var _0x200b44=function(_0x28adec){while(--_0x28adec){_0x2529a8['push'](_0x2529a8['shift']());}};_0x200b44(++_0x116eca);}(_0x0fd9,0xa3));var _0x90fd=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0x0fd9[_0x4b12ae];return _0x16957b;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var utils=require(_0x90fd('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x685cd0,_0x32f6b6){utils['info'](util['format'](_0x90fd('0x2'),_0x685cd0[_0x90fd('0x3')],_0x685cd0[_0x90fd('0x4')],_0x685cd0[_0x90fd('0x5')],_0x685cd0[_0x90fd('0x6')],_0x685cd0[_0x90fd('0x7')],_0x685cd0['calleridnum'],_0x685cd0['connectedlinenum'],_0x685cd0[_0x90fd('0x8')]));if(_0x685cd0['queue']){utils['getVoiceQueueByName'](_0x685cd0[_0x90fd('0x5')])[_0x90fd('0x9')](function(_0x5e66f0){if(_0x5e66f0){_0x685cd0[_0x90fd('0xa')]=_0x5e66f0[_0x90fd('0xa')];_0x685cd0[_0x90fd('0xb')]=_0x685cd0[_0x90fd('0xc')]?_0x5e66f0[_0x90fd('0xd')]:![];_0x685cd0[_0x90fd('0xe')]=_0x685cd0[_0x90fd('0xb')]?_0x5e66f0[_0x90fd('0xf')]:0x0;}utils[_0x90fd('0x10')]('CreateVoiceAgentReport',_0x685cd0);});}else{utils[_0x90fd('0x10')](_0x90fd('0x11'),_0x685cd0);}if(_0x32f6b6){delete transfers[_0x685cd0['uniqueid']];}else{delete agents[_0x685cd0[_0x90fd('0x12')]];}}exports[_0x90fd('0x13')]=function(_0x19a594){try{utils['debug'](util[_0x90fd('0x14')]('[%s][agents][agentcalled]',_0x19a594[_0x90fd('0x3')]),_0x19a594);agents[_0x19a594[_0x90fd('0x12')]]=_0x19a594;agents[_0x19a594[_0x90fd('0x12')]][_0x90fd('0x15')]=utils[_0x90fd('0x16')]();agents[_0x19a594[_0x90fd('0x12')]][_0x90fd('0x8')]='called';agents[_0x19a594['destuniqueid']][_0x90fd('0x17')]=null;agents[_0x19a594[_0x90fd('0x12')]]['connectedlinename']=null;utils[_0x90fd('0x18')](util[_0x90fd('0x14')](_0x90fd('0x19'),_0x19a594['uniqueid'],agents[_0x19a594[_0x90fd('0x12')]][_0x90fd('0x6')],_0x19a594[_0x90fd('0x12')]));}catch(_0x14958b){utils[_0x90fd('0x1a')](util[_0x90fd('0x14')](_0x90fd('0x1b'),_0x19a594[_0x90fd('0x3')]),_0x14958b);}};exports[_0x90fd('0x1c')]=function(_0x90197e){try{if(!_[_0x90fd('0x1d')](agents[_0x90197e[_0x90fd('0x12')]])){utils[_0x90fd('0x1e')](util[_0x90fd('0x14')](_0x90fd('0x1f'),_0x90197e['uniqueid']),_0x90197e);utils[_0x90fd('0x18')](util[_0x90fd('0x14')](_0x90fd('0x20'),_0x90197e[_0x90fd('0x3')],agents[_0x90197e[_0x90fd('0x12')]][_0x90fd('0x6')],_0x90197e[_0x90fd('0x12')]));agents[_0x90197e[_0x90fd('0x12')]]['agentringnoanswer']=!![];agents[_0x90197e[_0x90fd('0x12')]]['agentringnoanswerAt']=utils[_0x90fd('0x16')]();agents[_0x90197e[_0x90fd('0x12')]][_0x90fd('0x8')]=_0x90fd('0x21');agents[_0x90197e[_0x90fd('0x12')]]['reason']=_0x90fd('0x21');agents[_0x90197e[_0x90fd('0x12')]][_0x90fd('0x22')]=_0x90197e[_0x90fd('0x23')]?parseInt(_0x90197e[_0x90fd('0x23')])/0x3e8:0x0;agents[_0x90197e[_0x90fd('0x12')]]['talktime']=0x0;unanswered['push'](_0x90197e[_0x90fd('0x12')]);}}catch(_0x170cfb){utils[_0x90fd('0x1a')](util[_0x90fd('0x14')](_0x90fd('0x1f'),_0x90197e['uniqueid']),_0x170cfb);}};exports['queuecallerabandon']=function(_0x3781bb){try{_[_0x90fd('0x24')](agents,function(_0x228fbc,_0x3a0102){if(_0x228fbc['uniqueid']==_0x3781bb['uniqueid']&&!_[_0x90fd('0x25')](unanswered,_0x228fbc[_0x90fd('0x12')])){utils[_0x90fd('0x1e')](util[_0x90fd('0x14')]('[%s][agents][queuecallerabandon]',_0x3781bb[_0x90fd('0x3')]),_0x3781bb);utils[_0x90fd('0x18')](util[_0x90fd('0x14')](_0x90fd('0x26'),_0x3781bb[_0x90fd('0x3')],_0x228fbc[_0x90fd('0x6')],_0x228fbc[_0x90fd('0x12')]));_0x228fbc[_0x90fd('0x1c')]=!![];_0x228fbc[_0x90fd('0x27')]=utils[_0x90fd('0x16')]();_0x228fbc[_0x90fd('0x8')]=_0x90fd('0x28');_0x228fbc[_0x90fd('0x29')]=_0x90fd('0x28');_0x228fbc[_0x90fd('0x22')]=_0x3781bb[_0x90fd('0x22')];_0x228fbc['talktime']=0x0;writeDB(_0x228fbc);}});}catch(_0x13c019){utils[_0x90fd('0x1a')](util[_0x90fd('0x14')](_0x90fd('0x2a'),_0x3781bb[_0x90fd('0x3')]),_0x13c019);}};exports[_0x90fd('0x2b')]=function(_0x35eae2){try{if(agents[_0x35eae2[_0x90fd('0x12')]]){utils[_0x90fd('0x1e')](util[_0x90fd('0x14')](_0x90fd('0x2c'),_0x35eae2[_0x90fd('0x3')]),_0x35eae2);utils[_0x90fd('0x18')](util['format'](_0x90fd('0x2d'),_0x35eae2[_0x90fd('0x3')],agents[_0x35eae2[_0x90fd('0x12')]][_0x90fd('0x6')],_0x35eae2['destuniqueid']));agents[_0x35eae2[_0x90fd('0x12')]][_0x90fd('0x2e')]=utils[_0x90fd('0x16')]();agents[_0x35eae2['destuniqueid']]['connectedlinenum']=_0x35eae2[_0x90fd('0x17')];agents[_0x35eae2[_0x90fd('0x12')]][_0x90fd('0x2f')]=_0x35eae2[_0x90fd('0x2f')];agents[_0x35eae2[_0x90fd('0x12')]][_0x90fd('0x22')]=_0x35eae2[_0x90fd('0x23')];agents[_0x35eae2[_0x90fd('0x12')]][_0x90fd('0x8')]=_0x90fd('0x30');_[_0x90fd('0x24')](agents,function(_0x43c84c,_0x21dc9c){if(_0x43c84c[_0x90fd('0x12')]!=_0x35eae2[_0x90fd('0x12')]&&_0x43c84c[_0x90fd('0x3')]==_0x35eae2[_0x90fd('0x3')]){_0x43c84c[_0x90fd('0x31')]=0x0;_0x43c84c['holdtime']=_0x35eae2[_0x90fd('0x23')];_0x43c84c[_0x90fd('0x1c')]=!![];_0x43c84c[_0x90fd('0x27')]=utils['now']();_0x43c84c['lastevent']='answered_elsewhere';_0x43c84c[_0x90fd('0x29')]=_0x90fd('0x32');_0x43c84c[_0x90fd('0x33')]=_0x35eae2[_0x90fd('0x12')];_0x43c84c[_0x90fd('0x34')]=_0x35eae2[_0x90fd('0x6')];writeDB(_0x43c84c);}});}}catch(_0x363365){utils[_0x90fd('0x1a')](util[_0x90fd('0x14')](_0x90fd('0x2c'),_0x35eae2[_0x90fd('0x3')]),_0x363365);}};exports[_0x90fd('0xc')]=function(_0x4cb682){try{if(!_[_0x90fd('0x1d')](agents[_0x4cb682[_0x90fd('0x12')]])){utils['debug'](util['format'](_0x90fd('0x35'),_0x4cb682[_0x90fd('0x3')]),_0x4cb682);utils[_0x90fd('0x18')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4cb682[_0x90fd('0x3')],agents[_0x4cb682[_0x90fd('0x12')]]['membername'],_0x4cb682['destuniqueid']));agents[_0x4cb682[_0x90fd('0x12')]][_0x90fd('0xc')]=!![];agents[_0x4cb682['destuniqueid']]['agentcompleteAt']=utils[_0x90fd('0x16')]();agents[_0x4cb682[_0x90fd('0x12')]][_0x90fd('0x31')]=utils['diffTime'](agents[_0x4cb682[_0x90fd('0x12')]][_0x90fd('0x36')],agents[_0x4cb682['destuniqueid']]['agentconnectAt']);agents[_0x4cb682['destuniqueid']][_0x90fd('0x29')]=_0x4cb682[_0x90fd('0x29')];agents[_0x4cb682['destuniqueid']][_0x90fd('0x8')]=_0x90fd('0x37');writeDB(agents[_0x4cb682[_0x90fd('0x12')]]);}}catch(_0xe5e47e){utils[_0x90fd('0x1a')](util['format']('[%s][agents][agentcomplete]',_0x4cb682[_0x90fd('0x3')]),_0xe5e47e);}};exports[_0x90fd('0x38')]=function(_0x125874){try{if(!_[_0x90fd('0x1d')](agents[_0x125874[_0x90fd('0x39')]])){utils[_0x90fd('0x1e')](util[_0x90fd('0x14')](_0x90fd('0x3a'),_0x125874[_0x90fd('0x3')]),_0x125874);utils[_0x90fd('0x18')](util['format'](_0x90fd('0x3b'),_0x125874[_0x90fd('0x3')],agents[_0x125874[_0x90fd('0x39')]][_0x90fd('0x6')],agents[_0x125874['transfereruniqueid']]['uniqueid']));agents[_0x125874[_0x90fd('0x39')]]['transfer']=!![];agents[_0x125874['transfereruniqueid']][_0x90fd('0x3c')]=_0x90fd('0x3d');agents[_0x125874[_0x90fd('0x39')]][_0x90fd('0x3e')]=_0x125874[_0x90fd('0x3f')];agents[_0x125874[_0x90fd('0x39')]][_0x90fd('0x40')]=agents[_0x125874['transfereruniqueid']]['uniqueid'];}}catch(_0x1b81dc){utils[_0x90fd('0x1a')](util[_0x90fd('0x14')]('[%s][agents][blindtransfer]',_0x125874[_0x90fd('0x3')]),_0x1b81dc);}};exports[_0x90fd('0x41')]=function(_0x223554){try{utils[_0x90fd('0x1e')](util[_0x90fd('0x14')](_0x90fd('0x42'),_0x223554[_0x90fd('0x43')]),_0x223554);if(_0x223554[_0x90fd('0x43')]==_0x223554['origtransfererlinkedid']){if(!_['isNil'](agents[_0x223554[_0x90fd('0x44')]])){utils[_0x90fd('0x18')](util[_0x90fd('0x14')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x223554[_0x90fd('0x43')],agents[_0x223554[_0x90fd('0x44')]][_0x90fd('0x6')]));agents[_0x223554[_0x90fd('0x44')]][_0x90fd('0x45')]=!![];agents[_0x223554[_0x90fd('0x44')]]['transfertype']=_0x90fd('0x46');agents[_0x223554['secondtransfereruniqueid']][_0x90fd('0x3e')]=_0x223554['origtransfererexten'];agents[_0x223554[_0x90fd('0x44')]][_0x90fd('0x40')]=_0x223554[_0x90fd('0x43')];}if(_0x223554[_0x90fd('0x47')]&&agents[_0x223554['transfereeuniqueid']]){agents[_0x223554[_0x90fd('0x47')]][_0x90fd('0x48')]=0x1;transfers[_0x223554[_0x90fd('0x47')]]=_[_0x90fd('0x49')](agents[_0x223554[_0x90fd('0x47')]]);transfers[_0x223554[_0x90fd('0x47')]]['calleridnum']=agents[_0x223554['secondtransfereruniqueid']]['calleridnum'];transfers[_0x223554['transfereeuniqueid']]['calleridname']=agents[_0x223554[_0x90fd('0x44')]][_0x90fd('0x4a')];transfers[_0x223554[_0x90fd('0x47')]][_0x90fd('0x15')]=utils[_0x90fd('0x16')]();transfers[_0x223554['transfereeuniqueid']]['agentconnectAt']=utils['now']();transfers[_0x223554[_0x90fd('0x47')]][_0x90fd('0x22')]=0x0;transfers[_0x223554['transfereeuniqueid']][_0x90fd('0x48')]=0x2;}}else if(_0x223554[_0x90fd('0x44')]==_0x223554[_0x90fd('0x4b')]){if(!_[_0x90fd('0x1d')](agents[_0x223554[_0x90fd('0x43')]])){utils[_0x90fd('0x18')](util[_0x90fd('0x14')](_0x90fd('0x4c'),_0x223554[_0x90fd('0x43')],agents[_0x223554['origtransfereruniqueid']][_0x90fd('0x6')]));agents[_0x223554[_0x90fd('0x43')]][_0x90fd('0x45')]=!![];agents[_0x223554['origtransfereruniqueid']]['transfertype']=_0x90fd('0x46');agents[_0x223554[_0x90fd('0x43')]]['transferexten']=_0x223554[_0x90fd('0x4d')];agents[_0x223554['origtransfereruniqueid']]['transferuniqueid']=_0x223554[_0x90fd('0x44')];}if(_0x223554[_0x90fd('0x4e')]&&agents[_0x223554[_0x90fd('0x4e')]]){agents[_0x223554[_0x90fd('0x4e')]][_0x90fd('0x48')]=0x1;transfers[_0x223554[_0x90fd('0x4e')]]=_[_0x90fd('0x49')](agents[_0x223554[_0x90fd('0x4e')]]);transfers[_0x223554['transfertargetuniqueid']][_0x90fd('0x4f')]=agents[_0x223554[_0x90fd('0x43')]][_0x90fd('0x4f')];transfers[_0x223554['transfertargetuniqueid']][_0x90fd('0x4a')]=agents[_0x223554[_0x90fd('0x43')]]['calleridname'];transfers[_0x223554['transfertargetuniqueid']][_0x90fd('0x15')]=utils[_0x90fd('0x16')]();transfers[_0x223554[_0x90fd('0x4e')]]['agentconnectAt']=utils[_0x90fd('0x16')]();transfers[_0x223554['transfertargetuniqueid']]['holdtime']=0x0;transfers[_0x223554[_0x90fd('0x4e')]]['agententerreason']=0x2;}}}catch(_0x27a080){utils[_0x90fd('0x1a')](util['format'](_0x90fd('0x42'),_0x223554[_0x90fd('0x43')]),_0x27a080);}};exports[_0x90fd('0x50')]=function(_0x454201){try{utils[_0x90fd('0x1e')](util[_0x90fd('0x14')]('[%s][agents][hangup]',_0x454201['uniqueid']),_0x454201);if(agents[_0x454201['uniqueid']]&&agents[_0x454201['uniqueid']][_0x90fd('0x29')]===_0x90fd('0x21')){if(_0x454201[_0x90fd('0x51')]==='21'){agents[_0x454201['uniqueid']][_0x90fd('0x29')]=_0x90fd('0x52');agents[_0x454201['uniqueid']][_0x90fd('0x8')]=_0x90fd('0x52');}utils[_0x90fd('0x18')](util[_0x90fd('0x14')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x454201[_0x90fd('0x3')],agents[_0x454201[_0x90fd('0x3')]]['membername'],agents[_0x454201['uniqueid']]['reason'],agents[_0x454201[_0x90fd('0x3')]]['lastevent']));writeDB(agents[_0x454201['uniqueid']]);var _0x328bda=unanswered['indexOf'](_0x454201[_0x90fd('0x3')]);if(_0x328bda>-0x1){unanswered[_0x90fd('0x53')](_0x328bda,0x1);}}if(transfers[_0x454201[_0x90fd('0x3')]]){transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0xc')]=!![];transfers[_0x454201[_0x90fd('0x3')]]['agentcompleteAt']=utils[_0x90fd('0x16')]();transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0x31')]=utils['diffTime'](transfers[_0x454201['uniqueid']][_0x90fd('0x36')],transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0x2e')]);transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0x29')]=_0x90fd('0x54');transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0x8')]=_0x90fd('0x37');utils[_0x90fd('0x18')](util[_0x90fd('0x14')](_0x90fd('0x55'),_0x454201[_0x90fd('0x3')],transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0x6')],transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0x29')],transfers[_0x454201['uniqueid']][_0x90fd('0x8')]));writeDB(transfers[_0x454201[_0x90fd('0x3')]],!![]);}if(agents[_0x454201[_0x90fd('0x3')]]&&agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x2e')]){agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0xc')]=!![];agents[_0x454201['uniqueid']][_0x90fd('0x36')]=utils[_0x90fd('0x16')]();agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x31')]=utils['diffTime'](agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x36')],agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x2e')]);agents[_0x454201[_0x90fd('0x3')]]['reason']=agents[_0x454201['uniqueid']][_0x90fd('0x45')]?_0x90fd('0x45'):_0x90fd('0x54');agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x8')]=_0x90fd('0x37');utils['info'](util[_0x90fd('0x14')](_0x90fd('0x55'),_0x454201[_0x90fd('0x3')],agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x6')],agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x29')],agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x8')]));writeDB(agents[_0x454201['uniqueid']]);}}catch(_0x1adcc2){utils[_0x90fd('0x1a')](util[_0x90fd('0x14')](_0x90fd('0x56'),_0x454201[_0x90fd('0x3')]),_0x1adcc2);}}; \ No newline at end of file +var _0x1be1=['destuniqueid','agentcalled','debug','called','error','[%s][agents][agentcalled]','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','lastevent','timeout','ringtime','talktime','push','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswer','abandoned','reason','holdtime','[%s][agents][agentconnect]','agentconnectAt','connectedlinename','connect','answered_elsewhere','answeredelsewheremembername','agentcomplete','diffTime','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','agentcalledAt','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agentcompleteAt','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','connectedlinenum','getVoiceQueueByName','then','type','agentacw','acw','acwtime','acwTimeout','CreateVoiceAgentReport','request'];(function(_0x3fe1c5,_0x4ccabd){var _0x4c2692=function(_0x4114a4){while(--_0x4114a4){_0x3fe1c5['push'](_0x3fe1c5['shift']());}};_0x4c2692(++_0x4ccabd);}(_0x1be1,0x192));var _0x11be=function(_0xe94964,_0x1339cf){_0xe94964=_0xe94964-0x0;var _0x55dd2b=_0x1be1[_0xe94964];return _0x55dd2b;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x11be('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x33a55d,_0x5527b3){utils[_0x11be('0x1')](util[_0x11be('0x2')](_0x11be('0x3'),_0x33a55d[_0x11be('0x4')],_0x33a55d['channel'],_0x33a55d[_0x11be('0x5')],_0x33a55d[_0x11be('0x6')],_0x33a55d[_0x11be('0x7')],_0x33a55d['calleridnum'],_0x33a55d[_0x11be('0x8')],_0x33a55d['lastevent']));if(_0x33a55d[_0x11be('0x5')]){utils[_0x11be('0x9')](_0x33a55d[_0x11be('0x5')])[_0x11be('0xa')](function(_0x162eaa){if(_0x162eaa){_0x33a55d['type']=_0x162eaa[_0x11be('0xb')];_0x33a55d[_0x11be('0xc')]=_0x33a55d['agentcomplete']?_0x162eaa[_0x11be('0xd')]:![];_0x33a55d[_0x11be('0xe')]=_0x33a55d[_0x11be('0xc')]?_0x162eaa[_0x11be('0xf')]:0x0;}utils['request'](_0x11be('0x10'),_0x33a55d);});}else{utils[_0x11be('0x11')](_0x11be('0x10'),_0x33a55d);}if(_0x5527b3){delete transfers[_0x33a55d['uniqueid']];}else{delete agents[_0x33a55d[_0x11be('0x12')]];}}exports[_0x11be('0x13')]=function(_0x4ce3ae){try{utils[_0x11be('0x14')](util['format']('[%s][agents][agentcalled]',_0x4ce3ae['uniqueid']),_0x4ce3ae);agents[_0x4ce3ae['destuniqueid']]=_0x4ce3ae;agents[_0x4ce3ae['destuniqueid']]['agentcalledAt']=utils['now']();agents[_0x4ce3ae[_0x11be('0x12')]]['lastevent']=_0x11be('0x15');agents[_0x4ce3ae[_0x11be('0x12')]][_0x11be('0x8')]=null;agents[_0x4ce3ae[_0x11be('0x12')]]['connectedlinename']=null;utils[_0x11be('0x1')](util[_0x11be('0x2')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x4ce3ae[_0x11be('0x4')],agents[_0x4ce3ae[_0x11be('0x12')]][_0x11be('0x6')],_0x4ce3ae['destuniqueid']));}catch(_0x51ba82){utils[_0x11be('0x16')](util[_0x11be('0x2')](_0x11be('0x17'),_0x4ce3ae[_0x11be('0x4')]),_0x51ba82);}};exports['agentringnoanswer']=function(_0x12a5bd){try{if(!_[_0x11be('0x18')](agents[_0x12a5bd[_0x11be('0x12')]])){utils[_0x11be('0x14')](util[_0x11be('0x2')](_0x11be('0x19'),_0x12a5bd[_0x11be('0x4')]),_0x12a5bd);utils[_0x11be('0x1')](util[_0x11be('0x2')](_0x11be('0x1a'),_0x12a5bd['uniqueid'],agents[_0x12a5bd[_0x11be('0x12')]][_0x11be('0x6')],_0x12a5bd[_0x11be('0x12')]));agents[_0x12a5bd['destuniqueid']]['agentringnoanswer']=!![];agents[_0x12a5bd[_0x11be('0x12')]][_0x11be('0x1b')]=utils[_0x11be('0x1c')]();agents[_0x12a5bd['destuniqueid']][_0x11be('0x1d')]='timeout';agents[_0x12a5bd[_0x11be('0x12')]]['reason']=_0x11be('0x1e');agents[_0x12a5bd[_0x11be('0x12')]]['holdtime']=_0x12a5bd[_0x11be('0x1f')]?parseInt(_0x12a5bd[_0x11be('0x1f')])/0x3e8:0x0;agents[_0x12a5bd[_0x11be('0x12')]][_0x11be('0x20')]=0x0;unanswered[_0x11be('0x21')](_0x12a5bd[_0x11be('0x12')]);}}catch(_0xf5a6ac){utils[_0x11be('0x16')](util[_0x11be('0x2')]('[%s][agents][agentringnoanswer]',_0x12a5bd[_0x11be('0x4')]),_0xf5a6ac);}};exports['queuecallerabandon']=function(_0x182f6b){try{_[_0x11be('0x22')](agents,function(_0x510476,_0x584d4c){if(_0x510476[_0x11be('0x4')]==_0x182f6b[_0x11be('0x4')]&&!_[_0x11be('0x23')](unanswered,_0x510476[_0x11be('0x12')])){utils[_0x11be('0x14')](util[_0x11be('0x2')](_0x11be('0x24'),_0x182f6b[_0x11be('0x4')]),_0x182f6b);utils[_0x11be('0x1')](util['format'](_0x11be('0x25'),_0x182f6b[_0x11be('0x4')],_0x510476[_0x11be('0x6')],_0x510476[_0x11be('0x12')]));_0x510476[_0x11be('0x26')]=!![];_0x510476[_0x11be('0x1b')]=utils['now']();_0x510476[_0x11be('0x1d')]=_0x11be('0x27');_0x510476[_0x11be('0x28')]=_0x11be('0x27');_0x510476[_0x11be('0x29')]=_0x182f6b['holdtime'];_0x510476[_0x11be('0x20')]=0x0;writeDB(_0x510476);}});}catch(_0x254be5){utils[_0x11be('0x16')](util['format'](_0x11be('0x24'),_0x182f6b['uniqueid']),_0x254be5);}};exports['agentconnect']=function(_0x4c1f4d){try{if(agents[_0x4c1f4d['destuniqueid']]){utils[_0x11be('0x14')](util[_0x11be('0x2')](_0x11be('0x2a'),_0x4c1f4d['uniqueid']),_0x4c1f4d);utils[_0x11be('0x1')](util[_0x11be('0x2')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x4c1f4d[_0x11be('0x4')],agents[_0x4c1f4d['destuniqueid']][_0x11be('0x6')],_0x4c1f4d['destuniqueid']));agents[_0x4c1f4d[_0x11be('0x12')]][_0x11be('0x2b')]=utils[_0x11be('0x1c')]();agents[_0x4c1f4d[_0x11be('0x12')]]['connectedlinenum']=_0x4c1f4d[_0x11be('0x8')];agents[_0x4c1f4d[_0x11be('0x12')]][_0x11be('0x2c')]=_0x4c1f4d[_0x11be('0x2c')];agents[_0x4c1f4d['destuniqueid']][_0x11be('0x29')]=_0x4c1f4d[_0x11be('0x1f')];agents[_0x4c1f4d[_0x11be('0x12')]][_0x11be('0x1d')]=_0x11be('0x2d');_[_0x11be('0x22')](agents,function(_0x5742d1,_0x5ee47c){if(_0x5742d1[_0x11be('0x12')]!=_0x4c1f4d[_0x11be('0x12')]&&_0x5742d1['uniqueid']==_0x4c1f4d[_0x11be('0x4')]){_0x5742d1[_0x11be('0x20')]=0x0;_0x5742d1['holdtime']=_0x4c1f4d[_0x11be('0x1f')];_0x5742d1['agentringnoanswer']=!![];_0x5742d1[_0x11be('0x1b')]=utils['now']();_0x5742d1[_0x11be('0x1d')]=_0x11be('0x2e');_0x5742d1['reason']=_0x11be('0x2e');_0x5742d1['answeredelsewheredestinationuniqueid']=_0x4c1f4d[_0x11be('0x12')];_0x5742d1[_0x11be('0x2f')]=_0x4c1f4d[_0x11be('0x6')];writeDB(_0x5742d1);}});}}catch(_0x383604){utils[_0x11be('0x16')](util[_0x11be('0x2')](_0x11be('0x2a'),_0x4c1f4d['uniqueid']),_0x383604);}};exports[_0x11be('0x30')]=function(_0x18cddf){try{if(!_[_0x11be('0x18')](agents[_0x18cddf[_0x11be('0x12')]])){utils['debug'](util['format']('[%s][agents][agentcomplete]',_0x18cddf[_0x11be('0x4')]),_0x18cddf);utils['info'](util[_0x11be('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x18cddf[_0x11be('0x4')],agents[_0x18cddf[_0x11be('0x12')]][_0x11be('0x6')],_0x18cddf[_0x11be('0x12')]));agents[_0x18cddf[_0x11be('0x12')]][_0x11be('0x30')]=!![];agents[_0x18cddf[_0x11be('0x12')]]['agentcompleteAt']=utils[_0x11be('0x1c')]();agents[_0x18cddf['destuniqueid']][_0x11be('0x20')]=utils[_0x11be('0x31')](agents[_0x18cddf[_0x11be('0x12')]]['agentcompleteAt'],agents[_0x18cddf['destuniqueid']]['agentconnectAt']);agents[_0x18cddf[_0x11be('0x12')]][_0x11be('0x28')]=_0x18cddf['reason'];agents[_0x18cddf['destuniqueid']]['lastevent']=_0x11be('0x32');writeDB(agents[_0x18cddf[_0x11be('0x12')]]);}}catch(_0x2cdf2a){utils[_0x11be('0x16')](util[_0x11be('0x2')](_0x11be('0x33'),_0x18cddf[_0x11be('0x4')]),_0x2cdf2a);}};exports[_0x11be('0x34')]=function(_0x2ce110){try{if(!_[_0x11be('0x18')](agents[_0x2ce110[_0x11be('0x35')]])){utils['debug'](util[_0x11be('0x2')](_0x11be('0x36'),_0x2ce110['uniqueid']),_0x2ce110);utils['info'](util['format'](_0x11be('0x37'),_0x2ce110['uniqueid'],agents[_0x2ce110[_0x11be('0x35')]][_0x11be('0x6')],agents[_0x2ce110[_0x11be('0x35')]][_0x11be('0x4')]));agents[_0x2ce110[_0x11be('0x35')]][_0x11be('0x38')]=!![];agents[_0x2ce110[_0x11be('0x35')]][_0x11be('0x39')]=_0x11be('0x3a');agents[_0x2ce110['transfereruniqueid']][_0x11be('0x3b')]=_0x2ce110['extension'];agents[_0x2ce110[_0x11be('0x35')]][_0x11be('0x3c')]=agents[_0x2ce110['transfereruniqueid']][_0x11be('0x4')];}}catch(_0x1164a4){utils[_0x11be('0x16')](util[_0x11be('0x2')](_0x11be('0x36'),_0x2ce110['uniqueid']),_0x1164a4);}};exports['attendedtransfer']=function(_0x46764d){try{utils[_0x11be('0x14')](util['format']('[%s][agents][attendedtransfer]',_0x46764d[_0x11be('0x3d')]),_0x46764d);if(_0x46764d[_0x11be('0x3d')]==_0x46764d[_0x11be('0x3e')]){if(!_['isNil'](agents[_0x46764d['secondtransfereruniqueid']])){utils['info'](util[_0x11be('0x2')](_0x11be('0x3f'),_0x46764d[_0x11be('0x3d')],agents[_0x46764d['secondtransfereruniqueid']]['membername']));agents[_0x46764d[_0x11be('0x40')]][_0x11be('0x38')]=!![];agents[_0x46764d[_0x11be('0x40')]][_0x11be('0x39')]='ATTENDED';agents[_0x46764d[_0x11be('0x40')]]['transferexten']=_0x46764d['origtransfererexten'];agents[_0x46764d['secondtransfereruniqueid']]['transferuniqueid']=_0x46764d[_0x11be('0x3d')];}if(_0x46764d[_0x11be('0x41')]&&agents[_0x46764d[_0x11be('0x41')]]){agents[_0x46764d[_0x11be('0x41')]][_0x11be('0x42')]=0x1;transfers[_0x46764d[_0x11be('0x41')]]=_[_0x11be('0x43')](agents[_0x46764d['transfereeuniqueid']]);transfers[_0x46764d['transfereeuniqueid']][_0x11be('0x44')]=agents[_0x46764d[_0x11be('0x40')]][_0x11be('0x44')];transfers[_0x46764d[_0x11be('0x41')]][_0x11be('0x45')]=agents[_0x46764d[_0x11be('0x40')]][_0x11be('0x45')];transfers[_0x46764d[_0x11be('0x41')]][_0x11be('0x46')]=utils['now']();transfers[_0x46764d[_0x11be('0x41')]][_0x11be('0x2b')]=utils[_0x11be('0x1c')]();transfers[_0x46764d['transfereeuniqueid']][_0x11be('0x29')]=0x0;transfers[_0x46764d[_0x11be('0x41')]]['agententerreason']=0x2;}}else if(_0x46764d['secondtransfereruniqueid']==_0x46764d[_0x11be('0x47')]){if(!_[_0x11be('0x18')](agents[_0x46764d[_0x11be('0x3d')]])){utils[_0x11be('0x1')](util['format'](_0x11be('0x3f'),_0x46764d[_0x11be('0x3d')],agents[_0x46764d[_0x11be('0x3d')]][_0x11be('0x6')]));agents[_0x46764d[_0x11be('0x3d')]][_0x11be('0x38')]=!![];agents[_0x46764d[_0x11be('0x3d')]][_0x11be('0x39')]=_0x11be('0x48');agents[_0x46764d['origtransfereruniqueid']]['transferexten']=_0x46764d[_0x11be('0x49')];agents[_0x46764d[_0x11be('0x3d')]]['transferuniqueid']=_0x46764d[_0x11be('0x40')];}if(_0x46764d[_0x11be('0x4a')]&&agents[_0x46764d[_0x11be('0x4a')]]){agents[_0x46764d[_0x11be('0x4a')]][_0x11be('0x42')]=0x1;transfers[_0x46764d[_0x11be('0x4a')]]=_[_0x11be('0x43')](agents[_0x46764d['transfertargetuniqueid']]);transfers[_0x46764d['transfertargetuniqueid']][_0x11be('0x44')]=agents[_0x46764d[_0x11be('0x3d')]][_0x11be('0x44')];transfers[_0x46764d['transfertargetuniqueid']][_0x11be('0x45')]=agents[_0x46764d[_0x11be('0x3d')]][_0x11be('0x45')];transfers[_0x46764d[_0x11be('0x4a')]][_0x11be('0x46')]=utils[_0x11be('0x1c')]();transfers[_0x46764d[_0x11be('0x4a')]][_0x11be('0x2b')]=utils[_0x11be('0x1c')]();transfers[_0x46764d[_0x11be('0x4a')]][_0x11be('0x29')]=0x0;transfers[_0x46764d[_0x11be('0x4a')]][_0x11be('0x42')]=0x2;}}}catch(_0x464459){utils[_0x11be('0x16')](util[_0x11be('0x2')]('[%s][agents][attendedtransfer]',_0x46764d['origtransfereruniqueid']),_0x464459);}};exports[_0x11be('0x4b')]=function(_0x554aba){try{utils[_0x11be('0x14')](util[_0x11be('0x2')](_0x11be('0x4c'),_0x554aba[_0x11be('0x4')]),_0x554aba);if(agents[_0x554aba[_0x11be('0x4')]]&&agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x28')]===_0x11be('0x1e')){if(_0x554aba[_0x11be('0x4d')]==='21'){agents[_0x554aba['uniqueid']][_0x11be('0x28')]=_0x11be('0x4e');agents[_0x554aba[_0x11be('0x4')]]['lastevent']=_0x11be('0x4e');}utils[_0x11be('0x1')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x554aba['uniqueid'],agents[_0x554aba['uniqueid']][_0x11be('0x6')],agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x28')],agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x1d')]));writeDB(agents[_0x554aba['uniqueid']]);var _0x2c80b7=unanswered[_0x11be('0x4f')](_0x554aba[_0x11be('0x4')]);if(_0x2c80b7>-0x1){unanswered[_0x11be('0x50')](_0x2c80b7,0x1);}}if(transfers[_0x554aba[_0x11be('0x4')]]){transfers[_0x554aba['uniqueid']][_0x11be('0x30')]=!![];transfers[_0x554aba[_0x11be('0x4')]][_0x11be('0x51')]=utils[_0x11be('0x1c')]();transfers[_0x554aba['uniqueid']][_0x11be('0x20')]=utils[_0x11be('0x31')](transfers[_0x554aba[_0x11be('0x4')]][_0x11be('0x51')],transfers[_0x554aba[_0x11be('0x4')]][_0x11be('0x2b')]);transfers[_0x554aba['uniqueid']][_0x11be('0x28')]=_0x11be('0x52');transfers[_0x554aba[_0x11be('0x4')]][_0x11be('0x1d')]='complete';utils[_0x11be('0x1')](util['format'](_0x11be('0x53'),_0x554aba[_0x11be('0x4')],transfers[_0x554aba[_0x11be('0x4')]][_0x11be('0x6')],transfers[_0x554aba['uniqueid']][_0x11be('0x28')],transfers[_0x554aba[_0x11be('0x4')]]['lastevent']));writeDB(transfers[_0x554aba[_0x11be('0x4')]],!![]);}if(agents[_0x554aba[_0x11be('0x4')]]&&agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x2b')]){agents[_0x554aba['uniqueid']][_0x11be('0x30')]=!![];agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x51')]=utils[_0x11be('0x1c')]();agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x20')]=utils[_0x11be('0x31')](agents[_0x554aba[_0x11be('0x4')]]['agentcompleteAt'],agents[_0x554aba[_0x11be('0x4')]]['agentconnectAt']);agents[_0x554aba['uniqueid']][_0x11be('0x28')]=agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x38')]?_0x11be('0x38'):_0x11be('0x52');agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x1d')]='complete';utils['info'](util[_0x11be('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x554aba['uniqueid'],agents[_0x554aba[_0x11be('0x4')]]['membername'],agents[_0x554aba[_0x11be('0x4')]][_0x11be('0x28')],agents[_0x554aba['uniqueid']][_0x11be('0x1d')]));writeDB(agents[_0x554aba[_0x11be('0x4')]]);}}catch(_0x56d8d7){utils[_0x11be('0x16')](util[_0x11be('0x2')]('[%s][agents][hangup]',_0x554aba[_0x11be('0x4')]),_0x56d8d7);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 661b8bc..e2c7263 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 _0x853e=['endtime','[%s][calls][hangup]','localtwolinkedid','[%s][calls][attendedtransfer]','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','lastIndexOf','includes','noop','execif','util','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','CreateVoiceCallReport','recording','newchannel','debug','format','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','now','DOCUMENTATION','error','[%s][calls][newstate]','channelstate','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','hangup','callerid','calleridname','info','duration','diffTime','starttime','billableseconds'];(function(_0x1d795a,_0x14eec0){var _0x576324=function(_0x4da499){while(--_0x4da499){_0x1d795a['push'](_0x1d795a['shift']());}};_0x576324(++_0x14eec0);}(_0x853e,0x1ea));var _0xe853=function(_0x2f4b87,_0x1e81f3){_0x2f4b87=_0x2f4b87-0x0;var _0x31848a=_0x853e[_0x2f4b87];return _0x31848a;};'use strict';var _=require('lodash');var util=require(_0xe853('0x0'));var utils=require('./utils');var transfers=require(_0xe853('0x1'));var dispositions=['NO\x20ANSWER',_0xe853('0x2'),'FAILED',_0xe853('0x3'),_0xe853('0x3'),_0xe853('0x3'),_0xe853('0x4'),_0xe853('0x5'),'FAILED',_0xe853('0x2'),_0xe853('0x2')];var channels={};function writeDB(_0xab8d0d){var _0x25e6e1;if(transfers[_0xe853('0x6')][_0xab8d0d[_0xe853('0x7')]]){_0x25e6e1=_0xab8d0d[_0xe853('0x7')];_0xab8d0d[_0xe853('0x7')]=transfers[_0xe853('0x6')][_0xab8d0d[_0xe853('0x7')]]['transfereeuniqueid'];}utils['info'](util['format'](_0xe853('0x8'),_0xab8d0d['uniqueid'],_0xab8d0d['channel'],_0xab8d0d[_0xe853('0x9')],_0xab8d0d[_0xe853('0xa')],_0xab8d0d[_0xe853('0xb')],_0xab8d0d['calleridnum'],_0xab8d0d[_0xe853('0xc')],_0xab8d0d[_0xe853('0xd')]));if(_0xab8d0d[_0xe853('0xe')]){utils[_0xe853('0xf')](_0xab8d0d[_0xe853('0xe')])[_0xe853('0x10')](function(_0x1ebf13){if(_0x1ebf13){_0xab8d0d['UserId']=_0x1ebf13['id'];}utils['request']('CreateVoiceCallReport',_0xab8d0d);});}else{utils['request'](_0xe853('0x11'),_0xab8d0d);}if(channels[_0xab8d0d[_0xe853('0x7')]]){delete channels[_0xab8d0d[_0xe853('0x7')]];}else if(_0x25e6e1&&channels[_0x25e6e1]){if(!transfers[_0xe853('0x6')][_0x25e6e1][_0xe853('0x12')])delete transfers[_0xe853('0x6')][_0x25e6e1];delete channels[_0x25e6e1];}}exports[_0xe853('0x13')]=function(_0x111f2e){try{utils[_0xe853('0x14')](util[_0xe853('0x15')](_0xe853('0x16'),_0x111f2e[_0xe853('0x7')]),_0x111f2e);if(_0x111f2e[_0xe853('0x7')]==_0x111f2e[_0xe853('0x17')]&&_0x111f2e[_0xe853('0x18')]!=_0xe853('0x19')){utils['info'](util[_0xe853('0x15')](_0xe853('0x1a'),_0x111f2e[_0xe853('0x7')],_0x111f2e[_0xe853('0x1b')],_0x111f2e[_0xe853('0x1c')]));channels[_0x111f2e[_0xe853('0x7')]]={'uniqueid':_0x111f2e[_0xe853('0x7')],'accountcode':_0x111f2e[_0xe853('0xe')],'source':_0x111f2e[_0xe853('0x1d')],'destination':_0x111f2e[_0xe853('0x1c')],'destinationcontext':_0x111f2e[_0xe853('0x1b')],'channel':_0x111f2e['channel'],'starttime':utils[_0xe853('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xe853('0x3'),'amaflags':_0xe853('0x1f')};}}catch(_0x209049){utils[_0xe853('0x20')](util[_0xe853('0x15')](_0xe853('0x16'),_0x111f2e[_0xe853('0x7')]),_0x209049);}};exports['newstate']=function(_0x3c98f6){try{utils[_0xe853('0x14')](util[_0xe853('0x15')](_0xe853('0x21'),_0x3c98f6[_0xe853('0x7')]),_0x3c98f6);if(!_['isNil'](channels[_0x3c98f6[_0xe853('0x7')]])&&_0x3c98f6[_0xe853('0x22')]==0x6){utils['info'](util[_0xe853('0x15')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x3c98f6[_0xe853('0x7')],_0x3c98f6['context'],_0x3c98f6['channel']));if(_[_0xe853('0x23')](channels[_0x3c98f6[_0xe853('0x7')]][_0xe853('0x24')])){channels[_0x3c98f6[_0xe853('0x7')]][_0xe853('0x24')]=utils[_0xe853('0x1e')]();}}else if(!_[_0xe853('0x23')](channels[_0x3c98f6[_0xe853('0x17')]])&&_0x3c98f6[_0xe853('0x22')]==0x6&&_0x3c98f6[_0xe853('0x1b')]!=_0xe853('0x25')){utils['info'](util[_0xe853('0x15')](_0xe853('0x26'),_0x3c98f6['uniqueid'],_0x3c98f6[_0xe853('0x17')],_0x3c98f6['context'],_0x3c98f6[_0xe853('0x18')]));channels[_0x3c98f6[_0xe853('0x17')]][_0xe853('0xe')]=_0x3c98f6['accountcode'];channels[_0x3c98f6[_0xe853('0x17')]][_0xe853('0x27')]=_0x3c98f6[_0xe853('0x18')];if(_[_0xe853('0x23')](channels[_0x3c98f6[_0xe853('0x17')]][_0xe853('0x28')])){channels[_0x3c98f6[_0xe853('0x17')]][_0xe853('0x28')]=utils[_0xe853('0x1e')]();}channels[_0x3c98f6[_0xe853('0x17')]][_0xe853('0x29')]=dispositions[_['toNumber'](_0x3c98f6[_0xe853('0x22')])]||'ANSWERED';}}catch(_0x342528){utils[_0xe853('0x20')](util[_0xe853('0x15')](_0xe853('0x21'),_0x3c98f6['uniqueid']),_0x342528);}};exports[_0xe853('0x2a')]=function(_0x44396e){try{if(!_[_0xe853('0x23')](channels[_0x44396e[_0xe853('0x7')]])){utils[_0xe853('0x14')](util[_0xe853('0x15')]('[%s][calls][hangup]',_0x44396e[_0xe853('0x7')]),_0x44396e);if(_[_0xe853('0x23')](channels[_0x44396e[_0xe853('0x7')]][_0xe853('0x2b')])){channels[_0x44396e[_0xe853('0x7')]][_0xe853('0x2b')]=_0x44396e[_0xe853('0x2c')]+'\x20<'+_0x44396e[_0xe853('0x1d')]+'>';}utils[_0xe853('0x2d')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x44396e[_0xe853('0x7')],channels[_0x44396e[_0xe853('0x7')]][_0xe853('0x2b')],_0x44396e['cause-txt']));channels[_0x44396e[_0xe853('0x7')]]['endtime']=utils['now']();channels[_0x44396e['uniqueid']][_0xe853('0x2e')]=utils[_0xe853('0x2f')](channels[_0x44396e[_0xe853('0x7')]]['endtime'],channels[_0x44396e[_0xe853('0x7')]][_0xe853('0x30')]);channels[_0x44396e[_0xe853('0x7')]][_0xe853('0x31')]=channels[_0x44396e[_0xe853('0x7')]][_0xe853('0x28')]?utils['diffTime'](channels[_0x44396e['uniqueid']][_0xe853('0x32')],channels[_0x44396e['uniqueid']][_0xe853('0x28')]):0x0;writeDB(channels[_0x44396e[_0xe853('0x7')]]);}}catch(_0x13f117){utils[_0xe853('0x20')](util[_0xe853('0x15')](_0xe853('0x33'),_0x44396e[_0xe853('0x7')]),_0x13f117);}};exports['attendedtransfer']=function(_0x31ceb6){try{if(!_[_0xe853('0x23')](channels[_0x31ceb6[_0xe853('0x34')]])){utils['debug'](util[_0xe853('0x15')](_0xe853('0x35'),_0x31ceb6['origtransfereruniqueid']),_0x31ceb6);if(channels[_0x31ceb6[_0xe853('0x34')]][_0xe853('0x18')]==_0x31ceb6['transfereechannel']){utils[_0xe853('0x2d')](util[_0xe853('0x15')](_0xe853('0x36'),_0x31ceb6[_0xe853('0x37')],_0x31ceb6['localtwolinkedid'],_0x31ceb6[_0xe853('0x38')]));channels[_0x31ceb6['localtwolinkedid']][_0xe853('0x27')]=_0x31ceb6[_0xe853('0x38')];channels[_0x31ceb6[_0xe853('0x34')]]['userfield']=_0xe853('0x39');}else if(channels[_0x31ceb6[_0xe853('0x34')]]['channel']=_0x31ceb6[_0xe853('0x3a')]){utils['info'](util[_0xe853('0x15')](_0xe853('0x36'),_0x31ceb6[_0xe853('0x37')],_0x31ceb6[_0xe853('0x34')],_0x31ceb6['origtransfererchannel']));channels[_0x31ceb6['localtwolinkedid']][_0xe853('0x27')]=_0x31ceb6[_0xe853('0x3b')];channels[_0x31ceb6['localtwolinkedid']][_0xe853('0x3c')]=_0xe853('0x39');}}}catch(_0x4cbaeb){utils['error'](util[_0xe853('0x15')](_0xe853('0x35'),_0x31ceb6[_0xe853('0x37')]),_0x4cbaeb);}};exports[_0xe853('0x3d')]=function(_0x9b0863){try{if(!_[_0xe853('0x23')](channels[_0x9b0863[_0xe853('0x7')]])){utils[_0xe853('0x14')](util[_0xe853('0x15')](_0xe853('0x3e'),_0x9b0863['uniqueid']),_0x9b0863);channels[_0x9b0863['uniqueid']][_0xe853('0x3f')]=utils[_0xe853('0x1e')]();utils['info'](util[_0xe853('0x15')](_0xe853('0x40'),_0x9b0863['uniqueid'],channels[_0x9b0863[_0xe853('0x7')]][_0xe853('0x3f')]));}}catch(_0x24d152){utils['error'](util[_0xe853('0x15')](_0xe853('0x3e'),_0x9b0863['uniqueid']),_0x24d152);}};exports[_0xe853('0x41')]=function(_0x18d215){try{if(!_[_0xe853('0x23')](channels[_0x18d215[_0xe853('0x7')]])){utils[_0xe853('0x14')](util[_0xe853('0x15')](_0xe853('0x42'),_0x18d215[_0xe853('0x7')]),_0x18d215);if(!_['isNil'](channels[_0x18d215[_0xe853('0x7')]][_0xe853('0x3f')])){channels[_0x18d215[_0xe853('0x7')]][_0xe853('0x43')]+=utils[_0xe853('0x2f')](utils[_0xe853('0x1e')](),channels[_0x18d215[_0xe853('0x7')]][_0xe853('0x3f')]);utils[_0xe853('0x2d')](util[_0xe853('0x15')](_0xe853('0x44'),_0x18d215[_0xe853('0x7')],channels[_0x18d215[_0xe853('0x7')]][_0xe853('0x43')]));delete channels[_0x18d215[_0xe853('0x7')]][_0xe853('0x3f')];}}}catch(_0x5667f1){utils[_0xe853('0x20')](util['format'](_0xe853('0x42'),_0x18d215[_0xe853('0x7')]),_0x5667f1);}};exports[_0xe853('0x45')]=function(_0x4fdc55){try{if(!_[_0xe853('0x23')](channels[_0x4fdc55[_0xe853('0x7')]])){utils['debug'](util['format'](_0xe853('0x46'),_0x4fdc55[_0xe853('0x7')]),_0x4fdc55);if(!_['isNil'](_0x4fdc55[_0xe853('0x47')][_0xe853('0x48')])){utils[_0xe853('0x2d')](util[_0xe853('0x15')](_0xe853('0x49'),_0x4fdc55[_0xe853('0x7')],_0x4fdc55[_0xe853('0x4a')]));channels[_0x4fdc55['uniqueid']][_0xe853('0x4b')]=_0x4fdc55[_0xe853('0x4a')];}if(!_[_0xe853('0x23')](_0x4fdc55[_0xe853('0x47')][_0xe853('0x4c')])){utils['info'](util['format'](_0xe853('0x4d'),_0x4fdc55[_0xe853('0x7')],_0x4fdc55[_0xe853('0x4a')]));channels[_0x4fdc55[_0xe853('0x7')]][_0xe853('0x4e')]=_0x4fdc55[_0xe853('0x4a')];channels[_0x4fdc55['uniqueid']][_0xe853('0x2b')]='\x22'+_0x4fdc55['value']+_0xe853('0x4f')+_0x4fdc55[_0xe853('0x4a')]+'>';}if(!_['isNil'](_0x4fdc55[_0xe853('0x47')][_0xe853('0x50')])||!_['isNil'](_0x4fdc55[_0xe853('0x47')][_0xe853('0x51')])){utils[_0xe853('0x2d')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4fdc55['uniqueid'],!_[_0xe853('0x23')](_0x4fdc55[_0xe853('0x47')][_0xe853('0x50')])?_0xe853('0x50'):_0xe853('0x51'),_0x4fdc55[_0xe853('0x4a')]));channels[_0x4fdc55[_0xe853('0x7')]][_0xe853('0x2b')]=_0x4fdc55[_0xe853('0x4a')];}if(!_[_0xe853('0x23')](_0x4fdc55['variable'][_0xe853('0x52')])||!_[_0xe853('0x23')](_0x4fdc55[_0xe853('0x47')]['xmcs-queue'])){utils[_0xe853('0x2d')](util[_0xe853('0x15')](_0xe853('0x53'),_0x4fdc55[_0xe853('0x7')],!_[_0xe853('0x23')](_0x4fdc55[_0xe853('0x47')][_0xe853('0x52')])?'xmd-queue':'xmcs-queue',_0x4fdc55[_0xe853('0x4a')]));channels[_0x4fdc55[_0xe853('0x7')]][_0xe853('0x54')]=_0xe853('0x55');channels[_0x4fdc55[_0xe853('0x7')]][_0xe853('0x56')]=_0x4fdc55[_0xe853('0x4a')];channels[_0x4fdc55[_0xe853('0x7')]]['queue']=!![];}if(!_[_0xe853('0x23')](_0x4fdc55[_0xe853('0x47')]['xmd-contactid'])){utils[_0xe853('0x2d')](util['format'](_0xe853('0x57'),_0x4fdc55['uniqueid'],_0x4fdc55['value']));channels[_0x4fdc55[_0xe853('0x7')]]['ContactId']=_0x4fdc55[_0xe853('0x4a')];}if(!_['isNil'](_0x4fdc55['variable'][_0xe853('0x58')])){utils[_0xe853('0x2d')](util[_0xe853('0x15')](_0xe853('0x59'),_0x4fdc55['uniqueid'],_0x4fdc55['value']));channels[_0x4fdc55[_0xe853('0x7')]]['type']=_0x4fdc55[_0xe853('0x4a')];}if(!_[_0xe853('0x23')](_0x4fdc55[_0xe853('0x47')][_0xe853('0x5a')])){utils[_0xe853('0x2d')](util[_0xe853('0x15')](_0xe853('0x5b'),_0x4fdc55['uniqueid'],_0x4fdc55[_0xe853('0x4a')]));channels[_0x4fdc55[_0xe853('0x7')]][_0xe853('0x5c')]=_0x4fdc55[_0xe853('0x4a')];}if(!_[_0xe853('0x23')](_0x4fdc55['variable'][_0xe853('0x5d')])){utils[_0xe853('0x2d')](util['format'](_0xe853('0x5e'),_0x4fdc55[_0xe853('0x7')],_0x4fdc55[_0xe853('0x4a')]));channels[_0x4fdc55[_0xe853('0x7')]][_0xe853('0x5d')]=_0x4fdc55[_0xe853('0x4a')];}}}catch(_0x503ab5){utils[_0xe853('0x20')](util[_0xe853('0x15')](_0xe853('0x46'),_0x4fdc55[_0xe853('0x7')]),_0x503ab5);}};exports['newexten']=function(_0x1f0fc5){try{if(!_[_0xe853('0x23')](channels[_0x1f0fc5['uniqueid']])){utils[_0xe853('0x14')](util['format'](_0xe853('0x5f'),_0x1f0fc5[_0xe853('0x7')]),_0x1f0fc5);utils[_0xe853('0x2d')](util['format'](_0xe853('0x60'),_0x1f0fc5[_0xe853('0x7')],_0x1f0fc5[_0xe853('0x61')],_0x1f0fc5['appdata']));if(_0x1f0fc5[_0xe853('0x61')][_0xe853('0x62')]()==_0xe853('0x63')&&_[_0xe853('0x64')](_0x1f0fc5[_0xe853('0x65')][_0xe853('0x62')](),_0xe853('0x66'))){var _0x5094ce=_0x1f0fc5[_0xe853('0x65')][_0xe853('0x67')]('=');var _0x543399=_0x5094ce[0x0]['substring'](_0x5094ce[0x0][_0xe853('0x68')]('(')+0x1,_0x5094ce[0x0][_0xe853('0x68')](')'));var _0x472fca=_0x5094ce[0x1];channels[_0x1f0fc5[_0xe853('0x7')]][_0x543399]=_0x472fca;}if(!_[_0xe853('0x69')](['hangup',_0xe853('0x6a'),_0xe853('0x6b'),_0xe853('0x63'),'gotoif'],_0x1f0fc5['application']['toLowerCase']())){channels[_0x1f0fc5[_0xe853('0x7')]]['lastapplication']=_0x1f0fc5[_0xe853('0x61')];channels[_0x1f0fc5[_0xe853('0x7')]]['lastdata']=_0x1f0fc5[_0xe853('0x65')];}}}catch(_0x4d0fc7){utils[_0xe853('0x20')](util[_0xe853('0x15')](_0xe853('0x5f'),_0x1f0fc5['uniqueid']),_0x4d0fc7);}}; \ No newline at end of file +var _0xe797=['then','UserId','CreateVoiceCallReport','request','recording','newchannel','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','context','exten','calleridnum','now','DOCUMENTATION','isNil','channelstate','systemanswertime','linkedid','destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','billableseconds','error','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','lastIndexOf','includes','noop','execif','gotoif','lastapplication','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','connectedlinenum','accountcode'];(function(_0xe5877a,_0x43e9dc){var _0x1b7357=function(_0x4c9243){while(--_0x4c9243){_0xe5877a['push'](_0xe5877a['shift']());}};_0x1b7357(++_0x43e9dc);}(_0xe797,0x12a));var _0x7e79=function(_0x1f5f5a,_0x56188a){_0x1f5f5a=_0x1f5f5a-0x0;var _0x9d23d2=_0xe797[_0x1f5f5a];return _0x9d23d2;};'use strict';var _=require(_0x7e79('0x0'));var util=require(_0x7e79('0x1'));var utils=require(_0x7e79('0x2'));var transfers=require(_0x7e79('0x3'));var dispositions=[_0x7e79('0x4'),_0x7e79('0x5'),'FAILED',_0x7e79('0x4'),_0x7e79('0x4'),'NO\x20ANSWER',_0x7e79('0x6'),_0x7e79('0x7'),_0x7e79('0x5'),'FAILED','FAILED'];var channels={};function writeDB(_0x9dd35a){var _0x358bd6;if(transfers['blinds'][_0x9dd35a['uniqueid']]){_0x358bd6=_0x9dd35a[_0x7e79('0x8')];_0x9dd35a[_0x7e79('0x8')]=transfers[_0x7e79('0x9')][_0x9dd35a['uniqueid']][_0x7e79('0xa')];}utils[_0x7e79('0xb')](util[_0x7e79('0xc')](_0x7e79('0xd'),_0x9dd35a[_0x7e79('0x8')],_0x9dd35a[_0x7e79('0xe')],_0x9dd35a[_0x7e79('0xf')],_0x9dd35a[_0x7e79('0x10')],_0x9dd35a[_0x7e79('0x11')],_0x9dd35a['calleridnum'],_0x9dd35a[_0x7e79('0x12')],_0x9dd35a['lastevent']));if(_0x9dd35a[_0x7e79('0x13')]){utils['getUserByInternal'](_0x9dd35a[_0x7e79('0x13')])[_0x7e79('0x14')](function(_0xcc6f65){if(_0xcc6f65){_0x9dd35a[_0x7e79('0x15')]=_0xcc6f65['id'];}utils['request'](_0x7e79('0x16'),_0x9dd35a);});}else{utils[_0x7e79('0x17')](_0x7e79('0x16'),_0x9dd35a);}if(channels[_0x9dd35a[_0x7e79('0x8')]]){delete channels[_0x9dd35a[_0x7e79('0x8')]];}else if(_0x358bd6&&channels[_0x358bd6]){if(!transfers[_0x7e79('0x9')][_0x358bd6][_0x7e79('0x18')])delete transfers['blinds'][_0x358bd6];delete channels[_0x358bd6];}}exports[_0x7e79('0x19')]=function(_0x3bf2d3){try{utils[_0x7e79('0x1a')](util[_0x7e79('0xc')](_0x7e79('0x1b'),_0x3bf2d3[_0x7e79('0x8')]),_0x3bf2d3);if(_0x3bf2d3['uniqueid']==_0x3bf2d3['linkedid']&&_0x3bf2d3['channel']!=_0x7e79('0x1c')){utils[_0x7e79('0xb')](util[_0x7e79('0xc')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x3bf2d3[_0x7e79('0x8')],_0x3bf2d3[_0x7e79('0x1d')],_0x3bf2d3[_0x7e79('0x1e')]));channels[_0x3bf2d3[_0x7e79('0x8')]]={'uniqueid':_0x3bf2d3[_0x7e79('0x8')],'accountcode':_0x3bf2d3[_0x7e79('0x13')],'source':_0x3bf2d3[_0x7e79('0x1f')],'destination':_0x3bf2d3['exten'],'destinationcontext':_0x3bf2d3[_0x7e79('0x1d')],'channel':_0x3bf2d3[_0x7e79('0xe')],'starttime':utils[_0x7e79('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x7e79('0x4'),'amaflags':_0x7e79('0x21')};}}catch(_0x4736bb){utils['error'](util[_0x7e79('0xc')]('[%s][calls][newchannel]',_0x3bf2d3[_0x7e79('0x8')]),_0x4736bb);}};exports['newstate']=function(_0x5a9d6a){try{utils[_0x7e79('0x1a')](util[_0x7e79('0xc')]('[%s][calls][newstate]',_0x5a9d6a[_0x7e79('0x8')]),_0x5a9d6a);if(!_[_0x7e79('0x22')](channels[_0x5a9d6a[_0x7e79('0x8')]])&&_0x5a9d6a[_0x7e79('0x23')]==0x6){utils['info'](util[_0x7e79('0xc')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x5a9d6a[_0x7e79('0x8')],_0x5a9d6a[_0x7e79('0x1d')],_0x5a9d6a[_0x7e79('0xe')]));if(_[_0x7e79('0x22')](channels[_0x5a9d6a[_0x7e79('0x8')]]['systemanswertime'])){channels[_0x5a9d6a[_0x7e79('0x8')]][_0x7e79('0x24')]=utils[_0x7e79('0x20')]();}}else if(!_['isNil'](channels[_0x5a9d6a['linkedid']])&&_0x5a9d6a[_0x7e79('0x23')]==0x6&&_0x5a9d6a[_0x7e79('0x1d')]!='transfer'){utils[_0x7e79('0xb')](util[_0x7e79('0xc')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x5a9d6a[_0x7e79('0x8')],_0x5a9d6a[_0x7e79('0x25')],_0x5a9d6a[_0x7e79('0x1d')],_0x5a9d6a[_0x7e79('0xe')]));channels[_0x5a9d6a[_0x7e79('0x25')]]['accountcode']=_0x5a9d6a[_0x7e79('0x13')];channels[_0x5a9d6a['linkedid']][_0x7e79('0x26')]=_0x5a9d6a[_0x7e79('0xe')];if(_[_0x7e79('0x22')](channels[_0x5a9d6a[_0x7e79('0x25')]][_0x7e79('0x27')])){channels[_0x5a9d6a[_0x7e79('0x25')]][_0x7e79('0x27')]=utils[_0x7e79('0x20')]();}channels[_0x5a9d6a[_0x7e79('0x25')]][_0x7e79('0x28')]=dispositions[_[_0x7e79('0x29')](_0x5a9d6a[_0x7e79('0x23')])]||_0x7e79('0x6');}}catch(_0x4fdb8b){utils['error'](util[_0x7e79('0xc')](_0x7e79('0x2a'),_0x5a9d6a[_0x7e79('0x8')]),_0x4fdb8b);}};exports[_0x7e79('0x2b')]=function(_0x2c8f18){try{if(!_[_0x7e79('0x22')](channels[_0x2c8f18[_0x7e79('0x8')]])){utils[_0x7e79('0x1a')](util['format'](_0x7e79('0x2c'),_0x2c8f18[_0x7e79('0x8')]),_0x2c8f18);if(_[_0x7e79('0x22')](channels[_0x2c8f18[_0x7e79('0x8')]][_0x7e79('0x2d')])){channels[_0x2c8f18[_0x7e79('0x8')]]['callerid']=_0x2c8f18['calleridname']+'\x20<'+_0x2c8f18[_0x7e79('0x1f')]+'>';}utils[_0x7e79('0xb')](util[_0x7e79('0xc')](_0x7e79('0x2e'),_0x2c8f18[_0x7e79('0x8')],channels[_0x2c8f18[_0x7e79('0x8')]]['callerid'],_0x2c8f18[_0x7e79('0x2f')]));channels[_0x2c8f18[_0x7e79('0x8')]][_0x7e79('0x30')]=utils[_0x7e79('0x20')]();channels[_0x2c8f18['uniqueid']][_0x7e79('0x31')]=utils[_0x7e79('0x32')](channels[_0x2c8f18['uniqueid']][_0x7e79('0x30')],channels[_0x2c8f18[_0x7e79('0x8')]]['starttime']);channels[_0x2c8f18[_0x7e79('0x8')]][_0x7e79('0x33')]=channels[_0x2c8f18[_0x7e79('0x8')]][_0x7e79('0x27')]?utils[_0x7e79('0x32')](channels[_0x2c8f18[_0x7e79('0x8')]][_0x7e79('0x30')],channels[_0x2c8f18[_0x7e79('0x8')]][_0x7e79('0x27')]):0x0;writeDB(channels[_0x2c8f18[_0x7e79('0x8')]]);}}catch(_0x596be7){utils[_0x7e79('0x34')](util[_0x7e79('0xc')](_0x7e79('0x2c'),_0x2c8f18[_0x7e79('0x8')]),_0x596be7);}};exports['attendedtransfer']=function(_0xc854f1){try{if(!_['isNil'](channels[_0xc854f1[_0x7e79('0x35')]])){utils[_0x7e79('0x1a')](util['format'](_0x7e79('0x36'),_0xc854f1['origtransfereruniqueid']),_0xc854f1);if(channels[_0xc854f1[_0x7e79('0x35')]]['channel']==_0xc854f1[_0x7e79('0x37')]){utils['info'](util['format'](_0x7e79('0x38'),_0xc854f1[_0x7e79('0x39')],_0xc854f1[_0x7e79('0x35')],_0xc854f1['secondtransfererchannel']));channels[_0xc854f1[_0x7e79('0x35')]][_0x7e79('0x26')]=_0xc854f1[_0x7e79('0x3a')];channels[_0xc854f1[_0x7e79('0x35')]][_0x7e79('0x3b')]=_0x7e79('0x3c');}else if(channels[_0xc854f1[_0x7e79('0x35')]][_0x7e79('0xe')]=_0xc854f1[_0x7e79('0x3d')]){utils['info'](util[_0x7e79('0xc')](_0x7e79('0x38'),_0xc854f1[_0x7e79('0x39')],_0xc854f1[_0x7e79('0x35')],_0xc854f1['origtransfererchannel']));channels[_0xc854f1[_0x7e79('0x35')]][_0x7e79('0x26')]=_0xc854f1['origtransfererchannel'];channels[_0xc854f1[_0x7e79('0x35')]][_0x7e79('0x3b')]='_attended';}}}catch(_0x269323){utils[_0x7e79('0x34')](util['format']('[%s][calls][attendedtransfer]',_0xc854f1[_0x7e79('0x39')]),_0x269323);}};exports['musiconholdstart']=function(_0x204758){try{if(!_[_0x7e79('0x22')](channels[_0x204758[_0x7e79('0x8')]])){utils[_0x7e79('0x1a')](util['format'](_0x7e79('0x3e'),_0x204758[_0x7e79('0x8')]),_0x204758);channels[_0x204758[_0x7e79('0x8')]][_0x7e79('0x3f')]=utils[_0x7e79('0x20')]();utils['info'](util[_0x7e79('0xc')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x204758['uniqueid'],channels[_0x204758[_0x7e79('0x8')]]['musiconholdstartAt']));}}catch(_0xa386c){utils[_0x7e79('0x34')](util[_0x7e79('0xc')](_0x7e79('0x3e'),_0x204758[_0x7e79('0x8')]),_0xa386c);}};exports[_0x7e79('0x40')]=function(_0x917b7a){try{if(!_['isNil'](channels[_0x917b7a[_0x7e79('0x8')]])){utils[_0x7e79('0x1a')](util[_0x7e79('0xc')](_0x7e79('0x41'),_0x917b7a[_0x7e79('0x8')]),_0x917b7a);if(!_[_0x7e79('0x22')](channels[_0x917b7a['uniqueid']][_0x7e79('0x3f')])){channels[_0x917b7a[_0x7e79('0x8')]][_0x7e79('0x42')]+=utils['diffTime'](utils[_0x7e79('0x20')](),channels[_0x917b7a['uniqueid']]['musiconholdstartAt']);utils['info'](util[_0x7e79('0xc')](_0x7e79('0x43'),_0x917b7a[_0x7e79('0x8')],channels[_0x917b7a[_0x7e79('0x8')]][_0x7e79('0x42')]));delete channels[_0x917b7a['uniqueid']][_0x7e79('0x3f')];}}}catch(_0x541f58){utils[_0x7e79('0x34')](util[_0x7e79('0xc')](_0x7e79('0x41'),_0x917b7a[_0x7e79('0x8')]),_0x541f58);}};exports[_0x7e79('0x44')]=function(_0x5125f9){try{if(!_['isNil'](channels[_0x5125f9['uniqueid']])){utils['debug'](util['format'](_0x7e79('0x45'),_0x5125f9[_0x7e79('0x8')]),_0x5125f9);if(!_[_0x7e79('0x22')](_0x5125f9['variable'][_0x7e79('0x46')])){utils[_0x7e79('0xb')](util[_0x7e79('0xc')](_0x7e79('0x47'),_0x5125f9['uniqueid'],_0x5125f9[_0x7e79('0x48')]));channels[_0x5125f9[_0x7e79('0x8')]][_0x7e79('0x49')]=_0x5125f9[_0x7e79('0x48')];}if(!_[_0x7e79('0x22')](_0x5125f9[_0x7e79('0x4a')][_0x7e79('0x4b')])){utils['info'](util[_0x7e79('0xc')](_0x7e79('0x4c'),_0x5125f9[_0x7e79('0x8')],_0x5125f9[_0x7e79('0x48')]));channels[_0x5125f9[_0x7e79('0x8')]][_0x7e79('0x4d')]=_0x5125f9['value'];channels[_0x5125f9[_0x7e79('0x8')]]['callerid']='\x22'+_0x5125f9[_0x7e79('0x48')]+_0x7e79('0x4e')+_0x5125f9[_0x7e79('0x48')]+'>';}if(!_['isNil'](_0x5125f9[_0x7e79('0x4a')][_0x7e79('0x4f')])||!_[_0x7e79('0x22')](_0x5125f9['variable'][_0x7e79('0x50')])){utils['info'](util[_0x7e79('0xc')](_0x7e79('0x51'),_0x5125f9[_0x7e79('0x8')],!_[_0x7e79('0x22')](_0x5125f9[_0x7e79('0x4a')][_0x7e79('0x4f')])?_0x7e79('0x4f'):_0x7e79('0x50'),_0x5125f9[_0x7e79('0x48')]));channels[_0x5125f9[_0x7e79('0x8')]][_0x7e79('0x2d')]=_0x5125f9[_0x7e79('0x48')];}if(!_[_0x7e79('0x22')](_0x5125f9[_0x7e79('0x4a')][_0x7e79('0x52')])||!_[_0x7e79('0x22')](_0x5125f9[_0x7e79('0x4a')][_0x7e79('0x53')])){utils[_0x7e79('0xb')](util['format'](_0x7e79('0x51'),_0x5125f9['uniqueid'],!_['isNil'](_0x5125f9[_0x7e79('0x4a')][_0x7e79('0x52')])?_0x7e79('0x52'):'xmcs-queue',_0x5125f9[_0x7e79('0x48')]));channels[_0x5125f9['uniqueid']]['lastapplication']=_0x7e79('0x54');channels[_0x5125f9[_0x7e79('0x8')]][_0x7e79('0x55')]=_0x5125f9[_0x7e79('0x48')];channels[_0x5125f9['uniqueid']][_0x7e79('0xf')]=!![];}if(!_[_0x7e79('0x22')](_0x5125f9[_0x7e79('0x4a')][_0x7e79('0x56')])){utils[_0x7e79('0xb')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x5125f9[_0x7e79('0x8')],_0x5125f9[_0x7e79('0x48')]));channels[_0x5125f9[_0x7e79('0x8')]][_0x7e79('0x57')]=_0x5125f9[_0x7e79('0x48')];}if(!_['isNil'](_0x5125f9[_0x7e79('0x4a')]['xmd-cdrtype'])){utils['info'](util['format'](_0x7e79('0x58'),_0x5125f9[_0x7e79('0x8')],_0x5125f9[_0x7e79('0x48')]));channels[_0x5125f9[_0x7e79('0x8')]]['type']=_0x5125f9[_0x7e79('0x48')];}if(!_[_0x7e79('0x22')](_0x5125f9['variable'][_0x7e79('0x59')])){utils[_0x7e79('0xb')](util[_0x7e79('0xc')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5125f9[_0x7e79('0x8')],_0x5125f9[_0x7e79('0x48')]));channels[_0x5125f9[_0x7e79('0x8')]][_0x7e79('0x5a')]=_0x5125f9[_0x7e79('0x48')];}if(!_['isNil'](_0x5125f9[_0x7e79('0x4a')][_0x7e79('0x5b')])){utils[_0x7e79('0xb')](util[_0x7e79('0xc')](_0x7e79('0x5c'),_0x5125f9[_0x7e79('0x8')],_0x5125f9['value']));channels[_0x5125f9['uniqueid']][_0x7e79('0x5b')]=_0x5125f9[_0x7e79('0x48')];}}}catch(_0x49f4d9){utils[_0x7e79('0x34')](util[_0x7e79('0xc')]('[%s][calls][varset]',_0x5125f9[_0x7e79('0x8')]),_0x49f4d9);}};exports['newexten']=function(_0xeaa2cb){try{if(!_[_0x7e79('0x22')](channels[_0xeaa2cb[_0x7e79('0x8')]])){utils['debug'](util[_0x7e79('0xc')](_0x7e79('0x5d'),_0xeaa2cb[_0x7e79('0x8')]),_0xeaa2cb);utils[_0x7e79('0xb')](util['format'](_0x7e79('0x5e'),_0xeaa2cb['uniqueid'],_0xeaa2cb[_0x7e79('0x5f')],_0xeaa2cb[_0x7e79('0x60')]));if(_0xeaa2cb[_0x7e79('0x5f')][_0x7e79('0x61')]()==_0x7e79('0x62')&&_['startsWith'](_0xeaa2cb[_0x7e79('0x60')][_0x7e79('0x61')](),_0x7e79('0x63'))){var _0x2ccb63=_0xeaa2cb[_0x7e79('0x60')]['split']('=');var _0x4874f4=_0x2ccb63[0x0]['substring'](_0x2ccb63[0x0][_0x7e79('0x64')]('(')+0x1,_0x2ccb63[0x0][_0x7e79('0x64')](')'));var _0x26eb88=_0x2ccb63[0x1];channels[_0xeaa2cb[_0x7e79('0x8')]][_0x4874f4]=_0x26eb88;}if(!_[_0x7e79('0x65')]([_0x7e79('0x2b'),_0x7e79('0x66'),_0x7e79('0x67'),'set',_0x7e79('0x68')],_0xeaa2cb['application'][_0x7e79('0x61')]())){channels[_0xeaa2cb[_0x7e79('0x8')]][_0x7e79('0x69')]=_0xeaa2cb[_0x7e79('0x5f')];channels[_0xeaa2cb[_0x7e79('0x8')]][_0x7e79('0x55')]=_0xeaa2cb['appdata'];}}}catch(_0x547c24){utils[_0x7e79('0x34')](util[_0x7e79('0xc')]('[%s][calls][newexten]',_0xeaa2cb[_0x7e79('0x8')]),_0x547c24);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 8eae2f5..babb83a 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 _0x5d6f=['managerevent','./utils','connect','[core]\x20connected','shutdown','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close'];(function(_0x30ab77,_0x1bc21c){var _0x76e91b=function(_0x580da9){while(--_0x580da9){_0x30ab77['push'](_0x30ab77['shift']());}};_0x76e91b(++_0x1bc21c);}(_0x5d6f,0x105));var _0xf5d6=function(_0x2d91c6,_0x10ae0e){_0x2d91c6=_0x2d91c6-0x0;var _0x3a8d19=_0x5d6f[_0x2d91c6];return _0x3a8d19;};'use strict';var utils=require(_0xf5d6('0x0'));exports[_0xf5d6('0x1')]=function(){utils['info'](_0xf5d6('0x2'));};exports[_0xf5d6('0x3')]=function(){utils[_0xf5d6('0x4')](_0xf5d6('0x5'));};exports[_0xf5d6('0x6')]=function(){utils['info'](_0xf5d6('0x7'));};exports[_0xf5d6('0x8')]=function(_0x31c42f){utils[_0xf5d6('0x8')](_0xf5d6('0x9'),_0x31c42f);};exports[_0xf5d6('0xa')]=function(){utils[_0xf5d6('0x4')](_0xf5d6('0xb'));};exports[_0xf5d6('0xc')]=function(_0x2d1cf0){}; \ No newline at end of file +var _0x11db=['[core]\x20fullybooted','error','close','[core]\x20close','connect','info','[core]\x20connected','fullybooted'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x11db,0x94));var _0xb11d=function(_0x5a4400,_0xfae3b6){_0x5a4400=_0x5a4400-0x0;var _0xf9b532=_0x11db[_0x5a4400];return _0xf9b532;};'use strict';var utils=require('./utils');exports[_0xb11d('0x0')]=function(){utils[_0xb11d('0x1')](_0xb11d('0x2'));};exports['shutdown']=function(){utils[_0xb11d('0x1')]('[core]\x20shutdown');};exports[_0xb11d('0x3')]=function(){utils[_0xb11d('0x1')](_0xb11d('0x4'));};exports['error']=function(_0x72e8ae){utils[_0xb11d('0x5')]('[core]\x20error',_0x72e8ae);};exports[_0xb11d('0x6')]=function(){utils[_0xb11d('0x1')](_0xb11d('0x7'));};exports['managerevent']=function(_0xb52495){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 647465d..80f36b8 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 _0xcc57=['toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','starttime','now','lastevent','dialend','[%s][dials][dialend]','ANSWER','assign','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','complete','duration','diffTime','endtime','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','debug','[%s][dials][newexten]','format','appdata','application'];(function(_0x375f00,_0x1424f8){var _0x2e7202=function(_0xe996aa){while(--_0xe996aa){_0x375f00['push'](_0x375f00['shift']());}};_0x2e7202(++_0x1424f8);}(_0xcc57,0x1ec));var _0x7cc5=function(_0x2410fa,_0x4d4bc2){_0x2410fa=_0x2410fa-0x0;var _0x58482f=_0xcc57[_0x2410fa];return _0x58482f;};'use strict';var _=require(_0x7cc5('0x0'));var util=require(_0x7cc5('0x1'));var utils=require(_0x7cc5('0x2'));var dials={};function writeDB(_0x48a0a2){utils[_0x7cc5('0x3')](util['format'](_0x7cc5('0x4'),_0x48a0a2[_0x7cc5('0x5')],_0x48a0a2[_0x7cc5('0x6')],_0x48a0a2[_0x7cc5('0x7')],_0x48a0a2[_0x7cc5('0x8')],_0x48a0a2[_0x7cc5('0x9')],_0x48a0a2[_0x7cc5('0xa')]));utils[_0x7cc5('0xb')](_0x7cc5('0xc'),_0x48a0a2);delete dials[_0x48a0a2[_0x7cc5('0x5')]];}exports['newexten']=function(_0x4c1d4a){try{utils[_0x7cc5('0xd')](util['format'](_0x7cc5('0xe'),_0x4c1d4a[_0x7cc5('0x5')]),_0x4c1d4a);utils[_0x7cc5('0x3')](util[_0x7cc5('0xf')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x4c1d4a[_0x7cc5('0x5')],_0x4c1d4a['application'],_0x4c1d4a[_0x7cc5('0x10')]));if(_0x4c1d4a[_0x7cc5('0x11')][_0x7cc5('0x12')]()==_0x7cc5('0x13')&&_[_0x7cc5('0x14')](_0x4c1d4a[_0x7cc5('0x10')][_0x7cc5('0x12')](),_0x7cc5('0x15'))){var _0x1cfffc=_0x4c1d4a['appdata'][_0x7cc5('0x16')]('=');dials[_0x4c1d4a[_0x7cc5('0x5')]]={'routeId':_0x1cfffc[0x1]};}}catch(_0x4c7c27){utils[_0x7cc5('0x17')](util[_0x7cc5('0xf')](_0x7cc5('0xe'),_0x4c1d4a[_0x7cc5('0x5')]),_0x4c7c27);}};exports[_0x7cc5('0x18')]=function(_0x44086b){try{utils[_0x7cc5('0xd')](util[_0x7cc5('0xf')](_0x7cc5('0x19'),_0x44086b[_0x7cc5('0x5')]),_0x44086b);if(!_[_0x7cc5('0x1a')](_0x44086b[_0x7cc5('0x1b')][_0x7cc5('0x1c')])){utils[_0x7cc5('0x3')](util[_0x7cc5('0xf')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x44086b[_0x7cc5('0x5')],_0x44086b[_0x7cc5('0x1d')]));dials[_0x44086b[_0x7cc5('0x5')]]={'routeId':_0x44086b[_0x7cc5('0x1d')]};}}catch(_0x3d6668){utils[_0x7cc5('0x17')](util[_0x7cc5('0xf')]('[%s][dials][varset]',_0x44086b[_0x7cc5('0x5')]),_0x3d6668);}};exports[_0x7cc5('0x1e')]=function(_0x33f36f){try{if(!_[_0x7cc5('0x1a')](dials[_0x33f36f['uniqueid']])){utils[_0x7cc5('0xd')](util[_0x7cc5('0xf')](_0x7cc5('0x1f'),_0x33f36f[_0x7cc5('0x5')]),_0x33f36f);dials[_0x33f36f[_0x7cc5('0x5')]]=_['assign'](dials[_0x33f36f[_0x7cc5('0x5')]],_0x33f36f);dials[_0x33f36f['uniqueid']][_0x7cc5('0x20')]=utils[_0x7cc5('0x21')]();dials[_0x33f36f[_0x7cc5('0x5')]][_0x7cc5('0x22')]='called';utils[_0x7cc5('0x3')](util[_0x7cc5('0xf')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x33f36f[_0x7cc5('0x5')],dials[_0x33f36f[_0x7cc5('0x5')]][_0x7cc5('0x20')]));}}catch(_0x4ab648){utils['error'](util[_0x7cc5('0xf')](_0x7cc5('0x1f'),_0x33f36f[_0x7cc5('0x5')]),_0x4ab648);}};exports[_0x7cc5('0x23')]=function(_0x23c826){try{if(!_[_0x7cc5('0x1a')](dials[_0x23c826['uniqueid']])){utils[_0x7cc5('0xd')](util[_0x7cc5('0xf')](_0x7cc5('0x24'),_0x23c826['uniqueid']),_0x23c826);dials[_0x23c826['uniqueid']][_0x7cc5('0xa')]=_0x23c826[_0x7cc5('0xa')];if(_0x23c826[_0x7cc5('0xa')]==_0x7cc5('0x25')){dials[_0x23c826[_0x7cc5('0x5')]]=_[_0x7cc5('0x26')](dials[_0x23c826['uniqueid']],_0x23c826);dials[_0x23c826[_0x7cc5('0x5')]]['answertime']=utils[_0x7cc5('0x21')]();dials[_0x23c826[_0x7cc5('0x5')]][_0x7cc5('0x22')]=_0x7cc5('0x27');utils[_0x7cc5('0x3')](util[_0x7cc5('0xf')](_0x7cc5('0x28'),_0x23c826[_0x7cc5('0x5')],_0x23c826[_0x7cc5('0xa')],dials[_0x23c826[_0x7cc5('0x5')]][_0x7cc5('0x29')]));}else{utils['info'](util[_0x7cc5('0xf')](_0x7cc5('0x2a'),_0x23c826[_0x7cc5('0x5')],_0x23c826['dialstatus']));}}}catch(_0xc1fc05){utils[_0x7cc5('0x17')](util[_0x7cc5('0xf')](_0x7cc5('0x24'),_0x23c826[_0x7cc5('0x5')]),_0xc1fc05);}};exports[_0x7cc5('0x2b')]=function(_0x1ca797){try{if(!_[_0x7cc5('0x1a')](dials[_0x1ca797[_0x7cc5('0x5')]])){utils[_0x7cc5('0xd')](util[_0x7cc5('0xf')](_0x7cc5('0x2c'),_0x1ca797[_0x7cc5('0x5')]),_0x1ca797);utils['info'](util[_0x7cc5('0xf')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x1ca797['uniqueid'],_0x1ca797[_0x7cc5('0x8')],_0x1ca797[_0x7cc5('0x2d')],_0x1ca797[_0x7cc5('0x2e')]));dials[_0x1ca797['uniqueid']]=_[_0x7cc5('0x26')](dials[_0x1ca797[_0x7cc5('0x5')]],{'endtime':utils[_0x7cc5('0x21')](),'lastevent':_0x7cc5('0x2f')});dials[_0x1ca797[_0x7cc5('0x5')]][_0x7cc5('0x30')]=utils[_0x7cc5('0x31')](dials[_0x1ca797[_0x7cc5('0x5')]]['endtime'],dials[_0x1ca797[_0x7cc5('0x5')]]['starttime']);dials[_0x1ca797[_0x7cc5('0x5')]]['holdtime']=utils[_0x7cc5('0x31')](dials[_0x1ca797['uniqueid']]['answertime']||dials[_0x1ca797['uniqueid']][_0x7cc5('0x32')],dials[_0x1ca797[_0x7cc5('0x5')]][_0x7cc5('0x20')]);dials[_0x1ca797[_0x7cc5('0x5')]]['billableseconds']=dials[_0x1ca797[_0x7cc5('0x5')]][_0x7cc5('0x29')]?utils[_0x7cc5('0x31')](dials[_0x1ca797['uniqueid']][_0x7cc5('0x32')],dials[_0x1ca797[_0x7cc5('0x5')]]['answertime']):0x0;writeDB(dials[_0x1ca797[_0x7cc5('0x5')]]);}}catch(_0x2a7aaf){utils[_0x7cc5('0x17')](util[_0x7cc5('0xf')](_0x7cc5('0x2c'),_0x1ca797[_0x7cc5('0x5')]),_0x2a7aaf);}}; \ No newline at end of file +var _0x6566=['[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','error','varset','debug','isNil','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','assign','starttime','now','lastevent','called','[%s][dials][dialbegin]','dialend','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport'];(function(_0x72e4b2,_0x5329f2){var _0x1cff73=function(_0x3f1646){while(--_0x3f1646){_0x72e4b2['push'](_0x72e4b2['shift']());}};_0x1cff73(++_0x5329f2);}(_0x6566,0x1cc));var _0x6656=function(_0x1faaa1,_0x1568dd){_0x1faaa1=_0x1faaa1-0x0;var _0x994ec=_0x6566[_0x1faaa1];return _0x994ec;};'use strict';var _=require('lodash');var util=require(_0x6656('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x36749d){utils[_0x6656('0x1')](util[_0x6656('0x2')](_0x6656('0x3'),_0x36749d[_0x6656('0x4')],_0x36749d[_0x6656('0x5')],_0x36749d['dialstring'],_0x36749d[_0x6656('0x6')],_0x36749d[_0x6656('0x7')],_0x36749d[_0x6656('0x8')]));utils['request'](_0x6656('0x9'),_0x36749d);delete dials[_0x36749d['uniqueid']];}exports['newexten']=function(_0xe34137){try{utils['debug'](util[_0x6656('0x2')](_0x6656('0xa'),_0xe34137[_0x6656('0x4')]),_0xe34137);utils['info'](util[_0x6656('0x2')](_0x6656('0xb'),_0xe34137[_0x6656('0x4')],_0xe34137[_0x6656('0xc')],_0xe34137[_0x6656('0xd')]));if(_0xe34137[_0x6656('0xc')][_0x6656('0xe')]()==_0x6656('0xf')&&_[_0x6656('0x10')](_0xe34137[_0x6656('0xd')][_0x6656('0xe')](),'cdr(routeid)')){var _0x76dd4a=_0xe34137[_0x6656('0xd')][_0x6656('0x11')]('=');dials[_0xe34137[_0x6656('0x4')]]={'routeId':_0x76dd4a[0x1]};}}catch(_0x215ed3){utils[_0x6656('0x12')](util['format'](_0x6656('0xa'),_0xe34137[_0x6656('0x4')]),_0x215ed3);}};exports[_0x6656('0x13')]=function(_0x39fee1){try{utils[_0x6656('0x14')](util[_0x6656('0x2')]('[%s][dials][varset]',_0x39fee1['uniqueid']),_0x39fee1);if(!_[_0x6656('0x15')](_0x39fee1['variable']['outboundrouteid'])){utils[_0x6656('0x1')](util['format'](_0x6656('0x16'),_0x39fee1[_0x6656('0x4')],_0x39fee1[_0x6656('0x17')]));dials[_0x39fee1['uniqueid']]={'routeId':_0x39fee1[_0x6656('0x17')]};}}catch(_0x1a2d72){utils[_0x6656('0x12')](util['format'](_0x6656('0x18'),_0x39fee1[_0x6656('0x4')]),_0x1a2d72);}};exports['dialbegin']=function(_0x35fb0c){try{if(!_[_0x6656('0x15')](dials[_0x35fb0c[_0x6656('0x4')]])){utils['debug'](util[_0x6656('0x2')]('[%s][dials][dialbegin]',_0x35fb0c[_0x6656('0x4')]),_0x35fb0c);dials[_0x35fb0c[_0x6656('0x4')]]=_[_0x6656('0x19')](dials[_0x35fb0c[_0x6656('0x4')]],_0x35fb0c);dials[_0x35fb0c[_0x6656('0x4')]][_0x6656('0x1a')]=utils[_0x6656('0x1b')]();dials[_0x35fb0c[_0x6656('0x4')]][_0x6656('0x1c')]=_0x6656('0x1d');utils[_0x6656('0x1')](util[_0x6656('0x2')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x35fb0c[_0x6656('0x4')],dials[_0x35fb0c[_0x6656('0x4')]][_0x6656('0x1a')]));}}catch(_0x4a6e7d){utils[_0x6656('0x12')](util[_0x6656('0x2')](_0x6656('0x1e'),_0x35fb0c['uniqueid']),_0x4a6e7d);}};exports[_0x6656('0x1f')]=function(_0x112764){try{if(!_[_0x6656('0x15')](dials[_0x112764[_0x6656('0x4')]])){utils['debug'](util[_0x6656('0x2')]('[%s][dials][dialend]',_0x112764['uniqueid']),_0x112764);dials[_0x112764[_0x6656('0x4')]][_0x6656('0x8')]=_0x112764[_0x6656('0x8')];if(_0x112764[_0x6656('0x8')]==_0x6656('0x20')){dials[_0x112764[_0x6656('0x4')]]=_[_0x6656('0x19')](dials[_0x112764[_0x6656('0x4')]],_0x112764);dials[_0x112764[_0x6656('0x4')]][_0x6656('0x21')]=utils['now']();dials[_0x112764['uniqueid']][_0x6656('0x1c')]='connect';utils[_0x6656('0x1')](util[_0x6656('0x2')](_0x6656('0x22'),_0x112764[_0x6656('0x4')],_0x112764['dialstatus'],dials[_0x112764[_0x6656('0x4')]][_0x6656('0x21')]));}else{utils[_0x6656('0x1')](util[_0x6656('0x2')](_0x6656('0x23'),_0x112764[_0x6656('0x4')],_0x112764['dialstatus']));}}}catch(_0x551760){utils[_0x6656('0x12')](util[_0x6656('0x2')](_0x6656('0x24'),_0x112764[_0x6656('0x4')]),_0x551760);}};exports['hangup']=function(_0xf62d37){try{if(!_[_0x6656('0x15')](dials[_0xf62d37[_0x6656('0x4')]])){utils['debug'](util[_0x6656('0x2')](_0x6656('0x25'),_0xf62d37[_0x6656('0x4')]),_0xf62d37);utils['info'](util['format'](_0x6656('0x26'),_0xf62d37[_0x6656('0x4')],_0xf62d37[_0x6656('0x6')],_0xf62d37[_0x6656('0x27')],_0xf62d37[_0x6656('0x28')]));dials[_0xf62d37[_0x6656('0x4')]]=_[_0x6656('0x19')](dials[_0xf62d37[_0x6656('0x4')]],{'endtime':utils[_0x6656('0x1b')](),'lastevent':_0x6656('0x29')});dials[_0xf62d37['uniqueid']][_0x6656('0x2a')]=utils[_0x6656('0x2b')](dials[_0xf62d37['uniqueid']][_0x6656('0x2c')],dials[_0xf62d37[_0x6656('0x4')]][_0x6656('0x1a')]);dials[_0xf62d37[_0x6656('0x4')]][_0x6656('0x2d')]=utils['diffTime'](dials[_0xf62d37[_0x6656('0x4')]][_0x6656('0x21')]||dials[_0xf62d37[_0x6656('0x4')]][_0x6656('0x2c')],dials[_0xf62d37[_0x6656('0x4')]][_0x6656('0x1a')]);dials[_0xf62d37[_0x6656('0x4')]][_0x6656('0x2e')]=dials[_0xf62d37[_0x6656('0x4')]][_0x6656('0x21')]?utils[_0x6656('0x2b')](dials[_0xf62d37[_0x6656('0x4')]][_0x6656('0x2c')],dials[_0xf62d37['uniqueid']]['answertime']):0x0;writeDB(dials[_0xf62d37[_0x6656('0x4')]]);}}catch(_0x50691e){utils[_0x6656('0x12')](util[_0x6656('0x2')](_0x6656('0x25'),_0xf62d37[_0x6656('0x4')]),_0x50691e);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 423be0b..89b1407 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 _0x3383=['queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','./utils','xdr','disabled','local','port','asterisk','username','password','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','connect','shutdown','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','debug','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]'];(function(_0x3ea5cd,_0x407716){var _0x384157=function(_0x4a031c){while(--_0x4a031c){_0x3ea5cd['push'](_0x3ea5cd['shift']());}};_0x384157(++_0x407716);}(_0x3383,0x164));var _0x3338=function(_0x315089,_0x59eb17){_0x315089=_0x315089-0x0;var _0x2c2613=_0x3383[_0x315089];return _0x2c2613;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0x3338('0x0'));var util=require('util');var isXDREnabled=config[_0x3338('0x1')]&&config[_0x3338('0x1')][_0x3338('0x2')]?!config[_0x3338('0x1')][_0x3338('0x2')]:!![];var isProduction=config['env']==='production'||![];var isLocalAsterisk=config[_0x3338('0x1')]&&config[_0x3338('0x1')][_0x3338('0x3')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x3338('0x4')],config[_0x3338('0x5')]['ip'],config[_0x3338('0x5')][_0x3338('0x6')],config[_0x3338('0x5')][_0x3338('0x7')],!![]);ami[_0x3338('0x8')]();if(!isXDREnabled){utils[_0x3338('0x9')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x3338('0x9')](_0x3338('0xa'));}else{var agents=require(_0x3338('0xb'));var calls=require(_0x3338('0xc'));var queues=require(_0x3338('0xd'));var recordings=require(_0x3338('0xe'));var members=require('./members.controller');var dials=require(_0x3338('0xf'));var transfers=require(_0x3338('0x10'));var core=require('./core.controller');ami['on']('connect',core[_0x3338('0x11')]);ami['on']('shutdown',core[_0x3338('0x12')]);ami['on']('fullybooted',core['fullybooted']);ami['on']('error',core[_0x3338('0x13')]);ami['on'](_0x3338('0x14'),core[_0x3338('0x14')]);ami['on'](_0x3338('0x15'),core[_0x3338('0x15')]);ami['on'](_0x3338('0x16'),function(_0x40a22b){try{utils['debug'](util[_0x3338('0x17')](_0x3338('0x18'),_0x40a22b[_0x3338('0x19')]),_0x40a22b);members['devicestatechange'](_0x40a22b);}catch(_0x5ceb45){utils[_0x3338('0x13')](util[_0x3338('0x17')](_0x3338('0x18'),_0x40a22b['device']),_0x5ceb45);}});ami['on'](_0x3338('0x1a'),function(_0x1dfeb9){try{utils[_0x3338('0x1b')](util[_0x3338('0x17')]('[%s][index][agentcalled]',_0x1dfeb9[_0x3338('0x1c')]),_0x1dfeb9);agents[_0x3338('0x1a')](_0x1dfeb9);}catch(_0x52996e){utils[_0x3338('0x13')](util[_0x3338('0x17')](_0x3338('0x1d'),_0x1dfeb9['uniqueid']),_0x52996e);}});ami['on'](_0x3338('0x1e'),function(_0x47ca09){try{utils[_0x3338('0x1b')](util[_0x3338('0x17')](_0x3338('0x1f'),_0x47ca09[_0x3338('0x1c')]),_0x47ca09);agents[_0x3338('0x1e')](_0x47ca09);}catch(_0x494b63){utils[_0x3338('0x13')](util['format'](_0x3338('0x1f'),_0x47ca09['uniqueid']),_0x494b63);}});ami['on']('agentconnect',function(_0x63d28){try{utils[_0x3338('0x1b')](util[_0x3338('0x17')]('[%s][index][agentconnect]',_0x63d28[_0x3338('0x1c')]),_0x63d28);agents[_0x3338('0x20')](_0x63d28);queues[_0x3338('0x20')](_0x63d28);}catch(_0x592593){utils[_0x3338('0x13')](util[_0x3338('0x17')](_0x3338('0x21'),_0x63d28[_0x3338('0x1c')]),_0x592593);}});ami['on']('agentcomplete',function(_0x14060c){try{utils['debug'](util['format'](_0x3338('0x22'),_0x14060c[_0x3338('0x1c')]),_0x14060c);agents[_0x3338('0x23')](_0x14060c);queues['agentcomplete'](_0x14060c);members[_0x3338('0x23')](_0x14060c);}catch(_0x530486){utils[_0x3338('0x13')](util[_0x3338('0x17')]('[%s][index][agentcomplete]',_0x14060c[_0x3338('0x1c')]),_0x530486);}});ami['on'](_0x3338('0x24'),function(_0x23b54c){try{utils[_0x3338('0x1b')](util[_0x3338('0x17')]('[%s][index][queuecallerabandon]',_0x23b54c['uniqueid']),_0x23b54c);agents[_0x3338('0x24')](_0x23b54c);queues[_0x3338('0x24')](_0x23b54c);}catch(_0x200fd0){utils[_0x3338('0x13')](util[_0x3338('0x17')](_0x3338('0x25'),_0x23b54c[_0x3338('0x1c')]),_0x200fd0);}});ami['on'](_0x3338('0x26'),function(_0x451bd1){try{utils[_0x3338('0x1b')](util[_0x3338('0x17')](_0x3338('0x27'),_0x451bd1[_0x3338('0x1c')]),_0x451bd1);queues[_0x3338('0x26')](_0x451bd1);recordings[_0x3338('0x26')](_0x451bd1);}catch(_0x523625){utils[_0x3338('0x13')](util[_0x3338('0x17')]('[%s][index][queuecallerjoin]',_0x451bd1[_0x3338('0x1c')]),_0x523625);}});ami['on'](_0x3338('0x28'),function(_0x17dbac){try{utils[_0x3338('0x1b')](util[_0x3338('0x17')](_0x3338('0x29'),_0x17dbac[_0x3338('0x1c')]),_0x17dbac);queues['queuecallerleave'](_0x17dbac);}catch(_0xb6b64a){utils[_0x3338('0x13')](util[_0x3338('0x17')](_0x3338('0x29'),_0x17dbac[_0x3338('0x1c')]),_0xb6b64a);}});ami['on'](_0x3338('0x2a'),function(_0x550941){try{utils[_0x3338('0x1b')](util['format']('[%s][index][musiconholdstart]',_0x550941[_0x3338('0x1c')]),_0x550941);queues[_0x3338('0x2a')](_0x550941);calls['musiconholdstart'](_0x550941);}catch(_0x1914af){utils[_0x3338('0x13')](util[_0x3338('0x17')](_0x3338('0x2b'),_0x550941['uniqueid']),_0x1914af);}});ami['on'](_0x3338('0x2c'),function(_0x237685){try{utils[_0x3338('0x1b')](util[_0x3338('0x17')](_0x3338('0x2d'),_0x237685['uniqueid']),_0x237685);queues['musiconholdstop'](_0x237685);calls[_0x3338('0x2c')](_0x237685);}catch(_0x49adac){utils[_0x3338('0x13')](util[_0x3338('0x17')]('[%s][index][musiconholdstop]',_0x237685['uniqueid']),_0x49adac);}});ami['on'](_0x3338('0x2e'),function(_0x5ed3c8){try{utils['debug'](util[_0x3338('0x17')]('[%s][index][newstate]',_0x5ed3c8[_0x3338('0x1c')]),_0x5ed3c8);calls[_0x3338('0x2e')](_0x5ed3c8);recordings[_0x3338('0x2e')](_0x5ed3c8);}catch(_0x40523a){utils['error'](util['format']('[%s][index][newstate]',_0x5ed3c8[_0x3338('0x1c')]),_0x40523a);}});ami['on']('hangup',function(_0x5eb14e){try{utils['debug'](util[_0x3338('0x17')]('[%s][index][hangup]',_0x5eb14e[_0x3338('0x1c')]),_0x5eb14e);calls['hangup'](_0x5eb14e);recordings[_0x3338('0x2f')](_0x5eb14e);dials[_0x3338('0x2f')](_0x5eb14e);agents[_0x3338('0x2f')](_0x5eb14e);queues['hangup'](_0x5eb14e);}catch(_0x487d91){utils['error'](util[_0x3338('0x17')](_0x3338('0x30'),_0x5eb14e['uniqueid']),_0x487d91);}});ami['on'](_0x3338('0x31'),function(_0x1d4514){try{utils[_0x3338('0x1b')](util[_0x3338('0x17')]('[%s][index][cdr]',_0x1d4514[_0x3338('0x1c')]),_0x1d4514);members['cdr'](_0x1d4514);}catch(_0x56baa7){utils['error'](util['format'](_0x3338('0x32'),_0x1d4514[_0x3338('0x1c')]),_0x56baa7);}});ami['on'](_0x3338('0x33'),function(_0x2bc2c7){try{utils[_0x3338('0x1b')](util['format'](_0x3338('0x34'),_0x2bc2c7[_0x3338('0x1c')]),_0x2bc2c7);queues[_0x3338('0x33')](_0x2bc2c7);agents[_0x3338('0x33')](_0x2bc2c7);transfers['blindtransfer'](_0x2bc2c7);recordings[_0x3338('0x33')](_0x2bc2c7);}catch(_0x35e756){utils[_0x3338('0x13')](util[_0x3338('0x17')](_0x3338('0x34'),_0x2bc2c7[_0x3338('0x1c')]),_0x35e756);}});ami['on']('attendedtransfer',function(_0x198156){try{utils['debug'](util[_0x3338('0x17')]('[%s][index][attendedtransfer]',_0x198156['origtransfereruniqueid']),_0x198156);queues['attendedtransfer'](_0x198156);transfers[_0x3338('0x35')](_0x198156);agents[_0x3338('0x35')](_0x198156);calls['attendedtransfer'](_0x198156);}catch(_0x9a0d5b){utils['error'](util[_0x3338('0x17')](_0x3338('0x36'),_0x198156['origtransfereruniqueid']),_0x9a0d5b);}});ami['on'](_0x3338('0x37'),function(_0x535c26){try{utils['debug'](util[_0x3338('0x17')](_0x3338('0x38'),_0x535c26['uniqueid']),_0x535c26);queues[_0x3338('0x37')](_0x535c26);recordings[_0x3338('0x37')](_0x535c26);calls['varset'](_0x535c26);dials[_0x3338('0x37')](_0x535c26);}catch(_0x25efa0){utils[_0x3338('0x13')](util[_0x3338('0x17')](_0x3338('0x38'),_0x535c26[_0x3338('0x1c')]),_0x25efa0);}});ami['on'](_0x3338('0x39'),function(_0x452b1a){try{utils[_0x3338('0x1b')](util[_0x3338('0x17')](_0x3338('0x3a'),_0x452b1a['uniqueid']),_0x452b1a);calls['newexten'](_0x452b1a);recordings[_0x3338('0x39')](_0x452b1a);dials[_0x3338('0x39')](_0x452b1a);}catch(_0x429e59){utils[_0x3338('0x13')](util[_0x3338('0x17')](_0x3338('0x3a'),_0x452b1a[_0x3338('0x1c')]),_0x429e59);}});ami['on'](_0x3338('0x3b'),function(_0x38829c){try{utils[_0x3338('0x1b')](util[_0x3338('0x17')](_0x3338('0x3c'),_0x38829c['uniqueid']),_0x38829c);calls['newchannel'](_0x38829c);recordings[_0x3338('0x3b')](_0x38829c);}catch(_0x22bb66){utils[_0x3338('0x13')](util['format']('[%s][index][newchannel]',_0x38829c[_0x3338('0x1c')]),_0x22bb66);}});ami['on'](_0x3338('0x3d'),function(_0x4546c8){try{utils['debug'](util[_0x3338('0x17')](_0x3338('0x3e'),_0x4546c8[_0x3338('0x1c')]),_0x4546c8);dials[_0x3338('0x3d')](_0x4546c8);}catch(_0x3fe96a){utils[_0x3338('0x13')](util[_0x3338('0x17')](_0x3338('0x3f'),_0x4546c8[_0x3338('0x1c')]),_0x3fe96a);}});ami['on'](_0x3338('0x40'),function(_0x1e7f9b){try{utils[_0x3338('0x1b')](util[_0x3338('0x17')](_0x3338('0x41'),_0x1e7f9b[_0x3338('0x1c')]),_0x1e7f9b);dials['dialend'](_0x1e7f9b);}catch(_0x27a9e9){utils[_0x3338('0x13')](util[_0x3338('0x17')](_0x3338('0x41'),_0x1e7f9b[_0x3338('0x1c')]),_0x27a9e9);}});} \ No newline at end of file +var _0xbede=['queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','XDR\x20DISABLED','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','managerevent','devicestatechange','format','agentcalled','debug','[%s][index][agentcalled]','uniqueid','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]'];(function(_0x2d08b9,_0x2fee02){var _0x34c713=function(_0x57defa){while(--_0x57defa){_0x2d08b9['push'](_0x2d08b9['shift']());}};_0x34c713(++_0x2fee02);}(_0xbede,0x161));var _0xebed=function(_0x4e9cf3,_0x4c31a7){_0x4e9cf3=_0x4e9cf3-0x0;var _0x20a0a9=_0xbede[_0x4e9cf3];return _0x20a0a9;};var AsteriskManager=require(_0xebed('0x0'));var config=require(_0xebed('0x1'));var utils=require('./utils');var util=require('util');var isXDREnabled=config[_0xebed('0x2')]&&config[_0xebed('0x2')]['disabled']?!config[_0xebed('0x2')][_0xebed('0x3')]:!![];var isProduction=config[_0xebed('0x4')]===_0xebed('0x5')||![];var isLocalAsterisk=config[_0xebed('0x2')]&&config['xdr'][_0xebed('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0xebed('0x7')][_0xebed('0x8')],config[_0xebed('0x7')]['ip'],config[_0xebed('0x7')][_0xebed('0x9')],config[_0xebed('0x7')][_0xebed('0xa')],!![]);ami[_0xebed('0xb')]();if(!isXDREnabled){utils['info'](_0xebed('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require(_0xebed('0xd'));var recordings=require(_0xebed('0xe'));var members=require(_0xebed('0xf'));var dials=require(_0xebed('0x10'));var transfers=require(_0xebed('0x11'));var core=require(_0xebed('0x12'));ami['on'](_0xebed('0x13'),core[_0xebed('0x13')]);ami['on']('shutdown',core[_0xebed('0x14')]);ami['on']('fullybooted',core[_0xebed('0x15')]);ami['on']('error',core[_0xebed('0x16')]);ami['on']('close',core['close']);ami['on']('managerevent',core[_0xebed('0x17')]);ami['on'](_0xebed('0x18'),function(_0x3fce24){try{utils['debug'](util[_0xebed('0x19')]('[%s][index][devicestatechange]',_0x3fce24['device']),_0x3fce24);members['devicestatechange'](_0x3fce24);}catch(_0x407149){utils[_0xebed('0x16')](util[_0xebed('0x19')]('[%s][index][devicestatechange]',_0x3fce24['device']),_0x407149);}});ami['on'](_0xebed('0x1a'),function(_0x3af742){try{utils[_0xebed('0x1b')](util[_0xebed('0x19')](_0xebed('0x1c'),_0x3af742[_0xebed('0x1d')]),_0x3af742);agents[_0xebed('0x1a')](_0x3af742);}catch(_0x2f11e6){utils[_0xebed('0x16')](util[_0xebed('0x19')](_0xebed('0x1c'),_0x3af742[_0xebed('0x1d')]),_0x2f11e6);}});ami['on'](_0xebed('0x1e'),function(_0x2c7a12){try{utils[_0xebed('0x1b')](util[_0xebed('0x19')]('[%s][index][agentringnoanswer]',_0x2c7a12[_0xebed('0x1d')]),_0x2c7a12);agents[_0xebed('0x1e')](_0x2c7a12);}catch(_0x58722e){utils[_0xebed('0x16')](util[_0xebed('0x19')]('[%s][index][agentringnoanswer]',_0x2c7a12[_0xebed('0x1d')]),_0x58722e);}});ami['on'](_0xebed('0x1f'),function(_0x1ce05a){try{utils[_0xebed('0x1b')](util[_0xebed('0x19')](_0xebed('0x20'),_0x1ce05a[_0xebed('0x1d')]),_0x1ce05a);agents['agentconnect'](_0x1ce05a);queues['agentconnect'](_0x1ce05a);}catch(_0x408107){utils[_0xebed('0x16')](util[_0xebed('0x19')](_0xebed('0x20'),_0x1ce05a['uniqueid']),_0x408107);}});ami['on'](_0xebed('0x21'),function(_0x172bcb){try{utils[_0xebed('0x1b')](util[_0xebed('0x19')](_0xebed('0x22'),_0x172bcb[_0xebed('0x1d')]),_0x172bcb);agents[_0xebed('0x21')](_0x172bcb);queues['agentcomplete'](_0x172bcb);members[_0xebed('0x21')](_0x172bcb);}catch(_0x192ddb){utils[_0xebed('0x16')](util[_0xebed('0x19')]('[%s][index][agentcomplete]',_0x172bcb[_0xebed('0x1d')]),_0x192ddb);}});ami['on']('queuecallerabandon',function(_0x4dedf8){try{utils[_0xebed('0x1b')](util[_0xebed('0x19')]('[%s][index][queuecallerabandon]',_0x4dedf8[_0xebed('0x1d')]),_0x4dedf8);agents[_0xebed('0x23')](_0x4dedf8);queues['queuecallerabandon'](_0x4dedf8);}catch(_0x5b8c11){utils[_0xebed('0x16')](util[_0xebed('0x19')](_0xebed('0x24'),_0x4dedf8[_0xebed('0x1d')]),_0x5b8c11);}});ami['on'](_0xebed('0x25'),function(_0x3170f4){try{utils[_0xebed('0x1b')](util[_0xebed('0x19')]('[%s][index][queuecallerjoin]',_0x3170f4[_0xebed('0x1d')]),_0x3170f4);queues[_0xebed('0x25')](_0x3170f4);recordings[_0xebed('0x25')](_0x3170f4);}catch(_0x4d3b86){utils[_0xebed('0x16')](util[_0xebed('0x19')](_0xebed('0x26'),_0x3170f4[_0xebed('0x1d')]),_0x4d3b86);}});ami['on']('queuecallerleave',function(_0x42bf76){try{utils[_0xebed('0x1b')](util[_0xebed('0x19')](_0xebed('0x27'),_0x42bf76[_0xebed('0x1d')]),_0x42bf76);queues[_0xebed('0x28')](_0x42bf76);}catch(_0x522be8){utils['error'](util[_0xebed('0x19')](_0xebed('0x27'),_0x42bf76[_0xebed('0x1d')]),_0x522be8);}});ami['on'](_0xebed('0x29'),function(_0x918339){try{utils[_0xebed('0x1b')](util[_0xebed('0x19')]('[%s][index][musiconholdstart]',_0x918339[_0xebed('0x1d')]),_0x918339);queues[_0xebed('0x29')](_0x918339);calls[_0xebed('0x29')](_0x918339);}catch(_0xad3373){utils[_0xebed('0x16')](util[_0xebed('0x19')]('[%s][index][musiconholdstart]',_0x918339[_0xebed('0x1d')]),_0xad3373);}});ami['on'](_0xebed('0x2a'),function(_0x4d0742){try{utils[_0xebed('0x1b')](util[_0xebed('0x19')](_0xebed('0x2b'),_0x4d0742['uniqueid']),_0x4d0742);queues['musiconholdstop'](_0x4d0742);calls[_0xebed('0x2a')](_0x4d0742);}catch(_0x3fb60b){utils[_0xebed('0x16')](util['format']('[%s][index][musiconholdstop]',_0x4d0742[_0xebed('0x1d')]),_0x3fb60b);}});ami['on'](_0xebed('0x2c'),function(_0x2d2b4d){try{utils[_0xebed('0x1b')](util[_0xebed('0x19')](_0xebed('0x2d'),_0x2d2b4d[_0xebed('0x1d')]),_0x2d2b4d);calls[_0xebed('0x2c')](_0x2d2b4d);recordings[_0xebed('0x2c')](_0x2d2b4d);}catch(_0x4050e2){utils[_0xebed('0x16')](util[_0xebed('0x19')](_0xebed('0x2d'),_0x2d2b4d[_0xebed('0x1d')]),_0x4050e2);}});ami['on'](_0xebed('0x2e'),function(_0x163e12){try{utils[_0xebed('0x1b')](util[_0xebed('0x19')]('[%s][index][hangup]',_0x163e12['uniqueid']),_0x163e12);calls[_0xebed('0x2e')](_0x163e12);recordings[_0xebed('0x2e')](_0x163e12);dials[_0xebed('0x2e')](_0x163e12);agents['hangup'](_0x163e12);queues[_0xebed('0x2e')](_0x163e12);}catch(_0x60a7f1){utils['error'](util['format'](_0xebed('0x2f'),_0x163e12[_0xebed('0x1d')]),_0x60a7f1);}});ami['on'](_0xebed('0x30'),function(_0x93f3d){try{utils[_0xebed('0x1b')](util[_0xebed('0x19')](_0xebed('0x31'),_0x93f3d['uniqueid']),_0x93f3d);members['cdr'](_0x93f3d);}catch(_0x510ca){utils[_0xebed('0x16')](util[_0xebed('0x19')](_0xebed('0x31'),_0x93f3d['uniqueid']),_0x510ca);}});ami['on'](_0xebed('0x32'),function(_0x56d0fe){try{utils[_0xebed('0x1b')](util[_0xebed('0x19')](_0xebed('0x33'),_0x56d0fe['uniqueid']),_0x56d0fe);queues[_0xebed('0x32')](_0x56d0fe);agents[_0xebed('0x32')](_0x56d0fe);transfers[_0xebed('0x32')](_0x56d0fe);recordings['blindtransfer'](_0x56d0fe);}catch(_0x43c89b){utils[_0xebed('0x16')](util['format'](_0xebed('0x33'),_0x56d0fe['uniqueid']),_0x43c89b);}});ami['on']('attendedtransfer',function(_0x597d90){try{utils['debug'](util[_0xebed('0x19')](_0xebed('0x34'),_0x597d90[_0xebed('0x35')]),_0x597d90);queues[_0xebed('0x36')](_0x597d90);transfers['attendedtransfer'](_0x597d90);agents[_0xebed('0x36')](_0x597d90);calls[_0xebed('0x36')](_0x597d90);}catch(_0x360ab0){utils[_0xebed('0x16')](util[_0xebed('0x19')]('[%s][index][attendedtransfer]',_0x597d90[_0xebed('0x35')]),_0x360ab0);}});ami['on'](_0xebed('0x37'),function(_0x56f081){try{utils[_0xebed('0x1b')](util[_0xebed('0x19')](_0xebed('0x38'),_0x56f081[_0xebed('0x1d')]),_0x56f081);queues[_0xebed('0x37')](_0x56f081);recordings[_0xebed('0x37')](_0x56f081);calls[_0xebed('0x37')](_0x56f081);dials[_0xebed('0x37')](_0x56f081);}catch(_0x2bd72e){utils[_0xebed('0x16')](util[_0xebed('0x19')](_0xebed('0x38'),_0x56f081[_0xebed('0x1d')]),_0x2bd72e);}});ami['on']('newexten',function(_0x28f03e){try{utils['debug'](util['format'](_0xebed('0x39'),_0x28f03e[_0xebed('0x1d')]),_0x28f03e);calls[_0xebed('0x3a')](_0x28f03e);recordings[_0xebed('0x3a')](_0x28f03e);dials[_0xebed('0x3a')](_0x28f03e);}catch(_0x586ea7){utils['error'](util[_0xebed('0x19')](_0xebed('0x39'),_0x28f03e['uniqueid']),_0x586ea7);}});ami['on']('newchannel',function(_0x225ae6){try{utils[_0xebed('0x1b')](util[_0xebed('0x19')]('[%s][index][newchannel]',_0x225ae6[_0xebed('0x1d')]),_0x225ae6);calls[_0xebed('0x3b')](_0x225ae6);recordings[_0xebed('0x3b')](_0x225ae6);}catch(_0x5bb952){utils['error'](util[_0xebed('0x19')]('[%s][index][newchannel]',_0x225ae6[_0xebed('0x1d')]),_0x5bb952);}});ami['on'](_0xebed('0x3c'),function(_0x9ad318){try{utils['debug'](util[_0xebed('0x19')](_0xebed('0x3d'),_0x9ad318[_0xebed('0x1d')]),_0x9ad318);dials[_0xebed('0x3c')](_0x9ad318);}catch(_0x495718){utils[_0xebed('0x16')](util['format'](_0xebed('0x3e'),_0x9ad318[_0xebed('0x1d')]),_0x495718);}});ami['on'](_0xebed('0x3f'),function(_0x16fa92){try{utils[_0xebed('0x1b')](util[_0xebed('0x19')](_0xebed('0x40'),_0x16fa92[_0xebed('0x1d')]),_0x16fa92);dials['dialend'](_0x16fa92);}catch(_0x29dce0){utils[_0xebed('0x16')](util[_0xebed('0x19')]('[%s][index][dialend]',_0x16fa92[_0xebed('0x1d')]),_0x29dce0);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 4012046..7f05149 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 _0xc772=['uniqueid','channel','data2','membername','type','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','split','catch','error','format','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','lodash','util','./utils','Local/_attended@transfer','Queue:','info'];(function(_0x145c84,_0x1c0235){var _0x2ea15a=function(_0x3a9da5){while(--_0x3a9da5){_0x145c84['push'](_0x145c84['shift']());}};_0x2ea15a(++_0x1c0235);}(_0xc772,0x108));var _0x2c77=function(_0x517317,_0x105d58){_0x517317=_0x517317-0x0;var _0x1818b9=_0xc772[_0x517317];return _0x1818b9;};'use strict';var _=require(_0x2c77('0x0'));var util=require(_0x2c77('0x1'));var utils=require(_0x2c77('0x2'));var members={};var exclude=[_0x2c77('0x3'),_0x2c77('0x4')];function writeDB(_0x23a35c){utils[_0x2c77('0x5')](util['format']('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x23a35c[_0x2c77('0x6')],_0x23a35c['interface'],_0x23a35c[_0x2c77('0x7')],_0x23a35c[_0x2c77('0x8')],_0x23a35c[_0x2c77('0x9')],_0x23a35c[_0x2c77('0xa')]));if(_0x23a35c[_0x2c77('0xb')]){utils[_0x2c77('0xc')](_0x23a35c[_0x2c77('0xb')])[_0x2c77('0xd')](function(_0x3e99fa){if(_0x3e99fa){_0x23a35c['membername']=_0x3e99fa[_0x2c77('0xe')];_0x23a35c[_0x2c77('0xf')]=_0x3e99fa[_0x2c77('0xf')];utils[_0x2c77('0x10')](_0x2c77('0x11'),_0x23a35c);}else{utils['getUserByName'](_0x23a35c[_0x2c77('0xb')][_0x2c77('0x12')]('/')[0x1])[_0x2c77('0xd')](function(_0x138074){if(_0x138074){_0x23a35c[_0x2c77('0x9')]=_0x138074[_0x2c77('0xe')];_0x23a35c[_0x2c77('0xf')]=_0x138074[_0x2c77('0xf')];utils[_0x2c77('0x10')](_0x2c77('0x11'),_0x23a35c);}});}})[_0x2c77('0x13')](function(_0x32ae7a){utils[_0x2c77('0x14')](util[_0x2c77('0x15')](_0x2c77('0x16'),_0x23a35c['uniqueid']),_0x32ae7a);});}delete members[_0x23a35c[_0x2c77('0xb')]];}function startsWith(_0xd25fa8,_0x1b4043){return _[_0x2c77('0x17')](_0xd25fa8,function(_0x4a3351){return _[_0x2c77('0x18')](_0x1b4043,_0x4a3351);});}exports['devicestatechange']=function(_0x21eb7d){try{utils[_0x2c77('0x19')](util[_0x2c77('0x15')](_0x2c77('0x1a'),members[_0x21eb7d[_0x2c77('0x1b')]]?members[_0x21eb7d[_0x2c77('0x1b')]][_0x2c77('0x6')]:_0x21eb7d[_0x2c77('0x1b')]),_0x21eb7d);utils['info'](util[_0x2c77('0x15')](_0x2c77('0x1c'),members[_0x21eb7d['device']]?members[_0x21eb7d[_0x2c77('0x1b')]][_0x2c77('0x6')]:_0x21eb7d[_0x2c77('0x1b')],_0x21eb7d[_0x2c77('0x1d')],_0x21eb7d['device']));switch(_0x21eb7d['state']){case _0x2c77('0x1e'):case _0x2c77('0x1f'):if(!startsWith(exclude,_0x21eb7d[_0x2c77('0x1b')])){members[_0x21eb7d[_0x2c77('0x1b')]]={'channel':_0x2c77('0x20'),'interface':_0x21eb7d[_0x2c77('0x1b')],'type':_0x2c77('0x21'),'enterAt':utils[_0x2c77('0x22')](),'role':_0x2c77('0x23')};}break;case _0x2c77('0x24'):if(!_[_0x2c77('0x25')](members[_0x21eb7d[_0x2c77('0x1b')]])){members[_0x21eb7d[_0x2c77('0x1b')]][_0x2c77('0x26')]=utils[_0x2c77('0x22')]();members[_0x21eb7d[_0x2c77('0x1b')]]['duration']=utils[_0x2c77('0x27')](members[_0x21eb7d['device']][_0x2c77('0x26')],members[_0x21eb7d['device']][_0x2c77('0x28')]);if(members[_0x21eb7d[_0x2c77('0x1b')]][_0x2c77('0x6')]){writeDB(members[_0x21eb7d[_0x2c77('0x1b')]]);}}break;default:break;}}catch(_0x2a36cd){utils[_0x2c77('0x14')](util[_0x2c77('0x15')]('[%s][members][devicestatechange]',members[_0x21eb7d[_0x2c77('0x1b')]]?members[_0x21eb7d['device']][_0x2c77('0x6')]:_0x21eb7d[_0x2c77('0x1b')]),_0x2a36cd);}};exports[_0x2c77('0x29')]=function(_0x5e2a2b){try{if(!_[_0x2c77('0x25')](members[_0x5e2a2b[_0x2c77('0xb')]])){utils[_0x2c77('0x19')](util[_0x2c77('0x15')](_0x2c77('0x2a'),_0x5e2a2b[_0x2c77('0x6')]),_0x5e2a2b);utils[_0x2c77('0x5')](util['format'](_0x2c77('0x2b'),_0x5e2a2b['uniqueid'],_0x5e2a2b[_0x2c77('0xb')],_0x5e2a2b['queue']));members[_0x5e2a2b['interface']]=_[_0x2c77('0x2c')](members[_0x5e2a2b[_0x2c77('0xb')]],{'data4':_0x5e2a2b[_0x2c77('0x2d')],'uniqueid':_0x5e2a2b[_0x2c77('0x6')]});}}catch(_0x3b4b90){utils[_0x2c77('0x14')](util[_0x2c77('0x15')](_0x2c77('0x2a'),_0x5e2a2b['uniqueid']),_0x3b4b90);}};exports[_0x2c77('0x2e')]=function(_0x23e417){try{utils[_0x2c77('0x19')](util[_0x2c77('0x15')](_0x2c77('0x2f'),_0x23e417[_0x2c77('0x6')]),_0x23e417);if(_0x23e417['channel']){var _0x16cb2a=_0x23e417[_0x2c77('0x7')]['split']('-')[0x0];if(!_['isNil'](members[_0x16cb2a])){members[_0x16cb2a]=_[_0x2c77('0x2c')](members[_0x16cb2a],{'data1':members[_0x16cb2a][_0x2c77('0x30')]||_0x23e417[_0x2c77('0xa')],'data2':members[_0x16cb2a]['data2']||_0x23e417['source'],'data3':members[_0x16cb2a][_0x2c77('0x31')]||_0x23e417[_0x2c77('0x32')],'uniqueid':members[_0x16cb2a]['uniqueid']||_0x23e417[_0x2c77('0x6')]});utils['info'](util[_0x2c77('0x15')](_0x2c77('0x33'),_0x23e417[_0x2c77('0x6')],members[_0x16cb2a]['data1'],members[_0x16cb2a][_0x2c77('0x8')],members[_0x16cb2a]['data3']));if(members[_0x16cb2a]['exitAt']){writeDB(members[_0x16cb2a]);}}}if(_0x23e417[_0x2c77('0x34')]){var _0x22ee58=_0x23e417[_0x2c77('0x34')][_0x2c77('0x12')]('-')[0x0];if(!_[_0x2c77('0x25')](members[_0x22ee58])){members[_0x22ee58]=_[_0x2c77('0x2c')](members[_0x22ee58],{'data1':members[_0x22ee58][_0x2c77('0x30')]||_0x23e417[_0x2c77('0xa')],'data2':members[_0x22ee58]['data2']||_0x23e417[_0x2c77('0x35')],'data3':members[_0x22ee58][_0x2c77('0x31')]||_0x23e417[_0x2c77('0x32')],'uniqueid':members[_0x22ee58]['uniqueid']||_0x23e417[_0x2c77('0x6')]});utils[_0x2c77('0x5')](util[_0x2c77('0x15')](_0x2c77('0x33'),_0x23e417['uniqueid'],members[_0x22ee58][_0x2c77('0x30')],members[_0x22ee58][_0x2c77('0x8')],members[_0x22ee58][_0x2c77('0x31')]));if(members[_0x22ee58][_0x2c77('0x26')]){writeDB(members[_0x22ee58]);}}}}catch(_0x3c2878){utils[_0x2c77('0x14')](util[_0x2c77('0x15')](_0x2c77('0x2f'),_0x23e417['uniqueid']),_0x3c2878);}}; \ No newline at end of file +var _0x13c6=['format','uniqueid','interface','data2','type','getUserByInterface','then','membername','name','internal','request','CreateMemberReport','getUserByName','catch','error','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','BUSY','voice','TALKING','agent','exitAt','now','duration','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','channel','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','lodash','util','./utils','Local/_attended@transfer','Queue:'];(function(_0x44302b,_0x8c1468){var _0x395cf3=function(_0x22f060){while(--_0x22f060){_0x44302b['push'](_0x44302b['shift']());}};_0x395cf3(++_0x8c1468);}(_0x13c6,0x94));var _0x613c=function(_0x3063ca,_0x2cf770){_0x3063ca=_0x3063ca-0x0;var _0x1cad2c=_0x13c6[_0x3063ca];return _0x1cad2c;};'use strict';var _=require(_0x613c('0x0'));var util=require(_0x613c('0x1'));var utils=require(_0x613c('0x2'));var members={};var exclude=[_0x613c('0x3'),_0x613c('0x4')];function writeDB(_0x54a2aa){utils['info'](util[_0x613c('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x54a2aa[_0x613c('0x6')],_0x54a2aa[_0x613c('0x7')],_0x54a2aa['channel'],_0x54a2aa[_0x613c('0x8')],_0x54a2aa['membername'],_0x54a2aa[_0x613c('0x9')]));if(_0x54a2aa[_0x613c('0x7')]){utils[_0x613c('0xa')](_0x54a2aa[_0x613c('0x7')])[_0x613c('0xb')](function(_0x3ecb70){if(_0x3ecb70){_0x54a2aa[_0x613c('0xc')]=_0x3ecb70[_0x613c('0xd')];_0x54a2aa[_0x613c('0xe')]=_0x3ecb70[_0x613c('0xe')];utils[_0x613c('0xf')](_0x613c('0x10'),_0x54a2aa);}else{utils[_0x613c('0x11')](_0x54a2aa['interface']['split']('/')[0x1])['then'](function(_0x1d9535){if(_0x1d9535){_0x54a2aa[_0x613c('0xc')]=_0x1d9535['name'];_0x54a2aa['internal']=_0x1d9535[_0x613c('0xe')];utils['request'](_0x613c('0x10'),_0x54a2aa);}});}})[_0x613c('0x12')](function(_0x4143e7){utils[_0x613c('0x13')](util[_0x613c('0x5')](_0x613c('0x14'),_0x54a2aa[_0x613c('0x6')]),_0x4143e7);});}delete members[_0x54a2aa[_0x613c('0x7')]];}function startsWith(_0x4e1f8b,_0x238d98){return _[_0x613c('0x15')](_0x4e1f8b,function(_0x41eb2e){return _[_0x613c('0x16')](_0x238d98,_0x41eb2e);});}exports['devicestatechange']=function(_0x23e600){try{utils[_0x613c('0x17')](util[_0x613c('0x5')](_0x613c('0x18'),members[_0x23e600['device']]?members[_0x23e600[_0x613c('0x19')]][_0x613c('0x6')]:_0x23e600[_0x613c('0x19')]),_0x23e600);utils[_0x613c('0x1a')](util[_0x613c('0x5')](_0x613c('0x1b'),members[_0x23e600[_0x613c('0x19')]]?members[_0x23e600[_0x613c('0x19')]][_0x613c('0x6')]:_0x23e600[_0x613c('0x19')],_0x23e600['state'],_0x23e600[_0x613c('0x19')]));switch(_0x23e600['state']){case'INUSE':case _0x613c('0x1c'):if(!startsWith(exclude,_0x23e600[_0x613c('0x19')])){members[_0x23e600[_0x613c('0x19')]]={'channel':_0x613c('0x1d'),'interface':_0x23e600['device'],'type':_0x613c('0x1e'),'enterAt':utils['now'](),'role':_0x613c('0x1f')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x23e600[_0x613c('0x19')]])){members[_0x23e600[_0x613c('0x19')]][_0x613c('0x20')]=utils[_0x613c('0x21')]();members[_0x23e600[_0x613c('0x19')]][_0x613c('0x22')]=utils['diffTime'](members[_0x23e600[_0x613c('0x19')]][_0x613c('0x20')],members[_0x23e600[_0x613c('0x19')]][_0x613c('0x23')]);if(members[_0x23e600['device']][_0x613c('0x6')]){writeDB(members[_0x23e600['device']]);}}break;default:break;}}catch(_0x1de9b0){utils[_0x613c('0x13')](util[_0x613c('0x5')](_0x613c('0x18'),members[_0x23e600[_0x613c('0x19')]]?members[_0x23e600[_0x613c('0x19')]][_0x613c('0x6')]:_0x23e600[_0x613c('0x19')]),_0x1de9b0);}};exports[_0x613c('0x24')]=function(_0x1e1155){try{if(!_[_0x613c('0x25')](members[_0x1e1155[_0x613c('0x7')]])){utils[_0x613c('0x17')](util[_0x613c('0x5')](_0x613c('0x26'),_0x1e1155[_0x613c('0x6')]),_0x1e1155);utils[_0x613c('0x1a')](util['format'](_0x613c('0x27'),_0x1e1155[_0x613c('0x6')],_0x1e1155[_0x613c('0x7')],_0x1e1155[_0x613c('0x28')]));members[_0x1e1155[_0x613c('0x7')]]=_[_0x613c('0x29')](members[_0x1e1155[_0x613c('0x7')]],{'data4':_0x1e1155['queue'],'uniqueid':_0x1e1155[_0x613c('0x6')]});}}catch(_0x253823){utils[_0x613c('0x13')](util[_0x613c('0x5')](_0x613c('0x26'),_0x1e1155['uniqueid']),_0x253823);}};exports[_0x613c('0x2a')]=function(_0xd193d7){try{utils[_0x613c('0x17')](util[_0x613c('0x5')](_0x613c('0x2b'),_0xd193d7['uniqueid']),_0xd193d7);if(_0xd193d7[_0x613c('0x2c')]){var _0x4a6eb5=_0xd193d7[_0x613c('0x2c')]['split']('-')[0x0];if(!_[_0x613c('0x25')](members[_0x4a6eb5])){members[_0x4a6eb5]=_[_0x613c('0x29')](members[_0x4a6eb5],{'data1':members[_0x4a6eb5][_0x613c('0x2d')]||_0xd193d7[_0x613c('0x9')],'data2':members[_0x4a6eb5][_0x613c('0x8')]||_0xd193d7['source'],'data3':members[_0x4a6eb5][_0x613c('0x2e')]||_0xd193d7[_0x613c('0x2f')],'uniqueid':members[_0x4a6eb5][_0x613c('0x6')]||_0xd193d7[_0x613c('0x6')]});utils[_0x613c('0x1a')](util['format'](_0x613c('0x30'),_0xd193d7[_0x613c('0x6')],members[_0x4a6eb5][_0x613c('0x2d')],members[_0x4a6eb5]['data2'],members[_0x4a6eb5]['data3']));if(members[_0x4a6eb5][_0x613c('0x20')]){writeDB(members[_0x4a6eb5]);}}}if(_0xd193d7[_0x613c('0x31')]){var _0x4ea96b=_0xd193d7[_0x613c('0x31')]['split']('-')[0x0];if(!_[_0x613c('0x25')](members[_0x4ea96b])){members[_0x4ea96b]=_['assign'](members[_0x4ea96b],{'data1':members[_0x4ea96b][_0x613c('0x2d')]||_0xd193d7[_0x613c('0x9')],'data2':members[_0x4ea96b]['data2']||_0xd193d7[_0x613c('0x32')],'data3':members[_0x4ea96b][_0x613c('0x2e')]||_0xd193d7['destination'],'uniqueid':members[_0x4ea96b][_0x613c('0x6')]||_0xd193d7[_0x613c('0x6')]});utils[_0x613c('0x1a')](util[_0x613c('0x5')](_0x613c('0x30'),_0xd193d7[_0x613c('0x6')],members[_0x4ea96b]['data1'],members[_0x4ea96b]['data2'],members[_0x4ea96b]['data3']));if(members[_0x4ea96b][_0x613c('0x20')]){writeDB(members[_0x4ea96b]);}}}}catch(_0x4ddd03){utils[_0x613c('0x13')](util[_0x613c('0x5')](_0x613c('0x2b'),_0xd193d7[_0x613c('0x6')]),_0x4ddd03);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 866baea..100f7cb 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 _0xe6d2=['connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentcomplete]','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][blindtransfer]','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%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','origtransfererexten','transfertype','ATTENDED','transfereelinkedid','queuecallerenterreason','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertargetlinkedid','transfertargetuniqueid','clone','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','variable','queuestatus','toUpperCase','CONTINUE','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','value','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerabandonAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe6d2,0x171));var _0x2e6d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe6d2[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x2e6d('0x0'));var utils=require(_0x2e6d('0x1'));var queues={};function writeDB(_0x2ff3cf){utils[_0x2e6d('0x2')](util['format'](_0x2e6d('0x3'),_0x2ff3cf[_0x2e6d('0x4')],_0x2ff3cf[_0x2e6d('0x5')],_0x2ff3cf['queue'],_0x2ff3cf[_0x2e6d('0x6')],_0x2ff3cf[_0x2e6d('0x7')],_0x2ff3cf[_0x2e6d('0x8')],_0x2ff3cf[_0x2e6d('0x9')]));if(_0x2ff3cf[_0x2e6d('0xa')]){utils[_0x2e6d('0xb')](_0x2ff3cf['queue'])[_0x2e6d('0xc')](function(_0x2b0672){if(_0x2b0672){_0x2ff3cf['type']=_0x2b0672[_0x2e6d('0xd')];}utils[_0x2e6d('0xe')](_0x2e6d('0xf'),_0x2ff3cf);});}else{utils[_0x2e6d('0xe')](_0x2e6d('0xf'),_0x2ff3cf);}if(_0x2ff3cf[_0x2e6d('0x10')]){delete queues[_0x2ff3cf[_0x2e6d('0x10')]];}else{delete queues[_0x2ff3cf['uniqueid']];}}exports[_0x2e6d('0x11')]=function(_0x1af769){try{utils[_0x2e6d('0x12')](util['format'](_0x2e6d('0x13'),_0x1af769[_0x2e6d('0x4')]),_0x1af769);utils[_0x2e6d('0x2')](util[_0x2e6d('0x14')](_0x2e6d('0x15'),_0x1af769[_0x2e6d('0x4')],_0x1af769[_0x2e6d('0xa')],_0x1af769[_0x2e6d('0x16')]));queues[_0x1af769[_0x2e6d('0x4')]]=_[_0x2e6d('0x17')](_0x1af769,{'originalposition':_0x1af769[_0x2e6d('0x16')],'queuecallerjoinAt':utils[_0x2e6d('0x18')](),'mohtime':0x0});}catch(_0x2d56ae){utils[_0x2e6d('0x19')](util[_0x2e6d('0x14')](_0x2e6d('0x13'),_0x1af769[_0x2e6d('0x4')]),_0x2d56ae);}};exports[_0x2e6d('0x1a')]=function(_0x40263b){try{if(!_[_0x2e6d('0x1b')](queues[_0x40263b[_0x2e6d('0x4')]])){utils[_0x2e6d('0x12')](util['format'](_0x2e6d('0x1c'),_0x40263b[_0x2e6d('0x4')]),_0x40263b);if(queues[_0x40263b[_0x2e6d('0x4')]][_0x2e6d('0x1d')]){if(!queues[_0x40263b[_0x2e6d('0x4')]][_0x2e6d('0x1e')]&&!queues[_0x40263b[_0x2e6d('0x4')]][_0x2e6d('0x1f')]){queues[_0x40263b[_0x2e6d('0x4')]]['queuecallercomplete']=!![];queues[_0x40263b[_0x2e6d('0x4')]][_0x2e6d('0x20')]=utils['now']();queues[_0x40263b[_0x2e6d('0x4')]][_0x2e6d('0x9')]='COMPLETEDBYAGENT';}utils['info'](util[_0x2e6d('0x14')](_0x2e6d('0x21'),_0x40263b['uniqueid'],queues[_0x40263b[_0x2e6d('0x4')]][_0x2e6d('0x22')],queues[_0x40263b[_0x2e6d('0x4')]][_0x2e6d('0x9')]));writeDB(queues[_0x40263b[_0x2e6d('0x4')]]);}else if(queues[_0x40263b[_0x2e6d('0x4')]][_0x2e6d('0x10')]){utils[_0x2e6d('0x2')](util[_0x2e6d('0x14')](_0x2e6d('0x23'),_0x40263b[_0x2e6d('0x4')],queues[_0x40263b[_0x2e6d('0x4')]][_0x2e6d('0x22')],queues[_0x40263b['uniqueid']][_0x2e6d('0x10')]));queues[queues[_0x40263b[_0x2e6d('0x4')]][_0x2e6d('0x10')]]=queues[_0x40263b[_0x2e6d('0x4')]];queues[queues[_0x40263b[_0x2e6d('0x4')]][_0x2e6d('0x10')]]['queuecallerenterreason']=0x2;delete queues[_0x40263b[_0x2e6d('0x4')]];}}}catch(_0x723990){utils['error'](util[_0x2e6d('0x14')](_0x2e6d('0x1c'),_0x40263b[_0x2e6d('0x4')]),_0x723990);}};exports[_0x2e6d('0x24')]=function(_0x31a9f9){try{utils[_0x2e6d('0x12')](util['format'](_0x2e6d('0x25'),_0x31a9f9[_0x2e6d('0x4')]),_0x31a9f9);if(!_[_0x2e6d('0x1b')](_0x31a9f9[_0x2e6d('0x26')][_0x2e6d('0x27')])&&_0x31a9f9['value'][_0x2e6d('0x28')]()!==_0x2e6d('0x29')){if(!_[_0x2e6d('0x1b')](queues[_0x31a9f9[_0x2e6d('0x4')]])){queues[_0x31a9f9[_0x2e6d('0x4')]][_0x2e6d('0x1e')]=![];queues[_0x31a9f9[_0x2e6d('0x4')]]['queuecallerabandonAt']=null;queues[_0x31a9f9[_0x2e6d('0x4')]][_0x2e6d('0x1f')]=!![];queues[_0x31a9f9[_0x2e6d('0x4')]][_0x2e6d('0x2a')]=utils[_0x2e6d('0x18')]();queues[_0x31a9f9[_0x2e6d('0x4')]][_0x2e6d('0x9')]=_0x31a9f9['value']['toUpperCase']();utils['info'](util['format'](_0x2e6d('0x2b'),_0x31a9f9[_0x2e6d('0x4')],queues[_0x31a9f9[_0x2e6d('0x4')]][_0x2e6d('0x22')],_0x31a9f9[_0x2e6d('0x2c')],queues[_0x31a9f9[_0x2e6d('0x4')]][_0x2e6d('0x9')]));writeDB(queues[_0x31a9f9[_0x2e6d('0x4')]]);}}else if(!_[_0x2e6d('0x1b')](_0x31a9f9['variable'][_0x2e6d('0x2d')])){if(!_[_0x2e6d('0x1b')](queues[_0x31a9f9[_0x2e6d('0x4')]])&&!queues[_0x31a9f9[_0x2e6d('0x4')]][_0x2e6d('0x1e')]){queues[_0x31a9f9[_0x2e6d('0x4')]][_0x2e6d('0x1e')]=![];queues[_0x31a9f9['uniqueid']]['queuecallerabandonAt']=null;queues[_0x31a9f9[_0x2e6d('0x4')]][_0x2e6d('0x1f')]=!![];queues[_0x31a9f9[_0x2e6d('0x4')]]['queuecallerexitAt']=utils[_0x2e6d('0x18')]();queues[_0x31a9f9[_0x2e6d('0x4')]][_0x2e6d('0x9')]='EXITWITHKEY';utils[_0x2e6d('0x2')](util[_0x2e6d('0x14')](_0x2e6d('0x2e'),_0x31a9f9[_0x2e6d('0x4')],queues[_0x31a9f9[_0x2e6d('0x4')]][_0x2e6d('0x22')],_0x31a9f9[_0x2e6d('0x2c')],queues[_0x31a9f9[_0x2e6d('0x4')]]['queuecallerexitreason']));}}}catch(_0x9bf27e){utils['error'](util[_0x2e6d('0x14')](_0x2e6d('0x25'),_0x31a9f9[_0x2e6d('0x4')]),_0x9bf27e);}};exports[_0x2e6d('0x1e')]=function(_0x47dd8a){try{if(!_[_0x2e6d('0x1b')](queues[_0x47dd8a[_0x2e6d('0x4')]])){utils[_0x2e6d('0x12')](util[_0x2e6d('0x14')](_0x2e6d('0x2f'),_0x47dd8a['uniqueid']),_0x47dd8a);queues[_0x47dd8a[_0x2e6d('0x4')]][_0x2e6d('0x1f')]=![];queues[_0x47dd8a[_0x2e6d('0x4')]][_0x2e6d('0x2a')]=null;queues[_0x47dd8a['uniqueid']][_0x2e6d('0x1e')]=!![];queues[_0x47dd8a[_0x2e6d('0x4')]][_0x2e6d('0x30')]=utils[_0x2e6d('0x18')]();queues[_0x47dd8a[_0x2e6d('0x4')]]['queuecallerexitreason']=_0x2e6d('0x31');utils['info'](util['format'](_0x2e6d('0x32'),_0x47dd8a['uniqueid'],queues[_0x47dd8a[_0x2e6d('0x4')]]['name'],queues[_0x47dd8a[_0x2e6d('0x4')]][_0x2e6d('0x9')]));}}catch(_0x36dc13){utils['error'](util[_0x2e6d('0x14')](_0x2e6d('0x2f'),_0x47dd8a[_0x2e6d('0x4')]),_0x36dc13);}};exports[_0x2e6d('0x33')]=function(_0x9fe04e){try{if(!_[_0x2e6d('0x1b')](queues[_0x9fe04e[_0x2e6d('0x4')]])){utils[_0x2e6d('0x12')](util['format'](_0x2e6d('0x34'),_0x9fe04e['uniqueid']),_0x9fe04e);utils[_0x2e6d('0x2')](util[_0x2e6d('0x14')](_0x2e6d('0x35'),_0x9fe04e[_0x2e6d('0x4')],queues[_0x9fe04e[_0x2e6d('0x4')]][_0x2e6d('0x22')],_0x9fe04e['connectedlinenum'],_0x9fe04e[_0x2e6d('0x36')]));queues[_0x9fe04e[_0x2e6d('0x4')]][_0x2e6d('0x33')]=!![];queues[_0x9fe04e[_0x2e6d('0x4')]][_0x2e6d('0x1d')]=utils['now']();queues[_0x9fe04e['uniqueid']][_0x2e6d('0x37')]=utils[_0x2e6d('0x38')](queues[_0x9fe04e[_0x2e6d('0x4')]][_0x2e6d('0x1d')],queues[_0x9fe04e['uniqueid']][_0x2e6d('0x39')]);queues[_0x9fe04e[_0x2e6d('0x4')]]['position']=_0x9fe04e[_0x2e6d('0x16')];queues[_0x9fe04e['uniqueid']][_0x2e6d('0x3a')]=_0x9fe04e['count'];queues[_0x9fe04e['uniqueid']][_0x2e6d('0x3b')]=_0x9fe04e[_0x2e6d('0x3b')];queues[_0x9fe04e[_0x2e6d('0x4')]][_0x2e6d('0x36')]=_0x9fe04e['connectedlinename'];}}catch(_0x5ef172){utils['error'](util[_0x2e6d('0x14')](_0x2e6d('0x34'),_0x9fe04e[_0x2e6d('0x4')]),_0x5ef172);}};exports[_0x2e6d('0x3c')]=function(_0x18b0d1){try{if(!_[_0x2e6d('0x1b')](queues[_0x18b0d1[_0x2e6d('0x4')]])){utils[_0x2e6d('0x12')](util['format'](_0x2e6d('0x3d'),_0x18b0d1[_0x2e6d('0x4')]),_0x18b0d1);utils[_0x2e6d('0x2')](util[_0x2e6d('0x14')](_0x2e6d('0x3e'),_0x18b0d1[_0x2e6d('0x4')],queues[_0x18b0d1[_0x2e6d('0x4')]]['name'],_0x18b0d1[_0x2e6d('0x3f')],_0x18b0d1[_0x2e6d('0x40')]));queues[_0x18b0d1[_0x2e6d('0x4')]][_0x2e6d('0x1e')]=![];queues[_0x18b0d1[_0x2e6d('0x4')]][_0x2e6d('0x1e')]=![];queues[_0x18b0d1[_0x2e6d('0x4')]][_0x2e6d('0x30')]=null;queues[_0x18b0d1[_0x2e6d('0x4')]][_0x2e6d('0x1f')]=![];queues[_0x18b0d1['uniqueid']][_0x2e6d('0x9')]=null;queues[_0x18b0d1['uniqueid']][_0x2e6d('0x2a')]=null;queues[_0x18b0d1['uniqueid']][_0x2e6d('0x41')]=!![];queues[_0x18b0d1[_0x2e6d('0x4')]][_0x2e6d('0x8')]=_0x18b0d1[_0x2e6d('0x40')];queues[_0x18b0d1[_0x2e6d('0x4')]][_0x2e6d('0x6')]=_0x18b0d1['membername'];}}catch(_0x116a20){utils[_0x2e6d('0x19')](util[_0x2e6d('0x14')]('[%s][queues][agentconnect]',_0x18b0d1[_0x2e6d('0x4')]),_0x116a20);}};exports['agentcomplete']=function(_0x5ef45d){try{if(!_[_0x2e6d('0x1b')](queues[_0x5ef45d[_0x2e6d('0x4')]])){if(queues[_0x5ef45d[_0x2e6d('0x4')]][_0x2e6d('0x1d')]){utils[_0x2e6d('0x12')](util[_0x2e6d('0x14')](_0x2e6d('0x42'),_0x5ef45d[_0x2e6d('0x4')]),_0x5ef45d);queues[_0x5ef45d[_0x2e6d('0x4')]][_0x2e6d('0x1e')]=![];queues[_0x5ef45d[_0x2e6d('0x4')]][_0x2e6d('0x1e')]=![];queues[_0x5ef45d[_0x2e6d('0x4')]][_0x2e6d('0x30')]=null;queues[_0x5ef45d[_0x2e6d('0x4')]]['queuecallerexit']=![];queues[_0x5ef45d[_0x2e6d('0x4')]]['queuecallerexitAt']=null;queues[_0x5ef45d['uniqueid']][_0x2e6d('0x41')]=!![];queues[_0x5ef45d[_0x2e6d('0x4')]][_0x2e6d('0x6')]=_0x5ef45d[_0x2e6d('0x3f')];queues[_0x5ef45d[_0x2e6d('0x4')]]['queuecallercomplete']=!![];queues[_0x5ef45d[_0x2e6d('0x4')]][_0x2e6d('0x20')]=utils['now']();if(_0x5ef45d['reason']==_0x2e6d('0x43')){if(!queues[_0x5ef45d[_0x2e6d('0x4')]]['transfer']){queues[_0x5ef45d[_0x2e6d('0x4')]][_0x2e6d('0x9')]=_0x2e6d('0x44');}}else{queues[_0x5ef45d['uniqueid']][_0x2e6d('0x9')]=_0x2e6d('0x45')+_0x5ef45d[_0x2e6d('0x46')][_0x2e6d('0x28')]();}utils[_0x2e6d('0x2')](util[_0x2e6d('0x14')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x5ef45d[_0x2e6d('0x4')],queues[_0x5ef45d['uniqueid']][_0x2e6d('0x22')],_0x5ef45d['membername'],queues[_0x5ef45d['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x5ef45d[_0x2e6d('0x4')]]);}}}catch(_0x44d38f){utils[_0x2e6d('0x19')](util['format'](_0x2e6d('0x42'),_0x5ef45d[_0x2e6d('0x4')]),_0x44d38f);}};exports['blindtransfer']=function(_0x106bf4){try{if(!_[_0x2e6d('0x1b')](queues[_0x106bf4['transfereeuniqueid']])){utils['debug'](util[_0x2e6d('0x14')](_0x2e6d('0x47'),_0x106bf4[_0x2e6d('0x4')]),_0x106bf4);queues[_0x106bf4[_0x2e6d('0x48')]][_0x2e6d('0x43')]=!![];queues[_0x106bf4[_0x2e6d('0x48')]]['transfertype']=_0x2e6d('0x49');queues[_0x106bf4[_0x2e6d('0x48')]][_0x2e6d('0x4a')]=_0x106bf4[_0x2e6d('0x4b')];queues[_0x106bf4[_0x2e6d('0x48')]][_0x2e6d('0x4c')]=_0x106bf4[_0x2e6d('0x48')];queues[_0x106bf4[_0x2e6d('0x48')]]['queuecallerexitreason']=_0x2e6d('0x4d');utils[_0x2e6d('0x2')](util[_0x2e6d('0x14')](_0x2e6d('0x4e'),_0x106bf4[_0x2e6d('0x4')],queues[_0x106bf4[_0x2e6d('0x48')]][_0x2e6d('0x22')],_0x106bf4[_0x2e6d('0x48')],_0x106bf4[_0x2e6d('0x4b')]));}}catch(_0x28b00c){utils['error'](util[_0x2e6d('0x14')]('[%s][queues][blindtransfer]',_0x106bf4[_0x2e6d('0x4')]),_0x28b00c);}};exports[_0x2e6d('0x4f')]=function(_0x5710c4){try{utils[_0x2e6d('0x12')](util[_0x2e6d('0x14')](_0x2e6d('0x50'),_0x5710c4[_0x2e6d('0x51')]),_0x5710c4);if(_0x5710c4[_0x2e6d('0x51')]==_0x5710c4[_0x2e6d('0x52')]){if(!_[_0x2e6d('0x1b')](queues[_0x5710c4[_0x2e6d('0x53')]])){utils[_0x2e6d('0x2')](util[_0x2e6d('0x14')](_0x2e6d('0x54'),_0x5710c4['origtransfereruniqueid'],queues[_0x5710c4[_0x2e6d('0x53')]]['name'],_0x5710c4[_0x2e6d('0x55')]));queues[_0x5710c4['secondtransfererlinkedid']][_0x2e6d('0x43')]=!![];queues[_0x5710c4[_0x2e6d('0x53')]][_0x2e6d('0x56')]=_0x2e6d('0x57');queues[_0x5710c4[_0x2e6d('0x53')]]['transferexten']=_0x5710c4['origtransfererexten'];queues[_0x5710c4[_0x2e6d('0x53')]][_0x2e6d('0x4c')]=_0x5710c4[_0x2e6d('0x51')];queues[_0x5710c4[_0x2e6d('0x53')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0x2e6d('0x1b')](queues[_0x5710c4[_0x2e6d('0x52')]])){if(_0x5710c4[_0x2e6d('0x58')]&&queues[_0x5710c4['transfereelinkedid']]){queues[_0x5710c4[_0x2e6d('0x58')]][_0x2e6d('0x59')]=0x1;queues[_0x5710c4[_0x2e6d('0x48')]]=_['clone'](queues[_0x5710c4[_0x2e6d('0x58')]]);queues[_0x5710c4[_0x2e6d('0x48')]][_0x2e6d('0x10')]=_0x5710c4['transfertargetuniqueid'];queues[_0x5710c4[_0x2e6d('0x48')]][_0x2e6d('0x59')]=0x2;queues[_0x5710c4[_0x2e6d('0x48')]]['calleridnum']=queues[_0x5710c4['secondtransfererlinkedid']][_0x2e6d('0x7')];queues[_0x5710c4[_0x2e6d('0x48')]][_0x2e6d('0x5a')]=queues[_0x5710c4['secondtransfererlinkedid']]['calleridname'];queues[_0x5710c4[_0x2e6d('0x48')]][_0x2e6d('0x39')]=utils[_0x2e6d('0x18')]();queues[_0x5710c4[_0x2e6d('0x48')]][_0x2e6d('0x1d')]=utils[_0x2e6d('0x18')]();queues[_0x5710c4[_0x2e6d('0x48')]][_0x2e6d('0x37')]=0x0;queues[_0x5710c4[_0x2e6d('0x48')]][_0x2e6d('0x5b')]=0x0;utils['info'](util[_0x2e6d('0x14')](_0x2e6d('0x5c'),_0x5710c4['origtransfereruniqueid'],queues[_0x5710c4['transfereeuniqueid']][_0x2e6d('0x22')],queues[_0x5710c4[_0x2e6d('0x48')]]['calleridnum'],queues[_0x5710c4['transfereeuniqueid']]['calleridname']));}else{utils[_0x2e6d('0x2')](util[_0x2e6d('0x14')](_0x2e6d('0x5d'),_0x5710c4[_0x2e6d('0x51')],queues[_0x5710c4[_0x2e6d('0x52')]][_0x2e6d('0x22')],_0x5710c4[_0x2e6d('0x53')]));queues[_0x5710c4[_0x2e6d('0x52')]]['transfereduniqueid']=_0x5710c4[_0x2e6d('0x53')];}}}else if(_0x5710c4['secondtransfereruniqueid']==_0x5710c4[_0x2e6d('0x53')]){if(!_['isNil'](queues[_0x5710c4[_0x2e6d('0x52')]])){utils['info'](util[_0x2e6d('0x14')](_0x2e6d('0x5e'),_0x5710c4[_0x2e6d('0x51')],queues[_0x5710c4[_0x2e6d('0x52')]][_0x2e6d('0x22')],_0x5710c4['secondtransfereruniqueid'],_0x5710c4['secondtransfererexten']));queues[_0x5710c4[_0x2e6d('0x52')]][_0x2e6d('0x43')]=!![];queues[_0x5710c4[_0x2e6d('0x52')]]['transfertype']=_0x2e6d('0x57');queues[_0x5710c4[_0x2e6d('0x52')]][_0x2e6d('0x4a')]=_0x5710c4[_0x2e6d('0x5f')];queues[_0x5710c4[_0x2e6d('0x52')]][_0x2e6d('0x4c')]=_0x5710c4[_0x2e6d('0x60')];queues[_0x5710c4[_0x2e6d('0x52')]][_0x2e6d('0x9')]=_0x2e6d('0x61');}if(!_[_0x2e6d('0x1b')](queues[_0x5710c4[_0x2e6d('0x53')]])){if(_0x5710c4[_0x2e6d('0x62')]&&queues[_0x5710c4[_0x2e6d('0x62')]]){queues[_0x5710c4[_0x2e6d('0x62')]]['queuecallerenterreason']=0x1;queues[_0x5710c4[_0x2e6d('0x63')]]=_[_0x2e6d('0x64')](queues[_0x5710c4[_0x2e6d('0x62')]]);queues[_0x5710c4['transfertargetuniqueid']]['transfereduniqueid']=_0x5710c4[_0x2e6d('0x63')];queues[_0x5710c4['transfertargetuniqueid']][_0x2e6d('0x59')]=0x2;queues[_0x5710c4[_0x2e6d('0x63')]][_0x2e6d('0x7')]=queues[_0x5710c4[_0x2e6d('0x52')]]['calleridnum'];queues[_0x5710c4['transfertargetuniqueid']][_0x2e6d('0x5a')]=queues[_0x5710c4['origtransfererlinkedid']]['calleridname'];queues[_0x5710c4[_0x2e6d('0x63')]][_0x2e6d('0x39')]=utils[_0x2e6d('0x18')]();queues[_0x5710c4[_0x2e6d('0x63')]][_0x2e6d('0x1d')]=utils[_0x2e6d('0x18')]();queues[_0x5710c4[_0x2e6d('0x63')]]['holdtime']=0x0;queues[_0x5710c4['transfertargetuniqueid']][_0x2e6d('0x5b')]=0x0;utils[_0x2e6d('0x2')](util[_0x2e6d('0x14')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x5710c4['origtransfereruniqueid'],queues[_0x5710c4['transfertargetuniqueid']][_0x2e6d('0x22')],queues[_0x5710c4[_0x2e6d('0x63')]][_0x2e6d('0x10')],queues[_0x5710c4[_0x2e6d('0x63')]][_0x2e6d('0x7')],queues[_0x5710c4['transfertargetuniqueid']]['calleridname']));}else{utils['info'](util['format'](_0x2e6d('0x5d'),_0x5710c4[_0x2e6d('0x51')],queues[_0x5710c4[_0x2e6d('0x53')]][_0x2e6d('0x22')],_0x5710c4[_0x2e6d('0x52')]));queues[_0x5710c4[_0x2e6d('0x53')]][_0x2e6d('0x10')]=_0x5710c4[_0x2e6d('0x52')];}}}}catch(_0x2b21df){utils[_0x2e6d('0x19')](util[_0x2e6d('0x14')]('[%s][queues][attendedtransfer]',_0x5710c4[_0x2e6d('0x51')]),_0x2b21df);}};exports[_0x2e6d('0x65')]=function(_0x2a70e1){try{if(!_[_0x2e6d('0x1b')](queues[_0x2a70e1[_0x2e6d('0x4')]])){utils[_0x2e6d('0x12')](util[_0x2e6d('0x14')](_0x2e6d('0x66'),_0x2a70e1[_0x2e6d('0x4')]),_0x2a70e1);queues[_0x2a70e1['uniqueid']][_0x2e6d('0x67')]=utils[_0x2e6d('0x18')]();utils[_0x2e6d('0x2')](util[_0x2e6d('0x14')](_0x2e6d('0x68'),_0x2a70e1['uniqueid'],queues[_0x2a70e1[_0x2e6d('0x4')]][_0x2e6d('0x22')],queues[_0x2a70e1[_0x2e6d('0x4')]]['musiconholdstartAt']));}}catch(_0x18f6ea){utils[_0x2e6d('0x19')](util[_0x2e6d('0x14')]('[%s][queues][musiconholdstart]',_0x2a70e1[_0x2e6d('0x4')]),_0x18f6ea);}};exports['musiconholdstop']=function(_0x4a6517){try{if(!_['isNil'](queues[_0x4a6517[_0x2e6d('0x4')]])){if(!_[_0x2e6d('0x1b')](queues[_0x4a6517[_0x2e6d('0x4')]][_0x2e6d('0x67')])){utils['debug'](util[_0x2e6d('0x14')](_0x2e6d('0x69'),_0x4a6517[_0x2e6d('0x4')]),_0x4a6517);queues[_0x4a6517[_0x2e6d('0x4')]][_0x2e6d('0x5b')]+=utils[_0x2e6d('0x38')](utils['now'](),queues[_0x4a6517[_0x2e6d('0x4')]][_0x2e6d('0x67')]);utils[_0x2e6d('0x2')](util[_0x2e6d('0x14')](_0x2e6d('0x6a'),_0x4a6517[_0x2e6d('0x4')],queues[_0x4a6517[_0x2e6d('0x4')]][_0x2e6d('0x22')],queues[_0x4a6517[_0x2e6d('0x4')]][_0x2e6d('0x5b')]));delete queues[_0x4a6517['uniqueid']][_0x2e6d('0x67')];}}}catch(_0x2c8c62){utils[_0x2e6d('0x19')](util[_0x2e6d('0x14')](_0x2e6d('0x69'),_0x4a6517[_0x2e6d('0x4')]),_0x2c8c62);}}; \ No newline at end of file +var _0xe46a=['[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','position','now','error','isNil','debug','[%s][queues][hangup]','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexit','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]','queuecallerleave','connectedlinename','queuecallerleaveAt','holdtime','queuecallerjoinAt','count','connectedlinenum','[%s][queues][queuecallerleave]','membername','destaccountcode','assigned','accountcode','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridnum','calleridname','[%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','transfertargetlinkedid','transfertargetuniqueid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]','util','info','format','uniqueid','channel','queue','lastAssignedTo','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]'];(function(_0xdcc4df,_0x50b923){var _0x1eda4e=function(_0x15921e){while(--_0x15921e){_0xdcc4df['push'](_0xdcc4df['shift']());}};_0x1eda4e(++_0x50b923);}(_0xe46a,0xb6));var _0xae46=function(_0x2053ba,_0x31d7ea){_0x2053ba=_0x2053ba-0x0;var _0x126c39=_0xe46a[_0x2053ba];return _0x126c39;};'use strict';var _=require('lodash');var util=require(_0xae46('0x0'));var utils=require('./utils');var queues={};function writeDB(_0xa76a65){utils[_0xae46('0x1')](util[_0xae46('0x2')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0xa76a65[_0xae46('0x3')],_0xa76a65[_0xae46('0x4')],_0xa76a65[_0xae46('0x5')],_0xa76a65[_0xae46('0x6')],_0xa76a65['calleridnum'],_0xa76a65['accountcode'],_0xa76a65[_0xae46('0x7')]));if(_0xa76a65['queue']){utils[_0xae46('0x8')](_0xa76a65[_0xae46('0x5')])[_0xae46('0x9')](function(_0x3340e0){if(_0x3340e0){_0xa76a65[_0xae46('0xa')]=_0x3340e0[_0xae46('0xa')];}utils['request'](_0xae46('0xb'),_0xa76a65);});}else{utils[_0xae46('0xc')](_0xae46('0xb'),_0xa76a65);}if(_0xa76a65[_0xae46('0xd')]){delete queues[_0xa76a65[_0xae46('0xd')]];}else{delete queues[_0xa76a65['uniqueid']];}}exports[_0xae46('0xe')]=function(_0x569d20){try{utils['debug'](util[_0xae46('0x2')](_0xae46('0xf'),_0x569d20[_0xae46('0x3')]),_0x569d20);utils[_0xae46('0x1')](util[_0xae46('0x2')](_0xae46('0x10'),_0x569d20[_0xae46('0x3')],_0x569d20[_0xae46('0x5')],_0x569d20['position']));queues[_0x569d20['uniqueid']]=_[_0xae46('0x11')](_0x569d20,{'originalposition':_0x569d20[_0xae46('0x12')],'queuecallerjoinAt':utils[_0xae46('0x13')](),'mohtime':0x0});}catch(_0x57bc2f){utils[_0xae46('0x14')](util[_0xae46('0x2')](_0xae46('0xf'),_0x569d20[_0xae46('0x3')]),_0x57bc2f);}};exports['hangup']=function(_0x2910b0){try{if(!_[_0xae46('0x15')](queues[_0x2910b0[_0xae46('0x3')]])){utils[_0xae46('0x16')](util[_0xae46('0x2')](_0xae46('0x17'),_0x2910b0[_0xae46('0x3')]),_0x2910b0);if(queues[_0x2910b0[_0xae46('0x3')]]['queuecallerleaveAt']){if(!queues[_0x2910b0['uniqueid']]['queuecallerabandon']&&!queues[_0x2910b0[_0xae46('0x3')]]['queuecallerexit']){queues[_0x2910b0[_0xae46('0x3')]]['queuecallercomplete']=!![];queues[_0x2910b0['uniqueid']][_0xae46('0x18')]=utils[_0xae46('0x13')]();queues[_0x2910b0['uniqueid']]['queuecallerexitreason']=_0xae46('0x19');}utils[_0xae46('0x1')](util['format'](_0xae46('0x1a'),_0x2910b0['uniqueid'],queues[_0x2910b0[_0xae46('0x3')]][_0xae46('0x1b')],queues[_0x2910b0[_0xae46('0x3')]][_0xae46('0x7')]));writeDB(queues[_0x2910b0['uniqueid']]);}else if(queues[_0x2910b0[_0xae46('0x3')]][_0xae46('0xd')]){utils[_0xae46('0x1')](util[_0xae46('0x2')](_0xae46('0x1c'),_0x2910b0[_0xae46('0x3')],queues[_0x2910b0[_0xae46('0x3')]][_0xae46('0x1b')],queues[_0x2910b0['uniqueid']]['transfereduniqueid']));queues[queues[_0x2910b0[_0xae46('0x3')]][_0xae46('0xd')]]=queues[_0x2910b0[_0xae46('0x3')]];queues[queues[_0x2910b0[_0xae46('0x3')]][_0xae46('0xd')]][_0xae46('0x1d')]=0x2;delete queues[_0x2910b0[_0xae46('0x3')]];}}}catch(_0x4eb1d4){utils[_0xae46('0x14')](util['format'](_0xae46('0x17'),_0x2910b0['uniqueid']),_0x4eb1d4);}};exports[_0xae46('0x1e')]=function(_0x10b9bb){try{utils[_0xae46('0x16')](util[_0xae46('0x2')](_0xae46('0x1f'),_0x10b9bb['uniqueid']),_0x10b9bb);if(!_['isNil'](_0x10b9bb[_0xae46('0x20')][_0xae46('0x21')])&&_0x10b9bb[_0xae46('0x22')][_0xae46('0x23')]()!==_0xae46('0x24')){if(!_['isNil'](queues[_0x10b9bb[_0xae46('0x3')]])){queues[_0x10b9bb[_0xae46('0x3')]][_0xae46('0x25')]=![];queues[_0x10b9bb['uniqueid']][_0xae46('0x26')]=null;queues[_0x10b9bb['uniqueid']]['queuecallerexit']=!![];queues[_0x10b9bb[_0xae46('0x3')]][_0xae46('0x27')]=utils[_0xae46('0x13')]();queues[_0x10b9bb[_0xae46('0x3')]][_0xae46('0x7')]=_0x10b9bb[_0xae46('0x22')]['toUpperCase']();utils[_0xae46('0x1')](util[_0xae46('0x2')](_0xae46('0x28'),_0x10b9bb['uniqueid'],queues[_0x10b9bb[_0xae46('0x3')]][_0xae46('0x1b')],_0x10b9bb[_0xae46('0x22')],queues[_0x10b9bb['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x10b9bb[_0xae46('0x3')]]);}}else if(!_[_0xae46('0x15')](_0x10b9bb[_0xae46('0x20')][_0xae46('0x29')])){if(!_[_0xae46('0x15')](queues[_0x10b9bb[_0xae46('0x3')]])&&!queues[_0x10b9bb[_0xae46('0x3')]][_0xae46('0x25')]){queues[_0x10b9bb[_0xae46('0x3')]][_0xae46('0x25')]=![];queues[_0x10b9bb[_0xae46('0x3')]][_0xae46('0x26')]=null;queues[_0x10b9bb[_0xae46('0x3')]][_0xae46('0x2a')]=!![];queues[_0x10b9bb[_0xae46('0x3')]][_0xae46('0x27')]=utils[_0xae46('0x13')]();queues[_0x10b9bb[_0xae46('0x3')]][_0xae46('0x7')]='EXITWITHKEY';utils[_0xae46('0x1')](util['format'](_0xae46('0x2b'),_0x10b9bb[_0xae46('0x3')],queues[_0x10b9bb[_0xae46('0x3')]][_0xae46('0x1b')],_0x10b9bb[_0xae46('0x22')],queues[_0x10b9bb[_0xae46('0x3')]]['queuecallerexitreason']));}}}catch(_0x2b4473){utils[_0xae46('0x14')](util[_0xae46('0x2')](_0xae46('0x1f'),_0x10b9bb[_0xae46('0x3')]),_0x2b4473);}};exports[_0xae46('0x25')]=function(_0x54a117){try{if(!_[_0xae46('0x15')](queues[_0x54a117[_0xae46('0x3')]])){utils[_0xae46('0x16')](util['format']('[%s][queues][queuecallerabandon]',_0x54a117[_0xae46('0x3')]),_0x54a117);queues[_0x54a117[_0xae46('0x3')]][_0xae46('0x2a')]=![];queues[_0x54a117[_0xae46('0x3')]][_0xae46('0x27')]=null;queues[_0x54a117[_0xae46('0x3')]][_0xae46('0x25')]=!![];queues[_0x54a117[_0xae46('0x3')]][_0xae46('0x26')]=utils[_0xae46('0x13')]();queues[_0x54a117[_0xae46('0x3')]][_0xae46('0x7')]=_0xae46('0x2c');utils[_0xae46('0x1')](util[_0xae46('0x2')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x54a117[_0xae46('0x3')],queues[_0x54a117['uniqueid']][_0xae46('0x1b')],queues[_0x54a117[_0xae46('0x3')]][_0xae46('0x7')]));}}catch(_0x648062){utils[_0xae46('0x14')](util[_0xae46('0x2')](_0xae46('0x2d'),_0x54a117[_0xae46('0x3')]),_0x648062);}};exports[_0xae46('0x2e')]=function(_0x58f192){try{if(!_[_0xae46('0x15')](queues[_0x58f192['uniqueid']])){utils[_0xae46('0x16')](util[_0xae46('0x2')]('[%s][queues][queuecallerleave]',_0x58f192['uniqueid']),_0x58f192);utils[_0xae46('0x1')](util[_0xae46('0x2')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x58f192[_0xae46('0x3')],queues[_0x58f192[_0xae46('0x3')]]['name'],_0x58f192['connectedlinenum'],_0x58f192[_0xae46('0x2f')]));queues[_0x58f192['uniqueid']][_0xae46('0x2e')]=!![];queues[_0x58f192['uniqueid']][_0xae46('0x30')]=utils[_0xae46('0x13')]();queues[_0x58f192[_0xae46('0x3')]][_0xae46('0x31')]=utils['diffTime'](queues[_0x58f192[_0xae46('0x3')]][_0xae46('0x30')],queues[_0x58f192[_0xae46('0x3')]][_0xae46('0x32')]);queues[_0x58f192[_0xae46('0x3')]][_0xae46('0x12')]=_0x58f192[_0xae46('0x12')];queues[_0x58f192['uniqueid']]['count']=_0x58f192[_0xae46('0x33')];queues[_0x58f192[_0xae46('0x3')]][_0xae46('0x34')]=_0x58f192['connectedlinenum'];queues[_0x58f192[_0xae46('0x3')]][_0xae46('0x2f')]=_0x58f192[_0xae46('0x2f')];}}catch(_0x22016f){utils[_0xae46('0x14')](util[_0xae46('0x2')](_0xae46('0x35'),_0x58f192[_0xae46('0x3')]),_0x22016f);}};exports['agentconnect']=function(_0x4c5cf5){try{if(!_[_0xae46('0x15')](queues[_0x4c5cf5['uniqueid']])){utils['debug'](util[_0xae46('0x2')]('[%s][queues][agentconnect]',_0x4c5cf5['uniqueid']),_0x4c5cf5);utils['info'](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x4c5cf5[_0xae46('0x3')],queues[_0x4c5cf5['uniqueid']][_0xae46('0x1b')],_0x4c5cf5[_0xae46('0x36')],_0x4c5cf5[_0xae46('0x37')]));queues[_0x4c5cf5[_0xae46('0x3')]][_0xae46('0x25')]=![];queues[_0x4c5cf5[_0xae46('0x3')]][_0xae46('0x25')]=![];queues[_0x4c5cf5['uniqueid']][_0xae46('0x26')]=null;queues[_0x4c5cf5['uniqueid']][_0xae46('0x2a')]=![];queues[_0x4c5cf5[_0xae46('0x3')]]['queuecallerexitreason']=null;queues[_0x4c5cf5['uniqueid']]['queuecallerexitAt']=null;queues[_0x4c5cf5[_0xae46('0x3')]][_0xae46('0x38')]=!![];queues[_0x4c5cf5[_0xae46('0x3')]][_0xae46('0x39')]=_0x4c5cf5[_0xae46('0x37')];queues[_0x4c5cf5[_0xae46('0x3')]][_0xae46('0x6')]=_0x4c5cf5[_0xae46('0x36')];}}catch(_0x105b82){utils[_0xae46('0x14')](util['format'](_0xae46('0x3a'),_0x4c5cf5[_0xae46('0x3')]),_0x105b82);}};exports[_0xae46('0x3b')]=function(_0x462c9d){try{if(!_[_0xae46('0x15')](queues[_0x462c9d[_0xae46('0x3')]])){if(queues[_0x462c9d[_0xae46('0x3')]][_0xae46('0x30')]){utils['debug'](util[_0xae46('0x2')](_0xae46('0x3c'),_0x462c9d['uniqueid']),_0x462c9d);queues[_0x462c9d[_0xae46('0x3')]][_0xae46('0x25')]=![];queues[_0x462c9d[_0xae46('0x3')]][_0xae46('0x25')]=![];queues[_0x462c9d[_0xae46('0x3')]][_0xae46('0x26')]=null;queues[_0x462c9d['uniqueid']][_0xae46('0x2a')]=![];queues[_0x462c9d[_0xae46('0x3')]][_0xae46('0x27')]=null;queues[_0x462c9d[_0xae46('0x3')]][_0xae46('0x38')]=!![];queues[_0x462c9d[_0xae46('0x3')]][_0xae46('0x6')]=_0x462c9d[_0xae46('0x36')];queues[_0x462c9d[_0xae46('0x3')]]['queuecallercomplete']=!![];queues[_0x462c9d[_0xae46('0x3')]][_0xae46('0x18')]=utils['now']();if(_0x462c9d[_0xae46('0x3d')]==_0xae46('0x3e')){if(!queues[_0x462c9d[_0xae46('0x3')]][_0xae46('0x3e')]){queues[_0x462c9d[_0xae46('0x3')]]['queuecallerexitreason']=_0xae46('0x3f');}}else{queues[_0x462c9d[_0xae46('0x3')]][_0xae46('0x7')]=_0xae46('0x40')+_0x462c9d[_0xae46('0x3d')][_0xae46('0x23')]();}utils[_0xae46('0x1')](util['format'](_0xae46('0x41'),_0x462c9d[_0xae46('0x3')],queues[_0x462c9d['uniqueid']]['name'],_0x462c9d[_0xae46('0x36')],queues[_0x462c9d[_0xae46('0x3')]][_0xae46('0x7')]));writeDB(queues[_0x462c9d['uniqueid']]);}}}catch(_0x4b4e92){utils['error'](util[_0xae46('0x2')](_0xae46('0x3c'),_0x462c9d[_0xae46('0x3')]),_0x4b4e92);}};exports[_0xae46('0x42')]=function(_0x2e556){try{if(!_[_0xae46('0x15')](queues[_0x2e556[_0xae46('0x43')]])){utils[_0xae46('0x16')](util[_0xae46('0x2')](_0xae46('0x44'),_0x2e556[_0xae46('0x3')]),_0x2e556);queues[_0x2e556[_0xae46('0x43')]][_0xae46('0x3e')]=!![];queues[_0x2e556[_0xae46('0x43')]][_0xae46('0x45')]='BLIND';queues[_0x2e556[_0xae46('0x43')]][_0xae46('0x46')]=_0x2e556['extension'];queues[_0x2e556[_0xae46('0x43')]]['transferuniqueid']=_0x2e556[_0xae46('0x43')];queues[_0x2e556[_0xae46('0x43')]][_0xae46('0x7')]=_0xae46('0x47');utils[_0xae46('0x1')](util[_0xae46('0x2')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x2e556[_0xae46('0x3')],queues[_0x2e556['transfereeuniqueid']][_0xae46('0x1b')],_0x2e556[_0xae46('0x43')],_0x2e556['extension']));}}catch(_0x4e39e7){utils[_0xae46('0x14')](util[_0xae46('0x2')](_0xae46('0x44'),_0x2e556['uniqueid']),_0x4e39e7);}};exports[_0xae46('0x48')]=function(_0x3a7151){try{utils['debug'](util['format']('[%s][queues][attendedtransfer]',_0x3a7151[_0xae46('0x49')]),_0x3a7151);if(_0x3a7151[_0xae46('0x49')]==_0x3a7151[_0xae46('0x4a')]){if(!_[_0xae46('0x15')](queues[_0x3a7151[_0xae46('0x4b')]])){utils[_0xae46('0x1')](util[_0xae46('0x2')](_0xae46('0x4c'),_0x3a7151[_0xae46('0x49')],queues[_0x3a7151[_0xae46('0x4b')]][_0xae46('0x1b')],_0x3a7151['origtransfererexten']));queues[_0x3a7151[_0xae46('0x4b')]][_0xae46('0x3e')]=!![];queues[_0x3a7151[_0xae46('0x4b')]]['transfertype']=_0xae46('0x4d');queues[_0x3a7151[_0xae46('0x4b')]][_0xae46('0x46')]=_0x3a7151[_0xae46('0x4e')];queues[_0x3a7151[_0xae46('0x4b')]][_0xae46('0x4f')]=_0x3a7151[_0xae46('0x49')];queues[_0x3a7151[_0xae46('0x4b')]][_0xae46('0x7')]=_0xae46('0x50');}if(!_['isNil'](queues[_0x3a7151[_0xae46('0x4a')]])){if(_0x3a7151[_0xae46('0x51')]&&queues[_0x3a7151['transfereelinkedid']]){queues[_0x3a7151['transfereelinkedid']][_0xae46('0x1d')]=0x1;queues[_0x3a7151[_0xae46('0x43')]]=_[_0xae46('0x52')](queues[_0x3a7151[_0xae46('0x51')]]);queues[_0x3a7151[_0xae46('0x43')]][_0xae46('0xd')]=_0x3a7151['transfertargetuniqueid'];queues[_0x3a7151[_0xae46('0x43')]]['queuecallerenterreason']=0x2;queues[_0x3a7151[_0xae46('0x43')]][_0xae46('0x53')]=queues[_0x3a7151[_0xae46('0x4b')]][_0xae46('0x53')];queues[_0x3a7151[_0xae46('0x43')]]['calleridname']=queues[_0x3a7151[_0xae46('0x4b')]][_0xae46('0x54')];queues[_0x3a7151[_0xae46('0x43')]]['queuecallerjoinAt']=utils['now']();queues[_0x3a7151[_0xae46('0x43')]][_0xae46('0x30')]=utils[_0xae46('0x13')]();queues[_0x3a7151['transfereeuniqueid']][_0xae46('0x31')]=0x0;queues[_0x3a7151[_0xae46('0x43')]]['mohtime']=0x0;utils[_0xae46('0x1')](util['format'](_0xae46('0x55'),_0x3a7151[_0xae46('0x49')],queues[_0x3a7151[_0xae46('0x43')]][_0xae46('0x1b')],queues[_0x3a7151['transfereeuniqueid']][_0xae46('0x53')],queues[_0x3a7151[_0xae46('0x43')]][_0xae46('0x54')]));}else{utils[_0xae46('0x1')](util[_0xae46('0x2')](_0xae46('0x56'),_0x3a7151[_0xae46('0x49')],queues[_0x3a7151[_0xae46('0x4a')]][_0xae46('0x1b')],_0x3a7151[_0xae46('0x4b')]));queues[_0x3a7151['origtransfererlinkedid']]['transfereduniqueid']=_0x3a7151[_0xae46('0x4b')];}}}else if(_0x3a7151[_0xae46('0x57')]==_0x3a7151[_0xae46('0x4b')]){if(!_['isNil'](queues[_0x3a7151[_0xae46('0x4a')]])){utils['info'](util['format'](_0xae46('0x58'),_0x3a7151[_0xae46('0x49')],queues[_0x3a7151[_0xae46('0x4a')]][_0xae46('0x1b')],_0x3a7151['secondtransfereruniqueid'],_0x3a7151[_0xae46('0x59')]));queues[_0x3a7151[_0xae46('0x4a')]][_0xae46('0x3e')]=!![];queues[_0x3a7151[_0xae46('0x4a')]]['transfertype']=_0xae46('0x4d');queues[_0x3a7151[_0xae46('0x4a')]]['transferexten']=_0x3a7151[_0xae46('0x59')];queues[_0x3a7151['origtransfererlinkedid']][_0xae46('0x4f')]=_0x3a7151[_0xae46('0x57')];queues[_0x3a7151[_0xae46('0x4a')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0xae46('0x15')](queues[_0x3a7151[_0xae46('0x4b')]])){if(_0x3a7151[_0xae46('0x5a')]&&queues[_0x3a7151[_0xae46('0x5a')]]){queues[_0x3a7151[_0xae46('0x5a')]]['queuecallerenterreason']=0x1;queues[_0x3a7151[_0xae46('0x5b')]]=_[_0xae46('0x52')](queues[_0x3a7151['transfertargetlinkedid']]);queues[_0x3a7151[_0xae46('0x5b')]][_0xae46('0xd')]=_0x3a7151[_0xae46('0x5b')];queues[_0x3a7151[_0xae46('0x5b')]][_0xae46('0x1d')]=0x2;queues[_0x3a7151[_0xae46('0x5b')]]['calleridnum']=queues[_0x3a7151[_0xae46('0x4a')]][_0xae46('0x53')];queues[_0x3a7151[_0xae46('0x5b')]]['calleridname']=queues[_0x3a7151[_0xae46('0x4a')]]['calleridname'];queues[_0x3a7151[_0xae46('0x5b')]][_0xae46('0x32')]=utils[_0xae46('0x13')]();queues[_0x3a7151['transfertargetuniqueid']][_0xae46('0x30')]=utils[_0xae46('0x13')]();queues[_0x3a7151[_0xae46('0x5b')]][_0xae46('0x31')]=0x0;queues[_0x3a7151[_0xae46('0x5b')]][_0xae46('0x5c')]=0x0;utils[_0xae46('0x1')](util[_0xae46('0x2')](_0xae46('0x5d'),_0x3a7151[_0xae46('0x49')],queues[_0x3a7151[_0xae46('0x5b')]][_0xae46('0x1b')],queues[_0x3a7151[_0xae46('0x5b')]][_0xae46('0xd')],queues[_0x3a7151[_0xae46('0x5b')]][_0xae46('0x53')],queues[_0x3a7151[_0xae46('0x5b')]][_0xae46('0x54')]));}else{utils['info'](util[_0xae46('0x2')](_0xae46('0x56'),_0x3a7151[_0xae46('0x49')],queues[_0x3a7151['secondtransfererlinkedid']][_0xae46('0x1b')],_0x3a7151[_0xae46('0x4a')]));queues[_0x3a7151['secondtransfererlinkedid']][_0xae46('0xd')]=_0x3a7151['origtransfererlinkedid'];}}}}catch(_0x418e50){utils['error'](util[_0xae46('0x2')](_0xae46('0x5e'),_0x3a7151['origtransfereruniqueid']),_0x418e50);}};exports[_0xae46('0x5f')]=function(_0x4d0c7c){try{if(!_[_0xae46('0x15')](queues[_0x4d0c7c[_0xae46('0x3')]])){utils['debug'](util['format']('[%s][queues][musiconholdstart]',_0x4d0c7c[_0xae46('0x3')]),_0x4d0c7c);queues[_0x4d0c7c[_0xae46('0x3')]][_0xae46('0x60')]=utils[_0xae46('0x13')]();utils[_0xae46('0x1')](util[_0xae46('0x2')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x4d0c7c[_0xae46('0x3')],queues[_0x4d0c7c[_0xae46('0x3')]][_0xae46('0x1b')],queues[_0x4d0c7c[_0xae46('0x3')]][_0xae46('0x60')]));}}catch(_0x3952df){utils[_0xae46('0x14')](util[_0xae46('0x2')](_0xae46('0x61'),_0x4d0c7c['uniqueid']),_0x3952df);}};exports['musiconholdstop']=function(_0x92fb36){try{if(!_[_0xae46('0x15')](queues[_0x92fb36[_0xae46('0x3')]])){if(!_[_0xae46('0x15')](queues[_0x92fb36['uniqueid']][_0xae46('0x60')])){utils[_0xae46('0x16')](util[_0xae46('0x2')](_0xae46('0x62'),_0x92fb36[_0xae46('0x3')]),_0x92fb36);queues[_0x92fb36[_0xae46('0x3')]][_0xae46('0x5c')]+=utils['diffTime'](utils[_0xae46('0x13')](),queues[_0x92fb36[_0xae46('0x3')]][_0xae46('0x60')]);utils['info'](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x92fb36['uniqueid'],queues[_0x92fb36[_0xae46('0x3')]][_0xae46('0x1b')],queues[_0x92fb36[_0xae46('0x3')]][_0xae46('0x5c')]));delete queues[_0x92fb36[_0xae46('0x3')]]['musiconholdstartAt'];}}}catch(_0x28e27f){utils[_0xae46('0x14')](util[_0xae46('0x2')](_0xae46('0x62'),_0x92fb36['uniqueid']),_0x28e27f);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 4dd2701..683aa68 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 _0xa194=['[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','util','info','format','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','membername','name','request','CreateVoiceRecording','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','[%s][recordings][newchannel]','newstate','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','blindtransfer','[%s][recordings][blindtransfer]'];(function(_0xe1d6fc,_0x1ef0e8){var _0x5db740=function(_0x581049){while(--_0x581049){_0xe1d6fc['push'](_0xe1d6fc['shift']());}};_0x5db740(++_0x1ef0e8);}(_0xa194,0x1aa));var _0x4a19=function(_0x51fadf,_0x16c8ea){_0x51fadf=_0x51fadf-0x0;var _0x5ca024=_0xa194[_0x51fadf];return _0x5ca024;};'use strict';var _=require('lodash');var util=require(_0x4a19('0x0'));var utils=require('./utils');var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x2f1c43){var _0x1b93be;utils[_0x4a19('0x1')](util[_0x4a19('0x2')]('[%s][recordings][writeDB]',_0x2f1c43[_0x4a19('0x3')]));if(transfers[_0x4a19('0x4')][_0x2f1c43[_0x4a19('0x3')]]){_0x1b93be=_0x2f1c43[_0x4a19('0x3')];_0x2f1c43[_0x4a19('0x3')]=transfers[_0x4a19('0x4')][_0x2f1c43['uniqueid']][_0x4a19('0x5')];}if(_0x2f1c43[_0x4a19('0x6')]){utils[_0x4a19('0x7')](_0x2f1c43[_0x4a19('0x6')])['then'](function(_0x59c59e){if(_0x59c59e){_0x2f1c43[_0x4a19('0x8')]=_0x59c59e[_0x4a19('0x9')];_0x2f1c43['UserId']=_0x59c59e['id'];}utils[_0x4a19('0xa')](_0x4a19('0xb'),_0x2f1c43);});}else{utils[_0x4a19('0xa')](_0x4a19('0xb'),_0x2f1c43);}if(_0x1b93be)delete transfers[_0x4a19('0x4')][_0x1b93be];}exports['newchannel']=function(_0x459557){try{utils['debug'](util[_0x4a19('0x2')]('[%s][recordings][newchannel]',_0x459557[_0x4a19('0x3')]),_0x459557);if(_0x459557[_0x4a19('0x3')]==_0x459557[_0x4a19('0xc')]){utils[_0x4a19('0x1')](util[_0x4a19('0x2')](_0x4a19('0xd'),_0x459557[_0x4a19('0x3')],_0x459557[_0x4a19('0xe')],_0x459557[_0x4a19('0xf')]));recordings[_0x459557[_0x4a19('0x3')]]={'uniqueid':_0x459557[_0x4a19('0x3')],'accountcode':_0x459557[_0x4a19('0x6')],'exten':_0x459557[_0x4a19('0xf')],'context':_0x459557[_0x4a19('0xe')],'channel':_0x459557['channel'],'monitors':[]};}}catch(_0x4b6907){utils[_0x4a19('0x10')](util[_0x4a19('0x2')](_0x4a19('0x11'),_0x459557[_0x4a19('0x3')]),_0x4b6907);}};exports[_0x4a19('0x12')]=function(_0xe5f3a4){try{utils[_0x4a19('0x13')](util['format'](_0x4a19('0x14'),_0xe5f3a4[_0x4a19('0x3')]),_0xe5f3a4);if(!_[_0x4a19('0x15')](recordings[_0xe5f3a4[_0x4a19('0x3')]])&&_0xe5f3a4[_0x4a19('0x16')]==0x6){utils[_0x4a19('0x1')](util[_0x4a19('0x2')](_0x4a19('0x17'),_0xe5f3a4[_0x4a19('0x3')],_0xe5f3a4[_0x4a19('0xe')],_0xe5f3a4[_0x4a19('0x18')]));}else if(!_['isNil'](recordings[_0xe5f3a4['linkedid']])&&_0xe5f3a4['channelstate']==0x6&&_0xe5f3a4[_0x4a19('0xe')]!=_0x4a19('0x19')){utils[_0x4a19('0x1')](util[_0x4a19('0x2')](_0x4a19('0x1a'),_0xe5f3a4[_0x4a19('0x3')],_0xe5f3a4[_0x4a19('0xc')],_0xe5f3a4[_0x4a19('0xe')],_0xe5f3a4['channel']));recordings[_0xe5f3a4[_0x4a19('0xc')]][_0x4a19('0x6')]=_0xe5f3a4[_0x4a19('0x6')];}}catch(_0x15ca6c){utils[_0x4a19('0x10')](util[_0x4a19('0x2')](_0x4a19('0x14'),_0xe5f3a4[_0x4a19('0x3')]),_0x15ca6c);}};exports['varset']=function(_0x50b9fb){try{if(!_[_0x4a19('0x15')](_0x50b9fb[_0x4a19('0x1b')])&&!_[_0x4a19('0x15')](_0x50b9fb['variable'][_0x4a19('0x1c')])){utils[_0x4a19('0x13')](util[_0x4a19('0x2')]('[%s][recordings][varset]',_0x50b9fb[_0x4a19('0x3')]),_0x50b9fb);utils[_0x4a19('0x1')](util['format'](_0x4a19('0x1d'),_0x50b9fb[_0x4a19('0x3')],_0x50b9fb['variable'],_0x50b9fb[_0x4a19('0x1e')]));if(_[_0x4a19('0x1f')](_0x50b9fb['value'],_0x4a19('0x20'))){_0x50b9fb[_0x4a19('0x1e')]=_0x50b9fb['value'][_0x4a19('0x21')](_0x4a19('0x20'),'.WAV');}if(recordings[_0x50b9fb[_0x4a19('0xc')]]){var _0x44f088=_[_0x4a19('0x22')](recordings[_0x50b9fb[_0x4a19('0xc')]][_0x4a19('0x23')],{'value':_0x50b9fb[_0x4a19('0x1e')]});if(_[_0x4a19('0x15')](_0x44f088)){recordings[_0x50b9fb[_0x4a19('0xc')]][_0x4a19('0x23')][_0x4a19('0x24')]({'value':_0x50b9fb[_0x4a19('0x1e')]});}}}}catch(_0x3c39b2){utils[_0x4a19('0x10')](util[_0x4a19('0x2')](_0x4a19('0x25'),_0x50b9fb[_0x4a19('0x3')]),_0x3c39b2);}};exports[_0x4a19('0x26')]=function(_0x360067){try{if(!_[_0x4a19('0x15')](recordings[_0x360067['uniqueid']])){utils[_0x4a19('0x13')](util[_0x4a19('0x2')](_0x4a19('0x27'),_0x360067['uniqueid']),_0x360067);utils[_0x4a19('0x1')](util[_0x4a19('0x2')](_0x4a19('0x28'),_0x360067['uniqueid'],_0x360067[_0x4a19('0x29')],_0x360067['calleridname'],_0x360067[_0x4a19('0x2a')]));recordings[_0x360067[_0x4a19('0x3')]]['calleridnum']=_0x360067['calleridnum'];recordings[_0x360067[_0x4a19('0x3')]][_0x4a19('0x2b')]=_0x360067[_0x4a19('0x2b')];recordings[_0x360067[_0x4a19('0x3')]]['connectedlinenum']=_0x360067[_0x4a19('0x2c')];recordings[_0x360067[_0x4a19('0x3')]]['connectedlinename']=_0x360067[_0x4a19('0x2d')];if(recordings[_0x360067[_0x4a19('0x3')]]['type']==_0x4a19('0x2e')&&recordings[_0x360067[_0x4a19('0x3')]][_0x4a19('0x6')]){recordings[_0x360067[_0x4a19('0x3')]]['connectedlinenum']=recordings[_0x360067[_0x4a19('0x3')]][_0x4a19('0x6')];recordings[_0x360067[_0x4a19('0x3')]][_0x4a19('0x2d')]='';}recordings[_0x360067[_0x4a19('0x3')]][_0x4a19('0x23')][_0x4a19('0x2f')](function(_0x18b32d){var _0x2238bc=_[_0x4a19('0x30')](recordings[_0x360067[_0x4a19('0x3')]]);_0x2238bc[_0x4a19('0x1e')]=_0x18b32d[_0x4a19('0x1e')];writeDB(_0x2238bc);});delete recordings[_0x360067[_0x4a19('0x3')]];}}catch(_0x39c530){utils['error'](util[_0x4a19('0x2')]('[%s][recordings][hangup]',_0x360067[_0x4a19('0x3')]),_0x39c530);}};exports[_0x4a19('0x31')]=function(_0xcf73a0){try{if(!_[_0x4a19('0x15')](recordings[_0xcf73a0[_0x4a19('0x3')]])){utils[_0x4a19('0x13')](util[_0x4a19('0x2')](_0x4a19('0x32'),_0xcf73a0[_0x4a19('0x3')]),_0xcf73a0);utils[_0x4a19('0x1')](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0xcf73a0[_0x4a19('0x3')],_0xcf73a0[_0x4a19('0x33')],_0xcf73a0[_0x4a19('0x34')]));if(_0xcf73a0['application'][_0x4a19('0x35')]()==_0x4a19('0x36')&&_['startsWith'](_0xcf73a0[_0x4a19('0x34')][_0x4a19('0x35')](),_0x4a19('0x37'))){var _0x414768=_0xcf73a0[_0x4a19('0x34')][_0x4a19('0x38')]('=');var _0x25222a=_0x414768[0x0][_0x4a19('0x39')](_0x414768[0x0][_0x4a19('0x3a')]('(')+0x1,_0x414768[0x0][_0x4a19('0x3a')](')'));var _0x2e607f=_0x414768[0x1];recordings[_0xcf73a0[_0x4a19('0x3')]][_0x25222a]=_0x2e607f;}}}catch(_0x37adad){utils['error'](util['format'](_0x4a19('0x32'),_0xcf73a0[_0x4a19('0x3')]),_0x37adad);}};exports[_0x4a19('0x3b')]=function(_0x529acc){try{if(!_[_0x4a19('0x15')](recordings[_0x529acc[_0x4a19('0x3')]])){utils[_0x4a19('0x13')](util[_0x4a19('0x2')](_0x4a19('0x3c'),_0x529acc[_0x4a19('0x3')]),_0x529acc);utils[_0x4a19('0x1')](util[_0x4a19('0x2')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x529acc[_0x4a19('0x3')],_0x529acc[_0x4a19('0x3d')]));recordings[_0x529acc[_0x4a19('0x3')]][_0x4a19('0x3d')]=_0x529acc[_0x4a19('0x3d')];}}catch(_0x737ec7){utils[_0x4a19('0x10')](util[_0x4a19('0x2')](_0x4a19('0x3c'),_0x529acc[_0x4a19('0x3')]),_0x737ec7);}};exports[_0x4a19('0x3e')]=function(_0x436550){try{utils[_0x4a19('0x13')](util['format'](_0x4a19('0x3f'),_0x436550[_0x4a19('0x3')]),_0x436550);utils[_0x4a19('0x1')](util[_0x4a19('0x2')](_0x4a19('0x40'),_0x436550['uniqueid'],_0x436550[_0x4a19('0x41')],_0x436550['transferercalleridname'],_0x436550[_0x4a19('0x42')],_0x436550[_0x4a19('0x43')]));if(recordings[_0x436550[_0x4a19('0x44')]]&&transfers[_0x4a19('0x4')][_0x436550['transfereruniqueid']]){transfers[_0x4a19('0x4')][_0x436550[_0x4a19('0x44')]][_0x4a19('0x45')]=!![];}}catch(_0x1ec14c){utils[_0x4a19('0x10')](util[_0x4a19('0x2')]('[%s][recordings][blindtransfer]',_0x436550[_0x4a19('0x3')]),_0x1ec14c);}}; \ No newline at end of file +var _0xcd02=['accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','channelstate','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','isNil','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','lodash','util','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid'];(function(_0x130f5d,_0x422e9e){var _0x425398=function(_0x3aa5f8){while(--_0x3aa5f8){_0x130f5d['push'](_0x130f5d['shift']());}};_0x425398(++_0x422e9e);}(_0xcd02,0x197));var _0x2cd0=function(_0x3231fe,_0x2a0e64){_0x3231fe=_0x3231fe-0x0;var _0x35a05f=_0xcd02[_0x3231fe];return _0x35a05f;};'use strict';var _=require(_0x2cd0('0x0'));var util=require(_0x2cd0('0x1'));var utils=require('./utils');var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x248327){var _0x794165;utils['info'](util[_0x2cd0('0x2')](_0x2cd0('0x3'),_0x248327['uniqueid']));if(transfers['blinds'][_0x248327[_0x2cd0('0x4')]]){_0x794165=_0x248327[_0x2cd0('0x4')];_0x248327[_0x2cd0('0x4')]=transfers[_0x2cd0('0x5')][_0x248327[_0x2cd0('0x4')]][_0x2cd0('0x6')];}if(_0x248327[_0x2cd0('0x7')]){utils[_0x2cd0('0x8')](_0x248327[_0x2cd0('0x7')])['then'](function(_0x4d71da){if(_0x4d71da){_0x248327[_0x2cd0('0x9')]=_0x4d71da[_0x2cd0('0xa')];_0x248327[_0x2cd0('0xb')]=_0x4d71da['id'];}utils[_0x2cd0('0xc')](_0x2cd0('0xd'),_0x248327);});}else{utils['request']('CreateVoiceRecording',_0x248327);}if(_0x794165)delete transfers[_0x2cd0('0x5')][_0x794165];}exports[_0x2cd0('0xe')]=function(_0x1dcfc7){try{utils[_0x2cd0('0xf')](util[_0x2cd0('0x2')](_0x2cd0('0x10'),_0x1dcfc7[_0x2cd0('0x4')]),_0x1dcfc7);if(_0x1dcfc7[_0x2cd0('0x4')]==_0x1dcfc7['linkedid']){utils[_0x2cd0('0x11')](util[_0x2cd0('0x2')](_0x2cd0('0x12'),_0x1dcfc7['uniqueid'],_0x1dcfc7['context'],_0x1dcfc7[_0x2cd0('0x13')]));recordings[_0x1dcfc7[_0x2cd0('0x4')]]={'uniqueid':_0x1dcfc7[_0x2cd0('0x4')],'accountcode':_0x1dcfc7['accountcode'],'exten':_0x1dcfc7[_0x2cd0('0x13')],'context':_0x1dcfc7[_0x2cd0('0x14')],'channel':_0x1dcfc7[_0x2cd0('0x15')],'monitors':[]};}}catch(_0x351b8d){utils[_0x2cd0('0x16')](util[_0x2cd0('0x2')](_0x2cd0('0x10'),_0x1dcfc7[_0x2cd0('0x4')]),_0x351b8d);}};exports['newstate']=function(_0x59f19e){try{utils[_0x2cd0('0xf')](util[_0x2cd0('0x2')]('[%s][recordings][newstate]',_0x59f19e[_0x2cd0('0x4')]),_0x59f19e);if(!_['isNil'](recordings[_0x59f19e[_0x2cd0('0x4')]])&&_0x59f19e['channelstate']==0x6){utils[_0x2cd0('0x11')](util[_0x2cd0('0x2')](_0x2cd0('0x17'),_0x59f19e[_0x2cd0('0x4')],_0x59f19e[_0x2cd0('0x14')],_0x59f19e[_0x2cd0('0x15')]));}else if(!_['isNil'](recordings[_0x59f19e[_0x2cd0('0x18')]])&&_0x59f19e[_0x2cd0('0x19')]==0x6&&_0x59f19e['context']!='transfer'){utils[_0x2cd0('0x11')](util['format'](_0x2cd0('0x1a'),_0x59f19e[_0x2cd0('0x4')],_0x59f19e[_0x2cd0('0x18')],_0x59f19e[_0x2cd0('0x14')],_0x59f19e[_0x2cd0('0x15')]));recordings[_0x59f19e['linkedid']][_0x2cd0('0x7')]=_0x59f19e[_0x2cd0('0x7')];}}catch(_0x138cbf){utils['error'](util[_0x2cd0('0x2')](_0x2cd0('0x1b'),_0x59f19e[_0x2cd0('0x4')]),_0x138cbf);}};exports[_0x2cd0('0x1c')]=function(_0x115ae2){try{if(!_[_0x2cd0('0x1d')](_0x115ae2[_0x2cd0('0x1e')])&&!_[_0x2cd0('0x1d')](_0x115ae2[_0x2cd0('0x1e')][_0x2cd0('0x1f')])){utils[_0x2cd0('0xf')](util[_0x2cd0('0x2')](_0x2cd0('0x20'),_0x115ae2[_0x2cd0('0x4')]),_0x115ae2);utils['info'](util[_0x2cd0('0x2')](_0x2cd0('0x21'),_0x115ae2[_0x2cd0('0x4')],_0x115ae2[_0x2cd0('0x1e')],_0x115ae2[_0x2cd0('0x22')]));if(_[_0x2cd0('0x23')](_0x115ae2['value'],'.wav49')){_0x115ae2[_0x2cd0('0x22')]=_0x115ae2[_0x2cd0('0x22')]['replace'](_0x2cd0('0x24'),'.WAV');}if(recordings[_0x115ae2[_0x2cd0('0x18')]]){var _0x2822f5=_[_0x2cd0('0x25')](recordings[_0x115ae2[_0x2cd0('0x18')]][_0x2cd0('0x26')],{'value':_0x115ae2[_0x2cd0('0x22')]});if(_[_0x2cd0('0x1d')](_0x2822f5)){recordings[_0x115ae2[_0x2cd0('0x18')]]['monitors'][_0x2cd0('0x27')]({'value':_0x115ae2[_0x2cd0('0x22')]});}}}}catch(_0x30cb70){utils[_0x2cd0('0x16')](util['format'](_0x2cd0('0x20'),_0x115ae2[_0x2cd0('0x4')]),_0x30cb70);}};exports[_0x2cd0('0x28')]=function(_0x23b322){try{if(!_[_0x2cd0('0x1d')](recordings[_0x23b322['uniqueid']])){utils['debug'](util[_0x2cd0('0x2')](_0x2cd0('0x29'),_0x23b322[_0x2cd0('0x4')]),_0x23b322);utils[_0x2cd0('0x11')](util['format'](_0x2cd0('0x2a'),_0x23b322[_0x2cd0('0x4')],_0x23b322[_0x2cd0('0x2b')],_0x23b322[_0x2cd0('0x2c')],_0x23b322[_0x2cd0('0x2d')]));recordings[_0x23b322['uniqueid']]['calleridnum']=_0x23b322[_0x2cd0('0x2b')];recordings[_0x23b322[_0x2cd0('0x4')]][_0x2cd0('0x2c')]=_0x23b322[_0x2cd0('0x2c')];recordings[_0x23b322[_0x2cd0('0x4')]][_0x2cd0('0x2e')]=_0x23b322[_0x2cd0('0x2e')];recordings[_0x23b322[_0x2cd0('0x4')]][_0x2cd0('0x2f')]=_0x23b322[_0x2cd0('0x2f')];if(recordings[_0x23b322[_0x2cd0('0x4')]]['type']==_0x2cd0('0x30')&&recordings[_0x23b322[_0x2cd0('0x4')]]['accountcode']){recordings[_0x23b322[_0x2cd0('0x4')]][_0x2cd0('0x2e')]=recordings[_0x23b322[_0x2cd0('0x4')]]['accountcode'];recordings[_0x23b322['uniqueid']][_0x2cd0('0x2f')]='';}recordings[_0x23b322[_0x2cd0('0x4')]][_0x2cd0('0x26')][_0x2cd0('0x31')](function(_0x6e7a5){var _0x4e689e=_[_0x2cd0('0x32')](recordings[_0x23b322['uniqueid']]);_0x4e689e['value']=_0x6e7a5[_0x2cd0('0x22')];writeDB(_0x4e689e);});delete recordings[_0x23b322[_0x2cd0('0x4')]];}}catch(_0x122b11){utils[_0x2cd0('0x16')](util[_0x2cd0('0x2')](_0x2cd0('0x29'),_0x23b322[_0x2cd0('0x4')]),_0x122b11);}};exports['newexten']=function(_0x2202b6){try{if(!_[_0x2cd0('0x1d')](recordings[_0x2202b6[_0x2cd0('0x4')]])){utils[_0x2cd0('0xf')](util[_0x2cd0('0x2')](_0x2cd0('0x33'),_0x2202b6[_0x2cd0('0x4')]),_0x2202b6);utils[_0x2cd0('0x11')](util['format'](_0x2cd0('0x34'),_0x2202b6[_0x2cd0('0x4')],_0x2202b6[_0x2cd0('0x35')],_0x2202b6[_0x2cd0('0x36')]));if(_0x2202b6[_0x2cd0('0x35')][_0x2cd0('0x37')]()=='set'&&_['startsWith'](_0x2202b6[_0x2cd0('0x36')][_0x2cd0('0x37')](),_0x2cd0('0x38'))){var _0x477181=_0x2202b6[_0x2cd0('0x36')]['split']('=');var _0x207e6c=_0x477181[0x0][_0x2cd0('0x39')](_0x477181[0x0][_0x2cd0('0x3a')]('(')+0x1,_0x477181[0x0][_0x2cd0('0x3a')](')'));var _0x9a3a73=_0x477181[0x1];recordings[_0x2202b6[_0x2cd0('0x4')]][_0x207e6c]=_0x9a3a73;}}}catch(_0x2ac8e5){utils[_0x2cd0('0x16')](util[_0x2cd0('0x2')](_0x2cd0('0x33'),_0x2202b6[_0x2cd0('0x4')]),_0x2ac8e5);}};exports[_0x2cd0('0x3b')]=function(_0xdca7e1){try{if(!_[_0x2cd0('0x1d')](recordings[_0xdca7e1[_0x2cd0('0x4')]])){utils[_0x2cd0('0xf')](util[_0x2cd0('0x2')](_0x2cd0('0x3c'),_0xdca7e1[_0x2cd0('0x4')]),_0xdca7e1);utils[_0x2cd0('0x11')](util[_0x2cd0('0x2')](_0x2cd0('0x3d'),_0xdca7e1[_0x2cd0('0x4')],_0xdca7e1['queue']));recordings[_0xdca7e1[_0x2cd0('0x4')]]['queue']=_0xdca7e1[_0x2cd0('0x3e')];}}catch(_0x88a0ae){utils['error'](util[_0x2cd0('0x2')]('[%s][recordings][queuecallerjoin]',_0xdca7e1[_0x2cd0('0x4')]),_0x88a0ae);}};exports[_0x2cd0('0x3f')]=function(_0x14ecf6){try{utils[_0x2cd0('0xf')](util[_0x2cd0('0x2')]('[%s][recordings][blindtransfer]',_0x14ecf6[_0x2cd0('0x4')]),_0x14ecf6);utils['info'](util['format'](_0x2cd0('0x40'),_0x14ecf6[_0x2cd0('0x4')],_0x14ecf6['transferercalleridnum'],_0x14ecf6['transferercalleridname'],_0x14ecf6[_0x2cd0('0x41')],_0x14ecf6[_0x2cd0('0x42')]));if(recordings[_0x14ecf6[_0x2cd0('0x43')]]&&transfers[_0x2cd0('0x5')][_0x14ecf6[_0x2cd0('0x43')]]){transfers[_0x2cd0('0x5')][_0x14ecf6[_0x2cd0('0x43')]][_0x2cd0('0x44')]=!![];}}catch(_0x2c92da){utils[_0x2cd0('0x16')](util[_0x2cd0('0x2')]('[%s][recordings][blindtransfer]',_0x14ecf6[_0x2cd0('0x4')]),_0x2c92da);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index c0b92d2..55887f6 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 _0x22d7=['error','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','info','format','type','attended','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','blind'];(function(_0x1d6e91,_0x2e4d7f){var _0x16937c=function(_0x1e704c){while(--_0x1e704c){_0x1d6e91['push'](_0x1d6e91['shift']());}};_0x16937c(++_0x2e4d7f);}(_0x22d7,0x8e));var _0x722d=function(_0x23bdc9,_0x263a65){_0x23bdc9=_0x23bdc9-0x0;var _0x122214=_0x22d7[_0x23bdc9];return _0x122214;};'use strict';var _=require('lodash');var util=require(_0x722d('0x0'));var utils=require(_0x722d('0x1'));function writeDB(_0x579239){utils[_0x722d('0x2')](util[_0x722d('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x579239[_0x722d('0x4')]===_0x722d('0x5')?_0x579239['origtransfereruniqueid']:_0x579239[_0x722d('0x6')],_0x579239[_0x722d('0x4')]));utils[_0x722d('0x7')](_0x722d('0x8'),_0x579239);}exports[_0x722d('0x9')]={};exports[_0x722d('0xa')]=function(_0x32fdb4){try{utils[_0x722d('0xb')](util['format'](_0x722d('0xc'),_0x32fdb4[_0x722d('0x6')]),_0x32fdb4);utils[_0x722d('0x2')](util['format'](_0x722d('0xd'),_0x32fdb4[_0x722d('0x6')],_0x32fdb4[_0x722d('0xe')],_0x32fdb4[_0x722d('0xf')],_0x32fdb4['transfereecalleridnum'],_0x32fdb4[_0x722d('0x10')]));_0x32fdb4[_0x722d('0x4')]=_0x722d('0x11');exports[_0x722d('0x9')][_0x32fdb4['transfereruniqueid']]=_0x32fdb4;writeDB(_0x32fdb4);}catch(_0xc4aafa){utils[_0x722d('0x12')](util[_0x722d('0x3')](_0x722d('0xc'),_0x32fdb4[_0x722d('0x6')]),_0xc4aafa);}};exports['attendedtransfer']=function(_0x1bec3d){try{utils[_0x722d('0xb')](util['format'](_0x722d('0x13'),_0x1bec3d[_0x722d('0x14')]),_0x1bec3d);utils[_0x722d('0x2')](util[_0x722d('0x3')](_0x722d('0x15'),_0x1bec3d[_0x722d('0x14')],_0x1bec3d[_0x722d('0x16')],_0x1bec3d[_0x722d('0x17')],_0x1bec3d[_0x722d('0x18')],_0x1bec3d[_0x722d('0x19')]));_0x1bec3d=_[_0x722d('0x1a')](_0x1bec3d,{'transfererchannel':_0x1bec3d[_0x722d('0x1b')],'transferercalleridnum':_0x1bec3d[_0x722d('0x16')],'transferercalleridname':_0x1bec3d['origtransferercalleridname'],'transfererconnectedlinenum':_0x1bec3d[_0x722d('0x1c')],'transfererconnectedlinename':_0x1bec3d[_0x722d('0x1d')],'transfereraccountcode':_0x1bec3d[_0x722d('0x1e')],'transferercontext':_0x1bec3d['secondtransferercontext'],'transfererexten':_0x1bec3d[_0x722d('0x1f')],'transfererlinkedid':_0x1bec3d[_0x722d('0x20')],'context':_0x1bec3d['origtransferercontext'],'extension':_0x1bec3d[_0x722d('0x21')],'type':_0x722d('0x5')});if(_[_0x722d('0x22')](_0x1bec3d['transfereechannel'])){_0x1bec3d=_['assign'](_0x1bec3d,{'transfereechannel':_0x1bec3d['transfertargetchannel'],'transfereecalleridnum':_0x1bec3d[_0x722d('0x18')],'transfereecalleridname':_0x1bec3d[_0x722d('0x19')],'transfereeconnectedlinenum':_0x1bec3d[_0x722d('0x23')],'transfereeconnectedlinename':_0x1bec3d['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1bec3d[_0x722d('0x24')],'transfereecontext':_0x1bec3d[_0x722d('0x25')],'transfereeexten':_0x1bec3d[_0x722d('0x26')],'transfereelinkedid':_0x1bec3d[_0x722d('0x27')]});}writeDB(_0x1bec3d);}catch(_0x5c45fc){utils[_0x722d('0x12')](util[_0x722d('0x3')](_0x722d('0x13'),_0x1bec3d[_0x722d('0x14')]),_0x5c45fc);}}; \ No newline at end of file +var _0x901d=['error','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid'];(function(_0x651909,_0x15c6b4){var _0x572299=function(_0x5e8a48){while(--_0x5e8a48){_0x651909['push'](_0x651909['shift']());}};_0x572299(++_0x15c6b4);}(_0x901d,0x179));var _0xd901=function(_0x163fa9,_0x504b1d){_0x163fa9=_0x163fa9-0x0;var _0x3297da=_0x901d[_0x163fa9];return _0x3297da;};'use strict';var _=require(_0xd901('0x0'));var util=require('util');var utils=require(_0xd901('0x1'));function writeDB(_0x50330a){utils[_0xd901('0x2')](util[_0xd901('0x3')](_0xd901('0x4'),_0x50330a[_0xd901('0x5')]==='attended'?_0x50330a[_0xd901('0x6')]:_0x50330a[_0xd901('0x7')],_0x50330a[_0xd901('0x5')]));utils['request']('CreateVoiceTransferReport',_0x50330a);}exports[_0xd901('0x8')]={};exports[_0xd901('0x9')]=function(_0xef7822){try{utils[_0xd901('0xa')](util['format'](_0xd901('0xb'),_0xef7822['uniqueid']),_0xef7822);utils[_0xd901('0x2')](util[_0xd901('0x3')](_0xd901('0xc'),_0xef7822['uniqueid'],_0xef7822[_0xd901('0xd')],_0xef7822[_0xd901('0xe')],_0xef7822[_0xd901('0xf')],_0xef7822[_0xd901('0x10')]));_0xef7822[_0xd901('0x5')]=_0xd901('0x11');exports[_0xd901('0x8')][_0xef7822[_0xd901('0x12')]]=_0xef7822;writeDB(_0xef7822);}catch(_0x2a4fb9){utils[_0xd901('0x13')](util[_0xd901('0x3')](_0xd901('0xb'),_0xef7822['uniqueid']),_0x2a4fb9);}};exports[_0xd901('0x14')]=function(_0x4eb044){try{utils['debug'](util['format']('[%s][transfers][attendedtransfer]',_0x4eb044['origtransfereruniqueid']),_0x4eb044);utils[_0xd901('0x2')](util['format'](_0xd901('0x15'),_0x4eb044[_0xd901('0x6')],_0x4eb044[_0xd901('0x16')],_0x4eb044['origtransferercalleridname'],_0x4eb044[_0xd901('0x17')],_0x4eb044[_0xd901('0x18')]));_0x4eb044=_[_0xd901('0x19')](_0x4eb044,{'transfererchannel':_0x4eb044[_0xd901('0x1a')],'transferercalleridnum':_0x4eb044[_0xd901('0x16')],'transferercalleridname':_0x4eb044[_0xd901('0x1b')],'transfererconnectedlinenum':_0x4eb044['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4eb044[_0xd901('0x1c')],'transfereraccountcode':_0x4eb044[_0xd901('0x1d')],'transferercontext':_0x4eb044[_0xd901('0x1e')],'transfererexten':_0x4eb044[_0xd901('0x1f')],'transfererlinkedid':_0x4eb044[_0xd901('0x20')],'context':_0x4eb044[_0xd901('0x21')],'extension':_0x4eb044[_0xd901('0x22')],'type':_0xd901('0x23')});if(_[_0xd901('0x24')](_0x4eb044[_0xd901('0x25')])){_0x4eb044=_['assign'](_0x4eb044,{'transfereechannel':_0x4eb044[_0xd901('0x26')],'transfereecalleridnum':_0x4eb044[_0xd901('0x17')],'transfereecalleridname':_0x4eb044[_0xd901('0x18')],'transfereeconnectedlinenum':_0x4eb044[_0xd901('0x27')],'transfereeconnectedlinename':_0x4eb044[_0xd901('0x28')],'transfereeaccountcode':_0x4eb044['transfertargetaccountcode'],'transfereecontext':_0x4eb044[_0xd901('0x29')],'transfereeexten':_0x4eb044['transfertargetexten'],'transfereelinkedid':_0x4eb044[_0xd901('0x2a')]});}writeDB(_0x4eb044);}catch(_0x157361){utils['error'](util[_0xd901('0x3')](_0xd901('0x2b'),_0x4eb044[_0xd901('0x6')]),_0x157361);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 4862ae3..7a5284f 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 _0x4e93=['inspect','debug','error','request','then','catch','[utils][request]\x20name:%s','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','seconds','subtractTime','subtract','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','sumTime','now','isAfter','bluebird','jayson/promise','moment','client','../../config/logger','xdr','info'];(function(_0x37a7bc,_0x1220db){var _0x2e5f63=function(_0x1c37a2){while(--_0x1c37a2){_0x37a7bc['push'](_0x37a7bc['shift']());}};_0x2e5f63(++_0x1220db);}(_0x4e93,0x171));var _0x34e9=function(_0x158da6,_0x3cb06d){_0x158da6=_0x158da6-0x0;var _0x429c30=_0x4e93[_0x158da6];return _0x429c30;};'use strict';var BPromise=require(_0x34e9('0x0'));var jayson=require(_0x34e9('0x1'));var moment=require(_0x34e9('0x2'));var util=require('util');var client=jayson[_0x34e9('0x3')]['http']({'port':0x2329});var logger=require(_0x34e9('0x4'))(_0x34e9('0x5'));exports[_0x34e9('0x6')]=function(_0x2d9491,_0x5d5bc0){logger['info'](_0x2d9491,_0x5d5bc0?util[_0x34e9('0x7')](_0x5d5bc0,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x7ed67a,_0x33adc9){logger[_0x34e9('0x8')](_0x7ed67a,_0x33adc9?util[_0x34e9('0x7')](_0x33adc9,{'showHidden':![],'depth':null}):'');};exports[_0x34e9('0x9')]=function(_0x1d8506,_0x2acbb4){logger[_0x34e9('0x9')](_0x1d8506,_0x2acbb4?util[_0x34e9('0x7')](_0x2acbb4,{'showHidden':![],'depth':null}):'');};exports[_0x34e9('0xa')]=function(_0x127b2a,_0x348eed){return client['request'](_0x127b2a,{'body':_0x348eed})[_0x34e9('0xb')](function(_0x7dbf41){logger[_0x34e9('0x8')]('[utils][request]\x20name:%s',_0x127b2a,_0x7dbf41?util[_0x34e9('0x7')](_0x7dbf41,{'showHidden':![],'depth':null}):'');})[_0x34e9('0xc')](function(_0x1927a4){logger['error'](_0x34e9('0xd'),_0x127b2a,_0x1927a4?util[_0x34e9('0x7')](_0x1927a4,{'showHidden':![],'depth':null}):'');});};function getUser(_0x75d7db){return client[_0x34e9('0xa')](_0x34e9('0xe'),{'options':{'raw':!![],'attributes':['id',_0x34e9('0xf'),_0x34e9('0x10'),_0x34e9('0x11')],'where':_0x75d7db,'limit':0x1}})[_0x34e9('0xb')](function(_0x14ede2){logger[_0x34e9('0x8')](_0x34e9('0x12'),JSON[_0x34e9('0x13')](_0x75d7db),_0x14ede2?util[_0x34e9('0x7')](_0x14ede2,{'showHidden':![],'depth':null}):'');return _0x14ede2[_0x34e9('0x14')][_0x34e9('0x15')]?_0x14ede2['result'][0x0]:null;});}exports[_0x34e9('0x16')]=function(_0x1c72f2){return new BPromise(function(_0x30f80b,_0x5eee0d){if(_0x1c72f2){return getUser({'internal':_0x1c72f2})[_0x34e9('0xb')](function(_0x70eb45){logger[_0x34e9('0x6')](_0x34e9('0x17'),_0x1c72f2,_0x70eb45?_0x34e9('0x18'):'notfound');return _0x30f80b(_0x70eb45);})[_0x34e9('0xc')](function(_0x429372){logger[_0x34e9('0x9')](_0x34e9('0x19'),_0x429372?util[_0x34e9('0x7')](_0x429372,{'showHidden':![],'depth':null}):'');return _0x30f80b(null);});}return _0x30f80b(null);});};exports[_0x34e9('0x1a')]=function(_0x35f737){return new BPromise(function(_0x24a95d,_0x7879e7){if(_0x35f737){return getUser({'interface':_0x35f737})[_0x34e9('0xb')](function(_0x303cd4){logger[_0x34e9('0x6')](_0x34e9('0x1b'),_0x35f737,_0x303cd4?_0x34e9('0x18'):_0x34e9('0x1c'));return _0x24a95d(_0x303cd4);})[_0x34e9('0xc')](function(_0xead535){logger[_0x34e9('0x9')](_0x34e9('0x1d'),_0xead535?util['inspect'](_0xead535,{'showHidden':![],'depth':null}):'');return _0x24a95d(null);});}return _0x24a95d(null);});};exports[_0x34e9('0x1e')]=function(_0x1bd763){return new BPromise(function(_0x1e1198,_0x54f103){if(_0x1bd763){return getUser({'name':_0x1bd763})[_0x34e9('0xb')](function(_0x11e84d){logger[_0x34e9('0x6')](_0x34e9('0x1f'),_0x1bd763,_0x11e84d?_0x34e9('0x18'):_0x34e9('0x1c'));return _0x1e1198(_0x11e84d);})[_0x34e9('0xc')](function(_0x573c60){logger['error'](_0x34e9('0x20'),_0x573c60?util[_0x34e9('0x7')](_0x573c60,{'showHidden':![],'depth':null}):'');return _0x1e1198(null);});}return _0x1e1198(null);});};exports[_0x34e9('0x21')]=function(_0x2bb468){return new BPromise(function(_0x49f197,_0xe510e6){if(_0x2bb468){return client['request'](_0x34e9('0x22'),{'options':{'raw':!![],'attributes':['id','name',_0x34e9('0x23'),'acw','acwTimeout'],'where':{'name':_0x2bb468},'limit':0x1}})['then'](function(_0x14c841){logger[_0x34e9('0x8')](_0x34e9('0x24'),_0x2bb468,_0x14c841?util[_0x34e9('0x7')](_0x14c841,{'showHidden':![],'depth':null}):'');logger[_0x34e9('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x2bb468,_0x14c841?_0x34e9('0x18'):_0x34e9('0x1c'));return _0x49f197(_0x14c841['result'][_0x34e9('0x15')]?_0x14c841['result'][0x0]:null);})[_0x34e9('0xc')](function(_0x59fa74){logger[_0x34e9('0x9')](_0x34e9('0x25'),_0x59fa74?util['inspect'](_0x59fa74,{'showHidden':![],'depth':null}):'');return _0x49f197(null);});}return _0x49f197(null);});};exports['addTime']=function(_0x2636c3,_0x155a10){return moment(_0x2636c3)['add'](_0x155a10,_0x34e9('0x26'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x34e9('0x27')]=function(_0xb51e75,_0x14814f){return moment(_0xb51e75)[_0x34e9('0x28')](_0x14814f,_0x34e9('0x26'))[_0x34e9('0x29')](_0x34e9('0x2a'));};exports[_0x34e9('0x2b')]=function(_0x4b3479,_0x22434a){return moment(_0x4b3479)['diff'](moment(_0x22434a),_0x34e9('0x26'));};exports[_0x34e9('0x2c')]=function(_0x4689db,_0x1df80e){return parseInt(_0x4689db,0xa)+parseInt(_0x1df80e,0xa);};exports[_0x34e9('0x2d')]=function(){return moment()[_0x34e9('0x29')](_0x34e9('0x2a'));};exports['isAfter']=function(_0x43da1d,_0x47d10a){if(_0x47d10a){return moment(_0x43da1d)[_0x34e9('0x2e')](_0x47d10a);}return!![];};exports['isBefore']=function(_0x3e9339,_0x1d9d57){if(_0x1d9d57){return moment(_0x3e9339)['isBefore'](_0x1d9d57);}else if(_0x3e9339){return!![];}return![];}; \ No newline at end of file +var _0xac98=['notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[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','client','../../config/logger','info','inspect','debug','error','request','then','catch','[utils][request]\x20name:%s','GetUser','internal','name','[utils][getUser]\x20where:%s','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xac98,0x7a));var _0x8ac9=function(_0x201ffd,_0x21f711){_0x201ffd=_0x201ffd-0x0;var _0x58d969=_0xac98[_0x201ffd];return _0x58d969;};'use strict';var BPromise=require(_0x8ac9('0x0'));var jayson=require('jayson/promise');var moment=require(_0x8ac9('0x1'));var util=require(_0x8ac9('0x2'));var client=jayson[_0x8ac9('0x3')]['http']({'port':0x2329});var logger=require(_0x8ac9('0x4'))('xdr');exports[_0x8ac9('0x5')]=function(_0x12d36d,_0x550d2d){logger[_0x8ac9('0x5')](_0x12d36d,_0x550d2d?util[_0x8ac9('0x6')](_0x550d2d,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x3e190d,_0x5cbd40){logger[_0x8ac9('0x7')](_0x3e190d,_0x5cbd40?util['inspect'](_0x5cbd40,{'showHidden':![],'depth':null}):'');};exports[_0x8ac9('0x8')]=function(_0x4726e2,_0x3d6e21){logger[_0x8ac9('0x8')](_0x4726e2,_0x3d6e21?util[_0x8ac9('0x6')](_0x3d6e21,{'showHidden':![],'depth':null}):'');};exports[_0x8ac9('0x9')]=function(_0x54d47d,_0x3ba4b2){return client[_0x8ac9('0x9')](_0x54d47d,{'body':_0x3ba4b2})[_0x8ac9('0xa')](function(_0x2f04c8){logger[_0x8ac9('0x7')]('[utils][request]\x20name:%s',_0x54d47d,_0x2f04c8?util['inspect'](_0x2f04c8,{'showHidden':![],'depth':null}):'');})[_0x8ac9('0xb')](function(_0x3cfa3a){logger[_0x8ac9('0x8')](_0x8ac9('0xc'),_0x54d47d,_0x3cfa3a?util[_0x8ac9('0x6')](_0x3cfa3a,{'showHidden':![],'depth':null}):'');});};function getUser(_0x386366){return client['request'](_0x8ac9('0xd'),{'options':{'raw':!![],'attributes':['id',_0x8ac9('0xe'),_0x8ac9('0xf'),'interface'],'where':_0x386366,'limit':0x1}})['then'](function(_0x4c336d){logger[_0x8ac9('0x7')](_0x8ac9('0x10'),JSON['stringify'](_0x386366),_0x4c336d?util['inspect'](_0x4c336d,{'showHidden':![],'depth':null}):'');return _0x4c336d[_0x8ac9('0x11')][_0x8ac9('0x12')]?_0x4c336d[_0x8ac9('0x11')][0x0]:null;});}exports[_0x8ac9('0x13')]=function(_0x4a50da){return new BPromise(function(_0x13dca6,_0x2281e9){if(_0x4a50da){return getUser({'internal':_0x4a50da})[_0x8ac9('0xa')](function(_0xcbf281){logger['info'](_0x8ac9('0x14'),_0x4a50da,_0xcbf281?_0x8ac9('0x15'):_0x8ac9('0x16'));return _0x13dca6(_0xcbf281);})[_0x8ac9('0xb')](function(_0x3b41fd){logger[_0x8ac9('0x8')](_0x8ac9('0x17'),_0x3b41fd?util[_0x8ac9('0x6')](_0x3b41fd,{'showHidden':![],'depth':null}):'');return _0x13dca6(null);});}return _0x13dca6(null);});};exports[_0x8ac9('0x18')]=function(_0x2bcfb3){return new BPromise(function(_0x5a796d,_0x4188e5){if(_0x2bcfb3){return getUser({'interface':_0x2bcfb3})['then'](function(_0x52b3ac){logger[_0x8ac9('0x5')](_0x8ac9('0x19'),_0x2bcfb3,_0x52b3ac?_0x8ac9('0x15'):_0x8ac9('0x16'));return _0x5a796d(_0x52b3ac);})[_0x8ac9('0xb')](function(_0x2acdaa){logger[_0x8ac9('0x8')](_0x8ac9('0x1a'),_0x2acdaa?util['inspect'](_0x2acdaa,{'showHidden':![],'depth':null}):'');return _0x5a796d(null);});}return _0x5a796d(null);});};exports[_0x8ac9('0x1b')]=function(_0x4a5269){return new BPromise(function(_0x45742c,_0x15cd41){if(_0x4a5269){return getUser({'name':_0x4a5269})['then'](function(_0x22c41e){logger['info']('[utils][getUserByName]\x20name:%s\x20%s',_0x4a5269,_0x22c41e?_0x8ac9('0x15'):'notfound');return _0x45742c(_0x22c41e);})[_0x8ac9('0xb')](function(_0x1d3a25){logger['error'](_0x8ac9('0x1c'),_0x1d3a25?util[_0x8ac9('0x6')](_0x1d3a25,{'showHidden':![],'depth':null}):'');return _0x45742c(null);});}return _0x45742c(null);});};exports[_0x8ac9('0x1d')]=function(_0x3aa181){return new BPromise(function(_0x247e5a,_0x46d235){if(_0x3aa181){return client['request'](_0x8ac9('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x8ac9('0xf'),_0x8ac9('0x1f'),'acw',_0x8ac9('0x20')],'where':{'name':_0x3aa181},'limit':0x1}})[_0x8ac9('0xa')](function(_0x20feca){logger['debug'](_0x8ac9('0x21'),_0x3aa181,_0x20feca?util[_0x8ac9('0x6')](_0x20feca,{'showHidden':![],'depth':null}):'');logger[_0x8ac9('0x5')](_0x8ac9('0x22'),_0x3aa181,_0x20feca?_0x8ac9('0x15'):_0x8ac9('0x16'));return _0x247e5a(_0x20feca[_0x8ac9('0x11')]['length']?_0x20feca[_0x8ac9('0x11')][0x0]:null);})[_0x8ac9('0xb')](function(_0x52b121){logger['error'](_0x8ac9('0x23'),_0x52b121?util[_0x8ac9('0x6')](_0x52b121,{'showHidden':![],'depth':null}):'');return _0x247e5a(null);});}return _0x247e5a(null);});};exports[_0x8ac9('0x24')]=function(_0x3d1d8b,_0x13d6b4){return moment(_0x3d1d8b)[_0x8ac9('0x25')](_0x13d6b4,_0x8ac9('0x26'))[_0x8ac9('0x27')](_0x8ac9('0x28'));};exports['subtractTime']=function(_0x376474,_0xdbcc2e){return moment(_0x376474)[_0x8ac9('0x29')](_0xdbcc2e,_0x8ac9('0x26'))[_0x8ac9('0x27')](_0x8ac9('0x28'));};exports[_0x8ac9('0x2a')]=function(_0x4a8748,_0x105cea){return moment(_0x4a8748)[_0x8ac9('0x2b')](moment(_0x105cea),_0x8ac9('0x26'));};exports[_0x8ac9('0x2c')]=function(_0x3588ea,_0xceb637){return parseInt(_0x3588ea,0xa)+parseInt(_0xceb637,0xa);};exports[_0x8ac9('0x2d')]=function(){return moment()[_0x8ac9('0x27')](_0x8ac9('0x28'));};exports[_0x8ac9('0x2e')]=function(_0x4ceb63,_0x48ed8e){if(_0x48ed8e){return moment(_0x4ceb63)['isAfter'](_0x48ed8e);}return!![];};exports['isBefore']=function(_0x56b850,_0x224d8e){if(_0x224d8e){return moment(_0x56b850)[_0x8ac9('0x2f')](_0x224d8e);}else if(_0x56b850){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 7e79e46..37a4179 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c59=['x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','agent_name','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','./mask-sensitive-data','join','log','xcally','role','name','ensureDir','then','client','catch','user','no-user','data','timestamp','error','api','auth','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers'];(function(_0x1b1439,_0x1be3d5){var _0x5e1890=function(_0x41406d){while(--_0x41406d){_0x1b1439['push'](_0x1b1439['shift']());}};_0x5e1890(++_0x1be3d5);}(_0x8c59,0x96));var _0x98c5=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8c59[_0x3b380d];return _0x54502b;};var fs=require(_0x98c5('0x0'));var _=require(_0x98c5('0x1'));var ewinston=require(_0x98c5('0x2'));var path=require(_0x98c5('0x3'));var util=require(_0x98c5('0x4'));var fileLogger=require(_0x98c5('0x5'))[_0x98c5('0x6')];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require(_0x98c5('0x7'))['maskSensitiveData'];function ClientSideLogger(){function _0x9e5e80(_0x5361ca){var _0x4897f5=path[_0x98c5('0x8')]('/var',_0x98c5('0x9'),_0x98c5('0xa'));var _0x165be0=path[_0x98c5('0x8')]('client',_0x5361ca[_0x98c5('0xb')]+'-'+_0x5361ca[_0x98c5('0xc')]);return fs[_0x98c5('0xd')](path[_0x98c5('0x8')](_0x4897f5,_0x165be0))[_0x98c5('0xe')](function(){var _0x1b6d3=fileLogger(_0x98c5('0xf'),path['join'](_0x4897f5,_0x165be0));return _0x1b6d3;})[_0x98c5('0x10')](function(_0x1a422b){throw _0x1a422b;});}this['log']=function(_0x1e88a6,_0x22baee,_0x100995,_0x3e2ac8){return _0x9e5e80(_0x1e88a6[_0x98c5('0x11')])[_0x98c5('0xe')](function(_0x1ac5f9){var _0x3218f2=_0x1ac5f9[_0x22baee];return _0x3218f2;})[_0x98c5('0xe')](function(_0x27b94a){var _0x2d1f9e=_0x1e88a6['user']?_0x1e88a6['user']['id']:_0x98c5('0x12');var _0x42cd21=_0x3e2ac8[_0x98c5('0x13')];var _0x139ccc=_0x3e2ac8[_0x98c5('0x14')];var _0x3f5c68=new Date(Number(_0x139ccc));return _0x27b94a(_0x2d1f9e,_0x3f5c68,_0x100995,_0x42cd21);})['catch'](function(_0x5631fb){fileLogger('client')[_0x98c5('0x15')](_0x5631fb);});};}function setupLoggers(_0x14ef2b){return new Promise(function(_0x126381){var _0x730eb6=new ClientSideLogger();var _0x181fcf=fileLogger(_0x98c5('0x16'));var _0x48c4cf=fileLogger(_0x98c5('0x17'));_0x14ef2b['set'](_0x98c5('0x18'),_0x730eb6);_0x14ef2b[_0x98c5('0x19')](ewinston[_0x98c5('0x1a')]({'winstonInstance':_0x181fcf,'meta':![],'statusLevels':!![],'msg':function(_0x446ddc,_0x179560){var _0x5809f3=_0x98c5('0x1b');if(!_[_0x98c5('0x1c')](_0x446ddc[_0x98c5('0x1d')])){_0x5809f3+=_0x98c5('0x1e');var _0x275aba=_0x446ddc[_0x98c5('0x1d')];maskSensitiveData(_0x275aba);}return safeTemplate(util[_0x98c5('0x1f')](_0x5809f3,_0x446ddc[_0x98c5('0x20')],_0x446ddc[_0x98c5('0x21')][_0x98c5('0x22')]?_0x446ddc[_0x98c5('0x21')][_0x98c5('0x22')]:_0x446ddc[_0x98c5('0x23')][_0x98c5('0x24')]||_0x446ddc['ip'],_0x446ddc[_0x98c5('0x25')],_0x179560[_0x98c5('0x26')],_0x179560[_0x98c5('0x27')],_0x446ddc[_0x98c5('0x11')]?_0x446ddc['user']['id']:null,_0x446ddc[_0x98c5('0x11')]?_0x446ddc[_0x98c5('0x11')]['name']:null,_0x446ddc[_0x98c5('0x11')]?_0x446ddc[_0x98c5('0x11')][_0x98c5('0xb')]:null,_0x275aba?util[_0x98c5('0x28')](_0x275aba,![],null):''));}}));_0x14ef2b[_0x98c5('0x19')](ewinston['logger']({'winstonInstance':_0x48c4cf,'meta':![],'statusLevels':!![],'msg':function(_0x387045,_0x35a447){var _0x223a3e=_0x98c5('0x29');if(_0x387045[_0x98c5('0x1d')]&&_0x387045[_0x98c5('0x1d')][_0x98c5('0x2a')]&&_0x387045[_0x98c5('0x1d')][_0x98c5('0x2b')]){_0x223a3e=_0x98c5('0x2c');}return util['format'](_0x223a3e,_0x387045[_0x98c5('0x20')],_0x387045['headers'][_0x98c5('0x22')]?_0x387045[_0x98c5('0x21')]['x-forwarded-for']:_0x387045[_0x98c5('0x23')][_0x98c5('0x24')]||_0x387045['ip'],_0x387045[_0x98c5('0x25')],_0x35a447[_0x98c5('0x26')],_0x35a447['responseTime'],_0x387045[_0x98c5('0x11')]?_0x387045[_0x98c5('0x11')]['id']:null,_0x387045[_0x98c5('0x11')]?_0x387045[_0x98c5('0x11')]['name']:null,_0x387045['user']?_0x387045[_0x98c5('0x11')][_0x98c5('0xb')]:null,_0x387045[_0x98c5('0x1d')]&&_0x387045[_0x98c5('0x1d')][_0x98c5('0x2a')]?_0x387045[_0x98c5('0x1d')]['device']:'other',_0x387045[_0x98c5('0x1d')]&&_0x387045[_0x98c5('0x1d')]['agent_id']?_0x387045['body'][_0x98c5('0x2b')]:'',_0x387045[_0x98c5('0x1d')]&&_0x387045[_0x98c5('0x1d')][_0x98c5('0x2d')]?_0x387045[_0x98c5('0x1d')][_0x98c5('0x2d')]:'');},'ignoreRoute':function(_0x541829){var _0x223f46=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x223f46['test'](_0x541829['url']);}}));return _0x126381();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x05b6=['test','setupLoggers','fs-extra','lodash','express-winston','path','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','log','xcally','role','name','then','client','catch','user','error','auth','set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','method','headers','x-forwarded-for','remoteAddress','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','url','other','agent_name'];(function(_0x556e75,_0x244403){var _0xd46094=function(_0x164334){while(--_0x164334){_0x556e75['push'](_0x556e75['shift']());}};_0xd46094(++_0x244403);}(_0x05b6,0x162));var _0x605b=function(_0x4d06fb,_0x55390d){_0x4d06fb=_0x4d06fb-0x0;var _0x2e42fc=_0x05b6[_0x4d06fb];return _0x2e42fc;};var fs=require(_0x605b('0x0'));var _=require(_0x605b('0x1'));var ewinston=require(_0x605b('0x2'));var path=require(_0x605b('0x3'));var util=require('util');var fileLogger=require(_0x605b('0x4'))[_0x605b('0x5')];var safeTemplate=require(_0x605b('0x6'))[_0x605b('0x7')];var maskSensitiveData=require(_0x605b('0x8'))[_0x605b('0x9')];function ClientSideLogger(){function _0x8575c8(_0x2e9461){var _0x45fd26=path[_0x605b('0xa')]('/var',_0x605b('0xb'),_0x605b('0xc'));var _0xa4e96e=path[_0x605b('0xa')]('client',_0x2e9461[_0x605b('0xd')]+'-'+_0x2e9461[_0x605b('0xe')]);return fs['ensureDir'](path[_0x605b('0xa')](_0x45fd26,_0xa4e96e))[_0x605b('0xf')](function(){var _0xff5bc5=fileLogger(_0x605b('0x10'),path[_0x605b('0xa')](_0x45fd26,_0xa4e96e));return _0xff5bc5;})[_0x605b('0x11')](function(_0x22c7b9){throw _0x22c7b9;});}this['log']=function(_0x2a570d,_0x4288da,_0x5076a0,_0x20e038){return _0x8575c8(_0x2a570d[_0x605b('0x12')])[_0x605b('0xf')](function(_0x5aede8){var _0x2ed598=_0x5aede8[_0x4288da];return _0x2ed598;})[_0x605b('0xf')](function(_0x2d95ef){var _0x5a9ca1=_0x2a570d['user']?_0x2a570d['user']['id']:'no-user';var _0x3a783c=_0x20e038['data'];var _0xc943d3=_0x20e038['timestamp'];var _0x55b5f2=new Date(Number(_0xc943d3));return _0x2d95ef(_0x5a9ca1,_0x55b5f2,_0x5076a0,_0x3a783c);})['catch'](function(_0x500388){fileLogger(_0x605b('0x10'))[_0x605b('0x13')](_0x500388);});};}function setupLoggers(_0x22160d){return new Promise(function(_0x208999){var _0x31aef9=new ClientSideLogger();var _0x34291c=fileLogger('api');var _0x2dda24=fileLogger(_0x605b('0x14'));_0x22160d[_0x605b('0x15')]('client-side-logger',_0x31aef9);_0x22160d[_0x605b('0x16')](ewinston[_0x605b('0x17')]({'winstonInstance':_0x34291c,'meta':![],'statusLevels':!![],'msg':function(_0xd53b6f,_0x5d7e03){var _0x331863=_0x605b('0x18');if(!_['isEmpty'](_0xd53b6f[_0x605b('0x19')])){_0x331863+=_0x605b('0x1a');var _0x831af2=_0xd53b6f[_0x605b('0x19')];maskSensitiveData(_0x831af2);}return safeTemplate(util['format'](_0x331863,_0xd53b6f[_0x605b('0x1b')],_0xd53b6f[_0x605b('0x1c')][_0x605b('0x1d')]?_0xd53b6f['headers'][_0x605b('0x1d')]:_0xd53b6f['connection'][_0x605b('0x1e')]||_0xd53b6f['ip'],_0xd53b6f['url'],_0x5d7e03[_0x605b('0x1f')],_0x5d7e03[_0x605b('0x20')],_0xd53b6f['user']?_0xd53b6f[_0x605b('0x12')]['id']:null,_0xd53b6f[_0x605b('0x12')]?_0xd53b6f[_0x605b('0x12')][_0x605b('0xe')]:null,_0xd53b6f[_0x605b('0x12')]?_0xd53b6f[_0x605b('0x12')][_0x605b('0xd')]:null,_0x831af2?util[_0x605b('0x21')](_0x831af2,![],null):''));}}));_0x22160d[_0x605b('0x16')](ewinston[_0x605b('0x17')]({'winstonInstance':_0x2dda24,'meta':![],'statusLevels':!![],'msg':function(_0x35a9df,_0x5fd999){var _0x19b39d=_0x605b('0x22');if(_0x35a9df['body']&&_0x35a9df[_0x605b('0x19')][_0x605b('0x23')]&&_0x35a9df[_0x605b('0x19')][_0x605b('0x24')]){_0x19b39d=_0x605b('0x25');}return util[_0x605b('0x26')](_0x19b39d,_0x35a9df[_0x605b('0x1b')],_0x35a9df['headers'][_0x605b('0x1d')]?_0x35a9df[_0x605b('0x1c')][_0x605b('0x1d')]:_0x35a9df['connection'][_0x605b('0x1e')]||_0x35a9df['ip'],_0x35a9df[_0x605b('0x27')],_0x5fd999['statusCode'],_0x5fd999[_0x605b('0x20')],_0x35a9df[_0x605b('0x12')]?_0x35a9df[_0x605b('0x12')]['id']:null,_0x35a9df[_0x605b('0x12')]?_0x35a9df[_0x605b('0x12')][_0x605b('0xe')]:null,_0x35a9df[_0x605b('0x12')]?_0x35a9df[_0x605b('0x12')][_0x605b('0xd')]:null,_0x35a9df[_0x605b('0x19')]&&_0x35a9df['body'][_0x605b('0x23')]?_0x35a9df['body'][_0x605b('0x23')]:_0x605b('0x28'),_0x35a9df['body']&&_0x35a9df[_0x605b('0x19')][_0x605b('0x24')]?_0x35a9df[_0x605b('0x19')][_0x605b('0x24')]:'',_0x35a9df['body']&&_0x35a9df[_0x605b('0x19')][_0x605b('0x29')]?_0x35a9df[_0x605b('0x19')][_0x605b('0x29')]:'');},'ignoreRoute':function(_0x55fd3f){var _0x887ae4=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x887ae4[_0x605b('0x2a')](_0x55fd3f[_0x605b('0x27')]);}}));return _0x208999();});}exports[_0x605b('0x2b')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index d51aaef..e89ba8e 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87d4=['message','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','format','%s-%s.log','{{{','}}}','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x87d4,0x1bb));var _0x487d=function(_0x2b8da0,_0x10a1be){_0x2b8da0=_0x2b8da0-0x0;var _0xc160b0=_0x87d4[_0x2b8da0];return _0xc160b0;};'use strict';var path=require('path');var util=require('util');var moment=require('moment');var winston=require(_0x487d('0x0'));var config=require(_0x487d('0x1'));var debugLevel=config[_0x487d('0x2')]?config['debugLevel'][_0x487d('0x3')]():_0x487d('0x4');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x487d('0x5'),'error':_0x487d('0x6'),'warn':_0x487d('0x7'),'info':'white','print':_0x487d('0x8'),'success':_0x487d('0x9'),'http':_0x487d('0xa'),'verbose':_0x487d('0xb'),'debug':_0x487d('0xc'),'silly':_0x487d('0xd')};winston[_0x487d('0xe')](XC_LOG_COLORS);function getLogFileName(_0x1d9114,_0x28f13e,_0x30854e){var _0x307471=_0x1d9114||_0x487d('0xf');return path['join'](_0x307471,util[_0x487d('0x10')](_0x487d('0x11'),_0x28f13e,_0x30854e));}function formatter(_0x32c82a,_0xd720ca){_0xd720ca['message']=_0xd720ca['message']['replace'](/@@{/g,_0x487d('0x12'))['replace'](/}@@/g,_0x487d('0x13'))[_0x487d('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x487d('0x15'),moment()['format'](_0x487d('0x16')),_0xd720ca[_0x487d('0x17')][_0x487d('0x18')](),_0x32c82a,_0xd720ca[_0x487d('0x19')]);}function fileFormat(_0x2b81ed,_0x189624){_0x189624['message']=_0x189624[_0x487d('0x19')][_0x487d('0x14')](/@@{/g,_0x487d('0x12'))[_0x487d('0x14')](/}@@/g,_0x487d('0x13'))['replace'](/@{/g,'{{')[_0x487d('0x14')](/}@/g,'}}');var _0x2c6125=_0x189624[_0x487d('0x1a')]&&Object['keys'](_0x189624[_0x487d('0x1a')])[_0x487d('0x1b')]?'\x0a\x09'+JSON[_0x487d('0x1c')](_0x189624[_0x487d('0x1a')]):'';return util[_0x487d('0x10')](_0x487d('0x1d'),moment()[_0x487d('0x10')](_0x487d('0x16')),_0x189624[_0x487d('0x17')][_0x487d('0x18')](),_0x2b81ed,_0x189624[_0x487d('0x19')],_0x2c6125);}function consoleLogger(){var _0x4ad11b=new winston[(_0x487d('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x487d('0x1f'))][(_0x487d('0x20'))]({'level':_0x487d('0x21'),'json':![],'formatter':function(_0x56f33d){return formatter('',_0x56f33d);}})]});return _0x4ad11b;}function fileLogger(_0x43637d,_0x859112){var _0xd156e0=new winston[(_0x487d('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x487d('0x1f'))][(_0x487d('0x22'))]({'name':util[_0x487d('0x10')](_0x487d('0x23'),_0x43637d,_0x487d('0x24')),'filename':getLogFileName(_0x859112,_0x43637d,'error'),'level':_0x487d('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1471dc){return fileFormat(_0x43637d,_0x1471dc);}}),new winston[(_0x487d('0x1f'))][(_0x487d('0x22'))]({'name':util[_0x487d('0x10')](_0x487d('0x23'),_0x43637d,debugLevel),'filename':getLogFileName(_0x859112,_0x43637d,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x28ce8f){return fileFormat(_0x43637d,_0x28ce8f);}}),new winston[(_0x487d('0x1f'))][(_0x487d('0x20'))]({'level':_0x487d('0x21'),'json':![],'formatter':function(_0x61a5ad){return fileFormat(_0x43637d,_0x61a5ad);}})]});return _0xd156e0;}exports[_0x487d('0x25')]=consoleLogger;exports[_0x487d('0x26')]=fileLogger; \ No newline at end of file +var _0x4063=['consoleLogger','fileLogger','util','moment','winston','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','%s-%s.log','message','{{{','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','length','stringify','transports','Console','warn','%s-%s','error','File'];(function(_0x2ac534,_0x1f1538){var _0x48aa6f=function(_0x5de66b){while(--_0x5de66b){_0x2ac534['push'](_0x2ac534['shift']());}};_0x48aa6f(++_0x1f1538);}(_0x4063,0xec));var _0x3406=function(_0x206b07,_0x30ee32){_0x206b07=_0x206b07-0x0;var _0x55de27=_0x4063[_0x206b07];return _0x55de27;};'use strict';var path=require('path');var util=require(_0x3406('0x0'));var moment=require(_0x3406('0x1'));var winston=require(_0x3406('0x2'));var config=require('../config/environment');var debugLevel=config[_0x3406('0x3')]?config[_0x3406('0x3')][_0x3406('0x4')]():_0x3406('0x5');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x3406('0x6'),'error':_0x3406('0x7'),'warn':_0x3406('0x8'),'info':_0x3406('0x9'),'print':_0x3406('0xa'),'success':_0x3406('0xb'),'http':_0x3406('0xc'),'verbose':_0x3406('0xd'),'debug':_0x3406('0xe'),'silly':_0x3406('0xf')};winston[_0x3406('0x10')](XC_LOG_COLORS);function getLogFileName(_0x16ed21,_0x256380,_0x21b7cc){var _0x43023b=_0x16ed21||_0x3406('0x11');return path['join'](_0x43023b,util['format'](_0x3406('0x12'),_0x256380,_0x21b7cc));}function formatter(_0x357a47,_0x4e3363){_0x4e3363[_0x3406('0x13')]=_0x4e3363[_0x3406('0x13')]['replace'](/@@{/g,_0x3406('0x14'))[_0x3406('0x15')](/}@@/g,_0x3406('0x16'))['replace'](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x3406('0x17')](_0x3406('0x18'),moment()[_0x3406('0x17')](_0x3406('0x19')),_0x4e3363[_0x3406('0x1a')][_0x3406('0x1b')](),_0x357a47,_0x4e3363[_0x3406('0x13')]);}function fileFormat(_0x2941e2,_0x26bb1e){_0x26bb1e[_0x3406('0x13')]=_0x26bb1e['message'][_0x3406('0x15')](/@@{/g,_0x3406('0x14'))[_0x3406('0x15')](/}@@/g,_0x3406('0x16'))[_0x3406('0x15')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x3987d8=_0x26bb1e[_0x3406('0x1c')]&&Object['keys'](_0x26bb1e['meta'])[_0x3406('0x1d')]?'\x0a\x09'+JSON[_0x3406('0x1e')](_0x26bb1e[_0x3406('0x1c')]):'';return util[_0x3406('0x17')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x3406('0x17')](_0x3406('0x19')),_0x26bb1e['level']['toUpperCase'](),_0x2941e2,_0x26bb1e['message'],_0x3987d8);}function consoleLogger(){var _0x27d3e8=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x3406('0x1f'))][(_0x3406('0x20'))]({'level':_0x3406('0x21'),'json':![],'formatter':function(_0x44c082){return formatter('',_0x44c082);}})]});return _0x27d3e8;}function fileLogger(_0x360f4f,_0x1a85b4){var _0x5675ad=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x3406('0x1f'))]['File']({'name':util[_0x3406('0x17')](_0x3406('0x22'),_0x360f4f,'error'),'filename':getLogFileName(_0x1a85b4,_0x360f4f,_0x3406('0x23')),'level':_0x3406('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4f7c76){return fileFormat(_0x360f4f,_0x4f7c76);}}),new winston[(_0x3406('0x1f'))][(_0x3406('0x24'))]({'name':util['format'](_0x3406('0x22'),_0x360f4f,debugLevel),'filename':getLogFileName(_0x1a85b4,_0x360f4f,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2812dd){return fileFormat(_0x360f4f,_0x2812dd);}}),new winston['transports']['Console']({'level':_0x3406('0x21'),'json':![],'formatter':function(_0x4e78ea){return fileFormat(_0x360f4f,_0x4e78ea);}})]});return _0x5675ad;}exports[_0x3406('0x25')]=consoleLogger;exports[_0x3406('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 478272d..b5d6f48 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0x170066,_0x23bc99){var _0x227b67=function(_0x2f9b47){while(--_0x2f9b47){_0x170066['push'](_0x170066['shift']());}};_0x227b67(++_0x23bc99);}(_0xadb5,0xad));var _0x5adb=function(_0x1d9bd3,_0x27dc7b){_0x1d9bd3=_0x1d9bd3-0x0;var _0x5778ee=_0xadb5[_0x1d9bd3];return _0x5778ee;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x189e4e,_0x1f22dd){var _0x1d3164=function(_0x33b858){while(--_0x33b858){_0x189e4e['push'](_0x189e4e['shift']());}};_0x1d3164(++_0x1f22dd);}(_0x0b0e,0x187));var _0xe0b0=function(_0x12a06b,_0x417b51){_0x12a06b=_0x12a06b-0x0;var _0x5d0bb8=_0x0b0e[_0x12a06b];return _0x5d0bb8;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 41ba16a..ef56479 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['safeTemplate','lodash','{\x20{\x20','string','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x41c839,_0x54da08){var _0x326aa1=function(_0x2f0932){while(--_0x2f0932){_0x41c839['push'](_0x41c839['shift']());}};_0x326aa1(++_0x54da08);}(_0x0b0e,0x187));var _0xe0b0=function(_0x454bd3,_0x3e4d94){_0x454bd3=_0x454bd3-0x0;var _0x4eb066=_0x0b0e[_0x454bd3];return _0x4eb066;};var _=require(_0xe0b0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x503596){return _0x503596==='{{'?_0xe0b0('0x1'):'\x20}\x20}';}function safeTemplate(_0x7e5a8a){var _0xdf715e=_0x7e5a8a;if(typeof _0x7e5a8a===_0xe0b0('0x2')){_0xdf715e=_0x7e5a8a[_0xe0b0('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xe0b0('0x4')](_0x7e5a8a)){_0xdf715e=_0x7e5a8a[_0xe0b0('0x5')](function(_0x399e67){return safeTemplate(_0x399e67);});}else if(_[_0xe0b0('0x6')](_0x7e5a8a)){_0xdf715e=Object[_0xe0b0('0x7')](_0x7e5a8a)[_0xe0b0('0x8')](function(_0x219b1c,_0x5cf9cc){_0x219b1c[_0x5cf9cc]=safeTemplate(_0x7e5a8a[_0x5cf9cc]);return _0x219b1c;},{});}return _0xdf715e;}module['exports'][_0xe0b0('0x9')]=safeTemplate; \ No newline at end of file +var _0x93e9=['string','map','isPlainObject','keys','reduce','exports','lodash','{\x20{\x20','\x20}\x20}'];(function(_0x3ff6a1,_0x7ff039){var _0x821a33=function(_0x3d9c47){while(--_0x3d9c47){_0x3ff6a1['push'](_0x3ff6a1['shift']());}};_0x821a33(++_0x7ff039);}(_0x93e9,0xcc));var _0x993e=function(_0x1d7fab,_0x3dfa49){_0x1d7fab=_0x1d7fab-0x0;var _0x1d27f0=_0x93e9[_0x1d7fab];return _0x1d27f0;};var _=require(_0x993e('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0xcf3bfd){return _0xcf3bfd==='{{'?_0x993e('0x1'):_0x993e('0x2');}function safeTemplate(_0x43b7b0){var _0x2a63eb=_0x43b7b0;if(typeof _0x43b7b0===_0x993e('0x3')){_0x2a63eb=_0x43b7b0['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x43b7b0)){_0x2a63eb=_0x43b7b0[_0x993e('0x4')](function(_0x255045){return safeTemplate(_0x255045);});}else if(_[_0x993e('0x5')](_0x43b7b0)){_0x2a63eb=Object[_0x993e('0x6')](_0x43b7b0)[_0x993e('0x7')](function(_0x2366d9,_0x12ac94){_0x2366d9[_0x12ac94]=safeTemplate(_0x43b7b0[_0x12ac94]);return _0x2366d9;},{});}return _0x2a63eb;}module[_0x993e('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file